From: Andrea Amorese Date: Mon, 13 Sep 2021 08:17:59 +0000 (+0200) Subject: Built motion from commit d5e88c73.|2.5.35 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;//%22avatar.png/%22?a=commitdiff_plain;h=751fbabd65af92984d2965023f4aca2f4d491c91;p=motion2.git Built motion from commit d5e88c73.|2.5.35 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 631c25e..aad66a1 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-13T07:27:38.574Z", + "time": "2021-09-13T08:07:40.444Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index d76f6d2..3fc0c7c 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-13T07:27:38.574Z", + "time": "2021-09-13T08:07:40.444Z", "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 6f166a3..ef54f56 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 _0xec47=['sequelize','getDataValue','action','STRING','contactManager','integration','motionbar','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[body]'];(function(_0x11795d,_0x228ac0){var _0x5d1f7a=function(_0x3d4cbd){while(--_0x3d4cbd){_0x11795d['push'](_0x11795d['shift']());}};_0x5d1f7a(++_0x228ac0);}(_0xec47,0x170));var _0x7ec4=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xec47[_0x51020b];return _0x371e47;};'use strict';var Sequelize=require(_0x7ec4('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1c7fd1){return this[_0x7ec4('0x1')](_0x7ec4('0x2'));}},'action':{'type':Sequelize[_0x7ec4('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x7ec4('0x4'),_0x7ec4('0x5'),_0x7ec4('0x6'),'jscripty','urlForward','browser',_0x7ec4('0x7'),_0x7ec4('0x8')]],'msg':_0x7ec4('0x9')}},'comment':_0x7ec4('0x9')},'data1':{'type':Sequelize[_0x7ec4('0x3')](0x1000),'comment':_0x7ec4('0xa')},'data2':{'type':Sequelize[_0x7ec4('0x3')](0x1000),'comment':_0x7ec4('0xb')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x7ec4('0xc')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x7ec4('0xd')},'data5':{'type':Sequelize[_0x7ec4('0x3')](0x1000),'comments':_0x7ec4('0xe')},'data6':{'type':Sequelize[_0x7ec4('0x3')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize['TEXT'],'comments':_0x7ec4('0xf')}}; \ No newline at end of file +var _0xd6e5=['browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','getDataValue','action','STRING','contactManager','integration','motionbar','urlForward'];(function(_0x24287c,_0x20a838){var _0x16663c=function(_0x149454){while(--_0x149454){_0x24287c['push'](_0x24287c['shift']());}};_0x16663c(++_0x20a838);}(_0xd6e5,0x12b));var _0x5d6e=function(_0x3780ea,_0x1adf34){_0x3780ea=_0x3780ea-0x0;var _0x19258e=_0xd6e5[_0x3780ea];return _0x19258e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5161c3){return this[_0x5d6e('0x0')](_0x5d6e('0x1'));}},'action':{'type':Sequelize[_0x5d6e('0x2')],'allowNull':![],'validate':{'isIn':{'args':[[_0x5d6e('0x3'),_0x5d6e('0x4'),_0x5d6e('0x5'),'jscripty',_0x5d6e('0x6'),_0x5d6e('0x7'),_0x5d6e('0x8'),'script']],'msg':_0x5d6e('0x9')}},'comment':_0x5d6e('0x9')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x5d6e('0xa')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x5d6e('0xb')},'data3':{'type':Sequelize[_0x5d6e('0x2')](0x1000),'comment':_0x5d6e('0xc')},'data4':{'type':Sequelize[_0x5d6e('0x2')](0x1000),'comments':_0x5d6e('0xd')},'data5':{'type':Sequelize[_0x5d6e('0x2')](0x1000),'comments':_0x5d6e('0xe')},'data6':{'type':Sequelize[_0x5d6e('0x2')],'comments':_0x5d6e('0xf')},'data7':{'type':Sequelize[_0x5d6e('0x10')],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 010cef5..e6c7021 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 _0x1ab6=['to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','apply','reject','save','update','destroy','error','stack','name','send','body','Action','find','params','then','catch','zip-dir','moment','bluebird','mustache','util','path','sox'];(function(_0xf63ddd,_0x1aa06d){var _0x3300ff=function(_0x31635b){while(--_0x31635b){_0xf63ddd['push'](_0xf63ddd['shift']());}};_0x3300ff(++_0x1aa06d);}(_0x1ab6,0x1b1));var _0x61ab=function(_0x4e62ff,_0x448530){_0x4e62ff=_0x4e62ff-0x0;var _0x3b21cd=_0x1ab6[_0x4e62ff];return _0x3b21cd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x61ab('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x61ab('0x1'));var BPromise=require(_0x61ab('0x2'));var Mustache=require(_0x61ab('0x3'));var util=require(_0x61ab('0x4'));var path=require(_0x61ab('0x5'));var sox=require(_0x61ab('0x6'));var csv=require(_0x61ab('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x61ab('0x8'));var _=require('lodash');var squel=require(_0x61ab('0x9'));var crypto=require(_0x61ab('0xa'));var jsforce=require(_0x61ab('0xb'));var deskjs=require(_0x61ab('0xc'));var toCsv=require(_0x61ab('0x7'));var querystring=require(_0x61ab('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x61ab('0xe'));var qs=require(_0x61ab('0xf'));var as=require(_0x61ab('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x61ab('0x11'));var utils=require(_0x61ab('0x12'));var config=require(_0x61ab('0x13'));var licenseUtil=require(_0x61ab('0x14'));var db=require(_0x61ab('0x15'))['db'];function respondWithStatusCode(_0x21a564,_0x1f2593){_0x1f2593=_0x1f2593||0xcc;return function(_0x10f5ca){if(_0x10f5ca){return _0x21a564[_0x61ab('0x16')](_0x1f2593);}return _0x21a564[_0x61ab('0x17')](_0x1f2593)['end']();};}function respondWithResult(_0x5dadd2,_0x37173d){_0x37173d=_0x37173d||0xc8;return function(_0x3c1795){if(_0x3c1795){return _0x5dadd2['status'](_0x37173d)[_0x61ab('0x18')](_0x3c1795);}};}function respondWithFilteredResult(_0x1666b0,_0x496bb0){return function(_0x223d2f){if(_0x223d2f){var _0x1bfe9d=typeof _0x496bb0[_0x61ab('0x19')]===_0x61ab('0x1a')&&typeof _0x496bb0['limit']===_0x61ab('0x1a');var _0x279262=_0x223d2f[_0x61ab('0x1b')];var _0x236411=_0x1bfe9d?0x0:_0x496bb0[_0x61ab('0x19')];var _0x305c81=_0x1bfe9d?_0x223d2f[_0x61ab('0x1b')]:_0x496bb0[_0x61ab('0x19')]+_0x496bb0[_0x61ab('0x1c')];var _0x2b919e;if(_0x305c81>=_0x279262){_0x305c81=_0x279262;_0x2b919e=0xc8;}else{_0x2b919e=0xce;}_0x1666b0[_0x61ab('0x17')](_0x2b919e);return _0x1666b0['set']('Content-Range',_0x236411+'-'+_0x305c81+'/'+_0x279262)[_0x61ab('0x18')](_0x223d2f);}return null;};}function patchUpdates(_0x3a10a0){return function(_0x28dde4){try{jsonpatch[_0x61ab('0x1d')](_0x28dde4,_0x3a10a0,!![]);}catch(_0x312a05){return BPromise[_0x61ab('0x1e')](_0x312a05);}return _0x28dde4[_0x61ab('0x1f')]();};}function saveUpdates(_0x3da19b,_0x52e25c){return function(_0x289560){if(_0x289560){return _0x289560[_0x61ab('0x20')](_0x3da19b)['then'](function(_0x3e32c2){return _0x3e32c2;});}return null;};}function removeEntity(_0x2c9240,_0x1ffc8f){return function(_0x70dc0a){if(_0x70dc0a){return _0x70dc0a[_0x61ab('0x21')]()['then'](function(){_0x2c9240[_0x61ab('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d8e74,_0x24302f){return function(_0x40d5bb){if(!_0x40d5bb){_0x5d8e74['sendStatus'](0x194);}return _0x40d5bb;};}function handleError(_0x1b0eba,_0x1b58eb){_0x1b58eb=_0x1b58eb||0x1f4;return function(_0x129c2b){logger[_0x61ab('0x22')](_0x129c2b[_0x61ab('0x23')]);if(_0x129c2b[_0x61ab('0x24')]){delete _0x129c2b['name'];}_0x1b0eba[_0x61ab('0x17')](_0x1b58eb)[_0x61ab('0x25')](_0x129c2b);};}exports[_0x61ab('0x20')]=function(_0x13dd86,_0x506acb){if(_0x13dd86['body']['id']){delete _0x13dd86[_0x61ab('0x26')]['id'];}return db[_0x61ab('0x27')][_0x61ab('0x28')]({'where':{'id':_0x13dd86[_0x61ab('0x29')]['id']}})[_0x61ab('0x2a')](handleEntityNotFound(_0x506acb,null))['then'](saveUpdates(_0x13dd86[_0x61ab('0x26')],null))[_0x61ab('0x2a')](respondWithResult(_0x506acb,null))[_0x61ab('0x2b')](handleError(_0x506acb,null));};exports[_0x61ab('0x21')]=function(_0x41d941,_0x3a300d){return db['Action'][_0x61ab('0x28')]({'where':{'id':_0x41d941['params']['id']}})[_0x61ab('0x2a')](handleEntityNotFound(_0x3a300d,null))[_0x61ab('0x2a')](removeEntity(_0x3a300d,null))['catch'](handleError(_0x3a300d,null));}; \ No newline at end of file +var _0x4fb1=['../../config/utils','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','body','Action','find','params','catch','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4fb1,0x127));var _0x14fb=function(_0x35b118,_0x37ed6c){_0x35b118=_0x35b118-0x0;var _0x51906b=_0x4fb1[_0x35b118];return _0x51906b;};'use strict';var emlformat=require(_0x14fb('0x0'));var rimraf=require(_0x14fb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x14fb('0x2'));var rp=require(_0x14fb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x14fb('0x4'));var util=require(_0x14fb('0x5'));var path=require('path');var sox=require(_0x14fb('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x14fb('0x7'));var _=require(_0x14fb('0x8'));var squel=require(_0x14fb('0x9'));var crypto=require(_0x14fb('0xa'));var jsforce=require(_0x14fb('0xb'));var deskjs=require(_0x14fb('0xc'));var toCsv=require(_0x14fb('0xd'));var querystring=require(_0x14fb('0xe'));var Papa=require('papaparse');var Redis=require(_0x14fb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x14fb('0x10'));var as=require(_0x14fb('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x14fb('0x12'))(_0x14fb('0x13'));var utils=require(_0x14fb('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31ac44,_0x1d74ca){_0x1d74ca=_0x1d74ca||0xcc;return function(_0x319743){if(_0x319743){return _0x31ac44[_0x14fb('0x15')](_0x1d74ca);}return _0x31ac44[_0x14fb('0x16')](_0x1d74ca)[_0x14fb('0x17')]();};}function respondWithResult(_0x91e682,_0x564cb9){_0x564cb9=_0x564cb9||0xc8;return function(_0x51aaf2){if(_0x51aaf2){return _0x91e682[_0x14fb('0x16')](_0x564cb9)[_0x14fb('0x18')](_0x51aaf2);}};}function respondWithFilteredResult(_0xcd5ba7,_0x502d85){return function(_0x555795){if(_0x555795){var _0x3b7897=typeof _0x502d85[_0x14fb('0x19')]==='undefined'&&typeof _0x502d85[_0x14fb('0x1a')]===_0x14fb('0x1b');var _0x39b5c9=_0x555795[_0x14fb('0x1c')];var _0x10c1a7=_0x3b7897?0x0:_0x502d85[_0x14fb('0x19')];var _0x407cca=_0x3b7897?_0x555795[_0x14fb('0x1c')]:_0x502d85[_0x14fb('0x19')]+_0x502d85[_0x14fb('0x1a')];var _0x2d01cc;if(_0x407cca>=_0x39b5c9){_0x407cca=_0x39b5c9;_0x2d01cc=0xc8;}else{_0x2d01cc=0xce;}_0xcd5ba7[_0x14fb('0x16')](_0x2d01cc);return _0xcd5ba7[_0x14fb('0x1d')]('Content-Range',_0x10c1a7+'-'+_0x407cca+'/'+_0x39b5c9)[_0x14fb('0x18')](_0x555795);}return null;};}function patchUpdates(_0x425a51){return function(_0x264573){try{jsonpatch[_0x14fb('0x1e')](_0x264573,_0x425a51,!![]);}catch(_0x43c195){return BPromise[_0x14fb('0x1f')](_0x43c195);}return _0x264573[_0x14fb('0x20')]();};}function saveUpdates(_0x3474e4,_0x19b4a8){return function(_0x4f068d){if(_0x4f068d){return _0x4f068d[_0x14fb('0x21')](_0x3474e4)[_0x14fb('0x22')](function(_0x2c6b50){return _0x2c6b50;});}return null;};}function removeEntity(_0x15e7b9,_0x41fbf5){return function(_0x237a9c){if(_0x237a9c){return _0x237a9c[_0x14fb('0x23')]()[_0x14fb('0x22')](function(){_0x15e7b9[_0x14fb('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5efe1e,_0x5f3d08){return function(_0x3629de){if(!_0x3629de){_0x5efe1e[_0x14fb('0x15')](0x194);}return _0x3629de;};}function handleError(_0x33a529,_0x308eab){_0x308eab=_0x308eab||0x1f4;return function(_0xca985a){logger[_0x14fb('0x24')](_0xca985a[_0x14fb('0x25')]);if(_0xca985a['name']){delete _0xca985a[_0x14fb('0x26')];}_0x33a529[_0x14fb('0x16')](_0x308eab)[_0x14fb('0x27')](_0xca985a);};}exports[_0x14fb('0x21')]=function(_0x4466da,_0xa4c3df){if(_0x4466da[_0x14fb('0x28')]['id']){delete _0x4466da['body']['id'];}return db[_0x14fb('0x29')][_0x14fb('0x2a')]({'where':{'id':_0x4466da[_0x14fb('0x2b')]['id']}})['then'](handleEntityNotFound(_0xa4c3df,null))[_0x14fb('0x22')](saveUpdates(_0x4466da['body'],null))[_0x14fb('0x22')](respondWithResult(_0xa4c3df,null))['catch'](handleError(_0xa4c3df,null));};exports[_0x14fb('0x23')]=function(_0x52498b,_0x472720){return db['Action'][_0x14fb('0x2a')]({'where':{'id':_0x52498b[_0x14fb('0x2b')]['id']}})[_0x14fb('0x22')](handleEntityNotFound(_0x472720,null))['then'](removeEntity(_0x472720,null))[_0x14fb('0x2c')](handleError(_0x472720,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 5b1ddb2..c3d5a41 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 _0x7550=['tools_actions','lodash','util','../../config/logger','api','../../config/environment','./action.attributes','define'];(function(_0x2ff391,_0x5acb82){var _0x4f0647=function(_0x3bc22c){while(--_0x3bc22c){_0x2ff391['push'](_0x2ff391['shift']());}};_0x4f0647(++_0x5acb82);}(_0x7550,0xc9));var _0x0755=function(_0x4d99d2,_0x2d8a11){_0x4d99d2=_0x4d99d2-0x0;var _0x5498c0=_0x7550[_0x4d99d2];return _0x5498c0;};'use strict';var _=require(_0x0755('0x0'));var util=require(_0x0755('0x1'));var logger=require(_0x0755('0x2'))(_0x0755('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('rimraf');var config=require(_0x0755('0x4'));var attributes=require(_0x0755('0x5'));module['exports']=function(_0xc07402,_0x53a63c){return _0xc07402[_0x0755('0x6')]('Action',attributes,{'tableName':_0x0755('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4459=['path','rimraf','../../config/environment','./action.attributes','exports','define','Action','lodash','util','../../config/logger'];(function(_0x26da5e,_0x2f4830){var _0x19932c=function(_0x681c95){while(--_0x681c95){_0x26da5e['push'](_0x26da5e['shift']());}};_0x19932c(++_0x2f4830);}(_0x4459,0xb1));var _0x9445=function(_0x3c76d3,_0x3152da){_0x3c76d3=_0x3c76d3-0x0;var _0x4e653e=_0x4459[_0x3c76d3];return _0x4e653e;};'use strict';var _=require(_0x9445('0x0'));var util=require(_0x9445('0x1'));var logger=require(_0x9445('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9445('0x3'));var rimraf=require(_0x9445('0x4'));var config=require(_0x9445('0x5'));var attributes=require(_0x9445('0x6'));module[_0x9445('0x7')]=function(_0x36c3b5,_0x29ef9c){return _0x36c3b5[_0x9445('0x8')](_0x9445('0x9'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index c608912..67ab0ff 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 _0x326f=['info','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5b58c6,_0x438edf){var _0xe140d9=function(_0x193aea){while(--_0x193aea){_0x5b58c6['push'](_0x5b58c6['shift']());}};_0xe140d9(++_0x438edf);}(_0x326f,0xd1));var _0xf326=function(_0x1cb4e3,_0x39ba88){_0x1cb4e3=_0x1cb4e3-0x0;var _0x4bdfb5=_0x326f[_0x1cb4e3];return _0x4bdfb5;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('Action,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file +var _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x1cb9,0x14e));var _0x91cb=function(_0x54561a,_0x237731){_0x54561a=_0x54561a-0x0;var _0x1f7662=_0x1cb9[_0x54561a];return _0x1f7662;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Action,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 13913b6..2aa366c 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 _0xe04d=['fs-extra','../../components/interaction/service','../../config/environment','./action.controller','isAuthenticated','update','delete','/:id','destroy','exports','multer','path','connect-timeout','Router'];(function(_0x272f84,_0x153d61){var _0x50470b=function(_0x2e0eca){while(--_0x2e0eca){_0x272f84['push'](_0x272f84['shift']());}};_0x50470b(++_0x153d61);}(_0xe04d,0xdc));var _0xde04=function(_0x55c1f0,_0x4f574f){_0x55c1f0=_0x55c1f0-0x0;var _0x1530fa=_0xe04d[_0x55c1f0];return _0x1530fa;};'use strict';var multer=require(_0xde04('0x0'));var util=require('util');var path=require(_0xde04('0x1'));var timeout=require(_0xde04('0x2'));var express=require('express');var router=express[_0xde04('0x3')]();var fs_extra=require(_0xde04('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xde04('0x5'));var config=require(_0xde04('0x6'));var controller=require(_0xde04('0x7'));router['put']('/:id',auth[_0xde04('0x8')](),controller[_0xde04('0x9')]);router[_0xde04('0xa')](_0xde04('0xb'),auth[_0xde04('0x8')](),controller[_0xde04('0xc')]);module[_0xde04('0xd')]=router; \ No newline at end of file +var _0x8d6d=['destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update','delete'];(function(_0x293910,_0x2cd856){var _0x46734a=function(_0x59e527){while(--_0x59e527){_0x293910['push'](_0x293910['shift']());}};_0x46734a(++_0x2cd856);}(_0x8d6d,0x8e));var _0xd8d6=function(_0x4873c4,_0x9b8ba7){_0x4873c4=_0x4873c4-0x0;var _0x433316=_0x8d6d[_0x4873c4];return _0x433316;};'use strict';var multer=require('multer');var util=require(_0xd8d6('0x0'));var path=require(_0xd8d6('0x1'));var timeout=require('connect-timeout');var express=require(_0xd8d6('0x2'));var router=express[_0xd8d6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd8d6('0x4'));var interaction=require(_0xd8d6('0x5'));var config=require(_0xd8d6('0x6'));var controller=require('./action.controller');router[_0xd8d6('0x7')](_0xd8d6('0x8'),auth[_0xd8d6('0x9')](),controller[_0xd8d6('0xa')]);router[_0xd8d6('0xb')](_0xd8d6('0x8'),auth[_0xd8d6('0x9')](),controller[_0xd8d6('0xc')]);module[_0xd8d6('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 457b8e1..9a42a9b 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 _0xf2ca=['STRING','TEXT','sequelize','exports'];(function(_0x32cfed,_0x278ecd){var _0x5735e9=function(_0x20af72){while(--_0x20af72){_0x32cfed['push'](_0x32cfed['shift']());}};_0x5735e9(++_0x278ecd);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x257495,_0x18269b){_0x257495=_0x257495-0x0;var _0x3849aa=_0xf2ca[_0x257495];return _0x3849aa;};'use strict';var Sequelize=require(_0xaf2c('0x0'));module[_0xaf2c('0x1')]={'name':{'type':Sequelize[_0xaf2c('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xaf2c('0x2')]},'table':{'type':Sequelize[_0xaf2c('0x2')]},'conditions':{'type':Sequelize[_0xaf2c('0x3')]},'joins':{'type':Sequelize[_0xaf2c('0x3')]}}; \ No newline at end of file +var _0x687b=['STRING','TEXT','sequelize','exports'];(function(_0x2454da,_0x4fd1ec){var _0x10e3a0=function(_0x5ce015){while(--_0x5ce015){_0x2454da['push'](_0x2454da['shift']());}};_0x10e3a0(++_0x4fd1ec);}(_0x687b,0x14a));var _0xb687=function(_0x219729,_0x19f07d){_0x219729=_0x219729-0x0;var _0x35c464=_0x687b[_0x219729];return _0x35c464;};'use strict';var Sequelize=require(_0xb687('0x0'));module[_0xb687('0x1')]={'name':{'type':Sequelize[_0xb687('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb687('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xb687('0x3')]},'joins':{'type':Sequelize[_0xb687('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index e632864..fd43e9d 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 _0x31a5=['Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','MetricId','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','COUNT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','condition','value','from','metric','field','parentKey','output','web','fullPath','%s-%s.%s','randomstring','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','QueryTypes','run','runReport','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','CustomReports','UserProfileResource','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','AnalyticCustomReport','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','rules','operator','group','getFields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x31a5,0x186));var _0x531a=function(_0x2044ba,_0x1ebab8){_0x2044ba=_0x2044ba-0x0;var _0x2fa276=_0x31a5[_0x2044ba];return _0x2fa276;};'use strict';var emlformat=require(_0x531a('0x0'));var rimraf=require(_0x531a('0x1'));var zipdir=require(_0x531a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x531a('0x3'));var moment=require(_0x531a('0x4'));var BPromise=require(_0x531a('0x5'));var Mustache=require(_0x531a('0x6'));var util=require(_0x531a('0x7'));var path=require(_0x531a('0x8'));var sox=require(_0x531a('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x531a('0xa'));var _=require(_0x531a('0xb'));var squel=require(_0x531a('0xc'));var crypto=require('crypto');var jsforce=require(_0x531a('0xd'));var deskjs=require(_0x531a('0xe'));var toCsv=require(_0x531a('0xf'));var querystring=require(_0x531a('0x10'));var Papa=require(_0x531a('0x11'));var Redis=require(_0x531a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x531a('0x13'));var as=require(_0x531a('0x14'));var hardwareService=require(_0x531a('0x15'));var logger=require(_0x531a('0x16'))(_0x531a('0x17'));var utils=require(_0x531a('0x18'));var config=require(_0x531a('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x531a('0x1a'))['db'];var dbH=require('../../mysqldb')[_0x531a('0x1b')];function respondWithStatusCode(_0x4930d6,_0x379c7f){_0x379c7f=_0x379c7f||0xcc;return function(_0x485bd3){if(_0x485bd3){return _0x4930d6[_0x531a('0x1c')](_0x379c7f);}return _0x4930d6[_0x531a('0x1d')](_0x379c7f)['end']();};}function respondWithResult(_0x1e8949,_0x5ead7e){_0x5ead7e=_0x5ead7e||0xc8;return function(_0x244ee4){if(_0x244ee4){return _0x1e8949[_0x531a('0x1d')](_0x5ead7e)[_0x531a('0x1e')](_0x244ee4);}};}function respondWithFilteredResult(_0x13e0e5,_0xda4fcd){return function(_0x2905be){if(_0x2905be){var _0x1423d5=typeof _0xda4fcd[_0x531a('0x1f')]===_0x531a('0x20')&&typeof _0xda4fcd[_0x531a('0x21')]===_0x531a('0x20');var _0x43ebfd=_0x2905be[_0x531a('0x22')];var _0x53de84=_0x1423d5?0x0:_0xda4fcd[_0x531a('0x1f')];var _0x287410=_0x1423d5?_0x2905be[_0x531a('0x22')]:_0xda4fcd[_0x531a('0x1f')]+_0xda4fcd['limit'];var _0x57b9fe;if(_0x287410>=_0x43ebfd){_0x287410=_0x43ebfd;_0x57b9fe=0xc8;}else{_0x57b9fe=0xce;}_0x13e0e5['status'](_0x57b9fe);return _0x13e0e5[_0x531a('0x23')]('Content-Range',_0x53de84+'-'+_0x287410+'/'+_0x43ebfd)['json'](_0x2905be);}return null;};}function patchUpdates(_0x24ad78){return function(_0x23a34f){try{jsonpatch[_0x531a('0x24')](_0x23a34f,_0x24ad78,!![]);}catch(_0x26beea){return BPromise[_0x531a('0x25')](_0x26beea);}return _0x23a34f[_0x531a('0x26')]();};}function saveUpdates(_0x28e872,_0x308417){return function(_0x4f4888){if(_0x4f4888){return _0x4f4888['update'](_0x28e872)[_0x531a('0x27')](function(_0x58f9d1){return _0x58f9d1;});}return null;};}function removeEntity(_0x5e984d,_0x3e6db3){return function(_0xa0d3b9){if(_0xa0d3b9){return _0xa0d3b9['destroy']()[_0x531a('0x27')](function(){var _0x233882=_0xa0d3b9['get']({'plain':!![]});var _0x2b6e32=_0x531a('0x28');return db[_0x531a('0x29')][_0x531a('0x2a')]({'where':{'type':_0x2b6e32,'resourceId':_0x233882['id']}})['then'](function(){return _0xa0d3b9;});})[_0x531a('0x27')](function(){_0x5e984d[_0x531a('0x1d')](0xcc)[_0x531a('0x2b')]();});}};}function handleEntityNotFound(_0x59ec64,_0xb363ef){return function(_0x143e48){if(!_0x143e48){_0x59ec64[_0x531a('0x1c')](0x194);}return _0x143e48;};}function handleError(_0x3da027,_0x5cbab4){_0x5cbab4=_0x5cbab4||0x1f4;return function(_0x2def8b){logger[_0x531a('0x2c')](_0x2def8b[_0x531a('0x2d')]);if(_0x2def8b[_0x531a('0x2e')]){delete _0x2def8b['name'];}_0x3da027['status'](_0x5cbab4)[_0x531a('0x2f')](_0x2def8b);};}exports[_0x531a('0x30')]=function(_0x5c852d,_0x11edad){var _0x2ec1cf={},_0x4c4b8c={},_0x541b2d={'count':0x0,'rows':[]};var _0x16e6c1=_[_0x531a('0x31')](db['AnalyticCustomReport'][_0x531a('0x32')],function(_0x1ad8c0){return{'name':_0x1ad8c0[_0x531a('0x33')],'type':_0x1ad8c0[_0x531a('0x34')]['key']};});_0x4c4b8c[_0x531a('0x35')]=_['map'](_0x16e6c1,'name');_0x4c4b8c[_0x531a('0x36')]=_[_0x531a('0x37')](_0x5c852d[_0x531a('0x36')]);_0x4c4b8c[_0x531a('0x38')]=_[_0x531a('0x39')](_0x4c4b8c[_0x531a('0x35')],_0x4c4b8c[_0x531a('0x36')]);_0x2ec1cf[_0x531a('0x3a')]=_[_0x531a('0x39')](_0x4c4b8c['model'],qs[_0x531a('0x3b')](_0x5c852d[_0x531a('0x36')]['fields']));_0x2ec1cf['attributes']=_0x2ec1cf[_0x531a('0x3a')][_0x531a('0x3c')]?_0x2ec1cf[_0x531a('0x3a')]:_0x4c4b8c['model'];if(!_0x5c852d[_0x531a('0x36')]['hasOwnProperty']('nolimit')){_0x2ec1cf[_0x531a('0x21')]=qs[_0x531a('0x21')](_0x5c852d['query']['limit']);_0x2ec1cf[_0x531a('0x1f')]=qs['offset'](_0x5c852d['query']['offset']);}_0x2ec1cf[_0x531a('0x3d')]=qs[_0x531a('0x3e')](_0x5c852d['query']['sort']);_0x2ec1cf['where']=qs['filters'](_['pick'](_0x5c852d[_0x531a('0x36')],_0x4c4b8c[_0x531a('0x38')]),_0x16e6c1);if(_0x5c852d[_0x531a('0x36')]['filter']){_0x2ec1cf[_0x531a('0x3f')]=_['merge'](_0x2ec1cf[_0x531a('0x3f')],{'$or':_[_0x531a('0x31')](_0x16e6c1,function(_0x4dd6e3){if(_0x4dd6e3[_0x531a('0x34')]!==_0x531a('0x40')){var _0x5278c8={};_0x5278c8[_0x4dd6e3[_0x531a('0x2e')]]={'$like':'%'+_0x5c852d[_0x531a('0x36')]['filter']+'%'};return _0x5278c8;}})});}_0x2ec1cf=_[_0x531a('0x41')]({},_0x2ec1cf,_0x5c852d[_0x531a('0x42')]);var _0x3e7442={'where':_0x2ec1cf[_0x531a('0x3f')]};return db['AnalyticCustomReport'][_0x531a('0x22')](_0x3e7442)[_0x531a('0x27')](function(_0x49e146){_0x541b2d[_0x531a('0x22')]=_0x49e146;if(_0x5c852d[_0x531a('0x36')][_0x531a('0x43')]){_0x2ec1cf[_0x531a('0x44')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x531a('0x45')](_0x2ec1cf);})[_0x531a('0x27')](function(_0x586f37){_0x541b2d[_0x531a('0x46')]=_0x586f37;return _0x541b2d;})[_0x531a('0x27')](respondWithFilteredResult(_0x11edad,_0x2ec1cf))['catch'](handleError(_0x11edad,null));};exports[_0x531a('0x47')]=function(_0x3d2e0c,_0x29b8db){var _0x2643bc={'raw':![],'where':{'id':_0x3d2e0c[_0x531a('0x48')]['id']}},_0x1b67b5={};_0x1b67b5[_0x531a('0x35')]=_['keys'](db['AnalyticCustomReport']['rawAttributes']);_0x1b67b5[_0x531a('0x36')]=_[_0x531a('0x37')](_0x3d2e0c['query']);_0x1b67b5[_0x531a('0x38')]=_['intersection'](_0x1b67b5['model'],_0x1b67b5[_0x531a('0x36')]);_0x2643bc[_0x531a('0x3a')]=_[_0x531a('0x39')](_0x1b67b5[_0x531a('0x35')],qs[_0x531a('0x3b')](_0x3d2e0c['query']['fields']));_0x2643bc[_0x531a('0x3a')]=_0x2643bc[_0x531a('0x3a')][_0x531a('0x3c')]?_0x2643bc[_0x531a('0x3a')]:_0x1b67b5[_0x531a('0x35')];if(_0x3d2e0c['query'][_0x531a('0x43')]){_0x2643bc['include']=[{'all':!![]}];}_0x2643bc=_[_0x531a('0x41')]({},_0x2643bc,_0x3d2e0c['options']);return db[_0x531a('0x49')][_0x531a('0x4a')](_0x2643bc)[_0x531a('0x27')](handleEntityNotFound(_0x29b8db,null))[_0x531a('0x27')](respondWithResult(_0x29b8db,null))[_0x531a('0x4b')](handleError(_0x29b8db,null));};exports[_0x531a('0x4c')]=function(_0x1fa1ed,_0x3ee842){return db[_0x531a('0x49')][_0x531a('0x4c')](_0x1fa1ed[_0x531a('0x4d')],{})[_0x531a('0x27')](function(_0x40c4e1){var _0x54a852=_0x1fa1ed[_0x531a('0x4e')][_0x531a('0x4f')]({'plain':!![]});if(!_0x54a852)throw new Error(_0x531a('0x50'));if(_0x54a852['role']===_0x531a('0x4e')){var _0x42a782=_0x40c4e1[_0x531a('0x4f')]({'plain':!![]});var _0x5cbf88=_0x531a('0x51');return db['UserProfileSection'][_0x531a('0x4a')]({'where':{'name':_0x5cbf88,'userProfileId':_0x54a852['userProfileId']},'raw':!![]})[_0x531a('0x27')](function(_0x140eb2){if(_0x140eb2&&_0x140eb2[_0x531a('0x52')]===0x0){return db[_0x531a('0x29')][_0x531a('0x4c')]({'name':_0x42a782['name'],'resourceId':_0x42a782['id'],'type':_0x531a('0x28'),'sectionId':_0x140eb2['id']},{})['then'](function(){return _0x40c4e1;});}else{return _0x40c4e1;}})[_0x531a('0x4b')](function(_0x5d1a29){logger['error'](_0x531a('0x53'),_0x5d1a29);throw _0x5d1a29;});}return _0x40c4e1;})[_0x531a('0x27')](respondWithResult(_0x3ee842,0xc9))[_0x531a('0x4b')](handleError(_0x3ee842,null));};exports['update']=function(_0x2aeb94,_0x2fbbb9){if(_0x2aeb94['body']['id']){delete _0x2aeb94['body']['id'];}return db[_0x531a('0x49')][_0x531a('0x4a')]({'where':{'id':_0x2aeb94[_0x531a('0x48')]['id']}})['then'](handleEntityNotFound(_0x2fbbb9,null))[_0x531a('0x27')](saveUpdates(_0x2aeb94[_0x531a('0x4d')],null))[_0x531a('0x27')](respondWithResult(_0x2fbbb9,null))[_0x531a('0x4b')](handleError(_0x2fbbb9,null));};exports['destroy']=function(_0x2fe058,_0x197441){return db['AnalyticCustomReport'][_0x531a('0x4a')]({'where':{'id':_0x2fe058[_0x531a('0x48')]['id']}})[_0x531a('0x27')](handleEntityNotFound(_0x197441,null))[_0x531a('0x27')](removeEntity(_0x197441,null))['catch'](handleError(_0x197441,null));};exports[_0x531a('0x54')]=function(_0x22a4e1,_0x326af0){var _0x64c79d=0xa;var _0x149b7a=[_0x531a('0x55'),_0x531a('0x56'),_0x531a('0x57'),_0x531a('0x58')];var _0x12868f={'SUM':_0x531a('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x531a('0x5a'),'MAX':_0x531a('0x5b'),'MIN':_0x531a('0x5c'),'AVG':_0x531a('0x5d'),'GROUP_CONCAT':_0x531a('0x5e'),'GROUP_CONCAT ASC':_0x531a('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x27c3a1={'SEC_TO_TIME':_0x531a('0x60'),'DATE':_0x531a('0x61'),'HOUR':_0x531a('0x62'),'ROUND':_0x531a('0x63'),'UNIX_TIMESTAMP':_0x531a('0x64')};var _0x4c7536=function(_0x2dfefb){return!_[_0x531a('0x65')]([_0x531a('0x66'),'IS\x20NOT\x20NULL',_0x531a('0x67'),'IS\x20NOT\x20EMPTY'],_0x2dfefb);};var _0xf60a4=function(_0x108dc6){if(!_0x108dc6||!_0x108dc6[_0x531a('0x68')]['length']){return'';}for(var _0x71153a='(',_0x383606=0x0;_0x383606<_0x108dc6['rules'][_0x531a('0x3c')];_0x383606+=0x1){_0x383606>0x0&&(_0x71153a+='\x20'+_0x108dc6[_0x531a('0x69')]+'\x20');_0x71153a+=_0x108dc6[_0x531a('0x68')][_0x383606][_0x531a('0x6a')]?_0xf60a4(_0x108dc6[_0x531a('0x68')][_0x383606][_0x531a('0x6a')]):_0x108dc6[_0x531a('0x68')][_0x383606]['field']+'\x20'+_0x108dc6[_0x531a('0x68')][_0x383606]['condition']+(_0x4c7536(_0x108dc6[_0x531a('0x68')][_0x383606]['condition'])?'\x20'+_0x108dc6[_0x531a('0x68')][_0x383606]['value']:'');}return _0x71153a+')';};var _0x361fbf={'where':{'id':_0x22a4e1[_0x531a('0x48')]['id']}},_0x17cc8e,_0x5e0afc,_0x47a051,_0x33cb5a,_0x5ac4dc;_0x361fbf=_[_0x531a('0x41')]({},_0x361fbf,_0x22a4e1[_0x531a('0x42')]);return db[_0x531a('0x49')][_0x531a('0x4a')](_0x361fbf)[_0x531a('0x27')](function(_0x8e202f){if(_0x8e202f){_0x17cc8e=_0x8e202f;return _0x8e202f[_0x531a('0x6b')]();}return null;})[_0x531a('0x27')](function(_0x38a1c6){if(_0x38a1c6){if(!_0x38a1c6['length']){throw new db[(_0x531a('0x6c'))][(_0x531a('0x6d'))](_0x531a('0x6e'),0x193);}_0x5e0afc=_0x38a1c6;return db[_0x531a('0x6f')][_0x531a('0x45')]({'raw':!![]});}return null;})[_0x531a('0x27')](function(_0x3c48b0){if(_0x3c48b0){_0x47a051=_[_0x531a('0x70')](_0x3c48b0,'id');var _0x37db94;var _0x406513=squel[_0x531a('0x71')]();_0x406513['from'](_0x17cc8e['table']);for(var _0x13ddff=0x0;_0x13ddff<_0x5e0afc[_0x531a('0x3c')];_0x13ddff+=0x1){_0x37db94=_0x5e0afc[_0x13ddff][_0x531a('0x72')]?_0x47a051[_0x5e0afc[_0x13ddff][_0x531a('0x72')]]['metric']:_0x5e0afc[_0x13ddff]['field'];_0x37db94=_0x5e0afc[_0x13ddff][_0x531a('0x73')]?_[_0x531a('0x74')](_0x12868f[_0x5e0afc[_0x13ddff]['function']],'%s',_0x37db94):_0x37db94;_0x37db94=_0x5e0afc[_0x13ddff][_0x531a('0x75')]?_[_0x531a('0x74')](_0x27c3a1[_0x5e0afc[_0x13ddff][_0x531a('0x75')]],'%s',_0x37db94):_0x37db94;if(_0x5e0afc[_0x13ddff][_0x531a('0x76')]){_0x406513[_0x531a('0x6a')](_0x37db94);}_0x5e0afc[_0x13ddff][_0x531a('0x77')]&&_0x406513['order'](_0x37db94,_0x5e0afc[_0x13ddff][_0x531a('0x77')]===_0x531a('0x78')?![]:!![]);_0x406513['field'](_0x37db94,_0x5e0afc[_0x13ddff][_0x531a('0x79')]||_0x37db94);}if(_0x17cc8e[_0x531a('0x7a')]){_0x17cc8e['joins']=JSON[_0x531a('0x7b')](_0x17cc8e[_0x531a('0x7a')]);for(var _0x120a26=0x0;_0x120a26<_0x17cc8e[_0x531a('0x7a')][_0x531a('0x3c')];_0x120a26+=0x1){if(_0x17cc8e[_0x531a('0x7a')][_0x120a26][_0x531a('0x34')]&&_[_0x531a('0x65')](_0x149b7a,_0x17cc8e[_0x531a('0x7a')][_0x120a26][_0x531a('0x34')])&&_0x17cc8e[_0x531a('0x7a')][_0x120a26]['parentKey']&&_0x17cc8e[_0x531a('0x7a')][_0x120a26][_0x531a('0x7c')]&&_0x17cc8e[_0x531a('0x7a')][_0x120a26][_0x531a('0x7d')]){_0x406513[_0x17cc8e[_0x531a('0x7a')][_0x120a26]['type']](_0x17cc8e['joins'][_0x120a26]['foreignTable'],null,util['format'](_0x531a('0x7e'),_0x17cc8e[_0x531a('0x7f')],_0x17cc8e[_0x531a('0x7a')][_0x120a26]['parentKey'],_0x17cc8e[_0x531a('0x7a')][_0x120a26][_0x531a('0x7c')],_0x17cc8e[_0x531a('0x7a')][_0x120a26]['foreignKey']));}}}if(_0x17cc8e[_0x531a('0x80')]){_0x17cc8e[_0x531a('0x80')]=JSON[_0x531a('0x7b')](_0x17cc8e[_0x531a('0x80')]);_0x406513[_0x531a('0x3f')](_0xf60a4(_0x17cc8e['conditions'][_0x531a('0x6a')]));}_0x5ac4dc=_0x406513[_0x531a('0x81')]();_0x406513[_0x531a('0x21')](_0x64c79d);_0x406513['offset'](0x0);logger[_0x531a('0x82')](_0x531a('0x83'),_0x406513[_0x531a('0x84')]());return dbH['sequelize']['query'](_0x406513[_0x531a('0x84')](),{'type':dbH[_0x531a('0x85')]['QueryTypes'][_0x531a('0x86')]});}})['then'](respondWithResult(_0x326af0,null))['catch'](handleError(_0x326af0,null));};function runReport(_0x4e4dbe,_0x3ae83b,_0x2c2832){var _0x52b266=_0x3ae83b[_0x531a('0x2e')];var _0x436364=0xa;var _0x53bcda=[_0x531a('0x55'),_0x531a('0x56'),_0x531a('0x57'),'cross_join'];var _0x540c15={'SUM':_0x531a('0x59'),'COUNT':_0x531a('0x87'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x531a('0x5b'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x531a('0x5e'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x531a('0x88')};var _0x35fc1a={'SEC_TO_TIME':_0x531a('0x60'),'DATE':_0x531a('0x61'),'HOUR':_0x531a('0x62'),'ROUND':_0x531a('0x63'),'UNIX_TIMESTAMP':_0x531a('0x64')};var _0x2ba3ff=function(_0x3c2f8a){return!_['includes']([_0x531a('0x66'),_0x531a('0x89'),_0x531a('0x67'),_0x531a('0x8a')],_0x3c2f8a);};var _0x2699ce=function(_0x30ad36){if(!_0x30ad36||!_0x30ad36[_0x531a('0x68')][_0x531a('0x3c')]){return'';}for(var _0x19bd0f='(',_0x4e5bed=0x0;_0x4e5bed<_0x30ad36[_0x531a('0x68')][_0x531a('0x3c')];_0x4e5bed+=0x1){_0x4e5bed>0x0&&(_0x19bd0f+='\x20'+_0x30ad36[_0x531a('0x69')]+'\x20');_0x19bd0f+=_0x30ad36['rules'][_0x4e5bed][_0x531a('0x6a')]?_0x2699ce(_0x30ad36[_0x531a('0x68')][_0x4e5bed][_0x531a('0x6a')]):_0x30ad36['rules'][_0x4e5bed]['field']+'\x20'+_0x30ad36[_0x531a('0x68')][_0x4e5bed][_0x531a('0x8b')]+(_0x2ba3ff(_0x30ad36['rules'][_0x4e5bed][_0x531a('0x8b')])?'\x20'+_0x30ad36['rules'][_0x4e5bed][_0x531a('0x8c')]:'');}return _0x19bd0f+')';};var _0x19a9d3={'where':{'id':_0x4e4dbe['id']}},_0x3062fc,_0x3bfe6f,_0x57fc5,_0x5d7398,_0x5c5c7a;_0x19a9d3=_['merge']({},_0x19a9d3,_0x2c2832);return db[_0x531a('0x49')][_0x531a('0x4a')](_0x19a9d3)[_0x531a('0x27')](function(_0xc1047c){if(_0xc1047c){_0x3062fc=_0xc1047c;return _0xc1047c[_0x531a('0x6b')]();}return null;})[_0x531a('0x27')](function(_0x530189){if(_0x530189){if(!_0x530189['length']){throw new db[(_0x531a('0x6c'))][(_0x531a('0x6d'))](_0x531a('0x6e'),0x193);}_0x3bfe6f=_0x530189;return db['AnalyticMetric'][_0x531a('0x45')]({'raw':!![]});}return null;})['then'](function(_0x316189){if(_0x316189){_0x57fc5=_[_0x531a('0x70')](_0x316189,'id');var _0x52163b;var _0x1c4c3a=squel[_0x531a('0x71')]();_0x1c4c3a[_0x531a('0x8d')](_0x3062fc[_0x531a('0x7f')]);for(var _0x1bf37e=0x0;_0x1bf37e<_0x3bfe6f[_0x531a('0x3c')];_0x1bf37e+=0x1){_0x52163b=_0x3bfe6f[_0x1bf37e][_0x531a('0x72')]?_0x57fc5[_0x3bfe6f[_0x1bf37e]['MetricId']][_0x531a('0x8e')]:_0x3bfe6f[_0x1bf37e][_0x531a('0x8f')];_0x52163b=_0x3bfe6f[_0x1bf37e][_0x531a('0x73')]?_[_0x531a('0x74')](_0x540c15[_0x3bfe6f[_0x1bf37e]['function']],'%s',_0x52163b):_0x52163b;_0x52163b=_0x3bfe6f[_0x1bf37e][_0x531a('0x75')]?_[_0x531a('0x74')](_0x35fc1a[_0x3bfe6f[_0x1bf37e][_0x531a('0x75')]],'%s',_0x52163b):_0x52163b;if(_0x3bfe6f[_0x1bf37e]['groupBy']){_0x1c4c3a[_0x531a('0x6a')](_0x52163b);}_0x3bfe6f[_0x1bf37e][_0x531a('0x77')]&&_0x1c4c3a[_0x531a('0x3d')](_0x52163b,_0x3bfe6f[_0x1bf37e][_0x531a('0x77')]===_0x531a('0x78')?![]:!![]);_0x1c4c3a[_0x531a('0x8f')](_0x52163b,_0x3bfe6f[_0x1bf37e]['alias']||_0x52163b);}if(_0x3062fc[_0x531a('0x7a')]){_0x3062fc[_0x531a('0x7a')]=JSON['parse'](_0x3062fc[_0x531a('0x7a')]);for(var _0x431b3b=0x0;_0x431b3b<_0x3062fc[_0x531a('0x7a')]['length'];_0x431b3b+=0x1){if(_0x3062fc[_0x531a('0x7a')][_0x431b3b]['type']&&_[_0x531a('0x65')](_0x53bcda,_0x3062fc[_0x531a('0x7a')][_0x431b3b][_0x531a('0x34')])&&_0x3062fc[_0x531a('0x7a')][_0x431b3b][_0x531a('0x90')]&&_0x3062fc[_0x531a('0x7a')][_0x431b3b][_0x531a('0x7c')]&&_0x3062fc[_0x531a('0x7a')][_0x431b3b][_0x531a('0x7d')]){_0x1c4c3a[_0x3062fc[_0x531a('0x7a')][_0x431b3b][_0x531a('0x34')]](_0x3062fc['joins'][_0x431b3b][_0x531a('0x7c')],null,util[_0x531a('0x75')](_0x531a('0x7e'),_0x3062fc[_0x531a('0x7f')],_0x3062fc[_0x531a('0x7a')][_0x431b3b][_0x531a('0x90')],_0x3062fc[_0x531a('0x7a')][_0x431b3b]['foreignTable'],_0x3062fc[_0x531a('0x7a')][_0x431b3b][_0x531a('0x7d')]));}}}if(_0x3062fc[_0x531a('0x80')]){_0x3062fc[_0x531a('0x80')]=JSON['parse'](_0x3062fc[_0x531a('0x80')]);_0x1c4c3a[_0x531a('0x3f')](_0x2699ce(_0x3062fc[_0x531a('0x80')]['group']));}_0x5c5c7a=_0x1c4c3a[_0x531a('0x81')]();_0x1c4c3a['limit'](_0x436364);_0x1c4c3a['offset'](0x0);return;}})[_0x531a('0x27')](function(){if(_0x3ae83b[_0x531a('0x91')]===_0x531a('0x92')){return null;}var _0x1221ad=_[_0x531a('0x41')](_0x3ae83b,{'name':_0x3ae83b[_0x531a('0x93')]||_0x3ae83b[_0x531a('0x2e')]||_0x3062fc['name'],'basename':_0x52b266,'savename':util[_0x531a('0x75')](_0x531a('0x94'),_0x3ae83b['name']||_0x3062fc[_0x531a('0x2e')],require(_0x531a('0x95'))['generate'](0x4),_0x3ae83b[_0x531a('0x91')]||'csv'),'reportId':_0x3062fc['id'],'reportType':_0x531a('0x96')});return db['AnalyticExtractedReport']['create'](_0x1221ad,{'raw':!![]});})[_0x531a('0x27')](function(_0x56daf3){if(_0x3062fc['table']===_0x531a('0x97')){_0x5c5c7a['where'](_0x3062fc[_0x531a('0x7f')]+_0x531a('0x98'),_0x3ae83b[_0x531a('0x99')],_0x3ae83b[_0x531a('0x9a')]);}else{_0x5c5c7a[_0x531a('0x3f')](_0x3062fc[_0x531a('0x7f')]+_0x531a('0x9b'),_0x3ae83b['startDate'],_0x3ae83b[_0x531a('0x9a')]);}if(_0x56daf3){logger[_0x531a('0x9c')]('Run\x20Query:',_0x5c5c7a[_0x531a('0x84')]());require(_0x531a('0x9d'))[_0x531a('0x9e')](path[_0x531a('0x55')](__dirname,_0x531a('0x9f'),_0x56daf3[_0x531a('0x91')]),[_0x56daf3['id'],_0x5c5c7a[_0x531a('0x84')](),path['join'](__dirname,_0x531a('0xa0'),_0x56daf3[_0x531a('0xa1')]),_0x52b266]);return _0x56daf3;}else{var _0x255265=squel[_0x531a('0x71')]();_0x255265['from']('('+_0x5c5c7a[_0x531a('0x84')]()+')','countTable');_0x255265['field'](_0x531a('0xa2'),_0x531a('0x22'));_0x5c5c7a[_0x531a('0x21')](_0x3ae83b[_0x531a('0x21')]||_0x436364);_0x5c5c7a[_0x531a('0x1f')](_0x3ae83b['offset']||0x0);return dbH[_0x531a('0x85')][_0x531a('0x36')](_0x255265['toString'](),{'type':dbH[_0x531a('0x85')][_0x531a('0xa3')][_0x531a('0x86')]})[_0x531a('0x27')](function(_0x56e5be){if(!_0x56e5be[_0x531a('0x3c')]){_0x5d7398=0x0;}else{_0x5d7398=_0x56e5be[0x0][_0x531a('0x22')]||0x0;}return dbH['sequelize'][_0x531a('0x36')](_0x5c5c7a[_0x531a('0x84')](),{'type':dbH['sequelize'][_0x531a('0xa3')][_0x531a('0x86')]});})[_0x531a('0x27')](function(_0x5b977f){return{'rows':_0x5b977f||[],'count':_0x5d7398};});}});}exports[_0x531a('0xa4')]=function(_0x328eed,_0x32ac85){return runReport(_0x328eed[_0x531a('0x48')],_0x328eed[_0x531a('0x36')],_0x328eed[_0x531a('0x42')])[_0x531a('0x27')](respondWithResult(_0x32ac85,null))[_0x531a('0x4b')](handleError(_0x32ac85,null));};exports[_0x531a('0xa5')]=runReport;exports['query']=function(_0xe46a8b,_0x3791c1){var _0x388ded=0xa;var _0x2977ee=[_0x531a('0x55'),_0x531a('0x56'),_0x531a('0x57'),_0x531a('0x58')];var _0x4b6077={'SUM':_0x531a('0x59'),'COUNT':_0x531a('0x87'),'COUNT DISTINCT':_0x531a('0x5a'),'MAX':'MAX(%s)','MIN':_0x531a('0x5c'),'AVG':_0x531a('0x5d'),'GROUP_CONCAT':_0x531a('0x5e'),'GROUP_CONCAT ASC':_0x531a('0x5f'),'GROUP_CONCAT DESC':_0x531a('0x88')};var _0x4e115d={'SEC_TO_TIME':_0x531a('0x60'),'DATE':'DATE(%s)','HOUR':_0x531a('0x62'),'ROUND':_0x531a('0x63'),'UNIX_TIMESTAMP':_0x531a('0x64')};var _0x3c705f=function(_0x4cc764){return!_[_0x531a('0x65')](['IS\x20NULL',_0x531a('0x89'),_0x531a('0x67'),_0x531a('0x8a')],_0x4cc764);};var _0x44d608=function(_0x3846d1){if(!_0x3846d1||!_0x3846d1[_0x531a('0x68')][_0x531a('0x3c')]){return'';}for(var _0x3da266='(',_0x4a8c2a=0x0;_0x4a8c2a<_0x3846d1['rules'][_0x531a('0x3c')];_0x4a8c2a+=0x1){_0x4a8c2a>0x0&&(_0x3da266+='\x20'+_0x3846d1[_0x531a('0x69')]+'\x20');_0x3da266+=_0x3846d1[_0x531a('0x68')][_0x4a8c2a][_0x531a('0x6a')]?_0x44d608(_0x3846d1[_0x531a('0x68')][_0x4a8c2a][_0x531a('0x6a')]):_0x3846d1[_0x531a('0x68')][_0x4a8c2a][_0x531a('0x8f')]+'\x20'+_0x3846d1[_0x531a('0x68')][_0x4a8c2a][_0x531a('0x8b')]+(_0x3c705f(_0x3846d1[_0x531a('0x68')][_0x4a8c2a][_0x531a('0x8b')])?'\x20'+_0x3846d1[_0x531a('0x68')][_0x4a8c2a][_0x531a('0x8c')]:'');}return _0x3da266+')';};var _0x25d429={'where':{'id':_0xe46a8b[_0x531a('0x48')]['id']}},_0x3a2da5,_0x210d1b,_0x7d5b94,_0x25b4a6,_0x5d8385;_0x25d429=_['merge']({},_0x25d429,_0xe46a8b[_0x531a('0x42')]);return db[_0x531a('0x49')]['find'](_0x25d429)[_0x531a('0x27')](function(_0x30a8fe){if(_0x30a8fe){_0x3a2da5=_0x30a8fe;return _0x30a8fe[_0x531a('0x6b')]();}return null;})['then'](function(_0x82ce23){if(_0x82ce23){if(!_0x82ce23[_0x531a('0x3c')]){throw new db['Sequelize'][(_0x531a('0x6d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x210d1b=_0x82ce23;return db[_0x531a('0x6f')][_0x531a('0x45')]({'raw':!![]});}return null;})[_0x531a('0x27')](function(_0x263db2){if(_0x263db2){_0x7d5b94=_[_0x531a('0x70')](_0x263db2,'id');var _0x54e8ad;var _0x4db1a4=squel[_0x531a('0x71')]();_0x4db1a4['from'](_0x3a2da5[_0x531a('0x7f')]);for(var _0xaf8703=0x0;_0xaf8703<_0x210d1b['length'];_0xaf8703+=0x1){_0x54e8ad=_0x210d1b[_0xaf8703][_0x531a('0x72')]?_0x7d5b94[_0x210d1b[_0xaf8703][_0x531a('0x72')]]['metric']:_0x210d1b[_0xaf8703]['field'];_0x54e8ad=_0x210d1b[_0xaf8703][_0x531a('0x73')]?_[_0x531a('0x74')](_0x4b6077[_0x210d1b[_0xaf8703]['function']],'%s',_0x54e8ad):_0x54e8ad;_0x54e8ad=_0x210d1b[_0xaf8703]['format']?_[_0x531a('0x74')](_0x4e115d[_0x210d1b[_0xaf8703]['format']],'%s',_0x54e8ad):_0x54e8ad;if(_0x210d1b[_0xaf8703][_0x531a('0x76')]){_0x4db1a4[_0x531a('0x6a')](_0x54e8ad);}_0x210d1b[_0xaf8703]['orderBy']&&_0x4db1a4[_0x531a('0x3d')](_0x54e8ad,_0x210d1b[_0xaf8703][_0x531a('0x77')]===_0x531a('0x78')?![]:!![]);_0x4db1a4[_0x531a('0x8f')](_0x54e8ad,_0x210d1b[_0xaf8703]['alias']||_0x54e8ad);}if(_0x3a2da5[_0x531a('0x7a')]){_0x3a2da5[_0x531a('0x7a')]=JSON['parse'](_0x3a2da5[_0x531a('0x7a')]);for(var _0x4db1f9=0x0;_0x4db1f9<_0x3a2da5['joins']['length'];_0x4db1f9+=0x1){if(_0x3a2da5[_0x531a('0x7a')][_0x4db1f9][_0x531a('0x34')]&&_[_0x531a('0x65')](_0x2977ee,_0x3a2da5[_0x531a('0x7a')][_0x4db1f9][_0x531a('0x34')])&&_0x3a2da5[_0x531a('0x7a')][_0x4db1f9][_0x531a('0x90')]&&_0x3a2da5[_0x531a('0x7a')][_0x4db1f9]['foreignTable']&&_0x3a2da5[_0x531a('0x7a')][_0x4db1f9][_0x531a('0x7d')]){_0x4db1a4[_0x3a2da5[_0x531a('0x7a')][_0x4db1f9]['type']](_0x3a2da5['joins'][_0x4db1f9][_0x531a('0x7c')],null,util[_0x531a('0x75')](_0x531a('0x7e'),_0x3a2da5[_0x531a('0x7f')],_0x3a2da5['joins'][_0x4db1f9][_0x531a('0x90')],_0x3a2da5[_0x531a('0x7a')][_0x4db1f9]['foreignTable'],_0x3a2da5['joins'][_0x4db1f9][_0x531a('0x7d')]));}}}if(_0x3a2da5[_0x531a('0x80')]){_0x3a2da5[_0x531a('0x80')]=JSON[_0x531a('0x7b')](_0x3a2da5['conditions']);_0x4db1a4[_0x531a('0x3f')](_0x44d608(_0x3a2da5['conditions'][_0x531a('0x6a')]));}_0x5d8385=_0x4db1a4[_0x531a('0x81')]();_0x4db1a4['limit'](_0x388ded);_0x4db1a4[_0x531a('0x1f')](0x0);logger['debug'](_0x531a('0x83'),_0x4db1a4[_0x531a('0x84')]());return dbH[_0x531a('0x85')][_0x531a('0x36')](_0x4db1a4[_0x531a('0x84')](),{'type':dbH['sequelize']['QueryTypes'][_0x531a('0x86')]});}})[_0x531a('0x27')](function(){return{'sql':_0x5d8385[_0x531a('0x84')]()};})['then'](respondWithResult(_0x3791c1,null))[_0x531a('0x4b')](handleError(_0x3791c1,null));}; \ No newline at end of file +var _0xc8f7=['lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','save','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','type','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','where','filter','merge','options','include','findAll','catch','params','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','userProfileId','create','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','from','table','MetricId','metric','function','format','group','orderBy','order','DESC','alias','joins','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','toString','sequelize','QueryTypes','SELECT','COUNT(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','HOUR(%s)','ROUND(%s)','IS\x20NULL','value','select','replace','groupBy','output','web','fullPath','%s-%s.%s','randomstring','generate','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox'];(function(_0x56f7e2,_0x145392){var _0x36240b=function(_0x216ff7){while(--_0x216ff7){_0x56f7e2['push'](_0x56f7e2['shift']());}};_0x36240b(++_0x145392);}(_0xc8f7,0x99));var _0x7c8f=function(_0x381f7e,_0x16aa4a){_0x381f7e=_0x381f7e-0x0;var _0x1c869f=_0xc8f7[_0x381f7e];return _0x1c869f;};'use strict';var emlformat=require(_0x7c8f('0x0'));var rimraf=require(_0x7c8f('0x1'));var zipdir=require(_0x7c8f('0x2'));var jsonpatch=require(_0x7c8f('0x3'));var rp=require(_0x7c8f('0x4'));var moment=require('moment');var BPromise=require(_0x7c8f('0x5'));var Mustache=require(_0x7c8f('0x6'));var util=require(_0x7c8f('0x7'));var path=require(_0x7c8f('0x8'));var sox=require(_0x7c8f('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7c8f('0xa'));var squel=require(_0x7c8f('0xb'));var crypto=require(_0x7c8f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7c8f('0xd'));var toCsv=require(_0x7c8f('0xe'));var querystring=require(_0x7c8f('0xf'));var Papa=require(_0x7c8f('0x10'));var Redis=require(_0x7c8f('0x11'));var authService=require(_0x7c8f('0x12'));var qs=require(_0x7c8f('0x13'));var as=require(_0x7c8f('0x14'));var hardwareService=require(_0x7c8f('0x15'));var logger=require(_0x7c8f('0x16'))(_0x7c8f('0x17'));var utils=require(_0x7c8f('0x18'));var config=require(_0x7c8f('0x19'));var licenseUtil=require(_0x7c8f('0x1a'));var db=require(_0x7c8f('0x1b'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0x362c9a,_0x4108e1){_0x4108e1=_0x4108e1||0xcc;return function(_0x11f3f5){if(_0x11f3f5){return _0x362c9a['sendStatus'](_0x4108e1);}return _0x362c9a[_0x7c8f('0x1c')](_0x4108e1)[_0x7c8f('0x1d')]();};}function respondWithResult(_0x13f826,_0xac7651){_0xac7651=_0xac7651||0xc8;return function(_0x1c50bb){if(_0x1c50bb){return _0x13f826[_0x7c8f('0x1c')](_0xac7651)['json'](_0x1c50bb);}};}function respondWithFilteredResult(_0x1a2e0b,_0x2ae03f){return function(_0x3d2a2a){if(_0x3d2a2a){var _0x2a0b4c=typeof _0x2ae03f['offset']===_0x7c8f('0x1e')&&typeof _0x2ae03f[_0x7c8f('0x1f')]===_0x7c8f('0x1e');var _0x5a0683=_0x3d2a2a[_0x7c8f('0x20')];var _0x410c49=_0x2a0b4c?0x0:_0x2ae03f[_0x7c8f('0x21')];var _0x11eea7=_0x2a0b4c?_0x3d2a2a[_0x7c8f('0x20')]:_0x2ae03f[_0x7c8f('0x21')]+_0x2ae03f[_0x7c8f('0x1f')];var _0x38c345;if(_0x11eea7>=_0x5a0683){_0x11eea7=_0x5a0683;_0x38c345=0xc8;}else{_0x38c345=0xce;}_0x1a2e0b[_0x7c8f('0x1c')](_0x38c345);return _0x1a2e0b[_0x7c8f('0x22')](_0x7c8f('0x23'),_0x410c49+'-'+_0x11eea7+'/'+_0x5a0683)[_0x7c8f('0x24')](_0x3d2a2a);}return null;};}function patchUpdates(_0x22d5fa){return function(_0x346afa){try{jsonpatch['apply'](_0x346afa,_0x22d5fa,!![]);}catch(_0x69dfdf){return BPromise[_0x7c8f('0x25')](_0x69dfdf);}return _0x346afa[_0x7c8f('0x26')]();};}function saveUpdates(_0x33dc4c,_0x260547){return function(_0x5cb148){if(_0x5cb148){return _0x5cb148['update'](_0x33dc4c)[_0x7c8f('0x27')](function(_0x34e9f2){return _0x34e9f2;});}return null;};}function removeEntity(_0x33d5ab,_0x2b61b4){return function(_0x3acea3){if(_0x3acea3){return _0x3acea3['destroy']()[_0x7c8f('0x27')](function(){var _0x48ffe9=_0x3acea3[_0x7c8f('0x28')]({'plain':!![]});var _0x44657e='CustomReports';return db[_0x7c8f('0x29')][_0x7c8f('0x2a')]({'where':{'type':_0x44657e,'resourceId':_0x48ffe9['id']}})['then'](function(){return _0x3acea3;});})['then'](function(){_0x33d5ab[_0x7c8f('0x1c')](0xcc)[_0x7c8f('0x1d')]();});}};}function handleEntityNotFound(_0x53e30a,_0x3adfe3){return function(_0x2af990){if(!_0x2af990){_0x53e30a['sendStatus'](0x194);}return _0x2af990;};}function handleError(_0x52aaf4,_0x5ea19d){_0x5ea19d=_0x5ea19d||0x1f4;return function(_0x2ed95d){logger[_0x7c8f('0x2b')](_0x2ed95d[_0x7c8f('0x2c')]);if(_0x2ed95d[_0x7c8f('0x2d')]){delete _0x2ed95d['name'];}_0x52aaf4[_0x7c8f('0x1c')](_0x5ea19d)[_0x7c8f('0x2e')](_0x2ed95d);};}exports[_0x7c8f('0x2f')]=function(_0x25472c,_0x25318a){var _0x530f65={},_0x406392={},_0x186d40={'count':0x0,'rows':[]};var _0x5c7ab8=_[_0x7c8f('0x30')](db[_0x7c8f('0x31')][_0x7c8f('0x32')],function(_0x4f5456){return{'name':_0x4f5456['fieldName'],'type':_0x4f5456[_0x7c8f('0x33')]['key']};});_0x406392[_0x7c8f('0x34')]=_[_0x7c8f('0x30')](_0x5c7ab8,'name');_0x406392['query']=_[_0x7c8f('0x35')](_0x25472c['query']);_0x406392[_0x7c8f('0x36')]=_[_0x7c8f('0x37')](_0x406392[_0x7c8f('0x34')],_0x406392['query']);_0x530f65[_0x7c8f('0x38')]=_[_0x7c8f('0x37')](_0x406392[_0x7c8f('0x34')],qs[_0x7c8f('0x39')](_0x25472c[_0x7c8f('0x3a')]['fields']));_0x530f65[_0x7c8f('0x38')]=_0x530f65[_0x7c8f('0x38')][_0x7c8f('0x3b')]?_0x530f65[_0x7c8f('0x38')]:_0x406392['model'];if(!_0x25472c[_0x7c8f('0x3a')][_0x7c8f('0x3c')](_0x7c8f('0x3d'))){_0x530f65[_0x7c8f('0x1f')]=qs[_0x7c8f('0x1f')](_0x25472c[_0x7c8f('0x3a')][_0x7c8f('0x1f')]);_0x530f65[_0x7c8f('0x21')]=qs['offset'](_0x25472c[_0x7c8f('0x3a')][_0x7c8f('0x21')]);}_0x530f65['order']=qs['sort'](_0x25472c[_0x7c8f('0x3a')]['sort']);_0x530f65[_0x7c8f('0x3e')]=qs['filters'](_['pick'](_0x25472c[_0x7c8f('0x3a')],_0x406392[_0x7c8f('0x36')]),_0x5c7ab8);if(_0x25472c[_0x7c8f('0x3a')][_0x7c8f('0x3f')]){_0x530f65[_0x7c8f('0x3e')]=_['merge'](_0x530f65['where'],{'$or':_['map'](_0x5c7ab8,function(_0x5030a1){if(_0x5030a1[_0x7c8f('0x33')]!=='VIRTUAL'){var _0x390324={};_0x390324[_0x5030a1[_0x7c8f('0x2d')]]={'$like':'%'+_0x25472c[_0x7c8f('0x3a')][_0x7c8f('0x3f')]+'%'};return _0x390324;}})});}_0x530f65=_[_0x7c8f('0x40')]({},_0x530f65,_0x25472c[_0x7c8f('0x41')]);var _0x2aa3d0={'where':_0x530f65[_0x7c8f('0x3e')]};return db[_0x7c8f('0x31')][_0x7c8f('0x20')](_0x2aa3d0)[_0x7c8f('0x27')](function(_0x52fe6d){_0x186d40['count']=_0x52fe6d;if(_0x25472c[_0x7c8f('0x3a')]['includeAll']){_0x530f65[_0x7c8f('0x42')]=[{'all':!![]}];}return db[_0x7c8f('0x31')][_0x7c8f('0x43')](_0x530f65);})[_0x7c8f('0x27')](function(_0x55bdb9){_0x186d40['rows']=_0x55bdb9;return _0x186d40;})[_0x7c8f('0x27')](respondWithFilteredResult(_0x25318a,_0x530f65))[_0x7c8f('0x44')](handleError(_0x25318a,null));};exports['show']=function(_0xb27916,_0xcdda45){var _0x413e01={'raw':![],'where':{'id':_0xb27916[_0x7c8f('0x45')]['id']}},_0x2d9e91={};_0x2d9e91[_0x7c8f('0x34')]=_[_0x7c8f('0x35')](db[_0x7c8f('0x31')][_0x7c8f('0x32')]);_0x2d9e91[_0x7c8f('0x3a')]=_[_0x7c8f('0x35')](_0xb27916[_0x7c8f('0x3a')]);_0x2d9e91[_0x7c8f('0x36')]=_['intersection'](_0x2d9e91[_0x7c8f('0x34')],_0x2d9e91[_0x7c8f('0x3a')]);_0x413e01['attributes']=_[_0x7c8f('0x37')](_0x2d9e91[_0x7c8f('0x34')],qs['fields'](_0xb27916[_0x7c8f('0x3a')]['fields']));_0x413e01[_0x7c8f('0x38')]=_0x413e01[_0x7c8f('0x38')]['length']?_0x413e01[_0x7c8f('0x38')]:_0x2d9e91[_0x7c8f('0x34')];if(_0xb27916['query']['includeAll']){_0x413e01['include']=[{'all':!![]}];}_0x413e01=_[_0x7c8f('0x40')]({},_0x413e01,_0xb27916[_0x7c8f('0x41')]);return db['AnalyticCustomReport'][_0x7c8f('0x46')](_0x413e01)['then'](handleEntityNotFound(_0xcdda45,null))[_0x7c8f('0x27')](respondWithResult(_0xcdda45,null))[_0x7c8f('0x44')](handleError(_0xcdda45,null));};exports['create']=function(_0x14b1e2,_0x12a45a){return db[_0x7c8f('0x31')]['create'](_0x14b1e2['body'],{})['then'](function(_0x236cc5){var _0x5822e6=_0x14b1e2[_0x7c8f('0x47')]['get']({'plain':!![]});if(!_0x5822e6)throw new Error(_0x7c8f('0x48'));if(_0x5822e6['role']==='user'){var _0x117ddd=_0x236cc5[_0x7c8f('0x28')]({'plain':!![]});var _0x38b9e9=_0x7c8f('0x49');return db[_0x7c8f('0x4a')][_0x7c8f('0x46')]({'where':{'name':_0x38b9e9,'userProfileId':_0x5822e6[_0x7c8f('0x4b')]},'raw':!![]})[_0x7c8f('0x27')](function(_0x3e2a9c){if(_0x3e2a9c&&_0x3e2a9c['autoAssociation']===0x0){return db[_0x7c8f('0x29')][_0x7c8f('0x4c')]({'name':_0x117ddd[_0x7c8f('0x2d')],'resourceId':_0x117ddd['id'],'type':_0x7c8f('0x4d'),'sectionId':_0x3e2a9c['id']},{})[_0x7c8f('0x27')](function(){return _0x236cc5;});}else{return _0x236cc5;}})[_0x7c8f('0x44')](function(_0x485128){logger[_0x7c8f('0x2b')](_0x7c8f('0x4e'),_0x485128);throw _0x485128;});}return _0x236cc5;})['then'](respondWithResult(_0x12a45a,0xc9))[_0x7c8f('0x44')](handleError(_0x12a45a,null));};exports['update']=function(_0x3a22ec,_0x1c67fb){if(_0x3a22ec[_0x7c8f('0x4f')]['id']){delete _0x3a22ec[_0x7c8f('0x4f')]['id'];}return db[_0x7c8f('0x31')]['find']({'where':{'id':_0x3a22ec['params']['id']}})[_0x7c8f('0x27')](handleEntityNotFound(_0x1c67fb,null))['then'](saveUpdates(_0x3a22ec[_0x7c8f('0x4f')],null))[_0x7c8f('0x27')](respondWithResult(_0x1c67fb,null))['catch'](handleError(_0x1c67fb,null));};exports['destroy']=function(_0x3918f1,_0xa88eb6){return db[_0x7c8f('0x31')][_0x7c8f('0x46')]({'where':{'id':_0x3918f1[_0x7c8f('0x45')]['id']}})['then'](handleEntityNotFound(_0xa88eb6,null))[_0x7c8f('0x27')](removeEntity(_0xa88eb6,null))[_0x7c8f('0x44')](handleError(_0xa88eb6,null));};exports['preview']=function(_0x18abc2,_0x544d7e){var _0x23d8a3=0xa;var _0x4069d1=[_0x7c8f('0x50'),_0x7c8f('0x51'),_0x7c8f('0x52'),_0x7c8f('0x53')];var _0x3fbe6f={'SUM':_0x7c8f('0x54'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x7c8f('0x55'),'MAX':_0x7c8f('0x56'),'MIN':'MIN(%s)','AVG':_0x7c8f('0x57'),'GROUP_CONCAT':_0x7c8f('0x58'),'GROUP_CONCAT ASC':_0x7c8f('0x59'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x195ca2={'SEC_TO_TIME':_0x7c8f('0x5a'),'DATE':_0x7c8f('0x5b'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x7c8f('0x5c')};var _0x362aa8=function(_0x1a00a8){return!_['includes'](['IS\x20NULL',_0x7c8f('0x5d'),_0x7c8f('0x5e'),_0x7c8f('0x5f')],_0x1a00a8);};var _0x5b79aa=function(_0x605abf){if(!_0x605abf||!_0x605abf[_0x7c8f('0x60')]['length']){return'';}for(var _0x21d8af='(',_0x3602b2=0x0;_0x3602b2<_0x605abf[_0x7c8f('0x60')][_0x7c8f('0x3b')];_0x3602b2+=0x1){_0x3602b2>0x0&&(_0x21d8af+='\x20'+_0x605abf[_0x7c8f('0x61')]+'\x20');_0x21d8af+=_0x605abf['rules'][_0x3602b2]['group']?_0x5b79aa(_0x605abf[_0x7c8f('0x60')][_0x3602b2]['group']):_0x605abf[_0x7c8f('0x60')][_0x3602b2][_0x7c8f('0x62')]+'\x20'+_0x605abf[_0x7c8f('0x60')][_0x3602b2][_0x7c8f('0x63')]+(_0x362aa8(_0x605abf[_0x7c8f('0x60')][_0x3602b2][_0x7c8f('0x63')])?'\x20'+_0x605abf['rules'][_0x3602b2]['value']:'');}return _0x21d8af+')';};var _0x4b7110={'where':{'id':_0x18abc2[_0x7c8f('0x45')]['id']}},_0x2d03a2,_0x3fecd9,_0x4252d6,_0x207ffe,_0x3f2e39;_0x4b7110=_[_0x7c8f('0x40')]({},_0x4b7110,_0x18abc2[_0x7c8f('0x41')]);return db[_0x7c8f('0x31')]['find'](_0x4b7110)[_0x7c8f('0x27')](function(_0x8bb852){if(_0x8bb852){_0x2d03a2=_0x8bb852;return _0x8bb852[_0x7c8f('0x64')]();}return null;})[_0x7c8f('0x27')](function(_0x2fac37){if(_0x2fac37){if(!_0x2fac37[_0x7c8f('0x3b')]){throw new db[(_0x7c8f('0x65'))][(_0x7c8f('0x66'))](_0x7c8f('0x67'),0x193);}_0x3fecd9=_0x2fac37;return db['AnalyticMetric'][_0x7c8f('0x43')]({'raw':!![]});}return null;})[_0x7c8f('0x27')](function(_0x1e67cf){if(_0x1e67cf){_0x4252d6=_[_0x7c8f('0x68')](_0x1e67cf,'id');var _0x3da77a;var _0x3e523b=squel['select']();_0x3e523b[_0x7c8f('0x69')](_0x2d03a2[_0x7c8f('0x6a')]);for(var _0x1ecb6f=0x0;_0x1ecb6f<_0x3fecd9[_0x7c8f('0x3b')];_0x1ecb6f+=0x1){_0x3da77a=_0x3fecd9[_0x1ecb6f]['MetricId']?_0x4252d6[_0x3fecd9[_0x1ecb6f][_0x7c8f('0x6b')]][_0x7c8f('0x6c')]:_0x3fecd9[_0x1ecb6f][_0x7c8f('0x62')];_0x3da77a=_0x3fecd9[_0x1ecb6f][_0x7c8f('0x6d')]?_['replace'](_0x3fbe6f[_0x3fecd9[_0x1ecb6f][_0x7c8f('0x6d')]],'%s',_0x3da77a):_0x3da77a;_0x3da77a=_0x3fecd9[_0x1ecb6f][_0x7c8f('0x6e')]?_['replace'](_0x195ca2[_0x3fecd9[_0x1ecb6f][_0x7c8f('0x6e')]],'%s',_0x3da77a):_0x3da77a;if(_0x3fecd9[_0x1ecb6f]['groupBy']){_0x3e523b[_0x7c8f('0x6f')](_0x3da77a);}_0x3fecd9[_0x1ecb6f][_0x7c8f('0x70')]&&_0x3e523b[_0x7c8f('0x71')](_0x3da77a,_0x3fecd9[_0x1ecb6f][_0x7c8f('0x70')]===_0x7c8f('0x72')?![]:!![]);_0x3e523b[_0x7c8f('0x62')](_0x3da77a,_0x3fecd9[_0x1ecb6f][_0x7c8f('0x73')]||_0x3da77a);}if(_0x2d03a2[_0x7c8f('0x74')]){_0x2d03a2['joins']=JSON['parse'](_0x2d03a2[_0x7c8f('0x74')]);for(var _0x5d4f02=0x0;_0x5d4f02<_0x2d03a2[_0x7c8f('0x74')][_0x7c8f('0x3b')];_0x5d4f02+=0x1){if(_0x2d03a2[_0x7c8f('0x74')][_0x5d4f02][_0x7c8f('0x33')]&&_[_0x7c8f('0x75')](_0x4069d1,_0x2d03a2[_0x7c8f('0x74')][_0x5d4f02][_0x7c8f('0x33')])&&_0x2d03a2[_0x7c8f('0x74')][_0x5d4f02][_0x7c8f('0x76')]&&_0x2d03a2[_0x7c8f('0x74')][_0x5d4f02][_0x7c8f('0x77')]&&_0x2d03a2[_0x7c8f('0x74')][_0x5d4f02][_0x7c8f('0x78')]){_0x3e523b[_0x2d03a2[_0x7c8f('0x74')][_0x5d4f02][_0x7c8f('0x33')]](_0x2d03a2[_0x7c8f('0x74')][_0x5d4f02][_0x7c8f('0x77')],null,util['format'](_0x7c8f('0x79'),_0x2d03a2[_0x7c8f('0x6a')],_0x2d03a2[_0x7c8f('0x74')][_0x5d4f02][_0x7c8f('0x76')],_0x2d03a2[_0x7c8f('0x74')][_0x5d4f02][_0x7c8f('0x77')],_0x2d03a2[_0x7c8f('0x74')][_0x5d4f02][_0x7c8f('0x78')]));}}}if(_0x2d03a2[_0x7c8f('0x7a')]){_0x2d03a2['conditions']=JSON[_0x7c8f('0x7b')](_0x2d03a2[_0x7c8f('0x7a')]);_0x3e523b[_0x7c8f('0x3e')](_0x5b79aa(_0x2d03a2[_0x7c8f('0x7a')]['group']));}_0x3f2e39=_0x3e523b[_0x7c8f('0x7c')]();_0x3e523b[_0x7c8f('0x1f')](_0x23d8a3);_0x3e523b[_0x7c8f('0x21')](0x0);logger[_0x7c8f('0x7d')]('Limited\x20Query:',_0x3e523b[_0x7c8f('0x7e')]());return dbH[_0x7c8f('0x7f')]['query'](_0x3e523b[_0x7c8f('0x7e')](),{'type':dbH[_0x7c8f('0x7f')][_0x7c8f('0x80')][_0x7c8f('0x81')]});}})['then'](respondWithResult(_0x544d7e,null))['catch'](handleError(_0x544d7e,null));};function runReport(_0x3d5ad8,_0x2d0c08,_0x43d869){var _0xf039d=_0x2d0c08[_0x7c8f('0x2d')];var _0x47fca1=0xa;var _0x3d458f=[_0x7c8f('0x50'),_0x7c8f('0x51'),_0x7c8f('0x52'),_0x7c8f('0x53')];var _0x1392bc={'SUM':_0x7c8f('0x54'),'COUNT':_0x7c8f('0x82'),'COUNT DISTINCT':_0x7c8f('0x55'),'MAX':'MAX(%s)','MIN':_0x7c8f('0x83'),'AVG':_0x7c8f('0x57'),'GROUP_CONCAT':_0x7c8f('0x58'),'GROUP_CONCAT ASC':_0x7c8f('0x59'),'GROUP_CONCAT DESC':_0x7c8f('0x84')};var _0x2a2e84={'SEC_TO_TIME':_0x7c8f('0x5a'),'DATE':'DATE(%s)','HOUR':_0x7c8f('0x85'),'ROUND':_0x7c8f('0x86'),'UNIX_TIMESTAMP':_0x7c8f('0x5c')};var _0x55cd23=function(_0x1882b3){return!_[_0x7c8f('0x75')]([_0x7c8f('0x87'),_0x7c8f('0x5d'),_0x7c8f('0x5e'),'IS\x20NOT\x20EMPTY'],_0x1882b3);};var _0x33e8e2=function(_0x499328){if(!_0x499328||!_0x499328[_0x7c8f('0x60')][_0x7c8f('0x3b')]){return'';}for(var _0x3e82af='(',_0x546325=0x0;_0x546325<_0x499328[_0x7c8f('0x60')][_0x7c8f('0x3b')];_0x546325+=0x1){_0x546325>0x0&&(_0x3e82af+='\x20'+_0x499328[_0x7c8f('0x61')]+'\x20');_0x3e82af+=_0x499328['rules'][_0x546325]['group']?_0x33e8e2(_0x499328[_0x7c8f('0x60')][_0x546325][_0x7c8f('0x6f')]):_0x499328[_0x7c8f('0x60')][_0x546325][_0x7c8f('0x62')]+'\x20'+_0x499328[_0x7c8f('0x60')][_0x546325][_0x7c8f('0x63')]+(_0x55cd23(_0x499328[_0x7c8f('0x60')][_0x546325][_0x7c8f('0x63')])?'\x20'+_0x499328['rules'][_0x546325][_0x7c8f('0x88')]:'');}return _0x3e82af+')';};var _0x37cd49={'where':{'id':_0x3d5ad8['id']}},_0x4cbf18,_0x238086,_0x191237,_0x3251c9,_0x51e338;_0x37cd49=_[_0x7c8f('0x40')]({},_0x37cd49,_0x43d869);return db[_0x7c8f('0x31')][_0x7c8f('0x46')](_0x37cd49)[_0x7c8f('0x27')](function(_0x309db0){if(_0x309db0){_0x4cbf18=_0x309db0;return _0x309db0[_0x7c8f('0x64')]();}return null;})[_0x7c8f('0x27')](function(_0x4304da){if(_0x4304da){if(!_0x4304da[_0x7c8f('0x3b')]){throw new db[(_0x7c8f('0x65'))][(_0x7c8f('0x66'))](_0x7c8f('0x67'),0x193);}_0x238086=_0x4304da;return db['AnalyticMetric'][_0x7c8f('0x43')]({'raw':!![]});}return null;})['then'](function(_0x50c50e){if(_0x50c50e){_0x191237=_[_0x7c8f('0x68')](_0x50c50e,'id');var _0x3c562c;var _0x23feab=squel[_0x7c8f('0x89')]();_0x23feab[_0x7c8f('0x69')](_0x4cbf18[_0x7c8f('0x6a')]);for(var _0xfc005b=0x0;_0xfc005b<_0x238086[_0x7c8f('0x3b')];_0xfc005b+=0x1){_0x3c562c=_0x238086[_0xfc005b][_0x7c8f('0x6b')]?_0x191237[_0x238086[_0xfc005b][_0x7c8f('0x6b')]][_0x7c8f('0x6c')]:_0x238086[_0xfc005b]['field'];_0x3c562c=_0x238086[_0xfc005b]['function']?_[_0x7c8f('0x8a')](_0x1392bc[_0x238086[_0xfc005b][_0x7c8f('0x6d')]],'%s',_0x3c562c):_0x3c562c;_0x3c562c=_0x238086[_0xfc005b][_0x7c8f('0x6e')]?_['replace'](_0x2a2e84[_0x238086[_0xfc005b][_0x7c8f('0x6e')]],'%s',_0x3c562c):_0x3c562c;if(_0x238086[_0xfc005b][_0x7c8f('0x8b')]){_0x23feab[_0x7c8f('0x6f')](_0x3c562c);}_0x238086[_0xfc005b][_0x7c8f('0x70')]&&_0x23feab[_0x7c8f('0x71')](_0x3c562c,_0x238086[_0xfc005b][_0x7c8f('0x70')]===_0x7c8f('0x72')?![]:!![]);_0x23feab[_0x7c8f('0x62')](_0x3c562c,_0x238086[_0xfc005b][_0x7c8f('0x73')]||_0x3c562c);}if(_0x4cbf18[_0x7c8f('0x74')]){_0x4cbf18['joins']=JSON[_0x7c8f('0x7b')](_0x4cbf18[_0x7c8f('0x74')]);for(var _0x5344bb=0x0;_0x5344bb<_0x4cbf18[_0x7c8f('0x74')][_0x7c8f('0x3b')];_0x5344bb+=0x1){if(_0x4cbf18[_0x7c8f('0x74')][_0x5344bb][_0x7c8f('0x33')]&&_[_0x7c8f('0x75')](_0x3d458f,_0x4cbf18['joins'][_0x5344bb][_0x7c8f('0x33')])&&_0x4cbf18[_0x7c8f('0x74')][_0x5344bb][_0x7c8f('0x76')]&&_0x4cbf18[_0x7c8f('0x74')][_0x5344bb]['foreignTable']&&_0x4cbf18[_0x7c8f('0x74')][_0x5344bb][_0x7c8f('0x78')]){_0x23feab[_0x4cbf18[_0x7c8f('0x74')][_0x5344bb][_0x7c8f('0x33')]](_0x4cbf18['joins'][_0x5344bb][_0x7c8f('0x77')],null,util[_0x7c8f('0x6e')](_0x7c8f('0x79'),_0x4cbf18[_0x7c8f('0x6a')],_0x4cbf18[_0x7c8f('0x74')][_0x5344bb][_0x7c8f('0x76')],_0x4cbf18[_0x7c8f('0x74')][_0x5344bb][_0x7c8f('0x77')],_0x4cbf18[_0x7c8f('0x74')][_0x5344bb][_0x7c8f('0x78')]));}}}if(_0x4cbf18['conditions']){_0x4cbf18[_0x7c8f('0x7a')]=JSON[_0x7c8f('0x7b')](_0x4cbf18['conditions']);_0x23feab[_0x7c8f('0x3e')](_0x33e8e2(_0x4cbf18[_0x7c8f('0x7a')][_0x7c8f('0x6f')]));}_0x51e338=_0x23feab[_0x7c8f('0x7c')]();_0x23feab[_0x7c8f('0x1f')](_0x47fca1);_0x23feab[_0x7c8f('0x21')](0x0);return;}})[_0x7c8f('0x27')](function(){if(_0x2d0c08[_0x7c8f('0x8c')]===_0x7c8f('0x8d')){return null;}var _0x2c2bf9=_['merge'](_0x2d0c08,{'name':_0x2d0c08[_0x7c8f('0x8e')]||_0x2d0c08['name']||_0x4cbf18[_0x7c8f('0x2d')],'basename':_0xf039d,'savename':util[_0x7c8f('0x6e')](_0x7c8f('0x8f'),_0x2d0c08[_0x7c8f('0x2d')]||_0x4cbf18[_0x7c8f('0x2d')],require(_0x7c8f('0x90'))[_0x7c8f('0x91')](0x4),_0x2d0c08[_0x7c8f('0x8c')]||'csv'),'reportId':_0x4cbf18['id'],'reportType':_0x7c8f('0x92')});return db[_0x7c8f('0x93')][_0x7c8f('0x4c')](_0x2c2bf9,{'raw':!![]});})[_0x7c8f('0x27')](function(_0x1ad1bd){if(_0x4cbf18[_0x7c8f('0x6a')]===_0x7c8f('0x94')){_0x51e338[_0x7c8f('0x3e')](_0x4cbf18[_0x7c8f('0x6a')]+_0x7c8f('0x95'),_0x2d0c08[_0x7c8f('0x96')],_0x2d0c08['endDate']);}else{_0x51e338[_0x7c8f('0x3e')](_0x4cbf18[_0x7c8f('0x6a')]+_0x7c8f('0x97'),_0x2d0c08[_0x7c8f('0x96')],_0x2d0c08[_0x7c8f('0x98')]);}if(_0x1ad1bd){logger[_0x7c8f('0x99')](_0x7c8f('0x9a'),_0x51e338[_0x7c8f('0x7e')]());require(_0x7c8f('0x9b'))[_0x7c8f('0x9c')](path[_0x7c8f('0x50')](__dirname,_0x7c8f('0x9d'),_0x1ad1bd['output']),[_0x1ad1bd['id'],_0x51e338['toString'](),path[_0x7c8f('0x50')](__dirname,_0x7c8f('0x9e'),_0x1ad1bd[_0x7c8f('0x9f')]),_0xf039d]);return _0x1ad1bd;}else{var _0x1cc586=squel[_0x7c8f('0x89')]();_0x1cc586[_0x7c8f('0x69')]('('+_0x51e338['toString']()+')',_0x7c8f('0xa0'));_0x1cc586[_0x7c8f('0x62')](_0x7c8f('0xa1'),_0x7c8f('0x20'));_0x51e338[_0x7c8f('0x1f')](_0x2d0c08[_0x7c8f('0x1f')]||_0x47fca1);_0x51e338['offset'](_0x2d0c08[_0x7c8f('0x21')]||0x0);return dbH[_0x7c8f('0x7f')]['query'](_0x1cc586[_0x7c8f('0x7e')](),{'type':dbH[_0x7c8f('0x7f')][_0x7c8f('0x80')][_0x7c8f('0x81')]})[_0x7c8f('0x27')](function(_0x56c24e){if(!_0x56c24e['length']){_0x3251c9=0x0;}else{_0x3251c9=_0x56c24e[0x0][_0x7c8f('0x20')]||0x0;}return dbH[_0x7c8f('0x7f')][_0x7c8f('0x3a')](_0x51e338[_0x7c8f('0x7e')](),{'type':dbH[_0x7c8f('0x7f')][_0x7c8f('0x80')][_0x7c8f('0x81')]});})['then'](function(_0x277f22){return{'rows':_0x277f22||[],'count':_0x3251c9};});}});}exports['run']=function(_0x209463,_0x231468){return runReport(_0x209463['params'],_0x209463[_0x7c8f('0x3a')],_0x209463['options'])[_0x7c8f('0x27')](respondWithResult(_0x231468,null))[_0x7c8f('0x44')](handleError(_0x231468,null));};exports[_0x7c8f('0xa2')]=runReport;exports[_0x7c8f('0x3a')]=function(_0x9037d1,_0xf05e2a){var _0x26fb00=0xa;var _0x5c9011=[_0x7c8f('0x50'),'left_join','right_join','cross_join'];var _0x3390e6={'SUM':'SUM(%s)','COUNT':_0x7c8f('0x82'),'COUNT DISTINCT':_0x7c8f('0x55'),'MAX':_0x7c8f('0x56'),'MIN':_0x7c8f('0x83'),'AVG':_0x7c8f('0x57'),'GROUP_CONCAT':_0x7c8f('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2959d7={'SEC_TO_TIME':_0x7c8f('0x5a'),'DATE':_0x7c8f('0x5b'),'HOUR':_0x7c8f('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x187b8e=function(_0x42745b){return!_[_0x7c8f('0x75')]([_0x7c8f('0x87'),'IS\x20NOT\x20NULL',_0x7c8f('0x5e'),_0x7c8f('0x5f')],_0x42745b);};var _0x318899=function(_0x14e86a){if(!_0x14e86a||!_0x14e86a[_0x7c8f('0x60')][_0x7c8f('0x3b')]){return'';}for(var _0x405ef4='(',_0x457bee=0x0;_0x457bee<_0x14e86a['rules'][_0x7c8f('0x3b')];_0x457bee+=0x1){_0x457bee>0x0&&(_0x405ef4+='\x20'+_0x14e86a[_0x7c8f('0x61')]+'\x20');_0x405ef4+=_0x14e86a[_0x7c8f('0x60')][_0x457bee][_0x7c8f('0x6f')]?_0x318899(_0x14e86a['rules'][_0x457bee][_0x7c8f('0x6f')]):_0x14e86a[_0x7c8f('0x60')][_0x457bee][_0x7c8f('0x62')]+'\x20'+_0x14e86a[_0x7c8f('0x60')][_0x457bee]['condition']+(_0x187b8e(_0x14e86a['rules'][_0x457bee][_0x7c8f('0x63')])?'\x20'+_0x14e86a['rules'][_0x457bee][_0x7c8f('0x88')]:'');}return _0x405ef4+')';};var _0x114c3d={'where':{'id':_0x9037d1[_0x7c8f('0x45')]['id']}},_0x2fed90,_0x291d71,_0x363f7e,_0x4af6f3,_0x5b9d76;_0x114c3d=_[_0x7c8f('0x40')]({},_0x114c3d,_0x9037d1[_0x7c8f('0x41')]);return db[_0x7c8f('0x31')]['find'](_0x114c3d)[_0x7c8f('0x27')](function(_0x39d02f){if(_0x39d02f){_0x2fed90=_0x39d02f;return _0x39d02f[_0x7c8f('0x64')]();}return null;})[_0x7c8f('0x27')](function(_0x1078aa){if(_0x1078aa){if(!_0x1078aa[_0x7c8f('0x3b')]){throw new db['Sequelize'][(_0x7c8f('0x66'))](_0x7c8f('0x67'),0x193);}_0x291d71=_0x1078aa;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x65c8f0){if(_0x65c8f0){_0x363f7e=_[_0x7c8f('0x68')](_0x65c8f0,'id');var _0x5d3c1a;var _0x2b8ebd=squel[_0x7c8f('0x89')]();_0x2b8ebd['from'](_0x2fed90[_0x7c8f('0x6a')]);for(var _0x159acb=0x0;_0x159acb<_0x291d71[_0x7c8f('0x3b')];_0x159acb+=0x1){_0x5d3c1a=_0x291d71[_0x159acb]['MetricId']?_0x363f7e[_0x291d71[_0x159acb]['MetricId']][_0x7c8f('0x6c')]:_0x291d71[_0x159acb]['field'];_0x5d3c1a=_0x291d71[_0x159acb]['function']?_[_0x7c8f('0x8a')](_0x3390e6[_0x291d71[_0x159acb][_0x7c8f('0x6d')]],'%s',_0x5d3c1a):_0x5d3c1a;_0x5d3c1a=_0x291d71[_0x159acb]['format']?_[_0x7c8f('0x8a')](_0x2959d7[_0x291d71[_0x159acb][_0x7c8f('0x6e')]],'%s',_0x5d3c1a):_0x5d3c1a;if(_0x291d71[_0x159acb][_0x7c8f('0x8b')]){_0x2b8ebd['group'](_0x5d3c1a);}_0x291d71[_0x159acb][_0x7c8f('0x70')]&&_0x2b8ebd[_0x7c8f('0x71')](_0x5d3c1a,_0x291d71[_0x159acb][_0x7c8f('0x70')]===_0x7c8f('0x72')?![]:!![]);_0x2b8ebd[_0x7c8f('0x62')](_0x5d3c1a,_0x291d71[_0x159acb][_0x7c8f('0x73')]||_0x5d3c1a);}if(_0x2fed90[_0x7c8f('0x74')]){_0x2fed90[_0x7c8f('0x74')]=JSON['parse'](_0x2fed90[_0x7c8f('0x74')]);for(var _0x56bb7d=0x0;_0x56bb7d<_0x2fed90[_0x7c8f('0x74')][_0x7c8f('0x3b')];_0x56bb7d+=0x1){if(_0x2fed90[_0x7c8f('0x74')][_0x56bb7d][_0x7c8f('0x33')]&&_['includes'](_0x5c9011,_0x2fed90['joins'][_0x56bb7d][_0x7c8f('0x33')])&&_0x2fed90[_0x7c8f('0x74')][_0x56bb7d][_0x7c8f('0x76')]&&_0x2fed90['joins'][_0x56bb7d][_0x7c8f('0x77')]&&_0x2fed90[_0x7c8f('0x74')][_0x56bb7d]['foreignKey']){_0x2b8ebd[_0x2fed90[_0x7c8f('0x74')][_0x56bb7d][_0x7c8f('0x33')]](_0x2fed90['joins'][_0x56bb7d]['foreignTable'],null,util[_0x7c8f('0x6e')]('%s.%s\x20=\x20%s.%s',_0x2fed90['table'],_0x2fed90[_0x7c8f('0x74')][_0x56bb7d]['parentKey'],_0x2fed90['joins'][_0x56bb7d][_0x7c8f('0x77')],_0x2fed90['joins'][_0x56bb7d]['foreignKey']));}}}if(_0x2fed90[_0x7c8f('0x7a')]){_0x2fed90[_0x7c8f('0x7a')]=JSON['parse'](_0x2fed90[_0x7c8f('0x7a')]);_0x2b8ebd[_0x7c8f('0x3e')](_0x318899(_0x2fed90[_0x7c8f('0x7a')][_0x7c8f('0x6f')]));}_0x5b9d76=_0x2b8ebd[_0x7c8f('0x7c')]();_0x2b8ebd['limit'](_0x26fb00);_0x2b8ebd[_0x7c8f('0x21')](0x0);logger['debug']('Limited\x20Query:',_0x2b8ebd[_0x7c8f('0x7e')]());return dbH[_0x7c8f('0x7f')][_0x7c8f('0x3a')](_0x2b8ebd[_0x7c8f('0x7e')](),{'type':dbH[_0x7c8f('0x7f')][_0x7c8f('0x80')][_0x7c8f('0x81')]});}})[_0x7c8f('0x27')](function(){return{'sql':_0x5b9d76[_0x7c8f('0x7e')]()};})[_0x7c8f('0x27')](respondWithResult(_0xf05e2a,null))[_0x7c8f('0x44')](handleError(_0xf05e2a,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 16f1614..738f897 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 _0x4972=['moment','bluebird','request-promise','../../config/environment','./analyticCustomReport.attributes','define','AnalyticCustomReport','lodash','util','../../config/logger','api'];(function(_0x173c5e,_0x1a8403){var _0x41c573=function(_0x5bb29e){while(--_0x5bb29e){_0x173c5e['push'](_0x173c5e['shift']());}};_0x41c573(++_0x1a8403);}(_0x4972,0x151));var _0x2497=function(_0xcdecf2,_0x3f8f3e){_0xcdecf2=_0xcdecf2-0x0;var _0x34dbc2=_0x4972[_0xcdecf2];return _0x34dbc2;};'use strict';var _=require(_0x2497('0x0'));var util=require(_0x2497('0x1'));var logger=require(_0x2497('0x2'))(_0x2497('0x3'));var moment=require(_0x2497('0x4'));var BPromise=require(_0x2497('0x5'));var rp=require(_0x2497('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2497('0x7'));var attributes=require(_0x2497('0x8'));module['exports']=function(_0x50513e,_0x3d327a){return _0x50513e[_0x2497('0x9')](_0x2497('0xa'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdfb5=['moment','bluebird','request-promise','./analyticCustomReport.attributes','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api'];(function(_0x2c2980,_0x34282a){var _0x2a20a9=function(_0x537b18){while(--_0x537b18){_0x2c2980['push'](_0x2c2980['shift']());}};_0x2a20a9(++_0x34282a);}(_0xdfb5,0x146));var _0x5dfb=function(_0x2b29a3,_0x19aba6){_0x2b29a3=_0x2b29a3-0x0;var _0x40ffcb=_0xdfb5[_0x2b29a3];return _0x40ffcb;};'use strict';var _=require(_0x5dfb('0x0'));var util=require(_0x5dfb('0x1'));var logger=require(_0x5dfb('0x2'))(_0x5dfb('0x3'));var moment=require(_0x5dfb('0x4'));var BPromise=require(_0x5dfb('0x5'));var rp=require(_0x5dfb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5dfb('0x7'));module['exports']=function(_0x4d1263,_0x1666cb){return _0x4d1263['define'](_0x5dfb('0x8'),attributes,{'tableName':_0x5dfb('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 3be83a2..e3106ec 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 _0xe323=['request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2341ab,_0x326a6c){var _0x54533e=function(_0x413273){while(--_0x413273){_0x2341ab['push'](_0x2341ab['shift']());}};_0x54533e(++_0x326a6c);}(_0xe323,0x169));var _0x3e32=function(_0x85f3c8,_0x3c74f9){_0x85f3c8=_0x85f3c8-0x0;var _0x5847b8=_0xe323[_0x85f3c8];return _0x5847b8;};'use strict';var _=require(_0x3e32('0x0'));var util=require(_0x3e32('0x1'));var moment=require('moment');var BPromise=require(_0x3e32('0x2'));var rs=require(_0x3e32('0x3'));var fs=require('fs');var Redis=require(_0x3e32('0x4'));var db=require(_0x3e32('0x5'))['db'];var utils=require(_0x3e32('0x6'));var logger=require(_0x3e32('0x7'))(_0x3e32('0x8'));var config=require(_0x3e32('0x9'));var jayson=require(_0x3e32('0xa'));var client=jayson[_0x3e32('0xb')][_0x3e32('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3f774e,_0x1e0511,_0x28a84d){return new BPromise(function(_0x146cb5,_0x5782ef){return client[_0x3e32('0xd')](_0x3f774e,_0x28a84d)[_0x3e32('0xe')](function(_0x202c5d){logger[_0x3e32('0xf')](_0x3e32('0x10'),_0x1e0511,_0x3e32('0x11'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x1e0511,_0x3e32('0x11'),JSON['stringify'](_0x202c5d));if(_0x202c5d[_0x3e32('0x12')]){if(_0x202c5d[_0x3e32('0x12')][_0x3e32('0x13')]===0x1f4){logger[_0x3e32('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1e0511,_0x202c5d[_0x3e32('0x12')][_0x3e32('0x14')]);return _0x5782ef(_0x202c5d[_0x3e32('0x12')][_0x3e32('0x14')]);}logger['error'](_0x3e32('0x10'),_0x1e0511,_0x202c5d[_0x3e32('0x12')][_0x3e32('0x14')]);return _0x146cb5(_0x202c5d[_0x3e32('0x12')][_0x3e32('0x14')]);}else{logger[_0x3e32('0xf')](_0x3e32('0x10'),_0x1e0511,_0x3e32('0x11'));_0x146cb5(_0x202c5d[_0x3e32('0x15')][_0x3e32('0x14')]);}})['catch'](function(_0x4dc576){logger[_0x3e32('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1e0511,_0x4dc576);_0x5782ef(_0x4dc576);});});} \ No newline at end of file +var _0xbf3f=['result','lodash','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x4a8ef7,_0x2c87fc){var _0x5dcdfb=function(_0xb3b49a){while(--_0xb3b49a){_0x4a8ef7['push'](_0x4a8ef7['shift']());}};_0x5dcdfb(++_0x2c87fc);}(_0xbf3f,0x10f));var _0xfbf3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf3f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfbf3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfbf3('0x1'))['db'];var utils=require(_0xfbf3('0x2'));var logger=require(_0xfbf3('0x3'))('rpc');var config=require(_0xfbf3('0x4'));var jayson=require(_0xfbf3('0x5'));var client=jayson[_0xfbf3('0x6')][_0xfbf3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x218007,_0x154f23,_0x7bf395){return new BPromise(function(_0x58460f,_0x2c1143){return client[_0xfbf3('0x8')](_0x218007,_0x7bf395)[_0xfbf3('0x9')](function(_0xfed45a){logger[_0xfbf3('0xa')](_0xfbf3('0xb'),_0x154f23,_0xfbf3('0xc'));logger['debug'](_0xfbf3('0xd'),_0x154f23,_0xfbf3('0xc'),JSON['stringify'](_0xfed45a));if(_0xfed45a[_0xfbf3('0xe')]){if(_0xfed45a[_0xfbf3('0xe')][_0xfbf3('0xf')]===0x1f4){logger[_0xfbf3('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x154f23,_0xfed45a['error'][_0xfbf3('0x10')]);return _0x2c1143(_0xfed45a[_0xfbf3('0xe')][_0xfbf3('0x10')]);}logger[_0xfbf3('0xe')](_0xfbf3('0xb'),_0x154f23,_0xfed45a[_0xfbf3('0xe')][_0xfbf3('0x10')]);return _0x58460f(_0xfed45a[_0xfbf3('0xe')]['message']);}else{logger['info'](_0xfbf3('0xb'),_0x154f23,'request\x20sent');_0x58460f(_0xfed45a[_0xfbf3('0x11')][_0xfbf3('0x10')]);}})['catch'](function(_0x4118e4){logger[_0xfbf3('0xe')](_0xfbf3('0xb'),_0x154f23,_0x4118e4);_0x2c1143(_0x4118e4);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 382f0f5..e06d0e2 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 _0xa95e=['multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','query','post','create','put','update','delete','destroy'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xa95e,0x1c2));var _0xea95=function(_0x30f12e,_0x2daed5){_0x30f12e=_0x30f12e-0x0;var _0x182b6d=_0xa95e[_0x30f12e];return _0x182b6d;};'use strict';var multer=require(_0xea95('0x0'));var util=require('util');var path=require(_0xea95('0x1'));var timeout=require(_0xea95('0x2'));var express=require(_0xea95('0x3'));var router=express[_0xea95('0x4')]();var fs_extra=require(_0xea95('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xea95('0x6'));var config=require(_0xea95('0x7'));var controller=require(_0xea95('0x8'));router[_0xea95('0x9')]('/',auth[_0xea95('0xa')](),controller[_0xea95('0xb')]);router[_0xea95('0x9')](_0xea95('0xc'),auth['isAuthenticated'](),controller[_0xea95('0xd')]);router[_0xea95('0x9')](_0xea95('0xe'),auth[_0xea95('0xa')](),controller[_0xea95('0xf')]);router[_0xea95('0x9')](_0xea95('0x10'),auth[_0xea95('0xa')](),controller[_0xea95('0x11')]);router[_0xea95('0x9')]('/:id/query',auth[_0xea95('0xa')](),controller[_0xea95('0x12')]);router[_0xea95('0x13')]('/',auth[_0xea95('0xa')](),controller[_0xea95('0x14')]);router[_0xea95('0x15')](_0xea95('0xc'),auth[_0xea95('0xa')](),controller[_0xea95('0x16')]);router[_0xea95('0x17')](_0xea95('0xc'),auth[_0xea95('0xa')](),controller[_0xea95('0x18')]);module['exports']=router; \ No newline at end of file +var _0xb575=['../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/run','run','/:id/query','query','create','put','update','delete','exports','multer','path','Router','fs-extra'];(function(_0x485023,_0x41a05f){var _0x106731=function(_0x3b70d0){while(--_0x3b70d0){_0x485023['push'](_0x485023['shift']());}};_0x106731(++_0x41a05f);}(_0xb575,0x1e0));var _0x5b57=function(_0x3f7570,_0x4d4688){_0x3f7570=_0x3f7570-0x0;var _0x4bd721=_0xb575[_0x3f7570];return _0x4bd721;};'use strict';var multer=require(_0x5b57('0x0'));var util=require('util');var path=require(_0x5b57('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5b57('0x2')]();var fs_extra=require(_0x5b57('0x3'));var auth=require(_0x5b57('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5b57('0x5'));var controller=require(_0x5b57('0x6'));router[_0x5b57('0x7')]('/',auth[_0x5b57('0x8')](),controller[_0x5b57('0x9')]);router[_0x5b57('0x7')](_0x5b57('0xa'),auth['isAuthenticated'](),controller[_0x5b57('0xb')]);router[_0x5b57('0x7')](_0x5b57('0xc'),auth[_0x5b57('0x8')](),controller['preview']);router[_0x5b57('0x7')](_0x5b57('0xd'),auth[_0x5b57('0x8')](),controller[_0x5b57('0xe')]);router[_0x5b57('0x7')](_0x5b57('0xf'),auth[_0x5b57('0x8')](),controller[_0x5b57('0x10')]);router['post']('/',auth[_0x5b57('0x8')](),controller[_0x5b57('0x11')]);router[_0x5b57('0x12')](_0x5b57('0xa'),auth[_0x5b57('0x8')](),controller[_0x5b57('0x13')]);router[_0x5b57('0x14')]('/:id',auth[_0x5b57('0x8')](),controller['destroy']);module[_0x5b57('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 77f655f..3864795 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 _0xf494=['STRING','TEXT','sequelize','exports'];(function(_0x5d225a,_0x2debe9){var _0x1e7761=function(_0x491dc2){while(--_0x491dc2){_0x5d225a['push'](_0x5d225a['shift']());}};_0x1e7761(++_0x2debe9);}(_0xf494,0x1c6));var _0x4f49=function(_0x29e600,_0x563ae1){_0x29e600=_0x29e600-0x0;var _0x5319ae=_0xf494[_0x29e600];return _0x5319ae;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'name':{'type':Sequelize[_0x4f49('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x4f49('0x2')]},'table':{'type':Sequelize[_0x4f49('0x2')]},'conditions':{'type':Sequelize[_0x4f49('0x3')]},'joins':{'type':Sequelize[_0x4f49('0x3')]}}; \ No newline at end of file +var _0xbd51=['sequelize','STRING'];(function(_0x20acdb,_0x210c8e){var _0x383b0d=function(_0x5d0919){while(--_0x5d0919){_0x20acdb['push'](_0x20acdb['shift']());}};_0x383b0d(++_0x210c8e);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x159995,_0x427e32){_0x159995=_0x159995-0x0;var _0x26399c=_0xbd51[_0x159995];return _0x26399c;};'use strict';var Sequelize=require(_0x1bd5('0x0'));module['exports']={'name':{'type':Sequelize[_0x1bd5('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x1bd5('0x1')]},'parent':{'type':Sequelize[_0x1bd5('0x1')]},'table':{'type':Sequelize[_0x1bd5('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 1dc48bd..88e87d1 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 _0x1cb9=['runReport','left_join','SEC_TO_TIME(%s)','IS\x20NULL','clone','debug','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','apply','reject','then','destroy','get','UserProfileResource','stack','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','body','user','role','autoAssociation','create','DefaultReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','order','DESC','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','COUNT(%s)','GROUP_CONCAT(%s)','HOUR(%s)','value','groupBy','alias','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)'];(function(_0x22967e,_0x5b31be){var _0x290947=function(_0x108352){while(--_0x108352){_0x22967e['push'](_0x22967e['shift']());}};_0x290947(++_0x5b31be);}(_0x1cb9,0x14e));var _0x91cb=function(_0x128444,_0x4659b0){_0x128444=_0x128444-0x0;var _0x28fa45=_0x1cb9[_0x128444];return _0x28fa45;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];var dbH=require(_0x91cb('0x18'))['dbH'];function respondWithStatusCode(_0x20e6e0,_0x3ea707){_0x3ea707=_0x3ea707||0xcc;return function(_0x44f2e9){if(_0x44f2e9){return _0x20e6e0[_0x91cb('0x19')](_0x3ea707);}return _0x20e6e0['status'](_0x3ea707)['end']();};}function respondWithResult(_0x4aae25,_0x3d22b7){_0x3d22b7=_0x3d22b7||0xc8;return function(_0x585470){if(_0x585470){return _0x4aae25['status'](_0x3d22b7)[_0x91cb('0x1a')](_0x585470);}};}function respondWithFilteredResult(_0xc3629e,_0x347980){return function(_0x5ea796){if(_0x5ea796){var _0x238f11=typeof _0x347980[_0x91cb('0x1b')]==='undefined'&&typeof _0x347980[_0x91cb('0x1c')]===_0x91cb('0x1d');var _0x1cd34b=_0x5ea796[_0x91cb('0x1e')];var _0x5cc1c3=_0x238f11?0x0:_0x347980[_0x91cb('0x1b')];var _0x7dcf60=_0x238f11?_0x5ea796['count']:_0x347980[_0x91cb('0x1b')]+_0x347980['limit'];var _0x55042a;if(_0x7dcf60>=_0x1cd34b){_0x7dcf60=_0x1cd34b;_0x55042a=0xc8;}else{_0x55042a=0xce;}_0xc3629e[_0x91cb('0x1f')](_0x55042a);return _0xc3629e[_0x91cb('0x20')]('Content-Range',_0x5cc1c3+'-'+_0x7dcf60+'/'+_0x1cd34b)['json'](_0x5ea796);}return null;};}function patchUpdates(_0x5b385a){return function(_0x438162){try{jsonpatch[_0x91cb('0x21')](_0x438162,_0x5b385a,!![]);}catch(_0x20aff5){return BPromise[_0x91cb('0x22')](_0x20aff5);}return _0x438162['save']();};}function saveUpdates(_0x45c4b3,_0x43881c){return function(_0x1fa837){if(_0x1fa837){return _0x1fa837['update'](_0x45c4b3)[_0x91cb('0x23')](function(_0x1a7a54){return _0x1a7a54;});}return null;};}function removeEntity(_0x2447e7,_0x422d14){return function(_0x3ca500){if(_0x3ca500){return _0x3ca500[_0x91cb('0x24')]()[_0x91cb('0x23')](function(){var _0x423c4f=_0x3ca500[_0x91cb('0x25')]({'plain':!![]});var _0x4c8438='DefaultReports';return db[_0x91cb('0x26')]['destroy']({'where':{'type':_0x4c8438,'resourceId':_0x423c4f['id']}})[_0x91cb('0x23')](function(){return _0x3ca500;});})[_0x91cb('0x23')](function(){_0x2447e7[_0x91cb('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9b26a6,_0x4f5a7b){return function(_0x4572f6){if(!_0x4572f6){_0x9b26a6[_0x91cb('0x19')](0x194);}return _0x4572f6;};}function handleError(_0x3b3ee6,_0x2fb473){_0x2fb473=_0x2fb473||0x1f4;return function(_0x468908){logger['error'](_0x468908[_0x91cb('0x27')]);if(_0x468908['name']){delete _0x468908[_0x91cb('0x28')];}_0x3b3ee6[_0x91cb('0x1f')](_0x2fb473)[_0x91cb('0x29')](_0x468908);};}exports['index']=function(_0x775c25,_0x146e1f){var _0x25bbf9={},_0x361e4c={},_0xf296bc={'count':0x0,'rows':[]};var _0x3dab18=_[_0x91cb('0x2a')](db[_0x91cb('0x2b')][_0x91cb('0x2c')],function(_0x5e6ed3){return{'name':_0x5e6ed3[_0x91cb('0x2d')],'type':_0x5e6ed3[_0x91cb('0x2e')][_0x91cb('0x2f')]};});_0x361e4c[_0x91cb('0x30')]=_[_0x91cb('0x2a')](_0x3dab18,'name');_0x361e4c[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x775c25[_0x91cb('0x31')]);_0x361e4c[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0x361e4c['model'],_0x361e4c[_0x91cb('0x31')]);_0x25bbf9['attributes']=_['intersection'](_0x361e4c['model'],qs[_0x91cb('0x35')](_0x775c25['query'][_0x91cb('0x35')]));_0x25bbf9['attributes']=_0x25bbf9['attributes'][_0x91cb('0x36')]?_0x25bbf9[_0x91cb('0x37')]:_0x361e4c[_0x91cb('0x30')];if(!_0x775c25[_0x91cb('0x31')][_0x91cb('0x38')]('nolimit')){_0x25bbf9[_0x91cb('0x1c')]=qs[_0x91cb('0x1c')](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1c')]);_0x25bbf9['offset']=qs['offset'](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1b')]);}_0x25bbf9['order']=qs[_0x91cb('0x39')](_0x775c25[_0x91cb('0x31')]['sort']);_0x25bbf9[_0x91cb('0x3a')]=qs[_0x91cb('0x33')](_['pick'](_0x775c25[_0x91cb('0x31')],_0x361e4c['filters']),_0x3dab18);if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3b')]){_0x25bbf9[_0x91cb('0x3a')]=_[_0x91cb('0x3c')](_0x25bbf9[_0x91cb('0x3a')],{'$or':_[_0x91cb('0x2a')](_0x3dab18,function(_0x5d0e37){if(_0x5d0e37[_0x91cb('0x2e')]!==_0x91cb('0x3d')){var _0x4e5b4b={};_0x4e5b4b[_0x5d0e37[_0x91cb('0x28')]]={'$like':'%'+_0x775c25['query'][_0x91cb('0x3b')]+'%'};return _0x4e5b4b;}})});}_0x25bbf9=_[_0x91cb('0x3c')]({},_0x25bbf9,_0x775c25[_0x91cb('0x3e')]);var _0x174794={'where':_0x25bbf9['where']};return db[_0x91cb('0x2b')][_0x91cb('0x1e')](_0x174794)[_0x91cb('0x23')](function(_0x37e777){_0xf296bc[_0x91cb('0x1e')]=_0x37e777;if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3f')]){_0x25bbf9[_0x91cb('0x40')]=[{'all':!![]}];}return db[_0x91cb('0x2b')][_0x91cb('0x41')](_0x25bbf9);})['then'](function(_0x16993f){_0xf296bc['rows']=_0x16993f;return _0xf296bc;})[_0x91cb('0x23')](respondWithFilteredResult(_0x146e1f,_0x25bbf9))['catch'](handleError(_0x146e1f,null));};exports[_0x91cb('0x42')]=function(_0x52e82c,_0x138f48){var _0x477131={'raw':!![],'where':{'id':_0x52e82c[_0x91cb('0x43')]['id']}},_0xba99ce={};_0xba99ce['model']=_[_0x91cb('0x32')](db[_0x91cb('0x2b')]['rawAttributes']);_0xba99ce[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x52e82c[_0x91cb('0x31')]);_0xba99ce[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0xba99ce[_0x91cb('0x30')],_0xba99ce[_0x91cb('0x31')]);_0x477131[_0x91cb('0x37')]=_[_0x91cb('0x34')](_0xba99ce['model'],qs[_0x91cb('0x35')](_0x52e82c[_0x91cb('0x31')][_0x91cb('0x35')]));_0x477131[_0x91cb('0x37')]=_0x477131[_0x91cb('0x37')][_0x91cb('0x36')]?_0x477131[_0x91cb('0x37')]:_0xba99ce[_0x91cb('0x30')];if(_0x52e82c['query'][_0x91cb('0x3f')]){_0x477131[_0x91cb('0x40')]=[{'all':!![]}];}_0x477131=_[_0x91cb('0x3c')]({},_0x477131,_0x52e82c[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x477131)[_0x91cb('0x23')](handleEntityNotFound(_0x138f48,null))['then'](respondWithResult(_0x138f48,null))[_0x91cb('0x45')](handleError(_0x138f48,null));};exports['create']=function(_0x2c419b,_0x4c0acd){return db['AnalyticDefaultReport']['create'](_0x2c419b[_0x91cb('0x46')],{})[_0x91cb('0x23')](function(_0x3d62c4){var _0x2f8384=_0x2c419b[_0x91cb('0x47')]['get']({'plain':!![]});if(!_0x2f8384)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f8384[_0x91cb('0x48')]===_0x91cb('0x47')){var _0x140994=_0x3d62c4[_0x91cb('0x25')]({'plain':!![]});var _0x57adff='Reports';return db['UserProfileSection'][_0x91cb('0x44')]({'where':{'name':_0x57adff,'userProfileId':_0x2f8384['userProfileId']},'raw':!![]})[_0x91cb('0x23')](function(_0x4aa670){if(_0x4aa670&&_0x4aa670[_0x91cb('0x49')]===0x0){return db[_0x91cb('0x26')][_0x91cb('0x4a')]({'name':_0x140994[_0x91cb('0x28')],'resourceId':_0x140994['id'],'type':_0x91cb('0x4b'),'sectionId':_0x4aa670['id']},{})[_0x91cb('0x23')](function(){return _0x3d62c4;});}else{return _0x3d62c4;}})[_0x91cb('0x45')](function(_0x30fd4e){logger[_0x91cb('0x4c')](_0x91cb('0x4d'),_0x30fd4e);throw _0x30fd4e;});}return _0x3d62c4;})[_0x91cb('0x23')](respondWithResult(_0x4c0acd,0xc9))['catch'](handleError(_0x4c0acd,null));};exports[_0x91cb('0x4e')]=function(_0x1fa45a,_0x4d7a34){if(_0x1fa45a[_0x91cb('0x46')]['id']){delete _0x1fa45a[_0x91cb('0x46')]['id'];}return db['AnalyticDefaultReport'][_0x91cb('0x44')]({'where':{'id':_0x1fa45a[_0x91cb('0x43')]['id']}})[_0x91cb('0x23')](handleEntityNotFound(_0x4d7a34,null))[_0x91cb('0x23')](saveUpdates(_0x1fa45a[_0x91cb('0x46')],null))[_0x91cb('0x23')](respondWithResult(_0x4d7a34,null))[_0x91cb('0x45')](handleError(_0x4d7a34,null));};exports[_0x91cb('0x24')]=function(_0x3320bd,_0x93ef52){return db[_0x91cb('0x2b')]['find']({'where':{'id':_0x3320bd[_0x91cb('0x43')]['id']}})['then'](handleEntityNotFound(_0x93ef52,null))[_0x91cb('0x23')](removeEntity(_0x93ef52,null))['catch'](handleError(_0x93ef52,null));};exports[_0x91cb('0x4f')]=function(_0x1b2fec,_0x1986d7){var _0x47a6cd=0xa;var _0xe49d42=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),_0x91cb('0x52')];var _0x365afd={'SUM':_0x91cb('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x5c2c01={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x91cb('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':_0x91cb('0x5c')};var _0x5ae0d2=function(_0x4f19c8){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4f19c8);};var _0x551836=function(_0x22fea8){if(!_0x22fea8||!_0x22fea8['rules'][_0x91cb('0x36')]){return'';}for(var _0xe08233='(',_0xd7be15=0x0;_0xd7be15<_0x22fea8[_0x91cb('0x61')]['length'];_0xd7be15+=0x1){_0xd7be15>0x0&&(_0xe08233+='\x20'+_0x22fea8[_0x91cb('0x62')]+'\x20');_0xe08233+=_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]?_0x551836(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]):_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x64')]+'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')]+(_0x5ae0d2(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')])?'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15]['value']:'');}return _0xe08233+')';};var _0x2cf4d0={'where':{'id':_0x1b2fec[_0x91cb('0x43')]['id']}},_0x2e301a,_0x474682,_0x51ab8a,_0x21c890,_0xca33a2;_0x2cf4d0=_['merge']({},_0x2cf4d0,_0x1b2fec[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x2cf4d0)[_0x91cb('0x23')](function(_0x80fcc6){if(_0x80fcc6){_0x2e301a=_0x80fcc6;return _0x80fcc6[_0x91cb('0x66')]();}return null;})['then'](function(_0x1c0b66){if(_0x1c0b66){if(!_0x1c0b66[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x474682=_0x1c0b66;return db[_0x91cb('0x6a')]['findAll']({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x28bfe5){if(_0x28bfe5){_0x51ab8a=_[_0x91cb('0x6b')](_0x28bfe5,'id');var _0x1f0ba2;var _0x891569=squel[_0x91cb('0x6c')]();_0x891569[_0x91cb('0x6d')](_0x2e301a[_0x91cb('0x6e')]);for(var _0x43629b=0x0;_0x43629b<_0x474682[_0x91cb('0x36')];_0x43629b+=0x1){_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x6f')]?_0x51ab8a[_0x474682[_0x43629b][_0x91cb('0x6f')]][_0x91cb('0x70')]:_0x474682[_0x43629b][_0x91cb('0x64')];_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x365afd[_0x474682[_0x43629b][_0x91cb('0x71')]],'%s',_0x1f0ba2):_0x1f0ba2;_0x1f0ba2=_0x474682[_0x43629b]['format']?_[_0x91cb('0x72')](_0x5c2c01[_0x474682[_0x43629b][_0x91cb('0x73')]],'%s',_0x1f0ba2):_0x1f0ba2;if(_0x474682[_0x43629b]['groupBy']){_0x891569[_0x91cb('0x63')](_0x1f0ba2);}_0x474682[_0x43629b][_0x91cb('0x74')]&&_0x891569[_0x91cb('0x75')](_0x1f0ba2,_0x474682[_0x43629b]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x891569[_0x91cb('0x64')](_0x1f0ba2,_0x474682[_0x43629b]['alias']||_0x1f0ba2);}if(_0x2e301a['joins']){_0x2e301a[_0x91cb('0x77')]=JSON['parse'](_0x2e301a[_0x91cb('0x77')]);for(var _0x376f56=0x0;_0x376f56<_0x2e301a['joins'][_0x91cb('0x36')];_0x376f56+=0x1){if(_0x2e301a['joins'][_0x376f56][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0xe49d42,_0x2e301a['joins'][_0x376f56]['type'])&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')]&&_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignTable']&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x79')]){_0x891569[_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x2e')]](_0x2e301a['joins'][_0x376f56][_0x91cb('0x7a')],null,util['format'](_0x91cb('0x7b'),_0x2e301a[_0x91cb('0x6e')],_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')],_0x2e301a['joins'][_0x376f56]['foreignTable'],_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignKey']));}}}if(_0x2e301a[_0x91cb('0x7c')]){_0x2e301a[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2e301a[_0x91cb('0x7c')]);_0x891569[_0x91cb('0x3a')](_0x551836(_0x2e301a[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0xca33a2=_0x891569['clone']();_0x891569[_0x91cb('0x1c')](_0x47a6cd);_0x891569[_0x91cb('0x1b')](0x0);logger['debug'](_0x91cb('0x7e'),_0x891569['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x891569[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});}})[_0x91cb('0x23')](respondWithResult(_0x1986d7,null))[_0x91cb('0x45')](handleError(_0x1986d7,null));};function runReport(_0x23380a,_0x14cad8,_0x20a64f){var _0x11411d=_0x14cad8[_0x91cb('0x28')];var _0x14882d=0xa;var _0x22ba54=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),'cross_join'];var _0x1235c0={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':_0x91cb('0x84'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x91cb('0x59')};var _0xdee7f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x91cb('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x95f2de=function(_0x4d777a){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d777a);};var _0x443c01=function(_0x4e899c){if(!_0x4e899c||!_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x42d07b='(',_0x427afd=0x0;_0x427afd<_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')];_0x427afd+=0x1){_0x427afd>0x0&&(_0x42d07b+='\x20'+_0x4e899c[_0x91cb('0x62')]+'\x20');_0x42d07b+=_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]?_0x443c01(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]):_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x64')]+'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')]+(_0x95f2de(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')])?'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x86')]:'');}return _0x42d07b+')';};var _0x39b5bd={'where':{'id':_0x23380a['id']}},_0x315518,_0x3d944d,_0x43b96c,_0xe4d946,_0x32d426;_0x39b5bd=_['merge']({},_0x39b5bd,_0x20a64f);return db[_0x91cb('0x2b')][_0x91cb('0x44')](_0x39b5bd)[_0x91cb('0x23')](function(_0x1a654b){if(_0x1a654b){_0x315518=_0x1a654b;return _0x1a654b[_0x91cb('0x66')]();}return null;})[_0x91cb('0x23')](function(_0x404457){if(_0x404457){if(!_0x404457[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x3d944d=_0x404457;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})['then'](function(_0x5689ea){if(_0x5689ea){_0x43b96c=_[_0x91cb('0x6b')](_0x5689ea,'id');var _0x265ffb;var _0x4f66f=squel[_0x91cb('0x6c')]();_0x4f66f[_0x91cb('0x6d')](_0x315518[_0x91cb('0x6e')]);for(var _0x210b46=0x0;_0x210b46<_0x3d944d[_0x91cb('0x36')];_0x210b46+=0x1){_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x6f')]?_0x43b96c[_0x3d944d[_0x210b46][_0x91cb('0x6f')]]['metric']:_0x3d944d[_0x210b46][_0x91cb('0x64')];_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x71')]?_['replace'](_0x1235c0[_0x3d944d[_0x210b46][_0x91cb('0x71')]],'%s',_0x265ffb):_0x265ffb;_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x73')]?_['replace'](_0xdee7f[_0x3d944d[_0x210b46][_0x91cb('0x73')]],'%s',_0x265ffb):_0x265ffb;if(_0x3d944d[_0x210b46][_0x91cb('0x87')]){_0x4f66f[_0x91cb('0x63')](_0x265ffb);}_0x3d944d[_0x210b46][_0x91cb('0x74')]&&_0x4f66f[_0x91cb('0x75')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x74')]===_0x91cb('0x76')?![]:!![]);_0x4f66f[_0x91cb('0x64')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x88')]||_0x265ffb);}if(_0x315518[_0x91cb('0x77')]){_0x315518[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x315518['joins']);for(var _0x5c0725=0x0;_0x5c0725<_0x315518[_0x91cb('0x77')][_0x91cb('0x36')];_0x5c0725+=0x1){if(_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0x22ba54,_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')])&&_0x315518['joins'][_0x5c0725][_0x91cb('0x78')]&&_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')]&&_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]){_0x4f66f[_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]](_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')],null,util[_0x91cb('0x73')](_0x91cb('0x7b'),_0x315518[_0x91cb('0x6e')],_0x315518[_0x91cb('0x77')][_0x5c0725]['parentKey'],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x7a')],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]));}}}if(_0x315518['conditions']){_0x315518['conditions']=JSON['parse'](_0x315518[_0x91cb('0x7c')]);_0x4f66f[_0x91cb('0x3a')](_0x443c01(_0x315518[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0x32d426=_0x4f66f['clone']();_0x4f66f[_0x91cb('0x1c')](_0x14882d);_0x4f66f[_0x91cb('0x1b')](0x0);return;}})[_0x91cb('0x23')](function(){if(_0x14cad8[_0x91cb('0x89')]==='web'){return null;}var _0x4bf7c7=_[_0x91cb('0x3c')](_0x14cad8,{'name':_0x14cad8[_0x91cb('0x8a')]||_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],'basename':_0x11411d,'savename':util[_0x91cb('0x73')](_0x91cb('0x8b'),_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],require(_0x91cb('0x8c'))[_0x91cb('0x8d')](0x4),_0x14cad8[_0x91cb('0x89')]||_0x91cb('0x8e')),'reportId':_0x315518['id'],'reportType':_0x91cb('0x8f')});return db['AnalyticExtractedReport']['create'](_0x4bf7c7,{'raw':!![]});})[_0x91cb('0x23')](function(_0x48a910){if(_0x315518[_0x91cb('0x6e')]===_0x91cb('0x90')){_0x32d426[_0x91cb('0x3a')](_0x315518[_0x91cb('0x6e')]+_0x91cb('0x91'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}else{_0x32d426[_0x91cb('0x3a')](_0x315518['table']+_0x91cb('0x94'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}if(_0x48a910){logger[_0x91cb('0x95')](_0x91cb('0x96'),_0x32d426['toString']());require(_0x91cb('0x97'))[_0x91cb('0x98')](path[_0x91cb('0x50')](__dirname,_0x91cb('0x99'),_0x48a910[_0x91cb('0x89')]),[_0x48a910['id'],_0x32d426['toString'](),path[_0x91cb('0x50')](__dirname,_0x91cb('0x9a'),_0x48a910[_0x91cb('0x9b')]),_0x11411d]);return _0x48a910;}else{var _0x22b6d3=squel[_0x91cb('0x6c')]();_0x22b6d3[_0x91cb('0x6d')]('('+_0x32d426[_0x91cb('0x80')]()+')',_0x91cb('0x9c'));_0x22b6d3[_0x91cb('0x64')](_0x91cb('0x9d'),_0x91cb('0x1e'));_0x32d426[_0x91cb('0x1c')](_0x14cad8[_0x91cb('0x1c')]||_0x14882d);_0x32d426[_0x91cb('0x1b')](_0x14cad8[_0x91cb('0x1b')]||0x0);return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x22b6d3[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]})[_0x91cb('0x23')](function(_0x275c80){if(!_0x275c80[_0x91cb('0x36')]){_0xe4d946=0x0;}else{_0xe4d946=_0x275c80[0x0][_0x91cb('0x1e')]||0x0;}return dbH[_0x91cb('0x7f')]['query'](_0x32d426[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});})[_0x91cb('0x23')](function(_0x5ca377){return{'rows':_0x5ca377||[],'count':_0xe4d946};});}});}exports['run']=function(_0x552490,_0x5174ac){return runReport(_0x552490['params'],_0x552490[_0x91cb('0x31')],_0x552490[_0x91cb('0x3e')])[_0x91cb('0x23')](respondWithResult(_0x5174ac,null))[_0x91cb('0x45')](handleError(_0x5174ac,null));};exports[_0x91cb('0x9e')]=runReport;exports[_0x91cb('0x31')]=function(_0x3462c5,_0x146346){var _0xe3d97f=0xa;var _0x3b93c3=['join',_0x91cb('0x9f'),_0x91cb('0x51'),'cross_join'];var _0x154e6a={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x2a05af={'SEC_TO_TIME':_0x91cb('0xa0'),'DATE':_0x91cb('0x5a'),'HOUR':_0x91cb('0x85'),'ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x34c1f2=function(_0x4d82b4){return!_[_0x91cb('0x5d')]([_0x91cb('0xa1'),_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d82b4);};var _0x432099=function(_0x344c95){if(!_0x344c95||!_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x570cf0='(',_0xb3a6c4=0x0;_0xb3a6c4<_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')];_0xb3a6c4+=0x1){_0xb3a6c4>0x0&&(_0x570cf0+='\x20'+_0x344c95[_0x91cb('0x62')]+'\x20');_0x570cf0+=_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]?_0x432099(_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]):_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x64')]+'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x65')]+(_0x34c1f2(_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['condition'])?'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['value']:'');}return _0x570cf0+')';};var _0x39ba62={'where':{'id':_0x3462c5[_0x91cb('0x43')]['id']}},_0x2ab5a3,_0x10a9f6,_0x43ad75,_0x1382ba,_0x12da14;_0x39ba62=_[_0x91cb('0x3c')]({},_0x39ba62,_0x3462c5['options']);return db[_0x91cb('0x2b')]['find'](_0x39ba62)[_0x91cb('0x23')](function(_0x2f7387){if(_0x2f7387){_0x2ab5a3=_0x2f7387;return _0x2f7387[_0x91cb('0x66')]();}return null;})['then'](function(_0x1f2ef8){if(_0x1f2ef8){if(!_0x1f2ef8[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x10a9f6=_0x1f2ef8;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x3ac830){if(_0x3ac830){_0x43ad75=_['keyBy'](_0x3ac830,'id');var _0x469e62;var _0x1e9441=squel[_0x91cb('0x6c')]();_0x1e9441[_0x91cb('0x6d')](_0x2ab5a3[_0x91cb('0x6e')]);for(var _0x416390=0x0;_0x416390<_0x10a9f6[_0x91cb('0x36')];_0x416390+=0x1){_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x6f')]?_0x43ad75[_0x10a9f6[_0x416390]['MetricId']][_0x91cb('0x70')]:_0x10a9f6[_0x416390][_0x91cb('0x64')];_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x154e6a[_0x10a9f6[_0x416390]['function']],'%s',_0x469e62):_0x469e62;_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x73')]?_['replace'](_0x2a05af[_0x10a9f6[_0x416390][_0x91cb('0x73')]],'%s',_0x469e62):_0x469e62;if(_0x10a9f6[_0x416390][_0x91cb('0x87')]){_0x1e9441[_0x91cb('0x63')](_0x469e62);}_0x10a9f6[_0x416390][_0x91cb('0x74')]&&_0x1e9441[_0x91cb('0x75')](_0x469e62,_0x10a9f6[_0x416390]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x1e9441['field'](_0x469e62,_0x10a9f6[_0x416390]['alias']||_0x469e62);}if(_0x2ab5a3[_0x91cb('0x77')]){_0x2ab5a3[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x77')]);for(var _0x286ed7=0x0;_0x286ed7<_0x2ab5a3[_0x91cb('0x77')][_0x91cb('0x36')];_0x286ed7+=0x1){if(_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['type']&&_[_0x91cb('0x5d')](_0x3b93c3,_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x2e')])&&_0x2ab5a3['joins'][_0x286ed7]['parentKey']&&_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x7a')]&&_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x79')]){_0x1e9441[_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x2e')]](_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],null,util[_0x91cb('0x73')]('%s.%s\x20=\x20%s.%s',_0x2ab5a3[_0x91cb('0x6e')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x78')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['foreignKey']));}}}if(_0x2ab5a3[_0x91cb('0x7c')]){_0x2ab5a3[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x7c')]);_0x1e9441[_0x91cb('0x3a')](_0x432099(_0x2ab5a3['conditions'][_0x91cb('0x63')]));}_0x12da14=_0x1e9441[_0x91cb('0xa2')]();_0x1e9441[_0x91cb('0x1c')](_0xe3d97f);_0x1e9441[_0x91cb('0x1b')](0x0);logger[_0x91cb('0xa3')](_0x91cb('0x7e'),_0x1e9441['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x1e9441[_0x91cb('0x80')](),{'type':dbH['sequelize'][_0x91cb('0x81')]['SELECT']});}})[_0x91cb('0x23')](function(){return{'sql':_0x12da14[_0x91cb('0x80')]()};})[_0x91cb('0x23')](respondWithResult(_0x146346,null))[_0x91cb('0x45')](handleError(_0x146346,null));}; \ No newline at end of file +var _0x6d38=['Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','select','countTable','COUNT(*)','sequelize','run','SEC_TO_TIME(%s)','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','dbH','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','get','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','AnalyticDefaultReport','findAll','rows','show','keys','fields','find','catch','create','body','user','role','Reports','autoAssociation','UserProfileResource','DefaultReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','right_join','cross_join','SUM(%s)','COUNT(%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\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','AnalyticMetric','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','toString','QueryTypes','SELECT','left_join','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','DESC','%s.%s\x20=\x20%s.%s','output','web','fullPath','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','info'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6d38,0x1ef));var _0x86d3=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x6d38[_0x5f0089];return _0x193892;};'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'];var dbH=require(_0x86d3('0x13'))[_0x86d3('0x14')];function respondWithStatusCode(_0x26d64c,_0xe1b3d7){_0xe1b3d7=_0xe1b3d7||0xcc;return function(_0x1b8d0a){if(_0x1b8d0a){return _0x26d64c[_0x86d3('0x15')](_0xe1b3d7);}return _0x26d64c[_0x86d3('0x16')](_0xe1b3d7)['end']();};}function respondWithResult(_0x1c1ba8,_0x1f35cf){_0x1f35cf=_0x1f35cf||0xc8;return function(_0x356e7d){if(_0x356e7d){return _0x1c1ba8[_0x86d3('0x16')](_0x1f35cf)[_0x86d3('0x17')](_0x356e7d);}};}function respondWithFilteredResult(_0x34fb3b,_0x1ff008){return function(_0x44436d){if(_0x44436d){var _0x53b437=typeof _0x1ff008[_0x86d3('0x18')]===_0x86d3('0x19')&&typeof _0x1ff008[_0x86d3('0x1a')]===_0x86d3('0x19');var _0x46feec=_0x44436d[_0x86d3('0x1b')];var _0x33e459=_0x53b437?0x0:_0x1ff008[_0x86d3('0x18')];var _0x9b76f2=_0x53b437?_0x44436d['count']:_0x1ff008[_0x86d3('0x18')]+_0x1ff008['limit'];var _0x6ced9e;if(_0x9b76f2>=_0x46feec){_0x9b76f2=_0x46feec;_0x6ced9e=0xc8;}else{_0x6ced9e=0xce;}_0x34fb3b['status'](_0x6ced9e);return _0x34fb3b['set'](_0x86d3('0x1c'),_0x33e459+'-'+_0x9b76f2+'/'+_0x46feec)[_0x86d3('0x17')](_0x44436d);}return null;};}function patchUpdates(_0x988066){return function(_0x1720ae){try{jsonpatch['apply'](_0x1720ae,_0x988066,!![]);}catch(_0x2901de){return BPromise['reject'](_0x2901de);}return _0x1720ae[_0x86d3('0x1d')]();};}function saveUpdates(_0x3fdf67,_0x1ce849){return function(_0x5b990d){if(_0x5b990d){return _0x5b990d[_0x86d3('0x1e')](_0x3fdf67)[_0x86d3('0x1f')](function(_0x1fa4ac){return _0x1fa4ac;});}return null;};}function removeEntity(_0x4bf5b8,_0x58ba51){return function(_0x26262a){if(_0x26262a){return _0x26262a['destroy']()[_0x86d3('0x1f')](function(){var _0x1bea5e=_0x26262a[_0x86d3('0x20')]({'plain':!![]});var _0x3c5fe4='DefaultReports';return db['UserProfileResource'][_0x86d3('0x21')]({'where':{'type':_0x3c5fe4,'resourceId':_0x1bea5e['id']}})[_0x86d3('0x1f')](function(){return _0x26262a;});})['then'](function(){_0x4bf5b8[_0x86d3('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42413c,_0x41e2f0){return function(_0x287b96){if(!_0x287b96){_0x42413c[_0x86d3('0x15')](0x194);}return _0x287b96;};}function handleError(_0x11a6fd,_0x14c9ff){_0x14c9ff=_0x14c9ff||0x1f4;return function(_0x1f203e){logger[_0x86d3('0x22')](_0x1f203e[_0x86d3('0x23')]);if(_0x1f203e[_0x86d3('0x24')]){delete _0x1f203e[_0x86d3('0x24')];}_0x11a6fd[_0x86d3('0x16')](_0x14c9ff)[_0x86d3('0x25')](_0x1f203e);};}exports[_0x86d3('0x26')]=function(_0x5b09f6,_0x120a0c){var _0x403be3={},_0x2bda35={},_0x31cefe={'count':0x0,'rows':[]};var _0x7709f0=_[_0x86d3('0x27')](db['AnalyticDefaultReport'][_0x86d3('0x28')],function(_0x5c71df){return{'name':_0x5c71df['fieldName'],'type':_0x5c71df[_0x86d3('0x29')][_0x86d3('0x2a')]};});_0x2bda35[_0x86d3('0x2b')]=_['map'](_0x7709f0,_0x86d3('0x24'));_0x2bda35[_0x86d3('0x2c')]=_['keys'](_0x5b09f6[_0x86d3('0x2c')]);_0x2bda35[_0x86d3('0x2d')]=_[_0x86d3('0x2e')](_0x2bda35[_0x86d3('0x2b')],_0x2bda35[_0x86d3('0x2c')]);_0x403be3[_0x86d3('0x2f')]=_[_0x86d3('0x2e')](_0x2bda35[_0x86d3('0x2b')],qs['fields'](_0x5b09f6['query']['fields']));_0x403be3[_0x86d3('0x2f')]=_0x403be3['attributes'][_0x86d3('0x30')]?_0x403be3['attributes']:_0x2bda35[_0x86d3('0x2b')];if(!_0x5b09f6[_0x86d3('0x2c')][_0x86d3('0x31')](_0x86d3('0x32'))){_0x403be3[_0x86d3('0x1a')]=qs[_0x86d3('0x1a')](_0x5b09f6[_0x86d3('0x2c')]['limit']);_0x403be3[_0x86d3('0x18')]=qs[_0x86d3('0x18')](_0x5b09f6['query'][_0x86d3('0x18')]);}_0x403be3[_0x86d3('0x33')]=qs[_0x86d3('0x34')](_0x5b09f6[_0x86d3('0x2c')]['sort']);_0x403be3[_0x86d3('0x35')]=qs[_0x86d3('0x2d')](_[_0x86d3('0x36')](_0x5b09f6['query'],_0x2bda35[_0x86d3('0x2d')]),_0x7709f0);if(_0x5b09f6[_0x86d3('0x2c')][_0x86d3('0x37')]){_0x403be3[_0x86d3('0x35')]=_[_0x86d3('0x38')](_0x403be3[_0x86d3('0x35')],{'$or':_[_0x86d3('0x27')](_0x7709f0,function(_0x436065){if(_0x436065['type']!==_0x86d3('0x39')){var _0x470978={};_0x470978[_0x436065[_0x86d3('0x24')]]={'$like':'%'+_0x5b09f6[_0x86d3('0x2c')]['filter']+'%'};return _0x470978;}})});}_0x403be3=_[_0x86d3('0x38')]({},_0x403be3,_0x5b09f6[_0x86d3('0x3a')]);var _0x6f72be={'where':_0x403be3[_0x86d3('0x35')]};return db['AnalyticDefaultReport']['count'](_0x6f72be)[_0x86d3('0x1f')](function(_0x4f422b){_0x31cefe['count']=_0x4f422b;if(_0x5b09f6[_0x86d3('0x2c')][_0x86d3('0x3b')]){_0x403be3[_0x86d3('0x3c')]=[{'all':!![]}];}return db[_0x86d3('0x3d')][_0x86d3('0x3e')](_0x403be3);})['then'](function(_0x2a5f6c){_0x31cefe[_0x86d3('0x3f')]=_0x2a5f6c;return _0x31cefe;})[_0x86d3('0x1f')](respondWithFilteredResult(_0x120a0c,_0x403be3))['catch'](handleError(_0x120a0c,null));};exports[_0x86d3('0x40')]=function(_0x810d10,_0x5dfae8){var _0x369f68={'raw':!![],'where':{'id':_0x810d10['params']['id']}},_0xcf6c9e={};_0xcf6c9e['model']=_['keys'](db[_0x86d3('0x3d')][_0x86d3('0x28')]);_0xcf6c9e[_0x86d3('0x2c')]=_[_0x86d3('0x41')](_0x810d10[_0x86d3('0x2c')]);_0xcf6c9e[_0x86d3('0x2d')]=_['intersection'](_0xcf6c9e[_0x86d3('0x2b')],_0xcf6c9e[_0x86d3('0x2c')]);_0x369f68['attributes']=_[_0x86d3('0x2e')](_0xcf6c9e[_0x86d3('0x2b')],qs[_0x86d3('0x42')](_0x810d10[_0x86d3('0x2c')][_0x86d3('0x42')]));_0x369f68[_0x86d3('0x2f')]=_0x369f68['attributes'][_0x86d3('0x30')]?_0x369f68[_0x86d3('0x2f')]:_0xcf6c9e['model'];if(_0x810d10[_0x86d3('0x2c')][_0x86d3('0x3b')]){_0x369f68[_0x86d3('0x3c')]=[{'all':!![]}];}_0x369f68=_[_0x86d3('0x38')]({},_0x369f68,_0x810d10[_0x86d3('0x3a')]);return db['AnalyticDefaultReport'][_0x86d3('0x43')](_0x369f68)[_0x86d3('0x1f')](handleEntityNotFound(_0x5dfae8,null))[_0x86d3('0x1f')](respondWithResult(_0x5dfae8,null))[_0x86d3('0x44')](handleError(_0x5dfae8,null));};exports[_0x86d3('0x45')]=function(_0x7af7b3,_0x1a4345){return db[_0x86d3('0x3d')][_0x86d3('0x45')](_0x7af7b3[_0x86d3('0x46')],{})[_0x86d3('0x1f')](function(_0x1236ea){var _0x4ea940=_0x7af7b3[_0x86d3('0x47')][_0x86d3('0x20')]({'plain':!![]});if(!_0x4ea940)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ea940[_0x86d3('0x48')]===_0x86d3('0x47')){var _0x197047=_0x1236ea[_0x86d3('0x20')]({'plain':!![]});var _0x1dcff0=_0x86d3('0x49');return db['UserProfileSection']['find']({'where':{'name':_0x1dcff0,'userProfileId':_0x4ea940['userProfileId']},'raw':!![]})['then'](function(_0x159253){if(_0x159253&&_0x159253[_0x86d3('0x4a')]===0x0){return db[_0x86d3('0x4b')][_0x86d3('0x45')]({'name':_0x197047[_0x86d3('0x24')],'resourceId':_0x197047['id'],'type':_0x86d3('0x4c'),'sectionId':_0x159253['id']},{})[_0x86d3('0x1f')](function(){return _0x1236ea;});}else{return _0x1236ea;}})['catch'](function(_0x2afb07){logger[_0x86d3('0x22')](_0x86d3('0x4d'),_0x2afb07);throw _0x2afb07;});}return _0x1236ea;})[_0x86d3('0x1f')](respondWithResult(_0x1a4345,0xc9))[_0x86d3('0x44')](handleError(_0x1a4345,null));};exports[_0x86d3('0x1e')]=function(_0x34935f,_0x4c8828){if(_0x34935f[_0x86d3('0x46')]['id']){delete _0x34935f['body']['id'];}return db[_0x86d3('0x3d')][_0x86d3('0x43')]({'where':{'id':_0x34935f[_0x86d3('0x4e')]['id']}})[_0x86d3('0x1f')](handleEntityNotFound(_0x4c8828,null))[_0x86d3('0x1f')](saveUpdates(_0x34935f['body'],null))[_0x86d3('0x1f')](respondWithResult(_0x4c8828,null))[_0x86d3('0x44')](handleError(_0x4c8828,null));};exports[_0x86d3('0x21')]=function(_0x4e10d9,_0x4ad164){return db['AnalyticDefaultReport'][_0x86d3('0x43')]({'where':{'id':_0x4e10d9['params']['id']}})[_0x86d3('0x1f')](handleEntityNotFound(_0x4ad164,null))[_0x86d3('0x1f')](removeEntity(_0x4ad164,null))[_0x86d3('0x44')](handleError(_0x4ad164,null));};exports[_0x86d3('0x4f')]=function(_0x5963bb,_0x4cd835){var _0x551806=0xa;var _0x28655a=[_0x86d3('0x50'),'left_join',_0x86d3('0x51'),_0x86d3('0x52')];var _0xa085b2={'SUM':_0x86d3('0x53'),'COUNT':_0x86d3('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x86d3('0x55'),'MIN':_0x86d3('0x56'),'AVG':_0x86d3('0x57'),'GROUP_CONCAT':_0x86d3('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x86d3('0x59')};var _0x41fad7={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x86d3('0x5a'),'HOUR':_0x86d3('0x5b'),'ROUND':_0x86d3('0x5c'),'UNIX_TIMESTAMP':_0x86d3('0x5d')};var _0x4598d4=function(_0x4029a4){return!_[_0x86d3('0x5e')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x86d3('0x5f'),'IS\x20NOT\x20EMPTY'],_0x4029a4);};var _0x528ca8=function(_0x58e4b6){if(!_0x58e4b6||!_0x58e4b6[_0x86d3('0x60')]['length']){return'';}for(var _0x254ac3='(',_0x5f2ed6=0x0;_0x5f2ed6<_0x58e4b6[_0x86d3('0x60')][_0x86d3('0x30')];_0x5f2ed6+=0x1){_0x5f2ed6>0x0&&(_0x254ac3+='\x20'+_0x58e4b6[_0x86d3('0x61')]+'\x20');_0x254ac3+=_0x58e4b6['rules'][_0x5f2ed6]['group']?_0x528ca8(_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x62')]):_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x63')]+'\x20'+_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x64')]+(_0x4598d4(_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x64')])?'\x20'+_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x65')]:'');}return _0x254ac3+')';};var _0x1e3479={'where':{'id':_0x5963bb[_0x86d3('0x4e')]['id']}},_0x265beb,_0xfaf168,_0xf0dbbb,_0x3f978c,_0x5e1835;_0x1e3479=_[_0x86d3('0x38')]({},_0x1e3479,_0x5963bb['options']);return db[_0x86d3('0x3d')][_0x86d3('0x43')](_0x1e3479)[_0x86d3('0x1f')](function(_0x52dc99){if(_0x52dc99){_0x265beb=_0x52dc99;return _0x52dc99[_0x86d3('0x66')]();}return null;})[_0x86d3('0x1f')](function(_0x45e8d9){if(_0x45e8d9){if(!_0x45e8d9[_0x86d3('0x30')]){throw new db['Sequelize'][(_0x86d3('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xfaf168=_0x45e8d9;return db[_0x86d3('0x68')][_0x86d3('0x3e')]({'raw':!![]});}return null;})[_0x86d3('0x1f')](function(_0x2d4bc1){if(_0x2d4bc1){_0xf0dbbb=_[_0x86d3('0x69')](_0x2d4bc1,'id');var _0x56fd96;var _0x3cc1d8=squel['select']();_0x3cc1d8[_0x86d3('0x6a')](_0x265beb[_0x86d3('0x6b')]);for(var _0x5866fe=0x0;_0x5866fe<_0xfaf168[_0x86d3('0x30')];_0x5866fe+=0x1){_0x56fd96=_0xfaf168[_0x5866fe][_0x86d3('0x6c')]?_0xf0dbbb[_0xfaf168[_0x5866fe][_0x86d3('0x6c')]][_0x86d3('0x6d')]:_0xfaf168[_0x5866fe][_0x86d3('0x63')];_0x56fd96=_0xfaf168[_0x5866fe][_0x86d3('0x6e')]?_[_0x86d3('0x6f')](_0xa085b2[_0xfaf168[_0x5866fe]['function']],'%s',_0x56fd96):_0x56fd96;_0x56fd96=_0xfaf168[_0x5866fe][_0x86d3('0x70')]?_[_0x86d3('0x6f')](_0x41fad7[_0xfaf168[_0x5866fe][_0x86d3('0x70')]],'%s',_0x56fd96):_0x56fd96;if(_0xfaf168[_0x5866fe][_0x86d3('0x71')]){_0x3cc1d8[_0x86d3('0x62')](_0x56fd96);}_0xfaf168[_0x5866fe]['orderBy']&&_0x3cc1d8[_0x86d3('0x33')](_0x56fd96,_0xfaf168[_0x5866fe][_0x86d3('0x72')]==='DESC'?![]:!![]);_0x3cc1d8[_0x86d3('0x63')](_0x56fd96,_0xfaf168[_0x5866fe][_0x86d3('0x73')]||_0x56fd96);}if(_0x265beb[_0x86d3('0x74')]){_0x265beb[_0x86d3('0x74')]=JSON[_0x86d3('0x75')](_0x265beb[_0x86d3('0x74')]);for(var _0x1bf5ba=0x0;_0x1bf5ba<_0x265beb[_0x86d3('0x74')][_0x86d3('0x30')];_0x1bf5ba+=0x1){if(_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x29')]&&_[_0x86d3('0x5e')](_0x28655a,_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x29')])&&_0x265beb['joins'][_0x1bf5ba][_0x86d3('0x76')]&&_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x77')]&&_0x265beb[_0x86d3('0x74')][_0x1bf5ba]['foreignKey']){_0x3cc1d8[_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x29')]](_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x77')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x265beb[_0x86d3('0x6b')],_0x265beb['joins'][_0x1bf5ba][_0x86d3('0x76')],_0x265beb['joins'][_0x1bf5ba]['foreignTable'],_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x78')]));}}}if(_0x265beb[_0x86d3('0x79')]){_0x265beb[_0x86d3('0x79')]=JSON[_0x86d3('0x75')](_0x265beb['conditions']);_0x3cc1d8[_0x86d3('0x35')](_0x528ca8(_0x265beb[_0x86d3('0x79')]['group']));}_0x5e1835=_0x3cc1d8[_0x86d3('0x7a')]();_0x3cc1d8[_0x86d3('0x1a')](_0x551806);_0x3cc1d8['offset'](0x0);logger[_0x86d3('0x7b')]('Limited\x20Query:',_0x3cc1d8[_0x86d3('0x7c')]());return dbH['sequelize']['query'](_0x3cc1d8[_0x86d3('0x7c')](),{'type':dbH['sequelize'][_0x86d3('0x7d')][_0x86d3('0x7e')]});}})[_0x86d3('0x1f')](respondWithResult(_0x4cd835,null))[_0x86d3('0x44')](handleError(_0x4cd835,null));};function runReport(_0x3193d5,_0x3a1acc,_0x268c93){var _0x3b989c=_0x3a1acc['name'];var _0x245b39=0xa;var _0x158f56=[_0x86d3('0x50'),_0x86d3('0x7f'),_0x86d3('0x51'),'cross_join'];var _0x3d8b35={'SUM':_0x86d3('0x53'),'COUNT':_0x86d3('0x54'),'COUNT DISTINCT':_0x86d3('0x80'),'MAX':_0x86d3('0x55'),'MIN':_0x86d3('0x56'),'AVG':_0x86d3('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x86d3('0x81'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xca2e0={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x86d3('0x5b'),'ROUND':_0x86d3('0x5c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1b503a=function(_0x24410c){return!_[_0x86d3('0x5e')]([_0x86d3('0x82'),_0x86d3('0x83'),_0x86d3('0x5f'),_0x86d3('0x84')],_0x24410c);};var _0x5f4a38=function(_0x593b85){if(!_0x593b85||!_0x593b85[_0x86d3('0x60')][_0x86d3('0x30')]){return'';}for(var _0x3fac94='(',_0x28d98e=0x0;_0x28d98e<_0x593b85[_0x86d3('0x60')][_0x86d3('0x30')];_0x28d98e+=0x1){_0x28d98e>0x0&&(_0x3fac94+='\x20'+_0x593b85['operator']+'\x20');_0x3fac94+=_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x62')]?_0x5f4a38(_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x62')]):_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x63')]+'\x20'+_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x64')]+(_0x1b503a(_0x593b85[_0x86d3('0x60')][_0x28d98e]['condition'])?'\x20'+_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x65')]:'');}return _0x3fac94+')';};var _0x4b871b={'where':{'id':_0x3193d5['id']}},_0x584a57,_0x36ee46,_0x1cbc3a,_0x682a6d,_0x5004cd;_0x4b871b=_[_0x86d3('0x38')]({},_0x4b871b,_0x268c93);return db[_0x86d3('0x3d')][_0x86d3('0x43')](_0x4b871b)[_0x86d3('0x1f')](function(_0x3d3e7f){if(_0x3d3e7f){_0x584a57=_0x3d3e7f;return _0x3d3e7f['getFields']();}return null;})[_0x86d3('0x1f')](function(_0x1aaf08){if(_0x1aaf08){if(!_0x1aaf08['length']){throw new db[(_0x86d3('0x85'))][(_0x86d3('0x67'))](_0x86d3('0x86'),0x193);}_0x36ee46=_0x1aaf08;return db[_0x86d3('0x68')]['findAll']({'raw':!![]});}return null;})[_0x86d3('0x1f')](function(_0x2896e1){if(_0x2896e1){_0x1cbc3a=_[_0x86d3('0x69')](_0x2896e1,'id');var _0x18295c;var _0x44af1c=squel['select']();_0x44af1c[_0x86d3('0x6a')](_0x584a57[_0x86d3('0x6b')]);for(var _0x3582a2=0x0;_0x3582a2<_0x36ee46[_0x86d3('0x30')];_0x3582a2+=0x1){_0x18295c=_0x36ee46[_0x3582a2][_0x86d3('0x6c')]?_0x1cbc3a[_0x36ee46[_0x3582a2][_0x86d3('0x6c')]][_0x86d3('0x6d')]:_0x36ee46[_0x3582a2][_0x86d3('0x63')];_0x18295c=_0x36ee46[_0x3582a2][_0x86d3('0x6e')]?_[_0x86d3('0x6f')](_0x3d8b35[_0x36ee46[_0x3582a2]['function']],'%s',_0x18295c):_0x18295c;_0x18295c=_0x36ee46[_0x3582a2]['format']?_[_0x86d3('0x6f')](_0xca2e0[_0x36ee46[_0x3582a2][_0x86d3('0x70')]],'%s',_0x18295c):_0x18295c;if(_0x36ee46[_0x3582a2]['groupBy']){_0x44af1c[_0x86d3('0x62')](_0x18295c);}_0x36ee46[_0x3582a2][_0x86d3('0x72')]&&_0x44af1c[_0x86d3('0x33')](_0x18295c,_0x36ee46[_0x3582a2][_0x86d3('0x72')]===_0x86d3('0x87')?![]:!![]);_0x44af1c[_0x86d3('0x63')](_0x18295c,_0x36ee46[_0x3582a2][_0x86d3('0x73')]||_0x18295c);}if(_0x584a57[_0x86d3('0x74')]){_0x584a57[_0x86d3('0x74')]=JSON['parse'](_0x584a57['joins']);for(var _0x48a6d7=0x0;_0x48a6d7<_0x584a57['joins'][_0x86d3('0x30')];_0x48a6d7+=0x1){if(_0x584a57[_0x86d3('0x74')][_0x48a6d7][_0x86d3('0x29')]&&_[_0x86d3('0x5e')](_0x158f56,_0x584a57[_0x86d3('0x74')][_0x48a6d7][_0x86d3('0x29')])&&_0x584a57[_0x86d3('0x74')][_0x48a6d7]['parentKey']&&_0x584a57[_0x86d3('0x74')][_0x48a6d7][_0x86d3('0x77')]&&_0x584a57[_0x86d3('0x74')][_0x48a6d7][_0x86d3('0x78')]){_0x44af1c[_0x584a57['joins'][_0x48a6d7][_0x86d3('0x29')]](_0x584a57['joins'][_0x48a6d7][_0x86d3('0x77')],null,util[_0x86d3('0x70')](_0x86d3('0x88'),_0x584a57[_0x86d3('0x6b')],_0x584a57[_0x86d3('0x74')][_0x48a6d7]['parentKey'],_0x584a57['joins'][_0x48a6d7][_0x86d3('0x77')],_0x584a57['joins'][_0x48a6d7][_0x86d3('0x78')]));}}}if(_0x584a57['conditions']){_0x584a57[_0x86d3('0x79')]=JSON['parse'](_0x584a57['conditions']);_0x44af1c[_0x86d3('0x35')](_0x5f4a38(_0x584a57[_0x86d3('0x79')][_0x86d3('0x62')]));}_0x5004cd=_0x44af1c[_0x86d3('0x7a')]();_0x44af1c[_0x86d3('0x1a')](_0x245b39);_0x44af1c[_0x86d3('0x18')](0x0);return;}})[_0x86d3('0x1f')](function(){if(_0x3a1acc[_0x86d3('0x89')]===_0x86d3('0x8a')){return null;}var _0x120a85=_[_0x86d3('0x38')](_0x3a1acc,{'name':_0x3a1acc[_0x86d3('0x8b')]||_0x3a1acc[_0x86d3('0x24')]||_0x584a57[_0x86d3('0x24')],'basename':_0x3b989c,'savename':util[_0x86d3('0x70')]('%s-%s.%s',_0x3a1acc['name']||_0x584a57['name'],require(_0x86d3('0x8c'))[_0x86d3('0x8d')](0x4),_0x3a1acc[_0x86d3('0x89')]||_0x86d3('0x8e')),'reportId':_0x584a57['id'],'reportType':_0x86d3('0x8f')});return db[_0x86d3('0x90')][_0x86d3('0x45')](_0x120a85,{'raw':!![]});})[_0x86d3('0x1f')](function(_0x10e23d){if(_0x584a57[_0x86d3('0x6b')]===_0x86d3('0x91')){_0x5004cd['where'](_0x584a57[_0x86d3('0x6b')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x3a1acc[_0x86d3('0x92')],_0x3a1acc[_0x86d3('0x93')]);}else{_0x5004cd[_0x86d3('0x35')](_0x584a57[_0x86d3('0x6b')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3a1acc[_0x86d3('0x92')],_0x3a1acc[_0x86d3('0x93')]);}if(_0x10e23d){logger[_0x86d3('0x94')](_0x86d3('0x95'),_0x5004cd[_0x86d3('0x7c')]());require(_0x86d3('0x96'))[_0x86d3('0x97')](path[_0x86d3('0x50')](__dirname,_0x86d3('0x98'),_0x10e23d[_0x86d3('0x89')]),[_0x10e23d['id'],_0x5004cd[_0x86d3('0x7c')](),path[_0x86d3('0x50')](__dirname,_0x86d3('0x99'),_0x10e23d[_0x86d3('0x9a')]),_0x3b989c]);return _0x10e23d;}else{var _0x428b11=squel[_0x86d3('0x9b')]();_0x428b11[_0x86d3('0x6a')]('('+_0x5004cd['toString']()+')',_0x86d3('0x9c'));_0x428b11[_0x86d3('0x63')](_0x86d3('0x9d'),_0x86d3('0x1b'));_0x5004cd['limit'](_0x3a1acc[_0x86d3('0x1a')]||_0x245b39);_0x5004cd['offset'](_0x3a1acc['offset']||0x0);return dbH[_0x86d3('0x9e')][_0x86d3('0x2c')](_0x428b11[_0x86d3('0x7c')](),{'type':dbH[_0x86d3('0x9e')][_0x86d3('0x7d')][_0x86d3('0x7e')]})[_0x86d3('0x1f')](function(_0x4777f1){if(!_0x4777f1['length']){_0x682a6d=0x0;}else{_0x682a6d=_0x4777f1[0x0]['count']||0x0;}return dbH['sequelize'][_0x86d3('0x2c')](_0x5004cd[_0x86d3('0x7c')](),{'type':dbH[_0x86d3('0x9e')]['QueryTypes'][_0x86d3('0x7e')]});})['then'](function(_0x435b8e){return{'rows':_0x435b8e||[],'count':_0x682a6d};});}});}exports[_0x86d3('0x9f')]=function(_0x73b8e6,_0x2c98e1){return runReport(_0x73b8e6['params'],_0x73b8e6[_0x86d3('0x2c')],_0x73b8e6[_0x86d3('0x3a')])[_0x86d3('0x1f')](respondWithResult(_0x2c98e1,null))['catch'](handleError(_0x2c98e1,null));};exports['runReport']=runReport;exports['query']=function(_0x458997,_0x1e3559){var _0x49a101=0xa;var _0x38d724=['join',_0x86d3('0x7f'),_0x86d3('0x51'),_0x86d3('0x52')];var _0x56ff91={'SUM':_0x86d3('0x53'),'COUNT':_0x86d3('0x54'),'COUNT DISTINCT':_0x86d3('0x80'),'MAX':_0x86d3('0x55'),'MIN':_0x86d3('0x56'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x86d3('0x58'),'GROUP_CONCAT ASC':_0x86d3('0x81'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1f347e={'SEC_TO_TIME':_0x86d3('0xa0'),'DATE':'DATE(%s)','HOUR':_0x86d3('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x45b210=function(_0x144e43){return!_[_0x86d3('0x5e')]([_0x86d3('0x82'),_0x86d3('0x83'),_0x86d3('0x5f'),_0x86d3('0x84')],_0x144e43);};var _0xdc7c21=function(_0x2e0397){if(!_0x2e0397||!_0x2e0397[_0x86d3('0x60')][_0x86d3('0x30')]){return'';}for(var _0x2cc617='(',_0x25339c=0x0;_0x25339c<_0x2e0397['rules'][_0x86d3('0x30')];_0x25339c+=0x1){_0x25339c>0x0&&(_0x2cc617+='\x20'+_0x2e0397[_0x86d3('0x61')]+'\x20');_0x2cc617+=_0x2e0397[_0x86d3('0x60')][_0x25339c][_0x86d3('0x62')]?_0xdc7c21(_0x2e0397[_0x86d3('0x60')][_0x25339c][_0x86d3('0x62')]):_0x2e0397['rules'][_0x25339c][_0x86d3('0x63')]+'\x20'+_0x2e0397['rules'][_0x25339c][_0x86d3('0x64')]+(_0x45b210(_0x2e0397[_0x86d3('0x60')][_0x25339c]['condition'])?'\x20'+_0x2e0397['rules'][_0x25339c][_0x86d3('0x65')]:'');}return _0x2cc617+')';};var _0x2c0070={'where':{'id':_0x458997[_0x86d3('0x4e')]['id']}},_0x31d436,_0x56e713,_0x525559,_0x3b9e1e,_0x1d8d7c;_0x2c0070=_['merge']({},_0x2c0070,_0x458997[_0x86d3('0x3a')]);return db[_0x86d3('0x3d')][_0x86d3('0x43')](_0x2c0070)[_0x86d3('0x1f')](function(_0x1f80be){if(_0x1f80be){_0x31d436=_0x1f80be;return _0x1f80be[_0x86d3('0x66')]();}return null;})[_0x86d3('0x1f')](function(_0x3dddbe){if(_0x3dddbe){if(!_0x3dddbe[_0x86d3('0x30')]){throw new db[(_0x86d3('0x85'))][(_0x86d3('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x56e713=_0x3dddbe;return db[_0x86d3('0x68')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x1d7e83){if(_0x1d7e83){_0x525559=_[_0x86d3('0x69')](_0x1d7e83,'id');var _0x5d9385;var _0x49a499=squel[_0x86d3('0x9b')]();_0x49a499[_0x86d3('0x6a')](_0x31d436[_0x86d3('0x6b')]);for(var _0x33e0a5=0x0;_0x33e0a5<_0x56e713['length'];_0x33e0a5+=0x1){_0x5d9385=_0x56e713[_0x33e0a5][_0x86d3('0x6c')]?_0x525559[_0x56e713[_0x33e0a5][_0x86d3('0x6c')]][_0x86d3('0x6d')]:_0x56e713[_0x33e0a5][_0x86d3('0x63')];_0x5d9385=_0x56e713[_0x33e0a5][_0x86d3('0x6e')]?_['replace'](_0x56ff91[_0x56e713[_0x33e0a5][_0x86d3('0x6e')]],'%s',_0x5d9385):_0x5d9385;_0x5d9385=_0x56e713[_0x33e0a5][_0x86d3('0x70')]?_[_0x86d3('0x6f')](_0x1f347e[_0x56e713[_0x33e0a5]['format']],'%s',_0x5d9385):_0x5d9385;if(_0x56e713[_0x33e0a5][_0x86d3('0x71')]){_0x49a499['group'](_0x5d9385);}_0x56e713[_0x33e0a5][_0x86d3('0x72')]&&_0x49a499[_0x86d3('0x33')](_0x5d9385,_0x56e713[_0x33e0a5]['orderBy']===_0x86d3('0x87')?![]:!![]);_0x49a499[_0x86d3('0x63')](_0x5d9385,_0x56e713[_0x33e0a5][_0x86d3('0x73')]||_0x5d9385);}if(_0x31d436[_0x86d3('0x74')]){_0x31d436[_0x86d3('0x74')]=JSON[_0x86d3('0x75')](_0x31d436['joins']);for(var _0x10af91=0x0;_0x10af91<_0x31d436['joins'][_0x86d3('0x30')];_0x10af91+=0x1){if(_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x29')]&&_[_0x86d3('0x5e')](_0x38d724,_0x31d436['joins'][_0x10af91][_0x86d3('0x29')])&&_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x76')]&&_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x77')]&&_0x31d436[_0x86d3('0x74')][_0x10af91]['foreignKey']){_0x49a499[_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x29')]](_0x31d436['joins'][_0x10af91]['foreignTable'],null,util[_0x86d3('0x70')]('%s.%s\x20=\x20%s.%s',_0x31d436['table'],_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x76')],_0x31d436[_0x86d3('0x74')][_0x10af91]['foreignTable'],_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x78')]));}}}if(_0x31d436[_0x86d3('0x79')]){_0x31d436[_0x86d3('0x79')]=JSON[_0x86d3('0x75')](_0x31d436['conditions']);_0x49a499[_0x86d3('0x35')](_0xdc7c21(_0x31d436[_0x86d3('0x79')]['group']));}_0x1d8d7c=_0x49a499['clone']();_0x49a499['limit'](_0x49a101);_0x49a499[_0x86d3('0x18')](0x0);logger['debug']('Limited\x20Query:',_0x49a499[_0x86d3('0x7c')]());return dbH[_0x86d3('0x9e')]['query'](_0x49a499['toString'](),{'type':dbH[_0x86d3('0x9e')][_0x86d3('0x7d')][_0x86d3('0x7e')]});}})['then'](function(){return{'sql':_0x1d8d7c[_0x86d3('0x7c')]()};})[_0x86d3('0x1f')](respondWithResult(_0x1e3559,null))[_0x86d3('0x44')](handleError(_0x1e3559,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 3d2f53b..03f1abc 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 _0x88cc=['define','AnalyticDefaultReport','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./analyticDefaultReport.attributes'];(function(_0x2fbf61,_0x59228b){var _0x55c54a=function(_0x28154f){while(--_0x28154f){_0x2fbf61['push'](_0x2fbf61['shift']());}};_0x55c54a(++_0x59228b);}(_0x88cc,0x146));var _0xc88c=function(_0x529587,_0x7b9e47){_0x529587=_0x529587-0x0;var _0x4ea039=_0x88cc[_0x529587];return _0x4ea039;};'use strict';var _=require('lodash');var util=require(_0xc88c('0x0'));var logger=require(_0xc88c('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc88c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc88c('0x3'));var rimraf=require(_0xc88c('0x4'));var config=require(_0xc88c('0x5'));var attributes=require(_0xc88c('0x6'));module['exports']=function(_0x147151,_0x5507f0){return _0x147151[_0xc88c('0x7')](_0xc88c('0x8'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f78=['moment','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','analytics_default_reports','lodash','../../config/logger','api'];(function(_0x5849a4,_0x2001db){var _0x3877a9=function(_0x4b6c59){while(--_0x4b6c59){_0x5849a4['push'](_0x5849a4['shift']());}};_0x3877a9(++_0x2001db);}(_0x2f78,0xa8));var _0x82f7=function(_0x4f383c,_0x3150e4){_0x4f383c=_0x4f383c-0x0;var _0x5e4a00=_0x2f78[_0x4f383c];return _0x5e4a00;};'use strict';var _=require(_0x82f7('0x0'));var util=require('util');var logger=require(_0x82f7('0x1'))(_0x82f7('0x2'));var moment=require(_0x82f7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x82f7('0x4'));var rimraf=require(_0x82f7('0x5'));var config=require(_0x82f7('0x6'));var attributes=require(_0x82f7('0x7'));module['exports']=function(_0x375b6d,_0x28c04){return _0x375b6d['define']('AnalyticDefaultReport',attributes,{'tableName':_0x82f7('0x8'),'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 45a0098..ca410f0 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 _0x7a03=['request','then','info','debug','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','request\x20sent','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise'];(function(_0x220d07,_0x58dbe7){var _0x242e4a=function(_0x561c8f){while(--_0x561c8f){_0x220d07['push'](_0x220d07['shift']());}};_0x242e4a(++_0x58dbe7);}(_0x7a03,0x1f0));var _0x37a0=function(_0x1b9edd,_0x3e2201){_0x1b9edd=_0x1b9edd-0x0;var _0x448d87=_0x7a03[_0x1b9edd];return _0x448d87;};'use strict';var _=require('lodash');var util=require(_0x37a0('0x0'));var moment=require(_0x37a0('0x1'));var BPromise=require(_0x37a0('0x2'));var rs=require(_0x37a0('0x3'));var fs=require('fs');var Redis=require(_0x37a0('0x4'));var db=require(_0x37a0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x37a0('0x6'));var config=require('../../config/environment');var jayson=require(_0x37a0('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4a35f2,_0x1678bc,_0x40cb09){return new BPromise(function(_0x2a5133,_0x19dced){return client[_0x37a0('0x8')](_0x4a35f2,_0x40cb09)[_0x37a0('0x9')](function(_0x1e8c00){logger[_0x37a0('0xa')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x1678bc,'request\x20sent');logger[_0x37a0('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x1678bc,'request\x20sent',JSON['stringify'](_0x1e8c00));if(_0x1e8c00['error']){if(_0x1e8c00[_0x37a0('0xc')][_0x37a0('0xd')]===0x1f4){logger[_0x37a0('0xc')](_0x37a0('0xe'),_0x1678bc,_0x1e8c00[_0x37a0('0xc')][_0x37a0('0xf')]);return _0x19dced(_0x1e8c00[_0x37a0('0xc')]['message']);}logger[_0x37a0('0xc')](_0x37a0('0xe'),_0x1678bc,_0x1e8c00[_0x37a0('0xc')][_0x37a0('0xf')]);return _0x2a5133(_0x1e8c00[_0x37a0('0xc')]['message']);}else{logger['info'](_0x37a0('0xe'),_0x1678bc,_0x37a0('0x10'));_0x2a5133(_0x1e8c00['result'][_0x37a0('0xf')]);}})[_0x37a0('0x11')](function(_0x18752f){logger['error'](_0x37a0('0xe'),_0x1678bc,_0x18752f);_0x19dced(_0x18752f);});});} \ No newline at end of file +var _0x3836=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','request','then','info','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s'];(function(_0x158f5a,_0xaacc25){var _0xb3722e=function(_0x1659bd){while(--_0x1659bd){_0x158f5a['push'](_0x158f5a['shift']());}};_0xb3722e(++_0xaacc25);}(_0x3836,0x9d));var _0x6383=function(_0xed1dcf,_0x306ec6){_0xed1dcf=_0xed1dcf-0x0;var _0x33d93b=_0x3836[_0xed1dcf];return _0x33d93b;};'use strict';var _=require(_0x6383('0x0'));var util=require(_0x6383('0x1'));var moment=require(_0x6383('0x2'));var BPromise=require(_0x6383('0x3'));var rs=require(_0x6383('0x4'));var fs=require('fs');var Redis=require(_0x6383('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6383('0x6'));var logger=require('../../config/logger')(_0x6383('0x7'));var config=require('../../config/environment');var jayson=require(_0x6383('0x8'));var client=jayson[_0x6383('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59d9af,_0x54630b,_0x1d21f1){return new BPromise(function(_0xdbca4f,_0x1858a7){return client[_0x6383('0xa')](_0x59d9af,_0x1d21f1)[_0x6383('0xb')](function(_0x2ba933){logger[_0x6383('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x54630b,_0x6383('0xd'));logger['debug'](_0x6383('0xe'),_0x54630b,_0x6383('0xd'),JSON[_0x6383('0xf')](_0x2ba933));if(_0x2ba933[_0x6383('0x10')]){if(_0x2ba933[_0x6383('0x10')][_0x6383('0x11')]===0x1f4){logger['error'](_0x6383('0x12'),_0x54630b,_0x2ba933[_0x6383('0x10')][_0x6383('0x13')]);return _0x1858a7(_0x2ba933['error'][_0x6383('0x13')]);}logger[_0x6383('0x10')](_0x6383('0x12'),_0x54630b,_0x2ba933[_0x6383('0x10')][_0x6383('0x13')]);return _0xdbca4f(_0x2ba933[_0x6383('0x10')][_0x6383('0x13')]);}else{logger[_0x6383('0xc')](_0x6383('0x12'),_0x54630b,_0x6383('0xd'));_0xdbca4f(_0x2ba933[_0x6383('0x14')]['message']);}})[_0x6383('0x15')](function(_0x34ffd9){logger[_0x6383('0x10')](_0x6383('0x12'),_0x54630b,_0x34ffd9);_0x1858a7(_0x34ffd9);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 65fc1ee..8fdc32c 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 _0x0ba3=['delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','/:id/preview','preview','/:id/run','isAuthenticated','/:id/query','query','post','put','update'];(function(_0x39986a,_0x5ee5fb){var _0x294a23=function(_0x99f982){while(--_0x99f982){_0x39986a['push'](_0x39986a['shift']());}};_0x294a23(++_0x5ee5fb);}(_0x0ba3,0x1d0));var _0x30ba=function(_0xffd8b0,_0x12c51f){_0xffd8b0=_0xffd8b0-0x0;var _0x301ba0=_0x0ba3[_0xffd8b0];return _0x301ba0;};'use strict';var multer=require(_0x30ba('0x0'));var util=require('util');var path=require(_0x30ba('0x1'));var timeout=require(_0x30ba('0x2'));var express=require(_0x30ba('0x3'));var router=express[_0x30ba('0x4')]();var fs_extra=require(_0x30ba('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x30ba('0x6'));var config=require(_0x30ba('0x7'));var controller=require(_0x30ba('0x8'));router[_0x30ba('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x30ba('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x30ba('0x9')](_0x30ba('0xa'),auth['isAuthenticated'](),controller[_0x30ba('0xb')]);router[_0x30ba('0x9')](_0x30ba('0xc'),auth[_0x30ba('0xd')](),controller['run']);router[_0x30ba('0x9')](_0x30ba('0xe'),auth['isAuthenticated'](),controller[_0x30ba('0xf')]);router[_0x30ba('0x10')]('/',auth[_0x30ba('0xd')](),controller['create']);router[_0x30ba('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x30ba('0x12')]);router[_0x30ba('0x13')](_0x30ba('0x14'),auth[_0x30ba('0xd')](),controller[_0x30ba('0x15')]);module[_0x30ba('0x16')]=router; \ No newline at end of file +var _0xa661=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','post','update','destroy','exports'];(function(_0x2179f1,_0x21c653){var _0x176ec9=function(_0x4c4a4c){while(--_0x4c4a4c){_0x2179f1['push'](_0x2179f1['shift']());}};_0x176ec9(++_0x21c653);}(_0xa661,0xf2));var _0x1a66=function(_0x3b3750,_0x28f3b8){_0x3b3750=_0x3b3750-0x0;var _0x1b9e8b=_0xa661[_0x3b3750];return _0x1b9e8b;};'use strict';var multer=require(_0x1a66('0x0'));var util=require(_0x1a66('0x1'));var path=require(_0x1a66('0x2'));var timeout=require(_0x1a66('0x3'));var express=require('express');var router=express[_0x1a66('0x4')]();var fs_extra=require(_0x1a66('0x5'));var auth=require(_0x1a66('0x6'));var interaction=require(_0x1a66('0x7'));var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router['get']('/',auth[_0x1a66('0x8')](),controller[_0x1a66('0x9')]);router[_0x1a66('0xa')](_0x1a66('0xb'),auth[_0x1a66('0x8')](),controller[_0x1a66('0xc')]);router['get'](_0x1a66('0xd'),auth[_0x1a66('0x8')](),controller[_0x1a66('0xe')]);router['get'](_0x1a66('0xf'),auth[_0x1a66('0x8')](),controller[_0x1a66('0x10')]);router[_0x1a66('0xa')](_0x1a66('0x11'),auth[_0x1a66('0x8')](),controller['query']);router[_0x1a66('0x12')]('/',auth[_0x1a66('0x8')](),controller['create']);router['put'](_0x1a66('0xb'),auth[_0x1a66('0x8')](),controller[_0x1a66('0x13')]);router['delete'](_0x1a66('0xb'),auth['isAuthenticated'](),controller[_0x1a66('0x14')]);module[_0x1a66('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 3c02464..e32ef25 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 _0xb807=['ENUM','csv','manual','scheduled','INTEGER','UNSIGNED','moment','exports','STRING'];(function(_0x397009,_0x49d1b9){var _0x22cc48=function(_0x5033da){while(--_0x5033da){_0x397009['push'](_0x397009['shift']());}};_0x22cc48(++_0x49d1b9);}(_0xb807,0x153));var _0x7b80=function(_0x386b69,_0x5d9360){_0x386b69=_0x386b69-0x0;var _0x476415=_0xb807[_0x386b69];return _0x476415;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x7b80('0x0'));module[_0x7b80('0x1')]={'name':{'type':Sequelize[_0x7b80('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x7b80('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x7b80('0x3')](_0x7b80('0x4'),'pdf','xlsx'),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x7b80('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x7b80('0x3')](_0x7b80('0x5'),_0x7b80('0x6')),'allowNull':![],'defaultValue':_0x7b80('0x5')},'reportId':{'type':Sequelize[_0x7b80('0x7')](0xb)[_0x7b80('0x8')]},'reportType':{'type':Sequelize[_0x7b80('0x2')]}}; \ No newline at end of file +var _0x0192=['csv','xlsx','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','moment','exports','STRING','ENUM'];(function(_0x5d5543,_0x5cfb1e){var _0x53352b=function(_0x5cdb1d){while(--_0x5cdb1d){_0x5d5543['push'](_0x5d5543['shift']());}};_0x53352b(++_0x5cfb1e);}(_0x0192,0x98));var _0x2019=function(_0xca521d,_0x32334a){_0xca521d=_0xca521d-0x0;var _0x53e4c8=_0x0192[_0xca521d];return _0x53e4c8;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2019('0x0'));module[_0x2019('0x1')]={'name':{'type':Sequelize[_0x2019('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x2019('0x3')](_0x2019('0x4'),'pdf',_0x2019('0x5')),'allowNull':![],'defaultValue':_0x2019('0x4')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x2019('0x6')]},'endDate':{'type':Sequelize[_0x2019('0x6')]},'status':{'type':Sequelize[_0x2019('0x2')],'defaultValue':_0x2019('0x7')},'type':{'type':Sequelize[_0x2019('0x3')](_0x2019('0x8'),_0x2019('0x9')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x2019('0xa')](0xb)[_0x2019('0xb')]},'reportType':{'type':Sequelize[_0x2019('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index adb5faa..3a16c07 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 _0xb5c4=['include','findAll','rows','catch','show','params','keys','rawAttributes','length','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','savename','join','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','server/files/reports','%s.%s','basename','output','toLowerCase','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','update','then','get','ExtractedReports','UserProfileResource','destroy','error','name','send','index','map','AnalyticExtractedReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll'];(function(_0x58675f,_0x390355){var _0x1cc7f0=function(_0x31d6d6){while(--_0x31d6d6){_0x58675f['push'](_0x58675f['shift']());}};_0x1cc7f0(++_0x390355);}(_0xb5c4,0xd4));var _0x4b5c=function(_0x277c19,_0x22f714){_0x277c19=_0x277c19-0x0;var _0x3281e5=_0xb5c4[_0x277c19];return _0x3281e5;};'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(_0x4b5c('0x0'));var moment=require(_0x4b5c('0x1'));var BPromise=require(_0x4b5c('0x2'));var Mustache=require('mustache');var util=require(_0x4b5c('0x3'));var path=require(_0x4b5c('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4b5c('0x5'));var fs=require('fs');var fs_extra=require(_0x4b5c('0x6'));var _=require(_0x4b5c('0x7'));var squel=require(_0x4b5c('0x8'));var crypto=require('crypto');var jsforce=require(_0x4b5c('0x9'));var deskjs=require(_0x4b5c('0xa'));var toCsv=require('to-csv');var querystring=require(_0x4b5c('0xb'));var Papa=require(_0x4b5c('0xc'));var Redis=require('ioredis');var authService=require(_0x4b5c('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4b5c('0xe'));var logger=require(_0x4b5c('0xf'))(_0x4b5c('0x10'));var utils=require(_0x4b5c('0x11'));var config=require(_0x4b5c('0x12'));var licenseUtil=require(_0x4b5c('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13c0f3,_0x54bd6c){_0x54bd6c=_0x54bd6c||0xcc;return function(_0x5e6ca7){if(_0x5e6ca7){return _0x13c0f3[_0x4b5c('0x14')](_0x54bd6c);}return _0x13c0f3['status'](_0x54bd6c)[_0x4b5c('0x15')]();};}function respondWithResult(_0x3ce8a2,_0x3311be){_0x3311be=_0x3311be||0xc8;return function(_0x4c460d){if(_0x4c460d){return _0x3ce8a2[_0x4b5c('0x16')](_0x3311be)[_0x4b5c('0x17')](_0x4c460d);}};}function respondWithFilteredResult(_0xa602a6,_0x2e93e3){return function(_0x521f8c){if(_0x521f8c){var _0x5f58e9=typeof _0x2e93e3[_0x4b5c('0x18')]===_0x4b5c('0x19')&&typeof _0x2e93e3[_0x4b5c('0x1a')]===_0x4b5c('0x19');var _0x4fe9d2=_0x521f8c[_0x4b5c('0x1b')];var _0x573003=_0x5f58e9?0x0:_0x2e93e3[_0x4b5c('0x18')];var _0x38fdfa=_0x5f58e9?_0x521f8c[_0x4b5c('0x1b')]:_0x2e93e3[_0x4b5c('0x18')]+_0x2e93e3[_0x4b5c('0x1a')];var _0x1b476f;if(_0x38fdfa>=_0x4fe9d2){_0x38fdfa=_0x4fe9d2;_0x1b476f=0xc8;}else{_0x1b476f=0xce;}_0xa602a6[_0x4b5c('0x16')](_0x1b476f);return _0xa602a6[_0x4b5c('0x1c')]('Content-Range',_0x573003+'-'+_0x38fdfa+'/'+_0x4fe9d2)[_0x4b5c('0x17')](_0x521f8c);}return null;};}function patchUpdates(_0x4f18c4){return function(_0x1d02a8){try{jsonpatch['apply'](_0x1d02a8,_0x4f18c4,!![]);}catch(_0x2835a0){return BPromise[_0x4b5c('0x1d')](_0x2835a0);}return _0x1d02a8['save']();};}function saveUpdates(_0x123e34,_0x2b70fb){return function(_0x2171b2){if(_0x2171b2){return _0x2171b2[_0x4b5c('0x1e')](_0x123e34)[_0x4b5c('0x1f')](function(_0x2b5eb9){return _0x2b5eb9;});}return null;};}function removeEntity(_0x1c2856,_0x1aca27){return function(_0x2afe09){if(_0x2afe09){return _0x2afe09['destroy']()['then'](function(){var _0x2b974b=_0x2afe09[_0x4b5c('0x20')]({'plain':!![]});var _0x513f4c=_0x4b5c('0x21');return db[_0x4b5c('0x22')][_0x4b5c('0x23')]({'where':{'type':_0x513f4c,'resourceId':_0x2b974b['id']}})[_0x4b5c('0x1f')](function(){return _0x2afe09;});})[_0x4b5c('0x1f')](function(){_0x1c2856[_0x4b5c('0x16')](0xcc)[_0x4b5c('0x15')]();});}};}function handleEntityNotFound(_0x2a4a8d,_0x56065f){return function(_0x59b24f){if(!_0x59b24f){_0x2a4a8d['sendStatus'](0x194);}return _0x59b24f;};}function handleError(_0x7fe6ac,_0x24970e){_0x24970e=_0x24970e||0x1f4;return function(_0x53cab5){logger[_0x4b5c('0x24')](_0x53cab5['stack']);if(_0x53cab5[_0x4b5c('0x25')]){delete _0x53cab5[_0x4b5c('0x25')];}_0x7fe6ac[_0x4b5c('0x16')](_0x24970e)[_0x4b5c('0x26')](_0x53cab5);};}exports[_0x4b5c('0x27')]=function(_0x87ddb5,_0x3eea3b){var _0x54d221={},_0x3fb861={},_0x460912={'count':0x0,'rows':[]};var _0x65fd53=_[_0x4b5c('0x28')](db[_0x4b5c('0x29')]['rawAttributes'],function(_0x3a7abb){return{'name':_0x3a7abb[_0x4b5c('0x2a')],'type':_0x3a7abb[_0x4b5c('0x2b')][_0x4b5c('0x2c')]};});_0x3fb861[_0x4b5c('0x2d')]=_[_0x4b5c('0x28')](_0x65fd53,_0x4b5c('0x25'));_0x3fb861[_0x4b5c('0x2e')]=_['keys'](_0x87ddb5['query']);_0x3fb861[_0x4b5c('0x2f')]=_[_0x4b5c('0x30')](_0x3fb861['model'],_0x3fb861[_0x4b5c('0x2e')]);_0x54d221[_0x4b5c('0x31')]=_[_0x4b5c('0x30')](_0x3fb861[_0x4b5c('0x2d')],qs['fields'](_0x87ddb5[_0x4b5c('0x2e')][_0x4b5c('0x32')]));_0x54d221[_0x4b5c('0x31')]=_0x54d221[_0x4b5c('0x31')]['length']?_0x54d221['attributes']:_0x3fb861[_0x4b5c('0x2d')];if(!_0x87ddb5[_0x4b5c('0x2e')][_0x4b5c('0x33')](_0x4b5c('0x34'))){_0x54d221['limit']=qs[_0x4b5c('0x1a')](_0x87ddb5[_0x4b5c('0x2e')][_0x4b5c('0x1a')]);_0x54d221[_0x4b5c('0x18')]=qs['offset'](_0x87ddb5[_0x4b5c('0x2e')][_0x4b5c('0x18')]);}_0x54d221[_0x4b5c('0x35')]=qs[_0x4b5c('0x36')](_0x87ddb5[_0x4b5c('0x2e')]['sort']);_0x54d221['where']=qs['filters'](_['pick'](_0x87ddb5[_0x4b5c('0x2e')],_0x3fb861[_0x4b5c('0x2f')]),_0x65fd53);if(_0x87ddb5[_0x4b5c('0x2e')][_0x4b5c('0x37')]){_0x54d221['where']=_[_0x4b5c('0x38')](_0x54d221[_0x4b5c('0x39')],{'$or':_['map'](_0x65fd53,function(_0x1b494b){if(_0x1b494b['type']!==_0x4b5c('0x3a')){var _0x5dd9a6={};_0x5dd9a6[_0x1b494b['name']]={'$like':'%'+_0x87ddb5['query'][_0x4b5c('0x37')]+'%'};return _0x5dd9a6;}})});}_0x54d221=_[_0x4b5c('0x38')]({},_0x54d221,_0x87ddb5[_0x4b5c('0x3b')]);var _0x30fc4a={'where':_0x54d221[_0x4b5c('0x39')]};return db['AnalyticExtractedReport'][_0x4b5c('0x1b')](_0x30fc4a)[_0x4b5c('0x1f')](function(_0x370e9f){_0x460912[_0x4b5c('0x1b')]=_0x370e9f;if(_0x87ddb5[_0x4b5c('0x2e')][_0x4b5c('0x3c')]){_0x54d221[_0x4b5c('0x3d')]=[{'all':!![]}];}return db[_0x4b5c('0x29')][_0x4b5c('0x3e')](_0x54d221);})[_0x4b5c('0x1f')](function(_0x38f74e){_0x460912[_0x4b5c('0x3f')]=_0x38f74e;return _0x460912;})[_0x4b5c('0x1f')](respondWithFilteredResult(_0x3eea3b,_0x54d221))[_0x4b5c('0x40')](handleError(_0x3eea3b,null));};exports[_0x4b5c('0x41')]=function(_0x21b0de,_0xec934d){var _0x59619f={'raw':!![],'where':{'id':_0x21b0de[_0x4b5c('0x42')]['id']}},_0x267d91={};_0x267d91[_0x4b5c('0x2d')]=_[_0x4b5c('0x43')](db[_0x4b5c('0x29')][_0x4b5c('0x44')]);_0x267d91[_0x4b5c('0x2e')]=_['keys'](_0x21b0de[_0x4b5c('0x2e')]);_0x267d91['filters']=_[_0x4b5c('0x30')](_0x267d91[_0x4b5c('0x2d')],_0x267d91[_0x4b5c('0x2e')]);_0x59619f[_0x4b5c('0x31')]=_[_0x4b5c('0x30')](_0x267d91[_0x4b5c('0x2d')],qs['fields'](_0x21b0de['query']['fields']));_0x59619f['attributes']=_0x59619f['attributes'][_0x4b5c('0x45')]?_0x59619f[_0x4b5c('0x31')]:_0x267d91['model'];if(_0x21b0de[_0x4b5c('0x2e')][_0x4b5c('0x3c')]){_0x59619f[_0x4b5c('0x3d')]=[{'all':!![]}];}_0x59619f=_['merge']({},_0x59619f,_0x21b0de['options']);return db[_0x4b5c('0x29')][_0x4b5c('0x46')](_0x59619f)[_0x4b5c('0x1f')](handleEntityNotFound(_0xec934d,null))['then'](respondWithResult(_0xec934d,null))['catch'](handleError(_0xec934d,null));};exports[_0x4b5c('0x47')]=function(_0x385bdd,_0x5eba6f){return db[_0x4b5c('0x29')][_0x4b5c('0x47')](_0x385bdd[_0x4b5c('0x48')],{})[_0x4b5c('0x1f')](function(_0x479e8e){var _0x302d3c=_0x385bdd['user']['get']({'plain':!![]});if(!_0x302d3c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x302d3c['role']===_0x4b5c('0x49')){var _0x894822=_0x479e8e['get']({'plain':!![]});var _0x190160='ExtractedReports';return db[_0x4b5c('0x4a')][_0x4b5c('0x46')]({'where':{'name':_0x190160,'userProfileId':_0x302d3c[_0x4b5c('0x4b')]},'raw':!![]})[_0x4b5c('0x1f')](function(_0x12c672){if(_0x12c672&&_0x12c672[_0x4b5c('0x4c')]===0x0){return db[_0x4b5c('0x22')][_0x4b5c('0x47')]({'name':_0x894822[_0x4b5c('0x25')],'resourceId':_0x894822['id'],'type':_0x12c672[_0x4b5c('0x25')],'sectionId':_0x12c672['id']},{})[_0x4b5c('0x1f')](function(){return _0x479e8e;});}else{return _0x479e8e;}})['catch'](function(_0xde84d1){logger[_0x4b5c('0x24')](_0x4b5c('0x4d'),_0xde84d1);throw _0xde84d1;});}return _0x479e8e;})[_0x4b5c('0x1f')](respondWithResult(_0x5eba6f,0xc9))[_0x4b5c('0x40')](handleError(_0x5eba6f,null));};exports['update']=function(_0x447118,_0x19ae9b){if(_0x447118[_0x4b5c('0x48')]['id']){delete _0x447118[_0x4b5c('0x48')]['id'];}return db['AnalyticExtractedReport'][_0x4b5c('0x46')]({'where':{'id':_0x447118['params']['id']}})[_0x4b5c('0x1f')](handleEntityNotFound(_0x19ae9b,null))[_0x4b5c('0x1f')](saveUpdates(_0x447118[_0x4b5c('0x48')],null))[_0x4b5c('0x1f')](respondWithResult(_0x19ae9b,null))[_0x4b5c('0x40')](handleError(_0x19ae9b,null));};exports[_0x4b5c('0x23')]=function(_0x788474,_0x561275){return db['AnalyticExtractedReport'][_0x4b5c('0x46')]({'where':{'id':_0x788474[_0x4b5c('0x42')]['id']}})[_0x4b5c('0x1f')](handleEntityNotFound(_0x561275,null))[_0x4b5c('0x1f')](removeEntity(_0x561275,null))['catch'](handleError(_0x561275,null));};exports[_0x4b5c('0x4e')]=function(_0x3329b5,_0x479bb0,_0x34701b){return db[_0x4b5c('0x29')][_0x4b5c('0x46')]({'where':{'id':_0x3329b5[_0x4b5c('0x42')]['id']},'attributes':[_0x4b5c('0x25'),'basename',_0x4b5c('0x4f'),'output'],'raw':!![]})['then'](handleEntityNotFound(_0x479bb0,null))['then'](function(_0x2999ca){if(_0x2999ca){if(!fs['existsSync'](path[_0x4b5c('0x50')](config[_0x4b5c('0x51')],'server/files/reports',_0x2999ca[_0x4b5c('0x4f')]))){throw new db[(_0x4b5c('0x52'))][(_0x4b5c('0x53'))](_0x4b5c('0x54'));}if(_0x3329b5[_0x4b5c('0x2e')][_0x4b5c('0x55')]){return _0x479bb0[_0x4b5c('0x14')](0xc8);}return _0x479bb0['download'](path[_0x4b5c('0x50')](config[_0x4b5c('0x51')],_0x4b5c('0x56'),_0x2999ca[_0x4b5c('0x4f')]),util['format'](_0x4b5c('0x57'),_0x2999ca[_0x4b5c('0x58')]||_0x2999ca[_0x4b5c('0x25')],_0x2999ca[_0x4b5c('0x59')][_0x4b5c('0x5a')]()));}})[_0x4b5c('0x40')](handleError(_0x479bb0,null));}; \ No newline at end of file +var _0xc17d=['order','sort','where','pick','filter','map','VIRTUAL','merge','AnalyticExtractedReport','include','findAll','rows','catch','show','params','intersection','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','body','destroy','download','basename','savename','output','existsSync','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','join','format','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','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','limit','count','apply','reject','update','then','get','ExtractedReports','UserProfileResource','error','stack','send','index','rawAttributes','type','model','name','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x285824,_0x3da647){var _0x311d7e=function(_0x2f3de0){while(--_0x2f3de0){_0x285824['push'](_0x285824['shift']());}};_0x311d7e(++_0x3da647);}(_0xc17d,0xed));var _0xdc17=function(_0x387ee7,_0x4dc368){_0x387ee7=_0x387ee7-0x0;var _0x3dda3f=_0xc17d[_0x387ee7];return _0x3dda3f;};'use strict';var emlformat=require(_0xdc17('0x0'));var rimraf=require(_0xdc17('0x1'));var zipdir=require(_0xdc17('0x2'));var jsonpatch=require(_0xdc17('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdc17('0x4'));var Mustache=require(_0xdc17('0x5'));var util=require(_0xdc17('0x6'));var path=require(_0xdc17('0x7'));var sox=require('sox');var csv=require(_0xdc17('0x8'));var ejs=require(_0xdc17('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdc17('0xa'));var squel=require(_0xdc17('0xb'));var crypto=require(_0xdc17('0xc'));var jsforce=require(_0xdc17('0xd'));var deskjs=require(_0xdc17('0xe'));var toCsv=require(_0xdc17('0x8'));var querystring=require(_0xdc17('0xf'));var Papa=require(_0xdc17('0x10'));var Redis=require(_0xdc17('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdc17('0x12'));var as=require(_0xdc17('0x13'));var hardwareService=require(_0xdc17('0x14'));var logger=require('../../config/logger')(_0xdc17('0x15'));var utils=require(_0xdc17('0x16'));var config=require(_0xdc17('0x17'));var licenseUtil=require(_0xdc17('0x18'));var db=require(_0xdc17('0x19'))['db'];function respondWithStatusCode(_0x294b96,_0x50bbef){_0x50bbef=_0x50bbef||0xcc;return function(_0x1c83ce){if(_0x1c83ce){return _0x294b96[_0xdc17('0x1a')](_0x50bbef);}return _0x294b96[_0xdc17('0x1b')](_0x50bbef)[_0xdc17('0x1c')]();};}function respondWithResult(_0xf94f1d,_0x3f7196){_0x3f7196=_0x3f7196||0xc8;return function(_0x189c3f){if(_0x189c3f){return _0xf94f1d[_0xdc17('0x1b')](_0x3f7196)[_0xdc17('0x1d')](_0x189c3f);}};}function respondWithFilteredResult(_0x4df6c6,_0x2ea164){return function(_0x5f2b31){if(_0x5f2b31){var _0x51a039=typeof _0x2ea164[_0xdc17('0x1e')]===_0xdc17('0x1f')&&typeof _0x2ea164[_0xdc17('0x20')]===_0xdc17('0x1f');var _0x13554d=_0x5f2b31[_0xdc17('0x21')];var _0x5f280a=_0x51a039?0x0:_0x2ea164[_0xdc17('0x1e')];var _0x3be905=_0x51a039?_0x5f2b31['count']:_0x2ea164['offset']+_0x2ea164['limit'];var _0x59ca4d;if(_0x3be905>=_0x13554d){_0x3be905=_0x13554d;_0x59ca4d=0xc8;}else{_0x59ca4d=0xce;}_0x4df6c6[_0xdc17('0x1b')](_0x59ca4d);return _0x4df6c6['set']('Content-Range',_0x5f280a+'-'+_0x3be905+'/'+_0x13554d)[_0xdc17('0x1d')](_0x5f2b31);}return null;};}function patchUpdates(_0x131bd5){return function(_0x588da0){try{jsonpatch[_0xdc17('0x22')](_0x588da0,_0x131bd5,!![]);}catch(_0x26665e){return BPromise[_0xdc17('0x23')](_0x26665e);}return _0x588da0['save']();};}function saveUpdates(_0xd133ab,_0x1a9efb){return function(_0x5073ed){if(_0x5073ed){return _0x5073ed[_0xdc17('0x24')](_0xd133ab)[_0xdc17('0x25')](function(_0xaf7f60){return _0xaf7f60;});}return null;};}function removeEntity(_0x245a59,_0x2d5605){return function(_0x4aa4f0){if(_0x4aa4f0){return _0x4aa4f0['destroy']()[_0xdc17('0x25')](function(){var _0x5d6c9b=_0x4aa4f0[_0xdc17('0x26')]({'plain':!![]});var _0x14c422=_0xdc17('0x27');return db[_0xdc17('0x28')]['destroy']({'where':{'type':_0x14c422,'resourceId':_0x5d6c9b['id']}})['then'](function(){return _0x4aa4f0;});})[_0xdc17('0x25')](function(){_0x245a59[_0xdc17('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x471158,_0x3b73f3){return function(_0x4063e9){if(!_0x4063e9){_0x471158['sendStatus'](0x194);}return _0x4063e9;};}function handleError(_0x2d54b8,_0x592dca){_0x592dca=_0x592dca||0x1f4;return function(_0x25ce18){logger[_0xdc17('0x29')](_0x25ce18[_0xdc17('0x2a')]);if(_0x25ce18['name']){delete _0x25ce18['name'];}_0x2d54b8['status'](_0x592dca)[_0xdc17('0x2b')](_0x25ce18);};}exports[_0xdc17('0x2c')]=function(_0x2bf549,_0x21f5ca){var _0x42c32a={},_0x5edf06={},_0x1c0f76={'count':0x0,'rows':[]};var _0x4e163e=_['map'](db['AnalyticExtractedReport'][_0xdc17('0x2d')],function(_0x35d1e5){return{'name':_0x35d1e5['fieldName'],'type':_0x35d1e5[_0xdc17('0x2e')]['key']};});_0x5edf06[_0xdc17('0x2f')]=_['map'](_0x4e163e,_0xdc17('0x30'));_0x5edf06[_0xdc17('0x31')]=_[_0xdc17('0x32')](_0x2bf549[_0xdc17('0x31')]);_0x5edf06[_0xdc17('0x33')]=_['intersection'](_0x5edf06[_0xdc17('0x2f')],_0x5edf06[_0xdc17('0x31')]);_0x42c32a[_0xdc17('0x34')]=_['intersection'](_0x5edf06[_0xdc17('0x2f')],qs[_0xdc17('0x35')](_0x2bf549[_0xdc17('0x31')][_0xdc17('0x35')]));_0x42c32a['attributes']=_0x42c32a[_0xdc17('0x34')][_0xdc17('0x36')]?_0x42c32a[_0xdc17('0x34')]:_0x5edf06[_0xdc17('0x2f')];if(!_0x2bf549[_0xdc17('0x31')][_0xdc17('0x37')](_0xdc17('0x38'))){_0x42c32a['limit']=qs['limit'](_0x2bf549[_0xdc17('0x31')][_0xdc17('0x20')]);_0x42c32a[_0xdc17('0x1e')]=qs[_0xdc17('0x1e')](_0x2bf549[_0xdc17('0x31')][_0xdc17('0x1e')]);}_0x42c32a[_0xdc17('0x39')]=qs[_0xdc17('0x3a')](_0x2bf549[_0xdc17('0x31')][_0xdc17('0x3a')]);_0x42c32a[_0xdc17('0x3b')]=qs[_0xdc17('0x33')](_[_0xdc17('0x3c')](_0x2bf549[_0xdc17('0x31')],_0x5edf06[_0xdc17('0x33')]),_0x4e163e);if(_0x2bf549[_0xdc17('0x31')][_0xdc17('0x3d')]){_0x42c32a[_0xdc17('0x3b')]=_['merge'](_0x42c32a['where'],{'$or':_[_0xdc17('0x3e')](_0x4e163e,function(_0x50376f){if(_0x50376f[_0xdc17('0x2e')]!==_0xdc17('0x3f')){var _0x4002da={};_0x4002da[_0x50376f[_0xdc17('0x30')]]={'$like':'%'+_0x2bf549['query'][_0xdc17('0x3d')]+'%'};return _0x4002da;}})});}_0x42c32a=_[_0xdc17('0x40')]({},_0x42c32a,_0x2bf549['options']);var _0x856930={'where':_0x42c32a[_0xdc17('0x3b')]};return db[_0xdc17('0x41')]['count'](_0x856930)[_0xdc17('0x25')](function(_0x813121){_0x1c0f76[_0xdc17('0x21')]=_0x813121;if(_0x2bf549['query']['includeAll']){_0x42c32a[_0xdc17('0x42')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xdc17('0x43')](_0x42c32a);})['then'](function(_0x2d0ee5){_0x1c0f76[_0xdc17('0x44')]=_0x2d0ee5;return _0x1c0f76;})[_0xdc17('0x25')](respondWithFilteredResult(_0x21f5ca,_0x42c32a))[_0xdc17('0x45')](handleError(_0x21f5ca,null));};exports[_0xdc17('0x46')]=function(_0x1a4013,_0xfdb923){var _0x42847c={'raw':!![],'where':{'id':_0x1a4013[_0xdc17('0x47')]['id']}},_0x202ec2={};_0x202ec2[_0xdc17('0x2f')]=_['keys'](db[_0xdc17('0x41')][_0xdc17('0x2d')]);_0x202ec2['query']=_['keys'](_0x1a4013['query']);_0x202ec2['filters']=_[_0xdc17('0x48')](_0x202ec2[_0xdc17('0x2f')],_0x202ec2['query']);_0x42847c[_0xdc17('0x34')]=_[_0xdc17('0x48')](_0x202ec2['model'],qs[_0xdc17('0x35')](_0x1a4013[_0xdc17('0x31')]['fields']));_0x42847c[_0xdc17('0x34')]=_0x42847c[_0xdc17('0x34')][_0xdc17('0x36')]?_0x42847c[_0xdc17('0x34')]:_0x202ec2[_0xdc17('0x2f')];if(_0x1a4013['query'][_0xdc17('0x49')]){_0x42847c[_0xdc17('0x42')]=[{'all':!![]}];}_0x42847c=_[_0xdc17('0x40')]({},_0x42847c,_0x1a4013[_0xdc17('0x4a')]);return db[_0xdc17('0x41')][_0xdc17('0x4b')](_0x42847c)['then'](handleEntityNotFound(_0xfdb923,null))[_0xdc17('0x25')](respondWithResult(_0xfdb923,null))[_0xdc17('0x45')](handleError(_0xfdb923,null));};exports[_0xdc17('0x4c')]=function(_0x11dce1,_0x391110){return db[_0xdc17('0x41')][_0xdc17('0x4c')](_0x11dce1['body'],{})[_0xdc17('0x25')](function(_0x37ff29){var _0x38950c=_0x11dce1[_0xdc17('0x4d')][_0xdc17('0x26')]({'plain':!![]});if(!_0x38950c)throw new Error(_0xdc17('0x4e'));if(_0x38950c['role']===_0xdc17('0x4d')){var _0x30a4ce=_0x37ff29[_0xdc17('0x26')]({'plain':!![]});var _0x6d0f6=_0xdc17('0x27');return db[_0xdc17('0x4f')]['find']({'where':{'name':_0x6d0f6,'userProfileId':_0x38950c[_0xdc17('0x50')]},'raw':!![]})[_0xdc17('0x25')](function(_0x587c19){if(_0x587c19&&_0x587c19[_0xdc17('0x51')]===0x0){return db[_0xdc17('0x28')][_0xdc17('0x4c')]({'name':_0x30a4ce[_0xdc17('0x30')],'resourceId':_0x30a4ce['id'],'type':_0x587c19['name'],'sectionId':_0x587c19['id']},{})[_0xdc17('0x25')](function(){return _0x37ff29;});}else{return _0x37ff29;}})[_0xdc17('0x45')](function(_0x3152e2){logger[_0xdc17('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3152e2);throw _0x3152e2;});}return _0x37ff29;})[_0xdc17('0x25')](respondWithResult(_0x391110,0xc9))[_0xdc17('0x45')](handleError(_0x391110,null));};exports[_0xdc17('0x24')]=function(_0x3f9d70,_0x5064e7){if(_0x3f9d70[_0xdc17('0x52')]['id']){delete _0x3f9d70[_0xdc17('0x52')]['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x3f9d70[_0xdc17('0x47')]['id']}})[_0xdc17('0x25')](handleEntityNotFound(_0x5064e7,null))[_0xdc17('0x25')](saveUpdates(_0x3f9d70[_0xdc17('0x52')],null))[_0xdc17('0x25')](respondWithResult(_0x5064e7,null))[_0xdc17('0x45')](handleError(_0x5064e7,null));};exports[_0xdc17('0x53')]=function(_0x56a942,_0x324c22){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x56a942['params']['id']}})[_0xdc17('0x25')](handleEntityNotFound(_0x324c22,null))['then'](removeEntity(_0x324c22,null))[_0xdc17('0x45')](handleError(_0x324c22,null));};exports[_0xdc17('0x54')]=function(_0x19cac7,_0x60a1ba,_0x23a9d2){return db['AnalyticExtractedReport'][_0xdc17('0x4b')]({'where':{'id':_0x19cac7[_0xdc17('0x47')]['id']},'attributes':[_0xdc17('0x30'),_0xdc17('0x55'),_0xdc17('0x56'),_0xdc17('0x57')],'raw':!![]})[_0xdc17('0x25')](handleEntityNotFound(_0x60a1ba,null))[_0xdc17('0x25')](function(_0x23cf9c){if(_0x23cf9c){if(!fs[_0xdc17('0x58')](path['join'](config[_0xdc17('0x59')],_0xdc17('0x5a'),_0x23cf9c[_0xdc17('0x56')]))){throw new db[(_0xdc17('0x5b'))][(_0xdc17('0x5c'))](_0xdc17('0x5d'));}if(_0x19cac7[_0xdc17('0x31')][_0xdc17('0x5e')]){return _0x60a1ba[_0xdc17('0x1a')](0xc8);}return _0x60a1ba[_0xdc17('0x54')](path[_0xdc17('0x5f')](config['root'],_0xdc17('0x5a'),_0x23cf9c[_0xdc17('0x56')]),util[_0xdc17('0x60')]('%s.%s',_0x23cf9c[_0xdc17('0x55')]||_0x23cf9c[_0xdc17('0x30')],_0x23cf9c['output'][_0xdc17('0x61')]()));}})['catch'](handleError(_0x60a1ba,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index c4a2a17..87523da 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 _0x2f01=['analytics_extracted_reports','util','api','bluebird','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define'];(function(_0x437310,_0x20de0b){var _0xb43119=function(_0x36a866){while(--_0x36a866){_0x437310['push'](_0x437310['shift']());}};_0xb43119(++_0x20de0b);}(_0x2f01,0x14b));var _0x12f0=function(_0x49c5c0,_0xcc13f2){_0x49c5c0=_0x49c5c0-0x0;var _0x2b353a=_0x2f01[_0x49c5c0];return _0x2b353a;};'use strict';var _=require('lodash');var util=require(_0x12f0('0x0'));var logger=require('../../config/logger')(_0x12f0('0x1'));var moment=require('moment');var BPromise=require(_0x12f0('0x2'));var rp=require(_0x12f0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x12f0('0x4'));var config=require(_0x12f0('0x5'));var attributes=require(_0x12f0('0x6'));module[_0x12f0('0x7')]=function(_0x4eeb05,_0x332c15){return _0x4eeb05[_0x12f0('0x8')]('AnalyticExtractedReport',attributes,{'tableName':_0x12f0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d7c=['lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports'];(function(_0x2ca777,_0x57a6a6){var _0x43b4b7=function(_0x156d80){while(--_0x156d80){_0x2ca777['push'](_0x2ca777['shift']());}};_0x43b4b7(++_0x57a6a6);}(_0x6d7c,0x8f));var _0xc6d7=function(_0x8d4bff,_0x46fb43){_0x8d4bff=_0x8d4bff-0x0;var _0x550b57=_0x6d7c[_0x8d4bff];return _0x550b57;};'use strict';var _=require(_0xc6d7('0x0'));var util=require(_0xc6d7('0x1'));var logger=require(_0xc6d7('0x2'))(_0xc6d7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc6d7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc6d7('0x5'));var config=require(_0xc6d7('0x6'));var attributes=require(_0xc6d7('0x7'));module[_0xc6d7('0x8')]=function(_0x2c61cd,_0x3f945b){return _0x2c61cd[_0xc6d7('0x9')]('AnalyticExtractedReport',attributes,{'tableName':_0xc6d7('0xa'),'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 4d8e9cd..225c1b6 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 _0xeae7=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird'];(function(_0x559130,_0x56900b){var _0x23b94c=function(_0x581f4e){while(--_0x581f4e){_0x559130['push'](_0x559130['shift']());}};_0x23b94c(++_0x56900b);}(_0xeae7,0x1a1));var _0x7eae=function(_0x6173fc,_0x32aadf){_0x6173fc=_0x6173fc-0x0;var _0x965fbe=_0xeae7[_0x6173fc];return _0x965fbe;};'use strict';var _=require('lodash');var util=require(_0x7eae('0x0'));var moment=require(_0x7eae('0x1'));var BPromise=require(_0x7eae('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7eae('0x3'));var db=require(_0x7eae('0x4'))['db'];var utils=require(_0x7eae('0x5'));var logger=require(_0x7eae('0x6'))(_0x7eae('0x7'));var config=require(_0x7eae('0x8'));var jayson=require(_0x7eae('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xd01591,_0xfcbb05,_0x4acf71){return new BPromise(function(_0x3141b7,_0x50a3d9){return client[_0x7eae('0xa')](_0xd01591,_0x4acf71)[_0x7eae('0xb')](function(_0x1b6f32){logger[_0x7eae('0xc')](_0x7eae('0xd'),_0xfcbb05,_0x7eae('0xe'));logger[_0x7eae('0xf')](_0x7eae('0x10'),_0xfcbb05,_0x7eae('0xe'),JSON[_0x7eae('0x11')](_0x1b6f32));if(_0x1b6f32[_0x7eae('0x12')]){if(_0x1b6f32[_0x7eae('0x12')][_0x7eae('0x13')]===0x1f4){logger['error'](_0x7eae('0xd'),_0xfcbb05,_0x1b6f32[_0x7eae('0x12')][_0x7eae('0x14')]);return _0x50a3d9(_0x1b6f32[_0x7eae('0x12')][_0x7eae('0x14')]);}logger[_0x7eae('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xfcbb05,_0x1b6f32[_0x7eae('0x12')][_0x7eae('0x14')]);return _0x3141b7(_0x1b6f32[_0x7eae('0x12')]['message']);}else{logger['info'](_0x7eae('0xd'),_0xfcbb05,_0x7eae('0xe'));_0x3141b7(_0x1b6f32['result'][_0x7eae('0x14')]);}})['catch'](function(_0x477a8f){logger[_0x7eae('0x12')](_0x7eae('0xd'),_0xfcbb05,_0x477a8f);_0x50a3d9(_0x477a8f);});});} \ No newline at end of file +var _0x038f=['request','then','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x1be157,_0x97edbe){var _0x42e690=function(_0xf4971a){while(--_0xf4971a){_0x1be157['push'](_0x1be157['shift']());}};_0x42e690(++_0x97edbe);}(_0x038f,0x106));var _0xf038=function(_0x55c00d,_0x520cb6){_0x55c00d=_0x55c00d-0x0;var _0x254a8f=_0x038f[_0x55c00d];return _0x254a8f;};'use strict';var _=require(_0xf038('0x0'));var util=require(_0xf038('0x1'));var moment=require(_0xf038('0x2'));var BPromise=require('bluebird');var rs=require(_0xf038('0x3'));var fs=require('fs');var Redis=require(_0xf038('0x4'));var db=require(_0xf038('0x5'))['db'];var utils=require(_0xf038('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xf038('0x7'));var jayson=require(_0xf038('0x8'));var client=jayson[_0xf038('0x9')][_0xf038('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x139ac5,_0x5a4b23,_0x1b4f6c){return new BPromise(function(_0x3c58d0,_0x5deb8e){return client[_0xf038('0xb')](_0x139ac5,_0x1b4f6c)[_0xf038('0xc')](function(_0x4d52b5){logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x5a4b23,_0xf038('0xd'));logger[_0xf038('0xe')](_0xf038('0xf'),_0x5a4b23,_0xf038('0xd'),JSON[_0xf038('0x10')](_0x4d52b5));if(_0x4d52b5[_0xf038('0x11')]){if(_0x4d52b5[_0xf038('0x11')][_0xf038('0x12')]===0x1f4){logger['error'](_0xf038('0x13'),_0x5a4b23,_0x4d52b5[_0xf038('0x11')][_0xf038('0x14')]);return _0x5deb8e(_0x4d52b5[_0xf038('0x11')][_0xf038('0x14')]);}logger[_0xf038('0x11')](_0xf038('0x13'),_0x5a4b23,_0x4d52b5[_0xf038('0x11')]['message']);return _0x3c58d0(_0x4d52b5['error'][_0xf038('0x14')]);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x5a4b23,'request\x20sent');_0x3c58d0(_0x4d52b5['result'][_0xf038('0x14')]);}})['catch'](function(_0x37cf65){logger[_0xf038('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5a4b23,_0x37cf65);_0x5deb8e(_0x37cf65);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 3defe4d..d666c9e 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 _0xcc10=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','get','index','/:id','download','post','isAuthenticated','create','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x8ef553,_0x444b81){var _0x5e9bd2=function(_0xa12543){while(--_0xa12543){_0x8ef553['push'](_0x8ef553['shift']());}};_0x5e9bd2(++_0x444b81);}(_0xcc10,0x8f));var _0x0cc1=function(_0x3f701b,_0x12dbf9){_0x3f701b=_0x3f701b-0x0;var _0x484fed=_0xcc10[_0x3f701b];return _0x484fed;};'use strict';var multer=require(_0x0cc1('0x0'));var util=require(_0x0cc1('0x1'));var path=require(_0x0cc1('0x2'));var timeout=require(_0x0cc1('0x3'));var express=require(_0x0cc1('0x4'));var router=express[_0x0cc1('0x5')]();var fs_extra=require(_0x0cc1('0x6'));var auth=require(_0x0cc1('0x7'));var interaction=require(_0x0cc1('0x8'));var config=require('../../config/environment');var controller=require(_0x0cc1('0x9'));router[_0x0cc1('0xa')]('/',auth['isAuthenticated'](),controller[_0x0cc1('0xb')]);router[_0x0cc1('0xa')](_0x0cc1('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x0cc1('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0x0cc1('0xd')]);router[_0x0cc1('0xe')]('/',auth[_0x0cc1('0xf')](),controller[_0x0cc1('0x10')]);router[_0x0cc1('0x11')]('/:id',auth[_0x0cc1('0xf')](),controller[_0x0cc1('0x12')]);router[_0x0cc1('0x13')](_0x0cc1('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x0cc1('0x14')]=router; \ No newline at end of file +var _0xe73c=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','index','get','/:id','/:id/download','download','put','delete','destroy','exports','multer'];(function(_0x3cae0d,_0x17794d){var _0x386048=function(_0x24bf9d){while(--_0x24bf9d){_0x3cae0d['push'](_0x3cae0d['shift']());}};_0x386048(++_0x17794d);}(_0xe73c,0x153));var _0xce73=function(_0x46fab9,_0x395fbe){_0x46fab9=_0x46fab9-0x0;var _0x44009d=_0xe73c[_0x46fab9];return _0x44009d;};'use strict';var multer=require(_0xce73('0x0'));var util=require(_0xce73('0x1'));var path=require('path');var timeout=require(_0xce73('0x2'));var express=require(_0xce73('0x3'));var router=express[_0xce73('0x4')]();var fs_extra=require(_0xce73('0x5'));var auth=require(_0xce73('0x6'));var interaction=require(_0xce73('0x7'));var config=require(_0xce73('0x8'));var controller=require(_0xce73('0x9'));router['get']('/',auth[_0xce73('0xa')](),controller[_0xce73('0xb')]);router[_0xce73('0xc')](_0xce73('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0xce73('0xe'),auth['isAuthenticated'](),controller[_0xce73('0xf')]);router['post']('/',auth[_0xce73('0xa')](),controller['create']);router[_0xce73('0x10')]('/:id',auth[_0xce73('0xa')](),controller['update']);router[_0xce73('0x11')](_0xce73('0xd'),auth['isAuthenticated'](),controller[_0xce73('0x12')]);module[_0xce73('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index f44f1e7..8fdeb79 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 _0x9a0e=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x58a56e,_0x743b79){var _0x4a0f75=function(_0x48fd77){while(--_0x48fd77){_0x58a56e['push'](_0x58a56e['shift']());}};_0x4a0f75(++_0x743b79);}(_0x9a0e,0x1c3));var _0xe9a0=function(_0x247e03,_0x209b53){_0x247e03=_0x247e03-0x0;var _0xa7cae6=_0x9a0e[_0x247e03];return _0xa7cae6;};'use strict';var Sequelize=require(_0xe9a0('0x0'));module[_0xe9a0('0x1')]={'field':{'type':Sequelize[_0xe9a0('0x2')]},'alias':{'type':Sequelize[_0xe9a0('0x3')]},'function':{'type':Sequelize[_0xe9a0('0x3')]},'format':{'type':Sequelize[_0xe9a0('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xe9a0('0x3')]},'custom':{'type':Sequelize[_0xe9a0('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xc217=['STRING','BOOLEAN','exports','TEXT'];(function(_0x31295c,_0x2f2b82){var _0x2c150e=function(_0x957f1){while(--_0x957f1){_0x31295c['push'](_0x31295c['shift']());}};_0x2c150e(++_0x2f2b82);}(_0xc217,0x7a));var _0x7c21=function(_0x2181b1,_0x569637){_0x2181b1=_0x2181b1-0x0;var _0x530548=_0xc217[_0x2181b1];return _0x530548;};'use strict';var Sequelize=require('sequelize');module[_0x7c21('0x0')]={'field':{'type':Sequelize[_0x7c21('0x1')]},'alias':{'type':Sequelize[_0x7c21('0x2')]},'function':{'type':Sequelize[_0x7c21('0x2')]},'format':{'type':Sequelize[_0x7c21('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x7c21('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 41e5a84..9fa5cfa 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 _0x7e39=['includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','bulkCreate','bulkDestroy','ids','transaction','CustomReportId','eml-format','zip-dir','fast-json-patch','moment','mustache','path','fs-extra','lodash','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','AnalyticFieldReport','fieldName','type','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options'];(function(_0x38b11c,_0x550c61){var _0x4aef61=function(_0x512f8f){while(--_0x512f8f){_0x38b11c['push'](_0x38b11c['shift']());}};_0x4aef61(++_0x550c61);}(_0x7e39,0x139));var _0x97e3=function(_0x4b00a6,_0x2838d6){_0x4b00a6=_0x4b00a6-0x0;var _0x11c8eb=_0x7e39[_0x4b00a6];return _0x11c8eb;};'use strict';var emlformat=require(_0x97e3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x97e3('0x1'));var jsonpatch=require(_0x97e3('0x2'));var rp=require('request-promise');var moment=require(_0x97e3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x97e3('0x4'));var util=require('util');var path=require(_0x97e3('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x97e3('0x6'));var _=require(_0x97e3('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x97e3('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x97e3('0x9'));var querystring=require(_0x97e3('0xa'));var Papa=require('papaparse');var Redis=require(_0x97e3('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x97e3('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97e3('0xd'));var logger=require(_0x97e3('0xe'))('api');var utils=require(_0x97e3('0xf'));var config=require(_0x97e3('0x10'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x414ff0,_0x2f9bd6){_0x2f9bd6=_0x2f9bd6||0xcc;return function(_0x160111){if(_0x160111){return _0x414ff0[_0x97e3('0x11')](_0x2f9bd6);}return _0x414ff0[_0x97e3('0x12')](_0x2f9bd6)['end']();};}function respondWithResult(_0x1caec1,_0x28f5fa){_0x28f5fa=_0x28f5fa||0xc8;return function(_0x362982){if(_0x362982){return _0x1caec1[_0x97e3('0x12')](_0x28f5fa)[_0x97e3('0x13')](_0x362982);}};}function respondWithFilteredResult(_0xc52a56,_0x5b9b16){return function(_0x36050c){if(_0x36050c){var _0x25ad3a=typeof _0x5b9b16['offset']===_0x97e3('0x14')&&typeof _0x5b9b16[_0x97e3('0x15')]===_0x97e3('0x14');var _0x30c4ba=_0x36050c['count'];var _0xa2dd90=_0x25ad3a?0x0:_0x5b9b16['offset'];var _0x1a80e2=_0x25ad3a?_0x36050c[_0x97e3('0x16')]:_0x5b9b16[_0x97e3('0x17')]+_0x5b9b16[_0x97e3('0x15')];var _0x2dece5;if(_0x1a80e2>=_0x30c4ba){_0x1a80e2=_0x30c4ba;_0x2dece5=0xc8;}else{_0x2dece5=0xce;}_0xc52a56[_0x97e3('0x12')](_0x2dece5);return _0xc52a56[_0x97e3('0x18')](_0x97e3('0x19'),_0xa2dd90+'-'+_0x1a80e2+'/'+_0x30c4ba)[_0x97e3('0x13')](_0x36050c);}return null;};}function patchUpdates(_0x2c552d){return function(_0x26aec8){try{jsonpatch[_0x97e3('0x1a')](_0x26aec8,_0x2c552d,!![]);}catch(_0x100453){return BPromise[_0x97e3('0x1b')](_0x100453);}return _0x26aec8[_0x97e3('0x1c')]();};}function saveUpdates(_0x320b5c,_0x10ee01){return function(_0x16c989){if(_0x16c989){return _0x16c989[_0x97e3('0x1d')](_0x320b5c)[_0x97e3('0x1e')](function(_0x421471){return _0x421471;});}return null;};}function removeEntity(_0xb87b64,_0x1e612e){return function(_0x2c44bd){if(_0x2c44bd){return _0x2c44bd[_0x97e3('0x1f')]()['then'](function(){_0xb87b64[_0x97e3('0x12')](0xcc)[_0x97e3('0x20')]();});}};}function handleEntityNotFound(_0x26d78c,_0x108a75){return function(_0x4c5c82){if(!_0x4c5c82){_0x26d78c[_0x97e3('0x11')](0x194);}return _0x4c5c82;};}function handleError(_0x1f7529,_0x5645c7){_0x5645c7=_0x5645c7||0x1f4;return function(_0x282411){logger['error'](_0x282411[_0x97e3('0x21')]);if(_0x282411[_0x97e3('0x22')]){delete _0x282411[_0x97e3('0x22')];}_0x1f7529['status'](_0x5645c7)[_0x97e3('0x23')](_0x282411);};}exports['index']=function(_0x41e9dd,_0x27e969){var _0x3b6aeb={},_0x178d81={},_0x9374b7={'count':0x0,'rows':[]};var _0xed114a=_['map'](db[_0x97e3('0x24')]['rawAttributes'],function(_0x3d6093){return{'name':_0x3d6093[_0x97e3('0x25')],'type':_0x3d6093[_0x97e3('0x26')][_0x97e3('0x27')]};});_0x178d81['model']=_[_0x97e3('0x28')](_0xed114a,_0x97e3('0x22'));_0x178d81[_0x97e3('0x29')]=_['keys'](_0x41e9dd[_0x97e3('0x29')]);_0x178d81[_0x97e3('0x2a')]=_[_0x97e3('0x2b')](_0x178d81[_0x97e3('0x2c')],_0x178d81[_0x97e3('0x29')]);_0x3b6aeb['attributes']=_[_0x97e3('0x2b')](_0x178d81[_0x97e3('0x2c')],qs['fields'](_0x41e9dd[_0x97e3('0x29')][_0x97e3('0x2d')]));_0x3b6aeb[_0x97e3('0x2e')]=_0x3b6aeb[_0x97e3('0x2e')][_0x97e3('0x2f')]?_0x3b6aeb[_0x97e3('0x2e')]:_0x178d81[_0x97e3('0x2c')];if(!_0x41e9dd['query'][_0x97e3('0x30')](_0x97e3('0x31'))){_0x3b6aeb[_0x97e3('0x15')]=qs['limit'](_0x41e9dd[_0x97e3('0x29')][_0x97e3('0x15')]);_0x3b6aeb[_0x97e3('0x17')]=qs[_0x97e3('0x17')](_0x41e9dd[_0x97e3('0x29')][_0x97e3('0x17')]);}_0x3b6aeb[_0x97e3('0x32')]=qs[_0x97e3('0x33')](_0x41e9dd['query']['sort']);_0x3b6aeb[_0x97e3('0x34')]=qs[_0x97e3('0x2a')](_[_0x97e3('0x35')](_0x41e9dd[_0x97e3('0x29')],_0x178d81[_0x97e3('0x2a')]),_0xed114a);if(_0x41e9dd[_0x97e3('0x29')][_0x97e3('0x36')]){_0x3b6aeb[_0x97e3('0x34')]=_[_0x97e3('0x37')](_0x3b6aeb['where'],{'$or':_[_0x97e3('0x28')](_0xed114a,function(_0x399fc3){if(_0x399fc3[_0x97e3('0x26')]!=='VIRTUAL'){var _0x535d32={};_0x535d32[_0x399fc3[_0x97e3('0x22')]]={'$like':'%'+_0x41e9dd[_0x97e3('0x29')][_0x97e3('0x36')]+'%'};return _0x535d32;}})});}_0x3b6aeb=_['merge']({},_0x3b6aeb,_0x41e9dd[_0x97e3('0x38')]);var _0x52a382={'where':_0x3b6aeb[_0x97e3('0x34')]};return db[_0x97e3('0x24')][_0x97e3('0x16')](_0x52a382)[_0x97e3('0x1e')](function(_0x2b473a){_0x9374b7['count']=_0x2b473a;if(_0x41e9dd[_0x97e3('0x29')][_0x97e3('0x39')]){_0x3b6aeb[_0x97e3('0x3a')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x97e3('0x3b')](_0x3b6aeb);})[_0x97e3('0x1e')](function(_0xe0612b){_0x9374b7[_0x97e3('0x3c')]=_0xe0612b;return _0x9374b7;})['then'](respondWithFilteredResult(_0x27e969,_0x3b6aeb))[_0x97e3('0x3d')](handleError(_0x27e969,null));};exports[_0x97e3('0x3e')]=function(_0x3970a9,_0x22e18e){var _0x50f258={'raw':![],'where':{'id':_0x3970a9[_0x97e3('0x3f')]['id']}},_0x48b368={};_0x48b368[_0x97e3('0x2c')]=_[_0x97e3('0x40')](db[_0x97e3('0x24')][_0x97e3('0x41')]);_0x48b368['query']=_[_0x97e3('0x40')](_0x3970a9[_0x97e3('0x29')]);_0x48b368[_0x97e3('0x2a')]=_[_0x97e3('0x2b')](_0x48b368[_0x97e3('0x2c')],_0x48b368[_0x97e3('0x29')]);_0x50f258[_0x97e3('0x2e')]=_['intersection'](_0x48b368[_0x97e3('0x2c')],qs['fields'](_0x3970a9[_0x97e3('0x29')][_0x97e3('0x2d')]));_0x50f258['attributes']=_0x50f258[_0x97e3('0x2e')][_0x97e3('0x2f')]?_0x50f258[_0x97e3('0x2e')]:_0x48b368[_0x97e3('0x2c')];if(_0x3970a9['query'][_0x97e3('0x39')]){_0x50f258['include']=[{'all':!![]}];}_0x50f258=_[_0x97e3('0x37')]({},_0x50f258,_0x3970a9[_0x97e3('0x38')]);return db['AnalyticFieldReport'][_0x97e3('0x42')](_0x50f258)['then'](handleEntityNotFound(_0x22e18e,null))[_0x97e3('0x1e')](respondWithResult(_0x22e18e,null))[_0x97e3('0x3d')](handleError(_0x22e18e,null));};exports[_0x97e3('0x43')]=function(_0x46d807,_0x2b1370){return db[_0x97e3('0x24')][_0x97e3('0x43')](_0x46d807[_0x97e3('0x44')],{})[_0x97e3('0x1e')](respondWithResult(_0x2b1370,0xc9))[_0x97e3('0x3d')](handleError(_0x2b1370,null));};exports[_0x97e3('0x45')]=function(_0x138f85,_0x1b6956){return db[_0x97e3('0x24')][_0x97e3('0x45')](_0x138f85[_0x97e3('0x44')],{'raw':![],'individualHooks':!![]})[_0x97e3('0x1e')](respondWithResult(_0x1b6956,0xc9))[_0x97e3('0x3d')](handleError(_0x1b6956,null));};exports[_0x97e3('0x1d')]=function(_0x58960d,_0x45c469){if(_0x58960d['body']['id']){delete _0x58960d['body']['id'];}return db[_0x97e3('0x24')][_0x97e3('0x42')]({'where':{'id':_0x58960d[_0x97e3('0x3f')]['id']}})[_0x97e3('0x1e')](handleEntityNotFound(_0x45c469,null))['then'](saveUpdates(_0x58960d[_0x97e3('0x44')],null))[_0x97e3('0x1e')](respondWithResult(_0x45c469,null))[_0x97e3('0x3d')](handleError(_0x45c469,null));};exports[_0x97e3('0x1f')]=function(_0x2d69d7,_0x4ffebf){return db[_0x97e3('0x24')][_0x97e3('0x42')]({'where':{'id':_0x2d69d7[_0x97e3('0x3f')]['id']}})[_0x97e3('0x1e')](handleEntityNotFound(_0x4ffebf,null))[_0x97e3('0x1e')](removeEntity(_0x4ffebf,null))[_0x97e3('0x3d')](handleError(_0x4ffebf,null));};exports[_0x97e3('0x46')]=function(_0xae9765,_0x276e4b){return db[_0x97e3('0x24')][_0x97e3('0x1f')]({'where':{'id':_0xae9765[_0x97e3('0x29')][_0x97e3('0x47')]||[]},'raw':![],'individualHooks':!![]})[_0x97e3('0x1e')](respondWithResult(_0x276e4b,0xcc))[_0x97e3('0x3d')](handleError(_0x276e4b,null));};exports['addFields']=function(_0x14a973,_0x2bbae0,_0x1c759d){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x14a973[_0x97e3('0x3f')]['id']}})[_0x97e3('0x1e')](handleEntityNotFound(_0x2bbae0,null))[_0x97e3('0x1e')](function(_0x9fcce4){if(_0x9fcce4){return db['sequelize'][_0x97e3('0x48')](function(_0xb020b6){return db['AnalyticFieldReport'][_0x97e3('0x1f')]({'where':{'CustomReportId':_0x14a973[_0x97e3('0x3f')]['id']},'transaction':_0xb020b6})[_0x97e3('0x1e')](function(_0x5a3517){var _0x217a9a=_[_0x97e3('0x28')](_0x14a973['body'],function(_0x14450e){delete _0x14450e['id'];_0x14450e[_0x97e3('0x49')]=_0x14a973[_0x97e3('0x3f')]['id'];return _0x14450e;});return db['AnalyticFieldReport'][_0x97e3('0x45')](_0x217a9a,{'transaction':_0xb020b6});});})[_0x97e3('0x1e')](function(){return db[_0x97e3('0x24')][_0x97e3('0x3b')]({'where':{'CustomReportId':_0x14a973[_0x97e3('0x3f')]['id']}});});}})['then'](respondWithResult(_0x2bbae0,null))[_0x97e3('0x3d')](handleError(_0x2bbae0,null));}; \ No newline at end of file +var _0xab1a=['catch','params','find','create','body','bulkCreate','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','stack','name','send','map','fieldName','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','AnalyticFieldReport','includeAll','include','findAll'];(function(_0x3ba924,_0x3b99f0){var _0x4cc1df=function(_0x15bf28){while(--_0x15bf28){_0x3ba924['push'](_0x3ba924['shift']());}};_0x4cc1df(++_0x3b99f0);}(_0xab1a,0x151));var _0xaab1=function(_0x22868f,_0x450f48){_0x22868f=_0x22868f-0x0;var _0x97bc75=_0xab1a[_0x22868f];return _0x97bc75;};'use strict';var emlformat=require(_0xaab1('0x0'));var rimraf=require(_0xaab1('0x1'));var zipdir=require(_0xaab1('0x2'));var jsonpatch=require(_0xaab1('0x3'));var rp=require('request-promise');var moment=require(_0xaab1('0x4'));var BPromise=require(_0xaab1('0x5'));var Mustache=require(_0xaab1('0x6'));var util=require(_0xaab1('0x7'));var path=require('path');var sox=require(_0xaab1('0x8'));var csv=require(_0xaab1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaab1('0xa'));var _=require(_0xaab1('0xb'));var squel=require(_0xaab1('0xc'));var crypto=require(_0xaab1('0xd'));var jsforce=require(_0xaab1('0xe'));var deskjs=require(_0xaab1('0xf'));var toCsv=require(_0xaab1('0x9'));var querystring=require(_0xaab1('0x10'));var Papa=require(_0xaab1('0x11'));var Redis=require(_0xaab1('0x12'));var authService=require(_0xaab1('0x13'));var qs=require(_0xaab1('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaab1('0x15'));var utils=require(_0xaab1('0x16'));var config=require(_0xaab1('0x17'));var licenseUtil=require(_0xaab1('0x18'));var db=require(_0xaab1('0x19'))['db'];function respondWithStatusCode(_0x4e45ce,_0x3ce75f){_0x3ce75f=_0x3ce75f||0xcc;return function(_0x23bde5){if(_0x23bde5){return _0x4e45ce[_0xaab1('0x1a')](_0x3ce75f);}return _0x4e45ce[_0xaab1('0x1b')](_0x3ce75f)['end']();};}function respondWithResult(_0x32e764,_0x204b8a){_0x204b8a=_0x204b8a||0xc8;return function(_0x5695df){if(_0x5695df){return _0x32e764['status'](_0x204b8a)[_0xaab1('0x1c')](_0x5695df);}};}function respondWithFilteredResult(_0x2a300f,_0x574979){return function(_0x2a4485){if(_0x2a4485){var _0x356dd7=typeof _0x574979[_0xaab1('0x1d')]===_0xaab1('0x1e')&&typeof _0x574979[_0xaab1('0x1f')]===_0xaab1('0x1e');var _0x2c9f3b=_0x2a4485['count'];var _0x13ba55=_0x356dd7?0x0:_0x574979[_0xaab1('0x1d')];var _0x54fd0f=_0x356dd7?_0x2a4485[_0xaab1('0x20')]:_0x574979['offset']+_0x574979[_0xaab1('0x1f')];var _0x52672e;if(_0x54fd0f>=_0x2c9f3b){_0x54fd0f=_0x2c9f3b;_0x52672e=0xc8;}else{_0x52672e=0xce;}_0x2a300f['status'](_0x52672e);return _0x2a300f[_0xaab1('0x21')](_0xaab1('0x22'),_0x13ba55+'-'+_0x54fd0f+'/'+_0x2c9f3b)['json'](_0x2a4485);}return null;};}function patchUpdates(_0x3bb39a){return function(_0x175546){try{jsonpatch[_0xaab1('0x23')](_0x175546,_0x3bb39a,!![]);}catch(_0x4cea72){return BPromise[_0xaab1('0x24')](_0x4cea72);}return _0x175546['save']();};}function saveUpdates(_0x27e72c,_0x17a353){return function(_0x524b7e){if(_0x524b7e){return _0x524b7e[_0xaab1('0x25')](_0x27e72c)[_0xaab1('0x26')](function(_0x470ef0){return _0x470ef0;});}return null;};}function removeEntity(_0x527d6e,_0x2fb93d){return function(_0x495d1d){if(_0x495d1d){return _0x495d1d[_0xaab1('0x27')]()[_0xaab1('0x26')](function(){_0x527d6e[_0xaab1('0x1b')](0xcc)[_0xaab1('0x28')]();});}};}function handleEntityNotFound(_0x5a85c5,_0x3b745c){return function(_0x29496a){if(!_0x29496a){_0x5a85c5[_0xaab1('0x1a')](0x194);}return _0x29496a;};}function handleError(_0x3d3b06,_0xbf15f8){_0xbf15f8=_0xbf15f8||0x1f4;return function(_0x4e213f){logger['error'](_0x4e213f[_0xaab1('0x29')]);if(_0x4e213f[_0xaab1('0x2a')]){delete _0x4e213f[_0xaab1('0x2a')];}_0x3d3b06[_0xaab1('0x1b')](_0xbf15f8)[_0xaab1('0x2b')](_0x4e213f);};}exports['index']=function(_0x3fbfe7,_0x7dc02f){var _0x51207b={},_0x5f38e3={},_0x2fd8a0={'count':0x0,'rows':[]};var _0x213050=_[_0xaab1('0x2c')](db['AnalyticFieldReport']['rawAttributes'],function(_0x28ad87){return{'name':_0x28ad87[_0xaab1('0x2d')],'type':_0x28ad87['type']['key']};});_0x5f38e3['model']=_[_0xaab1('0x2c')](_0x213050,_0xaab1('0x2a'));_0x5f38e3[_0xaab1('0x2e')]=_[_0xaab1('0x2f')](_0x3fbfe7[_0xaab1('0x2e')]);_0x5f38e3[_0xaab1('0x30')]=_[_0xaab1('0x31')](_0x5f38e3[_0xaab1('0x32')],_0x5f38e3[_0xaab1('0x2e')]);_0x51207b['attributes']=_['intersection'](_0x5f38e3['model'],qs['fields'](_0x3fbfe7[_0xaab1('0x2e')][_0xaab1('0x33')]));_0x51207b[_0xaab1('0x34')]=_0x51207b[_0xaab1('0x34')][_0xaab1('0x35')]?_0x51207b[_0xaab1('0x34')]:_0x5f38e3['model'];if(!_0x3fbfe7[_0xaab1('0x2e')][_0xaab1('0x36')](_0xaab1('0x37'))){_0x51207b[_0xaab1('0x1f')]=qs[_0xaab1('0x1f')](_0x3fbfe7[_0xaab1('0x2e')][_0xaab1('0x1f')]);_0x51207b[_0xaab1('0x1d')]=qs['offset'](_0x3fbfe7['query'][_0xaab1('0x1d')]);}_0x51207b[_0xaab1('0x38')]=qs[_0xaab1('0x39')](_0x3fbfe7[_0xaab1('0x2e')][_0xaab1('0x39')]);_0x51207b['where']=qs['filters'](_[_0xaab1('0x3a')](_0x3fbfe7[_0xaab1('0x2e')],_0x5f38e3['filters']),_0x213050);if(_0x3fbfe7[_0xaab1('0x2e')][_0xaab1('0x3b')]){_0x51207b[_0xaab1('0x3c')]=_[_0xaab1('0x3d')](_0x51207b[_0xaab1('0x3c')],{'$or':_[_0xaab1('0x2c')](_0x213050,function(_0x49c345){if(_0x49c345['type']!==_0xaab1('0x3e')){var _0x38c0bd={};_0x38c0bd[_0x49c345[_0xaab1('0x2a')]]={'$like':'%'+_0x3fbfe7[_0xaab1('0x2e')]['filter']+'%'};return _0x38c0bd;}})});}_0x51207b=_[_0xaab1('0x3d')]({},_0x51207b,_0x3fbfe7[_0xaab1('0x3f')]);var _0x4b653b={'where':_0x51207b[_0xaab1('0x3c')]};return db[_0xaab1('0x40')]['count'](_0x4b653b)[_0xaab1('0x26')](function(_0x28038f){_0x2fd8a0[_0xaab1('0x20')]=_0x28038f;if(_0x3fbfe7[_0xaab1('0x2e')][_0xaab1('0x41')]){_0x51207b[_0xaab1('0x42')]=[{'all':!![]}];}return db[_0xaab1('0x40')][_0xaab1('0x43')](_0x51207b);})[_0xaab1('0x26')](function(_0xb16fb1){_0x2fd8a0['rows']=_0xb16fb1;return _0x2fd8a0;})[_0xaab1('0x26')](respondWithFilteredResult(_0x7dc02f,_0x51207b))[_0xaab1('0x44')](handleError(_0x7dc02f,null));};exports['show']=function(_0x471b85,_0x3e75c0){var _0x2e875c={'raw':![],'where':{'id':_0x471b85[_0xaab1('0x45')]['id']}},_0xec88c9={};_0xec88c9['model']=_[_0xaab1('0x2f')](db[_0xaab1('0x40')]['rawAttributes']);_0xec88c9[_0xaab1('0x2e')]=_['keys'](_0x471b85[_0xaab1('0x2e')]);_0xec88c9[_0xaab1('0x30')]=_[_0xaab1('0x31')](_0xec88c9[_0xaab1('0x32')],_0xec88c9['query']);_0x2e875c[_0xaab1('0x34')]=_[_0xaab1('0x31')](_0xec88c9[_0xaab1('0x32')],qs[_0xaab1('0x33')](_0x471b85[_0xaab1('0x2e')]['fields']));_0x2e875c[_0xaab1('0x34')]=_0x2e875c[_0xaab1('0x34')][_0xaab1('0x35')]?_0x2e875c['attributes']:_0xec88c9[_0xaab1('0x32')];if(_0x471b85[_0xaab1('0x2e')][_0xaab1('0x41')]){_0x2e875c[_0xaab1('0x42')]=[{'all':!![]}];}_0x2e875c=_[_0xaab1('0x3d')]({},_0x2e875c,_0x471b85[_0xaab1('0x3f')]);return db[_0xaab1('0x40')][_0xaab1('0x46')](_0x2e875c)[_0xaab1('0x26')](handleEntityNotFound(_0x3e75c0,null))['then'](respondWithResult(_0x3e75c0,null))[_0xaab1('0x44')](handleError(_0x3e75c0,null));};exports[_0xaab1('0x47')]=function(_0x4d0b95,_0xb77b34){return db['AnalyticFieldReport'][_0xaab1('0x47')](_0x4d0b95[_0xaab1('0x48')],{})[_0xaab1('0x26')](respondWithResult(_0xb77b34,0xc9))['catch'](handleError(_0xb77b34,null));};exports[_0xaab1('0x49')]=function(_0x563c5d,_0x319a61){return db['AnalyticFieldReport']['bulkCreate'](_0x563c5d['body'],{'raw':![],'individualHooks':!![]})[_0xaab1('0x26')](respondWithResult(_0x319a61,0xc9))[_0xaab1('0x44')](handleError(_0x319a61,null));};exports[_0xaab1('0x25')]=function(_0x44229b,_0x5c7096){if(_0x44229b[_0xaab1('0x48')]['id']){delete _0x44229b['body']['id'];}return db[_0xaab1('0x40')][_0xaab1('0x46')]({'where':{'id':_0x44229b['params']['id']}})['then'](handleEntityNotFound(_0x5c7096,null))['then'](saveUpdates(_0x44229b['body'],null))[_0xaab1('0x26')](respondWithResult(_0x5c7096,null))[_0xaab1('0x44')](handleError(_0x5c7096,null));};exports[_0xaab1('0x27')]=function(_0x29729e,_0xcc7f96){return db['AnalyticFieldReport'][_0xaab1('0x46')]({'where':{'id':_0x29729e[_0xaab1('0x45')]['id']}})[_0xaab1('0x26')](handleEntityNotFound(_0xcc7f96,null))[_0xaab1('0x26')](removeEntity(_0xcc7f96,null))[_0xaab1('0x44')](handleError(_0xcc7f96,null));};exports['bulkDestroy']=function(_0x1b44c8,_0x3aeea4){return db[_0xaab1('0x40')][_0xaab1('0x27')]({'where':{'id':_0x1b44c8[_0xaab1('0x2e')][_0xaab1('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0xaab1('0x26')](respondWithResult(_0x3aeea4,0xcc))['catch'](handleError(_0x3aeea4,null));};exports[_0xaab1('0x4b')]=function(_0x1ec483,_0x5a7c5b,_0x7ff33c){return db[_0xaab1('0x4c')][_0xaab1('0x4d')]({'where':{'id':_0x1ec483[_0xaab1('0x45')]['id']}})[_0xaab1('0x26')](handleEntityNotFound(_0x5a7c5b,null))[_0xaab1('0x26')](function(_0x2908fa){if(_0x2908fa){return db[_0xaab1('0x4e')][_0xaab1('0x4f')](function(_0x3abaec){return db[_0xaab1('0x40')][_0xaab1('0x27')]({'where':{'CustomReportId':_0x1ec483[_0xaab1('0x45')]['id']},'transaction':_0x3abaec})['then'](function(_0x119cc4){var _0x3ee4df=_[_0xaab1('0x2c')](_0x1ec483[_0xaab1('0x48')],function(_0x2397c6){delete _0x2397c6['id'];_0x2397c6[_0xaab1('0x50')]=_0x1ec483[_0xaab1('0x45')]['id'];return _0x2397c6;});return db[_0xaab1('0x40')][_0xaab1('0x49')](_0x3ee4df,{'transaction':_0x3abaec});});})[_0xaab1('0x26')](function(){return db['AnalyticFieldReport'][_0xaab1('0x43')]({'where':{'CustomReportId':_0x1ec483[_0xaab1('0x45')]['id']}});});}})[_0xaab1('0x26')](respondWithResult(_0x5a7c5b,null))[_0xaab1('0x44')](handleError(_0x5a7c5b,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 7a7d7e5..ca847f1 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 _0xce16=['path','rimraf','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','util','../../config/logger','api','bluebird','request-promise'];(function(_0x5ad190,_0x202756){var _0x57d479=function(_0x35965b){while(--_0x35965b){_0x5ad190['push'](_0x5ad190['shift']());}};_0x57d479(++_0x202756);}(_0xce16,0x127));var _0x6ce1=function(_0xb16d2d,_0x1cc3af){_0xb16d2d=_0xb16d2d-0x0;var _0x490681=_0xce16[_0xb16d2d];return _0x490681;};'use strict';var _=require('lodash');var util=require(_0x6ce1('0x0'));var logger=require(_0x6ce1('0x1'))(_0x6ce1('0x2'));var moment=require('moment');var BPromise=require(_0x6ce1('0x3'));var rp=require(_0x6ce1('0x4'));var fs=require('fs');var path=require(_0x6ce1('0x5'));var rimraf=require(_0x6ce1('0x6'));var config=require('../../config/environment');var attributes=require(_0x6ce1('0x7'));module[_0x6ce1('0x8')]=function(_0x36e9e0,_0x2d43bf){return _0x36e9e0[_0x6ce1('0x9')](_0x6ce1('0xa'),attributes,{'tableName':_0x6ce1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe7f=['../../config/environment','./analyticFieldReport.attributes','define','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0xd685e,_0x360045){var _0x5ef5e0=function(_0x37f4b3){while(--_0x37f4b3){_0xd685e['push'](_0xd685e['shift']());}};_0x5ef5e0(++_0x360045);}(_0xbe7f,0x85));var _0xfbe7=function(_0x57d00d,_0x3bb282){_0x57d00d=_0x57d00d-0x0;var _0x2d2b37=_0xbe7f[_0x57d00d];return _0x2d2b37;};'use strict';var _=require(_0xfbe7('0x0'));var util=require('util');var logger=require(_0xfbe7('0x1'))(_0xfbe7('0x2'));var moment=require(_0xfbe7('0x3'));var BPromise=require(_0xfbe7('0x4'));var rp=require(_0xfbe7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfbe7('0x6'));var config=require(_0xfbe7('0x7'));var attributes=require(_0xfbe7('0x8'));module['exports']=function(_0x42cce3,_0x4a9c72){return _0x42cce3[_0xfbe7('0x9')]('AnalyticFieldReport',attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index aef6ff1..9470383 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 _0xcd5f=['error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x22c4f0,_0x16d813){var _0x1d80f1=function(_0x52ae90){while(--_0x52ae90){_0x22c4f0['push'](_0x22c4f0['shift']());}};_0x1d80f1(++_0x16d813);}(_0xcd5f,0x9f));var _0xfcd5=function(_0x1ec3f4,_0x4508e9){_0x1ec3f4=_0x1ec3f4-0x0;var _0x53102d=_0xcd5f[_0x1ec3f4];return _0x53102d;};'use strict';var _=require(_0xfcd5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfcd5('0x1'));var rs=require(_0xfcd5('0x2'));var fs=require('fs');var Redis=require(_0xfcd5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfcd5('0x4'));var logger=require(_0xfcd5('0x5'))(_0xfcd5('0x6'));var config=require(_0xfcd5('0x7'));var jayson=require(_0xfcd5('0x8'));var client=jayson['client'][_0xfcd5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x315589,_0x54d4a1,_0x1e02c0){return new BPromise(function(_0xd9fcf7,_0x418c5f){return client['request'](_0x315589,_0x1e02c0)[_0xfcd5('0xa')](function(_0x1de43a){logger[_0xfcd5('0xb')](_0xfcd5('0xc'),_0x54d4a1,_0xfcd5('0xd'));logger[_0xfcd5('0xe')](_0xfcd5('0xf'),_0x54d4a1,_0xfcd5('0xd'),JSON[_0xfcd5('0x10')](_0x1de43a));if(_0x1de43a[_0xfcd5('0x11')]){if(_0x1de43a['error'][_0xfcd5('0x12')]===0x1f4){logger[_0xfcd5('0x11')](_0xfcd5('0xc'),_0x54d4a1,_0x1de43a[_0xfcd5('0x11')][_0xfcd5('0x13')]);return _0x418c5f(_0x1de43a[_0xfcd5('0x11')][_0xfcd5('0x13')]);}logger[_0xfcd5('0x11')](_0xfcd5('0xc'),_0x54d4a1,_0x1de43a[_0xfcd5('0x11')][_0xfcd5('0x13')]);return _0xd9fcf7(_0x1de43a[_0xfcd5('0x11')]['message']);}else{logger[_0xfcd5('0xb')](_0xfcd5('0xc'),_0x54d4a1,_0xfcd5('0xd'));_0xd9fcf7(_0x1de43a[_0xfcd5('0x14')][_0xfcd5('0x13')]);}})[_0xfcd5('0x15')](function(_0x440859){logger[_0xfcd5('0x11')](_0xfcd5('0xc'),_0x54d4a1,_0x440859);_0x418c5f(_0x440859);});});} \ No newline at end of file +var _0x5a40=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x650689,_0x42296d){var _0x5e4665=function(_0x55f89d){while(--_0x55f89d){_0x650689['push'](_0x650689['shift']());}};_0x5e4665(++_0x42296d);}(_0x5a40,0x1d1));var _0x05a4=function(_0x1ae125,_0x20820a){_0x1ae125=_0x1ae125-0x0;var _0x1f3b2b=_0x5a40[_0x1ae125];return _0x1f3b2b;};'use strict';var _=require(_0x05a4('0x0'));var util=require(_0x05a4('0x1'));var moment=require(_0x05a4('0x2'));var BPromise=require(_0x05a4('0x3'));var rs=require(_0x05a4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05a4('0x5'))['db'];var utils=require(_0x05a4('0x6'));var logger=require(_0x05a4('0x7'))('rpc');var config=require(_0x05a4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x05a4('0x9')][_0x05a4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bf8f9,_0x543bdd,_0x47d37f){return new BPromise(function(_0x3d5204,_0x5f2ed3){return client['request'](_0x4bf8f9,_0x47d37f)[_0x05a4('0xb')](function(_0x325826){logger[_0x05a4('0xc')](_0x05a4('0xd'),_0x543bdd,_0x05a4('0xe'));logger[_0x05a4('0xf')](_0x05a4('0x10'),_0x543bdd,_0x05a4('0xe'),JSON[_0x05a4('0x11')](_0x325826));if(_0x325826[_0x05a4('0x12')]){if(_0x325826[_0x05a4('0x12')]['code']===0x1f4){logger[_0x05a4('0x12')](_0x05a4('0xd'),_0x543bdd,_0x325826[_0x05a4('0x12')][_0x05a4('0x13')]);return _0x5f2ed3(_0x325826['error']['message']);}logger[_0x05a4('0x12')](_0x05a4('0xd'),_0x543bdd,_0x325826[_0x05a4('0x12')][_0x05a4('0x13')]);return _0x3d5204(_0x325826[_0x05a4('0x12')][_0x05a4('0x13')]);}else{logger[_0x05a4('0xc')](_0x05a4('0xd'),_0x543bdd,'request\x20sent');_0x3d5204(_0x325826[_0x05a4('0x14')][_0x05a4('0x13')]);}})[_0x05a4('0x15')](function(_0x2b7b1e){logger['error'](_0x05a4('0xd'),_0x543bdd,_0x2b7b1e);_0x5f2ed3(_0x2b7b1e);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 69ccca0..7983ff1 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(_0x5bebc5,_0x39bdeb){var _0x538278=function(_0x1fb3cb){while(--_0x1fb3cb){_0x5bebc5['push'](_0x5bebc5['shift']());}};_0x538278(++_0x39bdeb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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(_0x42733e,_0x282227){var _0x550eb9=function(_0x3b09be){while(--_0x3b09be){_0x42733e['push'](_0x42733e['shift']());}};_0x550eb9(++_0x282227);}(_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'));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 74050f1..a2be31f 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 _0x2f8b=['sequelize','exports','name','STRING','TEXT'];(function(_0x10fe20,_0x4f1268){var _0x4c4fa4=function(_0x3fe46c){while(--_0x3fe46c){_0x10fe20['push'](_0x10fe20['shift']());}};_0x4c4fa4(++_0x4f1268);}(_0x2f8b,0x96));var _0xb2f8=function(_0x3d67e3,_0x1e85ce){_0x3d67e3=_0x3d67e3-0x0;var _0x206293=_0x2f8b[_0x3d67e3];return _0x206293;};'use strict';var Sequelize=require(_0xb2f8('0x0'));module[_0xb2f8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb2f8('0x2')},'table':{'type':Sequelize[_0xb2f8('0x3')]},'metric':{'type':Sequelize[_0xb2f8('0x4')]},'description':{'type':Sequelize[_0xb2f8('0x3')]}}; \ No newline at end of file +var _0x608a=['exports','STRING','TEXT'];(function(_0x5c93bd,_0x392df5){var _0x466d31=function(_0x42a006){while(--_0x42a006){_0x5c93bd['push'](_0x5c93bd['shift']());}};_0x466d31(++_0x392df5);}(_0x608a,0xff));var _0xa608=function(_0x269e2d,_0x561780){_0x269e2d=_0x269e2d-0x0;var _0x42c9e2=_0x608a[_0x269e2d];return _0x42c9e2;};'use strict';var Sequelize=require('sequelize');module[_0xa608('0x0')]={'name':{'type':Sequelize[_0xa608('0x1')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xa608('0x1')]},'metric':{'type':Sequelize[_0xa608('0x2')]},'description':{'type':Sequelize[_0xa608('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 9ff31d9..e239f66 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 _0xf2ca=['filter','merge','map','type','VIRTUAL','options','AnalyticMetric','count','includeAll','findAll','rows','catch','keys','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','get','Metrics','UserProfileResource','destroy','stack','name','send','index','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x5dd5ff,_0x331d18){var _0x127436=function(_0xf47f62){while(--_0xf47f62){_0x5dd5ff['push'](_0x5dd5ff['shift']());}};_0x127436(++_0x331d18);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x146dd7,_0x4d877d){_0x146dd7=_0x146dd7-0x0;var _0x2af0bb=_0xf2ca[_0x146dd7];return _0x2af0bb;};'use strict';var emlformat=require(_0xaf2c('0x0'));var rimraf=require(_0xaf2c('0x1'));var zipdir=require(_0xaf2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf2c('0x3'));var moment=require(_0xaf2c('0x4'));var BPromise=require(_0xaf2c('0x5'));var Mustache=require(_0xaf2c('0x6'));var util=require(_0xaf2c('0x7'));var path=require(_0xaf2c('0x8'));var sox=require('sox');var csv=require(_0xaf2c('0x9'));var ejs=require(_0xaf2c('0xa'));var fs=require('fs');var fs_extra=require(_0xaf2c('0xb'));var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0x9'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];function respondWithStatusCode(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xcc;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0x18')](_0x59a59b);}return _0x285dac[_0xaf2c('0x19')](_0x59a59b)[_0xaf2c('0x1a')]();};}function respondWithResult(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0xc8;return function(_0x152c73){if(_0x152c73){return _0x18a8a5[_0xaf2c('0x19')](_0x293ca6)[_0xaf2c('0x1b')](_0x152c73);}};}function respondWithFilteredResult(_0x2119c8,_0x1d0633){return function(_0x6ac8e){if(_0x6ac8e){var _0x2b4d13=typeof _0x1d0633[_0xaf2c('0x1c')]===_0xaf2c('0x1d')&&typeof _0x1d0633[_0xaf2c('0x1e')]==='undefined';var _0x3ca650=_0x6ac8e['count'];var _0x278a28=_0x2b4d13?0x0:_0x1d0633[_0xaf2c('0x1c')];var _0x1d544a=_0x2b4d13?_0x6ac8e['count']:_0x1d0633[_0xaf2c('0x1c')]+_0x1d0633[_0xaf2c('0x1e')];var _0x1fec4c;if(_0x1d544a>=_0x3ca650){_0x1d544a=_0x3ca650;_0x1fec4c=0xc8;}else{_0x1fec4c=0xce;}_0x2119c8[_0xaf2c('0x19')](_0x1fec4c);return _0x2119c8[_0xaf2c('0x1f')](_0xaf2c('0x20'),_0x278a28+'-'+_0x1d544a+'/'+_0x3ca650)['json'](_0x6ac8e);}return null;};}function patchUpdates(_0x35e712){return function(_0x164bcb){try{jsonpatch[_0xaf2c('0x21')](_0x164bcb,_0x35e712,!![]);}catch(_0x3bfd3f){return BPromise[_0xaf2c('0x22')](_0x3bfd3f);}return _0x164bcb['save']();};}function saveUpdates(_0x396646,_0xbf6f62){return function(_0x18153c){if(_0x18153c){return _0x18153c['update'](_0x396646)['then'](function(_0x29cbdf){return _0x29cbdf;});}return null;};}function removeEntity(_0x303546,_0x1cafad){return function(_0x99f78d){if(_0x99f78d){return _0x99f78d['destroy']()[_0xaf2c('0x23')](function(){var _0xf1a7cf=_0x99f78d[_0xaf2c('0x24')]({'plain':!![]});var _0x3c1ae6=_0xaf2c('0x25');return db[_0xaf2c('0x26')][_0xaf2c('0x27')]({'where':{'type':_0x3c1ae6,'resourceId':_0xf1a7cf['id']}})['then'](function(){return _0x99f78d;});})[_0xaf2c('0x23')](function(){_0x303546[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();});}};}function handleEntityNotFound(_0x410536,_0x4b7cf2){return function(_0x3fb190){if(!_0x3fb190){_0x410536['sendStatus'](0x194);}return _0x3fb190;};}function handleError(_0x38db1b,_0x42f980){_0x42f980=_0x42f980||0x1f4;return function(_0x15466b){logger['error'](_0x15466b[_0xaf2c('0x28')]);if(_0x15466b[_0xaf2c('0x29')]){delete _0x15466b[_0xaf2c('0x29')];}_0x38db1b['status'](_0x42f980)[_0xaf2c('0x2a')](_0x15466b);};}exports[_0xaf2c('0x2b')]=function(_0x42e2a5,_0x19364e){var _0x59d858={},_0x3da072={},_0x4072ff={'count':0x0,'rows':[]};var _0x1be1ef=_['map'](db['AnalyticMetric'][_0xaf2c('0x2c')],function(_0x4c9b4f){return{'name':_0x4c9b4f[_0xaf2c('0x2d')],'type':_0x4c9b4f['type'][_0xaf2c('0x2e')]};});_0x3da072[_0xaf2c('0x2f')]=_['map'](_0x1be1ef,_0xaf2c('0x29'));_0x3da072[_0xaf2c('0x30')]=_['keys'](_0x42e2a5[_0xaf2c('0x30')]);_0x3da072[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x3da072[_0xaf2c('0x2f')],_0x3da072[_0xaf2c('0x30')]);_0x59d858[_0xaf2c('0x33')]=_['intersection'](_0x3da072[_0xaf2c('0x2f')],qs['fields'](_0x42e2a5[_0xaf2c('0x30')]['fields']));_0x59d858[_0xaf2c('0x33')]=_0x59d858['attributes'][_0xaf2c('0x34')]?_0x59d858['attributes']:_0x3da072[_0xaf2c('0x2f')];if(!_0x42e2a5['query'][_0xaf2c('0x35')](_0xaf2c('0x36'))){_0x59d858[_0xaf2c('0x1e')]=qs[_0xaf2c('0x1e')](_0x42e2a5[_0xaf2c('0x30')]['limit']);_0x59d858['offset']=qs[_0xaf2c('0x1c')](_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x1c')]);}_0x59d858[_0xaf2c('0x37')]=qs[_0xaf2c('0x38')](_0x42e2a5[_0xaf2c('0x30')]['sort']);_0x59d858[_0xaf2c('0x39')]=qs[_0xaf2c('0x31')](_['pick'](_0x42e2a5[_0xaf2c('0x30')],_0x3da072[_0xaf2c('0x31')]),_0x1be1ef);if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x3a')]){_0x59d858[_0xaf2c('0x39')]=_[_0xaf2c('0x3b')](_0x59d858[_0xaf2c('0x39')],{'$or':_[_0xaf2c('0x3c')](_0x1be1ef,function(_0x296ca8){if(_0x296ca8[_0xaf2c('0x3d')]!==_0xaf2c('0x3e')){var _0x43f606={};_0x43f606[_0x296ca8[_0xaf2c('0x29')]]={'$like':'%'+_0x42e2a5['query']['filter']+'%'};return _0x43f606;}})});}_0x59d858=_['merge']({},_0x59d858,_0x42e2a5[_0xaf2c('0x3f')]);var _0x3cb075={'where':_0x59d858[_0xaf2c('0x39')]};return db[_0xaf2c('0x40')][_0xaf2c('0x41')](_0x3cb075)[_0xaf2c('0x23')](function(_0x51c441){_0x4072ff[_0xaf2c('0x41')]=_0x51c441;if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x42')]){_0x59d858['include']=[{'all':!![]}];}return db['AnalyticMetric'][_0xaf2c('0x43')](_0x59d858);})['then'](function(_0x181787){_0x4072ff[_0xaf2c('0x44')]=_0x181787;return _0x4072ff;})[_0xaf2c('0x23')](respondWithFilteredResult(_0x19364e,_0x59d858))[_0xaf2c('0x45')](handleError(_0x19364e,null));};exports['show']=function(_0x2091eb,_0x532d5f){var _0x2056b8={'raw':!![],'where':{'id':_0x2091eb['params']['id']}},_0x8ebb65={};_0x8ebb65[_0xaf2c('0x2f')]=_['keys'](db[_0xaf2c('0x40')][_0xaf2c('0x2c')]);_0x8ebb65[_0xaf2c('0x30')]=_[_0xaf2c('0x46')](_0x2091eb[_0xaf2c('0x30')]);_0x8ebb65[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x8ebb65[_0xaf2c('0x2f')],_0x8ebb65[_0xaf2c('0x30')]);_0x2056b8['attributes']=_['intersection'](_0x8ebb65[_0xaf2c('0x2f')],qs['fields'](_0x2091eb['query']['fields']));_0x2056b8[_0xaf2c('0x33')]=_0x2056b8[_0xaf2c('0x33')][_0xaf2c('0x34')]?_0x2056b8[_0xaf2c('0x33')]:_0x8ebb65['model'];if(_0x2091eb[_0xaf2c('0x30')]['includeAll']){_0x2056b8[_0xaf2c('0x47')]=[{'all':!![]}];}_0x2056b8=_['merge']({},_0x2056b8,_0x2091eb[_0xaf2c('0x3f')]);return db[_0xaf2c('0x40')][_0xaf2c('0x48')](_0x2056b8)[_0xaf2c('0x23')](handleEntityNotFound(_0x532d5f,null))[_0xaf2c('0x23')](respondWithResult(_0x532d5f,null))['catch'](handleError(_0x532d5f,null));};exports[_0xaf2c('0x49')]=function(_0x26afee,_0x4b3ca4){return db['AnalyticMetric'][_0xaf2c('0x49')](_0x26afee['body'],{})[_0xaf2c('0x23')](function(_0x23642b){var _0x17b9ec=_0x26afee[_0xaf2c('0x4a')][_0xaf2c('0x24')]({'plain':!![]});if(!_0x17b9ec)throw new Error(_0xaf2c('0x4b'));if(_0x17b9ec[_0xaf2c('0x4c')]===_0xaf2c('0x4a')){var _0x31ccfe=_0x23642b[_0xaf2c('0x24')]({'plain':!![]});var _0x371486='Metrics';return db[_0xaf2c('0x4d')][_0xaf2c('0x48')]({'where':{'name':_0x371486,'userProfileId':_0x17b9ec['userProfileId']},'raw':!![]})['then'](function(_0x56d7ce){if(_0x56d7ce&&_0x56d7ce[_0xaf2c('0x4e')]===0x0){return db[_0xaf2c('0x26')]['create']({'name':_0x31ccfe[_0xaf2c('0x29')],'resourceId':_0x31ccfe['id'],'type':_0x56d7ce[_0xaf2c('0x29')],'sectionId':_0x56d7ce['id']},{})[_0xaf2c('0x23')](function(){return _0x23642b;});}else{return _0x23642b;}})[_0xaf2c('0x45')](function(_0x265748){logger[_0xaf2c('0x4f')](_0xaf2c('0x50'),_0x265748);throw _0x265748;});}return _0x23642b;})['then'](respondWithResult(_0x4b3ca4,0xc9))[_0xaf2c('0x45')](handleError(_0x4b3ca4,null));};exports[_0xaf2c('0x51')]=function(_0x5771e5,_0x245797){if(_0x5771e5[_0xaf2c('0x52')]['id']){delete _0x5771e5[_0xaf2c('0x52')]['id'];}return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x5771e5[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x245797,null))[_0xaf2c('0x23')](saveUpdates(_0x5771e5[_0xaf2c('0x52')],null))[_0xaf2c('0x23')](respondWithResult(_0x245797,null))[_0xaf2c('0x45')](handleError(_0x245797,null));};exports[_0xaf2c('0x27')]=function(_0x411e84,_0x2356a0){return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x411e84[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x2356a0,null))[_0xaf2c('0x23')](removeEntity(_0x2356a0,null))[_0xaf2c('0x45')](handleError(_0x2356a0,null));}; \ No newline at end of file +var _0x1cb9=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','show','params','keys','length','find','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb9,0x14e));var _0x91cb=function(_0x23d9a2,_0x27bb94){_0x23d9a2=_0x23d9a2-0x0;var _0xc48602=_0x1cb9[_0x23d9a2];return _0xc48602;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];function respondWithStatusCode(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xcc;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0x19')](_0x4ba2f2);}return _0x366f09[_0x91cb('0x1a')](_0x4ba2f2)[_0x91cb('0x1b')]();};}function respondWithResult(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0xc8;return function(_0x4aae25){if(_0x4aae25){return _0x4a7d45[_0x91cb('0x1a')](_0x4cc6ef)['json'](_0x4aae25);}};}function respondWithFilteredResult(_0x528f73,_0x576369){return function(_0xc3629e){if(_0xc3629e){var _0x347980=typeof _0x576369['offset']===_0x91cb('0x1c')&&typeof _0x576369[_0x91cb('0x1d')]==='undefined';var _0xc594e3=_0xc3629e[_0x91cb('0x1e')];var _0x1cd34b=_0x347980?0x0:_0x576369[_0x91cb('0x1f')];var _0x5cc1c3=_0x347980?_0xc3629e[_0x91cb('0x1e')]:_0x576369[_0x91cb('0x1f')]+_0x576369['limit'];var _0x123847;if(_0x5cc1c3>=_0xc594e3){_0x5cc1c3=_0xc594e3;_0x123847=0xc8;}else{_0x123847=0xce;}_0x528f73['status'](_0x123847);return _0x528f73['set'](_0x91cb('0x20'),_0x1cd34b+'-'+_0x5cc1c3+'/'+_0xc594e3)[_0x91cb('0x21')](_0xc3629e);}return null;};}function patchUpdates(_0x56e409){return function(_0x51a1d5){try{jsonpatch['apply'](_0x51a1d5,_0x56e409,!![]);}catch(_0x438162){return BPromise[_0x91cb('0x22')](_0x438162);}return _0x51a1d5[_0x91cb('0x23')]();};}function saveUpdates(_0x1dbee2,_0x5c6a15){return function(_0x45c4b3){if(_0x45c4b3){return _0x45c4b3[_0x91cb('0x24')](_0x1dbee2)[_0x91cb('0x25')](function(_0x55fa78){return _0x55fa78;});}return null;};}function removeEntity(_0x26f18f,_0x1a7a54){return function(_0x2447e7){if(_0x2447e7){return _0x2447e7[_0x91cb('0x26')]()[_0x91cb('0x25')](function(){var _0x7ad361=_0x2447e7[_0x91cb('0x27')]({'plain':!![]});var _0x423c4f=_0x91cb('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x423c4f,'resourceId':_0x7ad361['id']}})[_0x91cb('0x25')](function(){return _0x2447e7;});})['then'](function(){_0x26f18f[_0x91cb('0x1a')](0xcc)[_0x91cb('0x1b')]();});}};}function handleEntityNotFound(_0x318031,_0x5595c5){return function(_0x9b26a6){if(!_0x9b26a6){_0x318031['sendStatus'](0x194);}return _0x9b26a6;};}function handleError(_0x4572f6,_0x308e8c){_0x308e8c=_0x308e8c||0x1f4;return function(_0x3b3ee6){logger[_0x91cb('0x29')](_0x3b3ee6[_0x91cb('0x2a')]);if(_0x3b3ee6['name']){delete _0x3b3ee6[_0x91cb('0x2b')];}_0x4572f6['status'](_0x308e8c)[_0x91cb('0x2c')](_0x3b3ee6);};}exports[_0x91cb('0x2d')]=function(_0x445fe1,_0x4944bd){var _0x775c25={},_0x146e1f={},_0x25bbf9={'count':0x0,'rows':[]};var _0x361e4c=_[_0x91cb('0x2e')](db[_0x91cb('0x2f')][_0x91cb('0x30')],function(_0x3bbde3){return{'name':_0x3bbde3[_0x91cb('0x31')],'type':_0x3bbde3['type'][_0x91cb('0x32')]};});_0x146e1f[_0x91cb('0x33')]=_[_0x91cb('0x2e')](_0x361e4c,_0x91cb('0x2b'));_0x146e1f[_0x91cb('0x34')]=_['keys'](_0x445fe1[_0x91cb('0x34')]);_0x146e1f[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x146e1f[_0x91cb('0x33')],_0x146e1f[_0x91cb('0x34')]);_0x775c25['attributes']=_[_0x91cb('0x36')](_0x146e1f['model'],qs['fields'](_0x445fe1['query'][_0x91cb('0x37')]));_0x775c25['attributes']=_0x775c25[_0x91cb('0x38')]['length']?_0x775c25['attributes']:_0x146e1f[_0x91cb('0x33')];if(!_0x445fe1[_0x91cb('0x34')][_0x91cb('0x39')](_0x91cb('0x3a'))){_0x775c25[_0x91cb('0x1d')]=qs['limit'](_0x445fe1[_0x91cb('0x34')][_0x91cb('0x1d')]);_0x775c25[_0x91cb('0x1f')]=qs[_0x91cb('0x1f')](_0x445fe1['query']['offset']);}_0x775c25[_0x91cb('0x3b')]=qs[_0x91cb('0x3c')](_0x445fe1['query'][_0x91cb('0x3c')]);_0x775c25[_0x91cb('0x3d')]=qs['filters'](_[_0x91cb('0x3e')](_0x445fe1[_0x91cb('0x34')],_0x146e1f['filters']),_0x361e4c);if(_0x445fe1[_0x91cb('0x34')]['filter']){_0x775c25[_0x91cb('0x3d')]=_[_0x91cb('0x3f')](_0x775c25[_0x91cb('0x3d')],{'$or':_[_0x91cb('0x2e')](_0x361e4c,function(_0x51d0ea){if(_0x51d0ea[_0x91cb('0x40')]!=='VIRTUAL'){var _0xa90111={};_0xa90111[_0x51d0ea[_0x91cb('0x2b')]]={'$like':'%'+_0x445fe1['query'][_0x91cb('0x41')]+'%'};return _0xa90111;}})});}_0x775c25=_['merge']({},_0x775c25,_0x445fe1[_0x91cb('0x42')]);var _0x2eac87={'where':_0x775c25[_0x91cb('0x3d')]};return db[_0x91cb('0x2f')]['count'](_0x2eac87)[_0x91cb('0x25')](function(_0x5af0e6){_0x25bbf9[_0x91cb('0x1e')]=_0x5af0e6;if(_0x445fe1[_0x91cb('0x34')][_0x91cb('0x43')]){_0x775c25[_0x91cb('0x44')]=[{'all':!![]}];}return db[_0x91cb('0x2f')][_0x91cb('0x45')](_0x775c25);})[_0x91cb('0x25')](function(_0x3cc4c1){_0x25bbf9['rows']=_0x3cc4c1;return _0x25bbf9;})[_0x91cb('0x25')](respondWithFilteredResult(_0x4944bd,_0x775c25))['catch'](handleError(_0x4944bd,null));};exports[_0x91cb('0x46')]=function(_0x5537a0,_0x335879){var _0x52e82c={'raw':!![],'where':{'id':_0x5537a0[_0x91cb('0x47')]['id']}},_0x138f48={};_0x138f48[_0x91cb('0x33')]=_[_0x91cb('0x48')](db['AnalyticMetric'][_0x91cb('0x30')]);_0x138f48[_0x91cb('0x34')]=_['keys'](_0x5537a0[_0x91cb('0x34')]);_0x138f48[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],_0x138f48[_0x91cb('0x34')]);_0x52e82c[_0x91cb('0x38')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],qs[_0x91cb('0x37')](_0x5537a0['query'][_0x91cb('0x37')]));_0x52e82c[_0x91cb('0x38')]=_0x52e82c[_0x91cb('0x38')][_0x91cb('0x49')]?_0x52e82c[_0x91cb('0x38')]:_0x138f48[_0x91cb('0x33')];if(_0x5537a0[_0x91cb('0x34')][_0x91cb('0x43')]){_0x52e82c['include']=[{'all':!![]}];}_0x52e82c=_[_0x91cb('0x3f')]({},_0x52e82c,_0x5537a0[_0x91cb('0x42')]);return db[_0x91cb('0x2f')][_0x91cb('0x4a')](_0x52e82c)['then'](handleEntityNotFound(_0x335879,null))[_0x91cb('0x25')](respondWithResult(_0x335879,null))[_0x91cb('0x4b')](handleError(_0x335879,null));};exports['create']=function(_0x212473,_0x47cdb7){return db[_0x91cb('0x2f')]['create'](_0x212473['body'],{})['then'](function(_0x98245b){var _0xff3d11=_0x212473[_0x91cb('0x4c')][_0x91cb('0x27')]({'plain':!![]});if(!_0xff3d11)throw new Error(_0x91cb('0x4d'));if(_0xff3d11['role']==='user'){var _0x1d26b8=_0x98245b[_0x91cb('0x27')]({'plain':!![]});var _0x140994=_0x91cb('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x140994,'userProfileId':_0xff3d11['userProfileId']},'raw':!![]})[_0x91cb('0x25')](function(_0x490417){if(_0x490417&&_0x490417[_0x91cb('0x4e')]===0x0){return db['UserProfileResource'][_0x91cb('0x4f')]({'name':_0x1d26b8[_0x91cb('0x2b')],'resourceId':_0x1d26b8['id'],'type':_0x490417[_0x91cb('0x2b')],'sectionId':_0x490417['id']},{})[_0x91cb('0x25')](function(){return _0x98245b;});}else{return _0x98245b;}})[_0x91cb('0x4b')](function(_0x362532){logger[_0x91cb('0x29')](_0x91cb('0x50'),_0x362532);throw _0x362532;});}return _0x98245b;})[_0x91cb('0x25')](respondWithResult(_0x47cdb7,0xc9))[_0x91cb('0x4b')](handleError(_0x47cdb7,null));};exports[_0x91cb('0x24')]=function(_0x5752ed,_0x1e445a){if(_0x5752ed[_0x91cb('0x51')]['id']){delete _0x5752ed['body']['id'];}return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x5752ed['params']['id']}})[_0x91cb('0x25')](handleEntityNotFound(_0x1e445a,null))[_0x91cb('0x25')](saveUpdates(_0x5752ed[_0x91cb('0x51')],null))[_0x91cb('0x25')](respondWithResult(_0x1e445a,null))[_0x91cb('0x4b')](handleError(_0x1e445a,null));};exports[_0x91cb('0x26')]=function(_0x1d4b96,_0x274fff){return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x1d4b96[_0x91cb('0x47')]['id']}})['then'](handleEntityNotFound(_0x274fff,null))[_0x91cb('0x25')](removeEntity(_0x274fff,null))['catch'](handleError(_0x274fff,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index e75505c..6d5a938 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 _0x5a4f=['./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x1f16f9,_0x470806){var _0x513bf3=function(_0x142e64){while(--_0x142e64){_0x1f16f9['push'](_0x1f16f9['shift']());}};_0x513bf3(++_0x470806);}(_0x5a4f,0x10d));var _0xf5a4=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x5a4f[_0x39e84d];return _0x1991bc;};'use strict';var _=require(_0xf5a4('0x0'));var util=require('util');var logger=require(_0xf5a4('0x1'))('api');var moment=require(_0xf5a4('0x2'));var BPromise=require('bluebird');var rp=require(_0xf5a4('0x3'));var fs=require('fs');var path=require(_0xf5a4('0x4'));var rimraf=require(_0xf5a4('0x5'));var config=require(_0xf5a4('0x6'));var attributes=require(_0xf5a4('0x7'));module[_0xf5a4('0x8')]=function(_0x431162,_0x5d2a8c){return _0x431162[_0xf5a4('0x9')](_0xf5a4('0xa'),attributes,{'tableName':_0xf5a4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4819=['analytics_metrics','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','AnalyticMetric'];(function(_0x792ca2,_0x2c3eed){var _0x5f36f0=function(_0x45e0be){while(--_0x45e0be){_0x792ca2['push'](_0x792ca2['shift']());}};_0x5f36f0(++_0x2c3eed);}(_0x4819,0xcd));var _0x9481=function(_0x5466d3,_0x3e47ae){_0x5466d3=_0x5466d3-0x0;var _0x147302=_0x4819[_0x5466d3];return _0x147302;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));module['exports']=function(_0x4d9e3a,_0x5def07){return _0x4d9e3a['define'](_0x9481('0xa'),attributes,{'tableName':_0x9481('0xb'),'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 d52df78..04fb96f 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 _0x9ef1=['message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9ef1,0xbd));var _0x19ef=function(_0x257996,_0x31432b){_0x257996=_0x257996-0x0;var _0x531817=_0x9ef1[_0x257996];return _0x531817;};'use strict';var _=require(_0x19ef('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x19ef('0x1'));var rs=require(_0x19ef('0x2'));var fs=require('fs');var Redis=require(_0x19ef('0x3'));var db=require(_0x19ef('0x4'))['db'];var utils=require(_0x19ef('0x5'));var logger=require(_0x19ef('0x6'))(_0x19ef('0x7'));var config=require('../../config/environment');var jayson=require(_0x19ef('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x598f0a,_0x437b50,_0x377716){return new BPromise(function(_0x34ba14,_0x342168){return client[_0x19ef('0x9')](_0x598f0a,_0x377716)[_0x19ef('0xa')](function(_0x4f6e0a){logger[_0x19ef('0xb')](_0x19ef('0xc'),_0x437b50,_0x19ef('0xd'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x437b50,_0x19ef('0xd'),JSON['stringify'](_0x4f6e0a));if(_0x4f6e0a['error']){if(_0x4f6e0a[_0x19ef('0xe')]['code']===0x1f4){logger[_0x19ef('0xe')](_0x19ef('0xc'),_0x437b50,_0x4f6e0a[_0x19ef('0xe')][_0x19ef('0xf')]);return _0x342168(_0x4f6e0a[_0x19ef('0xe')][_0x19ef('0xf')]);}logger[_0x19ef('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x437b50,_0x4f6e0a['error']['message']);return _0x34ba14(_0x4f6e0a[_0x19ef('0xe')][_0x19ef('0xf')]);}else{logger[_0x19ef('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x437b50,_0x19ef('0xd'));_0x34ba14(_0x4f6e0a[_0x19ef('0x10')][_0x19ef('0xf')]);}})['catch'](function(_0x148191){logger[_0x19ef('0xe')](_0x19ef('0xc'),_0x437b50,_0x148191);_0x342168(_0x148191);});});} \ No newline at end of file +var _0xd354=['request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x31af8c,_0xd4a9a5){var _0x27c46b=function(_0x2e4324){while(--_0x2e4324){_0x31af8c['push'](_0x31af8c['shift']());}};_0x27c46b(++_0xd4a9a5);}(_0xd354,0x1ef));var _0x4d35=function(_0x594a1b,_0xa53172){_0x594a1b=_0x594a1b-0x0;var _0x5f33c9=_0xd354[_0x594a1b];return _0x5f33c9;};'use strict';var _=require(_0x4d35('0x0'));var util=require('util');var moment=require(_0x4d35('0x1'));var BPromise=require(_0x4d35('0x2'));var rs=require(_0x4d35('0x3'));var fs=require('fs');var Redis=require(_0x4d35('0x4'));var db=require(_0x4d35('0x5'))['db'];var utils=require(_0x4d35('0x6'));var logger=require(_0x4d35('0x7'))('rpc');var config=require(_0x4d35('0x8'));var jayson=require(_0x4d35('0x9'));var client=jayson['client'][_0x4d35('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e5196,_0x1097c6,_0x756393){return new BPromise(function(_0x1af103,_0x11ad58){return client[_0x4d35('0xb')](_0x5e5196,_0x756393)[_0x4d35('0xc')](function(_0x41574d){logger['info'](_0x4d35('0xd'),_0x1097c6,_0x4d35('0xe'));logger['debug'](_0x4d35('0xf'),_0x1097c6,'request\x20sent',JSON[_0x4d35('0x10')](_0x41574d));if(_0x41574d[_0x4d35('0x11')]){if(_0x41574d[_0x4d35('0x11')][_0x4d35('0x12')]===0x1f4){logger[_0x4d35('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x1097c6,_0x41574d[_0x4d35('0x11')][_0x4d35('0x13')]);return _0x11ad58(_0x41574d[_0x4d35('0x11')]['message']);}logger[_0x4d35('0x11')](_0x4d35('0xd'),_0x1097c6,_0x41574d[_0x4d35('0x11')][_0x4d35('0x13')]);return _0x1af103(_0x41574d[_0x4d35('0x11')]['message']);}else{logger[_0x4d35('0x14')](_0x4d35('0xd'),_0x1097c6,_0x4d35('0xe'));_0x1af103(_0x41574d[_0x4d35('0x15')][_0x4d35('0x13')]);}})['catch'](function(_0x207370){logger[_0x4d35('0x11')](_0x4d35('0xd'),_0x1097c6,_0x207370);_0x11ad58(_0x207370);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 60fb61f..8bf3d2a 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 _0x34f8=['../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x179d7e,_0x135be3){var _0x272c4d=function(_0x24635f){while(--_0x24635f){_0x179d7e['push'](_0x179d7e['shift']());}};_0x272c4d(++_0x135be3);}(_0x34f8,0x80));var _0x834f=function(_0x380baf,_0x48ef8b){_0x380baf=_0x380baf-0x0;var _0x5812cb=_0x34f8[_0x380baf];return _0x5812cb;};'use strict';var multer=require(_0x834f('0x0'));var util=require(_0x834f('0x1'));var path=require(_0x834f('0x2'));var timeout=require(_0x834f('0x3'));var express=require(_0x834f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x834f('0x5'));var interaction=require(_0x834f('0x6'));var config=require('../../config/environment');var controller=require(_0x834f('0x7'));router[_0x834f('0x8')]('/',auth[_0x834f('0x9')](),controller[_0x834f('0xa')]);router['get']('/:id',auth[_0x834f('0x9')](),controller[_0x834f('0xb')]);router[_0x834f('0xc')]('/',auth[_0x834f('0x9')](),controller['create']);router[_0x834f('0xd')](_0x834f('0xe'),auth['isAuthenticated'](),controller[_0x834f('0xf')]);router[_0x834f('0x10')](_0x834f('0xe'),auth[_0x834f('0x9')](),controller[_0x834f('0x11')]);module[_0x834f('0x12')]=router; \ No newline at end of file +var _0xdb70=['../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','show','post','create','put','update','/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xdb70,0xa0));var _0x0db7=function(_0x4337bd,_0x516be8){_0x4337bd=_0x4337bd-0x0;var _0x5aea5a=_0xdb70[_0x4337bd];return _0x5aea5a;};'use strict';var multer=require(_0x0db7('0x0'));var util=require(_0x0db7('0x1'));var path=require(_0x0db7('0x2'));var timeout=require('connect-timeout');var express=require(_0x0db7('0x3'));var router=express[_0x0db7('0x4')]();var fs_extra=require(_0x0db7('0x5'));var auth=require(_0x0db7('0x6'));var interaction=require(_0x0db7('0x7'));var config=require(_0x0db7('0x8'));var controller=require(_0x0db7('0x9'));router[_0x0db7('0xa')]('/',auth[_0x0db7('0xb')](),controller[_0x0db7('0xc')]);router[_0x0db7('0xa')]('/:id',auth[_0x0db7('0xb')](),controller[_0x0db7('0xd')]);router[_0x0db7('0xe')]('/',auth[_0x0db7('0xb')](),controller[_0x0db7('0xf')]);router[_0x0db7('0x10')]('/:id',auth[_0x0db7('0xb')](),controller[_0x0db7('0x11')]);router['delete'](_0x0db7('0x12'),auth[_0x0db7('0xb')](),controller[_0x0db7('0x13')]);module[_0x0db7('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index c74a5cd..38779fb 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 _0x0601=['exports','TEXT','sequelize'];(function(_0x308c59,_0x2ae2cd){var _0x2e372a=function(_0x5eaf85){while(--_0x5eaf85){_0x308c59['push'](_0x308c59['shift']());}};_0x2e372a(++_0x2ae2cd);}(_0x0601,0x6b));var _0x1060=function(_0x172ed7,_0x3d08fd){_0x172ed7=_0x172ed7-0x0;var _0xfa8f61=_0x0601[_0x172ed7];return _0xfa8f61;};'use strict';var Sequelize=require(_0x1060('0x0'));module[_0x1060('0x1')]={'tree':{'type':Sequelize[_0x1060('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x6015=['TEXT','sequelize','exports'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0x6015,0x145));var _0x5601=function(_0x160b0e,_0x2f1fe9){_0x160b0e=_0x160b0e-0x0;var _0x40ea25=_0x6015[_0x160b0e];return _0x40ea25;};'use strict';var Sequelize=require(_0x5601('0x0'));module[_0x5601('0x1')]={'tree':{'type':Sequelize[_0x5601('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 cff3cc5..ec9e1d9 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 _0xd3ce=['rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','show','params','includeAll','find','catch','create','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','json','undefined','count','offset','set','apply','reject','save','update','then','destroy','error','name','index','map','AnalyticTreeReport'];(function(_0xd4f75c,_0xa2b00){var _0x55844e=function(_0x4b413d){while(--_0x4b413d){_0xd4f75c['push'](_0xd4f75c['shift']());}};_0x55844e(++_0xa2b00);}(_0xd3ce,0xaa));var _0xed3c=function(_0x32eb37,_0x958bf1){_0x32eb37=_0x32eb37-0x0;var _0x16cf63=_0xd3ce[_0x32eb37];return _0x16cf63;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xed3c('0x0'));var zipdir=require(_0xed3c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xed3c('0x2'));var moment=require(_0xed3c('0x3'));var BPromise=require(_0xed3c('0x4'));var Mustache=require(_0xed3c('0x5'));var util=require('util');var path=require(_0xed3c('0x6'));var sox=require(_0xed3c('0x7'));var csv=require(_0xed3c('0x8'));var ejs=require(_0xed3c('0x9'));var fs=require('fs');var fs_extra=require(_0xed3c('0xa'));var _=require(_0xed3c('0xb'));var squel=require(_0xed3c('0xc'));var crypto=require('crypto');var jsforce=require(_0xed3c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xed3c('0xe'));var Papa=require('papaparse');var Redis=require(_0xed3c('0xf'));var authService=require(_0xed3c('0x10'));var qs=require(_0xed3c('0x11'));var as=require(_0xed3c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xed3c('0x13'))('api');var utils=require(_0xed3c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xed3c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17c9a7,_0x264b69){_0x264b69=_0x264b69||0xcc;return function(_0x5998f6){if(_0x5998f6){return _0x17c9a7[_0xed3c('0x16')](_0x264b69);}return _0x17c9a7[_0xed3c('0x17')](_0x264b69)['end']();};}function respondWithResult(_0x4c6ee0,_0x69d8a7){_0x69d8a7=_0x69d8a7||0xc8;return function(_0x9f7136){if(_0x9f7136){return _0x4c6ee0['status'](_0x69d8a7)[_0xed3c('0x18')](_0x9f7136);}};}function respondWithFilteredResult(_0x3e04dd,_0xb1767){return function(_0x245cd7){if(_0x245cd7){var _0x13cc15=typeof _0xb1767['offset']===_0xed3c('0x19')&&typeof _0xb1767['limit']===_0xed3c('0x19');var _0x59e905=_0x245cd7[_0xed3c('0x1a')];var _0x546076=_0x13cc15?0x0:_0xb1767['offset'];var _0x368653=_0x13cc15?_0x245cd7[_0xed3c('0x1a')]:_0xb1767[_0xed3c('0x1b')]+_0xb1767['limit'];var _0x3070d9;if(_0x368653>=_0x59e905){_0x368653=_0x59e905;_0x3070d9=0xc8;}else{_0x3070d9=0xce;}_0x3e04dd[_0xed3c('0x17')](_0x3070d9);return _0x3e04dd[_0xed3c('0x1c')]('Content-Range',_0x546076+'-'+_0x368653+'/'+_0x59e905)[_0xed3c('0x18')](_0x245cd7);}return null;};}function patchUpdates(_0x1dbe7e){return function(_0x5d920d){try{jsonpatch[_0xed3c('0x1d')](_0x5d920d,_0x1dbe7e,!![]);}catch(_0x8cef1d){return BPromise[_0xed3c('0x1e')](_0x8cef1d);}return _0x5d920d[_0xed3c('0x1f')]();};}function saveUpdates(_0x34afd0,_0x1b86ba){return function(_0x4f41a5){if(_0x4f41a5){return _0x4f41a5[_0xed3c('0x20')](_0x34afd0)[_0xed3c('0x21')](function(_0x263ad5){return _0x263ad5;});}return null;};}function removeEntity(_0x222185,_0x3947f6){return function(_0x34ba4e){if(_0x34ba4e){return _0x34ba4e[_0xed3c('0x22')]()[_0xed3c('0x21')](function(){_0x222185[_0xed3c('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2143be,_0x48003b){return function(_0x3b9f52){if(!_0x3b9f52){_0x2143be[_0xed3c('0x16')](0x194);}return _0x3b9f52;};}function handleError(_0x526dda,_0x3ed8d4){_0x3ed8d4=_0x3ed8d4||0x1f4;return function(_0x358e40){logger[_0xed3c('0x23')](_0x358e40['stack']);if(_0x358e40[_0xed3c('0x24')]){delete _0x358e40[_0xed3c('0x24')];}_0x526dda[_0xed3c('0x17')](_0x3ed8d4)['send'](_0x358e40);};}exports[_0xed3c('0x25')]=function(_0x223733,_0x3b4985){var _0x5767af={},_0x2bacbc={},_0x40949f={'count':0x0,'rows':[]};var _0x1f2e0a=_[_0xed3c('0x26')](db[_0xed3c('0x27')][_0xed3c('0x28')],function(_0x535611){return{'name':_0x535611['fieldName'],'type':_0x535611[_0xed3c('0x29')][_0xed3c('0x2a')]};});_0x2bacbc[_0xed3c('0x2b')]=_[_0xed3c('0x26')](_0x1f2e0a,_0xed3c('0x24'));_0x2bacbc['query']=_[_0xed3c('0x2c')](_0x223733[_0xed3c('0x2d')]);_0x2bacbc[_0xed3c('0x2e')]=_[_0xed3c('0x2f')](_0x2bacbc[_0xed3c('0x2b')],_0x2bacbc[_0xed3c('0x2d')]);_0x5767af[_0xed3c('0x30')]=_[_0xed3c('0x2f')](_0x2bacbc['model'],qs[_0xed3c('0x31')](_0x223733[_0xed3c('0x2d')][_0xed3c('0x31')]));_0x5767af[_0xed3c('0x30')]=_0x5767af['attributes'][_0xed3c('0x32')]?_0x5767af[_0xed3c('0x30')]:_0x2bacbc[_0xed3c('0x2b')];if(!_0x223733['query'][_0xed3c('0x33')](_0xed3c('0x34'))){_0x5767af[_0xed3c('0x35')]=qs[_0xed3c('0x35')](_0x223733[_0xed3c('0x2d')][_0xed3c('0x35')]);_0x5767af[_0xed3c('0x1b')]=qs[_0xed3c('0x1b')](_0x223733['query'][_0xed3c('0x1b')]);}_0x5767af['order']=qs[_0xed3c('0x36')](_0x223733['query'][_0xed3c('0x36')]);_0x5767af[_0xed3c('0x37')]=qs[_0xed3c('0x2e')](_[_0xed3c('0x38')](_0x223733[_0xed3c('0x2d')],_0x2bacbc[_0xed3c('0x2e')]),_0x1f2e0a);if(_0x223733[_0xed3c('0x2d')][_0xed3c('0x39')]){_0x5767af['where']=_['merge'](_0x5767af['where'],{'$or':_['map'](_0x1f2e0a,function(_0x117e1a){if(_0x117e1a['type']!==_0xed3c('0x3a')){var _0x4b83e7={};_0x4b83e7[_0x117e1a['name']]={'$like':'%'+_0x223733[_0xed3c('0x2d')]['filter']+'%'};return _0x4b83e7;}})});}_0x5767af=_[_0xed3c('0x3b')]({},_0x5767af,_0x223733[_0xed3c('0x3c')]);var _0x3a96de={'where':_0x5767af['where']};return db['AnalyticTreeReport'][_0xed3c('0x1a')](_0x3a96de)[_0xed3c('0x21')](function(_0x266ab8){_0x40949f['count']=_0x266ab8;if(_0x223733['query']['includeAll']){_0x5767af[_0xed3c('0x3d')]=[{'all':!![]}];}return db[_0xed3c('0x27')][_0xed3c('0x3e')](_0x5767af);})[_0xed3c('0x21')](function(_0x3d68e7){_0x40949f['rows']=_0x3d68e7;return _0x40949f;})[_0xed3c('0x21')](respondWithFilteredResult(_0x3b4985,_0x5767af))['catch'](handleError(_0x3b4985,null));};exports[_0xed3c('0x3f')]=function(_0x4a1036,_0x1f4a5d){var _0x3a81e4={'raw':!![],'where':{'id':_0x4a1036[_0xed3c('0x40')]['id']}},_0x4d0862={};_0x4d0862[_0xed3c('0x2b')]=_[_0xed3c('0x2c')](db[_0xed3c('0x27')]['rawAttributes']);_0x4d0862[_0xed3c('0x2d')]=_[_0xed3c('0x2c')](_0x4a1036[_0xed3c('0x2d')]);_0x4d0862[_0xed3c('0x2e')]=_[_0xed3c('0x2f')](_0x4d0862[_0xed3c('0x2b')],_0x4d0862['query']);_0x3a81e4[_0xed3c('0x30')]=_[_0xed3c('0x2f')](_0x4d0862[_0xed3c('0x2b')],qs[_0xed3c('0x31')](_0x4a1036[_0xed3c('0x2d')][_0xed3c('0x31')]));_0x3a81e4[_0xed3c('0x30')]=_0x3a81e4[_0xed3c('0x30')][_0xed3c('0x32')]?_0x3a81e4['attributes']:_0x4d0862[_0xed3c('0x2b')];if(_0x4a1036[_0xed3c('0x2d')][_0xed3c('0x41')]){_0x3a81e4[_0xed3c('0x3d')]=[{'all':!![]}];}_0x3a81e4=_[_0xed3c('0x3b')]({},_0x3a81e4,_0x4a1036['options']);return db[_0xed3c('0x27')][_0xed3c('0x42')](_0x3a81e4)[_0xed3c('0x21')](handleEntityNotFound(_0x1f4a5d,null))[_0xed3c('0x21')](respondWithResult(_0x1f4a5d,null))[_0xed3c('0x43')](handleError(_0x1f4a5d,null));};exports[_0xed3c('0x44')]=function(_0x396533,_0x5cdc72){return db[_0xed3c('0x27')][_0xed3c('0x44')](_0x396533[_0xed3c('0x45')],{})[_0xed3c('0x21')](respondWithResult(_0x5cdc72,0xc9))[_0xed3c('0x43')](handleError(_0x5cdc72,null));};exports[_0xed3c('0x20')]=function(_0x2dbf4b,_0x436dce){if(_0x2dbf4b[_0xed3c('0x45')]['id']){delete _0x2dbf4b['body']['id'];}return db[_0xed3c('0x27')][_0xed3c('0x42')]({'where':{'id':_0x2dbf4b[_0xed3c('0x40')]['id']}})[_0xed3c('0x21')](handleEntityNotFound(_0x436dce,null))[_0xed3c('0x21')](saveUpdates(_0x2dbf4b['body'],null))['then'](respondWithResult(_0x436dce,null))[_0xed3c('0x43')](handleError(_0x436dce,null));};exports[_0xed3c('0x22')]=function(_0x5aee15,_0x520492){return db[_0xed3c('0x27')][_0xed3c('0x42')]({'where':{'id':_0x5aee15[_0xed3c('0x40')]['id']}})[_0xed3c('0x21')](handleEntityNotFound(_0x520492,null))['then'](removeEntity(_0x520492,null))[_0xed3c('0x43')](handleError(_0x520492,null));}; \ No newline at end of file +var _0x84e0=['bluebird','mustache','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','status','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','length','include','find','update','body','params','eml-format','rimraf','fast-json-patch','moment'];(function(_0x1895b7,_0x21fbc7){var _0x1aecdc=function(_0x44682a){while(--_0x44682a){_0x1895b7['push'](_0x1895b7['shift']());}};_0x1aecdc(++_0x21fbc7);}(_0x84e0,0x15f));var _0x084e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x84e0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x084e('0x0'));var rimraf=require(_0x084e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x084e('0x2'));var rp=require('request-promise');var moment=require(_0x084e('0x3'));var BPromise=require(_0x084e('0x4'));var Mustache=require(_0x084e('0x5'));var util=require('util');var path=require('path');var sox=require(_0x084e('0x6'));var csv=require(_0x084e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x084e('0x8'));var _=require('lodash');var squel=require(_0x084e('0x9'));var crypto=require('crypto');var jsforce=require(_0x084e('0xa'));var deskjs=require(_0x084e('0xb'));var toCsv=require('to-csv');var querystring=require(_0x084e('0xc'));var Papa=require('papaparse');var Redis=require(_0x084e('0xd'));var authService=require(_0x084e('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x084e('0xf'));var hardwareService=require(_0x084e('0x10'));var logger=require(_0x084e('0x11'))('api');var utils=require(_0x084e('0x12'));var config=require(_0x084e('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x526f07,_0x5247ca){_0x5247ca=_0x5247ca||0xcc;return function(_0x4112e8){if(_0x4112e8){return _0x526f07[_0x084e('0x14')](_0x5247ca);}return _0x526f07['status'](_0x5247ca)[_0x084e('0x15')]();};}function respondWithResult(_0x545d73,_0x121a7d){_0x121a7d=_0x121a7d||0xc8;return function(_0xfe20f2){if(_0xfe20f2){return _0x545d73['status'](_0x121a7d)[_0x084e('0x16')](_0xfe20f2);}};}function respondWithFilteredResult(_0x3b21c7,_0x356ef8){return function(_0x3904c1){if(_0x3904c1){var _0x25e59f=typeof _0x356ef8[_0x084e('0x17')]===_0x084e('0x18')&&typeof _0x356ef8[_0x084e('0x19')]===_0x084e('0x18');var _0x474616=_0x3904c1['count'];var _0x374864=_0x25e59f?0x0:_0x356ef8[_0x084e('0x17')];var _0x2eda6f=_0x25e59f?_0x3904c1[_0x084e('0x1a')]:_0x356ef8[_0x084e('0x17')]+_0x356ef8[_0x084e('0x19')];var _0x25fc4e;if(_0x2eda6f>=_0x474616){_0x2eda6f=_0x474616;_0x25fc4e=0xc8;}else{_0x25fc4e=0xce;}_0x3b21c7['status'](_0x25fc4e);return _0x3b21c7[_0x084e('0x1b')](_0x084e('0x1c'),_0x374864+'-'+_0x2eda6f+'/'+_0x474616)[_0x084e('0x16')](_0x3904c1);}return null;};}function patchUpdates(_0x4e097c){return function(_0x559cd4){try{jsonpatch[_0x084e('0x1d')](_0x559cd4,_0x4e097c,!![]);}catch(_0x418db1){return BPromise['reject'](_0x418db1);}return _0x559cd4[_0x084e('0x1e')]();};}function saveUpdates(_0x477381,_0x3cfb25){return function(_0x5ef82d){if(_0x5ef82d){return _0x5ef82d['update'](_0x477381)[_0x084e('0x1f')](function(_0x1f3179){return _0x1f3179;});}return null;};}function removeEntity(_0x385b17,_0x3a8226){return function(_0x159750){if(_0x159750){return _0x159750[_0x084e('0x20')]()[_0x084e('0x1f')](function(){_0x385b17['status'](0xcc)[_0x084e('0x15')]();});}};}function handleEntityNotFound(_0x3ab296,_0x49c2fd){return function(_0x14b057){if(!_0x14b057){_0x3ab296['sendStatus'](0x194);}return _0x14b057;};}function handleError(_0x12895e,_0x44639f){_0x44639f=_0x44639f||0x1f4;return function(_0x48737c){logger[_0x084e('0x21')](_0x48737c[_0x084e('0x22')]);if(_0x48737c[_0x084e('0x23')]){delete _0x48737c[_0x084e('0x23')];}_0x12895e[_0x084e('0x24')](_0x44639f)[_0x084e('0x25')](_0x48737c);};}exports[_0x084e('0x26')]=function(_0x25fbbb,_0x5bc709){var _0x3a1679={},_0x1917d8={},_0x166a7a={'count':0x0,'rows':[]};var _0x4c7cb0=_[_0x084e('0x27')](db[_0x084e('0x28')][_0x084e('0x29')],function(_0x377e23){return{'name':_0x377e23[_0x084e('0x2a')],'type':_0x377e23[_0x084e('0x2b')][_0x084e('0x2c')]};});_0x1917d8['model']=_[_0x084e('0x27')](_0x4c7cb0,_0x084e('0x23'));_0x1917d8[_0x084e('0x2d')]=_[_0x084e('0x2e')](_0x25fbbb[_0x084e('0x2d')]);_0x1917d8[_0x084e('0x2f')]=_[_0x084e('0x30')](_0x1917d8[_0x084e('0x31')],_0x1917d8[_0x084e('0x2d')]);_0x3a1679['attributes']=_[_0x084e('0x30')](_0x1917d8['model'],qs[_0x084e('0x32')](_0x25fbbb['query'][_0x084e('0x32')]));_0x3a1679[_0x084e('0x33')]=_0x3a1679['attributes']['length']?_0x3a1679['attributes']:_0x1917d8['model'];if(!_0x25fbbb['query'][_0x084e('0x34')](_0x084e('0x35'))){_0x3a1679[_0x084e('0x19')]=qs[_0x084e('0x19')](_0x25fbbb[_0x084e('0x2d')][_0x084e('0x19')]);_0x3a1679[_0x084e('0x17')]=qs[_0x084e('0x17')](_0x25fbbb[_0x084e('0x2d')][_0x084e('0x17')]);}_0x3a1679['order']=qs[_0x084e('0x36')](_0x25fbbb['query']['sort']);_0x3a1679[_0x084e('0x37')]=qs[_0x084e('0x2f')](_[_0x084e('0x38')](_0x25fbbb['query'],_0x1917d8[_0x084e('0x2f')]),_0x4c7cb0);if(_0x25fbbb['query'][_0x084e('0x39')]){_0x3a1679[_0x084e('0x37')]=_[_0x084e('0x3a')](_0x3a1679[_0x084e('0x37')],{'$or':_[_0x084e('0x27')](_0x4c7cb0,function(_0x4125f2){if(_0x4125f2[_0x084e('0x2b')]!=='VIRTUAL'){var _0x5d656d={};_0x5d656d[_0x4125f2[_0x084e('0x23')]]={'$like':'%'+_0x25fbbb['query']['filter']+'%'};return _0x5d656d;}})});}_0x3a1679=_[_0x084e('0x3a')]({},_0x3a1679,_0x25fbbb[_0x084e('0x3b')]);var _0x5d0fd1={'where':_0x3a1679[_0x084e('0x37')]};return db['AnalyticTreeReport'][_0x084e('0x1a')](_0x5d0fd1)[_0x084e('0x1f')](function(_0x1552ca){_0x166a7a[_0x084e('0x1a')]=_0x1552ca;if(_0x25fbbb[_0x084e('0x2d')][_0x084e('0x3c')]){_0x3a1679['include']=[{'all':!![]}];}return db[_0x084e('0x28')][_0x084e('0x3d')](_0x3a1679);})[_0x084e('0x1f')](function(_0x1c9107){_0x166a7a[_0x084e('0x3e')]=_0x1c9107;return _0x166a7a;})[_0x084e('0x1f')](respondWithFilteredResult(_0x5bc709,_0x3a1679))[_0x084e('0x3f')](handleError(_0x5bc709,null));};exports[_0x084e('0x40')]=function(_0x103ab7,_0x745bc2){var _0xa588f={'raw':!![],'where':{'id':_0x103ab7['params']['id']}},_0x26da83={};_0x26da83[_0x084e('0x31')]=_['keys'](db[_0x084e('0x28')]['rawAttributes']);_0x26da83['query']=_[_0x084e('0x2e')](_0x103ab7['query']);_0x26da83[_0x084e('0x2f')]=_[_0x084e('0x30')](_0x26da83[_0x084e('0x31')],_0x26da83['query']);_0xa588f[_0x084e('0x33')]=_[_0x084e('0x30')](_0x26da83[_0x084e('0x31')],qs[_0x084e('0x32')](_0x103ab7[_0x084e('0x2d')][_0x084e('0x32')]));_0xa588f[_0x084e('0x33')]=_0xa588f[_0x084e('0x33')][_0x084e('0x41')]?_0xa588f[_0x084e('0x33')]:_0x26da83[_0x084e('0x31')];if(_0x103ab7[_0x084e('0x2d')][_0x084e('0x3c')]){_0xa588f[_0x084e('0x42')]=[{'all':!![]}];}_0xa588f=_[_0x084e('0x3a')]({},_0xa588f,_0x103ab7['options']);return db[_0x084e('0x28')][_0x084e('0x43')](_0xa588f)['then'](handleEntityNotFound(_0x745bc2,null))[_0x084e('0x1f')](respondWithResult(_0x745bc2,null))[_0x084e('0x3f')](handleError(_0x745bc2,null));};exports['create']=function(_0x3ce72b,_0x171377){return db[_0x084e('0x28')]['create'](_0x3ce72b['body'],{})['then'](respondWithResult(_0x171377,0xc9))[_0x084e('0x3f')](handleError(_0x171377,null));};exports[_0x084e('0x44')]=function(_0x208c9f,_0x15220a){if(_0x208c9f[_0x084e('0x45')]['id']){delete _0x208c9f[_0x084e('0x45')]['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x208c9f[_0x084e('0x46')]['id']}})[_0x084e('0x1f')](handleEntityNotFound(_0x15220a,null))['then'](saveUpdates(_0x208c9f[_0x084e('0x45')],null))[_0x084e('0x1f')](respondWithResult(_0x15220a,null))['catch'](handleError(_0x15220a,null));};exports[_0x084e('0x20')]=function(_0x4fceff,_0x580f93){return db['AnalyticTreeReport'][_0x084e('0x43')]({'where':{'id':_0x4fceff[_0x084e('0x46')]['id']}})[_0x084e('0x1f')](handleEntityNotFound(_0x580f93,null))[_0x084e('0x1f')](removeEntity(_0x580f93,null))[_0x084e('0x3f')](handleError(_0x580f93,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 44e75ef..8e67b71 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 _0x7b3b=['../../config/environment','define','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xbac2,_0x2d93f2){var _0x1c62a0=function(_0x1285e2){while(--_0x1285e2){_0xbac2['push'](_0xbac2['shift']());}};_0x1c62a0(++_0x2d93f2);}(_0x7b3b,0xe7));var _0xb7b3=function(_0x4f29fc,_0x17c58a){_0x4f29fc=_0x4f29fc-0x0;var _0x119cc8=_0x7b3b[_0x4f29fc];return _0x119cc8;};'use strict';var _=require(_0xb7b3('0x0'));var util=require(_0xb7b3('0x1'));var logger=require(_0xb7b3('0x2'))(_0xb7b3('0x3'));var moment=require(_0xb7b3('0x4'));var BPromise=require(_0xb7b3('0x5'));var rp=require(_0xb7b3('0x6'));var fs=require('fs');var path=require(_0xb7b3('0x7'));var rimraf=require(_0xb7b3('0x8'));var config=require(_0xb7b3('0x9'));var attributes=require('./analyticTreeReport.attributes');module['exports']=function(_0x23ccc7,_0x3f59fc){return _0x23ccc7[_0xb7b3('0xa')]('AnalyticTreeReport',attributes,{'tableName':_0xb7b3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa2a3=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./analyticTreeReport.attributes','define','lodash'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa2a3,0xaa));var _0x3a2a=function(_0x5b6375,_0x563718){_0x5b6375=_0x5b6375-0x0;var _0x4045b4=_0xa2a3[_0x5b6375];return _0x4045b4;};'use strict';var _=require(_0x3a2a('0x0'));var util=require('util');var logger=require(_0x3a2a('0x1'))(_0x3a2a('0x2'));var moment=require('moment');var BPromise=require(_0x3a2a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3a2a('0x4'));var rimraf=require(_0x3a2a('0x5'));var config=require(_0x3a2a('0x6'));var attributes=require(_0x3a2a('0x7'));module['exports']=function(_0x533b35,_0x5e6518){return _0x533b35[_0x3a2a('0x8')]('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 90077a3..9186bec 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x317c75,_0x19b216){var _0x168564=function(_0x4ccfb5){while(--_0x4ccfb5){_0x317c75['push'](_0x317c75['shift']());}};_0x168564(++_0x19b216);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xc4aa[_0x1969a7];return _0x3d665f;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x381406,_0x345d99){var _0x1569d5=function(_0x1047e4){while(--_0x1047e4){_0x381406['push'](_0x381406['shift']());}};_0x1569d5(++_0x345d99);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5a1214,_0x420421){_0x5a1214=_0x5a1214-0x0;var _0x5bfeb8=_0x5f2f[_0x5a1214];return _0x5bfeb8;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index b4dd0f0..1dc6372 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 _0xe703=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','get','/:id','isAuthenticated','create','put','update','delete','destroy','multer','connect-timeout'];(function(_0x1a0ae6,_0x42a00f){var _0x221760=function(_0xf573aa){while(--_0xf573aa){_0x1a0ae6['push'](_0x1a0ae6['shift']());}};_0x221760(++_0x42a00f);}(_0xe703,0x139));var _0x3e70=function(_0xaf29da,_0x117f5a){_0xaf29da=_0xaf29da-0x0;var _0x295c51=_0xe703[_0xaf29da];return _0x295c51;};'use strict';var multer=require(_0x3e70('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3e70('0x1'));var express=require('express');var router=express[_0x3e70('0x2')]();var fs_extra=require(_0x3e70('0x3'));var auth=require(_0x3e70('0x4'));var interaction=require(_0x3e70('0x5'));var config=require('../../config/environment');var controller=require(_0x3e70('0x6'));router[_0x3e70('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3e70('0x8'),auth[_0x3e70('0x9')](),controller['show']);router['post']('/',auth[_0x3e70('0x9')](),controller[_0x3e70('0xa')]);router[_0x3e70('0xb')](_0x3e70('0x8'),auth['isAuthenticated'](),controller[_0x3e70('0xc')]);router[_0x3e70('0xd')](_0x3e70('0x8'),auth[_0x3e70('0x9')](),controller[_0x3e70('0xe')]);module['exports']=router; \ No newline at end of file +var _0xa554=['isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get'];(function(_0x571bd9,_0xb84218){var _0x80b4cf=function(_0x420c2c){while(--_0x420c2c){_0x571bd9['push'](_0x571bd9['shift']());}};_0x80b4cf(++_0xb84218);}(_0xa554,0x171));var _0x4a55=function(_0x3d33da,_0x478c43){_0x3d33da=_0x3d33da-0x0;var _0x3af428=_0xa554[_0x3d33da];return _0x3af428;};'use strict';var multer=require('multer');var util=require(_0x4a55('0x0'));var path=require(_0x4a55('0x1'));var timeout=require(_0x4a55('0x2'));var express=require(_0x4a55('0x3'));var router=express[_0x4a55('0x4')]();var fs_extra=require(_0x4a55('0x5'));var auth=require(_0x4a55('0x6'));var interaction=require(_0x4a55('0x7'));var config=require(_0x4a55('0x8'));var controller=require(_0x4a55('0x9'));router[_0x4a55('0xa')]('/',auth[_0x4a55('0xb')](),controller['index']);router[_0x4a55('0xa')](_0x4a55('0xc'),auth[_0x4a55('0xb')](),controller[_0x4a55('0xd')]);router[_0x4a55('0xe')]('/',auth[_0x4a55('0xb')](),controller[_0x4a55('0xf')]);router['put'](_0x4a55('0xc'),auth[_0x4a55('0xb')](),controller[_0x4a55('0x10')]);router[_0x4a55('0x11')](_0x4a55('0xc'),auth[_0x4a55('0xb')](),controller[_0x4a55('0x12')]);module[_0x4a55('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 01c73df..5ce2761 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 _0x6e12=['STRING','sequelize','exports'];(function(_0x3d762b,_0x4c2714){var _0x36d99b=function(_0x3ce04b){while(--_0x3ce04b){_0x3d762b['push'](_0x3d762b['shift']());}};_0x36d99b(++_0x4c2714);}(_0x6e12,0x154));var _0x26e1=function(_0x162829,_0x2f1ec2){_0x162829=_0x162829-0x0;var _0x6d1bdc=_0x6e12[_0x162829];return _0x6d1bdc;};'use strict';var Sequelize=require(_0x26e1('0x0'));module[_0x26e1('0x1')]={'name':{'type':Sequelize[_0x26e1('0x2')]},'basename':{'type':Sequelize[_0x26e1('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2904=['exports','STRING','sequelize'];(function(_0x2a9893,_0x3774d5){var _0x23a0a8=function(_0x1a6f46){while(--_0x1a6f46){_0x2a9893['push'](_0x2a9893['shift']());}};_0x23a0a8(++_0x3774d5);}(_0x2904,0x137));var _0x4290=function(_0x9a9259,_0x383fd2){_0x9a9259=_0x9a9259-0x0;var _0x60f9c0=_0x2904[_0x9a9259];return _0x60f9c0;};'use strict';var Sequelize=require(_0x4290('0x0'));module[_0x4290('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x4290('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 3299da7..2c7eae9 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 _0x48f7=['rows','catch','show','options','find','clone','rawAttributes','get','omit','createdAt','updatedAt','body','create','params','originalname','basename','file','mimetype','findOne','join','root','server/files/attachments/','offline-chat/','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','send','index','map','Attachment','type','key','name','query','keys','filters','intersection','model','fields','attributes','length','nolimit','limit','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x48f7,0x6f));var _0x748f=function(_0x5411f8,_0x5335e3){_0x5411f8=_0x5411f8-0x0;var _0x5f003e=_0x48f7[_0x5411f8];return _0x5f003e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x748f('0x0'));var zipdir=require(_0x748f('0x1'));var jsonpatch=require(_0x748f('0x2'));var rp=require(_0x748f('0x3'));var moment=require('moment');var BPromise=require(_0x748f('0x4'));var Mustache=require(_0x748f('0x5'));var util=require(_0x748f('0x6'));var path=require(_0x748f('0x7'));var sox=require(_0x748f('0x8'));var csv=require(_0x748f('0x9'));var ejs=require(_0x748f('0xa'));var fs=require('fs');var fs_extra=require(_0x748f('0xb'));var _=require(_0x748f('0xc'));var squel=require(_0x748f('0xd'));var crypto=require(_0x748f('0xe'));var jsforce=require(_0x748f('0xf'));var deskjs=require(_0x748f('0x10'));var toCsv=require(_0x748f('0x9'));var querystring=require(_0x748f('0x11'));var Papa=require(_0x748f('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x748f('0x13'));var as=require(_0x748f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x748f('0x15'))(_0x748f('0x16'));var utils=require(_0x748f('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x748f('0x18'))['db'];function respondWithStatusCode(_0x96763d,_0x1ce535){_0x1ce535=_0x1ce535||0xcc;return function(_0x580008){if(_0x580008){return _0x96763d['sendStatus'](_0x1ce535);}return _0x96763d[_0x748f('0x19')](_0x1ce535)[_0x748f('0x1a')]();};}function respondWithResult(_0x4a208d,_0x1cb870){_0x1cb870=_0x1cb870||0xc8;return function(_0x5b7294){if(_0x5b7294){return _0x4a208d['status'](_0x1cb870)[_0x748f('0x1b')](_0x5b7294);}};}function respondWithFilteredResult(_0x46cf55,_0x49afa3){return function(_0x5660ed){if(_0x5660ed){var _0x45f9c1=typeof _0x49afa3[_0x748f('0x1c')]===_0x748f('0x1d')&&typeof _0x49afa3['limit']===_0x748f('0x1d');var _0x281b6a=_0x5660ed['count'];var _0x51cdb3=_0x45f9c1?0x0:_0x49afa3[_0x748f('0x1c')];var _0x3e27fd=_0x45f9c1?_0x5660ed[_0x748f('0x1e')]:_0x49afa3['offset']+_0x49afa3['limit'];var _0x99ac7c;if(_0x3e27fd>=_0x281b6a){_0x3e27fd=_0x281b6a;_0x99ac7c=0xc8;}else{_0x99ac7c=0xce;}_0x46cf55['status'](_0x99ac7c);return _0x46cf55[_0x748f('0x1f')](_0x748f('0x20'),_0x51cdb3+'-'+_0x3e27fd+'/'+_0x281b6a)['json'](_0x5660ed);}return null;};}function patchUpdates(_0x20661a){return function(_0x1e7e64){try{jsonpatch[_0x748f('0x21')](_0x1e7e64,_0x20661a,!![]);}catch(_0x1d06c4){return BPromise[_0x748f('0x22')](_0x1d06c4);}return _0x1e7e64[_0x748f('0x23')]();};}function saveUpdates(_0x1b0dde,_0x27427d){return function(_0x87a8e9){if(_0x87a8e9){return _0x87a8e9[_0x748f('0x24')](_0x1b0dde)[_0x748f('0x25')](function(_0xb797c0){return _0xb797c0;});}return null;};}function removeEntity(_0x3a2d5d,_0x50b86b){return function(_0x4029b7){if(_0x4029b7){return _0x4029b7[_0x748f('0x26')]()[_0x748f('0x25')](function(){_0x3a2d5d['status'](0xcc)[_0x748f('0x1a')]();});}};}function handleEntityNotFound(_0x1ef832,_0x4a3d01){return function(_0x39a586){if(!_0x39a586){_0x1ef832[_0x748f('0x27')](0x194);}return _0x39a586;};}function handleError(_0x2565b4,_0x16bdde){_0x16bdde=_0x16bdde||0x1f4;return function(_0x1507ad){logger['error'](_0x1507ad['stack']);if(_0x1507ad['name']){delete _0x1507ad['name'];}_0x2565b4[_0x748f('0x19')](_0x16bdde)[_0x748f('0x28')](_0x1507ad);};}exports[_0x748f('0x29')]=function(_0x53e9a0,_0x39c18e){var _0x5b13ad={},_0x3762e1={},_0x5b2368={'count':0x0,'rows':[]};var _0x22aa7b=_[_0x748f('0x2a')](db[_0x748f('0x2b')]['rawAttributes'],function(_0x52ff95){return{'name':_0x52ff95['fieldName'],'type':_0x52ff95[_0x748f('0x2c')][_0x748f('0x2d')]};});_0x3762e1['model']=_[_0x748f('0x2a')](_0x22aa7b,_0x748f('0x2e'));_0x3762e1[_0x748f('0x2f')]=_[_0x748f('0x30')](_0x53e9a0[_0x748f('0x2f')]);_0x3762e1[_0x748f('0x31')]=_['intersection'](_0x3762e1['model'],_0x3762e1[_0x748f('0x2f')]);_0x5b13ad['attributes']=_[_0x748f('0x32')](_0x3762e1[_0x748f('0x33')],qs[_0x748f('0x34')](_0x53e9a0[_0x748f('0x2f')][_0x748f('0x34')]));_0x5b13ad[_0x748f('0x35')]=_0x5b13ad['attributes'][_0x748f('0x36')]?_0x5b13ad[_0x748f('0x35')]:_0x3762e1[_0x748f('0x33')];if(!_0x53e9a0[_0x748f('0x2f')]['hasOwnProperty'](_0x748f('0x37'))){_0x5b13ad[_0x748f('0x38')]=qs['limit'](_0x53e9a0[_0x748f('0x2f')]['limit']);_0x5b13ad[_0x748f('0x1c')]=qs[_0x748f('0x1c')](_0x53e9a0['query'][_0x748f('0x1c')]);}_0x5b13ad['order']=qs[_0x748f('0x39')](_0x53e9a0[_0x748f('0x2f')][_0x748f('0x39')]);_0x5b13ad[_0x748f('0x3a')]=qs[_0x748f('0x31')](_[_0x748f('0x3b')](_0x53e9a0[_0x748f('0x2f')],_0x3762e1[_0x748f('0x31')]),_0x22aa7b);if(_0x53e9a0[_0x748f('0x2f')]['filter']){_0x5b13ad['where']=_[_0x748f('0x3c')](_0x5b13ad[_0x748f('0x3a')],{'$or':_[_0x748f('0x2a')](_0x22aa7b,function(_0xca48be){if(_0xca48be['type']!==_0x748f('0x3d')){var _0x5e378d={};_0x5e378d[_0xca48be[_0x748f('0x2e')]]={'$like':'%'+_0x53e9a0[_0x748f('0x2f')]['filter']+'%'};return _0x5e378d;}})});}_0x5b13ad=_['merge']({},_0x5b13ad,_0x53e9a0['options']);var _0x203ff9={'where':_0x5b13ad[_0x748f('0x3a')]};return db[_0x748f('0x2b')][_0x748f('0x1e')](_0x203ff9)['then'](function(_0x39dc2c){_0x5b2368['count']=_0x39dc2c;if(_0x53e9a0[_0x748f('0x2f')][_0x748f('0x3e')]){_0x5b13ad[_0x748f('0x3f')]=[{'all':!![]}];}return db[_0x748f('0x2b')][_0x748f('0x40')](_0x5b13ad);})[_0x748f('0x25')](function(_0x478501){_0x5b2368[_0x748f('0x41')]=_0x478501;return _0x5b2368;})[_0x748f('0x25')](respondWithFilteredResult(_0x39c18e,_0x5b13ad))[_0x748f('0x42')](handleError(_0x39c18e,null));};exports[_0x748f('0x43')]=function(_0x2eb8aa,_0x52c573){var _0x5c4e99={'raw':!![],'where':{'id':_0x2eb8aa['params']['id']}},_0x17df5d={};_0x17df5d[_0x748f('0x33')]=_['keys'](db['Attachment']['rawAttributes']);_0x17df5d[_0x748f('0x2f')]=_[_0x748f('0x30')](_0x2eb8aa[_0x748f('0x2f')]);_0x17df5d[_0x748f('0x31')]=_[_0x748f('0x32')](_0x17df5d[_0x748f('0x33')],_0x17df5d[_0x748f('0x2f')]);_0x5c4e99['attributes']=_[_0x748f('0x32')](_0x17df5d[_0x748f('0x33')],qs[_0x748f('0x34')](_0x2eb8aa[_0x748f('0x2f')][_0x748f('0x34')]));_0x5c4e99[_0x748f('0x35')]=_0x5c4e99[_0x748f('0x35')][_0x748f('0x36')]?_0x5c4e99[_0x748f('0x35')]:_0x17df5d[_0x748f('0x33')];if(_0x2eb8aa[_0x748f('0x2f')][_0x748f('0x3e')]){_0x5c4e99['include']=[{'all':!![]}];}_0x5c4e99=_['merge']({},_0x5c4e99,_0x2eb8aa[_0x748f('0x44')]);return db[_0x748f('0x2b')][_0x748f('0x45')](_0x5c4e99)['then'](handleEntityNotFound(_0x52c573,null))[_0x748f('0x25')](respondWithResult(_0x52c573,null))[_0x748f('0x42')](handleError(_0x52c573,null));};exports[_0x748f('0x46')]=function(_0x4005c9,_0x5c1eee){var _0x544b93={'where':{'id':_0x4005c9['params']['id']}},_0x7f42be={};_0x7f42be['model']=_[_0x748f('0x30')](db[_0x748f('0x2b')][_0x748f('0x47')]);_0x544b93[_0x748f('0x35')]=_[_0x748f('0x32')](_0x7f42be[_0x748f('0x33')],qs[_0x748f('0x34')](_0x4005c9[_0x748f('0x2f')][_0x748f('0x34')]));_0x544b93['attributes']=_0x544b93[_0x748f('0x35')][_0x748f('0x36')]?_0x544b93[_0x748f('0x35')]:_0x7f42be[_0x748f('0x33')];if(_0x4005c9[_0x748f('0x2f')][_0x748f('0x3e')]){_0x544b93['include']=[{'all':!![]}];}_0x544b93=_[_0x748f('0x3c')]({},_0x544b93,_0x4005c9['options']);return db[_0x748f('0x2b')][_0x748f('0x45')](_0x544b93)['then'](handleEntityNotFound(_0x5c1eee,null))['then'](function(_0x3ed9d8){if(_0x3ed9d8){var _0x4ffbd2=_0x3ed9d8[_0x748f('0x48')]({'plain':!![]});_0x4ffbd2=qs[_0x748f('0x49')](_0x4ffbd2,['id',_0x748f('0x4a'),_0x748f('0x4b')]);_0x4005c9[_0x748f('0x4c')]=_[_0x748f('0x49')](_0x4005c9[_0x748f('0x4c')],['id',_0x748f('0x4a'),_0x748f('0x4b')]);return db[_0x748f('0x2b')][_0x748f('0x4d')](_[_0x748f('0x3c')](_0x4ffbd2,_0x4005c9[_0x748f('0x4c')]),{'include':_0x4005c9[_0x748f('0x2f')][_0x748f('0x3e')]?[{'all':!![]}]:undefined});}})[_0x748f('0x25')](respondWithResult(_0x5c1eee,0xc9))[_0x748f('0x42')](handleError(_0x5c1eee,null));};exports[_0x748f('0x24')]=function(_0x28eb9d,_0x376404){if(_0x28eb9d['body']['id']){delete _0x28eb9d[_0x748f('0x4c')]['id'];}return db['Attachment'][_0x748f('0x45')]({'where':{'id':_0x28eb9d[_0x748f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x376404,null))[_0x748f('0x25')](saveUpdates(_0x28eb9d[_0x748f('0x4c')],null))[_0x748f('0x25')](respondWithResult(_0x376404,null))[_0x748f('0x42')](handleError(_0x376404,null));};exports[_0x748f('0x26')]=function(_0x296737,_0xd9f2e){return db[_0x748f('0x2b')][_0x748f('0x45')]({'where':{'id':_0x296737['params']['id']}})[_0x748f('0x25')](handleEntityNotFound(_0xd9f2e,null))[_0x748f('0x25')](removeEntity(_0xd9f2e,null))['catch'](handleError(_0xd9f2e,null));};exports[_0x748f('0x4d')]=function(_0x57ca71,_0x41152f,_0x196fee){_0x57ca71[_0x748f('0x4c')][_0x748f('0x2e')]=_0x57ca71['file'][_0x748f('0x4f')];_0x57ca71['body'][_0x748f('0x50')]=_0x57ca71[_0x748f('0x51')]['filename'];_0x57ca71[_0x748f('0x4c')][_0x748f('0x2c')]=_0x57ca71[_0x748f('0x51')][_0x748f('0x52')];return db[_0x748f('0x2b')][_0x748f('0x4d')](_0x57ca71['body'])[_0x748f('0x25')](respondWithResult(_0x41152f,0xc9))[_0x748f('0x42')](handleError(_0x41152f,null));};exports['download']=function(_0x5a19db,_0x1f9b81,_0x4c288f){return db[_0x748f('0x2b')][_0x748f('0x53')]({'where':{'id':_0x5a19db[_0x748f('0x4e')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x1f9b81,null))[_0x748f('0x25')](function(_0x4a703b){if(_0x4a703b){var _0xf75a5b=_0x4a703b['ChatOfflineMessageId']!==null;var _0x336dbd=path[_0x748f('0x54')](config[_0x748f('0x55')],_0x748f('0x56'));if(_0xf75a5b){_0x336dbd=path['join'](_0x336dbd,_0x748f('0x57'));}var _0x189eab=path['join'](_0x336dbd,_0x4a703b[_0x748f('0x50')]);return _0x1f9b81['download'](_0x189eab);}})[_0x748f('0x42')](handleError(_0x1f9b81,null));}; \ No newline at end of file +var _0xa798=['ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','rawAttributes','type','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','where','VIRTUAL','filter','options','include','Attachment','findAll','rows','catch','params','keys','includeAll','merge','clone','find','get','omit','updatedAt','body','createdAt','create','basename','file','filename','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','to-csv'];(function(_0x506a86,_0x41e1c9){var _0x5e1960=function(_0xbc7559){while(--_0xbc7559){_0x506a86['push'](_0x506a86['shift']());}};_0x5e1960(++_0x41e1c9);}(_0xa798,0xa5));var _0x8a79=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa798[_0x2160a9];return _0xa88cf7;};'use strict';var emlformat=require(_0x8a79('0x0'));var rimraf=require(_0x8a79('0x1'));var zipdir=require(_0x8a79('0x2'));var jsonpatch=require(_0x8a79('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8a79('0x4'));var Mustache=require('mustache');var util=require(_0x8a79('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x8a79('0x6'));var ejs=require(_0x8a79('0x7'));var fs=require('fs');var fs_extra=require(_0x8a79('0x8'));var _=require('lodash');var squel=require(_0x8a79('0x9'));var crypto=require(_0x8a79('0xa'));var jsforce=require(_0x8a79('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8a79('0xc'));var Papa=require(_0x8a79('0xd'));var Redis=require(_0x8a79('0xe'));var authService=require(_0x8a79('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a79('0x10'));var logger=require(_0x8a79('0x11'))(_0x8a79('0x12'));var utils=require(_0x8a79('0x13'));var config=require(_0x8a79('0x14'));var licenseUtil=require(_0x8a79('0x15'));var db=require(_0x8a79('0x16'))['db'];function respondWithStatusCode(_0x2c05f0,_0x506c8b){_0x506c8b=_0x506c8b||0xcc;return function(_0x5adbc6){if(_0x5adbc6){return _0x2c05f0[_0x8a79('0x17')](_0x506c8b);}return _0x2c05f0[_0x8a79('0x18')](_0x506c8b)[_0x8a79('0x19')]();};}function respondWithResult(_0x5b10f,_0x4c666a){_0x4c666a=_0x4c666a||0xc8;return function(_0x27388d){if(_0x27388d){return _0x5b10f[_0x8a79('0x18')](_0x4c666a)[_0x8a79('0x1a')](_0x27388d);}};}function respondWithFilteredResult(_0x23e82a,_0x2aa46f){return function(_0x409aac){if(_0x409aac){var _0x516b73=typeof _0x2aa46f['offset']===_0x8a79('0x1b')&&typeof _0x2aa46f[_0x8a79('0x1c')]===_0x8a79('0x1b');var _0x4c9931=_0x409aac[_0x8a79('0x1d')];var _0x4adbc7=_0x516b73?0x0:_0x2aa46f['offset'];var _0x27cd86=_0x516b73?_0x409aac[_0x8a79('0x1d')]:_0x2aa46f[_0x8a79('0x1e')]+_0x2aa46f['limit'];var _0x59256c;if(_0x27cd86>=_0x4c9931){_0x27cd86=_0x4c9931;_0x59256c=0xc8;}else{_0x59256c=0xce;}_0x23e82a[_0x8a79('0x18')](_0x59256c);return _0x23e82a['set'](_0x8a79('0x1f'),_0x4adbc7+'-'+_0x27cd86+'/'+_0x4c9931)[_0x8a79('0x1a')](_0x409aac);}return null;};}function patchUpdates(_0x2dba16){return function(_0x33d221){try{jsonpatch[_0x8a79('0x20')](_0x33d221,_0x2dba16,!![]);}catch(_0x1f675c){return BPromise[_0x8a79('0x21')](_0x1f675c);}return _0x33d221['save']();};}function saveUpdates(_0x2749b5,_0x3f97cc){return function(_0x3a571a){if(_0x3a571a){return _0x3a571a[_0x8a79('0x22')](_0x2749b5)[_0x8a79('0x23')](function(_0xd29278){return _0xd29278;});}return null;};}function removeEntity(_0x3b5210,_0x12009b){return function(_0x5c86dc){if(_0x5c86dc){return _0x5c86dc[_0x8a79('0x24')]()[_0x8a79('0x23')](function(){_0x3b5210[_0x8a79('0x18')](0xcc)[_0x8a79('0x19')]();});}};}function handleEntityNotFound(_0x2bae5c,_0x14e063){return function(_0x3246bf){if(!_0x3246bf){_0x2bae5c[_0x8a79('0x17')](0x194);}return _0x3246bf;};}function handleError(_0x2f7a54,_0x56b83d){_0x56b83d=_0x56b83d||0x1f4;return function(_0x42f068){logger[_0x8a79('0x25')](_0x42f068['stack']);if(_0x42f068[_0x8a79('0x26')]){delete _0x42f068[_0x8a79('0x26')];}_0x2f7a54[_0x8a79('0x18')](_0x56b83d)[_0x8a79('0x27')](_0x42f068);};}exports[_0x8a79('0x28')]=function(_0x54994f,_0x9b70c9){var _0x3a253d={},_0x4a5e95={},_0x39adf3={'count':0x0,'rows':[]};var _0x4d107a=_[_0x8a79('0x29')](db['Attachment'][_0x8a79('0x2a')],function(_0x4ec8c8){return{'name':_0x4ec8c8['fieldName'],'type':_0x4ec8c8[_0x8a79('0x2b')]['key']};});_0x4a5e95['model']=_[_0x8a79('0x29')](_0x4d107a,_0x8a79('0x26'));_0x4a5e95[_0x8a79('0x2c')]=_['keys'](_0x54994f[_0x8a79('0x2c')]);_0x4a5e95['filters']=_[_0x8a79('0x2d')](_0x4a5e95[_0x8a79('0x2e')],_0x4a5e95['query']);_0x3a253d['attributes']=_[_0x8a79('0x2d')](_0x4a5e95[_0x8a79('0x2e')],qs['fields'](_0x54994f['query'][_0x8a79('0x2f')]));_0x3a253d[_0x8a79('0x30')]=_0x3a253d['attributes'][_0x8a79('0x31')]?_0x3a253d['attributes']:_0x4a5e95[_0x8a79('0x2e')];if(!_0x54994f[_0x8a79('0x2c')][_0x8a79('0x32')](_0x8a79('0x33'))){_0x3a253d['limit']=qs['limit'](_0x54994f[_0x8a79('0x2c')][_0x8a79('0x1c')]);_0x3a253d[_0x8a79('0x1e')]=qs['offset'](_0x54994f[_0x8a79('0x2c')][_0x8a79('0x1e')]);}_0x3a253d['order']=qs[_0x8a79('0x34')](_0x54994f['query']['sort']);_0x3a253d['where']=qs[_0x8a79('0x35')](_[_0x8a79('0x36')](_0x54994f[_0x8a79('0x2c')],_0x4a5e95[_0x8a79('0x35')]),_0x4d107a);if(_0x54994f[_0x8a79('0x2c')]['filter']){_0x3a253d[_0x8a79('0x37')]=_['merge'](_0x3a253d[_0x8a79('0x37')],{'$or':_[_0x8a79('0x29')](_0x4d107a,function(_0x1a31b8){if(_0x1a31b8['type']!==_0x8a79('0x38')){var _0x3bc126={};_0x3bc126[_0x1a31b8[_0x8a79('0x26')]]={'$like':'%'+_0x54994f[_0x8a79('0x2c')][_0x8a79('0x39')]+'%'};return _0x3bc126;}})});}_0x3a253d=_['merge']({},_0x3a253d,_0x54994f[_0x8a79('0x3a')]);var _0x59f6b6={'where':_0x3a253d[_0x8a79('0x37')]};return db['Attachment']['count'](_0x59f6b6)[_0x8a79('0x23')](function(_0x4380b6){_0x39adf3['count']=_0x4380b6;if(_0x54994f[_0x8a79('0x2c')]['includeAll']){_0x3a253d[_0x8a79('0x3b')]=[{'all':!![]}];}return db[_0x8a79('0x3c')][_0x8a79('0x3d')](_0x3a253d);})['then'](function(_0x22ddf2){_0x39adf3[_0x8a79('0x3e')]=_0x22ddf2;return _0x39adf3;})[_0x8a79('0x23')](respondWithFilteredResult(_0x9b70c9,_0x3a253d))[_0x8a79('0x3f')](handleError(_0x9b70c9,null));};exports['show']=function(_0x2f499f,_0x1daa2d){var _0x3fbe12={'raw':!![],'where':{'id':_0x2f499f[_0x8a79('0x40')]['id']}},_0x357d96={};_0x357d96[_0x8a79('0x2e')]=_[_0x8a79('0x41')](db[_0x8a79('0x3c')][_0x8a79('0x2a')]);_0x357d96[_0x8a79('0x2c')]=_['keys'](_0x2f499f[_0x8a79('0x2c')]);_0x357d96[_0x8a79('0x35')]=_[_0x8a79('0x2d')](_0x357d96[_0x8a79('0x2e')],_0x357d96[_0x8a79('0x2c')]);_0x3fbe12['attributes']=_[_0x8a79('0x2d')](_0x357d96['model'],qs[_0x8a79('0x2f')](_0x2f499f[_0x8a79('0x2c')][_0x8a79('0x2f')]));_0x3fbe12['attributes']=_0x3fbe12[_0x8a79('0x30')][_0x8a79('0x31')]?_0x3fbe12[_0x8a79('0x30')]:_0x357d96[_0x8a79('0x2e')];if(_0x2f499f['query'][_0x8a79('0x42')]){_0x3fbe12[_0x8a79('0x3b')]=[{'all':!![]}];}_0x3fbe12=_[_0x8a79('0x43')]({},_0x3fbe12,_0x2f499f[_0x8a79('0x3a')]);return db[_0x8a79('0x3c')]['find'](_0x3fbe12)[_0x8a79('0x23')](handleEntityNotFound(_0x1daa2d,null))['then'](respondWithResult(_0x1daa2d,null))['catch'](handleError(_0x1daa2d,null));};exports[_0x8a79('0x44')]=function(_0x25f39c,_0x5cbf92){var _0x2d2a9c={'where':{'id':_0x25f39c[_0x8a79('0x40')]['id']}},_0x30bd28={};_0x30bd28[_0x8a79('0x2e')]=_['keys'](db[_0x8a79('0x3c')]['rawAttributes']);_0x2d2a9c[_0x8a79('0x30')]=_[_0x8a79('0x2d')](_0x30bd28['model'],qs['fields'](_0x25f39c['query'][_0x8a79('0x2f')]));_0x2d2a9c[_0x8a79('0x30')]=_0x2d2a9c[_0x8a79('0x30')][_0x8a79('0x31')]?_0x2d2a9c[_0x8a79('0x30')]:_0x30bd28[_0x8a79('0x2e')];if(_0x25f39c['query'][_0x8a79('0x42')]){_0x2d2a9c[_0x8a79('0x3b')]=[{'all':!![]}];}_0x2d2a9c=_[_0x8a79('0x43')]({},_0x2d2a9c,_0x25f39c[_0x8a79('0x3a')]);return db['Attachment'][_0x8a79('0x45')](_0x2d2a9c)[_0x8a79('0x23')](handleEntityNotFound(_0x5cbf92,null))['then'](function(_0x4f2b5c){if(_0x4f2b5c){var _0x349ca7=_0x4f2b5c[_0x8a79('0x46')]({'plain':!![]});_0x349ca7=qs[_0x8a79('0x47')](_0x349ca7,['id','createdAt',_0x8a79('0x48')]);_0x25f39c[_0x8a79('0x49')]=_[_0x8a79('0x47')](_0x25f39c[_0x8a79('0x49')],['id',_0x8a79('0x4a'),_0x8a79('0x48')]);return db[_0x8a79('0x3c')][_0x8a79('0x4b')](_[_0x8a79('0x43')](_0x349ca7,_0x25f39c[_0x8a79('0x49')]),{'include':_0x25f39c[_0x8a79('0x2c')][_0x8a79('0x42')]?[{'all':!![]}]:undefined});}})[_0x8a79('0x23')](respondWithResult(_0x5cbf92,0xc9))[_0x8a79('0x3f')](handleError(_0x5cbf92,null));};exports[_0x8a79('0x22')]=function(_0x20cfb1,_0x3903e0){if(_0x20cfb1[_0x8a79('0x49')]['id']){delete _0x20cfb1[_0x8a79('0x49')]['id'];}return db[_0x8a79('0x3c')][_0x8a79('0x45')]({'where':{'id':_0x20cfb1[_0x8a79('0x40')]['id']}})[_0x8a79('0x23')](handleEntityNotFound(_0x3903e0,null))[_0x8a79('0x23')](saveUpdates(_0x20cfb1['body'],null))[_0x8a79('0x23')](respondWithResult(_0x3903e0,null))[_0x8a79('0x3f')](handleError(_0x3903e0,null));};exports['destroy']=function(_0x352add,_0x488b5b){return db['Attachment'][_0x8a79('0x45')]({'where':{'id':_0x352add[_0x8a79('0x40')]['id']}})[_0x8a79('0x23')](handleEntityNotFound(_0x488b5b,null))[_0x8a79('0x23')](removeEntity(_0x488b5b,null))[_0x8a79('0x3f')](handleError(_0x488b5b,null));};exports['create']=function(_0x73d764,_0x512c72,_0x166b2a){_0x73d764[_0x8a79('0x49')][_0x8a79('0x26')]=_0x73d764['file']['originalname'];_0x73d764[_0x8a79('0x49')][_0x8a79('0x4c')]=_0x73d764[_0x8a79('0x4d')][_0x8a79('0x4e')];_0x73d764[_0x8a79('0x49')][_0x8a79('0x2b')]=_0x73d764['file']['mimetype'];return db[_0x8a79('0x3c')][_0x8a79('0x4b')](_0x73d764[_0x8a79('0x49')])['then'](respondWithResult(_0x512c72,0xc9))[_0x8a79('0x3f')](handleError(_0x512c72,null));};exports['download']=function(_0x528712,_0x1ba433,_0x4506af){return db[_0x8a79('0x3c')][_0x8a79('0x4f')]({'where':{'id':_0x528712[_0x8a79('0x40')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x1ba433,null))[_0x8a79('0x23')](function(_0x2b0ce8){if(_0x2b0ce8){var _0xca01d4=_0x2b0ce8[_0x8a79('0x50')]!==null;var _0xb991ee=path[_0x8a79('0x51')](config[_0x8a79('0x52')],_0x8a79('0x53'));if(_0xca01d4){_0xb991ee=path[_0x8a79('0x51')](_0xb991ee,_0x8a79('0x54'));}var _0x3ea365=path[_0x8a79('0x51')](_0xb991ee,_0x2b0ce8[_0x8a79('0x4c')]);return _0x1ba433[_0x8a79('0x55')](_0x3ea365);}})[_0x8a79('0x3f')](handleError(_0x1ba433,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 2da5db4..6f14d49 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 _0x7346=['./attachment.attributes','exports','define','Attachment','attachments','lodash','util','../../config/logger','request-promise','rimraf'];(function(_0x4ca6a4,_0x5e9694){var _0x120555=function(_0x56888c){while(--_0x56888c){_0x4ca6a4['push'](_0x4ca6a4['shift']());}};_0x120555(++_0x5e9694);}(_0x7346,0x113));var _0x6734=function(_0x1b0a0f,_0x5e1bb9){_0x1b0a0f=_0x1b0a0f-0x0;var _0x208490=_0x7346[_0x1b0a0f];return _0x208490;};'use strict';var _=require(_0x6734('0x0'));var util=require(_0x6734('0x1'));var logger=require(_0x6734('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6734('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6734('0x4'));var config=require('../../config/environment');var attributes=require(_0x6734('0x5'));module[_0x6734('0x6')]=function(_0x1f61a7,_0x433d4e){return _0x1f61a7[_0x6734('0x7')](_0x6734('0x8'),attributes,{'tableName':_0x6734('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9472=['define','Attachment','attachments','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./attachment.attributes'];(function(_0xcffe4a,_0x2a9463){var _0x45f345=function(_0x1b3024){while(--_0x1b3024){_0xcffe4a['push'](_0xcffe4a['shift']());}};_0x45f345(++_0x2a9463);}(_0x9472,0xff));var _0x2947=function(_0x40c00f,_0xf39ebf){_0x40c00f=_0x40c00f-0x0;var _0x17feb1=_0x9472[_0x40c00f];return _0x17feb1;};'use strict';var _=require(_0x2947('0x0'));var util=require(_0x2947('0x1'));var logger=require(_0x2947('0x2'))(_0x2947('0x3'));var moment=require(_0x2947('0x4'));var BPromise=require(_0x2947('0x5'));var rp=require(_0x2947('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2947('0x7'));var config=require('../../config/environment');var attributes=require(_0x2947('0x8'));module['exports']=function(_0x5377f8,_0x1b2c5e){return _0x5377f8[_0x2947('0x9')](_0x2947('0xa'),attributes,{'tableName':_0x2947('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index a366315..f40a5ec 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 _0xfa2b=['Attachment','create','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','code','error','message','result','CreateAttachment'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x9e87d6,_0x5afee5){_0x9e87d6=_0x9e87d6-0x0;var _0x24f3f2=_0xfa2b[_0x9e87d6];return _0x24f3f2;};'use strict';var _=require(_0xbfa2('0x0'));var util=require(_0xbfa2('0x1'));var moment=require(_0xbfa2('0x2'));var BPromise=require(_0xbfa2('0x3'));var rs=require(_0xbfa2('0x4'));var fs=require('fs');var Redis=require(_0xbfa2('0x5'));var db=require(_0xbfa2('0x6'))['db'];var utils=require(_0xbfa2('0x7'));var logger=require(_0xbfa2('0x8'))(_0xbfa2('0x9'));var config=require(_0xbfa2('0xa'));var jayson=require(_0xbfa2('0xb'));var client=jayson[_0xbfa2('0xc')][_0xbfa2('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x26ed93,_0x26e9bf,_0x4cd9ae){return new BPromise(function(_0x46a151,_0x4f17e6){return client[_0xbfa2('0xe')](_0x26ed93,_0x4cd9ae)[_0xbfa2('0xf')](function(_0x1b1c13){logger[_0xbfa2('0x10')](_0xbfa2('0x11'),_0x26e9bf,_0xbfa2('0x12'));logger[_0xbfa2('0x13')](_0xbfa2('0x14'),_0x26e9bf,_0xbfa2('0x12'),JSON['stringify'](_0x1b1c13));if(_0x1b1c13['error']){if(_0x1b1c13['error'][_0xbfa2('0x15')]===0x1f4){logger[_0xbfa2('0x16')](_0xbfa2('0x11'),_0x26e9bf,_0x1b1c13[_0xbfa2('0x16')][_0xbfa2('0x17')]);return _0x4f17e6(_0x1b1c13[_0xbfa2('0x16')]['message']);}logger[_0xbfa2('0x16')](_0xbfa2('0x11'),_0x26e9bf,_0x1b1c13[_0xbfa2('0x16')][_0xbfa2('0x17')]);return _0x46a151(_0x1b1c13[_0xbfa2('0x16')]['message']);}else{logger[_0xbfa2('0x10')]('Attachment,\x20%s,\x20%s',_0x26e9bf,'request\x20sent');_0x46a151(_0x1b1c13[_0xbfa2('0x18')]['message']);}})['catch'](function(_0xab2c91){logger[_0xbfa2('0x16')]('Attachment,\x20%s,\x20%s',_0x26e9bf,_0xab2c91);_0x4f17e6(_0xab2c91);});});}exports[_0xbfa2('0x19')]=function(_0x12627a){var _0x28fe6f=this;return new Promise(function(_0x4088c5,_0x37aed6){return db[_0xbfa2('0x1a')][_0xbfa2('0x1b')](_0x12627a['body'],{'raw':_0x12627a[_0xbfa2('0x1c')]?_0x12627a[_0xbfa2('0x1c')][_0xbfa2('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x2ac6c3){logger[_0xbfa2('0x10')]('CreateAttachment',_0x12627a);logger[_0xbfa2('0x13')]('CreateAttachment',_0x12627a,JSON['stringify'](_0x2ac6c3));_0x4088c5(_0x2ac6c3);})[_0xbfa2('0x1e')](function(_0xdb059b){logger[_0xbfa2('0x16')](_0xbfa2('0x19'),_0xdb059b['message'],_0x12627a);_0x37aed6(_0x28fe6f['error'](0x1f4,_0xdb059b[_0xbfa2('0x17')]));});});}; \ No newline at end of file +var _0xc91b=['client','http','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','Attachment','create','body','options','raw','CreateAttachment','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x561f25,_0x2d95c1){var _0x150e4c=function(_0x266e99){while(--_0x266e99){_0x561f25['push'](_0x561f25['shift']());}};_0x150e4c(++_0x2d95c1);}(_0xc91b,0x16f));var _0xbc91=function(_0x2739f9,_0x2d6862){_0x2739f9=_0x2739f9-0x0;var _0x4640ca=_0xc91b[_0x2739f9];return _0x4640ca;};'use strict';var _=require(_0xbc91('0x0'));var util=require(_0xbc91('0x1'));var moment=require(_0xbc91('0x2'));var BPromise=require(_0xbc91('0x3'));var rs=require(_0xbc91('0x4'));var fs=require('fs');var Redis=require(_0xbc91('0x5'));var db=require(_0xbc91('0x6'))['db'];var utils=require(_0xbc91('0x7'));var logger=require('../../config/logger')(_0xbc91('0x8'));var config=require(_0xbc91('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbc91('0xa')][_0xbc91('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x535cb9,_0xf88d45,_0x43731a){return new BPromise(function(_0x36e15f,_0x34f079){return client[_0xbc91('0xc')](_0x535cb9,_0x43731a)[_0xbc91('0xd')](function(_0xa20d9){logger['info'](_0xbc91('0xe'),_0xf88d45,_0xbc91('0xf'));logger[_0xbc91('0x10')]('Attachment,\x20%s,\x20%s,\x20%s',_0xf88d45,'request\x20sent',JSON[_0xbc91('0x11')](_0xa20d9));if(_0xa20d9[_0xbc91('0x12')]){if(_0xa20d9['error']['code']===0x1f4){logger[_0xbc91('0x12')]('Attachment,\x20%s,\x20%s',_0xf88d45,_0xa20d9['error'][_0xbc91('0x13')]);return _0x34f079(_0xa20d9[_0xbc91('0x12')][_0xbc91('0x13')]);}logger[_0xbc91('0x12')]('Attachment,\x20%s,\x20%s',_0xf88d45,_0xa20d9['error'][_0xbc91('0x13')]);return _0x36e15f(_0xa20d9[_0xbc91('0x12')]['message']);}else{logger[_0xbc91('0x14')](_0xbc91('0xe'),_0xf88d45,_0xbc91('0xf'));_0x36e15f(_0xa20d9[_0xbc91('0x15')][_0xbc91('0x13')]);}})[_0xbc91('0x16')](function(_0xb92600){logger[_0xbc91('0x12')](_0xbc91('0xe'),_0xf88d45,_0xb92600);_0x34f079(_0xb92600);});});}exports['CreateAttachment']=function(_0x60911a){var _0x439145=this;return new Promise(function(_0x181d48,_0x31ce1f){return db[_0xbc91('0x17')][_0xbc91('0x18')](_0x60911a[_0xbc91('0x19')],{'raw':_0x60911a['options']?_0x60911a[_0xbc91('0x1a')][_0xbc91('0x1b')]===undefined?!![]:![]:!![]})[_0xbc91('0xd')](function(_0x558c32){logger['info'](_0xbc91('0x1c'),_0x60911a);logger[_0xbc91('0x10')](_0xbc91('0x1c'),_0x60911a,JSON[_0xbc91('0x11')](_0x558c32));_0x181d48(_0x558c32);})['catch'](function(_0x521196){logger[_0xbc91('0x12')](_0xbc91('0x1c'),_0x521196[_0xbc91('0x13')],_0x60911a);_0x31ce1f(_0x439145[_0xbc91('0x12')](0x1f4,_0x521196[_0xbc91('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 1e1c26b..c5655cc 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 _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x337748,_0x402b05){var _0x3bb03f=function(_0x2fcdf4){while(--_0x2fcdf4){_0x337748['push'](_0x337748['shift']());}};_0x3bb03f(++_0x402b05);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file +var _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x50e442,_0x8d919e){var _0x53f01a=function(_0x35bd56){while(--_0x35bd56){_0x50e442['push'](_0x50e442['shift']());}};_0x53f01a(++_0x8d919e);}(_0x2032,0xd9));var _0x2203=function(_0x1c300f,_0x518464){_0x1c300f=_0x1c300f-0x0;var _0x3174d9=_0x2032[_0x1c300f];return _0x3174d9;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 365cf31..e335d01 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 _0xa59f=['value','admin','user','agent','disabled','blocked','blockedAt','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','lodash','passport-google-oauth20','moment','../../config/environment','../../components/auth/service','../../config/utils','login','authenticate','google','profile','email','callback','/login','use','clientID','clientSecret','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','find','map','emails'];(function(_0x3b1bdd,_0x1fbf1b){var _0x1d0ad7=function(_0x54fcd7){while(--_0x54fcd7){_0x3b1bdd['push'](_0x3b1bdd['shift']());}};_0x1d0ad7(++_0x1fbf1b);}(_0xa59f,0xea));var _0xfa59=function(_0x5d5e5e,_0x1197a4){_0x5d5e5e=_0x5d5e5e-0x0;var _0x2fa691=_0xa59f[_0x5d5e5e];return _0x2fa691;};'use strict';var _=require(_0xfa59('0x0'));var passport=require('passport');var GoogleStrategy=require(_0xfa59('0x1'))['Strategy'];var moment=require(_0xfa59('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0xfa59('0x3'));var signToken=require(_0xfa59('0x4'))['signToken'];var utils=require(_0xfa59('0x5'));exports[_0xfa59('0x6')]=passport[_0xfa59('0x7')](_0xfa59('0x8'),{'failureRedirect':'/login','scope':[_0xfa59('0x9'),_0xfa59('0xa')],'session':![]});exports[_0xfa59('0xb')]=passport[_0xfa59('0x7')](_0xfa59('0x8'),{'failureRedirect':_0xfa59('0xc'),'session':![]});passport[_0xfa59('0xd')](new GoogleStrategy({'clientID':config[_0xfa59('0x8')]?config[_0xfa59('0x8')][_0xfa59('0xe')]:'id','clientSecret':config[_0xfa59('0x8')]?config['google'][_0xfa59('0xf')]:_0xfa59('0x10'),'callbackURL':config[_0xfa59('0x8')]?config[_0xfa59('0x8')][_0xfa59('0x11')]:''},function(_0x458c80,_0x5965b5,_0x28716f,_0x9e10e3){var _0x136df0,_0x3047c9;return db['Setting'][_0xfa59('0x12')]({'where':{'id':0x1},'attributes':[_0xfa59('0x13'),_0xfa59('0x14')],'raw':!![]})[_0xfa59('0x15')](function(_0x132435){_0x136df0=_0x132435;return db['User'][_0xfa59('0x16')]({'where':{'email':_[_0xfa59('0x17')](_0x28716f[_0xfa59('0x18')],_0xfa59('0x19')),'role':{'$or':[_0xfa59('0x1a'),_0xfa59('0x1b'),_0xfa59('0x1c')]}}});})['then'](function(_0x3a5391){_0x3047c9=_0x3a5391;if(_0x3047c9){if(_0x3047c9[_0xfa59('0x1d')]){return _0x9e10e3('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x136df0['blockDuration']>0x0){if(_0x3047c9[_0xfa59('0x1e')]){if(moment(_0x3047c9[_0xfa59('0x1f')])[_0xfa59('0x20')](_0x136df0[_0xfa59('0x14')],_0xfa59('0x21'))>moment()){return _0x9e10e3(_0xfa59('0x22'));}else{return utils[_0xfa59('0x23')](_0x3047c9,0x0,![],null)['then'](function(){return utils[_0xfa59('0x24')](_0x3047c9);})[_0xfa59('0x15')](function(){return _0x9e10e3(null,_0x3047c9);});}}else{return utils[_0xfa59('0x24')](_0x3047c9)[_0xfa59('0x15')](function(){return _0x9e10e3(null,_0x3047c9);});}}else{return utils['getLicense'](_0x3047c9)['then'](function(){return _0x9e10e3(null,_0x3047c9);});}}return _0x9e10e3(_0xfa59('0x22'));})['catch'](function(_0x479a04){_0x9e10e3(_0x479a04);});})); \ No newline at end of file +var _0xea65=['admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','profile','email','callback','/login','use','clientID','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','then','User','map','emails','value'];(function(_0x838cf3,_0x8d338b){var _0x2c43a9=function(_0x341367){while(--_0x341367){_0x838cf3['push'](_0x838cf3['shift']());}};_0x2c43a9(++_0x8d338b);}(_0xea65,0x16a));var _0x5ea6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xea65[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x5ea6('0x0'));var passport=require(_0x5ea6('0x1'));var GoogleStrategy=require(_0x5ea6('0x2'))[_0x5ea6('0x3')];var moment=require(_0x5ea6('0x4'));var db=require(_0x5ea6('0x5'))['db'];var config=require('../../config/environment');var signToken=require(_0x5ea6('0x6'))[_0x5ea6('0x7')];var utils=require(_0x5ea6('0x8'));exports[_0x5ea6('0x9')]=passport[_0x5ea6('0xa')](_0x5ea6('0xb'),{'failureRedirect':'/login','scope':[_0x5ea6('0xc'),_0x5ea6('0xd')],'session':![]});exports[_0x5ea6('0xe')]=passport[_0x5ea6('0xa')](_0x5ea6('0xb'),{'failureRedirect':_0x5ea6('0xf'),'session':![]});passport[_0x5ea6('0x10')](new GoogleStrategy({'clientID':config[_0x5ea6('0xb')]?config['google'][_0x5ea6('0x11')]:'id','clientSecret':config[_0x5ea6('0xb')]?config['google']['clientSecret']:'secret','callbackURL':config[_0x5ea6('0xb')]?config[_0x5ea6('0xb')][_0x5ea6('0x12')]:''},function(_0x4847a6,_0x3ac15a,_0xe1241b,_0x16ce43){var _0x2e4e85,_0x19cc07;return db[_0x5ea6('0x13')][_0x5ea6('0x14')]({'where':{'id':0x1},'attributes':[_0x5ea6('0x15'),_0x5ea6('0x16')],'raw':!![]})[_0x5ea6('0x17')](function(_0x48beff){_0x2e4e85=_0x48beff;return db[_0x5ea6('0x18')]['find']({'where':{'email':_[_0x5ea6('0x19')](_0xe1241b[_0x5ea6('0x1a')],_0x5ea6('0x1b')),'role':{'$or':[_0x5ea6('0x1c'),_0x5ea6('0x1d'),_0x5ea6('0x1e')]}}});})[_0x5ea6('0x17')](function(_0x19da9c){_0x19cc07=_0x19da9c;if(_0x19cc07){if(_0x19cc07[_0x5ea6('0x1f')]){return _0x16ce43(_0x5ea6('0x20'));}else if(_0x2e4e85[_0x5ea6('0x16')]>0x0){if(_0x19cc07['blocked']){if(moment(_0x19cc07[_0x5ea6('0x21')])[_0x5ea6('0x22')](_0x2e4e85[_0x5ea6('0x16')],_0x5ea6('0x23'))>moment()){return _0x16ce43(_0x5ea6('0x20'));}else{return utils[_0x5ea6('0x24')](_0x19cc07,0x0,![],null)[_0x5ea6('0x17')](function(){return utils[_0x5ea6('0x25')](_0x19cc07);})[_0x5ea6('0x17')](function(){return _0x16ce43(null,_0x19cc07);});}}else{return utils['getLicense'](_0x19cc07)[_0x5ea6('0x17')](function(){return _0x16ce43(null,_0x19cc07);});}}else{return utils[_0x5ea6('0x25')](_0x19cc07)['then'](function(){return _0x16ce43(null,_0x19cc07);});}}return _0x16ce43(_0x5ea6('0x20'));})[_0x5ea6('0x26')](function(_0x5cfb91){_0x16ce43(_0x5cfb91);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 5ac081f..52c7ef9 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 _0x3368=['setTokenCookie','exports','express','Router','get','callback','isMiddleware'];(function(_0x3bcb39,_0x2e1bd0){var _0x158bc4=function(_0x5570d3){while(--_0x5570d3){_0x3bcb39['push'](_0x3bcb39['shift']());}};_0x158bc4(++_0x2e1bd0);}(_0x3368,0x19f));var _0x8336=function(_0x4f9ef1,_0x3cead7){_0x4f9ef1=_0x4f9ef1-0x0;var _0x3d3573=_0x3368[_0x4f9ef1];return _0x3d3573;};'use strict';var express=require(_0x8336('0x0'));var passport=require('passport');var router=express[_0x8336('0x1')]();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router[_0x8336('0x2')]('/',controller['login']);router[_0x8336('0x2')]('/callback',controller[_0x8336('0x3')],authService[_0x8336('0x4')],userController['login'],authService[_0x8336('0x5')]);module[_0x8336('0x6')]=router; \ No newline at end of file +var _0xbece=['login','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','/callback','callback','isMiddleware'];(function(_0x326ae1,_0x559742){var _0x616d33=function(_0xc9f279){while(--_0xc9f279){_0x326ae1['push'](_0x326ae1['shift']());}};_0x616d33(++_0x559742);}(_0xbece,0x148));var _0xebec=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbece[_0x321bb2];return _0x9c12ed;};'use strict';var express=require(_0xebec('0x0'));var passport=require(_0xebec('0x1'));var router=express[_0xebec('0x2')]();var controller=require(_0xebec('0x3'));var userController=require(_0xebec('0x4'));var authService=require(_0xebec('0x5'));router[_0xebec('0x6')]('/',controller['login']);router[_0xebec('0x6')](_0xebec('0x7'),controller[_0xebec('0x8')],authService[_0xebec('0x9')],userController[_0xebec('0xa')],authService[_0xebec('0xb')]);module[_0xebec('0xc')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 919eda7..6d3b312 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 _0xeee0=['secure','auth','pass','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','toLowerCase','find','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','password','enforcePasswordHistory','previousPasswords','resetPasswordToken','use','User','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','clearBlockUser','minutes','getLicense','catch','MailAccount','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port'];(function(_0x3be8a8,_0x2f3e3c){var _0x3e442e=function(_0x3e57d5){while(--_0x3e57d5){_0x3be8a8['push'](_0x3be8a8['shift']());}};_0x3e442e(++_0x2f3e3c);}(_0xeee0,0x183));var _0x0eee=function(_0x1fd9e7,_0x24cdbe){_0x1fd9e7=_0x1fd9e7-0x0;var _0x1781f2=_0xeee0[_0x1fd9e7];return _0x1781f2;};'use strict';var util=require('util');var passport=require('passport');var LocalStrategy=require(_0x0eee('0x0'))[_0x0eee('0x1')];var jayson=require(_0x0eee('0x2'));var _=require(_0x0eee('0x3'));var rs=require(_0x0eee('0x4'));var moment=require(_0x0eee('0x5'));var db=require(_0x0eee('0x6'))['db'];var authService=require(_0x0eee('0x7'));var utils=require('../../config/utils');var client=jayson[_0x0eee('0x8')][_0x0eee('0x9')]({'port':0x232b});function localAuthenticate(_0x52bcaf,_0x4a94b1,_0x54520a,_0x258d69){var _0x3639b6,_0x341460;return db[_0x0eee('0xa')][_0x0eee('0xb')]({'where':{'id':0x1},'attributes':[_0x0eee('0xc'),_0x0eee('0xd')],'raw':!![]})[_0x0eee('0xe')](function(_0x46e482){_0x3639b6=_0x46e482;return _0x52bcaf[_0x0eee('0xb')]({'attributes':['id',_0x0eee('0xf'),'password','salt',_0x0eee('0x10'),_0x0eee('0x11'),_0x0eee('0x12'),_0x0eee('0x13'),_0x0eee('0x14')],'where':{'name':_0x4a94b1,'role':{'$or':[_0x0eee('0x15'),_0x0eee('0x16'),_0x0eee('0x17')]}}});})[_0x0eee('0xe')](function(_0x196331){if(!_0x196331||_0x196331&&_0x196331[_0x0eee('0xf')]!==_0x4a94b1){throw new Error(_0x0eee('0x18'));}else{_0x341460=_0x196331;return _0x341460;}})[_0x0eee('0xe')](function(){_0x341460[_0x0eee('0x19')](_0x54520a,function(_0xbe0361,_0x17ea7c){var _0x50fe24=_0x341460[_0x0eee('0x14')]+0x1;if(_0xbe0361){return _0x258d69(_0xbe0361);}else if(!_0x17ea7c){if(_0x341460['disabled']){return _0x258d69(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x3639b6[_0x0eee('0xc')]>0x0){if(_0x341460['blocked']){if(_0x3639b6['blockDuration']>0x0){if(moment(_0x341460[_0x0eee('0x13')])[_0x0eee('0x1a')](_0x3639b6[_0x0eee('0xd')],'minutes')>moment()){return _0x258d69(null,![],{'message':_0x0eee('0x18')});}else{return utils[_0x0eee('0x1b')](_0x341460,_0x50fe24,![],null)[_0x0eee('0xe')](function(){return _0x258d69(null,![],{'message':_0x0eee('0x18')});});}}else{return _0x258d69(null,![],{'message':_0x0eee('0x18')});}}else{if(_0x50fe24>=_0x3639b6[_0x0eee('0xc')]){return utils[_0x0eee('0x1b')](_0x341460,0x0,!![],moment())[_0x0eee('0xe')](function(){return _0x258d69(null,![],{'message':_0x0eee('0x18')});});}else{return utils[_0x0eee('0x1b')](_0x341460,_0x50fe24,![],null)[_0x0eee('0xe')](function(){return _0x258d69(null,![],{'message':_0x0eee('0x18')});});}}}else{return _0x258d69(null,![],{'message':_0x0eee('0x18')});}}else{if(_0x341460['disabled']){return _0x258d69(null,![],{'message':_0x0eee('0x18')});}else if(_0x3639b6[_0x0eee('0xc')]>0x0){if(_0x341460['blocked']){if(_0x3639b6[_0x0eee('0xd')]>0x0){if(moment(_0x341460['blockedAt'])[_0x0eee('0x1a')](_0x3639b6['blockDuration'],_0x0eee('0x1c'))>moment()){return _0x258d69(null,![],{'message':_0x0eee('0x18')});}else{return utils[_0x0eee('0x1b')](_0x341460,0x0,![],null)[_0x0eee('0xe')](function(){return utils['getLicense'](_0x341460);})[_0x0eee('0xe')](function(){return _0x258d69(null,_0x341460);});}}else{return _0x258d69(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x0eee('0x1b')](_0x341460,0x0,![],null)[_0x0eee('0xe')](function(){return utils[_0x0eee('0x1d')](_0x341460);})[_0x0eee('0xe')](function(){return _0x258d69(null,_0x341460);})['catch'](function(_0x2fbdc2){return _0x258d69(null,![],_0x2fbdc2);});}}else{if(_0x341460[_0x0eee('0x12')]){return _0x258d69(null,![],{'message':_0x0eee('0x18')});}else{return utils['getLicense'](_0x341460)['then'](function(){return _0x258d69(null,_0x341460);});}}}});})[_0x0eee('0x1e')](function(_0x306029){return _0x258d69(null,![],_0x306029);});}function sendServiceMail(_0x81559){return db[_0x0eee('0x1f')]['find']({'where':{'service':!![]},'attributes':['id',_0x0eee('0xf'),_0x0eee('0x20')],'include':[{'model':db['MailServerOut'],'as':_0x0eee('0x21')}]})[_0x0eee('0xe')](function(_0x1d0ac1){if(!_0x1d0ac1){throw new Error(_0x0eee('0x22'));}var _0x346028={'tls':{'rejectUnauthorized':![]}};if(_0x1d0ac1['Smtp'][_0x0eee('0x23')]){_0x346028[_0x0eee('0x23')]=_0x1d0ac1['Smtp']['service'];}else{_0x346028[_0x0eee('0x24')]=_0x1d0ac1[_0x0eee('0x21')][_0x0eee('0x24')];_0x346028[_0x0eee('0x25')]=_0x1d0ac1[_0x0eee('0x21')][_0x0eee('0x25')];_0x346028[_0x0eee('0x26')]=_0x1d0ac1['Smtp'][_0x0eee('0x26')];}if(_0x1d0ac1[_0x0eee('0x21')]['authentication']){_0x346028[_0x0eee('0x27')]={'user':_0x1d0ac1[_0x0eee('0x21')][_0x0eee('0x16')],'pass':_0x1d0ac1[_0x0eee('0x21')][_0x0eee('0x28')]};}var _0xbdb49c={'account':_0x346028,'message':_['merge']({'from':util[_0x0eee('0x29')](_0x0eee('0x2a'),_0x1d0ac1[_0x0eee('0xf')],_0x1d0ac1['email']||_0x1d0ac1[_0x0eee('0x21')]['user'])},_0x81559)};return client[_0x0eee('0x2b')](_0x0eee('0x2c'),_0xbdb49c);})['then'](function(_0x520770){if(_0x520770[_0x0eee('0x2d')]){throw new Error(util[_0x0eee('0x29')](_0x0eee('0x2e'),_0x520770[_0x0eee('0x2d')][_0x0eee('0x2f')]||JSON[_0x0eee('0x30')](_0x520770[_0x0eee('0x2d')])));}return!![];});}function handleError(_0x36ae28,_0x4872d8,_0x51538a){return _0x36ae28[_0x0eee('0x31')](_0x4872d8||0x1f4)[_0x0eee('0x32')]({'message':_0x51538a?_0x51538a[_0x0eee('0x2f')]||_0x51538a:''});}exports[_0x0eee('0x33')]=function(_0x380b27,_0x1c3516,_0x4fb0cc){passport[_0x0eee('0x19')](_0x0eee('0x34'),function(_0x1efee0,_0x2ee3db,_0x2fc899){var _0x13c597=_0x1efee0||_0x2fc899;if(_0x13c597){return handleError(_0x1c3516,0x191,_0x13c597);}if(!_0x2ee3db){return handleError(_0x1c3516,0x194,{'message':_0x0eee('0x35')});}else{var _0x1c966f={'payload':{'id':_0x2ee3db['id'],'role':_0x2ee3db[_0x0eee('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x0eee('0x36')](_0x1c966f)[_0x0eee('0xe')](function(_0x1e2a24){_0x1c3516['json']({'id':_0x2ee3db['id'],'token':_0x1e2a24,'statusCall':'','isAlreadyLogged':_0x2ee3db[_0x0eee('0x37')]});});}})(_0x380b27,_0x1c3516,_0x4fb0cc);};exports[_0x0eee('0x38')]=function(_0x33a034,_0x1fe45d,_0x1072e3){if(!_0x33a034[_0x0eee('0x39')][_0x0eee('0x20')]){return handleError(_0x1fe45d,0x1f4,{'message':_0x0eee('0x3a')});}var _0x1ac26c=rs[_0x0eee('0x3b')]();_0x33a034['body'][_0x0eee('0x20')]=_0x33a034[_0x0eee('0x39')][_0x0eee('0x20')]['trim']()[_0x0eee('0x3c')]();var _0x2625d8;return db[_0x0eee('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0x0eee('0xc'),_0x0eee('0xd')],'raw':!![]})[_0x0eee('0xe')](function(_0x24721a){_0x2625d8=_0x24721a;return db['User'][_0x0eee('0x3d')]({'where':{'email':_0x33a034[_0x0eee('0x39')][_0x0eee('0x20')]}});})['then'](function(_0x590a08){if(!_0x590a08){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x590a08[_0x0eee('0x11')]){throw new Error(_0x0eee('0x3e'));}if(_0x590a08[_0x0eee('0x12')]){if(moment(_0x590a08[_0x0eee('0x13')])[_0x0eee('0x1a')](_0x2625d8[_0x0eee('0xd')],_0x0eee('0x1c'))>moment()){throw new Error(_0x0eee('0x3f'));}else{_0x590a08['blocked']=![];_0x590a08[_0x0eee('0x13')]=null;}}_0x590a08['resetPasswordToken']=_0x1ac26c;_0x590a08[_0x0eee('0x40')]=Date[_0x0eee('0x41')]()+0x36ee80;return _0x590a08[_0x0eee('0x42')]();})[_0x0eee('0xe')](function(){return sendServiceMail({'to':_0x33a034['body'][_0x0eee('0x20')],'subject':_0x0eee('0x43'),'text':_0x0eee('0x44')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'https://'+_0x33a034[_0x0eee('0x45')][_0x0eee('0x24')]+_0x0eee('0x46')+_0x1ac26c+'\x0a\x0a'+_0x0eee('0x47')});})[_0x0eee('0xe')](function(){_0x1fe45d['status'](0xc8)[_0x0eee('0x32')]({'message':_0x0eee('0x48')});})[_0x0eee('0x1e')](function(_0x4fe571){return handleError(_0x1fe45d,0x1f4,_0x4fe571);});};exports[_0x0eee('0x49')]=function(_0x72840f,_0x55d3c8,_0x28b31d){return db['User'][_0x0eee('0x3d')]({'where':{'resetPasswordToken':_0x72840f[_0x0eee('0x4a')][_0x0eee('0x4b')],'resetPasswordExpires':{'$gt':Date[_0x0eee('0x41')]()}}})[_0x0eee('0xe')](function(_0x1003d6){if(!_0x1003d6){throw new Error(_0x0eee('0x4c'));}return db[_0x0eee('0xa')][_0x0eee('0xb')]({'attributes':['id',_0x0eee('0x4d'),'enforcePasswordHistory',_0x0eee('0x4e')]})['then'](function(_0x56f804){if(_0x56f804[_0x0eee('0x4d')])authService['validatePasswordPattern'](_0x72840f[_0x0eee('0x39')][_0x0eee('0x4f')]);if(!_0x56f804[_0x0eee('0x50')]||!_0x1003d6[_0x0eee('0x51')])return _0x1003d6;authService['validatePasswordHistory'](_0x72840f[_0x0eee('0x39')][_0x0eee('0x4f')],_0x1003d6[_0x0eee('0x51')],_0x56f804[_0x0eee('0x4e')]);return _0x1003d6;})['then'](function(){_0x1003d6['password']=_0x72840f[_0x0eee('0x39')][_0x0eee('0x4f')];_0x1003d6[_0x0eee('0x52')]=null;_0x1003d6[_0x0eee('0x40')]=null;return _0x1003d6[_0x0eee('0x42')]();});})[_0x0eee('0xe')](function(){_0x55d3c8['status'](0xc8)['send']({'message':'Password\x20reset!'});})[_0x0eee('0x1e')](function(_0x3108a5){return handleError(_0x55d3c8,0x1f4,_0x3108a5);});};passport[_0x0eee('0x53')](new LocalStrategy({'usernameField':_0x0eee('0xf'),'passwordField':'password'},function(_0x3026be,_0x5b689b,_0x2c900f){return localAuthenticate(db[_0x0eee('0x54')],_0x3026be,_0x5b689b,_0x2c900f);})); \ No newline at end of file +var _0x41cb=['authentication','auth','user','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','message','stringify','status','send','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','Setting','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','Password\x20reset!','use','util','passport','Strategy','jayson/promise','lodash','randomstring','moment','../../components/auth/service','../../config/utils','client','http','findOne','allowedLoginAttempts','blockDuration','then','password','salt','role','disabled','admin','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','blockedAt','add','minutes','clearBlockUser','blocked','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure'];(function(_0x250514,_0x389eda){var _0x59c25b=function(_0x3ad38b){while(--_0x3ad38b){_0x250514['push'](_0x250514['shift']());}};_0x59c25b(++_0x389eda);}(_0x41cb,0x1e6));var _0xb41c=function(_0x36e26e,_0x13b02b){_0x36e26e=_0x36e26e-0x0;var _0x508e6c=_0x41cb[_0x36e26e];return _0x508e6c;};'use strict';var util=require(_0xb41c('0x0'));var passport=require(_0xb41c('0x1'));var LocalStrategy=require('passport-local')[_0xb41c('0x2')];var jayson=require(_0xb41c('0x3'));var _=require(_0xb41c('0x4'));var rs=require(_0xb41c('0x5'));var moment=require(_0xb41c('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0xb41c('0x7'));var utils=require(_0xb41c('0x8'));var client=jayson[_0xb41c('0x9')][_0xb41c('0xa')]({'port':0x232b});function localAuthenticate(_0x1a0689,_0x5b14dd,_0x5b25ba,_0x41d06d){var _0x4dd4b8,_0x39a81c;return db['Setting'][_0xb41c('0xb')]({'where':{'id':0x1},'attributes':[_0xb41c('0xc'),_0xb41c('0xd')],'raw':!![]})[_0xb41c('0xe')](function(_0x274d4){_0x4dd4b8=_0x274d4;return _0x1a0689['findOne']({'attributes':['id','name',_0xb41c('0xf'),_0xb41c('0x10'),_0xb41c('0x11'),_0xb41c('0x12'),'blocked','blockedAt','loginAttempts'],'where':{'name':_0x5b14dd,'role':{'$or':[_0xb41c('0x13'),'user',_0xb41c('0x14')]}}});})['then'](function(_0x52a729){if(!_0x52a729||_0x52a729&&_0x52a729[_0xb41c('0x15')]!==_0x5b14dd){throw new Error(_0xb41c('0x16'));}else{_0x39a81c=_0x52a729;return _0x39a81c;}})[_0xb41c('0xe')](function(){_0x39a81c[_0xb41c('0x17')](_0x5b25ba,function(_0x238fa0,_0x53b8e7){var _0x44b5fc=_0x39a81c[_0xb41c('0x18')]+0x1;if(_0x238fa0){return _0x41d06d(_0x238fa0);}else if(!_0x53b8e7){if(_0x39a81c[_0xb41c('0x12')]){return _0x41d06d(null,![],{'message':_0xb41c('0x16')});}else if(_0x4dd4b8[_0xb41c('0xc')]>0x0){if(_0x39a81c['blocked']){if(_0x4dd4b8[_0xb41c('0xd')]>0x0){if(moment(_0x39a81c[_0xb41c('0x19')])[_0xb41c('0x1a')](_0x4dd4b8[_0xb41c('0xd')],_0xb41c('0x1b'))>moment()){return _0x41d06d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xb41c('0x1c')](_0x39a81c,_0x44b5fc,![],null)[_0xb41c('0xe')](function(){return _0x41d06d(null,![],{'message':_0xb41c('0x16')});});}}else{return _0x41d06d(null,![],{'message':_0xb41c('0x16')});}}else{if(_0x44b5fc>=_0x4dd4b8[_0xb41c('0xc')]){return utils['clearBlockUser'](_0x39a81c,0x0,!![],moment())[_0xb41c('0xe')](function(){return _0x41d06d(null,![],{'message':_0xb41c('0x16')});});}else{return utils[_0xb41c('0x1c')](_0x39a81c,_0x44b5fc,![],null)['then'](function(){return _0x41d06d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x41d06d(null,![],{'message':_0xb41c('0x16')});}}else{if(_0x39a81c['disabled']){return _0x41d06d(null,![],{'message':_0xb41c('0x16')});}else if(_0x4dd4b8['allowedLoginAttempts']>0x0){if(_0x39a81c[_0xb41c('0x1d')]){if(_0x4dd4b8[_0xb41c('0xd')]>0x0){if(moment(_0x39a81c[_0xb41c('0x19')])[_0xb41c('0x1a')](_0x4dd4b8[_0xb41c('0xd')],_0xb41c('0x1b'))>moment()){return _0x41d06d(null,![],{'message':_0xb41c('0x16')});}else{return utils[_0xb41c('0x1c')](_0x39a81c,0x0,![],null)['then'](function(){return utils[_0xb41c('0x1e')](_0x39a81c);})[_0xb41c('0xe')](function(){return _0x41d06d(null,_0x39a81c);});}}else{return _0x41d06d(null,![],{'message':_0xb41c('0x16')});}}else{return utils[_0xb41c('0x1c')](_0x39a81c,0x0,![],null)[_0xb41c('0xe')](function(){return utils[_0xb41c('0x1e')](_0x39a81c);})[_0xb41c('0xe')](function(){return _0x41d06d(null,_0x39a81c);})[_0xb41c('0x1f')](function(_0x48c4c0){return _0x41d06d(null,![],_0x48c4c0);});}}else{if(_0x39a81c['blocked']){return _0x41d06d(null,![],{'message':_0xb41c('0x16')});}else{return utils[_0xb41c('0x1e')](_0x39a81c)[_0xb41c('0xe')](function(){return _0x41d06d(null,_0x39a81c);});}}}});})[_0xb41c('0x1f')](function(_0x362ae6){return _0x41d06d(null,![],_0x362ae6);});}function sendServiceMail(_0x7b7b3f){return db[_0xb41c('0x20')][_0xb41c('0x21')]({'where':{'service':!![]},'attributes':['id',_0xb41c('0x15'),_0xb41c('0x22')],'include':[{'model':db[_0xb41c('0x23')],'as':_0xb41c('0x24')}]})[_0xb41c('0xe')](function(_0x2a030d){if(!_0x2a030d){throw new Error(_0xb41c('0x25'));}var _0x82b331={'tls':{'rejectUnauthorized':![]}};if(_0x2a030d[_0xb41c('0x24')][_0xb41c('0x26')]){_0x82b331[_0xb41c('0x26')]=_0x2a030d[_0xb41c('0x24')][_0xb41c('0x26')];}else{_0x82b331[_0xb41c('0x27')]=_0x2a030d['Smtp'][_0xb41c('0x27')];_0x82b331[_0xb41c('0x28')]=_0x2a030d[_0xb41c('0x24')][_0xb41c('0x28')];_0x82b331[_0xb41c('0x29')]=_0x2a030d[_0xb41c('0x24')][_0xb41c('0x29')];}if(_0x2a030d[_0xb41c('0x24')][_0xb41c('0x2a')]){_0x82b331[_0xb41c('0x2b')]={'user':_0x2a030d[_0xb41c('0x24')][_0xb41c('0x2c')],'pass':_0x2a030d['Smtp'][_0xb41c('0x2d')]};}var _0x115983={'account':_0x82b331,'message':_[_0xb41c('0x2e')]({'from':util[_0xb41c('0x2f')](_0xb41c('0x30'),_0x2a030d['name'],_0x2a030d['email']||_0x2a030d['Smtp'][_0xb41c('0x2c')])},_0x7b7b3f)};return client[_0xb41c('0x31')](_0xb41c('0x32'),_0x115983);})[_0xb41c('0xe')](function(_0x2bff45){if(_0x2bff45[_0xb41c('0x33')]){throw new Error(util[_0xb41c('0x2f')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x2bff45['error'][_0xb41c('0x34')]||JSON[_0xb41c('0x35')](_0x2bff45[_0xb41c('0x33')])));}return!![];});}function handleError(_0xe1c62c,_0x2a109c,_0x349e3e){return _0xe1c62c[_0xb41c('0x36')](_0x2a109c||0x1f4)[_0xb41c('0x37')]({'message':_0x349e3e?_0x349e3e[_0xb41c('0x34')]||_0x349e3e:''});}exports['login']=function(_0x5c2e6a,_0x3b1c1f,_0x34bb91){passport[_0xb41c('0x17')](_0xb41c('0x38'),function(_0x55f1ae,_0x3753aa,_0x2e7d94){var _0x5ef98a=_0x55f1ae||_0x2e7d94;if(_0x5ef98a){return handleError(_0x3b1c1f,0x191,_0x5ef98a);}if(!_0x3753aa){return handleError(_0x3b1c1f,0x194,{'message':_0xb41c('0x39')});}else{var _0x54ef15={'payload':{'id':_0x3753aa['id'],'role':_0x3753aa[_0xb41c('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0xb41c('0x3a')](_0x54ef15)[_0xb41c('0xe')](function(_0x3c2ffd){_0x3b1c1f[_0xb41c('0x3b')]({'id':_0x3753aa['id'],'token':_0x3c2ffd,'statusCall':'','isAlreadyLogged':_0x3753aa[_0xb41c('0x3c')]});});}})(_0x5c2e6a,_0x3b1c1f,_0x34bb91);};exports[_0xb41c('0x3d')]=function(_0x42dda4,_0x23570d,_0x4cb00e){if(!_0x42dda4[_0xb41c('0x3e')][_0xb41c('0x22')]){return handleError(_0x23570d,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x285319=rs['generate']();_0x42dda4[_0xb41c('0x3e')][_0xb41c('0x22')]=_0x42dda4[_0xb41c('0x3e')][_0xb41c('0x22')][_0xb41c('0x3f')]()[_0xb41c('0x40')]();var _0x442db5;return db['Setting'][_0xb41c('0xb')]({'where':{'id':0x1},'attributes':[_0xb41c('0xc'),_0xb41c('0xd')],'raw':!![]})['then'](function(_0x5aa203){_0x442db5=_0x5aa203;return db[_0xb41c('0x41')][_0xb41c('0x21')]({'where':{'email':_0x42dda4[_0xb41c('0x3e')][_0xb41c('0x22')]}});})['then'](function(_0xa7d816){if(!_0xa7d816){throw new Error(_0xb41c('0x42'));}if(_0xa7d816[_0xb41c('0x12')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0xa7d816[_0xb41c('0x1d')]){if(moment(_0xa7d816['blockedAt'])[_0xb41c('0x1a')](_0x442db5['blockDuration'],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0xa7d816['blocked']=![];_0xa7d816[_0xb41c('0x19')]=null;}}_0xa7d816['resetPasswordToken']=_0x285319;_0xa7d816['resetPasswordExpires']=Date[_0xb41c('0x43')]()+0x36ee80;return _0xa7d816[_0xb41c('0x44')]();})[_0xb41c('0xe')](function(){return sendServiceMail({'to':_0x42dda4[_0xb41c('0x3e')][_0xb41c('0x22')],'subject':_0xb41c('0x45'),'text':_0xb41c('0x46')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0xb41c('0x47')+_0x42dda4[_0xb41c('0x48')]['host']+_0xb41c('0x49')+_0x285319+'\x0a\x0a'+_0xb41c('0x4a')});})[_0xb41c('0xe')](function(){_0x23570d[_0xb41c('0x36')](0xc8)[_0xb41c('0x37')]({'message':_0xb41c('0x4b')});})[_0xb41c('0x1f')](function(_0x4a9358){return handleError(_0x23570d,0x1f4,_0x4a9358);});};exports[_0xb41c('0x4c')]=function(_0x307c0b,_0x4330c0,_0xbcbbeb){return db[_0xb41c('0x41')][_0xb41c('0x21')]({'where':{'resetPasswordToken':_0x307c0b[_0xb41c('0x4d')][_0xb41c('0x4e')],'resetPasswordExpires':{'$gt':Date[_0xb41c('0x43')]()}}})[_0xb41c('0xe')](function(_0x4cc95a){if(!_0x4cc95a){throw new Error(_0xb41c('0x4f'));}return db[_0xb41c('0x50')][_0xb41c('0xb')]({'attributes':['id',_0xb41c('0x51'),_0xb41c('0x52'),_0xb41c('0x53')]})[_0xb41c('0xe')](function(_0x5e80de){if(_0x5e80de[_0xb41c('0x51')])authService[_0xb41c('0x54')](_0x307c0b[_0xb41c('0x3e')][_0xb41c('0xf')]);if(!_0x5e80de[_0xb41c('0x52')]||!_0x4cc95a[_0xb41c('0x55')])return _0x4cc95a;authService['validatePasswordHistory'](_0x307c0b[_0xb41c('0x3e')][_0xb41c('0xf')],_0x4cc95a[_0xb41c('0x55')],_0x5e80de['passwordHistoryLimit']);return _0x4cc95a;})[_0xb41c('0xe')](function(){_0x4cc95a['password']=_0x307c0b[_0xb41c('0x3e')][_0xb41c('0xf')];_0x4cc95a['resetPasswordToken']=null;_0x4cc95a['resetPasswordExpires']=null;return _0x4cc95a[_0xb41c('0x44')]();});})[_0xb41c('0xe')](function(){_0x4330c0['status'](0xc8)['send']({'message':_0xb41c('0x56')});})['catch'](function(_0x53ba24){return handleError(_0x4330c0,0x1f4,_0x53ba24);});};passport[_0xb41c('0x57')](new LocalStrategy({'usernameField':_0xb41c('0x15'),'passwordField':_0xb41c('0xf')},function(_0x42fc4e,_0x1dd82a,_0x307da1){return localAuthenticate(db[_0xb41c('0x41')],_0x42fc4e,_0x1dd82a,_0x307da1);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 063625f..53f40c5 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 _0x2640=['/forgot','forgot','/reset/:token','exports','express','Router','./authLocal.controller','login','post'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2640,0x8b));var _0x0264=function(_0x2668a3,_0x55fbf7){_0x2668a3=_0x2668a3-0x0;var _0x4b2aa0=_0x2640[_0x2668a3];return _0x4b2aa0;};'use strict';var express=require(_0x0264('0x0'));var router=express[_0x0264('0x1')]();var controller=require(_0x0264('0x2'));router['post']('/',controller[_0x0264('0x3')]);router[_0x0264('0x4')](_0x0264('0x5'),controller[_0x0264('0x6')]);router[_0x0264('0x4')](_0x0264('0x7'),controller['reset']);module[_0x0264('0x8')]=router; \ No newline at end of file +var _0xa0d4=['./authLocal.controller','post','login','forgot','reset','express'];(function(_0x1ad901,_0x852d9e){var _0x3c0249=function(_0x319eda){while(--_0x319eda){_0x1ad901['push'](_0x1ad901['shift']());}};_0x3c0249(++_0x852d9e);}(_0xa0d4,0xb9));var _0x4a0d=function(_0x57107e,_0x1f62aa){_0x57107e=_0x57107e-0x0;var _0x42c270=_0xa0d4[_0x57107e];return _0x42c270;};'use strict';var express=require(_0x4a0d('0x0'));var router=express['Router']();var controller=require(_0x4a0d('0x1'));router[_0x4a0d('0x2')]('/',controller[_0x4a0d('0x3')]);router[_0x4a0d('0x2')]('/forgot',controller[_0x4a0d('0x4')]);router[_0x4a0d('0x2')]('/reset/:token',controller[_0x4a0d('0x5')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index e14199a..d240347 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 _0xe8ae=['INTEGER','sequelize','exports','STRING'];(function(_0x4c7b0b,_0x2151a3){var _0x387dc2=function(_0x148a05){while(--_0x148a05){_0x4c7b0b['push'](_0x4c7b0b['shift']());}};_0x387dc2(++_0x2151a3);}(_0xe8ae,0xd9));var _0xee8a=function(_0x77d602,_0x2adebe){_0x77d602=_0x77d602-0x0;var _0x377b21=_0xe8ae[_0x77d602];return _0x377b21;};'use strict';var Sequelize=require(_0xee8a('0x0'));module[_0xee8a('0x1')]={'name':{'type':Sequelize[_0xee8a('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xee8a('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xee8a('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x99db=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x40a12e,_0x1133bf){var _0x3289f5=function(_0x2cb6d6){while(--_0x2cb6d6){_0x40a12e['push'](_0x40a12e['shift']());}};_0x3289f5(++_0x1133bf);}(_0x99db,0xe1));var _0xb99d=function(_0x4a5f6c,_0x4f532e){_0x4a5f6c=_0x4a5f6c-0x0;var _0x281ffd=_0x99db[_0x4a5f6c];return _0x281ffd;};'use strict';var Sequelize=require(_0xb99d('0x0'));module[_0xb99d('0x1')]={'name':{'type':Sequelize[_0xb99d('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xb99d('0x2')]},'description':{'type':Sequelize[_0xb99d('0x2')]},'status':{'type':Sequelize[_0xb99d('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xb99d('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index af76a90..1f38d4c 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 _0xfa6c=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','error','name','send','index','Automation','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','then','includeAll','catch','show','rawAttributes','intersection','include','find','create','body','params','addConditions','Condition','ids','findOne','pick','getConditions','addActions','Action','omit','getActions','eml-format','rimraf','fast-json-patch','request-promise','mustache','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service'];(function(_0x40077a,_0x5f4803){var _0x46e572=function(_0x4abf86){while(--_0x4abf86){_0x40077a['push'](_0x40077a['shift']());}};_0x46e572(++_0x5f4803);}(_0xfa6c,0x183));var _0xcfa6=function(_0x26f8a6,_0x3717a9){_0x26f8a6=_0x26f8a6-0x0;var _0x2606cb=_0xfa6c[_0x26f8a6];return _0x2606cb;};'use strict';var emlformat=require(_0xcfa6('0x0'));var rimraf=require(_0xcfa6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcfa6('0x2'));var rp=require(_0xcfa6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcfa6('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xcfa6('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcfa6('0x6'));var _=require(_0xcfa6('0x7'));var squel=require('squel');var crypto=require(_0xcfa6('0x8'));var jsforce=require(_0xcfa6('0x9'));var deskjs=require(_0xcfa6('0xa'));var toCsv=require(_0xcfa6('0x5'));var querystring=require('querystring');var Papa=require(_0xcfa6('0xb'));var Redis=require('ioredis');var authService=require(_0xcfa6('0xc'));var qs=require(_0xcfa6('0xd'));var as=require(_0xcfa6('0xe'));var hardwareService=require(_0xcfa6('0xf'));var logger=require(_0xcfa6('0x10'))(_0xcfa6('0x11'));var utils=require(_0xcfa6('0x12'));var config=require(_0xcfa6('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xcfa6('0x14'))['db'];function respondWithStatusCode(_0x476af0,_0x566d77){_0x566d77=_0x566d77||0xcc;return function(_0xb0a253){if(_0xb0a253){return _0x476af0[_0xcfa6('0x15')](_0x566d77);}return _0x476af0['status'](_0x566d77)[_0xcfa6('0x16')]();};}function respondWithResult(_0x592e47,_0x21304f){_0x21304f=_0x21304f||0xc8;return function(_0x744d76){if(_0x744d76){return _0x592e47[_0xcfa6('0x17')](_0x21304f)['json'](_0x744d76);}};}function respondWithFilteredResult(_0x141ee2,_0x3baad9){return function(_0x416e3e){if(_0x416e3e){var _0x415261=typeof _0x3baad9['offset']===_0xcfa6('0x18')&&typeof _0x3baad9[_0xcfa6('0x19')]===_0xcfa6('0x18');var _0x2c615e=_0x416e3e[_0xcfa6('0x1a')];var _0x4d0f56=_0x415261?0x0:_0x3baad9[_0xcfa6('0x1b')];var _0x25e70d=_0x415261?_0x416e3e[_0xcfa6('0x1a')]:_0x3baad9[_0xcfa6('0x1b')]+_0x3baad9[_0xcfa6('0x19')];var _0x520574;if(_0x25e70d>=_0x2c615e){_0x25e70d=_0x2c615e;_0x520574=0xc8;}else{_0x520574=0xce;}_0x141ee2['status'](_0x520574);return _0x141ee2[_0xcfa6('0x1c')](_0xcfa6('0x1d'),_0x4d0f56+'-'+_0x25e70d+'/'+_0x2c615e)[_0xcfa6('0x1e')](_0x416e3e);}return null;};}function patchUpdates(_0x2793b7){return function(_0x3d018f){try{jsonpatch[_0xcfa6('0x1f')](_0x3d018f,_0x2793b7,!![]);}catch(_0x3c2d18){return BPromise[_0xcfa6('0x20')](_0x3c2d18);}return _0x3d018f[_0xcfa6('0x21')]();};}function saveUpdates(_0x39f439,_0x54dacd){return function(_0x304b92){if(_0x304b92){return _0x304b92[_0xcfa6('0x22')](_0x39f439)['then'](function(_0xe72149){return _0xe72149;});}return null;};}function removeEntity(_0x5efea2,_0x4665c7){return function(_0x3923c0){if(_0x3923c0){return _0x3923c0[_0xcfa6('0x23')]()['then'](function(){_0x5efea2[_0xcfa6('0x17')](0xcc)[_0xcfa6('0x16')]();});}};}function handleEntityNotFound(_0x14bdba,_0x116671){return function(_0x45765a){if(!_0x45765a){_0x14bdba[_0xcfa6('0x15')](0x194);}return _0x45765a;};}function handleError(_0x54783a,_0x4e8964){_0x4e8964=_0x4e8964||0x1f4;return function(_0x20a66d){logger[_0xcfa6('0x24')](_0x20a66d['stack']);if(_0x20a66d[_0xcfa6('0x25')]){delete _0x20a66d[_0xcfa6('0x25')];}_0x54783a[_0xcfa6('0x17')](_0x4e8964)[_0xcfa6('0x26')](_0x20a66d);};}exports[_0xcfa6('0x27')]=function(_0x12bed5,_0x22c054){var _0xf7e1e5={},_0x517c1e={},_0x5abe42={'count':0x0,'rows':[]};var _0x375a7f=_['map'](db[_0xcfa6('0x28')]['rawAttributes'],function(_0xb8bc1c){return{'name':_0xb8bc1c['fieldName'],'type':_0xb8bc1c[_0xcfa6('0x29')][_0xcfa6('0x2a')]};});_0x517c1e[_0xcfa6('0x2b')]=_[_0xcfa6('0x2c')](_0x375a7f,_0xcfa6('0x25'));_0x517c1e[_0xcfa6('0x2d')]=_[_0xcfa6('0x2e')](_0x12bed5[_0xcfa6('0x2d')]);_0x517c1e[_0xcfa6('0x2f')]=_['intersection'](_0x517c1e['model'],_0x517c1e[_0xcfa6('0x2d')]);_0xf7e1e5[_0xcfa6('0x30')]=_['intersection'](_0x517c1e[_0xcfa6('0x2b')],qs[_0xcfa6('0x31')](_0x12bed5[_0xcfa6('0x2d')][_0xcfa6('0x31')]));_0xf7e1e5[_0xcfa6('0x30')]=_0xf7e1e5[_0xcfa6('0x30')][_0xcfa6('0x32')]?_0xf7e1e5[_0xcfa6('0x30')]:_0x517c1e[_0xcfa6('0x2b')];if(!_0x12bed5[_0xcfa6('0x2d')][_0xcfa6('0x33')](_0xcfa6('0x34'))){_0xf7e1e5['limit']=qs[_0xcfa6('0x19')](_0x12bed5[_0xcfa6('0x2d')][_0xcfa6('0x19')]);_0xf7e1e5['offset']=qs[_0xcfa6('0x1b')](_0x12bed5[_0xcfa6('0x2d')][_0xcfa6('0x1b')]);}_0xf7e1e5[_0xcfa6('0x35')]=qs[_0xcfa6('0x36')](_0x12bed5['query']['sort']);_0xf7e1e5['where']=qs['filters'](_['pick'](_0x12bed5[_0xcfa6('0x2d')],_0x517c1e['filters']),_0x375a7f);if(_0x12bed5[_0xcfa6('0x2d')][_0xcfa6('0x37')]){_0xf7e1e5[_0xcfa6('0x38')]=_[_0xcfa6('0x39')](_0xf7e1e5[_0xcfa6('0x38')],{'$or':_[_0xcfa6('0x2c')](_0x375a7f,function(_0x1e43ff){if(_0x1e43ff['type']!=='VIRTUAL'){var _0x4283fa={};_0x4283fa[_0x1e43ff[_0xcfa6('0x25')]]={'$like':'%'+_0x12bed5['query'][_0xcfa6('0x37')]+'%'};return _0x4283fa;}})});}_0xf7e1e5=_[_0xcfa6('0x39')]({},_0xf7e1e5,_0x12bed5[_0xcfa6('0x3a')]);var _0x30762f={'where':_0xf7e1e5[_0xcfa6('0x38')]};return db[_0xcfa6('0x28')][_0xcfa6('0x1a')](_0x30762f)[_0xcfa6('0x3b')](function(_0x402962){_0x5abe42[_0xcfa6('0x1a')]=_0x402962;if(_0x12bed5[_0xcfa6('0x2d')][_0xcfa6('0x3c')]){_0xf7e1e5['include']=[{'all':!![]}];}return db[_0xcfa6('0x28')]['findAll'](_0xf7e1e5);})['then'](function(_0x33c9ab){_0x5abe42['rows']=_0x33c9ab;return _0x5abe42;})['then'](respondWithFilteredResult(_0x22c054,_0xf7e1e5))[_0xcfa6('0x3d')](handleError(_0x22c054,null));};exports[_0xcfa6('0x3e')]=function(_0x1b3118,_0x3b02c4){var _0x4c7411={'raw':![],'where':{'id':_0x1b3118['params']['id']}},_0x3f451a={};_0x3f451a[_0xcfa6('0x2b')]=_['keys'](db[_0xcfa6('0x28')][_0xcfa6('0x3f')]);_0x3f451a[_0xcfa6('0x2d')]=_[_0xcfa6('0x2e')](_0x1b3118[_0xcfa6('0x2d')]);_0x3f451a[_0xcfa6('0x2f')]=_[_0xcfa6('0x40')](_0x3f451a[_0xcfa6('0x2b')],_0x3f451a['query']);_0x4c7411[_0xcfa6('0x30')]=_[_0xcfa6('0x40')](_0x3f451a[_0xcfa6('0x2b')],qs[_0xcfa6('0x31')](_0x1b3118[_0xcfa6('0x2d')][_0xcfa6('0x31')]));_0x4c7411[_0xcfa6('0x30')]=_0x4c7411[_0xcfa6('0x30')][_0xcfa6('0x32')]?_0x4c7411[_0xcfa6('0x30')]:_0x3f451a[_0xcfa6('0x2b')];if(_0x1b3118['query'][_0xcfa6('0x3c')]){_0x4c7411[_0xcfa6('0x41')]=[{'all':!![]}];}_0x4c7411=_[_0xcfa6('0x39')]({},_0x4c7411,_0x1b3118['options']);return db['Automation'][_0xcfa6('0x42')](_0x4c7411)[_0xcfa6('0x3b')](handleEntityNotFound(_0x3b02c4,null))[_0xcfa6('0x3b')](respondWithResult(_0x3b02c4,null))[_0xcfa6('0x3d')](handleError(_0x3b02c4,null));};exports['create']=function(_0x2fa682,_0x494c87){return db[_0xcfa6('0x28')][_0xcfa6('0x43')](_0x2fa682[_0xcfa6('0x44')],{})[_0xcfa6('0x3b')](respondWithResult(_0x494c87,0xc9))[_0xcfa6('0x3d')](handleError(_0x494c87,null));};exports[_0xcfa6('0x22')]=function(_0x540a20,_0x564a5e){if(_0x540a20['body']['id']){delete _0x540a20[_0xcfa6('0x44')]['id'];}return db[_0xcfa6('0x28')][_0xcfa6('0x42')]({'where':{'id':_0x540a20[_0xcfa6('0x45')]['id']}})[_0xcfa6('0x3b')](handleEntityNotFound(_0x564a5e,null))[_0xcfa6('0x3b')](saveUpdates(_0x540a20[_0xcfa6('0x44')],null))[_0xcfa6('0x3b')](respondWithResult(_0x564a5e,null))[_0xcfa6('0x3d')](handleError(_0x564a5e,null));};exports['destroy']=function(_0x32e770,_0x5acf39){return db['Automation'][_0xcfa6('0x42')]({'where':{'id':_0x32e770[_0xcfa6('0x45')]['id']}})['then'](handleEntityNotFound(_0x5acf39,null))[_0xcfa6('0x3b')](removeEntity(_0x5acf39,null))[_0xcfa6('0x3d')](handleError(_0x5acf39,null));};exports[_0xcfa6('0x46')]=function(_0x2eb72e,_0x15f128,_0x3bc234){return db[_0xcfa6('0x47')][_0xcfa6('0x42')]({'where':{'id':_0x2eb72e[_0xcfa6('0x45')]['id']}})[_0xcfa6('0x3b')](handleEntityNotFound(_0x15f128,null))[_0xcfa6('0x3b')](function(_0x1e4ab4){if(_0x1e4ab4){return _0x1e4ab4[_0xcfa6('0x46')](_0x2eb72e[_0xcfa6('0x44')][_0xcfa6('0x48')],_['omit'](_0x2eb72e[_0xcfa6('0x44')],[_0xcfa6('0x48'),'id'])||{});}})[_0xcfa6('0x3b')](respondWithResult(_0x15f128,null))[_0xcfa6('0x3d')](handleError(_0x15f128,null));};exports['getConditions']=function(_0x55e1e6,_0xc450b,_0x54a9b3){var _0x2fc46e={};var _0x6e3bd0={};var _0x42bbc7;var _0x489b9e;return db[_0xcfa6('0x28')][_0xcfa6('0x49')]({'where':{'id':_0x55e1e6[_0xcfa6('0x45')]['id']}})[_0xcfa6('0x3b')](handleEntityNotFound(_0xc450b,null))[_0xcfa6('0x3b')](function(_0x330d4b){if(_0x330d4b){_0x42bbc7=_0x330d4b;_0x6e3bd0[_0xcfa6('0x2b')]=_[_0xcfa6('0x2e')](db[_0xcfa6('0x47')][_0xcfa6('0x3f')]);_0x6e3bd0[_0xcfa6('0x2d')]=_[_0xcfa6('0x2e')](_0x55e1e6[_0xcfa6('0x2d')]);_0x6e3bd0[_0xcfa6('0x2f')]=_[_0xcfa6('0x40')](_0x6e3bd0[_0xcfa6('0x2b')],_0x6e3bd0[_0xcfa6('0x2d')]);_0x2fc46e['attributes']=_[_0xcfa6('0x40')](_0x6e3bd0['model'],qs[_0xcfa6('0x31')](_0x55e1e6[_0xcfa6('0x2d')][_0xcfa6('0x31')]));_0x2fc46e[_0xcfa6('0x30')]=_0x2fc46e[_0xcfa6('0x30')]['length']?_0x2fc46e[_0xcfa6('0x30')]:_0x6e3bd0['model'];_0x2fc46e[_0xcfa6('0x35')]=qs['sort'](_0x55e1e6['query'][_0xcfa6('0x36')]);_0x2fc46e[_0xcfa6('0x38')]=qs[_0xcfa6('0x2f')](_[_0xcfa6('0x4a')](_0x55e1e6[_0xcfa6('0x2d')],_0x6e3bd0[_0xcfa6('0x2f')]));if(_0x55e1e6['query'][_0xcfa6('0x37')]){_0x2fc46e[_0xcfa6('0x38')]=_['merge'](_0x2fc46e['where'],{'$or':_[_0xcfa6('0x2c')](_0x2fc46e[_0xcfa6('0x30')],function(_0x366530){var _0x55144a={};_0x55144a[_0x366530]={'$like':'%'+_0x55e1e6[_0xcfa6('0x2d')][_0xcfa6('0x37')]+'%'};return _0x55144a;})});}_0x2fc46e=_['merge']({},_0x2fc46e,_0x55e1e6[_0xcfa6('0x3a')]);return _0x42bbc7[_0xcfa6('0x4b')](_0x2fc46e);}})[_0xcfa6('0x3b')](function(_0x1283f8){if(_0x1283f8){_0x489b9e=_0x1283f8[_0xcfa6('0x32')];if(!_0x55e1e6[_0xcfa6('0x2d')]['hasOwnProperty']('nolimit')){_0x2fc46e[_0xcfa6('0x19')]=qs[_0xcfa6('0x19')](_0x55e1e6[_0xcfa6('0x2d')][_0xcfa6('0x19')]);_0x2fc46e[_0xcfa6('0x1b')]=qs['offset'](_0x55e1e6['query']['offset']);}return _0x42bbc7[_0xcfa6('0x4b')](_0x2fc46e);}})['then'](function(_0x322fb8){if(_0x322fb8){return _0x322fb8?{'count':_0x489b9e,'rows':_0x322fb8}:null;}})[_0xcfa6('0x3b')](respondWithResult(_0xc450b,null))['catch'](handleError(_0xc450b,null));};exports[_0xcfa6('0x4c')]=function(_0x50852e,_0x5b52a8,_0x13a1ec){return db[_0xcfa6('0x4d')]['find']({'where':{'id':_0x50852e[_0xcfa6('0x45')]['id']}})[_0xcfa6('0x3b')](handleEntityNotFound(_0x5b52a8,null))[_0xcfa6('0x3b')](function(_0xefc71a){if(_0xefc71a){return _0xefc71a[_0xcfa6('0x4c')](_0x50852e['body'][_0xcfa6('0x48')],_[_0xcfa6('0x4e')](_0x50852e[_0xcfa6('0x44')],[_0xcfa6('0x48'),'id'])||{});}})['then'](respondWithResult(_0x5b52a8,null))[_0xcfa6('0x3d')](handleError(_0x5b52a8,null));};exports[_0xcfa6('0x4f')]=function(_0x2851c2,_0x4a4f8c,_0x487258){var _0xc94991={};var _0x14ae5a={};var _0x2980c2;var _0x4a4d74;return db[_0xcfa6('0x28')][_0xcfa6('0x49')]({'where':{'id':_0x2851c2['params']['id']}})['then'](handleEntityNotFound(_0x4a4f8c,null))['then'](function(_0x53c64a){if(_0x53c64a){_0x2980c2=_0x53c64a;_0x14ae5a[_0xcfa6('0x2b')]=_['keys'](db['Action'][_0xcfa6('0x3f')]);_0x14ae5a['query']=_[_0xcfa6('0x2e')](_0x2851c2[_0xcfa6('0x2d')]);_0x14ae5a[_0xcfa6('0x2f')]=_[_0xcfa6('0x40')](_0x14ae5a[_0xcfa6('0x2b')],_0x14ae5a[_0xcfa6('0x2d')]);_0xc94991[_0xcfa6('0x30')]=_[_0xcfa6('0x40')](_0x14ae5a[_0xcfa6('0x2b')],qs[_0xcfa6('0x31')](_0x2851c2[_0xcfa6('0x2d')][_0xcfa6('0x31')]));_0xc94991[_0xcfa6('0x30')]=_0xc94991[_0xcfa6('0x30')]['length']?_0xc94991[_0xcfa6('0x30')]:_0x14ae5a[_0xcfa6('0x2b')];_0xc94991[_0xcfa6('0x35')]=qs['sort'](_0x2851c2['query'][_0xcfa6('0x36')]);_0xc94991[_0xcfa6('0x38')]=qs[_0xcfa6('0x2f')](_['pick'](_0x2851c2[_0xcfa6('0x2d')],_0x14ae5a[_0xcfa6('0x2f')]));if(_0x2851c2['query'][_0xcfa6('0x37')]){_0xc94991[_0xcfa6('0x38')]=_[_0xcfa6('0x39')](_0xc94991[_0xcfa6('0x38')],{'$or':_[_0xcfa6('0x2c')](_0xc94991[_0xcfa6('0x30')],function(_0x189326){var _0x5be985={};_0x5be985[_0x189326]={'$like':'%'+_0x2851c2[_0xcfa6('0x2d')][_0xcfa6('0x37')]+'%'};return _0x5be985;})});}_0xc94991=_[_0xcfa6('0x39')]({},_0xc94991,_0x2851c2[_0xcfa6('0x3a')]);return _0x2980c2['getActions'](_0xc94991);}})[_0xcfa6('0x3b')](function(_0x3d196f){if(_0x3d196f){_0x4a4d74=_0x3d196f[_0xcfa6('0x32')];if(!_0x2851c2[_0xcfa6('0x2d')][_0xcfa6('0x33')]('nolimit')){_0xc94991[_0xcfa6('0x19')]=qs[_0xcfa6('0x19')](_0x2851c2[_0xcfa6('0x2d')]['limit']);_0xc94991[_0xcfa6('0x1b')]=qs[_0xcfa6('0x1b')](_0x2851c2[_0xcfa6('0x2d')][_0xcfa6('0x1b')]);}return _0x2980c2[_0xcfa6('0x4f')](_0xc94991);}})[_0xcfa6('0x3b')](function(_0x40acb0){if(_0x40acb0){return _0x40acb0?{'count':_0x4a4d74,'rows':_0x40acb0}:null;}})['then'](respondWithResult(_0x4a4f8c,null))[_0xcfa6('0x3d')](handleError(_0x4a4f8c,null));}; \ No newline at end of file +var _0x8ae9=['nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','Automation','findAll','rows','catch','show','params','find','body','destroy','addConditions','Condition','ids','omit','getConditions','hasOwnProperty','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','rawAttributes','type','key','keys','intersection','model','attributes','fields','length','query'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x8ae9,0xcc));var _0x98ae=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8ae9[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x98ae('0x0'));var rimraf=require(_0x98ae('0x1'));var zipdir=require(_0x98ae('0x2'));var jsonpatch=require(_0x98ae('0x3'));var rp=require(_0x98ae('0x4'));var moment=require(_0x98ae('0x5'));var BPromise=require(_0x98ae('0x6'));var Mustache=require(_0x98ae('0x7'));var util=require(_0x98ae('0x8'));var path=require('path');var sox=require(_0x98ae('0x9'));var csv=require('to-csv');var ejs=require(_0x98ae('0xa'));var fs=require('fs');var fs_extra=require(_0x98ae('0xb'));var _=require(_0x98ae('0xc'));var squel=require(_0x98ae('0xd'));var crypto=require(_0x98ae('0xe'));var jsforce=require(_0x98ae('0xf'));var deskjs=require(_0x98ae('0x10'));var toCsv=require(_0x98ae('0x11'));var querystring=require(_0x98ae('0x12'));var Papa=require(_0x98ae('0x13'));var Redis=require(_0x98ae('0x14'));var authService=require(_0x98ae('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x98ae('0x16'));var hardwareService=require(_0x98ae('0x17'));var logger=require(_0x98ae('0x18'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x98ae('0x19'));var db=require(_0x98ae('0x1a'))['db'];function respondWithStatusCode(_0x253300,_0x49f76f){_0x49f76f=_0x49f76f||0xcc;return function(_0x191cff){if(_0x191cff){return _0x253300[_0x98ae('0x1b')](_0x49f76f);}return _0x253300[_0x98ae('0x1c')](_0x49f76f)[_0x98ae('0x1d')]();};}function respondWithResult(_0xc475d0,_0x24cd05){_0x24cd05=_0x24cd05||0xc8;return function(_0x458314){if(_0x458314){return _0xc475d0[_0x98ae('0x1c')](_0x24cd05)[_0x98ae('0x1e')](_0x458314);}};}function respondWithFilteredResult(_0x415ed4,_0x2bbba1){return function(_0xaab170){if(_0xaab170){var _0x5481a6=typeof _0x2bbba1[_0x98ae('0x1f')]===_0x98ae('0x20')&&typeof _0x2bbba1[_0x98ae('0x21')]===_0x98ae('0x20');var _0x1289c9=_0xaab170['count'];var _0x4482e4=_0x5481a6?0x0:_0x2bbba1[_0x98ae('0x1f')];var _0x521051=_0x5481a6?_0xaab170[_0x98ae('0x22')]:_0x2bbba1[_0x98ae('0x1f')]+_0x2bbba1[_0x98ae('0x21')];var _0x30f1d7;if(_0x521051>=_0x1289c9){_0x521051=_0x1289c9;_0x30f1d7=0xc8;}else{_0x30f1d7=0xce;}_0x415ed4['status'](_0x30f1d7);return _0x415ed4[_0x98ae('0x23')](_0x98ae('0x24'),_0x4482e4+'-'+_0x521051+'/'+_0x1289c9)[_0x98ae('0x1e')](_0xaab170);}return null;};}function patchUpdates(_0xe39f01){return function(_0x2418fe){try{jsonpatch[_0x98ae('0x25')](_0x2418fe,_0xe39f01,!![]);}catch(_0x23cfc3){return BPromise[_0x98ae('0x26')](_0x23cfc3);}return _0x2418fe[_0x98ae('0x27')]();};}function saveUpdates(_0x24ff84,_0x5d5e59){return function(_0x5938d5){if(_0x5938d5){return _0x5938d5[_0x98ae('0x28')](_0x24ff84)[_0x98ae('0x29')](function(_0x18ee46){return _0x18ee46;});}return null;};}function removeEntity(_0x85a0a7,_0x41c352){return function(_0x4d7ec7){if(_0x4d7ec7){return _0x4d7ec7['destroy']()[_0x98ae('0x29')](function(){_0x85a0a7[_0x98ae('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b14b1,_0x13d0da){return function(_0x4ff87c){if(!_0x4ff87c){_0x4b14b1[_0x98ae('0x1b')](0x194);}return _0x4ff87c;};}function handleError(_0x5f2e0d,_0xa8248){_0xa8248=_0xa8248||0x1f4;return function(_0x56fcd4){logger[_0x98ae('0x2a')](_0x56fcd4[_0x98ae('0x2b')]);if(_0x56fcd4[_0x98ae('0x2c')]){delete _0x56fcd4[_0x98ae('0x2c')];}_0x5f2e0d['status'](_0xa8248)[_0x98ae('0x2d')](_0x56fcd4);};}exports['index']=function(_0x223b4d,_0x1e6b3c){var _0x5d5949={},_0x1059b2={},_0x54c896={'count':0x0,'rows':[]};var _0x44108c=_[_0x98ae('0x2e')](db['Automation'][_0x98ae('0x2f')],function(_0x12a8f2){return{'name':_0x12a8f2['fieldName'],'type':_0x12a8f2[_0x98ae('0x30')][_0x98ae('0x31')]};});_0x1059b2['model']=_['map'](_0x44108c,_0x98ae('0x2c'));_0x1059b2['query']=_[_0x98ae('0x32')](_0x223b4d['query']);_0x1059b2['filters']=_[_0x98ae('0x33')](_0x1059b2[_0x98ae('0x34')],_0x1059b2['query']);_0x5d5949[_0x98ae('0x35')]=_[_0x98ae('0x33')](_0x1059b2['model'],qs[_0x98ae('0x36')](_0x223b4d['query'][_0x98ae('0x36')]));_0x5d5949[_0x98ae('0x35')]=_0x5d5949['attributes'][_0x98ae('0x37')]?_0x5d5949[_0x98ae('0x35')]:_0x1059b2[_0x98ae('0x34')];if(!_0x223b4d[_0x98ae('0x38')]['hasOwnProperty'](_0x98ae('0x39'))){_0x5d5949[_0x98ae('0x21')]=qs['limit'](_0x223b4d[_0x98ae('0x38')][_0x98ae('0x21')]);_0x5d5949[_0x98ae('0x1f')]=qs[_0x98ae('0x1f')](_0x223b4d[_0x98ae('0x38')][_0x98ae('0x1f')]);}_0x5d5949[_0x98ae('0x3a')]=qs['sort'](_0x223b4d[_0x98ae('0x38')][_0x98ae('0x3b')]);_0x5d5949[_0x98ae('0x3c')]=qs[_0x98ae('0x3d')](_[_0x98ae('0x3e')](_0x223b4d[_0x98ae('0x38')],_0x1059b2['filters']),_0x44108c);if(_0x223b4d[_0x98ae('0x38')]['filter']){_0x5d5949[_0x98ae('0x3c')]=_[_0x98ae('0x3f')](_0x5d5949['where'],{'$or':_[_0x98ae('0x2e')](_0x44108c,function(_0xfed004){if(_0xfed004['type']!==_0x98ae('0x40')){var _0x39ae3e={};_0x39ae3e[_0xfed004[_0x98ae('0x2c')]]={'$like':'%'+_0x223b4d[_0x98ae('0x38')][_0x98ae('0x41')]+'%'};return _0x39ae3e;}})});}_0x5d5949=_[_0x98ae('0x3f')]({},_0x5d5949,_0x223b4d[_0x98ae('0x42')]);var _0x193526={'where':_0x5d5949['where']};return db['Automation'][_0x98ae('0x22')](_0x193526)[_0x98ae('0x29')](function(_0x4f48b7){_0x54c896[_0x98ae('0x22')]=_0x4f48b7;if(_0x223b4d[_0x98ae('0x38')][_0x98ae('0x43')]){_0x5d5949[_0x98ae('0x44')]=[{'all':!![]}];}return db[_0x98ae('0x45')][_0x98ae('0x46')](_0x5d5949);})[_0x98ae('0x29')](function(_0x4fcafe){_0x54c896[_0x98ae('0x47')]=_0x4fcafe;return _0x54c896;})['then'](respondWithFilteredResult(_0x1e6b3c,_0x5d5949))[_0x98ae('0x48')](handleError(_0x1e6b3c,null));};exports[_0x98ae('0x49')]=function(_0x12518f,_0x109cde){var _0x47e046={'raw':![],'where':{'id':_0x12518f[_0x98ae('0x4a')]['id']}},_0x29187b={};_0x29187b[_0x98ae('0x34')]=_[_0x98ae('0x32')](db[_0x98ae('0x45')][_0x98ae('0x2f')]);_0x29187b['query']=_[_0x98ae('0x32')](_0x12518f[_0x98ae('0x38')]);_0x29187b[_0x98ae('0x3d')]=_[_0x98ae('0x33')](_0x29187b[_0x98ae('0x34')],_0x29187b['query']);_0x47e046[_0x98ae('0x35')]=_['intersection'](_0x29187b[_0x98ae('0x34')],qs['fields'](_0x12518f[_0x98ae('0x38')][_0x98ae('0x36')]));_0x47e046['attributes']=_0x47e046[_0x98ae('0x35')]['length']?_0x47e046[_0x98ae('0x35')]:_0x29187b[_0x98ae('0x34')];if(_0x12518f['query'][_0x98ae('0x43')]){_0x47e046[_0x98ae('0x44')]=[{'all':!![]}];}_0x47e046=_[_0x98ae('0x3f')]({},_0x47e046,_0x12518f['options']);return db[_0x98ae('0x45')][_0x98ae('0x4b')](_0x47e046)[_0x98ae('0x29')](handleEntityNotFound(_0x109cde,null))[_0x98ae('0x29')](respondWithResult(_0x109cde,null))[_0x98ae('0x48')](handleError(_0x109cde,null));};exports['create']=function(_0x54725c,_0x574d41){return db[_0x98ae('0x45')]['create'](_0x54725c[_0x98ae('0x4c')],{})[_0x98ae('0x29')](respondWithResult(_0x574d41,0xc9))[_0x98ae('0x48')](handleError(_0x574d41,null));};exports[_0x98ae('0x28')]=function(_0x3b02fd,_0x59cfd6){if(_0x3b02fd[_0x98ae('0x4c')]['id']){delete _0x3b02fd[_0x98ae('0x4c')]['id'];}return db[_0x98ae('0x45')][_0x98ae('0x4b')]({'where':{'id':_0x3b02fd[_0x98ae('0x4a')]['id']}})[_0x98ae('0x29')](handleEntityNotFound(_0x59cfd6,null))['then'](saveUpdates(_0x3b02fd[_0x98ae('0x4c')],null))[_0x98ae('0x29')](respondWithResult(_0x59cfd6,null))[_0x98ae('0x48')](handleError(_0x59cfd6,null));};exports[_0x98ae('0x4d')]=function(_0x5470e2,_0x2373af){return db['Automation'][_0x98ae('0x4b')]({'where':{'id':_0x5470e2['params']['id']}})['then'](handleEntityNotFound(_0x2373af,null))['then'](removeEntity(_0x2373af,null))[_0x98ae('0x48')](handleError(_0x2373af,null));};exports[_0x98ae('0x4e')]=function(_0x13cf8b,_0x3c1237,_0x33bc57){return db[_0x98ae('0x4f')][_0x98ae('0x4b')]({'where':{'id':_0x13cf8b[_0x98ae('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3c1237,null))[_0x98ae('0x29')](function(_0x2f7a57){if(_0x2f7a57){return _0x2f7a57[_0x98ae('0x4e')](_0x13cf8b[_0x98ae('0x4c')][_0x98ae('0x50')],_[_0x98ae('0x51')](_0x13cf8b[_0x98ae('0x4c')],[_0x98ae('0x50'),'id'])||{});}})[_0x98ae('0x29')](respondWithResult(_0x3c1237,null))[_0x98ae('0x48')](handleError(_0x3c1237,null));};exports[_0x98ae('0x52')]=function(_0x591a7f,_0x1d2c79,_0x45c254){var _0x44172e={};var _0x865ef4={};var _0x17ff5c;var _0x2b397d;return db[_0x98ae('0x45')]['findOne']({'where':{'id':_0x591a7f[_0x98ae('0x4a')]['id']}})[_0x98ae('0x29')](handleEntityNotFound(_0x1d2c79,null))[_0x98ae('0x29')](function(_0x119658){if(_0x119658){_0x17ff5c=_0x119658;_0x865ef4[_0x98ae('0x34')]=_[_0x98ae('0x32')](db[_0x98ae('0x4f')]['rawAttributes']);_0x865ef4[_0x98ae('0x38')]=_[_0x98ae('0x32')](_0x591a7f[_0x98ae('0x38')]);_0x865ef4['filters']=_[_0x98ae('0x33')](_0x865ef4[_0x98ae('0x34')],_0x865ef4[_0x98ae('0x38')]);_0x44172e['attributes']=_[_0x98ae('0x33')](_0x865ef4[_0x98ae('0x34')],qs['fields'](_0x591a7f[_0x98ae('0x38')][_0x98ae('0x36')]));_0x44172e[_0x98ae('0x35')]=_0x44172e[_0x98ae('0x35')]['length']?_0x44172e[_0x98ae('0x35')]:_0x865ef4[_0x98ae('0x34')];_0x44172e[_0x98ae('0x3a')]=qs[_0x98ae('0x3b')](_0x591a7f[_0x98ae('0x38')][_0x98ae('0x3b')]);_0x44172e[_0x98ae('0x3c')]=qs['filters'](_[_0x98ae('0x3e')](_0x591a7f[_0x98ae('0x38')],_0x865ef4[_0x98ae('0x3d')]));if(_0x591a7f['query'][_0x98ae('0x41')]){_0x44172e[_0x98ae('0x3c')]=_[_0x98ae('0x3f')](_0x44172e[_0x98ae('0x3c')],{'$or':_[_0x98ae('0x2e')](_0x44172e[_0x98ae('0x35')],function(_0x2fef75){var _0x2635f0={};_0x2635f0[_0x2fef75]={'$like':'%'+_0x591a7f[_0x98ae('0x38')]['filter']+'%'};return _0x2635f0;})});}_0x44172e=_['merge']({},_0x44172e,_0x591a7f[_0x98ae('0x42')]);return _0x17ff5c['getConditions'](_0x44172e);}})['then'](function(_0x54aa71){if(_0x54aa71){_0x2b397d=_0x54aa71[_0x98ae('0x37')];if(!_0x591a7f['query'][_0x98ae('0x53')](_0x98ae('0x39'))){_0x44172e[_0x98ae('0x21')]=qs[_0x98ae('0x21')](_0x591a7f[_0x98ae('0x38')][_0x98ae('0x21')]);_0x44172e[_0x98ae('0x1f')]=qs[_0x98ae('0x1f')](_0x591a7f['query'][_0x98ae('0x1f')]);}return _0x17ff5c[_0x98ae('0x52')](_0x44172e);}})[_0x98ae('0x29')](function(_0x474028){if(_0x474028){return _0x474028?{'count':_0x2b397d,'rows':_0x474028}:null;}})[_0x98ae('0x29')](respondWithResult(_0x1d2c79,null))[_0x98ae('0x48')](handleError(_0x1d2c79,null));};exports[_0x98ae('0x54')]=function(_0x32e1d3,_0xeb1b81,_0x1e454d){return db[_0x98ae('0x55')]['find']({'where':{'id':_0x32e1d3[_0x98ae('0x4a')]['id']}})['then'](handleEntityNotFound(_0xeb1b81,null))[_0x98ae('0x29')](function(_0x9d0b40){if(_0x9d0b40){return _0x9d0b40[_0x98ae('0x54')](_0x32e1d3[_0x98ae('0x4c')][_0x98ae('0x50')],_[_0x98ae('0x51')](_0x32e1d3[_0x98ae('0x4c')],[_0x98ae('0x50'),'id'])||{});}})[_0x98ae('0x29')](respondWithResult(_0xeb1b81,null))['catch'](handleError(_0xeb1b81,null));};exports['getActions']=function(_0x32697c,_0x325766,_0x5c2808){var _0x5eafbb={};var _0x161da8={};var _0x58541a;var _0x3fcd56;return db[_0x98ae('0x45')]['findOne']({'where':{'id':_0x32697c[_0x98ae('0x4a')]['id']}})[_0x98ae('0x29')](handleEntityNotFound(_0x325766,null))[_0x98ae('0x29')](function(_0x130e42){if(_0x130e42){_0x58541a=_0x130e42;_0x161da8[_0x98ae('0x34')]=_[_0x98ae('0x32')](db[_0x98ae('0x55')][_0x98ae('0x2f')]);_0x161da8[_0x98ae('0x38')]=_[_0x98ae('0x32')](_0x32697c[_0x98ae('0x38')]);_0x161da8[_0x98ae('0x3d')]=_['intersection'](_0x161da8['model'],_0x161da8[_0x98ae('0x38')]);_0x5eafbb[_0x98ae('0x35')]=_[_0x98ae('0x33')](_0x161da8['model'],qs[_0x98ae('0x36')](_0x32697c[_0x98ae('0x38')][_0x98ae('0x36')]));_0x5eafbb[_0x98ae('0x35')]=_0x5eafbb[_0x98ae('0x35')][_0x98ae('0x37')]?_0x5eafbb[_0x98ae('0x35')]:_0x161da8[_0x98ae('0x34')];_0x5eafbb[_0x98ae('0x3a')]=qs[_0x98ae('0x3b')](_0x32697c['query'][_0x98ae('0x3b')]);_0x5eafbb[_0x98ae('0x3c')]=qs[_0x98ae('0x3d')](_['pick'](_0x32697c['query'],_0x161da8[_0x98ae('0x3d')]));if(_0x32697c[_0x98ae('0x38')][_0x98ae('0x41')]){_0x5eafbb['where']=_['merge'](_0x5eafbb[_0x98ae('0x3c')],{'$or':_[_0x98ae('0x2e')](_0x5eafbb[_0x98ae('0x35')],function(_0x191a7f){var _0x3e5262={};_0x3e5262[_0x191a7f]={'$like':'%'+_0x32697c[_0x98ae('0x38')][_0x98ae('0x41')]+'%'};return _0x3e5262;})});}_0x5eafbb=_[_0x98ae('0x3f')]({},_0x5eafbb,_0x32697c['options']);return _0x58541a[_0x98ae('0x56')](_0x5eafbb);}})[_0x98ae('0x29')](function(_0x444fc7){if(_0x444fc7){_0x3fcd56=_0x444fc7[_0x98ae('0x37')];if(!_0x32697c['query'][_0x98ae('0x53')](_0x98ae('0x39'))){_0x5eafbb['limit']=qs[_0x98ae('0x21')](_0x32697c['query']['limit']);_0x5eafbb[_0x98ae('0x1f')]=qs[_0x98ae('0x1f')](_0x32697c[_0x98ae('0x38')][_0x98ae('0x1f')]);}return _0x58541a[_0x98ae('0x56')](_0x5eafbb);}})['then'](function(_0x34f281){if(_0x34f281){return _0x34f281?{'count':_0x3fcd56,'rows':_0x34f281}:null;}})[_0x98ae('0x29')](respondWithResult(_0x325766,null))[_0x98ae('0x48')](handleError(_0x325766,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 68fdcf1..c58c653 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 _0x89d8=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./automation.attributes','exports','define','Automation'];(function(_0x31747b,_0x4d1d3a){var _0x56639a=function(_0x8f8213){while(--_0x8f8213){_0x31747b['push'](_0x31747b['shift']());}};_0x56639a(++_0x4d1d3a);}(_0x89d8,0xa8));var _0x889d=function(_0x1893da,_0x2d0c72){_0x1893da=_0x1893da-0x0;var _0x2becec=_0x89d8[_0x1893da];return _0x2becec;};'use strict';var _=require(_0x889d('0x0'));var util=require(_0x889d('0x1'));var logger=require(_0x889d('0x2'))('api');var moment=require(_0x889d('0x3'));var BPromise=require(_0x889d('0x4'));var rp=require(_0x889d('0x5'));var fs=require('fs');var path=require(_0x889d('0x6'));var rimraf=require(_0x889d('0x7'));var config=require('../../config/environment');var attributes=require(_0x889d('0x8'));module[_0x889d('0x9')]=function(_0x40ef60,_0x22d0c3){return _0x40ef60[_0x889d('0xa')](_0x889d('0xb'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x542b=['./automation.attributes','exports','define','Automation','tools_automations','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x484c03,_0x13c1d2){var _0x294127=function(_0x45a834){while(--_0x45a834){_0x484c03['push'](_0x484c03['shift']());}};_0x294127(++_0x13c1d2);}(_0x542b,0x95));var _0xb542=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x542b[_0x5627e1];return _0x2f013f;};'use strict';var _=require(_0xb542('0x0'));var util=require(_0xb542('0x1'));var logger=require(_0xb542('0x2'))(_0xb542('0x3'));var moment=require('moment');var BPromise=require(_0xb542('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb542('0x5'));var rimraf=require(_0xb542('0x6'));var config=require('../../config/environment');var attributes=require(_0xb542('0x7'));module[_0xb542('0x8')]=function(_0x4c01e3,_0x5040be){return _0x4c01e3[_0xb542('0x9')](_0xb542('0xa'),attributes,{'tableName':_0xb542('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 4436c28..7f08ac6 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 _0x5453=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','request','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x59ea42,_0x4ddc78){var _0x1a24da=function(_0x3e90d1){while(--_0x3e90d1){_0x59ea42['push'](_0x59ea42['shift']());}};_0x1a24da(++_0x4ddc78);}(_0x5453,0x18b));var _0x3545=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x5453[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x3545('0x0'));var util=require(_0x3545('0x1'));var moment=require(_0x3545('0x2'));var BPromise=require(_0x3545('0x3'));var rs=require(_0x3545('0x4'));var fs=require('fs');var Redis=require(_0x3545('0x5'));var db=require(_0x3545('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3545('0x7'));var config=require(_0x3545('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3545('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x290aa5,_0x496d6b,_0x5d5808){return new BPromise(function(_0x2974ae,_0x3cf0cc){return client[_0x3545('0xa')](_0x290aa5,_0x5d5808)['then'](function(_0x21dc51){logger[_0x3545('0xb')](_0x3545('0xc'),_0x496d6b,_0x3545('0xd'));logger[_0x3545('0xe')](_0x3545('0xf'),_0x496d6b,_0x3545('0xd'),JSON['stringify'](_0x21dc51));if(_0x21dc51['error']){if(_0x21dc51[_0x3545('0x10')][_0x3545('0x11')]===0x1f4){logger[_0x3545('0x10')](_0x3545('0xc'),_0x496d6b,_0x21dc51['error']['message']);return _0x3cf0cc(_0x21dc51['error'][_0x3545('0x12')]);}logger[_0x3545('0x10')]('Automation,\x20%s,\x20%s',_0x496d6b,_0x21dc51[_0x3545('0x10')]['message']);return _0x2974ae(_0x21dc51['error'][_0x3545('0x12')]);}else{logger[_0x3545('0xb')]('Automation,\x20%s,\x20%s',_0x496d6b,_0x3545('0xd'));_0x2974ae(_0x21dc51[_0x3545('0x13')]['message']);}})[_0x3545('0x14')](function(_0x51f69b){logger[_0x3545('0x10')](_0x3545('0xc'),_0x496d6b,_0x51f69b);_0x3cf0cc(_0x51f69b);});});} \ No newline at end of file +var _0x084b=['message','result','catch','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3d465b,_0x41bdc3){var _0x46d229=function(_0x563be2){while(--_0x563be2){_0x3d465b['push'](_0x3d465b['shift']());}};_0x46d229(++_0x41bdc3);}(_0x084b,0xd5));var _0xb084=function(_0x297e7f,_0x454822){_0x297e7f=_0x297e7f-0x0;var _0x1fc8fb=_0x084b[_0x297e7f];return _0x1fc8fb;};'use strict';var _=require(_0xb084('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb084('0x1'));var fs=require('fs');var Redis=require(_0xb084('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xb084('0x3'));var logger=require(_0xb084('0x4'))(_0xb084('0x5'));var config=require('../../config/environment');var jayson=require(_0xb084('0x6'));var client=jayson['client'][_0xb084('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x449c7a,_0x275c8c,_0x4b69ad){return new BPromise(function(_0x4f45d2,_0x18a300){return client[_0xb084('0x8')](_0x449c7a,_0x4b69ad)[_0xb084('0x9')](function(_0xec1e0d){logger[_0xb084('0xa')](_0xb084('0xb'),_0x275c8c,_0xb084('0xc'));logger[_0xb084('0xd')](_0xb084('0xe'),_0x275c8c,_0xb084('0xc'),JSON[_0xb084('0xf')](_0xec1e0d));if(_0xec1e0d[_0xb084('0x10')]){if(_0xec1e0d[_0xb084('0x10')][_0xb084('0x11')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x275c8c,_0xec1e0d[_0xb084('0x10')]['message']);return _0x18a300(_0xec1e0d['error'][_0xb084('0x12')]);}logger[_0xb084('0x10')]('Automation,\x20%s,\x20%s',_0x275c8c,_0xec1e0d['error'][_0xb084('0x12')]);return _0x4f45d2(_0xec1e0d[_0xb084('0x10')][_0xb084('0x12')]);}else{logger[_0xb084('0xa')](_0xb084('0xb'),_0x275c8c,'request\x20sent');_0x4f45d2(_0xec1e0d[_0xb084('0x13')][_0xb084('0x12')]);}})[_0xb084('0x14')](function(_0xbcdb1f){logger[_0xb084('0x10')](_0xb084('0xb'),_0x275c8c,_0xbcdb1f);_0x18a300(_0xbcdb1f);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 89ee0b3..586a74d 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 _0x292e=['getConditions','/:id/actions','post','/:id/conditions','addConditions','addActions','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show'];(function(_0x99a8a7,_0x42b27c){var _0x21d8e0=function(_0x73188c){while(--_0x73188c){_0x99a8a7['push'](_0x99a8a7['shift']());}};_0x21d8e0(++_0x42b27c);}(_0x292e,0xcb));var _0xe292=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x292e[_0x465028];return _0xb783d4;};'use strict';var multer=require(_0xe292('0x0'));var util=require(_0xe292('0x1'));var path=require(_0xe292('0x2'));var timeout=require(_0xe292('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe292('0x4'));var auth=require(_0xe292('0x5'));var interaction=require(_0xe292('0x6'));var config=require(_0xe292('0x7'));var controller=require('./automation.controller');router[_0xe292('0x8')]('/',auth['isAuthenticated'](),controller[_0xe292('0x9')]);router[_0xe292('0x8')](_0xe292('0xa'),auth[_0xe292('0xb')](),controller[_0xe292('0xc')]);router[_0xe292('0x8')]('/:id/conditions',auth['isAuthenticated'](),controller[_0xe292('0xd')]);router[_0xe292('0x8')](_0xe292('0xe'),auth[_0xe292('0xb')](),controller['getActions']);router[_0xe292('0xf')]('/',auth[_0xe292('0xb')](),controller['create']);router[_0xe292('0xf')](_0xe292('0x10'),auth[_0xe292('0xb')](),controller[_0xe292('0x11')]);router[_0xe292('0xf')](_0xe292('0xe'),auth['isAuthenticated'](),controller[_0xe292('0x12')]);router[_0xe292('0x13')](_0xe292('0xa'),auth[_0xe292('0xb')](),controller[_0xe292('0x14')]);router[_0xe292('0x15')](_0xe292('0xa'),auth['isAuthenticated'](),controller[_0xe292('0x16')]);module[_0xe292('0x17')]=router; \ No newline at end of file +var _0x7531=['../../config/environment','./automation.controller','isAuthenticated','index','get','/:id','show','getConditions','/:id/actions','getActions','create','post','/:id/conditions','addConditions','addActions','delete','exports','multer','util','path','fs-extra','../../components/auth/service'];(function(_0x1529a3,_0x529f63){var _0x1a0d4b=function(_0x6f1058){while(--_0x6f1058){_0x1529a3['push'](_0x1529a3['shift']());}};_0x1a0d4b(++_0x529f63);}(_0x7531,0x69));var _0x1753=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7531[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1753('0x0'));var util=require(_0x1753('0x1'));var path=require(_0x1753('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x1753('0x3'));var auth=require(_0x1753('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1753('0x5'));var controller=require(_0x1753('0x6'));router['get']('/',auth[_0x1753('0x7')](),controller[_0x1753('0x8')]);router[_0x1753('0x9')](_0x1753('0xa'),auth[_0x1753('0x7')](),controller[_0x1753('0xb')]);router[_0x1753('0x9')]('/:id/conditions',auth[_0x1753('0x7')](),controller[_0x1753('0xc')]);router[_0x1753('0x9')](_0x1753('0xd'),auth[_0x1753('0x7')](),controller[_0x1753('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1753('0xf')]);router[_0x1753('0x10')](_0x1753('0x11'),auth[_0x1753('0x7')](),controller[_0x1753('0x12')]);router[_0x1753('0x10')](_0x1753('0xd'),auth[_0x1753('0x7')](),controller[_0x1753('0x13')]);router['put'](_0x1753('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x1753('0x14')](_0x1753('0xa'),auth[_0x1753('0x7')](),controller['destroy']);module[_0x1753('0x15')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index bb23b89..51c3073 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 _0xf404=['#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)','STRING','ivr','BOOLEAN','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\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)','ENUM','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)'];(function(_0x4b868c,_0x27456b){var _0x280c11=function(_0x3ea4ab){while(--_0x3ea4ab){_0x4b868c['push'](_0x4b868c['shift']());}};_0x280c11(++_0x27456b);}(_0xf404,0xe4));var _0x4f40=function(_0x56a679,_0xbdf67c){_0x56a679=_0x56a679-0x0;var _0x13b777=_0xf404[_0x56a679];return _0x13b777;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4f40('0x0')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':_0x4f40('0x1')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x4f40('0x2')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x4f40('0x3')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x4f40('0x4')},'dialOriginateCallerIdName':{'type':Sequelize[_0x4f40('0x0')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x4f40('0x5')](0x3)[_0x4f40('0x3')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4f40('0x6')},'dialCongestionMaxRetry':{'type':Sequelize[_0x4f40('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x4f40('0x5')](0x5)[_0x4f40('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4f40('0x7')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4f40('0x3')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4f40('0x8')},'dialBusyRetryFrequency':{'type':Sequelize[_0x4f40('0x5')](0x5)[_0x4f40('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4f40('0x9')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4f40('0x3')],'defaultValue':0x3,'comment':_0x4f40('0xa')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x4f40('0x5')](0x5)[_0x4f40('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4f40('0xb')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4f40('0x3')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x4f40('0xc')},'dialTimezone':{'type':Sequelize[_0x4f40('0x0')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x4f40('0x0')],'defaultValue':_0x4f40('0xd')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x4f40('0xe'),_0x4f40('0xf'),_0x4f40('0x10')),'defaultValue':_0x4f40('0xe')},'dialAMDActive':{'type':Sequelize[_0x4f40('0x2')],'defaultValue':0x0,'comment':_0x4f40('0x11')},'dialAMDInitialSilence':{'type':Sequelize[_0x4f40('0x5')](0x9)[_0x4f40('0x3')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x4f40('0x12')},'dialAMDGreeting':{'type':Sequelize[_0x4f40('0x5')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x4f40('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x4f40('0x5')](0x9)[_0x4f40('0x3')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x4f40('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x4f40('0x3')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4f40('0x15')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x4f40('0x3')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x4f40('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x4f40('0x5')](0x9)[_0x4f40('0x3')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x4f40('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x4f40('0x3')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x4f40('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x4f40('0x3')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x4f40('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x4f40('0x3')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x4f40('0x1a')](_0x4f40('0x1b'),_0x4f40('0x1c')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x4f40('0x5')](0x3)[_0x4f40('0x3')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4f40('0x1d')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x4f40('0x3')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4f40('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x4f40('0x5')](0x3)[_0x4f40('0x3')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x4f40('0x5')](0x3)[_0x4f40('0x3')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4f40('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0x4f40('0x5')](0x5)[_0x4f40('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4f40('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4f40('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4f40('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4f40('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x4f40('0x5')](0x3)[_0x4f40('0x3')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4f40('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0x4f40('0x5')](0x5)[_0x4f40('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4f40('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x4f40('0x5')](0x3)[_0x4f40('0x3')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4f40('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0x8897=['#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#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)','#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)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8897,0x132));var _0x7889=function(_0x4c3974,_0x42faee){_0x4c3974=_0x4c3974-0x0;var _0x5628d9=_0x8897[_0x4c3974];return _0x5628d9;};'use strict';var Sequelize=require(_0x7889('0x0'));module[_0x7889('0x1')]={'name':{'type':Sequelize[_0x7889('0x2')],'unique':_0x7889('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x7889('0x4')](_0x7889('0x5')),'allowNull':![],'defaultValue':_0x7889('0x5')},'description':{'type':Sequelize[_0x7889('0x2')]},'active':{'type':Sequelize[_0x7889('0x6')],'defaultValue':0x0,'comment':_0x7889('0x7')},'limitCalls':{'type':Sequelize[_0x7889('0x8')](0x4)[_0x7889('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x7889('0xa')},'dialOriginateCallerIdName':{'type':Sequelize[_0x7889('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x7889('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x7889('0x8')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7889('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0x7889('0x8')](0x3)[_0x7889('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x7889('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7889('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x7889('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7889('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x7889('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7889('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x7889('0x8')](0x3)[_0x7889('0x9')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x7889('0x8')](0x5)[_0x7889('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x7889('0x8')](0x3)[_0x7889('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x7889('0xf')},'dialTimezone':{'type':Sequelize[_0x7889('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x7889('0x2')],'defaultValue':_0x7889('0x10')},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always',_0x7889('0x11'),_0x7889('0x12')),'defaultValue':_0x7889('0x13')},'dialAMDActive':{'type':Sequelize[_0x7889('0x6')],'defaultValue':0x0,'comment':_0x7889('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x7889('0x8')](0x9)[_0x7889('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x7889('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x7889('0x8')](0x9)[_0x7889('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x7889('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x7889('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x7889('0x8')](0x9)[_0x7889('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7889('0x18')},'dialAMDMinWordLength':{'type':Sequelize[_0x7889('0x8')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x7889('0x8')](0x9)[_0x7889('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x7889('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x7889('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x7889('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x7889('0x8')](0x9)[_0x7889('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x7889('0x4')](_0x7889('0x1c'),_0x7889('0x1d')),'defaultValue':_0x7889('0x1c')},'dialPrefix':{'type':Sequelize[_0x7889('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7889('0x1e')},'dialCutDigit':{'type':Sequelize[_0x7889('0x8')](0x3)[_0x7889('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7889('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7889('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x7889('0x8')](0x5)[_0x7889('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x7889('0x8')](0x3)[_0x7889('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7889('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0x7889('0x8')](0x5)[_0x7889('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7889('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x7889('0x8')](0x3)[_0x7889('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7889('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x7889('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7889('0x24')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7889('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7889('0x25')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7889('0x26')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x7889('0x8')](0x3)[_0x7889('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7889('0x27')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x7889('0x8')](0x5)[_0x7889('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7889('0x28')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index c54ddba..8301162 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 _0x6da8=['options','includeAll','include','catch','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileSection','autoAssociation','update','findOne','CampaignId','CmHopper','findAll','rows','getHopperHistories','CmHopperHistory','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','ListId\x20=\x20?','sequelize','all','removeLists','ids','getBlackLists','addBlackLists','cm_hopper_black','fromQuery','push','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject','then','destroy','IvrCampaigns','UserProfileResource','error','stack','name','send','index','Campaign','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x6da8,0x14e));var _0x86da=function(_0xb1e77,_0x4442b7){_0xb1e77=_0xb1e77-0x0;var _0xeaa0d8=_0x6da8[_0xb1e77];return _0xeaa0d8;};'use strict';var emlformat=require(_0x86da('0x0'));var rimraf=require(_0x86da('0x1'));var zipdir=require(_0x86da('0x2'));var jsonpatch=require(_0x86da('0x3'));var rp=require('request-promise');var moment=require(_0x86da('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x86da('0x5'));var util=require(_0x86da('0x6'));var path=require(_0x86da('0x7'));var sox=require('sox');var csv=require(_0x86da('0x8'));var ejs=require(_0x86da('0x9'));var fs=require('fs');var fs_extra=require(_0x86da('0xa'));var _=require(_0x86da('0xb'));var squel=require(_0x86da('0xc'));var crypto=require(_0x86da('0xd'));var jsforce=require(_0x86da('0xe'));var deskjs=require(_0x86da('0xf'));var toCsv=require(_0x86da('0x8'));var querystring=require(_0x86da('0x10'));var Papa=require(_0x86da('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x86da('0x12'));var as=require(_0x86da('0x13'));var hardwareService=require(_0x86da('0x14'));var logger=require(_0x86da('0x15'))(_0x86da('0x16'));var utils=require(_0x86da('0x17'));var config=require(_0x86da('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x86da('0x19'))['db'];function respondWithStatusCode(_0x2c6b04,_0x2b4f4f){_0x2b4f4f=_0x2b4f4f||0xcc;return function(_0x440585){if(_0x440585){return _0x2c6b04['sendStatus'](_0x2b4f4f);}return _0x2c6b04[_0x86da('0x1a')](_0x2b4f4f)[_0x86da('0x1b')]();};}function respondWithResult(_0x1f1309,_0x1cbeb0){_0x1cbeb0=_0x1cbeb0||0xc8;return function(_0x11e019){if(_0x11e019){return _0x1f1309[_0x86da('0x1a')](_0x1cbeb0)[_0x86da('0x1c')](_0x11e019);}};}function respondWithFilteredResult(_0x399495,_0x43f3bf){return function(_0x92febf){if(_0x92febf){var _0x2446e0=typeof _0x43f3bf[_0x86da('0x1d')]===_0x86da('0x1e')&&typeof _0x43f3bf[_0x86da('0x1f')]===_0x86da('0x1e');var _0x329226=_0x92febf[_0x86da('0x20')];var _0xf696a4=_0x2446e0?0x0:_0x43f3bf[_0x86da('0x1d')];var _0x3f6fad=_0x2446e0?_0x92febf[_0x86da('0x20')]:_0x43f3bf[_0x86da('0x1d')]+_0x43f3bf[_0x86da('0x1f')];var _0x406f5c;if(_0x3f6fad>=_0x329226){_0x3f6fad=_0x329226;_0x406f5c=0xc8;}else{_0x406f5c=0xce;}_0x399495[_0x86da('0x1a')](_0x406f5c);return _0x399495[_0x86da('0x21')]('Content-Range',_0xf696a4+'-'+_0x3f6fad+'/'+_0x329226)[_0x86da('0x1c')](_0x92febf);}return null;};}function patchUpdates(_0x34657d){return function(_0x14913f){try{jsonpatch['apply'](_0x14913f,_0x34657d,!![]);}catch(_0x5ddc19){return BPromise[_0x86da('0x22')](_0x5ddc19);}return _0x14913f['save']();};}function saveUpdates(_0x3cd3a9,_0x26735a){return function(_0x2eaff4){if(_0x2eaff4){return _0x2eaff4['update'](_0x3cd3a9)[_0x86da('0x23')](function(_0x125e32){return _0x125e32;});}return null;};}function removeEntity(_0x29293f,_0x23b8c3){return function(_0x4dc3f9){if(_0x4dc3f9){return _0x4dc3f9[_0x86da('0x24')]()[_0x86da('0x23')](function(){var _0x39b21b=_0x4dc3f9['get']({'plain':!![]});var _0x469ff9=_0x86da('0x25');return db[_0x86da('0x26')][_0x86da('0x24')]({'where':{'type':_0x469ff9,'resourceId':_0x39b21b['id']}})[_0x86da('0x23')](function(){return _0x4dc3f9;});})[_0x86da('0x23')](function(){_0x29293f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x32bf79,_0x2c9d75){return function(_0x1aa7d5){if(!_0x1aa7d5){_0x32bf79['sendStatus'](0x194);}return _0x1aa7d5;};}function handleError(_0x3051fd,_0x1e0a3c){_0x1e0a3c=_0x1e0a3c||0x1f4;return function(_0x327292){logger[_0x86da('0x27')](_0x327292[_0x86da('0x28')]);if(_0x327292['name']){delete _0x327292[_0x86da('0x29')];}_0x3051fd[_0x86da('0x1a')](_0x1e0a3c)[_0x86da('0x2a')](_0x327292);};}exports[_0x86da('0x2b')]=function(_0xdecb62,_0x47a7ae){var _0x49d9c0={},_0x5f4d48={},_0x1070c0={'count':0x0,'rows':[]};var _0x86c270=_['map'](db[_0x86da('0x2c')][_0x86da('0x2d')],function(_0x3eb952){return{'name':_0x3eb952[_0x86da('0x2e')],'type':_0x3eb952[_0x86da('0x2f')]['key']};});_0x5f4d48[_0x86da('0x30')]=_[_0x86da('0x31')](_0x86c270,_0x86da('0x29'));_0x5f4d48[_0x86da('0x32')]=_[_0x86da('0x33')](_0xdecb62[_0x86da('0x32')]);_0x5f4d48[_0x86da('0x34')]=_['intersection'](_0x5f4d48[_0x86da('0x30')],_0x5f4d48[_0x86da('0x32')]);_0x49d9c0[_0x86da('0x35')]=_[_0x86da('0x36')](_0x5f4d48['model'],qs[_0x86da('0x37')](_0xdecb62[_0x86da('0x32')]['fields']));_0x49d9c0[_0x86da('0x35')]=_0x49d9c0[_0x86da('0x35')]['length']?_0x49d9c0[_0x86da('0x35')]:_0x5f4d48[_0x86da('0x30')];if(!_0xdecb62[_0x86da('0x32')][_0x86da('0x38')](_0x86da('0x39'))){_0x49d9c0[_0x86da('0x1f')]=qs[_0x86da('0x1f')](_0xdecb62[_0x86da('0x32')][_0x86da('0x1f')]);_0x49d9c0[_0x86da('0x1d')]=qs[_0x86da('0x1d')](_0xdecb62[_0x86da('0x32')][_0x86da('0x1d')]);}_0x49d9c0[_0x86da('0x3a')]=qs[_0x86da('0x3b')](_0xdecb62['query'][_0x86da('0x3b')]);_0x49d9c0[_0x86da('0x3c')]=qs[_0x86da('0x34')](_[_0x86da('0x3d')](_0xdecb62[_0x86da('0x32')],_0x5f4d48[_0x86da('0x34')]),_0x86c270);if(_0xdecb62['query'][_0x86da('0x3e')]){_0x49d9c0[_0x86da('0x3c')]=_[_0x86da('0x3f')](_0x49d9c0[_0x86da('0x3c')],{'$or':_[_0x86da('0x31')](_0x86c270,function(_0x45c1dc){if(_0x45c1dc['type']!==_0x86da('0x40')){var _0x4b341a={};_0x4b341a[_0x45c1dc['name']]={'$like':'%'+_0xdecb62['query']['filter']+'%'};return _0x4b341a;}})});}_0x49d9c0=_[_0x86da('0x3f')]({},_0x49d9c0,_0xdecb62[_0x86da('0x41')]);var _0x1eec2e={'where':_0x49d9c0['where']};return db[_0x86da('0x2c')][_0x86da('0x20')](_0x1eec2e)[_0x86da('0x23')](function(_0x2a6d11){_0x1070c0['count']=_0x2a6d11;if(_0xdecb62[_0x86da('0x32')][_0x86da('0x42')]){_0x49d9c0[_0x86da('0x43')]=[{'all':!![]}];}return db[_0x86da('0x2c')]['findAll'](_0x49d9c0);})[_0x86da('0x23')](function(_0x2c6db3){_0x1070c0['rows']=_0x2c6db3;return _0x1070c0;})['then'](respondWithFilteredResult(_0x47a7ae,_0x49d9c0))[_0x86da('0x44')](handleError(_0x47a7ae,null));};exports['show']=function(_0x4ace25,_0x31cdc0){var _0x5ec9f3={'raw':![],'where':{'id':_0x4ace25[_0x86da('0x45')]['id']}},_0x617457={};_0x617457[_0x86da('0x30')]=_[_0x86da('0x33')](db[_0x86da('0x2c')][_0x86da('0x2d')]);_0x617457['query']=_[_0x86da('0x33')](_0x4ace25[_0x86da('0x32')]);_0x617457[_0x86da('0x34')]=_['intersection'](_0x617457[_0x86da('0x30')],_0x617457['query']);_0x5ec9f3['attributes']=_[_0x86da('0x36')](_0x617457[_0x86da('0x30')],qs[_0x86da('0x37')](_0x4ace25[_0x86da('0x32')][_0x86da('0x37')]));_0x5ec9f3['attributes']=_0x5ec9f3[_0x86da('0x35')][_0x86da('0x46')]?_0x5ec9f3[_0x86da('0x35')]:_0x617457[_0x86da('0x30')];if(_0x4ace25[_0x86da('0x32')]['includeAll']){_0x5ec9f3[_0x86da('0x43')]=[{'all':!![]}];}_0x5ec9f3=_['merge']({},_0x5ec9f3,_0x4ace25[_0x86da('0x41')]);return db['Campaign'][_0x86da('0x47')](_0x5ec9f3)[_0x86da('0x23')](handleEntityNotFound(_0x31cdc0,null))[_0x86da('0x23')](respondWithResult(_0x31cdc0,null))[_0x86da('0x44')](handleError(_0x31cdc0,null));};exports[_0x86da('0x48')]=function(_0x2914ca,_0x26e1eb){return db['Campaign']['create'](_0x2914ca[_0x86da('0x49')],{})[_0x86da('0x23')](function(_0x1cfc9b){var _0xac1fee=_0x2914ca[_0x86da('0x4a')][_0x86da('0x4b')]({'plain':!![]});if(!_0xac1fee)throw new Error(_0x86da('0x4c'));if(_0xac1fee[_0x86da('0x4d')]==='user'){var _0x4f40f8=_0x1cfc9b['get']({'plain':!![]});var _0x3aa06d=_0x86da('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x3aa06d,'userProfileId':_0xac1fee[_0x86da('0x4e')]},'raw':!![]})[_0x86da('0x23')](function(_0x383181){if(_0x383181&&_0x383181['autoAssociation']===0x0){return db[_0x86da('0x26')][_0x86da('0x48')]({'name':_0x4f40f8[_0x86da('0x29')],'resourceId':_0x4f40f8['id'],'type':_0x383181[_0x86da('0x29')],'sectionId':_0x383181['id']},{})[_0x86da('0x23')](function(){return _0x1cfc9b;});}else{return _0x1cfc9b;}})['catch'](function(_0x423ff4){logger[_0x86da('0x27')](_0x86da('0x4f'),_0x423ff4);throw _0x423ff4;});}return _0x1cfc9b;})[_0x86da('0x23')](respondWithResult(_0x26e1eb,0xc9))[_0x86da('0x44')](handleError(_0x26e1eb,null));};exports[_0x86da('0x50')]=function(_0x51b3bf,_0xb6c41){var _0x5ede09={'where':{'id':_0x51b3bf['params']['id']}},_0x352dd5={};_0x352dd5[_0x86da('0x30')]=_[_0x86da('0x33')](db[_0x86da('0x2c')]['rawAttributes']);_0x5ede09[_0x86da('0x35')]=_['intersection'](_0x352dd5[_0x86da('0x30')],qs[_0x86da('0x37')](_0x51b3bf[_0x86da('0x32')]['fields']));_0x5ede09[_0x86da('0x35')]=_0x5ede09[_0x86da('0x35')][_0x86da('0x46')]?_0x5ede09['attributes']:_0x352dd5['model'];if(_0x51b3bf[_0x86da('0x32')]['includeAll']){_0x5ede09[_0x86da('0x43')]=[{'all':!![]}];}_0x5ede09=_[_0x86da('0x3f')]({},_0x5ede09,_0x51b3bf['options']);return db[_0x86da('0x2c')]['find'](_0x5ede09)['then'](handleEntityNotFound(_0xb6c41,null))[_0x86da('0x23')](function(_0x14e0e3){if(_0x14e0e3){var _0x580513=_0x14e0e3[_0x86da('0x4b')]({'plain':!![]});_0x580513=qs[_0x86da('0x51')](_0x580513,['id',_0x86da('0x52'),_0x86da('0x53')]);_0x51b3bf[_0x86da('0x49')]=_[_0x86da('0x51')](_0x51b3bf[_0x86da('0x49')],['id',_0x86da('0x52'),_0x86da('0x53')]);return db[_0x86da('0x2c')][_0x86da('0x48')](_['merge'](_0x580513,_0x51b3bf[_0x86da('0x49')]),{'include':_0x51b3bf[_0x86da('0x32')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x393744){var _0x64682b=_0x51b3bf[_0x86da('0x4a')]['get']({'plain':!![]});if(!_0x64682b)throw new Error(_0x86da('0x4c'));if(_0x64682b['role']==='user'){var _0x12520e=_0x393744[_0x86da('0x4b')]({'plain':!![]});var _0x28ac3d=_0x86da('0x25');return db[_0x86da('0x54')][_0x86da('0x47')]({'where':{'name':_0x28ac3d,'userProfileId':_0x64682b[_0x86da('0x4e')]},'raw':!![]})[_0x86da('0x23')](function(_0x1bf3e){if(_0x1bf3e&&_0x1bf3e[_0x86da('0x55')]===0x0){return db[_0x86da('0x26')]['create']({'name':_0x12520e[_0x86da('0x29')],'resourceId':_0x12520e['id'],'type':_0x1bf3e[_0x86da('0x29')],'sectionId':_0x1bf3e['id']},{})['then'](function(){return _0x393744;});}else{return _0x393744;}})[_0x86da('0x44')](function(_0x24a3e5){logger[_0x86da('0x27')](_0x86da('0x4f'),_0x24a3e5);throw _0x24a3e5;});}return _0x393744;});}})[_0x86da('0x23')](respondWithResult(_0xb6c41,0xc9))['catch'](handleError(_0xb6c41,null));};exports[_0x86da('0x56')]=function(_0x19897f,_0x412164){if(_0x19897f[_0x86da('0x49')]['id']){delete _0x19897f['body']['id'];}return db['Campaign']['find']({'where':{'id':_0x19897f[_0x86da('0x45')]['id']}})[_0x86da('0x23')](handleEntityNotFound(_0x412164,null))[_0x86da('0x23')](saveUpdates(_0x19897f[_0x86da('0x49')],null))['then'](respondWithResult(_0x412164,null))[_0x86da('0x44')](handleError(_0x412164,null));};exports['destroy']=function(_0x5760b3,_0x749760){return db[_0x86da('0x2c')][_0x86da('0x47')]({'where':{'id':_0x5760b3[_0x86da('0x45')]['id']}})[_0x86da('0x23')](handleEntityNotFound(_0x749760,null))[_0x86da('0x23')](removeEntity(_0x749760,null))[_0x86da('0x44')](handleError(_0x749760,null));};exports['getHoppers']=function(_0x2f127c,_0xc3644c,_0x444b2f){var _0x40d9d3={'raw':!![],'where':{}};var _0x74bd6d={};var _0xb8f1e9={'count':0x0,'rows':[]};return db[_0x86da('0x2c')][_0x86da('0x57')]({'where':{'id':_0x2f127c[_0x86da('0x45')]['id']}})['then'](handleEntityNotFound(_0xc3644c,null))[_0x86da('0x23')](function(_0x533068){if(_0x533068){_0x74bd6d[_0x86da('0x30')]=_[_0x86da('0x33')](db['CmHopper'][_0x86da('0x2d')]);_0x74bd6d[_0x86da('0x32')]=_[_0x86da('0x33')](_0x2f127c[_0x86da('0x32')]);_0x74bd6d[_0x86da('0x34')]=_[_0x86da('0x36')](_0x74bd6d[_0x86da('0x30')],_0x74bd6d[_0x86da('0x32')]);_0x40d9d3['attributes']=_['intersection'](_0x74bd6d[_0x86da('0x30')],qs[_0x86da('0x37')](_0x2f127c[_0x86da('0x32')][_0x86da('0x37')]));_0x40d9d3['attributes']=_0x40d9d3[_0x86da('0x35')]['length']?_0x40d9d3[_0x86da('0x35')]:_0x74bd6d['model'];if(!_0x2f127c[_0x86da('0x32')][_0x86da('0x38')]('nolimit')){_0x40d9d3[_0x86da('0x1f')]=qs[_0x86da('0x1f')](_0x2f127c[_0x86da('0x32')][_0x86da('0x1f')]);_0x40d9d3[_0x86da('0x1d')]=qs[_0x86da('0x1d')](_0x2f127c[_0x86da('0x32')][_0x86da('0x1d')]);}_0x40d9d3[_0x86da('0x3a')]=qs[_0x86da('0x3b')](_0x2f127c['query'][_0x86da('0x3b')]);_0x40d9d3[_0x86da('0x3c')]=qs[_0x86da('0x34')](_[_0x86da('0x3d')](_0x2f127c[_0x86da('0x32')],_0x74bd6d[_0x86da('0x34')]));_0x40d9d3[_0x86da('0x3c')][_0x86da('0x58')]=_0x533068['id'];if(_0x2f127c[_0x86da('0x32')][_0x86da('0x3e')]){_0x40d9d3[_0x86da('0x3c')]=_[_0x86da('0x3f')](_0x40d9d3[_0x86da('0x3c')],{'$or':_[_0x86da('0x31')](_0x40d9d3[_0x86da('0x35')],function(_0x3eeed9){var _0x24aafe={};_0x24aafe[_0x3eeed9]={'$like':'%'+_0x2f127c[_0x86da('0x32')][_0x86da('0x3e')]+'%'};return _0x24aafe;})});}_0x40d9d3=_[_0x86da('0x3f')]({},_0x40d9d3,_0x2f127c[_0x86da('0x41')]);return db[_0x86da('0x59')][_0x86da('0x20')]({'where':_0x40d9d3[_0x86da('0x3c')]})[_0x86da('0x23')](function(_0x327fcb){_0xb8f1e9[_0x86da('0x20')]=_0x327fcb;if(_0x2f127c[_0x86da('0x32')][_0x86da('0x42')]){_0x40d9d3[_0x86da('0x43')]=[{'all':!![]}];}return db['CmHopper'][_0x86da('0x5a')](_0x40d9d3);})[_0x86da('0x23')](function(_0x5b7ca5){_0xb8f1e9[_0x86da('0x5b')]=_0x5b7ca5;return _0xb8f1e9;});}})[_0x86da('0x23')](respondWithFilteredResult(_0xc3644c,_0x40d9d3))['catch'](handleError(_0xc3644c,null));};exports[_0x86da('0x5c')]=function(_0x2f122e,_0x239e59,_0x2351da){var _0x3b58bb={'raw':!![],'where':{}};var _0x2f1c2f={};var _0x2cccc4={'count':0x0,'rows':[]};return db[_0x86da('0x2c')][_0x86da('0x57')]({'where':{'id':_0x2f122e[_0x86da('0x45')]['id']}})['then'](handleEntityNotFound(_0x239e59,null))[_0x86da('0x23')](function(_0x436715){if(_0x436715){_0x2f1c2f['model']=_[_0x86da('0x33')](db['CmHopperHistory'][_0x86da('0x2d')]);_0x2f1c2f[_0x86da('0x32')]=_[_0x86da('0x33')](_0x2f122e['query']);_0x2f1c2f['filters']=_[_0x86da('0x36')](_0x2f1c2f[_0x86da('0x30')],_0x2f1c2f['query']);_0x3b58bb['attributes']=_[_0x86da('0x36')](_0x2f1c2f['model'],qs[_0x86da('0x37')](_0x2f122e['query'][_0x86da('0x37')]));_0x3b58bb[_0x86da('0x35')]=_0x3b58bb[_0x86da('0x35')][_0x86da('0x46')]?_0x3b58bb[_0x86da('0x35')]:_0x2f1c2f['model'];if(!_0x2f122e[_0x86da('0x32')]['hasOwnProperty'](_0x86da('0x39'))){_0x3b58bb[_0x86da('0x1f')]=qs['limit'](_0x2f122e['query'][_0x86da('0x1f')]);_0x3b58bb['offset']=qs['offset'](_0x2f122e['query'][_0x86da('0x1d')]);}_0x3b58bb[_0x86da('0x3a')]=qs['sort'](_0x2f122e[_0x86da('0x32')][_0x86da('0x3b')]);_0x3b58bb[_0x86da('0x3c')]=qs[_0x86da('0x34')](_[_0x86da('0x3d')](_0x2f122e[_0x86da('0x32')],_0x2f1c2f[_0x86da('0x34')]));_0x3b58bb[_0x86da('0x3c')][_0x86da('0x58')]=_0x436715['id'];if(_0x2f122e[_0x86da('0x32')][_0x86da('0x3e')]){_0x3b58bb[_0x86da('0x3c')]=_[_0x86da('0x3f')](_0x3b58bb[_0x86da('0x3c')],{'$or':_[_0x86da('0x31')](_0x3b58bb['attributes'],function(_0xdaf0fd){var _0x34c2f8={};_0x34c2f8[_0xdaf0fd]={'$like':'%'+_0x2f122e[_0x86da('0x32')][_0x86da('0x3e')]+'%'};return _0x34c2f8;})});}_0x3b58bb=_[_0x86da('0x3f')]({},_0x3b58bb,_0x2f122e['options']);return db['CmHopperHistory'][_0x86da('0x20')]({'where':_0x3b58bb[_0x86da('0x3c')]})[_0x86da('0x23')](function(_0x585c89){_0x2cccc4['count']=_0x585c89;if(_0x2f122e[_0x86da('0x32')][_0x86da('0x42')]){_0x3b58bb[_0x86da('0x43')]=[{'all':!![]}];}return db[_0x86da('0x5d')][_0x86da('0x5a')](_0x3b58bb);})[_0x86da('0x23')](function(_0x268dcc){_0x2cccc4[_0x86da('0x5b')]=_0x268dcc;return _0x2cccc4;});}})[_0x86da('0x23')](respondWithFilteredResult(_0x239e59,_0x3b58bb))['catch'](handleError(_0x239e59,null));};exports['getHopperFinals']=function(_0x43470c,_0x2cf47a,_0x33eedf){var _0x3c27c6={'raw':!![],'where':{}};var _0x4b5e52={};var _0x5b86db={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x43470c[_0x86da('0x45')]['id']}})[_0x86da('0x23')](handleEntityNotFound(_0x2cf47a,null))[_0x86da('0x23')](function(_0x43c8ee){if(_0x43c8ee){_0x4b5e52['model']=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x4b5e52[_0x86da('0x32')]=_['keys'](_0x43470c['query']);_0x4b5e52['filters']=_[_0x86da('0x36')](_0x4b5e52['model'],_0x4b5e52[_0x86da('0x32')]);_0x3c27c6['attributes']=_[_0x86da('0x36')](_0x4b5e52['model'],qs[_0x86da('0x37')](_0x43470c[_0x86da('0x32')][_0x86da('0x37')]));_0x3c27c6['attributes']=_0x3c27c6[_0x86da('0x35')]['length']?_0x3c27c6['attributes']:_0x4b5e52[_0x86da('0x30')];if(!_0x43470c[_0x86da('0x32')][_0x86da('0x38')](_0x86da('0x39'))){_0x3c27c6['limit']=qs[_0x86da('0x1f')](_0x43470c[_0x86da('0x32')]['limit']);_0x3c27c6[_0x86da('0x1d')]=qs['offset'](_0x43470c[_0x86da('0x32')][_0x86da('0x1d')]);}_0x3c27c6[_0x86da('0x3a')]=qs[_0x86da('0x3b')](_0x43470c[_0x86da('0x32')][_0x86da('0x3b')]);_0x3c27c6[_0x86da('0x3c')]=qs['filters'](_[_0x86da('0x3d')](_0x43470c[_0x86da('0x32')],_0x4b5e52[_0x86da('0x34')]));_0x3c27c6[_0x86da('0x3c')][_0x86da('0x58')]=_0x43c8ee['id'];if(_0x43470c['query'][_0x86da('0x3e')]){_0x3c27c6[_0x86da('0x3c')]=_['merge'](_0x3c27c6[_0x86da('0x3c')],{'$or':_[_0x86da('0x31')](_0x3c27c6['attributes'],function(_0x5a6174){var _0x3651d4={};_0x3651d4[_0x5a6174]={'$like':'%'+_0x43470c[_0x86da('0x32')][_0x86da('0x3e')]+'%'};return _0x3651d4;})});}_0x3c27c6=_[_0x86da('0x3f')]({},_0x3c27c6,_0x43470c[_0x86da('0x41')]);return db[_0x86da('0x5e')][_0x86da('0x20')]({'where':_0x3c27c6[_0x86da('0x3c')]})[_0x86da('0x23')](function(_0x5f0c3d){_0x5b86db['count']=_0x5f0c3d;if(_0x43470c['query']['includeAll']){_0x3c27c6['include']=[{'all':!![]}];}return db[_0x86da('0x5e')][_0x86da('0x5a')](_0x3c27c6);})[_0x86da('0x23')](function(_0x5971c0){_0x5b86db[_0x86da('0x5b')]=_0x5971c0;return _0x5b86db;});}})[_0x86da('0x23')](respondWithFilteredResult(_0x2cf47a,_0x3c27c6))[_0x86da('0x44')](handleError(_0x2cf47a,null));};exports['getHopperBlacks']=function(_0x34b05f,_0x35dd43,_0x166d0e){var _0x2431c0={'raw':!![],'where':{}};var _0x4bf8b7={};var _0x2f7236={'count':0x0,'rows':[]};return db[_0x86da('0x2c')][_0x86da('0x57')]({'where':{'id':_0x34b05f[_0x86da('0x45')]['id']}})[_0x86da('0x23')](handleEntityNotFound(_0x35dd43,null))[_0x86da('0x23')](function(_0x3ed648){if(_0x3ed648){_0x4bf8b7[_0x86da('0x30')]=_[_0x86da('0x33')](db[_0x86da('0x5f')]['rawAttributes']);_0x4bf8b7['query']=_[_0x86da('0x33')](_0x34b05f[_0x86da('0x32')]);_0x4bf8b7['filters']=_[_0x86da('0x36')](_0x4bf8b7[_0x86da('0x30')],_0x4bf8b7['query']);_0x2431c0[_0x86da('0x35')]=_[_0x86da('0x36')](_0x4bf8b7['model'],qs[_0x86da('0x37')](_0x34b05f[_0x86da('0x32')]['fields']));_0x2431c0[_0x86da('0x35')]=_0x2431c0[_0x86da('0x35')]['length']?_0x2431c0[_0x86da('0x35')]:_0x4bf8b7[_0x86da('0x30')];if(!_0x34b05f['query'][_0x86da('0x38')]('nolimit')){_0x2431c0[_0x86da('0x1f')]=qs[_0x86da('0x1f')](_0x34b05f[_0x86da('0x32')][_0x86da('0x1f')]);_0x2431c0[_0x86da('0x1d')]=qs[_0x86da('0x1d')](_0x34b05f[_0x86da('0x32')][_0x86da('0x1d')]);}_0x2431c0[_0x86da('0x3a')]=qs[_0x86da('0x3b')](_0x34b05f[_0x86da('0x32')][_0x86da('0x3b')]);_0x2431c0[_0x86da('0x3c')]=qs['filters'](_[_0x86da('0x3d')](_0x34b05f['query'],_0x4bf8b7[_0x86da('0x34')]));_0x2431c0['where'][_0x86da('0x58')]=_0x3ed648['id'];if(_0x34b05f[_0x86da('0x32')][_0x86da('0x3e')]){_0x2431c0['where']=_['merge'](_0x2431c0[_0x86da('0x3c')],{'$or':_[_0x86da('0x31')](_0x2431c0[_0x86da('0x35')],function(_0x3179b8){var _0x19fb6a={};_0x19fb6a[_0x3179b8]={'$like':'%'+_0x34b05f[_0x86da('0x32')][_0x86da('0x3e')]+'%'};return _0x19fb6a;})});}_0x2431c0=_['merge']({},_0x2431c0,_0x34b05f[_0x86da('0x41')]);return db[_0x86da('0x5f')]['count']({'where':_0x2431c0[_0x86da('0x3c')]})[_0x86da('0x23')](function(_0x160987){_0x2f7236[_0x86da('0x20')]=_0x160987;if(_0x34b05f[_0x86da('0x32')]['includeAll']){_0x2431c0[_0x86da('0x43')]=[{'all':!![]}];}return db[_0x86da('0x5f')][_0x86da('0x5a')](_0x2431c0);})[_0x86da('0x23')](function(_0x3572b4){_0x2f7236[_0x86da('0x5b')]=_0x3572b4;return _0x2f7236;});}})['then'](respondWithFilteredResult(_0x35dd43,_0x2431c0))['catch'](handleError(_0x35dd43,null));};exports[_0x86da('0x60')]=function(_0x99cfbe,_0x14a431,_0x104a12){var _0x3020d3={};var _0x4193ca={};var _0x1d3981;var _0x550eed;return db[_0x86da('0x2c')][_0x86da('0x57')]({'where':{'id':_0x99cfbe['params']['id']}})[_0x86da('0x23')](handleEntityNotFound(_0x14a431,null))[_0x86da('0x23')](function(_0x4cc0a0){if(_0x4cc0a0){_0x1d3981=_0x4cc0a0;_0x4193ca['model']=_['keys'](db[_0x86da('0x61')][_0x86da('0x2d')]);_0x4193ca[_0x86da('0x32')]=_['keys'](_0x99cfbe['query']);_0x4193ca['filters']=_[_0x86da('0x36')](_0x4193ca['model'],_0x4193ca['query']);_0x3020d3[_0x86da('0x35')]=_[_0x86da('0x36')](_0x4193ca[_0x86da('0x30')],qs[_0x86da('0x37')](_0x99cfbe[_0x86da('0x32')][_0x86da('0x37')]));_0x3020d3['attributes']=_0x3020d3[_0x86da('0x35')][_0x86da('0x46')]?_0x3020d3[_0x86da('0x35')]:_0x4193ca[_0x86da('0x30')];_0x3020d3[_0x86da('0x3a')]=qs[_0x86da('0x3b')](_0x99cfbe[_0x86da('0x32')][_0x86da('0x3b')]);_0x3020d3[_0x86da('0x3c')]=qs['filters'](_['pick'](_0x99cfbe['query'],_0x4193ca[_0x86da('0x34')]));if(_0x99cfbe[_0x86da('0x32')][_0x86da('0x3e')]){_0x3020d3[_0x86da('0x3c')]=_[_0x86da('0x3f')](_0x3020d3['where'],{'$or':_[_0x86da('0x31')](_0x3020d3[_0x86da('0x35')],function(_0x1c2667){var _0x50fe7d={};_0x50fe7d[_0x1c2667]={'$like':'%'+_0x99cfbe['query'][_0x86da('0x3e')]+'%'};return _0x50fe7d;})});}_0x3020d3=_[_0x86da('0x3f')]({},_0x3020d3,_0x99cfbe['options']);return _0x1d3981[_0x86da('0x60')](_0x3020d3);}})[_0x86da('0x23')](function(_0x57db0e){if(_0x57db0e){_0x550eed=_0x57db0e[_0x86da('0x46')];if(!_0x99cfbe[_0x86da('0x32')]['hasOwnProperty'](_0x86da('0x39'))){_0x3020d3[_0x86da('0x1f')]=qs['limit'](_0x99cfbe[_0x86da('0x32')][_0x86da('0x1f')]);_0x3020d3[_0x86da('0x1d')]=qs[_0x86da('0x1d')](_0x99cfbe[_0x86da('0x32')][_0x86da('0x1d')]);}return _0x1d3981['getLists'](_0x3020d3);}})['then'](function(_0x1b9f78){if(_0x1b9f78){return _0x1b9f78?{'count':_0x550eed,'rows':_0x1b9f78}:null;}})['then'](respondWithResult(_0x14a431,null))[_0x86da('0x44')](handleError(_0x14a431,null));};exports[_0x86da('0x62')]=function(_0x418db2,_0x1bd9a1,_0x3c4d9c){var _0x41e429,_0x3bba3d;return db[_0x86da('0x2c')][_0x86da('0x47')]({'where':{'id':_0x418db2[_0x86da('0x45')]['id']}})[_0x86da('0x23')](handleEntityNotFound(_0x1bd9a1,null))[_0x86da('0x23')](function(_0x20f426){if(_0x20f426){_0x3bba3d=_0x20f426;return _0x20f426[_0x86da('0x62')](_0x418db2[_0x86da('0x49')]['ids'],_[_0x86da('0x51')](_0x418db2['body'],['ids','id'])||{});}return null;})[_0x86da('0x63')](function(_0x37d907){var _0x3f405a;_0x41e429=_0x37d907||[];var _0x1f1955=[];if(_0x37d907){for(var _0x5231a7=0x0;_0x5231a7<_0x37d907[_0x86da('0x46')];_0x5231a7+=0x1){var _0x995b56=_0x37d907[_0x5231a7]['get']({'plain':!![]});_0x3bba3d[_0x86da('0x64')]=_0x418db2[_0x86da('0x49')]['dialCheckDuplicateType']?_0x418db2['body'][_0x86da('0x64')]:_0x3bba3d[_0x86da('0x64')];switch(_0x3bba3d[_0x86da('0x64')]){case _0x86da('0x65'):_0x3f405a=squel[_0x86da('0x66')]()[_0x86da('0x67')](_0x86da('0x68'))['fromQuery']([_0x86da('0x69'),_0x86da('0x6a'),_0x86da('0x6b'),_0x86da('0x6c'),_0x86da('0x58'),'createdAt',_0x86da('0x53')],squel[_0x86da('0x6d')]()[_0x86da('0x6e')]('phone',_0x86da('0x69'))[_0x86da('0x6e')](_0x86da('0x6f'),'scheduledAt')['field']('id',_0x86da('0x6b'))['field'](_0x995b56[_0x86da('0x70')][_0x86da('0x71')](),_0x86da('0x6c'))[_0x86da('0x6e')](_0x418db2[_0x86da('0x45')]['id'][_0x86da('0x71')](),_0x86da('0x58'))[_0x86da('0x6e')]('NOW()',_0x86da('0x52'))['field'](_0x86da('0x6f'),_0x86da('0x53'))[_0x86da('0x72')](_0x86da('0x73'))[_0x86da('0x3c')](_0x86da('0x74'))[_0x86da('0x3c')]('ListId\x20=\x20?',_0x995b56['CmListId']['toString']())[_0x86da('0x3c')](_0x86da('0x75'))[_0x86da('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x86da('0x6d')]()[_0x86da('0x6e')]('COALESCE(calleridnum,\x27\x27)')[_0x86da('0x72')](_0x86da('0x76'))[_0x86da('0x3c')](_0x86da('0x77'),_0x418db2[_0x86da('0x45')]['id']['toString']()))[_0x86da('0x3c')](_0x86da('0x78'),squel['select']()['field'](_0x86da('0x79'))['from'](_0x86da('0x68'))['where'](_0x86da('0x77'),_0x418db2[_0x86da('0x45')]['id']['toString']())))['toString']();break;case'onlyIfOpen':_0x3f405a=squel[_0x86da('0x66')]()[_0x86da('0x67')](_0x86da('0x68'))['fromQuery']([_0x86da('0x69'),_0x86da('0x6a'),_0x86da('0x6b'),_0x86da('0x6c'),_0x86da('0x58'),'createdAt',_0x86da('0x53')],squel[_0x86da('0x6d')]()[_0x86da('0x6e')]('phone',_0x86da('0x69'))['field'](_0x86da('0x6f'),_0x86da('0x6a'))[_0x86da('0x6e')]('id','ContactId')['field'](_0x995b56[_0x86da('0x70')][_0x86da('0x71')](),_0x86da('0x6c'))[_0x86da('0x6e')](_0x418db2[_0x86da('0x45')]['id'][_0x86da('0x71')](),_0x86da('0x58'))[_0x86da('0x6e')](_0x86da('0x6f'),'createdAt')[_0x86da('0x6e')](_0x86da('0x6f'),_0x86da('0x53'))[_0x86da('0x72')](_0x86da('0x73'))[_0x86da('0x3c')](_0x86da('0x74'))[_0x86da('0x3c')](_0x86da('0x7a'),_0x995b56[_0x86da('0x70')][_0x86da('0x71')]())[_0x86da('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x86da('0x3c')](_0x86da('0x78'),squel[_0x86da('0x6d')]()[_0x86da('0x6e')](_0x86da('0x79'))['from'](_0x86da('0x68'))[_0x86da('0x3c')](_0x86da('0x77'),_0x418db2[_0x86da('0x45')]['id'][_0x86da('0x71')]())))[_0x86da('0x71')]();break;default:_0x3f405a=squel[_0x86da('0x66')]()[_0x86da('0x67')](_0x86da('0x68'))['fromQuery']([_0x86da('0x69'),_0x86da('0x6a'),'ContactId',_0x86da('0x6c'),_0x86da('0x58'),_0x86da('0x52'),_0x86da('0x53')],squel[_0x86da('0x6d')]()[_0x86da('0x6e')](_0x86da('0x69'),_0x86da('0x69'))[_0x86da('0x6e')]('NOW()','scheduledAt')['field']('id',_0x86da('0x6b'))[_0x86da('0x6e')](_0x995b56[_0x86da('0x70')][_0x86da('0x71')](),_0x86da('0x6c'))[_0x86da('0x6e')](_0x418db2[_0x86da('0x45')]['id'][_0x86da('0x71')](),_0x86da('0x58'))[_0x86da('0x6e')](_0x86da('0x6f'),_0x86da('0x52'))[_0x86da('0x6e')](_0x86da('0x6f'),_0x86da('0x53'))[_0x86da('0x72')](_0x86da('0x73'))[_0x86da('0x3c')](_0x86da('0x74'))[_0x86da('0x3c')](_0x86da('0x7a'),_0x995b56[_0x86da('0x70')][_0x86da('0x71')]())[_0x86da('0x3c')](_0x86da('0x75')))[_0x86da('0x71')]();}_0x1f1955['push'](db[_0x86da('0x7b')][_0x86da('0x32')](_0x3f405a));}return BPromise[_0x86da('0x7c')](_0x1f1955);}})[_0x86da('0x23')](function(){return _0x41e429;})[_0x86da('0x23')](respondWithResult(_0x1bd9a1,null))[_0x86da('0x44')](handleError(_0x1bd9a1,null));};exports[_0x86da('0x7d')]=function(_0x23138a,_0x35e12e,_0x16dc90){return db['Campaign']['find']({'where':{'id':_0x23138a[_0x86da('0x45')]['id']}})[_0x86da('0x23')](handleEntityNotFound(_0x35e12e,null))['then'](function(_0x3161d7){if(_0x3161d7){return _0x3161d7[_0x86da('0x7d')](_0x23138a[_0x86da('0x32')][_0x86da('0x7e')]);}})[_0x86da('0x23')](function(_0x18aebe){if(_0x18aebe){return db[_0x86da('0x59')][_0x86da('0x24')]({'where':{'ListId':_0x23138a[_0x86da('0x32')][_0x86da('0x7e')],'CampaignId':_0x23138a[_0x86da('0x45')]['id']}})[_0x86da('0x23')](function(){return _0x18aebe;});}})['then'](respondWithStatusCode(_0x35e12e,null))[_0x86da('0x44')](handleError(_0x35e12e,null));};exports[_0x86da('0x7f')]=function(_0x218b50,_0x13c769,_0x565751){var _0xedae27={};var _0x202e19={};var _0x4a078e;var _0x37c7c4;return db['Campaign']['findOne']({'where':{'id':_0x218b50['params']['id']}})['then'](handleEntityNotFound(_0x13c769,null))[_0x86da('0x23')](function(_0x2aaab4){if(_0x2aaab4){_0x4a078e=_0x2aaab4;_0x202e19[_0x86da('0x30')]=_['keys'](db[_0x86da('0x61')][_0x86da('0x2d')]);_0x202e19[_0x86da('0x32')]=_[_0x86da('0x33')](_0x218b50[_0x86da('0x32')]);_0x202e19[_0x86da('0x34')]=_['intersection'](_0x202e19['model'],_0x202e19[_0x86da('0x32')]);_0xedae27[_0x86da('0x35')]=_[_0x86da('0x36')](_0x202e19[_0x86da('0x30')],qs[_0x86da('0x37')](_0x218b50[_0x86da('0x32')][_0x86da('0x37')]));_0xedae27[_0x86da('0x35')]=_0xedae27[_0x86da('0x35')]['length']?_0xedae27['attributes']:_0x202e19[_0x86da('0x30')];_0xedae27[_0x86da('0x3a')]=qs['sort'](_0x218b50[_0x86da('0x32')][_0x86da('0x3b')]);_0xedae27[_0x86da('0x3c')]=qs[_0x86da('0x34')](_[_0x86da('0x3d')](_0x218b50[_0x86da('0x32')],_0x202e19[_0x86da('0x34')]));if(_0x218b50[_0x86da('0x32')]['filter']){_0xedae27[_0x86da('0x3c')]=_['merge'](_0xedae27[_0x86da('0x3c')],{'$or':_[_0x86da('0x31')](_0xedae27[_0x86da('0x35')],function(_0x23ad45){var _0x51372d={};_0x51372d[_0x23ad45]={'$like':'%'+_0x218b50[_0x86da('0x32')][_0x86da('0x3e')]+'%'};return _0x51372d;})});}_0xedae27=_[_0x86da('0x3f')]({},_0xedae27,_0x218b50[_0x86da('0x41')]);return _0x4a078e[_0x86da('0x7f')](_0xedae27);}})['then'](function(_0x850e2a){if(_0x850e2a){_0x37c7c4=_0x850e2a[_0x86da('0x46')];if(!_0x218b50[_0x86da('0x32')][_0x86da('0x38')]('nolimit')){_0xedae27[_0x86da('0x1f')]=qs['limit'](_0x218b50['query'][_0x86da('0x1f')]);_0xedae27[_0x86da('0x1d')]=qs[_0x86da('0x1d')](_0x218b50[_0x86da('0x32')]['offset']);}return _0x4a078e[_0x86da('0x7f')](_0xedae27);}})[_0x86da('0x23')](function(_0x5ecaf5){if(_0x5ecaf5){return _0x5ecaf5?{'count':_0x37c7c4,'rows':_0x5ecaf5}:null;}})[_0x86da('0x23')](respondWithResult(_0x13c769,null))[_0x86da('0x44')](handleError(_0x13c769,null));};exports[_0x86da('0x80')]=function(_0x401a83,_0x538cf7,_0x4cd16e){var _0x3bc045,_0x46dc3b;return db[_0x86da('0x2c')][_0x86da('0x47')]({'where':{'id':_0x401a83[_0x86da('0x45')]['id']}})[_0x86da('0x23')](handleEntityNotFound(_0x538cf7,null))[_0x86da('0x23')](function(_0x1344b1){if(_0x1344b1){_0x46dc3b=_0x1344b1;return _0x1344b1[_0x86da('0x80')](_0x401a83['body'][_0x86da('0x7e')],_[_0x86da('0x51')](_0x401a83[_0x86da('0x49')],[_0x86da('0x7e'),'id'])||{});}return null;})[_0x86da('0x63')](function(_0x2e01cd){var _0x4b8f9a;_0x3bc045=_0x2e01cd||[];var _0x4e34d9=[];if(_0x2e01cd){for(var _0x3d7d8f=0x0;_0x3d7d8f<_0x2e01cd[_0x86da('0x46')];_0x3d7d8f+=0x1){var _0x1c69c5=_0x2e01cd[_0x3d7d8f]['get']({'plain':!![]});_0x4b8f9a=squel[_0x86da('0x66')]()[_0x86da('0x67')](_0x86da('0x81'))[_0x86da('0x82')]([_0x86da('0x69'),'ContactId',_0x86da('0x6c'),_0x86da('0x58'),'createdAt','updatedAt'],squel[_0x86da('0x6d')]()[_0x86da('0x6e')]('phone',_0x86da('0x69'))[_0x86da('0x6e')]('id','ContactId')['field'](_0x1c69c5[_0x86da('0x70')][_0x86da('0x71')](),_0x86da('0x6c'))[_0x86da('0x6e')](_0x401a83[_0x86da('0x45')]['id'][_0x86da('0x71')](),_0x86da('0x58'))[_0x86da('0x6e')]('NOW()',_0x86da('0x52'))['field'](_0x86da('0x6f'),_0x86da('0x53'))[_0x86da('0x72')](_0x86da('0x73'))[_0x86da('0x3c')](_0x86da('0x74'))[_0x86da('0x3c')]('ListId\x20=\x20?',_0x1c69c5[_0x86da('0x70')][_0x86da('0x71')]())[_0x86da('0x3c')](_0x86da('0x75')))[_0x86da('0x71')]();_0x4e34d9[_0x86da('0x83')](db[_0x86da('0x7b')][_0x86da('0x32')](_0x4b8f9a));}return BPromise[_0x86da('0x7c')](_0x4e34d9);}})[_0x86da('0x23')](function(){return _0x3bc045;})[_0x86da('0x23')](respondWithResult(_0x538cf7,null))[_0x86da('0x44')](handleError(_0x538cf7,null));};exports[_0x86da('0x84')]=function(_0x2a1676,_0x2b48e2,_0x6b43df){return db['Campaign'][_0x86da('0x47')]({'where':{'id':_0x2a1676[_0x86da('0x45')]['id']}})[_0x86da('0x23')](handleEntityNotFound(_0x2b48e2,null))['then'](function(_0x4c5db7){if(_0x4c5db7){return _0x4c5db7['removeBlackLists'](_0x2a1676[_0x86da('0x32')][_0x86da('0x7e')]);}})[_0x86da('0x23')](function(_0x270c0b){if(_0x270c0b){return db[_0x86da('0x5f')][_0x86da('0x24')]({'where':{'ListId':_0x2a1676['query'][_0x86da('0x7e')],'CampaignId':_0x2a1676[_0x86da('0x45')]['id']}})[_0x86da('0x23')](function(){return _0x270c0b;});}})[_0x86da('0x23')](respondWithStatusCode(_0x2b48e2,null))[_0x86da('0x44')](handleError(_0x2b48e2,null));}; \ No newline at end of file +var _0x1a3c=['getHoppers','findOne','CmHopper','nolimit','CampaignId','filter','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','select','field','phone','NOW()','CmListId','toString','cm_contacts','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','from','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','phone\x20IS\x20NOT\x20NULL','all','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','get','error','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','IvrCampaigns'];(function(_0x974b48,_0x3433d2){var _0x4a0980=function(_0x257a49){while(--_0x257a49){_0x974b48['push'](_0x974b48['shift']());}};_0x4a0980(++_0x3433d2);}(_0x1a3c,0xbd));var _0xc1a3=function(_0x57950f,_0x580206){_0x57950f=_0x57950f-0x0;var _0x3ae7b8=_0x1a3c[_0x57950f];return _0x3ae7b8;};'use strict';var emlformat=require(_0xc1a3('0x0'));var rimraf=require(_0xc1a3('0x1'));var zipdir=require(_0xc1a3('0x2'));var jsonpatch=require(_0xc1a3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc1a3('0x4'));var Mustache=require(_0xc1a3('0x5'));var util=require(_0xc1a3('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xc1a3('0x7'));var ejs=require(_0xc1a3('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc1a3('0x9'));var squel=require(_0xc1a3('0xa'));var crypto=require(_0xc1a3('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc1a3('0x7'));var querystring=require(_0xc1a3('0xc'));var Papa=require(_0xc1a3('0xd'));var Redis=require(_0xc1a3('0xe'));var authService=require(_0xc1a3('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc1a3('0x10'));var hardwareService=require(_0xc1a3('0x11'));var logger=require(_0xc1a3('0x12'))(_0xc1a3('0x13'));var utils=require('../../config/utils');var config=require(_0xc1a3('0x14'));var licenseUtil=require(_0xc1a3('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f3c92,_0x148471){_0x148471=_0x148471||0xcc;return function(_0x4cdfaf){if(_0x4cdfaf){return _0x4f3c92[_0xc1a3('0x16')](_0x148471);}return _0x4f3c92[_0xc1a3('0x17')](_0x148471)[_0xc1a3('0x18')]();};}function respondWithResult(_0x1491a2,_0x222c8d){_0x222c8d=_0x222c8d||0xc8;return function(_0xd6b8eb){if(_0xd6b8eb){return _0x1491a2[_0xc1a3('0x17')](_0x222c8d)['json'](_0xd6b8eb);}};}function respondWithFilteredResult(_0x5c46fb,_0x2bef8e){return function(_0x7d580f){if(_0x7d580f){var _0x412a85=typeof _0x2bef8e[_0xc1a3('0x19')]==='undefined'&&typeof _0x2bef8e[_0xc1a3('0x1a')]===_0xc1a3('0x1b');var _0xa357c6=_0x7d580f[_0xc1a3('0x1c')];var _0x19d617=_0x412a85?0x0:_0x2bef8e[_0xc1a3('0x19')];var _0xb577e8=_0x412a85?_0x7d580f[_0xc1a3('0x1c')]:_0x2bef8e['offset']+_0x2bef8e[_0xc1a3('0x1a')];var _0x4a57f6;if(_0xb577e8>=_0xa357c6){_0xb577e8=_0xa357c6;_0x4a57f6=0xc8;}else{_0x4a57f6=0xce;}_0x5c46fb[_0xc1a3('0x17')](_0x4a57f6);return _0x5c46fb[_0xc1a3('0x1d')](_0xc1a3('0x1e'),_0x19d617+'-'+_0xb577e8+'/'+_0xa357c6)[_0xc1a3('0x1f')](_0x7d580f);}return null;};}function patchUpdates(_0x43b071){return function(_0x50c3a7){try{jsonpatch[_0xc1a3('0x20')](_0x50c3a7,_0x43b071,!![]);}catch(_0x19c0a9){return BPromise['reject'](_0x19c0a9);}return _0x50c3a7[_0xc1a3('0x21')]();};}function saveUpdates(_0x24df47,_0x25d571){return function(_0x388094){if(_0x388094){return _0x388094[_0xc1a3('0x22')](_0x24df47)[_0xc1a3('0x23')](function(_0x198c80){return _0x198c80;});}return null;};}function removeEntity(_0x68175,_0x58269c){return function(_0x451188){if(_0x451188){return _0x451188[_0xc1a3('0x24')]()['then'](function(){var _0x16c683=_0x451188[_0xc1a3('0x25')]({'plain':!![]});var _0x33e9b9='IvrCampaigns';return db['UserProfileResource'][_0xc1a3('0x24')]({'where':{'type':_0x33e9b9,'resourceId':_0x16c683['id']}})[_0xc1a3('0x23')](function(){return _0x451188;});})[_0xc1a3('0x23')](function(){_0x68175[_0xc1a3('0x17')](0xcc)[_0xc1a3('0x18')]();});}};}function handleEntityNotFound(_0xc17f50,_0xeb70f0){return function(_0x4792f3){if(!_0x4792f3){_0xc17f50[_0xc1a3('0x16')](0x194);}return _0x4792f3;};}function handleError(_0x39f798,_0x4c6d77){_0x4c6d77=_0x4c6d77||0x1f4;return function(_0x14639d){logger[_0xc1a3('0x26')](_0x14639d[_0xc1a3('0x27')]);if(_0x14639d[_0xc1a3('0x28')]){delete _0x14639d[_0xc1a3('0x28')];}_0x39f798[_0xc1a3('0x17')](_0x4c6d77)[_0xc1a3('0x29')](_0x14639d);};}exports[_0xc1a3('0x2a')]=function(_0x55330f,_0x3f7603){var _0x30d5d7={},_0x275574={},_0x30d91b={'count':0x0,'rows':[]};var _0x483df1=_[_0xc1a3('0x2b')](db[_0xc1a3('0x2c')][_0xc1a3('0x2d')],function(_0x14cc71){return{'name':_0x14cc71[_0xc1a3('0x2e')],'type':_0x14cc71[_0xc1a3('0x2f')][_0xc1a3('0x30')]};});_0x275574[_0xc1a3('0x31')]=_[_0xc1a3('0x2b')](_0x483df1,_0xc1a3('0x28'));_0x275574[_0xc1a3('0x32')]=_['keys'](_0x55330f[_0xc1a3('0x32')]);_0x275574[_0xc1a3('0x33')]=_[_0xc1a3('0x34')](_0x275574[_0xc1a3('0x31')],_0x275574[_0xc1a3('0x32')]);_0x30d5d7[_0xc1a3('0x35')]=_[_0xc1a3('0x34')](_0x275574['model'],qs[_0xc1a3('0x36')](_0x55330f[_0xc1a3('0x32')][_0xc1a3('0x36')]));_0x30d5d7[_0xc1a3('0x35')]=_0x30d5d7[_0xc1a3('0x35')][_0xc1a3('0x37')]?_0x30d5d7[_0xc1a3('0x35')]:_0x275574['model'];if(!_0x55330f[_0xc1a3('0x32')][_0xc1a3('0x38')]('nolimit')){_0x30d5d7[_0xc1a3('0x1a')]=qs[_0xc1a3('0x1a')](_0x55330f[_0xc1a3('0x32')][_0xc1a3('0x1a')]);_0x30d5d7[_0xc1a3('0x19')]=qs[_0xc1a3('0x19')](_0x55330f['query'][_0xc1a3('0x19')]);}_0x30d5d7[_0xc1a3('0x39')]=qs[_0xc1a3('0x3a')](_0x55330f['query'][_0xc1a3('0x3a')]);_0x30d5d7[_0xc1a3('0x3b')]=qs['filters'](_[_0xc1a3('0x3c')](_0x55330f[_0xc1a3('0x32')],_0x275574[_0xc1a3('0x33')]),_0x483df1);if(_0x55330f[_0xc1a3('0x32')]['filter']){_0x30d5d7[_0xc1a3('0x3b')]=_[_0xc1a3('0x3d')](_0x30d5d7[_0xc1a3('0x3b')],{'$or':_[_0xc1a3('0x2b')](_0x483df1,function(_0x11446f){if(_0x11446f[_0xc1a3('0x2f')]!==_0xc1a3('0x3e')){var _0x18458f={};_0x18458f[_0x11446f[_0xc1a3('0x28')]]={'$like':'%'+_0x55330f['query']['filter']+'%'};return _0x18458f;}})});}_0x30d5d7=_['merge']({},_0x30d5d7,_0x55330f[_0xc1a3('0x3f')]);var _0x9def79={'where':_0x30d5d7['where']};return db[_0xc1a3('0x2c')]['count'](_0x9def79)['then'](function(_0x53ce52){_0x30d91b[_0xc1a3('0x1c')]=_0x53ce52;if(_0x55330f[_0xc1a3('0x32')][_0xc1a3('0x40')]){_0x30d5d7[_0xc1a3('0x41')]=[{'all':!![]}];}return db[_0xc1a3('0x2c')]['findAll'](_0x30d5d7);})[_0xc1a3('0x23')](function(_0x2ddd12){_0x30d91b[_0xc1a3('0x42')]=_0x2ddd12;return _0x30d91b;})[_0xc1a3('0x23')](respondWithFilteredResult(_0x3f7603,_0x30d5d7))[_0xc1a3('0x43')](handleError(_0x3f7603,null));};exports[_0xc1a3('0x44')]=function(_0x4f85d4,_0x5b2e5b){var _0x1404e0={'raw':![],'where':{'id':_0x4f85d4[_0xc1a3('0x45')]['id']}},_0xaa665c={};_0xaa665c[_0xc1a3('0x31')]=_[_0xc1a3('0x46')](db['Campaign'][_0xc1a3('0x2d')]);_0xaa665c[_0xc1a3('0x32')]=_[_0xc1a3('0x46')](_0x4f85d4[_0xc1a3('0x32')]);_0xaa665c[_0xc1a3('0x33')]=_[_0xc1a3('0x34')](_0xaa665c[_0xc1a3('0x31')],_0xaa665c[_0xc1a3('0x32')]);_0x1404e0[_0xc1a3('0x35')]=_[_0xc1a3('0x34')](_0xaa665c[_0xc1a3('0x31')],qs[_0xc1a3('0x36')](_0x4f85d4[_0xc1a3('0x32')][_0xc1a3('0x36')]));_0x1404e0['attributes']=_0x1404e0['attributes'][_0xc1a3('0x37')]?_0x1404e0['attributes']:_0xaa665c[_0xc1a3('0x31')];if(_0x4f85d4[_0xc1a3('0x32')][_0xc1a3('0x40')]){_0x1404e0['include']=[{'all':!![]}];}_0x1404e0=_[_0xc1a3('0x3d')]({},_0x1404e0,_0x4f85d4['options']);return db[_0xc1a3('0x2c')][_0xc1a3('0x47')](_0x1404e0)[_0xc1a3('0x23')](handleEntityNotFound(_0x5b2e5b,null))['then'](respondWithResult(_0x5b2e5b,null))[_0xc1a3('0x43')](handleError(_0x5b2e5b,null));};exports['create']=function(_0xad1911,_0x459087){return db[_0xc1a3('0x2c')][_0xc1a3('0x48')](_0xad1911[_0xc1a3('0x49')],{})['then'](function(_0x23b965){var _0x3011cf=_0xad1911[_0xc1a3('0x4a')][_0xc1a3('0x25')]({'plain':!![]});if(!_0x3011cf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3011cf[_0xc1a3('0x4b')]==='user'){var _0x47d33a=_0x23b965[_0xc1a3('0x25')]({'plain':!![]});var _0x4fe2ba='IvrCampaigns';return db[_0xc1a3('0x4c')][_0xc1a3('0x47')]({'where':{'name':_0x4fe2ba,'userProfileId':_0x3011cf[_0xc1a3('0x4d')]},'raw':!![]})[_0xc1a3('0x23')](function(_0x350034){if(_0x350034&&_0x350034[_0xc1a3('0x4e')]===0x0){return db[_0xc1a3('0x4f')]['create']({'name':_0x47d33a[_0xc1a3('0x28')],'resourceId':_0x47d33a['id'],'type':_0x350034[_0xc1a3('0x28')],'sectionId':_0x350034['id']},{})['then'](function(){return _0x23b965;});}else{return _0x23b965;}})[_0xc1a3('0x43')](function(_0x57ba9b){logger[_0xc1a3('0x26')](_0xc1a3('0x50'),_0x57ba9b);throw _0x57ba9b;});}return _0x23b965;})['then'](respondWithResult(_0x459087,0xc9))[_0xc1a3('0x43')](handleError(_0x459087,null));};exports[_0xc1a3('0x51')]=function(_0x20e318,_0x14f04f){var _0x442ae0={'where':{'id':_0x20e318['params']['id']}},_0x86960a={};_0x86960a['model']=_['keys'](db[_0xc1a3('0x2c')][_0xc1a3('0x2d')]);_0x442ae0['attributes']=_['intersection'](_0x86960a[_0xc1a3('0x31')],qs['fields'](_0x20e318[_0xc1a3('0x32')][_0xc1a3('0x36')]));_0x442ae0[_0xc1a3('0x35')]=_0x442ae0[_0xc1a3('0x35')][_0xc1a3('0x37')]?_0x442ae0[_0xc1a3('0x35')]:_0x86960a[_0xc1a3('0x31')];if(_0x20e318['query']['includeAll']){_0x442ae0[_0xc1a3('0x41')]=[{'all':!![]}];}_0x442ae0=_[_0xc1a3('0x3d')]({},_0x442ae0,_0x20e318[_0xc1a3('0x3f')]);return db[_0xc1a3('0x2c')][_0xc1a3('0x47')](_0x442ae0)['then'](handleEntityNotFound(_0x14f04f,null))[_0xc1a3('0x23')](function(_0x126ba7){if(_0x126ba7){var _0x227589=_0x126ba7['get']({'plain':!![]});_0x227589=qs[_0xc1a3('0x52')](_0x227589,['id',_0xc1a3('0x53'),'updatedAt']);_0x20e318[_0xc1a3('0x49')]=_[_0xc1a3('0x52')](_0x20e318[_0xc1a3('0x49')],['id',_0xc1a3('0x53'),_0xc1a3('0x54')]);return db['Campaign'][_0xc1a3('0x48')](_[_0xc1a3('0x3d')](_0x227589,_0x20e318[_0xc1a3('0x49')]),{'include':_0x20e318[_0xc1a3('0x32')][_0xc1a3('0x40')]?[{'all':!![]}]:undefined})[_0xc1a3('0x23')](function(_0x22ffa6){var _0x72ac40=_0x20e318[_0xc1a3('0x4a')][_0xc1a3('0x25')]({'plain':!![]});if(!_0x72ac40)throw new Error(_0xc1a3('0x55'));if(_0x72ac40[_0xc1a3('0x4b')]==='user'){var _0x150e76=_0x22ffa6['get']({'plain':!![]});var _0x232f9b=_0xc1a3('0x56');return db[_0xc1a3('0x4c')][_0xc1a3('0x47')]({'where':{'name':_0x232f9b,'userProfileId':_0x72ac40[_0xc1a3('0x4d')]},'raw':!![]})[_0xc1a3('0x23')](function(_0x1b1a9f){if(_0x1b1a9f&&_0x1b1a9f[_0xc1a3('0x4e')]===0x0){return db[_0xc1a3('0x4f')][_0xc1a3('0x48')]({'name':_0x150e76['name'],'resourceId':_0x150e76['id'],'type':_0x1b1a9f[_0xc1a3('0x28')],'sectionId':_0x1b1a9f['id']},{})[_0xc1a3('0x23')](function(){return _0x22ffa6;});}else{return _0x22ffa6;}})[_0xc1a3('0x43')](function(_0x5a1292){logger[_0xc1a3('0x26')](_0xc1a3('0x50'),_0x5a1292);throw _0x5a1292;});}return _0x22ffa6;});}})[_0xc1a3('0x23')](respondWithResult(_0x14f04f,0xc9))[_0xc1a3('0x43')](handleError(_0x14f04f,null));};exports[_0xc1a3('0x22')]=function(_0x33e241,_0x1f24b6){if(_0x33e241[_0xc1a3('0x49')]['id']){delete _0x33e241[_0xc1a3('0x49')]['id'];}return db[_0xc1a3('0x2c')][_0xc1a3('0x47')]({'where':{'id':_0x33e241[_0xc1a3('0x45')]['id']}})['then'](handleEntityNotFound(_0x1f24b6,null))['then'](saveUpdates(_0x33e241[_0xc1a3('0x49')],null))[_0xc1a3('0x23')](respondWithResult(_0x1f24b6,null))[_0xc1a3('0x43')](handleError(_0x1f24b6,null));};exports[_0xc1a3('0x24')]=function(_0x2c839a,_0x6c9a1c){return db[_0xc1a3('0x2c')]['find']({'where':{'id':_0x2c839a[_0xc1a3('0x45')]['id']}})[_0xc1a3('0x23')](handleEntityNotFound(_0x6c9a1c,null))[_0xc1a3('0x23')](removeEntity(_0x6c9a1c,null))['catch'](handleError(_0x6c9a1c,null));};exports[_0xc1a3('0x57')]=function(_0x196686,_0x296a3f,_0xa5a035){var _0x2b298f={'raw':!![],'where':{}};var _0xe5a4f5={};var _0x46d031={'count':0x0,'rows':[]};return db[_0xc1a3('0x2c')][_0xc1a3('0x58')]({'where':{'id':_0x196686['params']['id']}})[_0xc1a3('0x23')](handleEntityNotFound(_0x296a3f,null))['then'](function(_0x12cd95){if(_0x12cd95){_0xe5a4f5[_0xc1a3('0x31')]=_[_0xc1a3('0x46')](db[_0xc1a3('0x59')][_0xc1a3('0x2d')]);_0xe5a4f5['query']=_[_0xc1a3('0x46')](_0x196686[_0xc1a3('0x32')]);_0xe5a4f5[_0xc1a3('0x33')]=_[_0xc1a3('0x34')](_0xe5a4f5[_0xc1a3('0x31')],_0xe5a4f5[_0xc1a3('0x32')]);_0x2b298f[_0xc1a3('0x35')]=_[_0xc1a3('0x34')](_0xe5a4f5[_0xc1a3('0x31')],qs['fields'](_0x196686[_0xc1a3('0x32')][_0xc1a3('0x36')]));_0x2b298f[_0xc1a3('0x35')]=_0x2b298f['attributes'][_0xc1a3('0x37')]?_0x2b298f[_0xc1a3('0x35')]:_0xe5a4f5['model'];if(!_0x196686[_0xc1a3('0x32')]['hasOwnProperty'](_0xc1a3('0x5a'))){_0x2b298f[_0xc1a3('0x1a')]=qs['limit'](_0x196686[_0xc1a3('0x32')][_0xc1a3('0x1a')]);_0x2b298f[_0xc1a3('0x19')]=qs['offset'](_0x196686['query'][_0xc1a3('0x19')]);}_0x2b298f[_0xc1a3('0x39')]=qs['sort'](_0x196686[_0xc1a3('0x32')]['sort']);_0x2b298f[_0xc1a3('0x3b')]=qs[_0xc1a3('0x33')](_[_0xc1a3('0x3c')](_0x196686['query'],_0xe5a4f5['filters']));_0x2b298f[_0xc1a3('0x3b')][_0xc1a3('0x5b')]=_0x12cd95['id'];if(_0x196686[_0xc1a3('0x32')]['filter']){_0x2b298f[_0xc1a3('0x3b')]=_[_0xc1a3('0x3d')](_0x2b298f['where'],{'$or':_[_0xc1a3('0x2b')](_0x2b298f[_0xc1a3('0x35')],function(_0x2d506a){var _0x27486f={};_0x27486f[_0x2d506a]={'$like':'%'+_0x196686[_0xc1a3('0x32')][_0xc1a3('0x5c')]+'%'};return _0x27486f;})});}_0x2b298f=_[_0xc1a3('0x3d')]({},_0x2b298f,_0x196686[_0xc1a3('0x3f')]);return db['CmHopper'][_0xc1a3('0x1c')]({'where':_0x2b298f[_0xc1a3('0x3b')]})[_0xc1a3('0x23')](function(_0x2730a4){_0x46d031[_0xc1a3('0x1c')]=_0x2730a4;if(_0x196686[_0xc1a3('0x32')]['includeAll']){_0x2b298f[_0xc1a3('0x41')]=[{'all':!![]}];}return db[_0xc1a3('0x59')][_0xc1a3('0x5d')](_0x2b298f);})[_0xc1a3('0x23')](function(_0x17e779){_0x46d031[_0xc1a3('0x42')]=_0x17e779;return _0x46d031;});}})['then'](respondWithFilteredResult(_0x296a3f,_0x2b298f))['catch'](handleError(_0x296a3f,null));};exports[_0xc1a3('0x5e')]=function(_0x2b9492,_0x4ac36d,_0x54621f){var _0x5cec68={'raw':!![],'where':{}};var _0x16716e={};var _0x456992={'count':0x0,'rows':[]};return db['Campaign'][_0xc1a3('0x58')]({'where':{'id':_0x2b9492[_0xc1a3('0x45')]['id']}})[_0xc1a3('0x23')](handleEntityNotFound(_0x4ac36d,null))['then'](function(_0x2d67ba){if(_0x2d67ba){_0x16716e[_0xc1a3('0x31')]=_['keys'](db[_0xc1a3('0x5f')]['rawAttributes']);_0x16716e[_0xc1a3('0x32')]=_[_0xc1a3('0x46')](_0x2b9492[_0xc1a3('0x32')]);_0x16716e[_0xc1a3('0x33')]=_[_0xc1a3('0x34')](_0x16716e['model'],_0x16716e[_0xc1a3('0x32')]);_0x5cec68[_0xc1a3('0x35')]=_[_0xc1a3('0x34')](_0x16716e['model'],qs[_0xc1a3('0x36')](_0x2b9492[_0xc1a3('0x32')]['fields']));_0x5cec68[_0xc1a3('0x35')]=_0x5cec68[_0xc1a3('0x35')][_0xc1a3('0x37')]?_0x5cec68[_0xc1a3('0x35')]:_0x16716e['model'];if(!_0x2b9492[_0xc1a3('0x32')][_0xc1a3('0x38')](_0xc1a3('0x5a'))){_0x5cec68[_0xc1a3('0x1a')]=qs[_0xc1a3('0x1a')](_0x2b9492['query'][_0xc1a3('0x1a')]);_0x5cec68[_0xc1a3('0x19')]=qs[_0xc1a3('0x19')](_0x2b9492[_0xc1a3('0x32')]['offset']);}_0x5cec68[_0xc1a3('0x39')]=qs[_0xc1a3('0x3a')](_0x2b9492[_0xc1a3('0x32')]['sort']);_0x5cec68[_0xc1a3('0x3b')]=qs['filters'](_[_0xc1a3('0x3c')](_0x2b9492[_0xc1a3('0x32')],_0x16716e['filters']));_0x5cec68[_0xc1a3('0x3b')][_0xc1a3('0x5b')]=_0x2d67ba['id'];if(_0x2b9492[_0xc1a3('0x32')][_0xc1a3('0x5c')]){_0x5cec68[_0xc1a3('0x3b')]=_[_0xc1a3('0x3d')](_0x5cec68[_0xc1a3('0x3b')],{'$or':_[_0xc1a3('0x2b')](_0x5cec68[_0xc1a3('0x35')],function(_0x1b609b){var _0x1313bf={};_0x1313bf[_0x1b609b]={'$like':'%'+_0x2b9492[_0xc1a3('0x32')]['filter']+'%'};return _0x1313bf;})});}_0x5cec68=_[_0xc1a3('0x3d')]({},_0x5cec68,_0x2b9492['options']);return db[_0xc1a3('0x5f')][_0xc1a3('0x1c')]({'where':_0x5cec68['where']})[_0xc1a3('0x23')](function(_0x3da49c){_0x456992[_0xc1a3('0x1c')]=_0x3da49c;if(_0x2b9492['query'][_0xc1a3('0x40')]){_0x5cec68[_0xc1a3('0x41')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xc1a3('0x5d')](_0x5cec68);})[_0xc1a3('0x23')](function(_0x3040ff){_0x456992[_0xc1a3('0x42')]=_0x3040ff;return _0x456992;});}})[_0xc1a3('0x23')](respondWithFilteredResult(_0x4ac36d,_0x5cec68))[_0xc1a3('0x43')](handleError(_0x4ac36d,null));};exports[_0xc1a3('0x60')]=function(_0x29b098,_0x2273e9,_0x5de47c){var _0x2b5e65={'raw':!![],'where':{}};var _0x2acea1={};var _0x1e60ed={'count':0x0,'rows':[]};return db[_0xc1a3('0x2c')]['findOne']({'where':{'id':_0x29b098[_0xc1a3('0x45')]['id']}})[_0xc1a3('0x23')](handleEntityNotFound(_0x2273e9,null))[_0xc1a3('0x23')](function(_0x52f67b){if(_0x52f67b){_0x2acea1['model']=_['keys'](db['CmHopperFinal'][_0xc1a3('0x2d')]);_0x2acea1[_0xc1a3('0x32')]=_[_0xc1a3('0x46')](_0x29b098['query']);_0x2acea1[_0xc1a3('0x33')]=_['intersection'](_0x2acea1[_0xc1a3('0x31')],_0x2acea1['query']);_0x2b5e65[_0xc1a3('0x35')]=_[_0xc1a3('0x34')](_0x2acea1[_0xc1a3('0x31')],qs[_0xc1a3('0x36')](_0x29b098[_0xc1a3('0x32')]['fields']));_0x2b5e65[_0xc1a3('0x35')]=_0x2b5e65[_0xc1a3('0x35')][_0xc1a3('0x37')]?_0x2b5e65[_0xc1a3('0x35')]:_0x2acea1[_0xc1a3('0x31')];if(!_0x29b098[_0xc1a3('0x32')][_0xc1a3('0x38')](_0xc1a3('0x5a'))){_0x2b5e65[_0xc1a3('0x1a')]=qs[_0xc1a3('0x1a')](_0x29b098[_0xc1a3('0x32')][_0xc1a3('0x1a')]);_0x2b5e65[_0xc1a3('0x19')]=qs[_0xc1a3('0x19')](_0x29b098['query'][_0xc1a3('0x19')]);}_0x2b5e65[_0xc1a3('0x39')]=qs[_0xc1a3('0x3a')](_0x29b098['query'][_0xc1a3('0x3a')]);_0x2b5e65[_0xc1a3('0x3b')]=qs[_0xc1a3('0x33')](_[_0xc1a3('0x3c')](_0x29b098[_0xc1a3('0x32')],_0x2acea1[_0xc1a3('0x33')]));_0x2b5e65['where']['CampaignId']=_0x52f67b['id'];if(_0x29b098[_0xc1a3('0x32')][_0xc1a3('0x5c')]){_0x2b5e65['where']=_[_0xc1a3('0x3d')](_0x2b5e65[_0xc1a3('0x3b')],{'$or':_['map'](_0x2b5e65[_0xc1a3('0x35')],function(_0x350c51){var _0x4aa2fa={};_0x4aa2fa[_0x350c51]={'$like':'%'+_0x29b098[_0xc1a3('0x32')][_0xc1a3('0x5c')]+'%'};return _0x4aa2fa;})});}_0x2b5e65=_[_0xc1a3('0x3d')]({},_0x2b5e65,_0x29b098['options']);return db[_0xc1a3('0x61')]['count']({'where':_0x2b5e65[_0xc1a3('0x3b')]})[_0xc1a3('0x23')](function(_0x10bb65){_0x1e60ed['count']=_0x10bb65;if(_0x29b098['query'][_0xc1a3('0x40')]){_0x2b5e65[_0xc1a3('0x41')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xc1a3('0x5d')](_0x2b5e65);})[_0xc1a3('0x23')](function(_0x49bfab){_0x1e60ed[_0xc1a3('0x42')]=_0x49bfab;return _0x1e60ed;});}})[_0xc1a3('0x23')](respondWithFilteredResult(_0x2273e9,_0x2b5e65))[_0xc1a3('0x43')](handleError(_0x2273e9,null));};exports[_0xc1a3('0x62')]=function(_0x297f95,_0x21f3f0,_0x17acc4){var _0xe7023e={'raw':!![],'where':{}};var _0x150f44={};var _0x3e5359={'count':0x0,'rows':[]};return db[_0xc1a3('0x2c')][_0xc1a3('0x58')]({'where':{'id':_0x297f95['params']['id']}})[_0xc1a3('0x23')](handleEntityNotFound(_0x21f3f0,null))[_0xc1a3('0x23')](function(_0x53a74a){if(_0x53a74a){_0x150f44[_0xc1a3('0x31')]=_['keys'](db[_0xc1a3('0x63')][_0xc1a3('0x2d')]);_0x150f44[_0xc1a3('0x32')]=_[_0xc1a3('0x46')](_0x297f95[_0xc1a3('0x32')]);_0x150f44['filters']=_['intersection'](_0x150f44['model'],_0x150f44[_0xc1a3('0x32')]);_0xe7023e[_0xc1a3('0x35')]=_['intersection'](_0x150f44['model'],qs[_0xc1a3('0x36')](_0x297f95[_0xc1a3('0x32')][_0xc1a3('0x36')]));_0xe7023e[_0xc1a3('0x35')]=_0xe7023e[_0xc1a3('0x35')][_0xc1a3('0x37')]?_0xe7023e[_0xc1a3('0x35')]:_0x150f44[_0xc1a3('0x31')];if(!_0x297f95['query'][_0xc1a3('0x38')](_0xc1a3('0x5a'))){_0xe7023e['limit']=qs[_0xc1a3('0x1a')](_0x297f95['query'][_0xc1a3('0x1a')]);_0xe7023e[_0xc1a3('0x19')]=qs[_0xc1a3('0x19')](_0x297f95['query'][_0xc1a3('0x19')]);}_0xe7023e['order']=qs['sort'](_0x297f95[_0xc1a3('0x32')][_0xc1a3('0x3a')]);_0xe7023e[_0xc1a3('0x3b')]=qs[_0xc1a3('0x33')](_[_0xc1a3('0x3c')](_0x297f95[_0xc1a3('0x32')],_0x150f44[_0xc1a3('0x33')]));_0xe7023e[_0xc1a3('0x3b')]['CampaignId']=_0x53a74a['id'];if(_0x297f95[_0xc1a3('0x32')][_0xc1a3('0x5c')]){_0xe7023e[_0xc1a3('0x3b')]=_[_0xc1a3('0x3d')](_0xe7023e[_0xc1a3('0x3b')],{'$or':_[_0xc1a3('0x2b')](_0xe7023e[_0xc1a3('0x35')],function(_0x568582){var _0x2dc493={};_0x2dc493[_0x568582]={'$like':'%'+_0x297f95[_0xc1a3('0x32')]['filter']+'%'};return _0x2dc493;})});}_0xe7023e=_[_0xc1a3('0x3d')]({},_0xe7023e,_0x297f95[_0xc1a3('0x3f')]);return db[_0xc1a3('0x63')]['count']({'where':_0xe7023e[_0xc1a3('0x3b')]})[_0xc1a3('0x23')](function(_0x5296b9){_0x3e5359[_0xc1a3('0x1c')]=_0x5296b9;if(_0x297f95[_0xc1a3('0x32')]['includeAll']){_0xe7023e[_0xc1a3('0x41')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xc1a3('0x5d')](_0xe7023e);})[_0xc1a3('0x23')](function(_0x2fb56b){_0x3e5359[_0xc1a3('0x42')]=_0x2fb56b;return _0x3e5359;});}})[_0xc1a3('0x23')](respondWithFilteredResult(_0x21f3f0,_0xe7023e))[_0xc1a3('0x43')](handleError(_0x21f3f0,null));};exports[_0xc1a3('0x64')]=function(_0x143407,_0xf32bd5,_0x11f9fc){var _0x2790c4={};var _0xffbc3d={};var _0x1a5239;var _0x5f23d3;return db[_0xc1a3('0x2c')][_0xc1a3('0x58')]({'where':{'id':_0x143407[_0xc1a3('0x45')]['id']}})[_0xc1a3('0x23')](handleEntityNotFound(_0xf32bd5,null))[_0xc1a3('0x23')](function(_0x20f643){if(_0x20f643){_0x1a5239=_0x20f643;_0xffbc3d[_0xc1a3('0x31')]=_[_0xc1a3('0x46')](db[_0xc1a3('0x65')][_0xc1a3('0x2d')]);_0xffbc3d['query']=_['keys'](_0x143407[_0xc1a3('0x32')]);_0xffbc3d[_0xc1a3('0x33')]=_[_0xc1a3('0x34')](_0xffbc3d[_0xc1a3('0x31')],_0xffbc3d['query']);_0x2790c4[_0xc1a3('0x35')]=_['intersection'](_0xffbc3d[_0xc1a3('0x31')],qs['fields'](_0x143407[_0xc1a3('0x32')][_0xc1a3('0x36')]));_0x2790c4[_0xc1a3('0x35')]=_0x2790c4[_0xc1a3('0x35')][_0xc1a3('0x37')]?_0x2790c4['attributes']:_0xffbc3d['model'];_0x2790c4[_0xc1a3('0x39')]=qs[_0xc1a3('0x3a')](_0x143407[_0xc1a3('0x32')][_0xc1a3('0x3a')]);_0x2790c4[_0xc1a3('0x3b')]=qs[_0xc1a3('0x33')](_[_0xc1a3('0x3c')](_0x143407[_0xc1a3('0x32')],_0xffbc3d[_0xc1a3('0x33')]));if(_0x143407[_0xc1a3('0x32')][_0xc1a3('0x5c')]){_0x2790c4['where']=_['merge'](_0x2790c4[_0xc1a3('0x3b')],{'$or':_[_0xc1a3('0x2b')](_0x2790c4['attributes'],function(_0xc6a718){var _0x1ea45f={};_0x1ea45f[_0xc6a718]={'$like':'%'+_0x143407[_0xc1a3('0x32')][_0xc1a3('0x5c')]+'%'};return _0x1ea45f;})});}_0x2790c4=_[_0xc1a3('0x3d')]({},_0x2790c4,_0x143407[_0xc1a3('0x3f')]);return _0x1a5239[_0xc1a3('0x64')](_0x2790c4);}})[_0xc1a3('0x23')](function(_0x342c67){if(_0x342c67){_0x5f23d3=_0x342c67[_0xc1a3('0x37')];if(!_0x143407[_0xc1a3('0x32')]['hasOwnProperty'](_0xc1a3('0x5a'))){_0x2790c4['limit']=qs[_0xc1a3('0x1a')](_0x143407[_0xc1a3('0x32')][_0xc1a3('0x1a')]);_0x2790c4[_0xc1a3('0x19')]=qs[_0xc1a3('0x19')](_0x143407[_0xc1a3('0x32')][_0xc1a3('0x19')]);}return _0x1a5239['getLists'](_0x2790c4);}})['then'](function(_0x2d7b33){if(_0x2d7b33){return _0x2d7b33?{'count':_0x5f23d3,'rows':_0x2d7b33}:null;}})[_0xc1a3('0x23')](respondWithResult(_0xf32bd5,null))[_0xc1a3('0x43')](handleError(_0xf32bd5,null));};exports[_0xc1a3('0x66')]=function(_0x1bd8dd,_0x46b8d8,_0x4e0f94){var _0x1b9dce,_0x2e8f13;return db['Campaign'][_0xc1a3('0x47')]({'where':{'id':_0x1bd8dd['params']['id']}})[_0xc1a3('0x23')](handleEntityNotFound(_0x46b8d8,null))['then'](function(_0x1b3715){if(_0x1b3715){_0x2e8f13=_0x1b3715;return _0x1b3715[_0xc1a3('0x66')](_0x1bd8dd['body']['ids'],_['omit'](_0x1bd8dd[_0xc1a3('0x49')],[_0xc1a3('0x67'),'id'])||{});}return null;})[_0xc1a3('0x68')](function(_0x1ae7f9){var _0x279a55;_0x1b9dce=_0x1ae7f9||[];var _0x55b682=[];if(_0x1ae7f9){for(var _0x104966=0x0;_0x104966<_0x1ae7f9['length'];_0x104966+=0x1){var _0x240449=_0x1ae7f9[_0x104966][_0xc1a3('0x25')]({'plain':!![]});_0x2e8f13[_0xc1a3('0x69')]=_0x1bd8dd[_0xc1a3('0x49')][_0xc1a3('0x69')]?_0x1bd8dd[_0xc1a3('0x49')][_0xc1a3('0x69')]:_0x2e8f13[_0xc1a3('0x69')];switch(_0x2e8f13[_0xc1a3('0x69')]){case _0xc1a3('0x6a'):_0x279a55=squel[_0xc1a3('0x6b')]()[_0xc1a3('0x6c')](_0xc1a3('0x6d'))[_0xc1a3('0x6e')](['phone',_0xc1a3('0x6f'),_0xc1a3('0x70'),_0xc1a3('0x71'),_0xc1a3('0x5b'),_0xc1a3('0x53'),_0xc1a3('0x54')],squel[_0xc1a3('0x72')]()[_0xc1a3('0x73')]('phone',_0xc1a3('0x74'))[_0xc1a3('0x73')](_0xc1a3('0x75'),_0xc1a3('0x6f'))[_0xc1a3('0x73')]('id',_0xc1a3('0x70'))['field'](_0x240449[_0xc1a3('0x76')][_0xc1a3('0x77')](),_0xc1a3('0x71'))[_0xc1a3('0x73')](_0x1bd8dd['params']['id'][_0xc1a3('0x77')](),_0xc1a3('0x5b'))[_0xc1a3('0x73')](_0xc1a3('0x75'),'createdAt')['field'](_0xc1a3('0x75'),_0xc1a3('0x54'))['from'](_0xc1a3('0x78'))[_0xc1a3('0x3b')]('deletedAt\x20IS\x20NULL')[_0xc1a3('0x3b')](_0xc1a3('0x79'),_0x240449['CmListId']['toString']())[_0xc1a3('0x3b')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xc1a3('0x7a'),squel[_0xc1a3('0x72')]()[_0xc1a3('0x73')]('COALESCE(calleridnum,\x27\x27)')[_0xc1a3('0x7b')](_0xc1a3('0x7c'))[_0xc1a3('0x3b')](_0xc1a3('0x7d'),_0x1bd8dd[_0xc1a3('0x45')]['id'][_0xc1a3('0x77')]()))['where'](_0xc1a3('0x7a'),squel['select']()['field'](_0xc1a3('0x7e'))[_0xc1a3('0x7b')]('cm_hopper')[_0xc1a3('0x3b')](_0xc1a3('0x7d'),_0x1bd8dd['params']['id'][_0xc1a3('0x77')]())))[_0xc1a3('0x77')]();break;case _0xc1a3('0x7f'):_0x279a55=squel[_0xc1a3('0x6b')]()['into'](_0xc1a3('0x6d'))['fromQuery']([_0xc1a3('0x74'),'scheduledAt',_0xc1a3('0x70'),_0xc1a3('0x71'),'CampaignId',_0xc1a3('0x53'),_0xc1a3('0x54')],squel[_0xc1a3('0x72')]()['field'](_0xc1a3('0x74'),'phone')[_0xc1a3('0x73')](_0xc1a3('0x75'),_0xc1a3('0x6f'))[_0xc1a3('0x73')]('id',_0xc1a3('0x70'))[_0xc1a3('0x73')](_0x240449[_0xc1a3('0x76')][_0xc1a3('0x77')](),_0xc1a3('0x71'))[_0xc1a3('0x73')](_0x1bd8dd[_0xc1a3('0x45')]['id'][_0xc1a3('0x77')](),_0xc1a3('0x5b'))[_0xc1a3('0x73')](_0xc1a3('0x75'),_0xc1a3('0x53'))[_0xc1a3('0x73')](_0xc1a3('0x75'),_0xc1a3('0x54'))[_0xc1a3('0x7b')](_0xc1a3('0x78'))[_0xc1a3('0x3b')](_0xc1a3('0x80'))[_0xc1a3('0x3b')](_0xc1a3('0x79'),_0x240449[_0xc1a3('0x76')][_0xc1a3('0x77')]())[_0xc1a3('0x3b')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xc1a3('0x7a'),squel[_0xc1a3('0x72')]()[_0xc1a3('0x73')](_0xc1a3('0x7e'))[_0xc1a3('0x7b')](_0xc1a3('0x6d'))[_0xc1a3('0x3b')](_0xc1a3('0x7d'),_0x1bd8dd[_0xc1a3('0x45')]['id'][_0xc1a3('0x77')]())))[_0xc1a3('0x77')]();break;default:_0x279a55=squel['insert']()[_0xc1a3('0x6c')](_0xc1a3('0x6d'))[_0xc1a3('0x6e')]([_0xc1a3('0x74'),_0xc1a3('0x6f'),_0xc1a3('0x70'),_0xc1a3('0x71'),_0xc1a3('0x5b'),_0xc1a3('0x53'),_0xc1a3('0x54')],squel[_0xc1a3('0x72')]()['field'](_0xc1a3('0x74'),_0xc1a3('0x74'))[_0xc1a3('0x73')](_0xc1a3('0x75'),_0xc1a3('0x6f'))[_0xc1a3('0x73')]('id',_0xc1a3('0x70'))['field'](_0x240449[_0xc1a3('0x76')][_0xc1a3('0x77')](),'ListId')['field'](_0x1bd8dd[_0xc1a3('0x45')]['id'][_0xc1a3('0x77')](),_0xc1a3('0x5b'))[_0xc1a3('0x73')]('NOW()',_0xc1a3('0x53'))[_0xc1a3('0x73')](_0xc1a3('0x75'),_0xc1a3('0x54'))['from']('cm_contacts')[_0xc1a3('0x3b')](_0xc1a3('0x80'))['where'](_0xc1a3('0x79'),_0x240449[_0xc1a3('0x76')][_0xc1a3('0x77')]())[_0xc1a3('0x3b')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x55b682[_0xc1a3('0x81')](db[_0xc1a3('0x82')][_0xc1a3('0x32')](_0x279a55));}return BPromise['all'](_0x55b682);}})[_0xc1a3('0x23')](function(){return _0x1b9dce;})[_0xc1a3('0x23')](respondWithResult(_0x46b8d8,null))[_0xc1a3('0x43')](handleError(_0x46b8d8,null));};exports[_0xc1a3('0x83')]=function(_0x226f2d,_0x5185cf,_0xf6b252){return db[_0xc1a3('0x2c')][_0xc1a3('0x47')]({'where':{'id':_0x226f2d['params']['id']}})[_0xc1a3('0x23')](handleEntityNotFound(_0x5185cf,null))[_0xc1a3('0x23')](function(_0x40dadf){if(_0x40dadf){return _0x40dadf[_0xc1a3('0x83')](_0x226f2d[_0xc1a3('0x32')][_0xc1a3('0x67')]);}})[_0xc1a3('0x23')](function(_0x50e099){if(_0x50e099){return db['CmHopper'][_0xc1a3('0x24')]({'where':{'ListId':_0x226f2d['query'][_0xc1a3('0x67')],'CampaignId':_0x226f2d[_0xc1a3('0x45')]['id']}})[_0xc1a3('0x23')](function(){return _0x50e099;});}})[_0xc1a3('0x23')](respondWithStatusCode(_0x5185cf,null))[_0xc1a3('0x43')](handleError(_0x5185cf,null));};exports[_0xc1a3('0x84')]=function(_0x52a19b,_0x491b4e,_0x1238ca){var _0x35560d={};var _0x36e068={};var _0x5519af;var _0x417b55;return db['Campaign'][_0xc1a3('0x58')]({'where':{'id':_0x52a19b[_0xc1a3('0x45')]['id']}})[_0xc1a3('0x23')](handleEntityNotFound(_0x491b4e,null))[_0xc1a3('0x23')](function(_0x276b1e){if(_0x276b1e){_0x5519af=_0x276b1e;_0x36e068[_0xc1a3('0x31')]=_[_0xc1a3('0x46')](db[_0xc1a3('0x65')][_0xc1a3('0x2d')]);_0x36e068['query']=_['keys'](_0x52a19b[_0xc1a3('0x32')]);_0x36e068['filters']=_[_0xc1a3('0x34')](_0x36e068['model'],_0x36e068[_0xc1a3('0x32')]);_0x35560d[_0xc1a3('0x35')]=_[_0xc1a3('0x34')](_0x36e068['model'],qs[_0xc1a3('0x36')](_0x52a19b['query']['fields']));_0x35560d[_0xc1a3('0x35')]=_0x35560d[_0xc1a3('0x35')][_0xc1a3('0x37')]?_0x35560d['attributes']:_0x36e068[_0xc1a3('0x31')];_0x35560d[_0xc1a3('0x39')]=qs[_0xc1a3('0x3a')](_0x52a19b['query'][_0xc1a3('0x3a')]);_0x35560d['where']=qs[_0xc1a3('0x33')](_[_0xc1a3('0x3c')](_0x52a19b[_0xc1a3('0x32')],_0x36e068[_0xc1a3('0x33')]));if(_0x52a19b[_0xc1a3('0x32')][_0xc1a3('0x5c')]){_0x35560d[_0xc1a3('0x3b')]=_[_0xc1a3('0x3d')](_0x35560d['where'],{'$or':_[_0xc1a3('0x2b')](_0x35560d[_0xc1a3('0x35')],function(_0x2b1e31){var _0x3e460b={};_0x3e460b[_0x2b1e31]={'$like':'%'+_0x52a19b[_0xc1a3('0x32')][_0xc1a3('0x5c')]+'%'};return _0x3e460b;})});}_0x35560d=_[_0xc1a3('0x3d')]({},_0x35560d,_0x52a19b['options']);return _0x5519af[_0xc1a3('0x84')](_0x35560d);}})['then'](function(_0x983277){if(_0x983277){_0x417b55=_0x983277['length'];if(!_0x52a19b[_0xc1a3('0x32')][_0xc1a3('0x38')](_0xc1a3('0x5a'))){_0x35560d[_0xc1a3('0x1a')]=qs[_0xc1a3('0x1a')](_0x52a19b[_0xc1a3('0x32')][_0xc1a3('0x1a')]);_0x35560d[_0xc1a3('0x19')]=qs[_0xc1a3('0x19')](_0x52a19b[_0xc1a3('0x32')]['offset']);}return _0x5519af[_0xc1a3('0x84')](_0x35560d);}})[_0xc1a3('0x23')](function(_0x224b75){if(_0x224b75){return _0x224b75?{'count':_0x417b55,'rows':_0x224b75}:null;}})[_0xc1a3('0x23')](respondWithResult(_0x491b4e,null))[_0xc1a3('0x43')](handleError(_0x491b4e,null));};exports[_0xc1a3('0x85')]=function(_0x51f555,_0x437512,_0x21a145){var _0x243b91,_0x29827c;return db[_0xc1a3('0x2c')][_0xc1a3('0x47')]({'where':{'id':_0x51f555[_0xc1a3('0x45')]['id']}})[_0xc1a3('0x23')](handleEntityNotFound(_0x437512,null))[_0xc1a3('0x23')](function(_0x24ba92){if(_0x24ba92){_0x29827c=_0x24ba92;return _0x24ba92[_0xc1a3('0x85')](_0x51f555[_0xc1a3('0x49')][_0xc1a3('0x67')],_[_0xc1a3('0x52')](_0x51f555[_0xc1a3('0x49')],[_0xc1a3('0x67'),'id'])||{});}return null;})['spread'](function(_0x2351fa){var _0x5bd557;_0x243b91=_0x2351fa||[];var _0x598816=[];if(_0x2351fa){for(var _0xc85f98=0x0;_0xc85f98<_0x2351fa[_0xc1a3('0x37')];_0xc85f98+=0x1){var _0x42c190=_0x2351fa[_0xc85f98][_0xc1a3('0x25')]({'plain':!![]});_0x5bd557=squel['insert']()[_0xc1a3('0x6c')](_0xc1a3('0x86'))['fromQuery']([_0xc1a3('0x74'),_0xc1a3('0x70'),_0xc1a3('0x71'),_0xc1a3('0x5b'),'createdAt',_0xc1a3('0x54')],squel[_0xc1a3('0x72')]()[_0xc1a3('0x73')](_0xc1a3('0x74'),_0xc1a3('0x74'))[_0xc1a3('0x73')]('id',_0xc1a3('0x70'))['field'](_0x42c190[_0xc1a3('0x76')]['toString'](),_0xc1a3('0x71'))['field'](_0x51f555[_0xc1a3('0x45')]['id']['toString'](),_0xc1a3('0x5b'))[_0xc1a3('0x73')](_0xc1a3('0x75'),_0xc1a3('0x53'))[_0xc1a3('0x73')](_0xc1a3('0x75'),_0xc1a3('0x54'))[_0xc1a3('0x7b')](_0xc1a3('0x78'))[_0xc1a3('0x3b')](_0xc1a3('0x80'))[_0xc1a3('0x3b')]('ListId\x20=\x20?',_0x42c190[_0xc1a3('0x76')]['toString']())[_0xc1a3('0x3b')](_0xc1a3('0x87')))['toString']();_0x598816[_0xc1a3('0x81')](db[_0xc1a3('0x82')][_0xc1a3('0x32')](_0x5bd557));}return BPromise[_0xc1a3('0x88')](_0x598816);}})['then'](function(){return _0x243b91;})['then'](respondWithResult(_0x437512,null))['catch'](handleError(_0x437512,null));};exports['removeBlackLists']=function(_0x257771,_0x57a653,_0x3b01db){return db[_0xc1a3('0x2c')][_0xc1a3('0x47')]({'where':{'id':_0x257771[_0xc1a3('0x45')]['id']}})[_0xc1a3('0x23')](handleEntityNotFound(_0x57a653,null))['then'](function(_0x5a03ca){if(_0x5a03ca){return _0x5a03ca[_0xc1a3('0x89')](_0x257771[_0xc1a3('0x32')][_0xc1a3('0x67')]);}})['then'](function(_0x194813){if(_0x194813){return db['CmHopperBlack'][_0xc1a3('0x24')]({'where':{'ListId':_0x257771[_0xc1a3('0x32')][_0xc1a3('0x67')],'CampaignId':_0x257771[_0xc1a3('0x45')]['id']}})['then'](function(){return _0x194813;});}})[_0xc1a3('0x23')](respondWithStatusCode(_0x57a653,null))['catch'](handleError(_0x57a653,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 120f156..2b94b22 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(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 1aaed5c..c2282d0 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 _0x847d=['request','then','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','Campaign,\x20%s,\x20%s','message','info','result','catch','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','GetCampaign','debug','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x13ad22,_0x29a4e7){var _0x54af2b=function(_0x44878a){while(--_0x44878a){_0x13ad22['push'](_0x13ad22['shift']());}};_0x54af2b(++_0x29a4e7);}(_0x847d,0x14a));var _0xd847=function(_0x3be7ff,_0x12e714){_0x3be7ff=_0x3be7ff-0x0;var _0x186721=_0x847d[_0x3be7ff];return _0x186721;};'use strict';var _=require('lodash');var util=require(_0xd847('0x0'));var moment=require(_0xd847('0x1'));var BPromise=require(_0xd847('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd847('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd847('0x4'));var logger=require(_0xd847('0x5'))('rpc');var config=require(_0xd847('0x6'));var jayson=require(_0xd847('0x7'));var client=jayson[_0xd847('0x8')][_0xd847('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f3349,_0x20dbfd,_0x19fdb5){return new BPromise(function(_0x2bb22b,_0x235e82){return client[_0xd847('0xa')](_0x5f3349,_0x19fdb5)[_0xd847('0xb')](function(_0x17cb36){logger['info']('Campaign,\x20%s,\x20%s',_0x20dbfd,'request\x20sent');logger['debug'](_0xd847('0xc'),_0x20dbfd,_0xd847('0xd'),JSON[_0xd847('0xe')](_0x17cb36));if(_0x17cb36['error']){if(_0x17cb36['error'][_0xd847('0xf')]===0x1f4){logger[_0xd847('0x10')](_0xd847('0x11'),_0x20dbfd,_0x17cb36[_0xd847('0x10')][_0xd847('0x12')]);return _0x235e82(_0x17cb36[_0xd847('0x10')][_0xd847('0x12')]);}logger[_0xd847('0x10')](_0xd847('0x11'),_0x20dbfd,_0x17cb36[_0xd847('0x10')][_0xd847('0x12')]);return _0x2bb22b(_0x17cb36['error'][_0xd847('0x12')]);}else{logger[_0xd847('0x13')](_0xd847('0x11'),_0x20dbfd,_0xd847('0xd'));_0x2bb22b(_0x17cb36[_0xd847('0x14')]['message']);}})[_0xd847('0x15')](function(_0x3e1e1c){logger[_0xd847('0x10')](_0xd847('0x11'),_0x20dbfd,_0x3e1e1c);_0x235e82(_0x3e1e1c);});});}exports['GetCampaign']=function(_0x1ef765){var _0x5eb665=this;return new Promise(function(_0x4b6264,_0x44a57b){return db[_0xd847('0x16')][_0xd847('0x17')]({'raw':_0x1ef765[_0xd847('0x18')]?_0x1ef765['options'][_0xd847('0x19')]===undefined?!![]:![]:!![],'where':_0x1ef765['options']?_0x1ef765['options'][_0xd847('0x1a')]||null:null,'attributes':_0x1ef765[_0xd847('0x18')]?_0x1ef765[_0xd847('0x18')][_0xd847('0x1b')]||null:null,'limit':_0x1ef765[_0xd847('0x18')]?_0x1ef765[_0xd847('0x18')][_0xd847('0x1c')]||null:null,'include':_0x1ef765[_0xd847('0x18')]?_0x1ef765[_0xd847('0x18')][_0xd847('0x1d')]?_[_0xd847('0x1e')](_0x1ef765[_0xd847('0x18')]['include'],function(_0x560563){return{'model':db[_0x560563[_0xd847('0x1f')]],'as':_0x560563['as'],'attributes':_0x560563[_0xd847('0x1b')],'include':_0x560563[_0xd847('0x1d')]?_['map'](_0x560563[_0xd847('0x1d')],function(_0x246920){return{'model':db[_0x246920[_0xd847('0x1f')]],'as':_0x246920['as'],'attributes':_0x246920[_0xd847('0x1b')],'include':_0x246920[_0xd847('0x1d')]?_[_0xd847('0x1e')](_0x246920[_0xd847('0x1d')],function(_0x460eba){return{'model':db[_0x460eba[_0xd847('0x1f')]],'as':_0x460eba['as'],'attributes':_0x460eba['attributes']};}):[]};}):[]};}):[]:[]})[_0xd847('0xb')](function(_0x1d03e2){logger[_0xd847('0x13')](_0xd847('0x20'),_0x1ef765);logger[_0xd847('0x21')](_0xd847('0x20'),_0x1ef765,JSON['stringify'](_0x1d03e2));_0x4b6264(_0x1d03e2);})[_0xd847('0x15')](function(_0x5375fe){logger['error']('GetCampaign',_0x5375fe[_0xd847('0x12')],_0x1ef765);_0x44a57b(_0x5eb665[_0xd847('0x10')](0x1f4,_0x5375fe[_0xd847('0x12')]));});});}; \ No newline at end of file +var _0x8a9c=['jayson/promise','http','request','then','request\x20sent','debug','error','message','info','Campaign,\x20%s,\x20%s','Campaign','findAll','options','where','attributes','limit','include','map','model','GetCampaign','stringify','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x7e1874,_0x4cd180){var _0x2d3d3e=function(_0x4f564d){while(--_0x4f564d){_0x7e1874['push'](_0x7e1874['shift']());}};_0x2d3d3e(++_0x4cd180);}(_0x8a9c,0x12d));var _0xc8a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a9c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc8a9('0x0'));var util=require(_0xc8a9('0x1'));var moment=require(_0xc8a9('0x2'));var BPromise=require(_0xc8a9('0x3'));var rs=require(_0xc8a9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc8a9('0x5'))['db'];var utils=require(_0xc8a9('0x6'));var logger=require('../../config/logger')(_0xc8a9('0x7'));var config=require(_0xc8a9('0x8'));var jayson=require(_0xc8a9('0x9'));var client=jayson['client'][_0xc8a9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3dc31c,_0x1d49c8,_0x4520a2){return new BPromise(function(_0x2928f3,_0x241eae){return client[_0xc8a9('0xb')](_0x3dc31c,_0x4520a2)[_0xc8a9('0xc')](function(_0xb079ad){logger['info']('Campaign,\x20%s,\x20%s',_0x1d49c8,_0xc8a9('0xd'));logger[_0xc8a9('0xe')]('Campaign,\x20%s,\x20%s,\x20%s',_0x1d49c8,_0xc8a9('0xd'),JSON['stringify'](_0xb079ad));if(_0xb079ad[_0xc8a9('0xf')]){if(_0xb079ad[_0xc8a9('0xf')]['code']===0x1f4){logger[_0xc8a9('0xf')]('Campaign,\x20%s,\x20%s',_0x1d49c8,_0xb079ad[_0xc8a9('0xf')][_0xc8a9('0x10')]);return _0x241eae(_0xb079ad[_0xc8a9('0xf')][_0xc8a9('0x10')]);}logger[_0xc8a9('0xf')]('Campaign,\x20%s,\x20%s',_0x1d49c8,_0xb079ad['error'][_0xc8a9('0x10')]);return _0x2928f3(_0xb079ad['error'][_0xc8a9('0x10')]);}else{logger[_0xc8a9('0x11')](_0xc8a9('0x12'),_0x1d49c8,_0xc8a9('0xd'));_0x2928f3(_0xb079ad['result']['message']);}})['catch'](function(_0x4d03fe){logger[_0xc8a9('0xf')](_0xc8a9('0x12'),_0x1d49c8,_0x4d03fe);_0x241eae(_0x4d03fe);});});}exports['GetCampaign']=function(_0x43f403){var _0x2d894e=this;return new Promise(function(_0x35bd4a,_0x20b70d){return db[_0xc8a9('0x13')][_0xc8a9('0x14')]({'raw':_0x43f403[_0xc8a9('0x15')]?_0x43f403[_0xc8a9('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x43f403[_0xc8a9('0x15')]?_0x43f403[_0xc8a9('0x15')][_0xc8a9('0x16')]||null:null,'attributes':_0x43f403[_0xc8a9('0x15')]?_0x43f403[_0xc8a9('0x15')][_0xc8a9('0x17')]||null:null,'limit':_0x43f403[_0xc8a9('0x15')]?_0x43f403[_0xc8a9('0x15')][_0xc8a9('0x18')]||null:null,'include':_0x43f403['options']?_0x43f403[_0xc8a9('0x15')][_0xc8a9('0x19')]?_[_0xc8a9('0x1a')](_0x43f403['options'][_0xc8a9('0x19')],function(_0x1dad26){return{'model':db[_0x1dad26['model']],'as':_0x1dad26['as'],'attributes':_0x1dad26[_0xc8a9('0x17')],'include':_0x1dad26[_0xc8a9('0x19')]?_['map'](_0x1dad26[_0xc8a9('0x19')],function(_0x19f42e){return{'model':db[_0x19f42e[_0xc8a9('0x1b')]],'as':_0x19f42e['as'],'attributes':_0x19f42e[_0xc8a9('0x17')],'include':_0x19f42e[_0xc8a9('0x19')]?_['map'](_0x19f42e[_0xc8a9('0x19')],function(_0x17f08c){return{'model':db[_0x17f08c[_0xc8a9('0x1b')]],'as':_0x17f08c['as'],'attributes':_0x17f08c[_0xc8a9('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x25aa4d){logger[_0xc8a9('0x11')](_0xc8a9('0x1c'),_0x43f403);logger['debug'](_0xc8a9('0x1c'),_0x43f403,JSON[_0xc8a9('0x1d')](_0x25aa4d));_0x35bd4a(_0x25aa4d);})[_0xc8a9('0x1e')](function(_0x411e23){logger[_0xc8a9('0xf')](_0xc8a9('0x1c'),_0x411e23[_0xc8a9('0x10')],_0x43f403);_0x20b70d(_0x2d894e[_0xc8a9('0xf')](0x1f4,_0x411e23[_0xc8a9('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index f42a96f..0940a6d 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 _0xf421=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','create','clone','addLists','addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists','exports','util','path'];(function(_0x317cb9,_0x3afb86){var _0x54121f=function(_0xbfdd8a){while(--_0xbfdd8a){_0x317cb9['push'](_0x317cb9['shift']());}};_0x54121f(++_0x3afb86);}(_0xf421,0x64));var _0x1f42=function(_0x32c48c,_0x5d669e){_0x32c48c=_0x32c48c-0x0;var _0x133729=_0xf421[_0x32c48c];return _0x133729;};'use strict';var multer=require('multer');var util=require(_0x1f42('0x0'));var path=require(_0x1f42('0x1'));var timeout=require(_0x1f42('0x2'));var express=require(_0x1f42('0x3'));var router=express[_0x1f42('0x4')]();var fs_extra=require(_0x1f42('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1f42('0x6'));var config=require(_0x1f42('0x7'));var controller=require(_0x1f42('0x8'));router[_0x1f42('0x9')]('/',auth[_0x1f42('0xa')](),controller['index']);router['get'](_0x1f42('0xb'),auth[_0x1f42('0xa')](),controller[_0x1f42('0xc')]);router[_0x1f42('0x9')](_0x1f42('0xd'),auth[_0x1f42('0xa')](),controller[_0x1f42('0xe')]);router[_0x1f42('0x9')](_0x1f42('0xf'),auth['isAuthenticated'](),controller[_0x1f42('0x10')]);router[_0x1f42('0x9')]('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0x1f42('0x11')]);router[_0x1f42('0x9')]('/:id/hopper_black',auth[_0x1f42('0xa')](),controller[_0x1f42('0x12')]);router[_0x1f42('0x9')](_0x1f42('0x13'),auth[_0x1f42('0xa')](),controller[_0x1f42('0x14')]);router[_0x1f42('0x9')](_0x1f42('0x15'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0x1f42('0x16')]('/',auth[_0x1f42('0xa')](),controller[_0x1f42('0x17')]);router[_0x1f42('0x16')]('/:id/clone',auth[_0x1f42('0xa')](),controller[_0x1f42('0x18')]);router[_0x1f42('0x16')](_0x1f42('0x13'),auth[_0x1f42('0xa')](),controller[_0x1f42('0x19')]);router[_0x1f42('0x16')](_0x1f42('0x15'),auth['isAuthenticated'](),controller[_0x1f42('0x1a')]);router[_0x1f42('0x1b')]('/:id',auth[_0x1f42('0xa')](),controller[_0x1f42('0x1c')]);router[_0x1f42('0x1d')](_0x1f42('0xb'),auth[_0x1f42('0xa')](),controller[_0x1f42('0x1e')]);router[_0x1f42('0x1d')](_0x1f42('0x13'),auth[_0x1f42('0xa')](),controller[_0x1f42('0x1f')]);router[_0x1f42('0x1d')](_0x1f42('0x15'),auth['isAuthenticated'](),controller[_0x1f42('0x20')]);module[_0x1f42('0x21')]=router; \ No newline at end of file +var _0x2cde=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','create','/:id/clone','addLists','/:id/blacklists','addBlackLists','put','update','delete','removeBlackLists','multer','util'];(function(_0x5804a2,_0x10e37b){var _0x5a7932=function(_0x3ef1e1){while(--_0x3ef1e1){_0x5804a2['push'](_0x5804a2['shift']());}};_0x5a7932(++_0x10e37b);}(_0x2cde,0x1ed));var _0xe2cd=function(_0x293178,_0xa78b96){_0x293178=_0x293178-0x0;var _0x5b492e=_0x2cde[_0x293178];return _0x5b492e;};'use strict';var multer=require(_0xe2cd('0x0'));var util=require(_0xe2cd('0x1'));var path=require(_0xe2cd('0x2'));var timeout=require(_0xe2cd('0x3'));var express=require(_0xe2cd('0x4'));var router=express[_0xe2cd('0x5')]();var fs_extra=require(_0xe2cd('0x6'));var auth=require(_0xe2cd('0x7'));var interaction=require(_0xe2cd('0x8'));var config=require(_0xe2cd('0x9'));var controller=require('./campaign.controller');router[_0xe2cd('0xa')]('/',auth[_0xe2cd('0xb')](),controller['index']);router['get'](_0xe2cd('0xc'),auth[_0xe2cd('0xb')](),controller['show']);router[_0xe2cd('0xa')](_0xe2cd('0xd'),auth[_0xe2cd('0xb')](),controller[_0xe2cd('0xe')]);router[_0xe2cd('0xa')](_0xe2cd('0xf'),auth[_0xe2cd('0xb')](),controller[_0xe2cd('0x10')]);router['get']('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0xe2cd('0x11')]);router[_0xe2cd('0xa')](_0xe2cd('0x12'),auth[_0xe2cd('0xb')](),controller[_0xe2cd('0x13')]);router[_0xe2cd('0xa')](_0xe2cd('0x14'),auth[_0xe2cd('0xb')](),controller[_0xe2cd('0x15')]);router[_0xe2cd('0xa')]('/:id/blacklists',auth[_0xe2cd('0xb')](),controller[_0xe2cd('0x16')]);router[_0xe2cd('0x17')]('/',auth['isAuthenticated'](),controller[_0xe2cd('0x18')]);router[_0xe2cd('0x17')](_0xe2cd('0x19'),auth[_0xe2cd('0xb')](),controller['clone']);router['post'](_0xe2cd('0x14'),auth[_0xe2cd('0xb')](),controller[_0xe2cd('0x1a')]);router['post'](_0xe2cd('0x1b'),auth[_0xe2cd('0xb')](),controller[_0xe2cd('0x1c')]);router[_0xe2cd('0x1d')](_0xe2cd('0xc'),auth['isAuthenticated'](),controller[_0xe2cd('0x1e')]);router['delete'](_0xe2cd('0xc'),auth[_0xe2cd('0xb')](),controller['destroy']);router['delete'](_0xe2cd('0x14'),auth[_0xe2cd('0xb')](),controller['removeLists']);router[_0xe2cd('0x1f')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0xe2cd('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 445cb15..966fce0 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 _0xd457=['VIRTUAL','key','exports','STRING','TEXT'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xd457,0x197));var _0x7d45=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xd457[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require('sequelize');module[_0x7d45('0x0')]={'key':{'type':Sequelize[_0x7d45('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x7d45('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7d45('0x1')]},'name':{'type':Sequelize[_0x7d45('0x3')],'get':function(){return this['getDataValue'](_0x7d45('0x4'));}}}; \ No newline at end of file +var _0xda76=['TEXT','STRING','VIRTUAL','getDataValue','key','sequelize','exports'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xda76,0x1be));var _0x6da7=function(_0x19b91f,_0x4b78f8){_0x19b91f=_0x19b91f-0x0;var _0x4767fa=_0xda76[_0x19b91f];return _0x4767fa;};'use strict';var Sequelize=require(_0x6da7('0x0'));module[_0x6da7('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x6da7('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6da7('0x3')]},'name':{'type':Sequelize[_0x6da7('0x4')],'get':function(){return this[_0x6da7('0x5')](_0x6da7('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 6c45633..8dbe477 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 _0x45d5=['crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','get','CannedAnswers','UserProfileResource','then','error','stack','name','map','CannedAnswer','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','merge','options','includeAll','include','rows','catch','body','find','params','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x45d5,0xa4));var _0x545d=function(_0x597afe,_0x6748ca){_0x597afe=_0x597afe-0x0;var _0x4e3adc=_0x45d5[_0x597afe];return _0x4e3adc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x545d('0x0'));var zipdir=require(_0x545d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x545d('0x2'));var moment=require('moment');var BPromise=require(_0x545d('0x3'));var Mustache=require(_0x545d('0x4'));var util=require(_0x545d('0x5'));var path=require(_0x545d('0x6'));var sox=require(_0x545d('0x7'));var csv=require(_0x545d('0x8'));var ejs=require(_0x545d('0x9'));var fs=require('fs');var fs_extra=require(_0x545d('0xa'));var _=require(_0x545d('0xb'));var squel=require('squel');var crypto=require(_0x545d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x545d('0xd'));var toCsv=require(_0x545d('0x8'));var querystring=require(_0x545d('0xe'));var Papa=require(_0x545d('0xf'));var Redis=require(_0x545d('0x10'));var authService=require(_0x545d('0x11'));var qs=require(_0x545d('0x12'));var as=require(_0x545d('0x13'));var hardwareService=require(_0x545d('0x14'));var logger=require(_0x545d('0x15'))(_0x545d('0x16'));var utils=require('../../config/utils');var config=require(_0x545d('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43834f,_0x522b8e){_0x522b8e=_0x522b8e||0xcc;return function(_0x2ae645){if(_0x2ae645){return _0x43834f[_0x545d('0x18')](_0x522b8e);}return _0x43834f['status'](_0x522b8e)[_0x545d('0x19')]();};}function respondWithResult(_0x228311,_0x508b79){_0x508b79=_0x508b79||0xc8;return function(_0x59c9f2){if(_0x59c9f2){return _0x228311[_0x545d('0x1a')](_0x508b79)['json'](_0x59c9f2);}};}function respondWithFilteredResult(_0x54fddf,_0x410b64){return function(_0x45a024){if(_0x45a024){var _0x3012a3=typeof _0x410b64[_0x545d('0x1b')]===_0x545d('0x1c')&&typeof _0x410b64[_0x545d('0x1d')]===_0x545d('0x1c');var _0x3cc31f=_0x45a024[_0x545d('0x1e')];var _0x5814d6=_0x3012a3?0x0:_0x410b64[_0x545d('0x1b')];var _0x4e602f=_0x3012a3?_0x45a024[_0x545d('0x1e')]:_0x410b64[_0x545d('0x1b')]+_0x410b64['limit'];var _0x14e662;if(_0x4e602f>=_0x3cc31f){_0x4e602f=_0x3cc31f;_0x14e662=0xc8;}else{_0x14e662=0xce;}_0x54fddf[_0x545d('0x1a')](_0x14e662);return _0x54fddf[_0x545d('0x1f')](_0x545d('0x20'),_0x5814d6+'-'+_0x4e602f+'/'+_0x3cc31f)[_0x545d('0x21')](_0x45a024);}return null;};}function patchUpdates(_0x687cf){return function(_0x4d895e){try{jsonpatch[_0x545d('0x22')](_0x4d895e,_0x687cf,!![]);}catch(_0x49bac5){return BPromise[_0x545d('0x23')](_0x49bac5);}return _0x4d895e[_0x545d('0x24')]();};}function saveUpdates(_0x38e09e,_0x396bb3){return function(_0xb1f623){if(_0xb1f623){return _0xb1f623[_0x545d('0x25')](_0x38e09e)['then'](function(_0x285e10){return _0x285e10;});}return null;};}function removeEntity(_0x52657a,_0x50bfd0){return function(_0xe2afdf){if(_0xe2afdf){return _0xe2afdf[_0x545d('0x26')]()['then'](function(){var _0x5d44e3=_0xe2afdf[_0x545d('0x27')]({'plain':!![]});var _0x5f22ed=_0x545d('0x28');return db[_0x545d('0x29')][_0x545d('0x26')]({'where':{'type':_0x5f22ed,'resourceId':_0x5d44e3['id']}})[_0x545d('0x2a')](function(){return _0xe2afdf;});})[_0x545d('0x2a')](function(){_0x52657a[_0x545d('0x1a')](0xcc)[_0x545d('0x19')]();});}};}function handleEntityNotFound(_0x1311e4,_0x47fe21){return function(_0x1af7cc){if(!_0x1af7cc){_0x1311e4[_0x545d('0x18')](0x194);}return _0x1af7cc;};}function handleError(_0x460237,_0x46fe77){_0x46fe77=_0x46fe77||0x1f4;return function(_0x35bdcf){logger[_0x545d('0x2b')](_0x35bdcf[_0x545d('0x2c')]);if(_0x35bdcf[_0x545d('0x2d')]){delete _0x35bdcf[_0x545d('0x2d')];}_0x460237[_0x545d('0x1a')](_0x46fe77)['send'](_0x35bdcf);};}exports['index']=function(_0x2a0525,_0x43aeab){var _0x46442a={},_0x256b1b={},_0x166ba5={'count':0x0,'rows':[]};var _0x122713=_[_0x545d('0x2e')](db[_0x545d('0x2f')][_0x545d('0x30')],function(_0x9b2511){return{'name':_0x9b2511[_0x545d('0x31')],'type':_0x9b2511[_0x545d('0x32')]['key']};});_0x256b1b[_0x545d('0x33')]=_[_0x545d('0x2e')](_0x122713,_0x545d('0x2d'));_0x256b1b[_0x545d('0x34')]=_[_0x545d('0x35')](_0x2a0525['query']);_0x256b1b[_0x545d('0x36')]=_[_0x545d('0x37')](_0x256b1b[_0x545d('0x33')],_0x256b1b[_0x545d('0x34')]);_0x46442a[_0x545d('0x38')]=_[_0x545d('0x37')](_0x256b1b[_0x545d('0x33')],qs[_0x545d('0x39')](_0x2a0525[_0x545d('0x34')]['fields']));_0x46442a[_0x545d('0x38')]=_0x46442a[_0x545d('0x38')][_0x545d('0x3a')]?_0x46442a[_0x545d('0x38')]:_0x256b1b[_0x545d('0x33')];if(!_0x2a0525[_0x545d('0x34')]['hasOwnProperty'](_0x545d('0x3b'))){_0x46442a[_0x545d('0x1d')]=qs['limit'](_0x2a0525[_0x545d('0x34')][_0x545d('0x1d')]);_0x46442a[_0x545d('0x1b')]=qs[_0x545d('0x1b')](_0x2a0525['query'][_0x545d('0x1b')]);}_0x46442a[_0x545d('0x3c')]=qs[_0x545d('0x3d')](_0x2a0525['query']['sort']);_0x46442a['where']=qs[_0x545d('0x36')](_[_0x545d('0x3e')](_0x2a0525[_0x545d('0x34')],_0x256b1b['filters']),_0x122713);if(_0x2a0525[_0x545d('0x34')]['filter']){_0x46442a[_0x545d('0x3f')]=_[_0x545d('0x40')](_0x46442a[_0x545d('0x3f')],{'$or':[{'key':{'$like':'%'+_0x2a0525[_0x545d('0x34')]['filter']+'%'}},{'value':{'$like':'%'+_0x2a0525[_0x545d('0x34')]['filter']+'%'}}]});}_0x46442a=_[_0x545d('0x40')]({},_0x46442a,_0x2a0525[_0x545d('0x41')]);var _0x16476f={'where':_0x46442a[_0x545d('0x3f')]};return db[_0x545d('0x2f')][_0x545d('0x1e')](_0x16476f)[_0x545d('0x2a')](function(_0x2fa4e2){_0x166ba5[_0x545d('0x1e')]=_0x2fa4e2;if(_0x2a0525[_0x545d('0x34')][_0x545d('0x42')]){_0x46442a[_0x545d('0x43')]=[{'all':!![]}];}return db[_0x545d('0x2f')]['findAll'](_0x46442a);})[_0x545d('0x2a')](function(_0x55f216){_0x166ba5[_0x545d('0x44')]=_0x55f216;return _0x166ba5;})[_0x545d('0x2a')](respondWithFilteredResult(_0x43aeab,_0x46442a))[_0x545d('0x45')](handleError(_0x43aeab,null));};exports['show']=function(_0x146eb4,_0xc7f4df){var _0x10f64b={'raw':!![],'where':{'id':_0x146eb4['params']['id']}},_0x490091={};_0x490091[_0x545d('0x33')]=_[_0x545d('0x35')](db[_0x545d('0x2f')]['rawAttributes']);_0x490091[_0x545d('0x34')]=_['keys'](_0x146eb4[_0x545d('0x34')]);_0x490091[_0x545d('0x36')]=_['intersection'](_0x490091[_0x545d('0x33')],_0x490091[_0x545d('0x34')]);_0x10f64b[_0x545d('0x38')]=_[_0x545d('0x37')](_0x490091[_0x545d('0x33')],qs[_0x545d('0x39')](_0x146eb4['query']['fields']));_0x10f64b[_0x545d('0x38')]=_0x10f64b[_0x545d('0x38')][_0x545d('0x3a')]?_0x10f64b['attributes']:_0x490091[_0x545d('0x33')];if(_0x146eb4[_0x545d('0x34')][_0x545d('0x42')]){_0x10f64b[_0x545d('0x43')]=[{'all':!![]}];}_0x10f64b=_[_0x545d('0x40')]({},_0x10f64b,_0x146eb4[_0x545d('0x41')]);return db[_0x545d('0x2f')]['find'](_0x10f64b)[_0x545d('0x2a')](handleEntityNotFound(_0xc7f4df,null))[_0x545d('0x2a')](respondWithResult(_0xc7f4df,null))['catch'](handleError(_0xc7f4df,null));};exports[_0x545d('0x25')]=function(_0x80b016,_0x130be0){if(_0x80b016[_0x545d('0x46')]['id']){delete _0x80b016[_0x545d('0x46')]['id'];}return db[_0x545d('0x2f')][_0x545d('0x47')]({'where':{'id':_0x80b016[_0x545d('0x48')]['id']}})[_0x545d('0x2a')](handleEntityNotFound(_0x130be0,null))[_0x545d('0x2a')](saveUpdates(_0x80b016['body'],null))[_0x545d('0x2a')](respondWithResult(_0x130be0,null))['catch'](handleError(_0x130be0,null));};exports['destroy']=function(_0x424a83,_0x548bab){return db[_0x545d('0x2f')][_0x545d('0x47')]({'where':{'id':_0x424a83[_0x545d('0x48')]['id']}})['then'](handleEntityNotFound(_0x548bab,null))[_0x545d('0x2a')](removeEntity(_0x548bab,null))[_0x545d('0x45')](handleError(_0x548bab,null));};exports['create']=function(_0x55d7a2,_0x580aaa){var _0x291d5f={'key':_0x55d7a2[_0x545d('0x46')][_0x545d('0x49')]};if(_0x55d7a2[_0x545d('0x46')][_0x545d('0x4a')]){_0x291d5f[_0x545d('0x4a')]=_0x55d7a2[_0x545d('0x46')][_0x545d('0x4a')];}else if(_0x55d7a2['body'][_0x545d('0x4b')]){_0x291d5f[_0x545d('0x4b')]=_0x55d7a2[_0x545d('0x46')]['SmsAccountId'];}else if(_0x55d7a2[_0x545d('0x46')]['OpenchannelAccountId']){_0x291d5f[_0x545d('0x4c')]=_0x55d7a2['body']['OpenchannelAccountId'];}else if(_0x55d7a2['body'][_0x545d('0x4d')]){_0x291d5f['ChatWebsiteId']=_0x55d7a2[_0x545d('0x46')][_0x545d('0x4d')];}return db[_0x545d('0x2f')][_0x545d('0x47')]({'where':_0x291d5f})['then'](function(_0x3d7d58){if(_0x3d7d58){throw new db[(_0x545d('0x4e'))][(_0x545d('0x4f'))](_0x545d('0x50'));}return db[_0x545d('0x2f')][_0x545d('0x51')](_0x55d7a2['body']);})[_0x545d('0x2a')](function(_0x593d56){var _0x1fedd4=_0x55d7a2['user'][_0x545d('0x27')]({'plain':!![]});if(!_0x1fedd4)throw new Error(_0x545d('0x52'));if(_0x1fedd4[_0x545d('0x53')]===_0x545d('0x54')){var _0x52778e=_0x593d56[_0x545d('0x27')]({'plain':!![]});return db['UserProfileSection'][_0x545d('0x47')]({'where':{'name':_0x545d('0x28'),'userProfileId':_0x1fedd4[_0x545d('0x55')]},'raw':!![]})[_0x545d('0x2a')](function(_0x210073){if(_0x210073&&_0x210073[_0x545d('0x56')]===0x0){return db[_0x545d('0x29')][_0x545d('0x51')]({'name':_0x52778e['name'],'resourceId':_0x52778e['id'],'type':_0x210073[_0x545d('0x2d')],'sectionId':_0x210073['id']},{})['then'](function(){return _0x593d56;});}else{return _0x593d56;}})['catch'](function(_0x135828){logger[_0x545d('0x2b')](_0x545d('0x57'),_0x135828);throw _0x135828;});}return _0x593d56;})[_0x545d('0x2a')](respondWithResult(_0x580aaa,0xc9))[_0x545d('0x45')](handleError(_0x580aaa,null));}; \ No newline at end of file +var _0xe143=['includeAll','find','body','catch','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','reject','save','update','destroy','then','get','CannedAnswers','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','merge','filter','options','CannedAnswer','include','show','params','length'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0xe143,0xbb));var _0x3e14=function(_0x2b1219,_0x46bdb2){_0x2b1219=_0x2b1219-0x0;var _0x3e5e6f=_0xe143[_0x2b1219];return _0x3e5e6f;};'use strict';var emlformat=require(_0x3e14('0x0'));var rimraf=require(_0x3e14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e14('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3e14('0x3'));var Mustache=require(_0x3e14('0x4'));var util=require(_0x3e14('0x5'));var path=require(_0x3e14('0x6'));var sox=require(_0x3e14('0x7'));var csv=require('to-csv');var ejs=require(_0x3e14('0x8'));var fs=require('fs');var fs_extra=require(_0x3e14('0x9'));var _=require(_0x3e14('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3e14('0xb'));var toCsv=require(_0x3e14('0xc'));var querystring=require(_0x3e14('0xd'));var Papa=require('papaparse');var Redis=require(_0x3e14('0xe'));var authService=require(_0x3e14('0xf'));var qs=require(_0x3e14('0x10'));var as=require(_0x3e14('0x11'));var hardwareService=require(_0x3e14('0x12'));var logger=require(_0x3e14('0x13'))(_0x3e14('0x14'));var utils=require('../../config/utils');var config=require(_0x3e14('0x15'));var licenseUtil=require(_0x3e14('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3be5a2,_0x29a223){_0x29a223=_0x29a223||0xcc;return function(_0x293a99){if(_0x293a99){return _0x3be5a2[_0x3e14('0x17')](_0x29a223);}return _0x3be5a2['status'](_0x29a223)[_0x3e14('0x18')]();};}function respondWithResult(_0x1e92bb,_0x1e9798){_0x1e9798=_0x1e9798||0xc8;return function(_0xa47b5a){if(_0xa47b5a){return _0x1e92bb[_0x3e14('0x19')](_0x1e9798)[_0x3e14('0x1a')](_0xa47b5a);}};}function respondWithFilteredResult(_0x4611dd,_0x482bc8){return function(_0x59d001){if(_0x59d001){var _0x4f7466=typeof _0x482bc8[_0x3e14('0x1b')]==='undefined'&&typeof _0x482bc8['limit']===_0x3e14('0x1c');var _0x163e07=_0x59d001[_0x3e14('0x1d')];var _0x13a8a1=_0x4f7466?0x0:_0x482bc8['offset'];var _0x12f627=_0x4f7466?_0x59d001[_0x3e14('0x1d')]:_0x482bc8[_0x3e14('0x1b')]+_0x482bc8[_0x3e14('0x1e')];var _0xb68fc;if(_0x12f627>=_0x163e07){_0x12f627=_0x163e07;_0xb68fc=0xc8;}else{_0xb68fc=0xce;}_0x4611dd[_0x3e14('0x19')](_0xb68fc);return _0x4611dd['set'](_0x3e14('0x1f'),_0x13a8a1+'-'+_0x12f627+'/'+_0x163e07)['json'](_0x59d001);}return null;};}function patchUpdates(_0x86e8e2){return function(_0x3f8a22){try{jsonpatch['apply'](_0x3f8a22,_0x86e8e2,!![]);}catch(_0x2c594e){return BPromise[_0x3e14('0x20')](_0x2c594e);}return _0x3f8a22[_0x3e14('0x21')]();};}function saveUpdates(_0x770a36,_0x3fb8e6){return function(_0x36cc8a){if(_0x36cc8a){return _0x36cc8a[_0x3e14('0x22')](_0x770a36)['then'](function(_0x462e38){return _0x462e38;});}return null;};}function removeEntity(_0x461073,_0x3fec1d){return function(_0x35e114){if(_0x35e114){return _0x35e114[_0x3e14('0x23')]()[_0x3e14('0x24')](function(){var _0x5f4114=_0x35e114[_0x3e14('0x25')]({'plain':!![]});var _0x2e6bcb=_0x3e14('0x26');return db[_0x3e14('0x27')]['destroy']({'where':{'type':_0x2e6bcb,'resourceId':_0x5f4114['id']}})[_0x3e14('0x24')](function(){return _0x35e114;});})[_0x3e14('0x24')](function(){_0x461073[_0x3e14('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x578887,_0x352d51){return function(_0x279b8d){if(!_0x279b8d){_0x578887[_0x3e14('0x17')](0x194);}return _0x279b8d;};}function handleError(_0x203746,_0x55436b){_0x55436b=_0x55436b||0x1f4;return function(_0x432825){logger[_0x3e14('0x28')](_0x432825[_0x3e14('0x29')]);if(_0x432825[_0x3e14('0x2a')]){delete _0x432825[_0x3e14('0x2a')];}_0x203746[_0x3e14('0x19')](_0x55436b)[_0x3e14('0x2b')](_0x432825);};}exports[_0x3e14('0x2c')]=function(_0x4e15fd,_0x5275d4){var _0x44d52e={},_0x1134a0={},_0x30757f={'count':0x0,'rows':[]};var _0x1094b0=_[_0x3e14('0x2d')](db['CannedAnswer'][_0x3e14('0x2e')],function(_0xa5fbfe){return{'name':_0xa5fbfe['fieldName'],'type':_0xa5fbfe[_0x3e14('0x2f')][_0x3e14('0x30')]};});_0x1134a0[_0x3e14('0x31')]=_['map'](_0x1094b0,_0x3e14('0x2a'));_0x1134a0[_0x3e14('0x32')]=_[_0x3e14('0x33')](_0x4e15fd[_0x3e14('0x32')]);_0x1134a0[_0x3e14('0x34')]=_[_0x3e14('0x35')](_0x1134a0[_0x3e14('0x31')],_0x1134a0['query']);_0x44d52e[_0x3e14('0x36')]=_[_0x3e14('0x35')](_0x1134a0[_0x3e14('0x31')],qs[_0x3e14('0x37')](_0x4e15fd['query']['fields']));_0x44d52e[_0x3e14('0x36')]=_0x44d52e[_0x3e14('0x36')]['length']?_0x44d52e['attributes']:_0x1134a0[_0x3e14('0x31')];if(!_0x4e15fd[_0x3e14('0x32')][_0x3e14('0x38')]('nolimit')){_0x44d52e[_0x3e14('0x1e')]=qs[_0x3e14('0x1e')](_0x4e15fd[_0x3e14('0x32')]['limit']);_0x44d52e['offset']=qs[_0x3e14('0x1b')](_0x4e15fd['query'][_0x3e14('0x1b')]);}_0x44d52e[_0x3e14('0x39')]=qs[_0x3e14('0x3a')](_0x4e15fd[_0x3e14('0x32')][_0x3e14('0x3a')]);_0x44d52e[_0x3e14('0x3b')]=qs[_0x3e14('0x34')](_['pick'](_0x4e15fd[_0x3e14('0x32')],_0x1134a0[_0x3e14('0x34')]),_0x1094b0);if(_0x4e15fd[_0x3e14('0x32')]['filter']){_0x44d52e[_0x3e14('0x3b')]=_[_0x3e14('0x3c')](_0x44d52e['where'],{'$or':[{'key':{'$like':'%'+_0x4e15fd[_0x3e14('0x32')][_0x3e14('0x3d')]+'%'}},{'value':{'$like':'%'+_0x4e15fd[_0x3e14('0x32')][_0x3e14('0x3d')]+'%'}}]});}_0x44d52e=_[_0x3e14('0x3c')]({},_0x44d52e,_0x4e15fd[_0x3e14('0x3e')]);var _0x4035ab={'where':_0x44d52e[_0x3e14('0x3b')]};return db[_0x3e14('0x3f')][_0x3e14('0x1d')](_0x4035ab)['then'](function(_0x1d3e96){_0x30757f[_0x3e14('0x1d')]=_0x1d3e96;if(_0x4e15fd['query']['includeAll']){_0x44d52e[_0x3e14('0x40')]=[{'all':!![]}];}return db[_0x3e14('0x3f')]['findAll'](_0x44d52e);})['then'](function(_0x4f2ead){_0x30757f['rows']=_0x4f2ead;return _0x30757f;})[_0x3e14('0x24')](respondWithFilteredResult(_0x5275d4,_0x44d52e))['catch'](handleError(_0x5275d4,null));};exports[_0x3e14('0x41')]=function(_0x80e575,_0x39f926){var _0x51b31e={'raw':!![],'where':{'id':_0x80e575[_0x3e14('0x42')]['id']}},_0xc941f2={};_0xc941f2[_0x3e14('0x31')]=_[_0x3e14('0x33')](db[_0x3e14('0x3f')][_0x3e14('0x2e')]);_0xc941f2[_0x3e14('0x32')]=_['keys'](_0x80e575[_0x3e14('0x32')]);_0xc941f2[_0x3e14('0x34')]=_[_0x3e14('0x35')](_0xc941f2[_0x3e14('0x31')],_0xc941f2[_0x3e14('0x32')]);_0x51b31e[_0x3e14('0x36')]=_[_0x3e14('0x35')](_0xc941f2['model'],qs[_0x3e14('0x37')](_0x80e575['query'][_0x3e14('0x37')]));_0x51b31e['attributes']=_0x51b31e[_0x3e14('0x36')][_0x3e14('0x43')]?_0x51b31e['attributes']:_0xc941f2[_0x3e14('0x31')];if(_0x80e575[_0x3e14('0x32')][_0x3e14('0x44')]){_0x51b31e[_0x3e14('0x40')]=[{'all':!![]}];}_0x51b31e=_['merge']({},_0x51b31e,_0x80e575['options']);return db['CannedAnswer'][_0x3e14('0x45')](_0x51b31e)[_0x3e14('0x24')](handleEntityNotFound(_0x39f926,null))[_0x3e14('0x24')](respondWithResult(_0x39f926,null))['catch'](handleError(_0x39f926,null));};exports[_0x3e14('0x22')]=function(_0x33262d,_0x138310){if(_0x33262d['body']['id']){delete _0x33262d[_0x3e14('0x46')]['id'];}return db[_0x3e14('0x3f')][_0x3e14('0x45')]({'where':{'id':_0x33262d[_0x3e14('0x42')]['id']}})[_0x3e14('0x24')](handleEntityNotFound(_0x138310,null))[_0x3e14('0x24')](saveUpdates(_0x33262d[_0x3e14('0x46')],null))['then'](respondWithResult(_0x138310,null))[_0x3e14('0x47')](handleError(_0x138310,null));};exports['destroy']=function(_0x264f4f,_0x50424d){return db[_0x3e14('0x3f')][_0x3e14('0x45')]({'where':{'id':_0x264f4f[_0x3e14('0x42')]['id']}})[_0x3e14('0x24')](handleEntityNotFound(_0x50424d,null))[_0x3e14('0x24')](removeEntity(_0x50424d,null))[_0x3e14('0x47')](handleError(_0x50424d,null));};exports[_0x3e14('0x48')]=function(_0x20741f,_0x503f1a){var _0x4a40e0={'key':_0x20741f['body'][_0x3e14('0x30')]};if(_0x20741f[_0x3e14('0x46')][_0x3e14('0x49')]){_0x4a40e0[_0x3e14('0x49')]=_0x20741f['body'][_0x3e14('0x49')];}else if(_0x20741f[_0x3e14('0x46')]['SmsAccountId']){_0x4a40e0[_0x3e14('0x4a')]=_0x20741f[_0x3e14('0x46')][_0x3e14('0x4a')];}else if(_0x20741f[_0x3e14('0x46')]['OpenchannelAccountId']){_0x4a40e0[_0x3e14('0x4b')]=_0x20741f['body'][_0x3e14('0x4b')];}else if(_0x20741f[_0x3e14('0x46')][_0x3e14('0x4c')]){_0x4a40e0[_0x3e14('0x4c')]=_0x20741f[_0x3e14('0x46')][_0x3e14('0x4c')];}return db[_0x3e14('0x3f')][_0x3e14('0x45')]({'where':_0x4a40e0})['then'](function(_0x458017){if(_0x458017){throw new db[(_0x3e14('0x4d'))][(_0x3e14('0x4e'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x3e14('0x3f')]['create'](_0x20741f['body']);})[_0x3e14('0x24')](function(_0x32567d){var _0x4b45a1=_0x20741f['user'][_0x3e14('0x25')]({'plain':!![]});if(!_0x4b45a1)throw new Error(_0x3e14('0x4f'));if(_0x4b45a1['role']===_0x3e14('0x50')){var _0x818b01=_0x32567d[_0x3e14('0x25')]({'plain':!![]});return db[_0x3e14('0x51')][_0x3e14('0x45')]({'where':{'name':_0x3e14('0x26'),'userProfileId':_0x4b45a1[_0x3e14('0x52')]},'raw':!![]})['then'](function(_0x44383d){if(_0x44383d&&_0x44383d[_0x3e14('0x53')]===0x0){return db[_0x3e14('0x27')]['create']({'name':_0x818b01[_0x3e14('0x2a')],'resourceId':_0x818b01['id'],'type':_0x44383d[_0x3e14('0x2a')],'sectionId':_0x44383d['id']},{})[_0x3e14('0x24')](function(){return _0x32567d;});}else{return _0x32567d;}})['catch'](function(_0x42f384){logger['error'](_0x3e14('0x54'),_0x42f384);throw _0x42f384;});}return _0x32567d;})[_0x3e14('0x24')](respondWithResult(_0x503f1a,0xc9))[_0x3e14('0x47')](handleError(_0x503f1a,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index ce6d5ca..867c491 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 _0xcf76=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x481724,_0x598eb6){var _0x5ef8d6=function(_0x2ff593){while(--_0x2ff593){_0x481724['push'](_0x481724['shift']());}};_0x5ef8d6(++_0x598eb6);}(_0xcf76,0x10d));var _0x6cf7=function(_0x3dd345,_0x273fbb){_0x3dd345=_0x3dd345-0x0;var _0x15e015=_0xcf76[_0x3dd345];return _0x15e015;};'use strict';var _=require(_0x6cf7('0x0'));var util=require('util');var logger=require(_0x6cf7('0x1'))(_0x6cf7('0x2'));var moment=require(_0x6cf7('0x3'));var BPromise=require(_0x6cf7('0x4'));var rp=require(_0x6cf7('0x5'));var fs=require('fs');var path=require(_0x6cf7('0x6'));var rimraf=require(_0x6cf7('0x7'));var config=require(_0x6cf7('0x8'));var attributes=require(_0x6cf7('0x9'));module[_0x6cf7('0xa')]=function(_0x58b692,_0x1ffe30){return _0x58b692[_0x6cf7('0xb')](_0x6cf7('0xc'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6cf7('0xd'),'collate':_0x6cf7('0xe')});}; \ No newline at end of file +var _0x884b=['utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x884b,0xf2));var _0xb884=function(_0x1a87b3,_0x45ba68){_0x1a87b3=_0x1a87b3-0x0;var _0x37e84d=_0x884b[_0x1a87b3];return _0x37e84d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb884('0x0'))(_0xb884('0x1'));var moment=require(_0xb884('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb884('0x3'));module[_0xb884('0x4')]=function(_0x2e21ef,_0x68f4a6){return _0x2e21ef[_0xb884('0x5')](_0xb884('0x6'),attributes,{'tableName':_0xb884('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb884('0x8'),'collate':_0xb884('0x9')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 5f7bfa4..20f71d3 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(_0x3fd55c,_0x4de0f6){var _0x1fd315=function(_0x487c11){while(--_0x487c11){_0x3fd55c['push'](_0x3fd55c['shift']());}};_0x1fd315(++_0x4de0f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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(_0x3bb629,_0x3e65be){var _0x5e871d=function(_0x561908){while(--_0x561908){_0x3bb629['push'](_0x3bb629['shift']());}};_0x5e871d(++_0x3e65be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 da1a6bb..32b7ea0 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 _0x29dd=['../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','get','show','post','create','put','/:id','update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service'];(function(_0x4629ee,_0x5802d8){var _0x47fb5b=function(_0xf899cd){while(--_0xf899cd){_0x4629ee['push'](_0x4629ee['shift']());}};_0x47fb5b(++_0x5802d8);}(_0x29dd,0x7f));var _0xd29d=function(_0x3f6849,_0x43437d){_0x3f6849=_0x3f6849-0x0;var _0x24b0ec=_0x29dd[_0x3f6849];return _0x24b0ec;};'use strict';var multer=require(_0xd29d('0x0'));var util=require(_0xd29d('0x1'));var path=require(_0xd29d('0x2'));var timeout=require('connect-timeout');var express=require(_0xd29d('0x3'));var router=express['Router']();var fs_extra=require(_0xd29d('0x4'));var auth=require(_0xd29d('0x5'));var interaction=require(_0xd29d('0x6'));var config=require(_0xd29d('0x7'));var controller=require(_0xd29d('0x8'));router['get']('/',auth[_0xd29d('0x9')](),controller['index']);router[_0xd29d('0xa')]('/:id',auth[_0xd29d('0x9')](),controller[_0xd29d('0xb')]);router[_0xd29d('0xc')]('/',auth[_0xd29d('0x9')](),controller[_0xd29d('0xd')]);router[_0xd29d('0xe')](_0xd29d('0xf'),auth[_0xd29d('0x9')](),controller[_0xd29d('0x10')]);router[_0xd29d('0x11')]('/:id',auth[_0xd29d('0x9')](),controller[_0xd29d('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5db5=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','index','/:id','isAuthenticated','show','post','update','delete'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x5db5,0x8e));var _0x55db=function(_0x2b962a,_0x17e169){_0x2b962a=_0x2b962a-0x0;var _0x3a08ef=_0x5db5[_0x2b962a];return _0x3a08ef;};'use strict';var multer=require(_0x55db('0x0'));var util=require(_0x55db('0x1'));var path=require(_0x55db('0x2'));var timeout=require(_0x55db('0x3'));var express=require(_0x55db('0x4'));var router=express[_0x55db('0x5')]();var fs_extra=require(_0x55db('0x6'));var auth=require(_0x55db('0x7'));var interaction=require(_0x55db('0x8'));var config=require('../../config/environment');var controller=require(_0x55db('0x9'));router[_0x55db('0xa')]('/',auth['isAuthenticated'](),controller[_0x55db('0xb')]);router[_0x55db('0xa')](_0x55db('0xc'),auth[_0x55db('0xd')](),controller[_0x55db('0xe')]);router[_0x55db('0xf')]('/',auth[_0x55db('0xd')](),controller['create']);router['put'](_0x55db('0xc'),auth[_0x55db('0xd')](),controller[_0x55db('0x10')]);router[_0x55db('0x11')](_0x55db('0xc'),auth['isAuthenticated'](),controller[_0x55db('0x12')]);module[_0x55db('0x13')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 8664d70..f522ea0 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 _0xb5f8=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x4d4fc3,_0x4fc2ac){var _0x3330a8=function(_0x392ce4){while(--_0x392ce4){_0x4d4fc3['push'](_0x4d4fc3['shift']());}};_0x3330a8(++_0x4fc2ac);}(_0xb5f8,0x88));var _0x8b5f=function(_0xcc4c73,_0x400e8c){_0xcc4c73=_0xcc4c73-0x0;var _0x24f7df=_0xb5f8[_0xcc4c73];return _0x24f7df;};'use strict';var Sequelize=require(_0x8b5f('0x0'));module[_0x8b5f('0x1')]={'calldate':{'type':Sequelize[_0x8b5f('0x2')],'allowNull':![],'defaultValue':_0x8b5f('0x3')},'clid':{'type':Sequelize[_0x8b5f('0x4')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x8b5f('0x4')]},'dcontext':{'type':Sequelize[_0x8b5f('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x8b5f('0x4')]},'lastapp':{'type':Sequelize[_0x8b5f('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x8b5f('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x8b5f('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x8b5f('0x4')]},'userfield':{'type':Sequelize[_0x8b5f('0x4')]},'uniqueid':{'type':Sequelize[_0x8b5f('0x4')]},'linkedid':{'type':Sequelize[_0x8b5f('0x4')]},'sequence':{'type':Sequelize[_0x8b5f('0x4')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8b5f('0x4')]},'tag':{'type':Sequelize[_0x8b5f('0x4')]}}; \ No newline at end of file +var _0xbdeb=['1970-01-01\x2000:00:01','STRING','INTEGER','exports'];(function(_0x51d7a9,_0x45c44c){var _0x3fe051=function(_0x250c82){while(--_0x250c82){_0x51d7a9['push'](_0x51d7a9['shift']());}};_0x3fe051(++_0x45c44c);}(_0xbdeb,0x6f));var _0xbbde=function(_0x221b3e,_0x1fbf5d){_0x221b3e=_0x221b3e-0x0;var _0x24c811=_0xbdeb[_0x221b3e];return _0x24c811;};'use strict';var Sequelize=require('sequelize');module[_0xbbde('0x0')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xbbde('0x1')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xbbde('0x2')]},'dst':{'type':Sequelize[_0xbbde('0x2')]},'dcontext':{'type':Sequelize[_0xbbde('0x2')]},'channel':{'type':Sequelize[_0xbbde('0x2')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xbbde('0x2')]},'duration':{'type':Sequelize[_0xbbde('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xbbde('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xbbde('0x2')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xbbde('0x2')]},'uniqueid':{'type':Sequelize[_0xbbde('0x2')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xbbde('0x2')]},'peeraccount':{'type':Sequelize[_0xbbde('0x2')]},'type':{'type':Sequelize[_0xbbde('0x2')]},'tag':{'type':Sequelize[_0xbbde('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 9fdf9d2..bafaa3e 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 _0xa990=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','json','save','update','then','error','stack','name','send','map','Cdr','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','findAll','catch','show','params','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware'];(function(_0x294b7a,_0x51b167){var _0x30d2a3=function(_0x13a696){while(--_0x13a696){_0x294b7a['push'](_0x294b7a['shift']());}};_0x30d2a3(++_0x51b167);}(_0xa990,0xc9));var _0x0a99=function(_0xf5af70,_0x18fe1f){_0xf5af70=_0xf5af70-0x0;var _0x8fd0aa=_0xa990[_0xf5af70];return _0x8fd0aa;};'use strict';var emlformat=require(_0x0a99('0x0'));var rimraf=require(_0x0a99('0x1'));var zipdir=require(_0x0a99('0x2'));var jsonpatch=require(_0x0a99('0x3'));var rp=require(_0x0a99('0x4'));var moment=require(_0x0a99('0x5'));var BPromise=require(_0x0a99('0x6'));var Mustache=require(_0x0a99('0x7'));var util=require('util');var path=require('path');var sox=require(_0x0a99('0x8'));var csv=require(_0x0a99('0x9'));var ejs=require(_0x0a99('0xa'));var fs=require('fs');var fs_extra=require(_0x0a99('0xb'));var _=require(_0x0a99('0xc'));var squel=require(_0x0a99('0xd'));var crypto=require(_0x0a99('0xe'));var jsforce=require(_0x0a99('0xf'));var deskjs=require(_0x0a99('0x10'));var toCsv=require(_0x0a99('0x9'));var querystring=require(_0x0a99('0x11'));var Papa=require('papaparse');var Redis=require(_0x0a99('0x12'));var authService=require(_0x0a99('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0a99('0x14'));var logger=require(_0x0a99('0x15'))(_0x0a99('0x16'));var utils=require(_0x0a99('0x17'));var config=require(_0x0a99('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a99('0x19'))['db'];function respondWithStatusCode(_0x3aaaad,_0x57ab88){_0x57ab88=_0x57ab88||0xcc;return function(_0xb6a34d){if(_0xb6a34d){return _0x3aaaad[_0x0a99('0x1a')](_0x57ab88);}return _0x3aaaad[_0x0a99('0x1b')](_0x57ab88)[_0x0a99('0x1c')]();};}function respondWithResult(_0x346061,_0x23d018){_0x23d018=_0x23d018||0xc8;return function(_0x18c124){if(_0x18c124){return _0x346061[_0x0a99('0x1b')](_0x23d018)['json'](_0x18c124);}};}function respondWithFilteredResult(_0x5a17e1,_0x2c40db){return function(_0x3ac17e){if(_0x3ac17e){var _0xb7356c=typeof _0x2c40db['offset']===_0x0a99('0x1d')&&typeof _0x2c40db['limit']==='undefined';var _0x20104c=_0x3ac17e[_0x0a99('0x1e')];var _0x3de006=_0xb7356c?0x0:_0x2c40db[_0x0a99('0x1f')];var _0x572ce5=_0xb7356c?_0x3ac17e['count']:_0x2c40db[_0x0a99('0x1f')]+_0x2c40db[_0x0a99('0x20')];var _0xbe23f3;if(_0x572ce5>=_0x20104c){_0x572ce5=_0x20104c;_0xbe23f3=0xc8;}else{_0xbe23f3=0xce;}_0x5a17e1[_0x0a99('0x1b')](_0xbe23f3);return _0x5a17e1['set']('Content-Range',_0x3de006+'-'+_0x572ce5+'/'+_0x20104c)[_0x0a99('0x21')](_0x3ac17e);}return null;};}function patchUpdates(_0x4d0c78){return function(_0x1e8d30){try{jsonpatch['apply'](_0x1e8d30,_0x4d0c78,!![]);}catch(_0x191ee4){return BPromise['reject'](_0x191ee4);}return _0x1e8d30[_0x0a99('0x22')]();};}function saveUpdates(_0x356681,_0x3b1d60){return function(_0x1c1e5c){if(_0x1c1e5c){return _0x1c1e5c[_0x0a99('0x23')](_0x356681)[_0x0a99('0x24')](function(_0x19c870){return _0x19c870;});}return null;};}function removeEntity(_0x1d803c,_0x398dd2){return function(_0x5745ca){if(_0x5745ca){return _0x5745ca['destroy']()[_0x0a99('0x24')](function(){_0x1d803c[_0x0a99('0x1b')](0xcc)[_0x0a99('0x1c')]();});}};}function handleEntityNotFound(_0x518617,_0x5d917c){return function(_0x371b31){if(!_0x371b31){_0x518617[_0x0a99('0x1a')](0x194);}return _0x371b31;};}function handleError(_0x1b0e94,_0x40e765){_0x40e765=_0x40e765||0x1f4;return function(_0x10e70f){logger[_0x0a99('0x25')](_0x10e70f[_0x0a99('0x26')]);if(_0x10e70f[_0x0a99('0x27')]){delete _0x10e70f[_0x0a99('0x27')];}_0x1b0e94['status'](_0x40e765)[_0x0a99('0x28')](_0x10e70f);};}exports['index']=function(_0x47bc34,_0x4e597b){var _0x223bdb={},_0x379c7e={},_0x13d26a={'count':0x0,'rows':[]};var _0x26c0c0=_[_0x0a99('0x29')](db[_0x0a99('0x2a')][_0x0a99('0x2b')],function(_0x47da33){return{'name':_0x47da33[_0x0a99('0x2c')],'type':_0x47da33[_0x0a99('0x2d')][_0x0a99('0x2e')]};});_0x379c7e[_0x0a99('0x2f')]=_['map'](_0x26c0c0,'name');_0x379c7e['query']=_[_0x0a99('0x30')](_0x47bc34[_0x0a99('0x31')]);_0x379c7e[_0x0a99('0x32')]=_['intersection'](_0x379c7e[_0x0a99('0x2f')],_0x379c7e[_0x0a99('0x31')]);_0x223bdb[_0x0a99('0x33')]=_[_0x0a99('0x34')](_0x379c7e[_0x0a99('0x2f')],qs[_0x0a99('0x35')](_0x47bc34[_0x0a99('0x31')]['fields']));_0x223bdb[_0x0a99('0x33')]=_0x223bdb[_0x0a99('0x33')][_0x0a99('0x36')]?_0x223bdb[_0x0a99('0x33')]:_0x379c7e[_0x0a99('0x2f')];if(!_0x47bc34['query'][_0x0a99('0x37')]('nolimit')){_0x223bdb['limit']=qs['limit'](_0x47bc34['query'][_0x0a99('0x20')]);_0x223bdb['offset']=qs[_0x0a99('0x1f')](_0x47bc34[_0x0a99('0x31')][_0x0a99('0x1f')]);}_0x223bdb[_0x0a99('0x38')]=qs[_0x0a99('0x39')](_0x47bc34[_0x0a99('0x31')][_0x0a99('0x39')]);_0x223bdb[_0x0a99('0x3a')]=qs[_0x0a99('0x32')](_[_0x0a99('0x3b')](_0x47bc34[_0x0a99('0x31')],_0x379c7e[_0x0a99('0x32')]),_0x26c0c0);if(_0x47bc34[_0x0a99('0x31')]['filter']){_0x223bdb[_0x0a99('0x3a')]=_[_0x0a99('0x3c')](_0x223bdb['where'],{'$or':_[_0x0a99('0x29')](_0x26c0c0,function(_0x549bb9){if(_0x549bb9[_0x0a99('0x2d')]!=='VIRTUAL'){var _0x541178={};_0x541178[_0x549bb9[_0x0a99('0x27')]]={'$like':'%'+_0x47bc34[_0x0a99('0x31')][_0x0a99('0x3d')]+'%'};return _0x541178;}})});}_0x223bdb=_['merge']({},_0x223bdb,_0x47bc34[_0x0a99('0x3e')]);var _0x11e046={'where':_0x223bdb[_0x0a99('0x3a')]};return db['Cdr'][_0x0a99('0x1e')](_0x11e046)[_0x0a99('0x24')](function(_0x23e4b9){_0x13d26a[_0x0a99('0x1e')]=_0x23e4b9;if(_0x47bc34['query'][_0x0a99('0x3f')]){_0x223bdb['include']=[{'all':!![]}];}return db['Cdr'][_0x0a99('0x40')](_0x223bdb);})['then'](function(_0x185495){_0x13d26a['rows']=_0x185495;return _0x13d26a;})[_0x0a99('0x24')](respondWithFilteredResult(_0x4e597b,_0x223bdb))[_0x0a99('0x41')](handleError(_0x4e597b,null));};exports[_0x0a99('0x42')]=function(_0x29da8a,_0x57b999){var _0xcee64a={'raw':!![],'where':{'id':_0x29da8a[_0x0a99('0x43')]['id']}},_0x97158c={};_0x97158c[_0x0a99('0x2f')]=_['keys'](db['Cdr']['rawAttributes']);_0x97158c[_0x0a99('0x31')]=_['keys'](_0x29da8a[_0x0a99('0x31')]);_0x97158c['filters']=_['intersection'](_0x97158c['model'],_0x97158c['query']);_0xcee64a[_0x0a99('0x33')]=_['intersection'](_0x97158c[_0x0a99('0x2f')],qs[_0x0a99('0x35')](_0x29da8a['query'][_0x0a99('0x35')]));_0xcee64a[_0x0a99('0x33')]=_0xcee64a['attributes'][_0x0a99('0x36')]?_0xcee64a['attributes']:_0x97158c[_0x0a99('0x2f')];if(_0x29da8a[_0x0a99('0x31')]['includeAll']){_0xcee64a[_0x0a99('0x44')]=[{'all':!![]}];}_0xcee64a=_['merge']({},_0xcee64a,_0x29da8a['options']);return db[_0x0a99('0x2a')][_0x0a99('0x45')](_0xcee64a)[_0x0a99('0x24')](handleEntityNotFound(_0x57b999,null))[_0x0a99('0x24')](respondWithResult(_0x57b999,null))[_0x0a99('0x41')](handleError(_0x57b999,null));};exports['create']=function(_0x476207,_0x174298){return db[_0x0a99('0x2a')][_0x0a99('0x46')](_0x476207[_0x0a99('0x47')],{})[_0x0a99('0x24')](respondWithResult(_0x174298,0xc9))[_0x0a99('0x41')](handleError(_0x174298,null));};exports[_0x0a99('0x23')]=function(_0x1cd328,_0x1621d9){if(_0x1cd328['body']['id']){delete _0x1cd328['body']['id'];}return db[_0x0a99('0x2a')][_0x0a99('0x45')]({'where':{'id':_0x1cd328[_0x0a99('0x43')]['id']}})[_0x0a99('0x24')](handleEntityNotFound(_0x1621d9,null))[_0x0a99('0x24')](saveUpdates(_0x1cd328[_0x0a99('0x47')],null))['then'](respondWithResult(_0x1621d9,null))[_0x0a99('0x41')](handleError(_0x1621d9,null));};exports[_0x0a99('0x48')]=function(_0x55fee0,_0x11ed07){return db[_0x0a99('0x2a')]['find']({'where':{'id':_0x55fee0[_0x0a99('0x43')]['id']}})[_0x0a99('0x24')](handleEntityNotFound(_0x11ed07,null))[_0x0a99('0x24')](removeEntity(_0x11ed07,null))[_0x0a99('0x41')](handleError(_0x11ed07,null));};exports[_0x0a99('0x49')]=function(_0x2411ea,_0xbdfb18){return db['Cdr'][_0x0a99('0x49')]()[_0x0a99('0x24')](respondWithResult(_0xbdfb18,null))[_0x0a99('0x41')](handleError(_0xbdfb18,null));}; \ No newline at end of file +var _0xf767=['apply','save','then','error','stack','name','map','Cdr','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','offset','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','merge','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','undefined','count','limit','status','set','json'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf767,0x76));var _0x7f76=function(_0x5caf7e,_0x52e1bc){_0x5caf7e=_0x5caf7e-0x0;var _0x5c3435=_0xf767[_0x5caf7e];return _0x5c3435;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7f76('0x0'));var zipdir=require(_0x7f76('0x1'));var jsonpatch=require(_0x7f76('0x2'));var rp=require(_0x7f76('0x3'));var moment=require(_0x7f76('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7f76('0x5'));var util=require(_0x7f76('0x6'));var path=require(_0x7f76('0x7'));var sox=require(_0x7f76('0x8'));var csv=require('to-csv');var ejs=require(_0x7f76('0x9'));var fs=require('fs');var fs_extra=require(_0x7f76('0xa'));var _=require(_0x7f76('0xb'));var squel=require(_0x7f76('0xc'));var crypto=require(_0x7f76('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7f76('0xe'));var toCsv=require(_0x7f76('0xf'));var querystring=require(_0x7f76('0x10'));var Papa=require(_0x7f76('0x11'));var Redis=require('ioredis');var authService=require(_0x7f76('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7f76('0x13'));var hardwareService=require(_0x7f76('0x14'));var logger=require(_0x7f76('0x15'))(_0x7f76('0x16'));var utils=require(_0x7f76('0x17'));var config=require(_0x7f76('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7f76('0x19'))['db'];function respondWithStatusCode(_0x2cd1b3,_0x47403b){_0x47403b=_0x47403b||0xcc;return function(_0x32392b){if(_0x32392b){return _0x2cd1b3[_0x7f76('0x1a')](_0x47403b);}return _0x2cd1b3['status'](_0x47403b)[_0x7f76('0x1b')]();};}function respondWithResult(_0x4d8de0,_0x42a9d3){_0x42a9d3=_0x42a9d3||0xc8;return function(_0x256f79){if(_0x256f79){return _0x4d8de0['status'](_0x42a9d3)['json'](_0x256f79);}};}function respondWithFilteredResult(_0x58d2f3,_0xe81aa9){return function(_0x2df2db){if(_0x2df2db){var _0x286e96=typeof _0xe81aa9['offset']===_0x7f76('0x1c')&&typeof _0xe81aa9['limit']===_0x7f76('0x1c');var _0x3ceb6a=_0x2df2db[_0x7f76('0x1d')];var _0x4802ff=_0x286e96?0x0:_0xe81aa9['offset'];var _0x494537=_0x286e96?_0x2df2db['count']:_0xe81aa9['offset']+_0xe81aa9[_0x7f76('0x1e')];var _0xdb1407;if(_0x494537>=_0x3ceb6a){_0x494537=_0x3ceb6a;_0xdb1407=0xc8;}else{_0xdb1407=0xce;}_0x58d2f3[_0x7f76('0x1f')](_0xdb1407);return _0x58d2f3[_0x7f76('0x20')]('Content-Range',_0x4802ff+'-'+_0x494537+'/'+_0x3ceb6a)[_0x7f76('0x21')](_0x2df2db);}return null;};}function patchUpdates(_0x557c0f){return function(_0x38c4d6){try{jsonpatch[_0x7f76('0x22')](_0x38c4d6,_0x557c0f,!![]);}catch(_0x5a28b0){return BPromise['reject'](_0x5a28b0);}return _0x38c4d6[_0x7f76('0x23')]();};}function saveUpdates(_0xb647d8,_0x5efed5){return function(_0x3f2536){if(_0x3f2536){return _0x3f2536['update'](_0xb647d8)[_0x7f76('0x24')](function(_0x333056){return _0x333056;});}return null;};}function removeEntity(_0x31993d,_0x3deb00){return function(_0x3eea75){if(_0x3eea75){return _0x3eea75['destroy']()[_0x7f76('0x24')](function(){_0x31993d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x197519,_0x45f1c9){return function(_0x3492f4){if(!_0x3492f4){_0x197519['sendStatus'](0x194);}return _0x3492f4;};}function handleError(_0xbe6ac1,_0x1347bf){_0x1347bf=_0x1347bf||0x1f4;return function(_0x3e624d){logger[_0x7f76('0x25')](_0x3e624d[_0x7f76('0x26')]);if(_0x3e624d['name']){delete _0x3e624d[_0x7f76('0x27')];}_0xbe6ac1[_0x7f76('0x1f')](_0x1347bf)['send'](_0x3e624d);};}exports['index']=function(_0xe459de,_0x58829a){var _0x1dd664={},_0x3542e3={},_0xd5ba7={'count':0x0,'rows':[]};var _0x393bdd=_[_0x7f76('0x28')](db[_0x7f76('0x29')]['rawAttributes'],function(_0x3570ec){return{'name':_0x3570ec[_0x7f76('0x2a')],'type':_0x3570ec[_0x7f76('0x2b')][_0x7f76('0x2c')]};});_0x3542e3['model']=_[_0x7f76('0x28')](_0x393bdd,_0x7f76('0x27'));_0x3542e3[_0x7f76('0x2d')]=_['keys'](_0xe459de[_0x7f76('0x2d')]);_0x3542e3[_0x7f76('0x2e')]=_[_0x7f76('0x2f')](_0x3542e3[_0x7f76('0x30')],_0x3542e3[_0x7f76('0x2d')]);_0x1dd664[_0x7f76('0x31')]=_[_0x7f76('0x2f')](_0x3542e3[_0x7f76('0x30')],qs[_0x7f76('0x32')](_0xe459de[_0x7f76('0x2d')][_0x7f76('0x32')]));_0x1dd664[_0x7f76('0x31')]=_0x1dd664[_0x7f76('0x31')]['length']?_0x1dd664[_0x7f76('0x31')]:_0x3542e3[_0x7f76('0x30')];if(!_0xe459de[_0x7f76('0x2d')][_0x7f76('0x33')](_0x7f76('0x34'))){_0x1dd664[_0x7f76('0x1e')]=qs[_0x7f76('0x1e')](_0xe459de[_0x7f76('0x2d')]['limit']);_0x1dd664[_0x7f76('0x35')]=qs['offset'](_0xe459de['query'][_0x7f76('0x35')]);}_0x1dd664['order']=qs[_0x7f76('0x36')](_0xe459de[_0x7f76('0x2d')]['sort']);_0x1dd664[_0x7f76('0x37')]=qs['filters'](_['pick'](_0xe459de[_0x7f76('0x2d')],_0x3542e3[_0x7f76('0x2e')]),_0x393bdd);if(_0xe459de[_0x7f76('0x2d')][_0x7f76('0x38')]){_0x1dd664[_0x7f76('0x37')]=_['merge'](_0x1dd664[_0x7f76('0x37')],{'$or':_[_0x7f76('0x28')](_0x393bdd,function(_0x4edf74){if(_0x4edf74['type']!==_0x7f76('0x39')){var _0x4ea167={};_0x4ea167[_0x4edf74[_0x7f76('0x27')]]={'$like':'%'+_0xe459de[_0x7f76('0x2d')][_0x7f76('0x38')]+'%'};return _0x4ea167;}})});}_0x1dd664=_['merge']({},_0x1dd664,_0xe459de[_0x7f76('0x3a')]);var _0x26b537={'where':_0x1dd664[_0x7f76('0x37')]};return db[_0x7f76('0x29')][_0x7f76('0x1d')](_0x26b537)[_0x7f76('0x24')](function(_0x58649f){_0xd5ba7['count']=_0x58649f;if(_0xe459de[_0x7f76('0x2d')][_0x7f76('0x3b')]){_0x1dd664[_0x7f76('0x3c')]=[{'all':!![]}];}return db[_0x7f76('0x29')][_0x7f76('0x3d')](_0x1dd664);})[_0x7f76('0x24')](function(_0x401284){_0xd5ba7[_0x7f76('0x3e')]=_0x401284;return _0xd5ba7;})[_0x7f76('0x24')](respondWithFilteredResult(_0x58829a,_0x1dd664))[_0x7f76('0x3f')](handleError(_0x58829a,null));};exports[_0x7f76('0x40')]=function(_0x313d37,_0x3229b9){var _0x391d04={'raw':!![],'where':{'id':_0x313d37[_0x7f76('0x41')]['id']}},_0x2a43f1={};_0x2a43f1[_0x7f76('0x30')]=_[_0x7f76('0x42')](db['Cdr'][_0x7f76('0x43')]);_0x2a43f1[_0x7f76('0x2d')]=_[_0x7f76('0x42')](_0x313d37['query']);_0x2a43f1['filters']=_[_0x7f76('0x2f')](_0x2a43f1['model'],_0x2a43f1[_0x7f76('0x2d')]);_0x391d04['attributes']=_['intersection'](_0x2a43f1[_0x7f76('0x30')],qs[_0x7f76('0x32')](_0x313d37[_0x7f76('0x2d')][_0x7f76('0x32')]));_0x391d04[_0x7f76('0x31')]=_0x391d04[_0x7f76('0x31')][_0x7f76('0x44')]?_0x391d04[_0x7f76('0x31')]:_0x2a43f1[_0x7f76('0x30')];if(_0x313d37[_0x7f76('0x2d')][_0x7f76('0x3b')]){_0x391d04[_0x7f76('0x3c')]=[{'all':!![]}];}_0x391d04=_[_0x7f76('0x45')]({},_0x391d04,_0x313d37[_0x7f76('0x3a')]);return db['Cdr'][_0x7f76('0x46')](_0x391d04)['then'](handleEntityNotFound(_0x3229b9,null))[_0x7f76('0x24')](respondWithResult(_0x3229b9,null))[_0x7f76('0x3f')](handleError(_0x3229b9,null));};exports[_0x7f76('0x47')]=function(_0x39bbef,_0x487b1f){return db[_0x7f76('0x29')][_0x7f76('0x47')](_0x39bbef[_0x7f76('0x48')],{})[_0x7f76('0x24')](respondWithResult(_0x487b1f,0xc9))['catch'](handleError(_0x487b1f,null));};exports[_0x7f76('0x49')]=function(_0xd87fe7,_0x53f77a){if(_0xd87fe7[_0x7f76('0x48')]['id']){delete _0xd87fe7[_0x7f76('0x48')]['id'];}return db[_0x7f76('0x29')]['find']({'where':{'id':_0xd87fe7[_0x7f76('0x41')]['id']}})[_0x7f76('0x24')](handleEntityNotFound(_0x53f77a,null))[_0x7f76('0x24')](saveUpdates(_0xd87fe7[_0x7f76('0x48')],null))[_0x7f76('0x24')](respondWithResult(_0x53f77a,null))[_0x7f76('0x3f')](handleError(_0x53f77a,null));};exports[_0x7f76('0x4a')]=function(_0x42abd9,_0x1a4d3c){return db[_0x7f76('0x29')][_0x7f76('0x46')]({'where':{'id':_0x42abd9[_0x7f76('0x41')]['id']}})['then'](handleEntityNotFound(_0x1a4d3c,null))[_0x7f76('0x24')](removeEntity(_0x1a4d3c,null))['catch'](handleError(_0x1a4d3c,null));};exports[_0x7f76('0x4b')]=function(_0x3bcd59,_0x171c71){return db['Cdr'][_0x7f76('0x4b')]()[_0x7f76('0x24')](respondWithResult(_0x171c71,null))['catch'](handleError(_0x171c71,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 29a108e..82b2767 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(_0x190559,_0x126322){var _0x3802b6=function(_0x3387f4){while(--_0x3387f4){_0x190559['push'](_0x190559['shift']());}};_0x3802b6(++_0x126322);}(_0x7a54,0x106));var _0x47a5=function(_0x2effb7,_0x1fba38){_0x2effb7=_0x2effb7-0x0;var _0x120c03=_0x7a54[_0x2effb7];return _0x120c03;};'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(_0x2ab890,_0x34bd7b){var _0x495aa8=function(_0x1fbf62){while(--_0x1fbf62){_0x2ab890['push'](_0x2ab890['shift']());}};_0x495aa8(++_0x34bd7b);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 c493f8e..3ec6a0d 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 _0xddfa=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x329b34,_0x3c18d8){var _0x4aabcb=function(_0x11ef33){while(--_0x11ef33){_0x329b34['push'](_0x329b34['shift']());}};_0x4aabcb(++_0x3c18d8);}(_0xddfa,0x14b));var _0xaddf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xddfa[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xaddf('0x0'));var util=require(_0xaddf('0x1'));var moment=require(_0xaddf('0x2'));var BPromise=require(_0xaddf('0x3'));var rs=require(_0xaddf('0x4'));var fs=require('fs');var Redis=require(_0xaddf('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaddf('0x6'))('rpc');var config=require(_0xaddf('0x7'));var jayson=require(_0xaddf('0x8'));var client=jayson[_0xaddf('0x9')][_0xaddf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f0574,_0x5cf5e7,_0xb66282){return new BPromise(function(_0xf565ba,_0x12b4b3){return client['request'](_0x4f0574,_0xb66282)[_0xaddf('0xb')](function(_0x56554d){logger[_0xaddf('0xc')](_0xaddf('0xd'),_0x5cf5e7,_0xaddf('0xe'));logger[_0xaddf('0xf')]('Cdr,\x20%s,\x20%s,\x20%s',_0x5cf5e7,_0xaddf('0xe'),JSON[_0xaddf('0x10')](_0x56554d));if(_0x56554d[_0xaddf('0x11')]){if(_0x56554d[_0xaddf('0x11')][_0xaddf('0x12')]===0x1f4){logger[_0xaddf('0x11')]('Cdr,\x20%s,\x20%s',_0x5cf5e7,_0x56554d[_0xaddf('0x11')][_0xaddf('0x13')]);return _0x12b4b3(_0x56554d[_0xaddf('0x11')][_0xaddf('0x13')]);}logger[_0xaddf('0x11')]('Cdr,\x20%s,\x20%s',_0x5cf5e7,_0x56554d[_0xaddf('0x11')][_0xaddf('0x13')]);return _0xf565ba(_0x56554d[_0xaddf('0x11')][_0xaddf('0x13')]);}else{logger[_0xaddf('0xc')](_0xaddf('0xd'),_0x5cf5e7,_0xaddf('0xe'));_0xf565ba(_0x56554d[_0xaddf('0x14')][_0xaddf('0x13')]);}})[_0xaddf('0x15')](function(_0x6b50ce){logger[_0xaddf('0x11')]('Cdr,\x20%s,\x20%s',_0x5cf5e7,_0x6b50ce);_0x12b4b3(_0x6b50ce);});});} \ No newline at end of file +var _0x8619=['bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','Cdr,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash'];(function(_0x192fee,_0xca065b){var _0x1cc6f4=function(_0x302964){while(--_0x302964){_0x192fee['push'](_0x192fee['shift']());}};_0x1cc6f4(++_0xca065b);}(_0x8619,0x11f));var _0x9861=function(_0x365439,_0x562ef8){_0x365439=_0x365439-0x0;var _0x3215b4=_0x8619[_0x365439];return _0x3215b4;};'use strict';var _=require(_0x9861('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9861('0x1'));var rs=require(_0x9861('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9861('0x3'));var logger=require(_0x9861('0x4'))('rpc');var config=require(_0x9861('0x5'));var jayson=require(_0x9861('0x6'));var client=jayson[_0x9861('0x7')][_0x9861('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39a874,_0x3e7156,_0x3e731c){return new BPromise(function(_0x387fa8,_0x4d39de){return client['request'](_0x39a874,_0x3e731c)[_0x9861('0x9')](function(_0x4d110e){logger['info'](_0x9861('0xa'),_0x3e7156,'request\x20sent');logger['debug']('Cdr,\x20%s,\x20%s,\x20%s',_0x3e7156,_0x9861('0xb'),JSON['stringify'](_0x4d110e));if(_0x4d110e[_0x9861('0xc')]){if(_0x4d110e['error'][_0x9861('0xd')]===0x1f4){logger[_0x9861('0xc')](_0x9861('0xa'),_0x3e7156,_0x4d110e[_0x9861('0xc')][_0x9861('0xe')]);return _0x4d39de(_0x4d110e[_0x9861('0xc')][_0x9861('0xe')]);}logger['error'](_0x9861('0xa'),_0x3e7156,_0x4d110e[_0x9861('0xc')][_0x9861('0xe')]);return _0x387fa8(_0x4d110e[_0x9861('0xc')]['message']);}else{logger[_0x9861('0xf')](_0x9861('0xa'),_0x3e7156,'request\x20sent');_0x387fa8(_0x4d110e[_0x9861('0x10')]['message']);}})[_0x9861('0x11')](function(_0x2b6c5a){logger[_0x9861('0xc')]('Cdr,\x20%s,\x20%s',_0x3e7156,_0x2b6c5a);_0x4d39de(_0x2b6c5a);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 9f5e590..dbd3ed3 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x115b95,_0xa1f8b9){var _0x460b3d=function(_0x510c02){while(--_0x510c02){_0x115b95['push'](_0x115b95['shift']());}};_0x460b3d(++_0xa1f8b9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x4aa350,_0x12a9eb){var _0x32a16f=function(_0x658038){while(--_0x658038){_0x4aa350['push'](_0x4aa350['shift']());}};_0x32a16f(++_0x12a9eb);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index c22a89d..8e48440 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 _0xd987=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x143d08,_0x59d4d9){var _0x363ddd=function(_0x1f0a93){while(--_0x1f0a93){_0x143d08['push'](_0x143d08['shift']());}};_0x363ddd(++_0x59d4d9);}(_0xd987,0x15d));var _0x7d98=function(_0x1defa0,_0x564c7f){_0x1defa0=_0x1defa0-0x0;var _0x3cd429=_0xd987[_0x1defa0];return _0x3cd429;};'use strict';var Sequelize=require(_0x7d98('0x0'));module[_0x7d98('0x1')]={'priority':{'type':Sequelize[_0x7d98('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7d98('0x3')],'allowNull':![],'defaultValue':_0x7d98('0x4')},'appdata':{'type':Sequelize[_0x7d98('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7d98('0x3')],'defaultValue':_0x7d98('0x6')}}; \ No newline at end of file +var _0x4e91=['exports','STRING','noop','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4e91,0x194));var _0x14e9=function(_0x3f25b2,_0x412bd4){_0x3f25b2=_0x3f25b2-0x0;var _0xd8caeb=_0x4e91[_0x3f25b2];return _0xd8caeb;};'use strict';var Sequelize=require('sequelize');module[_0x14e9('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x14e9('0x1')],'allowNull':![],'defaultValue':_0x14e9('0x2')},'appdata':{'type':Sequelize[_0x14e9('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x14e9('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 116aa8e..f538da4 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 _0x9348=['undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','includeAll','merge','options','ChatApplication','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../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'];(function(_0x4685a9,_0x57af26){var _0x220a87=function(_0xd2f9aa){while(--_0xd2f9aa){_0x4685a9['push'](_0x4685a9['shift']());}};_0x220a87(++_0x57af26);}(_0x9348,0x10d));var _0x8934=function(_0x26911e,_0x121a02){_0x26911e=_0x26911e-0x0;var _0x47eb93=_0x9348[_0x26911e];return _0x47eb93;};'use strict';var emlformat=require(_0x8934('0x0'));var rimraf=require(_0x8934('0x1'));var zipdir=require(_0x8934('0x2'));var jsonpatch=require(_0x8934('0x3'));var rp=require(_0x8934('0x4'));var moment=require('moment');var BPromise=require(_0x8934('0x5'));var Mustache=require(_0x8934('0x6'));var util=require('util');var path=require(_0x8934('0x7'));var sox=require(_0x8934('0x8'));var csv=require(_0x8934('0x9'));var ejs=require(_0x8934('0xa'));var fs=require('fs');var fs_extra=require(_0x8934('0xb'));var _=require(_0x8934('0xc'));var squel=require('squel');var crypto=require(_0x8934('0xd'));var jsforce=require(_0x8934('0xe'));var deskjs=require(_0x8934('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8934('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8934('0x11'));var hardwareService=require(_0x8934('0x12'));var logger=require(_0x8934('0x13'))(_0x8934('0x14'));var utils=require(_0x8934('0x15'));var config=require(_0x8934('0x16'));var licenseUtil=require(_0x8934('0x17'));var db=require(_0x8934('0x18'))['db'];function respondWithStatusCode(_0x4a999c,_0x68427d){_0x68427d=_0x68427d||0xcc;return function(_0x108eab){if(_0x108eab){return _0x4a999c[_0x8934('0x19')](_0x68427d);}return _0x4a999c[_0x8934('0x1a')](_0x68427d)[_0x8934('0x1b')]();};}function respondWithResult(_0xdf59f4,_0x5b560f){_0x5b560f=_0x5b560f||0xc8;return function(_0x254720){if(_0x254720){return _0xdf59f4[_0x8934('0x1a')](_0x5b560f)[_0x8934('0x1c')](_0x254720);}};}function respondWithFilteredResult(_0x94b948,_0x34d4dc){return function(_0x41e6a9){if(_0x41e6a9){var _0x2a5b04=typeof _0x34d4dc[_0x8934('0x1d')]==='undefined'&&typeof _0x34d4dc[_0x8934('0x1e')]===_0x8934('0x1f');var _0x261c78=_0x41e6a9['count'];var _0x47f25e=_0x2a5b04?0x0:_0x34d4dc['offset'];var _0x2ff9ce=_0x2a5b04?_0x41e6a9['count']:_0x34d4dc[_0x8934('0x1d')]+_0x34d4dc[_0x8934('0x1e')];var _0x14b4e4;if(_0x2ff9ce>=_0x261c78){_0x2ff9ce=_0x261c78;_0x14b4e4=0xc8;}else{_0x14b4e4=0xce;}_0x94b948[_0x8934('0x1a')](_0x14b4e4);return _0x94b948[_0x8934('0x20')]('Content-Range',_0x47f25e+'-'+_0x2ff9ce+'/'+_0x261c78)[_0x8934('0x1c')](_0x41e6a9);}return null;};}function patchUpdates(_0x5ae49f){return function(_0x476c6c){try{jsonpatch[_0x8934('0x21')](_0x476c6c,_0x5ae49f,!![]);}catch(_0x1ccbe5){return BPromise[_0x8934('0x22')](_0x1ccbe5);}return _0x476c6c[_0x8934('0x23')]();};}function saveUpdates(_0x331e18,_0x36fe20){return function(_0x4f4a9b){if(_0x4f4a9b){return _0x4f4a9b[_0x8934('0x24')](_0x331e18)[_0x8934('0x25')](function(_0x32020a){return _0x32020a;});}return null;};}function removeEntity(_0x343e09,_0x43b89a){return function(_0x5e593b){if(_0x5e593b){return _0x5e593b[_0x8934('0x26')]()[_0x8934('0x25')](function(){_0x343e09[_0x8934('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16cfc2,_0x561df2){return function(_0x14c5f0){if(!_0x14c5f0){_0x16cfc2[_0x8934('0x19')](0x194);}return _0x14c5f0;};}function handleError(_0x110f7f,_0x5ef0ed){_0x5ef0ed=_0x5ef0ed||0x1f4;return function(_0x1fd5eb){logger[_0x8934('0x27')](_0x1fd5eb[_0x8934('0x28')]);if(_0x1fd5eb[_0x8934('0x29')]){delete _0x1fd5eb['name'];}_0x110f7f[_0x8934('0x1a')](_0x5ef0ed)[_0x8934('0x2a')](_0x1fd5eb);};}exports[_0x8934('0x2b')]=function(_0x3d93c7,_0x44972b){var _0x20d448={'raw':!![],'where':{'id':_0x3d93c7[_0x8934('0x2c')]['id']}},_0x3f328a={};_0x3f328a[_0x8934('0x2d')]=_[_0x8934('0x2e')](db['ChatApplication'][_0x8934('0x2f')]);_0x3f328a[_0x8934('0x30')]=_['keys'](_0x3d93c7[_0x8934('0x30')]);_0x3f328a[_0x8934('0x31')]=_[_0x8934('0x32')](_0x3f328a[_0x8934('0x2d')],_0x3f328a['query']);_0x20d448[_0x8934('0x33')]=_[_0x8934('0x32')](_0x3f328a[_0x8934('0x2d')],qs[_0x8934('0x34')](_0x3d93c7[_0x8934('0x30')]['fields']));_0x20d448[_0x8934('0x33')]=_0x20d448['attributes']['length']?_0x20d448[_0x8934('0x33')]:_0x3f328a[_0x8934('0x2d')];if(_0x3d93c7[_0x8934('0x30')][_0x8934('0x35')]){_0x20d448['include']=[{'all':!![]}];}_0x20d448=_[_0x8934('0x36')]({},_0x20d448,_0x3d93c7[_0x8934('0x37')]);return db[_0x8934('0x38')][_0x8934('0x39')](_0x20d448)[_0x8934('0x25')](handleEntityNotFound(_0x44972b,null))['then'](respondWithResult(_0x44972b,null))[_0x8934('0x3a')](handleError(_0x44972b,null));};exports[_0x8934('0x24')]=function(_0x5d5bc2,_0x5914b9){if(_0x5d5bc2[_0x8934('0x3b')]['id']){delete _0x5d5bc2[_0x8934('0x3b')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x5d5bc2[_0x8934('0x2c')]['id']}})[_0x8934('0x25')](handleEntityNotFound(_0x5914b9,null))[_0x8934('0x25')](saveUpdates(_0x5d5bc2[_0x8934('0x3b')],null))[_0x8934('0x25')](respondWithResult(_0x5914b9,null))[_0x8934('0x3a')](handleError(_0x5914b9,null));};exports[_0x8934('0x26')]=function(_0x1bc2d8,_0x27920e){return db[_0x8934('0x38')][_0x8934('0x39')]({'where':{'id':_0x1bc2d8['params']['id']}})[_0x8934('0x25')](handleEntityNotFound(_0x27920e,null))[_0x8934('0x25')](removeEntity(_0x27920e,null))['catch'](handleError(_0x27920e,null));}; \ No newline at end of file +var _0xe87e=['then','destroy','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x21efee,_0x374c7e){var _0x9b2a26=function(_0x1b9921){while(--_0x1b9921){_0x21efee['push'](_0x21efee['shift']());}};_0x9b2a26(++_0x374c7e);}(_0xe87e,0x17d));var _0xee87=function(_0x391c55,_0x168617){_0x391c55=_0x391c55-0x0;var _0xa434e0=_0xe87e[_0x391c55];return _0xa434e0;};'use strict';var emlformat=require(_0xee87('0x0'));var rimraf=require(_0xee87('0x1'));var zipdir=require(_0xee87('0x2'));var jsonpatch=require(_0xee87('0x3'));var rp=require(_0xee87('0x4'));var moment=require('moment');var BPromise=require(_0xee87('0x5'));var Mustache=require(_0xee87('0x6'));var util=require(_0xee87('0x7'));var path=require(_0xee87('0x8'));var sox=require(_0xee87('0x9'));var csv=require(_0xee87('0xa'));var ejs=require(_0xee87('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xee87('0xc'));var crypto=require(_0xee87('0xd'));var jsforce=require(_0xee87('0xe'));var deskjs=require(_0xee87('0xf'));var toCsv=require(_0xee87('0xa'));var querystring=require('querystring');var Papa=require(_0xee87('0x10'));var Redis=require(_0xee87('0x11'));var authService=require(_0xee87('0x12'));var qs=require(_0xee87('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee87('0x14'));var logger=require(_0xee87('0x15'))('api');var utils=require(_0xee87('0x16'));var config=require(_0xee87('0x17'));var licenseUtil=require(_0xee87('0x18'));var db=require(_0xee87('0x19'))['db'];function respondWithStatusCode(_0x252418,_0x2768f7){_0x2768f7=_0x2768f7||0xcc;return function(_0x317dcd){if(_0x317dcd){return _0x252418[_0xee87('0x1a')](_0x2768f7);}return _0x252418['status'](_0x2768f7)[_0xee87('0x1b')]();};}function respondWithResult(_0x2377a7,_0x49df11){_0x49df11=_0x49df11||0xc8;return function(_0x4be77d){if(_0x4be77d){return _0x2377a7[_0xee87('0x1c')](_0x49df11)[_0xee87('0x1d')](_0x4be77d);}};}function respondWithFilteredResult(_0x5175e6,_0x420526){return function(_0x35d1c7){if(_0x35d1c7){var _0x67df24=typeof _0x420526[_0xee87('0x1e')]==='undefined'&&typeof _0x420526[_0xee87('0x1f')]==='undefined';var _0x2f7ad3=_0x35d1c7[_0xee87('0x20')];var _0x1fa2be=_0x67df24?0x0:_0x420526['offset'];var _0x48a330=_0x67df24?_0x35d1c7[_0xee87('0x20')]:_0x420526[_0xee87('0x1e')]+_0x420526[_0xee87('0x1f')];var _0x4eb271;if(_0x48a330>=_0x2f7ad3){_0x48a330=_0x2f7ad3;_0x4eb271=0xc8;}else{_0x4eb271=0xce;}_0x5175e6[_0xee87('0x1c')](_0x4eb271);return _0x5175e6[_0xee87('0x21')](_0xee87('0x22'),_0x1fa2be+'-'+_0x48a330+'/'+_0x2f7ad3)[_0xee87('0x1d')](_0x35d1c7);}return null;};}function patchUpdates(_0x42ba7a){return function(_0x1d48c6){try{jsonpatch[_0xee87('0x23')](_0x1d48c6,_0x42ba7a,!![]);}catch(_0x504d15){return BPromise[_0xee87('0x24')](_0x504d15);}return _0x1d48c6[_0xee87('0x25')]();};}function saveUpdates(_0x406fde,_0x35e7cf){return function(_0x3176c6){if(_0x3176c6){return _0x3176c6[_0xee87('0x26')](_0x406fde)[_0xee87('0x27')](function(_0x1f5dc3){return _0x1f5dc3;});}return null;};}function removeEntity(_0xb41cbc,_0x49e9f5){return function(_0x5cc9a3){if(_0x5cc9a3){return _0x5cc9a3[_0xee87('0x28')]()[_0xee87('0x27')](function(){_0xb41cbc['status'](0xcc)[_0xee87('0x1b')]();});}};}function handleEntityNotFound(_0xb68987,_0x36a651){return function(_0x55236e){if(!_0x55236e){_0xb68987['sendStatus'](0x194);}return _0x55236e;};}function handleError(_0x18dd0d,_0x48fe19){_0x48fe19=_0x48fe19||0x1f4;return function(_0x36e381){logger['error'](_0x36e381[_0xee87('0x29')]);if(_0x36e381[_0xee87('0x2a')]){delete _0x36e381['name'];}_0x18dd0d[_0xee87('0x1c')](_0x48fe19)[_0xee87('0x2b')](_0x36e381);};}exports[_0xee87('0x2c')]=function(_0x1bd42a,_0x3fcc5e){var _0x5ac56a={'raw':!![],'where':{'id':_0x1bd42a[_0xee87('0x2d')]['id']}},_0x3eb538={};_0x3eb538[_0xee87('0x2e')]=_[_0xee87('0x2f')](db[_0xee87('0x30')][_0xee87('0x31')]);_0x3eb538[_0xee87('0x32')]=_['keys'](_0x1bd42a[_0xee87('0x32')]);_0x3eb538[_0xee87('0x33')]=_[_0xee87('0x34')](_0x3eb538[_0xee87('0x2e')],_0x3eb538[_0xee87('0x32')]);_0x5ac56a[_0xee87('0x35')]=_[_0xee87('0x34')](_0x3eb538[_0xee87('0x2e')],qs[_0xee87('0x36')](_0x1bd42a['query']['fields']));_0x5ac56a[_0xee87('0x35')]=_0x5ac56a['attributes'][_0xee87('0x37')]?_0x5ac56a[_0xee87('0x35')]:_0x3eb538[_0xee87('0x2e')];if(_0x1bd42a[_0xee87('0x32')][_0xee87('0x38')]){_0x5ac56a[_0xee87('0x39')]=[{'all':!![]}];}_0x5ac56a=_['merge']({},_0x5ac56a,_0x1bd42a['options']);return db[_0xee87('0x30')]['find'](_0x5ac56a)['then'](handleEntityNotFound(_0x3fcc5e,null))[_0xee87('0x27')](respondWithResult(_0x3fcc5e,null))[_0xee87('0x3a')](handleError(_0x3fcc5e,null));};exports[_0xee87('0x26')]=function(_0x5746e7,_0x27420a){if(_0x5746e7[_0xee87('0x3b')]['id']){delete _0x5746e7[_0xee87('0x3b')]['id'];}return db[_0xee87('0x30')]['find']({'where':{'id':_0x5746e7[_0xee87('0x2d')]['id']}})[_0xee87('0x27')](handleEntityNotFound(_0x27420a,null))[_0xee87('0x27')](saveUpdates(_0x5746e7['body'],null))[_0xee87('0x27')](respondWithResult(_0x27420a,null))[_0xee87('0x3a')](handleError(_0x27420a,null));};exports[_0xee87('0x28')]=function(_0x1c8d10,_0x512f54){return db[_0xee87('0x30')]['find']({'where':{'id':_0x1c8d10[_0xee87('0x2d')]['id']}})[_0xee87('0x27')](handleEntityNotFound(_0x512f54,null))[_0xee87('0x27')](removeEntity(_0x512f54,null))['catch'](handleError(_0x512f54,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index d7693ad..32b7c89 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 _0xbc4b=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','utf8mb4','utf8mb4_unicode_ci'];(function(_0xaf24cd,_0x10644a){var _0x1d9bda=function(_0x59a069){while(--_0x59a069){_0xaf24cd['push'](_0xaf24cd['shift']());}};_0x1d9bda(++_0x10644a);}(_0xbc4b,0x17a));var _0xbbc4=function(_0x134a26,_0x241d2c){_0x134a26=_0x134a26-0x0;var _0x5f3f9c=_0xbc4b[_0x134a26];return _0x5f3f9c;};'use strict';var _=require(_0xbbc4('0x0'));var util=require('util');var logger=require(_0xbbc4('0x1'))('api');var moment=require(_0xbbc4('0x2'));var BPromise=require(_0xbbc4('0x3'));var rp=require(_0xbbc4('0x4'));var fs=require('fs');var path=require(_0xbbc4('0x5'));var rimraf=require(_0xbbc4('0x6'));var config=require(_0xbbc4('0x7'));var attributes=require(_0xbbc4('0x8'));module[_0xbbc4('0x9')]=function(_0x5f7b1b,_0xf424ec){return _0x5f7b1b[_0xbbc4('0xa')](_0xbbc4('0xb'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbbc4('0xc'),'collate':_0xbbc4('0xd')});}; \ No newline at end of file +var _0x9275=['define','ChatApplication','chat_applications','utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes'];(function(_0x51da74,_0xed04){var _0x58cbd7=function(_0x3de772){while(--_0x3de772){_0x51da74['push'](_0x51da74['shift']());}};_0x58cbd7(++_0xed04);}(_0x9275,0x154));var _0x5927=function(_0x223461,_0x2bca70){_0x223461=_0x223461-0x0;var _0x4dbe0a=_0x9275[_0x223461];return _0x4dbe0a;};'use strict';var _=require(_0x5927('0x0'));var util=require(_0x5927('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x5927('0x2'));var rp=require(_0x5927('0x3'));var fs=require('fs');var path=require(_0x5927('0x4'));var rimraf=require(_0x5927('0x5'));var config=require(_0x5927('0x6'));var attributes=require(_0x5927('0x7'));module['exports']=function(_0x3f640c,_0xde818c){return _0x3f640c[_0x5927('0x8')](_0x5927('0x9'),attributes,{'tableName':_0x5927('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5927('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index bec75be..e274e32 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 _0x039b=['then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request'];(function(_0x5d88c0,_0x5d7d83){var _0x1b40f0=function(_0x3fde10){while(--_0x3fde10){_0x5d88c0['push'](_0x5d88c0['shift']());}};_0x1b40f0(++_0x5d7d83);}(_0x039b,0x8f));var _0xb039=function(_0x54e2ff,_0x11360a){_0x54e2ff=_0x54e2ff-0x0;var _0x6b1bec=_0x039b[_0x54e2ff];return _0x6b1bec;};'use strict';var _=require(_0xb039('0x0'));var util=require(_0xb039('0x1'));var moment=require('moment');var BPromise=require(_0xb039('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb039('0x3'));var db=require(_0xb039('0x4'))['db'];var utils=require(_0xb039('0x5'));var logger=require('../../config/logger')(_0xb039('0x6'));var config=require('../../config/environment');var jayson=require(_0xb039('0x7'));var client=jayson[_0xb039('0x8')][_0xb039('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35371d,_0x357eca,_0x5a129c){return new BPromise(function(_0x23970c,_0x2154d7){return client[_0xb039('0xa')](_0x35371d,_0x5a129c)[_0xb039('0xb')](function(_0x38fc43){logger[_0xb039('0xc')](_0xb039('0xd'),_0x357eca,_0xb039('0xe'));logger[_0xb039('0xf')](_0xb039('0x10'),_0x357eca,_0xb039('0xe'),JSON[_0xb039('0x11')](_0x38fc43));if(_0x38fc43[_0xb039('0x12')]){if(_0x38fc43['error'][_0xb039('0x13')]===0x1f4){logger['error'](_0xb039('0xd'),_0x357eca,_0x38fc43['error'][_0xb039('0x14')]);return _0x2154d7(_0x38fc43[_0xb039('0x12')][_0xb039('0x14')]);}logger[_0xb039('0x12')](_0xb039('0xd'),_0x357eca,_0x38fc43[_0xb039('0x12')][_0xb039('0x14')]);return _0x23970c(_0x38fc43[_0xb039('0x12')]['message']);}else{logger[_0xb039('0xc')](_0xb039('0xd'),_0x357eca,_0xb039('0xe'));_0x23970c(_0x38fc43[_0xb039('0x15')]['message']);}})['catch'](function(_0x43ffe4){logger[_0xb039('0x12')](_0xb039('0xd'),_0x357eca,_0x43ffe4);_0x2154d7(_0x43ffe4);});});} \ No newline at end of file +var _0xf987=['jayson/promise','client','http','request','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x11cbff,_0x52cbd3){var _0x5a60d9=function(_0x7f78ee){while(--_0x7f78ee){_0x11cbff['push'](_0x11cbff['shift']());}};_0x5a60d9(++_0x52cbd3);}(_0xf987,0x128));var _0x7f98=function(_0x1ce746,_0x3c1572){_0x1ce746=_0x1ce746-0x0;var _0x1d8d76=_0xf987[_0x1ce746];return _0x1d8d76;};'use strict';var _=require(_0x7f98('0x0'));var util=require('util');var moment=require(_0x7f98('0x1'));var BPromise=require('bluebird');var rs=require(_0x7f98('0x2'));var fs=require('fs');var Redis=require(_0x7f98('0x3'));var db=require(_0x7f98('0x4'))['db'];var utils=require(_0x7f98('0x5'));var logger=require('../../config/logger')(_0x7f98('0x6'));var config=require(_0x7f98('0x7'));var jayson=require(_0x7f98('0x8'));var client=jayson[_0x7f98('0x9')][_0x7f98('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x510db3,_0x2e7892,_0x84f3df){return new BPromise(function(_0x444f2d,_0x52da56){return client[_0x7f98('0xb')](_0x510db3,_0x84f3df)['then'](function(_0x1e8006){logger['info'](_0x7f98('0xc'),_0x2e7892,_0x7f98('0xd'));logger[_0x7f98('0xe')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x2e7892,_0x7f98('0xd'),JSON[_0x7f98('0xf')](_0x1e8006));if(_0x1e8006['error']){if(_0x1e8006[_0x7f98('0x10')]['code']===0x1f4){logger[_0x7f98('0x10')](_0x7f98('0xc'),_0x2e7892,_0x1e8006[_0x7f98('0x10')][_0x7f98('0x11')]);return _0x52da56(_0x1e8006[_0x7f98('0x10')]['message']);}logger[_0x7f98('0x10')](_0x7f98('0xc'),_0x2e7892,_0x1e8006['error']['message']);return _0x444f2d(_0x1e8006[_0x7f98('0x10')]['message']);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x2e7892,'request\x20sent');_0x444f2d(_0x1e8006[_0x7f98('0x12')][_0x7f98('0x11')]);}})['catch'](function(_0x417c1e){logger[_0x7f98('0x10')](_0x7f98('0xc'),_0x2e7892,_0x417c1e);_0x52da56(_0x417c1e);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index b3a0eb7..83b8875 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 _0xf32a=['./chatApplication.controller','get','/:id','show','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0xf32a,0x91));var _0xaf32=function(_0x2a0929,_0x4abe7c){_0x2a0929=_0x2a0929-0x0;var _0x50e47b=_0xf32a[_0x2a0929];return _0x50e47b;};'use strict';var multer=require(_0xaf32('0x0'));var util=require(_0xaf32('0x1'));var path=require(_0xaf32('0x2'));var timeout=require(_0xaf32('0x3'));var express=require('express');var router=express[_0xaf32('0x4')]();var fs_extra=require(_0xaf32('0x5'));var auth=require(_0xaf32('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xaf32('0x7'));var controller=require(_0xaf32('0x8'));router[_0xaf32('0x9')](_0xaf32('0xa'),auth['isAuthenticated'](),controller[_0xaf32('0xb')]);router['put'](_0xaf32('0xa'),auth[_0xaf32('0xc')](),controller[_0xaf32('0xd')]);router[_0xaf32('0xe')](_0xaf32('0xa'),auth[_0xaf32('0xc')](),controller[_0xaf32('0xf')]);module[_0xaf32('0x10')]=router; \ No newline at end of file +var _0x7155=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','destroy','exports','multer'];(function(_0x44e590,_0x4a3a99){var _0x36f77c=function(_0x58d4bc){while(--_0x58d4bc){_0x44e590['push'](_0x44e590['shift']());}};_0x36f77c(++_0x4a3a99);}(_0x7155,0x19f));var _0x5715=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7155[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x5715('0x0'));var util=require('util');var path=require(_0x5715('0x1'));var timeout=require('connect-timeout');var express=require(_0x5715('0x2'));var router=express[_0x5715('0x3')]();var fs_extra=require(_0x5715('0x4'));var auth=require(_0x5715('0x5'));var interaction=require(_0x5715('0x6'));var config=require(_0x5715('0x7'));var controller=require(_0x5715('0x8'));router[_0x5715('0x9')](_0x5715('0xa'),auth[_0x5715('0xb')](),controller[_0x5715('0xc')]);router[_0x5715('0xd')](_0x5715('0xa'),auth[_0x5715('0xb')](),controller['update']);router['delete'](_0x5715('0xa'),auth['isAuthenticated'](),controller[_0x5715('0xe')]);module[_0x5715('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index bb846f0..f4c0cab 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 _0x35b5=['sequelize','exports','STRING','BOOLEAN'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x35b5,0xd4));var _0x535b=function(_0x38eea6,_0x567ed2){_0x38eea6=_0x38eea6-0x0;var _0x272571=_0x35b5[_0x38eea6];return _0x272571;};'use strict';var Sequelize=require(_0x535b('0x0'));module[_0x535b('0x1')]={'name':{'type':Sequelize[_0x535b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x535b('0x2')]},'write':{'type':Sequelize[_0x535b('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x3b64=['BOOLEAN','sequelize','exports','STRING'];(function(_0x4f9522,_0x399e9f){var _0x5a89a7=function(_0x853a9a){while(--_0x853a9a){_0x4f9522['push'](_0x4f9522['shift']());}};_0x5a89a7(++_0x399e9f);}(_0x3b64,0x1bd));var _0x43b6=function(_0x21154b,_0x14406b){_0x21154b=_0x21154b-0x0;var _0x199827=_0x3b64[_0x21154b];return _0x199827;};'use strict';var Sequelize=require(_0x43b6('0x0'));module[_0x43b6('0x1')]={'name':{'type':Sequelize[_0x43b6('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x43b6('0x2')]},'write':{'type':Sequelize[_0x43b6('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index b1cfd18..8a3d6e4 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 _0x28b0=['create','body','find','describe','getUnread','user','addMembers','omit','ids','getMembers','findOne','User','order','pick','removeMembers','addMessage','ChatInternalMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','ChatGroup','includeAll','include','findAll','params','catch'];(function(_0x18ca74,_0x1fe2aa){var _0x5c853b=function(_0x396362){while(--_0x396362){_0x18ca74['push'](_0x18ca74['shift']());}};_0x5c853b(++_0x1fe2aa);}(_0x28b0,0xcc));var _0x028b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28b0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x028b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x028b('0x1'));var rp=require(_0x028b('0x2'));var moment=require(_0x028b('0x3'));var BPromise=require(_0x028b('0x4'));var Mustache=require('mustache');var util=require(_0x028b('0x5'));var path=require(_0x028b('0x6'));var sox=require(_0x028b('0x7'));var csv=require(_0x028b('0x8'));var ejs=require(_0x028b('0x9'));var fs=require('fs');var fs_extra=require(_0x028b('0xa'));var _=require(_0x028b('0xb'));var squel=require(_0x028b('0xc'));var crypto=require('crypto');var jsforce=require(_0x028b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x028b('0x8'));var querystring=require('querystring');var Papa=require(_0x028b('0xe'));var Redis=require('ioredis');var authService=require(_0x028b('0xf'));var qs=require(_0x028b('0x10'));var as=require(_0x028b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x028b('0x12'));var utils=require(_0x028b('0x13'));var config=require(_0x028b('0x14'));var licenseUtil=require(_0x028b('0x15'));var db=require(_0x028b('0x16'))['db'];config[_0x028b('0x17')]=_['defaults'](config[_0x028b('0x17')],{'host':_0x028b('0x18'),'port':0x18eb});var socket=require(_0x028b('0x19'))(new Redis(config[_0x028b('0x17')]));require(_0x028b('0x1a'))['register'](socket);function respondWithStatusCode(_0x13a913,_0x589554){_0x589554=_0x589554||0xcc;return function(_0x2e6747){if(_0x2e6747){return _0x13a913['sendStatus'](_0x589554);}return _0x13a913[_0x028b('0x1b')](_0x589554)[_0x028b('0x1c')]();};}function respondWithResult(_0x4cf82a,_0x21ec89){_0x21ec89=_0x21ec89||0xc8;return function(_0x3c37bf){if(_0x3c37bf){return _0x4cf82a['status'](_0x21ec89)[_0x028b('0x1d')](_0x3c37bf);}};}function respondWithFilteredResult(_0x235219,_0x5d46ed){return function(_0x118b17){if(_0x118b17){var _0x2a8fcf=typeof _0x5d46ed[_0x028b('0x1e')]===_0x028b('0x1f')&&typeof _0x5d46ed[_0x028b('0x20')]===_0x028b('0x1f');var _0x176d89=_0x118b17['count'];var _0x41e72d=_0x2a8fcf?0x0:_0x5d46ed[_0x028b('0x1e')];var _0x1085de=_0x2a8fcf?_0x118b17[_0x028b('0x21')]:_0x5d46ed[_0x028b('0x1e')]+_0x5d46ed[_0x028b('0x20')];var _0x3de8af;if(_0x1085de>=_0x176d89){_0x1085de=_0x176d89;_0x3de8af=0xc8;}else{_0x3de8af=0xce;}_0x235219[_0x028b('0x1b')](_0x3de8af);return _0x235219[_0x028b('0x22')]('Content-Range',_0x41e72d+'-'+_0x1085de+'/'+_0x176d89)[_0x028b('0x1d')](_0x118b17);}return null;};}function patchUpdates(_0xa4f05e){return function(_0x46d66c){try{jsonpatch['apply'](_0x46d66c,_0xa4f05e,!![]);}catch(_0x29029c){return BPromise[_0x028b('0x23')](_0x29029c);}return _0x46d66c[_0x028b('0x24')]();};}function saveUpdates(_0x352558,_0x22eea0){return function(_0x447c96){if(_0x447c96){return _0x447c96[_0x028b('0x25')](_0x352558)[_0x028b('0x26')](function(_0xd8804d){return _0xd8804d;});}return null;};}function removeEntity(_0x5d4573,_0x43ab1a){return function(_0x5e7d02){if(_0x5e7d02){return _0x5e7d02['destroy']()['then'](function(){_0x5d4573[_0x028b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19a528,_0x3ab27d){return function(_0x27d9aa){if(!_0x27d9aa){_0x19a528['sendStatus'](0x194);}return _0x27d9aa;};}function handleError(_0x3395c8,_0x3ae998){_0x3ae998=_0x3ae998||0x1f4;return function(_0x2fc8f1){logger[_0x028b('0x27')](_0x2fc8f1['stack']);if(_0x2fc8f1[_0x028b('0x28')]){delete _0x2fc8f1[_0x028b('0x28')];}_0x3395c8[_0x028b('0x1b')](_0x3ae998)[_0x028b('0x29')](_0x2fc8f1);};}exports[_0x028b('0x2a')]=function(_0x4c4320,_0x1afeab){var _0x41efec={},_0xb2c9c3={},_0x1908e9={'count':0x0,'rows':[]};var _0x5bcc40=_[_0x028b('0x2b')](db['ChatGroup'][_0x028b('0x2c')],function(_0x55e573){return{'name':_0x55e573[_0x028b('0x2d')],'type':_0x55e573[_0x028b('0x2e')][_0x028b('0x2f')]};});_0xb2c9c3[_0x028b('0x30')]=_['map'](_0x5bcc40,_0x028b('0x28'));_0xb2c9c3['query']=_[_0x028b('0x31')](_0x4c4320[_0x028b('0x32')]);_0xb2c9c3[_0x028b('0x33')]=_['intersection'](_0xb2c9c3[_0x028b('0x30')],_0xb2c9c3[_0x028b('0x32')]);_0x41efec[_0x028b('0x34')]=_[_0x028b('0x35')](_0xb2c9c3[_0x028b('0x30')],qs[_0x028b('0x36')](_0x4c4320['query']['fields']));_0x41efec[_0x028b('0x34')]=_0x41efec[_0x028b('0x34')][_0x028b('0x37')]?_0x41efec[_0x028b('0x34')]:_0xb2c9c3[_0x028b('0x30')];if(!_0x4c4320[_0x028b('0x32')][_0x028b('0x38')](_0x028b('0x39'))){_0x41efec[_0x028b('0x20')]=qs[_0x028b('0x20')](_0x4c4320['query'][_0x028b('0x20')]);_0x41efec['offset']=qs['offset'](_0x4c4320[_0x028b('0x32')][_0x028b('0x1e')]);}_0x41efec['order']=qs[_0x028b('0x3a')](_0x4c4320['query'][_0x028b('0x3a')]);_0x41efec['where']=qs['filters'](_['pick'](_0x4c4320[_0x028b('0x32')],_0xb2c9c3[_0x028b('0x33')]),_0x5bcc40);if(_0x4c4320[_0x028b('0x32')][_0x028b('0x3b')]){_0x41efec[_0x028b('0x3c')]=_[_0x028b('0x3d')](_0x41efec[_0x028b('0x3c')],{'$or':_['map'](_0x5bcc40,function(_0x135f64){if(_0x135f64[_0x028b('0x2e')]!==_0x028b('0x3e')){var _0xa9602f={};_0xa9602f[_0x135f64[_0x028b('0x28')]]={'$like':'%'+_0x4c4320[_0x028b('0x32')]['filter']+'%'};return _0xa9602f;}})});}_0x41efec=_['merge']({},_0x41efec,_0x4c4320['options']);var _0x3dda46={'where':_0x41efec['where']};return db[_0x028b('0x3f')]['count'](_0x3dda46)[_0x028b('0x26')](function(_0x4b862a){_0x1908e9['count']=_0x4b862a;if(_0x4c4320[_0x028b('0x32')][_0x028b('0x40')]){_0x41efec[_0x028b('0x41')]=[{'all':!![]}];}return db['ChatGroup'][_0x028b('0x42')](_0x41efec);})[_0x028b('0x26')](function(_0x18107e){_0x1908e9['rows']=_0x18107e;return _0x1908e9;})[_0x028b('0x26')](respondWithFilteredResult(_0x1afeab,_0x41efec))['catch'](handleError(_0x1afeab,null));};exports['show']=function(_0x37fb92,_0x4481f6){var _0x1cdd12={'raw':!![],'where':{'id':_0x37fb92[_0x028b('0x43')]['id']}},_0x4170fc={};_0x4170fc['model']=_[_0x028b('0x31')](db[_0x028b('0x3f')][_0x028b('0x2c')]);_0x4170fc[_0x028b('0x32')]=_[_0x028b('0x31')](_0x37fb92[_0x028b('0x32')]);_0x4170fc[_0x028b('0x33')]=_[_0x028b('0x35')](_0x4170fc[_0x028b('0x30')],_0x4170fc[_0x028b('0x32')]);_0x1cdd12[_0x028b('0x34')]=_[_0x028b('0x35')](_0x4170fc[_0x028b('0x30')],qs[_0x028b('0x36')](_0x37fb92['query'][_0x028b('0x36')]));_0x1cdd12[_0x028b('0x34')]=_0x1cdd12[_0x028b('0x34')]['length']?_0x1cdd12[_0x028b('0x34')]:_0x4170fc[_0x028b('0x30')];if(_0x37fb92[_0x028b('0x32')][_0x028b('0x40')]){_0x1cdd12[_0x028b('0x41')]=[{'all':!![]}];}_0x1cdd12=_['merge']({},_0x1cdd12,_0x37fb92['options']);return db[_0x028b('0x3f')]['find'](_0x1cdd12)[_0x028b('0x26')](handleEntityNotFound(_0x4481f6,null))[_0x028b('0x26')](respondWithResult(_0x4481f6,null))[_0x028b('0x44')](handleError(_0x4481f6,null));};exports[_0x028b('0x45')]=function(_0x3d613a,_0x4adbd5){return db['ChatGroup']['create'](_0x3d613a[_0x028b('0x46')],{})[_0x028b('0x26')](respondWithResult(_0x4adbd5,0xc9))[_0x028b('0x44')](handleError(_0x4adbd5,null));};exports['update']=function(_0x55f98f,_0x35d663){if(_0x55f98f[_0x028b('0x46')]['id']){delete _0x55f98f[_0x028b('0x46')]['id'];}return db['ChatGroup'][_0x028b('0x47')]({'where':{'id':_0x55f98f['params']['id']}})[_0x028b('0x26')](handleEntityNotFound(_0x35d663,null))['then'](saveUpdates(_0x55f98f[_0x028b('0x46')],null))['then'](respondWithResult(_0x35d663,null))[_0x028b('0x44')](handleError(_0x35d663,null));};exports['destroy']=function(_0x9ef9d3,_0x145e26){return db[_0x028b('0x3f')][_0x028b('0x47')]({'where':{'id':_0x9ef9d3[_0x028b('0x43')]['id']}})['then'](handleEntityNotFound(_0x145e26,null))[_0x028b('0x26')](removeEntity(_0x145e26,null))[_0x028b('0x44')](handleError(_0x145e26,null));};exports[_0x028b('0x48')]=function(_0x56757e,_0x54dd36){return db['ChatGroup'][_0x028b('0x48')]()[_0x028b('0x26')](respondWithResult(_0x54dd36,null))[_0x028b('0x44')](handleError(_0x54dd36,null));};exports[_0x028b('0x49')]=function(_0x357beb,_0x1da2d8,_0x4ac890){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x357beb['params']['id'],'ToId':_0x357beb[_0x028b('0x4a')]['id'],'read':![]}})[_0x028b('0x26')](function(_0x1b6e76){return{'id':_['toInteger'](_0x357beb['params']['id']),'count':_0x1b6e76};})['then'](respondWithResult(_0x1da2d8,null))[_0x028b('0x44')](handleError(_0x1da2d8,null));};exports[_0x028b('0x4b')]=function(_0x1e15a6,_0x1eb346,_0x1a33f4){return db[_0x028b('0x3f')][_0x028b('0x47')]({'where':{'id':_0x1e15a6[_0x028b('0x43')]['id']}})[_0x028b('0x26')](handleEntityNotFound(_0x1eb346,null))[_0x028b('0x26')](function(_0x2b7208){if(_0x2b7208){return _0x2b7208[_0x028b('0x4b')](_0x1e15a6[_0x028b('0x46')]['ids'],_[_0x028b('0x4c')](_0x1e15a6[_0x028b('0x46')],[_0x028b('0x4d'),'id'])||{});}})[_0x028b('0x26')](respondWithResult(_0x1eb346,null))[_0x028b('0x44')](handleError(_0x1eb346,null));};exports[_0x028b('0x4e')]=function(_0x140bcd,_0x2e1928,_0x1666df){var _0x367688={};var _0x57846a={};var _0xc6d9fe;var _0x233e10;return db[_0x028b('0x3f')][_0x028b('0x4f')]({'where':{'id':_0x140bcd[_0x028b('0x43')]['id']}})['then'](handleEntityNotFound(_0x2e1928,null))[_0x028b('0x26')](function(_0x3671a6){if(_0x3671a6){_0xc6d9fe=_0x3671a6;_0x57846a[_0x028b('0x30')]=_['keys'](db[_0x028b('0x50')]['rawAttributes']);_0x57846a[_0x028b('0x32')]=_[_0x028b('0x31')](_0x140bcd['query']);_0x57846a[_0x028b('0x33')]=_['intersection'](_0x57846a[_0x028b('0x30')],_0x57846a[_0x028b('0x32')]);_0x367688['attributes']=_[_0x028b('0x35')](_0x57846a[_0x028b('0x30')],qs[_0x028b('0x36')](_0x140bcd[_0x028b('0x32')][_0x028b('0x36')]));_0x367688['attributes']=_0x367688[_0x028b('0x34')][_0x028b('0x37')]?_0x367688['attributes']:_0x57846a[_0x028b('0x30')];_0x367688[_0x028b('0x51')]=qs['sort'](_0x140bcd['query'][_0x028b('0x3a')]);_0x367688['where']=qs['filters'](_[_0x028b('0x52')](_0x140bcd['query'],_0x57846a[_0x028b('0x33')]));if(_0x140bcd['query'][_0x028b('0x3b')]){_0x367688[_0x028b('0x3c')]=_[_0x028b('0x3d')](_0x367688[_0x028b('0x3c')],{'$or':_[_0x028b('0x2b')](_0x367688[_0x028b('0x34')],function(_0x28a8c8){var _0x2f1a43={};_0x2f1a43[_0x28a8c8]={'$like':'%'+_0x140bcd[_0x028b('0x32')][_0x028b('0x3b')]+'%'};return _0x2f1a43;})});}_0x367688=_[_0x028b('0x3d')]({},_0x367688,_0x140bcd['options']);return _0xc6d9fe['getMembers'](_0x367688);}})[_0x028b('0x26')](function(_0x1388ba){if(_0x1388ba){_0x233e10=_0x1388ba[_0x028b('0x37')];if(!_0x140bcd[_0x028b('0x32')][_0x028b('0x38')]('nolimit')){_0x367688[_0x028b('0x20')]=qs[_0x028b('0x20')](_0x140bcd[_0x028b('0x32')][_0x028b('0x20')]);_0x367688[_0x028b('0x1e')]=qs[_0x028b('0x1e')](_0x140bcd[_0x028b('0x32')][_0x028b('0x1e')]);}return _0xc6d9fe[_0x028b('0x4e')](_0x367688);}})[_0x028b('0x26')](function(_0x5465f3){if(_0x5465f3){return _0x5465f3?{'count':_0x233e10,'rows':_0x5465f3}:null;}})[_0x028b('0x26')](respondWithResult(_0x2e1928,null))[_0x028b('0x44')](handleError(_0x2e1928,null));};exports[_0x028b('0x53')]=function(_0x2ef7b8,_0x38ff7c,_0x1b4cd3){return db[_0x028b('0x3f')]['find']({'where':{'id':_0x2ef7b8['params']['id']}})[_0x028b('0x26')](handleEntityNotFound(_0x38ff7c,null))[_0x028b('0x26')](function(_0x120154){if(_0x120154){return _0x120154[_0x028b('0x53')](_0x2ef7b8[_0x028b('0x32')][_0x028b('0x4d')]);}})['then'](respondWithStatusCode(_0x38ff7c,null))['catch'](handleError(_0x38ff7c,null));};exports[_0x028b('0x54')]=function(_0x508d1e,_0x28b985,_0x177b11){if(_0x508d1e['body']['id']){delete _0x508d1e[_0x028b('0x46')]['id'];}return db[_0x028b('0x3f')][_0x028b('0x47')]({'where':{'id':_0x508d1e[_0x028b('0x43')]['id']}})['then'](handleEntityNotFound(_0x28b985,null))['then'](function(_0x36a681){if(_0x36a681){_0x508d1e[_0x028b('0x46')]['ChatGroupId']=_0x36a681['id'];return db['ChatInternalMessage'][_0x028b('0x45')](_0x508d1e[_0x028b('0x46')]);}})[_0x028b('0x26')](respondWithResult(_0x28b985,null))[_0x028b('0x44')](handleError(_0x28b985,null));};exports['getMessages']=function(_0x1c54f0,_0x3328e9,_0x2d17d5){var _0x4bcbdc={};var _0x899ca8={};var _0x3c0247;var _0x2cc64a;return db[_0x028b('0x3f')]['findOne']({'where':{'id':_0x1c54f0[_0x028b('0x43')]['id']}})['then'](handleEntityNotFound(_0x3328e9,null))[_0x028b('0x26')](function(_0x1488c3){if(_0x1488c3){_0x3c0247=_0x1488c3;_0x899ca8[_0x028b('0x30')]=_[_0x028b('0x31')](db[_0x028b('0x55')][_0x028b('0x2c')]);_0x899ca8[_0x028b('0x32')]=_[_0x028b('0x31')](_0x1c54f0[_0x028b('0x32')]);_0x899ca8[_0x028b('0x33')]=_[_0x028b('0x35')](_0x899ca8[_0x028b('0x30')],_0x899ca8['query']);_0x4bcbdc[_0x028b('0x34')]=_[_0x028b('0x35')](_0x899ca8[_0x028b('0x30')],qs[_0x028b('0x36')](_0x1c54f0[_0x028b('0x32')][_0x028b('0x36')]));_0x4bcbdc['attributes']=_0x4bcbdc['attributes'][_0x028b('0x37')]?_0x4bcbdc['attributes']:_0x899ca8[_0x028b('0x30')];_0x4bcbdc['order']=qs[_0x028b('0x3a')](_0x1c54f0[_0x028b('0x32')][_0x028b('0x3a')]);_0x4bcbdc[_0x028b('0x3c')]=qs['filters'](_['pick'](_0x1c54f0['query'],_0x899ca8['filters']));if(_0x1c54f0[_0x028b('0x32')][_0x028b('0x3b')]){_0x4bcbdc['where']=_[_0x028b('0x3d')](_0x4bcbdc[_0x028b('0x3c')],{'$or':_['map'](_0x4bcbdc[_0x028b('0x34')],function(_0x4d7ca4){var _0x13b5d0={};_0x13b5d0[_0x4d7ca4]={'$like':'%'+_0x1c54f0[_0x028b('0x32')][_0x028b('0x3b')]+'%'};return _0x13b5d0;})});}if(_0x1c54f0[_0x028b('0x32')]['$gte']){var _0x50b17c=_0x1c54f0[_0x028b('0x32')][_0x028b('0x56')][_0x028b('0x57')](',');var _0x4de26e={};_0x4de26e[_0x50b17c[0x0]]={'$gte':moment(_0x50b17c[0x1])[_0x028b('0x58')](_0x028b('0x59'))};_0x4bcbdc[_0x028b('0x3c')]=_[_0x028b('0x3d')](_0x4bcbdc['where'],_0x4de26e);}_0x4bcbdc=_['merge']({},_0x4bcbdc,_0x1c54f0[_0x028b('0x5a')]);return _0x3c0247['getMessages'](_0x4bcbdc);}})[_0x028b('0x26')](function(_0x1dc66d){if(_0x1dc66d){_0x2cc64a=_0x1dc66d[_0x028b('0x37')];if(!_0x1c54f0[_0x028b('0x32')]['hasOwnProperty']('nolimit')){_0x4bcbdc[_0x028b('0x20')]=qs[_0x028b('0x20')](_0x1c54f0[_0x028b('0x32')][_0x028b('0x20')]);_0x4bcbdc[_0x028b('0x1e')]=qs[_0x028b('0x1e')](_0x1c54f0[_0x028b('0x32')][_0x028b('0x1e')]);}return _0x3c0247['getMessages'](_0x4bcbdc);}})[_0x028b('0x26')](function(_0x3b7c90){if(_0x3b7c90){return _0x3b7c90?{'count':_0x2cc64a,'rows':_0x3b7c90}:null;}})[_0x028b('0x26')](respondWithResult(_0x3328e9,null))['catch'](handleError(_0x3328e9,null));}; \ No newline at end of file +var _0x06cc=['filter','options','ChatGroup','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','find','describe','getUnread','toInteger','addMembers','omit','User','removeMembers','ids','addMessage','ChatGroupId','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL'];(function(_0x78acc5,_0x4476ec){var _0x48e518=function(_0x54811e){while(--_0x54811e){_0x78acc5['push'](_0x78acc5['shift']());}};_0x48e518(++_0x4476ec);}(_0x06cc,0x7a));var _0xc06c=function(_0x542489,_0x31ca4e){_0x542489=_0x542489-0x0;var _0x5a9384=_0x06cc[_0x542489];return _0x5a9384;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc06c('0x0'));var zipdir=require(_0xc06c('0x1'));var jsonpatch=require(_0xc06c('0x2'));var rp=require(_0xc06c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc06c('0x4'));var util=require('util');var path=require(_0xc06c('0x5'));var sox=require(_0xc06c('0x6'));var csv=require(_0xc06c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc06c('0x8'));var squel=require(_0xc06c('0x9'));var crypto=require('crypto');var jsforce=require(_0xc06c('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xc06c('0x7'));var querystring=require(_0xc06c('0xb'));var Papa=require(_0xc06c('0xc'));var Redis=require(_0xc06c('0xd'));var authService=require(_0xc06c('0xe'));var qs=require(_0xc06c('0xf'));var as=require(_0xc06c('0x10'));var hardwareService=require(_0xc06c('0x11'));var logger=require(_0xc06c('0x12'))(_0xc06c('0x13'));var utils=require(_0xc06c('0x14'));var config=require(_0xc06c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc06c('0x16'))['db'];config[_0xc06c('0x17')]=_[_0xc06c('0x18')](config[_0xc06c('0x17')],{'host':_0xc06c('0x19'),'port':0x18eb});var socket=require(_0xc06c('0x1a'))(new Redis(config['redis']));require('./chatGroup.socket')[_0xc06c('0x1b')](socket);function respondWithStatusCode(_0x4d8a34,_0x2a0d5b){_0x2a0d5b=_0x2a0d5b||0xcc;return function(_0xd0dcee){if(_0xd0dcee){return _0x4d8a34[_0xc06c('0x1c')](_0x2a0d5b);}return _0x4d8a34[_0xc06c('0x1d')](_0x2a0d5b)['end']();};}function respondWithResult(_0x432ccd,_0x36b18b){_0x36b18b=_0x36b18b||0xc8;return function(_0x1820e3){if(_0x1820e3){return _0x432ccd['status'](_0x36b18b)[_0xc06c('0x1e')](_0x1820e3);}};}function respondWithFilteredResult(_0x2d18b4,_0x233fa7){return function(_0x3348db){if(_0x3348db){var _0x42235e=typeof _0x233fa7['offset']==='undefined'&&typeof _0x233fa7[_0xc06c('0x1f')]===_0xc06c('0x20');var _0x71a73a=_0x3348db[_0xc06c('0x21')];var _0x28d3df=_0x42235e?0x0:_0x233fa7[_0xc06c('0x22')];var _0x103e27=_0x42235e?_0x3348db[_0xc06c('0x21')]:_0x233fa7['offset']+_0x233fa7[_0xc06c('0x1f')];var _0x152c7b;if(_0x103e27>=_0x71a73a){_0x103e27=_0x71a73a;_0x152c7b=0xc8;}else{_0x152c7b=0xce;}_0x2d18b4['status'](_0x152c7b);return _0x2d18b4[_0xc06c('0x23')](_0xc06c('0x24'),_0x28d3df+'-'+_0x103e27+'/'+_0x71a73a)[_0xc06c('0x1e')](_0x3348db);}return null;};}function patchUpdates(_0x17ecf9){return function(_0x615b94){try{jsonpatch['apply'](_0x615b94,_0x17ecf9,!![]);}catch(_0x557d99){return BPromise[_0xc06c('0x25')](_0x557d99);}return _0x615b94[_0xc06c('0x26')]();};}function saveUpdates(_0x5720c8,_0x50d97d){return function(_0x19c288){if(_0x19c288){return _0x19c288[_0xc06c('0x27')](_0x5720c8)[_0xc06c('0x28')](function(_0x353317){return _0x353317;});}return null;};}function removeEntity(_0x10a15a,_0x495590){return function(_0x19f637){if(_0x19f637){return _0x19f637[_0xc06c('0x29')]()['then'](function(){_0x10a15a[_0xc06c('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dd6db,_0x594511){return function(_0x335eb7){if(!_0x335eb7){_0x4dd6db[_0xc06c('0x1c')](0x194);}return _0x335eb7;};}function handleError(_0x26fb9f,_0xf8dab3){_0xf8dab3=_0xf8dab3||0x1f4;return function(_0x121199){logger[_0xc06c('0x2a')](_0x121199[_0xc06c('0x2b')]);if(_0x121199[_0xc06c('0x2c')]){delete _0x121199[_0xc06c('0x2c')];}_0x26fb9f[_0xc06c('0x1d')](_0xf8dab3)['send'](_0x121199);};}exports[_0xc06c('0x2d')]=function(_0x4835d5,_0x4fc885){var _0x249d65={},_0xda32ae={},_0x245cc8={'count':0x0,'rows':[]};var _0x377177=_['map'](db['ChatGroup']['rawAttributes'],function(_0x57ae26){return{'name':_0x57ae26[_0xc06c('0x2e')],'type':_0x57ae26['type'][_0xc06c('0x2f')]};});_0xda32ae[_0xc06c('0x30')]=_[_0xc06c('0x31')](_0x377177,_0xc06c('0x2c'));_0xda32ae['query']=_[_0xc06c('0x32')](_0x4835d5[_0xc06c('0x33')]);_0xda32ae[_0xc06c('0x34')]=_[_0xc06c('0x35')](_0xda32ae['model'],_0xda32ae[_0xc06c('0x33')]);_0x249d65[_0xc06c('0x36')]=_[_0xc06c('0x35')](_0xda32ae['model'],qs[_0xc06c('0x37')](_0x4835d5['query'][_0xc06c('0x37')]));_0x249d65[_0xc06c('0x36')]=_0x249d65[_0xc06c('0x36')][_0xc06c('0x38')]?_0x249d65['attributes']:_0xda32ae['model'];if(!_0x4835d5['query'][_0xc06c('0x39')](_0xc06c('0x3a'))){_0x249d65[_0xc06c('0x1f')]=qs[_0xc06c('0x1f')](_0x4835d5[_0xc06c('0x33')]['limit']);_0x249d65['offset']=qs[_0xc06c('0x22')](_0x4835d5[_0xc06c('0x33')][_0xc06c('0x22')]);}_0x249d65[_0xc06c('0x3b')]=qs['sort'](_0x4835d5['query'][_0xc06c('0x3c')]);_0x249d65[_0xc06c('0x3d')]=qs['filters'](_[_0xc06c('0x3e')](_0x4835d5[_0xc06c('0x33')],_0xda32ae[_0xc06c('0x34')]),_0x377177);if(_0x4835d5[_0xc06c('0x33')]['filter']){_0x249d65[_0xc06c('0x3d')]=_[_0xc06c('0x3f')](_0x249d65[_0xc06c('0x3d')],{'$or':_[_0xc06c('0x31')](_0x377177,function(_0x161a02){if(_0x161a02[_0xc06c('0x40')]!==_0xc06c('0x41')){var _0x52cad5={};_0x52cad5[_0x161a02[_0xc06c('0x2c')]]={'$like':'%'+_0x4835d5[_0xc06c('0x33')][_0xc06c('0x42')]+'%'};return _0x52cad5;}})});}_0x249d65=_['merge']({},_0x249d65,_0x4835d5[_0xc06c('0x43')]);var _0x367652={'where':_0x249d65[_0xc06c('0x3d')]};return db[_0xc06c('0x44')]['count'](_0x367652)[_0xc06c('0x28')](function(_0xee5997){_0x245cc8['count']=_0xee5997;if(_0x4835d5[_0xc06c('0x33')][_0xc06c('0x45')]){_0x249d65[_0xc06c('0x46')]=[{'all':!![]}];}return db['ChatGroup'][_0xc06c('0x47')](_0x249d65);})[_0xc06c('0x28')](function(_0x1126ac){_0x245cc8['rows']=_0x1126ac;return _0x245cc8;})[_0xc06c('0x28')](respondWithFilteredResult(_0x4fc885,_0x249d65))[_0xc06c('0x48')](handleError(_0x4fc885,null));};exports[_0xc06c('0x49')]=function(_0x507add,_0x51e0af){var _0x1ecc9c={'raw':!![],'where':{'id':_0x507add[_0xc06c('0x4a')]['id']}},_0x1e1dea={};_0x1e1dea[_0xc06c('0x30')]=_[_0xc06c('0x32')](db[_0xc06c('0x44')][_0xc06c('0x4b')]);_0x1e1dea['query']=_['keys'](_0x507add[_0xc06c('0x33')]);_0x1e1dea[_0xc06c('0x34')]=_[_0xc06c('0x35')](_0x1e1dea['model'],_0x1e1dea[_0xc06c('0x33')]);_0x1ecc9c[_0xc06c('0x36')]=_[_0xc06c('0x35')](_0x1e1dea[_0xc06c('0x30')],qs[_0xc06c('0x37')](_0x507add['query'][_0xc06c('0x37')]));_0x1ecc9c[_0xc06c('0x36')]=_0x1ecc9c[_0xc06c('0x36')][_0xc06c('0x38')]?_0x1ecc9c[_0xc06c('0x36')]:_0x1e1dea[_0xc06c('0x30')];if(_0x507add[_0xc06c('0x33')][_0xc06c('0x45')]){_0x1ecc9c[_0xc06c('0x46')]=[{'all':!![]}];}_0x1ecc9c=_['merge']({},_0x1ecc9c,_0x507add['options']);return db[_0xc06c('0x44')]['find'](_0x1ecc9c)['then'](handleEntityNotFound(_0x51e0af,null))[_0xc06c('0x28')](respondWithResult(_0x51e0af,null))[_0xc06c('0x48')](handleError(_0x51e0af,null));};exports['create']=function(_0x129375,_0x10fe22){return db[_0xc06c('0x44')][_0xc06c('0x4c')](_0x129375['body'],{})[_0xc06c('0x28')](respondWithResult(_0x10fe22,0xc9))[_0xc06c('0x48')](handleError(_0x10fe22,null));};exports[_0xc06c('0x27')]=function(_0x1f7640,_0xaed588){if(_0x1f7640['body']['id']){delete _0x1f7640[_0xc06c('0x4d')]['id'];}return db[_0xc06c('0x44')][_0xc06c('0x4e')]({'where':{'id':_0x1f7640[_0xc06c('0x4a')]['id']}})[_0xc06c('0x28')](handleEntityNotFound(_0xaed588,null))[_0xc06c('0x28')](saveUpdates(_0x1f7640['body'],null))[_0xc06c('0x28')](respondWithResult(_0xaed588,null))[_0xc06c('0x48')](handleError(_0xaed588,null));};exports[_0xc06c('0x29')]=function(_0x26633b,_0x119564){return db[_0xc06c('0x44')][_0xc06c('0x4e')]({'where':{'id':_0x26633b['params']['id']}})['then'](handleEntityNotFound(_0x119564,null))[_0xc06c('0x28')](removeEntity(_0x119564,null))[_0xc06c('0x48')](handleError(_0x119564,null));};exports[_0xc06c('0x4f')]=function(_0x41a6a1,_0x45e58a){return db[_0xc06c('0x44')]['describe']()[_0xc06c('0x28')](respondWithResult(_0x45e58a,null))[_0xc06c('0x48')](handleError(_0x45e58a,null));};exports[_0xc06c('0x50')]=function(_0x2ebf24,_0x5948ef,_0x295c73){return db['ChatInternalMessage'][_0xc06c('0x21')]({'where':{'ChatGroupId':_0x2ebf24[_0xc06c('0x4a')]['id'],'ToId':_0x2ebf24['user']['id'],'read':![]}})[_0xc06c('0x28')](function(_0x303cb3){return{'id':_[_0xc06c('0x51')](_0x2ebf24['params']['id']),'count':_0x303cb3};})[_0xc06c('0x28')](respondWithResult(_0x5948ef,null))['catch'](handleError(_0x5948ef,null));};exports[_0xc06c('0x52')]=function(_0x544d21,_0x43d449,_0x41464f){return db[_0xc06c('0x44')]['find']({'where':{'id':_0x544d21[_0xc06c('0x4a')]['id']}})[_0xc06c('0x28')](handleEntityNotFound(_0x43d449,null))[_0xc06c('0x28')](function(_0x6107d2){if(_0x6107d2){return _0x6107d2['addMembers'](_0x544d21[_0xc06c('0x4d')]['ids'],_[_0xc06c('0x53')](_0x544d21[_0xc06c('0x4d')],['ids','id'])||{});}})[_0xc06c('0x28')](respondWithResult(_0x43d449,null))['catch'](handleError(_0x43d449,null));};exports['getMembers']=function(_0x26f9a3,_0x36ed8c,_0x16ba60){var _0x3ab23d={};var _0x59be84={};var _0x5cfb3c;var _0x39614f;return db['ChatGroup']['findOne']({'where':{'id':_0x26f9a3[_0xc06c('0x4a')]['id']}})[_0xc06c('0x28')](handleEntityNotFound(_0x36ed8c,null))['then'](function(_0x4ce751){if(_0x4ce751){_0x5cfb3c=_0x4ce751;_0x59be84[_0xc06c('0x30')]=_[_0xc06c('0x32')](db[_0xc06c('0x54')][_0xc06c('0x4b')]);_0x59be84[_0xc06c('0x33')]=_[_0xc06c('0x32')](_0x26f9a3['query']);_0x59be84[_0xc06c('0x34')]=_[_0xc06c('0x35')](_0x59be84[_0xc06c('0x30')],_0x59be84[_0xc06c('0x33')]);_0x3ab23d[_0xc06c('0x36')]=_[_0xc06c('0x35')](_0x59be84[_0xc06c('0x30')],qs['fields'](_0x26f9a3[_0xc06c('0x33')][_0xc06c('0x37')]));_0x3ab23d[_0xc06c('0x36')]=_0x3ab23d[_0xc06c('0x36')][_0xc06c('0x38')]?_0x3ab23d['attributes']:_0x59be84['model'];_0x3ab23d[_0xc06c('0x3b')]=qs['sort'](_0x26f9a3[_0xc06c('0x33')]['sort']);_0x3ab23d[_0xc06c('0x3d')]=qs[_0xc06c('0x34')](_[_0xc06c('0x3e')](_0x26f9a3[_0xc06c('0x33')],_0x59be84[_0xc06c('0x34')]));if(_0x26f9a3[_0xc06c('0x33')][_0xc06c('0x42')]){_0x3ab23d['where']=_['merge'](_0x3ab23d[_0xc06c('0x3d')],{'$or':_[_0xc06c('0x31')](_0x3ab23d[_0xc06c('0x36')],function(_0x2996ac){var _0x2ba99f={};_0x2ba99f[_0x2996ac]={'$like':'%'+_0x26f9a3[_0xc06c('0x33')]['filter']+'%'};return _0x2ba99f;})});}_0x3ab23d=_[_0xc06c('0x3f')]({},_0x3ab23d,_0x26f9a3[_0xc06c('0x43')]);return _0x5cfb3c['getMembers'](_0x3ab23d);}})[_0xc06c('0x28')](function(_0xa055d4){if(_0xa055d4){_0x39614f=_0xa055d4[_0xc06c('0x38')];if(!_0x26f9a3[_0xc06c('0x33')][_0xc06c('0x39')]('nolimit')){_0x3ab23d[_0xc06c('0x1f')]=qs[_0xc06c('0x1f')](_0x26f9a3['query'][_0xc06c('0x1f')]);_0x3ab23d['offset']=qs[_0xc06c('0x22')](_0x26f9a3[_0xc06c('0x33')]['offset']);}return _0x5cfb3c['getMembers'](_0x3ab23d);}})[_0xc06c('0x28')](function(_0x5a60fd){if(_0x5a60fd){return _0x5a60fd?{'count':_0x39614f,'rows':_0x5a60fd}:null;}})[_0xc06c('0x28')](respondWithResult(_0x36ed8c,null))[_0xc06c('0x48')](handleError(_0x36ed8c,null));};exports[_0xc06c('0x55')]=function(_0x2a6f04,_0x51bff9,_0x6376a8){return db[_0xc06c('0x44')][_0xc06c('0x4e')]({'where':{'id':_0x2a6f04['params']['id']}})[_0xc06c('0x28')](handleEntityNotFound(_0x51bff9,null))['then'](function(_0x3b022e){if(_0x3b022e){return _0x3b022e['removeMembers'](_0x2a6f04[_0xc06c('0x33')][_0xc06c('0x56')]);}})[_0xc06c('0x28')](respondWithStatusCode(_0x51bff9,null))[_0xc06c('0x48')](handleError(_0x51bff9,null));};exports[_0xc06c('0x57')]=function(_0x4cdf6f,_0x1fe3d0,_0x2c6471){if(_0x4cdf6f['body']['id']){delete _0x4cdf6f['body']['id'];}return db['ChatGroup']['find']({'where':{'id':_0x4cdf6f['params']['id']}})[_0xc06c('0x28')](handleEntityNotFound(_0x1fe3d0,null))[_0xc06c('0x28')](function(_0x5b9f2a){if(_0x5b9f2a){_0x4cdf6f[_0xc06c('0x4d')][_0xc06c('0x58')]=_0x5b9f2a['id'];return db['ChatInternalMessage'][_0xc06c('0x4c')](_0x4cdf6f['body']);}})[_0xc06c('0x28')](respondWithResult(_0x1fe3d0,null))[_0xc06c('0x48')](handleError(_0x1fe3d0,null));};exports['getMessages']=function(_0x5c995b,_0xad17cc,_0x22886f){var _0x5dce78={};var _0x28b37c={};var _0x4dd5ff;var _0x52397f;return db[_0xc06c('0x44')][_0xc06c('0x59')]({'where':{'id':_0x5c995b[_0xc06c('0x4a')]['id']}})[_0xc06c('0x28')](handleEntityNotFound(_0xad17cc,null))[_0xc06c('0x28')](function(_0x547ab5){if(_0x547ab5){_0x4dd5ff=_0x547ab5;_0x28b37c[_0xc06c('0x30')]=_[_0xc06c('0x32')](db['ChatInternalMessage']['rawAttributes']);_0x28b37c[_0xc06c('0x33')]=_[_0xc06c('0x32')](_0x5c995b[_0xc06c('0x33')]);_0x28b37c[_0xc06c('0x34')]=_[_0xc06c('0x35')](_0x28b37c[_0xc06c('0x30')],_0x28b37c[_0xc06c('0x33')]);_0x5dce78[_0xc06c('0x36')]=_[_0xc06c('0x35')](_0x28b37c['model'],qs['fields'](_0x5c995b[_0xc06c('0x33')][_0xc06c('0x37')]));_0x5dce78[_0xc06c('0x36')]=_0x5dce78[_0xc06c('0x36')][_0xc06c('0x38')]?_0x5dce78['attributes']:_0x28b37c[_0xc06c('0x30')];_0x5dce78[_0xc06c('0x3b')]=qs['sort'](_0x5c995b[_0xc06c('0x33')][_0xc06c('0x3c')]);_0x5dce78[_0xc06c('0x3d')]=qs[_0xc06c('0x34')](_[_0xc06c('0x3e')](_0x5c995b[_0xc06c('0x33')],_0x28b37c[_0xc06c('0x34')]));if(_0x5c995b[_0xc06c('0x33')][_0xc06c('0x42')]){_0x5dce78[_0xc06c('0x3d')]=_[_0xc06c('0x3f')](_0x5dce78['where'],{'$or':_['map'](_0x5dce78[_0xc06c('0x36')],function(_0x429fc5){var _0x2d3121={};_0x2d3121[_0x429fc5]={'$like':'%'+_0x5c995b[_0xc06c('0x33')][_0xc06c('0x42')]+'%'};return _0x2d3121;})});}if(_0x5c995b[_0xc06c('0x33')][_0xc06c('0x5a')]){var _0x3795bf=_0x5c995b[_0xc06c('0x33')][_0xc06c('0x5a')]['split'](',');var _0x4ed7ed={};_0x4ed7ed[_0x3795bf[0x0]]={'$gte':moment(_0x3795bf[0x1])[_0xc06c('0x5b')](_0xc06c('0x5c'))};_0x5dce78[_0xc06c('0x3d')]=_[_0xc06c('0x3f')](_0x5dce78[_0xc06c('0x3d')],_0x4ed7ed);}_0x5dce78=_['merge']({},_0x5dce78,_0x5c995b['options']);return _0x4dd5ff['getMessages'](_0x5dce78);}})[_0xc06c('0x28')](function(_0x3b4102){if(_0x3b4102){_0x52397f=_0x3b4102[_0xc06c('0x38')];if(!_0x5c995b[_0xc06c('0x33')][_0xc06c('0x39')](_0xc06c('0x3a'))){_0x5dce78['limit']=qs['limit'](_0x5c995b[_0xc06c('0x33')][_0xc06c('0x1f')]);_0x5dce78['offset']=qs[_0xc06c('0x22')](_0x5c995b[_0xc06c('0x33')][_0xc06c('0x22')]);}return _0x4dd5ff[_0xc06c('0x5d')](_0x5dce78);}})['then'](function(_0x281cee){if(_0x281cee){return _0x281cee?{'count':_0x52397f,'rows':_0x281cee}:null;}})[_0xc06c('0x28')](respondWithResult(_0xad17cc,null))[_0xc06c('0x48')](handleError(_0xad17cc,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 4db91e6..3869a85 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 _0x8969=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','remove'];(function(_0x442db0,_0x19392b){var _0x328bc1=function(_0x5bb704){while(--_0x5bb704){_0x442db0['push'](_0x442db0['shift']());}};_0x328bc1(++_0x19392b);}(_0x8969,0xc2));var _0x9896=function(_0x125ea4,_0xcb917f){_0x125ea4=_0x125ea4-0x0;var _0x4e8e73=_0x8969[_0x125ea4];return _0x4e8e73;};'use strict';var EventEmitter=require(_0x9896('0x0'));var ChatGroup=require(_0x9896('0x1'))['db'][_0x9896('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x9896('0x3')](0x0);var events={'afterCreate':_0x9896('0x4'),'afterUpdate':'update','afterDestroy':_0x9896('0x5')};function emitEvent(_0x180bfa){return function(_0x1aeed5,_0x2cf7f6,_0x3d2dea){ChatGroupEvents[_0x9896('0x6')](_0x180bfa+':'+_0x1aeed5['id'],_0x1aeed5);ChatGroupEvents['emit'](_0x180bfa,_0x1aeed5);_0x3d2dea(null);};}for(var e in events){if(events[_0x9896('0x7')](e)){var event=events[e];ChatGroup[_0x9896('0x8')](e,emitEvent(event));}}module[_0x9896('0x9')]=ChatGroupEvents; \ No newline at end of file +var _0x18b2=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatGroup'];(function(_0x5f0797,_0x45b013){var _0x492b80=function(_0x589a16){while(--_0x589a16){_0x5f0797['push'](_0x5f0797['shift']());}};_0x492b80(++_0x45b013);}(_0x18b2,0x85));var _0x218b=function(_0x397c5f,_0x14417f){_0x397c5f=_0x397c5f-0x0;var _0x428686=_0x18b2[_0x397c5f];return _0x428686;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x218b('0x0'))['db'][_0x218b('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x218b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x218b('0x3'),'afterDestroy':_0x218b('0x4')};function emitEvent(_0x3f15c3){return function(_0x3ffe21,_0xb6f819,_0x452eb6){ChatGroupEvents[_0x218b('0x5')](_0x3f15c3+':'+_0x3ffe21['id'],_0x3ffe21);ChatGroupEvents[_0x218b('0x5')](_0x3f15c3,_0x3ffe21);_0x452eb6(null);};}for(var e in events){if(events[_0x218b('0x6')](e)){var event=events[e];ChatGroup[_0x218b('0x7')](e,emitEvent(event));}}module[_0x218b('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 2f9715f..66a974a 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 _0xecd8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','lodash','../../config/logger','api'];(function(_0x5d4078,_0x8da411){var _0x49fb8f=function(_0x2686cf){while(--_0x2686cf){_0x5d4078['push'](_0x5d4078['shift']());}};_0x49fb8f(++_0x8da411);}(_0xecd8,0xba));var _0x8ecd=function(_0x3ff950,_0x4cf40e){_0x3ff950=_0x3ff950-0x0;var _0x4a8799=_0xecd8[_0x3ff950];return _0x4a8799;};'use strict';var _=require(_0x8ecd('0x0'));var util=require('util');var logger=require(_0x8ecd('0x1'))(_0x8ecd('0x2'));var moment=require(_0x8ecd('0x3'));var BPromise=require(_0x8ecd('0x4'));var rp=require(_0x8ecd('0x5'));var fs=require('fs');var path=require(_0x8ecd('0x6'));var rimraf=require(_0x8ecd('0x7'));var config=require(_0x8ecd('0x8'));var attributes=require('./chatGroup.attributes');module['exports']=function(_0x54b8ad,_0x6d42dc){return _0x54b8ad['define']('ChatGroup',attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41d7=['request-promise','rimraf','../../config/environment','ChatGroup','lodash','../../config/logger','api','moment'];(function(_0x45197c,_0x3cf9cf){var _0x4f4b4d=function(_0x42db8c){while(--_0x42db8c){_0x45197c['push'](_0x45197c['shift']());}};_0x4f4b4d(++_0x3cf9cf);}(_0x41d7,0x64));var _0x741d=function(_0x5630da,_0x5048e4){_0x5630da=_0x5630da-0x0;var _0x57a6c8=_0x41d7[_0x5630da];return _0x57a6c8;};'use strict';var _=require(_0x741d('0x0'));var util=require('util');var logger=require(_0x741d('0x1'))(_0x741d('0x2'));var moment=require(_0x741d('0x3'));var BPromise=require('bluebird');var rp=require(_0x741d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x741d('0x5'));var config=require(_0x741d('0x6'));var attributes=require('./chatGroup.attributes');module['exports']=function(_0x2fb76f,_0x55ea13){return _0x2fb76f['define'](_0x741d('0x7'),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 a0a4ef8..c172f70 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 _0xbbb8=['client','http','redis','socket.io-emitter','./chatGroup.socket','register','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4bd049,_0x4e3176){var _0x1478d2=function(_0x1b5480){while(--_0x1b5480){_0x4bd049['push'](_0x4bd049['shift']());}};_0x1478d2(++_0x4e3176);}(_0xbbb8,0x7d));var _0x8bbb=function(_0x1c136e,_0x451288){_0x1c136e=_0x1c136e-0x0;var _0x4754c5=_0xbbb8[_0x1c136e];return _0x4754c5;};'use strict';var _=require(_0x8bbb('0x0'));var util=require(_0x8bbb('0x1'));var moment=require('moment');var BPromise=require(_0x8bbb('0x2'));var rs=require(_0x8bbb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8bbb('0x4'))['db'];var utils=require(_0x8bbb('0x5'));var logger=require(_0x8bbb('0x6'))(_0x8bbb('0x7'));var config=require(_0x8bbb('0x8'));var jayson=require(_0x8bbb('0x9'));var client=jayson[_0x8bbb('0xa')][_0x8bbb('0xb')]({'port':0x232a});config[_0x8bbb('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8bbb('0xd'))(new Redis(config[_0x8bbb('0xc')]));require(_0x8bbb('0xe'))[_0x8bbb('0xf')](socket);function respondWithRpcPromise(_0x95e93a,_0x45e1bd,_0x1c220e){return new BPromise(function(_0x3f571f,_0x598827){return client[_0x8bbb('0x10')](_0x95e93a,_0x1c220e)[_0x8bbb('0x11')](function(_0x37ce77){logger['info'](_0x8bbb('0x12'),_0x45e1bd,_0x8bbb('0x13'));logger[_0x8bbb('0x14')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x45e1bd,_0x8bbb('0x13'),JSON[_0x8bbb('0x15')](_0x37ce77));if(_0x37ce77[_0x8bbb('0x16')]){if(_0x37ce77[_0x8bbb('0x16')]['code']===0x1f4){logger[_0x8bbb('0x16')](_0x8bbb('0x12'),_0x45e1bd,_0x37ce77['error'][_0x8bbb('0x17')]);return _0x598827(_0x37ce77[_0x8bbb('0x16')][_0x8bbb('0x17')]);}logger[_0x8bbb('0x16')](_0x8bbb('0x12'),_0x45e1bd,_0x37ce77[_0x8bbb('0x16')][_0x8bbb('0x17')]);return _0x3f571f(_0x37ce77[_0x8bbb('0x16')][_0x8bbb('0x17')]);}else{logger[_0x8bbb('0x18')](_0x8bbb('0x12'),_0x45e1bd,_0x8bbb('0x13'));_0x3f571f(_0x37ce77[_0x8bbb('0x19')]['message']);}})[_0x8bbb('0x1a')](function(_0x28e52a){logger[_0x8bbb('0x16')](_0x8bbb('0x12'),_0x45e1bd,_0x28e52a);_0x598827(_0x28e52a);});});} \ No newline at end of file +var _0xad86=['ChatGroup,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','./chatGroup.socket','register','request','then','request\x20sent','debug','error','message'];(function(_0x37d229,_0x4ae448){var _0x3a0998=function(_0x10c7fe){while(--_0x10c7fe){_0x37d229['push'](_0x37d229['shift']());}};_0x3a0998(++_0x4ae448);}(_0xad86,0x194));var _0x6ad8=function(_0x2d6f08,_0x1188de){_0x2d6f08=_0x2d6f08-0x0;var _0x110194=_0xad86[_0x2d6f08];return _0x110194;};'use strict';var _=require(_0x6ad8('0x0'));var util=require(_0x6ad8('0x1'));var moment=require(_0x6ad8('0x2'));var BPromise=require(_0x6ad8('0x3'));var rs=require(_0x6ad8('0x4'));var fs=require('fs');var Redis=require(_0x6ad8('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6ad8('0x6'))(_0x6ad8('0x7'));var config=require(_0x6ad8('0x8'));var jayson=require(_0x6ad8('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x6ad8('0xa')]=_[_0x6ad8('0xb')](config[_0x6ad8('0xa')],{'host':_0x6ad8('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6ad8('0xd'))[_0x6ad8('0xe')](socket);function respondWithRpcPromise(_0x3a9cae,_0x1c04bc,_0x355abf){return new BPromise(function(_0x3a6b94,_0x41332f){return client[_0x6ad8('0xf')](_0x3a9cae,_0x355abf)[_0x6ad8('0x10')](function(_0x5ca991){logger['info']('ChatGroup,\x20%s,\x20%s',_0x1c04bc,_0x6ad8('0x11'));logger[_0x6ad8('0x12')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x1c04bc,_0x6ad8('0x11'),JSON['stringify'](_0x5ca991));if(_0x5ca991[_0x6ad8('0x13')]){if(_0x5ca991[_0x6ad8('0x13')]['code']===0x1f4){logger[_0x6ad8('0x13')]('ChatGroup,\x20%s,\x20%s',_0x1c04bc,_0x5ca991[_0x6ad8('0x13')][_0x6ad8('0x14')]);return _0x41332f(_0x5ca991[_0x6ad8('0x13')][_0x6ad8('0x14')]);}logger['error'](_0x6ad8('0x15'),_0x1c04bc,_0x5ca991[_0x6ad8('0x13')][_0x6ad8('0x14')]);return _0x3a6b94(_0x5ca991[_0x6ad8('0x13')]['message']);}else{logger[_0x6ad8('0x16')](_0x6ad8('0x15'),_0x1c04bc,'request\x20sent');_0x3a6b94(_0x5ca991[_0x6ad8('0x17')]['message']);}})[_0x6ad8('0x18')](function(_0x157fa2){logger[_0x6ad8('0x13')](_0x6ad8('0x15'),_0x1c04bc,_0x157fa2);_0x41332f(_0x157fa2);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 5fb8e71..70edd09 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 _0x3630=['emit','removeListener','register','length','remove','update'];(function(_0x24a8e7,_0x417bae){var _0x470122=function(_0x394d36){while(--_0x394d36){_0x24a8e7['push'](_0x24a8e7['shift']());}};_0x470122(++_0x417bae);}(_0x3630,0x178));var _0x0363=function(_0x41cd5b,_0x382a0c){_0x41cd5b=_0x41cd5b-0x0;var _0x340594=_0x3630[_0x41cd5b];return _0x340594;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=['save',_0x0363('0x0'),_0x0363('0x1')];function createListener(_0x695bd1,_0x4cf97f){return function(_0x58c934){_0x4cf97f[_0x0363('0x2')](_0x695bd1,_0x58c934);};}function removeListener(_0x2f1160,_0x13379f){return function(){ChatGroupEvents[_0x0363('0x3')](_0x2f1160,_0x13379f);};}exports[_0x0363('0x4')]=function(_0x4d615e){for(var _0x3ea921=0x0,_0x5ca843=events[_0x0363('0x5')];_0x3ea921<_0x5ca843;_0x3ea921++){var _0x401d08=events[_0x3ea921];var _0x59ea7d=createListener('chatGroup:'+_0x401d08,_0x4d615e);ChatGroupEvents['on'](_0x401d08,_0x59ea7d);}}; \ No newline at end of file +var _0x573d=['update','emit','removeListener','register','length','save','remove'];(function(_0x3cec21,_0x4d3a61){var _0x58a1a7=function(_0x2493b6){while(--_0x2493b6){_0x3cec21['push'](_0x3cec21['shift']());}};_0x58a1a7(++_0x4d3a61);}(_0x573d,0xde));var _0xd573=function(_0x2747dd,_0x654451){_0x2747dd=_0x2747dd-0x0;var _0x56bd31=_0x573d[_0x2747dd];return _0x56bd31;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xd573('0x0'),_0xd573('0x1'),_0xd573('0x2')];function createListener(_0x170835,_0x3429e0){return function(_0x511b5f){_0x3429e0[_0xd573('0x3')](_0x170835,_0x511b5f);};}function removeListener(_0x4cb819,_0x353d50){return function(){ChatGroupEvents[_0xd573('0x4')](_0x4cb819,_0x353d50);};}exports[_0xd573('0x5')]=function(_0x392460){for(var _0x4a6d75=0x0,_0x132e26=events[_0xd573('0x6')];_0x4a6d75<_0x132e26;_0x4a6d75++){var _0x3d2179=events[_0x4a6d75];var _0x39c21b=createListener('chatGroup:'+_0x3d2179,_0x392460);ChatGroupEvents['on'](_0x3d2179,_0x39c21b);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 8475e17..e293093 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 _0x1259=['Router','fs-extra','../../components/auth/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','/:id/messages','post','addMessage','put','update','destroy','removeMembers','connect-timeout'];(function(_0x2f9854,_0x23b8bb){var _0x3be4df=function(_0x47187c){while(--_0x47187c){_0x2f9854['push'](_0x2f9854['shift']());}};_0x3be4df(++_0x23b8bb);}(_0x1259,0xfc));var _0x9125=function(_0x360581,_0x208bdc){_0x360581=_0x360581-0x0;var _0x3c0f5c=_0x1259[_0x360581];return _0x3c0f5c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x9125('0x0'));var express=require('express');var router=express[_0x9125('0x1')]();var fs_extra=require(_0x9125('0x2'));var auth=require(_0x9125('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9125('0x4'));var controller=require(_0x9125('0x5'));router['get']('/',auth[_0x9125('0x6')](),controller[_0x9125('0x7')]);router[_0x9125('0x8')](_0x9125('0x9'),auth[_0x9125('0x6')](),controller[_0x9125('0xa')]);router[_0x9125('0x8')](_0x9125('0xb'),auth[_0x9125('0x6')](),controller[_0x9125('0xc')]);router[_0x9125('0x8')](_0x9125('0xd'),auth[_0x9125('0x6')](),controller[_0x9125('0xe')]);router[_0x9125('0x8')](_0x9125('0xf'),auth[_0x9125('0x6')](),controller['getMembers']);router[_0x9125('0x8')](_0x9125('0x10'),auth[_0x9125('0x6')](),controller['getMessages']);router[_0x9125('0x11')]('/',auth[_0x9125('0x6')](),controller['create']);router['post'](_0x9125('0xf'),auth[_0x9125('0x6')](),controller['addMembers']);router['post'](_0x9125('0x10'),auth[_0x9125('0x6')](),controller[_0x9125('0x12')]);router[_0x9125('0x13')](_0x9125('0xb'),auth[_0x9125('0x6')](),controller[_0x9125('0x14')]);router['delete'](_0x9125('0xb'),auth['isAuthenticated'](),controller[_0x9125('0x15')]);router['delete'](_0x9125('0xf'),auth[_0x9125('0x6')](),controller[_0x9125('0x16')]);module['exports']=router; \ No newline at end of file +var _0xae0a=['get','index','isAuthenticated','describe','/:id','show','/:id/unread','/:id/members','getMembers','/:id/messages','create','addMembers','post','update','delete','destroy','removeMembers','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./chatGroup.controller'];(function(_0x5b253b,_0x2fa0d0){var _0x43ad95=function(_0x3ae9c1){while(--_0x3ae9c1){_0x5b253b['push'](_0x5b253b['shift']());}};_0x43ad95(++_0x2fa0d0);}(_0xae0a,0xfc));var _0xaae0=function(_0x57d163,_0x399f10){_0x57d163=_0x57d163-0x0;var _0x269b63=_0xae0a[_0x57d163];return _0x269b63;};'use strict';var multer=require('multer');var util=require(_0xaae0('0x0'));var path=require(_0xaae0('0x1'));var timeout=require(_0xaae0('0x2'));var express=require(_0xaae0('0x3'));var router=express['Router']();var fs_extra=require(_0xaae0('0x4'));var auth=require(_0xaae0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaae0('0x6'));var controller=require(_0xaae0('0x7'));router[_0xaae0('0x8')]('/',auth['isAuthenticated'](),controller[_0xaae0('0x9')]);router[_0xaae0('0x8')]('/describe',auth[_0xaae0('0xa')](),controller[_0xaae0('0xb')]);router[_0xaae0('0x8')](_0xaae0('0xc'),auth[_0xaae0('0xa')](),controller[_0xaae0('0xd')]);router['get'](_0xaae0('0xe'),auth[_0xaae0('0xa')](),controller['getUnread']);router[_0xaae0('0x8')](_0xaae0('0xf'),auth['isAuthenticated'](),controller[_0xaae0('0x10')]);router[_0xaae0('0x8')](_0xaae0('0x11'),auth['isAuthenticated'](),controller['getMessages']);router['post']('/',auth[_0xaae0('0xa')](),controller[_0xaae0('0x12')]);router['post'](_0xaae0('0xf'),auth[_0xaae0('0xa')](),controller[_0xaae0('0x13')]);router[_0xaae0('0x14')](_0xaae0('0x11'),auth[_0xaae0('0xa')](),controller['addMessage']);router['put']('/:id',auth[_0xaae0('0xa')](),controller[_0xaae0('0x15')]);router[_0xaae0('0x16')](_0xaae0('0xc'),auth[_0xaae0('0xa')](),controller[_0xaae0('0x17')]);router['delete'](_0xaae0('0xf'),auth[_0xaae0('0xa')](),controller[_0xaae0('0x18')]);module[_0xaae0('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index ee1bf91..54dfe3c 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 _0x236c=['long','sequelize','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE'];(function(_0x3c0e33,_0x4e9903){var _0x48d10c=function(_0x227823){while(--_0x227823){_0x3c0e33['push'](_0x3c0e33['shift']());}};_0x48d10c(++_0x4e9903);}(_0x236c,0x155));var _0xc236=function(_0x55d351,_0x209cb9){_0x55d351=_0x55d351-0x0;var _0x3a75bd=_0x236c[_0x55d351];return _0x3a75bd;};'use strict';var Sequelize=require(_0xc236('0x0'));module['exports']={'closed':{'type':Sequelize[_0xc236('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xc236('0x2')]},'ratingType':{'type':Sequelize[_0xc236('0x3')](_0xc236('0x4'),_0xc236('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xc236('0x6')]},'pathTranscript':{'type':Sequelize[_0xc236('0x6')]},'mailTranscript':{'type':Sequelize[_0xc236('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xc236('0x8')]},'disposition':{'type':Sequelize[_0xc236('0x7')]},'secondDisposition':{'type':Sequelize[_0xc236('0x7')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xc236('0x7')]},'browserName':{'type':Sequelize[_0xc236('0x7')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xc236('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xc236('0x7')]},'referer':{'type':Sequelize[_0xc236('0x6')]},'customerIp':{'type':Sequelize[_0xc236('0x7')]},'formData':{'type':Sequelize[_0xc236('0x6')](_0xc236('0x9'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0xc236('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xc236('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xc236('0x7')]},'customerPort':{'type':Sequelize[_0xc236('0x7')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0xc236('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x4fad=['TEXT','STRING','DATE','long','out','sequelize','exports','BOOLEAN','ENUM','star','thumb'];(function(_0x5e2474,_0x3dde05){var _0x4208ca=function(_0x27a93f){while(--_0x27a93f){_0x5e2474['push'](_0x5e2474['shift']());}};_0x4208ca(++_0x3dde05);}(_0x4fad,0xcb));var _0xd4fa=function(_0xe3103c,_0x2297e1){_0xe3103c=_0xe3103c-0x0;var _0x1dccb8=_0x4fad[_0xe3103c];return _0x1dccb8;};'use strict';var Sequelize=require(_0xd4fa('0x0'));module[_0xd4fa('0x1')]={'closed':{'type':Sequelize[_0xd4fa('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xd4fa('0x3')](_0xd4fa('0x4'),_0xd4fa('0x5')),'defaultValue':_0xd4fa('0x4')},'ratingMessage':{'type':Sequelize[_0xd4fa('0x6')]},'pathTranscript':{'type':Sequelize[_0xd4fa('0x6')]},'mailTranscript':{'type':Sequelize[_0xd4fa('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xd4fa('0x8')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xd4fa('0x7')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xd4fa('0x7')]},'browserName':{'type':Sequelize[_0xd4fa('0x7')]},'browserVersion':{'type':Sequelize[_0xd4fa('0x7')]},'osName':{'type':Sequelize[_0xd4fa('0x7')]},'osVersion':{'type':Sequelize[_0xd4fa('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xd4fa('0x7')]},'deviceType':{'type':Sequelize[_0xd4fa('0x7')]},'referer':{'type':Sequelize[_0xd4fa('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xd4fa('0x6')](_0xd4fa('0x9'))},'read1stAt':{'type':Sequelize[_0xd4fa('0x8')]},'lastMsgAt':{'type':Sequelize[_0xd4fa('0x8')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xd4fa('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xd4fa('0x7')]},'customerPort':{'type':Sequelize[_0xd4fa('0x7')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0xd4fa('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 3d0fdcd..861706c 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 _0x9ffd=['MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','agent','getChatWebsites','isEmpty','i.ChatWebsiteId\x20IS\x20NULL','role','sequelize','keyBy','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','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.ChatInteractionId\x20IN\x20?','groupBy','params','includeAll','find','destroy','describe','createVidaooSession','findOne','ChatWebsite','vidaooNote','vidaooApiKey','vidaooEscalation','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','vidaooMetadata','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','create','updateAttributes','customUpdate','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','abandon','attachmentUpload','file','originalname','basename','filename','Attachment','attachmentDownload','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','%s%d','agentAlias','System','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','addMessage','ids','omit','getMessages','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','secret','include','includeAgent','push','setTags','spread','Tag','emit','chatInteractionTags:save','removeTags','unix','tmp','server','files','CmContact','firstName','attachments','Account','Owner','get','mkdirSync','Chat','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','lastName','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','stack','name','render','merge','body','contact','account','Users','fullname','Tags','TagIds','split','forEach','index','ChatInteraction','rawAttributes','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','select','field','color','from','left_join','u.id\x20=\x20ui.UserId','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','parseSearch','search','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','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','start','compact','ChatWebsiteId','where','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x394bee,_0x5a98c5){_0x394bee=_0x394bee-0x0;var _0x228b1d=_0x9ffd[_0x394bee];return _0x228b1d;};'use strict';var emlformat=require(_0xd9ff('0x0'));var rimraf=require(_0xd9ff('0x1'));var zipdir=require(_0xd9ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9ff('0x3'));var moment=require(_0xd9ff('0x4'));var BPromise=require(_0xd9ff('0x5'));var Mustache=require(_0xd9ff('0x6'));var util=require('util');var path=require(_0xd9ff('0x7'));var sox=require(_0xd9ff('0x8'));var csv=require('to-csv');var ejs=require(_0xd9ff('0x9'));var fs=require('fs');var fs_extra=require(_0xd9ff('0xa'));var _=require(_0xd9ff('0xb'));var squel=require(_0xd9ff('0xc'));var crypto=require(_0xd9ff('0xd'));var jsforce=require(_0xd9ff('0xe'));var deskjs=require(_0xd9ff('0xf'));var toCsv=require(_0xd9ff('0x10'));var querystring=require(_0xd9ff('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd9ff('0x12'));var pdf=require(_0xd9ff('0x13'));var hardwareService=require(_0xd9ff('0x14'));var logger=require(_0xd9ff('0x15'))(_0xd9ff('0x16'));var utils=require(_0xd9ff('0x17'));var config=require(_0xd9ff('0x18'));var licenseUtil=require(_0xd9ff('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xd9ff('0x1a')](config[_0xd9ff('0x1b')],{'host':_0xd9ff('0x1c'),'port':0x18eb});var socket=require(_0xd9ff('0x1d'))(new Redis(config[_0xd9ff('0x1b')]));require('./chatInteraction.socket')[_0xd9ff('0x1e')](socket);var jayson=require(_0xd9ff('0x1f'));var client=jayson['client'][_0xd9ff('0x20')]({'port':0x232b});var client9004=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x547e28,_0x4c5718,_0x271287,_0x4f9d6d){return new BPromise(function(_0x35679e,_0xa30fd2){var _0x39c6ce=_0x4f9d6d||client;return _0x39c6ce[_0xd9ff('0x21')](_0x547e28,_0x271287)[_0xd9ff('0x22')](function(_0x2d4df1){logger[_0xd9ff('0x23')](_0xd9ff('0x24'),_0x4c5718,_0xd9ff('0x25'));logger[_0xd9ff('0x26')](_0xd9ff('0x27'),_0x4c5718,_0xd9ff('0x25'),JSON[_0xd9ff('0x28')](_0x2d4df1));if(_0x2d4df1['error']){if(_0x2d4df1['error'][_0xd9ff('0x29')]===0x1f4){logger[_0xd9ff('0x2a')]('ChatInteraction,\x20%s,\x20%s',_0x4c5718,_0x2d4df1['error']['message']);return _0xa30fd2(_0x2d4df1['error'][_0xd9ff('0x2b')]);}logger['error'](_0xd9ff('0x24'),_0x4c5718,_0x2d4df1[_0xd9ff('0x2a')][_0xd9ff('0x2b')]);return _0x35679e(_0x2d4df1[_0xd9ff('0x2a')][_0xd9ff('0x2b')]);}else{logger[_0xd9ff('0x23')]('ChatInteraction,\x20%s,\x20%s',_0x4c5718,'request\x20sent');_0x35679e(_0x2d4df1[_0xd9ff('0x2c')]['message']);}})[_0xd9ff('0x2d')](function(_0x4d86fe){logger[_0xd9ff('0x2a')]('ChatInteraction,\x20%s,\x20%s',_0x4c5718,_0x4d86fe);_0xa30fd2(_0x4d86fe);});});}function respondWithStatusCode(_0x10cbdd,_0x159e56){_0x159e56=_0x159e56||0xcc;return function(_0x2138b4){if(_0x2138b4){return _0x10cbdd[_0xd9ff('0x2e')](_0x159e56);}return _0x10cbdd['status'](_0x159e56)[_0xd9ff('0x2f')]();};}function respondWithResult(_0xe11f88,_0x1c78c4){_0x1c78c4=_0x1c78c4||0xc8;return function(_0x4390f7){if(_0x4390f7){return _0xe11f88['status'](_0x1c78c4)[_0xd9ff('0x30')](_0x4390f7);}};}function respondWithFilteredResult(_0x3792d9,_0x44b5a7){return function(_0x45fb63){if(_0x45fb63){var _0x263d3a=typeof _0x44b5a7[_0xd9ff('0x31')]===_0xd9ff('0x32')&&typeof _0x44b5a7[_0xd9ff('0x33')]===_0xd9ff('0x32');var _0x5706cf=_0x45fb63[_0xd9ff('0x34')];var _0x4ba2be=_0x263d3a?0x0:_0x44b5a7[_0xd9ff('0x31')];var _0x29c532=_0x263d3a?_0x45fb63[_0xd9ff('0x34')]:_0x44b5a7['offset']+_0x44b5a7[_0xd9ff('0x33')];var _0x3b26da;if(_0x29c532>=_0x5706cf){_0x29c532=_0x5706cf;_0x3b26da=0xc8;}else{_0x3b26da=0xce;}_0x3792d9[_0xd9ff('0x35')](_0x3b26da);return _0x3792d9[_0xd9ff('0x36')]('Content-Range',_0x4ba2be+'-'+_0x29c532+'/'+_0x5706cf)[_0xd9ff('0x30')](_0x45fb63);}return null;};}function patchUpdates(_0x5743de){return function(_0x18c28b){try{jsonpatch[_0xd9ff('0x37')](_0x18c28b,_0x5743de,!![]);}catch(_0x323cb5){return BPromise[_0xd9ff('0x38')](_0x323cb5);}return _0x18c28b[_0xd9ff('0x39')]();};}function saveUpdates(_0xdf3947,_0x2cc2ae){return function(_0x281c7b){if(_0x281c7b){return _0x281c7b[_0xd9ff('0x3a')](_0xdf3947)[_0xd9ff('0x22')](function(_0x4813a5){return _0x4813a5;});}return null;};}function removeEntity(_0x34e9a9,_0x4670e4){return function(_0x66f4d){if(_0x66f4d){return _0x66f4d['destroy']()[_0xd9ff('0x22')](function(){_0x34e9a9[_0xd9ff('0x35')](0xcc)[_0xd9ff('0x2f')]();});}};}function handleEntityNotFound(_0x4ab10f,_0x3d449d){return function(_0x5e3ff9){if(!_0x5e3ff9){_0x4ab10f[_0xd9ff('0x2e')](0x194);}return _0x5e3ff9;};}function handleError(_0x4ae56b,_0x20a021){_0x20a021=_0x20a021||0x1f4;return function(_0x5db498){logger[_0xd9ff('0x2a')](_0x5db498[_0xd9ff('0x3b')]);if(_0x5db498[_0xd9ff('0x3c')]){delete _0x5db498['name'];}_0x4ae56b['status'](_0x20a021)['send'](_0x5db498);};}function getMustacheRender(_0x7ac3d1,_0x30fc5b){return Mustache[_0xd9ff('0x3d')](_0x7ac3d1,_[_0xd9ff('0x3e')](_0x30fc5b[_0xd9ff('0x3f')],{'contact':_0x30fc5b[_0xd9ff('0x40')],'message':_0x30fc5b['message'],'agent':_0x30fc5b['agent'],'interaction':_0x30fc5b['interaction'],'account':_0x30fc5b[_0xd9ff('0x41')]}))||'';}function getInteractionUsers(_0x252edc,_0x918c9a){return new BPromise(function(_0x32adae,_0x56b94d){try{if(_0x918c9a[_0x252edc['id']]){_0x252edc[_0xd9ff('0x42')]=_['map'](_0x918c9a[_0x252edc['id']],function(_0x3cff52){return{'id':_0x3cff52['id'],'fullname':_0x3cff52[_0xd9ff('0x43')]};});}}catch(_0x1bedaf){_0x56b94d(_0x1bedaf);}_0x32adae(_0x252edc);});}function getInteractionTags(_0x169dc7,_0x59fc07){return new BPromise(function(_0x1e34da,_0x2d4d97){try{if(_0x169dc7['TagIds']){_0x169dc7[_0xd9ff('0x44')]=[];_0x169dc7[_0xd9ff('0x45')][_0xd9ff('0x46')](',')[_0xd9ff('0x47')](function(_0x1fe44d){_0x169dc7[_0xd9ff('0x44')]['push'](_0x59fc07[_0x1fe44d]);});}delete _0x169dc7[_0xd9ff('0x45')];}catch(_0x116f28){_0x2d4d97(_0x116f28);}_0x1e34da(_0x169dc7);});}function updateChatInteraction(_0x10533a,_0x39fbbb,_0x472724){return new BPromise(function(_0x52aab8,_0x3178cd){return getInteractionUsers(_0x10533a,_0x472724)[_0xd9ff('0x22')](function(_0xe0bc49){return getInteractionTags(_0xe0bc49,_0x39fbbb);})['then'](function(_0x5d06dd){_0x52aab8(_0x5d06dd);})[_0xd9ff('0x2d')](function(_0x7eb1a){_0x3178cd(_0x7eb1a);});});}exports[_0xd9ff('0x48')]=function(_0x2dfb8f,_0x437561){var _0x30c69d={},_0x564ef4={},_0xd64585={'count':0x0,'rows':[]};var _0x2d3013=_['map'](db[_0xd9ff('0x49')][_0xd9ff('0x4a')],function(_0x13a1ec){return{'name':_0x13a1ec[_0xd9ff('0x4b')],'type':_0x13a1ec[_0xd9ff('0x4c')]['key']};});_0x564ef4['model']=_['map'](_0x2d3013,_0xd9ff('0x3c'));_0x564ef4['query']=_[_0xd9ff('0x4d')](_0x2dfb8f[_0xd9ff('0x4e')]);_0x564ef4[_0xd9ff('0x4f')]=_['intersection'](_0x564ef4[_0xd9ff('0x50')],_0x564ef4[_0xd9ff('0x4e')]);_0x30c69d['attributes']=_[_0xd9ff('0x51')](_0x564ef4[_0xd9ff('0x50')],qs[_0xd9ff('0x52')](_0x2dfb8f[_0xd9ff('0x4e')]['fields']));_0x30c69d[_0xd9ff('0x53')]=_0x30c69d['attributes'][_0xd9ff('0x54')]?_0x30c69d['attributes']:_0x564ef4[_0xd9ff('0x50')];if(!_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x55')](_0xd9ff('0x56'))){_0x30c69d[_0xd9ff('0x33')]=qs['limit'](_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x33')]);_0x30c69d[_0xd9ff('0x31')]=qs[_0xd9ff('0x31')](_0x2dfb8f['query']['offset']);}_0x30c69d['order']=qs[_0xd9ff('0x57')](_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x57')]);_0x30c69d['where']=qs[_0xd9ff('0x4f')](_[_0xd9ff('0x58')](_0x2dfb8f[_0xd9ff('0x4e')],_0x564ef4[_0xd9ff('0x4f')]),_0x2d3013);var _0xfede73=[];var _0x40d391=squel[_0xd9ff('0x59')]()[_0xd9ff('0x5a')]('id')[_0xd9ff('0x5a')](_0xd9ff('0x3c'))[_0xd9ff('0x5a')](_0xd9ff('0x5b'))[_0xd9ff('0x5c')]('tools_tags');var _0x3ed112=squel['select']()[_0xd9ff('0x5a')]('u.id')[_0xd9ff('0x5a')]('u.fullname')[_0xd9ff('0x5a')]('ui.ChatInteractionId')[_0xd9ff('0x5c')]('user_has_chat_interactions','ui')[_0xd9ff('0x5d')]('users','u',_0xd9ff('0x5e'));var _0x5da1a8=squel[_0xd9ff('0x59')]()[_0xd9ff('0x5c')](_0xd9ff('0x5f'),'i')[_0xd9ff('0x5d')]('cm_contacts','c',_0xd9ff('0x60'))[_0xd9ff('0x5d')](_0xd9ff('0x61'),'o','o.id\x20=\x20i.UserId')[_0xd9ff('0x5d')](_0xd9ff('0x62'),'a',_0xd9ff('0x63'))[_0xd9ff('0x5d')](_0xd9ff('0x64'),'me','me.ChatInteractionId\x20=\x20i.id')[_0xd9ff('0x5d')](_0xd9ff('0x65'),'it',_0xd9ff('0x66'))[_0xd9ff('0x5d')](_0xd9ff('0x67'),'t',_0xd9ff('0x68'));var _0x458fd4=squel['expr']();var _0x3be850=[];var _0x11251f=squel['expr']();var _0x1c885f;if(_0x2dfb8f[_0xd9ff('0x4e')]['search']){_0x1c885f=as[_0xd9ff('0x69')](_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x6a')]);var _0x54ea27=_0x1c885f['sqlOperator'];for(var _0x39473e=0x0;_0x39473e<_0x1c885f['conditions'][_0xd9ff('0x54')];_0x39473e++){var _0x1e4d0c=_0x1c885f[_0xd9ff('0x6b')][_0x39473e];var _0x102aea='i';var _0x53a230=_['find'](_0x2d3013,['name',_0x1e4d0c[_0xd9ff('0x5a')]]);if(!_0x53a230){switch(_0x1e4d0c[_0xd9ff('0x5a')]){case _0xd9ff('0x6c'):if(_0x1e4d0c[_0xd9ff('0x6d')]==0x1){_0x5da1a8[_0xd9ff('0x6e')]('`'+_0x1e4d0c['field']+_0xd9ff('0x6f'));}else{_0x5da1a8['having']('`'+_0x1e4d0c[_0xd9ff('0x5a')]+_0xd9ff('0x70'));}break;case _0xd9ff('0x71'):if(_0x1e4d0c[_0xd9ff('0x72')]===_0xd9ff('0x73')){if(_0x1e4d0c[_0xd9ff('0x6d')][_0xd9ff('0x46')]('\x20')[_0xd9ff('0x54')]>0x1){_0x458fd4[_0x54ea27]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd9ff('0x74')](_0x1e4d0c[_0xd9ff('0x6d')]),null);}else{var _0x4f5338='%'+_0x1e4d0c['value']+'%';_0x458fd4[_0x54ea27](_0xd9ff('0x75'),_0x4f5338,_0x4f5338,_0x4f5338);}}else{_0x53a230=_['find'](_0x2d3013,[_0xd9ff('0x3c'),_0xd9ff('0x76')]);_0x1e4d0c['field']=_0xd9ff('0x76');_0x58c9c2=as[_0xd9ff('0x77')](_0x102aea,_0x53a230[_0xd9ff('0x4c')],_0x1e4d0c);_0x458fd4[_0x54ea27](_0x58c9c2[_0xd9ff('0x78')],_0x58c9c2[_0xd9ff('0x6d')]['start'],_0x58c9c2[_0xd9ff('0x6d')]['end']);}break;case'Tag':var _0x3dabb1=_0x1e4d0c[_0xd9ff('0x6d')][_0xd9ff('0x46')](',')[_0xd9ff('0x79')](function(_0x56d822){return Number(_0x56d822);});_0x3dabb1[_0xd9ff('0x47')](function(_0x23b816){_0x11251f['or'](_0xd9ff('0x7a'),'%,'+_0x23b816+',%');});_0x3be850=_[_0xd9ff('0x7b')](_0x3be850,_0x3dabb1);break;case _0xd9ff('0x7c'):if(_0x1e4d0c[_0xd9ff('0x72')]===_0xd9ff('0x73')){_0x458fd4[_0x54ea27](_0xd9ff('0x7d'),'%'+_0x1e4d0c['value']+'%',null);}else{_0x53a230=_['find'](_0x2d3013,['name',_0xd9ff('0x7e')]);_0x1e4d0c[_0xd9ff('0x5a')]='UserId';_0x58c9c2=as[_0xd9ff('0x77')](_0x102aea,_0x53a230[_0xd9ff('0x4c')],_0x1e4d0c);_0x458fd4[_0x54ea27](_0x58c9c2[_0xd9ff('0x78')],_0x58c9c2[_0xd9ff('0x6d')][_0xd9ff('0x7f')],_0x58c9c2[_0xd9ff('0x6d')][_0xd9ff('0x2f')]);}break;case _0xd9ff('0x3f'):_0x58c9c2=as['buildExpression']('me',null,_0x1e4d0c);_0x458fd4[_0x54ea27](_0x58c9c2[_0xd9ff('0x78')],_0x58c9c2[_0xd9ff('0x6d')][_0xd9ff('0x7f')],_0x58c9c2['value'][_0xd9ff('0x2f')]);break;}}else{var _0x58c9c2=as[_0xd9ff('0x77')](_0x102aea,_0x53a230[_0xd9ff('0x4c')],_0x1e4d0c);_0x458fd4[_0x54ea27](_0x58c9c2[_0xd9ff('0x78')],_0x58c9c2['value'][_0xd9ff('0x7f')],_0x58c9c2[_0xd9ff('0x6d')][_0xd9ff('0x2f')]);}}}else{var _0x1cd620=_(_0x2dfb8f['query'])[_0xd9ff('0x4d')]()[_0xd9ff('0x79')](function(_0x1de5c9){return _['some'](_0x2d3013,[_0xd9ff('0x3c'),_0x1de5c9])?_0x1de5c9:undefined;})[_0xd9ff('0x80')]()[_0xd9ff('0x6d')]();if(!_['isEmpty'](_0x1cd620)){_0x1cd620[_0xd9ff('0x47')](function(_0x35926f){if(_0x35926f===_0xd9ff('0x81')){_0x5da1a8[_0xd9ff('0x82')](_0xd9ff('0x83'),[]['concat'](_0x2dfb8f[_0xd9ff('0x4e')][_0x35926f]));}else if(_0x35926f===_0xd9ff('0x84')){var _0x59af0a=JSON[_0xd9ff('0x85')](_0x2dfb8f[_0xd9ff('0x4e')][_0x35926f])[_0xd9ff('0x86')];var _0x5d1973=JSON[_0xd9ff('0x85')](_0x2dfb8f['query'][_0x35926f])[_0xd9ff('0x87')];_0x5da1a8['where'](_0xd9ff('0x88'),_0x59af0a,_0x5d1973);}else{if(_0x2dfb8f[_0xd9ff('0x4e')][_0x35926f]===_0xd9ff('0x89')){_0x5da1a8[_0xd9ff('0x82')]('i.'+_0x35926f+_0xd9ff('0x8a'));}else{_0x5da1a8[_0xd9ff('0x82')]('i.'+_0x35926f+_0xd9ff('0x8b'),_0x2dfb8f[_0xd9ff('0x4e')][_0x35926f]);}}});}if(_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x8c')]){if(_0x2dfb8f['query'][_0xd9ff('0x8c')]==0x1){_0x5da1a8[_0xd9ff('0x6e')](_0xd9ff('0x8d'));}else{_0x5da1a8[_0xd9ff('0x6e')](_0xd9ff('0x8e'));}}if(_0x2dfb8f[_0xd9ff('0x4e')]['tag']){_0x3be850=_['isArray'](_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x8f')])?_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x8f')]:new Array(_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x8f')]);_0x3be850['forEach'](function(_0x1d34a1){_0x11251f['or'](_0xd9ff('0x7a'),'%,'+_0x1d34a1+',%');});}if(_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x90')]){var _0x14c89f=_0x2dfb8f[_0xd9ff('0x4e')]['filter'][_0xd9ff('0x91')]('\x5c','\x5c\x5c')[_0xd9ff('0x91')](/'/g,'\x27\x27');if(qs[_0xd9ff('0x92')](_0x14c89f)){_0x458fd4['or'](_0xd9ff('0x93'),_0x14c89f+'%');}else{_0x458fd4['or'](_0xd9ff('0x94'),qs[_0xd9ff('0x74')](_0x14c89f))['or'](_0xd9ff('0x95'),_0x14c89f+'%');}}}_0x5da1a8[_0xd9ff('0x82')](_0x458fd4);_0x5da1a8['group'](_0xd9ff('0x96'));var _0x4c2ad5={'type':db[_0xd9ff('0x97')][_0xd9ff('0x98')][_0xd9ff('0x99')],'raw':!![]};var _0x2d2d1c=_0x5da1a8[_0xd9ff('0x9a')]();_0x2d2d1c[_0xd9ff('0x5a')](_0xd9ff('0x96'));_0x2d2d1c[_0xd9ff('0x5a')](_0xd9ff('0x9b'),_0xd9ff('0x6c'));if(_0x30c69d[_0xd9ff('0x9c')]){_0x30c69d[_0xd9ff('0x9c')][_0xd9ff('0x47')](function(_0x5d29b9){var _0x4413c4=_0x5d29b9[0x0]===_0xd9ff('0x9d')?_0x5d29b9[0x0]:'i.'+_0x5d29b9[0x0];_0x5da1a8[_0xd9ff('0x9c')](_0x4413c4,_0x5d29b9[0x1]===_0xd9ff('0x9e')?![]:!![]);});}if(!_['isEmpty'](_0x3be850)){_0x5da1a8[_0xd9ff('0x6e')](_0x11251f);_0x2d2d1c[_0xd9ff('0x82')]('t.id\x20IN\x20?',_0x3be850);}BPromise[_0xd9ff('0x9f')]()[_0xd9ff('0x22')](function(){if(!_0x1c885f){if(_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x81')])return;_0x2d2d1c[_0xd9ff('0x82')](_0xd9ff('0xa0'));_0x5da1a8[_0xd9ff('0x82')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x2dfb8f[_0xd9ff('0xa1')]['role']!==_0xd9ff('0xa2'))return;return _0x2dfb8f[_0xd9ff('0xa1')][_0xd9ff('0xa3')]({'attributes':['id'],'raw':!![]})[_0xd9ff('0x22')](function(_0x320adb){if(_[_0xd9ff('0xa4')](_0x320adb)){_0x2d2d1c[_0xd9ff('0x82')](_0xd9ff('0xa5'));_0x5da1a8[_0xd9ff('0x82')](_0xd9ff('0xa5'));}else{_0x2d2d1c[_0xd9ff('0x82')]('i.ChatWebsiteId\x20IN\x20?',_[_0xd9ff('0x79')](_0x320adb,'id'));_0x5da1a8[_0xd9ff('0x82')]('i.ChatWebsiteId\x20IN\x20?',_[_0xd9ff('0x79')](_0x320adb,'id'));}});})[_0xd9ff('0x22')](function(){if(_0x2dfb8f[_0xd9ff('0xa1')][_0xd9ff('0xa6')]===_0xd9ff('0xa2')&&!_0x1c885f&&!_0x2dfb8f[_0xd9ff('0x4e')]['ChatWebsiteId'])return[];return db['sequelize'][_0xd9ff('0x4e')](_0x2d2d1c['toString'](),_0x4c2ad5);})['then'](function(_0x4a55c1){_0xd64585['count']=_0x4a55c1[_0xd9ff('0x54')];if(_0xd64585[_0xd9ff('0x34')]===0x0)return[];return db[_0xd9ff('0xa7')]['query'](_0x40d391['toString'](),_0x4c2ad5)[_0xd9ff('0x22')](function(_0x5e7f52){_0xfede73=_[_0xd9ff('0xa8')](_0x5e7f52,'id');_0x4c2ad5=_['merge'](_0x4c2ad5,{'model':db[_0xd9ff('0x49')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x52')]){_0x30c69d[_0xd9ff('0x53')][_0xd9ff('0x47')](function(_0x4e6dd2){_0x5da1a8['field']('i.'+_0x4e6dd2);});}else{_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0x9b'),_0xd9ff('0x6c'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xa9'),'Account.key');_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xaa'),_0xd9ff('0xab'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xac'),_0xd9ff('0x9d'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xad'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xae'),_0xd9ff('0xaf'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xb0'),'Contact.lastName');_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xb1'),'Contact.email');_0x5da1a8['field'](_0xd9ff('0xb2'),_0xd9ff('0xb3'));_0x5da1a8['field'](_0xd9ff('0xb4'),_0xd9ff('0xb5'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xb6'),_0xd9ff('0xb7'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xb8'),_0xd9ff('0xb9'));_0x5da1a8['field']('o.internal','Owner.internal');_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xba'),_0xd9ff('0x45'));}if(_0x30c69d['limit'])_0x5da1a8[_0xd9ff('0x33')](_0x30c69d[_0xd9ff('0x33')]);if(_0x30c69d[_0xd9ff('0x31')])_0x5da1a8[_0xd9ff('0x31')](_0x30c69d[_0xd9ff('0x31')]);return db[_0xd9ff('0xa7')]['query'](_0x5da1a8[_0xd9ff('0xbb')](),_0x4c2ad5);})['then'](function(_0x5cb3af){if(_0x5cb3af[_0xd9ff('0x54')]>0x0)_0x3ed112[_0xd9ff('0x82')](_0xd9ff('0xbc'),_['map'](_0x5cb3af,'id'));return db[_0xd9ff('0xa7')][_0xd9ff('0x4e')](_0x3ed112['toString'](),_0x4c2ad5)['then'](function(_0x4aa6d5){var _0x11840a=_[_0xd9ff('0xbd')](_0x4aa6d5,'ChatInteractionId');var _0x2871ec=[];_0x5cb3af[_0xd9ff('0x47')](function(_0x16e130){_0x2871ec['push'](updateChatInteraction(_0x16e130,_0xfede73,_0x11840a));});return BPromise['all'](_0x2871ec);});});})['then'](function(_0xdf2e33){_0xd64585['rows']=_0xdf2e33;return _0xd64585;})[_0xd9ff('0x22')](respondWithFilteredResult(_0x437561,_0x30c69d))[_0xd9ff('0x2d')](handleError(_0x437561,null));};exports['show']=function(_0x1b048b,_0x5eeeaf){var _0x3339e5={'raw':![],'where':{'id':_0x1b048b[_0xd9ff('0xbe')]['id']}},_0x1f7d87={};_0x1f7d87['model']=_[_0xd9ff('0x4d')](db['ChatInteraction']['rawAttributes']);_0x1f7d87['query']=_[_0xd9ff('0x4d')](_0x1b048b[_0xd9ff('0x4e')]);_0x1f7d87[_0xd9ff('0x4f')]=_[_0xd9ff('0x51')](_0x1f7d87['model'],_0x1f7d87['query']);_0x3339e5[_0xd9ff('0x53')]=_[_0xd9ff('0x51')](_0x1f7d87[_0xd9ff('0x50')],qs[_0xd9ff('0x52')](_0x1b048b[_0xd9ff('0x4e')]['fields']));_0x3339e5['attributes']=_0x3339e5[_0xd9ff('0x53')][_0xd9ff('0x54')]?_0x3339e5[_0xd9ff('0x53')]:_0x1f7d87[_0xd9ff('0x50')];if(_0x1b048b[_0xd9ff('0x4e')][_0xd9ff('0xbf')]){_0x3339e5['include']=[{'all':!![]}];}_0x3339e5=_[_0xd9ff('0x3e')]({},_0x3339e5,_0x1b048b['options']);return db['ChatInteraction'][_0xd9ff('0xc0')](_0x3339e5)[_0xd9ff('0x22')](handleEntityNotFound(_0x5eeeaf,null))[_0xd9ff('0x22')](respondWithResult(_0x5eeeaf,null))[_0xd9ff('0x2d')](handleError(_0x5eeeaf,null));};exports['create']=function(_0x4e3fdd,_0x2cf8da){return db['ChatInteraction']['create'](_0x4e3fdd[_0xd9ff('0x3f')],{})['then'](respondWithResult(_0x2cf8da,0xc9))[_0xd9ff('0x2d')](handleError(_0x2cf8da,null));};exports['update']=function(_0x327cd8,_0xd95329){if(_0x327cd8[_0xd9ff('0x3f')]['id']){delete _0x327cd8[_0xd9ff('0x3f')]['id'];}return db[_0xd9ff('0x49')][_0xd9ff('0xc0')]({'where':{'id':_0x327cd8[_0xd9ff('0xbe')]['id']}})['then'](handleEntityNotFound(_0xd95329,null))[_0xd9ff('0x22')](saveUpdates(_0x327cd8['body'],null))['then'](respondWithResult(_0xd95329,null))[_0xd9ff('0x2d')](handleError(_0xd95329,null));};exports[_0xd9ff('0xc1')]=function(_0x499869,_0x3c86ac){return db['ChatInteraction']['find']({'where':{'id':_0x499869[_0xd9ff('0xbe')]['id']}})[_0xd9ff('0x22')](handleEntityNotFound(_0x3c86ac,null))[_0xd9ff('0x22')](removeEntity(_0x3c86ac,null))[_0xd9ff('0x2d')](handleError(_0x3c86ac,null));};exports[_0xd9ff('0xc2')]=function(_0x11c84f,_0x2d0261){return db[_0xd9ff('0x49')][_0xd9ff('0xc2')]()[_0xd9ff('0x22')](respondWithResult(_0x2d0261,null))[_0xd9ff('0x2d')](handleError(_0x2d0261,null));};exports[_0xd9ff('0xc3')]=function(_0x73cfcf,_0x538f20){var _0x51feff=_0x73cfcf['params']['id'];var _0x30c62c;var _0x50b6b2;var _0x413aef;return db[_0xd9ff('0x49')][_0xd9ff('0xc4')]({'where':{'id':_0x51feff}})[_0xd9ff('0x22')](function(_0x54c390){_0x30c62c=_0x54c390;return db[_0xd9ff('0xc5')]['findOne']({'where':{'id':_0x54c390[_0xd9ff('0x81')]},'attributes':['id','vidaooApiKey','vidaooEscalation','vidaooTopic',_0xd9ff('0xc6'),'vidaooMetadata'],'raw':!![]});})[_0xd9ff('0x22')](function(_0x54524c){if(_0x54524c&&_0x54524c[_0xd9ff('0xc7')]&&_0x54524c[_0xd9ff('0xc8')]){_0x50b6b2=_0x54524c;var _0x696e18={'interaction':{'id':_0x51feff},'agent':{'id':_0x73cfcf[_0xd9ff('0xa1')]['id'],'name':_0x73cfcf[_0xd9ff('0xa1')][_0xd9ff('0x3c')],'fullname':_0x73cfcf['user']['fullname'],'email':_0x73cfcf[_0xd9ff('0xa1')][_0xd9ff('0xc9')]},'contact':_0x73cfcf[_0xd9ff('0x3f')][_0xd9ff('0x40')],'account':_0x73cfcf[_0xd9ff('0x3f')]['account']};var _0x432854={'rejectUnauthorized':![],'method':_0xd9ff('0xca'),'url':_0xd9ff('0xcb'),'headers':{'X-APIKEY':_0x54524c[_0xd9ff('0xc7')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x73cfcf[_0xd9ff('0xa1')][_0xd9ff('0xc9')]],'buttons':null,'topic':_0x50b6b2['vidaooTopic'],'note':_[_0xd9ff('0xcc')](_0x50b6b2[_0xd9ff('0xc6')])?null:getMustacheRender(_0x50b6b2[_0xd9ff('0xc6')],_0x696e18),'metadata':null},'redirect':_0xd9ff('0xcd'),'json':!![]};try{if(!_[_0xd9ff('0xcc')](_0x50b6b2[_0xd9ff('0xce')])){var _0x1c8e55=getMustacheRender(_0x50b6b2[_0xd9ff('0xce')],_0x696e18);var _0x29fdb8=JSON[_0xd9ff('0x85')](_0x1c8e55);_0x432854[_0xd9ff('0x3f')][_0xd9ff('0xcf')]=_0x29fdb8;}}catch(_0xfc755a){throw new db[(_0xd9ff('0x97'))][(_0xd9ff('0xd0'))](_0xd9ff('0xd1'));}return rp(_0x432854);}else{throw new db[(_0xd9ff('0x97'))][(_0xd9ff('0xd0'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xd9ff('0x22')](function(_0x282183){_0x413aef=_0x282183;if(_0x413aef['id']){var _0x3aba00={'body':_0x413aef[_0xd9ff('0xd2')],'ChatWebsiteId':_0x50b6b2['id'],'ChatInteractionId':_0x30c62c['id'],'direction':_0xd9ff('0xd3'),'UserId':_0x73cfcf[_0xd9ff('0xa1')]['id']};return db[_0xd9ff('0xd4')][_0xd9ff('0xd5')](_0x3aba00,{});}else{throw new db['Sequelize'][(_0xd9ff('0xd0'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xd9ff('0x22')](function(){return _0x30c62c[_0xd9ff('0xd6')]({'vidaooSessionId':_0x413aef['id']});})[_0xd9ff('0x22')](respondWithResult(_0x538f20,null))[_0xd9ff('0x2d')](handleError(_0x538f20,null));};exports[_0xd9ff('0xd7')]=function(_0x204127,_0xf98666){if(_0x204127['body']['id']){delete _0x204127[_0xd9ff('0x3f')]['id'];}return db[_0xd9ff('0x49')][_0xd9ff('0xc0')]({'where':{'id':_0x204127[_0xd9ff('0xbe')]['id']},'include':[{'model':db['CmContact'],'as':_0xd9ff('0x71')}]})[_0xd9ff('0x22')](handleEntityNotFound(_0xf98666,null))['then'](saveUpdates(_0x204127[_0xd9ff('0x3f')],null))[_0xd9ff('0x22')](respondWithResult(_0xf98666,null))['catch'](handleError(_0xf98666,null));};exports['abandon']=function(_0x5c4138,_0x560ea2,_0x1e6d5a){if(_0x5c4138[_0xd9ff('0x3f')]['id']){delete _0x5c4138[_0xd9ff('0x3f')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x5c4138[_0xd9ff('0xbe')]['id']}})['then'](function(_0x43a941){if(!_0x43a941){logger[_0xd9ff('0x2a')](_0xd9ff('0xd8'),'abandon',0x194,'entity\x20not\x20found');_0x560ea2['sendStatus'](0x194);}else{if(_0x43a941[_0xd9ff('0x7e')]){throw new db[(_0xd9ff('0x97'))]['ValidationError'](_0xd9ff('0xd9'));}}return _0x43a941;})[_0xd9ff('0x22')](function(_0x7efe12){if(_0x7efe12){return _0x7efe12[_0xd9ff('0x3a')]({'closed':_0x5c4138[_0xd9ff('0x3f')][_0xd9ff('0xda')],'disposition':_0x5c4138[_0xd9ff('0x3f')][_0xd9ff('0xdb')]})[_0xd9ff('0x22')](function(_0x3b7aeb){return _0x3b7aeb;});}})[_0xd9ff('0x22')](function(_0x37eb49){return respondWithRpcPromise(_0xd9ff('0xdc'),_0xd9ff('0xdd'),_0x5c4138[_0xd9ff('0x3f')],client9004);})[_0xd9ff('0x22')](respondWithResult(_0x560ea2,null))[_0xd9ff('0x2d')](handleError(_0x560ea2,null));};exports[_0xd9ff('0xde')]=function(_0x3b05c4,_0x32c04e,_0x1bcf8f){_0x3b05c4[_0xd9ff('0x3f')][_0xd9ff('0x3c')]=_0x3b05c4[_0xd9ff('0xdf')][_0xd9ff('0xe0')];_0x3b05c4[_0xd9ff('0x3f')][_0xd9ff('0xe1')]=_0x3b05c4[_0xd9ff('0xdf')][_0xd9ff('0xe2')];_0x3b05c4['body'][_0xd9ff('0x4c')]=_0x3b05c4[_0xd9ff('0xdf')]['mimetype'];return db[_0xd9ff('0xe3')][_0xd9ff('0xd5')](_0x3b05c4[_0xd9ff('0x3f')])[_0xd9ff('0x22')](respondWithResult(_0x32c04e,0xc9))[_0xd9ff('0x2d')](handleError(_0x32c04e,null));};exports[_0xd9ff('0xe4')]=function(_0x5978ad,_0x4ddfe7,_0x30c520){return db['ChatInteraction']['findOne']({'where':{'id':_0x5978ad[_0xd9ff('0xbe')]['id']},'raw':!![]})[_0xd9ff('0x22')](handleEntityNotFound(_0x4ddfe7,null))['then'](function(_0x327362){if(_0x327362){if(_0x327362[_0xd9ff('0xda')]){return _0x4ddfe7[_0xd9ff('0x35')](0x193)[_0xd9ff('0x30')]({'status':0x193,'message':'Unauthorized'});}return db[_0xd9ff('0xe3')][_0xd9ff('0xc4')]({'where':{'id':_0x5978ad['query'][_0xd9ff('0xe5')]},'raw':!![]})[_0xd9ff('0x22')](handleEntityNotFound(_0x4ddfe7,null));}})['then'](function(_0x62f1f3){if(_0x62f1f3){var _0xd188cf=_0x62f1f3[_0xd9ff('0xe6')]!==null;var _0x5b2e9c=path[_0xd9ff('0xe7')](config[_0xd9ff('0xe8')],_0xd9ff('0xe9'));if(_0xd188cf){_0x5b2e9c=path['join'](_0x5b2e9c,_0xd9ff('0xea'));}var _0x53a25a=path[_0xd9ff('0xe7')](_0x5b2e9c,_0x62f1f3[_0xd9ff('0xe1')]);return _0x4ddfe7[_0xd9ff('0xeb')](_0x53a25a);}})[_0xd9ff('0x2d')](handleError(_0x4ddfe7,null));};exports[_0xd9ff('0xec')]=function(_0x10397d,_0x51039f){var _0x37ea50=null;var _0x3cf2ef=null;var _0x171195=null;var _0x24c066=null;if(_0x10397d[_0xd9ff('0x3f')]['id']){delete _0x10397d['body']['id'];}if(_0x10397d[_0xd9ff('0x3f')][_0xd9ff('0xed')]){_0x24c066=path['join'](config[_0xd9ff('0xe8')],_0xd9ff('0xee'),util[_0xd9ff('0xef')](_0xd9ff('0xf0'),Date[_0xd9ff('0xf1')]()));_0x10397d[_0xd9ff('0x3f')][_0xd9ff('0xf2')]=_0x24c066;}return db[_0xd9ff('0x49')][_0xd9ff('0xc0')]({'where':{'id':_0x10397d[_0xd9ff('0xbe')]['id']},'include':[{'model':db[_0xd9ff('0xd4')],'as':_0xd9ff('0xf3'),'include':[{'model':db[_0xd9ff('0x7c')],'as':_0xd9ff('0x7c')}]}]})[_0xd9ff('0x22')](handleEntityNotFound(_0x51039f,null))[_0xd9ff('0x22')](saveUpdates(_0x10397d['body'],null))['then'](function(_0x497e36){if(_0x497e36){_0x37ea50=_0x497e36;return db[_0xd9ff('0xc5')]['find']({'where':{'id':_0x37ea50[_0xd9ff('0x81')]}});}})['then'](function(_0x4d4cc0){if(_0x4d4cc0){_0x171195=_0x4d4cc0;return db['CmContact'][_0xd9ff('0xc0')]({'where':{'id':_0x37ea50['ContactId']}});}})['then'](function(_0x474b4c){if(_0x474b4c){_0x3cf2ef=_0x474b4c;if(_0x24c066){var _0x144cf7=null;for(var _0x9eac7f=0x1;_0x9eac7f<_0x37ea50[_0xd9ff('0xf3')][_0xd9ff('0x54')];++_0x9eac7f){_0x144cf7=_0x37ea50[_0xd9ff('0xf3')][_0x9eac7f];var _0x2450da=_0x144cf7[_0xd9ff('0x7e')]?util[_0xd9ff('0xef')](_0xd9ff('0xf4'),_0x171195[_0xd9ff('0xf5')],_0x144cf7[_0xd9ff('0x7e')]):_0xd9ff('0xf6');var _0x4531bc=_0x10397d['body']['customer']||util[_0xd9ff('0xef')](_0xd9ff('0xf4'),_0xd9ff('0xf7'),_0x144cf7[_0xd9ff('0x76')]);switch(_0x171195[_0xd9ff('0xf8')]){case _0xd9ff('0xf9'):_0x2450da=_0x144cf7[_0xd9ff('0x7e')]?util[_0xd9ff('0xef')]('%s%d',_0x171195[_0xd9ff('0xf5')],_0x144cf7[_0xd9ff('0x7e')]):_0xd9ff('0xf6');break;case _0xd9ff('0xfa'):_0x2450da=_0x144cf7['UserId']?_0x144cf7['User'][_0xd9ff('0xfb')]||_0x144cf7[_0xd9ff('0x7c')]['fullname']:_0xd9ff('0xf6');break;case _0xd9ff('0xfc'):_0x2450da=_0x144cf7['UserId']?_0x144cf7[_0xd9ff('0x7c')][_0xd9ff('0x43')]:_0xd9ff('0xf6');break;default:_0x2450da=_0x144cf7[_0xd9ff('0x7e')]?util[_0xd9ff('0xef')](_0xd9ff('0xf4'),_0x171195[_0xd9ff('0xf5')],_0x144cf7['UserId']):_0xd9ff('0xf6');}var _0x62b518=util[_0xd9ff('0xef')](_0xd9ff('0xfd'),moment(_0x144cf7[_0xd9ff('0x84')])['format'](_0xd9ff('0xfe')),_0x144cf7[_0xd9ff('0xff')]==='in'?_0x4531bc:_0x2450da,_0x144cf7[_0xd9ff('0x3f')]);if(!_0x144cf7['secret']){fs[_0xd9ff('0x100')](_0x24c066,_0x62b518);}}return db[_0xd9ff('0x101')][_0xd9ff('0xc4')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xd9ff('0x102'),'raw':!![]}]});}}})['then'](function(_0x5e07ae){if(_0x5e07ae&&_0x5e07ae['Smtp']&&_0x10397d['body']){var _0x578f41={'tls':{'rejectUnauthorized':![]}};if(_0x5e07ae[_0xd9ff('0x102')][_0xd9ff('0x103')]){_0x578f41['service']=_0x5e07ae[_0xd9ff('0x102')][_0xd9ff('0x103')];}else{_0x578f41[_0xd9ff('0x104')]=_0x5e07ae['Smtp'][_0xd9ff('0x104')];_0x578f41['port']=_0x5e07ae['Smtp'][_0xd9ff('0x105')];_0x578f41[_0xd9ff('0x106')]=_0x5e07ae[_0xd9ff('0x102')]['secure'];}if(_0x5e07ae['Smtp'][_0xd9ff('0x107')]){_0x578f41[_0xd9ff('0x108')]={'user':_0x5e07ae['Smtp'][_0xd9ff('0xa1')],'pass':_0x5e07ae[_0xd9ff('0x102')][_0xd9ff('0x109')]};}return respondWithRpcPromise(_0xd9ff('0x10a'),_0xd9ff('0x10b'),{'account':_0x578f41,'message':{'from':util[_0xd9ff('0xef')](_0xd9ff('0x10c'),_0x5e07ae['name'],_0x5e07ae[_0xd9ff('0xc9')]||_0x5e07ae[_0xd9ff('0x102')]['user']),'to':_0x10397d[_0xd9ff('0x3f')][_0xd9ff('0xed')],'subject':'Mail\x20Transcript','text':util[_0xd9ff('0xef')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x10397d[_0xd9ff('0x3f')][_0xd9ff('0xed')]),'attachments':[{'path':_0x24c066}]}})['then'](function(){return _0x37ea50;})[_0xd9ff('0x2d')](function(_0x4d6172){console[_0xd9ff('0x2a')](_0x4d6172);});}else{return _0x37ea50;}})[_0xd9ff('0x22')](respondWithStatusCode(_0x51039f,0xc8))[_0xd9ff('0x2d')](handleError(_0x51039f,null));};exports[_0xd9ff('0x10d')]=function(_0x6a2524,_0x356583,_0x5c1165){return db['ChatMessage'][_0xd9ff('0xc0')]({'where':{'id':_0x6a2524['params']['id']}})[_0xd9ff('0x22')](handleEntityNotFound(_0x356583,null))[_0xd9ff('0x22')](function(_0x599273){if(_0x599273){return _0x599273['addMessage'](_0x6a2524['body'][_0xd9ff('0x10e')],_[_0xd9ff('0x10f')](_0x6a2524[_0xd9ff('0x3f')],['ids','id'])||{});}})[_0xd9ff('0x22')](respondWithResult(_0x356583,null))[_0xd9ff('0x2d')](handleError(_0x356583,null));};exports[_0xd9ff('0x110')]=function(_0x2832b7,_0x618c47,_0x109140){var _0x278670={'raw':![],'where':{}};var _0x5e064d={};var _0x231b46={'count':0x0,'rows':[]};return db[_0xd9ff('0x49')][_0xd9ff('0xc4')]({'where':{'id':_0x2832b7[_0xd9ff('0xbe')]['id']}})[_0xd9ff('0x22')](handleEntityNotFound(_0x618c47,null))[_0xd9ff('0x22')](function(_0x1802b1){if(_0x1802b1){_0x5e064d[_0xd9ff('0x50')]=_[_0xd9ff('0x4d')](db[_0xd9ff('0xd4')][_0xd9ff('0x4a')]);_0x5e064d['query']=_['keys'](_0x2832b7[_0xd9ff('0x4e')]);_0x5e064d['filters']=_['intersection'](_0x5e064d[_0xd9ff('0x50')],_0x5e064d[_0xd9ff('0x4e')]);_0x278670[_0xd9ff('0x53')]=_[_0xd9ff('0x51')](_0x5e064d[_0xd9ff('0x50')],qs['fields'](_0x2832b7[_0xd9ff('0x4e')]['fields']));_0x278670[_0xd9ff('0x53')]=_0x278670[_0xd9ff('0x53')]['length']?_0x278670[_0xd9ff('0x53')]:_0x5e064d[_0xd9ff('0x50')];if(!_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x55')](_0xd9ff('0x56'))){_0x278670[_0xd9ff('0x33')]=qs[_0xd9ff('0x33')](_0x2832b7['query'][_0xd9ff('0x33')]);_0x278670[_0xd9ff('0x31')]=qs[_0xd9ff('0x31')](_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x31')]);}_0x278670[_0xd9ff('0x9c')]=qs['sort'](_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x57')]);_0x278670[_0xd9ff('0x82')]=qs['filters'](_[_0xd9ff('0x58')](_0x2832b7['query'],_0x5e064d[_0xd9ff('0x4f')]));_0x278670['where'][_0xd9ff('0x111')]=_0x1802b1['id'];if(_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x90')]){_0x278670['where']=_[_0xd9ff('0x3e')](_0x278670['where'],{'$or':_[_0xd9ff('0x79')](_0x278670[_0xd9ff('0x53')],function(_0x2b2a50){var _0x34f3f0={};_0x34f3f0[_0x2b2a50]={'$like':'%'+_0x2832b7[_0xd9ff('0x4e')]['filter']+'%'};return _0x34f3f0;})});}if(_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x86')]){var _0x955328=_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x86')][_0xd9ff('0x46')](',');var _0x5d95b1={};_0x5d95b1[_0x955328[0x0]]={'$gte':moment(_0x955328[0x1])['format'](_0xd9ff('0x112'))};_0x278670[_0xd9ff('0x82')]=_[_0xd9ff('0x3e')](_0x278670[_0xd9ff('0x82')],_0x5d95b1);}_0x278670=_[_0xd9ff('0x3e')]({},_0x278670,_0x2832b7[_0xd9ff('0x113')]);return db[_0xd9ff('0xd4')]['count']({'where':_0x278670[_0xd9ff('0x82')]})[_0xd9ff('0x22')](function(_0x3e90fe){_0x231b46[_0xd9ff('0x34')]=_0x3e90fe;if(_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0xbf')]){_0x278670['include']=[{'all':!![]}];}return db[_0xd9ff('0xd4')][_0xd9ff('0x114')](_0x278670);})[_0xd9ff('0x22')](function(_0x33f933){_0x231b46[_0xd9ff('0x115')]=_0x33f933;return _0x231b46;});}})[_0xd9ff('0x22')](respondWithFilteredResult(_0x618c47,_0x278670))['catch'](handleError(_0x618c47,null));};exports['getMyMessages']=function(_0xf3a93b,_0x473ecf,_0x1213a4){var _0x6f731a={'where':{}},_0x193c57={},_0x4572b2={'count':0x0,'rows':[]};return db[_0xd9ff('0x49')][_0xd9ff('0xc4')]({'where':{'id':_0xf3a93b['params']['id']}})[_0xd9ff('0x22')](handleEntityNotFound(_0x473ecf,null))[_0xd9ff('0x22')](function(_0x4115a3){if(_0x4115a3){_0x193c57[_0xd9ff('0x50')]=_[_0xd9ff('0x4d')](db[_0xd9ff('0xd4')]['rawAttributes']);_0x193c57[_0xd9ff('0x4e')]=_['keys'](_0xf3a93b['query']);_0x193c57[_0xd9ff('0x4f')]=_[_0xd9ff('0x51')](_0x193c57[_0xd9ff('0x50')],_0x193c57[_0xd9ff('0x4e')]);_0x6f731a[_0xd9ff('0x53')]=_[_0xd9ff('0x51')](_0x193c57[_0xd9ff('0x50')],qs[_0xd9ff('0x52')](_0xf3a93b['query'][_0xd9ff('0x52')]));_0x6f731a['attributes']=_0x6f731a[_0xd9ff('0x53')][_0xd9ff('0x54')]?_0x6f731a[_0xd9ff('0x53')]:_0x193c57[_0xd9ff('0x50')];if(!_0xf3a93b['query'][_0xd9ff('0x55')](_0xd9ff('0x56'))){_0x6f731a[_0xd9ff('0x33')]=qs[_0xd9ff('0x33')](_0xf3a93b[_0xd9ff('0x4e')][_0xd9ff('0x33')]);_0x6f731a[_0xd9ff('0x31')]=qs[_0xd9ff('0x31')](_0xf3a93b[_0xd9ff('0x4e')]['offset']);}_0x6f731a[_0xd9ff('0x9c')]=qs['sort'](_0xf3a93b['query'][_0xd9ff('0x57')]);_0x6f731a[_0xd9ff('0x82')]=qs[_0xd9ff('0x4f')](_[_0xd9ff('0x58')](_0xf3a93b[_0xd9ff('0x4e')],_0x193c57[_0xd9ff('0x4f')]));_0x6f731a[_0xd9ff('0x82')][_0xd9ff('0x111')]=_0x4115a3['id'];if(_0xf3a93b[_0xd9ff('0x4e')][_0xd9ff('0x90')]){_0x6f731a[_0xd9ff('0x82')]=_[_0xd9ff('0x3e')](_0x6f731a['where'],{'$or':_[_0xd9ff('0x79')](_0x6f731a['attributes'],function(_0x1bb980){var _0x3ccf5d={};_0x3ccf5d[_0x1bb980]={'$like':'%'+_0xf3a93b['query']['filter']+'%'};return _0x3ccf5d;})});}_0x6f731a[_0xd9ff('0x82')][_0xd9ff('0x116')]=![];if(_0xf3a93b['query']['id']){_0x6f731a[_0xd9ff('0x82')]['id']={'$gt':_0xf3a93b[_0xd9ff('0x4e')]['id']};}_0x6f731a=_['merge']({},_0x6f731a,_0xf3a93b[_0xd9ff('0x113')]);return db['ChatMessage'][_0xd9ff('0x34')]({'where':_0x6f731a[_0xd9ff('0x82')]})[_0xd9ff('0x22')](function(_0x42d9ff){_0x4572b2[_0xd9ff('0x34')]=_0x42d9ff;_0x6f731a[_0xd9ff('0x117')]=[];if(_0xf3a93b[_0xd9ff('0x4e')][_0xd9ff('0x118')]){_0x6f731a[_0xd9ff('0x117')][_0xd9ff('0x119')]({'model':db[_0xd9ff('0x7c')],'as':_0xd9ff('0x7c'),'attributes':['id',_0xd9ff('0x43'),_0xd9ff('0xfb')]});}if(_0xf3a93b['query'][_0xd9ff('0xbf')]){_0x6f731a[_0xd9ff('0x117')]=[{'all':!![]}];}return db[_0xd9ff('0xd4')][_0xd9ff('0x114')](_0x6f731a);})[_0xd9ff('0x22')](function(_0x314f18){_0x4572b2['rows']=_0x314f18;return _0x4572b2;});}})['then'](respondWithFilteredResult(_0x473ecf,_0x6f731a))['catch'](handleError(_0x473ecf,null));};exports['addTags']=function(_0x4699d3,_0x2e91a8,_0x4956b2){return db[_0xd9ff('0x49')][_0xd9ff('0xc0')]({'where':{'id':_0x4699d3[_0xd9ff('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2e91a8,null))['then'](function(_0x217023){if(_0x217023){return _0x217023[_0xd9ff('0x11a')](_0x4699d3['body']['ids'],_['omit'](_0x4699d3['body'],['ids','id'])||{})[_0xd9ff('0x11b')](function(){return db[_0xd9ff('0x11c')][_0xd9ff('0x114')]({'attributes':['id',_0xd9ff('0x3c'),_0xd9ff('0x5b')],'where':{'id':_0x4699d3[_0xd9ff('0x3f')][_0xd9ff('0x10e')]}});})[_0xd9ff('0x22')](function(_0x317f93){socket[_0xd9ff('0x11d')](_0xd9ff('0x11e'),{'id':Number(_0x4699d3[_0xd9ff('0xbe')]['id']),'tags':_0x317f93||[]});return{'id':Number(_0x4699d3[_0xd9ff('0xbe')]['id']),'tags':_0x317f93||[]};});}})[_0xd9ff('0x22')](respondWithResult(_0x2e91a8,null))[_0xd9ff('0x2d')](handleError(_0x2e91a8,null));};exports[_0xd9ff('0x11f')]=function(_0x404baf,_0x5d73cd,_0xdb719b){return db['ChatInteraction'][_0xd9ff('0xc0')]({'where':{'id':_0x404baf['params']['id']}})[_0xd9ff('0x22')](handleEntityNotFound(_0x5d73cd,null))[_0xd9ff('0x22')](function(_0x10935d){if(_0x10935d){return _0x10935d['removeTags'](_0x404baf['query']['ids']);}})['then'](respondWithStatusCode(_0x5d73cd,null))['catch'](handleError(_0x5d73cd,null));};exports[_0xd9ff('0xeb')]=function(_0x2031e9,_0x3b50d9){var _0x410fae=moment()[_0xd9ff('0x120')]()[_0xd9ff('0xbb')]();var _0x494da6=path[_0xd9ff('0xe7')](config[_0xd9ff('0xe8')],'server','files',_0xd9ff('0x121'));var _0x49c9cc=path[_0xd9ff('0xe7')](config['root'],_0xd9ff('0x122'),_0xd9ff('0x123'),'attachments');var _0x378746=path[_0xd9ff('0xe7')](_0x494da6,_0x410fae);var _0x2acbe3=util[_0xd9ff('0xef')]('transcript-%d-%s.zip',_0x2031e9['params']['id'],_0x410fae);var _0x46d12c=path[_0xd9ff('0xe7')](_0x494da6,_0x2acbe3);var _0x54f4aa=[];_0x54f4aa[_0xd9ff('0x119')]({'model':db['User'],'as':_0xd9ff('0x7c'),'attributes':['id',_0xd9ff('0x43')],'raw':!![]});_0x54f4aa[_0xd9ff('0x119')]({'model':db[_0xd9ff('0x124')],'as':_0xd9ff('0x71'),'attributes':['id',_0xd9ff('0x125'),'lastName'],'raw':!![]});if(_0x2031e9['query'][_0xd9ff('0x126')]){_0x54f4aa['push']({'model':db[_0xd9ff('0xe3')],'as':'Attachment','raw':!![]});}var _0xd015e9=[{'model':db[_0xd9ff('0xd4')],'as':_0xd9ff('0xf3'),'attributes':['id','body',_0xd9ff('0x84'),_0xd9ff('0xff'),'secret','read'],'include':_0x54f4aa}];_0xd015e9['push']({'model':db[_0xd9ff('0xc5')],'as':_0xd9ff('0x127'),'attributes':['id',_0xd9ff('0x3c')]});_0xd015e9[_0xd9ff('0x119')]({'model':db[_0xd9ff('0x7c')],'as':_0xd9ff('0x128'),'attributes':['id',_0xd9ff('0x43')]});return db[_0xd9ff('0x49')]['find']({'where':{'id':_0x2031e9[_0xd9ff('0xbe')]['id']},'include':_0xd015e9})[_0xd9ff('0x22')](handleEntityNotFound(_0x3b50d9,null))[_0xd9ff('0x22')](function(_0x1b452e){if(_0x1b452e){var _0x3ab927=_0x1b452e[_0xd9ff('0x129')]({'plain':!![]});fs[_0xd9ff('0x12a')](_0x378746);var _0x2b6e15={'channel':_0xd9ff('0x12b'),'account':_0x3ab927['Account']['name'],'agent':_0x3ab927['Owner']?_0x3ab927[_0xd9ff('0x128')][_0xd9ff('0x43')]:'N.A.','createdAt':moment(_0x3ab927[_0xd9ff('0x84')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xd9ff('0xbb')](),'closedAt':_0x3ab927[_0xd9ff('0xda')]?moment(_0x3ab927[_0xd9ff('0x12c')])[_0xd9ff('0xef')](_0xd9ff('0x112'))[_0xd9ff('0xbb')]():'','disposition':_0x3ab927['disposition'],'chatInfo':{'browser':_0x3ab927[_0xd9ff('0x12d')],'os':_0x3ab927[_0xd9ff('0x12e')],'referer':_0x3ab927[_0xd9ff('0x12f')],'customerIp':_0x3ab927[_0xd9ff('0x130')],'customerPort':_0x3ab927[_0xd9ff('0x131')]?_0x3ab927['customerPort']:'N.A.'},'messages':_(_0x3ab927[_0xd9ff('0xf3')])[_0xd9ff('0x132')]()[_0xd9ff('0x90')]({'secret':![]})[_0xd9ff('0x79')](function(_0x319248){if(_0x319248[_0xd9ff('0xe3')]){var _0x1ea603=path[_0xd9ff('0xe7')](_0x49c9cc,_0x319248[_0xd9ff('0xe3')][_0xd9ff('0xe1')]);if(fs[_0xd9ff('0x133')](_0x1ea603)){fs[_0xd9ff('0x134')](_0x1ea603)[_0xd9ff('0x135')](fs['createWriteStream'](path[_0xd9ff('0xe7')](_0x378746,_0x319248[_0xd9ff('0xe3')][_0xd9ff('0xe1')])));}}return{'date':moment(_0x319248[_0xd9ff('0x84')])[_0xd9ff('0xef')](_0xd9ff('0x112'))[_0xd9ff('0xbb')](),'sender':_0x319248[_0xd9ff('0xff')]===_0xd9ff('0xd3')?_0x319248[_0xd9ff('0x7c')]?_0x319248[_0xd9ff('0x7c')][_0xd9ff('0x43')]:_0xd9ff('0xf6'):_0x319248['Contact'][_0xd9ff('0x125')]+(_0x319248[_0xd9ff('0x71')][_0xd9ff('0x136')]?'\x20'+_0x319248[_0xd9ff('0x71')]['lastName']:''),'body':_0x319248[_0xd9ff('0xe3')]?_0x319248['Attachment']['basename']:_0x319248[_0xd9ff('0x3f')],'direction':_0x319248[_0xd9ff('0xff')]===_0xd9ff('0xd3')?'A':'C','secret':_0x319248[_0xd9ff('0x116')],'read':_0x319248[_0xd9ff('0x8c')],'attachment':_0x319248[_0xd9ff('0xe3')]};})[_0xd9ff('0x6d')]()};return ejs['renderFile'](path[_0xd9ff('0xe7')](config[_0xd9ff('0xe8')],'server',_0xd9ff('0x137'),_0xd9ff('0x138')),{'interaction':_0x2b6e15})[_0xd9ff('0x22')](function(_0xb07a14){var _0x1c419f=path[_0xd9ff('0xe7')](_0x378746,_0xd9ff('0x139')+_0x3ab927['id']+'-'+_0x410fae+_0xd9ff('0x13a'));var _0x3156c8={'path':_0x1c419f,'channel':_0xd9ff('0x12b'),'interactionId':_0x3ab927['id']};return pdf[_0xd9ff('0x13b')](_0xb07a14,_0x3156c8);})['then'](function(){return new BPromise(function(_0x567007,_0x1019f9){zipdir(_0x378746,{'saveTo':_0x46d12c},function(_0x2ab78a,_0x4649d9){if(_0x2ab78a)return _0x1019f9(_0x2ab78a);return _0x567007(_0x4649d9);});})[_0xd9ff('0x22')](function(){return new BPromise(function(_0x166033,_0x3c40e4){rimraf(_0x378746,function(_0x346d93){if(_0x346d93)_0x3c40e4(_0x346d93);return _0x166033();});});})[_0xd9ff('0x22')](function(){return _0x3b50d9['download'](_0x46d12c,_0x2acbe3,function(_0x22680e){if(_0x22680e){console['log'](_0xd9ff('0x13c'),_0x22680e);}else{fs[_0xd9ff('0x13d')](_0x46d12c);}});});});}else{return _0x3b50d9['sendStatus'](0xc8);}})[_0xd9ff('0x2d')](handleError(_0x3b50d9,null));}; \ No newline at end of file +var _0x4024=['ChatInteractionId','push','all','rows','show','params','include','options','create','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooTopic','vidaooNote','fullname','email','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','vidaooMetadata','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','ChatMessage','Messages','ContactId','%s%d','agentAlias','System','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','getMessages','hasOwnProperty','sort','$gte','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','getMyMessages','includeAgent','addTags','setTags','ids','spread','color','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','Account','get','mkdirSync','Chat','Owner','N.A.','closed','browserName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','lastName','renderFile','.pdf','createPdfFromHTML','err','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','ejs','fs-extra','lodash','crypto','to-csv','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','end','status','offset','limit','undefined','count','set','json','apply','reject','save','update','destroy','then','sendStatus','name','render','merge','agent','interaction','account','Users','TagIds','Tags','split','forEach','catch','map','ChatInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','expr','search','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','Contact','operator','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','buildExpression','type','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','UserId','text','body','compact','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','having','isArray','tag','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?','i.id','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','a.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy'];(function(_0xbedc93,_0x358157){var _0x28aded=function(_0x2b26d8){while(--_0x2b26d8){_0xbedc93['push'](_0xbedc93['shift']());}};_0x28aded(++_0x358157);}(_0x4024,0x89));var _0x4402=function(_0x1dd5d4,_0x3474e3){_0x1dd5d4=_0x1dd5d4-0x0;var _0x4be6ee=_0x4024[_0x1dd5d4];return _0x4be6ee;};'use strict';var emlformat=require(_0x4402('0x0'));var rimraf=require(_0x4402('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4402('0x2'));var rp=require(_0x4402('0x3'));var moment=require('moment');var BPromise=require(_0x4402('0x4'));var Mustache=require('mustache');var util=require(_0x4402('0x5'));var path=require(_0x4402('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4402('0x7'));var fs=require('fs');var fs_extra=require(_0x4402('0x8'));var _=require(_0x4402('0x9'));var squel=require('squel');var crypto=require(_0x4402('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4402('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4402('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x4402('0xd'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x4402('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4402('0xf'))(_0x4402('0x10'));var utils=require('../../config/utils');var config=require(_0x4402('0x11'));var licenseUtil=require(_0x4402('0x12'));var db=require(_0x4402('0x13'))['db'];config['redis']=_[_0x4402('0x14')](config[_0x4402('0x15')],{'host':_0x4402('0x16'),'port':0x18eb});var socket=require(_0x4402('0x17'))(new Redis(config[_0x4402('0x15')]));require(_0x4402('0x18'))[_0x4402('0x19')](socket);var jayson=require(_0x4402('0x1a'));var client=jayson[_0x4402('0x1b')][_0x4402('0x1c')]({'port':0x232b});var client9004=jayson[_0x4402('0x1b')][_0x4402('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x2a2ce8,_0x19fe7b,_0xfd9853,_0x30c390){return new BPromise(function(_0x399c24,_0x25e88b){var _0x186c22=_0x30c390||client;return _0x186c22[_0x4402('0x1d')](_0x2a2ce8,_0xfd9853)['then'](function(_0x494389){logger[_0x4402('0x1e')](_0x4402('0x1f'),_0x19fe7b,'request\x20sent');logger[_0x4402('0x20')](_0x4402('0x21'),_0x19fe7b,'request\x20sent',JSON[_0x4402('0x22')](_0x494389));if(_0x494389['error']){if(_0x494389['error'][_0x4402('0x23')]===0x1f4){logger[_0x4402('0x24')](_0x4402('0x1f'),_0x19fe7b,_0x494389['error'][_0x4402('0x25')]);return _0x25e88b(_0x494389['error']['message']);}logger[_0x4402('0x24')](_0x4402('0x1f'),_0x19fe7b,_0x494389[_0x4402('0x24')][_0x4402('0x25')]);return _0x399c24(_0x494389[_0x4402('0x24')][_0x4402('0x25')]);}else{logger[_0x4402('0x1e')](_0x4402('0x1f'),_0x19fe7b,_0x4402('0x26'));_0x399c24(_0x494389['result'][_0x4402('0x25')]);}})['catch'](function(_0x3733cd){logger[_0x4402('0x24')](_0x4402('0x1f'),_0x19fe7b,_0x3733cd);_0x25e88b(_0x3733cd);});});}function respondWithStatusCode(_0x211424,_0x5a43d0){_0x5a43d0=_0x5a43d0||0xcc;return function(_0x15c19f){if(_0x15c19f){return _0x211424['sendStatus'](_0x5a43d0);}return _0x211424['status'](_0x5a43d0)[_0x4402('0x27')]();};}function respondWithResult(_0x395e49,_0x327d60){_0x327d60=_0x327d60||0xc8;return function(_0xabf61b){if(_0xabf61b){return _0x395e49[_0x4402('0x28')](_0x327d60)['json'](_0xabf61b);}};}function respondWithFilteredResult(_0x41de44,_0x52e625){return function(_0x71da2f){if(_0x71da2f){var _0x1e2340=typeof _0x52e625[_0x4402('0x29')]==='undefined'&&typeof _0x52e625[_0x4402('0x2a')]===_0x4402('0x2b');var _0x316239=_0x71da2f[_0x4402('0x2c')];var _0x2526d1=_0x1e2340?0x0:_0x52e625[_0x4402('0x29')];var _0x1189b8=_0x1e2340?_0x71da2f[_0x4402('0x2c')]:_0x52e625[_0x4402('0x29')]+_0x52e625[_0x4402('0x2a')];var _0xcea26b;if(_0x1189b8>=_0x316239){_0x1189b8=_0x316239;_0xcea26b=0xc8;}else{_0xcea26b=0xce;}_0x41de44['status'](_0xcea26b);return _0x41de44[_0x4402('0x2d')]('Content-Range',_0x2526d1+'-'+_0x1189b8+'/'+_0x316239)[_0x4402('0x2e')](_0x71da2f);}return null;};}function patchUpdates(_0x554096){return function(_0x2dea0f){try{jsonpatch[_0x4402('0x2f')](_0x2dea0f,_0x554096,!![]);}catch(_0x145003){return BPromise[_0x4402('0x30')](_0x145003);}return _0x2dea0f[_0x4402('0x31')]();};}function saveUpdates(_0x480781,_0x3a60af){return function(_0x3fa7ae){if(_0x3fa7ae){return _0x3fa7ae[_0x4402('0x32')](_0x480781)['then'](function(_0x331c75){return _0x331c75;});}return null;};}function removeEntity(_0x3383e3,_0x535e1d){return function(_0x2db1fe){if(_0x2db1fe){return _0x2db1fe[_0x4402('0x33')]()[_0x4402('0x34')](function(){_0x3383e3[_0x4402('0x28')](0xcc)[_0x4402('0x27')]();});}};}function handleEntityNotFound(_0x235f30,_0x1e67ac){return function(_0x6e9fb7){if(!_0x6e9fb7){_0x235f30[_0x4402('0x35')](0x194);}return _0x6e9fb7;};}function handleError(_0x5c819a,_0x2995b6){_0x2995b6=_0x2995b6||0x1f4;return function(_0x28fee8){logger[_0x4402('0x24')](_0x28fee8['stack']);if(_0x28fee8[_0x4402('0x36')]){delete _0x28fee8[_0x4402('0x36')];}_0x5c819a['status'](_0x2995b6)['send'](_0x28fee8);};}function getMustacheRender(_0x2b9d51,_0x5b7c2e){return Mustache[_0x4402('0x37')](_0x2b9d51,_[_0x4402('0x38')](_0x5b7c2e['body'],{'contact':_0x5b7c2e['contact'],'message':_0x5b7c2e['message'],'agent':_0x5b7c2e[_0x4402('0x39')],'interaction':_0x5b7c2e[_0x4402('0x3a')],'account':_0x5b7c2e[_0x4402('0x3b')]}))||'';}function getInteractionUsers(_0x3fd8ce,_0x52af0d){return new BPromise(function(_0x20579c,_0x7d5f2a){try{if(_0x52af0d[_0x3fd8ce['id']]){_0x3fd8ce[_0x4402('0x3c')]=_['map'](_0x52af0d[_0x3fd8ce['id']],function(_0x2b92b7){return{'id':_0x2b92b7['id'],'fullname':_0x2b92b7['fullname']};});}}catch(_0x6e328a){_0x7d5f2a(_0x6e328a);}_0x20579c(_0x3fd8ce);});}function getInteractionTags(_0x3ef31d,_0x5c74b1){return new BPromise(function(_0x16ef2e,_0x529526){try{if(_0x3ef31d[_0x4402('0x3d')]){_0x3ef31d[_0x4402('0x3e')]=[];_0x3ef31d['TagIds'][_0x4402('0x3f')](',')[_0x4402('0x40')](function(_0x250f09){_0x3ef31d[_0x4402('0x3e')]['push'](_0x5c74b1[_0x250f09]);});}delete _0x3ef31d['TagIds'];}catch(_0x2cda0a){_0x529526(_0x2cda0a);}_0x16ef2e(_0x3ef31d);});}function updateChatInteraction(_0x47a3a3,_0x3a589b,_0x2a6d78){return new BPromise(function(_0xb9cf85,_0x2e2391){return getInteractionUsers(_0x47a3a3,_0x2a6d78)[_0x4402('0x34')](function(_0x455a62){return getInteractionTags(_0x455a62,_0x3a589b);})[_0x4402('0x34')](function(_0x390169){_0xb9cf85(_0x390169);})[_0x4402('0x41')](function(_0x42812b){_0x2e2391(_0x42812b);});});}exports['index']=function(_0x14b94b,_0x3236fc){var _0x5e7872={},_0x214eec={},_0x370878={'count':0x0,'rows':[]};var _0x50552a=_[_0x4402('0x42')](db[_0x4402('0x43')][_0x4402('0x44')],function(_0x3278fc){return{'name':_0x3278fc[_0x4402('0x45')],'type':_0x3278fc['type'][_0x4402('0x46')]};});_0x214eec[_0x4402('0x47')]=_[_0x4402('0x42')](_0x50552a,_0x4402('0x36'));_0x214eec[_0x4402('0x48')]=_[_0x4402('0x49')](_0x14b94b[_0x4402('0x48')]);_0x214eec[_0x4402('0x4a')]=_[_0x4402('0x4b')](_0x214eec[_0x4402('0x47')],_0x214eec[_0x4402('0x48')]);_0x5e7872['attributes']=_[_0x4402('0x4b')](_0x214eec['model'],qs[_0x4402('0x4c')](_0x14b94b[_0x4402('0x48')]['fields']));_0x5e7872[_0x4402('0x4d')]=_0x5e7872[_0x4402('0x4d')][_0x4402('0x4e')]?_0x5e7872[_0x4402('0x4d')]:_0x214eec[_0x4402('0x47')];if(!_0x14b94b[_0x4402('0x48')]['hasOwnProperty'](_0x4402('0x4f'))){_0x5e7872[_0x4402('0x2a')]=qs[_0x4402('0x2a')](_0x14b94b[_0x4402('0x48')][_0x4402('0x2a')]);_0x5e7872[_0x4402('0x29')]=qs[_0x4402('0x29')](_0x14b94b[_0x4402('0x48')][_0x4402('0x29')]);}_0x5e7872['order']=qs['sort'](_0x14b94b['query']['sort']);_0x5e7872[_0x4402('0x50')]=qs[_0x4402('0x4a')](_[_0x4402('0x51')](_0x14b94b[_0x4402('0x48')],_0x214eec['filters']),_0x50552a);var _0x169bb2=[];var _0x12d6de=squel[_0x4402('0x52')]()[_0x4402('0x53')]('id')[_0x4402('0x53')](_0x4402('0x36'))[_0x4402('0x53')]('color')[_0x4402('0x54')](_0x4402('0x55'));var _0x38e6d1=squel[_0x4402('0x52')]()[_0x4402('0x53')](_0x4402('0x56'))['field'](_0x4402('0x57'))[_0x4402('0x53')](_0x4402('0x58'))[_0x4402('0x54')](_0x4402('0x59'),'ui')[_0x4402('0x5a')](_0x4402('0x5b'),'u','u.id\x20=\x20ui.UserId');var _0x48e138=squel[_0x4402('0x52')]()[_0x4402('0x54')](_0x4402('0x5c'),'i')['left_join']('cm_contacts','c',_0x4402('0x5d'))[_0x4402('0x5a')](_0x4402('0x5b'),'o',_0x4402('0x5e'))[_0x4402('0x5a')](_0x4402('0x5f'),'a',_0x4402('0x60'))[_0x4402('0x5a')](_0x4402('0x61'),'me',_0x4402('0x62'))[_0x4402('0x5a')](_0x4402('0x63'),'it',_0x4402('0x64'))['left_join'](_0x4402('0x55'),'t','t.id\x20=\x20it.TagId');var _0xe4530a=squel['expr']();var _0x3fb9f0=[];var _0x1e5891=squel[_0x4402('0x65')]();var _0x31e36c;if(_0x14b94b[_0x4402('0x48')][_0x4402('0x66')]){_0x31e36c=as['parseSearch'](_0x14b94b[_0x4402('0x48')][_0x4402('0x66')]);var _0xa390ce=_0x31e36c[_0x4402('0x67')];for(var _0xb341ab=0x0;_0xb341ab<_0x31e36c['conditions'][_0x4402('0x4e')];_0xb341ab++){var _0x31d993=_0x31e36c[_0x4402('0x68')][_0xb341ab];var _0xc15c0b='i';var _0x309077=_[_0x4402('0x69')](_0x50552a,[_0x4402('0x36'),_0x31d993[_0x4402('0x53')]]);if(!_0x309077){switch(_0x31d993['field']){case _0x4402('0x6a'):if(_0x31d993[_0x4402('0x6b')]==0x1){_0x48e138['having']('`'+_0x31d993[_0x4402('0x53')]+_0x4402('0x6c'));}else{_0x48e138['having']('`'+_0x31d993['field']+_0x4402('0x6d'));}break;case _0x4402('0x6e'):if(_0x31d993[_0x4402('0x6f')]==='$substring'){if(_0x31d993[_0x4402('0x6b')][_0x4402('0x3f')]('\x20')[_0x4402('0x4e')]>0x1){_0xe4530a[_0xa390ce]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4402('0x70')](_0x31d993[_0x4402('0x6b')]),null);}else{var _0xdde09f='%'+_0x31d993['value']+'%';_0xe4530a[_0xa390ce](_0x4402('0x71'),_0xdde09f,_0xdde09f,_0xdde09f);}}else{_0x309077=_[_0x4402('0x69')](_0x50552a,['name','ContactId']);_0x31d993[_0x4402('0x53')]='ContactId';_0x53e553=as[_0x4402('0x72')](_0xc15c0b,_0x309077[_0x4402('0x73')],_0x31d993);_0xe4530a[_0xa390ce](_0x53e553['text'],_0x53e553['value'][_0x4402('0x74')],_0x53e553[_0x4402('0x6b')][_0x4402('0x27')]);}break;case _0x4402('0x75'):var _0x4ac95e=_0x31d993[_0x4402('0x6b')][_0x4402('0x3f')](',')[_0x4402('0x42')](function(_0x168095){return Number(_0x168095);});_0x4ac95e[_0x4402('0x40')](function(_0x26b1ad){_0x1e5891['or'](_0x4402('0x76'),'%,'+_0x26b1ad+',%');});_0x3fb9f0=_['union'](_0x3fb9f0,_0x4ac95e);break;case _0x4402('0x77'):if(_0x31d993[_0x4402('0x6f')]==='$substring'){_0xe4530a[_0xa390ce]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x31d993[_0x4402('0x6b')]+'%',null);}else{_0x309077=_['find'](_0x50552a,[_0x4402('0x36'),'UserId']);_0x31d993[_0x4402('0x53')]=_0x4402('0x78');_0x53e553=as[_0x4402('0x72')](_0xc15c0b,_0x309077[_0x4402('0x73')],_0x31d993);_0xe4530a[_0xa390ce](_0x53e553[_0x4402('0x79')],_0x53e553[_0x4402('0x6b')][_0x4402('0x74')],_0x53e553[_0x4402('0x6b')][_0x4402('0x27')]);}break;case _0x4402('0x7a'):_0x53e553=as[_0x4402('0x72')]('me',null,_0x31d993);_0xe4530a[_0xa390ce](_0x53e553[_0x4402('0x79')],_0x53e553[_0x4402('0x6b')][_0x4402('0x74')],_0x53e553[_0x4402('0x6b')][_0x4402('0x27')]);break;}}else{var _0x53e553=as[_0x4402('0x72')](_0xc15c0b,_0x309077[_0x4402('0x73')],_0x31d993);_0xe4530a[_0xa390ce](_0x53e553[_0x4402('0x79')],_0x53e553['value'][_0x4402('0x74')],_0x53e553['value'][_0x4402('0x27')]);}}}else{var _0x1b1147=_(_0x14b94b[_0x4402('0x48')])[_0x4402('0x49')]()['map'](function(_0xac8513){return _['some'](_0x50552a,[_0x4402('0x36'),_0xac8513])?_0xac8513:undefined;})[_0x4402('0x7b')]()[_0x4402('0x6b')]();if(!_['isEmpty'](_0x1b1147)){_0x1b1147[_0x4402('0x40')](function(_0x4c98eb){if(_0x4c98eb===_0x4402('0x7c')){_0x48e138[_0x4402('0x50')](_0x4402('0x7d'),[][_0x4402('0x7e')](_0x14b94b[_0x4402('0x48')][_0x4c98eb]));}else if(_0x4c98eb===_0x4402('0x7f')){var _0x19b427=JSON[_0x4402('0x80')](_0x14b94b[_0x4402('0x48')][_0x4c98eb])['$gte'];var _0x44d806=JSON[_0x4402('0x80')](_0x14b94b[_0x4402('0x48')][_0x4c98eb])[_0x4402('0x81')];_0x48e138[_0x4402('0x50')](_0x4402('0x82'),_0x19b427,_0x44d806);}else{if(_0x14b94b[_0x4402('0x48')][_0x4c98eb]===_0x4402('0x83')){_0x48e138[_0x4402('0x50')]('i.'+_0x4c98eb+'\x20IS\x20NULL');}else{_0x48e138[_0x4402('0x50')]('i.'+_0x4c98eb+_0x4402('0x84'),_0x14b94b[_0x4402('0x48')][_0x4c98eb]);}}});}if(_0x14b94b['query'][_0x4402('0x85')]){if(_0x14b94b['query'][_0x4402('0x85')]==0x1){_0x48e138['having'](_0x4402('0x86'));}else{_0x48e138[_0x4402('0x87')]('`unreadMessages`\x20>\x200');}}if(_0x14b94b[_0x4402('0x48')]['tag']){_0x3fb9f0=_[_0x4402('0x88')](_0x14b94b[_0x4402('0x48')]['tag'])?_0x14b94b[_0x4402('0x48')][_0x4402('0x89')]:new Array(_0x14b94b['query'][_0x4402('0x89')]);_0x3fb9f0[_0x4402('0x40')](function(_0x4f0915){_0x1e5891['or'](_0x4402('0x76'),'%,'+_0x4f0915+',%');});}if(_0x14b94b[_0x4402('0x48')][_0x4402('0x8a')]){var _0x12b834=_0x14b94b[_0x4402('0x48')][_0x4402('0x8a')][_0x4402('0x8b')]('\x5c','\x5c\x5c')[_0x4402('0x8b')](/'/g,'\x27\x27');if(qs[_0x4402('0x8c')](_0x12b834)){_0xe4530a['or'](_0x4402('0x8d'),_0x12b834+'%');}else{_0xe4530a['or'](_0x4402('0x8e'),qs[_0x4402('0x70')](_0x12b834))['or'](_0x4402('0x8f'),_0x12b834+'%');}}}_0x48e138[_0x4402('0x50')](_0xe4530a);_0x48e138['group'](_0x4402('0x90'));var _0xc3914e={'type':db['Sequelize'][_0x4402('0x91')]['SELECT'],'raw':!![]};var _0x2c7ff5=_0x48e138[_0x4402('0x92')]();_0x2c7ff5[_0x4402('0x53')]('i.id');_0x2c7ff5[_0x4402('0x53')](_0x4402('0x93'),_0x4402('0x6a'));if(_0x5e7872['order']){_0x5e7872[_0x4402('0x94')][_0x4402('0x40')](function(_0x179eb4){var _0x1a0a6f=_0x179eb4[0x0]==='contactName'?_0x179eb4[0x0]:'i.'+_0x179eb4[0x0];_0x48e138[_0x4402('0x94')](_0x1a0a6f,_0x179eb4[0x1]===_0x4402('0x95')?![]:!![]);});}if(!_[_0x4402('0x96')](_0x3fb9f0)){_0x48e138[_0x4402('0x87')](_0x1e5891);_0x2c7ff5[_0x4402('0x50')](_0x4402('0x97'),_0x3fb9f0);}BPromise[_0x4402('0x98')]()[_0x4402('0x34')](function(){if(!_0x31e36c){if(_0x14b94b[_0x4402('0x48')][_0x4402('0x7c')])return;_0x2c7ff5[_0x4402('0x50')](_0x4402('0x99'));_0x48e138[_0x4402('0x50')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x14b94b[_0x4402('0x9a')][_0x4402('0x9b')]!==_0x4402('0x39'))return;return _0x14b94b[_0x4402('0x9a')]['getChatWebsites']({'attributes':['id'],'raw':!![]})['then'](function(_0x284b52){if(_[_0x4402('0x96')](_0x284b52)){_0x2c7ff5[_0x4402('0x50')](_0x4402('0x9c'));_0x48e138['where'](_0x4402('0x9c'));}else{_0x2c7ff5[_0x4402('0x50')]('i.ChatWebsiteId\x20IN\x20?',_[_0x4402('0x42')](_0x284b52,'id'));_0x48e138[_0x4402('0x50')](_0x4402('0x7d'),_[_0x4402('0x42')](_0x284b52,'id'));}});})[_0x4402('0x34')](function(){if(_0x14b94b['user'][_0x4402('0x9b')]===_0x4402('0x39')&&!_0x31e36c&&!_0x14b94b[_0x4402('0x48')][_0x4402('0x7c')])return[];return db[_0x4402('0x9d')][_0x4402('0x48')](_0x2c7ff5[_0x4402('0x9e')](),_0xc3914e);})['then'](function(_0x218640){_0x370878[_0x4402('0x2c')]=_0x218640[_0x4402('0x4e')];if(_0x370878[_0x4402('0x2c')]===0x0)return[];return db[_0x4402('0x9d')]['query'](_0x12d6de[_0x4402('0x9e')](),_0xc3914e)[_0x4402('0x34')](function(_0x572e21){_0x169bb2=_[_0x4402('0x9f')](_0x572e21,'id');_0xc3914e=_['merge'](_0xc3914e,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x14b94b[_0x4402('0x48')]['fields']){_0x5e7872[_0x4402('0x4d')]['forEach'](function(_0x51e85d){_0x48e138[_0x4402('0x53')]('i.'+_0x51e85d);});}else{_0x48e138[_0x4402('0x53')](_0x4402('0x93'),_0x4402('0x6a'));_0x48e138[_0x4402('0x53')](_0x4402('0xa0'),'Account.key');_0x48e138[_0x4402('0x53')](_0x4402('0xa1'),'Account.mandatoryDisposition');_0x48e138[_0x4402('0x53')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x48e138[_0x4402('0x53')]('i.*');_0x48e138[_0x4402('0x53')](_0x4402('0xa2'),_0x4402('0xa3'));_0x48e138[_0x4402('0x53')](_0x4402('0xa4'),'Contact.lastName');_0x48e138['field'](_0x4402('0xa5'),_0x4402('0xa6'));_0x48e138['field'](_0x4402('0xa7'),_0x4402('0xa8'));_0x48e138[_0x4402('0x53')](_0x4402('0xa9'),_0x4402('0xaa'));_0x48e138[_0x4402('0x53')]('c.fax','Contact.fax');_0x48e138[_0x4402('0x53')](_0x4402('0xab'),_0x4402('0xac'));_0x48e138[_0x4402('0x53')](_0x4402('0xad'),_0x4402('0xae'));_0x48e138['field'](_0x4402('0xaf'),_0x4402('0x3d'));}if(_0x5e7872[_0x4402('0x2a')])_0x48e138[_0x4402('0x2a')](_0x5e7872[_0x4402('0x2a')]);if(_0x5e7872['offset'])_0x48e138[_0x4402('0x29')](_0x5e7872[_0x4402('0x29')]);return db[_0x4402('0x9d')][_0x4402('0x48')](_0x48e138[_0x4402('0x9e')](),_0xc3914e);})[_0x4402('0x34')](function(_0x518b0b){if(_0x518b0b['length']>0x0)_0x38e6d1[_0x4402('0x50')]('ui.ChatInteractionId\x20IN\x20?',_[_0x4402('0x42')](_0x518b0b,'id'));return db[_0x4402('0x9d')][_0x4402('0x48')](_0x38e6d1[_0x4402('0x9e')](),_0xc3914e)[_0x4402('0x34')](function(_0x25b3ee){var _0x70bdbd=_[_0x4402('0xb0')](_0x25b3ee,_0x4402('0xb1'));var _0x23306f=[];_0x518b0b[_0x4402('0x40')](function(_0x425a1b){_0x23306f[_0x4402('0xb2')](updateChatInteraction(_0x425a1b,_0x169bb2,_0x70bdbd));});return BPromise[_0x4402('0xb3')](_0x23306f);});});})[_0x4402('0x34')](function(_0x1ba5a1){_0x370878[_0x4402('0xb4')]=_0x1ba5a1;return _0x370878;})[_0x4402('0x34')](respondWithFilteredResult(_0x3236fc,_0x5e7872))[_0x4402('0x41')](handleError(_0x3236fc,null));};exports[_0x4402('0xb5')]=function(_0xe37b11,_0x385b8e){var _0x418070={'raw':![],'where':{'id':_0xe37b11[_0x4402('0xb6')]['id']}},_0x47a76a={};_0x47a76a[_0x4402('0x47')]=_[_0x4402('0x49')](db[_0x4402('0x43')][_0x4402('0x44')]);_0x47a76a[_0x4402('0x48')]=_['keys'](_0xe37b11['query']);_0x47a76a[_0x4402('0x4a')]=_[_0x4402('0x4b')](_0x47a76a[_0x4402('0x47')],_0x47a76a['query']);_0x418070['attributes']=_['intersection'](_0x47a76a['model'],qs[_0x4402('0x4c')](_0xe37b11[_0x4402('0x48')][_0x4402('0x4c')]));_0x418070['attributes']=_0x418070[_0x4402('0x4d')][_0x4402('0x4e')]?_0x418070[_0x4402('0x4d')]:_0x47a76a['model'];if(_0xe37b11[_0x4402('0x48')]['includeAll']){_0x418070[_0x4402('0xb7')]=[{'all':!![]}];}_0x418070=_[_0x4402('0x38')]({},_0x418070,_0xe37b11[_0x4402('0xb8')]);return db[_0x4402('0x43')][_0x4402('0x69')](_0x418070)[_0x4402('0x34')](handleEntityNotFound(_0x385b8e,null))['then'](respondWithResult(_0x385b8e,null))[_0x4402('0x41')](handleError(_0x385b8e,null));};exports[_0x4402('0xb9')]=function(_0x3ac6b9,_0x55c3fd){return db[_0x4402('0x43')]['create'](_0x3ac6b9[_0x4402('0x7a')],{})[_0x4402('0x34')](respondWithResult(_0x55c3fd,0xc9))[_0x4402('0x41')](handleError(_0x55c3fd,null));};exports[_0x4402('0x32')]=function(_0x54d6dc,_0x91c49){if(_0x54d6dc[_0x4402('0x7a')]['id']){delete _0x54d6dc[_0x4402('0x7a')]['id'];}return db[_0x4402('0x43')][_0x4402('0x69')]({'where':{'id':_0x54d6dc['params']['id']}})[_0x4402('0x34')](handleEntityNotFound(_0x91c49,null))[_0x4402('0x34')](saveUpdates(_0x54d6dc['body'],null))['then'](respondWithResult(_0x91c49,null))['catch'](handleError(_0x91c49,null));};exports[_0x4402('0x33')]=function(_0x42b774,_0x246ff2){return db[_0x4402('0x43')]['find']({'where':{'id':_0x42b774[_0x4402('0xb6')]['id']}})[_0x4402('0x34')](handleEntityNotFound(_0x246ff2,null))[_0x4402('0x34')](removeEntity(_0x246ff2,null))[_0x4402('0x41')](handleError(_0x246ff2,null));};exports['describe']=function(_0x2a3361,_0x2949ce){return db[_0x4402('0x43')]['describe']()['then'](respondWithResult(_0x2949ce,null))['catch'](handleError(_0x2949ce,null));};exports[_0x4402('0xba')]=function(_0x48bf30,_0x17c5c2){var _0x35c16f=_0x48bf30[_0x4402('0xb6')]['id'];var _0x117911;var _0x87ae2a;var _0xd604a5;return db[_0x4402('0x43')][_0x4402('0xbb')]({'where':{'id':_0x35c16f}})[_0x4402('0x34')](function(_0x423f83){_0x117911=_0x423f83;return db[_0x4402('0xbc')][_0x4402('0xbb')]({'where':{'id':_0x423f83[_0x4402('0x7c')]},'attributes':['id',_0x4402('0xbd'),'vidaooEscalation',_0x4402('0xbe'),_0x4402('0xbf'),'vidaooMetadata'],'raw':!![]});})['then'](function(_0x57fd83){if(_0x57fd83&&_0x57fd83[_0x4402('0xbd')]&&_0x57fd83['vidaooEscalation']){_0x87ae2a=_0x57fd83;var _0x47aa8b={'interaction':{'id':_0x35c16f},'agent':{'id':_0x48bf30[_0x4402('0x9a')]['id'],'name':_0x48bf30[_0x4402('0x9a')]['name'],'fullname':_0x48bf30[_0x4402('0x9a')][_0x4402('0xc0')],'email':_0x48bf30[_0x4402('0x9a')][_0x4402('0xc1')]},'contact':_0x48bf30['body'][_0x4402('0xc2')],'account':_0x48bf30[_0x4402('0x7a')][_0x4402('0x3b')]};var _0x286500={'rejectUnauthorized':![],'method':_0x4402('0xc3'),'url':_0x4402('0xc4'),'headers':{'X-APIKEY':_0x57fd83[_0x4402('0xbd')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x48bf30[_0x4402('0x9a')][_0x4402('0xc1')]],'buttons':null,'topic':_0x87ae2a['vidaooTopic'],'note':_[_0x4402('0xc5')](_0x87ae2a[_0x4402('0xbf')])?null:getMustacheRender(_0x87ae2a[_0x4402('0xbf')],_0x47aa8b),'metadata':null},'redirect':_0x4402('0xc6'),'json':!![]};try{if(!_['isNull'](_0x87ae2a[_0x4402('0xc7')])){var _0x4bf0ff=getMustacheRender(_0x87ae2a[_0x4402('0xc7')],_0x47aa8b);var _0x29ffd4=JSON['parse'](_0x4bf0ff);_0x286500['body'][_0x4402('0xc8')]=_0x29ffd4;}}catch(_0x173f64){throw new db[(_0x4402('0xc9'))][(_0x4402('0xca'))](_0x4402('0xcb'));}return rp(_0x286500);}else{throw new db[(_0x4402('0xc9'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})[_0x4402('0x34')](function(_0x54e61e){_0xd604a5=_0x54e61e;if(_0xd604a5['id']){var _0xc47081={'body':_0xd604a5[_0x4402('0xcc')],'ChatWebsiteId':_0x87ae2a['id'],'ChatInteractionId':_0x117911['id'],'direction':_0x4402('0xcd'),'UserId':_0x48bf30[_0x4402('0x9a')]['id']};return db['ChatMessage'][_0x4402('0xb9')](_0xc47081,{});}else{throw new db[(_0x4402('0xc9'))][(_0x4402('0xca'))](_0x4402('0xce'));}})[_0x4402('0x34')](function(){return _0x117911[_0x4402('0xcf')]({'vidaooSessionId':_0xd604a5['id']});})['then'](respondWithResult(_0x17c5c2,null))['catch'](handleError(_0x17c5c2,null));};exports[_0x4402('0xd0')]=function(_0x5a768b,_0x38d7b5){if(_0x5a768b[_0x4402('0x7a')]['id']){delete _0x5a768b['body']['id'];}return db[_0x4402('0x43')]['find']({'where':{'id':_0x5a768b[_0x4402('0xb6')]['id']},'include':[{'model':db[_0x4402('0xd1')],'as':_0x4402('0x6e')}]})['then'](handleEntityNotFound(_0x38d7b5,null))[_0x4402('0x34')](saveUpdates(_0x5a768b['body'],null))[_0x4402('0x34')](respondWithResult(_0x38d7b5,null))[_0x4402('0x41')](handleError(_0x38d7b5,null));};exports[_0x4402('0xd2')]=function(_0x1fc790,_0xaaf390,_0x53be9e){if(_0x1fc790['body']['id']){delete _0x1fc790[_0x4402('0x7a')]['id'];}return db['ChatInteraction'][_0x4402('0x69')]({'where':{'id':_0x1fc790[_0x4402('0xb6')]['id']}})['then'](function(_0x50d453){if(!_0x50d453){logger[_0x4402('0x24')](_0x4402('0xd3'),_0x4402('0xd2'),0x194,_0x4402('0xd4'));_0xaaf390[_0x4402('0x35')](0x194);}else{if(_0x50d453[_0x4402('0x78')]){throw new db[(_0x4402('0xc9'))][(_0x4402('0xca'))]('Interaction\x20already\x20assigned');}}return _0x50d453;})['then'](function(_0xf3be9){if(_0xf3be9){return _0xf3be9[_0x4402('0x32')]({'closed':_0x1fc790[_0x4402('0x7a')]['closed'],'disposition':_0x1fc790[_0x4402('0x7a')]['disposition']})[_0x4402('0x34')](function(_0x1237a3){return _0x1237a3;});}})[_0x4402('0x34')](function(_0x4a0fd9){return respondWithRpcPromise(_0x4402('0xd5'),_0x4402('0xd2'),_0x1fc790['body'],client9004);})[_0x4402('0x34')](respondWithResult(_0xaaf390,null))[_0x4402('0x41')](handleError(_0xaaf390,null));};exports[_0x4402('0xd6')]=function(_0x8c436d,_0x15e9d3,_0xa0d1ee){_0x8c436d[_0x4402('0x7a')][_0x4402('0x36')]=_0x8c436d[_0x4402('0xd7')][_0x4402('0xd8')];_0x8c436d[_0x4402('0x7a')][_0x4402('0xd9')]=_0x8c436d['file'][_0x4402('0xda')];_0x8c436d[_0x4402('0x7a')][_0x4402('0x73')]=_0x8c436d[_0x4402('0xd7')][_0x4402('0xdb')];return db[_0x4402('0xdc')][_0x4402('0xb9')](_0x8c436d[_0x4402('0x7a')])[_0x4402('0x34')](respondWithResult(_0x15e9d3,0xc9))['catch'](handleError(_0x15e9d3,null));};exports[_0x4402('0xdd')]=function(_0x113451,_0x338e97,_0x4c6d4e){return db[_0x4402('0x43')][_0x4402('0xbb')]({'where':{'id':_0x113451['params']['id']},'raw':!![]})[_0x4402('0x34')](handleEntityNotFound(_0x338e97,null))[_0x4402('0x34')](function(_0x491a8e){if(_0x491a8e){if(_0x491a8e['closed']){return _0x338e97[_0x4402('0x28')](0x193)[_0x4402('0x2e')]({'status':0x193,'message':_0x4402('0xde')});}return db[_0x4402('0xdc')]['findOne']({'where':{'id':_0x113451[_0x4402('0x48')]['attachId']},'raw':!![]})[_0x4402('0x34')](handleEntityNotFound(_0x338e97,null));}})[_0x4402('0x34')](function(_0x171672){if(_0x171672){var _0xdbd1c8=_0x171672[_0x4402('0xdf')]!==null;var _0x5d190e=path[_0x4402('0xe0')](config[_0x4402('0xe1')],_0x4402('0xe2'));if(_0xdbd1c8){_0x5d190e=path[_0x4402('0xe0')](_0x5d190e,_0x4402('0xe3'));}var _0x23de88=path[_0x4402('0xe0')](_0x5d190e,_0x171672[_0x4402('0xd9')]);return _0x338e97[_0x4402('0xe4')](_0x23de88);}})[_0x4402('0x41')](handleError(_0x338e97,null));};exports[_0x4402('0xe5')]=function(_0x55274b,_0x2afc41){var _0x1c5cad=null;var _0x3b8f77=null;var _0x2b3b75=null;var _0x1ba411=null;if(_0x55274b[_0x4402('0x7a')]['id']){delete _0x55274b[_0x4402('0x7a')]['id'];}if(_0x55274b[_0x4402('0x7a')][_0x4402('0xe6')]){_0x1ba411=path[_0x4402('0xe0')](config['root'],_0x4402('0xe7'),util[_0x4402('0xe8')](_0x4402('0xe9'),Date['now']()));_0x55274b[_0x4402('0x7a')][_0x4402('0xea')]=_0x1ba411;}return db['ChatInteraction'][_0x4402('0x69')]({'where':{'id':_0x55274b[_0x4402('0xb6')]['id']},'include':[{'model':db[_0x4402('0xeb')],'as':_0x4402('0xec'),'include':[{'model':db[_0x4402('0x77')],'as':_0x4402('0x77')}]}]})[_0x4402('0x34')](handleEntityNotFound(_0x2afc41,null))[_0x4402('0x34')](saveUpdates(_0x55274b[_0x4402('0x7a')],null))[_0x4402('0x34')](function(_0x2d86c7){if(_0x2d86c7){_0x1c5cad=_0x2d86c7;return db['ChatWebsite'][_0x4402('0x69')]({'where':{'id':_0x1c5cad[_0x4402('0x7c')]}});}})[_0x4402('0x34')](function(_0x47837e){if(_0x47837e){_0x2b3b75=_0x47837e;return db[_0x4402('0xd1')][_0x4402('0x69')]({'where':{'id':_0x1c5cad[_0x4402('0xed')]}});}})[_0x4402('0x34')](function(_0x259c23){if(_0x259c23){_0x3b8f77=_0x259c23;if(_0x1ba411){var _0x535d83=null;for(var _0x2f3d6e=0x1;_0x2f3d6e<_0x1c5cad['Messages'][_0x4402('0x4e')];++_0x2f3d6e){_0x535d83=_0x1c5cad[_0x4402('0xec')][_0x2f3d6e];var _0x395d17=_0x535d83[_0x4402('0x78')]?util[_0x4402('0xe8')](_0x4402('0xee'),_0x2b3b75[_0x4402('0xef')],_0x535d83[_0x4402('0x78')]):_0x4402('0xf0');var _0x51bdf7=_0x55274b[_0x4402('0x7a')]['customer']||util[_0x4402('0xe8')](_0x4402('0xee'),_0x4402('0xf1'),_0x535d83[_0x4402('0xed')]);switch(_0x2b3b75[_0x4402('0xf2')]){case _0x4402('0xf3'):_0x395d17=_0x535d83['UserId']?util[_0x4402('0xe8')]('%s%d',_0x2b3b75[_0x4402('0xef')],_0x535d83['UserId']):_0x4402('0xf0');break;case _0x4402('0xf4'):_0x395d17=_0x535d83[_0x4402('0x78')]?_0x535d83[_0x4402('0x77')][_0x4402('0xf5')]||_0x535d83[_0x4402('0x77')][_0x4402('0xc0')]:_0x4402('0xf0');break;case _0x4402('0xf6'):_0x395d17=_0x535d83['UserId']?_0x535d83[_0x4402('0x77')]['fullname']:'System';break;default:_0x395d17=_0x535d83['UserId']?util[_0x4402('0xe8')](_0x4402('0xee'),_0x2b3b75[_0x4402('0xef')],_0x535d83['UserId']):_0x4402('0xf0');}var _0x1accec=util[_0x4402('0xe8')](_0x4402('0xf7'),moment(_0x535d83[_0x4402('0x7f')])[_0x4402('0xe8')](_0x4402('0xf8')),_0x535d83[_0x4402('0xf9')]==='in'?_0x51bdf7:_0x395d17,_0x535d83[_0x4402('0x7a')]);if(!_0x535d83[_0x4402('0xfa')]){fs[_0x4402('0xfb')](_0x1ba411,_0x1accec);}}return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x4402('0xfc')],'as':_0x4402('0xfd'),'raw':!![]}]});}}})[_0x4402('0x34')](function(_0x23dbb4){if(_0x23dbb4&&_0x23dbb4[_0x4402('0xfd')]&&_0x55274b['body']){var _0x494b72={'tls':{'rejectUnauthorized':![]}};if(_0x23dbb4[_0x4402('0xfd')][_0x4402('0xfe')]){_0x494b72[_0x4402('0xfe')]=_0x23dbb4[_0x4402('0xfd')][_0x4402('0xfe')];}else{_0x494b72[_0x4402('0xff')]=_0x23dbb4[_0x4402('0xfd')][_0x4402('0xff')];_0x494b72[_0x4402('0x100')]=_0x23dbb4[_0x4402('0xfd')][_0x4402('0x100')];_0x494b72[_0x4402('0x101')]=_0x23dbb4[_0x4402('0xfd')][_0x4402('0x101')];}if(_0x23dbb4[_0x4402('0xfd')][_0x4402('0x102')]){_0x494b72[_0x4402('0x103')]={'user':_0x23dbb4[_0x4402('0xfd')][_0x4402('0x9a')],'pass':_0x23dbb4[_0x4402('0xfd')][_0x4402('0x104')]};}return respondWithRpcPromise(_0x4402('0x105'),_0x4402('0x106'),{'account':_0x494b72,'message':{'from':util[_0x4402('0xe8')](_0x4402('0x107'),_0x23dbb4[_0x4402('0x36')],_0x23dbb4['email']||_0x23dbb4[_0x4402('0xfd')][_0x4402('0x9a')]),'to':_0x55274b[_0x4402('0x7a')][_0x4402('0xe6')],'subject':_0x4402('0x108'),'text':util[_0x4402('0xe8')](_0x4402('0x109'),_0x55274b[_0x4402('0x7a')][_0x4402('0xe6')]),'attachments':[{'path':_0x1ba411}]}})['then'](function(){return _0x1c5cad;})[_0x4402('0x41')](function(_0x3ba561){console[_0x4402('0x24')](_0x3ba561);});}else{return _0x1c5cad;}})[_0x4402('0x34')](respondWithStatusCode(_0x2afc41,0xc8))[_0x4402('0x41')](handleError(_0x2afc41,null));};exports[_0x4402('0x10a')]=function(_0x10f917,_0x1155d1,_0x17c1ee){return db['ChatMessage'][_0x4402('0x69')]({'where':{'id':_0x10f917[_0x4402('0xb6')]['id']}})[_0x4402('0x34')](handleEntityNotFound(_0x1155d1,null))[_0x4402('0x34')](function(_0x37ea8d){if(_0x37ea8d){return _0x37ea8d[_0x4402('0x10a')](_0x10f917[_0x4402('0x7a')]['ids'],_[_0x4402('0x10b')](_0x10f917[_0x4402('0x7a')],['ids','id'])||{});}})[_0x4402('0x34')](respondWithResult(_0x1155d1,null))[_0x4402('0x41')](handleError(_0x1155d1,null));};exports[_0x4402('0x10c')]=function(_0x3e78da,_0x1bf636,_0x44b095){var _0x2433a1={'raw':![],'where':{}};var _0x4069cf={};var _0x7be513={'count':0x0,'rows':[]};return db[_0x4402('0x43')][_0x4402('0xbb')]({'where':{'id':_0x3e78da[_0x4402('0xb6')]['id']}})[_0x4402('0x34')](handleEntityNotFound(_0x1bf636,null))[_0x4402('0x34')](function(_0x1f2219){if(_0x1f2219){_0x4069cf[_0x4402('0x47')]=_[_0x4402('0x49')](db[_0x4402('0xeb')][_0x4402('0x44')]);_0x4069cf[_0x4402('0x48')]=_[_0x4402('0x49')](_0x3e78da[_0x4402('0x48')]);_0x4069cf[_0x4402('0x4a')]=_[_0x4402('0x4b')](_0x4069cf[_0x4402('0x47')],_0x4069cf[_0x4402('0x48')]);_0x2433a1[_0x4402('0x4d')]=_[_0x4402('0x4b')](_0x4069cf[_0x4402('0x47')],qs[_0x4402('0x4c')](_0x3e78da[_0x4402('0x48')]['fields']));_0x2433a1[_0x4402('0x4d')]=_0x2433a1['attributes']['length']?_0x2433a1[_0x4402('0x4d')]:_0x4069cf[_0x4402('0x47')];if(!_0x3e78da[_0x4402('0x48')][_0x4402('0x10d')](_0x4402('0x4f'))){_0x2433a1['limit']=qs[_0x4402('0x2a')](_0x3e78da[_0x4402('0x48')][_0x4402('0x2a')]);_0x2433a1['offset']=qs[_0x4402('0x29')](_0x3e78da[_0x4402('0x48')][_0x4402('0x29')]);}_0x2433a1[_0x4402('0x94')]=qs['sort'](_0x3e78da[_0x4402('0x48')][_0x4402('0x10e')]);_0x2433a1['where']=qs['filters'](_['pick'](_0x3e78da['query'],_0x4069cf[_0x4402('0x4a')]));_0x2433a1[_0x4402('0x50')][_0x4402('0xb1')]=_0x1f2219['id'];if(_0x3e78da['query'][_0x4402('0x8a')]){_0x2433a1[_0x4402('0x50')]=_[_0x4402('0x38')](_0x2433a1['where'],{'$or':_[_0x4402('0x42')](_0x2433a1[_0x4402('0x4d')],function(_0x2466a1){var _0x55ed20={};_0x55ed20[_0x2466a1]={'$like':'%'+_0x3e78da[_0x4402('0x48')][_0x4402('0x8a')]+'%'};return _0x55ed20;})});}if(_0x3e78da['query'][_0x4402('0x10f')]){var _0x335d93=_0x3e78da[_0x4402('0x48')][_0x4402('0x10f')]['split'](',');var _0x3aebf6={};_0x3aebf6[_0x335d93[0x0]]={'$gte':moment(_0x335d93[0x1])['format'](_0x4402('0x110'))};_0x2433a1['where']=_['merge'](_0x2433a1[_0x4402('0x50')],_0x3aebf6);}_0x2433a1=_[_0x4402('0x38')]({},_0x2433a1,_0x3e78da[_0x4402('0xb8')]);return db[_0x4402('0xeb')][_0x4402('0x2c')]({'where':_0x2433a1[_0x4402('0x50')]})[_0x4402('0x34')](function(_0x87e1c){_0x7be513['count']=_0x87e1c;if(_0x3e78da[_0x4402('0x48')][_0x4402('0x111')]){_0x2433a1[_0x4402('0xb7')]=[{'all':!![]}];}return db[_0x4402('0xeb')][_0x4402('0x112')](_0x2433a1);})['then'](function(_0x20b540){_0x7be513['rows']=_0x20b540;return _0x7be513;});}})[_0x4402('0x34')](respondWithFilteredResult(_0x1bf636,_0x2433a1))[_0x4402('0x41')](handleError(_0x1bf636,null));};exports[_0x4402('0x113')]=function(_0x516583,_0x182827,_0x284292){var _0x579bab={'where':{}},_0x30cdd6={},_0x1ac943={'count':0x0,'rows':[]};return db[_0x4402('0x43')][_0x4402('0xbb')]({'where':{'id':_0x516583[_0x4402('0xb6')]['id']}})[_0x4402('0x34')](handleEntityNotFound(_0x182827,null))[_0x4402('0x34')](function(_0xe8f398){if(_0xe8f398){_0x30cdd6[_0x4402('0x47')]=_[_0x4402('0x49')](db[_0x4402('0xeb')][_0x4402('0x44')]);_0x30cdd6[_0x4402('0x48')]=_[_0x4402('0x49')](_0x516583['query']);_0x30cdd6[_0x4402('0x4a')]=_[_0x4402('0x4b')](_0x30cdd6[_0x4402('0x47')],_0x30cdd6[_0x4402('0x48')]);_0x579bab[_0x4402('0x4d')]=_[_0x4402('0x4b')](_0x30cdd6[_0x4402('0x47')],qs[_0x4402('0x4c')](_0x516583['query'][_0x4402('0x4c')]));_0x579bab[_0x4402('0x4d')]=_0x579bab[_0x4402('0x4d')]['length']?_0x579bab[_0x4402('0x4d')]:_0x30cdd6[_0x4402('0x47')];if(!_0x516583[_0x4402('0x48')][_0x4402('0x10d')](_0x4402('0x4f'))){_0x579bab[_0x4402('0x2a')]=qs[_0x4402('0x2a')](_0x516583['query']['limit']);_0x579bab[_0x4402('0x29')]=qs[_0x4402('0x29')](_0x516583[_0x4402('0x48')][_0x4402('0x29')]);}_0x579bab[_0x4402('0x94')]=qs['sort'](_0x516583[_0x4402('0x48')][_0x4402('0x10e')]);_0x579bab[_0x4402('0x50')]=qs['filters'](_[_0x4402('0x51')](_0x516583['query'],_0x30cdd6[_0x4402('0x4a')]));_0x579bab[_0x4402('0x50')][_0x4402('0xb1')]=_0xe8f398['id'];if(_0x516583[_0x4402('0x48')]['filter']){_0x579bab[_0x4402('0x50')]=_[_0x4402('0x38')](_0x579bab[_0x4402('0x50')],{'$or':_[_0x4402('0x42')](_0x579bab[_0x4402('0x4d')],function(_0x3adad4){var _0x207b70={};_0x207b70[_0x3adad4]={'$like':'%'+_0x516583['query']['filter']+'%'};return _0x207b70;})});}_0x579bab[_0x4402('0x50')][_0x4402('0xfa')]=![];if(_0x516583[_0x4402('0x48')]['id']){_0x579bab['where']['id']={'$gt':_0x516583[_0x4402('0x48')]['id']};}_0x579bab=_[_0x4402('0x38')]({},_0x579bab,_0x516583[_0x4402('0xb8')]);return db['ChatMessage'][_0x4402('0x2c')]({'where':_0x579bab['where']})[_0x4402('0x34')](function(_0x2903fd){_0x1ac943[_0x4402('0x2c')]=_0x2903fd;_0x579bab['include']=[];if(_0x516583[_0x4402('0x48')][_0x4402('0x114')]){_0x579bab['include']['push']({'model':db['User'],'as':'User','attributes':['id',_0x4402('0xc0'),'alias']});}if(_0x516583['query'][_0x4402('0x111')]){_0x579bab['include']=[{'all':!![]}];}return db[_0x4402('0xeb')][_0x4402('0x112')](_0x579bab);})['then'](function(_0x230904){_0x1ac943[_0x4402('0xb4')]=_0x230904;return _0x1ac943;});}})[_0x4402('0x34')](respondWithFilteredResult(_0x182827,_0x579bab))['catch'](handleError(_0x182827,null));};exports[_0x4402('0x115')]=function(_0x5f42bc,_0x50999c,_0xc4375e){return db['ChatInteraction'][_0x4402('0x69')]({'where':{'id':_0x5f42bc['params']['id']}})[_0x4402('0x34')](handleEntityNotFound(_0x50999c,null))[_0x4402('0x34')](function(_0x21a6d2){if(_0x21a6d2){return _0x21a6d2[_0x4402('0x116')](_0x5f42bc[_0x4402('0x7a')][_0x4402('0x117')],_[_0x4402('0x10b')](_0x5f42bc[_0x4402('0x7a')],[_0x4402('0x117'),'id'])||{})[_0x4402('0x118')](function(){return db[_0x4402('0x75')][_0x4402('0x112')]({'attributes':['id',_0x4402('0x36'),_0x4402('0x119')],'where':{'id':_0x5f42bc[_0x4402('0x7a')]['ids']}});})[_0x4402('0x34')](function(_0x132621){socket[_0x4402('0x11a')](_0x4402('0x11b'),{'id':Number(_0x5f42bc[_0x4402('0xb6')]['id']),'tags':_0x132621||[]});return{'id':Number(_0x5f42bc[_0x4402('0xb6')]['id']),'tags':_0x132621||[]};});}})[_0x4402('0x34')](respondWithResult(_0x50999c,null))[_0x4402('0x41')](handleError(_0x50999c,null));};exports[_0x4402('0x11c')]=function(_0x4e0ae2,_0x21e2c8,_0x1845d8){return db[_0x4402('0x43')]['find']({'where':{'id':_0x4e0ae2[_0x4402('0xb6')]['id']}})['then'](handleEntityNotFound(_0x21e2c8,null))[_0x4402('0x34')](function(_0x424e93){if(_0x424e93){return _0x424e93[_0x4402('0x11c')](_0x4e0ae2[_0x4402('0x48')]['ids']);}})[_0x4402('0x34')](respondWithStatusCode(_0x21e2c8,null))['catch'](handleError(_0x21e2c8,null));};exports[_0x4402('0xe4')]=function(_0x4cb0bf,_0x2a586e){var _0x5325a7=moment()[_0x4402('0x11d')]()['toString']();var _0x157060=path[_0x4402('0xe0')](config[_0x4402('0xe1')],_0x4402('0x11e'),_0x4402('0x11f'),_0x4402('0x120'));var _0x2ead56=path[_0x4402('0xe0')](config['root'],_0x4402('0x11e'),_0x4402('0x11f'),_0x4402('0x121'));var _0x31d19c=path[_0x4402('0xe0')](_0x157060,_0x5325a7);var _0x1675b2=util[_0x4402('0xe8')](_0x4402('0x122'),_0x4cb0bf['params']['id'],_0x5325a7);var _0xe5e2f3=path[_0x4402('0xe0')](_0x157060,_0x1675b2);var _0x22c8a1=[];_0x22c8a1[_0x4402('0xb2')]({'model':db[_0x4402('0x77')],'as':_0x4402('0x77'),'attributes':['id',_0x4402('0xc0')],'raw':!![]});_0x22c8a1[_0x4402('0xb2')]({'model':db[_0x4402('0xd1')],'as':_0x4402('0x6e'),'attributes':['id',_0x4402('0x123'),'lastName'],'raw':!![]});if(_0x4cb0bf[_0x4402('0x48')]['attachments']){_0x22c8a1[_0x4402('0xb2')]({'model':db[_0x4402('0xdc')],'as':_0x4402('0xdc'),'raw':!![]});}var _0x177297=[{'model':db['ChatMessage'],'as':_0x4402('0xec'),'attributes':['id','body',_0x4402('0x7f'),'direction',_0x4402('0xfa'),_0x4402('0x85')],'include':_0x22c8a1}];_0x177297[_0x4402('0xb2')]({'model':db[_0x4402('0xbc')],'as':_0x4402('0x124'),'attributes':['id',_0x4402('0x36')]});_0x177297[_0x4402('0xb2')]({'model':db[_0x4402('0x77')],'as':'Owner','attributes':['id',_0x4402('0xc0')]});return db[_0x4402('0x43')][_0x4402('0x69')]({'where':{'id':_0x4cb0bf[_0x4402('0xb6')]['id']},'include':_0x177297})[_0x4402('0x34')](handleEntityNotFound(_0x2a586e,null))[_0x4402('0x34')](function(_0x140207){if(_0x140207){var _0x1d2478=_0x140207[_0x4402('0x125')]({'plain':!![]});fs[_0x4402('0x126')](_0x31d19c);var _0x286a77={'channel':_0x4402('0x127'),'account':_0x1d2478[_0x4402('0x124')][_0x4402('0x36')],'agent':_0x1d2478['Owner']?_0x1d2478[_0x4402('0x128')][_0x4402('0xc0')]:_0x4402('0x129'),'createdAt':moment(_0x1d2478[_0x4402('0x7f')])[_0x4402('0xe8')](_0x4402('0x110'))[_0x4402('0x9e')](),'closedAt':_0x1d2478[_0x4402('0x12a')]?moment(_0x1d2478['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x4402('0x9e')]():'','disposition':_0x1d2478['disposition'],'chatInfo':{'browser':_0x1d2478[_0x4402('0x12b')],'os':_0x1d2478['osName'],'referer':_0x1d2478[_0x4402('0x12c')],'customerIp':_0x1d2478[_0x4402('0x12d')],'customerPort':_0x1d2478[_0x4402('0x12e')]?_0x1d2478['customerPort']:_0x4402('0x129')},'messages':_(_0x1d2478[_0x4402('0xec')])[_0x4402('0x12f')]()[_0x4402('0x8a')]({'secret':![]})['map'](function(_0x633496){if(_0x633496[_0x4402('0xdc')]){var _0x5862a7=path[_0x4402('0xe0')](_0x2ead56,_0x633496['Attachment'][_0x4402('0xd9')]);if(fs[_0x4402('0x130')](_0x5862a7)){fs[_0x4402('0x131')](_0x5862a7)[_0x4402('0x132')](fs[_0x4402('0x133')](path[_0x4402('0xe0')](_0x31d19c,_0x633496[_0x4402('0xdc')][_0x4402('0xd9')])));}}return{'date':moment(_0x633496[_0x4402('0x7f')])[_0x4402('0xe8')](_0x4402('0x110'))[_0x4402('0x9e')](),'sender':_0x633496['direction']===_0x4402('0xcd')?_0x633496[_0x4402('0x77')]?_0x633496[_0x4402('0x77')][_0x4402('0xc0')]:_0x4402('0xf0'):_0x633496['Contact'][_0x4402('0x123')]+(_0x633496[_0x4402('0x6e')][_0x4402('0x134')]?'\x20'+_0x633496[_0x4402('0x6e')][_0x4402('0x134')]:''),'body':_0x633496[_0x4402('0xdc')]?_0x633496[_0x4402('0xdc')]['basename']:_0x633496[_0x4402('0x7a')],'direction':_0x633496['direction']===_0x4402('0xcd')?'A':'C','secret':_0x633496[_0x4402('0xfa')],'read':_0x633496[_0x4402('0x85')],'attachment':_0x633496['Attachment']};})[_0x4402('0x6b')]()};return ejs[_0x4402('0x135')](path[_0x4402('0xe0')](config[_0x4402('0xe1')],_0x4402('0x11e'),'views','downloadInteraction.ejs'),{'interaction':_0x286a77})['then'](function(_0x5b8cd8){var _0x3fc6b3=path[_0x4402('0xe0')](_0x31d19c,'transcript-'+_0x1d2478['id']+'-'+_0x5325a7+_0x4402('0x136'));var _0x15bbe1={'path':_0x3fc6b3,'channel':_0x4402('0x127'),'interactionId':_0x1d2478['id']};return pdf[_0x4402('0x137')](_0x5b8cd8,_0x15bbe1);})[_0x4402('0x34')](function(){return new BPromise(function(_0x303680,_0x281eaa){zipdir(_0x31d19c,{'saveTo':_0xe5e2f3},function(_0x1baf42,_0x3d743e){if(_0x1baf42)return _0x281eaa(_0x1baf42);return _0x303680(_0x3d743e);});})[_0x4402('0x34')](function(){return new BPromise(function(_0x5ad41f,_0xbeb577){rimraf(_0x31d19c,function(_0x8c8f01){if(_0x8c8f01)_0xbeb577(_0x8c8f01);return _0x5ad41f();});});})[_0x4402('0x34')](function(){return _0x2a586e[_0x4402('0xe4')](_0xe5e2f3,_0x1675b2,function(_0xc36aed){if(_0xc36aed){console['log'](_0x4402('0x138'),_0xc36aed);}else{fs[_0x4402('0x139')](_0xe5e2f3);}});});});}else{return _0x2a586e[_0x4402('0x35')](0xc8);}})[_0x4402('0x41')](handleError(_0x2a586e,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 6331b94..1d3a0bb 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 _0xeae5=['catch','hasOwnProperty','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','map','findAll','then','setDataValue','unreadMessages','length','emit'];(function(_0x144c95,_0x55dc04){var _0x21a474=function(_0x490698){while(--_0x490698){_0x144c95['push'](_0x144c95['shift']());}};_0x21a474(++_0x55dc04);}(_0xeae5,0x1f0));var _0x5eae=function(_0x252ac8,_0xdeb607){_0x252ac8=_0x252ac8-0x0;var _0x6de399=_0xeae5[_0x252ac8];return _0x6de399;};'use strict';var EventEmitter=require(_0x5eae('0x0'));var ChatInteraction=require(_0x5eae('0x1'))['db'][_0x5eae('0x2')];var ChatMessage=require(_0x5eae('0x1'))['db'][_0x5eae('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x5eae('0x4')](0x0);var events={'afterCreate':_0x5eae('0x5'),'afterUpdate':_0x5eae('0x6'),'afterDestroy':'remove'};function emitEvent(_0x45f344){return function(_0x1ddf01,_0x41520a,_0x2d89a3){_0x1ddf01['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x4a2486){_0x1ddf01['setDataValue']('Users',_0x4a2486[_0x5eae('0x7')](function(_0x1ef17b){return{'id':_0x1ef17b['id']};}));return ChatMessage[_0x5eae('0x8')]({'where':{'ChatInteractionId':_0x1ddf01['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5eae('0x9')](function(_0x37588b){_0x1ddf01[_0x5eae('0xa')](_0x5eae('0xb'),_0x37588b[_0x5eae('0xc')]);ChatInteractionEvents[_0x5eae('0xd')](_0x45f344+':'+_0x1ddf01['id'],_0x1ddf01);ChatInteractionEvents[_0x5eae('0xd')](_0x45f344,_0x1ddf01);_0x2d89a3(null);})[_0x5eae('0xe')](_0x2d89a3(null));};}for(var e in events){if(events[_0x5eae('0xf')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x5eae('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0xa479=['save','update','remove','getUsers','setDataValue','Users','map','findAll','then','emit','catch','hook','exports','events','ChatInteraction','../../mysqldb','ChatMessage'];(function(_0x59e665,_0x3a05c1){var _0x548c15=function(_0x17173d){while(--_0x17173d){_0x59e665['push'](_0x59e665['shift']());}};_0x548c15(++_0x3a05c1);}(_0xa479,0x1d8));var _0x9a47=function(_0x4f5f06,_0x921b8){_0x4f5f06=_0x4f5f06-0x0;var _0x30f7a2=_0xa479[_0x4f5f06];return _0x30f7a2;};'use strict';var EventEmitter=require(_0x9a47('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x9a47('0x1')];var ChatMessage=require(_0x9a47('0x2'))['db'][_0x9a47('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9a47('0x4'),'afterUpdate':_0x9a47('0x5'),'afterDestroy':_0x9a47('0x6')};function emitEvent(_0x32e967){return function(_0x38c679,_0x446ca1,_0x57b35b){_0x38c679[_0x9a47('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5ccf19){_0x38c679[_0x9a47('0x8')](_0x9a47('0x9'),_0x5ccf19[_0x9a47('0xa')](function(_0x15f1b1){return{'id':_0x15f1b1['id']};}));return ChatMessage[_0x9a47('0xb')]({'where':{'ChatInteractionId':_0x38c679['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9a47('0xc')](function(_0xa4187c){_0x38c679[_0x9a47('0x8')]('unreadMessages',_0xa4187c['length']);ChatInteractionEvents['emit'](_0x32e967+':'+_0x38c679['id'],_0x38c679);ChatInteractionEvents[_0x9a47('0xd')](_0x32e967,_0x38c679);_0x57b35b(null);})[_0x9a47('0xe')](_0x57b35b(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x9a47('0xf')](e,emitEvent(event));}}module[_0x9a47('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 15cf456..e07e58b 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 _0xaed7=['../../config/environment','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x1557c3,_0x5e6999){var _0x4227cb=function(_0x14c893){while(--_0x14c893){_0x1557c3['push'](_0x1557c3['shift']());}};_0x4227cb(++_0x5e6999);}(_0xaed7,0x1aa));var _0x7aed=function(_0x162b3e,_0x49a58b){_0x162b3e=_0x162b3e-0x0;var _0x3c206e=_0xaed7[_0x162b3e];return _0x3c206e;};'use strict';var _=require('lodash');var util=require(_0x7aed('0x0'));var logger=require(_0x7aed('0x1'))('api');var moment=require(_0x7aed('0x2'));var BPromise=require(_0x7aed('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7aed('0x4'));var rimraf=require(_0x7aed('0x5'));var config=require(_0x7aed('0x6'));var attributes=require(_0x7aed('0x7'));module[_0x7aed('0x8')]=function(_0x3ffb33,_0xe96ee2){return _0x3ffb33['define'](_0x7aed('0x9'),attributes,{'tableName':_0x7aed('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x491971,_0x5ddfe0,_0x4c639d){if(_0x491971[_0x7aed('0xb')](_0x7aed('0xc'))){_0x491971[_0x7aed('0xd')]=moment()[_0x7aed('0xe')](_0x7aed('0xf'));}_0x4c639d(null,_0x491971);}},'charset':_0x7aed('0x10'),'collate':_0x7aed('0x11')});}; \ No newline at end of file +var _0x9803=['./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','changed','closed','format','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x503583,_0x1891ce){var _0x4d386f=function(_0xfcabb8){while(--_0xfcabb8){_0x503583['push'](_0x503583['shift']());}};_0x4d386f(++_0x1891ce);}(_0x9803,0x125));var _0x3980=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9803[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x3980('0x0'));var util=require(_0x3980('0x1'));var logger=require(_0x3980('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3980('0x3'));var rp=require(_0x3980('0x4'));var fs=require('fs');var path=require(_0x3980('0x5'));var rimraf=require(_0x3980('0x6'));var config=require('../../config/environment');var attributes=require(_0x3980('0x7'));module[_0x3980('0x8')]=function(_0x3ed702,_0x4b6727){return _0x3ed702['define'](_0x3980('0x9'),attributes,{'tableName':_0x3980('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5eef90,_0x5c4a51,_0x30c89c){if(_0x5eef90[_0x3980('0xb')](_0x3980('0xc'))){_0x5eef90['closedAt']=moment()[_0x3980('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x30c89c(null,_0x5eef90);}},'charset':'utf8mb4','collate':_0x3980('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index d8250c6..b1bc6e9 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 _0x36aa=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','ChatInteraction','body','options','raw','attributes','limit','UpdateChatInteraction','stringify','catch','find','where','addTags','ids','spread','AddTags','lodash','util'];(function(_0x504315,_0x4813fe){var _0xf99b17=function(_0x477f0e){while(--_0x477f0e){_0x504315['push'](_0x504315['shift']());}};_0xf99b17(++_0x4813fe);}(_0x36aa,0x1ea));var _0xa36a=function(_0x2b28d9,_0x94546d){_0x2b28d9=_0x2b28d9-0x0;var _0x109778=_0x36aa[_0x2b28d9];return _0x109778;};'use strict';var _=require(_0xa36a('0x0'));var util=require(_0xa36a('0x1'));var moment=require(_0xa36a('0x2'));var BPromise=require(_0xa36a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa36a('0x4'));var db=require(_0xa36a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa36a('0x6'))(_0xa36a('0x7'));var config=require(_0xa36a('0x8'));var jayson=require(_0xa36a('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xa36a('0xa')]=_['defaults'](config[_0xa36a('0xa')],{'host':_0xa36a('0xb'),'port':0x18eb});var socket=require(_0xa36a('0xc'))(new Redis(config['redis']));require(_0xa36a('0xd'))[_0xa36a('0xe')](socket);function respondWithRpcPromise(_0x37e035,_0x797fd6,_0x5b2f18){return new BPromise(function(_0x3c1c2d,_0x2e04c8){return client[_0xa36a('0xf')](_0x37e035,_0x5b2f18)[_0xa36a('0x10')](function(_0x3f2d5a){logger[_0xa36a('0x11')](_0xa36a('0x12'),_0x797fd6,_0xa36a('0x13'));logger[_0xa36a('0x14')](_0xa36a('0x15'),_0x797fd6,'request\x20sent',JSON['stringify'](_0x3f2d5a));if(_0x3f2d5a['error']){if(_0x3f2d5a[_0xa36a('0x16')][_0xa36a('0x17')]===0x1f4){logger['error'](_0xa36a('0x12'),_0x797fd6,_0x3f2d5a[_0xa36a('0x16')][_0xa36a('0x18')]);return _0x2e04c8(_0x3f2d5a[_0xa36a('0x16')][_0xa36a('0x18')]);}logger[_0xa36a('0x16')](_0xa36a('0x12'),_0x797fd6,_0x3f2d5a[_0xa36a('0x16')][_0xa36a('0x18')]);return _0x3c1c2d(_0x3f2d5a[_0xa36a('0x16')][_0xa36a('0x18')]);}else{logger[_0xa36a('0x11')](_0xa36a('0x12'),_0x797fd6,'request\x20sent');_0x3c1c2d(_0x3f2d5a[_0xa36a('0x19')][_0xa36a('0x18')]);}})['catch'](function(_0x7eb89a){logger['error'](_0xa36a('0x12'),_0x797fd6,_0x7eb89a);_0x2e04c8(_0x7eb89a);});});}exports['UpdateChatInteraction']=function(_0x4c9168){var _0xa783ef=this;return new Promise(function(_0x3c8d9b,_0x2f7ee1){return db[_0xa36a('0x1a')]['update'](_0x4c9168[_0xa36a('0x1b')],{'raw':_0x4c9168['options']?_0x4c9168[_0xa36a('0x1c')][_0xa36a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c9168[_0xa36a('0x1c')]?_0x4c9168['options']['where']||null:null,'attributes':_0x4c9168[_0xa36a('0x1c')]?_0x4c9168[_0xa36a('0x1c')][_0xa36a('0x1e')]||null:null,'limit':_0x4c9168[_0xa36a('0x1c')]?_0x4c9168[_0xa36a('0x1c')][_0xa36a('0x1f')]||null:null})[_0xa36a('0x10')](function(_0xb0706a){logger[_0xa36a('0x11')]('UpdateChatInteraction',_0x4c9168);logger[_0xa36a('0x14')](_0xa36a('0x20'),_0x4c9168,JSON[_0xa36a('0x21')](_0xb0706a));_0x3c8d9b(_0xb0706a);})[_0xa36a('0x22')](function(_0x826d07){logger['error'](_0xa36a('0x20'),_0x826d07[_0xa36a('0x18')],_0x4c9168);_0x2f7ee1(_0xa783ef[_0xa36a('0x16')](0x1f4,_0x826d07['message']));});});};exports['AddTagsToChatInteraction']=function(_0x47b837){return new Promise(function(_0x4d71f8,_0x2cdcb1){return db['ChatInteraction'][_0xa36a('0x23')]({'where':_0x47b837[_0xa36a('0x1c')]?_0x47b837[_0xa36a('0x1c')][_0xa36a('0x24')]||null:null})[_0xa36a('0x10')](function(_0x484c33){if(_0x484c33){return _0x484c33[_0xa36a('0x25')](_0x47b837[_0xa36a('0x1b')][_0xa36a('0x26')],_['omit'](_0x47b837[_0xa36a('0x1b')],[_0xa36a('0x26'),'id'])||{});}})[_0xa36a('0x27')](function(_0x2c4c65){logger[_0xa36a('0x11')](_0xa36a('0x28'),_0x47b837);logger[_0xa36a('0x14')](_0xa36a('0x28'),_0x47b837,JSON['stringify'](_0x2c4c65));_0x4d71f8(_0x2c4c65);})[_0xa36a('0x22')](function(_0x4e0941){logger['error'](_0xa36a('0x28'),_0x4e0941[_0xa36a('0x18')],_0x47b837);_0x2cdcb1(_this['error'](0x1f4,_0x4e0941['message']));});});}; \ No newline at end of file +var _0xf10a=['client','http','redis','defaults','localhost','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','UpdateChatInteraction','update','options','raw','where','attributes','stringify','AddTagsToChatInteraction','ChatInteraction','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf10a,0x124));var _0xaf10=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0xf10a[_0x53cf8e];return _0x459197;};'use strict';var _=require(_0xaf10('0x0'));var util=require(_0xaf10('0x1'));var moment=require(_0xaf10('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaf10('0x3'));var db=require(_0xaf10('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xaf10('0x5'))(_0xaf10('0x6'));var config=require(_0xaf10('0x7'));var jayson=require(_0xaf10('0x8'));var client=jayson[_0xaf10('0x9')][_0xaf10('0xa')]({'port':0x232a});config[_0xaf10('0xb')]=_[_0xaf10('0xc')](config[_0xaf10('0xb')],{'host':_0xaf10('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaf10('0xb')]));require(_0xaf10('0xe'))[_0xaf10('0xf')](socket);function respondWithRpcPromise(_0x322b0a,_0x11dece,_0xb5c079){return new BPromise(function(_0x4d66ab,_0x401b05){return client[_0xaf10('0x10')](_0x322b0a,_0xb5c079)[_0xaf10('0x11')](function(_0x52de10){logger[_0xaf10('0x12')](_0xaf10('0x13'),_0x11dece,'request\x20sent');logger[_0xaf10('0x14')](_0xaf10('0x15'),_0x11dece,_0xaf10('0x16'),JSON['stringify'](_0x52de10));if(_0x52de10[_0xaf10('0x17')]){if(_0x52de10['error'][_0xaf10('0x18')]===0x1f4){logger[_0xaf10('0x17')](_0xaf10('0x13'),_0x11dece,_0x52de10['error']['message']);return _0x401b05(_0x52de10[_0xaf10('0x17')][_0xaf10('0x19')]);}logger[_0xaf10('0x17')](_0xaf10('0x13'),_0x11dece,_0x52de10[_0xaf10('0x17')][_0xaf10('0x19')]);return _0x4d66ab(_0x52de10[_0xaf10('0x17')][_0xaf10('0x19')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x11dece,_0xaf10('0x16'));_0x4d66ab(_0x52de10[_0xaf10('0x1a')][_0xaf10('0x19')]);}})[_0xaf10('0x1b')](function(_0xed55ca){logger['error'](_0xaf10('0x13'),_0x11dece,_0xed55ca);_0x401b05(_0xed55ca);});});}exports[_0xaf10('0x1c')]=function(_0x4519b9){var _0x38abc8=this;return new Promise(function(_0x4d0a9e,_0x31db76){return db['ChatInteraction'][_0xaf10('0x1d')](_0x4519b9['body'],{'raw':_0x4519b9[_0xaf10('0x1e')]?_0x4519b9['options'][_0xaf10('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4519b9['options']?_0x4519b9[_0xaf10('0x1e')][_0xaf10('0x20')]||null:null,'attributes':_0x4519b9[_0xaf10('0x1e')]?_0x4519b9['options'][_0xaf10('0x21')]||null:null,'limit':_0x4519b9['options']?_0x4519b9[_0xaf10('0x1e')]['limit']||null:null})[_0xaf10('0x11')](function(_0x50ea4a){logger[_0xaf10('0x12')](_0xaf10('0x1c'),_0x4519b9);logger[_0xaf10('0x14')](_0xaf10('0x1c'),_0x4519b9,JSON[_0xaf10('0x22')](_0x50ea4a));_0x4d0a9e(_0x50ea4a);})[_0xaf10('0x1b')](function(_0x2d5c6d){logger[_0xaf10('0x17')](_0xaf10('0x1c'),_0x2d5c6d[_0xaf10('0x19')],_0x4519b9);_0x31db76(_0x38abc8[_0xaf10('0x17')](0x1f4,_0x2d5c6d[_0xaf10('0x19')]));});});};exports[_0xaf10('0x23')]=function(_0x4ff107){return new Promise(function(_0x20a5f4,_0x36cc93){return db[_0xaf10('0x24')]['find']({'where':_0x4ff107['options']?_0x4ff107[_0xaf10('0x1e')]['where']||null:null})[_0xaf10('0x11')](function(_0xd5d22c){if(_0xd5d22c){return _0xd5d22c[_0xaf10('0x25')](_0x4ff107[_0xaf10('0x26')][_0xaf10('0x27')],_[_0xaf10('0x28')](_0x4ff107[_0xaf10('0x26')],[_0xaf10('0x27'),'id'])||{});}})[_0xaf10('0x29')](function(_0x4aa210){logger['info'](_0xaf10('0x2a'),_0x4ff107);logger['debug']('AddTags',_0x4ff107,JSON[_0xaf10('0x22')](_0x4aa210));_0x20a5f4(_0x4aa210);})[_0xaf10('0x1b')](function(_0x1915b1){logger[_0xaf10('0x17')]('AddTags',_0x1915b1[_0xaf10('0x19')],_0x4ff107);_0x36cc93(_this[_0xaf10('0x17')](0x1f4,_0x1915b1['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 9b266e8..9a4e731 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 _0xe5d5=['length','chatInteraction:','remove','removeListener','register'];(function(_0x3074f3,_0x4f2c03){var _0x53f112=function(_0x4a17af){while(--_0x4a17af){_0x3074f3['push'](_0x3074f3['shift']());}};_0x53f112(++_0x4f2c03);}(_0xe5d5,0x156));var _0x5e5d=function(_0x44b67a,_0x5113fa){_0x44b67a=_0x44b67a-0x0;var _0x2e8cac=_0xe5d5[_0x44b67a];return _0x2e8cac;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save',_0x5e5d('0x0'),'update'];function createListener(_0x9f47d6,_0x4b8ae9){return function(_0x50afd3){_0x4b8ae9['emit'](_0x9f47d6,_0x50afd3);};}function removeListener(_0x3e2410,_0x191980){return function(){ChatInteractionEvents[_0x5e5d('0x1')](_0x3e2410,_0x191980);};}exports[_0x5e5d('0x2')]=function(_0x13bcb7){for(var _0x39077f=0x0,_0x3200d5=events[_0x5e5d('0x3')];_0x39077f<_0x3200d5;_0x39077f++){var _0x23de8d=events[_0x39077f];var _0x131a59=createListener(_0x5e5d('0x4')+_0x23de8d,_0x13bcb7);ChatInteractionEvents['on'](_0x23de8d,_0x131a59);}}; \ No newline at end of file +var _0xe642=['./chatInteraction.events','remove','emit','length'];(function(_0x3e7565,_0x4b38ca){var _0x36c72a=function(_0x4ad6f9){while(--_0x4ad6f9){_0x3e7565['push'](_0x3e7565['shift']());}};_0x36c72a(++_0x4b38ca);}(_0xe642,0x17c));var _0x2e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe642[_0x3dd15e];return _0x231fd0;};'use strict';var ChatInteractionEvents=require(_0x2e64('0x0'));var events=['save',_0x2e64('0x1'),'update'];function createListener(_0x5204c1,_0x46de23){return function(_0x32d2e3){_0x46de23[_0x2e64('0x2')](_0x5204c1,_0x32d2e3);};}function removeListener(_0x3d2a0f,_0x3ebc35){return function(){ChatInteractionEvents['removeListener'](_0x3d2a0f,_0x3ebc35);};}exports['register']=function(_0x4af34a){for(var _0x14eb3d=0x0,_0x54bbbd=events[_0x2e64('0x3')];_0x14eb3d<_0x54bbbd;_0x14eb3d++){var _0x4315b3=events[_0x14eb3d];var _0x15c347=createListener('chatInteraction:'+_0x4315b3,_0x4af34a);ChatInteractionEvents['on'](_0x4315b3,_0x15c347);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index b10a1a5..6102195 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 _0x5657=['../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download','post','create','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','now','replace','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chatinteraction:addtags','put','chatinteraction:update','update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','destroy','exports','util','path','connect-timeout','express','fs-extra'];(function(_0x4d9757,_0x28fad9){var _0x512f60=function(_0xa4947e){while(--_0xa4947e){_0x4d9757['push'](_0x4d9757['shift']());}};_0x512f60(++_0x28fad9);}(_0x5657,0xf5));var _0x7565=function(_0xb3653a,_0xc54c40){_0xb3653a=_0xb3653a-0x0;var _0x27fef5=_0x5657[_0xb3653a];return _0x27fef5;};'use strict';var multer=require('multer');var util=require(_0x7565('0x0'));var path=require(_0x7565('0x1'));var timeout=require(_0x7565('0x2'));var express=require(_0x7565('0x3'));var router=express['Router']();var fs_extra=require(_0x7565('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7565('0x5'));var config=require(_0x7565('0x6'));var controller=require(_0x7565('0x7'));router[_0x7565('0x8')]('/',auth[_0x7565('0x9')](),controller[_0x7565('0xa')]);router[_0x7565('0x8')](_0x7565('0xb'),auth[_0x7565('0x9')](),controller[_0x7565('0xc')]);router[_0x7565('0x8')](_0x7565('0xd'),auth[_0x7565('0xe')](),controller[_0x7565('0xf')]);router[_0x7565('0x8')](_0x7565('0x10'),auth[_0x7565('0xe')](),controller[_0x7565('0x11')]);router[_0x7565('0x8')](_0x7565('0x12'),auth['isAuthenticated'](),controller[_0x7565('0x13')]);router[_0x7565('0x8')](_0x7565('0x14'),auth['isChatInteractionAuthorized'](),controller['getMyMessages']);router['get'](_0x7565('0x15'),auth[_0x7565('0x9')](),controller['download']);router[_0x7565('0x16')]('/',auth[_0x7565('0x9')](),controller[_0x7565('0x17')]);router['post']('/:id/vidaoo',auth[_0x7565('0x9')](),controller[_0x7565('0x18')]);var upload=multer({'storage':multer[_0x7565('0x19')]({'destination':function(_0x3299e,_0x14f3c5,_0x1e3615){_0x1e3615(null,path[_0x7565('0x1a')](config[_0x7565('0x1b')],_0x7565('0x1c')));},'filename':function(_0x3506fc,_0x321cd1,_0x51a166){_0x51a166(null,util[_0x7565('0x1d')]('%s-%s',Date[_0x7565('0x1e')](),_0x321cd1['originalname'][_0x7565('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x7565('0x16')]('/:id/attachment_upload',upload[_0x7565('0x20')](_0x7565('0x21')),controller[_0x7565('0x22')]);router[_0x7565('0x16')](_0x7565('0x12'),auth[_0x7565('0xe')](),controller[_0x7565('0x23')]);router['post'](_0x7565('0x24'),auth['isAuthenticated'](),interaction[_0x7565('0x25')]('chat',_0x7565('0x26')),controller['addTags']);router[_0x7565('0x27')](_0x7565('0xd'),auth['isAuthenticated'](),interaction[_0x7565('0x25')]('chat',_0x7565('0x28')),controller[_0x7565('0x29')]);router[_0x7565('0x27')]('/:id/custom_update',controller[_0x7565('0x2a')]);router[_0x7565('0x27')](_0x7565('0x2b'),auth[_0x7565('0xe')](),controller[_0x7565('0x2c')]);router[_0x7565('0x27')](_0x7565('0x2d'),controller[_0x7565('0x2e')]);router[_0x7565('0x2f')](_0x7565('0xd'),auth[_0x7565('0x9')](),interaction[_0x7565('0x25')]('chat','chatinteraction:destroy'),controller[_0x7565('0x30')]);router[_0x7565('0x2f')](_0x7565('0x24'),auth['isAuthenticated'](),controller['removeTags']);module[_0x7565('0x31')]=router; \ No newline at end of file +var _0x1908=['removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','get','describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/download','download','create','createVidaooSession','diskStorage','root','format','%s-%s','now','replace','post','/:id/attachment_upload','single','file','attachmentUpload','tracked','chatinteraction:addtags','put','/:id','chat','chatinteraction:update','/:id/custom_update','customUpdate','/:id/close','close','delete','chatinteraction:destroy','/:id/tags'];(function(_0x5705a7,_0x464bf1){var _0x5a20a8=function(_0x6ff5fe){while(--_0x6ff5fe){_0x5705a7['push'](_0x5705a7['shift']());}};_0x5a20a8(++_0x464bf1);}(_0x1908,0x95));var _0x8190=function(_0x57c686,_0x5e3d1c){_0x57c686=_0x57c686-0x0;var _0x137d03=_0x1908[_0x57c686];return _0x137d03;};'use strict';var multer=require(_0x8190('0x0'));var util=require(_0x8190('0x1'));var path=require(_0x8190('0x2'));var timeout=require(_0x8190('0x3'));var express=require('express');var router=express[_0x8190('0x4')]();var fs_extra=require(_0x8190('0x5'));var auth=require(_0x8190('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8190('0x7'));var controller=require(_0x8190('0x8'));router['get']('/',auth[_0x8190('0x9')](),controller[_0x8190('0xa')]);router[_0x8190('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x8190('0xc')]);router[_0x8190('0xb')]('/:id',auth[_0x8190('0xd')](),controller[_0x8190('0xe')]);router[_0x8190('0xb')](_0x8190('0xf'),auth[_0x8190('0xd')](),controller[_0x8190('0x10')]);router[_0x8190('0xb')](_0x8190('0x11'),auth[_0x8190('0x9')](),controller[_0x8190('0x12')]);router['get']('/:id/my_messages',auth[_0x8190('0xd')](),controller['getMyMessages']);router['get'](_0x8190('0x13'),auth[_0x8190('0x9')](),controller[_0x8190('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8190('0x15')]);router['post']('/:id/vidaoo',auth[_0x8190('0x9')](),controller[_0x8190('0x16')]);var upload=multer({'storage':multer[_0x8190('0x17')]({'destination':function(_0xbef5b2,_0xc464e6,_0x1bf069){_0x1bf069(null,path['join'](config[_0x8190('0x18')],'server/files/attachments/'));},'filename':function(_0x1714c8,_0x2de930,_0x48ca2e){_0x48ca2e(null,util[_0x8190('0x19')](_0x8190('0x1a'),Date[_0x8190('0x1b')](),_0x2de930['originalname'][_0x8190('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8190('0x1d')](_0x8190('0x1e'),upload[_0x8190('0x1f')](_0x8190('0x20')),controller[_0x8190('0x21')]);router['post'](_0x8190('0x11'),auth[_0x8190('0xd')](),controller['addMessage']);router[_0x8190('0x1d')]('/:id/tags',auth[_0x8190('0x9')](),interaction[_0x8190('0x22')]('chat',_0x8190('0x23')),controller['addTags']);router[_0x8190('0x24')](_0x8190('0x25'),auth['isAuthenticated'](),interaction[_0x8190('0x22')](_0x8190('0x26'),_0x8190('0x27')),controller['update']);router[_0x8190('0x24')](_0x8190('0x28'),controller[_0x8190('0x29')]);router[_0x8190('0x24')]('/:id/abandon',auth[_0x8190('0xd')](),controller['abandon']);router[_0x8190('0x24')](_0x8190('0x2a'),controller[_0x8190('0x2b')]);router[_0x8190('0x2c')](_0x8190('0x25'),auth['isAuthenticated'](),interaction[_0x8190('0x22')]('chat',_0x8190('0x2d')),controller['destroy']);router[_0x8190('0x2c')](_0x8190('0x2e'),auth['isAuthenticated'](),controller[_0x8190('0x2f')]);module[_0x8190('0x30')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 38ac3ee..6d2fb90 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 _0xeb36=['TEXT','medium','INTEGER','sequelize'];(function(_0x1f1241,_0x3f068a){var _0x4030d2=function(_0x21a3e3){while(--_0x21a3e3){_0x1f1241['push'](_0x1f1241['shift']());}};_0x4030d2(++_0x3f068a);}(_0xeb36,0x11b));var _0x6eb3=function(_0x1f8cfa,_0x426e48){_0x1f8cfa=_0x1f8cfa-0x0;var _0x3bfe42=_0xeb36[_0x1f8cfa];return _0x3bfe42;};'use strict';var Sequelize=require(_0x6eb3('0x0'));module['exports']={'body':{'type':Sequelize[_0x6eb3('0x1')](_0x6eb3('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x6eb3('0x3')]}}; \ No newline at end of file +var _0x5702=['TEXT','medium','BOOLEAN','sequelize','exports'];(function(_0x28eb35,_0x185b9d){var _0x45dacd=function(_0x4d5951){while(--_0x4d5951){_0x28eb35['push'](_0x28eb35['shift']());}};_0x45dacd(++_0x185b9d);}(_0x5702,0x9e));var _0x2570=function(_0x267286,_0x5a8f5d){_0x267286=_0x267286-0x0;var _0x3e6ee2=_0x5702[_0x267286];return _0x3e6ee2;};'use strict';var Sequelize=require(_0x2570('0x0'));module[_0x2570('0x1')]={'body':{'type':Sequelize[_0x2570('0x2')](_0x2570('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x2570('0x4')],'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 fd6fa1b..831dd16 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 _0x0105=['fast-json-patch','moment','bluebird','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','end','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','length','include','find','create','describe','lastMessageAt','lastMessage','format','getUsers','User','agent','admin','user','fullname','role','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','autoAssociation','isEmpty','resourceId','push','messages','createdAt','ToId','read','body','all','eml-format','rimraf','zip-dir'];(function(_0x274638,_0x578968){var _0x5755df=function(_0x3227d5){while(--_0x3227d5){_0x274638['push'](_0x274638['shift']());}};_0x5755df(++_0x578968);}(_0x0105,0x1bd));var _0x5010=function(_0x1cb39f,_0x17212a){_0x1cb39f=_0x1cb39f-0x0;var _0x5026ee=_0x0105[_0x1cb39f];return _0x5026ee;};'use strict';var emlformat=require(_0x5010('0x0'));var rimraf=require(_0x5010('0x1'));var zipdir=require(_0x5010('0x2'));var jsonpatch=require(_0x5010('0x3'));var rp=require('request-promise');var moment=require(_0x5010('0x4'));var BPromise=require(_0x5010('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5010('0x6'));var sox=require(_0x5010('0x7'));var csv=require(_0x5010('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5010('0x9'));var _=require('lodash');var squel=require(_0x5010('0xa'));var crypto=require(_0x5010('0xb'));var jsforce=require(_0x5010('0xc'));var deskjs=require(_0x5010('0xd'));var toCsv=require(_0x5010('0x8'));var querystring=require(_0x5010('0xe'));var Papa=require(_0x5010('0xf'));var Redis=require(_0x5010('0x10'));var authService=require(_0x5010('0x11'));var qs=require(_0x5010('0x12'));var as=require(_0x5010('0x13'));var hardwareService=require(_0x5010('0x14'));var logger=require(_0x5010('0x15'))('api');var utils=require(_0x5010('0x16'));var config=require(_0x5010('0x17'));var licenseUtil=require(_0x5010('0x18'));var db=require(_0x5010('0x19'))['db'];config[_0x5010('0x1a')]=_[_0x5010('0x1b')](config[_0x5010('0x1a')],{'host':_0x5010('0x1c'),'port':0x18eb});var socket=require(_0x5010('0x1d'))(new Redis(config[_0x5010('0x1a')]));require(_0x5010('0x1e'))[_0x5010('0x1f')](socket);function respondWithStatusCode(_0x26a12f,_0x28d603){_0x28d603=_0x28d603||0xcc;return function(_0x424564){if(_0x424564){return _0x26a12f[_0x5010('0x20')](_0x28d603);}return _0x26a12f[_0x5010('0x21')](_0x28d603)['end']();};}function respondWithResult(_0x51dde2,_0x1f2407){_0x1f2407=_0x1f2407||0xc8;return function(_0x360c5d){if(_0x360c5d){return _0x51dde2['status'](_0x1f2407)[_0x5010('0x22')](_0x360c5d);}};}function respondWithFilteredResult(_0x119d77,_0x13f417){return function(_0x86460){if(_0x86460){var _0x44f8ff=typeof _0x13f417[_0x5010('0x23')]===_0x5010('0x24')&&typeof _0x13f417[_0x5010('0x25')]==='undefined';var _0x5b14f9=_0x86460[_0x5010('0x26')];var _0x195317=_0x44f8ff?0x0:_0x13f417[_0x5010('0x23')];var _0x4bcb65=_0x44f8ff?_0x86460[_0x5010('0x26')]:_0x13f417['offset']+_0x13f417[_0x5010('0x25')];var _0x5caed2;if(_0x4bcb65>=_0x5b14f9){_0x4bcb65=_0x5b14f9;_0x5caed2=0xc8;}else{_0x5caed2=0xce;}_0x119d77[_0x5010('0x21')](_0x5caed2);return _0x119d77['set'](_0x5010('0x27'),_0x195317+'-'+_0x4bcb65+'/'+_0x5b14f9)[_0x5010('0x22')](_0x86460);}return null;};}function patchUpdates(_0x33bd3b){return function(_0x38ac14){try{jsonpatch['apply'](_0x38ac14,_0x33bd3b,!![]);}catch(_0x5e9fd4){return BPromise['reject'](_0x5e9fd4);}return _0x38ac14[_0x5010('0x28')]();};}function saveUpdates(_0x468ea9,_0x57ddea){return function(_0x5bf20d){if(_0x5bf20d){return _0x5bf20d[_0x5010('0x29')](_0x468ea9)[_0x5010('0x2a')](function(_0x6d3367){return _0x6d3367;});}return null;};}function removeEntity(_0x3a8eb0,_0x370931){return function(_0x1c82eb){if(_0x1c82eb){return _0x1c82eb['destroy']()[_0x5010('0x2a')](function(){_0x3a8eb0[_0x5010('0x21')](0xcc)[_0x5010('0x2b')]();});}};}function handleEntityNotFound(_0x340ba9,_0x23ce20){return function(_0x57acb4){if(!_0x57acb4){_0x340ba9[_0x5010('0x20')](0x194);}return _0x57acb4;};}function handleError(_0x3eadb0,_0x48ba75){_0x48ba75=_0x48ba75||0x1f4;return function(_0x4a3897){logger[_0x5010('0x2c')](_0x4a3897[_0x5010('0x2d')]);if(_0x4a3897[_0x5010('0x2e')]){delete _0x4a3897[_0x5010('0x2e')];}_0x3eadb0['status'](_0x48ba75)[_0x5010('0x2f')](_0x4a3897);};}exports[_0x5010('0x30')]=function(_0xf27724,_0x5f3676){var _0x471c9c={},_0x1fdb58={},_0x43acd2={'count':0x0,'rows':[]};var _0x23ffaf=_[_0x5010('0x31')](db[_0x5010('0x32')][_0x5010('0x33')],function(_0x11cdfe){return{'name':_0x11cdfe[_0x5010('0x34')],'type':_0x11cdfe[_0x5010('0x35')]['key']};});_0x1fdb58[_0x5010('0x36')]=_[_0x5010('0x31')](_0x23ffaf,_0x5010('0x2e'));_0x1fdb58['query']=_[_0x5010('0x37')](_0xf27724[_0x5010('0x38')]);_0x1fdb58[_0x5010('0x39')]=_[_0x5010('0x3a')](_0x1fdb58[_0x5010('0x36')],_0x1fdb58[_0x5010('0x38')]);_0x471c9c['attributes']=_['intersection'](_0x1fdb58[_0x5010('0x36')],qs[_0x5010('0x3b')](_0xf27724[_0x5010('0x38')][_0x5010('0x3b')]));_0x471c9c[_0x5010('0x3c')]=_0x471c9c[_0x5010('0x3c')]['length']?_0x471c9c[_0x5010('0x3c')]:_0x1fdb58[_0x5010('0x36')];if(!_0xf27724[_0x5010('0x38')][_0x5010('0x3d')](_0x5010('0x3e'))){_0x471c9c[_0x5010('0x25')]=qs[_0x5010('0x25')](_0xf27724[_0x5010('0x38')][_0x5010('0x25')]);_0x471c9c[_0x5010('0x23')]=qs[_0x5010('0x23')](_0xf27724[_0x5010('0x38')][_0x5010('0x23')]);}_0x471c9c[_0x5010('0x3f')]=qs['sort'](_0xf27724['query'][_0x5010('0x40')]);_0x471c9c['where']=qs[_0x5010('0x39')](_[_0x5010('0x41')](_0xf27724['query'],_0x1fdb58[_0x5010('0x39')]),_0x23ffaf);if(_0xf27724[_0x5010('0x38')][_0x5010('0x42')]){_0x471c9c[_0x5010('0x43')]=_[_0x5010('0x44')](_0x471c9c[_0x5010('0x43')],{'$or':_[_0x5010('0x31')](_0x23ffaf,function(_0x3e7e0d){if(_0x3e7e0d[_0x5010('0x35')]!==_0x5010('0x45')){var _0x1eb556={};_0x1eb556[_0x3e7e0d[_0x5010('0x2e')]]={'$like':'%'+_0xf27724['query']['filter']+'%'};return _0x1eb556;}})});}_0x471c9c=_['merge']({},_0x471c9c,_0xf27724[_0x5010('0x46')]);var _0xd95878={'where':_0x471c9c['where']};return db[_0x5010('0x32')][_0x5010('0x26')](_0xd95878)[_0x5010('0x2a')](function(_0x423e96){_0x43acd2['count']=_0x423e96;if(_0xf27724[_0x5010('0x38')][_0x5010('0x47')]){_0x471c9c['include']=[{'all':!![]}];}return db[_0x5010('0x32')][_0x5010('0x48')](_0x471c9c);})['then'](function(_0x5d2a31){_0x43acd2[_0x5010('0x49')]=_0x5d2a31;return _0x43acd2;})[_0x5010('0x2a')](respondWithFilteredResult(_0x5f3676,_0x471c9c))[_0x5010('0x4a')](handleError(_0x5f3676,null));};exports['show']=function(_0x5de3f3,_0x5ccf3b){var _0x52ff00={'raw':!![],'where':{'id':_0x5de3f3[_0x5010('0x4b')]['id']}},_0x2cc18f={};_0x2cc18f[_0x5010('0x36')]=_[_0x5010('0x37')](db[_0x5010('0x32')]['rawAttributes']);_0x2cc18f[_0x5010('0x38')]=_[_0x5010('0x37')](_0x5de3f3[_0x5010('0x38')]);_0x2cc18f[_0x5010('0x39')]=_[_0x5010('0x3a')](_0x2cc18f[_0x5010('0x36')],_0x2cc18f[_0x5010('0x38')]);_0x52ff00[_0x5010('0x3c')]=_[_0x5010('0x3a')](_0x2cc18f[_0x5010('0x36')],qs[_0x5010('0x3b')](_0x5de3f3['query'][_0x5010('0x3b')]));_0x52ff00[_0x5010('0x3c')]=_0x52ff00[_0x5010('0x3c')][_0x5010('0x4c')]?_0x52ff00[_0x5010('0x3c')]:_0x2cc18f[_0x5010('0x36')];if(_0x5de3f3[_0x5010('0x38')][_0x5010('0x47')]){_0x52ff00[_0x5010('0x4d')]=[{'all':!![]}];}_0x52ff00=_[_0x5010('0x44')]({},_0x52ff00,_0x5de3f3[_0x5010('0x46')]);return db[_0x5010('0x32')][_0x5010('0x4e')](_0x52ff00)[_0x5010('0x2a')](handleEntityNotFound(_0x5ccf3b,null))[_0x5010('0x2a')](respondWithResult(_0x5ccf3b,null))['catch'](handleError(_0x5ccf3b,null));};exports[_0x5010('0x4f')]=function(_0x13a47a,_0x1c2b6e){return db[_0x5010('0x32')][_0x5010('0x4f')](_0x13a47a['body'],{})[_0x5010('0x2a')](respondWithResult(_0x1c2b6e,0xc9))['catch'](handleError(_0x1c2b6e,null));};exports[_0x5010('0x29')]=function(_0x326bf9,_0x402681){if(_0x326bf9['body']['id']){delete _0x326bf9['body']['id'];}return db['ChatInternalMessage'][_0x5010('0x4e')]({'where':{'id':_0x326bf9[_0x5010('0x4b')]['id']}})[_0x5010('0x2a')](handleEntityNotFound(_0x402681,null))[_0x5010('0x2a')](saveUpdates(_0x326bf9['body'],null))[_0x5010('0x2a')](respondWithResult(_0x402681,null))[_0x5010('0x4a')](handleError(_0x402681,null));};exports['destroy']=function(_0x1d51a5,_0xa33002){return db[_0x5010('0x32')][_0x5010('0x4e')]({'where':{'id':_0x1d51a5[_0x5010('0x4b')]['id']}})[_0x5010('0x2a')](handleEntityNotFound(_0xa33002,null))[_0x5010('0x2a')](removeEntity(_0xa33002,null))[_0x5010('0x4a')](handleError(_0xa33002,null));};exports[_0x5010('0x50')]=function(_0x497fd2,_0x2d8592){return db[_0x5010('0x32')][_0x5010('0x50')]()[_0x5010('0x2a')](respondWithResult(_0x2d8592,null))['catch'](handleError(_0x2d8592,null));};function wrapUser(_0x56eb70){return function(_0xf089df){var _0x579eae=_0x56eb70['get']({'plain':!![]});_0x579eae['messages']=[];if(_0xf089df){_0x579eae[_0x5010('0x51')]=_0xf089df['createdAt'];_0x579eae[_0x5010('0x52')]=_0xf089df;}else{_0x579eae['lastMessageAt']=moment(0x0)[_0x5010('0x53')]('YYYY-MM-DD\x20HH:mm:ss');_0x579eae[_0x5010('0x52')]={};}return _0x579eae;};}exports[_0x5010('0x54')]=function(_0x162fa8,_0x2cbbea,_0x34ac2b){var _0xc8c590=[];return db[_0x5010('0x55')]['findAll']({'where':{'role':[_0x5010('0x56'),_0x5010('0x57'),_0x5010('0x58')]},'attributes':['id',_0x5010('0x59'),_0x5010('0x2e'),_0x5010('0x5a'),'userpic','internal',_0x5010('0x5b'),_0x5010('0x5c'),_0x5010('0x5d'),_0x5010('0x5e')],'order':qs[_0x5010('0x40')](_0x5010('0x5f')),'include':[{'model':db[_0x5010('0x60')],'as':_0x5010('0x61'),'attributes':['id',_0x5010('0x2e'),_0x5010('0x35')],'through':{'attributes':[]}}]})[_0x5010('0x2a')](function(_0x5e2f96){if(_0x5e2f96){var _0x22649c=_0x162fa8[_0x5010('0x58')][_0x5010('0x62')]({'plain':!![]});if(!_0x22649c)throw new Error(_0x5010('0x63'));if(_0x22649c['role']==='user'){return db['UserProfileSection']['find']({'where':{'name':_0x5010('0x64'),'userProfileId':_0x22649c[_0x5010('0x65')]},'raw':!![]})['then'](function(_0x217502){if(_0x217502){if(_0x217502[_0x5010('0x66')]===0x0){return db['UserProfileResource'][_0x5010('0x48')]({'where':{'sectionId':_0x217502['id']},'raw':!![]})['then'](function(_0x312f18){var _0x440629=[];if(_[_0x5010('0x67')](_0x312f18)){_0x440629=_[_0x5010('0x42')](_0x5e2f96,function(_0x2b29bd){if(_0x2b29bd['role']!==_0x5010('0x56')){return _0x2b29bd;}});return _0x440629;}else{for(var _0xcf9073=0x0;_0xcf9073<_0x5e2f96[_0x5010('0x4c')];_0xcf9073++){var _0x1299ce=_0x5e2f96[_0xcf9073];if(_0x1299ce[_0x5010('0x5a')]==='agent'){var _0x3c4509=_[_0x5010('0x4e')](_0x312f18,function(_0xbcec99){return _0xbcec99[_0x5010('0x68')]===_0x1299ce['id'];});if(_0x3c4509)_0x440629[_0x5010('0x69')](_0x1299ce);}else{_0x440629[_0x5010('0x69')](_0x1299ce);}}return _0x440629;}});}else{return _0x5e2f96;}}else{var _0x5086ef=_['filter'](_0x5e2f96,function(_0x31be1c){if(_0x31be1c[_0x5010('0x5a')]!==_0x5010('0x56')){return _0x31be1c;}});return _0x5086ef;}});}else{return _0x5e2f96;}}})[_0x5010('0x2a')](function(_0x159ffc){var _0x42628b=[];if(_0x159ffc){_0xc8c590=_0x159ffc;for(var _0x150a73=0x0;_0x150a73<_0x159ffc[_0x5010('0x4c')];_0x150a73+=0x1){_0xc8c590[_0x150a73][_0x5010('0x6a')]=[];_0x42628b[_0x5010('0x69')](db[_0x5010('0x32')][_0x5010('0x4e')]({'where':{'FromId':[_0x162fa8[_0x5010('0x58')]['id'],_0x159ffc[_0x150a73]['id']],'ToId':[_0x162fa8[_0x5010('0x58')]['id'],_0x159ffc[_0x150a73]['id']],'ChatGroupId':null},'attributes':['id',_0x5010('0x6b'),'FromId',_0x5010('0x6c'),_0x5010('0x6d'),_0x5010('0x6e')],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x5010('0x2a')](wrapUser(_0x159ffc[_0x150a73])));}return BPromise[_0x5010('0x6f')](_0x42628b);}return[];})['then'](function(_0x54b6ac){return{'rows':_0x54b6ac,'count':_0x54b6ac[_0x5010('0x4c')]};})[_0x5010('0x2a')](respondWithResult(_0x2cbbea,null))[_0x5010('0x4a')](handleError(_0x2cbbea,null));}; \ No newline at end of file +var _0x0411=['rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatInternalMessage','then','includeAll','include','findAll','rows','show','catch','create','body','find','params','describe','get','lastMessageAt','createdAt','lastMessage','getUsers','User','agent','admin','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','type','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','messages','FromId','ToId','read','-createdAt','all'];(function(_0x5d1d50,_0x1dc96c){var _0x1846d3=function(_0x24066c){while(--_0x24066c){_0x5d1d50['push'](_0x5d1d50['shift']());}};_0x1846d3(++_0x1dc96c);}(_0x0411,0x14d));var _0x1041=function(_0x324798,_0x32187b){_0x324798=_0x324798-0x0;var _0x4c8cc2=_0x0411[_0x324798];return _0x4c8cc2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1041('0x0'));var zipdir=require(_0x1041('0x1'));var jsonpatch=require(_0x1041('0x2'));var rp=require('request-promise');var moment=require(_0x1041('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1041('0x4'));var util=require(_0x1041('0x5'));var path=require('path');var sox=require(_0x1041('0x6'));var csv=require('to-csv');var ejs=require(_0x1041('0x7'));var fs=require('fs');var fs_extra=require(_0x1041('0x8'));var _=require(_0x1041('0x9'));var squel=require('squel');var crypto=require(_0x1041('0xa'));var jsforce=require(_0x1041('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1041('0xc'));var querystring=require('querystring');var Papa=require(_0x1041('0xd'));var Redis=require('ioredis');var authService=require(_0x1041('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1041('0xf'));var hardwareService=require(_0x1041('0x10'));var logger=require('../../config/logger')(_0x1041('0x11'));var utils=require(_0x1041('0x12'));var config=require(_0x1041('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x1041('0x14'))['db'];config['redis']=_['defaults'](config[_0x1041('0x15')],{'host':_0x1041('0x16'),'port':0x18eb});var socket=require(_0x1041('0x17'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x1041('0x18')](socket);function respondWithStatusCode(_0x5b1ca7,_0x255506){_0x255506=_0x255506||0xcc;return function(_0xa5ef64){if(_0xa5ef64){return _0x5b1ca7['sendStatus'](_0x255506);}return _0x5b1ca7['status'](_0x255506)['end']();};}function respondWithResult(_0x299628,_0x13f7b2){_0x13f7b2=_0x13f7b2||0xc8;return function(_0x4e6bc3){if(_0x4e6bc3){return _0x299628['status'](_0x13f7b2)[_0x1041('0x19')](_0x4e6bc3);}};}function respondWithFilteredResult(_0x5ea122,_0x1c4b2e){return function(_0x275f9a){if(_0x275f9a){var _0x214a4e=typeof _0x1c4b2e[_0x1041('0x1a')]===_0x1041('0x1b')&&typeof _0x1c4b2e[_0x1041('0x1c')]===_0x1041('0x1b');var _0x3a081f=_0x275f9a[_0x1041('0x1d')];var _0x58c461=_0x214a4e?0x0:_0x1c4b2e[_0x1041('0x1a')];var _0x33af67=_0x214a4e?_0x275f9a[_0x1041('0x1d')]:_0x1c4b2e[_0x1041('0x1a')]+_0x1c4b2e['limit'];var _0x4bf88d;if(_0x33af67>=_0x3a081f){_0x33af67=_0x3a081f;_0x4bf88d=0xc8;}else{_0x4bf88d=0xce;}_0x5ea122[_0x1041('0x1e')](_0x4bf88d);return _0x5ea122['set'](_0x1041('0x1f'),_0x58c461+'-'+_0x33af67+'/'+_0x3a081f)[_0x1041('0x19')](_0x275f9a);}return null;};}function patchUpdates(_0x5ee4e8){return function(_0x6fa979){try{jsonpatch[_0x1041('0x20')](_0x6fa979,_0x5ee4e8,!![]);}catch(_0x5b01ae){return BPromise[_0x1041('0x21')](_0x5b01ae);}return _0x6fa979[_0x1041('0x22')]();};}function saveUpdates(_0xbdf64e,_0x1d4c80){return function(_0x214da9){if(_0x214da9){return _0x214da9[_0x1041('0x23')](_0xbdf64e)['then'](function(_0xde241f){return _0xde241f;});}return null;};}function removeEntity(_0x36d9e4,_0xb07c36){return function(_0x24836f){if(_0x24836f){return _0x24836f[_0x1041('0x24')]()['then'](function(){_0x36d9e4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4587b6,_0x4f5ba0){return function(_0x174efa){if(!_0x174efa){_0x4587b6[_0x1041('0x25')](0x194);}return _0x174efa;};}function handleError(_0xe3ea6,_0x4b4b17){_0x4b4b17=_0x4b4b17||0x1f4;return function(_0x275d44){logger['error'](_0x275d44[_0x1041('0x26')]);if(_0x275d44[_0x1041('0x27')]){delete _0x275d44[_0x1041('0x27')];}_0xe3ea6[_0x1041('0x1e')](_0x4b4b17)[_0x1041('0x28')](_0x275d44);};}exports[_0x1041('0x29')]=function(_0x13a41e,_0xe0f7dd){var _0x35cce0={},_0x45c112={},_0x3bf7ff={'count':0x0,'rows':[]};var _0xa099f6=_[_0x1041('0x2a')](db['ChatInternalMessage'][_0x1041('0x2b')],function(_0x788418){return{'name':_0x788418[_0x1041('0x2c')],'type':_0x788418['type'][_0x1041('0x2d')]};});_0x45c112['model']=_[_0x1041('0x2a')](_0xa099f6,'name');_0x45c112[_0x1041('0x2e')]=_[_0x1041('0x2f')](_0x13a41e[_0x1041('0x2e')]);_0x45c112[_0x1041('0x30')]=_[_0x1041('0x31')](_0x45c112['model'],_0x45c112[_0x1041('0x2e')]);_0x35cce0[_0x1041('0x32')]=_[_0x1041('0x31')](_0x45c112[_0x1041('0x33')],qs[_0x1041('0x34')](_0x13a41e['query'][_0x1041('0x34')]));_0x35cce0[_0x1041('0x32')]=_0x35cce0[_0x1041('0x32')][_0x1041('0x35')]?_0x35cce0[_0x1041('0x32')]:_0x45c112['model'];if(!_0x13a41e['query'][_0x1041('0x36')](_0x1041('0x37'))){_0x35cce0[_0x1041('0x1c')]=qs[_0x1041('0x1c')](_0x13a41e[_0x1041('0x2e')][_0x1041('0x1c')]);_0x35cce0[_0x1041('0x1a')]=qs['offset'](_0x13a41e['query']['offset']);}_0x35cce0[_0x1041('0x38')]=qs[_0x1041('0x39')](_0x13a41e['query'][_0x1041('0x39')]);_0x35cce0[_0x1041('0x3a')]=qs[_0x1041('0x30')](_[_0x1041('0x3b')](_0x13a41e['query'],_0x45c112[_0x1041('0x30')]),_0xa099f6);if(_0x13a41e[_0x1041('0x2e')][_0x1041('0x3c')]){_0x35cce0['where']=_[_0x1041('0x3d')](_0x35cce0[_0x1041('0x3a')],{'$or':_['map'](_0xa099f6,function(_0x539c76){if(_0x539c76['type']!==_0x1041('0x3e')){var _0x4b4f6d={};_0x4b4f6d[_0x539c76[_0x1041('0x27')]]={'$like':'%'+_0x13a41e[_0x1041('0x2e')][_0x1041('0x3c')]+'%'};return _0x4b4f6d;}})});}_0x35cce0=_[_0x1041('0x3d')]({},_0x35cce0,_0x13a41e[_0x1041('0x3f')]);var _0x5cffda={'where':_0x35cce0[_0x1041('0x3a')]};return db[_0x1041('0x40')][_0x1041('0x1d')](_0x5cffda)[_0x1041('0x41')](function(_0x128330){_0x3bf7ff[_0x1041('0x1d')]=_0x128330;if(_0x13a41e['query'][_0x1041('0x42')]){_0x35cce0[_0x1041('0x43')]=[{'all':!![]}];}return db[_0x1041('0x40')][_0x1041('0x44')](_0x35cce0);})[_0x1041('0x41')](function(_0x404ffd){_0x3bf7ff[_0x1041('0x45')]=_0x404ffd;return _0x3bf7ff;})[_0x1041('0x41')](respondWithFilteredResult(_0xe0f7dd,_0x35cce0))['catch'](handleError(_0xe0f7dd,null));};exports[_0x1041('0x46')]=function(_0x401a19,_0x4001d0){var _0x235ac9={'raw':!![],'where':{'id':_0x401a19['params']['id']}},_0x55f13f={};_0x55f13f[_0x1041('0x33')]=_[_0x1041('0x2f')](db[_0x1041('0x40')][_0x1041('0x2b')]);_0x55f13f[_0x1041('0x2e')]=_[_0x1041('0x2f')](_0x401a19['query']);_0x55f13f[_0x1041('0x30')]=_['intersection'](_0x55f13f[_0x1041('0x33')],_0x55f13f[_0x1041('0x2e')]);_0x235ac9['attributes']=_['intersection'](_0x55f13f[_0x1041('0x33')],qs[_0x1041('0x34')](_0x401a19[_0x1041('0x2e')][_0x1041('0x34')]));_0x235ac9[_0x1041('0x32')]=_0x235ac9[_0x1041('0x32')][_0x1041('0x35')]?_0x235ac9[_0x1041('0x32')]:_0x55f13f['model'];if(_0x401a19[_0x1041('0x2e')][_0x1041('0x42')]){_0x235ac9['include']=[{'all':!![]}];}_0x235ac9=_['merge']({},_0x235ac9,_0x401a19[_0x1041('0x3f')]);return db[_0x1041('0x40')]['find'](_0x235ac9)['then'](handleEntityNotFound(_0x4001d0,null))[_0x1041('0x41')](respondWithResult(_0x4001d0,null))[_0x1041('0x47')](handleError(_0x4001d0,null));};exports[_0x1041('0x48')]=function(_0x36e83e,_0x943f59){return db['ChatInternalMessage']['create'](_0x36e83e[_0x1041('0x49')],{})[_0x1041('0x41')](respondWithResult(_0x943f59,0xc9))[_0x1041('0x47')](handleError(_0x943f59,null));};exports[_0x1041('0x23')]=function(_0x1e742e,_0x4c49c1){if(_0x1e742e[_0x1041('0x49')]['id']){delete _0x1e742e[_0x1041('0x49')]['id'];}return db[_0x1041('0x40')][_0x1041('0x4a')]({'where':{'id':_0x1e742e['params']['id']}})[_0x1041('0x41')](handleEntityNotFound(_0x4c49c1,null))[_0x1041('0x41')](saveUpdates(_0x1e742e['body'],null))[_0x1041('0x41')](respondWithResult(_0x4c49c1,null))[_0x1041('0x47')](handleError(_0x4c49c1,null));};exports['destroy']=function(_0xc61275,_0x15c01c){return db[_0x1041('0x40')][_0x1041('0x4a')]({'where':{'id':_0xc61275[_0x1041('0x4b')]['id']}})[_0x1041('0x41')](handleEntityNotFound(_0x15c01c,null))['then'](removeEntity(_0x15c01c,null))['catch'](handleError(_0x15c01c,null));};exports[_0x1041('0x4c')]=function(_0x36a5b5,_0x370594){return db['ChatInternalMessage']['describe']()[_0x1041('0x41')](respondWithResult(_0x370594,null))[_0x1041('0x47')](handleError(_0x370594,null));};function wrapUser(_0x2dc40e){return function(_0x561e7a){var _0x5dd848=_0x2dc40e[_0x1041('0x4d')]({'plain':!![]});_0x5dd848['messages']=[];if(_0x561e7a){_0x5dd848[_0x1041('0x4e')]=_0x561e7a[_0x1041('0x4f')];_0x5dd848[_0x1041('0x50')]=_0x561e7a;}else{_0x5dd848[_0x1041('0x4e')]=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5dd848[_0x1041('0x50')]={};}return _0x5dd848;};}exports[_0x1041('0x51')]=function(_0x40d6bd,_0x1870f4,_0x2772ac){var _0x1719d0=[];return db[_0x1041('0x52')][_0x1041('0x44')]({'where':{'role':[_0x1041('0x53'),_0x1041('0x54'),'user']},'attributes':['id','fullname',_0x1041('0x27'),_0x1041('0x55'),_0x1041('0x56'),_0x1041('0x57'),_0x1041('0x58'),_0x1041('0x59'),_0x1041('0x5a'),_0x1041('0x5b')],'order':qs['sort']('-online'),'include':[{'model':db[_0x1041('0x5c')],'as':_0x1041('0x5d'),'attributes':['id',_0x1041('0x27'),_0x1041('0x5e')],'through':{'attributes':[]}}]})[_0x1041('0x41')](function(_0x5f411d){if(_0x5f411d){var _0x2e8ebb=_0x40d6bd[_0x1041('0x5f')][_0x1041('0x4d')]({'plain':!![]});if(!_0x2e8ebb)throw new Error(_0x1041('0x60'));if(_0x2e8ebb['role']===_0x1041('0x5f')){return db[_0x1041('0x61')][_0x1041('0x4a')]({'where':{'name':_0x1041('0x62'),'userProfileId':_0x2e8ebb[_0x1041('0x63')]},'raw':!![]})['then'](function(_0xe0e95){if(_0xe0e95){if(_0xe0e95[_0x1041('0x64')]===0x0){return db[_0x1041('0x65')][_0x1041('0x44')]({'where':{'sectionId':_0xe0e95['id']},'raw':!![]})[_0x1041('0x41')](function(_0xd34215){var _0x13097e=[];if(_[_0x1041('0x66')](_0xd34215)){_0x13097e=_[_0x1041('0x3c')](_0x5f411d,function(_0x597e5e){if(_0x597e5e['role']!==_0x1041('0x53')){return _0x597e5e;}});return _0x13097e;}else{for(var _0x37c67e=0x0;_0x37c67e<_0x5f411d[_0x1041('0x35')];_0x37c67e++){var _0x4741fa=_0x5f411d[_0x37c67e];if(_0x4741fa['role']===_0x1041('0x53')){var _0x2e569c=_[_0x1041('0x4a')](_0xd34215,function(_0x1ec8e3){return _0x1ec8e3[_0x1041('0x67')]===_0x4741fa['id'];});if(_0x2e569c)_0x13097e[_0x1041('0x68')](_0x4741fa);}else{_0x13097e[_0x1041('0x68')](_0x4741fa);}}return _0x13097e;}});}else{return _0x5f411d;}}else{var _0x2f47df=_[_0x1041('0x3c')](_0x5f411d,function(_0x186da0){if(_0x186da0['role']!==_0x1041('0x53')){return _0x186da0;}});return _0x2f47df;}});}else{return _0x5f411d;}}})[_0x1041('0x41')](function(_0x435573){var _0x2df6ff=[];if(_0x435573){_0x1719d0=_0x435573;for(var _0x5570a6=0x0;_0x5570a6<_0x435573[_0x1041('0x35')];_0x5570a6+=0x1){_0x1719d0[_0x5570a6][_0x1041('0x69')]=[];_0x2df6ff['push'](db[_0x1041('0x40')][_0x1041('0x4a')]({'where':{'FromId':[_0x40d6bd['user']['id'],_0x435573[_0x5570a6]['id']],'ToId':[_0x40d6bd[_0x1041('0x5f')]['id'],_0x435573[_0x5570a6]['id']],'ChatGroupId':null},'attributes':['id',_0x1041('0x4f'),_0x1041('0x6a'),_0x1041('0x6b'),_0x1041('0x6c'),_0x1041('0x49')],'order':qs[_0x1041('0x39')](_0x1041('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x1041('0x41')](wrapUser(_0x435573[_0x5570a6])));}return BPromise[_0x1041('0x6e')](_0x2df6ff);}return[];})['then'](function(_0x4d3629){return{'rows':_0x4d3629,'count':_0x4d3629['length']};})[_0x1041('0x41')](respondWithResult(_0x1870f4,null))[_0x1041('0x47')](handleError(_0x1870f4,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 7b1084f..a56d4d0 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 _0x5746=['exports','events','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x6cfb8a,_0x53be6f){var _0x29ba1d=function(_0x104303){while(--_0x104303){_0x6cfb8a['push'](_0x6cfb8a['shift']());}};_0x29ba1d(++_0x53be6f);}(_0x5746,0x1f2));var _0x6574=function(_0x563318,_0x1ee60f){_0x563318=_0x563318-0x0;var _0x2f345c=_0x5746[_0x563318];return _0x2f345c;};'use strict';var EventEmitter=require(_0x6574('0x0'));var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x6574('0x1')](0x0);var events={'afterCreate':_0x6574('0x2'),'afterUpdate':'update','afterDestroy':_0x6574('0x3')};function emitEvent(_0xb718de){return function(_0x936bd9,_0x15aae6,_0x175462){ChatInternalMessageEvents[_0x6574('0x4')](_0xb718de+':'+_0x936bd9['id'],_0x936bd9);ChatInternalMessageEvents[_0x6574('0x4')](_0xb718de,_0x936bd9);_0x175462(null);};}for(var e in events){if(events[_0x6574('0x5')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x6574('0x6')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xc50c=['../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x478bf0,_0x5593b5){var _0x2ff52a=function(_0x41fb9e){while(--_0x41fb9e){_0x478bf0['push'](_0x478bf0['shift']());}};_0x2ff52a(++_0x5593b5);}(_0xc50c,0x11d));var _0xcc50=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xc50c[_0x5d6456];return _0x4d66c1;};'use strict';var EventEmitter=require(_0xcc50('0x0'));var ChatInternalMessage=require(_0xcc50('0x1'))['db'][_0xcc50('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xcc50('0x3')](0x0);var events={'afterCreate':_0xcc50('0x4'),'afterUpdate':_0xcc50('0x5'),'afterDestroy':_0xcc50('0x6')};function emitEvent(_0x2a8f53){return function(_0x376579,_0x3715be,_0x3873bb){ChatInternalMessageEvents[_0xcc50('0x7')](_0x2a8f53+':'+_0x376579['id'],_0x376579);ChatInternalMessageEvents['emit'](_0x2a8f53,_0x376579);_0x3873bb(null);};}for(var e in events){if(events[_0xcc50('0x8')](e)){var event=events[e];ChatInternalMessage[_0xcc50('0x9')](e,emitEvent(event));}}module[_0xcc50('0xa')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 5ec4464..6e7188a 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 _0x61d9=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x1a7588,_0x38b20a){var _0xd1fbb2=function(_0x3fca2b){while(--_0x3fca2b){_0x1a7588['push'](_0x1a7588['shift']());}};_0xd1fbb2(++_0x38b20a);}(_0x61d9,0x1a0));var _0x961d=function(_0x4d742f,_0x271308){_0x4d742f=_0x4d742f-0x0;var _0x57f3ac=_0x61d9[_0x4d742f];return _0x57f3ac;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x961d('0x0'));var moment=require(_0x961d('0x1'));var BPromise=require(_0x961d('0x2'));var rp=require(_0x961d('0x3'));var fs=require('fs');var path=require(_0x961d('0x4'));var rimraf=require(_0x961d('0x5'));var config=require(_0x961d('0x6'));var attributes=require(_0x961d('0x7'));module[_0x961d('0x8')]=function(_0x3373b8,_0xd62546){return _0x3373b8[_0x961d('0x9')]('ChatInternalMessage',attributes,{'tableName':_0x961d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x961d('0xb'),'collate':_0x961d('0xc')});}; \ No newline at end of file +var _0x0f52=['utf8mb4_unicode_ci','moment','bluebird','path','../../config/environment','./chatInternalMessage.attributes','exports','ChatInternalMessage','chat_internal_messages','utf8mb4'];(function(_0x41ef43,_0x394c9b){var _0x3a6b7c=function(_0x1a82a4){while(--_0x1a82a4){_0x41ef43['push'](_0x41ef43['shift']());}};_0x3a6b7c(++_0x394c9b);}(_0x0f52,0x187));var _0x20f5=function(_0x1263d5,_0x5a1e64){_0x1263d5=_0x1263d5-0x0;var _0x29b1fa=_0x0f52[_0x1263d5];return _0x29b1fa;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x20f5('0x0'));var BPromise=require(_0x20f5('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20f5('0x2'));var rimraf=require('rimraf');var config=require(_0x20f5('0x3'));var attributes=require(_0x20f5('0x4'));module[_0x20f5('0x5')]=function(_0x55572a,_0x93e3b0){return _0x55572a['define'](_0x20f5('0x6'),attributes,{'tableName':_0x20f5('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x20f5('0x8'),'collate':_0x20f5('0x9')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 08b9db6..458edac 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 _0xeef0=['http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','jayson/promise','client'];(function(_0x8958a2,_0x25ec6c){var _0x5dca35=function(_0x15333f){while(--_0x15333f){_0x8958a2['push'](_0x8958a2['shift']());}};_0x5dca35(++_0x25ec6c);}(_0xeef0,0x1c4));var _0x0eef=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xeef0[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0x0eef('0x0'));var util=require(_0x0eef('0x1'));var moment=require(_0x0eef('0x2'));var BPromise=require(_0x0eef('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0eef('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0eef('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0eef('0x6'));var client=jayson[_0x0eef('0x7')][_0x0eef('0x8')]({'port':0x232a});config[_0x0eef('0x9')]=_['defaults'](config[_0x0eef('0x9')],{'host':_0x0eef('0xa'),'port':0x18eb});var socket=require(_0x0eef('0xb'))(new Redis(config['redis']));require(_0x0eef('0xc'))[_0x0eef('0xd')](socket);function respondWithRpcPromise(_0x5bac12,_0x412a98,_0x234349){return new BPromise(function(_0x415fde,_0x4d00c0){return client['request'](_0x5bac12,_0x234349)[_0x0eef('0xe')](function(_0x59a535){logger[_0x0eef('0xf')](_0x0eef('0x10'),_0x412a98,_0x0eef('0x11'));logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x412a98,_0x0eef('0x11'),JSON['stringify'](_0x59a535));if(_0x59a535[_0x0eef('0x12')]){if(_0x59a535[_0x0eef('0x12')][_0x0eef('0x13')]===0x1f4){logger['error'](_0x0eef('0x10'),_0x412a98,_0x59a535[_0x0eef('0x12')][_0x0eef('0x14')]);return _0x4d00c0(_0x59a535[_0x0eef('0x12')][_0x0eef('0x14')]);}logger[_0x0eef('0x12')](_0x0eef('0x10'),_0x412a98,_0x59a535[_0x0eef('0x12')][_0x0eef('0x14')]);return _0x415fde(_0x59a535[_0x0eef('0x12')]['message']);}else{logger[_0x0eef('0xf')](_0x0eef('0x10'),_0x412a98,'request\x20sent');_0x415fde(_0x59a535[_0x0eef('0x15')][_0x0eef('0x14')]);}})[_0x0eef('0x16')](function(_0x2bbeb6){logger[_0x0eef('0x12')](_0x0eef('0x10'),_0x412a98,_0x2bbeb6);_0x4d00c0(_0x2bbeb6);});});} \ No newline at end of file +var _0x17da=['then','info','request\x20sent','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter'];(function(_0x47f54d,_0x277644){var _0x3febe8=function(_0x3cc094){while(--_0x3cc094){_0x47f54d['push'](_0x47f54d['shift']());}};_0x3febe8(++_0x277644);}(_0x17da,0x18a));var _0xa17d=function(_0x2eb7c8,_0x267c90){_0x2eb7c8=_0x2eb7c8-0x0;var _0x29704d=_0x17da[_0x2eb7c8];return _0x29704d;};'use strict';var _=require(_0xa17d('0x0'));var util=require(_0xa17d('0x1'));var moment=require(_0xa17d('0x2'));var BPromise=require(_0xa17d('0x3'));var rs=require(_0xa17d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa17d('0x5'))['db'];var utils=require(_0xa17d('0x6'));var logger=require(_0xa17d('0x7'))(_0xa17d('0x8'));var config=require('../../config/environment');var jayson=require(_0xa17d('0x9'));var client=jayson[_0xa17d('0xa')]['http']({'port':0x232a});config[_0xa17d('0xb')]=_['defaults'](config['redis'],{'host':_0xa17d('0xc'),'port':0x18eb});var socket=require(_0xa17d('0xd'))(new Redis(config[_0xa17d('0xb')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x5b3cc3,_0x2f7e3e,_0x4e3e7f){return new BPromise(function(_0x2280df,_0x195f19){return client['request'](_0x5b3cc3,_0x4e3e7f)[_0xa17d('0xe')](function(_0x11e1a5){logger[_0xa17d('0xf')]('ChatInternalMessage,\x20%s,\x20%s',_0x2f7e3e,_0xa17d('0x10'));logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x2f7e3e,'request\x20sent',JSON[_0xa17d('0x11')](_0x11e1a5));if(_0x11e1a5['error']){if(_0x11e1a5[_0xa17d('0x12')][_0xa17d('0x13')]===0x1f4){logger[_0xa17d('0x12')](_0xa17d('0x14'),_0x2f7e3e,_0x11e1a5[_0xa17d('0x12')][_0xa17d('0x15')]);return _0x195f19(_0x11e1a5[_0xa17d('0x12')][_0xa17d('0x15')]);}logger['error'](_0xa17d('0x14'),_0x2f7e3e,_0x11e1a5['error'][_0xa17d('0x15')]);return _0x2280df(_0x11e1a5[_0xa17d('0x12')][_0xa17d('0x15')]);}else{logger[_0xa17d('0xf')](_0xa17d('0x14'),_0x2f7e3e,_0xa17d('0x10'));_0x2280df(_0x11e1a5[_0xa17d('0x16')]['message']);}})[_0xa17d('0x17')](function(_0xf400d7){logger['error'](_0xa17d('0x14'),_0x2f7e3e,_0xf400d7);_0x195f19(_0xf400d7);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 6b1b3fb..46e5bf0 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 _0x916a=['register','length','chatInternalMessage:','./chatInternalMessage.events','remove','emit'];(function(_0x4df7d6,_0x24e8eb){var _0xc14992=function(_0x47cf4e){while(--_0x47cf4e){_0x4df7d6['push'](_0x4df7d6['shift']());}};_0xc14992(++_0x24e8eb);}(_0x916a,0x189));var _0xa916=function(_0x58175c,_0x2d9373){_0x58175c=_0x58175c-0x0;var _0x55b88f=_0x916a[_0x58175c];return _0x55b88f;};'use strict';var ChatInternalMessageEvents=require(_0xa916('0x0'));var events=['save',_0xa916('0x1'),'update'];function createListener(_0x1e2c8d,_0xd79a2){return function(_0x53934f){_0xd79a2[_0xa916('0x2')](_0x1e2c8d,_0x53934f);};}function removeListener(_0x2e90ca,_0xee00b8){return function(){ChatInternalMessageEvents['removeListener'](_0x2e90ca,_0xee00b8);};}exports[_0xa916('0x3')]=function(_0x514ee2){for(var _0x4cd2e4=0x0,_0x33cf59=events[_0xa916('0x4')];_0x4cd2e4<_0x33cf59;_0x4cd2e4++){var _0x58a91a=events[_0x4cd2e4];var _0x3f5234=createListener(_0xa916('0x5')+_0x58a91a,_0x514ee2);ChatInternalMessageEvents['on'](_0x58a91a,_0x3f5234);}}; \ No newline at end of file +var _0xffda=['./chatInternalMessage.events','save','emit','register','length','chatInternalMessage:'];(function(_0x59a98a,_0x3f6c6c){var _0x2048ef=function(_0x208983){while(--_0x208983){_0x59a98a['push'](_0x59a98a['shift']());}};_0x2048ef(++_0x3f6c6c);}(_0xffda,0xae));var _0xaffd=function(_0x42da50,_0x581c43){_0x42da50=_0x42da50-0x0;var _0x126bc8=_0xffda[_0x42da50];return _0x126bc8;};'use strict';var ChatInternalMessageEvents=require(_0xaffd('0x0'));var events=[_0xaffd('0x1'),'remove','update'];function createListener(_0x472976,_0x5a02b5){return function(_0x5acf8f){_0x5a02b5[_0xaffd('0x2')](_0x472976,_0x5acf8f);};}function removeListener(_0x87505e,_0x597781){return function(){ChatInternalMessageEvents['removeListener'](_0x87505e,_0x597781);};}exports[_0xaffd('0x3')]=function(_0x527b73){for(var _0x17f965=0x0,_0x49231c=events[_0xaffd('0x4')];_0x17f965<_0x49231c;_0x17f965++){var _0x2be364=events[_0x17f965];var _0x354a89=createListener(_0xaffd('0x5')+_0x2be364,_0x527b73);ChatInternalMessageEvents['on'](_0x2be364,_0x354a89);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 460e9a1..fd23875 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 _0x49a4=['describe','/users','/:id','show','post','create','put','update','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index'];(function(_0x57cc16,_0x444378){var _0x5421e5=function(_0xbcb1d3){while(--_0xbcb1d3){_0x57cc16['push'](_0x57cc16['shift']());}};_0x5421e5(++_0x444378);}(_0x49a4,0x149));var _0x449a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x49a4[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x449a('0x0'));var express=require(_0x449a('0x1'));var router=express[_0x449a('0x2')]();var fs_extra=require(_0x449a('0x3'));var auth=require(_0x449a('0x4'));var interaction=require(_0x449a('0x5'));var config=require(_0x449a('0x6'));var controller=require(_0x449a('0x7'));router[_0x449a('0x8')]('/',auth[_0x449a('0x9')](),controller[_0x449a('0xa')]);router['get']('/describe',auth[_0x449a('0x9')](),controller[_0x449a('0xb')]);router[_0x449a('0x8')](_0x449a('0xc'),auth[_0x449a('0x9')](),controller['getUsers']);router[_0x449a('0x8')](_0x449a('0xd'),auth['isAuthenticated'](),controller[_0x449a('0xe')]);router[_0x449a('0xf')]('/',auth['isAuthenticated'](),controller[_0x449a('0x10')]);router[_0x449a('0x11')](_0x449a('0xd'),controller[_0x449a('0x12')]);router['delete'](_0x449a('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x449a('0x13')]=router; \ No newline at end of file +var _0x26ac=['isAuthenticated','describe','getUsers','/:id','create','delete','destroy','util','path','fs-extra','../../components/interaction/service','./chatInternalMessage.controller','get','index','/describe'];(function(_0x9acf87,_0x1b9f52){var _0x36ae1=function(_0x390d50){while(--_0x390d50){_0x9acf87['push'](_0x9acf87['shift']());}};_0x36ae1(++_0x1b9f52);}(_0x26ac,0x106));var _0xc26a=function(_0x529785,_0x1c4273){_0x529785=_0x529785-0x0;var _0x28bdcc=_0x26ac[_0x529785];return _0x28bdcc;};'use strict';var multer=require('multer');var util=require(_0xc26a('0x0'));var path=require(_0xc26a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xc26a('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xc26a('0x3'));var config=require('../../config/environment');var controller=require(_0xc26a('0x4'));router[_0xc26a('0x5')]('/',auth['isAuthenticated'](),controller[_0xc26a('0x6')]);router[_0xc26a('0x5')](_0xc26a('0x7'),auth[_0xc26a('0x8')](),controller[_0xc26a('0x9')]);router['get']('/users',auth['isAuthenticated'](),controller[_0xc26a('0xa')]);router['get'](_0xc26a('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xc26a('0x8')](),controller[_0xc26a('0xc')]);router['put'](_0xc26a('0xb'),controller['update']);router[_0xc26a('0xd')](_0xc26a('0xb'),auth[_0xc26a('0x8')](),controller[_0xc26a('0xe')]);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 d41363d..ab5432c 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 _0x28f2=['TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports'];(function(_0x35e2d7,_0x1729b7){var _0x3fcbf2=function(_0x1e225e){while(--_0x1e225e){_0x35e2d7['push'](_0x35e2d7['shift']());}};_0x3fcbf2(++_0x1729b7);}(_0x28f2,0x193));var _0x228f=function(_0x3adf1b,_0x53317d){_0x3adf1b=_0x3adf1b-0x0;var _0x4300d5=_0x28f2[_0x3adf1b];return _0x4300d5;};'use strict';var Sequelize=require(_0x228f('0x0'));module[_0x228f('0x1')]={'body':{'type':Sequelize[_0x228f('0x2')](_0x228f('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x228f('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x228f('0x5')]('in',_0x228f('0x6')),'defaultValue':_0x228f('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x228f('0x7')]},'providerName':{'type':Sequelize[_0x228f('0x8')]},'providerResponse':{'type':Sequelize[_0x228f('0x2')]}}; \ No newline at end of file +var _0xfcbb=['ENUM','out','DATE','sequelize','exports','TEXT','BOOLEAN'];(function(_0x310163,_0x4b7633){var _0x2491fe=function(_0x1ed047){while(--_0x1ed047){_0x310163['push'](_0x310163['shift']());}};_0x2491fe(++_0x4b7633);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x13af4e,_0x1e01c8){_0x13af4e=_0x13af4e-0x0;var _0x353beb=_0xfcbb[_0x13af4e];return _0x353beb;};'use strict';var Sequelize=require(_0xbfcb('0x0'));module[_0xbfcb('0x1')]={'body':{'type':Sequelize[_0xbfcb('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xbfcb('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbfcb('0x4')]('in',_0xbfcb('0x5')),'defaultValue':_0xbfcb('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xbfcb('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index c1ab92c..775c8f9 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 _0x32ac=['[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','interface','rejectmessage','formData','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','client','http','request','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','ChatMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','offset','undefined','count','limit','set','json','reject','save','update','then','destroy','end','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','where','type','VIRTUAL','merge','includeAll','include','rows','show','options','find','create','body','params','accept','chat','read','readAt','format','UserId','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','chat-interactions'];(function(_0x399f46,_0x48d930){var _0x4e11cc=function(_0x5e6978){while(--_0x5e6978){_0x399f46['push'](_0x399f46['shift']());}};_0x4e11cc(++_0x48d930);}(_0x32ac,0x90));var _0xc32a=function(_0x5422bd,_0x4ff360){_0x5422bd=_0x5422bd-0x0;var _0x42a047=_0x32ac[_0x5422bd];return _0x42a047;};'use strict';var emlformat=require(_0xc32a('0x0'));var rimraf=require(_0xc32a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc32a('0x2'));var rp=require(_0xc32a('0x3'));var moment=require(_0xc32a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc32a('0x5'));var util=require(_0xc32a('0x6'));var path=require(_0xc32a('0x7'));var sox=require(_0xc32a('0x8'));var csv=require(_0xc32a('0x9'));var ejs=require(_0xc32a('0xa'));var fs=require('fs');var fs_extra=require(_0xc32a('0xb'));var _=require(_0xc32a('0xc'));var squel=require(_0xc32a('0xd'));var crypto=require(_0xc32a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc32a('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc32a('0x10'));var Redis=require(_0xc32a('0x11'));var authService=require(_0xc32a('0x12'));var qs=require(_0xc32a('0x13'));var as=require(_0xc32a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc32a('0x15'))(_0xc32a('0x16'));var utils=require(_0xc32a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc32a('0x18'));var db=require(_0xc32a('0x19'))['db'];config[_0xc32a('0x1a')]=_[_0xc32a('0x1b')](config[_0xc32a('0x1a')],{'host':_0xc32a('0x1c'),'port':0x18eb});var socket=require(_0xc32a('0x1d'))(new Redis(config[_0xc32a('0x1a')]));require(_0xc32a('0x1e'))['register'](socket);var jayson=require(_0xc32a('0x1f'));var client=jayson[_0xc32a('0x20')][_0xc32a('0x21')]({'port':0x232c});var client9002=jayson[_0xc32a('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59baad,_0x25abd2,_0xb090bb,_0x497058){return new BPromise(function(_0x3f6c6d,_0x35ead2){var _0x34fdf5=_0x497058||client;return _0x34fdf5[_0xc32a('0x22')](_0x59baad,_0xb090bb)['then'](function(_0x201cab){logger['info']('ChatMessage,\x20%s,\x20%s',_0x25abd2,_0xc32a('0x23'));logger[_0xc32a('0x24')](_0xc32a('0x25'),_0x25abd2,_0xc32a('0x23'),JSON[_0xc32a('0x26')](_0x201cab));if(_0x201cab['error']){if(_0x201cab['error'][_0xc32a('0x27')]===0x1f4){logger[_0xc32a('0x28')](_0xc32a('0x29'),_0x25abd2,_0x201cab['error']['message']);return _0x35ead2(_0x201cab[_0xc32a('0x28')]['message']);}logger[_0xc32a('0x28')](_0xc32a('0x29'),_0x25abd2,_0x201cab[_0xc32a('0x28')][_0xc32a('0x2a')]);return _0x3f6c6d(_0x201cab[_0xc32a('0x28')][_0xc32a('0x2a')]);}else{logger[_0xc32a('0x2b')](_0xc32a('0x29'),_0x25abd2,_0xc32a('0x23'));_0x3f6c6d(_0x201cab[_0xc32a('0x2c')][_0xc32a('0x2a')]);}})[_0xc32a('0x2d')](function(_0x1dd542){logger[_0xc32a('0x28')]('ChatMessage,\x20%s,\x20%s',_0x25abd2,_0x1dd542);_0x35ead2(_0x1dd542);});});}function respondWithStatusCode(_0x36b4dc,_0x546f56){_0x546f56=_0x546f56||0xcc;return function(_0x1cb1b0){if(_0x1cb1b0){return _0x36b4dc[_0xc32a('0x2e')](_0x546f56);}return _0x36b4dc[_0xc32a('0x2f')](_0x546f56)['end']();};}function respondWithResult(_0x929c0d,_0x3c7adf){_0x3c7adf=_0x3c7adf||0xc8;return function(_0x2777a4){if(_0x2777a4){return _0x929c0d[_0xc32a('0x2f')](_0x3c7adf)['json'](_0x2777a4);}};}function respondWithFilteredResult(_0x3c88fa,_0x85cb54){return function(_0x480510){if(_0x480510){var _0x22174e=typeof _0x85cb54[_0xc32a('0x30')]===_0xc32a('0x31')&&typeof _0x85cb54['limit']==='undefined';var _0x3e2445=_0x480510['count'];var _0x5a8001=_0x22174e?0x0:_0x85cb54[_0xc32a('0x30')];var _0xab77f8=_0x22174e?_0x480510[_0xc32a('0x32')]:_0x85cb54[_0xc32a('0x30')]+_0x85cb54[_0xc32a('0x33')];var _0x59b49a;if(_0xab77f8>=_0x3e2445){_0xab77f8=_0x3e2445;_0x59b49a=0xc8;}else{_0x59b49a=0xce;}_0x3c88fa[_0xc32a('0x2f')](_0x59b49a);return _0x3c88fa[_0xc32a('0x34')]('Content-Range',_0x5a8001+'-'+_0xab77f8+'/'+_0x3e2445)[_0xc32a('0x35')](_0x480510);}return null;};}function patchUpdates(_0x3419b0){return function(_0x526027){try{jsonpatch['apply'](_0x526027,_0x3419b0,!![]);}catch(_0x4315c9){return BPromise[_0xc32a('0x36')](_0x4315c9);}return _0x526027[_0xc32a('0x37')]();};}function saveUpdates(_0x1bcb91,_0x1248df){return function(_0x470b14){if(_0x470b14){return _0x470b14[_0xc32a('0x38')](_0x1bcb91)[_0xc32a('0x39')](function(_0x4870cd){return _0x4870cd;});}return null;};}function removeEntity(_0x6afb97,_0x3a2229){return function(_0x218f57){if(_0x218f57){return _0x218f57[_0xc32a('0x3a')]()[_0xc32a('0x39')](function(){_0x6afb97[_0xc32a('0x2f')](0xcc)[_0xc32a('0x3b')]();});}};}function handleEntityNotFound(_0x3171cf,_0xc36cea){return function(_0x40b255){if(!_0x40b255){_0x3171cf['sendStatus'](0x194);}return _0x40b255;};}function handleError(_0x5c1795,_0xb19c1f){_0xb19c1f=_0xb19c1f||0x1f4;return function(_0x1dfe54){logger['error'](_0x1dfe54[_0xc32a('0x3c')]);if(_0x1dfe54['name']){delete _0x1dfe54[_0xc32a('0x3d')];}_0x5c1795['status'](_0xb19c1f)[_0xc32a('0x3e')](_0x1dfe54);};}exports[_0xc32a('0x3f')]=function(_0x5ad705,_0x455df0){var _0x2ae965={},_0x40323a={},_0x276823={'count':0x0,'rows':[]};var _0x430f3b=_[_0xc32a('0x40')](db[_0xc32a('0x41')][_0xc32a('0x42')],function(_0x2aea0d){return{'name':_0x2aea0d[_0xc32a('0x43')],'type':_0x2aea0d['type'][_0xc32a('0x44')]};});_0x40323a[_0xc32a('0x45')]=_[_0xc32a('0x40')](_0x430f3b,_0xc32a('0x3d'));_0x40323a[_0xc32a('0x46')]=_[_0xc32a('0x47')](_0x5ad705[_0xc32a('0x46')]);_0x40323a['filters']=_[_0xc32a('0x48')](_0x40323a['model'],_0x40323a['query']);_0x2ae965[_0xc32a('0x49')]=_['intersection'](_0x40323a[_0xc32a('0x45')],qs[_0xc32a('0x4a')](_0x5ad705[_0xc32a('0x46')][_0xc32a('0x4a')]));_0x2ae965[_0xc32a('0x49')]=_0x2ae965[_0xc32a('0x49')][_0xc32a('0x4b')]?_0x2ae965[_0xc32a('0x49')]:_0x40323a[_0xc32a('0x45')];if(!_0x5ad705['query'][_0xc32a('0x4c')](_0xc32a('0x4d'))){_0x2ae965[_0xc32a('0x33')]=qs['limit'](_0x5ad705[_0xc32a('0x46')][_0xc32a('0x33')]);_0x2ae965[_0xc32a('0x30')]=qs[_0xc32a('0x30')](_0x5ad705[_0xc32a('0x46')][_0xc32a('0x30')]);}_0x2ae965['order']=qs[_0xc32a('0x4e')](_0x5ad705[_0xc32a('0x46')][_0xc32a('0x4e')]);_0x2ae965['where']=qs[_0xc32a('0x4f')](_['pick'](_0x5ad705[_0xc32a('0x46')],_0x40323a[_0xc32a('0x4f')]),_0x430f3b);if(_0x5ad705['query']['filter']){_0x2ae965[_0xc32a('0x50')]=_['merge'](_0x2ae965[_0xc32a('0x50')],{'$or':_[_0xc32a('0x40')](_0x430f3b,function(_0x559fb1){if(_0x559fb1[_0xc32a('0x51')]!==_0xc32a('0x52')){var _0x29150f={};_0x29150f[_0x559fb1['name']]={'$like':'%'+_0x5ad705['query']['filter']+'%'};return _0x29150f;}})});}_0x2ae965=_[_0xc32a('0x53')]({},_0x2ae965,_0x5ad705['options']);var _0x2ec4bf={'where':_0x2ae965[_0xc32a('0x50')]};return db[_0xc32a('0x41')][_0xc32a('0x32')](_0x2ec4bf)[_0xc32a('0x39')](function(_0x4f072a){_0x276823[_0xc32a('0x32')]=_0x4f072a;if(_0x5ad705[_0xc32a('0x46')][_0xc32a('0x54')]){_0x2ae965[_0xc32a('0x55')]=[{'all':!![]}];}return db[_0xc32a('0x41')]['findAll'](_0x2ae965);})['then'](function(_0x426d42){_0x276823[_0xc32a('0x56')]=_0x426d42;return _0x276823;})[_0xc32a('0x39')](respondWithFilteredResult(_0x455df0,_0x2ae965))['catch'](handleError(_0x455df0,null));};exports[_0xc32a('0x57')]=function(_0x327d0c,_0x3d767e){var _0x45a49c={'raw':!![],'where':{'id':_0x327d0c['params']['id']}},_0x440e16={};_0x440e16[_0xc32a('0x45')]=_['keys'](db[_0xc32a('0x41')][_0xc32a('0x42')]);_0x440e16['query']=_[_0xc32a('0x47')](_0x327d0c['query']);_0x440e16[_0xc32a('0x4f')]=_['intersection'](_0x440e16[_0xc32a('0x45')],_0x440e16[_0xc32a('0x46')]);_0x45a49c[_0xc32a('0x49')]=_[_0xc32a('0x48')](_0x440e16[_0xc32a('0x45')],qs['fields'](_0x327d0c[_0xc32a('0x46')][_0xc32a('0x4a')]));_0x45a49c[_0xc32a('0x49')]=_0x45a49c['attributes'][_0xc32a('0x4b')]?_0x45a49c[_0xc32a('0x49')]:_0x440e16[_0xc32a('0x45')];if(_0x327d0c[_0xc32a('0x46')]['includeAll']){_0x45a49c[_0xc32a('0x55')]=[{'all':!![]}];}_0x45a49c=_[_0xc32a('0x53')]({},_0x45a49c,_0x327d0c[_0xc32a('0x58')]);return db[_0xc32a('0x41')][_0xc32a('0x59')](_0x45a49c)[_0xc32a('0x39')](handleEntityNotFound(_0x3d767e,null))[_0xc32a('0x39')](respondWithResult(_0x3d767e,null))[_0xc32a('0x2d')](handleError(_0x3d767e,null));};exports[_0xc32a('0x5a')]=function(_0x3cf52d,_0x1f1358){return db['ChatMessage'][_0xc32a('0x5a')](_0x3cf52d[_0xc32a('0x5b')],{})['then'](respondWithResult(_0x1f1358,0xc9))[_0xc32a('0x2d')](handleError(_0x1f1358,null));};exports[_0xc32a('0x38')]=function(_0x3072ba,_0x39a1d8){if(_0x3072ba[_0xc32a('0x5b')]['id']){delete _0x3072ba[_0xc32a('0x5b')]['id'];}return db['ChatMessage'][_0xc32a('0x59')]({'where':{'id':_0x3072ba['params']['id']}})['then'](handleEntityNotFound(_0x39a1d8,null))[_0xc32a('0x39')](saveUpdates(_0x3072ba[_0xc32a('0x5b')],null))[_0xc32a('0x39')](respondWithResult(_0x39a1d8,null))['catch'](handleError(_0x39a1d8,null));};exports[_0xc32a('0x3a')]=function(_0x3a29c4,_0x1a4b85){return db['ChatMessage'][_0xc32a('0x59')]({'where':{'id':_0x3a29c4[_0xc32a('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1a4b85,null))[_0xc32a('0x39')](removeEntity(_0x1a4b85,null))['catch'](handleError(_0x1a4b85,null));};exports['describe']=function(_0x2501b2,_0x2aa036){return db[_0xc32a('0x41')]['describe']()[_0xc32a('0x39')](respondWithResult(_0x2aa036,null))[_0xc32a('0x2d')](handleError(_0x2aa036,null));};var interaction_log=require(_0xc32a('0x15'))('chat-interactions');exports[_0xc32a('0x5d')]=function(_0x35c5ba,_0x2403b5,_0x523ba8){var _0x34f948={'agent':{},'channel':_0xc32a('0x5e')};if(_0x35c5ba[_0xc32a('0x5b')]['id']){delete _0x35c5ba[_0xc32a('0x5b')]['id'];}_0x35c5ba[_0xc32a('0x5b')][_0xc32a('0x5f')]=!![];_0x35c5ba['body'][_0xc32a('0x60')]=moment()[_0xc32a('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x35c5ba['body'][_0xc32a('0x62')]=_0x35c5ba[_0xc32a('0x5b')][_0xc32a('0x62')]||_0x35c5ba['user']['id'];_0x34f948[_0xc32a('0x63')]['id']=_0x35c5ba['body']['UserId'];return db[_0xc32a('0x41')][_0xc32a('0x59')]({'where':{'id':_0x35c5ba[_0xc32a('0x5c')]['id'],'UserId':null}})[_0xc32a('0x39')](handleEntityNotFound(_0x2403b5,null))[_0xc32a('0x39')](saveUpdates(_0x35c5ba[_0xc32a('0x5b')],null))[_0xc32a('0x39')](function(_0x4eab54){if(_0x4eab54){_0x34f948['message']=_0x4eab54[_0xc32a('0x64')]({'plain':!![]});return db[_0xc32a('0x65')]['find']({'where':{'id':_0x4eab54[_0xc32a('0x66')]}});}return null;})[_0xc32a('0x39')](handleEntityNotFound(_0x2403b5,null))['then'](function(_0x4cfea5){if(_0x4cfea5){return _0x4cfea5[_0xc32a('0x38')]({'UserId':_0x35c5ba[_0xc32a('0x5b')][_0xc32a('0x62')],'read1stAt':_[_0xc32a('0x67')](_0x4cfea5[_0xc32a('0x68')])?moment()[_0xc32a('0x61')](_0xc32a('0x69')):undefined});}return null;})[_0xc32a('0x39')](function(_0x480432){if(_0x480432){_0x34f948[_0xc32a('0x6a')]=_0x480432[_0xc32a('0x64')]({'plain':!![]});interaction_log[_0xc32a('0x2b')](_0xc32a('0x6b'),_0x35c5ba['user']['id'],_0x35c5ba['user']['name'],_0x35c5ba[_0xc32a('0x6c')][_0xc32a('0x6d')],_0x34f948[_0xc32a('0x6a')]['id'],_0x35c5ba['body']?JSON[_0xc32a('0x26')](_0x35c5ba[_0xc32a('0x5b')]):_0xc32a('0x6e'));return respondWithRpcPromise('AcceptMessage',_0xc32a('0x6f'),_0x34f948);}return null;})[_0xc32a('0x39')](function(_0x1f0b2a){var _0x568ac2=_0xc32a('0x70')+_0x1f0b2a[_0xc32a('0x2a')]['ContactId'];return db[_0xc32a('0x71')][_0xc32a('0x46')](_0x568ac2,{'type':db[_0xc32a('0x72')][_0xc32a('0x73')][_0xc32a('0x74')],'raw':!![]})[_0xc32a('0x39')](function(_0x2c29f8){return _0x2c29f8;});})[_0xc32a('0x39')](function(_0x4028d3){if(_0x4028d3){_0x34f948['message'][_0xc32a('0x75')]=_0x4028d3[0x0];if(!_0x35c5ba[_0xc32a('0x5b')][_0xc32a('0x62')])return;return db[_0xc32a('0x76')][_0xc32a('0x59')]({'where':{'id':_0x35c5ba[_0xc32a('0x5b')]['UserId'],'role':_0xc32a('0x63')},'attributes':['id',_0xc32a('0x3d'),_0xc32a('0x77'),_0xc32a('0x78'),_0xc32a('0x79')],'raw':!![]});}return null;})[_0xc32a('0x39')](function(_0x3d55c4){if(!_0x3d55c4)return null;_0x34f948[_0xc32a('0x2a')][_0xc32a('0x63')]=_0x3d55c4;return _0x34f948;})['then'](function(_0x39246a){if(_0x39246a){if(_0x35c5ba['body']['manual']){_0x34f948[_0xc32a('0x2a')]['interface']=util['format'](_0xc32a('0x7a'),_0x35c5ba['user'][_0xc32a('0x3d')]);_0x34f948[_0xc32a('0x2a')][_0xc32a('0x7b')]=_0x34f948['channel'];_0x34f948[_0xc32a('0x2a')][_0xc32a('0x7c')]=_0x34f948[_0xc32a('0x7b')];_0x34f948[_0xc32a('0x2a')][_0xc32a('0x7d')]=_0xc32a('0x5d');return respondWithRpcPromise(_0xc32a('0x7e'),'EventManager',{'event':_0xc32a('0x7f'),'message':_['merge'](_0x34f948[_0xc32a('0x2a')],JSON[_0xc32a('0x80')](_0x34f948[_0xc32a('0x6a')]['formData']))},client9002)[_0xc32a('0x39')](function(){return _0x34f948;});}return _0x34f948;}return null;})[_0xc32a('0x39')](respondWithResult(_0x2403b5,null))[_0xc32a('0x2d')](handleError(_0x2403b5,null));};var interaction_log=require(_0xc32a('0x15'))(_0xc32a('0x81'));exports['reject']=function(_0x37b670,_0x2cf48b,_0x3e54c7){var _0x331814={'agent':{},'channel':_0xc32a('0x5e')};if(_0x37b670[_0xc32a('0x5b')]['id']){delete _0x37b670['body']['id'];}_0x37b670[_0xc32a('0x5b')][_0xc32a('0x62')]=_0x37b670[_0xc32a('0x5b')][_0xc32a('0x62')]||_0x37b670[_0xc32a('0x6c')]['id'];_0x331814['agent']['id']=_0x37b670[_0xc32a('0x5b')][_0xc32a('0x62')];return db[_0xc32a('0x41')][_0xc32a('0x59')]({'where':{'id':_0x37b670[_0xc32a('0x5c')]['id'],'UserId':null}})[_0xc32a('0x39')](handleEntityNotFound(_0x2cf48b,null))[_0xc32a('0x39')](function(_0x336d94){if(_0x336d94){_0x331814['message']=_0x336d94[_0xc32a('0x64')]({'plain':!![]});return db[_0xc32a('0x65')]['find']({'where':{'id':_0x336d94[_0xc32a('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x2cf48b,null))[_0xc32a('0x39')](function(_0x87a37b){if(_0x87a37b){_0x331814[_0xc32a('0x6a')]=_0x87a37b['get']({'plain':!![]});interaction_log[_0xc32a('0x2b')](_0xc32a('0x82'),_0x37b670[_0xc32a('0x6c')]['id'],_0x37b670[_0xc32a('0x6c')][_0xc32a('0x3d')],_0x37b670['user'][_0xc32a('0x6d')],_0x331814[_0xc32a('0x6a')]['id'],_0x37b670[_0xc32a('0x5b')]?JSON[_0xc32a('0x26')](_0x37b670['body']):_0xc32a('0x6e'));return respondWithRpcPromise(_0xc32a('0x83'),_0xc32a('0x84'),_0x331814);}return null;})[_0xc32a('0x39')](function(_0x4e8b6d){var _0x1f3adb=_0xc32a('0x70')+_0x4e8b6d[_0xc32a('0x2a')][_0xc32a('0x85')];return db[_0xc32a('0x71')][_0xc32a('0x46')](_0x1f3adb,{'type':db[_0xc32a('0x72')][_0xc32a('0x73')][_0xc32a('0x74')],'raw':!![]})[_0xc32a('0x39')](function(_0x61d1c1){return _0x61d1c1;});})[_0xc32a('0x39')](function(_0x30be61){if(_0x30be61){_0x331814['message'][_0xc32a('0x75')]=_0x30be61[0x0];if(!_0x37b670[_0xc32a('0x5b')]['UserId'])return;return db[_0xc32a('0x76')][_0xc32a('0x59')]({'where':{'id':_0x37b670[_0xc32a('0x5b')][_0xc32a('0x62')],'role':_0xc32a('0x63')},'attributes':['id',_0xc32a('0x3d'),_0xc32a('0x77'),_0xc32a('0x78'),_0xc32a('0x79')],'raw':!![]});}return null;})[_0xc32a('0x39')](function(_0x4793bc){if(!_0x4793bc)return null;_0x331814[_0xc32a('0x2a')][_0xc32a('0x63')]=_0x4793bc;return _0x331814;})['then'](function(_0x465afb){if(_0x465afb){_0x465afb[_0xc32a('0x2a')][_0xc32a('0x86')]=util[_0xc32a('0x61')]('SIP/%s',_0x37b670['user'][_0xc32a('0x3d')]);_0x465afb[_0xc32a('0x2a')][_0xc32a('0x7b')]=_0x331814['channel'];_0x465afb[_0xc32a('0x2a')][_0xc32a('0x7c')]=_0x331814[_0xc32a('0x7b')];_0x465afb['message']['event']=_0xc32a('0x36');respondWithRpcPromise(_0xc32a('0x7e'),_0xc32a('0x7e'),{'event':_0xc32a('0x87'),'message':_[_0xc32a('0x53')](_0x331814[_0xc32a('0x2a')],JSON[_0xc32a('0x80')](_0x331814[_0xc32a('0x6a')][_0xc32a('0x88')]))},client9002);return _0x331814;}return null;})[_0xc32a('0x39')](respondWithResult(_0x2cf48b,null))[_0xc32a('0x2d')](handleError(_0x2cf48b,null));}; \ No newline at end of file +var _0xa547=['result','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','stack','name','index','map','ChatMessage','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','chat-interactions','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','ChatInteraction','ChatInteractionId','read1stAt','user','role','interaction','null','acceptMessage','ContactId','sequelize','Sequelize','SELECT','contact','User','agent','fullname','internal','channel','event','EventManager','parse','formData','reject','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','email','interface','SIP/%s','motionChannel','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','client','http','request','then','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','info'];(function(_0x13d69b,_0x738f99){var _0x17de43=function(_0x3486f7){while(--_0x3486f7){_0x13d69b['push'](_0x13d69b['shift']());}};_0x17de43(++_0x738f99);}(_0xa547,0x1e2));var _0x7a54=function(_0x429784,_0x30442f){_0x429784=_0x429784-0x0;var _0x521752=_0xa547[_0x429784];return _0x521752;};'use strict';var emlformat=require(_0x7a54('0x0'));var rimraf=require(_0x7a54('0x1'));var zipdir=require(_0x7a54('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7a54('0x3'));var moment=require('moment');var BPromise=require(_0x7a54('0x4'));var Mustache=require(_0x7a54('0x5'));var util=require(_0x7a54('0x6'));var path=require(_0x7a54('0x7'));var sox=require(_0x7a54('0x8'));var csv=require(_0x7a54('0x9'));var ejs=require(_0x7a54('0xa'));var fs=require('fs');var fs_extra=require(_0x7a54('0xb'));var _=require(_0x7a54('0xc'));var squel=require(_0x7a54('0xd'));var crypto=require('crypto');var jsforce=require(_0x7a54('0xe'));var deskjs=require(_0x7a54('0xf'));var toCsv=require(_0x7a54('0x9'));var querystring=require('querystring');var Papa=require(_0x7a54('0x10'));var Redis=require(_0x7a54('0x11'));var authService=require(_0x7a54('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7a54('0x13'));var utils=require(_0x7a54('0x14'));var config=require(_0x7a54('0x15'));var licenseUtil=require(_0x7a54('0x16'));var db=require(_0x7a54('0x17'))['db'];config['redis']=_[_0x7a54('0x18')](config[_0x7a54('0x19')],{'host':_0x7a54('0x1a'),'port':0x18eb});var socket=require(_0x7a54('0x1b'))(new Redis(config[_0x7a54('0x19')]));require(_0x7a54('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x7a54('0x1d')][_0x7a54('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x7a54('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x32a70a,_0x226253,_0x5bfe31,_0x5b8f2d){return new BPromise(function(_0x40d320,_0x2b2e38){var _0x51a7f8=_0x5b8f2d||client;return _0x51a7f8[_0x7a54('0x1f')](_0x32a70a,_0x5bfe31)[_0x7a54('0x20')](function(_0xfa2178){logger['info']('ChatMessage,\x20%s,\x20%s',_0x226253,_0x7a54('0x21'));logger[_0x7a54('0x22')](_0x7a54('0x23'),_0x226253,_0x7a54('0x21'),JSON[_0x7a54('0x24')](_0xfa2178));if(_0xfa2178[_0x7a54('0x25')]){if(_0xfa2178[_0x7a54('0x25')][_0x7a54('0x26')]===0x1f4){logger[_0x7a54('0x25')](_0x7a54('0x27'),_0x226253,_0xfa2178[_0x7a54('0x25')]['message']);return _0x2b2e38(_0xfa2178[_0x7a54('0x25')][_0x7a54('0x28')]);}logger['error'](_0x7a54('0x27'),_0x226253,_0xfa2178[_0x7a54('0x25')][_0x7a54('0x28')]);return _0x40d320(_0xfa2178[_0x7a54('0x25')][_0x7a54('0x28')]);}else{logger[_0x7a54('0x29')](_0x7a54('0x27'),_0x226253,_0x7a54('0x21'));_0x40d320(_0xfa2178[_0x7a54('0x2a')][_0x7a54('0x28')]);}})['catch'](function(_0x1eda2f){logger[_0x7a54('0x25')]('ChatMessage,\x20%s,\x20%s',_0x226253,_0x1eda2f);_0x2b2e38(_0x1eda2f);});});}function respondWithStatusCode(_0x27be2c,_0x30bf60){_0x30bf60=_0x30bf60||0xcc;return function(_0x20ff89){if(_0x20ff89){return _0x27be2c[_0x7a54('0x2b')](_0x30bf60);}return _0x27be2c['status'](_0x30bf60)[_0x7a54('0x2c')]();};}function respondWithResult(_0xbe685,_0x281786){_0x281786=_0x281786||0xc8;return function(_0x3db911){if(_0x3db911){return _0xbe685[_0x7a54('0x2d')](_0x281786)[_0x7a54('0x2e')](_0x3db911);}};}function respondWithFilteredResult(_0x4eb0b9,_0x5cd67e){return function(_0x26fc44){if(_0x26fc44){var _0x3f7b62=typeof _0x5cd67e[_0x7a54('0x2f')]===_0x7a54('0x30')&&typeof _0x5cd67e['limit']==='undefined';var _0x51e1af=_0x26fc44[_0x7a54('0x31')];var _0x5ea571=_0x3f7b62?0x0:_0x5cd67e[_0x7a54('0x2f')];var _0x346434=_0x3f7b62?_0x26fc44['count']:_0x5cd67e['offset']+_0x5cd67e[_0x7a54('0x32')];var _0x525d95;if(_0x346434>=_0x51e1af){_0x346434=_0x51e1af;_0x525d95=0xc8;}else{_0x525d95=0xce;}_0x4eb0b9[_0x7a54('0x2d')](_0x525d95);return _0x4eb0b9[_0x7a54('0x33')](_0x7a54('0x34'),_0x5ea571+'-'+_0x346434+'/'+_0x51e1af)['json'](_0x26fc44);}return null;};}function patchUpdates(_0x16e674){return function(_0x173d7f){try{jsonpatch[_0x7a54('0x35')](_0x173d7f,_0x16e674,!![]);}catch(_0x4eb699){return BPromise['reject'](_0x4eb699);}return _0x173d7f[_0x7a54('0x36')]();};}function saveUpdates(_0x451444,_0xe341c){return function(_0x416562){if(_0x416562){return _0x416562[_0x7a54('0x37')](_0x451444)[_0x7a54('0x20')](function(_0x103299){return _0x103299;});}return null;};}function removeEntity(_0x39102b,_0x88e168){return function(_0x584989){if(_0x584989){return _0x584989[_0x7a54('0x38')]()[_0x7a54('0x20')](function(){_0x39102b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x77f304,_0x4762a5){return function(_0x5be135){if(!_0x5be135){_0x77f304[_0x7a54('0x2b')](0x194);}return _0x5be135;};}function handleError(_0x25ec3d,_0xd1e6d9){_0xd1e6d9=_0xd1e6d9||0x1f4;return function(_0x456326){logger['error'](_0x456326[_0x7a54('0x39')]);if(_0x456326[_0x7a54('0x3a')]){delete _0x456326[_0x7a54('0x3a')];}_0x25ec3d[_0x7a54('0x2d')](_0xd1e6d9)['send'](_0x456326);};}exports[_0x7a54('0x3b')]=function(_0x3dd65f,_0x1d9788){var _0x1a89d9={},_0x3dd757={},_0x2d0da8={'count':0x0,'rows':[]};var _0x1ce66a=_[_0x7a54('0x3c')](db[_0x7a54('0x3d')][_0x7a54('0x3e')],function(_0x2b506d){return{'name':_0x2b506d[_0x7a54('0x3f')],'type':_0x2b506d[_0x7a54('0x40')]['key']};});_0x3dd757[_0x7a54('0x41')]=_[_0x7a54('0x3c')](_0x1ce66a,_0x7a54('0x3a'));_0x3dd757['query']=_[_0x7a54('0x42')](_0x3dd65f[_0x7a54('0x43')]);_0x3dd757[_0x7a54('0x44')]=_[_0x7a54('0x45')](_0x3dd757['model'],_0x3dd757[_0x7a54('0x43')]);_0x1a89d9[_0x7a54('0x46')]=_[_0x7a54('0x45')](_0x3dd757[_0x7a54('0x41')],qs[_0x7a54('0x47')](_0x3dd65f[_0x7a54('0x43')][_0x7a54('0x47')]));_0x1a89d9[_0x7a54('0x46')]=_0x1a89d9[_0x7a54('0x46')][_0x7a54('0x48')]?_0x1a89d9[_0x7a54('0x46')]:_0x3dd757['model'];if(!_0x3dd65f['query'][_0x7a54('0x49')](_0x7a54('0x4a'))){_0x1a89d9[_0x7a54('0x32')]=qs[_0x7a54('0x32')](_0x3dd65f[_0x7a54('0x43')][_0x7a54('0x32')]);_0x1a89d9[_0x7a54('0x2f')]=qs[_0x7a54('0x2f')](_0x3dd65f[_0x7a54('0x43')][_0x7a54('0x2f')]);}_0x1a89d9[_0x7a54('0x4b')]=qs[_0x7a54('0x4c')](_0x3dd65f[_0x7a54('0x43')][_0x7a54('0x4c')]);_0x1a89d9[_0x7a54('0x4d')]=qs[_0x7a54('0x44')](_[_0x7a54('0x4e')](_0x3dd65f[_0x7a54('0x43')],_0x3dd757[_0x7a54('0x44')]),_0x1ce66a);if(_0x3dd65f['query']['filter']){_0x1a89d9['where']=_[_0x7a54('0x4f')](_0x1a89d9[_0x7a54('0x4d')],{'$or':_['map'](_0x1ce66a,function(_0x4a7052){if(_0x4a7052[_0x7a54('0x40')]!==_0x7a54('0x50')){var _0x57be73={};_0x57be73[_0x4a7052[_0x7a54('0x3a')]]={'$like':'%'+_0x3dd65f[_0x7a54('0x43')][_0x7a54('0x51')]+'%'};return _0x57be73;}})});}_0x1a89d9=_[_0x7a54('0x4f')]({},_0x1a89d9,_0x3dd65f[_0x7a54('0x52')]);var _0x1c54dd={'where':_0x1a89d9[_0x7a54('0x4d')]};return db[_0x7a54('0x3d')][_0x7a54('0x31')](_0x1c54dd)['then'](function(_0x2f5b59){_0x2d0da8['count']=_0x2f5b59;if(_0x3dd65f[_0x7a54('0x43')][_0x7a54('0x53')]){_0x1a89d9[_0x7a54('0x54')]=[{'all':!![]}];}return db[_0x7a54('0x3d')][_0x7a54('0x55')](_0x1a89d9);})[_0x7a54('0x20')](function(_0x53de35){_0x2d0da8['rows']=_0x53de35;return _0x2d0da8;})[_0x7a54('0x20')](respondWithFilteredResult(_0x1d9788,_0x1a89d9))[_0x7a54('0x56')](handleError(_0x1d9788,null));};exports[_0x7a54('0x57')]=function(_0x5ec3f3,_0x1db01e){var _0x5137c5={'raw':!![],'where':{'id':_0x5ec3f3[_0x7a54('0x58')]['id']}},_0x51ee6e={};_0x51ee6e['model']=_[_0x7a54('0x42')](db[_0x7a54('0x3d')][_0x7a54('0x3e')]);_0x51ee6e[_0x7a54('0x43')]=_[_0x7a54('0x42')](_0x5ec3f3[_0x7a54('0x43')]);_0x51ee6e['filters']=_[_0x7a54('0x45')](_0x51ee6e['model'],_0x51ee6e[_0x7a54('0x43')]);_0x5137c5[_0x7a54('0x46')]=_[_0x7a54('0x45')](_0x51ee6e[_0x7a54('0x41')],qs[_0x7a54('0x47')](_0x5ec3f3['query'][_0x7a54('0x47')]));_0x5137c5[_0x7a54('0x46')]=_0x5137c5[_0x7a54('0x46')][_0x7a54('0x48')]?_0x5137c5[_0x7a54('0x46')]:_0x51ee6e[_0x7a54('0x41')];if(_0x5ec3f3['query']['includeAll']){_0x5137c5[_0x7a54('0x54')]=[{'all':!![]}];}_0x5137c5=_[_0x7a54('0x4f')]({},_0x5137c5,_0x5ec3f3[_0x7a54('0x52')]);return db['ChatMessage'][_0x7a54('0x59')](_0x5137c5)[_0x7a54('0x20')](handleEntityNotFound(_0x1db01e,null))[_0x7a54('0x20')](respondWithResult(_0x1db01e,null))['catch'](handleError(_0x1db01e,null));};exports['create']=function(_0x530d9b,_0x482312){return db['ChatMessage'][_0x7a54('0x5a')](_0x530d9b[_0x7a54('0x5b')],{})[_0x7a54('0x20')](respondWithResult(_0x482312,0xc9))[_0x7a54('0x56')](handleError(_0x482312,null));};exports[_0x7a54('0x37')]=function(_0x5ed4ca,_0x623cd7){if(_0x5ed4ca['body']['id']){delete _0x5ed4ca[_0x7a54('0x5b')]['id'];}return db[_0x7a54('0x3d')][_0x7a54('0x59')]({'where':{'id':_0x5ed4ca[_0x7a54('0x58')]['id']}})['then'](handleEntityNotFound(_0x623cd7,null))[_0x7a54('0x20')](saveUpdates(_0x5ed4ca['body'],null))[_0x7a54('0x20')](respondWithResult(_0x623cd7,null))[_0x7a54('0x56')](handleError(_0x623cd7,null));};exports[_0x7a54('0x38')]=function(_0x497e91,_0x4c66ac){return db[_0x7a54('0x3d')][_0x7a54('0x59')]({'where':{'id':_0x497e91[_0x7a54('0x58')]['id']}})[_0x7a54('0x20')](handleEntityNotFound(_0x4c66ac,null))[_0x7a54('0x20')](removeEntity(_0x4c66ac,null))['catch'](handleError(_0x4c66ac,null));};exports[_0x7a54('0x5c')]=function(_0x58ebec,_0x50bac2){return db[_0x7a54('0x3d')][_0x7a54('0x5c')]()[_0x7a54('0x20')](respondWithResult(_0x50bac2,null))[_0x7a54('0x56')](handleError(_0x50bac2,null));};var interaction_log=require('../../config/logger')(_0x7a54('0x5d'));exports[_0x7a54('0x5e')]=function(_0x539aab,_0x49d2a1,_0x32c1dc){var _0x246780={'agent':{},'channel':'chat'};if(_0x539aab[_0x7a54('0x5b')]['id']){delete _0x539aab[_0x7a54('0x5b')]['id'];}_0x539aab[_0x7a54('0x5b')][_0x7a54('0x5f')]=!![];_0x539aab['body']['readAt']=moment()[_0x7a54('0x60')](_0x7a54('0x61'));_0x539aab[_0x7a54('0x5b')]['UserId']=_0x539aab[_0x7a54('0x5b')]['UserId']||_0x539aab['user']['id'];_0x246780['agent']['id']=_0x539aab['body'][_0x7a54('0x62')];return db[_0x7a54('0x3d')][_0x7a54('0x59')]({'where':{'id':_0x539aab[_0x7a54('0x58')]['id'],'UserId':null}})[_0x7a54('0x20')](handleEntityNotFound(_0x49d2a1,null))[_0x7a54('0x20')](saveUpdates(_0x539aab[_0x7a54('0x5b')],null))[_0x7a54('0x20')](function(_0x128f86){if(_0x128f86){_0x246780[_0x7a54('0x28')]=_0x128f86[_0x7a54('0x63')]({'plain':!![]});return db[_0x7a54('0x64')][_0x7a54('0x59')]({'where':{'id':_0x128f86[_0x7a54('0x65')]}});}return null;})[_0x7a54('0x20')](handleEntityNotFound(_0x49d2a1,null))['then'](function(_0x11a233){if(_0x11a233){return _0x11a233[_0x7a54('0x37')]({'UserId':_0x539aab[_0x7a54('0x5b')][_0x7a54('0x62')],'read1stAt':_['isNil'](_0x11a233[_0x7a54('0x66')])?moment()[_0x7a54('0x60')](_0x7a54('0x61')):undefined});}return null;})['then'](function(_0x14fbe8){if(_0x14fbe8){_0x246780['interaction']=_0x14fbe8['get']({'plain':!![]});interaction_log[_0x7a54('0x29')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x539aab[_0x7a54('0x67')]['id'],_0x539aab[_0x7a54('0x67')][_0x7a54('0x3a')],_0x539aab[_0x7a54('0x67')][_0x7a54('0x68')],_0x246780[_0x7a54('0x69')]['id'],_0x539aab[_0x7a54('0x5b')]?JSON[_0x7a54('0x24')](_0x539aab[_0x7a54('0x5b')]):_0x7a54('0x6a'));return respondWithRpcPromise('AcceptMessage',_0x7a54('0x6b'),_0x246780);}return null;})[_0x7a54('0x20')](function(_0x3c6d9f){var _0x5e80e5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3c6d9f['message'][_0x7a54('0x6c')];return db[_0x7a54('0x6d')][_0x7a54('0x43')](_0x5e80e5,{'type':db[_0x7a54('0x6e')]['QueryTypes'][_0x7a54('0x6f')],'raw':!![]})[_0x7a54('0x20')](function(_0x5ce196){return _0x5ce196;});})[_0x7a54('0x20')](function(_0x492d36){if(_0x492d36){_0x246780[_0x7a54('0x28')][_0x7a54('0x70')]=_0x492d36[0x0];if(!_0x539aab[_0x7a54('0x5b')][_0x7a54('0x62')])return;return db[_0x7a54('0x71')]['find']({'where':{'id':_0x539aab[_0x7a54('0x5b')][_0x7a54('0x62')],'role':_0x7a54('0x72')},'attributes':['id',_0x7a54('0x3a'),_0x7a54('0x73'),'email',_0x7a54('0x74')],'raw':!![]});}return null;})[_0x7a54('0x20')](function(_0x1aed54){if(!_0x1aed54)return null;_0x246780[_0x7a54('0x28')][_0x7a54('0x72')]=_0x1aed54;return _0x246780;})[_0x7a54('0x20')](function(_0x23ec61){if(_0x23ec61){if(_0x539aab['body']['manual']){_0x246780['message']['interface']=util[_0x7a54('0x60')]('SIP/%s',_0x539aab[_0x7a54('0x67')]['name']);_0x246780[_0x7a54('0x28')][_0x7a54('0x75')]=_0x246780[_0x7a54('0x75')];_0x246780['message']['motionChannel']=_0x246780[_0x7a54('0x75')];_0x246780['message'][_0x7a54('0x76')]='accept';return respondWithRpcPromise(_0x7a54('0x77'),_0x7a54('0x77'),{'event':'acceptmessage','message':_[_0x7a54('0x4f')](_0x246780[_0x7a54('0x28')],JSON[_0x7a54('0x78')](_0x246780[_0x7a54('0x69')][_0x7a54('0x79')]))},client9002)[_0x7a54('0x20')](function(){return _0x246780;});}return _0x246780;}return null;})[_0x7a54('0x20')](respondWithResult(_0x49d2a1,null))[_0x7a54('0x56')](handleError(_0x49d2a1,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0x7a54('0x7a')]=function(_0x2f1013,_0x7fccee,_0x4bfe22){var _0x2a6761={'agent':{},'channel':'chat'};if(_0x2f1013['body']['id']){delete _0x2f1013[_0x7a54('0x5b')]['id'];}_0x2f1013['body']['UserId']=_0x2f1013[_0x7a54('0x5b')][_0x7a54('0x62')]||_0x2f1013[_0x7a54('0x67')]['id'];_0x2a6761[_0x7a54('0x72')]['id']=_0x2f1013['body'][_0x7a54('0x62')];return db[_0x7a54('0x3d')][_0x7a54('0x59')]({'where':{'id':_0x2f1013[_0x7a54('0x58')]['id'],'UserId':null}})[_0x7a54('0x20')](handleEntityNotFound(_0x7fccee,null))['then'](function(_0x30ec6f){if(_0x30ec6f){_0x2a6761[_0x7a54('0x28')]=_0x30ec6f[_0x7a54('0x63')]({'plain':!![]});return db[_0x7a54('0x64')][_0x7a54('0x59')]({'where':{'id':_0x30ec6f[_0x7a54('0x65')]}});}return null;})[_0x7a54('0x20')](handleEntityNotFound(_0x7fccee,null))[_0x7a54('0x20')](function(_0x30d9be){if(_0x30d9be){_0x2a6761[_0x7a54('0x69')]=_0x30d9be[_0x7a54('0x63')]({'plain':!![]});interaction_log[_0x7a54('0x29')](_0x7a54('0x7b'),_0x2f1013['user']['id'],_0x2f1013['user'][_0x7a54('0x3a')],_0x2f1013['user'][_0x7a54('0x68')],_0x2a6761[_0x7a54('0x69')]['id'],_0x2f1013[_0x7a54('0x5b')]?JSON[_0x7a54('0x24')](_0x2f1013[_0x7a54('0x5b')]):_0x7a54('0x6a'));return respondWithRpcPromise(_0x7a54('0x7c'),_0x7a54('0x7d'),_0x2a6761);}return null;})[_0x7a54('0x20')](function(_0x322350){var _0x28a2e1=_0x7a54('0x7e')+_0x322350[_0x7a54('0x28')][_0x7a54('0x6c')];return db[_0x7a54('0x6d')][_0x7a54('0x43')](_0x28a2e1,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x7a54('0x20')](function(_0xf92a79){return _0xf92a79;});})[_0x7a54('0x20')](function(_0xbbd82){if(_0xbbd82){_0x2a6761[_0x7a54('0x28')][_0x7a54('0x70')]=_0xbbd82[0x0];if(!_0x2f1013[_0x7a54('0x5b')][_0x7a54('0x62')])return;return db[_0x7a54('0x71')][_0x7a54('0x59')]({'where':{'id':_0x2f1013[_0x7a54('0x5b')][_0x7a54('0x62')],'role':_0x7a54('0x72')},'attributes':['id',_0x7a54('0x3a'),_0x7a54('0x73'),_0x7a54('0x7f'),'internal'],'raw':!![]});}return null;})[_0x7a54('0x20')](function(_0x135f84){if(!_0x135f84)return null;_0x2a6761[_0x7a54('0x28')][_0x7a54('0x72')]=_0x135f84;return _0x2a6761;})[_0x7a54('0x20')](function(_0xa051d8){if(_0xa051d8){_0xa051d8[_0x7a54('0x28')][_0x7a54('0x80')]=util[_0x7a54('0x60')](_0x7a54('0x81'),_0x2f1013[_0x7a54('0x67')][_0x7a54('0x3a')]);_0xa051d8[_0x7a54('0x28')]['channel']=_0x2a6761['channel'];_0xa051d8['message'][_0x7a54('0x82')]=_0x2a6761['channel'];_0xa051d8['message'][_0x7a54('0x76')]=_0x7a54('0x7a');respondWithRpcPromise(_0x7a54('0x77'),'EventManager',{'event':'rejectmessage','message':_[_0x7a54('0x4f')](_0x2a6761[_0x7a54('0x28')],JSON['parse'](_0x2a6761[_0x7a54('0x69')][_0x7a54('0x79')]))},client9002);return _0x2a6761;}return null;})['then'](respondWithResult(_0x7fccee,null))[_0x7a54('0x56')](handleError(_0x7fccee,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 910b278..d8378ec 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 _0xeb82=['hasOwnProperty','hook','exports','../../mysqldb','ChatMessage','setMaxListeners','update','emit'];(function(_0x95ed4c,_0x2a89e6){var _0x4630cd=function(_0x36c572){while(--_0x36c572){_0x95ed4c['push'](_0x95ed4c['shift']());}};_0x4630cd(++_0x2a89e6);}(_0xeb82,0x163));var _0x2eb8=function(_0x1e18d3,_0x3099aa){_0x1e18d3=_0x1e18d3-0x0;var _0x4660e9=_0xeb82[_0x1e18d3];return _0x4660e9;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x2eb8('0x0'))['db'][_0x2eb8('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x2eb8('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2eb8('0x3'),'afterDestroy':'remove'};function emitEvent(_0x91f7b){return function(_0x33ede9,_0x5b22a0,_0x397297){ChatMessageEvents[_0x2eb8('0x4')](_0x91f7b+':'+_0x33ede9['id'],_0x33ede9);ChatMessageEvents[_0x2eb8('0x4')](_0x91f7b,_0x33ede9);_0x397297(null);};}for(var e in events){if(events[_0x2eb8('0x5')](e)){var event=events[e];ChatMessage[_0x2eb8('0x6')](e,emitEvent(event));}}module[_0x2eb8('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x082e=['hasOwnProperty','hook','exports','events','ChatMessage','setMaxListeners','save','update','emit'];(function(_0x281c6e,_0x3607ed){var _0x11062c=function(_0x292e51){while(--_0x292e51){_0x281c6e['push'](_0x281c6e['shift']());}};_0x11062c(++_0x3607ed);}(_0x082e,0x8a));var _0xe082=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x082e[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xe082('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xe082('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xe082('0x2')](0x0);var events={'afterCreate':_0xe082('0x3'),'afterUpdate':_0xe082('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3e396b){return function(_0xe2f80a,_0x2cf36e,_0x5d9518){ChatMessageEvents[_0xe082('0x5')](_0x3e396b+':'+_0xe2f80a['id'],_0xe2f80a);ChatMessageEvents[_0xe082('0x5')](_0x3e396b,_0xe2f80a);_0x5d9518(null);};}for(var e in events){if(events[_0xe082('0x6')](e)){var event=events[e];ChatMessage[_0xe082('0x7')](e,emitEvent(event));}}module[_0xe082('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index fc8fc5d..f53ad03 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 _0x8d0e=['bluebird','request-promise','path','rimraf','./chatMessage.attributes','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','ChatInteraction','ChatInteractionId','update','createdAt','catch','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0x3d5351,_0x27bc80){var _0x1db4db=function(_0x3f572b){while(--_0x3f572b){_0x3d5351['push'](_0x3d5351['shift']());}};_0x1db4db(++_0x27bc80);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x5bc022,_0x6b78e5){_0x5bc022=_0x5bc022-0x0;var _0x229e50=_0x8d0e[_0x5bc022];return _0x229e50;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var logger=require(_0xe8d0('0x2'))(_0xe8d0('0x3'));var moment=require(_0xe8d0('0x4'));var BPromise=require(_0xe8d0('0x5'));var rp=require(_0xe8d0('0x6'));var fs=require('fs');var path=require(_0xe8d0('0x7'));var rimraf=require(_0xe8d0('0x8'));var config=require('../../config/environment');var attributes=require(_0xe8d0('0x9'));module['exports']=function(_0x560dab,_0x2e2985){return _0x560dab[_0xe8d0('0xa')](_0xe8d0('0xb'),attributes,{'tableName':_0xe8d0('0xc'),'paranoid':![],'indexes':[{'name':_0xe8d0('0xd'),'fields':[_0xe8d0('0xe')],'type':_0xe8d0('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x37deac,_0x5605a0,_0x10e56c){var _0x19c3d0=_0x560dab[_0xe8d0('0x10')];var _0x599bc3=_0x37deac['get']({'plain':!![]});if(_0x599bc3[_0xe8d0('0x11')][_0xe8d0('0x12')]()==='in'||_0x599bc3[_0xe8d0('0x11')][_0xe8d0('0x12')]()===_0xe8d0('0x13')&&!_0x599bc3[_0xe8d0('0x14')]&&!_['isNil'](_0x599bc3[_0xe8d0('0x15')])){_0x19c3d0[_0xe8d0('0x16')]['findOne']({'where':{'id':_0x599bc3[_0xe8d0('0x17')]}})['then'](function(_0x59b4b7){if(_0x59b4b7){_0x59b4b7[_0xe8d0('0x18')]({'lastMsgAt':_0x599bc3[_0xe8d0('0x19')],'lastMsgDirection':_0x599bc3[_0xe8d0('0x11')][_0xe8d0('0x12')]()});}})[_0xe8d0('0x1a')](function(_0x7151c6){console['error'](_0x7151c6);});}_0x10e56c();}},'charset':_0xe8d0('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe914=['secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','FULLTEXT','models','direction','toLowerCase','out'];(function(_0x34f75c,_0x29cfa3){var _0x4b96cc=function(_0x33982c){while(--_0x33982c){_0x34f75c['push'](_0x34f75c['shift']());}};_0x4b96cc(++_0x29cfa3);}(_0xe914,0x7f));var _0x4e91=function(_0x2eba9d,_0x37d0f8){_0x2eba9d=_0x2eba9d-0x0;var _0x5affcd=_0xe914[_0x2eba9d];return _0x5affcd;};'use strict';var _=require(_0x4e91('0x0'));var util=require(_0x4e91('0x1'));var logger=require('../../config/logger')(_0x4e91('0x2'));var moment=require(_0x4e91('0x3'));var BPromise=require(_0x4e91('0x4'));var rp=require(_0x4e91('0x5'));var fs=require('fs');var path=require(_0x4e91('0x6'));var rimraf=require(_0x4e91('0x7'));var config=require('../../config/environment');var attributes=require(_0x4e91('0x8'));module[_0x4e91('0x9')]=function(_0x5d4c14,_0x29c27c){return _0x5d4c14[_0x4e91('0xa')](_0x4e91('0xb'),attributes,{'tableName':_0x4e91('0xc'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':_0x4e91('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x49d0d3,_0x523dec,_0xa7ca19){var _0x1a0504=_0x5d4c14[_0x4e91('0xe')];var _0x2762e9=_0x49d0d3['get']({'plain':!![]});if(_0x2762e9[_0x4e91('0xf')][_0x4e91('0x10')]()==='in'||_0x2762e9[_0x4e91('0xf')]['toLowerCase']()===_0x4e91('0x11')&&!_0x2762e9[_0x4e91('0x12')]&&!_[_0x4e91('0x13')](_0x2762e9[_0x4e91('0x14')])){_0x1a0504[_0x4e91('0x15')][_0x4e91('0x16')]({'where':{'id':_0x2762e9[_0x4e91('0x17')]}})[_0x4e91('0x18')](function(_0x3c7a15){if(_0x3c7a15){_0x3c7a15['update']({'lastMsgAt':_0x2762e9[_0x4e91('0x19')],'lastMsgDirection':_0x2762e9[_0x4e91('0xf')][_0x4e91('0x10')]()});}})['catch'](function(_0x327d64){console[_0x4e91('0x1a')](_0x327d64);});}_0xa7ca19();}},'charset':_0x4e91('0x1b'),'collate':_0x4e91('0x1c')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 12285d1..39b8fc9 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 _0xc9d2=['redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateChatMessage','create','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b6667,_0x2ec2d9){var _0x2803ad=function(_0x599e94){while(--_0x599e94){_0x3b6667['push'](_0x3b6667['shift']());}};_0x2803ad(++_0x2ec2d9);}(_0xc9d2,0x137));var _0x2c9d=function(_0x405a9f,_0x5d49d8){_0x405a9f=_0x405a9f-0x0;var _0x243149=_0xc9d2[_0x405a9f];return _0x243149;};'use strict';var _=require(_0x2c9d('0x0'));var util=require(_0x2c9d('0x1'));var moment=require(_0x2c9d('0x2'));var BPromise=require(_0x2c9d('0x3'));var rs=require(_0x2c9d('0x4'));var fs=require('fs');var Redis=require(_0x2c9d('0x5'));var db=require(_0x2c9d('0x6'))['db'];var utils=require(_0x2c9d('0x7'));var logger=require(_0x2c9d('0x8'))(_0x2c9d('0x9'));var config=require(_0x2c9d('0xa'));var jayson=require(_0x2c9d('0xb'));var client=jayson['client'][_0x2c9d('0xc')]({'port':0x232a});config[_0x2c9d('0xd')]=_[_0x2c9d('0xe')](config[_0x2c9d('0xd')],{'host':_0x2c9d('0xf'),'port':0x18eb});var socket=require(_0x2c9d('0x10'))(new Redis(config[_0x2c9d('0xd')]));require('./chatMessage.socket')[_0x2c9d('0x11')](socket);function respondWithRpcPromise(_0x46f3da,_0x372f56,_0x2814a8){return new BPromise(function(_0x5bc82d,_0x1c9017){return client[_0x2c9d('0x12')](_0x46f3da,_0x2814a8)[_0x2c9d('0x13')](function(_0x415ff1){logger[_0x2c9d('0x14')](_0x2c9d('0x15'),_0x372f56,_0x2c9d('0x16'));logger[_0x2c9d('0x17')](_0x2c9d('0x18'),_0x372f56,_0x2c9d('0x16'),JSON[_0x2c9d('0x19')](_0x415ff1));if(_0x415ff1[_0x2c9d('0x1a')]){if(_0x415ff1[_0x2c9d('0x1a')][_0x2c9d('0x1b')]===0x1f4){logger['error'](_0x2c9d('0x15'),_0x372f56,_0x415ff1[_0x2c9d('0x1a')][_0x2c9d('0x1c')]);return _0x1c9017(_0x415ff1[_0x2c9d('0x1a')]['message']);}logger[_0x2c9d('0x1a')](_0x2c9d('0x15'),_0x372f56,_0x415ff1[_0x2c9d('0x1a')][_0x2c9d('0x1c')]);return _0x5bc82d(_0x415ff1['error'][_0x2c9d('0x1c')]);}else{logger['info'](_0x2c9d('0x15'),_0x372f56,'request\x20sent');_0x5bc82d(_0x415ff1[_0x2c9d('0x1d')][_0x2c9d('0x1c')]);}})['catch'](function(_0x5d8fbe){logger[_0x2c9d('0x1a')](_0x2c9d('0x15'),_0x372f56,_0x5d8fbe);_0x1c9017(_0x5d8fbe);});});}exports[_0x2c9d('0x1e')]=function(_0x421e3d){var _0x1dce15=this;return new Promise(function(_0x4e7b7d,_0x44e27f){return db['ChatMessage'][_0x2c9d('0x1f')](_0x421e3d[_0x2c9d('0x20')],{'raw':_0x421e3d[_0x2c9d('0x21')]?_0x421e3d['options'][_0x2c9d('0x22')]===undefined?!![]:![]:!![]})[_0x2c9d('0x13')](function(_0x37a5b3){logger[_0x2c9d('0x14')](_0x2c9d('0x1e'),_0x421e3d);logger[_0x2c9d('0x17')](_0x2c9d('0x1e'),_0x421e3d,JSON[_0x2c9d('0x19')](_0x37a5b3));_0x4e7b7d(_0x37a5b3);})[_0x2c9d('0x23')](function(_0x579465){logger['error']('CreateChatMessage',_0x579465[_0x2c9d('0x1c')],_0x421e3d);_0x44e27f(_0x1dce15['error'](0x1f4,_0x579465[_0x2c9d('0x1c')]));});});}; \ No newline at end of file +var _0x4b8a=['info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatMessage.socket','register','then'];(function(_0x111965,_0x1b586a){var _0x1812ac=function(_0xa5faee){while(--_0xa5faee){_0x111965['push'](_0x111965['shift']());}};_0x1812ac(++_0x1b586a);}(_0x4b8a,0x1a8));var _0xa4b8=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4b8a[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xa4b8('0x0'));var util=require(_0xa4b8('0x1'));var moment=require(_0xa4b8('0x2'));var BPromise=require(_0xa4b8('0x3'));var rs=require(_0xa4b8('0x4'));var fs=require('fs');var Redis=require(_0xa4b8('0x5'));var db=require(_0xa4b8('0x6'))['db'];var utils=require(_0xa4b8('0x7'));var logger=require(_0xa4b8('0x8'))(_0xa4b8('0x9'));var config=require(_0xa4b8('0xa'));var jayson=require(_0xa4b8('0xb'));var client=jayson[_0xa4b8('0xc')][_0xa4b8('0xd')]({'port':0x232a});config[_0xa4b8('0xe')]=_[_0xa4b8('0xf')](config[_0xa4b8('0xe')],{'host':_0xa4b8('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa4b8('0x11'))[_0xa4b8('0x12')](socket);function respondWithRpcPromise(_0x4d384e,_0x34a645,_0xbe5bba){return new BPromise(function(_0x55d6fa,_0x34b723){return client['request'](_0x4d384e,_0xbe5bba)[_0xa4b8('0x13')](function(_0x9e7a10){logger[_0xa4b8('0x14')](_0xa4b8('0x15'),_0x34a645,_0xa4b8('0x16'));logger['debug'](_0xa4b8('0x17'),_0x34a645,_0xa4b8('0x16'),JSON['stringify'](_0x9e7a10));if(_0x9e7a10['error']){if(_0x9e7a10[_0xa4b8('0x18')][_0xa4b8('0x19')]===0x1f4){logger[_0xa4b8('0x18')](_0xa4b8('0x15'),_0x34a645,_0x9e7a10[_0xa4b8('0x18')][_0xa4b8('0x1a')]);return _0x34b723(_0x9e7a10['error'][_0xa4b8('0x1a')]);}logger[_0xa4b8('0x18')](_0xa4b8('0x15'),_0x34a645,_0x9e7a10['error'][_0xa4b8('0x1a')]);return _0x55d6fa(_0x9e7a10[_0xa4b8('0x18')][_0xa4b8('0x1a')]);}else{logger['info'](_0xa4b8('0x15'),_0x34a645,_0xa4b8('0x16'));_0x55d6fa(_0x9e7a10[_0xa4b8('0x1b')][_0xa4b8('0x1a')]);}})[_0xa4b8('0x1c')](function(_0xe17c78){logger[_0xa4b8('0x18')](_0xa4b8('0x15'),_0x34a645,_0xe17c78);_0x34b723(_0xe17c78);});});}exports[_0xa4b8('0x1d')]=function(_0x48c08b){var _0x34cae3=this;return new Promise(function(_0x82746c,_0x449680){return db[_0xa4b8('0x1e')][_0xa4b8('0x1f')](_0x48c08b[_0xa4b8('0x20')],{'raw':_0x48c08b['options']?_0x48c08b[_0xa4b8('0x21')][_0xa4b8('0x22')]===undefined?!![]:![]:!![]})[_0xa4b8('0x13')](function(_0x288f13){logger[_0xa4b8('0x14')](_0xa4b8('0x1d'),_0x48c08b);logger[_0xa4b8('0x23')](_0xa4b8('0x1d'),_0x48c08b,JSON[_0xa4b8('0x24')](_0x288f13));_0x82746c(_0x288f13);})[_0xa4b8('0x1c')](function(_0x4d256a){logger['error'](_0xa4b8('0x1d'),_0x4d256a[_0xa4b8('0x1a')],_0x48c08b);_0x449680(_0x34cae3[_0xa4b8('0x18')](0x1f4,_0x4d256a[_0xa4b8('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 48d35b2..f9fc62d 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 _0x6dac=['update','emit','removeListener','register','length','chatMessage:','./chatMessage.events','save','remove'];(function(_0x27b175,_0x35ad4c){var _0x22bd77=function(_0x41e046){while(--_0x41e046){_0x27b175['push'](_0x27b175['shift']());}};_0x22bd77(++_0x35ad4c);}(_0x6dac,0x16e));var _0xc6da=function(_0x2477cf,_0xefe750){_0x2477cf=_0x2477cf-0x0;var _0x42ac3a=_0x6dac[_0x2477cf];return _0x42ac3a;};'use strict';var ChatMessageEvents=require(_0xc6da('0x0'));var events=[_0xc6da('0x1'),_0xc6da('0x2'),_0xc6da('0x3')];function createListener(_0x133ecc,_0x224a52){return function(_0x3391f5){_0x224a52[_0xc6da('0x4')](_0x133ecc,_0x3391f5);};}function removeListener(_0x28663f,_0x338470){return function(){ChatMessageEvents[_0xc6da('0x5')](_0x28663f,_0x338470);};}exports[_0xc6da('0x6')]=function(_0x325f49){for(var _0x5caf49=0x0,_0x1ebd11=events[_0xc6da('0x7')];_0x5caf49<_0x1ebd11;_0x5caf49++){var _0x5a0d8d=events[_0x5caf49];var _0x3047d3=createListener(_0xc6da('0x8')+_0x5a0d8d,_0x325f49);ChatMessageEvents['on'](_0x5a0d8d,_0x3047d3);}}; \ No newline at end of file +var _0x3148=['save','update','removeListener','register','chatMessage:','./chatMessage.events'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x3148,0x1d3));var _0x8314=function(_0x85f059,_0x27d70e){_0x85f059=_0x85f059-0x0;var _0x3520f7=_0x3148[_0x85f059];return _0x3520f7;};'use strict';var ChatMessageEvents=require(_0x8314('0x0'));var events=[_0x8314('0x1'),'remove',_0x8314('0x2')];function createListener(_0xf80bf9,_0x1b13ca){return function(_0x63760b){_0x1b13ca['emit'](_0xf80bf9,_0x63760b);};}function removeListener(_0x35ee55,_0x41e9fd){return function(){ChatMessageEvents[_0x8314('0x3')](_0x35ee55,_0x41e9fd);};}exports[_0x8314('0x4')]=function(_0x18a30b){for(var _0x9cb271=0x0,_0x1bd913=events['length'];_0x9cb271<_0x1bd913;_0x9cb271++){var _0x837c1f=events[_0x9cb271];var _0x4df2b0=createListener(_0x8314('0x5')+_0x837c1f,_0x18a30b);ChatMessageEvents['on'](_0x837c1f,_0x4df2b0);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index fb36d70..4c53f3e 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 _0xd2c1=['/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','describe','show','post','tracked','chat','chatmessage:create','create','put','update'];(function(_0x368924,_0x14f790){var _0x3236d=function(_0x172452){while(--_0x172452){_0x368924['push'](_0x368924['shift']());}};_0x3236d(++_0x14f790);}(_0xd2c1,0x77));var _0x1d2c=function(_0x40ebff,_0x1dd15e){_0x40ebff=_0x40ebff-0x0;var _0x40122a=_0xd2c1[_0x40ebff];return _0x40122a;};'use strict';var multer=require('multer');var util=require(_0x1d2c('0x0'));var path=require(_0x1d2c('0x1'));var timeout=require(_0x1d2c('0x2'));var express=require(_0x1d2c('0x3'));var router=express[_0x1d2c('0x4')]();var fs_extra=require(_0x1d2c('0x5'));var auth=require(_0x1d2c('0x6'));var interaction=require(_0x1d2c('0x7'));var config=require(_0x1d2c('0x8'));var controller=require(_0x1d2c('0x9'));router[_0x1d2c('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1d2c('0xa')]('/describe',auth[_0x1d2c('0xb')](),controller[_0x1d2c('0xc')]);router[_0x1d2c('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x1d2c('0xd')]);router[_0x1d2c('0xe')]('/',auth[_0x1d2c('0xb')](),interaction[_0x1d2c('0xf')](_0x1d2c('0x10'),_0x1d2c('0x11')),controller[_0x1d2c('0x12')]);router[_0x1d2c('0x13')]('/:id',controller[_0x1d2c('0x14')]);router['put'](_0x1d2c('0x15'),auth[_0x1d2c('0xb')](),controller[_0x1d2c('0x16')]);router[_0x1d2c('0x13')](_0x1d2c('0x17'),auth['isAuthenticated'](),controller[_0x1d2c('0x18')]);router[_0x1d2c('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x1d2c('0x1a')]);module[_0x1d2c('0x1b')]=router; \ No newline at end of file +var _0xfe91=['/describe','isAuthenticated','/:id','show','post','chat','chatmessage:create','update','put','/:id/accept','accept','/:id/reject','reject','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','get','index'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0xfe91,0x1f3));var _0x1fe9=function(_0x11dc39,_0x491115){_0x11dc39=_0x11dc39-0x0;var _0x457277=_0xfe91[_0x11dc39];return _0x457277;};'use strict';var multer=require('multer');var util=require(_0x1fe9('0x0'));var path=require(_0x1fe9('0x1'));var timeout=require(_0x1fe9('0x2'));var express=require(_0x1fe9('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1fe9('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatMessage.controller');router[_0x1fe9('0x5')]('/',auth['isAuthenticated'](),controller[_0x1fe9('0x6')]);router['get'](_0x1fe9('0x7'),auth[_0x1fe9('0x8')](),controller['describe']);router['get'](_0x1fe9('0x9'),auth[_0x1fe9('0x8')](),controller[_0x1fe9('0xa')]);router[_0x1fe9('0xb')]('/',auth[_0x1fe9('0x8')](),interaction['tracked'](_0x1fe9('0xc'),_0x1fe9('0xd')),controller['create']);router['put']('/:id',controller[_0x1fe9('0xe')]);router[_0x1fe9('0xf')](_0x1fe9('0x10'),auth['isAuthenticated'](),controller[_0x1fe9('0x11')]);router[_0x1fe9('0xf')](_0x1fe9('0x12'),auth[_0x1fe9('0x8')](),controller[_0x1fe9('0x13')]);router['delete'](_0x1fe9('0x9'),auth[_0x1fe9('0x8')](),controller[_0x1fe9('0x14')]);module[_0x1fe9('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 00dbee5..4a2067e 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 _0x1ea4=['TEXT','medium','exports'];(function(_0x26c025,_0x14321d){var _0x4f9865=function(_0x45af80){while(--_0x45af80){_0x26c025['push'](_0x26c025['shift']());}};_0x4f9865(++_0x14321d);}(_0x1ea4,0x1b2));var _0x41ea=function(_0x44c243,_0x4be132){_0x44c243=_0x44c243-0x0;var _0x505b0f=_0x1ea4[_0x44c243];return _0x505b0f;};'use strict';var Sequelize=require('sequelize');module[_0x41ea('0x0')]={'body':{'type':Sequelize[_0x41ea('0x1')](_0x41ea('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x4f17=['medium','sequelize','exports','TEXT'];(function(_0x2cfc8e,_0x46fc38){var _0x25cd3a=function(_0x159022){while(--_0x159022){_0x2cfc8e['push'](_0x2cfc8e['shift']());}};_0x25cd3a(++_0x46fc38);}(_0x4f17,0xed));var _0x74f1=function(_0x3d2b19,_0x349a5b){_0x3d2b19=_0x3d2b19-0x0;var _0x29769b=_0x4f17[_0x3d2b19];return _0x29769b;};'use strict';var Sequelize=require(_0x74f1('0x0'));module[_0x74f1('0x1')]={'body':{'type':Sequelize[_0x74f1('0x2')](_0x74f1('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 003bb8f..1358a0a 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(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x7a54,0x106));var _0x47a5=function(_0x4354b5,_0x4d9d26){_0x4354b5=_0x4354b5-0x0;var _0x26931a=_0x7a54[_0x4354b5];return _0x26931a;};'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 _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x2588eb,_0x4db65e){var _0x4c21f5=function(_0x186414){while(--_0x186414){_0x2588eb['push'](_0x2588eb['shift']());}};_0x4c21f5(++_0x4db65e);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index a2248c6..0773977 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 _0x8d24=['exports','define','api','moment','bluebird','request-promise','path'];(function(_0x16ba74,_0x2ebcfa){var _0x4333a6=function(_0x13b137){while(--_0x13b137){_0x16ba74['push'](_0x16ba74['shift']());}};_0x4333a6(++_0x2ebcfa);}(_0x8d24,0x11a));var _0x48d2=function(_0x119880,_0x4f291f){_0x119880=_0x119880-0x0;var _0x4a1707=_0x8d24[_0x119880];return _0x4a1707;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x48d2('0x0'));var moment=require(_0x48d2('0x1'));var BPromise=require(_0x48d2('0x2'));var rp=require(_0x48d2('0x3'));var fs=require('fs');var path=require(_0x48d2('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatOfflineMessage.attributes');module[_0x48d2('0x5')]=function(_0x2285d0,_0x5a9be5){return _0x2285d0[_0x48d2('0x6')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa4db=['exports','define','ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf','./chatOfflineMessage.attributes'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xa4db,0x17e));var _0xba4d=function(_0xe6c9,_0x3a8fea){_0xe6c9=_0xe6c9-0x0;var _0x3c31eb=_0xa4db[_0xe6c9];return _0x3c31eb;};'use strict';var _=require('lodash');var util=require(_0xba4d('0x0'));var logger=require(_0xba4d('0x1'))(_0xba4d('0x2'));var moment=require(_0xba4d('0x3'));var BPromise=require(_0xba4d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xba4d('0x5'));var rimraf=require(_0xba4d('0x6'));var config=require('../../config/environment');var attributes=require(_0xba4d('0x7'));module[_0xba4d('0x8')]=function(_0x1f3e2e,_0x4017d6){return _0x1f3e2e[_0xba4d('0x9')](_0xba4d('0xa'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xba4d('0xb'),'collate':_0xba4d('0xc')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 579a69c..dd66780 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 _0xaf66=['../../config/utils','rpc','../../config/environment','jayson/promise','client','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x803363,_0x4c77bc){var _0x55e30f=function(_0x40def4){while(--_0x40def4){_0x803363['push'](_0x803363['shift']());}};_0x55e30f(++_0x4c77bc);}(_0xaf66,0x7f));var _0x6af6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xaf66[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0x6af6('0x0'));var util=require(_0x6af6('0x1'));var moment=require(_0x6af6('0x2'));var BPromise=require(_0x6af6('0x3'));var rs=require(_0x6af6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6af6('0x5'))['db'];var utils=require(_0x6af6('0x6'));var logger=require('../../config/logger')(_0x6af6('0x7'));var config=require(_0x6af6('0x8'));var jayson=require(_0x6af6('0x9'));var client=jayson[_0x6af6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x102ea5,_0xbe04fb,_0x27993c){return new BPromise(function(_0x318904,_0x34d53e){return client['request'](_0x102ea5,_0x27993c)['then'](function(_0xf8fe2){logger[_0x6af6('0xb')](_0x6af6('0xc'),_0xbe04fb,'request\x20sent');logger[_0x6af6('0xd')](_0x6af6('0xe'),_0xbe04fb,'request\x20sent',JSON['stringify'](_0xf8fe2));if(_0xf8fe2[_0x6af6('0xf')]){if(_0xf8fe2[_0x6af6('0xf')]['code']===0x1f4){logger[_0x6af6('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0xbe04fb,_0xf8fe2[_0x6af6('0xf')]['message']);return _0x34d53e(_0xf8fe2[_0x6af6('0xf')][_0x6af6('0x10')]);}logger['error'](_0x6af6('0xc'),_0xbe04fb,_0xf8fe2['error'][_0x6af6('0x10')]);return _0x318904(_0xf8fe2['error'][_0x6af6('0x10')]);}else{logger[_0x6af6('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0xbe04fb,_0x6af6('0x11'));_0x318904(_0xf8fe2['result'][_0x6af6('0x10')]);}})[_0x6af6('0x12')](function(_0x2ee1b2){logger[_0x6af6('0xf')](_0x6af6('0xc'),_0xbe04fb,_0x2ee1b2);_0x34d53e(_0x2ee1b2);});});} \ No newline at end of file +var _0xf596=['message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xb718ab,_0x93e840){var _0x363b02=function(_0x4843bc){while(--_0x4843bc){_0xb718ab['push'](_0xb718ab['shift']());}};_0x363b02(++_0x93e840);}(_0xf596,0xd3));var _0x6f59=function(_0x48dcc0,_0x43e1e4){_0x48dcc0=_0x48dcc0-0x0;var _0x4a2088=_0xf596[_0x48dcc0];return _0x4a2088;};'use strict';var _=require(_0x6f59('0x0'));var util=require(_0x6f59('0x1'));var moment=require(_0x6f59('0x2'));var BPromise=require(_0x6f59('0x3'));var rs=require(_0x6f59('0x4'));var fs=require('fs');var Redis=require(_0x6f59('0x5'));var db=require(_0x6f59('0x6'))['db'];var utils=require(_0x6f59('0x7'));var logger=require(_0x6f59('0x8'))(_0x6f59('0x9'));var config=require(_0x6f59('0xa'));var jayson=require(_0x6f59('0xb'));var client=jayson[_0x6f59('0xc')][_0x6f59('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x36144d,_0x4c8fad,_0x172ba4){return new BPromise(function(_0x570caa,_0x3ad787){return client[_0x6f59('0xe')](_0x36144d,_0x172ba4)[_0x6f59('0xf')](function(_0x3dd96b){logger['info'](_0x6f59('0x10'),_0x4c8fad,_0x6f59('0x11'));logger[_0x6f59('0x12')](_0x6f59('0x13'),_0x4c8fad,_0x6f59('0x11'),JSON[_0x6f59('0x14')](_0x3dd96b));if(_0x3dd96b[_0x6f59('0x15')]){if(_0x3dd96b[_0x6f59('0x15')][_0x6f59('0x16')]===0x1f4){logger[_0x6f59('0x15')](_0x6f59('0x10'),_0x4c8fad,_0x3dd96b['error']['message']);return _0x3ad787(_0x3dd96b[_0x6f59('0x15')]['message']);}logger[_0x6f59('0x15')](_0x6f59('0x10'),_0x4c8fad,_0x3dd96b[_0x6f59('0x15')][_0x6f59('0x17')]);return _0x570caa(_0x3dd96b[_0x6f59('0x15')][_0x6f59('0x17')]);}else{logger[_0x6f59('0x18')]('ChatOfflineMessage,\x20%s,\x20%s',_0x4c8fad,_0x6f59('0x11'));_0x570caa(_0x3dd96b[_0x6f59('0x19')][_0x6f59('0x17')]);}})['catch'](function(_0x44e678){logger[_0x6f59('0x15')](_0x6f59('0x10'),_0x4c8fad,_0x44e678);_0x3ad787(_0x44e678);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 25a32d6..205dfb4 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 _0xc079=['../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','describe','show','post','create','put','/:id','update','destroy','exports','util','express','fs-extra'];(function(_0x13c199,_0x3caddc){var _0x266fab=function(_0x1af803){while(--_0x1af803){_0x13c199['push'](_0x13c199['shift']());}};_0x266fab(++_0x3caddc);}(_0xc079,0x12f));var _0x9c07=function(_0x582a3c,_0x2fd335){_0x582a3c=_0x582a3c-0x0;var _0x34f871=_0xc079[_0x582a3c];return _0x34f871;};'use strict';var multer=require('multer');var util=require(_0x9c07('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9c07('0x1'));var router=express['Router']();var fs_extra=require(_0x9c07('0x2'));var auth=require(_0x9c07('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9c07('0x4'));var controller=require(_0x9c07('0x5'));router[_0x9c07('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9c07('0x6')]('/describe',auth[_0x9c07('0x7')](),controller[_0x9c07('0x8')]);router[_0x9c07('0x6')]('/:id',auth[_0x9c07('0x7')](),controller[_0x9c07('0x9')]);router[_0x9c07('0xa')]('/',auth[_0x9c07('0x7')](),controller[_0x9c07('0xb')]);router[_0x9c07('0xc')](_0x9c07('0xd'),auth[_0x9c07('0x7')](),controller[_0x9c07('0xe')]);router['delete']('/:id',auth[_0x9c07('0x7')](),controller[_0x9c07('0xf')]);module[_0x9c07('0x10')]=router; \ No newline at end of file +var _0x3d71=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','describe','show','create','put','/:id','update','destroy','multer','util','connect-timeout'];(function(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0x3d71,0x19f));var _0x13d7=function(_0x885f1f,_0x48cb26){_0x885f1f=_0x885f1f-0x0;var _0x8a1177=_0x3d71[_0x885f1f];return _0x8a1177;};'use strict';var multer=require(_0x13d7('0x0'));var util=require(_0x13d7('0x1'));var path=require('path');var timeout=require(_0x13d7('0x2'));var express=require(_0x13d7('0x3'));var router=express[_0x13d7('0x4')]();var fs_extra=require(_0x13d7('0x5'));var auth=require(_0x13d7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x13d7('0x7'));var controller=require(_0x13d7('0x8'));router[_0x13d7('0x9')]('/',auth[_0x13d7('0xa')](),controller[_0x13d7('0xb')]);router[_0x13d7('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x13d7('0xc')]);router[_0x13d7('0x9')]('/:id',auth[_0x13d7('0xa')](),controller[_0x13d7('0xd')]);router['post']('/',auth[_0x13d7('0xa')](),controller[_0x13d7('0xe')]);router[_0x13d7('0xf')](_0x13d7('0x10'),auth[_0x13d7('0xa')](),controller[_0x13d7('0x11')]);router['delete'](_0x13d7('0x10'),auth[_0x13d7('0xa')](),controller[_0x13d7('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 35447b0..4c46a28 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 _0x1050=['timeout','INTEGER','sequelize','exports','STRING','mouseOver'];(function(_0xc3e938,_0x11b0bf){var _0x5360ca=function(_0xc06bf4){while(--_0xc06bf4){_0xc3e938['push'](_0xc3e938['shift']());}};_0x5360ca(++_0x11b0bf);}(_0x1050,0xc8));var _0x0105=function(_0x39049a,_0x2fa775){_0x39049a=_0x39049a-0x0;var _0x2ed061=_0x1050[_0x39049a];return _0x2ed061;};'use strict';var Sequelize=require(_0x0105('0x0'));module[_0x0105('0x1')]={'name':{'type':Sequelize[_0x0105('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0105('0x3'),_0x0105('0x4')),'defaultValue':_0x0105('0x3')},'selector':{'type':Sequelize[_0x0105('0x2')]},'timeout':{'type':Sequelize[_0x0105('0x5')]}}; \ No newline at end of file +var _0xd785=['STRING','ENUM','mouseOver','exports'];(function(_0x4dd5a4,_0x26bfb2){var _0x3334f9=function(_0x5530c4){while(--_0x5530c4){_0x4dd5a4['push'](_0x4dd5a4['shift']());}};_0x3334f9(++_0x26bfb2);}(_0xd785,0x183));var _0x5d78=function(_0x52666e,_0x5b3776){_0x52666e=_0x52666e-0x0;var _0x515330=_0xd785[_0x52666e];return _0x515330;};'use strict';var Sequelize=require('sequelize');module[_0x5d78('0x0')]={'name':{'type':Sequelize[_0x5d78('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5d78('0x2')](_0x5d78('0x3'),'timeout'),'defaultValue':_0x5d78('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index aa5b7f0..b75aa0d 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 _0xb4c7=['jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','attributes','intersection','fields','include','merge','find','create','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto'];(function(_0x563a22,_0x379dc1){var _0x5b9ae3=function(_0x4bd477){while(--_0x4bd477){_0x563a22['push'](_0x563a22['shift']());}};_0x5b9ae3(++_0x379dc1);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x1d86d3,_0x2b8e24){_0x1d86d3=_0x1d86d3-0x0;var _0x46f670=_0xb4c7[_0x1d86d3];return _0x46f670;};'use strict';var emlformat=require(_0x7b4c('0x0'));var rimraf=require(_0x7b4c('0x1'));var zipdir=require(_0x7b4c('0x2'));var jsonpatch=require(_0x7b4c('0x3'));var rp=require(_0x7b4c('0x4'));var moment=require('moment');var BPromise=require(_0x7b4c('0x5'));var Mustache=require(_0x7b4c('0x6'));var util=require(_0x7b4c('0x7'));var path=require(_0x7b4c('0x8'));var sox=require(_0x7b4c('0x9'));var csv=require('to-csv');var ejs=require(_0x7b4c('0xa'));var fs=require('fs');var fs_extra=require(_0x7b4c('0xb'));var _=require(_0x7b4c('0xc'));var squel=require('squel');var crypto=require(_0x7b4c('0xd'));var jsforce=require(_0x7b4c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7b4c('0xf'));var querystring=require(_0x7b4c('0x10'));var Papa=require(_0x7b4c('0x11'));var Redis=require(_0x7b4c('0x12'));var authService=require(_0x7b4c('0x13'));var qs=require(_0x7b4c('0x14'));var as=require(_0x7b4c('0x15'));var hardwareService=require(_0x7b4c('0x16'));var logger=require(_0x7b4c('0x17'))(_0x7b4c('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7b4c('0x19'));var db=require(_0x7b4c('0x1a'))['db'];function respondWithStatusCode(_0x38656b,_0x1722ad){_0x1722ad=_0x1722ad||0xcc;return function(_0x3e1558){if(_0x3e1558){return _0x38656b[_0x7b4c('0x1b')](_0x1722ad);}return _0x38656b[_0x7b4c('0x1c')](_0x1722ad)[_0x7b4c('0x1d')]();};}function respondWithResult(_0x25b90b,_0x387488){_0x387488=_0x387488||0xc8;return function(_0x593a19){if(_0x593a19){return _0x25b90b[_0x7b4c('0x1c')](_0x387488)[_0x7b4c('0x1e')](_0x593a19);}};}function respondWithFilteredResult(_0xdc71cd,_0x2a0e2f){return function(_0xa0a812){if(_0xa0a812){var _0x2471b3=typeof _0x2a0e2f[_0x7b4c('0x1f')]===_0x7b4c('0x20')&&typeof _0x2a0e2f['limit']===_0x7b4c('0x20');var _0xe71d88=_0xa0a812[_0x7b4c('0x21')];var _0x36c02a=_0x2471b3?0x0:_0x2a0e2f['offset'];var _0x3ce10c=_0x2471b3?_0xa0a812[_0x7b4c('0x21')]:_0x2a0e2f[_0x7b4c('0x1f')]+_0x2a0e2f[_0x7b4c('0x22')];var _0x2d4c72;if(_0x3ce10c>=_0xe71d88){_0x3ce10c=_0xe71d88;_0x2d4c72=0xc8;}else{_0x2d4c72=0xce;}_0xdc71cd[_0x7b4c('0x1c')](_0x2d4c72);return _0xdc71cd[_0x7b4c('0x23')](_0x7b4c('0x24'),_0x36c02a+'-'+_0x3ce10c+'/'+_0xe71d88)[_0x7b4c('0x1e')](_0xa0a812);}return null;};}function patchUpdates(_0x55e3df){return function(_0x1f06ec){try{jsonpatch[_0x7b4c('0x25')](_0x1f06ec,_0x55e3df,!![]);}catch(_0x11996d){return BPromise[_0x7b4c('0x26')](_0x11996d);}return _0x1f06ec[_0x7b4c('0x27')]();};}function saveUpdates(_0x168ac9,_0x176704){return function(_0x3d4826){if(_0x3d4826){return _0x3d4826[_0x7b4c('0x28')](_0x168ac9)[_0x7b4c('0x29')](function(_0x5eec1e){return _0x5eec1e;});}return null;};}function removeEntity(_0x45438c,_0x4350c9){return function(_0x276271){if(_0x276271){return _0x276271[_0x7b4c('0x2a')]()[_0x7b4c('0x29')](function(){_0x45438c[_0x7b4c('0x1c')](0xcc)[_0x7b4c('0x1d')]();});}};}function handleEntityNotFound(_0x459eb4,_0x1f311e){return function(_0x1a69db){if(!_0x1a69db){_0x459eb4[_0x7b4c('0x1b')](0x194);}return _0x1a69db;};}function handleError(_0x257da2,_0x316e5f){_0x316e5f=_0x316e5f||0x1f4;return function(_0x501f75){logger[_0x7b4c('0x2b')](_0x501f75[_0x7b4c('0x2c')]);if(_0x501f75[_0x7b4c('0x2d')]){delete _0x501f75[_0x7b4c('0x2d')];}_0x257da2[_0x7b4c('0x1c')](_0x316e5f)[_0x7b4c('0x2e')](_0x501f75);};}exports[_0x7b4c('0x2f')]=function(_0x2552f9,_0x3e4a46){var _0x9a799b={'raw':!![],'where':{'id':_0x2552f9[_0x7b4c('0x30')]['id']}},_0x3585cd={};_0x3585cd[_0x7b4c('0x31')]=_[_0x7b4c('0x32')](db[_0x7b4c('0x33')][_0x7b4c('0x34')]);_0x3585cd[_0x7b4c('0x35')]=_[_0x7b4c('0x32')](_0x2552f9[_0x7b4c('0x35')]);_0x3585cd['filters']=_['intersection'](_0x3585cd['model'],_0x3585cd[_0x7b4c('0x35')]);_0x9a799b[_0x7b4c('0x36')]=_[_0x7b4c('0x37')](_0x3585cd[_0x7b4c('0x31')],qs['fields'](_0x2552f9[_0x7b4c('0x35')][_0x7b4c('0x38')]));_0x9a799b['attributes']=_0x9a799b[_0x7b4c('0x36')]['length']?_0x9a799b[_0x7b4c('0x36')]:_0x3585cd[_0x7b4c('0x31')];if(_0x2552f9[_0x7b4c('0x35')]['includeAll']){_0x9a799b[_0x7b4c('0x39')]=[{'all':!![]}];}_0x9a799b=_[_0x7b4c('0x3a')]({},_0x9a799b,_0x2552f9['options']);return db[_0x7b4c('0x33')][_0x7b4c('0x3b')](_0x9a799b)[_0x7b4c('0x29')](handleEntityNotFound(_0x3e4a46,null))[_0x7b4c('0x29')](respondWithResult(_0x3e4a46,null))['catch'](handleError(_0x3e4a46,null));};exports['create']=function(_0x1325c1,_0x460fd4){return db['ChatProactiveAction'][_0x7b4c('0x3c')](_0x1325c1['body'],{})['then'](respondWithResult(_0x460fd4,0xc9))[_0x7b4c('0x3d')](handleError(_0x460fd4,null));};exports[_0x7b4c('0x28')]=function(_0x39d69a,_0x250901){if(_0x39d69a['body']['id']){delete _0x39d69a[_0x7b4c('0x3e')]['id'];}return db[_0x7b4c('0x33')][_0x7b4c('0x3b')]({'where':{'id':_0x39d69a[_0x7b4c('0x30')]['id']}})[_0x7b4c('0x29')](handleEntityNotFound(_0x250901,null))[_0x7b4c('0x29')](saveUpdates(_0x39d69a[_0x7b4c('0x3e')],null))['then'](respondWithResult(_0x250901,null))['catch'](handleError(_0x250901,null));};exports[_0x7b4c('0x2a')]=function(_0x37f136,_0x31ef1e){return db[_0x7b4c('0x33')][_0x7b4c('0x3b')]({'where':{'id':_0x37f136['params']['id']}})[_0x7b4c('0x29')](handleEntityNotFound(_0x31ef1e,null))[_0x7b4c('0x29')](removeEntity(_0x31ef1e,null))[_0x7b4c('0x3d')](handleError(_0x31ef1e,null));}; \ No newline at end of file +var _0x8958=['json','undefined','limit','count','offset','apply','reject','save','update','then','error','name','send','show','params','model','keys','query','filters','intersection','fields','attributes','includeAll','include','options','find','catch','create','body','ChatProactiveAction','destroy','rimraf','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x26a81b,_0x3bf1cd){var _0x39e063=function(_0x4bb23e){while(--_0x4bb23e){_0x26a81b['push'](_0x26a81b['shift']());}};_0x39e063(++_0x3bf1cd);}(_0x8958,0x93));var _0x8895=function(_0x2fc3ae,_0x42da14){_0x2fc3ae=_0x2fc3ae-0x0;var _0x26175b=_0x8958[_0x2fc3ae];return _0x26175b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8895('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8895('0x1'));var Mustache=require('mustache');var util=require(_0x8895('0x2'));var path=require(_0x8895('0x3'));var sox=require(_0x8895('0x4'));var csv=require('to-csv');var ejs=require(_0x8895('0x5'));var fs=require('fs');var fs_extra=require(_0x8895('0x6'));var _=require(_0x8895('0x7'));var squel=require(_0x8895('0x8'));var crypto=require(_0x8895('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8895('0xa'));var toCsv=require(_0x8895('0xb'));var querystring=require(_0x8895('0xc'));var Papa=require(_0x8895('0xd'));var Redis=require(_0x8895('0xe'));var authService=require(_0x8895('0xf'));var qs=require(_0x8895('0x10'));var as=require(_0x8895('0x11'));var hardwareService=require(_0x8895('0x12'));var logger=require(_0x8895('0x13'))('api');var utils=require(_0x8895('0x14'));var config=require(_0x8895('0x15'));var licenseUtil=require(_0x8895('0x16'));var db=require(_0x8895('0x17'))['db'];function respondWithStatusCode(_0x446e1a,_0xaf93bc){_0xaf93bc=_0xaf93bc||0xcc;return function(_0x5af0ef){if(_0x5af0ef){return _0x446e1a[_0x8895('0x18')](_0xaf93bc);}return _0x446e1a[_0x8895('0x19')](_0xaf93bc)[_0x8895('0x1a')]();};}function respondWithResult(_0x57d40a,_0x47b9fe){_0x47b9fe=_0x47b9fe||0xc8;return function(_0x9191b8){if(_0x9191b8){return _0x57d40a['status'](_0x47b9fe)[_0x8895('0x1b')](_0x9191b8);}};}function respondWithFilteredResult(_0x337101,_0x195789){return function(_0x3d7b59){if(_0x3d7b59){var _0x2c9d40=typeof _0x195789['offset']===_0x8895('0x1c')&&typeof _0x195789[_0x8895('0x1d')]===_0x8895('0x1c');var _0xcdd661=_0x3d7b59[_0x8895('0x1e')];var _0x1b5c82=_0x2c9d40?0x0:_0x195789[_0x8895('0x1f')];var _0x26cee0=_0x2c9d40?_0x3d7b59[_0x8895('0x1e')]:_0x195789[_0x8895('0x1f')]+_0x195789[_0x8895('0x1d')];var _0x6b8a16;if(_0x26cee0>=_0xcdd661){_0x26cee0=_0xcdd661;_0x6b8a16=0xc8;}else{_0x6b8a16=0xce;}_0x337101[_0x8895('0x19')](_0x6b8a16);return _0x337101['set']('Content-Range',_0x1b5c82+'-'+_0x26cee0+'/'+_0xcdd661)['json'](_0x3d7b59);}return null;};}function patchUpdates(_0x3daf43){return function(_0x456282){try{jsonpatch[_0x8895('0x20')](_0x456282,_0x3daf43,!![]);}catch(_0x29449a){return BPromise[_0x8895('0x21')](_0x29449a);}return _0x456282[_0x8895('0x22')]();};}function saveUpdates(_0x461346,_0xc1ce17){return function(_0x5219ca){if(_0x5219ca){return _0x5219ca[_0x8895('0x23')](_0x461346)[_0x8895('0x24')](function(_0x2a403){return _0x2a403;});}return null;};}function removeEntity(_0x1f71f3,_0x29223d){return function(_0x4d092d){if(_0x4d092d){return _0x4d092d['destroy']()[_0x8895('0x24')](function(){_0x1f71f3[_0x8895('0x19')](0xcc)[_0x8895('0x1a')]();});}};}function handleEntityNotFound(_0x24a376,_0x4fc150){return function(_0x25da11){if(!_0x25da11){_0x24a376[_0x8895('0x18')](0x194);}return _0x25da11;};}function handleError(_0x187a15,_0x5486a6){_0x5486a6=_0x5486a6||0x1f4;return function(_0x4aee03){logger[_0x8895('0x25')](_0x4aee03['stack']);if(_0x4aee03[_0x8895('0x26')]){delete _0x4aee03[_0x8895('0x26')];}_0x187a15[_0x8895('0x19')](_0x5486a6)[_0x8895('0x27')](_0x4aee03);};}exports[_0x8895('0x28')]=function(_0x5c03ea,_0x4d567a){var _0x6e449d={'raw':!![],'where':{'id':_0x5c03ea[_0x8895('0x29')]['id']}},_0x37ac3a={};_0x37ac3a[_0x8895('0x2a')]=_[_0x8895('0x2b')](db['ChatProactiveAction']['rawAttributes']);_0x37ac3a[_0x8895('0x2c')]=_[_0x8895('0x2b')](_0x5c03ea[_0x8895('0x2c')]);_0x37ac3a[_0x8895('0x2d')]=_[_0x8895('0x2e')](_0x37ac3a['model'],_0x37ac3a[_0x8895('0x2c')]);_0x6e449d['attributes']=_[_0x8895('0x2e')](_0x37ac3a['model'],qs[_0x8895('0x2f')](_0x5c03ea[_0x8895('0x2c')][_0x8895('0x2f')]));_0x6e449d[_0x8895('0x30')]=_0x6e449d[_0x8895('0x30')]['length']?_0x6e449d[_0x8895('0x30')]:_0x37ac3a[_0x8895('0x2a')];if(_0x5c03ea[_0x8895('0x2c')][_0x8895('0x31')]){_0x6e449d[_0x8895('0x32')]=[{'all':!![]}];}_0x6e449d=_['merge']({},_0x6e449d,_0x5c03ea[_0x8895('0x33')]);return db['ChatProactiveAction'][_0x8895('0x34')](_0x6e449d)['then'](handleEntityNotFound(_0x4d567a,null))[_0x8895('0x24')](respondWithResult(_0x4d567a,null))[_0x8895('0x35')](handleError(_0x4d567a,null));};exports[_0x8895('0x36')]=function(_0x418e53,_0xd08bf3){return db['ChatProactiveAction'][_0x8895('0x36')](_0x418e53['body'],{})[_0x8895('0x24')](respondWithResult(_0xd08bf3,0xc9))[_0x8895('0x35')](handleError(_0xd08bf3,null));};exports[_0x8895('0x23')]=function(_0x9297ea,_0x25fa39){if(_0x9297ea[_0x8895('0x37')]['id']){delete _0x9297ea['body']['id'];}return db[_0x8895('0x38')][_0x8895('0x34')]({'where':{'id':_0x9297ea['params']['id']}})[_0x8895('0x24')](handleEntityNotFound(_0x25fa39,null))['then'](saveUpdates(_0x9297ea[_0x8895('0x37')],null))[_0x8895('0x24')](respondWithResult(_0x25fa39,null))['catch'](handleError(_0x25fa39,null));};exports[_0x8895('0x39')]=function(_0x418250,_0x5b7204){return db['ChatProactiveAction'][_0x8895('0x34')]({'where':{'id':_0x418250[_0x8895('0x29')]['id']}})[_0x8895('0x24')](handleEntityNotFound(_0x5b7204,null))[_0x8895('0x24')](removeEntity(_0x5b7204,null))[_0x8895('0x35')](handleError(_0x5b7204,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index db13c72..85f4924 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 _0x28b7=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','lodash','util','../../config/logger','api'];(function(_0x3f6dc8,_0x54dea6){var _0x1c5c16=function(_0x3b8d9f){while(--_0x3b8d9f){_0x3f6dc8['push'](_0x3f6dc8['shift']());}};_0x1c5c16(++_0x54dea6);}(_0x28b7,0x11a));var _0x728b=function(_0x182aa3,_0x55cb6c){_0x182aa3=_0x182aa3-0x0;var _0x4bd366=_0x28b7[_0x182aa3];return _0x4bd366;};'use strict';var _=require(_0x728b('0x0'));var util=require(_0x728b('0x1'));var logger=require(_0x728b('0x2'))(_0x728b('0x3'));var moment=require(_0x728b('0x4'));var BPromise=require(_0x728b('0x5'));var rp=require(_0x728b('0x6'));var fs=require('fs');var path=require(_0x728b('0x7'));var rimraf=require(_0x728b('0x8'));var config=require(_0x728b('0x9'));var attributes=require('./chatProactiveAction.attributes');module[_0x728b('0xa')]=function(_0x134544,_0x479ee2){return _0x134544['define']('ChatProactiveAction',attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b99=['exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0xde86e5,_0xf929ae){var _0x1256bc=function(_0x33ca6f){while(--_0x33ca6f){_0xde86e5['push'](_0xde86e5['shift']());}};_0x1256bc(++_0xf929ae);}(_0x3b99,0x1e4));var _0x93b9=function(_0x298039,_0x4ad061){_0x298039=_0x298039-0x0;var _0x19c4a0=_0x3b99[_0x298039];return _0x19c4a0;};'use strict';var _=require(_0x93b9('0x0'));var util=require(_0x93b9('0x1'));var logger=require(_0x93b9('0x2'))(_0x93b9('0x3'));var moment=require(_0x93b9('0x4'));var BPromise=require(_0x93b9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x93b9('0x6'));var rimraf=require('rimraf');var config=require(_0x93b9('0x7'));var attributes=require('./chatProactiveAction.attributes');module[_0x93b9('0x8')]=function(_0x1272cc,_0x2a7b1a){return _0x1272cc[_0x93b9('0x9')](_0x93b9('0xa'),attributes,{'tableName':_0x93b9('0xb'),'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 0beb78f..c3175bf 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 _0x36bd=['request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x438537,_0x4adce6){var _0x2a55d0=function(_0x26e3ad){while(--_0x26e3ad){_0x438537['push'](_0x438537['shift']());}};_0x2a55d0(++_0x4adce6);}(_0x36bd,0x179));var _0xd36b=function(_0x4b24d1,_0x3726b6){_0x4b24d1=_0x4b24d1-0x0;var _0x3221d0=_0x36bd[_0x4b24d1];return _0x3221d0;};'use strict';var _=require(_0xd36b('0x0'));var util=require(_0xd36b('0x1'));var moment=require('moment');var BPromise=require(_0xd36b('0x2'));var rs=require(_0xd36b('0x3'));var fs=require('fs');var Redis=require(_0xd36b('0x4'));var db=require(_0xd36b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd36b('0x6'))('rpc');var config=require(_0xd36b('0x7'));var jayson=require(_0xd36b('0x8'));var client=jayson[_0xd36b('0x9')][_0xd36b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18113e,_0x501b6e,_0x4069fe){return new BPromise(function(_0x26a0d5,_0x5c224f){return client[_0xd36b('0xb')](_0x18113e,_0x4069fe)['then'](function(_0x50ab15){logger[_0xd36b('0xc')](_0xd36b('0xd'),_0x501b6e,_0xd36b('0xe'));logger[_0xd36b('0xf')](_0xd36b('0x10'),_0x501b6e,_0xd36b('0xe'),JSON[_0xd36b('0x11')](_0x50ab15));if(_0x50ab15['error']){if(_0x50ab15[_0xd36b('0x12')][_0xd36b('0x13')]===0x1f4){logger[_0xd36b('0x12')](_0xd36b('0xd'),_0x501b6e,_0x50ab15['error'][_0xd36b('0x14')]);return _0x5c224f(_0x50ab15[_0xd36b('0x12')][_0xd36b('0x14')]);}logger[_0xd36b('0x12')](_0xd36b('0xd'),_0x501b6e,_0x50ab15[_0xd36b('0x12')][_0xd36b('0x14')]);return _0x26a0d5(_0x50ab15[_0xd36b('0x12')][_0xd36b('0x14')]);}else{logger[_0xd36b('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x501b6e,_0xd36b('0xe'));_0x26a0d5(_0x50ab15[_0xd36b('0x15')][_0xd36b('0x14')]);}})[_0xd36b('0x16')](function(_0x3c9f88){logger[_0xd36b('0x12')](_0xd36b('0xd'),_0x501b6e,_0x3c9f88);_0x5c224f(_0x3c9f88);});});} \ No newline at end of file +var _0xc322=['result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','jayson/promise','http','request','info','ChatProactiveAction,\x20%s,\x20%s','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x577a70,_0x124cd0){var _0x35e80a=function(_0xcfe67d){while(--_0xcfe67d){_0x577a70['push'](_0x577a70['shift']());}};_0x35e80a(++_0x124cd0);}(_0xc322,0x145));var _0x2c32=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xc322[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x2c32('0x0'));var util=require(_0x2c32('0x1'));var moment=require(_0x2c32('0x2'));var BPromise=require('bluebird');var rs=require(_0x2c32('0x3'));var fs=require('fs');var Redis=require(_0x2c32('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2c32('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2c32('0x6'));var client=jayson['client'][_0x2c32('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3cf7e8,_0x56e127,_0x36dab2){return new BPromise(function(_0x3a3680,_0x3317f8){return client[_0x2c32('0x8')](_0x3cf7e8,_0x36dab2)['then'](function(_0xfd614f){logger[_0x2c32('0x9')](_0x2c32('0xa'),_0x56e127,'request\x20sent');logger['debug'](_0x2c32('0xb'),_0x56e127,_0x2c32('0xc'),JSON[_0x2c32('0xd')](_0xfd614f));if(_0xfd614f[_0x2c32('0xe')]){if(_0xfd614f[_0x2c32('0xe')][_0x2c32('0xf')]===0x1f4){logger[_0x2c32('0xe')](_0x2c32('0xa'),_0x56e127,_0xfd614f['error'][_0x2c32('0x10')]);return _0x3317f8(_0xfd614f[_0x2c32('0xe')][_0x2c32('0x10')]);}logger[_0x2c32('0xe')](_0x2c32('0xa'),_0x56e127,_0xfd614f['error'][_0x2c32('0x10')]);return _0x3a3680(_0xfd614f['error'][_0x2c32('0x10')]);}else{logger[_0x2c32('0x9')](_0x2c32('0xa'),_0x56e127,_0x2c32('0xc'));_0x3a3680(_0xfd614f[_0x2c32('0x11')][_0x2c32('0x10')]);}})[_0x2c32('0x12')](function(_0x546e39){logger['error'](_0x2c32('0xa'),_0x56e127,_0x546e39);_0x3317f8(_0x546e39);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index a30fc48..09502f0 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 _0x5fc3=['create','put','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatProactiveAction.controller','get','show','isAuthenticated'];(function(_0x2157b5,_0x1c39c8){var _0x217a78=function(_0x479b60){while(--_0x479b60){_0x2157b5['push'](_0x2157b5['shift']());}};_0x217a78(++_0x1c39c8);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2c3a88,_0x48637e){_0x2c3a88=_0x2c3a88-0x0;var _0x4a7925=_0x5fc3[_0x2c3a88];return _0x4a7925;};'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')]('/:id',auth['isAuthenticated'](),controller[_0x35fc('0xa')]);router['post']('/',auth[_0x35fc('0xb')](),controller[_0x35fc('0xc')]);router[_0x35fc('0xd')](_0x35fc('0xe'),auth[_0x35fc('0xb')](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xb')](),controller[_0x35fc('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5d17=['create','put','/:id','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','isAuthenticated','show','post'];(function(_0x80571,_0x458b76){var _0x4ffad4=function(_0x27dd14){while(--_0x27dd14){_0x80571['push'](_0x80571['shift']());}};_0x4ffad4(++_0x458b76);}(_0x5d17,0x114));var _0x75d1=function(_0x60df74,_0x458e29){_0x60df74=_0x60df74-0x0;var _0x5ee872=_0x5d17[_0x60df74];return _0x5ee872;};'use strict';var multer=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x75d1('0x2'));var router=express[_0x75d1('0x3')]();var fs_extra=require(_0x75d1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x75d1('0x5'));var config=require(_0x75d1('0x6'));var controller=require(_0x75d1('0x7'));router[_0x75d1('0x8')]('/:id',auth[_0x75d1('0x9')](),controller[_0x75d1('0xa')]);router[_0x75d1('0xb')]('/',auth[_0x75d1('0x9')](),controller[_0x75d1('0xc')]);router[_0x75d1('0xd')](_0x75d1('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x75d1('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x75d1('0x10')]);module[_0x75d1('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 a1be28a..415b705 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 _0xff7e=['name','INTEGER','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x5e8821,_0x5a623e){var _0x440c43=function(_0x5cd302){while(--_0x5cd302){_0x5e8821['push'](_0x5e8821['shift']());}};_0x440c43(++_0x5a623e);}(_0xff7e,0xdd));var _0xeff7=function(_0x287902,_0x37fd61){_0x287902=_0x287902-0x0;var _0x500e0a=_0xff7e[_0x287902];return _0x500e0a;};'use strict';var Sequelize=require(_0xeff7('0x0'));module[_0xeff7('0x1')]={'name':{'type':Sequelize[_0xeff7('0x2')],'unique':_0xeff7('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xeff7('0x2')]},'timeout':{'type':Sequelize[_0xeff7('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xeff7('0x5'),_0xeff7('0x6'),_0xeff7('0x7'))}}; \ No newline at end of file +var _0x2e1e=['STRING','name','INTEGER','roundrobin','sequelize','exports'];(function(_0x5ca349,_0x1abb0f){var _0xf8ee4a=function(_0x272eb2){while(--_0x272eb2){_0x5ca349['push'](_0x5ca349['shift']());}};_0xf8ee4a(++_0x1abb0f);}(_0x2e1e,0xd6));var _0xe2e1=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0x2e1e[_0x3e6d5d];return _0x238923;};'use strict';var Sequelize=require(_0xe2e1('0x0'));module[_0xe2e1('0x1')]={'name':{'type':Sequelize[_0xe2e1('0x2')],'unique':_0xe2e1('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe2e1('0x2')]},'timeout':{'type':Sequelize[_0xe2e1('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall',_0xe2e1('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 2c84ff0..63a5f60 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 _0x4011=['%s/%s','SIP','updatedAt','getTeams','Team','addTeams','ids','interface','flatMap','Agents','sequelize','transaction','each','forEach','emit','userChatQueue:save','select','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','value','userChatQueue:remove','addAgents','spread','removeAgents','getAgents','findOne','nolimit','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./chatQueue.socket','register','jayson/promise','client','request','then','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','get','UserProfileResource','name','index','map','ChatQueue','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','filters','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','UserChatQueue','hasOwnProperty','pick','User','UserId','chatPause','createdAt','format'];(function(_0x1441a3,_0x2cf7e9){var _0x192769=function(_0x2560f2){while(--_0x2560f2){_0x1441a3['push'](_0x1441a3['shift']());}};_0x192769(++_0x2cf7e9);}(_0x4011,0x1d2));var _0x1401=function(_0x4ebf3a,_0x26377e){_0x4ebf3a=_0x4ebf3a-0x0;var _0x3811d9=_0x4011[_0x4ebf3a];return _0x3811d9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1401('0x0'));var jsonpatch=require(_0x1401('0x1'));var rp=require(_0x1401('0x2'));var moment=require(_0x1401('0x3'));var BPromise=require(_0x1401('0x4'));var Mustache=require(_0x1401('0x5'));var util=require('util');var path=require(_0x1401('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1401('0x7'));var _=require(_0x1401('0x8'));var squel=require('squel');var crypto=require(_0x1401('0x9'));var jsforce=require(_0x1401('0xa'));var deskjs=require(_0x1401('0xb'));var toCsv=require(_0x1401('0xc'));var querystring=require(_0x1401('0xd'));var Papa=require(_0x1401('0xe'));var Redis=require('ioredis');var authService=require(_0x1401('0xf'));var qs=require(_0x1401('0x10'));var as=require(_0x1401('0x11'));var hardwareService=require(_0x1401('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x1401('0x13'));var config=require(_0x1401('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x1401('0x15'))['db'];config[_0x1401('0x16')]=_['defaults'](config[_0x1401('0x16')],{'host':_0x1401('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1401('0x16')]));require(_0x1401('0x18'))[_0x1401('0x19')](socket);var jayson=require(_0x1401('0x1a'));var client=jayson[_0x1401('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x699fb,_0x39229e,_0x502710,_0x231a94){return new BPromise(function(_0x9fda03,_0x58829d){var _0x525999=_0x231a94||client;return _0x525999[_0x1401('0x1c')](_0x699fb,_0x502710)[_0x1401('0x1d')](function(_0x238a6a){logger[_0x1401('0x1e')](_0x1401('0x1f'),_0x39229e,'request\x20sent');logger['debug'](_0x1401('0x20'),_0x39229e,'request\x20sent',JSON[_0x1401('0x21')](_0x238a6a));if(_0x238a6a[_0x1401('0x22')]){if(_0x238a6a[_0x1401('0x22')][_0x1401('0x23')]===0x1f4){logger[_0x1401('0x22')]('ChatQueue,\x20%s,\x20%s',_0x39229e,_0x238a6a[_0x1401('0x22')]['message']);return _0x58829d(_0x238a6a[_0x1401('0x22')][_0x1401('0x24')]);}logger[_0x1401('0x22')](_0x1401('0x1f'),_0x39229e,_0x238a6a[_0x1401('0x22')][_0x1401('0x24')]);return _0x9fda03(_0x238a6a[_0x1401('0x22')][_0x1401('0x24')]);}else{logger[_0x1401('0x1e')](_0x1401('0x1f'),_0x39229e,'request\x20sent');_0x9fda03(_0x238a6a[_0x1401('0x25')]['message']);}})[_0x1401('0x26')](function(_0x153fb1){logger[_0x1401('0x22')]('ChatQueue,\x20%s,\x20%s',_0x39229e,_0x153fb1);_0x58829d(_0x153fb1);});});}function respondWithStatusCode(_0x150d5d,_0x29aff2){_0x29aff2=_0x29aff2||0xcc;return function(_0x4ea5cb){if(_0x4ea5cb){return _0x150d5d[_0x1401('0x27')](_0x29aff2);}return _0x150d5d['status'](_0x29aff2)[_0x1401('0x28')]();};}function respondWithResult(_0x40dce9,_0x365366){_0x365366=_0x365366||0xc8;return function(_0x30c433){if(_0x30c433){return _0x40dce9[_0x1401('0x29')](_0x365366)['json'](_0x30c433);}};}function respondWithFilteredResult(_0x544f56,_0x3e27a8){return function(_0x2f3214){if(_0x2f3214){var _0x2f0a71=typeof _0x3e27a8[_0x1401('0x2a')]===_0x1401('0x2b')&&typeof _0x3e27a8[_0x1401('0x2c')]==='undefined';var _0x2bbff2=_0x2f3214[_0x1401('0x2d')];var _0x12ea3f=_0x2f0a71?0x0:_0x3e27a8[_0x1401('0x2a')];var _0x56c486=_0x2f0a71?_0x2f3214[_0x1401('0x2d')]:_0x3e27a8[_0x1401('0x2a')]+_0x3e27a8['limit'];var _0x5304ac;if(_0x56c486>=_0x2bbff2){_0x56c486=_0x2bbff2;_0x5304ac=0xc8;}else{_0x5304ac=0xce;}_0x544f56[_0x1401('0x29')](_0x5304ac);return _0x544f56['set'](_0x1401('0x2e'),_0x12ea3f+'-'+_0x56c486+'/'+_0x2bbff2)['json'](_0x2f3214);}return null;};}function patchUpdates(_0x24d848){return function(_0x57649c){try{jsonpatch[_0x1401('0x2f')](_0x57649c,_0x24d848,!![]);}catch(_0x725ca4){return BPromise['reject'](_0x725ca4);}return _0x57649c[_0x1401('0x30')]();};}function saveUpdates(_0x29e860,_0x33522c){return function(_0x3c6857){if(_0x3c6857){return _0x3c6857[_0x1401('0x31')](_0x29e860)['then'](function(_0x51040f){return _0x51040f;});}return null;};}function removeEntity(_0xd15f8b,_0x3848a6){return function(_0x541de8){if(_0x541de8){return _0x541de8[_0x1401('0x32')]()[_0x1401('0x1d')](function(){var _0x46e170=_0x541de8[_0x1401('0x33')]({'plain':!![]});var _0x53372d='ChatQueues';return db[_0x1401('0x34')][_0x1401('0x32')]({'where':{'type':_0x53372d,'resourceId':_0x46e170['id']}})[_0x1401('0x1d')](function(){return _0x541de8;});})['then'](function(){_0xd15f8b[_0x1401('0x29')](0xcc)[_0x1401('0x28')]();});}};}function handleEntityNotFound(_0x5ef8d5,_0x4b8c18){return function(_0xcb1da6){if(!_0xcb1da6){_0x5ef8d5[_0x1401('0x27')](0x194);}return _0xcb1da6;};}function handleError(_0x3108d8,_0x26dffc){_0x26dffc=_0x26dffc||0x1f4;return function(_0x4dc043){logger[_0x1401('0x22')](_0x4dc043['stack']);if(_0x4dc043['name']){delete _0x4dc043[_0x1401('0x35')];}_0x3108d8[_0x1401('0x29')](_0x26dffc)['send'](_0x4dc043);};}exports[_0x1401('0x36')]=function(_0x36f982,_0x29c1eb){var _0x1a89ac={},_0xac5cc1={},_0x23d272={'count':0x0,'rows':[]};var _0x35755d=_[_0x1401('0x37')](db[_0x1401('0x38')][_0x1401('0x39')],function(_0x121d15){return{'name':_0x121d15['fieldName'],'type':_0x121d15[_0x1401('0x3a')][_0x1401('0x3b')]};});_0xac5cc1[_0x1401('0x3c')]=_[_0x1401('0x37')](_0x35755d,_0x1401('0x35'));_0xac5cc1[_0x1401('0x3d')]=_[_0x1401('0x3e')](_0x36f982['query']);_0xac5cc1['filters']=_[_0x1401('0x3f')](_0xac5cc1[_0x1401('0x3c')],_0xac5cc1['query']);_0x1a89ac[_0x1401('0x40')]=_[_0x1401('0x3f')](_0xac5cc1['model'],qs[_0x1401('0x41')](_0x36f982[_0x1401('0x3d')][_0x1401('0x41')]));_0x1a89ac['attributes']=_0x1a89ac[_0x1401('0x40')][_0x1401('0x42')]?_0x1a89ac[_0x1401('0x40')]:_0xac5cc1[_0x1401('0x3c')];if(!_0x36f982[_0x1401('0x3d')]['hasOwnProperty']('nolimit')){_0x1a89ac[_0x1401('0x2c')]=qs[_0x1401('0x2c')](_0x36f982['query'][_0x1401('0x2c')]);_0x1a89ac[_0x1401('0x2a')]=qs[_0x1401('0x2a')](_0x36f982[_0x1401('0x3d')]['offset']);}_0x1a89ac[_0x1401('0x43')]=qs[_0x1401('0x44')](_0x36f982[_0x1401('0x3d')][_0x1401('0x44')]);_0x1a89ac['where']=qs[_0x1401('0x45')](_['pick'](_0x36f982['query'],_0xac5cc1[_0x1401('0x45')]),_0x35755d);if(_0x36f982['query']['filter']){_0x1a89ac[_0x1401('0x46')]=_[_0x1401('0x47')](_0x1a89ac['where'],{'$or':_[_0x1401('0x37')](_0x35755d,function(_0x2ace59){if(_0x2ace59[_0x1401('0x3a')]!==_0x1401('0x48')){var _0x497506={};_0x497506[_0x2ace59['name']]={'$like':'%'+_0x36f982[_0x1401('0x3d')][_0x1401('0x49')]+'%'};return _0x497506;}})});}_0x1a89ac=_[_0x1401('0x47')]({},_0x1a89ac,_0x36f982[_0x1401('0x4a')]);var _0x368bf3={'where':_0x1a89ac[_0x1401('0x46')]};return db[_0x1401('0x38')][_0x1401('0x2d')](_0x368bf3)[_0x1401('0x1d')](function(_0x2819c5){_0x23d272[_0x1401('0x2d')]=_0x2819c5;if(_0x36f982[_0x1401('0x3d')][_0x1401('0x4b')]){_0x1a89ac[_0x1401('0x4c')]=[{'all':!![]}];}return db[_0x1401('0x38')][_0x1401('0x4d')](_0x1a89ac);})[_0x1401('0x1d')](function(_0x16b43c){_0x23d272[_0x1401('0x4e')]=_0x16b43c;return _0x23d272;})[_0x1401('0x1d')](respondWithFilteredResult(_0x29c1eb,_0x1a89ac))[_0x1401('0x26')](handleError(_0x29c1eb,null));};exports[_0x1401('0x4f')]=function(_0x2e5591,_0x313802){var _0x1a4cea={'raw':!![],'where':{'id':_0x2e5591['params']['id']}},_0x53423c={};_0x53423c[_0x1401('0x3c')]=_[_0x1401('0x3e')](db[_0x1401('0x38')][_0x1401('0x39')]);_0x53423c[_0x1401('0x3d')]=_[_0x1401('0x3e')](_0x2e5591['query']);_0x53423c[_0x1401('0x45')]=_[_0x1401('0x3f')](_0x53423c[_0x1401('0x3c')],_0x53423c[_0x1401('0x3d')]);_0x1a4cea[_0x1401('0x40')]=_[_0x1401('0x3f')](_0x53423c['model'],qs[_0x1401('0x41')](_0x2e5591[_0x1401('0x3d')][_0x1401('0x41')]));_0x1a4cea['attributes']=_0x1a4cea['attributes'][_0x1401('0x42')]?_0x1a4cea[_0x1401('0x40')]:_0x53423c[_0x1401('0x3c')];if(_0x2e5591[_0x1401('0x3d')][_0x1401('0x4b')]){_0x1a4cea[_0x1401('0x4c')]=[{'all':!![]}];}_0x1a4cea=_[_0x1401('0x47')]({},_0x1a4cea,_0x2e5591[_0x1401('0x4a')]);return db[_0x1401('0x38')][_0x1401('0x50')](_0x1a4cea)[_0x1401('0x1d')](handleEntityNotFound(_0x313802,null))[_0x1401('0x1d')](respondWithResult(_0x313802,null))['catch'](handleError(_0x313802,null));};exports['create']=function(_0x238a43,_0x24717c){return db[_0x1401('0x38')]['create'](_0x238a43[_0x1401('0x51')],{})['then'](function(_0xdfaf9b){var _0x2a4066=_0x238a43[_0x1401('0x52')][_0x1401('0x33')]({'plain':!![]});if(!_0x2a4066)throw new Error(_0x1401('0x53'));if(_0x2a4066[_0x1401('0x54')]===_0x1401('0x52')){var _0x2c16d0=_0xdfaf9b[_0x1401('0x33')]({'plain':!![]});var _0x3e6cdc=_0x1401('0x55');return db[_0x1401('0x56')][_0x1401('0x50')]({'where':{'name':_0x3e6cdc,'userProfileId':_0x2a4066[_0x1401('0x57')]},'raw':!![]})['then'](function(_0x20743e){if(_0x20743e&&_0x20743e[_0x1401('0x58')]===0x0){return db[_0x1401('0x34')][_0x1401('0x59')]({'name':_0x2c16d0['name'],'resourceId':_0x2c16d0['id'],'type':_0x20743e[_0x1401('0x35')],'sectionId':_0x20743e['id']},{})[_0x1401('0x1d')](function(){return _0xdfaf9b;});}else{return _0xdfaf9b;}})[_0x1401('0x26')](function(_0x787604){logger['error'](_0x1401('0x5a'),_0x787604);throw _0x787604;});}return _0xdfaf9b;})[_0x1401('0x1d')](respondWithResult(_0x24717c,0xc9))[_0x1401('0x26')](handleError(_0x24717c,null));};exports[_0x1401('0x31')]=function(_0x360a4e,_0x4d9874){if(_0x360a4e['body']['id']){delete _0x360a4e['body']['id'];}return db[_0x1401('0x38')][_0x1401('0x50')]({'where':{'id':_0x360a4e['params']['id']}})['then'](handleEntityNotFound(_0x4d9874,null))[_0x1401('0x1d')](saveUpdates(_0x360a4e[_0x1401('0x51')],null))[_0x1401('0x1d')](respondWithResult(_0x4d9874,null))[_0x1401('0x26')](handleError(_0x4d9874,null));};exports['destroy']=function(_0x7f5095,_0x6c9d6c){return db['ChatQueue'][_0x1401('0x50')]({'where':{'id':_0x7f5095[_0x1401('0x5b')]['id']}})[_0x1401('0x1d')](handleEntityNotFound(_0x6c9d6c,null))[_0x1401('0x1d')](removeEntity(_0x6c9d6c,null))[_0x1401('0x26')](handleError(_0x6c9d6c,null));};exports[_0x1401('0x5c')]=function(_0x10e994,_0x2780af){return db['ChatQueue']['describe']()[_0x1401('0x1d')](respondWithResult(_0x2780af,null))[_0x1401('0x26')](handleError(_0x2780af,null));};exports[_0x1401('0x5d')]=function(_0x2ffa58,_0x5a6baf,_0x576b3a){var _0x435efc={'raw':!![],'where':{}},_0x257b8={},_0x3d6a1e;return db[_0x1401('0x38')]['findOne']({'where':{'id':_0x2ffa58[_0x1401('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5a6baf,null))[_0x1401('0x1d')](function(_0x4ad019){if(_0x4ad019){_0x3d6a1e=_0x4ad019[_0x1401('0x33')]({'plain':!![]});_0x257b8[_0x1401('0x3c')]=_[_0x1401('0x3e')](db[_0x1401('0x5e')][_0x1401('0x39')]);_0x257b8[_0x1401('0x3d')]=_['keys'](_0x2ffa58['query']);_0x257b8['filters']=_[_0x1401('0x3f')](_0x257b8[_0x1401('0x3c')],_0x257b8['query']);_0x435efc['attributes']=_[_0x1401('0x3f')](_0x257b8[_0x1401('0x3c')],qs[_0x1401('0x41')](_0x2ffa58['query'][_0x1401('0x41')]));_0x435efc[_0x1401('0x40')]=_0x435efc[_0x1401('0x40')][_0x1401('0x42')]?_0x435efc[_0x1401('0x40')]:_0x257b8[_0x1401('0x3c')];if(!_0x2ffa58[_0x1401('0x3d')][_0x1401('0x5f')]('nolimit')){_0x435efc[_0x1401('0x2c')]=qs[_0x1401('0x2c')](_0x2ffa58[_0x1401('0x3d')][_0x1401('0x2c')]);_0x435efc['offset']=qs[_0x1401('0x2a')](_0x2ffa58[_0x1401('0x3d')][_0x1401('0x2a')]);}_0x435efc['order']=qs[_0x1401('0x44')](_0x2ffa58['query']['sort']);_0x435efc[_0x1401('0x46')]=qs[_0x1401('0x45')](_[_0x1401('0x60')](_0x2ffa58[_0x1401('0x3d')],_0x257b8[_0x1401('0x45')]));_0x435efc[_0x1401('0x46')]['ChatQueueId']=_0x4ad019['id'];if(_0x2ffa58[_0x1401('0x3d')]['filter']){_0x435efc[_0x1401('0x46')]=_[_0x1401('0x47')](_0x435efc[_0x1401('0x46')],{'$or':_[_0x1401('0x37')](_0x435efc[_0x1401('0x40')],function(_0x2d2f78){var _0x530844={};_0x530844[_0x2d2f78]={'$like':'%'+_0x2ffa58[_0x1401('0x3d')][_0x1401('0x49')]+'%'};return _0x530844;})});}_0x435efc=_['merge']({},_0x435efc,_0x2ffa58[_0x1401('0x4a')]);return db[_0x1401('0x5e')][_0x1401('0x4d')](_0x435efc);}})['then'](function(_0x232831){if(_0x232831){return db[_0x1401('0x61')]['findAndCountAll']({'where':{'id':_[_0x1401('0x37')](_0x232831,_0x1401('0x62')),'role':'agent'},'attributes':['id','name',_0x1401('0x63'),'updatedAt',_0x1401('0x64')]});}})[_0x1401('0x1d')](function(_0x3ddb18){if(_0x3ddb18){return{'count':_0x3ddb18[_0x1401('0x2d')],'rows':_[_0x1401('0x37')](_0x3ddb18['rows'],function(_0x34c8c6){return{'membername':_0x34c8c6[_0x1401('0x35')],'UserId':_0x34c8c6['id'],'queue_name':_0x3d6a1e[_0x1401('0x35')],'ChatQueueId':_0x3d6a1e['id'],'interface':util[_0x1401('0x65')](_0x1401('0x66'),_0x1401('0x67'),_0x34c8c6[_0x1401('0x35')]),'penalty':0x0,'paused':_0x34c8c6[_0x1401('0x63')],'createdAt':_0x34c8c6[_0x1401('0x64')],'updatedAt':_0x34c8c6[_0x1401('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1401('0x1d')](respondWithFilteredResult(_0x5a6baf,_0x435efc))[_0x1401('0x26')](handleError(_0x5a6baf,null));};exports[_0x1401('0x69')]=function(_0x3fb95e,_0x5aedb2,_0x5ab5a5){var _0x232494={};var _0x59a952={};var _0x22c27c;var _0x58657d;return db[_0x1401('0x38')]['findOne']({'where':{'id':_0x3fb95e[_0x1401('0x5b')]['id']}})[_0x1401('0x1d')](handleEntityNotFound(_0x5aedb2,null))[_0x1401('0x1d')](function(_0x1a7697){if(_0x1a7697){_0x22c27c=_0x1a7697;_0x59a952['model']=_[_0x1401('0x3e')](db[_0x1401('0x6a')][_0x1401('0x39')]);_0x59a952[_0x1401('0x3d')]=_['keys'](_0x3fb95e[_0x1401('0x3d')]);_0x59a952['filters']=_['intersection'](_0x59a952[_0x1401('0x3c')],_0x59a952[_0x1401('0x3d')]);_0x232494[_0x1401('0x40')]=_[_0x1401('0x3f')](_0x59a952[_0x1401('0x3c')],qs['fields'](_0x3fb95e[_0x1401('0x3d')]['fields']));_0x232494[_0x1401('0x40')]=_0x232494[_0x1401('0x40')]['length']?_0x232494[_0x1401('0x40')]:_0x59a952[_0x1401('0x3c')];_0x232494[_0x1401('0x43')]=qs['sort'](_0x3fb95e['query'][_0x1401('0x44')]);_0x232494[_0x1401('0x46')]=qs[_0x1401('0x45')](_[_0x1401('0x60')](_0x3fb95e[_0x1401('0x3d')],_0x59a952['filters']));if(_0x3fb95e['query'][_0x1401('0x49')]){_0x232494[_0x1401('0x46')]=_['merge'](_0x232494[_0x1401('0x46')],{'$or':_['map'](_0x232494[_0x1401('0x40')],function(_0x45c951){var _0x1e96ce={};_0x1e96ce[_0x45c951]={'$like':'%'+_0x3fb95e[_0x1401('0x3d')][_0x1401('0x49')]+'%'};return _0x1e96ce;})});}_0x232494=_[_0x1401('0x47')]({},_0x232494,_0x3fb95e[_0x1401('0x4a')]);return _0x22c27c['getTeams'](_0x232494);}})[_0x1401('0x1d')](function(_0xa7d0eb){if(_0xa7d0eb){_0x58657d=_0xa7d0eb['length'];if(!_0x3fb95e[_0x1401('0x3d')][_0x1401('0x5f')]('nolimit')){_0x232494[_0x1401('0x2c')]=qs['limit'](_0x3fb95e[_0x1401('0x3d')][_0x1401('0x2c')]);_0x232494[_0x1401('0x2a')]=qs[_0x1401('0x2a')](_0x3fb95e[_0x1401('0x3d')][_0x1401('0x2a')]);}return _0x22c27c[_0x1401('0x69')](_0x232494);}})['then'](function(_0x5a69cc){if(_0x5a69cc){return _0x5a69cc?{'count':_0x58657d,'rows':_0x5a69cc}:null;}})[_0x1401('0x1d')](respondWithResult(_0x5aedb2,null))[_0x1401('0x26')](handleError(_0x5aedb2,null));};exports[_0x1401('0x6b')]=function(_0x3c534a,_0x227c60,_0x5da838){var _0x36b6c0=_0x3c534a[_0x1401('0x51')][_0x1401('0x6c')];return db[_0x1401('0x6a')][_0x1401('0x4d')]({'where':{'id':_0x36b6c0},'attributes':['id'],'include':[{'model':db[_0x1401('0x61')],'as':'Agents','attributes':['id',_0x1401('0x35'),'online','voicePause',_0x1401('0x6d')],'raw':!![]}]})['then'](function(_0x11838c){if(_0x11838c){var _0x44c87c=_[_0x1401('0x6e')](_0x11838c,function(_0x38a610){var _0x16ab4a=_0x38a610[_0x1401('0x33')]({'plain':!![]});return _0x16ab4a[_0x1401('0x6f')];});return db[_0x1401('0x38')]['find']({'where':{'id':_0x3c534a[_0x1401('0x5b')]['id']}})[_0x1401('0x1d')](function(_0x28303b){return db[_0x1401('0x70')][_0x1401('0x71')](function(_0x417271){return _0x28303b[_0x1401('0x6b')](_0x36b6c0,{'transaction':_0x417271})['then'](function(){return BPromise[_0x1401('0x72')](_0x44c87c,function(_0xfaff86){return db['UserChatQueue']['findOrCreate']({'where':{'UserId':_0xfaff86['id'],'ChatQueueId':_0x3c534a[_0x1401('0x5b')]['id']},'transaction':_0x417271});});})['then'](function(){_0x44c87c[_0x1401('0x73')](function(_0x229e0a){socket[_0x1401('0x74')](_0x1401('0x75'),{'UserId':_0x229e0a['id'],'ChatQueueId':_0x28303b['id']});});});});});}})[_0x1401('0x1d')](respondWithStatusCode(_0x227c60,null))[_0x1401('0x26')](handleError(_0x227c60,null));};exports['removeTeams']=function(_0x4ca257,_0x3fb259,_0x4c89a1){return db['Team'][_0x1401('0x4d')]({'where':{'id':_0x4ca257[_0x1401('0x3d')][_0x1401('0x6c')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x1401('0x1d')](handleEntityNotFound(_0x3fb259,null))[_0x1401('0x1d')](function(_0x31f152){var _0x1a2837=_[_0x1401('0x37')](_0x31f152,'id');var _0x1d4040=[];var _0xa162c=[];var _0x23e73f=squel[_0x1401('0x76')]();_0x23e73f[_0x1401('0x77')]('tq.TeamId')[_0x1401('0x78')]('team_has_chat_queues','tq')['join'](_0x1401('0x79'),'ut',_0x1401('0x7a'))[_0x1401('0x46')](_0x1401('0x7b'),_0x4ca257[_0x1401('0x5b')]['id']);for(var _0x423dfb=0x0;_0x423dfb<_0x31f152[_0x1401('0x42')];_0x423dfb+=0x1){let _0x1cc1d9=_0x31f152[_0x423dfb];for(var _0x555815=0x0;_0x555815<_0x1cc1d9[_0x1401('0x6f')]['length'];_0x555815+=0x1){let _0x2fe89b=_0x1cc1d9[_0x1401('0x6f')][_0x555815];var _0x27ca82=_0x23e73f[_0x1401('0x7c')]();_0x27ca82[_0x1401('0x46')](_0x1401('0x7d'),_0x2fe89b['id']);_0xa162c[_0x1401('0x7e')](db[_0x1401('0x70')][_0x1401('0x3d')](_0x27ca82[_0x1401('0x7f')](),{'type':db[_0x1401('0x70')][_0x1401('0x80')][_0x1401('0x81')]})[_0x1401('0x1d')](function(_0x582ba2){if(_0x582ba2[_0x1401('0x42')]===0x1){return _0x2fe89b['id'];}else{var _0x884dd4=_['every'](_['map'](_0x582ba2,_0x1401('0x82')),function(_0x1a3182){return _[_0x1401('0x83')](_0x1a2837,_0x1a3182);});if(_0x884dd4){return _0x2fe89b['id'];}}}));}}return BPromise[_0x1401('0x84')](_0xa162c)[_0x1401('0x1d')](function(_0x3d6642){_0x1d4040=_(_0x1d4040)[_0x1401('0x85')](_0x3d6642)['compact']()[_0x1401('0x86')]();return db[_0x1401('0x38')][_0x1401('0x50')]({'where':{'id':_0x4ca257[_0x1401('0x5b')]['id']}})[_0x1401('0x1d')](function(_0x5f305a){return db[_0x1401('0x70')][_0x1401('0x71')](function(_0x19da0a){return _0x5f305a['removeTeams'](_0x4ca257[_0x1401('0x3d')]['ids'],{'transaction':_0x19da0a})[_0x1401('0x1d')](function(){if(!_['isEmpty'](_0x1d4040)){return _0x5f305a['removeAgents'](_0x1d4040,{'transaction':_0x19da0a});}})[_0x1401('0x1d')](function(){_0x1d4040[_0x1401('0x73')](function(_0x56a6d2){socket[_0x1401('0x74')](_0x1401('0x87'),{'UserId':_0x56a6d2,'ChatQueueId':_0x5f305a['id']});});});});});});})[_0x1401('0x1d')](respondWithStatusCode(_0x3fb259,null))[_0x1401('0x26')](handleError(_0x3fb259,null));};exports['addAgents']=function(_0x21a83d,_0xcd1545,_0x4f6413){return db['ChatQueue']['find']({'where':{'id':_0x21a83d['params']['id']}})[_0x1401('0x1d')](handleEntityNotFound(_0xcd1545,null))[_0x1401('0x1d')](function(_0xa6d842){if(_0xa6d842){return _0xa6d842[_0x1401('0x88')](_0x21a83d[_0x1401('0x51')][_0x1401('0x6c')],_['omit'](_0x21a83d[_0x1401('0x51')],['ids','id'])||{})[_0x1401('0x89')](function(_0x5ecd8d){for(var _0x23eca8=0x0;_0x23eca8<_0x21a83d['body'][_0x1401('0x6c')][_0x1401('0x42')];_0x23eca8+=0x1){socket[_0x1401('0x74')](_0x1401('0x75'),{'UserId':Number(_0x21a83d[_0x1401('0x51')]['ids'][_0x23eca8]),'ChatQueueId':Number(_0x21a83d[_0x1401('0x5b')]['id'])});}return _0x5ecd8d;});}})['then'](respondWithResult(_0xcd1545,null))[_0x1401('0x26')](handleError(_0xcd1545,null));};exports[_0x1401('0x8a')]=function(_0x4d349f,_0x492857,_0x1e9cd7){return db[_0x1401('0x38')][_0x1401('0x50')]({'where':{'id':_0x4d349f[_0x1401('0x5b')]['id']}})[_0x1401('0x1d')](handleEntityNotFound(_0x492857,null))['then'](function(_0x4a8968){if(_0x4a8968){return _0x4a8968[_0x1401('0x8a')](_0x4d349f['query'][_0x1401('0x6c')])[_0x1401('0x1d')](function(){if(_['isArray'](_0x4d349f[_0x1401('0x3d')][_0x1401('0x6c')])){for(var _0xb157b0=0x0;_0xb157b0<_0x4d349f['query'][_0x1401('0x6c')][_0x1401('0x42')];_0xb157b0+=0x1){socket[_0x1401('0x74')](_0x1401('0x87'),{'UserId':Number(_0x4d349f['query']['ids'][_0xb157b0]),'ChatQueueId':Number(_0x4d349f[_0x1401('0x5b')]['id'])});}}else{socket['emit'](_0x1401('0x87'),{'UserId':Number(_0x4d349f[_0x1401('0x3d')][_0x1401('0x6c')]),'ChatQueueId':Number(_0x4d349f[_0x1401('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x492857,null))[_0x1401('0x26')](handleError(_0x492857,null));};exports[_0x1401('0x8b')]=function(_0x399e22,_0x317d30,_0x58bd99){var _0x200118={};var _0x5d22c5={};var _0x2d77e8;var _0x4de82a;return db[_0x1401('0x38')][_0x1401('0x8c')]({'where':{'id':_0x399e22['params']['id']}})[_0x1401('0x1d')](handleEntityNotFound(_0x317d30,null))[_0x1401('0x1d')](function(_0x17ca6e){if(_0x17ca6e){_0x2d77e8=_0x17ca6e;_0x5d22c5[_0x1401('0x3c')]=_[_0x1401('0x3e')](db[_0x1401('0x61')][_0x1401('0x39')]);_0x5d22c5['query']=_['keys'](_0x399e22['query']);_0x5d22c5['filters']=_[_0x1401('0x3f')](_0x5d22c5['model'],_0x5d22c5[_0x1401('0x3d')]);_0x200118[_0x1401('0x40')]=_[_0x1401('0x3f')](_0x5d22c5[_0x1401('0x3c')],qs['fields'](_0x399e22[_0x1401('0x3d')][_0x1401('0x41')]));_0x200118[_0x1401('0x40')]=_0x200118[_0x1401('0x40')][_0x1401('0x42')]?_0x200118[_0x1401('0x40')]:_0x5d22c5[_0x1401('0x3c')];_0x200118['order']=qs['sort'](_0x399e22[_0x1401('0x3d')][_0x1401('0x44')]);_0x200118[_0x1401('0x46')]=qs[_0x1401('0x45')](_['pick'](_0x399e22[_0x1401('0x3d')],_0x5d22c5['filters']));if(_0x399e22['query'][_0x1401('0x49')]){_0x200118[_0x1401('0x46')]=_['merge'](_0x200118['where'],{'$or':_[_0x1401('0x37')](_0x200118['attributes'],function(_0x50ee40){var _0x33db6b={};_0x33db6b[_0x50ee40]={'$like':'%'+_0x399e22[_0x1401('0x3d')][_0x1401('0x49')]+'%'};return _0x33db6b;})});}_0x200118=_[_0x1401('0x47')]({},_0x200118,_0x399e22[_0x1401('0x4a')]);return _0x2d77e8[_0x1401('0x8b')](_0x200118);}})[_0x1401('0x1d')](function(_0x14747f){if(_0x14747f){_0x4de82a=_0x14747f[_0x1401('0x42')];if(!_0x399e22[_0x1401('0x3d')]['hasOwnProperty'](_0x1401('0x8d'))){_0x200118[_0x1401('0x2c')]=qs[_0x1401('0x2c')](_0x399e22[_0x1401('0x3d')][_0x1401('0x2c')]);_0x200118[_0x1401('0x2a')]=qs[_0x1401('0x2a')](_0x399e22[_0x1401('0x3d')][_0x1401('0x2a')]);}return _0x2d77e8[_0x1401('0x8b')](_0x200118);}})[_0x1401('0x1d')](function(_0x470579){if(_0x470579){return _0x470579?{'count':_0x4de82a,'rows':_0x470579}:null;}})['then'](respondWithResult(_0x317d30,null))[_0x1401('0x26')](handleError(_0x317d30,null));}; \ No newline at end of file +var _0x8511=['SIP','getTeams','findOne','Team','addTeams','ids','flatMap','Agents','sequelize','transaction','each','findOrCreate','userChatQueue:save','removeTeams','findAll','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','all','union','compact','isEmpty','removeAgents','forEach','emit','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','pick','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','client','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','get','ChatQueues','UserProfileResource','destroy','sendStatus','stack','name','send','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','rows','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserChatQueue','ChatQueueId','User','chatPause','updatedAt','format','%s/%s'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x8511,0x1ea));var _0x1851=function(_0x4ac014,_0x2186a4){_0x4ac014=_0x4ac014-0x0;var _0x565410=_0x8511[_0x4ac014];return _0x565410;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1851('0x0'));var zipdir=require(_0x1851('0x1'));var jsonpatch=require(_0x1851('0x2'));var rp=require(_0x1851('0x3'));var moment=require(_0x1851('0x4'));var BPromise=require(_0x1851('0x5'));var Mustache=require(_0x1851('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1851('0x7'));var ejs=require(_0x1851('0x8'));var fs=require('fs');var fs_extra=require(_0x1851('0x9'));var _=require(_0x1851('0xa'));var squel=require(_0x1851('0xb'));var crypto=require('crypto');var jsforce=require(_0x1851('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1851('0x7'));var querystring=require(_0x1851('0xd'));var Papa=require(_0x1851('0xe'));var Redis=require(_0x1851('0xf'));var authService=require(_0x1851('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1851('0x11'));var logger=require('../../config/logger')(_0x1851('0x12'));var utils=require(_0x1851('0x13'));var config=require(_0x1851('0x14'));var licenseUtil=require(_0x1851('0x15'));var db=require(_0x1851('0x16'))['db'];config[_0x1851('0x17')]=_[_0x1851('0x18')](config[_0x1851('0x17')],{'host':_0x1851('0x19'),'port':0x18eb});var socket=require(_0x1851('0x1a'))(new Redis(config[_0x1851('0x17')]));require(_0x1851('0x1b'))[_0x1851('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1851('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e1703,_0x359b7b,_0x14aad4,_0x4ad49f){return new BPromise(function(_0x5a839d,_0x41cb9d){var _0xead50a=_0x4ad49f||client;return _0xead50a[_0x1851('0x1e')](_0x5e1703,_0x14aad4)['then'](function(_0x24196a){logger[_0x1851('0x1f')](_0x1851('0x20'),_0x359b7b,_0x1851('0x21'));logger['debug'](_0x1851('0x22'),_0x359b7b,_0x1851('0x21'),JSON[_0x1851('0x23')](_0x24196a));if(_0x24196a[_0x1851('0x24')]){if(_0x24196a[_0x1851('0x24')][_0x1851('0x25')]===0x1f4){logger[_0x1851('0x24')](_0x1851('0x20'),_0x359b7b,_0x24196a[_0x1851('0x24')][_0x1851('0x26')]);return _0x41cb9d(_0x24196a[_0x1851('0x24')][_0x1851('0x26')]);}logger[_0x1851('0x24')](_0x1851('0x20'),_0x359b7b,_0x24196a[_0x1851('0x24')]['message']);return _0x5a839d(_0x24196a[_0x1851('0x24')][_0x1851('0x26')]);}else{logger[_0x1851('0x1f')](_0x1851('0x20'),_0x359b7b,_0x1851('0x21'));_0x5a839d(_0x24196a['result'][_0x1851('0x26')]);}})[_0x1851('0x27')](function(_0xcc7a08){logger['error']('ChatQueue,\x20%s,\x20%s',_0x359b7b,_0xcc7a08);_0x41cb9d(_0xcc7a08);});});}function respondWithStatusCode(_0x5265af,_0x50b4d7){_0x50b4d7=_0x50b4d7||0xcc;return function(_0x17749d){if(_0x17749d){return _0x5265af['sendStatus'](_0x50b4d7);}return _0x5265af['status'](_0x50b4d7)[_0x1851('0x28')]();};}function respondWithResult(_0x3b20df,_0x54dccf){_0x54dccf=_0x54dccf||0xc8;return function(_0x5f151d){if(_0x5f151d){return _0x3b20df[_0x1851('0x29')](_0x54dccf)[_0x1851('0x2a')](_0x5f151d);}};}function respondWithFilteredResult(_0xa97f8d,_0xc4a3f9){return function(_0x560da8){if(_0x560da8){var _0x23965d=typeof _0xc4a3f9[_0x1851('0x2b')]==='undefined'&&typeof _0xc4a3f9[_0x1851('0x2c')]===_0x1851('0x2d');var _0x268200=_0x560da8[_0x1851('0x2e')];var _0x2e8aa5=_0x23965d?0x0:_0xc4a3f9['offset'];var _0x44d6ea=_0x23965d?_0x560da8[_0x1851('0x2e')]:_0xc4a3f9[_0x1851('0x2b')]+_0xc4a3f9['limit'];var _0x2f6adb;if(_0x44d6ea>=_0x268200){_0x44d6ea=_0x268200;_0x2f6adb=0xc8;}else{_0x2f6adb=0xce;}_0xa97f8d[_0x1851('0x29')](_0x2f6adb);return _0xa97f8d[_0x1851('0x2f')](_0x1851('0x30'),_0x2e8aa5+'-'+_0x44d6ea+'/'+_0x268200)[_0x1851('0x2a')](_0x560da8);}return null;};}function patchUpdates(_0x58883c){return function(_0x6511f2){try{jsonpatch['apply'](_0x6511f2,_0x58883c,!![]);}catch(_0x2cc283){return BPromise[_0x1851('0x31')](_0x2cc283);}return _0x6511f2[_0x1851('0x32')]();};}function saveUpdates(_0x3fe36e,_0x5547ad){return function(_0x1a6413){if(_0x1a6413){return _0x1a6413[_0x1851('0x33')](_0x3fe36e)[_0x1851('0x34')](function(_0x1be494){return _0x1be494;});}return null;};}function removeEntity(_0x20782d,_0x5a7b10){return function(_0xd784a1){if(_0xd784a1){return _0xd784a1['destroy']()[_0x1851('0x34')](function(){var _0x795ac1=_0xd784a1[_0x1851('0x35')]({'plain':!![]});var _0x1713ec=_0x1851('0x36');return db[_0x1851('0x37')][_0x1851('0x38')]({'where':{'type':_0x1713ec,'resourceId':_0x795ac1['id']}})[_0x1851('0x34')](function(){return _0xd784a1;});})[_0x1851('0x34')](function(){_0x20782d[_0x1851('0x29')](0xcc)[_0x1851('0x28')]();});}};}function handleEntityNotFound(_0x3e8c5b,_0xa06a8a){return function(_0x50c4d0){if(!_0x50c4d0){_0x3e8c5b[_0x1851('0x39')](0x194);}return _0x50c4d0;};}function handleError(_0x1bd5ee,_0x52a0df){_0x52a0df=_0x52a0df||0x1f4;return function(_0x44b5a4){logger[_0x1851('0x24')](_0x44b5a4[_0x1851('0x3a')]);if(_0x44b5a4[_0x1851('0x3b')]){delete _0x44b5a4['name'];}_0x1bd5ee[_0x1851('0x29')](_0x52a0df)[_0x1851('0x3c')](_0x44b5a4);};}exports['index']=function(_0x2121a9,_0x58faa0){var _0x3544a8={},_0x12995e={},_0x364fab={'count':0x0,'rows':[]};var _0x3fec2c=_[_0x1851('0x3d')](db[_0x1851('0x3e')][_0x1851('0x3f')],function(_0x160fd6){return{'name':_0x160fd6[_0x1851('0x40')],'type':_0x160fd6[_0x1851('0x41')][_0x1851('0x42')]};});_0x12995e[_0x1851('0x43')]=_[_0x1851('0x3d')](_0x3fec2c,_0x1851('0x3b'));_0x12995e[_0x1851('0x44')]=_[_0x1851('0x45')](_0x2121a9[_0x1851('0x44')]);_0x12995e['filters']=_['intersection'](_0x12995e[_0x1851('0x43')],_0x12995e['query']);_0x3544a8[_0x1851('0x46')]=_[_0x1851('0x47')](_0x12995e['model'],qs['fields'](_0x2121a9['query'][_0x1851('0x48')]));_0x3544a8['attributes']=_0x3544a8['attributes'][_0x1851('0x49')]?_0x3544a8[_0x1851('0x46')]:_0x12995e[_0x1851('0x43')];if(!_0x2121a9[_0x1851('0x44')][_0x1851('0x4a')](_0x1851('0x4b'))){_0x3544a8[_0x1851('0x2c')]=qs[_0x1851('0x2c')](_0x2121a9[_0x1851('0x44')][_0x1851('0x2c')]);_0x3544a8[_0x1851('0x2b')]=qs[_0x1851('0x2b')](_0x2121a9['query']['offset']);}_0x3544a8[_0x1851('0x4c')]=qs[_0x1851('0x4d')](_0x2121a9[_0x1851('0x44')][_0x1851('0x4d')]);_0x3544a8['where']=qs[_0x1851('0x4e')](_['pick'](_0x2121a9[_0x1851('0x44')],_0x12995e['filters']),_0x3fec2c);if(_0x2121a9['query'][_0x1851('0x4f')]){_0x3544a8[_0x1851('0x50')]=_[_0x1851('0x51')](_0x3544a8['where'],{'$or':_[_0x1851('0x3d')](_0x3fec2c,function(_0x3f329a){if(_0x3f329a[_0x1851('0x41')]!==_0x1851('0x52')){var _0x20a043={};_0x20a043[_0x3f329a[_0x1851('0x3b')]]={'$like':'%'+_0x2121a9[_0x1851('0x44')]['filter']+'%'};return _0x20a043;}})});}_0x3544a8=_['merge']({},_0x3544a8,_0x2121a9[_0x1851('0x53')]);var _0x345826={'where':_0x3544a8[_0x1851('0x50')]};return db[_0x1851('0x3e')][_0x1851('0x2e')](_0x345826)['then'](function(_0x4e2b5f){_0x364fab[_0x1851('0x2e')]=_0x4e2b5f;if(_0x2121a9[_0x1851('0x44')][_0x1851('0x54')]){_0x3544a8[_0x1851('0x55')]=[{'all':!![]}];}return db[_0x1851('0x3e')]['findAll'](_0x3544a8);})[_0x1851('0x34')](function(_0x55244c){_0x364fab[_0x1851('0x56')]=_0x55244c;return _0x364fab;})['then'](respondWithFilteredResult(_0x58faa0,_0x3544a8))[_0x1851('0x27')](handleError(_0x58faa0,null));};exports['show']=function(_0x318473,_0x594f9c){var _0xce103a={'raw':!![],'where':{'id':_0x318473[_0x1851('0x57')]['id']}},_0x1ba6cf={};_0x1ba6cf[_0x1851('0x43')]=_[_0x1851('0x45')](db[_0x1851('0x3e')][_0x1851('0x3f')]);_0x1ba6cf['query']=_[_0x1851('0x45')](_0x318473['query']);_0x1ba6cf[_0x1851('0x4e')]=_[_0x1851('0x47')](_0x1ba6cf[_0x1851('0x43')],_0x1ba6cf[_0x1851('0x44')]);_0xce103a['attributes']=_[_0x1851('0x47')](_0x1ba6cf[_0x1851('0x43')],qs[_0x1851('0x48')](_0x318473[_0x1851('0x44')][_0x1851('0x48')]));_0xce103a['attributes']=_0xce103a[_0x1851('0x46')][_0x1851('0x49')]?_0xce103a[_0x1851('0x46')]:_0x1ba6cf[_0x1851('0x43')];if(_0x318473[_0x1851('0x44')]['includeAll']){_0xce103a[_0x1851('0x55')]=[{'all':!![]}];}_0xce103a=_[_0x1851('0x51')]({},_0xce103a,_0x318473['options']);return db[_0x1851('0x3e')][_0x1851('0x58')](_0xce103a)[_0x1851('0x34')](handleEntityNotFound(_0x594f9c,null))[_0x1851('0x34')](respondWithResult(_0x594f9c,null))[_0x1851('0x27')](handleError(_0x594f9c,null));};exports[_0x1851('0x59')]=function(_0xd17e61,_0x11a898){return db[_0x1851('0x3e')]['create'](_0xd17e61[_0x1851('0x5a')],{})[_0x1851('0x34')](function(_0x49190b){var _0x174a13=_0xd17e61[_0x1851('0x5b')][_0x1851('0x35')]({'plain':!![]});if(!_0x174a13)throw new Error(_0x1851('0x5c'));if(_0x174a13[_0x1851('0x5d')]===_0x1851('0x5b')){var _0x174fa6=_0x49190b['get']({'plain':!![]});var _0x50bd91=_0x1851('0x36');return db[_0x1851('0x5e')]['find']({'where':{'name':_0x50bd91,'userProfileId':_0x174a13['userProfileId']},'raw':!![]})[_0x1851('0x34')](function(_0x1bbdd3){if(_0x1bbdd3&&_0x1bbdd3[_0x1851('0x5f')]===0x0){return db['UserProfileResource'][_0x1851('0x59')]({'name':_0x174fa6['name'],'resourceId':_0x174fa6['id'],'type':_0x1bbdd3[_0x1851('0x3b')],'sectionId':_0x1bbdd3['id']},{})[_0x1851('0x34')](function(){return _0x49190b;});}else{return _0x49190b;}})[_0x1851('0x27')](function(_0x4afe0f){logger[_0x1851('0x24')](_0x1851('0x60'),_0x4afe0f);throw _0x4afe0f;});}return _0x49190b;})[_0x1851('0x34')](respondWithResult(_0x11a898,0xc9))[_0x1851('0x27')](handleError(_0x11a898,null));};exports[_0x1851('0x33')]=function(_0x11f07f,_0x1f8e0a){if(_0x11f07f['body']['id']){delete _0x11f07f[_0x1851('0x5a')]['id'];}return db[_0x1851('0x3e')]['find']({'where':{'id':_0x11f07f[_0x1851('0x57')]['id']}})['then'](handleEntityNotFound(_0x1f8e0a,null))[_0x1851('0x34')](saveUpdates(_0x11f07f['body'],null))[_0x1851('0x34')](respondWithResult(_0x1f8e0a,null))[_0x1851('0x27')](handleError(_0x1f8e0a,null));};exports[_0x1851('0x38')]=function(_0x495f17,_0x209cc1){return db[_0x1851('0x3e')][_0x1851('0x58')]({'where':{'id':_0x495f17['params']['id']}})['then'](handleEntityNotFound(_0x209cc1,null))[_0x1851('0x34')](removeEntity(_0x209cc1,null))[_0x1851('0x27')](handleError(_0x209cc1,null));};exports[_0x1851('0x61')]=function(_0x51d3ef,_0x8c8dc6){return db['ChatQueue'][_0x1851('0x61')]()['then'](respondWithResult(_0x8c8dc6,null))['catch'](handleError(_0x8c8dc6,null));};exports[_0x1851('0x62')]=function(_0xd8c22d,_0x1ee04e,_0x28193d){var _0x5ba315={'raw':!![],'where':{}},_0x455762={},_0x2d32f6;return db[_0x1851('0x3e')]['findOne']({'where':{'id':_0xd8c22d['params']['id']}})['then'](handleEntityNotFound(_0x1ee04e,null))[_0x1851('0x34')](function(_0x27a3a0){if(_0x27a3a0){_0x2d32f6=_0x27a3a0[_0x1851('0x35')]({'plain':!![]});_0x455762['model']=_[_0x1851('0x45')](db[_0x1851('0x63')]['rawAttributes']);_0x455762['query']=_[_0x1851('0x45')](_0xd8c22d[_0x1851('0x44')]);_0x455762[_0x1851('0x4e')]=_[_0x1851('0x47')](_0x455762[_0x1851('0x43')],_0x455762['query']);_0x5ba315[_0x1851('0x46')]=_[_0x1851('0x47')](_0x455762['model'],qs['fields'](_0xd8c22d[_0x1851('0x44')][_0x1851('0x48')]));_0x5ba315[_0x1851('0x46')]=_0x5ba315[_0x1851('0x46')]['length']?_0x5ba315[_0x1851('0x46')]:_0x455762[_0x1851('0x43')];if(!_0xd8c22d[_0x1851('0x44')][_0x1851('0x4a')](_0x1851('0x4b'))){_0x5ba315[_0x1851('0x2c')]=qs[_0x1851('0x2c')](_0xd8c22d[_0x1851('0x44')]['limit']);_0x5ba315[_0x1851('0x2b')]=qs[_0x1851('0x2b')](_0xd8c22d[_0x1851('0x44')][_0x1851('0x2b')]);}_0x5ba315['order']=qs['sort'](_0xd8c22d[_0x1851('0x44')]['sort']);_0x5ba315[_0x1851('0x50')]=qs[_0x1851('0x4e')](_['pick'](_0xd8c22d[_0x1851('0x44')],_0x455762[_0x1851('0x4e')]));_0x5ba315[_0x1851('0x50')][_0x1851('0x64')]=_0x27a3a0['id'];if(_0xd8c22d[_0x1851('0x44')][_0x1851('0x4f')]){_0x5ba315[_0x1851('0x50')]=_[_0x1851('0x51')](_0x5ba315[_0x1851('0x50')],{'$or':_['map'](_0x5ba315[_0x1851('0x46')],function(_0x5a0b36){var _0x225f0a={};_0x225f0a[_0x5a0b36]={'$like':'%'+_0xd8c22d['query'][_0x1851('0x4f')]+'%'};return _0x225f0a;})});}_0x5ba315=_[_0x1851('0x51')]({},_0x5ba315,_0xd8c22d[_0x1851('0x53')]);return db[_0x1851('0x63')]['findAll'](_0x5ba315);}})[_0x1851('0x34')](function(_0x33cb2d){if(_0x33cb2d){return db[_0x1851('0x65')]['findAndCountAll']({'where':{'id':_[_0x1851('0x3d')](_0x33cb2d,'UserId'),'role':'agent'},'attributes':['id',_0x1851('0x3b'),_0x1851('0x66'),_0x1851('0x67'),'createdAt']});}})[_0x1851('0x34')](function(_0x2860d3){if(_0x2860d3){return{'count':_0x2860d3['count'],'rows':_[_0x1851('0x3d')](_0x2860d3[_0x1851('0x56')],function(_0x5000cc){return{'membername':_0x5000cc[_0x1851('0x3b')],'UserId':_0x5000cc['id'],'queue_name':_0x2d32f6[_0x1851('0x3b')],'ChatQueueId':_0x2d32f6['id'],'interface':util[_0x1851('0x68')](_0x1851('0x69'),_0x1851('0x6a'),_0x5000cc[_0x1851('0x3b')]),'penalty':0x0,'paused':_0x5000cc['chatPause'],'createdAt':_0x5000cc['createdAt'],'updatedAt':_0x5000cc[_0x1851('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1851('0x34')](respondWithFilteredResult(_0x1ee04e,_0x5ba315))['catch'](handleError(_0x1ee04e,null));};exports[_0x1851('0x6b')]=function(_0x34f552,_0x2dfe74,_0x57d6be){var _0x37c68d={};var _0x50f680={};var _0x478d9e;var _0x5836c3;return db[_0x1851('0x3e')][_0x1851('0x6c')]({'where':{'id':_0x34f552[_0x1851('0x57')]['id']}})[_0x1851('0x34')](handleEntityNotFound(_0x2dfe74,null))[_0x1851('0x34')](function(_0x3bf540){if(_0x3bf540){_0x478d9e=_0x3bf540;_0x50f680[_0x1851('0x43')]=_['keys'](db[_0x1851('0x6d')][_0x1851('0x3f')]);_0x50f680[_0x1851('0x44')]=_[_0x1851('0x45')](_0x34f552[_0x1851('0x44')]);_0x50f680[_0x1851('0x4e')]=_[_0x1851('0x47')](_0x50f680[_0x1851('0x43')],_0x50f680['query']);_0x37c68d[_0x1851('0x46')]=_[_0x1851('0x47')](_0x50f680[_0x1851('0x43')],qs[_0x1851('0x48')](_0x34f552[_0x1851('0x44')][_0x1851('0x48')]));_0x37c68d[_0x1851('0x46')]=_0x37c68d[_0x1851('0x46')][_0x1851('0x49')]?_0x37c68d[_0x1851('0x46')]:_0x50f680['model'];_0x37c68d['order']=qs[_0x1851('0x4d')](_0x34f552[_0x1851('0x44')]['sort']);_0x37c68d[_0x1851('0x50')]=qs[_0x1851('0x4e')](_['pick'](_0x34f552[_0x1851('0x44')],_0x50f680[_0x1851('0x4e')]));if(_0x34f552['query'][_0x1851('0x4f')]){_0x37c68d[_0x1851('0x50')]=_[_0x1851('0x51')](_0x37c68d[_0x1851('0x50')],{'$or':_[_0x1851('0x3d')](_0x37c68d[_0x1851('0x46')],function(_0x5008d1){var _0x5b2780={};_0x5b2780[_0x5008d1]={'$like':'%'+_0x34f552['query']['filter']+'%'};return _0x5b2780;})});}_0x37c68d=_[_0x1851('0x51')]({},_0x37c68d,_0x34f552[_0x1851('0x53')]);return _0x478d9e[_0x1851('0x6b')](_0x37c68d);}})['then'](function(_0x38a32e){if(_0x38a32e){_0x5836c3=_0x38a32e['length'];if(!_0x34f552[_0x1851('0x44')]['hasOwnProperty'](_0x1851('0x4b'))){_0x37c68d[_0x1851('0x2c')]=qs['limit'](_0x34f552[_0x1851('0x44')]['limit']);_0x37c68d[_0x1851('0x2b')]=qs[_0x1851('0x2b')](_0x34f552[_0x1851('0x44')][_0x1851('0x2b')]);}return _0x478d9e[_0x1851('0x6b')](_0x37c68d);}})[_0x1851('0x34')](function(_0x4acbb3){if(_0x4acbb3){return _0x4acbb3?{'count':_0x5836c3,'rows':_0x4acbb3}:null;}})[_0x1851('0x34')](respondWithResult(_0x2dfe74,null))[_0x1851('0x27')](handleError(_0x2dfe74,null));};exports[_0x1851('0x6e')]=function(_0x451732,_0x2a9c27,_0x32a500){var _0x1c5018=_0x451732[_0x1851('0x5a')][_0x1851('0x6f')];return db['Team']['findAll']({'where':{'id':_0x1c5018},'attributes':['id'],'include':[{'model':db[_0x1851('0x65')],'as':'Agents','attributes':['id',_0x1851('0x3b'),'online','voicePause','interface'],'raw':!![]}]})[_0x1851('0x34')](function(_0x732d70){if(_0x732d70){var _0x1d1eec=_[_0x1851('0x70')](_0x732d70,function(_0x35aba3){var _0x3d4aa1=_0x35aba3[_0x1851('0x35')]({'plain':!![]});return _0x3d4aa1[_0x1851('0x71')];});return db[_0x1851('0x3e')][_0x1851('0x58')]({'where':{'id':_0x451732[_0x1851('0x57')]['id']}})[_0x1851('0x34')](function(_0x45f34e){return db[_0x1851('0x72')][_0x1851('0x73')](function(_0x438d70){return _0x45f34e[_0x1851('0x6e')](_0x1c5018,{'transaction':_0x438d70})[_0x1851('0x34')](function(){return BPromise[_0x1851('0x74')](_0x1d1eec,function(_0x35968b){return db[_0x1851('0x63')][_0x1851('0x75')]({'where':{'UserId':_0x35968b['id'],'ChatQueueId':_0x451732[_0x1851('0x57')]['id']},'transaction':_0x438d70});});})[_0x1851('0x34')](function(){_0x1d1eec['forEach'](function(_0x5533c9){socket['emit'](_0x1851('0x76'),{'UserId':_0x5533c9['id'],'ChatQueueId':_0x45f34e['id']});});});});});}})['then'](respondWithStatusCode(_0x2a9c27,null))[_0x1851('0x27')](handleError(_0x2a9c27,null));};exports[_0x1851('0x77')]=function(_0x481f9e,_0x11f679,_0x371b08){return db['Team'][_0x1851('0x78')]({'where':{'id':_0x481f9e[_0x1851('0x44')][_0x1851('0x6f')]},'attributes':['id'],'include':[{'model':db[_0x1851('0x65')],'as':_0x1851('0x71'),'attributes':['id'],'raw':!![]}]})[_0x1851('0x34')](handleEntityNotFound(_0x11f679,null))[_0x1851('0x34')](function(_0x1d245b){var _0x1fafcc=_[_0x1851('0x3d')](_0x1d245b,'id');var _0x4cb0ec=[];var _0x4f2f94=[];var _0x22143b=squel[_0x1851('0x79')]();_0x22143b[_0x1851('0x7a')](_0x1851('0x7b'))[_0x1851('0x7c')](_0x1851('0x7d'),'tq')[_0x1851('0x7e')](_0x1851('0x7f'),'ut',_0x1851('0x80'))[_0x1851('0x50')](_0x1851('0x81'),_0x481f9e[_0x1851('0x57')]['id']);for(var _0x541488=0x0;_0x541488<_0x1d245b[_0x1851('0x49')];_0x541488+=0x1){let _0x32f2b6=_0x1d245b[_0x541488];for(var _0x183331=0x0;_0x183331<_0x32f2b6[_0x1851('0x71')][_0x1851('0x49')];_0x183331+=0x1){let _0xca7091=_0x32f2b6[_0x1851('0x71')][_0x183331];var _0x490750=_0x22143b['clone']();_0x490750[_0x1851('0x50')](_0x1851('0x82'),_0xca7091['id']);_0x4f2f94['push'](db['sequelize'][_0x1851('0x44')](_0x490750[_0x1851('0x83')](),{'type':db['sequelize'][_0x1851('0x84')][_0x1851('0x85')]})[_0x1851('0x34')](function(_0x109244){if(_0x109244[_0x1851('0x49')]===0x1){return _0xca7091['id'];}else{var _0x32a199=_[_0x1851('0x86')](_['map'](_0x109244,'TeamId'),function(_0x501324){return _['includes'](_0x1fafcc,_0x501324);});if(_0x32a199){return _0xca7091['id'];}}}));}}return BPromise[_0x1851('0x87')](_0x4f2f94)[_0x1851('0x34')](function(_0x52c520){_0x4cb0ec=_(_0x4cb0ec)[_0x1851('0x88')](_0x52c520)[_0x1851('0x89')]()['value']();return db[_0x1851('0x3e')][_0x1851('0x58')]({'where':{'id':_0x481f9e[_0x1851('0x57')]['id']}})[_0x1851('0x34')](function(_0x339abd){return db[_0x1851('0x72')][_0x1851('0x73')](function(_0x23425d){return _0x339abd[_0x1851('0x77')](_0x481f9e[_0x1851('0x44')]['ids'],{'transaction':_0x23425d})[_0x1851('0x34')](function(){if(!_[_0x1851('0x8a')](_0x4cb0ec)){return _0x339abd[_0x1851('0x8b')](_0x4cb0ec,{'transaction':_0x23425d});}})['then'](function(){_0x4cb0ec[_0x1851('0x8c')](function(_0x4e7109){socket[_0x1851('0x8d')](_0x1851('0x8e'),{'UserId':_0x4e7109,'ChatQueueId':_0x339abd['id']});});});});});});})[_0x1851('0x34')](respondWithStatusCode(_0x11f679,null))[_0x1851('0x27')](handleError(_0x11f679,null));};exports['addAgents']=function(_0x8c7aa8,_0xfa046e,_0x3857f7){return db['ChatQueue'][_0x1851('0x58')]({'where':{'id':_0x8c7aa8[_0x1851('0x57')]['id']}})[_0x1851('0x34')](handleEntityNotFound(_0xfa046e,null))[_0x1851('0x34')](function(_0x4b1c4c){if(_0x4b1c4c){return _0x4b1c4c[_0x1851('0x8f')](_0x8c7aa8['body']['ids'],_[_0x1851('0x90')](_0x8c7aa8['body'],[_0x1851('0x6f'),'id'])||{})[_0x1851('0x91')](function(_0x3d4fe8){for(var _0x46a516=0x0;_0x46a516<_0x8c7aa8[_0x1851('0x5a')]['ids']['length'];_0x46a516+=0x1){socket[_0x1851('0x8d')]('userChatQueue:save',{'UserId':Number(_0x8c7aa8['body']['ids'][_0x46a516]),'ChatQueueId':Number(_0x8c7aa8[_0x1851('0x57')]['id'])});}return _0x3d4fe8;});}})['then'](respondWithResult(_0xfa046e,null))[_0x1851('0x27')](handleError(_0xfa046e,null));};exports[_0x1851('0x8b')]=function(_0x4fa09b,_0x25c3d8,_0x3d444e){return db['ChatQueue'][_0x1851('0x58')]({'where':{'id':_0x4fa09b['params']['id']}})[_0x1851('0x34')](handleEntityNotFound(_0x25c3d8,null))['then'](function(_0x5589c4){if(_0x5589c4){return _0x5589c4[_0x1851('0x8b')](_0x4fa09b['query'][_0x1851('0x6f')])['then'](function(){if(_[_0x1851('0x92')](_0x4fa09b[_0x1851('0x44')][_0x1851('0x6f')])){for(var _0xb3b720=0x0;_0xb3b720<_0x4fa09b[_0x1851('0x44')][_0x1851('0x6f')][_0x1851('0x49')];_0xb3b720+=0x1){socket['emit'](_0x1851('0x8e'),{'UserId':Number(_0x4fa09b[_0x1851('0x44')]['ids'][_0xb3b720]),'ChatQueueId':Number(_0x4fa09b[_0x1851('0x57')]['id'])});}}else{socket[_0x1851('0x8d')](_0x1851('0x8e'),{'UserId':Number(_0x4fa09b[_0x1851('0x44')][_0x1851('0x6f')]),'ChatQueueId':Number(_0x4fa09b[_0x1851('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x25c3d8,null))[_0x1851('0x27')](handleError(_0x25c3d8,null));};exports[_0x1851('0x93')]=function(_0x30e443,_0x75acae,_0x4fa1c6){var _0x31610b={};var _0x585196={};var _0x1742fd;var _0x3f5847;return db[_0x1851('0x3e')][_0x1851('0x6c')]({'where':{'id':_0x30e443['params']['id']}})['then'](handleEntityNotFound(_0x75acae,null))[_0x1851('0x34')](function(_0x5ef300){if(_0x5ef300){_0x1742fd=_0x5ef300;_0x585196[_0x1851('0x43')]=_[_0x1851('0x45')](db['User'][_0x1851('0x3f')]);_0x585196[_0x1851('0x44')]=_[_0x1851('0x45')](_0x30e443['query']);_0x585196[_0x1851('0x4e')]=_[_0x1851('0x47')](_0x585196[_0x1851('0x43')],_0x585196[_0x1851('0x44')]);_0x31610b['attributes']=_[_0x1851('0x47')](_0x585196[_0x1851('0x43')],qs[_0x1851('0x48')](_0x30e443[_0x1851('0x44')][_0x1851('0x48')]));_0x31610b[_0x1851('0x46')]=_0x31610b[_0x1851('0x46')][_0x1851('0x49')]?_0x31610b[_0x1851('0x46')]:_0x585196[_0x1851('0x43')];_0x31610b[_0x1851('0x4c')]=qs[_0x1851('0x4d')](_0x30e443[_0x1851('0x44')][_0x1851('0x4d')]);_0x31610b[_0x1851('0x50')]=qs[_0x1851('0x4e')](_[_0x1851('0x94')](_0x30e443[_0x1851('0x44')],_0x585196['filters']));if(_0x30e443[_0x1851('0x44')]['filter']){_0x31610b[_0x1851('0x50')]=_[_0x1851('0x51')](_0x31610b['where'],{'$or':_[_0x1851('0x3d')](_0x31610b[_0x1851('0x46')],function(_0x268289){var _0x4dcf81={};_0x4dcf81[_0x268289]={'$like':'%'+_0x30e443[_0x1851('0x44')][_0x1851('0x4f')]+'%'};return _0x4dcf81;})});}_0x31610b=_['merge']({},_0x31610b,_0x30e443[_0x1851('0x53')]);return _0x1742fd[_0x1851('0x93')](_0x31610b);}})[_0x1851('0x34')](function(_0x148792){if(_0x148792){_0x3f5847=_0x148792[_0x1851('0x49')];if(!_0x30e443[_0x1851('0x44')][_0x1851('0x4a')](_0x1851('0x4b'))){_0x31610b[_0x1851('0x2c')]=qs['limit'](_0x30e443['query'][_0x1851('0x2c')]);_0x31610b[_0x1851('0x2b')]=qs[_0x1851('0x2b')](_0x30e443[_0x1851('0x44')][_0x1851('0x2b')]);}return _0x1742fd[_0x1851('0x93')](_0x31610b);}})[_0x1851('0x34')](function(_0x3c1988){if(_0x3c1988){return _0x3c1988?{'count':_0x3f5847,'rows':_0x3c1988}:null;}})[_0x1851('0x34')](respondWithResult(_0x75acae,null))[_0x1851('0x27')](handleError(_0x75acae,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index c632e25..3c690f5 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 _0xf6b4=['events','ChatQueue','setMaxListeners','save','update','remove','emit'];(function(_0x3d200f,_0x1d7823){var _0x444366=function(_0x39e8bd){while(--_0x39e8bd){_0x3d200f['push'](_0x3d200f['shift']());}};_0x444366(++_0x1d7823);}(_0xf6b4,0x196));var _0x4f6b=function(_0x126f47,_0x2199e9){_0x126f47=_0x126f47-0x0;var _0x49508a=_0xf6b4[_0x126f47];return _0x49508a;};'use strict';var EventEmitter=require(_0x4f6b('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x4f6b('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x4f6b('0x2')](0x0);var events={'afterCreate':_0x4f6b('0x3'),'afterUpdate':_0x4f6b('0x4'),'afterDestroy':_0x4f6b('0x5')};function emitEvent(_0x3cd5a4){return function(_0x44caf8,_0x350d74,_0x6dc615){ChatQueueEvents[_0x4f6b('0x6')](_0x3cd5a4+':'+_0x44caf8['id'],_0x44caf8);ChatQueueEvents['emit'](_0x3cd5a4,_0x44caf8);_0x6dc615(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x5c73=['ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x214282,_0x5cf292){var _0x4d2c6c=function(_0x30d11b){while(--_0x30d11b){_0x214282['push'](_0x214282['shift']());}};_0x4d2c6c(++_0x5cf292);}(_0x5c73,0x135));var _0x35c7=function(_0x2e38f3,_0x2d5564){_0x2e38f3=_0x2e38f3-0x0;var _0x3c20bf=_0x5c73[_0x2e38f3];return _0x3c20bf;};'use strict';var EventEmitter=require(_0x35c7('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x35c7('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x35c7('0x2')](0x0);var events={'afterCreate':_0x35c7('0x3'),'afterUpdate':_0x35c7('0x4'),'afterDestroy':_0x35c7('0x5')};function emitEvent(_0x1adfb8){return function(_0x1dc81f,_0x4e0471,_0x47c4eb){ChatQueueEvents[_0x35c7('0x6')](_0x1adfb8+':'+_0x1dc81f['id'],_0x1dc81f);ChatQueueEvents[_0x35c7('0x6')](_0x1adfb8,_0x1dc81f);_0x47c4eb(null);};}for(var e in events){if(events[_0x35c7('0x7')](e)){var event=events[e];ChatQueue[_0x35c7('0x8')](e,emitEvent(event));}}module[_0x35c7('0x9')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 7d9e2ae..fb5dc75 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 _0xd0d9=['./chatQueue.attributes','exports','define','chat_queues','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd0d9,0x130));var _0x9d0d=function(_0x5b1a4b,_0x5496a5){_0x5b1a4b=_0x5b1a4b-0x0;var _0x4fbb3d=_0xd0d9[_0x5b1a4b];return _0x4fbb3d;};'use strict';var _=require(_0x9d0d('0x0'));var util=require(_0x9d0d('0x1'));var logger=require('../../config/logger')(_0x9d0d('0x2'));var moment=require(_0x9d0d('0x3'));var BPromise=require(_0x9d0d('0x4'));var rp=require(_0x9d0d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9d0d('0x6'));var config=require(_0x9d0d('0x7'));var attributes=require(_0x9d0d('0x8'));module[_0x9d0d('0x9')]=function(_0x293126,_0x47286b){return _0x293126[_0x9d0d('0xa')]('ChatQueue',attributes,{'tableName':_0x9d0d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b43=['./chatQueue.attributes','exports','ChatQueue','chat_queues','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2b43,0x88));var _0x32b4=function(_0x464097,_0x4df563){_0x464097=_0x464097-0x0;var _0x5ab454=_0x2b43[_0x464097];return _0x5ab454;};'use strict';var _=require(_0x32b4('0x0'));var util=require('util');var logger=require(_0x32b4('0x1'))(_0x32b4('0x2'));var moment=require(_0x32b4('0x3'));var BPromise=require('bluebird');var rp=require(_0x32b4('0x4'));var fs=require('fs');var path=require(_0x32b4('0x5'));var rimraf=require(_0x32b4('0x6'));var config=require(_0x32b4('0x7'));var attributes=require(_0x32b4('0x8'));module[_0x32b4('0x9')]=function(_0x54aa2d,_0x1d3106){return _0x54aa2d['define'](_0x32b4('0xa'),attributes,{'tableName':_0x32b4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 5e1e889..942e0d8 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 _0x48ae=['register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatQueue','options','raw','where','attributes','limit','include','map','model','GetChatQueue','ShowChatQueue','find','lodash','randomstring','../../mysqldb','../../config/utils','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x48ae,0x142));var _0xe48a=function(_0x3e0a08,_0x2b7f4d){_0x3e0a08=_0x3e0a08-0x0;var _0x279db=_0x48ae[_0x3e0a08];return _0x279db;};'use strict';var _=require(_0xe48a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe48a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe48a('0x2'))['db'];var utils=require(_0xe48a('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe48a('0x4'));var client=jayson['client'][_0xe48a('0x5')]({'port':0x232a});config[_0xe48a('0x6')]=_[_0xe48a('0x7')](config['redis'],{'host':_0xe48a('0x8'),'port':0x18eb});var socket=require(_0xe48a('0x9'))(new Redis(config[_0xe48a('0x6')]));require(_0xe48a('0xa'))[_0xe48a('0xb')](socket);function respondWithRpcPromise(_0xf31d44,_0x3e8734,_0x403cc1){return new BPromise(function(_0x41fe19,_0x4fdc89){return client[_0xe48a('0xc')](_0xf31d44,_0x403cc1)[_0xe48a('0xd')](function(_0x2ad037){logger[_0xe48a('0xe')](_0xe48a('0xf'),_0x3e8734,_0xe48a('0x10'));logger[_0xe48a('0x11')](_0xe48a('0x12'),_0x3e8734,_0xe48a('0x10'),JSON[_0xe48a('0x13')](_0x2ad037));if(_0x2ad037[_0xe48a('0x14')]){if(_0x2ad037[_0xe48a('0x14')][_0xe48a('0x15')]===0x1f4){logger[_0xe48a('0x14')](_0xe48a('0xf'),_0x3e8734,_0x2ad037[_0xe48a('0x14')]['message']);return _0x4fdc89(_0x2ad037[_0xe48a('0x14')][_0xe48a('0x16')]);}logger[_0xe48a('0x14')](_0xe48a('0xf'),_0x3e8734,_0x2ad037[_0xe48a('0x14')][_0xe48a('0x16')]);return _0x41fe19(_0x2ad037[_0xe48a('0x14')]['message']);}else{logger[_0xe48a('0xe')](_0xe48a('0xf'),_0x3e8734,_0xe48a('0x10'));_0x41fe19(_0x2ad037[_0xe48a('0x17')][_0xe48a('0x16')]);}})[_0xe48a('0x18')](function(_0x5160bd){logger[_0xe48a('0x14')](_0xe48a('0xf'),_0x3e8734,_0x5160bd);_0x4fdc89(_0x5160bd);});});}exports['GetChatQueue']=function(_0x520fd8){var _0x38ae00=this;return new Promise(function(_0x30cd41,_0x458f44){return db[_0xe48a('0x19')]['findAll']({'raw':_0x520fd8[_0xe48a('0x1a')]?_0x520fd8[_0xe48a('0x1a')][_0xe48a('0x1b')]===undefined?!![]:![]:!![],'where':_0x520fd8[_0xe48a('0x1a')]?_0x520fd8['options'][_0xe48a('0x1c')]||null:null,'attributes':_0x520fd8[_0xe48a('0x1a')]?_0x520fd8[_0xe48a('0x1a')][_0xe48a('0x1d')]||null:null,'limit':_0x520fd8['options']?_0x520fd8['options'][_0xe48a('0x1e')]||null:null,'include':_0x520fd8[_0xe48a('0x1a')]?_0x520fd8[_0xe48a('0x1a')][_0xe48a('0x1f')]?_[_0xe48a('0x20')](_0x520fd8['options'][_0xe48a('0x1f')],function(_0x566bb4){return{'model':db[_0x566bb4['model']],'as':_0x566bb4['as'],'attributes':_0x566bb4[_0xe48a('0x1d')],'include':_0x566bb4[_0xe48a('0x1f')]?_[_0xe48a('0x20')](_0x566bb4[_0xe48a('0x1f')],function(_0x3a2b52){return{'model':db[_0x3a2b52[_0xe48a('0x21')]],'as':_0x3a2b52['as'],'attributes':_0x3a2b52[_0xe48a('0x1d')],'include':_0x3a2b52[_0xe48a('0x1f')]?_[_0xe48a('0x20')](_0x3a2b52['include'],function(_0x45739c){return{'model':db[_0x45739c[_0xe48a('0x21')]],'as':_0x45739c['as'],'attributes':_0x45739c[_0xe48a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe48a('0xd')](function(_0x32a6cf){logger['info'](_0xe48a('0x22'),_0x520fd8);logger[_0xe48a('0x11')](_0xe48a('0x22'),_0x520fd8,JSON[_0xe48a('0x13')](_0x32a6cf));_0x30cd41(_0x32a6cf);})['catch'](function(_0x3f7323){logger['error'](_0xe48a('0x22'),_0x3f7323[_0xe48a('0x16')],_0x520fd8);_0x458f44(_0x38ae00[_0xe48a('0x14')](0x1f4,_0x3f7323['message']));});});};exports[_0xe48a('0x23')]=function(_0x57689b){var _0x143336=this;return new Promise(function(_0xdcb935,_0xab4c47){return db[_0xe48a('0x19')][_0xe48a('0x24')]({'raw':_0x57689b['options']?_0x57689b[_0xe48a('0x1a')][_0xe48a('0x1b')]===undefined?!![]:![]:!![],'where':_0x57689b[_0xe48a('0x1a')]?_0x57689b[_0xe48a('0x1a')][_0xe48a('0x1c')]||null:null,'attributes':_0x57689b[_0xe48a('0x1a')]?_0x57689b[_0xe48a('0x1a')][_0xe48a('0x1d')]||null:null,'include':_0x57689b['options']?_0x57689b['options'][_0xe48a('0x1f')]?_['map'](_0x57689b['options'][_0xe48a('0x1f')],function(_0x1311a7){return{'model':db[_0x1311a7[_0xe48a('0x21')]],'as':_0x1311a7['as'],'attributes':_0x1311a7['attributes'],'include':_0x1311a7['include']?_[_0xe48a('0x20')](_0x1311a7[_0xe48a('0x1f')],function(_0x5b7fa6){return{'model':db[_0x5b7fa6[_0xe48a('0x21')]],'as':_0x5b7fa6['as'],'attributes':_0x5b7fa6[_0xe48a('0x1d')],'include':_0x5b7fa6['include']?_[_0xe48a('0x20')](_0x5b7fa6['include'],function(_0x4a1730){return{'model':db[_0x4a1730['model']],'as':_0x4a1730['as'],'attributes':_0x4a1730[_0xe48a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe48a('0xd')](function(_0x3221f3){logger[_0xe48a('0xe')](_0xe48a('0x23'),_0x57689b);logger[_0xe48a('0x11')](_0xe48a('0x23'),_0x57689b,JSON['stringify'](_0x3221f3));_0xdcb935(_0x3221f3);})[_0xe48a('0x18')](function(_0x226c6c){logger[_0xe48a('0x14')](_0xe48a('0x23'),_0x226c6c[_0xe48a('0x16')],_0x57689b);_0xab4c47(_0x143336['error'](0x1f4,_0x226c6c[_0xe48a('0x16')]));});});}; \ No newline at end of file +var _0xc8ac=['./chatQueue.socket','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowChatQueue','find','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults'];(function(_0x17a223,_0x101aad){var _0xf568e3=function(_0x1ee2fd){while(--_0x1ee2fd){_0x17a223['push'](_0x17a223['shift']());}};_0xf568e3(++_0x101aad);}(_0xc8ac,0xe9));var _0xcc8a=function(_0x438912,_0x3f7f74){_0x438912=_0x438912-0x0;var _0x18112f=_0xc8ac[_0x438912];return _0x18112f;};'use strict';var _=require(_0xcc8a('0x0'));var util=require(_0xcc8a('0x1'));var moment=require(_0xcc8a('0x2'));var BPromise=require(_0xcc8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcc8a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcc8a('0x5'));var logger=require(_0xcc8a('0x6'))(_0xcc8a('0x7'));var config=require(_0xcc8a('0x8'));var jayson=require(_0xcc8a('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xcc8a('0xa')]=_[_0xcc8a('0xb')](config[_0xcc8a('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcc8a('0xa')]));require(_0xcc8a('0xc'))['register'](socket);function respondWithRpcPromise(_0x3fa245,_0x34f02f,_0x510c1d){return new BPromise(function(_0x2c5025,_0x4e175e){return client['request'](_0x3fa245,_0x510c1d)[_0xcc8a('0xd')](function(_0x186896){logger[_0xcc8a('0xe')](_0xcc8a('0xf'),_0x34f02f,_0xcc8a('0x10'));logger[_0xcc8a('0x11')](_0xcc8a('0x12'),_0x34f02f,_0xcc8a('0x10'),JSON[_0xcc8a('0x13')](_0x186896));if(_0x186896[_0xcc8a('0x14')]){if(_0x186896[_0xcc8a('0x14')]['code']===0x1f4){logger[_0xcc8a('0x14')](_0xcc8a('0xf'),_0x34f02f,_0x186896[_0xcc8a('0x14')][_0xcc8a('0x15')]);return _0x4e175e(_0x186896[_0xcc8a('0x14')][_0xcc8a('0x15')]);}logger['error'](_0xcc8a('0xf'),_0x34f02f,_0x186896[_0xcc8a('0x14')][_0xcc8a('0x15')]);return _0x2c5025(_0x186896[_0xcc8a('0x14')][_0xcc8a('0x15')]);}else{logger[_0xcc8a('0xe')](_0xcc8a('0xf'),_0x34f02f,'request\x20sent');_0x2c5025(_0x186896['result'][_0xcc8a('0x15')]);}})[_0xcc8a('0x16')](function(_0x20c29f){logger[_0xcc8a('0x14')]('ChatQueue,\x20%s,\x20%s',_0x34f02f,_0x20c29f);_0x4e175e(_0x20c29f);});});}exports[_0xcc8a('0x17')]=function(_0x4dad7b){var _0x471f1d=this;return new Promise(function(_0x3a2e3d,_0xa76ad9){return db['ChatQueue'][_0xcc8a('0x18')]({'raw':_0x4dad7b[_0xcc8a('0x19')]?_0x4dad7b['options'][_0xcc8a('0x1a')]===undefined?!![]:![]:!![],'where':_0x4dad7b[_0xcc8a('0x19')]?_0x4dad7b[_0xcc8a('0x19')][_0xcc8a('0x1b')]||null:null,'attributes':_0x4dad7b[_0xcc8a('0x19')]?_0x4dad7b['options'][_0xcc8a('0x1c')]||null:null,'limit':_0x4dad7b[_0xcc8a('0x19')]?_0x4dad7b['options'][_0xcc8a('0x1d')]||null:null,'include':_0x4dad7b[_0xcc8a('0x19')]?_0x4dad7b['options'][_0xcc8a('0x1e')]?_[_0xcc8a('0x1f')](_0x4dad7b[_0xcc8a('0x19')][_0xcc8a('0x1e')],function(_0x221841){return{'model':db[_0x221841[_0xcc8a('0x20')]],'as':_0x221841['as'],'attributes':_0x221841[_0xcc8a('0x1c')],'include':_0x221841[_0xcc8a('0x1e')]?_[_0xcc8a('0x1f')](_0x221841[_0xcc8a('0x1e')],function(_0x338351){return{'model':db[_0x338351[_0xcc8a('0x20')]],'as':_0x338351['as'],'attributes':_0x338351['attributes'],'include':_0x338351[_0xcc8a('0x1e')]?_[_0xcc8a('0x1f')](_0x338351['include'],function(_0x41271f){return{'model':db[_0x41271f[_0xcc8a('0x20')]],'as':_0x41271f['as'],'attributes':_0x41271f[_0xcc8a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xcc8a('0xd')](function(_0x581ae8){logger[_0xcc8a('0xe')](_0xcc8a('0x17'),_0x4dad7b);logger[_0xcc8a('0x11')](_0xcc8a('0x17'),_0x4dad7b,JSON[_0xcc8a('0x13')](_0x581ae8));_0x3a2e3d(_0x581ae8);})[_0xcc8a('0x16')](function(_0x2a877f){logger[_0xcc8a('0x14')]('GetChatQueue',_0x2a877f['message'],_0x4dad7b);_0xa76ad9(_0x471f1d[_0xcc8a('0x14')](0x1f4,_0x2a877f['message']));});});};exports[_0xcc8a('0x21')]=function(_0x3629c1){var _0x59ff46=this;return new Promise(function(_0x14dbee,_0x5c19b0){return db['ChatQueue'][_0xcc8a('0x22')]({'raw':_0x3629c1[_0xcc8a('0x19')]?_0x3629c1[_0xcc8a('0x19')][_0xcc8a('0x1a')]===undefined?!![]:![]:!![],'where':_0x3629c1['options']?_0x3629c1['options'][_0xcc8a('0x1b')]||null:null,'attributes':_0x3629c1[_0xcc8a('0x19')]?_0x3629c1[_0xcc8a('0x19')][_0xcc8a('0x1c')]||null:null,'include':_0x3629c1[_0xcc8a('0x19')]?_0x3629c1[_0xcc8a('0x19')][_0xcc8a('0x1e')]?_[_0xcc8a('0x1f')](_0x3629c1[_0xcc8a('0x19')][_0xcc8a('0x1e')],function(_0x36125f){return{'model':db[_0x36125f[_0xcc8a('0x20')]],'as':_0x36125f['as'],'attributes':_0x36125f['attributes'],'include':_0x36125f[_0xcc8a('0x1e')]?_[_0xcc8a('0x1f')](_0x36125f[_0xcc8a('0x1e')],function(_0x5df806){return{'model':db[_0x5df806[_0xcc8a('0x20')]],'as':_0x5df806['as'],'attributes':_0x5df806['attributes'],'include':_0x5df806['include']?_[_0xcc8a('0x1f')](_0x5df806['include'],function(_0x46a22d){return{'model':db[_0x46a22d[_0xcc8a('0x20')]],'as':_0x46a22d['as'],'attributes':_0x46a22d[_0xcc8a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xcc8a('0xd')](function(_0x20390c){logger['info'](_0xcc8a('0x21'),_0x3629c1);logger[_0xcc8a('0x11')](_0xcc8a('0x21'),_0x3629c1,JSON[_0xcc8a('0x13')](_0x20390c));_0x14dbee(_0x20390c);})['catch'](function(_0x5e1174){logger[_0xcc8a('0x14')]('ShowChatQueue',_0x5e1174['message'],_0x3629c1);_0x5c19b0(_0x59ff46['error'](0x1f4,_0x5e1174['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 432321e..d11b9cf 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 _0xcb99=['chatQueue:','./chatQueue.events','remove','emit','removeListener','length'];(function(_0x559f56,_0x6fdb3){var _0x437f81=function(_0x176fa5){while(--_0x176fa5){_0x559f56['push'](_0x559f56['shift']());}};_0x437f81(++_0x6fdb3);}(_0xcb99,0x8b));var _0x9cb9=function(_0x503641,_0x33a3cf){_0x503641=_0x503641-0x0;var _0x17757d=_0xcb99[_0x503641];return _0x17757d;};'use strict';var ChatQueueEvents=require(_0x9cb9('0x0'));var events=['save',_0x9cb9('0x1'),'update'];function createListener(_0x480364,_0x3a2f21){return function(_0x1308a8){_0x3a2f21[_0x9cb9('0x2')](_0x480364,_0x1308a8);};}function removeListener(_0x51f2ee,_0x167735){return function(){ChatQueueEvents[_0x9cb9('0x3')](_0x51f2ee,_0x167735);};}exports['register']=function(_0x214b72){for(var _0x509cfc=0x0,_0x2ed26a=events[_0x9cb9('0x4')];_0x509cfc<_0x2ed26a;_0x509cfc++){var _0x1bf9b7=events[_0x509cfc];var _0x1dd62f=createListener(_0x9cb9('0x5')+_0x1bf9b7,_0x214b72);ChatQueueEvents['on'](_0x1bf9b7,_0x1dd62f);}}; \ No newline at end of file +var _0x2d17=['update','emit','register','chatQueue:','./chatQueue.events','save'];(function(_0x1a1b70,_0x327a42){var _0x489703=function(_0x227eb4){while(--_0x227eb4){_0x1a1b70['push'](_0x1a1b70['shift']());}};_0x489703(++_0x327a42);}(_0x2d17,0x17e));var _0x72d1=function(_0x5d6dd0,_0x4edabd){_0x5d6dd0=_0x5d6dd0-0x0;var _0x286e46=_0x2d17[_0x5d6dd0];return _0x286e46;};'use strict';var ChatQueueEvents=require(_0x72d1('0x0'));var events=[_0x72d1('0x1'),'remove',_0x72d1('0x2')];function createListener(_0x4727f9,_0x531f4e){return function(_0x3687bc){_0x531f4e[_0x72d1('0x3')](_0x4727f9,_0x3687bc);};}function removeListener(_0x55b722,_0x1dd6d8){return function(){ChatQueueEvents['removeListener'](_0x55b722,_0x1dd6d8);};}exports[_0x72d1('0x4')]=function(_0x50f551){for(var _0x139ba0=0x0,_0x239d1f=events['length'];_0x139ba0<_0x239d1f;_0x139ba0++){var _0x477264=events[_0x139ba0];var _0x422f5a=createListener(_0x72d1('0x5')+_0x477264,_0x50f551);ChatQueueEvents['on'](_0x477264,_0x422f5a);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index dbcefff..888c5b3 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0xf61bc2,_0x3d535e){var _0x1c6c56=function(_0x5ac552){while(--_0x5ac552){_0xf61bc2['push'](_0xf61bc2['shift']());}};_0x1c6c56(++_0x3d535e);}(_0x814b,0x1a2));var _0xb814=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0x814b[_0x25d386];return _0x857f4a;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0x16')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0x16')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x18')]);router[_0xb814('0x16')](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller['destroy']);router[_0xb814('0x1c')]('/:id/teams',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xb814('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x3e41f7,_0xb5ff25){var _0x43282a=function(_0x36e7e4){while(--_0x36e7e4){_0x3e41f7['push'](_0x3e41f7['shift']());}};_0x43282a(++_0xb5ff25);}(_0xe14b,0x93));var _0xbe14=function(_0xdb987d,_0x3c1c73){_0xdb987d=_0xdb987d-0x0;var _0x2a4d64=_0xe14b[_0xdb987d];return _0x2a4d64;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index d0a8100..03a27ee 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 _0x16eb=['sequelize','STRING','DATE','moment'];(function(_0x32cbd9,_0x1bbeb7){var _0x242d1e=function(_0x5362a4){while(--_0x5362a4){_0x32cbd9['push'](_0x32cbd9['shift']());}};_0x242d1e(++_0x1bbeb7);}(_0x16eb,0x73));var _0xb16e=function(_0x55ec67,_0x1c90d5){_0x55ec67=_0x55ec67-0x0;var _0x1350f6=_0x16eb[_0x55ec67];return _0x1350f6;};'use strict';var moment=require(_0xb16e('0x0'));var Sequelize=require(_0xb16e('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xb16e('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xb16e('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xb16e('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb7a6=['DATE','sequelize','exports','STRING'];(function(_0x2eeaf7,_0x155c61){var _0x450c3f=function(_0x4d5a3){while(--_0x4d5a3){_0x2eeaf7['push'](_0x2eeaf7['shift']());}};_0x450c3f(++_0x155c61);}(_0xb7a6,0x189));var _0x6b7a=function(_0x527fab,_0x511ef4){_0x527fab=_0x527fab-0x0;var _0x17718c=_0xb7a6[_0x527fab];return _0x17718c;};'use strict';var moment=require('moment');var Sequelize=require(_0x6b7a('0x0'));module[_0x6b7a('0x1')]={'uniqueid':{'type':Sequelize[_0x6b7a('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x6b7a('0x2')]},'joinAt':{'type':Sequelize[_0x6b7a('0x3')]},'leaveAt':{'type':Sequelize[_0x6b7a('0x3')]},'acceptAt':{'type':Sequelize[_0x6b7a('0x3')]},'exitAt':{'type':Sequelize[_0x6b7a('0x3')]},'reason':{'type':Sequelize[_0x6b7a('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 7625f00..429f0a3 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 _0x6f44=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','Content-Range','apply','save','update','then','destroy','error','stack','name','map','ChatQueueReport','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','VIRTUAL','where','count','includeAll','include','rows','catch','params','keys','rawAttributes','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x1afd94,_0x4562a1){var _0x481f3d=function(_0x1c08b7){while(--_0x1c08b7){_0x1afd94['push'](_0x1afd94['shift']());}};_0x481f3d(++_0x4562a1);}(_0x6f44,0x1ea));var _0x46f4=function(_0x47523f,_0x318789){_0x47523f=_0x47523f-0x0;var _0x4ac247=_0x6f44[_0x47523f];return _0x4ac247;};'use strict';var emlformat=require(_0x46f4('0x0'));var rimraf=require(_0x46f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x46f4('0x2'));var rp=require(_0x46f4('0x3'));var moment=require(_0x46f4('0x4'));var BPromise=require(_0x46f4('0x5'));var Mustache=require(_0x46f4('0x6'));var util=require(_0x46f4('0x7'));var path=require(_0x46f4('0x8'));var sox=require(_0x46f4('0x9'));var csv=require(_0x46f4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x46f4('0xb'));var _=require(_0x46f4('0xc'));var squel=require(_0x46f4('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x46f4('0xe'));var toCsv=require(_0x46f4('0xa'));var querystring=require('querystring');var Papa=require(_0x46f4('0xf'));var Redis=require('ioredis');var authService=require(_0x46f4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x46f4('0x11'));var hardwareService=require(_0x46f4('0x12'));var logger=require(_0x46f4('0x13'))(_0x46f4('0x14'));var utils=require(_0x46f4('0x15'));var config=require(_0x46f4('0x16'));var licenseUtil=require(_0x46f4('0x17'));var db=require(_0x46f4('0x18'))['db'];function respondWithStatusCode(_0x21d4a6,_0x1f4748){_0x1f4748=_0x1f4748||0xcc;return function(_0x1dd233){if(_0x1dd233){return _0x21d4a6[_0x46f4('0x19')](_0x1f4748);}return _0x21d4a6['status'](_0x1f4748)[_0x46f4('0x1a')]();};}function respondWithResult(_0x33f73c,_0x52db86){_0x52db86=_0x52db86||0xc8;return function(_0x44a55b){if(_0x44a55b){return _0x33f73c[_0x46f4('0x1b')](_0x52db86)[_0x46f4('0x1c')](_0x44a55b);}};}function respondWithFilteredResult(_0x4dd2fb,_0x3dc516){return function(_0x4e0661){if(_0x4e0661){var _0x4e84ce=typeof _0x3dc516[_0x46f4('0x1d')]===_0x46f4('0x1e')&&typeof _0x3dc516[_0x46f4('0x1f')]==='undefined';var _0x5c191a=_0x4e0661['count'];var _0x5d3471=_0x4e84ce?0x0:_0x3dc516[_0x46f4('0x1d')];var _0x433297=_0x4e84ce?_0x4e0661['count']:_0x3dc516[_0x46f4('0x1d')]+_0x3dc516[_0x46f4('0x1f')];var _0x2232d6;if(_0x433297>=_0x5c191a){_0x433297=_0x5c191a;_0x2232d6=0xc8;}else{_0x2232d6=0xce;}_0x4dd2fb[_0x46f4('0x1b')](_0x2232d6);return _0x4dd2fb['set'](_0x46f4('0x20'),_0x5d3471+'-'+_0x433297+'/'+_0x5c191a)[_0x46f4('0x1c')](_0x4e0661);}return null;};}function patchUpdates(_0x1627db){return function(_0x6476f0){try{jsonpatch[_0x46f4('0x21')](_0x6476f0,_0x1627db,!![]);}catch(_0xdb9f25){return BPromise['reject'](_0xdb9f25);}return _0x6476f0[_0x46f4('0x22')]();};}function saveUpdates(_0x2b88d3,_0x39760b){return function(_0x4ba21a){if(_0x4ba21a){return _0x4ba21a[_0x46f4('0x23')](_0x2b88d3)[_0x46f4('0x24')](function(_0x185ec2){return _0x185ec2;});}return null;};}function removeEntity(_0x47528b,_0x36092e){return function(_0x41be5e){if(_0x41be5e){return _0x41be5e[_0x46f4('0x25')]()[_0x46f4('0x24')](function(){_0x47528b[_0x46f4('0x1b')](0xcc)[_0x46f4('0x1a')]();});}};}function handleEntityNotFound(_0x2ad553,_0x16cd7f){return function(_0x197e55){if(!_0x197e55){_0x2ad553['sendStatus'](0x194);}return _0x197e55;};}function handleError(_0x46e96d,_0x30d4fc){_0x30d4fc=_0x30d4fc||0x1f4;return function(_0xb23194){logger[_0x46f4('0x26')](_0xb23194[_0x46f4('0x27')]);if(_0xb23194[_0x46f4('0x28')]){delete _0xb23194['name'];}_0x46e96d[_0x46f4('0x1b')](_0x30d4fc)['send'](_0xb23194);};}exports['index']=function(_0x53ac21,_0x2cf22c){var _0x57ff78={},_0x1fb343={},_0x183f0c={'count':0x0,'rows':[]};var _0x3c8c91=_[_0x46f4('0x29')](db[_0x46f4('0x2a')]['rawAttributes'],function(_0x1d512b){return{'name':_0x1d512b[_0x46f4('0x2b')],'type':_0x1d512b[_0x46f4('0x2c')]['key']};});_0x1fb343[_0x46f4('0x2d')]=_[_0x46f4('0x29')](_0x3c8c91,_0x46f4('0x28'));_0x1fb343['query']=_['keys'](_0x53ac21[_0x46f4('0x2e')]);_0x1fb343[_0x46f4('0x2f')]=_[_0x46f4('0x30')](_0x1fb343['model'],_0x1fb343[_0x46f4('0x2e')]);_0x57ff78[_0x46f4('0x31')]=_['intersection'](_0x1fb343[_0x46f4('0x2d')],qs['fields'](_0x53ac21[_0x46f4('0x2e')][_0x46f4('0x32')]));_0x57ff78[_0x46f4('0x31')]=_0x57ff78[_0x46f4('0x31')][_0x46f4('0x33')]?_0x57ff78['attributes']:_0x1fb343[_0x46f4('0x2d')];if(!_0x53ac21[_0x46f4('0x2e')]['hasOwnProperty'](_0x46f4('0x34'))){_0x57ff78[_0x46f4('0x1f')]=qs[_0x46f4('0x1f')](_0x53ac21[_0x46f4('0x2e')]['limit']);_0x57ff78[_0x46f4('0x1d')]=qs['offset'](_0x53ac21[_0x46f4('0x2e')][_0x46f4('0x1d')]);}_0x57ff78[_0x46f4('0x35')]=qs[_0x46f4('0x36')](_0x53ac21['query'][_0x46f4('0x36')]);_0x57ff78['where']=qs['filters'](_[_0x46f4('0x37')](_0x53ac21['query'],_0x1fb343['filters']),_0x3c8c91);if(_0x53ac21[_0x46f4('0x2e')][_0x46f4('0x38')]){_0x57ff78['where']=_[_0x46f4('0x39')](_0x57ff78['where'],{'$or':_[_0x46f4('0x29')](_0x3c8c91,function(_0x190c1a){if(_0x190c1a[_0x46f4('0x2c')]!==_0x46f4('0x3a')){var _0x5c6662={};_0x5c6662[_0x190c1a[_0x46f4('0x28')]]={'$like':'%'+_0x53ac21[_0x46f4('0x2e')][_0x46f4('0x38')]+'%'};return _0x5c6662;}})});}_0x57ff78=_['merge']({},_0x57ff78,_0x53ac21['options']);var _0x4a44a6={'where':_0x57ff78[_0x46f4('0x3b')]};return db[_0x46f4('0x2a')][_0x46f4('0x3c')](_0x4a44a6)[_0x46f4('0x24')](function(_0x57bfd2){_0x183f0c[_0x46f4('0x3c')]=_0x57bfd2;if(_0x53ac21[_0x46f4('0x2e')][_0x46f4('0x3d')]){_0x57ff78[_0x46f4('0x3e')]=[{'all':!![]}];}return db[_0x46f4('0x2a')]['findAll'](_0x57ff78);})[_0x46f4('0x24')](function(_0x306400){_0x183f0c[_0x46f4('0x3f')]=_0x306400;return _0x183f0c;})[_0x46f4('0x24')](respondWithFilteredResult(_0x2cf22c,_0x57ff78))[_0x46f4('0x40')](handleError(_0x2cf22c,null));};exports['show']=function(_0x549af3,_0x4e11cb){var _0x21ce83={'raw':!![],'where':{'id':_0x549af3[_0x46f4('0x41')]['id']}},_0x1c0513={};_0x1c0513['model']=_[_0x46f4('0x42')](db[_0x46f4('0x2a')][_0x46f4('0x43')]);_0x1c0513[_0x46f4('0x2e')]=_[_0x46f4('0x42')](_0x549af3[_0x46f4('0x2e')]);_0x1c0513[_0x46f4('0x2f')]=_[_0x46f4('0x30')](_0x1c0513[_0x46f4('0x2d')],_0x1c0513[_0x46f4('0x2e')]);_0x21ce83[_0x46f4('0x31')]=_[_0x46f4('0x30')](_0x1c0513[_0x46f4('0x2d')],qs['fields'](_0x549af3[_0x46f4('0x2e')][_0x46f4('0x32')]));_0x21ce83[_0x46f4('0x31')]=_0x21ce83[_0x46f4('0x31')][_0x46f4('0x33')]?_0x21ce83[_0x46f4('0x31')]:_0x1c0513['model'];if(_0x549af3['query']['includeAll']){_0x21ce83[_0x46f4('0x3e')]=[{'all':!![]}];}_0x21ce83=_[_0x46f4('0x39')]({},_0x21ce83,_0x549af3[_0x46f4('0x44')]);return db[_0x46f4('0x2a')][_0x46f4('0x45')](_0x21ce83)[_0x46f4('0x24')](handleEntityNotFound(_0x4e11cb,null))[_0x46f4('0x24')](respondWithResult(_0x4e11cb,null))[_0x46f4('0x40')](handleError(_0x4e11cb,null));};exports[_0x46f4('0x46')]=function(_0xf73c15,_0x21319d){return db[_0x46f4('0x2a')]['create'](_0xf73c15[_0x46f4('0x47')],{})[_0x46f4('0x24')](respondWithResult(_0x21319d,0xc9))[_0x46f4('0x40')](handleError(_0x21319d,null));};exports['update']=function(_0x5a6d1f,_0x1fedc8){if(_0x5a6d1f[_0x46f4('0x47')]['id']){delete _0x5a6d1f[_0x46f4('0x47')]['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x5a6d1f[_0x46f4('0x41')]['id']}})[_0x46f4('0x24')](handleEntityNotFound(_0x1fedc8,null))[_0x46f4('0x24')](saveUpdates(_0x5a6d1f[_0x46f4('0x47')],null))[_0x46f4('0x24')](respondWithResult(_0x1fedc8,null))[_0x46f4('0x40')](handleError(_0x1fedc8,null));};exports['destroy']=function(_0x18f0e0,_0x2bbb25){return db[_0x46f4('0x2a')]['find']({'where':{'id':_0x18f0e0[_0x46f4('0x41')]['id']}})[_0x46f4('0x24')](handleEntityNotFound(_0x2bbb25,null))[_0x46f4('0x24')](removeEntity(_0x2bbb25,null))[_0x46f4('0x40')](handleError(_0x2bbb25,null));};exports['describe']=function(_0x26f39a,_0x478dd7){return db[_0x46f4('0x2a')][_0x46f4('0x48')]()[_0x46f4('0x24')](respondWithResult(_0x478dd7,null))['catch'](handleError(_0x478dd7,null));}; \ No newline at end of file +var _0x33af=['findAll','rows','catch','show','params','length','include','create','body','find','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','order','sort','where','merge','VIRTUAL','filter','includeAll'];(function(_0x433c09,_0x5d4eee){var _0x47fd95=function(_0x3bf071){while(--_0x3bf071){_0x433c09['push'](_0x433c09['shift']());}};_0x47fd95(++_0x5d4eee);}(_0x33af,0xec));var _0xf33a=function(_0x150792,_0x187824){_0x150792=_0x150792-0x0;var _0x5f2974=_0x33af[_0x150792];return _0x5f2974;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf33a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf33a('0x1'));var rp=require(_0xf33a('0x2'));var moment=require(_0xf33a('0x3'));var BPromise=require(_0xf33a('0x4'));var Mustache=require(_0xf33a('0x5'));var util=require(_0xf33a('0x6'));var path=require('path');var sox=require(_0xf33a('0x7'));var csv=require(_0xf33a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf33a('0x9'));var _=require(_0xf33a('0xa'));var squel=require(_0xf33a('0xb'));var crypto=require(_0xf33a('0xc'));var jsforce=require(_0xf33a('0xd'));var deskjs=require(_0xf33a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf33a('0xf'));var Papa=require(_0xf33a('0x10'));var Redis=require(_0xf33a('0x11'));var authService=require(_0xf33a('0x12'));var qs=require(_0xf33a('0x13'));var as=require(_0xf33a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf33a('0x15'));var utils=require(_0xf33a('0x16'));var config=require(_0xf33a('0x17'));var licenseUtil=require(_0xf33a('0x18'));var db=require(_0xf33a('0x19'))['db'];function respondWithStatusCode(_0x5959c9,_0x9f87bc){_0x9f87bc=_0x9f87bc||0xcc;return function(_0x21b80e){if(_0x21b80e){return _0x5959c9['sendStatus'](_0x9f87bc);}return _0x5959c9['status'](_0x9f87bc)[_0xf33a('0x1a')]();};}function respondWithResult(_0x1b3bf0,_0x17043){_0x17043=_0x17043||0xc8;return function(_0x153bda){if(_0x153bda){return _0x1b3bf0[_0xf33a('0x1b')](_0x17043)[_0xf33a('0x1c')](_0x153bda);}};}function respondWithFilteredResult(_0x45e311,_0x1f2b1b){return function(_0x507cb9){if(_0x507cb9){var _0x441f59=typeof _0x1f2b1b['offset']===_0xf33a('0x1d')&&typeof _0x1f2b1b[_0xf33a('0x1e')]==='undefined';var _0x37e76c=_0x507cb9[_0xf33a('0x1f')];var _0x524109=_0x441f59?0x0:_0x1f2b1b[_0xf33a('0x20')];var _0x23d9e2=_0x441f59?_0x507cb9[_0xf33a('0x1f')]:_0x1f2b1b[_0xf33a('0x20')]+_0x1f2b1b['limit'];var _0x11efa0;if(_0x23d9e2>=_0x37e76c){_0x23d9e2=_0x37e76c;_0x11efa0=0xc8;}else{_0x11efa0=0xce;}_0x45e311[_0xf33a('0x1b')](_0x11efa0);return _0x45e311[_0xf33a('0x21')](_0xf33a('0x22'),_0x524109+'-'+_0x23d9e2+'/'+_0x37e76c)[_0xf33a('0x1c')](_0x507cb9);}return null;};}function patchUpdates(_0x6cdf7b){return function(_0x19986f){try{jsonpatch[_0xf33a('0x23')](_0x19986f,_0x6cdf7b,!![]);}catch(_0x19055e){return BPromise[_0xf33a('0x24')](_0x19055e);}return _0x19986f['save']();};}function saveUpdates(_0x3854b4,_0x272e60){return function(_0x1bf9bc){if(_0x1bf9bc){return _0x1bf9bc[_0xf33a('0x25')](_0x3854b4)[_0xf33a('0x26')](function(_0x51d3fd){return _0x51d3fd;});}return null;};}function removeEntity(_0x44654c,_0x5882ba){return function(_0x492986){if(_0x492986){return _0x492986[_0xf33a('0x27')]()[_0xf33a('0x26')](function(){_0x44654c[_0xf33a('0x1b')](0xcc)[_0xf33a('0x1a')]();});}};}function handleEntityNotFound(_0x4b9801,_0x57cb1d){return function(_0x393005){if(!_0x393005){_0x4b9801['sendStatus'](0x194);}return _0x393005;};}function handleError(_0x4af24a,_0x16ef31){_0x16ef31=_0x16ef31||0x1f4;return function(_0x5f0a53){logger['error'](_0x5f0a53[_0xf33a('0x28')]);if(_0x5f0a53['name']){delete _0x5f0a53[_0xf33a('0x29')];}_0x4af24a['status'](_0x16ef31)[_0xf33a('0x2a')](_0x5f0a53);};}exports[_0xf33a('0x2b')]=function(_0x469741,_0x729fca){var _0x4552c9={},_0x3068a9={},_0x1d19ee={'count':0x0,'rows':[]};var _0x1246ff=_[_0xf33a('0x2c')](db[_0xf33a('0x2d')][_0xf33a('0x2e')],function(_0x8f8ddc){return{'name':_0x8f8ddc[_0xf33a('0x2f')],'type':_0x8f8ddc[_0xf33a('0x30')][_0xf33a('0x31')]};});_0x3068a9['model']=_[_0xf33a('0x2c')](_0x1246ff,_0xf33a('0x29'));_0x3068a9[_0xf33a('0x32')]=_[_0xf33a('0x33')](_0x469741['query']);_0x3068a9[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x3068a9[_0xf33a('0x36')],_0x3068a9[_0xf33a('0x32')]);_0x4552c9[_0xf33a('0x37')]=_[_0xf33a('0x35')](_0x3068a9['model'],qs[_0xf33a('0x38')](_0x469741[_0xf33a('0x32')][_0xf33a('0x38')]));_0x4552c9[_0xf33a('0x37')]=_0x4552c9[_0xf33a('0x37')]['length']?_0x4552c9['attributes']:_0x3068a9[_0xf33a('0x36')];if(!_0x469741['query']['hasOwnProperty']('nolimit')){_0x4552c9[_0xf33a('0x1e')]=qs[_0xf33a('0x1e')](_0x469741['query'][_0xf33a('0x1e')]);_0x4552c9['offset']=qs[_0xf33a('0x20')](_0x469741[_0xf33a('0x32')][_0xf33a('0x20')]);}_0x4552c9[_0xf33a('0x39')]=qs[_0xf33a('0x3a')](_0x469741[_0xf33a('0x32')]['sort']);_0x4552c9[_0xf33a('0x3b')]=qs[_0xf33a('0x34')](_['pick'](_0x469741[_0xf33a('0x32')],_0x3068a9[_0xf33a('0x34')]),_0x1246ff);if(_0x469741[_0xf33a('0x32')]['filter']){_0x4552c9[_0xf33a('0x3b')]=_[_0xf33a('0x3c')](_0x4552c9[_0xf33a('0x3b')],{'$or':_[_0xf33a('0x2c')](_0x1246ff,function(_0x3ec562){if(_0x3ec562[_0xf33a('0x30')]!==_0xf33a('0x3d')){var _0x128baf={};_0x128baf[_0x3ec562[_0xf33a('0x29')]]={'$like':'%'+_0x469741['query'][_0xf33a('0x3e')]+'%'};return _0x128baf;}})});}_0x4552c9=_[_0xf33a('0x3c')]({},_0x4552c9,_0x469741['options']);var _0x1e8800={'where':_0x4552c9['where']};return db['ChatQueueReport'][_0xf33a('0x1f')](_0x1e8800)[_0xf33a('0x26')](function(_0x4dada1){_0x1d19ee[_0xf33a('0x1f')]=_0x4dada1;if(_0x469741[_0xf33a('0x32')][_0xf33a('0x3f')]){_0x4552c9['include']=[{'all':!![]}];}return db[_0xf33a('0x2d')][_0xf33a('0x40')](_0x4552c9);})['then'](function(_0x1e9748){_0x1d19ee[_0xf33a('0x41')]=_0x1e9748;return _0x1d19ee;})[_0xf33a('0x26')](respondWithFilteredResult(_0x729fca,_0x4552c9))[_0xf33a('0x42')](handleError(_0x729fca,null));};exports[_0xf33a('0x43')]=function(_0x5044f9,_0x45ae15){var _0x1722e5={'raw':!![],'where':{'id':_0x5044f9[_0xf33a('0x44')]['id']}},_0x2325eb={};_0x2325eb[_0xf33a('0x36')]=_['keys'](db[_0xf33a('0x2d')][_0xf33a('0x2e')]);_0x2325eb[_0xf33a('0x32')]=_['keys'](_0x5044f9[_0xf33a('0x32')]);_0x2325eb[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x2325eb[_0xf33a('0x36')],_0x2325eb[_0xf33a('0x32')]);_0x1722e5[_0xf33a('0x37')]=_['intersection'](_0x2325eb[_0xf33a('0x36')],qs[_0xf33a('0x38')](_0x5044f9[_0xf33a('0x32')][_0xf33a('0x38')]));_0x1722e5[_0xf33a('0x37')]=_0x1722e5['attributes'][_0xf33a('0x45')]?_0x1722e5[_0xf33a('0x37')]:_0x2325eb[_0xf33a('0x36')];if(_0x5044f9['query'][_0xf33a('0x3f')]){_0x1722e5[_0xf33a('0x46')]=[{'all':!![]}];}_0x1722e5=_['merge']({},_0x1722e5,_0x5044f9['options']);return db[_0xf33a('0x2d')]['find'](_0x1722e5)[_0xf33a('0x26')](handleEntityNotFound(_0x45ae15,null))[_0xf33a('0x26')](respondWithResult(_0x45ae15,null))[_0xf33a('0x42')](handleError(_0x45ae15,null));};exports[_0xf33a('0x47')]=function(_0xecc82f,_0x1a98f9){return db[_0xf33a('0x2d')][_0xf33a('0x47')](_0xecc82f[_0xf33a('0x48')],{})[_0xf33a('0x26')](respondWithResult(_0x1a98f9,0xc9))[_0xf33a('0x42')](handleError(_0x1a98f9,null));};exports[_0xf33a('0x25')]=function(_0x190a2b,_0x6b79da){if(_0x190a2b[_0xf33a('0x48')]['id']){delete _0x190a2b[_0xf33a('0x48')]['id'];}return db[_0xf33a('0x2d')][_0xf33a('0x49')]({'where':{'id':_0x190a2b[_0xf33a('0x44')]['id']}})[_0xf33a('0x26')](handleEntityNotFound(_0x6b79da,null))[_0xf33a('0x26')](saveUpdates(_0x190a2b[_0xf33a('0x48')],null))[_0xf33a('0x26')](respondWithResult(_0x6b79da,null))[_0xf33a('0x42')](handleError(_0x6b79da,null));};exports[_0xf33a('0x27')]=function(_0x1b15a1,_0x3bab07){return db[_0xf33a('0x2d')][_0xf33a('0x49')]({'where':{'id':_0x1b15a1['params']['id']}})[_0xf33a('0x26')](handleEntityNotFound(_0x3bab07,null))[_0xf33a('0x26')](removeEntity(_0x3bab07,null))['catch'](handleError(_0x3bab07,null));};exports[_0xf33a('0x4a')]=function(_0xd40707,_0x36cba8){return db['ChatQueueReport'][_0xf33a('0x4a')]()[_0xf33a('0x26')](respondWithResult(_0x36cba8,null))[_0xf33a('0x42')](handleError(_0x36cba8,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 420cbd5..def8291 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['path','rimraf','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x50c7a2,_0x296413){var _0x3d11bb=function(_0x436128){while(--_0x436128){_0x50c7a2['push'](_0x50c7a2['shift']());}};_0x3d11bb(++_0x296413);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0xcb91[_0x46efd7];return _0x5637e4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('ChatQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x4283e9,_0x55c057){var _0x4e4c67=function(_0x3c700c){while(--_0x3c700c){_0x4283e9['push'](_0x4283e9['shift']());}};_0x4e4c67(++_0x55c057);}(_0xe706,0xa3));var _0x6e70=function(_0x540041,_0x388ca0){_0x540041=_0x540041-0x0;var _0x5a4898=_0xe706[_0x540041];return _0x5a4898;};'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/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 37fd7f9..7ddc2a3 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 _0x38f9=['catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','update','where','limit','UpdateChatQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x3cc3c6,_0x39c09b){var _0x19d856=function(_0x19ca85){while(--_0x19ca85){_0x3cc3c6['push'](_0x3cc3c6['shift']());}};_0x19d856(++_0x39c09b);}(_0x38f9,0x1af));var _0x938f=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x38f9[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0x938f('0x0'));var util=require(_0x938f('0x1'));var moment=require(_0x938f('0x2'));var BPromise=require('bluebird');var rs=require(_0x938f('0x3'));var fs=require('fs');var Redis=require(_0x938f('0x4'));var db=require(_0x938f('0x5'))['db'];var utils=require(_0x938f('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x938f('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x938f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x275a93,_0x345bfd,_0x439921){return new BPromise(function(_0xf2db39,_0x3c9fb6){return client['request'](_0x275a93,_0x439921)[_0x938f('0x9')](function(_0x355eee){logger[_0x938f('0xa')](_0x938f('0xb'),_0x345bfd,_0x938f('0xc'));logger[_0x938f('0xd')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x345bfd,_0x938f('0xc'),JSON[_0x938f('0xe')](_0x355eee));if(_0x355eee['error']){if(_0x355eee[_0x938f('0xf')][_0x938f('0x10')]===0x1f4){logger[_0x938f('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x345bfd,_0x355eee[_0x938f('0xf')][_0x938f('0x11')]);return _0x3c9fb6(_0x355eee[_0x938f('0xf')][_0x938f('0x11')]);}logger[_0x938f('0xf')](_0x938f('0xb'),_0x345bfd,_0x355eee['error']['message']);return _0xf2db39(_0x355eee[_0x938f('0xf')]['message']);}else{logger['info'](_0x938f('0xb'),_0x345bfd,_0x938f('0xc'));_0xf2db39(_0x355eee[_0x938f('0x12')][_0x938f('0x11')]);}})[_0x938f('0x13')](function(_0x4bdcb3){logger[_0x938f('0xf')](_0x938f('0xb'),_0x345bfd,_0x4bdcb3);_0x3c9fb6(_0x4bdcb3);});});}exports[_0x938f('0x14')]=function(_0x1dbdce){var _0x55116c=this;return new Promise(function(_0x5915a5,_0x314709){return db[_0x938f('0x15')][_0x938f('0x16')](_0x1dbdce[_0x938f('0x17')],{'raw':_0x1dbdce[_0x938f('0x18')]?_0x1dbdce['options'][_0x938f('0x19')]===undefined?!![]:![]:!![]})[_0x938f('0x9')](function(_0x54394c){logger['info']('CreateChatQueueReport',_0x1dbdce);logger[_0x938f('0xd')](_0x938f('0x14'),_0x1dbdce,JSON[_0x938f('0xe')](_0x54394c));_0x5915a5(_0x54394c);})['catch'](function(_0x44001e){logger[_0x938f('0xf')](_0x938f('0x14'),_0x44001e[_0x938f('0x11')],_0x1dbdce);_0x314709(_0x55116c['error'](0x1f4,_0x44001e['message']));});});};exports['UpdateChatQueueReport']=function(_0x2f6ba7){var _0x52e0d=this;return new Promise(function(_0x230375,_0x9e1cc8){return db['ChatQueueReport'][_0x938f('0x1a')](_0x2f6ba7[_0x938f('0x17')],{'raw':_0x2f6ba7[_0x938f('0x18')]?_0x2f6ba7[_0x938f('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f6ba7[_0x938f('0x18')]?_0x2f6ba7[_0x938f('0x18')][_0x938f('0x1b')]||null:null,'attributes':_0x2f6ba7[_0x938f('0x18')]?_0x2f6ba7[_0x938f('0x18')]['attributes']||null:null,'limit':_0x2f6ba7[_0x938f('0x18')]?_0x2f6ba7[_0x938f('0x18')][_0x938f('0x1c')]||null:null})[_0x938f('0x9')](function(_0x2c5d38){logger[_0x938f('0xa')](_0x938f('0x1d'),_0x2f6ba7);logger[_0x938f('0xd')](_0x938f('0x1d'),_0x2f6ba7,JSON[_0x938f('0xe')](_0x2c5d38));_0x230375(_0x2c5d38);})[_0x938f('0x13')](function(_0x1c160b){logger[_0x938f('0xf')]('UpdateChatQueueReport',_0x1c160b['message'],_0x2f6ba7);_0x9e1cc8(_0x52e0d['error'](0x1f4,_0x1c160b['message']));});});}; \ No newline at end of file +var _0x3e33=['update','raw','attributes','lodash','moment','ioredis','../../mysqldb','jayson/promise','client','http','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','then','UpdateChatQueueReport'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x3e33,0x137));var _0x33e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e33[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x33e3('0x0'));var util=require('util');var moment=require(_0x33e3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x33e3('0x2'));var db=require(_0x33e3('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x33e3('0x4'));var client=jayson[_0x33e3('0x5')][_0x33e3('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2130d4,_0x424308,_0x36da59){return new BPromise(function(_0x1c0172,_0xca0d90){return client[_0x33e3('0x7')](_0x2130d4,_0x36da59)['then'](function(_0x1e5673){logger[_0x33e3('0x8')](_0x33e3('0x9'),_0x424308,_0x33e3('0xa'));logger[_0x33e3('0xb')](_0x33e3('0xc'),_0x424308,_0x33e3('0xa'),JSON[_0x33e3('0xd')](_0x1e5673));if(_0x1e5673[_0x33e3('0xe')]){if(_0x1e5673['error'][_0x33e3('0xf')]===0x1f4){logger['error'](_0x33e3('0x9'),_0x424308,_0x1e5673['error'][_0x33e3('0x10')]);return _0xca0d90(_0x1e5673[_0x33e3('0xe')]['message']);}logger[_0x33e3('0xe')](_0x33e3('0x9'),_0x424308,_0x1e5673[_0x33e3('0xe')]['message']);return _0x1c0172(_0x1e5673[_0x33e3('0xe')][_0x33e3('0x10')]);}else{logger[_0x33e3('0x8')](_0x33e3('0x9'),_0x424308,_0x33e3('0xa'));_0x1c0172(_0x1e5673['result']['message']);}})[_0x33e3('0x11')](function(_0x4d3346){logger[_0x33e3('0xe')](_0x33e3('0x9'),_0x424308,_0x4d3346);_0xca0d90(_0x4d3346);});});}exports[_0x33e3('0x12')]=function(_0x14790c){var _0x2163c2=this;return new Promise(function(_0x131efe,_0x30d8f2){return db[_0x33e3('0x13')][_0x33e3('0x14')](_0x14790c[_0x33e3('0x15')],{'raw':_0x14790c[_0x33e3('0x16')]?_0x14790c['options']['raw']===undefined?!![]:![]:!![]})[_0x33e3('0x17')](function(_0x43e0b4){logger[_0x33e3('0x8')](_0x33e3('0x12'),_0x14790c);logger[_0x33e3('0xb')]('CreateChatQueueReport',_0x14790c,JSON['stringify'](_0x43e0b4));_0x131efe(_0x43e0b4);})[_0x33e3('0x11')](function(_0x27433a){logger[_0x33e3('0xe')](_0x33e3('0x12'),_0x27433a['message'],_0x14790c);_0x30d8f2(_0x2163c2['error'](0x1f4,_0x27433a[_0x33e3('0x10')]));});});};exports[_0x33e3('0x18')]=function(_0x2e1809){var _0x45830c=this;return new Promise(function(_0xafcf15,_0x2c5fd){return db['ChatQueueReport'][_0x33e3('0x19')](_0x2e1809[_0x33e3('0x15')],{'raw':_0x2e1809[_0x33e3('0x16')]?_0x2e1809[_0x33e3('0x16')][_0x33e3('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e1809[_0x33e3('0x16')]?_0x2e1809[_0x33e3('0x16')]['where']||null:null,'attributes':_0x2e1809[_0x33e3('0x16')]?_0x2e1809[_0x33e3('0x16')][_0x33e3('0x1b')]||null:null,'limit':_0x2e1809['options']?_0x2e1809[_0x33e3('0x16')]['limit']||null:null})[_0x33e3('0x17')](function(_0x4ff5c1){logger['info'](_0x33e3('0x18'),_0x2e1809);logger[_0x33e3('0xb')](_0x33e3('0x18'),_0x2e1809,JSON[_0x33e3('0xd')](_0x4ff5c1));_0xafcf15(_0x4ff5c1);})[_0x33e3('0x11')](function(_0x36344c){logger['error']('UpdateChatQueueReport',_0x36344c[_0x33e3('0x10')],_0x2e1809);_0x2c5fd(_0x45830c[_0x33e3('0xe')](0x1f4,_0x36344c[_0x33e3('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 867b453..3bad156 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 _0x4f52=['express','Router','../../components/interaction/service','./chatQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x5a3737,_0x3bf296){var _0x1e7fb8=function(_0x372a18){while(--_0x372a18){_0x5a3737['push'](_0x5a3737['shift']());}};_0x1e7fb8(++_0x3bf296);}(_0x4f52,0x6f));var _0x24f5=function(_0x201153,_0x1db225){_0x201153=_0x201153-0x0;var _0x3a2a8e=_0x4f52[_0x201153];return _0x3a2a8e;};'use strict';var multer=require(_0x24f5('0x0'));var util=require(_0x24f5('0x1'));var path=require('path');var timeout=require(_0x24f5('0x2'));var express=require(_0x24f5('0x3'));var router=express[_0x24f5('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x24f5('0x5'));var config=require('../../config/environment');var controller=require(_0x24f5('0x6'));router[_0x24f5('0x7')]('/',auth[_0x24f5('0x8')](),controller[_0x24f5('0x9')]);router['get'](_0x24f5('0xa'),auth[_0x24f5('0x8')](),controller['describe']);router['get'](_0x24f5('0xb'),auth[_0x24f5('0x8')](),controller[_0x24f5('0xc')]);router[_0x24f5('0xd')]('/',auth[_0x24f5('0x8')](),controller[_0x24f5('0xe')]);router[_0x24f5('0xf')]('/:id',auth[_0x24f5('0x8')](),controller[_0x24f5('0x10')]);router[_0x24f5('0x11')](_0x24f5('0xb'),auth['isAuthenticated'](),controller[_0x24f5('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4b82=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','describe','/:id','post','put','update'];(function(_0x305955,_0x5a1de6){var _0x1537d9=function(_0x56e472){while(--_0x56e472){_0x305955['push'](_0x305955['shift']());}};_0x1537d9(++_0x5a1de6);}(_0x4b82,0x96));var _0x24b8=function(_0x14f458,_0x5dd219){_0x14f458=_0x14f458-0x0;var _0x4ff2da=_0x4b82[_0x14f458];return _0x4ff2da;};'use strict';var multer=require(_0x24b8('0x0'));var util=require(_0x24b8('0x1'));var path=require(_0x24b8('0x2'));var timeout=require(_0x24b8('0x3'));var express=require('express');var router=express[_0x24b8('0x4')]();var fs_extra=require(_0x24b8('0x5'));var auth=require(_0x24b8('0x6'));var interaction=require(_0x24b8('0x7'));var config=require(_0x24b8('0x8'));var controller=require(_0x24b8('0x9'));router[_0x24b8('0xa')]('/',auth[_0x24b8('0xb')](),controller[_0x24b8('0xc')]);router[_0x24b8('0xa')]('/describe',auth[_0x24b8('0xb')](),controller[_0x24b8('0xd')]);router[_0x24b8('0xa')](_0x24b8('0xe'),auth[_0x24b8('0xb')](),controller['show']);router[_0x24b8('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x24b8('0x10')]('/:id',auth[_0x24b8('0xb')](),controller[_0x24b8('0x11')]);router[_0x24b8('0x12')](_0x24b8('0xe'),auth['isAuthenticated'](),controller[_0x24b8('0x13')]);module[_0x24b8('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 5ef1499..a8cdee5 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x5af89d,_0xa40ecd){var _0x44e390=function(_0x296473){while(--_0x296473){_0x5af89d['push'](_0x5af89d['shift']());}};_0x44e390(++_0xa40ecd);}(_0x34e8,0x12c));var _0x834e=function(_0x40dd6a,_0x15332f){_0x40dd6a=_0x40dd6a-0x0;var _0x2be2fa=_0x34e8[_0x40dd6a];return _0x2be2fa;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x191154,_0x56f74c){var _0x3dcd73=function(_0x51c321){while(--_0x51c321){_0x191154['push'](_0x191154['shift']());}};_0x3dcd73(++_0x56f74c);}(_0x9bde,0xe1));var _0xe9bd=function(_0x505be8,_0x40a716){_0x505be8=_0x505be8-0x0;var _0x1ce96b=_0x9bde[_0x505be8];return _0x1ce96b;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 3980c83..182f6d7 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 _0xfe44=['name','index','fieldName','key','model','keys','query','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','map','type','VIRTUAL','options','includeAll','include','ChatTransferReport','findAll','rows','catch','show','rawAttributes','length','find','create','body','params','destroy','describe','eml-format','rimraf','fast-json-patch','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','limit','count','offset','set','Content-Range','json','reject','save','update','then','end','stack'];(function(_0x8c567e,_0x21c0c2){var _0xed00f0=function(_0x3bd9ab){while(--_0x3bd9ab){_0x8c567e['push'](_0x8c567e['shift']());}};_0xed00f0(++_0x21c0c2);}(_0xfe44,0x1b5));var _0x4fe4=function(_0x2b547d,_0x39b277){_0x2b547d=_0x2b547d-0x0;var _0x29caaa=_0xfe44[_0x2b547d];return _0x29caaa;};'use strict';var emlformat=require(_0x4fe4('0x0'));var rimraf=require(_0x4fe4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4fe4('0x2'));var rp=require(_0x4fe4('0x3'));var moment=require(_0x4fe4('0x4'));var BPromise=require(_0x4fe4('0x5'));var Mustache=require(_0x4fe4('0x6'));var util=require(_0x4fe4('0x7'));var path=require(_0x4fe4('0x8'));var sox=require(_0x4fe4('0x9'));var csv=require(_0x4fe4('0xa'));var ejs=require(_0x4fe4('0xb'));var fs=require('fs');var fs_extra=require(_0x4fe4('0xc'));var _=require(_0x4fe4('0xd'));var squel=require(_0x4fe4('0xe'));var crypto=require(_0x4fe4('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x4fe4('0x10'));var toCsv=require(_0x4fe4('0xa'));var querystring=require(_0x4fe4('0x11'));var Papa=require('papaparse');var Redis=require(_0x4fe4('0x12'));var authService=require(_0x4fe4('0x13'));var qs=require(_0x4fe4('0x14'));var as=require(_0x4fe4('0x15'));var hardwareService=require(_0x4fe4('0x16'));var logger=require(_0x4fe4('0x17'))(_0x4fe4('0x18'));var utils=require(_0x4fe4('0x19'));var config=require(_0x4fe4('0x1a'));var licenseUtil=require(_0x4fe4('0x1b'));var db=require(_0x4fe4('0x1c'))['db'];function respondWithStatusCode(_0x482105,_0x447594){_0x447594=_0x447594||0xcc;return function(_0x48ba45){if(_0x48ba45){return _0x482105[_0x4fe4('0x1d')](_0x447594);}return _0x482105[_0x4fe4('0x1e')](_0x447594)['end']();};}function respondWithResult(_0x2144f7,_0x2cbc62){_0x2cbc62=_0x2cbc62||0xc8;return function(_0x2a8071){if(_0x2a8071){return _0x2144f7[_0x4fe4('0x1e')](_0x2cbc62)['json'](_0x2a8071);}};}function respondWithFilteredResult(_0x18a6e5,_0x444c97){return function(_0x407b08){if(_0x407b08){var _0xe7d24c=typeof _0x444c97['offset']==='undefined'&&typeof _0x444c97[_0x4fe4('0x1f')]==='undefined';var _0x3aac75=_0x407b08[_0x4fe4('0x20')];var _0x22cae7=_0xe7d24c?0x0:_0x444c97[_0x4fe4('0x21')];var _0x502984=_0xe7d24c?_0x407b08[_0x4fe4('0x20')]:_0x444c97[_0x4fe4('0x21')]+_0x444c97[_0x4fe4('0x1f')];var _0x14a108;if(_0x502984>=_0x3aac75){_0x502984=_0x3aac75;_0x14a108=0xc8;}else{_0x14a108=0xce;}_0x18a6e5[_0x4fe4('0x1e')](_0x14a108);return _0x18a6e5[_0x4fe4('0x22')](_0x4fe4('0x23'),_0x22cae7+'-'+_0x502984+'/'+_0x3aac75)[_0x4fe4('0x24')](_0x407b08);}return null;};}function patchUpdates(_0x3f3932){return function(_0x328bd5){try{jsonpatch['apply'](_0x328bd5,_0x3f3932,!![]);}catch(_0x2645d2){return BPromise[_0x4fe4('0x25')](_0x2645d2);}return _0x328bd5[_0x4fe4('0x26')]();};}function saveUpdates(_0x48dd21,_0x474ec9){return function(_0xf045e3){if(_0xf045e3){return _0xf045e3[_0x4fe4('0x27')](_0x48dd21)[_0x4fe4('0x28')](function(_0x13660b){return _0x13660b;});}return null;};}function removeEntity(_0x22f27e,_0x19fb6e){return function(_0x2efcf7){if(_0x2efcf7){return _0x2efcf7['destroy']()[_0x4fe4('0x28')](function(){_0x22f27e[_0x4fe4('0x1e')](0xcc)[_0x4fe4('0x29')]();});}};}function handleEntityNotFound(_0x1e91cc,_0x661622){return function(_0x45a6e2){if(!_0x45a6e2){_0x1e91cc[_0x4fe4('0x1d')](0x194);}return _0x45a6e2;};}function handleError(_0x16464c,_0x59051f){_0x59051f=_0x59051f||0x1f4;return function(_0x45c466){logger['error'](_0x45c466[_0x4fe4('0x2a')]);if(_0x45c466[_0x4fe4('0x2b')]){delete _0x45c466[_0x4fe4('0x2b')];}_0x16464c[_0x4fe4('0x1e')](_0x59051f)['send'](_0x45c466);};}exports[_0x4fe4('0x2c')]=function(_0x1f58bf,_0x440571){var _0x2059ee={},_0x44cd7f={},_0x2b19ec={'count':0x0,'rows':[]};var _0x1c72d0=_['map'](db['ChatTransferReport']['rawAttributes'],function(_0x292f35){return{'name':_0x292f35[_0x4fe4('0x2d')],'type':_0x292f35['type'][_0x4fe4('0x2e')]};});_0x44cd7f[_0x4fe4('0x2f')]=_['map'](_0x1c72d0,'name');_0x44cd7f['query']=_[_0x4fe4('0x30')](_0x1f58bf[_0x4fe4('0x31')]);_0x44cd7f['filters']=_[_0x4fe4('0x32')](_0x44cd7f[_0x4fe4('0x2f')],_0x44cd7f[_0x4fe4('0x31')]);_0x2059ee[_0x4fe4('0x33')]=_[_0x4fe4('0x32')](_0x44cd7f[_0x4fe4('0x2f')],qs[_0x4fe4('0x34')](_0x1f58bf['query'][_0x4fe4('0x34')]));_0x2059ee[_0x4fe4('0x33')]=_0x2059ee[_0x4fe4('0x33')]['length']?_0x2059ee[_0x4fe4('0x33')]:_0x44cd7f[_0x4fe4('0x2f')];if(!_0x1f58bf[_0x4fe4('0x31')]['hasOwnProperty'](_0x4fe4('0x35'))){_0x2059ee[_0x4fe4('0x1f')]=qs[_0x4fe4('0x1f')](_0x1f58bf['query'][_0x4fe4('0x1f')]);_0x2059ee['offset']=qs[_0x4fe4('0x21')](_0x1f58bf['query'][_0x4fe4('0x21')]);}_0x2059ee[_0x4fe4('0x36')]=qs[_0x4fe4('0x37')](_0x1f58bf[_0x4fe4('0x31')][_0x4fe4('0x37')]);_0x2059ee[_0x4fe4('0x38')]=qs[_0x4fe4('0x39')](_[_0x4fe4('0x3a')](_0x1f58bf[_0x4fe4('0x31')],_0x44cd7f['filters']),_0x1c72d0);if(_0x1f58bf['query'][_0x4fe4('0x3b')]){_0x2059ee[_0x4fe4('0x38')]=_[_0x4fe4('0x3c')](_0x2059ee['where'],{'$or':_[_0x4fe4('0x3d')](_0x1c72d0,function(_0x1ba478){if(_0x1ba478[_0x4fe4('0x3e')]!==_0x4fe4('0x3f')){var _0x39bf1c={};_0x39bf1c[_0x1ba478[_0x4fe4('0x2b')]]={'$like':'%'+_0x1f58bf[_0x4fe4('0x31')][_0x4fe4('0x3b')]+'%'};return _0x39bf1c;}})});}_0x2059ee=_['merge']({},_0x2059ee,_0x1f58bf[_0x4fe4('0x40')]);var _0x52cda0={'where':_0x2059ee[_0x4fe4('0x38')]};return db['ChatTransferReport'][_0x4fe4('0x20')](_0x52cda0)[_0x4fe4('0x28')](function(_0x11d72b){_0x2b19ec[_0x4fe4('0x20')]=_0x11d72b;if(_0x1f58bf[_0x4fe4('0x31')][_0x4fe4('0x41')]){_0x2059ee[_0x4fe4('0x42')]=[{'all':!![]}];}return db[_0x4fe4('0x43')][_0x4fe4('0x44')](_0x2059ee);})[_0x4fe4('0x28')](function(_0xaab45){_0x2b19ec[_0x4fe4('0x45')]=_0xaab45;return _0x2b19ec;})[_0x4fe4('0x28')](respondWithFilteredResult(_0x440571,_0x2059ee))[_0x4fe4('0x46')](handleError(_0x440571,null));};exports[_0x4fe4('0x47')]=function(_0x5b64b4,_0x32117f){var _0x479003={'raw':!![],'where':{'id':_0x5b64b4['params']['id']}},_0x4db113={};_0x4db113[_0x4fe4('0x2f')]=_['keys'](db[_0x4fe4('0x43')][_0x4fe4('0x48')]);_0x4db113[_0x4fe4('0x31')]=_['keys'](_0x5b64b4[_0x4fe4('0x31')]);_0x4db113[_0x4fe4('0x39')]=_[_0x4fe4('0x32')](_0x4db113['model'],_0x4db113['query']);_0x479003[_0x4fe4('0x33')]=_[_0x4fe4('0x32')](_0x4db113['model'],qs[_0x4fe4('0x34')](_0x5b64b4[_0x4fe4('0x31')]['fields']));_0x479003['attributes']=_0x479003[_0x4fe4('0x33')][_0x4fe4('0x49')]?_0x479003[_0x4fe4('0x33')]:_0x4db113[_0x4fe4('0x2f')];if(_0x5b64b4[_0x4fe4('0x31')][_0x4fe4('0x41')]){_0x479003[_0x4fe4('0x42')]=[{'all':!![]}];}_0x479003=_[_0x4fe4('0x3c')]({},_0x479003,_0x5b64b4[_0x4fe4('0x40')]);return db[_0x4fe4('0x43')][_0x4fe4('0x4a')](_0x479003)['then'](handleEntityNotFound(_0x32117f,null))[_0x4fe4('0x28')](respondWithResult(_0x32117f,null))[_0x4fe4('0x46')](handleError(_0x32117f,null));};exports[_0x4fe4('0x4b')]=function(_0x216193,_0x55daf5){return db[_0x4fe4('0x43')][_0x4fe4('0x4b')](_0x216193[_0x4fe4('0x4c')],{})[_0x4fe4('0x28')](respondWithResult(_0x55daf5,0xc9))[_0x4fe4('0x46')](handleError(_0x55daf5,null));};exports['update']=function(_0x19a27c,_0x47bfb7){if(_0x19a27c[_0x4fe4('0x4c')]['id']){delete _0x19a27c[_0x4fe4('0x4c')]['id'];}return db['ChatTransferReport'][_0x4fe4('0x4a')]({'where':{'id':_0x19a27c[_0x4fe4('0x4d')]['id']}})[_0x4fe4('0x28')](handleEntityNotFound(_0x47bfb7,null))[_0x4fe4('0x28')](saveUpdates(_0x19a27c[_0x4fe4('0x4c')],null))[_0x4fe4('0x28')](respondWithResult(_0x47bfb7,null))[_0x4fe4('0x46')](handleError(_0x47bfb7,null));};exports[_0x4fe4('0x4e')]=function(_0x16765d,_0x5cde39){return db[_0x4fe4('0x43')][_0x4fe4('0x4a')]({'where':{'id':_0x16765d[_0x4fe4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5cde39,null))['then'](removeEntity(_0x5cde39,null))['catch'](handleError(_0x5cde39,null));};exports[_0x4fe4('0x4f')]=function(_0x1e7780,_0x39076d){return db[_0x4fe4('0x43')]['describe']()[_0x4fe4('0x28')](respondWithResult(_0x39076d,null))[_0x4fe4('0x46')](handleError(_0x39076d,null));}; \ No newline at end of file +var _0x2f32=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','offset','undefined','count','limit','Content-Range','json','reject','then','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x5846b6,_0x299729){var _0x5b4ba4=function(_0x50357f){while(--_0x50357f){_0x5846b6['push'](_0x5846b6['shift']());}};_0x5b4ba4(++_0x299729);}(_0x2f32,0x1e4));var _0x22f3=function(_0xf2f74d,_0x367ade){_0xf2f74d=_0xf2f74d-0x0;var _0x198808=_0x2f32[_0xf2f74d];return _0x198808;};'use strict';var emlformat=require(_0x22f3('0x0'));var rimraf=require(_0x22f3('0x1'));var zipdir=require(_0x22f3('0x2'));var jsonpatch=require(_0x22f3('0x3'));var rp=require(_0x22f3('0x4'));var moment=require(_0x22f3('0x5'));var BPromise=require(_0x22f3('0x6'));var Mustache=require(_0x22f3('0x7'));var util=require(_0x22f3('0x8'));var path=require('path');var sox=require(_0x22f3('0x9'));var csv=require(_0x22f3('0xa'));var ejs=require(_0x22f3('0xb'));var fs=require('fs');var fs_extra=require(_0x22f3('0xc'));var _=require(_0x22f3('0xd'));var squel=require(_0x22f3('0xe'));var crypto=require(_0x22f3('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x22f3('0x10'));var toCsv=require(_0x22f3('0xa'));var querystring=require(_0x22f3('0x11'));var Papa=require(_0x22f3('0x12'));var Redis=require(_0x22f3('0x13'));var authService=require(_0x22f3('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x22f3('0x15'))(_0x22f3('0x16'));var utils=require(_0x22f3('0x17'));var config=require(_0x22f3('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x22f3('0x19'))['db'];function respondWithStatusCode(_0x342823,_0x349006){_0x349006=_0x349006||0xcc;return function(_0x354039){if(_0x354039){return _0x342823['sendStatus'](_0x349006);}return _0x342823['status'](_0x349006)[_0x22f3('0x1a')]();};}function respondWithResult(_0x3e53a6,_0x1e1b12){_0x1e1b12=_0x1e1b12||0xc8;return function(_0x3029e0){if(_0x3029e0){return _0x3e53a6[_0x22f3('0x1b')](_0x1e1b12)['json'](_0x3029e0);}};}function respondWithFilteredResult(_0x576a10,_0x1d88fb){return function(_0x471250){if(_0x471250){var _0x516ce3=typeof _0x1d88fb[_0x22f3('0x1c')]==='undefined'&&typeof _0x1d88fb['limit']===_0x22f3('0x1d');var _0x16d944=_0x471250[_0x22f3('0x1e')];var _0x7bd3ad=_0x516ce3?0x0:_0x1d88fb[_0x22f3('0x1c')];var _0x47ea43=_0x516ce3?_0x471250[_0x22f3('0x1e')]:_0x1d88fb[_0x22f3('0x1c')]+_0x1d88fb[_0x22f3('0x1f')];var _0x34236a;if(_0x47ea43>=_0x16d944){_0x47ea43=_0x16d944;_0x34236a=0xc8;}else{_0x34236a=0xce;}_0x576a10[_0x22f3('0x1b')](_0x34236a);return _0x576a10['set'](_0x22f3('0x20'),_0x7bd3ad+'-'+_0x47ea43+'/'+_0x16d944)[_0x22f3('0x21')](_0x471250);}return null;};}function patchUpdates(_0x5ef328){return function(_0x57c0ce){try{jsonpatch['apply'](_0x57c0ce,_0x5ef328,!![]);}catch(_0x5ab00f){return BPromise[_0x22f3('0x22')](_0x5ab00f);}return _0x57c0ce['save']();};}function saveUpdates(_0x16a028,_0x1d31b4){return function(_0x17a54a){if(_0x17a54a){return _0x17a54a['update'](_0x16a028)['then'](function(_0x42c7f6){return _0x42c7f6;});}return null;};}function removeEntity(_0x40bd22,_0x4a332e){return function(_0x7bd69f){if(_0x7bd69f){return _0x7bd69f['destroy']()[_0x22f3('0x23')](function(){_0x40bd22[_0x22f3('0x1b')](0xcc)[_0x22f3('0x1a')]();});}};}function handleEntityNotFound(_0x5dc27a,_0xcf7470){return function(_0x27ccd5){if(!_0x27ccd5){_0x5dc27a['sendStatus'](0x194);}return _0x27ccd5;};}function handleError(_0x5f29b2,_0x25c2a1){_0x25c2a1=_0x25c2a1||0x1f4;return function(_0x2161ef){logger[_0x22f3('0x24')](_0x2161ef[_0x22f3('0x25')]);if(_0x2161ef[_0x22f3('0x26')]){delete _0x2161ef[_0x22f3('0x26')];}_0x5f29b2['status'](_0x25c2a1)[_0x22f3('0x27')](_0x2161ef);};}exports[_0x22f3('0x28')]=function(_0x3fcf5b,_0x47e9a3){var _0x1425cd={},_0x2954c2={},_0x58fe75={'count':0x0,'rows':[]};var _0x53851c=_[_0x22f3('0x29')](db[_0x22f3('0x2a')][_0x22f3('0x2b')],function(_0x39e739){return{'name':_0x39e739[_0x22f3('0x2c')],'type':_0x39e739[_0x22f3('0x2d')][_0x22f3('0x2e')]};});_0x2954c2[_0x22f3('0x2f')]=_['map'](_0x53851c,'name');_0x2954c2[_0x22f3('0x30')]=_[_0x22f3('0x31')](_0x3fcf5b[_0x22f3('0x30')]);_0x2954c2[_0x22f3('0x32')]=_[_0x22f3('0x33')](_0x2954c2[_0x22f3('0x2f')],_0x2954c2[_0x22f3('0x30')]);_0x1425cd[_0x22f3('0x34')]=_['intersection'](_0x2954c2[_0x22f3('0x2f')],qs[_0x22f3('0x35')](_0x3fcf5b[_0x22f3('0x30')]['fields']));_0x1425cd[_0x22f3('0x34')]=_0x1425cd[_0x22f3('0x34')][_0x22f3('0x36')]?_0x1425cd['attributes']:_0x2954c2['model'];if(!_0x3fcf5b['query'][_0x22f3('0x37')](_0x22f3('0x38'))){_0x1425cd[_0x22f3('0x1f')]=qs[_0x22f3('0x1f')](_0x3fcf5b[_0x22f3('0x30')]['limit']);_0x1425cd[_0x22f3('0x1c')]=qs[_0x22f3('0x1c')](_0x3fcf5b[_0x22f3('0x30')][_0x22f3('0x1c')]);}_0x1425cd[_0x22f3('0x39')]=qs[_0x22f3('0x3a')](_0x3fcf5b['query']['sort']);_0x1425cd[_0x22f3('0x3b')]=qs[_0x22f3('0x32')](_[_0x22f3('0x3c')](_0x3fcf5b['query'],_0x2954c2[_0x22f3('0x32')]),_0x53851c);if(_0x3fcf5b[_0x22f3('0x30')][_0x22f3('0x3d')]){_0x1425cd[_0x22f3('0x3b')]=_[_0x22f3('0x3e')](_0x1425cd[_0x22f3('0x3b')],{'$or':_[_0x22f3('0x29')](_0x53851c,function(_0xeb5902){if(_0xeb5902['type']!==_0x22f3('0x3f')){var _0x5c33a6={};_0x5c33a6[_0xeb5902[_0x22f3('0x26')]]={'$like':'%'+_0x3fcf5b[_0x22f3('0x30')][_0x22f3('0x3d')]+'%'};return _0x5c33a6;}})});}_0x1425cd=_[_0x22f3('0x3e')]({},_0x1425cd,_0x3fcf5b[_0x22f3('0x40')]);var _0x55c4f2={'where':_0x1425cd['where']};return db['ChatTransferReport'][_0x22f3('0x1e')](_0x55c4f2)[_0x22f3('0x23')](function(_0x7d2377){_0x58fe75[_0x22f3('0x1e')]=_0x7d2377;if(_0x3fcf5b[_0x22f3('0x30')][_0x22f3('0x41')]){_0x1425cd[_0x22f3('0x42')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x22f3('0x43')](_0x1425cd);})[_0x22f3('0x23')](function(_0x484078){_0x58fe75[_0x22f3('0x44')]=_0x484078;return _0x58fe75;})['then'](respondWithFilteredResult(_0x47e9a3,_0x1425cd))[_0x22f3('0x45')](handleError(_0x47e9a3,null));};exports[_0x22f3('0x46')]=function(_0x10eee0,_0x4c3d82){var _0x21b675={'raw':!![],'where':{'id':_0x10eee0[_0x22f3('0x47')]['id']}},_0x1dfd57={};_0x1dfd57[_0x22f3('0x2f')]=_[_0x22f3('0x31')](db[_0x22f3('0x2a')]['rawAttributes']);_0x1dfd57[_0x22f3('0x30')]=_[_0x22f3('0x31')](_0x10eee0[_0x22f3('0x30')]);_0x1dfd57[_0x22f3('0x32')]=_[_0x22f3('0x33')](_0x1dfd57[_0x22f3('0x2f')],_0x1dfd57[_0x22f3('0x30')]);_0x21b675[_0x22f3('0x34')]=_[_0x22f3('0x33')](_0x1dfd57[_0x22f3('0x2f')],qs[_0x22f3('0x35')](_0x10eee0['query'][_0x22f3('0x35')]));_0x21b675[_0x22f3('0x34')]=_0x21b675[_0x22f3('0x34')][_0x22f3('0x36')]?_0x21b675[_0x22f3('0x34')]:_0x1dfd57[_0x22f3('0x2f')];if(_0x10eee0[_0x22f3('0x30')][_0x22f3('0x41')]){_0x21b675[_0x22f3('0x42')]=[{'all':!![]}];}_0x21b675=_[_0x22f3('0x3e')]({},_0x21b675,_0x10eee0[_0x22f3('0x40')]);return db[_0x22f3('0x2a')][_0x22f3('0x48')](_0x21b675)[_0x22f3('0x23')](handleEntityNotFound(_0x4c3d82,null))[_0x22f3('0x23')](respondWithResult(_0x4c3d82,null))[_0x22f3('0x45')](handleError(_0x4c3d82,null));};exports[_0x22f3('0x49')]=function(_0x15ba90,_0x984cad){return db[_0x22f3('0x2a')]['create'](_0x15ba90[_0x22f3('0x4a')],{})['then'](respondWithResult(_0x984cad,0xc9))['catch'](handleError(_0x984cad,null));};exports[_0x22f3('0x4b')]=function(_0x2d3b61,_0x4501e8){if(_0x2d3b61[_0x22f3('0x4a')]['id']){delete _0x2d3b61[_0x22f3('0x4a')]['id'];}return db[_0x22f3('0x2a')]['find']({'where':{'id':_0x2d3b61['params']['id']}})[_0x22f3('0x23')](handleEntityNotFound(_0x4501e8,null))[_0x22f3('0x23')](saveUpdates(_0x2d3b61[_0x22f3('0x4a')],null))[_0x22f3('0x23')](respondWithResult(_0x4501e8,null))[_0x22f3('0x45')](handleError(_0x4501e8,null));};exports[_0x22f3('0x4c')]=function(_0x7767ce,_0x91ee9f){return db['ChatTransferReport'][_0x22f3('0x48')]({'where':{'id':_0x7767ce[_0x22f3('0x47')]['id']}})[_0x22f3('0x23')](handleEntityNotFound(_0x91ee9f,null))[_0x22f3('0x23')](removeEntity(_0x91ee9f,null))[_0x22f3('0x45')](handleError(_0x91ee9f,null));};exports[_0x22f3('0x4d')]=function(_0x1f8afe,_0x191307){return db['ChatTransferReport'][_0x22f3('0x4d')]()['then'](respondWithResult(_0x191307,null))[_0x22f3('0x45')](handleError(_0x191307,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 5555bc3..3eeffa2 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 _0x0949=['request-promise','path','rimraf','exports','report_chat_transfer','lodash','util','../../config/logger','api'];(function(_0x18bfa5,_0x27f81c){var _0x43863d=function(_0x3cfb6b){while(--_0x3cfb6b){_0x18bfa5['push'](_0x18bfa5['shift']());}};_0x43863d(++_0x27f81c);}(_0x0949,0x1d9));var _0x9094=function(_0x4147e6,_0x57174e){_0x4147e6=_0x4147e6-0x0;var _0x3305ba=_0x0949[_0x4147e6];return _0x3305ba;};'use strict';var _=require(_0x9094('0x0'));var util=require(_0x9094('0x1'));var logger=require(_0x9094('0x2'))(_0x9094('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9094('0x4'));var fs=require('fs');var path=require(_0x9094('0x5'));var rimraf=require(_0x9094('0x6'));var config=require('../../config/environment');var attributes=require('./chatTransferReport.attributes');module[_0x9094('0x7')]=function(_0x4af324,_0x512e07){return _0x4af324['define']('ChatTransferReport',attributes,{'tableName':_0x9094('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9de1=['ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x9de1,0x1e4));var _0x19de=function(_0x5e53be,_0x28ffa5){_0x5e53be=_0x5e53be-0x0;var _0x370496=_0x9de1[_0x5e53be];return _0x370496;};'use strict';var _=require(_0x19de('0x0'));var util=require(_0x19de('0x1'));var logger=require(_0x19de('0x2'))('api');var moment=require('moment');var BPromise=require(_0x19de('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x19de('0x4'));var rimraf=require(_0x19de('0x5'));var config=require(_0x19de('0x6'));var attributes=require(_0x19de('0x7'));module[_0x19de('0x8')]=function(_0x42448c,_0x5d785f){return _0x42448c[_0x19de('0x9')](_0x19de('0xa'),attributes,{'tableName':_0x19de('0xb'),'paranoid':![],'indexes':[{'name':_0x19de('0xc'),'fields':[_0x19de('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 5c608bf..1dac510 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 _0xee33=['debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','result','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x3bf120,_0x5eafe4){var _0x3b71ad=function(_0x2f7e83){while(--_0x2f7e83){_0x3bf120['push'](_0x3bf120['shift']());}};_0x3b71ad(++_0x5eafe4);}(_0xee33,0x1e1));var _0x3ee3=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xee33[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3ee3('0x0'));var BPromise=require('bluebird');var rs=require(_0x3ee3('0x1'));var fs=require('fs');var Redis=require(_0x3ee3('0x2'));var db=require(_0x3ee3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3ee3('0x4'))(_0x3ee3('0x5'));var config=require(_0x3ee3('0x6'));var jayson=require(_0x3ee3('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x597cba,_0x3679f8,_0x5e3126){return new BPromise(function(_0x5dd804,_0xe98a1){return client[_0x3ee3('0x8')](_0x597cba,_0x5e3126)[_0x3ee3('0x9')](function(_0x1b99c7){logger[_0x3ee3('0xa')](_0x3ee3('0xb'),_0x3679f8,_0x3ee3('0xc'));logger[_0x3ee3('0xd')](_0x3ee3('0xe'),_0x3679f8,_0x3ee3('0xc'),JSON['stringify'](_0x1b99c7));if(_0x1b99c7['error']){if(_0x1b99c7['error'][_0x3ee3('0xf')]===0x1f4){logger[_0x3ee3('0x10')](_0x3ee3('0xb'),_0x3679f8,_0x1b99c7[_0x3ee3('0x10')][_0x3ee3('0x11')]);return _0xe98a1(_0x1b99c7[_0x3ee3('0x10')][_0x3ee3('0x11')]);}logger[_0x3ee3('0x10')](_0x3ee3('0xb'),_0x3679f8,_0x1b99c7[_0x3ee3('0x10')][_0x3ee3('0x11')]);return _0x5dd804(_0x1b99c7[_0x3ee3('0x10')]['message']);}else{logger[_0x3ee3('0xa')](_0x3ee3('0xb'),_0x3679f8,_0x3ee3('0xc'));_0x5dd804(_0x1b99c7[_0x3ee3('0x12')][_0x3ee3('0x11')]);}})['catch'](function(_0x2e25fb){logger[_0x3ee3('0x10')](_0x3ee3('0xb'),_0x3679f8,_0x2e25fb);_0xe98a1(_0x2e25fb);});});} \ No newline at end of file +var _0x60d7=['result','catch','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x60d7,0x1ba));var _0x760d=function(_0x279a05,_0x4f5f83){_0x279a05=_0x279a05-0x0;var _0xd0ee7f=_0x60d7[_0x279a05];return _0xd0ee7f;};'use strict';var _=require('lodash');var util=require(_0x760d('0x0'));var moment=require('moment');var BPromise=require(_0x760d('0x1'));var rs=require(_0x760d('0x2'));var fs=require('fs');var Redis=require(_0x760d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x760d('0x4'));var logger=require('../../config/logger')(_0x760d('0x5'));var config=require(_0x760d('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x760d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4408d5,_0x55968a,_0x452e9b){return new BPromise(function(_0x56b31c,_0x52ce7a){return client[_0x760d('0x8')](_0x4408d5,_0x452e9b)[_0x760d('0x9')](function(_0x471e78){logger[_0x760d('0xa')](_0x760d('0xb'),_0x55968a,_0x760d('0xc'));logger[_0x760d('0xd')](_0x760d('0xe'),_0x55968a,'request\x20sent',JSON['stringify'](_0x471e78));if(_0x471e78[_0x760d('0xf')]){if(_0x471e78[_0x760d('0xf')][_0x760d('0x10')]===0x1f4){logger[_0x760d('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x55968a,_0x471e78[_0x760d('0xf')][_0x760d('0x11')]);return _0x52ce7a(_0x471e78[_0x760d('0xf')][_0x760d('0x11')]);}logger[_0x760d('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x55968a,_0x471e78[_0x760d('0xf')][_0x760d('0x11')]);return _0x56b31c(_0x471e78[_0x760d('0xf')][_0x760d('0x11')]);}else{logger[_0x760d('0xa')]('ChatTransferReport,\x20%s,\x20%s',_0x55968a,'request\x20sent');_0x56b31c(_0x471e78[_0x760d('0x12')][_0x760d('0x11')]);}})[_0x760d('0x13')](function(_0x246f0f){logger[_0x760d('0xf')](_0x760d('0xb'),_0x55968a,_0x246f0f);_0x52ce7a(_0x246f0f);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 60296b1..2a014b3 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 _0x1e34=['./chatTransferReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put','update','destroy','exports','multer','util','express','../../components/interaction/service','../../config/environment'];(function(_0x4489f2,_0x1f9128){var _0x5cc527=function(_0x44201f){while(--_0x44201f){_0x4489f2['push'](_0x4489f2['shift']());}};_0x5cc527(++_0x1f9128);}(_0x1e34,0x182));var _0x41e3=function(_0x1fef10,_0x13447d){_0x1fef10=_0x1fef10-0x0;var _0x548cf8=_0x1e34[_0x1fef10];return _0x548cf8;};'use strict';var multer=require(_0x41e3('0x0'));var util=require(_0x41e3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x41e3('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x41e3('0x3'));var config=require(_0x41e3('0x4'));var controller=require(_0x41e3('0x5'));router[_0x41e3('0x6')]('/',auth[_0x41e3('0x7')](),controller[_0x41e3('0x8')]);router[_0x41e3('0x6')]('/describe',auth[_0x41e3('0x7')](),controller[_0x41e3('0x9')]);router[_0x41e3('0x6')](_0x41e3('0xa'),auth[_0x41e3('0x7')](),controller['show']);router[_0x41e3('0xb')]('/',auth['isAuthenticated'](),controller[_0x41e3('0xc')]);router[_0x41e3('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x41e3('0xe')]);router['delete'](_0x41e3('0xa'),auth[_0x41e3('0x7')](),controller[_0x41e3('0xf')]);module[_0x41e3('0x10')]=router; \ No newline at end of file +var _0x655d=['fs-extra','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','describe','show','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x119ce4,_0x225599){var _0x3e8491=function(_0xf7ad08){while(--_0xf7ad08){_0x119ce4['push'](_0x119ce4['shift']());}};_0x3e8491(++_0x225599);}(_0x655d,0xa2));var _0xd655=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x655d[_0x27af45];return _0x18df21;};'use strict';var multer=require(_0xd655('0x0'));var util=require(_0xd655('0x1'));var path=require(_0xd655('0x2'));var timeout=require(_0xd655('0x3'));var express=require(_0xd655('0x4'));var router=express[_0xd655('0x5')]();var fs_extra=require(_0xd655('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd655('0x7'));var config=require(_0xd655('0x8'));var controller=require(_0xd655('0x9'));router[_0xd655('0xa')]('/',auth[_0xd655('0xb')](),controller['index']);router['get']('/describe',auth[_0xd655('0xb')](),controller[_0xd655('0xc')]);router[_0xd655('0xa')]('/:id',auth[_0xd655('0xb')](),controller[_0xd655('0xd')]);router['post']('/',auth[_0xd655('0xb')](),controller[_0xd655('0xe')]);router[_0xd655('0xf')](_0xd655('0x10'),auth[_0xd655('0xb')](),controller[_0xd655('0x11')]);router[_0xd655('0x12')](_0xd655('0x10'),auth['isAuthenticated'](),controller[_0xd655('0x13')]);module[_0xd655('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index f27605c..d917b4e 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 _0xc574=['star','thumb','stringify','input','text','name','getDataValue','onlineForm','parse','textarea','Comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','alternate','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','address','email','Agent','#011F6A','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Feedback'];(function(_0x44b005,_0x51199e){var _0x304f0b=function(_0x5a810e){while(--_0x5a810e){_0x44b005['push'](_0x44b005['shift']());}};_0x304f0b(++_0x51199e);}(_0xc574,0x1a3));var _0x4c57=function(_0x59773b,_0x40b836){_0x59773b=_0x59773b-0x0;var _0x5b16b4=_0xc574[_0x59773b];return _0x5b16b4;};'use strict';var Sequelize=require(_0x4c57('0x0'));var rs=require(_0x4c57('0x1'));module['exports']={'name':{'type':Sequelize[_0x4c57('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x4c57('0x2')],'allowNull':![],'unique':_0x4c57('0x3')},'description':{'type':Sequelize[_0x4c57('0x2')]},'mapKey':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':_0x4c57('0x4')},'mapKeyOffline':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':_0x4c57('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':_0x4c57('0x5')},'customerAlias':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x4c57('0x2')],'allowNull':![],'defaultValue':_0x4c57('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x4c57('0x2')],'allowNull':![],'defaultValue':_0x4c57('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x4c57('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x4c57('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x4c57('0x2')]},'animation':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x4c57('0x9')](_0x4c57('0xa'),'squared'),'defaultValue':_0x4c57('0xa')},'header_online':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':_0x4c57('0xb')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x4c57('0xc')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x4c57('0xd')},'header_offline':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':_0x4c57('0xe')},'download_transcript':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x4c57('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':_0x4c57('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x4c57('0x10')]},'closingQuestion':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':_0x4c57('0x11')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x4c57('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x4c57('0x13')},'noteTitle':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':_0x4c57('0x14')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':_0x4c57('0x15')},'ratingType':{'type':Sequelize['ENUM'](_0x4c57('0x16'),_0x4c57('0x17')),'defaultValue':_0x4c57('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x4c57('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x4c57('0x10')],'defaultValue':function(){return JSON[_0x4c57('0x18')]({'items':[{'type':_0x4c57('0x19'),'variable':null,'config':{'placeholder':'name','type':_0x4c57('0x1a'),'required':!![]},'props':{'title':_0x4c57('0x1b'),'helpText':''}},{'type':_0x4c57('0x19'),'props':{'title':_0x4c57('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x4c57('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x4c57('0x1c')](_0x4c57('0x1d'))?JSON[_0x4c57('0x1e')](this[_0x4c57('0x1c')](_0x4c57('0x1d'))):{};},'set':function(_0x55c7cd){return this['setDataValue'](_0x4c57('0x1d'),JSON[_0x4c57('0x18')](_0x55c7cd));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x4c57('0x18')]({'items':[{'type':_0x4c57('0x19'),'props':{'title':_0x4c57('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x4c57('0x4'),'type':'email'},'variable':null},{'type':_0x4c57('0x1f'),'config':{'placeholder':'Comments'},'props':{'title':_0x4c57('0x20'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x4c57('0x1c')](_0x4c57('0x21'))?JSON[_0x4c57('0x1e')](this['getDataValue'](_0x4c57('0x21'))):{};},'set':function(_0x41118f){return this[_0x4c57('0x22')]('offlineForm',JSON[_0x4c57('0x18')](_0x41118f));}},'token':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':function(){return rs[_0x4c57('0x23')]();}},'autoclose':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':_0x4c57('0x24')},'waitingMessage':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':_0x4c57('0x25')},'offlineMessageBody':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':_0x4c57('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x4c57('0x27')},'skipUnmanaged':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':_0x4c57('0x28')},'sendUnmanaged':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x4c57('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x4c57('0x2')]},'notificationTemplate':{'type':Sequelize[_0x4c57('0x10')],'defaultValue':function(){return _0x4c57('0x29');}},'notificationSound':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':_0x4c57('0x2a')},'verticalAlignment':{'type':Sequelize[_0x4c57('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':_0x4c57('0x2b')},'defaultTitle':{'type':Sequelize[_0x4c57('0x2')]},'customerAvatar':{'type':Sequelize[_0x4c57('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x4c57('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4c57('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4c57('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x4c57('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4c57('0x7')],'comment':_0x4c57('0x2c')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x4c57('0x2d'),'set':function(_0x363d15){if(!_0x363d15)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x4c57('0x22')](_0x4c57('0x2e'),_0x363d15);}},'vidaooEscalation':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x4c57('0x2')]},'vidaooTopic':{'type':Sequelize[_0x4c57('0x2')],'allowNull':![],'defaultValue':_0x4c57('0x2f')},'vidaooNote':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':function(){return _0x4c57('0x30');}},'vidaooMetadata':{'type':Sequelize[_0x4c57('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x4c57('0x10')]}}; \ No newline at end of file +var _0xbef9=['Skip','Feedback','star','TEXT','input','name','text','getDataValue','onlineForm','parse','setDataValue','stringify','Comments','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Send','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','squared','rounded','We\x20are\x20here!','Powered\x20by\x20xCALLY','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xbef9,0x136));var _0x9bef=function(_0x305a4e,_0x2f0c80){_0x305a4e=_0x305a4e-0x0;var _0x32ecd4=_0xbef9[_0x305a4e];return _0x32ecd4;};'use strict';var Sequelize=require(_0x9bef('0x0'));var rs=require(_0x9bef('0x1'));module[_0x9bef('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x9bef('0x3')],'allowNull':![],'unique':_0x9bef('0x4')},'description':{'type':Sequelize[_0x9bef('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x9bef('0x3')],'defaultValue':_0x9bef('0x5')},'key':{'type':Sequelize[_0x9bef('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x9bef('0x3')],'defaultValue':_0x9bef('0x6')},'customerAlias':{'type':Sequelize[_0x9bef('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x9bef('0x3')],'allowNull':![],'defaultValue':_0x9bef('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x9bef('0x3')],'allowNull':![],'defaultValue':_0x9bef('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x9bef('0x3')],'allowNull':![],'defaultValue':_0x9bef('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x9bef('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x9bef('0x3')]},'animation':{'type':Sequelize[_0x9bef('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x9bef('0xb')]('rounded',_0x9bef('0xc')),'defaultValue':_0x9bef('0xd')},'header_online':{'type':Sequelize[_0x9bef('0x3')],'defaultValue':_0x9bef('0xe')},'start_chat_button':{'type':Sequelize[_0x9bef('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x9bef('0x3')],'defaultValue':'Send'},'header_offline':{'type':Sequelize['STRING'],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x9bef('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x9bef('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x9bef('0x3')],'defaultValue':_0x9bef('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x9bef('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x9bef('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x9bef('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x9bef('0x3')],'defaultValue':_0x9bef('0x10')},'noteTitle':{'type':Sequelize[_0x9bef('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x9bef('0x11')},'closingMessage':{'type':Sequelize[_0x9bef('0x3')],'defaultValue':_0x9bef('0x12')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x9bef('0x3')],'defaultValue':_0x9bef('0x13')},'conditionAgreement':{'type':Sequelize[_0x9bef('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x9bef('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x9bef('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x9bef('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x9bef('0x3')],'defaultValue':_0x9bef('0x14')},'ratingType':{'type':Sequelize[_0x9bef('0xb')](_0x9bef('0x15'),'thumb'),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x9bef('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x9bef('0x16')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x9bef('0x17'),'variable':null,'config':{'placeholder':_0x9bef('0x18'),'type':_0x9bef('0x19'),'required':!![]},'props':{'title':_0x9bef('0x18'),'helpText':''}},{'type':_0x9bef('0x17'),'props':{'title':_0x9bef('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x9bef('0x5'),'type':_0x9bef('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x9bef('0x1a')](_0x9bef('0x1b'))?JSON[_0x9bef('0x1c')](this[_0x9bef('0x1a')](_0x9bef('0x1b'))):{};},'set':function(_0x5ea4fc){return this[_0x9bef('0x1d')](_0x9bef('0x1b'),JSON[_0x9bef('0x1e')](_0x5ea4fc));}},'offlineForm':{'type':Sequelize[_0x9bef('0x16')],'defaultValue':function(){return JSON[_0x9bef('0x1e')]({'items':[{'type':_0x9bef('0x17'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x9bef('0x5')},'variable':null},{'type':'textarea','config':{'placeholder':_0x9bef('0x1f')},'props':{'title':_0x9bef('0x1f'),'helpText':_0x9bef('0x20')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x9bef('0x21'))?JSON[_0x9bef('0x1c')](this['getDataValue']('offlineForm')):{};},'set':function(_0x51c5d6){return this['setDataValue'](_0x9bef('0x21'),JSON[_0x9bef('0x1e')](_0x51c5d6));}},'token':{'type':Sequelize[_0x9bef('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x9bef('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x9bef('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x9bef('0x3')]},'forwardOffline':{'type':Sequelize[_0x9bef('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x9bef('0x3')]},'waitingTitle':{'type':Sequelize[_0x9bef('0x3')],'defaultValue':_0x9bef('0x22')},'waitingMessage':{'type':Sequelize[_0x9bef('0x3')],'defaultValue':_0x9bef('0x23')},'offlineMessageSubject':{'type':Sequelize[_0x9bef('0x3')],'defaultValue':_0x9bef('0x24')},'offlineMessageBody':{'type':Sequelize[_0x9bef('0x3')],'defaultValue':_0x9bef('0x25')},'enableUnmanagedNote':{'type':Sequelize[_0x9bef('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x9bef('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x9bef('0x26')},'enableCustomerAttachment':{'type':Sequelize[_0x9bef('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x9bef('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x9bef('0x3')]},'notificationTemplate':{'type':Sequelize[_0x9bef('0x16')],'defaultValue':function(){return _0x9bef('0x27');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9bef('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x9bef('0xa')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x9bef('0x3')],'defaultValue':_0x9bef('0x28')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x9bef('0x29')},'verticalAlignment':{'type':Sequelize[_0x9bef('0x9')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x9bef('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x9bef('0x3')]},'customerAvatar':{'type':Sequelize[_0x9bef('0x16')]},'showCustomerAvatar':{'type':Sequelize[_0x9bef('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x9bef('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x9bef('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x9bef('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9bef('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9bef('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9bef('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x9bef('0x2a')},'systemAvatar':{'type':Sequelize[_0x9bef('0x16')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9bef('0x9')],'comment':_0x9bef('0x2b')},'mandatoryDisposition':{'type':Sequelize[_0x9bef('0xa')],'defaultValue':![],'comment':_0x9bef('0x2c'),'set':function(_0x35e1be){if(!_0x35e1be)this[_0x9bef('0x1d')](_0x9bef('0x2d'),null);this[_0x9bef('0x1d')]('mandatoryDisposition',_0x35e1be);}},'vidaooEscalation':{'type':Sequelize[_0x9bef('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x9bef('0x3')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9bef('0x2e')},'vidaooNote':{'type':Sequelize[_0x9bef('0x3')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x9bef('0x16')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x9bef('0x16')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 99fa9c9..aaa79ec 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 _0xf77a=['user-agent','getResult','CmContact','Sequelize','updatedAt','difference','createdAt','CompanyId','ListId','from','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','applications','list','priority','asc','account','contact','customerIp','headers','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','vendor','device','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','unmanaged','AttachmentId','User','UserId','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','notify','offline','files','no\x20available\x20attributes','from\x20is\x20mandatory','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','mapKeyOffline','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','ChatOfflineMessage','mimetype','server','attachments','offline-chat','basename','openNewInteraction','transaction','Attachment','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','user','pass','SendMail','sendMail','offlineMessageSubject','MailAccountId','originalname','subjectOffline','toPairsIn','mapValues','email','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','internal','Tag','Tags','tag','getSnippet','timezone','iftime\x20%s,%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','interval','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','some','server/files/chat/iframe.ejs','remote','x-real-ip','render','verticalAlignment','textColor','color_button','backgroundColor','addApplications','bulkCreate','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./chatWebsite.socket','http','client','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatWebsite,\x20%s,\x20%s','catch','sendStatus','status','end','json','offset','undefined','limit','Content-Range','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','count','includeAll','include','findAll','rows','show','params','ChatWebsite','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','findOne','rawAttributes','length','order','removeDispositions','addAnswer','CannedAnswer','getAnswers','ChatWebsiteId','removeAnswers','ids','addLogo','sitepic','file','filename','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','server/files/images/logos/','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','download','getCustomerAvatar','customerAvatar','showCustomerAvatar','getSystemAvatar','user-agent-parser','setUA'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xf77a,0xa6));var _0xaf77=function(_0x22c1cf,_0x415015){_0x22c1cf=_0x22c1cf-0x0;var _0x3029c1=_0xf77a[_0x22c1cf];return _0x3029c1;};'use strict';var emlformat=require(_0xaf77('0x0'));var rimraf=require(_0xaf77('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaf77('0x2'));var rp=require(_0xaf77('0x3'));var moment=require(_0xaf77('0x4'));var BPromise=require(_0xaf77('0x5'));var Mustache=require(_0xaf77('0x6'));var util=require('util');var path=require('path');var sox=require(_0xaf77('0x7'));var csv=require(_0xaf77('0x8'));var ejs=require(_0xaf77('0x9'));var fs=require('fs');var fs_extra=require(_0xaf77('0xa'));var _=require(_0xaf77('0xb'));var squel=require(_0xaf77('0xc'));var crypto=require(_0xaf77('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xaf77('0xe'));var toCsv=require(_0xaf77('0x8'));var querystring=require(_0xaf77('0xf'));var Papa=require(_0xaf77('0x10'));var Redis=require('ioredis');var authService=require(_0xaf77('0x11'));var qs=require(_0xaf77('0x12'));var as=require(_0xaf77('0x13'));var hardwareService=require(_0xaf77('0x14'));var logger=require(_0xaf77('0x15'))(_0xaf77('0x16'));var utils=require(_0xaf77('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xaf77('0x18'));var db=require(_0xaf77('0x19'))['db'];config['redis']=_[_0xaf77('0x1a')](config[_0xaf77('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xaf77('0x1c'))(new Redis(config[_0xaf77('0x1b')]));require(_0xaf77('0x1d'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xaf77('0x1e')]({'port':0x232c});var client9002=jayson[_0xaf77('0x1f')][_0xaf77('0x1e')]({'port':0x232a});var client9003=jayson[_0xaf77('0x1f')][_0xaf77('0x1e')]({'port':0x232b});var client9001=jayson[_0xaf77('0x1f')][_0xaf77('0x1e')]({'port':0x2329});function respondWithRpcPromise(_0x1ee367,_0x5eb747,_0x2b47e4,_0x117c53){return new BPromise(function(_0x5029c1,_0x263ff4){var _0x17e485=_0x117c53||client;return _0x17e485[_0xaf77('0x20')](_0x1ee367,_0x2b47e4)[_0xaf77('0x21')](function(_0x3707f3){logger[_0xaf77('0x22')]('ChatWebsite,\x20%s,\x20%s',_0x5eb747,_0xaf77('0x23'));logger[_0xaf77('0x24')](_0xaf77('0x25'),_0x5eb747,_0xaf77('0x23'),JSON[_0xaf77('0x26')](_0x3707f3));if(_0x3707f3['error']){if(_0x3707f3[_0xaf77('0x27')][_0xaf77('0x28')]===0x1f4){logger[_0xaf77('0x27')]('ChatWebsite,\x20%s,\x20%s',_0x5eb747,_0x3707f3['error'][_0xaf77('0x29')]);return _0x263ff4(_0x3707f3[_0xaf77('0x27')][_0xaf77('0x29')]);}logger[_0xaf77('0x27')]('ChatWebsite,\x20%s,\x20%s',_0x5eb747,_0x3707f3[_0xaf77('0x27')][_0xaf77('0x29')]);return _0x5029c1(_0x3707f3[_0xaf77('0x27')][_0xaf77('0x29')]);}else{logger[_0xaf77('0x22')](_0xaf77('0x2a'),_0x5eb747,'request\x20sent');_0x5029c1(_0x3707f3['result'][_0xaf77('0x29')]);}})[_0xaf77('0x2b')](function(_0x223cee){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x5eb747,_0x223cee);_0x263ff4(_0x223cee);});});}function respondWithStatusCode(_0x1613ef,_0x5edf16){_0x5edf16=_0x5edf16||0xcc;return function(_0xc4acb7){if(_0xc4acb7){return _0x1613ef[_0xaf77('0x2c')](_0x5edf16);}return _0x1613ef[_0xaf77('0x2d')](_0x5edf16)[_0xaf77('0x2e')]();};}function respondWithResult(_0x1f2935,_0x5d3978){_0x5d3978=_0x5d3978||0xc8;return function(_0x1bc186){if(_0x1bc186){return _0x1f2935[_0xaf77('0x2d')](_0x5d3978)[_0xaf77('0x2f')](_0x1bc186);}};}function respondWithFilteredResult(_0x3055d3,_0x3bb10b){return function(_0x4ba01d){if(_0x4ba01d){var _0x5422bc=typeof _0x3bb10b[_0xaf77('0x30')]===_0xaf77('0x31')&&typeof _0x3bb10b[_0xaf77('0x32')]===_0xaf77('0x31');var _0x1fcdd6=_0x4ba01d['count'];var _0x1f8f25=_0x5422bc?0x0:_0x3bb10b[_0xaf77('0x30')];var _0x2d54d6=_0x5422bc?_0x4ba01d['count']:_0x3bb10b[_0xaf77('0x30')]+_0x3bb10b[_0xaf77('0x32')];var _0x23793d;if(_0x2d54d6>=_0x1fcdd6){_0x2d54d6=_0x1fcdd6;_0x23793d=0xc8;}else{_0x23793d=0xce;}_0x3055d3['status'](_0x23793d);return _0x3055d3['set'](_0xaf77('0x33'),_0x1f8f25+'-'+_0x2d54d6+'/'+_0x1fcdd6)[_0xaf77('0x2f')](_0x4ba01d);}return null;};}function patchUpdates(_0x35e907){return function(_0x487835){try{jsonpatch['apply'](_0x487835,_0x35e907,!![]);}catch(_0x411ebf){return BPromise['reject'](_0x411ebf);}return _0x487835['save']();};}function saveUpdates(_0x24eabd,_0x3b6d88){return function(_0x58a766){if(_0x58a766){return _0x58a766[_0xaf77('0x34')](_0x24eabd)[_0xaf77('0x21')](function(_0x43c39c){return _0x43c39c;});}return null;};}function removeEntity(_0x3e16c2,_0x53c0a0){return function(_0x5e3a76){if(_0x5e3a76){return _0x5e3a76[_0xaf77('0x35')]()[_0xaf77('0x21')](function(){var _0x4b6c11=_0x5e3a76[_0xaf77('0x36')]({'plain':!![]});var _0x59fc91='ChatWebsites';return db[_0xaf77('0x37')]['destroy']({'where':{'type':_0x59fc91,'resourceId':_0x4b6c11['id']}})['then'](function(){return _0x5e3a76;});})[_0xaf77('0x21')](function(){_0x3e16c2['status'](0xcc)[_0xaf77('0x2e')]();});}};}function handleEntityNotFound(_0x1c66e7,_0x1c9632){return function(_0x10d817){if(!_0x10d817){_0x1c66e7['sendStatus'](0x194);}return _0x10d817;};}function handleError(_0x4d263f,_0x539ed8){_0x539ed8=_0x539ed8||0x1f4;return function(_0x5f539a){logger[_0xaf77('0x27')](_0x5f539a[_0xaf77('0x38')]);if(_0x5f539a[_0xaf77('0x39')]){delete _0x5f539a['name'];}_0x4d263f[_0xaf77('0x2d')](_0x539ed8)[_0xaf77('0x3a')](_0x5f539a);};}exports[_0xaf77('0x3b')]=function(_0x666e10,_0x17d59a){var _0x16ecad={'include':[{'model':db[_0xaf77('0x3c')],'as':_0xaf77('0x3d')}]},_0x58ef6f={},_0x5c2b7c={'count':0x0,'rows':[]};var _0x47edde=_[_0xaf77('0x3e')](db['ChatWebsite']['rawAttributes'],function(_0x40ab1a){return{'name':_0x40ab1a[_0xaf77('0x3f')],'type':_0x40ab1a['type'][_0xaf77('0x40')]};});_0x58ef6f[_0xaf77('0x41')]=_['map'](_0x47edde,_0xaf77('0x39'));_0x58ef6f[_0xaf77('0x42')]=_[_0xaf77('0x43')](_0x666e10[_0xaf77('0x42')]);_0x58ef6f[_0xaf77('0x44')]=_[_0xaf77('0x45')](_0x58ef6f[_0xaf77('0x41')],_0x58ef6f[_0xaf77('0x42')]);_0x16ecad[_0xaf77('0x46')]=_['intersection'](_0x58ef6f[_0xaf77('0x41')],qs[_0xaf77('0x47')](_0x666e10[_0xaf77('0x42')][_0xaf77('0x47')]));_0x16ecad['attributes']=_0x16ecad[_0xaf77('0x46')]['length']?_0x16ecad[_0xaf77('0x46')]:_0x58ef6f[_0xaf77('0x41')];if(!_0x666e10[_0xaf77('0x42')][_0xaf77('0x48')](_0xaf77('0x49'))){_0x16ecad[_0xaf77('0x32')]=qs[_0xaf77('0x32')](_0x666e10[_0xaf77('0x42')][_0xaf77('0x32')]);_0x16ecad[_0xaf77('0x30')]=qs[_0xaf77('0x30')](_0x666e10[_0xaf77('0x42')][_0xaf77('0x30')]);}_0x16ecad['order']=qs['sort'](_0x666e10['query'][_0xaf77('0x4a')]);_0x16ecad['where']=qs[_0xaf77('0x44')](_[_0xaf77('0x4b')](_0x666e10[_0xaf77('0x42')],_0x58ef6f[_0xaf77('0x44')]),_0x47edde);if(_0x666e10[_0xaf77('0x42')][_0xaf77('0x4c')]){_0x16ecad[_0xaf77('0x4d')]=_[_0xaf77('0x4e')](_0x16ecad['where'],{'$or':_[_0xaf77('0x3e')](_0x47edde,function(_0x1a8355){if(_0x1a8355[_0xaf77('0x4f')]!==_0xaf77('0x50')){var _0x21acdd={};_0x21acdd[_0x1a8355[_0xaf77('0x39')]]={'$like':'%'+_0x666e10['query'][_0xaf77('0x4c')]+'%'};return _0x21acdd;}})});}_0x16ecad=_[_0xaf77('0x4e')]({},_0x16ecad,_0x666e10['options']);var _0x497bc1={'where':_0x16ecad[_0xaf77('0x4d')]};return db['ChatWebsite'][_0xaf77('0x51')](_0x497bc1)[_0xaf77('0x21')](function(_0x15e151){_0x5c2b7c[_0xaf77('0x51')]=_0x15e151;if(_0x666e10[_0xaf77('0x42')][_0xaf77('0x52')]){_0x16ecad[_0xaf77('0x53')]=[{'all':!![]}];}return db['ChatWebsite'][_0xaf77('0x54')](_0x16ecad);})['then'](function(_0x3aea01){_0x5c2b7c[_0xaf77('0x55')]=_0x3aea01;return _0x5c2b7c;})[_0xaf77('0x21')](respondWithFilteredResult(_0x17d59a,_0x16ecad))[_0xaf77('0x2b')](handleError(_0x17d59a,null));};exports[_0xaf77('0x56')]=function(_0x37acee,_0x47b107){var _0x921805={'raw':![],'where':{'id':_0x37acee[_0xaf77('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0xaf77('0x3d')}]},_0x3120ac={};_0x3120ac['model']=_[_0xaf77('0x43')](db[_0xaf77('0x58')]['rawAttributes']);_0x3120ac['query']=_[_0xaf77('0x43')](_0x37acee['query']);_0x3120ac[_0xaf77('0x44')]=_[_0xaf77('0x45')](_0x3120ac['model'],_0x3120ac[_0xaf77('0x42')]);_0x921805[_0xaf77('0x46')]=_[_0xaf77('0x45')](_0x3120ac['model'],qs['fields'](_0x37acee[_0xaf77('0x42')][_0xaf77('0x47')]));_0x921805[_0xaf77('0x46')]=_0x921805['attributes']['length']?_0x921805['attributes']:_0x3120ac[_0xaf77('0x41')];if(_0x37acee[_0xaf77('0x42')]['includeAll']){_0x921805[_0xaf77('0x53')]=[{'all':!![]}];}_0x921805=_['merge']({},_0x921805,_0x37acee[_0xaf77('0x59')]);return db[_0xaf77('0x58')][_0xaf77('0x5a')](_0x921805)[_0xaf77('0x21')](handleEntityNotFound(_0x47b107,null))[_0xaf77('0x21')](respondWithResult(_0x47b107,null))['catch'](handleError(_0x47b107,null));};exports[_0xaf77('0x5b')]=function(_0x34f1ce,_0x4b0179){return db['ChatWebsite'][_0xaf77('0x5b')](_0x34f1ce[_0xaf77('0x5c')],{})['then'](function(_0x463b57){var _0x1ed097=_0x34f1ce['user']['get']({'plain':!![]});if(!_0x1ed097)throw new Error(_0xaf77('0x5d'));if(_0x1ed097[_0xaf77('0x5e')]==='user'){var _0x3c85e8=_0x463b57[_0xaf77('0x36')]({'plain':!![]});var _0xc2370d=_0xaf77('0x5f');return db['UserProfileSection']['find']({'where':{'name':_0xc2370d,'userProfileId':_0x1ed097[_0xaf77('0x60')]},'raw':!![]})[_0xaf77('0x21')](function(_0x5bf8d8){if(_0x5bf8d8&&_0x5bf8d8[_0xaf77('0x61')]===0x0){return db[_0xaf77('0x37')][_0xaf77('0x5b')]({'name':_0x3c85e8[_0xaf77('0x39')],'resourceId':_0x3c85e8['id'],'type':_0x5bf8d8[_0xaf77('0x39')],'sectionId':_0x5bf8d8['id']},{})[_0xaf77('0x21')](function(){return _0x463b57;});}else{return _0x463b57;}})[_0xaf77('0x2b')](function(_0x38bbc0){logger[_0xaf77('0x27')](_0xaf77('0x62'),_0x38bbc0);throw _0x38bbc0;});}return _0x463b57;})[_0xaf77('0x21')](respondWithResult(_0x4b0179,0xc9))['catch'](handleError(_0x4b0179,null));};exports[_0xaf77('0x34')]=function(_0x5b61b4,_0x3ffe74){if(_0x5b61b4['body']['id']){delete _0x5b61b4[_0xaf77('0x5c')]['id'];}return db['ChatWebsite'][_0xaf77('0x5a')]({'where':{'id':_0x5b61b4[_0xaf77('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0xaf77('0x3d')}]})[_0xaf77('0x21')](handleEntityNotFound(_0x3ffe74,null))[_0xaf77('0x21')](saveUpdates(_0x5b61b4['body'],null))[_0xaf77('0x21')](respondWithResult(_0x3ffe74,null))['catch'](handleError(_0x3ffe74,null));};exports[_0xaf77('0x35')]=function(_0x57ed77,_0x40c8d6){return db[_0xaf77('0x58')][_0xaf77('0x5a')]({'where':{'id':_0x57ed77[_0xaf77('0x57')]['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x40c8d6,null))['then'](removeEntity(_0x40c8d6,null))['catch'](handleError(_0x40c8d6,null));};exports[_0xaf77('0x63')]=function(_0x41d0bc,_0x5ccf8b){return db[_0xaf77('0x58')]['describe']()['then'](respondWithResult(_0x5ccf8b,null))[_0xaf77('0x2b')](handleError(_0x5ccf8b,null));};exports[_0xaf77('0x64')]=function(_0x45bbf2,_0x32a46d,_0x3e6226){if(_0x45bbf2[_0xaf77('0x5c')]['id']){delete _0x45bbf2[_0xaf77('0x5c')]['id'];}return db[_0xaf77('0x58')][_0xaf77('0x5a')]({'where':{'id':_0x45bbf2[_0xaf77('0x57')]['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x32a46d,null))['then'](function(_0x1e9d0b){if(_0x1e9d0b){_0x45bbf2['body']['ChatWebsiteId']=_0x1e9d0b['id'];return db[_0xaf77('0x65')][_0xaf77('0x5b')](_0x45bbf2[_0xaf77('0x5c')]);}})['then'](respondWithResult(_0x32a46d,null))[_0xaf77('0x2b')](handleError(_0x32a46d,null));};exports['getDispositions']=function(_0x31eb08,_0x5f54cd,_0x2cf527){var _0xd9fdab={'raw':![],'where':{}};var _0x26cb7b={};var _0x126c4a={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xaf77('0x66')]({'where':{'id':_0x31eb08[_0xaf77('0x57')]['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x5f54cd,null))[_0xaf77('0x21')](function(_0x5c99cc){if(_0x5c99cc){_0x26cb7b[_0xaf77('0x41')]=_['keys'](db[_0xaf77('0x65')][_0xaf77('0x67')]);_0x26cb7b[_0xaf77('0x42')]=_[_0xaf77('0x43')](_0x31eb08['query']);_0x26cb7b['filters']=_[_0xaf77('0x45')](_0x26cb7b[_0xaf77('0x41')],_0x26cb7b[_0xaf77('0x42')]);_0xd9fdab[_0xaf77('0x46')]=_['intersection'](_0x26cb7b[_0xaf77('0x41')],qs[_0xaf77('0x47')](_0x31eb08[_0xaf77('0x42')]['fields']));_0xd9fdab[_0xaf77('0x46')]=_0xd9fdab[_0xaf77('0x46')][_0xaf77('0x68')]?_0xd9fdab[_0xaf77('0x46')]:_0x26cb7b[_0xaf77('0x41')];if(!_0x31eb08['query'][_0xaf77('0x48')]('nolimit')){_0xd9fdab[_0xaf77('0x32')]=qs['limit'](_0x31eb08[_0xaf77('0x42')][_0xaf77('0x32')]);_0xd9fdab[_0xaf77('0x30')]=qs[_0xaf77('0x30')](_0x31eb08[_0xaf77('0x42')][_0xaf77('0x30')]);}_0xd9fdab[_0xaf77('0x69')]=qs[_0xaf77('0x4a')](_0x31eb08[_0xaf77('0x42')][_0xaf77('0x4a')]);_0xd9fdab['where']=qs[_0xaf77('0x44')](_[_0xaf77('0x4b')](_0x31eb08[_0xaf77('0x42')],_0x26cb7b[_0xaf77('0x44')]));_0xd9fdab[_0xaf77('0x4d')]['ChatWebsiteId']=_0x5c99cc['id'];if(_0x31eb08['query'][_0xaf77('0x4c')]){_0xd9fdab['where']=_[_0xaf77('0x4e')](_0xd9fdab[_0xaf77('0x4d')],{'$or':_[_0xaf77('0x3e')](_0xd9fdab[_0xaf77('0x46')],function(_0x40967e){var _0x1ca061={};_0x1ca061[_0x40967e]={'$like':'%'+_0x31eb08['query']['filter']+'%'};return _0x1ca061;})});}_0xd9fdab=_[_0xaf77('0x4e')]({},_0xd9fdab,_0x31eb08[_0xaf77('0x59')]);return db[_0xaf77('0x65')][_0xaf77('0x51')]({'where':_0xd9fdab['where']})[_0xaf77('0x21')](function(_0x3caec1){_0x126c4a['count']=_0x3caec1;if(_0x31eb08[_0xaf77('0x42')]['includeAll']){_0xd9fdab[_0xaf77('0x53')]=[{'all':!![]}];}return db[_0xaf77('0x65')][_0xaf77('0x54')](_0xd9fdab);})['then'](function(_0x445e29){_0x126c4a[_0xaf77('0x55')]=_0x445e29;return _0x126c4a;});}})[_0xaf77('0x21')](respondWithFilteredResult(_0x5f54cd,_0xd9fdab))[_0xaf77('0x2b')](handleError(_0x5f54cd,null));};exports[_0xaf77('0x6a')]=function(_0x4c29d8,_0x287e24,_0x17ada6){return db[_0xaf77('0x58')][_0xaf77('0x5a')]({'where':{'id':_0x4c29d8[_0xaf77('0x57')]['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x287e24,null))['then'](function(_0x4cde94){if(_0x4cde94){return _0x4cde94[_0xaf77('0x6a')](_0x4c29d8[_0xaf77('0x42')]['ids']);}})[_0xaf77('0x21')](respondWithStatusCode(_0x287e24,null))[_0xaf77('0x2b')](handleError(_0x287e24,null));};exports[_0xaf77('0x6b')]=function(_0x3343e9,_0x4816f6,_0x353579){if(_0x3343e9['body']['id']){delete _0x3343e9[_0xaf77('0x5c')]['id'];}return db['ChatWebsite'][_0xaf77('0x5a')]({'where':{'id':_0x3343e9[_0xaf77('0x57')]['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x4816f6,null))[_0xaf77('0x21')](function(_0x35ca1d){if(_0x35ca1d){_0x3343e9['body']['ChatWebsiteId']=_0x35ca1d['id'];return db[_0xaf77('0x6c')][_0xaf77('0x5b')](_0x3343e9['body']);}})['then'](respondWithResult(_0x4816f6,null))[_0xaf77('0x2b')](handleError(_0x4816f6,null));};exports[_0xaf77('0x6d')]=function(_0x4daeee,_0x1b8773,_0x371d88){var _0x531738={'raw':![],'where':{}};var _0xc5b527={};var _0x19b4e9={'count':0x0,'rows':[]};return db[_0xaf77('0x58')][_0xaf77('0x66')]({'where':{'id':_0x4daeee[_0xaf77('0x57')]['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x1b8773,null))[_0xaf77('0x21')](function(_0x434ff4){if(_0x434ff4){_0xc5b527[_0xaf77('0x41')]=_[_0xaf77('0x43')](db[_0xaf77('0x6c')][_0xaf77('0x67')]);_0xc5b527['query']=_[_0xaf77('0x43')](_0x4daeee[_0xaf77('0x42')]);_0xc5b527[_0xaf77('0x44')]=_[_0xaf77('0x45')](_0xc5b527['model'],_0xc5b527[_0xaf77('0x42')]);_0x531738[_0xaf77('0x46')]=_[_0xaf77('0x45')](_0xc5b527[_0xaf77('0x41')],qs[_0xaf77('0x47')](_0x4daeee[_0xaf77('0x42')][_0xaf77('0x47')]));_0x531738[_0xaf77('0x46')]=_0x531738['attributes'][_0xaf77('0x68')]?_0x531738['attributes']:_0xc5b527['model'];if(!_0x4daeee[_0xaf77('0x42')][_0xaf77('0x48')](_0xaf77('0x49'))){_0x531738[_0xaf77('0x32')]=qs[_0xaf77('0x32')](_0x4daeee[_0xaf77('0x42')][_0xaf77('0x32')]);_0x531738[_0xaf77('0x30')]=qs[_0xaf77('0x30')](_0x4daeee['query'][_0xaf77('0x30')]);}_0x531738[_0xaf77('0x69')]=qs[_0xaf77('0x4a')](_0x4daeee['query'][_0xaf77('0x4a')]);_0x531738['where']=qs[_0xaf77('0x44')](_[_0xaf77('0x4b')](_0x4daeee[_0xaf77('0x42')],_0xc5b527[_0xaf77('0x44')]));_0x531738[_0xaf77('0x4d')][_0xaf77('0x6e')]=_0x434ff4['id'];if(_0x4daeee[_0xaf77('0x42')][_0xaf77('0x4c')]){_0x531738['where']=_[_0xaf77('0x4e')](_0x531738[_0xaf77('0x4d')],{'$or':_[_0xaf77('0x3e')](_0x531738['attributes'],function(_0x24b936){var _0x52c937={};_0x52c937[_0x24b936]={'$like':'%'+_0x4daeee['query'][_0xaf77('0x4c')]+'%'};return _0x52c937;})});}_0x531738=_[_0xaf77('0x4e')]({},_0x531738,_0x4daeee[_0xaf77('0x59')]);return db['CannedAnswer']['count']({'where':_0x531738[_0xaf77('0x4d')]})[_0xaf77('0x21')](function(_0x53019b){_0x19b4e9[_0xaf77('0x51')]=_0x53019b;if(_0x4daeee[_0xaf77('0x42')][_0xaf77('0x52')]){_0x531738[_0xaf77('0x53')]=[{'all':!![]}];}return db[_0xaf77('0x6c')][_0xaf77('0x54')](_0x531738);})[_0xaf77('0x21')](function(_0x8746){_0x19b4e9['rows']=_0x8746;return _0x19b4e9;});}})[_0xaf77('0x21')](respondWithFilteredResult(_0x1b8773,_0x531738))['catch'](handleError(_0x1b8773,null));};exports[_0xaf77('0x6f')]=function(_0x523600,_0x10122f,_0x16f4c3){return db[_0xaf77('0x58')][_0xaf77('0x5a')]({'where':{'id':_0x523600[_0xaf77('0x57')]['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x10122f,null))[_0xaf77('0x21')](function(_0x556f44){if(_0x556f44){return _0x556f44[_0xaf77('0x6f')](_0x523600[_0xaf77('0x42')][_0xaf77('0x70')]);}})[_0xaf77('0x21')](respondWithStatusCode(_0x10122f,null))[_0xaf77('0x2b')](handleError(_0x10122f,null));};exports[_0xaf77('0x71')]=function(_0x209aee,_0x147734,_0x150d1e){_0x209aee['body'][_0xaf77('0x72')]=_0x209aee[_0xaf77('0x73')][_0xaf77('0x74')];return db['ChatWebsite'][_0xaf77('0x5a')]({'where':{'id':_0x209aee['params']['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x147734,null))[_0xaf77('0x21')](saveUpdates(_0x209aee['body'],null))[_0xaf77('0x21')](respondWithResult(_0x147734,null))[_0xaf77('0x2b')](handleError(_0x147734,null));};exports['addAvatar']=function(_0x161fe8,_0x5ec144,_0x1aab7c){_0x161fe8['body']['agentAvatar']=_0x161fe8['file'][_0xaf77('0x74')];return db[_0xaf77('0x58')][_0xaf77('0x5a')]({'where':{'id':_0x161fe8['params']['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x5ec144,null))[_0xaf77('0x21')](saveUpdates(_0x161fe8[_0xaf77('0x5c')],null))[_0xaf77('0x21')](respondWithResult(_0x5ec144,null))[_0xaf77('0x2b')](handleError(_0x5ec144,null));};exports[_0xaf77('0x75')]=function(_0x46103b,_0x9b67ec,_0xa1aeb6){_0x46103b[_0xaf77('0x5c')]['customerAvatar']=_0x46103b[_0xaf77('0x73')][_0xaf77('0x74')];return db[_0xaf77('0x58')][_0xaf77('0x5a')]({'where':{'id':_0x46103b['params']['id']}})['then'](handleEntityNotFound(_0x9b67ec,null))[_0xaf77('0x21')](saveUpdates(_0x46103b[_0xaf77('0x5c')],null))[_0xaf77('0x21')](respondWithResult(_0x9b67ec,null))[_0xaf77('0x2b')](handleError(_0x9b67ec,null));};exports[_0xaf77('0x76')]=function(_0x4870f1,_0x244ff2,_0x26d1ff){_0x4870f1['body'][_0xaf77('0x77')]=_0x4870f1['file'][_0xaf77('0x74')];return db[_0xaf77('0x58')][_0xaf77('0x5a')]({'where':{'id':_0x4870f1[_0xaf77('0x57')]['id']}})['then'](handleEntityNotFound(_0x244ff2,null))[_0xaf77('0x21')](saveUpdates(_0x4870f1['body'],null))[_0xaf77('0x21')](respondWithResult(_0x244ff2,null))[_0xaf77('0x2b')](handleError(_0x244ff2,null));};exports[_0xaf77('0x78')]=function(_0xcea8da,_0x599e7c,_0x4e4de9){var _0x1d337d=path[_0xaf77('0x79')](config[_0xaf77('0x7a')],_0xaf77('0x7b'));var _0x256e09={'where':{'id':_0xcea8da[_0xaf77('0x57')]['id']},'attributes':['id',_0xaf77('0x72')],'raw':!![]};var _0x40b179=![];return require(_0xaf77('0x18'))[_0xaf77('0x7c')]()['then'](function(_0x5d7108){if(_0x5d7108){_0x40b179=_0x5d7108[_0xaf77('0x7d')];}})[_0xaf77('0x21')](function(){return db[_0xaf77('0x58')][_0xaf77('0x5a')](_0x256e09);})[_0xaf77('0x21')](handleEntityNotFound(_0x599e7c,null))[_0xaf77('0x21')](function(_0xef0303){if(_0xef0303){if(!_[_0xaf77('0x7e')](_0xef0303[_0xaf77('0x72')])){if(fs[_0xaf77('0x7f')](path[_0xaf77('0x79')](config[_0xaf77('0x7a')],_0xaf77('0x80'),_0xef0303[_0xaf77('0x72')]))&&_0x40b179){_0x1d337d=path[_0xaf77('0x79')](config[_0xaf77('0x7a')],'server/files/images/logos/',_0xef0303[_0xaf77('0x72')]);}}return _0x599e7c['download'](_0x1d337d);}})[_0xaf77('0x2b')](handleError(_0x599e7c,null));};exports['getAvatar']=function(_0x5f17e8,_0x3b5548,_0x4d43f2){var _0x133fd3=path[_0xaf77('0x79')](config['root'],_0xaf77('0x81'));var _0x526054={'where':{'id':_0x5f17e8[_0xaf77('0x57')]['id']},'attributes':['id',_0xaf77('0x82')],'raw':!![]};return db['ChatWebsite']['find'](_0x526054)[_0xaf77('0x21')](handleEntityNotFound(_0x3b5548,null))['then'](function(_0x2374f4){if(_0x2374f4){if(!_['isNil'](_0x2374f4[_0xaf77('0x82')])){if(fs['existsSync'](path[_0xaf77('0x79')](config[_0xaf77('0x7a')],_0xaf77('0x83'),_0x2374f4[_0xaf77('0x82')]))){_0x133fd3=path['join'](config[_0xaf77('0x7a')],_0xaf77('0x83'),_0x2374f4[_0xaf77('0x82')]);}}return _0x3b5548[_0xaf77('0x84')](_0x133fd3);}})['catch'](handleError(_0x3b5548,null));};exports[_0xaf77('0x85')]=function(_0x2d54f1,_0x5b919f,_0x567d68){var _0x5b870d=path['join'](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x78d71c={'where':{'id':_0x2d54f1[_0xaf77('0x57')]['id']},'attributes':['id',_0xaf77('0x86'),_0xaf77('0x87')],'raw':!![]};return db[_0xaf77('0x58')][_0xaf77('0x5a')](_0x78d71c)[_0xaf77('0x21')](handleEntityNotFound(_0x5b919f,null))['then'](function(_0x412a44){if(_0x412a44){if(!_['isNil'](_0x412a44['customerAvatar'])){if(fs[_0xaf77('0x7f')](path[_0xaf77('0x79')](config[_0xaf77('0x7a')],_0xaf77('0x83'),_0x412a44[_0xaf77('0x86')]))&&_0x412a44[_0xaf77('0x87')]){_0x5b870d=path[_0xaf77('0x79')](config[_0xaf77('0x7a')],_0xaf77('0x83'),_0x412a44[_0xaf77('0x86')]);}}return _0x5b919f['download'](_0x5b870d);}})[_0xaf77('0x2b')](handleError(_0x5b919f,null));};exports[_0xaf77('0x88')]=function(_0x559f73,_0x3bc712,_0x28b857){var _0x16cf9f=path[_0xaf77('0x79')](config[_0xaf77('0x7a')],'server/files/images/avatars/system_avatar.png');var _0x348c0e={'where':{'id':_0x559f73[_0xaf77('0x57')]['id']},'attributes':['id',_0xaf77('0x77')],'raw':!![]};return db[_0xaf77('0x58')][_0xaf77('0x5a')](_0x348c0e)['then'](handleEntityNotFound(_0x3bc712,null))[_0xaf77('0x21')](function(_0x5a9d00){if(_0x5a9d00){if(!_[_0xaf77('0x7e')](_0x5a9d00[_0xaf77('0x77')])){if(fs[_0xaf77('0x7f')](path[_0xaf77('0x79')](config[_0xaf77('0x7a')],_0xaf77('0x83'),_0x5a9d00[_0xaf77('0x77')]))){_0x16cf9f=path[_0xaf77('0x79')](config[_0xaf77('0x7a')],_0xaf77('0x83'),_0x5a9d00['systemAvatar']);}}return _0x3bc712[_0xaf77('0x84')](_0x16cf9f);}})[_0xaf77('0x2b')](handleError(_0x3bc712,null));};exports['notify']=function(_0x49183a,_0x5635df,_0x48ddda){var _0x39eefc=require(_0xaf77('0x89'));var _0x199d68=new _0x39eefc();var _0x10b88c=_0x199d68[_0xaf77('0x8a')](_0x49183a['headers'][_0xaf77('0x8b')])[_0xaf77('0x8c')]();var _0x38db84={'body':_0x49183a[_0xaf77('0x5c')],'channel':'chat'};var _0x3ca3e3=[];var _0x18a51a=[];var _0x54cfd4={};var _0x381857=![];return db[_0xaf77('0x8d')]['describe']()[_0xaf77('0x21')](function(_0x313054){if(!_0x313054){throw new db[(_0xaf77('0x8e'))]['ValidationError']('no\x20available\x20attributes');}_0x3ca3e3=_['difference'](_[_0xaf77('0x43')](_0x313054),['createdAt',_0xaf77('0x8f')]);_0x18a51a=_[_0xaf77('0x90')](_['keys'](_0x313054),[_0xaf77('0x91'),_0xaf77('0x8f'),_0xaf77('0x92'),_0xaf77('0x93')]);if(_0x49183a[_0xaf77('0x5c')]['id']){delete _0x49183a[_0xaf77('0x5c')]['id'];}if(_[_0xaf77('0x7e')](_0x49183a['body'][_0xaf77('0x94')])){throw new db[(_0xaf77('0x8e'))][(_0xaf77('0x95'))]('from\x20is\x20mandatory');}if(_[_0xaf77('0x7e')](_0x49183a[_0xaf77('0x5c')]['body'])||_0x49183a[_0xaf77('0x5c')][_0xaf77('0x5c')]===''){throw new db[(_0xaf77('0x8e'))][(_0xaf77('0x95'))](_0xaf77('0x96'));}if(_[_0xaf77('0x7e')](_0x49183a[_0xaf77('0x5c')][_0xaf77('0x97')])){throw new db['Sequelize'][(_0xaf77('0x95'))](_0xaf77('0x98')+_0x18a51a);}if(!_['includes'](_0x18a51a,_0x49183a['body'][_0xaf77('0x97')])){throw new db[(_0xaf77('0x8e'))][(_0xaf77('0x95'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x18a51a);}_0x54cfd4[_0x49183a[_0xaf77('0x5c')][_0xaf77('0x97')]]=_0x49183a[_0xaf77('0x5c')][_0xaf77('0x94')];})[_0xaf77('0x21')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x49183a['params']['id']},'include':[{'model':db[_0xaf77('0x99')],'as':_0xaf77('0x9a'),'include':[{'model':db[_0xaf77('0x8d')],'as':_0xaf77('0x9b'),'where':_0x54cfd4,'limit':0x1,'order':[[_0xaf77('0x8f'),_0xaf77('0x9c')]]}]},{'model':db[_0xaf77('0x9d')],'as':_0xaf77('0x9e')}]});})['then'](handleEntityNotFound(_0x5635df,null))[_0xaf77('0x21')](function(_0x1066ec){if(_0x1066ec&&_0x1066ec[_0xaf77('0x9a')]){_0x38db84['account']=_0x1066ec;_0x38db84[_0xaf77('0x9f')]=_0x1066ec[_0xaf77('0x9e')];_0x38db84[_0xaf77('0xa0')]=_0x1066ec[_0xaf77('0x9a')];_0x38db84[_0xaf77('0x9f')]=_['orderBy'](_0x38db84[_0xaf77('0x9f')],[_0xaf77('0xa1')],[_0xaf77('0xa2')]);if(_0x38db84[_0xaf77('0xa3')][_0xaf77('0x9e')]){delete _0x38db84[_0xaf77('0xa3')][_0xaf77('0x9e')];}if(_0x38db84[_0xaf77('0xa3')]['List']&&_0x38db84['account'][_0xaf77('0x9a')][_0xaf77('0x9b')][_0xaf77('0x68')]){return _0x38db84[_0xaf77('0xa3')][_0xaf77('0x9a')][_0xaf77('0x9b')][0x0];}var _0x595744=_[_0xaf77('0x1a')](_0x49183a[_0xaf77('0x5c')],{'firstName':_0x49183a[_0xaf77('0x5c')][_0xaf77('0x94')],'ListId':_0x1066ec[_0xaf77('0x93')]});_0x595744[_0x49183a[_0xaf77('0x5c')][_0xaf77('0x97')]]=_0x49183a[_0xaf77('0x5c')]['from'];return db[_0xaf77('0x8d')]['create'](_0x595744,{'fields':_0x3ca3e3,'raw':!![]});}})[_0xaf77('0x21')](handleEntityNotFound(_0x5635df,null))[_0xaf77('0x21')](function(_0x25e72a){_0x38db84[_0xaf77('0xa4')]=_0x25e72a;var _0x4e5c93=_0x49183a['body'][_0xaf77('0xa5')];if(_0x49183a[_0xaf77('0xa6')][_0xaf77('0xa7')]){_0x4e5c93=_0x49183a[_0xaf77('0xa6')][_0xaf77('0xa7')];}else if(_0x49183a[_0xaf77('0xa6')][_0xaf77('0xa8')]){_0x4e5c93=_[_0xaf77('0xa9')](_0x49183a['headers'][_0xaf77('0xa8')]['split'](','));}if(_0x25e72a){var _0x8dfe6={'ContactId':_0x25e72a['id'],'ChatWebsiteId':_0x49183a[_0xaf77('0x57')]['id'],'from':(_0x25e72a[_0xaf77('0xaa')]||'')+'\x20'+(_0x25e72a[_0xaf77('0xab')]||''),'customerIp':_0x4e5c93,'customerPort':_0x49183a[_0xaf77('0xa6')][_0xaf77('0xac')]?_0x49183a[_0xaf77('0xa6')][_0xaf77('0xac')]:null,'referer':_0x49183a[_0xaf77('0x5c')][_0xaf77('0xad')],'browserName':_0x10b88c['browser'][_0xaf77('0x39')]&&_0x10b88c[_0xaf77('0xae')][_0xaf77('0xaf')]?util[_0xaf77('0xb0')](_0xaf77('0xb1'),_0x10b88c[_0xaf77('0xae')]['name'],_0x10b88c[_0xaf77('0xae')][_0xaf77('0xaf')]):_0xaf77('0xb2'),'browserVersion':_0x10b88c[_0xaf77('0xae')]['version']||'unknown','osName':util[_0xaf77('0xb0')](_0xaf77('0xb1'),_0x10b88c['os'][_0xaf77('0x39')],_0x10b88c['os']['version']),'osVersion':_0x10b88c['os']['version'],'deviceModel':_0x10b88c['device'][_0xaf77('0x41')]&&_0x10b88c['device'][_0xaf77('0xb3')]?util[_0xaf77('0xb0')]('%s\x20%s\x20%s',_0x10b88c[_0xaf77('0xb4')]['model'],_0x10b88c[_0xaf77('0xb4')]['vendor'],_0x10b88c['device'][_0xaf77('0x4f')]):null,'deviceVendor':_0x10b88c[_0xaf77('0xb4')][_0xaf77('0xb3')],'deviceType':_0x10b88c[_0xaf77('0xb4')][_0xaf77('0x4f')],'formData':JSON[_0xaf77('0x26')](_0x49183a[_0xaf77('0x5c')])};var _0x1286de={'ChatWebsiteId':_0x49183a[_0xaf77('0x57')]['id'],'closed':![]};if(_0x49183a[_0xaf77('0x5c')][_0xaf77('0xb5')]){_0x1286de[_0xaf77('0xb5')]=_0x49183a[_0xaf77('0x5c')][_0xaf77('0xb5')];return db[_0xaf77('0xb6')][_0xaf77('0x5a')]({'where':_0x1286de})['then'](function(_0x404941){if(_0x404941){return[_0x404941,![]];}_0x8dfe6[_0xaf77('0xb5')]=_0x49183a[_0xaf77('0x5c')][_0xaf77('0xb5')];_0x8dfe6['externalUrl']=_0x49183a['body'][_0xaf77('0xb7')];return db['ChatInteraction'][_0xaf77('0x5b')](_0x8dfe6)[_0xaf77('0x21')](function(_0x17e709){return[_0x17e709,!![]];});});}_0x1286de[_0xaf77('0xb8')]=_0x25e72a['id'];if(_0x49183a['body']['interaction']&&_0x49183a['body'][_0xaf77('0xb9')]['id']){_0x1286de['id']=_0x49183a[_0xaf77('0x5c')]['interaction']['id'];return db[_0xaf77('0xb6')]['find']({'where':_0x1286de})['then'](function(_0x16310e){if(_0x16310e){return[_0x16310e,![]];}return db[_0xaf77('0xb6')]['create'](_0x8dfe6)['then'](function(_0x4d7858){return[_0x4d7858,!![]];});});}return db[_0xaf77('0xb6')][_0xaf77('0x5b')](_0x8dfe6)[_0xaf77('0x21')](function(_0x1b5157){return[_0x1b5157,!![]];});}})[_0xaf77('0xba')](function(_0x3eb97f,_0x2a6b5f){if(_0x3eb97f){_0x381857=_0x2a6b5f;if(!_0x2a6b5f){var _0x45ae79={'from':(_0x38db84[_0xaf77('0xa4')][_0xaf77('0xaa')]||'')+'\x20'+(_0x38db84[_0xaf77('0xa4')][_0xaf77('0xab')]||'')};if(_0x49183a[_0xaf77('0x5c')][_0xaf77('0xb5')]&&_0x49183a['body']['messageId']&&_0x49183a[_0xaf77('0x5c')][_0xaf77('0xb5')]!=_0x49183a[_0xaf77('0x5c')][_0xaf77('0xbb')]){_0x45ae79[_0xaf77('0xb5')]=_0x49183a[_0xaf77('0x5c')][_0xaf77('0xbb')];}return _0x3eb97f[_0xaf77('0x34')](_0x45ae79);}else{return _0x3eb97f;}}})[_0xaf77('0x21')](function(_0xf26985){_0x38db84[_0xaf77('0xb9')]=_0xf26985['get']({'plain':!![]});_0x38db84[_0xaf77('0xb9')]['created']=_0x381857;if(_0x38db84[_0xaf77('0xb9')][_0xaf77('0xbc')]){if(_0x38db84[_0xaf77('0xa3')][_0xaf77('0xbd')]){_0x38db84[_0xaf77('0x9f')][_0xaf77('0xbe')]({'id':0x0,'priority':_0x38db84[_0xaf77('0x9f')][_0xaf77('0x68')]+0x1,'app':'close','appdata':_0xaf77('0xbf'),'interval':'*,*,*,*'});}}return db['ChatMessage']['create']({'body':_0x49183a[_0xaf77('0x5c')][_0xaf77('0x5c')],'ChatWebsiteId':_0x49183a['params']['id'],'ChatInteractionId':_0xf26985['id'],'direction':'in','ContactId':_0x38db84[_0xaf77('0xa4')]['id'],'AttachmentId':_0x49183a['body'][_0xaf77('0xc0')]});})[_0xaf77('0x21')](function(_0x182e32){_0x38db84['message']=_0x182e32;if(_0x38db84[_0xaf77('0xb9')]['UserId']){return db[_0xaf77('0xc1')][_0xaf77('0x5a')]({'attributes':['id',_0xaf77('0x39')],'where':{'id':_0x38db84[_0xaf77('0xb9')][_0xaf77('0xc2')]}})[_0xaf77('0x21')](function(_0x3c6a8f){if(_0x3c6a8f){_0x38db84['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xaf77('0xc3'),'appdata':_0x3c6a8f[_0xaf77('0x39')]+','+(_0x38db84['account'][_0xaf77('0xc4')]||0xa),'interval':_0xaf77('0xc5')});_0x38db84[_0xaf77('0xc6')]=!![];}return respondWithRpcPromise(_0xaf77('0xc7'),'startRouting',_0x38db84);});}return respondWithRpcPromise(_0xaf77('0xc7'),_0xaf77('0xc8'),_0x38db84);})[_0xaf77('0x21')](function(_0x5110da){respondWithRpcPromise(_0xaf77('0xc9'),_0xaf77('0xc9'),{'event':_0xaf77('0xca'),'message':_0x5110da},client9002);return _0x5110da;})[_0xaf77('0x21')](respondWithResult(_0x5635df,null))[_0xaf77('0x2b')](handleError(_0x5635df,null));};exports[_0xaf77('0xcb')]=function(_0x471de7,_0x3c94d3,_0x3070a3){var _0x392250,_0x1b5d94,_0x434edf;var _0x4c5377=[];var _0x1f0b2a=[];var _0x32ad0f={};var _0xa8999a=_0x471de7[_0xaf77('0xcc')]||[];var _0x218f89=[];var _0x66eecd;return db[_0xaf77('0x8d')]['describe']()[_0xaf77('0x21')](function(_0x5f3984){if(!_0x5f3984){throw new db['Sequelize'][(_0xaf77('0x95'))](_0xaf77('0xcd'));}_0x1f0b2a=_['difference'](_[_0xaf77('0x43')](_0x5f3984),[_0xaf77('0x91'),_0xaf77('0x8f')]);_0x4c5377=_[_0xaf77('0x90')](_[_0xaf77('0x43')](_0x5f3984),[_0xaf77('0x91'),_0xaf77('0x8f'),_0xaf77('0x92'),_0xaf77('0x93')]);if(_0x471de7['body']['id']){delete _0x471de7[_0xaf77('0x5c')]['id'];}if(_[_0xaf77('0x7e')](_0x471de7[_0xaf77('0x5c')][_0xaf77('0x94')])){throw _0x3c94d3[_0xaf77('0x2d')](0x1f4)[_0xaf77('0x3a')](new db[(_0xaf77('0x8e'))][(_0xaf77('0x95'))](_0xaf77('0xce')));}if(_['isNil'](_0x471de7['body'][_0xaf77('0x5c')])||_0x471de7[_0xaf77('0x5c')][_0xaf77('0x5c')]===''){throw _0x3c94d3['status'](0x1f4)[_0xaf77('0x3a')](new db['Sequelize'][(_0xaf77('0x95'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xaf77('0x7e')](_0x471de7[_0xaf77('0x5c')]['mapKeyOffline'])){throw _0x3c94d3[_0xaf77('0x2d')](0x1f4)[_0xaf77('0x3a')](new db['Sequelize'][(_0xaf77('0x95'))](_0xaf77('0xcf')+_0x4c5377));}if(!_[_0xaf77('0xd0')](_0x4c5377,_0x471de7[_0xaf77('0x5c')]['mapKeyOffline'])){throw _0x3c94d3['status'](0x1f4)[_0xaf77('0x3a')](new db['Sequelize'][(_0xaf77('0x95'))](_0xaf77('0xd1')+_0x4c5377));}_0x32ad0f[_0x471de7[_0xaf77('0x5c')]['mapKeyOffline']]=_0x471de7[_0xaf77('0x5c')]['from'];})[_0xaf77('0x21')](function(){return db[_0xaf77('0x58')][_0xaf77('0x5a')]({'where':{'id':_0x471de7[_0xaf77('0x57')]['id']},'include':[{'model':db[_0xaf77('0x99')],'as':_0xaf77('0x9a')},{'model':db[_0xaf77('0xd2')],'as':_0xaf77('0xd2')}]});})['then'](handleEntityNotFound(_0x3c94d3,null))[_0xaf77('0x21')](function(_0x247941){if(_0x247941&&_0x247941[_0xaf77('0x9a')]){_0x1b5d94=_0x247941;var _0x3c7116=_[_0xaf77('0x1a')](_0x471de7[_0xaf77('0x5c')],{'firstName':_0x471de7['body'][_0xaf77('0x94')],'phone':_0x471de7[_0xaf77('0x5c')][_0xaf77('0x94')],'ListId':_0x247941[_0xaf77('0x93')]});_0x3c7116[_0x471de7[_0xaf77('0x5c')][_0xaf77('0xd3')]]=_0x471de7['body'][_0xaf77('0x94')];return db[_0xaf77('0x8d')][_0xaf77('0xd4')]({'where':_0x32ad0f,'defaults':_0x3c7116});}})['spread'](function(_0x163720){if(_0x163720){_0x434edf=_0x163720;var _0x212794=fs[_0xaf77('0xd5')](path['join'](config[_0xaf77('0x7a')],_0xaf77('0xd6')),_0xaf77('0xd7'));var _0x3293d8=ejs['render'](_0x212794,{'body':_[_0xaf77('0xd8')](_0x471de7[_0xaf77('0x5c')]['body']),'bodyTitle':_0x1b5d94['offlineMessageBody']});return db[_0xaf77('0xd9')][_0xaf77('0x5b')]({'body':_0x3293d8,'ContactId':_0x163720['id'],'ChatWebsiteId':_0x1b5d94['id']});}})[_0xaf77('0x21')](function(_0x2e6697){_0x66eecd=_0x2e6697;if(_0xa8999a['length']){var _0x4f40d6=_0xa8999a['map'](function(_0x243f04){return{'name':_0x243f04['originalname'],'basename':_0x243f04[_0xaf77('0x74')],'type':_0x243f04[_0xaf77('0xda')],'ChatOfflineMessageId':_0x2e6697['id']};});_0x218f89=_0x4f40d6[_0xaf77('0x3e')](_0x11b681=>{var _0x62697c={'filename':_0x11b681[_0xaf77('0x39')],'path':path[_0xaf77('0x79')](config[_0xaf77('0x7a')],_0xaf77('0xdb'),_0xaf77('0xcc'),_0xaf77('0xdc'),_0xaf77('0xdd'),_0x11b681[_0xaf77('0xde')])};return _0x62697c;});if(!_0x1b5d94[_0xaf77('0xdf')]){return db['sequelize'][_0xaf77('0xe0')](function(_0x593aa3){return db[_0xaf77('0xe1')]['bulkCreate'](_0x4f40d6,{'transaction':_0x593aa3});});}}})[_0xaf77('0x21')](function(){if(_0x66eecd){_0x392250=_0x66eecd;return db[_0xaf77('0xd2')][_0xaf77('0x66')]({'where':{'active':!![]},'include':[{'model':db[_0xaf77('0xe2')],'as':_0xaf77('0xe3'),'raw':!![]}]});}})[_0xaf77('0x21')](function(_0x2099b6){if(_0x2099b6&&_0x2099b6[_0xaf77('0xe3')]&&_0x1b5d94['forwardOffline']&&_0x1b5d94[_0xaf77('0xe4')]){var _0x4ddae1={'tls':{'rejectUnauthorized':![]}};if(_0x2099b6[_0xaf77('0xe3')][_0xaf77('0xe5')]){_0x4ddae1[_0xaf77('0xe5')]=_0x2099b6[_0xaf77('0xe3')]['service'];}else{_0x4ddae1['host']=_0x2099b6[_0xaf77('0xe3')][_0xaf77('0xe6')];_0x4ddae1[_0xaf77('0xe7')]=_0x2099b6[_0xaf77('0xe3')]['port'];_0x4ddae1[_0xaf77('0xe8')]=_0x2099b6[_0xaf77('0xe3')]['secure'];}if(_0x2099b6['Smtp'][_0xaf77('0xe9')]){_0x4ddae1[_0xaf77('0xea')]={'user':_0x2099b6[_0xaf77('0xe3')][_0xaf77('0xeb')],'pass':_0x2099b6[_0xaf77('0xe3')][_0xaf77('0xec')]};}return respondWithRpcPromise(_0xaf77('0xed'),_0xaf77('0xee'),{'account':_0x4ddae1,'message':{'from':util[_0xaf77('0xb0')]('\x22%s\x22\x20<%s>',_0x2099b6['name'],_0x2099b6['email']||_0x2099b6[_0xaf77('0xe3')][_0xaf77('0xeb')]),'to':_0x1b5d94['forwardOfflineAddress'],'subject':_0x1b5d94[_0xaf77('0xef')],'html':_0x392250[_0xaf77('0x5c')],'attachments':_0x218f89}},client9003)[_0xaf77('0x21')](function(){return _0x392250;})['catch'](function(_0x212eea){console['error'](_0x212eea);});}})[_0xaf77('0x21')](function(){if(_0x1b5d94&&_0x1b5d94['openNewInteraction']&&_0x1b5d94[_0xaf77('0xf0')]){var _0x1d6332=[];if(_0xa8999a['length']){_0x1d6332=_0xa8999a[_0xaf77('0x3e')](function(_0x334f50){return{'name':_0x334f50[_0xaf77('0xf1')],'basename':_0x334f50[_0xaf77('0x74')],'type':_0x334f50[_0xaf77('0xda')],'ChatOfflineMessageId':_0x66eecd['id']};});}var _0x3fa5df;if(!_[_0xaf77('0x7e')](_0x1b5d94[_0xaf77('0xf2')])){var _0x2b5c9e=_[_0xaf77('0x3e')](_0x471de7[_0xaf77('0x5c')],function(_0x498142){return _0x498142;});var _0x3820c0=_[_0xaf77('0xf3')](_0x2b5c9e)[0x0];var _0x1d69a8=_[_0xaf77('0xf4')](_0x3820c0,function(_0x128279){return _0x128279;});_0x3fa5df=_0x1d69a8[0x1][_0x1b5d94['subjectOffline']];}var _0x28e88c={'from':_0x434edf[_0xaf77('0xf5')],'firstName':_0x434edf[_0xaf77('0xaa')],'lastName':_0x434edf[_0xaf77('0xab')],'mapKey':_0xaf77('0xf5'),'message':{'from':_0x434edf[_0xaf77('0xf5')],'to':_0x1b5d94['MailAccount']['email'],'cc':'','subject':_[_0xaf77('0x7e')](_0x3fa5df)?_0x1b5d94[_0xaf77('0xef')]:_0x3fa5df,'messageId':'','sentAt':new Date(),'attach':_0x1d6332['length'],'attachments':_0x1d6332,'originChannel':_0xaf77('0xf6'),'ChatWebsiteId':_0x1b5d94['id'],'ChatOfflineMessageId':_0x392250['id'],'originTo':_0x1b5d94[_0xaf77('0xd2')][_0xaf77('0xf5')]},'body':_0x392250['body']};var _0x4b20a6={'account':{'id':_0x1b5d94[_0xaf77('0xf0')]},'body':_0x28e88c,'log':_0xaf77('0xf7')};return respondWithRpcPromise('NotifyMailAccount',_0xaf77('0xf8'),_0x4b20a6,client9001)[_0xaf77('0x21')](function(){return _0x392250;})[_0xaf77('0x2b')](function(_0x4e1ed4){console['error'](_0x4e1ed4);});}return;})['then'](function(){if(_0x392250){return _0x392250;}})['then'](respondWithResult(_0x3c94d3,null))['catch'](function(_0x284664){console[_0xaf77('0x27')](_0xaf77('0x2b'),_0x284664);for(var _0x551279 of _0xa8999a){var _0x3c7fad=path[_0xaf77('0x79')](config[_0xaf77('0x7a')],'server',_0xaf77('0xcc'),_0xaf77('0xdc'),_0xaf77('0xdd'),_0x551279[_0xaf77('0x74')]);fs_extra[_0xaf77('0xf9')](_0x3c7fad)[_0xaf77('0x2b')](function(_0x17b194){console[_0xaf77('0x27')](_0xaf77('0xfa'),_0x3c7fad,_0x17b194);});}});};exports[_0xaf77('0xfb')]=function(_0x4fccf8,_0xf7f478,_0x367ec0){return db['ChatInteraction'][_0xaf77('0x5a')]({'where':{'id':_0x4fccf8['params']['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0xf7f478,null))[_0xaf77('0x21')](function(_0x483146){if(_0x483146){return _0x483146['addInteraction'](_0x4fccf8[_0xaf77('0x5c')][_0xaf77('0x70')],_[_0xaf77('0xfc')](_0x4fccf8[_0xaf77('0x5c')],['ids','id'])||{});}})[_0xaf77('0x21')](respondWithResult(_0xf7f478,null))[_0xaf77('0x2b')](handleError(_0xf7f478,null));};exports[_0xaf77('0xfd')]=function(_0x5b8d13,_0x1e3e62,_0xda940d){var _0x5232d9={'raw':![],'where':{}};var _0x42a64b={};var _0x5c334c={'count':0x0,'rows':[]};return db[_0xaf77('0x58')]['findOne']({'where':{'id':_0x5b8d13[_0xaf77('0x57')]['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x1e3e62,null))[_0xaf77('0x21')](function(_0x4ace10){if(_0x4ace10){_0x42a64b['model']=_['keys'](db['ChatInteraction'][_0xaf77('0x67')]);_0x42a64b[_0xaf77('0x42')]=_[_0xaf77('0x43')](_0x5b8d13[_0xaf77('0x42')]);_0x42a64b[_0xaf77('0x44')]=_[_0xaf77('0x45')](_0x42a64b['model'],_0x42a64b[_0xaf77('0x42')]);_0x5232d9[_0xaf77('0x46')]=_[_0xaf77('0x45')](_0x42a64b['model'],qs[_0xaf77('0x47')](_0x5b8d13[_0xaf77('0x42')]['fields']));_0x5232d9[_0xaf77('0x46')]=_0x5232d9['attributes'][_0xaf77('0x68')]?_0x5232d9[_0xaf77('0x46')]:_0x42a64b[_0xaf77('0x41')];if(!_0x5b8d13['query'][_0xaf77('0x48')](_0xaf77('0x49'))){_0x5232d9[_0xaf77('0x32')]=qs['limit'](_0x5b8d13['query'][_0xaf77('0x32')]);_0x5232d9[_0xaf77('0x30')]=qs[_0xaf77('0x30')](_0x5b8d13[_0xaf77('0x42')][_0xaf77('0x30')]);}_0x5232d9[_0xaf77('0x69')]=qs['sort'](_0x5b8d13['query'][_0xaf77('0x4a')]);_0x5232d9['where']=qs[_0xaf77('0x44')](_[_0xaf77('0x4b')](_0x5b8d13[_0xaf77('0x42')],_0x42a64b['filters']));_0x5232d9[_0xaf77('0x4d')][_0xaf77('0x6e')]=_0x4ace10['id'];if(_0x5b8d13[_0xaf77('0x42')]['filter']){_0x5232d9[_0xaf77('0x4d')]=_[_0xaf77('0x4e')](_0x5232d9[_0xaf77('0x4d')],{'$or':_['map'](_0x5232d9[_0xaf77('0x46')],function(_0x15d39a){var _0x4b12db={};_0x4b12db[_0x15d39a]={'$like':'%'+_0x5b8d13[_0xaf77('0x42')]['filter']+'%'};return _0x4b12db;})});}_0x5232d9=_[_0xaf77('0x4e')]({},_0x5232d9,_0x5b8d13[_0xaf77('0x59')]);return db['ChatInteraction']['count']({'where':_0x5232d9[_0xaf77('0x4d')]})[_0xaf77('0x21')](function(_0x12f71a){_0x5c334c['count']=_0x12f71a;if(_0x5b8d13[_0xaf77('0x42')][_0xaf77('0x52')]){_0x5232d9[_0xaf77('0x53')]=[{'model':db[_0xaf77('0x8d')],'as':_0xaf77('0xfe'),'required':![]},{'model':db['User'],'as':_0xaf77('0xff'),'attributes':['name','fullname',_0xaf77('0x100')],'required':![]},{'model':db[_0xaf77('0x101')],'as':_0xaf77('0x102'),'attributes':['id',_0xaf77('0x39'),'color'],'where':_0x5b8d13[_0xaf77('0x42')][_0xaf77('0x103')]?{'id':_0x5b8d13['query'][_0xaf77('0x103')]}:undefined,'required':_0x5b8d13[_0xaf77('0x42')]['tag']?!![]:![]}];}return db['ChatInteraction'][_0xaf77('0x54')](_0x5232d9);})[_0xaf77('0x21')](function(_0x256282){_0x5c334c[_0xaf77('0x55')]=_0x256282;return _0x5c334c;});}})[_0xaf77('0x21')](respondWithFilteredResult(_0x1e3e62,_0x5232d9))['catch'](handleError(_0x1e3e62,null));};function iftimePromise(_0x38e297,_0x36ab61){return respondWithRpcPromise('Command',_0xaf77('0x104'),{'command':_0x36ab61[_0xaf77('0x105')]?util[_0xaf77('0xb0')](_0xaf77('0x106'),_0x38e297['interval'],_0x36ab61['timezone']):util[_0xaf77('0xb0')]('iftime\x20%s',_0x38e297['interval'])},client9002)[_0xaf77('0x21')](function(_0xa9a313){var _0xc4d50f=_0xa9a313&&_0xa9a313[_0xaf77('0x107')](_0xaf77('0x108'))>=0x0?!![]:![];logger[_0xaf77('0x22')](_0xaf77('0x109'),_0x36ab61['id'],_0x38e297['id'],_0x38e297[_0xaf77('0x10a')],_0xc4d50f?'ONLINE':'OFFLINE',_0x36ab61[_0xaf77('0x105')]?_0x36ab61[_0xaf77('0x105')]:_0xaf77('0x10b'));return _0xc4d50f;})[_0xaf77('0x2b')](function(_0x4dcc7c){logger[_0xaf77('0x27')](_0xaf77('0x109'),_0x36ab61['id'],_0x38e297['id'],_0x38e297[_0xaf77('0x10a')],util[_0xaf77('0x10c')](_0x4dcc7c,{'showHidden':![],'depth':null}),_0x36ab61[_0xaf77('0x105')]?_0x36ab61[_0xaf77('0x105')]:_0xaf77('0x10b'));return![];});}exports[_0xaf77('0x104')]=function(_0x5b6e13,_0x28a226,_0x5c1c86){var _0x525653=0x0;var _0x4baa0f=0x0;var _0x46bee9=![];var _0x437a5b;var _0x1db6af;return db[_0xaf77('0x58')][_0xaf77('0x5a')]({'where':{'id':_0x5b6e13[_0xaf77('0x57')]['id']},'include':[{'model':db[_0xaf77('0x10d')],'as':_0xaf77('0x10d'),'include':[{'model':db[_0xaf77('0x10d')],'as':_0xaf77('0x10e'),'attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x28a226,null))[_0xaf77('0x21')](function(_0x312888){if(_0x312888){_0x437a5b=_0x312888;return _0x312888[_0xaf77('0x10f')]({'raw':!![]});}})[_0xaf77('0x21')](function(_0x4e5313){if(_0x437a5b){if(_0x4e5313){_0x1db6af=_0x4e5313;}}return require('../../config/license/util')[_0xaf77('0x7c')]();})['then'](function(_0x4efe27){if(_0x4efe27){_0x4baa0f=_0x4efe27[_0xaf77('0x110')];_0x46bee9=_0x4efe27['custom'];}})['then'](function(){return db[_0xaf77('0xb6')]['count']({'where':{'closed':![]}});})[_0xaf77('0x21')](function(_0x5cf6dc){_0x525653=_0x5cf6dc;if(_0x4baa0f&&_0x5cf6dc>_0x4baa0f){return db[_0xaf77('0x111')][_0xaf77('0x66')]({'where':{'id':0x1}})[_0xaf77('0x21')](function(_0x34a6fd){if(_0x34a6fd){_0x34a6fd[_0xaf77('0x112')](_0xaf77('0x113'));}});}})[_0xaf77('0x21')](function(){if(_0x437a5b['Interval']&&_0x437a5b[_0xaf77('0x10d')][_0xaf77('0x10e')]){var _0x55677c=[];for(var _0x4f13ca=0x0;_0x4f13ca<_0x437a5b['Interval'][_0xaf77('0x10e')][_0xaf77('0x68')];_0x4f13ca++){var _0x2adf92=_0x437a5b[_0xaf77('0x10d')][_0xaf77('0x10e')][_0x4f13ca][_0xaf77('0x36')]({'plain':!![]});_0x55677c[_0xaf77('0xbe')](iftimePromise(_0x2adf92,_0x437a5b));}return BPromise['all'](_0x55677c)[_0xaf77('0x21')](function(_0x367e32){return _[_0xaf77('0x114')](_0x367e32);});}else{return!![];}})['then'](function(_0xb5133d){var _0x266a4c=fs[_0xaf77('0xd5')](path['join'](config[_0xaf77('0x7a')],_0xaf77('0x115')),'utf8');var _0x405ddc={'remote':_0x437a5b[_0xaf77('0x116')],'query':querystring[_0xaf77('0x26')](_[_0xaf77('0x4e')](_0x437a5b[_0xaf77('0x36')]({'plain':!![]}),{'customerIp':_0x5b6e13['headers'][_0xaf77('0xa8')]||_0x5b6e13[_0xaf77('0xa6')][_0xaf77('0x117')]||_0x5b6e13['connection']['remoteAddress']||_0x5b6e13['ip'],'referer':_0x5b6e13['headers'][_0xaf77('0xad')],'openedInteractions':_0x525653,'maxInteractions':_0x4baa0f,'virtual':_0x46bee9[_0xaf77('0x110')],'online':_0xb5133d,'custom':_0x46bee9}))['replace'](/'/g,'\x5c\x27')};_0x28a226['send'](ejs[_0xaf77('0x118')](Mustache[_0xaf77('0x118')](_0x266a4c,_0x405ddc),{'proactiveActions':_0x1db6af,'alignment':_0x437a5b['alignment'],'verticalAlignment':_0x437a5b[_0xaf77('0x119')],'div_color':_0x437a5b['color'],'text_color':_0x437a5b[_0xaf77('0x11a')],'button_color':_0x437a5b[_0xaf77('0x11b')],'background_color':_0x437a5b[_0xaf77('0x11c')]}));})[_0xaf77('0x2b')](handleError(_0x28a226,null));};exports[_0xaf77('0x11d')]=function(_0x521377,_0x41865c,_0x413fe8){return db[_0xaf77('0x58')]['findOne']({'where':{'id':_0x521377[_0xaf77('0x57')]['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x41865c,null))[_0xaf77('0x21')](function(_0x3fda03){if(_0x3fda03){return db['sequelize'][_0xaf77('0xe0')](function(_0x12ab67){return db[_0xaf77('0x9d')][_0xaf77('0x35')]({'where':{'ChatWebsiteId':_0x521377[_0xaf77('0x57')]['id']},'transaction':_0x12ab67})[_0xaf77('0x21')](function(_0x2de891){var _0x4c20e2=_['map'](_0x521377[_0xaf77('0x5c')],function(_0xabe3b){_0xabe3b['ChatWebsiteId']=_0x521377[_0xaf77('0x57')]['id'];return _0xabe3b;});return db['ChatApplication'][_0xaf77('0x11e')](_0x4c20e2,{'transaction':_0x12ab67});});})['then'](function(){return db[_0xaf77('0x9d')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x521377[_0xaf77('0x57')]['id']},'order':_0xaf77('0xa1')});});}})[_0xaf77('0x21')](respondWithResult(_0x41865c,null))[_0xaf77('0x2b')](handleError(_0x41865c,null));};exports[_0xaf77('0x11f')]=function(_0x4bc531,_0x5e067d,_0x4b5c2b){var _0x5f2659={};var _0x42ac18={};var _0x2cfa0a;var _0x271908;return db[_0xaf77('0x58')][_0xaf77('0x66')]({'where':{'id':_0x4bc531[_0xaf77('0x57')]['id']}})['then'](handleEntityNotFound(_0x5e067d,null))['then'](function(_0x3b6a2f){if(_0x3b6a2f){_0x2cfa0a=_0x3b6a2f;_0x42ac18[_0xaf77('0x41')]=_[_0xaf77('0x43')](db['ChatApplication']['rawAttributes']);_0x42ac18[_0xaf77('0x42')]=_[_0xaf77('0x43')](_0x4bc531[_0xaf77('0x42')]);_0x42ac18[_0xaf77('0x44')]=_[_0xaf77('0x45')](_0x42ac18[_0xaf77('0x41')],_0x42ac18[_0xaf77('0x42')]);_0x5f2659['attributes']=_[_0xaf77('0x45')](_0x42ac18[_0xaf77('0x41')],qs['fields'](_0x4bc531[_0xaf77('0x42')][_0xaf77('0x47')]));_0x5f2659['attributes']=_0x5f2659[_0xaf77('0x46')][_0xaf77('0x68')]?_0x5f2659[_0xaf77('0x46')]:_0x42ac18['model'];_0x5f2659[_0xaf77('0x69')]=qs[_0xaf77('0x4a')](_0x4bc531[_0xaf77('0x42')][_0xaf77('0x4a')]);_0x5f2659[_0xaf77('0x4d')]=qs[_0xaf77('0x44')](_[_0xaf77('0x4b')](_0x4bc531[_0xaf77('0x42')],_0x42ac18['filters']));if(_0x4bc531['query'][_0xaf77('0x4c')]){_0x5f2659['where']=_[_0xaf77('0x4e')](_0x5f2659['where'],{'$or':_[_0xaf77('0x3e')](_0x5f2659['attributes'],function(_0x2349c6){var _0x157d43={};_0x157d43[_0x2349c6]={'$like':'%'+_0x4bc531[_0xaf77('0x42')][_0xaf77('0x4c')]+'%'};return _0x157d43;})});}_0x5f2659=_[_0xaf77('0x4e')]({},_0x5f2659,_0x4bc531['options']);return _0x2cfa0a[_0xaf77('0x11f')](_0x5f2659);}})[_0xaf77('0x21')](function(_0x2454ae){if(_0x2454ae){_0x271908=_0x2454ae[_0xaf77('0x68')];if(!_0x4bc531[_0xaf77('0x42')]['hasOwnProperty'](_0xaf77('0x49'))){_0x5f2659['limit']=qs['limit'](_0x4bc531['query'][_0xaf77('0x32')]);_0x5f2659[_0xaf77('0x30')]=qs[_0xaf77('0x30')](_0x4bc531['query'][_0xaf77('0x30')]);}return _0x2cfa0a['getApplications'](_0x5f2659);}})[_0xaf77('0x21')](function(_0x3b5255){if(_0x3b5255){return _0x3b5255?{'count':_0x271908,'rows':_0x3b5255}:null;}})['then'](respondWithResult(_0x5e067d,null))[_0xaf77('0x2b')](handleError(_0x5e067d,null));};exports[_0xaf77('0x120')]=function(_0x3cab4e,_0x98c13,_0x3ebc19){return db['chatProactiveAction'][_0xaf77('0x5a')]({'where':{'id':_0x3cab4e[_0xaf77('0x57')]['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x98c13,null))[_0xaf77('0x21')](function(_0x24bf71){if(_0x24bf71){return _0x24bf71[_0xaf77('0x120')](_0x3cab4e[_0xaf77('0x5c')][_0xaf77('0x70')],_[_0xaf77('0xfc')](_0x3cab4e['body'],[_0xaf77('0x70'),'id'])||{});}})[_0xaf77('0x21')](respondWithResult(_0x98c13,null))[_0xaf77('0x2b')](handleError(_0x98c13,null));};exports[_0xaf77('0x10f')]=function(_0x3d294c,_0x4072b1,_0x5829d6){var _0x3bd8c9={};var _0x42558a={};var _0x3c8b2b;var _0x31575f;return db[_0xaf77('0x58')][_0xaf77('0x66')]({'where':{'id':_0x3d294c['params']['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x4072b1,null))[_0xaf77('0x21')](function(_0x4682f6){if(_0x4682f6){_0x3c8b2b=_0x4682f6;_0x42558a[_0xaf77('0x41')]=_[_0xaf77('0x43')](db[_0xaf77('0x121')][_0xaf77('0x67')]);_0x42558a[_0xaf77('0x42')]=_[_0xaf77('0x43')](_0x3d294c[_0xaf77('0x42')]);_0x42558a[_0xaf77('0x44')]=_['intersection'](_0x42558a[_0xaf77('0x41')],_0x42558a[_0xaf77('0x42')]);_0x3bd8c9[_0xaf77('0x46')]=_[_0xaf77('0x45')](_0x42558a[_0xaf77('0x41')],qs[_0xaf77('0x47')](_0x3d294c['query'][_0xaf77('0x47')]));_0x3bd8c9[_0xaf77('0x46')]=_0x3bd8c9[_0xaf77('0x46')][_0xaf77('0x68')]?_0x3bd8c9[_0xaf77('0x46')]:_0x42558a['model'];_0x3bd8c9[_0xaf77('0x69')]=qs[_0xaf77('0x4a')](_0x3d294c['query'][_0xaf77('0x4a')]);_0x3bd8c9[_0xaf77('0x4d')]=qs[_0xaf77('0x44')](_[_0xaf77('0x4b')](_0x3d294c[_0xaf77('0x42')],_0x42558a[_0xaf77('0x44')]));if(_0x3d294c[_0xaf77('0x42')][_0xaf77('0x4c')]){_0x3bd8c9[_0xaf77('0x4d')]=_['merge'](_0x3bd8c9[_0xaf77('0x4d')],{'$or':_[_0xaf77('0x3e')](_0x3bd8c9[_0xaf77('0x46')],function(_0x350afe){var _0x528950={};_0x528950[_0x350afe]={'$like':'%'+_0x3d294c['query']['filter']+'%'};return _0x528950;})});}_0x3bd8c9=_[_0xaf77('0x4e')]({},_0x3bd8c9,_0x3d294c[_0xaf77('0x59')]);return _0x3c8b2b[_0xaf77('0x10f')](_0x3bd8c9);}})[_0xaf77('0x21')](function(_0x48e365){if(_0x48e365){_0x31575f=_0x48e365[_0xaf77('0x68')];if(!_0x3d294c[_0xaf77('0x42')][_0xaf77('0x48')](_0xaf77('0x49'))){_0x3bd8c9[_0xaf77('0x32')]=qs['limit'](_0x3d294c[_0xaf77('0x42')][_0xaf77('0x32')]);_0x3bd8c9['offset']=qs[_0xaf77('0x30')](_0x3d294c[_0xaf77('0x42')][_0xaf77('0x30')]);}return _0x3c8b2b[_0xaf77('0x10f')](_0x3bd8c9);}})[_0xaf77('0x21')](function(_0x69252b){if(_0x69252b){return _0x69252b?{'count':_0x31575f,'rows':_0x69252b}:null;}})[_0xaf77('0x21')](respondWithResult(_0x4072b1,null))[_0xaf77('0x2b')](handleError(_0x4072b1,null));};exports[_0xaf77('0x122')]=function(_0x5a7422,_0x642c,_0x35341d){var _0x2feb0a=_0x5a7422[_0xaf77('0x42')][_0xaf77('0x123')]===_0xaf77('0x124')?_0xaf77('0x125'):'onlineForm';return db['ChatWebsite'][_0xaf77('0x5a')]({'attributes':['id',_0x2feb0a],'where':{'id':_0x5a7422[_0xaf77('0x57')]['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x642c,null))[_0xaf77('0x21')](function(_0x484fae){if(_0x484fae){var _0x392ceb=_0x484fae[_0x2feb0a];var _0x577ed2=_0x392ceb&&_0x392ceb[_0xaf77('0x126')]?_0x392ceb[_0xaf77('0x126')]:[];_0x642c[_0xaf77('0x3a')]({'fromKey':_[_0xaf77('0x7e')](_0x392ceb[_0xaf77('0x127')])?undefined:_0x392ceb[_0xaf77('0x127')],'count':_0x577ed2[_0xaf77('0x68')],'rows':_0x577ed2});}})[_0xaf77('0x2b')](handleError(_0x642c,null));};exports[_0xaf77('0x128')]=function(_0x3e350d,_0x138e27,_0x46e69d){var _0x571049={'raw':![],'where':{}};var _0x497da2={};var _0x56f328={'count':0x0,'rows':[]};return db[_0xaf77('0x58')][_0xaf77('0x66')]({'where':{'id':_0x3e350d[_0xaf77('0x57')]['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x138e27,null))[_0xaf77('0x21')](function(_0x1b5981){if(_0x1b5981){_0x497da2[_0xaf77('0x41')]=_[_0xaf77('0x43')](db['ChatOfflineMessage']['rawAttributes']);_0x497da2[_0xaf77('0x42')]=_[_0xaf77('0x43')](_0x3e350d['query']);_0x497da2[_0xaf77('0x44')]=_[_0xaf77('0x45')](_0x497da2['model'],_0x497da2[_0xaf77('0x42')]);_0x571049['attributes']=_[_0xaf77('0x45')](_0x497da2[_0xaf77('0x41')],qs['fields'](_0x3e350d[_0xaf77('0x42')][_0xaf77('0x47')]));_0x571049[_0xaf77('0x46')]=_0x571049['attributes'][_0xaf77('0x68')]?_0x571049[_0xaf77('0x46')]:_0x497da2[_0xaf77('0x41')];if(!_0x3e350d[_0xaf77('0x42')]['hasOwnProperty'](_0xaf77('0x49'))){_0x571049['limit']=qs['limit'](_0x3e350d[_0xaf77('0x42')]['limit']);_0x571049['offset']=qs['offset'](_0x3e350d[_0xaf77('0x42')][_0xaf77('0x30')]);}_0x571049[_0xaf77('0x69')]=qs[_0xaf77('0x4a')](_0x3e350d[_0xaf77('0x42')]['sort']);_0x571049['where']=qs['filters'](_[_0xaf77('0x4b')](_0x3e350d[_0xaf77('0x42')],_0x497da2['filters']));_0x571049[_0xaf77('0x4d')][_0xaf77('0x6e')]=_0x1b5981['id'];if(_0x3e350d['query'][_0xaf77('0x4c')]){_0x571049['where']=_[_0xaf77('0x4e')](_0x571049[_0xaf77('0x4d')],{'$or':_['map'](_0x571049[_0xaf77('0x46')],function(_0x15265c){var _0x209d91={};_0x209d91[_0x15265c]={'$like':'%'+_0x3e350d[_0xaf77('0x42')][_0xaf77('0x4c')]+'%'};return _0x209d91;})});}_0x571049=_['merge']({},_0x571049,_0x3e350d[_0xaf77('0x59')]);return db[_0xaf77('0xd9')][_0xaf77('0x51')]({'where':_0x571049[_0xaf77('0x4d')]})[_0xaf77('0x21')](function(_0x496f6e){_0x56f328[_0xaf77('0x51')]=_0x496f6e;if(_0x3e350d['query']['includeAll']){_0x571049[_0xaf77('0x53')]=[{'all':!![]}];}else{_0x571049[_0xaf77('0x53')]=[{'model':db[_0xaf77('0x8d')],'as':_0xaf77('0xfe'),'required':![]},{'model':db[_0xaf77('0xe1')],'as':_0xaf77('0x129'),'required':![]}];}return db[_0xaf77('0xd9')][_0xaf77('0x54')](_0x571049);})[_0xaf77('0x21')](function(_0x5797c9){_0x56f328[_0xaf77('0x55')]=_0x5797c9;return _0x56f328;});}})[_0xaf77('0x21')](respondWithFilteredResult(_0x138e27,_0x571049))[_0xaf77('0x2b')](handleError(_0x138e27,null));};exports['addAgents']=function(_0xd597d4,_0x56e77a,_0x2beb72){return db[_0xaf77('0x58')][_0xaf77('0x5a')]({'where':{'id':_0xd597d4[_0xaf77('0x57')]['id']}})['then'](handleEntityNotFound(_0x56e77a,null))[_0xaf77('0x21')](function(_0x1b3755){if(_0x1b3755){return _0x1b3755[_0xaf77('0x12a')](_0xd597d4[_0xaf77('0x5c')]['ids'],_[_0xaf77('0xfc')](_0xd597d4['body'],['ids','id'])||{})[_0xaf77('0xba')](function(_0x1d448a){for(var _0x26038b=0x0;_0x26038b<_0xd597d4['body'][_0xaf77('0x70')][_0xaf77('0x68')];_0x26038b+=0x1){socket[_0xaf77('0x12b')](_0xaf77('0x12c'),{'UserId':Number(_0xd597d4['body']['ids'][_0x26038b]),'ChatWebsiteId':Number(_0xd597d4[_0xaf77('0x57')]['id'])});}return _0x1d448a;});}})[_0xaf77('0x21')](respondWithResult(_0x56e77a,null))['catch'](handleError(_0x56e77a,null));};exports[_0xaf77('0x12d')]=function(_0x287c89,_0x4a5282,_0x2175a7){return db[_0xaf77('0x58')][_0xaf77('0x5a')]({'where':{'id':_0x287c89[_0xaf77('0x57')]['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x4a5282,null))[_0xaf77('0x21')](function(_0xe02d0e){if(_0xe02d0e){return _0xe02d0e['removeAgents'](_0x287c89[_0xaf77('0x42')][_0xaf77('0x70')])[_0xaf77('0x21')](function(){if(_[_0xaf77('0x12e')](_0x287c89['query'][_0xaf77('0x70')])){for(var _0x522161=0x0;_0x522161<_0x287c89[_0xaf77('0x42')]['ids'][_0xaf77('0x68')];_0x522161+=0x1){socket['emit'](_0xaf77('0x12f'),{'UserId':Number(_0x287c89[_0xaf77('0x42')][_0xaf77('0x70')][_0x522161]),'ChatWebsiteId':Number(_0x287c89[_0xaf77('0x57')]['id'])});}}else{socket[_0xaf77('0x12b')](_0xaf77('0x12f'),{'UserId':Number(_0x287c89['query'][_0xaf77('0x70')]),'ChatWebsiteId':Number(_0x287c89[_0xaf77('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x4a5282,null))[_0xaf77('0x2b')](handleError(_0x4a5282,null));};exports[_0xaf77('0x130')]=function(_0x432573,_0x29f23f,_0x5361ee){var _0x207e2e={};var _0x2d12d8={};var _0x26a3d9;var _0x3fe11d;return db[_0xaf77('0x58')][_0xaf77('0x66')]({'where':{'id':_0x432573[_0xaf77('0x57')]['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x29f23f,null))[_0xaf77('0x21')](function(_0x5829c1){if(_0x5829c1){_0x26a3d9=_0x5829c1;_0x2d12d8[_0xaf77('0x41')]=_['keys'](db[_0xaf77('0xc1')][_0xaf77('0x67')]);_0x2d12d8['query']=_[_0xaf77('0x43')](_0x432573[_0xaf77('0x42')]);_0x2d12d8[_0xaf77('0x44')]=_['intersection'](_0x2d12d8[_0xaf77('0x41')],_0x2d12d8[_0xaf77('0x42')]);_0x207e2e[_0xaf77('0x46')]=_[_0xaf77('0x45')](_0x2d12d8[_0xaf77('0x41')],qs[_0xaf77('0x47')](_0x432573[_0xaf77('0x42')][_0xaf77('0x47')]));_0x207e2e[_0xaf77('0x46')]=_0x207e2e[_0xaf77('0x46')][_0xaf77('0x68')]?_0x207e2e[_0xaf77('0x46')]:_0x2d12d8['model'];_0x207e2e[_0xaf77('0x69')]=qs['sort'](_0x432573['query']['sort']);_0x207e2e[_0xaf77('0x4d')]=qs[_0xaf77('0x44')](_['pick'](_0x432573[_0xaf77('0x42')],_0x2d12d8[_0xaf77('0x44')]));if(_0x432573['query'][_0xaf77('0x4c')]){_0x207e2e['where']=_[_0xaf77('0x4e')](_0x207e2e['where'],{'$or':_[_0xaf77('0x3e')](_0x207e2e['attributes'],function(_0x2f4db6){var _0x21eb05={};_0x21eb05[_0x2f4db6]={'$like':'%'+_0x432573[_0xaf77('0x42')][_0xaf77('0x4c')]+'%'};return _0x21eb05;})});}_0x207e2e=_[_0xaf77('0x4e')]({},_0x207e2e,_0x432573[_0xaf77('0x59')]);return _0x26a3d9[_0xaf77('0x130')](_0x207e2e);}})[_0xaf77('0x21')](function(_0x549011){if(_0x549011){_0x3fe11d=_0x549011['length'];if(!_0x432573[_0xaf77('0x42')][_0xaf77('0x48')]('nolimit')){_0x207e2e[_0xaf77('0x32')]=qs[_0xaf77('0x32')](_0x432573[_0xaf77('0x42')][_0xaf77('0x32')]);_0x207e2e['offset']=qs[_0xaf77('0x30')](_0x432573['query'][_0xaf77('0x30')]);}return _0x26a3d9['getAgents'](_0x207e2e);}})[_0xaf77('0x21')](function(_0x3bf581){if(_0x3bf581){return _0x3bf581?{'count':_0x3fe11d,'rows':_0x3bf581}:null;}})[_0xaf77('0x21')](respondWithResult(_0x29f23f,null))[_0xaf77('0x2b')](handleError(_0x29f23f,null));}; \ No newline at end of file +var _0x8e3f=['getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','list','orderBy','priority','asc','contact','customerIp','headers','cf-connecting-ip','first','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','device','vendor','threadId','ChatInteraction','ContactId','interaction','spread','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','User','UserId','unshift','agent','Start','startRouting','offline','files','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','originalname','attachments','offline-chat','basename','sequelize','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','subjectOffline','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','fullname','internal','Tag','Tags','color','tag','timezone','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','No\x20timezone','Interval','Intervals','getProactiveActions','custom','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','virtual','replace','alignment','verticalAlignment','color_button','backgroundColor','transaction','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','items','getOfflineMessages','Attachments','ChatOfflineMessage','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','ChatWebsite,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','then','destroy','get','UserProfileResource','end','stack','send','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','name','options','includeAll','include','findAll','params','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','ChatWebsiteId','findOne','Disposition','rows','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','addLogo','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','sitepic','getLicense','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x8e3f,0x1ce));var _0xf8e3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8e3f[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xf8e3('0x0'));var rimraf=require(_0xf8e3('0x1'));var zipdir=require(_0xf8e3('0x2'));var jsonpatch=require(_0xf8e3('0x3'));var rp=require(_0xf8e3('0x4'));var moment=require('moment');var BPromise=require(_0xf8e3('0x5'));var Mustache=require(_0xf8e3('0x6'));var util=require(_0xf8e3('0x7'));var path=require(_0xf8e3('0x8'));var sox=require(_0xf8e3('0x9'));var csv=require(_0xf8e3('0xa'));var ejs=require(_0xf8e3('0xb'));var fs=require('fs');var fs_extra=require(_0xf8e3('0xc'));var _=require(_0xf8e3('0xd'));var squel=require(_0xf8e3('0xe'));var crypto=require(_0xf8e3('0xf'));var jsforce=require(_0xf8e3('0x10'));var deskjs=require(_0xf8e3('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf8e3('0x12'));var Redis=require('ioredis');var authService=require(_0xf8e3('0x13'));var qs=require(_0xf8e3('0x14'));var as=require(_0xf8e3('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf8e3('0x16'));var utils=require(_0xf8e3('0x17'));var config=require(_0xf8e3('0x18'));var licenseUtil=require(_0xf8e3('0x19'));var db=require(_0xf8e3('0x1a'))['db'];config[_0xf8e3('0x1b')]=_[_0xf8e3('0x1c')](config[_0xf8e3('0x1b')],{'host':_0xf8e3('0x1d'),'port':0x18eb});var socket=require(_0xf8e3('0x1e'))(new Redis(config[_0xf8e3('0x1b')]));require('./chatWebsite.socket')[_0xf8e3('0x1f')](socket);var jayson=require(_0xf8e3('0x20'));var client=jayson[_0xf8e3('0x21')][_0xf8e3('0x22')]({'port':0x232c});var client9002=jayson[_0xf8e3('0x21')]['http']({'port':0x232a});var client9003=jayson['client'][_0xf8e3('0x22')]({'port':0x232b});var client9001=jayson['client'][_0xf8e3('0x22')]({'port':0x2329});function respondWithRpcPromise(_0x1801f0,_0x291557,_0x3d439b,_0x2476b0){return new BPromise(function(_0x44fe1d,_0x58e0c8){var _0x31cea8=_0x2476b0||client;return _0x31cea8[_0xf8e3('0x23')](_0x1801f0,_0x3d439b)['then'](function(_0x28310c){logger[_0xf8e3('0x24')](_0xf8e3('0x25'),_0x291557,'request\x20sent');logger[_0xf8e3('0x26')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x291557,'request\x20sent',JSON[_0xf8e3('0x27')](_0x28310c));if(_0x28310c[_0xf8e3('0x28')]){if(_0x28310c[_0xf8e3('0x28')]['code']===0x1f4){logger['error'](_0xf8e3('0x25'),_0x291557,_0x28310c[_0xf8e3('0x28')][_0xf8e3('0x29')]);return _0x58e0c8(_0x28310c[_0xf8e3('0x28')][_0xf8e3('0x29')]);}logger[_0xf8e3('0x28')](_0xf8e3('0x25'),_0x291557,_0x28310c[_0xf8e3('0x28')][_0xf8e3('0x29')]);return _0x44fe1d(_0x28310c[_0xf8e3('0x28')][_0xf8e3('0x29')]);}else{logger['info'](_0xf8e3('0x25'),_0x291557,_0xf8e3('0x2a'));_0x44fe1d(_0x28310c[_0xf8e3('0x2b')][_0xf8e3('0x29')]);}})['catch'](function(_0x1dd750){logger['error'](_0xf8e3('0x25'),_0x291557,_0x1dd750);_0x58e0c8(_0x1dd750);});});}function respondWithStatusCode(_0x587991,_0x433651){_0x433651=_0x433651||0xcc;return function(_0x330bf9){if(_0x330bf9){return _0x587991[_0xf8e3('0x2c')](_0x433651);}return _0x587991[_0xf8e3('0x2d')](_0x433651)['end']();};}function respondWithResult(_0x130ff7,_0x3f21a5){_0x3f21a5=_0x3f21a5||0xc8;return function(_0x387a0d){if(_0x387a0d){return _0x130ff7['status'](_0x3f21a5)[_0xf8e3('0x2e')](_0x387a0d);}};}function respondWithFilteredResult(_0x2ddcc6,_0x34583b){return function(_0x53d0c0){if(_0x53d0c0){var _0x51173c=typeof _0x34583b[_0xf8e3('0x2f')]==='undefined'&&typeof _0x34583b[_0xf8e3('0x30')]===_0xf8e3('0x31');var _0x2a1d81=_0x53d0c0[_0xf8e3('0x32')];var _0x2feb9d=_0x51173c?0x0:_0x34583b[_0xf8e3('0x2f')];var _0x210fb4=_0x51173c?_0x53d0c0[_0xf8e3('0x32')]:_0x34583b[_0xf8e3('0x2f')]+_0x34583b[_0xf8e3('0x30')];var _0x573156;if(_0x210fb4>=_0x2a1d81){_0x210fb4=_0x2a1d81;_0x573156=0xc8;}else{_0x573156=0xce;}_0x2ddcc6[_0xf8e3('0x2d')](_0x573156);return _0x2ddcc6[_0xf8e3('0x33')]('Content-Range',_0x2feb9d+'-'+_0x210fb4+'/'+_0x2a1d81)['json'](_0x53d0c0);}return null;};}function patchUpdates(_0x2e5957){return function(_0x1922a9){try{jsonpatch[_0xf8e3('0x34')](_0x1922a9,_0x2e5957,!![]);}catch(_0x4e9d19){return BPromise[_0xf8e3('0x35')](_0x4e9d19);}return _0x1922a9['save']();};}function saveUpdates(_0x2e65d8,_0x504948){return function(_0x2142c8){if(_0x2142c8){return _0x2142c8['update'](_0x2e65d8)[_0xf8e3('0x36')](function(_0x3946b6){return _0x3946b6;});}return null;};}function removeEntity(_0x51e5ff,_0x13bc19){return function(_0x3decc3){if(_0x3decc3){return _0x3decc3[_0xf8e3('0x37')]()[_0xf8e3('0x36')](function(){var _0x1862c1=_0x3decc3[_0xf8e3('0x38')]({'plain':!![]});var _0x27ca77='ChatWebsites';return db[_0xf8e3('0x39')]['destroy']({'where':{'type':_0x27ca77,'resourceId':_0x1862c1['id']}})[_0xf8e3('0x36')](function(){return _0x3decc3;});})[_0xf8e3('0x36')](function(){_0x51e5ff[_0xf8e3('0x2d')](0xcc)[_0xf8e3('0x3a')]();});}};}function handleEntityNotFound(_0x218c63,_0x48a81e){return function(_0x51e402){if(!_0x51e402){_0x218c63['sendStatus'](0x194);}return _0x51e402;};}function handleError(_0x531047,_0x577a3b){_0x577a3b=_0x577a3b||0x1f4;return function(_0x2b41b3){logger[_0xf8e3('0x28')](_0x2b41b3[_0xf8e3('0x3b')]);if(_0x2b41b3['name']){delete _0x2b41b3['name'];}_0x531047['status'](_0x577a3b)[_0xf8e3('0x3c')](_0x2b41b3);};}exports['index']=function(_0x383a99,_0xc3c26c){var _0x54f850={'include':[{'model':db[_0xf8e3('0x3d')],'as':_0xf8e3('0x3e')}]},_0x50472a={},_0x1e7e35={'count':0x0,'rows':[]};var _0x3e0e28=_[_0xf8e3('0x3f')](db[_0xf8e3('0x40')][_0xf8e3('0x41')],function(_0x4191c0){return{'name':_0x4191c0[_0xf8e3('0x42')],'type':_0x4191c0[_0xf8e3('0x43')]['key']};});_0x50472a[_0xf8e3('0x44')]=_[_0xf8e3('0x3f')](_0x3e0e28,'name');_0x50472a[_0xf8e3('0x45')]=_[_0xf8e3('0x46')](_0x383a99[_0xf8e3('0x45')]);_0x50472a[_0xf8e3('0x47')]=_['intersection'](_0x50472a[_0xf8e3('0x44')],_0x50472a[_0xf8e3('0x45')]);_0x54f850['attributes']=_[_0xf8e3('0x48')](_0x50472a[_0xf8e3('0x44')],qs[_0xf8e3('0x49')](_0x383a99[_0xf8e3('0x45')][_0xf8e3('0x49')]));_0x54f850[_0xf8e3('0x4a')]=_0x54f850[_0xf8e3('0x4a')][_0xf8e3('0x4b')]?_0x54f850['attributes']:_0x50472a[_0xf8e3('0x44')];if(!_0x383a99[_0xf8e3('0x45')][_0xf8e3('0x4c')](_0xf8e3('0x4d'))){_0x54f850[_0xf8e3('0x30')]=qs['limit'](_0x383a99['query'][_0xf8e3('0x30')]);_0x54f850[_0xf8e3('0x2f')]=qs[_0xf8e3('0x2f')](_0x383a99[_0xf8e3('0x45')][_0xf8e3('0x2f')]);}_0x54f850[_0xf8e3('0x4e')]=qs['sort'](_0x383a99[_0xf8e3('0x45')][_0xf8e3('0x4f')]);_0x54f850[_0xf8e3('0x50')]=qs[_0xf8e3('0x47')](_[_0xf8e3('0x51')](_0x383a99[_0xf8e3('0x45')],_0x50472a[_0xf8e3('0x47')]),_0x3e0e28);if(_0x383a99['query'][_0xf8e3('0x52')]){_0x54f850['where']=_[_0xf8e3('0x53')](_0x54f850[_0xf8e3('0x50')],{'$or':_[_0xf8e3('0x3f')](_0x3e0e28,function(_0x138838){if(_0x138838[_0xf8e3('0x43')]!=='VIRTUAL'){var _0xccb5c4={};_0xccb5c4[_0x138838[_0xf8e3('0x54')]]={'$like':'%'+_0x383a99['query'][_0xf8e3('0x52')]+'%'};return _0xccb5c4;}})});}_0x54f850=_[_0xf8e3('0x53')]({},_0x54f850,_0x383a99[_0xf8e3('0x55')]);var _0x348d2f={'where':_0x54f850[_0xf8e3('0x50')]};return db['ChatWebsite']['count'](_0x348d2f)[_0xf8e3('0x36')](function(_0x5dc652){_0x1e7e35[_0xf8e3('0x32')]=_0x5dc652;if(_0x383a99[_0xf8e3('0x45')][_0xf8e3('0x56')]){_0x54f850[_0xf8e3('0x57')]=[{'all':!![]}];}return db[_0xf8e3('0x40')][_0xf8e3('0x58')](_0x54f850);})[_0xf8e3('0x36')](function(_0x4c9cb9){_0x1e7e35['rows']=_0x4c9cb9;return _0x1e7e35;})[_0xf8e3('0x36')](respondWithFilteredResult(_0xc3c26c,_0x54f850))['catch'](handleError(_0xc3c26c,null));};exports['show']=function(_0x301177,_0x4c3764){var _0x2dde3f={'raw':![],'where':{'id':_0x301177[_0xf8e3('0x59')]['id']},'include':[{'model':db[_0xf8e3('0x3d')],'as':_0xf8e3('0x3e')}]},_0x2411b0={};_0x2411b0[_0xf8e3('0x44')]=_['keys'](db[_0xf8e3('0x40')]['rawAttributes']);_0x2411b0[_0xf8e3('0x45')]=_[_0xf8e3('0x46')](_0x301177[_0xf8e3('0x45')]);_0x2411b0[_0xf8e3('0x47')]=_[_0xf8e3('0x48')](_0x2411b0[_0xf8e3('0x44')],_0x2411b0[_0xf8e3('0x45')]);_0x2dde3f[_0xf8e3('0x4a')]=_['intersection'](_0x2411b0[_0xf8e3('0x44')],qs[_0xf8e3('0x49')](_0x301177[_0xf8e3('0x45')]['fields']));_0x2dde3f[_0xf8e3('0x4a')]=_0x2dde3f[_0xf8e3('0x4a')]['length']?_0x2dde3f[_0xf8e3('0x4a')]:_0x2411b0[_0xf8e3('0x44')];if(_0x301177[_0xf8e3('0x45')][_0xf8e3('0x56')]){_0x2dde3f[_0xf8e3('0x57')]=[{'all':!![]}];}_0x2dde3f=_[_0xf8e3('0x53')]({},_0x2dde3f,_0x301177['options']);return db[_0xf8e3('0x40')][_0xf8e3('0x5a')](_0x2dde3f)[_0xf8e3('0x36')](handleEntityNotFound(_0x4c3764,null))['then'](respondWithResult(_0x4c3764,null))[_0xf8e3('0x5b')](handleError(_0x4c3764,null));};exports[_0xf8e3('0x5c')]=function(_0x553ffa,_0x232f5f){return db[_0xf8e3('0x40')]['create'](_0x553ffa[_0xf8e3('0x5d')],{})[_0xf8e3('0x36')](function(_0x2be407){var _0x5ea530=_0x553ffa[_0xf8e3('0x5e')]['get']({'plain':!![]});if(!_0x5ea530)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ea530[_0xf8e3('0x5f')]===_0xf8e3('0x5e')){var _0xf05f28=_0x2be407[_0xf8e3('0x38')]({'plain':!![]});var _0x14b147='ChatWebsites';return db[_0xf8e3('0x60')]['find']({'where':{'name':_0x14b147,'userProfileId':_0x5ea530[_0xf8e3('0x61')]},'raw':!![]})[_0xf8e3('0x36')](function(_0x5bdbee){if(_0x5bdbee&&_0x5bdbee[_0xf8e3('0x62')]===0x0){return db[_0xf8e3('0x39')][_0xf8e3('0x5c')]({'name':_0xf05f28[_0xf8e3('0x54')],'resourceId':_0xf05f28['id'],'type':_0x5bdbee['name'],'sectionId':_0x5bdbee['id']},{})['then'](function(){return _0x2be407;});}else{return _0x2be407;}})[_0xf8e3('0x5b')](function(_0x27be7a){logger[_0xf8e3('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27be7a);throw _0x27be7a;});}return _0x2be407;})['then'](respondWithResult(_0x232f5f,0xc9))[_0xf8e3('0x5b')](handleError(_0x232f5f,null));};exports['update']=function(_0x7d575b,_0x52297b){if(_0x7d575b['body']['id']){delete _0x7d575b[_0xf8e3('0x5d')]['id'];}return db['ChatWebsite'][_0xf8e3('0x5a')]({'where':{'id':_0x7d575b[_0xf8e3('0x59')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x52297b,null))[_0xf8e3('0x36')](saveUpdates(_0x7d575b[_0xf8e3('0x5d')],null))[_0xf8e3('0x36')](respondWithResult(_0x52297b,null))[_0xf8e3('0x5b')](handleError(_0x52297b,null));};exports[_0xf8e3('0x37')]=function(_0x5ced2a,_0x12d5a6){return db['ChatWebsite'][_0xf8e3('0x5a')]({'where':{'id':_0x5ced2a[_0xf8e3('0x59')]['id']}})['then'](handleEntityNotFound(_0x12d5a6,null))[_0xf8e3('0x36')](removeEntity(_0x12d5a6,null))[_0xf8e3('0x5b')](handleError(_0x12d5a6,null));};exports[_0xf8e3('0x63')]=function(_0x307cb7,_0x364f30){return db[_0xf8e3('0x40')]['describe']()[_0xf8e3('0x36')](respondWithResult(_0x364f30,null))[_0xf8e3('0x5b')](handleError(_0x364f30,null));};exports[_0xf8e3('0x64')]=function(_0x33a0fa,_0x2b88c3,_0x3a5657){if(_0x33a0fa[_0xf8e3('0x5d')]['id']){delete _0x33a0fa['body']['id'];}return db[_0xf8e3('0x40')][_0xf8e3('0x5a')]({'where':{'id':_0x33a0fa[_0xf8e3('0x59')]['id']}})[_0xf8e3('0x36')](handleEntityNotFound(_0x2b88c3,null))[_0xf8e3('0x36')](function(_0x17a404){if(_0x17a404){_0x33a0fa[_0xf8e3('0x5d')][_0xf8e3('0x65')]=_0x17a404['id'];return db['Disposition']['create'](_0x33a0fa[_0xf8e3('0x5d')]);}})[_0xf8e3('0x36')](respondWithResult(_0x2b88c3,null))[_0xf8e3('0x5b')](handleError(_0x2b88c3,null));};exports['getDispositions']=function(_0xe00884,_0x49c37f,_0x8b3037){var _0x103432={'raw':![],'where':{}};var _0x54c0e8={};var _0x13921b={'count':0x0,'rows':[]};return db[_0xf8e3('0x40')][_0xf8e3('0x66')]({'where':{'id':_0xe00884[_0xf8e3('0x59')]['id']}})[_0xf8e3('0x36')](handleEntityNotFound(_0x49c37f,null))[_0xf8e3('0x36')](function(_0x1addcf){if(_0x1addcf){_0x54c0e8[_0xf8e3('0x44')]=_['keys'](db[_0xf8e3('0x67')][_0xf8e3('0x41')]);_0x54c0e8[_0xf8e3('0x45')]=_['keys'](_0xe00884['query']);_0x54c0e8[_0xf8e3('0x47')]=_['intersection'](_0x54c0e8['model'],_0x54c0e8[_0xf8e3('0x45')]);_0x103432['attributes']=_[_0xf8e3('0x48')](_0x54c0e8[_0xf8e3('0x44')],qs[_0xf8e3('0x49')](_0xe00884['query']['fields']));_0x103432[_0xf8e3('0x4a')]=_0x103432[_0xf8e3('0x4a')][_0xf8e3('0x4b')]?_0x103432['attributes']:_0x54c0e8[_0xf8e3('0x44')];if(!_0xe00884['query'][_0xf8e3('0x4c')](_0xf8e3('0x4d'))){_0x103432[_0xf8e3('0x30')]=qs[_0xf8e3('0x30')](_0xe00884[_0xf8e3('0x45')][_0xf8e3('0x30')]);_0x103432[_0xf8e3('0x2f')]=qs[_0xf8e3('0x2f')](_0xe00884[_0xf8e3('0x45')][_0xf8e3('0x2f')]);}_0x103432[_0xf8e3('0x4e')]=qs[_0xf8e3('0x4f')](_0xe00884[_0xf8e3('0x45')]['sort']);_0x103432[_0xf8e3('0x50')]=qs[_0xf8e3('0x47')](_['pick'](_0xe00884[_0xf8e3('0x45')],_0x54c0e8[_0xf8e3('0x47')]));_0x103432[_0xf8e3('0x50')]['ChatWebsiteId']=_0x1addcf['id'];if(_0xe00884[_0xf8e3('0x45')]['filter']){_0x103432[_0xf8e3('0x50')]=_[_0xf8e3('0x53')](_0x103432[_0xf8e3('0x50')],{'$or':_[_0xf8e3('0x3f')](_0x103432['attributes'],function(_0x47e0e7){var _0x3305ea={};_0x3305ea[_0x47e0e7]={'$like':'%'+_0xe00884[_0xf8e3('0x45')][_0xf8e3('0x52')]+'%'};return _0x3305ea;})});}_0x103432=_[_0xf8e3('0x53')]({},_0x103432,_0xe00884[_0xf8e3('0x55')]);return db[_0xf8e3('0x67')]['count']({'where':_0x103432[_0xf8e3('0x50')]})[_0xf8e3('0x36')](function(_0x2eebe8){_0x13921b[_0xf8e3('0x32')]=_0x2eebe8;if(_0xe00884[_0xf8e3('0x45')]['includeAll']){_0x103432[_0xf8e3('0x57')]=[{'all':!![]}];}return db[_0xf8e3('0x67')][_0xf8e3('0x58')](_0x103432);})[_0xf8e3('0x36')](function(_0x4af349){_0x13921b[_0xf8e3('0x68')]=_0x4af349;return _0x13921b;});}})[_0xf8e3('0x36')](respondWithFilteredResult(_0x49c37f,_0x103432))[_0xf8e3('0x5b')](handleError(_0x49c37f,null));};exports[_0xf8e3('0x69')]=function(_0x209915,_0x10a447,_0x1a9ae6){return db['ChatWebsite'][_0xf8e3('0x5a')]({'where':{'id':_0x209915[_0xf8e3('0x59')]['id']}})[_0xf8e3('0x36')](handleEntityNotFound(_0x10a447,null))[_0xf8e3('0x36')](function(_0x35c6c0){if(_0x35c6c0){return _0x35c6c0[_0xf8e3('0x69')](_0x209915[_0xf8e3('0x45')][_0xf8e3('0x6a')]);}})[_0xf8e3('0x36')](respondWithStatusCode(_0x10a447,null))['catch'](handleError(_0x10a447,null));};exports['addAnswer']=function(_0x342505,_0x2cbcd0,_0x3c4cc3){if(_0x342505[_0xf8e3('0x5d')]['id']){delete _0x342505[_0xf8e3('0x5d')]['id'];}return db[_0xf8e3('0x40')][_0xf8e3('0x5a')]({'where':{'id':_0x342505[_0xf8e3('0x59')]['id']}})[_0xf8e3('0x36')](handleEntityNotFound(_0x2cbcd0,null))[_0xf8e3('0x36')](function(_0x206a23){if(_0x206a23){_0x342505['body']['ChatWebsiteId']=_0x206a23['id'];return db['CannedAnswer'][_0xf8e3('0x5c')](_0x342505[_0xf8e3('0x5d')]);}})['then'](respondWithResult(_0x2cbcd0,null))[_0xf8e3('0x5b')](handleError(_0x2cbcd0,null));};exports[_0xf8e3('0x6b')]=function(_0x7b90ff,_0x3e6ed9,_0x4eb850){var _0x3b0944={'raw':![],'where':{}};var _0xf239e5={};var _0x17121d={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x7b90ff[_0xf8e3('0x59')]['id']}})[_0xf8e3('0x36')](handleEntityNotFound(_0x3e6ed9,null))['then'](function(_0x52318e){if(_0x52318e){_0xf239e5[_0xf8e3('0x44')]=_['keys'](db['CannedAnswer'][_0xf8e3('0x41')]);_0xf239e5[_0xf8e3('0x45')]=_[_0xf8e3('0x46')](_0x7b90ff[_0xf8e3('0x45')]);_0xf239e5[_0xf8e3('0x47')]=_[_0xf8e3('0x48')](_0xf239e5['model'],_0xf239e5[_0xf8e3('0x45')]);_0x3b0944[_0xf8e3('0x4a')]=_[_0xf8e3('0x48')](_0xf239e5[_0xf8e3('0x44')],qs[_0xf8e3('0x49')](_0x7b90ff[_0xf8e3('0x45')][_0xf8e3('0x49')]));_0x3b0944[_0xf8e3('0x4a')]=_0x3b0944[_0xf8e3('0x4a')][_0xf8e3('0x4b')]?_0x3b0944['attributes']:_0xf239e5['model'];if(!_0x7b90ff[_0xf8e3('0x45')]['hasOwnProperty'](_0xf8e3('0x4d'))){_0x3b0944[_0xf8e3('0x30')]=qs[_0xf8e3('0x30')](_0x7b90ff[_0xf8e3('0x45')]['limit']);_0x3b0944[_0xf8e3('0x2f')]=qs[_0xf8e3('0x2f')](_0x7b90ff[_0xf8e3('0x45')]['offset']);}_0x3b0944[_0xf8e3('0x4e')]=qs[_0xf8e3('0x4f')](_0x7b90ff[_0xf8e3('0x45')]['sort']);_0x3b0944['where']=qs['filters'](_[_0xf8e3('0x51')](_0x7b90ff[_0xf8e3('0x45')],_0xf239e5['filters']));_0x3b0944[_0xf8e3('0x50')][_0xf8e3('0x65')]=_0x52318e['id'];if(_0x7b90ff['query']['filter']){_0x3b0944[_0xf8e3('0x50')]=_['merge'](_0x3b0944[_0xf8e3('0x50')],{'$or':_[_0xf8e3('0x3f')](_0x3b0944[_0xf8e3('0x4a')],function(_0x53f9f5){var _0x14044e={};_0x14044e[_0x53f9f5]={'$like':'%'+_0x7b90ff[_0xf8e3('0x45')][_0xf8e3('0x52')]+'%'};return _0x14044e;})});}_0x3b0944=_[_0xf8e3('0x53')]({},_0x3b0944,_0x7b90ff['options']);return db[_0xf8e3('0x6c')][_0xf8e3('0x32')]({'where':_0x3b0944[_0xf8e3('0x50')]})[_0xf8e3('0x36')](function(_0x195dca){_0x17121d['count']=_0x195dca;if(_0x7b90ff[_0xf8e3('0x45')][_0xf8e3('0x56')]){_0x3b0944['include']=[{'all':!![]}];}return db[_0xf8e3('0x6c')]['findAll'](_0x3b0944);})['then'](function(_0x130441){_0x17121d[_0xf8e3('0x68')]=_0x130441;return _0x17121d;});}})[_0xf8e3('0x36')](respondWithFilteredResult(_0x3e6ed9,_0x3b0944))[_0xf8e3('0x5b')](handleError(_0x3e6ed9,null));};exports[_0xf8e3('0x6d')]=function(_0x3a6092,_0x2b54e2,_0x2153eb){return db[_0xf8e3('0x40')][_0xf8e3('0x5a')]({'where':{'id':_0x3a6092[_0xf8e3('0x59')]['id']}})[_0xf8e3('0x36')](handleEntityNotFound(_0x2b54e2,null))[_0xf8e3('0x36')](function(_0x53fe81){if(_0x53fe81){return _0x53fe81['removeAnswers'](_0x3a6092[_0xf8e3('0x45')]['ids']);}})['then'](respondWithStatusCode(_0x2b54e2,null))[_0xf8e3('0x5b')](handleError(_0x2b54e2,null));};exports[_0xf8e3('0x6e')]=function(_0x5882f8,_0x5be3f5,_0x33d6ea){_0x5882f8[_0xf8e3('0x5d')]['sitepic']=_0x5882f8[_0xf8e3('0x6f')][_0xf8e3('0x70')];return db[_0xf8e3('0x40')][_0xf8e3('0x5a')]({'where':{'id':_0x5882f8['params']['id']}})[_0xf8e3('0x36')](handleEntityNotFound(_0x5be3f5,null))[_0xf8e3('0x36')](saveUpdates(_0x5882f8[_0xf8e3('0x5d')],null))[_0xf8e3('0x36')](respondWithResult(_0x5be3f5,null))['catch'](handleError(_0x5be3f5,null));};exports['addAvatar']=function(_0x516523,_0x560e7b,_0x4beb00){_0x516523[_0xf8e3('0x5d')][_0xf8e3('0x71')]=_0x516523['file']['filename'];return db[_0xf8e3('0x40')][_0xf8e3('0x5a')]({'where':{'id':_0x516523[_0xf8e3('0x59')]['id']}})[_0xf8e3('0x36')](handleEntityNotFound(_0x560e7b,null))[_0xf8e3('0x36')](saveUpdates(_0x516523[_0xf8e3('0x5d')],null))[_0xf8e3('0x36')](respondWithResult(_0x560e7b,null))[_0xf8e3('0x5b')](handleError(_0x560e7b,null));};exports[_0xf8e3('0x72')]=function(_0x54e485,_0x6b944c,_0x2361ab){_0x54e485[_0xf8e3('0x5d')][_0xf8e3('0x73')]=_0x54e485[_0xf8e3('0x6f')][_0xf8e3('0x70')];return db[_0xf8e3('0x40')][_0xf8e3('0x5a')]({'where':{'id':_0x54e485['params']['id']}})[_0xf8e3('0x36')](handleEntityNotFound(_0x6b944c,null))[_0xf8e3('0x36')](saveUpdates(_0x54e485['body'],null))['then'](respondWithResult(_0x6b944c,null))[_0xf8e3('0x5b')](handleError(_0x6b944c,null));};exports[_0xf8e3('0x74')]=function(_0x1fc36f,_0x19924c,_0x5d5624){_0x1fc36f[_0xf8e3('0x5d')][_0xf8e3('0x75')]=_0x1fc36f[_0xf8e3('0x6f')][_0xf8e3('0x70')];return db[_0xf8e3('0x40')][_0xf8e3('0x5a')]({'where':{'id':_0x1fc36f[_0xf8e3('0x59')]['id']}})[_0xf8e3('0x36')](handleEntityNotFound(_0x19924c,null))[_0xf8e3('0x36')](saveUpdates(_0x1fc36f[_0xf8e3('0x5d')],null))[_0xf8e3('0x36')](respondWithResult(_0x19924c,null))['catch'](handleError(_0x19924c,null));};exports[_0xf8e3('0x76')]=function(_0xcf2e65,_0x4cd463,_0x2fe26b){var _0x8d7573=path[_0xf8e3('0x77')](config[_0xf8e3('0x78')],'server/files/images/logos/default_logo.svg');var _0x2c7c0a={'where':{'id':_0xcf2e65[_0xf8e3('0x59')]['id']},'attributes':['id',_0xf8e3('0x79')],'raw':!![]};var _0x57112a=![];return require(_0xf8e3('0x19'))[_0xf8e3('0x7a')]()[_0xf8e3('0x36')](function(_0x3e9146){if(_0x3e9146){_0x57112a=_0x3e9146['custom'];}})[_0xf8e3('0x36')](function(){return db[_0xf8e3('0x40')][_0xf8e3('0x5a')](_0x2c7c0a);})[_0xf8e3('0x36')](handleEntityNotFound(_0x4cd463,null))['then'](function(_0x4e5ffb){if(_0x4e5ffb){if(!_[_0xf8e3('0x7b')](_0x4e5ffb[_0xf8e3('0x79')])){if(fs[_0xf8e3('0x7c')](path[_0xf8e3('0x77')](config[_0xf8e3('0x78')],'server/files/images/logos/',_0x4e5ffb[_0xf8e3('0x79')]))&&_0x57112a){_0x8d7573=path[_0xf8e3('0x77')](config['root'],_0xf8e3('0x7d'),_0x4e5ffb[_0xf8e3('0x79')]);}}return _0x4cd463[_0xf8e3('0x7e')](_0x8d7573);}})[_0xf8e3('0x5b')](handleError(_0x4cd463,null));};exports[_0xf8e3('0x7f')]=function(_0x55f66a,_0x5676de,_0x51b76f){var _0x548119=path[_0xf8e3('0x77')](config['root'],_0xf8e3('0x80'));var _0x53e3ef={'where':{'id':_0x55f66a[_0xf8e3('0x59')]['id']},'attributes':['id',_0xf8e3('0x71')],'raw':!![]};return db[_0xf8e3('0x40')][_0xf8e3('0x5a')](_0x53e3ef)[_0xf8e3('0x36')](handleEntityNotFound(_0x5676de,null))[_0xf8e3('0x36')](function(_0x2a7cdf){if(_0x2a7cdf){if(!_[_0xf8e3('0x7b')](_0x2a7cdf[_0xf8e3('0x71')])){if(fs[_0xf8e3('0x7c')](path[_0xf8e3('0x77')](config[_0xf8e3('0x78')],'server/files/images/avatars/',_0x2a7cdf[_0xf8e3('0x71')]))){_0x548119=path[_0xf8e3('0x77')](config[_0xf8e3('0x78')],_0xf8e3('0x81'),_0x2a7cdf[_0xf8e3('0x71')]);}}return _0x5676de['download'](_0x548119);}})[_0xf8e3('0x5b')](handleError(_0x5676de,null));};exports[_0xf8e3('0x82')]=function(_0x1fccb4,_0x3c4ed4,_0x3acaa5){var _0x3b4238=path['join'](config[_0xf8e3('0x78')],_0xf8e3('0x83'));var _0x4e5fc7={'where':{'id':_0x1fccb4[_0xf8e3('0x59')]['id']},'attributes':['id',_0xf8e3('0x73'),_0xf8e3('0x84')],'raw':!![]};return db[_0xf8e3('0x40')][_0xf8e3('0x5a')](_0x4e5fc7)[_0xf8e3('0x36')](handleEntityNotFound(_0x3c4ed4,null))[_0xf8e3('0x36')](function(_0x3c89be){if(_0x3c89be){if(!_[_0xf8e3('0x7b')](_0x3c89be[_0xf8e3('0x73')])){if(fs[_0xf8e3('0x7c')](path[_0xf8e3('0x77')](config[_0xf8e3('0x78')],_0xf8e3('0x81'),_0x3c89be[_0xf8e3('0x73')]))&&_0x3c89be[_0xf8e3('0x84')]){_0x3b4238=path[_0xf8e3('0x77')](config[_0xf8e3('0x78')],'server/files/images/avatars/',_0x3c89be[_0xf8e3('0x73')]);}}return _0x3c4ed4[_0xf8e3('0x7e')](_0x3b4238);}})['catch'](handleError(_0x3c4ed4,null));};exports[_0xf8e3('0x85')]=function(_0x14059d,_0x83eafc,_0x1d910a){var _0x2420d2=path[_0xf8e3('0x77')](config[_0xf8e3('0x78')],_0xf8e3('0x86'));var _0xfc59be={'where':{'id':_0x14059d[_0xf8e3('0x59')]['id']},'attributes':['id',_0xf8e3('0x75')],'raw':!![]};return db[_0xf8e3('0x40')][_0xf8e3('0x5a')](_0xfc59be)['then'](handleEntityNotFound(_0x83eafc,null))[_0xf8e3('0x36')](function(_0x79d884){if(_0x79d884){if(!_[_0xf8e3('0x7b')](_0x79d884[_0xf8e3('0x75')])){if(fs[_0xf8e3('0x7c')](path['join'](config[_0xf8e3('0x78')],'server/files/images/avatars/',_0x79d884[_0xf8e3('0x75')]))){_0x2420d2=path[_0xf8e3('0x77')](config['root'],_0xf8e3('0x81'),_0x79d884[_0xf8e3('0x75')]);}}return _0x83eafc['download'](_0x2420d2);}})[_0xf8e3('0x5b')](handleError(_0x83eafc,null));};exports[_0xf8e3('0x87')]=function(_0x1915ab,_0x2af49f,_0x52de0d){var _0x486c9e=require(_0xf8e3('0x88'));var _0x332ed2=new _0x486c9e();var _0x20f1e5=_0x332ed2[_0xf8e3('0x89')](_0x1915ab['headers']['user-agent'])[_0xf8e3('0x8a')]();var _0x5bf903={'body':_0x1915ab[_0xf8e3('0x5d')],'channel':_0xf8e3('0x8b')};var _0x4099c5=[];var _0x36d7c4=[];var _0x198d7e={};var _0x124ff1=![];return db[_0xf8e3('0x8c')][_0xf8e3('0x63')]()['then'](function(_0x467545){if(!_0x467545){throw new db[(_0xf8e3('0x8d'))][(_0xf8e3('0x8e'))](_0xf8e3('0x8f'));}_0x4099c5=_['difference'](_[_0xf8e3('0x46')](_0x467545),[_0xf8e3('0x90'),_0xf8e3('0x91')]);_0x36d7c4=_[_0xf8e3('0x92')](_['keys'](_0x467545),[_0xf8e3('0x90'),_0xf8e3('0x91'),_0xf8e3('0x93'),_0xf8e3('0x94')]);if(_0x1915ab[_0xf8e3('0x5d')]['id']){delete _0x1915ab[_0xf8e3('0x5d')]['id'];}if(_['isNil'](_0x1915ab[_0xf8e3('0x5d')][_0xf8e3('0x95')])){throw new db[(_0xf8e3('0x8d'))][(_0xf8e3('0x8e'))](_0xf8e3('0x96'));}if(_[_0xf8e3('0x7b')](_0x1915ab['body'][_0xf8e3('0x5d')])||_0x1915ab[_0xf8e3('0x5d')]['body']===''){throw new db[(_0xf8e3('0x8d'))]['ValidationError'](_0xf8e3('0x97'));}if(_[_0xf8e3('0x7b')](_0x1915ab[_0xf8e3('0x5d')][_0xf8e3('0x98')])){throw new db['Sequelize'][(_0xf8e3('0x8e'))](_0xf8e3('0x99')+_0x36d7c4);}if(!_[_0xf8e3('0x9a')](_0x36d7c4,_0x1915ab['body'][_0xf8e3('0x98')])){throw new db['Sequelize'][(_0xf8e3('0x8e'))](_0xf8e3('0x9b')+_0x36d7c4);}_0x198d7e[_0x1915ab[_0xf8e3('0x5d')][_0xf8e3('0x98')]]=_0x1915ab['body'][_0xf8e3('0x95')];})[_0xf8e3('0x36')](function(){return db[_0xf8e3('0x40')][_0xf8e3('0x5a')]({'where':{'id':_0x1915ab[_0xf8e3('0x59')]['id']},'include':[{'model':db[_0xf8e3('0x9c')],'as':_0xf8e3('0x9d'),'include':[{'model':db[_0xf8e3('0x8c')],'as':_0xf8e3('0x9e'),'where':_0x198d7e,'limit':0x1,'order':[['updatedAt',_0xf8e3('0x9f')]]}]},{'model':db[_0xf8e3('0xa0')],'as':_0xf8e3('0xa1')}]});})['then'](handleEntityNotFound(_0x2af49f,null))[_0xf8e3('0x36')](function(_0x56aceb){if(_0x56aceb&&_0x56aceb[_0xf8e3('0x9d')]){_0x5bf903[_0xf8e3('0xa2')]=_0x56aceb;_0x5bf903[_0xf8e3('0xa3')]=_0x56aceb[_0xf8e3('0xa1')];_0x5bf903[_0xf8e3('0xa4')]=_0x56aceb[_0xf8e3('0x9d')];_0x5bf903[_0xf8e3('0xa3')]=_[_0xf8e3('0xa5')](_0x5bf903[_0xf8e3('0xa3')],[_0xf8e3('0xa6')],[_0xf8e3('0xa7')]);if(_0x5bf903['account']['Applications']){delete _0x5bf903[_0xf8e3('0xa2')][_0xf8e3('0xa1')];}if(_0x5bf903[_0xf8e3('0xa2')]['List']&&_0x5bf903[_0xf8e3('0xa2')]['List'][_0xf8e3('0x9e')][_0xf8e3('0x4b')]){return _0x5bf903[_0xf8e3('0xa2')]['List'][_0xf8e3('0x9e')][0x0];}var _0x400778=_['defaults'](_0x1915ab[_0xf8e3('0x5d')],{'firstName':_0x1915ab[_0xf8e3('0x5d')]['from'],'ListId':_0x56aceb[_0xf8e3('0x94')]});_0x400778[_0x1915ab[_0xf8e3('0x5d')]['mapKey']]=_0x1915ab[_0xf8e3('0x5d')]['from'];return db[_0xf8e3('0x8c')][_0xf8e3('0x5c')](_0x400778,{'fields':_0x4099c5,'raw':!![]});}})['then'](handleEntityNotFound(_0x2af49f,null))['then'](function(_0x35193c){_0x5bf903[_0xf8e3('0xa8')]=_0x35193c;var _0x205ca0=_0x1915ab['body'][_0xf8e3('0xa9')];if(_0x1915ab[_0xf8e3('0xaa')][_0xf8e3('0xab')]){_0x205ca0=_0x1915ab['headers'][_0xf8e3('0xab')];}else if(_0x1915ab[_0xf8e3('0xaa')]['x-forwarded-for']){_0x205ca0=_[_0xf8e3('0xac')](_0x1915ab[_0xf8e3('0xaa')][_0xf8e3('0xad')][_0xf8e3('0xae')](','));}if(_0x35193c){var _0xd4d98c={'ContactId':_0x35193c['id'],'ChatWebsiteId':_0x1915ab[_0xf8e3('0x59')]['id'],'from':(_0x35193c[_0xf8e3('0xaf')]||'')+'\x20'+(_0x35193c[_0xf8e3('0xb0')]||''),'customerIp':_0x205ca0,'customerPort':_0x1915ab[_0xf8e3('0xaa')][_0xf8e3('0xb1')]?_0x1915ab[_0xf8e3('0xaa')][_0xf8e3('0xb1')]:null,'referer':_0x1915ab[_0xf8e3('0x5d')][_0xf8e3('0xb2')],'browserName':_0x20f1e5['browser'][_0xf8e3('0x54')]&&_0x20f1e5[_0xf8e3('0xb3')][_0xf8e3('0xb4')]?util['format']('%s\x20%s',_0x20f1e5[_0xf8e3('0xb3')][_0xf8e3('0x54')],_0x20f1e5[_0xf8e3('0xb3')][_0xf8e3('0xb4')]):'unknown','browserVersion':_0x20f1e5['browser'][_0xf8e3('0xb4')]||'unknown','osName':util[_0xf8e3('0xb5')](_0xf8e3('0xb6'),_0x20f1e5['os']['name'],_0x20f1e5['os']['version']),'osVersion':_0x20f1e5['os'][_0xf8e3('0xb4')],'deviceModel':_0x20f1e5[_0xf8e3('0xb7')][_0xf8e3('0x44')]&&_0x20f1e5[_0xf8e3('0xb7')][_0xf8e3('0xb8')]?util[_0xf8e3('0xb5')]('%s\x20%s\x20%s',_0x20f1e5[_0xf8e3('0xb7')][_0xf8e3('0x44')],_0x20f1e5[_0xf8e3('0xb7')]['vendor'],_0x20f1e5[_0xf8e3('0xb7')][_0xf8e3('0x43')]):null,'deviceVendor':_0x20f1e5[_0xf8e3('0xb7')][_0xf8e3('0xb8')],'deviceType':_0x20f1e5['device']['type'],'formData':JSON[_0xf8e3('0x27')](_0x1915ab['body'])};var _0x4f103c={'ChatWebsiteId':_0x1915ab[_0xf8e3('0x59')]['id'],'closed':![]};if(_0x1915ab[_0xf8e3('0x5d')]['threadId']){_0x4f103c[_0xf8e3('0xb9')]=_0x1915ab['body']['threadId'];return db[_0xf8e3('0xba')][_0xf8e3('0x5a')]({'where':_0x4f103c})['then'](function(_0xc1ee60){if(_0xc1ee60){return[_0xc1ee60,![]];}_0xd4d98c['threadId']=_0x1915ab[_0xf8e3('0x5d')][_0xf8e3('0xb9')];_0xd4d98c['externalUrl']=_0x1915ab[_0xf8e3('0x5d')]['externalUrl'];return db[_0xf8e3('0xba')][_0xf8e3('0x5c')](_0xd4d98c)[_0xf8e3('0x36')](function(_0x348d5f){return[_0x348d5f,!![]];});});}_0x4f103c[_0xf8e3('0xbb')]=_0x35193c['id'];if(_0x1915ab[_0xf8e3('0x5d')][_0xf8e3('0xbc')]&&_0x1915ab[_0xf8e3('0x5d')][_0xf8e3('0xbc')]['id']){_0x4f103c['id']=_0x1915ab[_0xf8e3('0x5d')][_0xf8e3('0xbc')]['id'];return db[_0xf8e3('0xba')][_0xf8e3('0x5a')]({'where':_0x4f103c})['then'](function(_0x399f19){if(_0x399f19){return[_0x399f19,![]];}return db[_0xf8e3('0xba')]['create'](_0xd4d98c)[_0xf8e3('0x36')](function(_0x3ec26c){return[_0x3ec26c,!![]];});});}return db[_0xf8e3('0xba')][_0xf8e3('0x5c')](_0xd4d98c)[_0xf8e3('0x36')](function(_0x578ea5){return[_0x578ea5,!![]];});}})[_0xf8e3('0xbd')](function(_0x2d2335,_0x5d3017){if(_0x2d2335){_0x124ff1=_0x5d3017;if(!_0x5d3017){var _0xcc40d3={'from':(_0x5bf903['contact'][_0xf8e3('0xaf')]||'')+'\x20'+(_0x5bf903['contact'][_0xf8e3('0xb0')]||'')};if(_0x1915ab[_0xf8e3('0x5d')]['threadId']&&_0x1915ab[_0xf8e3('0x5d')][_0xf8e3('0xbe')]&&_0x1915ab['body'][_0xf8e3('0xb9')]!=_0x1915ab['body'][_0xf8e3('0xbe')]){_0xcc40d3[_0xf8e3('0xb9')]=_0x1915ab[_0xf8e3('0x5d')][_0xf8e3('0xbe')];}return _0x2d2335['update'](_0xcc40d3);}else{return _0x2d2335;}}})[_0xf8e3('0x36')](function(_0x39593a){_0x5bf903[_0xf8e3('0xbc')]=_0x39593a[_0xf8e3('0x38')]({'plain':!![]});_0x5bf903['interaction'][_0xf8e3('0xbf')]=_0x124ff1;if(_0x5bf903[_0xf8e3('0xbc')][_0xf8e3('0xbf')]){if(_0x5bf903[_0xf8e3('0xa2')][_0xf8e3('0xc0')]){_0x5bf903[_0xf8e3('0xa3')][_0xf8e3('0xc1')]({'id':0x0,'priority':_0x5bf903[_0xf8e3('0xa3')][_0xf8e3('0x4b')]+0x1,'app':_0xf8e3('0xc2'),'appdata':_0xf8e3('0xc3'),'interval':_0xf8e3('0xc4')});}}return db[_0xf8e3('0xc5')][_0xf8e3('0x5c')]({'body':_0x1915ab['body'][_0xf8e3('0x5d')],'ChatWebsiteId':_0x1915ab[_0xf8e3('0x59')]['id'],'ChatInteractionId':_0x39593a['id'],'direction':'in','ContactId':_0x5bf903[_0xf8e3('0xa8')]['id'],'AttachmentId':_0x1915ab['body']['AttachmentId']});})['then'](function(_0x5df0c1){_0x5bf903[_0xf8e3('0x29')]=_0x5df0c1;if(_0x5bf903[_0xf8e3('0xbc')]['UserId']){return db[_0xf8e3('0xc6')][_0xf8e3('0x5a')]({'attributes':['id',_0xf8e3('0x54')],'where':{'id':_0x5bf903[_0xf8e3('0xbc')][_0xf8e3('0xc7')]}})['then'](function(_0x48ad6b){if(_0x48ad6b){_0x5bf903['applications'][_0xf8e3('0xc8')]({'id':0x0,'priority':0x0,'app':_0xf8e3('0xc9'),'appdata':_0x48ad6b[_0xf8e3('0x54')]+','+(_0x5bf903[_0xf8e3('0xa2')]['waitForTheAssignedAgent']||0xa),'interval':_0xf8e3('0xc4')});_0x5bf903['forcedOwnership']=!![];}return respondWithRpcPromise(_0xf8e3('0xca'),_0xf8e3('0xcb'),_0x5bf903);});}return respondWithRpcPromise(_0xf8e3('0xca'),_0xf8e3('0xcb'),_0x5bf903);})['then'](function(_0x52a084){respondWithRpcPromise('EventManager','EventManager',{'event':_0xf8e3('0x87'),'message':_0x52a084},client9002);return _0x52a084;})[_0xf8e3('0x36')](respondWithResult(_0x2af49f,null))['catch'](handleError(_0x2af49f,null));};exports[_0xf8e3('0xcc')]=function(_0x47a13a,_0x3f7bc4,_0x269135){var _0x521a89,_0x518810,_0x3dadb4;var _0x422b04=[];var _0x3896ae=[];var _0x3f3416={};var _0x57e77b=_0x47a13a[_0xf8e3('0xcd')]||[];var _0x112d68=[];var _0x1617b2;return db['CmContact'][_0xf8e3('0x63')]()[_0xf8e3('0x36')](function(_0x42f4b7){if(!_0x42f4b7){throw new db[(_0xf8e3('0x8d'))][(_0xf8e3('0x8e'))]('no\x20available\x20attributes');}_0x3896ae=_['difference'](_[_0xf8e3('0x46')](_0x42f4b7),[_0xf8e3('0x90'),_0xf8e3('0x91')]);_0x422b04=_[_0xf8e3('0x92')](_[_0xf8e3('0x46')](_0x42f4b7),['createdAt',_0xf8e3('0x91'),_0xf8e3('0x93'),'ListId']);if(_0x47a13a[_0xf8e3('0x5d')]['id']){delete _0x47a13a[_0xf8e3('0x5d')]['id'];}if(_[_0xf8e3('0x7b')](_0x47a13a[_0xf8e3('0x5d')]['from'])){throw _0x3f7bc4[_0xf8e3('0x2d')](0x1f4)['send'](new db[(_0xf8e3('0x8d'))][(_0xf8e3('0x8e'))](_0xf8e3('0x96')));}if(_['isNil'](_0x47a13a[_0xf8e3('0x5d')]['body'])||_0x47a13a[_0xf8e3('0x5d')][_0xf8e3('0x5d')]===''){throw _0x3f7bc4[_0xf8e3('0x2d')](0x1f4)[_0xf8e3('0x3c')](new db[(_0xf8e3('0x8d'))][(_0xf8e3('0x8e'))](_0xf8e3('0x97')));}if(_['isNil'](_0x47a13a[_0xf8e3('0x5d')]['mapKeyOffline'])){throw _0x3f7bc4[_0xf8e3('0x2d')](0x1f4)[_0xf8e3('0x3c')](new db[(_0xf8e3('0x8d'))]['ValidationError'](_0xf8e3('0xce')+_0x422b04));}if(!_['includes'](_0x422b04,_0x47a13a[_0xf8e3('0x5d')][_0xf8e3('0xcf')])){throw _0x3f7bc4[_0xf8e3('0x2d')](0x1f4)['send'](new db[(_0xf8e3('0x8d'))][(_0xf8e3('0x8e'))](_0xf8e3('0xd0')+_0x422b04));}_0x3f3416[_0x47a13a[_0xf8e3('0x5d')]['mapKeyOffline']]=_0x47a13a['body']['from'];})['then'](function(){return db[_0xf8e3('0x40')][_0xf8e3('0x5a')]({'where':{'id':_0x47a13a[_0xf8e3('0x59')]['id']},'include':[{'model':db['CmList'],'as':_0xf8e3('0x9d')},{'model':db[_0xf8e3('0xd1')],'as':_0xf8e3('0xd1')}]});})[_0xf8e3('0x36')](handleEntityNotFound(_0x3f7bc4,null))[_0xf8e3('0x36')](function(_0x771768){if(_0x771768&&_0x771768[_0xf8e3('0x9d')]){_0x518810=_0x771768;var _0x335d04=_[_0xf8e3('0x1c')](_0x47a13a[_0xf8e3('0x5d')],{'firstName':_0x47a13a[_0xf8e3('0x5d')][_0xf8e3('0x95')],'phone':_0x47a13a[_0xf8e3('0x5d')][_0xf8e3('0x95')],'ListId':_0x771768[_0xf8e3('0x94')]});_0x335d04[_0x47a13a[_0xf8e3('0x5d')][_0xf8e3('0xcf')]]=_0x47a13a['body'][_0xf8e3('0x95')];return db[_0xf8e3('0x8c')]['findOrCreate']({'where':_0x3f3416,'defaults':_0x335d04});}})[_0xf8e3('0xbd')](function(_0x347220){if(_0x347220){_0x3dadb4=_0x347220;var _0x4b8871=fs[_0xf8e3('0xd2')](path[_0xf8e3('0x77')](config[_0xf8e3('0x78')],_0xf8e3('0xd3')),_0xf8e3('0xd4'));var _0x341919=ejs[_0xf8e3('0xd5')](_0x4b8871,{'body':_[_0xf8e3('0xd6')](_0x47a13a[_0xf8e3('0x5d')][_0xf8e3('0x5d')]),'bodyTitle':_0x518810['offlineMessageBody']});return db['ChatOfflineMessage'][_0xf8e3('0x5c')]({'body':_0x341919,'ContactId':_0x347220['id'],'ChatWebsiteId':_0x518810['id']});}})[_0xf8e3('0x36')](function(_0x2462b3){_0x1617b2=_0x2462b3;if(_0x57e77b[_0xf8e3('0x4b')]){var _0x2fe68a=_0x57e77b[_0xf8e3('0x3f')](function(_0x2a823b){return{'name':_0x2a823b[_0xf8e3('0xd7')],'basename':_0x2a823b[_0xf8e3('0x70')],'type':_0x2a823b['mimetype'],'ChatOfflineMessageId':_0x2462b3['id']};});_0x112d68=_0x2fe68a[_0xf8e3('0x3f')](_0x4a2e95=>{var _0x5429ab={'filename':_0x4a2e95['name'],'path':path['join'](config[_0xf8e3('0x78')],'server',_0xf8e3('0xcd'),_0xf8e3('0xd8'),_0xf8e3('0xd9'),_0x4a2e95[_0xf8e3('0xda')])};return _0x5429ab;});if(!_0x518810['openNewInteraction']){return db[_0xf8e3('0xdb')]['transaction'](function(_0x584ca9){return db['Attachment'][_0xf8e3('0xdc')](_0x2fe68a,{'transaction':_0x584ca9});});}}})[_0xf8e3('0x36')](function(){if(_0x1617b2){_0x521a89=_0x1617b2;return db[_0xf8e3('0xd1')][_0xf8e3('0x66')]({'where':{'active':!![]},'include':[{'model':db[_0xf8e3('0xdd')],'as':'Smtp','raw':!![]}]});}})['then'](function(_0x3930f9){if(_0x3930f9&&_0x3930f9[_0xf8e3('0xde')]&&_0x518810[_0xf8e3('0xdf')]&&_0x518810[_0xf8e3('0xe0')]){var _0x5358aa={'tls':{'rejectUnauthorized':![]}};if(_0x3930f9['Smtp'][_0xf8e3('0xe1')]){_0x5358aa['service']=_0x3930f9[_0xf8e3('0xde')][_0xf8e3('0xe1')];}else{_0x5358aa[_0xf8e3('0xe2')]=_0x3930f9[_0xf8e3('0xde')]['host'];_0x5358aa[_0xf8e3('0xe3')]=_0x3930f9[_0xf8e3('0xde')][_0xf8e3('0xe3')];_0x5358aa[_0xf8e3('0xe4')]=_0x3930f9[_0xf8e3('0xde')][_0xf8e3('0xe4')];}if(_0x3930f9[_0xf8e3('0xde')][_0xf8e3('0xe5')]){_0x5358aa['auth']={'user':_0x3930f9['Smtp'][_0xf8e3('0x5e')],'pass':_0x3930f9['Smtp'][_0xf8e3('0xe6')]};}return respondWithRpcPromise(_0xf8e3('0xe7'),_0xf8e3('0xe8'),{'account':_0x5358aa,'message':{'from':util['format'](_0xf8e3('0xe9'),_0x3930f9['name'],_0x3930f9[_0xf8e3('0xea')]||_0x3930f9['Smtp'][_0xf8e3('0x5e')]),'to':_0x518810[_0xf8e3('0xe0')],'subject':_0x518810[_0xf8e3('0xeb')],'html':_0x521a89['body'],'attachments':_0x112d68}},client9003)[_0xf8e3('0x36')](function(){return _0x521a89;})[_0xf8e3('0x5b')](function(_0x50f4e4){console[_0xf8e3('0x28')](_0x50f4e4);});}})[_0xf8e3('0x36')](function(){if(_0x518810&&_0x518810['openNewInteraction']&&_0x518810['MailAccountId']){var _0x34c194=[];if(_0x57e77b['length']){_0x34c194=_0x57e77b[_0xf8e3('0x3f')](function(_0x54e882){return{'name':_0x54e882[_0xf8e3('0xd7')],'basename':_0x54e882[_0xf8e3('0x70')],'type':_0x54e882['mimetype'],'ChatOfflineMessageId':_0x1617b2['id']};});}var _0x23fe1c;if(!_[_0xf8e3('0x7b')](_0x518810[_0xf8e3('0xec')])){var _0x202332=_[_0xf8e3('0x3f')](_0x47a13a[_0xf8e3('0x5d')],function(_0x4619b3){return _0x4619b3;});var _0x43ba7b=_['toPairsIn'](_0x202332)[0x0];var _0x19d582=_['mapValues'](_0x43ba7b,function(_0x364a51){return _0x364a51;});_0x23fe1c=_0x19d582[0x1][_0x518810['subjectOffline']];}var _0x5868bf={'from':_0x3dadb4[_0xf8e3('0xea')],'firstName':_0x3dadb4['firstName'],'lastName':_0x3dadb4[_0xf8e3('0xb0')],'mapKey':_0xf8e3('0xea'),'message':{'from':_0x3dadb4[_0xf8e3('0xea')],'to':_0x518810[_0xf8e3('0xd1')]['email'],'cc':'','subject':_[_0xf8e3('0x7b')](_0x23fe1c)?_0x518810[_0xf8e3('0xeb')]:_0x23fe1c,'messageId':'','sentAt':new Date(),'attach':_0x34c194['length'],'attachments':_0x34c194,'originChannel':_0xf8e3('0xed'),'ChatWebsiteId':_0x518810['id'],'ChatOfflineMessageId':_0x521a89['id'],'originTo':_0x518810['MailAccount'][_0xf8e3('0xea')]},'body':_0x521a89[_0xf8e3('0x5d')]};var _0x18cc97={'account':{'id':_0x518810['MailAccountId']},'body':_0x5868bf,'log':_0xf8e3('0xee')};return respondWithRpcPromise('NotifyMailAccount',_0xf8e3('0xef'),_0x18cc97,client9001)[_0xf8e3('0x36')](function(){return _0x521a89;})[_0xf8e3('0x5b')](function(_0x306d1b){console[_0xf8e3('0x28')](_0x306d1b);});}return;})[_0xf8e3('0x36')](function(){if(_0x521a89){return _0x521a89;}})[_0xf8e3('0x36')](respondWithResult(_0x3f7bc4,null))[_0xf8e3('0x5b')](function(_0x5da68e){console[_0xf8e3('0x28')](_0xf8e3('0x5b'),_0x5da68e);for(var _0x16e1ae of _0x57e77b){var _0x3e49b6=path[_0xf8e3('0x77')](config[_0xf8e3('0x78')],'server',_0xf8e3('0xcd'),_0xf8e3('0xd8'),_0xf8e3('0xd9'),_0x16e1ae[_0xf8e3('0x70')]);fs_extra[_0xf8e3('0xf0')](_0x3e49b6)[_0xf8e3('0x5b')](function(_0x921b5b){console[_0xf8e3('0x28')](_0xf8e3('0xf1'),_0x3e49b6,_0x921b5b);});}});};exports['addInteraction']=function(_0x1a6047,_0x471d84,_0xd99edb){return db[_0xf8e3('0xba')][_0xf8e3('0x5a')]({'where':{'id':_0x1a6047[_0xf8e3('0x59')]['id']}})[_0xf8e3('0x36')](handleEntityNotFound(_0x471d84,null))[_0xf8e3('0x36')](function(_0x1348f6){if(_0x1348f6){return _0x1348f6[_0xf8e3('0xf2')](_0x1a6047[_0xf8e3('0x5d')]['ids'],_[_0xf8e3('0xf3')](_0x1a6047[_0xf8e3('0x5d')],['ids','id'])||{});}})[_0xf8e3('0x36')](respondWithResult(_0x471d84,null))['catch'](handleError(_0x471d84,null));};exports['getInteractions']=function(_0x55491c,_0x32df42,_0x184be7){var _0x288c1b={'raw':![],'where':{}};var _0x3d436e={};var _0x3b3084={'count':0x0,'rows':[]};return db[_0xf8e3('0x40')][_0xf8e3('0x66')]({'where':{'id':_0x55491c[_0xf8e3('0x59')]['id']}})['then'](handleEntityNotFound(_0x32df42,null))[_0xf8e3('0x36')](function(_0x192407){if(_0x192407){_0x3d436e[_0xf8e3('0x44')]=_[_0xf8e3('0x46')](db[_0xf8e3('0xba')][_0xf8e3('0x41')]);_0x3d436e['query']=_[_0xf8e3('0x46')](_0x55491c['query']);_0x3d436e[_0xf8e3('0x47')]=_['intersection'](_0x3d436e[_0xf8e3('0x44')],_0x3d436e[_0xf8e3('0x45')]);_0x288c1b[_0xf8e3('0x4a')]=_[_0xf8e3('0x48')](_0x3d436e[_0xf8e3('0x44')],qs[_0xf8e3('0x49')](_0x55491c['query'][_0xf8e3('0x49')]));_0x288c1b[_0xf8e3('0x4a')]=_0x288c1b[_0xf8e3('0x4a')][_0xf8e3('0x4b')]?_0x288c1b['attributes']:_0x3d436e[_0xf8e3('0x44')];if(!_0x55491c[_0xf8e3('0x45')][_0xf8e3('0x4c')](_0xf8e3('0x4d'))){_0x288c1b['limit']=qs['limit'](_0x55491c[_0xf8e3('0x45')][_0xf8e3('0x30')]);_0x288c1b[_0xf8e3('0x2f')]=qs[_0xf8e3('0x2f')](_0x55491c[_0xf8e3('0x45')][_0xf8e3('0x2f')]);}_0x288c1b[_0xf8e3('0x4e')]=qs[_0xf8e3('0x4f')](_0x55491c[_0xf8e3('0x45')][_0xf8e3('0x4f')]);_0x288c1b[_0xf8e3('0x50')]=qs[_0xf8e3('0x47')](_[_0xf8e3('0x51')](_0x55491c[_0xf8e3('0x45')],_0x3d436e[_0xf8e3('0x47')]));_0x288c1b[_0xf8e3('0x50')][_0xf8e3('0x65')]=_0x192407['id'];if(_0x55491c[_0xf8e3('0x45')][_0xf8e3('0x52')]){_0x288c1b[_0xf8e3('0x50')]=_[_0xf8e3('0x53')](_0x288c1b[_0xf8e3('0x50')],{'$or':_[_0xf8e3('0x3f')](_0x288c1b[_0xf8e3('0x4a')],function(_0x54ff54){var _0x991853={};_0x991853[_0x54ff54]={'$like':'%'+_0x55491c[_0xf8e3('0x45')][_0xf8e3('0x52')]+'%'};return _0x991853;})});}_0x288c1b=_[_0xf8e3('0x53')]({},_0x288c1b,_0x55491c[_0xf8e3('0x55')]);return db[_0xf8e3('0xba')][_0xf8e3('0x32')]({'where':_0x288c1b[_0xf8e3('0x50')]})['then'](function(_0x19e45d){_0x3b3084['count']=_0x19e45d;if(_0x55491c[_0xf8e3('0x45')][_0xf8e3('0x56')]){_0x288c1b[_0xf8e3('0x57')]=[{'model':db[_0xf8e3('0x8c')],'as':_0xf8e3('0xf4'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xf8e3('0x54'),_0xf8e3('0xf5'),_0xf8e3('0xf6')],'required':![]},{'model':db[_0xf8e3('0xf7')],'as':_0xf8e3('0xf8'),'attributes':['id',_0xf8e3('0x54'),_0xf8e3('0xf9')],'where':_0x55491c[_0xf8e3('0x45')]['tag']?{'id':_0x55491c[_0xf8e3('0x45')][_0xf8e3('0xfa')]}:undefined,'required':_0x55491c[_0xf8e3('0x45')][_0xf8e3('0xfa')]?!![]:![]}];}return db['ChatInteraction'][_0xf8e3('0x58')](_0x288c1b);})['then'](function(_0x5494a7){_0x3b3084[_0xf8e3('0x68')]=_0x5494a7;return _0x3b3084;});}})[_0xf8e3('0x36')](respondWithFilteredResult(_0x32df42,_0x288c1b))[_0xf8e3('0x5b')](handleError(_0x32df42,null));};function iftimePromise(_0x32c2eb,_0x573078){return respondWithRpcPromise('Command','getSnippet',{'command':_0x573078[_0xf8e3('0xfb')]?util['format']('iftime\x20%s,%s',_0x32c2eb[_0xf8e3('0xfc')],_0x573078[_0xf8e3('0xfb')]):util[_0xf8e3('0xb5')](_0xf8e3('0xfd'),_0x32c2eb[_0xf8e3('0xfc')])},client9002)[_0xf8e3('0x36')](function(_0x39f950){var _0x1bd2d2=_0x39f950&&_0x39f950[_0xf8e3('0xfe')](_0xf8e3('0xff'))>=0x0?!![]:![];logger['info'](_0xf8e3('0x100'),_0x573078['id'],_0x32c2eb['id'],_0x32c2eb[_0xf8e3('0xfc')],_0x1bd2d2?'ONLINE':_0xf8e3('0x101'),_0x573078['timezone']?_0x573078[_0xf8e3('0xfb')]:_0xf8e3('0x102'));return _0x1bd2d2;})[_0xf8e3('0x5b')](function(_0x126eea){logger[_0xf8e3('0x28')](_0xf8e3('0x100'),_0x573078['id'],_0x32c2eb['id'],_0x32c2eb[_0xf8e3('0xfc')],util['inspect'](_0x126eea,{'showHidden':![],'depth':null}),_0x573078[_0xf8e3('0xfb')]?_0x573078['timezone']:'No\x20timezone');return![];});}exports['getSnippet']=function(_0xb92fc,_0x4f3322,_0x54e41c){var _0x4f9098=0x0;var _0x210675=0x0;var _0x1082fb=![];var _0x32a039;var _0x299dc7;return db['ChatWebsite']['find']({'where':{'id':_0xb92fc['params']['id']},'include':[{'model':db['Interval'],'as':_0xf8e3('0x103'),'include':[{'model':db[_0xf8e3('0x103')],'as':_0xf8e3('0x104'),'attributes':['id',_0xf8e3('0xfc')],'raw':!![]}]}]})[_0xf8e3('0x36')](handleEntityNotFound(_0x4f3322,null))[_0xf8e3('0x36')](function(_0x47b6e4){if(_0x47b6e4){_0x32a039=_0x47b6e4;return _0x47b6e4[_0xf8e3('0x105')]({'raw':!![]});}})[_0xf8e3('0x36')](function(_0x21facd){if(_0x32a039){if(_0x21facd){_0x299dc7=_0x21facd;}}return require(_0xf8e3('0x19'))[_0xf8e3('0x7a')]();})[_0xf8e3('0x36')](function(_0x2f16df){if(_0x2f16df){_0x210675=_0x2f16df['virtual'];_0x1082fb=_0x2f16df[_0xf8e3('0x106')];}})[_0xf8e3('0x36')](function(){return db['ChatInteraction'][_0xf8e3('0x32')]({'where':{'closed':![]}});})['then'](function(_0x56ef7c){_0x4f9098=_0x56ef7c;if(_0x210675&&_0x56ef7c>_0x210675){return db['License'][_0xf8e3('0x66')]({'where':{'id':0x1}})[_0xf8e3('0x36')](function(_0x28f226){if(_0x28f226){_0x28f226[_0xf8e3('0x107')](_0xf8e3('0x108'));}});}})[_0xf8e3('0x36')](function(){if(_0x32a039[_0xf8e3('0x103')]&&_0x32a039['Interval'][_0xf8e3('0x104')]){var _0x1c4fad=[];for(var _0x1bc033=0x0;_0x1bc033<_0x32a039[_0xf8e3('0x103')][_0xf8e3('0x104')][_0xf8e3('0x4b')];_0x1bc033++){var _0x59474e=_0x32a039['Interval']['Intervals'][_0x1bc033]['get']({'plain':!![]});_0x1c4fad[_0xf8e3('0xc1')](iftimePromise(_0x59474e,_0x32a039));}return BPromise[_0xf8e3('0x109')](_0x1c4fad)[_0xf8e3('0x36')](function(_0x187e5c){return _[_0xf8e3('0x10a')](_0x187e5c);});}else{return!![];}})[_0xf8e3('0x36')](function(_0x3e3696){var _0x9ba3d2=fs['readFileSync'](path[_0xf8e3('0x77')](config[_0xf8e3('0x78')],_0xf8e3('0x10b')),_0xf8e3('0xd4'));var _0x121df8={'remote':_0x32a039[_0xf8e3('0x10c')],'query':querystring[_0xf8e3('0x27')](_[_0xf8e3('0x53')](_0x32a039['get']({'plain':!![]}),{'customerIp':_0xb92fc[_0xf8e3('0xaa')][_0xf8e3('0xad')]||_0xb92fc[_0xf8e3('0xaa')][_0xf8e3('0x10d')]||_0xb92fc[_0xf8e3('0x10e')][_0xf8e3('0x10f')]||_0xb92fc['ip'],'referer':_0xb92fc[_0xf8e3('0xaa')][_0xf8e3('0xb2')],'openedInteractions':_0x4f9098,'maxInteractions':_0x210675,'virtual':_0x1082fb[_0xf8e3('0x110')],'online':_0x3e3696,'custom':_0x1082fb}))[_0xf8e3('0x111')](/'/g,'\x5c\x27')};_0x4f3322[_0xf8e3('0x3c')](ejs[_0xf8e3('0xd5')](Mustache[_0xf8e3('0xd5')](_0x9ba3d2,_0x121df8),{'proactiveActions':_0x299dc7,'alignment':_0x32a039[_0xf8e3('0x112')],'verticalAlignment':_0x32a039[_0xf8e3('0x113')],'div_color':_0x32a039[_0xf8e3('0xf9')],'text_color':_0x32a039['textColor'],'button_color':_0x32a039[_0xf8e3('0x114')],'background_color':_0x32a039[_0xf8e3('0x115')]}));})[_0xf8e3('0x5b')](handleError(_0x4f3322,null));};exports['addApplications']=function(_0x53120f,_0x3978e2,_0xd6839c){return db[_0xf8e3('0x40')][_0xf8e3('0x66')]({'where':{'id':_0x53120f['params']['id']}})[_0xf8e3('0x36')](handleEntityNotFound(_0x3978e2,null))[_0xf8e3('0x36')](function(_0x48212f){if(_0x48212f){return db[_0xf8e3('0xdb')][_0xf8e3('0x116')](function(_0x62431b){return db[_0xf8e3('0xa0')][_0xf8e3('0x37')]({'where':{'ChatWebsiteId':_0x53120f['params']['id']},'transaction':_0x62431b})[_0xf8e3('0x36')](function(_0x3b4e38){var _0x34a4f1=_[_0xf8e3('0x3f')](_0x53120f[_0xf8e3('0x5d')],function(_0x109bc0){_0x109bc0[_0xf8e3('0x65')]=_0x53120f['params']['id'];return _0x109bc0;});return db[_0xf8e3('0xa0')][_0xf8e3('0xdc')](_0x34a4f1,{'transaction':_0x62431b});});})[_0xf8e3('0x36')](function(){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x53120f[_0xf8e3('0x59')]['id']},'order':_0xf8e3('0xa6')});});}})[_0xf8e3('0x36')](respondWithResult(_0x3978e2,null))[_0xf8e3('0x5b')](handleError(_0x3978e2,null));};exports[_0xf8e3('0x117')]=function(_0x4041a0,_0xc40ffb,_0x364818){var _0x503ab3={};var _0x1f6661={};var _0x2e4079;var _0x42c5b8;return db[_0xf8e3('0x40')][_0xf8e3('0x66')]({'where':{'id':_0x4041a0[_0xf8e3('0x59')]['id']}})['then'](handleEntityNotFound(_0xc40ffb,null))['then'](function(_0x510eda){if(_0x510eda){_0x2e4079=_0x510eda;_0x1f6661[_0xf8e3('0x44')]=_[_0xf8e3('0x46')](db['ChatApplication']['rawAttributes']);_0x1f6661[_0xf8e3('0x45')]=_['keys'](_0x4041a0['query']);_0x1f6661['filters']=_['intersection'](_0x1f6661['model'],_0x1f6661['query']);_0x503ab3[_0xf8e3('0x4a')]=_[_0xf8e3('0x48')](_0x1f6661[_0xf8e3('0x44')],qs[_0xf8e3('0x49')](_0x4041a0[_0xf8e3('0x45')]['fields']));_0x503ab3['attributes']=_0x503ab3[_0xf8e3('0x4a')][_0xf8e3('0x4b')]?_0x503ab3[_0xf8e3('0x4a')]:_0x1f6661['model'];_0x503ab3[_0xf8e3('0x4e')]=qs['sort'](_0x4041a0['query'][_0xf8e3('0x4f')]);_0x503ab3[_0xf8e3('0x50')]=qs[_0xf8e3('0x47')](_[_0xf8e3('0x51')](_0x4041a0[_0xf8e3('0x45')],_0x1f6661[_0xf8e3('0x47')]));if(_0x4041a0[_0xf8e3('0x45')][_0xf8e3('0x52')]){_0x503ab3[_0xf8e3('0x50')]=_[_0xf8e3('0x53')](_0x503ab3[_0xf8e3('0x50')],{'$or':_['map'](_0x503ab3[_0xf8e3('0x4a')],function(_0x28ca04){var _0x54c0ff={};_0x54c0ff[_0x28ca04]={'$like':'%'+_0x4041a0['query']['filter']+'%'};return _0x54c0ff;})});}_0x503ab3=_[_0xf8e3('0x53')]({},_0x503ab3,_0x4041a0['options']);return _0x2e4079[_0xf8e3('0x117')](_0x503ab3);}})[_0xf8e3('0x36')](function(_0x51f371){if(_0x51f371){_0x42c5b8=_0x51f371['length'];if(!_0x4041a0[_0xf8e3('0x45')][_0xf8e3('0x4c')](_0xf8e3('0x4d'))){_0x503ab3[_0xf8e3('0x30')]=qs[_0xf8e3('0x30')](_0x4041a0['query'][_0xf8e3('0x30')]);_0x503ab3[_0xf8e3('0x2f')]=qs[_0xf8e3('0x2f')](_0x4041a0['query']['offset']);}return _0x2e4079['getApplications'](_0x503ab3);}})[_0xf8e3('0x36')](function(_0xf7cf8a){if(_0xf7cf8a){return _0xf7cf8a?{'count':_0x42c5b8,'rows':_0xf7cf8a}:null;}})[_0xf8e3('0x36')](respondWithResult(_0xc40ffb,null))[_0xf8e3('0x5b')](handleError(_0xc40ffb,null));};exports[_0xf8e3('0x118')]=function(_0x2cf01d,_0xc7d40c,_0x558ed9){return db[_0xf8e3('0x119')]['find']({'where':{'id':_0x2cf01d[_0xf8e3('0x59')]['id']}})[_0xf8e3('0x36')](handleEntityNotFound(_0xc7d40c,null))['then'](function(_0x321f0b){if(_0x321f0b){return _0x321f0b[_0xf8e3('0x118')](_0x2cf01d[_0xf8e3('0x5d')][_0xf8e3('0x6a')],_[_0xf8e3('0xf3')](_0x2cf01d['body'],['ids','id'])||{});}})[_0xf8e3('0x36')](respondWithResult(_0xc7d40c,null))[_0xf8e3('0x5b')](handleError(_0xc7d40c,null));};exports['getProactiveActions']=function(_0x2c8a98,_0x5b8225,_0x1cdcdf){var _0x17a184={};var _0xf4c214={};var _0x1112bd;var _0x54b0c0;return db[_0xf8e3('0x40')][_0xf8e3('0x66')]({'where':{'id':_0x2c8a98[_0xf8e3('0x59')]['id']}})[_0xf8e3('0x36')](handleEntityNotFound(_0x5b8225,null))[_0xf8e3('0x36')](function(_0x23059b){if(_0x23059b){_0x1112bd=_0x23059b;_0xf4c214[_0xf8e3('0x44')]=_['keys'](db[_0xf8e3('0x11a')][_0xf8e3('0x41')]);_0xf4c214[_0xf8e3('0x45')]=_[_0xf8e3('0x46')](_0x2c8a98[_0xf8e3('0x45')]);_0xf4c214[_0xf8e3('0x47')]=_[_0xf8e3('0x48')](_0xf4c214[_0xf8e3('0x44')],_0xf4c214[_0xf8e3('0x45')]);_0x17a184['attributes']=_[_0xf8e3('0x48')](_0xf4c214[_0xf8e3('0x44')],qs['fields'](_0x2c8a98['query'][_0xf8e3('0x49')]));_0x17a184['attributes']=_0x17a184[_0xf8e3('0x4a')][_0xf8e3('0x4b')]?_0x17a184[_0xf8e3('0x4a')]:_0xf4c214['model'];_0x17a184[_0xf8e3('0x4e')]=qs[_0xf8e3('0x4f')](_0x2c8a98['query'][_0xf8e3('0x4f')]);_0x17a184['where']=qs['filters'](_[_0xf8e3('0x51')](_0x2c8a98[_0xf8e3('0x45')],_0xf4c214[_0xf8e3('0x47')]));if(_0x2c8a98['query'][_0xf8e3('0x52')]){_0x17a184[_0xf8e3('0x50')]=_[_0xf8e3('0x53')](_0x17a184[_0xf8e3('0x50')],{'$or':_[_0xf8e3('0x3f')](_0x17a184[_0xf8e3('0x4a')],function(_0x3f4ab6){var _0x4ed284={};_0x4ed284[_0x3f4ab6]={'$like':'%'+_0x2c8a98[_0xf8e3('0x45')][_0xf8e3('0x52')]+'%'};return _0x4ed284;})});}_0x17a184=_[_0xf8e3('0x53')]({},_0x17a184,_0x2c8a98[_0xf8e3('0x55')]);return _0x1112bd[_0xf8e3('0x105')](_0x17a184);}})[_0xf8e3('0x36')](function(_0x5ec2a8){if(_0x5ec2a8){_0x54b0c0=_0x5ec2a8[_0xf8e3('0x4b')];if(!_0x2c8a98['query'][_0xf8e3('0x4c')](_0xf8e3('0x4d'))){_0x17a184[_0xf8e3('0x30')]=qs['limit'](_0x2c8a98['query']['limit']);_0x17a184[_0xf8e3('0x2f')]=qs[_0xf8e3('0x2f')](_0x2c8a98[_0xf8e3('0x45')]['offset']);}return _0x1112bd['getProactiveActions'](_0x17a184);}})[_0xf8e3('0x36')](function(_0x49aacf){if(_0x49aacf){return _0x49aacf?{'count':_0x54b0c0,'rows':_0x49aacf}:null;}})[_0xf8e3('0x36')](respondWithResult(_0x5b8225,null))['catch'](handleError(_0x5b8225,null));};exports[_0xf8e3('0x11b')]=function(_0x24e547,_0x2845ff,_0x2db8b8){var _0x3ef6c8=_0x24e547['query'][_0xf8e3('0x11c')]==='false'?'offlineForm':'onlineForm';return db[_0xf8e3('0x40')][_0xf8e3('0x5a')]({'attributes':['id',_0x3ef6c8],'where':{'id':_0x24e547[_0xf8e3('0x59')]['id']}})[_0xf8e3('0x36')](handleEntityNotFound(_0x2845ff,null))['then'](function(_0x1eb824){if(_0x1eb824){var _0x3f0834=_0x1eb824[_0x3ef6c8];var _0x1429e6=_0x3f0834&&_0x3f0834[_0xf8e3('0x11d')]?_0x3f0834[_0xf8e3('0x11d')]:[];_0x2845ff[_0xf8e3('0x3c')]({'fromKey':_['isNil'](_0x3f0834['fromKey'])?undefined:_0x3f0834['fromKey'],'count':_0x1429e6[_0xf8e3('0x4b')],'rows':_0x1429e6});}})[_0xf8e3('0x5b')](handleError(_0x2845ff,null));};exports[_0xf8e3('0x11e')]=function(_0xb6993c,_0x20421e,_0x146f0b){var _0x15a558={'raw':![],'where':{}};var _0x20610a={};var _0x45f8bb={'count':0x0,'rows':[]};return db[_0xf8e3('0x40')][_0xf8e3('0x66')]({'where':{'id':_0xb6993c['params']['id']}})[_0xf8e3('0x36')](handleEntityNotFound(_0x20421e,null))[_0xf8e3('0x36')](function(_0xfc4daf){if(_0xfc4daf){_0x20610a['model']=_[_0xf8e3('0x46')](db['ChatOfflineMessage'][_0xf8e3('0x41')]);_0x20610a['query']=_[_0xf8e3('0x46')](_0xb6993c[_0xf8e3('0x45')]);_0x20610a[_0xf8e3('0x47')]=_['intersection'](_0x20610a[_0xf8e3('0x44')],_0x20610a[_0xf8e3('0x45')]);_0x15a558['attributes']=_['intersection'](_0x20610a[_0xf8e3('0x44')],qs['fields'](_0xb6993c[_0xf8e3('0x45')]['fields']));_0x15a558['attributes']=_0x15a558[_0xf8e3('0x4a')][_0xf8e3('0x4b')]?_0x15a558[_0xf8e3('0x4a')]:_0x20610a[_0xf8e3('0x44')];if(!_0xb6993c[_0xf8e3('0x45')][_0xf8e3('0x4c')](_0xf8e3('0x4d'))){_0x15a558[_0xf8e3('0x30')]=qs[_0xf8e3('0x30')](_0xb6993c['query'][_0xf8e3('0x30')]);_0x15a558['offset']=qs[_0xf8e3('0x2f')](_0xb6993c['query'][_0xf8e3('0x2f')]);}_0x15a558[_0xf8e3('0x4e')]=qs['sort'](_0xb6993c[_0xf8e3('0x45')]['sort']);_0x15a558[_0xf8e3('0x50')]=qs[_0xf8e3('0x47')](_[_0xf8e3('0x51')](_0xb6993c[_0xf8e3('0x45')],_0x20610a[_0xf8e3('0x47')]));_0x15a558[_0xf8e3('0x50')][_0xf8e3('0x65')]=_0xfc4daf['id'];if(_0xb6993c['query']['filter']){_0x15a558['where']=_[_0xf8e3('0x53')](_0x15a558['where'],{'$or':_[_0xf8e3('0x3f')](_0x15a558[_0xf8e3('0x4a')],function(_0x14e2f5){var _0x1847ec={};_0x1847ec[_0x14e2f5]={'$like':'%'+_0xb6993c[_0xf8e3('0x45')][_0xf8e3('0x52')]+'%'};return _0x1847ec;})});}_0x15a558=_[_0xf8e3('0x53')]({},_0x15a558,_0xb6993c['options']);return db['ChatOfflineMessage'][_0xf8e3('0x32')]({'where':_0x15a558[_0xf8e3('0x50')]})[_0xf8e3('0x36')](function(_0x2bf076){_0x45f8bb[_0xf8e3('0x32')]=_0x2bf076;if(_0xb6993c[_0xf8e3('0x45')][_0xf8e3('0x56')]){_0x15a558[_0xf8e3('0x57')]=[{'all':!![]}];}else{_0x15a558[_0xf8e3('0x57')]=[{'model':db[_0xf8e3('0x8c')],'as':'Contact','required':![]},{'model':db['Attachment'],'as':_0xf8e3('0x11f'),'required':![]}];}return db[_0xf8e3('0x120')][_0xf8e3('0x58')](_0x15a558);})[_0xf8e3('0x36')](function(_0xa7fe30){_0x45f8bb[_0xf8e3('0x68')]=_0xa7fe30;return _0x45f8bb;});}})[_0xf8e3('0x36')](respondWithFilteredResult(_0x20421e,_0x15a558))[_0xf8e3('0x5b')](handleError(_0x20421e,null));};exports[_0xf8e3('0x121')]=function(_0x36ba1a,_0x4baaa9,_0x3e2ca4){return db['ChatWebsite'][_0xf8e3('0x5a')]({'where':{'id':_0x36ba1a[_0xf8e3('0x59')]['id']}})[_0xf8e3('0x36')](handleEntityNotFound(_0x4baaa9,null))[_0xf8e3('0x36')](function(_0x266a0b){if(_0x266a0b){return _0x266a0b[_0xf8e3('0x121')](_0x36ba1a[_0xf8e3('0x5d')]['ids'],_[_0xf8e3('0xf3')](_0x36ba1a['body'],['ids','id'])||{})[_0xf8e3('0xbd')](function(_0x5eecd5){for(var _0x2c4cb9=0x0;_0x2c4cb9<_0x36ba1a[_0xf8e3('0x5d')][_0xf8e3('0x6a')][_0xf8e3('0x4b')];_0x2c4cb9+=0x1){socket[_0xf8e3('0x122')](_0xf8e3('0x123'),{'UserId':Number(_0x36ba1a[_0xf8e3('0x5d')][_0xf8e3('0x6a')][_0x2c4cb9]),'ChatWebsiteId':Number(_0x36ba1a['params']['id'])});}return _0x5eecd5;});}})[_0xf8e3('0x36')](respondWithResult(_0x4baaa9,null))[_0xf8e3('0x5b')](handleError(_0x4baaa9,null));};exports[_0xf8e3('0x124')]=function(_0x29308e,_0x4b0e2e,_0x272649){return db[_0xf8e3('0x40')][_0xf8e3('0x5a')]({'where':{'id':_0x29308e[_0xf8e3('0x59')]['id']}})[_0xf8e3('0x36')](handleEntityNotFound(_0x4b0e2e,null))[_0xf8e3('0x36')](function(_0x56eda3){if(_0x56eda3){return _0x56eda3[_0xf8e3('0x124')](_0x29308e['query'][_0xf8e3('0x6a')])[_0xf8e3('0x36')](function(){if(_[_0xf8e3('0x125')](_0x29308e[_0xf8e3('0x45')][_0xf8e3('0x6a')])){for(var _0x463895=0x0;_0x463895<_0x29308e[_0xf8e3('0x45')][_0xf8e3('0x6a')][_0xf8e3('0x4b')];_0x463895+=0x1){socket['emit'](_0xf8e3('0x126'),{'UserId':Number(_0x29308e[_0xf8e3('0x45')][_0xf8e3('0x6a')][_0x463895]),'ChatWebsiteId':Number(_0x29308e['params']['id'])});}}else{socket[_0xf8e3('0x122')](_0xf8e3('0x126'),{'UserId':Number(_0x29308e[_0xf8e3('0x45')][_0xf8e3('0x6a')]),'ChatWebsiteId':Number(_0x29308e[_0xf8e3('0x59')]['id'])});}});}})[_0xf8e3('0x36')](respondWithStatusCode(_0x4b0e2e,null))[_0xf8e3('0x5b')](handleError(_0x4b0e2e,null));};exports[_0xf8e3('0x127')]=function(_0x2b409d,_0x5e1558,_0x41a772){var _0x207f3a={};var _0x5d0bfa={};var _0x1a1521;var _0x2a2a42;return db[_0xf8e3('0x40')][_0xf8e3('0x66')]({'where':{'id':_0x2b409d[_0xf8e3('0x59')]['id']}})[_0xf8e3('0x36')](handleEntityNotFound(_0x5e1558,null))['then'](function(_0x335c86){if(_0x335c86){_0x1a1521=_0x335c86;_0x5d0bfa['model']=_['keys'](db[_0xf8e3('0xc6')][_0xf8e3('0x41')]);_0x5d0bfa[_0xf8e3('0x45')]=_[_0xf8e3('0x46')](_0x2b409d[_0xf8e3('0x45')]);_0x5d0bfa['filters']=_[_0xf8e3('0x48')](_0x5d0bfa[_0xf8e3('0x44')],_0x5d0bfa[_0xf8e3('0x45')]);_0x207f3a[_0xf8e3('0x4a')]=_['intersection'](_0x5d0bfa[_0xf8e3('0x44')],qs['fields'](_0x2b409d[_0xf8e3('0x45')]['fields']));_0x207f3a[_0xf8e3('0x4a')]=_0x207f3a[_0xf8e3('0x4a')][_0xf8e3('0x4b')]?_0x207f3a[_0xf8e3('0x4a')]:_0x5d0bfa['model'];_0x207f3a[_0xf8e3('0x4e')]=qs['sort'](_0x2b409d['query'][_0xf8e3('0x4f')]);_0x207f3a[_0xf8e3('0x50')]=qs[_0xf8e3('0x47')](_[_0xf8e3('0x51')](_0x2b409d['query'],_0x5d0bfa[_0xf8e3('0x47')]));if(_0x2b409d[_0xf8e3('0x45')][_0xf8e3('0x52')]){_0x207f3a['where']=_[_0xf8e3('0x53')](_0x207f3a['where'],{'$or':_['map'](_0x207f3a[_0xf8e3('0x4a')],function(_0x1023c9){var _0x15a067={};_0x15a067[_0x1023c9]={'$like':'%'+_0x2b409d[_0xf8e3('0x45')]['filter']+'%'};return _0x15a067;})});}_0x207f3a=_[_0xf8e3('0x53')]({},_0x207f3a,_0x2b409d[_0xf8e3('0x55')]);return _0x1a1521['getAgents'](_0x207f3a);}})[_0xf8e3('0x36')](function(_0x1a5396){if(_0x1a5396){_0x2a2a42=_0x1a5396['length'];if(!_0x2b409d[_0xf8e3('0x45')][_0xf8e3('0x4c')]('nolimit')){_0x207f3a['limit']=qs[_0xf8e3('0x30')](_0x2b409d['query']['limit']);_0x207f3a[_0xf8e3('0x2f')]=qs['offset'](_0x2b409d[_0xf8e3('0x45')][_0xf8e3('0x2f')]);}return _0x1a1521[_0xf8e3('0x127')](_0x207f3a);}})[_0xf8e3('0x36')](function(_0x352f18){if(_0x352f18){return _0x352f18?{'count':_0x2a2a42,'rows':_0x352f18}:null;}})['then'](respondWithResult(_0x5e1558,null))[_0xf8e3('0x5b')](handleError(_0x5e1558,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 622467d..28fff25 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 _0x99c9=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite'];(function(_0x277031,_0x1e99d9){var _0x4c8835=function(_0x2e1e26){while(--_0x2e1e26){_0x277031['push'](_0x277031['shift']());}};_0x4c8835(++_0x1e99d9);}(_0x99c9,0x13c));var _0x999c=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x99c9[_0x178e48];return _0x440d7e;};'use strict';var EventEmitter=require(_0x999c('0x0'));var ChatWebsite=require(_0x999c('0x1'))['db'][_0x999c('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x999c('0x3')](0x0);var events={'afterCreate':_0x999c('0x4'),'afterUpdate':_0x999c('0x5'),'afterDestroy':_0x999c('0x6')};function emitEvent(_0x52dc75){return function(_0x2a4e06,_0x140cd5,_0x2d4f2d){ChatWebsiteEvents[_0x999c('0x7')](_0x52dc75+':'+_0x2a4e06['id'],_0x2a4e06);ChatWebsiteEvents[_0x999c('0x7')](_0x52dc75,_0x2a4e06);_0x2d4f2d(null);};}for(var e in events){if(events[_0x999c('0x8')](e)){var event=events[e];ChatWebsite[_0x999c('0x9')](e,emitEvent(event));}}module[_0x999c('0xa')]=ChatWebsiteEvents; \ No newline at end of file +var _0xb1a3=['ChatWebsite','save','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x44f5a1,_0x223a9c){var _0x6bb557=function(_0x578e54){while(--_0x578e54){_0x44f5a1['push'](_0x44f5a1['shift']());}};_0x6bb557(++_0x223a9c);}(_0xb1a3,0x1cc));var _0x3b1a=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xb1a3[_0x5447fd];return _0x15b28a;};'use strict';var EventEmitter=require(_0x3b1a('0x0'));var ChatWebsite=require(_0x3b1a('0x1'))['db'][_0x3b1a('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3b1a('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x41fe6c){return function(_0x77489e,_0xd2c9e1,_0x3fcfd5){ChatWebsiteEvents[_0x3b1a('0x4')](_0x41fe6c+':'+_0x77489e['id'],_0x77489e);ChatWebsiteEvents[_0x3b1a('0x4')](_0x41fe6c,_0x77489e);_0x3fcfd5(null);};}for(var e in events){if(events[_0x3b1a('0x5')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x3b1a('0x6')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index be1d68b..4a79ec7 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 _0x0d47=['rimraf','../../config/environment','./chatWebsite.attributes','exports','ChatWebsite','util','../../config/logger','api','moment','request-promise','path'];(function(_0x179b53,_0x31f6fe){var _0x38a146=function(_0x33f0c2){while(--_0x33f0c2){_0x179b53['push'](_0x179b53['shift']());}};_0x38a146(++_0x31f6fe);}(_0x0d47,0xb5));var _0x70d4=function(_0x4dd3f6,_0x12ad70){_0x4dd3f6=_0x4dd3f6-0x0;var _0xb137f1=_0x0d47[_0x4dd3f6];return _0xb137f1;};'use strict';var _=require('lodash');var util=require(_0x70d4('0x0'));var logger=require(_0x70d4('0x1'))(_0x70d4('0x2'));var moment=require(_0x70d4('0x3'));var BPromise=require('bluebird');var rp=require(_0x70d4('0x4'));var fs=require('fs');var path=require(_0x70d4('0x5'));var rimraf=require(_0x70d4('0x6'));var config=require(_0x70d4('0x7'));var attributes=require(_0x70d4('0x8'));module[_0x70d4('0x9')]=function(_0x5460bb,_0x3bb675){return _0x5460bb['define'](_0x70d4('0xa'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x966e=['./chatWebsite.attributes','define','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x40e4cc,_0x1093e1){var _0x3845c2=function(_0x59c0b2){while(--_0x59c0b2){_0x40e4cc['push'](_0x40e4cc['shift']());}};_0x3845c2(++_0x1093e1);}(_0x966e,0x1a8));var _0xe966=function(_0x262957,_0x34c699){_0x262957=_0x262957-0x0;var _0x27e221=_0x966e[_0x262957];return _0x27e221;};'use strict';var _=require(_0xe966('0x0'));var util=require(_0xe966('0x1'));var logger=require(_0xe966('0x2'))(_0xe966('0x3'));var moment=require(_0xe966('0x4'));var BPromise=require('bluebird');var rp=require(_0xe966('0x5'));var fs=require('fs');var path=require(_0xe966('0x6'));var rimraf=require(_0xe966('0x7'));var config=require('../../config/environment');var attributes=require(_0xe966('0x8'));module['exports']=function(_0x4e5c3f,_0x438f1e){return _0x4e5c3f[_0xe966('0x9')](_0xe966('0xa'),attributes,{'tableName':_0xe966('0xb'),'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 ce01a4f..28707fc 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 _0x7ceb=['../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','util','moment','randomstring','../../mysqldb'];(function(_0x59cb47,_0x1bda58){var _0x1b1e4f=function(_0x14aa4a){while(--_0x14aa4a){_0x59cb47['push'](_0x59cb47['shift']());}};_0x1b1e4f(++_0x1bda58);}(_0x7ceb,0x10f));var _0xb7ce=function(_0x9c1c51,_0x2d637f){_0x9c1c51=_0x9c1c51-0x0;var _0x33fe65=_0x7ceb[_0x9c1c51];return _0x33fe65;};'use strict';var _=require('lodash');var util=require(_0xb7ce('0x0'));var moment=require(_0xb7ce('0x1'));var BPromise=require('bluebird');var rs=require(_0xb7ce('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb7ce('0x3'))['db'];var utils=require(_0xb7ce('0x4'));var logger=require('../../config/logger')(_0xb7ce('0x5'));var config=require('../../config/environment');var jayson=require(_0xb7ce('0x6'));var client=jayson[_0xb7ce('0x7')][_0xb7ce('0x8')]({'port':0x232a});config[_0xb7ce('0x9')]=_[_0xb7ce('0xa')](config[_0xb7ce('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xb7ce('0xb'))(new Redis(config[_0xb7ce('0x9')]));require(_0xb7ce('0xc'))[_0xb7ce('0xd')](socket);function respondWithRpcPromise(_0x334200,_0x2cfe50,_0x4f3a73){return new BPromise(function(_0x37e976,_0x25c5dc){return client[_0xb7ce('0xe')](_0x334200,_0x4f3a73)[_0xb7ce('0xf')](function(_0x47deaf){logger[_0xb7ce('0x10')](_0xb7ce('0x11'),_0x2cfe50,_0xb7ce('0x12'));logger[_0xb7ce('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x2cfe50,_0xb7ce('0x12'),JSON[_0xb7ce('0x14')](_0x47deaf));if(_0x47deaf['error']){if(_0x47deaf['error'][_0xb7ce('0x15')]===0x1f4){logger['error'](_0xb7ce('0x11'),_0x2cfe50,_0x47deaf[_0xb7ce('0x16')][_0xb7ce('0x17')]);return _0x25c5dc(_0x47deaf[_0xb7ce('0x16')][_0xb7ce('0x17')]);}logger[_0xb7ce('0x16')](_0xb7ce('0x11'),_0x2cfe50,_0x47deaf[_0xb7ce('0x16')][_0xb7ce('0x17')]);return _0x37e976(_0x47deaf[_0xb7ce('0x16')]['message']);}else{logger[_0xb7ce('0x10')](_0xb7ce('0x11'),_0x2cfe50,_0xb7ce('0x12'));_0x37e976(_0x47deaf[_0xb7ce('0x18')][_0xb7ce('0x17')]);}})['catch'](function(_0x2acced){logger[_0xb7ce('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x2cfe50,_0x2acced);_0x25c5dc(_0x2acced);});});} \ No newline at end of file +var _0x9ae8=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0xf6afd,_0x409d5b){var _0x31bbca=function(_0x2549b2){while(--_0x2549b2){_0xf6afd['push'](_0xf6afd['shift']());}};_0x31bbca(++_0x409d5b);}(_0x9ae8,0xcc));var _0x89ae=function(_0x33fbfd,_0x547b70){_0x33fbfd=_0x33fbfd-0x0;var _0x520785=_0x9ae8[_0x33fbfd];return _0x520785;};'use strict';var _=require(_0x89ae('0x0'));var util=require(_0x89ae('0x1'));var moment=require(_0x89ae('0x2'));var BPromise=require(_0x89ae('0x3'));var rs=require(_0x89ae('0x4'));var fs=require('fs');var Redis=require(_0x89ae('0x5'));var db=require(_0x89ae('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x89ae('0x7'));var config=require(_0x89ae('0x8'));var jayson=require(_0x89ae('0x9'));var client=jayson[_0x89ae('0xa')][_0x89ae('0xb')]({'port':0x232a});config[_0x89ae('0xc')]=_[_0x89ae('0xd')](config[_0x89ae('0xc')],{'host':_0x89ae('0xe'),'port':0x18eb});var socket=require(_0x89ae('0xf'))(new Redis(config[_0x89ae('0xc')]));require(_0x89ae('0x10'))[_0x89ae('0x11')](socket);function respondWithRpcPromise(_0x20110f,_0x372b9a,_0x16132e){return new BPromise(function(_0x5e58be,_0x5cac6e){return client[_0x89ae('0x12')](_0x20110f,_0x16132e)[_0x89ae('0x13')](function(_0x328f76){logger[_0x89ae('0x14')](_0x89ae('0x15'),_0x372b9a,_0x89ae('0x16'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x372b9a,'request\x20sent',JSON[_0x89ae('0x17')](_0x328f76));if(_0x328f76[_0x89ae('0x18')]){if(_0x328f76[_0x89ae('0x18')][_0x89ae('0x19')]===0x1f4){logger[_0x89ae('0x18')](_0x89ae('0x15'),_0x372b9a,_0x328f76[_0x89ae('0x18')]['message']);return _0x5cac6e(_0x328f76[_0x89ae('0x18')]['message']);}logger[_0x89ae('0x18')](_0x89ae('0x15'),_0x372b9a,_0x328f76['error'][_0x89ae('0x1a')]);return _0x5e58be(_0x328f76[_0x89ae('0x18')][_0x89ae('0x1a')]);}else{logger[_0x89ae('0x14')](_0x89ae('0x15'),_0x372b9a,_0x89ae('0x16'));_0x5e58be(_0x328f76[_0x89ae('0x1b')][_0x89ae('0x1a')]);}})[_0x89ae('0x1c')](function(_0x475c66){logger['error'](_0x89ae('0x15'),_0x372b9a,_0x475c66);_0x5cac6e(_0x475c66);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index b5e669a..23c74b4 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 _0x2b8d=['update','emit','length','chatWebsite:','./chatWebsite.events','save','remove'];(function(_0x425716,_0x3e9d1c){var _0x2d39af=function(_0x1febc1){while(--_0x1febc1){_0x425716['push'](_0x425716['shift']());}};_0x2d39af(++_0x3e9d1c);}(_0x2b8d,0x90));var _0xd2b8=function(_0xe501ff,_0x955b7e){_0xe501ff=_0xe501ff-0x0;var _0x17135d=_0x2b8d[_0xe501ff];return _0x17135d;};'use strict';var ChatWebsiteEvents=require(_0xd2b8('0x0'));var events=[_0xd2b8('0x1'),_0xd2b8('0x2'),_0xd2b8('0x3')];function createListener(_0x972a0a,_0x33489a){return function(_0x1086c3){_0x33489a[_0xd2b8('0x4')](_0x972a0a,_0x1086c3);};}function removeListener(_0x459efa,_0x49b412){return function(){ChatWebsiteEvents['removeListener'](_0x459efa,_0x49b412);};}exports['register']=function(_0x400745){for(var _0x5b381f=0x0,_0x246d33=events[_0xd2b8('0x5')];_0x5b381f<_0x246d33;_0x5b381f++){var _0x3f9a3f=events[_0x5b381f];var _0x1f117a=createListener(_0xd2b8('0x6')+_0x3f9a3f,_0x400745);ChatWebsiteEvents['on'](_0x3f9a3f,_0x1f117a);}}; \ No newline at end of file +var _0x627e=['save','remove','update','emit','chatWebsite:','./chatWebsite.events'];(function(_0x408e38,_0x23cda8){var _0x426b0e=function(_0x8f2898){while(--_0x8f2898){_0x408e38['push'](_0x408e38['shift']());}};_0x426b0e(++_0x23cda8);}(_0x627e,0x1eb));var _0xe627=function(_0x522892,_0x37aa67){_0x522892=_0x522892-0x0;var _0x5ef48c=_0x627e[_0x522892];return _0x5ef48c;};'use strict';var ChatWebsiteEvents=require(_0xe627('0x0'));var events=[_0xe627('0x1'),_0xe627('0x2'),_0xe627('0x3')];function createListener(_0x494d2e,_0x3de001){return function(_0x3fbe8f){_0x3de001[_0xe627('0x4')](_0x494d2e,_0x3fbe8f);};}function removeListener(_0x1b1753,_0x237fe7){return function(){ChatWebsiteEvents['removeListener'](_0x1b1753,_0x237fe7);};}exports['register']=function(_0x2b7a69){for(var _0x1e7362=0x0,_0x45351d=events['length'];_0x1e7362<_0x45351d;_0x1e7362++){var _0x5ee62e=events[_0x1e7362];var _0x579c3e=createListener(_0xe627('0x5')+_0x5ee62e,_0x2b7a69);ChatWebsiteEvents['on'](_0x5ee62e,_0x579c3e);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 441236d..0e944e4 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 _0x276b=['getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','addAvatar','addCustomerAvatar','/:id/notify','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','offline','addInteraction','addApplications','addProactiveActions','put','delete','destroy','removeAnswers','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatWebsite.controller','index','/describe','isAuthenticated','describe','get','/:id','/:id/dispositions','/:id/canned_answers'];(function(_0x187a64,_0x354b20){var _0x3e0147=function(_0x1464ea){while(--_0x1464ea){_0x187a64['push'](_0x187a64['shift']());}};_0x3e0147(++_0x354b20);}(_0x276b,0x7c));var _0xb276=function(_0x5d78ed,_0xedabc4){_0x5d78ed=_0x5d78ed-0x0;var _0x40479b=_0x276b[_0x5d78ed];return _0x40479b;};'use strict';var multer=require(_0xb276('0x0'));var util=require(_0xb276('0x1'));var path=require('path');var timeout=require(_0xb276('0x2'));var express=require(_0xb276('0x3'));var router=express[_0xb276('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb276('0x5'));var config=require(_0xb276('0x6'));var controller=require(_0xb276('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xb276('0x8')]);router['get'](_0xb276('0x9'),auth[_0xb276('0xa')](),controller[_0xb276('0xb')]);router[_0xb276('0xc')](_0xb276('0xd'),auth[_0xb276('0xa')](),controller['show']);router[_0xb276('0xc')](_0xb276('0xe'),auth[_0xb276('0xa')](),controller['getDispositions']);router['get'](_0xb276('0xf'),auth['isAuthenticated'](),controller[_0xb276('0x10')]);router[_0xb276('0xc')](_0xb276('0x11'),controller[_0xb276('0x12')]);router[_0xb276('0xc')](_0xb276('0x13'),controller[_0xb276('0x14')]);router[_0xb276('0xc')](_0xb276('0x15'),controller[_0xb276('0x16')]);router[_0xb276('0xc')](_0xb276('0x17'),controller['getSystemAvatar']);router['get'](_0xb276('0x18'),auth[_0xb276('0xa')](),controller[_0xb276('0x19')]);router[_0xb276('0xc')](_0xb276('0x1a'),controller[_0xb276('0x1b')]);router[_0xb276('0xc')]('/:id/applications',auth['isAuthenticated'](),controller[_0xb276('0x1c')]);router[_0xb276('0xc')](_0xb276('0x1d'),auth[_0xb276('0xa')](),controller['getProactiveActions']);router[_0xb276('0xc')](_0xb276('0x1e'),controller[_0xb276('0x1f')]);router['get'](_0xb276('0x20'),auth[_0xb276('0xa')](),controller[_0xb276('0x21')]);router[_0xb276('0xc')](_0xb276('0x22'),auth[_0xb276('0xa')](),controller[_0xb276('0x23')]);router[_0xb276('0x24')]('/',auth[_0xb276('0xa')](),controller[_0xb276('0x25')]);router['post']('/:id/dispositions',auth[_0xb276('0xa')](),controller[_0xb276('0x26')]);router[_0xb276('0x24')](_0xb276('0xf'),auth[_0xb276('0xa')](),controller[_0xb276('0x27')]);var upload=multer({'storage':multer[_0xb276('0x28')]({'destination':function(_0x5d30ee,_0x4d28ed,_0x2ae8a3){_0x2ae8a3(null,path[_0xb276('0x29')](config[_0xb276('0x2a')],_0xb276('0x2b')));},'filename':function(_0x2db8c6,_0x171925,_0x1e5ba0){_0x1e5ba0(null,util[_0xb276('0x2c')](_0xb276('0x2d'),Date[_0xb276('0x2e')](),_0x171925[_0xb276('0x2f')]));}})});router[_0xb276('0x24')](_0xb276('0x11'),upload[_0xb276('0x30')](_0xb276('0x31')),controller[_0xb276('0x32')]);var upload=multer({'storage':multer[_0xb276('0x28')]({'destination':function(_0x206c77,_0x17ed9b,_0x386c89){_0x386c89(null,path['join'](config[_0xb276('0x2a')],_0xb276('0x33')));},'filename':function(_0x2badbf,_0xd40450,_0x271f62){_0x271f62(null,util[_0xb276('0x2c')](_0xb276('0x2d'),Date[_0xb276('0x2e')](),_0xd40450['originalname']));}})});router[_0xb276('0x24')]('/:id/avatar',upload['single'](_0xb276('0x31')),controller[_0xb276('0x34')]);var upload=multer({'storage':multer[_0xb276('0x28')]({'destination':function(_0x3bdfac,_0x716918,_0x2b281f){_0x2b281f(null,path[_0xb276('0x29')](config['root'],_0xb276('0x33')));},'filename':function(_0x111db2,_0x322272,_0x3f32e8){_0x3f32e8(null,util[_0xb276('0x2c')](_0xb276('0x2d'),Date[_0xb276('0x2e')](),_0x322272[_0xb276('0x2f')]));}})});router[_0xb276('0x24')](_0xb276('0x15'),upload[_0xb276('0x30')](_0xb276('0x31')),controller[_0xb276('0x35')]);var upload=multer({'storage':multer[_0xb276('0x28')]({'destination':function(_0x9e8dfa,_0x28c894,_0x309582){_0x309582(null,path[_0xb276('0x29')](config[_0xb276('0x2a')],_0xb276('0x33')));},'filename':function(_0x1a6a2b,_0x538b6b,_0x43910e){_0x43910e(null,util[_0xb276('0x2c')](_0xb276('0x2d'),Date[_0xb276('0x2e')](),_0x538b6b['originalname']));}})});router[_0xb276('0x24')](_0xb276('0x17'),upload[_0xb276('0x30')]('file'),controller['addSystemAvatar']);router[_0xb276('0x24')](_0xb276('0x36'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xb276('0x28')]({'destination':function(_0x2b5866,_0x2f3aba,_0x110e38){const _0x1f90bd=path[_0xb276('0x29')](config[_0xb276('0x2a')],'server/files',_0xb276('0x37'),_0xb276('0x38'));fs_extra[_0xb276('0x39')](_0x1f90bd,function(){_0x110e38(null,_0x1f90bd);});},'filename':function(_0x28f2d7,_0x35e7b6,_0x552c38){const _0x23b3ee=_0x35e7b6[_0xb276('0x2f')][_0xb276('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x220585=path[_0xb276('0x3b')](_0x23b3ee);const _0x462bb0=Date['now']()+'-'+_0x23b3ee[_0xb276('0x3a')](_0x220585,'')+_0x220585;_0x552c38(null,_0x462bb0);}})});router[_0xb276('0x24')](_0xb276('0x3c'),offlineUploadMulter['any'](),controller[_0xb276('0x3d')]);router[_0xb276('0x24')](_0xb276('0x18'),auth[_0xb276('0xa')](),controller[_0xb276('0x3e')]);router[_0xb276('0x24')]('/:id/applications',auth[_0xb276('0xa')](),controller[_0xb276('0x3f')]);router[_0xb276('0x24')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0xb276('0x40')]);router['post']('/:id/users',auth[_0xb276('0xa')](),controller['addAgents']);router[_0xb276('0x41')]('/:id',auth[_0xb276('0xa')](),controller['update']);router[_0xb276('0x42')]('/:id',auth['isAuthenticated'](),controller[_0xb276('0x43')]);router[_0xb276('0x42')](_0xb276('0xe'),auth[_0xb276('0xa')](),controller['removeDispositions']);router['delete'](_0xb276('0xf'),auth['isAuthenticated'](),controller[_0xb276('0x44')]);router[_0xb276('0x42')](_0xb276('0x22'),auth[_0xb276('0xa')](),controller['removeAgents']);module[_0xb276('0x45')]=router; \ No newline at end of file +var _0xcbef=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','getInteractions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','join','root','server/files/images/logos/','%s-%s','now','originalname','file','addLogo','diskStorage','format','single','addAvatar','server/files/images/avatars/','addCustomerAvatar','addSystemAvatar','notify','offline-chat','extname','replace','/:id/offline','offline','/:id/interactions','addInteraction','addApplications','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path'];(function(_0x166e96,_0x55191d){var _0x553d73=function(_0x586142){while(--_0x586142){_0x166e96['push'](_0x166e96['shift']());}};_0x553d73(++_0x55191d);}(_0xcbef,0x11a));var _0xfcbe=function(_0x3823ca,_0x54508a){_0x3823ca=_0x3823ca-0x0;var _0x496298=_0xcbef[_0x3823ca];return _0x496298;};'use strict';var multer=require('multer');var util=require(_0xfcbe('0x0'));var path=require(_0xfcbe('0x1'));var timeout=require('connect-timeout');var express=require(_0xfcbe('0x2'));var router=express[_0xfcbe('0x3')]();var fs_extra=require(_0xfcbe('0x4'));var auth=require(_0xfcbe('0x5'));var interaction=require(_0xfcbe('0x6'));var config=require(_0xfcbe('0x7'));var controller=require(_0xfcbe('0x8'));router['get']('/',auth[_0xfcbe('0x9')](),controller[_0xfcbe('0xa')]);router[_0xfcbe('0xb')](_0xfcbe('0xc'),auth[_0xfcbe('0x9')](),controller[_0xfcbe('0xd')]);router[_0xfcbe('0xb')](_0xfcbe('0xe'),auth[_0xfcbe('0x9')](),controller[_0xfcbe('0xf')]);router['get'](_0xfcbe('0x10'),auth[_0xfcbe('0x9')](),controller[_0xfcbe('0x11')]);router['get'](_0xfcbe('0x12'),auth[_0xfcbe('0x9')](),controller['getAnswers']);router['get']('/:id/logo',controller[_0xfcbe('0x13')]);router['get'](_0xfcbe('0x14'),controller[_0xfcbe('0x15')]);router[_0xfcbe('0xb')](_0xfcbe('0x16'),controller['getCustomerAvatar']);router['get'](_0xfcbe('0x17'),controller[_0xfcbe('0x18')]);router['get']('/:id/interactions',auth[_0xfcbe('0x9')](),controller[_0xfcbe('0x19')]);router[_0xfcbe('0xb')]('/:id/snippet',controller[_0xfcbe('0x1a')]);router[_0xfcbe('0xb')](_0xfcbe('0x1b'),auth[_0xfcbe('0x9')](),controller[_0xfcbe('0x1c')]);router['get'](_0xfcbe('0x1d'),auth[_0xfcbe('0x9')](),controller[_0xfcbe('0x1e')]);router[_0xfcbe('0xb')](_0xfcbe('0x1f'),controller['getFields']);router[_0xfcbe('0xb')]('/:id/offline_messages',auth['isAuthenticated'](),controller[_0xfcbe('0x20')]);router[_0xfcbe('0xb')](_0xfcbe('0x21'),auth[_0xfcbe('0x9')](),controller[_0xfcbe('0x22')]);router[_0xfcbe('0x23')]('/',auth['isAuthenticated'](),controller[_0xfcbe('0x24')]);router[_0xfcbe('0x23')](_0xfcbe('0x10'),auth[_0xfcbe('0x9')](),controller[_0xfcbe('0x25')]);router[_0xfcbe('0x23')]('/:id/canned_answers',auth[_0xfcbe('0x9')](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1f6941,_0x2a62f9,_0x1ae1cf){_0x1ae1cf(null,path[_0xfcbe('0x26')](config[_0xfcbe('0x27')],_0xfcbe('0x28')));},'filename':function(_0x5dbf5c,_0x5eb6f1,_0x18b167){_0x18b167(null,util['format'](_0xfcbe('0x29'),Date[_0xfcbe('0x2a')](),_0x5eb6f1[_0xfcbe('0x2b')]));}})});router[_0xfcbe('0x23')]('/:id/logo',upload['single'](_0xfcbe('0x2c')),controller[_0xfcbe('0x2d')]);var upload=multer({'storage':multer[_0xfcbe('0x2e')]({'destination':function(_0x54a1d0,_0x579e95,_0x28305f){_0x28305f(null,path[_0xfcbe('0x26')](config[_0xfcbe('0x27')],'server/files/images/avatars/'));},'filename':function(_0x46f418,_0x18f623,_0x1b7be7){_0x1b7be7(null,util[_0xfcbe('0x2f')](_0xfcbe('0x29'),Date[_0xfcbe('0x2a')](),_0x18f623[_0xfcbe('0x2b')]));}})});router[_0xfcbe('0x23')](_0xfcbe('0x14'),upload[_0xfcbe('0x30')](_0xfcbe('0x2c')),controller[_0xfcbe('0x31')]);var upload=multer({'storage':multer[_0xfcbe('0x2e')]({'destination':function(_0x551ed8,_0x2ef6c4,_0x4ad339){_0x4ad339(null,path[_0xfcbe('0x26')](config[_0xfcbe('0x27')],_0xfcbe('0x32')));},'filename':function(_0x32b411,_0x5c41f9,_0x229da9){_0x229da9(null,util[_0xfcbe('0x2f')](_0xfcbe('0x29'),Date[_0xfcbe('0x2a')](),_0x5c41f9[_0xfcbe('0x2b')]));}})});router[_0xfcbe('0x23')](_0xfcbe('0x16'),upload[_0xfcbe('0x30')](_0xfcbe('0x2c')),controller[_0xfcbe('0x33')]);var upload=multer({'storage':multer[_0xfcbe('0x2e')]({'destination':function(_0x2858b1,_0x5a7b32,_0x10c2c4){_0x10c2c4(null,path[_0xfcbe('0x26')](config['root'],_0xfcbe('0x32')));},'filename':function(_0x12bd9b,_0x53bf31,_0x253a43){_0x253a43(null,util['format'](_0xfcbe('0x29'),Date['now'](),_0x53bf31['originalname']));}})});router[_0xfcbe('0x23')]('/:id/system_avatar',upload[_0xfcbe('0x30')](_0xfcbe('0x2c')),controller[_0xfcbe('0x34')]);router['post']('/:id/notify',controller[_0xfcbe('0x35')]);const offlineUploadMulter=multer({'storage':multer[_0xfcbe('0x2e')]({'destination':function(_0x366b7d,_0x52107c,_0x47008d){const _0x33f869=path[_0xfcbe('0x26')](config['root'],'server/files','attachments',_0xfcbe('0x36'));fs_extra['ensureDir'](_0x33f869,function(){_0x47008d(null,_0x33f869);});},'filename':function(_0xa135fb,_0x4f43da,_0x439888){const _0x4cf43d=_0x4f43da[_0xfcbe('0x2b')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x3e9b7a=path[_0xfcbe('0x37')](_0x4cf43d);const _0x35f292=Date[_0xfcbe('0x2a')]()+'-'+_0x4cf43d[_0xfcbe('0x38')](_0x3e9b7a,'')+_0x3e9b7a;_0x439888(null,_0x35f292);}})});router[_0xfcbe('0x23')](_0xfcbe('0x39'),offlineUploadMulter['any'](),controller[_0xfcbe('0x3a')]);router[_0xfcbe('0x23')](_0xfcbe('0x3b'),auth[_0xfcbe('0x9')](),controller[_0xfcbe('0x3c')]);router[_0xfcbe('0x23')](_0xfcbe('0x1b'),auth[_0xfcbe('0x9')](),controller[_0xfcbe('0x3d')]);router[_0xfcbe('0x23')](_0xfcbe('0x1d'),auth[_0xfcbe('0x9')](),controller['addProactiveActions']);router['post'](_0xfcbe('0x21'),auth['isAuthenticated'](),controller[_0xfcbe('0x3e')]);router[_0xfcbe('0x3f')](_0xfcbe('0xe'),auth['isAuthenticated'](),controller[_0xfcbe('0x40')]);router[_0xfcbe('0x41')]('/:id',auth['isAuthenticated'](),controller[_0xfcbe('0x42')]);router[_0xfcbe('0x41')](_0xfcbe('0x10'),auth[_0xfcbe('0x9')](),controller[_0xfcbe('0x43')]);router[_0xfcbe('0x41')]('/:id/canned_answers',auth[_0xfcbe('0x9')](),controller[_0xfcbe('0x44')]);router[_0xfcbe('0x41')](_0xfcbe('0x21'),auth[_0xfcbe('0x9')](),controller[_0xfcbe('0x45')]);module[_0xfcbe('0x46')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index ea37b54..0084409 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 _0xea31=['AmazonAWS','Google','sequelize','STRING','ENUM'];(function(_0x3196e7,_0x577155){var _0x352207=function(_0x2efb7a){while(--_0x2efb7a){_0x3196e7['push'](_0x3196e7['shift']());}};_0x352207(++_0x577155);}(_0xea31,0x6b));var _0x1ea3=function(_0x11cda4,_0x589013){_0x11cda4=_0x11cda4-0x0;var _0x5ef9ab=_0xea31[_0x11cda4];return _0x5ef9ab;};'use strict';var Sequelize=require(_0x1ea3('0x0'));module['exports']={'name':{'type':Sequelize[_0x1ea3('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x1ea3('0x2')](_0x1ea3('0x3'),_0x1ea3('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x1ea3('0x1')]},'data2':{'type':Sequelize[_0x1ea3('0x1')]}}; \ No newline at end of file +var _0xbfe8=['STRING','exports','ENUM','AmazonAWS'];(function(_0x1f7c90,_0x23a49e){var _0x145a29=function(_0x3a49d7){while(--_0x3a49d7){_0x1f7c90['push'](_0x1f7c90['shift']());}};_0x145a29(++_0x23a49e);}(_0xbfe8,0x1b9));var _0x8bfe=function(_0x5af700,_0x47c20f){_0x5af700=_0x5af700-0x0;var _0x24c281=_0xbfe8[_0x5af700];return _0x24c281;};'use strict';var Sequelize=require('sequelize');module[_0x8bfe('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x8bfe('0x1')](_0x8bfe('0x2'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x8bfe('0x3')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 57270fb..aa8f041 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 _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(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4ad6ad,_0x4dcb4f){_0x4ad6ad=_0x4ad6ad-0x0;var _0x51bc14=_0x5f2f[_0x4ad6ad];return _0x51bc14;};'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 +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(_0x2ba4de,_0x37a66f){var _0x381eb7=function(_0xf2b84a){while(--_0xf2b84a){_0x2ba4de['push'](_0x2ba4de['shift']());}};_0x381eb7(++_0x37a66f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1bf8cc,_0x118778){_0x1bf8cc=_0x1bf8cc-0x0;var _0x322d20=_0x0b0e[_0x1bf8cc];return _0x322d20;};'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 diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 4978d17..8a2bb38 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 _0x92c3=['rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','path'];(function(_0x3971a7,_0x3d77bb){var _0x1e1363=function(_0x3b808d){while(--_0x3b808d){_0x3971a7['push'](_0x3971a7['shift']());}};_0x1e1363(++_0x3d77bb);}(_0x92c3,0x1e8));var _0x392c=function(_0x4c1327,_0xd2183e){_0x4c1327=_0x4c1327-0x0;var _0x436f33=_0x92c3[_0x4c1327];return _0x436f33;};'use strict';var _=require(_0x392c('0x0'));var util=require(_0x392c('0x1'));var logger=require(_0x392c('0x2'))(_0x392c('0x3'));var moment=require(_0x392c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x392c('0x5'));var rimraf=require(_0x392c('0x6'));var config=require(_0x392c('0x7'));var attributes=require(_0x392c('0x8'));module[_0x392c('0x9')]=function(_0x2222b5,_0x28597b){return _0x2222b5[_0x392c('0xa')](_0x392c('0xb'),attributes,{'tableName':_0x392c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x499d=['bluebird','request-promise','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api'];(function(_0xb14c4c,_0x1382a6){var _0x4cbb01=function(_0x4799eb){while(--_0x4799eb){_0xb14c4c['push'](_0xb14c4c['shift']());}};_0x4cbb01(++_0x1382a6);}(_0x499d,0x182));var _0xd499=function(_0x5700bc,_0x556e5b){_0x5700bc=_0x5700bc-0x0;var _0x42e979=_0x499d[_0x5700bc];return _0x42e979;};'use strict';var _=require(_0xd499('0x0'));var util=require(_0xd499('0x1'));var logger=require(_0xd499('0x2'))(_0xd499('0x3'));var moment=require('moment');var BPromise=require(_0xd499('0x4'));var rp=require(_0xd499('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd499('0x6'));var config=require(_0xd499('0x7'));var attributes=require(_0xd499('0x8'));module[_0xd499('0x9')]=function(_0x4cb282,_0x57959b){return _0x4cb282[_0xd499('0xa')](_0xd499('0xb'),attributes,{'tableName':_0xd499('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 6da4af1..afc915d 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 _0x161a=['moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x3b90c9,_0x35f6e8){var _0x336887=function(_0x37cfbe){while(--_0x37cfbe){_0x3b90c9['push'](_0x3b90c9['shift']());}};_0x336887(++_0x35f6e8);}(_0x161a,0x140));var _0xa161=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x161a[_0x2fc012];return _0x2891f9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa161('0x0'));var BPromise=require(_0xa161('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa161('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa161('0x3'));var logger=require(_0xa161('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa161('0x5'));var client=jayson[_0xa161('0x6')][_0xa161('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x8a253b,_0x264bd0,_0x28aaf5){return new BPromise(function(_0x3fa9e2,_0x48a7c2){return client[_0xa161('0x8')](_0x8a253b,_0x28aaf5)[_0xa161('0x9')](function(_0x327221){logger[_0xa161('0xa')](_0xa161('0xb'),_0x264bd0,_0xa161('0xc'));logger[_0xa161('0xd')](_0xa161('0xe'),_0x264bd0,_0xa161('0xc'),JSON[_0xa161('0xf')](_0x327221));if(_0x327221[_0xa161('0x10')]){if(_0x327221[_0xa161('0x10')][_0xa161('0x11')]===0x1f4){logger['error'](_0xa161('0xb'),_0x264bd0,_0x327221[_0xa161('0x10')][_0xa161('0x12')]);return _0x48a7c2(_0x327221[_0xa161('0x10')]['message']);}logger[_0xa161('0x10')](_0xa161('0xb'),_0x264bd0,_0x327221['error'][_0xa161('0x12')]);return _0x3fa9e2(_0x327221[_0xa161('0x10')]['message']);}else{logger[_0xa161('0xa')](_0xa161('0xb'),_0x264bd0,_0xa161('0xc'));_0x3fa9e2(_0x327221['result'][_0xa161('0x12')]);}})[_0xa161('0x13')](function(_0x27b79f){logger[_0xa161('0x10')](_0xa161('0xb'),_0x264bd0,_0x27b79f);_0x48a7c2(_0x27b79f);});});} \ No newline at end of file +var _0x47c5=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x41382c,_0xc3ffd1){var _0x4da35b=function(_0x5d56b8){while(--_0x5d56b8){_0x41382c['push'](_0x41382c['shift']());}};_0x4da35b(++_0xc3ffd1);}(_0x47c5,0x165));var _0x547c=function(_0x15c1eb,_0x3c8cb8){_0x15c1eb=_0x15c1eb-0x0;var _0x630e54=_0x47c5[_0x15c1eb];return _0x630e54;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439f25,_0x381f2e,_0x10a334){return new BPromise(function(_0x12fb7d,_0x4ef079){return client[_0x547c('0xb')](_0x439f25,_0x10a334)[_0x547c('0xc')](function(_0x10dec9){logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));logger[_0x547c('0x10')](_0x547c('0x11'),_0x381f2e,_0x547c('0xf'),JSON[_0x547c('0x12')](_0x10dec9));if(_0x10dec9[_0x547c('0x13')]){if(_0x10dec9['error'][_0x547c('0x14')]===0x1f4){logger[_0x547c('0x13')]('CloudProvider,\x20%s,\x20%s',_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x4ef079(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}logger[_0x547c('0x13')](_0x547c('0xe'),_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x12fb7d(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}else{logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));_0x12fb7d(_0x10dec9[_0x547c('0x16')][_0x547c('0x15')]);}})[_0x547c('0x17')](function(_0x39498d){logger[_0x547c('0x13')]('CloudProvider,\x20%s,\x20%s',_0x381f2e,_0x39498d);_0x4ef079(_0x39498d);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 0f9df39..4690457 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 _0x191b=['/:id','create','exports','util','path','connect-timeout','express','Router','get','isAuthenticated','index'];(function(_0x3af597,_0x56b82d){var _0x2c69da=function(_0x57016a){while(--_0x57016a){_0x3af597['push'](_0x3af597['shift']());}};_0x2c69da(++_0x56b82d);}(_0x191b,0x100));var _0xb191=function(_0x512d49,_0x907617){_0x512d49=_0x512d49-0x0;var _0x348d3f=_0x191b[_0x512d49];return _0x348d3f;};'use strict';var multer=require('multer');var util=require(_0xb191('0x0'));var path=require(_0xb191('0x1'));var timeout=require(_0xb191('0x2'));var express=require(_0xb191('0x3'));var router=express[_0xb191('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('./cloudProvider.controller');router[_0xb191('0x5')]('/',auth[_0xb191('0x6')](),controller[_0xb191('0x7')]);router[_0xb191('0x5')](_0xb191('0x8'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xb191('0x6')](),controller[_0xb191('0x9')]);router['put'](_0xb191('0x8'),auth[_0xb191('0x6')](),controller['update']);router['delete'](_0xb191('0x8'),auth[_0xb191('0x6')](),controller['destroy']);module[_0xb191('0xa')]=router; \ No newline at end of file +var _0x8303=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','show','post','put','delete','exports','multer'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8303,0xaa));var _0x3830=function(_0x327ebc,_0x437101){_0x327ebc=_0x327ebc-0x0;var _0x56e759=_0x8303[_0x327ebc];return _0x56e759;};'use strict';var multer=require(_0x3830('0x0'));var util=require('util');var path=require(_0x3830('0x1'));var timeout=require(_0x3830('0x2'));var express=require(_0x3830('0x3'));var router=express[_0x3830('0x4')]();var fs_extra=require(_0x3830('0x5'));var auth=require(_0x3830('0x6'));var interaction=require(_0x3830('0x7'));var config=require(_0x3830('0x8'));var controller=require(_0x3830('0x9'));router[_0x3830('0xa')]('/',auth[_0x3830('0xb')](),controller[_0x3830('0xc')]);router[_0x3830('0xa')](_0x3830('0xd'),auth[_0x3830('0xb')](),controller[_0x3830('0xe')]);router[_0x3830('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3830('0x10')](_0x3830('0xd'),auth[_0x3830('0xb')](),controller['update']);router[_0x3830('0x11')](_0x3830('0xd'),auth[_0x3830('0xb')](),controller['destroy']);module[_0x3830('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 93a0796..4450b17 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 _0x0a24=['sequelize','exports','name','STRING'];(function(_0x6f7c64,_0x4a8555){var _0x16753a=function(_0xbb964c){while(--_0xbb964c){_0x6f7c64['push'](_0x6f7c64['shift']());}};_0x16753a(++_0x4a8555);}(_0x0a24,0xd0));var _0x40a2=function(_0x2265b0,_0x279abe){_0x2265b0=_0x2265b0-0x0;var _0xc4900b=_0x0a24[_0x2265b0];return _0xc4900b;};'use strict';var Sequelize=require(_0x40a2('0x0'));module[_0x40a2('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x40a2('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x40a2('0x3')]},'website':{'type':Sequelize[_0x40a2('0x3')]},'phone':{'type':Sequelize[_0x40a2('0x3')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x40a2('0x3')]},'street':{'type':Sequelize[_0x40a2('0x3')]},'postalCode':{'type':Sequelize[_0x40a2('0x3')]},'city':{'type':Sequelize[_0x40a2('0x3')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x40a2('0x3')]},'sStreet':{'type':Sequelize[_0x40a2('0x3')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x40a2('0x3')]},'sCountry':{'type':Sequelize[_0x40a2('0x3')]},'description':{'type':Sequelize[_0x40a2('0x3')]}}; \ No newline at end of file +var _0x2e3d=['sequelize','exports','STRING','name'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x2e3d,0x8c));var _0xd2e3=function(_0x4db82b,_0xa3b53f){_0x4db82b=_0x4db82b-0x0;var _0x368b8a=_0x2e3d[_0x4db82b];return _0x368b8a;};'use strict';var Sequelize=require(_0xd2e3('0x0'));module[_0xd2e3('0x1')]={'name':{'type':Sequelize[_0xd2e3('0x2')],'unique':_0xd2e3('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xd2e3('0x2')]},'companyId':{'type':Sequelize[_0xd2e3('0x2')]},'website':{'type':Sequelize[_0xd2e3('0x2')]},'phone':{'type':Sequelize[_0xd2e3('0x2')]},'fax':{'type':Sequelize[_0xd2e3('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xd2e3('0x2')]},'postalCode':{'type':Sequelize[_0xd2e3('0x2')]},'city':{'type':Sequelize[_0xd2e3('0x2')]},'country':{'type':Sequelize[_0xd2e3('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xd2e3('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xd2e3('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xd2e3('0x2')]},'description':{'type':Sequelize[_0xd2e3('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 1b49628..fb4e770 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 _0x2d35=['destroy','sendStatus','error','stack','name','send','index','CmCompany','model','query','keys','filters','attributes','intersection','fields','length','order','sort','pick','where','map','filter','merge','options','includeAll','include','findAll','catch','show','rawAttributes','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addContacts','CmContact','omit','ids','getContacts','findOne','hasOwnProperty','nolimit','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','Companies','UserProfileResource'];(function(_0x7818c1,_0x27ca7e){var _0x3ba860=function(_0x433c9e){while(--_0x433c9e){_0x7818c1['push'](_0x7818c1['shift']());}};_0x3ba860(++_0x27ca7e);}(_0x2d35,0xe3));var _0x52d3=function(_0x436e94,_0x3e9b31){_0x436e94=_0x436e94-0x0;var _0x3e213b=_0x2d35[_0x436e94];return _0x3e213b;};'use strict';var emlformat=require(_0x52d3('0x0'));var rimraf=require(_0x52d3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x52d3('0x2'));var rp=require(_0x52d3('0x3'));var moment=require(_0x52d3('0x4'));var BPromise=require(_0x52d3('0x5'));var Mustache=require(_0x52d3('0x6'));var util=require(_0x52d3('0x7'));var path=require('path');var sox=require(_0x52d3('0x8'));var csv=require(_0x52d3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x52d3('0xa'));var crypto=require(_0x52d3('0xb'));var jsforce=require(_0x52d3('0xc'));var deskjs=require(_0x52d3('0xd'));var toCsv=require(_0x52d3('0x9'));var querystring=require(_0x52d3('0xe'));var Papa=require(_0x52d3('0xf'));var Redis=require('ioredis');var authService=require(_0x52d3('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x52d3('0x11'));var hardwareService=require(_0x52d3('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x52d3('0x13'));var config=require(_0x52d3('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x52d3('0x15'))['db'];function respondWithStatusCode(_0x3b6729,_0x1805c0){_0x1805c0=_0x1805c0||0xcc;return function(_0x1dde44){if(_0x1dde44){return _0x3b6729['sendStatus'](_0x1805c0);}return _0x3b6729[_0x52d3('0x16')](_0x1805c0)[_0x52d3('0x17')]();};}function respondWithResult(_0x36f8e8,_0x2932b7){_0x2932b7=_0x2932b7||0xc8;return function(_0x59ae43){if(_0x59ae43){return _0x36f8e8['status'](_0x2932b7)[_0x52d3('0x18')](_0x59ae43);}};}function respondWithFilteredResult(_0x1dba0f,_0x3e3fc9){return function(_0x5d954f){if(_0x5d954f){var _0x1ab99b=typeof _0x3e3fc9[_0x52d3('0x19')]===_0x52d3('0x1a')&&typeof _0x3e3fc9[_0x52d3('0x1b')]===_0x52d3('0x1a');var _0x167261=_0x5d954f[_0x52d3('0x1c')];var _0x2fe4ad=_0x1ab99b?0x0:_0x3e3fc9[_0x52d3('0x19')];var _0x1344dc=_0x1ab99b?_0x5d954f['count']:_0x3e3fc9[_0x52d3('0x19')]+_0x3e3fc9[_0x52d3('0x1b')];var _0x416bac;if(_0x1344dc>=_0x167261){_0x1344dc=_0x167261;_0x416bac=0xc8;}else{_0x416bac=0xce;}_0x1dba0f[_0x52d3('0x16')](_0x416bac);return _0x1dba0f[_0x52d3('0x1d')](_0x52d3('0x1e'),_0x2fe4ad+'-'+_0x1344dc+'/'+_0x167261)[_0x52d3('0x18')](_0x5d954f);}return null;};}function patchUpdates(_0x53dac6){return function(_0x100bad){try{jsonpatch[_0x52d3('0x1f')](_0x100bad,_0x53dac6,!![]);}catch(_0x4ba8e1){return BPromise[_0x52d3('0x20')](_0x4ba8e1);}return _0x100bad['save']();};}function saveUpdates(_0x3eafd5,_0x2c62f9){return function(_0xc16750){if(_0xc16750){return _0xc16750[_0x52d3('0x21')](_0x3eafd5)[_0x52d3('0x22')](function(_0x62b8f3){return _0x62b8f3;});}return null;};}function removeEntity(_0x3a22c8,_0x1e6d6a){return function(_0x535b18){if(_0x535b18){return _0x535b18['destroy']()[_0x52d3('0x22')](function(){var _0x817c6a=_0x535b18['get']({'plain':!![]});var _0x527dab=_0x52d3('0x23');return db[_0x52d3('0x24')][_0x52d3('0x25')]({'where':{'type':_0x527dab,'resourceId':_0x817c6a['id']}})[_0x52d3('0x22')](function(){return _0x535b18;});})[_0x52d3('0x22')](function(){_0x3a22c8[_0x52d3('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x787682,_0x246494){return function(_0x39bf0d){if(!_0x39bf0d){_0x787682[_0x52d3('0x26')](0x194);}return _0x39bf0d;};}function handleError(_0x114c9e,_0xc9a92){_0xc9a92=_0xc9a92||0x1f4;return function(_0x3bc583){logger[_0x52d3('0x27')](_0x3bc583[_0x52d3('0x28')]);if(_0x3bc583[_0x52d3('0x29')]){delete _0x3bc583[_0x52d3('0x29')];}_0x114c9e['status'](_0xc9a92)[_0x52d3('0x2a')](_0x3bc583);};}exports[_0x52d3('0x2b')]=function(_0x3d8df1,_0x5e437b){var _0x45d6db={},_0x23db85={},_0x2029a9={'count':0x0,'rows':[]};return db[_0x52d3('0x2c')]['describe']()[_0x52d3('0x22')](function(_0x109e86){_0x23db85[_0x52d3('0x2d')]=_['keys'](_0x109e86);_0x23db85[_0x52d3('0x2e')]=_[_0x52d3('0x2f')](_0x3d8df1['query']);_0x23db85[_0x52d3('0x30')]=_['intersection'](_0x23db85[_0x52d3('0x2d')],_0x23db85['query']);_0x45d6db[_0x52d3('0x31')]=_[_0x52d3('0x32')](_0x23db85['model'],qs[_0x52d3('0x33')](_0x3d8df1[_0x52d3('0x2e')][_0x52d3('0x33')]));_0x45d6db['attributes']=_0x45d6db[_0x52d3('0x31')][_0x52d3('0x34')]?_0x45d6db[_0x52d3('0x31')]:_0x23db85['model'];if(!_0x3d8df1[_0x52d3('0x2e')]['hasOwnProperty']('nolimit')){_0x45d6db[_0x52d3('0x1b')]=qs[_0x52d3('0x1b')](_0x3d8df1[_0x52d3('0x2e')][_0x52d3('0x1b')]);_0x45d6db['offset']=qs[_0x52d3('0x19')](_0x3d8df1[_0x52d3('0x2e')]['offset']);}_0x45d6db[_0x52d3('0x35')]=qs['sort'](_0x3d8df1[_0x52d3('0x2e')][_0x52d3('0x36')]);_0x45d6db['where']=qs[_0x52d3('0x30')](_[_0x52d3('0x37')](_0x3d8df1['query'],_0x23db85[_0x52d3('0x30')]),_0x109e86);if(_0x3d8df1[_0x52d3('0x2e')]['filter']){_0x45d6db[_0x52d3('0x38')]=_['merge'](_0x45d6db[_0x52d3('0x38')],{'$or':_[_0x52d3('0x39')](_0x45d6db[_0x52d3('0x31')],function(_0x497126){var _0x3fe77a={};_0x3fe77a[_0x497126]={'$like':'%'+_0x3d8df1[_0x52d3('0x2e')][_0x52d3('0x3a')]+'%'};return _0x3fe77a;})});}_0x45d6db=_[_0x52d3('0x3b')]({},_0x45d6db,_0x3d8df1[_0x52d3('0x3c')]);var _0x4c4fe1={'where':_0x45d6db[_0x52d3('0x38')]};return db[_0x52d3('0x2c')]['count'](_0x4c4fe1)[_0x52d3('0x22')](function(_0x2eff82){_0x2029a9[_0x52d3('0x1c')]=_0x2eff82;if(_0x3d8df1[_0x52d3('0x2e')][_0x52d3('0x3d')]){_0x45d6db[_0x52d3('0x3e')]=[{'all':!![]}];}return db[_0x52d3('0x2c')][_0x52d3('0x3f')](_0x45d6db);})['then'](function(_0x20cdbc){_0x2029a9['rows']=_0x20cdbc;return _0x2029a9;})[_0x52d3('0x22')](respondWithFilteredResult(_0x5e437b,_0x45d6db))[_0x52d3('0x40')](handleError(_0x5e437b,null));})[_0x52d3('0x40')](handleError(_0x5e437b,null));};exports[_0x52d3('0x41')]=function(_0x393576,_0x7a30e2){var _0x536c51={'raw':![],'where':{'id':_0x393576['params']['id']}},_0x33d6f1={};_0x33d6f1[_0x52d3('0x2d')]=_[_0x52d3('0x2f')](db['CmCompany'][_0x52d3('0x42')]);_0x33d6f1[_0x52d3('0x2e')]=_['keys'](_0x393576['query']);_0x33d6f1[_0x52d3('0x30')]=_[_0x52d3('0x32')](_0x33d6f1['model'],_0x33d6f1['query']);_0x536c51['attributes']=_[_0x52d3('0x32')](_0x33d6f1['model'],qs[_0x52d3('0x33')](_0x393576[_0x52d3('0x2e')][_0x52d3('0x33')]));_0x536c51[_0x52d3('0x31')]=_0x536c51['attributes'][_0x52d3('0x34')]?_0x536c51[_0x52d3('0x31')]:_0x33d6f1[_0x52d3('0x2d')];if(_0x393576['query'][_0x52d3('0x3d')]){_0x536c51[_0x52d3('0x3e')]=[{'all':!![]}];}_0x536c51=_[_0x52d3('0x3b')]({},_0x536c51,_0x393576['options']);return db['CmCompany'][_0x52d3('0x43')](_0x536c51)[_0x52d3('0x22')](handleEntityNotFound(_0x7a30e2,null))[_0x52d3('0x22')](respondWithResult(_0x7a30e2,null))[_0x52d3('0x40')](handleError(_0x7a30e2,null));};exports[_0x52d3('0x44')]=function(_0x3ee477,_0x15c889){return db[_0x52d3('0x2c')][_0x52d3('0x44')](_0x3ee477[_0x52d3('0x45')],{})[_0x52d3('0x22')](function(_0x338071){var _0x2a1269=_0x3ee477['user'][_0x52d3('0x46')]({'plain':!![]});if(!_0x2a1269)throw new Error(_0x52d3('0x47'));if(_0x2a1269[_0x52d3('0x48')]===_0x52d3('0x49')){var _0x816ea9=_0x338071[_0x52d3('0x46')]({'plain':!![]});var _0x15c95c='Companies';return db[_0x52d3('0x4a')]['find']({'where':{'name':_0x15c95c,'userProfileId':_0x2a1269[_0x52d3('0x4b')]},'raw':!![]})[_0x52d3('0x22')](function(_0x92c6c9){if(_0x92c6c9&&_0x92c6c9[_0x52d3('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x816ea9[_0x52d3('0x29')],'resourceId':_0x816ea9['id'],'type':_0x92c6c9[_0x52d3('0x29')],'sectionId':_0x92c6c9['id']},{})['then'](function(){return _0x338071;});}else{return _0x338071;}})[_0x52d3('0x40')](function(_0x4a1529){logger[_0x52d3('0x27')](_0x52d3('0x4d'),_0x4a1529);throw _0x4a1529;});}return _0x338071;})[_0x52d3('0x22')](respondWithResult(_0x15c889,0xc9))[_0x52d3('0x40')](handleError(_0x15c889,null));};exports['update']=function(_0x1c6feb,_0x2747ea){if(_0x1c6feb['body']['id']){delete _0x1c6feb[_0x52d3('0x45')]['id'];}return db[_0x52d3('0x2c')]['find']({'where':{'id':_0x1c6feb[_0x52d3('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2747ea,null))[_0x52d3('0x22')](saveUpdates(_0x1c6feb['body'],null))[_0x52d3('0x22')](respondWithResult(_0x2747ea,null))['catch'](handleError(_0x2747ea,null));};exports[_0x52d3('0x25')]=function(_0x3e5161,_0x1924dd){return db['CmCompany'][_0x52d3('0x43')]({'where':{'id':_0x3e5161[_0x52d3('0x4e')]['id']}})[_0x52d3('0x22')](handleEntityNotFound(_0x1924dd,null))[_0x52d3('0x22')](removeEntity(_0x1924dd,null))[_0x52d3('0x40')](handleError(_0x1924dd,null));};exports[_0x52d3('0x4f')]=function(_0x25cd3d,_0x50c8c2){return db[_0x52d3('0x2c')][_0x52d3('0x4f')]()[_0x52d3('0x22')](respondWithResult(_0x50c8c2,null))[_0x52d3('0x40')](handleError(_0x50c8c2,null));};exports[_0x52d3('0x50')]=function(_0x2c36a8,_0x23a1cf,_0x1f196b){return db[_0x52d3('0x51')][_0x52d3('0x43')]({'where':{'id':_0x2c36a8[_0x52d3('0x4e')]['id']}})[_0x52d3('0x22')](handleEntityNotFound(_0x23a1cf,null))['then'](function(_0x996174){if(_0x996174){return _0x996174[_0x52d3('0x50')](_0x2c36a8['body']['ids'],_[_0x52d3('0x52')](_0x2c36a8['body'],[_0x52d3('0x53'),'id'])||{});}})[_0x52d3('0x22')](respondWithResult(_0x23a1cf,null))[_0x52d3('0x40')](handleError(_0x23a1cf,null));};exports[_0x52d3('0x54')]=function(_0x27166d,_0x3efc82,_0x413575){var _0x4ff603={};var _0x46bfb1={};var _0x513bba;var _0x17ae01;return db[_0x52d3('0x2c')][_0x52d3('0x55')]({'where':{'id':_0x27166d['params']['id']}})['then'](handleEntityNotFound(_0x3efc82,null))['then'](function(_0x21b945){if(_0x21b945){_0x513bba=_0x21b945;_0x46bfb1[_0x52d3('0x2d')]=_['keys'](db['CmContact'][_0x52d3('0x42')]);_0x46bfb1['query']=_[_0x52d3('0x2f')](_0x27166d['query']);_0x46bfb1['filters']=_['intersection'](_0x46bfb1['model'],_0x46bfb1[_0x52d3('0x2e')]);_0x4ff603[_0x52d3('0x31')]=_['intersection'](_0x46bfb1[_0x52d3('0x2d')],qs[_0x52d3('0x33')](_0x27166d['query'][_0x52d3('0x33')]));_0x4ff603[_0x52d3('0x31')]=_0x4ff603[_0x52d3('0x31')]['length']?_0x4ff603[_0x52d3('0x31')]:_0x46bfb1['model'];_0x4ff603[_0x52d3('0x35')]=qs[_0x52d3('0x36')](_0x27166d[_0x52d3('0x2e')][_0x52d3('0x36')]);_0x4ff603[_0x52d3('0x38')]=qs[_0x52d3('0x30')](_[_0x52d3('0x37')](_0x27166d[_0x52d3('0x2e')],_0x46bfb1[_0x52d3('0x30')]));if(_0x27166d[_0x52d3('0x2e')][_0x52d3('0x3a')]){_0x4ff603[_0x52d3('0x38')]=_[_0x52d3('0x3b')](_0x4ff603[_0x52d3('0x38')],{'$or':_[_0x52d3('0x39')](_0x4ff603[_0x52d3('0x31')],function(_0x4aaf57){var _0x5752c0={};_0x5752c0[_0x4aaf57]={'$like':'%'+_0x27166d['query']['filter']+'%'};return _0x5752c0;})});}_0x4ff603=_[_0x52d3('0x3b')]({},_0x4ff603,_0x27166d['options']);return _0x513bba[_0x52d3('0x54')](_0x4ff603);}})[_0x52d3('0x22')](function(_0x206419){if(_0x206419){_0x17ae01=_0x206419['length'];if(!_0x27166d['query'][_0x52d3('0x56')](_0x52d3('0x57'))){_0x4ff603[_0x52d3('0x1b')]=qs[_0x52d3('0x1b')](_0x27166d['query'][_0x52d3('0x1b')]);_0x4ff603[_0x52d3('0x19')]=qs['offset'](_0x27166d[_0x52d3('0x2e')][_0x52d3('0x19')]);}return _0x513bba['getContacts'](_0x4ff603);}})[_0x52d3('0x22')](function(_0x2f905c){if(_0x2f905c){return _0x2f905c?{'count':_0x17ae01,'rows':_0x2f905c}:null;}})[_0x52d3('0x22')](respondWithResult(_0x3efc82,null))[_0x52d3('0x40')](handleError(_0x3efc82,null));}; \ No newline at end of file +var _0xdbb9=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','Companies','UserProfileResource','destroy','error','name','send','index','CmCompany','keys','query','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','rows','catch','show','params','rawAttributes','length','includeAll','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','describe','addContacts','CmContact','omit','getContacts','map','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0xea6018,_0x4cf082){var _0x57b54d=function(_0x49099a){while(--_0x49099a){_0xea6018['push'](_0xea6018['shift']());}};_0x57b54d(++_0x4cf082);}(_0xdbb9,0xe9));var _0x9dbb=function(_0x565b6c,_0x144698){_0x565b6c=_0x565b6c-0x0;var _0x1d5929=_0xdbb9[_0x565b6c];return _0x1d5929;};'use strict';var emlformat=require(_0x9dbb('0x0'));var rimraf=require(_0x9dbb('0x1'));var zipdir=require(_0x9dbb('0x2'));var jsonpatch=require(_0x9dbb('0x3'));var rp=require('request-promise');var moment=require(_0x9dbb('0x4'));var BPromise=require(_0x9dbb('0x5'));var Mustache=require(_0x9dbb('0x6'));var util=require('util');var path=require(_0x9dbb('0x7'));var sox=require(_0x9dbb('0x8'));var csv=require(_0x9dbb('0x9'));var ejs=require(_0x9dbb('0xa'));var fs=require('fs');var fs_extra=require(_0x9dbb('0xb'));var _=require('lodash');var squel=require(_0x9dbb('0xc'));var crypto=require(_0x9dbb('0xd'));var jsforce=require(_0x9dbb('0xe'));var deskjs=require(_0x9dbb('0xf'));var toCsv=require(_0x9dbb('0x9'));var querystring=require(_0x9dbb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9dbb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9dbb('0x12'))(_0x9dbb('0x13'));var utils=require(_0x9dbb('0x14'));var config=require(_0x9dbb('0x15'));var licenseUtil=require(_0x9dbb('0x16'));var db=require(_0x9dbb('0x17'))['db'];function respondWithStatusCode(_0x3df7f2,_0x2cd0b6){_0x2cd0b6=_0x2cd0b6||0xcc;return function(_0x2a992f){if(_0x2a992f){return _0x3df7f2[_0x9dbb('0x18')](_0x2cd0b6);}return _0x3df7f2[_0x9dbb('0x19')](_0x2cd0b6)[_0x9dbb('0x1a')]();};}function respondWithResult(_0xc510f2,_0x19d915){_0x19d915=_0x19d915||0xc8;return function(_0x6802fa){if(_0x6802fa){return _0xc510f2[_0x9dbb('0x19')](_0x19d915)[_0x9dbb('0x1b')](_0x6802fa);}};}function respondWithFilteredResult(_0x2efc11,_0x19fd63){return function(_0x362efc){if(_0x362efc){var _0x2d8bf2=typeof _0x19fd63[_0x9dbb('0x1c')]===_0x9dbb('0x1d')&&typeof _0x19fd63['limit']===_0x9dbb('0x1d');var _0x17c0a5=_0x362efc['count'];var _0x2bea5d=_0x2d8bf2?0x0:_0x19fd63[_0x9dbb('0x1c')];var _0x380eac=_0x2d8bf2?_0x362efc[_0x9dbb('0x1e')]:_0x19fd63[_0x9dbb('0x1c')]+_0x19fd63[_0x9dbb('0x1f')];var _0x4d2979;if(_0x380eac>=_0x17c0a5){_0x380eac=_0x17c0a5;_0x4d2979=0xc8;}else{_0x4d2979=0xce;}_0x2efc11[_0x9dbb('0x19')](_0x4d2979);return _0x2efc11[_0x9dbb('0x20')](_0x9dbb('0x21'),_0x2bea5d+'-'+_0x380eac+'/'+_0x17c0a5)[_0x9dbb('0x1b')](_0x362efc);}return null;};}function patchUpdates(_0x13d9d7){return function(_0x16346e){try{jsonpatch['apply'](_0x16346e,_0x13d9d7,!![]);}catch(_0x1cbac1){return BPromise[_0x9dbb('0x22')](_0x1cbac1);}return _0x16346e[_0x9dbb('0x23')]();};}function saveUpdates(_0xa8d57c,_0xe581b1){return function(_0x50fdbe){if(_0x50fdbe){return _0x50fdbe[_0x9dbb('0x24')](_0xa8d57c)['then'](function(_0x2b9312){return _0x2b9312;});}return null;};}function removeEntity(_0x4a27b9,_0x7359e6){return function(_0x397c4e){if(_0x397c4e){return _0x397c4e['destroy']()[_0x9dbb('0x25')](function(){var _0x1f152f=_0x397c4e['get']({'plain':!![]});var _0x394cf6=_0x9dbb('0x26');return db[_0x9dbb('0x27')][_0x9dbb('0x28')]({'where':{'type':_0x394cf6,'resourceId':_0x1f152f['id']}})[_0x9dbb('0x25')](function(){return _0x397c4e;});})[_0x9dbb('0x25')](function(){_0x4a27b9['status'](0xcc)[_0x9dbb('0x1a')]();});}};}function handleEntityNotFound(_0xd0e745,_0x342711){return function(_0x5ee93c){if(!_0x5ee93c){_0xd0e745['sendStatus'](0x194);}return _0x5ee93c;};}function handleError(_0x4fc56f,_0x3ffeab){_0x3ffeab=_0x3ffeab||0x1f4;return function(_0x81f71a){logger[_0x9dbb('0x29')](_0x81f71a['stack']);if(_0x81f71a[_0x9dbb('0x2a')]){delete _0x81f71a[_0x9dbb('0x2a')];}_0x4fc56f[_0x9dbb('0x19')](_0x3ffeab)[_0x9dbb('0x2b')](_0x81f71a);};}exports[_0x9dbb('0x2c')]=function(_0x5931a6,_0x3ab9ca){var _0x2b20d0={},_0x4b81ef={},_0x43f5b9={'count':0x0,'rows':[]};return db[_0x9dbb('0x2d')]['describe']()[_0x9dbb('0x25')](function(_0x3d2639){_0x4b81ef['model']=_[_0x9dbb('0x2e')](_0x3d2639);_0x4b81ef[_0x9dbb('0x2f')]=_[_0x9dbb('0x2e')](_0x5931a6[_0x9dbb('0x2f')]);_0x4b81ef['filters']=_[_0x9dbb('0x30')](_0x4b81ef['model'],_0x4b81ef[_0x9dbb('0x2f')]);_0x2b20d0[_0x9dbb('0x31')]=_[_0x9dbb('0x30')](_0x4b81ef[_0x9dbb('0x32')],qs[_0x9dbb('0x33')](_0x5931a6[_0x9dbb('0x2f')]['fields']));_0x2b20d0[_0x9dbb('0x31')]=_0x2b20d0[_0x9dbb('0x31')]['length']?_0x2b20d0[_0x9dbb('0x31')]:_0x4b81ef[_0x9dbb('0x32')];if(!_0x5931a6[_0x9dbb('0x2f')][_0x9dbb('0x34')](_0x9dbb('0x35'))){_0x2b20d0[_0x9dbb('0x1f')]=qs[_0x9dbb('0x1f')](_0x5931a6[_0x9dbb('0x2f')]['limit']);_0x2b20d0[_0x9dbb('0x1c')]=qs[_0x9dbb('0x1c')](_0x5931a6[_0x9dbb('0x2f')][_0x9dbb('0x1c')]);}_0x2b20d0[_0x9dbb('0x36')]=qs[_0x9dbb('0x37')](_0x5931a6['query'][_0x9dbb('0x37')]);_0x2b20d0[_0x9dbb('0x38')]=qs['filters'](_[_0x9dbb('0x39')](_0x5931a6['query'],_0x4b81ef[_0x9dbb('0x3a')]),_0x3d2639);if(_0x5931a6[_0x9dbb('0x2f')][_0x9dbb('0x3b')]){_0x2b20d0[_0x9dbb('0x38')]=_[_0x9dbb('0x3c')](_0x2b20d0['where'],{'$or':_['map'](_0x2b20d0['attributes'],function(_0x1301d2){var _0x4493b0={};_0x4493b0[_0x1301d2]={'$like':'%'+_0x5931a6[_0x9dbb('0x2f')][_0x9dbb('0x3b')]+'%'};return _0x4493b0;})});}_0x2b20d0=_['merge']({},_0x2b20d0,_0x5931a6[_0x9dbb('0x3d')]);var _0x5821b4={'where':_0x2b20d0[_0x9dbb('0x38')]};return db[_0x9dbb('0x2d')][_0x9dbb('0x1e')](_0x5821b4)[_0x9dbb('0x25')](function(_0xbf4172){_0x43f5b9[_0x9dbb('0x1e')]=_0xbf4172;if(_0x5931a6[_0x9dbb('0x2f')]['includeAll']){_0x2b20d0['include']=[{'all':!![]}];}return db[_0x9dbb('0x2d')]['findAll'](_0x2b20d0);})[_0x9dbb('0x25')](function(_0x3a5365){_0x43f5b9[_0x9dbb('0x3e')]=_0x3a5365;return _0x43f5b9;})[_0x9dbb('0x25')](respondWithFilteredResult(_0x3ab9ca,_0x2b20d0))[_0x9dbb('0x3f')](handleError(_0x3ab9ca,null));})['catch'](handleError(_0x3ab9ca,null));};exports[_0x9dbb('0x40')]=function(_0x2333b3,_0x456385){var _0x59de9a={'raw':![],'where':{'id':_0x2333b3[_0x9dbb('0x41')]['id']}},_0x346dd6={};_0x346dd6[_0x9dbb('0x32')]=_['keys'](db['CmCompany'][_0x9dbb('0x42')]);_0x346dd6[_0x9dbb('0x2f')]=_['keys'](_0x2333b3[_0x9dbb('0x2f')]);_0x346dd6[_0x9dbb('0x3a')]=_[_0x9dbb('0x30')](_0x346dd6[_0x9dbb('0x32')],_0x346dd6[_0x9dbb('0x2f')]);_0x59de9a[_0x9dbb('0x31')]=_[_0x9dbb('0x30')](_0x346dd6['model'],qs['fields'](_0x2333b3['query']['fields']));_0x59de9a[_0x9dbb('0x31')]=_0x59de9a['attributes'][_0x9dbb('0x43')]?_0x59de9a['attributes']:_0x346dd6[_0x9dbb('0x32')];if(_0x2333b3[_0x9dbb('0x2f')][_0x9dbb('0x44')]){_0x59de9a[_0x9dbb('0x45')]=[{'all':!![]}];}_0x59de9a=_['merge']({},_0x59de9a,_0x2333b3[_0x9dbb('0x3d')]);return db['CmCompany']['find'](_0x59de9a)[_0x9dbb('0x25')](handleEntityNotFound(_0x456385,null))[_0x9dbb('0x25')](respondWithResult(_0x456385,null))['catch'](handleError(_0x456385,null));};exports['create']=function(_0x45c59e,_0x5a792d){return db[_0x9dbb('0x2d')][_0x9dbb('0x46')](_0x45c59e[_0x9dbb('0x47')],{})['then'](function(_0x579470){var _0x46c572=_0x45c59e[_0x9dbb('0x48')][_0x9dbb('0x49')]({'plain':!![]});if(!_0x46c572)throw new Error(_0x9dbb('0x4a'));if(_0x46c572['role']===_0x9dbb('0x48')){var _0x3d5579=_0x579470[_0x9dbb('0x49')]({'plain':!![]});var _0x4377de=_0x9dbb('0x26');return db[_0x9dbb('0x4b')][_0x9dbb('0x4c')]({'where':{'name':_0x4377de,'userProfileId':_0x46c572[_0x9dbb('0x4d')]},'raw':!![]})[_0x9dbb('0x25')](function(_0x1ce89b){if(_0x1ce89b&&_0x1ce89b[_0x9dbb('0x4e')]===0x0){return db[_0x9dbb('0x27')][_0x9dbb('0x46')]({'name':_0x3d5579[_0x9dbb('0x2a')],'resourceId':_0x3d5579['id'],'type':_0x1ce89b[_0x9dbb('0x2a')],'sectionId':_0x1ce89b['id']},{})['then'](function(){return _0x579470;});}else{return _0x579470;}})[_0x9dbb('0x3f')](function(_0x551e53){logger[_0x9dbb('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x551e53);throw _0x551e53;});}return _0x579470;})[_0x9dbb('0x25')](respondWithResult(_0x5a792d,0xc9))['catch'](handleError(_0x5a792d,null));};exports[_0x9dbb('0x24')]=function(_0x37f3dd,_0x4bfd17){if(_0x37f3dd[_0x9dbb('0x47')]['id']){delete _0x37f3dd['body']['id'];}return db['CmCompany'][_0x9dbb('0x4c')]({'where':{'id':_0x37f3dd['params']['id']}})['then'](handleEntityNotFound(_0x4bfd17,null))['then'](saveUpdates(_0x37f3dd[_0x9dbb('0x47')],null))[_0x9dbb('0x25')](respondWithResult(_0x4bfd17,null))['catch'](handleError(_0x4bfd17,null));};exports[_0x9dbb('0x28')]=function(_0x2d1f1a,_0x3c22b1){return db[_0x9dbb('0x2d')][_0x9dbb('0x4c')]({'where':{'id':_0x2d1f1a[_0x9dbb('0x41')]['id']}})['then'](handleEntityNotFound(_0x3c22b1,null))[_0x9dbb('0x25')](removeEntity(_0x3c22b1,null))[_0x9dbb('0x3f')](handleError(_0x3c22b1,null));};exports['describe']=function(_0x26d74e,_0x178ea2){return db[_0x9dbb('0x2d')][_0x9dbb('0x4f')]()[_0x9dbb('0x25')](respondWithResult(_0x178ea2,null))[_0x9dbb('0x3f')](handleError(_0x178ea2,null));};exports[_0x9dbb('0x50')]=function(_0x876d9a,_0x519c65,_0x219d61){return db[_0x9dbb('0x51')][_0x9dbb('0x4c')]({'where':{'id':_0x876d9a[_0x9dbb('0x41')]['id']}})[_0x9dbb('0x25')](handleEntityNotFound(_0x519c65,null))[_0x9dbb('0x25')](function(_0x37a3f6){if(_0x37a3f6){return _0x37a3f6[_0x9dbb('0x50')](_0x876d9a['body']['ids'],_[_0x9dbb('0x52')](_0x876d9a[_0x9dbb('0x47')],['ids','id'])||{});}})[_0x9dbb('0x25')](respondWithResult(_0x519c65,null))['catch'](handleError(_0x519c65,null));};exports[_0x9dbb('0x53')]=function(_0x1e5b38,_0x5e5d4d,_0x5e9236){var _0x407389={};var _0x1b5a6b={};var _0x907b1e;var _0x22ff23;return db[_0x9dbb('0x2d')]['findOne']({'where':{'id':_0x1e5b38['params']['id']}})[_0x9dbb('0x25')](handleEntityNotFound(_0x5e5d4d,null))['then'](function(_0x2ad6fc){if(_0x2ad6fc){_0x907b1e=_0x2ad6fc;_0x1b5a6b['model']=_[_0x9dbb('0x2e')](db[_0x9dbb('0x51')][_0x9dbb('0x42')]);_0x1b5a6b[_0x9dbb('0x2f')]=_[_0x9dbb('0x2e')](_0x1e5b38[_0x9dbb('0x2f')]);_0x1b5a6b['filters']=_[_0x9dbb('0x30')](_0x1b5a6b[_0x9dbb('0x32')],_0x1b5a6b[_0x9dbb('0x2f')]);_0x407389[_0x9dbb('0x31')]=_[_0x9dbb('0x30')](_0x1b5a6b[_0x9dbb('0x32')],qs[_0x9dbb('0x33')](_0x1e5b38['query']['fields']));_0x407389[_0x9dbb('0x31')]=_0x407389[_0x9dbb('0x31')][_0x9dbb('0x43')]?_0x407389[_0x9dbb('0x31')]:_0x1b5a6b[_0x9dbb('0x32')];_0x407389[_0x9dbb('0x36')]=qs[_0x9dbb('0x37')](_0x1e5b38[_0x9dbb('0x2f')][_0x9dbb('0x37')]);_0x407389['where']=qs[_0x9dbb('0x3a')](_[_0x9dbb('0x39')](_0x1e5b38[_0x9dbb('0x2f')],_0x1b5a6b[_0x9dbb('0x3a')]));if(_0x1e5b38[_0x9dbb('0x2f')][_0x9dbb('0x3b')]){_0x407389[_0x9dbb('0x38')]=_['merge'](_0x407389['where'],{'$or':_[_0x9dbb('0x54')](_0x407389[_0x9dbb('0x31')],function(_0xa45988){var _0x5625a3={};_0x5625a3[_0xa45988]={'$like':'%'+_0x1e5b38['query']['filter']+'%'};return _0x5625a3;})});}_0x407389=_[_0x9dbb('0x3c')]({},_0x407389,_0x1e5b38[_0x9dbb('0x3d')]);return _0x907b1e[_0x9dbb('0x53')](_0x407389);}})[_0x9dbb('0x25')](function(_0x63ea7d){if(_0x63ea7d){_0x22ff23=_0x63ea7d['length'];if(!_0x1e5b38[_0x9dbb('0x2f')][_0x9dbb('0x34')](_0x9dbb('0x35'))){_0x407389[_0x9dbb('0x1f')]=qs[_0x9dbb('0x1f')](_0x1e5b38['query'][_0x9dbb('0x1f')]);_0x407389[_0x9dbb('0x1c')]=qs[_0x9dbb('0x1c')](_0x1e5b38[_0x9dbb('0x2f')][_0x9dbb('0x1c')]);}return _0x907b1e[_0x9dbb('0x53')](_0x407389);}})[_0x9dbb('0x25')](function(_0x248ec8){if(_0x248ec8){return _0x248ec8?{'count':_0x22ff23,'rows':_0x248ec8}:null;}})['then'](respondWithResult(_0x5e5d4d,null))[_0x9dbb('0x3f')](handleError(_0x5e5d4d,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index b043c37..c518ca0 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 _0x1d03=['CmCompany','cm_companies','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define'];(function(_0x453b63,_0x5e30dc){var _0x34500f=function(_0x46db0c){while(--_0x46db0c){_0x453b63['push'](_0x453b63['shift']());}};_0x34500f(++_0x5e30dc);}(_0x1d03,0x1de));var _0x31d0=function(_0x24c67c,_0x5c4593){_0x24c67c=_0x24c67c-0x0;var _0x7de026=_0x1d03[_0x24c67c];return _0x7de026;};'use strict';var _=require(_0x31d0('0x0'));var util=require('util');var logger=require(_0x31d0('0x1'))(_0x31d0('0x2'));var moment=require(_0x31d0('0x3'));var BPromise=require(_0x31d0('0x4'));var rp=require(_0x31d0('0x5'));var fs=require('fs');var path=require(_0x31d0('0x6'));var rimraf=require(_0x31d0('0x7'));var config=require(_0x31d0('0x8'));var attributes=require(_0x31d0('0x9'));module[_0x31d0('0xa')]=function(_0x5068ae,_0x4515d8){return _0x5068ae[_0x31d0('0xb')](_0x31d0('0xc'),attributes,{'tableName':_0x31d0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x04e9=['./cmCompany.attributes','define','CmCompany','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x5ac78c,_0x4e3757){var _0x42ac1a=function(_0x48a64e){while(--_0x48a64e){_0x5ac78c['push'](_0x5ac78c['shift']());}};_0x42ac1a(++_0x4e3757);}(_0x04e9,0x11a));var _0x904e=function(_0x20e68c,_0x5ba0be){_0x20e68c=_0x20e68c-0x0;var _0x1aaed2=_0x04e9[_0x20e68c];return _0x1aaed2;};'use strict';var _=require(_0x904e('0x0'));var util=require(_0x904e('0x1'));var logger=require(_0x904e('0x2'))(_0x904e('0x3'));var moment=require('moment');var BPromise=require(_0x904e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x904e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x904e('0x6'));module['exports']=function(_0x21bd91,_0xbc5fa9){return _0x21bd91[_0x904e('0x7')](_0x904e('0x8'),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 98aca4e..8f91a0b 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 _0x1e78=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','CmCompany,\x20%s,\x20%s','message','result','catch','util','bluebird','ioredis'];(function(_0x1f3aec,_0x24c18e){var _0x409f0d=function(_0x52b818){while(--_0x52b818){_0x1f3aec['push'](_0x1f3aec['shift']());}};_0x409f0d(++_0x24c18e);}(_0x1e78,0xa5));var _0x81e7=function(_0x28658c,_0x438b5d){_0x28658c=_0x28658c-0x0;var _0x34438d=_0x1e78[_0x28658c];return _0x34438d;};'use strict';var _=require('lodash');var util=require(_0x81e7('0x0'));var moment=require('moment');var BPromise=require(_0x81e7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x81e7('0x2'));var db=require(_0x81e7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x81e7('0x4'))(_0x81e7('0x5'));var config=require('../../config/environment');var jayson=require(_0x81e7('0x6'));var client=jayson[_0x81e7('0x7')][_0x81e7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f0a6b,_0x21fcbf,_0x47349d){return new BPromise(function(_0x344a24,_0x407dda){return client[_0x81e7('0x9')](_0x1f0a6b,_0x47349d)[_0x81e7('0xa')](function(_0x23b5ed){logger[_0x81e7('0xb')]('CmCompany,\x20%s,\x20%s',_0x21fcbf,_0x81e7('0xc'));logger[_0x81e7('0xd')](_0x81e7('0xe'),_0x21fcbf,_0x81e7('0xc'),JSON[_0x81e7('0xf')](_0x23b5ed));if(_0x23b5ed[_0x81e7('0x10')]){if(_0x23b5ed['error']['code']===0x1f4){logger[_0x81e7('0x10')](_0x81e7('0x11'),_0x21fcbf,_0x23b5ed[_0x81e7('0x10')][_0x81e7('0x12')]);return _0x407dda(_0x23b5ed[_0x81e7('0x10')][_0x81e7('0x12')]);}logger['error'](_0x81e7('0x11'),_0x21fcbf,_0x23b5ed[_0x81e7('0x10')][_0x81e7('0x12')]);return _0x344a24(_0x23b5ed[_0x81e7('0x10')][_0x81e7('0x12')]);}else{logger['info'](_0x81e7('0x11'),_0x21fcbf,_0x81e7('0xc'));_0x344a24(_0x23b5ed[_0x81e7('0x13')][_0x81e7('0x12')]);}})[_0x81e7('0x14')](function(_0x1d321e){logger[_0x81e7('0x10')](_0x81e7('0x11'),_0x21fcbf,_0x1d321e);_0x407dda(_0x1d321e);});});} \ No newline at end of file +var _0x70be=['request','info','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x70be,0x137));var _0xe70b=function(_0x570dea,_0x17f03a){_0x570dea=_0x570dea-0x0;var _0x4465f3=_0x70be[_0x570dea];return _0x4465f3;};'use strict';var _=require(_0xe70b('0x0'));var util=require(_0xe70b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe70b('0x2'));var fs=require('fs');var Redis=require(_0xe70b('0x3'));var db=require(_0xe70b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe70b('0x5'))(_0xe70b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe70b('0x7')][_0xe70b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x9e73dc,_0x56eaf1,_0x4b5cb6){return new BPromise(function(_0x1d5f94,_0x21a0c0){return client[_0xe70b('0x9')](_0x9e73dc,_0x4b5cb6)['then'](function(_0x5cdd1f){logger[_0xe70b('0xa')](_0xe70b('0xb'),_0x56eaf1,_0xe70b('0xc'));logger['debug'](_0xe70b('0xd'),_0x56eaf1,_0xe70b('0xc'),JSON[_0xe70b('0xe')](_0x5cdd1f));if(_0x5cdd1f[_0xe70b('0xf')]){if(_0x5cdd1f[_0xe70b('0xf')][_0xe70b('0x10')]===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0x56eaf1,_0x5cdd1f[_0xe70b('0xf')][_0xe70b('0x11')]);return _0x21a0c0(_0x5cdd1f['error'][_0xe70b('0x11')]);}logger[_0xe70b('0xf')](_0xe70b('0xb'),_0x56eaf1,_0x5cdd1f['error'][_0xe70b('0x11')]);return _0x1d5f94(_0x5cdd1f[_0xe70b('0xf')][_0xe70b('0x11')]);}else{logger['info'](_0xe70b('0xb'),_0x56eaf1,_0xe70b('0xc'));_0x1d5f94(_0x5cdd1f[_0xe70b('0x12')]['message']);}})[_0xe70b('0x13')](function(_0x1cd377){logger[_0xe70b('0xf')](_0xe70b('0xb'),_0x56eaf1,_0x1cd377);_0x21a0c0(_0x1cd377);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index f22fe46..9c95422 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 _0x2b94=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/contacts','getContacts','post','create','addContacts','put','/:id','update','delete','destroy','exports','path','express','Router'];(function(_0x555b2f,_0x43b622){var _0x81c0a6=function(_0x4629e6){while(--_0x4629e6){_0x555b2f['push'](_0x555b2f['shift']());}};_0x81c0a6(++_0x43b622);}(_0x2b94,0xad));var _0x42b9=function(_0x55c710,_0x38e4c8){_0x55c710=_0x55c710-0x0;var _0x1bd2df=_0x2b94[_0x55c710];return _0x1bd2df;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x42b9('0x0'));var timeout=require('connect-timeout');var express=require(_0x42b9('0x1'));var router=express[_0x42b9('0x2')]();var fs_extra=require(_0x42b9('0x3'));var auth=require(_0x42b9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x42b9('0x5'));var controller=require('./cmCompany.controller');router[_0x42b9('0x6')]('/',auth[_0x42b9('0x7')](),controller[_0x42b9('0x8')]);router[_0x42b9('0x6')]('/describe',auth[_0x42b9('0x7')](),controller[_0x42b9('0x9')]);router['get']('/:id',auth[_0x42b9('0x7')](),controller[_0x42b9('0xa')]);router['get'](_0x42b9('0xb'),auth[_0x42b9('0x7')](),controller[_0x42b9('0xc')]);router[_0x42b9('0xd')]('/',auth[_0x42b9('0x7')](),controller[_0x42b9('0xe')]);router['post'](_0x42b9('0xb'),auth[_0x42b9('0x7')](),controller[_0x42b9('0xf')]);router[_0x42b9('0x10')](_0x42b9('0x11'),auth[_0x42b9('0x7')](),controller[_0x42b9('0x12')]);router[_0x42b9('0x13')](_0x42b9('0x11'),auth[_0x42b9('0x7')](),controller[_0x42b9('0x14')]);module[_0x42b9('0x15')]=router; \ No newline at end of file +var _0x723a=['../../components/auth/service','get','/describe','isAuthenticated','describe','/:id','show','/:id/contacts','getContacts','post','create','addContacts','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x27b10c,_0x3a30a6){var _0x111416=function(_0x1a3001){while(--_0x1a3001){_0x27b10c['push'](_0x27b10c['shift']());}};_0x111416(++_0x3a30a6);}(_0x723a,0x144));var _0xa723=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x723a[_0x36ed48];return _0x51c63a;};'use strict';var multer=require(_0xa723('0x0'));var util=require(_0xa723('0x1'));var path=require('path');var timeout=require(_0xa723('0x2'));var express=require(_0xa723('0x3'));var router=express[_0xa723('0x4')]();var fs_extra=require(_0xa723('0x5'));var auth=require(_0xa723('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0xa723('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa723('0x8'),auth[_0xa723('0x9')](),controller[_0xa723('0xa')]);router[_0xa723('0x7')](_0xa723('0xb'),auth[_0xa723('0x9')](),controller[_0xa723('0xc')]);router[_0xa723('0x7')](_0xa723('0xd'),auth[_0xa723('0x9')](),controller[_0xa723('0xe')]);router[_0xa723('0xf')]('/',auth['isAuthenticated'](),controller[_0xa723('0x10')]);router['post'](_0xa723('0xd'),auth['isAuthenticated'](),controller[_0xa723('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xa723('0x12')]);router[_0xa723('0x13')](_0xa723('0xb'),auth[_0xa723('0x9')](),controller[_0xa723('0x14')]);module[_0xa723('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 95d3a52..fc630a6 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 _0x6155=['lodash','sequelize','exports','STRING','TEXT','INTEGER','DATE'];(function(_0x4f8a29,_0x13a35d){var _0x2fbee9=function(_0xe45f62){while(--_0xe45f62){_0x4f8a29['push'](_0x4f8a29['shift']());}};_0x2fbee9(++_0x13a35d);}(_0x6155,0x142));var _0x5615=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x6155[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0x5615('0x0'));var Sequelize=require(_0x5615('0x1'));module[_0x5615('0x2')]={'firstName':{'type':Sequelize[_0x5615('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x5615('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x5615('0x3')]},'city':{'type':Sequelize[_0x5615('0x3')]},'country':{'type':Sequelize[_0x5615('0x3')]},'dateOfBirth':{'type':Sequelize[_0x5615('0x3')]},'description':{'type':Sequelize[_0x5615('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x5615('0x3')]},'fax':{'type':Sequelize[_0x5615('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x5615('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x5615('0x3')]},'skype':{'type':Sequelize[_0x5615('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x5615('0x3')]},'line':{'type':Sequelize[_0x5615('0x3')]},'wechat':{'type':Sequelize[_0x5615('0x3')]},'telegram':{'type':Sequelize[_0x5615('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0x5615('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x5615('0x6')],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x16d7=['sequelize','STRING','INTEGER','UNSIGNED','DATE','NOW'];(function(_0x2e76a7,_0x23871a){var _0x454cde=function(_0x51724d){while(--_0x51724d){_0x2e76a7['push'](_0x2e76a7['shift']());}};_0x454cde(++_0x23871a);}(_0x16d7,0x1b6));var _0x716d=function(_0x2e35c6,_0x3c5004){_0x2e35c6=_0x2e35c6-0x0;var _0x4a1d2c=_0x16d7[_0x2e35c6];return _0x4a1d2c;};'use strict';var _=require('lodash');var Sequelize=require(_0x716d('0x0'));module['exports']={'firstName':{'type':Sequelize[_0x716d('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0x716d('0x1')]},'street':{'type':Sequelize[_0x716d('0x1')]},'postalCode':{'type':Sequelize[_0x716d('0x1')]},'city':{'type':Sequelize[_0x716d('0x1')]},'country':{'type':Sequelize[_0x716d('0x1')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x716d('0x1')]},'mobile':{'type':Sequelize[_0x716d('0x1')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x716d('0x1')]},'url':{'type':Sequelize[_0x716d('0x1')]},'facebook':{'type':Sequelize[_0x716d('0x1')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x716d('0x1')]},'skype':{'type':Sequelize[_0x716d('0x1')]},'teams':{'type':Sequelize[_0x716d('0x1')]},'viber':{'type':Sequelize[_0x716d('0x1')]},'line':{'type':Sequelize[_0x716d('0x1')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x716d('0x1')]},'UserId':{'type':Sequelize[_0x716d('0x2')]},'priority':{'type':Sequelize[_0x716d('0x2')](0x2)[_0x716d('0x3')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x716d('0x4')],'defaultValue':Sequelize[_0x716d('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index ba8d9aa..b61bf51 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 _0x614a=['info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','FaxQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','each','duplicates','$or','findOrCreate','spread','show','omit','format','cf_%d','$and','pickBy','setFields','id\x20=\x20?','toParam','values','phone','getTags','rawAttributes','merge','options','nolimit','setTags','ids','getHoppers','include','getHopperHistories','ContactId','includeAll','rows','getHopperFinals','getJscriptySessions','No\x20ListId\x20specified','binding_keys','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','chmodSync','0777','fork','../../components/import/cm/csv','binding_values','File\x20uploaded\x20correctly!','pid','upload','createReadStream','binding','child_process','stringify','start\x20child\x20process\x20correctly!','exit','getJourney','mail','chat','openchannel','whatsapp','voice','-createdAt','channel','toLowerCase','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','destination','callerid','starttime','endtime','note','createdAt','userThirdDisposition','fullname','range','startCase','Website','Account','closed','secondDisposition','thirdDisposition','UserId','key','browserName','customerIp','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','subject','threadId','Interaction','findAndCountAll','Owner','all','flatten','reverse','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','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','redis','defaults','localhost','./cmContact.socket','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','CmContact','describe','keys','length','findOne','trimStart','cf_','fieldType','type','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','select','field','color','from','tools_tags','cm_contacts','left_join','cm_user_has_contacts','cm_contact_has_tags','t.id\x20=\x20ct.TagId','expr','search','parseSearch','sqlOperator','conditions','find','Tag','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','value','dateOfBirth','datetime','DATE','start','end','filter','isNil','Contact','push','isEmpty','ListId','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','replace','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','clone','DESC','having','t.id\x20IN\x20?','resolve','user','some','getLists','c.ListId\x20IS\x20NULL','role','agent','sequelize','toString','c.lastName','c.phone','c.mobile','c.fax','c.email','c.ListId','c.createdAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','catch','params','tags','startsWith','columnName','CmCustomField','findAll','displayName','alias','body','get','join','CmHopper'];(function(_0x312f59,_0x4b30d5){var _0x3f070f=function(_0x6acbdb){while(--_0x6acbdb){_0x312f59['push'](_0x312f59['shift']());}};_0x3f070f(++_0x4b30d5);}(_0x614a,0x1a2));var _0xa614=function(_0x446d64,_0x1357d3){_0x446d64=_0x446d64-0x0;var _0x34201b=_0x614a[_0x446d64];return _0x34201b;};'use strict';var emlformat=require(_0xa614('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa614('0x1'));var jsonpatch=require(_0xa614('0x2'));var rp=require('request-promise');var moment=require(_0xa614('0x3'));var BPromise=require(_0xa614('0x4'));var Mustache=require(_0xa614('0x5'));var util=require(_0xa614('0x6'));var path=require(_0xa614('0x7'));var sox=require('sox');var csv=require(_0xa614('0x8'));var ejs=require(_0xa614('0x9'));var fs=require('fs');var fs_extra=require(_0xa614('0xa'));var _=require(_0xa614('0xb'));var squel=require('squel');var crypto=require(_0xa614('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa614('0xd'));var toCsv=require(_0xa614('0x8'));var querystring=require('querystring');var Papa=require(_0xa614('0xe'));var Redis=require(_0xa614('0xf'));var authService=require(_0xa614('0x10'));var qs=require(_0xa614('0x11'));var as=require(_0xa614('0x12'));var hardwareService=require(_0xa614('0x13'));var logger=require(_0xa614('0x14'))(_0xa614('0x15'));var utils=require(_0xa614('0x16'));var config=require(_0xa614('0x17'));var licenseUtil=require(_0xa614('0x18'));var db=require(_0xa614('0x19'))['db'];config[_0xa614('0x1a')]=_[_0xa614('0x1b')](config['redis'],{'host':_0xa614('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa614('0x1a')]));require(_0xa614('0x1d'))['register'](socket);function respondWithStatusCode(_0x1e5194,_0x313c1e){_0x313c1e=_0x313c1e||0xcc;return function(_0xe55bf1){if(_0xe55bf1){return _0x1e5194[_0xa614('0x1e')](_0x313c1e);}return _0x1e5194['status'](_0x313c1e)['end']();};}function respondWithResult(_0x428414,_0x4508ab){_0x4508ab=_0x4508ab||0xc8;return function(_0x280963){if(_0x280963){return _0x428414['status'](_0x4508ab)[_0xa614('0x1f')](_0x280963);}};}function respondWithFilteredResult(_0x23ceca,_0x1afe8b){return function(_0x1bd05e){if(_0x1bd05e){var _0x4559d2=typeof _0x1afe8b[_0xa614('0x20')]===_0xa614('0x21')&&typeof _0x1afe8b[_0xa614('0x22')]===_0xa614('0x21');var _0x7abe5e=_0x1bd05e[_0xa614('0x23')];var _0x3fb8e3=_0x4559d2?0x0:_0x1afe8b['offset'];var _0x38bb6b=_0x4559d2?_0x1bd05e['count']:_0x1afe8b[_0xa614('0x20')]+_0x1afe8b[_0xa614('0x22')];var _0x399c5e;if(_0x38bb6b>=_0x7abe5e){_0x38bb6b=_0x7abe5e;_0x399c5e=0xc8;}else{_0x399c5e=0xce;}_0x23ceca[_0xa614('0x24')](_0x399c5e);return _0x23ceca[_0xa614('0x25')](_0xa614('0x26'),_0x3fb8e3+'-'+_0x38bb6b+'/'+_0x7abe5e)['json'](_0x1bd05e);}return null;};}function patchUpdates(_0x250658){return function(_0x3b70dc){try{jsonpatch[_0xa614('0x27')](_0x3b70dc,_0x250658,!![]);}catch(_0x365450){return BPromise[_0xa614('0x28')](_0x365450);}return _0x3b70dc[_0xa614('0x29')]();};}function saveUpdates(_0x25ada6,_0x5bc01f){return function(_0x1818b1){if(_0x1818b1){return _0x1818b1['update'](_0x25ada6)['then'](function(_0x3420a8){return _0x3420a8;});}return null;};}function removeEntity(_0x29b08e,_0x4ada33){return function(_0x25ccdd){if(_0x25ccdd){return _0x25ccdd[_0xa614('0x2a')]()[_0xa614('0x2b')](function(){_0x29b08e[_0xa614('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42c459,_0x3e3d1c){return function(_0x56eb42){if(!_0x56eb42){_0x42c459[_0xa614('0x1e')](0x194);}return _0x56eb42;};}function handleError(_0xe69f8d,_0x1fc8ec){_0x1fc8ec=_0x1fc8ec||0x1f4;return function(_0x3ea20b){logger[_0xa614('0x2c')](_0x3ea20b[_0xa614('0x2d')]);if(_0x3ea20b[_0xa614('0x2e')]){delete _0x3ea20b['name'];}_0xe69f8d['status'](_0x1fc8ec)[_0xa614('0x2f')](_0x3ea20b);};}exports[_0xa614('0x30')]=function(_0x14dfec,_0x4e7e9a){var _0x2e9855={},_0x5cf8a5={},_0x38d186={'count':0x0,'rows':[]};return db[_0xa614('0x31')][_0xa614('0x32')]()[_0xa614('0x2b')](function(_0x4b90af){var _0x3d79c7=[];for(var _0x32af30=0x0;_0x32af300x1){_0x1718cd['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xa614('0x6f')](_0x277c57),null);}else{if(qs[_0xa614('0x70')](_0x277c57)){_0x1718cd['or'](_0xa614('0x71'),_0x277c57+'%');_0x1718cd['or'](_0xa614('0x72'),_0x277c57+'%');_0x1718cd['or'](_0xa614('0x73'),_0x277c57+'%');_0x1718cd['or'](_0xa614('0x74'),_0x277c57+'%');}else if(qs['isEmail'](_0x277c57)){_0x1718cd['or'](_0xa614('0x75'),_0x277c57+'%');}else{_0x1718cd['or'](_0xa614('0x76'),'%'+_0x277c57+'%');_0x1718cd['or']('c.lastName\x20LIKE\x20?','%'+_0x277c57+'%');_0x1718cd['or'](_0xa614('0x75'),'%'+_0x277c57+'%');}}}}_0x1a44f9['where'](_0x1718cd);_0x1a44f9[_0xa614('0x77')](_0xa614('0x78'));var _0x305e27={'type':db[_0xa614('0x79')][_0xa614('0x7a')]['SELECT'],'raw':!![]};var _0x4bc38b=_0x1a44f9[_0xa614('0x7b')]()[_0xa614('0x46')](_0xa614('0x78'));if(_0x2e9855[_0xa614('0x41')]){_0x2e9855[_0xa614('0x41')][_0xa614('0x58')](function(_0x206c0d){_0x1a44f9[_0xa614('0x41')]('c.'+_0x206c0d[0x0],_0x206c0d[0x1]===_0xa614('0x7c')?![]:!![]);});}if(!_[_0xa614('0x67')](_0x20da67)){_0x1a44f9[_0xa614('0x7d')](_0xbc6b2b);_0x4bc38b[_0xa614('0x43')](_0xa614('0x7e'),_0x20da67);}BPromise[_0xa614('0x7f')]()['then'](function(){if(!_0x525a15)return;if(_0x14dfec[_0xa614('0x80')]['role']!=='agent')return;if(!_[_0xa614('0x81')](_0x525a15[_0xa614('0x53')],[_0xa614('0x46'),_0xa614('0x5b')])){return _0x14dfec[_0xa614('0x80')][_0xa614('0x82')]({'attributes':['id'],'raw':!![]})[_0xa614('0x2b')](function(_0x5b25c0){if(_[_0xa614('0x67')](_0x5b25c0)){_0x4bc38b[_0xa614('0x43')](_0xa614('0x83'));_0x1a44f9[_0xa614('0x43')]('c.ListId\x20IS\x20NULL');}else{_0x4bc38b['where'](_0xa614('0x69'),_[_0xa614('0x57')](_0x5b25c0,'id'));_0x1a44f9['where']('c.ListId\x20IN\x20?',_[_0xa614('0x57')](_0x5b25c0,'id'));}});}})[_0xa614('0x2b')](function(){if(_0x14dfec[_0xa614('0x80')][_0xa614('0x84')]===_0xa614('0x85')&&!_0x525a15&&!_0x14dfec[_0xa614('0x3a')][_0xa614('0x68')])return[];return db[_0xa614('0x86')][_0xa614('0x3a')](_0x4bc38b[_0xa614('0x87')](),_0x305e27);})['then'](function(_0x385ab8){_0x38d186[_0xa614('0x23')]=_0x385ab8['length'];if(_0x38d186[_0xa614('0x23')]===0x0)return[];return db['sequelize'][_0xa614('0x3a')](_0x42e5ac[_0xa614('0x87')](),_0x305e27)['then'](function(_0x4cad77){_0x399a67=_['keyBy'](_0x4cad77,'id');_0x305e27=_['merge'](_0x305e27,{'model':db[_0xa614('0x31')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x14dfec['query'][_0xa614('0x3f')]){_0x2e9855[_0xa614('0x3e')][_0xa614('0x58')](function(_0x395cf0){_0x1a44f9[_0xa614('0x46')]('c.'+_0x395cf0);});}else{_0x1a44f9[_0xa614('0x46')](_0xa614('0x78'));_0x1a44f9['field']('c.firstName');_0x1a44f9[_0xa614('0x46')](_0xa614('0x88'));_0x1a44f9[_0xa614('0x46')](_0xa614('0x89'));_0x1a44f9[_0xa614('0x46')](_0xa614('0x8a'));_0x1a44f9[_0xa614('0x46')](_0xa614('0x8b'));_0x1a44f9[_0xa614('0x46')](_0xa614('0x8c'));_0x1a44f9[_0xa614('0x46')](_0xa614('0x8d'));_0x1a44f9[_0xa614('0x46')](_0xa614('0x8e'));_0x1a44f9[_0xa614('0x46')]('c.deletedAt');_0x1a44f9[_0xa614('0x46')](_0xa614('0x8f'));_0x1a44f9['field'](_0xa614('0x90'),_0xa614('0x91'));}if(_0x2e9855[_0xa614('0x22')])_0x1a44f9['limit'](_0x2e9855['limit']);if(_0x2e9855[_0xa614('0x20')])_0x1a44f9[_0xa614('0x20')](_0x2e9855[_0xa614('0x20')]);return db['sequelize'][_0xa614('0x3a')](_0x1a44f9[_0xa614('0x87')](),_0x305e27);});})[_0xa614('0x2b')](function(_0xdd675e){_0xdd675e[_0xa614('0x58')](function(_0x4f10f7){if(_0x4f10f7[_0xa614('0x91')]){_0x4f10f7[_0xa614('0x92')]=[];_0x4f10f7[_0xa614('0x91')]['split'](',')[_0xa614('0x58')](function(_0x1042c3){_0x4f10f7[_0xa614('0x92')]['push'](_0x399a67[_0x1042c3]);});}delete _0x4f10f7[_0xa614('0x91')];});_0x38d186['rows']=_0xdd675e;return _0x38d186;})[_0xa614('0x2b')](respondWithFilteredResult(_0x4e7e9a,_0x2e9855));})[_0xa614('0x93')](handleError(_0x4e7e9a,null));};exports[_0xa614('0x2a')]=function(_0x3a446f,_0x3a3625){return db[_0xa614('0x31')]['find']({'where':{'id':_0x3a446f[_0xa614('0x94')]['id']}})[_0xa614('0x2b')](handleEntityNotFound(_0x3a3625,null))['then'](removeEntity(_0x3a3625,null))['catch'](handleError(_0x3a3625,null));};exports[_0xa614('0x32')]=function(_0x8319e4,_0x49a037){return db['CmContact']['describe']()[_0xa614('0x2b')](function(_0x45a90c){delete _0x45a90c[_0xa614('0x95')];for(var _0x4abadc=0x0;_0x4abadc=_0x286fdc){_0x2f75cc=_0x286fdc;_0x157f31=0xc8;}else{_0x157f31=0xce;}_0x294b80[_0x75f9('0x1a')](_0x157f31);return _0x294b80['set'](_0x75f9('0x1e'),_0x535fa8+'-'+_0x2f75cc+'/'+_0x286fdc)[_0x75f9('0x1f')](_0x42d7af);}return null;};}function patchUpdates(_0x658a7a){return function(_0x350a17){try{jsonpatch[_0x75f9('0x20')](_0x350a17,_0x658a7a,!![]);}catch(_0x2f2651){return BPromise[_0x75f9('0x21')](_0x2f2651);}return _0x350a17['save']();};}function saveUpdates(_0x1f4ae6,_0x2667ab){return function(_0x514838){if(_0x514838){return _0x514838[_0x75f9('0x22')](_0x1f4ae6)[_0x75f9('0x23')](function(_0x475698){return _0x475698;});}return null;};}function removeEntity(_0x365d95,_0xb228c2){return function(_0x452a2d){if(_0x452a2d){return _0x452a2d['destroy']()[_0x75f9('0x23')](function(){_0x365d95[_0x75f9('0x1a')](0xcc)[_0x75f9('0x24')]();});}};}function handleEntityNotFound(_0x4b665a,_0x507dbb){return function(_0x3842b4){if(!_0x3842b4){_0x4b665a[_0x75f9('0x19')](0x194);}return _0x3842b4;};}function handleError(_0xf49eb8,_0x5f140e){_0x5f140e=_0x5f140e||0x1f4;return function(_0x20e2d5){logger['error'](_0x20e2d5['stack']);if(_0x20e2d5[_0x75f9('0x25')]){delete _0x20e2d5['name'];}_0xf49eb8['status'](_0x5f140e)[_0x75f9('0x26')](_0x20e2d5);};}exports['index']=function(_0xdf030d,_0x3953dd){var _0x241988={},_0x12a2b8={},_0x3d9005={'count':0x0,'rows':[]};return db[_0x75f9('0x27')][_0x75f9('0x28')]()['then'](function(_0x1c1f1e){var _0x364b24=[];for(var _0x21414f=0x0;_0x21414f0x1){_0x3f6aa9['or'](_0x75f9('0x64'),qs[_0x75f9('0x65')](_0xb3ca72),null);}else{if(qs[_0x75f9('0x66')](_0xb3ca72)){_0x3f6aa9['or'](_0x75f9('0x67'),_0xb3ca72+'%');_0x3f6aa9['or']('c.phone\x20LIKE\x20?',_0xb3ca72+'%');_0x3f6aa9['or'](_0x75f9('0x68'),_0xb3ca72+'%');_0x3f6aa9['or'](_0x75f9('0x69'),_0xb3ca72+'%');}else if(qs[_0x75f9('0x6a')](_0xb3ca72)){_0x3f6aa9['or']('c.email\x20LIKE\x20?',_0xb3ca72+'%');}else{_0x3f6aa9['or'](_0x75f9('0x6b'),'%'+_0xb3ca72+'%');_0x3f6aa9['or'](_0x75f9('0x6c'),'%'+_0xb3ca72+'%');_0x3f6aa9['or']('c.email\x20LIKE\x20?','%'+_0xb3ca72+'%');}}}}_0x4f4e93[_0x75f9('0x46')](_0x3f6aa9);_0x4f4e93[_0x75f9('0x6d')](_0x75f9('0x6e'));var _0x228a19={'type':db[_0x75f9('0x6f')][_0x75f9('0x70')][_0x75f9('0x71')],'raw':!![]};var _0x1ae4d1=_0x4f4e93[_0x75f9('0x72')]()[_0x75f9('0x3d')]('c.id');if(_0x241988[_0x75f9('0x3a')]){_0x241988[_0x75f9('0x3a')]['forEach'](function(_0x43981d){_0x4f4e93[_0x75f9('0x3a')]('c.'+_0x43981d[0x0],_0x43981d[0x1]==='DESC'?![]:!![]);});}if(!_[_0x75f9('0x73')](_0xe1f8af)){_0x4f4e93[_0x75f9('0x74')](_0x1e1297);_0x1ae4d1[_0x75f9('0x46')]('t.id\x20IN\x20?',_0xe1f8af);}BPromise['resolve']()['then'](function(){if(!_0x50421e)return;if(_0xdf030d['user']['role']!==_0x75f9('0x75'))return;if(!_[_0x75f9('0x76')](_0x50421e[_0x75f9('0x4a')],[_0x75f9('0x3d'),_0x75f9('0x50')])){return _0xdf030d['user'][_0x75f9('0x77')]({'attributes':['id'],'raw':!![]})[_0x75f9('0x23')](function(_0x457bf3){if(_[_0x75f9('0x73')](_0x457bf3)){_0x1ae4d1[_0x75f9('0x46')](_0x75f9('0x78'));_0x4f4e93[_0x75f9('0x46')](_0x75f9('0x78'));}else{_0x1ae4d1['where'](_0x75f9('0x5f'),_[_0x75f9('0x4e')](_0x457bf3,'id'));_0x4f4e93[_0x75f9('0x46')](_0x75f9('0x5f'),_[_0x75f9('0x4e')](_0x457bf3,'id'));}});}})[_0x75f9('0x23')](function(){if(_0xdf030d[_0x75f9('0x79')]['role']==='agent'&&!_0x50421e&&!_0xdf030d[_0x75f9('0x33')][_0x75f9('0x5e')])return[];return db[_0x75f9('0x7a')][_0x75f9('0x33')](_0x1ae4d1['toString'](),_0x228a19);})[_0x75f9('0x23')](function(_0x3063db){_0x3d9005['count']=_0x3063db[_0x75f9('0x29')];if(_0x3d9005['count']===0x0)return[];return db['sequelize'][_0x75f9('0x33')](_0x68a2ad[_0x75f9('0x7b')](),_0x228a19)['then'](function(_0x1f2c10){_0x13a313=_[_0x75f9('0x7c')](_0x1f2c10,'id');_0x228a19=_[_0x75f9('0x7d')](_0x228a19,{'model':db[_0x75f9('0x27')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xdf030d[_0x75f9('0x33')][_0x75f9('0x37')]){_0x241988['attributes'][_0x75f9('0x5d')](function(_0x541756){_0x4f4e93[_0x75f9('0x3d')]('c.'+_0x541756);});}else{_0x4f4e93['field']('c.id');_0x4f4e93[_0x75f9('0x3d')](_0x75f9('0x7e'));_0x4f4e93[_0x75f9('0x3d')]('c.lastName');_0x4f4e93[_0x75f9('0x3d')](_0x75f9('0x7f'));_0x4f4e93[_0x75f9('0x3d')](_0x75f9('0x80'));_0x4f4e93['field'](_0x75f9('0x81'));_0x4f4e93[_0x75f9('0x3d')]('c.email');_0x4f4e93[_0x75f9('0x3d')](_0x75f9('0x82'));_0x4f4e93['field'](_0x75f9('0x83'));_0x4f4e93['field'](_0x75f9('0x84'));_0x4f4e93['field'](_0x75f9('0x85'));_0x4f4e93['field'](_0x75f9('0x86'),_0x75f9('0x87'));}if(_0x241988[_0x75f9('0x39')])_0x4f4e93[_0x75f9('0x39')](_0x241988['limit']);if(_0x241988['offset'])_0x4f4e93[_0x75f9('0x1b')](_0x241988[_0x75f9('0x1b')]);return db[_0x75f9('0x7a')][_0x75f9('0x33')](_0x4f4e93[_0x75f9('0x7b')](),_0x228a19);});})[_0x75f9('0x23')](function(_0x65df55){_0x65df55['forEach'](function(_0xb438cf){if(_0xb438cf[_0x75f9('0x87')]){_0xb438cf['Tags']=[];_0xb438cf[_0x75f9('0x87')][_0x75f9('0x88')](',')[_0x75f9('0x5d')](function(_0x5289b4){_0xb438cf['Tags'][_0x75f9('0x5c')](_0x13a313[_0x5289b4]);});}delete _0xb438cf[_0x75f9('0x87')];});_0x3d9005[_0x75f9('0x89')]=_0x65df55;return _0x3d9005;})['then'](respondWithFilteredResult(_0x3953dd,_0x241988));})['catch'](handleError(_0x3953dd,null));};exports[_0x75f9('0x8a')]=function(_0x341da4,_0x227f8d){return db[_0x75f9('0x27')][_0x75f9('0x4b')]({'where':{'id':_0x341da4['params']['id']}})[_0x75f9('0x23')](handleEntityNotFound(_0x227f8d,null))[_0x75f9('0x23')](removeEntity(_0x227f8d,null))[_0x75f9('0x8b')](handleError(_0x227f8d,null));};exports[_0x75f9('0x28')]=function(_0x5672f4,_0x45d940){return db[_0x75f9('0x27')]['describe']()[_0x75f9('0x23')](function(_0x2a503c){delete _0x2a503c[_0x75f9('0x8c')];for(var _0xb013a5=0x0;_0xb013a5{}\s\\|]/g,'-');_0x4aad2d(null,util['format'](_0xe24f('0x23'),path[_0xe24f('0x24')](_0x496904['originalname'],path[_0xe24f('0x25')](_0x496904[_0xe24f('0x21')])),Date[_0xe24f('0x26')](),path[_0xe24f('0x25')](_0x496904[_0xe24f('0x21')])));}})});router[_0xe24f('0x1a')](_0xe24f('0x27'),upload[_0xe24f('0x28')](_0xe24f('0x29')),controller['uploadCsv']);var upload=multer({'storage':multer[_0xe24f('0x2a')]({'destination':function(_0x10133c,_0x5de3bc,_0x13a551){_0x13a551(null,path[_0xe24f('0x1f')](config[_0xe24f('0x2b')],_0xe24f('0x20')));},'filename':function(_0x385ea3,_0x358855,_0x2e2908){_0x358855['originalname']=_0x358855['originalname'][_0xe24f('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2e2908(null,util[_0xe24f('0x2c')](_0xe24f('0x23'),path[_0xe24f('0x24')](_0x358855[_0xe24f('0x21')],path[_0xe24f('0x25')](_0x358855[_0xe24f('0x21')])),Date[_0xe24f('0x26')](),path['extname'](_0x358855[_0xe24f('0x21')])));}})});router[_0xe24f('0x1a')](_0xe24f('0x2d'),upload['single']('file'),controller[_0xe24f('0x2e')]);router[_0xe24f('0x1a')](_0xe24f('0x2f'),auth[_0xe24f('0xa')](),controller['import']);router[_0xe24f('0x30')]('/:id',auth['isAuthenticated'](),controller[_0xe24f('0x31')]);router[_0xe24f('0x32')](_0xe24f('0xd'),auth[_0xe24f('0xa')](),controller[_0xe24f('0x33')]);module[_0xe24f('0x34')]=router; \ No newline at end of file +var _0x3545=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','describe','/:id','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','post','/merge','merge','create','/create_many','bulkCreate','setTags','diskStorage','join','root','server/files/tmp','originalname','replace','%s-%s%s','extname','file','uploadCsv','format','basename','now','/upload','/upload/:id','import','put','update','delete','destroy','exports','multer','util'];(function(_0xef4cf0,_0x16c9c3){var _0x497ad2=function(_0xce63d4){while(--_0xce63d4){_0xef4cf0['push'](_0xef4cf0['shift']());}};_0x497ad2(++_0x16c9c3);}(_0x3545,0x196));var _0x5354=function(_0x1d32ac,_0x16f800){_0x1d32ac=_0x1d32ac-0x0;var _0x2e15e4=_0x3545[_0x1d32ac];return _0x2e15e4;};'use strict';var multer=require(_0x5354('0x0'));var util=require(_0x5354('0x1'));var path=require(_0x5354('0x2'));var timeout=require(_0x5354('0x3'));var express=require(_0x5354('0x4'));var router=express[_0x5354('0x5')]();var fs_extra=require(_0x5354('0x6'));var auth=require(_0x5354('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x5354('0x8'));var controller=require('./cmContact.controller');router['get']('/',auth[_0x5354('0x9')](),controller[_0x5354('0xa')]);router[_0x5354('0xb')]('/describe',auth[_0x5354('0x9')](),controller[_0x5354('0xc')]);router[_0x5354('0xb')](_0x5354('0xd'),auth[_0x5354('0x9')](),controller['show']);router[_0x5354('0xb')](_0x5354('0xe'),auth[_0x5354('0x9')](),controller[_0x5354('0xf')]);router[_0x5354('0xb')](_0x5354('0x10'),auth['isAuthenticated'](),controller[_0x5354('0x11')]);router[_0x5354('0xb')](_0x5354('0x12'),auth[_0x5354('0x9')](),controller['getHopperHistories']);router[_0x5354('0xb')](_0x5354('0x13'),auth[_0x5354('0x9')](),controller[_0x5354('0x14')]);router[_0x5354('0xb')](_0x5354('0x15'),auth[_0x5354('0x9')](),controller[_0x5354('0x16')]);router[_0x5354('0xb')]('/:id/journey',auth['isAuthenticated'](),controller['getJourney']);router[_0x5354('0x17')](_0x5354('0x18'),auth['isAuthenticated'](),controller[_0x5354('0x19')]);router['post']('/',auth[_0x5354('0x9')](),controller[_0x5354('0x1a')]);router['post'](_0x5354('0x1b'),auth[_0x5354('0x9')](),controller[_0x5354('0x1c')]);router[_0x5354('0x17')](_0x5354('0xe'),auth['isAuthenticated'](),controller[_0x5354('0x1d')]);var upload=multer({'storage':multer[_0x5354('0x1e')]({'destination':function(_0x40d3fa,_0xbdd73d,_0x353444){_0x353444(null,path[_0x5354('0x1f')](config[_0x5354('0x20')],_0x5354('0x21')));},'filename':function(_0x4963bb,_0x255627,_0x56759a){_0x255627[_0x5354('0x22')]=_0x255627[_0x5354('0x22')][_0x5354('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x56759a(null,util['format'](_0x5354('0x24'),path['basename'](_0x255627['originalname'],path[_0x5354('0x25')](_0x255627[_0x5354('0x22')])),Date['now'](),path[_0x5354('0x25')](_0x255627[_0x5354('0x22')])));}})});router['post']('/csv',upload['single'](_0x5354('0x26')),controller[_0x5354('0x27')]);var upload=multer({'storage':multer[_0x5354('0x1e')]({'destination':function(_0x41d17a,_0x3b5f74,_0x2cf892){_0x2cf892(null,path[_0x5354('0x1f')](config['root'],'server/files/tmp'));},'filename':function(_0x531361,_0x286741,_0x2c0223){_0x286741[_0x5354('0x22')]=_0x286741['originalname'][_0x5354('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2c0223(null,util[_0x5354('0x28')](_0x5354('0x24'),path[_0x5354('0x29')](_0x286741['originalname'],path[_0x5354('0x25')](_0x286741[_0x5354('0x22')])),Date[_0x5354('0x2a')](),path[_0x5354('0x25')](_0x286741['originalname'])));}})});router[_0x5354('0x17')](_0x5354('0x2b'),upload['single']('file'),controller['upload']);router['post'](_0x5354('0x2c'),auth['isAuthenticated'](),controller[_0x5354('0x2d')]);router[_0x5354('0x2e')](_0x5354('0xd'),auth[_0x5354('0x9')](),controller[_0x5354('0x2f')]);router[_0x5354('0x30')](_0x5354('0xd'),auth[_0x5354('0x9')](),controller[_0x5354('0x31')]);module[_0x5354('0x32')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 436e67a..55d36dd 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 _0xa624=['stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','setDataValue','name','STRING','TEXT','long','values','isArray'];(function(_0x104f8f,_0x223643){var _0x207a1f=function(_0x3c3a99){while(--_0x3c3a99){_0x104f8f['push'](_0x104f8f['shift']());}};_0x207a1f(++_0x223643);}(_0xa624,0x17a));var _0x4a62=function(_0x4c1ec2,_0x4f42b7){_0x4c1ec2=_0x4c1ec2-0x0;var _0x3f6f1c=_0xa624[_0x4c1ec2];return _0x3f6f1c;};'use strict';var Sequelize=require(_0x4a62('0x0'));var _=require(_0x4a62('0x1'));module[_0x4a62('0x2')]={'name':{'type':Sequelize[_0x4a62('0x3')],'get':function(_0xc78e6e){return this[_0x4a62('0x4')](_0x4a62('0x5'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x379aa9){this[_0x4a62('0x6')]('alias',_0x379aa9?_0x379aa9:this['getDataValue'](_0x4a62('0x7')));}},'type':{'type':Sequelize[_0x4a62('0x8')],'allowNull':![]},'values':{'type':Sequelize[_0x4a62('0x9')](_0x4a62('0xa')),'get':function(){if(this['getDataValue']('type')==='select'){return JSON['parse'](this[_0x4a62('0x4')](_0x4a62('0xb')));}else{return this[_0x4a62('0x4')](_0x4a62('0xb'));}},'set':function(_0x228ede){if(Array[_0x4a62('0xc')](_0x228ede)){this[_0x4a62('0x6')](_0x4a62('0xb'),JSON[_0x4a62('0xd')](_0x228ede));}else{this['setDataValue'](_0x4a62('0xb'),_0x228ede);}}},'required':{'type':Sequelize[_0x4a62('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x4a62('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x4a62('0xf')](_0x4a62('0x10'))}}; \ No newline at end of file +var _0x29d1=['parse','values','stringify','BOOLEAN','ENUM','voice','sequelize','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','TEXT','long','select'];(function(_0x2e449c,_0x2c4533){var _0x3add79=function(_0x1c34d3){while(--_0x1c34d3){_0x2e449c['push'](_0x2e449c['shift']());}};_0x3add79(++_0x2c4533);}(_0x29d1,0x66));var _0x129d=function(_0x3be951,_0x9d9eed){_0x3be951=_0x3be951-0x0;var _0x53e527=_0x29d1[_0x3be951];return _0x53e527;};'use strict';var Sequelize=require(_0x129d('0x0'));var _=require('lodash');module[_0x129d('0x1')]={'name':{'type':Sequelize[_0x129d('0x2')],'get':function(_0x4aee53){return this[_0x129d('0x3')](_0x129d('0x4'));}},'alias':{'type':Sequelize[_0x129d('0x5')],'allowNull':![],'set':function(_0x599b2b){this[_0x129d('0x6')](_0x129d('0x4'),_0x599b2b?_0x599b2b:this[_0x129d('0x3')]('name'));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x129d('0x7')](_0x129d('0x8')),'get':function(){if(this[_0x129d('0x3')]('type')===_0x129d('0x9')){return JSON[_0x129d('0xa')](this[_0x129d('0x3')](_0x129d('0xb')));}else{return this[_0x129d('0x3')](_0x129d('0xb'));}},'set':function(_0xb58ce8){if(Array['isArray'](_0xb58ce8)){this[_0x129d('0x6')](_0x129d('0xb'),JSON[_0x129d('0xc')](_0xb58ce8));}else{this[_0x129d('0x6')](_0x129d('0xb'),_0xb58ce8);}}},'required':{'type':Sequelize[_0x129d('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x129d('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x129d('0xe')](_0x129d('0xf'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 3864dc1..f1794f5 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 _0xd381=['where','pick','filters','filter','merge','options','includeAll','include','rows','catch','show','params','intersection','find','body','create','sequelize','Sequelize','TEXT','type','text','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','limit','undefined','count','offset','set','reject','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','key','differenceBy','keys','query','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x494d34,_0x353f86){var _0x80a59c=function(_0x43b737){while(--_0x43b737){_0x494d34['push'](_0x494d34['shift']());}};_0x80a59c(++_0x353f86);}(_0xd381,0xcc));var _0x1d38=function(_0x1344d6,_0x2181e6){_0x1344d6=_0x1344d6-0x0;var _0xf45b24=_0xd381[_0x1344d6];return _0xf45b24;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1d38('0x0'));var zipdir=require(_0x1d38('0x1'));var jsonpatch=require(_0x1d38('0x2'));var rp=require(_0x1d38('0x3'));var moment=require(_0x1d38('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1d38('0x5'));var util=require(_0x1d38('0x6'));var path=require(_0x1d38('0x7'));var sox=require('sox');var csv=require(_0x1d38('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1d38('0x9'));var _=require(_0x1d38('0xa'));var squel=require(_0x1d38('0xb'));var crypto=require(_0x1d38('0xc'));var jsforce=require(_0x1d38('0xd'));var deskjs=require(_0x1d38('0xe'));var toCsv=require(_0x1d38('0x8'));var querystring=require(_0x1d38('0xf'));var Papa=require(_0x1d38('0x10'));var Redis=require(_0x1d38('0x11'));var authService=require(_0x1d38('0x12'));var qs=require(_0x1d38('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1d38('0x14'))(_0x1d38('0x15'));var utils=require(_0x1d38('0x16'));var config=require(_0x1d38('0x17'));var licenseUtil=require(_0x1d38('0x18'));var db=require(_0x1d38('0x19'))['db'];function respondWithStatusCode(_0x6539f9,_0x2545e0){_0x2545e0=_0x2545e0||0xcc;return function(_0x132e8e){if(_0x132e8e){return _0x6539f9['sendStatus'](_0x2545e0);}return _0x6539f9[_0x1d38('0x1a')](_0x2545e0)['end']();};}function respondWithResult(_0xd38e38,_0x440c55){_0x440c55=_0x440c55||0xc8;return function(_0x511ea6){if(_0x511ea6){return _0xd38e38[_0x1d38('0x1a')](_0x440c55)[_0x1d38('0x1b')](_0x511ea6);}};}function respondWithFilteredResult(_0x47a96a,_0x3cbad1){return function(_0x398a47){if(_0x398a47){var _0x2fef1a=typeof _0x3cbad1['offset']==='undefined'&&typeof _0x3cbad1[_0x1d38('0x1c')]===_0x1d38('0x1d');var _0x3f2c99=_0x398a47[_0x1d38('0x1e')];var _0x392676=_0x2fef1a?0x0:_0x3cbad1[_0x1d38('0x1f')];var _0x4058fa=_0x2fef1a?_0x398a47[_0x1d38('0x1e')]:_0x3cbad1[_0x1d38('0x1f')]+_0x3cbad1[_0x1d38('0x1c')];var _0x38da08;if(_0x4058fa>=_0x3f2c99){_0x4058fa=_0x3f2c99;_0x38da08=0xc8;}else{_0x38da08=0xce;}_0x47a96a[_0x1d38('0x1a')](_0x38da08);return _0x47a96a[_0x1d38('0x20')]('Content-Range',_0x392676+'-'+_0x4058fa+'/'+_0x3f2c99)[_0x1d38('0x1b')](_0x398a47);}return null;};}function patchUpdates(_0x187e0b){return function(_0x39fd4e){try{jsonpatch['apply'](_0x39fd4e,_0x187e0b,!![]);}catch(_0x34eae0){return BPromise[_0x1d38('0x21')](_0x34eae0);}return _0x39fd4e['save']();};}function saveUpdates(_0x47bdbf,_0x88f5ff){return function(_0x4e42d1){if(_0x4e42d1){return _0x4e42d1[_0x1d38('0x22')](_0x47bdbf)['then'](function(_0x1cc2ce){return _0x1cc2ce;});}return null;};}function removeEntity(_0x4cfc67,_0x464cbe){return function(_0x3c1a3b){if(_0x3c1a3b){return _0x3c1a3b[_0x1d38('0x23')]()[_0x1d38('0x24')](function(){_0x4cfc67['status'](0xcc)[_0x1d38('0x25')]();});}};}function handleEntityNotFound(_0xc2ccb9,_0x21e34a){return function(_0x21f839){if(!_0x21f839){_0xc2ccb9[_0x1d38('0x26')](0x194);}return _0x21f839;};}function handleError(_0x147395,_0x5e6b5d){_0x5e6b5d=_0x5e6b5d||0x1f4;return function(_0x207b7b){logger[_0x1d38('0x27')](_0x207b7b[_0x1d38('0x28')]);if(_0x207b7b['name']){delete _0x207b7b[_0x1d38('0x29')];}_0x147395['status'](_0x5e6b5d)[_0x1d38('0x2a')](_0x207b7b);};}exports[_0x1d38('0x2b')]=function(_0x207bf9,_0x1397ae){var _0x1e0f9e={},_0x4a4368={},_0x40690a={'count':0x0,'rows':[]};var _0x3fb02f=_[_0x1d38('0x2c')](db[_0x1d38('0x2d')][_0x1d38('0x2e')],function(_0x358119){return{'name':_0x358119[_0x1d38('0x2f')],'type':_0x358119['type'][_0x1d38('0x30')]};});_0x4a4368['model']=_[_0x1d38('0x31')](_['map'](_0x3fb02f,_0x1d38('0x29')),[_0x1d38('0x29')]);_0x4a4368['query']=_[_0x1d38('0x32')](_0x207bf9[_0x1d38('0x33')]);_0x4a4368['filters']=_['intersection'](_0x4a4368[_0x1d38('0x34')],_0x4a4368['query']);_0x1e0f9e[_0x1d38('0x35')]=_['intersection'](_0x4a4368['model'],qs['fields'](_0x207bf9[_0x1d38('0x33')][_0x1d38('0x36')]));_0x1e0f9e[_0x1d38('0x35')]=_0x1e0f9e['attributes'][_0x1d38('0x37')]?_0x1e0f9e['attributes']:_0x4a4368['model'];if(!_0x207bf9[_0x1d38('0x33')][_0x1d38('0x38')](_0x1d38('0x39'))){_0x1e0f9e[_0x1d38('0x1c')]=qs[_0x1d38('0x1c')](_0x207bf9[_0x1d38('0x33')]['limit']);_0x1e0f9e[_0x1d38('0x1f')]=qs[_0x1d38('0x1f')](_0x207bf9[_0x1d38('0x33')][_0x1d38('0x1f')]);}_0x1e0f9e[_0x1d38('0x3a')]=qs[_0x1d38('0x3b')](_0x207bf9[_0x1d38('0x33')][_0x1d38('0x3b')]);_0x1e0f9e[_0x1d38('0x3c')]=qs['filters'](_[_0x1d38('0x3d')](_0x207bf9['query'],_0x4a4368[_0x1d38('0x3e')]),_0x3fb02f);if(_0x207bf9[_0x1d38('0x33')]['filter']){_0x1e0f9e['where']=_['merge'](_0x1e0f9e[_0x1d38('0x3c')],{'$or':_[_0x1d38('0x2c')](_0x3fb02f,function(_0x478f13){if(_0x478f13['type']!=='VIRTUAL'){var _0x5ccae1={};_0x5ccae1[_0x478f13[_0x1d38('0x29')]]={'$like':'%'+_0x207bf9['query'][_0x1d38('0x3f')]+'%'};return _0x5ccae1;}})});}_0x1e0f9e=_[_0x1d38('0x40')]({},_0x1e0f9e,_0x207bf9[_0x1d38('0x41')]);var _0x176404={'where':_0x1e0f9e['where']};return db[_0x1d38('0x2d')][_0x1d38('0x1e')](_0x176404)[_0x1d38('0x24')](function(_0x18bc6e){_0x40690a[_0x1d38('0x1e')]=_0x18bc6e;if(_0x207bf9['query'][_0x1d38('0x42')]){_0x1e0f9e[_0x1d38('0x43')]=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x1e0f9e);})[_0x1d38('0x24')](function(_0x45a6be){_0x40690a[_0x1d38('0x44')]=_0x45a6be;return _0x40690a;})[_0x1d38('0x24')](respondWithFilteredResult(_0x1397ae,_0x1e0f9e))[_0x1d38('0x45')](handleError(_0x1397ae,null));};exports[_0x1d38('0x46')]=function(_0x4b780a,_0x547915){var _0x5a47f6={'raw':!![],'where':{'id':_0x4b780a[_0x1d38('0x47')]['id']}},_0x4a83b9={};_0x4a83b9[_0x1d38('0x34')]=_[_0x1d38('0x32')](db[_0x1d38('0x2d')][_0x1d38('0x2e')]);_0x4a83b9[_0x1d38('0x33')]=_[_0x1d38('0x32')](_0x4b780a[_0x1d38('0x33')]);_0x4a83b9[_0x1d38('0x3e')]=_[_0x1d38('0x48')](_0x4a83b9[_0x1d38('0x34')],_0x4a83b9[_0x1d38('0x33')]);_0x5a47f6[_0x1d38('0x35')]=_[_0x1d38('0x48')](_0x4a83b9[_0x1d38('0x34')],qs[_0x1d38('0x36')](_0x4b780a[_0x1d38('0x33')][_0x1d38('0x36')]));_0x5a47f6[_0x1d38('0x35')]=_0x5a47f6['attributes'][_0x1d38('0x37')]?_0x5a47f6[_0x1d38('0x35')]:_0x4a83b9[_0x1d38('0x34')];if(_0x4b780a['query'][_0x1d38('0x42')]){_0x5a47f6['include']=[{'all':!![]}];}_0x5a47f6=_[_0x1d38('0x40')]({},_0x5a47f6,_0x4b780a['options']);return db[_0x1d38('0x2d')][_0x1d38('0x49')](_0x5a47f6)['then'](handleEntityNotFound(_0x547915,null))[_0x1d38('0x24')](respondWithResult(_0x547915,null))['catch'](handleError(_0x547915,null));};exports[_0x1d38('0x22')]=function(_0x43748d,_0x2334d6){if(_0x43748d[_0x1d38('0x4a')]['id']){delete _0x43748d['body']['id'];}return db[_0x1d38('0x2d')][_0x1d38('0x49')]({'where':{'id':_0x43748d[_0x1d38('0x47')]['id']}})[_0x1d38('0x24')](handleEntityNotFound(_0x2334d6,null))[_0x1d38('0x24')](saveUpdates(_0x43748d['body'],null))[_0x1d38('0x24')](respondWithResult(_0x2334d6,null))[_0x1d38('0x45')](handleError(_0x2334d6,null));};exports[_0x1d38('0x23')]=function(_0x2e34ba,_0x18c41d){return db['CmCustomField'][_0x1d38('0x49')]({'where':{'id':_0x2e34ba[_0x1d38('0x47')]['id']}})[_0x1d38('0x24')](handleEntityNotFound(_0x18c41d,null))[_0x1d38('0x24')](removeEntity(_0x18c41d,null))['catch'](handleError(_0x18c41d,null));};exports[_0x1d38('0x4b')]=function(_0x44bbc1,_0xad1cd8){var _0x1f694c;return db[_0x1d38('0x4c')]['transaction'](function(_0x5c51e4){return db[_0x1d38('0x2d')]['create'](_0x44bbc1[_0x1d38('0x4a')],{'transaction':_0x5c51e4})[_0x1d38('0x24')](function(_0x4b1122){_0x1f694c=_0x4b1122;var _0x4246de={'type':db[_0x1d38('0x4d')][_0x1d38('0x4e')],'transaction':_0x5c51e4};switch(_0x44bbc1['body'][_0x1d38('0x4f')]){case _0x1d38('0x50'):_0x4246de['type']=db[_0x1d38('0x4d')][_0x1d38('0x4e')];break;case'number':_0x4246de[_0x1d38('0x4f')]=db[_0x1d38('0x4d')]['INTEGER'];break;case _0x1d38('0x51'):_0x4246de['type']=db[_0x1d38('0x4d')][_0x1d38('0x52')];_0x4246de[_0x1d38('0x53')]=![];break;default:}return db[_0x1d38('0x4c')][_0x1d38('0x54')][_0x1d38('0x55')](_0x1d38('0x56'),util[_0x1d38('0x57')]('cf_%d',_0x1f694c['id']),_0x4246de);})['then'](function(){return _0x1f694c;});})[_0x1d38('0x24')](respondWithResult(_0xad1cd8,0xc9))[_0x1d38('0x45')](handleError(_0xad1cd8,null));}; \ No newline at end of file +var _0xdb77=['then','error','stack','name','send','map','CmCustomField','rawAttributes','fieldName','type','key','differenceBy','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','body','sequelize','transaction','create','TEXT','number','Sequelize','BOOLEAN','queryInterface','cm_contacts','cf_%d','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','limit','undefined','count','offset','Content-Range','apply','save','update','destroy'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xdb77,0xde));var _0x7db7=function(_0x2489d0,_0xa513c){_0x2489d0=_0x2489d0-0x0;var _0x57f4cb=_0xdb77[_0x2489d0];return _0x57f4cb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7db7('0x0'));var zipdir=require(_0x7db7('0x1'));var jsonpatch=require(_0x7db7('0x2'));var rp=require(_0x7db7('0x3'));var moment=require(_0x7db7('0x4'));var BPromise=require(_0x7db7('0x5'));var Mustache=require(_0x7db7('0x6'));var util=require(_0x7db7('0x7'));var path=require(_0x7db7('0x8'));var sox=require(_0x7db7('0x9'));var csv=require(_0x7db7('0xa'));var ejs=require(_0x7db7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7db7('0xc'));var squel=require(_0x7db7('0xd'));var crypto=require(_0x7db7('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7db7('0xf'));var toCsv=require(_0x7db7('0xa'));var querystring=require(_0x7db7('0x10'));var Papa=require(_0x7db7('0x11'));var Redis=require(_0x7db7('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7db7('0x13'));var as=require(_0x7db7('0x14'));var hardwareService=require(_0x7db7('0x15'));var logger=require(_0x7db7('0x16'))(_0x7db7('0x17'));var utils=require(_0x7db7('0x18'));var config=require(_0x7db7('0x19'));var licenseUtil=require(_0x7db7('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5eb192,_0x41ccae){_0x41ccae=_0x41ccae||0xcc;return function(_0x3e66ff){if(_0x3e66ff){return _0x5eb192['sendStatus'](_0x41ccae);}return _0x5eb192['status'](_0x41ccae)[_0x7db7('0x1b')]();};}function respondWithResult(_0x510c46,_0x3c29f4){_0x3c29f4=_0x3c29f4||0xc8;return function(_0x42913f){if(_0x42913f){return _0x510c46[_0x7db7('0x1c')](_0x3c29f4)[_0x7db7('0x1d')](_0x42913f);}};}function respondWithFilteredResult(_0x1349ac,_0x2e0c01){return function(_0x1ed349){if(_0x1ed349){var _0xaaa49f=typeof _0x2e0c01['offset']==='undefined'&&typeof _0x2e0c01[_0x7db7('0x1e')]===_0x7db7('0x1f');var _0x3f4828=_0x1ed349[_0x7db7('0x20')];var _0x6c5200=_0xaaa49f?0x0:_0x2e0c01[_0x7db7('0x21')];var _0x27c8e1=_0xaaa49f?_0x1ed349[_0x7db7('0x20')]:_0x2e0c01[_0x7db7('0x21')]+_0x2e0c01[_0x7db7('0x1e')];var _0x103c90;if(_0x27c8e1>=_0x3f4828){_0x27c8e1=_0x3f4828;_0x103c90=0xc8;}else{_0x103c90=0xce;}_0x1349ac[_0x7db7('0x1c')](_0x103c90);return _0x1349ac['set'](_0x7db7('0x22'),_0x6c5200+'-'+_0x27c8e1+'/'+_0x3f4828)['json'](_0x1ed349);}return null;};}function patchUpdates(_0x4f8811){return function(_0x240ac1){try{jsonpatch[_0x7db7('0x23')](_0x240ac1,_0x4f8811,!![]);}catch(_0x39eac2){return BPromise['reject'](_0x39eac2);}return _0x240ac1[_0x7db7('0x24')]();};}function saveUpdates(_0x54762d,_0x59156b){return function(_0x1e675e){if(_0x1e675e){return _0x1e675e[_0x7db7('0x25')](_0x54762d)['then'](function(_0x321a27){return _0x321a27;});}return null;};}function removeEntity(_0x2358f,_0x5481ef){return function(_0x682e6b){if(_0x682e6b){return _0x682e6b[_0x7db7('0x26')]()[_0x7db7('0x27')](function(){_0x2358f[_0x7db7('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x233fbe,_0x40a3db){return function(_0x16c206){if(!_0x16c206){_0x233fbe['sendStatus'](0x194);}return _0x16c206;};}function handleError(_0x389fd9,_0x5a9e55){_0x5a9e55=_0x5a9e55||0x1f4;return function(_0x2bc385){logger[_0x7db7('0x28')](_0x2bc385[_0x7db7('0x29')]);if(_0x2bc385[_0x7db7('0x2a')]){delete _0x2bc385['name'];}_0x389fd9[_0x7db7('0x1c')](_0x5a9e55)[_0x7db7('0x2b')](_0x2bc385);};}exports['index']=function(_0x46c990,_0x12d634){var _0x240146={},_0x7232e={},_0x587834={'count':0x0,'rows':[]};var _0x5c057c=_[_0x7db7('0x2c')](db[_0x7db7('0x2d')][_0x7db7('0x2e')],function(_0x4b806a){return{'name':_0x4b806a[_0x7db7('0x2f')],'type':_0x4b806a[_0x7db7('0x30')][_0x7db7('0x31')]};});_0x7232e['model']=_[_0x7db7('0x32')](_[_0x7db7('0x2c')](_0x5c057c,_0x7db7('0x2a')),[_0x7db7('0x2a')]);_0x7232e['query']=_[_0x7db7('0x33')](_0x46c990[_0x7db7('0x34')]);_0x7232e[_0x7db7('0x35')]=_['intersection'](_0x7232e[_0x7db7('0x36')],_0x7232e[_0x7db7('0x34')]);_0x240146[_0x7db7('0x37')]=_[_0x7db7('0x38')](_0x7232e[_0x7db7('0x36')],qs[_0x7db7('0x39')](_0x46c990[_0x7db7('0x34')][_0x7db7('0x39')]));_0x240146[_0x7db7('0x37')]=_0x240146[_0x7db7('0x37')][_0x7db7('0x3a')]?_0x240146[_0x7db7('0x37')]:_0x7232e[_0x7db7('0x36')];if(!_0x46c990[_0x7db7('0x34')][_0x7db7('0x3b')](_0x7db7('0x3c'))){_0x240146[_0x7db7('0x1e')]=qs[_0x7db7('0x1e')](_0x46c990['query'][_0x7db7('0x1e')]);_0x240146[_0x7db7('0x21')]=qs[_0x7db7('0x21')](_0x46c990[_0x7db7('0x34')]['offset']);}_0x240146[_0x7db7('0x3d')]=qs[_0x7db7('0x3e')](_0x46c990[_0x7db7('0x34')]['sort']);_0x240146[_0x7db7('0x3f')]=qs['filters'](_[_0x7db7('0x40')](_0x46c990[_0x7db7('0x34')],_0x7232e['filters']),_0x5c057c);if(_0x46c990[_0x7db7('0x34')]['filter']){_0x240146[_0x7db7('0x3f')]=_[_0x7db7('0x41')](_0x240146[_0x7db7('0x3f')],{'$or':_[_0x7db7('0x2c')](_0x5c057c,function(_0x401fe9){if(_0x401fe9[_0x7db7('0x30')]!==_0x7db7('0x42')){var _0xe7dcf0={};_0xe7dcf0[_0x401fe9[_0x7db7('0x2a')]]={'$like':'%'+_0x46c990['query']['filter']+'%'};return _0xe7dcf0;}})});}_0x240146=_[_0x7db7('0x41')]({},_0x240146,_0x46c990[_0x7db7('0x43')]);var _0x702698={'where':_0x240146[_0x7db7('0x3f')]};return db[_0x7db7('0x2d')]['count'](_0x702698)['then'](function(_0x5e736e){_0x587834[_0x7db7('0x20')]=_0x5e736e;if(_0x46c990[_0x7db7('0x34')]['includeAll']){_0x240146[_0x7db7('0x44')]=[{'all':!![]}];}return db[_0x7db7('0x2d')][_0x7db7('0x45')](_0x240146);})[_0x7db7('0x27')](function(_0x10848b){_0x587834[_0x7db7('0x46')]=_0x10848b;return _0x587834;})[_0x7db7('0x27')](respondWithFilteredResult(_0x12d634,_0x240146))[_0x7db7('0x47')](handleError(_0x12d634,null));};exports[_0x7db7('0x48')]=function(_0x2a390f,_0x4d403e){var _0x3a6a87={'raw':!![],'where':{'id':_0x2a390f[_0x7db7('0x49')]['id']}},_0xfb420a={};_0xfb420a[_0x7db7('0x36')]=_['keys'](db[_0x7db7('0x2d')][_0x7db7('0x2e')]);_0xfb420a[_0x7db7('0x34')]=_['keys'](_0x2a390f[_0x7db7('0x34')]);_0xfb420a[_0x7db7('0x35')]=_[_0x7db7('0x38')](_0xfb420a[_0x7db7('0x36')],_0xfb420a[_0x7db7('0x34')]);_0x3a6a87[_0x7db7('0x37')]=_[_0x7db7('0x38')](_0xfb420a['model'],qs[_0x7db7('0x39')](_0x2a390f['query'][_0x7db7('0x39')]));_0x3a6a87[_0x7db7('0x37')]=_0x3a6a87[_0x7db7('0x37')]['length']?_0x3a6a87[_0x7db7('0x37')]:_0xfb420a['model'];if(_0x2a390f[_0x7db7('0x34')][_0x7db7('0x4a')]){_0x3a6a87[_0x7db7('0x44')]=[{'all':!![]}];}_0x3a6a87=_[_0x7db7('0x41')]({},_0x3a6a87,_0x2a390f['options']);return db[_0x7db7('0x2d')][_0x7db7('0x4b')](_0x3a6a87)['then'](handleEntityNotFound(_0x4d403e,null))[_0x7db7('0x27')](respondWithResult(_0x4d403e,null))[_0x7db7('0x47')](handleError(_0x4d403e,null));};exports[_0x7db7('0x25')]=function(_0x21ca63,_0x4bc99e){if(_0x21ca63[_0x7db7('0x4c')]['id']){delete _0x21ca63['body']['id'];}return db[_0x7db7('0x2d')]['find']({'where':{'id':_0x21ca63[_0x7db7('0x49')]['id']}})[_0x7db7('0x27')](handleEntityNotFound(_0x4bc99e,null))[_0x7db7('0x27')](saveUpdates(_0x21ca63[_0x7db7('0x4c')],null))[_0x7db7('0x27')](respondWithResult(_0x4bc99e,null))[_0x7db7('0x47')](handleError(_0x4bc99e,null));};exports[_0x7db7('0x26')]=function(_0x437656,_0x4d056d){return db[_0x7db7('0x2d')][_0x7db7('0x4b')]({'where':{'id':_0x437656[_0x7db7('0x49')]['id']}})[_0x7db7('0x27')](handleEntityNotFound(_0x4d056d,null))[_0x7db7('0x27')](removeEntity(_0x4d056d,null))[_0x7db7('0x47')](handleError(_0x4d056d,null));};exports['create']=function(_0x3f58f5,_0x52519c){var _0x4ebb31;return db[_0x7db7('0x4d')][_0x7db7('0x4e')](function(_0x59e869){return db[_0x7db7('0x2d')][_0x7db7('0x4f')](_0x3f58f5[_0x7db7('0x4c')],{'transaction':_0x59e869})['then'](function(_0x2fb284){_0x4ebb31=_0x2fb284;var _0x900439={'type':db['Sequelize'][_0x7db7('0x50')],'transaction':_0x59e869};switch(_0x3f58f5[_0x7db7('0x4c')]['type']){case'text':_0x900439[_0x7db7('0x30')]=db['Sequelize'][_0x7db7('0x50')];break;case _0x7db7('0x51'):_0x900439[_0x7db7('0x30')]=db[_0x7db7('0x52')]['INTEGER'];break;case'switch':_0x900439[_0x7db7('0x30')]=db[_0x7db7('0x52')][_0x7db7('0x53')];_0x900439['defaultValue']=![];break;default:}return db[_0x7db7('0x4d')][_0x7db7('0x54')]['addColumn'](_0x7db7('0x55'),util['format'](_0x7db7('0x56'),_0x4ebb31['id']),_0x900439);})[_0x7db7('0x27')](function(){return _0x4ebb31;});})[_0x7db7('0x27')](respondWithResult(_0x52519c,0xc9))[_0x7db7('0x47')](handleError(_0x52519c,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 7754a93..e3e1141 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 _0xd204=['define','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports'];(function(_0x590300,_0x263466){var _0x15ffdc=function(_0x412a1c){while(--_0x412a1c){_0x590300['push'](_0x590300['shift']());}};_0x15ffdc(++_0x263466);}(_0xd204,0x9c));var _0x4d20=function(_0x13464b,_0x402bf4){_0x13464b=_0x13464b-0x0;var _0xf6c8fa=_0xd204[_0x13464b];return _0xf6c8fa;};'use strict';var _=require(_0x4d20('0x0'));var util=require(_0x4d20('0x1'));var logger=require(_0x4d20('0x2'))(_0x4d20('0x3'));var moment=require(_0x4d20('0x4'));var BPromise=require(_0x4d20('0x5'));var rp=require(_0x4d20('0x6'));var fs=require('fs');var path=require(_0x4d20('0x7'));var rimraf=require(_0x4d20('0x8'));var config=require(_0x4d20('0x9'));var attributes=require(_0x4d20('0xa'));module[_0x4d20('0xb')]=function(_0x1f0942,_0x302643){return _0x1f0942[_0x4d20('0xc')]('CmCustomField',attributes,{'tableName':_0x4d20('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe9f7=['../../config/environment','exports','define','CmCustomField','lodash','../../config/logger','moment','path','rimraf'];(function(_0x2d68ce,_0x2cebf7){var _0x4bc64d=function(_0x52b537){while(--_0x52b537){_0x2d68ce['push'](_0x2d68ce['shift']());}};_0x4bc64d(++_0x2cebf7);}(_0xe9f7,0xdc));var _0x7e9f=function(_0x51b0dc,_0x5307b7){_0x51b0dc=_0x51b0dc-0x0;var _0x13fa89=_0xe9f7[_0x51b0dc];return _0x13fa89;};'use strict';var _=require(_0x7e9f('0x0'));var util=require('util');var logger=require(_0x7e9f('0x1'))('api');var moment=require(_0x7e9f('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7e9f('0x3'));var rimraf=require(_0x7e9f('0x4'));var config=require(_0x7e9f('0x5'));var attributes=require('./cmCustomField.attributes');module[_0x7e9f('0x6')]=function(_0x6aa90b,_0x488ec6){return _0x6aa90b[_0x7e9f('0x7')](_0x7e9f('0x8'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 31e7f63..3b18682 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 _0x566a=['stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s'];(function(_0x101ccf,_0x470d63){var _0x58021a=function(_0x45a46d){while(--_0x45a46d){_0x101ccf['push'](_0x101ccf['shift']());}};_0x58021a(++_0x470d63);}(_0x566a,0x9f));var _0xa566=function(_0x487adb,_0x336c93){_0x487adb=_0x487adb-0x0;var _0x282753=_0x566a[_0x487adb];return _0x282753;};'use strict';var _=require(_0xa566('0x0'));var util=require('util');var moment=require(_0xa566('0x1'));var BPromise=require(_0xa566('0x2'));var rs=require(_0xa566('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa566('0x4'))['db'];var utils=require(_0xa566('0x5'));var logger=require(_0xa566('0x6'))(_0xa566('0x7'));var config=require(_0xa566('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa566('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18e355,_0x2adb69,_0x50dcf9){return new BPromise(function(_0x4ab3d6,_0x2f8733){return client[_0xa566('0xa')](_0x18e355,_0x50dcf9)[_0xa566('0xb')](function(_0x2204a3){logger[_0xa566('0xc')](_0xa566('0xd'),_0x2adb69,_0xa566('0xe'));logger[_0xa566('0xf')](_0xa566('0x10'),_0x2adb69,'request\x20sent',JSON[_0xa566('0x11')](_0x2204a3));if(_0x2204a3[_0xa566('0x12')]){if(_0x2204a3['error'][_0xa566('0x13')]===0x1f4){logger['error'](_0xa566('0xd'),_0x2adb69,_0x2204a3[_0xa566('0x12')][_0xa566('0x14')]);return _0x2f8733(_0x2204a3[_0xa566('0x12')][_0xa566('0x14')]);}logger[_0xa566('0x12')]('CmCustomField,\x20%s,\x20%s',_0x2adb69,_0x2204a3['error']['message']);return _0x4ab3d6(_0x2204a3[_0xa566('0x12')][_0xa566('0x14')]);}else{logger[_0xa566('0xc')](_0xa566('0xd'),_0x2adb69,_0xa566('0xe'));_0x4ab3d6(_0x2204a3['result']['message']);}})[_0xa566('0x15')](function(_0x4f6ad2){logger[_0xa566('0x12')](_0xa566('0xd'),_0x2adb69,_0x4f6ad2);_0x2f8733(_0x4f6ad2);});});} \ No newline at end of file +var _0xad08=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1bf85f,_0x20a48c){var _0x23af65=function(_0x28055b){while(--_0x28055b){_0x1bf85f['push'](_0x1bf85f['shift']());}};_0x23af65(++_0x20a48c);}(_0xad08,0x75));var _0x8ad0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xad08[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8ad0('0x0'));var util=require(_0x8ad0('0x1'));var moment=require(_0x8ad0('0x2'));var BPromise=require(_0x8ad0('0x3'));var rs=require(_0x8ad0('0x4'));var fs=require('fs');var Redis=require(_0x8ad0('0x5'));var db=require(_0x8ad0('0x6'))['db'];var utils=require(_0x8ad0('0x7'));var logger=require(_0x8ad0('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8ad0('0x9'));var client=jayson[_0x8ad0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa2902a,_0x13938e,_0x281212){return new BPromise(function(_0x36173d,_0xd22e7b){return client[_0x8ad0('0xb')](_0xa2902a,_0x281212)[_0x8ad0('0xc')](function(_0x391bdc){logger[_0x8ad0('0xd')](_0x8ad0('0xe'),_0x13938e,_0x8ad0('0xf'));logger[_0x8ad0('0x10')](_0x8ad0('0x11'),_0x13938e,_0x8ad0('0xf'),JSON[_0x8ad0('0x12')](_0x391bdc));if(_0x391bdc['error']){if(_0x391bdc[_0x8ad0('0x13')][_0x8ad0('0x14')]===0x1f4){logger['error'](_0x8ad0('0xe'),_0x13938e,_0x391bdc[_0x8ad0('0x13')][_0x8ad0('0x15')]);return _0xd22e7b(_0x391bdc['error']['message']);}logger['error'](_0x8ad0('0xe'),_0x13938e,_0x391bdc['error']['message']);return _0x36173d(_0x391bdc[_0x8ad0('0x13')][_0x8ad0('0x15')]);}else{logger[_0x8ad0('0xd')](_0x8ad0('0xe'),_0x13938e,_0x8ad0('0xf'));_0x36173d(_0x391bdc[_0x8ad0('0x16')]['message']);}})['catch'](function(_0x1f4505){logger[_0x8ad0('0x13')](_0x8ad0('0xe'),_0x13938e,_0x1f4505);_0xd22e7b(_0x1f4505);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 5114740..a2df633 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 _0x41fe=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','post','put','delete','exports'];(function(_0x120577,_0x592df5){var _0x3c5bdc=function(_0xf03a32){while(--_0xf03a32){_0x120577['push'](_0x120577['shift']());}};_0x3c5bdc(++_0x592df5);}(_0x41fe,0xd1));var _0xe41f=function(_0x5c2c7c,_0xa7d3b1){_0x5c2c7c=_0x5c2c7c-0x0;var _0xea7ffe=_0x41fe[_0x5c2c7c];return _0xea7ffe;};'use strict';var multer=require(_0xe41f('0x0'));var util=require(_0xe41f('0x1'));var path=require(_0xe41f('0x2'));var timeout=require(_0xe41f('0x3'));var express=require(_0xe41f('0x4'));var router=express[_0xe41f('0x5')]();var fs_extra=require(_0xe41f('0x6'));var auth=require(_0xe41f('0x7'));var interaction=require(_0xe41f('0x8'));var config=require(_0xe41f('0x9'));var controller=require(_0xe41f('0xa'));router[_0xe41f('0xb')]('/',auth[_0xe41f('0xc')](),controller[_0xe41f('0xd')]);router[_0xe41f('0xb')](_0xe41f('0xe'),auth[_0xe41f('0xc')](),controller['show']);router[_0xe41f('0xf')]('/',auth[_0xe41f('0xc')](),controller['create']);router[_0xe41f('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xe41f('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xe41f('0x12')]=router; \ No newline at end of file +var _0x2353=['create','update','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','/:id','show','post'];(function(_0x2f9bae,_0x575f40){var _0xb264f7=function(_0x1a6505){while(--_0x1a6505){_0x2f9bae['push'](_0x2f9bae['shift']());}};_0xb264f7(++_0x575f40);}(_0x2353,0xe3));var _0x3235=function(_0x36fbb5,_0x3ef27d){_0x36fbb5=_0x36fbb5-0x0;var _0x5b7c78=_0x2353[_0x36fbb5];return _0x5b7c78;};'use strict';var multer=require(_0x3235('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3235('0x1'));var express=require(_0x3235('0x2'));var router=express[_0x3235('0x3')]();var fs_extra=require(_0x3235('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3235('0x5'));var config=require(_0x3235('0x6'));var controller=require(_0x3235('0x7'));router[_0x3235('0x8')]('/',auth[_0x3235('0x9')](),controller['index']);router[_0x3235('0x8')](_0x3235('0xa'),auth[_0x3235('0x9')](),controller[_0x3235('0xb')]);router[_0x3235('0xc')]('/',auth[_0x3235('0x9')](),controller[_0x3235('0xd')]);router['put'](_0x3235('0xa'),auth[_0x3235('0x9')](),controller[_0x3235('0xe')]);router['delete'](_0x3235('0xa'),auth['isAuthenticated'](),controller[_0x3235('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 81e5c57..e0ff00d 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 _0x1c2b=['sequelize','STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE','UNSIGNED','contactListQueue','moment'];(function(_0xa88f7d,_0x470fe6){var _0xb1abdb=function(_0x144c69){while(--_0x144c69){_0xa88f7d['push'](_0xa88f7d['shift']());}};_0xb1abdb(++_0x470fe6);}(_0x1c2b,0xc7));var _0xb1c2=function(_0x4f153b,_0x39818f){_0x4f153b=_0x4f153b-0x0;var _0x4e0cf8=_0x1c2b[_0x4f153b];return _0x4e0cf8;};'use strict';var moment=require(_0xb1c2('0x0'));var Sequelize=require(_0xb1c2('0x1'));module['exports']={'phone':{'type':Sequelize[_0xb1c2('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xb1c2('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xb1c2('0x4')](_0xb1c2('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb1c2('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xb1c2('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb1c2('0x7')]},'priority':{'type':Sequelize[_0xb1c2('0x6')](0x2)[_0xb1c2('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xb1c2('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xb1c2('0x6')],'unique':_0xb1c2('0x9')},'ListId':{'type':Sequelize[_0xb1c2('0x6')],'unique':_0xb1c2('0x9')},'UserId':{'type':Sequelize[_0xb1c2('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xb1c2('0x6')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xb1c2('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xb1c2('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb1c2('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb1c2('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb1c2('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb1c2('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0x581f=['sequelize','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue'];(function(_0x77d166,_0x2a9b10){var _0x35dd9d=function(_0x18cb77){while(--_0x18cb77){_0x77d166['push'](_0x77d166['shift']());}};_0x35dd9d(++_0x2a9b10);}(_0x581f,0xd2));var _0xf581=function(_0x3f8d30,_0x57d905){_0x3f8d30=_0x3f8d30-0x0;var _0x22da37=_0x581f[_0x3f8d30];return _0x22da37;};'use strict';var moment=require('moment');var Sequelize=require(_0xf581('0x0'));module[_0xf581('0x1')]={'phone':{'type':Sequelize[_0xf581('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xf581('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xf581('0x4')],'defaultValue':moment()[_0xf581('0x5')](_0xf581('0x6'))},'countbusyretry':{'type':Sequelize[_0xf581('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf581('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf581('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xf581('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf581('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf581('0x4')]},'priority':{'type':Sequelize[_0xf581('0x7')](0x2)[_0xf581('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xf581('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xf581('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xf581('0x9')},'UserId':{'type':Sequelize[_0xf581('0x7')]},'VoiceQueueId':{'type':Sequelize[_0xf581('0x7')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xf581('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf581('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf581('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf581('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 2d1781e..7805966 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 _0x0aab=['rawAttributes','fieldName','type','model','query','keys','filters','intersection','$and','$or','$eq','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','find','create','body','describe','params','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','updatedAt','statedesc','deleted','membername','user','format','calleridnum','phone','CmContact','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','getOpenContacts','YYYY-MM-DD\x20HH:mm:ss','isNumber','json','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','to-csv','ejs','fs-extra','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','map','CmHopper'];(function(_0x483056,_0x34c5eb){var _0x13e41d=function(_0x454043){while(--_0x454043){_0x483056['push'](_0x483056['shift']());}};_0x13e41d(++_0x34c5eb);}(_0x0aab,0x179));var _0xb0aa=function(_0x54c10d,_0x2f2251){_0x54c10d=_0x54c10d-0x0;var _0x1fa703=_0x0aab[_0x54c10d];return _0x1fa703;};'use strict';var emlformat=require(_0xb0aa('0x0'));var rimraf=require(_0xb0aa('0x1'));var zipdir=require(_0xb0aa('0x2'));var jsonpatch=require(_0xb0aa('0x3'));var rp=require(_0xb0aa('0x4'));var moment=require(_0xb0aa('0x5'));var BPromise=require(_0xb0aa('0x6'));var Mustache=require(_0xb0aa('0x7'));var util=require(_0xb0aa('0x8'));var path=require(_0xb0aa('0x9'));var sox=require('sox');var csv=require(_0xb0aa('0xa'));var ejs=require(_0xb0aa('0xb'));var fs=require('fs');var fs_extra=require(_0xb0aa('0xc'));var _=require('lodash');var squel=require(_0xb0aa('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb0aa('0xe'));var Papa=require(_0xb0aa('0xf'));var Redis=require('ioredis');var authService=require(_0xb0aa('0x10'));var qs=require(_0xb0aa('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb0aa('0x12'));var logger=require(_0xb0aa('0x13'))(_0xb0aa('0x14'));var utils=require('../../config/utils');var config=require(_0xb0aa('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb0aa('0x16'))['db'];function respondWithStatusCode(_0x3e3a8f,_0x1e1c6e){_0x1e1c6e=_0x1e1c6e||0xcc;return function(_0x5115af){if(_0x5115af){return _0x3e3a8f[_0xb0aa('0x17')](_0x1e1c6e);}return _0x3e3a8f[_0xb0aa('0x18')](_0x1e1c6e)[_0xb0aa('0x19')]();};}function respondWithResult(_0x56d043,_0x289695){_0x289695=_0x289695||0xc8;return function(_0x51f987){if(_0x51f987){return _0x56d043[_0xb0aa('0x18')](_0x289695)['json'](_0x51f987);}};}function respondWithFilteredResult(_0x58ec14,_0x54ed87){return function(_0x4005cf){if(_0x4005cf){var _0x404625=typeof _0x54ed87[_0xb0aa('0x1a')]===_0xb0aa('0x1b')&&typeof _0x54ed87[_0xb0aa('0x1c')]===_0xb0aa('0x1b');var _0x186237=_0x4005cf[_0xb0aa('0x1d')];var _0x10386c=_0x404625?0x0:_0x54ed87[_0xb0aa('0x1a')];var _0x24311a=_0x404625?_0x4005cf[_0xb0aa('0x1d')]:_0x54ed87['offset']+_0x54ed87[_0xb0aa('0x1c')];var _0x454a47;if(_0x24311a>=_0x186237){_0x24311a=_0x186237;_0x454a47=0xc8;}else{_0x454a47=0xce;}_0x58ec14[_0xb0aa('0x18')](_0x454a47);return _0x58ec14[_0xb0aa('0x1e')](_0xb0aa('0x1f'),_0x10386c+'-'+_0x24311a+'/'+_0x186237)['json'](_0x4005cf);}return null;};}function patchUpdates(_0x50b8b3){return function(_0xabf20a){try{jsonpatch[_0xb0aa('0x20')](_0xabf20a,_0x50b8b3,!![]);}catch(_0x28c47e){return BPromise[_0xb0aa('0x21')](_0x28c47e);}return _0xabf20a['save']();};}function saveUpdates(_0x276b63,_0xf2b224){return function(_0x47b691){if(_0x47b691){return _0x47b691[_0xb0aa('0x22')](_0x276b63)['then'](function(_0x3ef2e6){return _0x3ef2e6;});}return null;};}function removeEntity(_0x3c85a1,_0x2223ca){return function(_0x26a316){if(_0x26a316){return _0x26a316[_0xb0aa('0x23')]()[_0xb0aa('0x24')](function(){_0x3c85a1['status'](0xcc)[_0xb0aa('0x19')]();});}};}function handleEntityNotFound(_0x1e9f0d,_0x5e522b){return function(_0xa5ba32){if(!_0xa5ba32){_0x1e9f0d[_0xb0aa('0x17')](0x194);}return _0xa5ba32;};}function handleError(_0x59d76f,_0x23aa87){_0x23aa87=_0x23aa87||0x1f4;return function(_0x431af8){logger[_0xb0aa('0x25')](_0x431af8[_0xb0aa('0x26')]);if(_0x431af8['name']){delete _0x431af8[_0xb0aa('0x27')];}_0x59d76f[_0xb0aa('0x18')](_0x23aa87)[_0xb0aa('0x28')](_0x431af8);};}exports['index']=function(_0x43623a,_0x56529c){var _0x2aa981={},_0x5457a6={},_0x60c9f={'count':0x0,'rows':[]};var _0x113c03=_[_0xb0aa('0x29')](db[_0xb0aa('0x2a')][_0xb0aa('0x2b')],function(_0x3815a3){return{'name':_0x3815a3[_0xb0aa('0x2c')],'type':_0x3815a3[_0xb0aa('0x2d')]['key']};});_0x5457a6[_0xb0aa('0x2e')]=_[_0xb0aa('0x29')](_0x113c03,_0xb0aa('0x27'));_0x5457a6[_0xb0aa('0x2f')]=_[_0xb0aa('0x30')](_0x43623a['query']);_0x5457a6[_0xb0aa('0x31')]=_[_0xb0aa('0x32')](_0x5457a6[_0xb0aa('0x2e')],_0x5457a6[_0xb0aa('0x2f')]);_0x5457a6[_0xb0aa('0x31')]=_['concat'](_0x5457a6['filters'],[_0xb0aa('0x33'),_0xb0aa('0x34'),'$gt','$gte','$lt','$lte','$ne',_0xb0aa('0x35'),'$not','$between',_0xb0aa('0x36'),_0xb0aa('0x37'),_0xb0aa('0x38'),_0xb0aa('0x39'),_0xb0aa('0x3a'),_0xb0aa('0x3b'),_0xb0aa('0x3c'),_0xb0aa('0x39'),_0xb0aa('0x3d'),_0xb0aa('0x3e'),_0xb0aa('0x3f'),_0xb0aa('0x40')]);_0x2aa981[_0xb0aa('0x41')]=_[_0xb0aa('0x32')](_0x5457a6[_0xb0aa('0x2e')],qs[_0xb0aa('0x42')](_0x43623a['query']['fields']));_0x2aa981[_0xb0aa('0x41')]=_0x2aa981[_0xb0aa('0x41')][_0xb0aa('0x43')]?_0x2aa981[_0xb0aa('0x41')]:_0x5457a6[_0xb0aa('0x2e')];if(!_0x43623a[_0xb0aa('0x2f')][_0xb0aa('0x44')](_0xb0aa('0x45'))){_0x2aa981[_0xb0aa('0x1c')]=qs[_0xb0aa('0x1c')](_0x43623a[_0xb0aa('0x2f')][_0xb0aa('0x1c')]);_0x2aa981[_0xb0aa('0x1a')]=qs[_0xb0aa('0x1a')](_0x43623a[_0xb0aa('0x2f')][_0xb0aa('0x1a')]);}_0x2aa981[_0xb0aa('0x46')]=qs[_0xb0aa('0x47')](_0x43623a['query'][_0xb0aa('0x47')]);_0x2aa981[_0xb0aa('0x48')]=qs[_0xb0aa('0x31')](_[_0xb0aa('0x49')](_0x43623a['query'],_0x5457a6[_0xb0aa('0x31')]),_0x113c03);if(_0x43623a[_0xb0aa('0x2f')]['filter']){_0x2aa981[_0xb0aa('0x48')]=_[_0xb0aa('0x4a')](_0x2aa981[_0xb0aa('0x48')],{'$or':_[_0xb0aa('0x29')](_0x113c03,function(_0x3e2fdc){if(_0x3e2fdc[_0xb0aa('0x2d')]!==_0xb0aa('0x4b')){var _0x518268={};_0x518268[_0x3e2fdc[_0xb0aa('0x27')]]={'$like':'%'+_0x43623a[_0xb0aa('0x2f')][_0xb0aa('0x4c')]+'%'};return _0x518268;}})});}_0x2aa981=_[_0xb0aa('0x4a')]({},_0x2aa981,_0x43623a[_0xb0aa('0x4d')]);var _0xd07e1b={'where':_0x2aa981['where']};return db[_0xb0aa('0x2a')]['count'](_0xd07e1b)['then'](function(_0x22c0af){_0x60c9f[_0xb0aa('0x1d')]=_0x22c0af;if(_0x43623a[_0xb0aa('0x2f')][_0xb0aa('0x4e')]){_0x2aa981[_0xb0aa('0x4f')]=[{'all':!![]}];}return db[_0xb0aa('0x2a')][_0xb0aa('0x50')](_0x2aa981);})[_0xb0aa('0x24')](function(_0x1522c4){_0x60c9f[_0xb0aa('0x51')]=_0x1522c4;return _0x60c9f;})[_0xb0aa('0x24')](respondWithFilteredResult(_0x56529c,_0x2aa981))[_0xb0aa('0x52')](handleError(_0x56529c,null));};exports['show']=function(_0x3b70e7,_0x273bf9){var _0x3e29f8={'raw':!![],'where':{'id':_0x3b70e7['params']['id']}},_0x409852={};_0x409852[_0xb0aa('0x2e')]=_[_0xb0aa('0x30')](db['CmHopper']['rawAttributes']);_0x409852[_0xb0aa('0x2f')]=_[_0xb0aa('0x30')](_0x3b70e7['query']);_0x409852[_0xb0aa('0x31')]=_[_0xb0aa('0x32')](_0x409852[_0xb0aa('0x2e')],_0x409852[_0xb0aa('0x2f')]);_0x3e29f8[_0xb0aa('0x41')]=_['intersection'](_0x409852[_0xb0aa('0x2e')],qs[_0xb0aa('0x42')](_0x3b70e7[_0xb0aa('0x2f')][_0xb0aa('0x42')]));_0x3e29f8[_0xb0aa('0x41')]=_0x3e29f8[_0xb0aa('0x41')][_0xb0aa('0x43')]?_0x3e29f8[_0xb0aa('0x41')]:_0x409852['model'];if(_0x3b70e7[_0xb0aa('0x2f')]['includeAll']){_0x3e29f8[_0xb0aa('0x4f')]=[{'all':!![]}];}_0x3e29f8=_[_0xb0aa('0x4a')]({},_0x3e29f8,_0x3b70e7[_0xb0aa('0x4d')]);return db[_0xb0aa('0x2a')][_0xb0aa('0x53')](_0x3e29f8)[_0xb0aa('0x24')](handleEntityNotFound(_0x273bf9,null))[_0xb0aa('0x24')](respondWithResult(_0x273bf9,null))[_0xb0aa('0x52')](handleError(_0x273bf9,null));};exports[_0xb0aa('0x54')]=function(_0x5176b0,_0x41f1fb){return db[_0xb0aa('0x2a')][_0xb0aa('0x54')](_0x5176b0[_0xb0aa('0x55')],{})[_0xb0aa('0x24')](respondWithResult(_0x41f1fb,0xc9))[_0xb0aa('0x52')](handleError(_0x41f1fb,null));};exports[_0xb0aa('0x22')]=function(_0x538c4d,_0x112a4e){if(_0x538c4d[_0xb0aa('0x55')]['id']){delete _0x538c4d[_0xb0aa('0x55')]['id'];}return db[_0xb0aa('0x2a')][_0xb0aa('0x53')]({'where':{'id':_0x538c4d['params']['id']}})[_0xb0aa('0x24')](handleEntityNotFound(_0x112a4e,null))[_0xb0aa('0x24')](saveUpdates(_0x538c4d[_0xb0aa('0x55')],null))['then'](respondWithResult(_0x112a4e,null))['catch'](handleError(_0x112a4e,null));};exports[_0xb0aa('0x56')]=function(_0x304b7d,_0xe6de20){return db[_0xb0aa('0x2a')][_0xb0aa('0x56')]()[_0xb0aa('0x24')](respondWithResult(_0xe6de20,null))['catch'](handleError(_0xe6de20,null));};exports[_0xb0aa('0x23')]=function(_0x503544,_0x27eea0){var _0x3ec7c4;return db[_0xb0aa('0x2a')][_0xb0aa('0x53')]({'where':{'id':_0x503544[_0xb0aa('0x57')]['id']}})[_0xb0aa('0x24')](handleEntityNotFound(_0x27eea0,null))[_0xb0aa('0x24')](function(_0x5dfddc){if(_0x5dfddc){return _0x5dfddc['destroy']()[_0xb0aa('0x24')](function(_0x30f016){return _0x30f016;});}})['then'](function(_0x5ede23){_0x3ec7c4=_0x5ede23;if(_0x5ede23){if(_0x5ede23[_0xb0aa('0x58')]||_0x5ede23[_0xb0aa('0x59')]){return db[_0x5ede23['VoiceQueueId']?_0xb0aa('0x5a'):_0xb0aa('0x5b')][_0xb0aa('0x53')]({'where':{'id':_0x5ede23[_0xb0aa('0x58')]?_0x5ede23['VoiceQueueId']:_0x5ede23['CampaignId']},'attributes':['id',_0xb0aa('0x27')],'raw':!![]});}}})[_0xb0aa('0x24')](function(_0x4caf0f){var _0x1ce18e={};if(_0x4caf0f){_[_0xb0aa('0x4a')](_0x1ce18e,_[_0xb0aa('0x5c')](_0x3ec7c4['dataValues'],['createdAt',_0xb0aa('0x5d'),'id']));_0x1ce18e['state']=0x15;_0x1ce18e[_0xb0aa('0x5e')]=_0xb0aa('0x5f');_0x1ce18e['campaign']=_0x4caf0f[_0xb0aa('0x27')];_0x1ce18e[_0xb0aa('0x60')]=_0x503544[_0xb0aa('0x61')][_0xb0aa('0x27')];_0x1ce18e['UserId']=_0x503544['user']['id'];_0x1ce18e[_0xb0aa('0x5f')]=!![];_0x1ce18e['deletedat']=moment()[_0xb0aa('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x1ce18e[_0xb0aa('0x63')]=_0x3ec7c4[_0xb0aa('0x64')];_0x1ce18e['campaigntype']=_0x3ec7c4[_0xb0aa('0x58')]?'queue':'ivr';return db[_0xb0aa('0x65')]['find']({'where':{'id':_0x1ce18e['ContactId']},'attributes':[_0xb0aa('0x66'),_0xb0aa('0x67')]})[_0xb0aa('0x24')](function(_0x4142fd){if(!_[_0xb0aa('0x68')](_0x27eea0)&&!_[_0xb0aa('0x68')](_0x4142fd['firstName'])){_0x1ce18e[_0xb0aa('0x69')]=_0x4142fd[_0xb0aa('0x66')];if(!_['isNil'](_0x4142fd['lastName'])){_0x1ce18e[_0xb0aa('0x69')]+='\x20'+_0x4142fd[_0xb0aa('0x67')];}}})[_0xb0aa('0x6a')](function(){return db[_0xb0aa('0x6b')][_0xb0aa('0x54')](_0x1ce18e);});}})[_0xb0aa('0x24')](function(){return _0x27eea0[_0xb0aa('0x18')](0xcc)[_0xb0aa('0x19')]();})[_0xb0aa('0x52')](handleError(_0x27eea0,null));};exports['getPreview']=function(_0x3a7d60,_0x4a155a,_0x3f1d11){var _0x1f586b=[];return db[_0xb0aa('0x65')]['describe']()['then'](function(_0x45a45c){_0x1f586b=_['keys'](_0x45a45c);return _0x3a7d60['user'][_0xb0aa('0x6c')]({'where':{'type':_0xb0aa('0x6d'),'dialActive':!![],'dialMethod':_0xb0aa('0x6e')},'attributes':['id',_0xb0aa('0x6f')],'raw':!![]});})[_0xb0aa('0x24')](function(_0x332ffc){if(_0x332ffc&&_0x332ffc[_0xb0aa('0x43')]){return db[_0xb0aa('0x70')][_0xb0aa('0x71')](function(_0x38046c){var _0x287926={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x332ffc,'id')},'$or':[{'UserId':null},{'UserId':_0x3a7d60[_0xb0aa('0x61')]['id']}]};var _0x3f18c4=[];if(_0x3a7d60[_0xb0aa('0x55')][_0xb0aa('0x72')]&&_0x3a7d60[_0xb0aa('0x55')]['direction']===_0xb0aa('0x73')){if(!_[_0xb0aa('0x74')](_0x3a7d60[_0xb0aa('0x55')][_0xb0aa('0x75')])){_0x287926['id']={'$in':_0x3a7d60['body'][_0xb0aa('0x75')]};}_0x3f18c4=[[_0xb0aa('0x76'),'ASC'],['scheduledAt',_0x332ffc[0x0][_0xb0aa('0x6f')]===_0xb0aa('0x77')?_0xb0aa('0x78'):_0xb0aa('0x77')],db[_0xb0aa('0x70')][_0xb0aa('0x79')](_0xb0aa('0x7a')),['id',_0xb0aa('0x78')]];}else{if(!_[_0xb0aa('0x74')](_0x3a7d60[_0xb0aa('0x55')][_0xb0aa('0x75')])){_0x287926['id']={'$notIn':_0x3a7d60['body']['hopperIds']};}_0x3f18c4=[[_0xb0aa('0x76'),_0xb0aa('0x78')],[_0xb0aa('0x7b'),_0x332ffc[0x0]['dialOrderByScheduledAt']],db[_0xb0aa('0x70')]['literal'](_0xb0aa('0x7c')),['id',_0xb0aa('0x77')]];}return db[_0xb0aa('0x2a')][_0xb0aa('0x7d')]({'attributes':['id',_0xb0aa('0x7e')],'where':_0x287926,'order':_0x3f18c4,'transaction':_0x38046c,'lock':_0x38046c['LOCK'][_0xb0aa('0x7f')],'include':[{'model':db[_0xb0aa('0x65')],'as':_0xb0aa('0x80'),'attributes':_0x1f586b,'include':[{'model':db[_0xb0aa('0x81')],'as':_0xb0aa('0x82'),'attributes':['id',_0xb0aa('0x27')]}]},{'model':db[_0xb0aa('0x83')],'as':_0xb0aa('0x84'),'attributes':['id',_0xb0aa('0x27')]},{'model':db[_0xb0aa('0x5a')],'as':_0xb0aa('0x85'),'attributes':['id',_0xb0aa('0x27'),'dialActive']}]})[_0xb0aa('0x24')](function(_0x4f6a0d){if(_0x4f6a0d){return _0x4f6a0d['update']({'UserId':_0x3a7d60[_0xb0aa('0x61')]['id']},{'transaction':_0x38046c});}});});}})[_0xb0aa('0x24')](handleEntityNotFound(_0x4a155a,null))['then'](respondWithResult(_0x4a155a,null))[_0xb0aa('0x52')](handleError(_0x4a155a,null));};exports[_0xb0aa('0x86')]=function(_0x54448b,_0x310712,_0x3c42c9){return _0x54448b[_0xb0aa('0x61')]['getVoiceQueues']({'where':{'type':_0xb0aa('0x6d'),'dialActive':!![],'dialMethod':_0xb0aa('0x6e')},'attributes':['id'],'raw':!![]})['then'](function(_0x3b13f0){if(_0x3b13f0&&_0x3b13f0['length']){return db[_0xb0aa('0x2a')][_0xb0aa('0x1d')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xb0aa('0x87'))},'VoiceQueueId':{'$in':_[_0xb0aa('0x29')](_0x3b13f0,'id')},'$or':[{'UserId':null},{'UserId':_0x54448b[_0xb0aa('0x61')]['id']}]}});}return 0x0;})[_0xb0aa('0x24')](function(_0x57b691){if(!_[_0xb0aa('0x68')](_0x57b691)&&_[_0xb0aa('0x88')](_0x57b691)){return _0x310712['status'](0xc8)[_0xb0aa('0x89')]({'contacts':_0x57b691});}else{logger[_0xb0aa('0x25')](_0xb0aa('0x8a'),_0xb0aa('0x86'),0x194,_0xb0aa('0x8b'));_0x310712['sendStatus'](0x194);}})[_0xb0aa('0x52')](handleError(_0x310712,null));}; \ No newline at end of file +var _0x14fe=['request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','intersection','filters','concat','$and','$gt','$gte','$ne','$not','$between','$in','$notIn','$like','$notLike','$iLike','$overlap','$contained','$any','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','state','statedesc','membername','user','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','sequelize','transaction','direction','hopperIds','priority','ASC','scheduledAt','dialOrderByScheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','COALESCE(CmHopper.UserId,\x200)\x20DESC','Contact','CmCompany','Company','List','Queue','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','zip-dir','fast-json-patch'];(function(_0x4a85a6,_0x2bda1c){var _0x5b7080=function(_0xc4b84e){while(--_0xc4b84e){_0x4a85a6['push'](_0x4a85a6['shift']());}};_0x5b7080(++_0x2bda1c);}(_0x14fe,0x127));var _0xe14f=function(_0x4ae103,_0x48e832){_0x4ae103=_0x4ae103-0x0;var _0x3b97d7=_0x14fe[_0x4ae103];return _0x3b97d7;};'use strict';var emlformat=require(_0xe14f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe14f('0x1'));var jsonpatch=require(_0xe14f('0x2'));var rp=require(_0xe14f('0x3'));var moment=require(_0xe14f('0x4'));var BPromise=require(_0xe14f('0x5'));var Mustache=require(_0xe14f('0x6'));var util=require('util');var path=require(_0xe14f('0x7'));var sox=require(_0xe14f('0x8'));var csv=require(_0xe14f('0x9'));var ejs=require(_0xe14f('0xa'));var fs=require('fs');var fs_extra=require(_0xe14f('0xb'));var _=require('lodash');var squel=require(_0xe14f('0xc'));var crypto=require(_0xe14f('0xd'));var jsforce=require(_0xe14f('0xe'));var deskjs=require(_0xe14f('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe14f('0x10'));var authService=require(_0xe14f('0x11'));var qs=require(_0xe14f('0x12'));var as=require(_0xe14f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe14f('0x14'))(_0xe14f('0x15'));var utils=require(_0xe14f('0x16'));var config=require(_0xe14f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe14f('0x18'))['db'];function respondWithStatusCode(_0x43a7a0,_0x4c01e9){_0x4c01e9=_0x4c01e9||0xcc;return function(_0x5e2ba8){if(_0x5e2ba8){return _0x43a7a0[_0xe14f('0x19')](_0x4c01e9);}return _0x43a7a0['status'](_0x4c01e9)['end']();};}function respondWithResult(_0x48274a,_0x19f883){_0x19f883=_0x19f883||0xc8;return function(_0x37a534){if(_0x37a534){return _0x48274a['status'](_0x19f883)[_0xe14f('0x1a')](_0x37a534);}};}function respondWithFilteredResult(_0x473f62,_0xcfa162){return function(_0x27be34){if(_0x27be34){var _0x4014b9=typeof _0xcfa162[_0xe14f('0x1b')]===_0xe14f('0x1c')&&typeof _0xcfa162[_0xe14f('0x1d')]===_0xe14f('0x1c');var _0x5aa85c=_0x27be34[_0xe14f('0x1e')];var _0x5d534e=_0x4014b9?0x0:_0xcfa162[_0xe14f('0x1b')];var _0x13a738=_0x4014b9?_0x27be34[_0xe14f('0x1e')]:_0xcfa162[_0xe14f('0x1b')]+_0xcfa162[_0xe14f('0x1d')];var _0x18579c;if(_0x13a738>=_0x5aa85c){_0x13a738=_0x5aa85c;_0x18579c=0xc8;}else{_0x18579c=0xce;}_0x473f62[_0xe14f('0x1f')](_0x18579c);return _0x473f62['set'](_0xe14f('0x20'),_0x5d534e+'-'+_0x13a738+'/'+_0x5aa85c)[_0xe14f('0x1a')](_0x27be34);}return null;};}function patchUpdates(_0x7d6fc0){return function(_0x263452){try{jsonpatch[_0xe14f('0x21')](_0x263452,_0x7d6fc0,!![]);}catch(_0xb82d9d){return BPromise[_0xe14f('0x22')](_0xb82d9d);}return _0x263452[_0xe14f('0x23')]();};}function saveUpdates(_0x20702d,_0x134853){return function(_0x369c5e){if(_0x369c5e){return _0x369c5e[_0xe14f('0x24')](_0x20702d)[_0xe14f('0x25')](function(_0x1a2ffa){return _0x1a2ffa;});}return null;};}function removeEntity(_0x18dcdd,_0x2579cc){return function(_0x9fe753){if(_0x9fe753){return _0x9fe753[_0xe14f('0x26')]()['then'](function(){_0x18dcdd['status'](0xcc)[_0xe14f('0x27')]();});}};}function handleEntityNotFound(_0x50b1dd,_0x526e7d){return function(_0x441ca5){if(!_0x441ca5){_0x50b1dd['sendStatus'](0x194);}return _0x441ca5;};}function handleError(_0x4aa8c0,_0x2b6bb6){_0x2b6bb6=_0x2b6bb6||0x1f4;return function(_0x2ff091){logger[_0xe14f('0x28')](_0x2ff091[_0xe14f('0x29')]);if(_0x2ff091[_0xe14f('0x2a')]){delete _0x2ff091['name'];}_0x4aa8c0[_0xe14f('0x1f')](_0x2b6bb6)[_0xe14f('0x2b')](_0x2ff091);};}exports[_0xe14f('0x2c')]=function(_0x4ded8d,_0x4f47c4){var _0x568f54={},_0x38183c={},_0x1248c0={'count':0x0,'rows':[]};var _0x1c15f0=_[_0xe14f('0x2d')](db[_0xe14f('0x2e')][_0xe14f('0x2f')],function(_0xc37d6a){return{'name':_0xc37d6a[_0xe14f('0x30')],'type':_0xc37d6a[_0xe14f('0x31')][_0xe14f('0x32')]};});_0x38183c[_0xe14f('0x33')]=_[_0xe14f('0x2d')](_0x1c15f0,_0xe14f('0x2a'));_0x38183c[_0xe14f('0x34')]=_[_0xe14f('0x35')](_0x4ded8d['query']);_0x38183c['filters']=_[_0xe14f('0x36')](_0x38183c[_0xe14f('0x33')],_0x38183c['query']);_0x38183c[_0xe14f('0x37')]=_[_0xe14f('0x38')](_0x38183c[_0xe14f('0x37')],[_0xe14f('0x39'),'$or',_0xe14f('0x3a'),_0xe14f('0x3b'),'$lt','$lte',_0xe14f('0x3c'),'$eq',_0xe14f('0x3d'),_0xe14f('0x3e'),'$notBetween',_0xe14f('0x3f'),_0xe14f('0x40'),_0xe14f('0x41'),_0xe14f('0x42'),_0xe14f('0x43'),'$notILike','$like',_0xe14f('0x44'),'$contains',_0xe14f('0x45'),_0xe14f('0x46')]);_0x568f54[_0xe14f('0x47')]=_['intersection'](_0x38183c[_0xe14f('0x33')],qs[_0xe14f('0x48')](_0x4ded8d['query']['fields']));_0x568f54[_0xe14f('0x47')]=_0x568f54['attributes']['length']?_0x568f54[_0xe14f('0x47')]:_0x38183c[_0xe14f('0x33')];if(!_0x4ded8d['query'][_0xe14f('0x49')](_0xe14f('0x4a'))){_0x568f54[_0xe14f('0x1d')]=qs[_0xe14f('0x1d')](_0x4ded8d[_0xe14f('0x34')][_0xe14f('0x1d')]);_0x568f54[_0xe14f('0x1b')]=qs['offset'](_0x4ded8d[_0xe14f('0x34')][_0xe14f('0x1b')]);}_0x568f54[_0xe14f('0x4b')]=qs[_0xe14f('0x4c')](_0x4ded8d[_0xe14f('0x34')][_0xe14f('0x4c')]);_0x568f54[_0xe14f('0x4d')]=qs[_0xe14f('0x37')](_['pick'](_0x4ded8d['query'],_0x38183c[_0xe14f('0x37')]),_0x1c15f0);if(_0x4ded8d[_0xe14f('0x34')][_0xe14f('0x4e')]){_0x568f54[_0xe14f('0x4d')]=_[_0xe14f('0x4f')](_0x568f54['where'],{'$or':_[_0xe14f('0x2d')](_0x1c15f0,function(_0x575f1e){if(_0x575f1e[_0xe14f('0x31')]!==_0xe14f('0x50')){var _0x4ff0e5={};_0x4ff0e5[_0x575f1e[_0xe14f('0x2a')]]={'$like':'%'+_0x4ded8d[_0xe14f('0x34')][_0xe14f('0x4e')]+'%'};return _0x4ff0e5;}})});}_0x568f54=_[_0xe14f('0x4f')]({},_0x568f54,_0x4ded8d[_0xe14f('0x51')]);var _0x25a1a6={'where':_0x568f54['where']};return db['CmHopper'][_0xe14f('0x1e')](_0x25a1a6)['then'](function(_0x791e3c){_0x1248c0[_0xe14f('0x1e')]=_0x791e3c;if(_0x4ded8d[_0xe14f('0x34')]['includeAll']){_0x568f54[_0xe14f('0x52')]=[{'all':!![]}];}return db[_0xe14f('0x2e')][_0xe14f('0x53')](_0x568f54);})['then'](function(_0x369a3a){_0x1248c0[_0xe14f('0x54')]=_0x369a3a;return _0x1248c0;})[_0xe14f('0x25')](respondWithFilteredResult(_0x4f47c4,_0x568f54))[_0xe14f('0x55')](handleError(_0x4f47c4,null));};exports[_0xe14f('0x56')]=function(_0x125ce9,_0x1bd459){var _0x38c95a={'raw':!![],'where':{'id':_0x125ce9[_0xe14f('0x57')]['id']}},_0x548e82={};_0x548e82['model']=_['keys'](db[_0xe14f('0x2e')][_0xe14f('0x2f')]);_0x548e82[_0xe14f('0x34')]=_[_0xe14f('0x35')](_0x125ce9[_0xe14f('0x34')]);_0x548e82[_0xe14f('0x37')]=_[_0xe14f('0x36')](_0x548e82[_0xe14f('0x33')],_0x548e82['query']);_0x38c95a[_0xe14f('0x47')]=_['intersection'](_0x548e82[_0xe14f('0x33')],qs['fields'](_0x125ce9[_0xe14f('0x34')][_0xe14f('0x48')]));_0x38c95a[_0xe14f('0x47')]=_0x38c95a[_0xe14f('0x47')][_0xe14f('0x58')]?_0x38c95a[_0xe14f('0x47')]:_0x548e82['model'];if(_0x125ce9[_0xe14f('0x34')][_0xe14f('0x59')]){_0x38c95a[_0xe14f('0x52')]=[{'all':!![]}];}_0x38c95a=_[_0xe14f('0x4f')]({},_0x38c95a,_0x125ce9[_0xe14f('0x51')]);return db[_0xe14f('0x2e')][_0xe14f('0x5a')](_0x38c95a)[_0xe14f('0x25')](handleEntityNotFound(_0x1bd459,null))['then'](respondWithResult(_0x1bd459,null))['catch'](handleError(_0x1bd459,null));};exports[_0xe14f('0x5b')]=function(_0x382c80,_0x34a09f){return db[_0xe14f('0x2e')][_0xe14f('0x5b')](_0x382c80[_0xe14f('0x5c')],{})[_0xe14f('0x25')](respondWithResult(_0x34a09f,0xc9))[_0xe14f('0x55')](handleError(_0x34a09f,null));};exports[_0xe14f('0x24')]=function(_0xaa197a,_0xe999d9){if(_0xaa197a[_0xe14f('0x5c')]['id']){delete _0xaa197a[_0xe14f('0x5c')]['id'];}return db[_0xe14f('0x2e')][_0xe14f('0x5a')]({'where':{'id':_0xaa197a[_0xe14f('0x57')]['id']}})[_0xe14f('0x25')](handleEntityNotFound(_0xe999d9,null))[_0xe14f('0x25')](saveUpdates(_0xaa197a[_0xe14f('0x5c')],null))[_0xe14f('0x25')](respondWithResult(_0xe999d9,null))[_0xe14f('0x55')](handleError(_0xe999d9,null));};exports['describe']=function(_0x3103f1,_0x2b7a67){return db[_0xe14f('0x2e')][_0xe14f('0x5d')]()['then'](respondWithResult(_0x2b7a67,null))['catch'](handleError(_0x2b7a67,null));};exports[_0xe14f('0x26')]=function(_0x56d3d8,_0x3a9e68){var _0x2ce3c5;return db['CmHopper'][_0xe14f('0x5a')]({'where':{'id':_0x56d3d8['params']['id']}})[_0xe14f('0x25')](handleEntityNotFound(_0x3a9e68,null))[_0xe14f('0x25')](function(_0x39bcd0){if(_0x39bcd0){return _0x39bcd0[_0xe14f('0x26')]()['then'](function(_0x218b5f){return _0x218b5f;});}})[_0xe14f('0x25')](function(_0x1954e1){_0x2ce3c5=_0x1954e1;if(_0x1954e1){if(_0x1954e1[_0xe14f('0x5e')]||_0x1954e1[_0xe14f('0x5f')]){return db[_0x1954e1[_0xe14f('0x5e')]?_0xe14f('0x60'):_0xe14f('0x61')]['find']({'where':{'id':_0x1954e1[_0xe14f('0x5e')]?_0x1954e1[_0xe14f('0x5e')]:_0x1954e1[_0xe14f('0x5f')]},'attributes':['id','name'],'raw':!![]});}}})[_0xe14f('0x25')](function(_0x302af1){var _0x3513e8={};if(_0x302af1){_['merge'](_0x3513e8,_[_0xe14f('0x62')](_0x2ce3c5[_0xe14f('0x63')],[_0xe14f('0x64'),'updatedAt','id']));_0x3513e8[_0xe14f('0x65')]=0x15;_0x3513e8[_0xe14f('0x66')]='deleted';_0x3513e8['campaign']=_0x302af1[_0xe14f('0x2a')];_0x3513e8[_0xe14f('0x67')]=_0x56d3d8['user'][_0xe14f('0x2a')];_0x3513e8['UserId']=_0x56d3d8[_0xe14f('0x68')]['id'];_0x3513e8[_0xe14f('0x69')]=!![];_0x3513e8[_0xe14f('0x6a')]=moment()[_0xe14f('0x6b')](_0xe14f('0x6c'));_0x3513e8[_0xe14f('0x6d')]=_0x2ce3c5[_0xe14f('0x6e')];_0x3513e8[_0xe14f('0x6f')]=_0x2ce3c5[_0xe14f('0x5e')]?_0xe14f('0x70'):_0xe14f('0x71');return db[_0xe14f('0x72')][_0xe14f('0x5a')]({'where':{'id':_0x3513e8[_0xe14f('0x73')]},'attributes':[_0xe14f('0x74'),_0xe14f('0x75')]})['then'](function(_0x45d10d){if(!_[_0xe14f('0x76')](_0x3a9e68)&&!_[_0xe14f('0x76')](_0x45d10d[_0xe14f('0x74')])){_0x3513e8[_0xe14f('0x77')]=_0x45d10d['firstName'];if(!_[_0xe14f('0x76')](_0x45d10d[_0xe14f('0x75')])){_0x3513e8[_0xe14f('0x77')]+='\x20'+_0x45d10d[_0xe14f('0x75')];}}})[_0xe14f('0x78')](function(){return db[_0xe14f('0x79')]['create'](_0x3513e8);});}})[_0xe14f('0x25')](function(){return _0x3a9e68[_0xe14f('0x1f')](0xcc)[_0xe14f('0x27')]();})[_0xe14f('0x55')](handleError(_0x3a9e68,null));};exports[_0xe14f('0x7a')]=function(_0x3e5629,_0x15af00,_0x6cb961){var _0x534405=[];return db['CmContact'][_0xe14f('0x5d')]()['then'](function(_0x1a30f9){_0x534405=_[_0xe14f('0x35')](_0x1a30f9);return _0x3e5629['user'][_0xe14f('0x7b')]({'where':{'type':_0xe14f('0x7c'),'dialActive':!![],'dialMethod':_0xe14f('0x7d')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})[_0xe14f('0x25')](function(_0x40c217){if(_0x40c217&&_0x40c217[_0xe14f('0x58')]){return db[_0xe14f('0x7e')][_0xe14f('0x7f')](function(_0x38e37f){var _0xe46c19={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe14f('0x6b')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xe14f('0x2d')](_0x40c217,'id')},'$or':[{'UserId':null},{'UserId':_0x3e5629['user']['id']}]};var _0x44fa45=[];if(_0x3e5629[_0xe14f('0x5c')][_0xe14f('0x80')]&&_0x3e5629['body'][_0xe14f('0x80')]==='prev'){if(!_['isEmpty'](_0x3e5629['body']['hopperIds'])){_0xe46c19['id']={'$in':_0x3e5629[_0xe14f('0x5c')][_0xe14f('0x81')]};}_0x44fa45=[[_0xe14f('0x82'),_0xe14f('0x83')],[_0xe14f('0x84'),_0x40c217[0x0][_0xe14f('0x85')]===_0xe14f('0x83')?_0xe14f('0x86'):_0xe14f('0x83')],db[_0xe14f('0x7e')][_0xe14f('0x87')](_0xe14f('0x88')),['id','DESC']];}else{if(!_[_0xe14f('0x89')](_0x3e5629[_0xe14f('0x5c')]['hopperIds'])){_0xe46c19['id']={'$notIn':_0x3e5629[_0xe14f('0x5c')][_0xe14f('0x81')]};}_0x44fa45=[[_0xe14f('0x82'),_0xe14f('0x86')],[_0xe14f('0x84'),_0x40c217[0x0]['dialOrderByScheduledAt']],db['sequelize'][_0xe14f('0x87')](_0xe14f('0x8a')),['id',_0xe14f('0x83')]];}return db[_0xe14f('0x2e')]['findOne']({'attributes':['id','scheduledat'],'where':_0xe46c19,'order':_0x44fa45,'transaction':_0x38e37f,'lock':_0x38e37f['LOCK']['UPDATE'],'include':[{'model':db[_0xe14f('0x72')],'as':_0xe14f('0x8b'),'attributes':_0x534405,'include':[{'model':db[_0xe14f('0x8c')],'as':_0xe14f('0x8d'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0xe14f('0x8e'),'attributes':['id',_0xe14f('0x2a')]},{'model':db['VoiceQueue'],'as':_0xe14f('0x8f'),'attributes':['id','name',_0xe14f('0x90')]}]})[_0xe14f('0x25')](function(_0x240bc4){if(_0x240bc4){return _0x240bc4['update']({'UserId':_0x3e5629[_0xe14f('0x68')]['id']},{'transaction':_0x38e37f});}});});}})['then'](handleEntityNotFound(_0x15af00,null))[_0xe14f('0x25')](respondWithResult(_0x15af00,null))[_0xe14f('0x55')](handleError(_0x15af00,null));};exports[_0xe14f('0x91')]=function(_0x3a3dfc,_0xfc48f2,_0x514e26){return _0x3a3dfc['user'][_0xe14f('0x7b')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})['then'](function(_0x286ef8){if(_0x286ef8&&_0x286ef8['length']){return db[_0xe14f('0x2e')][_0xe14f('0x1e')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xe14f('0x6c'))},'VoiceQueueId':{'$in':_['map'](_0x286ef8,'id')},'$or':[{'UserId':null},{'UserId':_0x3a3dfc[_0xe14f('0x68')]['id']}]}});}return 0x0;})[_0xe14f('0x25')](function(_0x3702ca){if(!_[_0xe14f('0x76')](_0x3702ca)&&_[_0xe14f('0x92')](_0x3702ca)){return _0xfc48f2[_0xe14f('0x1f')](0xc8)[_0xe14f('0x1a')]({'contacts':_0x3702ca});}else{logger['error'](_0xe14f('0x93'),_0xe14f('0x91'),0x194,_0xe14f('0x94'));_0xfc48f2[_0xe14f('0x19')](0x194);}})[_0xe14f('0x55')](handleError(_0xfc48f2,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 7a8b5f9..fd2d068 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 _0x687b=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x687b,0x14a));var _0xb687=function(_0x233811,_0x1283e9){_0x233811=_0x233811-0x0;var _0x292f41=_0x687b[_0x233811];return _0x292f41;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));module[_0xb687('0x9')]=function(_0x16ccf3,_0xf43a1f){return _0x16ccf3[_0xb687('0xa')](_0xb687('0xb'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xb687('0xc'),'fields':[_0xb687('0xc')]},{'name':'phone','fields':[_0xb687('0xd')]},{'name':_0xb687('0xe'),'fields':[_0xb687('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes'];(function(_0x27e811,_0x1fad22){var _0x1bfe61=function(_0x2d8d02){while(--_0x2d8d02){_0x27e811['push'](_0x27e811['shift']());}};_0x1bfe61(++_0x1fad22);}(_0x4975,0x86));var _0x5497=function(_0x5c8d32,_0x1b27c8){_0x5c8d32=_0x5c8d32-0x0;var _0x46d132=_0x4975[_0x5c8d32];return _0x46d132;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['scheduledat']},{'name':_0x5497('0xe'),'fields':['phone']},{'name':_0x5497('0xf'),'fields':[_0x5497('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 86e7583..d8428b4 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 _0xb125=['transaction','findAll','order','LOCK','Contact','keys','User','Agent','name','voicePause','length','UserId','includes','push','all','MoveContactManagedDialer','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','UPDATE','GetCmHopperPreview','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','message','CmHopper,\x20%s,\x20%s','result','catch','GetCmHopper','CmHopper','options','raw','where','limit','include','map','model','attributes','then','debug','find','ShowCmHopper','create','body','CreateCmHopper','update','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','sequelize'];(function(_0x3e4db1,_0x385cd6){var _0x33ecd5=function(_0x1213ad){while(--_0x1213ad){_0x3e4db1['push'](_0x3e4db1['shift']());}};_0x33ecd5(++_0x385cd6);}(_0xb125,0xf3));var _0x5b12=function(_0x282146,_0x2e01b6){_0x282146=_0x282146-0x0;var _0x1e8b80=_0xb125[_0x282146];return _0x1e8b80;};'use strict';var _=require('lodash');var util=require(_0x5b12('0x0'));var moment=require(_0x5b12('0x1'));var BPromise=require('bluebird');var rs=require(_0x5b12('0x2'));var fs=require('fs');var Redis=require(_0x5b12('0x3'));var db=require(_0x5b12('0x4'))['db'];var utils=require(_0x5b12('0x5'));var logger=require(_0x5b12('0x6'))(_0x5b12('0x7'));var config=require('../../config/environment');var jayson=require(_0x5b12('0x8'));var client=jayson[_0x5b12('0x9')][_0x5b12('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c9d5e,_0x35546e,_0xa73a56){return new BPromise(function(_0x3e9c06,_0x2b5fe6){return client[_0x5b12('0xb')](_0x1c9d5e,_0xa73a56)['then'](function(_0x1bc2e1){logger[_0x5b12('0xc')]('CmHopper,\x20%s,\x20%s',_0x35546e,_0x5b12('0xd'));logger['debug'](_0x5b12('0xe'),_0x35546e,_0x5b12('0xd'),JSON[_0x5b12('0xf')](_0x1bc2e1));if(_0x1bc2e1['error']){if(_0x1bc2e1[_0x5b12('0x10')]['code']===0x1f4){logger['error']('CmHopper,\x20%s,\x20%s',_0x35546e,_0x1bc2e1['error']['message']);return _0x2b5fe6(_0x1bc2e1[_0x5b12('0x10')][_0x5b12('0x11')]);}logger[_0x5b12('0x10')](_0x5b12('0x12'),_0x35546e,_0x1bc2e1[_0x5b12('0x10')]['message']);return _0x3e9c06(_0x1bc2e1['error']['message']);}else{logger[_0x5b12('0xc')](_0x5b12('0x12'),_0x35546e,_0x5b12('0xd'));_0x3e9c06(_0x1bc2e1[_0x5b12('0x13')][_0x5b12('0x11')]);}})[_0x5b12('0x14')](function(_0xe3453d){logger['error'](_0x5b12('0x12'),_0x35546e,_0xe3453d);_0x2b5fe6(_0xe3453d);});});}exports[_0x5b12('0x15')]=function(_0x2cf908){var _0x8ea82c=this;return new Promise(function(_0xf486f6,_0x2b876e){return db[_0x5b12('0x16')]['findAll']({'raw':_0x2cf908[_0x5b12('0x17')]?_0x2cf908[_0x5b12('0x17')][_0x5b12('0x18')]===undefined?!![]:![]:!![],'where':_0x2cf908[_0x5b12('0x17')]?_0x2cf908[_0x5b12('0x17')][_0x5b12('0x19')]||null:null,'attributes':_0x2cf908[_0x5b12('0x17')]?_0x2cf908[_0x5b12('0x17')]['attributes']||null:null,'limit':_0x2cf908[_0x5b12('0x17')]?_0x2cf908[_0x5b12('0x17')][_0x5b12('0x1a')]||null:null,'include':_0x2cf908[_0x5b12('0x17')]?_0x2cf908[_0x5b12('0x17')][_0x5b12('0x1b')]?_[_0x5b12('0x1c')](_0x2cf908[_0x5b12('0x17')][_0x5b12('0x1b')],function(_0x505d9c){return{'model':db[_0x505d9c[_0x5b12('0x1d')]],'as':_0x505d9c['as'],'attributes':_0x505d9c[_0x5b12('0x1e')],'include':_0x505d9c['include']?_['map'](_0x505d9c[_0x5b12('0x1b')],function(_0x116d84){return{'model':db[_0x116d84[_0x5b12('0x1d')]],'as':_0x116d84['as'],'attributes':_0x116d84['attributes'],'include':_0x116d84[_0x5b12('0x1b')]?_[_0x5b12('0x1c')](_0x116d84['include'],function(_0x55285e){return{'model':db[_0x55285e['model']],'as':_0x55285e['as'],'attributes':_0x55285e[_0x5b12('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5b12('0x1f')](function(_0x57a5d2){logger['info'](_0x5b12('0x15'),_0x2cf908);logger[_0x5b12('0x20')](_0x5b12('0x15'),_0x2cf908,JSON[_0x5b12('0xf')](_0x57a5d2));_0xf486f6(_0x57a5d2);})[_0x5b12('0x14')](function(_0x4ddbbb){logger[_0x5b12('0x10')]('GetCmHopper',_0x4ddbbb[_0x5b12('0x11')],_0x2cf908);_0x2b876e(_0x8ea82c['error'](0x1f4,_0x4ddbbb[_0x5b12('0x11')]));});});};exports['ShowCmHopper']=function(_0x166fae){var _0x3fa5ea=this;return new Promise(function(_0x5e30ef,_0x453f96){return db[_0x5b12('0x16')][_0x5b12('0x21')]({'raw':_0x166fae['options']?_0x166fae[_0x5b12('0x17')][_0x5b12('0x18')]===undefined?!![]:![]:!![],'where':_0x166fae[_0x5b12('0x17')]?_0x166fae[_0x5b12('0x17')][_0x5b12('0x19')]||null:null,'attributes':_0x166fae[_0x5b12('0x17')]?_0x166fae[_0x5b12('0x17')]['attributes']||null:null,'include':_0x166fae[_0x5b12('0x17')]?_0x166fae[_0x5b12('0x17')][_0x5b12('0x1b')]?_[_0x5b12('0x1c')](_0x166fae[_0x5b12('0x17')][_0x5b12('0x1b')],function(_0xd56215){return{'model':db[_0xd56215[_0x5b12('0x1d')]],'as':_0xd56215['as'],'attributes':_0xd56215[_0x5b12('0x1e')],'include':_0xd56215[_0x5b12('0x1b')]?_[_0x5b12('0x1c')](_0xd56215['include'],function(_0x3bbd85){return{'model':db[_0x3bbd85['model']],'as':_0x3bbd85['as'],'attributes':_0x3bbd85[_0x5b12('0x1e')],'include':_0x3bbd85[_0x5b12('0x1b')]?_[_0x5b12('0x1c')](_0x3bbd85[_0x5b12('0x1b')],function(_0x56f4c2){return{'model':db[_0x56f4c2[_0x5b12('0x1d')]],'as':_0x56f4c2['as'],'attributes':_0x56f4c2[_0x5b12('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41a307){logger[_0x5b12('0xc')](_0x5b12('0x22'),_0x166fae);logger['debug'](_0x5b12('0x22'),_0x166fae,JSON['stringify'](_0x41a307));_0x5e30ef(_0x41a307);})['catch'](function(_0x2ad7d5){logger[_0x5b12('0x10')](_0x5b12('0x22'),_0x2ad7d5['message'],_0x166fae);_0x453f96(_0x3fa5ea[_0x5b12('0x10')](0x1f4,_0x2ad7d5['message']));});});};exports['CreateCmHopper']=function(_0x1e586d){var _0x3a3f80=this;return new Promise(function(_0x52368e,_0x3e42c1){return db['CmHopper'][_0x5b12('0x23')](_0x1e586d[_0x5b12('0x24')],{'raw':_0x1e586d['options']?_0x1e586d[_0x5b12('0x17')][_0x5b12('0x18')]===undefined?!![]:![]:!![]})[_0x5b12('0x1f')](function(_0x2b057b){logger[_0x5b12('0xc')](_0x5b12('0x25'),_0x1e586d);logger[_0x5b12('0x20')](_0x5b12('0x25'),_0x1e586d,JSON['stringify'](_0x2b057b));_0x52368e(_0x2b057b);})[_0x5b12('0x14')](function(_0x37365a){logger['error'](_0x5b12('0x25'),_0x37365a['message'],_0x1e586d);_0x3e42c1(_0x3a3f80['error'](0x1f4,_0x37365a[_0x5b12('0x11')]));});});};exports['UpdateCmHopper']=function(_0x43c23b){var _0x48f0af=this;return new Promise(function(_0x5159cf,_0x17aec9){return db['CmHopper'][_0x5b12('0x26')](_0x43c23b[_0x5b12('0x24')],{'raw':_0x43c23b[_0x5b12('0x17')]?_0x43c23b['options'][_0x5b12('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43c23b['options']?_0x43c23b[_0x5b12('0x17')][_0x5b12('0x19')]||null:null,'attributes':_0x43c23b[_0x5b12('0x17')]?_0x43c23b[_0x5b12('0x17')][_0x5b12('0x1e')]||null:null,'limit':_0x43c23b[_0x5b12('0x17')]?_0x43c23b[_0x5b12('0x17')][_0x5b12('0x1a')]||null:null})['then'](function(_0x5643e0){logger[_0x5b12('0xc')](_0x5b12('0x27'),_0x43c23b);logger[_0x5b12('0x20')](_0x5b12('0x27'),_0x43c23b,JSON[_0x5b12('0xf')](_0x5643e0));_0x5159cf(_0x5643e0);})[_0x5b12('0x14')](function(_0x9fc449){logger[_0x5b12('0x10')](_0x5b12('0x27'),_0x9fc449[_0x5b12('0x11')],_0x43c23b);_0x17aec9(_0x48f0af[_0x5b12('0x10')](0x1f4,_0x9fc449[_0x5b12('0x11')]));});});};exports[_0x5b12('0x28')]=function(_0x23fde9){var _0x26aaba=this;return new Promise(function(_0x1e7a9d,_0x24cad9){return db[_0x5b12('0x16')][_0x5b12('0x29')]({'where':_0x23fde9['options']?_0x23fde9[_0x5b12('0x17')][_0x5b12('0x19')]||null:null})[_0x5b12('0x1f')](function(_0xdc0782){logger['info'](_0x5b12('0x28'),_0x23fde9);logger['debug'](_0x5b12('0x28'),_0x23fde9,JSON[_0x5b12('0xf')](_0xdc0782));_0x1e7a9d(_0xdc0782);})[_0x5b12('0x14')](function(_0x42f491){logger[_0x5b12('0x10')](_0x5b12('0x28'),_0x42f491['message'],_0x23fde9);_0x24cad9(_0x26aaba[_0x5b12('0x10')](0x1f4,_0x42f491[_0x5b12('0x11')]));});});};exports[_0x5b12('0x2a')]=function(_0x1463a3){var _0x388f36=this;return new Promise(function(_0x408935,_0x3edad1){return db[_0x5b12('0x2b')]['describe']()[_0x5b12('0x1f')](function(_0x495e76){return db[_0x5b12('0x2c')][_0x5b12('0x2d')](function(_0x2ec740){return db[_0x5b12('0x16')][_0x5b12('0x2e')]({'where':_0x1463a3['options']?_0x1463a3['options'][_0x5b12('0x19')]||null:null,'attributes':_0x1463a3['options']?_0x1463a3[_0x5b12('0x17')][_0x5b12('0x1e')]||null:null,'limit':_0x1463a3[_0x5b12('0x17')]?_0x1463a3['options'][_0x5b12('0x1a')]||null:null,'order':_0x1463a3[_0x5b12('0x17')]?_0x1463a3[_0x5b12('0x17')][_0x5b12('0x2f')]||null:null,'transaction':_0x2ec740,'lock':_0x2ec740[_0x5b12('0x30')]['UPDATE'],'include':[{'model':db[_0x5b12('0x2b')],'as':_0x5b12('0x31'),'attributes':_[_0x5b12('0x32')](_0x495e76)},{'model':db[_0x5b12('0x33')],'as':_0x5b12('0x34'),'attributes':['id',_0x5b12('0x35'),_0x5b12('0x36')]}]})[_0x5b12('0x1f')](function(_0x50b42e){var _0xc72342=[];var _0x12446e=[];for(var _0xb9520e=0x0;_0xb9520e<_0x50b42e[_0x5b12('0x37')];_0xb9520e+=0x1){var _0xbcc37a=_0x50b42e[_0xb9520e][_0x5b12('0x38')];if(_0xbcc37a===null){_0xc72342['push'](_0x50b42e[_0xb9520e][_0x5b12('0x26')](_0x1463a3[_0x5b12('0x24')],{'transaction':_0x2ec740}));}else if(!_0x12446e[_0x5b12('0x39')](_0xbcc37a)){_0x12446e[_0x5b12('0x3a')](_0xbcc37a);_0xc72342[_0x5b12('0x3a')](_0x50b42e[_0xb9520e][_0x5b12('0x26')](_0x1463a3[_0x5b12('0x24')],{'transaction':_0x2ec740}));}}return BPromise[_0x5b12('0x3b')](_0xc72342);});})[_0x5b12('0x1f')](function(_0xb4c4b9){logger[_0x5b12('0xc')](_0x5b12('0x2a'),_0x1463a3);logger[_0x5b12('0x20')]('GetContactDialer',_0x1463a3,JSON[_0x5b12('0xf')](_0xb4c4b9));_0x408935(_0xb4c4b9);})[_0x5b12('0x14')](function(_0x45a9cf){logger[_0x5b12('0x10')](_0x5b12('0x2a'),_0x45a9cf[_0x5b12('0x11')],_0x1463a3);_0x3edad1(_0x388f36[_0x5b12('0x10')](0x1f4,_0x45a9cf[_0x5b12('0x11')]));});});});};exports[_0x5b12('0x3c')]=function(_0x171ace){var _0x469fce=this;return new Promise(function(_0x4adfcf,_0x6e4022){return db[_0x5b12('0x2c')]['transaction'](function(_0x55f018){return db['CmHopperFinal'][_0x5b12('0x23')](_0x171ace[_0x5b12('0x24')],{'raw':_0x171ace['options']?_0x171ace[_0x5b12('0x17')][_0x5b12('0x18')]===undefined?!![]:![]:!![],'transaction':_0x55f018})[_0x5b12('0x1f')](function(){return db[_0x5b12('0x16')][_0x5b12('0x29')]({'where':_0x171ace[_0x5b12('0x17')]?_0x171ace[_0x5b12('0x17')][_0x5b12('0x19')]||null:null,'transaction':_0x55f018});});})[_0x5b12('0x1f')](function(_0x2ee5d1){logger[_0x5b12('0xc')]('MoveContactManagedDialer',_0x171ace);logger[_0x5b12('0x20')](_0x5b12('0x3c'),_0x171ace,JSON[_0x5b12('0xf')](_0x2ee5d1));_0x4adfcf(_0x2ee5d1);})['catch'](function(_0x35e154){logger[_0x5b12('0x10')]('MoveContactManagedDialer',_0x35e154[_0x5b12('0x11')],_0x171ace);_0x6e4022(_0x469fce[_0x5b12('0x10')](0x1f4,_0x35e154[_0x5b12('0x11')]));});});};exports['CountReScheduled']=function(_0x45ffd7){var _0x4c58b1=this;return new Promise(function(_0x34f17e,_0x4aca60){return db[_0x5b12('0x16')][_0x5b12('0x2e')]({'raw':_0x45ffd7[_0x5b12('0x17')]?_0x45ffd7[_0x5b12('0x17')][_0x5b12('0x18')]===undefined?!![]:![]:!![],'where':_0x45ffd7['options']?_0x45ffd7[_0x5b12('0x17')]['where']||null:null,'attributes':[[db[_0x5b12('0x2c')]['fn'](_0x5b12('0x3d'),db[_0x5b12('0x2c')]['fn']('IF',db[_0x5b12('0x2c')][_0x5b12('0x3e')](_0x5b12('0x3f')+util[_0x5b12('0x40')]('\x22%s\x22',moment()[_0x5b12('0x40')](_0x5b12('0x41')))+_0x5b12('0x42')))),_0x5b12('0x43')]]})['then'](function(_0x1afe96){logger[_0x5b12('0xc')](_0x5b12('0x44'),_0x45ffd7);logger[_0x5b12('0x20')](_0x5b12('0x44'),_0x45ffd7,JSON[_0x5b12('0xf')](_0x1afe96));_0x34f17e(_0x1afe96);})['catch'](function(_0x2ab9c5){logger[_0x5b12('0x10')]('CountReScheduled',_0x2ab9c5[_0x5b12('0x11')],_0x45ffd7);_0x4aca60(_0x4c58b1[_0x5b12('0x10')](0x1f4,_0x2ab9c5[_0x5b12('0x11')]));});});};exports[_0x5b12('0x45')]=function(_0x4ff719){var _0x24c3fe=this;return new Promise(function(_0x436c41,_0x2eeb34){return db[_0x5b12('0x2b')]['describe']()[_0x5b12('0x1f')](function(_0x27467f){return db[_0x5b12('0x2c')][_0x5b12('0x2d')](function(_0x58c045){return db[_0x5b12('0x16')][_0x5b12('0x2e')]({'where':_0x4ff719[_0x5b12('0x17')]?_0x4ff719[_0x5b12('0x17')][_0x5b12('0x19')]||null:null,'attributes':_0x4ff719[_0x5b12('0x17')]?_0x4ff719['options'][_0x5b12('0x1e')]||null:null,'limit':0x1,'order':_0x4ff719[_0x5b12('0x17')]?_0x4ff719[_0x5b12('0x17')]['order']||null:null,'group':db[_0x5b12('0x16')][_0x5b12('0x38')],'transaction':_0x58c045,'lock':_0x58c045[_0x5b12('0x30')][_0x5b12('0x46')],'include':_0x4ff719[_0x5b12('0x17')]?_0x4ff719[_0x5b12('0x17')][_0x5b12('0x1b')]?_['map'](_0x4ff719[_0x5b12('0x17')]['include'],function(_0x551ace){return{'model':db[_0x551ace[_0x5b12('0x1d')]],'as':_0x551ace['as'],'attributes':_0x551ace[_0x5b12('0x1e')],'include':_0x551ace[_0x5b12('0x1b')]?_[_0x5b12('0x1c')](_0x551ace[_0x5b12('0x1b')],function(_0x456035){return{'model':db[_0x456035['model']],'as':_0x456035['as'],'attributes':_0x456035[_0x5b12('0x1e')],'include':_0x456035[_0x5b12('0x1b')]?_[_0x5b12('0x1c')](_0x456035[_0x5b12('0x1b')],function(_0x47f175){return{'model':db[_0x47f175['model']],'as':_0x47f175['as'],'attributes':_0x47f175[_0x5b12('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5b12('0x1f')](function(_0x39ea0e){var _0x442baa=[];for(var _0x12d45d=0x0;_0x12d45d<_0x39ea0e[_0x5b12('0x37')];_0x12d45d+=0x1){_0x442baa[_0x5b12('0x3a')](_0x39ea0e[_0x12d45d][_0x5b12('0x26')](_0x4ff719[_0x5b12('0x24')],{'transaction':_0x58c045}));}return BPromise[_0x5b12('0x3b')](_0x442baa);});})['then'](function(_0x28feb1){logger['info'](_0x5b12('0x45'),_0x4ff719);logger[_0x5b12('0x20')]('GetContactRecallMe',_0x4ff719,JSON['stringify'](_0x28feb1));_0x436c41(_0x28feb1);})['catch'](function(_0x1e0763){logger[_0x5b12('0x10')](_0x5b12('0x45'),_0x1e0763[_0x5b12('0x11')],_0x4ff719);_0x2eeb34(_0x24c3fe[_0x5b12('0x10')](0x1f4,_0x1e0763[_0x5b12('0x11')]));});});});};exports[_0x5b12('0x47')]=function(_0x361617){var _0x6c92f9=this;return new Promise(function(_0x441844,_0x5ec51c){db[_0x5b12('0x2b')]['describe']()[_0x5b12('0x1f')](function(_0x566acb){return db[_0x5b12('0x16')][_0x5b12('0x2e')]({'raw':_0x361617[_0x5b12('0x17')]?_0x361617[_0x5b12('0x17')][_0x5b12('0x18')]===undefined?!![]:![]:!![],'where':_0x361617[_0x5b12('0x17')]?_0x361617[_0x5b12('0x17')][_0x5b12('0x19')]||null:null,'attributes':_0x361617['options']?_0x361617[_0x5b12('0x17')][_0x5b12('0x1e')]||null:null,'limit':_0x361617[_0x5b12('0x17')]?_0x361617['options'][_0x5b12('0x1a')]||null:null,'include':_0x361617[_0x5b12('0x17')]?_0x361617[_0x5b12('0x17')][_0x5b12('0x1b')]?_['map'](_0x361617[_0x5b12('0x17')][_0x5b12('0x1b')],function(_0xbd6c7a){return{'model':db[_0xbd6c7a[_0x5b12('0x1d')]],'as':_0xbd6c7a['as'],'attributes':_0xbd6c7a['as']==='Contact'?_['keys'](_0x566acb):_0xbd6c7a[_0x5b12('0x1e')],'include':_0xbd6c7a[_0x5b12('0x1b')]?_['map'](_0xbd6c7a[_0x5b12('0x1b')],function(_0x56bea8){return{'model':db[_0x56bea8[_0x5b12('0x1d')]],'as':_0x56bea8['as'],'attributes':_0x56bea8[_0x5b12('0x1e')],'include':_0x56bea8[_0x5b12('0x1b')]?_[_0x5b12('0x1c')](_0x56bea8[_0x5b12('0x1b')],function(_0x3cc5d4){return{'model':db[_0x3cc5d4['model']],'as':_0x3cc5d4['as'],'attributes':_0x3cc5d4[_0x5b12('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5b12('0x1f')](function(_0x3fd90e){logger['info'](_0x5b12('0x15'),_0x361617);logger[_0x5b12('0x20')](_0x5b12('0x15'),_0x361617,JSON[_0x5b12('0xf')](_0x3fd90e));_0x441844(_0x3fd90e);})[_0x5b12('0x14')](function(_0x1548f0){logger[_0x5b12('0x10')](_0x5b12('0x15'),_0x1548f0['message'],_0x361617);_0x5ec51c(_0x6c92f9[_0x5b12('0x10')](0x1f4,_0x1548f0[_0x5b12('0x11')]));});});});}; \ No newline at end of file +var _0xf657=['result','GetCmHopper','CmHopper','findAll','options','where','attributes','limit','model','include','map','debug','catch','ShowCmHopper','find','raw','CreateCmHopper','create','info','update','UpdateCmHopper','DestroyCmHopper','CmContact','describe','sequelize','transaction','UPDATE','Contact','User','Agent','name','voicePause','UserId','push','includes','body','all','GetContactDialer','MoveContactManagedDialer','CmHopperFinal','destroy','CountReScheduled','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','order','LOCK','length','GetContactRecallMe','GetCmHopperPreview','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','CmHopper,\x20%s,\x20%s','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x946518,_0x22816f){var _0x909b69=function(_0x2fa5a4){while(--_0x2fa5a4){_0x946518['push'](_0x946518['shift']());}};_0x909b69(++_0x22816f);}(_0xf657,0x198));var _0x7f65=function(_0x46930a,_0x3f0799){_0x46930a=_0x46930a-0x0;var _0xebe0d8=_0xf657[_0x46930a];return _0xebe0d8;};'use strict';var _=require('lodash');var util=require(_0x7f65('0x0'));var moment=require('moment');var BPromise=require(_0x7f65('0x1'));var rs=require(_0x7f65('0x2'));var fs=require('fs');var Redis=require(_0x7f65('0x3'));var db=require(_0x7f65('0x4'))['db'];var utils=require(_0x7f65('0x5'));var logger=require(_0x7f65('0x6'))(_0x7f65('0x7'));var config=require(_0x7f65('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7f65('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x66b0ad,_0x5f3d59,_0x430f8e){return new BPromise(function(_0x29e792,_0x11e474){return client['request'](_0x66b0ad,_0x430f8e)[_0x7f65('0xa')](function(_0x5312ec){logger['info'](_0x7f65('0xb'),_0x5f3d59,'request\x20sent');logger['debug'](_0x7f65('0xc'),_0x5f3d59,_0x7f65('0xd'),JSON[_0x7f65('0xe')](_0x5312ec));if(_0x5312ec[_0x7f65('0xf')]){if(_0x5312ec[_0x7f65('0xf')][_0x7f65('0x10')]===0x1f4){logger['error'](_0x7f65('0xb'),_0x5f3d59,_0x5312ec[_0x7f65('0xf')][_0x7f65('0x11')]);return _0x11e474(_0x5312ec['error'][_0x7f65('0x11')]);}logger[_0x7f65('0xf')](_0x7f65('0xb'),_0x5f3d59,_0x5312ec[_0x7f65('0xf')]['message']);return _0x29e792(_0x5312ec['error']['message']);}else{logger['info']('CmHopper,\x20%s,\x20%s',_0x5f3d59,_0x7f65('0xd'));_0x29e792(_0x5312ec[_0x7f65('0x12')][_0x7f65('0x11')]);}})['catch'](function(_0x20332c){logger[_0x7f65('0xf')](_0x7f65('0xb'),_0x5f3d59,_0x20332c);_0x11e474(_0x20332c);});});}exports[_0x7f65('0x13')]=function(_0x321b13){var _0x5a02a1=this;return new Promise(function(_0xacf3ba,_0x30177c){return db[_0x7f65('0x14')][_0x7f65('0x15')]({'raw':_0x321b13[_0x7f65('0x16')]?_0x321b13[_0x7f65('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x321b13[_0x7f65('0x16')]?_0x321b13[_0x7f65('0x16')][_0x7f65('0x17')]||null:null,'attributes':_0x321b13[_0x7f65('0x16')]?_0x321b13[_0x7f65('0x16')][_0x7f65('0x18')]||null:null,'limit':_0x321b13[_0x7f65('0x16')]?_0x321b13[_0x7f65('0x16')][_0x7f65('0x19')]||null:null,'include':_0x321b13['options']?_0x321b13[_0x7f65('0x16')]['include']?_['map'](_0x321b13[_0x7f65('0x16')]['include'],function(_0x2b2369){return{'model':db[_0x2b2369[_0x7f65('0x1a')]],'as':_0x2b2369['as'],'attributes':_0x2b2369['attributes'],'include':_0x2b2369[_0x7f65('0x1b')]?_[_0x7f65('0x1c')](_0x2b2369[_0x7f65('0x1b')],function(_0x1eac92){return{'model':db[_0x1eac92[_0x7f65('0x1a')]],'as':_0x1eac92['as'],'attributes':_0x1eac92[_0x7f65('0x18')],'include':_0x1eac92['include']?_['map'](_0x1eac92[_0x7f65('0x1b')],function(_0x39dff8){return{'model':db[_0x39dff8[_0x7f65('0x1a')]],'as':_0x39dff8['as'],'attributes':_0x39dff8[_0x7f65('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7f65('0xa')](function(_0x3dde57){logger['info'](_0x7f65('0x13'),_0x321b13);logger[_0x7f65('0x1d')](_0x7f65('0x13'),_0x321b13,JSON[_0x7f65('0xe')](_0x3dde57));_0xacf3ba(_0x3dde57);})[_0x7f65('0x1e')](function(_0xca2130){logger[_0x7f65('0xf')](_0x7f65('0x13'),_0xca2130['message'],_0x321b13);_0x30177c(_0x5a02a1[_0x7f65('0xf')](0x1f4,_0xca2130[_0x7f65('0x11')]));});});};exports[_0x7f65('0x1f')]=function(_0x4e42d4){var _0x47c3a7=this;return new Promise(function(_0x1387db,_0x3f2ea7){return db['CmHopper'][_0x7f65('0x20')]({'raw':_0x4e42d4[_0x7f65('0x16')]?_0x4e42d4['options'][_0x7f65('0x21')]===undefined?!![]:![]:!![],'where':_0x4e42d4[_0x7f65('0x16')]?_0x4e42d4[_0x7f65('0x16')][_0x7f65('0x17')]||null:null,'attributes':_0x4e42d4['options']?_0x4e42d4[_0x7f65('0x16')]['attributes']||null:null,'include':_0x4e42d4[_0x7f65('0x16')]?_0x4e42d4[_0x7f65('0x16')][_0x7f65('0x1b')]?_[_0x7f65('0x1c')](_0x4e42d4[_0x7f65('0x16')][_0x7f65('0x1b')],function(_0x5ad6dc){return{'model':db[_0x5ad6dc[_0x7f65('0x1a')]],'as':_0x5ad6dc['as'],'attributes':_0x5ad6dc[_0x7f65('0x18')],'include':_0x5ad6dc['include']?_[_0x7f65('0x1c')](_0x5ad6dc['include'],function(_0x1675af){return{'model':db[_0x1675af[_0x7f65('0x1a')]],'as':_0x1675af['as'],'attributes':_0x1675af[_0x7f65('0x18')],'include':_0x1675af['include']?_[_0x7f65('0x1c')](_0x1675af['include'],function(_0x130d4d){return{'model':db[_0x130d4d['model']],'as':_0x130d4d['as'],'attributes':_0x130d4d[_0x7f65('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7f65('0xa')](function(_0x5888f4){logger['info']('ShowCmHopper',_0x4e42d4);logger[_0x7f65('0x1d')](_0x7f65('0x1f'),_0x4e42d4,JSON['stringify'](_0x5888f4));_0x1387db(_0x5888f4);})[_0x7f65('0x1e')](function(_0x34d30b){logger[_0x7f65('0xf')](_0x7f65('0x1f'),_0x34d30b['message'],_0x4e42d4);_0x3f2ea7(_0x47c3a7[_0x7f65('0xf')](0x1f4,_0x34d30b[_0x7f65('0x11')]));});});};exports[_0x7f65('0x22')]=function(_0x371847){var _0x5013c6=this;return new Promise(function(_0x2f0348,_0x187a17){return db[_0x7f65('0x14')][_0x7f65('0x23')](_0x371847['body'],{'raw':_0x371847['options']?_0x371847['options'][_0x7f65('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x40b283){logger[_0x7f65('0x24')](_0x7f65('0x22'),_0x371847);logger[_0x7f65('0x1d')](_0x7f65('0x22'),_0x371847,JSON[_0x7f65('0xe')](_0x40b283));_0x2f0348(_0x40b283);})[_0x7f65('0x1e')](function(_0x565b96){logger[_0x7f65('0xf')](_0x7f65('0x22'),_0x565b96['message'],_0x371847);_0x187a17(_0x5013c6['error'](0x1f4,_0x565b96['message']));});});};exports['UpdateCmHopper']=function(_0x16812f){var _0x2e26bc=this;return new Promise(function(_0x2b7c4c,_0x2ec18d){return db['CmHopper'][_0x7f65('0x25')](_0x16812f['body'],{'raw':_0x16812f[_0x7f65('0x16')]?_0x16812f['options'][_0x7f65('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16812f[_0x7f65('0x16')]?_0x16812f[_0x7f65('0x16')][_0x7f65('0x17')]||null:null,'attributes':_0x16812f[_0x7f65('0x16')]?_0x16812f[_0x7f65('0x16')][_0x7f65('0x18')]||null:null,'limit':_0x16812f['options']?_0x16812f[_0x7f65('0x16')][_0x7f65('0x19')]||null:null})[_0x7f65('0xa')](function(_0x11975e){logger[_0x7f65('0x24')](_0x7f65('0x26'),_0x16812f);logger[_0x7f65('0x1d')](_0x7f65('0x26'),_0x16812f,JSON['stringify'](_0x11975e));_0x2b7c4c(_0x11975e);})[_0x7f65('0x1e')](function(_0x4157d4){logger[_0x7f65('0xf')](_0x7f65('0x26'),_0x4157d4[_0x7f65('0x11')],_0x16812f);_0x2ec18d(_0x2e26bc[_0x7f65('0xf')](0x1f4,_0x4157d4[_0x7f65('0x11')]));});});};exports[_0x7f65('0x27')]=function(_0x175d9d){var _0x3e97a7=this;return new Promise(function(_0x593211,_0x4f311d){return db[_0x7f65('0x14')]['destroy']({'where':_0x175d9d['options']?_0x175d9d[_0x7f65('0x16')][_0x7f65('0x17')]||null:null})['then'](function(_0x26798b){logger[_0x7f65('0x24')](_0x7f65('0x27'),_0x175d9d);logger['debug'](_0x7f65('0x27'),_0x175d9d,JSON['stringify'](_0x26798b));_0x593211(_0x26798b);})[_0x7f65('0x1e')](function(_0x4a4cc0){logger['error'](_0x7f65('0x27'),_0x4a4cc0[_0x7f65('0x11')],_0x175d9d);_0x4f311d(_0x3e97a7['error'](0x1f4,_0x4a4cc0[_0x7f65('0x11')]));});});};exports['GetContactDialer']=function(_0x2c5f69){var _0x2b742c=this;return new Promise(function(_0x431a51,_0x34dd82){return db[_0x7f65('0x28')][_0x7f65('0x29')]()[_0x7f65('0xa')](function(_0x3eb835){return db[_0x7f65('0x2a')][_0x7f65('0x2b')](function(_0x3951e6){return db[_0x7f65('0x14')][_0x7f65('0x15')]({'where':_0x2c5f69[_0x7f65('0x16')]?_0x2c5f69[_0x7f65('0x16')][_0x7f65('0x17')]||null:null,'attributes':_0x2c5f69[_0x7f65('0x16')]?_0x2c5f69[_0x7f65('0x16')][_0x7f65('0x18')]||null:null,'limit':_0x2c5f69[_0x7f65('0x16')]?_0x2c5f69[_0x7f65('0x16')][_0x7f65('0x19')]||null:null,'order':_0x2c5f69[_0x7f65('0x16')]?_0x2c5f69['options']['order']||null:null,'transaction':_0x3951e6,'lock':_0x3951e6['LOCK'][_0x7f65('0x2c')],'include':[{'model':db[_0x7f65('0x28')],'as':_0x7f65('0x2d'),'attributes':_['keys'](_0x3eb835)},{'model':db[_0x7f65('0x2e')],'as':_0x7f65('0x2f'),'attributes':['id',_0x7f65('0x30'),_0x7f65('0x31')]}]})[_0x7f65('0xa')](function(_0x122df2){var _0x289ca0=[];var _0x21ef0a=[];for(var _0x2ae28e=0x0;_0x2ae28e<_0x122df2['length'];_0x2ae28e+=0x1){var _0x9ae5f9=_0x122df2[_0x2ae28e][_0x7f65('0x32')];if(_0x9ae5f9===null){_0x289ca0[_0x7f65('0x33')](_0x122df2[_0x2ae28e][_0x7f65('0x25')](_0x2c5f69['body'],{'transaction':_0x3951e6}));}else if(!_0x21ef0a[_0x7f65('0x34')](_0x9ae5f9)){_0x21ef0a[_0x7f65('0x33')](_0x9ae5f9);_0x289ca0['push'](_0x122df2[_0x2ae28e][_0x7f65('0x25')](_0x2c5f69[_0x7f65('0x35')],{'transaction':_0x3951e6}));}}return BPromise[_0x7f65('0x36')](_0x289ca0);});})[_0x7f65('0xa')](function(_0x4a1fbf){logger[_0x7f65('0x24')](_0x7f65('0x37'),_0x2c5f69);logger[_0x7f65('0x1d')](_0x7f65('0x37'),_0x2c5f69,JSON[_0x7f65('0xe')](_0x4a1fbf));_0x431a51(_0x4a1fbf);})[_0x7f65('0x1e')](function(_0x3e69bd){logger[_0x7f65('0xf')](_0x7f65('0x37'),_0x3e69bd[_0x7f65('0x11')],_0x2c5f69);_0x34dd82(_0x2b742c[_0x7f65('0xf')](0x1f4,_0x3e69bd[_0x7f65('0x11')]));});});});};exports[_0x7f65('0x38')]=function(_0x25f6d0){var _0x5671ed=this;return new Promise(function(_0x28700d,_0xfe9c5b){return db[_0x7f65('0x2a')][_0x7f65('0x2b')](function(_0x115cab){return db[_0x7f65('0x39')]['create'](_0x25f6d0[_0x7f65('0x35')],{'raw':_0x25f6d0['options']?_0x25f6d0[_0x7f65('0x16')]['raw']===undefined?!![]:![]:!![],'transaction':_0x115cab})['then'](function(){return db[_0x7f65('0x14')][_0x7f65('0x3a')]({'where':_0x25f6d0[_0x7f65('0x16')]?_0x25f6d0[_0x7f65('0x16')][_0x7f65('0x17')]||null:null,'transaction':_0x115cab});});})['then'](function(_0x2d63de){logger[_0x7f65('0x24')](_0x7f65('0x38'),_0x25f6d0);logger[_0x7f65('0x1d')](_0x7f65('0x38'),_0x25f6d0,JSON[_0x7f65('0xe')](_0x2d63de));_0x28700d(_0x2d63de);})[_0x7f65('0x1e')](function(_0x8fcf7f){logger[_0x7f65('0xf')]('MoveContactManagedDialer',_0x8fcf7f[_0x7f65('0x11')],_0x25f6d0);_0xfe9c5b(_0x5671ed[_0x7f65('0xf')](0x1f4,_0x8fcf7f[_0x7f65('0x11')]));});});};exports[_0x7f65('0x3b')]=function(_0x3f3ae0){var _0x1d6add=this;return new Promise(function(_0x1dfc2d,_0x1bfd8e){return db[_0x7f65('0x14')][_0x7f65('0x15')]({'raw':_0x3f3ae0[_0x7f65('0x16')]?_0x3f3ae0[_0x7f65('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3f3ae0['options']?_0x3f3ae0[_0x7f65('0x16')][_0x7f65('0x17')]||null:null,'attributes':[[db[_0x7f65('0x2a')]['fn']('COUNT',db[_0x7f65('0x2a')]['fn']('IF',db[_0x7f65('0x2a')][_0x7f65('0x3c')](_0x7f65('0x3d')+util[_0x7f65('0x3e')](_0x7f65('0x3f'),moment()[_0x7f65('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x7f65('0x40')))),_0x7f65('0x41')]]})[_0x7f65('0xa')](function(_0x4f8082){logger[_0x7f65('0x24')]('CountReScheduled',_0x3f3ae0);logger[_0x7f65('0x1d')](_0x7f65('0x3b'),_0x3f3ae0,JSON[_0x7f65('0xe')](_0x4f8082));_0x1dfc2d(_0x4f8082);})['catch'](function(_0x54a448){logger[_0x7f65('0xf')](_0x7f65('0x3b'),_0x54a448[_0x7f65('0x11')],_0x3f3ae0);_0x1bfd8e(_0x1d6add[_0x7f65('0xf')](0x1f4,_0x54a448['message']));});});};exports['GetContactRecallMe']=function(_0x3d13b5){var _0x395c0d=this;return new Promise(function(_0x169905,_0x5a7b6d){return db['CmContact']['describe']()[_0x7f65('0xa')](function(_0x411c0d){return db[_0x7f65('0x2a')][_0x7f65('0x2b')](function(_0x31fb8c){return db[_0x7f65('0x14')][_0x7f65('0x15')]({'where':_0x3d13b5[_0x7f65('0x16')]?_0x3d13b5[_0x7f65('0x16')][_0x7f65('0x17')]||null:null,'attributes':_0x3d13b5[_0x7f65('0x16')]?_0x3d13b5[_0x7f65('0x16')]['attributes']||null:null,'limit':0x1,'order':_0x3d13b5[_0x7f65('0x16')]?_0x3d13b5[_0x7f65('0x16')][_0x7f65('0x42')]||null:null,'group':db[_0x7f65('0x14')][_0x7f65('0x32')],'transaction':_0x31fb8c,'lock':_0x31fb8c[_0x7f65('0x43')][_0x7f65('0x2c')],'include':_0x3d13b5[_0x7f65('0x16')]?_0x3d13b5[_0x7f65('0x16')]['include']?_[_0x7f65('0x1c')](_0x3d13b5[_0x7f65('0x16')][_0x7f65('0x1b')],function(_0x3e8837){return{'model':db[_0x3e8837[_0x7f65('0x1a')]],'as':_0x3e8837['as'],'attributes':_0x3e8837[_0x7f65('0x18')],'include':_0x3e8837[_0x7f65('0x1b')]?_[_0x7f65('0x1c')](_0x3e8837[_0x7f65('0x1b')],function(_0x4162bb){return{'model':db[_0x4162bb['model']],'as':_0x4162bb['as'],'attributes':_0x4162bb[_0x7f65('0x18')],'include':_0x4162bb[_0x7f65('0x1b')]?_[_0x7f65('0x1c')](_0x4162bb[_0x7f65('0x1b')],function(_0x309fee){return{'model':db[_0x309fee[_0x7f65('0x1a')]],'as':_0x309fee['as'],'attributes':_0x309fee[_0x7f65('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7f65('0xa')](function(_0x204847){var _0xf34d6c=[];for(var _0x3e37c3=0x0;_0x3e37c3<_0x204847[_0x7f65('0x44')];_0x3e37c3+=0x1){_0xf34d6c[_0x7f65('0x33')](_0x204847[_0x3e37c3][_0x7f65('0x25')](_0x3d13b5[_0x7f65('0x35')],{'transaction':_0x31fb8c}));}return BPromise[_0x7f65('0x36')](_0xf34d6c);});})[_0x7f65('0xa')](function(_0x407a58){logger['info'](_0x7f65('0x45'),_0x3d13b5);logger['debug']('GetContactRecallMe',_0x3d13b5,JSON[_0x7f65('0xe')](_0x407a58));_0x169905(_0x407a58);})[_0x7f65('0x1e')](function(_0x4bf261){logger[_0x7f65('0xf')](_0x7f65('0x45'),_0x4bf261[_0x7f65('0x11')],_0x3d13b5);_0x5a7b6d(_0x395c0d[_0x7f65('0xf')](0x1f4,_0x4bf261[_0x7f65('0x11')]));});});});};exports[_0x7f65('0x46')]=function(_0x3bfe3e){var _0x459589=this;return new Promise(function(_0x202144,_0x3f1424){db['CmContact'][_0x7f65('0x29')]()[_0x7f65('0xa')](function(_0x2bcdca){return db['CmHopper'][_0x7f65('0x15')]({'raw':_0x3bfe3e['options']?_0x3bfe3e[_0x7f65('0x16')][_0x7f65('0x21')]===undefined?!![]:![]:!![],'where':_0x3bfe3e['options']?_0x3bfe3e['options'][_0x7f65('0x17')]||null:null,'attributes':_0x3bfe3e['options']?_0x3bfe3e[_0x7f65('0x16')][_0x7f65('0x18')]||null:null,'limit':_0x3bfe3e[_0x7f65('0x16')]?_0x3bfe3e[_0x7f65('0x16')][_0x7f65('0x19')]||null:null,'include':_0x3bfe3e[_0x7f65('0x16')]?_0x3bfe3e[_0x7f65('0x16')][_0x7f65('0x1b')]?_[_0x7f65('0x1c')](_0x3bfe3e['options'][_0x7f65('0x1b')],function(_0x35b5c1){return{'model':db[_0x35b5c1[_0x7f65('0x1a')]],'as':_0x35b5c1['as'],'attributes':_0x35b5c1['as']==='Contact'?_['keys'](_0x2bcdca):_0x35b5c1[_0x7f65('0x18')],'include':_0x35b5c1[_0x7f65('0x1b')]?_[_0x7f65('0x1c')](_0x35b5c1[_0x7f65('0x1b')],function(_0x23b338){return{'model':db[_0x23b338[_0x7f65('0x1a')]],'as':_0x23b338['as'],'attributes':_0x23b338[_0x7f65('0x18')],'include':_0x23b338['include']?_['map'](_0x23b338[_0x7f65('0x1b')],function(_0x9b7369){return{'model':db[_0x9b7369[_0x7f65('0x1a')]],'as':_0x9b7369['as'],'attributes':_0x9b7369[_0x7f65('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7f65('0xa')](function(_0x3290c7){logger[_0x7f65('0x24')]('GetCmHopper',_0x3bfe3e);logger['debug'](_0x7f65('0x13'),_0x3bfe3e,JSON['stringify'](_0x3290c7));_0x202144(_0x3290c7);})[_0x7f65('0x1e')](function(_0x4e8ef3){logger['error'](_0x7f65('0x13'),_0x4e8ef3[_0x7f65('0x11')],_0x3bfe3e);_0x3f1424(_0x459589[_0x7f65('0xf')](0x1f4,_0x4e8ef3[_0x7f65('0x11')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index d96ca96..c98df09 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 _0xf4e7=['update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','/describe','describe','/opencontacts','getOpenContacts','/:id','show','create','post','/preview','getPreview','put'];(function(_0x56c744,_0x4bbd5b){var _0x38ba64=function(_0xedd6f4){while(--_0xedd6f4){_0x56c744['push'](_0x56c744['shift']());}};_0x38ba64(++_0x4bbd5b);}(_0xf4e7,0xfe));var _0x7f4e=function(_0x22e345,_0x376766){_0x22e345=_0x22e345-0x0;var _0xcc3698=_0xf4e7[_0x22e345];return _0xcc3698;};'use strict';var multer=require('multer');var util=require(_0x7f4e('0x0'));var path=require(_0x7f4e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7f4e('0x2'));var router=express[_0x7f4e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7f4e('0x4'));var interaction=require(_0x7f4e('0x5'));var config=require(_0x7f4e('0x6'));var controller=require(_0x7f4e('0x7'));router[_0x7f4e('0x8')]('/',auth[_0x7f4e('0x9')](),controller['index']);router[_0x7f4e('0x8')](_0x7f4e('0xa'),auth['isAuthenticated'](),controller[_0x7f4e('0xb')]);router[_0x7f4e('0x8')](_0x7f4e('0xc'),auth['isAuthenticated'](),controller[_0x7f4e('0xd')]);router[_0x7f4e('0x8')](_0x7f4e('0xe'),auth['isAuthenticated'](),controller[_0x7f4e('0xf')]);router['post']('/',auth[_0x7f4e('0x9')](),controller[_0x7f4e('0x10')]);router[_0x7f4e('0x11')](_0x7f4e('0x12'),auth[_0x7f4e('0x9')](),controller[_0x7f4e('0x13')]);router[_0x7f4e('0x14')](_0x7f4e('0xe'),auth[_0x7f4e('0x9')](),controller[_0x7f4e('0x15')]);router[_0x7f4e('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7f4e('0x17')]);module[_0x7f4e('0x18')]=router; \ No newline at end of file +var _0x672a=['/:id','show','create','/preview','getPreview','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','isAuthenticated','index','get','/describe','describe','/opencontacts','getOpenContacts'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x672a,0x122));var _0xa672=function(_0x126f5c,_0xf02349){_0x126f5c=_0x126f5c-0x0;var _0x43eb10=_0x672a[_0x126f5c];return _0x43eb10;};'use strict';var multer=require(_0xa672('0x0'));var util=require(_0xa672('0x1'));var path=require(_0xa672('0x2'));var timeout=require(_0xa672('0x3'));var express=require(_0xa672('0x4'));var router=express[_0xa672('0x5')]();var fs_extra=require(_0xa672('0x6'));var auth=require(_0xa672('0x7'));var interaction=require(_0xa672('0x8'));var config=require(_0xa672('0x9'));var controller=require(_0xa672('0xa'));router['get']('/',auth[_0xa672('0xb')](),controller[_0xa672('0xc')]);router[_0xa672('0xd')](_0xa672('0xe'),auth[_0xa672('0xb')](),controller[_0xa672('0xf')]);router[_0xa672('0xd')](_0xa672('0x10'),auth[_0xa672('0xb')](),controller[_0xa672('0x11')]);router[_0xa672('0xd')](_0xa672('0x12'),auth[_0xa672('0xb')](),controller[_0xa672('0x13')]);router['post']('/',auth[_0xa672('0xb')](),controller[_0xa672('0x14')]);router['post'](_0xa672('0x15'),auth[_0xa672('0xb')](),controller[_0xa672('0x16')]);router[_0xa672('0x17')](_0xa672('0x12'),auth[_0xa672('0xb')](),controller[_0xa672('0x18')]);router[_0xa672('0x19')](_0xa672('0x12'),auth['isAuthenticated'](),controller[_0xa672('0x1a')]);module[_0xa672('0x1b')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 86c9113..9d9ac2e 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 _0xad68=['exports','STRING','INTEGER','contactListQueue'];(function(_0x3e2fc3,_0x3b6f89){var _0x463b89=function(_0x1fcbae){while(--_0x1fcbae){_0x3e2fc3['push'](_0x3e2fc3['shift']());}};_0x463b89(++_0x3b6f89);}(_0xad68,0x100));var _0x8ad6=function(_0x2aee7b,_0x181285){_0x2aee7b=_0x2aee7b-0x0;var _0x5a4554=_0xad68[_0x2aee7b];return _0x5a4554;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x8ad6('0x0')]={'phone':{'type':Sequelize[_0x8ad6('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x8ad6('0x2')],'unique':_0x8ad6('0x3')},'VoiceQueueId':{'type':Sequelize[_0x8ad6('0x2')],'unique':_0x8ad6('0x3')}}; \ No newline at end of file +var _0xa2c8=['STRING','INTEGER','contactListQueue','moment','sequelize','exports'];(function(_0x2388f9,_0x48fcbc){var _0x567965=function(_0x1a1508){while(--_0x1a1508){_0x2388f9['push'](_0x2388f9['shift']());}};_0x567965(++_0x48fcbc);}(_0xa2c8,0x99));var _0x8a2c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa2c8[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0x8a2c('0x0'));var Sequelize=require(_0x8a2c('0x1'));module[_0x8a2c('0x2')]={'phone':{'type':Sequelize[_0x8a2c('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x8a2c('0x4')],'unique':_0x8a2c('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x8a2c('0x5')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 6ed21db..629bf52 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 _0x77aa=['eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','end','error','stack','name','send','map','CmHopperBlack','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','update','body','destroy'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x77aa,0x1f1));var _0xa77a=function(_0x261917,_0x5ce7ee){_0x261917=_0x261917-0x0;var _0x1cb997=_0x77aa[_0x261917];return _0x1cb997;};'use strict';var emlformat=require(_0xa77a('0x0'));var rimraf=require(_0xa77a('0x1'));var zipdir=require(_0xa77a('0x2'));var jsonpatch=require(_0xa77a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa77a('0x4'));var Mustache=require('mustache');var util=require(_0xa77a('0x5'));var path=require('path');var sox=require(_0xa77a('0x6'));var csv=require(_0xa77a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa77a('0x8'));var squel=require('squel');var crypto=require(_0xa77a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xa77a('0xa'));var toCsv=require('to-csv');var querystring=require(_0xa77a('0xb'));var Papa=require('papaparse');var Redis=require(_0xa77a('0xc'));var authService=require(_0xa77a('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xa77a('0xe'));var hardwareService=require(_0xa77a('0xf'));var logger=require(_0xa77a('0x10'))(_0xa77a('0x11'));var utils=require(_0xa77a('0x12'));var config=require(_0xa77a('0x13'));var licenseUtil=require(_0xa77a('0x14'));var db=require(_0xa77a('0x15'))['db'];function respondWithStatusCode(_0xcf7948,_0x563d3a){_0x563d3a=_0x563d3a||0xcc;return function(_0x117a4f){if(_0x117a4f){return _0xcf7948['sendStatus'](_0x563d3a);}return _0xcf7948['status'](_0x563d3a)['end']();};}function respondWithResult(_0x5ef6cb,_0x4b7352){_0x4b7352=_0x4b7352||0xc8;return function(_0x36feed){if(_0x36feed){return _0x5ef6cb[_0xa77a('0x16')](_0x4b7352)['json'](_0x36feed);}};}function respondWithFilteredResult(_0x465b95,_0x232c26){return function(_0x4e7263){if(_0x4e7263){var _0x2a8de9=typeof _0x232c26[_0xa77a('0x17')]===_0xa77a('0x18')&&typeof _0x232c26[_0xa77a('0x19')]===_0xa77a('0x18');var _0x41ea92=_0x4e7263[_0xa77a('0x1a')];var _0x4b310b=_0x2a8de9?0x0:_0x232c26['offset'];var _0x257c1c=_0x2a8de9?_0x4e7263[_0xa77a('0x1a')]:_0x232c26[_0xa77a('0x17')]+_0x232c26[_0xa77a('0x19')];var _0x4a8d62;if(_0x257c1c>=_0x41ea92){_0x257c1c=_0x41ea92;_0x4a8d62=0xc8;}else{_0x4a8d62=0xce;}_0x465b95[_0xa77a('0x16')](_0x4a8d62);return _0x465b95[_0xa77a('0x1b')](_0xa77a('0x1c'),_0x4b310b+'-'+_0x257c1c+'/'+_0x41ea92)[_0xa77a('0x1d')](_0x4e7263);}return null;};}function patchUpdates(_0x5967b2){return function(_0x364df1){try{jsonpatch[_0xa77a('0x1e')](_0x364df1,_0x5967b2,!![]);}catch(_0x3d9ed9){return BPromise[_0xa77a('0x1f')](_0x3d9ed9);}return _0x364df1['save']();};}function saveUpdates(_0x163bac,_0x514bf1){return function(_0x1e4504){if(_0x1e4504){return _0x1e4504['update'](_0x163bac)[_0xa77a('0x20')](function(_0x34dd1b){return _0x34dd1b;});}return null;};}function removeEntity(_0x4fd7be,_0x4125b2){return function(_0x1a7158){if(_0x1a7158){return _0x1a7158['destroy']()['then'](function(){_0x4fd7be[_0xa77a('0x16')](0xcc)[_0xa77a('0x21')]();});}};}function handleEntityNotFound(_0x1e9395,_0x5633ad){return function(_0x589fb4){if(!_0x589fb4){_0x1e9395['sendStatus'](0x194);}return _0x589fb4;};}function handleError(_0x167b82,_0x232477){_0x232477=_0x232477||0x1f4;return function(_0x19d7fd){logger[_0xa77a('0x22')](_0x19d7fd[_0xa77a('0x23')]);if(_0x19d7fd[_0xa77a('0x24')]){delete _0x19d7fd[_0xa77a('0x24')];}_0x167b82[_0xa77a('0x16')](_0x232477)[_0xa77a('0x25')](_0x19d7fd);};}exports['index']=function(_0x142004,_0x1e2830){var _0x2ad051={},_0x292db1={},_0x326a99={'count':0x0,'rows':[]};var _0x8e1f8f=_[_0xa77a('0x26')](db[_0xa77a('0x27')][_0xa77a('0x28')],function(_0x3d1d44){return{'name':_0x3d1d44[_0xa77a('0x29')],'type':_0x3d1d44[_0xa77a('0x2a')]['key']};});_0x292db1[_0xa77a('0x2b')]=_[_0xa77a('0x26')](_0x8e1f8f,_0xa77a('0x24'));_0x292db1['query']=_['keys'](_0x142004[_0xa77a('0x2c')]);_0x292db1[_0xa77a('0x2d')]=_[_0xa77a('0x2e')](_0x292db1[_0xa77a('0x2b')],_0x292db1[_0xa77a('0x2c')]);_0x2ad051[_0xa77a('0x2f')]=_[_0xa77a('0x2e')](_0x292db1['model'],qs[_0xa77a('0x30')](_0x142004[_0xa77a('0x2c')]['fields']));_0x2ad051[_0xa77a('0x2f')]=_0x2ad051[_0xa77a('0x2f')][_0xa77a('0x31')]?_0x2ad051[_0xa77a('0x2f')]:_0x292db1[_0xa77a('0x2b')];if(!_0x142004[_0xa77a('0x2c')][_0xa77a('0x32')](_0xa77a('0x33'))){_0x2ad051[_0xa77a('0x19')]=qs[_0xa77a('0x19')](_0x142004[_0xa77a('0x2c')][_0xa77a('0x19')]);_0x2ad051[_0xa77a('0x17')]=qs[_0xa77a('0x17')](_0x142004[_0xa77a('0x2c')][_0xa77a('0x17')]);}_0x2ad051[_0xa77a('0x34')]=qs[_0xa77a('0x35')](_0x142004[_0xa77a('0x2c')][_0xa77a('0x35')]);_0x2ad051[_0xa77a('0x36')]=qs[_0xa77a('0x2d')](_[_0xa77a('0x37')](_0x142004[_0xa77a('0x2c')],_0x292db1[_0xa77a('0x2d')]),_0x8e1f8f);if(_0x142004[_0xa77a('0x2c')]['filter']){_0x2ad051[_0xa77a('0x36')]=_['merge'](_0x2ad051[_0xa77a('0x36')],{'$or':_[_0xa77a('0x26')](_0x8e1f8f,function(_0x4149bf){if(_0x4149bf['type']!==_0xa77a('0x38')){var _0x274633={};_0x274633[_0x4149bf[_0xa77a('0x24')]]={'$like':'%'+_0x142004[_0xa77a('0x2c')]['filter']+'%'};return _0x274633;}})});}_0x2ad051=_[_0xa77a('0x39')]({},_0x2ad051,_0x142004[_0xa77a('0x3a')]);var _0x5f4e40={'where':_0x2ad051['where']};return db[_0xa77a('0x27')]['count'](_0x5f4e40)[_0xa77a('0x20')](function(_0x2dae62){_0x326a99['count']=_0x2dae62;if(_0x142004['query'][_0xa77a('0x3b')]){_0x2ad051[_0xa77a('0x3c')]=[{'all':!![]}];}return db[_0xa77a('0x27')][_0xa77a('0x3d')](_0x2ad051);})[_0xa77a('0x20')](function(_0x2984a3){_0x326a99[_0xa77a('0x3e')]=_0x2984a3;return _0x326a99;})[_0xa77a('0x20')](respondWithFilteredResult(_0x1e2830,_0x2ad051))[_0xa77a('0x3f')](handleError(_0x1e2830,null));};exports[_0xa77a('0x40')]=function(_0x1a292c,_0x291463){var _0x3ec3f0={'raw':!![],'where':{'id':_0x1a292c[_0xa77a('0x41')]['id']}},_0xc3cf77={};_0xc3cf77['model']=_[_0xa77a('0x42')](db[_0xa77a('0x27')][_0xa77a('0x28')]);_0xc3cf77[_0xa77a('0x2c')]=_[_0xa77a('0x42')](_0x1a292c[_0xa77a('0x2c')]);_0xc3cf77[_0xa77a('0x2d')]=_[_0xa77a('0x2e')](_0xc3cf77[_0xa77a('0x2b')],_0xc3cf77[_0xa77a('0x2c')]);_0x3ec3f0[_0xa77a('0x2f')]=_[_0xa77a('0x2e')](_0xc3cf77[_0xa77a('0x2b')],qs[_0xa77a('0x30')](_0x1a292c['query'][_0xa77a('0x30')]));_0x3ec3f0[_0xa77a('0x2f')]=_0x3ec3f0[_0xa77a('0x2f')]['length']?_0x3ec3f0[_0xa77a('0x2f')]:_0xc3cf77[_0xa77a('0x2b')];if(_0x1a292c[_0xa77a('0x2c')][_0xa77a('0x3b')]){_0x3ec3f0[_0xa77a('0x3c')]=[{'all':!![]}];}_0x3ec3f0=_[_0xa77a('0x39')]({},_0x3ec3f0,_0x1a292c[_0xa77a('0x3a')]);return db[_0xa77a('0x27')][_0xa77a('0x43')](_0x3ec3f0)['then'](handleEntityNotFound(_0x291463,null))[_0xa77a('0x20')](respondWithResult(_0x291463,null))[_0xa77a('0x3f')](handleError(_0x291463,null));};exports[_0xa77a('0x44')]=function(_0x3a0d13,_0x4fa21a){if(_0x3a0d13[_0xa77a('0x45')]['id']){delete _0x3a0d13[_0xa77a('0x45')]['id'];}return db[_0xa77a('0x27')][_0xa77a('0x43')]({'where':{'id':_0x3a0d13[_0xa77a('0x41')]['id']}})[_0xa77a('0x20')](handleEntityNotFound(_0x4fa21a,null))[_0xa77a('0x20')](saveUpdates(_0x3a0d13[_0xa77a('0x45')],null))[_0xa77a('0x20')](respondWithResult(_0x4fa21a,null))['catch'](handleError(_0x4fa21a,null));};exports[_0xa77a('0x46')]=function(_0x25276a,_0x37495c){return db[_0xa77a('0x27')][_0xa77a('0x43')]({'where':{'id':_0x25276a['params']['id']}})[_0xa77a('0x20')](handleEntityNotFound(_0x37495c,null))[_0xa77a('0x20')](removeEntity(_0x37495c,null))[_0xa77a('0x3f')](handleError(_0x37495c,null));};exports['describe']=function(_0x490b0d,_0xc5dba2){return db[_0xa77a('0x27')]['describe']()[_0xa77a('0x20')](respondWithResult(_0xc5dba2,null))[_0xa77a('0x3f')](handleError(_0xc5dba2,null));}; \ No newline at end of file +var _0x08e6=['then','destroy','end','error','stack','name','index','map','CmHopperBlack','rawAttributes','type','key','query','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','where','VIRTUAL','merge','include','rows','catch','show','params','keys','length','includeAll','options','find','body','describe','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update'];(function(_0x5ca5db,_0x37feae){var _0xd6bfa7=function(_0xb74535){while(--_0xb74535){_0x5ca5db['push'](_0x5ca5db['shift']());}};_0xd6bfa7(++_0x37feae);}(_0x08e6,0x75));var _0x608e=function(_0x10e74d,_0x6624f6){_0x10e74d=_0x10e74d-0x0;var _0x13d9b2=_0x08e6[_0x10e74d];return _0x13d9b2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x608e('0x0'));var zipdir=require(_0x608e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x608e('0x2'));var moment=require(_0x608e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x608e('0x4'));var util=require(_0x608e('0x5'));var path=require(_0x608e('0x6'));var sox=require(_0x608e('0x7'));var csv=require(_0x608e('0x8'));var ejs=require(_0x608e('0x9'));var fs=require('fs');var fs_extra=require(_0x608e('0xa'));var _=require(_0x608e('0xb'));var squel=require(_0x608e('0xc'));var crypto=require(_0x608e('0xd'));var jsforce=require(_0x608e('0xe'));var deskjs=require(_0x608e('0xf'));var toCsv=require(_0x608e('0x8'));var querystring=require(_0x608e('0x10'));var Papa=require(_0x608e('0x11'));var Redis=require(_0x608e('0x12'));var authService=require(_0x608e('0x13'));var qs=require(_0x608e('0x14'));var as=require(_0x608e('0x15'));var hardwareService=require(_0x608e('0x16'));var logger=require(_0x608e('0x17'))(_0x608e('0x18'));var utils=require(_0x608e('0x19'));var config=require(_0x608e('0x1a'));var licenseUtil=require(_0x608e('0x1b'));var db=require(_0x608e('0x1c'))['db'];function respondWithStatusCode(_0x441373,_0x145b70){_0x145b70=_0x145b70||0xcc;return function(_0x19eb9c){if(_0x19eb9c){return _0x441373[_0x608e('0x1d')](_0x145b70);}return _0x441373[_0x608e('0x1e')](_0x145b70)['end']();};}function respondWithResult(_0x3d1e9f,_0x2c402b){_0x2c402b=_0x2c402b||0xc8;return function(_0x56d701){if(_0x56d701){return _0x3d1e9f['status'](_0x2c402b)[_0x608e('0x1f')](_0x56d701);}};}function respondWithFilteredResult(_0x5148d6,_0x4a8693){return function(_0x2a25f3){if(_0x2a25f3){var _0x3a2f42=typeof _0x4a8693[_0x608e('0x20')]===_0x608e('0x21')&&typeof _0x4a8693[_0x608e('0x22')]===_0x608e('0x21');var _0x40dffa=_0x2a25f3[_0x608e('0x23')];var _0x23ae6d=_0x3a2f42?0x0:_0x4a8693[_0x608e('0x20')];var _0x1bdb4b=_0x3a2f42?_0x2a25f3['count']:_0x4a8693[_0x608e('0x20')]+_0x4a8693[_0x608e('0x22')];var _0x11360d;if(_0x1bdb4b>=_0x40dffa){_0x1bdb4b=_0x40dffa;_0x11360d=0xc8;}else{_0x11360d=0xce;}_0x5148d6['status'](_0x11360d);return _0x5148d6[_0x608e('0x24')](_0x608e('0x25'),_0x23ae6d+'-'+_0x1bdb4b+'/'+_0x40dffa)['json'](_0x2a25f3);}return null;};}function patchUpdates(_0x3e859a){return function(_0x5a751d){try{jsonpatch[_0x608e('0x26')](_0x5a751d,_0x3e859a,!![]);}catch(_0x5fb9b0){return BPromise['reject'](_0x5fb9b0);}return _0x5a751d[_0x608e('0x27')]();};}function saveUpdates(_0x23f6b7,_0x11c78e){return function(_0x182d69){if(_0x182d69){return _0x182d69[_0x608e('0x28')](_0x23f6b7)[_0x608e('0x29')](function(_0x2bae27){return _0x2bae27;});}return null;};}function removeEntity(_0x4291d9,_0x292c79){return function(_0x12d43d){if(_0x12d43d){return _0x12d43d[_0x608e('0x2a')]()[_0x608e('0x29')](function(){_0x4291d9[_0x608e('0x1e')](0xcc)[_0x608e('0x2b')]();});}};}function handleEntityNotFound(_0x162013,_0x1ee378){return function(_0xf1315b){if(!_0xf1315b){_0x162013[_0x608e('0x1d')](0x194);}return _0xf1315b;};}function handleError(_0x461b2c,_0x47ae26){_0x47ae26=_0x47ae26||0x1f4;return function(_0x432180){logger[_0x608e('0x2c')](_0x432180[_0x608e('0x2d')]);if(_0x432180['name']){delete _0x432180[_0x608e('0x2e')];}_0x461b2c[_0x608e('0x1e')](_0x47ae26)['send'](_0x432180);};}exports[_0x608e('0x2f')]=function(_0x389ac3,_0x5ba54f){var _0x53b080={},_0x3a3783={},_0x53bb6c={'count':0x0,'rows':[]};var _0x3c9d5d=_[_0x608e('0x30')](db[_0x608e('0x31')][_0x608e('0x32')],function(_0x31b4cf){return{'name':_0x31b4cf['fieldName'],'type':_0x31b4cf[_0x608e('0x33')][_0x608e('0x34')]};});_0x3a3783['model']=_[_0x608e('0x30')](_0x3c9d5d,'name');_0x3a3783[_0x608e('0x35')]=_['keys'](_0x389ac3[_0x608e('0x35')]);_0x3a3783['filters']=_['intersection'](_0x3a3783[_0x608e('0x36')],_0x3a3783[_0x608e('0x35')]);_0x53b080[_0x608e('0x37')]=_[_0x608e('0x38')](_0x3a3783['model'],qs[_0x608e('0x39')](_0x389ac3['query'][_0x608e('0x39')]));_0x53b080[_0x608e('0x37')]=_0x53b080[_0x608e('0x37')]['length']?_0x53b080[_0x608e('0x37')]:_0x3a3783['model'];if(!_0x389ac3['query'][_0x608e('0x3a')](_0x608e('0x3b'))){_0x53b080[_0x608e('0x22')]=qs[_0x608e('0x22')](_0x389ac3[_0x608e('0x35')][_0x608e('0x22')]);_0x53b080[_0x608e('0x20')]=qs[_0x608e('0x20')](_0x389ac3[_0x608e('0x35')][_0x608e('0x20')]);}_0x53b080['order']=qs[_0x608e('0x3c')](_0x389ac3[_0x608e('0x35')]['sort']);_0x53b080['where']=qs[_0x608e('0x3d')](_[_0x608e('0x3e')](_0x389ac3[_0x608e('0x35')],_0x3a3783[_0x608e('0x3d')]),_0x3c9d5d);if(_0x389ac3[_0x608e('0x35')][_0x608e('0x3f')]){_0x53b080[_0x608e('0x40')]=_['merge'](_0x53b080['where'],{'$or':_[_0x608e('0x30')](_0x3c9d5d,function(_0x2ca7b2){if(_0x2ca7b2[_0x608e('0x33')]!==_0x608e('0x41')){var _0x5d4fb0={};_0x5d4fb0[_0x2ca7b2[_0x608e('0x2e')]]={'$like':'%'+_0x389ac3['query'][_0x608e('0x3f')]+'%'};return _0x5d4fb0;}})});}_0x53b080=_[_0x608e('0x42')]({},_0x53b080,_0x389ac3['options']);var _0x2d7267={'where':_0x53b080[_0x608e('0x40')]};return db[_0x608e('0x31')][_0x608e('0x23')](_0x2d7267)[_0x608e('0x29')](function(_0x2cd50c){_0x53bb6c[_0x608e('0x23')]=_0x2cd50c;if(_0x389ac3[_0x608e('0x35')]['includeAll']){_0x53b080[_0x608e('0x43')]=[{'all':!![]}];}return db[_0x608e('0x31')]['findAll'](_0x53b080);})['then'](function(_0x5f248a){_0x53bb6c[_0x608e('0x44')]=_0x5f248a;return _0x53bb6c;})[_0x608e('0x29')](respondWithFilteredResult(_0x5ba54f,_0x53b080))[_0x608e('0x45')](handleError(_0x5ba54f,null));};exports[_0x608e('0x46')]=function(_0x25ae40,_0xccdc99){var _0x2ad32c={'raw':!![],'where':{'id':_0x25ae40[_0x608e('0x47')]['id']}},_0x5137a1={};_0x5137a1[_0x608e('0x36')]=_[_0x608e('0x48')](db[_0x608e('0x31')]['rawAttributes']);_0x5137a1[_0x608e('0x35')]=_[_0x608e('0x48')](_0x25ae40[_0x608e('0x35')]);_0x5137a1[_0x608e('0x3d')]=_[_0x608e('0x38')](_0x5137a1[_0x608e('0x36')],_0x5137a1[_0x608e('0x35')]);_0x2ad32c['attributes']=_[_0x608e('0x38')](_0x5137a1[_0x608e('0x36')],qs['fields'](_0x25ae40[_0x608e('0x35')][_0x608e('0x39')]));_0x2ad32c['attributes']=_0x2ad32c[_0x608e('0x37')][_0x608e('0x49')]?_0x2ad32c[_0x608e('0x37')]:_0x5137a1[_0x608e('0x36')];if(_0x25ae40[_0x608e('0x35')][_0x608e('0x4a')]){_0x2ad32c[_0x608e('0x43')]=[{'all':!![]}];}_0x2ad32c=_['merge']({},_0x2ad32c,_0x25ae40[_0x608e('0x4b')]);return db[_0x608e('0x31')][_0x608e('0x4c')](_0x2ad32c)[_0x608e('0x29')](handleEntityNotFound(_0xccdc99,null))[_0x608e('0x29')](respondWithResult(_0xccdc99,null))[_0x608e('0x45')](handleError(_0xccdc99,null));};exports[_0x608e('0x28')]=function(_0x3fa024,_0x37cb0d){if(_0x3fa024[_0x608e('0x4d')]['id']){delete _0x3fa024['body']['id'];}return db[_0x608e('0x31')]['find']({'where':{'id':_0x3fa024[_0x608e('0x47')]['id']}})['then'](handleEntityNotFound(_0x37cb0d,null))[_0x608e('0x29')](saveUpdates(_0x3fa024[_0x608e('0x4d')],null))['then'](respondWithResult(_0x37cb0d,null))[_0x608e('0x45')](handleError(_0x37cb0d,null));};exports['destroy']=function(_0x5306f4,_0x2807c6){return db[_0x608e('0x31')][_0x608e('0x4c')]({'where':{'id':_0x5306f4[_0x608e('0x47')]['id']}})[_0x608e('0x29')](handleEntityNotFound(_0x2807c6,null))[_0x608e('0x29')](removeEntity(_0x2807c6,null))['catch'](handleError(_0x2807c6,null));};exports[_0x608e('0x4e')]=function(_0x4fd1f8,_0x197a95){return db[_0x608e('0x31')][_0x608e('0x4e')]()[_0x608e('0x29')](respondWithResult(_0x197a95,null))['catch'](handleError(_0x197a95,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index d017b7f..9145712 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 _0x948d=['exports','define','cm_hopper_black','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5713f3,_0x4df455){var _0x541456=function(_0x19ec8f){while(--_0x19ec8f){_0x5713f3['push'](_0x5713f3['shift']());}};_0x541456(++_0x4df455);}(_0x948d,0xea));var _0xd948=function(_0x414691,_0x31baf2){_0x414691=_0x414691-0x0;var _0x1705c3=_0x948d[_0x414691];return _0x1705c3;};'use strict';var _=require(_0xd948('0x0'));var util=require(_0xd948('0x1'));var logger=require(_0xd948('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd948('0x3'));var rp=require(_0xd948('0x4'));var fs=require('fs');var path=require(_0xd948('0x5'));var rimraf=require(_0xd948('0x6'));var config=require(_0xd948('0x7'));var attributes=require('./cmHopperBlack.attributes');module[_0xd948('0x8')]=function(_0x5267a0,_0x245bdf){return _0x5267a0[_0xd948('0x9')]('CmHopperBlack',attributes,{'tableName':_0xd948('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x687f=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','cm_hopper_black','util'];(function(_0x3a75fa,_0xd9150a){var _0x5a3c3=function(_0x2bc9e4){while(--_0x2bc9e4){_0x3a75fa['push'](_0x3a75fa['shift']());}};_0x5a3c3(++_0xd9150a);}(_0x687f,0xe6));var _0xf687=function(_0x2e2681,_0x4089c1){_0x2e2681=_0x2e2681-0x0;var _0x368a64=_0x687f[_0x2e2681];return _0x368a64;};'use strict';var _=require('lodash');var util=require(_0xf687('0x0'));var logger=require('../../config/logger')(_0xf687('0x1'));var moment=require(_0xf687('0x2'));var BPromise=require(_0xf687('0x3'));var rp=require(_0xf687('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf687('0x5'));var config=require(_0xf687('0x6'));var attributes=require(_0xf687('0x7'));module[_0xf687('0x8')]=function(_0x5f4bdb,_0x2fb2ff){return _0x5f4bdb[_0xf687('0x9')]('CmHopperBlack',attributes,{'tableName':_0xf687('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index f8ce033..673cca7 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 _0xf13a=['moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','GetCmHopperBlack','CmHopperBlack','options','where','limit','include','map','model','attributes','UpdateCmHopperBlack','update','body','raw','catch','DestroyCmHopperBlack','destroy','lodash','util'];(function(_0x58a295,_0x407f4d){var _0x1b6a20=function(_0xcce711){while(--_0xcce711){_0x58a295['push'](_0x58a295['shift']());}};_0x1b6a20(++_0x407f4d);}(_0xf13a,0xb7));var _0xaf13=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0xf13a[_0x494d1f];return _0x457b6e;};'use strict';var _=require(_0xaf13('0x0'));var util=require(_0xaf13('0x1'));var moment=require(_0xaf13('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaf13('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xaf13('0x4'));var logger=require('../../config/logger')(_0xaf13('0x5'));var config=require(_0xaf13('0x6'));var jayson=require(_0xaf13('0x7'));var client=jayson[_0xaf13('0x8')][_0xaf13('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4de3f1,_0x536170,_0x11e020){return new BPromise(function(_0x1c69c2,_0x3820f6){return client['request'](_0x4de3f1,_0x11e020)[_0xaf13('0xa')](function(_0x1fcbd8){logger[_0xaf13('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0x536170,_0xaf13('0xc'));logger[_0xaf13('0xd')](_0xaf13('0xe'),_0x536170,_0xaf13('0xc'),JSON[_0xaf13('0xf')](_0x1fcbd8));if(_0x1fcbd8[_0xaf13('0x10')]){if(_0x1fcbd8['error'][_0xaf13('0x11')]===0x1f4){logger[_0xaf13('0x10')](_0xaf13('0x12'),_0x536170,_0x1fcbd8[_0xaf13('0x10')][_0xaf13('0x13')]);return _0x3820f6(_0x1fcbd8[_0xaf13('0x10')][_0xaf13('0x13')]);}logger['error'](_0xaf13('0x12'),_0x536170,_0x1fcbd8[_0xaf13('0x10')][_0xaf13('0x13')]);return _0x1c69c2(_0x1fcbd8[_0xaf13('0x10')][_0xaf13('0x13')]);}else{logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x536170,_0xaf13('0xc'));_0x1c69c2(_0x1fcbd8[_0xaf13('0x14')]['message']);}})['catch'](function(_0x26d142){logger[_0xaf13('0x10')](_0xaf13('0x12'),_0x536170,_0x26d142);_0x3820f6(_0x26d142);});});}exports[_0xaf13('0x15')]=function(_0x72db58){var _0x2ca83e=this;return new Promise(function(_0x283f55,_0x168174){return db[_0xaf13('0x16')]['findAll']({'raw':_0x72db58[_0xaf13('0x17')]?_0x72db58[_0xaf13('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x72db58['options']?_0x72db58[_0xaf13('0x17')][_0xaf13('0x18')]||null:null,'attributes':_0x72db58[_0xaf13('0x17')]?_0x72db58[_0xaf13('0x17')]['attributes']||null:null,'limit':_0x72db58[_0xaf13('0x17')]?_0x72db58['options'][_0xaf13('0x19')]||null:null,'include':_0x72db58['options']?_0x72db58[_0xaf13('0x17')][_0xaf13('0x1a')]?_[_0xaf13('0x1b')](_0x72db58[_0xaf13('0x17')][_0xaf13('0x1a')],function(_0x215e50){return{'model':db[_0x215e50[_0xaf13('0x1c')]],'as':_0x215e50['as'],'attributes':_0x215e50[_0xaf13('0x1d')],'include':_0x215e50['include']?_['map'](_0x215e50[_0xaf13('0x1a')],function(_0x28ac49){return{'model':db[_0x28ac49['model']],'as':_0x28ac49['as'],'attributes':_0x28ac49[_0xaf13('0x1d')],'include':_0x28ac49['include']?_[_0xaf13('0x1b')](_0x28ac49[_0xaf13('0x1a')],function(_0x1bc2ed){return{'model':db[_0x1bc2ed[_0xaf13('0x1c')]],'as':_0x1bc2ed['as'],'attributes':_0x1bc2ed[_0xaf13('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xaf13('0xa')](function(_0x257195){logger['info'](_0xaf13('0x15'),_0x72db58);logger['debug'](_0xaf13('0x15'),_0x72db58,JSON[_0xaf13('0xf')](_0x257195));_0x283f55(_0x257195);})['catch'](function(_0x3cf59a){logger[_0xaf13('0x10')]('GetCmHopperBlack',_0x3cf59a[_0xaf13('0x13')],_0x72db58);_0x168174(_0x2ca83e['error'](0x1f4,_0x3cf59a[_0xaf13('0x13')]));});});};exports[_0xaf13('0x1e')]=function(_0x1b85f5){var _0x50c60f=this;return new Promise(function(_0x39b59c,_0x377a32){return db[_0xaf13('0x16')][_0xaf13('0x1f')](_0x1b85f5[_0xaf13('0x20')],{'raw':_0x1b85f5[_0xaf13('0x17')]?_0x1b85f5['options'][_0xaf13('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b85f5[_0xaf13('0x17')]?_0x1b85f5['options'][_0xaf13('0x18')]||null:null,'attributes':_0x1b85f5[_0xaf13('0x17')]?_0x1b85f5[_0xaf13('0x17')]['attributes']||null:null,'limit':_0x1b85f5[_0xaf13('0x17')]?_0x1b85f5[_0xaf13('0x17')]['limit']||null:null})[_0xaf13('0xa')](function(_0x501b46){logger[_0xaf13('0xb')](_0xaf13('0x1e'),_0x1b85f5);logger['debug'](_0xaf13('0x1e'),_0x1b85f5,JSON['stringify'](_0x501b46));_0x39b59c(_0x501b46);})[_0xaf13('0x22')](function(_0x279928){logger[_0xaf13('0x10')](_0xaf13('0x1e'),_0x279928[_0xaf13('0x13')],_0x1b85f5);_0x377a32(_0x50c60f[_0xaf13('0x10')](0x1f4,_0x279928[_0xaf13('0x13')]));});});};exports[_0xaf13('0x23')]=function(_0x582696){var _0x5c6d9a=this;return new Promise(function(_0x36423d,_0x1017f3){return db[_0xaf13('0x16')][_0xaf13('0x24')]({'where':_0x582696[_0xaf13('0x17')]?_0x582696[_0xaf13('0x17')][_0xaf13('0x18')]||null:null})[_0xaf13('0xa')](function(_0x57f692){logger[_0xaf13('0xb')](_0xaf13('0x23'),_0x582696);logger[_0xaf13('0xd')]('DestroyCmHopperBlack',_0x582696,JSON[_0xaf13('0xf')](_0x57f692));_0x36423d(_0x57f692);})['catch'](function(_0x201ae6){logger[_0xaf13('0x10')](_0xaf13('0x23'),_0x201ae6[_0xaf13('0x13')],_0x582696);_0x1017f3(_0x5c6d9a[_0xaf13('0x10')](0x1f4,_0x201ae6[_0xaf13('0x13')]));});});}; \ No newline at end of file +var _0x97ef=['bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CmHopperBlack','findAll','options','raw','attributes','limit','include','model','map','GetCmHopperBlack','stringify','update','body','UpdateCmHopperBlack','destroy','DestroyCmHopperBlack','moment'];(function(_0x2febdb,_0x1c1143){var _0x16c299=function(_0x8d0349){while(--_0x8d0349){_0x2febdb['push'](_0x2febdb['shift']());}};_0x16c299(++_0x1c1143);}(_0x97ef,0xcb));var _0xf97e=function(_0x22c21b,_0x14e93f){_0x22c21b=_0x22c21b-0x0;var _0x24bdc=_0x97ef[_0x22c21b];return _0x24bdc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf97e('0x0'));var BPromise=require(_0xf97e('0x1'));var rs=require(_0xf97e('0x2'));var fs=require('fs');var Redis=require(_0xf97e('0x3'));var db=require(_0xf97e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xf97e('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x138cf6,_0x450df3,_0x3c6b37){return new BPromise(function(_0xd65572,_0x38c88b){return client[_0xf97e('0x6')](_0x138cf6,_0x3c6b37)[_0xf97e('0x7')](function(_0x1b9843){logger[_0xf97e('0x8')](_0xf97e('0x9'),_0x450df3,'request\x20sent');logger[_0xf97e('0xa')](_0xf97e('0xb'),_0x450df3,_0xf97e('0xc'),JSON['stringify'](_0x1b9843));if(_0x1b9843[_0xf97e('0xd')]){if(_0x1b9843['error'][_0xf97e('0xe')]===0x1f4){logger[_0xf97e('0xd')](_0xf97e('0x9'),_0x450df3,_0x1b9843['error']['message']);return _0x38c88b(_0x1b9843[_0xf97e('0xd')][_0xf97e('0xf')]);}logger[_0xf97e('0xd')](_0xf97e('0x9'),_0x450df3,_0x1b9843[_0xf97e('0xd')][_0xf97e('0xf')]);return _0xd65572(_0x1b9843[_0xf97e('0xd')][_0xf97e('0xf')]);}else{logger[_0xf97e('0x8')](_0xf97e('0x9'),_0x450df3,'request\x20sent');_0xd65572(_0x1b9843[_0xf97e('0x10')][_0xf97e('0xf')]);}})[_0xf97e('0x11')](function(_0x51fde2){logger[_0xf97e('0xd')](_0xf97e('0x9'),_0x450df3,_0x51fde2);_0x38c88b(_0x51fde2);});});}exports['GetCmHopperBlack']=function(_0x1ac413){var _0x9c7cb3=this;return new Promise(function(_0x4f2d25,_0x9371cd){return db[_0xf97e('0x12')][_0xf97e('0x13')]({'raw':_0x1ac413[_0xf97e('0x14')]?_0x1ac413[_0xf97e('0x14')][_0xf97e('0x15')]===undefined?!![]:![]:!![],'where':_0x1ac413[_0xf97e('0x14')]?_0x1ac413[_0xf97e('0x14')]['where']||null:null,'attributes':_0x1ac413[_0xf97e('0x14')]?_0x1ac413[_0xf97e('0x14')][_0xf97e('0x16')]||null:null,'limit':_0x1ac413[_0xf97e('0x14')]?_0x1ac413[_0xf97e('0x14')][_0xf97e('0x17')]||null:null,'include':_0x1ac413[_0xf97e('0x14')]?_0x1ac413['options']['include']?_['map'](_0x1ac413['options'][_0xf97e('0x18')],function(_0x2b0507){return{'model':db[_0x2b0507[_0xf97e('0x19')]],'as':_0x2b0507['as'],'attributes':_0x2b0507[_0xf97e('0x16')],'include':_0x2b0507[_0xf97e('0x18')]?_[_0xf97e('0x1a')](_0x2b0507[_0xf97e('0x18')],function(_0x583329){return{'model':db[_0x583329[_0xf97e('0x19')]],'as':_0x583329['as'],'attributes':_0x583329[_0xf97e('0x16')],'include':_0x583329[_0xf97e('0x18')]?_[_0xf97e('0x1a')](_0x583329[_0xf97e('0x18')],function(_0xbb009c){return{'model':db[_0xbb009c[_0xf97e('0x19')]],'as':_0xbb009c['as'],'attributes':_0xbb009c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x362a2e){logger[_0xf97e('0x8')]('GetCmHopperBlack',_0x1ac413);logger[_0xf97e('0xa')](_0xf97e('0x1b'),_0x1ac413,JSON[_0xf97e('0x1c')](_0x362a2e));_0x4f2d25(_0x362a2e);})[_0xf97e('0x11')](function(_0x14487b){logger[_0xf97e('0xd')](_0xf97e('0x1b'),_0x14487b[_0xf97e('0xf')],_0x1ac413);_0x9371cd(_0x9c7cb3[_0xf97e('0xd')](0x1f4,_0x14487b['message']));});});};exports['UpdateCmHopperBlack']=function(_0x151b47){var _0x528f8e=this;return new Promise(function(_0x53b96f,_0x229c86){return db[_0xf97e('0x12')][_0xf97e('0x1d')](_0x151b47[_0xf97e('0x1e')],{'raw':_0x151b47[_0xf97e('0x14')]?_0x151b47[_0xf97e('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x151b47['options']?_0x151b47[_0xf97e('0x14')]['where']||null:null,'attributes':_0x151b47['options']?_0x151b47[_0xf97e('0x14')][_0xf97e('0x16')]||null:null,'limit':_0x151b47['options']?_0x151b47[_0xf97e('0x14')][_0xf97e('0x17')]||null:null})['then'](function(_0x8f13c1){logger['info'](_0xf97e('0x1f'),_0x151b47);logger[_0xf97e('0xa')](_0xf97e('0x1f'),_0x151b47,JSON[_0xf97e('0x1c')](_0x8f13c1));_0x53b96f(_0x8f13c1);})[_0xf97e('0x11')](function(_0x500c56){logger['error'](_0xf97e('0x1f'),_0x500c56[_0xf97e('0xf')],_0x151b47);_0x229c86(_0x528f8e[_0xf97e('0xd')](0x1f4,_0x500c56['message']));});});};exports['DestroyCmHopperBlack']=function(_0x265ec9){var _0x3235f4=this;return new Promise(function(_0x2dc169,_0x2b9951){return db[_0xf97e('0x12')][_0xf97e('0x20')]({'where':_0x265ec9[_0xf97e('0x14')]?_0x265ec9[_0xf97e('0x14')]['where']||null:null})[_0xf97e('0x7')](function(_0x435b1e){logger[_0xf97e('0x8')](_0xf97e('0x21'),_0x265ec9);logger['debug'](_0xf97e('0x21'),_0x265ec9,JSON[_0xf97e('0x1c')](_0x435b1e));_0x2dc169(_0x435b1e);})[_0xf97e('0x11')](function(_0x3370d6){logger['error'](_0xf97e('0x21'),_0x3370d6[_0xf97e('0xf')],_0x265ec9);_0x2b9951(_0x3235f4['error'](0x1f4,_0x3370d6[_0xf97e('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index b127138..74abc7a 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 _0x1db9=['isAuthenticated','describe','put','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','/describe'];(function(_0x127283,_0x4158d6){var _0x5faf6a=function(_0x168d73){while(--_0x168d73){_0x127283['push'](_0x127283['shift']());}};_0x5faf6a(++_0x4158d6);}(_0x1db9,0x176));var _0x91db=function(_0x567cb9,_0xeb8d2b){_0x567cb9=_0x567cb9-0x0;var _0x319657=_0x1db9[_0x567cb9];return _0x319657;};'use strict';var multer=require(_0x91db('0x0'));var util=require(_0x91db('0x1'));var path=require(_0x91db('0x2'));var timeout=require(_0x91db('0x3'));var express=require(_0x91db('0x4'));var router=express[_0x91db('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x91db('0x6'));var interaction=require(_0x91db('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router[_0x91db('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x91db('0x8')](_0x91db('0x9'),auth[_0x91db('0xa')](),controller[_0x91db('0xb')]);router[_0x91db('0x8')]('/:id',auth[_0x91db('0xa')](),controller['show']);router[_0x91db('0xc')](_0x91db('0xd'),auth[_0x91db('0xa')](),controller['update']);router[_0x91db('0xe')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x91db('0xf')]=router; \ No newline at end of file +var _0xd117=['/describe','describe','/:id','show','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xd117,0x182));var _0x7d11=function(_0x67f95e,_0x3ca797){_0x67f95e=_0x67f95e-0x0;var _0x538f5a=_0xd117[_0x67f95e];return _0x538f5a;};'use strict';var multer=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var path=require(_0x7d11('0x2'));var timeout=require(_0x7d11('0x3'));var express=require(_0x7d11('0x4'));var router=express[_0x7d11('0x5')]();var fs_extra=require(_0x7d11('0x6'));var auth=require(_0x7d11('0x7'));var interaction=require(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var controller=require(_0x7d11('0xa'));router[_0x7d11('0xb')]('/',auth[_0x7d11('0xc')](),controller[_0x7d11('0xd')]);router[_0x7d11('0xb')](_0x7d11('0xe'),auth['isAuthenticated'](),controller[_0x7d11('0xf')]);router[_0x7d11('0xb')](_0x7d11('0x10'),auth['isAuthenticated'](),controller[_0x7d11('0x11')]);router[_0x7d11('0x12')](_0x7d11('0x10'),auth['isAuthenticated'](),controller[_0x7d11('0x13')]);router['delete']('/:id',auth[_0x7d11('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 99b1676..476ed70 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 _0xb3b6=['setDataValue','dispositionat','BOOLEAN','STRING','DATE','INTEGER','getDataValue','endtime','diff','seconds'];(function(_0x2ed806,_0x4e64aa){var _0x55f7aa=function(_0x139a81){while(--_0x139a81){_0x2ed806['push'](_0x2ed806['shift']());}};_0x55f7aa(++_0x4e64aa);}(_0xb3b6,0xe9));var _0x6b3b=function(_0x529a5f,_0x5db03e){_0x529a5f=_0x529a5f-0x0;var _0xc468da=_0xb3b6[_0x529a5f];return _0xc468da;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x6b3b('0x0')]},'scheduledat':{'type':Sequelize[_0x6b3b('0x1')]},'countbusyretry':{'type':Sequelize[_0x6b3b('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6b3b('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6b3b('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6b3b('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6b3b('0x0')]},'originatecalleridnum':{'type':Sequelize[_0x6b3b('0x0')]},'originatecalleridname':{'type':Sequelize[_0x6b3b('0x0')]},'calleridnum':{'type':Sequelize[_0x6b3b('0x0')]},'calleridname':{'type':Sequelize[_0x6b3b('0x0')]},'starttime':{'type':Sequelize[_0x6b3b('0x1')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x6b3b('0x1')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x6b3b('0x1')]},'ringtime':{'type':Sequelize[_0x6b3b('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6b3b('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6b3b('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6b3b('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6b3b('0x0')]},'campaign':{'type':Sequelize[_0x6b3b('0x0')]},'campaigntype':{'type':Sequelize[_0x6b3b('0x0')]},'membername':{'type':Sequelize[_0x6b3b('0x0')]},'reason':{'type':Sequelize[_0x6b3b('0x0')]},'disposition':{'type':Sequelize[_0x6b3b('0x0')]},'secondDisposition':{'type':Sequelize[_0x6b3b('0x0')]},'thirdDisposition':{'type':Sequelize[_0x6b3b('0x0')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x24f7cb){var _0x588029=this[_0x6b3b('0x3')](_0x6b3b('0x4'));if(_0x588029&&_0x24f7cb){this['setDataValue']('followuptime',moment(_0x24f7cb)[_0x6b3b('0x5')](moment(_0x588029),_0x6b3b('0x6')));}return this[_0x6b3b('0x7')](_0x6b3b('0x8'),_0x24f7cb);}},'amd':{'type':Sequelize[_0x6b3b('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6b3b('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x6b3b('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x6b3b('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x6b3b('0x1')]},'callback':{'type':Sequelize[_0x6b3b('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6b3b('0x0')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6b3b('0x1')]},'deleted':{'type':Sequelize[_0x6b3b('0x0')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x6b3b('0x1')]},'recallme':{'type':Sequelize[_0x6b3b('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x6b3b('0x1')]},'countnosuchnumberretry':{'type':Sequelize[_0x6b3b('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6b3b('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6b3b('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6b3b('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6b3b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2646=['setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','exports','INTEGER','STRING','DATE','getDataValue','endtime'];(function(_0x246835,_0x2f1312){var _0x2fb281=function(_0x15bdef){while(--_0x15bdef){_0x246835['push'](_0x246835['shift']());}};_0x2fb281(++_0x2f1312);}(_0x2646,0x1b6));var _0x6264=function(_0x11160d,_0x413adc){_0x11160d=_0x11160d-0x0;var _0x21520a=_0x2646[_0x11160d];return _0x21520a;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x6264('0x0')]={'state':{'type':Sequelize[_0x6264('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x6264('0x2')]},'scheduledat':{'type':Sequelize[_0x6264('0x3')]},'countbusyretry':{'type':Sequelize[_0x6264('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6264('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6264('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6264('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6264('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x6264('0x2')]},'originatecalleridname':{'type':Sequelize[_0x6264('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6264('0x2')]},'starttime':{'type':Sequelize[_0x6264('0x3')]},'responsetime':{'type':Sequelize[_0x6264('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x6264('0x3')]},'endtime':{'type':Sequelize[_0x6264('0x3')]},'ringtime':{'type':Sequelize[_0x6264('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6264('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6264('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6264('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6264('0x2')]},'campaign':{'type':Sequelize[_0x6264('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x6264('0x2')]},'disposition':{'type':Sequelize[_0x6264('0x2')]},'secondDisposition':{'type':Sequelize[_0x6264('0x2')]},'thirdDisposition':{'type':Sequelize[_0x6264('0x2')]},'dispositionat':{'type':Sequelize[_0x6264('0x3')],'set':function(_0x1f37c3){var _0x318d3a=this[_0x6264('0x4')](_0x6264('0x5'));if(_0x318d3a&&_0x1f37c3){this[_0x6264('0x6')](_0x6264('0x7'),moment(_0x1f37c3)[_0x6264('0x8')](moment(_0x318d3a),_0x6264('0x9')));}return this[_0x6264('0x6')](_0x6264('0xa'),_0x1f37c3);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x6264('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x6264('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6264('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6264('0x3')]},'deleted':{'type':Sequelize[_0x6264('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x6264('0x3')]},'recallme':{'type':Sequelize[_0x6264('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x6264('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x6264('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6264('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6264('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6264('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6264('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 7eaa89f..2748ca6 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 _0xbd51=['ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','updatedAt','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','from','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','then','includeAll','include','rows','show','params','keys','length','catch','describe','body','uniqueid','find','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','findAll','`state`\x20=\x208,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','VoiceQueueId','createdAt','select','field','ANY_VALUE(calleridnum)','NOW()','scheduledAt'];(function(_0x158e40,_0x40fa60){var _0x57b63c=function(_0x27a42f){while(--_0x27a42f){_0x158e40['push'](_0x158e40['shift']());}};_0x57b63c(++_0x40fa60);}(_0xbd51,0x1a8));var _0x1bd5=function(_0xb2823d,_0x2e1faf){_0xb2823d=_0xb2823d-0x0;var _0x112587=_0xbd51[_0xb2823d];return _0x112587;};'use strict';var emlformat=require(_0x1bd5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1bd5('0x1'));var jsonpatch=require(_0x1bd5('0x2'));var rp=require(_0x1bd5('0x3'));var moment=require(_0x1bd5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1bd5('0x5'));var csv=require(_0x1bd5('0x6'));var ejs=require(_0x1bd5('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1bd5('0x8'));var squel=require(_0x1bd5('0x9'));var crypto=require(_0x1bd5('0xa'));var jsforce=require(_0x1bd5('0xb'));var deskjs=require(_0x1bd5('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1bd5('0xd'));var Papa=require('papaparse');var Redis=require(_0x1bd5('0xe'));var authService=require(_0x1bd5('0xf'));var qs=require(_0x1bd5('0x10'));var as=require(_0x1bd5('0x11'));var hardwareService=require(_0x1bd5('0x12'));var logger=require(_0x1bd5('0x13'))('api');var utils=require(_0x1bd5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1bd5('0x15'));var db=require(_0x1bd5('0x16'))['db'];function respondWithStatusCode(_0x37e8e1,_0x14606b){_0x14606b=_0x14606b||0xcc;return function(_0x177be0){if(_0x177be0){return _0x37e8e1[_0x1bd5('0x17')](_0x14606b);}return _0x37e8e1[_0x1bd5('0x18')](_0x14606b)['end']();};}function respondWithResult(_0x5650b5,_0x8b2390){_0x8b2390=_0x8b2390||0xc8;return function(_0x6d2c40){if(_0x6d2c40){return _0x5650b5[_0x1bd5('0x18')](_0x8b2390)[_0x1bd5('0x19')](_0x6d2c40);}};}function respondWithFilteredResult(_0x48d048,_0x5072c2){return function(_0xa63190){if(_0xa63190){var _0xc7277e=typeof _0x5072c2[_0x1bd5('0x1a')]===_0x1bd5('0x1b')&&typeof _0x5072c2[_0x1bd5('0x1c')]===_0x1bd5('0x1b');var _0x13cf34=_0xa63190[_0x1bd5('0x1d')];var _0x4670b5=_0xc7277e?0x0:_0x5072c2['offset'];var _0x53ad5e=_0xc7277e?_0xa63190[_0x1bd5('0x1d')]:_0x5072c2[_0x1bd5('0x1a')]+_0x5072c2[_0x1bd5('0x1c')];var _0xb95d4e;if(_0x53ad5e>=_0x13cf34){_0x53ad5e=_0x13cf34;_0xb95d4e=0xc8;}else{_0xb95d4e=0xce;}_0x48d048[_0x1bd5('0x18')](_0xb95d4e);return _0x48d048[_0x1bd5('0x1e')](_0x1bd5('0x1f'),_0x4670b5+'-'+_0x53ad5e+'/'+_0x13cf34)[_0x1bd5('0x19')](_0xa63190);}return null;};}function patchUpdates(_0x456051){return function(_0xb1ac1e){try{jsonpatch[_0x1bd5('0x20')](_0xb1ac1e,_0x456051,!![]);}catch(_0x2447c4){return BPromise[_0x1bd5('0x21')](_0x2447c4);}return _0xb1ac1e[_0x1bd5('0x22')]();};}function saveUpdates(_0x253d79,_0x46c580){return function(_0x1f13e7){if(_0x1f13e7){return _0x1f13e7[_0x1bd5('0x23')](_0x253d79)['then'](function(_0x42c43d){return _0x42c43d;});}return null;};}function removeEntity(_0x50c663,_0x18fd18){return function(_0x1e534e){if(_0x1e534e){return _0x1e534e[_0x1bd5('0x24')]()['then'](function(){_0x50c663[_0x1bd5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ed551,_0x30676d){return function(_0x3dba4f){if(!_0x3dba4f){_0x2ed551[_0x1bd5('0x17')](0x194);}return _0x3dba4f;};}function handleError(_0x47c84b,_0x202ed3){_0x202ed3=_0x202ed3||0x1f4;return function(_0x69bb17){logger[_0x1bd5('0x25')](_0x69bb17[_0x1bd5('0x26')]);if(_0x69bb17['name']){delete _0x69bb17[_0x1bd5('0x27')];}_0x47c84b[_0x1bd5('0x18')](_0x202ed3)[_0x1bd5('0x28')](_0x69bb17);};}exports[_0x1bd5('0x29')]=function(_0xe54b9f,_0xc73670){var _0x4e72b2={},_0x289097={},_0x472b22={'count':0x0,'rows':[]};var _0x8d53ba=_['map'](db[_0x1bd5('0x2a')][_0x1bd5('0x2b')],function(_0x345181){return{'name':_0x345181[_0x1bd5('0x2c')],'type':_0x345181[_0x1bd5('0x2d')][_0x1bd5('0x2e')]};});_0x289097['model']=_['map'](_0x8d53ba,_0x1bd5('0x27'));_0x289097[_0x1bd5('0x2f')]=_['keys'](_0xe54b9f[_0x1bd5('0x2f')]);_0x289097[_0x1bd5('0x30')]=_[_0x1bd5('0x31')](_0x289097[_0x1bd5('0x32')],_0x289097['query']);_0x4e72b2[_0x1bd5('0x33')]=_[_0x1bd5('0x31')](_0x289097[_0x1bd5('0x32')],qs[_0x1bd5('0x34')](_0xe54b9f[_0x1bd5('0x2f')][_0x1bd5('0x34')]));_0x4e72b2[_0x1bd5('0x33')]=_0x4e72b2[_0x1bd5('0x33')]['length']?_0x4e72b2[_0x1bd5('0x33')]:_0x289097[_0x1bd5('0x32')];if(!_0xe54b9f[_0x1bd5('0x2f')][_0x1bd5('0x35')](_0x1bd5('0x36'))){_0x4e72b2[_0x1bd5('0x1c')]=qs[_0x1bd5('0x1c')](_0xe54b9f['query'][_0x1bd5('0x1c')]);_0x4e72b2[_0x1bd5('0x1a')]=qs[_0x1bd5('0x1a')](_0xe54b9f[_0x1bd5('0x2f')][_0x1bd5('0x1a')]);}_0x4e72b2[_0x1bd5('0x37')]=qs[_0x1bd5('0x38')](_0xe54b9f['query']['sort']);_0x4e72b2[_0x1bd5('0x39')]=qs[_0x1bd5('0x30')](_[_0x1bd5('0x3a')](_0xe54b9f['query'],_0x289097[_0x1bd5('0x30')]),_0x8d53ba);if(_0xe54b9f['query'][_0x1bd5('0x3b')]){_0x4e72b2[_0x1bd5('0x39')]=_[_0x1bd5('0x3c')](_0x4e72b2[_0x1bd5('0x39')],{'$or':_[_0x1bd5('0x3d')](_0x8d53ba,function(_0x2470ec){if(_0x2470ec[_0x1bd5('0x2d')]!==_0x1bd5('0x3e')){var _0x4bbefc={};_0x4bbefc[_0x2470ec[_0x1bd5('0x27')]]={'$like':'%'+_0xe54b9f[_0x1bd5('0x2f')]['filter']+'%'};return _0x4bbefc;}})});}_0x4e72b2=_[_0x1bd5('0x3c')]({},_0x4e72b2,_0xe54b9f[_0x1bd5('0x3f')]);var _0x20b25c={'where':_0x4e72b2['where']};return db[_0x1bd5('0x2a')][_0x1bd5('0x1d')](_0x20b25c)[_0x1bd5('0x40')](function(_0x4074f1){_0x472b22['count']=_0x4074f1;if(_0xe54b9f[_0x1bd5('0x2f')][_0x1bd5('0x41')]){_0x4e72b2[_0x1bd5('0x42')]=[{'all':!![]}];}return db[_0x1bd5('0x2a')]['findAll'](_0x4e72b2);})['then'](function(_0x40eeff){_0x472b22[_0x1bd5('0x43')]=_0x40eeff;return _0x472b22;})[_0x1bd5('0x40')](respondWithFilteredResult(_0xc73670,_0x4e72b2))['catch'](handleError(_0xc73670,null));};exports[_0x1bd5('0x44')]=function(_0x3b1092,_0x574d95){var _0x1eacac={'raw':!![],'where':{'id':_0x3b1092[_0x1bd5('0x45')]['id']}},_0x5761b8={};_0x5761b8[_0x1bd5('0x32')]=_['keys'](db[_0x1bd5('0x2a')][_0x1bd5('0x2b')]);_0x5761b8[_0x1bd5('0x2f')]=_[_0x1bd5('0x46')](_0x3b1092[_0x1bd5('0x2f')]);_0x5761b8[_0x1bd5('0x30')]=_[_0x1bd5('0x31')](_0x5761b8[_0x1bd5('0x32')],_0x5761b8[_0x1bd5('0x2f')]);_0x1eacac[_0x1bd5('0x33')]=_[_0x1bd5('0x31')](_0x5761b8[_0x1bd5('0x32')],qs['fields'](_0x3b1092[_0x1bd5('0x2f')][_0x1bd5('0x34')]));_0x1eacac[_0x1bd5('0x33')]=_0x1eacac['attributes'][_0x1bd5('0x47')]?_0x1eacac[_0x1bd5('0x33')]:_0x5761b8['model'];if(_0x3b1092[_0x1bd5('0x2f')]['includeAll']){_0x1eacac[_0x1bd5('0x42')]=[{'all':!![]}];}_0x1eacac=_['merge']({},_0x1eacac,_0x3b1092[_0x1bd5('0x3f')]);return db[_0x1bd5('0x2a')]['find'](_0x1eacac)[_0x1bd5('0x40')](handleEntityNotFound(_0x574d95,null))['then'](respondWithResult(_0x574d95,null))[_0x1bd5('0x48')](handleError(_0x574d95,null));};exports[_0x1bd5('0x49')]=function(_0x1a29f3,_0xe71454){return db[_0x1bd5('0x2a')][_0x1bd5('0x49')]()[_0x1bd5('0x40')](respondWithResult(_0xe71454,null))[_0x1bd5('0x48')](handleError(_0xe71454,null));};exports['update']=function(_0x13985e,_0x227a68){if(_0x13985e[_0x1bd5('0x4a')][_0x1bd5('0x4b')]){delete _0x13985e[_0x1bd5('0x4a')][_0x1bd5('0x4b')];}return db['CmHopperFinal'][_0x1bd5('0x4c')]({'where':{'uniqueid':_0x13985e[_0x1bd5('0x45')]['id']}})[_0x1bd5('0x40')](handleEntityNotFound(_0x227a68,null))[_0x1bd5('0x40')](saveUpdates(_0x13985e[_0x1bd5('0x4a')],null))[_0x1bd5('0x40')](respondWithResult(_0x227a68,null))[_0x1bd5('0x48')](handleError(_0x227a68,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x587c46,_0x126221,_0x2d713b){return db[_0x1bd5('0x2a')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x587c46[_0x1bd5('0x45')]['id']},'attributes':[[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x50')))),'noSuchContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')]['literal'](_0x1bd5('0x51')))),'noAnswerContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x52')))),_0x1bd5('0x53')],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db['sequelize'][_0x1bd5('0x4f')]('`state`\x20=\x208,\x201,\x20null'))),_0x1bd5('0x54')],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db['sequelize'][_0x1bd5('0x4f')](_0x1bd5('0x55')))),_0x1bd5('0x56')],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x57')))),_0x1bd5('0x58')],[db['sequelize']['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x59')))),'reCallContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db['sequelize'][_0x1bd5('0x4f')](_0x1bd5('0x5a')))),_0x1bd5('0x5b')]]})[_0x1bd5('0x40')](handleEntityNotFound(_0x126221,null))['then'](respondWithResult(_0x126221,null))['catch'](handleError(_0x126221,null));};exports[_0x1bd5('0x5c')]=function(_0xec9fac,_0x1790af,_0x54a8c4){return db['CmHopperFinal'][_0x1bd5('0x5d')]({'raw':![],'where':{'CampaignId':_0xec9fac['params']['id']},'attributes':[[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')]['literal'](_0x1bd5('0x50')))),'noSuchContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')]('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')]('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db['sequelize'][_0x1bd5('0x4f')](_0x1bd5('0x5e')))),'congestionContacts'],[db['sequelize']['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x55')))),'dropContacts'],[db[_0x1bd5('0x4d')]['fn']('COUNT',db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x57')))),'abandonedContacts'],[db['sequelize']['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x59')))),_0x1bd5('0x5f')],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x5a')))),_0x1bd5('0x5b')]]})[_0x1bd5('0x40')](handleEntityNotFound(_0x1790af,null))[_0x1bd5('0x40')](respondWithResult(_0x1790af,null))[_0x1bd5('0x48')](handleError(_0x1790af,null));};exports[_0x1bd5('0x60')]=function(_0x195176,_0x393a8f,_0x1ffbab){return db[_0x1bd5('0x61')][_0x1bd5('0x4c')]({'where':{'id':_0x195176[_0x1bd5('0x45')]['id']}})[_0x1bd5('0x40')](handleEntityNotFound(_0x393a8f,null))['then'](function(_0x3bd058){var _0x1d6223;if(_0x3bd058){_0x1d6223=squel[_0x1bd5('0x62')]()[_0x1bd5('0x63')](_0x1bd5('0x64'))[_0x1bd5('0x65')]([_0x1bd5('0x66'),'scheduledAt',_0x1bd5('0x67'),_0x1bd5('0x68'),_0x1bd5('0x69'),_0x1bd5('0x6a'),'updatedAt'],squel[_0x1bd5('0x6b')]()[_0x1bd5('0x6c')](_0x1bd5('0x6d'),_0x1bd5('0x66'))[_0x1bd5('0x6c')](_0x1bd5('0x6e'),_0x1bd5('0x6f'))['field'](_0x1bd5('0x70'),'ContactId')['field'](_0x1bd5('0x71'),'ListId')[_0x1bd5('0x6c')](_0x1bd5('0x72'),'VoiceQueueId')[_0x1bd5('0x6c')](_0x1bd5('0x6e'),_0x1bd5('0x6a'))[_0x1bd5('0x6c')](_0x1bd5('0x6e'),_0x1bd5('0x73'))['from'](_0x1bd5('0x74'))[_0x1bd5('0x39')](_0x1bd5('0x75'),_0x195176[_0x1bd5('0x45')]['id']['toString']())['where'](_0x1bd5('0x76'),_0x195176[_0x1bd5('0x4a')][_0x1bd5('0x77')][_0x1bd5('0x78')]())['where'](_0x1bd5('0x79'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x1bd5('0x6b')]()['field'](_0x1bd5('0x66'))[_0x1bd5('0x7a')](_0x1bd5('0x64'))[_0x1bd5('0x39')](_0x1bd5('0x75'),_0x195176[_0x1bd5('0x45')]['id'][_0x1bd5('0x78')]()))[_0x1bd5('0x39')](_0x1bd5('0x7b'),squel['select']()[_0x1bd5('0x6c')]('calleridnum')['from']('cm_hopper_final')[_0x1bd5('0x39')]('VoiceQueueId\x20=\x20?',_0x195176[_0x1bd5('0x45')]['id'][_0x1bd5('0x78')]())[_0x1bd5('0x39')](_0x1bd5('0x7c')))[_0x1bd5('0x7d')](_0x1bd5('0x67')))[_0x1bd5('0x78')]();return db['sequelize'][_0x1bd5('0x2f')](_0x1d6223);}return[];})['then'](respondWithResult(_0x393a8f,null))[_0x1bd5('0x48')](handleError(_0x393a8f,null));};exports[_0x1bd5('0x7e')]=function(_0x7d097,_0x50f2ac,_0x5db61c){return db[_0x1bd5('0x7f')]['find']({'where':{'id':_0x7d097[_0x1bd5('0x45')]['id']}})['then'](handleEntityNotFound(_0x50f2ac,null))[_0x1bd5('0x40')](function(_0x16f996){var _0x248d66;if(_0x16f996){_0x248d66=squel[_0x1bd5('0x62')]()[_0x1bd5('0x63')](_0x1bd5('0x64'))[_0x1bd5('0x65')]([_0x1bd5('0x66'),_0x1bd5('0x6f'),_0x1bd5('0x67'),_0x1bd5('0x68'),_0x1bd5('0x80'),_0x1bd5('0x6a'),_0x1bd5('0x73')],squel['select']()[_0x1bd5('0x6c')](_0x1bd5('0x6d'),_0x1bd5('0x66'))['field'](_0x1bd5('0x6e'),_0x1bd5('0x6f'))['field'](_0x1bd5('0x70'),_0x1bd5('0x67'))[_0x1bd5('0x6c')]('ANY_VALUE(ListId)',_0x1bd5('0x68'))[_0x1bd5('0x6c')](_0x1bd5('0x81'),_0x1bd5('0x80'))['field'](_0x1bd5('0x6e'),_0x1bd5('0x6a'))[_0x1bd5('0x6c')]('NOW()',_0x1bd5('0x73'))[_0x1bd5('0x7a')]('cm_hopper_final')['where'](_0x1bd5('0x82'),_0x7d097[_0x1bd5('0x45')]['id']['toString']())['where'](_0x1bd5('0x76'),_0x7d097['body']['state'][_0x1bd5('0x78')]())['where'](_0x1bd5('0x79'))[_0x1bd5('0x39')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x1bd5('0x6b')]()[_0x1bd5('0x6c')](_0x1bd5('0x66'))['from'](_0x1bd5('0x64'))['where'](_0x1bd5('0x82'),_0x7d097[_0x1bd5('0x45')]['id'][_0x1bd5('0x78')]()))[_0x1bd5('0x39')](_0x1bd5('0x7b'),squel['select']()[_0x1bd5('0x6c')]('calleridnum')[_0x1bd5('0x7a')]('cm_hopper_final')['where'](_0x1bd5('0x82'),_0x7d097[_0x1bd5('0x45')]['id'][_0x1bd5('0x78')]())[_0x1bd5('0x39')]('state\x20=\x204'))[_0x1bd5('0x7d')](_0x1bd5('0x67')))[_0x1bd5('0x78')]();return db[_0x1bd5('0x4d')][_0x1bd5('0x2f')](_0x248d66);}return[];})[_0x1bd5('0x40')](respondWithResult(_0x50f2ac,null))[_0x1bd5('0x48')](handleError(_0x50f2ac,null));};exports[_0x1bd5('0x83')]=function(_0x22e1f4,_0x347d06,_0x3cf023){return db[_0x1bd5('0x84')][_0x1bd5('0x85')]({'where':{'VoiceQueueId':_0x22e1f4[_0x1bd5('0x4a')]['VoiceQueueId'],'CampaignId':_0x22e1f4[_0x1bd5('0x4a')][_0x1bd5('0x80')],'ContactId':_0x22e1f4[_0x1bd5('0x4a')][_0x1bd5('0x67')]}})[_0x1bd5('0x40')](handleEntityNotFound(_0x347d06,null))[_0x1bd5('0x40')](function(_0x28f567){if(_0x28f567){return _0x28f567;}return null;})[_0x1bd5('0x40')](respondWithResult(_0x347d06,null))[_0x1bd5('0x48')](handleError(_0x347d06,null));}; \ No newline at end of file +var _0xadb5=['`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','noSuchContacts','VoiceQueue','find','insert','cm_hopper','fromQuery','phone','ContactId','ListId','createdAt','select','field','NOW()','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','updatedAt','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','state\x20=\x204','group','Campaign','into','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','VoiceQueueId','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','CmHopperFinal','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts'];(function(_0xa48503,_0x5f4d71){var _0x51e27d=function(_0xf68652){while(--_0xf68652){_0xa48503['push'](_0xa48503['shift']());}};_0x51e27d(++_0x5f4d71);}(_0xadb5,0xad));var _0x5adb=function(_0x12a6cb,_0x29ccd4){_0x12a6cb=_0x12a6cb-0x0;var _0x42184d=_0xadb5[_0x12a6cb];return _0x42184d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['CmHopperFinal']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'all':!![]}];}return db[_0x5adb('0x2a')][_0x5adb('0x40')](_0x5d457e);})['then'](function(_0x53f2c6){_0x1eac55[_0x5adb('0x41')]=_0x53f2c6;return _0x1eac55;})['then'](respondWithFilteredResult(_0x49992e,_0x5d457e))[_0x5adb('0x42')](handleError(_0x49992e,null));};exports[_0x5adb('0x43')]=function(_0x299746,_0x121714){var _0xdfecfd={'raw':!![],'where':{'id':_0x299746[_0x5adb('0x44')]['id']}},_0x522ee5={};_0x522ee5[_0x5adb('0x2e')]=_['keys'](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x522ee5['query']=_[_0x5adb('0x30')](_0x299746[_0x5adb('0x2f')]);_0x522ee5[_0x5adb('0x39')]=_[_0x5adb('0x31')](_0x522ee5[_0x5adb('0x2e')],_0x522ee5[_0x5adb('0x2f')]);_0xdfecfd[_0x5adb('0x32')]=_['intersection'](_0x522ee5['model'],qs[_0x5adb('0x33')](_0x299746[_0x5adb('0x2f')][_0x5adb('0x33')]));_0xdfecfd[_0x5adb('0x32')]=_0xdfecfd['attributes']['length']?_0xdfecfd[_0x5adb('0x32')]:_0x522ee5[_0x5adb('0x2e')];if(_0x299746[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0xdfecfd[_0x5adb('0x3f')]=[{'all':!![]}];}_0xdfecfd=_['merge']({},_0xdfecfd,_0x299746[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')]['find'](_0xdfecfd)[_0x5adb('0x22')](handleEntityNotFound(_0x121714,null))[_0x5adb('0x22')](respondWithResult(_0x121714,null))[_0x5adb('0x42')](handleError(_0x121714,null));};exports[_0x5adb('0x46')]=function(_0x186bd2,_0x3a5409){return db[_0x5adb('0x2a')][_0x5adb('0x46')]()['then'](respondWithResult(_0x3a5409,null))[_0x5adb('0x42')](handleError(_0x3a5409,null));};exports['update']=function(_0x51bc49,_0x5015ee){if(_0x51bc49[_0x5adb('0x47')][_0x5adb('0x48')]){delete _0x51bc49[_0x5adb('0x47')]['uniqueid'];}return db[_0x5adb('0x2a')]['find']({'where':{'uniqueid':_0x51bc49[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x5015ee,null))[_0x5adb('0x22')](saveUpdates(_0x51bc49['body'],null))[_0x5adb('0x22')](respondWithResult(_0x5015ee,null))['catch'](handleError(_0x5015ee,null));};exports[_0x5adb('0x49')]=function(_0x6dc067,_0x55c535,_0x2402a3){return db[_0x5adb('0x2a')][_0x5adb('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x6dc067[_0x5adb('0x44')]['id']},'attributes':[[db[_0x5adb('0x4a')]['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x4c')))),'noSuchContacts'],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db['sequelize'][_0x5adb('0x4b')](_0x5adb('0x4e')))),_0x5adb('0x4f')],[db[_0x5adb('0x4a')]['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x50')))),_0x5adb('0x51')],[db['sequelize']['fn'](_0x5adb('0x4d'),db['sequelize']['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x52')))),_0x5adb('0x53')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db['sequelize']['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x54')))),'dropContacts'],[db['sequelize']['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x55')))),_0x5adb('0x56')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x57')))),_0x5adb('0x58')],[db[_0x5adb('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x59')))),_0x5adb('0x5a')]]})['then'](handleEntityNotFound(_0x55c535,null))[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x42')](handleError(_0x55c535,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x5cb50e,_0x476e62,_0x1505f7){return db['CmHopperFinal'][_0x5adb('0x40')]({'raw':![],'where':{'CampaignId':_0x5cb50e[_0x5adb('0x44')]['id']},'attributes':[[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x4c')))),_0x5adb('0x5b')],[db[_0x5adb('0x4a')]['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')]('`state`\x20=\x203,\x201,\x20null'))),_0x5adb('0x4f')],[db['sequelize']['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x50')))),_0x5adb('0x51')],[db['sequelize']['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')]('`state`\x20=\x208,\x201,\x20null'))),_0x5adb('0x53')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x5adb('0x54')))),'dropContacts'],[db['sequelize']['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x55')))),_0x5adb('0x56')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x57')))),'reCallContacts'],[db['sequelize']['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x59')))),_0x5adb('0x5a')]]})[_0x5adb('0x22')](handleEntityNotFound(_0x476e62,null))[_0x5adb('0x22')](respondWithResult(_0x476e62,null))[_0x5adb('0x42')](handleError(_0x476e62,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x5e55c2,_0x1fc73b,_0x56df90){return db[_0x5adb('0x5c')][_0x5adb('0x5d')]({'where':{'id':_0x5e55c2[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x1fc73b,null))[_0x5adb('0x22')](function(_0x236f59){var _0x338aee;if(_0x236f59){_0x338aee=squel[_0x5adb('0x5e')]()['into'](_0x5adb('0x5f'))[_0x5adb('0x60')]([_0x5adb('0x61'),'scheduledAt',_0x5adb('0x62'),_0x5adb('0x63'),'VoiceQueueId',_0x5adb('0x64'),'updatedAt'],squel[_0x5adb('0x65')]()[_0x5adb('0x66')]('ANY_VALUE(calleridnum)',_0x5adb('0x61'))[_0x5adb('0x66')](_0x5adb('0x67'),_0x5adb('0x68'))[_0x5adb('0x66')](_0x5adb('0x69'),_0x5adb('0x62'))[_0x5adb('0x66')]('ANY_VALUE(ListId)',_0x5adb('0x63'))[_0x5adb('0x66')](_0x5adb('0x6a'),'VoiceQueueId')['field'](_0x5adb('0x67'),'createdAt')[_0x5adb('0x66')](_0x5adb('0x67'),_0x5adb('0x6b'))['from'](_0x5adb('0x6c'))[_0x5adb('0x37')](_0x5adb('0x6d'),_0x5e55c2[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]())['where'](_0x5adb('0x6f'),_0x5e55c2[_0x5adb('0x47')][_0x5adb('0x70')][_0x5adb('0x6e')]())['where'](_0x5adb('0x71'))[_0x5adb('0x37')](_0x5adb('0x72'),squel[_0x5adb('0x65')]()[_0x5adb('0x66')](_0x5adb('0x61'))[_0x5adb('0x73')]('cm_hopper')[_0x5adb('0x37')](_0x5adb('0x6d'),_0x5e55c2['params']['id'][_0x5adb('0x6e')]()))[_0x5adb('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x5adb('0x65')]()['field'](_0x5adb('0x74'))[_0x5adb('0x73')]('cm_hopper_final')[_0x5adb('0x37')]('VoiceQueueId\x20=\x20?',_0x5e55c2[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]())[_0x5adb('0x37')](_0x5adb('0x75')))[_0x5adb('0x76')]('ContactId'))[_0x5adb('0x6e')]();return db[_0x5adb('0x4a')][_0x5adb('0x2f')](_0x338aee);}return[];})[_0x5adb('0x22')](respondWithResult(_0x1fc73b,null))['catch'](handleError(_0x1fc73b,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x3f3db9,_0x461a07,_0x2e5c96){return db[_0x5adb('0x77')][_0x5adb('0x5d')]({'where':{'id':_0x3f3db9[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x461a07,null))['then'](function(_0xda26cc){var _0x14bada;if(_0xda26cc){_0x14bada=squel[_0x5adb('0x5e')]()[_0x5adb('0x78')]('cm_hopper')[_0x5adb('0x60')]([_0x5adb('0x61'),_0x5adb('0x68'),_0x5adb('0x62'),_0x5adb('0x63'),_0x5adb('0x79'),_0x5adb('0x64'),_0x5adb('0x6b')],squel[_0x5adb('0x65')]()['field'](_0x5adb('0x7a'),_0x5adb('0x61'))['field'](_0x5adb('0x67'),_0x5adb('0x68'))[_0x5adb('0x66')](_0x5adb('0x69'),_0x5adb('0x62'))[_0x5adb('0x66')](_0x5adb('0x7b'),_0x5adb('0x63'))['field'](_0x5adb('0x7c'),_0x5adb('0x79'))['field'](_0x5adb('0x67'),_0x5adb('0x64'))[_0x5adb('0x66')]('NOW()','updatedAt')[_0x5adb('0x73')](_0x5adb('0x6c'))[_0x5adb('0x37')]('CampaignId\x20=\x20?',_0x3f3db9[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]())[_0x5adb('0x37')](_0x5adb('0x6f'),_0x3f3db9[_0x5adb('0x47')][_0x5adb('0x70')][_0x5adb('0x6e')]())[_0x5adb('0x37')](_0x5adb('0x71'))[_0x5adb('0x37')](_0x5adb('0x72'),squel[_0x5adb('0x65')]()['field']('phone')[_0x5adb('0x73')](_0x5adb('0x5f'))['where'](_0x5adb('0x7d'),_0x3f3db9[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]()))[_0x5adb('0x37')](_0x5adb('0x72'),squel[_0x5adb('0x65')]()[_0x5adb('0x66')](_0x5adb('0x74'))[_0x5adb('0x73')]('cm_hopper_final')[_0x5adb('0x37')](_0x5adb('0x7d'),_0x3f3db9[_0x5adb('0x44')]['id']['toString']())[_0x5adb('0x37')](_0x5adb('0x75')))[_0x5adb('0x76')](_0x5adb('0x62')))[_0x5adb('0x6e')]();return db[_0x5adb('0x4a')]['query'](_0x14bada);}return[];})[_0x5adb('0x22')](respondWithResult(_0x461a07,null))[_0x5adb('0x42')](handleError(_0x461a07,null));};exports[_0x5adb('0x7e')]=function(_0x1e5532,_0x2c3af8,_0x3a201a){return db[_0x5adb('0x7f')][_0x5adb('0x80')]({'where':{'VoiceQueueId':_0x1e5532[_0x5adb('0x47')][_0x5adb('0x81')],'CampaignId':_0x1e5532['body'][_0x5adb('0x79')],'ContactId':_0x1e5532['body'][_0x5adb('0x62')]}})[_0x5adb('0x22')](handleEntityNotFound(_0x2c3af8,null))[_0x5adb('0x22')](function(_0x193a29){if(_0x193a29){return _0x193a29;}return null;})[_0x5adb('0x22')](respondWithResult(_0x2c3af8,null))['catch'](handleError(_0x2c3af8,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 690f696..507cc80 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 _0x0adc=['define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopperFinal.attributes'];(function(_0x22dc2c,_0x4829f3){var _0x327e50=function(_0x25a9d5){while(--_0x25a9d5){_0x22dc2c['push'](_0x22dc2c['shift']());}};_0x327e50(++_0x4829f3);}(_0x0adc,0x1e5));var _0xc0ad=function(_0xad727e,_0x1088d2){_0xad727e=_0xad727e-0x0;var _0xb1d7b2=_0x0adc[_0xad727e];return _0xb1d7b2;};'use strict';var _=require(_0xc0ad('0x0'));var util=require(_0xc0ad('0x1'));var logger=require(_0xc0ad('0x2'))(_0xc0ad('0x3'));var moment=require(_0xc0ad('0x4'));var BPromise=require(_0xc0ad('0x5'));var rp=require(_0xc0ad('0x6'));var fs=require('fs');var path=require(_0xc0ad('0x7'));var rimraf=require(_0xc0ad('0x8'));var config=require('../../config/environment');var attributes=require(_0xc0ad('0x9'));module['exports']=function(_0x8dfaf8,_0x2a500a){return _0x8dfaf8[_0xc0ad('0xa')](_0xc0ad('0xb'),attributes,{'tableName':_0xc0ad('0xc'),'paranoid':![],'indexes':[{'name':_0xc0ad('0xd'),'fields':[_0xc0ad('0xd')]},{'name':_0xc0ad('0xe'),'fields':[_0xc0ad('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8042=['moment','bluebird','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','CmHopperFinal','calleridnum','uniqueid','lodash','util','../../config/logger','api'];(function(_0x384ad0,_0x141eab){var _0x3713d1=function(_0x4820fd){while(--_0x4820fd){_0x384ad0['push'](_0x384ad0['shift']());}};_0x3713d1(++_0x141eab);}(_0x8042,0xce));var _0x2804=function(_0x275d85,_0x5a883e){_0x275d85=_0x275d85-0x0;var _0x3cd754=_0x8042[_0x275d85];return _0x3cd754;};'use strict';var _=require(_0x2804('0x0'));var util=require(_0x2804('0x1'));var logger=require(_0x2804('0x2'))(_0x2804('0x3'));var moment=require(_0x2804('0x4'));var BPromise=require(_0x2804('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2804('0x6'));var rimraf=require(_0x2804('0x7'));var config=require(_0x2804('0x8'));var attributes=require(_0x2804('0x9'));module[_0x2804('0xa')]=function(_0x237b49,_0x34ae66){return _0x237b49['define'](_0x2804('0xb'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x2804('0xc'),'fields':[_0x2804('0xc')]},{'name':_0x2804('0xd'),'fields':[_0x2804('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 63b8bcc..c151ceb 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x2adb30,_0x32650c){var _0x27f506=function(_0x4c0db0){while(--_0x4c0db0){_0x2adb30['push'](_0x2adb30['shift']());}};_0x27f506(++_0x32650c);}(_0xb10b,0x12a));var _0xbb10=function(_0x3e5d32,_0x19ce13){_0x3e5d32=_0x3e5d32-0x0;var _0x3e7822=_0xb10b[_0x3e5d32];return _0x3e7822;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x25727f,_0xbef3e8){var _0x5d7a32=function(_0x4abc7e){while(--_0x4abc7e){_0x25727f['push'](_0x25727f['shift']());}};_0x5d7a32(++_0xbef3e8);}(_0xb10b,0x12a));var _0xbb10=function(_0x1a15cd,_0x1b95c6){_0x1a15cd=_0x1a15cd-0x0;var _0x33f1eb=_0xb10b[_0x1a15cd];return _0x33f1eb;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 37b5a25..9c9bf68 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 _0xa168=['put','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper'];(function(_0x278a8f,_0x2cddc3){var _0x41b514=function(_0x4c9f66){while(--_0x4c9f66){_0x278a8f['push'](_0x278a8f['shift']());}};_0x41b514(++_0x2cddc3);}(_0xa168,0x95));var _0x8a16=function(_0x3eb671,_0x1f2c1d){_0x3eb671=_0x3eb671-0x0;var _0x41eac5=_0xa168[_0x3eb671];return _0x41eac5;};'use strict';var multer=require(_0x8a16('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8a16('0x1'));var express=require(_0x8a16('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8a16('0x3'));var interaction=require(_0x8a16('0x4'));var config=require(_0x8a16('0x5'));var controller=require('./cmHopperFinal.controller');router['get']('/',auth[_0x8a16('0x6')](),controller[_0x8a16('0x7')]);router['get'](_0x8a16('0x8'),auth[_0x8a16('0x6')](),controller[_0x8a16('0x9')]);router[_0x8a16('0xa')](_0x8a16('0xb'),auth[_0x8a16('0x6')](),controller['show']);router[_0x8a16('0xa')]('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller['countContactsQueueCampaignHopperFinal']);router[_0x8a16('0xa')](_0x8a16('0xc'),auth[_0x8a16('0x6')](),controller[_0x8a16('0xd')]);router[_0x8a16('0xe')]('/voice/queue/moveContacts/:id',auth[_0x8a16('0x6')](),controller[_0x8a16('0xf')]);router[_0x8a16('0xe')](_0x8a16('0x10'),auth[_0x8a16('0x6')](),controller['moveContactsIvrCampaignHopperFinal']);router['post'](_0x8a16('0x11'),auth[_0x8a16('0x6')](),controller[_0x8a16('0x12')]);router[_0x8a16('0x13')](_0x8a16('0xb'),auth[_0x8a16('0x6')](),controller['update']);module[_0x8a16('0x14')]=router; \ No newline at end of file +var _0x5a9a=['show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','update','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','/describe','isAuthenticated','/:id'];(function(_0x91fbc7,_0x207e4c){var _0x32a811=function(_0x3d6a42){while(--_0x3d6a42){_0x91fbc7['push'](_0x91fbc7['shift']());}};_0x32a811(++_0x207e4c);}(_0x5a9a,0x1ac));var _0xa5a9=function(_0x7bc9d8,_0x16284d){_0x7bc9d8=_0x7bc9d8-0x0;var _0x3fbe2e=_0x5a9a[_0x7bc9d8];return _0x3fbe2e;};'use strict';var multer=require(_0xa5a9('0x0'));var util=require(_0xa5a9('0x1'));var path=require(_0xa5a9('0x2'));var timeout=require(_0xa5a9('0x3'));var express=require(_0xa5a9('0x4'));var router=express['Router']();var fs_extra=require(_0xa5a9('0x5'));var auth=require(_0xa5a9('0x6'));var interaction=require(_0xa5a9('0x7'));var config=require(_0xa5a9('0x8'));var controller=require(_0xa5a9('0x9'));router[_0xa5a9('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa5a9('0xa')](_0xa5a9('0xb'),auth[_0xa5a9('0xc')](),controller['describe']);router['get'](_0xa5a9('0xd'),auth[_0xa5a9('0xc')](),controller[_0xa5a9('0xe')]);router[_0xa5a9('0xa')](_0xa5a9('0xf'),auth['isAuthenticated'](),controller[_0xa5a9('0x10')]);router[_0xa5a9('0xa')]('/campaign/countAttributes/:id',auth[_0xa5a9('0xc')](),controller[_0xa5a9('0x11')]);router[_0xa5a9('0x12')](_0xa5a9('0x13'),auth[_0xa5a9('0xc')](),controller[_0xa5a9('0x14')]);router['post'](_0xa5a9('0x15'),auth['isAuthenticated'](),controller[_0xa5a9('0x16')]);router[_0xa5a9('0x12')](_0xa5a9('0x17'),auth['isAuthenticated'](),controller['checkContactHopper']);router[_0xa5a9('0x18')](_0xa5a9('0xd'),auth[_0xa5a9('0xc')](),controller[_0xa5a9('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index ab649c9..bcbb974 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 _0x49b7=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x47a67b,_0x52042d){var _0x498d4f=function(_0x53a3ed){while(--_0x53a3ed){_0x47a67b['push'](_0x47a67b['shift']());}};_0x498d4f(++_0x52042d);}(_0x49b7,0x8d));var _0x749b=function(_0x2f48cd,_0x46a75a){_0x2f48cd=_0x2f48cd-0x0;var _0x193ae2=_0x49b7[_0x2f48cd];return _0x193ae2;};'use strict';var Sequelize=require(_0x749b('0x0'));module[_0x749b('0x1')]={'state':{'type':Sequelize[_0x749b('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x749b('0x3')]},'scheduledat':{'type':Sequelize[_0x749b('0x4')]},'countbusyretry':{'type':Sequelize[_0x749b('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x749b('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x749b('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x749b('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x749b('0x3')]},'calleridnum':{'type':Sequelize[_0x749b('0x3')]},'calleridname':{'type':Sequelize[_0x749b('0x3')]},'starttime':{'type':Sequelize[_0x749b('0x4')]},'responsetime':{'type':Sequelize[_0x749b('0x4')]},'answertime':{'type':Sequelize[_0x749b('0x4')]},'droptime':{'type':Sequelize[_0x749b('0x4')]},'endtime':{'type':Sequelize[_0x749b('0x4')]},'ringtime':{'type':Sequelize[_0x749b('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x749b('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x749b('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x749b('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x749b('0x3')]},'campaign':{'type':Sequelize[_0x749b('0x3')]},'campaigntype':{'type':Sequelize[_0x749b('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x749b('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x749b('0x4')]},'edited':{'type':Sequelize[_0x749b('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x749b('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x749b('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x749b('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x749b('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x749b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xec61=['sequelize','exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x469ac7,_0x38e416){var _0x22f3b0=function(_0x1a1447){while(--_0x1a1447){_0x469ac7['push'](_0x469ac7['shift']());}};_0x22f3b0(++_0x38e416);}(_0xec61,0x138));var _0x1ec6=function(_0x1c8317,_0x67e0a1){_0x1c8317=_0x1c8317-0x0;var _0x437418=_0xec61[_0x1c8317];return _0x437418;};'use strict';var Sequelize=require(_0x1ec6('0x0'));module[_0x1ec6('0x1')]={'state':{'type':Sequelize[_0x1ec6('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x1ec6('0x3')]},'scheduledat':{'type':Sequelize[_0x1ec6('0x4')]},'countbusyretry':{'type':Sequelize[_0x1ec6('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1ec6('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1ec6('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x1ec6('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x1ec6('0x3')]},'originatecalleridname':{'type':Sequelize[_0x1ec6('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x1ec6('0x3')]},'starttime':{'type':Sequelize[_0x1ec6('0x4')]},'responsetime':{'type':Sequelize[_0x1ec6('0x4')]},'answertime':{'type':Sequelize[_0x1ec6('0x4')]},'droptime':{'type':Sequelize[_0x1ec6('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x1ec6('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1ec6('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x1ec6('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x1ec6('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x1ec6('0x3')]},'membername':{'type':Sequelize[_0x1ec6('0x3')]},'reason':{'type':Sequelize[_0x1ec6('0x3')]},'amd':{'type':Sequelize[_0x1ec6('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x1ec6('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x1ec6('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x1ec6('0x4')]},'edited':{'type':Sequelize[_0x1ec6('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x1ec6('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1ec6('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1ec6('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1ec6('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1ec6('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index bbd1f0c..b5f63dd 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 _0xd883=['sendStatus','error','stack','name','send','index','map','CmHopperHistory','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','rawAttributes','keys','options','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','set','Content-Range','apply','update','then','destroy'];(function(_0x5a03fa,_0xcf3275){var _0x29e6c2=function(_0x10638b){while(--_0x10638b){_0x5a03fa['push'](_0x5a03fa['shift']());}};_0x29e6c2(++_0xcf3275);}(_0xd883,0xc8));var _0x3d88=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xd883[_0x5c2e3e];return _0x53f64a;};'use strict';var emlformat=require(_0x3d88('0x0'));var rimraf=require(_0x3d88('0x1'));var zipdir=require(_0x3d88('0x2'));var jsonpatch=require(_0x3d88('0x3'));var rp=require(_0x3d88('0x4'));var moment=require(_0x3d88('0x5'));var BPromise=require(_0x3d88('0x6'));var Mustache=require('mustache');var util=require(_0x3d88('0x7'));var path=require(_0x3d88('0x8'));var sox=require(_0x3d88('0x9'));var csv=require(_0x3d88('0xa'));var ejs=require(_0x3d88('0xb'));var fs=require('fs');var fs_extra=require(_0x3d88('0xc'));var _=require(_0x3d88('0xd'));var squel=require(_0x3d88('0xe'));var crypto=require(_0x3d88('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x3d88('0x10'));var toCsv=require('to-csv');var querystring=require(_0x3d88('0x11'));var Papa=require(_0x3d88('0x12'));var Redis=require(_0x3d88('0x13'));var authService=require(_0x3d88('0x14'));var qs=require(_0x3d88('0x15'));var as=require(_0x3d88('0x16'));var hardwareService=require(_0x3d88('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x3d88('0x18'));var config=require(_0x3d88('0x19'));var licenseUtil=require(_0x3d88('0x1a'));var db=require(_0x3d88('0x1b'))['db'];function respondWithStatusCode(_0x2923d8,_0x38057d){_0x38057d=_0x38057d||0xcc;return function(_0x1f4883){if(_0x1f4883){return _0x2923d8['sendStatus'](_0x38057d);}return _0x2923d8['status'](_0x38057d)[_0x3d88('0x1c')]();};}function respondWithResult(_0x5e9673,_0x3d18ee){_0x3d18ee=_0x3d18ee||0xc8;return function(_0x8b5a45){if(_0x8b5a45){return _0x5e9673[_0x3d88('0x1d')](_0x3d18ee)[_0x3d88('0x1e')](_0x8b5a45);}};}function respondWithFilteredResult(_0x592d05,_0x1aae4b){return function(_0x43a79e){if(_0x43a79e){var _0x19d74a=typeof _0x1aae4b[_0x3d88('0x1f')]===_0x3d88('0x20')&&typeof _0x1aae4b['limit']==='undefined';var _0x168716=_0x43a79e[_0x3d88('0x21')];var _0x5984fc=_0x19d74a?0x0:_0x1aae4b[_0x3d88('0x1f')];var _0x20cfea=_0x19d74a?_0x43a79e[_0x3d88('0x21')]:_0x1aae4b['offset']+_0x1aae4b['limit'];var _0x57d286;if(_0x20cfea>=_0x168716){_0x20cfea=_0x168716;_0x57d286=0xc8;}else{_0x57d286=0xce;}_0x592d05[_0x3d88('0x1d')](_0x57d286);return _0x592d05[_0x3d88('0x22')](_0x3d88('0x23'),_0x5984fc+'-'+_0x20cfea+'/'+_0x168716)[_0x3d88('0x1e')](_0x43a79e);}return null;};}function patchUpdates(_0x10d7c0){return function(_0x1e5c3c){try{jsonpatch[_0x3d88('0x24')](_0x1e5c3c,_0x10d7c0,!![]);}catch(_0x5c0b3a){return BPromise['reject'](_0x5c0b3a);}return _0x1e5c3c['save']();};}function saveUpdates(_0x138d8d,_0x5b8a61){return function(_0x699408){if(_0x699408){return _0x699408[_0x3d88('0x25')](_0x138d8d)[_0x3d88('0x26')](function(_0x387fcf){return _0x387fcf;});}return null;};}function removeEntity(_0x2f3387,_0x411460){return function(_0x351ed5){if(_0x351ed5){return _0x351ed5[_0x3d88('0x27')]()[_0x3d88('0x26')](function(){_0x2f3387[_0x3d88('0x1d')](0xcc)[_0x3d88('0x1c')]();});}};}function handleEntityNotFound(_0x384205,_0x5e0cec){return function(_0x53eef2){if(!_0x53eef2){_0x384205[_0x3d88('0x28')](0x194);}return _0x53eef2;};}function handleError(_0xed8f1d,_0x1e4209){_0x1e4209=_0x1e4209||0x1f4;return function(_0x42ee1e){logger[_0x3d88('0x29')](_0x42ee1e[_0x3d88('0x2a')]);if(_0x42ee1e[_0x3d88('0x2b')]){delete _0x42ee1e[_0x3d88('0x2b')];}_0xed8f1d[_0x3d88('0x1d')](_0x1e4209)[_0x3d88('0x2c')](_0x42ee1e);};}exports[_0x3d88('0x2d')]=function(_0x363f8d,_0x56ef60){var _0x5f5013={},_0x43922f={},_0x56983d={'count':0x0,'rows':[]};var _0x1c858c=_[_0x3d88('0x2e')](db[_0x3d88('0x2f')]['rawAttributes'],function(_0x41becd){return{'name':_0x41becd[_0x3d88('0x30')],'type':_0x41becd[_0x3d88('0x31')]['key']};});_0x43922f['model']=_['map'](_0x1c858c,_0x3d88('0x2b'));_0x43922f[_0x3d88('0x32')]=_['keys'](_0x363f8d[_0x3d88('0x32')]);_0x43922f[_0x3d88('0x33')]=_[_0x3d88('0x34')](_0x43922f[_0x3d88('0x35')],_0x43922f[_0x3d88('0x32')]);_0x5f5013[_0x3d88('0x36')]=_['intersection'](_0x43922f['model'],qs['fields'](_0x363f8d['query'][_0x3d88('0x37')]));_0x5f5013[_0x3d88('0x36')]=_0x5f5013['attributes'][_0x3d88('0x38')]?_0x5f5013[_0x3d88('0x36')]:_0x43922f[_0x3d88('0x35')];if(!_0x363f8d[_0x3d88('0x32')][_0x3d88('0x39')](_0x3d88('0x3a'))){_0x5f5013[_0x3d88('0x3b')]=qs[_0x3d88('0x3b')](_0x363f8d[_0x3d88('0x32')]['limit']);_0x5f5013['offset']=qs[_0x3d88('0x1f')](_0x363f8d[_0x3d88('0x32')][_0x3d88('0x1f')]);}_0x5f5013['order']=qs[_0x3d88('0x3c')](_0x363f8d[_0x3d88('0x32')][_0x3d88('0x3c')]);_0x5f5013[_0x3d88('0x3d')]=qs[_0x3d88('0x33')](_[_0x3d88('0x3e')](_0x363f8d[_0x3d88('0x32')],_0x43922f[_0x3d88('0x33')]),_0x1c858c);if(_0x363f8d[_0x3d88('0x32')][_0x3d88('0x3f')]){_0x5f5013[_0x3d88('0x3d')]=_[_0x3d88('0x40')](_0x5f5013['where'],{'$or':_[_0x3d88('0x2e')](_0x1c858c,function(_0x2477e5){if(_0x2477e5[_0x3d88('0x31')]!==_0x3d88('0x41')){var _0x3dac39={};_0x3dac39[_0x2477e5[_0x3d88('0x2b')]]={'$like':'%'+_0x363f8d[_0x3d88('0x32')][_0x3d88('0x3f')]+'%'};return _0x3dac39;}})});}_0x5f5013=_[_0x3d88('0x40')]({},_0x5f5013,_0x363f8d['options']);var _0x3c700d={'where':_0x5f5013[_0x3d88('0x3d')]};return db[_0x3d88('0x2f')][_0x3d88('0x21')](_0x3c700d)['then'](function(_0x3a9cf6){_0x56983d[_0x3d88('0x21')]=_0x3a9cf6;if(_0x363f8d[_0x3d88('0x32')][_0x3d88('0x42')]){_0x5f5013[_0x3d88('0x43')]=[{'all':!![]}];}return db[_0x3d88('0x2f')]['findAll'](_0x5f5013);})[_0x3d88('0x26')](function(_0x23ff30){_0x56983d[_0x3d88('0x44')]=_0x23ff30;return _0x56983d;})[_0x3d88('0x26')](respondWithFilteredResult(_0x56ef60,_0x5f5013))[_0x3d88('0x45')](handleError(_0x56ef60,null));};exports[_0x3d88('0x46')]=function(_0x3f4da5,_0x502bc6){var _0x11c5ca={'raw':!![],'where':{'id':_0x3f4da5[_0x3d88('0x47')]['id']}},_0x78786b={};_0x78786b[_0x3d88('0x35')]=_['keys'](db[_0x3d88('0x2f')][_0x3d88('0x48')]);_0x78786b[_0x3d88('0x32')]=_[_0x3d88('0x49')](_0x3f4da5[_0x3d88('0x32')]);_0x78786b[_0x3d88('0x33')]=_['intersection'](_0x78786b[_0x3d88('0x35')],_0x78786b[_0x3d88('0x32')]);_0x11c5ca['attributes']=_['intersection'](_0x78786b[_0x3d88('0x35')],qs[_0x3d88('0x37')](_0x3f4da5[_0x3d88('0x32')][_0x3d88('0x37')]));_0x11c5ca[_0x3d88('0x36')]=_0x11c5ca['attributes'][_0x3d88('0x38')]?_0x11c5ca[_0x3d88('0x36')]:_0x78786b[_0x3d88('0x35')];if(_0x3f4da5['query']['includeAll']){_0x11c5ca['include']=[{'all':!![]}];}_0x11c5ca=_[_0x3d88('0x40')]({},_0x11c5ca,_0x3f4da5[_0x3d88('0x4a')]);return db[_0x3d88('0x2f')][_0x3d88('0x4b')](_0x11c5ca)[_0x3d88('0x26')](handleEntityNotFound(_0x502bc6,null))[_0x3d88('0x26')](respondWithResult(_0x502bc6,null))['catch'](handleError(_0x502bc6,null));};exports[_0x3d88('0x4c')]=function(_0x3b33ca,_0x3af7a8){return db['CmHopperHistory'][_0x3d88('0x4c')](_0x3b33ca[_0x3d88('0x4d')],{})[_0x3d88('0x26')](respondWithResult(_0x3af7a8,0xc9))['catch'](handleError(_0x3af7a8,null));};exports['describe']=function(_0x47e823,_0xa28ff6){return db[_0x3d88('0x2f')][_0x3d88('0x4e')]()[_0x3d88('0x26')](respondWithResult(_0xa28ff6,null))[_0x3d88('0x45')](handleError(_0xa28ff6,null));};exports['update']=function(_0x3f35fe,_0x19271f){if(_0x3f35fe[_0x3d88('0x4d')]['uniqueid']){delete _0x3f35fe[_0x3d88('0x4d')][_0x3d88('0x4f')];}return db[_0x3d88('0x2f')][_0x3d88('0x4b')]({'where':{'uniqueid':_0x3f35fe[_0x3d88('0x47')]['id']}})['then'](handleEntityNotFound(_0x19271f,null))[_0x3d88('0x26')](saveUpdates(_0x3f35fe[_0x3d88('0x4d')],null))[_0x3d88('0x26')](respondWithResult(_0x19271f,null))[_0x3d88('0x45')](handleError(_0x19271f,null));}; \ No newline at end of file +var _0x1f7b=['offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','describe','body','uniqueid','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x1f7b,0xcd));var _0xb1f7=function(_0xcd4d8e,_0x1fc2fd){_0xcd4d8e=_0xcd4d8e-0x0;var _0x1c3c61=_0x1f7b[_0xcd4d8e];return _0x1c3c61;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb1f7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb1f7('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb1f7('0x2'));var Mustache=require(_0xb1f7('0x3'));var util=require(_0xb1f7('0x4'));var path=require(_0xb1f7('0x5'));var sox=require(_0xb1f7('0x6'));var csv=require(_0xb1f7('0x7'));var ejs=require(_0xb1f7('0x8'));var fs=require('fs');var fs_extra=require(_0xb1f7('0x9'));var _=require('lodash');var squel=require(_0xb1f7('0xa'));var crypto=require(_0xb1f7('0xb'));var jsforce=require(_0xb1f7('0xc'));var deskjs=require(_0xb1f7('0xd'));var toCsv=require(_0xb1f7('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb1f7('0xe'));var authService=require(_0xb1f7('0xf'));var qs=require(_0xb1f7('0x10'));var as=require(_0xb1f7('0x11'));var hardwareService=require(_0xb1f7('0x12'));var logger=require(_0xb1f7('0x13'))(_0xb1f7('0x14'));var utils=require(_0xb1f7('0x15'));var config=require(_0xb1f7('0x16'));var licenseUtil=require(_0xb1f7('0x17'));var db=require(_0xb1f7('0x18'))['db'];function respondWithStatusCode(_0x257dc8,_0x48dec7){_0x48dec7=_0x48dec7||0xcc;return function(_0xbfa0b1){if(_0xbfa0b1){return _0x257dc8[_0xb1f7('0x19')](_0x48dec7);}return _0x257dc8['status'](_0x48dec7)[_0xb1f7('0x1a')]();};}function respondWithResult(_0x3b05e7,_0x467f6c){_0x467f6c=_0x467f6c||0xc8;return function(_0xd0499d){if(_0xd0499d){return _0x3b05e7[_0xb1f7('0x1b')](_0x467f6c)[_0xb1f7('0x1c')](_0xd0499d);}};}function respondWithFilteredResult(_0x328c37,_0x533740){return function(_0x514850){if(_0x514850){var _0x5a745d=typeof _0x533740[_0xb1f7('0x1d')]===_0xb1f7('0x1e')&&typeof _0x533740['limit']===_0xb1f7('0x1e');var _0x1be2c6=_0x514850[_0xb1f7('0x1f')];var _0x4dcd09=_0x5a745d?0x0:_0x533740[_0xb1f7('0x1d')];var _0x13de2b=_0x5a745d?_0x514850['count']:_0x533740[_0xb1f7('0x1d')]+_0x533740[_0xb1f7('0x20')];var _0x427a4d;if(_0x13de2b>=_0x1be2c6){_0x13de2b=_0x1be2c6;_0x427a4d=0xc8;}else{_0x427a4d=0xce;}_0x328c37[_0xb1f7('0x1b')](_0x427a4d);return _0x328c37[_0xb1f7('0x21')](_0xb1f7('0x22'),_0x4dcd09+'-'+_0x13de2b+'/'+_0x1be2c6)[_0xb1f7('0x1c')](_0x514850);}return null;};}function patchUpdates(_0x3aa5e6){return function(_0x26b2e7){try{jsonpatch['apply'](_0x26b2e7,_0x3aa5e6,!![]);}catch(_0xacdb7d){return BPromise['reject'](_0xacdb7d);}return _0x26b2e7[_0xb1f7('0x23')]();};}function saveUpdates(_0xf667e1,_0x17944e){return function(_0x210f63){if(_0x210f63){return _0x210f63[_0xb1f7('0x24')](_0xf667e1)[_0xb1f7('0x25')](function(_0x931c47){return _0x931c47;});}return null;};}function removeEntity(_0x254783,_0x5e3935){return function(_0x2e07ae){if(_0x2e07ae){return _0x2e07ae[_0xb1f7('0x26')]()[_0xb1f7('0x25')](function(){_0x254783['status'](0xcc)[_0xb1f7('0x1a')]();});}};}function handleEntityNotFound(_0x55437c,_0x421f20){return function(_0x7d1ffd){if(!_0x7d1ffd){_0x55437c['sendStatus'](0x194);}return _0x7d1ffd;};}function handleError(_0x526f51,_0x125de2){_0x125de2=_0x125de2||0x1f4;return function(_0x40637a){logger[_0xb1f7('0x27')](_0x40637a[_0xb1f7('0x28')]);if(_0x40637a[_0xb1f7('0x29')]){delete _0x40637a[_0xb1f7('0x29')];}_0x526f51['status'](_0x125de2)[_0xb1f7('0x2a')](_0x40637a);};}exports[_0xb1f7('0x2b')]=function(_0x3e85b3,_0x2a775b){var _0xf49588={},_0x4b0f95={},_0x5453ab={'count':0x0,'rows':[]};var _0x1f1df7=_[_0xb1f7('0x2c')](db[_0xb1f7('0x2d')][_0xb1f7('0x2e')],function(_0x191ca8){return{'name':_0x191ca8['fieldName'],'type':_0x191ca8[_0xb1f7('0x2f')][_0xb1f7('0x30')]};});_0x4b0f95[_0xb1f7('0x31')]=_[_0xb1f7('0x2c')](_0x1f1df7,_0xb1f7('0x29'));_0x4b0f95[_0xb1f7('0x32')]=_[_0xb1f7('0x33')](_0x3e85b3[_0xb1f7('0x32')]);_0x4b0f95['filters']=_[_0xb1f7('0x34')](_0x4b0f95[_0xb1f7('0x31')],_0x4b0f95[_0xb1f7('0x32')]);_0xf49588[_0xb1f7('0x35')]=_[_0xb1f7('0x34')](_0x4b0f95[_0xb1f7('0x31')],qs[_0xb1f7('0x36')](_0x3e85b3[_0xb1f7('0x32')][_0xb1f7('0x36')]));_0xf49588[_0xb1f7('0x35')]=_0xf49588['attributes'][_0xb1f7('0x37')]?_0xf49588[_0xb1f7('0x35')]:_0x4b0f95[_0xb1f7('0x31')];if(!_0x3e85b3[_0xb1f7('0x32')][_0xb1f7('0x38')](_0xb1f7('0x39'))){_0xf49588[_0xb1f7('0x20')]=qs[_0xb1f7('0x20')](_0x3e85b3[_0xb1f7('0x32')][_0xb1f7('0x20')]);_0xf49588[_0xb1f7('0x1d')]=qs[_0xb1f7('0x1d')](_0x3e85b3[_0xb1f7('0x32')][_0xb1f7('0x1d')]);}_0xf49588['order']=qs[_0xb1f7('0x3a')](_0x3e85b3[_0xb1f7('0x32')]['sort']);_0xf49588[_0xb1f7('0x3b')]=qs[_0xb1f7('0x3c')](_[_0xb1f7('0x3d')](_0x3e85b3[_0xb1f7('0x32')],_0x4b0f95[_0xb1f7('0x3c')]),_0x1f1df7);if(_0x3e85b3[_0xb1f7('0x32')][_0xb1f7('0x3e')]){_0xf49588[_0xb1f7('0x3b')]=_[_0xb1f7('0x3f')](_0xf49588[_0xb1f7('0x3b')],{'$or':_['map'](_0x1f1df7,function(_0x26be3a){if(_0x26be3a[_0xb1f7('0x2f')]!==_0xb1f7('0x40')){var _0x44c450={};_0x44c450[_0x26be3a[_0xb1f7('0x29')]]={'$like':'%'+_0x3e85b3['query']['filter']+'%'};return _0x44c450;}})});}_0xf49588=_['merge']({},_0xf49588,_0x3e85b3[_0xb1f7('0x41')]);var _0x47bbb2={'where':_0xf49588[_0xb1f7('0x3b')]};return db[_0xb1f7('0x2d')][_0xb1f7('0x1f')](_0x47bbb2)[_0xb1f7('0x25')](function(_0x1e18cf){_0x5453ab['count']=_0x1e18cf;if(_0x3e85b3[_0xb1f7('0x32')][_0xb1f7('0x42')]){_0xf49588[_0xb1f7('0x43')]=[{'all':!![]}];}return db[_0xb1f7('0x2d')][_0xb1f7('0x44')](_0xf49588);})[_0xb1f7('0x25')](function(_0x3108ae){_0x5453ab[_0xb1f7('0x45')]=_0x3108ae;return _0x5453ab;})[_0xb1f7('0x25')](respondWithFilteredResult(_0x2a775b,_0xf49588))[_0xb1f7('0x46')](handleError(_0x2a775b,null));};exports[_0xb1f7('0x47')]=function(_0x150e24,_0x4986f4){var _0x119c15={'raw':!![],'where':{'id':_0x150e24[_0xb1f7('0x48')]['id']}},_0x5b3ce0={};_0x5b3ce0['model']=_['keys'](db[_0xb1f7('0x2d')][_0xb1f7('0x2e')]);_0x5b3ce0['query']=_['keys'](_0x150e24[_0xb1f7('0x32')]);_0x5b3ce0[_0xb1f7('0x3c')]=_[_0xb1f7('0x34')](_0x5b3ce0[_0xb1f7('0x31')],_0x5b3ce0[_0xb1f7('0x32')]);_0x119c15[_0xb1f7('0x35')]=_['intersection'](_0x5b3ce0[_0xb1f7('0x31')],qs[_0xb1f7('0x36')](_0x150e24[_0xb1f7('0x32')]['fields']));_0x119c15[_0xb1f7('0x35')]=_0x119c15['attributes'][_0xb1f7('0x37')]?_0x119c15[_0xb1f7('0x35')]:_0x5b3ce0[_0xb1f7('0x31')];if(_0x150e24[_0xb1f7('0x32')][_0xb1f7('0x42')]){_0x119c15[_0xb1f7('0x43')]=[{'all':!![]}];}_0x119c15=_['merge']({},_0x119c15,_0x150e24[_0xb1f7('0x41')]);return db[_0xb1f7('0x2d')][_0xb1f7('0x49')](_0x119c15)[_0xb1f7('0x25')](handleEntityNotFound(_0x4986f4,null))['then'](respondWithResult(_0x4986f4,null))[_0xb1f7('0x46')](handleError(_0x4986f4,null));};exports[_0xb1f7('0x4a')]=function(_0x1fe210,_0x5dee12){return db['CmHopperHistory'][_0xb1f7('0x4a')](_0x1fe210['body'],{})[_0xb1f7('0x25')](respondWithResult(_0x5dee12,0xc9))[_0xb1f7('0x46')](handleError(_0x5dee12,null));};exports[_0xb1f7('0x4b')]=function(_0x21f656,_0x3140b0){return db['CmHopperHistory'][_0xb1f7('0x4b')]()[_0xb1f7('0x25')](respondWithResult(_0x3140b0,null))['catch'](handleError(_0x3140b0,null));};exports[_0xb1f7('0x24')]=function(_0x3bd1f7,_0x5f4e70){if(_0x3bd1f7[_0xb1f7('0x4c')][_0xb1f7('0x4d')]){delete _0x3bd1f7[_0xb1f7('0x4c')]['uniqueid'];}return db[_0xb1f7('0x2d')][_0xb1f7('0x49')]({'where':{'uniqueid':_0x3bd1f7[_0xb1f7('0x48')]['id']}})['then'](handleEntityNotFound(_0x5f4e70,null))[_0xb1f7('0x25')](saveUpdates(_0x3bd1f7[_0xb1f7('0x4c')],null))[_0xb1f7('0x25')](respondWithResult(_0x5f4e70,null))['catch'](handleError(_0x5f4e70,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index fcaf3fa..6070f48 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 _0xf65d=['cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','exports','define'];(function(_0x14bfbf,_0x552595){var _0x3a29d4=function(_0x1fae62){while(--_0x1fae62){_0x14bfbf['push'](_0x14bfbf['shift']());}};_0x3a29d4(++_0x552595);}(_0xf65d,0x9f));var _0xdf65=function(_0x3f0743,_0x19c784){_0x3f0743=_0x3f0743-0x0;var _0x291c35=_0xf65d[_0x3f0743];return _0x291c35;};'use strict';var _=require(_0xdf65('0x0'));var util=require('util');var logger=require(_0xdf65('0x1'))(_0xdf65('0x2'));var moment=require(_0xdf65('0x3'));var BPromise=require(_0xdf65('0x4'));var rp=require(_0xdf65('0x5'));var fs=require('fs');var path=require(_0xdf65('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module[_0xdf65('0x7')]=function(_0x4ac44a,_0x254ddf){return _0x4ac44a[_0xdf65('0x8')]('CmHopperHistory',attributes,{'tableName':_0xdf65('0x9'),'paranoid':![],'indexes':[{'name':_0xdf65('0xa'),'fields':[_0xdf65('0xa')]},{'name':_0xdf65('0xb'),'fields':[_0xdf65('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xde1a=['uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopperHistory.attributes','exports','define','CmHopperHistory','endtime'];(function(_0x39c8ae,_0x80f637){var _0x48fe5c=function(_0x5587dc){while(--_0x5587dc){_0x39c8ae['push'](_0x39c8ae['shift']());}};_0x48fe5c(++_0x80f637);}(_0xde1a,0xfd));var _0xade1=function(_0x43be84,_0x1e8c20){_0x43be84=_0x43be84-0x0;var _0xa3e03c=_0xde1a[_0x43be84];return _0xa3e03c;};'use strict';var _=require('lodash');var util=require(_0xade1('0x0'));var logger=require(_0xade1('0x1'))(_0xade1('0x2'));var moment=require(_0xade1('0x3'));var BPromise=require(_0xade1('0x4'));var rp=require(_0xade1('0x5'));var fs=require('fs');var path=require(_0xade1('0x6'));var rimraf=require(_0xade1('0x7'));var config=require('../../config/environment');var attributes=require(_0xade1('0x8'));module[_0xade1('0x9')]=function(_0x36721c,_0x983a27){return _0x36721c[_0xade1('0xa')](_0xade1('0xb'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xade1('0xc'),'fields':[_0xade1('0xc')]},{'name':_0xade1('0xd'),'fields':[_0xade1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 5c35e72..8874901 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 _0xb921=['outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','col','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','findAll','where','sequelize','COUNT','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','literal','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null'];(function(_0x3491f5,_0x222f0c){var _0x26e38a=function(_0x58392b){while(--_0x58392b){_0x3491f5['push'](_0x3491f5['shift']());}};_0x26e38a(++_0x222f0c);}(_0xb921,0x16a));var _0x1b92=function(_0x2c823e,_0x1067c9){_0x2c823e=_0x2c823e-0x0;var _0x21b297=_0xb921[_0x2c823e];return _0x21b297;};'use strict';var _=require(_0x1b92('0x0'));var util=require(_0x1b92('0x1'));var moment=require(_0x1b92('0x2'));var BPromise=require(_0x1b92('0x3'));var rs=require(_0x1b92('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1b92('0x5'));var logger=require(_0x1b92('0x6'))(_0x1b92('0x7'));var config=require(_0x1b92('0x8'));var jayson=require(_0x1b92('0x9'));var client=jayson[_0x1b92('0xa')][_0x1b92('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8a6282,_0x7973df,_0x352406){return new BPromise(function(_0x1545f9,_0x64a3ed){return client[_0x1b92('0xc')](_0x8a6282,_0x352406)[_0x1b92('0xd')](function(_0x4567ab){logger['info'](_0x1b92('0xe'),_0x7973df,_0x1b92('0xf'));logger[_0x1b92('0x10')](_0x1b92('0x11'),_0x7973df,_0x1b92('0xf'),JSON[_0x1b92('0x12')](_0x4567ab));if(_0x4567ab[_0x1b92('0x13')]){if(_0x4567ab['error'][_0x1b92('0x14')]===0x1f4){logger[_0x1b92('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x7973df,_0x4567ab[_0x1b92('0x13')][_0x1b92('0x15')]);return _0x64a3ed(_0x4567ab[_0x1b92('0x13')][_0x1b92('0x15')]);}logger[_0x1b92('0x13')](_0x1b92('0xe'),_0x7973df,_0x4567ab[_0x1b92('0x13')]['message']);return _0x1545f9(_0x4567ab[_0x1b92('0x13')]['message']);}else{logger[_0x1b92('0x16')]('CmHopperHistory,\x20%s,\x20%s',_0x7973df,_0x1b92('0xf'));_0x1545f9(_0x4567ab['result'][_0x1b92('0x15')]);}})[_0x1b92('0x17')](function(_0x688aef){logger['error'](_0x1b92('0xe'),_0x7973df,_0x688aef);_0x64a3ed(_0x688aef);});});}exports[_0x1b92('0x18')]=function(_0x289523){var _0xf62817=this;return new Promise(function(_0x4368dc,_0x5010cd){return db[_0x1b92('0x19')][_0x1b92('0x1a')](_0x289523[_0x1b92('0x1b')],{'raw':_0x289523['options']?_0x289523[_0x1b92('0x1c')][_0x1b92('0x1d')]===undefined?!![]:![]:!![]})[_0x1b92('0xd')](function(_0x4bfc51){logger[_0x1b92('0x16')]('CreateCmHopperHistory',_0x289523);logger[_0x1b92('0x10')](_0x1b92('0x18'),_0x289523,JSON['stringify'](_0x4bfc51));_0x4368dc(_0x4bfc51);})['catch'](function(_0x34c5c9){logger[_0x1b92('0x13')](_0x1b92('0x18'),_0x34c5c9[_0x1b92('0x15')],_0x289523);_0x5010cd(_0xf62817[_0x1b92('0x13')](0x1f4,_0x34c5c9[_0x1b92('0x15')]));});});};exports['AvgHandleTime']=function(_0x3be220){var _0x1dcdd5=this;return new Promise(function(_0x2c8580,_0x39dcaa){return db['CmHopperHistory'][_0x1b92('0x1e')]({'raw':_0x3be220['options']?_0x3be220[_0x1b92('0x1c')][_0x1b92('0x1d')]===undefined?!![]:![]:!![],'where':_0x3be220[_0x1b92('0x1c')]?_0x3be220[_0x1b92('0x1c')][_0x1b92('0x1f')]||null:null,'attributes':[[db[_0x1b92('0x20')]['fn'](_0x1b92('0x21'),db[_0x1b92('0x20')]['col']('id')),'predictiveIntervalTotalCalls'],[db['sequelize']['fn'](_0x1b92('0x21'),db['sequelize']['fn']('IF',db[_0x1b92('0x20')]['literal'](_0x1b92('0x22')))),_0x1b92('0x23')],[db[_0x1b92('0x20')]['fn']('COUNT',db[_0x1b92('0x20')]['fn']('IF',db[_0x1b92('0x20')]['literal']('`state`\x20=\x2010,\x201,\x20null'))),_0x1b92('0x24')],[db[_0x1b92('0x20')]['fn'](_0x1b92('0x21'),db[_0x1b92('0x20')]['fn']('IF',db[_0x1b92('0x20')]['literal'](_0x1b92('0x25')))),_0x1b92('0x26')],[db[_0x1b92('0x20')]['fn'](_0x1b92('0x27'),db[_0x1b92('0x20')]['fn']('IF',db[_0x1b92('0x20')][_0x1b92('0x28')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x1b92('0x29')],[db[_0x1b92('0x20')]['fn']('AVG',db[_0x1b92('0x20')]['fn']('IF',db[_0x1b92('0x20')][_0x1b92('0x28')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x1b92('0x2a')]]})[_0x1b92('0xd')](function(_0x5cce14){logger['info'](_0x1b92('0x2b'),_0x3be220);logger[_0x1b92('0x10')](_0x1b92('0x2b'),_0x3be220,JSON[_0x1b92('0x12')](_0x5cce14));_0x2c8580(_0x5cce14);})['catch'](function(_0x5f0543){logger['error'](_0x1b92('0x2b'),_0x5f0543[_0x1b92('0x15')],_0x3be220);_0x39dcaa(_0x1dcdd5[_0x1b92('0x13')](0x1f4,_0x5f0543[_0x1b92('0x15')]));});});};exports[_0x1b92('0x2c')]=function(_0x258b34){var _0x3f629e=this;return new Promise(function(_0x55389f,_0x351ac0){return db[_0x1b92('0x19')]['findAll']({'raw':_0x258b34[_0x1b92('0x1c')]?_0x258b34[_0x1b92('0x1c')][_0x1b92('0x1d')]===undefined?!![]:![]:!![],'where':_0x258b34[_0x1b92('0x1c')]?_0x258b34[_0x1b92('0x1c')][_0x1b92('0x1f')]||null:null,'attributes':[[_0x1b92('0x2d'),_0x1b92('0x2e')],[db[_0x1b92('0x20')]['fn'](_0x1b92('0x21'),db['sequelize']['fn']('IF',db[_0x1b92('0x20')]['literal'](_0x1b92('0x2f')))),'outboundNoSuchCallsDay'],[db[_0x1b92('0x20')]['fn'](_0x1b92('0x21'),db[_0x1b92('0x20')]['fn']('IF',db[_0x1b92('0x20')][_0x1b92('0x28')](_0x1b92('0x30')))),_0x1b92('0x31')],[db[_0x1b92('0x20')]['fn'](_0x1b92('0x21'),db['sequelize']['fn']('IF',db[_0x1b92('0x20')]['literal'](_0x1b92('0x22')))),_0x1b92('0x32')],[db[_0x1b92('0x20')]['fn'](_0x1b92('0x21'),db['sequelize']['fn']('IF',db[_0x1b92('0x20')][_0x1b92('0x28')](_0x1b92('0x33')))),_0x1b92('0x34')],[db[_0x1b92('0x20')]['fn'](_0x1b92('0x21'),db['sequelize']['fn']('IF',db[_0x1b92('0x20')][_0x1b92('0x28')](_0x1b92('0x35')))),_0x1b92('0x36')],[db[_0x1b92('0x20')]['fn'](_0x1b92('0x21'),db['sequelize']['fn']('IF',db[_0x1b92('0x20')][_0x1b92('0x28')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x1b92('0x37')],[db['sequelize']['fn'](_0x1b92('0x21'),db[_0x1b92('0x20')]['fn']('IF',db[_0x1b92('0x20')]['literal'](_0x1b92('0x38')))),_0x1b92('0x39')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x1b92('0x20')][_0x1b92('0x28')](_0x1b92('0x3a')))),_0x1b92('0x3b')],[db[_0x1b92('0x20')]['fn'](_0x1b92('0x21'),db['sequelize']['fn']('IF',db[_0x1b92('0x20')][_0x1b92('0x28')]('`state`\x20=\x2013,\x201,\x20null'))),_0x1b92('0x3c')],[db[_0x1b92('0x20')]['fn'](_0x1b92('0x21'),db['sequelize']['fn']('IF',db[_0x1b92('0x20')][_0x1b92('0x28')](_0x1b92('0x3d')))),_0x1b92('0x3e')],[db[_0x1b92('0x20')]['fn']('COUNT',db[_0x1b92('0x20')]['fn']('IF',db[_0x1b92('0x20')][_0x1b92('0x28')](_0x1b92('0x3f')))),_0x1b92('0x40')],[db['sequelize']['fn']('COUNT',db[_0x1b92('0x20')]['fn']('IF',db[_0x1b92('0x20')][_0x1b92('0x28')](_0x1b92('0x41')))),'outboundAnswerAgiCallsDay'],[db[_0x1b92('0x20')]['fn'](_0x1b92('0x21'),db['sequelize']['fn']('IF',db[_0x1b92('0x20')][_0x1b92('0x28')](_0x1b92('0x42')))),'outboundRejectCallsDay'],[db[_0x1b92('0x20')]['fn'](_0x1b92('0x21'),db[_0x1b92('0x20')]['fn']('IF',db[_0x1b92('0x20')][_0x1b92('0x28')](_0x1b92('0x43')))),_0x1b92('0x44')]],'group':[_0x1b92('0x2d')]})['then'](function(_0x140202){logger['info'](_0x1b92('0x2c'),_0x258b34);logger[_0x1b92('0x10')](_0x1b92('0x2c'),_0x258b34,JSON[_0x1b92('0x12')](_0x140202));_0x55389f(_0x140202);})[_0x1b92('0x17')](function(_0x3cab8e){logger[_0x1b92('0x13')](_0x1b92('0x2c'),_0x3cab8e[_0x1b92('0x15')],_0x258b34);_0x351ac0(_0x3f629e[_0x1b92('0x13')](0x1f4,_0x3cab8e[_0x1b92('0x15')]));});});};exports[_0x1b92('0x45')]=function(_0x80e88b){var _0x181e03=this;return new Promise(function(_0x2304ef,_0x1e9888){return db[_0x1b92('0x19')][_0x1b92('0x1e')]({'raw':_0x80e88b[_0x1b92('0x1c')]?_0x80e88b[_0x1b92('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x80e88b[_0x1b92('0x1c')]?_0x80e88b[_0x1b92('0x1c')]['where']||null:null,'attributes':[[_0x1b92('0x2d'),_0x1b92('0x2e')],[db['sequelize']['fn']('COUNT',db[_0x1b92('0x20')][_0x1b92('0x46')]('id')),'ivrTotalCallsDays'],[db[_0x1b92('0x20')]['fn'](_0x1b92('0x21'),db[_0x1b92('0x20')]['fn']('IF',db[_0x1b92('0x20')][_0x1b92('0x28')](_0x1b92('0x22')))),'ivrAnswerCallsDay']],'group':[_0x1b92('0x2d')]})['then'](function(_0x4b5b60){logger[_0x1b92('0x16')](_0x1b92('0x45'),_0x80e88b);logger[_0x1b92('0x10')](_0x1b92('0x45'),_0x80e88b,JSON[_0x1b92('0x12')](_0x4b5b60));_0x2304ef(_0x4b5b60);})[_0x1b92('0x17')](function(_0x37c28d){logger[_0x1b92('0x13')](_0x1b92('0x45'),_0x37c28d[_0x1b92('0x15')],_0x80e88b);_0x1e9888(_0x181e03['error'](0x1f4,_0x37c28d[_0x1b92('0x15')]));});});}; \ No newline at end of file +var _0xf972=['error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','raw','debug','findAll','sequelize','COUNT','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','literal','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','where','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','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','`state`\x20=\x2018,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','name','`state`\x20=\x204,\x201,\x20null','ivrAnswerCallsDay','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','stringify'];(function(_0x4a3064,_0x3df0d){var _0x470f06=function(_0xeae47){while(--_0xeae47){_0x4a3064['push'](_0x4a3064['shift']());}};_0x470f06(++_0x3df0d);}(_0xf972,0x171));var _0x2f97=function(_0xa29bb5,_0x1837b6){_0xa29bb5=_0xa29bb5-0x0;var _0x2cb695=_0xf972[_0xa29bb5];return _0x2cb695;};'use strict';var _=require(_0x2f97('0x0'));var util=require('util');var moment=require(_0x2f97('0x1'));var BPromise=require(_0x2f97('0x2'));var rs=require(_0x2f97('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f97('0x4'))['db'];var utils=require(_0x2f97('0x5'));var logger=require('../../config/logger')(_0x2f97('0x6'));var config=require(_0x2f97('0x7'));var jayson=require(_0x2f97('0x8'));var client=jayson[_0x2f97('0x9')][_0x2f97('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x77824f,_0x3f872b,_0x322e02){return new BPromise(function(_0x11c897,_0x51eead){return client['request'](_0x77824f,_0x322e02)[_0x2f97('0xb')](function(_0x449290){logger[_0x2f97('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x3f872b,_0x2f97('0xd'));logger['debug']('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x3f872b,_0x2f97('0xd'),JSON[_0x2f97('0xe')](_0x449290));if(_0x449290[_0x2f97('0xf')]){if(_0x449290[_0x2f97('0xf')][_0x2f97('0x10')]===0x1f4){logger['error'](_0x2f97('0x11'),_0x3f872b,_0x449290[_0x2f97('0xf')][_0x2f97('0x12')]);return _0x51eead(_0x449290[_0x2f97('0xf')][_0x2f97('0x12')]);}logger[_0x2f97('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x3f872b,_0x449290['error'][_0x2f97('0x12')]);return _0x11c897(_0x449290[_0x2f97('0xf')][_0x2f97('0x12')]);}else{logger['info'](_0x2f97('0x11'),_0x3f872b,_0x2f97('0xd'));_0x11c897(_0x449290[_0x2f97('0x13')][_0x2f97('0x12')]);}})[_0x2f97('0x14')](function(_0xcccb2d){logger['error'](_0x2f97('0x11'),_0x3f872b,_0xcccb2d);_0x51eead(_0xcccb2d);});});}exports[_0x2f97('0x15')]=function(_0x1e97f2){var _0x4f6bb1=this;return new Promise(function(_0x52e1ab,_0x52d36e){return db[_0x2f97('0x16')][_0x2f97('0x17')](_0x1e97f2['body'],{'raw':_0x1e97f2[_0x2f97('0x18')]?_0x1e97f2['options'][_0x2f97('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x51a45a){logger[_0x2f97('0xc')](_0x2f97('0x15'),_0x1e97f2);logger[_0x2f97('0x1a')]('CreateCmHopperHistory',_0x1e97f2,JSON[_0x2f97('0xe')](_0x51a45a));_0x52e1ab(_0x51a45a);})['catch'](function(_0x39a332){logger['error'](_0x2f97('0x15'),_0x39a332[_0x2f97('0x12')],_0x1e97f2);_0x52d36e(_0x4f6bb1[_0x2f97('0xf')](0x1f4,_0x39a332['message']));});});};exports['AvgHandleTime']=function(_0x10c1c1){var _0x20a1d1=this;return new Promise(function(_0x388bf5,_0x114326){return db[_0x2f97('0x16')][_0x2f97('0x1b')]({'raw':_0x10c1c1[_0x2f97('0x18')]?_0x10c1c1[_0x2f97('0x18')][_0x2f97('0x19')]===undefined?!![]:![]:!![],'where':_0x10c1c1[_0x2f97('0x18')]?_0x10c1c1[_0x2f97('0x18')]['where']||null:null,'attributes':[[db[_0x2f97('0x1c')]['fn'](_0x2f97('0x1d'),db[_0x2f97('0x1c')]['col']('id')),'predictiveIntervalTotalCalls'],[db['sequelize']['fn'](_0x2f97('0x1d'),db[_0x2f97('0x1c')]['fn']('IF',db[_0x2f97('0x1c')]['literal']('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn'](_0x2f97('0x1d'),db['sequelize']['fn']('IF',db[_0x2f97('0x1c')]['literal'](_0x2f97('0x1e')))),_0x2f97('0x1f')],[db['sequelize']['fn'](_0x2f97('0x1d'),db['sequelize']['fn']('IF',db[_0x2f97('0x1c')][_0x2f97('0x20')](_0x2f97('0x21')))),_0x2f97('0x22')],[db['sequelize']['fn'](_0x2f97('0x23'),db[_0x2f97('0x1c')]['fn']('IF',db['sequelize'][_0x2f97('0x20')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),'predictiveIntervalAvgHoldtime'],[db[_0x2f97('0x1c')]['fn'](_0x2f97('0x23'),db[_0x2f97('0x1c')]['fn']('IF',db[_0x2f97('0x1c')]['literal'](_0x2f97('0x24')))),_0x2f97('0x25')]]})[_0x2f97('0xb')](function(_0xc3955e){logger[_0x2f97('0xc')]('AvgHandleTime',_0x10c1c1);logger['debug'](_0x2f97('0x26'),_0x10c1c1,JSON[_0x2f97('0xe')](_0xc3955e));_0x388bf5(_0xc3955e);})[_0x2f97('0x14')](function(_0x39c9c4){logger[_0x2f97('0xf')](_0x2f97('0x26'),_0x39c9c4[_0x2f97('0x12')],_0x10c1c1);_0x114326(_0x20a1d1[_0x2f97('0xf')](0x1f4,_0x39c9c4[_0x2f97('0x12')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x52612a){var _0x1535f8=this;return new Promise(function(_0x575907,_0x9b1322){return db[_0x2f97('0x16')][_0x2f97('0x1b')]({'raw':_0x52612a[_0x2f97('0x18')]?_0x52612a[_0x2f97('0x18')][_0x2f97('0x19')]===undefined?!![]:![]:!![],'where':_0x52612a['options']?_0x52612a[_0x2f97('0x18')][_0x2f97('0x27')]||null:null,'attributes':[[_0x2f97('0x28'),'name'],[db['sequelize']['fn']('COUNT',db[_0x2f97('0x1c')]['fn']('IF',db[_0x2f97('0x1c')]['literal'](_0x2f97('0x29')))),_0x2f97('0x2a')],[db[_0x2f97('0x1c')]['fn']('COUNT',db[_0x2f97('0x1c')]['fn']('IF',db[_0x2f97('0x1c')][_0x2f97('0x20')](_0x2f97('0x2b')))),'outboundNoAnswerCallsDay'],[db['sequelize']['fn'](_0x2f97('0x1d'),db[_0x2f97('0x1c')]['fn']('IF',db[_0x2f97('0x1c')][_0x2f97('0x20')]('`state`\x20=\x204,\x201,\x20null'))),_0x2f97('0x2c')],[db[_0x2f97('0x1c')]['fn'](_0x2f97('0x1d'),db['sequelize']['fn']('IF',db[_0x2f97('0x1c')]['literal'](_0x2f97('0x2d')))),_0x2f97('0x2e')],[db[_0x2f97('0x1c')]['fn']('COUNT',db[_0x2f97('0x1c')]['fn']('IF',db[_0x2f97('0x1c')]['literal'](_0x2f97('0x2f')))),_0x2f97('0x30')],[db[_0x2f97('0x1c')]['fn'](_0x2f97('0x1d'),db[_0x2f97('0x1c')]['fn']('IF',db[_0x2f97('0x1c')]['literal'](_0x2f97('0x31')))),_0x2f97('0x32')],[db['sequelize']['fn'](_0x2f97('0x1d'),db[_0x2f97('0x1c')]['fn']('IF',db[_0x2f97('0x1c')][_0x2f97('0x20')](_0x2f97('0x33')))),_0x2f97('0x34')],[db['sequelize']['fn'](_0x2f97('0x1d'),db['sequelize']['fn']('IF',db[_0x2f97('0x1c')]['literal'](_0x2f97('0x35')))),_0x2f97('0x36')],[db[_0x2f97('0x1c')]['fn'](_0x2f97('0x1d'),db['sequelize']['fn']('IF',db[_0x2f97('0x1c')][_0x2f97('0x20')]('`state`\x20=\x2013,\x201,\x20null'))),'outboundBlacklistCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x2f97('0x1c')]['fn']('IF',db[_0x2f97('0x1c')]['literal']('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db[_0x2f97('0x1c')]['fn'](_0x2f97('0x1d'),db[_0x2f97('0x1c')]['fn']('IF',db[_0x2f97('0x1c')][_0x2f97('0x20')](_0x2f97('0x37')))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x2f97('0x1d'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2016,\x201,\x20null'))),_0x2f97('0x38')],[db[_0x2f97('0x1c')]['fn'](_0x2f97('0x1d'),db[_0x2f97('0x1c')]['fn']('IF',db[_0x2f97('0x1c')]['literal']('`state`\x20=\x2020,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0x2f97('0x1c')]['fn'](_0x2f97('0x1d'),db[_0x2f97('0x1c')]['fn']('IF',db[_0x2f97('0x1c')][_0x2f97('0x20')](_0x2f97('0x39')))),_0x2f97('0x3a')]],'group':[_0x2f97('0x28')]})[_0x2f97('0xb')](function(_0x54c2a4){logger[_0x2f97('0xc')](_0x2f97('0x3b'),_0x52612a);logger[_0x2f97('0x1a')](_0x2f97('0x3b'),_0x52612a,JSON[_0x2f97('0xe')](_0x54c2a4));_0x575907(_0x54c2a4);})[_0x2f97('0x14')](function(_0x3a01da){logger['error']('GetVoiceQueueHopperHistory',_0x3a01da['message'],_0x52612a);_0x9b1322(_0x1535f8[_0x2f97('0xf')](0x1f4,_0x3a01da[_0x2f97('0x12')]));});});};exports[_0x2f97('0x3c')]=function(_0x58a05d){var _0x3f2d92=this;return new Promise(function(_0x3ffa70,_0x681298){return db[_0x2f97('0x16')][_0x2f97('0x1b')]({'raw':_0x58a05d[_0x2f97('0x18')]?_0x58a05d[_0x2f97('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x58a05d[_0x2f97('0x18')]?_0x58a05d[_0x2f97('0x18')][_0x2f97('0x27')]||null:null,'attributes':[[_0x2f97('0x28'),_0x2f97('0x3d')],[db[_0x2f97('0x1c')]['fn'](_0x2f97('0x1d'),db[_0x2f97('0x1c')]['col']('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0x2f97('0x1d'),db[_0x2f97('0x1c')]['fn']('IF',db[_0x2f97('0x1c')][_0x2f97('0x20')](_0x2f97('0x3e')))),_0x2f97('0x3f')]],'group':[_0x2f97('0x28')]})[_0x2f97('0xb')](function(_0x5ec0e6){logger[_0x2f97('0xc')]('GetCampaignHopperHistory',_0x58a05d);logger[_0x2f97('0x1a')](_0x2f97('0x3c'),_0x58a05d,JSON['stringify'](_0x5ec0e6));_0x3ffa70(_0x5ec0e6);})['catch'](function(_0x150e20){logger[_0x2f97('0xf')](_0x2f97('0x3c'),_0x150e20[_0x2f97('0x12')],_0x58a05d);_0x681298(_0x3f2d92['error'](0x1f4,_0x150e20[_0x2f97('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index a1ce550..7f6640b 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 _0x46eb=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','multer'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x46eb,0x1cb));var _0xb46e=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x46eb[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0xb46e('0x0'));var util=require(_0xb46e('0x1'));var path=require(_0xb46e('0x2'));var timeout=require(_0xb46e('0x3'));var express=require(_0xb46e('0x4'));var router=express['Router']();var fs_extra=require(_0xb46e('0x5'));var auth=require(_0xb46e('0x6'));var interaction=require(_0xb46e('0x7'));var config=require('../../config/environment');var controller=require(_0xb46e('0x8'));router[_0xb46e('0x9')]('/',auth[_0xb46e('0xa')](),controller[_0xb46e('0xb')]);router[_0xb46e('0x9')](_0xb46e('0xc'),auth[_0xb46e('0xa')](),controller[_0xb46e('0xd')]);router[_0xb46e('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xb46e('0xe')]);router[_0xb46e('0xf')]('/',auth[_0xb46e('0xa')](),controller[_0xb46e('0x10')]);router[_0xb46e('0x11')](_0xb46e('0x12'),auth[_0xb46e('0xa')](),controller[_0xb46e('0x13')]);module['exports']=router; \ No newline at end of file +var _0xb2e0=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','post','put','exports','util','path','connect-timeout'];(function(_0x18491c,_0x127529){var _0x249764=function(_0x1cb3b1){while(--_0x1cb3b1){_0x18491c['push'](_0x18491c['shift']());}};_0x249764(++_0x127529);}(_0xb2e0,0x1cd));var _0x0b2e=function(_0x4b14e7,_0x14d83d){_0x4b14e7=_0x4b14e7-0x0;var _0x2a4a21=_0xb2e0[_0x4b14e7];return _0x2a4a21;};'use strict';var multer=require('multer');var util=require(_0x0b2e('0x0'));var path=require(_0x0b2e('0x1'));var timeout=require(_0x0b2e('0x2'));var express=require(_0x0b2e('0x3'));var router=express[_0x0b2e('0x4')]();var fs_extra=require(_0x0b2e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0b2e('0x6'));var config=require(_0x0b2e('0x7'));var controller=require('./cmHopperHistory.controller');router[_0x0b2e('0x8')]('/',auth[_0x0b2e('0x9')](),controller['index']);router[_0x0b2e('0x8')](_0x0b2e('0xa'),auth[_0x0b2e('0x9')](),controller['describe']);router[_0x0b2e('0x8')](_0x0b2e('0xb'),auth[_0x0b2e('0x9')](),controller[_0x0b2e('0xc')]);router[_0x0b2e('0xd')]('/',auth[_0x0b2e('0x9')](),controller['create']);router[_0x0b2e('0xe')]('/:id',auth[_0x0b2e('0x9')](),controller['update']);module[_0x0b2e('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index bc0ba49..fadc5bb 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 _0xc73a=['exports','STRING','name'];(function(_0x24bef4,_0x3c9d66){var _0x800c3a=function(_0x2ab5c2){while(--_0x2ab5c2){_0x24bef4['push'](_0x24bef4['shift']());}};_0x800c3a(++_0x3c9d66);}(_0xc73a,0x72));var _0xac73=function(_0x28d626,_0x52745f){_0x28d626=_0x28d626-0x0;var _0x8df84a=_0xc73a[_0x28d626];return _0x8df84a;};'use strict';var Sequelize=require('sequelize');module[_0xac73('0x0')]={'name':{'type':Sequelize[_0xac73('0x1')],'unique':_0xac73('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2fed=['sequelize','exports','STRING','name'];(function(_0x518a70,_0x513ab8){var _0x3aa358=function(_0x5a2243){while(--_0x5a2243){_0x518a70['push'](_0x518a70['shift']());}};_0x3aa358(++_0x513ab8);}(_0x2fed,0x7c));var _0xd2fe=function(_0x241e79,_0x113129){_0x241e79=_0x241e79-0x0;var _0x29f602=_0x2fed[_0x241e79];return _0x29f602;};'use strict';var Sequelize=require(_0xd2fe('0x0'));module[_0xd2fe('0x1')]={'name':{'type':Sequelize[_0xd2fe('0x2')],'unique':_0xd2fe('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd2fe('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 077209e..2834892 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 _0xc6f6=['stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addDisposition','ListId','Disposition','rows','removeDispositions','addContacts','tags','isArray','push','each','CmContact','omit','success','dataValues','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','raw','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','download','addCustomField','findOne','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','INTEGER','switch','addColumn','cf_%s','addAgents','ids','spread','emit','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','status','end','json','undefined','limit','offset','count','Content-Range','apply','save','update','then','get','Lists','destroy','sendStatus','error'];(function(_0x6b035c,_0x11d7cb){var _0x95b5f1=function(_0x31852f){while(--_0x31852f){_0x6b035c['push'](_0x6b035c['shift']());}};_0x95b5f1(++_0x11d7cb);}(_0xc6f6,0xeb));var _0x6c6f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc6f6[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x6c6f('0x0'));var rimraf=require(_0x6c6f('0x1'));var zipdir=require(_0x6c6f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6c6f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6c6f('0x4'));var util=require(_0x6c6f('0x5'));var path=require(_0x6c6f('0x6'));var sox=require(_0x6c6f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c6f('0x8'));var _=require(_0x6c6f('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6c6f('0xa'));var deskjs=require(_0x6c6f('0xb'));var toCsv=require(_0x6c6f('0xc'));var querystring=require(_0x6c6f('0xd'));var Papa=require(_0x6c6f('0xe'));var Redis=require(_0x6c6f('0xf'));var authService=require(_0x6c6f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6c6f('0x11'));var hardwareService=require(_0x6c6f('0x12'));var logger=require(_0x6c6f('0x13'))(_0x6c6f('0x14'));var utils=require(_0x6c6f('0x15'));var config=require(_0x6c6f('0x16'));var licenseUtil=require(_0x6c6f('0x17'));var db=require(_0x6c6f('0x18'))['db'];config['redis']=_[_0x6c6f('0x19')](config[_0x6c6f('0x1a')],{'host':_0x6c6f('0x1b'),'port':0x18eb});var socket=require(_0x6c6f('0x1c'))(new Redis(config[_0x6c6f('0x1a')]));require('./cmList.socket')[_0x6c6f('0x1d')](socket);function respondWithStatusCode(_0x4fc8a8,_0x182f8d){_0x182f8d=_0x182f8d||0xcc;return function(_0x309f9e){if(_0x309f9e){return _0x4fc8a8['sendStatus'](_0x182f8d);}return _0x4fc8a8[_0x6c6f('0x1e')](_0x182f8d)[_0x6c6f('0x1f')]();};}function respondWithResult(_0x2518cb,_0x31680e){_0x31680e=_0x31680e||0xc8;return function(_0x51a5ba){if(_0x51a5ba){return _0x2518cb['status'](_0x31680e)[_0x6c6f('0x20')](_0x51a5ba);}};}function respondWithFilteredResult(_0x42e65b,_0x404777){return function(_0x453607){if(_0x453607){var _0x3027e7=typeof _0x404777['offset']===_0x6c6f('0x21')&&typeof _0x404777[_0x6c6f('0x22')]===_0x6c6f('0x21');var _0x364e58=_0x453607['count'];var _0x2f780a=_0x3027e7?0x0:_0x404777[_0x6c6f('0x23')];var _0x203a6c=_0x3027e7?_0x453607[_0x6c6f('0x24')]:_0x404777[_0x6c6f('0x23')]+_0x404777[_0x6c6f('0x22')];var _0x2b2371;if(_0x203a6c>=_0x364e58){_0x203a6c=_0x364e58;_0x2b2371=0xc8;}else{_0x2b2371=0xce;}_0x42e65b[_0x6c6f('0x1e')](_0x2b2371);return _0x42e65b['set'](_0x6c6f('0x25'),_0x2f780a+'-'+_0x203a6c+'/'+_0x364e58)['json'](_0x453607);}return null;};}function patchUpdates(_0x14fad9){return function(_0x1f05c2){try{jsonpatch[_0x6c6f('0x26')](_0x1f05c2,_0x14fad9,!![]);}catch(_0x46e827){return BPromise['reject'](_0x46e827);}return _0x1f05c2[_0x6c6f('0x27')]();};}function saveUpdates(_0x1a1f07,_0x23d050){return function(_0x1bb70e){if(_0x1bb70e){return _0x1bb70e[_0x6c6f('0x28')](_0x1a1f07)[_0x6c6f('0x29')](function(_0x3e2d8d){return _0x3e2d8d;});}return null;};}function removeEntity(_0x1a9706,_0x41672c){return function(_0x9981cc){if(_0x9981cc){return _0x9981cc['destroy']()['then'](function(){var _0x44c2f5=_0x9981cc[_0x6c6f('0x2a')]({'plain':!![]});var _0x2c5134=_0x6c6f('0x2b');return db['UserProfileResource'][_0x6c6f('0x2c')]({'where':{'type':_0x2c5134,'resourceId':_0x44c2f5['id']}})['then'](function(){return _0x9981cc;});})[_0x6c6f('0x29')](function(){_0x1a9706['status'](0xcc)[_0x6c6f('0x1f')]();});}};}function handleEntityNotFound(_0x2aaabd,_0x4adc3d){return function(_0x232bad){if(!_0x232bad){_0x2aaabd[_0x6c6f('0x2d')](0x194);}return _0x232bad;};}function handleError(_0x2b1c01,_0x4ef29e){_0x4ef29e=_0x4ef29e||0x1f4;return function(_0x1cfde0){logger[_0x6c6f('0x2e')](_0x1cfde0[_0x6c6f('0x2f')]);if(_0x1cfde0[_0x6c6f('0x30')]){delete _0x1cfde0['name'];}_0x2b1c01[_0x6c6f('0x1e')](_0x4ef29e)[_0x6c6f('0x31')](_0x1cfde0);};}exports[_0x6c6f('0x32')]=function(_0x1f2f71,_0x11ef6d){var _0x5a72a8={},_0x1a333e={},_0x3f8140={'count':0x0,'rows':[]};var _0x488ba2=_[_0x6c6f('0x33')](db[_0x6c6f('0x34')][_0x6c6f('0x35')],function(_0x50d40d){return{'name':_0x50d40d[_0x6c6f('0x36')],'type':_0x50d40d[_0x6c6f('0x37')][_0x6c6f('0x38')]};});_0x1a333e['model']=_[_0x6c6f('0x33')](_0x488ba2,_0x6c6f('0x30'));_0x1a333e[_0x6c6f('0x39')]=_[_0x6c6f('0x3a')](_0x1f2f71[_0x6c6f('0x39')]);_0x1a333e[_0x6c6f('0x3b')]=_[_0x6c6f('0x3c')](_0x1a333e[_0x6c6f('0x3d')],_0x1a333e['query']);_0x5a72a8['attributes']=_[_0x6c6f('0x3c')](_0x1a333e[_0x6c6f('0x3d')],qs[_0x6c6f('0x3e')](_0x1f2f71[_0x6c6f('0x39')][_0x6c6f('0x3e')]));_0x5a72a8[_0x6c6f('0x3f')]=_0x5a72a8[_0x6c6f('0x3f')][_0x6c6f('0x40')]?_0x5a72a8['attributes']:_0x1a333e['model'];if(!_0x1f2f71[_0x6c6f('0x39')][_0x6c6f('0x41')](_0x6c6f('0x42'))){_0x5a72a8[_0x6c6f('0x22')]=qs[_0x6c6f('0x22')](_0x1f2f71['query'][_0x6c6f('0x22')]);_0x5a72a8['offset']=qs[_0x6c6f('0x23')](_0x1f2f71[_0x6c6f('0x39')]['offset']);}_0x5a72a8[_0x6c6f('0x43')]=qs['sort'](_0x1f2f71[_0x6c6f('0x39')][_0x6c6f('0x44')]);_0x5a72a8['where']=qs[_0x6c6f('0x3b')](_[_0x6c6f('0x45')](_0x1f2f71[_0x6c6f('0x39')],_0x1a333e['filters']),_0x488ba2);if(_0x1f2f71[_0x6c6f('0x39')][_0x6c6f('0x46')]){_0x5a72a8[_0x6c6f('0x47')]=_[_0x6c6f('0x48')](_0x5a72a8[_0x6c6f('0x47')],{'$or':_[_0x6c6f('0x33')](_0x488ba2,function(_0x507c4c){if(_0x507c4c[_0x6c6f('0x37')]!=='VIRTUAL'){var _0x467ac8={};_0x467ac8[_0x507c4c[_0x6c6f('0x30')]]={'$like':'%'+_0x1f2f71[_0x6c6f('0x39')][_0x6c6f('0x46')]+'%'};return _0x467ac8;}})});}_0x5a72a8=_[_0x6c6f('0x48')]({},_0x5a72a8,_0x1f2f71[_0x6c6f('0x49')]);var _0x219687={'where':_0x5a72a8[_0x6c6f('0x47')]};return db[_0x6c6f('0x34')][_0x6c6f('0x24')](_0x219687)[_0x6c6f('0x29')](function(_0x120925){_0x3f8140[_0x6c6f('0x24')]=_0x120925;if(_0x1f2f71[_0x6c6f('0x39')][_0x6c6f('0x4a')]){_0x5a72a8[_0x6c6f('0x4b')]=[{'all':!![]}];}return db[_0x6c6f('0x34')][_0x6c6f('0x4c')](_0x5a72a8);})[_0x6c6f('0x29')](function(_0x3eb321){_0x3f8140['rows']=_0x3eb321;return _0x3f8140;})[_0x6c6f('0x29')](respondWithFilteredResult(_0x11ef6d,_0x5a72a8))['catch'](handleError(_0x11ef6d,null));};exports['show']=function(_0x49c685,_0x1bf8eb){var _0x13c279={'raw':![],'where':{'id':_0x49c685[_0x6c6f('0x4d')]['id']}},_0xf1cd8d={};_0xf1cd8d[_0x6c6f('0x3d')]=_[_0x6c6f('0x3a')](db['CmList']['rawAttributes']);_0xf1cd8d[_0x6c6f('0x39')]=_['keys'](_0x49c685[_0x6c6f('0x39')]);_0xf1cd8d[_0x6c6f('0x3b')]=_['intersection'](_0xf1cd8d[_0x6c6f('0x3d')],_0xf1cd8d[_0x6c6f('0x39')]);_0x13c279['attributes']=_[_0x6c6f('0x3c')](_0xf1cd8d[_0x6c6f('0x3d')],qs[_0x6c6f('0x3e')](_0x49c685[_0x6c6f('0x39')][_0x6c6f('0x3e')]));_0x13c279['attributes']=_0x13c279['attributes'][_0x6c6f('0x40')]?_0x13c279['attributes']:_0xf1cd8d[_0x6c6f('0x3d')];if(_0x49c685[_0x6c6f('0x39')]['includeAll']){_0x13c279[_0x6c6f('0x4b')]=[{'all':!![]}];}_0x13c279=_[_0x6c6f('0x48')]({},_0x13c279,_0x49c685[_0x6c6f('0x49')]);return db['CmList']['find'](_0x13c279)[_0x6c6f('0x29')](handleEntityNotFound(_0x1bf8eb,null))[_0x6c6f('0x29')](respondWithResult(_0x1bf8eb,null))[_0x6c6f('0x4e')](handleError(_0x1bf8eb,null));};exports[_0x6c6f('0x4f')]=function(_0x437a82,_0x261acd){return db[_0x6c6f('0x34')][_0x6c6f('0x4f')](_0x437a82[_0x6c6f('0x50')],{})[_0x6c6f('0x29')](function(_0x43bb4d){var _0x56be50=_0x437a82[_0x6c6f('0x51')][_0x6c6f('0x2a')]({'plain':!![]});if(!_0x56be50)throw new Error(_0x6c6f('0x52'));if(_0x56be50[_0x6c6f('0x53')]===_0x6c6f('0x51')){var _0x5c1836=_0x43bb4d[_0x6c6f('0x2a')]({'plain':!![]});var _0x18d619=_0x6c6f('0x2b');return db[_0x6c6f('0x54')]['find']({'where':{'name':_0x18d619,'userProfileId':_0x56be50['userProfileId']},'raw':!![]})[_0x6c6f('0x29')](function(_0x368195){if(_0x368195&&_0x368195[_0x6c6f('0x55')]===0x0){return db[_0x6c6f('0x56')][_0x6c6f('0x4f')]({'name':_0x5c1836['name'],'resourceId':_0x5c1836['id'],'type':_0x368195[_0x6c6f('0x30')],'sectionId':_0x368195['id']},{})[_0x6c6f('0x29')](function(){return _0x43bb4d;});}else{return _0x43bb4d;}})[_0x6c6f('0x4e')](function(_0x4e61e7){logger[_0x6c6f('0x2e')](_0x6c6f('0x57'),_0x4e61e7);throw _0x4e61e7;});}return _0x43bb4d;})[_0x6c6f('0x29')](respondWithResult(_0x261acd,0xc9))['catch'](handleError(_0x261acd,null));};exports[_0x6c6f('0x28')]=function(_0x3fbcad,_0x665a32){if(_0x3fbcad[_0x6c6f('0x50')]['id']){delete _0x3fbcad[_0x6c6f('0x50')]['id'];}return db[_0x6c6f('0x34')]['find']({'where':{'id':_0x3fbcad['params']['id']}})[_0x6c6f('0x29')](handleEntityNotFound(_0x665a32,null))[_0x6c6f('0x29')](saveUpdates(_0x3fbcad['body'],null))['then'](respondWithResult(_0x665a32,null))['catch'](handleError(_0x665a32,null));};exports[_0x6c6f('0x2c')]=function(_0x94917e,_0x541f01){return db[_0x6c6f('0x34')][_0x6c6f('0x58')]({'where':{'id':_0x94917e['params']['id']}})[_0x6c6f('0x29')](handleEntityNotFound(_0x541f01,null))[_0x6c6f('0x29')](removeEntity(_0x541f01,null))[_0x6c6f('0x4e')](handleError(_0x541f01,null));};exports[_0x6c6f('0x59')]=function(_0x3fbda4,_0x784832){return db[_0x6c6f('0x34')]['describe']()[_0x6c6f('0x29')](respondWithResult(_0x784832,null))[_0x6c6f('0x4e')](handleError(_0x784832,null));};exports[_0x6c6f('0x5a')]=function(_0x5d631b,_0x2c830b,_0x5279fd){if(_0x5d631b['body']['id']){delete _0x5d631b[_0x6c6f('0x50')]['id'];}return db[_0x6c6f('0x34')][_0x6c6f('0x58')]({'where':{'id':_0x5d631b['params']['id']}})[_0x6c6f('0x29')](handleEntityNotFound(_0x2c830b,null))[_0x6c6f('0x29')](function(_0x361853){if(_0x361853){_0x5d631b['body'][_0x6c6f('0x5b')]=_0x361853['id'];return db[_0x6c6f('0x5c')][_0x6c6f('0x4f')](_0x5d631b[_0x6c6f('0x50')]);}})[_0x6c6f('0x29')](respondWithResult(_0x2c830b,null))['catch'](handleError(_0x2c830b,null));};exports['getDispositions']=function(_0x3bfc97,_0x286f79,_0x3a08bb){var _0x738c18={'raw':![],'where':{}};var _0x1f02a5={};var _0x49323f={'count':0x0,'rows':[]};return db[_0x6c6f('0x34')]['findOne']({'where':{'id':_0x3bfc97[_0x6c6f('0x4d')]['id']}})[_0x6c6f('0x29')](handleEntityNotFound(_0x286f79,null))[_0x6c6f('0x29')](function(_0x17ad1d){if(_0x17ad1d){_0x1f02a5[_0x6c6f('0x3d')]=_[_0x6c6f('0x3a')](db[_0x6c6f('0x5c')][_0x6c6f('0x35')]);_0x1f02a5['query']=_[_0x6c6f('0x3a')](_0x3bfc97[_0x6c6f('0x39')]);_0x1f02a5['filters']=_['intersection'](_0x1f02a5[_0x6c6f('0x3d')],_0x1f02a5[_0x6c6f('0x39')]);_0x738c18['attributes']=_[_0x6c6f('0x3c')](_0x1f02a5[_0x6c6f('0x3d')],qs['fields'](_0x3bfc97[_0x6c6f('0x39')][_0x6c6f('0x3e')]));_0x738c18['attributes']=_0x738c18[_0x6c6f('0x3f')]['length']?_0x738c18[_0x6c6f('0x3f')]:_0x1f02a5['model'];if(!_0x3bfc97['query'][_0x6c6f('0x41')](_0x6c6f('0x42'))){_0x738c18['limit']=qs[_0x6c6f('0x22')](_0x3bfc97[_0x6c6f('0x39')]['limit']);_0x738c18[_0x6c6f('0x23')]=qs[_0x6c6f('0x23')](_0x3bfc97[_0x6c6f('0x39')][_0x6c6f('0x23')]);}_0x738c18['order']=qs['sort'](_0x3bfc97[_0x6c6f('0x39')][_0x6c6f('0x44')]);_0x738c18[_0x6c6f('0x47')]=qs[_0x6c6f('0x3b')](_[_0x6c6f('0x45')](_0x3bfc97['query'],_0x1f02a5[_0x6c6f('0x3b')]));_0x738c18['where']['ListId']=_0x17ad1d['id'];if(_0x3bfc97[_0x6c6f('0x39')][_0x6c6f('0x46')]){_0x738c18['where']=_[_0x6c6f('0x48')](_0x738c18[_0x6c6f('0x47')],{'$or':_['map'](_0x738c18['attributes'],function(_0x4c4ac7){var _0x1c5b40={};_0x1c5b40[_0x4c4ac7]={'$like':'%'+_0x3bfc97[_0x6c6f('0x39')][_0x6c6f('0x46')]+'%'};return _0x1c5b40;})});}_0x738c18=_[_0x6c6f('0x48')]({},_0x738c18,_0x3bfc97['options']);return db[_0x6c6f('0x5c')][_0x6c6f('0x24')]({'where':_0x738c18[_0x6c6f('0x47')]})[_0x6c6f('0x29')](function(_0x2ef710){_0x49323f[_0x6c6f('0x24')]=_0x2ef710;if(_0x3bfc97[_0x6c6f('0x39')][_0x6c6f('0x4a')]){_0x738c18[_0x6c6f('0x4b')]=[{'all':!![]}];}return db[_0x6c6f('0x5c')]['findAll'](_0x738c18);})[_0x6c6f('0x29')](function(_0x1d75d5){_0x49323f[_0x6c6f('0x5d')]=_0x1d75d5;return _0x49323f;});}})[_0x6c6f('0x29')](respondWithFilteredResult(_0x286f79,_0x738c18))[_0x6c6f('0x4e')](handleError(_0x286f79,null));};exports['removeDispositions']=function(_0x969354,_0x1566ea,_0x9e3cc){return db[_0x6c6f('0x34')][_0x6c6f('0x58')]({'where':{'id':_0x969354[_0x6c6f('0x4d')]['id']}})[_0x6c6f('0x29')](handleEntityNotFound(_0x1566ea,null))[_0x6c6f('0x29')](function(_0x1dd50f){if(_0x1dd50f){return _0x1dd50f[_0x6c6f('0x5e')](_0x969354[_0x6c6f('0x39')]['ids']);}})['then'](respondWithStatusCode(_0x1566ea,null))['catch'](handleError(_0x1566ea,null));};exports[_0x6c6f('0x5f')]=function(_0x212211,_0x246ee9,_0x3da09d){return db['CmList']['find']({'where':{'id':_0x212211['params']['id']}})[_0x6c6f('0x29')](handleEntityNotFound(_0x246ee9,null))['then'](function(_0x2084fd){if(_0x2084fd){var _0x5048b8=[];var _0x3ae712={'success':[],'errors':[]};return db['CmContact']['describe']()[_0x6c6f('0x29')](function(_0x23eae5){if(_0x212211[_0x6c6f('0x50')]['tags']&&_['isArray'](_0x212211['body'][_0x6c6f('0x60')])){if(_0x212211[_0x6c6f('0x50')]['tags'][_0x6c6f('0x40')]){_0x212211[_0x6c6f('0x50')]['tags']=_0x212211[_0x6c6f('0x50')][_0x6c6f('0x60')]['join'](';')+';';}else{_0x212211[_0x6c6f('0x50')]['tags']=null;}}else{_0x212211[_0x6c6f('0x50')]['tags']=null;}if(_0x212211[_0x6c6f('0x50')]&&_[_0x6c6f('0x61')](_0x212211[_0x6c6f('0x50')])){for(var _0x4e909a=0x0;_0x4e909a<_0x212211[_0x6c6f('0x50')]['length'];_0x4e909a+=0x1){_0x212211['body'][_0x4e909a]['ListId']=_0x212211[_0x6c6f('0x4d')]['id'];_0x5048b8[_0x6c6f('0x62')](_0x212211[_0x6c6f('0x50')][_0x4e909a]);}return BPromise[_0x6c6f('0x63')](_0x5048b8,function(_0x7760b3){return db[_0x6c6f('0x64')][_0x6c6f('0x4f')](_[_0x6c6f('0x65')](_0x7760b3,['ids','id'])||{},{'fields':_['keys'](_0x23eae5),'raw':!![]})[_0x6c6f('0x29')](function(_0x2e174f){_0x3ae712[_0x6c6f('0x66')][_0x6c6f('0x62')](_0x2e174f[_0x6c6f('0x67')]);})[_0x6c6f('0x4e')](function(_0x49fdbf){_0x3ae712['errors']['push']({'data':_0x7760b3,'error':_0x49fdbf['message']});});})[_0x6c6f('0x29')](function(_0x4332e5){return _0x3ae712;})['catch'](function(_0x34c605){return _0x34c605;});}else{_0x246ee9[_0x6c6f('0x1e')](0x190)[_0x6c6f('0x20')]({'message':_0x6c6f('0x68')});}});}})[_0x6c6f('0x29')](respondWithResult(_0x246ee9,null))[_0x6c6f('0x4e')](handleError(_0x246ee9,null));};exports[_0x6c6f('0x69')]=function(_0x13c43b,_0x2a1ca4,_0x432b60){var _0x41253c;return db[_0x6c6f('0x34')][_0x6c6f('0x58')]({'where':{'id':_0x13c43b['params']['id']},'include':[{'model':db[_0x6c6f('0x6a')],'as':_0x6c6f('0x6b')}]})[_0x6c6f('0x29')](handleEntityNotFound(_0x2a1ca4,null))[_0x6c6f('0x29')](function(_0x5775cc){if(_0x5775cc){_0x41253c=_0x5775cc;return db['CmContact']['rawAttributes'];}})[_0x6c6f('0x29')](function(_0x3ac4e5){if(_0x3ac4e5){var _0x5c3b75={};var _0x55bb6d={};_0x55bb6d[_0x6c6f('0x3d')]=_[_0x6c6f('0x6c')](_[_0x6c6f('0x3a')](_0x3ac4e5),_[_0x6c6f('0x33')](_0x41253c['CustomFields'],function(_0x5612e9){return util[_0x6c6f('0x6d')]('cf_%d',_0x5612e9['id']);}));_0x55bb6d[_0x6c6f('0x39')]=_['keys'](_0x13c43b[_0x6c6f('0x39')]);_0x55bb6d[_0x6c6f('0x3b')]=_[_0x6c6f('0x3c')](_0x55bb6d[_0x6c6f('0x3d')],_0x55bb6d[_0x6c6f('0x39')]);_0x5c3b75['attributes']=_[_0x6c6f('0x3c')](_0x55bb6d[_0x6c6f('0x3d')],qs[_0x6c6f('0x3e')](_0x13c43b['query'][_0x6c6f('0x3e')]));_0x5c3b75['attributes']=_0x5c3b75['attributes'][_0x6c6f('0x40')]?_0x5c3b75['attributes']:_0x55bb6d[_0x6c6f('0x3d')];if(!_0x13c43b[_0x6c6f('0x39')][_0x6c6f('0x41')](_0x6c6f('0x42'))){_0x5c3b75[_0x6c6f('0x22')]=qs[_0x6c6f('0x22')](_0x13c43b[_0x6c6f('0x39')]['limit']);_0x5c3b75['offset']=qs['offset'](_0x13c43b['query']['offset']);}_0x5c3b75[_0x6c6f('0x43')]=qs[_0x6c6f('0x44')](_0x13c43b[_0x6c6f('0x39')][_0x6c6f('0x44')]);_0x5c3b75[_0x6c6f('0x47')]=qs[_0x6c6f('0x3b')](_[_0x6c6f('0x45')](_0x13c43b[_0x6c6f('0x39')],_0x55bb6d['filters']));_0x5c3b75[_0x6c6f('0x6e')]=!![];if(_0x13c43b[_0x6c6f('0x39')][_0x6c6f('0x46')]){_0x5c3b75[_0x6c6f('0x47')]=_[_0x6c6f('0x48')](_0x5c3b75['where'],{'$or':_['map'](_0x5c3b75[_0x6c6f('0x3f')],function(_0x22571b){var _0x361ec7={};_0x361ec7[_0x22571b]={'$like':'%'+_0x13c43b['query'][_0x6c6f('0x46')]+'%'};return _0x361ec7;})});}_0x5c3b75=_['merge']({},_0x5c3b75,_0x13c43b[_0x6c6f('0x49')]);return _0x41253c[_0x6c6f('0x69')](_0x5c3b75);}})['then'](respondWithResult(_0x2a1ca4,null))[_0x6c6f('0x4e')](handleError(_0x2a1ca4,null));};exports['getContactsCsv']=function(_0x244c07,_0x50aac3,_0x647b93){var _0x4b8c62;return db[_0x6c6f('0x34')]['find']({'where':{'id':_0x244c07['params']['id']},'include':[{'model':db[_0x6c6f('0x6a')],'as':_0x6c6f('0x6b')}]})[_0x6c6f('0x29')](handleEntityNotFound(_0x50aac3,null))[_0x6c6f('0x29')](function(_0x3570e0){if(_0x3570e0){_0x4b8c62=_0x3570e0;return db[_0x6c6f('0x64')]['rawAttributes'];}})[_0x6c6f('0x29')](function(_0x3bcfd2){if(_0x3bcfd2){var _0x3222b9={};var _0x3cf533={};_0x3cf533[_0x6c6f('0x3d')]=_['concat'](_[_0x6c6f('0x3a')](_0x3bcfd2),_[_0x6c6f('0x33')](_0x4b8c62['CustomFields'],function(_0x3f84a8){return util[_0x6c6f('0x6d')]('cf_%d',_0x3f84a8['id']);}));_0x3cf533[_0x6c6f('0x39')]=_['keys'](_0x244c07[_0x6c6f('0x39')]);_0x3cf533[_0x6c6f('0x3b')]=_[_0x6c6f('0x3c')](_0x3cf533[_0x6c6f('0x3d')],_0x3cf533['query']);_0x3222b9[_0x6c6f('0x3f')]=_[_0x6c6f('0x3c')](_0x3cf533[_0x6c6f('0x3d')],qs[_0x6c6f('0x3e')](_0x244c07[_0x6c6f('0x39')]['fields']));_0x3222b9[_0x6c6f('0x3f')]=_0x3222b9[_0x6c6f('0x3f')][_0x6c6f('0x40')]?_0x3222b9['attributes']:_0x3cf533[_0x6c6f('0x3d')];if(!_0x244c07[_0x6c6f('0x39')][_0x6c6f('0x41')](_0x6c6f('0x42'))){_0x3222b9[_0x6c6f('0x22')]=qs[_0x6c6f('0x22')](_0x244c07[_0x6c6f('0x39')]['limit']);_0x3222b9['offset']=qs['offset'](_0x244c07['query'][_0x6c6f('0x23')]);}_0x3222b9['order']=qs[_0x6c6f('0x44')](_0x244c07[_0x6c6f('0x39')][_0x6c6f('0x44')]);_0x3222b9[_0x6c6f('0x47')]=qs[_0x6c6f('0x3b')](_[_0x6c6f('0x45')](_0x244c07[_0x6c6f('0x39')],_0x3cf533[_0x6c6f('0x3b')]));_0x3222b9[_0x6c6f('0x6e')]=!![];if(_0x244c07[_0x6c6f('0x39')]['filter']){_0x3222b9['where']=_[_0x6c6f('0x48')](_0x3222b9[_0x6c6f('0x47')],{'$or':_[_0x6c6f('0x33')](_0x3222b9['attributes'],function(_0xcc6dd6){var _0x591ce0={};_0x591ce0[_0xcc6dd6]={'$like':'%'+_0x244c07[_0x6c6f('0x39')]['filter']+'%'};return _0x591ce0;})});}_0x3222b9=_['merge']({},_0x3222b9,_0x244c07[_0x6c6f('0x49')]);return _0x4b8c62[_0x6c6f('0x69')](_0x3222b9);}})['then'](function(_0x3e7ab0){if(!_[_0x6c6f('0x6f')](_0x3e7ab0)){var _0x51491c=toCsv(_0x3e7ab0);var _0x4a4cc8=Date[_0x6c6f('0x70')]();fs[_0x6c6f('0x71')](util[_0x6c6f('0x6d')](_0x6c6f('0x72'),_0x4b8c62['id'],_0x4a4cc8),_0x51491c);_0x50aac3[_0x6c6f('0x73')](_0x6c6f('0x74'),_0x6c6f('0x75')+util[_0x6c6f('0x6d')](_0x6c6f('0x76'),_0x4b8c62['id'],_0x4a4cc8));_0x50aac3['setHeader']('Content-type',_0x6c6f('0x77'));return _0x50aac3[_0x6c6f('0x78')](util['format']('/tmp/list_%d_%s.csv',_0x4b8c62['id'],_0x4a4cc8));}else{return _0x50aac3[_0x6c6f('0x2d')](0xcc);}})[_0x6c6f('0x4e')](handleError(_0x50aac3,null));};exports[_0x6c6f('0x79')]=function(_0x4eb412,_0x454601,_0x45f7d0){var _0x36638f;delete _0x4eb412['body']['id'];return db['CmList'][_0x6c6f('0x7a')]({'where':{'id':_0x4eb412[_0x6c6f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x454601,null))[_0x6c6f('0x29')](function(_0x4ee626){if(_0x4ee626){return db[_0x6c6f('0x7b')][_0x6c6f('0x7c')](function(_0x31a0b2){return db[_0x6c6f('0x6a')]['create'](_0x4eb412[_0x6c6f('0x50')],{'transaction':_0x31a0b2})['then'](function(_0x1da2a0){_0x36638f=_0x1da2a0;return _0x4ee626[_0x6c6f('0x7d')](_0x1da2a0,{'transaction':_0x31a0b2});})[_0x6c6f('0x29')](function(){var _0x12bbc2={'type':db[_0x6c6f('0x7e')]['TEXT'],'transaction':_0x31a0b2};switch(_0x4eb412[_0x6c6f('0x50')][_0x6c6f('0x37')]){case'text':_0x12bbc2[_0x6c6f('0x37')]=db[_0x6c6f('0x7e')][_0x6c6f('0x7f')];break;case _0x6c6f('0x80'):_0x12bbc2[_0x6c6f('0x37')]=db[_0x6c6f('0x7e')][_0x6c6f('0x81')];break;case _0x6c6f('0x82'):_0x12bbc2['type']=db[_0x6c6f('0x7e')]['BOOLEAN'];_0x12bbc2['defaultValue']=![];break;default:}return db[_0x6c6f('0x7b')]['queryInterface'][_0x6c6f('0x83')]('cm_contacts',util[_0x6c6f('0x6d')](_0x6c6f('0x84'),_0x36638f['id']),_0x12bbc2);})[_0x6c6f('0x29')](function(){return _0x36638f;});});}})[_0x6c6f('0x29')](respondWithResult(_0x454601,null))['catch'](handleError(_0x454601,null));};exports['getCustomFields']=function(_0x4f0e1c,_0x5a9dde,_0x17c666){var _0x83b746={};var _0x1f9ef4={};var _0x1982a4;var _0x5c5725;return db['CmList'][_0x6c6f('0x7a')]({'where':{'id':_0x4f0e1c['params']['id']}})[_0x6c6f('0x29')](handleEntityNotFound(_0x5a9dde,null))[_0x6c6f('0x29')](function(_0x1643e6){if(_0x1643e6){_0x1982a4=_0x1643e6;_0x1f9ef4[_0x6c6f('0x3d')]=_['keys'](db[_0x6c6f('0x6a')][_0x6c6f('0x35')]);_0x1f9ef4[_0x6c6f('0x39')]=_[_0x6c6f('0x3a')](_0x4f0e1c[_0x6c6f('0x39')]);_0x1f9ef4['filters']=_[_0x6c6f('0x3c')](_0x1f9ef4['model'],_0x1f9ef4[_0x6c6f('0x39')]);_0x83b746[_0x6c6f('0x3f')]=_[_0x6c6f('0x3c')](_0x1f9ef4[_0x6c6f('0x3d')],qs['fields'](_0x4f0e1c[_0x6c6f('0x39')][_0x6c6f('0x3e')]));_0x83b746['attributes']=_0x83b746[_0x6c6f('0x3f')][_0x6c6f('0x40')]?_0x83b746[_0x6c6f('0x3f')]:_0x1f9ef4[_0x6c6f('0x3d')];_0x83b746[_0x6c6f('0x43')]=qs[_0x6c6f('0x44')](_0x4f0e1c[_0x6c6f('0x39')][_0x6c6f('0x44')]);_0x83b746[_0x6c6f('0x47')]=qs[_0x6c6f('0x3b')](_[_0x6c6f('0x45')](_0x4f0e1c[_0x6c6f('0x39')],_0x1f9ef4[_0x6c6f('0x3b')]));_0x83b746['where']=_['merge'](_0x83b746[_0x6c6f('0x47')],{'$or':[{'ListId':_0x1643e6['id']},{'ListId':null}]});if(_0x4f0e1c['query'][_0x6c6f('0x46')]){_0x83b746[_0x6c6f('0x47')]=_[_0x6c6f('0x48')](_0x83b746['where'],{'$or':_[_0x6c6f('0x33')](_0x83b746[_0x6c6f('0x3f')],function(_0x1cc27a){var _0x3bbe4d={};_0x3bbe4d[_0x1cc27a]={'$like':'%'+_0x4f0e1c[_0x6c6f('0x39')]['filter']+'%'};return _0x3bbe4d;})});}_0x83b746=_['merge']({},_0x83b746,_0x4f0e1c[_0x6c6f('0x49')]);return db[_0x6c6f('0x6a')]['findAndCountAll'](_0x83b746);}})[_0x6c6f('0x29')](respondWithResult(_0x5a9dde,null))[_0x6c6f('0x4e')](handleError(_0x5a9dde,null));};exports['addAgents']=function(_0x11b37d,_0x2ffb1e,_0x4f8228){return db[_0x6c6f('0x34')][_0x6c6f('0x58')]({'where':{'id':_0x11b37d[_0x6c6f('0x4d')]['id']}})[_0x6c6f('0x29')](handleEntityNotFound(_0x2ffb1e,null))[_0x6c6f('0x29')](function(_0x4f0f2a){if(_0x4f0f2a){return _0x4f0f2a[_0x6c6f('0x85')](_0x11b37d[_0x6c6f('0x50')][_0x6c6f('0x86')],_['omit'](_0x11b37d[_0x6c6f('0x50')],['ids','id'])||{})[_0x6c6f('0x87')](function(_0x100e84){for(var _0x716462=0x0;_0x716462<_0x11b37d[_0x6c6f('0x50')][_0x6c6f('0x86')][_0x6c6f('0x40')];_0x716462+=0x1){socket[_0x6c6f('0x88')]('userCmList:save',{'UserId':Number(_0x11b37d[_0x6c6f('0x50')]['ids'][_0x716462]),'CmListId':Number(_0x11b37d[_0x6c6f('0x4d')]['id'])});}return _0x100e84;});}})[_0x6c6f('0x29')](respondWithResult(_0x2ffb1e,null))[_0x6c6f('0x4e')](handleError(_0x2ffb1e,null));};exports[_0x6c6f('0x89')]=function(_0x551bb6,_0x45472b,_0x1bd6c1){return db[_0x6c6f('0x34')][_0x6c6f('0x58')]({'where':{'id':_0x551bb6['params']['id']}})[_0x6c6f('0x29')](handleEntityNotFound(_0x45472b,null))['then'](function(_0x468202){if(_0x468202){return _0x468202[_0x6c6f('0x89')](_0x551bb6[_0x6c6f('0x39')][_0x6c6f('0x86')])[_0x6c6f('0x29')](function(){if(_[_0x6c6f('0x61')](_0x551bb6[_0x6c6f('0x39')][_0x6c6f('0x86')])){for(var _0x78ebd8=0x0;_0x78ebd8<_0x551bb6[_0x6c6f('0x39')]['ids'][_0x6c6f('0x40')];_0x78ebd8+=0x1){socket['emit'](_0x6c6f('0x8a'),{'UserId':Number(_0x551bb6['query']['ids'][_0x78ebd8]),'CmListId':Number(_0x551bb6[_0x6c6f('0x4d')]['id'])});}}else{socket[_0x6c6f('0x88')](_0x6c6f('0x8a'),{'UserId':Number(_0x551bb6['query'][_0x6c6f('0x86')]),'CmListId':Number(_0x551bb6['params']['id'])});}});}})[_0x6c6f('0x29')](respondWithStatusCode(_0x45472b,null))[_0x6c6f('0x4e')](handleError(_0x45472b,null));};exports[_0x6c6f('0x8b')]=function(_0x520c7a,_0x1432f8,_0x45cb84){var _0x147864={};var _0x372931={};var _0x5b9cff;var _0x5d44db;return db[_0x6c6f('0x34')][_0x6c6f('0x7a')]({'where':{'id':_0x520c7a['params']['id']}})[_0x6c6f('0x29')](handleEntityNotFound(_0x1432f8,null))[_0x6c6f('0x29')](function(_0x38de25){if(_0x38de25){_0x5b9cff=_0x38de25;_0x372931[_0x6c6f('0x3d')]=_['keys'](db[_0x6c6f('0x8c')][_0x6c6f('0x35')]);_0x372931['query']=_[_0x6c6f('0x3a')](_0x520c7a[_0x6c6f('0x39')]);_0x372931[_0x6c6f('0x3b')]=_[_0x6c6f('0x3c')](_0x372931[_0x6c6f('0x3d')],_0x372931['query']);_0x147864[_0x6c6f('0x3f')]=_[_0x6c6f('0x3c')](_0x372931[_0x6c6f('0x3d')],qs['fields'](_0x520c7a['query'][_0x6c6f('0x3e')]));_0x147864[_0x6c6f('0x3f')]=_0x147864['attributes']['length']?_0x147864['attributes']:_0x372931['model'];_0x147864[_0x6c6f('0x43')]=qs['sort'](_0x520c7a['query'][_0x6c6f('0x44')]);_0x147864['where']=qs['filters'](_[_0x6c6f('0x45')](_0x520c7a[_0x6c6f('0x39')],_0x372931[_0x6c6f('0x3b')]));if(_0x520c7a[_0x6c6f('0x39')][_0x6c6f('0x46')]){_0x147864[_0x6c6f('0x47')]=_[_0x6c6f('0x48')](_0x147864[_0x6c6f('0x47')],{'$or':_[_0x6c6f('0x33')](_0x147864[_0x6c6f('0x3f')],function(_0x440995){var _0x5c1967={};_0x5c1967[_0x440995]={'$like':'%'+_0x520c7a[_0x6c6f('0x39')]['filter']+'%'};return _0x5c1967;})});}_0x147864=_[_0x6c6f('0x48')]({},_0x147864,_0x520c7a['options']);return _0x5b9cff[_0x6c6f('0x8b')](_0x147864);}})[_0x6c6f('0x29')](function(_0x480a4a){if(_0x480a4a){_0x5d44db=_0x480a4a['length'];if(!_0x520c7a[_0x6c6f('0x39')][_0x6c6f('0x41')](_0x6c6f('0x42'))){_0x147864['limit']=qs[_0x6c6f('0x22')](_0x520c7a[_0x6c6f('0x39')]['limit']);_0x147864[_0x6c6f('0x23')]=qs[_0x6c6f('0x23')](_0x520c7a[_0x6c6f('0x39')]['offset']);}return _0x5b9cff[_0x6c6f('0x8b')](_0x147864);}})['then'](function(_0x242218){if(_0x242218){return _0x242218?{'count':_0x5d44db,'rows':_0x242218}:null;}})['then'](respondWithResult(_0x1432f8,null))[_0x6c6f('0x4e')](handleError(_0x1432f8,null));}; \ No newline at end of file +var _0x4d32=['keys','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','autoAssociation','error','describe','Disposition','getDispositions','findOne','ListId','findAll','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','success','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','list_%d_%s.csv','text/csv','addCustomField','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','addColumn','getCustomFields','findAndCountAll','addAgents','emit','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','Lists','UserProfileResource','stack','name','map','CmList','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params'];(function(_0x743b6c,_0x4dbc78){var _0x41575a=function(_0x283c63){while(--_0x283c63){_0x743b6c['push'](_0x743b6c['shift']());}};_0x41575a(++_0x4dbc78);}(_0x4d32,0xce));var _0x24d3=function(_0x58b571,_0x585a32){_0x58b571=_0x58b571-0x0;var _0x32f892=_0x4d32[_0x58b571];return _0x32f892;};'use strict';var emlformat=require(_0x24d3('0x0'));var rimraf=require(_0x24d3('0x1'));var zipdir=require(_0x24d3('0x2'));var jsonpatch=require(_0x24d3('0x3'));var rp=require(_0x24d3('0x4'));var moment=require(_0x24d3('0x5'));var BPromise=require(_0x24d3('0x6'));var Mustache=require(_0x24d3('0x7'));var util=require(_0x24d3('0x8'));var path=require('path');var sox=require(_0x24d3('0x9'));var csv=require(_0x24d3('0xa'));var ejs=require(_0x24d3('0xb'));var fs=require('fs');var fs_extra=require(_0x24d3('0xc'));var _=require(_0x24d3('0xd'));var squel=require('squel');var crypto=require(_0x24d3('0xe'));var jsforce=require(_0x24d3('0xf'));var deskjs=require(_0x24d3('0x10'));var toCsv=require('to-csv');var querystring=require(_0x24d3('0x11'));var Papa=require(_0x24d3('0x12'));var Redis=require(_0x24d3('0x13'));var authService=require(_0x24d3('0x14'));var qs=require(_0x24d3('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x24d3('0x16'));var logger=require(_0x24d3('0x17'))(_0x24d3('0x18'));var utils=require(_0x24d3('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x24d3('0x1a'));var db=require(_0x24d3('0x1b'))['db'];config[_0x24d3('0x1c')]=_[_0x24d3('0x1d')](config[_0x24d3('0x1c')],{'host':_0x24d3('0x1e'),'port':0x18eb});var socket=require(_0x24d3('0x1f'))(new Redis(config[_0x24d3('0x1c')]));require('./cmList.socket')[_0x24d3('0x20')](socket);function respondWithStatusCode(_0x3cace1,_0x3165d0){_0x3165d0=_0x3165d0||0xcc;return function(_0x33a526){if(_0x33a526){return _0x3cace1[_0x24d3('0x21')](_0x3165d0);}return _0x3cace1[_0x24d3('0x22')](_0x3165d0)[_0x24d3('0x23')]();};}function respondWithResult(_0x2018bd,_0x2ed3d0){_0x2ed3d0=_0x2ed3d0||0xc8;return function(_0x1e5ac5){if(_0x1e5ac5){return _0x2018bd[_0x24d3('0x22')](_0x2ed3d0)[_0x24d3('0x24')](_0x1e5ac5);}};}function respondWithFilteredResult(_0xbd74c0,_0x1df2d6){return function(_0x20b6b8){if(_0x20b6b8){var _0x2c2cbf=typeof _0x1df2d6[_0x24d3('0x25')]===_0x24d3('0x26')&&typeof _0x1df2d6[_0x24d3('0x27')]===_0x24d3('0x26');var _0x1b72d6=_0x20b6b8[_0x24d3('0x28')];var _0x4619bc=_0x2c2cbf?0x0:_0x1df2d6[_0x24d3('0x25')];var _0x5b400b=_0x2c2cbf?_0x20b6b8[_0x24d3('0x28')]:_0x1df2d6[_0x24d3('0x25')]+_0x1df2d6[_0x24d3('0x27')];var _0x3390bd;if(_0x5b400b>=_0x1b72d6){_0x5b400b=_0x1b72d6;_0x3390bd=0xc8;}else{_0x3390bd=0xce;}_0xbd74c0['status'](_0x3390bd);return _0xbd74c0[_0x24d3('0x29')](_0x24d3('0x2a'),_0x4619bc+'-'+_0x5b400b+'/'+_0x1b72d6)[_0x24d3('0x24')](_0x20b6b8);}return null;};}function patchUpdates(_0xabbf0d){return function(_0x360794){try{jsonpatch[_0x24d3('0x2b')](_0x360794,_0xabbf0d,!![]);}catch(_0x4f0df1){return BPromise[_0x24d3('0x2c')](_0x4f0df1);}return _0x360794['save']();};}function saveUpdates(_0x317a42,_0x3d52a3){return function(_0x420b6f){if(_0x420b6f){return _0x420b6f[_0x24d3('0x2d')](_0x317a42)[_0x24d3('0x2e')](function(_0xb3bbd){return _0xb3bbd;});}return null;};}function removeEntity(_0x1b2bc0,_0x43c8ee){return function(_0x4155ba){if(_0x4155ba){return _0x4155ba[_0x24d3('0x2f')]()[_0x24d3('0x2e')](function(){var _0x4cc9c5=_0x4155ba['get']({'plain':!![]});var _0x17e11e=_0x24d3('0x30');return db[_0x24d3('0x31')][_0x24d3('0x2f')]({'where':{'type':_0x17e11e,'resourceId':_0x4cc9c5['id']}})['then'](function(){return _0x4155ba;});})['then'](function(){_0x1b2bc0[_0x24d3('0x22')](0xcc)[_0x24d3('0x23')]();});}};}function handleEntityNotFound(_0x6dbe2e,_0x4f088f){return function(_0x120a5e){if(!_0x120a5e){_0x6dbe2e[_0x24d3('0x21')](0x194);}return _0x120a5e;};}function handleError(_0x3d5dc9,_0xa1c9e5){_0xa1c9e5=_0xa1c9e5||0x1f4;return function(_0x15ead5){logger['error'](_0x15ead5[_0x24d3('0x32')]);if(_0x15ead5['name']){delete _0x15ead5[_0x24d3('0x33')];}_0x3d5dc9[_0x24d3('0x22')](_0xa1c9e5)['send'](_0x15ead5);};}exports['index']=function(_0xc1c26,_0x4752a4){var _0x1da55a={},_0x39c023={},_0x262b56={'count':0x0,'rows':[]};var _0x4cd855=_[_0x24d3('0x34')](db[_0x24d3('0x35')][_0x24d3('0x36')],function(_0x5e30a9){return{'name':_0x5e30a9['fieldName'],'type':_0x5e30a9[_0x24d3('0x37')]['key']};});_0x39c023[_0x24d3('0x38')]=_[_0x24d3('0x34')](_0x4cd855,'name');_0x39c023[_0x24d3('0x39')]=_['keys'](_0xc1c26['query']);_0x39c023[_0x24d3('0x3a')]=_[_0x24d3('0x3b')](_0x39c023['model'],_0x39c023[_0x24d3('0x39')]);_0x1da55a['attributes']=_[_0x24d3('0x3b')](_0x39c023['model'],qs[_0x24d3('0x3c')](_0xc1c26[_0x24d3('0x39')][_0x24d3('0x3c')]));_0x1da55a[_0x24d3('0x3d')]=_0x1da55a[_0x24d3('0x3d')][_0x24d3('0x3e')]?_0x1da55a['attributes']:_0x39c023[_0x24d3('0x38')];if(!_0xc1c26[_0x24d3('0x39')][_0x24d3('0x3f')](_0x24d3('0x40'))){_0x1da55a[_0x24d3('0x27')]=qs[_0x24d3('0x27')](_0xc1c26[_0x24d3('0x39')][_0x24d3('0x27')]);_0x1da55a[_0x24d3('0x25')]=qs[_0x24d3('0x25')](_0xc1c26[_0x24d3('0x39')]['offset']);}_0x1da55a[_0x24d3('0x41')]=qs['sort'](_0xc1c26['query'][_0x24d3('0x42')]);_0x1da55a[_0x24d3('0x43')]=qs[_0x24d3('0x3a')](_[_0x24d3('0x44')](_0xc1c26[_0x24d3('0x39')],_0x39c023[_0x24d3('0x3a')]),_0x4cd855);if(_0xc1c26[_0x24d3('0x39')][_0x24d3('0x45')]){_0x1da55a['where']=_[_0x24d3('0x46')](_0x1da55a[_0x24d3('0x43')],{'$or':_[_0x24d3('0x34')](_0x4cd855,function(_0x3fbe65){if(_0x3fbe65[_0x24d3('0x37')]!=='VIRTUAL'){var _0x39fef1={};_0x39fef1[_0x3fbe65[_0x24d3('0x33')]]={'$like':'%'+_0xc1c26['query'][_0x24d3('0x45')]+'%'};return _0x39fef1;}})});}_0x1da55a=_['merge']({},_0x1da55a,_0xc1c26[_0x24d3('0x47')]);var _0x1cae6f={'where':_0x1da55a['where']};return db[_0x24d3('0x35')][_0x24d3('0x28')](_0x1cae6f)[_0x24d3('0x2e')](function(_0x49cbb3){_0x262b56[_0x24d3('0x28')]=_0x49cbb3;if(_0xc1c26['query'][_0x24d3('0x48')]){_0x1da55a[_0x24d3('0x49')]=[{'all':!![]}];}return db[_0x24d3('0x35')]['findAll'](_0x1da55a);})[_0x24d3('0x2e')](function(_0x360218){_0x262b56[_0x24d3('0x4a')]=_0x360218;return _0x262b56;})[_0x24d3('0x2e')](respondWithFilteredResult(_0x4752a4,_0x1da55a))[_0x24d3('0x4b')](handleError(_0x4752a4,null));};exports[_0x24d3('0x4c')]=function(_0xe3a0b6,_0x11565e){var _0x257a99={'raw':![],'where':{'id':_0xe3a0b6[_0x24d3('0x4d')]['id']}},_0x51fa7e={};_0x51fa7e[_0x24d3('0x38')]=_[_0x24d3('0x4e')](db[_0x24d3('0x35')][_0x24d3('0x36')]);_0x51fa7e[_0x24d3('0x39')]=_[_0x24d3('0x4e')](_0xe3a0b6[_0x24d3('0x39')]);_0x51fa7e[_0x24d3('0x3a')]=_[_0x24d3('0x3b')](_0x51fa7e[_0x24d3('0x38')],_0x51fa7e[_0x24d3('0x39')]);_0x257a99[_0x24d3('0x3d')]=_[_0x24d3('0x3b')](_0x51fa7e['model'],qs[_0x24d3('0x3c')](_0xe3a0b6[_0x24d3('0x39')][_0x24d3('0x3c')]));_0x257a99[_0x24d3('0x3d')]=_0x257a99[_0x24d3('0x3d')][_0x24d3('0x3e')]?_0x257a99[_0x24d3('0x3d')]:_0x51fa7e['model'];if(_0xe3a0b6[_0x24d3('0x39')][_0x24d3('0x48')]){_0x257a99[_0x24d3('0x49')]=[{'all':!![]}];}_0x257a99=_[_0x24d3('0x46')]({},_0x257a99,_0xe3a0b6[_0x24d3('0x47')]);return db[_0x24d3('0x35')]['find'](_0x257a99)[_0x24d3('0x2e')](handleEntityNotFound(_0x11565e,null))[_0x24d3('0x2e')](respondWithResult(_0x11565e,null))[_0x24d3('0x4b')](handleError(_0x11565e,null));};exports[_0x24d3('0x4f')]=function(_0x1d92fd,_0x2be35a){return db['CmList']['create'](_0x1d92fd[_0x24d3('0x50')],{})['then'](function(_0x487d17){var _0x1d7495=_0x1d92fd['user'][_0x24d3('0x51')]({'plain':!![]});if(!_0x1d7495)throw new Error(_0x24d3('0x52'));if(_0x1d7495['role']===_0x24d3('0x53')){var _0x4d7614=_0x487d17[_0x24d3('0x51')]({'plain':!![]});var _0x24aafb=_0x24d3('0x30');return db[_0x24d3('0x54')][_0x24d3('0x55')]({'where':{'name':_0x24aafb,'userProfileId':_0x1d7495[_0x24d3('0x56')]},'raw':!![]})['then'](function(_0x182eff){if(_0x182eff&&_0x182eff[_0x24d3('0x57')]===0x0){return db[_0x24d3('0x31')][_0x24d3('0x4f')]({'name':_0x4d7614['name'],'resourceId':_0x4d7614['id'],'type':_0x182eff['name'],'sectionId':_0x182eff['id']},{})[_0x24d3('0x2e')](function(){return _0x487d17;});}else{return _0x487d17;}})[_0x24d3('0x4b')](function(_0x19de3b){logger[_0x24d3('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19de3b);throw _0x19de3b;});}return _0x487d17;})['then'](respondWithResult(_0x2be35a,0xc9))[_0x24d3('0x4b')](handleError(_0x2be35a,null));};exports['update']=function(_0x4d1775,_0x2346c9){if(_0x4d1775[_0x24d3('0x50')]['id']){delete _0x4d1775[_0x24d3('0x50')]['id'];}return db[_0x24d3('0x35')][_0x24d3('0x55')]({'where':{'id':_0x4d1775[_0x24d3('0x4d')]['id']}})[_0x24d3('0x2e')](handleEntityNotFound(_0x2346c9,null))[_0x24d3('0x2e')](saveUpdates(_0x4d1775['body'],null))[_0x24d3('0x2e')](respondWithResult(_0x2346c9,null))[_0x24d3('0x4b')](handleError(_0x2346c9,null));};exports[_0x24d3('0x2f')]=function(_0x4e7d7d,_0x4621b5){return db['CmList']['find']({'where':{'id':_0x4e7d7d[_0x24d3('0x4d')]['id']}})[_0x24d3('0x2e')](handleEntityNotFound(_0x4621b5,null))[_0x24d3('0x2e')](removeEntity(_0x4621b5,null))['catch'](handleError(_0x4621b5,null));};exports[_0x24d3('0x59')]=function(_0x511993,_0xe92e74){return db['CmList'][_0x24d3('0x59')]()[_0x24d3('0x2e')](respondWithResult(_0xe92e74,null))[_0x24d3('0x4b')](handleError(_0xe92e74,null));};exports['addDisposition']=function(_0x4f2e8f,_0x19c4ac,_0x5dbbef){if(_0x4f2e8f[_0x24d3('0x50')]['id']){delete _0x4f2e8f['body']['id'];}return db[_0x24d3('0x35')][_0x24d3('0x55')]({'where':{'id':_0x4f2e8f['params']['id']}})[_0x24d3('0x2e')](handleEntityNotFound(_0x19c4ac,null))[_0x24d3('0x2e')](function(_0x248207){if(_0x248207){_0x4f2e8f[_0x24d3('0x50')]['ListId']=_0x248207['id'];return db[_0x24d3('0x5a')][_0x24d3('0x4f')](_0x4f2e8f[_0x24d3('0x50')]);}})[_0x24d3('0x2e')](respondWithResult(_0x19c4ac,null))[_0x24d3('0x4b')](handleError(_0x19c4ac,null));};exports[_0x24d3('0x5b')]=function(_0x5e6aa8,_0x17bfb3,_0x50c111){var _0x23faeb={'raw':![],'where':{}};var _0x49e477={};var _0x32cd75={'count':0x0,'rows':[]};return db['CmList'][_0x24d3('0x5c')]({'where':{'id':_0x5e6aa8[_0x24d3('0x4d')]['id']}})[_0x24d3('0x2e')](handleEntityNotFound(_0x17bfb3,null))['then'](function(_0x590bcf){if(_0x590bcf){_0x49e477[_0x24d3('0x38')]=_['keys'](db['Disposition'][_0x24d3('0x36')]);_0x49e477['query']=_[_0x24d3('0x4e')](_0x5e6aa8[_0x24d3('0x39')]);_0x49e477[_0x24d3('0x3a')]=_[_0x24d3('0x3b')](_0x49e477[_0x24d3('0x38')],_0x49e477[_0x24d3('0x39')]);_0x23faeb[_0x24d3('0x3d')]=_[_0x24d3('0x3b')](_0x49e477[_0x24d3('0x38')],qs[_0x24d3('0x3c')](_0x5e6aa8[_0x24d3('0x39')]['fields']));_0x23faeb[_0x24d3('0x3d')]=_0x23faeb['attributes'][_0x24d3('0x3e')]?_0x23faeb[_0x24d3('0x3d')]:_0x49e477[_0x24d3('0x38')];if(!_0x5e6aa8[_0x24d3('0x39')][_0x24d3('0x3f')](_0x24d3('0x40'))){_0x23faeb['limit']=qs[_0x24d3('0x27')](_0x5e6aa8[_0x24d3('0x39')]['limit']);_0x23faeb[_0x24d3('0x25')]=qs[_0x24d3('0x25')](_0x5e6aa8[_0x24d3('0x39')][_0x24d3('0x25')]);}_0x23faeb[_0x24d3('0x41')]=qs[_0x24d3('0x42')](_0x5e6aa8['query'][_0x24d3('0x42')]);_0x23faeb['where']=qs[_0x24d3('0x3a')](_[_0x24d3('0x44')](_0x5e6aa8['query'],_0x49e477[_0x24d3('0x3a')]));_0x23faeb[_0x24d3('0x43')][_0x24d3('0x5d')]=_0x590bcf['id'];if(_0x5e6aa8['query'][_0x24d3('0x45')]){_0x23faeb['where']=_[_0x24d3('0x46')](_0x23faeb['where'],{'$or':_[_0x24d3('0x34')](_0x23faeb[_0x24d3('0x3d')],function(_0x1d26de){var _0x10dde3={};_0x10dde3[_0x1d26de]={'$like':'%'+_0x5e6aa8[_0x24d3('0x39')][_0x24d3('0x45')]+'%'};return _0x10dde3;})});}_0x23faeb=_[_0x24d3('0x46')]({},_0x23faeb,_0x5e6aa8[_0x24d3('0x47')]);return db[_0x24d3('0x5a')][_0x24d3('0x28')]({'where':_0x23faeb[_0x24d3('0x43')]})[_0x24d3('0x2e')](function(_0x327e7c){_0x32cd75[_0x24d3('0x28')]=_0x327e7c;if(_0x5e6aa8[_0x24d3('0x39')]['includeAll']){_0x23faeb[_0x24d3('0x49')]=[{'all':!![]}];}return db[_0x24d3('0x5a')][_0x24d3('0x5e')](_0x23faeb);})['then'](function(_0x2276f0){_0x32cd75[_0x24d3('0x4a')]=_0x2276f0;return _0x32cd75;});}})[_0x24d3('0x2e')](respondWithFilteredResult(_0x17bfb3,_0x23faeb))[_0x24d3('0x4b')](handleError(_0x17bfb3,null));};exports['removeDispositions']=function(_0x48b82b,_0x1164eb,_0x4ac77e){return db[_0x24d3('0x35')][_0x24d3('0x55')]({'where':{'id':_0x48b82b[_0x24d3('0x4d')]['id']}})[_0x24d3('0x2e')](handleEntityNotFound(_0x1164eb,null))['then'](function(_0x1669ec){if(_0x1669ec){return _0x1669ec[_0x24d3('0x5f')](_0x48b82b[_0x24d3('0x39')][_0x24d3('0x60')]);}})[_0x24d3('0x2e')](respondWithStatusCode(_0x1164eb,null))[_0x24d3('0x4b')](handleError(_0x1164eb,null));};exports[_0x24d3('0x61')]=function(_0x11329f,_0x361ef1,_0x5be602){return db[_0x24d3('0x35')]['find']({'where':{'id':_0x11329f['params']['id']}})[_0x24d3('0x2e')](handleEntityNotFound(_0x361ef1,null))[_0x24d3('0x2e')](function(_0x5864fd){if(_0x5864fd){var _0x208a24=[];var _0x19fa7a={'success':[],'errors':[]};return db[_0x24d3('0x62')][_0x24d3('0x59')]()[_0x24d3('0x2e')](function(_0x27eef7){if(_0x11329f['body'][_0x24d3('0x63')]&&_[_0x24d3('0x64')](_0x11329f[_0x24d3('0x50')][_0x24d3('0x63')])){if(_0x11329f['body'][_0x24d3('0x63')][_0x24d3('0x3e')]){_0x11329f['body'][_0x24d3('0x63')]=_0x11329f[_0x24d3('0x50')][_0x24d3('0x63')][_0x24d3('0x65')](';')+';';}else{_0x11329f['body'][_0x24d3('0x63')]=null;}}else{_0x11329f[_0x24d3('0x50')][_0x24d3('0x63')]=null;}if(_0x11329f['body']&&_['isArray'](_0x11329f[_0x24d3('0x50')])){for(var _0x20d672=0x0;_0x20d672<_0x11329f[_0x24d3('0x50')]['length'];_0x20d672+=0x1){_0x11329f[_0x24d3('0x50')][_0x20d672][_0x24d3('0x5d')]=_0x11329f[_0x24d3('0x4d')]['id'];_0x208a24[_0x24d3('0x66')](_0x11329f[_0x24d3('0x50')][_0x20d672]);}return BPromise[_0x24d3('0x67')](_0x208a24,function(_0x3d52b2){return db[_0x24d3('0x62')][_0x24d3('0x4f')](_[_0x24d3('0x68')](_0x3d52b2,[_0x24d3('0x60'),'id'])||{},{'fields':_[_0x24d3('0x4e')](_0x27eef7),'raw':!![]})[_0x24d3('0x2e')](function(_0x57e532){_0x19fa7a[_0x24d3('0x69')][_0x24d3('0x66')](_0x57e532['dataValues']);})[_0x24d3('0x4b')](function(_0x467928){_0x19fa7a[_0x24d3('0x6a')]['push']({'data':_0x3d52b2,'error':_0x467928[_0x24d3('0x6b')]});});})[_0x24d3('0x2e')](function(_0x51c320){return _0x19fa7a;})[_0x24d3('0x4b')](function(_0x4cc2ed){return _0x4cc2ed;});}else{_0x361ef1[_0x24d3('0x22')](0x190)[_0x24d3('0x24')]({'message':_0x24d3('0x6c')});}});}})[_0x24d3('0x2e')](respondWithResult(_0x361ef1,null))[_0x24d3('0x4b')](handleError(_0x361ef1,null));};exports[_0x24d3('0x6d')]=function(_0x359bf2,_0x57398b,_0x2266fc){var _0x1c3424;return db['CmList'][_0x24d3('0x55')]({'where':{'id':_0x359bf2[_0x24d3('0x4d')]['id']},'include':[{'model':db[_0x24d3('0x6e')],'as':_0x24d3('0x6f')}]})[_0x24d3('0x2e')](handleEntityNotFound(_0x57398b,null))['then'](function(_0x14c22b){if(_0x14c22b){_0x1c3424=_0x14c22b;return db[_0x24d3('0x62')]['rawAttributes'];}})[_0x24d3('0x2e')](function(_0x705c78){if(_0x705c78){var _0x2ef760={};var _0x4b175c={};_0x4b175c[_0x24d3('0x38')]=_[_0x24d3('0x70')](_['keys'](_0x705c78),_['map'](_0x1c3424[_0x24d3('0x6f')],function(_0xc1de3d){return util[_0x24d3('0x71')](_0x24d3('0x72'),_0xc1de3d['id']);}));_0x4b175c[_0x24d3('0x39')]=_[_0x24d3('0x4e')](_0x359bf2['query']);_0x4b175c[_0x24d3('0x3a')]=_[_0x24d3('0x3b')](_0x4b175c[_0x24d3('0x38')],_0x4b175c[_0x24d3('0x39')]);_0x2ef760[_0x24d3('0x3d')]=_[_0x24d3('0x3b')](_0x4b175c['model'],qs[_0x24d3('0x3c')](_0x359bf2[_0x24d3('0x39')][_0x24d3('0x3c')]));_0x2ef760[_0x24d3('0x3d')]=_0x2ef760[_0x24d3('0x3d')][_0x24d3('0x3e')]?_0x2ef760[_0x24d3('0x3d')]:_0x4b175c[_0x24d3('0x38')];if(!_0x359bf2[_0x24d3('0x39')][_0x24d3('0x3f')](_0x24d3('0x40'))){_0x2ef760[_0x24d3('0x27')]=qs[_0x24d3('0x27')](_0x359bf2['query'][_0x24d3('0x27')]);_0x2ef760['offset']=qs['offset'](_0x359bf2[_0x24d3('0x39')][_0x24d3('0x25')]);}_0x2ef760[_0x24d3('0x41')]=qs[_0x24d3('0x42')](_0x359bf2[_0x24d3('0x39')][_0x24d3('0x42')]);_0x2ef760[_0x24d3('0x43')]=qs['filters'](_['pick'](_0x359bf2[_0x24d3('0x39')],_0x4b175c[_0x24d3('0x3a')]));_0x2ef760[_0x24d3('0x73')]=!![];if(_0x359bf2[_0x24d3('0x39')][_0x24d3('0x45')]){_0x2ef760[_0x24d3('0x43')]=_[_0x24d3('0x46')](_0x2ef760[_0x24d3('0x43')],{'$or':_[_0x24d3('0x34')](_0x2ef760[_0x24d3('0x3d')],function(_0x44f128){var _0x25ff47={};_0x25ff47[_0x44f128]={'$like':'%'+_0x359bf2['query'][_0x24d3('0x45')]+'%'};return _0x25ff47;})});}_0x2ef760=_[_0x24d3('0x46')]({},_0x2ef760,_0x359bf2['options']);return _0x1c3424[_0x24d3('0x6d')](_0x2ef760);}})[_0x24d3('0x2e')](respondWithResult(_0x57398b,null))[_0x24d3('0x4b')](handleError(_0x57398b,null));};exports[_0x24d3('0x74')]=function(_0x4515ab,_0x2e91fe,_0x2f1627){var _0x507f15;return db[_0x24d3('0x35')]['find']({'where':{'id':_0x4515ab['params']['id']},'include':[{'model':db[_0x24d3('0x6e')],'as':'CustomFields'}]})[_0x24d3('0x2e')](handleEntityNotFound(_0x2e91fe,null))[_0x24d3('0x2e')](function(_0x1efb99){if(_0x1efb99){_0x507f15=_0x1efb99;return db['CmContact'][_0x24d3('0x36')];}})[_0x24d3('0x2e')](function(_0x118e64){if(_0x118e64){var _0x3495a4={};var _0x4ee901={};_0x4ee901[_0x24d3('0x38')]=_[_0x24d3('0x70')](_[_0x24d3('0x4e')](_0x118e64),_[_0x24d3('0x34')](_0x507f15[_0x24d3('0x6f')],function(_0x1e3b22){return util[_0x24d3('0x71')](_0x24d3('0x72'),_0x1e3b22['id']);}));_0x4ee901[_0x24d3('0x39')]=_[_0x24d3('0x4e')](_0x4515ab['query']);_0x4ee901['filters']=_[_0x24d3('0x3b')](_0x4ee901[_0x24d3('0x38')],_0x4ee901[_0x24d3('0x39')]);_0x3495a4['attributes']=_[_0x24d3('0x3b')](_0x4ee901[_0x24d3('0x38')],qs['fields'](_0x4515ab[_0x24d3('0x39')][_0x24d3('0x3c')]));_0x3495a4[_0x24d3('0x3d')]=_0x3495a4[_0x24d3('0x3d')][_0x24d3('0x3e')]?_0x3495a4[_0x24d3('0x3d')]:_0x4ee901[_0x24d3('0x38')];if(!_0x4515ab[_0x24d3('0x39')][_0x24d3('0x3f')]('nolimit')){_0x3495a4['limit']=qs[_0x24d3('0x27')](_0x4515ab[_0x24d3('0x39')]['limit']);_0x3495a4[_0x24d3('0x25')]=qs[_0x24d3('0x25')](_0x4515ab['query'][_0x24d3('0x25')]);}_0x3495a4['order']=qs[_0x24d3('0x42')](_0x4515ab[_0x24d3('0x39')][_0x24d3('0x42')]);_0x3495a4['where']=qs[_0x24d3('0x3a')](_['pick'](_0x4515ab[_0x24d3('0x39')],_0x4ee901['filters']));_0x3495a4['raw']=!![];if(_0x4515ab[_0x24d3('0x39')]['filter']){_0x3495a4[_0x24d3('0x43')]=_[_0x24d3('0x46')](_0x3495a4['where'],{'$or':_[_0x24d3('0x34')](_0x3495a4[_0x24d3('0x3d')],function(_0x43c32b){var _0x7e568f={};_0x7e568f[_0x43c32b]={'$like':'%'+_0x4515ab[_0x24d3('0x39')][_0x24d3('0x45')]+'%'};return _0x7e568f;})});}_0x3495a4=_[_0x24d3('0x46')]({},_0x3495a4,_0x4515ab['options']);return _0x507f15[_0x24d3('0x6d')](_0x3495a4);}})[_0x24d3('0x2e')](function(_0x5dfe99){if(!_['isEmpty'](_0x5dfe99)){var _0x3a672f=toCsv(_0x5dfe99);var _0x5c657b=Date[_0x24d3('0x75')]();fs[_0x24d3('0x76')](util[_0x24d3('0x71')](_0x24d3('0x77'),_0x507f15['id'],_0x5c657b),_0x3a672f);_0x2e91fe[_0x24d3('0x78')]('Content-disposition',_0x24d3('0x79')+util[_0x24d3('0x71')](_0x24d3('0x7a'),_0x507f15['id'],_0x5c657b));_0x2e91fe[_0x24d3('0x78')]('Content-type',_0x24d3('0x7b'));return _0x2e91fe['download'](util['format']('/tmp/list_%d_%s.csv',_0x507f15['id'],_0x5c657b));}else{return _0x2e91fe['sendStatus'](0xcc);}})[_0x24d3('0x4b')](handleError(_0x2e91fe,null));};exports[_0x24d3('0x7c')]=function(_0x2a2eda,_0xe55434,_0x4185fb){var _0x4932b2;delete _0x2a2eda['body']['id'];return db[_0x24d3('0x35')][_0x24d3('0x5c')]({'where':{'id':_0x2a2eda[_0x24d3('0x4d')]['id']}})[_0x24d3('0x2e')](handleEntityNotFound(_0xe55434,null))[_0x24d3('0x2e')](function(_0x2e3f10){if(_0x2e3f10){return db['sequelize'][_0x24d3('0x7d')](function(_0x5735d7){return db[_0x24d3('0x6e')][_0x24d3('0x4f')](_0x2a2eda[_0x24d3('0x50')],{'transaction':_0x5735d7})['then'](function(_0x2ac71c){_0x4932b2=_0x2ac71c;return _0x2e3f10[_0x24d3('0x7e')](_0x2ac71c,{'transaction':_0x5735d7});})['then'](function(){var _0x38203e={'type':db[_0x24d3('0x7f')][_0x24d3('0x80')],'transaction':_0x5735d7};switch(_0x2a2eda['body'][_0x24d3('0x37')]){case _0x24d3('0x81'):_0x38203e[_0x24d3('0x37')]=db[_0x24d3('0x7f')][_0x24d3('0x80')];break;case _0x24d3('0x82'):_0x38203e[_0x24d3('0x37')]=db['Sequelize'][_0x24d3('0x83')];break;case _0x24d3('0x84'):_0x38203e[_0x24d3('0x37')]=db['Sequelize']['BOOLEAN'];_0x38203e['defaultValue']=![];break;default:}return db['sequelize']['queryInterface'][_0x24d3('0x85')]('cm_contacts',util[_0x24d3('0x71')]('cf_%s',_0x4932b2['id']),_0x38203e);})[_0x24d3('0x2e')](function(){return _0x4932b2;});});}})['then'](respondWithResult(_0xe55434,null))['catch'](handleError(_0xe55434,null));};exports[_0x24d3('0x86')]=function(_0x234886,_0x34522b,_0x5a0f21){var _0x3398f6={};var _0x1e2fea={};var _0x3e4b6c;var _0x14aaa4;return db[_0x24d3('0x35')][_0x24d3('0x5c')]({'where':{'id':_0x234886[_0x24d3('0x4d')]['id']}})[_0x24d3('0x2e')](handleEntityNotFound(_0x34522b,null))['then'](function(_0x5770ad){if(_0x5770ad){_0x3e4b6c=_0x5770ad;_0x1e2fea[_0x24d3('0x38')]=_[_0x24d3('0x4e')](db[_0x24d3('0x6e')][_0x24d3('0x36')]);_0x1e2fea[_0x24d3('0x39')]=_[_0x24d3('0x4e')](_0x234886[_0x24d3('0x39')]);_0x1e2fea[_0x24d3('0x3a')]=_[_0x24d3('0x3b')](_0x1e2fea['model'],_0x1e2fea[_0x24d3('0x39')]);_0x3398f6[_0x24d3('0x3d')]=_['intersection'](_0x1e2fea['model'],qs[_0x24d3('0x3c')](_0x234886[_0x24d3('0x39')][_0x24d3('0x3c')]));_0x3398f6[_0x24d3('0x3d')]=_0x3398f6[_0x24d3('0x3d')][_0x24d3('0x3e')]?_0x3398f6[_0x24d3('0x3d')]:_0x1e2fea[_0x24d3('0x38')];_0x3398f6[_0x24d3('0x41')]=qs[_0x24d3('0x42')](_0x234886['query'][_0x24d3('0x42')]);_0x3398f6[_0x24d3('0x43')]=qs[_0x24d3('0x3a')](_[_0x24d3('0x44')](_0x234886[_0x24d3('0x39')],_0x1e2fea['filters']));_0x3398f6[_0x24d3('0x43')]=_[_0x24d3('0x46')](_0x3398f6['where'],{'$or':[{'ListId':_0x5770ad['id']},{'ListId':null}]});if(_0x234886[_0x24d3('0x39')][_0x24d3('0x45')]){_0x3398f6['where']=_['merge'](_0x3398f6[_0x24d3('0x43')],{'$or':_[_0x24d3('0x34')](_0x3398f6[_0x24d3('0x3d')],function(_0x5b4390){var _0x58b703={};_0x58b703[_0x5b4390]={'$like':'%'+_0x234886['query'][_0x24d3('0x45')]+'%'};return _0x58b703;})});}_0x3398f6=_[_0x24d3('0x46')]({},_0x3398f6,_0x234886[_0x24d3('0x47')]);return db[_0x24d3('0x6e')][_0x24d3('0x87')](_0x3398f6);}})['then'](respondWithResult(_0x34522b,null))[_0x24d3('0x4b')](handleError(_0x34522b,null));};exports[_0x24d3('0x88')]=function(_0x192b96,_0x4cb26f,_0x2dd9a3){return db[_0x24d3('0x35')]['find']({'where':{'id':_0x192b96[_0x24d3('0x4d')]['id']}})[_0x24d3('0x2e')](handleEntityNotFound(_0x4cb26f,null))[_0x24d3('0x2e')](function(_0x2a11eb){if(_0x2a11eb){return _0x2a11eb[_0x24d3('0x88')](_0x192b96[_0x24d3('0x50')][_0x24d3('0x60')],_[_0x24d3('0x68')](_0x192b96[_0x24d3('0x50')],[_0x24d3('0x60'),'id'])||{})['spread'](function(_0x264da4){for(var _0x378ee0=0x0;_0x378ee0<_0x192b96['body'][_0x24d3('0x60')][_0x24d3('0x3e')];_0x378ee0+=0x1){socket[_0x24d3('0x89')]('userCmList:save',{'UserId':Number(_0x192b96[_0x24d3('0x50')][_0x24d3('0x60')][_0x378ee0]),'CmListId':Number(_0x192b96[_0x24d3('0x4d')]['id'])});}return _0x264da4;});}})[_0x24d3('0x2e')](respondWithResult(_0x4cb26f,null))['catch'](handleError(_0x4cb26f,null));};exports[_0x24d3('0x8a')]=function(_0x2905c0,_0x1d259b,_0x4c21ca){return db[_0x24d3('0x35')][_0x24d3('0x55')]({'where':{'id':_0x2905c0[_0x24d3('0x4d')]['id']}})[_0x24d3('0x2e')](handleEntityNotFound(_0x1d259b,null))[_0x24d3('0x2e')](function(_0x462d3d){if(_0x462d3d){return _0x462d3d[_0x24d3('0x8a')](_0x2905c0[_0x24d3('0x39')][_0x24d3('0x60')])[_0x24d3('0x2e')](function(){if(_[_0x24d3('0x64')](_0x2905c0[_0x24d3('0x39')][_0x24d3('0x60')])){for(var _0x409ed4=0x0;_0x409ed4<_0x2905c0[_0x24d3('0x39')]['ids'][_0x24d3('0x3e')];_0x409ed4+=0x1){socket[_0x24d3('0x89')](_0x24d3('0x8b'),{'UserId':Number(_0x2905c0[_0x24d3('0x39')][_0x24d3('0x60')][_0x409ed4]),'CmListId':Number(_0x2905c0['params']['id'])});}}else{socket['emit'](_0x24d3('0x8b'),{'UserId':Number(_0x2905c0['query'][_0x24d3('0x60')]),'CmListId':Number(_0x2905c0[_0x24d3('0x4d')]['id'])});}});}})[_0x24d3('0x2e')](respondWithStatusCode(_0x1d259b,null))[_0x24d3('0x4b')](handleError(_0x1d259b,null));};exports[_0x24d3('0x8c')]=function(_0x3a9eb8,_0x45f5df,_0x128fbb){var _0x2d1ff9={};var _0x2efaaa={};var _0x24aef7;var _0x133b02;return db[_0x24d3('0x35')]['findOne']({'where':{'id':_0x3a9eb8[_0x24d3('0x4d')]['id']}})[_0x24d3('0x2e')](handleEntityNotFound(_0x45f5df,null))[_0x24d3('0x2e')](function(_0x52eefd){if(_0x52eefd){_0x24aef7=_0x52eefd;_0x2efaaa[_0x24d3('0x38')]=_[_0x24d3('0x4e')](db[_0x24d3('0x8d')][_0x24d3('0x36')]);_0x2efaaa[_0x24d3('0x39')]=_[_0x24d3('0x4e')](_0x3a9eb8[_0x24d3('0x39')]);_0x2efaaa[_0x24d3('0x3a')]=_['intersection'](_0x2efaaa['model'],_0x2efaaa[_0x24d3('0x39')]);_0x2d1ff9[_0x24d3('0x3d')]=_[_0x24d3('0x3b')](_0x2efaaa[_0x24d3('0x38')],qs[_0x24d3('0x3c')](_0x3a9eb8[_0x24d3('0x39')]['fields']));_0x2d1ff9[_0x24d3('0x3d')]=_0x2d1ff9[_0x24d3('0x3d')][_0x24d3('0x3e')]?_0x2d1ff9[_0x24d3('0x3d')]:_0x2efaaa[_0x24d3('0x38')];_0x2d1ff9['order']=qs[_0x24d3('0x42')](_0x3a9eb8[_0x24d3('0x39')][_0x24d3('0x42')]);_0x2d1ff9[_0x24d3('0x43')]=qs[_0x24d3('0x3a')](_['pick'](_0x3a9eb8[_0x24d3('0x39')],_0x2efaaa['filters']));if(_0x3a9eb8[_0x24d3('0x39')][_0x24d3('0x45')]){_0x2d1ff9[_0x24d3('0x43')]=_[_0x24d3('0x46')](_0x2d1ff9[_0x24d3('0x43')],{'$or':_['map'](_0x2d1ff9[_0x24d3('0x3d')],function(_0x208461){var _0x5f37ac={};_0x5f37ac[_0x208461]={'$like':'%'+_0x3a9eb8[_0x24d3('0x39')][_0x24d3('0x45')]+'%'};return _0x5f37ac;})});}_0x2d1ff9=_[_0x24d3('0x46')]({},_0x2d1ff9,_0x3a9eb8[_0x24d3('0x47')]);return _0x24aef7[_0x24d3('0x8c')](_0x2d1ff9);}})[_0x24d3('0x2e')](function(_0x33e724){if(_0x33e724){_0x133b02=_0x33e724[_0x24d3('0x3e')];if(!_0x3a9eb8['query']['hasOwnProperty'](_0x24d3('0x40'))){_0x2d1ff9[_0x24d3('0x27')]=qs[_0x24d3('0x27')](_0x3a9eb8[_0x24d3('0x39')][_0x24d3('0x27')]);_0x2d1ff9[_0x24d3('0x25')]=qs[_0x24d3('0x25')](_0x3a9eb8['query'][_0x24d3('0x25')]);}return _0x24aef7[_0x24d3('0x8c')](_0x2d1ff9);}})[_0x24d3('0x2e')](function(_0x37df07){if(_0x37df07){return _0x37df07?{'count':_0x133b02,'rows':_0x37df07}:null;}})[_0x24d3('0x2e')](respondWithResult(_0x45f5df,null))[_0x24d3('0x4b')](handleError(_0x45f5df,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 4341243..7394db6 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x13fef9,_0xbb55cc){var _0x110c18=function(_0x34ba1b){while(--_0x34ba1b){_0x13fef9['push'](_0x13fef9['shift']());}};_0x110c18(++_0xbb55cc);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file +var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x4e6eb2,_0x16a451){var _0x4e0c1c=function(_0x59f144){while(--_0x59f144){_0x4e6eb2['push'](_0x4e6eb2['shift']());}};_0x4e0c1c(++_0x16a451);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1f83a5,_0x59843f){_0x1f83a5=_0x1f83a5-0x0;var _0x45edf0=_0x5fc3[_0x1f83a5];return _0x45edf0;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index a70537c..ff5e62b 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 _0x668b=['cm_lists','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./cmList.attributes','define','CmList'];(function(_0x142156,_0x5169f8){var _0x5b1ea3=function(_0x26080b){while(--_0x26080b){_0x142156['push'](_0x142156['shift']());}};_0x5b1ea3(++_0x5169f8);}(_0x668b,0x140));var _0xb668=function(_0x35a140,_0x3aeac6){_0x35a140=_0x35a140-0x0;var _0x30ab82=_0x668b[_0x35a140];return _0x30ab82;};'use strict';var _=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var logger=require('../../config/logger')(_0xb668('0x2'));var moment=require(_0xb668('0x3'));var BPromise=require('bluebird');var rp=require(_0xb668('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb668('0x5'));var config=require(_0xb668('0x6'));var attributes=require(_0xb668('0x7'));module['exports']=function(_0x9b99a8,_0x296fa9){return _0x9b99a8[_0xb668('0x8')](_0xb668('0x9'),attributes,{'tableName':_0xb668('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2ea=['cm_lists','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList'];(function(_0xb7f071,_0x34134a){var _0xdc2c6d=function(_0x58cdff){while(--_0x58cdff){_0xb7f071['push'](_0xb7f071['shift']());}};_0xdc2c6d(++_0x34134a);}(_0xd2ea,0x15f));var _0xad2e=function(_0x1ca1d3,_0x4f3c92){_0x1ca1d3=_0x1ca1d3-0x0;var _0x4d7c74=_0xd2ea[_0x1ca1d3];return _0x4d7c74;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var logger=require(_0xad2e('0x2'))(_0xad2e('0x3'));var moment=require(_0xad2e('0x4'));var BPromise=require('bluebird');var rp=require(_0xad2e('0x5'));var fs=require('fs');var path=require(_0xad2e('0x6'));var rimraf=require(_0xad2e('0x7'));var config=require(_0xad2e('0x8'));var attributes=require(_0xad2e('0x9'));module[_0xad2e('0xa')]=function(_0x29e97f,_0x592e8b){return _0x29e97f[_0xad2e('0xb')](_0xad2e('0xc'),attributes,{'tableName':_0xad2e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 57c0bce..29e5163 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 _0x6164=['defaults','socket.io-emitter','./cmList.socket','request','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis'];(function(_0x206711,_0x4125b4){var _0x4fe02b=function(_0x27dc45){while(--_0x27dc45){_0x206711['push'](_0x206711['shift']());}};_0x4fe02b(++_0x4125b4);}(_0x6164,0x6d));var _0x4616=function(_0x3e2480,_0x2eed70){_0x3e2480=_0x3e2480-0x0;var _0x652c0=_0x6164[_0x3e2480];return _0x652c0;};'use strict';var _=require(_0x4616('0x0'));var util=require(_0x4616('0x1'));var moment=require(_0x4616('0x2'));var BPromise=require(_0x4616('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4616('0x4'));var db=require(_0x4616('0x5'))['db'];var utils=require(_0x4616('0x6'));var logger=require('../../config/logger')(_0x4616('0x7'));var config=require('../../config/environment');var jayson=require(_0x4616('0x8'));var client=jayson[_0x4616('0x9')]['http']({'port':0x232a});config[_0x4616('0xa')]=_[_0x4616('0xb')](config[_0x4616('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x4616('0xc'))(new Redis(config['redis']));require(_0x4616('0xd'))['register'](socket);function respondWithRpcPromise(_0x1e2f2d,_0x10d5e8,_0x3a1be6){return new BPromise(function(_0x1ccc6b,_0x376555){return client[_0x4616('0xe')](_0x1e2f2d,_0x3a1be6)['then'](function(_0x11970b){logger['info'](_0x4616('0xf'),_0x10d5e8,_0x4616('0x10'));logger[_0x4616('0x11')]('CmList,\x20%s,\x20%s,\x20%s',_0x10d5e8,_0x4616('0x10'),JSON[_0x4616('0x12')](_0x11970b));if(_0x11970b[_0x4616('0x13')]){if(_0x11970b[_0x4616('0x13')][_0x4616('0x14')]===0x1f4){logger[_0x4616('0x13')](_0x4616('0xf'),_0x10d5e8,_0x11970b[_0x4616('0x13')][_0x4616('0x15')]);return _0x376555(_0x11970b['error'][_0x4616('0x15')]);}logger['error'](_0x4616('0xf'),_0x10d5e8,_0x11970b[_0x4616('0x13')][_0x4616('0x15')]);return _0x1ccc6b(_0x11970b[_0x4616('0x13')]['message']);}else{logger[_0x4616('0x16')](_0x4616('0xf'),_0x10d5e8,_0x4616('0x10'));_0x1ccc6b(_0x11970b[_0x4616('0x17')]['message']);}})['catch'](function(_0x2efa96){logger[_0x4616('0x13')]('CmList,\x20%s,\x20%s',_0x10d5e8,_0x2efa96);_0x376555(_0x2efa96);});});} \ No newline at end of file +var _0x56f9=['../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./cmList.socket','then','info','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','bluebird','../../mysqldb'];(function(_0x37c5c1,_0x3dafe9){var _0xb2a21f=function(_0x3bcc63){while(--_0x3bcc63){_0x37c5c1['push'](_0x37c5c1['shift']());}};_0xb2a21f(++_0x3dafe9);}(_0x56f9,0xf9));var _0x956f=function(_0x49616c,_0x4c3a08){_0x49616c=_0x49616c-0x0;var _0x4ccb3c=_0x56f9[_0x49616c];return _0x4ccb3c;};'use strict';var _=require(_0x956f('0x0'));var util=require(_0x956f('0x1'));var moment=require('moment');var BPromise=require(_0x956f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x956f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x956f('0x4'))(_0x956f('0x5'));var config=require(_0x956f('0x6'));var jayson=require(_0x956f('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x956f('0x8')]=_[_0x956f('0x9')](config['redis'],{'host':_0x956f('0xa'),'port':0x18eb});var socket=require(_0x956f('0xb'))(new Redis(config['redis']));require(_0x956f('0xc'))['register'](socket);function respondWithRpcPromise(_0x3d366d,_0x5952f1,_0x14dc25){return new BPromise(function(_0x18a044,_0x21e0b8){return client['request'](_0x3d366d,_0x14dc25)[_0x956f('0xd')](function(_0x419bbd){logger[_0x956f('0xe')](_0x956f('0xf'),_0x5952f1,'request\x20sent');logger[_0x956f('0x10')](_0x956f('0x11'),_0x5952f1,_0x956f('0x12'),JSON['stringify'](_0x419bbd));if(_0x419bbd['error']){if(_0x419bbd[_0x956f('0x13')][_0x956f('0x14')]===0x1f4){logger[_0x956f('0x13')](_0x956f('0xf'),_0x5952f1,_0x419bbd[_0x956f('0x13')][_0x956f('0x15')]);return _0x21e0b8(_0x419bbd[_0x956f('0x13')][_0x956f('0x15')]);}logger[_0x956f('0x13')](_0x956f('0xf'),_0x5952f1,_0x419bbd[_0x956f('0x13')][_0x956f('0x15')]);return _0x18a044(_0x419bbd[_0x956f('0x13')][_0x956f('0x15')]);}else{logger['info'](_0x956f('0xf'),_0x5952f1,_0x956f('0x12'));_0x18a044(_0x419bbd['result']['message']);}})[_0x956f('0x16')](function(_0x4e60b7){logger[_0x956f('0x13')](_0x956f('0xf'),_0x5952f1,_0x4e60b7);_0x21e0b8(_0x4e60b7);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 7ae51e9..d085cfd 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 _0xe776=['remove','update','emit','removeListener','register','length','cmList:','./cmList.events','save'];(function(_0x1d4d67,_0x5c92b6){var _0x9fd1fb=function(_0x44d9e9){while(--_0x44d9e9){_0x1d4d67['push'](_0x1d4d67['shift']());}};_0x9fd1fb(++_0x5c92b6);}(_0xe776,0xc4));var _0x6e77=function(_0x4c727f,_0x312e30){_0x4c727f=_0x4c727f-0x0;var _0x10b72b=_0xe776[_0x4c727f];return _0x10b72b;};'use strict';var CmListEvents=require(_0x6e77('0x0'));var events=[_0x6e77('0x1'),_0x6e77('0x2'),_0x6e77('0x3')];function createListener(_0x48b69b,_0x11b191){return function(_0x44adbb){_0x11b191[_0x6e77('0x4')](_0x48b69b,_0x44adbb);};}function removeListener(_0x48af48,_0x52383c){return function(){CmListEvents[_0x6e77('0x5')](_0x48af48,_0x52383c);};}exports[_0x6e77('0x6')]=function(_0x106ca9){for(var _0x5a1a50=0x0,_0x3e771d=events[_0x6e77('0x7')];_0x5a1a50<_0x3e771d;_0x5a1a50++){var _0x53c51c=events[_0x5a1a50];var _0x112485=createListener(_0x6e77('0x8')+_0x53c51c,_0x106ca9);CmListEvents['on'](_0x53c51c,_0x112485);}}; \ No newline at end of file +var _0xa997=['update','removeListener','register','length','cmList:','./cmList.events','save'];(function(_0x108704,_0x4fa981){var _0x4b783e=function(_0x3b6e54){while(--_0x3b6e54){_0x108704['push'](_0x108704['shift']());}};_0x4b783e(++_0x4fa981);}(_0xa997,0xb4));var _0x7a99=function(_0x3c8b46,_0x34e053){_0x3c8b46=_0x3c8b46-0x0;var _0x4bf0a8=_0xa997[_0x3c8b46];return _0x4bf0a8;};'use strict';var CmListEvents=require(_0x7a99('0x0'));var events=[_0x7a99('0x1'),'remove',_0x7a99('0x2')];function createListener(_0x33ef39,_0x4d82ea){return function(_0x468f32){_0x4d82ea['emit'](_0x33ef39,_0x468f32);};}function removeListener(_0x4c2b05,_0x4be712){return function(){CmListEvents[_0x7a99('0x3')](_0x4c2b05,_0x4be712);};}exports[_0x7a99('0x4')]=function(_0x294e76){for(var _0x3ca413=0x0,_0x3aad7e=events[_0x7a99('0x5')];_0x3ca413<_0x3aad7e;_0x3ca413++){var _0x1b5108=events[_0x3ca413];var _0x264cf6=createListener(_0x7a99('0x6')+_0x1b5108,_0x294e76);CmListEvents['on'](_0x1b5108,_0x264cf6);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index ef4005e..5757c14 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 _0x668d=['delete','/:id/dispositions','removeDispositions','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','show','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','/:id','update'];(function(_0x3fb9ca,_0x28de6d){var _0x5e0b5e=function(_0x5ad64d){while(--_0x5ad64d){_0x3fb9ca['push'](_0x3fb9ca['shift']());}};_0x5e0b5e(++_0x28de6d);}(_0x668d,0x1c0));var _0xd668=function(_0x4d6d8a,_0x4efda0){_0x4d6d8a=_0x4d6d8a-0x0;var _0x306157=_0x668d[_0x4d6d8a];return _0x306157;};'use strict';var multer=require(_0xd668('0x0'));var util=require(_0xd668('0x1'));var path=require(_0xd668('0x2'));var timeout=require(_0xd668('0x3'));var express=require('express');var router=express[_0xd668('0x4')]();var fs_extra=require(_0xd668('0x5'));var auth=require(_0xd668('0x6'));var interaction=require(_0xd668('0x7'));var config=require(_0xd668('0x8'));var controller=require(_0xd668('0x9'));router[_0xd668('0xa')]('/',auth[_0xd668('0xb')](),controller[_0xd668('0xc')]);router[_0xd668('0xa')](_0xd668('0xd'),auth[_0xd668('0xb')](),controller[_0xd668('0xe')]);router[_0xd668('0xa')]('/:id',auth[_0xd668('0xb')](),controller[_0xd668('0xf')]);router[_0xd668('0xa')]('/:id/dispositions',auth[_0xd668('0xb')](),controller[_0xd668('0x10')]);router[_0xd668('0xa')](_0xd668('0x11'),auth[_0xd668('0xb')](),controller[_0xd668('0x12')]);router['get'](_0xd668('0x13'),auth[_0xd668('0xb')](),controller[_0xd668('0x14')]);router[_0xd668('0xa')](_0xd668('0x15'),auth[_0xd668('0xb')](),controller[_0xd668('0x16')]);router[_0xd668('0xa')](_0xd668('0x17'),auth[_0xd668('0xb')](),controller[_0xd668('0x18')]);router[_0xd668('0x19')]('/',auth['isAuthenticated'](),controller[_0xd668('0x1a')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xd668('0x1b')]);router[_0xd668('0x19')]('/:id/contacts',auth['isAuthenticated'](),controller['addContacts']);router['post'](_0xd668('0x15'),auth['isAuthenticated'](),controller[_0xd668('0x1c')]);router[_0xd668('0x19')](_0xd668('0x17'),auth[_0xd668('0xb')](),controller[_0xd668('0x1d')]);router[_0xd668('0x1e')](_0xd668('0x1f'),auth['isAuthenticated'](),controller[_0xd668('0x20')]);router[_0xd668('0x21')](_0xd668('0x1f'),auth['isAuthenticated'](),controller['destroy']);router[_0xd668('0x21')](_0xd668('0x22'),auth[_0xd668('0xb')](),controller[_0xd668('0x23')]);router[_0xd668('0x21')](_0xd668('0x17'),auth[_0xd668('0xb')](),controller['removeAgents']);module[_0xd668('0x24')]=router; \ No newline at end of file +var _0xa152=['/describe','describe','show','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','/:id/fields','getAgents','post','create','addDisposition','addContacts','addCustomField','/:id/users','addAgents','delete','/:id','removeDispositions','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cmList.controller','get','isAuthenticated','index'];(function(_0x5f2096,_0x4145e6){var _0x4f2be5=function(_0x4070){while(--_0x4070){_0x5f2096['push'](_0x5f2096['shift']());}};_0x4f2be5(++_0x4145e6);}(_0xa152,0x1b4));var _0x2a15=function(_0x11f385,_0x26ac16){_0x11f385=_0x11f385-0x0;var _0x2d6098=_0xa152[_0x11f385];return _0x2d6098;};'use strict';var multer=require(_0x2a15('0x0'));var util=require(_0x2a15('0x1'));var path=require(_0x2a15('0x2'));var timeout=require(_0x2a15('0x3'));var express=require(_0x2a15('0x4'));var router=express[_0x2a15('0x5')]();var fs_extra=require(_0x2a15('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2a15('0x7'));var config=require('../../config/environment');var controller=require(_0x2a15('0x8'));router[_0x2a15('0x9')]('/',auth[_0x2a15('0xa')](),controller[_0x2a15('0xb')]);router['get'](_0x2a15('0xc'),auth[_0x2a15('0xa')](),controller[_0x2a15('0xd')]);router[_0x2a15('0x9')]('/:id',auth[_0x2a15('0xa')](),controller[_0x2a15('0xe')]);router['get'](_0x2a15('0xf'),auth[_0x2a15('0xa')](),controller[_0x2a15('0x10')]);router[_0x2a15('0x9')](_0x2a15('0x11'),auth[_0x2a15('0xa')](),controller['getContacts']);router[_0x2a15('0x9')](_0x2a15('0x12'),auth[_0x2a15('0xa')](),controller['getContactsCsv']);router[_0x2a15('0x9')](_0x2a15('0x13'),auth[_0x2a15('0xa')](),controller['getCustomFields']);router[_0x2a15('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x2a15('0x14')]);router[_0x2a15('0x15')]('/',auth[_0x2a15('0xa')](),controller[_0x2a15('0x16')]);router['post']('/:id/dispositions',auth[_0x2a15('0xa')](),controller[_0x2a15('0x17')]);router[_0x2a15('0x15')](_0x2a15('0x11'),auth[_0x2a15('0xa')](),controller[_0x2a15('0x18')]);router[_0x2a15('0x15')]('/:id/fields',auth[_0x2a15('0xa')](),controller[_0x2a15('0x19')]);router[_0x2a15('0x15')](_0x2a15('0x1a'),auth['isAuthenticated'](),controller[_0x2a15('0x1b')]);router['put']('/:id',auth[_0x2a15('0xa')](),controller['update']);router[_0x2a15('0x1c')](_0x2a15('0x1d'),auth[_0x2a15('0xa')](),controller['destroy']);router[_0x2a15('0x1c')]('/:id/dispositions',auth[_0x2a15('0xa')](),controller[_0x2a15('0x1e')]);router[_0x2a15('0x1c')](_0x2a15('0x1a'),auth[_0x2a15('0xa')](),controller[_0x2a15('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 438d814..2b7df63 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 _0xd97a=['VIRTUAL','field','STRING','exports'];(function(_0x5c879e,_0xe58074){var _0x30942b=function(_0x535b57){while(--_0x535b57){_0x5c879e['push'](_0x5c879e['shift']());}};_0x30942b(++_0xe58074);}(_0xd97a,0xef));var _0xad97=function(_0x111fd9,_0x237b96){_0x111fd9=_0x111fd9-0x0;var _0x397c7e=_0xd97a[_0x111fd9];return _0x397c7e;};'use strict';var Sequelize=require('sequelize');module[_0xad97('0x0')]={'name':{'type':Sequelize[_0xad97('0x1')],'get':function(_0x2cdbd0){return this['getDataValue'](_0xad97('0x2'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0xad97('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0xad97('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x5521=['STRING','sequelize','exports','VIRTUAL','getDataValue','field'];(function(_0x3fa36a,_0x475ce9){var _0x61133f=function(_0xe8e1b4){while(--_0xe8e1b4){_0x3fa36a['push'](_0x3fa36a['shift']());}};_0x61133f(++_0x475ce9);}(_0x5521,0x181));var _0x1552=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x5521[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x1552('0x0'));module[_0x1552('0x1')]={'name':{'type':Sequelize[_0x1552('0x2')],'get':function(_0x2dc29c){return this[_0x1552('0x3')](_0x1552('0x4'));}},'field':{'type':Sequelize[_0x1552('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x1552('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x1552('0x5')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 0349c89..8083b25 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(_0x266181,_0x2e0297){var _0x215552=function(_0x53aa06){while(--_0x53aa06){_0x266181['push'](_0x266181['shift']());}};_0x215552(++_0x2e0297);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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(_0x4e11f0,_0x5a3382){var _0x2f8d4b=function(_0x633d4b){while(--_0x633d4b){_0x4e11f0['push'](_0x4e11f0['shift']());}};_0x2f8d4b(++_0x5a3382);}(_0x7a54,0x106));var _0x47a5=function(_0x358fbd,_0x410dab){_0x358fbd=_0x358fbd-0x0;var _0x391e59=_0x7a54[_0x358fbd];return _0x391e59;};'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 1892d7e..e4094d3 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 _0x296b=['Condition','tools_conditions','lodash','../../config/logger','api','bluebird','request-promise','path','./condition.attributes','define'];(function(_0x3e10be,_0x1542c8){var _0x53ff27=function(_0x3d2377){while(--_0x3d2377){_0x3e10be['push'](_0x3e10be['shift']());}};_0x53ff27(++_0x1542c8);}(_0x296b,0x1b0));var _0xb296=function(_0x273f88,_0x5d4150){_0x273f88=_0x273f88-0x0;var _0x177ca1=_0x296b[_0x273f88];return _0x177ca1;};'use strict';var _=require(_0xb296('0x0'));var util=require('util');var logger=require(_0xb296('0x1'))(_0xb296('0x2'));var moment=require('moment');var BPromise=require(_0xb296('0x3'));var rp=require(_0xb296('0x4'));var fs=require('fs');var path=require(_0xb296('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb296('0x6'));module['exports']=function(_0xe42119,_0x18ed4c){return _0xe42119[_0xb296('0x7')](_0xb296('0x8'),attributes,{'tableName':_0xb296('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7049=['../../config/environment','./condition.attributes','exports','Condition','tools_conditions','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7049,0x1f1));var _0x9704=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x7049[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x9704('0x0'));var util=require('util');var logger=require(_0x9704('0x1'))(_0x9704('0x2'));var moment=require(_0x9704('0x3'));var BPromise=require('bluebird');var rp=require(_0x9704('0x4'));var fs=require('fs');var path=require(_0x9704('0x5'));var rimraf=require(_0x9704('0x6'));var config=require(_0x9704('0x7'));var attributes=require(_0x9704('0x8'));module[_0x9704('0x9')]=function(_0x2ac94f,_0x2bbcbf){return _0x2ac94f['define'](_0x9704('0xa'),attributes,{'tableName':_0x9704('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 319de4a..7e4c9b5 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 _0x1603=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','debug','stringify','error','code','Condition,\x20%s,\x20%s','message','request\x20sent','moment'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x1603,0x1f3));var _0x3160=function(_0x1203ef,_0x4c69a1){_0x1203ef=_0x1203ef-0x0;var _0x1f2b50=_0x1603[_0x1203ef];return _0x1f2b50;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3160('0x0'));var BPromise=require(_0x3160('0x1'));var rs=require(_0x3160('0x2'));var fs=require('fs');var Redis=require(_0x3160('0x3'));var db=require(_0x3160('0x4'))['db'];var utils=require(_0x3160('0x5'));var logger=require(_0x3160('0x6'))(_0x3160('0x7'));var config=require(_0x3160('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3160('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51cf07,_0x36331a,_0x2b0808){return new BPromise(function(_0x3e0e90,_0x5cf66e){return client[_0x3160('0xa')](_0x51cf07,_0x2b0808)[_0x3160('0xb')](function(_0x29d444){logger[_0x3160('0xc')]('Condition,\x20%s,\x20%s',_0x36331a,'request\x20sent');logger[_0x3160('0xd')]('Condition,\x20%s,\x20%s,\x20%s',_0x36331a,'request\x20sent',JSON[_0x3160('0xe')](_0x29d444));if(_0x29d444[_0x3160('0xf')]){if(_0x29d444['error'][_0x3160('0x10')]===0x1f4){logger[_0x3160('0xf')](_0x3160('0x11'),_0x36331a,_0x29d444[_0x3160('0xf')][_0x3160('0x12')]);return _0x5cf66e(_0x29d444[_0x3160('0xf')][_0x3160('0x12')]);}logger['error'](_0x3160('0x11'),_0x36331a,_0x29d444[_0x3160('0xf')]['message']);return _0x3e0e90(_0x29d444[_0x3160('0xf')][_0x3160('0x12')]);}else{logger[_0x3160('0xc')](_0x3160('0x11'),_0x36331a,_0x3160('0x13'));_0x3e0e90(_0x29d444['result'][_0x3160('0x12')]);}})['catch'](function(_0x64551e){logger[_0x3160('0xf')](_0x3160('0x11'),_0x36331a,_0x64551e);_0x5cf66e(_0x64551e);});});} \ No newline at end of file +var _0x9ca5=['../../config/logger','../../config/environment','jayson/promise','client','then','info','Condition,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x3dc55d,_0xd07e93){var _0x3aa7f3=function(_0x506b46){while(--_0x506b46){_0x3dc55d['push'](_0x3dc55d['shift']());}};_0x3aa7f3(++_0xd07e93);}(_0x9ca5,0x1ee));var _0x59ca=function(_0x52b0b2,_0xf6dbf9){_0x52b0b2=_0x52b0b2-0x0;var _0x322769=_0x9ca5[_0x52b0b2];return _0x322769;};'use strict';var _=require(_0x59ca('0x0'));var util=require(_0x59ca('0x1'));var moment=require(_0x59ca('0x2'));var BPromise=require(_0x59ca('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x59ca('0x4'))['db'];var utils=require(_0x59ca('0x5'));var logger=require(_0x59ca('0x6'))('rpc');var config=require(_0x59ca('0x7'));var jayson=require(_0x59ca('0x8'));var client=jayson[_0x59ca('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b6af6,_0x3b3899,_0x355387){return new BPromise(function(_0x27a955,_0x2ead3f){return client['request'](_0x5b6af6,_0x355387)[_0x59ca('0xa')](function(_0x4efa57){logger[_0x59ca('0xb')](_0x59ca('0xc'),_0x3b3899,'request\x20sent');logger[_0x59ca('0xd')]('Condition,\x20%s,\x20%s,\x20%s',_0x3b3899,_0x59ca('0xe'),JSON[_0x59ca('0xf')](_0x4efa57));if(_0x4efa57['error']){if(_0x4efa57[_0x59ca('0x10')][_0x59ca('0x11')]===0x1f4){logger[_0x59ca('0x10')](_0x59ca('0xc'),_0x3b3899,_0x4efa57['error'][_0x59ca('0x12')]);return _0x2ead3f(_0x4efa57[_0x59ca('0x10')]['message']);}logger['error'](_0x59ca('0xc'),_0x3b3899,_0x4efa57[_0x59ca('0x10')][_0x59ca('0x12')]);return _0x27a955(_0x4efa57[_0x59ca('0x10')][_0x59ca('0x12')]);}else{logger[_0x59ca('0xb')](_0x59ca('0xc'),_0x3b3899,_0x59ca('0xe'));_0x27a955(_0x4efa57['result'][_0x59ca('0x12')]);}})[_0x59ca('0x13')](function(_0x3ff44c){logger[_0x59ca('0x10')](_0x59ca('0xc'),_0x3b3899,_0x3ff44c);_0x2ead3f(_0x3ff44c);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 0feffab..38ec8a8 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 _0x5caf=['isAuthenticated','/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','put'];(function(_0x397f0d,_0x321cdb){var _0x44059c=function(_0x2f8929){while(--_0x2f8929){_0x397f0d['push'](_0x397f0d['shift']());}};_0x44059c(++_0x321cdb);}(_0x5caf,0x149));var _0xf5ca=function(_0x396e2d,_0x7831f8){_0x396e2d=_0x396e2d-0x0;var _0x31b7bb=_0x5caf[_0x396e2d];return _0x31b7bb;};'use strict';var multer=require(_0xf5ca('0x0'));var util=require(_0xf5ca('0x1'));var path=require(_0xf5ca('0x2'));var timeout=require('connect-timeout');var express=require(_0xf5ca('0x3'));var router=express[_0xf5ca('0x4')]();var fs_extra=require(_0xf5ca('0x5'));var auth=require(_0xf5ca('0x6'));var interaction=require(_0xf5ca('0x7'));var config=require('../../config/environment');var controller=require('./condition.controller');router[_0xf5ca('0x8')]('/:id',auth[_0xf5ca('0x9')](),controller['update']);router['delete'](_0xf5ca('0xa'),auth[_0xf5ca('0x9')](),controller[_0xf5ca('0xb')]);module[_0xf5ca('0xc')]=router; \ No newline at end of file +var _0x430b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x430b,0x1b0));var _0xb430=function(_0x602ca8,_0x568e82){_0x602ca8=_0x602ca8-0x0;var _0x26e8ab=_0x430b[_0x602ca8];return _0x26e8ab;};'use strict';var multer=require(_0xb430('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb430('0x1'));var express=require(_0xb430('0x2'));var router=express[_0xb430('0x3')]();var fs_extra=require(_0xb430('0x4'));var auth=require(_0xb430('0x5'));var interaction=require(_0xb430('0x6'));var config=require(_0xb430('0x7'));var controller=require(_0xb430('0x8'));router[_0xb430('0x9')](_0xb430('0xa'),auth[_0xb430('0xb')](),controller['update']);router[_0xb430('0xc')](_0xb430('0xa'),auth[_0xb430('0xb')](),controller[_0xb430('0xd')]);module[_0xb430('0xe')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 9eafe90..ae89b0c 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 _0x0713=['STRING','name'];(function(_0xab19c8,_0x3debf2){var _0x5e459f=function(_0x3af030){while(--_0x3af030){_0xab19c8['push'](_0xab19c8['shift']());}};_0x5e459f(++_0x3debf2);}(_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 +var _0xb7e7=['STRING','sequelize'];(function(_0x179e11,_0xf65436){var _0x549f04=function(_0x610545){while(--_0x610545){_0x179e11['push'](_0x179e11['shift']());}};_0x549f04(++_0xf65436);}(_0xb7e7,0x121));var _0x7b7e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb7e7[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index b6b2b6f..a9e8db4 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 _0x4b16=['attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','findOne','hasOwnProperty','getItems','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./dashboard.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','end','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','options','Dashboard','includeAll','include','findAll','rows','catch','show','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','updatedAt'];(function(_0xca8ee6,_0x500814){var _0x338251=function(_0x5ef912){while(--_0x5ef912){_0xca8ee6['push'](_0xca8ee6['shift']());}};_0x338251(++_0x500814);}(_0x4b16,0x183));var _0x64b1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4b16[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x64b1('0x0'));var rp=require(_0x64b1('0x1'));var moment=require(_0x64b1('0x2'));var BPromise=require(_0x64b1('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x64b1('0x4'));var sox=require(_0x64b1('0x5'));var csv=require('to-csv');var ejs=require(_0x64b1('0x6'));var fs=require('fs');var fs_extra=require(_0x64b1('0x7'));var _=require(_0x64b1('0x8'));var squel=require(_0x64b1('0x9'));var crypto=require(_0x64b1('0xa'));var jsforce=require(_0x64b1('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x64b1('0xc'));var querystring=require('querystring');var Papa=require(_0x64b1('0xd'));var Redis=require(_0x64b1('0xe'));var authService=require(_0x64b1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x64b1('0x10'));var hardwareService=require(_0x64b1('0x11'));var logger=require(_0x64b1('0x12'))('api');var utils=require(_0x64b1('0x13'));var config=require(_0x64b1('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x64b1('0x15'))['db'];config[_0x64b1('0x16')]=_[_0x64b1('0x17')](config[_0x64b1('0x16')],{'host':_0x64b1('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x64b1('0x16')]));require(_0x64b1('0x19'))['register'](socket);function respondWithStatusCode(_0x30e505,_0x3fd932){_0x3fd932=_0x3fd932||0xcc;return function(_0x52dfd0){if(_0x52dfd0){return _0x30e505[_0x64b1('0x1a')](_0x3fd932);}return _0x30e505[_0x64b1('0x1b')](_0x3fd932)['end']();};}function respondWithResult(_0x15316c,_0x243ef4){_0x243ef4=_0x243ef4||0xc8;return function(_0x4c8806){if(_0x4c8806){return _0x15316c[_0x64b1('0x1b')](_0x243ef4)[_0x64b1('0x1c')](_0x4c8806);}};}function respondWithFilteredResult(_0x42c8f7,_0x146e39){return function(_0x67fa46){if(_0x67fa46){var _0x23ae3c=typeof _0x146e39[_0x64b1('0x1d')]===_0x64b1('0x1e')&&typeof _0x146e39[_0x64b1('0x1f')]===_0x64b1('0x1e');var _0x2cda64=_0x67fa46[_0x64b1('0x20')];var _0x2d7d37=_0x23ae3c?0x0:_0x146e39['offset'];var _0x5c859a=_0x23ae3c?_0x67fa46['count']:_0x146e39[_0x64b1('0x1d')]+_0x146e39[_0x64b1('0x1f')];var _0x44668e;if(_0x5c859a>=_0x2cda64){_0x5c859a=_0x2cda64;_0x44668e=0xc8;}else{_0x44668e=0xce;}_0x42c8f7[_0x64b1('0x1b')](_0x44668e);return _0x42c8f7[_0x64b1('0x21')](_0x64b1('0x22'),_0x2d7d37+'-'+_0x5c859a+'/'+_0x2cda64)['json'](_0x67fa46);}return null;};}function patchUpdates(_0x3aad5e){return function(_0x3f8083){try{jsonpatch[_0x64b1('0x23')](_0x3f8083,_0x3aad5e,!![]);}catch(_0x2d1e4c){return BPromise[_0x64b1('0x24')](_0x2d1e4c);}return _0x3f8083[_0x64b1('0x25')]();};}function saveUpdates(_0x44f006,_0x660c6f){return function(_0xbec921){if(_0xbec921){return _0xbec921[_0x64b1('0x26')](_0x44f006)[_0x64b1('0x27')](function(_0x9cf3e7){return _0x9cf3e7;});}return null;};}function removeEntity(_0x19a8d7,_0x431a4e){return function(_0x3ed91e){if(_0x3ed91e){return _0x3ed91e['destroy']()['then'](function(){var _0x5f2c59=_0x3ed91e[_0x64b1('0x28')]({'plain':!![]});var _0xd46e='CustomDashboards';return db[_0x64b1('0x29')]['destroy']({'where':{'type':_0xd46e,'resourceId':_0x5f2c59['id']}})[_0x64b1('0x27')](function(){return _0x3ed91e;});})[_0x64b1('0x27')](function(){_0x19a8d7[_0x64b1('0x1b')](0xcc)[_0x64b1('0x2a')]();});}};}function handleEntityNotFound(_0x35ee09,_0x53dfa6){return function(_0x331b79){if(!_0x331b79){_0x35ee09[_0x64b1('0x1a')](0x194);}return _0x331b79;};}function handleError(_0x1c00d2,_0x436533){_0x436533=_0x436533||0x1f4;return function(_0x3a247f){logger[_0x64b1('0x2b')](_0x3a247f[_0x64b1('0x2c')]);if(_0x3a247f[_0x64b1('0x2d')]){delete _0x3a247f[_0x64b1('0x2d')];}_0x1c00d2[_0x64b1('0x1b')](_0x436533)['send'](_0x3a247f);};}exports['index']=function(_0x597c92,_0x58fc91){var _0x2b9fd8={},_0x1b3438={},_0x3f8e50={'count':0x0,'rows':[]};var _0x30a917=_[_0x64b1('0x2e')](db['Dashboard'][_0x64b1('0x2f')],function(_0x518f93){return{'name':_0x518f93[_0x64b1('0x30')],'type':_0x518f93[_0x64b1('0x31')][_0x64b1('0x32')]};});_0x1b3438[_0x64b1('0x33')]=_['map'](_0x30a917,_0x64b1('0x2d'));_0x1b3438[_0x64b1('0x34')]=_[_0x64b1('0x35')](_0x597c92[_0x64b1('0x34')]);_0x1b3438[_0x64b1('0x36')]=_[_0x64b1('0x37')](_0x1b3438[_0x64b1('0x33')],_0x1b3438['query']);_0x2b9fd8[_0x64b1('0x38')]=_[_0x64b1('0x37')](_0x1b3438[_0x64b1('0x33')],qs[_0x64b1('0x39')](_0x597c92[_0x64b1('0x34')][_0x64b1('0x39')]));_0x2b9fd8[_0x64b1('0x38')]=_0x2b9fd8[_0x64b1('0x38')][_0x64b1('0x3a')]?_0x2b9fd8['attributes']:_0x1b3438[_0x64b1('0x33')];if(!_0x597c92[_0x64b1('0x34')]['hasOwnProperty'](_0x64b1('0x3b'))){_0x2b9fd8[_0x64b1('0x1f')]=qs[_0x64b1('0x1f')](_0x597c92[_0x64b1('0x34')][_0x64b1('0x1f')]);_0x2b9fd8[_0x64b1('0x1d')]=qs['offset'](_0x597c92[_0x64b1('0x34')][_0x64b1('0x1d')]);}_0x2b9fd8[_0x64b1('0x3c')]=qs[_0x64b1('0x3d')](_0x597c92[_0x64b1('0x34')][_0x64b1('0x3d')]);_0x2b9fd8[_0x64b1('0x3e')]=qs[_0x64b1('0x36')](_[_0x64b1('0x3f')](_0x597c92[_0x64b1('0x34')],_0x1b3438[_0x64b1('0x36')]),_0x30a917);if(_0x597c92[_0x64b1('0x34')]['filter']){_0x2b9fd8[_0x64b1('0x3e')]=_[_0x64b1('0x40')](_0x2b9fd8[_0x64b1('0x3e')],{'$or':_[_0x64b1('0x2e')](_0x30a917,function(_0x26c281){if(_0x26c281[_0x64b1('0x31')]!=='VIRTUAL'){var _0x35bb32={};_0x35bb32[_0x26c281[_0x64b1('0x2d')]]={'$like':'%'+_0x597c92[_0x64b1('0x34')][_0x64b1('0x41')]+'%'};return _0x35bb32;}})});}_0x2b9fd8=_[_0x64b1('0x40')]({},_0x2b9fd8,_0x597c92[_0x64b1('0x42')]);var _0x2bee6b={'where':_0x2b9fd8[_0x64b1('0x3e')]};return db[_0x64b1('0x43')]['count'](_0x2bee6b)[_0x64b1('0x27')](function(_0x1989c9){_0x3f8e50[_0x64b1('0x20')]=_0x1989c9;if(_0x597c92[_0x64b1('0x34')][_0x64b1('0x44')]){_0x2b9fd8[_0x64b1('0x45')]=[{'all':!![]}];}return db[_0x64b1('0x43')][_0x64b1('0x46')](_0x2b9fd8);})[_0x64b1('0x27')](function(_0x1291bb){_0x3f8e50[_0x64b1('0x47')]=_0x1291bb;return _0x3f8e50;})[_0x64b1('0x27')](respondWithFilteredResult(_0x58fc91,_0x2b9fd8))[_0x64b1('0x48')](handleError(_0x58fc91,null));};exports[_0x64b1('0x49')]=function(_0x193ccd,_0x4fe1c5){var _0x14e61d={'raw':![],'where':{'id':_0x193ccd['params']['id']}},_0x4586af={};_0x4586af['model']=_[_0x64b1('0x35')](db[_0x64b1('0x43')][_0x64b1('0x2f')]);_0x4586af[_0x64b1('0x34')]=_[_0x64b1('0x35')](_0x193ccd[_0x64b1('0x34')]);_0x4586af['filters']=_[_0x64b1('0x37')](_0x4586af[_0x64b1('0x33')],_0x4586af[_0x64b1('0x34')]);_0x14e61d['attributes']=_['intersection'](_0x4586af[_0x64b1('0x33')],qs['fields'](_0x193ccd[_0x64b1('0x34')][_0x64b1('0x39')]));_0x14e61d['attributes']=_0x14e61d['attributes'][_0x64b1('0x3a')]?_0x14e61d[_0x64b1('0x38')]:_0x4586af['model'];if(_0x193ccd[_0x64b1('0x34')]['includeAll']){_0x14e61d[_0x64b1('0x45')]=[{'all':!![]}];}_0x14e61d=_['merge']({},_0x14e61d,_0x193ccd[_0x64b1('0x42')]);return db[_0x64b1('0x43')][_0x64b1('0x4a')](_0x14e61d)[_0x64b1('0x27')](handleEntityNotFound(_0x4fe1c5,null))[_0x64b1('0x27')](respondWithResult(_0x4fe1c5,null))[_0x64b1('0x48')](handleError(_0x4fe1c5,null));};exports['create']=function(_0x3a4bda,_0x2a9ef2){return db[_0x64b1('0x43')]['create'](_0x3a4bda[_0x64b1('0x4b')],{})[_0x64b1('0x27')](function(_0x2dc33c){var _0x5f282a=_0x3a4bda[_0x64b1('0x4c')][_0x64b1('0x28')]({'plain':!![]});if(!_0x5f282a)throw new Error(_0x64b1('0x4d'));if(_0x5f282a[_0x64b1('0x4e')]===_0x64b1('0x4c')){var _0x443dbe=_0x2dc33c[_0x64b1('0x28')]({'plain':!![]});var _0x1f71fa=_0x64b1('0x4f');return db[_0x64b1('0x50')]['find']({'where':{'name':_0x1f71fa,'userProfileId':_0x5f282a[_0x64b1('0x51')]},'raw':!![]})[_0x64b1('0x27')](function(_0x7c6520){if(_0x7c6520&&_0x7c6520[_0x64b1('0x52')]===0x0){return db[_0x64b1('0x29')][_0x64b1('0x53')]({'name':_0x443dbe['name'],'resourceId':_0x443dbe['id'],'type':_0x7c6520['name'],'sectionId':_0x7c6520['id']},{})[_0x64b1('0x27')](function(){return _0x2dc33c;});}else{return _0x2dc33c;}})['catch'](function(_0x57983e){logger[_0x64b1('0x2b')](_0x64b1('0x54'),_0x57983e);throw _0x57983e;});}return _0x2dc33c;})[_0x64b1('0x27')](respondWithResult(_0x2a9ef2,0xc9))['catch'](handleError(_0x2a9ef2,null));};exports[_0x64b1('0x55')]=function(_0x4b141a,_0x1f2606){var _0x2d0641={'where':{'id':_0x4b141a[_0x64b1('0x56')]['id']}},_0x453760={};_0x453760[_0x64b1('0x33')]=_['keys'](db[_0x64b1('0x43')][_0x64b1('0x2f')]);_0x2d0641[_0x64b1('0x38')]=_[_0x64b1('0x37')](_0x453760[_0x64b1('0x33')],qs['fields'](_0x4b141a[_0x64b1('0x34')][_0x64b1('0x39')]));_0x2d0641['attributes']=_0x2d0641[_0x64b1('0x38')][_0x64b1('0x3a')]?_0x2d0641[_0x64b1('0x38')]:_0x453760[_0x64b1('0x33')];if(_0x4b141a['query']['includeAll']){_0x2d0641['include']=[{'all':!![]}];}_0x2d0641=_[_0x64b1('0x40')]({},_0x2d0641,_0x4b141a[_0x64b1('0x42')]);return db[_0x64b1('0x43')][_0x64b1('0x4a')](_0x2d0641)[_0x64b1('0x27')](handleEntityNotFound(_0x1f2606,null))['then'](function(_0x133ec4){if(_0x133ec4){var _0x3d5fad=_0x133ec4[_0x64b1('0x28')]({'plain':!![]});_0x3d5fad=qs[_0x64b1('0x57')](_0x3d5fad,['id','createdAt',_0x64b1('0x58')]);_0x4b141a[_0x64b1('0x4b')]=_[_0x64b1('0x57')](_0x4b141a[_0x64b1('0x4b')],['id','createdAt','updatedAt']);return db[_0x64b1('0x43')]['create'](_['merge'](_0x3d5fad,_0x4b141a['body']),{'include':_0x4b141a[_0x64b1('0x34')][_0x64b1('0x44')]?[{'all':!![]}]:undefined})[_0x64b1('0x27')](function(_0x482586){var _0x7adcf9=_0x4b141a['user'][_0x64b1('0x28')]({'plain':!![]});if(!_0x7adcf9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x7adcf9['role']===_0x64b1('0x4c')){var _0x32866b=_0x482586[_0x64b1('0x28')]({'plain':!![]});var _0x15f9a8=_0x64b1('0x4f');return db[_0x64b1('0x50')][_0x64b1('0x4a')]({'where':{'name':_0x15f9a8,'userProfileId':_0x7adcf9[_0x64b1('0x51')]},'raw':!![]})[_0x64b1('0x27')](function(_0x525816){if(_0x525816&&_0x525816[_0x64b1('0x52')]===0x0){return db[_0x64b1('0x29')]['create']({'name':_0x32866b[_0x64b1('0x2d')],'resourceId':_0x32866b['id'],'type':_0x525816[_0x64b1('0x2d')],'sectionId':_0x525816['id']},{})['then'](function(){return _0x482586;});}else{return _0x482586;}})[_0x64b1('0x48')](function(_0x46e7cf){logger[_0x64b1('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x46e7cf);throw _0x46e7cf;});}return _0x482586;});}})[_0x64b1('0x27')](respondWithResult(_0x1f2606,0xc9))[_0x64b1('0x48')](handleError(_0x1f2606,null));};exports[_0x64b1('0x26')]=function(_0x59b817,_0x21ea55){if(_0x59b817['body']['id']){delete _0x59b817[_0x64b1('0x4b')]['id'];}return db[_0x64b1('0x43')]['find']({'where':{'id':_0x59b817[_0x64b1('0x56')]['id']}})[_0x64b1('0x27')](handleEntityNotFound(_0x21ea55,null))[_0x64b1('0x27')](saveUpdates(_0x59b817[_0x64b1('0x4b')],null))[_0x64b1('0x27')](respondWithResult(_0x21ea55,null))[_0x64b1('0x48')](handleError(_0x21ea55,null));};exports['destroy']=function(_0x153b68,_0x91d576){return db['Dashboard']['find']({'where':{'id':_0x153b68['params']['id']}})[_0x64b1('0x27')](handleEntityNotFound(_0x91d576,null))['then'](removeEntity(_0x91d576,null))[_0x64b1('0x48')](handleError(_0x91d576,null));};function widgetAttributes(_0x287250){try{switch(_0x287250[_0x64b1('0x31')]){case'iframe':return[{'name':_0x64b1('0x59'),'value':_0x287250[_0x64b1('0x59')]||(_0x287250[_0x64b1('0x5a')]&&_0x287250['attrs'][0x0]?_0x287250[_0x64b1('0x5a')][0x0][_0x64b1('0x5b')]:undefined)||_0x64b1('0x5c')}];case'custom':return[{'name':'attrPath','value':_0x287250[_0x64b1('0x5d')]||(_0x287250['attrs']&&_0x287250[_0x64b1('0x5a')][0x0]?_0x287250['attrs'][0x0][_0x64b1('0x5b')]:undefined)||''}];case _0x64b1('0x5e'):return[{'name':_0x64b1('0x5f'),'value':_0x287250[_0x64b1('0x5f')]||(_0x287250[_0x64b1('0x5a')]&&_0x287250[_0x64b1('0x5a')][0x0]?_0x287250['attrs'][0x0][_0x64b1('0x5b')]:undefined)||_0x64b1('0x60')},{'name':_0x64b1('0x61'),'value':_0x287250['attrTimezone']||(_0x287250[_0x64b1('0x5a')]&&_0x287250[_0x64b1('0x5a')][0x1]?_0x287250[_0x64b1('0x5a')][0x1][_0x64b1('0x5b')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x287250[_0x64b1('0x62')]||(_0x287250[_0x64b1('0x5a')]&&_0x287250['attrs'][0x2]?_0x287250['attrs'][0x2]['value']:undefined)||0xc}];case _0x64b1('0x63'):return[{'name':_0x64b1('0x64'),'value':_0x287250[_0x64b1('0x64')]||(_0x287250[_0x64b1('0x5a')]&&_0x287250[_0x64b1('0x5a')][0x0]?_0x287250[_0x64b1('0x5a')][0x0]['value']:undefined)||'total'},{'name':_0x64b1('0x65'),'value':_0x287250[_0x64b1('0x65')]||(_0x287250[_0x64b1('0x5a')]&&_0x287250[_0x64b1('0x5a')][0x1]?_0x287250[_0x64b1('0x5a')][0x1][_0x64b1('0x5b')]:undefined)||[]},{'name':_0x64b1('0x62'),'value':_0x287250['attrFontSize']||(_0x287250[_0x64b1('0x5a')]&&_0x287250[_0x64b1('0x5a')][0x2]?_0x287250[_0x64b1('0x5a')][0x2]['value']:undefined)||0x14}];case _0x64b1('0x66'):case _0x64b1('0x67'):return[{'name':_0x64b1('0x68'),'value':_0x287250[_0x64b1('0x68')]||(_0x287250[_0x64b1('0x5a')]&&_0x287250[_0x64b1('0x5a')][0x0]?_0x287250['attrs'][0x0][_0x64b1('0x5b')]:undefined)||_0x64b1('0x69')},{'name':_0x64b1('0x6a'),'value':_0x287250['attrSerie2']||(_0x287250[_0x64b1('0x5a')]&&_0x287250[_0x64b1('0x5a')][0x1]?_0x287250[_0x64b1('0x5a')][0x1][_0x64b1('0x5b')]:undefined)||null},{'name':'attrSerie3','value':_0x287250[_0x64b1('0x6b')]||(_0x287250[_0x64b1('0x5a')]&&_0x287250['attrs'][0x2]?_0x287250[_0x64b1('0x5a')][0x2][_0x64b1('0x5b')]:undefined)||null},{'name':_0x64b1('0x65'),'value':_0x287250[_0x64b1('0x65')]||(_0x287250[_0x64b1('0x5a')]&&_0x287250[_0x64b1('0x5a')][0x3]?_0x287250[_0x64b1('0x5a')][0x3][_0x64b1('0x5b')]:undefined)||[]}];case _0x64b1('0x6c'):return[{'name':_0x64b1('0x6d'),'type':_0x287250[_0x64b1('0x6e')]||(_0x287250[_0x64b1('0x5a')]&&_0x287250['attrs'][0x0]?_0x287250[_0x64b1('0x5a')][0x0]['type']:undefined)||null,'value':_0x287250[_0x64b1('0x6d')]||(_0x287250['attrs']&&_0x287250['attrs'][0x0]?_0x287250[_0x64b1('0x5a')][0x0][_0x64b1('0x5b')]:undefined)||null},{'name':'attrRefresh','value':_0x287250[_0x64b1('0x6f')]||(_0x287250['attrs']&&_0x287250[_0x64b1('0x5a')][0x1]?_0x287250[_0x64b1('0x5a')][0x1][_0x64b1('0x5b')]:undefined)||0x0}];default:return[];}}catch(_0x1cf88d){logger[_0x64b1('0x2b')](_0x64b1('0x70'),JSON[_0x64b1('0x71')](_0x1cf88d));return[];}}exports['addItem']=function(_0x25decf,_0x4e2066,_0x745acf){if(_0x25decf[_0x64b1('0x4b')]['id']){delete _0x25decf['body']['id'];}return db[_0x64b1('0x43')][_0x64b1('0x4a')]({'where':{'id':_0x25decf['params']['id']}})['then'](handleEntityNotFound(_0x4e2066,null))['then'](function(_0x36ef3f){if(_0x36ef3f){_0x25decf[_0x64b1('0x4b')][_0x64b1('0x72')]=_0x36ef3f['id'];_0x25decf[_0x64b1('0x4b')][_0x64b1('0x5a')]=widgetAttributes(_0x25decf[_0x64b1('0x4b')]);return db[_0x64b1('0x73')][_0x64b1('0x53')](_0x25decf[_0x64b1('0x4b')]);}})['then'](respondWithResult(_0x4e2066,null))[_0x64b1('0x48')](handleError(_0x4e2066,null));};exports['getItems']=function(_0x11c1fe,_0x1c27f8,_0x1cef06){var _0x1ae594={};var _0x11fb5c={};var _0x3fd693;var _0x46f874;return db[_0x64b1('0x43')][_0x64b1('0x74')]({'where':{'id':_0x11c1fe['params']['id']}})[_0x64b1('0x27')](handleEntityNotFound(_0x1c27f8,null))[_0x64b1('0x27')](function(_0xdae77d){if(_0xdae77d){_0x3fd693=_0xdae77d;_0x11fb5c[_0x64b1('0x33')]=_[_0x64b1('0x35')](db[_0x64b1('0x73')]['rawAttributes']);_0x11fb5c['query']=_[_0x64b1('0x35')](_0x11c1fe[_0x64b1('0x34')]);_0x11fb5c[_0x64b1('0x36')]=_[_0x64b1('0x37')](_0x11fb5c['model'],_0x11fb5c['query']);_0x1ae594['attributes']=_[_0x64b1('0x37')](_0x11fb5c['model'],qs['fields'](_0x11c1fe[_0x64b1('0x34')][_0x64b1('0x39')]));_0x1ae594['attributes']=_0x1ae594[_0x64b1('0x38')]['length']?_0x1ae594[_0x64b1('0x38')]:_0x11fb5c[_0x64b1('0x33')];_0x1ae594['order']=qs[_0x64b1('0x3d')](_0x11c1fe[_0x64b1('0x34')][_0x64b1('0x3d')]);_0x1ae594[_0x64b1('0x3e')]=qs[_0x64b1('0x36')](_[_0x64b1('0x3f')](_0x11c1fe[_0x64b1('0x34')],_0x11fb5c[_0x64b1('0x36')]));if(_0x11c1fe[_0x64b1('0x34')][_0x64b1('0x41')]){_0x1ae594[_0x64b1('0x3e')]=_[_0x64b1('0x40')](_0x1ae594[_0x64b1('0x3e')],{'$or':_[_0x64b1('0x2e')](_0x1ae594[_0x64b1('0x38')],function(_0x5f3c96){var _0x22324a={};_0x22324a[_0x5f3c96]={'$like':'%'+_0x11c1fe[_0x64b1('0x34')][_0x64b1('0x41')]+'%'};return _0x22324a;})});}_0x1ae594=_[_0x64b1('0x40')]({},_0x1ae594,_0x11c1fe['options']);return _0x3fd693['getItems'](_0x1ae594);}})[_0x64b1('0x27')](function(_0x4d2609){if(_0x4d2609){_0x46f874=_0x4d2609[_0x64b1('0x3a')];if(!_0x11c1fe[_0x64b1('0x34')][_0x64b1('0x75')](_0x64b1('0x3b'))){_0x1ae594[_0x64b1('0x1f')]=qs[_0x64b1('0x1f')](_0x11c1fe['query'][_0x64b1('0x1f')]);_0x1ae594[_0x64b1('0x1d')]=qs[_0x64b1('0x1d')](_0x11c1fe[_0x64b1('0x34')][_0x64b1('0x1d')]);}return _0x3fd693[_0x64b1('0x76')](_0x1ae594);}})[_0x64b1('0x27')](function(_0x48fc17){if(_0x48fc17){return _0x48fc17?{'count':_0x46f874,'rows':_0x48fc17}:null;}})['then'](respondWithResult(_0x1c27f8,null))[_0x64b1('0x48')](handleError(_0x1c27f8,null));}; \ No newline at end of file +var _0x4c20=['keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','body','omit','createdAt','update','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrReport','attrRefresh','stringify','addItem','getItems','filter','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','apply','reject','save','then','destroy','CustomDashboards','UserProfileResource','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model'];(function(_0x11afc8,_0x1cb3c8){var _0x4c9a80=function(_0x5d100f){while(--_0x5d100f){_0x11afc8['push'](_0x11afc8['shift']());}};_0x4c9a80(++_0x1cb3c8);}(_0x4c20,0xbe));var _0x04c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4c20[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x04c2('0x0'));var zipdir=require(_0x04c2('0x1'));var jsonpatch=require(_0x04c2('0x2'));var rp=require(_0x04c2('0x3'));var moment=require(_0x04c2('0x4'));var BPromise=require(_0x04c2('0x5'));var Mustache=require(_0x04c2('0x6'));var util=require(_0x04c2('0x7'));var path=require(_0x04c2('0x8'));var sox=require('sox');var csv=require(_0x04c2('0x9'));var ejs=require(_0x04c2('0xa'));var fs=require('fs');var fs_extra=require(_0x04c2('0xb'));var _=require(_0x04c2('0xc'));var squel=require(_0x04c2('0xd'));var crypto=require(_0x04c2('0xe'));var jsforce=require(_0x04c2('0xf'));var deskjs=require(_0x04c2('0x10'));var toCsv=require(_0x04c2('0x9'));var querystring=require(_0x04c2('0x11'));var Papa=require(_0x04c2('0x12'));var Redis=require('ioredis');var authService=require(_0x04c2('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x04c2('0x14'));var hardwareService=require(_0x04c2('0x15'));var logger=require('../../config/logger')(_0x04c2('0x16'));var utils=require(_0x04c2('0x17'));var config=require(_0x04c2('0x18'));var licenseUtil=require(_0x04c2('0x19'));var db=require(_0x04c2('0x1a'))['db'];config[_0x04c2('0x1b')]=_[_0x04c2('0x1c')](config[_0x04c2('0x1b')],{'host':_0x04c2('0x1d'),'port':0x18eb});var socket=require(_0x04c2('0x1e'))(new Redis(config['redis']));require(_0x04c2('0x1f'))[_0x04c2('0x20')](socket);function respondWithStatusCode(_0x4aab59,_0x517d45){_0x517d45=_0x517d45||0xcc;return function(_0xcb64db){if(_0xcb64db){return _0x4aab59[_0x04c2('0x21')](_0x517d45);}return _0x4aab59['status'](_0x517d45)[_0x04c2('0x22')]();};}function respondWithResult(_0x37aadf,_0x32aed1){_0x32aed1=_0x32aed1||0xc8;return function(_0xd9885e){if(_0xd9885e){return _0x37aadf['status'](_0x32aed1)[_0x04c2('0x23')](_0xd9885e);}};}function respondWithFilteredResult(_0x12c514,_0x2f02bd){return function(_0x4b029d){if(_0x4b029d){var _0x328203=typeof _0x2f02bd[_0x04c2('0x24')]===_0x04c2('0x25')&&typeof _0x2f02bd[_0x04c2('0x26')]===_0x04c2('0x25');var _0x332e9e=_0x4b029d[_0x04c2('0x27')];var _0x4ed7f0=_0x328203?0x0:_0x2f02bd[_0x04c2('0x24')];var _0x1afa63=_0x328203?_0x4b029d[_0x04c2('0x27')]:_0x2f02bd[_0x04c2('0x24')]+_0x2f02bd[_0x04c2('0x26')];var _0x1073fc;if(_0x1afa63>=_0x332e9e){_0x1afa63=_0x332e9e;_0x1073fc=0xc8;}else{_0x1073fc=0xce;}_0x12c514[_0x04c2('0x28')](_0x1073fc);return _0x12c514['set']('Content-Range',_0x4ed7f0+'-'+_0x1afa63+'/'+_0x332e9e)[_0x04c2('0x23')](_0x4b029d);}return null;};}function patchUpdates(_0x408203){return function(_0x3130ad){try{jsonpatch[_0x04c2('0x29')](_0x3130ad,_0x408203,!![]);}catch(_0x412061){return BPromise[_0x04c2('0x2a')](_0x412061);}return _0x3130ad[_0x04c2('0x2b')]();};}function saveUpdates(_0x293487,_0x42bc26){return function(_0x4e6a61){if(_0x4e6a61){return _0x4e6a61['update'](_0x293487)[_0x04c2('0x2c')](function(_0x393f55){return _0x393f55;});}return null;};}function removeEntity(_0x2fadde,_0x2eb877){return function(_0x33845f){if(_0x33845f){return _0x33845f[_0x04c2('0x2d')]()[_0x04c2('0x2c')](function(){var _0x48919f=_0x33845f['get']({'plain':!![]});var _0x2cae4c=_0x04c2('0x2e');return db[_0x04c2('0x2f')][_0x04c2('0x2d')]({'where':{'type':_0x2cae4c,'resourceId':_0x48919f['id']}})[_0x04c2('0x2c')](function(){return _0x33845f;});})[_0x04c2('0x2c')](function(){_0x2fadde[_0x04c2('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d8bb9,_0x5df722){return function(_0x31ab85){if(!_0x31ab85){_0x4d8bb9[_0x04c2('0x21')](0x194);}return _0x31ab85;};}function handleError(_0x5c5153,_0x1c8a1b){_0x1c8a1b=_0x1c8a1b||0x1f4;return function(_0x505644){logger[_0x04c2('0x30')](_0x505644[_0x04c2('0x31')]);if(_0x505644['name']){delete _0x505644[_0x04c2('0x32')];}_0x5c5153[_0x04c2('0x28')](_0x1c8a1b)[_0x04c2('0x33')](_0x505644);};}exports[_0x04c2('0x34')]=function(_0x37a1e7,_0x1cfa2d){var _0x84ebb5={},_0xec3b7f={},_0x3ce678={'count':0x0,'rows':[]};var _0x4128a7=_[_0x04c2('0x35')](db[_0x04c2('0x36')][_0x04c2('0x37')],function(_0x321f73){return{'name':_0x321f73[_0x04c2('0x38')],'type':_0x321f73[_0x04c2('0x39')][_0x04c2('0x3a')]};});_0xec3b7f[_0x04c2('0x3b')]=_[_0x04c2('0x35')](_0x4128a7,'name');_0xec3b7f['query']=_[_0x04c2('0x3c')](_0x37a1e7[_0x04c2('0x3d')]);_0xec3b7f['filters']=_[_0x04c2('0x3e')](_0xec3b7f[_0x04c2('0x3b')],_0xec3b7f['query']);_0x84ebb5[_0x04c2('0x3f')]=_[_0x04c2('0x3e')](_0xec3b7f[_0x04c2('0x3b')],qs[_0x04c2('0x40')](_0x37a1e7[_0x04c2('0x3d')][_0x04c2('0x40')]));_0x84ebb5['attributes']=_0x84ebb5[_0x04c2('0x3f')][_0x04c2('0x41')]?_0x84ebb5['attributes']:_0xec3b7f[_0x04c2('0x3b')];if(!_0x37a1e7[_0x04c2('0x3d')][_0x04c2('0x42')](_0x04c2('0x43'))){_0x84ebb5[_0x04c2('0x26')]=qs[_0x04c2('0x26')](_0x37a1e7['query'][_0x04c2('0x26')]);_0x84ebb5[_0x04c2('0x24')]=qs[_0x04c2('0x24')](_0x37a1e7['query'][_0x04c2('0x24')]);}_0x84ebb5[_0x04c2('0x44')]=qs['sort'](_0x37a1e7[_0x04c2('0x3d')][_0x04c2('0x45')]);_0x84ebb5[_0x04c2('0x46')]=qs[_0x04c2('0x47')](_[_0x04c2('0x48')](_0x37a1e7[_0x04c2('0x3d')],_0xec3b7f[_0x04c2('0x47')]),_0x4128a7);if(_0x37a1e7[_0x04c2('0x3d')]['filter']){_0x84ebb5[_0x04c2('0x46')]=_[_0x04c2('0x49')](_0x84ebb5[_0x04c2('0x46')],{'$or':_[_0x04c2('0x35')](_0x4128a7,function(_0x4cee68){if(_0x4cee68['type']!==_0x04c2('0x4a')){var _0x452196={};_0x452196[_0x4cee68[_0x04c2('0x32')]]={'$like':'%'+_0x37a1e7[_0x04c2('0x3d')]['filter']+'%'};return _0x452196;}})});}_0x84ebb5=_['merge']({},_0x84ebb5,_0x37a1e7[_0x04c2('0x4b')]);var _0x433e17={'where':_0x84ebb5[_0x04c2('0x46')]};return db[_0x04c2('0x36')][_0x04c2('0x27')](_0x433e17)[_0x04c2('0x2c')](function(_0x779726){_0x3ce678[_0x04c2('0x27')]=_0x779726;if(_0x37a1e7[_0x04c2('0x3d')][_0x04c2('0x4c')]){_0x84ebb5[_0x04c2('0x4d')]=[{'all':!![]}];}return db[_0x04c2('0x36')][_0x04c2('0x4e')](_0x84ebb5);})['then'](function(_0x3d42c6){_0x3ce678[_0x04c2('0x4f')]=_0x3d42c6;return _0x3ce678;})[_0x04c2('0x2c')](respondWithFilteredResult(_0x1cfa2d,_0x84ebb5))[_0x04c2('0x50')](handleError(_0x1cfa2d,null));};exports[_0x04c2('0x51')]=function(_0x5bdd94,_0x27426d){var _0x552582={'raw':![],'where':{'id':_0x5bdd94[_0x04c2('0x52')]['id']}},_0x45ddb4={};_0x45ddb4[_0x04c2('0x3b')]=_[_0x04c2('0x3c')](db['Dashboard']['rawAttributes']);_0x45ddb4[_0x04c2('0x3d')]=_[_0x04c2('0x3c')](_0x5bdd94['query']);_0x45ddb4[_0x04c2('0x47')]=_[_0x04c2('0x3e')](_0x45ddb4[_0x04c2('0x3b')],_0x45ddb4[_0x04c2('0x3d')]);_0x552582[_0x04c2('0x3f')]=_[_0x04c2('0x3e')](_0x45ddb4[_0x04c2('0x3b')],qs['fields'](_0x5bdd94[_0x04c2('0x3d')]['fields']));_0x552582['attributes']=_0x552582[_0x04c2('0x3f')][_0x04c2('0x41')]?_0x552582[_0x04c2('0x3f')]:_0x45ddb4[_0x04c2('0x3b')];if(_0x5bdd94[_0x04c2('0x3d')][_0x04c2('0x4c')]){_0x552582['include']=[{'all':!![]}];}_0x552582=_[_0x04c2('0x49')]({},_0x552582,_0x5bdd94['options']);return db[_0x04c2('0x36')]['find'](_0x552582)['then'](handleEntityNotFound(_0x27426d,null))[_0x04c2('0x2c')](respondWithResult(_0x27426d,null))[_0x04c2('0x50')](handleError(_0x27426d,null));};exports[_0x04c2('0x53')]=function(_0x2f27ea,_0x1e33d4){return db[_0x04c2('0x36')][_0x04c2('0x53')](_0x2f27ea['body'],{})[_0x04c2('0x2c')](function(_0x3254d1){var _0x45885e=_0x2f27ea[_0x04c2('0x54')][_0x04c2('0x55')]({'plain':!![]});if(!_0x45885e)throw new Error(_0x04c2('0x56'));if(_0x45885e[_0x04c2('0x57')]===_0x04c2('0x54')){var _0x5063b5=_0x3254d1[_0x04c2('0x55')]({'plain':!![]});var _0x584567=_0x04c2('0x2e');return db[_0x04c2('0x58')][_0x04c2('0x59')]({'where':{'name':_0x584567,'userProfileId':_0x45885e['userProfileId']},'raw':!![]})[_0x04c2('0x2c')](function(_0x539ec6){if(_0x539ec6&&_0x539ec6[_0x04c2('0x5a')]===0x0){return db[_0x04c2('0x2f')][_0x04c2('0x53')]({'name':_0x5063b5['name'],'resourceId':_0x5063b5['id'],'type':_0x539ec6[_0x04c2('0x32')],'sectionId':_0x539ec6['id']},{})[_0x04c2('0x2c')](function(){return _0x3254d1;});}else{return _0x3254d1;}})[_0x04c2('0x50')](function(_0x1f7d8b){logger['error'](_0x04c2('0x5b'),_0x1f7d8b);throw _0x1f7d8b;});}return _0x3254d1;})[_0x04c2('0x2c')](respondWithResult(_0x1e33d4,0xc9))[_0x04c2('0x50')](handleError(_0x1e33d4,null));};exports[_0x04c2('0x5c')]=function(_0x39337a,_0x4846ae){var _0x29e9b5={'where':{'id':_0x39337a[_0x04c2('0x52')]['id']}},_0x125e55={};_0x125e55[_0x04c2('0x3b')]=_[_0x04c2('0x3c')](db['Dashboard'][_0x04c2('0x37')]);_0x29e9b5[_0x04c2('0x3f')]=_[_0x04c2('0x3e')](_0x125e55[_0x04c2('0x3b')],qs[_0x04c2('0x40')](_0x39337a['query'][_0x04c2('0x40')]));_0x29e9b5[_0x04c2('0x3f')]=_0x29e9b5[_0x04c2('0x3f')][_0x04c2('0x41')]?_0x29e9b5[_0x04c2('0x3f')]:_0x125e55[_0x04c2('0x3b')];if(_0x39337a[_0x04c2('0x3d')][_0x04c2('0x4c')]){_0x29e9b5['include']=[{'all':!![]}];}_0x29e9b5=_[_0x04c2('0x49')]({},_0x29e9b5,_0x39337a[_0x04c2('0x4b')]);return db[_0x04c2('0x36')]['find'](_0x29e9b5)[_0x04c2('0x2c')](handleEntityNotFound(_0x4846ae,null))[_0x04c2('0x2c')](function(_0xa400d){if(_0xa400d){var _0x337c0a=_0xa400d['get']({'plain':!![]});_0x337c0a=qs['omit'](_0x337c0a,['id','createdAt',_0x04c2('0x5d')]);_0x39337a[_0x04c2('0x5e')]=_[_0x04c2('0x5f')](_0x39337a[_0x04c2('0x5e')],['id',_0x04c2('0x60'),'updatedAt']);return db[_0x04c2('0x36')][_0x04c2('0x53')](_[_0x04c2('0x49')](_0x337c0a,_0x39337a[_0x04c2('0x5e')]),{'include':_0x39337a[_0x04c2('0x3d')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x50586e){var _0x3f9b73=_0x39337a[_0x04c2('0x54')][_0x04c2('0x55')]({'plain':!![]});if(!_0x3f9b73)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f9b73['role']===_0x04c2('0x54')){var _0x90c5ca=_0x50586e['get']({'plain':!![]});var _0x5040c3=_0x04c2('0x2e');return db['UserProfileSection'][_0x04c2('0x59')]({'where':{'name':_0x5040c3,'userProfileId':_0x3f9b73['userProfileId']},'raw':!![]})[_0x04c2('0x2c')](function(_0x30ac8b){if(_0x30ac8b&&_0x30ac8b['autoAssociation']===0x0){return db['UserProfileResource'][_0x04c2('0x53')]({'name':_0x90c5ca[_0x04c2('0x32')],'resourceId':_0x90c5ca['id'],'type':_0x30ac8b[_0x04c2('0x32')],'sectionId':_0x30ac8b['id']},{})['then'](function(){return _0x50586e;});}else{return _0x50586e;}})[_0x04c2('0x50')](function(_0x4e30bb){logger[_0x04c2('0x30')](_0x04c2('0x5b'),_0x4e30bb);throw _0x4e30bb;});}return _0x50586e;});}})[_0x04c2('0x2c')](respondWithResult(_0x4846ae,0xc9))['catch'](handleError(_0x4846ae,null));};exports[_0x04c2('0x61')]=function(_0x170110,_0x213cc4){if(_0x170110['body']['id']){delete _0x170110[_0x04c2('0x5e')]['id'];}return db['Dashboard'][_0x04c2('0x59')]({'where':{'id':_0x170110[_0x04c2('0x52')]['id']}})['then'](handleEntityNotFound(_0x213cc4,null))[_0x04c2('0x2c')](saveUpdates(_0x170110['body'],null))[_0x04c2('0x2c')](respondWithResult(_0x213cc4,null))['catch'](handleError(_0x213cc4,null));};exports[_0x04c2('0x2d')]=function(_0x32f291,_0x4beb3d){return db[_0x04c2('0x36')]['find']({'where':{'id':_0x32f291[_0x04c2('0x52')]['id']}})['then'](handleEntityNotFound(_0x4beb3d,null))[_0x04c2('0x2c')](removeEntity(_0x4beb3d,null))['catch'](handleError(_0x4beb3d,null));};function widgetAttributes(_0x84f957){try{switch(_0x84f957[_0x04c2('0x39')]){case _0x04c2('0x62'):return[{'name':_0x04c2('0x63'),'value':_0x84f957[_0x04c2('0x63')]||(_0x84f957[_0x04c2('0x64')]&&_0x84f957['attrs'][0x0]?_0x84f957['attrs'][0x0][_0x04c2('0x65')]:undefined)||'https://'}];case _0x04c2('0x66'):return[{'name':'attrPath','value':_0x84f957[_0x04c2('0x67')]||(_0x84f957[_0x04c2('0x64')]&&_0x84f957['attrs'][0x0]?_0x84f957[_0x04c2('0x64')][0x0][_0x04c2('0x65')]:undefined)||''}];case _0x04c2('0x68'):return[{'name':_0x04c2('0x69'),'value':_0x84f957[_0x04c2('0x69')]||(_0x84f957[_0x04c2('0x64')]&&_0x84f957[_0x04c2('0x64')][0x0]?_0x84f957['attrs'][0x0]['value']:undefined)||_0x04c2('0x6a')},{'name':'attrTimezone','value':_0x84f957[_0x04c2('0x6b')]||(_0x84f957[_0x04c2('0x64')]&&_0x84f957['attrs'][0x1]?_0x84f957[_0x04c2('0x64')][0x1][_0x04c2('0x65')]:undefined)||_0x04c2('0x6c')},{'name':_0x04c2('0x6d'),'value':_0x84f957[_0x04c2('0x6d')]||(_0x84f957[_0x04c2('0x64')]&&_0x84f957['attrs'][0x2]?_0x84f957[_0x04c2('0x64')][0x2][_0x04c2('0x65')]:undefined)||0xc}];case _0x04c2('0x6e'):return[{'name':'attrMetric','value':_0x84f957[_0x04c2('0x6f')]||(_0x84f957[_0x04c2('0x64')]&&_0x84f957[_0x04c2('0x64')][0x0]?_0x84f957[_0x04c2('0x64')][0x0]['value']:undefined)||'total'},{'name':_0x04c2('0x70'),'value':_0x84f957[_0x04c2('0x70')]||(_0x84f957[_0x04c2('0x64')]&&_0x84f957[_0x04c2('0x64')][0x1]?_0x84f957[_0x04c2('0x64')][0x1][_0x04c2('0x65')]:undefined)||[]},{'name':_0x04c2('0x6d'),'value':_0x84f957[_0x04c2('0x6d')]||(_0x84f957[_0x04c2('0x64')]&&_0x84f957[_0x04c2('0x64')][0x2]?_0x84f957[_0x04c2('0x64')][0x2][_0x04c2('0x65')]:undefined)||0x14}];case _0x04c2('0x71'):case _0x04c2('0x72'):return[{'name':_0x04c2('0x73'),'value':_0x84f957[_0x04c2('0x73')]||(_0x84f957['attrs']&&_0x84f957['attrs'][0x0]?_0x84f957['attrs'][0x0]['value']:undefined)||_0x04c2('0x74')},{'name':_0x04c2('0x75'),'value':_0x84f957['attrSerie2']||(_0x84f957[_0x04c2('0x64')]&&_0x84f957[_0x04c2('0x64')][0x1]?_0x84f957[_0x04c2('0x64')][0x1][_0x04c2('0x65')]:undefined)||null},{'name':'attrSerie3','value':_0x84f957[_0x04c2('0x76')]||(_0x84f957[_0x04c2('0x64')]&&_0x84f957[_0x04c2('0x64')][0x2]?_0x84f957[_0x04c2('0x64')][0x2]['value']:undefined)||null},{'name':_0x04c2('0x70'),'value':_0x84f957[_0x04c2('0x70')]||(_0x84f957['attrs']&&_0x84f957[_0x04c2('0x64')][0x3]?_0x84f957[_0x04c2('0x64')][0x3][_0x04c2('0x65')]:undefined)||[]}];case'web-report':return[{'name':_0x04c2('0x77'),'type':_0x84f957['reportType']||(_0x84f957[_0x04c2('0x64')]&&_0x84f957[_0x04c2('0x64')][0x0]?_0x84f957[_0x04c2('0x64')][0x0][_0x04c2('0x39')]:undefined)||null,'value':_0x84f957['attrReport']||(_0x84f957[_0x04c2('0x64')]&&_0x84f957[_0x04c2('0x64')][0x0]?_0x84f957[_0x04c2('0x64')][0x0][_0x04c2('0x65')]:undefined)||null},{'name':'attrRefresh','value':_0x84f957[_0x04c2('0x78')]||(_0x84f957[_0x04c2('0x64')]&&_0x84f957[_0x04c2('0x64')][0x1]?_0x84f957[_0x04c2('0x64')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x5ef11e){logger[_0x04c2('0x30')]('widgetAttributes:\x20%s',JSON[_0x04c2('0x79')](_0x5ef11e));return[];}}exports[_0x04c2('0x7a')]=function(_0x1ef5fa,_0x50a325,_0x5c2fee){if(_0x1ef5fa[_0x04c2('0x5e')]['id']){delete _0x1ef5fa[_0x04c2('0x5e')]['id'];}return db[_0x04c2('0x36')]['find']({'where':{'id':_0x1ef5fa[_0x04c2('0x52')]['id']}})[_0x04c2('0x2c')](handleEntityNotFound(_0x50a325,null))[_0x04c2('0x2c')](function(_0x976db){if(_0x976db){_0x1ef5fa[_0x04c2('0x5e')]['DashboardId']=_0x976db['id'];_0x1ef5fa['body'][_0x04c2('0x64')]=widgetAttributes(_0x1ef5fa[_0x04c2('0x5e')]);return db['DashboardItem'][_0x04c2('0x53')](_0x1ef5fa[_0x04c2('0x5e')]);}})[_0x04c2('0x2c')](respondWithResult(_0x50a325,null))['catch'](handleError(_0x50a325,null));};exports[_0x04c2('0x7b')]=function(_0x1b8b57,_0x115891,_0x481e49){var _0x3cff8b={};var _0x4fb04b={};var _0x53d86f;var _0x1b760b;return db[_0x04c2('0x36')]['findOne']({'where':{'id':_0x1b8b57[_0x04c2('0x52')]['id']}})['then'](handleEntityNotFound(_0x115891,null))[_0x04c2('0x2c')](function(_0x6d6a5f){if(_0x6d6a5f){_0x53d86f=_0x6d6a5f;_0x4fb04b[_0x04c2('0x3b')]=_[_0x04c2('0x3c')](db['DashboardItem']['rawAttributes']);_0x4fb04b['query']=_[_0x04c2('0x3c')](_0x1b8b57['query']);_0x4fb04b[_0x04c2('0x47')]=_[_0x04c2('0x3e')](_0x4fb04b[_0x04c2('0x3b')],_0x4fb04b[_0x04c2('0x3d')]);_0x3cff8b['attributes']=_[_0x04c2('0x3e')](_0x4fb04b[_0x04c2('0x3b')],qs['fields'](_0x1b8b57['query'][_0x04c2('0x40')]));_0x3cff8b[_0x04c2('0x3f')]=_0x3cff8b['attributes'][_0x04c2('0x41')]?_0x3cff8b[_0x04c2('0x3f')]:_0x4fb04b[_0x04c2('0x3b')];_0x3cff8b[_0x04c2('0x44')]=qs[_0x04c2('0x45')](_0x1b8b57[_0x04c2('0x3d')]['sort']);_0x3cff8b[_0x04c2('0x46')]=qs[_0x04c2('0x47')](_[_0x04c2('0x48')](_0x1b8b57['query'],_0x4fb04b[_0x04c2('0x47')]));if(_0x1b8b57[_0x04c2('0x3d')][_0x04c2('0x7c')]){_0x3cff8b[_0x04c2('0x46')]=_['merge'](_0x3cff8b[_0x04c2('0x46')],{'$or':_[_0x04c2('0x35')](_0x3cff8b[_0x04c2('0x3f')],function(_0x53b9a2){var _0x1194b1={};_0x1194b1[_0x53b9a2]={'$like':'%'+_0x1b8b57['query'][_0x04c2('0x7c')]+'%'};return _0x1194b1;})});}_0x3cff8b=_['merge']({},_0x3cff8b,_0x1b8b57[_0x04c2('0x4b')]);return _0x53d86f[_0x04c2('0x7b')](_0x3cff8b);}})['then'](function(_0x2208dd){if(_0x2208dd){_0x1b760b=_0x2208dd[_0x04c2('0x41')];if(!_0x1b8b57[_0x04c2('0x3d')][_0x04c2('0x42')]('nolimit')){_0x3cff8b['limit']=qs[_0x04c2('0x26')](_0x1b8b57['query'][_0x04c2('0x26')]);_0x3cff8b[_0x04c2('0x24')]=qs[_0x04c2('0x24')](_0x1b8b57[_0x04c2('0x3d')][_0x04c2('0x24')]);}return _0x53d86f[_0x04c2('0x7b')](_0x3cff8b);}})[_0x04c2('0x2c')](function(_0x1ee2ab){if(_0x1ee2ab){return _0x1ee2ab?{'count':_0x1b760b,'rows':_0x1ee2ab}:null;}})[_0x04c2('0x2c')](respondWithResult(_0x115891,null))['catch'](handleError(_0x115891,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 6fe726c..6bc6498 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 _0xfea2=['events','../../mysqldb','Dashboard','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x2adfb1,_0x406e6e){var _0xa52d45=function(_0x2de16c){while(--_0x2de16c){_0x2adfb1['push'](_0x2adfb1['shift']());}};_0xa52d45(++_0x406e6e);}(_0xfea2,0x156));var _0x2fea=function(_0x2eaa66,_0x2062c0){_0x2eaa66=_0x2eaa66-0x0;var _0x3b1dd3=_0xfea2[_0x2eaa66];return _0x3b1dd3;};'use strict';var EventEmitter=require(_0x2fea('0x0'));var Dashboard=require(_0x2fea('0x1'))['db'][_0x2fea('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2fea('0x3'),'afterUpdate':_0x2fea('0x4'),'afterDestroy':_0x2fea('0x5')};function emitEvent(_0x7d9268){return function(_0x33052b,_0x1db390,_0x23818b){DashboardEvents['emit'](_0x7d9268+':'+_0x33052b['id'],_0x33052b);DashboardEvents[_0x2fea('0x6')](_0x7d9268,_0x33052b);_0x23818b(null);};}for(var e in events){if(events[_0x2fea('0x7')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x2fea('0x8')]=DashboardEvents; \ No newline at end of file +var _0x0f6a=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','Dashboard'];(function(_0x2f32c4,_0x531dc6){var _0x3f3018=function(_0x406998){while(--_0x406998){_0x2f32c4['push'](_0x2f32c4['shift']());}};_0x3f3018(++_0x531dc6);}(_0x0f6a,0x1b6));var _0xa0f6=function(_0x1da515,_0x58b30b){_0x1da515=_0x1da515-0x0;var _0x517f06=_0x0f6a[_0x1da515];return _0x517f06;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xa0f6('0x0'))['db'][_0xa0f6('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa0f6('0x2'),'afterDestroy':_0xa0f6('0x3')};function emitEvent(_0x3d6036){return function(_0x128d65,_0xa49606,_0x37881d){DashboardEvents[_0xa0f6('0x4')](_0x3d6036+':'+_0x128d65['id'],_0x128d65);DashboardEvents[_0xa0f6('0x4')](_0x3d6036,_0x128d65);_0x37881d(null);};}for(var e in events){if(events[_0xa0f6('0x5')](e)){var event=events[e];Dashboard[_0xa0f6('0x6')](e,emitEvent(event));}}module[_0xa0f6('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 0f45d49..3e21120 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 _0x553e=['exports','define','Dashboard','dashboards','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x545654,_0x5d47e7){var _0x2605a6=function(_0x53007d){while(--_0x53007d){_0x545654['push'](_0x545654['shift']());}};_0x2605a6(++_0x5d47e7);}(_0x553e,0x94));var _0xe553=function(_0x13354b,_0x38f631){_0x13354b=_0x13354b-0x0;var _0x3e1aa4=_0x553e[_0x13354b];return _0x3e1aa4;};'use strict';var _=require('lodash');var util=require(_0xe553('0x0'));var logger=require(_0xe553('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe553('0x2'));var rp=require(_0xe553('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe553('0x4'));var config=require('../../config/environment');var attributes=require('./dashboard.attributes');module[_0xe553('0x5')]=function(_0x5ebb7f,_0x51a822){return _0x5ebb7f[_0xe553('0x6')](_0xe553('0x7'),attributes,{'tableName':_0xe553('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x17d6=['api','moment','bluebird','request-promise','path','rimraf','exports','define','util'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x17d6,0xbc));var _0x617d=function(_0x1aac3f,_0x24daef){_0x1aac3f=_0x1aac3f-0x0;var _0x183039=_0x17d6[_0x1aac3f];return _0x183039;};'use strict';var _=require('lodash');var util=require(_0x617d('0x0'));var logger=require('../../config/logger')(_0x617d('0x1'));var moment=require(_0x617d('0x2'));var BPromise=require(_0x617d('0x3'));var rp=require(_0x617d('0x4'));var fs=require('fs');var path=require(_0x617d('0x5'));var rimraf=require(_0x617d('0x6'));var config=require('../../config/environment');var attributes=require('./dashboard.attributes');module[_0x617d('0x7')]=function(_0x5d2fdb,_0x11c5d8){return _0x5d2fdb[_0x617d('0x8')]('Dashboard',attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 1fceac5..8868957 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 _0x323f=['client','http','redis','defaults','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x277079,_0x511204){var _0x205a0b=function(_0x4f7df8){while(--_0x4f7df8){_0x277079['push'](_0x277079['shift']());}};_0x205a0b(++_0x511204);}(_0x323f,0xc8));var _0xf323=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x323f[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var moment=require(_0xf323('0x1'));var BPromise=require('bluebird');var rs=require(_0xf323('0x2'));var fs=require('fs');var Redis=require(_0xf323('0x3'));var db=require(_0xf323('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf323('0x5'))('rpc');var config=require(_0xf323('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf323('0x7')][_0xf323('0x8')]({'port':0x232a});config[_0xf323('0x9')]=_[_0xf323('0xa')](config[_0xf323('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf323('0x9')]));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x3d2766,_0x2aed45,_0x24ac21){return new BPromise(function(_0xc9ee82,_0x2d0996){return client[_0xf323('0xb')](_0x3d2766,_0x24ac21)[_0xf323('0xc')](function(_0x321b3b){logger[_0xf323('0xd')](_0xf323('0xe'),_0x2aed45,_0xf323('0xf'));logger[_0xf323('0x10')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x2aed45,'request\x20sent',JSON[_0xf323('0x11')](_0x321b3b));if(_0x321b3b['error']){if(_0x321b3b[_0xf323('0x12')][_0xf323('0x13')]===0x1f4){logger['error'](_0xf323('0xe'),_0x2aed45,_0x321b3b[_0xf323('0x12')][_0xf323('0x14')]);return _0x2d0996(_0x321b3b[_0xf323('0x12')]['message']);}logger[_0xf323('0x12')](_0xf323('0xe'),_0x2aed45,_0x321b3b[_0xf323('0x12')][_0xf323('0x14')]);return _0xc9ee82(_0x321b3b[_0xf323('0x12')]['message']);}else{logger[_0xf323('0xd')](_0xf323('0xe'),_0x2aed45,_0xf323('0xf'));_0xc9ee82(_0x321b3b[_0xf323('0x15')][_0xf323('0x14')]);}})[_0xf323('0x16')](function(_0xd48cbe){logger['error'](_0xf323('0xe'),_0x2aed45,_0xd48cbe);_0x2d0996(_0xd48cbe);});});} \ No newline at end of file +var _0x5fa7=['localhost','socket.io-emitter','./dashboard.socket','register','request','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','redis'];(function(_0x1857c6,_0x48840c){var _0x51011c=function(_0x3a4736){while(--_0x3a4736){_0x1857c6['push'](_0x1857c6['shift']());}};_0x51011c(++_0x48840c);}(_0x5fa7,0x1da));var _0x75fa=function(_0x3d69c3,_0x2f466d){_0x3d69c3=_0x3d69c3-0x0;var _0x414055=_0x5fa7[_0x3d69c3];return _0x414055;};'use strict';var _=require(_0x75fa('0x0'));var util=require(_0x75fa('0x1'));var moment=require(_0x75fa('0x2'));var BPromise=require('bluebird');var rs=require(_0x75fa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x75fa('0x4'))['db'];var utils=require(_0x75fa('0x5'));var logger=require('../../config/logger')(_0x75fa('0x6'));var config=require(_0x75fa('0x7'));var jayson=require(_0x75fa('0x8'));var client=jayson[_0x75fa('0x9')]['http']({'port':0x232a});config['redis']=_[_0x75fa('0xa')](config[_0x75fa('0xb')],{'host':_0x75fa('0xc'),'port':0x18eb});var socket=require(_0x75fa('0xd'))(new Redis(config[_0x75fa('0xb')]));require(_0x75fa('0xe'))[_0x75fa('0xf')](socket);function respondWithRpcPromise(_0x2e6b18,_0x31f9da,_0x4c0a5e){return new BPromise(function(_0x38451d,_0x274e34){return client[_0x75fa('0x10')](_0x2e6b18,_0x4c0a5e)['then'](function(_0x465152){logger['info'](_0x75fa('0x11'),_0x31f9da,_0x75fa('0x12'));logger[_0x75fa('0x13')](_0x75fa('0x14'),_0x31f9da,_0x75fa('0x12'),JSON[_0x75fa('0x15')](_0x465152));if(_0x465152[_0x75fa('0x16')]){if(_0x465152['error'][_0x75fa('0x17')]===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x31f9da,_0x465152[_0x75fa('0x16')][_0x75fa('0x18')]);return _0x274e34(_0x465152[_0x75fa('0x16')][_0x75fa('0x18')]);}logger['error'](_0x75fa('0x11'),_0x31f9da,_0x465152[_0x75fa('0x16')][_0x75fa('0x18')]);return _0x38451d(_0x465152['error'][_0x75fa('0x18')]);}else{logger[_0x75fa('0x19')](_0x75fa('0x11'),_0x31f9da,_0x75fa('0x12'));_0x38451d(_0x465152[_0x75fa('0x1a')][_0x75fa('0x18')]);}})['catch'](function(_0x56ed03){logger[_0x75fa('0x16')](_0x75fa('0x11'),_0x31f9da,_0x56ed03);_0x274e34(_0x56ed03);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 54ce011..e89e23b 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 _0x017d=['./dashboard.events','remove','emit','register'];(function(_0xfbceb4,_0x392f3b){var _0x563dbe=function(_0x3ac1cf){while(--_0x3ac1cf){_0xfbceb4['push'](_0xfbceb4['shift']());}};_0x563dbe(++_0x392f3b);}(_0x017d,0x1ec));var _0xd017=function(_0x11a1ba,_0x2613c8){_0x11a1ba=_0x11a1ba-0x0;var _0x26b430=_0x017d[_0x11a1ba];return _0x26b430;};'use strict';var DashboardEvents=require(_0xd017('0x0'));var events=['save',_0xd017('0x1'),'update'];function createListener(_0x3ee124,_0x529885){return function(_0x26f6fd){_0x529885[_0xd017('0x2')](_0x3ee124,_0x26f6fd);};}function removeListener(_0x48fbfd,_0x3feffd){return function(){DashboardEvents['removeListener'](_0x48fbfd,_0x3feffd);};}exports[_0xd017('0x3')]=function(_0x356997){for(var _0x1c79e9=0x0,_0x31f67a=events['length'];_0x1c79e9<_0x31f67a;_0x1c79e9++){var _0x1dbc91=events[_0x1c79e9];var _0x1f7586=createListener('dashboard:'+_0x1dbc91,_0x356997);DashboardEvents['on'](_0x1dbc91,_0x1f7586);}}; \ No newline at end of file +var _0x7dae=['dashboard:','./dashboard.events','remove','update','emit','removeListener','register','length'];(function(_0x14b550,_0x146b71){var _0x5b98ba=function(_0x3e3c6f){while(--_0x3e3c6f){_0x14b550['push'](_0x14b550['shift']());}};_0x5b98ba(++_0x146b71);}(_0x7dae,0x191));var _0xe7da=function(_0x546d56,_0x2460ec){_0x546d56=_0x546d56-0x0;var _0x316a7e=_0x7dae[_0x546d56];return _0x316a7e;};'use strict';var DashboardEvents=require(_0xe7da('0x0'));var events=['save',_0xe7da('0x1'),_0xe7da('0x2')];function createListener(_0x4501aa,_0x3823c4){return function(_0x235454){_0x3823c4[_0xe7da('0x3')](_0x4501aa,_0x235454);};}function removeListener(_0x4d86f1,_0x15557f){return function(){DashboardEvents[_0xe7da('0x4')](_0x4d86f1,_0x15557f);};}exports[_0xe7da('0x5')]=function(_0x528757){for(var _0x4fea35=0x0,_0x4de0e8=events[_0xe7da('0x6')];_0x4fea35<_0x4de0e8;_0x4fea35++){var _0x51be7f=events[_0x4fea35];var _0x31ceee=createListener(_0xe7da('0x7')+_0x51be7f,_0x528757);DashboardEvents['on'](_0x51be7f,_0x31ceee);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 0eee409..7b88105 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 _0x6d87=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboard.controller','isAuthenticated','get','/:id','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','exports','multer','path','connect-timeout'];(function(_0x375661,_0x118333){var _0x441062=function(_0x11889a){while(--_0x11889a){_0x375661['push'](_0x375661['shift']());}};_0x441062(++_0x118333);}(_0x6d87,0x1a1));var _0x76d8=function(_0x40296a,_0x5531e7){_0x40296a=_0x40296a-0x0;var _0x41ceac=_0x6d87[_0x40296a];return _0x41ceac;};'use strict';var multer=require(_0x76d8('0x0'));var util=require('util');var path=require(_0x76d8('0x1'));var timeout=require(_0x76d8('0x2'));var express=require(_0x76d8('0x3'));var router=express[_0x76d8('0x4')]();var fs_extra=require(_0x76d8('0x5'));var auth=require(_0x76d8('0x6'));var interaction=require(_0x76d8('0x7'));var config=require('../../config/environment');var controller=require(_0x76d8('0x8'));router['get']('/',auth[_0x76d8('0x9')](),controller['index']);router[_0x76d8('0xa')](_0x76d8('0xb'),auth[_0x76d8('0x9')](),controller['show']);router['get'](_0x76d8('0xc'),auth['isAuthenticated'](),controller[_0x76d8('0xd')]);router[_0x76d8('0xe')]('/',auth['isAuthenticated'](),controller[_0x76d8('0xf')]);router[_0x76d8('0xe')](_0x76d8('0x10'),auth['isAuthenticated'](),controller[_0x76d8('0x11')]);router[_0x76d8('0xe')](_0x76d8('0xc'),auth[_0x76d8('0x9')](),controller[_0x76d8('0x12')]);router[_0x76d8('0x13')](_0x76d8('0xb'),auth[_0x76d8('0x9')](),controller['update']);router['delete'](_0x76d8('0xb'),auth[_0x76d8('0x9')](),controller['destroy']);module[_0x76d8('0x14')]=router; \ No newline at end of file +var _0xb71d=['multer','util','path','express','Router','fs-extra','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','/:id/items','getItems','post','create','clone','addItem','put','update'];(function(_0x43c28d,_0x72bf05){var _0x117006=function(_0x5dde11){while(--_0x5dde11){_0x43c28d['push'](_0x43c28d['shift']());}};_0x117006(++_0x72bf05);}(_0xb71d,0xdc));var _0xdb71=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb71d[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0xdb71('0x0'));var util=require(_0xdb71('0x1'));var path=require(_0xdb71('0x2'));var timeout=require('connect-timeout');var express=require(_0xdb71('0x3'));var router=express[_0xdb71('0x4')]();var fs_extra=require(_0xdb71('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdb71('0x6'));var controller=require(_0xdb71('0x7'));router[_0xdb71('0x8')]('/',auth[_0xdb71('0x9')](),controller[_0xdb71('0xa')]);router['get'](_0xdb71('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xdb71('0x8')](_0xdb71('0xc'),auth[_0xdb71('0x9')](),controller[_0xdb71('0xd')]);router[_0xdb71('0xe')]('/',auth[_0xdb71('0x9')](),controller[_0xdb71('0xf')]);router[_0xdb71('0xe')]('/:id/clone',auth['isAuthenticated'](),controller[_0xdb71('0x10')]);router[_0xdb71('0xe')](_0xdb71('0xc'),auth['isAuthenticated'](),controller[_0xdb71('0x11')]);router[_0xdb71('0x12')](_0xdb71('0xb'),auth[_0xdb71('0x9')](),controller[_0xdb71('0x13')]);router['delete']('/:id',auth[_0xdb71('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 4bcd0f3..1a92abd 100644 --- a/server/api/dashboardItem/dashboardItem.attributes.js +++ b/server/api/dashboardItem/dashboardItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff','sequelize','squel','lodash','exports','STRING','long'];(function(_0x205e5a,_0x5c19fb){var _0x10da58=function(_0x1ba35d){while(--_0x1ba35d){_0x205e5a['push'](_0x205e5a['shift']());}};_0x10da58(++_0x5c19fb);}(_0x53ec,0x192));var _0xc53e=function(_0x6e51f1,_0x11371a){_0x6e51f1=_0x6e51f1-0x0;var _0x141b4c=_0x53ec[_0x6e51f1];return _0x141b4c;};'use strict';var Sequelize=require(_0xc53e('0x0'));var squel=require(_0xc53e('0x1'));var _=require(_0xc53e('0x2'));module[_0xc53e('0x3')]={'title':{'type':Sequelize[_0xc53e('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xc53e('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xc53e('0x5')),'get':function(){try{return JSON['parse'](this[_0xc53e('0x6')](_0xc53e('0x7')));}catch(_0x4a9c59){return[];}},'set':function(_0x2f1414){try{this['setDataValue'](_0xc53e('0x7'),JSON[_0xc53e('0x8')](_0x2f1414));}catch(_0x5d3b28){this[_0xc53e('0x9')](_0xc53e('0x7'),JSON[_0xc53e('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0xc53e('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xc53e('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xc53e('0xa')]},'col':{'type':Sequelize[_0xc53e('0xa')]},'background':{'type':Sequelize[_0xc53e('0x4')],'allowNull':![],'defaultValue':_0xc53e('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xc53e('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x7a54=['lodash','STRING','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','sequelize','squel'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x7a54,0x106));var _0x47a5=function(_0xa8a145,_0x2d9926){_0xa8a145=_0xa8a145-0x0;var _0x31f51=_0x7a54[_0xa8a145];return _0x31f51;};'use strict';var Sequelize=require(_0x47a5('0x0'));var squel=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));module['exports']={'title':{'type':Sequelize[_0x47a5('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x47a5('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x47a5('0x4')),'get':function(){try{return JSON[_0x47a5('0x5')](this[_0x47a5('0x6')](_0x47a5('0x7')));}catch(_0xfdf934){return[];}},'set':function(_0x545a97){try{this[_0x47a5('0x8')]('attrs',JSON[_0x47a5('0x9')](_0x545a97));}catch(_0x30e405){this['setDataValue'](_0x47a5('0x7'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x47a5('0xa')]},'col':{'type':Sequelize[_0x47a5('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x47a5('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x47a5('0x3')]},'titleFontSize':{'type':Sequelize[_0x47a5('0xa')],'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 d7c4310..f8ea28c 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 _0x6dd0=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','error','stack','name','show','params','keys','DashboardItem','query','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','catch','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x6dd0,0xae));var _0x06dd=function(_0x286f07,_0x40e03a){_0x286f07=_0x286f07-0x0;var _0x437c35=_0x6dd0[_0x286f07];return _0x437c35;};'use strict';var emlformat=require(_0x06dd('0x0'));var rimraf=require(_0x06dd('0x1'));var zipdir=require(_0x06dd('0x2'));var jsonpatch=require(_0x06dd('0x3'));var rp=require(_0x06dd('0x4'));var moment=require(_0x06dd('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x06dd('0x6'));var path=require(_0x06dd('0x7'));var sox=require(_0x06dd('0x8'));var csv=require(_0x06dd('0x9'));var ejs=require(_0x06dd('0xa'));var fs=require('fs');var fs_extra=require(_0x06dd('0xb'));var _=require('lodash');var squel=require(_0x06dd('0xc'));var crypto=require(_0x06dd('0xd'));var jsforce=require(_0x06dd('0xe'));var deskjs=require(_0x06dd('0xf'));var toCsv=require('to-csv');var querystring=require(_0x06dd('0x10'));var Papa=require(_0x06dd('0x11'));var Redis=require('ioredis');var authService=require(_0x06dd('0x12'));var qs=require(_0x06dd('0x13'));var as=require(_0x06dd('0x14'));var hardwareService=require(_0x06dd('0x15'));var logger=require(_0x06dd('0x16'))(_0x06dd('0x17'));var utils=require('../../config/utils');var config=require(_0x06dd('0x18'));var licenseUtil=require(_0x06dd('0x19'));var db=require(_0x06dd('0x1a'))['db'];config[_0x06dd('0x1b')]=_['defaults'](config[_0x06dd('0x1b')],{'host':_0x06dd('0x1c'),'port':0x18eb});var socket=require(_0x06dd('0x1d'))(new Redis(config[_0x06dd('0x1b')]));require(_0x06dd('0x1e'))['register'](socket);function respondWithStatusCode(_0x3b4042,_0x3bf79e){_0x3bf79e=_0x3bf79e||0xcc;return function(_0x5396c4){if(_0x5396c4){return _0x3b4042[_0x06dd('0x1f')](_0x3bf79e);}return _0x3b4042['status'](_0x3bf79e)[_0x06dd('0x20')]();};}function respondWithResult(_0x42dfe8,_0x594fda){_0x594fda=_0x594fda||0xc8;return function(_0x476484){if(_0x476484){return _0x42dfe8[_0x06dd('0x21')](_0x594fda)[_0x06dd('0x22')](_0x476484);}};}function respondWithFilteredResult(_0x99d879,_0x482b3b){return function(_0x1326a4){if(_0x1326a4){var _0x490792=typeof _0x482b3b['offset']===_0x06dd('0x23')&&typeof _0x482b3b[_0x06dd('0x24')]==='undefined';var _0x3a83b6=_0x1326a4[_0x06dd('0x25')];var _0x229cd6=_0x490792?0x0:_0x482b3b['offset'];var _0x3f15f6=_0x490792?_0x1326a4['count']:_0x482b3b[_0x06dd('0x26')]+_0x482b3b[_0x06dd('0x24')];var _0x534806;if(_0x3f15f6>=_0x3a83b6){_0x3f15f6=_0x3a83b6;_0x534806=0xc8;}else{_0x534806=0xce;}_0x99d879[_0x06dd('0x21')](_0x534806);return _0x99d879[_0x06dd('0x27')](_0x06dd('0x28'),_0x229cd6+'-'+_0x3f15f6+'/'+_0x3a83b6)[_0x06dd('0x22')](_0x1326a4);}return null;};}function patchUpdates(_0x362865){return function(_0x4757fe){try{jsonpatch[_0x06dd('0x29')](_0x4757fe,_0x362865,!![]);}catch(_0x38b1b3){return BPromise['reject'](_0x38b1b3);}return _0x4757fe[_0x06dd('0x2a')]();};}function saveUpdates(_0x4d1d62,_0x39ae65){return function(_0x2fe65b){if(_0x2fe65b){return _0x2fe65b['update'](_0x4d1d62)[_0x06dd('0x2b')](function(_0xca0c00){return _0xca0c00;});}return null;};}function removeEntity(_0x1bb9b2,_0x12d3c2){return function(_0xfd530){if(_0xfd530){return _0xfd530['destroy']()[_0x06dd('0x2b')](function(){_0x1bb9b2[_0x06dd('0x21')](0xcc)[_0x06dd('0x20')]();});}};}function handleEntityNotFound(_0x2668b2,_0x8b7213){return function(_0x50e312){if(!_0x50e312){_0x2668b2['sendStatus'](0x194);}return _0x50e312;};}function handleError(_0x5f0c97,_0x29b25b){_0x29b25b=_0x29b25b||0x1f4;return function(_0x2d30f6){logger[_0x06dd('0x2c')](_0x2d30f6[_0x06dd('0x2d')]);if(_0x2d30f6[_0x06dd('0x2e')]){delete _0x2d30f6[_0x06dd('0x2e')];}_0x5f0c97[_0x06dd('0x21')](_0x29b25b)['send'](_0x2d30f6);};}exports[_0x06dd('0x2f')]=function(_0x358aa3,_0x251d66){var _0x3db9f6={'raw':![],'where':{'id':_0x358aa3[_0x06dd('0x30')]['id']}},_0x38c505={};_0x38c505['model']=_[_0x06dd('0x31')](db[_0x06dd('0x32')]['rawAttributes']);_0x38c505[_0x06dd('0x33')]=_[_0x06dd('0x31')](_0x358aa3['query']);_0x38c505[_0x06dd('0x34')]=_['intersection'](_0x38c505['model'],_0x38c505['query']);_0x3db9f6['attributes']=_[_0x06dd('0x35')](_0x38c505[_0x06dd('0x36')],qs[_0x06dd('0x37')](_0x358aa3[_0x06dd('0x33')]['fields']));_0x3db9f6[_0x06dd('0x38')]=_0x3db9f6['attributes'][_0x06dd('0x39')]?_0x3db9f6[_0x06dd('0x38')]:_0x38c505[_0x06dd('0x36')];if(_0x358aa3[_0x06dd('0x33')][_0x06dd('0x3a')]){_0x3db9f6[_0x06dd('0x3b')]=[{'all':!![]}];}_0x3db9f6=_[_0x06dd('0x3c')]({},_0x3db9f6,_0x358aa3[_0x06dd('0x3d')]);return db[_0x06dd('0x32')][_0x06dd('0x3e')](_0x3db9f6)[_0x06dd('0x2b')](handleEntityNotFound(_0x251d66,null))['then'](respondWithResult(_0x251d66,null))['catch'](handleError(_0x251d66,null));};exports['destroy']=function(_0x2f9b4a,_0x1d9439){return db[_0x06dd('0x32')]['find']({'where':{'id':_0x2f9b4a[_0x06dd('0x30')]['id']}})[_0x06dd('0x2b')](handleEntityNotFound(_0x1d9439,null))[_0x06dd('0x2b')](removeEntity(_0x1d9439,null))['catch'](handleError(_0x1d9439,null));};function widgetAttributes(_0x5e5d66){try{switch(_0x5e5d66[_0x06dd('0x3f')]){case _0x06dd('0x40'):return[{'name':_0x06dd('0x41'),'value':_0x5e5d66[_0x06dd('0x41')]||(_0x5e5d66[_0x06dd('0x42')]&&_0x5e5d66[_0x06dd('0x42')][0x0]?_0x5e5d66['attrs'][0x0][_0x06dd('0x43')]:undefined)||_0x06dd('0x44')}];case _0x06dd('0x45'):return[{'name':_0x06dd('0x46'),'value':_0x5e5d66['attrPath']||(_0x5e5d66[_0x06dd('0x42')]&&_0x5e5d66['attrs'][0x0]?_0x5e5d66[_0x06dd('0x42')][0x0][_0x06dd('0x43')]:undefined)||''}];case'clock':return[{'name':_0x06dd('0x47'),'value':_0x5e5d66[_0x06dd('0x47')]||(_0x5e5d66[_0x06dd('0x42')]&&_0x5e5d66[_0x06dd('0x42')][0x0]?_0x5e5d66[_0x06dd('0x42')][0x0][_0x06dd('0x43')]:undefined)||_0x06dd('0x48')},{'name':'attrTimezone','value':_0x5e5d66[_0x06dd('0x49')]||(_0x5e5d66[_0x06dd('0x42')]&&_0x5e5d66['attrs'][0x1]?_0x5e5d66['attrs'][0x1][_0x06dd('0x43')]:undefined)||_0x06dd('0x4a')},{'name':'attrFontSize','value':_0x5e5d66[_0x06dd('0x4b')]||(_0x5e5d66['attrs']&&_0x5e5d66['attrs'][0x2]?_0x5e5d66[_0x06dd('0x42')][0x2][_0x06dd('0x43')]:undefined)||0xc}];case _0x06dd('0x4c'):return[{'name':_0x06dd('0x4d'),'value':_0x5e5d66['attrMetric']||(_0x5e5d66[_0x06dd('0x42')]&&_0x5e5d66['attrs'][0x0]?_0x5e5d66[_0x06dd('0x42')][0x0]['value']:undefined)||_0x06dd('0x4e')},{'name':_0x06dd('0x4f'),'value':_0x5e5d66[_0x06dd('0x4f')]||(_0x5e5d66[_0x06dd('0x42')]&&_0x5e5d66[_0x06dd('0x42')][0x1]?_0x5e5d66[_0x06dd('0x42')][0x1][_0x06dd('0x43')]:undefined)||[]},{'name':'attrFontSize','value':_0x5e5d66['attrFontSize']||(_0x5e5d66[_0x06dd('0x42')]&&_0x5e5d66[_0x06dd('0x42')][0x2]?_0x5e5d66[_0x06dd('0x42')][0x2][_0x06dd('0x43')]:undefined)||0x14}];case _0x06dd('0x50'):case _0x06dd('0x51'):return[{'name':_0x06dd('0x52'),'value':_0x5e5d66['attrSerie1']||(_0x5e5d66[_0x06dd('0x42')]&&_0x5e5d66['attrs'][0x0]?_0x5e5d66[_0x06dd('0x42')][0x0][_0x06dd('0x43')]:undefined)||_0x06dd('0x4e')},{'name':_0x06dd('0x53'),'value':_0x5e5d66['attrSerie2']||(_0x5e5d66[_0x06dd('0x42')]&&_0x5e5d66[_0x06dd('0x42')][0x1]?_0x5e5d66[_0x06dd('0x42')][0x1]['value']:undefined)||null},{'name':_0x06dd('0x54'),'value':_0x5e5d66['attrSerie3']||(_0x5e5d66[_0x06dd('0x42')]&&_0x5e5d66[_0x06dd('0x42')][0x2]?_0x5e5d66[_0x06dd('0x42')][0x2][_0x06dd('0x43')]:undefined)||null},{'name':_0x06dd('0x4f'),'value':_0x5e5d66[_0x06dd('0x4f')]||(_0x5e5d66[_0x06dd('0x42')]&&_0x5e5d66[_0x06dd('0x42')][0x3]?_0x5e5d66[_0x06dd('0x42')][0x3]['value']:undefined)||[]}];case _0x06dd('0x55'):return[{'name':'attrReport','type':_0x5e5d66[_0x06dd('0x56')]||(_0x5e5d66[_0x06dd('0x42')]&&_0x5e5d66[_0x06dd('0x42')][0x0]?_0x5e5d66[_0x06dd('0x42')][0x0][_0x06dd('0x3f')]:undefined)||null,'value':_0x5e5d66['attrReport']||(_0x5e5d66['attrs']&&_0x5e5d66[_0x06dd('0x42')][0x0]?_0x5e5d66[_0x06dd('0x42')][0x0][_0x06dd('0x43')]:undefined)||null},{'name':_0x06dd('0x57'),'value':_0x5e5d66['attrRefresh']||(_0x5e5d66['attrs']&&_0x5e5d66[_0x06dd('0x42')][0x1]?_0x5e5d66['attrs'][0x1][_0x06dd('0x43')]:undefined)||0x0}];default:return[];}}catch(_0xcba7b0){logger[_0x06dd('0x2c')](_0x06dd('0x58'),JSON[_0x06dd('0x59')](_0xcba7b0));return[];}}exports[_0x06dd('0x5a')]=function(_0x309750,_0x339702){if(_0x309750[_0x06dd('0x5b')]){_0x309750[_0x06dd('0x5b')][_0x06dd('0x42')]=widgetAttributes(_0x309750[_0x06dd('0x5b')]);}return db[_0x06dd('0x32')]['create'](_0x309750[_0x06dd('0x5b')],{})['then'](respondWithResult(_0x339702,0xc9))[_0x06dd('0x5c')](handleError(_0x339702,null));};exports[_0x06dd('0x5d')]=function(_0x53db09,_0x405336){if(_0x53db09[_0x06dd('0x5b')]['id']){delete _0x53db09['body']['id'];}_0x53db09[_0x06dd('0x5b')][_0x06dd('0x42')]=widgetAttributes(_0x53db09[_0x06dd('0x5b')]);return db[_0x06dd('0x32')][_0x06dd('0x3e')]({'where':{'id':_0x53db09[_0x06dd('0x30')]['id']}})['then'](handleEntityNotFound(_0x405336,null))[_0x06dd('0x2b')](saveUpdates(_0x53db09[_0x06dd('0x5b')],null))['then'](respondWithResult(_0x405336,null))[_0x06dd('0x5c')](handleError(_0x405336,null));}; \ No newline at end of file +var _0xc389=['web-report','attrReport','attrRefresh','error','widgetAttributes:\x20%s','stringify','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','stack','name','send','rawAttributes','keys','filters','intersection','query','attributes','model','fields','includeAll','merge','DashboardItem','find','then','catch','params','type','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie2'];(function(_0x58235f,_0x5e3186){var _0x461ccc=function(_0x3c4409){while(--_0x3c4409){_0x58235f['push'](_0x58235f['shift']());}};_0x461ccc(++_0x5e3186);}(_0xc389,0x164));var _0x9c38=function(_0x19f195,_0x53dd36){_0x19f195=_0x19f195-0x0;var _0x43b5b8=_0xc389[_0x19f195];return _0x43b5b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9c38('0x0'));var zipdir=require(_0x9c38('0x1'));var jsonpatch=require(_0x9c38('0x2'));var rp=require(_0x9c38('0x3'));var moment=require(_0x9c38('0x4'));var BPromise=require(_0x9c38('0x5'));var Mustache=require('mustache');var util=require(_0x9c38('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9c38('0x7'));var _=require(_0x9c38('0x8'));var squel=require(_0x9c38('0x9'));var crypto=require(_0x9c38('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9c38('0xb'));var toCsv=require(_0x9c38('0xc'));var querystring=require(_0x9c38('0xd'));var Papa=require(_0x9c38('0xe'));var Redis=require(_0x9c38('0xf'));var authService=require(_0x9c38('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9c38('0x11'));var hardwareService=require(_0x9c38('0x12'));var logger=require(_0x9c38('0x13'))('api');var utils=require(_0x9c38('0x14'));var config=require(_0x9c38('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9c38('0x16'))['db'];config[_0x9c38('0x17')]=_[_0x9c38('0x18')](config[_0x9c38('0x17')],{'host':_0x9c38('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9c38('0x17')]));require('./dashboardItem.socket')[_0x9c38('0x1a')](socket);function respondWithStatusCode(_0x35738a,_0x1921e0){_0x1921e0=_0x1921e0||0xcc;return function(_0x4c93ba){if(_0x4c93ba){return _0x35738a[_0x9c38('0x1b')](_0x1921e0);}return _0x35738a[_0x9c38('0x1c')](_0x1921e0)[_0x9c38('0x1d')]();};}function respondWithResult(_0xecd2e,_0x307e9c){_0x307e9c=_0x307e9c||0xc8;return function(_0xa30fc3){if(_0xa30fc3){return _0xecd2e[_0x9c38('0x1c')](_0x307e9c)[_0x9c38('0x1e')](_0xa30fc3);}};}function respondWithFilteredResult(_0x315296,_0x8f8d8d){return function(_0x247444){if(_0x247444){var _0x3cc99b=typeof _0x8f8d8d[_0x9c38('0x1f')]==='undefined'&&typeof _0x8f8d8d[_0x9c38('0x20')]===_0x9c38('0x21');var _0x540cae=_0x247444[_0x9c38('0x22')];var _0x204baa=_0x3cc99b?0x0:_0x8f8d8d['offset'];var _0x484f3d=_0x3cc99b?_0x247444[_0x9c38('0x22')]:_0x8f8d8d[_0x9c38('0x1f')]+_0x8f8d8d[_0x9c38('0x20')];var _0x32f9c6;if(_0x484f3d>=_0x540cae){_0x484f3d=_0x540cae;_0x32f9c6=0xc8;}else{_0x32f9c6=0xce;}_0x315296[_0x9c38('0x1c')](_0x32f9c6);return _0x315296[_0x9c38('0x23')](_0x9c38('0x24'),_0x204baa+'-'+_0x484f3d+'/'+_0x540cae)['json'](_0x247444);}return null;};}function patchUpdates(_0x5b0d04){return function(_0x40b0d7){try{jsonpatch[_0x9c38('0x25')](_0x40b0d7,_0x5b0d04,!![]);}catch(_0x4d8ab3){return BPromise['reject'](_0x4d8ab3);}return _0x40b0d7[_0x9c38('0x26')]();};}function saveUpdates(_0x1e3350,_0x593781){return function(_0x10c108){if(_0x10c108){return _0x10c108[_0x9c38('0x27')](_0x1e3350)['then'](function(_0x2555b8){return _0x2555b8;});}return null;};}function removeEntity(_0x4a07c8,_0x3745de){return function(_0x73aead){if(_0x73aead){return _0x73aead[_0x9c38('0x28')]()['then'](function(){_0x4a07c8['status'](0xcc)[_0x9c38('0x1d')]();});}};}function handleEntityNotFound(_0x262b44,_0x36398b){return function(_0x19b196){if(!_0x19b196){_0x262b44[_0x9c38('0x1b')](0x194);}return _0x19b196;};}function handleError(_0x58c37b,_0x59ea90){_0x59ea90=_0x59ea90||0x1f4;return function(_0xa18b63){logger['error'](_0xa18b63[_0x9c38('0x29')]);if(_0xa18b63[_0x9c38('0x2a')]){delete _0xa18b63['name'];}_0x58c37b[_0x9c38('0x1c')](_0x59ea90)[_0x9c38('0x2b')](_0xa18b63);};}exports['show']=function(_0x7da84a,_0x40a367){var _0x384f7b={'raw':![],'where':{'id':_0x7da84a['params']['id']}},_0x484e37={};_0x484e37['model']=_['keys'](db['DashboardItem'][_0x9c38('0x2c')]);_0x484e37['query']=_[_0x9c38('0x2d')](_0x7da84a['query']);_0x484e37[_0x9c38('0x2e')]=_[_0x9c38('0x2f')](_0x484e37['model'],_0x484e37[_0x9c38('0x30')]);_0x384f7b[_0x9c38('0x31')]=_[_0x9c38('0x2f')](_0x484e37[_0x9c38('0x32')],qs[_0x9c38('0x33')](_0x7da84a[_0x9c38('0x30')][_0x9c38('0x33')]));_0x384f7b['attributes']=_0x384f7b[_0x9c38('0x31')]['length']?_0x384f7b[_0x9c38('0x31')]:_0x484e37[_0x9c38('0x32')];if(_0x7da84a[_0x9c38('0x30')][_0x9c38('0x34')]){_0x384f7b['include']=[{'all':!![]}];}_0x384f7b=_[_0x9c38('0x35')]({},_0x384f7b,_0x7da84a['options']);return db[_0x9c38('0x36')][_0x9c38('0x37')](_0x384f7b)['then'](handleEntityNotFound(_0x40a367,null))[_0x9c38('0x38')](respondWithResult(_0x40a367,null))[_0x9c38('0x39')](handleError(_0x40a367,null));};exports[_0x9c38('0x28')]=function(_0x24c93f,_0x3cffa5){return db[_0x9c38('0x36')][_0x9c38('0x37')]({'where':{'id':_0x24c93f[_0x9c38('0x3a')]['id']}})['then'](handleEntityNotFound(_0x3cffa5,null))[_0x9c38('0x38')](removeEntity(_0x3cffa5,null))[_0x9c38('0x39')](handleError(_0x3cffa5,null));};function widgetAttributes(_0xa20a9f){try{switch(_0xa20a9f[_0x9c38('0x3b')]){case'iframe':return[{'name':_0x9c38('0x3c'),'value':_0xa20a9f[_0x9c38('0x3c')]||(_0xa20a9f['attrs']&&_0xa20a9f[_0x9c38('0x3d')][0x0]?_0xa20a9f['attrs'][0x0][_0x9c38('0x3e')]:undefined)||_0x9c38('0x3f')}];case _0x9c38('0x40'):return[{'name':_0x9c38('0x41'),'value':_0xa20a9f[_0x9c38('0x41')]||(_0xa20a9f[_0x9c38('0x3d')]&&_0xa20a9f[_0x9c38('0x3d')][0x0]?_0xa20a9f['attrs'][0x0]['value']:undefined)||''}];case _0x9c38('0x42'):return[{'name':_0x9c38('0x43'),'value':_0xa20a9f[_0x9c38('0x43')]||(_0xa20a9f[_0x9c38('0x3d')]&&_0xa20a9f[_0x9c38('0x3d')][0x0]?_0xa20a9f['attrs'][0x0][_0x9c38('0x3e')]:undefined)||_0x9c38('0x44')},{'name':'attrTimezone','value':_0xa20a9f[_0x9c38('0x45')]||(_0xa20a9f[_0x9c38('0x3d')]&&_0xa20a9f['attrs'][0x1]?_0xa20a9f[_0x9c38('0x3d')][0x1][_0x9c38('0x3e')]:undefined)||_0x9c38('0x46')},{'name':_0x9c38('0x47'),'value':_0xa20a9f[_0x9c38('0x47')]||(_0xa20a9f[_0x9c38('0x3d')]&&_0xa20a9f[_0x9c38('0x3d')][0x2]?_0xa20a9f['attrs'][0x2][_0x9c38('0x3e')]:undefined)||0xc}];case _0x9c38('0x48'):return[{'name':_0x9c38('0x49'),'value':_0xa20a9f['attrMetric']||(_0xa20a9f['attrs']&&_0xa20a9f['attrs'][0x0]?_0xa20a9f[_0x9c38('0x3d')][0x0]['value']:undefined)||_0x9c38('0x4a')},{'name':'attrVoiceQueues','value':_0xa20a9f[_0x9c38('0x4b')]||(_0xa20a9f[_0x9c38('0x3d')]&&_0xa20a9f['attrs'][0x1]?_0xa20a9f[_0x9c38('0x3d')][0x1][_0x9c38('0x3e')]:undefined)||[]},{'name':_0x9c38('0x47'),'value':_0xa20a9f[_0x9c38('0x47')]||(_0xa20a9f['attrs']&&_0xa20a9f[_0x9c38('0x3d')][0x2]?_0xa20a9f[_0x9c38('0x3d')][0x2]['value']:undefined)||0x14}];case _0x9c38('0x4c'):case _0x9c38('0x4d'):return[{'name':'attrSerie1','value':_0xa20a9f['attrSerie1']||(_0xa20a9f[_0x9c38('0x3d')]&&_0xa20a9f[_0x9c38('0x3d')][0x0]?_0xa20a9f[_0x9c38('0x3d')][0x0][_0x9c38('0x3e')]:undefined)||_0x9c38('0x4a')},{'name':_0x9c38('0x4e'),'value':_0xa20a9f[_0x9c38('0x4e')]||(_0xa20a9f[_0x9c38('0x3d')]&&_0xa20a9f['attrs'][0x1]?_0xa20a9f[_0x9c38('0x3d')][0x1][_0x9c38('0x3e')]:undefined)||null},{'name':'attrSerie3','value':_0xa20a9f['attrSerie3']||(_0xa20a9f[_0x9c38('0x3d')]&&_0xa20a9f[_0x9c38('0x3d')][0x2]?_0xa20a9f[_0x9c38('0x3d')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0xa20a9f[_0x9c38('0x4b')]||(_0xa20a9f['attrs']&&_0xa20a9f[_0x9c38('0x3d')][0x3]?_0xa20a9f['attrs'][0x3][_0x9c38('0x3e')]:undefined)||[]}];case _0x9c38('0x4f'):return[{'name':_0x9c38('0x50'),'type':_0xa20a9f['reportType']||(_0xa20a9f[_0x9c38('0x3d')]&&_0xa20a9f[_0x9c38('0x3d')][0x0]?_0xa20a9f[_0x9c38('0x3d')][0x0]['type']:undefined)||null,'value':_0xa20a9f[_0x9c38('0x50')]||(_0xa20a9f[_0x9c38('0x3d')]&&_0xa20a9f[_0x9c38('0x3d')][0x0]?_0xa20a9f['attrs'][0x0][_0x9c38('0x3e')]:undefined)||null},{'name':_0x9c38('0x51'),'value':_0xa20a9f[_0x9c38('0x51')]||(_0xa20a9f[_0x9c38('0x3d')]&&_0xa20a9f[_0x9c38('0x3d')][0x1]?_0xa20a9f['attrs'][0x1][_0x9c38('0x3e')]:undefined)||0x0}];default:return[];}}catch(_0x4dcaf2){logger[_0x9c38('0x52')](_0x9c38('0x53'),JSON[_0x9c38('0x54')](_0x4dcaf2));return[];}}exports[_0x9c38('0x55')]=function(_0x1b917d,_0x37c1c4){if(_0x1b917d[_0x9c38('0x56')]){_0x1b917d[_0x9c38('0x56')][_0x9c38('0x3d')]=widgetAttributes(_0x1b917d['body']);}return db[_0x9c38('0x36')]['create'](_0x1b917d[_0x9c38('0x56')],{})['then'](respondWithResult(_0x37c1c4,0xc9))['catch'](handleError(_0x37c1c4,null));};exports[_0x9c38('0x27')]=function(_0x3f5d80,_0x550a9a){if(_0x3f5d80['body']['id']){delete _0x3f5d80[_0x9c38('0x56')]['id'];}_0x3f5d80[_0x9c38('0x56')][_0x9c38('0x3d')]=widgetAttributes(_0x3f5d80['body']);return db['DashboardItem'][_0x9c38('0x37')]({'where':{'id':_0x3f5d80[_0x9c38('0x3a')]['id']}})[_0x9c38('0x38')](handleEntityNotFound(_0x550a9a,null))[_0x9c38('0x38')](saveUpdates(_0x3f5d80[_0x9c38('0x56')],null))['then'](respondWithResult(_0x550a9a,null))[_0x9c38('0x39')](handleError(_0x550a9a,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 2ba33fc..0ef5db0 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 _0xa413=['update','emit','hasOwnProperty','hook','exports','events','DashboardItem','save'];(function(_0x5c0b94,_0x5d4ae3){var _0x2429b4=function(_0x1d649b){while(--_0x1d649b){_0x5c0b94['push'](_0x5c0b94['shift']());}};_0x2429b4(++_0x5d4ae3);}(_0xa413,0x1e5));var _0x3a41=function(_0x156023,_0x1be9af){_0x156023=_0x156023-0x0;var _0x44b162=_0xa413[_0x156023];return _0x44b162;};'use strict';var EventEmitter=require(_0x3a41('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x3a41('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3a41('0x2'),'afterUpdate':_0x3a41('0x3'),'afterDestroy':'remove'};function emitEvent(_0x53ca9c){return function(_0x32a053,_0x212eb6,_0x118b7a){DashboardItemEvents[_0x3a41('0x4')](_0x53ca9c+':'+_0x32a053['id'],_0x32a053);DashboardItemEvents[_0x3a41('0x4')](_0x53ca9c,_0x32a053);_0x118b7a(null);};}for(var e in events){if(events[_0x3a41('0x5')](e)){var event=events[e];DashboardItem[_0x3a41('0x6')](e,emitEvent(event));}}module[_0x3a41('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0x8747=['hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','emit','hasOwnProperty'];(function(_0x47dce8,_0x10dcf3){var _0x5a8686=function(_0x542f89){while(--_0x542f89){_0x47dce8['push'](_0x47dce8['shift']());}};_0x5a8686(++_0x10dcf3);}(_0x8747,0x1ba));var _0x7874=function(_0x279f6d,_0x122316){_0x279f6d=_0x279f6d-0x0;var _0x5874a5=_0x8747[_0x279f6d];return _0x5874a5;};'use strict';var EventEmitter=require(_0x7874('0x0'));var DashboardItem=require(_0x7874('0x1'))['db'][_0x7874('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x7874('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x19e460){return function(_0x3b8af6,_0x565fbc,_0x2fac49){DashboardItemEvents[_0x7874('0x4')](_0x19e460+':'+_0x3b8af6['id'],_0x3b8af6);DashboardItemEvents[_0x7874('0x4')](_0x19e460,_0x3b8af6);_0x2fac49(null);};}for(var e in events){if(events[_0x7874('0x5')](e)){var event=events[e];DashboardItem[_0x7874('0x6')](e,emitEvent(event));}}module[_0x7874('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 1e1a469..4c60ac1 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 _0x3954=['dashboard_items','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x3954,0x16d));var _0x4395=function(_0x18227a,_0x198ce6){_0x18227a=_0x18227a-0x0;var _0x53b481=_0x3954[_0x18227a];return _0x53b481;};'use strict';var _=require(_0x4395('0x0'));var util=require(_0x4395('0x1'));var logger=require('../../config/logger')(_0x4395('0x2'));var moment=require('moment');var BPromise=require(_0x4395('0x3'));var rp=require(_0x4395('0x4'));var fs=require('fs');var path=require(_0x4395('0x5'));var rimraf=require(_0x4395('0x6'));var config=require(_0x4395('0x7'));var attributes=require(_0x4395('0x8'));module[_0x4395('0x9')]=function(_0x4ee6b0,_0x5463d5){return _0x4ee6b0[_0x4395('0xa')](_0x4395('0xb'),attributes,{'tableName':_0x4395('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9490=['path','rimraf','../../config/environment','exports','define','DashboardItem','api','bluebird','request-promise'];(function(_0x4e7b46,_0x1e5718){var _0x309599=function(_0x549658){while(--_0x549658){_0x4e7b46['push'](_0x4e7b46['shift']());}};_0x309599(++_0x1e5718);}(_0x9490,0x15c));var _0x0949=function(_0x4fc1a8,_0xc50ab1){_0x4fc1a8=_0x4fc1a8-0x0;var _0x4f1462=_0x9490[_0x4fc1a8];return _0x4f1462;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0949('0x0'));var moment=require('moment');var BPromise=require(_0x0949('0x1'));var rp=require(_0x0949('0x2'));var fs=require('fs');var path=require(_0x0949('0x3'));var rimraf=require(_0x0949('0x4'));var config=require(_0x0949('0x5'));var attributes=require('./dashboardItem.attributes');module[_0x0949('0x6')]=function(_0x389a07,_0x3511bb){return _0x389a07[_0x0949('0x7')](_0x0949('0x8'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index c4a8b99..1017b89 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 _0x1049=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','request\x20sent','debug','stringify','error','DashboardItem,\x20%s,\x20%s','message','info','result','catch'];(function(_0x511d41,_0x14b3ca){var _0x1030e3=function(_0x4e38d2){while(--_0x4e38d2){_0x511d41['push'](_0x511d41['shift']());}};_0x1030e3(++_0x14b3ca);}(_0x1049,0x134));var _0x9104=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1049[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x9104('0x0'));var util=require(_0x9104('0x1'));var moment=require(_0x9104('0x2'));var BPromise=require(_0x9104('0x3'));var rs=require(_0x9104('0x4'));var fs=require('fs');var Redis=require(_0x9104('0x5'));var db=require(_0x9104('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9104('0x7'))(_0x9104('0x8'));var config=require('../../config/environment');var jayson=require(_0x9104('0x9'));var client=jayson['client'][_0x9104('0xa')]({'port':0x232a});config[_0x9104('0xb')]=_[_0x9104('0xc')](config[_0x9104('0xb')],{'host':_0x9104('0xd'),'port':0x18eb});var socket=require(_0x9104('0xe'))(new Redis(config[_0x9104('0xb')]));require(_0x9104('0xf'))[_0x9104('0x10')](socket);function respondWithRpcPromise(_0x3e98cf,_0x4bd299,_0x552162){return new BPromise(function(_0x13231d,_0x85629d){return client[_0x9104('0x11')](_0x3e98cf,_0x552162)[_0x9104('0x12')](function(_0xc13335){logger['info']('DashboardItem,\x20%s,\x20%s',_0x4bd299,_0x9104('0x13'));logger[_0x9104('0x14')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x4bd299,_0x9104('0x13'),JSON[_0x9104('0x15')](_0xc13335));if(_0xc13335[_0x9104('0x16')]){if(_0xc13335[_0x9104('0x16')]['code']===0x1f4){logger['error'](_0x9104('0x17'),_0x4bd299,_0xc13335[_0x9104('0x16')][_0x9104('0x18')]);return _0x85629d(_0xc13335[_0x9104('0x16')][_0x9104('0x18')]);}logger[_0x9104('0x16')](_0x9104('0x17'),_0x4bd299,_0xc13335[_0x9104('0x16')]['message']);return _0x13231d(_0xc13335['error'][_0x9104('0x18')]);}else{logger[_0x9104('0x19')](_0x9104('0x17'),_0x4bd299,_0x9104('0x13'));_0x13231d(_0xc13335[_0x9104('0x1a')][_0x9104('0x18')]);}})[_0x9104('0x1b')](function(_0x51928c){logger['error'](_0x9104('0x17'),_0x4bd299,_0x51928c);_0x85629d(_0x51928c);});});} \ No newline at end of file +var _0x1ff0=['rpc','../../config/environment','jayson/promise','defaults','redis','socket.io-emitter','./dashboardItem.socket','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x50e7a4,_0x35bfbf){var _0x35c692=function(_0xcfe583){while(--_0xcfe583){_0x50e7a4['push'](_0x50e7a4['shift']());}};_0x35c692(++_0x35bfbf);}(_0x1ff0,0x171));var _0x01ff=function(_0x2ec61e,_0x435d7d){_0x2ec61e=_0x2ec61e-0x0;var _0x4eaaa9=_0x1ff0[_0x2ec61e];return _0x4eaaa9;};'use strict';var _=require(_0x01ff('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x01ff('0x1'));var fs=require('fs');var Redis=require(_0x01ff('0x2'));var db=require(_0x01ff('0x3'))['db'];var utils=require(_0x01ff('0x4'));var logger=require(_0x01ff('0x5'))(_0x01ff('0x6'));var config=require(_0x01ff('0x7'));var jayson=require(_0x01ff('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x01ff('0x9')](config[_0x01ff('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x01ff('0xb'))(new Redis(config[_0x01ff('0xa')]));require(_0x01ff('0xc'))['register'](socket);function respondWithRpcPromise(_0x5b98e5,_0xb51b92,_0x5ce010){return new BPromise(function(_0x16b865,_0x368788){return client[_0x01ff('0xd')](_0x5b98e5,_0x5ce010)[_0x01ff('0xe')](function(_0x2e2c00){logger[_0x01ff('0xf')](_0x01ff('0x10'),_0xb51b92,_0x01ff('0x11'));logger[_0x01ff('0x12')](_0x01ff('0x13'),_0xb51b92,_0x01ff('0x11'),JSON[_0x01ff('0x14')](_0x2e2c00));if(_0x2e2c00[_0x01ff('0x15')]){if(_0x2e2c00[_0x01ff('0x15')]['code']===0x1f4){logger['error']('DashboardItem,\x20%s,\x20%s',_0xb51b92,_0x2e2c00[_0x01ff('0x15')][_0x01ff('0x16')]);return _0x368788(_0x2e2c00['error'][_0x01ff('0x16')]);}logger['error'](_0x01ff('0x10'),_0xb51b92,_0x2e2c00[_0x01ff('0x15')][_0x01ff('0x16')]);return _0x16b865(_0x2e2c00[_0x01ff('0x15')][_0x01ff('0x16')]);}else{logger['info']('DashboardItem,\x20%s,\x20%s',_0xb51b92,'request\x20sent');_0x16b865(_0x2e2c00[_0x01ff('0x17')][_0x01ff('0x16')]);}})[_0x01ff('0x18')](function(_0x40d976){logger[_0x01ff('0x15')]('DashboardItem,\x20%s,\x20%s',_0xb51b92,_0x40d976);_0x368788(_0x40d976);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 127d03c..d999f09 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 _0xf00e=['length','dashboardItem:','./dashboardItem.events','save','remove','update','emit'];(function(_0x55f233,_0x5c8281){var _0x37554a=function(_0x4370d6){while(--_0x4370d6){_0x55f233['push'](_0x55f233['shift']());}};_0x37554a(++_0x5c8281);}(_0xf00e,0x80));var _0xef00=function(_0x96e9a1,_0x33e139){_0x96e9a1=_0x96e9a1-0x0;var _0x5bff77=_0xf00e[_0x96e9a1];return _0x5bff77;};'use strict';var DashboardItemEvents=require(_0xef00('0x0'));var events=[_0xef00('0x1'),_0xef00('0x2'),_0xef00('0x3')];function createListener(_0x172806,_0x23561a){return function(_0x46cd20){_0x23561a[_0xef00('0x4')](_0x172806,_0x46cd20);};}function removeListener(_0x3660e4,_0x59e043){return function(){DashboardItemEvents['removeListener'](_0x3660e4,_0x59e043);};}exports['register']=function(_0x12912b){for(var _0x13ea80=0x0,_0x30c256=events[_0xef00('0x5')];_0x13ea80<_0x30c256;_0x13ea80++){var _0x62f882=events[_0x13ea80];var _0xde2f8c=createListener(_0xef00('0x6')+_0x62f882,_0x12912b);DashboardItemEvents['on'](_0x62f882,_0xde2f8c);}}; \ No newline at end of file +var _0xa31b=['remove','emit','removeListener','register','dashboardItem:'];(function(_0x134a57,_0x4b6c62){var _0x5cf722=function(_0x489c94){while(--_0x489c94){_0x134a57['push'](_0x134a57['shift']());}};_0x5cf722(++_0x4b6c62);}(_0xa31b,0x186));var _0xba31=function(_0x5e17e7,_0x551ed9){_0x5e17e7=_0x5e17e7-0x0;var _0x19a417=_0xa31b[_0x5e17e7];return _0x19a417;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=['save',_0xba31('0x0'),'update'];function createListener(_0x50d841,_0x4b35de){return function(_0x3589bb){_0x4b35de[_0xba31('0x1')](_0x50d841,_0x3589bb);};}function removeListener(_0x33a4aa,_0x447d6b){return function(){DashboardItemEvents[_0xba31('0x2')](_0x33a4aa,_0x447d6b);};}exports[_0xba31('0x3')]=function(_0x195ddb){for(var _0x25dd4a=0x0,_0x4e8994=events['length'];_0x25dd4a<_0x4e8994;_0x25dd4a++){var _0x316475=events[_0x25dd4a];var _0xa6cb45=createListener(_0xba31('0x4')+_0x316475,_0x195ddb);DashboardItemEvents['on'](_0x316475,_0xa6cb45);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 670d8f5..be9c5f0 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 _0xd266=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','create','put','update','delete','destroy'];(function(_0x4b281a,_0x1733de){var _0x3149a7=function(_0x3a6b40){while(--_0x3a6b40){_0x4b281a['push'](_0x4b281a['shift']());}};_0x3149a7(++_0x1733de);}(_0xd266,0x141));var _0x6d26=function(_0x54d486,_0x193223){_0x54d486=_0x54d486-0x0;var _0x3a639e=_0xd266[_0x54d486];return _0x3a639e;};'use strict';var multer=require(_0x6d26('0x0'));var util=require(_0x6d26('0x1'));var path=require(_0x6d26('0x2'));var timeout=require(_0x6d26('0x3'));var express=require(_0x6d26('0x4'));var router=express[_0x6d26('0x5')]();var fs_extra=require(_0x6d26('0x6'));var auth=require(_0x6d26('0x7'));var interaction=require(_0x6d26('0x8'));var config=require(_0x6d26('0x9'));var controller=require(_0x6d26('0xa'));router[_0x6d26('0xb')](_0x6d26('0xc'),auth[_0x6d26('0xd')](),controller['show']);router['post']('/',auth[_0x6d26('0xd')](),controller[_0x6d26('0xe')]);router[_0x6d26('0xf')](_0x6d26('0xc'),auth['isAuthenticated'](),controller[_0x6d26('0x10')]);router[_0x6d26('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x6d26('0x12')]);module[_0x6d26('0x13')]=router; \ No newline at end of file +var _0x0923=['../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','post','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x33a062,_0x3a3d6b){var _0x5a7107=function(_0x40684a){while(--_0x40684a){_0x33a062['push'](_0x33a062['shift']());}};_0x5a7107(++_0x3a3d6b);}(_0x0923,0x139));var _0x3092=function(_0x4bcbfa,_0x50b567){_0x4bcbfa=_0x4bcbfa-0x0;var _0xe5b859=_0x0923[_0x4bcbfa];return _0xe5b859;};'use strict';var multer=require(_0x3092('0x0'));var util=require(_0x3092('0x1'));var path=require(_0x3092('0x2'));var timeout=require(_0x3092('0x3'));var express=require(_0x3092('0x4'));var router=express[_0x3092('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3092('0x6'));var interaction=require(_0x3092('0x7'));var config=require(_0x3092('0x8'));var controller=require(_0x3092('0x9'));router['get'](_0x3092('0xa'),auth[_0x3092('0xb')](),controller['show']);router[_0x3092('0xc')]('/',auth[_0x3092('0xb')](),controller['create']);router['put'](_0x3092('0xa'),auth[_0x3092('0xb')](),controller[_0x3092('0xd')]);router[_0x3092('0xe')](_0x3092('0xa'),auth[_0x3092('0xb')](),controller[_0x3092('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 4445f2a..d998c14 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 _0xa249=['STRING','first','second','third','exports'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0xa249,0x1cb));var _0x9a24=function(_0x5c513f,_0xc1c487){_0x5c513f=_0x5c513f-0x0;var _0x48ff0e=_0xa249[_0x5c513f];return _0x48ff0e;};'use strict';var Sequelize=require('sequelize');module[_0x9a24('0x0')]={'name':{'type':Sequelize[_0x9a24('0x1')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x9a24('0x2'),_0x9a24('0x3'),_0x9a24('0x4')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x9a24('0x1')]}}; \ No newline at end of file +var _0xe363=['first','second','third','sequelize','exports','STRING','ENUM'];(function(_0x284609,_0x386b54){var _0x55116b=function(_0x3cdc4e){while(--_0x3cdc4e){_0x284609['push'](_0x284609['shift']());}};_0x55116b(++_0x386b54);}(_0xe363,0x88));var _0x3e36=function(_0x3a8fd0,_0x39a744){_0x3a8fd0=_0x3a8fd0-0x0;var _0x45b7f8=_0xe363[_0x3a8fd0];return _0x45b7f8;};'use strict';var Sequelize=require(_0x3e36('0x0'));module[_0x3e36('0x1')]={'name':{'type':Sequelize[_0x3e36('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x3e36('0x3')](_0x3e36('0x4'),_0x3e36('0x5'),_0x3e36('0x6')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x3e36('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index d41516b..e5d3af1 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 _0x8cc2=['nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','options','includeAll','findAll','catch','params','length','include','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','then','Dispositions','UserProfileResource','stack','name','send','index','map','Disposition','rawAttributes','key','query','keys','model','attributes','intersection','fields','hasOwnProperty'];(function(_0x166e96,_0x55191d){var _0x553d73=function(_0x586142){while(--_0x586142){_0x166e96['push'](_0x166e96['shift']());}};_0x553d73(++_0x55191d);}(_0x8cc2,0x1cb));var _0x28cc=function(_0x52db40,_0x471802){_0x52db40=_0x52db40-0x0;var _0x423bae=_0x8cc2[_0x52db40];return _0x423bae;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x28cc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x28cc('0x1'));var rp=require(_0x28cc('0x2'));var moment=require(_0x28cc('0x3'));var BPromise=require(_0x28cc('0x4'));var Mustache=require(_0x28cc('0x5'));var util=require(_0x28cc('0x6'));var path=require(_0x28cc('0x7'));var sox=require(_0x28cc('0x8'));var csv=require(_0x28cc('0x9'));var ejs=require(_0x28cc('0xa'));var fs=require('fs');var fs_extra=require(_0x28cc('0xb'));var _=require('lodash');var squel=require(_0x28cc('0xc'));var crypto=require(_0x28cc('0xd'));var jsforce=require(_0x28cc('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x28cc('0x9'));var querystring=require('querystring');var Papa=require(_0x28cc('0xf'));var Redis=require('ioredis');var authService=require(_0x28cc('0x10'));var qs=require(_0x28cc('0x11'));var as=require(_0x28cc('0x12'));var hardwareService=require(_0x28cc('0x13'));var logger=require(_0x28cc('0x14'))(_0x28cc('0x15'));var utils=require(_0x28cc('0x16'));var config=require(_0x28cc('0x17'));var licenseUtil=require(_0x28cc('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xaf8ef1,_0x38ddc3){_0x38ddc3=_0x38ddc3||0xcc;return function(_0x21e748){if(_0x21e748){return _0xaf8ef1[_0x28cc('0x19')](_0x38ddc3);}return _0xaf8ef1[_0x28cc('0x1a')](_0x38ddc3)[_0x28cc('0x1b')]();};}function respondWithResult(_0x131819,_0x22ac98){_0x22ac98=_0x22ac98||0xc8;return function(_0x26e7d3){if(_0x26e7d3){return _0x131819[_0x28cc('0x1a')](_0x22ac98)[_0x28cc('0x1c')](_0x26e7d3);}};}function respondWithFilteredResult(_0x46ef93,_0x1ea36c){return function(_0x2e83c5){if(_0x2e83c5){var _0x4175ac=typeof _0x1ea36c[_0x28cc('0x1d')]===_0x28cc('0x1e')&&typeof _0x1ea36c['limit']==='undefined';var _0x500ba1=_0x2e83c5[_0x28cc('0x1f')];var _0x188288=_0x4175ac?0x0:_0x1ea36c[_0x28cc('0x1d')];var _0x2b2b37=_0x4175ac?_0x2e83c5[_0x28cc('0x1f')]:_0x1ea36c[_0x28cc('0x1d')]+_0x1ea36c[_0x28cc('0x20')];var _0x40e427;if(_0x2b2b37>=_0x500ba1){_0x2b2b37=_0x500ba1;_0x40e427=0xc8;}else{_0x40e427=0xce;}_0x46ef93['status'](_0x40e427);return _0x46ef93[_0x28cc('0x21')]('Content-Range',_0x188288+'-'+_0x2b2b37+'/'+_0x500ba1)[_0x28cc('0x1c')](_0x2e83c5);}return null;};}function patchUpdates(_0x3e2be6){return function(_0x3aa913){try{jsonpatch[_0x28cc('0x22')](_0x3aa913,_0x3e2be6,!![]);}catch(_0x91f541){return BPromise[_0x28cc('0x23')](_0x91f541);}return _0x3aa913[_0x28cc('0x24')]();};}function saveUpdates(_0x3c839e,_0x132680){return function(_0x55a9db){if(_0x55a9db){return _0x55a9db[_0x28cc('0x25')](_0x3c839e)['then'](function(_0x362afa){return _0x362afa;});}return null;};}function removeEntity(_0xc54602,_0xe105cc){return function(_0x1e0dc6){if(_0x1e0dc6){return _0x1e0dc6[_0x28cc('0x26')]()[_0x28cc('0x27')](function(){var _0x5029a=_0x1e0dc6['get']({'plain':!![]});var _0xee508a=_0x28cc('0x28');return db[_0x28cc('0x29')][_0x28cc('0x26')]({'where':{'type':_0xee508a,'resourceId':_0x5029a['id']}})[_0x28cc('0x27')](function(){return _0x1e0dc6;});})[_0x28cc('0x27')](function(){_0xc54602[_0x28cc('0x1a')](0xcc)[_0x28cc('0x1b')]();});}};}function handleEntityNotFound(_0x595f4a,_0x43b4e7){return function(_0x599e7e){if(!_0x599e7e){_0x595f4a[_0x28cc('0x19')](0x194);}return _0x599e7e;};}function handleError(_0x206ba9,_0xff7d4c){_0xff7d4c=_0xff7d4c||0x1f4;return function(_0x3a7bbc){logger['error'](_0x3a7bbc[_0x28cc('0x2a')]);if(_0x3a7bbc[_0x28cc('0x2b')]){delete _0x3a7bbc[_0x28cc('0x2b')];}_0x206ba9[_0x28cc('0x1a')](_0xff7d4c)[_0x28cc('0x2c')](_0x3a7bbc);};}exports[_0x28cc('0x2d')]=function(_0xd7c16,_0x232fb2){var _0x15dde6={},_0x459945={},_0x395f1d={'count':0x0,'rows':[]};var _0x2825b7=_[_0x28cc('0x2e')](db[_0x28cc('0x2f')][_0x28cc('0x30')],function(_0x3d1336){return{'name':_0x3d1336['fieldName'],'type':_0x3d1336['type'][_0x28cc('0x31')]};});_0x459945['model']=_[_0x28cc('0x2e')](_0x2825b7,'name');_0x459945[_0x28cc('0x32')]=_[_0x28cc('0x33')](_0xd7c16['query']);_0x459945['filters']=_['intersection'](_0x459945[_0x28cc('0x34')],_0x459945[_0x28cc('0x32')]);_0x15dde6[_0x28cc('0x35')]=_[_0x28cc('0x36')](_0x459945[_0x28cc('0x34')],qs[_0x28cc('0x37')](_0xd7c16['query']['fields']));_0x15dde6['attributes']=_0x15dde6[_0x28cc('0x35')]['length']?_0x15dde6[_0x28cc('0x35')]:_0x459945['model'];if(!_0xd7c16[_0x28cc('0x32')][_0x28cc('0x38')](_0x28cc('0x39'))){_0x15dde6[_0x28cc('0x20')]=qs['limit'](_0xd7c16[_0x28cc('0x32')][_0x28cc('0x20')]);_0x15dde6[_0x28cc('0x1d')]=qs[_0x28cc('0x1d')](_0xd7c16[_0x28cc('0x32')][_0x28cc('0x1d')]);}_0x15dde6[_0x28cc('0x3a')]=qs[_0x28cc('0x3b')](_0xd7c16['query'][_0x28cc('0x3b')]);_0x15dde6[_0x28cc('0x3c')]=qs[_0x28cc('0x3d')](_[_0x28cc('0x3e')](_0xd7c16[_0x28cc('0x32')],_0x459945['filters']),_0x2825b7);if(_0xd7c16[_0x28cc('0x32')][_0x28cc('0x3f')]){_0x15dde6['where']=_['merge'](_0x15dde6[_0x28cc('0x3c')],{'$or':_[_0x28cc('0x2e')](_0x2825b7,function(_0x17c277){if(_0x17c277[_0x28cc('0x40')]!==_0x28cc('0x41')){var _0x177a44={};_0x177a44[_0x17c277[_0x28cc('0x2b')]]={'$like':'%'+_0xd7c16[_0x28cc('0x32')]['filter']+'%'};return _0x177a44;}})});}_0x15dde6=_['merge']({},_0x15dde6,_0xd7c16[_0x28cc('0x42')]);var _0x1f37c0={'where':_0x15dde6[_0x28cc('0x3c')]};return db[_0x28cc('0x2f')]['count'](_0x1f37c0)[_0x28cc('0x27')](function(_0x447fd5){_0x395f1d['count']=_0x447fd5;if(_0xd7c16[_0x28cc('0x32')][_0x28cc('0x43')]){_0x15dde6['include']=[{'all':!![]}];}return db[_0x28cc('0x2f')][_0x28cc('0x44')](_0x15dde6);})['then'](function(_0x1a1356){_0x395f1d['rows']=_0x1a1356;return _0x395f1d;})['then'](respondWithFilteredResult(_0x232fb2,_0x15dde6))[_0x28cc('0x45')](handleError(_0x232fb2,null));};exports['show']=function(_0xc34b34,_0x4cd729){var _0x3814a4={'raw':!![],'where':{'id':_0xc34b34[_0x28cc('0x46')]['id']}},_0x49cb76={};_0x49cb76[_0x28cc('0x34')]=_[_0x28cc('0x33')](db[_0x28cc('0x2f')][_0x28cc('0x30')]);_0x49cb76[_0x28cc('0x32')]=_[_0x28cc('0x33')](_0xc34b34[_0x28cc('0x32')]);_0x49cb76[_0x28cc('0x3d')]=_[_0x28cc('0x36')](_0x49cb76['model'],_0x49cb76[_0x28cc('0x32')]);_0x3814a4['attributes']=_[_0x28cc('0x36')](_0x49cb76['model'],qs[_0x28cc('0x37')](_0xc34b34[_0x28cc('0x32')][_0x28cc('0x37')]));_0x3814a4[_0x28cc('0x35')]=_0x3814a4[_0x28cc('0x35')][_0x28cc('0x47')]?_0x3814a4['attributes']:_0x49cb76['model'];if(_0xc34b34['query'][_0x28cc('0x43')]){_0x3814a4[_0x28cc('0x48')]=[{'all':!![]}];}_0x3814a4=_[_0x28cc('0x49')]({},_0x3814a4,_0xc34b34['options']);return db[_0x28cc('0x2f')][_0x28cc('0x4a')](_0x3814a4)[_0x28cc('0x27')](handleEntityNotFound(_0x4cd729,null))[_0x28cc('0x27')](respondWithResult(_0x4cd729,null))[_0x28cc('0x45')](handleError(_0x4cd729,null));};exports[_0x28cc('0x4b')]=function(_0x42d732,_0x502522){return db['Disposition'][_0x28cc('0x4b')](_0x42d732[_0x28cc('0x4c')],{})[_0x28cc('0x27')](function(_0x4769fd){var _0xe49dd6=_0x42d732[_0x28cc('0x4d')][_0x28cc('0x4e')]({'plain':!![]});if(!_0xe49dd6)throw new Error(_0x28cc('0x4f'));if(_0xe49dd6[_0x28cc('0x50')]==='user'){var _0x2fe6f0=_0x4769fd[_0x28cc('0x4e')]({'plain':!![]});var _0x4ab6ee=_0x28cc('0x28');return db[_0x28cc('0x51')]['find']({'where':{'name':_0x4ab6ee,'userProfileId':_0xe49dd6[_0x28cc('0x52')]},'raw':!![]})[_0x28cc('0x27')](function(_0x35e806){if(_0x35e806&&_0x35e806[_0x28cc('0x53')]===0x0){return db[_0x28cc('0x29')][_0x28cc('0x4b')]({'name':_0x2fe6f0[_0x28cc('0x2b')],'resourceId':_0x2fe6f0['id'],'type':_0x35e806[_0x28cc('0x2b')],'sectionId':_0x35e806['id']},{})[_0x28cc('0x27')](function(){return _0x4769fd;});}else{return _0x4769fd;}})[_0x28cc('0x45')](function(_0x379b94){logger[_0x28cc('0x54')](_0x28cc('0x55'),_0x379b94);throw _0x379b94;});}return _0x4769fd;})['then'](respondWithResult(_0x502522,0xc9))['catch'](handleError(_0x502522,null));};exports[_0x28cc('0x25')]=function(_0xaa6241,_0x5e25f5){if(_0xaa6241[_0x28cc('0x4c')]['id']){delete _0xaa6241[_0x28cc('0x4c')]['id'];}return db[_0x28cc('0x2f')][_0x28cc('0x4a')]({'where':{'id':_0xaa6241[_0x28cc('0x46')]['id']}})[_0x28cc('0x27')](handleEntityNotFound(_0x5e25f5,null))['then'](saveUpdates(_0xaa6241[_0x28cc('0x4c')],null))['then'](respondWithResult(_0x5e25f5,null))['catch'](handleError(_0x5e25f5,null));};exports[_0x28cc('0x26')]=function(_0x3a8706,_0x3627e9){return db[_0x28cc('0x2f')][_0x28cc('0x4a')]({'where':{'id':_0x3a8706['params']['id']}})['then'](handleEntityNotFound(_0x3627e9,null))['then'](removeEntity(_0x3627e9,null))[_0x28cc('0x45')](handleError(_0x3627e9,null));}; \ No newline at end of file +var _0x00b7=['save','update','then','destroy','Dispositions','end','sendStatus','error','stack','send','index','map','rawAttributes','fieldName','type','key','name','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','Disposition','includeAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x00b7,0x13c));var _0x700b=function(_0x29f1e2,_0xf10647){_0x29f1e2=_0x29f1e2-0x0;var _0x396510=_0x00b7[_0x29f1e2];return _0x396510;};'use strict';var emlformat=require(_0x700b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x700b('0x1'));var jsonpatch=require(_0x700b('0x2'));var rp=require(_0x700b('0x3'));var moment=require(_0x700b('0x4'));var BPromise=require(_0x700b('0x5'));var Mustache=require(_0x700b('0x6'));var util=require(_0x700b('0x7'));var path=require(_0x700b('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x700b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x700b('0xa'));var crypto=require(_0x700b('0xb'));var jsforce=require(_0x700b('0xc'));var deskjs=require(_0x700b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x700b('0xe'));var Papa=require(_0x700b('0xf'));var Redis=require(_0x700b('0x10'));var authService=require(_0x700b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x700b('0x12'));var hardwareService=require(_0x700b('0x13'));var logger=require(_0x700b('0x14'))(_0x700b('0x15'));var utils=require(_0x700b('0x16'));var config=require(_0x700b('0x17'));var licenseUtil=require(_0x700b('0x18'));var db=require(_0x700b('0x19'))['db'];function respondWithStatusCode(_0x474606,_0x47f544){_0x47f544=_0x47f544||0xcc;return function(_0x2574b2){if(_0x2574b2){return _0x474606['sendStatus'](_0x47f544);}return _0x474606[_0x700b('0x1a')](_0x47f544)['end']();};}function respondWithResult(_0x32b97b,_0x36ad0b){_0x36ad0b=_0x36ad0b||0xc8;return function(_0x518f0e){if(_0x518f0e){return _0x32b97b['status'](_0x36ad0b)[_0x700b('0x1b')](_0x518f0e);}};}function respondWithFilteredResult(_0x6413e4,_0x5be4b9){return function(_0x2a2ec7){if(_0x2a2ec7){var _0x5c80c6=typeof _0x5be4b9[_0x700b('0x1c')]===_0x700b('0x1d')&&typeof _0x5be4b9[_0x700b('0x1e')]==='undefined';var _0x3fdfdd=_0x2a2ec7['count'];var _0x422b1a=_0x5c80c6?0x0:_0x5be4b9[_0x700b('0x1c')];var _0x3cc614=_0x5c80c6?_0x2a2ec7[_0x700b('0x1f')]:_0x5be4b9['offset']+_0x5be4b9['limit'];var _0x2b1c05;if(_0x3cc614>=_0x3fdfdd){_0x3cc614=_0x3fdfdd;_0x2b1c05=0xc8;}else{_0x2b1c05=0xce;}_0x6413e4['status'](_0x2b1c05);return _0x6413e4[_0x700b('0x20')](_0x700b('0x21'),_0x422b1a+'-'+_0x3cc614+'/'+_0x3fdfdd)[_0x700b('0x1b')](_0x2a2ec7);}return null;};}function patchUpdates(_0x4a91b3){return function(_0x3d01de){try{jsonpatch[_0x700b('0x22')](_0x3d01de,_0x4a91b3,!![]);}catch(_0x557981){return BPromise[_0x700b('0x23')](_0x557981);}return _0x3d01de[_0x700b('0x24')]();};}function saveUpdates(_0x4d0758,_0x5f33bd){return function(_0x5c9256){if(_0x5c9256){return _0x5c9256[_0x700b('0x25')](_0x4d0758)[_0x700b('0x26')](function(_0x8f0866){return _0x8f0866;});}return null;};}function removeEntity(_0xa60ec8,_0x5f2d86){return function(_0xe123dc){if(_0xe123dc){return _0xe123dc[_0x700b('0x27')]()[_0x700b('0x26')](function(){var _0x54e733=_0xe123dc['get']({'plain':!![]});var _0x27a49d=_0x700b('0x28');return db['UserProfileResource'][_0x700b('0x27')]({'where':{'type':_0x27a49d,'resourceId':_0x54e733['id']}})['then'](function(){return _0xe123dc;});})[_0x700b('0x26')](function(){_0xa60ec8['status'](0xcc)[_0x700b('0x29')]();});}};}function handleEntityNotFound(_0x4ec2c9,_0x44214e){return function(_0x9c5ec6){if(!_0x9c5ec6){_0x4ec2c9[_0x700b('0x2a')](0x194);}return _0x9c5ec6;};}function handleError(_0x550884,_0x43a648){_0x43a648=_0x43a648||0x1f4;return function(_0x5e8b0e){logger[_0x700b('0x2b')](_0x5e8b0e[_0x700b('0x2c')]);if(_0x5e8b0e['name']){delete _0x5e8b0e['name'];}_0x550884[_0x700b('0x1a')](_0x43a648)[_0x700b('0x2d')](_0x5e8b0e);};}exports[_0x700b('0x2e')]=function(_0x58b71f,_0x402f01){var _0x2d5c67={},_0x5c7a30={},_0x2a8ec4={'count':0x0,'rows':[]};var _0x9949df=_[_0x700b('0x2f')](db['Disposition'][_0x700b('0x30')],function(_0x3dd0e3){return{'name':_0x3dd0e3[_0x700b('0x31')],'type':_0x3dd0e3[_0x700b('0x32')][_0x700b('0x33')]};});_0x5c7a30['model']=_[_0x700b('0x2f')](_0x9949df,_0x700b('0x34'));_0x5c7a30['query']=_[_0x700b('0x35')](_0x58b71f[_0x700b('0x36')]);_0x5c7a30[_0x700b('0x37')]=_[_0x700b('0x38')](_0x5c7a30['model'],_0x5c7a30[_0x700b('0x36')]);_0x2d5c67[_0x700b('0x39')]=_[_0x700b('0x38')](_0x5c7a30[_0x700b('0x3a')],qs[_0x700b('0x3b')](_0x58b71f[_0x700b('0x36')][_0x700b('0x3b')]));_0x2d5c67[_0x700b('0x39')]=_0x2d5c67[_0x700b('0x39')][_0x700b('0x3c')]?_0x2d5c67[_0x700b('0x39')]:_0x5c7a30[_0x700b('0x3a')];if(!_0x58b71f[_0x700b('0x36')][_0x700b('0x3d')](_0x700b('0x3e'))){_0x2d5c67[_0x700b('0x1e')]=qs[_0x700b('0x1e')](_0x58b71f[_0x700b('0x36')][_0x700b('0x1e')]);_0x2d5c67[_0x700b('0x1c')]=qs[_0x700b('0x1c')](_0x58b71f['query'][_0x700b('0x1c')]);}_0x2d5c67[_0x700b('0x3f')]=qs[_0x700b('0x40')](_0x58b71f[_0x700b('0x36')][_0x700b('0x40')]);_0x2d5c67['where']=qs[_0x700b('0x37')](_[_0x700b('0x41')](_0x58b71f['query'],_0x5c7a30['filters']),_0x9949df);if(_0x58b71f[_0x700b('0x36')][_0x700b('0x42')]){_0x2d5c67[_0x700b('0x43')]=_['merge'](_0x2d5c67[_0x700b('0x43')],{'$or':_['map'](_0x9949df,function(_0x5d3eb9){if(_0x5d3eb9[_0x700b('0x32')]!==_0x700b('0x44')){var _0x3fc08d={};_0x3fc08d[_0x5d3eb9[_0x700b('0x34')]]={'$like':'%'+_0x58b71f[_0x700b('0x36')][_0x700b('0x42')]+'%'};return _0x3fc08d;}})});}_0x2d5c67=_[_0x700b('0x45')]({},_0x2d5c67,_0x58b71f['options']);var _0xbccd14={'where':_0x2d5c67[_0x700b('0x43')]};return db[_0x700b('0x46')][_0x700b('0x1f')](_0xbccd14)[_0x700b('0x26')](function(_0x5b8225){_0x2a8ec4[_0x700b('0x1f')]=_0x5b8225;if(_0x58b71f[_0x700b('0x36')][_0x700b('0x47')]){_0x2d5c67['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x2d5c67);})[_0x700b('0x26')](function(_0x3161b5){_0x2a8ec4[_0x700b('0x48')]=_0x3161b5;return _0x2a8ec4;})[_0x700b('0x26')](respondWithFilteredResult(_0x402f01,_0x2d5c67))[_0x700b('0x49')](handleError(_0x402f01,null));};exports[_0x700b('0x4a')]=function(_0x2fbeeb,_0x459627){var _0x524a6e={'raw':!![],'where':{'id':_0x2fbeeb[_0x700b('0x4b')]['id']}},_0x2fb190={};_0x2fb190[_0x700b('0x3a')]=_[_0x700b('0x35')](db[_0x700b('0x46')][_0x700b('0x30')]);_0x2fb190[_0x700b('0x36')]=_[_0x700b('0x35')](_0x2fbeeb['query']);_0x2fb190[_0x700b('0x37')]=_['intersection'](_0x2fb190[_0x700b('0x3a')],_0x2fb190['query']);_0x524a6e[_0x700b('0x39')]=_['intersection'](_0x2fb190[_0x700b('0x3a')],qs[_0x700b('0x3b')](_0x2fbeeb[_0x700b('0x36')][_0x700b('0x3b')]));_0x524a6e[_0x700b('0x39')]=_0x524a6e[_0x700b('0x39')][_0x700b('0x3c')]?_0x524a6e[_0x700b('0x39')]:_0x2fb190[_0x700b('0x3a')];if(_0x2fbeeb['query'][_0x700b('0x47')]){_0x524a6e['include']=[{'all':!![]}];}_0x524a6e=_[_0x700b('0x45')]({},_0x524a6e,_0x2fbeeb['options']);return db[_0x700b('0x46')][_0x700b('0x4c')](_0x524a6e)[_0x700b('0x26')](handleEntityNotFound(_0x459627,null))['then'](respondWithResult(_0x459627,null))['catch'](handleError(_0x459627,null));};exports[_0x700b('0x4d')]=function(_0x50bc82,_0x17cb59){return db[_0x700b('0x46')][_0x700b('0x4d')](_0x50bc82['body'],{})['then'](function(_0x4acb64){var _0x24123f=_0x50bc82[_0x700b('0x4e')]['get']({'plain':!![]});if(!_0x24123f)throw new Error(_0x700b('0x4f'));if(_0x24123f[_0x700b('0x50')]===_0x700b('0x4e')){var _0x343f97=_0x4acb64[_0x700b('0x51')]({'plain':!![]});var _0xca538d='Dispositions';return db[_0x700b('0x52')]['find']({'where':{'name':_0xca538d,'userProfileId':_0x24123f[_0x700b('0x53')]},'raw':!![]})['then'](function(_0x13e02d){if(_0x13e02d&&_0x13e02d[_0x700b('0x54')]===0x0){return db[_0x700b('0x55')]['create']({'name':_0x343f97['name'],'resourceId':_0x343f97['id'],'type':_0x13e02d['name'],'sectionId':_0x13e02d['id']},{})[_0x700b('0x26')](function(){return _0x4acb64;});}else{return _0x4acb64;}})[_0x700b('0x49')](function(_0xd09202){logger[_0x700b('0x2b')](_0x700b('0x56'),_0xd09202);throw _0xd09202;});}return _0x4acb64;})[_0x700b('0x26')](respondWithResult(_0x17cb59,0xc9))[_0x700b('0x49')](handleError(_0x17cb59,null));};exports[_0x700b('0x25')]=function(_0x3d6fcf,_0x2e6282){if(_0x3d6fcf[_0x700b('0x57')]['id']){delete _0x3d6fcf[_0x700b('0x57')]['id'];}return db[_0x700b('0x46')][_0x700b('0x4c')]({'where':{'id':_0x3d6fcf[_0x700b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2e6282,null))[_0x700b('0x26')](saveUpdates(_0x3d6fcf[_0x700b('0x57')],null))[_0x700b('0x26')](respondWithResult(_0x2e6282,null))['catch'](handleError(_0x2e6282,null));};exports['destroy']=function(_0xa120e,_0x143ec0){return db[_0x700b('0x46')][_0x700b('0x4c')]({'where':{'id':_0xa120e[_0x700b('0x4b')]['id']}})[_0x700b('0x26')](handleEntityNotFound(_0x143ec0,null))[_0x700b('0x26')](removeEntity(_0x143ec0,null))['catch'](handleError(_0x143ec0,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index a614cfe..10ec2ad 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 _0xed63=['exports','define','tools_dispositions','name_voice','name','ListId','name_mail','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash','api','bluebird','request-promise','path','rimraf','./disposition.attributes'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xed63,0xe0));var _0x3ed6=function(_0x29bbc4,_0x254c27){_0x29bbc4=_0x29bbc4-0x0;var _0x52fefa=_0xed63[_0x29bbc4];return _0x52fefa;};'use strict';var _=require(_0x3ed6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3ed6('0x1'));var moment=require('moment');var BPromise=require(_0x3ed6('0x2'));var rp=require(_0x3ed6('0x3'));var fs=require('fs');var path=require(_0x3ed6('0x4'));var rimraf=require(_0x3ed6('0x5'));var config=require('../../config/environment');var attributes=require(_0x3ed6('0x6'));module[_0x3ed6('0x7')]=function(_0x4b4148,_0x46a411){return _0x4b4148[_0x3ed6('0x8')]('Disposition',attributes,{'tableName':_0x3ed6('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x3ed6('0xa'),'fields':[_0x3ed6('0xb'),_0x3ed6('0xc')]},{'unique':!![],'name':'name_chat','fields':[_0x3ed6('0xb'),'ChatWebsiteId']},{'unique':!![],'name':_0x3ed6('0xd'),'fields':[_0x3ed6('0xb'),'MailAccountId']},{'unique':!![],'name':_0x3ed6('0xe'),'fields':[_0x3ed6('0xb'),_0x3ed6('0xf')]},{'unique':!![],'name':_0x3ed6('0x10'),'fields':[_0x3ed6('0xb'),_0x3ed6('0x11')]},{'unique':!![],'name':_0x3ed6('0x12'),'fields':[_0x3ed6('0xb'),_0x3ed6('0x13')]},{'unique':!![],'name':_0x3ed6('0x14'),'fields':['name','WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa01e=['Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api','request-promise','rimraf','./disposition.attributes','exports','define'];(function(_0x55cba9,_0x57c9d7){var _0x3ca03b=function(_0x3d8e96){while(--_0x3d8e96){_0x55cba9['push'](_0x55cba9['shift']());}};_0x3ca03b(++_0x57c9d7);}(_0xa01e,0x1f2));var _0xea01=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa01e[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0xea01('0x0'));var util=require('util');var logger=require(_0xea01('0x1'))(_0xea01('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xea01('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea01('0x4'));var config=require('../../config/environment');var attributes=require(_0xea01('0x5'));module[_0xea01('0x6')]=function(_0x2d0fe7,_0x4dd906){return _0x2d0fe7[_0xea01('0x7')](_0xea01('0x8'),attributes,{'tableName':_0xea01('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xea01('0xa'),'fields':[_0xea01('0xb'),_0xea01('0xc')]},{'unique':!![],'name':_0xea01('0xd'),'fields':[_0xea01('0xb'),_0xea01('0xe')]},{'unique':!![],'name':_0xea01('0xf'),'fields':['name',_0xea01('0x10')]},{'unique':!![],'name':'name_sms','fields':['name',_0xea01('0x11')]},{'unique':!![],'name':'name_fax','fields':[_0xea01('0xb'),_0xea01('0x12')]},{'unique':!![],'name':_0xea01('0x13'),'fields':['name',_0xea01('0x14')]},{'unique':!![],'name':_0xea01('0x15'),'fields':[_0xea01('0xb'),_0xea01('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 3ef0081..f0aa979 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(_0x18b544,_0x2e73f2){var _0x5ba98=function(_0x3482b9){while(--_0x3482b9){_0x18b544['push'](_0x18b544['shift']());}};_0x5ba98(++_0x2e73f2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x341c71,_0x3a3300){var _0x3e9131=function(_0x44badf){while(--_0x44badf){_0x341c71['push'](_0x341c71['shift']());}};_0x3e9131(++_0x3a3300);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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 a05389b..327a6a7 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 _0x3c84=['../../components/auth/service','../../config/environment','./disposition.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','fs-extra'];(function(_0x3b5561,_0x55773c){var _0x5e8d83=function(_0x375177){while(--_0x375177){_0x3b5561['push'](_0x3b5561['shift']());}};_0x5e8d83(++_0x55773c);}(_0x3c84,0x151));var _0x43c8=function(_0x514cd3,_0x4072fb){_0x514cd3=_0x514cd3-0x0;var _0x41d430=_0x3c84[_0x514cd3];return _0x41d430;};'use strict';var multer=require('multer');var util=require(_0x43c8('0x0'));var path=require(_0x43c8('0x1'));var timeout=require(_0x43c8('0x2'));var express=require(_0x43c8('0x3'));var router=express['Router']();var fs_extra=require(_0x43c8('0x4'));var auth=require(_0x43c8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x43c8('0x6'));var controller=require(_0x43c8('0x7'));router['get']('/',auth[_0x43c8('0x8')](),controller[_0x43c8('0x9')]);router[_0x43c8('0xa')](_0x43c8('0xb'),auth['isAuthenticated'](),controller[_0x43c8('0xc')]);router[_0x43c8('0xd')]('/',auth[_0x43c8('0x8')](),controller[_0x43c8('0xe')]);router[_0x43c8('0xf')]('/:id',auth[_0x43c8('0x8')](),controller[_0x43c8('0x10')]);router[_0x43c8('0x11')](_0x43c8('0xb'),auth[_0x43c8('0x8')](),controller['destroy']);module[_0x43c8('0x12')]=router; \ No newline at end of file +var _0x1d4d=['index','post','/:id','exports','multer','path','connect-timeout','Router','fs-extra','../../config/environment','./disposition.controller','get','isAuthenticated'];(function(_0xfe7033,_0x123a96){var _0x190f75=function(_0x18e8f4){while(--_0x18e8f4){_0xfe7033['push'](_0xfe7033['shift']());}};_0x190f75(++_0x123a96);}(_0x1d4d,0x1a4));var _0xd1d4=function(_0x43d50f,_0x1a5ec3){_0x43d50f=_0x43d50f-0x0;var _0xd30928=_0x1d4d[_0x43d50f];return _0xd30928;};'use strict';var multer=require(_0xd1d4('0x0'));var util=require('util');var path=require(_0xd1d4('0x1'));var timeout=require(_0xd1d4('0x2'));var express=require('express');var router=express[_0xd1d4('0x3')]();var fs_extra=require(_0xd1d4('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd1d4('0x5'));var controller=require(_0xd1d4('0x6'));router[_0xd1d4('0x7')]('/',auth[_0xd1d4('0x8')](),controller[_0xd1d4('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xd1d4('0xa')]('/',auth[_0xd1d4('0x8')](),controller['create']);router['put']('/:id',auth[_0xd1d4('0x8')](),controller['update']);router['delete'](_0xd1d4('0xb'),auth[_0xd1d4('0x8')](),controller['destroy']);module[_0xd1d4('0xc')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 4f4cd00..fe5dc99 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 _0xf7b8=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','9600','12000','7200','14400','v17,v27,v29','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf7b8,0xa0));var _0x8f7b=function(_0x44f0da,_0x11cd4b){_0x44f0da=_0x44f0da-0x0;var _0x39ddb8=_0xf7b8[_0x44f0da];return _0x39ddb8;};'use strict';var Sequelize=require(_0x8f7b('0x0'));module[_0x8f7b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8f7b('0x2')]},'ecm':{'type':Sequelize[_0x8f7b('0x3')](_0x8f7b('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x8f7b('0x2')],'defaultValue':_0x8f7b('0x5')},'localstationid':{'type':Sequelize[_0x8f7b('0x2')],'unique':_0x8f7b('0x6')},'minrate':{'type':Sequelize[_0x8f7b('0x3')](_0x8f7b('0x7'),_0x8f7b('0x8'),'7200',_0x8f7b('0x9'),_0x8f7b('0xa'),'14400'),'defaultValue':_0x8f7b('0x8')},'maxrate':{'type':Sequelize['ENUM'](_0x8f7b('0x7'),_0x8f7b('0x8'),_0x8f7b('0xb'),_0x8f7b('0x9'),'12000',_0x8f7b('0xc')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x8f7b('0x2')],'defaultValue':_0x8f7b('0xd')},'gateway':{'type':Sequelize[_0x8f7b('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x8f7b('0x3')](_0x8f7b('0xe'),_0x8f7b('0xf'),_0x8f7b('0x10'),_0x8f7b('0x11')),'defaultValue':_0x8f7b('0xe')},'key':{'type':Sequelize[_0x8f7b('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x8f7b('0x12')],'defaultValue':function(){return _0x8f7b('0x13');}},'notificationSound':{'type':Sequelize[_0x8f7b('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8f7b('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8f7b('0x15')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8f7b('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8f7b('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8f7b('0x15')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8f7b('0x15')],'allowNull':!![],'defaultValue':null,'comment':_0x8f7b('0x16')},'mandatoryDisposition':{'type':Sequelize[_0x8f7b('0x14')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1cb031){if(!_0x1cb031)this[_0x8f7b('0x17')](_0x8f7b('0x18'),null);this[_0x8f7b('0x17')](_0x8f7b('0x19'),_0x1cb031);}}}; \ No newline at end of file +var _0x5d19=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','yes','xCALLY\x20Motion\x20Fax','ENUM','2400','4800','7200','12000','14400','v17,v27,v29','INTEGER','SIP','KHOMP','TEXT'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x5d19,0x1a9));var _0x95d1=function(_0x4f35f4,_0x51a8c3){_0x4f35f4=_0x4f35f4-0x0;var _0x2e9a70=_0x5d19[_0x4f35f4];return _0x2e9a70;};'use strict';var Sequelize=require(_0x95d1('0x0'));module[_0x95d1('0x1')]={'name':{'type':Sequelize[_0x95d1('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x95d1('0x2')]},'ecm':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x95d1('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x95d1('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x95d1('0x5')](_0x95d1('0x6'),_0x95d1('0x7'),_0x95d1('0x8'),'9600',_0x95d1('0x9'),_0x95d1('0xa')),'defaultValue':_0x95d1('0x7')},'maxrate':{'type':Sequelize['ENUM'](_0x95d1('0x6'),'4800',_0x95d1('0x8'),'9600',_0x95d1('0x9'),_0x95d1('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x95d1('0xb')},'gateway':{'type':Sequelize[_0x95d1('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x95d1('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x95d1('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x95d1('0x5')](_0x95d1('0xd'),'IAX','DADHI',_0x95d1('0xe')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x95d1('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x95d1('0xf')],'defaultValue':function(){return _0x95d1('0x10');}},'notificationSound':{'type':Sequelize[_0x95d1('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x95d1('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x95d1('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x95d1('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x95d1('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x95d1('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x95d1('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1293ed){if(!_0x1293ed)this[_0x95d1('0x13')](_0x95d1('0x14'),null);this[_0x95d1('0x13')]('mandatoryDisposition',_0x1293ed);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 112d7ad..99de6b2 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 _0x52c5=['info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','FaxAccounts','UserProfileResource','stack','name','Pause','mandatoryDispositionPause','map','FaxAccount','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','params','rawAttributes','options','find','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','getDispositions','Disposition','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addInteraction','omit','order','FaxInteraction','CmContact','User','Owner','fullname','internal','Tag','Tags','tag','transaction','FaxApplication','priority','getApplications','context','from-voip-provider','exten','localstationid','app','system','Fax\x20Extension','appdata','push','Answer','Set','ecm','gateway','faxdetect','headerinfo','maxrate','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','ReceiveFax','sequelize','bulkCreate','VoiceExtension','tech','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','send','List','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http'];(function(_0x1bc320,_0x3e43b5){var _0x4f5b7d=function(_0x49f3a6){while(--_0x49f3a6){_0x1bc320['push'](_0x1bc320['shift']());}};_0x4f5b7d(++_0x3e43b5);}(_0x52c5,0x160));var _0x552c=function(_0x4f35f4,_0x51a8c3){_0x4f35f4=_0x4f35f4-0x0;var _0x2e9a70=_0x52c5[_0x4f35f4];return _0x2e9a70;};'use strict';var emlformat=require(_0x552c('0x0'));var rimraf=require(_0x552c('0x1'));var zipdir=require(_0x552c('0x2'));var jsonpatch=require(_0x552c('0x3'));var rp=require(_0x552c('0x4'));var moment=require(_0x552c('0x5'));var BPromise=require(_0x552c('0x6'));var Mustache=require('mustache');var util=require(_0x552c('0x7'));var path=require(_0x552c('0x8'));var sox=require(_0x552c('0x9'));var csv=require(_0x552c('0xa'));var ejs=require(_0x552c('0xb'));var fs=require('fs');var fs_extra=require(_0x552c('0xc'));var _=require(_0x552c('0xd'));var squel=require(_0x552c('0xe'));var crypto=require(_0x552c('0xf'));var jsforce=require(_0x552c('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x552c('0xa'));var querystring=require(_0x552c('0x11'));var Papa=require(_0x552c('0x12'));var Redis=require(_0x552c('0x13'));var authService=require(_0x552c('0x14'));var qs=require(_0x552c('0x15'));var as=require(_0x552c('0x16'));var hardwareService=require(_0x552c('0x17'));var logger=require(_0x552c('0x18'))(_0x552c('0x19'));var utils=require(_0x552c('0x1a'));var config=require(_0x552c('0x1b'));var licenseUtil=require(_0x552c('0x1c'));var db=require(_0x552c('0x1d'))['db'];config[_0x552c('0x1e')]=_[_0x552c('0x1f')](config[_0x552c('0x1e')],{'host':'localhost','port':0x18eb});var socket=require(_0x552c('0x20'))(new Redis(config[_0x552c('0x1e')]));require(_0x552c('0x21'))[_0x552c('0x22')](socket);var jayson=require(_0x552c('0x23'));var client=jayson[_0x552c('0x24')]['http']({'port':0x232c});var client9002=jayson[_0x552c('0x24')][_0x552c('0x25')]({'port':0x232a});function respondWithRpcPromise(_0x423016,_0x1cf396,_0x55b653,_0x11a555){return new BPromise(function(_0x1e615c,_0x56052f){var _0x4262aa=_0x11a555||client;return _0x4262aa['request'](_0x423016,_0x55b653)['then'](function(_0x43dd99){logger[_0x552c('0x26')](_0x552c('0x27'),_0x1cf396,_0x552c('0x28'));logger[_0x552c('0x29')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x1cf396,_0x552c('0x28'),JSON[_0x552c('0x2a')](_0x43dd99));if(_0x43dd99[_0x552c('0x2b')]){if(_0x43dd99['error'][_0x552c('0x2c')]===0x1f4){logger[_0x552c('0x2b')](_0x552c('0x27'),_0x1cf396,_0x43dd99[_0x552c('0x2b')][_0x552c('0x2d')]);return _0x56052f(_0x43dd99[_0x552c('0x2b')][_0x552c('0x2d')]);}logger[_0x552c('0x2b')](_0x552c('0x27'),_0x1cf396,_0x43dd99[_0x552c('0x2b')][_0x552c('0x2d')]);return _0x1e615c(_0x43dd99[_0x552c('0x2b')][_0x552c('0x2d')]);}else{logger[_0x552c('0x26')]('FaxAccount,\x20%s,\x20%s',_0x1cf396,_0x552c('0x28'));_0x1e615c(_0x43dd99[_0x552c('0x2e')]['message']);}})[_0x552c('0x2f')](function(_0x289b00){logger[_0x552c('0x2b')]('FaxAccount,\x20%s,\x20%s',_0x1cf396,_0x289b00);_0x56052f(_0x289b00);});});}function respondWithStatusCode(_0x5b0fc8,_0x515ece){_0x515ece=_0x515ece||0xcc;return function(_0x3b893d){if(_0x3b893d){return _0x5b0fc8[_0x552c('0x30')](_0x515ece);}return _0x5b0fc8[_0x552c('0x31')](_0x515ece)[_0x552c('0x32')]();};}function respondWithResult(_0x3c1343,_0x2465d9){_0x2465d9=_0x2465d9||0xc8;return function(_0x5401fe){if(_0x5401fe){return _0x3c1343[_0x552c('0x31')](_0x2465d9)[_0x552c('0x33')](_0x5401fe);}};}function respondWithFilteredResult(_0x42216d,_0x9d5431){return function(_0x1a1dbb){if(_0x1a1dbb){var _0x22b53a=typeof _0x9d5431[_0x552c('0x34')]===_0x552c('0x35')&&typeof _0x9d5431[_0x552c('0x36')]===_0x552c('0x35');var _0x7f8c8f=_0x1a1dbb[_0x552c('0x37')];var _0xc5a3fa=_0x22b53a?0x0:_0x9d5431[_0x552c('0x34')];var _0x990a77=_0x22b53a?_0x1a1dbb['count']:_0x9d5431[_0x552c('0x34')]+_0x9d5431['limit'];var _0x1ffc27;if(_0x990a77>=_0x7f8c8f){_0x990a77=_0x7f8c8f;_0x1ffc27=0xc8;}else{_0x1ffc27=0xce;}_0x42216d['status'](_0x1ffc27);return _0x42216d[_0x552c('0x38')]('Content-Range',_0xc5a3fa+'-'+_0x990a77+'/'+_0x7f8c8f)[_0x552c('0x33')](_0x1a1dbb);}return null;};}function patchUpdates(_0x4b72d7){return function(_0x41ae9a){try{jsonpatch[_0x552c('0x39')](_0x41ae9a,_0x4b72d7,!![]);}catch(_0x245652){return BPromise[_0x552c('0x3a')](_0x245652);}return _0x41ae9a['save']();};}function saveUpdates(_0x348684,_0x37a711){return function(_0x14d8e0){if(_0x14d8e0){return _0x14d8e0[_0x552c('0x3b')](_0x348684)[_0x552c('0x3c')](function(_0x3eb21b){return _0x3eb21b;});}return null;};}function removeEntity(_0x167203,_0x13ad92){return function(_0x40d8e7){if(_0x40d8e7){return _0x40d8e7[_0x552c('0x3d')]()[_0x552c('0x3c')](function(){var _0x35f790=_0x40d8e7['get']({'plain':!![]});var _0x3cb50e=_0x552c('0x3e');return db[_0x552c('0x3f')][_0x552c('0x3d')]({'where':{'type':_0x3cb50e,'resourceId':_0x35f790['id']}})[_0x552c('0x3c')](function(){return _0x40d8e7;});})[_0x552c('0x3c')](function(){_0x167203[_0x552c('0x31')](0xcc)[_0x552c('0x32')]();});}};}function handleEntityNotFound(_0xb3ba82,_0x30eb6d){return function(_0x137c66){if(!_0x137c66){_0xb3ba82[_0x552c('0x30')](0x194);}return _0x137c66;};}function handleError(_0x326901,_0x20afc5){_0x20afc5=_0x20afc5||0x1f4;return function(_0x21bffa){logger[_0x552c('0x2b')](_0x21bffa[_0x552c('0x40')]);if(_0x21bffa[_0x552c('0x41')]){delete _0x21bffa['name'];}_0x326901['status'](_0x20afc5)['send'](_0x21bffa);};}exports['index']=function(_0xbf55f1,_0x1f50fa){var _0x2adf27={'include':[{'model':db[_0x552c('0x42')],'as':_0x552c('0x43')}]},_0x498af9={},_0x4e0870={'count':0x0,'rows':[]};var _0x4a6343=_[_0x552c('0x44')](db[_0x552c('0x45')]['rawAttributes'],function(_0x5baa33){return{'name':_0x5baa33[_0x552c('0x46')],'type':_0x5baa33[_0x552c('0x47')]['key']};});_0x498af9[_0x552c('0x48')]=_[_0x552c('0x44')](_0x4a6343,_0x552c('0x41'));_0x498af9[_0x552c('0x49')]=_[_0x552c('0x4a')](_0xbf55f1[_0x552c('0x49')]);_0x498af9[_0x552c('0x4b')]=_[_0x552c('0x4c')](_0x498af9[_0x552c('0x48')],_0x498af9[_0x552c('0x49')]);_0x2adf27[_0x552c('0x4d')]=_[_0x552c('0x4c')](_0x498af9[_0x552c('0x48')],qs[_0x552c('0x4e')](_0xbf55f1[_0x552c('0x49')][_0x552c('0x4e')]));_0x2adf27[_0x552c('0x4d')]=_0x2adf27['attributes'][_0x552c('0x4f')]?_0x2adf27['attributes']:_0x498af9[_0x552c('0x48')];if(!_0xbf55f1[_0x552c('0x49')][_0x552c('0x50')](_0x552c('0x51'))){_0x2adf27[_0x552c('0x36')]=qs[_0x552c('0x36')](_0xbf55f1[_0x552c('0x49')][_0x552c('0x36')]);_0x2adf27[_0x552c('0x34')]=qs['offset'](_0xbf55f1[_0x552c('0x49')][_0x552c('0x34')]);}_0x2adf27['order']=qs[_0x552c('0x52')](_0xbf55f1[_0x552c('0x49')][_0x552c('0x52')]);_0x2adf27[_0x552c('0x53')]=qs[_0x552c('0x4b')](_[_0x552c('0x54')](_0xbf55f1['query'],_0x498af9[_0x552c('0x4b')]),_0x4a6343);if(_0xbf55f1[_0x552c('0x49')][_0x552c('0x55')]){_0x2adf27[_0x552c('0x53')]=_[_0x552c('0x56')](_0x2adf27[_0x552c('0x53')],{'$or':_[_0x552c('0x44')](_0x4a6343,function(_0xd18908){if(_0xd18908[_0x552c('0x47')]!=='VIRTUAL'){var _0x5dce6b={};_0x5dce6b[_0xd18908[_0x552c('0x41')]]={'$like':'%'+_0xbf55f1['query'][_0x552c('0x55')]+'%'};return _0x5dce6b;}})});}_0x2adf27=_['merge']({},_0x2adf27,_0xbf55f1['options']);var _0x52b7cf={'where':_0x2adf27['where']};return db['FaxAccount'][_0x552c('0x37')](_0x52b7cf)['then'](function(_0x1000ec){_0x4e0870['count']=_0x1000ec;if(_0xbf55f1[_0x552c('0x49')][_0x552c('0x57')]){_0x2adf27[_0x552c('0x58')]=[{'all':!![]}];}return db[_0x552c('0x45')][_0x552c('0x59')](_0x2adf27);})[_0x552c('0x3c')](function(_0x14b970){_0x4e0870[_0x552c('0x5a')]=_0x14b970;return _0x4e0870;})['then'](respondWithFilteredResult(_0x1f50fa,_0x2adf27))[_0x552c('0x2f')](handleError(_0x1f50fa,null));};exports['show']=function(_0x4877e2,_0x431d6f){var _0xd55b70={'raw':![],'where':{'id':_0x4877e2[_0x552c('0x5b')]['id']},'include':[{'model':db[_0x552c('0x42')],'as':_0x552c('0x43')}]},_0x446dca={};_0x446dca[_0x552c('0x48')]=_[_0x552c('0x4a')](db['FaxAccount'][_0x552c('0x5c')]);_0x446dca[_0x552c('0x49')]=_[_0x552c('0x4a')](_0x4877e2[_0x552c('0x49')]);_0x446dca[_0x552c('0x4b')]=_['intersection'](_0x446dca[_0x552c('0x48')],_0x446dca['query']);_0xd55b70[_0x552c('0x4d')]=_['intersection'](_0x446dca[_0x552c('0x48')],qs['fields'](_0x4877e2[_0x552c('0x49')][_0x552c('0x4e')]));_0xd55b70[_0x552c('0x4d')]=_0xd55b70[_0x552c('0x4d')][_0x552c('0x4f')]?_0xd55b70[_0x552c('0x4d')]:_0x446dca['model'];if(_0x4877e2['query'][_0x552c('0x57')]){_0xd55b70[_0x552c('0x58')]=[{'all':!![]}];}_0xd55b70=_[_0x552c('0x56')]({},_0xd55b70,_0x4877e2[_0x552c('0x5d')]);return db[_0x552c('0x45')][_0x552c('0x5e')](_0xd55b70)[_0x552c('0x3c')](handleEntityNotFound(_0x431d6f,null))['then'](respondWithResult(_0x431d6f,null))[_0x552c('0x2f')](handleError(_0x431d6f,null));};exports[_0x552c('0x5f')]=function(_0xfb735c,_0x11e858){return db[_0x552c('0x45')][_0x552c('0x5f')](_0xfb735c[_0x552c('0x60')],{})[_0x552c('0x3c')](function(_0x13770e){var _0x5ab787=_0xfb735c[_0x552c('0x61')][_0x552c('0x62')]({'plain':!![]});if(!_0x5ab787)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ab787['role']===_0x552c('0x61')){var _0x4a0828=_0x13770e['get']({'plain':!![]});var _0x358cb6='FaxAccounts';return db[_0x552c('0x63')][_0x552c('0x5e')]({'where':{'name':_0x358cb6,'userProfileId':_0x5ab787[_0x552c('0x64')]},'raw':!![]})[_0x552c('0x3c')](function(_0x1556f8){if(_0x1556f8&&_0x1556f8[_0x552c('0x65')]===0x0){return db[_0x552c('0x3f')]['create']({'name':_0x4a0828[_0x552c('0x41')],'resourceId':_0x4a0828['id'],'type':_0x1556f8[_0x552c('0x41')],'sectionId':_0x1556f8['id']},{})['then'](function(){return _0x13770e;});}else{return _0x13770e;}})['catch'](function(_0x1ba5ac){logger[_0x552c('0x2b')](_0x552c('0x66'),_0x1ba5ac);throw _0x1ba5ac;});}return _0x13770e;})['then'](respondWithResult(_0x11e858,0xc9))['catch'](handleError(_0x11e858,null));};exports['update']=function(_0x32a1ed,_0x1fa7af){if(_0x32a1ed['body']['id']){delete _0x32a1ed[_0x552c('0x60')]['id'];}return db[_0x552c('0x45')][_0x552c('0x5e')]({'where':{'id':_0x32a1ed['params']['id']},'include':[{'model':db[_0x552c('0x42')],'as':_0x552c('0x43')}]})[_0x552c('0x3c')](handleEntityNotFound(_0x1fa7af,null))['then'](saveUpdates(_0x32a1ed[_0x552c('0x60')],null))[_0x552c('0x3c')](respondWithResult(_0x1fa7af,null))[_0x552c('0x2f')](handleError(_0x1fa7af,null));};exports[_0x552c('0x3d')]=function(_0x49f021,_0x3c63f1){return db['FaxAccount'][_0x552c('0x5e')]({'where':{'id':_0x49f021[_0x552c('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3c63f1,null))['then'](removeEntity(_0x3c63f1,null))['catch'](handleError(_0x3c63f1,null));};exports[_0x552c('0x67')]=function(_0x5d057b,_0x435950){return db[_0x552c('0x45')][_0x552c('0x67')]()['then'](respondWithResult(_0x435950,null))[_0x552c('0x2f')](handleError(_0x435950,null));};exports[_0x552c('0x68')]=function(_0xc8847f,_0x5dc314,_0x5e9700){if(_0xc8847f[_0x552c('0x60')]['id']){delete _0xc8847f[_0x552c('0x60')]['id'];}return db[_0x552c('0x45')][_0x552c('0x5e')]({'where':{'id':_0xc8847f[_0x552c('0x5b')]['id']}})[_0x552c('0x3c')](handleEntityNotFound(_0x5dc314,null))['then'](function(_0x18c856){if(_0x18c856){_0xc8847f[_0x552c('0x60')][_0x552c('0x69')]=_0x18c856['id'];return db['Disposition'][_0x552c('0x5f')](_0xc8847f[_0x552c('0x60')]);}})['then'](respondWithResult(_0x5dc314,null))[_0x552c('0x2f')](handleError(_0x5dc314,null));};exports[_0x552c('0x6a')]=function(_0x19dc3e,_0x6b9a93,_0x45d4ac){var _0x179c92={'raw':![],'where':{}};var _0x3e6f1a={};var _0x49a30b={'count':0x0,'rows':[]};return db[_0x552c('0x45')]['findOne']({'where':{'id':_0x19dc3e['params']['id']}})[_0x552c('0x3c')](handleEntityNotFound(_0x6b9a93,null))[_0x552c('0x3c')](function(_0x374e48){if(_0x374e48){_0x3e6f1a['model']=_[_0x552c('0x4a')](db['Disposition'][_0x552c('0x5c')]);_0x3e6f1a[_0x552c('0x49')]=_[_0x552c('0x4a')](_0x19dc3e[_0x552c('0x49')]);_0x3e6f1a[_0x552c('0x4b')]=_[_0x552c('0x4c')](_0x3e6f1a[_0x552c('0x48')],_0x3e6f1a[_0x552c('0x49')]);_0x179c92[_0x552c('0x4d')]=_['intersection'](_0x3e6f1a[_0x552c('0x48')],qs[_0x552c('0x4e')](_0x19dc3e[_0x552c('0x49')][_0x552c('0x4e')]));_0x179c92['attributes']=_0x179c92[_0x552c('0x4d')]['length']?_0x179c92['attributes']:_0x3e6f1a[_0x552c('0x48')];if(!_0x19dc3e[_0x552c('0x49')][_0x552c('0x50')](_0x552c('0x51'))){_0x179c92[_0x552c('0x36')]=qs['limit'](_0x19dc3e[_0x552c('0x49')][_0x552c('0x36')]);_0x179c92['offset']=qs[_0x552c('0x34')](_0x19dc3e[_0x552c('0x49')][_0x552c('0x34')]);}_0x179c92['order']=qs['sort'](_0x19dc3e[_0x552c('0x49')][_0x552c('0x52')]);_0x179c92['where']=qs[_0x552c('0x4b')](_[_0x552c('0x54')](_0x19dc3e[_0x552c('0x49')],_0x3e6f1a[_0x552c('0x4b')]));_0x179c92['where'][_0x552c('0x69')]=_0x374e48['id'];if(_0x19dc3e[_0x552c('0x49')][_0x552c('0x55')]){_0x179c92[_0x552c('0x53')]=_[_0x552c('0x56')](_0x179c92[_0x552c('0x53')],{'$or':_[_0x552c('0x44')](_0x179c92[_0x552c('0x4d')],function(_0x4203ee){var _0x42336a={};_0x42336a[_0x4203ee]={'$like':'%'+_0x19dc3e[_0x552c('0x49')][_0x552c('0x55')]+'%'};return _0x42336a;})});}_0x179c92=_[_0x552c('0x56')]({},_0x179c92,_0x19dc3e[_0x552c('0x5d')]);return db[_0x552c('0x6b')]['count']({'where':_0x179c92[_0x552c('0x53')]})[_0x552c('0x3c')](function(_0x27b8ce){_0x49a30b[_0x552c('0x37')]=_0x27b8ce;if(_0x19dc3e[_0x552c('0x49')][_0x552c('0x57')]){_0x179c92[_0x552c('0x58')]=[{'all':!![]}];}return db[_0x552c('0x6b')][_0x552c('0x59')](_0x179c92);})[_0x552c('0x3c')](function(_0x4b0c5d){_0x49a30b['rows']=_0x4b0c5d;return _0x49a30b;});}})[_0x552c('0x3c')](respondWithFilteredResult(_0x6b9a93,_0x179c92))[_0x552c('0x2f')](handleError(_0x6b9a93,null));};exports['removeDispositions']=function(_0x522169,_0x4fa825,_0x1551f3){return db['FaxAccount'][_0x552c('0x5e')]({'where':{'id':_0x522169[_0x552c('0x5b')]['id']}})[_0x552c('0x3c')](handleEntityNotFound(_0x4fa825,null))[_0x552c('0x3c')](function(_0x1fb99e){if(_0x1fb99e){return _0x1fb99e['removeDispositions'](_0x522169[_0x552c('0x49')][_0x552c('0x6c')]);}})[_0x552c('0x3c')](respondWithStatusCode(_0x4fa825,null))[_0x552c('0x2f')](handleError(_0x4fa825,null));};exports[_0x552c('0x6d')]=function(_0x5e5c0c,_0x4cf3f0,_0x1898e4){if(_0x5e5c0c[_0x552c('0x60')]['id']){delete _0x5e5c0c[_0x552c('0x60')]['id'];}return db['FaxAccount'][_0x552c('0x5e')]({'where':{'id':_0x5e5c0c[_0x552c('0x5b')]['id']}})[_0x552c('0x3c')](handleEntityNotFound(_0x4cf3f0,null))[_0x552c('0x3c')](function(_0x1828b2){if(_0x1828b2){_0x5e5c0c[_0x552c('0x60')][_0x552c('0x69')]=_0x1828b2['id'];return db[_0x552c('0x6e')][_0x552c('0x5f')](_0x5e5c0c[_0x552c('0x60')]);}})[_0x552c('0x3c')](respondWithResult(_0x4cf3f0,null))[_0x552c('0x2f')](handleError(_0x4cf3f0,null));};exports[_0x552c('0x6f')]=function(_0x442158,_0x3bb618,_0x201737){var _0x198b32={'raw':![],'where':{}};var _0x4e6fd1={};var _0x24781c={'count':0x0,'rows':[]};return db[_0x552c('0x45')][_0x552c('0x70')]({'where':{'id':_0x442158[_0x552c('0x5b')]['id']}})[_0x552c('0x3c')](handleEntityNotFound(_0x3bb618,null))['then'](function(_0x3e2d8){if(_0x3e2d8){_0x4e6fd1[_0x552c('0x48')]=_['keys'](db['CannedAnswer'][_0x552c('0x5c')]);_0x4e6fd1[_0x552c('0x49')]=_[_0x552c('0x4a')](_0x442158[_0x552c('0x49')]);_0x4e6fd1[_0x552c('0x4b')]=_[_0x552c('0x4c')](_0x4e6fd1[_0x552c('0x48')],_0x4e6fd1[_0x552c('0x49')]);_0x198b32[_0x552c('0x4d')]=_[_0x552c('0x4c')](_0x4e6fd1['model'],qs[_0x552c('0x4e')](_0x442158['query']['fields']));_0x198b32['attributes']=_0x198b32[_0x552c('0x4d')][_0x552c('0x4f')]?_0x198b32[_0x552c('0x4d')]:_0x4e6fd1[_0x552c('0x48')];if(!_0x442158[_0x552c('0x49')]['hasOwnProperty'](_0x552c('0x51'))){_0x198b32[_0x552c('0x36')]=qs[_0x552c('0x36')](_0x442158[_0x552c('0x49')][_0x552c('0x36')]);_0x198b32[_0x552c('0x34')]=qs[_0x552c('0x34')](_0x442158['query'][_0x552c('0x34')]);}_0x198b32['order']=qs[_0x552c('0x52')](_0x442158[_0x552c('0x49')][_0x552c('0x52')]);_0x198b32['where']=qs[_0x552c('0x4b')](_[_0x552c('0x54')](_0x442158[_0x552c('0x49')],_0x4e6fd1[_0x552c('0x4b')]));_0x198b32[_0x552c('0x53')][_0x552c('0x69')]=_0x3e2d8['id'];if(_0x442158[_0x552c('0x49')][_0x552c('0x55')]){_0x198b32[_0x552c('0x53')]=_[_0x552c('0x56')](_0x198b32['where'],{'$or':_[_0x552c('0x44')](_0x198b32[_0x552c('0x4d')],function(_0x4d5800){var _0x27e3b7={};_0x27e3b7[_0x4d5800]={'$like':'%'+_0x442158[_0x552c('0x49')][_0x552c('0x55')]+'%'};return _0x27e3b7;})});}_0x198b32=_['merge']({},_0x198b32,_0x442158[_0x552c('0x5d')]);return db[_0x552c('0x6e')][_0x552c('0x37')]({'where':_0x198b32[_0x552c('0x53')]})[_0x552c('0x3c')](function(_0x218e9a){_0x24781c[_0x552c('0x37')]=_0x218e9a;if(_0x442158[_0x552c('0x49')]['includeAll']){_0x198b32[_0x552c('0x58')]=[{'all':!![]}];}return db[_0x552c('0x6e')][_0x552c('0x59')](_0x198b32);})[_0x552c('0x3c')](function(_0x5709dd){_0x24781c[_0x552c('0x5a')]=_0x5709dd;return _0x24781c;});}})[_0x552c('0x3c')](respondWithFilteredResult(_0x3bb618,_0x198b32))[_0x552c('0x2f')](handleError(_0x3bb618,null));};exports[_0x552c('0x71')]=function(_0x5ddb6d,_0x3f3aa8,_0x390bb2){return db[_0x552c('0x45')][_0x552c('0x5e')]({'where':{'id':_0x5ddb6d[_0x552c('0x5b')]['id']}})[_0x552c('0x3c')](handleEntityNotFound(_0x3f3aa8,null))[_0x552c('0x3c')](function(_0x4fda65){if(_0x4fda65){return _0x4fda65[_0x552c('0x71')](_0x5ddb6d[_0x552c('0x49')][_0x552c('0x6c')]);}})[_0x552c('0x3c')](respondWithStatusCode(_0x3f3aa8,null))['catch'](handleError(_0x3f3aa8,null));};exports[_0x552c('0x72')]=function(_0x5ab09c,_0x3d7469,_0x33d52){return db['FaxInteraction'][_0x552c('0x5e')]({'where':{'id':_0x5ab09c[_0x552c('0x5b')]['id']}})[_0x552c('0x3c')](handleEntityNotFound(_0x3d7469,null))[_0x552c('0x3c')](function(_0x28be04){if(_0x28be04){return _0x28be04[_0x552c('0x72')](_0x5ab09c['body']['ids'],_[_0x552c('0x73')](_0x5ab09c[_0x552c('0x60')],[_0x552c('0x6c'),'id'])||{});}})[_0x552c('0x3c')](respondWithResult(_0x3d7469,null))['catch'](handleError(_0x3d7469,null));};exports['getInteractions']=function(_0x21da6a,_0x3374f5,_0x3477b5){var _0x559127={'raw':![],'where':{}};var _0x2d6354={};var _0x482851={'count':0x0,'rows':[]};return db['FaxAccount'][_0x552c('0x70')]({'where':{'id':_0x21da6a[_0x552c('0x5b')]['id']}})[_0x552c('0x3c')](handleEntityNotFound(_0x3374f5,null))[_0x552c('0x3c')](function(_0x2bd563){if(_0x2bd563){_0x2d6354['model']=_[_0x552c('0x4a')](db['FaxInteraction'][_0x552c('0x5c')]);_0x2d6354['query']=_['keys'](_0x21da6a[_0x552c('0x49')]);_0x2d6354[_0x552c('0x4b')]=_['intersection'](_0x2d6354['model'],_0x2d6354[_0x552c('0x49')]);_0x559127['attributes']=_[_0x552c('0x4c')](_0x2d6354[_0x552c('0x48')],qs[_0x552c('0x4e')](_0x21da6a[_0x552c('0x49')][_0x552c('0x4e')]));_0x559127[_0x552c('0x4d')]=_0x559127[_0x552c('0x4d')][_0x552c('0x4f')]?_0x559127[_0x552c('0x4d')]:_0x2d6354[_0x552c('0x48')];if(!_0x21da6a[_0x552c('0x49')][_0x552c('0x50')](_0x552c('0x51'))){_0x559127[_0x552c('0x36')]=qs[_0x552c('0x36')](_0x21da6a[_0x552c('0x49')][_0x552c('0x36')]);_0x559127['offset']=qs['offset'](_0x21da6a[_0x552c('0x49')][_0x552c('0x34')]);}_0x559127[_0x552c('0x74')]=qs[_0x552c('0x52')](_0x21da6a[_0x552c('0x49')][_0x552c('0x52')]);_0x559127[_0x552c('0x53')]=qs['filters'](_['pick'](_0x21da6a[_0x552c('0x49')],_0x2d6354[_0x552c('0x4b')]));_0x559127['where'][_0x552c('0x69')]=_0x2bd563['id'];if(_0x21da6a['query'][_0x552c('0x55')]){_0x559127['where']=_[_0x552c('0x56')](_0x559127[_0x552c('0x53')],{'$or':_[_0x552c('0x44')](_0x559127[_0x552c('0x4d')],function(_0x3b2c39){var _0x42d17f={};_0x42d17f[_0x3b2c39]={'$like':'%'+_0x21da6a[_0x552c('0x49')][_0x552c('0x55')]+'%'};return _0x42d17f;})});}_0x559127=_['merge']({},_0x559127,_0x21da6a[_0x552c('0x5d')]);return db[_0x552c('0x75')][_0x552c('0x37')]({'where':_0x559127[_0x552c('0x53')]})[_0x552c('0x3c')](function(_0x42389d){_0x482851[_0x552c('0x37')]=_0x42389d;if(_0x21da6a[_0x552c('0x49')][_0x552c('0x57')]){_0x559127['include']=[{'model':db[_0x552c('0x76')],'as':'Contact','required':![]},{'model':db[_0x552c('0x77')],'as':_0x552c('0x78'),'attributes':[_0x552c('0x41'),_0x552c('0x79'),_0x552c('0x7a')],'required':![]},{'model':db[_0x552c('0x7b')],'as':_0x552c('0x7c'),'attributes':['id',_0x552c('0x41'),'color'],'where':_0x21da6a[_0x552c('0x49')][_0x552c('0x7d')]?{'id':_0x21da6a['query']['tag']}:undefined,'required':_0x21da6a['query'][_0x552c('0x7d')]?!![]:![]}];}return db[_0x552c('0x75')][_0x552c('0x59')](_0x559127);})['then'](function(_0x54dc2d){_0x482851[_0x552c('0x5a')]=_0x54dc2d;return _0x482851;});}})['then'](respondWithFilteredResult(_0x3374f5,_0x559127))[_0x552c('0x2f')](handleError(_0x3374f5,null));};exports['addApplications']=function(_0x114e92,_0x5d6889,_0x2f365b){return db[_0x552c('0x45')][_0x552c('0x70')]({'where':{'id':_0x114e92[_0x552c('0x5b')]['id']}})[_0x552c('0x3c')](handleEntityNotFound(_0x5d6889,null))['then'](function(_0x2a830a){if(_0x2a830a){return db['sequelize'][_0x552c('0x7e')](function(_0x121a3c){return db[_0x552c('0x7f')][_0x552c('0x3d')]({'where':{'FaxAccountId':_0x114e92[_0x552c('0x5b')]['id']},'transaction':_0x121a3c})[_0x552c('0x3c')](function(_0x14058e){var _0xf63792=_['map'](_0x114e92[_0x552c('0x60')],function(_0x2c968d){_0x2c968d[_0x552c('0x69')]=_0x114e92[_0x552c('0x5b')]['id'];return _0x2c968d;});return db[_0x552c('0x7f')]['bulkCreate'](_0xf63792,{'transaction':_0x121a3c});});})['then'](function(){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x114e92[_0x552c('0x5b')]['id']},'order':_0x552c('0x80')});});}})[_0x552c('0x3c')](respondWithResult(_0x5d6889,null))[_0x552c('0x2f')](handleError(_0x5d6889,null));};exports[_0x552c('0x81')]=function(_0x5b4291,_0x1246ce,_0x4be854){var _0x31a05b={};var _0x45741e={};var _0x5f5ccb;var _0x2b7bba;return db['FaxAccount'][_0x552c('0x70')]({'where':{'id':_0x5b4291[_0x552c('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1246ce,null))[_0x552c('0x3c')](function(_0x5da39b){if(_0x5da39b){_0x5f5ccb=_0x5da39b;_0x45741e[_0x552c('0x48')]=_['keys'](db[_0x552c('0x7f')][_0x552c('0x5c')]);_0x45741e[_0x552c('0x49')]=_['keys'](_0x5b4291[_0x552c('0x49')]);_0x45741e[_0x552c('0x4b')]=_[_0x552c('0x4c')](_0x45741e[_0x552c('0x48')],_0x45741e['query']);_0x31a05b[_0x552c('0x4d')]=_[_0x552c('0x4c')](_0x45741e[_0x552c('0x48')],qs[_0x552c('0x4e')](_0x5b4291[_0x552c('0x49')]['fields']));_0x31a05b[_0x552c('0x4d')]=_0x31a05b[_0x552c('0x4d')][_0x552c('0x4f')]?_0x31a05b['attributes']:_0x45741e['model'];_0x31a05b[_0x552c('0x74')]=qs['sort'](_0x5b4291[_0x552c('0x49')][_0x552c('0x52')]);_0x31a05b[_0x552c('0x53')]=qs[_0x552c('0x4b')](_['pick'](_0x5b4291[_0x552c('0x49')],_0x45741e[_0x552c('0x4b')]));if(_0x5b4291['query']['filter']){_0x31a05b[_0x552c('0x53')]=_['merge'](_0x31a05b[_0x552c('0x53')],{'$or':_[_0x552c('0x44')](_0x31a05b[_0x552c('0x4d')],function(_0x3c3cc2){var _0x4d918f={};_0x4d918f[_0x3c3cc2]={'$like':'%'+_0x5b4291[_0x552c('0x49')][_0x552c('0x55')]+'%'};return _0x4d918f;})});}_0x31a05b=_['merge']({},_0x31a05b,_0x5b4291[_0x552c('0x5d')]);return _0x5f5ccb[_0x552c('0x81')](_0x31a05b);}})[_0x552c('0x3c')](function(_0x1e82cd){if(_0x1e82cd){_0x2b7bba=_0x1e82cd[_0x552c('0x4f')];if(!_0x5b4291[_0x552c('0x49')]['hasOwnProperty'](_0x552c('0x51'))){_0x31a05b['limit']=qs[_0x552c('0x36')](_0x5b4291[_0x552c('0x49')][_0x552c('0x36')]);_0x31a05b[_0x552c('0x34')]=qs['offset'](_0x5b4291[_0x552c('0x49')][_0x552c('0x34')]);}return _0x5f5ccb[_0x552c('0x81')](_0x31a05b);}})['then'](function(_0x57a34c){if(_0x57a34c){return _0x57a34c?{'count':_0x2b7bba,'rows':_0x57a34c}:null;}})[_0x552c('0x3c')](respondWithResult(_0x1246ce,null))['catch'](handleError(_0x1246ce,null));};function Extension(_0x7e4e35,_0x204b73,_0x1b6ede,_0x37466d){this[_0x552c('0x82')]=_0x552c('0x83');this[_0x552c('0x84')]=_0x7e4e35[_0x552c('0x85')];this[_0x552c('0x86')]=_0x37466d;this[_0x552c('0x47')]=_0x552c('0x87');this['description']=_0x552c('0x88');this[_0x552c('0x69')]=_0x7e4e35['id'];this[_0x552c('0x80')]=_0x204b73;this[_0x552c('0x89')]=_0x1b6ede;}function createExtensionsReciveFax(_0x5396da){var _0x17012e=0x1;var _0x189586=[];_0x189586[_0x552c('0x8a')](new Extension(_0x5396da,_0x17012e,'',_0x552c('0x8b')));_0x17012e+=0x1;_0x189586[_0x552c('0x8a')](new Extension(_0x5396da,_0x17012e,'CDR(type)=inbound-fax',_0x552c('0x8c')));_0x17012e+=0x1;for(var _0x351e3c in _0x5396da){if(_0x5396da[_0x552c('0x50')](_0x351e3c)&&(_0x351e3c===_0x552c('0x8d')||_0x351e3c===_0x552c('0x85')||_0x351e3c===_0x552c('0x8e')||_0x351e3c===_0x552c('0x8f')||_0x351e3c===_0x552c('0x90')||_0x351e3c===_0x552c('0x91')||_0x351e3c===_0x552c('0x92')||_0x351e3c===_0x552c('0x93')||_0x351e3c===_0x552c('0x94'))){_0x189586['push'](new Extension(_0x5396da,_0x17012e,'FAXOPT('+_0x351e3c+')='+_0x5396da[_0x351e3c],_0x552c('0x8c')));_0x17012e+=0x1;}}_0x189586[_0x552c('0x8a')](new Extension(_0x5396da,_0x17012e,'6',_0x552c('0x95')));_0x17012e+=0x1;_0x189586[_0x552c('0x8a')](new Extension(_0x5396da,_0x17012e,_0x552c('0x96'),_0x552c('0x97')));_0x17012e=0x0;return _0x189586;}exports['addAccountApplications']=function(_0x4a1c7a,_0x22a599,_0x320715){var _0x31ad31;return db[_0x552c('0x98')][_0x552c('0x7e')](function(_0x43713f){return db[_0x552c('0x45')]['create'](_0x4a1c7a[_0x552c('0x60')],{'transaction':_0x43713f})[_0x552c('0x3c')](function(_0x56f81d){_0x31ad31=_0x56f81d['get']({'plain':!![]});return db['VoiceExtension'][_0x552c('0x99')](createExtensionsReciveFax(_0x31ad31),{'transaction':_0x43713f});});})['then'](function(){return _0x31ad31;})[_0x552c('0x3c')](respondWithResult(_0x22a599,null))[_0x552c('0x2f')](handleError(_0x22a599,null));};exports['updateAccountApplications']=function(_0x21344d,_0x3f59a7,_0x10722d){var _0x420f35;return db[_0x552c('0x98')][_0x552c('0x7e')](function(_0x104146){return db[_0x552c('0x45')][_0x552c('0x3b')](_0x21344d['body'],{'where':{'id':_0x21344d['body']['id']},'transaction':_0x104146})['then'](function(_0x28c8f5){return db[_0x552c('0x9a')][_0x552c('0x3d')]({'where':{'FaxAccountId':_0x21344d['body']['id']},'transaction':_0x104146})[_0x552c('0x3c')](function(_0x31a77f){return db[_0x552c('0x9a')]['bulkCreate'](createExtensionsReciveFax(_[_0x552c('0x73')](_0x21344d[_0x552c('0x60')],[_0x552c('0x9b'),'key',_0x552c('0x9c'),_0x552c('0x9d'),_0x552c('0x9e'),'ListId'])),{'transaction':_0x104146});});});})[_0x552c('0x3c')](function(){return db[_0x552c('0x45')][_0x552c('0x9f')](_0x21344d['body']['id']);})[_0x552c('0x3c')](respondWithResult(_0x3f59a7,null))[_0x552c('0x2f')](handleError(_0x3f59a7,null));};exports[_0x552c('0xa0')]=function(_0x2b5d07,_0x3b229a,_0x397b99){var _0x330887={'raw':!![],'where':{}};var _0x4464a8={};var _0x30d761={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x2b5d07[_0x552c('0x5b')]['id']}})[_0x552c('0x3c')](handleEntityNotFound(_0x3b229a,null))[_0x552c('0x3c')](function(_0x57e8fe){if(_0x57e8fe){_0x4464a8[_0x552c('0x48')]=_[_0x552c('0x4a')](db[_0x552c('0xa1')][_0x552c('0x5c')]);_0x4464a8[_0x552c('0x49')]=_[_0x552c('0x4a')](_0x2b5d07[_0x552c('0x49')]);_0x4464a8['filters']=_[_0x552c('0x4c')](_0x4464a8['model'],_0x4464a8[_0x552c('0x49')]);_0x330887[_0x552c('0x4d')]=_['intersection'](_0x4464a8['model'],qs[_0x552c('0x4e')](_0x2b5d07[_0x552c('0x49')][_0x552c('0x4e')]));_0x330887[_0x552c('0x4d')]=_0x330887['attributes'][_0x552c('0x4f')]?_0x330887[_0x552c('0x4d')]:_0x4464a8[_0x552c('0x48')];if(!_0x2b5d07[_0x552c('0x49')][_0x552c('0x50')](_0x552c('0x51'))){_0x330887[_0x552c('0x36')]=qs[_0x552c('0x36')](_0x2b5d07[_0x552c('0x49')]['limit']);_0x330887[_0x552c('0x34')]=qs['offset'](_0x2b5d07[_0x552c('0x49')][_0x552c('0x34')]);}_0x330887[_0x552c('0x74')]=qs[_0x552c('0x52')](_0x2b5d07['query'][_0x552c('0x52')]);_0x330887[_0x552c('0x53')]=qs['filters'](_[_0x552c('0x54')](_0x2b5d07['query'],_0x4464a8[_0x552c('0x4b')]));_0x330887[_0x552c('0x53')]['FaxAccountId']=_0x57e8fe['id'];if(_0x2b5d07[_0x552c('0x49')][_0x552c('0x55')]){_0x330887[_0x552c('0x53')]=_[_0x552c('0x56')](_0x330887['where'],{'$or':_['map'](_0x330887['attributes'],function(_0x16bbde){var _0x10a4cd={};_0x10a4cd[_0x16bbde]={'$like':'%'+_0x2b5d07[_0x552c('0x49')][_0x552c('0x55')]+'%'};return _0x10a4cd;})});}if(_0x2b5d07[_0x552c('0x49')][_0x552c('0xa2')]){var _0x19ab9f=_0x2b5d07['query'][_0x552c('0xa2')][_0x552c('0xa3')](',');var _0x132148={};_0x132148[_0x19ab9f[0x0]]={'$gte':moment(_0x19ab9f[0x1])[_0x552c('0xa4')](_0x552c('0xa5'))};_0x330887[_0x552c('0x53')]=_['merge'](_0x330887[_0x552c('0x53')],_0x132148);}_0x330887=_[_0x552c('0x56')]({},_0x330887,_0x2b5d07['options']);return db[_0x552c('0xa1')][_0x552c('0x37')]({'where':_0x330887[_0x552c('0x53')]})['then'](function(_0x3652c6){_0x30d761[_0x552c('0x37')]=_0x3652c6;if(_0x2b5d07[_0x552c('0x49')][_0x552c('0x57')]){_0x330887[_0x552c('0x58')]=[{'all':!![]}];}return db[_0x552c('0xa1')]['findAll'](_0x330887);})[_0x552c('0x3c')](function(_0x1bc04f){_0x30d761[_0x552c('0x5a')]=_0x1bc04f;return _0x30d761;});}})[_0x552c('0x3c')](respondWithFilteredResult(_0x3b229a,_0x330887))['catch'](handleError(_0x3b229a,null));};exports[_0x552c('0xa6')]=function(_0xfff6bc,_0x2d95e9,_0x3fb9d1){var _0x313766,_0x4c30aa={},_0x4351e2;if(_0xfff6bc[_0x552c('0x60')]['to']){_0x4351e2=_0xfff6bc[_0x552c('0x60')]['to'][0x0];}return db[_0x552c('0x45')]['find']({'where':{'id':_0xfff6bc[_0x552c('0x5b')]['id']},'include':[{'model':db['CmList'],'as':_0x552c('0xa7'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'fax':_0x4351e2},'limit':0x1,'order':[[_0x552c('0x9d'),_0x552c('0xa8')]]}]}]})[_0x552c('0x3c')](handleEntityNotFound(_0x2d95e9,null))['then'](function(_0x52195e){_0x313766=_0x52195e;if(_0xfff6bc[_0x552c('0x60')][_0x552c('0xa9')]&&_0xfff6bc[_0x552c('0x60')][_0x552c('0xa9')][_0x552c('0x4f')]){for(var _0x4bae34=0x0;_0x4bae34<_0xfff6bc[_0x552c('0x60')]['attachments']['length'];_0x4bae34+=0x1){_0xfff6bc[_0x552c('0x60')][_0x552c('0xa9')][_0x4bae34]={'filename':_0xfff6bc['body'][_0x552c('0xa9')][_0x4bae34][_0x552c('0x41')],'id':_0xfff6bc['body'][_0x552c('0xa9')][_0x4bae34]['id'],'path':path[_0x552c('0xaa')](config['root'],_0x552c('0xab'),_0xfff6bc[_0x552c('0x60')][_0x552c('0xa9')][_0x4bae34][_0x552c('0xac')])};}}return respondWithRpcPromise(_0x552c('0xad'),_0x552c('0xad'),{'FaxAccountId':_[_0x552c('0xae')](_0xfff6bc[_0x552c('0x5b')]['id'])?undefined:_0xfff6bc[_0x552c('0x5b')]['id'],'path':_[_0x552c('0xae')](_0xfff6bc[_0x552c('0x60')][_0x552c('0xa9')][0x0][_0x552c('0x8')])?undefined:_0xfff6bc[_0x552c('0x60')]['attachments'][0x0][_0x552c('0x8')],'fax':_[_0x552c('0xae')](_0xfff6bc['body']['to'][0x0])?undefined:_0xfff6bc[_0x552c('0x60')]['to'][0x0]},client9002);})[_0x552c('0x3c')](function(){if(_0x313766){if(_[_0x552c('0xae')](_0xfff6bc[_0x552c('0x60')][_0x552c('0xaf')])){_0xfff6bc['body'][_0x552c('0xaf')]=util[_0x552c('0xa4')](_0x552c('0xb0'),_0x313766[_0x552c('0x41')],_0x313766[_0x552c('0xb1')]);}if(_0x313766[_0x552c('0xa7')]){if(_0x313766['List'][_0x552c('0xb2')][_0x552c('0x4f')]){return _0x313766[_0x552c('0xa7')]['Contacts'][0x0];}else{return db[_0x552c('0x76')][_0x552c('0x5f')](_['defaults'](_0xfff6bc[_0x552c('0x60')],{'firstName':_0xfff6bc[_0x552c('0x60')]['to'][0x0],'phone':_0xfff6bc['body']['to'][0x0],'fax':_0xfff6bc[_0x552c('0x60')]['to'][0x0],'ListId':_0x313766['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x552c('0xb3'));}})['then'](function(_0x521e1a){if(_0x521e1a){return db['FaxInteraction'][_0x552c('0x5e')]({'where':{'ContactId':_0x521e1a['id'],'closed':![],'FaxAccountId':_0x313766['id']}})[_0x552c('0x3c')](function(_0x5291bf){if(_0x5291bf){return[_0x5291bf,![]];}return db[_0x552c('0x75')]['create']({'UserId':_0xfff6bc[_0x552c('0x61')]['id'],'ContactId':_0x521e1a['id'],'FaxAccountId':_0x313766['id'],'fax':_0xfff6bc[_0x552c('0x60')]['to'][0x0],'firstMsgDirection':_0x552c('0xb4'),'Messages':[_[_0x552c('0x56')](_0xfff6bc[_0x552c('0x60')],{'read':![],'body':_0xfff6bc['body']['attachments'][0x0][_0x552c('0xb5')],'FaxAccountId':_0x313766['id'],'UserId':_0xfff6bc[_0x552c('0x61')]['id'],'ContactId':_0x521e1a['id'],'AttachmentId':_0xfff6bc[_0x552c('0x60')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x552c('0xa1')],'as':_0x552c('0xb6')}]})[_0x552c('0x3c')](function(_0x1579a8){return[_0x1579a8,!![]];});});}else{throw new Error(_0x552c('0xb7'));}})[_0x552c('0xb8')](function(_0x33fe74,_0x2f4b8d){if(_0x2f4b8d){return _0x33fe74;}return db['FaxMessage'][_0x552c('0x5f')]({'direction':_0x552c('0xb4'),'read':![],'body':_0xfff6bc['body']['attachments'][0x0][_0x552c('0xb5')],'FaxAccountId':_0x313766['id'],'FaxInteractionId':_0x33fe74['id'],'UserId':_0xfff6bc[_0x552c('0x61')]['id'],'ContactId':_0x33fe74[_0x552c('0xb9')],'AttachmentId':_0xfff6bc[_0x552c('0x60')][_0x552c('0xa9')][0x0]['id']})[_0x552c('0x3c')](function(_0x1bd069){_0x33fe74[_0x552c('0xba')][_0x552c('0xb6')]=[];_0x33fe74[_0x552c('0xba')][_0x552c('0xb6')][_0x552c('0x8a')](_0x1bd069[_0x552c('0xba')]);return _0x33fe74;});})['then'](function(_0x50c658){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0x552c('0xae')](_0xfff6bc[_0x552c('0x5b')]['id'])?undefined:_0xfff6bc[_0x552c('0x5b')]['id'],'path':_['isNil'](_0xfff6bc['body'][_0x552c('0xa9')][0x0][_0x552c('0x8')])?undefined:_0xfff6bc[_0x552c('0x60')][_0x552c('0xa9')][0x0]['path'],'fax':_['isNil'](_0xfff6bc['body']['to'][0x0])?undefined:_0xfff6bc[_0x552c('0x60')]['to'][0x0],'AttachmentId':_0xfff6bc[_0x552c('0x60')][_0x552c('0xa9')][0x0]['id']},client9002)[_0x552c('0x3c')](function(_0x488374){logger[_0x552c('0x26')](_0x552c('0xbb'),_0x488374);})[_0x552c('0x2f')](function(_0x311ff8){logger[_0x552c('0x26')]('SendFaxRpc,\x20%s',_0x311ff8);});return _0x50c658;})[_0x552c('0x3c')](respondWithResult(_0x2d95e9,null))[_0x552c('0x2f')](handleError(_0x2d95e9,null));};exports['addAgents']=function(_0x1ab91d,_0x4a5a53,_0x4ec491){return db[_0x552c('0x45')][_0x552c('0x5e')]({'where':{'id':_0x1ab91d[_0x552c('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4a5a53,null))['then'](function(_0x426438){if(_0x426438){return _0x426438[_0x552c('0xbc')](_0x1ab91d[_0x552c('0x60')][_0x552c('0x6c')],_[_0x552c('0x73')](_0x1ab91d['body'],['ids','id'])||{})['spread'](function(_0x4adf8c){for(var _0x558b3d=0x0;_0x558b3d<_0x1ab91d[_0x552c('0x60')][_0x552c('0x6c')][_0x552c('0x4f')];_0x558b3d+=0x1){socket[_0x552c('0xbd')](_0x552c('0xbe'),{'UserId':Number(_0x1ab91d['body'][_0x552c('0x6c')][_0x558b3d]),'FaxAccountId':Number(_0x1ab91d['params']['id'])});}return _0x4adf8c;});}})[_0x552c('0x3c')](respondWithResult(_0x4a5a53,null))[_0x552c('0x2f')](handleError(_0x4a5a53,null));};exports['removeAgents']=function(_0x5c9d77,_0x18fea8,_0x4020b2){return db[_0x552c('0x45')][_0x552c('0x5e')]({'where':{'id':_0x5c9d77[_0x552c('0x5b')]['id']}})[_0x552c('0x3c')](handleEntityNotFound(_0x18fea8,null))[_0x552c('0x3c')](function(_0x444492){if(_0x444492){return _0x444492[_0x552c('0xbf')](_0x5c9d77['query']['ids'])[_0x552c('0x3c')](function(){if(_[_0x552c('0xc0')](_0x5c9d77[_0x552c('0x49')][_0x552c('0x6c')])){for(var _0x446f7d=0x0;_0x446f7d<_0x5c9d77[_0x552c('0x49')][_0x552c('0x6c')][_0x552c('0x4f')];_0x446f7d+=0x1){socket['emit'](_0x552c('0xc1'),{'UserId':Number(_0x5c9d77[_0x552c('0x49')][_0x552c('0x6c')][_0x446f7d]),'FaxAccountId':Number(_0x5c9d77[_0x552c('0x5b')]['id'])});}}else{socket[_0x552c('0xbd')]('userFaxAccount:remove',{'UserId':Number(_0x5c9d77[_0x552c('0x49')][_0x552c('0x6c')]),'FaxAccountId':Number(_0x5c9d77[_0x552c('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x18fea8,null))[_0x552c('0x2f')](handleError(_0x18fea8,null));};exports[_0x552c('0xc2')]=function(_0x3d1947,_0x3aea87,_0x257024){var _0x595580={};var _0x118d24={};var _0x3c2baf;var _0x3af542;return db[_0x552c('0x45')][_0x552c('0x70')]({'where':{'id':_0x3d1947[_0x552c('0x5b')]['id']}})[_0x552c('0x3c')](handleEntityNotFound(_0x3aea87,null))[_0x552c('0x3c')](function(_0x572d99){if(_0x572d99){_0x3c2baf=_0x572d99;_0x118d24[_0x552c('0x48')]=_[_0x552c('0x4a')](db['User']['rawAttributes']);_0x118d24[_0x552c('0x49')]=_[_0x552c('0x4a')](_0x3d1947['query']);_0x118d24[_0x552c('0x4b')]=_['intersection'](_0x118d24['model'],_0x118d24[_0x552c('0x49')]);_0x595580['attributes']=_['intersection'](_0x118d24[_0x552c('0x48')],qs[_0x552c('0x4e')](_0x3d1947['query'][_0x552c('0x4e')]));_0x595580[_0x552c('0x4d')]=_0x595580['attributes']['length']?_0x595580[_0x552c('0x4d')]:_0x118d24['model'];_0x595580[_0x552c('0x74')]=qs[_0x552c('0x52')](_0x3d1947[_0x552c('0x49')][_0x552c('0x52')]);_0x595580['where']=qs['filters'](_['pick'](_0x3d1947[_0x552c('0x49')],_0x118d24['filters']));if(_0x3d1947[_0x552c('0x49')][_0x552c('0x55')]){_0x595580['where']=_['merge'](_0x595580['where'],{'$or':_['map'](_0x595580[_0x552c('0x4d')],function(_0x274f7c){var _0x220d8b={};_0x220d8b[_0x274f7c]={'$like':'%'+_0x3d1947[_0x552c('0x49')]['filter']+'%'};return _0x220d8b;})});}_0x595580=_[_0x552c('0x56')]({},_0x595580,_0x3d1947[_0x552c('0x5d')]);return _0x3c2baf[_0x552c('0xc2')](_0x595580);}})[_0x552c('0x3c')](function(_0x5d8950){if(_0x5d8950){_0x3af542=_0x5d8950[_0x552c('0x4f')];if(!_0x3d1947[_0x552c('0x49')]['hasOwnProperty'](_0x552c('0x51'))){_0x595580[_0x552c('0x36')]=qs['limit'](_0x3d1947[_0x552c('0x49')]['limit']);_0x595580['offset']=qs[_0x552c('0x34')](_0x3d1947[_0x552c('0x49')][_0x552c('0x34')]);}return _0x3c2baf[_0x552c('0xc2')](_0x595580);}})[_0x552c('0x3c')](function(_0x577a03){if(_0x577a03){return _0x577a03?{'count':_0x3af542,'rows':_0x577a03}:null;}})['then'](respondWithResult(_0x3aea87,null))[_0x552c('0x2f')](handleError(_0x3aea87,null));}; \ No newline at end of file +var _0xe79f=['crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./faxAccount.socket','register','jayson/promise','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','offset','limit','undefined','count','set','json','apply','reject','destroy','get','FaxAccounts','stack','name','send','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','find','describe','FaxAccountId','Disposition','getDispositions','options','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','order','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','getApplications','context','exten','localstationid','system','description','Fax\x20Extension','priority','push','Answer','CDR(type)=inbound-fax','ecm','gateway','faxdetect','headerinfo','maxrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','tech','createdAt','updatedAt','ListId','findById','getMessages','FaxMessage','$gte','split','format','CmList','CmContact','Contacts','DESC','attachments','root','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','fs-extra','lodash','squel'];(function(_0x14b17b,_0x38d206){var _0xdcd8f2=function(_0x26230b){while(--_0x26230b){_0x14b17b['push'](_0x14b17b['shift']());}};_0xdcd8f2(++_0x38d206);}(_0xe79f,0x181));var _0xfe79=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe79f[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xfe79('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfe79('0x1'));var jsonpatch=require(_0xfe79('0x2'));var rp=require(_0xfe79('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfe79('0x4'));var util=require(_0xfe79('0x5'));var path=require(_0xfe79('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfe79('0x7'));var fs=require('fs');var fs_extra=require(_0xfe79('0x8'));var _=require(_0xfe79('0x9'));var squel=require(_0xfe79('0xa'));var crypto=require(_0xfe79('0xb'));var jsforce=require(_0xfe79('0xc'));var deskjs=require(_0xfe79('0xd'));var toCsv=require(_0xfe79('0xe'));var querystring=require(_0xfe79('0xf'));var Papa=require(_0xfe79('0x10'));var Redis=require(_0xfe79('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfe79('0x12'));var as=require(_0xfe79('0x13'));var hardwareService=require(_0xfe79('0x14'));var logger=require(_0xfe79('0x15'))(_0xfe79('0x16'));var utils=require('../../config/utils');var config=require(_0xfe79('0x17'));var licenseUtil=require(_0xfe79('0x18'));var db=require(_0xfe79('0x19'))['db'];config[_0xfe79('0x1a')]=_['defaults'](config[_0xfe79('0x1a')],{'host':_0xfe79('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfe79('0x1a')]));require(_0xfe79('0x1c'))[_0xfe79('0x1d')](socket);var jayson=require(_0xfe79('0x1e'));var client=jayson[_0xfe79('0x1f')][_0xfe79('0x20')]({'port':0x232c});var client9002=jayson[_0xfe79('0x1f')][_0xfe79('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x172837,_0x53b97e,_0x11afef,_0x3c079f){return new BPromise(function(_0x13944c,_0x597fce){var _0x1cc73f=_0x3c079f||client;return _0x1cc73f['request'](_0x172837,_0x11afef)[_0xfe79('0x21')](function(_0xf969d7){logger[_0xfe79('0x22')](_0xfe79('0x23'),_0x53b97e,_0xfe79('0x24'));logger[_0xfe79('0x25')](_0xfe79('0x26'),_0x53b97e,_0xfe79('0x24'),JSON[_0xfe79('0x27')](_0xf969d7));if(_0xf969d7[_0xfe79('0x28')]){if(_0xf969d7[_0xfe79('0x28')][_0xfe79('0x29')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x53b97e,_0xf969d7['error'][_0xfe79('0x2a')]);return _0x597fce(_0xf969d7[_0xfe79('0x28')][_0xfe79('0x2a')]);}logger[_0xfe79('0x28')]('FaxAccount,\x20%s,\x20%s',_0x53b97e,_0xf969d7[_0xfe79('0x28')][_0xfe79('0x2a')]);return _0x13944c(_0xf969d7['error']['message']);}else{logger[_0xfe79('0x22')](_0xfe79('0x23'),_0x53b97e,_0xfe79('0x24'));_0x13944c(_0xf969d7[_0xfe79('0x2b')]['message']);}})['catch'](function(_0x4b4605){logger[_0xfe79('0x28')](_0xfe79('0x23'),_0x53b97e,_0x4b4605);_0x597fce(_0x4b4605);});});}function respondWithStatusCode(_0x3af1e9,_0xbfc734){_0xbfc734=_0xbfc734||0xcc;return function(_0x1eaccd){if(_0x1eaccd){return _0x3af1e9[_0xfe79('0x2c')](_0xbfc734);}return _0x3af1e9[_0xfe79('0x2d')](_0xbfc734)['end']();};}function respondWithResult(_0x1961e3,_0x3ba8cd){_0x3ba8cd=_0x3ba8cd||0xc8;return function(_0x17eb53){if(_0x17eb53){return _0x1961e3[_0xfe79('0x2d')](_0x3ba8cd)['json'](_0x17eb53);}};}function respondWithFilteredResult(_0x527eef,_0x1dfaca){return function(_0x1f67d0){if(_0x1f67d0){var _0x336a1d=typeof _0x1dfaca[_0xfe79('0x2e')]==='undefined'&&typeof _0x1dfaca[_0xfe79('0x2f')]===_0xfe79('0x30');var _0x42cc54=_0x1f67d0['count'];var _0x519f4d=_0x336a1d?0x0:_0x1dfaca[_0xfe79('0x2e')];var _0x5019d7=_0x336a1d?_0x1f67d0[_0xfe79('0x31')]:_0x1dfaca[_0xfe79('0x2e')]+_0x1dfaca[_0xfe79('0x2f')];var _0x37dd48;if(_0x5019d7>=_0x42cc54){_0x5019d7=_0x42cc54;_0x37dd48=0xc8;}else{_0x37dd48=0xce;}_0x527eef[_0xfe79('0x2d')](_0x37dd48);return _0x527eef[_0xfe79('0x32')]('Content-Range',_0x519f4d+'-'+_0x5019d7+'/'+_0x42cc54)[_0xfe79('0x33')](_0x1f67d0);}return null;};}function patchUpdates(_0x6ab9ae){return function(_0x5cab23){try{jsonpatch[_0xfe79('0x34')](_0x5cab23,_0x6ab9ae,!![]);}catch(_0x4c9cbe){return BPromise[_0xfe79('0x35')](_0x4c9cbe);}return _0x5cab23['save']();};}function saveUpdates(_0x455acb,_0x3b9685){return function(_0x425255){if(_0x425255){return _0x425255['update'](_0x455acb)[_0xfe79('0x21')](function(_0x2b6d19){return _0x2b6d19;});}return null;};}function removeEntity(_0x35d3f0,_0x4f3ed6){return function(_0x111df5){if(_0x111df5){return _0x111df5[_0xfe79('0x36')]()[_0xfe79('0x21')](function(){var _0x17e77b=_0x111df5[_0xfe79('0x37')]({'plain':!![]});var _0x1ecb36=_0xfe79('0x38');return db['UserProfileResource'][_0xfe79('0x36')]({'where':{'type':_0x1ecb36,'resourceId':_0x17e77b['id']}})[_0xfe79('0x21')](function(){return _0x111df5;});})[_0xfe79('0x21')](function(){_0x35d3f0[_0xfe79('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x253901,_0xdad64b){return function(_0x755d4c){if(!_0x755d4c){_0x253901[_0xfe79('0x2c')](0x194);}return _0x755d4c;};}function handleError(_0x59ea0f,_0x2ba333){_0x2ba333=_0x2ba333||0x1f4;return function(_0x11937b){logger[_0xfe79('0x28')](_0x11937b[_0xfe79('0x39')]);if(_0x11937b[_0xfe79('0x3a')]){delete _0x11937b[_0xfe79('0x3a')];}_0x59ea0f[_0xfe79('0x2d')](_0x2ba333)[_0xfe79('0x3b')](_0x11937b);};}exports['index']=function(_0x1a26a5,_0x20a0bd){var _0x44f703={'include':[{'model':db[_0xfe79('0x3c')],'as':_0xfe79('0x3d')}]},_0x15367c={},_0x257781={'count':0x0,'rows':[]};var _0x42bcec=_[_0xfe79('0x3e')](db[_0xfe79('0x3f')][_0xfe79('0x40')],function(_0x5818ec){return{'name':_0x5818ec[_0xfe79('0x41')],'type':_0x5818ec[_0xfe79('0x42')][_0xfe79('0x43')]};});_0x15367c[_0xfe79('0x44')]=_[_0xfe79('0x3e')](_0x42bcec,'name');_0x15367c['query']=_['keys'](_0x1a26a5[_0xfe79('0x45')]);_0x15367c[_0xfe79('0x46')]=_[_0xfe79('0x47')](_0x15367c['model'],_0x15367c[_0xfe79('0x45')]);_0x44f703['attributes']=_[_0xfe79('0x47')](_0x15367c[_0xfe79('0x44')],qs[_0xfe79('0x48')](_0x1a26a5[_0xfe79('0x45')][_0xfe79('0x48')]));_0x44f703[_0xfe79('0x49')]=_0x44f703[_0xfe79('0x49')][_0xfe79('0x4a')]?_0x44f703[_0xfe79('0x49')]:_0x15367c[_0xfe79('0x44')];if(!_0x1a26a5[_0xfe79('0x45')][_0xfe79('0x4b')](_0xfe79('0x4c'))){_0x44f703[_0xfe79('0x2f')]=qs['limit'](_0x1a26a5['query'][_0xfe79('0x2f')]);_0x44f703[_0xfe79('0x2e')]=qs[_0xfe79('0x2e')](_0x1a26a5[_0xfe79('0x45')][_0xfe79('0x2e')]);}_0x44f703['order']=qs[_0xfe79('0x4d')](_0x1a26a5[_0xfe79('0x45')][_0xfe79('0x4d')]);_0x44f703[_0xfe79('0x4e')]=qs[_0xfe79('0x46')](_[_0xfe79('0x4f')](_0x1a26a5[_0xfe79('0x45')],_0x15367c['filters']),_0x42bcec);if(_0x1a26a5['query'][_0xfe79('0x50')]){_0x44f703[_0xfe79('0x4e')]=_[_0xfe79('0x51')](_0x44f703[_0xfe79('0x4e')],{'$or':_['map'](_0x42bcec,function(_0x269615){if(_0x269615['type']!==_0xfe79('0x52')){var _0x25a1fb={};_0x25a1fb[_0x269615['name']]={'$like':'%'+_0x1a26a5[_0xfe79('0x45')]['filter']+'%'};return _0x25a1fb;}})});}_0x44f703=_['merge']({},_0x44f703,_0x1a26a5['options']);var _0x278833={'where':_0x44f703[_0xfe79('0x4e')]};return db[_0xfe79('0x3f')][_0xfe79('0x31')](_0x278833)[_0xfe79('0x21')](function(_0x247a5e){_0x257781[_0xfe79('0x31')]=_0x247a5e;if(_0x1a26a5['query'][_0xfe79('0x53')]){_0x44f703[_0xfe79('0x54')]=[{'all':!![]}];}return db[_0xfe79('0x3f')][_0xfe79('0x55')](_0x44f703);})[_0xfe79('0x21')](function(_0x214891){_0x257781[_0xfe79('0x56')]=_0x214891;return _0x257781;})[_0xfe79('0x21')](respondWithFilteredResult(_0x20a0bd,_0x44f703))[_0xfe79('0x57')](handleError(_0x20a0bd,null));};exports[_0xfe79('0x58')]=function(_0x526933,_0x21b3bb){var _0x5ad4b8={'raw':![],'where':{'id':_0x526933[_0xfe79('0x59')]['id']},'include':[{'model':db[_0xfe79('0x3c')],'as':_0xfe79('0x3d')}]},_0x4a2de2={};_0x4a2de2[_0xfe79('0x44')]=_[_0xfe79('0x5a')](db[_0xfe79('0x3f')]['rawAttributes']);_0x4a2de2[_0xfe79('0x45')]=_[_0xfe79('0x5a')](_0x526933[_0xfe79('0x45')]);_0x4a2de2[_0xfe79('0x46')]=_['intersection'](_0x4a2de2[_0xfe79('0x44')],_0x4a2de2[_0xfe79('0x45')]);_0x5ad4b8[_0xfe79('0x49')]=_[_0xfe79('0x47')](_0x4a2de2[_0xfe79('0x44')],qs[_0xfe79('0x48')](_0x526933[_0xfe79('0x45')][_0xfe79('0x48')]));_0x5ad4b8['attributes']=_0x5ad4b8[_0xfe79('0x49')]['length']?_0x5ad4b8[_0xfe79('0x49')]:_0x4a2de2['model'];if(_0x526933[_0xfe79('0x45')]['includeAll']){_0x5ad4b8['include']=[{'all':!![]}];}_0x5ad4b8=_[_0xfe79('0x51')]({},_0x5ad4b8,_0x526933['options']);return db[_0xfe79('0x3f')]['find'](_0x5ad4b8)[_0xfe79('0x21')](handleEntityNotFound(_0x21b3bb,null))[_0xfe79('0x21')](respondWithResult(_0x21b3bb,null))[_0xfe79('0x57')](handleError(_0x21b3bb,null));};exports[_0xfe79('0x5b')]=function(_0x1342d6,_0x49f458){return db[_0xfe79('0x3f')][_0xfe79('0x5b')](_0x1342d6['body'],{})[_0xfe79('0x21')](function(_0x712730){var _0x4b3a2a=_0x1342d6[_0xfe79('0x5c')][_0xfe79('0x37')]({'plain':!![]});if(!_0x4b3a2a)throw new Error(_0xfe79('0x5d'));if(_0x4b3a2a[_0xfe79('0x5e')]===_0xfe79('0x5c')){var _0x3d2dd7=_0x712730[_0xfe79('0x37')]({'plain':!![]});var _0x50093a=_0xfe79('0x38');return db[_0xfe79('0x5f')]['find']({'where':{'name':_0x50093a,'userProfileId':_0x4b3a2a[_0xfe79('0x60')]},'raw':!![]})[_0xfe79('0x21')](function(_0x1b0f3c){if(_0x1b0f3c&&_0x1b0f3c[_0xfe79('0x61')]===0x0){return db[_0xfe79('0x62')]['create']({'name':_0x3d2dd7[_0xfe79('0x3a')],'resourceId':_0x3d2dd7['id'],'type':_0x1b0f3c[_0xfe79('0x3a')],'sectionId':_0x1b0f3c['id']},{})[_0xfe79('0x21')](function(){return _0x712730;});}else{return _0x712730;}})['catch'](function(_0x27097d){logger[_0xfe79('0x28')](_0xfe79('0x63'),_0x27097d);throw _0x27097d;});}return _0x712730;})[_0xfe79('0x21')](respondWithResult(_0x49f458,0xc9))['catch'](handleError(_0x49f458,null));};exports[_0xfe79('0x64')]=function(_0x2a7071,_0x376ec9){if(_0x2a7071[_0xfe79('0x65')]['id']){delete _0x2a7071['body']['id'];}return db[_0xfe79('0x3f')][_0xfe79('0x66')]({'where':{'id':_0x2a7071[_0xfe79('0x59')]['id']},'include':[{'model':db[_0xfe79('0x3c')],'as':_0xfe79('0x3d')}]})[_0xfe79('0x21')](handleEntityNotFound(_0x376ec9,null))[_0xfe79('0x21')](saveUpdates(_0x2a7071[_0xfe79('0x65')],null))['then'](respondWithResult(_0x376ec9,null))['catch'](handleError(_0x376ec9,null));};exports[_0xfe79('0x36')]=function(_0x50d90d,_0x17bb0c){return db[_0xfe79('0x3f')][_0xfe79('0x66')]({'where':{'id':_0x50d90d[_0xfe79('0x59')]['id']}})[_0xfe79('0x21')](handleEntityNotFound(_0x17bb0c,null))[_0xfe79('0x21')](removeEntity(_0x17bb0c,null))['catch'](handleError(_0x17bb0c,null));};exports[_0xfe79('0x67')]=function(_0x30a6fb,_0x4ef5b0){return db['FaxAccount'][_0xfe79('0x67')]()[_0xfe79('0x21')](respondWithResult(_0x4ef5b0,null))[_0xfe79('0x57')](handleError(_0x4ef5b0,null));};exports['addDisposition']=function(_0x463cb2,_0x3e42cc,_0x56fc0d){if(_0x463cb2['body']['id']){delete _0x463cb2[_0xfe79('0x65')]['id'];}return db[_0xfe79('0x3f')]['find']({'where':{'id':_0x463cb2[_0xfe79('0x59')]['id']}})['then'](handleEntityNotFound(_0x3e42cc,null))[_0xfe79('0x21')](function(_0x1725ef){if(_0x1725ef){_0x463cb2[_0xfe79('0x65')][_0xfe79('0x68')]=_0x1725ef['id'];return db[_0xfe79('0x69')][_0xfe79('0x5b')](_0x463cb2[_0xfe79('0x65')]);}})[_0xfe79('0x21')](respondWithResult(_0x3e42cc,null))[_0xfe79('0x57')](handleError(_0x3e42cc,null));};exports[_0xfe79('0x6a')]=function(_0x8f2b06,_0x20b537,_0x1820c5){var _0x2c6e40={'raw':![],'where':{}};var _0x17be8e={};var _0x2b62a8={'count':0x0,'rows':[]};return db[_0xfe79('0x3f')]['findOne']({'where':{'id':_0x8f2b06[_0xfe79('0x59')]['id']}})[_0xfe79('0x21')](handleEntityNotFound(_0x20b537,null))['then'](function(_0x5b4493){if(_0x5b4493){_0x17be8e[_0xfe79('0x44')]=_[_0xfe79('0x5a')](db[_0xfe79('0x69')][_0xfe79('0x40')]);_0x17be8e[_0xfe79('0x45')]=_[_0xfe79('0x5a')](_0x8f2b06[_0xfe79('0x45')]);_0x17be8e[_0xfe79('0x46')]=_['intersection'](_0x17be8e[_0xfe79('0x44')],_0x17be8e[_0xfe79('0x45')]);_0x2c6e40[_0xfe79('0x49')]=_[_0xfe79('0x47')](_0x17be8e['model'],qs[_0xfe79('0x48')](_0x8f2b06[_0xfe79('0x45')][_0xfe79('0x48')]));_0x2c6e40[_0xfe79('0x49')]=_0x2c6e40[_0xfe79('0x49')][_0xfe79('0x4a')]?_0x2c6e40[_0xfe79('0x49')]:_0x17be8e[_0xfe79('0x44')];if(!_0x8f2b06['query'][_0xfe79('0x4b')]('nolimit')){_0x2c6e40['limit']=qs[_0xfe79('0x2f')](_0x8f2b06[_0xfe79('0x45')][_0xfe79('0x2f')]);_0x2c6e40[_0xfe79('0x2e')]=qs[_0xfe79('0x2e')](_0x8f2b06[_0xfe79('0x45')][_0xfe79('0x2e')]);}_0x2c6e40['order']=qs[_0xfe79('0x4d')](_0x8f2b06[_0xfe79('0x45')][_0xfe79('0x4d')]);_0x2c6e40[_0xfe79('0x4e')]=qs[_0xfe79('0x46')](_[_0xfe79('0x4f')](_0x8f2b06['query'],_0x17be8e[_0xfe79('0x46')]));_0x2c6e40[_0xfe79('0x4e')][_0xfe79('0x68')]=_0x5b4493['id'];if(_0x8f2b06[_0xfe79('0x45')]['filter']){_0x2c6e40[_0xfe79('0x4e')]=_[_0xfe79('0x51')](_0x2c6e40[_0xfe79('0x4e')],{'$or':_[_0xfe79('0x3e')](_0x2c6e40[_0xfe79('0x49')],function(_0x442a0c){var _0x5c9d3e={};_0x5c9d3e[_0x442a0c]={'$like':'%'+_0x8f2b06['query']['filter']+'%'};return _0x5c9d3e;})});}_0x2c6e40=_['merge']({},_0x2c6e40,_0x8f2b06[_0xfe79('0x6b')]);return db[_0xfe79('0x69')][_0xfe79('0x31')]({'where':_0x2c6e40[_0xfe79('0x4e')]})[_0xfe79('0x21')](function(_0x26ba45){_0x2b62a8[_0xfe79('0x31')]=_0x26ba45;if(_0x8f2b06[_0xfe79('0x45')][_0xfe79('0x53')]){_0x2c6e40[_0xfe79('0x54')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x2c6e40);})[_0xfe79('0x21')](function(_0x3ce537){_0x2b62a8['rows']=_0x3ce537;return _0x2b62a8;});}})[_0xfe79('0x21')](respondWithFilteredResult(_0x20b537,_0x2c6e40))[_0xfe79('0x57')](handleError(_0x20b537,null));};exports[_0xfe79('0x6c')]=function(_0x445fe6,_0x1e6c1b,_0x460fe6){return db[_0xfe79('0x3f')][_0xfe79('0x66')]({'where':{'id':_0x445fe6[_0xfe79('0x59')]['id']}})[_0xfe79('0x21')](handleEntityNotFound(_0x1e6c1b,null))[_0xfe79('0x21')](function(_0x2091c4){if(_0x2091c4){return _0x2091c4[_0xfe79('0x6c')](_0x445fe6[_0xfe79('0x45')][_0xfe79('0x6d')]);}})[_0xfe79('0x21')](respondWithStatusCode(_0x1e6c1b,null))[_0xfe79('0x57')](handleError(_0x1e6c1b,null));};exports[_0xfe79('0x6e')]=function(_0x926853,_0x161949,_0x5b4718){if(_0x926853['body']['id']){delete _0x926853[_0xfe79('0x65')]['id'];}return db[_0xfe79('0x3f')][_0xfe79('0x66')]({'where':{'id':_0x926853[_0xfe79('0x59')]['id']}})[_0xfe79('0x21')](handleEntityNotFound(_0x161949,null))[_0xfe79('0x21')](function(_0x26f698){if(_0x26f698){_0x926853[_0xfe79('0x65')][_0xfe79('0x68')]=_0x26f698['id'];return db['CannedAnswer'][_0xfe79('0x5b')](_0x926853[_0xfe79('0x65')]);}})['then'](respondWithResult(_0x161949,null))[_0xfe79('0x57')](handleError(_0x161949,null));};exports[_0xfe79('0x6f')]=function(_0x490ffd,_0x2a2a78,_0x4deb44){var _0x472ecc={'raw':![],'where':{}};var _0xbd24c8={};var _0x3d0072={'count':0x0,'rows':[]};return db[_0xfe79('0x3f')][_0xfe79('0x70')]({'where':{'id':_0x490ffd[_0xfe79('0x59')]['id']}})['then'](handleEntityNotFound(_0x2a2a78,null))[_0xfe79('0x21')](function(_0x20ebef){if(_0x20ebef){_0xbd24c8['model']=_[_0xfe79('0x5a')](db[_0xfe79('0x71')][_0xfe79('0x40')]);_0xbd24c8['query']=_['keys'](_0x490ffd[_0xfe79('0x45')]);_0xbd24c8[_0xfe79('0x46')]=_[_0xfe79('0x47')](_0xbd24c8[_0xfe79('0x44')],_0xbd24c8[_0xfe79('0x45')]);_0x472ecc[_0xfe79('0x49')]=_[_0xfe79('0x47')](_0xbd24c8[_0xfe79('0x44')],qs['fields'](_0x490ffd[_0xfe79('0x45')][_0xfe79('0x48')]));_0x472ecc[_0xfe79('0x49')]=_0x472ecc['attributes']['length']?_0x472ecc['attributes']:_0xbd24c8['model'];if(!_0x490ffd[_0xfe79('0x45')][_0xfe79('0x4b')](_0xfe79('0x4c'))){_0x472ecc[_0xfe79('0x2f')]=qs['limit'](_0x490ffd[_0xfe79('0x45')]['limit']);_0x472ecc[_0xfe79('0x2e')]=qs[_0xfe79('0x2e')](_0x490ffd['query'][_0xfe79('0x2e')]);}_0x472ecc[_0xfe79('0x72')]=qs[_0xfe79('0x4d')](_0x490ffd[_0xfe79('0x45')][_0xfe79('0x4d')]);_0x472ecc['where']=qs[_0xfe79('0x46')](_[_0xfe79('0x4f')](_0x490ffd['query'],_0xbd24c8[_0xfe79('0x46')]));_0x472ecc[_0xfe79('0x4e')][_0xfe79('0x68')]=_0x20ebef['id'];if(_0x490ffd[_0xfe79('0x45')][_0xfe79('0x50')]){_0x472ecc[_0xfe79('0x4e')]=_[_0xfe79('0x51')](_0x472ecc[_0xfe79('0x4e')],{'$or':_[_0xfe79('0x3e')](_0x472ecc[_0xfe79('0x49')],function(_0x1cf5b1){var _0xcbbd28={};_0xcbbd28[_0x1cf5b1]={'$like':'%'+_0x490ffd[_0xfe79('0x45')]['filter']+'%'};return _0xcbbd28;})});}_0x472ecc=_['merge']({},_0x472ecc,_0x490ffd['options']);return db[_0xfe79('0x71')][_0xfe79('0x31')]({'where':_0x472ecc['where']})[_0xfe79('0x21')](function(_0x430193){_0x3d0072[_0xfe79('0x31')]=_0x430193;if(_0x490ffd[_0xfe79('0x45')]['includeAll']){_0x472ecc[_0xfe79('0x54')]=[{'all':!![]}];}return db[_0xfe79('0x71')]['findAll'](_0x472ecc);})[_0xfe79('0x21')](function(_0x46db4e){_0x3d0072[_0xfe79('0x56')]=_0x46db4e;return _0x3d0072;});}})['then'](respondWithFilteredResult(_0x2a2a78,_0x472ecc))[_0xfe79('0x57')](handleError(_0x2a2a78,null));};exports[_0xfe79('0x73')]=function(_0x234e71,_0x57305d,_0x5065bb){return db['FaxAccount'][_0xfe79('0x66')]({'where':{'id':_0x234e71[_0xfe79('0x59')]['id']}})['then'](handleEntityNotFound(_0x57305d,null))['then'](function(_0x59a0ab){if(_0x59a0ab){return _0x59a0ab['removeAnswers'](_0x234e71[_0xfe79('0x45')][_0xfe79('0x6d')]);}})[_0xfe79('0x21')](respondWithStatusCode(_0x57305d,null))['catch'](handleError(_0x57305d,null));};exports[_0xfe79('0x74')]=function(_0x27e764,_0xf032b4,_0x10929f){return db[_0xfe79('0x75')][_0xfe79('0x66')]({'where':{'id':_0x27e764[_0xfe79('0x59')]['id']}})[_0xfe79('0x21')](handleEntityNotFound(_0xf032b4,null))[_0xfe79('0x21')](function(_0x5b4a9f){if(_0x5b4a9f){return _0x5b4a9f[_0xfe79('0x74')](_0x27e764[_0xfe79('0x65')][_0xfe79('0x6d')],_[_0xfe79('0x76')](_0x27e764['body'],[_0xfe79('0x6d'),'id'])||{});}})[_0xfe79('0x21')](respondWithResult(_0xf032b4,null))['catch'](handleError(_0xf032b4,null));};exports[_0xfe79('0x77')]=function(_0x4665dd,_0x3c4e49,_0x22d40e){var _0x15e94f={'raw':![],'where':{}};var _0x1e9aa6={};var _0x16f8ca={'count':0x0,'rows':[]};return db[_0xfe79('0x3f')]['findOne']({'where':{'id':_0x4665dd[_0xfe79('0x59')]['id']}})[_0xfe79('0x21')](handleEntityNotFound(_0x3c4e49,null))[_0xfe79('0x21')](function(_0x1f8a1f){if(_0x1f8a1f){_0x1e9aa6['model']=_['keys'](db[_0xfe79('0x75')][_0xfe79('0x40')]);_0x1e9aa6['query']=_['keys'](_0x4665dd['query']);_0x1e9aa6['filters']=_[_0xfe79('0x47')](_0x1e9aa6['model'],_0x1e9aa6[_0xfe79('0x45')]);_0x15e94f[_0xfe79('0x49')]=_[_0xfe79('0x47')](_0x1e9aa6[_0xfe79('0x44')],qs[_0xfe79('0x48')](_0x4665dd['query'][_0xfe79('0x48')]));_0x15e94f['attributes']=_0x15e94f[_0xfe79('0x49')]['length']?_0x15e94f[_0xfe79('0x49')]:_0x1e9aa6[_0xfe79('0x44')];if(!_0x4665dd[_0xfe79('0x45')][_0xfe79('0x4b')](_0xfe79('0x4c'))){_0x15e94f[_0xfe79('0x2f')]=qs['limit'](_0x4665dd['query'][_0xfe79('0x2f')]);_0x15e94f[_0xfe79('0x2e')]=qs[_0xfe79('0x2e')](_0x4665dd[_0xfe79('0x45')]['offset']);}_0x15e94f['order']=qs[_0xfe79('0x4d')](_0x4665dd[_0xfe79('0x45')][_0xfe79('0x4d')]);_0x15e94f['where']=qs[_0xfe79('0x46')](_[_0xfe79('0x4f')](_0x4665dd[_0xfe79('0x45')],_0x1e9aa6[_0xfe79('0x46')]));_0x15e94f[_0xfe79('0x4e')][_0xfe79('0x68')]=_0x1f8a1f['id'];if(_0x4665dd[_0xfe79('0x45')]['filter']){_0x15e94f['where']=_['merge'](_0x15e94f[_0xfe79('0x4e')],{'$or':_[_0xfe79('0x3e')](_0x15e94f[_0xfe79('0x49')],function(_0x25311a){var _0x123f39={};_0x123f39[_0x25311a]={'$like':'%'+_0x4665dd[_0xfe79('0x45')][_0xfe79('0x50')]+'%'};return _0x123f39;})});}_0x15e94f=_[_0xfe79('0x51')]({},_0x15e94f,_0x4665dd[_0xfe79('0x6b')]);return db['FaxInteraction'][_0xfe79('0x31')]({'where':_0x15e94f[_0xfe79('0x4e')]})[_0xfe79('0x21')](function(_0x326f0a){_0x16f8ca[_0xfe79('0x31')]=_0x326f0a;if(_0x4665dd[_0xfe79('0x45')][_0xfe79('0x53')]){_0x15e94f[_0xfe79('0x54')]=[{'model':db['CmContact'],'as':_0xfe79('0x78'),'required':![]},{'model':db[_0xfe79('0x79')],'as':_0xfe79('0x7a'),'attributes':[_0xfe79('0x3a'),_0xfe79('0x7b'),_0xfe79('0x7c')],'required':![]},{'model':db[_0xfe79('0x7d')],'as':_0xfe79('0x7e'),'attributes':['id',_0xfe79('0x3a'),_0xfe79('0x7f')],'where':_0x4665dd['query'][_0xfe79('0x80')]?{'id':_0x4665dd['query'][_0xfe79('0x80')]}:undefined,'required':_0x4665dd[_0xfe79('0x45')][_0xfe79('0x80')]?!![]:![]}];}return db[_0xfe79('0x75')][_0xfe79('0x55')](_0x15e94f);})[_0xfe79('0x21')](function(_0xe07a1f){_0x16f8ca[_0xfe79('0x56')]=_0xe07a1f;return _0x16f8ca;});}})[_0xfe79('0x21')](respondWithFilteredResult(_0x3c4e49,_0x15e94f))[_0xfe79('0x57')](handleError(_0x3c4e49,null));};exports['addApplications']=function(_0x483a2,_0x2929f9,_0x3b7f3b){return db[_0xfe79('0x3f')][_0xfe79('0x70')]({'where':{'id':_0x483a2[_0xfe79('0x59')]['id']}})[_0xfe79('0x21')](handleEntityNotFound(_0x2929f9,null))[_0xfe79('0x21')](function(_0x2cf5ba){if(_0x2cf5ba){return db[_0xfe79('0x81')][_0xfe79('0x82')](function(_0x4a828b){return db[_0xfe79('0x83')][_0xfe79('0x36')]({'where':{'FaxAccountId':_0x483a2[_0xfe79('0x59')]['id']},'transaction':_0x4a828b})['then'](function(_0x3f4672){var _0x49c20d=_['map'](_0x483a2[_0xfe79('0x65')],function(_0x2efe28){_0x2efe28[_0xfe79('0x68')]=_0x483a2[_0xfe79('0x59')]['id'];return _0x2efe28;});return db[_0xfe79('0x83')][_0xfe79('0x84')](_0x49c20d,{'transaction':_0x4a828b});});})['then'](function(){return db[_0xfe79('0x83')][_0xfe79('0x85')]({'where':{'FaxAccountId':_0x483a2['params']['id']},'order':'priority'});});}})['then'](respondWithResult(_0x2929f9,null))[_0xfe79('0x57')](handleError(_0x2929f9,null));};exports[_0xfe79('0x86')]=function(_0x592650,_0x228acd,_0x6c08d4){var _0x5bca96={};var _0x44ab55={};var _0x216db0;var _0x2fe23a;return db[_0xfe79('0x3f')][_0xfe79('0x70')]({'where':{'id':_0x592650['params']['id']}})[_0xfe79('0x21')](handleEntityNotFound(_0x228acd,null))[_0xfe79('0x21')](function(_0xd5cf52){if(_0xd5cf52){_0x216db0=_0xd5cf52;_0x44ab55[_0xfe79('0x44')]=_[_0xfe79('0x5a')](db[_0xfe79('0x83')][_0xfe79('0x40')]);_0x44ab55[_0xfe79('0x45')]=_['keys'](_0x592650[_0xfe79('0x45')]);_0x44ab55[_0xfe79('0x46')]=_['intersection'](_0x44ab55[_0xfe79('0x44')],_0x44ab55[_0xfe79('0x45')]);_0x5bca96[_0xfe79('0x49')]=_['intersection'](_0x44ab55[_0xfe79('0x44')],qs[_0xfe79('0x48')](_0x592650['query'][_0xfe79('0x48')]));_0x5bca96[_0xfe79('0x49')]=_0x5bca96[_0xfe79('0x49')][_0xfe79('0x4a')]?_0x5bca96[_0xfe79('0x49')]:_0x44ab55['model'];_0x5bca96[_0xfe79('0x72')]=qs[_0xfe79('0x4d')](_0x592650[_0xfe79('0x45')][_0xfe79('0x4d')]);_0x5bca96[_0xfe79('0x4e')]=qs['filters'](_[_0xfe79('0x4f')](_0x592650[_0xfe79('0x45')],_0x44ab55[_0xfe79('0x46')]));if(_0x592650[_0xfe79('0x45')][_0xfe79('0x50')]){_0x5bca96[_0xfe79('0x4e')]=_[_0xfe79('0x51')](_0x5bca96[_0xfe79('0x4e')],{'$or':_[_0xfe79('0x3e')](_0x5bca96['attributes'],function(_0x2783a2){var _0x4db160={};_0x4db160[_0x2783a2]={'$like':'%'+_0x592650[_0xfe79('0x45')]['filter']+'%'};return _0x4db160;})});}_0x5bca96=_[_0xfe79('0x51')]({},_0x5bca96,_0x592650[_0xfe79('0x6b')]);return _0x216db0[_0xfe79('0x86')](_0x5bca96);}})[_0xfe79('0x21')](function(_0x213da1){if(_0x213da1){_0x2fe23a=_0x213da1[_0xfe79('0x4a')];if(!_0x592650[_0xfe79('0x45')][_0xfe79('0x4b')]('nolimit')){_0x5bca96[_0xfe79('0x2f')]=qs[_0xfe79('0x2f')](_0x592650[_0xfe79('0x45')][_0xfe79('0x2f')]);_0x5bca96[_0xfe79('0x2e')]=qs[_0xfe79('0x2e')](_0x592650[_0xfe79('0x45')]['offset']);}return _0x216db0[_0xfe79('0x86')](_0x5bca96);}})[_0xfe79('0x21')](function(_0x13d53b){if(_0x13d53b){return _0x13d53b?{'count':_0x2fe23a,'rows':_0x13d53b}:null;}})[_0xfe79('0x21')](respondWithResult(_0x228acd,null))[_0xfe79('0x57')](handleError(_0x228acd,null));};function Extension(_0x20b9de,_0xd6b700,_0x410b23,_0x4a7595){this[_0xfe79('0x87')]='from-voip-provider';this[_0xfe79('0x88')]=_0x20b9de[_0xfe79('0x89')];this['app']=_0x4a7595;this['type']=_0xfe79('0x8a');this[_0xfe79('0x8b')]=_0xfe79('0x8c');this[_0xfe79('0x68')]=_0x20b9de['id'];this[_0xfe79('0x8d')]=_0xd6b700;this['appdata']=_0x410b23;}function createExtensionsReciveFax(_0x124741){var _0x3b109e=0x1;var _0x20d338=[];_0x20d338[_0xfe79('0x8e')](new Extension(_0x124741,_0x3b109e,'',_0xfe79('0x8f')));_0x3b109e+=0x1;_0x20d338[_0xfe79('0x8e')](new Extension(_0x124741,_0x3b109e,_0xfe79('0x90'),'Set'));_0x3b109e+=0x1;for(var _0x56ffe0 in _0x124741){if(_0x124741['hasOwnProperty'](_0x56ffe0)&&(_0x56ffe0===_0xfe79('0x91')||_0x56ffe0===_0xfe79('0x89')||_0x56ffe0===_0xfe79('0x92')||_0x56ffe0===_0xfe79('0x93')||_0x56ffe0===_0xfe79('0x94')||_0x56ffe0===_0xfe79('0x95')||_0x56ffe0==='minrate'||_0x56ffe0===_0xfe79('0x96')||_0x56ffe0===_0xfe79('0x97'))){_0x20d338[_0xfe79('0x8e')](new Extension(_0x124741,_0x3b109e,_0xfe79('0x98')+_0x56ffe0+')='+_0x124741[_0x56ffe0],'Set'));_0x3b109e+=0x1;}}_0x20d338[_0xfe79('0x8e')](new Extension(_0x124741,_0x3b109e,'6',_0xfe79('0x99')));_0x3b109e+=0x1;_0x20d338[_0xfe79('0x8e')](new Extension(_0x124741,_0x3b109e,_0xfe79('0x9a'),_0xfe79('0x9b')));_0x3b109e=0x0;return _0x20d338;}exports[_0xfe79('0x9c')]=function(_0xdcbbe2,_0x3fd1f8,_0x32ed29){var _0x2279cc;return db[_0xfe79('0x81')][_0xfe79('0x82')](function(_0x4c6724){return db[_0xfe79('0x3f')][_0xfe79('0x5b')](_0xdcbbe2['body'],{'transaction':_0x4c6724})[_0xfe79('0x21')](function(_0x4e7883){_0x2279cc=_0x4e7883['get']({'plain':!![]});return db[_0xfe79('0x9d')][_0xfe79('0x84')](createExtensionsReciveFax(_0x2279cc),{'transaction':_0x4c6724});});})[_0xfe79('0x21')](function(){return _0x2279cc;})['then'](respondWithResult(_0x3fd1f8,null))[_0xfe79('0x57')](handleError(_0x3fd1f8,null));};exports['updateAccountApplications']=function(_0x5504fe,_0x1da63c,_0x4ff61b){var _0x3bead7;return db[_0xfe79('0x81')][_0xfe79('0x82')](function(_0x4d77ec){return db[_0xfe79('0x3f')][_0xfe79('0x64')](_0x5504fe[_0xfe79('0x65')],{'where':{'id':_0x5504fe[_0xfe79('0x65')]['id']},'transaction':_0x4d77ec})[_0xfe79('0x21')](function(_0x53873c){return db[_0xfe79('0x9d')][_0xfe79('0x36')]({'where':{'FaxAccountId':_0x5504fe[_0xfe79('0x65')]['id']},'transaction':_0x4d77ec})[_0xfe79('0x21')](function(_0x71ec65){return db[_0xfe79('0x9d')][_0xfe79('0x84')](createExtensionsReciveFax(_[_0xfe79('0x76')](_0x5504fe[_0xfe79('0x65')],[_0xfe79('0x9e'),_0xfe79('0x43'),_0xfe79('0x9f'),_0xfe79('0xa0'),'TrunkId',_0xfe79('0xa1')])),{'transaction':_0x4d77ec});});});})[_0xfe79('0x21')](function(){return db[_0xfe79('0x3f')][_0xfe79('0xa2')](_0x5504fe[_0xfe79('0x65')]['id']);})[_0xfe79('0x21')](respondWithResult(_0x1da63c,null))[_0xfe79('0x57')](handleError(_0x1da63c,null));};exports[_0xfe79('0xa3')]=function(_0x316bf6,_0x54982b,_0x288924){var _0x119459={'raw':!![],'where':{}};var _0x3eb430={};var _0x56ceb1={'count':0x0,'rows':[]};return db[_0xfe79('0x3f')]['findOne']({'where':{'id':_0x316bf6['params']['id']}})[_0xfe79('0x21')](handleEntityNotFound(_0x54982b,null))[_0xfe79('0x21')](function(_0x519bfa){if(_0x519bfa){_0x3eb430[_0xfe79('0x44')]=_[_0xfe79('0x5a')](db[_0xfe79('0xa4')][_0xfe79('0x40')]);_0x3eb430['query']=_[_0xfe79('0x5a')](_0x316bf6['query']);_0x3eb430[_0xfe79('0x46')]=_[_0xfe79('0x47')](_0x3eb430[_0xfe79('0x44')],_0x3eb430['query']);_0x119459['attributes']=_[_0xfe79('0x47')](_0x3eb430[_0xfe79('0x44')],qs[_0xfe79('0x48')](_0x316bf6['query']['fields']));_0x119459[_0xfe79('0x49')]=_0x119459['attributes'][_0xfe79('0x4a')]?_0x119459[_0xfe79('0x49')]:_0x3eb430['model'];if(!_0x316bf6['query'][_0xfe79('0x4b')](_0xfe79('0x4c'))){_0x119459[_0xfe79('0x2f')]=qs['limit'](_0x316bf6[_0xfe79('0x45')]['limit']);_0x119459[_0xfe79('0x2e')]=qs[_0xfe79('0x2e')](_0x316bf6[_0xfe79('0x45')][_0xfe79('0x2e')]);}_0x119459[_0xfe79('0x72')]=qs[_0xfe79('0x4d')](_0x316bf6[_0xfe79('0x45')][_0xfe79('0x4d')]);_0x119459['where']=qs[_0xfe79('0x46')](_[_0xfe79('0x4f')](_0x316bf6[_0xfe79('0x45')],_0x3eb430[_0xfe79('0x46')]));_0x119459[_0xfe79('0x4e')][_0xfe79('0x68')]=_0x519bfa['id'];if(_0x316bf6['query'][_0xfe79('0x50')]){_0x119459[_0xfe79('0x4e')]=_['merge'](_0x119459['where'],{'$or':_[_0xfe79('0x3e')](_0x119459['attributes'],function(_0x231601){var _0x41c2e8={};_0x41c2e8[_0x231601]={'$like':'%'+_0x316bf6['query'][_0xfe79('0x50')]+'%'};return _0x41c2e8;})});}if(_0x316bf6[_0xfe79('0x45')]['$gte']){var _0x5ec8b1=_0x316bf6[_0xfe79('0x45')][_0xfe79('0xa5')][_0xfe79('0xa6')](',');var _0x1d41e1={};_0x1d41e1[_0x5ec8b1[0x0]]={'$gte':moment(_0x5ec8b1[0x1])[_0xfe79('0xa7')]('YYYY-MM-DD\x20HH:mm:ss')};_0x119459['where']=_[_0xfe79('0x51')](_0x119459[_0xfe79('0x4e')],_0x1d41e1);}_0x119459=_[_0xfe79('0x51')]({},_0x119459,_0x316bf6['options']);return db[_0xfe79('0xa4')]['count']({'where':_0x119459[_0xfe79('0x4e')]})[_0xfe79('0x21')](function(_0x208cf0){_0x56ceb1[_0xfe79('0x31')]=_0x208cf0;if(_0x316bf6[_0xfe79('0x45')]['includeAll']){_0x119459['include']=[{'all':!![]}];}return db[_0xfe79('0xa4')]['findAll'](_0x119459);})[_0xfe79('0x21')](function(_0x1c036b){_0x56ceb1[_0xfe79('0x56')]=_0x1c036b;return _0x56ceb1;});}})[_0xfe79('0x21')](respondWithFilteredResult(_0x54982b,_0x119459))[_0xfe79('0x57')](handleError(_0x54982b,null));};exports[_0xfe79('0x3b')]=function(_0x1c55a3,_0x40bbd6,_0x2cd482){var _0x425ac6,_0x556f92={},_0xe1e53a;if(_0x1c55a3[_0xfe79('0x65')]['to']){_0xe1e53a=_0x1c55a3['body']['to'][0x0];}return db[_0xfe79('0x3f')]['find']({'where':{'id':_0x1c55a3[_0xfe79('0x59')]['id']},'include':[{'model':db[_0xfe79('0xa8')],'as':'List','include':[{'model':db[_0xfe79('0xa9')],'as':_0xfe79('0xaa'),'where':{'fax':_0xe1e53a},'limit':0x1,'order':[[_0xfe79('0xa0'),_0xfe79('0xab')]]}]}]})['then'](handleEntityNotFound(_0x40bbd6,null))[_0xfe79('0x21')](function(_0x434ca9){_0x425ac6=_0x434ca9;if(_0x1c55a3['body'][_0xfe79('0xac')]&&_0x1c55a3[_0xfe79('0x65')][_0xfe79('0xac')][_0xfe79('0x4a')]){for(var _0x4f3f24=0x0;_0x4f3f24<_0x1c55a3[_0xfe79('0x65')][_0xfe79('0xac')][_0xfe79('0x4a')];_0x4f3f24+=0x1){_0x1c55a3[_0xfe79('0x65')]['attachments'][_0x4f3f24]={'filename':_0x1c55a3[_0xfe79('0x65')][_0xfe79('0xac')][_0x4f3f24]['name'],'id':_0x1c55a3[_0xfe79('0x65')]['attachments'][_0x4f3f24]['id'],'path':path['join'](config[_0xfe79('0xad')],'server/files/attachments',_0x1c55a3[_0xfe79('0x65')]['attachments'][_0x4f3f24]['basename'])};}}return respondWithRpcPromise(_0xfe79('0xae'),'CheckAfterSend',{'FaxAccountId':_[_0xfe79('0xaf')](_0x1c55a3[_0xfe79('0x59')]['id'])?undefined:_0x1c55a3[_0xfe79('0x59')]['id'],'path':_[_0xfe79('0xaf')](_0x1c55a3[_0xfe79('0x65')][_0xfe79('0xac')][0x0][_0xfe79('0x6')])?undefined:_0x1c55a3['body']['attachments'][0x0][_0xfe79('0x6')],'fax':_[_0xfe79('0xaf')](_0x1c55a3[_0xfe79('0x65')]['to'][0x0])?undefined:_0x1c55a3[_0xfe79('0x65')]['to'][0x0]},client9002);})[_0xfe79('0x21')](function(){if(_0x425ac6){if(_[_0xfe79('0xaf')](_0x1c55a3['body'][_0xfe79('0xb0')])){_0x1c55a3[_0xfe79('0x65')][_0xfe79('0xb0')]=util['format'](_0xfe79('0xb1'),_0x425ac6[_0xfe79('0x3a')],_0x425ac6[_0xfe79('0xb2')]);}if(_0x425ac6['List']){if(_0x425ac6['List'][_0xfe79('0xaa')][_0xfe79('0x4a')]){return _0x425ac6[_0xfe79('0xb3')][_0xfe79('0xaa')][0x0];}else{return db[_0xfe79('0xa9')][_0xfe79('0x5b')](_[_0xfe79('0xb4')](_0x1c55a3['body'],{'firstName':_0x1c55a3['body']['to'][0x0],'phone':_0x1c55a3['body']['to'][0x0],'fax':_0x1c55a3['body']['to'][0x0],'ListId':_0x425ac6['ListId']}));}}else{throw new Error(_0xfe79('0xb5'));}}else{throw new Error(_0xfe79('0xb6'));}})['then'](function(_0x301ddc){if(_0x301ddc){return db[_0xfe79('0x75')]['find']({'where':{'ContactId':_0x301ddc['id'],'closed':![],'FaxAccountId':_0x425ac6['id']}})[_0xfe79('0x21')](function(_0x360f92){if(_0x360f92){return[_0x360f92,![]];}return db[_0xfe79('0x75')]['create']({'UserId':_0x1c55a3[_0xfe79('0x5c')]['id'],'ContactId':_0x301ddc['id'],'FaxAccountId':_0x425ac6['id'],'fax':_0x1c55a3['body']['to'][0x0],'firstMsgDirection':_0xfe79('0xb7'),'Messages':[_['merge'](_0x1c55a3[_0xfe79('0x65')],{'read':![],'body':_0x1c55a3[_0xfe79('0x65')]['attachments'][0x0][_0xfe79('0xb8')],'FaxAccountId':_0x425ac6['id'],'UserId':_0x1c55a3['user']['id'],'ContactId':_0x301ddc['id'],'AttachmentId':_0x1c55a3[_0xfe79('0x65')][_0xfe79('0xac')][0x0]['id']})]},{'include':[{'model':db[_0xfe79('0xa4')],'as':_0xfe79('0xb9')}]})[_0xfe79('0x21')](function(_0x562eab){return[_0x562eab,!![]];});});}else{throw new Error(_0xfe79('0xba'));}})[_0xfe79('0xbb')](function(_0x1cb082,_0x1ea09e){if(_0x1ea09e){return _0x1cb082;}return db[_0xfe79('0xa4')][_0xfe79('0x5b')]({'direction':_0xfe79('0xb7'),'read':![],'body':_0x1c55a3[_0xfe79('0x65')][_0xfe79('0xac')][0x0][_0xfe79('0xb8')],'FaxAccountId':_0x425ac6['id'],'FaxInteractionId':_0x1cb082['id'],'UserId':_0x1c55a3[_0xfe79('0x5c')]['id'],'ContactId':_0x1cb082[_0xfe79('0xbc')],'AttachmentId':_0x1c55a3[_0xfe79('0x65')][_0xfe79('0xac')][0x0]['id']})[_0xfe79('0x21')](function(_0x303c56){_0x1cb082[_0xfe79('0xbd')][_0xfe79('0xb9')]=[];_0x1cb082[_0xfe79('0xbd')][_0xfe79('0xb9')][_0xfe79('0x8e')](_0x303c56[_0xfe79('0xbd')]);return _0x1cb082;});})['then'](function(_0x37bcad){respondWithRpcPromise('SendFax',_0xfe79('0xbe'),{'FaxAccountId':_['isNil'](_0x1c55a3[_0xfe79('0x59')]['id'])?undefined:_0x1c55a3[_0xfe79('0x59')]['id'],'path':_['isNil'](_0x1c55a3[_0xfe79('0x65')][_0xfe79('0xac')][0x0][_0xfe79('0x6')])?undefined:_0x1c55a3[_0xfe79('0x65')][_0xfe79('0xac')][0x0][_0xfe79('0x6')],'fax':_[_0xfe79('0xaf')](_0x1c55a3['body']['to'][0x0])?undefined:_0x1c55a3['body']['to'][0x0],'AttachmentId':_0x1c55a3[_0xfe79('0x65')]['attachments'][0x0]['id']},client9002)[_0xfe79('0x21')](function(_0x50b97d){logger[_0xfe79('0x22')](_0xfe79('0xbf'),_0x50b97d);})[_0xfe79('0x57')](function(_0x1a86f1){logger[_0xfe79('0x22')](_0xfe79('0xbf'),_0x1a86f1);});return _0x37bcad;})['then'](respondWithResult(_0x40bbd6,null))[_0xfe79('0x57')](handleError(_0x40bbd6,null));};exports[_0xfe79('0xc0')]=function(_0x2580b7,_0x15cd1d,_0x1b72ba){return db[_0xfe79('0x3f')]['find']({'where':{'id':_0x2580b7['params']['id']}})['then'](handleEntityNotFound(_0x15cd1d,null))[_0xfe79('0x21')](function(_0x57908d){if(_0x57908d){return _0x57908d[_0xfe79('0xc0')](_0x2580b7[_0xfe79('0x65')][_0xfe79('0x6d')],_[_0xfe79('0x76')](_0x2580b7[_0xfe79('0x65')],[_0xfe79('0x6d'),'id'])||{})[_0xfe79('0xbb')](function(_0x31a8e4){for(var _0xa10ed=0x0;_0xa10ed<_0x2580b7[_0xfe79('0x65')][_0xfe79('0x6d')]['length'];_0xa10ed+=0x1){socket[_0xfe79('0xc1')]('userFaxAccount:save',{'UserId':Number(_0x2580b7[_0xfe79('0x65')][_0xfe79('0x6d')][_0xa10ed]),'FaxAccountId':Number(_0x2580b7[_0xfe79('0x59')]['id'])});}return _0x31a8e4;});}})[_0xfe79('0x21')](respondWithResult(_0x15cd1d,null))[_0xfe79('0x57')](handleError(_0x15cd1d,null));};exports[_0xfe79('0xc2')]=function(_0x20d5a5,_0x3eecef,_0x7c56de){return db['FaxAccount'][_0xfe79('0x66')]({'where':{'id':_0x20d5a5['params']['id']}})['then'](handleEntityNotFound(_0x3eecef,null))['then'](function(_0x2884d2){if(_0x2884d2){return _0x2884d2[_0xfe79('0xc2')](_0x20d5a5['query'][_0xfe79('0x6d')])[_0xfe79('0x21')](function(){if(_[_0xfe79('0xc3')](_0x20d5a5[_0xfe79('0x45')][_0xfe79('0x6d')])){for(var _0x1fadc6=0x0;_0x1fadc6<_0x20d5a5[_0xfe79('0x45')]['ids'][_0xfe79('0x4a')];_0x1fadc6+=0x1){socket[_0xfe79('0xc1')]('userFaxAccount:remove',{'UserId':Number(_0x20d5a5[_0xfe79('0x45')][_0xfe79('0x6d')][_0x1fadc6]),'FaxAccountId':Number(_0x20d5a5['params']['id'])});}}else{socket[_0xfe79('0xc1')](_0xfe79('0xc4'),{'UserId':Number(_0x20d5a5['query'][_0xfe79('0x6d')]),'FaxAccountId':Number(_0x20d5a5[_0xfe79('0x59')]['id'])});}});}})[_0xfe79('0x21')](respondWithStatusCode(_0x3eecef,null))[_0xfe79('0x57')](handleError(_0x3eecef,null));};exports[_0xfe79('0xc5')]=function(_0x59768d,_0x118581,_0x3f1d66){var _0x5ed2eb={};var _0x202f46={};var _0x34dc7b;var _0x40b249;return db[_0xfe79('0x3f')]['findOne']({'where':{'id':_0x59768d[_0xfe79('0x59')]['id']}})[_0xfe79('0x21')](handleEntityNotFound(_0x118581,null))[_0xfe79('0x21')](function(_0x2da774){if(_0x2da774){_0x34dc7b=_0x2da774;_0x202f46['model']=_['keys'](db[_0xfe79('0x79')][_0xfe79('0x40')]);_0x202f46['query']=_[_0xfe79('0x5a')](_0x59768d['query']);_0x202f46[_0xfe79('0x46')]=_[_0xfe79('0x47')](_0x202f46[_0xfe79('0x44')],_0x202f46[_0xfe79('0x45')]);_0x5ed2eb[_0xfe79('0x49')]=_[_0xfe79('0x47')](_0x202f46[_0xfe79('0x44')],qs[_0xfe79('0x48')](_0x59768d[_0xfe79('0x45')][_0xfe79('0x48')]));_0x5ed2eb[_0xfe79('0x49')]=_0x5ed2eb[_0xfe79('0x49')][_0xfe79('0x4a')]?_0x5ed2eb['attributes']:_0x202f46[_0xfe79('0x44')];_0x5ed2eb['order']=qs[_0xfe79('0x4d')](_0x59768d[_0xfe79('0x45')][_0xfe79('0x4d')]);_0x5ed2eb['where']=qs[_0xfe79('0x46')](_[_0xfe79('0x4f')](_0x59768d['query'],_0x202f46[_0xfe79('0x46')]));if(_0x59768d[_0xfe79('0x45')]['filter']){_0x5ed2eb[_0xfe79('0x4e')]=_[_0xfe79('0x51')](_0x5ed2eb['where'],{'$or':_['map'](_0x5ed2eb[_0xfe79('0x49')],function(_0x4c342c){var _0x1f0076={};_0x1f0076[_0x4c342c]={'$like':'%'+_0x59768d['query']['filter']+'%'};return _0x1f0076;})});}_0x5ed2eb=_[_0xfe79('0x51')]({},_0x5ed2eb,_0x59768d['options']);return _0x34dc7b[_0xfe79('0xc5')](_0x5ed2eb);}})['then'](function(_0x5c699b){if(_0x5c699b){_0x40b249=_0x5c699b[_0xfe79('0x4a')];if(!_0x59768d['query']['hasOwnProperty'](_0xfe79('0x4c'))){_0x5ed2eb[_0xfe79('0x2f')]=qs[_0xfe79('0x2f')](_0x59768d[_0xfe79('0x45')]['limit']);_0x5ed2eb[_0xfe79('0x2e')]=qs[_0xfe79('0x2e')](_0x59768d[_0xfe79('0x45')]['offset']);}return _0x34dc7b['getAgents'](_0x5ed2eb);}})['then'](function(_0x43ef88){if(_0x43ef88){return _0x43ef88?{'count':_0x40b249,'rows':_0x43ef88}:null;}})['then'](respondWithResult(_0x118581,null))['catch'](handleError(_0x118581,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 3c746ef..623eb5b 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 _0xf960=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','../../mysqldb','FaxAccount'];(function(_0x27e9b3,_0x1b17af){var _0x553cac=function(_0x5c368e){while(--_0x5c368e){_0x27e9b3['push'](_0x27e9b3['shift']());}};_0x553cac(++_0x1b17af);}(_0xf960,0xde));var _0x0f96=function(_0x58efa6,_0x2c00bd){_0x58efa6=_0x58efa6-0x0;var _0x5d643c=_0xf960[_0x58efa6];return _0x5d643c;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x0f96('0x0'))['db'][_0x0f96('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x0f96('0x2')](0x0);var events={'afterCreate':_0x0f96('0x3'),'afterUpdate':'update','afterDestroy':_0x0f96('0x4')};function emitEvent(_0x370dcb){return function(_0x5f4622,_0x26b2ee,_0xba6655){FaxAccountEvents[_0x0f96('0x5')](_0x370dcb+':'+_0x5f4622['id'],_0x5f4622);FaxAccountEvents['emit'](_0x370dcb,_0x5f4622);_0xba6655(null);};}for(var e in events){if(events[_0x0f96('0x6')](e)){var event=events[e];FaxAccount[_0x0f96('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x1394=['save','remove','emit','hasOwnProperty','events','../../mysqldb','FaxAccount'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x1394,0xb3));var _0x4139=function(_0x392abe,_0x1eba25){_0x392abe=_0x392abe-0x0;var _0x4dc1c9=_0x1394[_0x392abe];return _0x4dc1c9;};'use strict';var EventEmitter=require(_0x4139('0x0'));var FaxAccount=require(_0x4139('0x1'))['db'][_0x4139('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4139('0x3'),'afterUpdate':'update','afterDestroy':_0x4139('0x4')};function emitEvent(_0x2d08b4){return function(_0x514ca9,_0x2282a4,_0x4c0306){FaxAccountEvents[_0x4139('0x5')](_0x2d08b4+':'+_0x514ca9['id'],_0x514ca9);FaxAccountEvents[_0x4139('0x5')](_0x2d08b4,_0x514ca9);_0x4c0306(null);};}for(var e in events){if(events[_0x4139('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 4b0a57e..3abfc06 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 _0x89e6=['path','rimraf','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','bluebird'];(function(_0x32a548,_0x2cbe5a){var _0x2a7d54=function(_0x588c14){while(--_0x588c14){_0x32a548['push'](_0x32a548['shift']());}};_0x2a7d54(++_0x2cbe5a);}(_0x89e6,0x75));var _0x689e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x89e6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x689e('0x0'));var util=require(_0x689e('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x689e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x689e('0x3'));var rimraf=require(_0x689e('0x4'));var config=require('../../config/environment');var attributes=require(_0x689e('0x5'));module[_0x689e('0x6')]=function(_0x3f6c0e,_0x10d7e8){return _0x3f6c0e[_0x689e('0x7')](_0x689e('0x8'),attributes,{'tableName':_0x689e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54e3=['moment','bluebird','request-promise','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x54e3,0x14c));var _0x354e=function(_0x2b8c03,_0x448b48){_0x2b8c03=_0x2b8c03-0x0;var _0x5f5777=_0x54e3[_0x2b8c03];return _0x5f5777;};'use strict';var _=require(_0x354e('0x0'));var util=require(_0x354e('0x1'));var logger=require(_0x354e('0x2'))(_0x354e('0x3'));var moment=require(_0x354e('0x4'));var BPromise=require(_0x354e('0x5'));var rp=require(_0x354e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x354e('0x7'));var config=require(_0x354e('0x8'));var attributes=require(_0x354e('0x9'));module[_0x354e('0xa')]=function(_0x26853a,_0x1629da){return _0x26853a[_0x354e('0xb')](_0x354e('0xc'),attributes,{'tableName':_0x354e('0xd'),'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 2ed35df..c497a49 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 _0xfaee=['no\x20available\x20attributes','keys','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','List','Contacts','DESC','Applications','account','applications','list','orderBy','priority','length','defaults','create','contact','FaxInteraction','Contact\x20not\x20found','get','autoclose','push','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','User','name','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxAccount.socket','register','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','info','result','catch','GetFaxAccount','findAll','options','raw','attributes','limit','include','map','model','then','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError'];(function(_0x8af54b,_0x280be5){var _0x27d8f0=function(_0x559734){while(--_0x559734){_0x8af54b['push'](_0x8af54b['shift']());}};_0x27d8f0(++_0x280be5);}(_0xfaee,0x1a0));var _0xefae=function(_0x58779c,_0xe8471b){_0x58779c=_0x58779c-0x0;var _0x5e1897=_0xfaee[_0x58779c];return _0x5e1897;};'use strict';var _=require('lodash');var util=require(_0xefae('0x0'));var moment=require('moment');var BPromise=require(_0xefae('0x1'));var rs=require(_0xefae('0x2'));var fs=require('fs');var Redis=require(_0xefae('0x3'));var db=require(_0xefae('0x4'))['db'];var utils=require(_0xefae('0x5'));var logger=require(_0xefae('0x6'))(_0xefae('0x7'));var config=require(_0xefae('0x8'));var jayson=require(_0xefae('0x9'));var client=jayson[_0xefae('0xa')][_0xefae('0xb')]({'port':0x232c});config[_0xefae('0xc')]=_['defaults'](config[_0xefae('0xc')],{'host':_0xefae('0xd'),'port':0x18eb});var socket=require(_0xefae('0xe'))(new Redis(config['redis']));require(_0xefae('0xf'))[_0xefae('0x10')](socket);function respondWithRpcPromise(_0x7f6f96,_0x36fb3e,_0x2c9164){return new BPromise(function(_0x30d9ea,_0x1245c2){return client['request'](_0x7f6f96,_0x2c9164)['then'](function(_0x219e1f){logger['info']('FaxAccount,\x20%s,\x20%s',_0x36fb3e,'request\x20sent');logger[_0xefae('0x11')](_0xefae('0x12'),_0x36fb3e,_0xefae('0x13'),JSON[_0xefae('0x14')](_0x219e1f));if(_0x219e1f[_0xefae('0x15')]){if(_0x219e1f['error'][_0xefae('0x16')]===0x1f4){logger[_0xefae('0x15')](_0xefae('0x17'),_0x36fb3e,_0x219e1f['error'][_0xefae('0x18')]);return _0x1245c2(_0x219e1f[_0xefae('0x15')][_0xefae('0x18')]);}logger[_0xefae('0x15')](_0xefae('0x17'),_0x36fb3e,_0x219e1f['error'][_0xefae('0x18')]);return _0x30d9ea(_0x219e1f[_0xefae('0x15')][_0xefae('0x18')]);}else{logger[_0xefae('0x19')](_0xefae('0x17'),_0x36fb3e,_0xefae('0x13'));_0x30d9ea(_0x219e1f[_0xefae('0x1a')]['message']);}})[_0xefae('0x1b')](function(_0x3afd23){logger['error'](_0xefae('0x17'),_0x36fb3e,_0x3afd23);_0x1245c2(_0x3afd23);});});}exports[_0xefae('0x1c')]=function(_0x2a31a4){var _0x437271=this;return new Promise(function(_0x48ae4d,_0x461fa6){return db['FaxAccount'][_0xefae('0x1d')]({'raw':_0x2a31a4[_0xefae('0x1e')]?_0x2a31a4[_0xefae('0x1e')][_0xefae('0x1f')]===undefined?!![]:![]:!![],'where':_0x2a31a4['options']?_0x2a31a4[_0xefae('0x1e')]['where']||null:null,'attributes':_0x2a31a4[_0xefae('0x1e')]?_0x2a31a4[_0xefae('0x1e')][_0xefae('0x20')]||null:null,'limit':_0x2a31a4['options']?_0x2a31a4['options'][_0xefae('0x21')]||null:null,'include':_0x2a31a4[_0xefae('0x1e')]?_0x2a31a4[_0xefae('0x1e')][_0xefae('0x22')]?_[_0xefae('0x23')](_0x2a31a4['options'][_0xefae('0x22')],function(_0x39ec40){return{'model':db[_0x39ec40[_0xefae('0x24')]],'as':_0x39ec40['as'],'attributes':_0x39ec40[_0xefae('0x20')],'include':_0x39ec40[_0xefae('0x22')]?_[_0xefae('0x23')](_0x39ec40[_0xefae('0x22')],function(_0x45348b){return{'model':db[_0x45348b[_0xefae('0x24')]],'as':_0x45348b['as'],'attributes':_0x45348b[_0xefae('0x20')],'include':_0x45348b[_0xefae('0x22')]?_[_0xefae('0x23')](_0x45348b['include'],function(_0x4669c8){return{'model':db[_0x4669c8[_0xefae('0x24')]],'as':_0x4669c8['as'],'attributes':_0x4669c8[_0xefae('0x20')]};}):[]};}):[]};}):[]:[]})[_0xefae('0x25')](function(_0x2e46e0){logger[_0xefae('0x19')](_0xefae('0x1c'),_0x2a31a4);logger['debug']('GetFaxAccount',_0x2a31a4,JSON[_0xefae('0x14')](_0x2e46e0));_0x48ae4d(_0x2e46e0);})['catch'](function(_0x1e6270){logger[_0xefae('0x15')](_0xefae('0x1c'),_0x1e6270[_0xefae('0x18')],_0x2a31a4);_0x461fa6(_0x437271['error'](0x1f4,_0x1e6270[_0xefae('0x18')]));});});};exports[_0xefae('0x26')]=function(_0x348d42,_0x4a4345,_0x328a89){var _0x95dde4=this;return new Promise(function(_0x21101c,_0x329c97){var _0x2d51d2={'body':_0x348d42['body'],'channel':_0xefae('0x27')};var _0x3e154e=[];var _0x21f3d3=[];var _0x40a999={};return db[_0xefae('0x28')][_0xefae('0x29')]()['then'](function(_0x478aa3){if(!_0x478aa3){throw new db[(_0xefae('0x2a'))][(_0xefae('0x2b'))](_0xefae('0x2c'));}_0x3e154e=_['difference'](_[_0xefae('0x2d')](_0x478aa3),[_0xefae('0x2e'),'updatedAt']);_0x21f3d3=_['difference'](_[_0xefae('0x2d')](_0x478aa3),['createdAt',_0xefae('0x2f'),_0xefae('0x30'),_0xefae('0x31')]);if(_0x348d42[_0xefae('0x32')]['id']){delete _0x348d42['body']['id'];}if(_[_0xefae('0x33')](_0x348d42[_0xefae('0x32')][_0xefae('0x34')])){throw new db[(_0xefae('0x2a'))]['ValidationError'](_0xefae('0x35'));}if(_['isNil'](_0x348d42[_0xefae('0x32')]['body'])||_0x348d42[_0xefae('0x32')][_0xefae('0x32')]===''){throw new db['Sequelize'][(_0xefae('0x2b'))](_0xefae('0x36'));}if(_['isNil'](_0x348d42[_0xefae('0x32')][_0xefae('0x37')])){throw new db['Sequelize']['ValidationError'](_0xefae('0x38')+_0x21f3d3);}if(!_[_0xefae('0x39')](_0x21f3d3,_0x348d42[_0xefae('0x32')][_0xefae('0x37')])){throw new db['Sequelize'][(_0xefae('0x2b'))](_0xefae('0x3a')+_0x21f3d3);}_0x40a999[_0x348d42[_0xefae('0x32')]['mapKey']]=_0x348d42[_0xefae('0x32')][_0xefae('0x34')];})[_0xefae('0x25')](function(){return db[_0xefae('0x3b')][_0xefae('0x3c')]({'where':{'id':_0x348d42['account']['id']},'include':[{'model':db['CmList'],'as':_0xefae('0x3d'),'include':[{'model':db[_0xefae('0x28')],'as':_0xefae('0x3e'),'where':_0x40a999,'limit':0x1,'order':[[_0xefae('0x2f'),_0xefae('0x3f')]]}]},{'model':db['FaxApplication'],'as':_0xefae('0x40')}]});})[_0xefae('0x25')](function(_0x5ec2bc){if(_0x5ec2bc&&_0x5ec2bc[_0xefae('0x3d')]){var _0x56cd47=_0x5ec2bc['get']({'plain':!![]});_0x2d51d2[_0xefae('0x41')]=_0x56cd47;_0x2d51d2[_0xefae('0x42')]=_0x56cd47['Applications'];_0x2d51d2[_0xefae('0x43')]=_0x56cd47[_0xefae('0x3d')];_0x2d51d2['applications']=_[_0xefae('0x44')](_0x2d51d2[_0xefae('0x42')],[_0xefae('0x45')],['asc']);if(_0x2d51d2[_0xefae('0x41')]['Applications']){delete _0x2d51d2[_0xefae('0x41')][_0xefae('0x40')];}if(_0x2d51d2[_0xefae('0x41')]['List']&&_0x2d51d2[_0xefae('0x41')]['List'][_0xefae('0x3e')][_0xefae('0x46')]){return _0x2d51d2[_0xefae('0x41')][_0xefae('0x3d')]['Contacts'][0x0];}var _0x3a0423=_[_0xefae('0x47')](_0x348d42['body'],{'firstName':_0x348d42[_0xefae('0x32')][_0xefae('0x34')],'ListId':_0x56cd47[_0xefae('0x31')]});_0x3a0423[_0x348d42[_0xefae('0x32')]['mapKey']]=_0x348d42['body'][_0xefae('0x34')];return db['CmContact'][_0xefae('0x48')](_0x3a0423,{'fields':_0x3e154e,'raw':!![]});}})['then'](function(_0x2ea5b7){_0x2d51d2[_0xefae('0x49')]=_0x2ea5b7;if(_0x2ea5b7){var _0x282762={'ContactId':_0x2ea5b7['id'],'FaxAccountId':_0x348d42[_0xefae('0x41')]['id'],'fax':_0x2ea5b7[_0xefae('0x27')]};return db[_0xefae('0x4a')][_0xefae('0x3c')]({'where':{'ContactId':_0x2ea5b7['id'],'closed':![],'FaxAccountId':_0x348d42['account']['id']}})['then'](function(_0x4daf2d){if(_0x4daf2d){return[_0x4daf2d,![]];}return db[_0xefae('0x4a')][_0xefae('0x48')](_0x282762)[_0xefae('0x25')](function(_0x3c1b66){return[_0x3c1b66,!![]];});});}else{throw new Error(_0xefae('0x4b'));}})['spread'](function(_0x510bb3,_0x5542f8){var _0x1a99e4=_0x510bb3[_0xefae('0x4c')]({'plain':!![]});if(_0x5542f8){if(_0x2d51d2['account'][_0xefae('0x4d')]){_0x2d51d2[_0xefae('0x42')][_0xefae('0x4e')]({'id':0x0,'priority':_0x2d51d2['applications'][_0xefae('0x46')]+0x1,'app':'close','appdata':_0xefae('0x4f'),'interval':_0xefae('0x50')});}_0x1a99e4[_0xefae('0x51')]=!![];}else{_0x1a99e4[_0xefae('0x51')]=![];}_0x2d51d2[_0xefae('0x52')]=_0x1a99e4;return db[_0xefae('0x53')][_0xefae('0x48')]({'body':_0x348d42[_0xefae('0x32')]['body'],'FaxAccountId':_0x348d42[_0xefae('0x41')]['id'],'FaxInteractionId':_0x510bb3['id'],'direction':'in','ContactId':_0x510bb3['ContactId'],'AttachmentId':_0x348d42[_0xefae('0x32')][_0xefae('0x54')]});})[_0xefae('0x25')](function(_0x167f5f){_0x2d51d2[_0xefae('0x18')]=_0x167f5f;if(_0x2d51d2[_0xefae('0x52')]['UserId']){return db[_0xefae('0x55')][_0xefae('0x3c')]({'attributes':['id',_0xefae('0x56')],'where':{'id':_0x2d51d2[_0xefae('0x52')][_0xefae('0x57')]}})[_0xefae('0x25')](function(_0x200714){if(_0x200714){_0x2d51d2[_0xefae('0x42')][_0xefae('0x58')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x200714[_0xefae('0x56')]+','+(_0x2d51d2['account'][_0xefae('0x59')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xefae('0x5a'),_0xefae('0x5b'),_0x2d51d2);});}return respondWithRpcPromise('Start',_0xefae('0x5b'),_0x2d51d2);})[_0xefae('0x25')](function(_0x2a1428){_0x21101c(_0x2a1428);})[_0xefae('0x1b')](function(_0x1e2b55){_0x329c97(_0x95dde4[_0xefae('0x15')](0x1f4,_0x1e2b55[_0xefae('0x18')]));});});}; \ No newline at end of file +var _0x3627=['describe','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','difference','ListId','from','Sequelize','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','DESC','FaxApplication','get','applications','Applications','orderBy','priority','asc','Contacts','length','CmContact','FaxInteraction','spread','autoclose','close','unmanaged','*,*,*,*','created','interaction','ContactId','UserId','User','name','unshift','agent','Start','startRouting','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','FaxAccount','options','raw','attributes','limit','include','map','model','debug','catch','GetFaxAccount','NotifyFaxAccount','body','fax'];(function(_0x3edbf0,_0x3571fd){var _0x575ac3=function(_0x409fa8){while(--_0x409fa8){_0x3edbf0['push'](_0x3edbf0['shift']());}};_0x575ac3(++_0x3571fd);}(_0x3627,0x81));var _0x7362=function(_0x59e5d4,_0x575cd5){_0x59e5d4=_0x59e5d4-0x0;var _0x464c9a=_0x3627[_0x59e5d4];return _0x464c9a;};'use strict';var _=require(_0x7362('0x0'));var util=require(_0x7362('0x1'));var moment=require(_0x7362('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7362('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7362('0x4'))(_0x7362('0x5'));var config=require(_0x7362('0x6'));var jayson=require(_0x7362('0x7'));var client=jayson[_0x7362('0x8')][_0x7362('0x9')]({'port':0x232c});config['redis']=_[_0x7362('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7362('0xb'))(new Redis(config['redis']));require(_0x7362('0xc'))[_0x7362('0xd')](socket);function respondWithRpcPromise(_0x4fdbdd,_0x343853,_0x4718ce){return new BPromise(function(_0x565eb2,_0x478640){return client[_0x7362('0xe')](_0x4fdbdd,_0x4718ce)[_0x7362('0xf')](function(_0x26433f){logger[_0x7362('0x10')](_0x7362('0x11'),_0x343853,_0x7362('0x12'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x343853,'request\x20sent',JSON[_0x7362('0x13')](_0x26433f));if(_0x26433f[_0x7362('0x14')]){if(_0x26433f['error']['code']===0x1f4){logger['error'](_0x7362('0x11'),_0x343853,_0x26433f[_0x7362('0x14')][_0x7362('0x15')]);return _0x478640(_0x26433f[_0x7362('0x14')]['message']);}logger[_0x7362('0x14')]('FaxAccount,\x20%s,\x20%s',_0x343853,_0x26433f['error'][_0x7362('0x15')]);return _0x565eb2(_0x26433f[_0x7362('0x14')][_0x7362('0x15')]);}else{logger[_0x7362('0x10')](_0x7362('0x11'),_0x343853,_0x7362('0x12'));_0x565eb2(_0x26433f[_0x7362('0x16')][_0x7362('0x15')]);}})['catch'](function(_0x129aff){logger[_0x7362('0x14')]('FaxAccount,\x20%s,\x20%s',_0x343853,_0x129aff);_0x478640(_0x129aff);});});}exports['GetFaxAccount']=function(_0x9f4547){var _0x5c5c81=this;return new Promise(function(_0x32addc,_0x220f58){return db[_0x7362('0x17')]['findAll']({'raw':_0x9f4547[_0x7362('0x18')]?_0x9f4547['options'][_0x7362('0x19')]===undefined?!![]:![]:!![],'where':_0x9f4547[_0x7362('0x18')]?_0x9f4547[_0x7362('0x18')]['where']||null:null,'attributes':_0x9f4547[_0x7362('0x18')]?_0x9f4547[_0x7362('0x18')][_0x7362('0x1a')]||null:null,'limit':_0x9f4547[_0x7362('0x18')]?_0x9f4547['options'][_0x7362('0x1b')]||null:null,'include':_0x9f4547[_0x7362('0x18')]?_0x9f4547[_0x7362('0x18')][_0x7362('0x1c')]?_['map'](_0x9f4547[_0x7362('0x18')][_0x7362('0x1c')],function(_0x1133a3){return{'model':db[_0x1133a3['model']],'as':_0x1133a3['as'],'attributes':_0x1133a3[_0x7362('0x1a')],'include':_0x1133a3['include']?_[_0x7362('0x1d')](_0x1133a3['include'],function(_0x5325e7){return{'model':db[_0x5325e7[_0x7362('0x1e')]],'as':_0x5325e7['as'],'attributes':_0x5325e7['attributes'],'include':_0x5325e7[_0x7362('0x1c')]?_['map'](_0x5325e7[_0x7362('0x1c')],function(_0x1b7829){return{'model':db[_0x1b7829['model']],'as':_0x1b7829['as'],'attributes':_0x1b7829[_0x7362('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7362('0xf')](function(_0x2bf9ca){logger[_0x7362('0x10')]('GetFaxAccount',_0x9f4547);logger[_0x7362('0x1f')]('GetFaxAccount',_0x9f4547,JSON[_0x7362('0x13')](_0x2bf9ca));_0x32addc(_0x2bf9ca);})[_0x7362('0x20')](function(_0x3cc01a){logger[_0x7362('0x14')](_0x7362('0x21'),_0x3cc01a['message'],_0x9f4547);_0x220f58(_0x5c5c81[_0x7362('0x14')](0x1f4,_0x3cc01a[_0x7362('0x15')]));});});};exports[_0x7362('0x22')]=function(_0x133d73,_0x3686de,_0x35cca9){var _0x4b68f1=this;return new Promise(function(_0xc526d2,_0x49446d){var _0x239763={'body':_0x133d73[_0x7362('0x23')],'channel':_0x7362('0x24')};var _0x510a4d=[];var _0x4472ed=[];var _0x38605a={};return db['CmContact'][_0x7362('0x25')]()['then'](function(_0xc2e9e3){if(!_0xc2e9e3){throw new db['Sequelize'][(_0x7362('0x26'))](_0x7362('0x27'));}_0x510a4d=_['difference'](_[_0x7362('0x28')](_0xc2e9e3),[_0x7362('0x29'),_0x7362('0x2a')]);_0x4472ed=_[_0x7362('0x2b')](_[_0x7362('0x28')](_0xc2e9e3),[_0x7362('0x29'),_0x7362('0x2a'),'CompanyId',_0x7362('0x2c')]);if(_0x133d73[_0x7362('0x23')]['id']){delete _0x133d73['body']['id'];}if(_['isNil'](_0x133d73[_0x7362('0x23')][_0x7362('0x2d')])){throw new db[(_0x7362('0x2e'))][(_0x7362('0x26'))](_0x7362('0x2f'));}if(_[_0x7362('0x30')](_0x133d73[_0x7362('0x23')]['body'])||_0x133d73[_0x7362('0x23')][_0x7362('0x23')]===''){throw new db['Sequelize'][(_0x7362('0x26'))](_0x7362('0x31'));}if(_[_0x7362('0x30')](_0x133d73[_0x7362('0x23')][_0x7362('0x32')])){throw new db[(_0x7362('0x2e'))][(_0x7362('0x26'))](_0x7362('0x33')+_0x4472ed);}if(!_['includes'](_0x4472ed,_0x133d73['body'][_0x7362('0x32')])){throw new db[(_0x7362('0x2e'))][(_0x7362('0x26'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4472ed);}_0x38605a[_0x133d73[_0x7362('0x23')][_0x7362('0x32')]]=_0x133d73[_0x7362('0x23')][_0x7362('0x2d')];})['then'](function(){return db[_0x7362('0x17')][_0x7362('0x34')]({'where':{'id':_0x133d73[_0x7362('0x35')]['id']},'include':[{'model':db[_0x7362('0x36')],'as':_0x7362('0x37'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x38605a,'limit':0x1,'order':[[_0x7362('0x2a'),_0x7362('0x38')]]}]},{'model':db[_0x7362('0x39')],'as':'Applications'}]});})[_0x7362('0xf')](function(_0x20f811){if(_0x20f811&&_0x20f811[_0x7362('0x37')]){var _0x3f7d1f=_0x20f811[_0x7362('0x3a')]({'plain':!![]});_0x239763[_0x7362('0x35')]=_0x3f7d1f;_0x239763[_0x7362('0x3b')]=_0x3f7d1f[_0x7362('0x3c')];_0x239763['list']=_0x3f7d1f[_0x7362('0x37')];_0x239763[_0x7362('0x3b')]=_[_0x7362('0x3d')](_0x239763['applications'],[_0x7362('0x3e')],[_0x7362('0x3f')]);if(_0x239763[_0x7362('0x35')][_0x7362('0x3c')]){delete _0x239763[_0x7362('0x35')][_0x7362('0x3c')];}if(_0x239763['account']['List']&&_0x239763[_0x7362('0x35')][_0x7362('0x37')][_0x7362('0x40')][_0x7362('0x41')]){return _0x239763[_0x7362('0x35')][_0x7362('0x37')][_0x7362('0x40')][0x0];}var _0x1bd296=_[_0x7362('0xa')](_0x133d73['body'],{'firstName':_0x133d73[_0x7362('0x23')][_0x7362('0x2d')],'ListId':_0x3f7d1f[_0x7362('0x2c')]});_0x1bd296[_0x133d73[_0x7362('0x23')][_0x7362('0x32')]]=_0x133d73[_0x7362('0x23')][_0x7362('0x2d')];return db[_0x7362('0x42')]['create'](_0x1bd296,{'fields':_0x510a4d,'raw':!![]});}})['then'](function(_0x4e325a){_0x239763['contact']=_0x4e325a;if(_0x4e325a){var _0x452701={'ContactId':_0x4e325a['id'],'FaxAccountId':_0x133d73[_0x7362('0x35')]['id'],'fax':_0x4e325a[_0x7362('0x24')]};return db[_0x7362('0x43')][_0x7362('0x34')]({'where':{'ContactId':_0x4e325a['id'],'closed':![],'FaxAccountId':_0x133d73[_0x7362('0x35')]['id']}})['then'](function(_0x543332){if(_0x543332){return[_0x543332,![]];}return db['FaxInteraction']['create'](_0x452701)['then'](function(_0x2e2b05){return[_0x2e2b05,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x7362('0x44')](function(_0xc2cc5b,_0x39db88){var _0x1a1db8=_0xc2cc5b[_0x7362('0x3a')]({'plain':!![]});if(_0x39db88){if(_0x239763[_0x7362('0x35')][_0x7362('0x45')]){_0x239763[_0x7362('0x3b')]['push']({'id':0x0,'priority':_0x239763[_0x7362('0x3b')][_0x7362('0x41')]+0x1,'app':_0x7362('0x46'),'appdata':_0x7362('0x47'),'interval':_0x7362('0x48')});}_0x1a1db8['created']=!![];}else{_0x1a1db8[_0x7362('0x49')]=![];}_0x239763[_0x7362('0x4a')]=_0x1a1db8;return db['FaxMessage']['create']({'body':_0x133d73[_0x7362('0x23')][_0x7362('0x23')],'FaxAccountId':_0x133d73[_0x7362('0x35')]['id'],'FaxInteractionId':_0xc2cc5b['id'],'direction':'in','ContactId':_0xc2cc5b[_0x7362('0x4b')],'AttachmentId':_0x133d73[_0x7362('0x23')]['AttachmentId']});})[_0x7362('0xf')](function(_0x4adb9e){_0x239763[_0x7362('0x15')]=_0x4adb9e;if(_0x239763[_0x7362('0x4a')][_0x7362('0x4c')]){return db[_0x7362('0x4d')][_0x7362('0x34')]({'attributes':['id',_0x7362('0x4e')],'where':{'id':_0x239763['interaction'][_0x7362('0x4c')]}})[_0x7362('0xf')](function(_0x3fca42){if(_0x3fca42){_0x239763[_0x7362('0x3b')][_0x7362('0x4f')]({'id':0x0,'priority':0x0,'app':_0x7362('0x50'),'appdata':_0x3fca42[_0x7362('0x4e')]+','+(_0x239763[_0x7362('0x35')]['waitForTheAssignedAgent']||0xa),'interval':_0x7362('0x48')});}return respondWithRpcPromise(_0x7362('0x51'),_0x7362('0x52'),_0x239763);});}return respondWithRpcPromise(_0x7362('0x51'),_0x7362('0x52'),_0x239763);})['then'](function(_0x34c12a){_0xc526d2(_0x34c12a);})[_0x7362('0x20')](function(_0x5db137){_0x49446d(_0x4b68f1[_0x7362('0x14')](0x1f4,_0x5db137['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 2e68c48..7cebaff 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 _0x4942=['removeListener','register','length','faxAccount:','./faxAccount.events','remove','emit'];(function(_0x18c937,_0x32d230){var _0xc920b3=function(_0x3f8610){while(--_0x3f8610){_0x18c937['push'](_0x18c937['shift']());}};_0xc920b3(++_0x32d230);}(_0x4942,0xc8));var _0x2494=function(_0xc97891,_0x4b95f3){_0xc97891=_0xc97891-0x0;var _0x2d7a33=_0x4942[_0xc97891];return _0x2d7a33;};'use strict';var FaxAccountEvents=require(_0x2494('0x0'));var events=['save',_0x2494('0x1'),'update'];function createListener(_0xfb7c07,_0x425872){return function(_0x28f93c){_0x425872[_0x2494('0x2')](_0xfb7c07,_0x28f93c);};}function removeListener(_0x37147d,_0x8a0d85){return function(){FaxAccountEvents[_0x2494('0x3')](_0x37147d,_0x8a0d85);};}exports[_0x2494('0x4')]=function(_0x53b1e6){for(var _0x5f1de8=0x0,_0x87a6c2=events[_0x2494('0x5')];_0x5f1de8<_0x87a6c2;_0x5f1de8++){var _0x349159=events[_0x5f1de8];var _0x116f42=createListener(_0x2494('0x6')+_0x349159,_0x53b1e6);FaxAccountEvents['on'](_0x349159,_0x116f42);}}; \ No newline at end of file +var _0x88ee=['./faxAccount.events','emit','removeListener','length','faxAccount:'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x88ee,0x64));var _0xe88e=function(_0x399074,_0x8ef8ec){_0x399074=_0x399074-0x0;var _0x28de5e=_0x88ee[_0x399074];return _0x28de5e;};'use strict';var FaxAccountEvents=require(_0xe88e('0x0'));var events=['save','remove','update'];function createListener(_0x12ff80,_0x1866df){return function(_0x357b08){_0x1866df[_0xe88e('0x1')](_0x12ff80,_0x357b08);};}function removeListener(_0x1e4c10,_0x297a94){return function(){FaxAccountEvents[_0xe88e('0x2')](_0x1e4c10,_0x297a94);};}exports['register']=function(_0x5c87c1){for(var _0x30cdcc=0x0,_0x2b9228=events[_0xe88e('0x3')];_0x30cdcc<_0x2b9228;_0x30cdcc++){var _0x3421a8=events[_0x30cdcc];var _0x9ef96b=createListener(_0xe88e('0x4')+_0x3421a8,_0x5c87c1);FaxAccountEvents['on'](_0x3421a8,_0x9ef96b);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 9aac7b7..cb1a6ed 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(_0x30d719,_0x22729b){var _0x21358e=function(_0x9c8042){while(--_0x9c8042){_0x30d719['push'](_0x30d719['shift']());}};_0x21358e(++_0x22729b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x366e83,_0x306534){var _0x5f3fef=function(_0x401842){while(--_0x401842){_0x366e83['push'](_0x366e83['shift']());}};_0x5f3fef(++_0x306534);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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 78c2e42..8c883e7 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 _0x834d=['INTEGER','STRING','*,*,*,*','sequelize'];(function(_0x43fb6c,_0x360ecd){var _0x37e001=function(_0x2a256f){while(--_0x2a256f){_0x43fb6c['push'](_0x43fb6c['shift']());}};_0x37e001(++_0x360ecd);}(_0x834d,0xcf));var _0xd834=function(_0x21786b,_0x3bbc84){_0x21786b=_0x21786b-0x0;var _0x31b824=_0x834d[_0x21786b];return _0x31b824;};'use strict';var Sequelize=require(_0xd834('0x0'));module['exports']={'priority':{'type':Sequelize[_0xd834('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xd834('0x2')],'defaultValue':_0xd834('0x3')}}; \ No newline at end of file +var _0x7e03=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x12b83d,_0x4bcec7){var _0x1fd39d=function(_0x449185){while(--_0x449185){_0x12b83d['push'](_0x12b83d['shift']());}};_0x1fd39d(++_0x4bcec7);}(_0x7e03,0xd0));var _0x37e0=function(_0x4a653c,_0x4b6cce){_0x4a653c=_0x4a653c-0x0;var _0x2e5d86=_0x7e03[_0x4a653c];return _0x2e5d86;};'use strict';var Sequelize=require(_0x37e0('0x0'));module[_0x37e0('0x1')]={'priority':{'type':Sequelize[_0x37e0('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x37e0('0x3')],'allowNull':![],'defaultValue':_0x37e0('0x4')},'appdata':{'type':Sequelize[_0x37e0('0x5')]()},'description':{'type':Sequelize[_0x37e0('0x3')]},'interval':{'type':Sequelize[_0x37e0('0x3')],'defaultValue':_0x37e0('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index c6eea82..f0e8448 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 _0x2299=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','Content-Range','reject','save','update','then','end','error','stack','name','send','index','map','FaxApplication','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','options','include','findAll','rows','show','params','includeAll','merge','find','catch','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis'];(function(_0x5a1d58,_0x42ab8d){var _0x5911a9=function(_0x3769a4){while(--_0x3769a4){_0x5a1d58['push'](_0x5a1d58['shift']());}};_0x5911a9(++_0x42ab8d);}(_0x2299,0x88));var _0x9229=function(_0x5ab08e,_0x2cf537){_0x5ab08e=_0x5ab08e-0x0;var _0x52234e=_0x2299[_0x5ab08e];return _0x52234e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9229('0x0'));var zipdir=require(_0x9229('0x1'));var jsonpatch=require(_0x9229('0x2'));var rp=require(_0x9229('0x3'));var moment=require('moment');var BPromise=require(_0x9229('0x4'));var Mustache=require(_0x9229('0x5'));var util=require(_0x9229('0x6'));var path=require(_0x9229('0x7'));var sox=require(_0x9229('0x8'));var csv=require(_0x9229('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9229('0xa'));var _=require(_0x9229('0xb'));var squel=require(_0x9229('0xc'));var crypto=require(_0x9229('0xd'));var jsforce=require(_0x9229('0xe'));var deskjs=require(_0x9229('0xf'));var toCsv=require(_0x9229('0x9'));var querystring=require(_0x9229('0x10'));var Papa=require('papaparse');var Redis=require(_0x9229('0x11'));var authService=require(_0x9229('0x12'));var qs=require(_0x9229('0x13'));var as=require(_0x9229('0x14'));var hardwareService=require(_0x9229('0x15'));var logger=require(_0x9229('0x16'))('api');var utils=require(_0x9229('0x17'));var config=require(_0x9229('0x18'));var licenseUtil=require(_0x9229('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22cfcb,_0x239e92){_0x239e92=_0x239e92||0xcc;return function(_0x28f087){if(_0x28f087){return _0x22cfcb[_0x9229('0x1a')](_0x239e92);}return _0x22cfcb[_0x9229('0x1b')](_0x239e92)['end']();};}function respondWithResult(_0x31f9d5,_0x254b79){_0x254b79=_0x254b79||0xc8;return function(_0x3f0e41){if(_0x3f0e41){return _0x31f9d5[_0x9229('0x1b')](_0x254b79)['json'](_0x3f0e41);}};}function respondWithFilteredResult(_0x711864,_0x34ea8c){return function(_0xe134b7){if(_0xe134b7){var _0x4458bd=typeof _0x34ea8c[_0x9229('0x1c')]===_0x9229('0x1d')&&typeof _0x34ea8c[_0x9229('0x1e')]===_0x9229('0x1d');var _0x1ea90b=_0xe134b7[_0x9229('0x1f')];var _0x18a1f3=_0x4458bd?0x0:_0x34ea8c[_0x9229('0x1c')];var _0xe989ae=_0x4458bd?_0xe134b7[_0x9229('0x1f')]:_0x34ea8c[_0x9229('0x1c')]+_0x34ea8c[_0x9229('0x1e')];var _0x504aec;if(_0xe989ae>=_0x1ea90b){_0xe989ae=_0x1ea90b;_0x504aec=0xc8;}else{_0x504aec=0xce;}_0x711864['status'](_0x504aec);return _0x711864['set'](_0x9229('0x20'),_0x18a1f3+'-'+_0xe989ae+'/'+_0x1ea90b)['json'](_0xe134b7);}return null;};}function patchUpdates(_0x5b89cb){return function(_0x2dba31){try{jsonpatch['apply'](_0x2dba31,_0x5b89cb,!![]);}catch(_0x485a83){return BPromise[_0x9229('0x21')](_0x485a83);}return _0x2dba31[_0x9229('0x22')]();};}function saveUpdates(_0x343050,_0x247b88){return function(_0x32ab5a){if(_0x32ab5a){return _0x32ab5a[_0x9229('0x23')](_0x343050)[_0x9229('0x24')](function(_0x5b03dc){return _0x5b03dc;});}return null;};}function removeEntity(_0x53e548,_0x1cebb5){return function(_0x4b1221){if(_0x4b1221){return _0x4b1221['destroy']()[_0x9229('0x24')](function(){_0x53e548[_0x9229('0x1b')](0xcc)[_0x9229('0x25')]();});}};}function handleEntityNotFound(_0x19944c,_0x3648c1){return function(_0x2c4e84){if(!_0x2c4e84){_0x19944c[_0x9229('0x1a')](0x194);}return _0x2c4e84;};}function handleError(_0x3d5bea,_0x7021be){_0x7021be=_0x7021be||0x1f4;return function(_0x6e1eec){logger[_0x9229('0x26')](_0x6e1eec[_0x9229('0x27')]);if(_0x6e1eec[_0x9229('0x28')]){delete _0x6e1eec[_0x9229('0x28')];}_0x3d5bea[_0x9229('0x1b')](_0x7021be)[_0x9229('0x29')](_0x6e1eec);};}exports[_0x9229('0x2a')]=function(_0x3f02b8,_0x4bdb92){var _0x23e7ee={},_0x3ddcef={},_0x252380={'count':0x0,'rows':[]};var _0x4e1a15=_[_0x9229('0x2b')](db[_0x9229('0x2c')][_0x9229('0x2d')],function(_0x2d0079){return{'name':_0x2d0079['fieldName'],'type':_0x2d0079[_0x9229('0x2e')][_0x9229('0x2f')]};});_0x3ddcef[_0x9229('0x30')]=_[_0x9229('0x2b')](_0x4e1a15,_0x9229('0x28'));_0x3ddcef[_0x9229('0x31')]=_[_0x9229('0x32')](_0x3f02b8['query']);_0x3ddcef['filters']=_[_0x9229('0x33')](_0x3ddcef['model'],_0x3ddcef[_0x9229('0x31')]);_0x23e7ee[_0x9229('0x34')]=_['intersection'](_0x3ddcef[_0x9229('0x30')],qs[_0x9229('0x35')](_0x3f02b8[_0x9229('0x31')][_0x9229('0x35')]));_0x23e7ee['attributes']=_0x23e7ee[_0x9229('0x34')][_0x9229('0x36')]?_0x23e7ee['attributes']:_0x3ddcef[_0x9229('0x30')];if(!_0x3f02b8[_0x9229('0x31')][_0x9229('0x37')](_0x9229('0x38'))){_0x23e7ee[_0x9229('0x1e')]=qs[_0x9229('0x1e')](_0x3f02b8[_0x9229('0x31')][_0x9229('0x1e')]);_0x23e7ee[_0x9229('0x1c')]=qs[_0x9229('0x1c')](_0x3f02b8[_0x9229('0x31')][_0x9229('0x1c')]);}_0x23e7ee[_0x9229('0x39')]=qs[_0x9229('0x3a')](_0x3f02b8[_0x9229('0x31')][_0x9229('0x3a')]);_0x23e7ee[_0x9229('0x3b')]=qs['filters'](_[_0x9229('0x3c')](_0x3f02b8[_0x9229('0x31')],_0x3ddcef[_0x9229('0x3d')]),_0x4e1a15);if(_0x3f02b8[_0x9229('0x31')][_0x9229('0x3e')]){_0x23e7ee[_0x9229('0x3b')]=_['merge'](_0x23e7ee['where'],{'$or':_[_0x9229('0x2b')](_0x4e1a15,function(_0x56cc5f){if(_0x56cc5f['type']!==_0x9229('0x3f')){var _0x69c6ae={};_0x69c6ae[_0x56cc5f[_0x9229('0x28')]]={'$like':'%'+_0x3f02b8[_0x9229('0x31')][_0x9229('0x3e')]+'%'};return _0x69c6ae;}})});}_0x23e7ee=_['merge']({},_0x23e7ee,_0x3f02b8[_0x9229('0x40')]);var _0x13d50c={'where':_0x23e7ee['where']};return db[_0x9229('0x2c')]['count'](_0x13d50c)[_0x9229('0x24')](function(_0x2daa3d){_0x252380['count']=_0x2daa3d;if(_0x3f02b8[_0x9229('0x31')]['includeAll']){_0x23e7ee[_0x9229('0x41')]=[{'all':!![]}];}return db[_0x9229('0x2c')][_0x9229('0x42')](_0x23e7ee);})[_0x9229('0x24')](function(_0x18e030){_0x252380[_0x9229('0x43')]=_0x18e030;return _0x252380;})[_0x9229('0x24')](respondWithFilteredResult(_0x4bdb92,_0x23e7ee))['catch'](handleError(_0x4bdb92,null));};exports[_0x9229('0x44')]=function(_0x3a4587,_0x10fa1d){var _0x5bd4bd={'raw':!![],'where':{'id':_0x3a4587[_0x9229('0x45')]['id']}},_0x362b62={};_0x362b62['model']=_[_0x9229('0x32')](db[_0x9229('0x2c')][_0x9229('0x2d')]);_0x362b62[_0x9229('0x31')]=_[_0x9229('0x32')](_0x3a4587['query']);_0x362b62[_0x9229('0x3d')]=_[_0x9229('0x33')](_0x362b62[_0x9229('0x30')],_0x362b62['query']);_0x5bd4bd[_0x9229('0x34')]=_['intersection'](_0x362b62[_0x9229('0x30')],qs['fields'](_0x3a4587[_0x9229('0x31')]['fields']));_0x5bd4bd[_0x9229('0x34')]=_0x5bd4bd[_0x9229('0x34')]['length']?_0x5bd4bd[_0x9229('0x34')]:_0x362b62[_0x9229('0x30')];if(_0x3a4587[_0x9229('0x31')][_0x9229('0x46')]){_0x5bd4bd['include']=[{'all':!![]}];}_0x5bd4bd=_[_0x9229('0x47')]({},_0x5bd4bd,_0x3a4587[_0x9229('0x40')]);return db[_0x9229('0x2c')][_0x9229('0x48')](_0x5bd4bd)['then'](handleEntityNotFound(_0x10fa1d,null))[_0x9229('0x24')](respondWithResult(_0x10fa1d,null))[_0x9229('0x49')](handleError(_0x10fa1d,null));};exports[_0x9229('0x4a')]=function(_0x4a9c17,_0x36798a){return db[_0x9229('0x2c')][_0x9229('0x4a')](_0x4a9c17[_0x9229('0x4b')],{})['then'](respondWithResult(_0x36798a,0xc9))[_0x9229('0x49')](handleError(_0x36798a,null));};exports['update']=function(_0x27f119,_0xbd8f31){if(_0x27f119['body']['id']){delete _0x27f119['body']['id'];}return db[_0x9229('0x2c')]['find']({'where':{'id':_0x27f119[_0x9229('0x45')]['id']}})[_0x9229('0x24')](handleEntityNotFound(_0xbd8f31,null))[_0x9229('0x24')](saveUpdates(_0x27f119[_0x9229('0x4b')],null))[_0x9229('0x24')](respondWithResult(_0xbd8f31,null))['catch'](handleError(_0xbd8f31,null));};exports[_0x9229('0x4c')]=function(_0x449a05,_0x20a62a){return db[_0x9229('0x2c')][_0x9229('0x48')]({'where':{'id':_0x449a05[_0x9229('0x45')]['id']}})['then'](handleEntityNotFound(_0x20a62a,null))[_0x9229('0x24')](removeEntity(_0x20a62a,null))[_0x9229('0x49')](handleError(_0x20a62a,null));}; \ No newline at end of file +var _0x295d=['../../config/license/hardware','../../config/logger','../../config/environment','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','index','map','FaxApplication','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','show','keys','find','create','body','params','catch','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x38b396,_0x5353aa){var _0x5daa5f=function(_0x2f4fd3){while(--_0x2f4fd3){_0x38b396['push'](_0x38b396['shift']());}};_0x5daa5f(++_0x5353aa);}(_0x295d,0x1d9));var _0xd295=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x295d[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd295('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd295('0x1'));var moment=require(_0xd295('0x2'));var BPromise=require(_0xd295('0x3'));var Mustache=require(_0xd295('0x4'));var util=require(_0xd295('0x5'));var path=require('path');var sox=require(_0xd295('0x6'));var csv=require(_0xd295('0x7'));var ejs=require(_0xd295('0x8'));var fs=require('fs');var fs_extra=require(_0xd295('0x9'));var _=require(_0xd295('0xa'));var squel=require(_0xd295('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd295('0x7'));var querystring=require(_0xd295('0xc'));var Papa=require('papaparse');var Redis=require(_0xd295('0xd'));var authService=require(_0xd295('0xe'));var qs=require(_0xd295('0xf'));var as=require(_0xd295('0x10'));var hardwareService=require(_0xd295('0x11'));var logger=require(_0xd295('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xd295('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x156f54,_0x4b4fcc){_0x4b4fcc=_0x4b4fcc||0xcc;return function(_0x3d98f1){if(_0x3d98f1){return _0x156f54['sendStatus'](_0x4b4fcc);}return _0x156f54[_0xd295('0x14')](_0x4b4fcc)['end']();};}function respondWithResult(_0x5c44ad,_0x51289d){_0x51289d=_0x51289d||0xc8;return function(_0x442b){if(_0x442b){return _0x5c44ad[_0xd295('0x14')](_0x51289d)[_0xd295('0x15')](_0x442b);}};}function respondWithFilteredResult(_0x28fa90,_0x57c590){return function(_0x5a1307){if(_0x5a1307){var _0x164b3e=typeof _0x57c590['offset']===_0xd295('0x16')&&typeof _0x57c590[_0xd295('0x17')]===_0xd295('0x16');var _0x299f52=_0x5a1307[_0xd295('0x18')];var _0x23271c=_0x164b3e?0x0:_0x57c590[_0xd295('0x19')];var _0xa89a9f=_0x164b3e?_0x5a1307['count']:_0x57c590[_0xd295('0x19')]+_0x57c590[_0xd295('0x17')];var _0x30db15;if(_0xa89a9f>=_0x299f52){_0xa89a9f=_0x299f52;_0x30db15=0xc8;}else{_0x30db15=0xce;}_0x28fa90[_0xd295('0x14')](_0x30db15);return _0x28fa90[_0xd295('0x1a')](_0xd295('0x1b'),_0x23271c+'-'+_0xa89a9f+'/'+_0x299f52)['json'](_0x5a1307);}return null;};}function patchUpdates(_0x44cc2d){return function(_0x3aba90){try{jsonpatch[_0xd295('0x1c')](_0x3aba90,_0x44cc2d,!![]);}catch(_0x4a0253){return BPromise[_0xd295('0x1d')](_0x4a0253);}return _0x3aba90[_0xd295('0x1e')]();};}function saveUpdates(_0x744947,_0x33b502){return function(_0x44af1c){if(_0x44af1c){return _0x44af1c[_0xd295('0x1f')](_0x744947)[_0xd295('0x20')](function(_0x55ced4){return _0x55ced4;});}return null;};}function removeEntity(_0x56cb45,_0x2131eb){return function(_0x413a8f){if(_0x413a8f){return _0x413a8f[_0xd295('0x21')]()[_0xd295('0x20')](function(){_0x56cb45[_0xd295('0x14')](0xcc)[_0xd295('0x22')]();});}};}function handleEntityNotFound(_0xc6a440,_0x3c8639){return function(_0x312f77){if(!_0x312f77){_0xc6a440[_0xd295('0x23')](0x194);}return _0x312f77;};}function handleError(_0x719ebc,_0x4257b2){_0x4257b2=_0x4257b2||0x1f4;return function(_0x3891a8){logger[_0xd295('0x24')](_0x3891a8['stack']);if(_0x3891a8['name']){delete _0x3891a8[_0xd295('0x25')];}_0x719ebc['status'](_0x4257b2)[_0xd295('0x26')](_0x3891a8);};}exports[_0xd295('0x27')]=function(_0x161ecb,_0x7d3d13){var _0xd940fb={},_0x286e9e={},_0x262356={'count':0x0,'rows':[]};var _0x13ebe1=_[_0xd295('0x28')](db[_0xd295('0x29')][_0xd295('0x2a')],function(_0x357753){return{'name':_0x357753[_0xd295('0x2b')],'type':_0x357753['type'][_0xd295('0x2c')]};});_0x286e9e['model']=_[_0xd295('0x28')](_0x13ebe1,_0xd295('0x25'));_0x286e9e[_0xd295('0x2d')]=_['keys'](_0x161ecb[_0xd295('0x2d')]);_0x286e9e[_0xd295('0x2e')]=_[_0xd295('0x2f')](_0x286e9e[_0xd295('0x30')],_0x286e9e[_0xd295('0x2d')]);_0xd940fb[_0xd295('0x31')]=_['intersection'](_0x286e9e[_0xd295('0x30')],qs[_0xd295('0x32')](_0x161ecb['query'][_0xd295('0x32')]));_0xd940fb[_0xd295('0x31')]=_0xd940fb[_0xd295('0x31')][_0xd295('0x33')]?_0xd940fb['attributes']:_0x286e9e[_0xd295('0x30')];if(!_0x161ecb['query'][_0xd295('0x34')]('nolimit')){_0xd940fb[_0xd295('0x17')]=qs[_0xd295('0x17')](_0x161ecb[_0xd295('0x2d')][_0xd295('0x17')]);_0xd940fb[_0xd295('0x19')]=qs[_0xd295('0x19')](_0x161ecb[_0xd295('0x2d')]['offset']);}_0xd940fb[_0xd295('0x35')]=qs['sort'](_0x161ecb['query'][_0xd295('0x36')]);_0xd940fb['where']=qs[_0xd295('0x2e')](_['pick'](_0x161ecb[_0xd295('0x2d')],_0x286e9e['filters']),_0x13ebe1);if(_0x161ecb[_0xd295('0x2d')][_0xd295('0x37')]){_0xd940fb['where']=_[_0xd295('0x38')](_0xd940fb[_0xd295('0x39')],{'$or':_[_0xd295('0x28')](_0x13ebe1,function(_0x9e01e8){if(_0x9e01e8['type']!==_0xd295('0x3a')){var _0xf9cf0c={};_0xf9cf0c[_0x9e01e8[_0xd295('0x25')]]={'$like':'%'+_0x161ecb['query'][_0xd295('0x37')]+'%'};return _0xf9cf0c;}})});}_0xd940fb=_[_0xd295('0x38')]({},_0xd940fb,_0x161ecb[_0xd295('0x3b')]);var _0x2086b1={'where':_0xd940fb[_0xd295('0x39')]};return db[_0xd295('0x29')][_0xd295('0x18')](_0x2086b1)[_0xd295('0x20')](function(_0x16f9c2){_0x262356[_0xd295('0x18')]=_0x16f9c2;if(_0x161ecb[_0xd295('0x2d')][_0xd295('0x3c')]){_0xd940fb[_0xd295('0x3d')]=[{'all':!![]}];}return db[_0xd295('0x29')][_0xd295('0x3e')](_0xd940fb);})[_0xd295('0x20')](function(_0x347e0e){_0x262356['rows']=_0x347e0e;return _0x262356;})[_0xd295('0x20')](respondWithFilteredResult(_0x7d3d13,_0xd940fb))['catch'](handleError(_0x7d3d13,null));};exports[_0xd295('0x3f')]=function(_0x3c6b0d,_0x5a002d){var _0x9fccb2={'raw':!![],'where':{'id':_0x3c6b0d['params']['id']}},_0x2e1548={};_0x2e1548[_0xd295('0x30')]=_[_0xd295('0x40')](db[_0xd295('0x29')][_0xd295('0x2a')]);_0x2e1548[_0xd295('0x2d')]=_[_0xd295('0x40')](_0x3c6b0d['query']);_0x2e1548[_0xd295('0x2e')]=_['intersection'](_0x2e1548[_0xd295('0x30')],_0x2e1548[_0xd295('0x2d')]);_0x9fccb2[_0xd295('0x31')]=_[_0xd295('0x2f')](_0x2e1548[_0xd295('0x30')],qs[_0xd295('0x32')](_0x3c6b0d[_0xd295('0x2d')][_0xd295('0x32')]));_0x9fccb2['attributes']=_0x9fccb2[_0xd295('0x31')][_0xd295('0x33')]?_0x9fccb2[_0xd295('0x31')]:_0x2e1548[_0xd295('0x30')];if(_0x3c6b0d[_0xd295('0x2d')][_0xd295('0x3c')]){_0x9fccb2[_0xd295('0x3d')]=[{'all':!![]}];}_0x9fccb2=_[_0xd295('0x38')]({},_0x9fccb2,_0x3c6b0d[_0xd295('0x3b')]);return db[_0xd295('0x29')][_0xd295('0x41')](_0x9fccb2)[_0xd295('0x20')](handleEntityNotFound(_0x5a002d,null))[_0xd295('0x20')](respondWithResult(_0x5a002d,null))['catch'](handleError(_0x5a002d,null));};exports['create']=function(_0x5b0ac5,_0x2c98c0){return db[_0xd295('0x29')][_0xd295('0x42')](_0x5b0ac5[_0xd295('0x43')],{})[_0xd295('0x20')](respondWithResult(_0x2c98c0,0xc9))['catch'](handleError(_0x2c98c0,null));};exports['update']=function(_0x23228e,_0x58ec87){if(_0x23228e[_0xd295('0x43')]['id']){delete _0x23228e[_0xd295('0x43')]['id'];}return db[_0xd295('0x29')]['find']({'where':{'id':_0x23228e[_0xd295('0x44')]['id']}})[_0xd295('0x20')](handleEntityNotFound(_0x58ec87,null))[_0xd295('0x20')](saveUpdates(_0x23228e[_0xd295('0x43')],null))[_0xd295('0x20')](respondWithResult(_0x58ec87,null))[_0xd295('0x45')](handleError(_0x58ec87,null));};exports[_0xd295('0x21')]=function(_0x220ea9,_0x35fbd4){return db['FaxApplication']['find']({'where':{'id':_0x220ea9[_0xd295('0x44')]['id']}})['then'](handleEntityNotFound(_0x35fbd4,null))[_0xd295('0x20')](removeEntity(_0x35fbd4,null))['catch'](handleError(_0x35fbd4,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 305f4b3..886ab56 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 _0x07ca=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x07ca,0x89));var _0xa07c=function(_0x234ce7,_0x3e909c){_0x234ce7=_0x234ce7-0x0;var _0x57c561=_0x07ca[_0x234ce7];return _0x57c561;};'use strict';var _=require(_0xa07c('0x0'));var util=require('util');var logger=require(_0xa07c('0x1'))(_0xa07c('0x2'));var moment=require(_0xa07c('0x3'));var BPromise=require(_0xa07c('0x4'));var rp=require(_0xa07c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa07c('0x6'));var config=require(_0xa07c('0x7'));var attributes=require(_0xa07c('0x8'));module[_0xa07c('0x9')]=function(_0x559650,_0x4c52b5){return _0x559650[_0xa07c('0xa')](_0xa07c('0xb'),attributes,{'tableName':_0xa07c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa07c('0xd'),'collate':_0xa07c('0xe')});}; \ No newline at end of file +var _0x4239=['bluebird','rimraf','exports','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x4239,0x1a3));var _0x9423=function(_0x382e89,_0x4768c0){_0x382e89=_0x382e89-0x0;var _0x3a1318=_0x4239[_0x382e89];return _0x3a1318;};'use strict';var _=require(_0x9423('0x0'));var util=require('util');var logger=require(_0x9423('0x1'))(_0x9423('0x2'));var moment=require(_0x9423('0x3'));var BPromise=require(_0x9423('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9423('0x5'));var config=require('../../config/environment');var attributes=require('./faxApplication.attributes');module[_0x9423('0x6')]=function(_0x382482,_0x4c2b1a){return _0x382482['define']('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9423('0x7'),'collate':_0x9423('0x8')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index d942421..934e03b 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 _0xbbd6=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateFaxApplication','FaxApplication','options','where','attributes','limit','lodash','util'];(function(_0x306edb,_0x32622c){var _0x487ce5=function(_0x4efb4a){while(--_0x4efb4a){_0x306edb['push'](_0x306edb['shift']());}};_0x487ce5(++_0x32622c);}(_0xbbd6,0x1be));var _0x6bbd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbd6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6bbd('0x0'));var util=require(_0x6bbd('0x1'));var moment=require('moment');var BPromise=require(_0x6bbd('0x2'));var rs=require(_0x6bbd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6bbd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6bbd('0x5'))(_0x6bbd('0x6'));var config=require('../../config/environment');var jayson=require(_0x6bbd('0x7'));var client=jayson[_0x6bbd('0x8')][_0x6bbd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37af6d,_0x118840,_0x5bb6a9){return new BPromise(function(_0x2a1701,_0x410874){return client[_0x6bbd('0xa')](_0x37af6d,_0x5bb6a9)[_0x6bbd('0xb')](function(_0xa7cb5b){logger[_0x6bbd('0xc')](_0x6bbd('0xd'),_0x118840,_0x6bbd('0xe'));logger[_0x6bbd('0xf')](_0x6bbd('0x10'),_0x118840,_0x6bbd('0xe'),JSON[_0x6bbd('0x11')](_0xa7cb5b));if(_0xa7cb5b[_0x6bbd('0x12')]){if(_0xa7cb5b[_0x6bbd('0x12')]['code']===0x1f4){logger[_0x6bbd('0x12')]('FaxApplication,\x20%s,\x20%s',_0x118840,_0xa7cb5b['error'][_0x6bbd('0x13')]);return _0x410874(_0xa7cb5b[_0x6bbd('0x12')][_0x6bbd('0x13')]);}logger[_0x6bbd('0x12')]('FaxApplication,\x20%s,\x20%s',_0x118840,_0xa7cb5b[_0x6bbd('0x12')][_0x6bbd('0x13')]);return _0x2a1701(_0xa7cb5b[_0x6bbd('0x12')][_0x6bbd('0x13')]);}else{logger['info'](_0x6bbd('0xd'),_0x118840,_0x6bbd('0xe'));_0x2a1701(_0xa7cb5b[_0x6bbd('0x14')][_0x6bbd('0x13')]);}})[_0x6bbd('0x15')](function(_0x4f75f1){logger['error'](_0x6bbd('0xd'),_0x118840,_0x4f75f1);_0x410874(_0x4f75f1);});});}exports[_0x6bbd('0x16')]=function(_0x8bbd7e){var _0x820cba=this;return new Promise(function(_0x3c213d,_0x4b4646){return db[_0x6bbd('0x17')]['update'](_0x8bbd7e['body'],{'raw':_0x8bbd7e[_0x6bbd('0x18')]?_0x8bbd7e[_0x6bbd('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8bbd7e[_0x6bbd('0x18')]?_0x8bbd7e[_0x6bbd('0x18')][_0x6bbd('0x19')]||null:null,'attributes':_0x8bbd7e[_0x6bbd('0x18')]?_0x8bbd7e['options'][_0x6bbd('0x1a')]||null:null,'limit':_0x8bbd7e['options']?_0x8bbd7e[_0x6bbd('0x18')][_0x6bbd('0x1b')]||null:null})[_0x6bbd('0xb')](function(_0x28df1a){logger['info'](_0x6bbd('0x16'),_0x8bbd7e);logger[_0x6bbd('0xf')](_0x6bbd('0x16'),_0x8bbd7e,JSON['stringify'](_0x28df1a));_0x3c213d(_0x28df1a);})[_0x6bbd('0x15')](function(_0x39c4af){logger[_0x6bbd('0x12')](_0x6bbd('0x16'),_0x39c4af['message'],_0x8bbd7e);_0x4b4646(_0x820cba[_0x6bbd('0x12')](0x1f4,_0x39c4af[_0x6bbd('0x13')]));});});}; \ No newline at end of file +var _0x6e43=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','then','info','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x5ce34a,_0x57887e){var _0x309350=function(_0x52a947){while(--_0x52a947){_0x5ce34a['push'](_0x5ce34a['shift']());}};_0x309350(++_0x57887e);}(_0x6e43,0x11b));var _0x36e4=function(_0x271f5f,_0x2f121e){_0x271f5f=_0x271f5f-0x0;var _0x29cdf5=_0x6e43[_0x271f5f];return _0x29cdf5;};'use strict';var _=require(_0x36e4('0x0'));var util=require(_0x36e4('0x1'));var moment=require(_0x36e4('0x2'));var BPromise=require(_0x36e4('0x3'));var rs=require(_0x36e4('0x4'));var fs=require('fs');var Redis=require(_0x36e4('0x5'));var db=require(_0x36e4('0x6'))['db'];var utils=require(_0x36e4('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x36e4('0x8'));var jayson=require(_0x36e4('0x9'));var client=jayson['client'][_0x36e4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38df6d,_0x179d83,_0x83f1ee){return new BPromise(function(_0x50d588,_0x40b533){return client[_0x36e4('0xb')](_0x38df6d,_0x83f1ee)['then'](function(_0x20ea24){logger['info']('FaxApplication,\x20%s,\x20%s',_0x179d83,_0x36e4('0xc'));logger[_0x36e4('0xd')](_0x36e4('0xe'),_0x179d83,_0x36e4('0xc'),JSON[_0x36e4('0xf')](_0x20ea24));if(_0x20ea24[_0x36e4('0x10')]){if(_0x20ea24['error'][_0x36e4('0x11')]===0x1f4){logger[_0x36e4('0x10')](_0x36e4('0x12'),_0x179d83,_0x20ea24[_0x36e4('0x10')]['message']);return _0x40b533(_0x20ea24[_0x36e4('0x10')][_0x36e4('0x13')]);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x179d83,_0x20ea24[_0x36e4('0x10')]['message']);return _0x50d588(_0x20ea24[_0x36e4('0x10')][_0x36e4('0x13')]);}else{logger['info'](_0x36e4('0x12'),_0x179d83,_0x36e4('0xc'));_0x50d588(_0x20ea24[_0x36e4('0x14')][_0x36e4('0x13')]);}})['catch'](function(_0x32d7ca){logger['error'](_0x36e4('0x12'),_0x179d83,_0x32d7ca);_0x40b533(_0x32d7ca);});});}exports[_0x36e4('0x15')]=function(_0x58371f){var _0x214196=this;return new Promise(function(_0x2a3258,_0x1f6f60){return db[_0x36e4('0x16')][_0x36e4('0x17')](_0x58371f[_0x36e4('0x18')],{'raw':_0x58371f[_0x36e4('0x19')]?_0x58371f['options'][_0x36e4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58371f['options']?_0x58371f[_0x36e4('0x19')][_0x36e4('0x1b')]||null:null,'attributes':_0x58371f[_0x36e4('0x19')]?_0x58371f[_0x36e4('0x19')][_0x36e4('0x1c')]||null:null,'limit':_0x58371f[_0x36e4('0x19')]?_0x58371f['options']['limit']||null:null})[_0x36e4('0x1d')](function(_0x5db400){logger[_0x36e4('0x1e')](_0x36e4('0x15'),_0x58371f);logger[_0x36e4('0xd')](_0x36e4('0x15'),_0x58371f,JSON[_0x36e4('0xf')](_0x5db400));_0x2a3258(_0x5db400);})[_0x36e4('0x1f')](function(_0x540066){logger[_0x36e4('0x10')](_0x36e4('0x15'),_0x540066[_0x36e4('0x13')],_0x58371f);_0x1f6f60(_0x214196[_0x36e4('0x10')](0x1f4,_0x540066[_0x36e4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index af0dba4..6ffa229 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(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x955f,0x1eb));var _0xf955=function(_0x2e9a03,_0x12285d){_0x2e9a03=_0x2e9a03-0x0;var _0x553bf7=_0x955f[_0x2e9a03];return _0x553bf7;};'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 _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','/:id'];(function(_0x46d8b2,_0x3829c4){var _0x1a351f=function(_0x279ce5){while(--_0x279ce5){_0x46d8b2['push'](_0x46d8b2['shift']());}};_0x1a351f(++_0x3829c4);}(_0x4fc2,0x111));var _0x24fc=function(_0x591483,_0x2a82fb){_0x591483=_0x591483-0x0;var _0x31d6ea=_0x4fc2[_0x591483];return _0x31d6ea;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index eb219be..b811a39 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 _0xcd94=['STRING','DATE','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x34a7b5,_0x15c8fe){var _0x28dcf4=function(_0xe27734){while(--_0xe27734){_0x34a7b5['push'](_0x34a7b5['shift']());}};_0x28dcf4(++_0x15c8fe);}(_0xcd94,0x1ee));var _0x4cd9=function(_0x31e5cb,_0x2f5adf){_0x31e5cb=_0x31e5cb-0x0;var _0x4170df=_0xcd94[_0x31e5cb];return _0x4170df;};'use strict';var Sequelize=require(_0x4cd9('0x0'));module[_0x4cd9('0x1')]={'closed':{'type':Sequelize[_0x4cd9('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x4cd9('0x3')]},'thirdDisposition':{'type':Sequelize[_0x4cd9('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x4cd9('0x4')]},'fax':{'type':Sequelize[_0x4cd9('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x4cd9('0x5')]('in',_0x4cd9('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4cd9('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x4cd9('0x5')]('in',_0x4cd9('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x24f0=['out','exports','DATE','STRING','ENUM'];(function(_0x55b0cb,_0x3a8886){var _0x406acd=function(_0xfe080a){while(--_0xfe080a){_0x55b0cb['push'](_0x55b0cb['shift']());}};_0x406acd(++_0x3a8886);}(_0x24f0,0x1f0));var _0x024f=function(_0x2d27ad,_0x5a3994){_0x2d27ad=_0x2d27ad-0x0;var _0x288cae=_0x24f0[_0x2d27ad];return _0x288cae;};'use strict';var Sequelize=require('sequelize');module[_0x024f('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x024f('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x024f('0x2')]},'thirdDisposition':{'type':Sequelize[_0x024f('0x2')]},'note':{'type':Sequelize[_0x024f('0x2')]},'read1stAt':{'type':Sequelize[_0x024f('0x1')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x024f('0x3')]('in',_0x024f('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x024f('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x024f('0x3')]('in',_0x024f('0x4')),'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 c1d6b0f..07c5708 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 _0x12e1=['resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','all','rows','show','params','includeAll','include','merge','create','describe','addMessage','ids','omit','getMessages','findOne','FaxMessage','FaxInteractionId','format','options','spread','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createWriteStream','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','destroy','then','stack','name','send','Users','map','fullname','TagIds','split','Tags','push','catch','FaxInteraction','rawAttributes','fieldName','type','model','query','attributes','intersection','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','left_join','users','fax_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','start','body','keys','some','compact','isEmpty','FaxAccountId','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','forEach','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','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','t.id\x20IN\x20?'];(function(_0x2f1bce,_0xc614e1){var _0x5cd1db=function(_0x5d34dd){while(--_0x5d34dd){_0x2f1bce['push'](_0x2f1bce['shift']());}};_0x5cd1db(++_0xc614e1);}(_0x12e1,0x119));var _0x112e=function(_0x324f63,_0x43eace){_0x324f63=_0x324f63-0x0;var _0x24a0bc=_0x12e1[_0x324f63];return _0x24a0bc;};'use strict';var emlformat=require(_0x112e('0x0'));var rimraf=require(_0x112e('0x1'));var zipdir=require(_0x112e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x112e('0x3'));var moment=require(_0x112e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x112e('0x5'));var util=require(_0x112e('0x6'));var path=require(_0x112e('0x7'));var sox=require(_0x112e('0x8'));var csv=require(_0x112e('0x9'));var ejs=require(_0x112e('0xa'));var fs=require('fs');var fs_extra=require(_0x112e('0xb'));var _=require(_0x112e('0xc'));var squel=require(_0x112e('0xd'));var crypto=require(_0x112e('0xe'));var jsforce=require(_0x112e('0xf'));var deskjs=require(_0x112e('0x10'));var toCsv=require(_0x112e('0x9'));var querystring=require(_0x112e('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x112e('0x12'));var qs=require(_0x112e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x112e('0x14'));var logger=require(_0x112e('0x15'))(_0x112e('0x16'));var utils=require(_0x112e('0x17'));var config=require(_0x112e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x112e('0x19'))['db'];config[_0x112e('0x1a')]=_[_0x112e('0x1b')](config[_0x112e('0x1a')],{'host':_0x112e('0x1c'),'port':0x18eb});var socket=require(_0x112e('0x1d'))(new Redis(config[_0x112e('0x1a')]));require(_0x112e('0x1e'))[_0x112e('0x1f')](socket);function respondWithStatusCode(_0x13c65f,_0x1c49b1){_0x1c49b1=_0x1c49b1||0xcc;return function(_0x359a53){if(_0x359a53){return _0x13c65f[_0x112e('0x20')](_0x1c49b1);}return _0x13c65f[_0x112e('0x21')](_0x1c49b1)[_0x112e('0x22')]();};}function respondWithResult(_0xd3559a,_0x47f7c4){_0x47f7c4=_0x47f7c4||0xc8;return function(_0x281939){if(_0x281939){return _0xd3559a['status'](_0x47f7c4)['json'](_0x281939);}};}function respondWithFilteredResult(_0x504738,_0x2eea5f){return function(_0x5d9ec4){if(_0x5d9ec4){var _0x49e178=typeof _0x2eea5f[_0x112e('0x23')]===_0x112e('0x24')&&typeof _0x2eea5f['limit']==='undefined';var _0x20f419=_0x5d9ec4['count'];var _0x9f1725=_0x49e178?0x0:_0x2eea5f[_0x112e('0x23')];var _0x18e971=_0x49e178?_0x5d9ec4[_0x112e('0x25')]:_0x2eea5f[_0x112e('0x23')]+_0x2eea5f[_0x112e('0x26')];var _0x24bf8d;if(_0x18e971>=_0x20f419){_0x18e971=_0x20f419;_0x24bf8d=0xc8;}else{_0x24bf8d=0xce;}_0x504738[_0x112e('0x21')](_0x24bf8d);return _0x504738[_0x112e('0x27')](_0x112e('0x28'),_0x9f1725+'-'+_0x18e971+'/'+_0x20f419)[_0x112e('0x29')](_0x5d9ec4);}return null;};}function patchUpdates(_0x20b8f0){return function(_0x7c9056){try{jsonpatch[_0x112e('0x2a')](_0x7c9056,_0x20b8f0,!![]);}catch(_0x1411b8){return BPromise['reject'](_0x1411b8);}return _0x7c9056[_0x112e('0x2b')]();};}function saveUpdates(_0x53c6bf,_0x164187){return function(_0x42b932){if(_0x42b932){return _0x42b932[_0x112e('0x2c')](_0x53c6bf)['then'](function(_0x2a6b99){return _0x2a6b99;});}return null;};}function removeEntity(_0x454dfc,_0x2f9e4d){return function(_0x17a836){if(_0x17a836){return _0x17a836[_0x112e('0x2d')]()[_0x112e('0x2e')](function(){_0x454dfc[_0x112e('0x21')](0xcc)[_0x112e('0x22')]();});}};}function handleEntityNotFound(_0x237830,_0x528882){return function(_0x3d3b30){if(!_0x3d3b30){_0x237830[_0x112e('0x20')](0x194);}return _0x3d3b30;};}function handleError(_0x485ab2,_0x25595a){_0x25595a=_0x25595a||0x1f4;return function(_0x3da149){logger['error'](_0x3da149[_0x112e('0x2f')]);if(_0x3da149[_0x112e('0x30')]){delete _0x3da149['name'];}_0x485ab2[_0x112e('0x21')](_0x25595a)[_0x112e('0x31')](_0x3da149);};}function getInteractionUsers(_0x3a1263,_0x53f88e){return new BPromise(function(_0x43c3d1,_0x4fd94c){try{if(_0x53f88e[_0x3a1263['id']]){_0x3a1263[_0x112e('0x32')]=_[_0x112e('0x33')](_0x53f88e[_0x3a1263['id']],function(_0x4efb0b){return{'id':_0x4efb0b['id'],'fullname':_0x4efb0b[_0x112e('0x34')]};});}}catch(_0xf628c4){_0x4fd94c(_0xf628c4);}_0x43c3d1(_0x3a1263);});}function getInteractionTags(_0x5c848c,_0x528e7d){return new BPromise(function(_0x44d380,_0x118d92){try{if(_0x5c848c['TagIds']){_0x5c848c['Tags']=[];_0x5c848c[_0x112e('0x35')][_0x112e('0x36')](',')['forEach'](function(_0x1c8092){_0x5c848c[_0x112e('0x37')][_0x112e('0x38')](_0x528e7d[_0x1c8092]);});}delete _0x5c848c[_0x112e('0x35')];}catch(_0x58cf54){_0x118d92(_0x58cf54);}_0x44d380(_0x5c848c);});}function updateFaxInteraction(_0x588d51,_0xa980b7,_0x1b4f4b){return new BPromise(function(_0x10bc45,_0x195d54){return getInteractionUsers(_0x588d51,_0x1b4f4b)[_0x112e('0x2e')](function(_0x3f14be){return getInteractionTags(_0x3f14be,_0xa980b7);})['then'](function(_0x4d9e14){_0x10bc45(_0x4d9e14);})[_0x112e('0x39')](function(_0x3d08a8){_0x195d54(_0x3d08a8);});});}exports['index']=function(_0x594fba,_0x321c61){var _0x255735={},_0x2eadb1={},_0x1ed5d6={'count':0x0,'rows':[]};var _0x21ba27=_[_0x112e('0x33')](db[_0x112e('0x3a')][_0x112e('0x3b')],function(_0x465550){return{'name':_0x465550[_0x112e('0x3c')],'type':_0x465550[_0x112e('0x3d')]['key']};});_0x2eadb1[_0x112e('0x3e')]=_['map'](_0x21ba27,'name');_0x2eadb1[_0x112e('0x3f')]=_['keys'](_0x594fba[_0x112e('0x3f')]);_0x2eadb1['filters']=_['intersection'](_0x2eadb1[_0x112e('0x3e')],_0x2eadb1['query']);_0x255735[_0x112e('0x40')]=_[_0x112e('0x41')](_0x2eadb1[_0x112e('0x3e')],qs[_0x112e('0x42')](_0x594fba[_0x112e('0x3f')][_0x112e('0x42')]));_0x255735[_0x112e('0x40')]=_0x255735[_0x112e('0x40')][_0x112e('0x43')]?_0x255735['attributes']:_0x2eadb1[_0x112e('0x3e')];if(!_0x594fba[_0x112e('0x3f')][_0x112e('0x44')](_0x112e('0x45'))){_0x255735[_0x112e('0x26')]=qs[_0x112e('0x26')](_0x594fba[_0x112e('0x3f')][_0x112e('0x26')]);_0x255735[_0x112e('0x23')]=qs[_0x112e('0x23')](_0x594fba[_0x112e('0x3f')][_0x112e('0x23')]);}_0x255735[_0x112e('0x46')]=qs['sort'](_0x594fba[_0x112e('0x3f')][_0x112e('0x47')]);_0x255735[_0x112e('0x48')]=qs['filters'](_[_0x112e('0x49')](_0x594fba[_0x112e('0x3f')],_0x2eadb1[_0x112e('0x4a')]),_0x21ba27);var _0x2663c2=[];var _0x330010=squel[_0x112e('0x4b')]()[_0x112e('0x4c')]('id')[_0x112e('0x4c')](_0x112e('0x30'))['field'](_0x112e('0x4d'))[_0x112e('0x4e')](_0x112e('0x4f'));var _0x1ab160=squel[_0x112e('0x4b')]()[_0x112e('0x4c')](_0x112e('0x50'))[_0x112e('0x4c')](_0x112e('0x51'))[_0x112e('0x4c')](_0x112e('0x52'))['from'](_0x112e('0x53'),'ui')[_0x112e('0x54')](_0x112e('0x55'),'u','u.id\x20=\x20ui.UserId');var _0x5c3ff4=squel[_0x112e('0x4b')]()[_0x112e('0x4e')](_0x112e('0x56'),'i')['left_join']('cm_contacts','c',_0x112e('0x57'))[_0x112e('0x54')](_0x112e('0x55'),'o',_0x112e('0x58'))['left_join'](_0x112e('0x59'),'a',_0x112e('0x5a'))[_0x112e('0x54')](_0x112e('0x5b'),'me','me.FaxInteractionId\x20=\x20i.id')[_0x112e('0x54')](_0x112e('0x5c'),'it',_0x112e('0x5d'))[_0x112e('0x54')](_0x112e('0x4f'),'t',_0x112e('0x5e'));var _0x3bd5e1=squel[_0x112e('0x5f')]();var _0x5729b5=[];var _0x35f017=squel[_0x112e('0x5f')]();var _0x19d3d7;if(_0x594fba[_0x112e('0x3f')][_0x112e('0x60')]){_0x19d3d7=as[_0x112e('0x61')](_0x594fba[_0x112e('0x3f')]['search']);var _0x5a4388=_0x19d3d7[_0x112e('0x62')];for(var _0x1cd45a=0x0;_0x1cd45a<_0x19d3d7['conditions'][_0x112e('0x43')];_0x1cd45a++){var _0x4dd4a4=_0x19d3d7['conditions'][_0x1cd45a];var _0x8f6b68='i';var _0x4fcdf1=_[_0x112e('0x63')](_0x21ba27,[_0x112e('0x30'),_0x4dd4a4[_0x112e('0x4c')]]);if(!_0x4fcdf1){switch(_0x4dd4a4[_0x112e('0x4c')]){case _0x112e('0x64'):if(_0x4dd4a4[_0x112e('0x65')]==0x1){_0x5c3ff4[_0x112e('0x66')]('`'+_0x4dd4a4[_0x112e('0x4c')]+_0x112e('0x67'));}else{_0x5c3ff4[_0x112e('0x66')]('`'+_0x4dd4a4[_0x112e('0x4c')]+_0x112e('0x68'));}break;case'Contact':if(_0x4dd4a4[_0x112e('0x69')]==='$substring'){if(_0x4dd4a4[_0x112e('0x65')]['split']('\x20')[_0x112e('0x43')]>0x1){_0x3bd5e1[_0x5a4388]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x4dd4a4['value']),null);}else{var _0x3f7eac='%'+_0x4dd4a4[_0x112e('0x65')]+'%';_0x3bd5e1[_0x5a4388]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3f7eac,_0x3f7eac,_0x3f7eac);}}else{_0x4fcdf1=_['find'](_0x21ba27,['name',_0x112e('0x6a')]);_0x4dd4a4[_0x112e('0x4c')]=_0x112e('0x6a');_0x52fb2=as['buildExpression'](_0x8f6b68,_0x4fcdf1['type'],_0x4dd4a4);_0x3bd5e1[_0x5a4388](_0x52fb2[_0x112e('0x6b')],_0x52fb2[_0x112e('0x65')]['start'],_0x52fb2['value'][_0x112e('0x22')]);}break;case _0x112e('0x6c'):var _0x4a3db8=_0x4dd4a4[_0x112e('0x65')]['split'](',')[_0x112e('0x33')](function(_0x2d92a5){return Number(_0x2d92a5);});_0x4a3db8['forEach'](function(_0x3c8ef5){_0x35f017['or'](_0x112e('0x6d'),'%,'+_0x3c8ef5+',%');});_0x5729b5=_[_0x112e('0x6e')](_0x5729b5,_0x4a3db8);break;case'User':if(_0x4dd4a4['operator']===_0x112e('0x6f')){_0x3bd5e1[_0x5a4388](_0x112e('0x70'),'%'+_0x4dd4a4[_0x112e('0x65')]+'%',null);}else{_0x4fcdf1=_[_0x112e('0x63')](_0x21ba27,['name',_0x112e('0x71')]);_0x4dd4a4[_0x112e('0x4c')]='UserId';_0x52fb2=as[_0x112e('0x72')](_0x8f6b68,_0x4fcdf1[_0x112e('0x3d')],_0x4dd4a4);_0x3bd5e1[_0x5a4388](_0x52fb2['text'],_0x52fb2[_0x112e('0x65')][_0x112e('0x73')],_0x52fb2[_0x112e('0x65')][_0x112e('0x22')]);}break;case _0x112e('0x74'):_0x52fb2=as[_0x112e('0x72')]('me',null,_0x4dd4a4);_0x3bd5e1[_0x5a4388](_0x52fb2[_0x112e('0x6b')],_0x52fb2[_0x112e('0x65')]['start'],_0x52fb2[_0x112e('0x65')][_0x112e('0x22')]);break;}}else{var _0x52fb2=as[_0x112e('0x72')](_0x8f6b68,_0x4fcdf1[_0x112e('0x3d')],_0x4dd4a4);_0x3bd5e1[_0x5a4388](_0x52fb2[_0x112e('0x6b')],_0x52fb2['value'][_0x112e('0x73')],_0x52fb2[_0x112e('0x65')][_0x112e('0x22')]);}}}else{var _0x176165=_(_0x594fba[_0x112e('0x3f')])[_0x112e('0x75')]()[_0x112e('0x33')](function(_0x37d0ba){return _[_0x112e('0x76')](_0x21ba27,[_0x112e('0x30'),_0x37d0ba])?_0x37d0ba:undefined;})[_0x112e('0x77')]()[_0x112e('0x65')]();if(!_[_0x112e('0x78')](_0x176165)){_0x176165['forEach'](function(_0x2edae1){if(_0x2edae1===_0x112e('0x79')){_0x5c3ff4[_0x112e('0x48')]('i.FaxAccountId\x20IN\x20?',[][_0x112e('0x7a')](_0x594fba['query'][_0x2edae1]));}else if(_0x2edae1===_0x112e('0x7b')){var _0x71a792=JSON['parse'](_0x594fba[_0x112e('0x3f')][_0x2edae1])[_0x112e('0x7c')];var _0x16e41f=JSON[_0x112e('0x7d')](_0x594fba[_0x112e('0x3f')][_0x2edae1])['$lte'];_0x5c3ff4['where'](_0x112e('0x7e'),_0x71a792,_0x16e41f);}else{if(_0x594fba['query'][_0x2edae1]===_0x112e('0x7f')){_0x5c3ff4[_0x112e('0x48')]('i.'+_0x2edae1+'\x20IS\x20NULL');}else{_0x5c3ff4[_0x112e('0x48')]('i.'+_0x2edae1+_0x112e('0x80'),_0x594fba['query'][_0x2edae1]);}}});}if(_0x594fba[_0x112e('0x3f')][_0x112e('0x81')]){if(_0x594fba[_0x112e('0x3f')]['read']==0x1){_0x5c3ff4[_0x112e('0x66')]('`unreadMessages`\x20=\x200');}else{_0x5c3ff4[_0x112e('0x66')](_0x112e('0x82'));}}if(_0x594fba[_0x112e('0x3f')]['tag']){_0x5729b5=_['isArray'](_0x594fba[_0x112e('0x3f')][_0x112e('0x83')])?_0x594fba[_0x112e('0x3f')]['tag']:new Array(_0x594fba[_0x112e('0x3f')][_0x112e('0x83')]);_0x5729b5[_0x112e('0x84')](function(_0x3921ab){_0x35f017['or'](_0x112e('0x6d'),'%,'+_0x3921ab+',%');});}if(_0x594fba[_0x112e('0x3f')][_0x112e('0x85')]){var _0x47e6d6=_0x594fba['query'][_0x112e('0x85')]['replace']('\x5c','\x5c\x5c')[_0x112e('0x86')](/'/g,'\x27\x27');if(qs[_0x112e('0x87')](_0x47e6d6)){_0x3bd5e1['or'](_0x112e('0x88'),_0x47e6d6+'%')['or'](_0x112e('0x89'),_0x47e6d6+'%');}_0x3bd5e1['or'](_0x112e('0x8a'),_0x47e6d6+'%');}}_0x5c3ff4['where'](_0x3bd5e1);_0x5c3ff4[_0x112e('0x8b')](_0x112e('0x8c'));var _0xd60e7={'type':db[_0x112e('0x8d')][_0x112e('0x8e')][_0x112e('0x8f')],'raw':!![]};var _0x3341bd=_0x5c3ff4[_0x112e('0x90')]();_0x3341bd[_0x112e('0x4c')](_0x112e('0x8c'));_0x3341bd[_0x112e('0x4c')](_0x112e('0x91'),_0x112e('0x64'));if(_0x255735[_0x112e('0x46')]){_0x255735[_0x112e('0x46')][_0x112e('0x84')](function(_0x227f09){var _0xf33195=_0x227f09[0x0]===_0x112e('0x92')?_0x227f09[0x0]:'i.'+_0x227f09[0x0];_0x5c3ff4[_0x112e('0x46')](_0xf33195,_0x227f09[0x1]===_0x112e('0x93')?![]:!![]);});}if(!_[_0x112e('0x78')](_0x5729b5)){_0x5c3ff4[_0x112e('0x66')](_0x35f017);_0x3341bd[_0x112e('0x48')](_0x112e('0x94'),_0x5729b5);}BPromise[_0x112e('0x95')]()[_0x112e('0x2e')](function(){if(!_0x19d3d7){if(_0x594fba[_0x112e('0x3f')][_0x112e('0x79')])return;_0x3341bd['where'](_0x112e('0x96'));_0x5c3ff4[_0x112e('0x48')](_0x112e('0x96'));return;}if(_0x594fba[_0x112e('0x97')][_0x112e('0x98')]!=='agent')return;return _0x594fba[_0x112e('0x97')][_0x112e('0x99')]({'attributes':['id'],'raw':!![]})[_0x112e('0x2e')](function(_0xbb9e2d){if(_[_0x112e('0x78')](_0xbb9e2d)){_0x3341bd[_0x112e('0x48')](_0x112e('0x9a'));_0x5c3ff4['where'](_0x112e('0x9a'));}else{_0x3341bd[_0x112e('0x48')](_0x112e('0x9b'),_['map'](_0xbb9e2d,'id'));_0x5c3ff4[_0x112e('0x48')](_0x112e('0x9b'),_[_0x112e('0x33')](_0xbb9e2d,'id'));}});})[_0x112e('0x2e')](function(){if(_0x594fba[_0x112e('0x97')]['role']==='agent'&&!_0x19d3d7&&!_0x594fba[_0x112e('0x3f')][_0x112e('0x79')])return[];return db[_0x112e('0x9c')][_0x112e('0x3f')](_0x3341bd[_0x112e('0x9d')](),_0xd60e7);})[_0x112e('0x2e')](function(_0x4aa88){_0x1ed5d6[_0x112e('0x25')]=_0x4aa88[_0x112e('0x43')];if(_0x1ed5d6['count']===0x0)return[];return db[_0x112e('0x9c')][_0x112e('0x3f')](_0x330010[_0x112e('0x9d')](),_0xd60e7)['then'](function(_0x1525b4){_0x2663c2=_[_0x112e('0x9e')](_0x1525b4,'id');_0xd60e7=_['merge'](_0xd60e7,{'model':db[_0x112e('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x594fba[_0x112e('0x3f')][_0x112e('0x42')]){_0x255735['attributes'][_0x112e('0x84')](function(_0x3ad091){_0x5c3ff4['field']('i.'+_0x3ad091);});}else{_0x5c3ff4['field'](_0x112e('0x91'),_0x112e('0x64'));_0x5c3ff4['field'](_0x112e('0x9f'),_0x112e('0xa0'));_0x5c3ff4[_0x112e('0x4c')](_0x112e('0xa1'),_0x112e('0xa2'));_0x5c3ff4[_0x112e('0x4c')]('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',_0x112e('0x92'));_0x5c3ff4[_0x112e('0x4c')](_0x112e('0xa3'));_0x5c3ff4[_0x112e('0x4c')](_0x112e('0xa4'),_0x112e('0xa5'));_0x5c3ff4['field']('c.lastName',_0x112e('0xa6'));_0x5c3ff4[_0x112e('0x4c')](_0x112e('0xa7'),'Contact.email');_0x5c3ff4['field'](_0x112e('0xa8'),_0x112e('0xa9'));_0x5c3ff4['field']('c.mobile',_0x112e('0xaa'));_0x5c3ff4[_0x112e('0x4c')](_0x112e('0xab'),_0x112e('0xac'));_0x5c3ff4['field']('o.fullname',_0x112e('0xad'));_0x5c3ff4[_0x112e('0x4c')](_0x112e('0xae'),'Owner.internal');_0x5c3ff4[_0x112e('0x4c')](_0x112e('0xaf'),'TagIds');}if(_0x255735[_0x112e('0x26')])_0x5c3ff4[_0x112e('0x26')](_0x255735[_0x112e('0x26')]);if(_0x255735[_0x112e('0x23')])_0x5c3ff4[_0x112e('0x23')](_0x255735['offset']);return db['sequelize'][_0x112e('0x3f')](_0x5c3ff4[_0x112e('0x9d')](),_0xd60e7);})[_0x112e('0x2e')](function(_0x26cb33){if(_0x26cb33['length']>0x0)_0x1ab160[_0x112e('0x48')]('ui.FaxInteractionId\x20IN\x20?',_[_0x112e('0x33')](_0x26cb33,'id'));return db[_0x112e('0x9c')][_0x112e('0x3f')](_0x1ab160[_0x112e('0x9d')](),_0xd60e7)[_0x112e('0x2e')](function(_0x31db9b){var _0x5ca2fc=_[_0x112e('0xb0')](_0x31db9b,'FaxInteractionId');var _0x3120a0=[];_0x26cb33[_0x112e('0x84')](function(_0x347347){_0x3120a0['push'](updateFaxInteraction(_0x347347,_0x2663c2,_0x5ca2fc));});return BPromise[_0x112e('0xb1')](_0x3120a0);});});})['then'](function(_0x365450){_0x1ed5d6[_0x112e('0xb2')]=_0x365450;return _0x1ed5d6;})[_0x112e('0x2e')](respondWithFilteredResult(_0x321c61,_0x255735))[_0x112e('0x39')](handleError(_0x321c61,null));};exports[_0x112e('0xb3')]=function(_0x5825af,_0x32dbd4){var _0x28a7c0={'raw':![],'where':{'id':_0x5825af[_0x112e('0xb4')]['id']}},_0x337f82={};_0x337f82[_0x112e('0x3e')]=_[_0x112e('0x75')](db[_0x112e('0x3a')][_0x112e('0x3b')]);_0x337f82[_0x112e('0x3f')]=_[_0x112e('0x75')](_0x5825af[_0x112e('0x3f')]);_0x337f82[_0x112e('0x4a')]=_[_0x112e('0x41')](_0x337f82[_0x112e('0x3e')],_0x337f82[_0x112e('0x3f')]);_0x28a7c0[_0x112e('0x40')]=_['intersection'](_0x337f82[_0x112e('0x3e')],qs[_0x112e('0x42')](_0x5825af[_0x112e('0x3f')][_0x112e('0x42')]));_0x28a7c0[_0x112e('0x40')]=_0x28a7c0[_0x112e('0x40')][_0x112e('0x43')]?_0x28a7c0[_0x112e('0x40')]:_0x337f82['model'];if(_0x5825af[_0x112e('0x3f')][_0x112e('0xb5')]){_0x28a7c0[_0x112e('0xb6')]=[{'all':!![]}];}_0x28a7c0=_[_0x112e('0xb7')]({},_0x28a7c0,_0x5825af['options']);return db['FaxInteraction'][_0x112e('0x63')](_0x28a7c0)[_0x112e('0x2e')](handleEntityNotFound(_0x32dbd4,null))['then'](respondWithResult(_0x32dbd4,null))['catch'](handleError(_0x32dbd4,null));};exports[_0x112e('0xb8')]=function(_0x5362ad,_0x1b5f33){return db[_0x112e('0x3a')][_0x112e('0xb8')](_0x5362ad['body'],{})['then'](respondWithResult(_0x1b5f33,0xc9))[_0x112e('0x39')](handleError(_0x1b5f33,null));};exports[_0x112e('0x2c')]=function(_0x1a216b,_0x4861fc){if(_0x1a216b[_0x112e('0x74')]['id']){delete _0x1a216b['body']['id'];}return db[_0x112e('0x3a')][_0x112e('0x63')]({'where':{'id':_0x1a216b[_0x112e('0xb4')]['id']}})[_0x112e('0x2e')](handleEntityNotFound(_0x4861fc,null))['then'](saveUpdates(_0x1a216b[_0x112e('0x74')],null))[_0x112e('0x2e')](respondWithResult(_0x4861fc,null))['catch'](handleError(_0x4861fc,null));};exports[_0x112e('0x2d')]=function(_0x484027,_0x175173){return db['FaxInteraction'][_0x112e('0x63')]({'where':{'id':_0x484027[_0x112e('0xb4')]['id']}})[_0x112e('0x2e')](handleEntityNotFound(_0x175173,null))[_0x112e('0x2e')](removeEntity(_0x175173,null))[_0x112e('0x39')](handleError(_0x175173,null));};exports[_0x112e('0xb9')]=function(_0x544b0f,_0x8c5541){return db[_0x112e('0x3a')][_0x112e('0xb9')]()[_0x112e('0x2e')](respondWithResult(_0x8c5541,null))[_0x112e('0x39')](handleError(_0x8c5541,null));};exports['addMessage']=function(_0x1fb387,_0x4b46fd,_0x333e42){return db['FaxMessage']['find']({'where':{'id':_0x1fb387['params']['id']}})[_0x112e('0x2e')](handleEntityNotFound(_0x4b46fd,null))[_0x112e('0x2e')](function(_0x550d60){if(_0x550d60){return _0x550d60[_0x112e('0xba')](_0x1fb387[_0x112e('0x74')][_0x112e('0xbb')],_[_0x112e('0xbc')](_0x1fb387[_0x112e('0x74')],[_0x112e('0xbb'),'id'])||{});}})[_0x112e('0x2e')](respondWithResult(_0x4b46fd,null))[_0x112e('0x39')](handleError(_0x4b46fd,null));};exports[_0x112e('0xbd')]=function(_0x1a2fb9,_0x8c2b76,_0x122b19){var _0x2f7720={'raw':![],'where':{}};var _0x1b887a={};var _0x477aef={'count':0x0,'rows':[]};return db[_0x112e('0x3a')][_0x112e('0xbe')]({'where':{'id':_0x1a2fb9['params']['id']}})[_0x112e('0x2e')](handleEntityNotFound(_0x8c2b76,null))['then'](function(_0x55142f){if(_0x55142f){_0x1b887a[_0x112e('0x3e')]=_[_0x112e('0x75')](db[_0x112e('0xbf')]['rawAttributes']);_0x1b887a['query']=_[_0x112e('0x75')](_0x1a2fb9[_0x112e('0x3f')]);_0x1b887a['filters']=_[_0x112e('0x41')](_0x1b887a['model'],_0x1b887a[_0x112e('0x3f')]);_0x2f7720[_0x112e('0x40')]=_[_0x112e('0x41')](_0x1b887a['model'],qs[_0x112e('0x42')](_0x1a2fb9[_0x112e('0x3f')][_0x112e('0x42')]));_0x2f7720[_0x112e('0x40')]=_0x2f7720[_0x112e('0x40')]['length']?_0x2f7720[_0x112e('0x40')]:_0x1b887a[_0x112e('0x3e')];if(!_0x1a2fb9[_0x112e('0x3f')][_0x112e('0x44')](_0x112e('0x45'))){_0x2f7720[_0x112e('0x26')]=qs[_0x112e('0x26')](_0x1a2fb9[_0x112e('0x3f')][_0x112e('0x26')]);_0x2f7720[_0x112e('0x23')]=qs[_0x112e('0x23')](_0x1a2fb9[_0x112e('0x3f')][_0x112e('0x23')]);}_0x2f7720[_0x112e('0x46')]=qs[_0x112e('0x47')](_0x1a2fb9['query'][_0x112e('0x47')]);_0x2f7720[_0x112e('0x48')]=qs[_0x112e('0x4a')](_[_0x112e('0x49')](_0x1a2fb9[_0x112e('0x3f')],_0x1b887a['filters']));_0x2f7720[_0x112e('0x48')][_0x112e('0xc0')]=_0x55142f['id'];if(_0x1a2fb9[_0x112e('0x3f')][_0x112e('0x85')]){_0x2f7720[_0x112e('0x48')]=_[_0x112e('0xb7')](_0x2f7720['where'],{'$or':_[_0x112e('0x33')](_0x2f7720[_0x112e('0x40')],function(_0x1beee5){var _0x1ea903={};_0x1ea903[_0x1beee5]={'$like':'%'+_0x1a2fb9[_0x112e('0x3f')]['filter']+'%'};return _0x1ea903;})});}if(_0x1a2fb9[_0x112e('0x3f')][_0x112e('0x7c')]){var _0xc068e4=_0x1a2fb9[_0x112e('0x3f')][_0x112e('0x7c')][_0x112e('0x36')](',');var _0x428e89={};_0x428e89[_0xc068e4[0x0]]={'$gte':moment(_0xc068e4[0x1])[_0x112e('0xc1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2f7720[_0x112e('0x48')]=_['merge'](_0x2f7720[_0x112e('0x48')],_0x428e89);}_0x2f7720=_[_0x112e('0xb7')]({},_0x2f7720,_0x1a2fb9[_0x112e('0xc2')]);return db[_0x112e('0xbf')][_0x112e('0x25')]({'where':_0x2f7720[_0x112e('0x48')]})[_0x112e('0x2e')](function(_0x18ede6){_0x477aef['count']=_0x18ede6;if(_0x1a2fb9['query'][_0x112e('0xb5')]){_0x2f7720[_0x112e('0xb6')]=[{'all':!![]}];}return db[_0x112e('0xbf')]['findAll'](_0x2f7720);})[_0x112e('0x2e')](function(_0x37d1fe){_0x477aef[_0x112e('0xb2')]=_0x37d1fe;return _0x477aef;});}})[_0x112e('0x2e')](respondWithFilteredResult(_0x8c2b76,_0x2f7720))['catch'](handleError(_0x8c2b76,null));};exports['addTags']=function(_0x3ec8d6,_0x461cbc,_0x51a9e1){return db[_0x112e('0x3a')][_0x112e('0x63')]({'where':{'id':_0x3ec8d6[_0x112e('0xb4')]['id']}})[_0x112e('0x2e')](handleEntityNotFound(_0x461cbc,null))[_0x112e('0x2e')](function(_0x58f42d){if(_0x58f42d){return _0x58f42d['setTags'](_0x3ec8d6[_0x112e('0x74')][_0x112e('0xbb')],_[_0x112e('0xbc')](_0x3ec8d6[_0x112e('0x74')],[_0x112e('0xbb'),'id'])||{})[_0x112e('0xc3')](function(){return db[_0x112e('0x6c')]['findAll']({'attributes':['id',_0x112e('0x30'),_0x112e('0x4d')],'where':{'id':_0x3ec8d6[_0x112e('0x74')][_0x112e('0xbb')]}});})[_0x112e('0x2e')](function(_0x43d081){socket[_0x112e('0xc4')](_0x112e('0xc5'),{'id':Number(_0x3ec8d6[_0x112e('0xb4')]['id']),'tags':_0x43d081||[]});return{'id':Number(_0x3ec8d6['params']['id']),'tags':_0x43d081||[]};});}})[_0x112e('0x2e')](respondWithResult(_0x461cbc,null))[_0x112e('0x39')](handleError(_0x461cbc,null));};exports[_0x112e('0xc6')]=function(_0xff1e77,_0x10cc83,_0x25d8f8){return db['FaxInteraction'][_0x112e('0x63')]({'where':{'id':_0xff1e77['params']['id']}})[_0x112e('0x2e')](handleEntityNotFound(_0x10cc83,null))[_0x112e('0x2e')](function(_0x22f669){if(_0x22f669){return _0x22f669[_0x112e('0xc6')](_0xff1e77[_0x112e('0x3f')][_0x112e('0xbb')]);}})[_0x112e('0x2e')](respondWithStatusCode(_0x10cc83,null))[_0x112e('0x39')](handleError(_0x10cc83,null));};exports[_0x112e('0xc7')]=function(_0x2bae67,_0x35bdbf){var _0x4fc35b=moment()[_0x112e('0xc8')]()[_0x112e('0x9d')]();var _0x574f8b=path[_0x112e('0xc9')](config[_0x112e('0xca')],_0x112e('0xcb'),'files','tmp');var _0x7f81b0=path[_0x112e('0xc9')](config[_0x112e('0xca')],'server',_0x112e('0xcc'),_0x112e('0xcd'));var _0x1b9b6d=path[_0x112e('0xc9')](_0x574f8b,_0x4fc35b);var _0x103343=util[_0x112e('0xc1')](_0x112e('0xce'),_0x2bae67['params']['id'],_0x4fc35b);var _0x4adc3a=path[_0x112e('0xc9')](_0x574f8b,_0x103343);var _0x39150f=[];_0x39150f[_0x112e('0x38')]({'model':db['Attachment'],'as':_0x112e('0xcf'),'raw':!![]});var _0x2019a6=[{'model':db[_0x112e('0xbf')],'as':_0x112e('0xd0'),'attributes':['id','body',_0x112e('0x7b')],'include':_0x39150f}];return db[_0x112e('0x3a')][_0x112e('0x63')]({'where':{'id':_0x2bae67['params']['id']},'include':_0x2019a6})[_0x112e('0x2e')](handleEntityNotFound(_0x35bdbf,null))[_0x112e('0x2e')](function(_0x2e65b7){if(_0x2e65b7&&_0x2e65b7[_0x112e('0xd0')]){var _0x1c2ecc=_0x2e65b7[_0x112e('0xd1')]({'plain':!![]});fs[_0x112e('0xd2')](_0x1b9b6d);for(var _0xd6949e=0x0;_0xd6949e<_0x1c2ecc[_0x112e('0xd0')][_0x112e('0x43')];_0xd6949e++){var _0x230198=_0x1c2ecc[_0x112e('0xd0')][_0xd6949e][_0x112e('0xcf')];if(_0x230198){var _0x47407c=path[_0x112e('0xc9')](_0x7f81b0,_0x230198[_0x112e('0xd3')]);if(fs[_0x112e('0xd4')](_0x47407c)){fs['createReadStream'](_0x47407c)['pipe'](fs[_0x112e('0xd5')](path[_0x112e('0xc9')](_0x1b9b6d,_0x230198[_0x112e('0xd3')])));}}}return BPromise[_0x112e('0x95')]()[_0x112e('0x2e')](function(){return new BPromise(function(_0x37219f,_0xd6cfc){zipdir(_0x1b9b6d,{'saveTo':_0x4adc3a},function(_0x159f8a,_0x3b9fe4){if(_0x159f8a)return _0xd6cfc(_0x159f8a);return _0x37219f(_0x3b9fe4);});})[_0x112e('0x2e')](function(){return new BPromise(function(_0x307390,_0x56c581){rimraf(_0x1b9b6d,function(_0x2a3fef){if(_0x2a3fef)_0x56c581(_0x2a3fef);return _0x307390();});});})['then'](function(){return _0x35bdbf[_0x112e('0xc7')](_0x4adc3a,_0x103343,function(_0x579b93){if(_0x579b93){console['log']('err',_0x579b93);}else{fs[_0x112e('0xd6')](_0x4adc3a);}});});});}else{return _0x35bdbf['sendStatus'](0xc8);}})[_0x112e('0x39')](handleError(_0x35bdbf,null));}; \ No newline at end of file +var _0xbf2a=['value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','buildExpression','keys','some','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.fax\x20LIKE\x20?','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)','unreadMessages','order','contactName','DESC','resolve','user','role','i.FaxAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','TagIds','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','push','show','params','includeAll','include','catch','create','destroy','FaxMessage','addMessage','ids','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','merge','options','findAll','setTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','existsSync','pipe','basename','log','err','unlinkSync','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','then','end','error','stack','name','Users','map','fullname','Tags','forEach','FaxInteraction','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','u.id\x20=\x20ui.UserId','fax_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','fax_accounts','a.id\x20=\x20i.FaxAccountId','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','search','parseSearch','sqlOperator','conditions','find'];(function(_0x489b87,_0xd51c93){var _0x1823b6=function(_0x451c70){while(--_0x451c70){_0x489b87['push'](_0x489b87['shift']());}};_0x1823b6(++_0xd51c93);}(_0xbf2a,0x77));var _0xabf2=function(_0x45b374,_0x20dccb){_0x45b374=_0x45b374-0x0;var _0x24fc74=_0xbf2a[_0x45b374];return _0x24fc74;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xabf2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xabf2('0x1'));var rp=require(_0xabf2('0x2'));var moment=require('moment');var BPromise=require(_0xabf2('0x3'));var Mustache=require(_0xabf2('0x4'));var util=require(_0xabf2('0x5'));var path=require(_0xabf2('0x6'));var sox=require(_0xabf2('0x7'));var csv=require(_0xabf2('0x8'));var ejs=require(_0xabf2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xabf2('0xa'));var squel=require(_0xabf2('0xb'));var crypto=require(_0xabf2('0xc'));var jsforce=require(_0xabf2('0xd'));var deskjs=require(_0xabf2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xabf2('0xf'));var Papa=require(_0xabf2('0x10'));var Redis=require(_0xabf2('0x11'));var authService=require(_0xabf2('0x12'));var qs=require(_0xabf2('0x13'));var as=require(_0xabf2('0x14'));var hardwareService=require(_0xabf2('0x15'));var logger=require(_0xabf2('0x16'))(_0xabf2('0x17'));var utils=require('../../config/utils');var config=require(_0xabf2('0x18'));var licenseUtil=require(_0xabf2('0x19'));var db=require(_0xabf2('0x1a'))['db'];config[_0xabf2('0x1b')]=_[_0xabf2('0x1c')](config['redis'],{'host':_0xabf2('0x1d'),'port':0x18eb});var socket=require(_0xabf2('0x1e'))(new Redis(config[_0xabf2('0x1b')]));require(_0xabf2('0x1f'))[_0xabf2('0x20')](socket);function respondWithStatusCode(_0x3626fc,_0x6cb031){_0x6cb031=_0x6cb031||0xcc;return function(_0x1dc9f2){if(_0x1dc9f2){return _0x3626fc[_0xabf2('0x21')](_0x6cb031);}return _0x3626fc['status'](_0x6cb031)['end']();};}function respondWithResult(_0x1b3c23,_0x22d7d5){_0x22d7d5=_0x22d7d5||0xc8;return function(_0x5c1a0b){if(_0x5c1a0b){return _0x1b3c23[_0xabf2('0x22')](_0x22d7d5)[_0xabf2('0x23')](_0x5c1a0b);}};}function respondWithFilteredResult(_0x21b7b8,_0x41d175){return function(_0x711885){if(_0x711885){var _0xccbbeb=typeof _0x41d175[_0xabf2('0x24')]==='undefined'&&typeof _0x41d175[_0xabf2('0x25')]===_0xabf2('0x26');var _0x4890e3=_0x711885[_0xabf2('0x27')];var _0x51d019=_0xccbbeb?0x0:_0x41d175[_0xabf2('0x24')];var _0x1803ad=_0xccbbeb?_0x711885['count']:_0x41d175[_0xabf2('0x24')]+_0x41d175[_0xabf2('0x25')];var _0x577045;if(_0x1803ad>=_0x4890e3){_0x1803ad=_0x4890e3;_0x577045=0xc8;}else{_0x577045=0xce;}_0x21b7b8[_0xabf2('0x22')](_0x577045);return _0x21b7b8[_0xabf2('0x28')](_0xabf2('0x29'),_0x51d019+'-'+_0x1803ad+'/'+_0x4890e3)['json'](_0x711885);}return null;};}function patchUpdates(_0x2c7175){return function(_0xcbbf8b){try{jsonpatch[_0xabf2('0x2a')](_0xcbbf8b,_0x2c7175,!![]);}catch(_0x28710c){return BPromise['reject'](_0x28710c);}return _0xcbbf8b['save']();};}function saveUpdates(_0x320e20,_0xae1a6e){return function(_0x2d8a28){if(_0x2d8a28){return _0x2d8a28['update'](_0x320e20)['then'](function(_0x43e4b0){return _0x43e4b0;});}return null;};}function removeEntity(_0x576343,_0x39e24b){return function(_0x1c071a){if(_0x1c071a){return _0x1c071a['destroy']()[_0xabf2('0x2b')](function(){_0x576343['status'](0xcc)[_0xabf2('0x2c')]();});}};}function handleEntityNotFound(_0x24a188,_0xfd1fbf){return function(_0x50ee16){if(!_0x50ee16){_0x24a188[_0xabf2('0x21')](0x194);}return _0x50ee16;};}function handleError(_0x3fc294,_0x2d4780){_0x2d4780=_0x2d4780||0x1f4;return function(_0x3e71fc){logger[_0xabf2('0x2d')](_0x3e71fc[_0xabf2('0x2e')]);if(_0x3e71fc[_0xabf2('0x2f')]){delete _0x3e71fc[_0xabf2('0x2f')];}_0x3fc294[_0xabf2('0x22')](_0x2d4780)['send'](_0x3e71fc);};}function getInteractionUsers(_0x471cfd,_0x2ef3dd){return new BPromise(function(_0x4ea0cd,_0x270de0){try{if(_0x2ef3dd[_0x471cfd['id']]){_0x471cfd[_0xabf2('0x30')]=_[_0xabf2('0x31')](_0x2ef3dd[_0x471cfd['id']],function(_0x4c22f5){return{'id':_0x4c22f5['id'],'fullname':_0x4c22f5[_0xabf2('0x32')]};});}}catch(_0x5c5ec3){_0x270de0(_0x5c5ec3);}_0x4ea0cd(_0x471cfd);});}function getInteractionTags(_0x470f81,_0x3b08c9){return new BPromise(function(_0x1126a1,_0x35eb9e){try{if(_0x470f81['TagIds']){_0x470f81[_0xabf2('0x33')]=[];_0x470f81['TagIds']['split'](',')[_0xabf2('0x34')](function(_0x46ff47){_0x470f81['Tags']['push'](_0x3b08c9[_0x46ff47]);});}delete _0x470f81['TagIds'];}catch(_0x3409d9){_0x35eb9e(_0x3409d9);}_0x1126a1(_0x470f81);});}function updateFaxInteraction(_0x6f0e54,_0x968255,_0x548d5f){return new BPromise(function(_0xb26fab,_0x18c779){return getInteractionUsers(_0x6f0e54,_0x548d5f)['then'](function(_0x212f33){return getInteractionTags(_0x212f33,_0x968255);})[_0xabf2('0x2b')](function(_0x26baac){_0xb26fab(_0x26baac);})['catch'](function(_0x415646){_0x18c779(_0x415646);});});}exports['index']=function(_0x26bd5d,_0x21c51f){var _0x4dca1e={},_0x19edcb={},_0x36ab37={'count':0x0,'rows':[]};var _0x4ecb24=_[_0xabf2('0x31')](db[_0xabf2('0x35')][_0xabf2('0x36')],function(_0x4ce0b1){return{'name':_0x4ce0b1[_0xabf2('0x37')],'type':_0x4ce0b1['type']['key']};});_0x19edcb[_0xabf2('0x38')]=_['map'](_0x4ecb24,_0xabf2('0x2f'));_0x19edcb[_0xabf2('0x39')]=_['keys'](_0x26bd5d[_0xabf2('0x39')]);_0x19edcb[_0xabf2('0x3a')]=_[_0xabf2('0x3b')](_0x19edcb[_0xabf2('0x38')],_0x19edcb[_0xabf2('0x39')]);_0x4dca1e[_0xabf2('0x3c')]=_['intersection'](_0x19edcb[_0xabf2('0x38')],qs[_0xabf2('0x3d')](_0x26bd5d['query'][_0xabf2('0x3d')]));_0x4dca1e[_0xabf2('0x3c')]=_0x4dca1e[_0xabf2('0x3c')][_0xabf2('0x3e')]?_0x4dca1e[_0xabf2('0x3c')]:_0x19edcb[_0xabf2('0x38')];if(!_0x26bd5d[_0xabf2('0x39')][_0xabf2('0x3f')]('nolimit')){_0x4dca1e['limit']=qs[_0xabf2('0x25')](_0x26bd5d[_0xabf2('0x39')][_0xabf2('0x25')]);_0x4dca1e[_0xabf2('0x24')]=qs['offset'](_0x26bd5d['query'][_0xabf2('0x24')]);}_0x4dca1e['order']=qs[_0xabf2('0x40')](_0x26bd5d['query'][_0xabf2('0x40')]);_0x4dca1e[_0xabf2('0x41')]=qs['filters'](_[_0xabf2('0x42')](_0x26bd5d[_0xabf2('0x39')],_0x19edcb[_0xabf2('0x3a')]),_0x4ecb24);var _0x288fd1=[];var _0x3fe857=squel[_0xabf2('0x43')]()['field']('id')[_0xabf2('0x44')](_0xabf2('0x2f'))[_0xabf2('0x44')](_0xabf2('0x45'))[_0xabf2('0x46')](_0xabf2('0x47'));var _0x1b6107=squel['select']()['field'](_0xabf2('0x48'))[_0xabf2('0x44')](_0xabf2('0x49'))[_0xabf2('0x44')](_0xabf2('0x4a'))[_0xabf2('0x46')](_0xabf2('0x4b'),'ui')[_0xabf2('0x4c')]('users','u',_0xabf2('0x4d'));var _0x39e9e7=squel[_0xabf2('0x43')]()[_0xabf2('0x46')](_0xabf2('0x4e'),'i')[_0xabf2('0x4c')]('cm_contacts','c',_0xabf2('0x4f'))[_0xabf2('0x4c')](_0xabf2('0x50'),'o','o.id\x20=\x20i.UserId')[_0xabf2('0x4c')](_0xabf2('0x51'),'a',_0xabf2('0x52'))[_0xabf2('0x4c')]('fax_messages','me',_0xabf2('0x53'))[_0xabf2('0x4c')](_0xabf2('0x54'),'it',_0xabf2('0x55'))['left_join'](_0xabf2('0x47'),'t',_0xabf2('0x56'));var _0x493b7e=squel['expr']();var _0x320fba=[];var _0x44eba1=squel['expr']();var _0x1edefa;if(_0x26bd5d[_0xabf2('0x39')][_0xabf2('0x57')]){_0x1edefa=as[_0xabf2('0x58')](_0x26bd5d[_0xabf2('0x39')][_0xabf2('0x57')]);var _0x217847=_0x1edefa[_0xabf2('0x59')];for(var _0x26a2b8=0x0;_0x26a2b8<_0x1edefa[_0xabf2('0x5a')][_0xabf2('0x3e')];_0x26a2b8++){var _0x26395e=_0x1edefa[_0xabf2('0x5a')][_0x26a2b8];var _0x463f79='i';var _0xa05fd2=_[_0xabf2('0x5b')](_0x4ecb24,[_0xabf2('0x2f'),_0x26395e[_0xabf2('0x44')]]);if(!_0xa05fd2){switch(_0x26395e[_0xabf2('0x44')]){case'unreadMessages':if(_0x26395e[_0xabf2('0x5c')]==0x1){_0x39e9e7[_0xabf2('0x5d')]('`'+_0x26395e[_0xabf2('0x44')]+_0xabf2('0x5e'));}else{_0x39e9e7[_0xabf2('0x5d')]('`'+_0x26395e[_0xabf2('0x44')]+_0xabf2('0x5f'));}break;case _0xabf2('0x60'):if(_0x26395e[_0xabf2('0x61')]===_0xabf2('0x62')){if(_0x26395e[_0xabf2('0x5c')][_0xabf2('0x63')]('\x20')[_0xabf2('0x3e')]>0x1){_0x493b7e[_0x217847]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xabf2('0x64')](_0x26395e[_0xabf2('0x5c')]),null);}else{var _0x34cf1b='%'+_0x26395e[_0xabf2('0x5c')]+'%';_0x493b7e[_0x217847](_0xabf2('0x65'),_0x34cf1b,_0x34cf1b,_0x34cf1b);}}else{_0xa05fd2=_['find'](_0x4ecb24,[_0xabf2('0x2f'),_0xabf2('0x66')]);_0x26395e['field']=_0xabf2('0x66');_0x4d8c36=as['buildExpression'](_0x463f79,_0xa05fd2[_0xabf2('0x67')],_0x26395e);_0x493b7e[_0x217847](_0x4d8c36[_0xabf2('0x68')],_0x4d8c36[_0xabf2('0x5c')][_0xabf2('0x69')],_0x4d8c36['value']['end']);}break;case _0xabf2('0x6a'):var _0x5ad2bd=_0x26395e[_0xabf2('0x5c')][_0xabf2('0x63')](',')['map'](function(_0x45f717){return Number(_0x45f717);});_0x5ad2bd['forEach'](function(_0x62903b){_0x44eba1['or'](_0xabf2('0x6b'),'%,'+_0x62903b+',%');});_0x320fba=_[_0xabf2('0x6c')](_0x320fba,_0x5ad2bd);break;case'User':if(_0x26395e[_0xabf2('0x61')]===_0xabf2('0x62')){_0x493b7e[_0x217847](_0xabf2('0x6d'),'%'+_0x26395e[_0xabf2('0x5c')]+'%',null);}else{_0xa05fd2=_['find'](_0x4ecb24,[_0xabf2('0x2f'),'UserId']);_0x26395e[_0xabf2('0x44')]=_0xabf2('0x6e');_0x4d8c36=as['buildExpression'](_0x463f79,_0xa05fd2[_0xabf2('0x67')],_0x26395e);_0x493b7e[_0x217847](_0x4d8c36['text'],_0x4d8c36['value']['start'],_0x4d8c36[_0xabf2('0x5c')][_0xabf2('0x2c')]);}break;case _0xabf2('0x6f'):_0x4d8c36=as[_0xabf2('0x70')]('me',null,_0x26395e);_0x493b7e[_0x217847](_0x4d8c36[_0xabf2('0x68')],_0x4d8c36['value'][_0xabf2('0x69')],_0x4d8c36[_0xabf2('0x5c')][_0xabf2('0x2c')]);break;}}else{var _0x4d8c36=as[_0xabf2('0x70')](_0x463f79,_0xa05fd2[_0xabf2('0x67')],_0x26395e);_0x493b7e[_0x217847](_0x4d8c36[_0xabf2('0x68')],_0x4d8c36['value'][_0xabf2('0x69')],_0x4d8c36[_0xabf2('0x5c')][_0xabf2('0x2c')]);}}}else{var _0x2a3b24=_(_0x26bd5d[_0xabf2('0x39')])[_0xabf2('0x71')]()['map'](function(_0x3f023b){return _[_0xabf2('0x72')](_0x4ecb24,[_0xabf2('0x2f'),_0x3f023b])?_0x3f023b:undefined;})['compact']()[_0xabf2('0x5c')]();if(!_[_0xabf2('0x73')](_0x2a3b24)){_0x2a3b24[_0xabf2('0x34')](function(_0x53844b){if(_0x53844b===_0xabf2('0x74')){_0x39e9e7[_0xabf2('0x41')](_0xabf2('0x75'),[]['concat'](_0x26bd5d[_0xabf2('0x39')][_0x53844b]));}else if(_0x53844b===_0xabf2('0x76')){var _0x1e36ff=JSON['parse'](_0x26bd5d[_0xabf2('0x39')][_0x53844b])[_0xabf2('0x77')];var _0x1070d2=JSON[_0xabf2('0x78')](_0x26bd5d['query'][_0x53844b])['$lte'];_0x39e9e7['where'](_0xabf2('0x79'),_0x1e36ff,_0x1070d2);}else{if(_0x26bd5d[_0xabf2('0x39')][_0x53844b]===_0xabf2('0x7a')){_0x39e9e7[_0xabf2('0x41')]('i.'+_0x53844b+'\x20IS\x20NULL');}else{_0x39e9e7[_0xabf2('0x41')]('i.'+_0x53844b+_0xabf2('0x7b'),_0x26bd5d['query'][_0x53844b]);}}});}if(_0x26bd5d[_0xabf2('0x39')][_0xabf2('0x7c')]){if(_0x26bd5d[_0xabf2('0x39')][_0xabf2('0x7c')]==0x1){_0x39e9e7[_0xabf2('0x5d')](_0xabf2('0x7d'));}else{_0x39e9e7['having'](_0xabf2('0x7e'));}}if(_0x26bd5d['query']['tag']){_0x320fba=_['isArray'](_0x26bd5d[_0xabf2('0x39')][_0xabf2('0x7f')])?_0x26bd5d[_0xabf2('0x39')][_0xabf2('0x7f')]:new Array(_0x26bd5d[_0xabf2('0x39')][_0xabf2('0x7f')]);_0x320fba[_0xabf2('0x34')](function(_0x274f1a){_0x44eba1['or'](_0xabf2('0x6b'),'%,'+_0x274f1a+',%');});}if(_0x26bd5d[_0xabf2('0x39')][_0xabf2('0x80')]){var _0x5bd4fc=_0x26bd5d['query'][_0xabf2('0x80')][_0xabf2('0x81')]('\x5c','\x5c\x5c')[_0xabf2('0x81')](/'/g,'\x27\x27');if(qs[_0xabf2('0x82')](_0x5bd4fc)){_0x493b7e['or']('i.id\x20LIKE\x20?',_0x5bd4fc+'%')['or'](_0xabf2('0x83'),_0x5bd4fc+'%');}_0x493b7e['or'](_0xabf2('0x84'),_0x5bd4fc+'%');}}_0x39e9e7['where'](_0x493b7e);_0x39e9e7['group'](_0xabf2('0x85'));var _0x2811ea={'type':db[_0xabf2('0x86')][_0xabf2('0x87')]['SELECT'],'raw':!![]};var _0x247b2e=_0x39e9e7[_0xabf2('0x88')]();_0x247b2e[_0xabf2('0x44')](_0xabf2('0x85'));_0x247b2e[_0xabf2('0x44')](_0xabf2('0x89'),_0xabf2('0x8a'));if(_0x4dca1e[_0xabf2('0x8b')]){_0x4dca1e[_0xabf2('0x8b')]['forEach'](function(_0x2f41af){var _0x24e4c5=_0x2f41af[0x0]===_0xabf2('0x8c')?_0x2f41af[0x0]:'i.'+_0x2f41af[0x0];_0x39e9e7[_0xabf2('0x8b')](_0x24e4c5,_0x2f41af[0x1]===_0xabf2('0x8d')?![]:!![]);});}if(!_[_0xabf2('0x73')](_0x320fba)){_0x39e9e7[_0xabf2('0x5d')](_0x44eba1);_0x247b2e['where']('t.id\x20IN\x20?',_0x320fba);}BPromise[_0xabf2('0x8e')]()['then'](function(){if(!_0x1edefa){if(_0x26bd5d[_0xabf2('0x39')][_0xabf2('0x74')])return;_0x247b2e['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x39e9e7[_0xabf2('0x41')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x26bd5d[_0xabf2('0x8f')][_0xabf2('0x90')]!=='agent')return;return _0x26bd5d[_0xabf2('0x8f')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0xabf2('0x2b')](function(_0x463600){if(_[_0xabf2('0x73')](_0x463600)){_0x247b2e[_0xabf2('0x41')](_0xabf2('0x91'));_0x39e9e7[_0xabf2('0x41')](_0xabf2('0x91'));}else{_0x247b2e[_0xabf2('0x41')](_0xabf2('0x75'),_[_0xabf2('0x31')](_0x463600,'id'));_0x39e9e7[_0xabf2('0x41')](_0xabf2('0x75'),_['map'](_0x463600,'id'));}});})[_0xabf2('0x2b')](function(){if(_0x26bd5d[_0xabf2('0x8f')][_0xabf2('0x90')]===_0xabf2('0x92')&&!_0x1edefa&&!_0x26bd5d[_0xabf2('0x39')][_0xabf2('0x74')])return[];return db[_0xabf2('0x93')][_0xabf2('0x39')](_0x247b2e[_0xabf2('0x94')](),_0x2811ea);})[_0xabf2('0x2b')](function(_0x471024){_0x36ab37[_0xabf2('0x27')]=_0x471024[_0xabf2('0x3e')];if(_0x36ab37['count']===0x0)return[];return db[_0xabf2('0x93')][_0xabf2('0x39')](_0x3fe857[_0xabf2('0x94')](),_0x2811ea)[_0xabf2('0x2b')](function(_0x2f1f4d){_0x288fd1=_[_0xabf2('0x95')](_0x2f1f4d,'id');_0x2811ea=_['merge'](_0x2811ea,{'model':db[_0xabf2('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x26bd5d['query'][_0xabf2('0x3d')]){_0x4dca1e[_0xabf2('0x3c')][_0xabf2('0x34')](function(_0x373293){_0x39e9e7[_0xabf2('0x44')]('i.'+_0x373293);});}else{_0x39e9e7[_0xabf2('0x44')](_0xabf2('0x89'),_0xabf2('0x8a'));_0x39e9e7[_0xabf2('0x44')](_0xabf2('0x96'),_0xabf2('0x97'));_0x39e9e7[_0xabf2('0x44')]('a.mandatoryDisposition',_0xabf2('0x98'));_0x39e9e7[_0xabf2('0x44')](_0xabf2('0x99'),_0xabf2('0x8c'));_0x39e9e7['field']('i.*');_0x39e9e7[_0xabf2('0x44')](_0xabf2('0x9a'),'Contact.firstName');_0x39e9e7['field'](_0xabf2('0x9b'),'Contact.lastName');_0x39e9e7[_0xabf2('0x44')](_0xabf2('0x9c'),_0xabf2('0x9d'));_0x39e9e7[_0xabf2('0x44')](_0xabf2('0x9e'),_0xabf2('0x9f'));_0x39e9e7[_0xabf2('0x44')]('c.mobile',_0xabf2('0xa0'));_0x39e9e7[_0xabf2('0x44')](_0xabf2('0xa1'),_0xabf2('0xa2'));_0x39e9e7[_0xabf2('0x44')](_0xabf2('0xa3'),_0xabf2('0xa4'));_0x39e9e7['field']('o.internal',_0xabf2('0xa5'));_0x39e9e7['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xabf2('0xa6'));}if(_0x4dca1e[_0xabf2('0x25')])_0x39e9e7[_0xabf2('0x25')](_0x4dca1e[_0xabf2('0x25')]);if(_0x4dca1e['offset'])_0x39e9e7[_0xabf2('0x24')](_0x4dca1e[_0xabf2('0x24')]);return db['sequelize'][_0xabf2('0x39')](_0x39e9e7['toString'](),_0x2811ea);})[_0xabf2('0x2b')](function(_0x4c9349){if(_0x4c9349[_0xabf2('0x3e')]>0x0)_0x1b6107['where'](_0xabf2('0xa7'),_[_0xabf2('0x31')](_0x4c9349,'id'));return db[_0xabf2('0x93')][_0xabf2('0x39')](_0x1b6107[_0xabf2('0x94')](),_0x2811ea)[_0xabf2('0x2b')](function(_0x521ea1){var _0x19560f=_[_0xabf2('0xa8')](_0x521ea1,_0xabf2('0xa9'));var _0x5229f7=[];_0x4c9349[_0xabf2('0x34')](function(_0x9da046){_0x5229f7[_0xabf2('0xaa')](updateFaxInteraction(_0x9da046,_0x288fd1,_0x19560f));});return BPromise['all'](_0x5229f7);});});})[_0xabf2('0x2b')](function(_0x56d8b1){_0x36ab37['rows']=_0x56d8b1;return _0x36ab37;})['then'](respondWithFilteredResult(_0x21c51f,_0x4dca1e))['catch'](handleError(_0x21c51f,null));};exports[_0xabf2('0xab')]=function(_0x27d256,_0x2f6481){var _0x1806be={'raw':![],'where':{'id':_0x27d256[_0xabf2('0xac')]['id']}},_0x502b3d={};_0x502b3d[_0xabf2('0x38')]=_[_0xabf2('0x71')](db[_0xabf2('0x35')][_0xabf2('0x36')]);_0x502b3d[_0xabf2('0x39')]=_[_0xabf2('0x71')](_0x27d256[_0xabf2('0x39')]);_0x502b3d['filters']=_['intersection'](_0x502b3d['model'],_0x502b3d[_0xabf2('0x39')]);_0x1806be[_0xabf2('0x3c')]=_['intersection'](_0x502b3d[_0xabf2('0x38')],qs['fields'](_0x27d256[_0xabf2('0x39')][_0xabf2('0x3d')]));_0x1806be[_0xabf2('0x3c')]=_0x1806be['attributes'][_0xabf2('0x3e')]?_0x1806be[_0xabf2('0x3c')]:_0x502b3d['model'];if(_0x27d256[_0xabf2('0x39')][_0xabf2('0xad')]){_0x1806be[_0xabf2('0xae')]=[{'all':!![]}];}_0x1806be=_['merge']({},_0x1806be,_0x27d256['options']);return db[_0xabf2('0x35')]['find'](_0x1806be)[_0xabf2('0x2b')](handleEntityNotFound(_0x2f6481,null))['then'](respondWithResult(_0x2f6481,null))[_0xabf2('0xaf')](handleError(_0x2f6481,null));};exports[_0xabf2('0xb0')]=function(_0x46558c,_0x50413c){return db[_0xabf2('0x35')][_0xabf2('0xb0')](_0x46558c[_0xabf2('0x6f')],{})[_0xabf2('0x2b')](respondWithResult(_0x50413c,0xc9))[_0xabf2('0xaf')](handleError(_0x50413c,null));};exports['update']=function(_0xa1f856,_0x21efc4){if(_0xa1f856['body']['id']){delete _0xa1f856[_0xabf2('0x6f')]['id'];}return db[_0xabf2('0x35')][_0xabf2('0x5b')]({'where':{'id':_0xa1f856['params']['id']}})[_0xabf2('0x2b')](handleEntityNotFound(_0x21efc4,null))[_0xabf2('0x2b')](saveUpdates(_0xa1f856[_0xabf2('0x6f')],null))['then'](respondWithResult(_0x21efc4,null))[_0xabf2('0xaf')](handleError(_0x21efc4,null));};exports[_0xabf2('0xb1')]=function(_0x1f2fc6,_0x23c783){return db[_0xabf2('0x35')][_0xabf2('0x5b')]({'where':{'id':_0x1f2fc6['params']['id']}})['then'](handleEntityNotFound(_0x23c783,null))[_0xabf2('0x2b')](removeEntity(_0x23c783,null))['catch'](handleError(_0x23c783,null));};exports['describe']=function(_0x1539b8,_0x5f0d98){return db[_0xabf2('0x35')]['describe']()['then'](respondWithResult(_0x5f0d98,null))[_0xabf2('0xaf')](handleError(_0x5f0d98,null));};exports['addMessage']=function(_0x130514,_0x277205,_0x10b46e){return db[_0xabf2('0xb2')]['find']({'where':{'id':_0x130514[_0xabf2('0xac')]['id']}})[_0xabf2('0x2b')](handleEntityNotFound(_0x277205,null))['then'](function(_0x46c592){if(_0x46c592){return _0x46c592[_0xabf2('0xb3')](_0x130514[_0xabf2('0x6f')][_0xabf2('0xb4')],_[_0xabf2('0xb5')](_0x130514[_0xabf2('0x6f')],[_0xabf2('0xb4'),'id'])||{});}})[_0xabf2('0x2b')](respondWithResult(_0x277205,null))[_0xabf2('0xaf')](handleError(_0x277205,null));};exports[_0xabf2('0xb6')]=function(_0x484e43,_0x5c8ad1,_0x128b17){var _0xff0839={'raw':![],'where':{}};var _0x56788d={};var _0x351927={'count':0x0,'rows':[]};return db[_0xabf2('0x35')]['findOne']({'where':{'id':_0x484e43[_0xabf2('0xac')]['id']}})[_0xabf2('0x2b')](handleEntityNotFound(_0x5c8ad1,null))[_0xabf2('0x2b')](function(_0xf62dbd){if(_0xf62dbd){_0x56788d[_0xabf2('0x38')]=_['keys'](db[_0xabf2('0xb2')][_0xabf2('0x36')]);_0x56788d[_0xabf2('0x39')]=_[_0xabf2('0x71')](_0x484e43[_0xabf2('0x39')]);_0x56788d[_0xabf2('0x3a')]=_[_0xabf2('0x3b')](_0x56788d[_0xabf2('0x38')],_0x56788d['query']);_0xff0839['attributes']=_['intersection'](_0x56788d['model'],qs['fields'](_0x484e43[_0xabf2('0x39')]['fields']));_0xff0839[_0xabf2('0x3c')]=_0xff0839[_0xabf2('0x3c')]['length']?_0xff0839['attributes']:_0x56788d['model'];if(!_0x484e43[_0xabf2('0x39')][_0xabf2('0x3f')]('nolimit')){_0xff0839[_0xabf2('0x25')]=qs[_0xabf2('0x25')](_0x484e43['query'][_0xabf2('0x25')]);_0xff0839[_0xabf2('0x24')]=qs[_0xabf2('0x24')](_0x484e43[_0xabf2('0x39')][_0xabf2('0x24')]);}_0xff0839['order']=qs[_0xabf2('0x40')](_0x484e43[_0xabf2('0x39')][_0xabf2('0x40')]);_0xff0839['where']=qs[_0xabf2('0x3a')](_[_0xabf2('0x42')](_0x484e43[_0xabf2('0x39')],_0x56788d[_0xabf2('0x3a')]));_0xff0839[_0xabf2('0x41')][_0xabf2('0xa9')]=_0xf62dbd['id'];if(_0x484e43[_0xabf2('0x39')]['filter']){_0xff0839[_0xabf2('0x41')]=_['merge'](_0xff0839[_0xabf2('0x41')],{'$or':_['map'](_0xff0839[_0xabf2('0x3c')],function(_0x34c9c2){var _0x380665={};_0x380665[_0x34c9c2]={'$like':'%'+_0x484e43[_0xabf2('0x39')][_0xabf2('0x80')]+'%'};return _0x380665;})});}if(_0x484e43['query'][_0xabf2('0x77')]){var _0x254458=_0x484e43[_0xabf2('0x39')][_0xabf2('0x77')][_0xabf2('0x63')](',');var _0x3d972a={};_0x3d972a[_0x254458[0x0]]={'$gte':moment(_0x254458[0x1])[_0xabf2('0xb7')](_0xabf2('0xb8'))};_0xff0839['where']=_[_0xabf2('0xb9')](_0xff0839['where'],_0x3d972a);}_0xff0839=_[_0xabf2('0xb9')]({},_0xff0839,_0x484e43[_0xabf2('0xba')]);return db[_0xabf2('0xb2')][_0xabf2('0x27')]({'where':_0xff0839[_0xabf2('0x41')]})[_0xabf2('0x2b')](function(_0x24d2fe){_0x351927[_0xabf2('0x27')]=_0x24d2fe;if(_0x484e43[_0xabf2('0x39')][_0xabf2('0xad')]){_0xff0839['include']=[{'all':!![]}];}return db[_0xabf2('0xb2')][_0xabf2('0xbb')](_0xff0839);})['then'](function(_0x310766){_0x351927['rows']=_0x310766;return _0x351927;});}})[_0xabf2('0x2b')](respondWithFilteredResult(_0x5c8ad1,_0xff0839))[_0xabf2('0xaf')](handleError(_0x5c8ad1,null));};exports['addTags']=function(_0x4fe786,_0x2cd3a5,_0x38de7a){return db[_0xabf2('0x35')][_0xabf2('0x5b')]({'where':{'id':_0x4fe786[_0xabf2('0xac')]['id']}})[_0xabf2('0x2b')](handleEntityNotFound(_0x2cd3a5,null))[_0xabf2('0x2b')](function(_0x4c62fb){if(_0x4c62fb){return _0x4c62fb[_0xabf2('0xbc')](_0x4fe786['body'][_0xabf2('0xb4')],_[_0xabf2('0xb5')](_0x4fe786[_0xabf2('0x6f')],[_0xabf2('0xb4'),'id'])||{})[_0xabf2('0xbd')](function(){return db[_0xabf2('0x6a')][_0xabf2('0xbb')]({'attributes':['id',_0xabf2('0x2f'),_0xabf2('0x45')],'where':{'id':_0x4fe786['body'][_0xabf2('0xb4')]}});})[_0xabf2('0x2b')](function(_0x96cc47){socket[_0xabf2('0xbe')](_0xabf2('0xbf'),{'id':Number(_0x4fe786['params']['id']),'tags':_0x96cc47||[]});return{'id':Number(_0x4fe786[_0xabf2('0xac')]['id']),'tags':_0x96cc47||[]};});}})[_0xabf2('0x2b')](respondWithResult(_0x2cd3a5,null))['catch'](handleError(_0x2cd3a5,null));};exports[_0xabf2('0xc0')]=function(_0x4ea203,_0x31d09e,_0x51dfeb){return db['FaxInteraction']['find']({'where':{'id':_0x4ea203[_0xabf2('0xac')]['id']}})['then'](handleEntityNotFound(_0x31d09e,null))['then'](function(_0x339ea5){if(_0x339ea5){return _0x339ea5[_0xabf2('0xc0')](_0x4ea203[_0xabf2('0x39')][_0xabf2('0xb4')]);}})[_0xabf2('0x2b')](respondWithStatusCode(_0x31d09e,null))[_0xabf2('0xaf')](handleError(_0x31d09e,null));};exports[_0xabf2('0xc1')]=function(_0x440fef,_0x5c36eb){var _0x1cc015=moment()[_0xabf2('0xc2')]()[_0xabf2('0x94')]();var _0x193368=path[_0xabf2('0xc3')](config[_0xabf2('0xc4')],_0xabf2('0xc5'),_0xabf2('0xc6'),_0xabf2('0xc7'));var _0x200bb4=path['join'](config['root'],_0xabf2('0xc5'),'files','attachments');var _0x159864=path[_0xabf2('0xc3')](_0x193368,_0x1cc015);var _0x15cc5d=util[_0xabf2('0xb7')](_0xabf2('0xc8'),_0x440fef[_0xabf2('0xac')]['id'],_0x1cc015);var _0x50cd=path[_0xabf2('0xc3')](_0x193368,_0x15cc5d);var _0x40f0e1=[];_0x40f0e1[_0xabf2('0xaa')]({'model':db[_0xabf2('0xc9')],'as':_0xabf2('0xc9'),'raw':!![]});var _0x6c034a=[{'model':db[_0xabf2('0xb2')],'as':_0xabf2('0xca'),'attributes':['id',_0xabf2('0x6f'),'createdAt'],'include':_0x40f0e1}];return db[_0xabf2('0x35')]['find']({'where':{'id':_0x440fef[_0xabf2('0xac')]['id']},'include':_0x6c034a})[_0xabf2('0x2b')](handleEntityNotFound(_0x5c36eb,null))[_0xabf2('0x2b')](function(_0x39de23){if(_0x39de23&&_0x39de23[_0xabf2('0xca')]){var _0x24cca9=_0x39de23[_0xabf2('0xcb')]({'plain':!![]});fs[_0xabf2('0xcc')](_0x159864);for(var _0x5ae776=0x0;_0x5ae776<_0x24cca9[_0xabf2('0xca')]['length'];_0x5ae776++){var _0x69b28a=_0x24cca9[_0xabf2('0xca')][_0x5ae776][_0xabf2('0xc9')];if(_0x69b28a){var _0x1fecea=path[_0xabf2('0xc3')](_0x200bb4,_0x69b28a['basename']);if(fs[_0xabf2('0xcd')](_0x1fecea)){fs['createReadStream'](_0x1fecea)[_0xabf2('0xce')](fs['createWriteStream'](path[_0xabf2('0xc3')](_0x159864,_0x69b28a[_0xabf2('0xcf')])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x4abbb1,_0x2cd0af){zipdir(_0x159864,{'saveTo':_0x50cd},function(_0x48a31f,_0x1432c6){if(_0x48a31f)return _0x2cd0af(_0x48a31f);return _0x4abbb1(_0x1432c6);});})[_0xabf2('0x2b')](function(){return new BPromise(function(_0x5cb927,_0x5ea7b9){rimraf(_0x159864,function(_0x4c927b){if(_0x4c927b)_0x5ea7b9(_0x4c927b);return _0x5cb927();});});})['then'](function(){return _0x5c36eb[_0xabf2('0xc1')](_0x50cd,_0x15cc5d,function(_0xad201c){if(_0xad201c){console[_0xabf2('0xd0')](_0xabf2('0xd1'),_0xad201c);}else{fs[_0xabf2('0xd2')](_0x50cd);}});});});}else{return _0x5c36eb['sendStatus'](0xc8);}})[_0xabf2('0xaf')](handleError(_0x5c36eb,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index e492d8d..a1d5f0b 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 _0x6a3f=['then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','FaxInteraction','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','getUsers'];(function(_0x17562c,_0x25f747){var _0x1e53a1=function(_0x526420){while(--_0x526420){_0x17562c['push'](_0x17562c['shift']());}};_0x1e53a1(++_0x25f747);}(_0x6a3f,0x123));var _0xf6a3=function(_0x5eb10f,_0x1be4fb){_0x5eb10f=_0x5eb10f-0x0;var _0x1af57a=_0x6a3f[_0x5eb10f];return _0x1af57a;};'use strict';var EventEmitter=require(_0xf6a3('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0xf6a3('0x1')];var FaxMessage=require(_0xf6a3('0x2'))['db'][_0xf6a3('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xf6a3('0x4')](0x0);var events={'afterCreate':_0xf6a3('0x5'),'afterUpdate':_0xf6a3('0x6'),'afterDestroy':_0xf6a3('0x7')};function emitEvent(_0x359710){return function(_0x26fb75,_0x4ac1cb,_0x5cb51f){_0x26fb75[_0xf6a3('0x8')]({'attributes':['id'],'raw':!![]})[_0xf6a3('0x9')](function(_0x56327c){_0x26fb75[_0xf6a3('0xa')](_0xf6a3('0xb'),_0x56327c[_0xf6a3('0xc')](function(_0xb1a431){return{'id':_0xb1a431['id']};}));return FaxMessage[_0xf6a3('0xd')]({'where':{'FaxInteractionId':_0x26fb75['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf6a3('0x9')](function(_0x137de7){_0x26fb75[_0xf6a3('0xa')](_0xf6a3('0xe'),_0x137de7['length']);FaxInteractionEvents['emit'](_0x359710+':'+_0x26fb75['id'],_0x26fb75);FaxInteractionEvents[_0xf6a3('0xf')](_0x359710,_0x26fb75);_0x5cb51f(null);})[_0xf6a3('0x10')](_0x5cb51f(null));};}for(var e in events){if(events[_0xf6a3('0x11')](e)){var event=events[e];FaxInteraction[_0xf6a3('0x12')](e,emitEvent(event));}}module[_0xf6a3('0x13')]=FaxInteractionEvents; \ No newline at end of file +var _0xf55f=['length','emit','catch','hook','exports','events','../../mysqldb','FaxInteraction','setMaxListeners','save','update','getUsers','then','Users','map','findAll','setDataValue','unreadMessages'];(function(_0x2d238f,_0xd47c5c){var _0x2a2998=function(_0x215837){while(--_0x215837){_0x2d238f['push'](_0x2d238f['shift']());}};_0x2a2998(++_0xd47c5c);}(_0xf55f,0x16d));var _0xff55=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xf55f[_0x11005e];return _0x29338f;};'use strict';var EventEmitter=require(_0xff55('0x0'));var FaxInteraction=require(_0xff55('0x1'))['db'][_0xff55('0x2')];var FaxMessage=require(_0xff55('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xff55('0x3')](0x0);var events={'afterCreate':_0xff55('0x4'),'afterUpdate':_0xff55('0x5'),'afterDestroy':'remove'};function emitEvent(_0x69f3c4){return function(_0x40705f,_0x211ec2,_0x51a726){_0x40705f[_0xff55('0x6')]({'attributes':['id'],'raw':!![]})[_0xff55('0x7')](function(_0x5cccac){_0x40705f['setDataValue'](_0xff55('0x8'),_0x5cccac[_0xff55('0x9')](function(_0x3e1c08){return{'id':_0x3e1c08['id']};}));return FaxMessage[_0xff55('0xa')]({'where':{'FaxInteractionId':_0x40705f['id'],'direction':'in','read':![]},'raw':!![]});})[_0xff55('0x7')](function(_0x50598b){_0x40705f[_0xff55('0xb')](_0xff55('0xc'),_0x50598b[_0xff55('0xd')]);FaxInteractionEvents[_0xff55('0xe')](_0x69f3c4+':'+_0x40705f['id'],_0x40705f);FaxInteractionEvents['emit'](_0x69f3c4,_0x40705f);_0x51a726(null);})[_0xff55('0xf')](_0x51a726(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0xff55('0x10')](e,emitEvent(event));}}module[_0xff55('0x11')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 0e66c7a..dd3b1f5 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 _0xa3d4=['moment','request-promise','define','FaxInteraction','fax_interactions','changed','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xa3d4,0x151));var _0x4a3d=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xa3d4[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0x4a3d('0x0'));var util=require('util');var logger=require(_0x4a3d('0x1'))(_0x4a3d('0x2'));var moment=require(_0x4a3d('0x3'));var BPromise=require('bluebird');var rp=require(_0x4a3d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxInteraction.attributes');module['exports']=function(_0x3ab704,_0x461b5c){return _0x3ab704[_0x4a3d('0x5')](_0x4a3d('0x6'),attributes,{'tableName':_0x4a3d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4580f9,_0x3011e6,_0x79f478){if(_0x4580f9[_0x4a3d('0x8')]('closed')){_0x4580f9['closedAt']=moment()['format'](_0x4a3d('0x9'));}_0x79f478(null,_0x4580f9);}}});}; \ No newline at end of file +var _0xf7d6=['path','rimraf','../../config/environment','exports','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','bluebird','request-promise'];(function(_0x49d3d8,_0x4405fd){var _0x296f57=function(_0x300059){while(--_0x300059){_0x49d3d8['push'](_0x49d3d8['shift']());}};_0x296f57(++_0x4405fd);}(_0xf7d6,0x136));var _0x6f7d=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xf7d6[_0x411add];return _0x238242;};'use strict';var _=require(_0x6f7d('0x0'));var util=require(_0x6f7d('0x1'));var logger=require('../../config/logger')(_0x6f7d('0x2'));var moment=require('moment');var BPromise=require(_0x6f7d('0x3'));var rp=require(_0x6f7d('0x4'));var fs=require('fs');var path=require(_0x6f7d('0x5'));var rimraf=require(_0x6f7d('0x6'));var config=require(_0x6f7d('0x7'));var attributes=require('./faxInteraction.attributes');module[_0x6f7d('0x8')]=function(_0x45da40,_0x44c0fe){return _0x45da40['define']('FaxInteraction',attributes,{'tableName':_0x6f7d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x306189,_0xd99796,_0x534689){if(_0x306189[_0x6f7d('0xa')](_0x6f7d('0xb'))){_0x306189[_0x6f7d('0xc')]=moment()[_0x6f7d('0xd')](_0x6f7d('0xe'));}_0x534689(null,_0x306189);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index e476ed7..fc2ecb8 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 _0x8722=['ids','spread','AddTags','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./faxInteraction.socket','register','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateFaxInteraction','FaxInteraction','body','options','where','limit','debug','AddTagsToFaxInteraction','addTags'];(function(_0xf61d62,_0x5e1ce1){var _0x1b8b00=function(_0x21dbba){while(--_0x21dbba){_0xf61d62['push'](_0xf61d62['shift']());}};_0x1b8b00(++_0x5e1ce1);}(_0x8722,0x189));var _0x2872=function(_0x11faee,_0x3124b5){_0x11faee=_0x11faee-0x0;var _0x11e7d3=_0x8722[_0x11faee];return _0x11e7d3;};'use strict';var _=require(_0x2872('0x0'));var util=require(_0x2872('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2872('0x2'));var fs=require('fs');var Redis=require(_0x2872('0x3'));var db=require(_0x2872('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2872('0x5'))('rpc');var config=require(_0x2872('0x6'));var jayson=require(_0x2872('0x7'));var client=jayson[_0x2872('0x8')][_0x2872('0x9')]({'port':0x232a});config['redis']=_[_0x2872('0xa')](config[_0x2872('0xb')],{'host':_0x2872('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2872('0xd'))[_0x2872('0xe')](socket);function respondWithRpcPromise(_0x50fb1d,_0x2cc80f,_0x195534){return new BPromise(function(_0x947916,_0x59f8fd){return client[_0x2872('0xf')](_0x50fb1d,_0x195534)[_0x2872('0x10')](function(_0x2fdfbb){logger['info'](_0x2872('0x11'),_0x2cc80f,_0x2872('0x12'));logger['debug'](_0x2872('0x13'),_0x2cc80f,'request\x20sent',JSON[_0x2872('0x14')](_0x2fdfbb));if(_0x2fdfbb[_0x2872('0x15')]){if(_0x2fdfbb[_0x2872('0x15')][_0x2872('0x16')]===0x1f4){logger[_0x2872('0x15')](_0x2872('0x11'),_0x2cc80f,_0x2fdfbb[_0x2872('0x15')]['message']);return _0x59f8fd(_0x2fdfbb[_0x2872('0x15')][_0x2872('0x17')]);}logger[_0x2872('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x2cc80f,_0x2fdfbb[_0x2872('0x15')]['message']);return _0x947916(_0x2fdfbb['error']['message']);}else{logger[_0x2872('0x18')](_0x2872('0x11'),_0x2cc80f,_0x2872('0x12'));_0x947916(_0x2fdfbb[_0x2872('0x19')][_0x2872('0x17')]);}})[_0x2872('0x1a')](function(_0x4a06a1){logger[_0x2872('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x2cc80f,_0x4a06a1);_0x59f8fd(_0x4a06a1);});});}exports[_0x2872('0x1b')]=function(_0x166a92){var _0x51edf6=this;return new Promise(function(_0x4f7b1e,_0x2aabb2){return db[_0x2872('0x1c')]['update'](_0x166a92[_0x2872('0x1d')],{'raw':_0x166a92['options']?_0x166a92[_0x2872('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x166a92[_0x2872('0x1e')]?_0x166a92[_0x2872('0x1e')][_0x2872('0x1f')]||null:null,'attributes':_0x166a92[_0x2872('0x1e')]?_0x166a92[_0x2872('0x1e')]['attributes']||null:null,'limit':_0x166a92[_0x2872('0x1e')]?_0x166a92['options'][_0x2872('0x20')]||null:null})[_0x2872('0x10')](function(_0x4ac130){logger[_0x2872('0x18')](_0x2872('0x1b'),_0x166a92);logger[_0x2872('0x21')](_0x2872('0x1b'),_0x166a92,JSON[_0x2872('0x14')](_0x4ac130));_0x4f7b1e(_0x4ac130);})[_0x2872('0x1a')](function(_0x33afed){logger[_0x2872('0x15')](_0x2872('0x1b'),_0x33afed['message'],_0x166a92);_0x2aabb2(_0x51edf6[_0x2872('0x15')](0x1f4,_0x33afed[_0x2872('0x17')]));});});};exports[_0x2872('0x22')]=function(_0x1aea3b){return new Promise(function(_0x4d3688,_0x540ea1){return db[_0x2872('0x1c')]['find']({'where':_0x1aea3b[_0x2872('0x1e')]?_0x1aea3b['options'][_0x2872('0x1f')]||null:null})['then'](function(_0x221994){if(_0x221994){return _0x221994[_0x2872('0x23')](_0x1aea3b[_0x2872('0x1d')][_0x2872('0x24')],_['omit'](_0x1aea3b[_0x2872('0x1d')],[_0x2872('0x24'),'id'])||{});}})[_0x2872('0x25')](function(_0x48cb14){logger['info'](_0x2872('0x26'),_0x1aea3b);logger[_0x2872('0x21')](_0x2872('0x26'),_0x1aea3b,JSON['stringify'](_0x48cb14));_0x4d3688(_0x48cb14);})[_0x2872('0x1a')](function(_0x300317){logger[_0x2872('0x15')](_0x2872('0x26'),_0x300317['message'],_0x1aea3b);_0x540ea1(_this[_0x2872('0x15')](0x1f4,_0x300317[_0x2872('0x17')]));});});}; \ No newline at end of file +var _0x54f9=['rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','then','stringify','AddTagsToFaxInteraction','find','where','addTags','ids','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x54f9,0xf9));var _0x954f=function(_0x366f41,_0x47831f){_0x366f41=_0x366f41-0x0;var _0x3eaa3a=_0x54f9[_0x366f41];return _0x3eaa3a;};'use strict';var _=require(_0x954f('0x0'));var util=require(_0x954f('0x1'));var moment=require(_0x954f('0x2'));var BPromise=require(_0x954f('0x3'));var rs=require(_0x954f('0x4'));var fs=require('fs');var Redis=require(_0x954f('0x5'));var db=require(_0x954f('0x6'))['db'];var utils=require(_0x954f('0x7'));var logger=require(_0x954f('0x8'))(_0x954f('0x9'));var config=require(_0x954f('0xa'));var jayson=require(_0x954f('0xb'));var client=jayson[_0x954f('0xc')][_0x954f('0xd')]({'port':0x232a});config['redis']=_[_0x954f('0xe')](config[_0x954f('0xf')],{'host':_0x954f('0x10'),'port':0x18eb});var socket=require(_0x954f('0x11'))(new Redis(config['redis']));require(_0x954f('0x12'))[_0x954f('0x13')](socket);function respondWithRpcPromise(_0x1033a4,_0x544b1c,_0x59ebff){return new BPromise(function(_0x28bda3,_0x129eba){return client['request'](_0x1033a4,_0x59ebff)['then'](function(_0x45442d){logger[_0x954f('0x14')](_0x954f('0x15'),_0x544b1c,_0x954f('0x16'));logger[_0x954f('0x17')](_0x954f('0x18'),_0x544b1c,_0x954f('0x16'),JSON['stringify'](_0x45442d));if(_0x45442d[_0x954f('0x19')]){if(_0x45442d[_0x954f('0x19')]['code']===0x1f4){logger[_0x954f('0x19')](_0x954f('0x15'),_0x544b1c,_0x45442d[_0x954f('0x19')][_0x954f('0x1a')]);return _0x129eba(_0x45442d['error'][_0x954f('0x1a')]);}logger['error'](_0x954f('0x15'),_0x544b1c,_0x45442d[_0x954f('0x19')][_0x954f('0x1a')]);return _0x28bda3(_0x45442d[_0x954f('0x19')][_0x954f('0x1a')]);}else{logger['info'](_0x954f('0x15'),_0x544b1c,'request\x20sent');_0x28bda3(_0x45442d[_0x954f('0x1b')]['message']);}})[_0x954f('0x1c')](function(_0xe40686){logger[_0x954f('0x19')](_0x954f('0x15'),_0x544b1c,_0xe40686);_0x129eba(_0xe40686);});});}exports[_0x954f('0x1d')]=function(_0x4fbe0c){var _0x59d682=this;return new Promise(function(_0x4964eb,_0x4cd6c7){return db[_0x954f('0x1e')][_0x954f('0x1f')](_0x4fbe0c[_0x954f('0x20')],{'raw':_0x4fbe0c[_0x954f('0x21')]?_0x4fbe0c[_0x954f('0x21')][_0x954f('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fbe0c[_0x954f('0x21')]?_0x4fbe0c[_0x954f('0x21')]['where']||null:null,'attributes':_0x4fbe0c[_0x954f('0x21')]?_0x4fbe0c[_0x954f('0x21')]['attributes']||null:null,'limit':_0x4fbe0c['options']?_0x4fbe0c['options']['limit']||null:null})[_0x954f('0x23')](function(_0x1e3f0e){logger['info'](_0x954f('0x1d'),_0x4fbe0c);logger[_0x954f('0x17')](_0x954f('0x1d'),_0x4fbe0c,JSON[_0x954f('0x24')](_0x1e3f0e));_0x4964eb(_0x1e3f0e);})[_0x954f('0x1c')](function(_0x46b06a){logger[_0x954f('0x19')]('UpdateFaxInteraction',_0x46b06a[_0x954f('0x1a')],_0x4fbe0c);_0x4cd6c7(_0x59d682[_0x954f('0x19')](0x1f4,_0x46b06a[_0x954f('0x1a')]));});});};exports[_0x954f('0x25')]=function(_0x42ae2e){return new Promise(function(_0x2da58e,_0x56db5e){return db[_0x954f('0x1e')][_0x954f('0x26')]({'where':_0x42ae2e['options']?_0x42ae2e[_0x954f('0x21')][_0x954f('0x27')]||null:null})[_0x954f('0x23')](function(_0x56f626){if(_0x56f626){return _0x56f626[_0x954f('0x28')](_0x42ae2e[_0x954f('0x20')][_0x954f('0x29')],_['omit'](_0x42ae2e['body'],[_0x954f('0x29'),'id'])||{});}})['spread'](function(_0x9f02a0){logger[_0x954f('0x14')](_0x954f('0x2a'),_0x42ae2e);logger[_0x954f('0x17')](_0x954f('0x2a'),_0x42ae2e,JSON['stringify'](_0x9f02a0));_0x2da58e(_0x9f02a0);})['catch'](function(_0x2a9241){logger[_0x954f('0x19')](_0x954f('0x2a'),_0x2a9241[_0x954f('0x1a')],_0x42ae2e);_0x56db5e(_this[_0x954f('0x19')](0x1f4,_0x2a9241[_0x954f('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 1e8715a..ece50d7 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 _0x6252=['emit','removeListener','faxInteraction:','./faxInteraction.events','remove','update'];(function(_0x5929d6,_0x4f3835){var _0x52d38b=function(_0x99f48f){while(--_0x99f48f){_0x5929d6['push'](_0x5929d6['shift']());}};_0x52d38b(++_0x4f3835);}(_0x6252,0xc3));var _0x2625=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x6252[_0x49b207];return _0x2dc8fa;};'use strict';var FaxInteractionEvents=require(_0x2625('0x0'));var events=['save',_0x2625('0x1'),_0x2625('0x2')];function createListener(_0x4e1de8,_0x4b09e7){return function(_0x17597c){_0x4b09e7[_0x2625('0x3')](_0x4e1de8,_0x17597c);};}function removeListener(_0x247748,_0x46568d){return function(){FaxInteractionEvents[_0x2625('0x4')](_0x247748,_0x46568d);};}exports['register']=function(_0x511b62){for(var _0x43fc8d=0x0,_0x3ffa88=events['length'];_0x43fc8d<_0x3ffa88;_0x43fc8d++){var _0x396c4f=events[_0x43fc8d];var _0x4cb5af=createListener(_0x2625('0x5')+_0x396c4f,_0x511b62);FaxInteractionEvents['on'](_0x396c4f,_0x4cb5af);}}; \ No newline at end of file +var _0x7d5b=['emit','removeListener','length','./faxInteraction.events','save','remove','update'];(function(_0x40d078,_0x541e13){var _0x52c06b=function(_0x151fb5){while(--_0x151fb5){_0x40d078['push'](_0x40d078['shift']());}};_0x52c06b(++_0x541e13);}(_0x7d5b,0xf1));var _0xb7d5=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x7d5b[_0x39d544];return _0x5a5ff2;};'use strict';var FaxInteractionEvents=require(_0xb7d5('0x0'));var events=[_0xb7d5('0x1'),_0xb7d5('0x2'),_0xb7d5('0x3')];function createListener(_0x518586,_0x4446b1){return function(_0x16e9c5){_0x4446b1[_0xb7d5('0x4')](_0x518586,_0x16e9c5);};}function removeListener(_0x3042a2,_0x42f39c){return function(){FaxInteractionEvents[_0xb7d5('0x5')](_0x3042a2,_0x42f39c);};}exports['register']=function(_0x164782){for(var _0x5ca828=0x0,_0x474645=events[_0xb7d5('0x6')];_0x5ca828<_0x474645;_0x5ca828++){var _0x50fdde=events[_0x5ca828];var _0x13f3aa=createListener('faxInteraction:'+_0x50fdde,_0x164782);FaxInteractionEvents['on'](_0x50fdde,_0x13f3aa);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 578f8ce..5938859 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 _0x75a4=['tracked','fax','faxinteraction:addtags','addTags','put','/:id','faxinteraction:update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags'];(function(_0x5a8e47,_0x177836){var _0xacd8d3=function(_0x31344f){while(--_0x31344f){_0x5a8e47['push'](_0x5a8e47['shift']());}};_0xacd8d3(++_0x177836);}(_0x75a4,0x180));var _0x475a=function(_0x335278,_0x22e892){_0x335278=_0x335278-0x0;var _0x590908=_0x75a4[_0x335278];return _0x590908;};'use strict';var multer=require(_0x475a('0x0'));var util=require(_0x475a('0x1'));var path=require(_0x475a('0x2'));var timeout=require('connect-timeout');var express=require(_0x475a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x475a('0x4'));var config=require('../../config/environment');var controller=require(_0x475a('0x5'));router[_0x475a('0x6')]('/',auth[_0x475a('0x7')](),controller[_0x475a('0x8')]);router[_0x475a('0x6')](_0x475a('0x9'),auth[_0x475a('0x7')](),controller[_0x475a('0xa')]);router[_0x475a('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x475a('0xb')]);router[_0x475a('0x6')](_0x475a('0xc'),auth[_0x475a('0x7')](),controller[_0x475a('0xd')]);router[_0x475a('0x6')](_0x475a('0xe'),auth[_0x475a('0x7')](),controller['download']);router[_0x475a('0xf')]('/',auth[_0x475a('0x7')](),controller[_0x475a('0x10')]);router[_0x475a('0xf')](_0x475a('0xc'),auth[_0x475a('0x7')](),controller[_0x475a('0x11')]);router[_0x475a('0xf')](_0x475a('0x12'),auth['isAuthenticated'](),interaction[_0x475a('0x13')](_0x475a('0x14'),_0x475a('0x15')),controller[_0x475a('0x16')]);router[_0x475a('0x17')](_0x475a('0x18'),auth[_0x475a('0x7')](),interaction[_0x475a('0x13')](_0x475a('0x14'),_0x475a('0x19')),controller['update']);router[_0x475a('0x1a')](_0x475a('0x18'),auth[_0x475a('0x7')](),interaction[_0x475a('0x13')](_0x475a('0x14'),_0x475a('0x1b')),controller[_0x475a('0x1c')]);router[_0x475a('0x1a')]('/:id/tags',auth[_0x475a('0x7')](),controller[_0x475a('0x1d')]);module[_0x475a('0x1e')]=router; \ No newline at end of file +var _0x1cda=['delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./faxInteraction.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','fax','faxinteraction:addtags','addTags','put','tracked','faxinteraction:update','update'];(function(_0x1de784,_0x4c6eee){var _0x540489=function(_0x2bd0d6){while(--_0x2bd0d6){_0x1de784['push'](_0x1de784['shift']());}};_0x540489(++_0x4c6eee);}(_0x1cda,0x91));var _0xa1cd=function(_0x49a54d,_0x3ea9a6){_0x49a54d=_0x49a54d-0x0;var _0x59f69a=_0x1cda[_0x49a54d];return _0x59f69a;};'use strict';var multer=require(_0xa1cd('0x0'));var util=require(_0xa1cd('0x1'));var path=require(_0xa1cd('0x2'));var timeout=require('connect-timeout');var express=require(_0xa1cd('0x3'));var router=express[_0xa1cd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa1cd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa1cd('0x6'));var controller=require(_0xa1cd('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xa1cd('0x8')]);router[_0xa1cd('0x9')](_0xa1cd('0xa'),auth[_0xa1cd('0xb')](),controller[_0xa1cd('0xc')]);router[_0xa1cd('0x9')](_0xa1cd('0xd'),auth['isAuthenticated'](),controller[_0xa1cd('0xe')]);router[_0xa1cd('0x9')](_0xa1cd('0xf'),auth[_0xa1cd('0xb')](),controller[_0xa1cd('0x10')]);router[_0xa1cd('0x9')](_0xa1cd('0x11'),auth['isAuthenticated'](),controller[_0xa1cd('0x12')]);router[_0xa1cd('0x13')]('/',auth[_0xa1cd('0xb')](),controller[_0xa1cd('0x14')]);router[_0xa1cd('0x13')](_0xa1cd('0xf'),auth[_0xa1cd('0xb')](),controller[_0xa1cd('0x15')]);router[_0xa1cd('0x13')](_0xa1cd('0x16'),auth[_0xa1cd('0xb')](),interaction['tracked'](_0xa1cd('0x17'),_0xa1cd('0x18')),controller[_0xa1cd('0x19')]);router[_0xa1cd('0x1a')](_0xa1cd('0xd'),auth['isAuthenticated'](),interaction[_0xa1cd('0x1b')](_0xa1cd('0x17'),_0xa1cd('0x1c')),controller[_0xa1cd('0x1d')]);router[_0xa1cd('0x1e')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0xa1cd('0x17'),_0xa1cd('0x1f')),controller[_0xa1cd('0x20')]);router['delete'](_0xa1cd('0x16'),auth[_0xa1cd('0xb')](),controller[_0xa1cd('0x21')]);module[_0xa1cd('0x22')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 54987e9..01bd3f7 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 _0x66fa=['sequelize','exports','TEXT','ENUM','out','DATE'];(function(_0x22dfca,_0x2c6e8d){var _0x5b8794=function(_0x52f50d){while(--_0x52f50d){_0x22dfca['push'](_0x22dfca['shift']());}};_0x5b8794(++_0x2c6e8d);}(_0x66fa,0x168));var _0xa66f=function(_0xbbc489,_0x14aac4){_0xbbc489=_0xbbc489-0x0;var _0x132d80=_0x66fa[_0xbbc489];return _0x132d80;};'use strict';var Sequelize=require(_0xa66f('0x0'));module[_0xa66f('0x1')]={'body':{'type':Sequelize[_0xa66f('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xa66f('0x3')]('in',_0xa66f('0x4')),'defaultValue':_0xa66f('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xa66f('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xa66f('0x5')]}}; \ No newline at end of file +var _0x83d3=['out','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x181d93,_0x2de070){var _0x4e7502=function(_0x11c225){while(--_0x11c225){_0x181d93['push'](_0x181d93['shift']());}};_0x4e7502(++_0x2de070);}(_0x83d3,0x17c));var _0x383d=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0x83d3[_0x57486e];return _0x5f110b;};'use strict';var Sequelize=require(_0x383d('0x0'));module[_0x383d('0x1')]={'body':{'type':Sequelize[_0x383d('0x2')](_0x383d('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x383d('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x383d('0x5')),'defaultValue':_0x383d('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x383d('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x383d('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index f7a5fa4..039c61e 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 _0xd090=['destroy','end','stack','name','send','index','map','FaxMessage','rawAttributes','type','key','model','query','keys','attributes','fields','length','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','include','findAll','rows','catch','show','params','intersection','includeAll','options','find','body','describe','../../config/logger','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','FaxInteraction','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','agent','manual','channel','motionChannel','event','accept','EventManager','fax','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','interface','SIP/%s','create','CmContact','findOne','AttachmentId','SendFax','FaxAccountId','basename','download','join','root','server','files','Attachment','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','then'];(function(_0x8ff7a6,_0x5929d2){var _0x437bae=function(_0x5127c6){while(--_0x5127c6){_0x8ff7a6['push'](_0x8ff7a6['shift']());}};_0x437bae(++_0x5929d2);}(_0xd090,0xeb));var _0x0d09=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd090[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x0d09('0x0'));var rimraf=require(_0x0d09('0x1'));var zipdir=require(_0x0d09('0x2'));var jsonpatch=require(_0x0d09('0x3'));var rp=require(_0x0d09('0x4'));var moment=require(_0x0d09('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0d09('0x6'));var path=require(_0x0d09('0x7'));var sox=require('sox');var csv=require(_0x0d09('0x8'));var ejs=require(_0x0d09('0x9'));var fs=require('fs');var fs_extra=require(_0x0d09('0xa'));var _=require(_0x0d09('0xb'));var squel=require(_0x0d09('0xc'));var crypto=require(_0x0d09('0xd'));var jsforce=require(_0x0d09('0xe'));var deskjs=require(_0x0d09('0xf'));var toCsv=require(_0x0d09('0x8'));var querystring=require('querystring');var Papa=require(_0x0d09('0x10'));var Redis=require('ioredis');var authService=require(_0x0d09('0x11'));var qs=require(_0x0d09('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d09('0x13'));var logger=require('../../config/logger')(_0x0d09('0x14'));var utils=require(_0x0d09('0x15'));var config=require(_0x0d09('0x16'));var licenseUtil=require(_0x0d09('0x17'));var db=require(_0x0d09('0x18'))['db'];config[_0x0d09('0x19')]=_[_0x0d09('0x1a')](config[_0x0d09('0x19')],{'host':_0x0d09('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxMessage.socket')[_0x0d09('0x1c')](socket);var jayson=require(_0x0d09('0x1d'));var client=jayson[_0x0d09('0x1e')][_0x0d09('0x1f')]({'port':0x232c});var client9002=jayson[_0x0d09('0x1e')][_0x0d09('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x54c9b2,_0x156ca5,_0x5b451e,_0x2b9b9b){return new BPromise(function(_0xe3eadf,_0x3f16c0){var _0x5ed71a=_0x2b9b9b||client;return _0x5ed71a[_0x0d09('0x20')](_0x54c9b2,_0x5b451e)['then'](function(_0x21ab6c){logger[_0x0d09('0x21')](_0x0d09('0x22'),_0x156ca5,_0x0d09('0x23'));logger[_0x0d09('0x24')](_0x0d09('0x25'),_0x156ca5,_0x0d09('0x23'),JSON[_0x0d09('0x26')](_0x21ab6c));if(_0x21ab6c[_0x0d09('0x27')]){if(_0x21ab6c[_0x0d09('0x27')][_0x0d09('0x28')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x156ca5,_0x21ab6c[_0x0d09('0x27')]['message']);return _0x3f16c0(_0x21ab6c[_0x0d09('0x27')][_0x0d09('0x29')]);}logger[_0x0d09('0x27')](_0x0d09('0x22'),_0x156ca5,_0x21ab6c[_0x0d09('0x27')]['message']);return _0xe3eadf(_0x21ab6c['error'][_0x0d09('0x29')]);}else{logger[_0x0d09('0x21')]('FaxMessage,\x20%s,\x20%s',_0x156ca5,_0x0d09('0x23'));_0xe3eadf(_0x21ab6c[_0x0d09('0x2a')][_0x0d09('0x29')]);}})['catch'](function(_0xb471ef){logger[_0x0d09('0x27')](_0x0d09('0x22'),_0x156ca5,_0xb471ef);_0x3f16c0(_0xb471ef);});});}function respondWithStatusCode(_0x1ffc2d,_0x3ad395){_0x3ad395=_0x3ad395||0xcc;return function(_0x2a842e){if(_0x2a842e){return _0x1ffc2d[_0x0d09('0x2b')](_0x3ad395);}return _0x1ffc2d['status'](_0x3ad395)['end']();};}function respondWithResult(_0x4456fc,_0x566a55){_0x566a55=_0x566a55||0xc8;return function(_0x3a1d12){if(_0x3a1d12){return _0x4456fc[_0x0d09('0x2c')](_0x566a55)['json'](_0x3a1d12);}};}function respondWithFilteredResult(_0xda4c58,_0x55f85c){return function(_0x8cdd63){if(_0x8cdd63){var _0x52216b=typeof _0x55f85c[_0x0d09('0x2d')]===_0x0d09('0x2e')&&typeof _0x55f85c[_0x0d09('0x2f')]===_0x0d09('0x2e');var _0x387e5a=_0x8cdd63[_0x0d09('0x30')];var _0xfe993c=_0x52216b?0x0:_0x55f85c[_0x0d09('0x2d')];var _0x5be12e=_0x52216b?_0x8cdd63[_0x0d09('0x30')]:_0x55f85c['offset']+_0x55f85c[_0x0d09('0x2f')];var _0x1f7829;if(_0x5be12e>=_0x387e5a){_0x5be12e=_0x387e5a;_0x1f7829=0xc8;}else{_0x1f7829=0xce;}_0xda4c58[_0x0d09('0x2c')](_0x1f7829);return _0xda4c58['set'](_0x0d09('0x31'),_0xfe993c+'-'+_0x5be12e+'/'+_0x387e5a)[_0x0d09('0x32')](_0x8cdd63);}return null;};}function patchUpdates(_0x1ef665){return function(_0x57d112){try{jsonpatch['apply'](_0x57d112,_0x1ef665,!![]);}catch(_0x48d242){return BPromise[_0x0d09('0x33')](_0x48d242);}return _0x57d112[_0x0d09('0x34')]();};}function saveUpdates(_0x5ba9f7,_0x258f56){return function(_0x470bf4){if(_0x470bf4){return _0x470bf4[_0x0d09('0x35')](_0x5ba9f7)[_0x0d09('0x36')](function(_0x5090a6){return _0x5090a6;});}return null;};}function removeEntity(_0x303414,_0x218062){return function(_0x22d4c8){if(_0x22d4c8){return _0x22d4c8[_0x0d09('0x37')]()['then'](function(){_0x303414[_0x0d09('0x2c')](0xcc)[_0x0d09('0x38')]();});}};}function handleEntityNotFound(_0x8a67cd,_0x370bb6){return function(_0x234fbe){if(!_0x234fbe){_0x8a67cd[_0x0d09('0x2b')](0x194);}return _0x234fbe;};}function handleError(_0x10742a,_0x2b67f6){_0x2b67f6=_0x2b67f6||0x1f4;return function(_0x3250ad){logger['error'](_0x3250ad[_0x0d09('0x39')]);if(_0x3250ad[_0x0d09('0x3a')]){delete _0x3250ad[_0x0d09('0x3a')];}_0x10742a['status'](_0x2b67f6)[_0x0d09('0x3b')](_0x3250ad);};}exports[_0x0d09('0x3c')]=function(_0x54219d,_0x5c9330){var _0x413459={},_0x5f46fa={},_0x3276cc={'count':0x0,'rows':[]};var _0x598b01=_[_0x0d09('0x3d')](db[_0x0d09('0x3e')][_0x0d09('0x3f')],function(_0xd2c84f){return{'name':_0xd2c84f['fieldName'],'type':_0xd2c84f[_0x0d09('0x40')][_0x0d09('0x41')]};});_0x5f46fa[_0x0d09('0x42')]=_[_0x0d09('0x3d')](_0x598b01,_0x0d09('0x3a'));_0x5f46fa[_0x0d09('0x43')]=_[_0x0d09('0x44')](_0x54219d[_0x0d09('0x43')]);_0x5f46fa['filters']=_['intersection'](_0x5f46fa['model'],_0x5f46fa[_0x0d09('0x43')]);_0x413459[_0x0d09('0x45')]=_['intersection'](_0x5f46fa['model'],qs[_0x0d09('0x46')](_0x54219d[_0x0d09('0x43')]['fields']));_0x413459['attributes']=_0x413459[_0x0d09('0x45')][_0x0d09('0x47')]?_0x413459['attributes']:_0x5f46fa[_0x0d09('0x42')];if(!_0x54219d[_0x0d09('0x43')]['hasOwnProperty'](_0x0d09('0x48'))){_0x413459[_0x0d09('0x2f')]=qs[_0x0d09('0x2f')](_0x54219d[_0x0d09('0x43')]['limit']);_0x413459['offset']=qs[_0x0d09('0x2d')](_0x54219d[_0x0d09('0x43')][_0x0d09('0x2d')]);}_0x413459[_0x0d09('0x49')]=qs['sort'](_0x54219d[_0x0d09('0x43')][_0x0d09('0x4a')]);_0x413459[_0x0d09('0x4b')]=qs['filters'](_[_0x0d09('0x4c')](_0x54219d[_0x0d09('0x43')],_0x5f46fa[_0x0d09('0x4d')]),_0x598b01);if(_0x54219d[_0x0d09('0x43')]['filter']){_0x413459[_0x0d09('0x4b')]=_[_0x0d09('0x4e')](_0x413459[_0x0d09('0x4b')],{'$or':_[_0x0d09('0x3d')](_0x598b01,function(_0x569ee0){if(_0x569ee0[_0x0d09('0x40')]!==_0x0d09('0x4f')){var _0x257906={};_0x257906[_0x569ee0[_0x0d09('0x3a')]]={'$like':'%'+_0x54219d[_0x0d09('0x43')][_0x0d09('0x50')]+'%'};return _0x257906;}})});}_0x413459=_[_0x0d09('0x4e')]({},_0x413459,_0x54219d['options']);var _0x2d2a89={'where':_0x413459[_0x0d09('0x4b')]};return db[_0x0d09('0x3e')][_0x0d09('0x30')](_0x2d2a89)[_0x0d09('0x36')](function(_0x3e86ee){_0x3276cc[_0x0d09('0x30')]=_0x3e86ee;if(_0x54219d[_0x0d09('0x43')]['includeAll']){_0x413459[_0x0d09('0x51')]=[{'all':!![]}];}return db['FaxMessage'][_0x0d09('0x52')](_0x413459);})[_0x0d09('0x36')](function(_0x311a6d){_0x3276cc[_0x0d09('0x53')]=_0x311a6d;return _0x3276cc;})[_0x0d09('0x36')](respondWithFilteredResult(_0x5c9330,_0x413459))[_0x0d09('0x54')](handleError(_0x5c9330,null));};exports[_0x0d09('0x55')]=function(_0x1fab63,_0x335386){var _0x13a3f3={'raw':!![],'where':{'id':_0x1fab63[_0x0d09('0x56')]['id']}},_0x6a2e7e={};_0x6a2e7e[_0x0d09('0x42')]=_['keys'](db[_0x0d09('0x3e')][_0x0d09('0x3f')]);_0x6a2e7e[_0x0d09('0x43')]=_[_0x0d09('0x44')](_0x1fab63['query']);_0x6a2e7e[_0x0d09('0x4d')]=_[_0x0d09('0x57')](_0x6a2e7e[_0x0d09('0x42')],_0x6a2e7e['query']);_0x13a3f3['attributes']=_[_0x0d09('0x57')](_0x6a2e7e[_0x0d09('0x42')],qs[_0x0d09('0x46')](_0x1fab63[_0x0d09('0x43')][_0x0d09('0x46')]));_0x13a3f3[_0x0d09('0x45')]=_0x13a3f3['attributes'][_0x0d09('0x47')]?_0x13a3f3[_0x0d09('0x45')]:_0x6a2e7e[_0x0d09('0x42')];if(_0x1fab63[_0x0d09('0x43')][_0x0d09('0x58')]){_0x13a3f3[_0x0d09('0x51')]=[{'all':!![]}];}_0x13a3f3=_[_0x0d09('0x4e')]({},_0x13a3f3,_0x1fab63[_0x0d09('0x59')]);return db['FaxMessage'][_0x0d09('0x5a')](_0x13a3f3)[_0x0d09('0x36')](handleEntityNotFound(_0x335386,null))['then'](respondWithResult(_0x335386,null))[_0x0d09('0x54')](handleError(_0x335386,null));};exports[_0x0d09('0x35')]=function(_0x411116,_0x3b194d){if(_0x411116['body']['id']){delete _0x411116[_0x0d09('0x5b')]['id'];}return db['FaxMessage'][_0x0d09('0x5a')]({'where':{'id':_0x411116[_0x0d09('0x56')]['id']}})[_0x0d09('0x36')](handleEntityNotFound(_0x3b194d,null))[_0x0d09('0x36')](saveUpdates(_0x411116['body'],null))[_0x0d09('0x36')](respondWithResult(_0x3b194d,null))[_0x0d09('0x54')](handleError(_0x3b194d,null));};exports[_0x0d09('0x37')]=function(_0x515a61,_0x57066a){return db[_0x0d09('0x3e')][_0x0d09('0x5a')]({'where':{'id':_0x515a61[_0x0d09('0x56')]['id']}})['then'](handleEntityNotFound(_0x57066a,null))[_0x0d09('0x36')](removeEntity(_0x57066a,null))['catch'](handleError(_0x57066a,null));};exports[_0x0d09('0x5c')]=function(_0xc75246,_0x16bbc4){return db[_0x0d09('0x3e')]['describe']()[_0x0d09('0x36')](respondWithResult(_0x16bbc4,null))['catch'](handleError(_0x16bbc4,null));};var interaction_log=require(_0x0d09('0x5d'))('fax-interactions');exports['accept']=function(_0x5252f4,_0x2b3e1b,_0x26f752){var _0x49d9df={'agent':{},'channel':'fax'};if(_0x5252f4['body']['id']){delete _0x5252f4[_0x0d09('0x5b')]['id'];}_0x5252f4[_0x0d09('0x5b')][_0x0d09('0x5e')]=!![];_0x5252f4[_0x0d09('0x5b')][_0x0d09('0x5f')]=moment()[_0x0d09('0x60')](_0x0d09('0x61'));_0x5252f4[_0x0d09('0x5b')][_0x0d09('0x62')]=_0x5252f4[_0x0d09('0x5b')]['UserId']||_0x5252f4['user']['id'];_0x49d9df['agent']['id']=_0x5252f4[_0x0d09('0x5b')]['UserId'];return db['FaxMessage'][_0x0d09('0x5a')]({'where':{'id':_0x5252f4[_0x0d09('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2b3e1b,null))[_0x0d09('0x36')](saveUpdates(_0x5252f4[_0x0d09('0x5b')],null))[_0x0d09('0x36')](function(_0x5aa3ab){if(_0x5aa3ab){_0x49d9df[_0x0d09('0x29')]=_0x5aa3ab[_0x0d09('0x63')]({'plain':!![]});return db[_0x0d09('0x64')][_0x0d09('0x5a')]({'where':{'id':_0x5aa3ab['FaxInteractionId']}});}return null;})[_0x0d09('0x36')](handleEntityNotFound(_0x2b3e1b,null))[_0x0d09('0x36')](function(_0x446571){if(_0x446571){return _0x446571[_0x0d09('0x35')]({'UserId':_0x5252f4[_0x0d09('0x5b')][_0x0d09('0x62')],'read1stAt':_[_0x0d09('0x65')](_0x446571[_0x0d09('0x66')])?moment()['format'](_0x0d09('0x61')):undefined});}return null;})[_0x0d09('0x36')](function(_0x2c0480){if(_0x2c0480){_0x49d9df[_0x0d09('0x67')]=_0x2c0480[_0x0d09('0x63')]({'plain':!![]});interaction_log['info'](_0x0d09('0x68'),_0x5252f4[_0x0d09('0x69')]['id'],_0x5252f4['user'][_0x0d09('0x3a')],_0x5252f4['user'][_0x0d09('0x6a')],_0x49d9df[_0x0d09('0x67')]['id'],_0x5252f4[_0x0d09('0x5b')]?JSON['stringify'](_0x5252f4[_0x0d09('0x5b')]):_0x0d09('0x6b'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x49d9df);}return null;})[_0x0d09('0x36')](function(_0x33339f){var _0x53f292=_0x0d09('0x6c')+_0x33339f[_0x0d09('0x29')][_0x0d09('0x6d')];return db[_0x0d09('0x6e')]['query'](_0x53f292,{'type':db[_0x0d09('0x6f')][_0x0d09('0x70')][_0x0d09('0x71')],'raw':!![]})[_0x0d09('0x36')](function(_0x526701){return _0x526701;});})['then'](function(_0x1b0769){if(_0x1b0769){_0x49d9df[_0x0d09('0x29')][_0x0d09('0x72')]=_0x1b0769[0x0];if(!_0x5252f4[_0x0d09('0x5b')][_0x0d09('0x62')])return;return db[_0x0d09('0x73')][_0x0d09('0x5a')]({'where':{'id':_0x5252f4['body'][_0x0d09('0x62')],'role':'agent'},'attributes':['id','name',_0x0d09('0x74'),_0x0d09('0x75'),_0x0d09('0x76')],'raw':!![]});}return null;})['then'](function(_0x1dcab){if(!_0x1dcab)return null;_0x49d9df[_0x0d09('0x29')][_0x0d09('0x77')]=_0x1dcab;return _0x49d9df;})[_0x0d09('0x36')](function(_0x452466){if(_0x452466){if(_0x5252f4[_0x0d09('0x5b')][_0x0d09('0x78')]){_0x49d9df[_0x0d09('0x29')]['interface']=util[_0x0d09('0x60')]('SIP/%s',_0x5252f4[_0x0d09('0x69')][_0x0d09('0x3a')]);_0x49d9df[_0x0d09('0x29')][_0x0d09('0x79')]=_0x49d9df[_0x0d09('0x79')];_0x49d9df[_0x0d09('0x29')][_0x0d09('0x7a')]=_0x49d9df[_0x0d09('0x79')];_0x49d9df[_0x0d09('0x29')][_0x0d09('0x7b')]=_0x0d09('0x7c');return respondWithRpcPromise(_0x0d09('0x7d'),_0x0d09('0x7d'),{'event':'acceptmessage','message':_0x49d9df[_0x0d09('0x29')]},client9002)['then'](function(){return _0x49d9df;});}return _0x49d9df;}return null;})[_0x0d09('0x36')](respondWithResult(_0x2b3e1b,null))['catch'](handleError(_0x2b3e1b,null));};var interaction_log=require(_0x0d09('0x5d'))('fax-interactions');exports[_0x0d09('0x33')]=function(_0xb8fefb,_0x18d724,_0x5bb3ab){var _0x2dc191={'agent':{},'channel':_0x0d09('0x7e')};if(_0xb8fefb['body']['id']){delete _0xb8fefb[_0x0d09('0x5b')]['id'];}_0xb8fefb[_0x0d09('0x5b')][_0x0d09('0x62')]=_0xb8fefb[_0x0d09('0x5b')][_0x0d09('0x62')]||_0xb8fefb['user']['id'];_0x2dc191[_0x0d09('0x77')]['id']=_0xb8fefb['body'][_0x0d09('0x62')];return db['FaxMessage'][_0x0d09('0x5a')]({'where':{'id':_0xb8fefb[_0x0d09('0x56')]['id'],'UserId':null}})[_0x0d09('0x36')](handleEntityNotFound(_0x18d724,null))[_0x0d09('0x36')](function(_0x181861){if(_0x181861){_0x2dc191[_0x0d09('0x29')]=_0x181861[_0x0d09('0x63')]({'plain':!![]});return db['FaxInteraction'][_0x0d09('0x5a')]({'where':{'id':_0x181861[_0x0d09('0x7f')]}});}return null;})[_0x0d09('0x36')](handleEntityNotFound(_0x18d724,null))[_0x0d09('0x36')](function(_0x13faf5){if(_0x13faf5){_0x2dc191[_0x0d09('0x67')]=_0x13faf5[_0x0d09('0x63')]({'plain':!![]});interaction_log[_0x0d09('0x21')](_0x0d09('0x80'),_0xb8fefb['user']['id'],_0xb8fefb[_0x0d09('0x69')][_0x0d09('0x3a')],_0xb8fefb[_0x0d09('0x69')]['role'],_0x2dc191[_0x0d09('0x67')]['id'],_0xb8fefb[_0x0d09('0x5b')]?JSON[_0x0d09('0x26')](_0xb8fefb[_0x0d09('0x5b')]):'null');return respondWithRpcPromise('RejectMessage',_0x0d09('0x81'),_0x2dc191);}return null;})[_0x0d09('0x36')](function(_0x485ba6){var _0x53f177='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x485ba6[_0x0d09('0x29')]['ContactId'];return db[_0x0d09('0x6e')][_0x0d09('0x43')](_0x53f177,{'type':db['Sequelize'][_0x0d09('0x70')][_0x0d09('0x71')],'raw':!![]})[_0x0d09('0x36')](function(_0x5557cc){return _0x5557cc;});})[_0x0d09('0x36')](function(_0x283c){if(_0x283c){_0x2dc191[_0x0d09('0x29')][_0x0d09('0x72')]=_0x283c[0x0];if(!_0xb8fefb[_0x0d09('0x5b')][_0x0d09('0x62')])return;return db[_0x0d09('0x73')][_0x0d09('0x5a')]({'where':{'id':_0xb8fefb['body'][_0x0d09('0x62')],'role':_0x0d09('0x77')},'attributes':['id','name','fullname','email',_0x0d09('0x76')],'raw':!![]});}return null;})[_0x0d09('0x36')](function(_0x1f538c){if(!_0x1f538c)return null;_0x2dc191[_0x0d09('0x29')][_0x0d09('0x77')]=_0x1f538c;return _0x2dc191;})[_0x0d09('0x36')](function(_0x1afc49){if(_0x1afc49){_0x1afc49[_0x0d09('0x29')][_0x0d09('0x82')]=util[_0x0d09('0x60')](_0x0d09('0x83'),_0xb8fefb['user'][_0x0d09('0x3a')]);_0x1afc49['message'][_0x0d09('0x79')]=_0x2dc191[_0x0d09('0x79')];_0x1afc49[_0x0d09('0x29')][_0x0d09('0x7a')]=_0x2dc191[_0x0d09('0x79')];_0x1afc49[_0x0d09('0x29')]['event']=_0x0d09('0x33');respondWithRpcPromise('EventManager',_0x0d09('0x7d'),{'event':'rejectmessage','message':_0x1afc49[_0x0d09('0x29')]},client9002);return _0x2dc191;}return null;})[_0x0d09('0x36')](respondWithResult(_0x18d724,null))[_0x0d09('0x54')](handleError(_0x18d724,null));};exports[_0x0d09('0x84')]=function(_0x3cc9e2,_0x338215){var _0x1c91bf;return db[_0x0d09('0x3e')][_0x0d09('0x84')](_0x3cc9e2['body'],{})[_0x0d09('0x36')](function(_0x64702a){_0x1c91bf=_0x64702a;return db[_0x0d09('0x85')][_0x0d09('0x86')]({'where':{'id':_0x1c91bf['ContactId']}});})[_0x0d09('0x36')](function(_0x4a191f){if(_[_0x0d09('0x65')](_0x4a191f)){return;}else{_0x1c91bf[_0x0d09('0x7e')]=_0x4a191f[_0x0d09('0x7e')];return db['Attachment'][_0x0d09('0x86')]({'where':{'id':_0x1c91bf[_0x0d09('0x87')]}});}})[_0x0d09('0x36')](function(_0x418c26){return respondWithRpcPromise(_0x0d09('0x88'),_0x0d09('0x88'),{'FaxAccountId':_['isNil'](_0x3cc9e2[_0x0d09('0x5b')])?undefined:_0x3cc9e2[_0x0d09('0x5b')][_0x0d09('0x89')],'path':_['isNil'](_0x418c26)?undefined:util[_0x0d09('0x60')]('/var/opt/motion2/server/files/attachments/%s',_0x418c26[_0x0d09('0x8a')]),'fax':_['isNil'](_0x1c91bf[_0x0d09('0x7e')])?undefined:_0x1c91bf['fax'],'AttachmentId':_0x1c91bf[_0x0d09('0x87')]},client9002);})[_0x0d09('0x36')](respondWithResult(_0x338215,0xc9))[_0x0d09('0x54')](handleError(_0x338215,null));};exports[_0x0d09('0x8b')]=function(_0xc304f2,_0x520de6){var _0x1f8ef5=path[_0x0d09('0x8c')](config[_0x0d09('0x8d')],_0x0d09('0x8e'),_0x0d09('0x8f'),'attachments');return db[_0x0d09('0x3e')][_0x0d09('0x5a')]({'where':{'id':_0xc304f2['params']['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x520de6,null))['then'](function(_0x36b5f1){if(_0x36b5f1){return _0x520de6[_0x0d09('0x8b')](path['join'](_0x1f8ef5,_0x36b5f1[_0x0d09('0x90')]['basename']));}})[_0x0d09('0x54')](handleError(_0x520de6,null));}; \ No newline at end of file +var _0xb063=['update','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','includeAll','include','findAll','rows','params','options','find','body','describe','../../config/logger','accept','fax','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','contact','fullname','email','internal','SIP/%s','channel','motionChannel','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','SELECT','User','interface','event','rejectmessage','create','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','join','root','server','files','attachments','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save'];(function(_0x5df435,_0x56de86){var _0x1ca33b=function(_0x318e49){while(--_0x318e49){_0x5df435['push'](_0x5df435['shift']());}};_0x1ca33b(++_0x56de86);}(_0xb063,0xe8));var _0x3b06=function(_0x319516,_0x270808){_0x319516=_0x319516-0x0;var _0x289583=_0xb063[_0x319516];return _0x289583;};'use strict';var emlformat=require(_0x3b06('0x0'));var rimraf=require(_0x3b06('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3b06('0x2'));var moment=require(_0x3b06('0x3'));var BPromise=require(_0x3b06('0x4'));var Mustache=require(_0x3b06('0x5'));var util=require(_0x3b06('0x6'));var path=require(_0x3b06('0x7'));var sox=require(_0x3b06('0x8'));var csv=require('to-csv');var ejs=require(_0x3b06('0x9'));var fs=require('fs');var fs_extra=require(_0x3b06('0xa'));var _=require(_0x3b06('0xb'));var squel=require(_0x3b06('0xc'));var crypto=require(_0x3b06('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3b06('0xe'));var toCsv=require(_0x3b06('0xf'));var querystring=require('querystring');var Papa=require(_0x3b06('0x10'));var Redis=require(_0x3b06('0x11'));var authService=require(_0x3b06('0x12'));var qs=require(_0x3b06('0x13'));var as=require(_0x3b06('0x14'));var hardwareService=require(_0x3b06('0x15'));var logger=require('../../config/logger')(_0x3b06('0x16'));var utils=require('../../config/utils');var config=require(_0x3b06('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3b06('0x18'))['db'];config['redis']=_['defaults'](config[_0x3b06('0x19')],{'host':_0x3b06('0x1a'),'port':0x18eb});var socket=require(_0x3b06('0x1b'))(new Redis(config[_0x3b06('0x19')]));require(_0x3b06('0x1c'))['register'](socket);var jayson=require(_0x3b06('0x1d'));var client=jayson[_0x3b06('0x1e')][_0x3b06('0x1f')]({'port':0x232c});var client9002=jayson[_0x3b06('0x1e')][_0x3b06('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x16a532,_0x1f897b,_0x4325ec,_0x15b6a6){return new BPromise(function(_0x46dc9d,_0x380e7a){var _0x231e63=_0x15b6a6||client;return _0x231e63[_0x3b06('0x20')](_0x16a532,_0x4325ec)[_0x3b06('0x21')](function(_0x1c4b46){logger[_0x3b06('0x22')](_0x3b06('0x23'),_0x1f897b,_0x3b06('0x24'));logger[_0x3b06('0x25')](_0x3b06('0x26'),_0x1f897b,_0x3b06('0x24'),JSON['stringify'](_0x1c4b46));if(_0x1c4b46[_0x3b06('0x27')]){if(_0x1c4b46[_0x3b06('0x27')]['code']===0x1f4){logger[_0x3b06('0x27')]('FaxMessage,\x20%s,\x20%s',_0x1f897b,_0x1c4b46['error']['message']);return _0x380e7a(_0x1c4b46[_0x3b06('0x27')][_0x3b06('0x28')]);}logger[_0x3b06('0x27')](_0x3b06('0x23'),_0x1f897b,_0x1c4b46[_0x3b06('0x27')][_0x3b06('0x28')]);return _0x46dc9d(_0x1c4b46[_0x3b06('0x27')]['message']);}else{logger[_0x3b06('0x22')](_0x3b06('0x23'),_0x1f897b,'request\x20sent');_0x46dc9d(_0x1c4b46['result'][_0x3b06('0x28')]);}})[_0x3b06('0x29')](function(_0x49a650){logger[_0x3b06('0x27')](_0x3b06('0x23'),_0x1f897b,_0x49a650);_0x380e7a(_0x49a650);});});}function respondWithStatusCode(_0x5ab23a,_0x574c8c){_0x574c8c=_0x574c8c||0xcc;return function(_0x5b056e){if(_0x5b056e){return _0x5ab23a[_0x3b06('0x2a')](_0x574c8c);}return _0x5ab23a[_0x3b06('0x2b')](_0x574c8c)[_0x3b06('0x2c')]();};}function respondWithResult(_0xdf8856,_0x36609e){_0x36609e=_0x36609e||0xc8;return function(_0x5a8b87){if(_0x5a8b87){return _0xdf8856[_0x3b06('0x2b')](_0x36609e)[_0x3b06('0x2d')](_0x5a8b87);}};}function respondWithFilteredResult(_0x993d6d,_0x10d5ca){return function(_0x41d2b9){if(_0x41d2b9){var _0x44f929=typeof _0x10d5ca['offset']===_0x3b06('0x2e')&&typeof _0x10d5ca[_0x3b06('0x2f')]==='undefined';var _0x3bab3b=_0x41d2b9[_0x3b06('0x30')];var _0x2bcc4c=_0x44f929?0x0:_0x10d5ca['offset'];var _0x1e72e8=_0x44f929?_0x41d2b9[_0x3b06('0x30')]:_0x10d5ca[_0x3b06('0x31')]+_0x10d5ca[_0x3b06('0x2f')];var _0xa027b0;if(_0x1e72e8>=_0x3bab3b){_0x1e72e8=_0x3bab3b;_0xa027b0=0xc8;}else{_0xa027b0=0xce;}_0x993d6d[_0x3b06('0x2b')](_0xa027b0);return _0x993d6d[_0x3b06('0x32')]('Content-Range',_0x2bcc4c+'-'+_0x1e72e8+'/'+_0x3bab3b)[_0x3b06('0x2d')](_0x41d2b9);}return null;};}function patchUpdates(_0x122b59){return function(_0x24630c){try{jsonpatch[_0x3b06('0x33')](_0x24630c,_0x122b59,!![]);}catch(_0x216945){return BPromise[_0x3b06('0x34')](_0x216945);}return _0x24630c[_0x3b06('0x35')]();};}function saveUpdates(_0x5c0e2d,_0x3aad11){return function(_0x5ba095){if(_0x5ba095){return _0x5ba095[_0x3b06('0x36')](_0x5c0e2d)[_0x3b06('0x21')](function(_0x434bfd){return _0x434bfd;});}return null;};}function removeEntity(_0x238bfa,_0x5eb1f8){return function(_0x3f2e58){if(_0x3f2e58){return _0x3f2e58[_0x3b06('0x37')]()[_0x3b06('0x21')](function(){_0x238bfa[_0x3b06('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2500ab,_0x1ba54e){return function(_0x240130){if(!_0x240130){_0x2500ab[_0x3b06('0x2a')](0x194);}return _0x240130;};}function handleError(_0x4e85e6,_0xbc6e3b){_0xbc6e3b=_0xbc6e3b||0x1f4;return function(_0x292e6b){logger[_0x3b06('0x27')](_0x292e6b[_0x3b06('0x38')]);if(_0x292e6b['name']){delete _0x292e6b[_0x3b06('0x39')];}_0x4e85e6[_0x3b06('0x2b')](_0xbc6e3b)[_0x3b06('0x3a')](_0x292e6b);};}exports[_0x3b06('0x3b')]=function(_0xb50276,_0x1f41f8){var _0x8112df={},_0xe23cf9={},_0x976598={'count':0x0,'rows':[]};var _0x3d9adc=_[_0x3b06('0x3c')](db[_0x3b06('0x3d')][_0x3b06('0x3e')],function(_0x369211){return{'name':_0x369211[_0x3b06('0x3f')],'type':_0x369211[_0x3b06('0x40')]['key']};});_0xe23cf9[_0x3b06('0x41')]=_['map'](_0x3d9adc,_0x3b06('0x39'));_0xe23cf9[_0x3b06('0x42')]=_[_0x3b06('0x43')](_0xb50276[_0x3b06('0x42')]);_0xe23cf9['filters']=_['intersection'](_0xe23cf9['model'],_0xe23cf9[_0x3b06('0x42')]);_0x8112df['attributes']=_[_0x3b06('0x44')](_0xe23cf9[_0x3b06('0x41')],qs[_0x3b06('0x45')](_0xb50276[_0x3b06('0x42')][_0x3b06('0x45')]));_0x8112df[_0x3b06('0x46')]=_0x8112df[_0x3b06('0x46')][_0x3b06('0x47')]?_0x8112df[_0x3b06('0x46')]:_0xe23cf9[_0x3b06('0x41')];if(!_0xb50276['query'][_0x3b06('0x48')](_0x3b06('0x49'))){_0x8112df[_0x3b06('0x2f')]=qs[_0x3b06('0x2f')](_0xb50276[_0x3b06('0x42')][_0x3b06('0x2f')]);_0x8112df[_0x3b06('0x31')]=qs[_0x3b06('0x31')](_0xb50276[_0x3b06('0x42')]['offset']);}_0x8112df[_0x3b06('0x4a')]=qs['sort'](_0xb50276[_0x3b06('0x42')][_0x3b06('0x4b')]);_0x8112df[_0x3b06('0x4c')]=qs[_0x3b06('0x4d')](_[_0x3b06('0x4e')](_0xb50276[_0x3b06('0x42')],_0xe23cf9[_0x3b06('0x4d')]),_0x3d9adc);if(_0xb50276[_0x3b06('0x42')]['filter']){_0x8112df['where']=_[_0x3b06('0x4f')](_0x8112df[_0x3b06('0x4c')],{'$or':_[_0x3b06('0x3c')](_0x3d9adc,function(_0x1d4b24){if(_0x1d4b24['type']!==_0x3b06('0x50')){var _0xa18fc4={};_0xa18fc4[_0x1d4b24['name']]={'$like':'%'+_0xb50276[_0x3b06('0x42')]['filter']+'%'};return _0xa18fc4;}})});}_0x8112df=_[_0x3b06('0x4f')]({},_0x8112df,_0xb50276['options']);var _0x220080={'where':_0x8112df[_0x3b06('0x4c')]};return db[_0x3b06('0x3d')][_0x3b06('0x30')](_0x220080)[_0x3b06('0x21')](function(_0x5b6163){_0x976598[_0x3b06('0x30')]=_0x5b6163;if(_0xb50276[_0x3b06('0x42')][_0x3b06('0x51')]){_0x8112df[_0x3b06('0x52')]=[{'all':!![]}];}return db['FaxMessage'][_0x3b06('0x53')](_0x8112df);})[_0x3b06('0x21')](function(_0x1af03d){_0x976598[_0x3b06('0x54')]=_0x1af03d;return _0x976598;})[_0x3b06('0x21')](respondWithFilteredResult(_0x1f41f8,_0x8112df))[_0x3b06('0x29')](handleError(_0x1f41f8,null));};exports['show']=function(_0x101784,_0x2675b8){var _0x5bb93a={'raw':!![],'where':{'id':_0x101784[_0x3b06('0x55')]['id']}},_0xd9de38={};_0xd9de38['model']=_[_0x3b06('0x43')](db[_0x3b06('0x3d')][_0x3b06('0x3e')]);_0xd9de38[_0x3b06('0x42')]=_[_0x3b06('0x43')](_0x101784[_0x3b06('0x42')]);_0xd9de38[_0x3b06('0x4d')]=_[_0x3b06('0x44')](_0xd9de38[_0x3b06('0x41')],_0xd9de38[_0x3b06('0x42')]);_0x5bb93a[_0x3b06('0x46')]=_[_0x3b06('0x44')](_0xd9de38[_0x3b06('0x41')],qs[_0x3b06('0x45')](_0x101784[_0x3b06('0x42')][_0x3b06('0x45')]));_0x5bb93a[_0x3b06('0x46')]=_0x5bb93a[_0x3b06('0x46')][_0x3b06('0x47')]?_0x5bb93a[_0x3b06('0x46')]:_0xd9de38[_0x3b06('0x41')];if(_0x101784['query'][_0x3b06('0x51')]){_0x5bb93a[_0x3b06('0x52')]=[{'all':!![]}];}_0x5bb93a=_['merge']({},_0x5bb93a,_0x101784[_0x3b06('0x56')]);return db[_0x3b06('0x3d')][_0x3b06('0x57')](_0x5bb93a)[_0x3b06('0x21')](handleEntityNotFound(_0x2675b8,null))[_0x3b06('0x21')](respondWithResult(_0x2675b8,null))['catch'](handleError(_0x2675b8,null));};exports[_0x3b06('0x36')]=function(_0x16d59a,_0x1fabd4){if(_0x16d59a['body']['id']){delete _0x16d59a[_0x3b06('0x58')]['id'];}return db[_0x3b06('0x3d')][_0x3b06('0x57')]({'where':{'id':_0x16d59a[_0x3b06('0x55')]['id']}})[_0x3b06('0x21')](handleEntityNotFound(_0x1fabd4,null))['then'](saveUpdates(_0x16d59a['body'],null))[_0x3b06('0x21')](respondWithResult(_0x1fabd4,null))[_0x3b06('0x29')](handleError(_0x1fabd4,null));};exports[_0x3b06('0x37')]=function(_0x4cca0e,_0x29edf1){return db[_0x3b06('0x3d')][_0x3b06('0x57')]({'where':{'id':_0x4cca0e[_0x3b06('0x55')]['id']}})[_0x3b06('0x21')](handleEntityNotFound(_0x29edf1,null))[_0x3b06('0x21')](removeEntity(_0x29edf1,null))['catch'](handleError(_0x29edf1,null));};exports[_0x3b06('0x59')]=function(_0xf1817e,_0x5e8454){return db[_0x3b06('0x3d')][_0x3b06('0x59')]()[_0x3b06('0x21')](respondWithResult(_0x5e8454,null))[_0x3b06('0x29')](handleError(_0x5e8454,null));};var interaction_log=require(_0x3b06('0x5a'))('fax-interactions');exports[_0x3b06('0x5b')]=function(_0x29055f,_0x10cfde,_0x543c49){var _0xeb7860={'agent':{},'channel':_0x3b06('0x5c')};if(_0x29055f[_0x3b06('0x58')]['id']){delete _0x29055f[_0x3b06('0x58')]['id'];}_0x29055f['body']['read']=!![];_0x29055f[_0x3b06('0x58')][_0x3b06('0x5d')]=moment()[_0x3b06('0x5e')](_0x3b06('0x5f'));_0x29055f[_0x3b06('0x58')][_0x3b06('0x60')]=_0x29055f[_0x3b06('0x58')][_0x3b06('0x60')]||_0x29055f[_0x3b06('0x61')]['id'];_0xeb7860[_0x3b06('0x62')]['id']=_0x29055f['body'][_0x3b06('0x60')];return db[_0x3b06('0x3d')][_0x3b06('0x57')]({'where':{'id':_0x29055f[_0x3b06('0x55')]['id'],'UserId':null}})[_0x3b06('0x21')](handleEntityNotFound(_0x10cfde,null))[_0x3b06('0x21')](saveUpdates(_0x29055f[_0x3b06('0x58')],null))[_0x3b06('0x21')](function(_0x7c0c1e){if(_0x7c0c1e){_0xeb7860[_0x3b06('0x28')]=_0x7c0c1e[_0x3b06('0x63')]({'plain':!![]});return db[_0x3b06('0x64')][_0x3b06('0x57')]({'where':{'id':_0x7c0c1e[_0x3b06('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x10cfde,null))['then'](function(_0x49649c){if(_0x49649c){return _0x49649c['update']({'UserId':_0x29055f[_0x3b06('0x58')][_0x3b06('0x60')],'read1stAt':_[_0x3b06('0x66')](_0x49649c[_0x3b06('0x67')])?moment()[_0x3b06('0x5e')](_0x3b06('0x5f')):undefined});}return null;})[_0x3b06('0x21')](function(_0x428781){if(_0x428781){_0xeb7860[_0x3b06('0x68')]=_0x428781[_0x3b06('0x63')]({'plain':!![]});interaction_log[_0x3b06('0x22')](_0x3b06('0x69'),_0x29055f[_0x3b06('0x61')]['id'],_0x29055f['user'][_0x3b06('0x39')],_0x29055f[_0x3b06('0x61')][_0x3b06('0x6a')],_0xeb7860[_0x3b06('0x68')]['id'],_0x29055f[_0x3b06('0x58')]?JSON[_0x3b06('0x6b')](_0x29055f[_0x3b06('0x58')]):'null');return respondWithRpcPromise('AcceptMessage',_0x3b06('0x6c'),_0xeb7860);}return null;})[_0x3b06('0x21')](function(_0x578a42){var _0x2c096e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x578a42[_0x3b06('0x28')][_0x3b06('0x6d')];return db[_0x3b06('0x6e')][_0x3b06('0x42')](_0x2c096e,{'type':db[_0x3b06('0x6f')][_0x3b06('0x70')]['SELECT'],'raw':!![]})['then'](function(_0x2fdbd2){return _0x2fdbd2;});})[_0x3b06('0x21')](function(_0x75b2fd){if(_0x75b2fd){_0xeb7860['message'][_0x3b06('0x71')]=_0x75b2fd[0x0];if(!_0x29055f['body'][_0x3b06('0x60')])return;return db['User'][_0x3b06('0x57')]({'where':{'id':_0x29055f['body']['UserId'],'role':_0x3b06('0x62')},'attributes':['id','name',_0x3b06('0x72'),_0x3b06('0x73'),_0x3b06('0x74')],'raw':!![]});}return null;})[_0x3b06('0x21')](function(_0x26aa6a){if(!_0x26aa6a)return null;_0xeb7860[_0x3b06('0x28')]['agent']=_0x26aa6a;return _0xeb7860;})['then'](function(_0x2e4204){if(_0x2e4204){if(_0x29055f[_0x3b06('0x58')]['manual']){_0xeb7860[_0x3b06('0x28')]['interface']=util['format'](_0x3b06('0x75'),_0x29055f['user'][_0x3b06('0x39')]);_0xeb7860['message'][_0x3b06('0x76')]=_0xeb7860[_0x3b06('0x76')];_0xeb7860[_0x3b06('0x28')][_0x3b06('0x77')]=_0xeb7860[_0x3b06('0x76')];_0xeb7860[_0x3b06('0x28')]['event']=_0x3b06('0x5b');return respondWithRpcPromise(_0x3b06('0x78'),_0x3b06('0x78'),{'event':_0x3b06('0x79'),'message':_0xeb7860[_0x3b06('0x28')]},client9002)[_0x3b06('0x21')](function(){return _0xeb7860;});}return _0xeb7860;}return null;})[_0x3b06('0x21')](respondWithResult(_0x10cfde,null))[_0x3b06('0x29')](handleError(_0x10cfde,null));};var interaction_log=require(_0x3b06('0x5a'))('fax-interactions');exports[_0x3b06('0x34')]=function(_0x264539,_0x2204eb,_0x403022){var _0x2cf479={'agent':{},'channel':_0x3b06('0x5c')};if(_0x264539[_0x3b06('0x58')]['id']){delete _0x264539['body']['id'];}_0x264539[_0x3b06('0x58')]['UserId']=_0x264539[_0x3b06('0x58')][_0x3b06('0x60')]||_0x264539['user']['id'];_0x2cf479['agent']['id']=_0x264539[_0x3b06('0x58')]['UserId'];return db['FaxMessage']['find']({'where':{'id':_0x264539[_0x3b06('0x55')]['id'],'UserId':null}})[_0x3b06('0x21')](handleEntityNotFound(_0x2204eb,null))[_0x3b06('0x21')](function(_0xe0134a){if(_0xe0134a){_0x2cf479['message']=_0xe0134a['get']({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0xe0134a[_0x3b06('0x65')]}});}return null;})[_0x3b06('0x21')](handleEntityNotFound(_0x2204eb,null))[_0x3b06('0x21')](function(_0x281895){if(_0x281895){_0x2cf479['interaction']=_0x281895[_0x3b06('0x63')]({'plain':!![]});interaction_log[_0x3b06('0x22')](_0x3b06('0x7a'),_0x264539[_0x3b06('0x61')]['id'],_0x264539['user']['name'],_0x264539['user']['role'],_0x2cf479[_0x3b06('0x68')]['id'],_0x264539[_0x3b06('0x58')]?JSON[_0x3b06('0x6b')](_0x264539[_0x3b06('0x58')]):_0x3b06('0x7b'));return respondWithRpcPromise(_0x3b06('0x7c'),'rejectMessage',_0x2cf479);}return null;})[_0x3b06('0x21')](function(_0x255174){var _0x1e6e8e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x255174[_0x3b06('0x28')][_0x3b06('0x6d')];return db[_0x3b06('0x6e')]['query'](_0x1e6e8e,{'type':db[_0x3b06('0x6f')][_0x3b06('0x70')][_0x3b06('0x7d')],'raw':!![]})['then'](function(_0x317db2){return _0x317db2;});})[_0x3b06('0x21')](function(_0x448145){if(_0x448145){_0x2cf479[_0x3b06('0x28')][_0x3b06('0x71')]=_0x448145[0x0];if(!_0x264539[_0x3b06('0x58')]['UserId'])return;return db[_0x3b06('0x7e')]['find']({'where':{'id':_0x264539[_0x3b06('0x58')]['UserId'],'role':_0x3b06('0x62')},'attributes':['id',_0x3b06('0x39'),_0x3b06('0x72'),_0x3b06('0x73'),'internal'],'raw':!![]});}return null;})[_0x3b06('0x21')](function(_0x288c7b){if(!_0x288c7b)return null;_0x2cf479['message'][_0x3b06('0x62')]=_0x288c7b;return _0x2cf479;})['then'](function(_0x233f74){if(_0x233f74){_0x233f74[_0x3b06('0x28')][_0x3b06('0x7f')]=util[_0x3b06('0x5e')](_0x3b06('0x75'),_0x264539[_0x3b06('0x61')][_0x3b06('0x39')]);_0x233f74[_0x3b06('0x28')]['channel']=_0x2cf479[_0x3b06('0x76')];_0x233f74[_0x3b06('0x28')][_0x3b06('0x77')]=_0x2cf479['channel'];_0x233f74[_0x3b06('0x28')][_0x3b06('0x80')]='reject';respondWithRpcPromise(_0x3b06('0x78'),_0x3b06('0x78'),{'event':_0x3b06('0x81'),'message':_0x233f74[_0x3b06('0x28')]},client9002);return _0x2cf479;}return null;})[_0x3b06('0x21')](respondWithResult(_0x2204eb,null))['catch'](handleError(_0x2204eb,null));};exports[_0x3b06('0x82')]=function(_0x3a4945,_0x2e9c68){var _0x36c70a;return db[_0x3b06('0x3d')]['create'](_0x3a4945['body'],{})[_0x3b06('0x21')](function(_0x4829a2){_0x36c70a=_0x4829a2;return db['CmContact'][_0x3b06('0x83')]({'where':{'id':_0x36c70a[_0x3b06('0x6d')]}});})[_0x3b06('0x21')](function(_0x20a898){if(_[_0x3b06('0x66')](_0x20a898)){return;}else{_0x36c70a[_0x3b06('0x5c')]=_0x20a898['fax'];return db[_0x3b06('0x84')][_0x3b06('0x83')]({'where':{'id':_0x36c70a[_0x3b06('0x85')]}});}})[_0x3b06('0x21')](function(_0x1a0c50){return respondWithRpcPromise(_0x3b06('0x86'),_0x3b06('0x86'),{'FaxAccountId':_[_0x3b06('0x66')](_0x3a4945['body'])?undefined:_0x3a4945[_0x3b06('0x58')][_0x3b06('0x87')],'path':_['isNil'](_0x1a0c50)?undefined:util[_0x3b06('0x5e')](_0x3b06('0x88'),_0x1a0c50['basename']),'fax':_[_0x3b06('0x66')](_0x36c70a['fax'])?undefined:_0x36c70a[_0x3b06('0x5c')],'AttachmentId':_0x36c70a[_0x3b06('0x85')]},client9002);})[_0x3b06('0x21')](respondWithResult(_0x2e9c68,0xc9))[_0x3b06('0x29')](handleError(_0x2e9c68,null));};exports[_0x3b06('0x89')]=function(_0x43bfef,_0x21914d){var _0x1d011a=path[_0x3b06('0x8a')](config[_0x3b06('0x8b')],_0x3b06('0x8c'),_0x3b06('0x8d'),_0x3b06('0x8e'));return db[_0x3b06('0x3d')][_0x3b06('0x57')]({'where':{'id':_0x43bfef['params']['id']},'include':[{'model':db[_0x3b06('0x84')],'as':_0x3b06('0x84')}]})[_0x3b06('0x21')](handleEntityNotFound(_0x21914d,null))[_0x3b06('0x21')](function(_0x106433){if(_0x106433){return _0x21914d['download'](path['join'](_0x1d011a,_0x106433[_0x3b06('0x84')]['basename']));}})[_0x3b06('0x29')](handleError(_0x21914d,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index cce926e..1f7efb1 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 _0xb296=['FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3f2ed0,_0x55e1d7){var _0x4a035d=function(_0x574e11){while(--_0x574e11){_0x3f2ed0['push'](_0x3f2ed0['shift']());}};_0x4a035d(++_0x55e1d7);}(_0xb296,0xa3));var _0x6b29=function(_0x111264,_0x38cd3d){_0x111264=_0x111264-0x0;var _0xa767b3=_0xb296[_0x111264];return _0xa767b3;};'use strict';var EventEmitter=require(_0x6b29('0x0'));var FaxMessage=require(_0x6b29('0x1'))['db'][_0x6b29('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x6b29('0x3')](0x0);var events={'afterCreate':_0x6b29('0x4'),'afterUpdate':_0x6b29('0x5'),'afterDestroy':_0x6b29('0x6')};function emitEvent(_0x48e967){return function(_0x3ff65c,_0x5c1cf5,_0x50a1ba){FaxMessageEvents[_0x6b29('0x7')](_0x48e967+':'+_0x3ff65c['id'],_0x3ff65c);FaxMessageEvents['emit'](_0x48e967,_0x3ff65c);_0x50a1ba(null);};}for(var e in events){if(events[_0x6b29('0x8')](e)){var event=events[e];FaxMessage[_0x6b29('0x9')](e,emitEvent(event));}}module[_0x6b29('0xa')]=FaxMessageEvents; \ No newline at end of file +var _0x9120=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners','remove','emit'];(function(_0x396e4a,_0x2b5f02){var _0x5aadf4=function(_0x4f48a7){while(--_0x4f48a7){_0x396e4a['push'](_0x396e4a['shift']());}};_0x5aadf4(++_0x2b5f02);}(_0x9120,0x1b3));var _0x0912=function(_0x2b0f27,_0x5798e1){_0x2b0f27=_0x2b0f27-0x0;var _0x163f85=_0x9120[_0x2b0f27];return _0x163f85;};'use strict';var EventEmitter=require(_0x0912('0x0'));var FaxMessage=require(_0x0912('0x1'))['db'][_0x0912('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x0912('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0912('0x4')};function emitEvent(_0x3f15a8){return function(_0x24fc0a,_0x217a2e,_0x3c1cdb){FaxMessageEvents[_0x0912('0x5')](_0x3f15a8+':'+_0x24fc0a['id'],_0x24fc0a);FaxMessageEvents['emit'](_0x3f15a8,_0x24fc0a);_0x3c1cdb(null);};}for(var e in events){if(events[_0x0912('0x6')](e)){var event=events[e];FaxMessage[_0x0912('0x7')](e,emitEvent(event));}}module[_0x0912('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 9f0620d..1fca5ed 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 _0x6c1a=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','FaxInteractionId','update','createdAt','catch','error'];(function(_0xd7a1c0,_0x18fb30){var _0x2612ac=function(_0x206bc0){while(--_0x206bc0){_0xd7a1c0['push'](_0xd7a1c0['shift']());}};_0x2612ac(++_0x18fb30);}(_0x6c1a,0x195));var _0xa6c1=function(_0x31dbd9,_0x38ed92){_0x31dbd9=_0x31dbd9-0x0;var _0x4ea341=_0x6c1a[_0x31dbd9];return _0x4ea341;};'use strict';var _=require(_0xa6c1('0x0'));var util=require(_0xa6c1('0x1'));var logger=require(_0xa6c1('0x2'))(_0xa6c1('0x3'));var moment=require(_0xa6c1('0x4'));var BPromise=require(_0xa6c1('0x5'));var rp=require(_0xa6c1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa6c1('0x7'));var config=require(_0xa6c1('0x8'));var attributes=require('./faxMessage.attributes');module['exports']=function(_0x1ece51,_0xfe61c4){return _0x1ece51[_0xa6c1('0x9')](_0xa6c1('0xa'),attributes,{'tableName':_0xa6c1('0xb'),'paranoid':![],'indexes':[{'name':_0xa6c1('0xc'),'fields':[_0xa6c1('0xd')],'type':_0xa6c1('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2cc785,_0x4d2a2f,_0x365219){var _0x4bd23f=_0x1ece51[_0xa6c1('0xf')];var _0x4a196a=_0x2cc785[_0xa6c1('0x10')]({'plain':!![]});if(_0x4a196a[_0xa6c1('0x11')][_0xa6c1('0x12')]()==='in'||_0x4a196a[_0xa6c1('0x11')][_0xa6c1('0x12')]()===_0xa6c1('0x13')&&!_0x4a196a[_0xa6c1('0x14')]&&!_[_0xa6c1('0x15')](_0x4a196a[_0xa6c1('0x16')])){_0x4bd23f[_0xa6c1('0x17')]['findOne']({'where':{'id':_0x4a196a[_0xa6c1('0x18')]}})['then'](function(_0x37591b){if(_0x37591b){_0x37591b[_0xa6c1('0x19')]({'lastMsgAt':_0x4a196a[_0xa6c1('0x1a')],'lastMsgDirection':_0x4a196a[_0xa6c1('0x11')][_0xa6c1('0x12')]()});}})[_0xa6c1('0x1b')](function(_0x31bed0){console[_0xa6c1('0x1c')](_0x31bed0);});}_0x365219();}},'charset':_0xa6c1('0x1d'),'collate':_0xa6c1('0x1e')});}; \ No newline at end of file +var _0x2b17=['FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','define','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId'];(function(_0x5ecac0,_0x101db9){var _0x4941ad=function(_0x47d4d5){while(--_0x47d4d5){_0x5ecac0['push'](_0x5ecac0['shift']());}};_0x4941ad(++_0x101db9);}(_0x2b17,0x15e));var _0x72b1=function(_0x210185,_0x52b57e){_0x210185=_0x210185-0x0;var _0x154dae=_0x2b17[_0x210185];return _0x154dae;};'use strict';var _=require(_0x72b1('0x0'));var util=require(_0x72b1('0x1'));var logger=require(_0x72b1('0x2'))(_0x72b1('0x3'));var moment=require('moment');var BPromise=require(_0x72b1('0x4'));var rp=require(_0x72b1('0x5'));var fs=require('fs');var path=require(_0x72b1('0x6'));var rimraf=require('rimraf');var config=require(_0x72b1('0x7'));var attributes=require(_0x72b1('0x8'));module['exports']=function(_0x309ce3,_0x259866){return _0x309ce3[_0x72b1('0x9')]('FaxMessage',attributes,{'tableName':_0x72b1('0xa'),'paranoid':![],'indexes':[{'name':_0x72b1('0xb'),'fields':[_0x72b1('0xc')],'type':_0x72b1('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1e2d09,_0x2c486a,_0x345e4e){var _0x20232c=_0x309ce3[_0x72b1('0xe')];var _0x463e9b=_0x1e2d09[_0x72b1('0xf')]({'plain':!![]});if(_0x463e9b[_0x72b1('0x10')][_0x72b1('0x11')]()==='in'||_0x463e9b[_0x72b1('0x10')][_0x72b1('0x11')]()===_0x72b1('0x12')&&!_0x463e9b[_0x72b1('0x13')]&&!_[_0x72b1('0x14')](_0x463e9b[_0x72b1('0x15')])){_0x20232c[_0x72b1('0x16')][_0x72b1('0x17')]({'where':{'id':_0x463e9b[_0x72b1('0x18')]}})[_0x72b1('0x19')](function(_0x14bd98){if(_0x14bd98){_0x14bd98[_0x72b1('0x1a')]({'lastMsgAt':_0x463e9b[_0x72b1('0x1b')],'lastMsgDirection':_0x463e9b[_0x72b1('0x10')][_0x72b1('0x11')]()});}})[_0x72b1('0x1c')](function(_0x29bd4a){console[_0x72b1('0x1d')](_0x29bd4a);});}_0x345e4e();}},'charset':'utf8mb4','collate':_0x72b1('0x1e')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 045d399..e17df46 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 _0x6f0d=['../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','body','options','raw','UpdateFaxMessage','update','attributes','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x334f9a,_0x542f01){var _0x2b219d=function(_0x25bb3e){while(--_0x25bb3e){_0x334f9a['push'](_0x334f9a['shift']());}};_0x2b219d(++_0x542f01);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x11d142,_0x7005da){_0x11d142=_0x11d142-0x0;var _0x3094e5=_0x6f0d[_0x11d142];return _0x3094e5;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6f0('0x4'))['db'];var utils=require(_0xd6f0('0x5'));var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6f0('0x9')]['http']({'port':0x232a});config[_0xd6f0('0xa')]=_[_0xd6f0('0xb')](config[_0xd6f0('0xa')],{'host':_0xd6f0('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd6f0('0xd'))[_0xd6f0('0xe')](socket);function respondWithRpcPromise(_0x2854cd,_0x382a2e,_0x225dcf){return new BPromise(function(_0x4db64a,_0x136eee){return client[_0xd6f0('0xf')](_0x2854cd,_0x225dcf)[_0xd6f0('0x10')](function(_0x44bba6){logger['info'](_0xd6f0('0x11'),_0x382a2e,_0xd6f0('0x12'));logger[_0xd6f0('0x13')](_0xd6f0('0x14'),_0x382a2e,_0xd6f0('0x12'),JSON[_0xd6f0('0x15')](_0x44bba6));if(_0x44bba6[_0xd6f0('0x16')]){if(_0x44bba6[_0xd6f0('0x16')][_0xd6f0('0x17')]===0x1f4){logger['error'](_0xd6f0('0x11'),_0x382a2e,_0x44bba6[_0xd6f0('0x16')]['message']);return _0x136eee(_0x44bba6[_0xd6f0('0x16')]['message']);}logger[_0xd6f0('0x16')](_0xd6f0('0x11'),_0x382a2e,_0x44bba6[_0xd6f0('0x16')][_0xd6f0('0x18')]);return _0x4db64a(_0x44bba6[_0xd6f0('0x16')][_0xd6f0('0x18')]);}else{logger[_0xd6f0('0x19')](_0xd6f0('0x11'),_0x382a2e,_0xd6f0('0x12'));_0x4db64a(_0x44bba6[_0xd6f0('0x1a')][_0xd6f0('0x18')]);}})[_0xd6f0('0x1b')](function(_0x327231){logger[_0xd6f0('0x16')](_0xd6f0('0x11'),_0x382a2e,_0x327231);_0x136eee(_0x327231);});});}exports[_0xd6f0('0x1c')]=function(_0x5cd367){var _0x48ac38=this;return new Promise(function(_0x3939aa,_0x264104){return db[_0xd6f0('0x1d')]['create'](_0x5cd367[_0xd6f0('0x1e')],{'raw':_0x5cd367[_0xd6f0('0x1f')]?_0x5cd367['options'][_0xd6f0('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x1ee584){logger[_0xd6f0('0x19')]('CreateFaxMessage',_0x5cd367);logger[_0xd6f0('0x13')](_0xd6f0('0x1c'),_0x5cd367,JSON['stringify'](_0x1ee584));_0x3939aa(_0x1ee584);})[_0xd6f0('0x1b')](function(_0x402070){logger[_0xd6f0('0x16')]('CreateFaxMessage',_0x402070[_0xd6f0('0x18')],_0x5cd367);_0x264104(_0x48ac38[_0xd6f0('0x16')](0x1f4,_0x402070['message']));});});};exports[_0xd6f0('0x21')]=function(_0x551be8){var _0x2042d5=this;return new Promise(function(_0x3fb5c3,_0x1630dc){return db[_0xd6f0('0x1d')][_0xd6f0('0x22')](_0x551be8[_0xd6f0('0x1e')],{'raw':_0x551be8[_0xd6f0('0x1f')]?_0x551be8[_0xd6f0('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x551be8[_0xd6f0('0x1f')]?_0x551be8[_0xd6f0('0x1f')]['where']||null:null,'attributes':_0x551be8[_0xd6f0('0x1f')]?_0x551be8[_0xd6f0('0x1f')][_0xd6f0('0x23')]||null:null,'limit':_0x551be8[_0xd6f0('0x1f')]?_0x551be8[_0xd6f0('0x1f')][_0xd6f0('0x24')]||null:null})[_0xd6f0('0x10')](function(_0x3151f8){logger[_0xd6f0('0x19')](_0xd6f0('0x21'),_0x551be8);logger[_0xd6f0('0x13')](_0xd6f0('0x21'),_0x551be8,JSON[_0xd6f0('0x15')](_0x3151f8));_0x3fb5c3(_0x3151f8);})[_0xd6f0('0x1b')](function(_0xbdd223){logger[_0xd6f0('0x16')](_0xd6f0('0x21'),_0xbdd223[_0xd6f0('0x18')],_0x551be8);_0x1630dc(_0x2042d5[_0xd6f0('0x16')](0x1f4,_0xbdd223[_0xd6f0('0x18')]));});});}; \ 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(_0x4e9b0f,_0x456524){var _0x18fae8=function(_0x24a579){while(--_0x24a579){_0x4e9b0f['push'](_0x4e9b0f['shift']());}};_0x18fae8(++_0x456524);}(_0x81bd,0x7c));var _0xd81b=function(_0x4bec28,_0x3138a9){_0x4bec28=_0x4bec28-0x0;var _0x36cd6e=_0x81bd[_0x4bec28];return _0x36cd6e;};'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 dbc4084..0dabafa 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 _0xf13e=['removeListener','register','length','faxMessage:','./faxMessage.events','save','remove','update','emit'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xf13e,0x148));var _0xef13=function(_0x3e0863,_0x5e7b9a){_0x3e0863=_0x3e0863-0x0;var _0x5cf89=_0xf13e[_0x3e0863];return _0x5cf89;};'use strict';var FaxMessageEvents=require(_0xef13('0x0'));var events=[_0xef13('0x1'),_0xef13('0x2'),_0xef13('0x3')];function createListener(_0x59b50d,_0x30b68e){return function(_0x11e530){_0x30b68e[_0xef13('0x4')](_0x59b50d,_0x11e530);};}function removeListener(_0x172b61,_0x2cfccd){return function(){FaxMessageEvents[_0xef13('0x5')](_0x172b61,_0x2cfccd);};}exports[_0xef13('0x6')]=function(_0x3d825a){for(var _0x4a53b6=0x0,_0x4e387a=events[_0xef13('0x7')];_0x4a53b6<_0x4e387a;_0x4a53b6++){var _0x57288d=events[_0x4a53b6];var _0x133e31=createListener(_0xef13('0x8')+_0x57288d,_0x3d825a);FaxMessageEvents['on'](_0x57288d,_0x133e31);}}; \ No newline at end of file +var _0x603e=['update','emit','length','faxMessage:','./faxMessage.events','save','remove'];(function(_0x4b111d,_0x20b2b7){var _0x445562=function(_0x426885){while(--_0x426885){_0x4b111d['push'](_0x4b111d['shift']());}};_0x445562(++_0x20b2b7);}(_0x603e,0xba));var _0xe603=function(_0x595bd1,_0xb1e7a){_0x595bd1=_0x595bd1-0x0;var _0xd0344f=_0x603e[_0x595bd1];return _0xd0344f;};'use strict';var FaxMessageEvents=require(_0xe603('0x0'));var events=[_0xe603('0x1'),_0xe603('0x2'),_0xe603('0x3')];function createListener(_0x510266,_0x39b494){return function(_0x1f4e74){_0x39b494[_0xe603('0x4')](_0x510266,_0x1f4e74);};}function removeListener(_0x5c5699,_0x56f6ad){return function(){FaxMessageEvents['removeListener'](_0x5c5699,_0x56f6ad);};}exports['register']=function(_0x104263){for(var _0x1b823f=0x0,_0x137d10=events[_0xe603('0x5')];_0x1b823f<_0x137d10;_0x1b823f++){var _0x558c61=events[_0x1b823f];var _0xf61296=createListener(_0xe603('0x6')+_0x558c61,_0x104263);FaxMessageEvents['on'](_0x558c61,_0xf61296);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 5b98e34..f7de815 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 _0xdace=['/describe','describe','/:id','show','download','tracked','fax','create','update','put','/:id/accept','accept','reject','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x3cf78d,_0x3a467a){var _0x35e8d6=function(_0x24dfe1){while(--_0x24dfe1){_0x3cf78d['push'](_0x3cf78d['shift']());}};_0x35e8d6(++_0x3a467a);}(_0xdace,0xc5));var _0xedac=function(_0xaaf2e2,_0x19d28a){_0xaaf2e2=_0xaaf2e2-0x0;var _0x28bc36=_0xdace[_0xaaf2e2];return _0x28bc36;};'use strict';var multer=require(_0xedac('0x0'));var util=require('util');var path=require(_0xedac('0x1'));var timeout=require(_0xedac('0x2'));var express=require(_0xedac('0x3'));var router=express['Router']();var fs_extra=require(_0xedac('0x4'));var auth=require(_0xedac('0x5'));var interaction=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var controller=require('./faxMessage.controller');router[_0xedac('0x8')]('/',auth[_0xedac('0x9')](),controller[_0xedac('0xa')]);router['get'](_0xedac('0xb'),auth[_0xedac('0x9')](),controller[_0xedac('0xc')]);router['get'](_0xedac('0xd'),auth[_0xedac('0x9')](),controller[_0xedac('0xe')]);router['get']('/:id/download',auth[_0xedac('0x9')](),controller[_0xedac('0xf')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xedac('0x10')](_0xedac('0x11'),'faxmessage:create'),controller[_0xedac('0x12')]);router['put'](_0xedac('0xd'),auth[_0xedac('0x9')](),controller[_0xedac('0x13')]);router[_0xedac('0x14')](_0xedac('0x15'),auth[_0xedac('0x9')](),controller[_0xedac('0x16')]);router[_0xedac('0x14')]('/:id/reject',auth[_0xedac('0x9')](),controller[_0xedac('0x17')]);router[_0xedac('0x18')](_0xedac('0xd'),auth[_0xedac('0x9')](),controller['destroy']);module[_0xedac('0x19')]=router; \ No newline at end of file +var _0x13f6=['isAuthenticated','index','get','/:id','show','/:id/download','download','tracked','fax','create','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxMessage.controller'];(function(_0x519535,_0x57d96f){var _0x4c4e34=function(_0x5578e0){while(--_0x5578e0){_0x519535['push'](_0x519535['shift']());}};_0x4c4e34(++_0x57d96f);}(_0x13f6,0x124));var _0x613f=function(_0x471062,_0x1d6f1d){_0x471062=_0x471062-0x0;var _0x287f1e=_0x13f6[_0x471062];return _0x287f1e;};'use strict';var multer=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x613f('0x2'));var router=express[_0x613f('0x3')]();var fs_extra=require(_0x613f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x613f('0x5'));var config=require(_0x613f('0x6'));var controller=require(_0x613f('0x7'));router['get']('/',auth[_0x613f('0x8')](),controller[_0x613f('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x613f('0xa')](_0x613f('0xb'),auth[_0x613f('0x8')](),controller[_0x613f('0xc')]);router['get'](_0x613f('0xd'),auth[_0x613f('0x8')](),controller[_0x613f('0xe')]);router['post']('/',auth[_0x613f('0x8')](),interaction[_0x613f('0xf')](_0x613f('0x10'),'faxmessage:create'),controller[_0x613f('0x11')]);router[_0x613f('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x613f('0x12')](_0x613f('0x13'),auth[_0x613f('0x8')](),controller[_0x613f('0x14')]);router[_0x613f('0x12')](_0x613f('0x15'),auth[_0x613f('0x8')](),controller[_0x613f('0x16')]);router[_0x613f('0x17')](_0x613f('0xb'),auth['isAuthenticated'](),controller[_0x613f('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 00116b4..41e0339 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 _0x2ebd=['sequelize','exports','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x325a08,_0x571fff){var _0x436e01=function(_0x2c7719){while(--_0x2c7719){_0x325a08['push'](_0x325a08['shift']());}};_0x436e01(++_0x571fff);}(_0x2ebd,0x1c8));var _0xd2eb=function(_0x7404d4,_0x15eff4){_0x7404d4=_0x7404d4-0x0;var _0x37f6fc=_0x2ebd[_0x7404d4];return _0x37f6fc;};'use strict';var Sequelize=require(_0xd2eb('0x0'));module[_0xd2eb('0x1')]={'name':{'type':Sequelize[_0xd2eb('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd2eb('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd2eb('0x4')](_0xd2eb('0x5'),_0xd2eb('0x6'),_0xd2eb('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xd2eb('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xaa55=['rrmemory','roundrobin','sequelize','exports','STRING','INTEGER','ENUM'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xaa55,0x9c));var _0x5aa5=function(_0x1b55b7,_0x250d36){_0x1b55b7=_0x1b55b7-0x0;var _0x5a73c8=_0xaa55[_0x1b55b7];return _0x5a73c8;};'use strict';var Sequelize=require(_0x5aa5('0x0'));module[_0x5aa5('0x1')]={'name':{'type':Sequelize[_0x5aa5('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5aa5('0x2')]},'timeout':{'type':Sequelize[_0x5aa5('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5aa5('0x4')](_0x5aa5('0x5'),'beepall',_0x5aa5('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x5aa5('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 2dfe00b..c815c89 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 _0x079f=['count','limit','set','Content-Range','json','apply','reject','save','update','then','get','FaxQueues','UserProfileResource','stack','name','index','FaxQueue','fieldName','map','query','keys','filters','attributes','intersection','model','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','rawAttributes','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','error','find','describe','getMembers','nolimit','FaxQueueId','UserFaxQueue','User','findAndCountAll','UserId','faxPause','updatedAt','createdAt','rows','%s/%s','getTeams','findOne','Team','ids','Agents','online','flatMap','sequelize','transaction','addTeams','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','isEmpty','addAgents','spread','removeAgents','isArray','userFaxQueue:remove','getAgents','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxQueue.socket','register','sendStatus','status','end','offset','undefined'];(function(_0x19118e,_0x148a16){var _0x5a0c20=function(_0x57f03a){while(--_0x57f03a){_0x19118e['push'](_0x19118e['shift']());}};_0x5a0c20(++_0x148a16);}(_0x079f,0xef));var _0xf079=function(_0x50f6e5,_0x151ccb){_0x50f6e5=_0x50f6e5-0x0;var _0x5988c5=_0x079f[_0x50f6e5];return _0x5988c5;};'use strict';var emlformat=require(_0xf079('0x0'));var rimraf=require(_0xf079('0x1'));var zipdir=require(_0xf079('0x2'));var jsonpatch=require(_0xf079('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf079('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf079('0x5'));var csv=require(_0xf079('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf079('0x7'));var _=require('lodash');var squel=require(_0xf079('0x8'));var crypto=require(_0xf079('0x9'));var jsforce=require(_0xf079('0xa'));var deskjs=require(_0xf079('0xb'));var toCsv=require(_0xf079('0x6'));var querystring=require(_0xf079('0xc'));var Papa=require(_0xf079('0xd'));var Redis=require(_0xf079('0xe'));var authService=require(_0xf079('0xf'));var qs=require(_0xf079('0x10'));var as=require(_0xf079('0x11'));var hardwareService=require(_0xf079('0x12'));var logger=require(_0xf079('0x13'))(_0xf079('0x14'));var utils=require(_0xf079('0x15'));var config=require(_0xf079('0x16'));var licenseUtil=require(_0xf079('0x17'));var db=require(_0xf079('0x18'))['db'];config[_0xf079('0x19')]=_[_0xf079('0x1a')](config['redis'],{'host':_0xf079('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf079('0x19')]));require(_0xf079('0x1c'))[_0xf079('0x1d')](socket);function respondWithStatusCode(_0x32cd1d,_0x1fe4ef){_0x1fe4ef=_0x1fe4ef||0xcc;return function(_0x2d3779){if(_0x2d3779){return _0x32cd1d[_0xf079('0x1e')](_0x1fe4ef);}return _0x32cd1d[_0xf079('0x1f')](_0x1fe4ef)[_0xf079('0x20')]();};}function respondWithResult(_0x4468e7,_0x15b724){_0x15b724=_0x15b724||0xc8;return function(_0xe30f42){if(_0xe30f42){return _0x4468e7[_0xf079('0x1f')](_0x15b724)['json'](_0xe30f42);}};}function respondWithFilteredResult(_0x354d0a,_0x1265a0){return function(_0x43cb0c){if(_0x43cb0c){var _0x1b85de=typeof _0x1265a0[_0xf079('0x21')]===_0xf079('0x22')&&typeof _0x1265a0['limit']===_0xf079('0x22');var _0x22117a=_0x43cb0c[_0xf079('0x23')];var _0x3b4176=_0x1b85de?0x0:_0x1265a0[_0xf079('0x21')];var _0x3d778e=_0x1b85de?_0x43cb0c[_0xf079('0x23')]:_0x1265a0[_0xf079('0x21')]+_0x1265a0[_0xf079('0x24')];var _0x5d3d10;if(_0x3d778e>=_0x22117a){_0x3d778e=_0x22117a;_0x5d3d10=0xc8;}else{_0x5d3d10=0xce;}_0x354d0a[_0xf079('0x1f')](_0x5d3d10);return _0x354d0a[_0xf079('0x25')](_0xf079('0x26'),_0x3b4176+'-'+_0x3d778e+'/'+_0x22117a)[_0xf079('0x27')](_0x43cb0c);}return null;};}function patchUpdates(_0x28324a){return function(_0x4a38a7){try{jsonpatch[_0xf079('0x28')](_0x4a38a7,_0x28324a,!![]);}catch(_0x4e7c74){return BPromise[_0xf079('0x29')](_0x4e7c74);}return _0x4a38a7[_0xf079('0x2a')]();};}function saveUpdates(_0x6ca7cb,_0x2ad4bd){return function(_0x5c0d85){if(_0x5c0d85){return _0x5c0d85[_0xf079('0x2b')](_0x6ca7cb)['then'](function(_0x1d6274){return _0x1d6274;});}return null;};}function removeEntity(_0x832561,_0x14c432){return function(_0x2b5d9e){if(_0x2b5d9e){return _0x2b5d9e['destroy']()[_0xf079('0x2c')](function(){var _0x15b5e5=_0x2b5d9e[_0xf079('0x2d')]({'plain':!![]});var _0x3de0e4=_0xf079('0x2e');return db[_0xf079('0x2f')]['destroy']({'where':{'type':_0x3de0e4,'resourceId':_0x15b5e5['id']}})[_0xf079('0x2c')](function(){return _0x2b5d9e;});})[_0xf079('0x2c')](function(){_0x832561[_0xf079('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dc5b8,_0xe18534){return function(_0x15f7f3){if(!_0x15f7f3){_0x2dc5b8[_0xf079('0x1e')](0x194);}return _0x15f7f3;};}function handleError(_0xf7b18d,_0x4766b4){_0x4766b4=_0x4766b4||0x1f4;return function(_0x448377){logger['error'](_0x448377[_0xf079('0x30')]);if(_0x448377['name']){delete _0x448377[_0xf079('0x31')];}_0xf7b18d[_0xf079('0x1f')](_0x4766b4)['send'](_0x448377);};}exports[_0xf079('0x32')]=function(_0x1136c6,_0x1f8b9f){var _0x17d707={},_0x2d262a={},_0x26eeeb={'count':0x0,'rows':[]};var _0x2d2b58=_['map'](db[_0xf079('0x33')]['rawAttributes'],function(_0x14d2cf){return{'name':_0x14d2cf[_0xf079('0x34')],'type':_0x14d2cf['type']['key']};});_0x2d262a['model']=_[_0xf079('0x35')](_0x2d2b58,_0xf079('0x31'));_0x2d262a[_0xf079('0x36')]=_[_0xf079('0x37')](_0x1136c6[_0xf079('0x36')]);_0x2d262a[_0xf079('0x38')]=_['intersection'](_0x2d262a['model'],_0x2d262a[_0xf079('0x36')]);_0x17d707[_0xf079('0x39')]=_[_0xf079('0x3a')](_0x2d262a[_0xf079('0x3b')],qs[_0xf079('0x3c')](_0x1136c6[_0xf079('0x36')][_0xf079('0x3c')]));_0x17d707[_0xf079('0x39')]=_0x17d707['attributes'][_0xf079('0x3d')]?_0x17d707['attributes']:_0x2d262a[_0xf079('0x3b')];if(!_0x1136c6[_0xf079('0x36')]['hasOwnProperty']('nolimit')){_0x17d707[_0xf079('0x24')]=qs['limit'](_0x1136c6[_0xf079('0x36')]['limit']);_0x17d707[_0xf079('0x21')]=qs['offset'](_0x1136c6[_0xf079('0x36')]['offset']);}_0x17d707[_0xf079('0x3e')]=qs[_0xf079('0x3f')](_0x1136c6[_0xf079('0x36')][_0xf079('0x3f')]);_0x17d707[_0xf079('0x40')]=qs['filters'](_[_0xf079('0x41')](_0x1136c6[_0xf079('0x36')],_0x2d262a[_0xf079('0x38')]),_0x2d2b58);if(_0x1136c6[_0xf079('0x36')][_0xf079('0x42')]){_0x17d707[_0xf079('0x40')]=_[_0xf079('0x43')](_0x17d707[_0xf079('0x40')],{'$or':_[_0xf079('0x35')](_0x2d2b58,function(_0x4665f4){if(_0x4665f4['type']!==_0xf079('0x44')){var _0x4df9bf={};_0x4df9bf[_0x4665f4[_0xf079('0x31')]]={'$like':'%'+_0x1136c6[_0xf079('0x36')][_0xf079('0x42')]+'%'};return _0x4df9bf;}})});}_0x17d707=_[_0xf079('0x43')]({},_0x17d707,_0x1136c6['options']);var _0x564b69={'where':_0x17d707[_0xf079('0x40')]};return db['FaxQueue'][_0xf079('0x23')](_0x564b69)[_0xf079('0x2c')](function(_0x95b007){_0x26eeeb[_0xf079('0x23')]=_0x95b007;if(_0x1136c6[_0xf079('0x36')][_0xf079('0x45')]){_0x17d707['include']=[{'all':!![]}];}return db['FaxQueue'][_0xf079('0x46')](_0x17d707);})[_0xf079('0x2c')](function(_0x5eca06){_0x26eeeb['rows']=_0x5eca06;return _0x26eeeb;})[_0xf079('0x2c')](respondWithFilteredResult(_0x1f8b9f,_0x17d707))[_0xf079('0x47')](handleError(_0x1f8b9f,null));};exports[_0xf079('0x48')]=function(_0x3c8d57,_0x547438){var _0x123e99={'raw':!![],'where':{'id':_0x3c8d57[_0xf079('0x49')]['id']}},_0x11a91f={};_0x11a91f['model']=_[_0xf079('0x37')](db[_0xf079('0x33')][_0xf079('0x4a')]);_0x11a91f['query']=_[_0xf079('0x37')](_0x3c8d57['query']);_0x11a91f[_0xf079('0x38')]=_[_0xf079('0x3a')](_0x11a91f['model'],_0x11a91f[_0xf079('0x36')]);_0x123e99[_0xf079('0x39')]=_[_0xf079('0x3a')](_0x11a91f[_0xf079('0x3b')],qs[_0xf079('0x3c')](_0x3c8d57[_0xf079('0x36')][_0xf079('0x3c')]));_0x123e99[_0xf079('0x39')]=_0x123e99['attributes'][_0xf079('0x3d')]?_0x123e99[_0xf079('0x39')]:_0x11a91f['model'];if(_0x3c8d57[_0xf079('0x36')]['includeAll']){_0x123e99['include']=[{'all':!![]}];}_0x123e99=_[_0xf079('0x43')]({},_0x123e99,_0x3c8d57[_0xf079('0x4b')]);return db[_0xf079('0x33')]['find'](_0x123e99)[_0xf079('0x2c')](handleEntityNotFound(_0x547438,null))[_0xf079('0x2c')](respondWithResult(_0x547438,null))[_0xf079('0x47')](handleError(_0x547438,null));};exports[_0xf079('0x4c')]=function(_0x1376cc,_0x4393ff){return db[_0xf079('0x33')]['create'](_0x1376cc[_0xf079('0x4d')],{})[_0xf079('0x2c')](function(_0x49377b){var _0x3fe076=_0x1376cc['user'][_0xf079('0x2d')]({'plain':!![]});if(!_0x3fe076)throw new Error(_0xf079('0x4e'));if(_0x3fe076[_0xf079('0x4f')]===_0xf079('0x50')){var _0x3fe381=_0x49377b[_0xf079('0x2d')]({'plain':!![]});var _0x341de9=_0xf079('0x2e');return db['UserProfileSection']['find']({'where':{'name':_0x341de9,'userProfileId':_0x3fe076['userProfileId']},'raw':!![]})[_0xf079('0x2c')](function(_0x47bfa3){if(_0x47bfa3&&_0x47bfa3[_0xf079('0x51')]===0x0){return db[_0xf079('0x2f')][_0xf079('0x4c')]({'name':_0x3fe381['name'],'resourceId':_0x3fe381['id'],'type':_0x47bfa3[_0xf079('0x31')],'sectionId':_0x47bfa3['id']},{})[_0xf079('0x2c')](function(){return _0x49377b;});}else{return _0x49377b;}})[_0xf079('0x47')](function(_0x12b813){logger[_0xf079('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12b813);throw _0x12b813;});}return _0x49377b;})[_0xf079('0x2c')](respondWithResult(_0x4393ff,0xc9))[_0xf079('0x47')](handleError(_0x4393ff,null));};exports['update']=function(_0x23e916,_0xd6bc4f){if(_0x23e916['body']['id']){delete _0x23e916[_0xf079('0x4d')]['id'];}return db[_0xf079('0x33')][_0xf079('0x53')]({'where':{'id':_0x23e916[_0xf079('0x49')]['id']}})[_0xf079('0x2c')](handleEntityNotFound(_0xd6bc4f,null))[_0xf079('0x2c')](saveUpdates(_0x23e916[_0xf079('0x4d')],null))['then'](respondWithResult(_0xd6bc4f,null))[_0xf079('0x47')](handleError(_0xd6bc4f,null));};exports['destroy']=function(_0x432c0b,_0x343ac9){return db[_0xf079('0x33')][_0xf079('0x53')]({'where':{'id':_0x432c0b[_0xf079('0x49')]['id']}})[_0xf079('0x2c')](handleEntityNotFound(_0x343ac9,null))[_0xf079('0x2c')](removeEntity(_0x343ac9,null))[_0xf079('0x47')](handleError(_0x343ac9,null));};exports[_0xf079('0x54')]=function(_0x4b831a,_0x14b6a5){return db['FaxQueue'][_0xf079('0x54')]()[_0xf079('0x2c')](respondWithResult(_0x14b6a5,null))[_0xf079('0x47')](handleError(_0x14b6a5,null));};exports[_0xf079('0x55')]=function(_0x3b2a40,_0x2d47d9,_0x2891ee){var _0x2c5fb9={'raw':!![],'where':{}},_0x9681b7={},_0x168a97;return db[_0xf079('0x33')]['findOne']({'where':{'id':_0x3b2a40[_0xf079('0x49')]['id']}})['then'](handleEntityNotFound(_0x2d47d9,null))[_0xf079('0x2c')](function(_0x24105d){if(_0x24105d){_0x168a97=_0x24105d[_0xf079('0x2d')]({'plain':!![]});_0x9681b7[_0xf079('0x3b')]=_[_0xf079('0x37')](db['UserFaxQueue'][_0xf079('0x4a')]);_0x9681b7[_0xf079('0x36')]=_[_0xf079('0x37')](_0x3b2a40['query']);_0x9681b7[_0xf079('0x38')]=_['intersection'](_0x9681b7['model'],_0x9681b7['query']);_0x2c5fb9['attributes']=_[_0xf079('0x3a')](_0x9681b7[_0xf079('0x3b')],qs[_0xf079('0x3c')](_0x3b2a40[_0xf079('0x36')]['fields']));_0x2c5fb9['attributes']=_0x2c5fb9[_0xf079('0x39')]['length']?_0x2c5fb9[_0xf079('0x39')]:_0x9681b7[_0xf079('0x3b')];if(!_0x3b2a40[_0xf079('0x36')]['hasOwnProperty'](_0xf079('0x56'))){_0x2c5fb9[_0xf079('0x24')]=qs[_0xf079('0x24')](_0x3b2a40[_0xf079('0x36')][_0xf079('0x24')]);_0x2c5fb9['offset']=qs['offset'](_0x3b2a40['query'][_0xf079('0x21')]);}_0x2c5fb9[_0xf079('0x3e')]=qs['sort'](_0x3b2a40[_0xf079('0x36')][_0xf079('0x3f')]);_0x2c5fb9[_0xf079('0x40')]=qs[_0xf079('0x38')](_[_0xf079('0x41')](_0x3b2a40[_0xf079('0x36')],_0x9681b7[_0xf079('0x38')]));_0x2c5fb9[_0xf079('0x40')][_0xf079('0x57')]=_0x24105d['id'];if(_0x3b2a40[_0xf079('0x36')][_0xf079('0x42')]){_0x2c5fb9[_0xf079('0x40')]=_['merge'](_0x2c5fb9[_0xf079('0x40')],{'$or':_[_0xf079('0x35')](_0x2c5fb9['attributes'],function(_0x49a42a){var _0x5157db={};_0x5157db[_0x49a42a]={'$like':'%'+_0x3b2a40['query'][_0xf079('0x42')]+'%'};return _0x5157db;})});}_0x2c5fb9=_[_0xf079('0x43')]({},_0x2c5fb9,_0x3b2a40[_0xf079('0x4b')]);return db[_0xf079('0x58')][_0xf079('0x46')](_0x2c5fb9);}})[_0xf079('0x2c')](function(_0x372431){if(_0x372431){return db[_0xf079('0x59')][_0xf079('0x5a')]({'where':{'id':_[_0xf079('0x35')](_0x372431,_0xf079('0x5b')),'role':'agent'},'attributes':['id',_0xf079('0x31'),_0xf079('0x5c'),_0xf079('0x5d'),_0xf079('0x5e')]});}})[_0xf079('0x2c')](function(_0x5370db){if(_0x5370db){return{'count':_0x5370db[_0xf079('0x23')],'rows':_[_0xf079('0x35')](_0x5370db[_0xf079('0x5f')],function(_0x453021){return{'membername':_0x453021[_0xf079('0x31')],'UserId':_0x453021['id'],'queue_name':_0x168a97[_0xf079('0x31')],'FaxQueueId':_0x168a97['id'],'interface':util['format'](_0xf079('0x60'),'SIP',_0x453021[_0xf079('0x31')]),'penalty':0x0,'paused':_0x453021[_0xf079('0x5c')],'createdAt':_0x453021[_0xf079('0x5e')],'updatedAt':_0x453021[_0xf079('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf079('0x2c')](respondWithFilteredResult(_0x2d47d9,_0x2c5fb9))['catch'](handleError(_0x2d47d9,null));};exports[_0xf079('0x61')]=function(_0x59caf3,_0x2598e5,_0x4467f8){var _0x4935f5={};var _0x487a17={};var _0x506f3d;var _0xd659f7;return db[_0xf079('0x33')][_0xf079('0x62')]({'where':{'id':_0x59caf3['params']['id']}})[_0xf079('0x2c')](handleEntityNotFound(_0x2598e5,null))[_0xf079('0x2c')](function(_0x775f2){if(_0x775f2){_0x506f3d=_0x775f2;_0x487a17[_0xf079('0x3b')]=_[_0xf079('0x37')](db[_0xf079('0x63')][_0xf079('0x4a')]);_0x487a17['query']=_[_0xf079('0x37')](_0x59caf3[_0xf079('0x36')]);_0x487a17['filters']=_[_0xf079('0x3a')](_0x487a17[_0xf079('0x3b')],_0x487a17[_0xf079('0x36')]);_0x4935f5[_0xf079('0x39')]=_[_0xf079('0x3a')](_0x487a17[_0xf079('0x3b')],qs[_0xf079('0x3c')](_0x59caf3[_0xf079('0x36')][_0xf079('0x3c')]));_0x4935f5[_0xf079('0x39')]=_0x4935f5['attributes'][_0xf079('0x3d')]?_0x4935f5[_0xf079('0x39')]:_0x487a17['model'];_0x4935f5[_0xf079('0x3e')]=qs[_0xf079('0x3f')](_0x59caf3[_0xf079('0x36')]['sort']);_0x4935f5[_0xf079('0x40')]=qs[_0xf079('0x38')](_[_0xf079('0x41')](_0x59caf3['query'],_0x487a17[_0xf079('0x38')]));if(_0x59caf3[_0xf079('0x36')][_0xf079('0x42')]){_0x4935f5['where']=_[_0xf079('0x43')](_0x4935f5[_0xf079('0x40')],{'$or':_[_0xf079('0x35')](_0x4935f5[_0xf079('0x39')],function(_0x59a7fa){var _0x2cfca4={};_0x2cfca4[_0x59a7fa]={'$like':'%'+_0x59caf3['query'][_0xf079('0x42')]+'%'};return _0x2cfca4;})});}_0x4935f5=_[_0xf079('0x43')]({},_0x4935f5,_0x59caf3[_0xf079('0x4b')]);return _0x506f3d[_0xf079('0x61')](_0x4935f5);}})[_0xf079('0x2c')](function(_0x317709){if(_0x317709){_0xd659f7=_0x317709['length'];if(!_0x59caf3[_0xf079('0x36')]['hasOwnProperty'](_0xf079('0x56'))){_0x4935f5[_0xf079('0x24')]=qs[_0xf079('0x24')](_0x59caf3[_0xf079('0x36')]['limit']);_0x4935f5[_0xf079('0x21')]=qs[_0xf079('0x21')](_0x59caf3[_0xf079('0x36')][_0xf079('0x21')]);}return _0x506f3d[_0xf079('0x61')](_0x4935f5);}})[_0xf079('0x2c')](function(_0x23bcdd){if(_0x23bcdd){return _0x23bcdd?{'count':_0xd659f7,'rows':_0x23bcdd}:null;}})['then'](respondWithResult(_0x2598e5,null))[_0xf079('0x47')](handleError(_0x2598e5,null));};exports['addTeams']=function(_0x317368,_0x742400,_0x8a7ae0){var _0x23ec1b=_0x317368['body'][_0xf079('0x64')];return db[_0xf079('0x63')][_0xf079('0x46')]({'where':{'id':_0x23ec1b},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf079('0x65'),'attributes':['id',_0xf079('0x31'),_0xf079('0x66'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x1a7c76){if(_0x1a7c76){var _0x5d8419=_[_0xf079('0x67')](_0x1a7c76,function(_0x7e2f8b){var _0x5ba611=_0x7e2f8b[_0xf079('0x2d')]({'plain':!![]});return _0x5ba611[_0xf079('0x65')];});return db[_0xf079('0x33')]['find']({'where':{'id':_0x317368[_0xf079('0x49')]['id']}})['then'](function(_0x1c8333){return db[_0xf079('0x68')][_0xf079('0x69')](function(_0xfd9ba7){return _0x1c8333[_0xf079('0x6a')](_0x23ec1b,{'transaction':_0xfd9ba7})['then'](function(){return BPromise['each'](_0x5d8419,function(_0x384542){return db[_0xf079('0x58')][_0xf079('0x6b')]({'where':{'UserId':_0x384542['id'],'FaxQueueId':_0x317368[_0xf079('0x49')]['id']},'transaction':_0xfd9ba7});});})[_0xf079('0x2c')](function(){_0x5d8419[_0xf079('0x6c')](function(_0x311de3){socket[_0xf079('0x6d')](_0xf079('0x6e'),{'UserId':_0x311de3['id'],'FaxQueueId':_0x1c8333['id']});});});});});}})[_0xf079('0x2c')](respondWithStatusCode(_0x742400,null))['catch'](handleError(_0x742400,null));};exports[_0xf079('0x6f')]=function(_0x442583,_0x5d27ed,_0x1cf79d){return db[_0xf079('0x63')]['findAll']({'where':{'id':_0x442583[_0xf079('0x36')][_0xf079('0x64')]},'attributes':['id'],'include':[{'model':db[_0xf079('0x59')],'as':_0xf079('0x65'),'attributes':['id'],'raw':!![]}]})[_0xf079('0x2c')](handleEntityNotFound(_0x5d27ed,null))[_0xf079('0x2c')](function(_0x19355e){var _0x108941=_['map'](_0x19355e,'id');var _0x28c742=[];var _0x3bb077=[];var _0x1f0100=squel[_0xf079('0x70')]();_0x1f0100[_0xf079('0x71')](_0xf079('0x72'))['from'](_0xf079('0x73'),'tq')[_0xf079('0x74')]('user_has_teams','ut',_0xf079('0x75'))[_0xf079('0x40')](_0xf079('0x76'),_0x442583[_0xf079('0x49')]['id']);for(var _0xb616c3=0x0;_0xb616c3<_0x19355e[_0xf079('0x3d')];_0xb616c3+=0x1){let _0x3a9db9=_0x19355e[_0xb616c3];for(var _0x1e1e73=0x0;_0x1e1e73<_0x3a9db9['Agents']['length'];_0x1e1e73+=0x1){let _0x33c0f2=_0x3a9db9['Agents'][_0x1e1e73];var _0x3fd22d=_0x1f0100['clone']();_0x3fd22d[_0xf079('0x40')](_0xf079('0x77'),_0x33c0f2['id']);_0x3bb077['push'](db[_0xf079('0x68')][_0xf079('0x36')](_0x3fd22d[_0xf079('0x78')](),{'type':db[_0xf079('0x68')][_0xf079('0x79')][_0xf079('0x7a')]})[_0xf079('0x2c')](function(_0x5b7b73){if(_0x5b7b73[_0xf079('0x3d')]===0x1){return _0x33c0f2['id'];}else{var _0x36aaea=_[_0xf079('0x7b')](_[_0xf079('0x35')](_0x5b7b73,_0xf079('0x7c')),function(_0x3d2fa6){return _[_0xf079('0x7d')](_0x108941,_0x3d2fa6);});if(_0x36aaea){return _0x33c0f2['id'];}}}));}}return BPromise['all'](_0x3bb077)['then'](function(_0x4151ad){_0x28c742=_(_0x28c742)[_0xf079('0x7e')](_0x4151ad)[_0xf079('0x7f')]()[_0xf079('0x80')]();return db['FaxQueue'][_0xf079('0x53')]({'where':{'id':_0x442583[_0xf079('0x49')]['id']}})[_0xf079('0x2c')](function(_0x2958f3){return db['sequelize'][_0xf079('0x69')](function(_0x290ef9){return _0x2958f3[_0xf079('0x6f')](_0x442583[_0xf079('0x36')]['ids'],{'transaction':_0x290ef9})['then'](function(){if(!_[_0xf079('0x81')](_0x28c742)){return _0x2958f3['removeAgents'](_0x28c742,{'transaction':_0x290ef9});}})[_0xf079('0x2c')](function(){_0x28c742['forEach'](function(_0x19b0af){socket['emit']('userFaxQueue:remove',{'UserId':_0x19b0af,'FaxQueueId':_0x2958f3['id']});});});});});});})[_0xf079('0x2c')](respondWithStatusCode(_0x5d27ed,null))['catch'](handleError(_0x5d27ed,null));};exports[_0xf079('0x82')]=function(_0x15375e,_0x23c776,_0x2ac4ec){return db['FaxQueue'][_0xf079('0x53')]({'where':{'id':_0x15375e[_0xf079('0x49')]['id']}})['then'](handleEntityNotFound(_0x23c776,null))[_0xf079('0x2c')](function(_0x3472ea){if(_0x3472ea){return _0x3472ea[_0xf079('0x82')](_0x15375e['body'][_0xf079('0x64')],_['omit'](_0x15375e['body'],[_0xf079('0x64'),'id'])||{})[_0xf079('0x83')](function(_0x121e8d){for(var _0x4c5c40=0x0;_0x4c5c40<_0x15375e[_0xf079('0x4d')]['ids']['length'];_0x4c5c40+=0x1){socket['emit'](_0xf079('0x6e'),{'UserId':Number(_0x15375e[_0xf079('0x4d')]['ids'][_0x4c5c40]),'FaxQueueId':Number(_0x15375e[_0xf079('0x49')]['id'])});}return _0x121e8d;});}})[_0xf079('0x2c')](respondWithResult(_0x23c776,null))[_0xf079('0x47')](handleError(_0x23c776,null));};exports[_0xf079('0x84')]=function(_0x203b71,_0x2081da,_0xc9f93){return db[_0xf079('0x33')][_0xf079('0x53')]({'where':{'id':_0x203b71[_0xf079('0x49')]['id']}})['then'](handleEntityNotFound(_0x2081da,null))[_0xf079('0x2c')](function(_0x88a8f4){if(_0x88a8f4){return _0x88a8f4[_0xf079('0x84')](_0x203b71[_0xf079('0x36')][_0xf079('0x64')])[_0xf079('0x2c')](function(){if(_[_0xf079('0x85')](_0x203b71[_0xf079('0x36')][_0xf079('0x64')])){for(var _0x140946=0x0;_0x140946<_0x203b71['query'][_0xf079('0x64')][_0xf079('0x3d')];_0x140946+=0x1){socket[_0xf079('0x6d')]('userFaxQueue:remove',{'UserId':Number(_0x203b71[_0xf079('0x36')]['ids'][_0x140946]),'FaxQueueId':Number(_0x203b71[_0xf079('0x49')]['id'])});}}else{socket['emit'](_0xf079('0x86'),{'UserId':Number(_0x203b71[_0xf079('0x36')][_0xf079('0x64')]),'FaxQueueId':Number(_0x203b71[_0xf079('0x49')]['id'])});}});}})[_0xf079('0x2c')](respondWithStatusCode(_0x2081da,null))[_0xf079('0x47')](handleError(_0x2081da,null));};exports[_0xf079('0x87')]=function(_0x45aedf,_0x96c62e,_0x539ac0){var _0x4b0502={};var _0x447c00={};var _0x63ed3f;var _0x520711;return db[_0xf079('0x33')]['findOne']({'where':{'id':_0x45aedf[_0xf079('0x49')]['id']}})['then'](handleEntityNotFound(_0x96c62e,null))[_0xf079('0x2c')](function(_0x266681){if(_0x266681){_0x63ed3f=_0x266681;_0x447c00[_0xf079('0x3b')]=_[_0xf079('0x37')](db['User']['rawAttributes']);_0x447c00[_0xf079('0x36')]=_[_0xf079('0x37')](_0x45aedf[_0xf079('0x36')]);_0x447c00[_0xf079('0x38')]=_['intersection'](_0x447c00[_0xf079('0x3b')],_0x447c00[_0xf079('0x36')]);_0x4b0502[_0xf079('0x39')]=_[_0xf079('0x3a')](_0x447c00[_0xf079('0x3b')],qs[_0xf079('0x3c')](_0x45aedf['query']['fields']));_0x4b0502[_0xf079('0x39')]=_0x4b0502[_0xf079('0x39')][_0xf079('0x3d')]?_0x4b0502[_0xf079('0x39')]:_0x447c00[_0xf079('0x3b')];_0x4b0502[_0xf079('0x3e')]=qs[_0xf079('0x3f')](_0x45aedf[_0xf079('0x36')]['sort']);_0x4b0502['where']=qs[_0xf079('0x38')](_[_0xf079('0x41')](_0x45aedf[_0xf079('0x36')],_0x447c00['filters']));if(_0x45aedf['query'][_0xf079('0x42')]){_0x4b0502['where']=_[_0xf079('0x43')](_0x4b0502[_0xf079('0x40')],{'$or':_[_0xf079('0x35')](_0x4b0502[_0xf079('0x39')],function(_0x12e477){var _0x38d9df={};_0x38d9df[_0x12e477]={'$like':'%'+_0x45aedf[_0xf079('0x36')][_0xf079('0x42')]+'%'};return _0x38d9df;})});}_0x4b0502=_[_0xf079('0x43')]({},_0x4b0502,_0x45aedf[_0xf079('0x4b')]);return _0x63ed3f['getAgents'](_0x4b0502);}})[_0xf079('0x2c')](function(_0x4d87f8){if(_0x4d87f8){_0x520711=_0x4d87f8['length'];if(!_0x45aedf['query'][_0xf079('0x88')](_0xf079('0x56'))){_0x4b0502[_0xf079('0x24')]=qs['limit'](_0x45aedf['query'][_0xf079('0x24')]);_0x4b0502[_0xf079('0x21')]=qs[_0xf079('0x21')](_0x45aedf[_0xf079('0x36')][_0xf079('0x21')]);}return _0x63ed3f[_0xf079('0x87')](_0x4b0502);}})[_0xf079('0x2c')](function(_0x4da63b){if(_0x4da63b){return _0x4da63b?{'count':_0x520711,'rows':_0x4da63b}:null;}})[_0xf079('0x2c')](respondWithResult(_0x96c62e,null))[_0xf079('0x47')](handleError(_0x96c62e,null));}; \ No newline at end of file +var _0x3950=['create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserFaxQueue','order','FaxQueueId','findAll','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','options','ids','Team','online','interface','flatMap','sequelize','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','User','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','SELECT','includes','all','union','compact','value','transaction','isEmpty','removeAgents','addAgents','omit','spread','userFaxQueue:remove','getAgents','rimraf','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','end','json','offset','undefined','count','status','Content-Range','apply','reject','update','then','FaxQueues','UserProfileResource','destroy','error','stack','name','send','map','FaxQueue','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','catch','show','params'];(function(_0x23b04e,_0x3117b7){var _0x5f1ac3=function(_0x5ddcab){while(--_0x5ddcab){_0x23b04e['push'](_0x23b04e['shift']());}};_0x5f1ac3(++_0x3117b7);}(_0x3950,0x158));var _0x0395=function(_0x1d5458,_0x3acf09){_0x1d5458=_0x1d5458-0x0;var _0x9bf6f=_0x3950[_0x1d5458];return _0x9bf6f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0395('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0395('0x1'));var moment=require(_0x0395('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x0395('0x3'));var util=require(_0x0395('0x4'));var path=require(_0x0395('0x5'));var sox=require(_0x0395('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0395('0x7'));var _=require(_0x0395('0x8'));var squel=require(_0x0395('0x9'));var crypto=require(_0x0395('0xa'));var jsforce=require(_0x0395('0xb'));var deskjs=require(_0x0395('0xc'));var toCsv=require(_0x0395('0xd'));var querystring=require(_0x0395('0xe'));var Papa=require(_0x0395('0xf'));var Redis=require(_0x0395('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0395('0x11'));var as=require(_0x0395('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0395('0x13'))(_0x0395('0x14'));var utils=require(_0x0395('0x15'));var config=require(_0x0395('0x16'));var licenseUtil=require(_0x0395('0x17'));var db=require('../../mysqldb')['db'];config[_0x0395('0x18')]=_[_0x0395('0x19')](config[_0x0395('0x18')],{'host':_0x0395('0x1a'),'port':0x18eb});var socket=require(_0x0395('0x1b'))(new Redis(config[_0x0395('0x18')]));require(_0x0395('0x1c'))['register'](socket);function respondWithStatusCode(_0x28103b,_0x3721e4){_0x3721e4=_0x3721e4||0xcc;return function(_0x5b31c1){if(_0x5b31c1){return _0x28103b[_0x0395('0x1d')](_0x3721e4);}return _0x28103b['status'](_0x3721e4)[_0x0395('0x1e')]();};}function respondWithResult(_0x1117ee,_0x4b4538){_0x4b4538=_0x4b4538||0xc8;return function(_0xd78e7a){if(_0xd78e7a){return _0x1117ee['status'](_0x4b4538)[_0x0395('0x1f')](_0xd78e7a);}};}function respondWithFilteredResult(_0x4586bf,_0x24f4fb){return function(_0x2ca81e){if(_0x2ca81e){var _0x15379d=typeof _0x24f4fb[_0x0395('0x20')]===_0x0395('0x21')&&typeof _0x24f4fb['limit']===_0x0395('0x21');var _0x13c8b7=_0x2ca81e[_0x0395('0x22')];var _0x175228=_0x15379d?0x0:_0x24f4fb[_0x0395('0x20')];var _0x2a4252=_0x15379d?_0x2ca81e[_0x0395('0x22')]:_0x24f4fb[_0x0395('0x20')]+_0x24f4fb['limit'];var _0x7a1a51;if(_0x2a4252>=_0x13c8b7){_0x2a4252=_0x13c8b7;_0x7a1a51=0xc8;}else{_0x7a1a51=0xce;}_0x4586bf[_0x0395('0x23')](_0x7a1a51);return _0x4586bf['set'](_0x0395('0x24'),_0x175228+'-'+_0x2a4252+'/'+_0x13c8b7)[_0x0395('0x1f')](_0x2ca81e);}return null;};}function patchUpdates(_0x446f9b){return function(_0x25caf3){try{jsonpatch[_0x0395('0x25')](_0x25caf3,_0x446f9b,!![]);}catch(_0x45645e){return BPromise[_0x0395('0x26')](_0x45645e);}return _0x25caf3['save']();};}function saveUpdates(_0x6cd8af,_0x220f6c){return function(_0x753e12){if(_0x753e12){return _0x753e12[_0x0395('0x27')](_0x6cd8af)['then'](function(_0x5d90cb){return _0x5d90cb;});}return null;};}function removeEntity(_0x28429a,_0x429e27){return function(_0x1d3fcb){if(_0x1d3fcb){return _0x1d3fcb['destroy']()[_0x0395('0x28')](function(){var _0x57adaa=_0x1d3fcb['get']({'plain':!![]});var _0x745e25=_0x0395('0x29');return db[_0x0395('0x2a')][_0x0395('0x2b')]({'where':{'type':_0x745e25,'resourceId':_0x57adaa['id']}})[_0x0395('0x28')](function(){return _0x1d3fcb;});})[_0x0395('0x28')](function(){_0x28429a[_0x0395('0x23')](0xcc)[_0x0395('0x1e')]();});}};}function handleEntityNotFound(_0x6c5d70,_0x1b43b1){return function(_0x21906d){if(!_0x21906d){_0x6c5d70[_0x0395('0x1d')](0x194);}return _0x21906d;};}function handleError(_0x224f42,_0x4cf837){_0x4cf837=_0x4cf837||0x1f4;return function(_0x532547){logger[_0x0395('0x2c')](_0x532547[_0x0395('0x2d')]);if(_0x532547['name']){delete _0x532547[_0x0395('0x2e')];}_0x224f42[_0x0395('0x23')](_0x4cf837)[_0x0395('0x2f')](_0x532547);};}exports['index']=function(_0x46c44e,_0x929285){var _0xb190a0={},_0x20bef8={},_0x1fbde2={'count':0x0,'rows':[]};var _0x41757f=_[_0x0395('0x30')](db[_0x0395('0x31')][_0x0395('0x32')],function(_0x44c42b){return{'name':_0x44c42b['fieldName'],'type':_0x44c42b['type']['key']};});_0x20bef8[_0x0395('0x33')]=_[_0x0395('0x30')](_0x41757f,_0x0395('0x2e'));_0x20bef8[_0x0395('0x34')]=_[_0x0395('0x35')](_0x46c44e['query']);_0x20bef8[_0x0395('0x36')]=_[_0x0395('0x37')](_0x20bef8['model'],_0x20bef8['query']);_0xb190a0[_0x0395('0x38')]=_['intersection'](_0x20bef8[_0x0395('0x33')],qs[_0x0395('0x39')](_0x46c44e[_0x0395('0x34')][_0x0395('0x39')]));_0xb190a0[_0x0395('0x38')]=_0xb190a0[_0x0395('0x38')][_0x0395('0x3a')]?_0xb190a0[_0x0395('0x38')]:_0x20bef8[_0x0395('0x33')];if(!_0x46c44e[_0x0395('0x34')][_0x0395('0x3b')](_0x0395('0x3c'))){_0xb190a0[_0x0395('0x3d')]=qs[_0x0395('0x3d')](_0x46c44e[_0x0395('0x34')][_0x0395('0x3d')]);_0xb190a0[_0x0395('0x20')]=qs[_0x0395('0x20')](_0x46c44e[_0x0395('0x34')][_0x0395('0x20')]);}_0xb190a0['order']=qs[_0x0395('0x3e')](_0x46c44e['query'][_0x0395('0x3e')]);_0xb190a0[_0x0395('0x3f')]=qs[_0x0395('0x36')](_[_0x0395('0x40')](_0x46c44e[_0x0395('0x34')],_0x20bef8[_0x0395('0x36')]),_0x41757f);if(_0x46c44e[_0x0395('0x34')][_0x0395('0x41')]){_0xb190a0[_0x0395('0x3f')]=_[_0x0395('0x42')](_0xb190a0[_0x0395('0x3f')],{'$or':_[_0x0395('0x30')](_0x41757f,function(_0x3f9299){if(_0x3f9299[_0x0395('0x43')]!==_0x0395('0x44')){var _0x519acd={};_0x519acd[_0x3f9299[_0x0395('0x2e')]]={'$like':'%'+_0x46c44e[_0x0395('0x34')][_0x0395('0x41')]+'%'};return _0x519acd;}})});}_0xb190a0=_['merge']({},_0xb190a0,_0x46c44e['options']);var _0x487e9a={'where':_0xb190a0['where']};return db[_0x0395('0x31')]['count'](_0x487e9a)[_0x0395('0x28')](function(_0x24fc21){_0x1fbde2[_0x0395('0x22')]=_0x24fc21;if(_0x46c44e[_0x0395('0x34')][_0x0395('0x45')]){_0xb190a0['include']=[{'all':!![]}];}return db[_0x0395('0x31')]['findAll'](_0xb190a0);})[_0x0395('0x28')](function(_0x18e51a){_0x1fbde2['rows']=_0x18e51a;return _0x1fbde2;})[_0x0395('0x28')](respondWithFilteredResult(_0x929285,_0xb190a0))[_0x0395('0x46')](handleError(_0x929285,null));};exports[_0x0395('0x47')]=function(_0x587b60,_0x5bf26c){var _0x158c53={'raw':!![],'where':{'id':_0x587b60[_0x0395('0x48')]['id']}},_0x54b907={};_0x54b907[_0x0395('0x33')]=_[_0x0395('0x35')](db[_0x0395('0x31')][_0x0395('0x32')]);_0x54b907[_0x0395('0x34')]=_[_0x0395('0x35')](_0x587b60[_0x0395('0x34')]);_0x54b907[_0x0395('0x36')]=_[_0x0395('0x37')](_0x54b907['model'],_0x54b907[_0x0395('0x34')]);_0x158c53[_0x0395('0x38')]=_[_0x0395('0x37')](_0x54b907['model'],qs['fields'](_0x587b60['query']['fields']));_0x158c53[_0x0395('0x38')]=_0x158c53[_0x0395('0x38')][_0x0395('0x3a')]?_0x158c53[_0x0395('0x38')]:_0x54b907['model'];if(_0x587b60[_0x0395('0x34')][_0x0395('0x45')]){_0x158c53['include']=[{'all':!![]}];}_0x158c53=_[_0x0395('0x42')]({},_0x158c53,_0x587b60['options']);return db['FaxQueue']['find'](_0x158c53)[_0x0395('0x28')](handleEntityNotFound(_0x5bf26c,null))[_0x0395('0x28')](respondWithResult(_0x5bf26c,null))['catch'](handleError(_0x5bf26c,null));};exports[_0x0395('0x49')]=function(_0x5d4580,_0x3cf94e){return db['FaxQueue'][_0x0395('0x49')](_0x5d4580['body'],{})[_0x0395('0x28')](function(_0x9980ec){var _0xea1174=_0x5d4580[_0x0395('0x4a')]['get']({'plain':!![]});if(!_0xea1174)throw new Error(_0x0395('0x4b'));if(_0xea1174[_0x0395('0x4c')]===_0x0395('0x4a')){var _0x2016be=_0x9980ec[_0x0395('0x4d')]({'plain':!![]});var _0x515b3b=_0x0395('0x29');return db['UserProfileSection'][_0x0395('0x4e')]({'where':{'name':_0x515b3b,'userProfileId':_0xea1174[_0x0395('0x4f')]},'raw':!![]})[_0x0395('0x28')](function(_0x4ab12e){if(_0x4ab12e&&_0x4ab12e['autoAssociation']===0x0){return db[_0x0395('0x2a')][_0x0395('0x49')]({'name':_0x2016be[_0x0395('0x2e')],'resourceId':_0x2016be['id'],'type':_0x4ab12e[_0x0395('0x2e')],'sectionId':_0x4ab12e['id']},{})[_0x0395('0x28')](function(){return _0x9980ec;});}else{return _0x9980ec;}})[_0x0395('0x46')](function(_0xe4f5e9){logger[_0x0395('0x2c')](_0x0395('0x50'),_0xe4f5e9);throw _0xe4f5e9;});}return _0x9980ec;})[_0x0395('0x28')](respondWithResult(_0x3cf94e,0xc9))[_0x0395('0x46')](handleError(_0x3cf94e,null));};exports[_0x0395('0x27')]=function(_0x29c06e,_0x396020){if(_0x29c06e[_0x0395('0x51')]['id']){delete _0x29c06e[_0x0395('0x51')]['id'];}return db[_0x0395('0x31')][_0x0395('0x4e')]({'where':{'id':_0x29c06e[_0x0395('0x48')]['id']}})[_0x0395('0x28')](handleEntityNotFound(_0x396020,null))[_0x0395('0x28')](saveUpdates(_0x29c06e['body'],null))[_0x0395('0x28')](respondWithResult(_0x396020,null))[_0x0395('0x46')](handleError(_0x396020,null));};exports['destroy']=function(_0x1dcbd1,_0x3a01d1){return db['FaxQueue'][_0x0395('0x4e')]({'where':{'id':_0x1dcbd1[_0x0395('0x48')]['id']}})[_0x0395('0x28')](handleEntityNotFound(_0x3a01d1,null))[_0x0395('0x28')](removeEntity(_0x3a01d1,null))[_0x0395('0x46')](handleError(_0x3a01d1,null));};exports[_0x0395('0x52')]=function(_0x55c985,_0x2ca2e9){return db[_0x0395('0x31')]['describe']()[_0x0395('0x28')](respondWithResult(_0x2ca2e9,null))['catch'](handleError(_0x2ca2e9,null));};exports[_0x0395('0x53')]=function(_0x383b19,_0x354a69,_0x2fb0a7){var _0x4f45f7={'raw':!![],'where':{}},_0x28d04f={},_0x563b1b;return db[_0x0395('0x31')][_0x0395('0x54')]({'where':{'id':_0x383b19[_0x0395('0x48')]['id']}})['then'](handleEntityNotFound(_0x354a69,null))[_0x0395('0x28')](function(_0x185b90){if(_0x185b90){_0x563b1b=_0x185b90[_0x0395('0x4d')]({'plain':!![]});_0x28d04f['model']=_[_0x0395('0x35')](db[_0x0395('0x55')][_0x0395('0x32')]);_0x28d04f[_0x0395('0x34')]=_[_0x0395('0x35')](_0x383b19['query']);_0x28d04f[_0x0395('0x36')]=_['intersection'](_0x28d04f[_0x0395('0x33')],_0x28d04f[_0x0395('0x34')]);_0x4f45f7[_0x0395('0x38')]=_[_0x0395('0x37')](_0x28d04f[_0x0395('0x33')],qs[_0x0395('0x39')](_0x383b19[_0x0395('0x34')]['fields']));_0x4f45f7[_0x0395('0x38')]=_0x4f45f7[_0x0395('0x38')][_0x0395('0x3a')]?_0x4f45f7[_0x0395('0x38')]:_0x28d04f[_0x0395('0x33')];if(!_0x383b19[_0x0395('0x34')][_0x0395('0x3b')](_0x0395('0x3c'))){_0x4f45f7[_0x0395('0x3d')]=qs[_0x0395('0x3d')](_0x383b19[_0x0395('0x34')]['limit']);_0x4f45f7['offset']=qs['offset'](_0x383b19[_0x0395('0x34')][_0x0395('0x20')]);}_0x4f45f7[_0x0395('0x56')]=qs[_0x0395('0x3e')](_0x383b19['query']['sort']);_0x4f45f7[_0x0395('0x3f')]=qs[_0x0395('0x36')](_['pick'](_0x383b19[_0x0395('0x34')],_0x28d04f[_0x0395('0x36')]));_0x4f45f7[_0x0395('0x3f')][_0x0395('0x57')]=_0x185b90['id'];if(_0x383b19[_0x0395('0x34')][_0x0395('0x41')]){_0x4f45f7['where']=_[_0x0395('0x42')](_0x4f45f7[_0x0395('0x3f')],{'$or':_['map'](_0x4f45f7['attributes'],function(_0x3d87a8){var _0x45e572={};_0x45e572[_0x3d87a8]={'$like':'%'+_0x383b19[_0x0395('0x34')][_0x0395('0x41')]+'%'};return _0x45e572;})});}_0x4f45f7=_['merge']({},_0x4f45f7,_0x383b19['options']);return db[_0x0395('0x55')][_0x0395('0x58')](_0x4f45f7);}})['then'](function(_0x1e6045){if(_0x1e6045){return db['User'][_0x0395('0x59')]({'where':{'id':_[_0x0395('0x30')](_0x1e6045,_0x0395('0x5a')),'role':_0x0395('0x5b')},'attributes':['id',_0x0395('0x2e'),_0x0395('0x5c'),_0x0395('0x5d'),_0x0395('0x5e')]});}})[_0x0395('0x28')](function(_0xd52b63){if(_0xd52b63){return{'count':_0xd52b63[_0x0395('0x22')],'rows':_[_0x0395('0x30')](_0xd52b63[_0x0395('0x5f')],function(_0x26aa86){return{'membername':_0x26aa86[_0x0395('0x2e')],'UserId':_0x26aa86['id'],'queue_name':_0x563b1b[_0x0395('0x2e')],'FaxQueueId':_0x563b1b['id'],'interface':util[_0x0395('0x60')](_0x0395('0x61'),_0x0395('0x62'),_0x26aa86[_0x0395('0x2e')]),'penalty':0x0,'paused':_0x26aa86[_0x0395('0x5c')],'createdAt':_0x26aa86['createdAt'],'updatedAt':_0x26aa86['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x0395('0x28')](respondWithFilteredResult(_0x354a69,_0x4f45f7))[_0x0395('0x46')](handleError(_0x354a69,null));};exports[_0x0395('0x63')]=function(_0x1edaf3,_0x588458,_0x22cce8){var _0x3a7877={};var _0x5dc716={};var _0x58e4ef;var _0x5a1fe0;return db[_0x0395('0x31')][_0x0395('0x54')]({'where':{'id':_0x1edaf3[_0x0395('0x48')]['id']}})['then'](handleEntityNotFound(_0x588458,null))['then'](function(_0x45fca5){if(_0x45fca5){_0x58e4ef=_0x45fca5;_0x5dc716[_0x0395('0x33')]=_[_0x0395('0x35')](db['Team'][_0x0395('0x32')]);_0x5dc716[_0x0395('0x34')]=_[_0x0395('0x35')](_0x1edaf3['query']);_0x5dc716[_0x0395('0x36')]=_[_0x0395('0x37')](_0x5dc716[_0x0395('0x33')],_0x5dc716['query']);_0x3a7877[_0x0395('0x38')]=_['intersection'](_0x5dc716['model'],qs[_0x0395('0x39')](_0x1edaf3[_0x0395('0x34')][_0x0395('0x39')]));_0x3a7877[_0x0395('0x38')]=_0x3a7877[_0x0395('0x38')][_0x0395('0x3a')]?_0x3a7877[_0x0395('0x38')]:_0x5dc716[_0x0395('0x33')];_0x3a7877['order']=qs[_0x0395('0x3e')](_0x1edaf3['query'][_0x0395('0x3e')]);_0x3a7877['where']=qs[_0x0395('0x36')](_[_0x0395('0x40')](_0x1edaf3['query'],_0x5dc716[_0x0395('0x36')]));if(_0x1edaf3['query'][_0x0395('0x41')]){_0x3a7877[_0x0395('0x3f')]=_[_0x0395('0x42')](_0x3a7877[_0x0395('0x3f')],{'$or':_[_0x0395('0x30')](_0x3a7877['attributes'],function(_0x532804){var _0x170132={};_0x170132[_0x532804]={'$like':'%'+_0x1edaf3['query']['filter']+'%'};return _0x170132;})});}_0x3a7877=_[_0x0395('0x42')]({},_0x3a7877,_0x1edaf3[_0x0395('0x64')]);return _0x58e4ef[_0x0395('0x63')](_0x3a7877);}})[_0x0395('0x28')](function(_0x97c1fd){if(_0x97c1fd){_0x5a1fe0=_0x97c1fd['length'];if(!_0x1edaf3[_0x0395('0x34')][_0x0395('0x3b')](_0x0395('0x3c'))){_0x3a7877['limit']=qs[_0x0395('0x3d')](_0x1edaf3[_0x0395('0x34')][_0x0395('0x3d')]);_0x3a7877[_0x0395('0x20')]=qs[_0x0395('0x20')](_0x1edaf3[_0x0395('0x34')][_0x0395('0x20')]);}return _0x58e4ef['getTeams'](_0x3a7877);}})[_0x0395('0x28')](function(_0x4258d1){if(_0x4258d1){return _0x4258d1?{'count':_0x5a1fe0,'rows':_0x4258d1}:null;}})['then'](respondWithResult(_0x588458,null))[_0x0395('0x46')](handleError(_0x588458,null));};exports['addTeams']=function(_0x5963d5,_0x3275e6,_0x1c985a){var _0x394bca=_0x5963d5[_0x0395('0x51')][_0x0395('0x65')];return db[_0x0395('0x66')][_0x0395('0x58')]({'where':{'id':_0x394bca},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x0395('0x2e'),_0x0395('0x67'),'voicePause',_0x0395('0x68')],'raw':!![]}]})[_0x0395('0x28')](function(_0x63a7a6){if(_0x63a7a6){var _0x4f06eb=_[_0x0395('0x69')](_0x63a7a6,function(_0x2f23bf){var _0x5c1e98=_0x2f23bf[_0x0395('0x4d')]({'plain':!![]});return _0x5c1e98['Agents'];});return db[_0x0395('0x31')]['find']({'where':{'id':_0x5963d5[_0x0395('0x48')]['id']}})[_0x0395('0x28')](function(_0x16d11a){return db[_0x0395('0x6a')]['transaction'](function(_0x54158f){return _0x16d11a['addTeams'](_0x394bca,{'transaction':_0x54158f})[_0x0395('0x28')](function(){return BPromise['each'](_0x4f06eb,function(_0x4ea034){return db['UserFaxQueue'][_0x0395('0x6b')]({'where':{'UserId':_0x4ea034['id'],'FaxQueueId':_0x5963d5[_0x0395('0x48')]['id']},'transaction':_0x54158f});});})[_0x0395('0x28')](function(){_0x4f06eb[_0x0395('0x6c')](function(_0x50db78){socket[_0x0395('0x6d')](_0x0395('0x6e'),{'UserId':_0x50db78['id'],'FaxQueueId':_0x16d11a['id']});});});});});}})[_0x0395('0x28')](respondWithStatusCode(_0x3275e6,null))['catch'](handleError(_0x3275e6,null));};exports[_0x0395('0x6f')]=function(_0x2bcce0,_0x5ebb7b,_0x11e284){return db[_0x0395('0x66')][_0x0395('0x58')]({'where':{'id':_0x2bcce0[_0x0395('0x34')][_0x0395('0x65')]},'attributes':['id'],'include':[{'model':db[_0x0395('0x70')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5ebb7b,null))['then'](function(_0x562acf){var _0x3d7607=_[_0x0395('0x30')](_0x562acf,'id');var _0x46d67c=[];var _0x4a0a15=[];var _0x224bbf=squel[_0x0395('0x71')]();_0x224bbf[_0x0395('0x72')](_0x0395('0x73'))[_0x0395('0x74')](_0x0395('0x75'),'tq')[_0x0395('0x76')](_0x0395('0x77'),'ut',_0x0395('0x78'))[_0x0395('0x3f')]('FaxQueueId\x20=\x20?',_0x2bcce0[_0x0395('0x48')]['id']);for(var _0x2ae250=0x0;_0x2ae250<_0x562acf['length'];_0x2ae250+=0x1){let _0x541b18=_0x562acf[_0x2ae250];for(var _0x5b3686=0x0;_0x5b3686<_0x541b18['Agents'][_0x0395('0x3a')];_0x5b3686+=0x1){let _0x2b4bb5=_0x541b18['Agents'][_0x5b3686];var _0x471ed6=_0x224bbf[_0x0395('0x79')]();_0x471ed6[_0x0395('0x3f')](_0x0395('0x7a'),_0x2b4bb5['id']);_0x4a0a15[_0x0395('0x7b')](db[_0x0395('0x6a')][_0x0395('0x34')](_0x471ed6[_0x0395('0x7c')](),{'type':db['sequelize']['QueryTypes'][_0x0395('0x7d')]})['then'](function(_0x47355b){if(_0x47355b[_0x0395('0x3a')]===0x1){return _0x2b4bb5['id'];}else{var _0x31ff3a=_['every'](_[_0x0395('0x30')](_0x47355b,'TeamId'),function(_0x9f2df5){return _[_0x0395('0x7e')](_0x3d7607,_0x9f2df5);});if(_0x31ff3a){return _0x2b4bb5['id'];}}}));}}return BPromise[_0x0395('0x7f')](_0x4a0a15)[_0x0395('0x28')](function(_0x5aefdf){_0x46d67c=_(_0x46d67c)[_0x0395('0x80')](_0x5aefdf)[_0x0395('0x81')]()[_0x0395('0x82')]();return db[_0x0395('0x31')][_0x0395('0x4e')]({'where':{'id':_0x2bcce0[_0x0395('0x48')]['id']}})[_0x0395('0x28')](function(_0x3329ca){return db[_0x0395('0x6a')][_0x0395('0x83')](function(_0x2ad158){return _0x3329ca[_0x0395('0x6f')](_0x2bcce0[_0x0395('0x34')]['ids'],{'transaction':_0x2ad158})['then'](function(){if(!_[_0x0395('0x84')](_0x46d67c)){return _0x3329ca[_0x0395('0x85')](_0x46d67c,{'transaction':_0x2ad158});}})['then'](function(){_0x46d67c[_0x0395('0x6c')](function(_0x511bf7){socket[_0x0395('0x6d')]('userFaxQueue:remove',{'UserId':_0x511bf7,'FaxQueueId':_0x3329ca['id']});});});});});});})[_0x0395('0x28')](respondWithStatusCode(_0x5ebb7b,null))[_0x0395('0x46')](handleError(_0x5ebb7b,null));};exports[_0x0395('0x86')]=function(_0x4706a6,_0x13aefc,_0x4ff88f){return db['FaxQueue'][_0x0395('0x4e')]({'where':{'id':_0x4706a6[_0x0395('0x48')]['id']}})[_0x0395('0x28')](handleEntityNotFound(_0x13aefc,null))[_0x0395('0x28')](function(_0x51d142){if(_0x51d142){return _0x51d142[_0x0395('0x86')](_0x4706a6[_0x0395('0x51')][_0x0395('0x65')],_[_0x0395('0x87')](_0x4706a6['body'],[_0x0395('0x65'),'id'])||{})[_0x0395('0x88')](function(_0x384b82){for(var _0x18f083=0x0;_0x18f083<_0x4706a6[_0x0395('0x51')][_0x0395('0x65')][_0x0395('0x3a')];_0x18f083+=0x1){socket['emit'](_0x0395('0x6e'),{'UserId':Number(_0x4706a6[_0x0395('0x51')][_0x0395('0x65')][_0x18f083]),'FaxQueueId':Number(_0x4706a6['params']['id'])});}return _0x384b82;});}})[_0x0395('0x28')](respondWithResult(_0x13aefc,null))[_0x0395('0x46')](handleError(_0x13aefc,null));};exports['removeAgents']=function(_0xc2205f,_0x5cf497,_0x3f43cf){return db['FaxQueue'][_0x0395('0x4e')]({'where':{'id':_0xc2205f[_0x0395('0x48')]['id']}})[_0x0395('0x28')](handleEntityNotFound(_0x5cf497,null))[_0x0395('0x28')](function(_0x199471){if(_0x199471){return _0x199471['removeAgents'](_0xc2205f[_0x0395('0x34')][_0x0395('0x65')])[_0x0395('0x28')](function(){if(_['isArray'](_0xc2205f[_0x0395('0x34')][_0x0395('0x65')])){for(var _0x35d119=0x0;_0x35d119<_0xc2205f['query'][_0x0395('0x65')][_0x0395('0x3a')];_0x35d119+=0x1){socket[_0x0395('0x6d')](_0x0395('0x89'),{'UserId':Number(_0xc2205f[_0x0395('0x34')][_0x0395('0x65')][_0x35d119]),'FaxQueueId':Number(_0xc2205f[_0x0395('0x48')]['id'])});}}else{socket['emit'](_0x0395('0x89'),{'UserId':Number(_0xc2205f[_0x0395('0x34')]['ids']),'FaxQueueId':Number(_0xc2205f[_0x0395('0x48')]['id'])});}});}})[_0x0395('0x28')](respondWithStatusCode(_0x5cf497,null))[_0x0395('0x46')](handleError(_0x5cf497,null));};exports[_0x0395('0x8a')]=function(_0x2d1617,_0x590e13,_0x228054){var _0x34706f={};var _0x4ed4e6={};var _0x229e27;var _0x59564e;return db['FaxQueue']['findOne']({'where':{'id':_0x2d1617[_0x0395('0x48')]['id']}})[_0x0395('0x28')](handleEntityNotFound(_0x590e13,null))[_0x0395('0x28')](function(_0x366a9c){if(_0x366a9c){_0x229e27=_0x366a9c;_0x4ed4e6['model']=_[_0x0395('0x35')](db[_0x0395('0x70')][_0x0395('0x32')]);_0x4ed4e6[_0x0395('0x34')]=_[_0x0395('0x35')](_0x2d1617['query']);_0x4ed4e6[_0x0395('0x36')]=_[_0x0395('0x37')](_0x4ed4e6[_0x0395('0x33')],_0x4ed4e6[_0x0395('0x34')]);_0x34706f[_0x0395('0x38')]=_[_0x0395('0x37')](_0x4ed4e6['model'],qs[_0x0395('0x39')](_0x2d1617[_0x0395('0x34')][_0x0395('0x39')]));_0x34706f['attributes']=_0x34706f[_0x0395('0x38')][_0x0395('0x3a')]?_0x34706f['attributes']:_0x4ed4e6[_0x0395('0x33')];_0x34706f[_0x0395('0x56')]=qs[_0x0395('0x3e')](_0x2d1617[_0x0395('0x34')]['sort']);_0x34706f['where']=qs[_0x0395('0x36')](_[_0x0395('0x40')](_0x2d1617[_0x0395('0x34')],_0x4ed4e6[_0x0395('0x36')]));if(_0x2d1617[_0x0395('0x34')]['filter']){_0x34706f[_0x0395('0x3f')]=_[_0x0395('0x42')](_0x34706f[_0x0395('0x3f')],{'$or':_[_0x0395('0x30')](_0x34706f[_0x0395('0x38')],function(_0x221976){var _0x39f278={};_0x39f278[_0x221976]={'$like':'%'+_0x2d1617[_0x0395('0x34')][_0x0395('0x41')]+'%'};return _0x39f278;})});}_0x34706f=_[_0x0395('0x42')]({},_0x34706f,_0x2d1617[_0x0395('0x64')]);return _0x229e27[_0x0395('0x8a')](_0x34706f);}})['then'](function(_0x5eae2b){if(_0x5eae2b){_0x59564e=_0x5eae2b['length'];if(!_0x2d1617['query'][_0x0395('0x3b')]('nolimit')){_0x34706f[_0x0395('0x3d')]=qs[_0x0395('0x3d')](_0x2d1617['query'][_0x0395('0x3d')]);_0x34706f[_0x0395('0x20')]=qs[_0x0395('0x20')](_0x2d1617[_0x0395('0x34')]['offset']);}return _0x229e27['getAgents'](_0x34706f);}})[_0x0395('0x28')](function(_0x5ed6e8){if(_0x5ed6e8){return _0x5ed6e8?{'count':_0x59564e,'rows':_0x5ed6e8}:null;}})[_0x0395('0x28')](respondWithResult(_0x590e13,null))['catch'](handleError(_0x590e13,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 50e6109..76d181b 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 _0x1e52=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update'];(function(_0x2dbeae,_0x331c62){var _0x1dd1ed=function(_0x25b628){while(--_0x25b628){_0x2dbeae['push'](_0x2dbeae['shift']());}};_0x1dd1ed(++_0x331c62);}(_0x1e52,0x118));var _0x21e5=function(_0x159969,_0x48b72a){_0x159969=_0x159969-0x0;var _0x21fb4b=_0x1e52[_0x159969];return _0x21fb4b;};'use strict';var EventEmitter=require(_0x21e5('0x0'));var FaxQueue=require(_0x21e5('0x1'))['db'][_0x21e5('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x21e5('0x3')](0x0);var events={'afterCreate':_0x21e5('0x4'),'afterUpdate':_0x21e5('0x5'),'afterDestroy':_0x21e5('0x6')};function emitEvent(_0x3e327f){return function(_0x15a84e,_0x3cf833,_0x138570){FaxQueueEvents[_0x21e5('0x7')](_0x3e327f+':'+_0x15a84e['id'],_0x15a84e);FaxQueueEvents[_0x21e5('0x7')](_0x3e327f,_0x15a84e);_0x138570(null);};}for(var e in events){if(events[_0x21e5('0x8')](e)){var event=events[e];FaxQueue[_0x21e5('0x9')](e,emitEvent(event));}}module[_0x21e5('0xa')]=FaxQueueEvents; \ No newline at end of file +var _0xca0b=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxQueue','setMaxListeners','save'];(function(_0x3938d2,_0x8e9793){var _0x45513c=function(_0x2684ea){while(--_0x2684ea){_0x3938d2['push'](_0x3938d2['shift']());}};_0x45513c(++_0x8e9793);}(_0xca0b,0xe1));var _0xbca0=function(_0x4369ef,_0x33cde3){_0x4369ef=_0x4369ef-0x0;var _0xf9dac4=_0xca0b[_0x4369ef];return _0xf9dac4;};'use strict';var EventEmitter=require(_0xbca0('0x0'));var FaxQueue=require(_0xbca0('0x1'))['db'][_0xbca0('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xbca0('0x3')](0x0);var events={'afterCreate':_0xbca0('0x4'),'afterUpdate':_0xbca0('0x5'),'afterDestroy':_0xbca0('0x6')};function emitEvent(_0x246c96){return function(_0x5b3983,_0x579e4e,_0x1a8d91){FaxQueueEvents['emit'](_0x246c96+':'+_0x5b3983['id'],_0x5b3983);FaxQueueEvents[_0xbca0('0x7')](_0x246c96,_0x5b3983);_0x1a8d91(null);};}for(var e in events){if(events[_0xbca0('0x8')](e)){var event=events[e];FaxQueue[_0xbca0('0x9')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index e2e8cf9..f46bcb9 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 _0x4fd8=['path','rimraf','../../config/environment','./faxQueue.attributes','exports','lodash','util','api','moment','bluebird','request-promise'];(function(_0xbdc283,_0x5e0184){var _0x319b3d=function(_0x2456f6){while(--_0x2456f6){_0xbdc283['push'](_0xbdc283['shift']());}};_0x319b3d(++_0x5e0184);}(_0x4fd8,0x165));var _0x84fd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4fd8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x84fd('0x0'));var util=require(_0x84fd('0x1'));var logger=require('../../config/logger')(_0x84fd('0x2'));var moment=require(_0x84fd('0x3'));var BPromise=require(_0x84fd('0x4'));var rp=require(_0x84fd('0x5'));var fs=require('fs');var path=require(_0x84fd('0x6'));var rimraf=require(_0x84fd('0x7'));var config=require(_0x84fd('0x8'));var attributes=require(_0x84fd('0x9'));module[_0x84fd('0xa')]=function(_0x1d11bc,_0x375d10){return _0x1d11bc['define']('FaxQueue',attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ba9=['rimraf','../../config/environment','./faxQueue.attributes','exports','define','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x46b14c,_0xc19e5e){var _0x4f95c8=function(_0x23cf28){while(--_0x23cf28){_0x46b14c['push'](_0x46b14c['shift']());}};_0x4f95c8(++_0xc19e5e);}(_0x6ba9,0xb9));var _0x96ba=function(_0x11ddab,_0x1105cb){_0x11ddab=_0x11ddab-0x0;var _0x5f3a88=_0x6ba9[_0x11ddab];return _0x5f3a88;};'use strict';var _=require(_0x96ba('0x0'));var util=require(_0x96ba('0x1'));var logger=require(_0x96ba('0x2'))(_0x96ba('0x3'));var moment=require(_0x96ba('0x4'));var BPromise=require('bluebird');var rp=require(_0x96ba('0x5'));var fs=require('fs');var path=require(_0x96ba('0x6'));var rimraf=require(_0x96ba('0x7'));var config=require(_0x96ba('0x8'));var attributes=require(_0x96ba('0x9'));module[_0x96ba('0xa')]=function(_0x221b06,_0x53396a){return _0x221b06[_0x96ba('0xb')]('FaxQueue',attributes,{'tableName':'fax_queues','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 d110794..54788e0 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 _0x2412=['debug','stringify','find','ShowFaxQueue','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','request\x20sent','error','code','FaxQueue,\x20%s,\x20%s','message','result','catch','FaxQueue','options','where','attributes','limit','map','include','model','GetFaxQueue'];(function(_0x411fd8,_0x56f775){var _0x594859=function(_0x372def){while(--_0x372def){_0x411fd8['push'](_0x411fd8['shift']());}};_0x594859(++_0x56f775);}(_0x2412,0x1f2));var _0x2241=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2412[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2241('0x0'));var util=require('util');var moment=require(_0x2241('0x1'));var BPromise=require(_0x2241('0x2'));var rs=require(_0x2241('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2241('0x4'));var logger=require(_0x2241('0x5'))(_0x2241('0x6'));var config=require('../../config/environment');var jayson=require(_0x2241('0x7'));var client=jayson[_0x2241('0x8')][_0x2241('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x2241('0xa')],{'host':_0x2241('0xb'),'port':0x18eb});var socket=require(_0x2241('0xc'))(new Redis(config[_0x2241('0xa')]));require(_0x2241('0xd'))[_0x2241('0xe')](socket);function respondWithRpcPromise(_0xcf8c3f,_0x4d0922,_0x4b21d7){return new BPromise(function(_0x23f294,_0x1c7470){return client[_0x2241('0xf')](_0xcf8c3f,_0x4b21d7)[_0x2241('0x10')](function(_0x4176ff){logger[_0x2241('0x11')]('FaxQueue,\x20%s,\x20%s',_0x4d0922,'request\x20sent');logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x4d0922,_0x2241('0x12'),JSON['stringify'](_0x4176ff));if(_0x4176ff[_0x2241('0x13')]){if(_0x4176ff[_0x2241('0x13')][_0x2241('0x14')]===0x1f4){logger[_0x2241('0x13')](_0x2241('0x15'),_0x4d0922,_0x4176ff[_0x2241('0x13')][_0x2241('0x16')]);return _0x1c7470(_0x4176ff[_0x2241('0x13')][_0x2241('0x16')]);}logger['error'](_0x2241('0x15'),_0x4d0922,_0x4176ff['error'][_0x2241('0x16')]);return _0x23f294(_0x4176ff[_0x2241('0x13')][_0x2241('0x16')]);}else{logger['info'](_0x2241('0x15'),_0x4d0922,_0x2241('0x12'));_0x23f294(_0x4176ff[_0x2241('0x17')][_0x2241('0x16')]);}})[_0x2241('0x18')](function(_0x5eef5d){logger[_0x2241('0x13')](_0x2241('0x15'),_0x4d0922,_0x5eef5d);_0x1c7470(_0x5eef5d);});});}exports['GetFaxQueue']=function(_0x439d87){var _0x29f592=this;return new Promise(function(_0x1a29f9,_0x363468){return db[_0x2241('0x19')]['findAll']({'raw':_0x439d87['options']?_0x439d87[_0x2241('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x439d87[_0x2241('0x1a')]?_0x439d87[_0x2241('0x1a')][_0x2241('0x1b')]||null:null,'attributes':_0x439d87['options']?_0x439d87[_0x2241('0x1a')][_0x2241('0x1c')]||null:null,'limit':_0x439d87[_0x2241('0x1a')]?_0x439d87['options'][_0x2241('0x1d')]||null:null,'include':_0x439d87[_0x2241('0x1a')]?_0x439d87['options']['include']?_[_0x2241('0x1e')](_0x439d87[_0x2241('0x1a')][_0x2241('0x1f')],function(_0x556941){return{'model':db[_0x556941['model']],'as':_0x556941['as'],'attributes':_0x556941[_0x2241('0x1c')],'include':_0x556941[_0x2241('0x1f')]?_[_0x2241('0x1e')](_0x556941[_0x2241('0x1f')],function(_0x5a1543){return{'model':db[_0x5a1543['model']],'as':_0x5a1543['as'],'attributes':_0x5a1543[_0x2241('0x1c')],'include':_0x5a1543['include']?_['map'](_0x5a1543['include'],function(_0x5dec68){return{'model':db[_0x5dec68[_0x2241('0x20')]],'as':_0x5dec68['as'],'attributes':_0x5dec68[_0x2241('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2241('0x10')](function(_0xf0c3c3){logger[_0x2241('0x11')](_0x2241('0x21'),_0x439d87);logger[_0x2241('0x22')]('GetFaxQueue',_0x439d87,JSON[_0x2241('0x23')](_0xf0c3c3));_0x1a29f9(_0xf0c3c3);})[_0x2241('0x18')](function(_0xcda0af){logger['error']('GetFaxQueue',_0xcda0af[_0x2241('0x16')],_0x439d87);_0x363468(_0x29f592[_0x2241('0x13')](0x1f4,_0xcda0af[_0x2241('0x16')]));});});};exports['ShowFaxQueue']=function(_0x5e7d1f){var _0x49b701=this;return new Promise(function(_0x5ec868,_0x5c9a9a){return db[_0x2241('0x19')][_0x2241('0x24')]({'raw':_0x5e7d1f['options']?_0x5e7d1f['options']['raw']===undefined?!![]:![]:!![],'where':_0x5e7d1f['options']?_0x5e7d1f[_0x2241('0x1a')][_0x2241('0x1b')]||null:null,'attributes':_0x5e7d1f[_0x2241('0x1a')]?_0x5e7d1f[_0x2241('0x1a')][_0x2241('0x1c')]||null:null,'include':_0x5e7d1f[_0x2241('0x1a')]?_0x5e7d1f[_0x2241('0x1a')][_0x2241('0x1f')]?_[_0x2241('0x1e')](_0x5e7d1f['options']['include'],function(_0x470110){return{'model':db[_0x470110['model']],'as':_0x470110['as'],'attributes':_0x470110[_0x2241('0x1c')],'include':_0x470110[_0x2241('0x1f')]?_[_0x2241('0x1e')](_0x470110[_0x2241('0x1f')],function(_0xc49a44){return{'model':db[_0xc49a44[_0x2241('0x20')]],'as':_0xc49a44['as'],'attributes':_0xc49a44[_0x2241('0x1c')],'include':_0xc49a44[_0x2241('0x1f')]?_[_0x2241('0x1e')](_0xc49a44[_0x2241('0x1f')],function(_0x83dc80){return{'model':db[_0x83dc80[_0x2241('0x20')]],'as':_0x83dc80['as'],'attributes':_0x83dc80[_0x2241('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2241('0x10')](function(_0x28806f){logger['info'](_0x2241('0x25'),_0x5e7d1f);logger[_0x2241('0x22')](_0x2241('0x25'),_0x5e7d1f,JSON[_0x2241('0x23')](_0x28806f));_0x5ec868(_0x28806f);})[_0x2241('0x18')](function(_0x78fa51){logger[_0x2241('0x13')](_0x2241('0x25'),_0x78fa51[_0x2241('0x16')],_0x5e7d1f);_0x5c9a9a(_0x49b701['error'](0x1f4,_0x78fa51[_0x2241('0x16')]));});});}; \ No newline at end of file +var _0x5926=['rpc','../../config/environment','client','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','FaxQueue','findAll','options','raw','where','attributes','limit','map','include','model','GetFaxQueue','catch','ShowFaxQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3c7d53,_0x2826d0){var _0x2c8387=function(_0x21f0e8){while(--_0x21f0e8){_0x3c7d53['push'](_0x3c7d53['shift']());}};_0x2c8387(++_0x2826d0);}(_0x5926,0x188));var _0x6592=function(_0x30f3c4,_0x2e16ce){_0x30f3c4=_0x30f3c4-0x0;var _0x3ed3b5=_0x5926[_0x30f3c4];return _0x3ed3b5;};'use strict';var _=require('lodash');var util=require(_0x6592('0x0'));var moment=require(_0x6592('0x1'));var BPromise=require(_0x6592('0x2'));var rs=require(_0x6592('0x3'));var fs=require('fs');var Redis=require(_0x6592('0x4'));var db=require(_0x6592('0x5'))['db'];var utils=require(_0x6592('0x6'));var logger=require(_0x6592('0x7'))(_0x6592('0x8'));var config=require(_0x6592('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6592('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x6592('0xb')],{'host':_0x6592('0xc'),'port':0x18eb});var socket=require(_0x6592('0xd'))(new Redis(config[_0x6592('0xb')]));require('./faxQueue.socket')[_0x6592('0xe')](socket);function respondWithRpcPromise(_0x15ca97,_0x51af5d,_0x14fadb){return new BPromise(function(_0x357f76,_0x48dcd9){return client[_0x6592('0xf')](_0x15ca97,_0x14fadb)[_0x6592('0x10')](function(_0x2026ff){logger[_0x6592('0x11')]('FaxQueue,\x20%s,\x20%s',_0x51af5d,_0x6592('0x12'));logger[_0x6592('0x13')](_0x6592('0x14'),_0x51af5d,_0x6592('0x12'),JSON[_0x6592('0x15')](_0x2026ff));if(_0x2026ff[_0x6592('0x16')]){if(_0x2026ff['error'][_0x6592('0x17')]===0x1f4){logger[_0x6592('0x16')](_0x6592('0x18'),_0x51af5d,_0x2026ff[_0x6592('0x16')][_0x6592('0x19')]);return _0x48dcd9(_0x2026ff[_0x6592('0x16')][_0x6592('0x19')]);}logger['error'](_0x6592('0x18'),_0x51af5d,_0x2026ff[_0x6592('0x16')][_0x6592('0x19')]);return _0x357f76(_0x2026ff[_0x6592('0x16')][_0x6592('0x19')]);}else{logger[_0x6592('0x11')](_0x6592('0x18'),_0x51af5d,_0x6592('0x12'));_0x357f76(_0x2026ff['result'][_0x6592('0x19')]);}})['catch'](function(_0x5121df){logger[_0x6592('0x16')](_0x6592('0x18'),_0x51af5d,_0x5121df);_0x48dcd9(_0x5121df);});});}exports['GetFaxQueue']=function(_0x10dfcf){var _0x25084d=this;return new Promise(function(_0x1a9860,_0x2fa42b){return db[_0x6592('0x1a')][_0x6592('0x1b')]({'raw':_0x10dfcf['options']?_0x10dfcf[_0x6592('0x1c')][_0x6592('0x1d')]===undefined?!![]:![]:!![],'where':_0x10dfcf[_0x6592('0x1c')]?_0x10dfcf['options'][_0x6592('0x1e')]||null:null,'attributes':_0x10dfcf[_0x6592('0x1c')]?_0x10dfcf['options'][_0x6592('0x1f')]||null:null,'limit':_0x10dfcf['options']?_0x10dfcf[_0x6592('0x1c')][_0x6592('0x20')]||null:null,'include':_0x10dfcf[_0x6592('0x1c')]?_0x10dfcf[_0x6592('0x1c')]['include']?_[_0x6592('0x21')](_0x10dfcf[_0x6592('0x1c')][_0x6592('0x22')],function(_0x32a88d){return{'model':db[_0x32a88d[_0x6592('0x23')]],'as':_0x32a88d['as'],'attributes':_0x32a88d[_0x6592('0x1f')],'include':_0x32a88d[_0x6592('0x22')]?_[_0x6592('0x21')](_0x32a88d[_0x6592('0x22')],function(_0x5bd3ad){return{'model':db[_0x5bd3ad[_0x6592('0x23')]],'as':_0x5bd3ad['as'],'attributes':_0x5bd3ad[_0x6592('0x1f')],'include':_0x5bd3ad[_0x6592('0x22')]?_[_0x6592('0x21')](_0x5bd3ad[_0x6592('0x22')],function(_0x4b248d){return{'model':db[_0x4b248d[_0x6592('0x23')]],'as':_0x4b248d['as'],'attributes':_0x4b248d[_0x6592('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6592('0x10')](function(_0x1cb0d4){logger[_0x6592('0x11')](_0x6592('0x24'),_0x10dfcf);logger[_0x6592('0x13')](_0x6592('0x24'),_0x10dfcf,JSON[_0x6592('0x15')](_0x1cb0d4));_0x1a9860(_0x1cb0d4);})[_0x6592('0x25')](function(_0x4e1d1a){logger[_0x6592('0x16')](_0x6592('0x24'),_0x4e1d1a[_0x6592('0x19')],_0x10dfcf);_0x2fa42b(_0x25084d[_0x6592('0x16')](0x1f4,_0x4e1d1a[_0x6592('0x19')]));});});};exports[_0x6592('0x26')]=function(_0x3ae52d){var _0x2bce23=this;return new Promise(function(_0x392da3,_0x35b729){return db[_0x6592('0x1a')][_0x6592('0x27')]({'raw':_0x3ae52d[_0x6592('0x1c')]?_0x3ae52d['options']['raw']===undefined?!![]:![]:!![],'where':_0x3ae52d['options']?_0x3ae52d[_0x6592('0x1c')][_0x6592('0x1e')]||null:null,'attributes':_0x3ae52d['options']?_0x3ae52d[_0x6592('0x1c')][_0x6592('0x1f')]||null:null,'include':_0x3ae52d[_0x6592('0x1c')]?_0x3ae52d[_0x6592('0x1c')][_0x6592('0x22')]?_[_0x6592('0x21')](_0x3ae52d['options']['include'],function(_0xb4ac46){return{'model':db[_0xb4ac46[_0x6592('0x23')]],'as':_0xb4ac46['as'],'attributes':_0xb4ac46[_0x6592('0x1f')],'include':_0xb4ac46[_0x6592('0x22')]?_[_0x6592('0x21')](_0xb4ac46[_0x6592('0x22')],function(_0x35ef66){return{'model':db[_0x35ef66[_0x6592('0x23')]],'as':_0x35ef66['as'],'attributes':_0x35ef66[_0x6592('0x1f')],'include':_0x35ef66[_0x6592('0x22')]?_[_0x6592('0x21')](_0x35ef66[_0x6592('0x22')],function(_0x34bb8b){return{'model':db[_0x34bb8b['model']],'as':_0x34bb8b['as'],'attributes':_0x34bb8b[_0x6592('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6592('0x10')](function(_0x36b8b8){logger[_0x6592('0x11')](_0x6592('0x26'),_0x3ae52d);logger[_0x6592('0x13')](_0x6592('0x26'),_0x3ae52d,JSON['stringify'](_0x36b8b8));_0x392da3(_0x36b8b8);})[_0x6592('0x25')](function(_0x3138b2){logger[_0x6592('0x16')](_0x6592('0x26'),_0x3138b2['message'],_0x3ae52d);_0x35b729(_0x2bce23['error'](0x1f4,_0x3138b2[_0x6592('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index b19981a..45eb7bf 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 _0x0159=['update','emit','removeListener','register','length','faxQueue:','./faxQueue.events','save','remove'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x0159,0x141));var _0x9015=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0159[_0x3dd15e];return _0x231fd0;};'use strict';var FaxQueueEvents=require(_0x9015('0x0'));var events=[_0x9015('0x1'),_0x9015('0x2'),_0x9015('0x3')];function createListener(_0x122280,_0x45ff74){return function(_0x5b973e){_0x45ff74[_0x9015('0x4')](_0x122280,_0x5b973e);};}function removeListener(_0x83683,_0x16ae68){return function(){FaxQueueEvents[_0x9015('0x5')](_0x83683,_0x16ae68);};}exports[_0x9015('0x6')]=function(_0x4e94d2){for(var _0x372fe6=0x0,_0x21e1e2=events[_0x9015('0x7')];_0x372fe6<_0x21e1e2;_0x372fe6++){var _0x2199ba=events[_0x372fe6];var _0x4b5a94=createListener(_0x9015('0x8')+_0x2199ba,_0x4e94d2);FaxQueueEvents['on'](_0x2199ba,_0x4b5a94);}}; \ No newline at end of file +var _0xbc38=['save','remove','update','emit','removeListener','register','length'];(function(_0x2a67fe,_0x295c09){var _0x57e726=function(_0x280573){while(--_0x280573){_0x2a67fe['push'](_0x2a67fe['shift']());}};_0x57e726(++_0x295c09);}(_0xbc38,0x157));var _0x8bc3=function(_0x7e6506,_0x15d8ed){_0x7e6506=_0x7e6506-0x0;var _0x1bb5d3=_0xbc38[_0x7e6506];return _0x1bb5d3;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x8bc3('0x0'),_0x8bc3('0x1'),_0x8bc3('0x2')];function createListener(_0x367fd5,_0x2792f2){return function(_0x1ed356){_0x2792f2[_0x8bc3('0x3')](_0x367fd5,_0x1ed356);};}function removeListener(_0x392bcc,_0x336617){return function(){FaxQueueEvents[_0x8bc3('0x4')](_0x392bcc,_0x336617);};}exports[_0x8bc3('0x5')]=function(_0x2b01d9){for(var _0x3330c5=0x0,_0x1bfbc1=events[_0x8bc3('0x6')];_0x3330c5<_0x1bfbc1;_0x3330c5++){var _0x13a485=events[_0x3330c5];var _0x7e6b9d=createListener('faxQueue:'+_0x13a485,_0x2b01d9);FaxQueueEvents['on'](_0x13a485,_0x7e6b9d);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 69fb892..53fbcdb 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 _0x7b84=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','exports','multer','util','path','connect-timeout'];(function(_0xc36d01,_0x3bf1a6){var _0xecb231=function(_0x2fb301){while(--_0x2fb301){_0xc36d01['push'](_0xc36d01['shift']());}};_0xecb231(++_0x3bf1a6);}(_0x7b84,0x17c));var _0x47b8=function(_0x296a30,_0x2c15ec){_0x296a30=_0x296a30-0x0;var _0x50e62a=_0x7b84[_0x296a30];return _0x50e62a;};'use strict';var multer=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var path=require(_0x47b8('0x2'));var timeout=require(_0x47b8('0x3'));var express=require(_0x47b8('0x4'));var router=express[_0x47b8('0x5')]();var fs_extra=require(_0x47b8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var controller=require(_0x47b8('0x9'));router[_0x47b8('0xa')]('/',auth[_0x47b8('0xb')](),controller[_0x47b8('0xc')]);router['get'](_0x47b8('0xd'),auth[_0x47b8('0xb')](),controller[_0x47b8('0xe')]);router[_0x47b8('0xa')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x10')]);router[_0x47b8('0xa')](_0x47b8('0x11'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x12')]);router[_0x47b8('0xa')](_0x47b8('0x13'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x14')]);router[_0x47b8('0xa')](_0x47b8('0x15'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x16')]);router[_0x47b8('0x17')]('/',auth[_0x47b8('0xb')](),controller[_0x47b8('0x18')]);router[_0x47b8('0x17')](_0x47b8('0x13'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x19')]);router[_0x47b8('0x17')]('/:id/users',auth[_0x47b8('0xb')](),controller[_0x47b8('0x1a')]);router[_0x47b8('0x1b')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x1c')]);router[_0x47b8('0x1d')]('/:id',auth[_0x47b8('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0x47b8('0xb')](),controller[_0x47b8('0x1e')]);router[_0x47b8('0x1d')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x47b8('0x1f')]=router; \ No newline at end of file +var _0x199c=['getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','delete','destroy','removeTeams','removeAgents','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x199c,0x1d8));var _0xc199=function(_0x5c9070,_0x3271d1){_0x5c9070=_0x5c9070-0x0;var _0x54b5af=_0x199c[_0x5c9070];return _0x54b5af;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc199('0x0'));var timeout=require(_0xc199('0x1'));var express=require(_0xc199('0x2'));var router=express[_0xc199('0x3')]();var fs_extra=require(_0xc199('0x4'));var auth=require(_0xc199('0x5'));var interaction=require(_0xc199('0x6'));var config=require(_0xc199('0x7'));var controller=require('./faxQueue.controller');router[_0xc199('0x8')]('/',auth[_0xc199('0x9')](),controller['index']);router['get'](_0xc199('0xa'),auth[_0xc199('0x9')](),controller[_0xc199('0xb')]);router[_0xc199('0x8')](_0xc199('0xc'),auth[_0xc199('0x9')](),controller[_0xc199('0xd')]);router[_0xc199('0x8')]('/:id/members',auth[_0xc199('0x9')](),controller[_0xc199('0xe')]);router[_0xc199('0x8')](_0xc199('0xf'),auth[_0xc199('0x9')](),controller[_0xc199('0x10')]);router['get'](_0xc199('0x11'),auth[_0xc199('0x9')](),controller[_0xc199('0x12')]);router[_0xc199('0x13')]('/',auth[_0xc199('0x9')](),controller['create']);router[_0xc199('0x13')](_0xc199('0xf'),auth[_0xc199('0x9')](),controller[_0xc199('0x14')]);router[_0xc199('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0xc199('0x15')]);router['put'](_0xc199('0xc'),auth[_0xc199('0x9')](),controller['update']);router[_0xc199('0x16')]('/:id',auth[_0xc199('0x9')](),controller[_0xc199('0x17')]);router[_0xc199('0x16')](_0xc199('0xf'),auth[_0xc199('0x9')](),controller[_0xc199('0x18')]);router[_0xc199('0x16')](_0xc199('0x11'),auth[_0xc199('0x9')](),controller[_0xc199('0x19')]);module[_0xc199('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 8c3e95b..de9e0ed 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 _0xba6f=['DATE','STRING','moment','sequelize','exports'];(function(_0x4ef34e,_0x11ac32){var _0x3a6f82=function(_0x5e3df9){while(--_0x5e3df9){_0x4ef34e['push'](_0x4ef34e['shift']());}};_0x3a6f82(++_0x11ac32);}(_0xba6f,0xa7));var _0xfba6=function(_0x29311d,_0x3f9e23){_0x29311d=_0x29311d-0x0;var _0xa29b8f=_0xba6f[_0x29311d];return _0xa29b8f;};'use strict';var moment=require(_0xfba6('0x0'));var Sequelize=require(_0xfba6('0x1'));module[_0xfba6('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xfba6('0x3')]},'leaveAt':{'type':Sequelize[_0xfba6('0x3')]},'acceptAt':{'type':Sequelize[_0xfba6('0x3')]},'exitAt':{'type':Sequelize[_0xfba6('0x3')]},'reason':{'type':Sequelize[_0xfba6('0x4')]}}; \ No newline at end of file +var _0x9a23=['moment','exports','STRING','DATE'];(function(_0x3a176,_0x2b4fea){var _0x1dc7ce=function(_0x518600){while(--_0x518600){_0x3a176['push'](_0x3a176['shift']());}};_0x1dc7ce(++_0x2b4fea);}(_0x9a23,0x1e4));var _0x39a2=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x9a23[_0x2b9b7f];return _0x4ed19a;};'use strict';var moment=require(_0x39a2('0x0'));var Sequelize=require('sequelize');module[_0x39a2('0x1')]={'uniqueid':{'type':Sequelize[_0x39a2('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x39a2('0x2')]},'joinAt':{'type':Sequelize[_0x39a2('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x39a2('0x3')]},'exitAt':{'type':Sequelize[_0x39a2('0x3')]},'reason':{'type':Sequelize[_0x39a2('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 1cf657a..8d4ffdd 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 _0x1cc7=['count','limit','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','include','find','catch','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined'];(function(_0x2d27cc,_0x21d0b5){var _0x55ef01=function(_0x370c57){while(--_0x370c57){_0x2d27cc['push'](_0x2d27cc['shift']());}};_0x55ef01(++_0x21d0b5);}(_0x1cc7,0x15a));var _0x71cc=function(_0x4c5000,_0x5d7cf2){_0x4c5000=_0x4c5000-0x0;var _0x281089=_0x1cc7[_0x4c5000];return _0x281089;};'use strict';var emlformat=require(_0x71cc('0x0'));var rimraf=require(_0x71cc('0x1'));var zipdir=require(_0x71cc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x71cc('0x3'));var Mustache=require(_0x71cc('0x4'));var util=require(_0x71cc('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x71cc('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x71cc('0x7'));var squel=require(_0x71cc('0x8'));var crypto=require(_0x71cc('0x9'));var jsforce=require(_0x71cc('0xa'));var deskjs=require(_0x71cc('0xb'));var toCsv=require('to-csv');var querystring=require(_0x71cc('0xc'));var Papa=require(_0x71cc('0xd'));var Redis=require(_0x71cc('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x71cc('0xf'))(_0x71cc('0x10'));var utils=require(_0x71cc('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x71cc('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1aad83,_0x4f9c5c){_0x4f9c5c=_0x4f9c5c||0xcc;return function(_0x1a7c58){if(_0x1a7c58){return _0x1aad83['sendStatus'](_0x4f9c5c);}return _0x1aad83[_0x71cc('0x13')](_0x4f9c5c)[_0x71cc('0x14')]();};}function respondWithResult(_0x3cee23,_0xd16032){_0xd16032=_0xd16032||0xc8;return function(_0x33070e){if(_0x33070e){return _0x3cee23['status'](_0xd16032)[_0x71cc('0x15')](_0x33070e);}};}function respondWithFilteredResult(_0x292d0c,_0x3b26d1){return function(_0x14d5ab){if(_0x14d5ab){var _0x3875b8=typeof _0x3b26d1[_0x71cc('0x16')]===_0x71cc('0x17')&&typeof _0x3b26d1['limit']===_0x71cc('0x17');var _0x14788d=_0x14d5ab[_0x71cc('0x18')];var _0x1d1da8=_0x3875b8?0x0:_0x3b26d1[_0x71cc('0x16')];var _0x10da0a=_0x3875b8?_0x14d5ab['count']:_0x3b26d1[_0x71cc('0x16')]+_0x3b26d1[_0x71cc('0x19')];var _0x4fc0a9;if(_0x10da0a>=_0x14788d){_0x10da0a=_0x14788d;_0x4fc0a9=0xc8;}else{_0x4fc0a9=0xce;}_0x292d0c['status'](_0x4fc0a9);return _0x292d0c[_0x71cc('0x1a')](_0x71cc('0x1b'),_0x1d1da8+'-'+_0x10da0a+'/'+_0x14788d)[_0x71cc('0x15')](_0x14d5ab);}return null;};}function patchUpdates(_0x11299c){return function(_0x258d30){try{jsonpatch[_0x71cc('0x1c')](_0x258d30,_0x11299c,!![]);}catch(_0x363ecb){return BPromise[_0x71cc('0x1d')](_0x363ecb);}return _0x258d30['save']();};}function saveUpdates(_0x1442ef,_0x109239){return function(_0x587a0b){if(_0x587a0b){return _0x587a0b[_0x71cc('0x1e')](_0x1442ef)[_0x71cc('0x1f')](function(_0x38f58e){return _0x38f58e;});}return null;};}function removeEntity(_0x1a9b4f,_0x1bc67c){return function(_0x887399){if(_0x887399){return _0x887399['destroy']()[_0x71cc('0x1f')](function(){_0x1a9b4f[_0x71cc('0x13')](0xcc)[_0x71cc('0x14')]();});}};}function handleEntityNotFound(_0x180cd2,_0x36367b){return function(_0x5fa323){if(!_0x5fa323){_0x180cd2[_0x71cc('0x20')](0x194);}return _0x5fa323;};}function handleError(_0x42e6ec,_0xbce208){_0xbce208=_0xbce208||0x1f4;return function(_0x4d4529){logger[_0x71cc('0x21')](_0x4d4529[_0x71cc('0x22')]);if(_0x4d4529[_0x71cc('0x23')]){delete _0x4d4529[_0x71cc('0x23')];}_0x42e6ec[_0x71cc('0x13')](_0xbce208)[_0x71cc('0x24')](_0x4d4529);};}exports[_0x71cc('0x25')]=function(_0x9a7ca3,_0x3cc813){var _0x1fc046={},_0x30f94d={},_0x35f723={'count':0x0,'rows':[]};var _0x1d5805=_[_0x71cc('0x26')](db[_0x71cc('0x27')][_0x71cc('0x28')],function(_0x4fa63e){return{'name':_0x4fa63e[_0x71cc('0x29')],'type':_0x4fa63e[_0x71cc('0x2a')][_0x71cc('0x2b')]};});_0x30f94d[_0x71cc('0x2c')]=_[_0x71cc('0x26')](_0x1d5805,_0x71cc('0x23'));_0x30f94d['query']=_[_0x71cc('0x2d')](_0x9a7ca3[_0x71cc('0x2e')]);_0x30f94d[_0x71cc('0x2f')]=_[_0x71cc('0x30')](_0x30f94d[_0x71cc('0x2c')],_0x30f94d[_0x71cc('0x2e')]);_0x1fc046[_0x71cc('0x31')]=_['intersection'](_0x30f94d[_0x71cc('0x2c')],qs['fields'](_0x9a7ca3['query'][_0x71cc('0x32')]));_0x1fc046['attributes']=_0x1fc046['attributes'][_0x71cc('0x33')]?_0x1fc046['attributes']:_0x30f94d[_0x71cc('0x2c')];if(!_0x9a7ca3['query'][_0x71cc('0x34')](_0x71cc('0x35'))){_0x1fc046['limit']=qs[_0x71cc('0x19')](_0x9a7ca3[_0x71cc('0x2e')][_0x71cc('0x19')]);_0x1fc046[_0x71cc('0x16')]=qs[_0x71cc('0x16')](_0x9a7ca3[_0x71cc('0x2e')][_0x71cc('0x16')]);}_0x1fc046[_0x71cc('0x36')]=qs[_0x71cc('0x37')](_0x9a7ca3[_0x71cc('0x2e')]['sort']);_0x1fc046[_0x71cc('0x38')]=qs['filters'](_[_0x71cc('0x39')](_0x9a7ca3[_0x71cc('0x2e')],_0x30f94d[_0x71cc('0x2f')]),_0x1d5805);if(_0x9a7ca3[_0x71cc('0x2e')][_0x71cc('0x3a')]){_0x1fc046[_0x71cc('0x38')]=_['merge'](_0x1fc046[_0x71cc('0x38')],{'$or':_['map'](_0x1d5805,function(_0x468b4b){if(_0x468b4b[_0x71cc('0x2a')]!==_0x71cc('0x3b')){var _0x487e13={};_0x487e13[_0x468b4b[_0x71cc('0x23')]]={'$like':'%'+_0x9a7ca3['query'][_0x71cc('0x3a')]+'%'};return _0x487e13;}})});}_0x1fc046=_[_0x71cc('0x3c')]({},_0x1fc046,_0x9a7ca3[_0x71cc('0x3d')]);var _0x92389={'where':_0x1fc046[_0x71cc('0x38')]};return db[_0x71cc('0x27')][_0x71cc('0x18')](_0x92389)[_0x71cc('0x1f')](function(_0x3c3fae){_0x35f723[_0x71cc('0x18')]=_0x3c3fae;if(_0x9a7ca3[_0x71cc('0x2e')][_0x71cc('0x3e')]){_0x1fc046['include']=[{'all':!![]}];}return db[_0x71cc('0x27')][_0x71cc('0x3f')](_0x1fc046);})['then'](function(_0x54fc85){_0x35f723[_0x71cc('0x40')]=_0x54fc85;return _0x35f723;})[_0x71cc('0x1f')](respondWithFilteredResult(_0x3cc813,_0x1fc046))['catch'](handleError(_0x3cc813,null));};exports[_0x71cc('0x41')]=function(_0x3b9eec,_0x2fbe5e){var _0x19d7c8={'raw':!![],'where':{'id':_0x3b9eec['params']['id']}},_0x21ef21={};_0x21ef21['model']=_['keys'](db[_0x71cc('0x27')]['rawAttributes']);_0x21ef21[_0x71cc('0x2e')]=_[_0x71cc('0x2d')](_0x3b9eec[_0x71cc('0x2e')]);_0x21ef21[_0x71cc('0x2f')]=_[_0x71cc('0x30')](_0x21ef21[_0x71cc('0x2c')],_0x21ef21[_0x71cc('0x2e')]);_0x19d7c8[_0x71cc('0x31')]=_[_0x71cc('0x30')](_0x21ef21[_0x71cc('0x2c')],qs[_0x71cc('0x32')](_0x3b9eec[_0x71cc('0x2e')][_0x71cc('0x32')]));_0x19d7c8['attributes']=_0x19d7c8[_0x71cc('0x31')][_0x71cc('0x33')]?_0x19d7c8[_0x71cc('0x31')]:_0x21ef21['model'];if(_0x3b9eec[_0x71cc('0x2e')][_0x71cc('0x3e')]){_0x19d7c8[_0x71cc('0x42')]=[{'all':!![]}];}_0x19d7c8=_[_0x71cc('0x3c')]({},_0x19d7c8,_0x3b9eec[_0x71cc('0x3d')]);return db[_0x71cc('0x27')][_0x71cc('0x43')](_0x19d7c8)[_0x71cc('0x1f')](handleEntityNotFound(_0x2fbe5e,null))[_0x71cc('0x1f')](respondWithResult(_0x2fbe5e,null))[_0x71cc('0x44')](handleError(_0x2fbe5e,null));};exports[_0x71cc('0x45')]=function(_0xbb951c,_0x47cefc){return db[_0x71cc('0x27')][_0x71cc('0x45')](_0xbb951c[_0x71cc('0x46')],{})[_0x71cc('0x1f')](respondWithResult(_0x47cefc,0xc9))[_0x71cc('0x44')](handleError(_0x47cefc,null));};exports[_0x71cc('0x1e')]=function(_0x430387,_0x51cd49){if(_0x430387[_0x71cc('0x46')]['id']){delete _0x430387[_0x71cc('0x46')]['id'];}return db['FaxQueueReport'][_0x71cc('0x43')]({'where':{'id':_0x430387[_0x71cc('0x47')]['id']}})[_0x71cc('0x1f')](handleEntityNotFound(_0x51cd49,null))[_0x71cc('0x1f')](saveUpdates(_0x430387[_0x71cc('0x46')],null))[_0x71cc('0x1f')](respondWithResult(_0x51cd49,null))[_0x71cc('0x44')](handleError(_0x51cd49,null));};exports[_0x71cc('0x48')]=function(_0x3cf0bf,_0x1647ce){return db[_0x71cc('0x27')]['find']({'where':{'id':_0x3cf0bf[_0x71cc('0x47')]['id']}})['then'](handleEntityNotFound(_0x1647ce,null))[_0x71cc('0x1f')](removeEntity(_0x1647ce,null))['catch'](handleError(_0x1647ce,null));};exports[_0x71cc('0x49')]=function(_0x36c71e,_0x5c9ac5){return db[_0x71cc('0x27')][_0x71cc('0x49')]()['then'](respondWithResult(_0x5c9ac5,null))[_0x71cc('0x44')](handleError(_0x5c9ac5,null));}; \ No newline at end of file +var _0xf0cc=['fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','includeAll','include','rows','catch','show','params','keys','options','find','create','body','destroy','describe','eml-format','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','undefined','offset','count','limit','set','Content-Range','json','reject','update','then','error','stack','name','send','index','map','FaxQueueReport','rawAttributes'];(function(_0x4c1901,_0x25bca7){var _0x1d13ab=function(_0x813a35){while(--_0x813a35){_0x4c1901['push'](_0x4c1901['shift']());}};_0x1d13ab(++_0x25bca7);}(_0xf0cc,0xa7));var _0xcf0c=function(_0x41cacb,_0x5e52bc){_0x41cacb=_0x41cacb-0x0;var _0x3daa82=_0xf0cc[_0x41cacb];return _0x3daa82;};'use strict';var emlformat=require(_0xcf0c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcf0c('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcf0c('0x2'));var Mustache=require(_0xcf0c('0x3'));var util=require('util');var path=require('path');var sox=require(_0xcf0c('0x4'));var csv=require(_0xcf0c('0x5'));var ejs=require(_0xcf0c('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcf0c('0x7'));var squel=require(_0xcf0c('0x8'));var crypto=require(_0xcf0c('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcf0c('0x5'));var querystring=require('querystring');var Papa=require(_0xcf0c('0xa'));var Redis=require('ioredis');var authService=require(_0xcf0c('0xb'));var qs=require(_0xcf0c('0xc'));var as=require(_0xcf0c('0xd'));var hardwareService=require(_0xcf0c('0xe'));var logger=require(_0xcf0c('0xf'))(_0xcf0c('0x10'));var utils=require(_0xcf0c('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xcf0c('0x12'));var db=require(_0xcf0c('0x13'))['db'];function respondWithStatusCode(_0x6dde21,_0x34f74f){_0x34f74f=_0x34f74f||0xcc;return function(_0x327f65){if(_0x327f65){return _0x6dde21['sendStatus'](_0x34f74f);}return _0x6dde21[_0xcf0c('0x14')](_0x34f74f)[_0xcf0c('0x15')]();};}function respondWithResult(_0x26fc43,_0x4fd482){_0x4fd482=_0x4fd482||0xc8;return function(_0x52038a){if(_0x52038a){return _0x26fc43[_0xcf0c('0x14')](_0x4fd482)['json'](_0x52038a);}};}function respondWithFilteredResult(_0x1f7a47,_0x8ed57d){return function(_0x5362ef){if(_0x5362ef){var _0x58f9ab=typeof _0x8ed57d['offset']===_0xcf0c('0x16')&&typeof _0x8ed57d['limit']===_0xcf0c('0x16');var _0xee0e66=_0x5362ef['count'];var _0x48766e=_0x58f9ab?0x0:_0x8ed57d[_0xcf0c('0x17')];var _0x3c43e5=_0x58f9ab?_0x5362ef[_0xcf0c('0x18')]:_0x8ed57d['offset']+_0x8ed57d[_0xcf0c('0x19')];var _0x134ecb;if(_0x3c43e5>=_0xee0e66){_0x3c43e5=_0xee0e66;_0x134ecb=0xc8;}else{_0x134ecb=0xce;}_0x1f7a47[_0xcf0c('0x14')](_0x134ecb);return _0x1f7a47[_0xcf0c('0x1a')](_0xcf0c('0x1b'),_0x48766e+'-'+_0x3c43e5+'/'+_0xee0e66)[_0xcf0c('0x1c')](_0x5362ef);}return null;};}function patchUpdates(_0x29bb2b){return function(_0xcfb5bd){try{jsonpatch['apply'](_0xcfb5bd,_0x29bb2b,!![]);}catch(_0x203da7){return BPromise[_0xcf0c('0x1d')](_0x203da7);}return _0xcfb5bd['save']();};}function saveUpdates(_0x4832d2,_0x39b1ed){return function(_0x20b8f3){if(_0x20b8f3){return _0x20b8f3[_0xcf0c('0x1e')](_0x4832d2)[_0xcf0c('0x1f')](function(_0x1ceea0){return _0x1ceea0;});}return null;};}function removeEntity(_0x8c4978,_0xbdf266){return function(_0x33628d){if(_0x33628d){return _0x33628d['destroy']()[_0xcf0c('0x1f')](function(){_0x8c4978['status'](0xcc)[_0xcf0c('0x15')]();});}};}function handleEntityNotFound(_0x39f5e0,_0x444e1e){return function(_0x596190){if(!_0x596190){_0x39f5e0['sendStatus'](0x194);}return _0x596190;};}function handleError(_0x308c7c,_0xba5548){_0xba5548=_0xba5548||0x1f4;return function(_0x45ca82){logger[_0xcf0c('0x20')](_0x45ca82[_0xcf0c('0x21')]);if(_0x45ca82[_0xcf0c('0x22')]){delete _0x45ca82[_0xcf0c('0x22')];}_0x308c7c['status'](_0xba5548)[_0xcf0c('0x23')](_0x45ca82);};}exports[_0xcf0c('0x24')]=function(_0x2bd2e3,_0x43780d){var _0x4e7007={},_0x56da28={},_0x524181={'count':0x0,'rows':[]};var _0x5013f5=_[_0xcf0c('0x25')](db[_0xcf0c('0x26')][_0xcf0c('0x27')],function(_0x34db17){return{'name':_0x34db17[_0xcf0c('0x28')],'type':_0x34db17[_0xcf0c('0x29')][_0xcf0c('0x2a')]};});_0x56da28[_0xcf0c('0x2b')]=_[_0xcf0c('0x25')](_0x5013f5,'name');_0x56da28[_0xcf0c('0x2c')]=_['keys'](_0x2bd2e3[_0xcf0c('0x2c')]);_0x56da28[_0xcf0c('0x2d')]=_[_0xcf0c('0x2e')](_0x56da28['model'],_0x56da28['query']);_0x4e7007[_0xcf0c('0x2f')]=_['intersection'](_0x56da28[_0xcf0c('0x2b')],qs[_0xcf0c('0x30')](_0x2bd2e3[_0xcf0c('0x2c')][_0xcf0c('0x30')]));_0x4e7007[_0xcf0c('0x2f')]=_0x4e7007['attributes'][_0xcf0c('0x31')]?_0x4e7007[_0xcf0c('0x2f')]:_0x56da28[_0xcf0c('0x2b')];if(!_0x2bd2e3[_0xcf0c('0x2c')]['hasOwnProperty'](_0xcf0c('0x32'))){_0x4e7007[_0xcf0c('0x19')]=qs[_0xcf0c('0x19')](_0x2bd2e3[_0xcf0c('0x2c')]['limit']);_0x4e7007[_0xcf0c('0x17')]=qs[_0xcf0c('0x17')](_0x2bd2e3['query'][_0xcf0c('0x17')]);}_0x4e7007[_0xcf0c('0x33')]=qs[_0xcf0c('0x34')](_0x2bd2e3[_0xcf0c('0x2c')][_0xcf0c('0x34')]);_0x4e7007[_0xcf0c('0x35')]=qs[_0xcf0c('0x2d')](_['pick'](_0x2bd2e3[_0xcf0c('0x2c')],_0x56da28['filters']),_0x5013f5);if(_0x2bd2e3[_0xcf0c('0x2c')][_0xcf0c('0x36')]){_0x4e7007[_0xcf0c('0x35')]=_[_0xcf0c('0x37')](_0x4e7007[_0xcf0c('0x35')],{'$or':_['map'](_0x5013f5,function(_0x503703){if(_0x503703[_0xcf0c('0x29')]!=='VIRTUAL'){var _0x6f3886={};_0x6f3886[_0x503703[_0xcf0c('0x22')]]={'$like':'%'+_0x2bd2e3[_0xcf0c('0x2c')][_0xcf0c('0x36')]+'%'};return _0x6f3886;}})});}_0x4e7007=_[_0xcf0c('0x37')]({},_0x4e7007,_0x2bd2e3['options']);var _0x340a57={'where':_0x4e7007[_0xcf0c('0x35')]};return db[_0xcf0c('0x26')][_0xcf0c('0x18')](_0x340a57)[_0xcf0c('0x1f')](function(_0x4413fc){_0x524181[_0xcf0c('0x18')]=_0x4413fc;if(_0x2bd2e3[_0xcf0c('0x2c')][_0xcf0c('0x38')]){_0x4e7007[_0xcf0c('0x39')]=[{'all':!![]}];}return db[_0xcf0c('0x26')]['findAll'](_0x4e7007);})['then'](function(_0xf39dea){_0x524181[_0xcf0c('0x3a')]=_0xf39dea;return _0x524181;})[_0xcf0c('0x1f')](respondWithFilteredResult(_0x43780d,_0x4e7007))[_0xcf0c('0x3b')](handleError(_0x43780d,null));};exports[_0xcf0c('0x3c')]=function(_0x4c4fc0,_0x511c97){var _0x207701={'raw':!![],'where':{'id':_0x4c4fc0[_0xcf0c('0x3d')]['id']}},_0x24f4bd={};_0x24f4bd['model']=_[_0xcf0c('0x3e')](db[_0xcf0c('0x26')][_0xcf0c('0x27')]);_0x24f4bd[_0xcf0c('0x2c')]=_['keys'](_0x4c4fc0[_0xcf0c('0x2c')]);_0x24f4bd['filters']=_[_0xcf0c('0x2e')](_0x24f4bd['model'],_0x24f4bd[_0xcf0c('0x2c')]);_0x207701['attributes']=_[_0xcf0c('0x2e')](_0x24f4bd[_0xcf0c('0x2b')],qs['fields'](_0x4c4fc0['query']['fields']));_0x207701[_0xcf0c('0x2f')]=_0x207701[_0xcf0c('0x2f')][_0xcf0c('0x31')]?_0x207701[_0xcf0c('0x2f')]:_0x24f4bd[_0xcf0c('0x2b')];if(_0x4c4fc0[_0xcf0c('0x2c')][_0xcf0c('0x38')]){_0x207701[_0xcf0c('0x39')]=[{'all':!![]}];}_0x207701=_[_0xcf0c('0x37')]({},_0x207701,_0x4c4fc0[_0xcf0c('0x3f')]);return db[_0xcf0c('0x26')][_0xcf0c('0x40')](_0x207701)['then'](handleEntityNotFound(_0x511c97,null))[_0xcf0c('0x1f')](respondWithResult(_0x511c97,null))[_0xcf0c('0x3b')](handleError(_0x511c97,null));};exports[_0xcf0c('0x41')]=function(_0x2c3e67,_0xe6b16a){return db['FaxQueueReport']['create'](_0x2c3e67[_0xcf0c('0x42')],{})[_0xcf0c('0x1f')](respondWithResult(_0xe6b16a,0xc9))['catch'](handleError(_0xe6b16a,null));};exports[_0xcf0c('0x1e')]=function(_0x1f9728,_0x87e6d4){if(_0x1f9728[_0xcf0c('0x42')]['id']){delete _0x1f9728[_0xcf0c('0x42')]['id'];}return db[_0xcf0c('0x26')][_0xcf0c('0x40')]({'where':{'id':_0x1f9728[_0xcf0c('0x3d')]['id']}})[_0xcf0c('0x1f')](handleEntityNotFound(_0x87e6d4,null))[_0xcf0c('0x1f')](saveUpdates(_0x1f9728[_0xcf0c('0x42')],null))[_0xcf0c('0x1f')](respondWithResult(_0x87e6d4,null))[_0xcf0c('0x3b')](handleError(_0x87e6d4,null));};exports[_0xcf0c('0x43')]=function(_0x11558c,_0x10fc54){return db['FaxQueueReport'][_0xcf0c('0x40')]({'where':{'id':_0x11558c['params']['id']}})[_0xcf0c('0x1f')](handleEntityNotFound(_0x10fc54,null))[_0xcf0c('0x1f')](removeEntity(_0x10fc54,null))[_0xcf0c('0x3b')](handleError(_0x10fc54,null));};exports['describe']=function(_0x7337cd,_0x33c18f){return db[_0xcf0c('0x26')][_0xcf0c('0x44')]()[_0xcf0c('0x1f')](respondWithResult(_0x33c18f,null))[_0xcf0c('0x3b')](handleError(_0x33c18f,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index e3bf4e9..b3a8955 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0x4226c0,_0x45478b){var _0x381c64=function(_0x48e3e1){while(--_0x48e3e1){_0x4226c0['push'](_0x4226c0['shift']());}};_0x381c64(++_0x45478b);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4dcecc,_0x3865b9){_0x4dcecc=_0x4dcecc-0x0;var _0x2aa658=_0x7fbe[_0x4dcecc];return _0x2aa658;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','util'];(function(_0x146484,_0x27a7f0){var _0x4c7aa3=function(_0x481b98){while(--_0x481b98){_0x146484['push'](_0x146484['shift']());}};_0x4c7aa3(++_0x27a7f0);}(_0x814b,0x1a2));var _0xb814=function(_0x34a6e9,_0x25cabe){_0x34a6e9=_0x34a6e9-0x0;var _0x11015c=_0x814b[_0x34a6e9];return _0x11015c;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index c889e42..a32933e 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 _0x0a5f=['error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','options','raw','CreateFaxQueueReport','UpdateFaxQueueReport','update','body','where','attributes','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0a5f,0x1a1));var _0xf0a5=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0a5f[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xf0a5('0x0'));var util=require('util');var moment=require(_0xf0a5('0x1'));var BPromise=require(_0xf0a5('0x2'));var rs=require(_0xf0a5('0x3'));var fs=require('fs');var Redis=require(_0xf0a5('0x4'));var db=require(_0xf0a5('0x5'))['db'];var utils=require(_0xf0a5('0x6'));var logger=require(_0xf0a5('0x7'))('rpc');var config=require(_0xf0a5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf0a5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54d30e,_0x1a4d72,_0x3d6edf){return new BPromise(function(_0x31eaf0,_0x44d515){return client[_0xf0a5('0xa')](_0x54d30e,_0x3d6edf)[_0xf0a5('0xb')](function(_0x1383d6){logger[_0xf0a5('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x1a4d72,'request\x20sent');logger[_0xf0a5('0xd')](_0xf0a5('0xe'),_0x1a4d72,_0xf0a5('0xf'),JSON[_0xf0a5('0x10')](_0x1383d6));if(_0x1383d6[_0xf0a5('0x11')]){if(_0x1383d6[_0xf0a5('0x11')][_0xf0a5('0x12')]===0x1f4){logger[_0xf0a5('0x11')](_0xf0a5('0x13'),_0x1a4d72,_0x1383d6[_0xf0a5('0x11')][_0xf0a5('0x14')]);return _0x44d515(_0x1383d6[_0xf0a5('0x11')]['message']);}logger['error'](_0xf0a5('0x13'),_0x1a4d72,_0x1383d6['error']['message']);return _0x31eaf0(_0x1383d6[_0xf0a5('0x11')][_0xf0a5('0x14')]);}else{logger[_0xf0a5('0xc')](_0xf0a5('0x13'),_0x1a4d72,'request\x20sent');_0x31eaf0(_0x1383d6[_0xf0a5('0x15')][_0xf0a5('0x14')]);}})[_0xf0a5('0x16')](function(_0xa7c191){logger['error'](_0xf0a5('0x13'),_0x1a4d72,_0xa7c191);_0x44d515(_0xa7c191);});});}exports['CreateFaxQueueReport']=function(_0x4a1f4b){var _0x3f3c0d=this;return new Promise(function(_0x424613,_0x3bbb23){return db['FaxQueueReport']['create'](_0x4a1f4b['body'],{'raw':_0x4a1f4b[_0xf0a5('0x17')]?_0x4a1f4b[_0xf0a5('0x17')][_0xf0a5('0x18')]===undefined?!![]:![]:!![]})[_0xf0a5('0xb')](function(_0x4edb8f){logger[_0xf0a5('0xc')](_0xf0a5('0x19'),_0x4a1f4b);logger['debug'](_0xf0a5('0x19'),_0x4a1f4b,JSON[_0xf0a5('0x10')](_0x4edb8f));_0x424613(_0x4edb8f);})[_0xf0a5('0x16')](function(_0x150ecc){logger[_0xf0a5('0x11')](_0xf0a5('0x19'),_0x150ecc[_0xf0a5('0x14')],_0x4a1f4b);_0x3bbb23(_0x3f3c0d[_0xf0a5('0x11')](0x1f4,_0x150ecc[_0xf0a5('0x14')]));});});};exports[_0xf0a5('0x1a')]=function(_0x28955e){var _0x1a13c6=this;return new Promise(function(_0x282a08,_0x5eaf53){return db['FaxQueueReport'][_0xf0a5('0x1b')](_0x28955e[_0xf0a5('0x1c')],{'raw':_0x28955e[_0xf0a5('0x17')]?_0x28955e[_0xf0a5('0x17')][_0xf0a5('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28955e[_0xf0a5('0x17')]?_0x28955e['options'][_0xf0a5('0x1d')]||null:null,'attributes':_0x28955e[_0xf0a5('0x17')]?_0x28955e['options'][_0xf0a5('0x1e')]||null:null,'limit':_0x28955e[_0xf0a5('0x17')]?_0x28955e['options']['limit']||null:null})[_0xf0a5('0xb')](function(_0x13795a){logger[_0xf0a5('0xc')](_0xf0a5('0x1a'),_0x28955e);logger[_0xf0a5('0xd')](_0xf0a5('0x1a'),_0x28955e,JSON[_0xf0a5('0x10')](_0x13795a));_0x282a08(_0x13795a);})[_0xf0a5('0x16')](function(_0x5c9965){logger[_0xf0a5('0x11')]('UpdateFaxQueueReport',_0x5c9965[_0xf0a5('0x14')],_0x28955e);_0x5eaf53(_0x1a13c6[_0xf0a5('0x11')](0x1f4,_0x5c9965[_0xf0a5('0x14')]));});});}; \ No newline at end of file +var _0xfd53=['catch','CreateFaxQueueReport','create','body','options','raw','debug','UpdateFaxQueueReport','FaxQueueReport','update','where','limit','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info'];(function(_0xfeb6b5,_0x599471){var _0x33f31b=function(_0x38ade5){while(--_0x38ade5){_0xfeb6b5['push'](_0xfeb6b5['shift']());}};_0x33f31b(++_0x599471);}(_0xfd53,0x135));var _0x3fd5=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xfd53[_0xe73080];return _0x12cbc4;};'use strict';var _=require(_0x3fd5('0x0'));var util=require(_0x3fd5('0x1'));var moment=require(_0x3fd5('0x2'));var BPromise=require(_0x3fd5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3fd5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3fd5('0x5'));var logger=require(_0x3fd5('0x6'))(_0x3fd5('0x7'));var config=require(_0x3fd5('0x8'));var jayson=require(_0x3fd5('0x9'));var client=jayson['client'][_0x3fd5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3eb780,_0x43b346,_0x2f4898){return new BPromise(function(_0x17dc0e,_0x168c22){return client[_0x3fd5('0xb')](_0x3eb780,_0x2f4898)[_0x3fd5('0xc')](function(_0x462633){logger['info'](_0x3fd5('0xd'),_0x43b346,_0x3fd5('0xe'));logger['debug'](_0x3fd5('0xf'),_0x43b346,_0x3fd5('0xe'),JSON[_0x3fd5('0x10')](_0x462633));if(_0x462633['error']){if(_0x462633['error'][_0x3fd5('0x11')]===0x1f4){logger['error'](_0x3fd5('0xd'),_0x43b346,_0x462633[_0x3fd5('0x12')][_0x3fd5('0x13')]);return _0x168c22(_0x462633[_0x3fd5('0x12')]['message']);}logger['error'](_0x3fd5('0xd'),_0x43b346,_0x462633[_0x3fd5('0x12')][_0x3fd5('0x13')]);return _0x17dc0e(_0x462633[_0x3fd5('0x12')]['message']);}else{logger[_0x3fd5('0x14')](_0x3fd5('0xd'),_0x43b346,'request\x20sent');_0x17dc0e(_0x462633['result'][_0x3fd5('0x13')]);}})[_0x3fd5('0x15')](function(_0x394d7c){logger[_0x3fd5('0x12')](_0x3fd5('0xd'),_0x43b346,_0x394d7c);_0x168c22(_0x394d7c);});});}exports[_0x3fd5('0x16')]=function(_0x2282fc){var _0x51e857=this;return new Promise(function(_0x4824a4,_0x5789ff){return db['FaxQueueReport'][_0x3fd5('0x17')](_0x2282fc[_0x3fd5('0x18')],{'raw':_0x2282fc['options']?_0x2282fc[_0x3fd5('0x19')][_0x3fd5('0x1a')]===undefined?!![]:![]:!![]})[_0x3fd5('0xc')](function(_0x236e1a){logger[_0x3fd5('0x14')](_0x3fd5('0x16'),_0x2282fc);logger[_0x3fd5('0x1b')](_0x3fd5('0x16'),_0x2282fc,JSON[_0x3fd5('0x10')](_0x236e1a));_0x4824a4(_0x236e1a);})[_0x3fd5('0x15')](function(_0x2092f6){logger['error'](_0x3fd5('0x16'),_0x2092f6[_0x3fd5('0x13')],_0x2282fc);_0x5789ff(_0x51e857[_0x3fd5('0x12')](0x1f4,_0x2092f6[_0x3fd5('0x13')]));});});};exports[_0x3fd5('0x1c')]=function(_0x7873ad){var _0x5b7dad=this;return new Promise(function(_0x42e486,_0x3542db){return db[_0x3fd5('0x1d')][_0x3fd5('0x1e')](_0x7873ad['body'],{'raw':_0x7873ad[_0x3fd5('0x19')]?_0x7873ad['options'][_0x3fd5('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7873ad[_0x3fd5('0x19')]?_0x7873ad[_0x3fd5('0x19')][_0x3fd5('0x1f')]||null:null,'attributes':_0x7873ad[_0x3fd5('0x19')]?_0x7873ad[_0x3fd5('0x19')]['attributes']||null:null,'limit':_0x7873ad[_0x3fd5('0x19')]?_0x7873ad['options'][_0x3fd5('0x20')]||null:null})[_0x3fd5('0xc')](function(_0x2bc2ec){logger[_0x3fd5('0x14')](_0x3fd5('0x1c'),_0x7873ad);logger['debug'](_0x3fd5('0x1c'),_0x7873ad,JSON[_0x3fd5('0x10')](_0x2bc2ec));_0x42e486(_0x2bc2ec);})[_0x3fd5('0x15')](function(_0x3dca30){logger[_0x3fd5('0x12')]('UpdateFaxQueueReport',_0x3dca30[_0x3fd5('0x13')],_0x7873ad);_0x3542db(_0x5b7dad[_0x3fd5('0x12')](0x1f4,_0x3dca30[_0x3fd5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 7115b41..33e8eed 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 _0xfeb6=['update','delete','exports','multer','util','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x449286,_0x38c70e){var _0x1f19c2=function(_0x1f17c6){while(--_0x1f17c6){_0x449286['push'](_0x449286['shift']());}};_0x1f19c2(++_0x38c70e);}(_0xfeb6,0x161));var _0x6feb=function(_0x5cd160,_0x20253b){_0x5cd160=_0x5cd160-0x0;var _0xecd807=_0xfeb6[_0x5cd160];return _0xecd807;};'use strict';var multer=require(_0x6feb('0x0'));var util=require(_0x6feb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6feb('0x2'));var config=require(_0x6feb('0x3'));var controller=require(_0x6feb('0x4'));router[_0x6feb('0x5')]('/',auth[_0x6feb('0x6')](),controller['index']);router[_0x6feb('0x5')](_0x6feb('0x7'),auth[_0x6feb('0x6')](),controller['describe']);router[_0x6feb('0x5')](_0x6feb('0x8'),auth[_0x6feb('0x6')](),controller['show']);router[_0x6feb('0x9')]('/',auth['isAuthenticated'](),controller[_0x6feb('0xa')]);router['put'](_0x6feb('0x8'),auth['isAuthenticated'](),controller[_0x6feb('0xb')]);router[_0x6feb('0xc')]('/:id',auth[_0x6feb('0x6')](),controller['destroy']);module[_0x6feb('0xd')]=router; \ No newline at end of file +var _0xd071=['/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get'];(function(_0x3d69aa,_0x413fd6){var _0x342611=function(_0x673938){while(--_0x673938){_0x3d69aa['push'](_0x3d69aa['shift']());}};_0x342611(++_0x413fd6);}(_0xd071,0xbc));var _0x1d07=function(_0x3cc28f,_0x1002dc){_0x3cc28f=_0x3cc28f-0x0;var _0x1a6402=_0xd071[_0x3cc28f];return _0x1a6402;};'use strict';var multer=require(_0x1d07('0x0'));var util=require(_0x1d07('0x1'));var path=require(_0x1d07('0x2'));var timeout=require(_0x1d07('0x3'));var express=require(_0x1d07('0x4'));var router=express[_0x1d07('0x5')]();var fs_extra=require(_0x1d07('0x6'));var auth=require(_0x1d07('0x7'));var interaction=require(_0x1d07('0x8'));var config=require(_0x1d07('0x9'));var controller=require('./faxQueueReport.controller');router['get']('/',auth[_0x1d07('0xa')](),controller['index']);router[_0x1d07('0xb')]('/describe',auth[_0x1d07('0xa')](),controller['describe']);router[_0x1d07('0xb')](_0x1d07('0xc'),auth[_0x1d07('0xa')](),controller[_0x1d07('0xd')]);router[_0x1d07('0xe')]('/',auth[_0x1d07('0xa')](),controller[_0x1d07('0xf')]);router[_0x1d07('0x10')](_0x1d07('0xc'),auth[_0x1d07('0xa')](),controller[_0x1d07('0x11')]);router['delete'](_0x1d07('0xc'),auth[_0x1d07('0xa')](),controller[_0x1d07('0x12')]);module[_0x1d07('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 30fd3f3..ddd73a9 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x2a5517,_0x250516){var _0x2a40b4=function(_0x3a35b4){while(--_0x3a35b4){_0x2a5517['push'](_0x2a5517['shift']());}};_0x2a40b4(++_0x250516);}(_0xaa88,0x137));var _0x8aa8=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0xaa88[_0x369151];return _0x4292d5;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x5081a8,_0x4dcfc3){var _0xc6b1a7=function(_0x39a825){while(--_0x39a825){_0x5081a8['push'](_0x5081a8['shift']());}};_0xc6b1a7(++_0x4dcfc3);}(_0xaa88,0x137));var _0x8aa8=function(_0x37ae26,_0x2ecd70){_0x37ae26=_0x37ae26-0x0;var _0x1b1902=_0xaa88[_0x37ae26];return _0x1b1902;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 7ff00c9..d8f495c 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 _0x139b=['body','describe','eml-format','fast-json-patch','moment','bluebird','mustache','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/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','then','includeAll','include','findAll','rows','catch','show','params','intersection','find','create'];(function(_0x240ad5,_0x5e125b){var _0x9cc8f5=function(_0x1e376e){while(--_0x1e376e){_0x240ad5['push'](_0x240ad5['shift']());}};_0x9cc8f5(++_0x5e125b);}(_0x139b,0x12e));var _0xb139=function(_0x1c4545,_0x9bad83){_0x1c4545=_0x1c4545-0x0;var _0x1e13c0=_0x139b[_0x1c4545];return _0x1e13c0;};'use strict';var emlformat=require(_0xb139('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb139('0x1'));var rp=require('request-promise');var moment=require(_0xb139('0x2'));var BPromise=require(_0xb139('0x3'));var Mustache=require(_0xb139('0x4'));var util=require('util');var path=require(_0xb139('0x5'));var sox=require(_0xb139('0x6'));var csv=require(_0xb139('0x7'));var ejs=require(_0xb139('0x8'));var fs=require('fs');var fs_extra=require(_0xb139('0x9'));var _=require(_0xb139('0xa'));var squel=require(_0xb139('0xb'));var crypto=require(_0xb139('0xc'));var jsforce=require(_0xb139('0xd'));var deskjs=require(_0xb139('0xe'));var toCsv=require(_0xb139('0x7'));var querystring=require(_0xb139('0xf'));var Papa=require(_0xb139('0x10'));var Redis=require('ioredis');var authService=require(_0xb139('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb139('0x12'));var hardwareService=require(_0xb139('0x13'));var logger=require(_0xb139('0x14'))(_0xb139('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb139('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x235308,_0x46e035){_0x46e035=_0x46e035||0xcc;return function(_0x455cef){if(_0x455cef){return _0x235308[_0xb139('0x17')](_0x46e035);}return _0x235308[_0xb139('0x18')](_0x46e035)[_0xb139('0x19')]();};}function respondWithResult(_0x19e0da,_0x1d0929){_0x1d0929=_0x1d0929||0xc8;return function(_0x23817a){if(_0x23817a){return _0x19e0da[_0xb139('0x18')](_0x1d0929)['json'](_0x23817a);}};}function respondWithFilteredResult(_0x3e06fd,_0x40d98){return function(_0x72c1f8){if(_0x72c1f8){var _0x501019=typeof _0x40d98[_0xb139('0x1a')]===_0xb139('0x1b')&&typeof _0x40d98['limit']===_0xb139('0x1b');var _0x38c9b6=_0x72c1f8['count'];var _0x1b007b=_0x501019?0x0:_0x40d98[_0xb139('0x1a')];var _0x56ef2b=_0x501019?_0x72c1f8[_0xb139('0x1c')]:_0x40d98[_0xb139('0x1a')]+_0x40d98[_0xb139('0x1d')];var _0x447f03;if(_0x56ef2b>=_0x38c9b6){_0x56ef2b=_0x38c9b6;_0x447f03=0xc8;}else{_0x447f03=0xce;}_0x3e06fd[_0xb139('0x18')](_0x447f03);return _0x3e06fd[_0xb139('0x1e')](_0xb139('0x1f'),_0x1b007b+'-'+_0x56ef2b+'/'+_0x38c9b6)['json'](_0x72c1f8);}return null;};}function patchUpdates(_0x3461c9){return function(_0x1c62b8){try{jsonpatch['apply'](_0x1c62b8,_0x3461c9,!![]);}catch(_0x575197){return BPromise[_0xb139('0x20')](_0x575197);}return _0x1c62b8[_0xb139('0x21')]();};}function saveUpdates(_0x2233bf,_0x32cab7){return function(_0x141233){if(_0x141233){return _0x141233[_0xb139('0x22')](_0x2233bf)['then'](function(_0x4597a1){return _0x4597a1;});}return null;};}function removeEntity(_0x40ca43,_0xcdcee7){return function(_0x475dc3){if(_0x475dc3){return _0x475dc3[_0xb139('0x23')]()['then'](function(){_0x40ca43[_0xb139('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35b985,_0x5eb233){return function(_0x308d80){if(!_0x308d80){_0x35b985[_0xb139('0x17')](0x194);}return _0x308d80;};}function handleError(_0x2a3335,_0x4cc077){_0x4cc077=_0x4cc077||0x1f4;return function(_0x12291c){logger[_0xb139('0x24')](_0x12291c[_0xb139('0x25')]);if(_0x12291c[_0xb139('0x26')]){delete _0x12291c[_0xb139('0x26')];}_0x2a3335[_0xb139('0x18')](_0x4cc077)[_0xb139('0x27')](_0x12291c);};}exports[_0xb139('0x28')]=function(_0x32fe3a,_0x164a97){var _0x4a24ae={},_0x13cf9b={},_0xdd5ae6={'count':0x0,'rows':[]};var _0x49956e=_[_0xb139('0x29')](db[_0xb139('0x2a')][_0xb139('0x2b')],function(_0x487c19){return{'name':_0x487c19[_0xb139('0x2c')],'type':_0x487c19[_0xb139('0x2d')][_0xb139('0x2e')]};});_0x13cf9b[_0xb139('0x2f')]=_['map'](_0x49956e,_0xb139('0x26'));_0x13cf9b[_0xb139('0x30')]=_[_0xb139('0x31')](_0x32fe3a[_0xb139('0x30')]);_0x13cf9b[_0xb139('0x32')]=_['intersection'](_0x13cf9b[_0xb139('0x2f')],_0x13cf9b['query']);_0x4a24ae['attributes']=_['intersection'](_0x13cf9b['model'],qs['fields'](_0x32fe3a[_0xb139('0x30')][_0xb139('0x33')]));_0x4a24ae[_0xb139('0x34')]=_0x4a24ae[_0xb139('0x34')][_0xb139('0x35')]?_0x4a24ae[_0xb139('0x34')]:_0x13cf9b['model'];if(!_0x32fe3a[_0xb139('0x30')][_0xb139('0x36')](_0xb139('0x37'))){_0x4a24ae[_0xb139('0x1d')]=qs['limit'](_0x32fe3a[_0xb139('0x30')][_0xb139('0x1d')]);_0x4a24ae['offset']=qs[_0xb139('0x1a')](_0x32fe3a[_0xb139('0x30')][_0xb139('0x1a')]);}_0x4a24ae['order']=qs[_0xb139('0x38')](_0x32fe3a[_0xb139('0x30')][_0xb139('0x38')]);_0x4a24ae['where']=qs[_0xb139('0x32')](_[_0xb139('0x39')](_0x32fe3a[_0xb139('0x30')],_0x13cf9b[_0xb139('0x32')]),_0x49956e);if(_0x32fe3a[_0xb139('0x30')][_0xb139('0x3a')]){_0x4a24ae[_0xb139('0x3b')]=_[_0xb139('0x3c')](_0x4a24ae[_0xb139('0x3b')],{'$or':_['map'](_0x49956e,function(_0x2db5da){if(_0x2db5da[_0xb139('0x2d')]!=='VIRTUAL'){var _0x469727={};_0x469727[_0x2db5da['name']]={'$like':'%'+_0x32fe3a['query'][_0xb139('0x3a')]+'%'};return _0x469727;}})});}_0x4a24ae=_[_0xb139('0x3c')]({},_0x4a24ae,_0x32fe3a[_0xb139('0x3d')]);var _0x231f2f={'where':_0x4a24ae[_0xb139('0x3b')]};return db[_0xb139('0x2a')][_0xb139('0x1c')](_0x231f2f)[_0xb139('0x3e')](function(_0x2d7286){_0xdd5ae6[_0xb139('0x1c')]=_0x2d7286;if(_0x32fe3a['query'][_0xb139('0x3f')]){_0x4a24ae[_0xb139('0x40')]=[{'all':!![]}];}return db[_0xb139('0x2a')][_0xb139('0x41')](_0x4a24ae);})[_0xb139('0x3e')](function(_0x447769){_0xdd5ae6[_0xb139('0x42')]=_0x447769;return _0xdd5ae6;})[_0xb139('0x3e')](respondWithFilteredResult(_0x164a97,_0x4a24ae))[_0xb139('0x43')](handleError(_0x164a97,null));};exports[_0xb139('0x44')]=function(_0x500252,_0x3e094e){var _0x4c56e4={'raw':!![],'where':{'id':_0x500252[_0xb139('0x45')]['id']}},_0x1b9f03={};_0x1b9f03[_0xb139('0x2f')]=_[_0xb139('0x31')](db[_0xb139('0x2a')][_0xb139('0x2b')]);_0x1b9f03[_0xb139('0x30')]=_[_0xb139('0x31')](_0x500252[_0xb139('0x30')]);_0x1b9f03[_0xb139('0x32')]=_[_0xb139('0x46')](_0x1b9f03[_0xb139('0x2f')],_0x1b9f03[_0xb139('0x30')]);_0x4c56e4[_0xb139('0x34')]=_[_0xb139('0x46')](_0x1b9f03[_0xb139('0x2f')],qs['fields'](_0x500252['query'][_0xb139('0x33')]));_0x4c56e4['attributes']=_0x4c56e4['attributes']['length']?_0x4c56e4[_0xb139('0x34')]:_0x1b9f03[_0xb139('0x2f')];if(_0x500252[_0xb139('0x30')][_0xb139('0x3f')]){_0x4c56e4[_0xb139('0x40')]=[{'all':!![]}];}_0x4c56e4=_[_0xb139('0x3c')]({},_0x4c56e4,_0x500252[_0xb139('0x3d')]);return db[_0xb139('0x2a')][_0xb139('0x47')](_0x4c56e4)[_0xb139('0x3e')](handleEntityNotFound(_0x3e094e,null))['then'](respondWithResult(_0x3e094e,null))[_0xb139('0x43')](handleError(_0x3e094e,null));};exports[_0xb139('0x48')]=function(_0x1797c3,_0x1a727f){return db[_0xb139('0x2a')][_0xb139('0x48')](_0x1797c3[_0xb139('0x49')],{})[_0xb139('0x3e')](respondWithResult(_0x1a727f,0xc9))[_0xb139('0x43')](handleError(_0x1a727f,null));};exports[_0xb139('0x22')]=function(_0x4955d3,_0x48014f){if(_0x4955d3['body']['id']){delete _0x4955d3[_0xb139('0x49')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x4955d3[_0xb139('0x45')]['id']}})[_0xb139('0x3e')](handleEntityNotFound(_0x48014f,null))[_0xb139('0x3e')](saveUpdates(_0x4955d3[_0xb139('0x49')],null))[_0xb139('0x3e')](respondWithResult(_0x48014f,null))[_0xb139('0x43')](handleError(_0x48014f,null));};exports[_0xb139('0x23')]=function(_0x1115e3,_0x419c7c){return db[_0xb139('0x2a')][_0xb139('0x47')]({'where':{'id':_0x1115e3[_0xb139('0x45')]['id']}})[_0xb139('0x3e')](handleEntityNotFound(_0x419c7c,null))[_0xb139('0x3e')](removeEntity(_0x419c7c,null))[_0xb139('0x43')](handleError(_0x419c7c,null));};exports['describe']=function(_0x245b87,_0x378bb3){return db['FaxTransferReport'][_0xb139('0x4a')]()[_0xb139('0x3e')](respondWithResult(_0x378bb3,null))[_0xb139('0x43')](handleError(_0x378bb3,null));}; \ No newline at end of file +var _0xb718=['hasOwnProperty','nolimit','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','find','destroy','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','error','stack','name','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length'];(function(_0x53af39,_0x33cc36){var _0xd2faa5=function(_0x3e9baf){while(--_0x3e9baf){_0x53af39['push'](_0x53af39['shift']());}};_0xd2faa5(++_0x33cc36);}(_0xb718,0x181));var _0x8b71=function(_0x202ae6,_0x424ff7){_0x202ae6=_0x202ae6-0x0;var _0x121b35=_0xb718[_0x202ae6];return _0x121b35;};'use strict';var emlformat=require(_0x8b71('0x0'));var rimraf=require(_0x8b71('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8b71('0x2'));var rp=require('request-promise');var moment=require(_0x8b71('0x3'));var BPromise=require(_0x8b71('0x4'));var Mustache=require(_0x8b71('0x5'));var util=require('util');var path=require('path');var sox=require(_0x8b71('0x6'));var csv=require(_0x8b71('0x7'));var ejs=require(_0x8b71('0x8'));var fs=require('fs');var fs_extra=require(_0x8b71('0x9'));var _=require(_0x8b71('0xa'));var squel=require(_0x8b71('0xb'));var crypto=require('crypto');var jsforce=require(_0x8b71('0xc'));var deskjs=require(_0x8b71('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8b71('0xe'));var authService=require(_0x8b71('0xf'));var qs=require(_0x8b71('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8b71('0x11'));var logger=require(_0x8b71('0x12'))(_0x8b71('0x13'));var utils=require(_0x8b71('0x14'));var config=require(_0x8b71('0x15'));var licenseUtil=require(_0x8b71('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x445a10,_0x36d362){_0x36d362=_0x36d362||0xcc;return function(_0x238a0e){if(_0x238a0e){return _0x445a10[_0x8b71('0x17')](_0x36d362);}return _0x445a10[_0x8b71('0x18')](_0x36d362)[_0x8b71('0x19')]();};}function respondWithResult(_0x5b4526,_0x46a742){_0x46a742=_0x46a742||0xc8;return function(_0x39aaaa){if(_0x39aaaa){return _0x5b4526[_0x8b71('0x18')](_0x46a742)[_0x8b71('0x1a')](_0x39aaaa);}};}function respondWithFilteredResult(_0x1352ed,_0x20b730){return function(_0x292233){if(_0x292233){var _0x31b212=typeof _0x20b730[_0x8b71('0x1b')]===_0x8b71('0x1c')&&typeof _0x20b730[_0x8b71('0x1d')]===_0x8b71('0x1c');var _0xe8139f=_0x292233[_0x8b71('0x1e')];var _0xf0a0a5=_0x31b212?0x0:_0x20b730[_0x8b71('0x1b')];var _0x232b1b=_0x31b212?_0x292233['count']:_0x20b730['offset']+_0x20b730[_0x8b71('0x1d')];var _0x274b4b;if(_0x232b1b>=_0xe8139f){_0x232b1b=_0xe8139f;_0x274b4b=0xc8;}else{_0x274b4b=0xce;}_0x1352ed[_0x8b71('0x18')](_0x274b4b);return _0x1352ed['set'](_0x8b71('0x1f'),_0xf0a0a5+'-'+_0x232b1b+'/'+_0xe8139f)['json'](_0x292233);}return null;};}function patchUpdates(_0x3c1c2e){return function(_0x5772c4){try{jsonpatch[_0x8b71('0x20')](_0x5772c4,_0x3c1c2e,!![]);}catch(_0x2b5ef7){return BPromise['reject'](_0x2b5ef7);}return _0x5772c4['save']();};}function saveUpdates(_0x7fcc65,_0x13295d){return function(_0x3c93a3){if(_0x3c93a3){return _0x3c93a3[_0x8b71('0x21')](_0x7fcc65)[_0x8b71('0x22')](function(_0x36c713){return _0x36c713;});}return null;};}function removeEntity(_0x4cb0ce,_0x2f436e){return function(_0x597418){if(_0x597418){return _0x597418['destroy']()['then'](function(){_0x4cb0ce[_0x8b71('0x18')](0xcc)[_0x8b71('0x19')]();});}};}function handleEntityNotFound(_0x349183,_0x2c5323){return function(_0x3b50ca){if(!_0x3b50ca){_0x349183[_0x8b71('0x17')](0x194);}return _0x3b50ca;};}function handleError(_0x2e3053,_0x410cb6){_0x410cb6=_0x410cb6||0x1f4;return function(_0x850717){logger[_0x8b71('0x23')](_0x850717[_0x8b71('0x24')]);if(_0x850717[_0x8b71('0x25')]){delete _0x850717[_0x8b71('0x25')];}_0x2e3053[_0x8b71('0x18')](_0x410cb6)['send'](_0x850717);};}exports[_0x8b71('0x26')]=function(_0x20825b,_0x430c20){var _0x335a7c={},_0x4d591d={},_0x2f9fac={'count':0x0,'rows':[]};var _0x435035=_[_0x8b71('0x27')](db[_0x8b71('0x28')][_0x8b71('0x29')],function(_0x5dd4f0){return{'name':_0x5dd4f0[_0x8b71('0x2a')],'type':_0x5dd4f0[_0x8b71('0x2b')][_0x8b71('0x2c')]};});_0x4d591d['model']=_['map'](_0x435035,_0x8b71('0x25'));_0x4d591d[_0x8b71('0x2d')]=_[_0x8b71('0x2e')](_0x20825b[_0x8b71('0x2d')]);_0x4d591d[_0x8b71('0x2f')]=_[_0x8b71('0x30')](_0x4d591d[_0x8b71('0x31')],_0x4d591d[_0x8b71('0x2d')]);_0x335a7c['attributes']=_[_0x8b71('0x30')](_0x4d591d['model'],qs[_0x8b71('0x32')](_0x20825b[_0x8b71('0x2d')][_0x8b71('0x32')]));_0x335a7c[_0x8b71('0x33')]=_0x335a7c[_0x8b71('0x33')][_0x8b71('0x34')]?_0x335a7c[_0x8b71('0x33')]:_0x4d591d[_0x8b71('0x31')];if(!_0x20825b[_0x8b71('0x2d')][_0x8b71('0x35')](_0x8b71('0x36'))){_0x335a7c[_0x8b71('0x1d')]=qs[_0x8b71('0x1d')](_0x20825b['query'][_0x8b71('0x1d')]);_0x335a7c['offset']=qs[_0x8b71('0x1b')](_0x20825b['query'][_0x8b71('0x1b')]);}_0x335a7c['order']=qs['sort'](_0x20825b[_0x8b71('0x2d')]['sort']);_0x335a7c['where']=qs['filters'](_[_0x8b71('0x37')](_0x20825b['query'],_0x4d591d['filters']),_0x435035);if(_0x20825b[_0x8b71('0x2d')][_0x8b71('0x38')]){_0x335a7c[_0x8b71('0x39')]=_[_0x8b71('0x3a')](_0x335a7c[_0x8b71('0x39')],{'$or':_[_0x8b71('0x27')](_0x435035,function(_0x650ec4){if(_0x650ec4[_0x8b71('0x2b')]!==_0x8b71('0x3b')){var _0x4e715c={};_0x4e715c[_0x650ec4[_0x8b71('0x25')]]={'$like':'%'+_0x20825b[_0x8b71('0x2d')][_0x8b71('0x38')]+'%'};return _0x4e715c;}})});}_0x335a7c=_[_0x8b71('0x3a')]({},_0x335a7c,_0x20825b[_0x8b71('0x3c')]);var _0x5cd9a8={'where':_0x335a7c[_0x8b71('0x39')]};return db['FaxTransferReport'][_0x8b71('0x1e')](_0x5cd9a8)[_0x8b71('0x22')](function(_0x2d3e43){_0x2f9fac[_0x8b71('0x1e')]=_0x2d3e43;if(_0x20825b[_0x8b71('0x2d')]['includeAll']){_0x335a7c[_0x8b71('0x3d')]=[{'all':!![]}];}return db[_0x8b71('0x28')][_0x8b71('0x3e')](_0x335a7c);})['then'](function(_0xdb86ba){_0x2f9fac[_0x8b71('0x3f')]=_0xdb86ba;return _0x2f9fac;})['then'](respondWithFilteredResult(_0x430c20,_0x335a7c))[_0x8b71('0x40')](handleError(_0x430c20,null));};exports[_0x8b71('0x41')]=function(_0x17f662,_0x2ab5){var _0x19062f={'raw':!![],'where':{'id':_0x17f662[_0x8b71('0x42')]['id']}},_0xe4ddf3={};_0xe4ddf3[_0x8b71('0x31')]=_[_0x8b71('0x2e')](db[_0x8b71('0x28')][_0x8b71('0x29')]);_0xe4ddf3[_0x8b71('0x2d')]=_['keys'](_0x17f662[_0x8b71('0x2d')]);_0xe4ddf3[_0x8b71('0x2f')]=_[_0x8b71('0x30')](_0xe4ddf3[_0x8b71('0x31')],_0xe4ddf3[_0x8b71('0x2d')]);_0x19062f['attributes']=_[_0x8b71('0x30')](_0xe4ddf3['model'],qs['fields'](_0x17f662[_0x8b71('0x2d')][_0x8b71('0x32')]));_0x19062f[_0x8b71('0x33')]=_0x19062f[_0x8b71('0x33')][_0x8b71('0x34')]?_0x19062f['attributes']:_0xe4ddf3[_0x8b71('0x31')];if(_0x17f662[_0x8b71('0x2d')][_0x8b71('0x43')]){_0x19062f[_0x8b71('0x3d')]=[{'all':!![]}];}_0x19062f=_[_0x8b71('0x3a')]({},_0x19062f,_0x17f662[_0x8b71('0x3c')]);return db[_0x8b71('0x28')]['find'](_0x19062f)['then'](handleEntityNotFound(_0x2ab5,null))[_0x8b71('0x22')](respondWithResult(_0x2ab5,null))[_0x8b71('0x40')](handleError(_0x2ab5,null));};exports[_0x8b71('0x44')]=function(_0x5eb779,_0x235dc5){return db[_0x8b71('0x28')]['create'](_0x5eb779[_0x8b71('0x45')],{})[_0x8b71('0x22')](respondWithResult(_0x235dc5,0xc9))[_0x8b71('0x40')](handleError(_0x235dc5,null));};exports['update']=function(_0x270e16,_0xef9ed7){if(_0x270e16[_0x8b71('0x45')]['id']){delete _0x270e16[_0x8b71('0x45')]['id'];}return db[_0x8b71('0x28')][_0x8b71('0x46')]({'where':{'id':_0x270e16['params']['id']}})[_0x8b71('0x22')](handleEntityNotFound(_0xef9ed7,null))[_0x8b71('0x22')](saveUpdates(_0x270e16[_0x8b71('0x45')],null))[_0x8b71('0x22')](respondWithResult(_0xef9ed7,null))['catch'](handleError(_0xef9ed7,null));};exports[_0x8b71('0x47')]=function(_0x15f0a3,_0x3b5746){return db[_0x8b71('0x28')][_0x8b71('0x46')]({'where':{'id':_0x15f0a3[_0x8b71('0x42')]['id']}})[_0x8b71('0x22')](handleEntityNotFound(_0x3b5746,null))['then'](removeEntity(_0x3b5746,null))[_0x8b71('0x40')](handleError(_0x3b5746,null));};exports['describe']=function(_0x2683b1,_0x457317){return db[_0x8b71('0x28')][_0x8b71('0x48')]()['then'](respondWithResult(_0x457317,null))['catch'](handleError(_0x457317,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 4816bca..d2a43c0 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 _0x6426=['moment','request-promise','path','../../config/environment','./faxTransferReport.attributes','exports','define','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x49fc48,_0x1c9e46){var _0xc50548=function(_0x479530){while(--_0x479530){_0x49fc48['push'](_0x49fc48['shift']());}};_0xc50548(++_0x1c9e46);}(_0x6426,0x15b));var _0x6642=function(_0x9e646,_0x474a87){_0x9e646=_0x9e646-0x0;var _0x44264e=_0x6426[_0x9e646];return _0x44264e;};'use strict';var _=require(_0x6642('0x0'));var util=require(_0x6642('0x1'));var logger=require(_0x6642('0x2'))(_0x6642('0x3'));var moment=require(_0x6642('0x4'));var BPromise=require('bluebird');var rp=require(_0x6642('0x5'));var fs=require('fs');var path=require(_0x6642('0x6'));var rimraf=require('rimraf');var config=require(_0x6642('0x7'));var attributes=require(_0x6642('0x8'));module[_0x6642('0x9')]=function(_0x217323,_0x40eddc){return _0x217323[_0x6642('0xa')]('FaxTransferReport',attributes,{'tableName':_0x6642('0xb'),'paranoid':![],'indexes':[{'name':_0x6642('0xc'),'fields':[_0x6642('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6df9=['request-promise','rimraf','./faxTransferReport.attributes','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','api'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x6df9,0x84));var _0x96df=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x6df9[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x96df('0x0'));var util=require(_0x96df('0x1'));var logger=require('../../config/logger')(_0x96df('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x96df('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x96df('0x4'));var config=require('../../config/environment');var attributes=require(_0x96df('0x5'));module['exports']=function(_0x23e387,_0x3951b3){return _0x23e387['define'](_0x96df('0x6'),attributes,{'tableName':_0x96df('0x7'),'paranoid':![],'indexes':[{'name':_0x96df('0x8'),'fields':[_0x96df('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 2fc1e52..ffdc74e 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 _0x1450=['FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info'];(function(_0x257495,_0x18269b){var _0x3849aa=function(_0x1ca94e){while(--_0x1ca94e){_0x257495['push'](_0x257495['shift']());}};_0x3849aa(++_0x18269b);}(_0x1450,0xda));var _0x0145=function(_0xa01473,_0xf2386e){_0xa01473=_0xa01473-0x0;var _0x1c0870=_0x1450[_0xa01473];return _0x1c0870;};'use strict';var _=require(_0x0145('0x0'));var util=require(_0x0145('0x1'));var moment=require(_0x0145('0x2'));var BPromise=require(_0x0145('0x3'));var rs=require(_0x0145('0x4'));var fs=require('fs');var Redis=require(_0x0145('0x5'));var db=require(_0x0145('0x6'))['db'];var utils=require(_0x0145('0x7'));var logger=require(_0x0145('0x8'))(_0x0145('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0145('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x564586,_0x4942d5,_0x5f1576){return new BPromise(function(_0x1744b8,_0x2168ba){return client[_0x0145('0xb')](_0x564586,_0x5f1576)['then'](function(_0x27774b){logger[_0x0145('0xc')](_0x0145('0xd'),_0x4942d5,_0x0145('0xe'));logger['debug'](_0x0145('0xf'),_0x4942d5,'request\x20sent',JSON['stringify'](_0x27774b));if(_0x27774b[_0x0145('0x10')]){if(_0x27774b[_0x0145('0x10')][_0x0145('0x11')]===0x1f4){logger['error'](_0x0145('0xd'),_0x4942d5,_0x27774b['error'][_0x0145('0x12')]);return _0x2168ba(_0x27774b[_0x0145('0x10')][_0x0145('0x12')]);}logger[_0x0145('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x4942d5,_0x27774b['error'][_0x0145('0x12')]);return _0x1744b8(_0x27774b['error']['message']);}else{logger['info'](_0x0145('0xd'),_0x4942d5,_0x0145('0xe'));_0x1744b8(_0x27774b[_0x0145('0x13')]['message']);}})[_0x0145('0x14')](function(_0x437441){logger[_0x0145('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x4942d5,_0x437441);_0x2168ba(_0x437441);});});} \ No newline at end of file +var _0x6de2=['then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x4ab63f,_0x22b64a){var _0x58b38a=function(_0x4049dd){while(--_0x4049dd){_0x4ab63f['push'](_0x4ab63f['shift']());}};_0x58b38a(++_0x22b64a);}(_0x6de2,0x72));var _0x26de=function(_0x50986f,_0xd38979){_0x50986f=_0x50986f-0x0;var _0xf3a526=_0x6de2[_0x50986f];return _0xf3a526;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x26de('0x0'));var BPromise=require('bluebird');var rs=require(_0x26de('0x1'));var fs=require('fs');var Redis=require(_0x26de('0x2'));var db=require(_0x26de('0x3'))['db'];var utils=require(_0x26de('0x4'));var logger=require(_0x26de('0x5'))(_0x26de('0x6'));var config=require(_0x26de('0x7'));var jayson=require(_0x26de('0x8'));var client=jayson[_0x26de('0x9')][_0x26de('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x205c6a,_0x14c1bc,_0x352ebd){return new BPromise(function(_0x172352,_0x15f30b){return client[_0x26de('0xb')](_0x205c6a,_0x352ebd)[_0x26de('0xc')](function(_0xcdd54){logger[_0x26de('0xd')](_0x26de('0xe'),_0x14c1bc,'request\x20sent');logger['debug']('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x14c1bc,_0x26de('0xf'),JSON[_0x26de('0x10')](_0xcdd54));if(_0xcdd54[_0x26de('0x11')]){if(_0xcdd54[_0x26de('0x11')][_0x26de('0x12')]===0x1f4){logger[_0x26de('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x14c1bc,_0xcdd54[_0x26de('0x11')][_0x26de('0x13')]);return _0x15f30b(_0xcdd54['error'][_0x26de('0x13')]);}logger[_0x26de('0x11')](_0x26de('0xe'),_0x14c1bc,_0xcdd54[_0x26de('0x11')][_0x26de('0x13')]);return _0x172352(_0xcdd54[_0x26de('0x11')]['message']);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x14c1bc,'request\x20sent');_0x172352(_0xcdd54['result'][_0x26de('0x13')]);}})[_0x26de('0x14')](function(_0x46551d){logger['error'](_0x26de('0xe'),_0x14c1bc,_0x46551d);_0x15f30b(_0x46551d);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 60e8887..f3e326a 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 _0xd9bb=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','/describe','describe','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x54193e,_0xd18505){var _0x1303f5=function(_0x577ac2){while(--_0x577ac2){_0x54193e['push'](_0x54193e['shift']());}};_0x1303f5(++_0xd18505);}(_0xd9bb,0xa4));var _0xbd9b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd9bb[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xbd9b('0x0'));var util=require(_0xbd9b('0x1'));var path=require(_0xbd9b('0x2'));var timeout=require(_0xbd9b('0x3'));var express=require('express');var router=express[_0xbd9b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbd9b('0x5'));var interaction=require(_0xbd9b('0x6'));var config=require(_0xbd9b('0x7'));var controller=require(_0xbd9b('0x8'));router['get']('/',auth[_0xbd9b('0x9')](),controller[_0xbd9b('0xa')]);router[_0xbd9b('0xb')](_0xbd9b('0xc'),auth[_0xbd9b('0x9')](),controller[_0xbd9b('0xd')]);router['get']('/:id',auth[_0xbd9b('0x9')](),controller['show']);router[_0xbd9b('0xe')]('/',auth['isAuthenticated'](),controller[_0xbd9b('0xf')]);router[_0xbd9b('0x10')](_0xbd9b('0x11'),auth[_0xbd9b('0x9')](),controller[_0xbd9b('0x12')]);router[_0xbd9b('0x13')](_0xbd9b('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0xbd9b('0x14')]=router; \ No newline at end of file +var _0x6c84=['isAuthenticated','/describe','describe','/:id','show','create','put','delete','destroy','exports','multer','connect-timeout','express','../../config/environment','get'];(function(_0x2c2d02,_0x516d6b){var _0x4ed1d7=function(_0x4b126f){while(--_0x4b126f){_0x2c2d02['push'](_0x2c2d02['shift']());}};_0x4ed1d7(++_0x516d6b);}(_0x6c84,0x19f));var _0x46c8=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x6c84[_0x173441];return _0x2423a8;};'use strict';var multer=require(_0x46c8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x46c8('0x1'));var express=require(_0x46c8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x46c8('0x3'));var controller=require('./faxTransferReport.controller');router[_0x46c8('0x4')]('/',auth[_0x46c8('0x5')](),controller['index']);router[_0x46c8('0x4')](_0x46c8('0x6'),auth[_0x46c8('0x5')](),controller[_0x46c8('0x7')]);router[_0x46c8('0x4')](_0x46c8('0x8'),auth[_0x46c8('0x5')](),controller[_0x46c8('0x9')]);router['post']('/',auth[_0x46c8('0x5')](),controller[_0x46c8('0xa')]);router[_0x46c8('0xb')](_0x46c8('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x46c8('0xc')](_0x46c8('0x8'),auth[_0x46c8('0x5')](),controller[_0x46c8('0xd')]);module[_0x46c8('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index efb8b26..c7c68e2 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 _0xcb20=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','/:id','update','delete','destroy'];(function(_0x18aa2a,_0x251095){var _0x300e3c=function(_0x2e33e2){while(--_0x2e33e2){_0x18aa2a['push'](_0x18aa2a['shift']());}};_0x300e3c(++_0x251095);}(_0xcb20,0x177));var _0x0cb2=function(_0x44624a,_0x4e868a){_0x44624a=_0x44624a-0x0;var _0x58b641=_0xcb20[_0x44624a];return _0x58b641;};'use strict';var multer=require(_0x0cb2('0x0'));var util=require(_0x0cb2('0x1'));var path=require('path');var timeout=require(_0x0cb2('0x2'));var express=require(_0x0cb2('0x3'));var router=express[_0x0cb2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0cb2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0cb2('0x6'));var controller=require('./intDeskAccount.controller');router[_0x0cb2('0x7')]('/',auth[_0x0cb2('0x8')](),controller[_0x0cb2('0x9')]);router['get']('/:id',auth[_0x0cb2('0x8')](),controller[_0x0cb2('0xa')]);router[_0x0cb2('0x7')](_0x0cb2('0xb'),auth[_0x0cb2('0x8')](),controller[_0x0cb2('0xc')]);router[_0x0cb2('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x0cb2('0xd')]);router[_0x0cb2('0xe')]('/',auth[_0x0cb2('0x8')](),controller[_0x0cb2('0xf')]);router['post'](_0x0cb2('0xb'),auth[_0x0cb2('0x8')](),controller[_0x0cb2('0x10')]);router['put'](_0x0cb2('0x11'),auth[_0x0cb2('0x8')](),controller[_0x0cb2('0x12')]);router[_0x0cb2('0x13')](_0x0cb2('0x11'),auth[_0x0cb2('0x8')](),controller[_0x0cb2('0x14')]);module[_0x0cb2('0x15')]=router; \ No newline at end of file +var _0x6aa2=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','/:id'];(function(_0x888bea,_0x1a28ae){var _0x5572b1=function(_0x3a2672){while(--_0x3a2672){_0x888bea['push'](_0x888bea['shift']());}};_0x5572b1(++_0x1a28ae);}(_0x6aa2,0x148));var _0x26aa=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x6aa2[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require(_0x26aa('0x0'));var util=require(_0x26aa('0x1'));var path=require(_0x26aa('0x2'));var timeout=require(_0x26aa('0x3'));var express=require(_0x26aa('0x4'));var router=express[_0x26aa('0x5')]();var fs_extra=require(_0x26aa('0x6'));var auth=require(_0x26aa('0x7'));var interaction=require(_0x26aa('0x8'));var config=require(_0x26aa('0x9'));var controller=require(_0x26aa('0xa'));router['get']('/',auth[_0x26aa('0xb')](),controller[_0x26aa('0xc')]);router[_0x26aa('0xd')]('/:id',auth[_0x26aa('0xb')](),controller[_0x26aa('0xe')]);router['get'](_0x26aa('0xf'),auth['isAuthenticated'](),controller[_0x26aa('0x10')]);router[_0x26aa('0xd')](_0x26aa('0x11'),auth[_0x26aa('0xb')](),controller[_0x26aa('0x12')]);router[_0x26aa('0x13')]('/',auth[_0x26aa('0xb')](),controller[_0x26aa('0x14')]);router['post']('/:id/configurations',auth[_0x26aa('0xb')](),controller['addConfiguration']);router[_0x26aa('0x15')](_0x26aa('0x16'),auth[_0x26aa('0xb')](),controller[_0x26aa('0x17')]);router[_0x26aa('0x18')](_0x26aa('0x16'),auth['isAuthenticated'](),controller[_0x26aa('0x19')]);module[_0x26aa('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 78e8c3d..b5837ce 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 _0xe406=['exports','STRING','ENUM','basic','integrationTab','newTab','sequelize'];(function(_0x447a41,_0xca926){var _0x108ec6=function(_0x4a49e8){while(--_0x4a49e8){_0x447a41['push'](_0x447a41['shift']());}};_0x108ec6(++_0xca926);}(_0xe406,0x125));var _0x6e40=function(_0x47af95,_0x5beef9){_0x47af95=_0x47af95-0x0;var _0x534d8=_0xe406[_0x47af95];return _0x534d8;};'use strict';var Sequelize=require(_0x6e40('0x0'));module[_0x6e40('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6e40('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x6e40('0x3')](_0x6e40('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x6e40('0x2')]},'consumerKey':{'type':Sequelize[_0x6e40('0x2')]},'consumerSecret':{'type':Sequelize[_0x6e40('0x2')]},'token':{'type':Sequelize[_0x6e40('0x2')]},'tokenSecret':{'type':Sequelize[_0x6e40('0x2')]},'serverUrl':{'type':Sequelize[_0x6e40('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6e40('0x3')](_0x6e40('0x5'),_0x6e40('0x6')),'defaultValue':_0x6e40('0x5')}}; \ No newline at end of file +var _0x4e5b=['ENUM','basic','newTab','integrationTab','sequelize','exports','STRING'];(function(_0x5a825,_0x50edc6){var _0x4fb5d9=function(_0x4c3b07){while(--_0x4c3b07){_0x5a825['push'](_0x5a825['shift']());}};_0x4fb5d9(++_0x50edc6);}(_0x4e5b,0x1c4));var _0xb4e5=function(_0x1655bb,_0x5a82ae){_0x1655bb=_0x1655bb-0x0;var _0x5e2020=_0x4e5b[_0x1655bb];return _0x5e2020;};'use strict';var Sequelize=require(_0xb4e5('0x0'));module[_0xb4e5('0x1')]={'name':{'type':Sequelize[_0xb4e5('0x2')]},'description':{'type':Sequelize[_0xb4e5('0x2')]},'username':{'type':Sequelize[_0xb4e5('0x2')]},'remoteUri':{'type':Sequelize[_0xb4e5('0x2')]},'authType':{'type':Sequelize[_0xb4e5('0x3')](_0xb4e5('0x4')),'defaultValue':_0xb4e5('0x4')},'password':{'type':Sequelize[_0xb4e5('0x2')]},'consumerKey':{'type':Sequelize[_0xb4e5('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xb4e5('0x2')]},'tokenSecret':{'type':Sequelize[_0xb4e5('0x2')]},'serverUrl':{'type':Sequelize[_0xb4e5('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb4e5('0x3')]('integrationTab',_0xb4e5('0x5')),'defaultValue':_0xb4e5('0x6')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 3d1cb11..1fd1f61 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 _0x1e3c=['basic','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','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','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','getConfigurations','findOne','DeskConfiguration','nolimit','addConfiguration','Subjects','getSubjects','getDescriptions','channel','DeskField','Descriptions','getFields','priority','remoteUri','authType','username','password','consumerKey','tokenSecret','slice','substring','GET','format','application/json'];(function(_0x3aa3b4,_0x417691){var _0x24c99b=function(_0xc4b9f8){while(--_0xc4b9f8){_0x3aa3b4['push'](_0x3aa3b4['shift']());}};_0x24c99b(++_0x417691);}(_0x1e3c,0x1e8));var _0xc1e3=function(_0x237120,_0x2e7c40){_0x237120=_0x237120-0x0;var _0x5d7957=_0x1e3c[_0x237120];return _0x5d7957;};'use strict';var emlformat=require(_0xc1e3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc1e3('0x1'));var jsonpatch=require(_0xc1e3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc1e3('0x3'));var Mustache=require(_0xc1e3('0x4'));var util=require('util');var path=require(_0xc1e3('0x5'));var sox=require(_0xc1e3('0x6'));var csv=require('to-csv');var ejs=require(_0xc1e3('0x7'));var fs=require('fs');var fs_extra=require(_0xc1e3('0x8'));var _=require(_0xc1e3('0x9'));var squel=require('squel');var crypto=require(_0xc1e3('0xa'));var jsforce=require(_0xc1e3('0xb'));var deskjs=require(_0xc1e3('0xc'));var toCsv=require(_0xc1e3('0xd'));var querystring=require(_0xc1e3('0xe'));var Papa=require(_0xc1e3('0xf'));var Redis=require(_0xc1e3('0x10'));var authService=require(_0xc1e3('0x11'));var qs=require(_0xc1e3('0x12'));var as=require(_0xc1e3('0x13'));var hardwareService=require(_0xc1e3('0x14'));var logger=require('../../config/logger')(_0xc1e3('0x15'));var utils=require(_0xc1e3('0x16'));var config=require(_0xc1e3('0x17'));var licenseUtil=require(_0xc1e3('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0xc1e3('0x19'));function respondWithStatusCode(_0x2e3eb1,_0x18cb5d){_0x18cb5d=_0x18cb5d||0xcc;return function(_0x1ca0dc){if(_0x1ca0dc){return _0x2e3eb1[_0xc1e3('0x1a')](_0x18cb5d);}return _0x2e3eb1[_0xc1e3('0x1b')](_0x18cb5d)[_0xc1e3('0x1c')]();};}function respondWithResult(_0x1df242,_0x5dd7f9){_0x5dd7f9=_0x5dd7f9||0xc8;return function(_0xd48942){if(_0xd48942){return _0x1df242[_0xc1e3('0x1b')](_0x5dd7f9)['json'](_0xd48942);}};}function respondWithFilteredResult(_0x3367d3,_0x39569e){return function(_0x68279b){if(_0x68279b){var _0x18c5ef=typeof _0x39569e[_0xc1e3('0x1d')]===_0xc1e3('0x1e')&&typeof _0x39569e[_0xc1e3('0x1f')]==='undefined';var _0x4f4e6c=_0x68279b[_0xc1e3('0x20')];var _0x27130e=_0x18c5ef?0x0:_0x39569e[_0xc1e3('0x1d')];var _0x30bb90=_0x18c5ef?_0x68279b[_0xc1e3('0x20')]:_0x39569e[_0xc1e3('0x1d')]+_0x39569e[_0xc1e3('0x1f')];var _0x56a7ec;if(_0x30bb90>=_0x4f4e6c){_0x30bb90=_0x4f4e6c;_0x56a7ec=0xc8;}else{_0x56a7ec=0xce;}_0x3367d3[_0xc1e3('0x1b')](_0x56a7ec);return _0x3367d3['set'](_0xc1e3('0x21'),_0x27130e+'-'+_0x30bb90+'/'+_0x4f4e6c)[_0xc1e3('0x22')](_0x68279b);}return null;};}function patchUpdates(_0x31fc06){return function(_0x4dc69c){try{jsonpatch[_0xc1e3('0x23')](_0x4dc69c,_0x31fc06,!![]);}catch(_0x7c5227){return BPromise[_0xc1e3('0x24')](_0x7c5227);}return _0x4dc69c[_0xc1e3('0x25')]();};}function saveUpdates(_0x405099,_0x37c329){return function(_0x3d6fca){if(_0x3d6fca){return _0x3d6fca[_0xc1e3('0x26')](_0x405099)['then'](function(_0x2ddb64){return _0x2ddb64;});}return null;};}function removeEntity(_0x28fea1,_0x2b6b98){return function(_0x3e685f){if(_0x3e685f){return _0x3e685f[_0xc1e3('0x27')]()[_0xc1e3('0x28')](function(){_0x28fea1[_0xc1e3('0x1b')](0xcc)[_0xc1e3('0x1c')]();});}};}function handleEntityNotFound(_0x7ae6cd,_0xe072b2){return function(_0xaefd86){if(!_0xaefd86){_0x7ae6cd[_0xc1e3('0x1a')](0x194);}return _0xaefd86;};}function handleError(_0x260638,_0x31a719){_0x31a719=_0x31a719||0x1f4;return function(_0x4b534c){logger[_0xc1e3('0x29')](_0x4b534c[_0xc1e3('0x2a')]);if(_0x4b534c[_0xc1e3('0x2b')]){delete _0x4b534c['name'];}_0x260638[_0xc1e3('0x1b')](_0x31a719)[_0xc1e3('0x2c')](_0x4b534c);};}exports[_0xc1e3('0x2d')]=function(_0xe647f,_0x481458){var _0x500d70={},_0x1f3b72={},_0x4a0d8a={'count':0x0,'rows':[]};var _0x4d5700=_[_0xc1e3('0x2e')](db[_0xc1e3('0x2f')][_0xc1e3('0x30')],function(_0x4b7165){return{'name':_0x4b7165[_0xc1e3('0x31')],'type':_0x4b7165[_0xc1e3('0x32')]['key']};});_0x1f3b72[_0xc1e3('0x33')]=_['map'](_0x4d5700,_0xc1e3('0x2b'));_0x1f3b72[_0xc1e3('0x34')]=_[_0xc1e3('0x35')](_0xe647f[_0xc1e3('0x34')]);_0x1f3b72[_0xc1e3('0x36')]=_[_0xc1e3('0x37')](_0x1f3b72[_0xc1e3('0x33')],_0x1f3b72[_0xc1e3('0x34')]);_0x500d70[_0xc1e3('0x38')]=_[_0xc1e3('0x37')](_0x1f3b72[_0xc1e3('0x33')],qs[_0xc1e3('0x39')](_0xe647f[_0xc1e3('0x34')][_0xc1e3('0x39')]));_0x500d70[_0xc1e3('0x38')]=_0x500d70[_0xc1e3('0x38')][_0xc1e3('0x3a')]?_0x500d70['attributes']:_0x1f3b72[_0xc1e3('0x33')];if(!_0xe647f['query'][_0xc1e3('0x3b')]('nolimit')){_0x500d70[_0xc1e3('0x1f')]=qs['limit'](_0xe647f[_0xc1e3('0x34')]['limit']);_0x500d70[_0xc1e3('0x1d')]=qs[_0xc1e3('0x1d')](_0xe647f[_0xc1e3('0x34')][_0xc1e3('0x1d')]);}_0x500d70[_0xc1e3('0x3c')]=qs['sort'](_0xe647f[_0xc1e3('0x34')][_0xc1e3('0x3d')]);_0x500d70[_0xc1e3('0x3e')]=qs[_0xc1e3('0x36')](_[_0xc1e3('0x3f')](_0xe647f[_0xc1e3('0x34')],_0x1f3b72[_0xc1e3('0x36')]),_0x4d5700);if(_0xe647f[_0xc1e3('0x34')][_0xc1e3('0x40')]){_0x500d70[_0xc1e3('0x3e')]=_[_0xc1e3('0x41')](_0x500d70[_0xc1e3('0x3e')],{'$or':_[_0xc1e3('0x2e')](_0x4d5700,function(_0x1a7653){if(_0x1a7653[_0xc1e3('0x32')]!==_0xc1e3('0x42')){var _0x3c1cf3={};_0x3c1cf3[_0x1a7653['name']]={'$like':'%'+_0xe647f[_0xc1e3('0x34')][_0xc1e3('0x40')]+'%'};return _0x3c1cf3;}})});}_0x500d70=_['merge']({},_0x500d70,_0xe647f[_0xc1e3('0x43')]);var _0x8892aa={'where':_0x500d70[_0xc1e3('0x3e')]};return db[_0xc1e3('0x2f')][_0xc1e3('0x20')](_0x8892aa)[_0xc1e3('0x28')](function(_0x267c35){_0x4a0d8a[_0xc1e3('0x20')]=_0x267c35;if(_0xe647f[_0xc1e3('0x34')]['includeAll']){_0x500d70[_0xc1e3('0x44')]=[{'all':!![]}];}return db['DeskAccount'][_0xc1e3('0x45')](_0x500d70);})[_0xc1e3('0x28')](function(_0x225c15){_0x4a0d8a[_0xc1e3('0x46')]=_0x225c15;return _0x4a0d8a;})[_0xc1e3('0x28')](respondWithFilteredResult(_0x481458,_0x500d70))['catch'](handleError(_0x481458,null));};exports[_0xc1e3('0x47')]=function(_0x2b4a8a,_0x25f96f){var _0x421c00={'raw':![],'where':{'id':_0x2b4a8a[_0xc1e3('0x48')]['id']}},_0x5cac6f={};_0x5cac6f[_0xc1e3('0x33')]=_[_0xc1e3('0x35')](db[_0xc1e3('0x2f')]['rawAttributes']);_0x5cac6f['query']=_[_0xc1e3('0x35')](_0x2b4a8a['query']);_0x5cac6f[_0xc1e3('0x36')]=_[_0xc1e3('0x37')](_0x5cac6f[_0xc1e3('0x33')],_0x5cac6f['query']);_0x421c00[_0xc1e3('0x38')]=_[_0xc1e3('0x37')](_0x5cac6f[_0xc1e3('0x33')],qs[_0xc1e3('0x39')](_0x2b4a8a[_0xc1e3('0x34')][_0xc1e3('0x39')]));_0x421c00[_0xc1e3('0x38')]=_0x421c00['attributes'][_0xc1e3('0x3a')]?_0x421c00['attributes']:_0x5cac6f[_0xc1e3('0x33')];if(_0x2b4a8a[_0xc1e3('0x34')][_0xc1e3('0x49')]){_0x421c00[_0xc1e3('0x44')]=[{'all':!![]}];}_0x421c00=_[_0xc1e3('0x41')]({},_0x421c00,_0x2b4a8a[_0xc1e3('0x43')]);return db[_0xc1e3('0x2f')][_0xc1e3('0x4a')](_0x421c00)[_0xc1e3('0x28')](handleEntityNotFound(_0x25f96f,null))[_0xc1e3('0x28')](respondWithResult(_0x25f96f,null))[_0xc1e3('0x4b')](handleError(_0x25f96f,null));};exports[_0xc1e3('0x4c')]=function(_0x5bc4c9,_0x51861a){return db[_0xc1e3('0x2f')][_0xc1e3('0x4c')](_0x5bc4c9['body'],{})[_0xc1e3('0x28')](respondWithResult(_0x51861a,0xc9))[_0xc1e3('0x4b')](handleError(_0x51861a,null));};exports[_0xc1e3('0x26')]=function(_0x2ebbb7,_0x23b738){if(_0x2ebbb7[_0xc1e3('0x4d')]['id']){delete _0x2ebbb7[_0xc1e3('0x4d')]['id'];}return db[_0xc1e3('0x2f')][_0xc1e3('0x4a')]({'where':{'id':_0x2ebbb7['params']['id']}})[_0xc1e3('0x28')](handleEntityNotFound(_0x23b738,null))[_0xc1e3('0x28')](saveUpdates(_0x2ebbb7[_0xc1e3('0x4d')],null))[_0xc1e3('0x28')](respondWithResult(_0x23b738,null))[_0xc1e3('0x4b')](handleError(_0x23b738,null));};exports[_0xc1e3('0x27')]=function(_0x5a3daf,_0x472c4d){return db[_0xc1e3('0x2f')]['find']({'where':{'id':_0x5a3daf[_0xc1e3('0x48')]['id']}})[_0xc1e3('0x28')](handleEntityNotFound(_0x472c4d,null))['then'](removeEntity(_0x472c4d,null))[_0xc1e3('0x4b')](handleError(_0x472c4d,null));};exports[_0xc1e3('0x4e')]=function(_0x8164c7,_0x453aaf,_0x15aaa1){var _0x534c69={};var _0x32d093={};var _0x160c5d;var _0x279135;return db[_0xc1e3('0x2f')][_0xc1e3('0x4f')]({'where':{'id':_0x8164c7[_0xc1e3('0x48')]['id']}})[_0xc1e3('0x28')](handleEntityNotFound(_0x453aaf,null))[_0xc1e3('0x28')](function(_0x877e4c){if(_0x877e4c){_0x160c5d=_0x877e4c;_0x32d093[_0xc1e3('0x33')]=_[_0xc1e3('0x35')](db[_0xc1e3('0x50')][_0xc1e3('0x30')]);_0x32d093[_0xc1e3('0x34')]=_[_0xc1e3('0x35')](_0x8164c7[_0xc1e3('0x34')]);_0x32d093['filters']=_[_0xc1e3('0x37')](_0x32d093[_0xc1e3('0x33')],_0x32d093[_0xc1e3('0x34')]);_0x534c69[_0xc1e3('0x38')]=_['intersection'](_0x32d093[_0xc1e3('0x33')],qs['fields'](_0x8164c7['query']['fields']));_0x534c69[_0xc1e3('0x38')]=_0x534c69[_0xc1e3('0x38')][_0xc1e3('0x3a')]?_0x534c69[_0xc1e3('0x38')]:_0x32d093[_0xc1e3('0x33')];_0x534c69[_0xc1e3('0x3c')]=qs[_0xc1e3('0x3d')](_0x8164c7['query'][_0xc1e3('0x3d')]);_0x534c69['where']=qs[_0xc1e3('0x36')](_['pick'](_0x8164c7[_0xc1e3('0x34')],_0x32d093[_0xc1e3('0x36')]));if(_0x8164c7[_0xc1e3('0x34')][_0xc1e3('0x40')]){_0x534c69['where']=_[_0xc1e3('0x41')](_0x534c69[_0xc1e3('0x3e')],{'$or':_[_0xc1e3('0x2e')](_0x534c69[_0xc1e3('0x38')],function(_0x6eecb6){var _0x32c8f6={};_0x32c8f6[_0x6eecb6]={'$like':'%'+_0x8164c7[_0xc1e3('0x34')][_0xc1e3('0x40')]+'%'};return _0x32c8f6;})});}_0x534c69=_[_0xc1e3('0x41')]({},_0x534c69,_0x8164c7[_0xc1e3('0x43')]);return _0x160c5d[_0xc1e3('0x4e')](_0x534c69);}})[_0xc1e3('0x28')](function(_0xb6a402){if(_0xb6a402){_0x279135=_0xb6a402[_0xc1e3('0x3a')];if(!_0x8164c7[_0xc1e3('0x34')][_0xc1e3('0x3b')](_0xc1e3('0x51'))){_0x534c69[_0xc1e3('0x1f')]=qs[_0xc1e3('0x1f')](_0x8164c7[_0xc1e3('0x34')][_0xc1e3('0x1f')]);_0x534c69[_0xc1e3('0x1d')]=qs['offset'](_0x8164c7[_0xc1e3('0x34')][_0xc1e3('0x1d')]);}return _0x160c5d[_0xc1e3('0x4e')](_0x534c69);}})[_0xc1e3('0x28')](function(_0x3f8baa){if(_0x3f8baa){return _0x3f8baa?{'count':_0x279135,'rows':_0x3f8baa}:null;}})[_0xc1e3('0x28')](respondWithResult(_0x453aaf,null))[_0xc1e3('0x4b')](handleError(_0x453aaf,null));};exports[_0xc1e3('0x52')]=function(_0x543366,_0x19f88c,_0x1da511){if(_0x543366[_0xc1e3('0x4d')]['id']){delete _0x543366[_0xc1e3('0x4d')]['id'];}return db['DeskAccount'][_0xc1e3('0x4f')]({'where':{'id':_0x543366[_0xc1e3('0x48')]['id']}})[_0xc1e3('0x28')](handleEntityNotFound(_0x19f88c,null))[_0xc1e3('0x28')](function(_0x48979f){if(_0x48979f){_0x543366['body']['AccountId']=_0x48979f['id'];_0x543366[_0xc1e3('0x4d')][_0xc1e3('0x53')]=integrations[_0xc1e3('0x54')](_0x543366[_0xc1e3('0x4d')]['channel'],_0x543366[_0xc1e3('0x4d')][_0xc1e3('0x32')]);_0x543366[_0xc1e3('0x4d')]['Descriptions']=integrations[_0xc1e3('0x55')](_0x543366['body'][_0xc1e3('0x56')],_0x543366['body']['type']);return db[_0xc1e3('0x50')][_0xc1e3('0x4c')](_0x543366[_0xc1e3('0x4d')],{'include':[{'model':db[_0xc1e3('0x57')],'as':_0xc1e3('0x53')},{'model':db[_0xc1e3('0x57')],'as':_0xc1e3('0x58')}]});}return null;})['then'](respondWithResult(_0x19f88c,null))[_0xc1e3('0x4b')](handleError(_0x19f88c,null));};exports[_0xc1e3('0x59')]=function(_0x4c57f9,_0x3cc7f5,_0x15235e){var _0x1ef84d=[{'name':_0xc1e3('0x5a'),'label':_0xc1e3('0x5a'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x37bde7='';return db[_0xc1e3('0x2f')][_0xc1e3('0x4f')]({'where':{'id':_0x4c57f9['params']['id']},'attributes':['id',_0xc1e3('0x5b'),_0xc1e3('0x5c'),_0xc1e3('0x5d'),_0xc1e3('0x5e'),_0xc1e3('0x5f'),'consumerSecret','token',_0xc1e3('0x60')]})[_0xc1e3('0x28')](handleEntityNotFound(_0x3cc7f5,null))[_0xc1e3('0x28')](function(_0x44760c){if(_0x44760c){_0x37bde7=_0x44760c['remoteUri'];var _0x34e4f7=_0x37bde7[_0xc1e3('0x61')](-0x1);if(_0x34e4f7==='/'){_0x37bde7=_0x37bde7[_0xc1e3('0x62')](0x0,_0x37bde7['lastIndexOf'](_0x34e4f7));}var _0x3d6cd4={'method':_0xc1e3('0x63'),'uri':util[_0xc1e3('0x64')]('%s/custom_fields',_0x37bde7),'headers':{'Content-Type':'application/json','Accept':_0xc1e3('0x65')},'json':!![]};if(_0x44760c[_0xc1e3('0x5c')]===_0xc1e3('0x66')){_0x3d6cd4[_0xc1e3('0x67')][_0xc1e3('0x68')]=util[_0xc1e3('0x64')](_0xc1e3('0x69'),new Buffer(util[_0xc1e3('0x64')](_0xc1e3('0x6a'),_0x44760c[_0xc1e3('0x5d')],_0x44760c[_0xc1e3('0x5e')]))[_0xc1e3('0x6b')](_0xc1e3('0x6c')));}return rp(_0x3d6cd4)[_0xc1e3('0x28')](function(_0x13012a){return _0x1ef84d[_0xc1e3('0x6d')](_[_0xc1e3('0x2e')](_0x13012a['_embedded'][_0xc1e3('0x6e')],function(_0x1fc0fb){return{'id':_0x1fc0fb['name'],'name':_0x1fc0fb[_0xc1e3('0x2b')],'type':_0x1fc0fb['type'],'active':_0x1fc0fb[_0xc1e3('0x6f')],'label':_0x1fc0fb[_0xc1e3('0x70')],'custom':!![]};}));});}})[_0xc1e3('0x28')](function(_0x2f3f9a){return{'count':_0x2f3f9a[_0xc1e3('0x3a')],'rows':_0x2f3f9a};})['then'](respondWithResult(_0x3cc7f5,null))[_0xc1e3('0x4b')](function(_0x2fd4ad){var _0x5b9d1d=_0x4c57f9['query']['test']?0x1f4:_0x2fd4ad[_0xc1e3('0x71')]||0x1f4;logger[_0xc1e3('0x29')](_0xc1e3('0x72'),_0xc1e3('0x59'),_0x5b9d1d,JSON[_0xc1e3('0x73')](_0x2fd4ad));delete _0x2fd4ad[_0xc1e3('0x2b')];if(_0x5b9d1d===0x191){_0x5b9d1d=0x190;}_0x3cc7f5[_0xc1e3('0x1b')](_0x5b9d1d)[_0xc1e3('0x2c')](_0x4c57f9['query'][_0xc1e3('0x74')]?{'message':_0xc1e3('0x75'),'statusCode':_0x2fd4ad[_0xc1e3('0x71')]}:_0x2fd4ad);});}; \ No newline at end of file +var _0xa2ee=['map','DeskAccount','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getConfigurations','findOne','keys','options','hasOwnProperty','AccountId','Subjects','getSubjects','channel','getDescriptions','getFields','priority','remoteUri','authType','username','consumerSecret','tokenSecret','slice','substring','lastIndexOf','application/json','headers','Authorization','format','Basic\x20%s','%s:%s','password','base64','concat','entries','label','test','statusCode','error','stringify','send','Wrong\x20credentials','rimraf','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','name'];(function(_0x31e5cb,_0x2f5adf){var _0x4170df=function(_0x31c53e){while(--_0x31c53e){_0x31e5cb['push'](_0x31e5cb['shift']());}};_0x4170df(++_0x2f5adf);}(_0xa2ee,0xa9));var _0xea2e=function(_0x34986b,_0x56fb4a){_0x34986b=_0x34986b-0x0;var _0x28a0d1=_0xa2ee[_0x34986b];return _0x28a0d1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xea2e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xea2e('0x1'));var BPromise=require(_0xea2e('0x2'));var Mustache=require('mustache');var util=require(_0xea2e('0x3'));var path=require('path');var sox=require(_0xea2e('0x4'));var csv=require(_0xea2e('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xea2e('0x6'));var _=require(_0xea2e('0x7'));var squel=require(_0xea2e('0x8'));var crypto=require(_0xea2e('0x9'));var jsforce=require(_0xea2e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xea2e('0x5'));var querystring=require('querystring');var Papa=require(_0xea2e('0xb'));var Redis=require(_0xea2e('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xea2e('0xd'));var as=require(_0xea2e('0xe'));var hardwareService=require(_0xea2e('0xf'));var logger=require('../../config/logger')(_0xea2e('0x10'));var utils=require(_0xea2e('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xea2e('0x12'));var db=require(_0xea2e('0x13'))['db'];var integrations=require(_0xea2e('0x14'));function respondWithStatusCode(_0x3942eb,_0x2d2f63){_0x2d2f63=_0x2d2f63||0xcc;return function(_0x2e1cec){if(_0x2e1cec){return _0x3942eb[_0xea2e('0x15')](_0x2d2f63);}return _0x3942eb[_0xea2e('0x16')](_0x2d2f63)[_0xea2e('0x17')]();};}function respondWithResult(_0x30eba9,_0x4a3356){_0x4a3356=_0x4a3356||0xc8;return function(_0xde2197){if(_0xde2197){return _0x30eba9[_0xea2e('0x16')](_0x4a3356)[_0xea2e('0x18')](_0xde2197);}};}function respondWithFilteredResult(_0x3206a1,_0x46f171){return function(_0x39b5d4){if(_0x39b5d4){var _0x4da9c1=typeof _0x46f171[_0xea2e('0x19')]===_0xea2e('0x1a')&&typeof _0x46f171[_0xea2e('0x1b')]===_0xea2e('0x1a');var _0x25e8df=_0x39b5d4[_0xea2e('0x1c')];var _0x3f911c=_0x4da9c1?0x0:_0x46f171[_0xea2e('0x19')];var _0x2475dd=_0x4da9c1?_0x39b5d4[_0xea2e('0x1c')]:_0x46f171[_0xea2e('0x19')]+_0x46f171['limit'];var _0x2cd69c;if(_0x2475dd>=_0x25e8df){_0x2475dd=_0x25e8df;_0x2cd69c=0xc8;}else{_0x2cd69c=0xce;}_0x3206a1[_0xea2e('0x16')](_0x2cd69c);return _0x3206a1['set'](_0xea2e('0x1d'),_0x3f911c+'-'+_0x2475dd+'/'+_0x25e8df)[_0xea2e('0x18')](_0x39b5d4);}return null;};}function patchUpdates(_0x19d81a){return function(_0x1f0e93){try{jsonpatch['apply'](_0x1f0e93,_0x19d81a,!![]);}catch(_0x9bc623){return BPromise['reject'](_0x9bc623);}return _0x1f0e93[_0xea2e('0x1e')]();};}function saveUpdates(_0x12eff9,_0x5c60cc){return function(_0x145176){if(_0x145176){return _0x145176[_0xea2e('0x1f')](_0x12eff9)[_0xea2e('0x20')](function(_0x4f48f6){return _0x4f48f6;});}return null;};}function removeEntity(_0x29fc97,_0x2fb249){return function(_0xf16cbc){if(_0xf16cbc){return _0xf16cbc[_0xea2e('0x21')]()[_0xea2e('0x20')](function(){_0x29fc97[_0xea2e('0x16')](0xcc)[_0xea2e('0x17')]();});}};}function handleEntityNotFound(_0x22b70d,_0x679996){return function(_0x5e9747){if(!_0x5e9747){_0x22b70d[_0xea2e('0x15')](0x194);}return _0x5e9747;};}function handleError(_0x25fa2f,_0x3aef5a){_0x3aef5a=_0x3aef5a||0x1f4;return function(_0x5b3c5d){logger['error'](_0x5b3c5d['stack']);if(_0x5b3c5d[_0xea2e('0x22')]){delete _0x5b3c5d[_0xea2e('0x22')];}_0x25fa2f[_0xea2e('0x16')](_0x3aef5a)['send'](_0x5b3c5d);};}exports['index']=function(_0x315248,_0x33d1a7){var _0x5595ff={},_0x4870f={},_0x27ee73={'count':0x0,'rows':[]};var _0x3f2255=_[_0xea2e('0x23')](db[_0xea2e('0x24')][_0xea2e('0x25')],function(_0x5d1aba){return{'name':_0x5d1aba[_0xea2e('0x26')],'type':_0x5d1aba['type']['key']};});_0x4870f[_0xea2e('0x27')]=_[_0xea2e('0x23')](_0x3f2255,_0xea2e('0x22'));_0x4870f[_0xea2e('0x28')]=_['keys'](_0x315248[_0xea2e('0x28')]);_0x4870f[_0xea2e('0x29')]=_[_0xea2e('0x2a')](_0x4870f[_0xea2e('0x27')],_0x4870f[_0xea2e('0x28')]);_0x5595ff[_0xea2e('0x2b')]=_[_0xea2e('0x2a')](_0x4870f[_0xea2e('0x27')],qs[_0xea2e('0x2c')](_0x315248[_0xea2e('0x28')][_0xea2e('0x2c')]));_0x5595ff[_0xea2e('0x2b')]=_0x5595ff[_0xea2e('0x2b')]['length']?_0x5595ff[_0xea2e('0x2b')]:_0x4870f['model'];if(!_0x315248[_0xea2e('0x28')]['hasOwnProperty'](_0xea2e('0x2d'))){_0x5595ff['limit']=qs[_0xea2e('0x1b')](_0x315248[_0xea2e('0x28')][_0xea2e('0x1b')]);_0x5595ff[_0xea2e('0x19')]=qs['offset'](_0x315248[_0xea2e('0x28')][_0xea2e('0x19')]);}_0x5595ff[_0xea2e('0x2e')]=qs['sort'](_0x315248[_0xea2e('0x28')][_0xea2e('0x2f')]);_0x5595ff[_0xea2e('0x30')]=qs[_0xea2e('0x29')](_[_0xea2e('0x31')](_0x315248[_0xea2e('0x28')],_0x4870f[_0xea2e('0x29')]),_0x3f2255);if(_0x315248[_0xea2e('0x28')][_0xea2e('0x32')]){_0x5595ff['where']=_[_0xea2e('0x33')](_0x5595ff[_0xea2e('0x30')],{'$or':_[_0xea2e('0x23')](_0x3f2255,function(_0x2552cf){if(_0x2552cf[_0xea2e('0x34')]!==_0xea2e('0x35')){var _0xa79a7c={};_0xa79a7c[_0x2552cf[_0xea2e('0x22')]]={'$like':'%'+_0x315248[_0xea2e('0x28')]['filter']+'%'};return _0xa79a7c;}})});}_0x5595ff=_[_0xea2e('0x33')]({},_0x5595ff,_0x315248['options']);var _0x1a4713={'where':_0x5595ff[_0xea2e('0x30')]};return db[_0xea2e('0x24')][_0xea2e('0x1c')](_0x1a4713)[_0xea2e('0x20')](function(_0x130315){_0x27ee73[_0xea2e('0x1c')]=_0x130315;if(_0x315248[_0xea2e('0x28')][_0xea2e('0x36')]){_0x5595ff[_0xea2e('0x37')]=[{'all':!![]}];}return db[_0xea2e('0x24')][_0xea2e('0x38')](_0x5595ff);})[_0xea2e('0x20')](function(_0x3e814b){_0x27ee73[_0xea2e('0x39')]=_0x3e814b;return _0x27ee73;})['then'](respondWithFilteredResult(_0x33d1a7,_0x5595ff))[_0xea2e('0x3a')](handleError(_0x33d1a7,null));};exports[_0xea2e('0x3b')]=function(_0x173ac2,_0x241dd6){var _0x190a23={'raw':![],'where':{'id':_0x173ac2[_0xea2e('0x3c')]['id']}},_0x589dc3={};_0x589dc3[_0xea2e('0x27')]=_['keys'](db[_0xea2e('0x24')][_0xea2e('0x25')]);_0x589dc3['query']=_['keys'](_0x173ac2[_0xea2e('0x28')]);_0x589dc3['filters']=_['intersection'](_0x589dc3[_0xea2e('0x27')],_0x589dc3[_0xea2e('0x28')]);_0x190a23['attributes']=_[_0xea2e('0x2a')](_0x589dc3[_0xea2e('0x27')],qs['fields'](_0x173ac2[_0xea2e('0x28')][_0xea2e('0x2c')]));_0x190a23[_0xea2e('0x2b')]=_0x190a23['attributes'][_0xea2e('0x3d')]?_0x190a23[_0xea2e('0x2b')]:_0x589dc3[_0xea2e('0x27')];if(_0x173ac2['query'][_0xea2e('0x36')]){_0x190a23[_0xea2e('0x37')]=[{'all':!![]}];}_0x190a23=_[_0xea2e('0x33')]({},_0x190a23,_0x173ac2['options']);return db[_0xea2e('0x24')][_0xea2e('0x3e')](_0x190a23)[_0xea2e('0x20')](handleEntityNotFound(_0x241dd6,null))['then'](respondWithResult(_0x241dd6,null))[_0xea2e('0x3a')](handleError(_0x241dd6,null));};exports[_0xea2e('0x3f')]=function(_0x3595f,_0x3cf1ea){return db['DeskAccount']['create'](_0x3595f['body'],{})[_0xea2e('0x20')](respondWithResult(_0x3cf1ea,0xc9))[_0xea2e('0x3a')](handleError(_0x3cf1ea,null));};exports[_0xea2e('0x1f')]=function(_0x1718bb,_0x5623ed){if(_0x1718bb[_0xea2e('0x40')]['id']){delete _0x1718bb['body']['id'];}return db[_0xea2e('0x24')][_0xea2e('0x3e')]({'where':{'id':_0x1718bb[_0xea2e('0x3c')]['id']}})[_0xea2e('0x20')](handleEntityNotFound(_0x5623ed,null))[_0xea2e('0x20')](saveUpdates(_0x1718bb[_0xea2e('0x40')],null))['then'](respondWithResult(_0x5623ed,null))[_0xea2e('0x3a')](handleError(_0x5623ed,null));};exports['destroy']=function(_0x1a39f7,_0x5aeb00){return db[_0xea2e('0x24')][_0xea2e('0x3e')]({'where':{'id':_0x1a39f7[_0xea2e('0x3c')]['id']}})[_0xea2e('0x20')](handleEntityNotFound(_0x5aeb00,null))[_0xea2e('0x20')](removeEntity(_0x5aeb00,null))['catch'](handleError(_0x5aeb00,null));};exports[_0xea2e('0x41')]=function(_0xd82b79,_0x3efbec,_0x408e23){var _0x4708dc={};var _0x22200b={};var _0x1cf245;var _0xe2daa;return db[_0xea2e('0x24')][_0xea2e('0x42')]({'where':{'id':_0xd82b79['params']['id']}})[_0xea2e('0x20')](handleEntityNotFound(_0x3efbec,null))[_0xea2e('0x20')](function(_0x3d6628){if(_0x3d6628){_0x1cf245=_0x3d6628;_0x22200b[_0xea2e('0x27')]=_['keys'](db['DeskConfiguration']['rawAttributes']);_0x22200b[_0xea2e('0x28')]=_[_0xea2e('0x43')](_0xd82b79[_0xea2e('0x28')]);_0x22200b[_0xea2e('0x29')]=_['intersection'](_0x22200b['model'],_0x22200b[_0xea2e('0x28')]);_0x4708dc[_0xea2e('0x2b')]=_[_0xea2e('0x2a')](_0x22200b['model'],qs[_0xea2e('0x2c')](_0xd82b79[_0xea2e('0x28')][_0xea2e('0x2c')]));_0x4708dc[_0xea2e('0x2b')]=_0x4708dc[_0xea2e('0x2b')]['length']?_0x4708dc[_0xea2e('0x2b')]:_0x22200b[_0xea2e('0x27')];_0x4708dc[_0xea2e('0x2e')]=qs['sort'](_0xd82b79[_0xea2e('0x28')][_0xea2e('0x2f')]);_0x4708dc[_0xea2e('0x30')]=qs[_0xea2e('0x29')](_[_0xea2e('0x31')](_0xd82b79[_0xea2e('0x28')],_0x22200b[_0xea2e('0x29')]));if(_0xd82b79[_0xea2e('0x28')][_0xea2e('0x32')]){_0x4708dc[_0xea2e('0x30')]=_[_0xea2e('0x33')](_0x4708dc[_0xea2e('0x30')],{'$or':_[_0xea2e('0x23')](_0x4708dc[_0xea2e('0x2b')],function(_0x1de5da){var _0x250819={};_0x250819[_0x1de5da]={'$like':'%'+_0xd82b79['query'][_0xea2e('0x32')]+'%'};return _0x250819;})});}_0x4708dc=_[_0xea2e('0x33')]({},_0x4708dc,_0xd82b79[_0xea2e('0x44')]);return _0x1cf245[_0xea2e('0x41')](_0x4708dc);}})[_0xea2e('0x20')](function(_0x53bd60){if(_0x53bd60){_0xe2daa=_0x53bd60[_0xea2e('0x3d')];if(!_0xd82b79['query'][_0xea2e('0x45')](_0xea2e('0x2d'))){_0x4708dc['limit']=qs['limit'](_0xd82b79[_0xea2e('0x28')][_0xea2e('0x1b')]);_0x4708dc[_0xea2e('0x19')]=qs[_0xea2e('0x19')](_0xd82b79['query'][_0xea2e('0x19')]);}return _0x1cf245[_0xea2e('0x41')](_0x4708dc);}})[_0xea2e('0x20')](function(_0x558036){if(_0x558036){return _0x558036?{'count':_0xe2daa,'rows':_0x558036}:null;}})[_0xea2e('0x20')](respondWithResult(_0x3efbec,null))[_0xea2e('0x3a')](handleError(_0x3efbec,null));};exports['addConfiguration']=function(_0x1683d0,_0x12d649,_0x3a39e8){if(_0x1683d0[_0xea2e('0x40')]['id']){delete _0x1683d0[_0xea2e('0x40')]['id'];}return db[_0xea2e('0x24')][_0xea2e('0x42')]({'where':{'id':_0x1683d0[_0xea2e('0x3c')]['id']}})[_0xea2e('0x20')](handleEntityNotFound(_0x12d649,null))[_0xea2e('0x20')](function(_0x439674){if(_0x439674){_0x1683d0[_0xea2e('0x40')][_0xea2e('0x46')]=_0x439674['id'];_0x1683d0['body'][_0xea2e('0x47')]=integrations[_0xea2e('0x48')](_0x1683d0[_0xea2e('0x40')][_0xea2e('0x49')],_0x1683d0[_0xea2e('0x40')][_0xea2e('0x34')]);_0x1683d0[_0xea2e('0x40')]['Descriptions']=integrations[_0xea2e('0x4a')](_0x1683d0[_0xea2e('0x40')][_0xea2e('0x49')],_0x1683d0[_0xea2e('0x40')][_0xea2e('0x34')]);return db['DeskConfiguration'][_0xea2e('0x3f')](_0x1683d0[_0xea2e('0x40')],{'include':[{'model':db['DeskField'],'as':_0xea2e('0x47')},{'model':db['DeskField'],'as':'Descriptions'}]});}return null;})[_0xea2e('0x20')](respondWithResult(_0x12d649,null))['catch'](handleError(_0x12d649,null));};exports[_0xea2e('0x4b')]=function(_0x3e26b7,_0x1d9126,_0x58a851){var _0x492453=[{'name':_0xea2e('0x4c'),'label':_0xea2e('0x4c'),'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 _0x325760='';return db['DeskAccount'][_0xea2e('0x42')]({'where':{'id':_0x3e26b7[_0xea2e('0x3c')]['id']},'attributes':['id',_0xea2e('0x4d'),_0xea2e('0x4e'),_0xea2e('0x4f'),'password','consumerKey',_0xea2e('0x50'),'token',_0xea2e('0x51')]})[_0xea2e('0x20')](handleEntityNotFound(_0x1d9126,null))[_0xea2e('0x20')](function(_0x3fcecd){if(_0x3fcecd){_0x325760=_0x3fcecd[_0xea2e('0x4d')];var _0x15e2c5=_0x325760[_0xea2e('0x52')](-0x1);if(_0x15e2c5==='/'){_0x325760=_0x325760[_0xea2e('0x53')](0x0,_0x325760[_0xea2e('0x54')](_0x15e2c5));}var _0x40b201={'method':'GET','uri':util['format']('%s/custom_fields',_0x325760),'headers':{'Content-Type':_0xea2e('0x55'),'Accept':_0xea2e('0x55')},'json':!![]};if(_0x3fcecd[_0xea2e('0x4e')]==='basic'){_0x40b201[_0xea2e('0x56')][_0xea2e('0x57')]=util[_0xea2e('0x58')](_0xea2e('0x59'),new Buffer(util[_0xea2e('0x58')](_0xea2e('0x5a'),_0x3fcecd['username'],_0x3fcecd[_0xea2e('0x5b')]))['toString'](_0xea2e('0x5c')));}return rp(_0x40b201)[_0xea2e('0x20')](function(_0x44fd59){return _0x492453[_0xea2e('0x5d')](_[_0xea2e('0x23')](_0x44fd59['_embedded'][_0xea2e('0x5e')],function(_0x32a237){return{'id':_0x32a237[_0xea2e('0x22')],'name':_0x32a237[_0xea2e('0x22')],'type':_0x32a237[_0xea2e('0x34')],'active':_0x32a237['active'],'label':_0x32a237[_0xea2e('0x5f')],'custom':!![]};}));});}})[_0xea2e('0x20')](function(_0x555f8f){return{'count':_0x555f8f[_0xea2e('0x3d')],'rows':_0x555f8f};})[_0xea2e('0x20')](respondWithResult(_0x1d9126,null))[_0xea2e('0x3a')](function(_0x32691c){var _0x4a23a7=_0x3e26b7['query'][_0xea2e('0x60')]?0x1f4:_0x32691c[_0xea2e('0x61')]||0x1f4;logger[_0xea2e('0x62')]('getFields,\x20%s,\x20%s,\x20%s',_0xea2e('0x4b'),_0x4a23a7,JSON[_0xea2e('0x63')](_0x32691c));delete _0x32691c[_0xea2e('0x22')];if(_0x4a23a7===0x191){_0x4a23a7=0x190;}_0x1d9126[_0xea2e('0x16')](_0x4a23a7)[_0xea2e('0x64')](_0x3e26b7[_0xea2e('0x28')][_0xea2e('0x60')]?{'message':_0xea2e('0x65'),'statusCode':_0x32691c['statusCode']}:_0x32691c);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 1b9d24a..5e7c74d 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 _0x49c1=['util','../../config/logger','api','moment','bluebird','request-promise','path','./intDeskAccount.attributes','exports','define','DeskAccount','int_desk_accounts'];(function(_0x2d0384,_0xae28cd){var _0x381567=function(_0x5eeec0){while(--_0x5eeec0){_0x2d0384['push'](_0x2d0384['shift']());}};_0x381567(++_0xae28cd);}(_0x49c1,0x168));var _0x149c=function(_0x1fe2dd,_0x14917a){_0x1fe2dd=_0x1fe2dd-0x0;var _0x159f82=_0x49c1[_0x1fe2dd];return _0x159f82;};'use strict';var _=require('lodash');var util=require(_0x149c('0x0'));var logger=require(_0x149c('0x1'))(_0x149c('0x2'));var moment=require(_0x149c('0x3'));var BPromise=require(_0x149c('0x4'));var rp=require(_0x149c('0x5'));var fs=require('fs');var path=require(_0x149c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x149c('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x149c('0x8')]=function(_0x516191,_0x41a9a0){return _0x516191[_0x149c('0x9')](_0x149c('0xa'),attributes,{'tableName':_0x149c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9438=['../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskAccount.attributes'];(function(_0xb95d44,_0x1402b4){var _0x521c07=function(_0x36b3fd){while(--_0x36b3fd){_0xb95d44['push'](_0xb95d44['shift']());}};_0x521c07(++_0x1402b4);}(_0x9438,0x122));var _0x8943=function(_0x465c68,_0x446cb6){_0x465c68=_0x465c68-0x0;var _0x41c631=_0x9438[_0x465c68];return _0x41c631;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8943('0x0'))('api');var moment=require(_0x8943('0x1'));var BPromise=require(_0x8943('0x2'));var rp=require(_0x8943('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8943('0x4'));var config=require(_0x8943('0x5'));var attributes=require(_0x8943('0x6'));var integrations=require(_0x8943('0x7'));module['exports']=function(_0x1d6e2d,_0x4888b2){return _0x1d6e2d[_0x8943('0x8')](_0x8943('0x9'),attributes,{'tableName':_0x8943('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index f76e0de..65ef6c3 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 _0xf5cf=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetDeskAccount','DeskAccount','findAll','options','raw','where','limit','map','attributes','include','model','debug','catch','ShowDeskAccount','find','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x12d245,_0x3ce3f7){var _0x58cf96=function(_0x14c5ee){while(--_0x14c5ee){_0x12d245['push'](_0x12d245['shift']());}};_0x58cf96(++_0x3ce3f7);}(_0xf5cf,0x8f));var _0xff5c=function(_0x372a38,_0x310c5f){_0x372a38=_0x372a38-0x0;var _0x194cac=_0xf5cf[_0x372a38];return _0x194cac;};'use strict';var _=require('lodash');var util=require(_0xff5c('0x0'));var moment=require(_0xff5c('0x1'));var BPromise=require(_0xff5c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff5c('0x3'));var db=require(_0xff5c('0x4'))['db'];var utils=require(_0xff5c('0x5'));var logger=require(_0xff5c('0x6'))(_0xff5c('0x7'));var config=require(_0xff5c('0x8'));var jayson=require(_0xff5c('0x9'));var client=jayson[_0xff5c('0xa')][_0xff5c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21a900,_0x24bceb,_0x18bf13){return new BPromise(function(_0x28ccf1,_0x3e7c14){return client[_0xff5c('0xc')](_0x21a900,_0x18bf13)[_0xff5c('0xd')](function(_0x474550){logger[_0xff5c('0xe')](_0xff5c('0xf'),_0x24bceb,_0xff5c('0x10'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x24bceb,'request\x20sent',JSON[_0xff5c('0x11')](_0x474550));if(_0x474550['error']){if(_0x474550[_0xff5c('0x12')][_0xff5c('0x13')]===0x1f4){logger[_0xff5c('0x12')](_0xff5c('0xf'),_0x24bceb,_0x474550[_0xff5c('0x12')][_0xff5c('0x14')]);return _0x3e7c14(_0x474550[_0xff5c('0x12')][_0xff5c('0x14')]);}logger[_0xff5c('0x12')](_0xff5c('0xf'),_0x24bceb,_0x474550[_0xff5c('0x12')][_0xff5c('0x14')]);return _0x28ccf1(_0x474550['error'][_0xff5c('0x14')]);}else{logger[_0xff5c('0xe')](_0xff5c('0xf'),_0x24bceb,_0xff5c('0x10'));_0x28ccf1(_0x474550[_0xff5c('0x15')][_0xff5c('0x14')]);}})['catch'](function(_0x11a956){logger[_0xff5c('0x12')](_0xff5c('0xf'),_0x24bceb,_0x11a956);_0x3e7c14(_0x11a956);});});}exports[_0xff5c('0x16')]=function(_0x33c8db){var _0x28a280=this;return new Promise(function(_0x4cc3ae,_0x3a89f9){return db[_0xff5c('0x17')][_0xff5c('0x18')]({'raw':_0x33c8db[_0xff5c('0x19')]?_0x33c8db[_0xff5c('0x19')][_0xff5c('0x1a')]===undefined?!![]:![]:!![],'where':_0x33c8db[_0xff5c('0x19')]?_0x33c8db['options'][_0xff5c('0x1b')]||null:null,'attributes':_0x33c8db[_0xff5c('0x19')]?_0x33c8db[_0xff5c('0x19')]['attributes']||null:null,'limit':_0x33c8db[_0xff5c('0x19')]?_0x33c8db[_0xff5c('0x19')][_0xff5c('0x1c')]||null:null,'include':_0x33c8db[_0xff5c('0x19')]?_0x33c8db['options']['include']?_[_0xff5c('0x1d')](_0x33c8db[_0xff5c('0x19')]['include'],function(_0x2615c4){return{'model':db[_0x2615c4['model']],'as':_0x2615c4['as'],'attributes':_0x2615c4[_0xff5c('0x1e')],'include':_0x2615c4[_0xff5c('0x1f')]?_[_0xff5c('0x1d')](_0x2615c4[_0xff5c('0x1f')],function(_0x49d570){return{'model':db[_0x49d570[_0xff5c('0x20')]],'as':_0x49d570['as'],'attributes':_0x49d570['attributes'],'include':_0x49d570['include']?_['map'](_0x49d570[_0xff5c('0x1f')],function(_0x4b0c65){return{'model':db[_0x4b0c65[_0xff5c('0x20')]],'as':_0x4b0c65['as'],'attributes':_0x4b0c65['attributes']};}):[]};}):[]};}):[]:[]})[_0xff5c('0xd')](function(_0x45522a){logger[_0xff5c('0xe')](_0xff5c('0x16'),_0x33c8db);logger[_0xff5c('0x21')](_0xff5c('0x16'),_0x33c8db,JSON[_0xff5c('0x11')](_0x45522a));_0x4cc3ae(_0x45522a);})[_0xff5c('0x22')](function(_0x5d5b17){logger[_0xff5c('0x12')]('GetDeskAccount',_0x5d5b17[_0xff5c('0x14')],_0x33c8db);_0x3a89f9(_0x28a280[_0xff5c('0x12')](0x1f4,_0x5d5b17[_0xff5c('0x14')]));});});};exports[_0xff5c('0x23')]=function(_0x5846e4){var _0x544ca1=this;return new Promise(function(_0x56bb24,_0x2d2e55){return db[_0xff5c('0x17')][_0xff5c('0x24')]({'raw':_0x5846e4[_0xff5c('0x19')]?_0x5846e4['options'][_0xff5c('0x1a')]===undefined?!![]:![]:!![],'where':_0x5846e4[_0xff5c('0x19')]?_0x5846e4[_0xff5c('0x19')]['where']||null:null,'attributes':_0x5846e4[_0xff5c('0x19')]?_0x5846e4[_0xff5c('0x19')][_0xff5c('0x1e')]||null:null,'include':_0x5846e4['options']?_0x5846e4[_0xff5c('0x19')]['include']?_['map'](_0x5846e4['options'][_0xff5c('0x1f')],function(_0x29f341){return{'model':db[_0x29f341[_0xff5c('0x20')]],'as':_0x29f341['as'],'attributes':_0x29f341[_0xff5c('0x1e')],'include':_0x29f341['include']?_[_0xff5c('0x1d')](_0x29f341[_0xff5c('0x1f')],function(_0x49b8b4){return{'model':db[_0x49b8b4[_0xff5c('0x20')]],'as':_0x49b8b4['as'],'attributes':_0x49b8b4[_0xff5c('0x1e')],'include':_0x49b8b4['include']?_[_0xff5c('0x1d')](_0x49b8b4[_0xff5c('0x1f')],function(_0x29d484){return{'model':db[_0x29d484[_0xff5c('0x20')]],'as':_0x29d484['as'],'attributes':_0x29d484[_0xff5c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xff5c('0xd')](function(_0x493c1e){logger[_0xff5c('0xe')](_0xff5c('0x23'),_0x5846e4);logger[_0xff5c('0x21')]('ShowDeskAccount',_0x5846e4,JSON['stringify'](_0x493c1e));_0x56bb24(_0x493c1e);})[_0xff5c('0x22')](function(_0x3bd147){logger[_0xff5c('0x12')](_0xff5c('0x23'),_0x3bd147[_0xff5c('0x14')],_0x5846e4);_0x2d2e55(_0x544ca1['error'](0x1f4,_0x3bd147[_0xff5c('0x14')]));});});}; \ No newline at end of file +var _0x0f7c=['../../config/logger','rpc','../../config/environment','client','http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','DeskAccount','options','raw','where','include','map','model','attributes','GetDeskAccount','debug','ShowDeskAccount','find','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0f7c,0xe2));var _0xc0f7=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x0f7c[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require('lodash');var util=require(_0xc0f7('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc0f7('0x1'));var fs=require('fs');var Redis=require(_0xc0f7('0x2'));var db=require(_0xc0f7('0x3'))['db'];var utils=require(_0xc0f7('0x4'));var logger=require(_0xc0f7('0x5'))(_0xc0f7('0x6'));var config=require(_0xc0f7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc0f7('0x8')][_0xc0f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5cc507,_0x362ff7,_0x5a242a){return new BPromise(function(_0x4018be,_0xc75f7){return client[_0xc0f7('0xa')](_0x5cc507,_0x5a242a)[_0xc0f7('0xb')](function(_0x4e4377){logger['info'](_0xc0f7('0xc'),_0x362ff7,_0xc0f7('0xd'));logger['debug'](_0xc0f7('0xe'),_0x362ff7,_0xc0f7('0xd'),JSON[_0xc0f7('0xf')](_0x4e4377));if(_0x4e4377[_0xc0f7('0x10')]){if(_0x4e4377[_0xc0f7('0x10')][_0xc0f7('0x11')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x362ff7,_0x4e4377[_0xc0f7('0x10')][_0xc0f7('0x12')]);return _0xc75f7(_0x4e4377[_0xc0f7('0x10')]['message']);}logger['error'](_0xc0f7('0xc'),_0x362ff7,_0x4e4377[_0xc0f7('0x10')][_0xc0f7('0x12')]);return _0x4018be(_0x4e4377[_0xc0f7('0x10')][_0xc0f7('0x12')]);}else{logger[_0xc0f7('0x13')](_0xc0f7('0xc'),_0x362ff7,_0xc0f7('0xd'));_0x4018be(_0x4e4377[_0xc0f7('0x14')][_0xc0f7('0x12')]);}})['catch'](function(_0x172de4){logger[_0xc0f7('0x10')](_0xc0f7('0xc'),_0x362ff7,_0x172de4);_0xc75f7(_0x172de4);});});}exports['GetDeskAccount']=function(_0x1efc13){var _0x4ca8dd=this;return new Promise(function(_0xb4dcee,_0x16bce1){return db[_0xc0f7('0x15')]['findAll']({'raw':_0x1efc13[_0xc0f7('0x16')]?_0x1efc13[_0xc0f7('0x16')][_0xc0f7('0x17')]===undefined?!![]:![]:!![],'where':_0x1efc13['options']?_0x1efc13[_0xc0f7('0x16')][_0xc0f7('0x18')]||null:null,'attributes':_0x1efc13[_0xc0f7('0x16')]?_0x1efc13[_0xc0f7('0x16')]['attributes']||null:null,'limit':_0x1efc13[_0xc0f7('0x16')]?_0x1efc13[_0xc0f7('0x16')]['limit']||null:null,'include':_0x1efc13[_0xc0f7('0x16')]?_0x1efc13[_0xc0f7('0x16')][_0xc0f7('0x19')]?_[_0xc0f7('0x1a')](_0x1efc13[_0xc0f7('0x16')][_0xc0f7('0x19')],function(_0x20b641){return{'model':db[_0x20b641[_0xc0f7('0x1b')]],'as':_0x20b641['as'],'attributes':_0x20b641[_0xc0f7('0x1c')],'include':_0x20b641['include']?_[_0xc0f7('0x1a')](_0x20b641[_0xc0f7('0x19')],function(_0x5b5295){return{'model':db[_0x5b5295['model']],'as':_0x5b5295['as'],'attributes':_0x5b5295[_0xc0f7('0x1c')],'include':_0x5b5295[_0xc0f7('0x19')]?_[_0xc0f7('0x1a')](_0x5b5295['include'],function(_0x35d847){return{'model':db[_0x35d847[_0xc0f7('0x1b')]],'as':_0x35d847['as'],'attributes':_0x35d847['attributes']};}):[]};}):[]};}):[]:[]})[_0xc0f7('0xb')](function(_0x218670){logger[_0xc0f7('0x13')](_0xc0f7('0x1d'),_0x1efc13);logger[_0xc0f7('0x1e')](_0xc0f7('0x1d'),_0x1efc13,JSON[_0xc0f7('0xf')](_0x218670));_0xb4dcee(_0x218670);})['catch'](function(_0x3cf987){logger[_0xc0f7('0x10')](_0xc0f7('0x1d'),_0x3cf987['message'],_0x1efc13);_0x16bce1(_0x4ca8dd[_0xc0f7('0x10')](0x1f4,_0x3cf987[_0xc0f7('0x12')]));});});};exports[_0xc0f7('0x1f')]=function(_0x21a6c2){var _0x37cc7f=this;return new Promise(function(_0x4350c2,_0x331e89){return db['DeskAccount'][_0xc0f7('0x20')]({'raw':_0x21a6c2[_0xc0f7('0x16')]?_0x21a6c2[_0xc0f7('0x16')][_0xc0f7('0x17')]===undefined?!![]:![]:!![],'where':_0x21a6c2[_0xc0f7('0x16')]?_0x21a6c2[_0xc0f7('0x16')]['where']||null:null,'attributes':_0x21a6c2['options']?_0x21a6c2[_0xc0f7('0x16')][_0xc0f7('0x1c')]||null:null,'include':_0x21a6c2['options']?_0x21a6c2['options'][_0xc0f7('0x19')]?_['map'](_0x21a6c2[_0xc0f7('0x16')][_0xc0f7('0x19')],function(_0x184c54){return{'model':db[_0x184c54[_0xc0f7('0x1b')]],'as':_0x184c54['as'],'attributes':_0x184c54[_0xc0f7('0x1c')],'include':_0x184c54[_0xc0f7('0x19')]?_['map'](_0x184c54[_0xc0f7('0x19')],function(_0x340a90){return{'model':db[_0x340a90[_0xc0f7('0x1b')]],'as':_0x340a90['as'],'attributes':_0x340a90[_0xc0f7('0x1c')],'include':_0x340a90[_0xc0f7('0x19')]?_['map'](_0x340a90[_0xc0f7('0x19')],function(_0x74f5e2){return{'model':db[_0x74f5e2[_0xc0f7('0x1b')]],'as':_0x74f5e2['as'],'attributes':_0x74f5e2[_0xc0f7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc0f7('0xb')](function(_0x1d3aaa){logger[_0xc0f7('0x13')](_0xc0f7('0x1f'),_0x21a6c2);logger[_0xc0f7('0x1e')]('ShowDeskAccount',_0x21a6c2,JSON[_0xc0f7('0xf')](_0x1d3aaa));_0x4350c2(_0x1d3aaa);})['catch'](function(_0x4d583d){logger['error'](_0xc0f7('0x1f'),_0x4d583d[_0xc0f7('0x12')],_0x21a6c2);_0x331e89(_0x37cc7f[_0xc0f7('0x10')](0x1f4,_0x4d583d[_0xc0f7('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index e6d213f..3282605 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x39124e,_0x15f4bf){var _0x1ad849=function(_0x74d7ba){while(--_0x74d7ba){_0x39124e['push'](_0x39124e['shift']());}};_0x1ad849(++_0x15f4bf);}(_0x3e74,0x175));var _0x43e7=function(_0xe34f08,_0x1ec62c){_0xe34f08=_0xe34f08-0x0;var _0x54724b=_0x3e74[_0xe34f08];return _0x54724b;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/subjects',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/tags',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0x13'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router['put']('/:id',auth[_0x43e7('0x8')](),controller[_0x43e7('0x15')]);router[_0x43e7('0x16')](_0x43e7('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x43e7('0x17')]=router; \ No newline at end of file +var _0x3e74=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x5bb22f,_0x515720){var _0x251f38=function(_0x30500b){while(--_0x30500b){_0x5bb22f['push'](_0x5bb22f['shift']());}};_0x251f38(++_0x515720);}(_0x3e74,0x175));var _0x43e7=function(_0x500e77,_0x3772b6){_0x500e77=_0x500e77-0x0;var _0x2f09e0=_0x3e74[_0x500e77];return _0x2f09e0;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/subjects',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/tags',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0x13'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router['put']('/:id',auth[_0x43e7('0x8')](),controller[_0x43e7('0x15')]);router[_0x43e7('0x16')](_0x43e7('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x43e7('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 8088992..d9d78df 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 _0xeb09=['STRING','sequelize'];(function(_0x542ce8,_0x206715){var _0x36838a=function(_0x277a6a){while(--_0x277a6a){_0x542ce8['push'](_0x542ce8['shift']());}};_0x36838a(++_0x206715);}(_0xeb09,0x1bf));var _0x9eb0=function(_0x1727c1,_0x19afcd){_0x1727c1=_0x1727c1-0x0;var _0x412013=_0xeb09[_0x1727c1];return _0x412013;};'use strict';var Sequelize=require(_0x9eb0('0x0'));module['exports']={'name':{'type':Sequelize[_0x9eb0('0x1')]},'description':{'type':Sequelize[_0x9eb0('0x1')]}}; \ No newline at end of file +var _0x8f00=['STRING','sequelize','exports'];(function(_0x43420c,_0xa401d1){var _0xddf38a=function(_0x520db0){while(--_0x520db0){_0x43420c['push'](_0x43420c['shift']());}};_0xddf38a(++_0xa401d1);}(_0x8f00,0x64));var _0x08f0=function(_0x418a58,_0x1df451){_0x418a58=_0x418a58-0x0;var _0x4c7d6d=_0x8f00[_0x418a58];return _0x4c7d6d;};'use strict';var Sequelize=require(_0x08f0('0x0'));module[_0x08f0('0x1')]={'name':{'type':Sequelize[_0x08f0('0x2')]},'description':{'type':Sequelize[_0x08f0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 695ea57..fe647c8 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 _0x74c3=['moment','mustache','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','Content-Range','apply','reject','update','destroy','error','stack','name','send','index','DeskConfiguration','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','then','rows','catch','params','includeAll','find','create','body','getFields','findOne','DeskField','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir'];(function(_0x5379f2,_0x5e8877){var _0x47c456=function(_0x1d418b){while(--_0x1d418b){_0x5379f2['push'](_0x5379f2['shift']());}};_0x47c456(++_0x5e8877);}(_0x74c3,0x1e3));var _0x374c=function(_0x2113c9,_0x23d7c0){_0x2113c9=_0x2113c9-0x0;var _0x30c266=_0x74c3[_0x2113c9];return _0x30c266;};'use strict';var emlformat=require(_0x374c('0x0'));var rimraf=require(_0x374c('0x1'));var zipdir=require(_0x374c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x374c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x374c('0x4'));var util=require('util');var path=require('path');var sox=require(_0x374c('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x374c('0x6'));var _=require(_0x374c('0x7'));var squel=require(_0x374c('0x8'));var crypto=require('crypto');var jsforce=require(_0x374c('0x9'));var deskjs=require(_0x374c('0xa'));var toCsv=require(_0x374c('0xb'));var querystring=require('querystring');var Papa=require(_0x374c('0xc'));var Redis=require(_0x374c('0xd'));var authService=require(_0x374c('0xe'));var qs=require(_0x374c('0xf'));var as=require(_0x374c('0x10'));var hardwareService=require(_0x374c('0x11'));var logger=require(_0x374c('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x374c('0x13'));var db=require(_0x374c('0x14'))['db'];function respondWithStatusCode(_0x5949fd,_0x196947){_0x196947=_0x196947||0xcc;return function(_0x56d544){if(_0x56d544){return _0x5949fd[_0x374c('0x15')](_0x196947);}return _0x5949fd[_0x374c('0x16')](_0x196947)['end']();};}function respondWithResult(_0x539bbe,_0x3d46cd){_0x3d46cd=_0x3d46cd||0xc8;return function(_0x483f1b){if(_0x483f1b){return _0x539bbe['status'](_0x3d46cd)[_0x374c('0x17')](_0x483f1b);}};}function respondWithFilteredResult(_0x3c8bb2,_0x5a144a){return function(_0x5ab8ab){if(_0x5ab8ab){var _0x51778b=typeof _0x5a144a[_0x374c('0x18')]===_0x374c('0x19')&&typeof _0x5a144a['limit']===_0x374c('0x19');var _0x43144d=_0x5ab8ab[_0x374c('0x1a')];var _0x59c16d=_0x51778b?0x0:_0x5a144a[_0x374c('0x18')];var _0x1d51e0=_0x51778b?_0x5ab8ab['count']:_0x5a144a[_0x374c('0x18')]+_0x5a144a['limit'];var _0x3acf14;if(_0x1d51e0>=_0x43144d){_0x1d51e0=_0x43144d;_0x3acf14=0xc8;}else{_0x3acf14=0xce;}_0x3c8bb2[_0x374c('0x16')](_0x3acf14);return _0x3c8bb2['set'](_0x374c('0x1b'),_0x59c16d+'-'+_0x1d51e0+'/'+_0x43144d)[_0x374c('0x17')](_0x5ab8ab);}return null;};}function patchUpdates(_0x1ee851){return function(_0x8fcbc5){try{jsonpatch[_0x374c('0x1c')](_0x8fcbc5,_0x1ee851,!![]);}catch(_0x39043b){return BPromise[_0x374c('0x1d')](_0x39043b);}return _0x8fcbc5['save']();};}function saveUpdates(_0x571d25,_0x3e7608){return function(_0x3aee56){if(_0x3aee56){return _0x3aee56[_0x374c('0x1e')](_0x571d25)['then'](function(_0x182c4c){return _0x182c4c;});}return null;};}function removeEntity(_0x22fab1,_0x41df60){return function(_0x3330c9){if(_0x3330c9){return _0x3330c9[_0x374c('0x1f')]()['then'](function(){_0x22fab1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x27a03b,_0x1fa783){return function(_0x4db215){if(!_0x4db215){_0x27a03b[_0x374c('0x15')](0x194);}return _0x4db215;};}function handleError(_0x707bbf,_0x59aac6){_0x59aac6=_0x59aac6||0x1f4;return function(_0x169092){logger[_0x374c('0x20')](_0x169092[_0x374c('0x21')]);if(_0x169092[_0x374c('0x22')]){delete _0x169092['name'];}_0x707bbf[_0x374c('0x16')](_0x59aac6)[_0x374c('0x23')](_0x169092);};}exports[_0x374c('0x24')]=function(_0x46f509,_0x3c795e){var _0x35e71c={},_0x44e505={},_0x16b5b8={'count':0x0,'rows':[]};var _0x31536b=_['map'](db[_0x374c('0x25')][_0x374c('0x26')],function(_0x37db26){return{'name':_0x37db26[_0x374c('0x27')],'type':_0x37db26['type'][_0x374c('0x28')]};});_0x44e505[_0x374c('0x29')]=_[_0x374c('0x2a')](_0x31536b,'name');_0x44e505[_0x374c('0x2b')]=_[_0x374c('0x2c')](_0x46f509[_0x374c('0x2b')]);_0x44e505[_0x374c('0x2d')]=_['intersection'](_0x44e505['model'],_0x44e505[_0x374c('0x2b')]);_0x35e71c[_0x374c('0x2e')]=_[_0x374c('0x2f')](_0x44e505[_0x374c('0x29')],qs['fields'](_0x46f509[_0x374c('0x2b')][_0x374c('0x30')]));_0x35e71c[_0x374c('0x2e')]=_0x35e71c[_0x374c('0x2e')][_0x374c('0x31')]?_0x35e71c[_0x374c('0x2e')]:_0x44e505['model'];if(!_0x46f509['query'][_0x374c('0x32')](_0x374c('0x33'))){_0x35e71c[_0x374c('0x34')]=qs[_0x374c('0x34')](_0x46f509[_0x374c('0x2b')][_0x374c('0x34')]);_0x35e71c[_0x374c('0x18')]=qs[_0x374c('0x18')](_0x46f509[_0x374c('0x2b')]['offset']);}_0x35e71c[_0x374c('0x35')]=qs['sort'](_0x46f509[_0x374c('0x2b')][_0x374c('0x36')]);_0x35e71c[_0x374c('0x37')]=qs[_0x374c('0x2d')](_['pick'](_0x46f509['query'],_0x44e505[_0x374c('0x2d')]),_0x31536b);if(_0x46f509['query'][_0x374c('0x38')]){_0x35e71c[_0x374c('0x37')]=_[_0x374c('0x39')](_0x35e71c[_0x374c('0x37')],{'$or':_[_0x374c('0x2a')](_0x31536b,function(_0x2b109d){if(_0x2b109d[_0x374c('0x3a')]!==_0x374c('0x3b')){var _0x2f647c={};_0x2f647c[_0x2b109d['name']]={'$like':'%'+_0x46f509['query'][_0x374c('0x38')]+'%'};return _0x2f647c;}})});}_0x35e71c=_[_0x374c('0x39')]({},_0x35e71c,_0x46f509[_0x374c('0x3c')]);var _0x3495f6={'where':_0x35e71c[_0x374c('0x37')]};return db[_0x374c('0x25')][_0x374c('0x1a')](_0x3495f6)['then'](function(_0x5615b8){_0x16b5b8[_0x374c('0x1a')]=_0x5615b8;if(_0x46f509[_0x374c('0x2b')]['includeAll']){_0x35e71c[_0x374c('0x3d')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x374c('0x3e')](_0x35e71c);})[_0x374c('0x3f')](function(_0x14b464){_0x16b5b8[_0x374c('0x40')]=_0x14b464;return _0x16b5b8;})[_0x374c('0x3f')](respondWithFilteredResult(_0x3c795e,_0x35e71c))[_0x374c('0x41')](handleError(_0x3c795e,null));};exports['show']=function(_0x4e1181,_0x1b0408){var _0x50b4cb={'raw':![],'where':{'id':_0x4e1181[_0x374c('0x42')]['id']}},_0x1d6725={};_0x1d6725[_0x374c('0x29')]=_[_0x374c('0x2c')](db['DeskConfiguration'][_0x374c('0x26')]);_0x1d6725[_0x374c('0x2b')]=_[_0x374c('0x2c')](_0x4e1181[_0x374c('0x2b')]);_0x1d6725[_0x374c('0x2d')]=_[_0x374c('0x2f')](_0x1d6725[_0x374c('0x29')],_0x1d6725[_0x374c('0x2b')]);_0x50b4cb[_0x374c('0x2e')]=_[_0x374c('0x2f')](_0x1d6725[_0x374c('0x29')],qs[_0x374c('0x30')](_0x4e1181[_0x374c('0x2b')]['fields']));_0x50b4cb[_0x374c('0x2e')]=_0x50b4cb['attributes'][_0x374c('0x31')]?_0x50b4cb[_0x374c('0x2e')]:_0x1d6725['model'];if(_0x4e1181['query'][_0x374c('0x43')]){_0x50b4cb[_0x374c('0x3d')]=[{'all':!![]}];}_0x50b4cb=_[_0x374c('0x39')]({},_0x50b4cb,_0x4e1181['options']);return db[_0x374c('0x25')][_0x374c('0x44')](_0x50b4cb)[_0x374c('0x3f')](handleEntityNotFound(_0x1b0408,null))[_0x374c('0x3f')](respondWithResult(_0x1b0408,null))[_0x374c('0x41')](handleError(_0x1b0408,null));};exports[_0x374c('0x45')]=function(_0x10bf1c,_0xe9308f){return db[_0x374c('0x25')][_0x374c('0x45')](_0x10bf1c[_0x374c('0x46')],{})[_0x374c('0x3f')](respondWithResult(_0xe9308f,0xc9))['catch'](handleError(_0xe9308f,null));};exports[_0x374c('0x1e')]=function(_0x5162a6,_0x44e038){if(_0x5162a6[_0x374c('0x46')]['id']){delete _0x5162a6[_0x374c('0x46')]['id'];}return db[_0x374c('0x25')][_0x374c('0x44')]({'where':{'id':_0x5162a6[_0x374c('0x42')]['id']}})[_0x374c('0x3f')](handleEntityNotFound(_0x44e038,null))[_0x374c('0x3f')](saveUpdates(_0x5162a6['body'],null))['then'](respondWithResult(_0x44e038,null))['catch'](handleError(_0x44e038,null));};exports['destroy']=function(_0x4ee569,_0x1e879d){return db[_0x374c('0x25')][_0x374c('0x44')]({'where':{'id':_0x4ee569[_0x374c('0x42')]['id']}})[_0x374c('0x3f')](handleEntityNotFound(_0x1e879d,null))['then'](removeEntity(_0x1e879d,null))[_0x374c('0x41')](handleError(_0x1e879d,null));};exports[_0x374c('0x47')]=function(_0x231d54,_0x5b30e3,_0x1a12f3){var _0x194e4c={};var _0x28b161={};var _0x16f35d;var _0x3c099a;return db[_0x374c('0x25')][_0x374c('0x48')]({'where':{'id':_0x231d54[_0x374c('0x42')]['id']}})['then'](handleEntityNotFound(_0x5b30e3,null))[_0x374c('0x3f')](function(_0x2cace3){if(_0x2cace3){_0x16f35d=_0x2cace3;_0x28b161[_0x374c('0x29')]=_[_0x374c('0x2c')](db[_0x374c('0x49')][_0x374c('0x26')]);_0x28b161[_0x374c('0x2b')]=_['keys'](_0x231d54[_0x374c('0x2b')]);_0x28b161['filters']=_[_0x374c('0x2f')](_0x28b161['model'],_0x28b161[_0x374c('0x2b')]);_0x194e4c['attributes']=_[_0x374c('0x2f')](_0x28b161[_0x374c('0x29')],qs[_0x374c('0x30')](_0x231d54[_0x374c('0x2b')][_0x374c('0x30')]));_0x194e4c[_0x374c('0x2e')]=_0x194e4c['attributes'][_0x374c('0x31')]?_0x194e4c[_0x374c('0x2e')]:_0x28b161['model'];_0x194e4c['order']=qs[_0x374c('0x36')](_0x231d54['query']['sort']);_0x194e4c['where']=qs[_0x374c('0x2d')](_[_0x374c('0x4a')](_0x231d54[_0x374c('0x2b')],_0x28b161['filters']));if(_0x231d54['query'][_0x374c('0x38')]){_0x194e4c[_0x374c('0x37')]=_['merge'](_0x194e4c['where'],{'$or':_[_0x374c('0x2a')](_0x194e4c[_0x374c('0x2e')],function(_0x5b77e1){var _0x2e67a2={};_0x2e67a2[_0x5b77e1]={'$like':'%'+_0x231d54[_0x374c('0x2b')][_0x374c('0x38')]+'%'};return _0x2e67a2;})});}_0x194e4c=_['merge']({},_0x194e4c,_0x231d54[_0x374c('0x3c')]);return _0x16f35d[_0x374c('0x47')](_0x194e4c);}})[_0x374c('0x3f')](function(_0x24fabc){if(_0x24fabc){_0x3c099a=_0x24fabc['length'];if(!_0x231d54['query']['hasOwnProperty'](_0x374c('0x33'))){_0x194e4c[_0x374c('0x34')]=qs['limit'](_0x231d54[_0x374c('0x2b')][_0x374c('0x34')]);_0x194e4c['offset']=qs[_0x374c('0x18')](_0x231d54[_0x374c('0x2b')][_0x374c('0x18')]);}return _0x16f35d['getFields'](_0x194e4c);}})[_0x374c('0x3f')](function(_0x55b863){if(_0x55b863){return _0x55b863?{'count':_0x3c099a,'rows':_0x55b863}:null;}})[_0x374c('0x3f')](respondWithResult(_0x5b30e3,null))['catch'](handleError(_0x5b30e3,null));};exports[_0x374c('0x4b')]=function(_0x3fe274,_0x3daf7a,_0x1701c3){var _0x6595fd={};var _0x5b6103={};var _0x2bc687;var _0x43757f;return db[_0x374c('0x25')][_0x374c('0x48')]({'where':{'id':_0x3fe274[_0x374c('0x42')]['id']}})[_0x374c('0x3f')](handleEntityNotFound(_0x3daf7a,null))[_0x374c('0x3f')](function(_0x441cd7){if(_0x441cd7){_0x2bc687=_0x441cd7;_0x5b6103['model']=_[_0x374c('0x2c')](db['DeskField']['rawAttributes']);_0x5b6103[_0x374c('0x2b')]=_[_0x374c('0x2c')](_0x3fe274['query']);_0x5b6103[_0x374c('0x2d')]=_[_0x374c('0x2f')](_0x5b6103[_0x374c('0x29')],_0x5b6103['query']);_0x6595fd[_0x374c('0x2e')]=_['intersection'](_0x5b6103[_0x374c('0x29')],qs['fields'](_0x3fe274[_0x374c('0x2b')][_0x374c('0x30')]));_0x6595fd[_0x374c('0x2e')]=_0x6595fd[_0x374c('0x2e')]['length']?_0x6595fd[_0x374c('0x2e')]:_0x5b6103[_0x374c('0x29')];_0x6595fd[_0x374c('0x35')]=qs[_0x374c('0x36')](_0x3fe274[_0x374c('0x2b')]['sort']);_0x6595fd[_0x374c('0x37')]=qs[_0x374c('0x2d')](_[_0x374c('0x4a')](_0x3fe274[_0x374c('0x2b')],_0x5b6103[_0x374c('0x2d')]));if(_0x3fe274[_0x374c('0x2b')][_0x374c('0x38')]){_0x6595fd[_0x374c('0x37')]=_[_0x374c('0x39')](_0x6595fd[_0x374c('0x37')],{'$or':_['map'](_0x6595fd['attributes'],function(_0x17e2e6){var _0x3594b3={};_0x3594b3[_0x17e2e6]={'$like':'%'+_0x3fe274[_0x374c('0x2b')]['filter']+'%'};return _0x3594b3;})});}_0x6595fd=_[_0x374c('0x39')]({},_0x6595fd,_0x3fe274[_0x374c('0x3c')]);return _0x2bc687[_0x374c('0x4b')](_0x6595fd);}})[_0x374c('0x3f')](function(_0x4fb326){if(_0x4fb326){_0x43757f=_0x4fb326['length'];if(!_0x3fe274[_0x374c('0x2b')]['hasOwnProperty'](_0x374c('0x33'))){_0x6595fd[_0x374c('0x34')]=qs[_0x374c('0x34')](_0x3fe274[_0x374c('0x2b')][_0x374c('0x34')]);_0x6595fd['offset']=qs[_0x374c('0x18')](_0x3fe274[_0x374c('0x2b')][_0x374c('0x18')]);}return _0x2bc687['getSubjects'](_0x6595fd);}})[_0x374c('0x3f')](function(_0x2c3114){if(_0x2c3114){return _0x2c3114?{'count':_0x43757f,'rows':_0x2c3114}:null;}})[_0x374c('0x3f')](respondWithResult(_0x3daf7a,null))['catch'](handleError(_0x3daf7a,null));};exports[_0x374c('0x4c')]=function(_0x3a6119,_0xab9c85,_0x534e93){var _0x492d32={};var _0x5f3266={};var _0x5074dd;var _0x39a329;return db[_0x374c('0x25')][_0x374c('0x48')]({'where':{'id':_0x3a6119[_0x374c('0x42')]['id']}})[_0x374c('0x3f')](handleEntityNotFound(_0xab9c85,null))[_0x374c('0x3f')](function(_0x5c038c){if(_0x5c038c){_0x5074dd=_0x5c038c;_0x5f3266[_0x374c('0x29')]=_[_0x374c('0x2c')](db[_0x374c('0x49')]['rawAttributes']);_0x5f3266['query']=_[_0x374c('0x2c')](_0x3a6119[_0x374c('0x2b')]);_0x5f3266[_0x374c('0x2d')]=_[_0x374c('0x2f')](_0x5f3266[_0x374c('0x29')],_0x5f3266[_0x374c('0x2b')]);_0x492d32['attributes']=_['intersection'](_0x5f3266[_0x374c('0x29')],qs[_0x374c('0x30')](_0x3a6119['query'][_0x374c('0x30')]));_0x492d32[_0x374c('0x2e')]=_0x492d32[_0x374c('0x2e')][_0x374c('0x31')]?_0x492d32[_0x374c('0x2e')]:_0x5f3266[_0x374c('0x29')];_0x492d32[_0x374c('0x35')]=qs['sort'](_0x3a6119[_0x374c('0x2b')][_0x374c('0x36')]);_0x492d32[_0x374c('0x37')]=qs[_0x374c('0x2d')](_['pick'](_0x3a6119['query'],_0x5f3266[_0x374c('0x2d')]));if(_0x3a6119['query']['filter']){_0x492d32[_0x374c('0x37')]=_[_0x374c('0x39')](_0x492d32[_0x374c('0x37')],{'$or':_[_0x374c('0x2a')](_0x492d32['attributes'],function(_0x5a5369){var _0x2a0503={};_0x2a0503[_0x5a5369]={'$like':'%'+_0x3a6119['query'][_0x374c('0x38')]+'%'};return _0x2a0503;})});}_0x492d32=_[_0x374c('0x39')]({},_0x492d32,_0x3a6119['options']);return _0x5074dd[_0x374c('0x4c')](_0x492d32);}})[_0x374c('0x3f')](function(_0x43ade3){if(_0x43ade3){_0x39a329=_0x43ade3[_0x374c('0x31')];if(!_0x3a6119['query'][_0x374c('0x32')]('nolimit')){_0x492d32['limit']=qs[_0x374c('0x34')](_0x3a6119[_0x374c('0x2b')]['limit']);_0x492d32[_0x374c('0x18')]=qs[_0x374c('0x18')](_0x3a6119[_0x374c('0x2b')][_0x374c('0x18')]);}return _0x5074dd['getDescriptions'](_0x492d32);}})['then'](function(_0x4672b1){if(_0x4672b1){return _0x4672b1?{'count':_0x39a329,'rows':_0x4672b1}:null;}})[_0x374c('0x3f')](respondWithResult(_0xab9c85,null))[_0x374c('0x41')](handleError(_0xab9c85,null));};exports[_0x374c('0x4d')]=function(_0x43fbb2,_0x369d24,_0x480d01){var _0x8866e={};var _0x579cd5={};var _0x28171c;var _0x304606;return db[_0x374c('0x25')][_0x374c('0x48')]({'where':{'id':_0x43fbb2['params']['id']}})[_0x374c('0x3f')](handleEntityNotFound(_0x369d24,null))['then'](function(_0x4790da){if(_0x4790da){_0x28171c=_0x4790da;_0x579cd5['model']=_['keys'](db[_0x374c('0x4e')]['rawAttributes']);_0x579cd5[_0x374c('0x2b')]=_[_0x374c('0x2c')](_0x43fbb2[_0x374c('0x2b')]);_0x579cd5['filters']=_['intersection'](_0x579cd5[_0x374c('0x29')],_0x579cd5[_0x374c('0x2b')]);_0x8866e[_0x374c('0x2e')]=_['intersection'](_0x579cd5['model'],qs[_0x374c('0x30')](_0x43fbb2[_0x374c('0x2b')][_0x374c('0x30')]));_0x8866e[_0x374c('0x2e')]=_0x8866e[_0x374c('0x2e')][_0x374c('0x31')]?_0x8866e['attributes']:_0x579cd5['model'];_0x8866e['order']=qs[_0x374c('0x36')](_0x43fbb2[_0x374c('0x2b')][_0x374c('0x36')]);_0x8866e[_0x374c('0x37')]=qs['filters'](_['pick'](_0x43fbb2[_0x374c('0x2b')],_0x579cd5[_0x374c('0x2d')]));if(_0x43fbb2['query'][_0x374c('0x38')]){_0x8866e[_0x374c('0x37')]=_[_0x374c('0x39')](_0x8866e[_0x374c('0x37')],{'$or':_['map'](_0x8866e['attributes'],function(_0x37f83a){var _0x1efaae={};_0x1efaae[_0x37f83a]={'$like':'%'+_0x43fbb2['query'][_0x374c('0x38')]+'%'};return _0x1efaae;})});}_0x8866e=_[_0x374c('0x39')]({},_0x8866e,_0x43fbb2[_0x374c('0x3c')]);return _0x28171c['getTags'](_0x8866e);}})[_0x374c('0x3f')](function(_0x253dfb){if(_0x253dfb){_0x304606=_0x253dfb[_0x374c('0x31')];if(!_0x43fbb2['query'][_0x374c('0x32')]('nolimit')){_0x8866e[_0x374c('0x34')]=qs[_0x374c('0x34')](_0x43fbb2[_0x374c('0x2b')]['limit']);_0x8866e[_0x374c('0x18')]=qs[_0x374c('0x18')](_0x43fbb2[_0x374c('0x2b')]['offset']);}return _0x28171c['getTags'](_0x8866e);}})[_0x374c('0x3f')](function(_0x4b2272){if(_0x4b2272){return _0x4b2272?{'count':_0x304606,'rows':_0x4b2272}:null;}})[_0x374c('0x3f')](respondWithResult(_0x369d24,null))[_0x374c('0x41')](handleError(_0x369d24,null));};exports[_0x374c('0x4f')]=function(_0x5218f4,_0x3f3014,_0x532b44){if(_0x5218f4[_0x374c('0x46')]['id']){delete _0x5218f4[_0x374c('0x46')]['id'];}return db[_0x374c('0x25')]['findOne']({'where':{'id':_0x5218f4[_0x374c('0x42')]['id']}})[_0x374c('0x3f')](handleEntityNotFound(_0x3f3014,null))[_0x374c('0x3f')](function(_0x25be36){if(_0x25be36){return _0x25be36[_0x374c('0x4f')](_0x5218f4['body'][_0x374c('0x50')]||[]);}return null;})[_0x374c('0x3f')](respondWithResult(_0x3f3014,null))[_0x374c('0x41')](handleError(_0x3f3014,null));}; \ No newline at end of file +var _0x6d5c=['limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','index','rawAttributes','fieldName','type','model','map','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','DeskConfiguration','include','rows','catch','show','params','intersection','find','create','body','update','filter','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','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'];(function(_0x291ad0,_0x37cc19){var _0x156607=function(_0x5b2de0){while(--_0x5b2de0){_0x291ad0['push'](_0x291ad0['shift']());}};_0x156607(++_0x37cc19);}(_0x6d5c,0xe2));var _0xc6d5=function(_0x2f38c8,_0x5e4ebd){_0x2f38c8=_0x2f38c8-0x0;var _0x5d46a4=_0x6d5c[_0x2f38c8];return _0x5d46a4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc6d5('0x0'));var zipdir=require(_0xc6d5('0x1'));var jsonpatch=require(_0xc6d5('0x2'));var rp=require(_0xc6d5('0x3'));var moment=require(_0xc6d5('0x4'));var BPromise=require(_0xc6d5('0x5'));var Mustache=require(_0xc6d5('0x6'));var util=require(_0xc6d5('0x7'));var path=require(_0xc6d5('0x8'));var sox=require(_0xc6d5('0x9'));var csv=require(_0xc6d5('0xa'));var ejs=require(_0xc6d5('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc6d5('0xc'));var squel=require(_0xc6d5('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc6d5('0xe'));var toCsv=require(_0xc6d5('0xa'));var querystring=require(_0xc6d5('0xf'));var Papa=require('papaparse');var Redis=require(_0xc6d5('0x10'));var authService=require(_0xc6d5('0x11'));var qs=require(_0xc6d5('0x12'));var as=require(_0xc6d5('0x13'));var hardwareService=require(_0xc6d5('0x14'));var logger=require(_0xc6d5('0x15'))(_0xc6d5('0x16'));var utils=require(_0xc6d5('0x17'));var config=require(_0xc6d5('0x18'));var licenseUtil=require(_0xc6d5('0x19'));var db=require(_0xc6d5('0x1a'))['db'];function respondWithStatusCode(_0x203b46,_0x292ce0){_0x292ce0=_0x292ce0||0xcc;return function(_0x3e5b54){if(_0x3e5b54){return _0x203b46[_0xc6d5('0x1b')](_0x292ce0);}return _0x203b46[_0xc6d5('0x1c')](_0x292ce0)[_0xc6d5('0x1d')]();};}function respondWithResult(_0x23fbac,_0x57a16c){_0x57a16c=_0x57a16c||0xc8;return function(_0x29ee03){if(_0x29ee03){return _0x23fbac[_0xc6d5('0x1c')](_0x57a16c)[_0xc6d5('0x1e')](_0x29ee03);}};}function respondWithFilteredResult(_0x8bc34e,_0x444500){return function(_0x4060c2){if(_0x4060c2){var _0x42b34f=typeof _0x444500[_0xc6d5('0x1f')]==='undefined'&&typeof _0x444500[_0xc6d5('0x20')]===_0xc6d5('0x21');var _0x39a30d=_0x4060c2[_0xc6d5('0x22')];var _0x18d774=_0x42b34f?0x0:_0x444500['offset'];var _0x7c505b=_0x42b34f?_0x4060c2[_0xc6d5('0x22')]:_0x444500[_0xc6d5('0x1f')]+_0x444500[_0xc6d5('0x20')];var _0x2938d6;if(_0x7c505b>=_0x39a30d){_0x7c505b=_0x39a30d;_0x2938d6=0xc8;}else{_0x2938d6=0xce;}_0x8bc34e[_0xc6d5('0x1c')](_0x2938d6);return _0x8bc34e[_0xc6d5('0x23')](_0xc6d5('0x24'),_0x18d774+'-'+_0x7c505b+'/'+_0x39a30d)[_0xc6d5('0x1e')](_0x4060c2);}return null;};}function patchUpdates(_0x5ac072){return function(_0x42191d){try{jsonpatch[_0xc6d5('0x25')](_0x42191d,_0x5ac072,!![]);}catch(_0x576047){return BPromise[_0xc6d5('0x26')](_0x576047);}return _0x42191d[_0xc6d5('0x27')]();};}function saveUpdates(_0x313f65,_0x6bb4cd){return function(_0x59b0ca){if(_0x59b0ca){return _0x59b0ca['update'](_0x313f65)[_0xc6d5('0x28')](function(_0x451a15){return _0x451a15;});}return null;};}function removeEntity(_0x125a55,_0x391e40){return function(_0x3e8d5c){if(_0x3e8d5c){return _0x3e8d5c[_0xc6d5('0x29')]()[_0xc6d5('0x28')](function(){_0x125a55[_0xc6d5('0x1c')](0xcc)[_0xc6d5('0x1d')]();});}};}function handleEntityNotFound(_0x3464b8,_0x215d31){return function(_0x1ff825){if(!_0x1ff825){_0x3464b8['sendStatus'](0x194);}return _0x1ff825;};}function handleError(_0x3be7e3,_0x145d40){_0x145d40=_0x145d40||0x1f4;return function(_0x2647c7){logger['error'](_0x2647c7[_0xc6d5('0x2a')]);if(_0x2647c7[_0xc6d5('0x2b')]){delete _0x2647c7['name'];}_0x3be7e3['status'](_0x145d40)['send'](_0x2647c7);};}exports[_0xc6d5('0x2c')]=function(_0x5394eb,_0x320965){var _0x2736c7={},_0x43605e={},_0xad018c={'count':0x0,'rows':[]};var _0x13f998=_['map'](db['DeskConfiguration'][_0xc6d5('0x2d')],function(_0x50a7c4){return{'name':_0x50a7c4[_0xc6d5('0x2e')],'type':_0x50a7c4[_0xc6d5('0x2f')]['key']};});_0x43605e[_0xc6d5('0x30')]=_[_0xc6d5('0x31')](_0x13f998,_0xc6d5('0x2b'));_0x43605e[_0xc6d5('0x32')]=_[_0xc6d5('0x33')](_0x5394eb[_0xc6d5('0x32')]);_0x43605e[_0xc6d5('0x34')]=_['intersection'](_0x43605e[_0xc6d5('0x30')],_0x43605e[_0xc6d5('0x32')]);_0x2736c7['attributes']=_['intersection'](_0x43605e['model'],qs[_0xc6d5('0x35')](_0x5394eb[_0xc6d5('0x32')][_0xc6d5('0x35')]));_0x2736c7[_0xc6d5('0x36')]=_0x2736c7['attributes'][_0xc6d5('0x37')]?_0x2736c7[_0xc6d5('0x36')]:_0x43605e[_0xc6d5('0x30')];if(!_0x5394eb[_0xc6d5('0x32')][_0xc6d5('0x38')](_0xc6d5('0x39'))){_0x2736c7[_0xc6d5('0x20')]=qs[_0xc6d5('0x20')](_0x5394eb[_0xc6d5('0x32')][_0xc6d5('0x20')]);_0x2736c7[_0xc6d5('0x1f')]=qs[_0xc6d5('0x1f')](_0x5394eb['query'][_0xc6d5('0x1f')]);}_0x2736c7[_0xc6d5('0x3a')]=qs[_0xc6d5('0x3b')](_0x5394eb['query'][_0xc6d5('0x3b')]);_0x2736c7[_0xc6d5('0x3c')]=qs[_0xc6d5('0x34')](_[_0xc6d5('0x3d')](_0x5394eb['query'],_0x43605e[_0xc6d5('0x34')]),_0x13f998);if(_0x5394eb['query']['filter']){_0x2736c7['where']=_[_0xc6d5('0x3e')](_0x2736c7[_0xc6d5('0x3c')],{'$or':_[_0xc6d5('0x31')](_0x13f998,function(_0x2b6722){if(_0x2b6722[_0xc6d5('0x2f')]!==_0xc6d5('0x3f')){var _0x36af93={};_0x36af93[_0x2b6722[_0xc6d5('0x2b')]]={'$like':'%'+_0x5394eb['query']['filter']+'%'};return _0x36af93;}})});}_0x2736c7=_['merge']({},_0x2736c7,_0x5394eb[_0xc6d5('0x40')]);var _0x18fd4d={'where':_0x2736c7[_0xc6d5('0x3c')]};return db[_0xc6d5('0x41')][_0xc6d5('0x22')](_0x18fd4d)[_0xc6d5('0x28')](function(_0x27d1d5){_0xad018c[_0xc6d5('0x22')]=_0x27d1d5;if(_0x5394eb[_0xc6d5('0x32')]['includeAll']){_0x2736c7[_0xc6d5('0x42')]=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x2736c7);})['then'](function(_0x42499d){_0xad018c[_0xc6d5('0x43')]=_0x42499d;return _0xad018c;})['then'](respondWithFilteredResult(_0x320965,_0x2736c7))[_0xc6d5('0x44')](handleError(_0x320965,null));};exports[_0xc6d5('0x45')]=function(_0x2f97ac,_0x94898e){var _0x1e068b={'raw':![],'where':{'id':_0x2f97ac[_0xc6d5('0x46')]['id']}},_0x450fbb={};_0x450fbb[_0xc6d5('0x30')]=_[_0xc6d5('0x33')](db['DeskConfiguration'][_0xc6d5('0x2d')]);_0x450fbb[_0xc6d5('0x32')]=_[_0xc6d5('0x33')](_0x2f97ac[_0xc6d5('0x32')]);_0x450fbb['filters']=_['intersection'](_0x450fbb[_0xc6d5('0x30')],_0x450fbb[_0xc6d5('0x32')]);_0x1e068b[_0xc6d5('0x36')]=_[_0xc6d5('0x47')](_0x450fbb[_0xc6d5('0x30')],qs[_0xc6d5('0x35')](_0x2f97ac[_0xc6d5('0x32')][_0xc6d5('0x35')]));_0x1e068b[_0xc6d5('0x36')]=_0x1e068b[_0xc6d5('0x36')]['length']?_0x1e068b[_0xc6d5('0x36')]:_0x450fbb[_0xc6d5('0x30')];if(_0x2f97ac[_0xc6d5('0x32')]['includeAll']){_0x1e068b[_0xc6d5('0x42')]=[{'all':!![]}];}_0x1e068b=_[_0xc6d5('0x3e')]({},_0x1e068b,_0x2f97ac[_0xc6d5('0x40')]);return db['DeskConfiguration'][_0xc6d5('0x48')](_0x1e068b)[_0xc6d5('0x28')](handleEntityNotFound(_0x94898e,null))[_0xc6d5('0x28')](respondWithResult(_0x94898e,null))[_0xc6d5('0x44')](handleError(_0x94898e,null));};exports[_0xc6d5('0x49')]=function(_0x2a887c,_0x58e84b){return db[_0xc6d5('0x41')]['create'](_0x2a887c[_0xc6d5('0x4a')],{})['then'](respondWithResult(_0x58e84b,0xc9))[_0xc6d5('0x44')](handleError(_0x58e84b,null));};exports[_0xc6d5('0x4b')]=function(_0x1135ea,_0x36a245){if(_0x1135ea['body']['id']){delete _0x1135ea[_0xc6d5('0x4a')]['id'];}return db[_0xc6d5('0x41')]['find']({'where':{'id':_0x1135ea[_0xc6d5('0x46')]['id']}})['then'](handleEntityNotFound(_0x36a245,null))[_0xc6d5('0x28')](saveUpdates(_0x1135ea[_0xc6d5('0x4a')],null))[_0xc6d5('0x28')](respondWithResult(_0x36a245,null))[_0xc6d5('0x44')](handleError(_0x36a245,null));};exports[_0xc6d5('0x29')]=function(_0x238621,_0x5b2171){return db[_0xc6d5('0x41')][_0xc6d5('0x48')]({'where':{'id':_0x238621[_0xc6d5('0x46')]['id']}})['then'](handleEntityNotFound(_0x5b2171,null))[_0xc6d5('0x28')](removeEntity(_0x5b2171,null))['catch'](handleError(_0x5b2171,null));};exports['getFields']=function(_0x144bf4,_0x750a30,_0x1f7c00){var _0x6e32cd={};var _0x21b38e={};var _0x17b00c;var _0x59e80b;return db['DeskConfiguration']['findOne']({'where':{'id':_0x144bf4[_0xc6d5('0x46')]['id']}})[_0xc6d5('0x28')](handleEntityNotFound(_0x750a30,null))[_0xc6d5('0x28')](function(_0x464448){if(_0x464448){_0x17b00c=_0x464448;_0x21b38e[_0xc6d5('0x30')]=_[_0xc6d5('0x33')](db['DeskField'][_0xc6d5('0x2d')]);_0x21b38e[_0xc6d5('0x32')]=_[_0xc6d5('0x33')](_0x144bf4[_0xc6d5('0x32')]);_0x21b38e['filters']=_[_0xc6d5('0x47')](_0x21b38e['model'],_0x21b38e[_0xc6d5('0x32')]);_0x6e32cd[_0xc6d5('0x36')]=_[_0xc6d5('0x47')](_0x21b38e[_0xc6d5('0x30')],qs[_0xc6d5('0x35')](_0x144bf4[_0xc6d5('0x32')][_0xc6d5('0x35')]));_0x6e32cd[_0xc6d5('0x36')]=_0x6e32cd[_0xc6d5('0x36')]['length']?_0x6e32cd[_0xc6d5('0x36')]:_0x21b38e[_0xc6d5('0x30')];_0x6e32cd[_0xc6d5('0x3a')]=qs[_0xc6d5('0x3b')](_0x144bf4['query'][_0xc6d5('0x3b')]);_0x6e32cd[_0xc6d5('0x3c')]=qs[_0xc6d5('0x34')](_[_0xc6d5('0x3d')](_0x144bf4[_0xc6d5('0x32')],_0x21b38e[_0xc6d5('0x34')]));if(_0x144bf4[_0xc6d5('0x32')][_0xc6d5('0x4c')]){_0x6e32cd[_0xc6d5('0x3c')]=_['merge'](_0x6e32cd[_0xc6d5('0x3c')],{'$or':_[_0xc6d5('0x31')](_0x6e32cd[_0xc6d5('0x36')],function(_0x76b18){var _0x50db65={};_0x50db65[_0x76b18]={'$like':'%'+_0x144bf4[_0xc6d5('0x32')][_0xc6d5('0x4c')]+'%'};return _0x50db65;})});}_0x6e32cd=_[_0xc6d5('0x3e')]({},_0x6e32cd,_0x144bf4[_0xc6d5('0x40')]);return _0x17b00c[_0xc6d5('0x4d')](_0x6e32cd);}})['then'](function(_0x441791){if(_0x441791){_0x59e80b=_0x441791['length'];if(!_0x144bf4['query'][_0xc6d5('0x38')](_0xc6d5('0x39'))){_0x6e32cd[_0xc6d5('0x20')]=qs[_0xc6d5('0x20')](_0x144bf4[_0xc6d5('0x32')][_0xc6d5('0x20')]);_0x6e32cd[_0xc6d5('0x1f')]=qs['offset'](_0x144bf4[_0xc6d5('0x32')][_0xc6d5('0x1f')]);}return _0x17b00c[_0xc6d5('0x4d')](_0x6e32cd);}})[_0xc6d5('0x28')](function(_0x39692e){if(_0x39692e){return _0x39692e?{'count':_0x59e80b,'rows':_0x39692e}:null;}})[_0xc6d5('0x28')](respondWithResult(_0x750a30,null))[_0xc6d5('0x44')](handleError(_0x750a30,null));};exports['getSubjects']=function(_0x1d6151,_0x4feaa0,_0x366c7e){var _0x28815d={};var _0x5e8327={};var _0xc63990;var _0x5210b3;return db[_0xc6d5('0x41')][_0xc6d5('0x4e')]({'where':{'id':_0x1d6151[_0xc6d5('0x46')]['id']}})['then'](handleEntityNotFound(_0x4feaa0,null))['then'](function(_0x137ea1){if(_0x137ea1){_0xc63990=_0x137ea1;_0x5e8327['model']=_[_0xc6d5('0x33')](db[_0xc6d5('0x4f')]['rawAttributes']);_0x5e8327[_0xc6d5('0x32')]=_[_0xc6d5('0x33')](_0x1d6151[_0xc6d5('0x32')]);_0x5e8327[_0xc6d5('0x34')]=_[_0xc6d5('0x47')](_0x5e8327['model'],_0x5e8327['query']);_0x28815d[_0xc6d5('0x36')]=_[_0xc6d5('0x47')](_0x5e8327[_0xc6d5('0x30')],qs[_0xc6d5('0x35')](_0x1d6151[_0xc6d5('0x32')][_0xc6d5('0x35')]));_0x28815d[_0xc6d5('0x36')]=_0x28815d['attributes'][_0xc6d5('0x37')]?_0x28815d[_0xc6d5('0x36')]:_0x5e8327[_0xc6d5('0x30')];_0x28815d[_0xc6d5('0x3a')]=qs['sort'](_0x1d6151[_0xc6d5('0x32')][_0xc6d5('0x3b')]);_0x28815d[_0xc6d5('0x3c')]=qs[_0xc6d5('0x34')](_['pick'](_0x1d6151[_0xc6d5('0x32')],_0x5e8327[_0xc6d5('0x34')]));if(_0x1d6151[_0xc6d5('0x32')][_0xc6d5('0x4c')]){_0x28815d['where']=_[_0xc6d5('0x3e')](_0x28815d[_0xc6d5('0x3c')],{'$or':_[_0xc6d5('0x31')](_0x28815d[_0xc6d5('0x36')],function(_0x3aeea6){var _0x3bf406={};_0x3bf406[_0x3aeea6]={'$like':'%'+_0x1d6151[_0xc6d5('0x32')]['filter']+'%'};return _0x3bf406;})});}_0x28815d=_[_0xc6d5('0x3e')]({},_0x28815d,_0x1d6151[_0xc6d5('0x40')]);return _0xc63990[_0xc6d5('0x50')](_0x28815d);}})[_0xc6d5('0x28')](function(_0x463c70){if(_0x463c70){_0x5210b3=_0x463c70['length'];if(!_0x1d6151[_0xc6d5('0x32')][_0xc6d5('0x38')](_0xc6d5('0x39'))){_0x28815d[_0xc6d5('0x20')]=qs[_0xc6d5('0x20')](_0x1d6151[_0xc6d5('0x32')][_0xc6d5('0x20')]);_0x28815d[_0xc6d5('0x1f')]=qs[_0xc6d5('0x1f')](_0x1d6151[_0xc6d5('0x32')][_0xc6d5('0x1f')]);}return _0xc63990['getSubjects'](_0x28815d);}})[_0xc6d5('0x28')](function(_0x578954){if(_0x578954){return _0x578954?{'count':_0x5210b3,'rows':_0x578954}:null;}})['then'](respondWithResult(_0x4feaa0,null))[_0xc6d5('0x44')](handleError(_0x4feaa0,null));};exports[_0xc6d5('0x51')]=function(_0x4b65c5,_0x14808b,_0x11d544){var _0x32fec4={};var _0x17e072={};var _0x13c46e;var _0x4b066c;return db[_0xc6d5('0x41')][_0xc6d5('0x4e')]({'where':{'id':_0x4b65c5[_0xc6d5('0x46')]['id']}})['then'](handleEntityNotFound(_0x14808b,null))['then'](function(_0x38c3d6){if(_0x38c3d6){_0x13c46e=_0x38c3d6;_0x17e072[_0xc6d5('0x30')]=_[_0xc6d5('0x33')](db[_0xc6d5('0x4f')][_0xc6d5('0x2d')]);_0x17e072[_0xc6d5('0x32')]=_[_0xc6d5('0x33')](_0x4b65c5[_0xc6d5('0x32')]);_0x17e072[_0xc6d5('0x34')]=_[_0xc6d5('0x47')](_0x17e072['model'],_0x17e072['query']);_0x32fec4[_0xc6d5('0x36')]=_[_0xc6d5('0x47')](_0x17e072['model'],qs[_0xc6d5('0x35')](_0x4b65c5[_0xc6d5('0x32')][_0xc6d5('0x35')]));_0x32fec4[_0xc6d5('0x36')]=_0x32fec4['attributes'][_0xc6d5('0x37')]?_0x32fec4['attributes']:_0x17e072[_0xc6d5('0x30')];_0x32fec4[_0xc6d5('0x3a')]=qs[_0xc6d5('0x3b')](_0x4b65c5[_0xc6d5('0x32')][_0xc6d5('0x3b')]);_0x32fec4[_0xc6d5('0x3c')]=qs[_0xc6d5('0x34')](_[_0xc6d5('0x3d')](_0x4b65c5[_0xc6d5('0x32')],_0x17e072[_0xc6d5('0x34')]));if(_0x4b65c5[_0xc6d5('0x32')][_0xc6d5('0x4c')]){_0x32fec4['where']=_[_0xc6d5('0x3e')](_0x32fec4[_0xc6d5('0x3c')],{'$or':_[_0xc6d5('0x31')](_0x32fec4[_0xc6d5('0x36')],function(_0x1fec07){var _0x42d473={};_0x42d473[_0x1fec07]={'$like':'%'+_0x4b65c5[_0xc6d5('0x32')][_0xc6d5('0x4c')]+'%'};return _0x42d473;})});}_0x32fec4=_[_0xc6d5('0x3e')]({},_0x32fec4,_0x4b65c5[_0xc6d5('0x40')]);return _0x13c46e[_0xc6d5('0x51')](_0x32fec4);}})[_0xc6d5('0x28')](function(_0x3f4d14){if(_0x3f4d14){_0x4b066c=_0x3f4d14['length'];if(!_0x4b65c5[_0xc6d5('0x32')][_0xc6d5('0x38')](_0xc6d5('0x39'))){_0x32fec4[_0xc6d5('0x20')]=qs['limit'](_0x4b65c5['query'][_0xc6d5('0x20')]);_0x32fec4[_0xc6d5('0x1f')]=qs[_0xc6d5('0x1f')](_0x4b65c5[_0xc6d5('0x32')][_0xc6d5('0x1f')]);}return _0x13c46e['getDescriptions'](_0x32fec4);}})[_0xc6d5('0x28')](function(_0x31b24f){if(_0x31b24f){return _0x31b24f?{'count':_0x4b066c,'rows':_0x31b24f}:null;}})[_0xc6d5('0x28')](respondWithResult(_0x14808b,null))['catch'](handleError(_0x14808b,null));};exports[_0xc6d5('0x52')]=function(_0x50ec3d,_0xd73cfd,_0x204b76){var _0x50651e={};var _0x2bcba6={};var _0x35fbc8;var _0x50a03b;return db[_0xc6d5('0x41')][_0xc6d5('0x4e')]({'where':{'id':_0x50ec3d[_0xc6d5('0x46')]['id']}})['then'](handleEntityNotFound(_0xd73cfd,null))[_0xc6d5('0x28')](function(_0x46ea72){if(_0x46ea72){_0x35fbc8=_0x46ea72;_0x2bcba6[_0xc6d5('0x30')]=_[_0xc6d5('0x33')](db[_0xc6d5('0x53')][_0xc6d5('0x2d')]);_0x2bcba6['query']=_[_0xc6d5('0x33')](_0x50ec3d[_0xc6d5('0x32')]);_0x2bcba6['filters']=_[_0xc6d5('0x47')](_0x2bcba6[_0xc6d5('0x30')],_0x2bcba6[_0xc6d5('0x32')]);_0x50651e[_0xc6d5('0x36')]=_[_0xc6d5('0x47')](_0x2bcba6[_0xc6d5('0x30')],qs[_0xc6d5('0x35')](_0x50ec3d[_0xc6d5('0x32')][_0xc6d5('0x35')]));_0x50651e[_0xc6d5('0x36')]=_0x50651e[_0xc6d5('0x36')][_0xc6d5('0x37')]?_0x50651e[_0xc6d5('0x36')]:_0x2bcba6[_0xc6d5('0x30')];_0x50651e[_0xc6d5('0x3a')]=qs[_0xc6d5('0x3b')](_0x50ec3d[_0xc6d5('0x32')][_0xc6d5('0x3b')]);_0x50651e[_0xc6d5('0x3c')]=qs[_0xc6d5('0x34')](_[_0xc6d5('0x3d')](_0x50ec3d[_0xc6d5('0x32')],_0x2bcba6[_0xc6d5('0x34')]));if(_0x50ec3d[_0xc6d5('0x32')][_0xc6d5('0x4c')]){_0x50651e[_0xc6d5('0x3c')]=_['merge'](_0x50651e['where'],{'$or':_[_0xc6d5('0x31')](_0x50651e[_0xc6d5('0x36')],function(_0x19405){var _0x74da6a={};_0x74da6a[_0x19405]={'$like':'%'+_0x50ec3d[_0xc6d5('0x32')][_0xc6d5('0x4c')]+'%'};return _0x74da6a;})});}_0x50651e=_['merge']({},_0x50651e,_0x50ec3d[_0xc6d5('0x40')]);return _0x35fbc8[_0xc6d5('0x52')](_0x50651e);}})[_0xc6d5('0x28')](function(_0x20851a){if(_0x20851a){_0x50a03b=_0x20851a[_0xc6d5('0x37')];if(!_0x50ec3d['query'][_0xc6d5('0x38')]('nolimit')){_0x50651e[_0xc6d5('0x20')]=qs['limit'](_0x50ec3d[_0xc6d5('0x32')][_0xc6d5('0x20')]);_0x50651e[_0xc6d5('0x1f')]=qs[_0xc6d5('0x1f')](_0x50ec3d['query'][_0xc6d5('0x1f')]);}return _0x35fbc8['getTags'](_0x50651e);}})[_0xc6d5('0x28')](function(_0x338f80){if(_0x338f80){return _0x338f80?{'count':_0x50a03b,'rows':_0x338f80}:null;}})['then'](respondWithResult(_0xd73cfd,null))[_0xc6d5('0x44')](handleError(_0xd73cfd,null));};exports[_0xc6d5('0x54')]=function(_0x35a3a9,_0x102cf2,_0x431852){if(_0x35a3a9['body']['id']){delete _0x35a3a9[_0xc6d5('0x4a')]['id'];}return db['DeskConfiguration'][_0xc6d5('0x4e')]({'where':{'id':_0x35a3a9['params']['id']}})[_0xc6d5('0x28')](handleEntityNotFound(_0x102cf2,null))[_0xc6d5('0x28')](function(_0x69f82){if(_0x69f82){return _0x69f82['setTags'](_0x35a3a9[_0xc6d5('0x4a')][_0xc6d5('0x55')]||[]);}return null;})['then'](respondWithResult(_0x102cf2,null))[_0xc6d5('0x44')](handleError(_0x102cf2,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index dac1ff7..54bd68d 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 _0xfde3=['bluebird','request-promise','path','../../config/environment','exports','define','int_desk_configurations','lodash','moment'];(function(_0x492813,_0x4fad44){var _0x1c30ab=function(_0x454c23){while(--_0x454c23){_0x492813['push'](_0x492813['shift']());}};_0x1c30ab(++_0x4fad44);}(_0xfde3,0xe8));var _0x3fde=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xfde3[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x3fde('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3fde('0x1'));var BPromise=require(_0x3fde('0x2'));var rp=require(_0x3fde('0x3'));var fs=require('fs');var path=require(_0x3fde('0x4'));var rimraf=require('rimraf');var config=require(_0x3fde('0x5'));var attributes=require('./intDeskConfiguration.attributes');module[_0x3fde('0x6')]=function(_0xb76889,_0x49ea96){return _0xb76889[_0x3fde('0x7')]('DeskConfiguration',attributes,{'tableName':_0x3fde('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x06c0=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations'];(function(_0x1e6d43,_0x1c99e2){var _0x58ce19=function(_0x29695e){while(--_0x29695e){_0x1e6d43['push'](_0x1e6d43['shift']());}};_0x58ce19(++_0x1c99e2);}(_0x06c0,0x1ad));var _0x006c=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x06c0[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x006c('0x0'));var util=require(_0x006c('0x1'));var logger=require(_0x006c('0x2'))(_0x006c('0x3'));var moment=require('moment');var BPromise=require(_0x006c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x006c('0x5'));var rimraf=require(_0x006c('0x6'));var config=require(_0x006c('0x7'));var attributes=require(_0x006c('0x8'));module[_0x006c('0x9')]=function(_0x4eddf0,_0x468604){return _0x4eddf0[_0x006c('0xa')](_0x006c('0xb'),attributes,{'tableName':_0x006c('0xc'),'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 5b5e6aa..d15838e 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 _0x534b=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird'];(function(_0x4341e2,_0x17dfff){var _0x4d9dff=function(_0x5201d3){while(--_0x5201d3){_0x4341e2['push'](_0x4341e2['shift']());}};_0x4d9dff(++_0x17dfff);}(_0x534b,0xbd));var _0xb534=function(_0x28b54,_0x251993){_0x28b54=_0x28b54-0x0;var _0x40bbff=_0x534b[_0x28b54];return _0x40bbff;};'use strict';var _=require(_0xb534('0x0'));var util=require(_0xb534('0x1'));var moment=require('moment');var BPromise=require(_0xb534('0x2'));var rs=require(_0xb534('0x3'));var fs=require('fs');var Redis=require(_0xb534('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb534('0x5'));var logger=require('../../config/logger')(_0xb534('0x6'));var config=require(_0xb534('0x7'));var jayson=require(_0xb534('0x8'));var client=jayson[_0xb534('0x9')][_0xb534('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54ea55,_0x23383c,_0x2c0b7f){return new BPromise(function(_0x446a52,_0x4637f6){return client[_0xb534('0xb')](_0x54ea55,_0x2c0b7f)[_0xb534('0xc')](function(_0x43a29e){logger['info'](_0xb534('0xd'),_0x23383c,'request\x20sent');logger[_0xb534('0xe')](_0xb534('0xf'),_0x23383c,_0xb534('0x10'),JSON[_0xb534('0x11')](_0x43a29e));if(_0x43a29e['error']){if(_0x43a29e[_0xb534('0x12')][_0xb534('0x13')]===0x1f4){logger['error'](_0xb534('0xd'),_0x23383c,_0x43a29e[_0xb534('0x12')][_0xb534('0x14')]);return _0x4637f6(_0x43a29e['error'][_0xb534('0x14')]);}logger[_0xb534('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x23383c,_0x43a29e['error'][_0xb534('0x14')]);return _0x446a52(_0x43a29e[_0xb534('0x12')][_0xb534('0x14')]);}else{logger[_0xb534('0x15')](_0xb534('0xd'),_0x23383c,_0xb534('0x10'));_0x446a52(_0x43a29e[_0xb534('0x16')][_0xb534('0x14')]);}})[_0xb534('0x17')](function(_0x15d352){logger['error'](_0xb534('0xd'),_0x23383c,_0x15d352);_0x4637f6(_0x15d352);});});} \ No newline at end of file +var _0xcf54=['debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','DeskConfiguration,\x20%s,\x20%s','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent'];(function(_0x2b95fe,_0x4e2f52){var _0x5f4d5c=function(_0x1033af){while(--_0x1033af){_0x2b95fe['push'](_0x2b95fe['shift']());}};_0x5f4d5c(++_0x4e2f52);}(_0xcf54,0x125));var _0x4cf5=function(_0x1e17eb,_0x2e15c5){_0x1e17eb=_0x1e17eb-0x0;var _0x4de4c7=_0xcf54[_0x1e17eb];return _0x4de4c7;};'use strict';var _=require('lodash');var util=require(_0x4cf5('0x0'));var moment=require(_0x4cf5('0x1'));var BPromise=require(_0x4cf5('0x2'));var rs=require(_0x4cf5('0x3'));var fs=require('fs');var Redis=require(_0x4cf5('0x4'));var db=require(_0x4cf5('0x5'))['db'];var utils=require(_0x4cf5('0x6'));var logger=require('../../config/logger')(_0x4cf5('0x7'));var config=require(_0x4cf5('0x8'));var jayson=require(_0x4cf5('0x9'));var client=jayson[_0x4cf5('0xa')][_0x4cf5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55eae8,_0x1ab304,_0x748eb1){return new BPromise(function(_0x4cf824,_0x4fe906){return client[_0x4cf5('0xc')](_0x55eae8,_0x748eb1)['then'](function(_0x3c7c38){logger[_0x4cf5('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x1ab304,_0x4cf5('0xe'));logger[_0x4cf5('0xf')](_0x4cf5('0x10'),_0x1ab304,'request\x20sent',JSON['stringify'](_0x3c7c38));if(_0x3c7c38['error']){if(_0x3c7c38[_0x4cf5('0x11')][_0x4cf5('0x12')]===0x1f4){logger[_0x4cf5('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x1ab304,_0x3c7c38['error'][_0x4cf5('0x13')]);return _0x4fe906(_0x3c7c38[_0x4cf5('0x11')][_0x4cf5('0x13')]);}logger[_0x4cf5('0x11')](_0x4cf5('0x14'),_0x1ab304,_0x3c7c38[_0x4cf5('0x11')][_0x4cf5('0x13')]);return _0x4cf824(_0x3c7c38[_0x4cf5('0x11')][_0x4cf5('0x13')]);}else{logger[_0x4cf5('0xd')](_0x4cf5('0x14'),_0x1ab304,'request\x20sent');_0x4cf824(_0x3c7c38[_0x4cf5('0x15')][_0x4cf5('0x13')]);}})['catch'](function(_0x36460c){logger[_0x4cf5('0x11')](_0x4cf5('0x14'),_0x1ab304,_0x36460c);_0x4fe906(_0x36460c);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 9d74454..5a1726c 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 _0x6de2=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','index','get','/:id','post','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x1f6ad9,_0x43dc2d){var _0x1b4d80=function(_0x5b0f2e){while(--_0x5b0f2e){_0x1f6ad9['push'](_0x1f6ad9['shift']());}};_0x1b4d80(++_0x43dc2d);}(_0x6de2,0x152));var _0x26de=function(_0x529323,_0x3f4a2e){_0x529323=_0x529323-0x0;var _0x57b4d2=_0x6de2[_0x529323];return _0x57b4d2;};'use strict';var multer=require(_0x26de('0x0'));var util=require(_0x26de('0x1'));var path=require(_0x26de('0x2'));var timeout=require(_0x26de('0x3'));var express=require(_0x26de('0x4'));var router=express['Router']();var fs_extra=require(_0x26de('0x5'));var auth=require(_0x26de('0x6'));var interaction=require(_0x26de('0x7'));var config=require(_0x26de('0x8'));var controller=require(_0x26de('0x9'));router['get']('/',auth[_0x26de('0xa')](),controller[_0x26de('0xb')]);router[_0x26de('0xc')](_0x26de('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x26de('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x26de('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x26de('0x10')]);router[_0x26de('0x11')](_0x26de('0xd'),auth[_0x26de('0xa')](),controller['destroy']);module[_0x26de('0x12')]=router; \ No newline at end of file +var _0x6aa1=['/:id','put','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x6aa1,0x1b5));var _0x16aa=function(_0xb4b24d,_0x249f45){_0xb4b24d=_0xb4b24d-0x0;var _0x2e959b=_0x6aa1[_0xb4b24d];return _0x2e959b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x16aa('0x0'));var timeout=require(_0x16aa('0x1'));var express=require(_0x16aa('0x2'));var router=express[_0x16aa('0x3')]();var fs_extra=require(_0x16aa('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x16aa('0x5'));var config=require(_0x16aa('0x6'));var controller=require(_0x16aa('0x7'));router[_0x16aa('0x8')]('/',auth[_0x16aa('0x9')](),controller[_0x16aa('0xa')]);router[_0x16aa('0x8')](_0x16aa('0xb'),auth[_0x16aa('0x9')](),controller['show']);router['post']('/',auth[_0x16aa('0x9')](),controller['create']);router[_0x16aa('0xc')](_0x16aa('0xb'),auth[_0x16aa('0x9')](),controller[_0x16aa('0xd')]);router[_0x16aa('0xe')](_0x16aa('0xb'),auth[_0x16aa('0x9')](),controller['destroy']);module[_0x16aa('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index e17eae7..628ace5 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 _0x0bef=['STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x0bef,0x173));var _0xf0be=function(_0x3b10f4,_0x59f4a7){_0x3b10f4=_0x3b10f4-0x0;var _0x9fa36f=_0x0bef[_0x3b10f4];return _0x9fa36f;};'use strict';var Sequelize=require(_0xf0be('0x0'));module['exports']={'type':{'type':Sequelize[_0xf0be('0x1')](_0xf0be('0x2'),_0xf0be('0x3'),_0xf0be('0x4'),_0xf0be('0x5'),_0xf0be('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xf0be('0x7')]},'key':{'type':Sequelize[_0xf0be('0x7')]},'keyType':{'type':Sequelize[_0xf0be('0x1')](_0xf0be('0x2'),_0xf0be('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xf0be('0x7')]},'idField':{'type':Sequelize[_0xf0be('0x7')]},'nameField':{'type':Sequelize[_0xf0be('0x7')]},'customField':{'type':Sequelize[_0xf0be('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf0be('0x7')]}}; \ No newline at end of file +var _0x3da9=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x3d07d2,_0x4afc87){var _0x53ed3e=function(_0xeb74c0){while(--_0xeb74c0){_0x3d07d2['push'](_0x3d07d2['shift']());}};_0x53ed3e(++_0x4afc87);}(_0x3da9,0x1df));var _0x93da=function(_0x2e79a8,_0x28e699){_0x2e79a8=_0x2e79a8-0x0;var _0x24aa57=_0x3da9[_0x2e79a8];return _0x24aa57;};'use strict';var Sequelize=require(_0x93da('0x0'));module[_0x93da('0x1')]={'type':{'type':Sequelize[_0x93da('0x2')](_0x93da('0x3'),_0x93da('0x4'),_0x93da('0x5'),_0x93da('0x6'),'picklist'),'defaultValue':_0x93da('0x3')},'content':{'type':Sequelize[_0x93da('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0x93da('0x4'),_0x93da('0x5'))},'keyContent':{'type':Sequelize[_0x93da('0x7')]},'idField':{'type':Sequelize[_0x93da('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x93da('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x93da('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 13f8962..3560dd5 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 _0xad68=['model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','VIRTUAL','options','where','include','findAll','rows','catch','show','rawAttributes','filters','length','includeAll','find','create','body','params','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','DeskField','fieldName','type'];(function(_0x4fba44,_0x10e53c){var _0x1b87ec=function(_0x20015c){while(--_0x20015c){_0x4fba44['push'](_0x4fba44['shift']());}};_0x1b87ec(++_0x10e53c);}(_0xad68,0x100));var _0x8ad6=function(_0x1fd9e7,_0x24cdbe){_0x1fd9e7=_0x1fd9e7-0x0;var _0x1781f2=_0xad68[_0x1fd9e7];return _0x1781f2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8ad6('0x0'));var jsonpatch=require(_0x8ad6('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8ad6('0x2'));var Mustache=require(_0x8ad6('0x3'));var util=require(_0x8ad6('0x4'));var path=require(_0x8ad6('0x5'));var sox=require(_0x8ad6('0x6'));var csv=require(_0x8ad6('0x7'));var ejs=require(_0x8ad6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8ad6('0x9'));var squel=require(_0x8ad6('0xa'));var crypto=require(_0x8ad6('0xb'));var jsforce=require(_0x8ad6('0xc'));var deskjs=require(_0x8ad6('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8ad6('0xe'));var Redis=require(_0x8ad6('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8ad6('0x10'));var hardwareService=require(_0x8ad6('0x11'));var logger=require(_0x8ad6('0x12'))(_0x8ad6('0x13'));var utils=require(_0x8ad6('0x14'));var config=require(_0x8ad6('0x15'));var licenseUtil=require(_0x8ad6('0x16'));var db=require(_0x8ad6('0x17'))['db'];function respondWithStatusCode(_0x5ea9e2,_0x3d0252){_0x3d0252=_0x3d0252||0xcc;return function(_0x4b8041){if(_0x4b8041){return _0x5ea9e2['sendStatus'](_0x3d0252);}return _0x5ea9e2[_0x8ad6('0x18')](_0x3d0252)['end']();};}function respondWithResult(_0x329fca,_0x50179e){_0x50179e=_0x50179e||0xc8;return function(_0x307afc){if(_0x307afc){return _0x329fca[_0x8ad6('0x18')](_0x50179e)[_0x8ad6('0x19')](_0x307afc);}};}function respondWithFilteredResult(_0x5bbfb6,_0x45e709){return function(_0x1fed01){if(_0x1fed01){var _0x37a7f0=typeof _0x45e709[_0x8ad6('0x1a')]===_0x8ad6('0x1b')&&typeof _0x45e709[_0x8ad6('0x1c')]===_0x8ad6('0x1b');var _0x2e9a2e=_0x1fed01['count'];var _0x8ca3e3=_0x37a7f0?0x0:_0x45e709[_0x8ad6('0x1a')];var _0x29e6a6=_0x37a7f0?_0x1fed01[_0x8ad6('0x1d')]:_0x45e709[_0x8ad6('0x1a')]+_0x45e709[_0x8ad6('0x1c')];var _0x144b50;if(_0x29e6a6>=_0x2e9a2e){_0x29e6a6=_0x2e9a2e;_0x144b50=0xc8;}else{_0x144b50=0xce;}_0x5bbfb6['status'](_0x144b50);return _0x5bbfb6[_0x8ad6('0x1e')](_0x8ad6('0x1f'),_0x8ca3e3+'-'+_0x29e6a6+'/'+_0x2e9a2e)[_0x8ad6('0x19')](_0x1fed01);}return null;};}function patchUpdates(_0x52f4ab){return function(_0x47086a){try{jsonpatch[_0x8ad6('0x20')](_0x47086a,_0x52f4ab,!![]);}catch(_0x3074e7){return BPromise[_0x8ad6('0x21')](_0x3074e7);}return _0x47086a[_0x8ad6('0x22')]();};}function saveUpdates(_0x46f5bf,_0x42f18b){return function(_0x5edc1){if(_0x5edc1){return _0x5edc1[_0x8ad6('0x23')](_0x46f5bf)['then'](function(_0x47af23){return _0x47af23;});}return null;};}function removeEntity(_0x2762e7,_0x351267){return function(_0x558430){if(_0x558430){return _0x558430[_0x8ad6('0x24')]()[_0x8ad6('0x25')](function(){_0x2762e7[_0x8ad6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54adf7,_0x4795d8){return function(_0x850dc6){if(!_0x850dc6){_0x54adf7[_0x8ad6('0x26')](0x194);}return _0x850dc6;};}function handleError(_0xf0a55f,_0x2e4cf7){_0x2e4cf7=_0x2e4cf7||0x1f4;return function(_0x1c79c9){logger[_0x8ad6('0x27')](_0x1c79c9[_0x8ad6('0x28')]);if(_0x1c79c9[_0x8ad6('0x29')]){delete _0x1c79c9[_0x8ad6('0x29')];}_0xf0a55f[_0x8ad6('0x18')](_0x2e4cf7)[_0x8ad6('0x2a')](_0x1c79c9);};}exports[_0x8ad6('0x2b')]=function(_0x303f6a,_0x371f2b){var _0x34f567={},_0x24a2fa={},_0xaabe95={'count':0x0,'rows':[]};var _0x3c2092=_[_0x8ad6('0x2c')](db[_0x8ad6('0x2d')]['rawAttributes'],function(_0x3dfedd){return{'name':_0x3dfedd[_0x8ad6('0x2e')],'type':_0x3dfedd[_0x8ad6('0x2f')]['key']};});_0x24a2fa[_0x8ad6('0x30')]=_['map'](_0x3c2092,'name');_0x24a2fa['query']=_[_0x8ad6('0x31')](_0x303f6a[_0x8ad6('0x32')]);_0x24a2fa['filters']=_[_0x8ad6('0x33')](_0x24a2fa[_0x8ad6('0x30')],_0x24a2fa[_0x8ad6('0x32')]);_0x34f567[_0x8ad6('0x34')]=_[_0x8ad6('0x33')](_0x24a2fa['model'],qs[_0x8ad6('0x35')](_0x303f6a[_0x8ad6('0x32')]['fields']));_0x34f567[_0x8ad6('0x34')]=_0x34f567['attributes']['length']?_0x34f567[_0x8ad6('0x34')]:_0x24a2fa[_0x8ad6('0x30')];if(!_0x303f6a['query'][_0x8ad6('0x36')](_0x8ad6('0x37'))){_0x34f567[_0x8ad6('0x1c')]=qs[_0x8ad6('0x1c')](_0x303f6a['query'][_0x8ad6('0x1c')]);_0x34f567[_0x8ad6('0x1a')]=qs[_0x8ad6('0x1a')](_0x303f6a[_0x8ad6('0x32')]['offset']);}_0x34f567['order']=qs[_0x8ad6('0x38')](_0x303f6a[_0x8ad6('0x32')][_0x8ad6('0x38')]);_0x34f567['where']=qs['filters'](_[_0x8ad6('0x39')](_0x303f6a[_0x8ad6('0x32')],_0x24a2fa['filters']),_0x3c2092);if(_0x303f6a[_0x8ad6('0x32')][_0x8ad6('0x3a')]){_0x34f567['where']=_[_0x8ad6('0x3b')](_0x34f567['where'],{'$or':_[_0x8ad6('0x2c')](_0x3c2092,function(_0x552754){if(_0x552754[_0x8ad6('0x2f')]!==_0x8ad6('0x3c')){var _0x4dd3ec={};_0x4dd3ec[_0x552754[_0x8ad6('0x29')]]={'$like':'%'+_0x303f6a['query']['filter']+'%'};return _0x4dd3ec;}})});}_0x34f567=_[_0x8ad6('0x3b')]({},_0x34f567,_0x303f6a[_0x8ad6('0x3d')]);var _0x17da1c={'where':_0x34f567[_0x8ad6('0x3e')]};return db[_0x8ad6('0x2d')][_0x8ad6('0x1d')](_0x17da1c)[_0x8ad6('0x25')](function(_0x341c76){_0xaabe95['count']=_0x341c76;if(_0x303f6a[_0x8ad6('0x32')]['includeAll']){_0x34f567[_0x8ad6('0x3f')]=[{'all':!![]}];}return db['DeskField'][_0x8ad6('0x40')](_0x34f567);})[_0x8ad6('0x25')](function(_0x27fea){_0xaabe95[_0x8ad6('0x41')]=_0x27fea;return _0xaabe95;})['then'](respondWithFilteredResult(_0x371f2b,_0x34f567))[_0x8ad6('0x42')](handleError(_0x371f2b,null));};exports[_0x8ad6('0x43')]=function(_0x2eb7be,_0x233cac){var _0x2ccbed={'raw':!![],'where':{'id':_0x2eb7be['params']['id']}},_0x5deb79={};_0x5deb79[_0x8ad6('0x30')]=_[_0x8ad6('0x31')](db[_0x8ad6('0x2d')][_0x8ad6('0x44')]);_0x5deb79[_0x8ad6('0x32')]=_[_0x8ad6('0x31')](_0x2eb7be[_0x8ad6('0x32')]);_0x5deb79[_0x8ad6('0x45')]=_[_0x8ad6('0x33')](_0x5deb79[_0x8ad6('0x30')],_0x5deb79['query']);_0x2ccbed[_0x8ad6('0x34')]=_[_0x8ad6('0x33')](_0x5deb79[_0x8ad6('0x30')],qs[_0x8ad6('0x35')](_0x2eb7be[_0x8ad6('0x32')][_0x8ad6('0x35')]));_0x2ccbed[_0x8ad6('0x34')]=_0x2ccbed[_0x8ad6('0x34')][_0x8ad6('0x46')]?_0x2ccbed['attributes']:_0x5deb79[_0x8ad6('0x30')];if(_0x2eb7be[_0x8ad6('0x32')][_0x8ad6('0x47')]){_0x2ccbed['include']=[{'all':!![]}];}_0x2ccbed=_['merge']({},_0x2ccbed,_0x2eb7be[_0x8ad6('0x3d')]);return db[_0x8ad6('0x2d')][_0x8ad6('0x48')](_0x2ccbed)[_0x8ad6('0x25')](handleEntityNotFound(_0x233cac,null))[_0x8ad6('0x25')](respondWithResult(_0x233cac,null))[_0x8ad6('0x42')](handleError(_0x233cac,null));};exports[_0x8ad6('0x49')]=function(_0x50e7bc,_0x5ce092){return db[_0x8ad6('0x2d')][_0x8ad6('0x49')](_0x50e7bc[_0x8ad6('0x4a')],{})[_0x8ad6('0x25')](respondWithResult(_0x5ce092,0xc9))[_0x8ad6('0x42')](handleError(_0x5ce092,null));};exports[_0x8ad6('0x23')]=function(_0x438612,_0x52c1ca){if(_0x438612['body']['id']){delete _0x438612[_0x8ad6('0x4a')]['id'];}return db[_0x8ad6('0x2d')][_0x8ad6('0x48')]({'where':{'id':_0x438612['params']['id']}})['then'](handleEntityNotFound(_0x52c1ca,null))['then'](saveUpdates(_0x438612['body'],null))[_0x8ad6('0x25')](respondWithResult(_0x52c1ca,null))['catch'](handleError(_0x52c1ca,null));};exports[_0x8ad6('0x24')]=function(_0x72ce3b,_0x4acba7){return db[_0x8ad6('0x2d')][_0x8ad6('0x48')]({'where':{'id':_0x72ce3b[_0x8ad6('0x4b')]['id']}})[_0x8ad6('0x25')](handleEntityNotFound(_0x4acba7,null))['then'](removeEntity(_0x4acba7,null))[_0x8ad6('0x42')](handleError(_0x4acba7,null));}; \ No newline at end of file +var _0xf228=['error','name','send','index','fieldName','type','key','map','keys','filters','intersection','model','fields','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','DeskField','includeAll','include','findAll','then','rows','catch','show','rawAttributes','find','create','body','params','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update'];(function(_0x1281a1,_0x7630e4){var _0x40f706=function(_0x38b837){while(--_0x38b837){_0x1281a1['push'](_0x1281a1['shift']());}};_0x40f706(++_0x7630e4);}(_0xf228,0x1a9));var _0x8f22=function(_0x958d24,_0x21ce7d){_0x958d24=_0x958d24-0x0;var _0x5942ab=_0xf228[_0x958d24];return _0x5942ab;};'use strict';var emlformat=require(_0x8f22('0x0'));var rimraf=require(_0x8f22('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8f22('0x2'));var rp=require(_0x8f22('0x3'));var moment=require(_0x8f22('0x4'));var BPromise=require(_0x8f22('0x5'));var Mustache=require(_0x8f22('0x6'));var util=require(_0x8f22('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x8f22('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8f22('0x9'));var _=require(_0x8f22('0xa'));var squel=require('squel');var crypto=require(_0x8f22('0xb'));var jsforce=require(_0x8f22('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8f22('0x8'));var querystring=require(_0x8f22('0xd'));var Papa=require(_0x8f22('0xe'));var Redis=require(_0x8f22('0xf'));var authService=require(_0x8f22('0x10'));var qs=require(_0x8f22('0x11'));var as=require(_0x8f22('0x12'));var hardwareService=require(_0x8f22('0x13'));var logger=require('../../config/logger')(_0x8f22('0x14'));var utils=require(_0x8f22('0x15'));var config=require(_0x8f22('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8f22('0x17'))['db'];function respondWithStatusCode(_0x51508b,_0x22d8b2){_0x22d8b2=_0x22d8b2||0xcc;return function(_0xd35f24){if(_0xd35f24){return _0x51508b[_0x8f22('0x18')](_0x22d8b2);}return _0x51508b[_0x8f22('0x19')](_0x22d8b2)[_0x8f22('0x1a')]();};}function respondWithResult(_0x4b3a4a,_0xac2666){_0xac2666=_0xac2666||0xc8;return function(_0x3fe61c){if(_0x3fe61c){return _0x4b3a4a['status'](_0xac2666)[_0x8f22('0x1b')](_0x3fe61c);}};}function respondWithFilteredResult(_0xb3b10,_0x48516d){return function(_0xa3124a){if(_0xa3124a){var _0x32559b=typeof _0x48516d[_0x8f22('0x1c')]==='undefined'&&typeof _0x48516d[_0x8f22('0x1d')]===_0x8f22('0x1e');var _0x3679b1=_0xa3124a[_0x8f22('0x1f')];var _0x4bd281=_0x32559b?0x0:_0x48516d['offset'];var _0x12d63c=_0x32559b?_0xa3124a['count']:_0x48516d[_0x8f22('0x1c')]+_0x48516d['limit'];var _0x2944bc;if(_0x12d63c>=_0x3679b1){_0x12d63c=_0x3679b1;_0x2944bc=0xc8;}else{_0x2944bc=0xce;}_0xb3b10[_0x8f22('0x19')](_0x2944bc);return _0xb3b10[_0x8f22('0x20')](_0x8f22('0x21'),_0x4bd281+'-'+_0x12d63c+'/'+_0x3679b1)[_0x8f22('0x1b')](_0xa3124a);}return null;};}function patchUpdates(_0x5b45c5){return function(_0x2e786a){try{jsonpatch['apply'](_0x2e786a,_0x5b45c5,!![]);}catch(_0x454805){return BPromise[_0x8f22('0x22')](_0x454805);}return _0x2e786a[_0x8f22('0x23')]();};}function saveUpdates(_0x23cfab,_0x46c2b7){return function(_0x475392){if(_0x475392){return _0x475392[_0x8f22('0x24')](_0x23cfab)['then'](function(_0x22dfaf){return _0x22dfaf;});}return null;};}function removeEntity(_0x36a334,_0x99019a){return function(_0x5c229b){if(_0x5c229b){return _0x5c229b['destroy']()['then'](function(){_0x36a334['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dc9c4,_0x3fc9d7){return function(_0xf34b6c){if(!_0xf34b6c){_0x4dc9c4[_0x8f22('0x18')](0x194);}return _0xf34b6c;};}function handleError(_0x285bfe,_0x7cf609){_0x7cf609=_0x7cf609||0x1f4;return function(_0x3e7630){logger[_0x8f22('0x25')](_0x3e7630['stack']);if(_0x3e7630['name']){delete _0x3e7630[_0x8f22('0x26')];}_0x285bfe[_0x8f22('0x19')](_0x7cf609)[_0x8f22('0x27')](_0x3e7630);};}exports[_0x8f22('0x28')]=function(_0xc76bca,_0x4cd29f){var _0x1a06b8={},_0x4ce821={},_0x2c2a82={'count':0x0,'rows':[]};var _0x2dc10d=_['map'](db['DeskField']['rawAttributes'],function(_0x22c6ef){return{'name':_0x22c6ef[_0x8f22('0x29')],'type':_0x22c6ef[_0x8f22('0x2a')][_0x8f22('0x2b')]};});_0x4ce821['model']=_[_0x8f22('0x2c')](_0x2dc10d,'name');_0x4ce821['query']=_[_0x8f22('0x2d')](_0xc76bca['query']);_0x4ce821[_0x8f22('0x2e')]=_[_0x8f22('0x2f')](_0x4ce821[_0x8f22('0x30')],_0x4ce821['query']);_0x1a06b8['attributes']=_['intersection'](_0x4ce821[_0x8f22('0x30')],qs[_0x8f22('0x31')](_0xc76bca[_0x8f22('0x32')][_0x8f22('0x31')]));_0x1a06b8['attributes']=_0x1a06b8[_0x8f22('0x33')][_0x8f22('0x34')]?_0x1a06b8['attributes']:_0x4ce821[_0x8f22('0x30')];if(!_0xc76bca[_0x8f22('0x32')][_0x8f22('0x35')](_0x8f22('0x36'))){_0x1a06b8[_0x8f22('0x1d')]=qs[_0x8f22('0x1d')](_0xc76bca['query'][_0x8f22('0x1d')]);_0x1a06b8[_0x8f22('0x1c')]=qs[_0x8f22('0x1c')](_0xc76bca['query'][_0x8f22('0x1c')]);}_0x1a06b8[_0x8f22('0x37')]=qs[_0x8f22('0x38')](_0xc76bca[_0x8f22('0x32')]['sort']);_0x1a06b8[_0x8f22('0x39')]=qs[_0x8f22('0x2e')](_[_0x8f22('0x3a')](_0xc76bca[_0x8f22('0x32')],_0x4ce821['filters']),_0x2dc10d);if(_0xc76bca[_0x8f22('0x32')][_0x8f22('0x3b')]){_0x1a06b8[_0x8f22('0x39')]=_['merge'](_0x1a06b8['where'],{'$or':_[_0x8f22('0x2c')](_0x2dc10d,function(_0x31268c){if(_0x31268c['type']!==_0x8f22('0x3c')){var _0x429f5e={};_0x429f5e[_0x31268c[_0x8f22('0x26')]]={'$like':'%'+_0xc76bca['query']['filter']+'%'};return _0x429f5e;}})});}_0x1a06b8=_[_0x8f22('0x3d')]({},_0x1a06b8,_0xc76bca[_0x8f22('0x3e')]);var _0x9fecab={'where':_0x1a06b8['where']};return db[_0x8f22('0x3f')][_0x8f22('0x1f')](_0x9fecab)['then'](function(_0x5a819f){_0x2c2a82[_0x8f22('0x1f')]=_0x5a819f;if(_0xc76bca['query'][_0x8f22('0x40')]){_0x1a06b8[_0x8f22('0x41')]=[{'all':!![]}];}return db[_0x8f22('0x3f')][_0x8f22('0x42')](_0x1a06b8);})[_0x8f22('0x43')](function(_0x2cbf1c){_0x2c2a82[_0x8f22('0x44')]=_0x2cbf1c;return _0x2c2a82;})[_0x8f22('0x43')](respondWithFilteredResult(_0x4cd29f,_0x1a06b8))[_0x8f22('0x45')](handleError(_0x4cd29f,null));};exports[_0x8f22('0x46')]=function(_0x201022,_0x4897d7){var _0x15b5fd={'raw':!![],'where':{'id':_0x201022['params']['id']}},_0x39f8b6={};_0x39f8b6[_0x8f22('0x30')]=_[_0x8f22('0x2d')](db[_0x8f22('0x3f')][_0x8f22('0x47')]);_0x39f8b6[_0x8f22('0x32')]=_['keys'](_0x201022[_0x8f22('0x32')]);_0x39f8b6[_0x8f22('0x2e')]=_[_0x8f22('0x2f')](_0x39f8b6['model'],_0x39f8b6['query']);_0x15b5fd[_0x8f22('0x33')]=_[_0x8f22('0x2f')](_0x39f8b6[_0x8f22('0x30')],qs[_0x8f22('0x31')](_0x201022[_0x8f22('0x32')]['fields']));_0x15b5fd['attributes']=_0x15b5fd[_0x8f22('0x33')][_0x8f22('0x34')]?_0x15b5fd[_0x8f22('0x33')]:_0x39f8b6[_0x8f22('0x30')];if(_0x201022[_0x8f22('0x32')][_0x8f22('0x40')]){_0x15b5fd[_0x8f22('0x41')]=[{'all':!![]}];}_0x15b5fd=_[_0x8f22('0x3d')]({},_0x15b5fd,_0x201022[_0x8f22('0x3e')]);return db[_0x8f22('0x3f')][_0x8f22('0x48')](_0x15b5fd)[_0x8f22('0x43')](handleEntityNotFound(_0x4897d7,null))[_0x8f22('0x43')](respondWithResult(_0x4897d7,null))[_0x8f22('0x45')](handleError(_0x4897d7,null));};exports[_0x8f22('0x49')]=function(_0x373f1c,_0x23c9a3){return db[_0x8f22('0x3f')]['create'](_0x373f1c[_0x8f22('0x4a')],{})['then'](respondWithResult(_0x23c9a3,0xc9))[_0x8f22('0x45')](handleError(_0x23c9a3,null));};exports[_0x8f22('0x24')]=function(_0x3654a9,_0x147767){if(_0x3654a9[_0x8f22('0x4a')]['id']){delete _0x3654a9['body']['id'];}return db[_0x8f22('0x3f')][_0x8f22('0x48')]({'where':{'id':_0x3654a9[_0x8f22('0x4b')]['id']}})['then'](handleEntityNotFound(_0x147767,null))[_0x8f22('0x43')](saveUpdates(_0x3654a9[_0x8f22('0x4a')],null))[_0x8f22('0x43')](respondWithResult(_0x147767,null))[_0x8f22('0x45')](handleError(_0x147767,null));};exports[_0x8f22('0x4c')]=function(_0x2e60a8,_0x2c7eb3){return db[_0x8f22('0x3f')]['find']({'where':{'id':_0x2e60a8[_0x8f22('0x4b')]['id']}})[_0x8f22('0x43')](handleEntityNotFound(_0x2c7eb3,null))['then'](removeEntity(_0x2c7eb3,null))[_0x8f22('0x45')](handleError(_0x2c7eb3,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 53e6ae0..9ac747f 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 _0xe5e4=['util','bluebird','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','idField','FieldId','lodash'];(function(_0x2a08cd,_0x422897){var _0x596668=function(_0x2656d0){while(--_0x2656d0){_0x2a08cd['push'](_0x2a08cd['shift']());}};_0x596668(++_0x422897);}(_0xe5e4,0x1a1));var _0x4e5e=function(_0x5961ec,_0x442dc8){_0x5961ec=_0x5961ec-0x0;var _0x21acef=_0xe5e4[_0x5961ec];return _0x21acef;};'use strict';var _=require(_0x4e5e('0x0'));var util=require(_0x4e5e('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4e5e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e5e('0x3'));var rimraf=require(_0x4e5e('0x4'));var config=require(_0x4e5e('0x5'));var attributes=require(_0x4e5e('0x6'));module[_0x4e5e('0x7')]=function(_0xc93184,_0x1f21cb){return _0xc93184[_0x4e5e('0x8')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x4e5e('0x9'),_0x4e5e('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa418=['moment','bluebird','request-promise','path','../../config/environment','exports','define','DeskField','idField','FieldId','api'];(function(_0x520bbb,_0x18ea70){var _0x596d14=function(_0x109709){while(--_0x109709){_0x520bbb['push'](_0x520bbb['shift']());}};_0x596d14(++_0x18ea70);}(_0xa418,0x1b7));var _0x8a41=function(_0x1c64e8,_0xe7ca56){_0x1c64e8=_0x1c64e8-0x0;var _0x9eda59=_0xa418[_0x1c64e8];return _0x9eda59;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8a41('0x0'));var moment=require(_0x8a41('0x1'));var BPromise=require(_0x8a41('0x2'));var rp=require(_0x8a41('0x3'));var fs=require('fs');var path=require(_0x8a41('0x4'));var rimraf=require('rimraf');var config=require(_0x8a41('0x5'));var attributes=require('./intDeskField.attributes');module[_0x8a41('0x6')]=function(_0x4324c1,_0x288306){return _0x4324c1[_0x8a41('0x7')](_0x8a41('0x8'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x8a41('0x9'),_0x8a41('0xa')],'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 f6e240d..43ee3f3 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 _0x4653=['DeskField,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','info','request\x20sent','debug','stringify','code','error'];(function(_0x24f326,_0x616a7){var _0x488e2d=function(_0x293d9a){while(--_0x293d9a){_0x24f326['push'](_0x24f326['shift']());}};_0x488e2d(++_0x616a7);}(_0x4653,0x154));var _0x3465=function(_0x500ae9,_0x346b76){_0x500ae9=_0x500ae9-0x0;var _0x5a47b3=_0x4653[_0x500ae9];return _0x5a47b3;};'use strict';var _=require('lodash');var util=require(_0x3465('0x0'));var moment=require(_0x3465('0x1'));var BPromise=require(_0x3465('0x2'));var rs=require(_0x3465('0x3'));var fs=require('fs');var Redis=require(_0x3465('0x4'));var db=require(_0x3465('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3465('0x6'))(_0x3465('0x7'));var config=require('../../config/environment');var jayson=require(_0x3465('0x8'));var client=jayson[_0x3465('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42483b,_0x480335,_0x228ac9){return new BPromise(function(_0x23238a,_0x80e791){return client[_0x3465('0xa')](_0x42483b,_0x228ac9)['then'](function(_0xd0a961){logger[_0x3465('0xb')]('DeskField,\x20%s,\x20%s',_0x480335,_0x3465('0xc'));logger[_0x3465('0xd')]('DeskField,\x20%s,\x20%s,\x20%s',_0x480335,'request\x20sent',JSON[_0x3465('0xe')](_0xd0a961));if(_0xd0a961['error']){if(_0xd0a961['error'][_0x3465('0xf')]===0x1f4){logger[_0x3465('0x10')](_0x3465('0x11'),_0x480335,_0xd0a961[_0x3465('0x10')][_0x3465('0x12')]);return _0x80e791(_0xd0a961['error'][_0x3465('0x12')]);}logger[_0x3465('0x10')](_0x3465('0x11'),_0x480335,_0xd0a961['error'][_0x3465('0x12')]);return _0x23238a(_0xd0a961[_0x3465('0x10')][_0x3465('0x12')]);}else{logger[_0x3465('0xb')](_0x3465('0x11'),_0x480335,_0x3465('0xc'));_0x23238a(_0xd0a961[_0x3465('0x13')][_0x3465('0x12')]);}})[_0x3465('0x14')](function(_0x4d5042){logger[_0x3465('0x10')](_0x3465('0x11'),_0x480335,_0x4d5042);_0x80e791(_0x4d5042);});});} \ No newline at end of file +var _0xf3b8=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xf3b8,0x167));var _0x8f3b=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xf3b8[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0x8f3b('0x0'));var util=require(_0x8f3b('0x1'));var moment=require(_0x8f3b('0x2'));var BPromise=require(_0x8f3b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f3b('0x4'));var db=require(_0x8f3b('0x5'))['db'];var utils=require(_0x8f3b('0x6'));var logger=require(_0x8f3b('0x7'))(_0x8f3b('0x8'));var config=require(_0x8f3b('0x9'));var jayson=require(_0x8f3b('0xa'));var client=jayson[_0x8f3b('0xb')][_0x8f3b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3355c8,_0x36e575,_0x2047e7){return new BPromise(function(_0x43298e,_0x50188d){return client[_0x8f3b('0xd')](_0x3355c8,_0x2047e7)[_0x8f3b('0xe')](function(_0x536d66){logger[_0x8f3b('0xf')](_0x8f3b('0x10'),_0x36e575,_0x8f3b('0x11'));logger[_0x8f3b('0x12')](_0x8f3b('0x13'),_0x36e575,_0x8f3b('0x11'),JSON[_0x8f3b('0x14')](_0x536d66));if(_0x536d66[_0x8f3b('0x15')]){if(_0x536d66[_0x8f3b('0x15')][_0x8f3b('0x16')]===0x1f4){logger[_0x8f3b('0x15')](_0x8f3b('0x10'),_0x36e575,_0x536d66[_0x8f3b('0x15')][_0x8f3b('0x17')]);return _0x50188d(_0x536d66[_0x8f3b('0x15')][_0x8f3b('0x17')]);}logger[_0x8f3b('0x15')]('DeskField,\x20%s,\x20%s',_0x36e575,_0x536d66[_0x8f3b('0x15')][_0x8f3b('0x17')]);return _0x43298e(_0x536d66['error']['message']);}else{logger[_0x8f3b('0xf')](_0x8f3b('0x10'),_0x36e575,_0x8f3b('0x11'));_0x43298e(_0x536d66[_0x8f3b('0x18')][_0x8f3b('0x17')]);}})[_0x8f3b('0x19')](function(_0x1fc9e8){logger[_0x8f3b('0x15')](_0x8f3b('0x10'),_0x36e575,_0x1fc9e8);_0x50188d(_0x1fc9e8);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 397bbc0..849648a 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 _0x4822=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put'];(function(_0x4d82ea,_0x4d459f){var _0x257f4a=function(_0x424c4f){while(--_0x424c4f){_0x4d82ea['push'](_0x4d82ea['shift']());}};_0x257f4a(++_0x4d459f);}(_0x4822,0xab));var _0x2482=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x4822[_0x485b5a];return _0xd2b34d;};'use strict';var multer=require(_0x2482('0x0'));var util=require(_0x2482('0x1'));var path=require(_0x2482('0x2'));var timeout=require(_0x2482('0x3'));var express=require(_0x2482('0x4'));var router=express[_0x2482('0x5')]();var fs_extra=require(_0x2482('0x6'));var auth=require(_0x2482('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2482('0x8'));var controller=require(_0x2482('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2482('0xa')](_0x2482('0xb'),auth[_0x2482('0xc')](),controller[_0x2482('0xd')]);router['get'](_0x2482('0xe'),auth[_0x2482('0xc')](),controller[_0x2482('0xf')]);router[_0x2482('0xa')]('/:id/fields',auth[_0x2482('0xc')](),controller[_0x2482('0x10')]);router[_0x2482('0x11')]('/',auth[_0x2482('0xc')](),controller[_0x2482('0x12')]);router[_0x2482('0x11')](_0x2482('0xe'),auth[_0x2482('0xc')](),controller[_0x2482('0x13')]);router[_0x2482('0x14')](_0x2482('0xb'),auth[_0x2482('0xc')](),controller[_0x2482('0x15')]);router[_0x2482('0x16')](_0x2482('0xb'),auth[_0x2482('0xc')](),controller[_0x2482('0x17')]);module['exports']=router; \ No newline at end of file +var _0xce4b=['get','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','/:id','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x6bddc3,_0x36563e){var _0x868581=function(_0x3a2628){while(--_0x3a2628){_0x6bddc3['push'](_0x6bddc3['shift']());}};_0x868581(++_0x36563e);}(_0xce4b,0xc5));var _0xbce4=function(_0x40ff48,_0x529705){_0x40ff48=_0x40ff48-0x0;var _0xc0676a=_0xce4b[_0x40ff48];return _0xc0676a;};'use strict';var multer=require(_0xbce4('0x0'));var util=require(_0xbce4('0x1'));var path=require(_0xbce4('0x2'));var timeout=require(_0xbce4('0x3'));var express=require(_0xbce4('0x4'));var router=express[_0xbce4('0x5')]();var fs_extra=require(_0xbce4('0x6'));var auth=require(_0xbce4('0x7'));var interaction=require(_0xbce4('0x8'));var config=require(_0xbce4('0x9'));var controller=require('./intDynamics365Account.controller');router[_0xbce4('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbce4('0xa')]('/:id',auth[_0xbce4('0xb')](),controller[_0xbce4('0xc')]);router[_0xbce4('0xa')]('/:id/configurations',auth[_0xbce4('0xb')](),controller[_0xbce4('0xd')]);router[_0xbce4('0xa')](_0xbce4('0xe'),auth[_0xbce4('0xb')](),controller[_0xbce4('0xf')]);router[_0xbce4('0x10')]('/',auth[_0xbce4('0xb')](),controller[_0xbce4('0x11')]);router[_0xbce4('0x10')](_0xbce4('0x12'),auth[_0xbce4('0xb')](),controller[_0xbce4('0x13')]);router['put'](_0xbce4('0x14'),auth[_0xbce4('0xb')](),controller[_0xbce4('0x15')]);router[_0xbce4('0x16')](_0xbce4('0x14'),auth[_0xbce4('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 0ef8af3..1f42298 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 _0x2961=['exports','STRING'];(function(_0x1d1dbf,_0x496eec){var _0x5d048d=function(_0xe942f7){while(--_0xe942f7){_0x1d1dbf['push'](_0x1d1dbf['shift']());}};_0x5d048d(++_0x496eec);}(_0x2961,0x15a));var _0x1296=function(_0x3f3514,_0x4dbfea){_0x3f3514=_0x3f3514-0x0;var _0x1203de=_0x2961[_0x3f3514];return _0x1203de;};'use strict';var Sequelize=require('sequelize');module[_0x1296('0x0')]={'name':{'type':Sequelize[_0x1296('0x1')]},'username':{'type':Sequelize[_0x1296('0x1')]},'password':{'type':Sequelize[_0x1296('0x1')]},'remoteUri':{'type':Sequelize[_0x1296('0x1')]},'tenantId':{'type':Sequelize[_0x1296('0x1')]},'clientId':{'type':Sequelize[_0x1296('0x1')]},'clientSecret':{'type':Sequelize[_0x1296('0x1')]},'serverUrl':{'type':Sequelize[_0x1296('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x1296('0x1')]}}; \ No newline at end of file +var _0x51f8=['exports','STRING','sequelize'];(function(_0x366f2a,_0x116363){var _0x6e347d=function(_0x2293e3){while(--_0x2293e3){_0x366f2a['push'](_0x366f2a['shift']());}};_0x6e347d(++_0x116363);}(_0x51f8,0x119));var _0x851f=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x51f8[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x851f('0x0'));module[_0x851f('0x1')]={'name':{'type':Sequelize[_0x851f('0x2')]},'username':{'type':Sequelize[_0x851f('0x2')]},'password':{'type':Sequelize[_0x851f('0x2')]},'remoteUri':{'type':Sequelize[_0x851f('0x2')]},'tenantId':{'type':Sequelize[_0x851f('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x851f('0x2')]},'serverUrl':{'type':Sequelize[_0x851f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x851f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 9bebbf9..e1a633a 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 _0xe57e=['EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','value','GET',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','4.0','Attributes','remove','@odata.type','substring','PicklistAttributeMetadata','MetadataId','all','forEach','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName','DisplayName','TrueOption','FalseOption','?$select=DisplayName,LogicalName','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','status','undefined','limit','count','offset','Content-Range','json','save','update','then','destroy','sendStatus','error','stack','name','send','map','Dynamics365Account','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','catch','show','params','includeAll','find','body','getConfigurations','findOne','Dynamics365Configuration','options','hasOwnProperty','AccountId','Subjects','channel','Descriptions','getDescriptions','create','Dynamics365Field','getFields','ticketType','Incident','PhoneCall','title','customerid','ownerid','caseorigincode','subject','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','concat','username','password','remoteUri','tenantId','clientSecret','slice','lastIndexOf','format','POST','https://login.microsoftonline.com/','clientId','access_token'];(function(_0x7ba621,_0x545d23){var _0x49a136=function(_0x2cf60e){while(--_0x2cf60e){_0x7ba621['push'](_0x7ba621['shift']());}};_0x49a136(++_0x545d23);}(_0xe57e,0xf2));var _0xee57=function(_0x419015,_0x5dcac7){_0x419015=_0x419015-0x0;var _0x53837b=_0xe57e[_0x419015];return _0x53837b;};'use strict';var emlformat=require(_0xee57('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xee57('0x1'));var jsonpatch=require(_0xee57('0x2'));var rp=require(_0xee57('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xee57('0x4'));var util=require('util');var path=require(_0xee57('0x5'));var sox=require(_0xee57('0x6'));var csv=require(_0xee57('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee57('0x8'));var squel=require(_0xee57('0x9'));var crypto=require(_0xee57('0xa'));var jsforce=require(_0xee57('0xb'));var deskjs=require(_0xee57('0xc'));var toCsv=require(_0xee57('0x7'));var querystring=require(_0xee57('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xee57('0xe'));var qs=require(_0xee57('0xf'));var as=require(_0xee57('0x10'));var hardwareService=require(_0xee57('0x11'));var logger=require(_0xee57('0x12'))(_0xee57('0x13'));var utils=require(_0xee57('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee57('0x15'))['db'];var integrations=require(_0xee57('0x16'));function respondWithStatusCode(_0x298f51,_0x390305){_0x390305=_0x390305||0xcc;return function(_0xdc2ed){if(_0xdc2ed){return _0x298f51['sendStatus'](_0x390305);}return _0x298f51[_0xee57('0x17')](_0x390305)['end']();};}function respondWithResult(_0x2a807e,_0x4f37fb){_0x4f37fb=_0x4f37fb||0xc8;return function(_0x312fe3){if(_0x312fe3){return _0x2a807e['status'](_0x4f37fb)['json'](_0x312fe3);}};}function respondWithFilteredResult(_0x2141f0,_0x44d800){return function(_0x322120){if(_0x322120){var _0x17a05a=typeof _0x44d800['offset']===_0xee57('0x18')&&typeof _0x44d800[_0xee57('0x19')]==='undefined';var _0x5400a5=_0x322120['count'];var _0x41e018=_0x17a05a?0x0:_0x44d800['offset'];var _0x9a6461=_0x17a05a?_0x322120[_0xee57('0x1a')]:_0x44d800[_0xee57('0x1b')]+_0x44d800[_0xee57('0x19')];var _0x396318;if(_0x9a6461>=_0x5400a5){_0x9a6461=_0x5400a5;_0x396318=0xc8;}else{_0x396318=0xce;}_0x2141f0[_0xee57('0x17')](_0x396318);return _0x2141f0['set'](_0xee57('0x1c'),_0x41e018+'-'+_0x9a6461+'/'+_0x5400a5)[_0xee57('0x1d')](_0x322120);}return null;};}function patchUpdates(_0x10b83c){return function(_0x529e0f){try{jsonpatch['apply'](_0x529e0f,_0x10b83c,!![]);}catch(_0x102fa8){return BPromise['reject'](_0x102fa8);}return _0x529e0f[_0xee57('0x1e')]();};}function saveUpdates(_0xeffac8,_0x54486f){return function(_0x466869){if(_0x466869){return _0x466869[_0xee57('0x1f')](_0xeffac8)[_0xee57('0x20')](function(_0x306f1f){return _0x306f1f;});}return null;};}function removeEntity(_0x54a70b,_0x2b5747){return function(_0xb1fdf2){if(_0xb1fdf2){return _0xb1fdf2[_0xee57('0x21')]()[_0xee57('0x20')](function(){_0x54a70b[_0xee57('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7d7236,_0x17fd20){return function(_0x4eedc9){if(!_0x4eedc9){_0x7d7236[_0xee57('0x22')](0x194);}return _0x4eedc9;};}function handleError(_0x5c7fc1,_0x5505c2){_0x5505c2=_0x5505c2||0x1f4;return function(_0x1f16fd){logger[_0xee57('0x23')](_0x1f16fd[_0xee57('0x24')]);if(_0x1f16fd[_0xee57('0x25')]){delete _0x1f16fd['name'];}_0x5c7fc1['status'](_0x5505c2)[_0xee57('0x26')](_0x1f16fd);};}exports['index']=function(_0x11f6fd,_0x2c4e0f){var _0x1c7079={},_0x19e4a6={},_0x13a8fe={'count':0x0,'rows':[]};var _0x5466bf=_[_0xee57('0x27')](db[_0xee57('0x28')][_0xee57('0x29')],function(_0x51ff51){return{'name':_0x51ff51[_0xee57('0x2a')],'type':_0x51ff51[_0xee57('0x2b')]['key']};});_0x19e4a6[_0xee57('0x2c')]=_[_0xee57('0x27')](_0x5466bf,_0xee57('0x25'));_0x19e4a6[_0xee57('0x2d')]=_[_0xee57('0x2e')](_0x11f6fd['query']);_0x19e4a6[_0xee57('0x2f')]=_[_0xee57('0x30')](_0x19e4a6['model'],_0x19e4a6[_0xee57('0x2d')]);_0x1c7079[_0xee57('0x31')]=_[_0xee57('0x30')](_0x19e4a6[_0xee57('0x2c')],qs[_0xee57('0x32')](_0x11f6fd['query'][_0xee57('0x32')]));_0x1c7079[_0xee57('0x31')]=_0x1c7079[_0xee57('0x31')][_0xee57('0x33')]?_0x1c7079[_0xee57('0x31')]:_0x19e4a6[_0xee57('0x2c')];if(!_0x11f6fd['query']['hasOwnProperty'](_0xee57('0x34'))){_0x1c7079[_0xee57('0x19')]=qs[_0xee57('0x19')](_0x11f6fd['query']['limit']);_0x1c7079[_0xee57('0x1b')]=qs[_0xee57('0x1b')](_0x11f6fd['query'][_0xee57('0x1b')]);}_0x1c7079[_0xee57('0x35')]=qs['sort'](_0x11f6fd[_0xee57('0x2d')][_0xee57('0x36')]);_0x1c7079[_0xee57('0x37')]=qs[_0xee57('0x2f')](_[_0xee57('0x38')](_0x11f6fd['query'],_0x19e4a6['filters']),_0x5466bf);if(_0x11f6fd[_0xee57('0x2d')][_0xee57('0x39')]){_0x1c7079[_0xee57('0x37')]=_[_0xee57('0x3a')](_0x1c7079[_0xee57('0x37')],{'$or':_[_0xee57('0x27')](_0x5466bf,function(_0x2cf137){if(_0x2cf137[_0xee57('0x2b')]!==_0xee57('0x3b')){var _0x368755={};_0x368755[_0x2cf137[_0xee57('0x25')]]={'$like':'%'+_0x11f6fd[_0xee57('0x2d')][_0xee57('0x39')]+'%'};return _0x368755;}})});}_0x1c7079=_['merge']({},_0x1c7079,_0x11f6fd['options']);var _0x581bfd={'where':_0x1c7079['where']};return db[_0xee57('0x28')][_0xee57('0x1a')](_0x581bfd)[_0xee57('0x20')](function(_0x48152d){_0x13a8fe['count']=_0x48152d;if(_0x11f6fd[_0xee57('0x2d')]['includeAll']){_0x1c7079[_0xee57('0x3c')]=[{'all':!![]}];}return db[_0xee57('0x28')]['findAll'](_0x1c7079);})[_0xee57('0x20')](function(_0x576898){_0x13a8fe['rows']=_0x576898;return _0x13a8fe;})[_0xee57('0x20')](respondWithFilteredResult(_0x2c4e0f,_0x1c7079))[_0xee57('0x3d')](handleError(_0x2c4e0f,null));};exports[_0xee57('0x3e')]=function(_0x3336a4,_0x3813b4){var _0x5c13e5={'raw':![],'where':{'id':_0x3336a4[_0xee57('0x3f')]['id']}},_0x41674a={};_0x41674a[_0xee57('0x2c')]=_[_0xee57('0x2e')](db[_0xee57('0x28')][_0xee57('0x29')]);_0x41674a['query']=_[_0xee57('0x2e')](_0x3336a4[_0xee57('0x2d')]);_0x41674a['filters']=_[_0xee57('0x30')](_0x41674a[_0xee57('0x2c')],_0x41674a[_0xee57('0x2d')]);_0x5c13e5[_0xee57('0x31')]=_[_0xee57('0x30')](_0x41674a[_0xee57('0x2c')],qs[_0xee57('0x32')](_0x3336a4[_0xee57('0x2d')][_0xee57('0x32')]));_0x5c13e5[_0xee57('0x31')]=_0x5c13e5['attributes'][_0xee57('0x33')]?_0x5c13e5[_0xee57('0x31')]:_0x41674a[_0xee57('0x2c')];if(_0x3336a4[_0xee57('0x2d')][_0xee57('0x40')]){_0x5c13e5[_0xee57('0x3c')]=[{'all':!![]}];}_0x5c13e5=_['merge']({},_0x5c13e5,_0x3336a4['options']);return db[_0xee57('0x28')][_0xee57('0x41')](_0x5c13e5)['then'](handleEntityNotFound(_0x3813b4,null))[_0xee57('0x20')](respondWithResult(_0x3813b4,null))[_0xee57('0x3d')](handleError(_0x3813b4,null));};exports['create']=function(_0xbff060,_0x336ed9){return db[_0xee57('0x28')]['create'](_0xbff060[_0xee57('0x42')],{})[_0xee57('0x20')](respondWithResult(_0x336ed9,0xc9))['catch'](handleError(_0x336ed9,null));};exports[_0xee57('0x1f')]=function(_0x33faf6,_0x2fd2b4){if(_0x33faf6[_0xee57('0x42')]['id']){delete _0x33faf6[_0xee57('0x42')]['id'];}return db[_0xee57('0x28')]['find']({'where':{'id':_0x33faf6['params']['id']}})[_0xee57('0x20')](handleEntityNotFound(_0x2fd2b4,null))[_0xee57('0x20')](saveUpdates(_0x33faf6[_0xee57('0x42')],null))[_0xee57('0x20')](respondWithResult(_0x2fd2b4,null))[_0xee57('0x3d')](handleError(_0x2fd2b4,null));};exports['destroy']=function(_0x3dc8b8,_0x2b8a81){return db[_0xee57('0x28')][_0xee57('0x41')]({'where':{'id':_0x3dc8b8[_0xee57('0x3f')]['id']}})[_0xee57('0x20')](handleEntityNotFound(_0x2b8a81,null))[_0xee57('0x20')](removeEntity(_0x2b8a81,null))[_0xee57('0x3d')](handleError(_0x2b8a81,null));};exports[_0xee57('0x43')]=function(_0xc3f41d,_0x4ae37e,_0x43e3a6){var _0x2b4acf={};var _0x37697c={};var _0x23fd8b;var _0x4031d4;return db[_0xee57('0x28')][_0xee57('0x44')]({'where':{'id':_0xc3f41d[_0xee57('0x3f')]['id']}})[_0xee57('0x20')](handleEntityNotFound(_0x4ae37e,null))[_0xee57('0x20')](function(_0x5cc7e3){if(_0x5cc7e3){_0x23fd8b=_0x5cc7e3;_0x37697c[_0xee57('0x2c')]=_[_0xee57('0x2e')](db[_0xee57('0x45')][_0xee57('0x29')]);_0x37697c[_0xee57('0x2d')]=_['keys'](_0xc3f41d[_0xee57('0x2d')]);_0x37697c['filters']=_[_0xee57('0x30')](_0x37697c[_0xee57('0x2c')],_0x37697c[_0xee57('0x2d')]);_0x2b4acf['attributes']=_[_0xee57('0x30')](_0x37697c['model'],qs[_0xee57('0x32')](_0xc3f41d[_0xee57('0x2d')][_0xee57('0x32')]));_0x2b4acf[_0xee57('0x31')]=_0x2b4acf[_0xee57('0x31')]['length']?_0x2b4acf['attributes']:_0x37697c['model'];_0x2b4acf[_0xee57('0x35')]=qs[_0xee57('0x36')](_0xc3f41d[_0xee57('0x2d')]['sort']);_0x2b4acf[_0xee57('0x37')]=qs[_0xee57('0x2f')](_[_0xee57('0x38')](_0xc3f41d[_0xee57('0x2d')],_0x37697c[_0xee57('0x2f')]));if(_0xc3f41d[_0xee57('0x2d')][_0xee57('0x39')]){_0x2b4acf[_0xee57('0x37')]=_[_0xee57('0x3a')](_0x2b4acf['where'],{'$or':_[_0xee57('0x27')](_0x2b4acf['attributes'],function(_0x1c957a){var _0x4de867={};_0x4de867[_0x1c957a]={'$like':'%'+_0xc3f41d[_0xee57('0x2d')][_0xee57('0x39')]+'%'};return _0x4de867;})});}_0x2b4acf=_[_0xee57('0x3a')]({},_0x2b4acf,_0xc3f41d[_0xee57('0x46')]);return _0x23fd8b[_0xee57('0x43')](_0x2b4acf);}})[_0xee57('0x20')](function(_0x567f64){if(_0x567f64){_0x4031d4=_0x567f64[_0xee57('0x33')];if(!_0xc3f41d[_0xee57('0x2d')][_0xee57('0x47')](_0xee57('0x34'))){_0x2b4acf['limit']=qs['limit'](_0xc3f41d[_0xee57('0x2d')][_0xee57('0x19')]);_0x2b4acf['offset']=qs[_0xee57('0x1b')](_0xc3f41d['query'][_0xee57('0x1b')]);}return _0x23fd8b[_0xee57('0x43')](_0x2b4acf);}})['then'](function(_0x146d91){if(_0x146d91){return _0x146d91?{'count':_0x4031d4,'rows':_0x146d91}:null;}})['then'](respondWithResult(_0x4ae37e,null))['catch'](handleError(_0x4ae37e,null));};exports['addConfiguration']=function(_0x43db41,_0x4db647,_0x4a7a42){if(_0x43db41[_0xee57('0x42')]['id']){delete _0x43db41['body']['id'];}return db[_0xee57('0x28')]['findOne']({'where':{'id':_0x43db41[_0xee57('0x3f')]['id']}})[_0xee57('0x20')](handleEntityNotFound(_0x4db647,null))[_0xee57('0x20')](function(_0x4a47ab){if(_0x4a47ab){_0x43db41[_0xee57('0x42')][_0xee57('0x48')]=_0x4a47ab['id'];_0x43db41[_0xee57('0x42')][_0xee57('0x49')]=integrations['getSubjects'](_0x43db41['body'][_0xee57('0x4a')],_0x43db41[_0xee57('0x42')][_0xee57('0x2b')]);_0x43db41['body'][_0xee57('0x4b')]=integrations[_0xee57('0x4c')](_0x43db41[_0xee57('0x42')][_0xee57('0x4a')],_0x43db41[_0xee57('0x42')][_0xee57('0x2b')]);return db[_0xee57('0x45')][_0xee57('0x4d')](_0x43db41[_0xee57('0x42')],{'include':[{'model':db[_0xee57('0x4e')],'as':'Subjects'},{'model':db[_0xee57('0x4e')],'as':_0xee57('0x4b')}]});}return null;})[_0xee57('0x20')](respondWithResult(_0x4db647,null))[_0xee57('0x3d')](handleError(_0x4db647,null));};exports[_0xee57('0x4f')]=function(_0x3264d4,_0xe25def,_0x10a93a){var _0x35ffae=_0x3264d4[_0xee57('0x2d')][_0xee57('0x50')];var _0x3c33af=_0x35ffae==='incident'?_0xee57('0x51'):_0xee57('0x52');var _0x3dd8da='';var _0x3e9491='';var _0x427a3e='';var _0x2b05d0='';var _0x5e02c3='';var _0x33974c='';var _0x56d44c='';var _0x39c3a1='';var _0x3ec3fa=[_0xee57('0x53'),'description',_0xee57('0x54'),_0xee57('0x55'),_0xee57('0x56'),_0xee57('0x57'),'phonenumber','regardingobjectid','directioncode',_0xee57('0x58')];var _0x371d21=[_0xee57('0x59'),_0xee57('0x5a'),_0xee57('0x5b'),_0xee57('0x5c'),_0xee57('0x5d'),_0xee57('0x5e'),_0xee57('0x5f'),'contractidname',_0xee57('0x60'),_0xee57('0x61'),_0xee57('0x62'),_0xee57('0x63'),_0xee57('0x64'),_0xee57('0x65'),'createdonbehalfbyyominame',_0xee57('0x66'),_0xee57('0x67'),_0xee57('0x68'),_0xee57('0x69'),_0xee57('0x6a'),_0xee57('0x6b'),_0xee57('0x6c'),'escalatedon',_0xee57('0x6d'),_0xee57('0x6e'),'followupby',_0xee57('0x6f'),_0xee57('0x70'),_0xee57('0x71'),'lastonholdtime',_0xee57('0x72'),_0xee57('0x73'),_0xee57('0x74'),_0xee57('0x75'),'modifiedbyyominame',_0xee57('0x76'),_0xee57('0x77'),_0xee57('0x78'),_0xee57('0x79'),_0xee57('0x7a'),_0xee57('0x7b'),_0xee57('0x7c'),_0xee57('0x7d'),'owneridname',_0xee57('0x7e'),_0xee57('0x7f'),_0xee57('0x80'),'primarycontactidname',_0xee57('0x81'),'prioritycodename',_0xee57('0x82'),_0xee57('0x83'),_0xee57('0x84'),_0xee57('0x85'),_0xee57('0x86'),_0xee57('0x87'),'responsiblecontactidyominame',_0xee57('0x88'),_0xee57('0x89'),_0xee57('0x8a'),_0xee57('0x8b'),'statecode','statuscode',_0xee57('0x8c'),_0xee57('0x8d'),_0xee57('0x8e'),_0xee57('0x8f'),_0xee57('0x90'),'utcconversiontimezonecode','versionnumber'];var _0x8f1d58=_0x3ec3fa[_0xee57('0x91')](_0x371d21);return db[_0xee57('0x28')][_0xee57('0x44')]({'where':{'id':_0x3264d4[_0xee57('0x3f')]['id']},'attributes':['id',_0xee57('0x92'),_0xee57('0x93'),_0xee57('0x94'),_0xee57('0x95'),'clientId',_0xee57('0x96')]})[_0xee57('0x20')](handleEntityNotFound(_0xe25def,null))[_0xee57('0x20')](function(_0x396a21){if(_0x396a21){_0x39c3a1=_0x396a21['remoteUri'];var _0x4d894a=_0x39c3a1[_0xee57('0x97')](-0x1);if(_0x4d894a==='/'){_0x39c3a1=_0x39c3a1['substring'](0x0,_0x39c3a1[_0xee57('0x98')](_0x4d894a));}_0x56d44c=util[_0xee57('0x99')]('%s/api/data/v9.0/',_0x39c3a1);var _0x1c149d={'method':_0xee57('0x9a'),'uri':_0xee57('0x9b')+_0x396a21[_0xee57('0x95')]+'/oauth2/token','form':{'client_id':_0x396a21[_0xee57('0x9c')],'resource':_0x39c3a1,'username':_0x396a21[_0xee57('0x92')],'password':_0x396a21['password'],'grant_type':_0xee57('0x93'),'client_secret':_0x396a21[_0xee57('0x96')]},'json':!![]};return rp(_0x1c149d);}})[_0xee57('0x20')](function(_0x1c1805){_0x33974c=_0x1c1805[_0xee57('0x9d')];var _0x22b20f={'method':'GET','uri':encodeURI(_0x56d44c+_0xee57('0x9e')+_0x3c33af+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x33974c,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x22b20f);})['then'](function(_0x160aa0){var _0x605eae=_0x160aa0[_0xee57('0x9f')][0x0];var _0x181807=_0x605eae['MetadataId'];var _0x27ef4f={'method':_0xee57('0xa0'),'uri':_0x56d44c+'EntityDefinitions('+_0x181807+_0xee57('0xa1'),'headers':{'Authorization':_0xee57('0xa2')+_0x33974c,'If-None-Match':null,'OData-Version':_0xee57('0xa3')},'json':!![]};return rp(_0x27ef4f);})[_0xee57('0x20')](function(_0x29c6c8){_0x3dd8da=_0x29c6c8;_0x3e9491=_0x3dd8da[_0xee57('0xa4')];_0x3e9491=_[_0xee57('0xa5')](_0x3e9491,function(_0x1aaace){return!_0x8f1d58['includes'](_0x1aaace['LogicalName']);});var _0x2ec98d=[];var _0x24d46d=[];_0x3e9491['forEach'](function(_0x51a4b9){if(_0x51a4b9[_0xee57('0xa6')]){var _0x221ee1=_0x51a4b9[_0xee57('0xa6')][_0xee57('0xa7')](_0x51a4b9[_0xee57('0xa6')][_0xee57('0x98')]('.')+0x1);if(_0x221ee1===_0xee57('0xa8')){_0x2ec98d['push'](getSelectList(_0x56d44c,_0x35ffae,_0x24d46d,_0x3dd8da[_0xee57('0xa9')],_0x51a4b9[_0xee57('0xa9')],_0x33974c));}}});return Promise[_0xee57('0xaa')](_0x2ec98d);})['then'](function(_0xfdf330){_0x427a3e=_0xfdf330[0x0];var _0x1698d3=[];var _0x58f1cb=[];_0x3e9491[_0xee57('0xab')](function(_0x5d6e8e){if(!_[_0xee57('0xac')](_0x5d6e8e[_0xee57('0xa6')])){var _0x258b6c=_0x5d6e8e[_0xee57('0xa6')][_0xee57('0xa7')](_0x5d6e8e['@odata.type']['lastIndexOf']('.')+0x1);if(_0x258b6c===_0xee57('0xad')){_0x1698d3[_0xee57('0xae')](getBooleanList(_0x56d44c,_0x35ffae,_0x58f1cb,_0x3dd8da[_0xee57('0xa9')],_0x5d6e8e[_0xee57('0xa9')],_0x33974c));}}});return Promise[_0xee57('0xaa')](_0x1698d3);})[_0xee57('0x20')](function(_0x5557e1){_0x2b05d0=_0x5557e1[0x0];var _0xeb94bd=[];var _0x2f2027=[];_0x3e9491[_0xee57('0xab')](function(_0x31aa4e){if(_0x31aa4e['@odata.type']){var _0x254d9d=_0x31aa4e[_0xee57('0xa6')][_0xee57('0xa7')](_0x31aa4e[_0xee57('0xa6')][_0xee57('0x98')]('.')+0x1);if(_0x254d9d===_0xee57('0xaf')||_0x254d9d===_0xee57('0xb0')||_0x254d9d===_0xee57('0xb1')||_0x254d9d==='IntegerAttributeMetadata'||_0x254d9d===_0xee57('0xb2')||_0x254d9d===_0xee57('0xb3')||_0x254d9d==='StatusAttributeMetadata'||_0x254d9d===_0xee57('0xb4')||_0x254d9d===_0xee57('0xb5')||_0x254d9d===_0xee57('0xb6')){_0xeb94bd['push'](getInputList(_0x56d44c,_0x35ffae,_0x254d9d,_0x2f2027,_0x3dd8da[_0xee57('0xa9')],_0x31aa4e[_0xee57('0xa9')],_0x33974c));}}});return Promise['all'](_0xeb94bd);})[_0xee57('0x20')](function(_0x2a429d){_0x5e02c3=_0x2a429d[0x0];var _0x34b9e9=_0x427a3e[_0xee57('0x91')](_0x2b05d0)[_0xee57('0x91')](_0x5e02c3);var _0x1836ac={'count':_0x34b9e9['length'],'rows':_0x34b9e9};return _0x1836ac;})['then'](respondWithResult(_0xe25def,null))[_0xee57('0x3d')](function(_0x4d711a){var _0x4eb727=_0x3264d4[_0xee57('0x2d')][_0xee57('0xb7')]?0x1f4:_0x4d711a[_0xee57('0xb8')]||0x1f4;logger[_0xee57('0x23')](_0x4d711a['stack']);delete _0x4d711a[_0xee57('0x25')];if(_0x4eb727===0x191){_0x4eb727=0x190;}_0xe25def[_0xee57('0x17')](_0x4eb727)[_0xee57('0x26')](_0x3264d4[_0xee57('0x2d')][_0xee57('0xb7')]?{'message':_0xee57('0xb9'),'statusCode':_0x4d711a[_0xee57('0xb8')]}:_0x4d711a);});};function getSelectList(_0x465254,_0x1bd596,_0xb01d3a,_0x1de26b,_0x5666a2,_0x7ad523){var _0x356c9a={'method':'GET','uri':_0x465254+_0xee57('0xba')+_0x1de26b+_0xee57('0xbb')+_0x5666a2+_0xee57('0xbc')+_0xee57('0xbd'),'headers':{'Authorization':_0xee57('0xa2')+_0x7ad523,'If-None-Match':null,'OData-Version':_0xee57('0xa3')},'json':!![]};return rp(_0x356c9a)['then'](function(_0x4c3488){var _0x513490=[];var _0x2ddb9a=_0x4c3488[_0xee57('0xbe')][_0xee57('0xbf')];_0x2ddb9a[_0xee57('0xab')](function(_0x4da04b){_0x513490[_0xee57('0xae')]({'name':_0x4da04b[_0xee57('0xc0')][_0xee57('0xc1')][_0xee57('0xc0')],'value':String(_0x4da04b[_0xee57('0xc2')])});});var _0x2d4650={'id':_0x1bd596+'_'+_0x4c3488[_0xee57('0xc3')],'name':_0x4c3488[_0xee57('0xc4')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x513490};_0xb01d3a[_0xee57('0xae')](_0x2d4650);return _0xb01d3a;});}function getBooleanList(_0x17cbc7,_0x8fbd0,_0x3c55d5,_0x845bac,_0x53a369,_0x198ce3){var _0x2874a1={'method':'GET','uri':_0x17cbc7+_0xee57('0xba')+_0x845bac+')/Attributes('+_0x53a369+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xee57('0xa2')+_0x198ce3,'If-None-Match':null,'OData-Version':_0xee57('0xa3')},'json':!![]};return rp(_0x2874a1)[_0xee57('0x20')](function(_0x510c93){var _0x18fdf5=[];_0x18fdf5[_0xee57('0xae')]({'name':_0x510c93[_0xee57('0xbe')][_0xee57('0xc5')]['Label'][_0xee57('0xc1')][_0xee57('0xc0')],'value':'true'},{'name':_0x510c93[_0xee57('0xbe')][_0xee57('0xc6')]['Label'][_0xee57('0xc1')]['Label'],'value':'false'});var _0x47332d={'id':_0x8fbd0+'_'+_0x510c93[_0xee57('0xc3')],'name':_0x510c93[_0xee57('0xc4')][_0xee57('0xc1')][_0xee57('0xc0')],'custom':![],'options':_0x18fdf5};_0x3c55d5['push'](_0x47332d);return _0x3c55d5;});}function getInputList(_0x3949b3,_0x17a1ed,_0x3af863,_0x462199,_0x4cfe92,_0x3e4eac,_0xb12bc5){var _0x153b2f={'method':_0xee57('0xa0'),'uri':_0x3949b3+'EntityDefinitions('+_0x4cfe92+')/Attributes('+_0x3e4eac+')/Microsoft.Dynamics.CRM.'+_0x3af863+_0xee57('0xc7'),'headers':{'Authorization':_0xee57('0xa2')+_0xb12bc5,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x153b2f)[_0xee57('0x20')](function(_0x13475e){var _0x22c904={'id':_0x17a1ed+'_'+_0x13475e['LogicalName'],'name':_0x13475e[_0xee57('0xc4')][_0xee57('0xc1')]?_0x13475e[_0xee57('0xc4')][_0xee57('0xc1')][_0xee57('0xc0')]:_0x13475e['LogicalName'],'custom':![],'options':[]};_0x462199[_0xee57('0xae')](_0x22c904);return _0x462199;});} \ No newline at end of file +var _0x5a01=['Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','limit','undefined','count','set','Content-Range','apply','save','update','then','sendStatus','error','name','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','destroy','findOne','Dynamics365Configuration','nolimit','getConfigurations','AccountId','Subjects','getSubjects','getDescriptions','channel','Dynamics365Field','Descriptions','getFields','incident','Incident','PhoneCall','title','description','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','kbarticleidname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','traversedpath','versionnumber','concat','username','remoteUri','tenantId','clientId','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','password','clientSecret','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','MetadataId','EntityDefinitions(','Bearer\x20','Attributes','remove','LogicalName','forEach','@odata.type','push','isNil','BooleanAttributeMetadata','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','stack','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options'];(function(_0x6ad9f6,_0x4c6f34){var _0x4bb94e=function(_0x3e6850){while(--_0x3e6850){_0x6ad9f6['push'](_0x6ad9f6['shift']());}};_0x4bb94e(++_0x4c6f34);}(_0x5a01,0x1af));var _0x15a0=function(_0xd511d,_0x3546b9){_0xd511d=_0xd511d-0x0;var _0x3f148e=_0x5a01[_0xd511d];return _0x3f148e;};'use strict';var emlformat=require(_0x15a0('0x0'));var rimraf=require(_0x15a0('0x1'));var zipdir=require(_0x15a0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x15a0('0x3'));var BPromise=require(_0x15a0('0x4'));var Mustache=require('mustache');var util=require(_0x15a0('0x5'));var path=require(_0x15a0('0x6'));var sox=require(_0x15a0('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x15a0('0x8'));var _=require(_0x15a0('0x9'));var squel=require(_0x15a0('0xa'));var crypto=require('crypto');var jsforce=require(_0x15a0('0xb'));var deskjs=require(_0x15a0('0xc'));var toCsv=require(_0x15a0('0xd'));var querystring=require(_0x15a0('0xe'));var Papa=require(_0x15a0('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x15a0('0x10'));var as=require(_0x15a0('0x11'));var hardwareService=require(_0x15a0('0x12'));var logger=require(_0x15a0('0x13'))(_0x15a0('0x14'));var utils=require(_0x15a0('0x15'));var config=require(_0x15a0('0x16'));var licenseUtil=require(_0x15a0('0x17'));var db=require(_0x15a0('0x18'))['db'];var integrations=require(_0x15a0('0x19'));function respondWithStatusCode(_0x17108f,_0x418907){_0x418907=_0x418907||0xcc;return function(_0x58c549){if(_0x58c549){return _0x17108f['sendStatus'](_0x418907);}return _0x17108f[_0x15a0('0x1a')](_0x418907)[_0x15a0('0x1b')]();};}function respondWithResult(_0xa580bf,_0x1c4d39){_0x1c4d39=_0x1c4d39||0xc8;return function(_0x32a1b4){if(_0x32a1b4){return _0xa580bf[_0x15a0('0x1a')](_0x1c4d39)[_0x15a0('0x1c')](_0x32a1b4);}};}function respondWithFilteredResult(_0x2568ee,_0x2b8a17){return function(_0x547d10){if(_0x547d10){var _0x40d6e7=typeof _0x2b8a17['offset']==='undefined'&&typeof _0x2b8a17[_0x15a0('0x1d')]===_0x15a0('0x1e');var _0x45cf59=_0x547d10[_0x15a0('0x1f')];var _0x5d4373=_0x40d6e7?0x0:_0x2b8a17['offset'];var _0x5044c0=_0x40d6e7?_0x547d10[_0x15a0('0x1f')]:_0x2b8a17['offset']+_0x2b8a17[_0x15a0('0x1d')];var _0x54edca;if(_0x5044c0>=_0x45cf59){_0x5044c0=_0x45cf59;_0x54edca=0xc8;}else{_0x54edca=0xce;}_0x2568ee[_0x15a0('0x1a')](_0x54edca);return _0x2568ee[_0x15a0('0x20')](_0x15a0('0x21'),_0x5d4373+'-'+_0x5044c0+'/'+_0x45cf59)[_0x15a0('0x1c')](_0x547d10);}return null;};}function patchUpdates(_0x225aac){return function(_0xeeefcf){try{jsonpatch[_0x15a0('0x22')](_0xeeefcf,_0x225aac,!![]);}catch(_0x4d076a){return BPromise['reject'](_0x4d076a);}return _0xeeefcf[_0x15a0('0x23')]();};}function saveUpdates(_0x23a2f6,_0x349623){return function(_0x54897f){if(_0x54897f){return _0x54897f[_0x15a0('0x24')](_0x23a2f6)[_0x15a0('0x25')](function(_0x42dc91){return _0x42dc91;});}return null;};}function removeEntity(_0x53e470,_0x559024){return function(_0x3f251e){if(_0x3f251e){return _0x3f251e['destroy']()[_0x15a0('0x25')](function(){_0x53e470[_0x15a0('0x1a')](0xcc)[_0x15a0('0x1b')]();});}};}function handleEntityNotFound(_0x2845ec,_0x23a06b){return function(_0x20cbd3){if(!_0x20cbd3){_0x2845ec[_0x15a0('0x26')](0x194);}return _0x20cbd3;};}function handleError(_0x299183,_0x3608d6){_0x3608d6=_0x3608d6||0x1f4;return function(_0x4123b6){logger[_0x15a0('0x27')](_0x4123b6['stack']);if(_0x4123b6[_0x15a0('0x28')]){delete _0x4123b6['name'];}_0x299183[_0x15a0('0x1a')](_0x3608d6)['send'](_0x4123b6);};}exports[_0x15a0('0x29')]=function(_0x192b11,_0x1a20ed){var _0x15a2e7={},_0x1d76c3={},_0x2c7001={'count':0x0,'rows':[]};var _0x366d1e=_[_0x15a0('0x2a')](db[_0x15a0('0x2b')][_0x15a0('0x2c')],function(_0xf46a73){return{'name':_0xf46a73[_0x15a0('0x2d')],'type':_0xf46a73[_0x15a0('0x2e')][_0x15a0('0x2f')]};});_0x1d76c3[_0x15a0('0x30')]=_['map'](_0x366d1e,_0x15a0('0x28'));_0x1d76c3[_0x15a0('0x31')]=_['keys'](_0x192b11['query']);_0x1d76c3[_0x15a0('0x32')]=_[_0x15a0('0x33')](_0x1d76c3['model'],_0x1d76c3[_0x15a0('0x31')]);_0x15a2e7[_0x15a0('0x34')]=_['intersection'](_0x1d76c3[_0x15a0('0x30')],qs[_0x15a0('0x35')](_0x192b11[_0x15a0('0x31')]['fields']));_0x15a2e7[_0x15a0('0x34')]=_0x15a2e7[_0x15a0('0x34')][_0x15a0('0x36')]?_0x15a2e7[_0x15a0('0x34')]:_0x1d76c3['model'];if(!_0x192b11[_0x15a0('0x31')][_0x15a0('0x37')]('nolimit')){_0x15a2e7['limit']=qs['limit'](_0x192b11[_0x15a0('0x31')][_0x15a0('0x1d')]);_0x15a2e7[_0x15a0('0x38')]=qs[_0x15a0('0x38')](_0x192b11[_0x15a0('0x31')][_0x15a0('0x38')]);}_0x15a2e7[_0x15a0('0x39')]=qs[_0x15a0('0x3a')](_0x192b11[_0x15a0('0x31')][_0x15a0('0x3a')]);_0x15a2e7[_0x15a0('0x3b')]=qs[_0x15a0('0x32')](_[_0x15a0('0x3c')](_0x192b11[_0x15a0('0x31')],_0x1d76c3[_0x15a0('0x32')]),_0x366d1e);if(_0x192b11[_0x15a0('0x31')][_0x15a0('0x3d')]){_0x15a2e7[_0x15a0('0x3b')]=_[_0x15a0('0x3e')](_0x15a2e7[_0x15a0('0x3b')],{'$or':_[_0x15a0('0x2a')](_0x366d1e,function(_0x3b2856){if(_0x3b2856['type']!==_0x15a0('0x3f')){var _0x3caf20={};_0x3caf20[_0x3b2856[_0x15a0('0x28')]]={'$like':'%'+_0x192b11[_0x15a0('0x31')][_0x15a0('0x3d')]+'%'};return _0x3caf20;}})});}_0x15a2e7=_['merge']({},_0x15a2e7,_0x192b11[_0x15a0('0x40')]);var _0x19edf8={'where':_0x15a2e7[_0x15a0('0x3b')]};return db[_0x15a0('0x2b')]['count'](_0x19edf8)[_0x15a0('0x25')](function(_0x42b2b4){_0x2c7001[_0x15a0('0x1f')]=_0x42b2b4;if(_0x192b11[_0x15a0('0x31')][_0x15a0('0x41')]){_0x15a2e7[_0x15a0('0x42')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x15a0('0x43')](_0x15a2e7);})[_0x15a0('0x25')](function(_0x345c30){_0x2c7001[_0x15a0('0x44')]=_0x345c30;return _0x2c7001;})['then'](respondWithFilteredResult(_0x1a20ed,_0x15a2e7))[_0x15a0('0x45')](handleError(_0x1a20ed,null));};exports[_0x15a0('0x46')]=function(_0xbd154d,_0x5989f7){var _0xec055a={'raw':![],'where':{'id':_0xbd154d[_0x15a0('0x47')]['id']}},_0x4f3367={};_0x4f3367[_0x15a0('0x30')]=_[_0x15a0('0x48')](db[_0x15a0('0x2b')]['rawAttributes']);_0x4f3367[_0x15a0('0x31')]=_[_0x15a0('0x48')](_0xbd154d['query']);_0x4f3367['filters']=_['intersection'](_0x4f3367['model'],_0x4f3367[_0x15a0('0x31')]);_0xec055a[_0x15a0('0x34')]=_[_0x15a0('0x33')](_0x4f3367[_0x15a0('0x30')],qs['fields'](_0xbd154d[_0x15a0('0x31')][_0x15a0('0x35')]));_0xec055a[_0x15a0('0x34')]=_0xec055a[_0x15a0('0x34')]['length']?_0xec055a[_0x15a0('0x34')]:_0x4f3367['model'];if(_0xbd154d[_0x15a0('0x31')][_0x15a0('0x41')]){_0xec055a[_0x15a0('0x42')]=[{'all':!![]}];}_0xec055a=_[_0x15a0('0x3e')]({},_0xec055a,_0xbd154d[_0x15a0('0x40')]);return db[_0x15a0('0x2b')][_0x15a0('0x49')](_0xec055a)['then'](handleEntityNotFound(_0x5989f7,null))[_0x15a0('0x25')](respondWithResult(_0x5989f7,null))[_0x15a0('0x45')](handleError(_0x5989f7,null));};exports[_0x15a0('0x4a')]=function(_0x462b72,_0xd9ded){return db[_0x15a0('0x2b')][_0x15a0('0x4a')](_0x462b72[_0x15a0('0x4b')],{})[_0x15a0('0x25')](respondWithResult(_0xd9ded,0xc9))['catch'](handleError(_0xd9ded,null));};exports['update']=function(_0x10372a,_0x22a665){if(_0x10372a[_0x15a0('0x4b')]['id']){delete _0x10372a[_0x15a0('0x4b')]['id'];}return db[_0x15a0('0x2b')][_0x15a0('0x49')]({'where':{'id':_0x10372a[_0x15a0('0x47')]['id']}})[_0x15a0('0x25')](handleEntityNotFound(_0x22a665,null))[_0x15a0('0x25')](saveUpdates(_0x10372a[_0x15a0('0x4b')],null))[_0x15a0('0x25')](respondWithResult(_0x22a665,null))[_0x15a0('0x45')](handleError(_0x22a665,null));};exports[_0x15a0('0x4c')]=function(_0x1e2cba,_0x304d80){return db[_0x15a0('0x2b')]['find']({'where':{'id':_0x1e2cba[_0x15a0('0x47')]['id']}})['then'](handleEntityNotFound(_0x304d80,null))[_0x15a0('0x25')](removeEntity(_0x304d80,null))[_0x15a0('0x45')](handleError(_0x304d80,null));};exports['getConfigurations']=function(_0x24afd4,_0x14eeaa,_0x19e612){var _0x45574a={};var _0x44831d={};var _0x8b30e9;var _0xb14ccf;return db['Dynamics365Account'][_0x15a0('0x4d')]({'where':{'id':_0x24afd4['params']['id']}})[_0x15a0('0x25')](handleEntityNotFound(_0x14eeaa,null))['then'](function(_0x595f45){if(_0x595f45){_0x8b30e9=_0x595f45;_0x44831d[_0x15a0('0x30')]=_[_0x15a0('0x48')](db[_0x15a0('0x4e')][_0x15a0('0x2c')]);_0x44831d[_0x15a0('0x31')]=_[_0x15a0('0x48')](_0x24afd4['query']);_0x44831d[_0x15a0('0x32')]=_['intersection'](_0x44831d['model'],_0x44831d[_0x15a0('0x31')]);_0x45574a[_0x15a0('0x34')]=_[_0x15a0('0x33')](_0x44831d[_0x15a0('0x30')],qs['fields'](_0x24afd4[_0x15a0('0x31')][_0x15a0('0x35')]));_0x45574a[_0x15a0('0x34')]=_0x45574a[_0x15a0('0x34')][_0x15a0('0x36')]?_0x45574a[_0x15a0('0x34')]:_0x44831d[_0x15a0('0x30')];_0x45574a[_0x15a0('0x39')]=qs['sort'](_0x24afd4[_0x15a0('0x31')][_0x15a0('0x3a')]);_0x45574a[_0x15a0('0x3b')]=qs['filters'](_['pick'](_0x24afd4[_0x15a0('0x31')],_0x44831d['filters']));if(_0x24afd4[_0x15a0('0x31')][_0x15a0('0x3d')]){_0x45574a['where']=_['merge'](_0x45574a[_0x15a0('0x3b')],{'$or':_['map'](_0x45574a[_0x15a0('0x34')],function(_0x5ca247){var _0x23b2b6={};_0x23b2b6[_0x5ca247]={'$like':'%'+_0x24afd4[_0x15a0('0x31')][_0x15a0('0x3d')]+'%'};return _0x23b2b6;})});}_0x45574a=_[_0x15a0('0x3e')]({},_0x45574a,_0x24afd4[_0x15a0('0x40')]);return _0x8b30e9['getConfigurations'](_0x45574a);}})[_0x15a0('0x25')](function(_0xd7f3ae){if(_0xd7f3ae){_0xb14ccf=_0xd7f3ae[_0x15a0('0x36')];if(!_0x24afd4['query'][_0x15a0('0x37')](_0x15a0('0x4f'))){_0x45574a[_0x15a0('0x1d')]=qs[_0x15a0('0x1d')](_0x24afd4['query'][_0x15a0('0x1d')]);_0x45574a[_0x15a0('0x38')]=qs[_0x15a0('0x38')](_0x24afd4[_0x15a0('0x31')][_0x15a0('0x38')]);}return _0x8b30e9[_0x15a0('0x50')](_0x45574a);}})[_0x15a0('0x25')](function(_0x120c58){if(_0x120c58){return _0x120c58?{'count':_0xb14ccf,'rows':_0x120c58}:null;}})[_0x15a0('0x25')](respondWithResult(_0x14eeaa,null))[_0x15a0('0x45')](handleError(_0x14eeaa,null));};exports['addConfiguration']=function(_0x4585a0,_0x1e72cd,_0x1a0e0f){if(_0x4585a0[_0x15a0('0x4b')]['id']){delete _0x4585a0[_0x15a0('0x4b')]['id'];}return db['Dynamics365Account'][_0x15a0('0x4d')]({'where':{'id':_0x4585a0[_0x15a0('0x47')]['id']}})[_0x15a0('0x25')](handleEntityNotFound(_0x1e72cd,null))[_0x15a0('0x25')](function(_0x1a8ee5){if(_0x1a8ee5){_0x4585a0[_0x15a0('0x4b')][_0x15a0('0x51')]=_0x1a8ee5['id'];_0x4585a0[_0x15a0('0x4b')][_0x15a0('0x52')]=integrations[_0x15a0('0x53')](_0x4585a0[_0x15a0('0x4b')]['channel'],_0x4585a0[_0x15a0('0x4b')][_0x15a0('0x2e')]);_0x4585a0[_0x15a0('0x4b')]['Descriptions']=integrations[_0x15a0('0x54')](_0x4585a0['body'][_0x15a0('0x55')],_0x4585a0[_0x15a0('0x4b')][_0x15a0('0x2e')]);return db[_0x15a0('0x4e')]['create'](_0x4585a0[_0x15a0('0x4b')],{'include':[{'model':db[_0x15a0('0x56')],'as':_0x15a0('0x52')},{'model':db[_0x15a0('0x56')],'as':_0x15a0('0x57')}]});}return null;})['then'](respondWithResult(_0x1e72cd,null))['catch'](handleError(_0x1e72cd,null));};exports[_0x15a0('0x58')]=function(_0x5d27ef,_0x4a40d5,_0xf40bee){var _0x183a89=_0x5d27ef[_0x15a0('0x31')]['ticketType'];var _0x20242d=_0x183a89===_0x15a0('0x59')?_0x15a0('0x5a'):_0x15a0('0x5b');var _0x5e7826='';var _0xcf0f0d='';var _0x15d510='';var _0x51a6f7='';var _0x409ee3='';var _0x3004a5='';var _0x1a6b0d='';var _0x5d6893='';var _0x3960a5=[_0x15a0('0x5c'),_0x15a0('0x5d'),'customerid',_0x15a0('0x5e'),'caseorigincode',_0x15a0('0x5f'),_0x15a0('0x60'),_0x15a0('0x61'),_0x15a0('0x62'),_0x15a0('0x63')];var _0x8829a0=[_0x15a0('0x64'),_0x15a0('0x65'),_0x15a0('0x66'),_0x15a0('0x67'),_0x15a0('0x68'),_0x15a0('0x69'),_0x15a0('0x6a'),_0x15a0('0x6b'),_0x15a0('0x6c'),_0x15a0('0x6d'),_0x15a0('0x6e'),_0x15a0('0x6f'),'createdon',_0x15a0('0x70'),_0x15a0('0x71'),_0x15a0('0x72'),_0x15a0('0x73'),_0x15a0('0x74'),_0x15a0('0x75'),_0x15a0('0x76'),'entityimage_timestamp',_0x15a0('0x77'),_0x15a0('0x78'),_0x15a0('0x79'),_0x15a0('0x7a'),'followupby',_0x15a0('0x7b'),'influencescore',_0x15a0('0x7c'),'lastonholdtime','masteridname','modifiedbyexternalpartyname',_0x15a0('0x7d'),_0x15a0('0x7e'),'modifiedbyyominame',_0x15a0('0x7f'),_0x15a0('0x80'),_0x15a0('0x81'),_0x15a0('0x82'),_0x15a0('0x83'),_0x15a0('0x84'),_0x15a0('0x85'),_0x15a0('0x86'),_0x15a0('0x87'),'owneridtype',_0x15a0('0x88'),_0x15a0('0x89'),_0x15a0('0x8a'),'primarycontactidyominame',_0x15a0('0x8b'),_0x15a0('0x8c'),_0x15a0('0x8d'),_0x15a0('0x8e'),_0x15a0('0x8f'),_0x15a0('0x90'),_0x15a0('0x91'),_0x15a0('0x92'),_0x15a0('0x93'),_0x15a0('0x94'),'slaname',_0x15a0('0x95'),_0x15a0('0x96'),_0x15a0('0x97'),_0x15a0('0x98'),_0x15a0('0x99'),'timezoneruleversionnumber','transactioncurrencyidname',_0x15a0('0x9a'),'utcconversiontimezonecode',_0x15a0('0x9b')];var _0x1d2395=_0x3960a5[_0x15a0('0x9c')](_0x8829a0);return db[_0x15a0('0x2b')][_0x15a0('0x4d')]({'where':{'id':_0x5d27ef['params']['id']},'attributes':['id',_0x15a0('0x9d'),'password',_0x15a0('0x9e'),_0x15a0('0x9f'),_0x15a0('0xa0'),'clientSecret']})['then'](handleEntityNotFound(_0x4a40d5,null))[_0x15a0('0x25')](function(_0xfdf330){if(_0xfdf330){_0x5d6893=_0xfdf330[_0x15a0('0x9e')];var _0x429c56=_0x5d6893[_0x15a0('0xa1')](-0x1);if(_0x429c56==='/'){_0x5d6893=_0x5d6893[_0x15a0('0xa2')](0x0,_0x5d6893[_0x15a0('0xa3')](_0x429c56));}_0x1a6b0d=util[_0x15a0('0xa4')](_0x15a0('0xa5'),_0x5d6893);var _0x1dc1f4={'method':_0x15a0('0xa6'),'uri':_0x15a0('0xa7')+_0xfdf330[_0x15a0('0x9f')]+_0x15a0('0xa8'),'form':{'client_id':_0xfdf330['clientId'],'resource':_0x5d6893,'username':_0xfdf330[_0x15a0('0x9d')],'password':_0xfdf330[_0x15a0('0xa9')],'grant_type':_0x15a0('0xa9'),'client_secret':_0xfdf330[_0x15a0('0xaa')]},'json':!![]};return rp(_0x1dc1f4);}})[_0x15a0('0x25')](function(_0x54ff16){_0x3004a5=_0x54ff16[_0x15a0('0xab')];var _0x4ad5a6={'method':_0x15a0('0xac'),'uri':encodeURI(_0x1a6b0d+_0x15a0('0xad')+_0x20242d+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x3004a5,'If-None-Match':null,'OData-Version':_0x15a0('0xae')},'json':!![]};return rp(_0x4ad5a6);})['then'](function(_0x1c16eb){var _0x5dccbb=_0x1c16eb['value'][0x0];var _0x284107=_0x5dccbb[_0x15a0('0xaf')];var _0x5073db={'method':_0x15a0('0xac'),'uri':_0x1a6b0d+_0x15a0('0xb0')+_0x284107+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x15a0('0xb1')+_0x3004a5,'If-None-Match':null,'OData-Version':_0x15a0('0xae')},'json':!![]};return rp(_0x5073db);})['then'](function(_0x176106){_0x5e7826=_0x176106;_0xcf0f0d=_0x5e7826[_0x15a0('0xb2')];_0xcf0f0d=_[_0x15a0('0xb3')](_0xcf0f0d,function(_0x1cdc35){return!_0x1d2395['includes'](_0x1cdc35[_0x15a0('0xb4')]);});var _0x48ac56=[];var _0x25a1bf=[];_0xcf0f0d[_0x15a0('0xb5')](function(_0x574a60){if(_0x574a60[_0x15a0('0xb6')]){var _0x3785b2=_0x574a60[_0x15a0('0xb6')][_0x15a0('0xa2')](_0x574a60['@odata.type']['lastIndexOf']('.')+0x1);if(_0x3785b2==='PicklistAttributeMetadata'){_0x48ac56[_0x15a0('0xb7')](getSelectList(_0x1a6b0d,_0x183a89,_0x25a1bf,_0x5e7826['MetadataId'],_0x574a60[_0x15a0('0xaf')],_0x3004a5));}}});return Promise['all'](_0x48ac56);})['then'](function(_0xa6c47a){_0x15d510=_0xa6c47a[0x0];var _0x4e4e10=[];var _0x13104e=[];_0xcf0f0d[_0x15a0('0xb5')](function(_0x50583a){if(!_[_0x15a0('0xb8')](_0x50583a['@odata.type'])){var _0x550d7b=_0x50583a[_0x15a0('0xb6')][_0x15a0('0xa2')](_0x50583a[_0x15a0('0xb6')][_0x15a0('0xa3')]('.')+0x1);if(_0x550d7b===_0x15a0('0xb9')){_0x4e4e10['push'](getBooleanList(_0x1a6b0d,_0x183a89,_0x13104e,_0x5e7826[_0x15a0('0xaf')],_0x50583a[_0x15a0('0xaf')],_0x3004a5));}}});return Promise[_0x15a0('0xba')](_0x4e4e10);})['then'](function(_0x2e5d92){_0x51a6f7=_0x2e5d92[0x0];var _0x5524c3=[];var _0x34bc5b=[];_0xcf0f0d[_0x15a0('0xb5')](function(_0x5e683a){if(_0x5e683a[_0x15a0('0xb6')]){var _0x160cfd=_0x5e683a[_0x15a0('0xb6')][_0x15a0('0xa2')](_0x5e683a[_0x15a0('0xb6')][_0x15a0('0xa3')]('.')+0x1);if(_0x160cfd===_0x15a0('0xbb')||_0x160cfd===_0x15a0('0xbc')||_0x160cfd===_0x15a0('0xbd')||_0x160cfd===_0x15a0('0xbe')||_0x160cfd==='MemoAttributeMetadata'||_0x160cfd===_0x15a0('0xbf')||_0x160cfd===_0x15a0('0xc0')||_0x160cfd===_0x15a0('0xc1')||_0x160cfd==='StateAttributeMetadata'||_0x160cfd===_0x15a0('0xc2')){_0x5524c3[_0x15a0('0xb7')](getInputList(_0x1a6b0d,_0x183a89,_0x160cfd,_0x34bc5b,_0x5e7826['MetadataId'],_0x5e683a[_0x15a0('0xaf')],_0x3004a5));}}});return Promise[_0x15a0('0xba')](_0x5524c3);})[_0x15a0('0x25')](function(_0x2c0965){_0x409ee3=_0x2c0965[0x0];var _0x2b3a1e=_0x15d510[_0x15a0('0x9c')](_0x51a6f7)['concat'](_0x409ee3);var _0x19e34c={'count':_0x2b3a1e[_0x15a0('0x36')],'rows':_0x2b3a1e};return _0x19e34c;})[_0x15a0('0x25')](respondWithResult(_0x4a40d5,null))['catch'](function(_0x399f97){var _0x3e3510=_0x5d27ef['query']['test']?0x1f4:_0x399f97['statusCode']||0x1f4;logger[_0x15a0('0x27')](_0x399f97[_0x15a0('0xc3')]);delete _0x399f97[_0x15a0('0x28')];if(_0x3e3510===0x191){_0x3e3510=0x190;}_0x4a40d5[_0x15a0('0x1a')](_0x3e3510)['send'](_0x5d27ef[_0x15a0('0x31')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x399f97[_0x15a0('0xc4')]}:_0x399f97);});};function getSelectList(_0x58a55f,_0x586fb7,_0x3dcee1,_0x508ce7,_0x2bcd3a,_0x4053bb){var _0x663990={'method':'GET','uri':_0x58a55f+'EntityDefinitions('+_0x508ce7+_0x15a0('0xc5')+_0x2bcd3a+_0x15a0('0xc6')+_0x15a0('0xc7'),'headers':{'Authorization':_0x15a0('0xb1')+_0x4053bb,'If-None-Match':null,'OData-Version':_0x15a0('0xae')},'json':!![]};return rp(_0x663990)['then'](function(_0x563897){var _0x3fa672=[];var _0x7c0d13=_0x563897[_0x15a0('0xc8')][_0x15a0('0xc9')];_0x7c0d13[_0x15a0('0xb5')](function(_0x81c523){_0x3fa672['push']({'name':_0x81c523[_0x15a0('0xca')][_0x15a0('0xcb')]['Label'],'value':String(_0x81c523[_0x15a0('0xcc')])});});var _0x362504={'id':_0x586fb7+'_'+_0x563897['LogicalName'],'name':_0x563897[_0x15a0('0xcd')]['UserLocalizedLabel'][_0x15a0('0xca')],'custom':![],'options':_0x3fa672};_0x3dcee1[_0x15a0('0xb7')](_0x362504);return _0x3dcee1;});}function getBooleanList(_0x2783e0,_0x46df37,_0x38e6fd,_0x15d8d0,_0x4a8c19,_0x47c4dd){var _0x45e4fb={'method':_0x15a0('0xac'),'uri':_0x2783e0+_0x15a0('0xb0')+_0x15d8d0+')/Attributes('+_0x4a8c19+_0x15a0('0xce'),'headers':{'Authorization':_0x15a0('0xb1')+_0x47c4dd,'If-None-Match':null,'OData-Version':_0x15a0('0xae')},'json':!![]};return rp(_0x45e4fb)[_0x15a0('0x25')](function(_0x3aa4a3){var _0x4b7e1c=[];_0x4b7e1c[_0x15a0('0xb7')]({'name':_0x3aa4a3[_0x15a0('0xc8')][_0x15a0('0xcf')][_0x15a0('0xca')][_0x15a0('0xcb')]['Label'],'value':_0x15a0('0xd0')},{'name':_0x3aa4a3['OptionSet'][_0x15a0('0xd1')][_0x15a0('0xca')][_0x15a0('0xcb')][_0x15a0('0xca')],'value':'false'});var _0x184966={'id':_0x46df37+'_'+_0x3aa4a3[_0x15a0('0xb4')],'name':_0x3aa4a3[_0x15a0('0xcd')][_0x15a0('0xcb')]['Label'],'custom':![],'options':_0x4b7e1c};_0x38e6fd[_0x15a0('0xb7')](_0x184966);return _0x38e6fd;});}function getInputList(_0x3894d5,_0x4d52fa,_0x5c9a08,_0x3af036,_0x37c755,_0x570d45,_0x81564d){var _0x506242={'method':_0x15a0('0xac'),'uri':_0x3894d5+_0x15a0('0xb0')+_0x37c755+_0x15a0('0xc5')+_0x570d45+')/Microsoft.Dynamics.CRM.'+_0x5c9a08+_0x15a0('0xd2'),'headers':{'Authorization':_0x15a0('0xb1')+_0x81564d,'If-None-Match':null,'OData-Version':_0x15a0('0xae')},'json':!![]};return rp(_0x506242)[_0x15a0('0x25')](function(_0x2f41fc){var _0x2ce50f={'id':_0x4d52fa+'_'+_0x2f41fc[_0x15a0('0xb4')],'name':_0x2f41fc[_0x15a0('0xcd')][_0x15a0('0xcb')]?_0x2f41fc[_0x15a0('0xcd')][_0x15a0('0xcb')][_0x15a0('0xca')]:_0x2f41fc['LogicalName'],'custom':![],'options':[]};_0x3af036[_0x15a0('0xb7')](_0x2ce50f);return _0x3af036;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 7099ae9..be4e77f 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 _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0xba412b,_0x1806d5){var _0x1f6661=function(_0x3ab0c0){while(--_0x3ab0c0){_0xba412b['push'](_0xba412b['shift']());}};_0x1f6661(++_0x1806d5);}(_0x757a,0xde));var _0xa757=function(_0x46348d,_0xdbe4be){_0x46348d=_0x46348d-0x0;var _0x5b507e=_0x757a[_0x46348d];return _0x5b507e;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'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(_0x29c482,_0x4b3e91){var _0x5bba5c=function(_0x326ac6){while(--_0x326ac6){_0x29c482['push'](_0x29c482['shift']());}};_0x5bba5c(++_0x4b3e91);}(_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 68b2310..4a57bf8 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 _0xf97d=['limit','map','include','model','catch','ShowDynamics365Account','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','debug','request\x20sent','stringify','Dynamics365Account,\x20%s,\x20%s','error','message','info','result','GetDynamics365Account','Dynamics365Account','options','where','attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf97d,0x87));var _0xdf97=function(_0x3793a4,_0x18871a){_0x3793a4=_0x3793a4-0x0;var _0x2ab94f=_0xf97d[_0x3793a4];return _0x2ab94f;};'use strict';var _=require('lodash');var util=require(_0xdf97('0x0'));var moment=require(_0xdf97('0x1'));var BPromise=require(_0xdf97('0x2'));var rs=require(_0xdf97('0x3'));var fs=require('fs');var Redis=require(_0xdf97('0x4'));var db=require(_0xdf97('0x5'))['db'];var utils=require(_0xdf97('0x6'));var logger=require(_0xdf97('0x7'))(_0xdf97('0x8'));var config=require(_0xdf97('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x792d88,_0xeb0dec,_0x7ff8c6){return new BPromise(function(_0x2c6a32,_0x1c3c58){return client[_0xdf97('0xa')](_0x792d88,_0x7ff8c6)[_0xdf97('0xb')](function(_0x3cc2cf){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0xeb0dec,'request\x20sent');logger[_0xdf97('0xc')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0xeb0dec,_0xdf97('0xd'),JSON[_0xdf97('0xe')](_0x3cc2cf));if(_0x3cc2cf['error']){if(_0x3cc2cf['error']['code']===0x1f4){logger['error'](_0xdf97('0xf'),_0xeb0dec,_0x3cc2cf[_0xdf97('0x10')][_0xdf97('0x11')]);return _0x1c3c58(_0x3cc2cf[_0xdf97('0x10')][_0xdf97('0x11')]);}logger[_0xdf97('0x10')](_0xdf97('0xf'),_0xeb0dec,_0x3cc2cf[_0xdf97('0x10')][_0xdf97('0x11')]);return _0x2c6a32(_0x3cc2cf[_0xdf97('0x10')][_0xdf97('0x11')]);}else{logger[_0xdf97('0x12')](_0xdf97('0xf'),_0xeb0dec,_0xdf97('0xd'));_0x2c6a32(_0x3cc2cf[_0xdf97('0x13')]['message']);}})['catch'](function(_0x33050f){logger['error'](_0xdf97('0xf'),_0xeb0dec,_0x33050f);_0x1c3c58(_0x33050f);});});}exports[_0xdf97('0x14')]=function(_0x5c5ca2){var _0x9d036=this;return new Promise(function(_0x22a8de,_0x25edae){return db[_0xdf97('0x15')]['findAll']({'raw':_0x5c5ca2[_0xdf97('0x16')]?_0x5c5ca2[_0xdf97('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5c5ca2[_0xdf97('0x16')]?_0x5c5ca2[_0xdf97('0x16')][_0xdf97('0x17')]||null:null,'attributes':_0x5c5ca2[_0xdf97('0x16')]?_0x5c5ca2[_0xdf97('0x16')][_0xdf97('0x18')]||null:null,'limit':_0x5c5ca2['options']?_0x5c5ca2[_0xdf97('0x16')][_0xdf97('0x19')]||null:null,'include':_0x5c5ca2[_0xdf97('0x16')]?_0x5c5ca2['options']['include']?_[_0xdf97('0x1a')](_0x5c5ca2[_0xdf97('0x16')][_0xdf97('0x1b')],function(_0x3f9769){return{'model':db[_0x3f9769[_0xdf97('0x1c')]],'as':_0x3f9769['as'],'attributes':_0x3f9769['attributes'],'include':_0x3f9769[_0xdf97('0x1b')]?_[_0xdf97('0x1a')](_0x3f9769[_0xdf97('0x1b')],function(_0x2f8f8e){return{'model':db[_0x2f8f8e[_0xdf97('0x1c')]],'as':_0x2f8f8e['as'],'attributes':_0x2f8f8e[_0xdf97('0x18')],'include':_0x2f8f8e['include']?_['map'](_0x2f8f8e[_0xdf97('0x1b')],function(_0x4cdab1){return{'model':db[_0x4cdab1[_0xdf97('0x1c')]],'as':_0x4cdab1['as'],'attributes':_0x4cdab1[_0xdf97('0x18')]};}):[]};}):[]};}):[]:[]})[_0xdf97('0xb')](function(_0xccd319){logger[_0xdf97('0x12')](_0xdf97('0x14'),_0x5c5ca2);logger[_0xdf97('0xc')](_0xdf97('0x14'),_0x5c5ca2,JSON['stringify'](_0xccd319));_0x22a8de(_0xccd319);})[_0xdf97('0x1d')](function(_0x2b9a0b){logger[_0xdf97('0x10')](_0xdf97('0x14'),_0x2b9a0b[_0xdf97('0x11')],_0x5c5ca2);_0x25edae(_0x9d036[_0xdf97('0x10')](0x1f4,_0x2b9a0b['message']));});});};exports[_0xdf97('0x1e')]=function(_0x23067d){var _0x240ab5=this;return new Promise(function(_0x47d818,_0x13f44a){return db[_0xdf97('0x15')][_0xdf97('0x1f')]({'raw':_0x23067d[_0xdf97('0x16')]?_0x23067d[_0xdf97('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x23067d[_0xdf97('0x16')]?_0x23067d[_0xdf97('0x16')]['where']||null:null,'attributes':_0x23067d[_0xdf97('0x16')]?_0x23067d[_0xdf97('0x16')][_0xdf97('0x18')]||null:null,'include':_0x23067d[_0xdf97('0x16')]?_0x23067d[_0xdf97('0x16')][_0xdf97('0x1b')]?_[_0xdf97('0x1a')](_0x23067d[_0xdf97('0x16')]['include'],function(_0x43a517){return{'model':db[_0x43a517[_0xdf97('0x1c')]],'as':_0x43a517['as'],'attributes':_0x43a517['attributes'],'include':_0x43a517['include']?_['map'](_0x43a517[_0xdf97('0x1b')],function(_0x502f48){return{'model':db[_0x502f48[_0xdf97('0x1c')]],'as':_0x502f48['as'],'attributes':_0x502f48['attributes'],'include':_0x502f48[_0xdf97('0x1b')]?_[_0xdf97('0x1a')](_0x502f48['include'],function(_0x2ad765){return{'model':db[_0x2ad765[_0xdf97('0x1c')]],'as':_0x2ad765['as'],'attributes':_0x2ad765[_0xdf97('0x18')]};}):[]};}):[]};}):[]:[]})[_0xdf97('0xb')](function(_0x3d1dbd){logger[_0xdf97('0x12')](_0xdf97('0x1e'),_0x23067d);logger['debug']('ShowDynamics365Account',_0x23067d,JSON['stringify'](_0x3d1dbd));_0x47d818(_0x3d1dbd);})['catch'](function(_0x2863d3){logger[_0xdf97('0x10')](_0xdf97('0x1e'),_0x2863d3[_0xdf97('0x11')],_0x23067d);_0x13f44a(_0x240ab5[_0xdf97('0x10')](0x1f4,_0x2863d3[_0xdf97('0x11')]));});});}; \ No newline at end of file +var _0xdbc9=['options','raw','where','attributes','limit','include','model','map','info','GetDynamics365Account','ShowDynamics365Account','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Dynamics365Account','findAll'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0xdbc9,0x81));var _0x9dbc=function(_0x2cde1f,_0x9d479){_0x2cde1f=_0x2cde1f-0x0;var _0x2bf5de=_0xdbc9[_0x2cde1f];return _0x2bf5de;};'use strict';var _=require(_0x9dbc('0x0'));var util=require(_0x9dbc('0x1'));var moment=require(_0x9dbc('0x2'));var BPromise=require(_0x9dbc('0x3'));var rs=require(_0x9dbc('0x4'));var fs=require('fs');var Redis=require(_0x9dbc('0x5'));var db=require(_0x9dbc('0x6'))['db'];var utils=require(_0x9dbc('0x7'));var logger=require(_0x9dbc('0x8'))(_0x9dbc('0x9'));var config=require(_0x9dbc('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x9dbc('0xb')][_0x9dbc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3d7041,_0x49a318,_0x3f9692){return new BPromise(function(_0x561d36,_0x43dfe0){return client[_0x9dbc('0xd')](_0x3d7041,_0x3f9692)[_0x9dbc('0xe')](function(_0x5a80ba){logger['info'](_0x9dbc('0xf'),_0x49a318,_0x9dbc('0x10'));logger[_0x9dbc('0x11')](_0x9dbc('0x12'),_0x49a318,_0x9dbc('0x10'),JSON[_0x9dbc('0x13')](_0x5a80ba));if(_0x5a80ba['error']){if(_0x5a80ba[_0x9dbc('0x14')][_0x9dbc('0x15')]===0x1f4){logger[_0x9dbc('0x14')]('Dynamics365Account,\x20%s,\x20%s',_0x49a318,_0x5a80ba[_0x9dbc('0x14')][_0x9dbc('0x16')]);return _0x43dfe0(_0x5a80ba['error'][_0x9dbc('0x16')]);}logger['error'](_0x9dbc('0xf'),_0x49a318,_0x5a80ba[_0x9dbc('0x14')][_0x9dbc('0x16')]);return _0x561d36(_0x5a80ba['error'][_0x9dbc('0x16')]);}else{logger['info'](_0x9dbc('0xf'),_0x49a318,_0x9dbc('0x10'));_0x561d36(_0x5a80ba[_0x9dbc('0x17')][_0x9dbc('0x16')]);}})[_0x9dbc('0x18')](function(_0x451bd6){logger[_0x9dbc('0x14')]('Dynamics365Account,\x20%s,\x20%s',_0x49a318,_0x451bd6);_0x43dfe0(_0x451bd6);});});}exports['GetDynamics365Account']=function(_0x2ac27d){var _0x11a8e8=this;return new Promise(function(_0x532825,_0x31a8c0){return db[_0x9dbc('0x19')][_0x9dbc('0x1a')]({'raw':_0x2ac27d[_0x9dbc('0x1b')]?_0x2ac27d['options'][_0x9dbc('0x1c')]===undefined?!![]:![]:!![],'where':_0x2ac27d[_0x9dbc('0x1b')]?_0x2ac27d['options'][_0x9dbc('0x1d')]||null:null,'attributes':_0x2ac27d[_0x9dbc('0x1b')]?_0x2ac27d['options'][_0x9dbc('0x1e')]||null:null,'limit':_0x2ac27d[_0x9dbc('0x1b')]?_0x2ac27d['options'][_0x9dbc('0x1f')]||null:null,'include':_0x2ac27d[_0x9dbc('0x1b')]?_0x2ac27d['options']['include']?_['map'](_0x2ac27d['options'][_0x9dbc('0x20')],function(_0x51d732){return{'model':db[_0x51d732[_0x9dbc('0x21')]],'as':_0x51d732['as'],'attributes':_0x51d732['attributes'],'include':_0x51d732[_0x9dbc('0x20')]?_[_0x9dbc('0x22')](_0x51d732['include'],function(_0x2baf36){return{'model':db[_0x2baf36[_0x9dbc('0x21')]],'as':_0x2baf36['as'],'attributes':_0x2baf36[_0x9dbc('0x1e')],'include':_0x2baf36[_0x9dbc('0x20')]?_[_0x9dbc('0x22')](_0x2baf36[_0x9dbc('0x20')],function(_0x1617f3){return{'model':db[_0x1617f3['model']],'as':_0x1617f3['as'],'attributes':_0x1617f3['attributes']};}):[]};}):[]};}):[]:[]})[_0x9dbc('0xe')](function(_0x562c91){logger[_0x9dbc('0x23')](_0x9dbc('0x24'),_0x2ac27d);logger[_0x9dbc('0x11')](_0x9dbc('0x24'),_0x2ac27d,JSON[_0x9dbc('0x13')](_0x562c91));_0x532825(_0x562c91);})[_0x9dbc('0x18')](function(_0x54ad96){logger[_0x9dbc('0x14')](_0x9dbc('0x24'),_0x54ad96[_0x9dbc('0x16')],_0x2ac27d);_0x31a8c0(_0x11a8e8[_0x9dbc('0x14')](0x1f4,_0x54ad96[_0x9dbc('0x16')]));});});};exports[_0x9dbc('0x25')]=function(_0x5b3700){var _0x1e27e7=this;return new Promise(function(_0x45b2ac,_0x2394c7){return db['Dynamics365Account'][_0x9dbc('0x26')]({'raw':_0x5b3700[_0x9dbc('0x1b')]?_0x5b3700[_0x9dbc('0x1b')][_0x9dbc('0x1c')]===undefined?!![]:![]:!![],'where':_0x5b3700[_0x9dbc('0x1b')]?_0x5b3700['options'][_0x9dbc('0x1d')]||null:null,'attributes':_0x5b3700['options']?_0x5b3700[_0x9dbc('0x1b')]['attributes']||null:null,'include':_0x5b3700[_0x9dbc('0x1b')]?_0x5b3700[_0x9dbc('0x1b')][_0x9dbc('0x20')]?_[_0x9dbc('0x22')](_0x5b3700[_0x9dbc('0x1b')][_0x9dbc('0x20')],function(_0x4191b0){return{'model':db[_0x4191b0[_0x9dbc('0x21')]],'as':_0x4191b0['as'],'attributes':_0x4191b0[_0x9dbc('0x1e')],'include':_0x4191b0[_0x9dbc('0x20')]?_[_0x9dbc('0x22')](_0x4191b0[_0x9dbc('0x20')],function(_0x531b36){return{'model':db[_0x531b36[_0x9dbc('0x21')]],'as':_0x531b36['as'],'attributes':_0x531b36[_0x9dbc('0x1e')],'include':_0x531b36[_0x9dbc('0x20')]?_[_0x9dbc('0x22')](_0x531b36[_0x9dbc('0x20')],function(_0x5a7095){return{'model':db[_0x5a7095['model']],'as':_0x5a7095['as'],'attributes':_0x5a7095[_0x9dbc('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9dbc('0xe')](function(_0x21a88f){logger['info'](_0x9dbc('0x25'),_0x5b3700);logger['debug'](_0x9dbc('0x25'),_0x5b3700,JSON[_0x9dbc('0x13')](_0x21a88f));_0x45b2ac(_0x21a88f);})[_0x9dbc('0x18')](function(_0x257ae9){logger[_0x9dbc('0x14')](_0x9dbc('0x25'),_0x257ae9[_0x9dbc('0x16')],_0x5b3700);_0x2394c7(_0x1e27e7['error'](0x1f4,_0x257ae9[_0x9dbc('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 7b2784e..2c24f50 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 _0xc013=['delete','destroy','exports','multer','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','/:id','update'];(function(_0x5f0889,_0x3b3212){var _0x441f8d=function(_0x255654){while(--_0x255654){_0x5f0889['push'](_0x5f0889['shift']());}};_0x441f8d(++_0x3b3212);}(_0xc013,0x1bc));var _0x3c01=function(_0x7cb10c,_0x2fcc3a){_0x7cb10c=_0x7cb10c-0x0;var _0x11df59=_0xc013[_0x7cb10c];return _0x11df59;};'use strict';var multer=require(_0x3c01('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x3c01('0x1'));var auth=require(_0x3c01('0x2'));var interaction=require(_0x3c01('0x3'));var config=require(_0x3c01('0x4'));var controller=require('./intDynamics365Configuration.controller');router[_0x3c01('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3c01('0x5')]('/:id',auth[_0x3c01('0x6')](),controller[_0x3c01('0x7')]);router['get'](_0x3c01('0x8'),auth[_0x3c01('0x6')](),controller[_0x3c01('0x9')]);router[_0x3c01('0x5')](_0x3c01('0xa'),auth[_0x3c01('0x6')](),controller[_0x3c01('0xb')]);router['get']('/:id/descriptions',auth[_0x3c01('0x6')](),controller[_0x3c01('0xc')]);router[_0x3c01('0xd')]('/',auth[_0x3c01('0x6')](),controller[_0x3c01('0xe')]);router[_0x3c01('0xf')](_0x3c01('0x10'),auth[_0x3c01('0x6')](),controller[_0x3c01('0x11')]);router[_0x3c01('0x12')](_0x3c01('0x10'),auth[_0x3c01('0x6')](),controller[_0x3c01('0x13')]);module[_0x3c01('0x14')]=router; \ No newline at end of file +var _0x2160=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','show','getFields','getSubjects','getDescriptions','post','/:id','update','delete','destroy','util','path'];(function(_0x54b436,_0x67930b){var _0x5eb7b8=function(_0xf6e9e){while(--_0xf6e9e){_0x54b436['push'](_0x54b436['shift']());}};_0x5eb7b8(++_0x67930b);}(_0x2160,0x132));var _0x0216=function(_0x2b3226,_0x29023d){_0x2b3226=_0x2b3226-0x0;var _0x360483=_0x2160[_0x2b3226];return _0x360483;};'use strict';var multer=require('multer');var util=require(_0x0216('0x0'));var path=require(_0x0216('0x1'));var timeout=require(_0x0216('0x2'));var express=require(_0x0216('0x3'));var router=express[_0x0216('0x4')]();var fs_extra=require(_0x0216('0x5'));var auth=require(_0x0216('0x6'));var interaction=require(_0x0216('0x7'));var config=require(_0x0216('0x8'));var controller=require(_0x0216('0x9'));router[_0x0216('0xa')]('/',auth[_0x0216('0xb')](),controller[_0x0216('0xc')]);router[_0x0216('0xa')]('/:id',auth[_0x0216('0xb')](),controller[_0x0216('0xd')]);router[_0x0216('0xa')]('/:id/fields',auth[_0x0216('0xb')](),controller[_0x0216('0xe')]);router[_0x0216('0xa')]('/:id/subjects',auth[_0x0216('0xb')](),controller[_0x0216('0xf')]);router[_0x0216('0xa')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x0216('0x10')]);router[_0x0216('0x11')]('/',auth[_0x0216('0xb')](),controller['create']);router['put'](_0x0216('0x12'),auth[_0x0216('0xb')](),controller[_0x0216('0x13')]);router[_0x0216('0x14')](_0x0216('0x12'),auth[_0x0216('0xb')](),controller[_0x0216('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index d3d906a..e9e7542 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 _0x2727=['sequelize','STRING','ENUM','phonecall','incident'];(function(_0xca0166,_0x12b2ab){var _0x42210f=function(_0x2d4e89){while(--_0x2d4e89){_0xca0166['push'](_0xca0166['shift']());}};_0x42210f(++_0x12b2ab);}(_0x2727,0x1e5));var _0x7272=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x2727[_0x68ee8b];return _0x5148f7;};'use strict';var Sequelize=require(_0x7272('0x0'));module['exports']={'name':{'type':Sequelize[_0x7272('0x1')]},'description':{'type':Sequelize[_0x7272('0x1')]},'ticketType':{'type':Sequelize[_0x7272('0x2')]('incident',_0x7272('0x3')),'defaultValue':_0x7272('0x4')}}; \ No newline at end of file +var _0xb61d=['sequelize','exports','STRING','ENUM','incident','phonecall'];(function(_0x3731c9,_0x3eda17){var _0x18aac2=function(_0x55aaf3){while(--_0x55aaf3){_0x3731c9['push'](_0x3731c9['shift']());}};_0x18aac2(++_0x3eda17);}(_0xb61d,0x14a));var _0xdb61=function(_0xf0193a,_0x32db52){_0xf0193a=_0xf0193a-0x0;var _0x5f1563=_0xb61d[_0xf0193a];return _0x5f1563;};'use strict';var Sequelize=require(_0xdb61('0x0'));module[_0xdb61('0x1')]={'name':{'type':Sequelize[_0xdb61('0x2')]},'description':{'type':Sequelize[_0xdb61('0x2')]},'ticketType':{'type':Sequelize[_0xdb61('0x3')](_0xdb61('0x4'),_0xdb61('0x5')),'defaultValue':_0xdb61('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index de00be2..7d18617 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 _0xef15=['model','query','keys','intersection','attributes','fields','order','sort','filters','pick','merge','where','VIRTUAL','filter','options','Dynamics365Configuration','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getFields','Dynamics365Field','hasOwnProperty','nolimit','getSubjects','findOne','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xef15,0x1d0));var _0x5ef1=function(_0x4d770d,_0x5af4ce){_0x4d770d=_0x4d770d-0x0;var _0x11dc7a=_0xef15[_0x4d770d];return _0x11dc7a;};'use strict';var emlformat=require(_0x5ef1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5ef1('0x1'));var jsonpatch=require(_0x5ef1('0x2'));var rp=require(_0x5ef1('0x3'));var moment=require(_0x5ef1('0x4'));var BPromise=require(_0x5ef1('0x5'));var Mustache=require(_0x5ef1('0x6'));var util=require(_0x5ef1('0x7'));var path=require(_0x5ef1('0x8'));var sox=require(_0x5ef1('0x9'));var csv=require('to-csv');var ejs=require(_0x5ef1('0xa'));var fs=require('fs');var fs_extra=require(_0x5ef1('0xb'));var _=require(_0x5ef1('0xc'));var squel=require(_0x5ef1('0xd'));var crypto=require(_0x5ef1('0xe'));var jsforce=require(_0x5ef1('0xf'));var deskjs=require(_0x5ef1('0x10'));var toCsv=require('to-csv');var querystring=require(_0x5ef1('0x11'));var Papa=require('papaparse');var Redis=require(_0x5ef1('0x12'));var authService=require(_0x5ef1('0x13'));var qs=require(_0x5ef1('0x14'));var as=require(_0x5ef1('0x15'));var hardwareService=require(_0x5ef1('0x16'));var logger=require(_0x5ef1('0x17'))(_0x5ef1('0x18'));var utils=require('../../config/utils');var config=require(_0x5ef1('0x19'));var licenseUtil=require(_0x5ef1('0x1a'));var db=require(_0x5ef1('0x1b'))['db'];function respondWithStatusCode(_0x3888f9,_0x39873b){_0x39873b=_0x39873b||0xcc;return function(_0x257ec9){if(_0x257ec9){return _0x3888f9['sendStatus'](_0x39873b);}return _0x3888f9[_0x5ef1('0x1c')](_0x39873b)['end']();};}function respondWithResult(_0x2969ad,_0x4e570a){_0x4e570a=_0x4e570a||0xc8;return function(_0x19010e){if(_0x19010e){return _0x2969ad['status'](_0x4e570a)[_0x5ef1('0x1d')](_0x19010e);}};}function respondWithFilteredResult(_0x370885,_0x1f0d53){return function(_0x2a76d1){if(_0x2a76d1){var _0x4aca26=typeof _0x1f0d53[_0x5ef1('0x1e')]===_0x5ef1('0x1f')&&typeof _0x1f0d53[_0x5ef1('0x20')]===_0x5ef1('0x1f');var _0x39a04e=_0x2a76d1[_0x5ef1('0x21')];var _0x123a35=_0x4aca26?0x0:_0x1f0d53['offset'];var _0x3299a9=_0x4aca26?_0x2a76d1[_0x5ef1('0x21')]:_0x1f0d53['offset']+_0x1f0d53[_0x5ef1('0x20')];var _0x2c9122;if(_0x3299a9>=_0x39a04e){_0x3299a9=_0x39a04e;_0x2c9122=0xc8;}else{_0x2c9122=0xce;}_0x370885[_0x5ef1('0x1c')](_0x2c9122);return _0x370885[_0x5ef1('0x22')](_0x5ef1('0x23'),_0x123a35+'-'+_0x3299a9+'/'+_0x39a04e)[_0x5ef1('0x1d')](_0x2a76d1);}return null;};}function patchUpdates(_0x425d21){return function(_0x122e13){try{jsonpatch['apply'](_0x122e13,_0x425d21,!![]);}catch(_0x5eda4e){return BPromise[_0x5ef1('0x24')](_0x5eda4e);}return _0x122e13[_0x5ef1('0x25')]();};}function saveUpdates(_0x3af411,_0x2da5b0){return function(_0x440825){if(_0x440825){return _0x440825[_0x5ef1('0x26')](_0x3af411)[_0x5ef1('0x27')](function(_0x1ef6a2){return _0x1ef6a2;});}return null;};}function removeEntity(_0x4df1fc,_0x2ef64b){return function(_0x5145d3){if(_0x5145d3){return _0x5145d3[_0x5ef1('0x28')]()[_0x5ef1('0x27')](function(){_0x4df1fc[_0x5ef1('0x1c')](0xcc)[_0x5ef1('0x29')]();});}};}function handleEntityNotFound(_0x443417,_0x3b4082){return function(_0x2ef315){if(!_0x2ef315){_0x443417['sendStatus'](0x194);}return _0x2ef315;};}function handleError(_0x53cd87,_0x151a60){_0x151a60=_0x151a60||0x1f4;return function(_0x2b5c69){logger[_0x5ef1('0x2a')](_0x2b5c69[_0x5ef1('0x2b')]);if(_0x2b5c69[_0x5ef1('0x2c')]){delete _0x2b5c69[_0x5ef1('0x2c')];}_0x53cd87[_0x5ef1('0x1c')](_0x151a60)[_0x5ef1('0x2d')](_0x2b5c69);};}exports[_0x5ef1('0x2e')]=function(_0x310c6c,_0x85a703){var _0x30564e={},_0x456eb5={},_0x1b304b={'count':0x0,'rows':[]};var _0x2f0c2b=_[_0x5ef1('0x2f')](db['Dynamics365Configuration'][_0x5ef1('0x30')],function(_0x5ebddf){return{'name':_0x5ebddf[_0x5ef1('0x31')],'type':_0x5ebddf[_0x5ef1('0x32')][_0x5ef1('0x33')]};});_0x456eb5[_0x5ef1('0x34')]=_['map'](_0x2f0c2b,_0x5ef1('0x2c'));_0x456eb5[_0x5ef1('0x35')]=_[_0x5ef1('0x36')](_0x310c6c[_0x5ef1('0x35')]);_0x456eb5['filters']=_[_0x5ef1('0x37')](_0x456eb5[_0x5ef1('0x34')],_0x456eb5[_0x5ef1('0x35')]);_0x30564e[_0x5ef1('0x38')]=_[_0x5ef1('0x37')](_0x456eb5[_0x5ef1('0x34')],qs[_0x5ef1('0x39')](_0x310c6c[_0x5ef1('0x35')]['fields']));_0x30564e[_0x5ef1('0x38')]=_0x30564e[_0x5ef1('0x38')]['length']?_0x30564e['attributes']:_0x456eb5[_0x5ef1('0x34')];if(!_0x310c6c[_0x5ef1('0x35')]['hasOwnProperty']('nolimit')){_0x30564e[_0x5ef1('0x20')]=qs['limit'](_0x310c6c[_0x5ef1('0x35')][_0x5ef1('0x20')]);_0x30564e[_0x5ef1('0x1e')]=qs[_0x5ef1('0x1e')](_0x310c6c[_0x5ef1('0x35')][_0x5ef1('0x1e')]);}_0x30564e[_0x5ef1('0x3a')]=qs[_0x5ef1('0x3b')](_0x310c6c['query'][_0x5ef1('0x3b')]);_0x30564e['where']=qs[_0x5ef1('0x3c')](_[_0x5ef1('0x3d')](_0x310c6c[_0x5ef1('0x35')],_0x456eb5[_0x5ef1('0x3c')]),_0x2f0c2b);if(_0x310c6c[_0x5ef1('0x35')]['filter']){_0x30564e['where']=_[_0x5ef1('0x3e')](_0x30564e[_0x5ef1('0x3f')],{'$or':_['map'](_0x2f0c2b,function(_0x209138){if(_0x209138[_0x5ef1('0x32')]!==_0x5ef1('0x40')){var _0x432ce5={};_0x432ce5[_0x209138['name']]={'$like':'%'+_0x310c6c[_0x5ef1('0x35')][_0x5ef1('0x41')]+'%'};return _0x432ce5;}})});}_0x30564e=_[_0x5ef1('0x3e')]({},_0x30564e,_0x310c6c[_0x5ef1('0x42')]);var _0x385d03={'where':_0x30564e['where']};return db[_0x5ef1('0x43')]['count'](_0x385d03)[_0x5ef1('0x27')](function(_0x3ebab6){_0x1b304b['count']=_0x3ebab6;if(_0x310c6c[_0x5ef1('0x35')][_0x5ef1('0x44')]){_0x30564e[_0x5ef1('0x45')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x5ef1('0x46')](_0x30564e);})[_0x5ef1('0x27')](function(_0x1ec1fc){_0x1b304b[_0x5ef1('0x47')]=_0x1ec1fc;return _0x1b304b;})[_0x5ef1('0x27')](respondWithFilteredResult(_0x85a703,_0x30564e))[_0x5ef1('0x48')](handleError(_0x85a703,null));};exports[_0x5ef1('0x49')]=function(_0x350798,_0x2ed700){var _0x1c5367={'raw':![],'where':{'id':_0x350798[_0x5ef1('0x4a')]['id']}},_0x5ab0bf={};_0x5ab0bf['model']=_['keys'](db[_0x5ef1('0x43')][_0x5ef1('0x30')]);_0x5ab0bf['query']=_[_0x5ef1('0x36')](_0x350798['query']);_0x5ab0bf['filters']=_[_0x5ef1('0x37')](_0x5ab0bf[_0x5ef1('0x34')],_0x5ab0bf[_0x5ef1('0x35')]);_0x1c5367[_0x5ef1('0x38')]=_[_0x5ef1('0x37')](_0x5ab0bf[_0x5ef1('0x34')],qs[_0x5ef1('0x39')](_0x350798[_0x5ef1('0x35')][_0x5ef1('0x39')]));_0x1c5367[_0x5ef1('0x38')]=_0x1c5367[_0x5ef1('0x38')][_0x5ef1('0x4b')]?_0x1c5367[_0x5ef1('0x38')]:_0x5ab0bf[_0x5ef1('0x34')];if(_0x350798[_0x5ef1('0x35')][_0x5ef1('0x44')]){_0x1c5367[_0x5ef1('0x45')]=[{'all':!![]}];}_0x1c5367=_['merge']({},_0x1c5367,_0x350798[_0x5ef1('0x42')]);return db[_0x5ef1('0x43')][_0x5ef1('0x4c')](_0x1c5367)[_0x5ef1('0x27')](handleEntityNotFound(_0x2ed700,null))[_0x5ef1('0x27')](respondWithResult(_0x2ed700,null))[_0x5ef1('0x48')](handleError(_0x2ed700,null));};exports['create']=function(_0x3af1af,_0x5d6c66){return db[_0x5ef1('0x43')][_0x5ef1('0x4d')](_0x3af1af['body'],{})['then'](respondWithResult(_0x5d6c66,0xc9))[_0x5ef1('0x48')](handleError(_0x5d6c66,null));};exports[_0x5ef1('0x26')]=function(_0x2bb191,_0xa594f9){if(_0x2bb191[_0x5ef1('0x4e')]['id']){delete _0x2bb191[_0x5ef1('0x4e')]['id'];}return db[_0x5ef1('0x43')][_0x5ef1('0x4c')]({'where':{'id':_0x2bb191['params']['id']}})[_0x5ef1('0x27')](handleEntityNotFound(_0xa594f9,null))[_0x5ef1('0x27')](saveUpdates(_0x2bb191[_0x5ef1('0x4e')],null))[_0x5ef1('0x27')](respondWithResult(_0xa594f9,null))['catch'](handleError(_0xa594f9,null));};exports[_0x5ef1('0x28')]=function(_0x232fe8,_0x177f09){return db[_0x5ef1('0x43')][_0x5ef1('0x4c')]({'where':{'id':_0x232fe8[_0x5ef1('0x4a')]['id']}})[_0x5ef1('0x27')](handleEntityNotFound(_0x177f09,null))[_0x5ef1('0x27')](removeEntity(_0x177f09,null))[_0x5ef1('0x48')](handleError(_0x177f09,null));};exports[_0x5ef1('0x4f')]=function(_0x2663af,_0x9963ec,_0x5449ab){var _0x5cda01={};var _0x272ce1={};var _0x4a7c88;var _0x2a9b30;return db[_0x5ef1('0x43')]['findOne']({'where':{'id':_0x2663af['params']['id']}})[_0x5ef1('0x27')](handleEntityNotFound(_0x9963ec,null))[_0x5ef1('0x27')](function(_0x150183){if(_0x150183){_0x4a7c88=_0x150183;_0x272ce1[_0x5ef1('0x34')]=_[_0x5ef1('0x36')](db[_0x5ef1('0x50')][_0x5ef1('0x30')]);_0x272ce1[_0x5ef1('0x35')]=_['keys'](_0x2663af[_0x5ef1('0x35')]);_0x272ce1[_0x5ef1('0x3c')]=_[_0x5ef1('0x37')](_0x272ce1[_0x5ef1('0x34')],_0x272ce1[_0x5ef1('0x35')]);_0x5cda01[_0x5ef1('0x38')]=_['intersection'](_0x272ce1[_0x5ef1('0x34')],qs['fields'](_0x2663af[_0x5ef1('0x35')][_0x5ef1('0x39')]));_0x5cda01[_0x5ef1('0x38')]=_0x5cda01[_0x5ef1('0x38')][_0x5ef1('0x4b')]?_0x5cda01[_0x5ef1('0x38')]:_0x272ce1[_0x5ef1('0x34')];_0x5cda01['order']=qs[_0x5ef1('0x3b')](_0x2663af[_0x5ef1('0x35')][_0x5ef1('0x3b')]);_0x5cda01[_0x5ef1('0x3f')]=qs[_0x5ef1('0x3c')](_[_0x5ef1('0x3d')](_0x2663af['query'],_0x272ce1[_0x5ef1('0x3c')]));if(_0x2663af[_0x5ef1('0x35')][_0x5ef1('0x41')]){_0x5cda01['where']=_[_0x5ef1('0x3e')](_0x5cda01[_0x5ef1('0x3f')],{'$or':_[_0x5ef1('0x2f')](_0x5cda01[_0x5ef1('0x38')],function(_0x18c5b8){var _0x18c012={};_0x18c012[_0x18c5b8]={'$like':'%'+_0x2663af[_0x5ef1('0x35')][_0x5ef1('0x41')]+'%'};return _0x18c012;})});}_0x5cda01=_[_0x5ef1('0x3e')]({},_0x5cda01,_0x2663af[_0x5ef1('0x42')]);return _0x4a7c88[_0x5ef1('0x4f')](_0x5cda01);}})[_0x5ef1('0x27')](function(_0x1bbf6c){if(_0x1bbf6c){_0x2a9b30=_0x1bbf6c[_0x5ef1('0x4b')];if(!_0x2663af[_0x5ef1('0x35')][_0x5ef1('0x51')](_0x5ef1('0x52'))){_0x5cda01[_0x5ef1('0x20')]=qs['limit'](_0x2663af[_0x5ef1('0x35')][_0x5ef1('0x20')]);_0x5cda01[_0x5ef1('0x1e')]=qs[_0x5ef1('0x1e')](_0x2663af[_0x5ef1('0x35')][_0x5ef1('0x1e')]);}return _0x4a7c88['getFields'](_0x5cda01);}})[_0x5ef1('0x27')](function(_0x195403){if(_0x195403){return _0x195403?{'count':_0x2a9b30,'rows':_0x195403}:null;}})[_0x5ef1('0x27')](respondWithResult(_0x9963ec,null))[_0x5ef1('0x48')](handleError(_0x9963ec,null));};exports[_0x5ef1('0x53')]=function(_0xd3bddb,_0x5ab0a8,_0x275c63){var _0x2f5842={};var _0x1b3162={};var _0x2889c4;var _0x3bd68b;return db[_0x5ef1('0x43')][_0x5ef1('0x54')]({'where':{'id':_0xd3bddb[_0x5ef1('0x4a')]['id']}})[_0x5ef1('0x27')](handleEntityNotFound(_0x5ab0a8,null))[_0x5ef1('0x27')](function(_0x57802b){if(_0x57802b){_0x2889c4=_0x57802b;_0x1b3162[_0x5ef1('0x34')]=_[_0x5ef1('0x36')](db['Dynamics365Field'][_0x5ef1('0x30')]);_0x1b3162[_0x5ef1('0x35')]=_[_0x5ef1('0x36')](_0xd3bddb['query']);_0x1b3162['filters']=_['intersection'](_0x1b3162['model'],_0x1b3162[_0x5ef1('0x35')]);_0x2f5842[_0x5ef1('0x38')]=_['intersection'](_0x1b3162[_0x5ef1('0x34')],qs[_0x5ef1('0x39')](_0xd3bddb[_0x5ef1('0x35')][_0x5ef1('0x39')]));_0x2f5842[_0x5ef1('0x38')]=_0x2f5842['attributes']['length']?_0x2f5842[_0x5ef1('0x38')]:_0x1b3162[_0x5ef1('0x34')];_0x2f5842[_0x5ef1('0x3a')]=qs[_0x5ef1('0x3b')](_0xd3bddb[_0x5ef1('0x35')][_0x5ef1('0x3b')]);_0x2f5842[_0x5ef1('0x3f')]=qs[_0x5ef1('0x3c')](_[_0x5ef1('0x3d')](_0xd3bddb[_0x5ef1('0x35')],_0x1b3162['filters']));if(_0xd3bddb[_0x5ef1('0x35')][_0x5ef1('0x41')]){_0x2f5842['where']=_['merge'](_0x2f5842[_0x5ef1('0x3f')],{'$or':_['map'](_0x2f5842['attributes'],function(_0x4d2b77){var _0x25686f={};_0x25686f[_0x4d2b77]={'$like':'%'+_0xd3bddb['query'][_0x5ef1('0x41')]+'%'};return _0x25686f;})});}_0x2f5842=_['merge']({},_0x2f5842,_0xd3bddb[_0x5ef1('0x42')]);return _0x2889c4[_0x5ef1('0x53')](_0x2f5842);}})[_0x5ef1('0x27')](function(_0x25433b){if(_0x25433b){_0x3bd68b=_0x25433b['length'];if(!_0xd3bddb[_0x5ef1('0x35')][_0x5ef1('0x51')](_0x5ef1('0x52'))){_0x2f5842[_0x5ef1('0x20')]=qs[_0x5ef1('0x20')](_0xd3bddb['query'][_0x5ef1('0x20')]);_0x2f5842[_0x5ef1('0x1e')]=qs[_0x5ef1('0x1e')](_0xd3bddb[_0x5ef1('0x35')][_0x5ef1('0x1e')]);}return _0x2889c4[_0x5ef1('0x53')](_0x2f5842);}})[_0x5ef1('0x27')](function(_0x2f52df){if(_0x2f52df){return _0x2f52df?{'count':_0x3bd68b,'rows':_0x2f52df}:null;}})[_0x5ef1('0x27')](respondWithResult(_0x5ab0a8,null))[_0x5ef1('0x48')](handleError(_0x5ab0a8,null));};exports[_0x5ef1('0x55')]=function(_0x5ed49e,_0x2dbdc1,_0x5d9ff5){var _0x269bf0={};var _0x4882b5={};var _0x5cc46c;var _0x117c3e;return db[_0x5ef1('0x43')][_0x5ef1('0x54')]({'where':{'id':_0x5ed49e[_0x5ef1('0x4a')]['id']}})[_0x5ef1('0x27')](handleEntityNotFound(_0x2dbdc1,null))['then'](function(_0x196bbe){if(_0x196bbe){_0x5cc46c=_0x196bbe;_0x4882b5['model']=_[_0x5ef1('0x36')](db['Dynamics365Field'][_0x5ef1('0x30')]);_0x4882b5[_0x5ef1('0x35')]=_[_0x5ef1('0x36')](_0x5ed49e[_0x5ef1('0x35')]);_0x4882b5['filters']=_[_0x5ef1('0x37')](_0x4882b5[_0x5ef1('0x34')],_0x4882b5['query']);_0x269bf0[_0x5ef1('0x38')]=_['intersection'](_0x4882b5[_0x5ef1('0x34')],qs[_0x5ef1('0x39')](_0x5ed49e[_0x5ef1('0x35')][_0x5ef1('0x39')]));_0x269bf0[_0x5ef1('0x38')]=_0x269bf0['attributes'][_0x5ef1('0x4b')]?_0x269bf0[_0x5ef1('0x38')]:_0x4882b5[_0x5ef1('0x34')];_0x269bf0['order']=qs[_0x5ef1('0x3b')](_0x5ed49e[_0x5ef1('0x35')][_0x5ef1('0x3b')]);_0x269bf0[_0x5ef1('0x3f')]=qs[_0x5ef1('0x3c')](_[_0x5ef1('0x3d')](_0x5ed49e[_0x5ef1('0x35')],_0x4882b5[_0x5ef1('0x3c')]));if(_0x5ed49e['query'][_0x5ef1('0x41')]){_0x269bf0['where']=_[_0x5ef1('0x3e')](_0x269bf0[_0x5ef1('0x3f')],{'$or':_[_0x5ef1('0x2f')](_0x269bf0[_0x5ef1('0x38')],function(_0x257ae6){var _0x2b62b4={};_0x2b62b4[_0x257ae6]={'$like':'%'+_0x5ed49e[_0x5ef1('0x35')][_0x5ef1('0x41')]+'%'};return _0x2b62b4;})});}_0x269bf0=_[_0x5ef1('0x3e')]({},_0x269bf0,_0x5ed49e[_0x5ef1('0x42')]);return _0x5cc46c[_0x5ef1('0x55')](_0x269bf0);}})[_0x5ef1('0x27')](function(_0xc78184){if(_0xc78184){_0x117c3e=_0xc78184[_0x5ef1('0x4b')];if(!_0x5ed49e['query']['hasOwnProperty'](_0x5ef1('0x52'))){_0x269bf0[_0x5ef1('0x20')]=qs['limit'](_0x5ed49e[_0x5ef1('0x35')]['limit']);_0x269bf0[_0x5ef1('0x1e')]=qs[_0x5ef1('0x1e')](_0x5ed49e[_0x5ef1('0x35')][_0x5ef1('0x1e')]);}return _0x5cc46c['getDescriptions'](_0x269bf0);}})[_0x5ef1('0x27')](function(_0x10ebae){if(_0x10ebae){return _0x10ebae?{'count':_0x117c3e,'rows':_0x10ebae}:null;}})[_0x5ef1('0x27')](respondWithResult(_0x2dbdc1,null))['catch'](handleError(_0x2dbdc1,null));}; \ No newline at end of file +var _0x7ad0=['update','then','name','send','index','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','params','length','includeAll','create','body','find','destroy','getFields','findOne','Dynamics365Field','options','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x33a97f,_0x147410){var _0x11017f=function(_0x149218){while(--_0x149218){_0x33a97f['push'](_0x33a97f['shift']());}};_0x11017f(++_0x147410);}(_0x7ad0,0x80));var _0x07ad=function(_0x3ff036,_0x5be445){_0x3ff036=_0x3ff036-0x0;var _0x1caded=_0x7ad0[_0x3ff036];return _0x1caded;};'use strict';var emlformat=require(_0x07ad('0x0'));var rimraf=require(_0x07ad('0x1'));var zipdir=require(_0x07ad('0x2'));var jsonpatch=require(_0x07ad('0x3'));var rp=require(_0x07ad('0x4'));var moment=require(_0x07ad('0x5'));var BPromise=require(_0x07ad('0x6'));var Mustache=require(_0x07ad('0x7'));var util=require(_0x07ad('0x8'));var path=require('path');var sox=require(_0x07ad('0x9'));var csv=require(_0x07ad('0xa'));var ejs=require(_0x07ad('0xb'));var fs=require('fs');var fs_extra=require(_0x07ad('0xc'));var _=require(_0x07ad('0xd'));var squel=require(_0x07ad('0xe'));var crypto=require(_0x07ad('0xf'));var jsforce=require(_0x07ad('0x10'));var deskjs=require(_0x07ad('0x11'));var toCsv=require('to-csv');var querystring=require(_0x07ad('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x07ad('0x13'));var qs=require(_0x07ad('0x14'));var as=require(_0x07ad('0x15'));var hardwareService=require(_0x07ad('0x16'));var logger=require('../../config/logger')(_0x07ad('0x17'));var utils=require(_0x07ad('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x07ad('0x19'))['db'];function respondWithStatusCode(_0xf2a833,_0x23cce6){_0x23cce6=_0x23cce6||0xcc;return function(_0x3c91da){if(_0x3c91da){return _0xf2a833[_0x07ad('0x1a')](_0x23cce6);}return _0xf2a833[_0x07ad('0x1b')](_0x23cce6)[_0x07ad('0x1c')]();};}function respondWithResult(_0xc7b39,_0x57e8d1){_0x57e8d1=_0x57e8d1||0xc8;return function(_0x491197){if(_0x491197){return _0xc7b39[_0x07ad('0x1b')](_0x57e8d1)['json'](_0x491197);}};}function respondWithFilteredResult(_0x464487,_0x31d1f7){return function(_0x168c91){if(_0x168c91){var _0x5a44a0=typeof _0x31d1f7[_0x07ad('0x1d')]===_0x07ad('0x1e')&&typeof _0x31d1f7[_0x07ad('0x1f')]===_0x07ad('0x1e');var _0x5a6f75=_0x168c91[_0x07ad('0x20')];var _0x294eaf=_0x5a44a0?0x0:_0x31d1f7[_0x07ad('0x1d')];var _0x236e60=_0x5a44a0?_0x168c91[_0x07ad('0x20')]:_0x31d1f7[_0x07ad('0x1d')]+_0x31d1f7[_0x07ad('0x1f')];var _0x449948;if(_0x236e60>=_0x5a6f75){_0x236e60=_0x5a6f75;_0x449948=0xc8;}else{_0x449948=0xce;}_0x464487[_0x07ad('0x1b')](_0x449948);return _0x464487[_0x07ad('0x21')](_0x07ad('0x22'),_0x294eaf+'-'+_0x236e60+'/'+_0x5a6f75)['json'](_0x168c91);}return null;};}function patchUpdates(_0x3062eb){return function(_0x1b5044){try{jsonpatch[_0x07ad('0x23')](_0x1b5044,_0x3062eb,!![]);}catch(_0x47ec3a){return BPromise[_0x07ad('0x24')](_0x47ec3a);}return _0x1b5044[_0x07ad('0x25')]();};}function saveUpdates(_0x5b3ef7,_0x170518){return function(_0x52c2dc){if(_0x52c2dc){return _0x52c2dc[_0x07ad('0x26')](_0x5b3ef7)['then'](function(_0x42f6e6){return _0x42f6e6;});}return null;};}function removeEntity(_0x2ad710,_0x2999f0){return function(_0x3f1c25){if(_0x3f1c25){return _0x3f1c25['destroy']()[_0x07ad('0x27')](function(){_0x2ad710['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x17e210,_0x1f9ffd){return function(_0x2f8367){if(!_0x2f8367){_0x17e210[_0x07ad('0x1a')](0x194);}return _0x2f8367;};}function handleError(_0x127c6b,_0x33b1bd){_0x33b1bd=_0x33b1bd||0x1f4;return function(_0x39922f){logger['error'](_0x39922f['stack']);if(_0x39922f[_0x07ad('0x28')]){delete _0x39922f[_0x07ad('0x28')];}_0x127c6b[_0x07ad('0x1b')](_0x33b1bd)[_0x07ad('0x29')](_0x39922f);};}exports[_0x07ad('0x2a')]=function(_0x41fba1,_0x5a43c7){var _0x46e6a6={},_0x58be68={},_0x34c072={'count':0x0,'rows':[]};var _0x5c20ee=_['map'](db[_0x07ad('0x2b')][_0x07ad('0x2c')],function(_0x19c2ea){return{'name':_0x19c2ea[_0x07ad('0x2d')],'type':_0x19c2ea[_0x07ad('0x2e')][_0x07ad('0x2f')]};});_0x58be68[_0x07ad('0x30')]=_[_0x07ad('0x31')](_0x5c20ee,_0x07ad('0x28'));_0x58be68[_0x07ad('0x32')]=_[_0x07ad('0x33')](_0x41fba1[_0x07ad('0x32')]);_0x58be68['filters']=_[_0x07ad('0x34')](_0x58be68[_0x07ad('0x30')],_0x58be68[_0x07ad('0x32')]);_0x46e6a6['attributes']=_['intersection'](_0x58be68[_0x07ad('0x30')],qs[_0x07ad('0x35')](_0x41fba1[_0x07ad('0x32')][_0x07ad('0x35')]));_0x46e6a6[_0x07ad('0x36')]=_0x46e6a6[_0x07ad('0x36')]['length']?_0x46e6a6[_0x07ad('0x36')]:_0x58be68[_0x07ad('0x30')];if(!_0x41fba1[_0x07ad('0x32')][_0x07ad('0x37')](_0x07ad('0x38'))){_0x46e6a6[_0x07ad('0x1f')]=qs[_0x07ad('0x1f')](_0x41fba1[_0x07ad('0x32')][_0x07ad('0x1f')]);_0x46e6a6[_0x07ad('0x1d')]=qs[_0x07ad('0x1d')](_0x41fba1['query'][_0x07ad('0x1d')]);}_0x46e6a6[_0x07ad('0x39')]=qs['sort'](_0x41fba1[_0x07ad('0x32')][_0x07ad('0x3a')]);_0x46e6a6['where']=qs['filters'](_[_0x07ad('0x3b')](_0x41fba1[_0x07ad('0x32')],_0x58be68[_0x07ad('0x3c')]),_0x5c20ee);if(_0x41fba1[_0x07ad('0x32')][_0x07ad('0x3d')]){_0x46e6a6[_0x07ad('0x3e')]=_[_0x07ad('0x3f')](_0x46e6a6[_0x07ad('0x3e')],{'$or':_[_0x07ad('0x31')](_0x5c20ee,function(_0x48c3d0){if(_0x48c3d0[_0x07ad('0x2e')]!==_0x07ad('0x40')){var _0x232d40={};_0x232d40[_0x48c3d0[_0x07ad('0x28')]]={'$like':'%'+_0x41fba1[_0x07ad('0x32')][_0x07ad('0x3d')]+'%'};return _0x232d40;}})});}_0x46e6a6=_[_0x07ad('0x3f')]({},_0x46e6a6,_0x41fba1['options']);var _0x1c8460={'where':_0x46e6a6['where']};return db[_0x07ad('0x2b')][_0x07ad('0x20')](_0x1c8460)[_0x07ad('0x27')](function(_0x384163){_0x34c072['count']=_0x384163;if(_0x41fba1[_0x07ad('0x32')]['includeAll']){_0x46e6a6[_0x07ad('0x41')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x07ad('0x42')](_0x46e6a6);})[_0x07ad('0x27')](function(_0x35c5a0){_0x34c072[_0x07ad('0x43')]=_0x35c5a0;return _0x34c072;})[_0x07ad('0x27')](respondWithFilteredResult(_0x5a43c7,_0x46e6a6))[_0x07ad('0x44')](handleError(_0x5a43c7,null));};exports[_0x07ad('0x45')]=function(_0x57e54f,_0x48bd37){var _0x3fcb0c={'raw':![],'where':{'id':_0x57e54f[_0x07ad('0x46')]['id']}},_0x74a042={};_0x74a042[_0x07ad('0x30')]=_[_0x07ad('0x33')](db['Dynamics365Configuration'][_0x07ad('0x2c')]);_0x74a042['query']=_[_0x07ad('0x33')](_0x57e54f[_0x07ad('0x32')]);_0x74a042[_0x07ad('0x3c')]=_['intersection'](_0x74a042[_0x07ad('0x30')],_0x74a042[_0x07ad('0x32')]);_0x3fcb0c[_0x07ad('0x36')]=_[_0x07ad('0x34')](_0x74a042[_0x07ad('0x30')],qs[_0x07ad('0x35')](_0x57e54f['query'][_0x07ad('0x35')]));_0x3fcb0c[_0x07ad('0x36')]=_0x3fcb0c['attributes'][_0x07ad('0x47')]?_0x3fcb0c[_0x07ad('0x36')]:_0x74a042[_0x07ad('0x30')];if(_0x57e54f['query'][_0x07ad('0x48')]){_0x3fcb0c[_0x07ad('0x41')]=[{'all':!![]}];}_0x3fcb0c=_[_0x07ad('0x3f')]({},_0x3fcb0c,_0x57e54f['options']);return db[_0x07ad('0x2b')]['find'](_0x3fcb0c)[_0x07ad('0x27')](handleEntityNotFound(_0x48bd37,null))[_0x07ad('0x27')](respondWithResult(_0x48bd37,null))[_0x07ad('0x44')](handleError(_0x48bd37,null));};exports[_0x07ad('0x49')]=function(_0x3f0e32,_0x2378a2){return db[_0x07ad('0x2b')][_0x07ad('0x49')](_0x3f0e32['body'],{})['then'](respondWithResult(_0x2378a2,0xc9))['catch'](handleError(_0x2378a2,null));};exports[_0x07ad('0x26')]=function(_0xa1d0a2,_0x5d1340){if(_0xa1d0a2[_0x07ad('0x4a')]['id']){delete _0xa1d0a2[_0x07ad('0x4a')]['id'];}return db['Dynamics365Configuration'][_0x07ad('0x4b')]({'where':{'id':_0xa1d0a2[_0x07ad('0x46')]['id']}})[_0x07ad('0x27')](handleEntityNotFound(_0x5d1340,null))[_0x07ad('0x27')](saveUpdates(_0xa1d0a2['body'],null))[_0x07ad('0x27')](respondWithResult(_0x5d1340,null))[_0x07ad('0x44')](handleError(_0x5d1340,null));};exports[_0x07ad('0x4c')]=function(_0x55a276,_0x233167){return db[_0x07ad('0x2b')]['find']({'where':{'id':_0x55a276[_0x07ad('0x46')]['id']}})[_0x07ad('0x27')](handleEntityNotFound(_0x233167,null))['then'](removeEntity(_0x233167,null))[_0x07ad('0x44')](handleError(_0x233167,null));};exports[_0x07ad('0x4d')]=function(_0x388bbd,_0x16ea0f,_0x32a584){var _0x12980b={};var _0x2bb026={};var _0x367dda;var _0x275ae8;return db[_0x07ad('0x2b')][_0x07ad('0x4e')]({'where':{'id':_0x388bbd['params']['id']}})[_0x07ad('0x27')](handleEntityNotFound(_0x16ea0f,null))[_0x07ad('0x27')](function(_0x2ae98e){if(_0x2ae98e){_0x367dda=_0x2ae98e;_0x2bb026['model']=_[_0x07ad('0x33')](db[_0x07ad('0x4f')]['rawAttributes']);_0x2bb026[_0x07ad('0x32')]=_[_0x07ad('0x33')](_0x388bbd[_0x07ad('0x32')]);_0x2bb026[_0x07ad('0x3c')]=_[_0x07ad('0x34')](_0x2bb026[_0x07ad('0x30')],_0x2bb026[_0x07ad('0x32')]);_0x12980b['attributes']=_[_0x07ad('0x34')](_0x2bb026[_0x07ad('0x30')],qs['fields'](_0x388bbd[_0x07ad('0x32')][_0x07ad('0x35')]));_0x12980b[_0x07ad('0x36')]=_0x12980b['attributes'][_0x07ad('0x47')]?_0x12980b[_0x07ad('0x36')]:_0x2bb026[_0x07ad('0x30')];_0x12980b[_0x07ad('0x39')]=qs[_0x07ad('0x3a')](_0x388bbd[_0x07ad('0x32')][_0x07ad('0x3a')]);_0x12980b[_0x07ad('0x3e')]=qs['filters'](_['pick'](_0x388bbd[_0x07ad('0x32')],_0x2bb026[_0x07ad('0x3c')]));if(_0x388bbd[_0x07ad('0x32')][_0x07ad('0x3d')]){_0x12980b[_0x07ad('0x3e')]=_[_0x07ad('0x3f')](_0x12980b[_0x07ad('0x3e')],{'$or':_[_0x07ad('0x31')](_0x12980b['attributes'],function(_0x4ede76){var _0x1eca8b={};_0x1eca8b[_0x4ede76]={'$like':'%'+_0x388bbd[_0x07ad('0x32')][_0x07ad('0x3d')]+'%'};return _0x1eca8b;})});}_0x12980b=_[_0x07ad('0x3f')]({},_0x12980b,_0x388bbd[_0x07ad('0x50')]);return _0x367dda[_0x07ad('0x4d')](_0x12980b);}})[_0x07ad('0x27')](function(_0x3b8b22){if(_0x3b8b22){_0x275ae8=_0x3b8b22[_0x07ad('0x47')];if(!_0x388bbd[_0x07ad('0x32')][_0x07ad('0x37')]('nolimit')){_0x12980b[_0x07ad('0x1f')]=qs['limit'](_0x388bbd[_0x07ad('0x32')]['limit']);_0x12980b['offset']=qs[_0x07ad('0x1d')](_0x388bbd[_0x07ad('0x32')][_0x07ad('0x1d')]);}return _0x367dda[_0x07ad('0x4d')](_0x12980b);}})['then'](function(_0x26b807){if(_0x26b807){return _0x26b807?{'count':_0x275ae8,'rows':_0x26b807}:null;}})[_0x07ad('0x27')](respondWithResult(_0x16ea0f,null))[_0x07ad('0x44')](handleError(_0x16ea0f,null));};exports[_0x07ad('0x51')]=function(_0x507ce6,_0x5dc3f,_0xfec729){var _0x44a77e={};var _0x30c43d={};var _0x4ec673;var _0x44ecb7;return db[_0x07ad('0x2b')][_0x07ad('0x4e')]({'where':{'id':_0x507ce6['params']['id']}})['then'](handleEntityNotFound(_0x5dc3f,null))['then'](function(_0x3a10c8){if(_0x3a10c8){_0x4ec673=_0x3a10c8;_0x30c43d['model']=_['keys'](db[_0x07ad('0x4f')][_0x07ad('0x2c')]);_0x30c43d[_0x07ad('0x32')]=_['keys'](_0x507ce6[_0x07ad('0x32')]);_0x30c43d[_0x07ad('0x3c')]=_[_0x07ad('0x34')](_0x30c43d['model'],_0x30c43d[_0x07ad('0x32')]);_0x44a77e[_0x07ad('0x36')]=_[_0x07ad('0x34')](_0x30c43d[_0x07ad('0x30')],qs[_0x07ad('0x35')](_0x507ce6[_0x07ad('0x32')][_0x07ad('0x35')]));_0x44a77e[_0x07ad('0x36')]=_0x44a77e[_0x07ad('0x36')][_0x07ad('0x47')]?_0x44a77e[_0x07ad('0x36')]:_0x30c43d[_0x07ad('0x30')];_0x44a77e[_0x07ad('0x39')]=qs[_0x07ad('0x3a')](_0x507ce6[_0x07ad('0x32')]['sort']);_0x44a77e[_0x07ad('0x3e')]=qs[_0x07ad('0x3c')](_[_0x07ad('0x3b')](_0x507ce6['query'],_0x30c43d[_0x07ad('0x3c')]));if(_0x507ce6[_0x07ad('0x32')]['filter']){_0x44a77e[_0x07ad('0x3e')]=_['merge'](_0x44a77e[_0x07ad('0x3e')],{'$or':_[_0x07ad('0x31')](_0x44a77e[_0x07ad('0x36')],function(_0x2e91bb){var _0x52a666={};_0x52a666[_0x2e91bb]={'$like':'%'+_0x507ce6['query'][_0x07ad('0x3d')]+'%'};return _0x52a666;})});}_0x44a77e=_[_0x07ad('0x3f')]({},_0x44a77e,_0x507ce6[_0x07ad('0x50')]);return _0x4ec673[_0x07ad('0x51')](_0x44a77e);}})[_0x07ad('0x27')](function(_0xe751b9){if(_0xe751b9){_0x44ecb7=_0xe751b9[_0x07ad('0x47')];if(!_0x507ce6[_0x07ad('0x32')][_0x07ad('0x37')](_0x07ad('0x38'))){_0x44a77e[_0x07ad('0x1f')]=qs[_0x07ad('0x1f')](_0x507ce6[_0x07ad('0x32')][_0x07ad('0x1f')]);_0x44a77e[_0x07ad('0x1d')]=qs[_0x07ad('0x1d')](_0x507ce6[_0x07ad('0x32')][_0x07ad('0x1d')]);}return _0x4ec673[_0x07ad('0x51')](_0x44a77e);}})['then'](function(_0x26a1b3){if(_0x26a1b3){return _0x26a1b3?{'count':_0x44ecb7,'rows':_0x26a1b3}:null;}})[_0x07ad('0x27')](respondWithResult(_0x5dc3f,null))[_0x07ad('0x44')](handleError(_0x5dc3f,null));};exports[_0x07ad('0x52')]=function(_0x3c85dc,_0x47b26f,_0x22e13f){var _0x2d4c72={};var _0x52815a={};var _0x3e0d12;var _0x53410c;return db[_0x07ad('0x2b')][_0x07ad('0x4e')]({'where':{'id':_0x3c85dc[_0x07ad('0x46')]['id']}})[_0x07ad('0x27')](handleEntityNotFound(_0x47b26f,null))['then'](function(_0x15acb5){if(_0x15acb5){_0x3e0d12=_0x15acb5;_0x52815a['model']=_[_0x07ad('0x33')](db[_0x07ad('0x4f')][_0x07ad('0x2c')]);_0x52815a[_0x07ad('0x32')]=_[_0x07ad('0x33')](_0x3c85dc['query']);_0x52815a[_0x07ad('0x3c')]=_[_0x07ad('0x34')](_0x52815a['model'],_0x52815a[_0x07ad('0x32')]);_0x2d4c72[_0x07ad('0x36')]=_['intersection'](_0x52815a[_0x07ad('0x30')],qs[_0x07ad('0x35')](_0x3c85dc[_0x07ad('0x32')][_0x07ad('0x35')]));_0x2d4c72[_0x07ad('0x36')]=_0x2d4c72[_0x07ad('0x36')]['length']?_0x2d4c72[_0x07ad('0x36')]:_0x52815a['model'];_0x2d4c72[_0x07ad('0x39')]=qs['sort'](_0x3c85dc[_0x07ad('0x32')][_0x07ad('0x3a')]);_0x2d4c72[_0x07ad('0x3e')]=qs['filters'](_[_0x07ad('0x3b')](_0x3c85dc['query'],_0x52815a[_0x07ad('0x3c')]));if(_0x3c85dc[_0x07ad('0x32')][_0x07ad('0x3d')]){_0x2d4c72[_0x07ad('0x3e')]=_[_0x07ad('0x3f')](_0x2d4c72[_0x07ad('0x3e')],{'$or':_[_0x07ad('0x31')](_0x2d4c72[_0x07ad('0x36')],function(_0x1a40cb){var _0x333e70={};_0x333e70[_0x1a40cb]={'$like':'%'+_0x3c85dc[_0x07ad('0x32')]['filter']+'%'};return _0x333e70;})});}_0x2d4c72=_[_0x07ad('0x3f')]({},_0x2d4c72,_0x3c85dc[_0x07ad('0x50')]);return _0x3e0d12[_0x07ad('0x52')](_0x2d4c72);}})[_0x07ad('0x27')](function(_0x1da26f){if(_0x1da26f){_0x53410c=_0x1da26f[_0x07ad('0x47')];if(!_0x3c85dc['query'][_0x07ad('0x37')](_0x07ad('0x38'))){_0x2d4c72[_0x07ad('0x1f')]=qs[_0x07ad('0x1f')](_0x3c85dc[_0x07ad('0x32')][_0x07ad('0x1f')]);_0x2d4c72[_0x07ad('0x1d')]=qs[_0x07ad('0x1d')](_0x3c85dc['query'][_0x07ad('0x1d')]);}return _0x3e0d12[_0x07ad('0x52')](_0x2d4c72);}})[_0x07ad('0x27')](function(_0x27ef2){if(_0x27ef2){return _0x27ef2?{'count':_0x53410c,'rows':_0x27ef2}:null;}})[_0x07ad('0x27')](respondWithResult(_0x47b26f,null))['catch'](handleError(_0x47b26f,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 9d9a583..cbbf8ea 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x5e918d,_0x129f9e){var _0x4250f4=function(_0x13b980){while(--_0x13b980){_0x5e918d['push'](_0x5e918d['shift']());}};_0x4250f4(++_0x129f9e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb821=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','bluebird'];(function(_0x54f641,_0x8ee543){var _0x5bb545=function(_0x4ae7fe){while(--_0x4ae7fe){_0x54f641['push'](_0x54f641['shift']());}};_0x5bb545(++_0x8ee543);}(_0xb821,0xa7));var _0x1b82=function(_0x3624ae,_0x4e0756){_0x3624ae=_0x3624ae-0x0;var _0x808d7b=_0xb821[_0x3624ae];return _0x808d7b;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 01796dc..d5eef8f 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 _0xa807=['Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','ioredis','../../config/utils','rpc','http','request','then','info'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa807,0x1d2));var _0x7a80=function(_0x425f0c,_0x263b17){_0x425f0c=_0x425f0c-0x0;var _0x2b86c7=_0xa807[_0x425f0c];return _0x2b86c7;};'use strict';var _=require(_0x7a80('0x0'));var util=require(_0x7a80('0x1'));var moment=require(_0x7a80('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a80('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a80('0x4'));var logger=require('../../config/logger')(_0x7a80('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x7a80('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3731b9,_0x11c262,_0x1e1411){return new BPromise(function(_0x574051,_0x206048){return client[_0x7a80('0x7')](_0x3731b9,_0x1e1411)[_0x7a80('0x8')](function(_0x37bedb){logger[_0x7a80('0x9')](_0x7a80('0xa'),_0x11c262,_0x7a80('0xb'));logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x11c262,_0x7a80('0xb'),JSON[_0x7a80('0xc')](_0x37bedb));if(_0x37bedb[_0x7a80('0xd')]){if(_0x37bedb['error'][_0x7a80('0xe')]===0x1f4){logger[_0x7a80('0xd')](_0x7a80('0xa'),_0x11c262,_0x37bedb[_0x7a80('0xd')][_0x7a80('0xf')]);return _0x206048(_0x37bedb[_0x7a80('0xd')][_0x7a80('0xf')]);}logger[_0x7a80('0xd')](_0x7a80('0xa'),_0x11c262,_0x37bedb[_0x7a80('0xd')]['message']);return _0x574051(_0x37bedb['error'][_0x7a80('0xf')]);}else{logger['info'](_0x7a80('0xa'),_0x11c262,'request\x20sent');_0x574051(_0x37bedb['result']['message']);}})[_0x7a80('0x10')](function(_0x2581fd){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x11c262,_0x2581fd);_0x206048(_0x2581fd);});});} \ No newline at end of file +var _0x7b71=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','http','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7b71,0x116));var _0x17b7=function(_0x33ca22,_0xbcc94){_0x33ca22=_0x33ca22-0x0;var _0x1790c3=_0x7b71[_0x33ca22];return _0x1790c3;};'use strict';var _=require(_0x17b7('0x0'));var util=require(_0x17b7('0x1'));var moment=require(_0x17b7('0x2'));var BPromise=require(_0x17b7('0x3'));var rs=require(_0x17b7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x17b7('0x5'));var logger=require(_0x17b7('0x6'))(_0x17b7('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x17b7('0x8')][_0x17b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47ae7c,_0x209d0d,_0x1ea7e0){return new BPromise(function(_0x18e548,_0x51459e){return client['request'](_0x47ae7c,_0x1ea7e0)['then'](function(_0x742adc){logger[_0x17b7('0xa')](_0x17b7('0xb'),_0x209d0d,_0x17b7('0xc'));logger[_0x17b7('0xd')](_0x17b7('0xe'),_0x209d0d,_0x17b7('0xc'),JSON[_0x17b7('0xf')](_0x742adc));if(_0x742adc[_0x17b7('0x10')]){if(_0x742adc[_0x17b7('0x10')]['code']===0x1f4){logger[_0x17b7('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x209d0d,_0x742adc['error'][_0x17b7('0x11')]);return _0x51459e(_0x742adc[_0x17b7('0x10')][_0x17b7('0x11')]);}logger[_0x17b7('0x10')](_0x17b7('0xb'),_0x209d0d,_0x742adc[_0x17b7('0x10')][_0x17b7('0x11')]);return _0x18e548(_0x742adc[_0x17b7('0x10')]['message']);}else{logger[_0x17b7('0xa')]('Dynamics365Configuration,\x20%s,\x20%s',_0x209d0d,_0x17b7('0xc'));_0x18e548(_0x742adc[_0x17b7('0x12')][_0x17b7('0x11')]);}})[_0x17b7('0x13')](function(_0xf9608b){logger[_0x17b7('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x209d0d,_0xf9608b);_0x51459e(_0xf9608b);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index ec5de4c..043dd20 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 _0xcdf0=['show','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcdf0,0x112));var _0x0cdf=function(_0x4dd507,_0x18c725){_0x4dd507=_0x4dd507-0x0;var _0x1e774e=_0xcdf0[_0x4dd507];return _0x1e774e;};'use strict';var multer=require(_0x0cdf('0x0'));var util=require(_0x0cdf('0x1'));var path=require(_0x0cdf('0x2'));var timeout=require(_0x0cdf('0x3'));var express=require(_0x0cdf('0x4'));var router=express[_0x0cdf('0x5')]();var fs_extra=require(_0x0cdf('0x6'));var auth=require(_0x0cdf('0x7'));var interaction=require(_0x0cdf('0x8'));var config=require(_0x0cdf('0x9'));var controller=require('./intDynamics365Field.controller');router['get']('/',auth[_0x0cdf('0xa')](),controller[_0x0cdf('0xb')]);router[_0x0cdf('0xc')](_0x0cdf('0xd'),auth[_0x0cdf('0xa')](),controller[_0x0cdf('0xe')]);router['post']('/',auth[_0x0cdf('0xa')](),controller['create']);router[_0x0cdf('0xf')](_0x0cdf('0xd'),auth[_0x0cdf('0xa')](),controller['update']);router[_0x0cdf('0x10')](_0x0cdf('0xd'),auth[_0x0cdf('0xa')](),controller['destroy']);module[_0x0cdf('0x11')]=router; \ No newline at end of file +var _0x0aa9=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xdd4565,_0x179e9c){var _0x2804ae=function(_0x41e7b8){while(--_0x41e7b8){_0xdd4565['push'](_0xdd4565['shift']());}};_0x2804ae(++_0x179e9c);}(_0x0aa9,0xf5));var _0x90aa=function(_0x406c1e,_0x279e87){_0x406c1e=_0x406c1e-0x0;var _0x883a01=_0x0aa9[_0x406c1e];return _0x883a01;};'use strict';var multer=require(_0x90aa('0x0'));var util=require(_0x90aa('0x1'));var path=require('path');var timeout=require(_0x90aa('0x2'));var express=require(_0x90aa('0x3'));var router=express[_0x90aa('0x4')]();var fs_extra=require(_0x90aa('0x5'));var auth=require(_0x90aa('0x6'));var interaction=require(_0x90aa('0x7'));var config=require(_0x90aa('0x8'));var controller=require('./intDynamics365Field.controller');router[_0x90aa('0x9')]('/',auth[_0x90aa('0xa')](),controller['index']);router[_0x90aa('0x9')](_0x90aa('0xb'),auth[_0x90aa('0xa')](),controller['show']);router[_0x90aa('0xc')]('/',auth[_0x90aa('0xa')](),controller[_0x90aa('0xd')]);router['put'](_0x90aa('0xb'),auth['isAuthenticated'](),controller[_0x90aa('0xe')]);router[_0x90aa('0xf')](_0x90aa('0xb'),auth[_0x90aa('0xa')](),controller[_0x90aa('0x10')]);module[_0x90aa('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index a09c2ed..268373f 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 _0x72f7=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x5b9c9a,_0x1c1b96){var _0x58f5ae=function(_0x2bc336){while(--_0x2bc336){_0x5b9c9a['push'](_0x5b9c9a['shift']());}};_0x58f5ae(++_0x1c1b96);}(_0x72f7,0x10a));var _0x772f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x72f7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x772f('0x0'));module[_0x772f('0x1')]={'type':{'type':Sequelize[_0x772f('0x2')](_0x772f('0x3'),_0x772f('0x4'),_0x772f('0x5'),_0x772f('0x6'),_0x772f('0x7')),'defaultValue':_0x772f('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x772f('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x772f('0x3'),_0x772f('0x4'),_0x772f('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x772f('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x772f('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf9ed=['string','variable','customVariable','STRING','sequelize','exports','ENUM'];(function(_0x148073,_0x37dbaa){var _0x30ba58=function(_0x2ce0e4){while(--_0x2ce0e4){_0x148073['push'](_0x148073['shift']());}};_0x30ba58(++_0x37dbaa);}(_0xf9ed,0x185));var _0xdf9e=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xf9ed[_0x3070dc];return _0x431489;};'use strict';var Sequelize=require(_0xdf9e('0x0'));module[_0xdf9e('0x1')]={'type':{'type':Sequelize[_0xdf9e('0x2')](_0xdf9e('0x3'),_0xdf9e('0x4'),_0xdf9e('0x5'),'keyValue','picklist'),'defaultValue':_0xdf9e('0x3')},'content':{'type':Sequelize[_0xdf9e('0x6')]},'key':{'type':Sequelize[_0xdf9e('0x6')]},'keyType':{'type':Sequelize[_0xdf9e('0x2')](_0xdf9e('0x3'),_0xdf9e('0x4'),_0xdf9e('0x5'))},'keyContent':{'type':Sequelize[_0xdf9e('0x6')]},'idField':{'type':Sequelize[_0xdf9e('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdf9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index bfd1519..143b4f5 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 _0xd63f=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','include','findAll','rows','catch','show','params','intersection','includeAll','options','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','end','name','send','index','Dynamics365Field','rawAttributes','fieldName','type','key','model','map','query','keys','fields'];(function(_0x18e875,_0x54fff7){var _0x1643c6=function(_0x5f09ff){while(--_0x5f09ff){_0x18e875['push'](_0x18e875['shift']());}};_0x1643c6(++_0x54fff7);}(_0xd63f,0x1cd));var _0xfd63=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd63f[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xfd63('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfd63('0x1'));var jsonpatch=require(_0xfd63('0x2'));var rp=require(_0xfd63('0x3'));var moment=require('moment');var BPromise=require(_0xfd63('0x4'));var Mustache=require(_0xfd63('0x5'));var util=require(_0xfd63('0x6'));var path=require('path');var sox=require(_0xfd63('0x7'));var csv=require(_0xfd63('0x8'));var ejs=require(_0xfd63('0x9'));var fs=require('fs');var fs_extra=require(_0xfd63('0xa'));var _=require('lodash');var squel=require(_0xfd63('0xb'));var crypto=require(_0xfd63('0xc'));var jsforce=require(_0xfd63('0xd'));var deskjs=require(_0xfd63('0xe'));var toCsv=require(_0xfd63('0x8'));var querystring=require(_0xfd63('0xf'));var Papa=require(_0xfd63('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfd63('0x11'));var as=require(_0xfd63('0x12'));var hardwareService=require(_0xfd63('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xfd63('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40ca8e,_0x1488c0){_0x1488c0=_0x1488c0||0xcc;return function(_0x1efda8){if(_0x1efda8){return _0x40ca8e[_0xfd63('0x15')](_0x1488c0);}return _0x40ca8e[_0xfd63('0x16')](_0x1488c0)['end']();};}function respondWithResult(_0x386eb9,_0x192784){_0x192784=_0x192784||0xc8;return function(_0x568c8a){if(_0x568c8a){return _0x386eb9[_0xfd63('0x16')](_0x192784)['json'](_0x568c8a);}};}function respondWithFilteredResult(_0x17241c,_0x2a02fa){return function(_0xafa8ff){if(_0xafa8ff){var _0x4bd82f=typeof _0x2a02fa['offset']===_0xfd63('0x17')&&typeof _0x2a02fa[_0xfd63('0x18')]==='undefined';var _0x4b6202=_0xafa8ff[_0xfd63('0x19')];var _0x4145c9=_0x4bd82f?0x0:_0x2a02fa[_0xfd63('0x1a')];var _0x37b310=_0x4bd82f?_0xafa8ff[_0xfd63('0x19')]:_0x2a02fa[_0xfd63('0x1a')]+_0x2a02fa[_0xfd63('0x18')];var _0x18e065;if(_0x37b310>=_0x4b6202){_0x37b310=_0x4b6202;_0x18e065=0xc8;}else{_0x18e065=0xce;}_0x17241c[_0xfd63('0x16')](_0x18e065);return _0x17241c[_0xfd63('0x1b')](_0xfd63('0x1c'),_0x4145c9+'-'+_0x37b310+'/'+_0x4b6202)[_0xfd63('0x1d')](_0xafa8ff);}return null;};}function patchUpdates(_0x27360f){return function(_0x18dd5a){try{jsonpatch[_0xfd63('0x1e')](_0x18dd5a,_0x27360f,!![]);}catch(_0x1be043){return BPromise[_0xfd63('0x1f')](_0x1be043);}return _0x18dd5a[_0xfd63('0x20')]();};}function saveUpdates(_0x1fd4cf,_0x5ea409){return function(_0x12b67e){if(_0x12b67e){return _0x12b67e[_0xfd63('0x21')](_0x1fd4cf)[_0xfd63('0x22')](function(_0x353930){return _0x353930;});}return null;};}function removeEntity(_0xfb085a,_0x3828db){return function(_0x3a743a){if(_0x3a743a){return _0x3a743a[_0xfd63('0x23')]()[_0xfd63('0x22')](function(){_0xfb085a[_0xfd63('0x16')](0xcc)[_0xfd63('0x24')]();});}};}function handleEntityNotFound(_0x160c91,_0x268a7a){return function(_0x1bf0a4){if(!_0x1bf0a4){_0x160c91[_0xfd63('0x15')](0x194);}return _0x1bf0a4;};}function handleError(_0x3819b4,_0x50c28c){_0x50c28c=_0x50c28c||0x1f4;return function(_0x197bf5){logger['error'](_0x197bf5['stack']);if(_0x197bf5[_0xfd63('0x25')]){delete _0x197bf5['name'];}_0x3819b4[_0xfd63('0x16')](_0x50c28c)[_0xfd63('0x26')](_0x197bf5);};}exports[_0xfd63('0x27')]=function(_0x56263d,_0x3ed145){var _0x3865e7={},_0x3a91f7={},_0x18b1e8={'count':0x0,'rows':[]};var _0x1e0a32=_['map'](db[_0xfd63('0x28')][_0xfd63('0x29')],function(_0x13f297){return{'name':_0x13f297[_0xfd63('0x2a')],'type':_0x13f297[_0xfd63('0x2b')][_0xfd63('0x2c')]};});_0x3a91f7[_0xfd63('0x2d')]=_[_0xfd63('0x2e')](_0x1e0a32,_0xfd63('0x25'));_0x3a91f7[_0xfd63('0x2f')]=_[_0xfd63('0x30')](_0x56263d[_0xfd63('0x2f')]);_0x3a91f7['filters']=_['intersection'](_0x3a91f7[_0xfd63('0x2d')],_0x3a91f7['query']);_0x3865e7['attributes']=_['intersection'](_0x3a91f7[_0xfd63('0x2d')],qs[_0xfd63('0x31')](_0x56263d['query'][_0xfd63('0x31')]));_0x3865e7['attributes']=_0x3865e7[_0xfd63('0x32')][_0xfd63('0x33')]?_0x3865e7[_0xfd63('0x32')]:_0x3a91f7[_0xfd63('0x2d')];if(!_0x56263d[_0xfd63('0x2f')][_0xfd63('0x34')](_0xfd63('0x35'))){_0x3865e7[_0xfd63('0x18')]=qs['limit'](_0x56263d[_0xfd63('0x2f')][_0xfd63('0x18')]);_0x3865e7['offset']=qs[_0xfd63('0x1a')](_0x56263d[_0xfd63('0x2f')]['offset']);}_0x3865e7[_0xfd63('0x36')]=qs[_0xfd63('0x37')](_0x56263d[_0xfd63('0x2f')]['sort']);_0x3865e7[_0xfd63('0x38')]=qs['filters'](_[_0xfd63('0x39')](_0x56263d[_0xfd63('0x2f')],_0x3a91f7[_0xfd63('0x3a')]),_0x1e0a32);if(_0x56263d[_0xfd63('0x2f')][_0xfd63('0x3b')]){_0x3865e7[_0xfd63('0x38')]=_[_0xfd63('0x3c')](_0x3865e7[_0xfd63('0x38')],{'$or':_[_0xfd63('0x2e')](_0x1e0a32,function(_0x56c049){if(_0x56c049[_0xfd63('0x2b')]!=='VIRTUAL'){var _0x5b9c40={};_0x5b9c40[_0x56c049[_0xfd63('0x25')]]={'$like':'%'+_0x56263d['query'][_0xfd63('0x3b')]+'%'};return _0x5b9c40;}})});}_0x3865e7=_[_0xfd63('0x3c')]({},_0x3865e7,_0x56263d['options']);var _0x136f2b={'where':_0x3865e7[_0xfd63('0x38')]};return db[_0xfd63('0x28')][_0xfd63('0x19')](_0x136f2b)['then'](function(_0xaea07f){_0x18b1e8[_0xfd63('0x19')]=_0xaea07f;if(_0x56263d['query']['includeAll']){_0x3865e7[_0xfd63('0x3d')]=[{'all':!![]}];}return db[_0xfd63('0x28')][_0xfd63('0x3e')](_0x3865e7);})[_0xfd63('0x22')](function(_0xf8203c){_0x18b1e8[_0xfd63('0x3f')]=_0xf8203c;return _0x18b1e8;})[_0xfd63('0x22')](respondWithFilteredResult(_0x3ed145,_0x3865e7))[_0xfd63('0x40')](handleError(_0x3ed145,null));};exports[_0xfd63('0x41')]=function(_0x144877,_0x346e7d){var _0x1918ed={'raw':!![],'where':{'id':_0x144877[_0xfd63('0x42')]['id']}},_0x138dff={};_0x138dff['model']=_[_0xfd63('0x30')](db[_0xfd63('0x28')][_0xfd63('0x29')]);_0x138dff[_0xfd63('0x2f')]=_[_0xfd63('0x30')](_0x144877[_0xfd63('0x2f')]);_0x138dff['filters']=_[_0xfd63('0x43')](_0x138dff[_0xfd63('0x2d')],_0x138dff[_0xfd63('0x2f')]);_0x1918ed[_0xfd63('0x32')]=_[_0xfd63('0x43')](_0x138dff['model'],qs['fields'](_0x144877[_0xfd63('0x2f')]['fields']));_0x1918ed[_0xfd63('0x32')]=_0x1918ed['attributes'][_0xfd63('0x33')]?_0x1918ed[_0xfd63('0x32')]:_0x138dff[_0xfd63('0x2d')];if(_0x144877[_0xfd63('0x2f')][_0xfd63('0x44')]){_0x1918ed[_0xfd63('0x3d')]=[{'all':!![]}];}_0x1918ed=_[_0xfd63('0x3c')]({},_0x1918ed,_0x144877[_0xfd63('0x45')]);return db['Dynamics365Field'][_0xfd63('0x46')](_0x1918ed)[_0xfd63('0x22')](handleEntityNotFound(_0x346e7d,null))['then'](respondWithResult(_0x346e7d,null))[_0xfd63('0x40')](handleError(_0x346e7d,null));};exports[_0xfd63('0x47')]=function(_0x5cbea0,_0x1b3cd9){return db[_0xfd63('0x28')][_0xfd63('0x47')](_0x5cbea0[_0xfd63('0x48')],{})[_0xfd63('0x22')](respondWithResult(_0x1b3cd9,0xc9))['catch'](handleError(_0x1b3cd9,null));};exports['update']=function(_0x3b7da8,_0x4a7dad){if(_0x3b7da8[_0xfd63('0x48')]['id']){delete _0x3b7da8[_0xfd63('0x48')]['id'];}return db[_0xfd63('0x28')][_0xfd63('0x46')]({'where':{'id':_0x3b7da8[_0xfd63('0x42')]['id']}})[_0xfd63('0x22')](handleEntityNotFound(_0x4a7dad,null))[_0xfd63('0x22')](saveUpdates(_0x3b7da8[_0xfd63('0x48')],null))['then'](respondWithResult(_0x4a7dad,null))[_0xfd63('0x40')](handleError(_0x4a7dad,null));};exports[_0xfd63('0x23')]=function(_0x3534d5,_0x2c9275){return db[_0xfd63('0x28')][_0xfd63('0x46')]({'where':{'id':_0x3534d5[_0xfd63('0x42')]['id']}})[_0xfd63('0x22')](handleEntityNotFound(_0x2c9275,null))['then'](removeEntity(_0x2c9275,null))[_0xfd63('0x40')](handleError(_0x2c9275,null));}; \ No newline at end of file +var _0xcbd3=['limit','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','map','Dynamics365Field','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','create','body','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count'];(function(_0x4f2bf4,_0x5051e2){var _0x4b701c=function(_0x9184af){while(--_0x9184af){_0x4f2bf4['push'](_0x4f2bf4['shift']());}};_0x4b701c(++_0x5051e2);}(_0xcbd3,0x143));var _0x3cbd=function(_0x19577c,_0x578d2e){_0x19577c=_0x19577c-0x0;var _0xb287f7=_0xcbd3[_0x19577c];return _0xb287f7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3cbd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3cbd('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3cbd('0x2'));var Mustache=require(_0x3cbd('0x3'));var util=require(_0x3cbd('0x4'));var path=require(_0x3cbd('0x5'));var sox=require(_0x3cbd('0x6'));var csv=require(_0x3cbd('0x7'));var ejs=require(_0x3cbd('0x8'));var fs=require('fs');var fs_extra=require(_0x3cbd('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3cbd('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3cbd('0xb'));var toCsv=require(_0x3cbd('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3cbd('0xc'));var authService=require(_0x3cbd('0xd'));var qs=require(_0x3cbd('0xe'));var as=require(_0x3cbd('0xf'));var hardwareService=require(_0x3cbd('0x10'));var logger=require(_0x3cbd('0x11'))(_0x3cbd('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3cbd('0x13'));var db=require(_0x3cbd('0x14'))['db'];function respondWithStatusCode(_0x2781af,_0x451e2b){_0x451e2b=_0x451e2b||0xcc;return function(_0x26493f){if(_0x26493f){return _0x2781af[_0x3cbd('0x15')](_0x451e2b);}return _0x2781af[_0x3cbd('0x16')](_0x451e2b)['end']();};}function respondWithResult(_0x44ea00,_0x4040f8){_0x4040f8=_0x4040f8||0xc8;return function(_0x56146c){if(_0x56146c){return _0x44ea00[_0x3cbd('0x16')](_0x4040f8)[_0x3cbd('0x17')](_0x56146c);}};}function respondWithFilteredResult(_0x1b470d,_0x3da856){return function(_0xd9e513){if(_0xd9e513){var _0x2af97b=typeof _0x3da856[_0x3cbd('0x18')]==='undefined'&&typeof _0x3da856['limit']===_0x3cbd('0x19');var _0x51251a=_0xd9e513[_0x3cbd('0x1a')];var _0x54121c=_0x2af97b?0x0:_0x3da856[_0x3cbd('0x18')];var _0x2c3e9d=_0x2af97b?_0xd9e513[_0x3cbd('0x1a')]:_0x3da856['offset']+_0x3da856[_0x3cbd('0x1b')];var _0xe04b4c;if(_0x2c3e9d>=_0x51251a){_0x2c3e9d=_0x51251a;_0xe04b4c=0xc8;}else{_0xe04b4c=0xce;}_0x1b470d[_0x3cbd('0x16')](_0xe04b4c);return _0x1b470d[_0x3cbd('0x1c')](_0x3cbd('0x1d'),_0x54121c+'-'+_0x2c3e9d+'/'+_0x51251a)[_0x3cbd('0x17')](_0xd9e513);}return null;};}function patchUpdates(_0x2babe6){return function(_0x31807e){try{jsonpatch[_0x3cbd('0x1e')](_0x31807e,_0x2babe6,!![]);}catch(_0x424e54){return BPromise[_0x3cbd('0x1f')](_0x424e54);}return _0x31807e[_0x3cbd('0x20')]();};}function saveUpdates(_0x225a0b,_0x1df585){return function(_0x70878e){if(_0x70878e){return _0x70878e[_0x3cbd('0x21')](_0x225a0b)['then'](function(_0x3a1a54){return _0x3a1a54;});}return null;};}function removeEntity(_0x14b8f5,_0x1540cf){return function(_0x15e7d1){if(_0x15e7d1){return _0x15e7d1[_0x3cbd('0x22')]()[_0x3cbd('0x23')](function(){_0x14b8f5[_0x3cbd('0x16')](0xcc)[_0x3cbd('0x24')]();});}};}function handleEntityNotFound(_0x1299fd,_0x1bc1fe){return function(_0x49cce7){if(!_0x49cce7){_0x1299fd[_0x3cbd('0x15')](0x194);}return _0x49cce7;};}function handleError(_0x571377,_0x426367){_0x426367=_0x426367||0x1f4;return function(_0x38d9da){logger[_0x3cbd('0x25')](_0x38d9da[_0x3cbd('0x26')]);if(_0x38d9da['name']){delete _0x38d9da[_0x3cbd('0x27')];}_0x571377[_0x3cbd('0x16')](_0x426367)[_0x3cbd('0x28')](_0x38d9da);};}exports['index']=function(_0x2bdb1c,_0x502840){var _0x566174={},_0x46f581={},_0x139866={'count':0x0,'rows':[]};var _0x48ebd5=_[_0x3cbd('0x29')](db[_0x3cbd('0x2a')][_0x3cbd('0x2b')],function(_0x308e8c){return{'name':_0x308e8c['fieldName'],'type':_0x308e8c[_0x3cbd('0x2c')][_0x3cbd('0x2d')]};});_0x46f581[_0x3cbd('0x2e')]=_[_0x3cbd('0x29')](_0x48ebd5,_0x3cbd('0x27'));_0x46f581[_0x3cbd('0x2f')]=_[_0x3cbd('0x30')](_0x2bdb1c['query']);_0x46f581[_0x3cbd('0x31')]=_[_0x3cbd('0x32')](_0x46f581[_0x3cbd('0x2e')],_0x46f581[_0x3cbd('0x2f')]);_0x566174[_0x3cbd('0x33')]=_['intersection'](_0x46f581[_0x3cbd('0x2e')],qs['fields'](_0x2bdb1c['query'][_0x3cbd('0x34')]));_0x566174[_0x3cbd('0x33')]=_0x566174['attributes'][_0x3cbd('0x35')]?_0x566174[_0x3cbd('0x33')]:_0x46f581[_0x3cbd('0x2e')];if(!_0x2bdb1c[_0x3cbd('0x2f')][_0x3cbd('0x36')](_0x3cbd('0x37'))){_0x566174[_0x3cbd('0x1b')]=qs[_0x3cbd('0x1b')](_0x2bdb1c['query'][_0x3cbd('0x1b')]);_0x566174['offset']=qs[_0x3cbd('0x18')](_0x2bdb1c[_0x3cbd('0x2f')]['offset']);}_0x566174[_0x3cbd('0x38')]=qs['sort'](_0x2bdb1c[_0x3cbd('0x2f')]['sort']);_0x566174[_0x3cbd('0x39')]=qs[_0x3cbd('0x31')](_['pick'](_0x2bdb1c[_0x3cbd('0x2f')],_0x46f581[_0x3cbd('0x31')]),_0x48ebd5);if(_0x2bdb1c[_0x3cbd('0x2f')][_0x3cbd('0x3a')]){_0x566174[_0x3cbd('0x39')]=_[_0x3cbd('0x3b')](_0x566174[_0x3cbd('0x39')],{'$or':_[_0x3cbd('0x29')](_0x48ebd5,function(_0x198254){if(_0x198254[_0x3cbd('0x2c')]!==_0x3cbd('0x3c')){var _0x44924d={};_0x44924d[_0x198254[_0x3cbd('0x27')]]={'$like':'%'+_0x2bdb1c[_0x3cbd('0x2f')][_0x3cbd('0x3a')]+'%'};return _0x44924d;}})});}_0x566174=_[_0x3cbd('0x3b')]({},_0x566174,_0x2bdb1c[_0x3cbd('0x3d')]);var _0x26d00d={'where':_0x566174[_0x3cbd('0x39')]};return db[_0x3cbd('0x2a')][_0x3cbd('0x1a')](_0x26d00d)[_0x3cbd('0x23')](function(_0x1923ff){_0x139866[_0x3cbd('0x1a')]=_0x1923ff;if(_0x2bdb1c[_0x3cbd('0x2f')][_0x3cbd('0x3e')]){_0x566174[_0x3cbd('0x3f')]=[{'all':!![]}];}return db[_0x3cbd('0x2a')][_0x3cbd('0x40')](_0x566174);})[_0x3cbd('0x23')](function(_0x3ecdae){_0x139866[_0x3cbd('0x41')]=_0x3ecdae;return _0x139866;})[_0x3cbd('0x23')](respondWithFilteredResult(_0x502840,_0x566174))[_0x3cbd('0x42')](handleError(_0x502840,null));};exports[_0x3cbd('0x43')]=function(_0x5a928d,_0x4c3aee){var _0x5a2ad1={'raw':!![],'where':{'id':_0x5a928d['params']['id']}},_0x52204c={};_0x52204c[_0x3cbd('0x2e')]=_[_0x3cbd('0x30')](db[_0x3cbd('0x2a')][_0x3cbd('0x2b')]);_0x52204c[_0x3cbd('0x2f')]=_[_0x3cbd('0x30')](_0x5a928d[_0x3cbd('0x2f')]);_0x52204c[_0x3cbd('0x31')]=_[_0x3cbd('0x32')](_0x52204c[_0x3cbd('0x2e')],_0x52204c['query']);_0x5a2ad1['attributes']=_[_0x3cbd('0x32')](_0x52204c['model'],qs[_0x3cbd('0x34')](_0x5a928d['query']['fields']));_0x5a2ad1['attributes']=_0x5a2ad1[_0x3cbd('0x33')][_0x3cbd('0x35')]?_0x5a2ad1[_0x3cbd('0x33')]:_0x52204c['model'];if(_0x5a928d['query']['includeAll']){_0x5a2ad1['include']=[{'all':!![]}];}_0x5a2ad1=_['merge']({},_0x5a2ad1,_0x5a928d['options']);return db[_0x3cbd('0x2a')]['find'](_0x5a2ad1)['then'](handleEntityNotFound(_0x4c3aee,null))[_0x3cbd('0x23')](respondWithResult(_0x4c3aee,null))[_0x3cbd('0x42')](handleError(_0x4c3aee,null));};exports[_0x3cbd('0x44')]=function(_0x5151c4,_0x37d5f3){return db[_0x3cbd('0x2a')]['create'](_0x5151c4[_0x3cbd('0x45')],{})[_0x3cbd('0x23')](respondWithResult(_0x37d5f3,0xc9))[_0x3cbd('0x42')](handleError(_0x37d5f3,null));};exports[_0x3cbd('0x21')]=function(_0x4b6465,_0x432ff7){if(_0x4b6465[_0x3cbd('0x45')]['id']){delete _0x4b6465[_0x3cbd('0x45')]['id'];}return db[_0x3cbd('0x2a')]['find']({'where':{'id':_0x4b6465['params']['id']}})[_0x3cbd('0x23')](handleEntityNotFound(_0x432ff7,null))[_0x3cbd('0x23')](saveUpdates(_0x4b6465[_0x3cbd('0x45')],null))[_0x3cbd('0x23')](respondWithResult(_0x432ff7,null))['catch'](handleError(_0x432ff7,null));};exports[_0x3cbd('0x22')]=function(_0x1f3a4c,_0x473a41){return db['Dynamics365Field']['find']({'where':{'id':_0x1f3a4c['params']['id']}})[_0x3cbd('0x23')](handleEntityNotFound(_0x473a41,null))[_0x3cbd('0x23')](removeEntity(_0x473a41,null))[_0x3cbd('0x42')](handleError(_0x473a41,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 9b5ac0a..4709b4f 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 _0x2f10=['./intDynamics365Field.attributes','define','Dynamics365Field','int_dynamics365_fields','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1b5f00,_0x29f4f0){var _0x388e51=function(_0x412423){while(--_0x412423){_0x1b5f00['push'](_0x1b5f00['shift']());}};_0x388e51(++_0x29f4f0);}(_0x2f10,0x75));var _0x02f1=function(_0x42f13d,_0x3491bf){_0x42f13d=_0x42f13d-0x0;var _0xcfc728=_0x2f10[_0x42f13d];return _0xcfc728;};'use strict';var _=require(_0x02f1('0x0'));var util=require(_0x02f1('0x1'));var logger=require(_0x02f1('0x2'))(_0x02f1('0x3'));var moment=require(_0x02f1('0x4'));var BPromise=require(_0x02f1('0x5'));var rp=require(_0x02f1('0x6'));var fs=require('fs');var path=require(_0x02f1('0x7'));var rimraf=require('rimraf');var config=require(_0x02f1('0x8'));var attributes=require(_0x02f1('0x9'));module['exports']=function(_0x565260,_0x4a6751){return _0x565260[_0x02f1('0xa')](_0x02f1('0xb'),attributes,{'tableName':_0x02f1('0xc'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x02f1('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2c9d=['moment','bluebird','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0xe1487c,_0x129687){var _0x24f5b3=function(_0x3ebc4f){while(--_0x3ebc4f){_0xe1487c['push'](_0xe1487c['shift']());}};_0x24f5b3(++_0x129687);}(_0x2c9d,0x74));var _0xd2c9=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x2c9d[_0x53cf8e];return _0x459197;};'use strict';var _=require(_0xd2c9('0x0'));var util=require(_0xd2c9('0x1'));var logger=require(_0xd2c9('0x2'))(_0xd2c9('0x3'));var moment=require(_0xd2c9('0x4'));var BPromise=require(_0xd2c9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd2c9('0x6'));var rimraf=require(_0xd2c9('0x7'));var config=require(_0xd2c9('0x8'));var attributes=require(_0xd2c9('0x9'));module[_0xd2c9('0xa')]=function(_0x85c974,_0x59be11){return _0x85c974['define'](_0xd2c9('0xb'),attributes,{'tableName':_0xd2c9('0xc'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0xd2c9('0xd'),_0xd2c9('0xe')],'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 15e3eb5..da8f1d5 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 _0x9d50=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch'];(function(_0x410f37,_0x942067){var _0x28df57=function(_0x376a10){while(--_0x376a10){_0x410f37['push'](_0x410f37['shift']());}};_0x28df57(++_0x942067);}(_0x9d50,0x1e4));var _0x09d5=function(_0x3d7106,_0x476083){_0x3d7106=_0x3d7106-0x0;var _0x3c99e7=_0x9d50[_0x3d7106];return _0x3c99e7;};'use strict';var _=require(_0x09d5('0x0'));var util=require(_0x09d5('0x1'));var moment=require(_0x09d5('0x2'));var BPromise=require(_0x09d5('0x3'));var rs=require(_0x09d5('0x4'));var fs=require('fs');var Redis=require(_0x09d5('0x5'));var db=require(_0x09d5('0x6'))['db'];var utils=require(_0x09d5('0x7'));var logger=require(_0x09d5('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x09d5('0x9'));var client=jayson['client'][_0x09d5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d1fa1,_0x4094db,_0x34ff55){return new BPromise(function(_0x4c36ea,_0x320f0f){return client[_0x09d5('0xb')](_0x5d1fa1,_0x34ff55)[_0x09d5('0xc')](function(_0x130aa7){logger[_0x09d5('0xd')](_0x09d5('0xe'),_0x4094db,_0x09d5('0xf'));logger[_0x09d5('0x10')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x4094db,_0x09d5('0xf'),JSON['stringify'](_0x130aa7));if(_0x130aa7['error']){if(_0x130aa7[_0x09d5('0x11')][_0x09d5('0x12')]===0x1f4){logger[_0x09d5('0x11')](_0x09d5('0xe'),_0x4094db,_0x130aa7['error'][_0x09d5('0x13')]);return _0x320f0f(_0x130aa7['error'][_0x09d5('0x13')]);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x4094db,_0x130aa7['error'][_0x09d5('0x13')]);return _0x4c36ea(_0x130aa7[_0x09d5('0x11')][_0x09d5('0x13')]);}else{logger[_0x09d5('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x4094db,_0x09d5('0xf'));_0x4c36ea(_0x130aa7[_0x09d5('0x14')][_0x09d5('0x13')]);}})[_0x09d5('0x15')](function(_0xcb3c8){logger['error'](_0x09d5('0xe'),_0x4094db,_0xcb3c8);_0x320f0f(_0xcb3c8);});});} \ No newline at end of file +var _0x6c0b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dynamics365Field,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring'];(function(_0x282696,_0x35cd20){var _0xaa74d8=function(_0x1a7352){while(--_0x1a7352){_0x282696['push'](_0x282696['shift']());}};_0xaa74d8(++_0x35cd20);}(_0x6c0b,0x19e));var _0xb6c0=function(_0x33bc64,_0x4d1e92){_0x33bc64=_0x33bc64-0x0;var _0x3fdd34=_0x6c0b[_0x33bc64];return _0x3fdd34;};'use strict';var _=require(_0xb6c0('0x0'));var util=require(_0xb6c0('0x1'));var moment=require('moment');var BPromise=require(_0xb6c0('0x2'));var rs=require(_0xb6c0('0x3'));var fs=require('fs');var Redis=require(_0xb6c0('0x4'));var db=require(_0xb6c0('0x5'))['db'];var utils=require(_0xb6c0('0x6'));var logger=require(_0xb6c0('0x7'))(_0xb6c0('0x8'));var config=require('../../config/environment');var jayson=require(_0xb6c0('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3d78a2,_0x344f0e,_0x571ba4){return new BPromise(function(_0x2e05b9,_0x17d55e){return client[_0xb6c0('0xa')](_0x3d78a2,_0x571ba4)[_0xb6c0('0xb')](function(_0x118a4b){logger[_0xb6c0('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x344f0e,_0xb6c0('0xd'));logger[_0xb6c0('0xe')](_0xb6c0('0xf'),_0x344f0e,_0xb6c0('0xd'),JSON[_0xb6c0('0x10')](_0x118a4b));if(_0x118a4b[_0xb6c0('0x11')]){if(_0x118a4b[_0xb6c0('0x11')][_0xb6c0('0x12')]===0x1f4){logger[_0xb6c0('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x344f0e,_0x118a4b[_0xb6c0('0x11')]['message']);return _0x17d55e(_0x118a4b[_0xb6c0('0x11')][_0xb6c0('0x13')]);}logger[_0xb6c0('0x11')](_0xb6c0('0x14'),_0x344f0e,_0x118a4b['error']['message']);return _0x2e05b9(_0x118a4b['error']['message']);}else{logger[_0xb6c0('0xc')](_0xb6c0('0x14'),_0x344f0e,'request\x20sent');_0x2e05b9(_0x118a4b['result'][_0xb6c0('0x13')]);}})[_0xb6c0('0x15')](function(_0x423f3e){logger[_0xb6c0('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x344f0e,_0x423f3e);_0x17d55e(_0x423f3e);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 7855f3c..64499db 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 _0x7a98=['getFields','create','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x34217f,_0x4954d9){var _0x533721=function(_0x5ea689){while(--_0x5ea689){_0x34217f['push'](_0x34217f['shift']());}};_0x533721(++_0x4954d9);}(_0x7a98,0x135));var _0x87a9=function(_0x971d66,_0xb27281){_0x971d66=_0x971d66-0x0;var _0x33882e=_0x7a98[_0x971d66];return _0x33882e;};'use strict';var multer=require(_0x87a9('0x0'));var util=require(_0x87a9('0x1'));var path=require(_0x87a9('0x2'));var timeout=require(_0x87a9('0x3'));var express=require(_0x87a9('0x4'));var router=express[_0x87a9('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x87a9('0x6'));var config=require(_0x87a9('0x7'));var controller=require('./intFreshdeskAccount.controller');router[_0x87a9('0x8')]('/',auth['isAuthenticated'](),controller[_0x87a9('0x9')]);router['get'](_0x87a9('0xa'),auth[_0x87a9('0xb')](),controller[_0x87a9('0xc')]);router[_0x87a9('0x8')](_0x87a9('0xd'),auth[_0x87a9('0xb')](),controller[_0x87a9('0xe')]);router[_0x87a9('0x8')](_0x87a9('0xf'),auth[_0x87a9('0xb')](),controller[_0x87a9('0x10')]);router['post']('/',auth[_0x87a9('0xb')](),controller[_0x87a9('0x11')]);router[_0x87a9('0x12')]('/:id/configurations',auth[_0x87a9('0xb')](),controller[_0x87a9('0x13')]);router[_0x87a9('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x87a9('0x15')]);router[_0x87a9('0x16')](_0x87a9('0xa'),auth[_0x87a9('0xb')](),controller[_0x87a9('0x17')]);module[_0x87a9('0x18')]=router; \ No newline at end of file +var _0x19d0=['../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','index','/:id','isAuthenticated','show','getConfigurations','getFields','create','post','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0xa8d025,_0x3a5cbe){var _0x29e44e=function(_0x57a178){while(--_0x57a178){_0xa8d025['push'](_0xa8d025['shift']());}};_0x29e44e(++_0x3a5cbe);}(_0x19d0,0x16b));var _0x019d=function(_0x1ff842,_0x4d30f2){_0x1ff842=_0x1ff842-0x0;var _0x20cae3=_0x19d0[_0x1ff842];return _0x20cae3;};'use strict';var multer=require(_0x019d('0x0'));var util=require(_0x019d('0x1'));var path=require(_0x019d('0x2'));var timeout=require(_0x019d('0x3'));var express=require('express');var router=express[_0x019d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x019d('0x5'));var interaction=require(_0x019d('0x6'));var config=require('../../config/environment');var controller=require(_0x019d('0x7'));router[_0x019d('0x8')]('/',auth['isAuthenticated'](),controller[_0x019d('0x9')]);router[_0x019d('0x8')](_0x019d('0xa'),auth[_0x019d('0xb')](),controller[_0x019d('0xc')]);router[_0x019d('0x8')]('/:id/configurations',auth[_0x019d('0xb')](),controller[_0x019d('0xd')]);router['get']('/:id/fields',auth[_0x019d('0xb')](),controller[_0x019d('0xe')]);router['post']('/',auth[_0x019d('0xb')](),controller[_0x019d('0xf')]);router[_0x019d('0x10')](_0x019d('0x11'),auth[_0x019d('0xb')](),controller[_0x019d('0x12')]);router[_0x019d('0x13')](_0x019d('0xa'),auth[_0x019d('0xb')](),controller['update']);router[_0x019d('0x14')]('/:id',auth[_0x019d('0xb')](),controller[_0x019d('0x15')]);module[_0x019d('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index e6c2228..bc9c9f4 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 _0xed3c=['STRING','username','sequelize','exports'];(function(_0x3d38a6,_0xa7bd3c){var _0x34ad7f=function(_0xe474fc){while(--_0xe474fc){_0x3d38a6['push'](_0x3d38a6['shift']());}};_0x34ad7f(++_0xa7bd3c);}(_0xed3c,0x1a6));var _0xced3=function(_0x122cc1,_0x5c956e){_0x122cc1=_0x122cc1-0x0;var _0x1e33af=_0xed3c[_0x122cc1];return _0x1e33af;};'use strict';var Sequelize=require(_0xced3('0x0'));module[_0xced3('0x1')]={'name':{'type':Sequelize[_0xced3('0x2')]},'description':{'type':Sequelize[_0xced3('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xced3('0x3')},'apiKey':{'type':Sequelize[_0xced3('0x2')]},'remoteUri':{'type':Sequelize[_0xced3('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xb78e=['username','remoteUri','sequelize','exports','STRING'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0xb78e,0x1c9));var _0xeb78=function(_0x58b9a7,_0x1920c9){_0x58b9a7=_0x58b9a7-0x0;var _0x21bd75=_0xb78e[_0x58b9a7];return _0x21bd75;};'use strict';var Sequelize=require(_0xeb78('0x0'));module[_0xeb78('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xeb78('0x2')]},'username':{'type':Sequelize[_0xeb78('0x2')],'unique':_0xeb78('0x3')},'apiKey':{'type':Sequelize[_0xeb78('0x2')]},'remoteUri':{'type':Sequelize[_0xeb78('0x2')],'unique':_0xeb78('0x4')},'serverUrl':{'type':Sequelize[_0xeb78('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 0f57838..6829b2c 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 _0x43c8=['hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','getConfigurations','FreshdeskConfiguration','length','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','substring','GET','%s/%s','api/v2/ticket_fields','%s:X','toString','requester','subject','description','priority','group','ticket_type','remove','includes','custom_text','custom_dropdown','label','default','choices','capitalize','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','destroy','then','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x180464,_0x5a01ec){var _0x2715ea=function(_0x460267){while(--_0x460267){_0x180464['push'](_0x180464['shift']());}};_0x2715ea(++_0x5a01ec);}(_0x43c8,0xaf));var _0x843c=function(_0x29c975,_0x5c6fb1){_0x29c975=_0x29c975-0x0;var _0x1221f3=_0x43c8[_0x29c975];return _0x1221f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x843c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x843c('0x1'));var rp=require(_0x843c('0x2'));var moment=require(_0x843c('0x3'));var BPromise=require(_0x843c('0x4'));var Mustache=require(_0x843c('0x5'));var util=require(_0x843c('0x6'));var path=require(_0x843c('0x7'));var sox=require('sox');var csv=require(_0x843c('0x8'));var ejs=require(_0x843c('0x9'));var fs=require('fs');var fs_extra=require(_0x843c('0xa'));var _=require(_0x843c('0xb'));var squel=require(_0x843c('0xc'));var crypto=require('crypto');var jsforce=require(_0x843c('0xd'));var deskjs=require(_0x843c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x843c('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x843c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x843c('0x11'));var hardwareService=require(_0x843c('0x12'));var logger=require(_0x843c('0x13'))(_0x843c('0x14'));var utils=require('../../config/utils');var config=require(_0x843c('0x15'));var licenseUtil=require(_0x843c('0x16'));var db=require(_0x843c('0x17'))['db'];var integrations=require(_0x843c('0x18'));function respondWithStatusCode(_0x231ce1,_0x34e297){_0x34e297=_0x34e297||0xcc;return function(_0x33ff2c){if(_0x33ff2c){return _0x231ce1[_0x843c('0x19')](_0x34e297);}return _0x231ce1[_0x843c('0x1a')](_0x34e297)[_0x843c('0x1b')]();};}function respondWithResult(_0x313947,_0x36e07f){_0x36e07f=_0x36e07f||0xc8;return function(_0x2ad766){if(_0x2ad766){return _0x313947[_0x843c('0x1a')](_0x36e07f)[_0x843c('0x1c')](_0x2ad766);}};}function respondWithFilteredResult(_0x5577ff,_0x3dc50d){return function(_0x2c013c){if(_0x2c013c){var _0x1d92cf=typeof _0x3dc50d[_0x843c('0x1d')]===_0x843c('0x1e')&&typeof _0x3dc50d['limit']===_0x843c('0x1e');var _0x807f83=_0x2c013c[_0x843c('0x1f')];var _0x2acf94=_0x1d92cf?0x0:_0x3dc50d['offset'];var _0xf53b50=_0x1d92cf?_0x2c013c[_0x843c('0x1f')]:_0x3dc50d[_0x843c('0x1d')]+_0x3dc50d[_0x843c('0x20')];var _0x1db871;if(_0xf53b50>=_0x807f83){_0xf53b50=_0x807f83;_0x1db871=0xc8;}else{_0x1db871=0xce;}_0x5577ff['status'](_0x1db871);return _0x5577ff[_0x843c('0x21')]('Content-Range',_0x2acf94+'-'+_0xf53b50+'/'+_0x807f83)[_0x843c('0x1c')](_0x2c013c);}return null;};}function patchUpdates(_0x5eb8ca){return function(_0x3422a3){try{jsonpatch[_0x843c('0x22')](_0x3422a3,_0x5eb8ca,!![]);}catch(_0x526946){return BPromise[_0x843c('0x23')](_0x526946);}return _0x3422a3[_0x843c('0x24')]();};}function saveUpdates(_0x2d1d43,_0x15513d){return function(_0x495927){if(_0x495927){return _0x495927['update'](_0x2d1d43)['then'](function(_0x3f914b){return _0x3f914b;});}return null;};}function removeEntity(_0x17e6ab,_0x2d90f9){return function(_0x408bf1){if(_0x408bf1){return _0x408bf1[_0x843c('0x25')]()[_0x843c('0x26')](function(){_0x17e6ab[_0x843c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4584be,_0x2a8c56){return function(_0x1a6a52){if(!_0x1a6a52){_0x4584be['sendStatus'](0x194);}return _0x1a6a52;};}function handleError(_0x2a34d2,_0x5caa13){_0x5caa13=_0x5caa13||0x1f4;return function(_0x15863a){logger[_0x843c('0x27')](_0x15863a[_0x843c('0x28')]);if(_0x15863a['name']){delete _0x15863a[_0x843c('0x29')];}_0x2a34d2[_0x843c('0x1a')](_0x5caa13)[_0x843c('0x2a')](_0x15863a);};}exports[_0x843c('0x2b')]=function(_0x8473bb,_0xb8b544){var _0x4e2a13={},_0xff406d={},_0x4d23bd={'count':0x0,'rows':[]};var _0x3855fb=_[_0x843c('0x2c')](db[_0x843c('0x2d')][_0x843c('0x2e')],function(_0x51aebb){return{'name':_0x51aebb[_0x843c('0x2f')],'type':_0x51aebb[_0x843c('0x30')][_0x843c('0x31')]};});_0xff406d[_0x843c('0x32')]=_[_0x843c('0x2c')](_0x3855fb,_0x843c('0x29'));_0xff406d[_0x843c('0x33')]=_[_0x843c('0x34')](_0x8473bb[_0x843c('0x33')]);_0xff406d[_0x843c('0x35')]=_[_0x843c('0x36')](_0xff406d[_0x843c('0x32')],_0xff406d['query']);_0x4e2a13[_0x843c('0x37')]=_['intersection'](_0xff406d[_0x843c('0x32')],qs[_0x843c('0x38')](_0x8473bb['query'][_0x843c('0x38')]));_0x4e2a13[_0x843c('0x37')]=_0x4e2a13[_0x843c('0x37')]['length']?_0x4e2a13[_0x843c('0x37')]:_0xff406d[_0x843c('0x32')];if(!_0x8473bb['query'][_0x843c('0x39')]('nolimit')){_0x4e2a13[_0x843c('0x20')]=qs[_0x843c('0x20')](_0x8473bb[_0x843c('0x33')]['limit']);_0x4e2a13[_0x843c('0x1d')]=qs[_0x843c('0x1d')](_0x8473bb[_0x843c('0x33')][_0x843c('0x1d')]);}_0x4e2a13[_0x843c('0x3a')]=qs['sort'](_0x8473bb[_0x843c('0x33')][_0x843c('0x3b')]);_0x4e2a13[_0x843c('0x3c')]=qs[_0x843c('0x35')](_[_0x843c('0x3d')](_0x8473bb[_0x843c('0x33')],_0xff406d['filters']),_0x3855fb);if(_0x8473bb[_0x843c('0x33')][_0x843c('0x3e')]){_0x4e2a13[_0x843c('0x3c')]=_[_0x843c('0x3f')](_0x4e2a13[_0x843c('0x3c')],{'$or':_[_0x843c('0x2c')](_0x3855fb,function(_0x2f36f7){if(_0x2f36f7['type']!=='VIRTUAL'){var _0xab253={};_0xab253[_0x2f36f7[_0x843c('0x29')]]={'$like':'%'+_0x8473bb[_0x843c('0x33')]['filter']+'%'};return _0xab253;}})});}_0x4e2a13=_[_0x843c('0x3f')]({},_0x4e2a13,_0x8473bb[_0x843c('0x40')]);var _0x1b29f7={'where':_0x4e2a13[_0x843c('0x3c')]};return db[_0x843c('0x2d')]['count'](_0x1b29f7)[_0x843c('0x26')](function(_0x1204ac){_0x4d23bd[_0x843c('0x1f')]=_0x1204ac;if(_0x8473bb[_0x843c('0x33')][_0x843c('0x41')]){_0x4e2a13[_0x843c('0x42')]=[{'all':!![]}];}return db[_0x843c('0x2d')][_0x843c('0x43')](_0x4e2a13);})[_0x843c('0x26')](function(_0x1c3600){_0x4d23bd[_0x843c('0x44')]=_0x1c3600;return _0x4d23bd;})[_0x843c('0x26')](respondWithFilteredResult(_0xb8b544,_0x4e2a13))[_0x843c('0x45')](handleError(_0xb8b544,null));};exports[_0x843c('0x46')]=function(_0x33243a,_0x4c8115){var _0x49de5c={'raw':![],'where':{'id':_0x33243a[_0x843c('0x47')]['id']}},_0x4c25a6={};_0x4c25a6['model']=_[_0x843c('0x34')](db[_0x843c('0x2d')]['rawAttributes']);_0x4c25a6[_0x843c('0x33')]=_['keys'](_0x33243a['query']);_0x4c25a6['filters']=_[_0x843c('0x36')](_0x4c25a6['model'],_0x4c25a6[_0x843c('0x33')]);_0x49de5c[_0x843c('0x37')]=_['intersection'](_0x4c25a6['model'],qs[_0x843c('0x38')](_0x33243a[_0x843c('0x33')][_0x843c('0x38')]));_0x49de5c[_0x843c('0x37')]=_0x49de5c[_0x843c('0x37')]['length']?_0x49de5c[_0x843c('0x37')]:_0x4c25a6['model'];if(_0x33243a[_0x843c('0x33')][_0x843c('0x41')]){_0x49de5c[_0x843c('0x42')]=[{'all':!![]}];}_0x49de5c=_[_0x843c('0x3f')]({},_0x49de5c,_0x33243a[_0x843c('0x40')]);return db[_0x843c('0x2d')][_0x843c('0x48')](_0x49de5c)[_0x843c('0x26')](handleEntityNotFound(_0x4c8115,null))[_0x843c('0x26')](respondWithResult(_0x4c8115,null))[_0x843c('0x45')](handleError(_0x4c8115,null));};exports[_0x843c('0x49')]=function(_0x41f9fa,_0x306394){return db[_0x843c('0x2d')][_0x843c('0x49')](_0x41f9fa[_0x843c('0x4a')],{})[_0x843c('0x26')](respondWithResult(_0x306394,0xc9))['catch'](handleError(_0x306394,null));};exports[_0x843c('0x4b')]=function(_0x189a9e,_0x11bb2d){if(_0x189a9e[_0x843c('0x4a')]['id']){delete _0x189a9e[_0x843c('0x4a')]['id'];}return db['FreshdeskAccount'][_0x843c('0x48')]({'where':{'id':_0x189a9e['params']['id']}})[_0x843c('0x26')](handleEntityNotFound(_0x11bb2d,null))['then'](saveUpdates(_0x189a9e[_0x843c('0x4a')],null))[_0x843c('0x26')](respondWithResult(_0x11bb2d,null))[_0x843c('0x45')](handleError(_0x11bb2d,null));};exports[_0x843c('0x25')]=function(_0x1603ea,_0x2236d1){return db[_0x843c('0x2d')][_0x843c('0x48')]({'where':{'id':_0x1603ea[_0x843c('0x47')]['id']}})[_0x843c('0x26')](handleEntityNotFound(_0x2236d1,null))['then'](removeEntity(_0x2236d1,null))[_0x843c('0x45')](handleError(_0x2236d1,null));};exports[_0x843c('0x4c')]=function(_0x1e6802,_0x28bbb7,_0x1628ae){var _0x1f7f5d={};var _0x3da0f7={};var _0x428884;var _0x29fe16;return db[_0x843c('0x2d')]['findOne']({'where':{'id':_0x1e6802[_0x843c('0x47')]['id']}})[_0x843c('0x26')](handleEntityNotFound(_0x28bbb7,null))[_0x843c('0x26')](function(_0x5b0e18){if(_0x5b0e18){_0x428884=_0x5b0e18;_0x3da0f7[_0x843c('0x32')]=_[_0x843c('0x34')](db[_0x843c('0x4d')][_0x843c('0x2e')]);_0x3da0f7[_0x843c('0x33')]=_[_0x843c('0x34')](_0x1e6802[_0x843c('0x33')]);_0x3da0f7[_0x843c('0x35')]=_['intersection'](_0x3da0f7['model'],_0x3da0f7[_0x843c('0x33')]);_0x1f7f5d[_0x843c('0x37')]=_[_0x843c('0x36')](_0x3da0f7['model'],qs[_0x843c('0x38')](_0x1e6802[_0x843c('0x33')][_0x843c('0x38')]));_0x1f7f5d[_0x843c('0x37')]=_0x1f7f5d[_0x843c('0x37')]['length']?_0x1f7f5d[_0x843c('0x37')]:_0x3da0f7['model'];_0x1f7f5d[_0x843c('0x3a')]=qs[_0x843c('0x3b')](_0x1e6802[_0x843c('0x33')][_0x843c('0x3b')]);_0x1f7f5d[_0x843c('0x3c')]=qs['filters'](_[_0x843c('0x3d')](_0x1e6802['query'],_0x3da0f7[_0x843c('0x35')]));if(_0x1e6802[_0x843c('0x33')]['filter']){_0x1f7f5d[_0x843c('0x3c')]=_[_0x843c('0x3f')](_0x1f7f5d[_0x843c('0x3c')],{'$or':_[_0x843c('0x2c')](_0x1f7f5d[_0x843c('0x37')],function(_0xcb8c8){var _0x1e4073={};_0x1e4073[_0xcb8c8]={'$like':'%'+_0x1e6802[_0x843c('0x33')][_0x843c('0x3e')]+'%'};return _0x1e4073;})});}_0x1f7f5d=_['merge']({},_0x1f7f5d,_0x1e6802[_0x843c('0x40')]);return _0x428884[_0x843c('0x4c')](_0x1f7f5d);}})['then'](function(_0x327032){if(_0x327032){_0x29fe16=_0x327032[_0x843c('0x4e')];if(!_0x1e6802['query'][_0x843c('0x39')](_0x843c('0x4f'))){_0x1f7f5d[_0x843c('0x20')]=qs['limit'](_0x1e6802['query'][_0x843c('0x20')]);_0x1f7f5d['offset']=qs[_0x843c('0x1d')](_0x1e6802[_0x843c('0x33')][_0x843c('0x1d')]);}return _0x428884[_0x843c('0x4c')](_0x1f7f5d);}})[_0x843c('0x26')](function(_0x31a4c5){if(_0x31a4c5){return _0x31a4c5?{'count':_0x29fe16,'rows':_0x31a4c5}:null;}})[_0x843c('0x26')](respondWithResult(_0x28bbb7,null))[_0x843c('0x45')](handleError(_0x28bbb7,null));};exports[_0x843c('0x50')]=function(_0x5e43bf,_0x1bd68f,_0x5e4880){if(_0x5e43bf[_0x843c('0x4a')]['id']){delete _0x5e43bf['body']['id'];}return db[_0x843c('0x2d')][_0x843c('0x51')]({'where':{'id':_0x5e43bf[_0x843c('0x47')]['id']}})[_0x843c('0x26')](handleEntityNotFound(_0x1bd68f,null))['then'](function(_0xbf1c81){if(_0xbf1c81){_0x5e43bf[_0x843c('0x4a')][_0x843c('0x52')]=_0xbf1c81['id'];_0x5e43bf['body'][_0x843c('0x53')]=integrations[_0x843c('0x54')](_0x5e43bf[_0x843c('0x4a')][_0x843c('0x55')],_0x5e43bf['body'][_0x843c('0x30')]);_0x5e43bf[_0x843c('0x4a')]['Descriptions']=integrations[_0x843c('0x56')](_0x5e43bf['body'][_0x843c('0x55')],_0x5e43bf[_0x843c('0x4a')][_0x843c('0x30')]);return db['FreshdeskConfiguration'][_0x843c('0x49')](_0x5e43bf['body'],{'include':[{'model':db[_0x843c('0x57')],'as':_0x843c('0x53')},{'model':db[_0x843c('0x57')],'as':_0x843c('0x58')}]});}return null;})[_0x843c('0x26')](respondWithResult(_0x1bd68f,null))[_0x843c('0x45')](handleError(_0x1bd68f,null));};exports[_0x843c('0x59')]=function(_0x3a8572,_0x42c84f,_0x6779d1){var _0xfc619a='';return db[_0x843c('0x2d')][_0x843c('0x51')]({'where':{'id':_0x3a8572[_0x843c('0x47')]['id']},'attributes':['id',_0x843c('0x5a'),_0x843c('0x5b')]})[_0x843c('0x26')](handleEntityNotFound(_0x42c84f,null))[_0x843c('0x26')](function(_0x10b90e){if(_0x10b90e){_0xfc619a=_0x10b90e[_0x843c('0x5a')];var _0x3add11=_0xfc619a[_0x843c('0x5c')](-0x1);if(_0x3add11==='/'){_0xfc619a=_0xfc619a[_0x843c('0x5d')](0x0,_0xfc619a['lastIndexOf'](_0x3add11));}return rp({'method':_0x843c('0x5e'),'uri':util['format'](_0x843c('0x5f'),_0xfc619a,_0x843c('0x60')),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0x843c('0x61'),_0x10b90e[_0x843c('0x5b')]))[_0x843c('0x62')]('base64'))},'json':!![]});}})[_0x843c('0x26')](function(_0x1e27b8){if(_0x1e27b8){var _0x55922=[_0x843c('0x63'),_0x843c('0x64'),'agent',_0x843c('0x65'),_0x843c('0x1a'),_0x843c('0x66'),_0x843c('0x67'),'source',_0x843c('0x68'),'group','company'];_[_0x843c('0x69')](_0x1e27b8,function(_0x124db5){return _0x55922[_0x843c('0x6a')](_0x124db5[_0x843c('0x29')])||!_0x124db5['default']&&_0x124db5['type']!==_0x843c('0x6b')&&_0x124db5[_0x843c('0x30')]!==_0x843c('0x6c');});return{'count':_0x1e27b8[_0x843c('0x4e')],'rows':_[_0x843c('0x2c')](_0x1e27b8,function(_0x17295a){return{'id':_0x17295a[_0x843c('0x29')],'name':_0x17295a[_0x843c('0x6d')],'custom':!_0x17295a[_0x843c('0x6e')],'options':_0x17295a[_0x843c('0x6f')]?_[_0x843c('0x2c')](_0x17295a[_0x843c('0x6f')],function(_0x3722a6){return{'name':_[_0x843c('0x70')](_0x3722a6),'value':_0x3722a6};}):[]};})};}})[_0x843c('0x26')](respondWithResult(_0x42c84f,null))[_0x843c('0x45')](function(_0x159b57){var _0x1c5177=_0x3a8572[_0x843c('0x33')]['test']?0x1f4:_0x159b57['statusCode']||0x1f4;logger[_0x843c('0x27')](_0x843c('0x71'),_0x843c('0x59'),_0x1c5177,JSON['stringify'](_0x159b57));delete _0x159b57['name'];if(_0x1c5177===0x191){_0x1c5177=0x190;}_0x42c84f['status'](_0x1c5177)[_0x843c('0x2a')](_0x3a8572[_0x843c('0x33')][_0x843c('0x72')]?{'message':_0x843c('0x73'),'statusCode':_0x159b57['statusCode']}:_0x159b57);});}; \ No newline at end of file +var _0x0f88=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','end','stack','name','send','index','map','FreshdeskAccount','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','then','findAll','rows','params','keys','rawAttributes','includeAll','include','find','catch','create','body','getConfigurations','order','pick','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','substring','GET','format','%s/%s','Basic\x20%s','toString','base64','requester','subject','agent','description','source','group','company','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x422517,_0x3bc3eb){var _0x33eda3=function(_0x2db516){while(--_0x2db516){_0x422517['push'](_0x422517['shift']());}};_0x33eda3(++_0x3bc3eb);}(_0x0f88,0x1d9));var _0x80f8=function(_0x38d887,_0x261d68){_0x38d887=_0x38d887-0x0;var _0x84c717=_0x0f88[_0x38d887];return _0x84c717;};'use strict';var emlformat=require(_0x80f8('0x0'));var rimraf=require(_0x80f8('0x1'));var zipdir=require(_0x80f8('0x2'));var jsonpatch=require(_0x80f8('0x3'));var rp=require(_0x80f8('0x4'));var moment=require(_0x80f8('0x5'));var BPromise=require(_0x80f8('0x6'));var Mustache=require(_0x80f8('0x7'));var util=require('util');var path=require(_0x80f8('0x8'));var sox=require('sox');var csv=require(_0x80f8('0x9'));var ejs=require(_0x80f8('0xa'));var fs=require('fs');var fs_extra=require(_0x80f8('0xb'));var _=require(_0x80f8('0xc'));var squel=require(_0x80f8('0xd'));var crypto=require(_0x80f8('0xe'));var jsforce=require(_0x80f8('0xf'));var deskjs=require(_0x80f8('0x10'));var toCsv=require(_0x80f8('0x9'));var querystring=require(_0x80f8('0x11'));var Papa=require(_0x80f8('0x12'));var Redis=require(_0x80f8('0x13'));var authService=require(_0x80f8('0x14'));var qs=require(_0x80f8('0x15'));var as=require(_0x80f8('0x16'));var hardwareService=require(_0x80f8('0x17'));var logger=require(_0x80f8('0x18'))(_0x80f8('0x19'));var utils=require(_0x80f8('0x1a'));var config=require(_0x80f8('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x80f8('0x1c'))['db'];var integrations=require(_0x80f8('0x1d'));function respondWithStatusCode(_0x35538b,_0x5e6020){_0x5e6020=_0x5e6020||0xcc;return function(_0x280db2){if(_0x280db2){return _0x35538b[_0x80f8('0x1e')](_0x5e6020);}return _0x35538b[_0x80f8('0x1f')](_0x5e6020)['end']();};}function respondWithResult(_0x4887d3,_0x4f8755){_0x4f8755=_0x4f8755||0xc8;return function(_0x5e29bf){if(_0x5e29bf){return _0x4887d3[_0x80f8('0x1f')](_0x4f8755)['json'](_0x5e29bf);}};}function respondWithFilteredResult(_0x2c9b94,_0x25c36b){return function(_0x381355){if(_0x381355){var _0x3817be=typeof _0x25c36b[_0x80f8('0x20')]===_0x80f8('0x21')&&typeof _0x25c36b[_0x80f8('0x22')]===_0x80f8('0x21');var _0x375f42=_0x381355[_0x80f8('0x23')];var _0x581196=_0x3817be?0x0:_0x25c36b[_0x80f8('0x20')];var _0x981e13=_0x3817be?_0x381355[_0x80f8('0x23')]:_0x25c36b[_0x80f8('0x20')]+_0x25c36b[_0x80f8('0x22')];var _0x538e77;if(_0x981e13>=_0x375f42){_0x981e13=_0x375f42;_0x538e77=0xc8;}else{_0x538e77=0xce;}_0x2c9b94[_0x80f8('0x1f')](_0x538e77);return _0x2c9b94[_0x80f8('0x24')]('Content-Range',_0x581196+'-'+_0x981e13+'/'+_0x375f42)[_0x80f8('0x25')](_0x381355);}return null;};}function patchUpdates(_0x3d23b5){return function(_0x50d3b9){try{jsonpatch[_0x80f8('0x26')](_0x50d3b9,_0x3d23b5,!![]);}catch(_0x29c71c){return BPromise[_0x80f8('0x27')](_0x29c71c);}return _0x50d3b9[_0x80f8('0x28')]();};}function saveUpdates(_0x214dc7,_0x1a4988){return function(_0x168009){if(_0x168009){return _0x168009[_0x80f8('0x29')](_0x214dc7)['then'](function(_0x26c62a){return _0x26c62a;});}return null;};}function removeEntity(_0x530350,_0x192ae5){return function(_0x5336ad){if(_0x5336ad){return _0x5336ad[_0x80f8('0x2a')]()['then'](function(){_0x530350[_0x80f8('0x1f')](0xcc)[_0x80f8('0x2b')]();});}};}function handleEntityNotFound(_0x5e3f76,_0x57fad1){return function(_0x53be8e){if(!_0x53be8e){_0x5e3f76[_0x80f8('0x1e')](0x194);}return _0x53be8e;};}function handleError(_0x3032bb,_0x4ae1a6){_0x4ae1a6=_0x4ae1a6||0x1f4;return function(_0x40ed3e){logger['error'](_0x40ed3e[_0x80f8('0x2c')]);if(_0x40ed3e['name']){delete _0x40ed3e[_0x80f8('0x2d')];}_0x3032bb['status'](_0x4ae1a6)[_0x80f8('0x2e')](_0x40ed3e);};}exports[_0x80f8('0x2f')]=function(_0x109ea3,_0x46d379){var _0x42e871={},_0x14fcce={},_0x436d24={'count':0x0,'rows':[]};var _0x1bd039=_[_0x80f8('0x30')](db[_0x80f8('0x31')]['rawAttributes'],function(_0x545f3c){return{'name':_0x545f3c[_0x80f8('0x32')],'type':_0x545f3c[_0x80f8('0x33')][_0x80f8('0x34')]};});_0x14fcce[_0x80f8('0x35')]=_['map'](_0x1bd039,_0x80f8('0x2d'));_0x14fcce[_0x80f8('0x36')]=_['keys'](_0x109ea3[_0x80f8('0x36')]);_0x14fcce['filters']=_[_0x80f8('0x37')](_0x14fcce['model'],_0x14fcce[_0x80f8('0x36')]);_0x42e871[_0x80f8('0x38')]=_['intersection'](_0x14fcce['model'],qs[_0x80f8('0x39')](_0x109ea3[_0x80f8('0x36')][_0x80f8('0x39')]));_0x42e871[_0x80f8('0x38')]=_0x42e871[_0x80f8('0x38')][_0x80f8('0x3a')]?_0x42e871[_0x80f8('0x38')]:_0x14fcce['model'];if(!_0x109ea3[_0x80f8('0x36')][_0x80f8('0x3b')](_0x80f8('0x3c'))){_0x42e871[_0x80f8('0x22')]=qs['limit'](_0x109ea3[_0x80f8('0x36')][_0x80f8('0x22')]);_0x42e871[_0x80f8('0x20')]=qs[_0x80f8('0x20')](_0x109ea3['query'][_0x80f8('0x20')]);}_0x42e871['order']=qs['sort'](_0x109ea3[_0x80f8('0x36')][_0x80f8('0x3d')]);_0x42e871[_0x80f8('0x3e')]=qs[_0x80f8('0x3f')](_['pick'](_0x109ea3[_0x80f8('0x36')],_0x14fcce[_0x80f8('0x3f')]),_0x1bd039);if(_0x109ea3[_0x80f8('0x36')][_0x80f8('0x40')]){_0x42e871[_0x80f8('0x3e')]=_[_0x80f8('0x41')](_0x42e871[_0x80f8('0x3e')],{'$or':_[_0x80f8('0x30')](_0x1bd039,function(_0x173c61){if(_0x173c61[_0x80f8('0x33')]!==_0x80f8('0x42')){var _0x592de={};_0x592de[_0x173c61[_0x80f8('0x2d')]]={'$like':'%'+_0x109ea3[_0x80f8('0x36')][_0x80f8('0x40')]+'%'};return _0x592de;}})});}_0x42e871=_[_0x80f8('0x41')]({},_0x42e871,_0x109ea3[_0x80f8('0x43')]);var _0x3940f1={'where':_0x42e871[_0x80f8('0x3e')]};return db['FreshdeskAccount'][_0x80f8('0x23')](_0x3940f1)[_0x80f8('0x44')](function(_0x4365a4){_0x436d24['count']=_0x4365a4;if(_0x109ea3['query']['includeAll']){_0x42e871['include']=[{'all':!![]}];}return db[_0x80f8('0x31')][_0x80f8('0x45')](_0x42e871);})[_0x80f8('0x44')](function(_0x1a9eb9){_0x436d24[_0x80f8('0x46')]=_0x1a9eb9;return _0x436d24;})[_0x80f8('0x44')](respondWithFilteredResult(_0x46d379,_0x42e871))['catch'](handleError(_0x46d379,null));};exports['show']=function(_0x3c6b03,_0x38a9c2){var _0x75feef={'raw':![],'where':{'id':_0x3c6b03[_0x80f8('0x47')]['id']}},_0x5ae1d={};_0x5ae1d['model']=_[_0x80f8('0x48')](db[_0x80f8('0x31')][_0x80f8('0x49')]);_0x5ae1d[_0x80f8('0x36')]=_[_0x80f8('0x48')](_0x3c6b03[_0x80f8('0x36')]);_0x5ae1d[_0x80f8('0x3f')]=_[_0x80f8('0x37')](_0x5ae1d[_0x80f8('0x35')],_0x5ae1d[_0x80f8('0x36')]);_0x75feef[_0x80f8('0x38')]=_[_0x80f8('0x37')](_0x5ae1d[_0x80f8('0x35')],qs[_0x80f8('0x39')](_0x3c6b03[_0x80f8('0x36')][_0x80f8('0x39')]));_0x75feef[_0x80f8('0x38')]=_0x75feef['attributes'][_0x80f8('0x3a')]?_0x75feef[_0x80f8('0x38')]:_0x5ae1d['model'];if(_0x3c6b03['query'][_0x80f8('0x4a')]){_0x75feef[_0x80f8('0x4b')]=[{'all':!![]}];}_0x75feef=_[_0x80f8('0x41')]({},_0x75feef,_0x3c6b03[_0x80f8('0x43')]);return db['FreshdeskAccount'][_0x80f8('0x4c')](_0x75feef)[_0x80f8('0x44')](handleEntityNotFound(_0x38a9c2,null))['then'](respondWithResult(_0x38a9c2,null))[_0x80f8('0x4d')](handleError(_0x38a9c2,null));};exports[_0x80f8('0x4e')]=function(_0x5be18f,_0x181487){return db[_0x80f8('0x31')]['create'](_0x5be18f[_0x80f8('0x4f')],{})['then'](respondWithResult(_0x181487,0xc9))[_0x80f8('0x4d')](handleError(_0x181487,null));};exports['update']=function(_0x3d73ac,_0xf2eb0){if(_0x3d73ac[_0x80f8('0x4f')]['id']){delete _0x3d73ac[_0x80f8('0x4f')]['id'];}return db[_0x80f8('0x31')][_0x80f8('0x4c')]({'where':{'id':_0x3d73ac[_0x80f8('0x47')]['id']}})[_0x80f8('0x44')](handleEntityNotFound(_0xf2eb0,null))['then'](saveUpdates(_0x3d73ac[_0x80f8('0x4f')],null))['then'](respondWithResult(_0xf2eb0,null))[_0x80f8('0x4d')](handleError(_0xf2eb0,null));};exports[_0x80f8('0x2a')]=function(_0x46135b,_0x2ba4c2){return db[_0x80f8('0x31')][_0x80f8('0x4c')]({'where':{'id':_0x46135b[_0x80f8('0x47')]['id']}})[_0x80f8('0x44')](handleEntityNotFound(_0x2ba4c2,null))[_0x80f8('0x44')](removeEntity(_0x2ba4c2,null))[_0x80f8('0x4d')](handleError(_0x2ba4c2,null));};exports[_0x80f8('0x50')]=function(_0x3aa28f,_0xb1204c,_0x133229){var _0x5848ca={};var _0x177e8d={};var _0x8c589f;var _0x87bb6a;return db[_0x80f8('0x31')]['findOne']({'where':{'id':_0x3aa28f[_0x80f8('0x47')]['id']}})['then'](handleEntityNotFound(_0xb1204c,null))[_0x80f8('0x44')](function(_0x3b886b){if(_0x3b886b){_0x8c589f=_0x3b886b;_0x177e8d[_0x80f8('0x35')]=_['keys'](db['FreshdeskConfiguration']['rawAttributes']);_0x177e8d[_0x80f8('0x36')]=_[_0x80f8('0x48')](_0x3aa28f[_0x80f8('0x36')]);_0x177e8d[_0x80f8('0x3f')]=_[_0x80f8('0x37')](_0x177e8d[_0x80f8('0x35')],_0x177e8d[_0x80f8('0x36')]);_0x5848ca['attributes']=_[_0x80f8('0x37')](_0x177e8d[_0x80f8('0x35')],qs[_0x80f8('0x39')](_0x3aa28f[_0x80f8('0x36')]['fields']));_0x5848ca[_0x80f8('0x38')]=_0x5848ca['attributes'][_0x80f8('0x3a')]?_0x5848ca[_0x80f8('0x38')]:_0x177e8d['model'];_0x5848ca[_0x80f8('0x51')]=qs[_0x80f8('0x3d')](_0x3aa28f[_0x80f8('0x36')]['sort']);_0x5848ca[_0x80f8('0x3e')]=qs['filters'](_[_0x80f8('0x52')](_0x3aa28f[_0x80f8('0x36')],_0x177e8d['filters']));if(_0x3aa28f[_0x80f8('0x36')][_0x80f8('0x40')]){_0x5848ca[_0x80f8('0x3e')]=_[_0x80f8('0x41')](_0x5848ca['where'],{'$or':_[_0x80f8('0x30')](_0x5848ca[_0x80f8('0x38')],function(_0x1735ea){var _0x40e717={};_0x40e717[_0x1735ea]={'$like':'%'+_0x3aa28f[_0x80f8('0x36')][_0x80f8('0x40')]+'%'};return _0x40e717;})});}_0x5848ca=_[_0x80f8('0x41')]({},_0x5848ca,_0x3aa28f[_0x80f8('0x43')]);return _0x8c589f[_0x80f8('0x50')](_0x5848ca);}})[_0x80f8('0x44')](function(_0x2a580){if(_0x2a580){_0x87bb6a=_0x2a580[_0x80f8('0x3a')];if(!_0x3aa28f['query'][_0x80f8('0x3b')](_0x80f8('0x3c'))){_0x5848ca[_0x80f8('0x22')]=qs[_0x80f8('0x22')](_0x3aa28f[_0x80f8('0x36')][_0x80f8('0x22')]);_0x5848ca[_0x80f8('0x20')]=qs[_0x80f8('0x20')](_0x3aa28f[_0x80f8('0x36')][_0x80f8('0x20')]);}return _0x8c589f[_0x80f8('0x50')](_0x5848ca);}})['then'](function(_0x522587){if(_0x522587){return _0x522587?{'count':_0x87bb6a,'rows':_0x522587}:null;}})['then'](respondWithResult(_0xb1204c,null))[_0x80f8('0x4d')](handleError(_0xb1204c,null));};exports[_0x80f8('0x53')]=function(_0x52e5e6,_0xebf443,_0x49100e){if(_0x52e5e6[_0x80f8('0x4f')]['id']){delete _0x52e5e6[_0x80f8('0x4f')]['id'];}return db['FreshdeskAccount'][_0x80f8('0x54')]({'where':{'id':_0x52e5e6[_0x80f8('0x47')]['id']}})[_0x80f8('0x44')](handleEntityNotFound(_0xebf443,null))[_0x80f8('0x44')](function(_0x138e34){if(_0x138e34){_0x52e5e6[_0x80f8('0x4f')][_0x80f8('0x55')]=_0x138e34['id'];_0x52e5e6['body'][_0x80f8('0x56')]=integrations[_0x80f8('0x57')](_0x52e5e6[_0x80f8('0x4f')][_0x80f8('0x58')],_0x52e5e6[_0x80f8('0x4f')][_0x80f8('0x33')]);_0x52e5e6[_0x80f8('0x4f')]['Descriptions']=integrations[_0x80f8('0x59')](_0x52e5e6[_0x80f8('0x4f')][_0x80f8('0x58')],_0x52e5e6[_0x80f8('0x4f')][_0x80f8('0x33')]);return db['FreshdeskConfiguration'][_0x80f8('0x4e')](_0x52e5e6[_0x80f8('0x4f')],{'include':[{'model':db[_0x80f8('0x5a')],'as':_0x80f8('0x56')},{'model':db[_0x80f8('0x5a')],'as':_0x80f8('0x5b')}]});}return null;})[_0x80f8('0x44')](respondWithResult(_0xebf443,null))[_0x80f8('0x4d')](handleError(_0xebf443,null));};exports[_0x80f8('0x5c')]=function(_0x4e6839,_0x100470,_0x1bfa2b){var _0x186d8c='';return db[_0x80f8('0x31')][_0x80f8('0x54')]({'where':{'id':_0x4e6839[_0x80f8('0x47')]['id']},'attributes':['id',_0x80f8('0x5d'),_0x80f8('0x5e')]})['then'](handleEntityNotFound(_0x100470,null))['then'](function(_0x22b786){if(_0x22b786){_0x186d8c=_0x22b786['remoteUri'];var _0xd4ba91=_0x186d8c[_0x80f8('0x5f')](-0x1);if(_0xd4ba91==='/'){_0x186d8c=_0x186d8c[_0x80f8('0x60')](0x0,_0x186d8c['lastIndexOf'](_0xd4ba91));}return rp({'method':_0x80f8('0x61'),'uri':util[_0x80f8('0x62')](_0x80f8('0x63'),_0x186d8c,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x80f8('0x62')](_0x80f8('0x64'),new Buffer(util['format']('%s:X',_0x22b786[_0x80f8('0x5e')]))[_0x80f8('0x65')](_0x80f8('0x66')))},'json':!![]});}})['then'](function(_0x59edbd){if(_0x59edbd){var _0x307a57=[_0x80f8('0x67'),_0x80f8('0x68'),_0x80f8('0x69'),_0x80f8('0x6a'),'status','priority','group',_0x80f8('0x6b'),'ticket_type',_0x80f8('0x6c'),_0x80f8('0x6d')];_['remove'](_0x59edbd,function(_0x1621b5){return _0x307a57[_0x80f8('0x6e')](_0x1621b5[_0x80f8('0x2d')])||!_0x1621b5[_0x80f8('0x6f')]&&_0x1621b5[_0x80f8('0x33')]!==_0x80f8('0x70')&&_0x1621b5[_0x80f8('0x33')]!==_0x80f8('0x71');});return{'count':_0x59edbd[_0x80f8('0x3a')],'rows':_[_0x80f8('0x30')](_0x59edbd,function(_0x554b5c){return{'id':_0x554b5c[_0x80f8('0x2d')],'name':_0x554b5c[_0x80f8('0x72')],'custom':!_0x554b5c[_0x80f8('0x6f')],'options':_0x554b5c[_0x80f8('0x73')]?_[_0x80f8('0x30')](_0x554b5c[_0x80f8('0x73')],function(_0x28d1d0){return{'name':_[_0x80f8('0x74')](_0x28d1d0),'value':_0x28d1d0};}):[]};})};}})[_0x80f8('0x44')](respondWithResult(_0x100470,null))['catch'](function(_0x2fdfe0){var _0x25af09=_0x4e6839[_0x80f8('0x36')][_0x80f8('0x75')]?0x1f4:_0x2fdfe0[_0x80f8('0x76')]||0x1f4;logger[_0x80f8('0x77')](_0x80f8('0x78'),_0x80f8('0x5c'),_0x25af09,JSON[_0x80f8('0x79')](_0x2fdfe0));delete _0x2fdfe0[_0x80f8('0x2d')];if(_0x25af09===0x191){_0x25af09=0x190;}_0x100470[_0x80f8('0x1f')](_0x25af09)[_0x80f8('0x2e')](_0x4e6839['query'][_0x80f8('0x75')]?{'message':_0x80f8('0x7a'),'statusCode':_0x2fdfe0[_0x80f8('0x76')]}:_0x2fdfe0);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 14a0eb1..2ef4d7f 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 _0x4f7e=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount','int_freshdesk_accounts','../../config/logger','api','moment'];(function(_0x5b7788,_0x309ae5){var _0x573871=function(_0x5c79fd){while(--_0x5c79fd){_0x5b7788['push'](_0x5b7788['shift']());}};_0x573871(++_0x309ae5);}(_0x4f7e,0x99));var _0xe4f7=function(_0x468485,_0x3bcc02){_0x468485=_0x468485-0x0;var _0x1e4f9f=_0x4f7e[_0x468485];return _0x1e4f9f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe4f7('0x0'))(_0xe4f7('0x1'));var moment=require(_0xe4f7('0x2'));var BPromise=require(_0xe4f7('0x3'));var rp=require(_0xe4f7('0x4'));var fs=require('fs');var path=require(_0xe4f7('0x5'));var rimraf=require(_0xe4f7('0x6'));var config=require(_0xe4f7('0x7'));var attributes=require(_0xe4f7('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xe4f7('0x9')]=function(_0x448fc0,_0x2a1c25){return _0x448fc0[_0xe4f7('0xa')](_0xe4f7('0xb'),attributes,{'tableName':_0xe4f7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4c6=['int_freshdesk_accounts','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','FreshdeskAccount'];(function(_0x4a30cf,_0x312dd4){var _0x4d975b=function(_0x170368){while(--_0x170368){_0x4a30cf['push'](_0x4a30cf['shift']());}};_0x4d975b(++_0x312dd4);}(_0xc4c6,0x160));var _0x6c4c=function(_0x3e5ef9,_0x4673bd){_0x3e5ef9=_0x3e5ef9-0x0;var _0x13d79=_0xc4c6[_0x3e5ef9];return _0x13d79;};'use strict';var _=require('lodash');var util=require(_0x6c4c('0x0'));var logger=require(_0x6c4c('0x1'))(_0x6c4c('0x2'));var moment=require(_0x6c4c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c4c('0x4'));var fs=require('fs');var path=require(_0x6c4c('0x5'));var rimraf=require(_0x6c4c('0x6'));var config=require(_0x6c4c('0x7'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x6c4c('0x8'));module[_0x6c4c('0x9')]=function(_0x5bc8df,_0x39d6e2){return _0x5bc8df[_0x6c4c('0xa')](_0x6c4c('0xb'),attributes,{'tableName':_0x6c4c('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 33ded1c..1f78518 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 _0x9494=['model','catch','ShowFreshdeskAccount','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','GetFreshdeskAccount','FreshdeskAccount','findAll','raw','options','where','attributes','map','include'];(function(_0x1fe915,_0x50da25){var _0x36d429=function(_0x8a58e2){while(--_0x8a58e2){_0x1fe915['push'](_0x1fe915['shift']());}};_0x36d429(++_0x50da25);}(_0x9494,0x185));var _0x4949=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9494[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4949('0x0'));var util=require(_0x4949('0x1'));var moment=require('moment');var BPromise=require(_0x4949('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4949('0x3'));var db=require(_0x4949('0x4'))['db'];var utils=require(_0x4949('0x5'));var logger=require(_0x4949('0x6'))(_0x4949('0x7'));var config=require(_0x4949('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4949('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x172a90,_0x3ac70d,_0x1b0da2){return new BPromise(function(_0x4068f0,_0xf74760){return client[_0x4949('0xa')](_0x172a90,_0x1b0da2)[_0x4949('0xb')](function(_0x3b0484){logger[_0x4949('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x3ac70d,'request\x20sent');logger[_0x4949('0xd')](_0x4949('0xe'),_0x3ac70d,_0x4949('0xf'),JSON[_0x4949('0x10')](_0x3b0484));if(_0x3b0484[_0x4949('0x11')]){if(_0x3b0484[_0x4949('0x11')][_0x4949('0x12')]===0x1f4){logger[_0x4949('0x11')](_0x4949('0x13'),_0x3ac70d,_0x3b0484[_0x4949('0x11')][_0x4949('0x14')]);return _0xf74760(_0x3b0484['error'][_0x4949('0x14')]);}logger[_0x4949('0x11')](_0x4949('0x13'),_0x3ac70d,_0x3b0484[_0x4949('0x11')]['message']);return _0x4068f0(_0x3b0484[_0x4949('0x11')]['message']);}else{logger[_0x4949('0xc')](_0x4949('0x13'),_0x3ac70d,'request\x20sent');_0x4068f0(_0x3b0484[_0x4949('0x15')][_0x4949('0x14')]);}})['catch'](function(_0x5791c3){logger[_0x4949('0x11')](_0x4949('0x13'),_0x3ac70d,_0x5791c3);_0xf74760(_0x5791c3);});});}exports[_0x4949('0x16')]=function(_0x44ad32){var _0x5b188f=this;return new Promise(function(_0x2dd65a,_0x59da6c){return db[_0x4949('0x17')][_0x4949('0x18')]({'raw':_0x44ad32['options']?_0x44ad32['options'][_0x4949('0x19')]===undefined?!![]:![]:!![],'where':_0x44ad32[_0x4949('0x1a')]?_0x44ad32['options'][_0x4949('0x1b')]||null:null,'attributes':_0x44ad32[_0x4949('0x1a')]?_0x44ad32['options'][_0x4949('0x1c')]||null:null,'limit':_0x44ad32[_0x4949('0x1a')]?_0x44ad32[_0x4949('0x1a')]['limit']||null:null,'include':_0x44ad32[_0x4949('0x1a')]?_0x44ad32[_0x4949('0x1a')]['include']?_[_0x4949('0x1d')](_0x44ad32[_0x4949('0x1a')][_0x4949('0x1e')],function(_0x351d7b){return{'model':db[_0x351d7b[_0x4949('0x1f')]],'as':_0x351d7b['as'],'attributes':_0x351d7b[_0x4949('0x1c')],'include':_0x351d7b['include']?_[_0x4949('0x1d')](_0x351d7b[_0x4949('0x1e')],function(_0x27397f){return{'model':db[_0x27397f['model']],'as':_0x27397f['as'],'attributes':_0x27397f[_0x4949('0x1c')],'include':_0x27397f['include']?_['map'](_0x27397f['include'],function(_0x1c98c9){return{'model':db[_0x1c98c9['model']],'as':_0x1c98c9['as'],'attributes':_0x1c98c9[_0x4949('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4949('0xb')](function(_0x192374){logger[_0x4949('0xc')](_0x4949('0x16'),_0x44ad32);logger['debug'](_0x4949('0x16'),_0x44ad32,JSON[_0x4949('0x10')](_0x192374));_0x2dd65a(_0x192374);})[_0x4949('0x20')](function(_0x2d5100){logger['error'](_0x4949('0x16'),_0x2d5100[_0x4949('0x14')],_0x44ad32);_0x59da6c(_0x5b188f[_0x4949('0x11')](0x1f4,_0x2d5100[_0x4949('0x14')]));});});};exports[_0x4949('0x21')]=function(_0x3b51d3){var _0x363bca=this;return new Promise(function(_0x142798,_0x1dd93f){return db[_0x4949('0x17')][_0x4949('0x22')]({'raw':_0x3b51d3[_0x4949('0x1a')]?_0x3b51d3[_0x4949('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3b51d3[_0x4949('0x1a')]?_0x3b51d3[_0x4949('0x1a')][_0x4949('0x1b')]||null:null,'attributes':_0x3b51d3[_0x4949('0x1a')]?_0x3b51d3[_0x4949('0x1a')][_0x4949('0x1c')]||null:null,'include':_0x3b51d3[_0x4949('0x1a')]?_0x3b51d3['options'][_0x4949('0x1e')]?_[_0x4949('0x1d')](_0x3b51d3[_0x4949('0x1a')]['include'],function(_0x352fe2){return{'model':db[_0x352fe2[_0x4949('0x1f')]],'as':_0x352fe2['as'],'attributes':_0x352fe2[_0x4949('0x1c')],'include':_0x352fe2[_0x4949('0x1e')]?_[_0x4949('0x1d')](_0x352fe2[_0x4949('0x1e')],function(_0xb92425){return{'model':db[_0xb92425['model']],'as':_0xb92425['as'],'attributes':_0xb92425[_0x4949('0x1c')],'include':_0xb92425[_0x4949('0x1e')]?_[_0x4949('0x1d')](_0xb92425[_0x4949('0x1e')],function(_0x25faa4){return{'model':db[_0x25faa4[_0x4949('0x1f')]],'as':_0x25faa4['as'],'attributes':_0x25faa4[_0x4949('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4949('0xb')](function(_0x48f387){logger[_0x4949('0xc')]('ShowFreshdeskAccount',_0x3b51d3);logger['debug']('ShowFreshdeskAccount',_0x3b51d3,JSON[_0x4949('0x10')](_0x48f387));_0x142798(_0x48f387);})[_0x4949('0x20')](function(_0x2d1eec){logger['error']('ShowFreshdeskAccount',_0x2d1eec[_0x4949('0x14')],_0x3b51d3);_0x1dd93f(_0x363bca[_0x4949('0x11')](0x1f4,_0x2d1eec[_0x4949('0x14')]));});});}; \ No newline at end of file +var _0x6feb=['client','http','request','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','attributes','map','include','model','ShowFreshdeskAccount','find','where','then','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x6feb,0x1be));var _0xb6fe=function(_0xc62c74,_0x23731a){_0xc62c74=_0xc62c74-0x0;var _0x3f3148=_0x6feb[_0xc62c74];return _0x3f3148;};'use strict';var _=require(_0xb6fe('0x0'));var util=require(_0xb6fe('0x1'));var moment=require(_0xb6fe('0x2'));var BPromise=require(_0xb6fe('0x3'));var rs=require(_0xb6fe('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb6fe('0x5'));var logger=require(_0xb6fe('0x6'))(_0xb6fe('0x7'));var config=require(_0xb6fe('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb6fe('0x9')][_0xb6fe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x315058,_0x423af0,_0x35393d){return new BPromise(function(_0x4c0f7e,_0x1594e0){return client[_0xb6fe('0xb')](_0x315058,_0x35393d)['then'](function(_0x54a315){logger[_0xb6fe('0xc')](_0xb6fe('0xd'),_0x423af0,'request\x20sent');logger[_0xb6fe('0xe')](_0xb6fe('0xf'),_0x423af0,'request\x20sent',JSON[_0xb6fe('0x10')](_0x54a315));if(_0x54a315[_0xb6fe('0x11')]){if(_0x54a315['error'][_0xb6fe('0x12')]===0x1f4){logger[_0xb6fe('0x11')](_0xb6fe('0xd'),_0x423af0,_0x54a315['error'][_0xb6fe('0x13')]);return _0x1594e0(_0x54a315[_0xb6fe('0x11')]['message']);}logger[_0xb6fe('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x423af0,_0x54a315[_0xb6fe('0x11')][_0xb6fe('0x13')]);return _0x4c0f7e(_0x54a315[_0xb6fe('0x11')]['message']);}else{logger[_0xb6fe('0xc')](_0xb6fe('0xd'),_0x423af0,_0xb6fe('0x14'));_0x4c0f7e(_0x54a315['result'][_0xb6fe('0x13')]);}})[_0xb6fe('0x15')](function(_0x17305e){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x423af0,_0x17305e);_0x1594e0(_0x17305e);});});}exports[_0xb6fe('0x16')]=function(_0x124e33){var _0x13f653=this;return new Promise(function(_0x1014f2,_0x56f888){return db[_0xb6fe('0x17')][_0xb6fe('0x18')]({'raw':_0x124e33[_0xb6fe('0x19')]?_0x124e33[_0xb6fe('0x19')][_0xb6fe('0x1a')]===undefined?!![]:![]:!![],'where':_0x124e33[_0xb6fe('0x19')]?_0x124e33[_0xb6fe('0x19')]['where']||null:null,'attributes':_0x124e33[_0xb6fe('0x19')]?_0x124e33['options'][_0xb6fe('0x1b')]||null:null,'limit':_0x124e33[_0xb6fe('0x19')]?_0x124e33[_0xb6fe('0x19')]['limit']||null:null,'include':_0x124e33['options']?_0x124e33['options']['include']?_[_0xb6fe('0x1c')](_0x124e33[_0xb6fe('0x19')][_0xb6fe('0x1d')],function(_0x2d757e){return{'model':db[_0x2d757e[_0xb6fe('0x1e')]],'as':_0x2d757e['as'],'attributes':_0x2d757e[_0xb6fe('0x1b')],'include':_0x2d757e[_0xb6fe('0x1d')]?_[_0xb6fe('0x1c')](_0x2d757e[_0xb6fe('0x1d')],function(_0x42d958){return{'model':db[_0x42d958['model']],'as':_0x42d958['as'],'attributes':_0x42d958[_0xb6fe('0x1b')],'include':_0x42d958['include']?_['map'](_0x42d958['include'],function(_0x146b06){return{'model':db[_0x146b06[_0xb6fe('0x1e')]],'as':_0x146b06['as'],'attributes':_0x146b06[_0xb6fe('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x28bb6f){logger[_0xb6fe('0xc')](_0xb6fe('0x16'),_0x124e33);logger[_0xb6fe('0xe')](_0xb6fe('0x16'),_0x124e33,JSON['stringify'](_0x28bb6f));_0x1014f2(_0x28bb6f);})['catch'](function(_0x312ad7){logger[_0xb6fe('0x11')](_0xb6fe('0x16'),_0x312ad7[_0xb6fe('0x13')],_0x124e33);_0x56f888(_0x13f653[_0xb6fe('0x11')](0x1f4,_0x312ad7[_0xb6fe('0x13')]));});});};exports[_0xb6fe('0x1f')]=function(_0xc6d05c){var _0x2661a3=this;return new Promise(function(_0x1126a0,_0x10755e){return db[_0xb6fe('0x17')][_0xb6fe('0x20')]({'raw':_0xc6d05c[_0xb6fe('0x19')]?_0xc6d05c[_0xb6fe('0x19')][_0xb6fe('0x1a')]===undefined?!![]:![]:!![],'where':_0xc6d05c['options']?_0xc6d05c[_0xb6fe('0x19')][_0xb6fe('0x21')]||null:null,'attributes':_0xc6d05c['options']?_0xc6d05c[_0xb6fe('0x19')][_0xb6fe('0x1b')]||null:null,'include':_0xc6d05c[_0xb6fe('0x19')]?_0xc6d05c['options']['include']?_['map'](_0xc6d05c[_0xb6fe('0x19')][_0xb6fe('0x1d')],function(_0x5e8885){return{'model':db[_0x5e8885[_0xb6fe('0x1e')]],'as':_0x5e8885['as'],'attributes':_0x5e8885[_0xb6fe('0x1b')],'include':_0x5e8885[_0xb6fe('0x1d')]?_[_0xb6fe('0x1c')](_0x5e8885[_0xb6fe('0x1d')],function(_0x13afca){return{'model':db[_0x13afca[_0xb6fe('0x1e')]],'as':_0x13afca['as'],'attributes':_0x13afca[_0xb6fe('0x1b')],'include':_0x13afca[_0xb6fe('0x1d')]?_[_0xb6fe('0x1c')](_0x13afca[_0xb6fe('0x1d')],function(_0x3a7cd0){return{'model':db[_0x3a7cd0[_0xb6fe('0x1e')]],'as':_0x3a7cd0['as'],'attributes':_0x3a7cd0[_0xb6fe('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb6fe('0x22')](function(_0xf6a241){logger[_0xb6fe('0xc')](_0xb6fe('0x1f'),_0xc6d05c);logger['debug'](_0xb6fe('0x1f'),_0xc6d05c,JSON['stringify'](_0xf6a241));_0x1126a0(_0xf6a241);})[_0xb6fe('0x15')](function(_0x38ea11){logger[_0xb6fe('0x11')](_0xb6fe('0x1f'),_0x38ea11[_0xb6fe('0x13')],_0xc6d05c);_0x10755e(_0x2661a3['error'](0x1f4,_0x38ea11[_0xb6fe('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index f7cc886..7900e14 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 _0x43ff=['getDescriptions','/:id/tags','getTags','post','setTags','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x43ff,0xbf));var _0xf43f=function(_0x506d2f,_0x5ab76e){_0x506d2f=_0x506d2f-0x0;var _0x101255=_0x43ff[_0x506d2f];return _0x101255;};'use strict';var multer=require(_0xf43f('0x0'));var util=require(_0xf43f('0x1'));var path=require(_0xf43f('0x2'));var timeout=require(_0xf43f('0x3'));var express=require(_0xf43f('0x4'));var router=express[_0xf43f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf43f('0x6'));var interaction=require(_0xf43f('0x7'));var config=require(_0xf43f('0x8'));var controller=require('./intFreshdeskConfiguration.controller');router[_0xf43f('0x9')]('/',auth[_0xf43f('0xa')](),controller[_0xf43f('0xb')]);router[_0xf43f('0x9')](_0xf43f('0xc'),auth[_0xf43f('0xa')](),controller['show']);router[_0xf43f('0x9')](_0xf43f('0xd'),auth['isAuthenticated'](),controller[_0xf43f('0xe')]);router[_0xf43f('0x9')](_0xf43f('0xf'),auth[_0xf43f('0xa')](),controller['getSubjects']);router['get'](_0xf43f('0x10'),auth[_0xf43f('0xa')](),controller[_0xf43f('0x11')]);router[_0xf43f('0x9')](_0xf43f('0x12'),auth[_0xf43f('0xa')](),controller[_0xf43f('0x13')]);router[_0xf43f('0x14')]('/',auth[_0xf43f('0xa')](),controller['create']);router[_0xf43f('0x14')](_0xf43f('0x12'),auth[_0xf43f('0xa')](),controller[_0xf43f('0x15')]);router[_0xf43f('0x16')](_0xf43f('0xc'),auth[_0xf43f('0xa')](),controller[_0xf43f('0x17')]);router[_0xf43f('0x18')](_0xf43f('0xc'),auth[_0xf43f('0xa')](),controller[_0xf43f('0x19')]);module['exports']=router; \ No newline at end of file +var _0xc6c4=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','post','create','put'];(function(_0x11a31c,_0x3ee34b){var _0x33a8fd=function(_0x1a3bd5){while(--_0x1a3bd5){_0x11a31c['push'](_0x11a31c['shift']());}};_0x33a8fd(++_0x3ee34b);}(_0xc6c4,0x13a));var _0x4c6c=function(_0x344829,_0x2a359d){_0x344829=_0x344829-0x0;var _0x3b07bb=_0xc6c4[_0x344829];return _0x3b07bb;};'use strict';var multer=require(_0x4c6c('0x0'));var util=require(_0x4c6c('0x1'));var path=require(_0x4c6c('0x2'));var timeout=require(_0x4c6c('0x3'));var express=require(_0x4c6c('0x4'));var router=express[_0x4c6c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4c6c('0x6'));var interaction=require(_0x4c6c('0x7'));var config=require(_0x4c6c('0x8'));var controller=require(_0x4c6c('0x9'));router['get']('/',auth[_0x4c6c('0xa')](),controller[_0x4c6c('0xb')]);router[_0x4c6c('0xc')](_0x4c6c('0xd'),auth['isAuthenticated'](),controller[_0x4c6c('0xe')]);router[_0x4c6c('0xc')](_0x4c6c('0xf'),auth['isAuthenticated'](),controller[_0x4c6c('0x10')]);router['get'](_0x4c6c('0x11'),auth[_0x4c6c('0xa')](),controller[_0x4c6c('0x12')]);router[_0x4c6c('0xc')](_0x4c6c('0x13'),auth['isAuthenticated'](),controller['getDescriptions']);router['get'](_0x4c6c('0x14'),auth['isAuthenticated'](),controller['getTags']);router[_0x4c6c('0x15')]('/',auth[_0x4c6c('0xa')](),controller[_0x4c6c('0x16')]);router[_0x4c6c('0x15')]('/:id/tags',auth[_0x4c6c('0xa')](),controller['setTags']);router[_0x4c6c('0x17')](_0x4c6c('0xd'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x4c6c('0xa')](),controller[_0x4c6c('0x18')]);module[_0x4c6c('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 02a99e2..296d89c 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 _0xd767=['sequelize','exports','STRING'];(function(_0x14eaff,_0x3ef509){var _0x5609b2=function(_0x589ac3){while(--_0x589ac3){_0x14eaff['push'](_0x14eaff['shift']());}};_0x5609b2(++_0x3ef509);}(_0xd767,0x10e));var _0x7d76=function(_0x3825f2,_0x33c9b1){_0x3825f2=_0x3825f2-0x0;var _0x6dab8a=_0xd767[_0x3825f2];return _0x6dab8a;};'use strict';var Sequelize=require(_0x7d76('0x0'));module[_0x7d76('0x1')]={'name':{'type':Sequelize[_0x7d76('0x2')]},'description':{'type':Sequelize[_0x7d76('0x2')]}}; \ No newline at end of file +var _0x82bc=['exports','STRING'];(function(_0x363ca3,_0x3180ed){var _0x392085=function(_0x198bb4){while(--_0x198bb4){_0x363ca3['push'](_0x363ca3['shift']());}};_0x392085(++_0x3180ed);}(_0x82bc,0x14a));var _0xc82b=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x82bc[_0x413feb];return _0x40ee88;};'use strict';var Sequelize=require('sequelize');module[_0xc82b('0x0')]={'name':{'type':Sequelize[_0xc82b('0x1')]},'description':{'type':Sequelize[_0xc82b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index b01b194..d2ded8e 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 _0x1ed7=['path','sox','to-csv','fs-extra','lodash','desk.js','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','json','undefined','offset','count','set','apply','reject','save','update','then','destroy','status','sendStatus','error','stack','name','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','keys','fields','options','create','body','find','getFields','findOne','FreshdeskField','nolimit','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x1492f7,_0x2ea065){var _0x1343a9=function(_0x1b7a9f){while(--_0x1b7a9f){_0x1492f7['push'](_0x1492f7['shift']());}};_0x1343a9(++_0x2ea065);}(_0x1ed7,0xed));var _0x71ed=function(_0xb3933d,_0x4ccb20){_0xb3933d=_0xb3933d-0x0;var _0x2fbd6d=_0x1ed7[_0xb3933d];return _0x2fbd6d;};'use strict';var emlformat=require(_0x71ed('0x0'));var rimraf=require(_0x71ed('0x1'));var zipdir=require(_0x71ed('0x2'));var jsonpatch=require(_0x71ed('0x3'));var rp=require(_0x71ed('0x4'));var moment=require(_0x71ed('0x5'));var BPromise=require(_0x71ed('0x6'));var Mustache=require(_0x71ed('0x7'));var util=require(_0x71ed('0x8'));var path=require(_0x71ed('0x9'));var sox=require(_0x71ed('0xa'));var csv=require(_0x71ed('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71ed('0xc'));var _=require(_0x71ed('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x71ed('0xe'));var toCsv=require(_0x71ed('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x71ed('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x71ed('0x10'));var logger=require(_0x71ed('0x11'))('api');var utils=require(_0x71ed('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x71ed('0x13'));var db=require(_0x71ed('0x14'))['db'];function respondWithStatusCode(_0x110376,_0x200d5e){_0x200d5e=_0x200d5e||0xcc;return function(_0xf67fcb){if(_0xf67fcb){return _0x110376['sendStatus'](_0x200d5e);}return _0x110376['status'](_0x200d5e)[_0x71ed('0x15')]();};}function respondWithResult(_0x307271,_0x230e51){_0x230e51=_0x230e51||0xc8;return function(_0x241f9c){if(_0x241f9c){return _0x307271['status'](_0x230e51)[_0x71ed('0x16')](_0x241f9c);}};}function respondWithFilteredResult(_0x5bf7b9,_0x2de85e){return function(_0x340d60){if(_0x340d60){var _0x36c212=typeof _0x2de85e['offset']===_0x71ed('0x17')&&typeof _0x2de85e['limit']===_0x71ed('0x17');var _0x5f370d=_0x340d60['count'];var _0x11fa75=_0x36c212?0x0:_0x2de85e[_0x71ed('0x18')];var _0x2f170=_0x36c212?_0x340d60[_0x71ed('0x19')]:_0x2de85e[_0x71ed('0x18')]+_0x2de85e['limit'];var _0x29d802;if(_0x2f170>=_0x5f370d){_0x2f170=_0x5f370d;_0x29d802=0xc8;}else{_0x29d802=0xce;}_0x5bf7b9['status'](_0x29d802);return _0x5bf7b9[_0x71ed('0x1a')]('Content-Range',_0x11fa75+'-'+_0x2f170+'/'+_0x5f370d)[_0x71ed('0x16')](_0x340d60);}return null;};}function patchUpdates(_0x4a190f){return function(_0x525c7d){try{jsonpatch[_0x71ed('0x1b')](_0x525c7d,_0x4a190f,!![]);}catch(_0x46755f){return BPromise[_0x71ed('0x1c')](_0x46755f);}return _0x525c7d[_0x71ed('0x1d')]();};}function saveUpdates(_0x1690a4,_0x72b0f7){return function(_0x48f86c){if(_0x48f86c){return _0x48f86c[_0x71ed('0x1e')](_0x1690a4)[_0x71ed('0x1f')](function(_0x23d767){return _0x23d767;});}return null;};}function removeEntity(_0x2a6442,_0x1cebb7){return function(_0xd3f3b7){if(_0xd3f3b7){return _0xd3f3b7[_0x71ed('0x20')]()[_0x71ed('0x1f')](function(){_0x2a6442[_0x71ed('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1615e7,_0x3d9f32){return function(_0x57539a){if(!_0x57539a){_0x1615e7[_0x71ed('0x22')](0x194);}return _0x57539a;};}function handleError(_0x1b76cb,_0x3ff4aa){_0x3ff4aa=_0x3ff4aa||0x1f4;return function(_0x5255ee){logger[_0x71ed('0x23')](_0x5255ee[_0x71ed('0x24')]);if(_0x5255ee[_0x71ed('0x25')]){delete _0x5255ee[_0x71ed('0x25')];}_0x1b76cb['status'](_0x3ff4aa)['send'](_0x5255ee);};}exports[_0x71ed('0x26')]=function(_0x126cd1,_0x6fee69){var _0x387f3e={},_0x17d1c2={},_0x522e98={'count':0x0,'rows':[]};var _0x524b13=_[_0x71ed('0x27')](db[_0x71ed('0x28')][_0x71ed('0x29')],function(_0x3429b1){return{'name':_0x3429b1[_0x71ed('0x2a')],'type':_0x3429b1[_0x71ed('0x2b')][_0x71ed('0x2c')]};});_0x17d1c2[_0x71ed('0x2d')]=_[_0x71ed('0x27')](_0x524b13,_0x71ed('0x25'));_0x17d1c2[_0x71ed('0x2e')]=_['keys'](_0x126cd1[_0x71ed('0x2e')]);_0x17d1c2[_0x71ed('0x2f')]=_[_0x71ed('0x30')](_0x17d1c2['model'],_0x17d1c2[_0x71ed('0x2e')]);_0x387f3e[_0x71ed('0x31')]=_['intersection'](_0x17d1c2[_0x71ed('0x2d')],qs['fields'](_0x126cd1['query']['fields']));_0x387f3e[_0x71ed('0x31')]=_0x387f3e[_0x71ed('0x31')][_0x71ed('0x32')]?_0x387f3e[_0x71ed('0x31')]:_0x17d1c2[_0x71ed('0x2d')];if(!_0x126cd1[_0x71ed('0x2e')][_0x71ed('0x33')]('nolimit')){_0x387f3e[_0x71ed('0x34')]=qs[_0x71ed('0x34')](_0x126cd1['query'][_0x71ed('0x34')]);_0x387f3e[_0x71ed('0x18')]=qs[_0x71ed('0x18')](_0x126cd1['query'][_0x71ed('0x18')]);}_0x387f3e[_0x71ed('0x35')]=qs[_0x71ed('0x36')](_0x126cd1[_0x71ed('0x2e')][_0x71ed('0x36')]);_0x387f3e[_0x71ed('0x37')]=qs[_0x71ed('0x2f')](_[_0x71ed('0x38')](_0x126cd1[_0x71ed('0x2e')],_0x17d1c2[_0x71ed('0x2f')]),_0x524b13);if(_0x126cd1[_0x71ed('0x2e')]['filter']){_0x387f3e[_0x71ed('0x37')]=_[_0x71ed('0x39')](_0x387f3e[_0x71ed('0x37')],{'$or':_[_0x71ed('0x27')](_0x524b13,function(_0x41307b){if(_0x41307b[_0x71ed('0x2b')]!==_0x71ed('0x3a')){var _0x120963={};_0x120963[_0x41307b[_0x71ed('0x25')]]={'$like':'%'+_0x126cd1['query'][_0x71ed('0x3b')]+'%'};return _0x120963;}})});}_0x387f3e=_[_0x71ed('0x39')]({},_0x387f3e,_0x126cd1['options']);var _0x4a6cff={'where':_0x387f3e[_0x71ed('0x37')]};return db[_0x71ed('0x28')][_0x71ed('0x19')](_0x4a6cff)[_0x71ed('0x1f')](function(_0x1032ec){_0x522e98[_0x71ed('0x19')]=_0x1032ec;if(_0x126cd1[_0x71ed('0x2e')][_0x71ed('0x3c')]){_0x387f3e[_0x71ed('0x3d')]=[{'all':!![]}];}return db[_0x71ed('0x28')][_0x71ed('0x3e')](_0x387f3e);})[_0x71ed('0x1f')](function(_0x128266){_0x522e98[_0x71ed('0x3f')]=_0x128266;return _0x522e98;})['then'](respondWithFilteredResult(_0x6fee69,_0x387f3e))[_0x71ed('0x40')](handleError(_0x6fee69,null));};exports[_0x71ed('0x41')]=function(_0x77c2be,_0x51cde2){var _0x11be5e={'raw':![],'where':{'id':_0x77c2be[_0x71ed('0x42')]['id']}},_0xabde45={};_0xabde45[_0x71ed('0x2d')]=_[_0x71ed('0x43')](db[_0x71ed('0x28')][_0x71ed('0x29')]);_0xabde45['query']=_['keys'](_0x77c2be[_0x71ed('0x2e')]);_0xabde45[_0x71ed('0x2f')]=_[_0x71ed('0x30')](_0xabde45['model'],_0xabde45[_0x71ed('0x2e')]);_0x11be5e[_0x71ed('0x31')]=_[_0x71ed('0x30')](_0xabde45['model'],qs['fields'](_0x77c2be[_0x71ed('0x2e')][_0x71ed('0x44')]));_0x11be5e[_0x71ed('0x31')]=_0x11be5e[_0x71ed('0x31')][_0x71ed('0x32')]?_0x11be5e[_0x71ed('0x31')]:_0xabde45[_0x71ed('0x2d')];if(_0x77c2be[_0x71ed('0x2e')][_0x71ed('0x3c')]){_0x11be5e['include']=[{'all':!![]}];}_0x11be5e=_[_0x71ed('0x39')]({},_0x11be5e,_0x77c2be[_0x71ed('0x45')]);return db['FreshdeskConfiguration']['find'](_0x11be5e)['then'](handleEntityNotFound(_0x51cde2,null))[_0x71ed('0x1f')](respondWithResult(_0x51cde2,null))[_0x71ed('0x40')](handleError(_0x51cde2,null));};exports[_0x71ed('0x46')]=function(_0x4b1868,_0x2e235f){return db[_0x71ed('0x28')][_0x71ed('0x46')](_0x4b1868[_0x71ed('0x47')],{})[_0x71ed('0x1f')](respondWithResult(_0x2e235f,0xc9))[_0x71ed('0x40')](handleError(_0x2e235f,null));};exports[_0x71ed('0x1e')]=function(_0x2612ac,_0x32ee5e){if(_0x2612ac[_0x71ed('0x47')]['id']){delete _0x2612ac[_0x71ed('0x47')]['id'];}return db['FreshdeskConfiguration'][_0x71ed('0x48')]({'where':{'id':_0x2612ac[_0x71ed('0x42')]['id']}})[_0x71ed('0x1f')](handleEntityNotFound(_0x32ee5e,null))['then'](saveUpdates(_0x2612ac[_0x71ed('0x47')],null))[_0x71ed('0x1f')](respondWithResult(_0x32ee5e,null))[_0x71ed('0x40')](handleError(_0x32ee5e,null));};exports['destroy']=function(_0x2ec812,_0x527f23){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x2ec812['params']['id']}})['then'](handleEntityNotFound(_0x527f23,null))[_0x71ed('0x1f')](removeEntity(_0x527f23,null))['catch'](handleError(_0x527f23,null));};exports[_0x71ed('0x49')]=function(_0x4a7b74,_0x466061,_0x52ca2d){var _0x154845={};var _0x25f10c={};var _0x82c95d;var _0x56c92a;return db[_0x71ed('0x28')][_0x71ed('0x4a')]({'where':{'id':_0x4a7b74[_0x71ed('0x42')]['id']}})[_0x71ed('0x1f')](handleEntityNotFound(_0x466061,null))[_0x71ed('0x1f')](function(_0x28dfbd){if(_0x28dfbd){_0x82c95d=_0x28dfbd;_0x25f10c[_0x71ed('0x2d')]=_[_0x71ed('0x43')](db[_0x71ed('0x4b')][_0x71ed('0x29')]);_0x25f10c[_0x71ed('0x2e')]=_['keys'](_0x4a7b74[_0x71ed('0x2e')]);_0x25f10c[_0x71ed('0x2f')]=_[_0x71ed('0x30')](_0x25f10c[_0x71ed('0x2d')],_0x25f10c[_0x71ed('0x2e')]);_0x154845['attributes']=_[_0x71ed('0x30')](_0x25f10c[_0x71ed('0x2d')],qs[_0x71ed('0x44')](_0x4a7b74[_0x71ed('0x2e')][_0x71ed('0x44')]));_0x154845[_0x71ed('0x31')]=_0x154845['attributes'][_0x71ed('0x32')]?_0x154845[_0x71ed('0x31')]:_0x25f10c[_0x71ed('0x2d')];_0x154845[_0x71ed('0x35')]=qs[_0x71ed('0x36')](_0x4a7b74[_0x71ed('0x2e')]['sort']);_0x154845['where']=qs['filters'](_['pick'](_0x4a7b74[_0x71ed('0x2e')],_0x25f10c[_0x71ed('0x2f')]));if(_0x4a7b74[_0x71ed('0x2e')][_0x71ed('0x3b')]){_0x154845[_0x71ed('0x37')]=_[_0x71ed('0x39')](_0x154845[_0x71ed('0x37')],{'$or':_[_0x71ed('0x27')](_0x154845[_0x71ed('0x31')],function(_0x36768a){var _0x279763={};_0x279763[_0x36768a]={'$like':'%'+_0x4a7b74[_0x71ed('0x2e')][_0x71ed('0x3b')]+'%'};return _0x279763;})});}_0x154845=_['merge']({},_0x154845,_0x4a7b74[_0x71ed('0x45')]);return _0x82c95d['getFields'](_0x154845);}})[_0x71ed('0x1f')](function(_0x52643f){if(_0x52643f){_0x56c92a=_0x52643f[_0x71ed('0x32')];if(!_0x4a7b74[_0x71ed('0x2e')][_0x71ed('0x33')](_0x71ed('0x4c'))){_0x154845[_0x71ed('0x34')]=qs[_0x71ed('0x34')](_0x4a7b74['query']['limit']);_0x154845[_0x71ed('0x18')]=qs[_0x71ed('0x18')](_0x4a7b74[_0x71ed('0x2e')][_0x71ed('0x18')]);}return _0x82c95d[_0x71ed('0x49')](_0x154845);}})[_0x71ed('0x1f')](function(_0x1c7cea){if(_0x1c7cea){return _0x1c7cea?{'count':_0x56c92a,'rows':_0x1c7cea}:null;}})[_0x71ed('0x1f')](respondWithResult(_0x466061,null))[_0x71ed('0x40')](handleError(_0x466061,null));};exports[_0x71ed('0x4d')]=function(_0x2f976d,_0x3b5f5f,_0x47e55b){var _0x4b0a13={};var _0x33c8bd={};var _0x256997;var _0x69e2f;return db[_0x71ed('0x28')]['findOne']({'where':{'id':_0x2f976d[_0x71ed('0x42')]['id']}})[_0x71ed('0x1f')](handleEntityNotFound(_0x3b5f5f,null))[_0x71ed('0x1f')](function(_0x1d00ad){if(_0x1d00ad){_0x256997=_0x1d00ad;_0x33c8bd[_0x71ed('0x2d')]=_['keys'](db[_0x71ed('0x4b')][_0x71ed('0x29')]);_0x33c8bd[_0x71ed('0x2e')]=_[_0x71ed('0x43')](_0x2f976d[_0x71ed('0x2e')]);_0x33c8bd[_0x71ed('0x2f')]=_[_0x71ed('0x30')](_0x33c8bd[_0x71ed('0x2d')],_0x33c8bd['query']);_0x4b0a13[_0x71ed('0x31')]=_['intersection'](_0x33c8bd['model'],qs['fields'](_0x2f976d[_0x71ed('0x2e')][_0x71ed('0x44')]));_0x4b0a13[_0x71ed('0x31')]=_0x4b0a13[_0x71ed('0x31')][_0x71ed('0x32')]?_0x4b0a13[_0x71ed('0x31')]:_0x33c8bd[_0x71ed('0x2d')];_0x4b0a13[_0x71ed('0x35')]=qs['sort'](_0x2f976d[_0x71ed('0x2e')][_0x71ed('0x36')]);_0x4b0a13[_0x71ed('0x37')]=qs['filters'](_[_0x71ed('0x38')](_0x2f976d[_0x71ed('0x2e')],_0x33c8bd[_0x71ed('0x2f')]));if(_0x2f976d[_0x71ed('0x2e')][_0x71ed('0x3b')]){_0x4b0a13[_0x71ed('0x37')]=_[_0x71ed('0x39')](_0x4b0a13['where'],{'$or':_['map'](_0x4b0a13[_0x71ed('0x31')],function(_0x119032){var _0x3472e4={};_0x3472e4[_0x119032]={'$like':'%'+_0x2f976d['query']['filter']+'%'};return _0x3472e4;})});}_0x4b0a13=_['merge']({},_0x4b0a13,_0x2f976d[_0x71ed('0x45')]);return _0x256997[_0x71ed('0x4d')](_0x4b0a13);}})['then'](function(_0x3c1e9f){if(_0x3c1e9f){_0x69e2f=_0x3c1e9f['length'];if(!_0x2f976d['query'][_0x71ed('0x33')](_0x71ed('0x4c'))){_0x4b0a13[_0x71ed('0x34')]=qs[_0x71ed('0x34')](_0x2f976d[_0x71ed('0x2e')][_0x71ed('0x34')]);_0x4b0a13[_0x71ed('0x18')]=qs[_0x71ed('0x18')](_0x2f976d['query'][_0x71ed('0x18')]);}return _0x256997['getSubjects'](_0x4b0a13);}})[_0x71ed('0x1f')](function(_0xbd30d4){if(_0xbd30d4){return _0xbd30d4?{'count':_0x69e2f,'rows':_0xbd30d4}:null;}})[_0x71ed('0x1f')](respondWithResult(_0x3b5f5f,null))['catch'](handleError(_0x3b5f5f,null));};exports[_0x71ed('0x4e')]=function(_0x5a8429,_0x31116c,_0x2f694a){var _0x23fa3b={};var _0x1f4693={};var _0x582b97;var _0x517deb;return db[_0x71ed('0x28')][_0x71ed('0x4a')]({'where':{'id':_0x5a8429['params']['id']}})[_0x71ed('0x1f')](handleEntityNotFound(_0x31116c,null))[_0x71ed('0x1f')](function(_0x382feb){if(_0x382feb){_0x582b97=_0x382feb;_0x1f4693[_0x71ed('0x2d')]=_[_0x71ed('0x43')](db[_0x71ed('0x4b')][_0x71ed('0x29')]);_0x1f4693[_0x71ed('0x2e')]=_[_0x71ed('0x43')](_0x5a8429['query']);_0x1f4693[_0x71ed('0x2f')]=_[_0x71ed('0x30')](_0x1f4693[_0x71ed('0x2d')],_0x1f4693['query']);_0x23fa3b[_0x71ed('0x31')]=_[_0x71ed('0x30')](_0x1f4693[_0x71ed('0x2d')],qs[_0x71ed('0x44')](_0x5a8429['query'][_0x71ed('0x44')]));_0x23fa3b[_0x71ed('0x31')]=_0x23fa3b[_0x71ed('0x31')]['length']?_0x23fa3b['attributes']:_0x1f4693[_0x71ed('0x2d')];_0x23fa3b[_0x71ed('0x35')]=qs[_0x71ed('0x36')](_0x5a8429['query'][_0x71ed('0x36')]);_0x23fa3b[_0x71ed('0x37')]=qs[_0x71ed('0x2f')](_[_0x71ed('0x38')](_0x5a8429[_0x71ed('0x2e')],_0x1f4693['filters']));if(_0x5a8429['query'][_0x71ed('0x3b')]){_0x23fa3b[_0x71ed('0x37')]=_[_0x71ed('0x39')](_0x23fa3b[_0x71ed('0x37')],{'$or':_[_0x71ed('0x27')](_0x23fa3b['attributes'],function(_0x5def54){var _0x16cde6={};_0x16cde6[_0x5def54]={'$like':'%'+_0x5a8429[_0x71ed('0x2e')]['filter']+'%'};return _0x16cde6;})});}_0x23fa3b=_[_0x71ed('0x39')]({},_0x23fa3b,_0x5a8429['options']);return _0x582b97[_0x71ed('0x4e')](_0x23fa3b);}})['then'](function(_0x38a252){if(_0x38a252){_0x517deb=_0x38a252['length'];if(!_0x5a8429['query'][_0x71ed('0x33')](_0x71ed('0x4c'))){_0x23fa3b[_0x71ed('0x34')]=qs['limit'](_0x5a8429[_0x71ed('0x2e')][_0x71ed('0x34')]);_0x23fa3b[_0x71ed('0x18')]=qs['offset'](_0x5a8429[_0x71ed('0x2e')]['offset']);}return _0x582b97[_0x71ed('0x4e')](_0x23fa3b);}})[_0x71ed('0x1f')](function(_0x253a31){if(_0x253a31){return _0x253a31?{'count':_0x517deb,'rows':_0x253a31}:null;}})[_0x71ed('0x1f')](respondWithResult(_0x31116c,null))[_0x71ed('0x40')](handleError(_0x31116c,null));};exports[_0x71ed('0x4f')]=function(_0x473415,_0x15fa74,_0x5c5870){var _0x25b26b={};var _0x2495e5={};var _0x3e563b;var _0x56573f;return db[_0x71ed('0x28')]['findOne']({'where':{'id':_0x473415['params']['id']}})[_0x71ed('0x1f')](handleEntityNotFound(_0x15fa74,null))[_0x71ed('0x1f')](function(_0x2ff0d6){if(_0x2ff0d6){_0x3e563b=_0x2ff0d6;_0x2495e5[_0x71ed('0x2d')]=_[_0x71ed('0x43')](db['Tag'][_0x71ed('0x29')]);_0x2495e5[_0x71ed('0x2e')]=_['keys'](_0x473415[_0x71ed('0x2e')]);_0x2495e5[_0x71ed('0x2f')]=_['intersection'](_0x2495e5['model'],_0x2495e5[_0x71ed('0x2e')]);_0x25b26b['attributes']=_[_0x71ed('0x30')](_0x2495e5['model'],qs[_0x71ed('0x44')](_0x473415[_0x71ed('0x2e')][_0x71ed('0x44')]));_0x25b26b['attributes']=_0x25b26b['attributes'][_0x71ed('0x32')]?_0x25b26b[_0x71ed('0x31')]:_0x2495e5[_0x71ed('0x2d')];_0x25b26b[_0x71ed('0x35')]=qs[_0x71ed('0x36')](_0x473415[_0x71ed('0x2e')][_0x71ed('0x36')]);_0x25b26b['where']=qs[_0x71ed('0x2f')](_[_0x71ed('0x38')](_0x473415[_0x71ed('0x2e')],_0x2495e5[_0x71ed('0x2f')]));if(_0x473415[_0x71ed('0x2e')]['filter']){_0x25b26b[_0x71ed('0x37')]=_[_0x71ed('0x39')](_0x25b26b[_0x71ed('0x37')],{'$or':_[_0x71ed('0x27')](_0x25b26b[_0x71ed('0x31')],function(_0xa378b2){var _0x316240={};_0x316240[_0xa378b2]={'$like':'%'+_0x473415[_0x71ed('0x2e')][_0x71ed('0x3b')]+'%'};return _0x316240;})});}_0x25b26b=_[_0x71ed('0x39')]({},_0x25b26b,_0x473415[_0x71ed('0x45')]);return _0x3e563b[_0x71ed('0x4f')](_0x25b26b);}})[_0x71ed('0x1f')](function(_0x257f60){if(_0x257f60){_0x56573f=_0x257f60[_0x71ed('0x32')];if(!_0x473415[_0x71ed('0x2e')][_0x71ed('0x33')](_0x71ed('0x4c'))){_0x25b26b[_0x71ed('0x34')]=qs[_0x71ed('0x34')](_0x473415['query'][_0x71ed('0x34')]);_0x25b26b[_0x71ed('0x18')]=qs[_0x71ed('0x18')](_0x473415[_0x71ed('0x2e')]['offset']);}return _0x3e563b['getTags'](_0x25b26b);}})[_0x71ed('0x1f')](function(_0x4b1259){if(_0x4b1259){return _0x4b1259?{'count':_0x56573f,'rows':_0x4b1259}:null;}})['then'](respondWithResult(_0x15fa74,null))[_0x71ed('0x40')](handleError(_0x15fa74,null));};exports[_0x71ed('0x50')]=function(_0x7a4586,_0xbb854e,_0x365a47){if(_0x7a4586['body']['id']){delete _0x7a4586[_0x71ed('0x47')]['id'];}return db['FreshdeskConfiguration'][_0x71ed('0x4a')]({'where':{'id':_0x7a4586[_0x71ed('0x42')]['id']}})[_0x71ed('0x1f')](handleEntityNotFound(_0xbb854e,null))['then'](function(_0x485a08){if(_0x485a08){return _0x485a08[_0x71ed('0x50')](_0x7a4586[_0x71ed('0x47')][_0x71ed('0x51')]||[]);}return null;})[_0x71ed('0x1f')](respondWithResult(_0xbb854e,null))['catch'](handleError(_0xbb854e,null));}; \ No newline at end of file +var _0x83f7=['ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','set','Content-Range','json','apply','save','then','end','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','rows','show','params','length','include','find','catch','create','body','update','destroy','getFields','findOne','FreshdeskField','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags'];(function(_0x5000a8,_0x5a27e2){var _0x25fbed=function(_0x293f85){while(--_0x293f85){_0x5000a8['push'](_0x5000a8['shift']());}};_0x25fbed(++_0x5a27e2);}(_0x83f7,0x106));var _0x783f=function(_0x162dca,_0x43f332){_0x162dca=_0x162dca-0x0;var _0x448f16=_0x83f7[_0x162dca];return _0x448f16;};'use strict';var emlformat=require(_0x783f('0x0'));var rimraf=require(_0x783f('0x1'));var zipdir=require(_0x783f('0x2'));var jsonpatch=require(_0x783f('0x3'));var rp=require(_0x783f('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x783f('0x5'));var path=require(_0x783f('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x783f('0x7'));var fs=require('fs');var fs_extra=require(_0x783f('0x8'));var _=require(_0x783f('0x9'));var squel=require('squel');var crypto=require(_0x783f('0xa'));var jsforce=require(_0x783f('0xb'));var deskjs=require(_0x783f('0xc'));var toCsv=require(_0x783f('0xd'));var querystring=require(_0x783f('0xe'));var Papa=require(_0x783f('0xf'));var Redis=require(_0x783f('0x10'));var authService=require(_0x783f('0x11'));var qs=require(_0x783f('0x12'));var as=require(_0x783f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x783f('0x14'))('api');var utils=require(_0x783f('0x15'));var config=require(_0x783f('0x16'));var licenseUtil=require(_0x783f('0x17'));var db=require(_0x783f('0x18'))['db'];function respondWithStatusCode(_0x5ac0f2,_0xca5989){_0xca5989=_0xca5989||0xcc;return function(_0x3024e5){if(_0x3024e5){return _0x5ac0f2[_0x783f('0x19')](_0xca5989);}return _0x5ac0f2[_0x783f('0x1a')](_0xca5989)['end']();};}function respondWithResult(_0x10cf2e,_0x2547d8){_0x2547d8=_0x2547d8||0xc8;return function(_0x4160e2){if(_0x4160e2){return _0x10cf2e[_0x783f('0x1a')](_0x2547d8)['json'](_0x4160e2);}};}function respondWithFilteredResult(_0x571ba4,_0x56e60c){return function(_0xbb3b21){if(_0xbb3b21){var _0x2b19c1=typeof _0x56e60c[_0x783f('0x1b')]==='undefined'&&typeof _0x56e60c['limit']===_0x783f('0x1c');var _0xf4a346=_0xbb3b21['count'];var _0x53ee30=_0x2b19c1?0x0:_0x56e60c['offset'];var _0x40359c=_0x2b19c1?_0xbb3b21['count']:_0x56e60c['offset']+_0x56e60c[_0x783f('0x1d')];var _0x5d8a05;if(_0x40359c>=_0xf4a346){_0x40359c=_0xf4a346;_0x5d8a05=0xc8;}else{_0x5d8a05=0xce;}_0x571ba4[_0x783f('0x1a')](_0x5d8a05);return _0x571ba4[_0x783f('0x1e')](_0x783f('0x1f'),_0x53ee30+'-'+_0x40359c+'/'+_0xf4a346)[_0x783f('0x20')](_0xbb3b21);}return null;};}function patchUpdates(_0x4e671a){return function(_0x39a35e){try{jsonpatch[_0x783f('0x21')](_0x39a35e,_0x4e671a,!![]);}catch(_0x3269a3){return BPromise['reject'](_0x3269a3);}return _0x39a35e[_0x783f('0x22')]();};}function saveUpdates(_0x5dd5c6,_0x250e11){return function(_0x3a06a3){if(_0x3a06a3){return _0x3a06a3['update'](_0x5dd5c6)[_0x783f('0x23')](function(_0x45aae8){return _0x45aae8;});}return null;};}function removeEntity(_0x16f57d,_0x964d35){return function(_0x851396){if(_0x851396){return _0x851396['destroy']()[_0x783f('0x23')](function(){_0x16f57d[_0x783f('0x1a')](0xcc)[_0x783f('0x24')]();});}};}function handleEntityNotFound(_0x4e1d61,_0x49de4e){return function(_0x297271){if(!_0x297271){_0x4e1d61[_0x783f('0x19')](0x194);}return _0x297271;};}function handleError(_0x1dd260,_0x3e1348){_0x3e1348=_0x3e1348||0x1f4;return function(_0x3b9800){logger[_0x783f('0x25')](_0x3b9800[_0x783f('0x26')]);if(_0x3b9800[_0x783f('0x27')]){delete _0x3b9800[_0x783f('0x27')];}_0x1dd260[_0x783f('0x1a')](_0x3e1348)[_0x783f('0x28')](_0x3b9800);};}exports[_0x783f('0x29')]=function(_0x57fb99,_0x37bf5f){var _0x52c426={},_0x2aa969={},_0x4d8aee={'count':0x0,'rows':[]};var _0x47f40f=_[_0x783f('0x2a')](db[_0x783f('0x2b')][_0x783f('0x2c')],function(_0x39bb2c){return{'name':_0x39bb2c[_0x783f('0x2d')],'type':_0x39bb2c['type'][_0x783f('0x2e')]};});_0x2aa969['model']=_['map'](_0x47f40f,_0x783f('0x27'));_0x2aa969[_0x783f('0x2f')]=_[_0x783f('0x30')](_0x57fb99[_0x783f('0x2f')]);_0x2aa969[_0x783f('0x31')]=_[_0x783f('0x32')](_0x2aa969['model'],_0x2aa969[_0x783f('0x2f')]);_0x52c426[_0x783f('0x33')]=_['intersection'](_0x2aa969[_0x783f('0x34')],qs[_0x783f('0x35')](_0x57fb99['query'][_0x783f('0x35')]));_0x52c426[_0x783f('0x33')]=_0x52c426[_0x783f('0x33')]['length']?_0x52c426[_0x783f('0x33')]:_0x2aa969[_0x783f('0x34')];if(!_0x57fb99[_0x783f('0x2f')][_0x783f('0x36')]('nolimit')){_0x52c426[_0x783f('0x1d')]=qs[_0x783f('0x1d')](_0x57fb99[_0x783f('0x2f')][_0x783f('0x1d')]);_0x52c426[_0x783f('0x1b')]=qs['offset'](_0x57fb99[_0x783f('0x2f')][_0x783f('0x1b')]);}_0x52c426[_0x783f('0x37')]=qs[_0x783f('0x38')](_0x57fb99[_0x783f('0x2f')][_0x783f('0x38')]);_0x52c426[_0x783f('0x39')]=qs[_0x783f('0x31')](_[_0x783f('0x3a')](_0x57fb99[_0x783f('0x2f')],_0x2aa969[_0x783f('0x31')]),_0x47f40f);if(_0x57fb99[_0x783f('0x2f')][_0x783f('0x3b')]){_0x52c426[_0x783f('0x39')]=_[_0x783f('0x3c')](_0x52c426[_0x783f('0x39')],{'$or':_[_0x783f('0x2a')](_0x47f40f,function(_0x591f3f){if(_0x591f3f[_0x783f('0x3d')]!==_0x783f('0x3e')){var _0x32f329={};_0x32f329[_0x591f3f[_0x783f('0x27')]]={'$like':'%'+_0x57fb99[_0x783f('0x2f')][_0x783f('0x3b')]+'%'};return _0x32f329;}})});}_0x52c426=_['merge']({},_0x52c426,_0x57fb99[_0x783f('0x3f')]);var _0x401327={'where':_0x52c426['where']};return db['FreshdeskConfiguration'][_0x783f('0x40')](_0x401327)[_0x783f('0x23')](function(_0xff2b84){_0x4d8aee['count']=_0xff2b84;if(_0x57fb99[_0x783f('0x2f')][_0x783f('0x41')]){_0x52c426['include']=[{'all':!![]}];}return db[_0x783f('0x2b')]['findAll'](_0x52c426);})['then'](function(_0x197739){_0x4d8aee[_0x783f('0x42')]=_0x197739;return _0x4d8aee;})[_0x783f('0x23')](respondWithFilteredResult(_0x37bf5f,_0x52c426))['catch'](handleError(_0x37bf5f,null));};exports[_0x783f('0x43')]=function(_0xa4d9ff,_0x3157c0){var _0x12d74f={'raw':![],'where':{'id':_0xa4d9ff[_0x783f('0x44')]['id']}},_0x263445={};_0x263445[_0x783f('0x34')]=_[_0x783f('0x30')](db[_0x783f('0x2b')][_0x783f('0x2c')]);_0x263445[_0x783f('0x2f')]=_[_0x783f('0x30')](_0xa4d9ff['query']);_0x263445[_0x783f('0x31')]=_[_0x783f('0x32')](_0x263445[_0x783f('0x34')],_0x263445['query']);_0x12d74f[_0x783f('0x33')]=_[_0x783f('0x32')](_0x263445[_0x783f('0x34')],qs[_0x783f('0x35')](_0xa4d9ff[_0x783f('0x2f')]['fields']));_0x12d74f['attributes']=_0x12d74f[_0x783f('0x33')][_0x783f('0x45')]?_0x12d74f[_0x783f('0x33')]:_0x263445[_0x783f('0x34')];if(_0xa4d9ff[_0x783f('0x2f')][_0x783f('0x41')]){_0x12d74f[_0x783f('0x46')]=[{'all':!![]}];}_0x12d74f=_[_0x783f('0x3c')]({},_0x12d74f,_0xa4d9ff[_0x783f('0x3f')]);return db['FreshdeskConfiguration'][_0x783f('0x47')](_0x12d74f)[_0x783f('0x23')](handleEntityNotFound(_0x3157c0,null))[_0x783f('0x23')](respondWithResult(_0x3157c0,null))[_0x783f('0x48')](handleError(_0x3157c0,null));};exports[_0x783f('0x49')]=function(_0x1605a3,_0x17bf5e){return db[_0x783f('0x2b')][_0x783f('0x49')](_0x1605a3[_0x783f('0x4a')],{})[_0x783f('0x23')](respondWithResult(_0x17bf5e,0xc9))['catch'](handleError(_0x17bf5e,null));};exports[_0x783f('0x4b')]=function(_0x4ad737,_0x3da36f){if(_0x4ad737[_0x783f('0x4a')]['id']){delete _0x4ad737['body']['id'];}return db[_0x783f('0x2b')]['find']({'where':{'id':_0x4ad737[_0x783f('0x44')]['id']}})[_0x783f('0x23')](handleEntityNotFound(_0x3da36f,null))[_0x783f('0x23')](saveUpdates(_0x4ad737[_0x783f('0x4a')],null))[_0x783f('0x23')](respondWithResult(_0x3da36f,null))[_0x783f('0x48')](handleError(_0x3da36f,null));};exports[_0x783f('0x4c')]=function(_0x566aad,_0x203dfa){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x566aad[_0x783f('0x44')]['id']}})[_0x783f('0x23')](handleEntityNotFound(_0x203dfa,null))[_0x783f('0x23')](removeEntity(_0x203dfa,null))[_0x783f('0x48')](handleError(_0x203dfa,null));};exports[_0x783f('0x4d')]=function(_0x36b5a0,_0x331168,_0xe96ff0){var _0x1a5f9b={};var _0x5e6581={};var _0x18194f;var _0x1060ec;return db[_0x783f('0x2b')][_0x783f('0x4e')]({'where':{'id':_0x36b5a0[_0x783f('0x44')]['id']}})['then'](handleEntityNotFound(_0x331168,null))[_0x783f('0x23')](function(_0x30435e){if(_0x30435e){_0x18194f=_0x30435e;_0x5e6581[_0x783f('0x34')]=_[_0x783f('0x30')](db[_0x783f('0x4f')]['rawAttributes']);_0x5e6581[_0x783f('0x2f')]=_[_0x783f('0x30')](_0x36b5a0[_0x783f('0x2f')]);_0x5e6581['filters']=_[_0x783f('0x32')](_0x5e6581[_0x783f('0x34')],_0x5e6581[_0x783f('0x2f')]);_0x1a5f9b[_0x783f('0x33')]=_['intersection'](_0x5e6581['model'],qs[_0x783f('0x35')](_0x36b5a0[_0x783f('0x2f')][_0x783f('0x35')]));_0x1a5f9b[_0x783f('0x33')]=_0x1a5f9b[_0x783f('0x33')][_0x783f('0x45')]?_0x1a5f9b[_0x783f('0x33')]:_0x5e6581[_0x783f('0x34')];_0x1a5f9b[_0x783f('0x37')]=qs['sort'](_0x36b5a0[_0x783f('0x2f')][_0x783f('0x38')]);_0x1a5f9b[_0x783f('0x39')]=qs[_0x783f('0x31')](_[_0x783f('0x3a')](_0x36b5a0['query'],_0x5e6581['filters']));if(_0x36b5a0[_0x783f('0x2f')][_0x783f('0x3b')]){_0x1a5f9b[_0x783f('0x39')]=_['merge'](_0x1a5f9b[_0x783f('0x39')],{'$or':_['map'](_0x1a5f9b[_0x783f('0x33')],function(_0x49b40c){var _0x237aac={};_0x237aac[_0x49b40c]={'$like':'%'+_0x36b5a0['query'][_0x783f('0x3b')]+'%'};return _0x237aac;})});}_0x1a5f9b=_[_0x783f('0x3c')]({},_0x1a5f9b,_0x36b5a0[_0x783f('0x3f')]);return _0x18194f['getFields'](_0x1a5f9b);}})[_0x783f('0x23')](function(_0xc0b57a){if(_0xc0b57a){_0x1060ec=_0xc0b57a[_0x783f('0x45')];if(!_0x36b5a0[_0x783f('0x2f')][_0x783f('0x36')](_0x783f('0x50'))){_0x1a5f9b['limit']=qs['limit'](_0x36b5a0['query'][_0x783f('0x1d')]);_0x1a5f9b[_0x783f('0x1b')]=qs[_0x783f('0x1b')](_0x36b5a0[_0x783f('0x2f')][_0x783f('0x1b')]);}return _0x18194f[_0x783f('0x4d')](_0x1a5f9b);}})[_0x783f('0x23')](function(_0x3d2e33){if(_0x3d2e33){return _0x3d2e33?{'count':_0x1060ec,'rows':_0x3d2e33}:null;}})[_0x783f('0x23')](respondWithResult(_0x331168,null))['catch'](handleError(_0x331168,null));};exports['getSubjects']=function(_0x811f9d,_0xebc2b2,_0x3a6178){var _0x3b4344={};var _0x37ab7a={};var _0x5a7d51;var _0xb209bf;return db['FreshdeskConfiguration'][_0x783f('0x4e')]({'where':{'id':_0x811f9d[_0x783f('0x44')]['id']}})[_0x783f('0x23')](handleEntityNotFound(_0xebc2b2,null))[_0x783f('0x23')](function(_0x5460c8){if(_0x5460c8){_0x5a7d51=_0x5460c8;_0x37ab7a[_0x783f('0x34')]=_[_0x783f('0x30')](db[_0x783f('0x4f')][_0x783f('0x2c')]);_0x37ab7a['query']=_['keys'](_0x811f9d[_0x783f('0x2f')]);_0x37ab7a[_0x783f('0x31')]=_[_0x783f('0x32')](_0x37ab7a[_0x783f('0x34')],_0x37ab7a[_0x783f('0x2f')]);_0x3b4344['attributes']=_[_0x783f('0x32')](_0x37ab7a[_0x783f('0x34')],qs['fields'](_0x811f9d['query'][_0x783f('0x35')]));_0x3b4344['attributes']=_0x3b4344[_0x783f('0x33')][_0x783f('0x45')]?_0x3b4344[_0x783f('0x33')]:_0x37ab7a['model'];_0x3b4344[_0x783f('0x37')]=qs[_0x783f('0x38')](_0x811f9d['query'][_0x783f('0x38')]);_0x3b4344[_0x783f('0x39')]=qs[_0x783f('0x31')](_[_0x783f('0x3a')](_0x811f9d['query'],_0x37ab7a[_0x783f('0x31')]));if(_0x811f9d[_0x783f('0x2f')][_0x783f('0x3b')]){_0x3b4344[_0x783f('0x39')]=_[_0x783f('0x3c')](_0x3b4344[_0x783f('0x39')],{'$or':_['map'](_0x3b4344['attributes'],function(_0x266724){var _0x3c2929={};_0x3c2929[_0x266724]={'$like':'%'+_0x811f9d['query'][_0x783f('0x3b')]+'%'};return _0x3c2929;})});}_0x3b4344=_[_0x783f('0x3c')]({},_0x3b4344,_0x811f9d[_0x783f('0x3f')]);return _0x5a7d51['getSubjects'](_0x3b4344);}})[_0x783f('0x23')](function(_0x3d99f6){if(_0x3d99f6){_0xb209bf=_0x3d99f6[_0x783f('0x45')];if(!_0x811f9d[_0x783f('0x2f')][_0x783f('0x36')]('nolimit')){_0x3b4344[_0x783f('0x1d')]=qs[_0x783f('0x1d')](_0x811f9d[_0x783f('0x2f')][_0x783f('0x1d')]);_0x3b4344['offset']=qs['offset'](_0x811f9d['query'][_0x783f('0x1b')]);}return _0x5a7d51[_0x783f('0x51')](_0x3b4344);}})[_0x783f('0x23')](function(_0x316fd8){if(_0x316fd8){return _0x316fd8?{'count':_0xb209bf,'rows':_0x316fd8}:null;}})[_0x783f('0x23')](respondWithResult(_0xebc2b2,null))[_0x783f('0x48')](handleError(_0xebc2b2,null));};exports[_0x783f('0x52')]=function(_0x2a5301,_0x3341c5,_0x49f7ec){var _0x550d56={};var _0x27ac0e={};var _0xae9633;var _0x39c42f;return db[_0x783f('0x2b')][_0x783f('0x4e')]({'where':{'id':_0x2a5301[_0x783f('0x44')]['id']}})[_0x783f('0x23')](handleEntityNotFound(_0x3341c5,null))['then'](function(_0xc6fc96){if(_0xc6fc96){_0xae9633=_0xc6fc96;_0x27ac0e[_0x783f('0x34')]=_[_0x783f('0x30')](db['FreshdeskField'][_0x783f('0x2c')]);_0x27ac0e[_0x783f('0x2f')]=_[_0x783f('0x30')](_0x2a5301['query']);_0x27ac0e[_0x783f('0x31')]=_[_0x783f('0x32')](_0x27ac0e[_0x783f('0x34')],_0x27ac0e['query']);_0x550d56['attributes']=_[_0x783f('0x32')](_0x27ac0e['model'],qs[_0x783f('0x35')](_0x2a5301[_0x783f('0x2f')][_0x783f('0x35')]));_0x550d56[_0x783f('0x33')]=_0x550d56['attributes'][_0x783f('0x45')]?_0x550d56[_0x783f('0x33')]:_0x27ac0e[_0x783f('0x34')];_0x550d56[_0x783f('0x37')]=qs[_0x783f('0x38')](_0x2a5301[_0x783f('0x2f')][_0x783f('0x38')]);_0x550d56[_0x783f('0x39')]=qs['filters'](_[_0x783f('0x3a')](_0x2a5301[_0x783f('0x2f')],_0x27ac0e[_0x783f('0x31')]));if(_0x2a5301[_0x783f('0x2f')][_0x783f('0x3b')]){_0x550d56[_0x783f('0x39')]=_['merge'](_0x550d56['where'],{'$or':_[_0x783f('0x2a')](_0x550d56['attributes'],function(_0x48917e){var _0x12e91d={};_0x12e91d[_0x48917e]={'$like':'%'+_0x2a5301['query'][_0x783f('0x3b')]+'%'};return _0x12e91d;})});}_0x550d56=_[_0x783f('0x3c')]({},_0x550d56,_0x2a5301[_0x783f('0x3f')]);return _0xae9633[_0x783f('0x52')](_0x550d56);}})[_0x783f('0x23')](function(_0x33d4c5){if(_0x33d4c5){_0x39c42f=_0x33d4c5[_0x783f('0x45')];if(!_0x2a5301[_0x783f('0x2f')][_0x783f('0x36')](_0x783f('0x50'))){_0x550d56[_0x783f('0x1d')]=qs[_0x783f('0x1d')](_0x2a5301[_0x783f('0x2f')][_0x783f('0x1d')]);_0x550d56[_0x783f('0x1b')]=qs[_0x783f('0x1b')](_0x2a5301[_0x783f('0x2f')][_0x783f('0x1b')]);}return _0xae9633[_0x783f('0x52')](_0x550d56);}})['then'](function(_0x557dc5){if(_0x557dc5){return _0x557dc5?{'count':_0x39c42f,'rows':_0x557dc5}:null;}})[_0x783f('0x23')](respondWithResult(_0x3341c5,null))[_0x783f('0x48')](handleError(_0x3341c5,null));};exports[_0x783f('0x53')]=function(_0x55ec30,_0x17dc53,_0x22fb6a){var _0x1c3ddf={};var _0x4cb73a={};var _0x41d4bb;var _0x476f9c;return db[_0x783f('0x2b')][_0x783f('0x4e')]({'where':{'id':_0x55ec30[_0x783f('0x44')]['id']}})[_0x783f('0x23')](handleEntityNotFound(_0x17dc53,null))[_0x783f('0x23')](function(_0x45d693){if(_0x45d693){_0x41d4bb=_0x45d693;_0x4cb73a[_0x783f('0x34')]=_[_0x783f('0x30')](db[_0x783f('0x54')]['rawAttributes']);_0x4cb73a['query']=_[_0x783f('0x30')](_0x55ec30[_0x783f('0x2f')]);_0x4cb73a[_0x783f('0x31')]=_['intersection'](_0x4cb73a[_0x783f('0x34')],_0x4cb73a[_0x783f('0x2f')]);_0x1c3ddf[_0x783f('0x33')]=_['intersection'](_0x4cb73a['model'],qs[_0x783f('0x35')](_0x55ec30['query'][_0x783f('0x35')]));_0x1c3ddf[_0x783f('0x33')]=_0x1c3ddf['attributes']['length']?_0x1c3ddf[_0x783f('0x33')]:_0x4cb73a['model'];_0x1c3ddf[_0x783f('0x37')]=qs['sort'](_0x55ec30[_0x783f('0x2f')][_0x783f('0x38')]);_0x1c3ddf[_0x783f('0x39')]=qs[_0x783f('0x31')](_['pick'](_0x55ec30[_0x783f('0x2f')],_0x4cb73a[_0x783f('0x31')]));if(_0x55ec30[_0x783f('0x2f')]['filter']){_0x1c3ddf[_0x783f('0x39')]=_[_0x783f('0x3c')](_0x1c3ddf['where'],{'$or':_[_0x783f('0x2a')](_0x1c3ddf[_0x783f('0x33')],function(_0x33caf6){var _0x1e7a57={};_0x1e7a57[_0x33caf6]={'$like':'%'+_0x55ec30['query'][_0x783f('0x3b')]+'%'};return _0x1e7a57;})});}_0x1c3ddf=_[_0x783f('0x3c')]({},_0x1c3ddf,_0x55ec30[_0x783f('0x3f')]);return _0x41d4bb['getTags'](_0x1c3ddf);}})[_0x783f('0x23')](function(_0x2dd044){if(_0x2dd044){_0x476f9c=_0x2dd044[_0x783f('0x45')];if(!_0x55ec30[_0x783f('0x2f')][_0x783f('0x36')]('nolimit')){_0x1c3ddf[_0x783f('0x1d')]=qs[_0x783f('0x1d')](_0x55ec30[_0x783f('0x2f')][_0x783f('0x1d')]);_0x1c3ddf['offset']=qs[_0x783f('0x1b')](_0x55ec30[_0x783f('0x2f')][_0x783f('0x1b')]);}return _0x41d4bb[_0x783f('0x53')](_0x1c3ddf);}})['then'](function(_0x26a307){if(_0x26a307){return _0x26a307?{'count':_0x476f9c,'rows':_0x26a307}:null;}})[_0x783f('0x23')](respondWithResult(_0x17dc53,null))['catch'](handleError(_0x17dc53,null));};exports[_0x783f('0x55')]=function(_0x242dde,_0xd895a4,_0x3122d8){if(_0x242dde[_0x783f('0x4a')]['id']){delete _0x242dde[_0x783f('0x4a')]['id'];}return db[_0x783f('0x2b')][_0x783f('0x4e')]({'where':{'id':_0x242dde[_0x783f('0x44')]['id']}})[_0x783f('0x23')](handleEntityNotFound(_0xd895a4,null))[_0x783f('0x23')](function(_0x46fc16){if(_0x46fc16){return _0x46fc16[_0x783f('0x55')](_0x242dde['body'][_0x783f('0x56')]||[]);}return null;})[_0x783f('0x23')](respondWithResult(_0xd895a4,null))[_0x783f('0x48')](handleError(_0xd895a4,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index d85b3a2..6511db5 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 _0xb08c=['FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','bluebird','rimraf','exports','define'];(function(_0x340756,_0xad31ae){var _0x2ef745=function(_0x59ffde){while(--_0x59ffde){_0x340756['push'](_0x340756['shift']());}};_0x2ef745(++_0xad31ae);}(_0xb08c,0xc8));var _0xcb08=function(_0x2144ad,_0x1a860f){_0x2144ad=_0x2144ad-0x0;var _0x424ec2=_0xb08c[_0x2144ad];return _0x424ec2;};'use strict';var _=require(_0xcb08('0x0'));var util=require(_0xcb08('0x1'));var logger=require(_0xcb08('0x2'))('api');var moment=require('moment');var BPromise=require(_0xcb08('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcb08('0x4'));var config=require('../../config/environment');var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xcb08('0x5')]=function(_0x316058,_0x5e4521){return _0x316058[_0xcb08('0x6')](_0xcb08('0x7'),attributes,{'tableName':_0xcb08('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x21b7=['exports','define','int_freshdesk_configurations','lodash','api','moment','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x1fc61d,_0x41f348){var _0x35bd7c=function(_0x280392){while(--_0x280392){_0x1fc61d['push'](_0x1fc61d['shift']());}};_0x35bd7c(++_0x41f348);}(_0x21b7,0x85));var _0x721b=function(_0xd13990,_0x443289){_0xd13990=_0xd13990-0x0;var _0x414c72=_0x21b7[_0xd13990];return _0x414c72;};'use strict';var _=require(_0x721b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x721b('0x1'));var moment=require(_0x721b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x721b('0x3'));var rimraf=require(_0x721b('0x4'));var config=require(_0x721b('0x5'));var attributes=require(_0x721b('0x6'));module[_0x721b('0x7')]=function(_0x56656f,_0x1a56df){return _0x56656f[_0x721b('0x8')]('FreshdeskConfiguration',attributes,{'tableName':_0x721b('0x9'),'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 287223d..a5114b1 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 _0xe8e8=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment'];(function(_0x2401fc,_0xbc7845){var _0x23bb42=function(_0x45a8e9){while(--_0x45a8e9){_0x2401fc['push'](_0x2401fc['shift']());}};_0x23bb42(++_0xbc7845);}(_0xe8e8,0x1e1));var _0x8e8e=function(_0x5b264c,_0x1c41f6){_0x5b264c=_0x5b264c-0x0;var _0x77946e=_0xe8e8[_0x5b264c];return _0x77946e;};'use strict';var _=require(_0x8e8e('0x0'));var util=require(_0x8e8e('0x1'));var moment=require(_0x8e8e('0x2'));var BPromise=require(_0x8e8e('0x3'));var rs=require(_0x8e8e('0x4'));var fs=require('fs');var Redis=require(_0x8e8e('0x5'));var db=require(_0x8e8e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8e8e('0x7'))(_0x8e8e('0x8'));var config=require(_0x8e8e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8e8e('0xa')][_0x8e8e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10e4d5,_0x134045,_0x25b858){return new BPromise(function(_0x36f103,_0xf28aef){return client[_0x8e8e('0xc')](_0x10e4d5,_0x25b858)[_0x8e8e('0xd')](function(_0x2957f3){logger[_0x8e8e('0xe')](_0x8e8e('0xf'),_0x134045,_0x8e8e('0x10'));logger['debug'](_0x8e8e('0x11'),_0x134045,_0x8e8e('0x10'),JSON[_0x8e8e('0x12')](_0x2957f3));if(_0x2957f3[_0x8e8e('0x13')]){if(_0x2957f3[_0x8e8e('0x13')]['code']===0x1f4){logger[_0x8e8e('0x13')](_0x8e8e('0xf'),_0x134045,_0x2957f3[_0x8e8e('0x13')][_0x8e8e('0x14')]);return _0xf28aef(_0x2957f3[_0x8e8e('0x13')][_0x8e8e('0x14')]);}logger[_0x8e8e('0x13')](_0x8e8e('0xf'),_0x134045,_0x2957f3[_0x8e8e('0x13')][_0x8e8e('0x14')]);return _0x36f103(_0x2957f3[_0x8e8e('0x13')][_0x8e8e('0x14')]);}else{logger[_0x8e8e('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x134045,'request\x20sent');_0x36f103(_0x2957f3[_0x8e8e('0x15')]['message']);}})['catch'](function(_0x5492c5){logger[_0x8e8e('0x13')](_0x8e8e('0xf'),_0x134045,_0x5492c5);_0xf28aef(_0x5492c5);});});} \ No newline at end of file +var _0x8b88=['FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','stringify','error','code'];(function(_0x449706,_0x5a3e7f){var _0x34cd72=function(_0x8985be){while(--_0x8985be){_0x449706['push'](_0x449706['shift']());}};_0x34cd72(++_0x5a3e7f);}(_0x8b88,0xf4));var _0x88b8=function(_0x28548d,_0x435d62){_0x28548d=_0x28548d-0x0;var _0x147dae=_0x8b88[_0x28548d];return _0x147dae;};'use strict';var _=require('lodash');var util=require(_0x88b8('0x0'));var moment=require(_0x88b8('0x1'));var BPromise=require(_0x88b8('0x2'));var rs=require(_0x88b8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x88b8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x88b8('0x5'))('rpc');var config=require(_0x88b8('0x6'));var jayson=require(_0x88b8('0x7'));var client=jayson[_0x88b8('0x8')][_0x88b8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf50f44,_0x3d773b,_0x43f01f){return new BPromise(function(_0x1d23ff,_0x53d379){return client[_0x88b8('0xa')](_0xf50f44,_0x43f01f)['then'](function(_0x2abaa2){logger[_0x88b8('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3d773b,_0x88b8('0xc'));logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3d773b,_0x88b8('0xc'),JSON[_0x88b8('0xd')](_0x2abaa2));if(_0x2abaa2['error']){if(_0x2abaa2[_0x88b8('0xe')][_0x88b8('0xf')]===0x1f4){logger[_0x88b8('0xe')](_0x88b8('0x10'),_0x3d773b,_0x2abaa2[_0x88b8('0xe')][_0x88b8('0x11')]);return _0x53d379(_0x2abaa2[_0x88b8('0xe')][_0x88b8('0x11')]);}logger[_0x88b8('0xe')](_0x88b8('0x10'),_0x3d773b,_0x2abaa2[_0x88b8('0xe')]['message']);return _0x1d23ff(_0x2abaa2[_0x88b8('0xe')][_0x88b8('0x11')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x3d773b,_0x88b8('0xc'));_0x1d23ff(_0x2abaa2[_0x88b8('0x12')]['message']);}})[_0x88b8('0x13')](function(_0x51a5bc){logger['error'](_0x88b8('0x10'),_0x3d773b,_0x51a5bc);_0x53d379(_0x51a5bc);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 1d4605c..5c689a7 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 _0x051f=['index','/:id','show','post','isAuthenticated','create','put','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get'];(function(_0x55b946,_0x30bede){var _0x538666=function(_0x11bf06){while(--_0x11bf06){_0x55b946['push'](_0x55b946['shift']());}};_0x538666(++_0x30bede);}(_0x051f,0x10e));var _0xf051=function(_0x3b997a,_0x2f49ae){_0x3b997a=_0x3b997a-0x0;var _0x50b740=_0x051f[_0x3b997a];return _0x50b740;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf051('0x0'));var timeout=require(_0xf051('0x1'));var express=require(_0xf051('0x2'));var router=express[_0xf051('0x3')]();var fs_extra=require(_0xf051('0x4'));var auth=require(_0xf051('0x5'));var interaction=require(_0xf051('0x6'));var config=require(_0xf051('0x7'));var controller=require(_0xf051('0x8'));router[_0xf051('0x9')]('/',auth['isAuthenticated'](),controller[_0xf051('0xa')]);router[_0xf051('0x9')](_0xf051('0xb'),auth['isAuthenticated'](),controller[_0xf051('0xc')]);router[_0xf051('0xd')]('/',auth[_0xf051('0xe')](),controller[_0xf051('0xf')]);router[_0xf051('0x10')](_0xf051('0xb'),auth[_0xf051('0xe')](),controller[_0xf051('0x11')]);router[_0xf051('0x12')](_0xf051('0xb'),auth[_0xf051('0xe')](),controller['destroy']);module[_0xf051('0x13')]=router; \ No newline at end of file +var _0xf6ed=['fs-extra','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','get','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3f5e08,_0x25569a){var _0x487731=function(_0x191731){while(--_0x191731){_0x3f5e08['push'](_0x3f5e08['shift']());}};_0x487731(++_0x25569a);}(_0xf6ed,0x140));var _0xdf6e=function(_0x37e654,_0x5efb4f){_0x37e654=_0x37e654-0x0;var _0x466bcf=_0xf6ed[_0x37e654];return _0x466bcf;};'use strict';var multer=require(_0xdf6e('0x0'));var util=require(_0xdf6e('0x1'));var path=require(_0xdf6e('0x2'));var timeout=require(_0xdf6e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdf6e('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdf6e('0x5'));var controller=require(_0xdf6e('0x6'));router['get']('/',auth[_0xdf6e('0x7')](),controller[_0xdf6e('0x8')]);router[_0xdf6e('0x9')](_0xdf6e('0xa'),auth['isAuthenticated'](),controller[_0xdf6e('0xb')]);router[_0xdf6e('0xc')]('/',auth[_0xdf6e('0x7')](),controller[_0xdf6e('0xd')]);router[_0xdf6e('0xe')]('/:id',auth[_0xdf6e('0x7')](),controller['update']);router[_0xdf6e('0xf')]('/:id',auth[_0xdf6e('0x7')](),controller[_0xdf6e('0x10')]);module[_0xdf6e('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index f17988d..7071a49 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 _0x0362=['customVariable','keyValue','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable'];(function(_0x456766,_0x53c8eb){var _0xd39fa=function(_0x124824){while(--_0x124824){_0x456766['push'](_0x456766['shift']());}};_0xd39fa(++_0x53c8eb);}(_0x0362,0xe6));var _0x2036=function(_0x4a1fad,_0x24f3c5){_0x4a1fad=_0x4a1fad-0x0;var _0x33deda=_0x0362[_0x4a1fad];return _0x33deda;};'use strict';var Sequelize=require(_0x2036('0x0'));module[_0x2036('0x1')]={'type':{'type':Sequelize['ENUM'](_0x2036('0x2'),_0x2036('0x3'),_0x2036('0x4'),_0x2036('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x2036('0x6')]},'key':{'type':Sequelize[_0x2036('0x6')]},'keyType':{'type':Sequelize[_0x2036('0x7')](_0x2036('0x2'),'variable',_0x2036('0x4'))},'keyContent':{'type':Sequelize[_0x2036('0x6')]},'idField':{'type':Sequelize[_0x2036('0x6')]},'nameField':{'type':Sequelize[_0x2036('0x6')]},'customField':{'type':Sequelize[_0x2036('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2036('0x6')]}}; \ No newline at end of file +var _0x8d6f=['customVariable','keyValue','picklist','string','STRING','BOOLEAN','exports','ENUM','variable'];(function(_0x3bc7a0,_0x9a38d8){var _0x34322e=function(_0x2cbafc){while(--_0x2cbafc){_0x3bc7a0['push'](_0x3bc7a0['shift']());}};_0x34322e(++_0x9a38d8);}(_0x8d6f,0x138));var _0xf8d6=function(_0x206960,_0x5c5b16){_0x206960=_0x206960-0x0;var _0x60ace5=_0x8d6f[_0x206960];return _0x60ace5;};'use strict';var Sequelize=require('sequelize');module[_0xf8d6('0x0')]={'type':{'type':Sequelize[_0xf8d6('0x1')]('string',_0xf8d6('0x2'),_0xf8d6('0x3'),_0xf8d6('0x4'),_0xf8d6('0x5')),'defaultValue':_0xf8d6('0x6')},'content':{'type':Sequelize[_0xf8d6('0x7')]},'key':{'type':Sequelize[_0xf8d6('0x7')]},'keyType':{'type':Sequelize[_0xf8d6('0x1')](_0xf8d6('0x6'),_0xf8d6('0x2'),_0xf8d6('0x3'))},'keyContent':{'type':Sequelize[_0xf8d6('0x7')]},'idField':{'type':Sequelize[_0xf8d6('0x7')]},'nameField':{'type':Sequelize[_0xf8d6('0x7')]},'customField':{'type':Sequelize[_0xf8d6('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf8d6('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 8dcbf46..1ab3e50 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 _0x422f=['update','destroy','then','error','stack','name','map','FreshdeskField','fieldName','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','type','VIRTUAL','findAll','rows','show','params','rawAttributes','length','includeAll','include','merge','options','find','body','catch','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','apply','reject','save'];(function(_0x4d08b8,_0x34c445){var _0x70214a=function(_0x4db67c){while(--_0x4db67c){_0x4d08b8['push'](_0x4d08b8['shift']());}};_0x70214a(++_0x34c445);}(_0x422f,0x1c7));var _0xf422=function(_0x1809c5,_0x46cabc){_0x1809c5=_0x1809c5-0x0;var _0x5254a4=_0x422f[_0x1809c5];return _0x5254a4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf422('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf422('0x1'));var rp=require(_0xf422('0x2'));var moment=require('moment');var BPromise=require(_0xf422('0x3'));var Mustache=require(_0xf422('0x4'));var util=require(_0xf422('0x5'));var path=require(_0xf422('0x6'));var sox=require(_0xf422('0x7'));var csv=require(_0xf422('0x8'));var ejs=require(_0xf422('0x9'));var fs=require('fs');var fs_extra=require(_0xf422('0xa'));var _=require(_0xf422('0xb'));var squel=require('squel');var crypto=require(_0xf422('0xc'));var jsforce=require(_0xf422('0xd'));var deskjs=require(_0xf422('0xe'));var toCsv=require(_0xf422('0x8'));var querystring=require(_0xf422('0xf'));var Papa=require('papaparse');var Redis=require(_0xf422('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf422('0x11'));var hardwareService=require(_0xf422('0x12'));var logger=require(_0xf422('0x13'))(_0xf422('0x14'));var utils=require(_0xf422('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf422('0x16'));var db=require(_0xf422('0x17'))['db'];function respondWithStatusCode(_0x4d56d1,_0x133a6a){_0x133a6a=_0x133a6a||0xcc;return function(_0x8aa9cc){if(_0x8aa9cc){return _0x4d56d1[_0xf422('0x18')](_0x133a6a);}return _0x4d56d1[_0xf422('0x19')](_0x133a6a)[_0xf422('0x1a')]();};}function respondWithResult(_0x28a6a8,_0x223b21){_0x223b21=_0x223b21||0xc8;return function(_0x272430){if(_0x272430){return _0x28a6a8[_0xf422('0x19')](_0x223b21)['json'](_0x272430);}};}function respondWithFilteredResult(_0x54bb9c,_0x52f96b){return function(_0x1c81e1){if(_0x1c81e1){var _0x30b70a=typeof _0x52f96b[_0xf422('0x1b')]===_0xf422('0x1c')&&typeof _0x52f96b['limit']===_0xf422('0x1c');var _0x264964=_0x1c81e1[_0xf422('0x1d')];var _0x2ae133=_0x30b70a?0x0:_0x52f96b[_0xf422('0x1b')];var _0x29b0b1=_0x30b70a?_0x1c81e1['count']:_0x52f96b['offset']+_0x52f96b[_0xf422('0x1e')];var _0x4b657;if(_0x29b0b1>=_0x264964){_0x29b0b1=_0x264964;_0x4b657=0xc8;}else{_0x4b657=0xce;}_0x54bb9c[_0xf422('0x19')](_0x4b657);return _0x54bb9c['set'](_0xf422('0x1f'),_0x2ae133+'-'+_0x29b0b1+'/'+_0x264964)['json'](_0x1c81e1);}return null;};}function patchUpdates(_0x22afe7){return function(_0x15833b){try{jsonpatch[_0xf422('0x20')](_0x15833b,_0x22afe7,!![]);}catch(_0x4d6717){return BPromise[_0xf422('0x21')](_0x4d6717);}return _0x15833b[_0xf422('0x22')]();};}function saveUpdates(_0x511529,_0x4b80a0){return function(_0x268575){if(_0x268575){return _0x268575[_0xf422('0x23')](_0x511529)['then'](function(_0x25b6a5){return _0x25b6a5;});}return null;};}function removeEntity(_0x570ea2,_0x3b21a5){return function(_0x32ceee){if(_0x32ceee){return _0x32ceee[_0xf422('0x24')]()[_0xf422('0x25')](function(){_0x570ea2[_0xf422('0x19')](0xcc)[_0xf422('0x1a')]();});}};}function handleEntityNotFound(_0xd8d70f,_0x11d10b){return function(_0x5dcab4){if(!_0x5dcab4){_0xd8d70f[_0xf422('0x18')](0x194);}return _0x5dcab4;};}function handleError(_0x59d03d,_0x2f0f9f){_0x2f0f9f=_0x2f0f9f||0x1f4;return function(_0x7d36e7){logger[_0xf422('0x26')](_0x7d36e7[_0xf422('0x27')]);if(_0x7d36e7[_0xf422('0x28')]){delete _0x7d36e7[_0xf422('0x28')];}_0x59d03d[_0xf422('0x19')](_0x2f0f9f)['send'](_0x7d36e7);};}exports['index']=function(_0x35d1fa,_0x10d51b){var _0x266fb8={},_0x33ef63={},_0xefb99e={'count':0x0,'rows':[]};var _0x48e0c7=_[_0xf422('0x29')](db[_0xf422('0x2a')]['rawAttributes'],function(_0x5f0186){return{'name':_0x5f0186[_0xf422('0x2b')],'type':_0x5f0186['type']['key']};});_0x33ef63[_0xf422('0x2c')]=_[_0xf422('0x29')](_0x48e0c7,'name');_0x33ef63[_0xf422('0x2d')]=_[_0xf422('0x2e')](_0x35d1fa[_0xf422('0x2d')]);_0x33ef63[_0xf422('0x2f')]=_[_0xf422('0x30')](_0x33ef63['model'],_0x33ef63[_0xf422('0x2d')]);_0x266fb8['attributes']=_[_0xf422('0x30')](_0x33ef63[_0xf422('0x2c')],qs[_0xf422('0x31')](_0x35d1fa[_0xf422('0x2d')][_0xf422('0x31')]));_0x266fb8[_0xf422('0x32')]=_0x266fb8[_0xf422('0x32')]['length']?_0x266fb8['attributes']:_0x33ef63[_0xf422('0x2c')];if(!_0x35d1fa[_0xf422('0x2d')]['hasOwnProperty'](_0xf422('0x33'))){_0x266fb8[_0xf422('0x1e')]=qs[_0xf422('0x1e')](_0x35d1fa[_0xf422('0x2d')][_0xf422('0x1e')]);_0x266fb8[_0xf422('0x1b')]=qs[_0xf422('0x1b')](_0x35d1fa[_0xf422('0x2d')][_0xf422('0x1b')]);}_0x266fb8[_0xf422('0x34')]=qs[_0xf422('0x35')](_0x35d1fa[_0xf422('0x2d')][_0xf422('0x35')]);_0x266fb8[_0xf422('0x36')]=qs['filters'](_['pick'](_0x35d1fa['query'],_0x33ef63[_0xf422('0x2f')]),_0x48e0c7);if(_0x35d1fa[_0xf422('0x2d')]['filter']){_0x266fb8[_0xf422('0x36')]=_['merge'](_0x266fb8[_0xf422('0x36')],{'$or':_[_0xf422('0x29')](_0x48e0c7,function(_0x55ac68){if(_0x55ac68[_0xf422('0x37')]!==_0xf422('0x38')){var _0x174f6f={};_0x174f6f[_0x55ac68['name']]={'$like':'%'+_0x35d1fa[_0xf422('0x2d')]['filter']+'%'};return _0x174f6f;}})});}_0x266fb8=_['merge']({},_0x266fb8,_0x35d1fa['options']);var _0x112bce={'where':_0x266fb8[_0xf422('0x36')]};return db[_0xf422('0x2a')][_0xf422('0x1d')](_0x112bce)[_0xf422('0x25')](function(_0x2f82a0){_0xefb99e[_0xf422('0x1d')]=_0x2f82a0;if(_0x35d1fa[_0xf422('0x2d')]['includeAll']){_0x266fb8['include']=[{'all':!![]}];}return db[_0xf422('0x2a')][_0xf422('0x39')](_0x266fb8);})[_0xf422('0x25')](function(_0xb3955){_0xefb99e[_0xf422('0x3a')]=_0xb3955;return _0xefb99e;})[_0xf422('0x25')](respondWithFilteredResult(_0x10d51b,_0x266fb8))['catch'](handleError(_0x10d51b,null));};exports[_0xf422('0x3b')]=function(_0x4f453a,_0x17c1f2){var _0x391e3c={'raw':!![],'where':{'id':_0x4f453a[_0xf422('0x3c')]['id']}},_0x564041={};_0x564041[_0xf422('0x2c')]=_[_0xf422('0x2e')](db[_0xf422('0x2a')][_0xf422('0x3d')]);_0x564041['query']=_[_0xf422('0x2e')](_0x4f453a[_0xf422('0x2d')]);_0x564041[_0xf422('0x2f')]=_[_0xf422('0x30')](_0x564041[_0xf422('0x2c')],_0x564041['query']);_0x391e3c[_0xf422('0x32')]=_[_0xf422('0x30')](_0x564041['model'],qs[_0xf422('0x31')](_0x4f453a['query'][_0xf422('0x31')]));_0x391e3c[_0xf422('0x32')]=_0x391e3c[_0xf422('0x32')][_0xf422('0x3e')]?_0x391e3c[_0xf422('0x32')]:_0x564041[_0xf422('0x2c')];if(_0x4f453a[_0xf422('0x2d')][_0xf422('0x3f')]){_0x391e3c[_0xf422('0x40')]=[{'all':!![]}];}_0x391e3c=_[_0xf422('0x41')]({},_0x391e3c,_0x4f453a[_0xf422('0x42')]);return db[_0xf422('0x2a')][_0xf422('0x43')](_0x391e3c)[_0xf422('0x25')](handleEntityNotFound(_0x17c1f2,null))[_0xf422('0x25')](respondWithResult(_0x17c1f2,null))['catch'](handleError(_0x17c1f2,null));};exports['create']=function(_0x3c59dd,_0x2c2ce9){return db[_0xf422('0x2a')]['create'](_0x3c59dd[_0xf422('0x44')],{})[_0xf422('0x25')](respondWithResult(_0x2c2ce9,0xc9))[_0xf422('0x45')](handleError(_0x2c2ce9,null));};exports[_0xf422('0x23')]=function(_0x1f3a30,_0x259e24){if(_0x1f3a30[_0xf422('0x44')]['id']){delete _0x1f3a30['body']['id'];}return db[_0xf422('0x2a')]['find']({'where':{'id':_0x1f3a30[_0xf422('0x3c')]['id']}})[_0xf422('0x25')](handleEntityNotFound(_0x259e24,null))['then'](saveUpdates(_0x1f3a30[_0xf422('0x44')],null))[_0xf422('0x25')](respondWithResult(_0x259e24,null))[_0xf422('0x45')](handleError(_0x259e24,null));};exports[_0xf422('0x24')]=function(_0x2df71a,_0x5c3cb8){return db['FreshdeskField'][_0xf422('0x43')]({'where':{'id':_0x2df71a['params']['id']}})[_0xf422('0x25')](handleEntityNotFound(_0x5c3cb8,null))[_0xf422('0x25')](removeEntity(_0x5c3cb8,null))[_0xf422('0x45')](handleError(_0x5c3cb8,null));}; \ No newline at end of file +var _0xc6d8=['params','find','create','body','update','eml-format','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','destroy','error','stack','name','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','then','includeAll','include','findAll','catch','show'];(function(_0x50b568,_0x54e916){var _0x1a58f7=function(_0xd20f2e){while(--_0xd20f2e){_0x50b568['push'](_0x50b568['shift']());}};_0x1a58f7(++_0x54e916);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x18ebf5,_0x5889ea){_0x18ebf5=_0x18ebf5-0x0;var _0x302a3e=_0xc6d8[_0x18ebf5];return _0x302a3e;};'use strict';var emlformat=require(_0x8c6d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8c6d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c6d('0x2'));var moment=require('moment');var BPromise=require(_0x8c6d('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8c6d('0x4'));var sox=require(_0x8c6d('0x5'));var csv=require(_0x8c6d('0x6'));var ejs=require(_0x8c6d('0x7'));var fs=require('fs');var fs_extra=require(_0x8c6d('0x8'));var _=require(_0x8c6d('0x9'));var squel=require(_0x8c6d('0xa'));var crypto=require('crypto');var jsforce=require(_0x8c6d('0xb'));var deskjs=require(_0x8c6d('0xc'));var toCsv=require(_0x8c6d('0x6'));var querystring=require('querystring');var Papa=require(_0x8c6d('0xd'));var Redis=require(_0x8c6d('0xe'));var authService=require(_0x8c6d('0xf'));var qs=require(_0x8c6d('0x10'));var as=require(_0x8c6d('0x11'));var hardwareService=require(_0x8c6d('0x12'));var logger=require(_0x8c6d('0x13'))(_0x8c6d('0x14'));var utils=require('../../config/utils');var config=require(_0x8c6d('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22d0fb,_0x890e85){_0x890e85=_0x890e85||0xcc;return function(_0x131d97){if(_0x131d97){return _0x22d0fb[_0x8c6d('0x16')](_0x890e85);}return _0x22d0fb[_0x8c6d('0x17')](_0x890e85)[_0x8c6d('0x18')]();};}function respondWithResult(_0x42d746,_0x103699){_0x103699=_0x103699||0xc8;return function(_0x14c1ee){if(_0x14c1ee){return _0x42d746[_0x8c6d('0x17')](_0x103699)['json'](_0x14c1ee);}};}function respondWithFilteredResult(_0x16c6b5,_0x4b2bb1){return function(_0x16af06){if(_0x16af06){var _0x4dd4b6=typeof _0x4b2bb1[_0x8c6d('0x19')]===_0x8c6d('0x1a')&&typeof _0x4b2bb1['limit']===_0x8c6d('0x1a');var _0x2b8a26=_0x16af06['count'];var _0x3e5495=_0x4dd4b6?0x0:_0x4b2bb1['offset'];var _0x4c2f8d=_0x4dd4b6?_0x16af06[_0x8c6d('0x1b')]:_0x4b2bb1['offset']+_0x4b2bb1[_0x8c6d('0x1c')];var _0x174a4f;if(_0x4c2f8d>=_0x2b8a26){_0x4c2f8d=_0x2b8a26;_0x174a4f=0xc8;}else{_0x174a4f=0xce;}_0x16c6b5[_0x8c6d('0x17')](_0x174a4f);return _0x16c6b5[_0x8c6d('0x1d')](_0x8c6d('0x1e'),_0x3e5495+'-'+_0x4c2f8d+'/'+_0x2b8a26)['json'](_0x16af06);}return null;};}function patchUpdates(_0x5512be){return function(_0x550079){try{jsonpatch[_0x8c6d('0x1f')](_0x550079,_0x5512be,!![]);}catch(_0x507e0c){return BPromise[_0x8c6d('0x20')](_0x507e0c);}return _0x550079['save']();};}function saveUpdates(_0x4c378b,_0x37fd7c){return function(_0x8cebeb){if(_0x8cebeb){return _0x8cebeb['update'](_0x4c378b)['then'](function(_0x51bb08){return _0x51bb08;});}return null;};}function removeEntity(_0x47d3a0,_0x2a85b5){return function(_0xd16c91){if(_0xd16c91){return _0xd16c91[_0x8c6d('0x21')]()['then'](function(){_0x47d3a0[_0x8c6d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15a9c4,_0x490b46){return function(_0x23c893){if(!_0x23c893){_0x15a9c4[_0x8c6d('0x16')](0x194);}return _0x23c893;};}function handleError(_0x353ba5,_0x2b6d18){_0x2b6d18=_0x2b6d18||0x1f4;return function(_0x1e6755){logger[_0x8c6d('0x22')](_0x1e6755[_0x8c6d('0x23')]);if(_0x1e6755[_0x8c6d('0x24')]){delete _0x1e6755[_0x8c6d('0x24')];}_0x353ba5['status'](_0x2b6d18)['send'](_0x1e6755);};}exports[_0x8c6d('0x25')]=function(_0x93a094,_0xfc6000){var _0x42a7db={},_0x370626={},_0x316ca7={'count':0x0,'rows':[]};var _0x2bc94a=_[_0x8c6d('0x26')](db[_0x8c6d('0x27')][_0x8c6d('0x28')],function(_0x3375dd){return{'name':_0x3375dd[_0x8c6d('0x29')],'type':_0x3375dd['type'][_0x8c6d('0x2a')]};});_0x370626[_0x8c6d('0x2b')]=_[_0x8c6d('0x26')](_0x2bc94a,_0x8c6d('0x24'));_0x370626[_0x8c6d('0x2c')]=_[_0x8c6d('0x2d')](_0x93a094[_0x8c6d('0x2c')]);_0x370626[_0x8c6d('0x2e')]=_[_0x8c6d('0x2f')](_0x370626['model'],_0x370626[_0x8c6d('0x2c')]);_0x42a7db['attributes']=_[_0x8c6d('0x2f')](_0x370626[_0x8c6d('0x2b')],qs[_0x8c6d('0x30')](_0x93a094[_0x8c6d('0x2c')][_0x8c6d('0x30')]));_0x42a7db[_0x8c6d('0x31')]=_0x42a7db['attributes']['length']?_0x42a7db[_0x8c6d('0x31')]:_0x370626[_0x8c6d('0x2b')];if(!_0x93a094[_0x8c6d('0x2c')][_0x8c6d('0x32')]('nolimit')){_0x42a7db[_0x8c6d('0x1c')]=qs[_0x8c6d('0x1c')](_0x93a094[_0x8c6d('0x2c')][_0x8c6d('0x1c')]);_0x42a7db[_0x8c6d('0x19')]=qs[_0x8c6d('0x19')](_0x93a094['query'][_0x8c6d('0x19')]);}_0x42a7db[_0x8c6d('0x33')]=qs[_0x8c6d('0x34')](_0x93a094[_0x8c6d('0x2c')][_0x8c6d('0x34')]);_0x42a7db[_0x8c6d('0x35')]=qs[_0x8c6d('0x2e')](_[_0x8c6d('0x36')](_0x93a094[_0x8c6d('0x2c')],_0x370626[_0x8c6d('0x2e')]),_0x2bc94a);if(_0x93a094[_0x8c6d('0x2c')][_0x8c6d('0x37')]){_0x42a7db['where']=_[_0x8c6d('0x38')](_0x42a7db[_0x8c6d('0x35')],{'$or':_[_0x8c6d('0x26')](_0x2bc94a,function(_0x454e96){if(_0x454e96[_0x8c6d('0x39')]!=='VIRTUAL'){var _0x26027f={};_0x26027f[_0x454e96[_0x8c6d('0x24')]]={'$like':'%'+_0x93a094['query'][_0x8c6d('0x37')]+'%'};return _0x26027f;}})});}_0x42a7db=_[_0x8c6d('0x38')]({},_0x42a7db,_0x93a094[_0x8c6d('0x3a')]);var _0x4869dc={'where':_0x42a7db[_0x8c6d('0x35')]};return db[_0x8c6d('0x27')][_0x8c6d('0x1b')](_0x4869dc)[_0x8c6d('0x3b')](function(_0x2f54a2){_0x316ca7[_0x8c6d('0x1b')]=_0x2f54a2;if(_0x93a094[_0x8c6d('0x2c')][_0x8c6d('0x3c')]){_0x42a7db[_0x8c6d('0x3d')]=[{'all':!![]}];}return db[_0x8c6d('0x27')][_0x8c6d('0x3e')](_0x42a7db);})['then'](function(_0x58af06){_0x316ca7['rows']=_0x58af06;return _0x316ca7;})[_0x8c6d('0x3b')](respondWithFilteredResult(_0xfc6000,_0x42a7db))[_0x8c6d('0x3f')](handleError(_0xfc6000,null));};exports[_0x8c6d('0x40')]=function(_0x3d69c3,_0x3409eb){var _0x546f04={'raw':!![],'where':{'id':_0x3d69c3[_0x8c6d('0x41')]['id']}},_0x274d01={};_0x274d01[_0x8c6d('0x2b')]=_['keys'](db[_0x8c6d('0x27')][_0x8c6d('0x28')]);_0x274d01['query']=_['keys'](_0x3d69c3['query']);_0x274d01['filters']=_['intersection'](_0x274d01[_0x8c6d('0x2b')],_0x274d01[_0x8c6d('0x2c')]);_0x546f04[_0x8c6d('0x31')]=_[_0x8c6d('0x2f')](_0x274d01[_0x8c6d('0x2b')],qs['fields'](_0x3d69c3['query']['fields']));_0x546f04['attributes']=_0x546f04[_0x8c6d('0x31')]['length']?_0x546f04[_0x8c6d('0x31')]:_0x274d01[_0x8c6d('0x2b')];if(_0x3d69c3[_0x8c6d('0x2c')][_0x8c6d('0x3c')]){_0x546f04[_0x8c6d('0x3d')]=[{'all':!![]}];}_0x546f04=_[_0x8c6d('0x38')]({},_0x546f04,_0x3d69c3['options']);return db[_0x8c6d('0x27')][_0x8c6d('0x42')](_0x546f04)['then'](handleEntityNotFound(_0x3409eb,null))[_0x8c6d('0x3b')](respondWithResult(_0x3409eb,null))[_0x8c6d('0x3f')](handleError(_0x3409eb,null));};exports['create']=function(_0x2fd4ea,_0xb6e94){return db[_0x8c6d('0x27')][_0x8c6d('0x43')](_0x2fd4ea[_0x8c6d('0x44')],{})[_0x8c6d('0x3b')](respondWithResult(_0xb6e94,0xc9))[_0x8c6d('0x3f')](handleError(_0xb6e94,null));};exports[_0x8c6d('0x45')]=function(_0x1f1609,_0x1d6c29){if(_0x1f1609[_0x8c6d('0x44')]['id']){delete _0x1f1609[_0x8c6d('0x44')]['id'];}return db[_0x8c6d('0x27')][_0x8c6d('0x42')]({'where':{'id':_0x1f1609[_0x8c6d('0x41')]['id']}})[_0x8c6d('0x3b')](handleEntityNotFound(_0x1d6c29,null))['then'](saveUpdates(_0x1f1609['body'],null))['then'](respondWithResult(_0x1d6c29,null))[_0x8c6d('0x3f')](handleError(_0x1d6c29,null));};exports[_0x8c6d('0x21')]=function(_0x4919b8,_0x574b08){return db['FreshdeskField'][_0x8c6d('0x42')]({'where':{'id':_0x4919b8['params']['id']}})[_0x8c6d('0x3b')](handleEntityNotFound(_0x574b08,null))[_0x8c6d('0x3b')](removeEntity(_0x574b08,null))[_0x8c6d('0x3f')](handleError(_0x574b08,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index fb0084a..70a3ba4 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 _0x11db=['exports','define','FreshdeskField','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes'];(function(_0xcaf223,_0xd39f07){var _0x17e00d=function(_0xe2852e){while(--_0xe2852e){_0xcaf223['push'](_0xcaf223['shift']());}};_0x17e00d(++_0xd39f07);}(_0x11db,0x146));var _0xb11d=function(_0x27bcf5,_0x236765){_0x27bcf5=_0x27bcf5-0x0;var _0x4ce4cf=_0x11db[_0x27bcf5];return _0x4ce4cf;};'use strict';var _=require(_0xb11d('0x0'));var util=require(_0xb11d('0x1'));var logger=require(_0xb11d('0x2'))(_0xb11d('0x3'));var moment=require(_0xb11d('0x4'));var BPromise=require('bluebird');var rp=require(_0xb11d('0x5'));var fs=require('fs');var path=require(_0xb11d('0x6'));var rimraf=require(_0xb11d('0x7'));var config=require(_0xb11d('0x8'));var attributes=require(_0xb11d('0x9'));module[_0xb11d('0xa')]=function(_0x5f7a31,_0x300fcc){return _0x5f7a31[_0xb11d('0xb')](_0xb11d('0xc'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0xb11d('0xd'),'fields':[_0xb11d('0xe'),_0xb11d('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf4f3=['FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','exports','define','FreshdeskField','int_freshdesk_fields','idField'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xf4f3,0x9b));var _0x3f4f=function(_0x113d44,_0xe9c556){_0x113d44=_0x113d44-0x0;var _0x460d7a=_0xf4f3[_0x113d44];return _0x460d7a;};'use strict';var _=require(_0x3f4f('0x0'));var util=require(_0x3f4f('0x1'));var logger=require(_0x3f4f('0x2'))(_0x3f4f('0x3'));var moment=require(_0x3f4f('0x4'));var BPromise=require('bluebird');var rp=require(_0x3f4f('0x5'));var fs=require('fs');var path=require(_0x3f4f('0x6'));var rimraf=require(_0x3f4f('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshdeskField.attributes');module[_0x3f4f('0x8')]=function(_0x3f42d8,_0x1c7569){return _0x3f42d8[_0x3f4f('0x9')](_0x3f4f('0xa'),attributes,{'tableName':_0x3f4f('0xb'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x3f4f('0xc'),_0x3f4f('0xd')],'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 4f2ed78..60df880 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 _0x423a=['error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x317c71,_0x524498){var _0xbf3b06=function(_0x1ea3ea){while(--_0x1ea3ea){_0x317c71['push'](_0x317c71['shift']());}};_0xbf3b06(++_0x524498);}(_0x423a,0x14a));var _0xa423=function(_0x39b2f7,_0x1cc006){_0x39b2f7=_0x39b2f7-0x0;var _0xf7c96c=_0x423a[_0x39b2f7];return _0xf7c96c;};'use strict';var _=require(_0xa423('0x0'));var util=require(_0xa423('0x1'));var moment=require(_0xa423('0x2'));var BPromise=require(_0xa423('0x3'));var rs=require(_0xa423('0x4'));var fs=require('fs');var Redis=require(_0xa423('0x5'));var db=require(_0xa423('0x6'))['db'];var utils=require(_0xa423('0x7'));var logger=require(_0xa423('0x8'))(_0xa423('0x9'));var config=require(_0xa423('0xa'));var jayson=require(_0xa423('0xb'));var client=jayson[_0xa423('0xc')][_0xa423('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x13e7d6,_0x21ab9c,_0x211e85){return new BPromise(function(_0x3414c6,_0x38d223){return client[_0xa423('0xe')](_0x13e7d6,_0x211e85)[_0xa423('0xf')](function(_0x2c5998){logger['info'](_0xa423('0x10'),_0x21ab9c,_0xa423('0x11'));logger[_0xa423('0x12')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x21ab9c,_0xa423('0x11'),JSON[_0xa423('0x13')](_0x2c5998));if(_0x2c5998['error']){if(_0x2c5998[_0xa423('0x14')]['code']===0x1f4){logger[_0xa423('0x14')](_0xa423('0x10'),_0x21ab9c,_0x2c5998[_0xa423('0x14')]['message']);return _0x38d223(_0x2c5998[_0xa423('0x14')][_0xa423('0x15')]);}logger[_0xa423('0x14')](_0xa423('0x10'),_0x21ab9c,_0x2c5998[_0xa423('0x14')][_0xa423('0x15')]);return _0x3414c6(_0x2c5998[_0xa423('0x14')][_0xa423('0x15')]);}else{logger[_0xa423('0x16')](_0xa423('0x10'),_0x21ab9c,_0xa423('0x11'));_0x3414c6(_0x2c5998[_0xa423('0x17')][_0xa423('0x15')]);}})[_0xa423('0x18')](function(_0x3041f1){logger[_0xa423('0x14')]('FreshdeskField,\x20%s,\x20%s',_0x21ab9c,_0x3041f1);_0x38d223(_0x3041f1);});});} \ No newline at end of file +var _0xf3c9=['lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x162604,_0x1497c7){var _0x508c0e=function(_0x47e11f){while(--_0x47e11f){_0x162604['push'](_0x162604['shift']());}};_0x508c0e(++_0x1497c7);}(_0xf3c9,0x1cc));var _0x9f3c=function(_0x5edad7,_0x4ca4a7){_0x5edad7=_0x5edad7-0x0;var _0x5c6d65=_0xf3c9[_0x5edad7];return _0x5c6d65;};'use strict';var _=require(_0x9f3c('0x0'));var util=require(_0x9f3c('0x1'));var moment=require('moment');var BPromise=require(_0x9f3c('0x2'));var rs=require(_0x9f3c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f3c('0x4'))['db'];var utils=require(_0x9f3c('0x5'));var logger=require('../../config/logger')(_0x9f3c('0x6'));var config=require(_0x9f3c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9f3c('0x8')][_0x9f3c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13c67e,_0x5702c0,_0x45545d){return new BPromise(function(_0x222fc1,_0x4a0241){return client[_0x9f3c('0xa')](_0x13c67e,_0x45545d)[_0x9f3c('0xb')](function(_0x5b05f3){logger[_0x9f3c('0xc')](_0x9f3c('0xd'),_0x5702c0,_0x9f3c('0xe'));logger[_0x9f3c('0xf')](_0x9f3c('0x10'),_0x5702c0,_0x9f3c('0xe'),JSON[_0x9f3c('0x11')](_0x5b05f3));if(_0x5b05f3[_0x9f3c('0x12')]){if(_0x5b05f3[_0x9f3c('0x12')][_0x9f3c('0x13')]===0x1f4){logger['error'](_0x9f3c('0xd'),_0x5702c0,_0x5b05f3['error'][_0x9f3c('0x14')]);return _0x4a0241(_0x5b05f3[_0x9f3c('0x12')][_0x9f3c('0x14')]);}logger[_0x9f3c('0x12')](_0x9f3c('0xd'),_0x5702c0,_0x5b05f3[_0x9f3c('0x12')][_0x9f3c('0x14')]);return _0x222fc1(_0x5b05f3[_0x9f3c('0x12')][_0x9f3c('0x14')]);}else{logger['info']('FreshdeskField,\x20%s,\x20%s',_0x5702c0,_0x9f3c('0xe'));_0x222fc1(_0x5b05f3[_0x9f3c('0x15')][_0x9f3c('0x14')]);}})[_0x9f3c('0x16')](function(_0x21b1b){logger[_0x9f3c('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x5702c0,_0x21b1b);_0x4a0241(_0x21b1b);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 8987434..c30b26b 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 _0x16d2=['./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3457b4,_0x4cd8f9){var _0xaa8fa9=function(_0x51897a){while(--_0x51897a){_0x3457b4['push'](_0x3457b4['shift']());}};_0xaa8fa9(++_0x4cd8f9);}(_0x16d2,0x123));var _0x216d=function(_0x34190e,_0x50ecc7){_0x34190e=_0x34190e-0x0;var _0x41a4e6=_0x16d2[_0x34190e];return _0x41a4e6;};'use strict';var multer=require(_0x216d('0x0'));var util=require(_0x216d('0x1'));var path=require(_0x216d('0x2'));var timeout=require(_0x216d('0x3'));var express=require(_0x216d('0x4'));var router=express[_0x216d('0x5')]();var fs_extra=require(_0x216d('0x6'));var auth=require(_0x216d('0x7'));var interaction=require(_0x216d('0x8'));var config=require('../../config/environment');var controller=require(_0x216d('0x9'));router[_0x216d('0xa')]('/',auth[_0x216d('0xb')](),controller[_0x216d('0xc')]);router[_0x216d('0xa')](_0x216d('0xd'),auth[_0x216d('0xb')](),controller[_0x216d('0xe')]);router['get'](_0x216d('0xf'),auth[_0x216d('0xb')](),controller[_0x216d('0x10')]);router[_0x216d('0xa')](_0x216d('0x11'),auth[_0x216d('0xb')](),controller['getFields']);router[_0x216d('0x12')]('/',auth['isAuthenticated'](),controller[_0x216d('0x13')]);router[_0x216d('0x12')](_0x216d('0xf'),auth[_0x216d('0xb')](),controller[_0x216d('0x14')]);router[_0x216d('0x15')]('/:id',auth[_0x216d('0xb')](),controller['update']);router[_0x216d('0x16')](_0x216d('0xd'),auth['isAuthenticated'](),controller[_0x216d('0x17')]);module[_0x216d('0x18')]=router; \ No newline at end of file +var _0x4cf8=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','create','addConfiguration'];(function(_0x35b578,_0x7d3fe5){var _0x592ed4=function(_0x304dce){while(--_0x304dce){_0x35b578['push'](_0x35b578['shift']());}};_0x592ed4(++_0x7d3fe5);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x3f1076,_0x23b6c1){_0x3f1076=_0x3f1076-0x0;var _0x21d34f=_0x4cf8[_0x3f1076];return _0x21d34f;};'use strict';var multer=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var path=require(_0x84cf('0x2'));var timeout=require(_0x84cf('0x3'));var express=require(_0x84cf('0x4'));var router=express[_0x84cf('0x5')]();var fs_extra=require(_0x84cf('0x6'));var auth=require(_0x84cf('0x7'));var interaction=require(_0x84cf('0x8'));var config=require(_0x84cf('0x9'));var controller=require(_0x84cf('0xa'));router[_0x84cf('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x84cf('0xb')]('/:id',auth[_0x84cf('0xc')](),controller[_0x84cf('0xd')]);router['get'](_0x84cf('0xe'),auth[_0x84cf('0xc')](),controller['getConfigurations']);router[_0x84cf('0xb')](_0x84cf('0xf'),auth[_0x84cf('0xc')](),controller[_0x84cf('0x10')]);router['post']('/',auth[_0x84cf('0xc')](),controller[_0x84cf('0x11')]);router['post']('/:id/configurations',auth[_0x84cf('0xc')](),controller[_0x84cf('0x12')]);router[_0x84cf('0x13')](_0x84cf('0x14'),auth[_0x84cf('0xc')](),controller[_0x84cf('0x15')]);router[_0x84cf('0x16')](_0x84cf('0x14'),auth[_0x84cf('0xc')](),controller[_0x84cf('0x17')]);module[_0x84cf('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 4c1c2aa..ea6e4cb 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 _0x77e6=['STRING','username','sequelize','exports'];(function(_0x65c0bb,_0x82e7b8){var _0x320bd5=function(_0x6e1675){while(--_0x6e1675){_0x65c0bb['push'](_0x65c0bb['shift']());}};_0x320bd5(++_0x82e7b8);}(_0x77e6,0x1a6));var _0x677e=function(_0x153505,_0x128c26){_0x153505=_0x153505-0x0;var _0x2d970b=_0x77e6[_0x153505];return _0x2d970b;};'use strict';var Sequelize=require(_0x677e('0x0'));module[_0x677e('0x1')]={'name':{'type':Sequelize[_0x677e('0x2')]},'description':{'type':Sequelize[_0x677e('0x2')]},'username':{'type':Sequelize[_0x677e('0x2')],'unique':_0x677e('0x3')},'apiKey':{'type':Sequelize[_0x677e('0x2')]},'remoteUri':{'type':Sequelize[_0x677e('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x677e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x02ce=['sequelize','exports','STRING','remoteUri'];(function(_0x403ed1,_0x5c5de5){var _0x34a5cd=function(_0x4bd6bb){while(--_0x4bd6bb){_0x403ed1['push'](_0x403ed1['shift']());}};_0x34a5cd(++_0x5c5de5);}(_0x02ce,0x1ac));var _0xe02c=function(_0x22fd2f,_0x177448){_0x22fd2f=_0x22fd2f-0x0;var _0x418164=_0x02ce[_0x22fd2f];return _0x418164;};'use strict';var Sequelize=require(_0xe02c('0x0'));module[_0xe02c('0x1')]={'name':{'type':Sequelize[_0xe02c('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe02c('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xe02c('0x2')]},'remoteUri':{'type':Sequelize[_0xe02c('0x2')],'unique':_0xe02c('0x3')},'serverUrl':{'type':Sequelize[_0xe02c('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 41042d9..5dac7f8 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 _0xc977=['mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','FreshsalesAccount','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','getConfigurations','findOne','rawAttributes','length','pick','addConfiguration','AccountId','Subjects','Descriptions','FreshsalesConfiguration','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','GET','format','%s%s','/api/selector/owners','email','Requested\x20Resource\x20not\x20Found','test','statusCode','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc977,0x191));var _0x7c97=function(_0x357f0a,_0x37aa60){_0x357f0a=_0x357f0a-0x0;var _0x10d41b=_0xc977[_0x357f0a];return _0x10d41b;};'use strict';var emlformat=require(_0x7c97('0x0'));var rimraf=require(_0x7c97('0x1'));var zipdir=require(_0x7c97('0x2'));var jsonpatch=require(_0x7c97('0x3'));var rp=require(_0x7c97('0x4'));var moment=require(_0x7c97('0x5'));var BPromise=require(_0x7c97('0x6'));var Mustache=require(_0x7c97('0x7'));var util=require(_0x7c97('0x8'));var path=require(_0x7c97('0x9'));var sox=require('sox');var csv=require(_0x7c97('0xa'));var ejs=require(_0x7c97('0xb'));var fs=require('fs');var fs_extra=require(_0x7c97('0xc'));var _=require(_0x7c97('0xd'));var squel=require('squel');var crypto=require(_0x7c97('0xe'));var jsforce=require(_0x7c97('0xf'));var deskjs=require(_0x7c97('0x10'));var toCsv=require(_0x7c97('0xa'));var querystring=require(_0x7c97('0x11'));var Papa=require(_0x7c97('0x12'));var Redis=require(_0x7c97('0x13'));var authService=require(_0x7c97('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7c97('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7c97('0x16'))(_0x7c97('0x17'));var utils=require(_0x7c97('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7c97('0x19'));var db=require(_0x7c97('0x1a'))['db'];var integrations=require(_0x7c97('0x1b'));function respondWithStatusCode(_0x45c645,_0x56ffad){_0x56ffad=_0x56ffad||0xcc;return function(_0x49e166){if(_0x49e166){return _0x45c645[_0x7c97('0x1c')](_0x56ffad);}return _0x45c645[_0x7c97('0x1d')](_0x56ffad)['end']();};}function respondWithResult(_0x40bcd5,_0x312f30){_0x312f30=_0x312f30||0xc8;return function(_0x884c6b){if(_0x884c6b){return _0x40bcd5['status'](_0x312f30)[_0x7c97('0x1e')](_0x884c6b);}};}function respondWithFilteredResult(_0x319dc5,_0x329fe7){return function(_0x31994b){if(_0x31994b){var _0x8b81a6=typeof _0x329fe7['offset']===_0x7c97('0x1f')&&typeof _0x329fe7[_0x7c97('0x20')]===_0x7c97('0x1f');var _0x22110b=_0x31994b[_0x7c97('0x21')];var _0x359b04=_0x8b81a6?0x0:_0x329fe7[_0x7c97('0x22')];var _0x1cf2ab=_0x8b81a6?_0x31994b[_0x7c97('0x21')]:_0x329fe7['offset']+_0x329fe7[_0x7c97('0x20')];var _0x1d58bc;if(_0x1cf2ab>=_0x22110b){_0x1cf2ab=_0x22110b;_0x1d58bc=0xc8;}else{_0x1d58bc=0xce;}_0x319dc5[_0x7c97('0x1d')](_0x1d58bc);return _0x319dc5[_0x7c97('0x23')](_0x7c97('0x24'),_0x359b04+'-'+_0x1cf2ab+'/'+_0x22110b)[_0x7c97('0x1e')](_0x31994b);}return null;};}function patchUpdates(_0x315c27){return function(_0x4cc69b){try{jsonpatch[_0x7c97('0x25')](_0x4cc69b,_0x315c27,!![]);}catch(_0x4ecfde){return BPromise[_0x7c97('0x26')](_0x4ecfde);}return _0x4cc69b[_0x7c97('0x27')]();};}function saveUpdates(_0x2e1a79,_0x5b4d7d){return function(_0x14be47){if(_0x14be47){return _0x14be47['update'](_0x2e1a79)[_0x7c97('0x28')](function(_0x2f3f45){return _0x2f3f45;});}return null;};}function removeEntity(_0x100fd1,_0x1569ed){return function(_0x164831){if(_0x164831){return _0x164831[_0x7c97('0x29')]()[_0x7c97('0x28')](function(){_0x100fd1[_0x7c97('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x101f8f,_0x2db7d4){return function(_0x3b9688){if(!_0x3b9688){_0x101f8f[_0x7c97('0x1c')](0x194);}return _0x3b9688;};}function handleError(_0x2aa488,_0x2d59b9){_0x2d59b9=_0x2d59b9||0x1f4;return function(_0x5d13e8){logger[_0x7c97('0x2a')](_0x5d13e8[_0x7c97('0x2b')]);if(_0x5d13e8['name']){delete _0x5d13e8[_0x7c97('0x2c')];}_0x2aa488['status'](_0x2d59b9)[_0x7c97('0x2d')](_0x5d13e8);};}exports[_0x7c97('0x2e')]=function(_0x20ec9a,_0x2fb664){var _0x3e1036={},_0x3df2da={},_0x37e25d={'count':0x0,'rows':[]};var _0x25cba5=_[_0x7c97('0x2f')](db[_0x7c97('0x30')]['rawAttributes'],function(_0xa4b48){return{'name':_0xa4b48[_0x7c97('0x31')],'type':_0xa4b48['type']['key']};});_0x3df2da[_0x7c97('0x32')]=_[_0x7c97('0x2f')](_0x25cba5,_0x7c97('0x2c'));_0x3df2da[_0x7c97('0x33')]=_[_0x7c97('0x34')](_0x20ec9a[_0x7c97('0x33')]);_0x3df2da[_0x7c97('0x35')]=_[_0x7c97('0x36')](_0x3df2da['model'],_0x3df2da[_0x7c97('0x33')]);_0x3e1036[_0x7c97('0x37')]=_[_0x7c97('0x36')](_0x3df2da['model'],qs['fields'](_0x20ec9a[_0x7c97('0x33')][_0x7c97('0x38')]));_0x3e1036['attributes']=_0x3e1036[_0x7c97('0x37')]['length']?_0x3e1036['attributes']:_0x3df2da[_0x7c97('0x32')];if(!_0x20ec9a['query'][_0x7c97('0x39')](_0x7c97('0x3a'))){_0x3e1036[_0x7c97('0x20')]=qs[_0x7c97('0x20')](_0x20ec9a[_0x7c97('0x33')][_0x7c97('0x20')]);_0x3e1036[_0x7c97('0x22')]=qs[_0x7c97('0x22')](_0x20ec9a[_0x7c97('0x33')][_0x7c97('0x22')]);}_0x3e1036[_0x7c97('0x3b')]=qs[_0x7c97('0x3c')](_0x20ec9a[_0x7c97('0x33')][_0x7c97('0x3c')]);_0x3e1036[_0x7c97('0x3d')]=qs[_0x7c97('0x35')](_['pick'](_0x20ec9a[_0x7c97('0x33')],_0x3df2da[_0x7c97('0x35')]),_0x25cba5);if(_0x20ec9a['query'][_0x7c97('0x3e')]){_0x3e1036[_0x7c97('0x3d')]=_[_0x7c97('0x3f')](_0x3e1036[_0x7c97('0x3d')],{'$or':_[_0x7c97('0x2f')](_0x25cba5,function(_0x523bfb){if(_0x523bfb[_0x7c97('0x40')]!==_0x7c97('0x41')){var _0x2612e5={};_0x2612e5[_0x523bfb[_0x7c97('0x2c')]]={'$like':'%'+_0x20ec9a['query']['filter']+'%'};return _0x2612e5;}})});}_0x3e1036=_[_0x7c97('0x3f')]({},_0x3e1036,_0x20ec9a[_0x7c97('0x42')]);var _0x35bdfc={'where':_0x3e1036[_0x7c97('0x3d')]};return db['FreshsalesAccount']['count'](_0x35bdfc)[_0x7c97('0x28')](function(_0x44b581){_0x37e25d['count']=_0x44b581;if(_0x20ec9a[_0x7c97('0x33')][_0x7c97('0x43')]){_0x3e1036[_0x7c97('0x44')]=[{'all':!![]}];}return db[_0x7c97('0x30')]['findAll'](_0x3e1036);})[_0x7c97('0x28')](function(_0x16cf1f){_0x37e25d[_0x7c97('0x45')]=_0x16cf1f;return _0x37e25d;})[_0x7c97('0x28')](respondWithFilteredResult(_0x2fb664,_0x3e1036))[_0x7c97('0x46')](handleError(_0x2fb664,null));};exports[_0x7c97('0x47')]=function(_0x51884d,_0x4a217e){var _0x44d8cd={'raw':![],'where':{'id':_0x51884d[_0x7c97('0x48')]['id']}},_0xeb45eb={};_0xeb45eb[_0x7c97('0x32')]=_[_0x7c97('0x34')](db[_0x7c97('0x30')]['rawAttributes']);_0xeb45eb[_0x7c97('0x33')]=_[_0x7c97('0x34')](_0x51884d['query']);_0xeb45eb[_0x7c97('0x35')]=_[_0x7c97('0x36')](_0xeb45eb[_0x7c97('0x32')],_0xeb45eb[_0x7c97('0x33')]);_0x44d8cd[_0x7c97('0x37')]=_['intersection'](_0xeb45eb[_0x7c97('0x32')],qs[_0x7c97('0x38')](_0x51884d['query']['fields']));_0x44d8cd['attributes']=_0x44d8cd[_0x7c97('0x37')]['length']?_0x44d8cd['attributes']:_0xeb45eb[_0x7c97('0x32')];if(_0x51884d[_0x7c97('0x33')][_0x7c97('0x43')]){_0x44d8cd[_0x7c97('0x44')]=[{'all':!![]}];}_0x44d8cd=_[_0x7c97('0x3f')]({},_0x44d8cd,_0x51884d[_0x7c97('0x42')]);return db['FreshsalesAccount'][_0x7c97('0x49')](_0x44d8cd)['then'](handleEntityNotFound(_0x4a217e,null))[_0x7c97('0x28')](respondWithResult(_0x4a217e,null))[_0x7c97('0x46')](handleError(_0x4a217e,null));};exports[_0x7c97('0x4a')]=function(_0x29c508,_0x45cd4e){return db[_0x7c97('0x30')]['create'](_0x29c508[_0x7c97('0x4b')],{})[_0x7c97('0x28')](respondWithResult(_0x45cd4e,0xc9))['catch'](handleError(_0x45cd4e,null));};exports['update']=function(_0x30696e,_0x4b7ce7){if(_0x30696e['body']['id']){delete _0x30696e[_0x7c97('0x4b')]['id'];}return db[_0x7c97('0x30')][_0x7c97('0x49')]({'where':{'id':_0x30696e[_0x7c97('0x48')]['id']}})[_0x7c97('0x28')](handleEntityNotFound(_0x4b7ce7,null))['then'](saveUpdates(_0x30696e['body'],null))[_0x7c97('0x28')](respondWithResult(_0x4b7ce7,null))['catch'](handleError(_0x4b7ce7,null));};exports['destroy']=function(_0x2407d9,_0x220214){return db[_0x7c97('0x30')][_0x7c97('0x49')]({'where':{'id':_0x2407d9[_0x7c97('0x48')]['id']}})['then'](handleEntityNotFound(_0x220214,null))['then'](removeEntity(_0x220214,null))['catch'](handleError(_0x220214,null));};exports[_0x7c97('0x4c')]=function(_0x5e522c,_0x295c2f,_0x4c7c9d){var _0x27ec72={};var _0x44546d={};var _0x31c3ff;var _0x30bd60;return db[_0x7c97('0x30')][_0x7c97('0x4d')]({'where':{'id':_0x5e522c[_0x7c97('0x48')]['id']}})[_0x7c97('0x28')](handleEntityNotFound(_0x295c2f,null))[_0x7c97('0x28')](function(_0x30feba){if(_0x30feba){_0x31c3ff=_0x30feba;_0x44546d[_0x7c97('0x32')]=_[_0x7c97('0x34')](db['FreshsalesConfiguration'][_0x7c97('0x4e')]);_0x44546d[_0x7c97('0x33')]=_[_0x7c97('0x34')](_0x5e522c[_0x7c97('0x33')]);_0x44546d['filters']=_[_0x7c97('0x36')](_0x44546d['model'],_0x44546d[_0x7c97('0x33')]);_0x27ec72['attributes']=_[_0x7c97('0x36')](_0x44546d[_0x7c97('0x32')],qs['fields'](_0x5e522c[_0x7c97('0x33')][_0x7c97('0x38')]));_0x27ec72[_0x7c97('0x37')]=_0x27ec72[_0x7c97('0x37')][_0x7c97('0x4f')]?_0x27ec72[_0x7c97('0x37')]:_0x44546d[_0x7c97('0x32')];_0x27ec72[_0x7c97('0x3b')]=qs[_0x7c97('0x3c')](_0x5e522c[_0x7c97('0x33')][_0x7c97('0x3c')]);_0x27ec72[_0x7c97('0x3d')]=qs[_0x7c97('0x35')](_[_0x7c97('0x50')](_0x5e522c['query'],_0x44546d[_0x7c97('0x35')]));if(_0x5e522c[_0x7c97('0x33')][_0x7c97('0x3e')]){_0x27ec72['where']=_[_0x7c97('0x3f')](_0x27ec72['where'],{'$or':_['map'](_0x27ec72[_0x7c97('0x37')],function(_0x11d19e){var _0x5855e0={};_0x5855e0[_0x11d19e]={'$like':'%'+_0x5e522c[_0x7c97('0x33')][_0x7c97('0x3e')]+'%'};return _0x5855e0;})});}_0x27ec72=_[_0x7c97('0x3f')]({},_0x27ec72,_0x5e522c[_0x7c97('0x42')]);return _0x31c3ff[_0x7c97('0x4c')](_0x27ec72);}})['then'](function(_0x4c49e5){if(_0x4c49e5){_0x30bd60=_0x4c49e5['length'];if(!_0x5e522c[_0x7c97('0x33')]['hasOwnProperty'](_0x7c97('0x3a'))){_0x27ec72['limit']=qs['limit'](_0x5e522c[_0x7c97('0x33')]['limit']);_0x27ec72[_0x7c97('0x22')]=qs['offset'](_0x5e522c[_0x7c97('0x33')][_0x7c97('0x22')]);}return _0x31c3ff[_0x7c97('0x4c')](_0x27ec72);}})[_0x7c97('0x28')](function(_0x2406fd){if(_0x2406fd){return _0x2406fd?{'count':_0x30bd60,'rows':_0x2406fd}:null;}})[_0x7c97('0x28')](respondWithResult(_0x295c2f,null))['catch'](handleError(_0x295c2f,null));};exports[_0x7c97('0x51')]=function(_0x5c6db6,_0x153e47,_0x4b727b){if(_0x5c6db6[_0x7c97('0x4b')]['id']){delete _0x5c6db6[_0x7c97('0x4b')]['id'];}return db[_0x7c97('0x30')][_0x7c97('0x4d')]({'where':{'id':_0x5c6db6[_0x7c97('0x48')]['id']}})['then'](handleEntityNotFound(_0x153e47,null))[_0x7c97('0x28')](function(_0xafb287){if(_0xafb287){_0x5c6db6[_0x7c97('0x4b')][_0x7c97('0x52')]=_0xafb287['id'];_0x5c6db6[_0x7c97('0x4b')][_0x7c97('0x53')]=integrations['getSubjects'](_0x5c6db6['body']['channel'],_0x5c6db6['body'][_0x7c97('0x40')]);_0x5c6db6['body'][_0x7c97('0x54')]=integrations['getDescriptions'](_0x5c6db6['body']['channel'],_0x5c6db6[_0x7c97('0x4b')][_0x7c97('0x40')]);return db[_0x7c97('0x55')][_0x7c97('0x4a')](_0x5c6db6[_0x7c97('0x4b')],{'include':[{'model':db[_0x7c97('0x56')],'as':'Subjects'},{'model':db[_0x7c97('0x56')],'as':_0x7c97('0x54')}]});}return null;})[_0x7c97('0x28')](respondWithResult(_0x153e47,null))[_0x7c97('0x46')](handleError(_0x153e47,null));};exports[_0x7c97('0x57')]=function(_0x294eec,_0x5f2816,_0x50eba1){var _0x5188fa='';var _0x567205='';return db[_0x7c97('0x30')]['findOne']({'where':{'id':_0x294eec[_0x7c97('0x48')]['id']},'attributes':['id',_0x7c97('0x58'),_0x7c97('0x59'),_0x7c97('0x5a')]})['then'](handleEntityNotFound(_0x5f2816,null))[_0x7c97('0x28')](function(_0x3a43f9){if(_0x3a43f9){_0x567205=_0x3a43f9[_0x7c97('0x58')];_0x5188fa=_0x3a43f9['remoteUri'];var _0x201a95=_0x3a43f9[_0x7c97('0x59')][_0x7c97('0x5b')](-0x1);if(_0x201a95==='/'){_0x5188fa=_0x5188fa[_0x7c97('0x5c')](0x0,_0x5188fa['lastIndexOf'](_0x201a95));}return rp({'method':_0x7c97('0x5d'),'uri':util[_0x7c97('0x5e')](_0x7c97('0x5f'),_0x5188fa,_0x7c97('0x60')),'headers':{'Authorization':'Token\x20token='+_0x3a43f9[_0x7c97('0x5a')]},'json':!![]});}})[_0x7c97('0x28')](function(_0x23b9a1){if(_0x23b9a1){var _0x6a3bef=_0x23b9a1['users'];var _0x45f0a5=![];var _0x2aae2c=null;for(_0x2aae2c=0x0;_0x2aae2c<_0x6a3bef[_0x7c97('0x4f')];_0x2aae2c++){if(_0x6a3bef[_0x2aae2c][_0x7c97('0x61')]===_0x567205){_0x45f0a5=!![];}}if(_0x45f0a5){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x7c97('0x62')});}}})[_0x7c97('0x28')](respondWithResult(_0x5f2816,null))[_0x7c97('0x46')](function(_0x2c3c13){var _0x1a3a24=_0x294eec[_0x7c97('0x33')][_0x7c97('0x63')]?0x1f4:_0x2c3c13[_0x7c97('0x64')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x7c97('0x57'),_0x1a3a24,JSON[_0x7c97('0x65')](_0x2c3c13));delete _0x2c3c13[_0x7c97('0x2c')];if(_0x1a3a24===0x191){_0x1a3a24=0x190;}_0x5f2816[_0x7c97('0x1d')](_0x1a3a24)[_0x7c97('0x2d')](_0x294eec['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x2c3c13[_0x7c97('0x64')]}:_0x2c3c13);});}; \ No newline at end of file +var _0x2a92=['fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','catch','show','params','intersection','options','create','find','body','findOne','FreshsalesConfiguration','order','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','apiKey','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','end','error','send','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','name','query','keys','attributes'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0x2a92,0x169));var _0x22a9=function(_0xdbd4f7,_0x4e3bdd){_0xdbd4f7=_0xdbd4f7-0x0;var _0x5c3f9d=_0x2a92[_0xdbd4f7];return _0x5c3f9d;};'use strict';var emlformat=require(_0x22a9('0x0'));var rimraf=require(_0x22a9('0x1'));var zipdir=require(_0x22a9('0x2'));var jsonpatch=require(_0x22a9('0x3'));var rp=require(_0x22a9('0x4'));var moment=require(_0x22a9('0x5'));var BPromise=require(_0x22a9('0x6'));var Mustache=require(_0x22a9('0x7'));var util=require(_0x22a9('0x8'));var path=require(_0x22a9('0x9'));var sox=require(_0x22a9('0xa'));var csv=require(_0x22a9('0xb'));var ejs=require(_0x22a9('0xc'));var fs=require('fs');var fs_extra=require(_0x22a9('0xd'));var _=require(_0x22a9('0xe'));var squel=require('squel');var crypto=require(_0x22a9('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x22a9('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x22a9('0x11'));var authService=require(_0x22a9('0x12'));var qs=require(_0x22a9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x22a9('0x14'))(_0x22a9('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x22a9('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x22a9('0x17'));function respondWithStatusCode(_0x4be06a,_0x24069b){_0x24069b=_0x24069b||0xcc;return function(_0x5d9b66){if(_0x5d9b66){return _0x4be06a[_0x22a9('0x18')](_0x24069b);}return _0x4be06a[_0x22a9('0x19')](_0x24069b)['end']();};}function respondWithResult(_0x8ca378,_0x4bc7fd){_0x4bc7fd=_0x4bc7fd||0xc8;return function(_0x4b8094){if(_0x4b8094){return _0x8ca378['status'](_0x4bc7fd)[_0x22a9('0x1a')](_0x4b8094);}};}function respondWithFilteredResult(_0x2b488f,_0x46fe04){return function(_0x3f0235){if(_0x3f0235){var _0x63962d=typeof _0x46fe04[_0x22a9('0x1b')]===_0x22a9('0x1c')&&typeof _0x46fe04[_0x22a9('0x1d')]==='undefined';var _0x85955b=_0x3f0235['count'];var _0x276fcc=_0x63962d?0x0:_0x46fe04[_0x22a9('0x1b')];var _0x12e7bd=_0x63962d?_0x3f0235['count']:_0x46fe04[_0x22a9('0x1b')]+_0x46fe04[_0x22a9('0x1d')];var _0x2a7210;if(_0x12e7bd>=_0x85955b){_0x12e7bd=_0x85955b;_0x2a7210=0xc8;}else{_0x2a7210=0xce;}_0x2b488f[_0x22a9('0x19')](_0x2a7210);return _0x2b488f[_0x22a9('0x1e')](_0x22a9('0x1f'),_0x276fcc+'-'+_0x12e7bd+'/'+_0x85955b)[_0x22a9('0x1a')](_0x3f0235);}return null;};}function patchUpdates(_0xce31){return function(_0x8312ab){try{jsonpatch[_0x22a9('0x20')](_0x8312ab,_0xce31,!![]);}catch(_0x3e6ced){return BPromise[_0x22a9('0x21')](_0x3e6ced);}return _0x8312ab[_0x22a9('0x22')]();};}function saveUpdates(_0x2e43bb,_0x4b7e3a){return function(_0xa08d64){if(_0xa08d64){return _0xa08d64[_0x22a9('0x23')](_0x2e43bb)['then'](function(_0x2370d3){return _0x2370d3;});}return null;};}function removeEntity(_0x1bd7b6,_0x49ea2a){return function(_0x23a1fb){if(_0x23a1fb){return _0x23a1fb['destroy']()[_0x22a9('0x24')](function(){_0x1bd7b6[_0x22a9('0x19')](0xcc)[_0x22a9('0x25')]();});}};}function handleEntityNotFound(_0x3923ab,_0xacc3b){return function(_0x42983e){if(!_0x42983e){_0x3923ab[_0x22a9('0x18')](0x194);}return _0x42983e;};}function handleError(_0x58d146,_0x509b04){_0x509b04=_0x509b04||0x1f4;return function(_0x1b0819){logger[_0x22a9('0x26')](_0x1b0819['stack']);if(_0x1b0819['name']){delete _0x1b0819['name'];}_0x58d146[_0x22a9('0x19')](_0x509b04)[_0x22a9('0x27')](_0x1b0819);};}exports['index']=function(_0x4f81b4,_0x3e4c67){var _0x559757={},_0x19b614={},_0x266401={'count':0x0,'rows':[]};var _0x136d67=_[_0x22a9('0x28')](db[_0x22a9('0x29')][_0x22a9('0x2a')],function(_0x2294de){return{'name':_0x2294de[_0x22a9('0x2b')],'type':_0x2294de[_0x22a9('0x2c')][_0x22a9('0x2d')]};});_0x19b614[_0x22a9('0x2e')]=_['map'](_0x136d67,_0x22a9('0x2f'));_0x19b614[_0x22a9('0x30')]=_[_0x22a9('0x31')](_0x4f81b4[_0x22a9('0x30')]);_0x19b614['filters']=_['intersection'](_0x19b614[_0x22a9('0x2e')],_0x19b614[_0x22a9('0x30')]);_0x559757[_0x22a9('0x32')]=_['intersection'](_0x19b614[_0x22a9('0x2e')],qs['fields'](_0x4f81b4[_0x22a9('0x30')][_0x22a9('0x33')]));_0x559757[_0x22a9('0x32')]=_0x559757[_0x22a9('0x32')][_0x22a9('0x34')]?_0x559757[_0x22a9('0x32')]:_0x19b614[_0x22a9('0x2e')];if(!_0x4f81b4[_0x22a9('0x30')][_0x22a9('0x35')]('nolimit')){_0x559757[_0x22a9('0x1d')]=qs[_0x22a9('0x1d')](_0x4f81b4['query'][_0x22a9('0x1d')]);_0x559757['offset']=qs['offset'](_0x4f81b4[_0x22a9('0x30')][_0x22a9('0x1b')]);}_0x559757['order']=qs[_0x22a9('0x36')](_0x4f81b4[_0x22a9('0x30')]['sort']);_0x559757[_0x22a9('0x37')]=qs[_0x22a9('0x38')](_[_0x22a9('0x39')](_0x4f81b4[_0x22a9('0x30')],_0x19b614['filters']),_0x136d67);if(_0x4f81b4['query'][_0x22a9('0x3a')]){_0x559757[_0x22a9('0x37')]=_[_0x22a9('0x3b')](_0x559757['where'],{'$or':_[_0x22a9('0x28')](_0x136d67,function(_0x3030c3){if(_0x3030c3[_0x22a9('0x2c')]!==_0x22a9('0x3c')){var _0x5f103d={};_0x5f103d[_0x3030c3[_0x22a9('0x2f')]]={'$like':'%'+_0x4f81b4[_0x22a9('0x30')][_0x22a9('0x3a')]+'%'};return _0x5f103d;}})});}_0x559757=_['merge']({},_0x559757,_0x4f81b4['options']);var _0x1c2e82={'where':_0x559757[_0x22a9('0x37')]};return db[_0x22a9('0x29')][_0x22a9('0x3d')](_0x1c2e82)[_0x22a9('0x24')](function(_0x3e4e46){_0x266401[_0x22a9('0x3d')]=_0x3e4e46;if(_0x4f81b4['query'][_0x22a9('0x3e')]){_0x559757[_0x22a9('0x3f')]=[{'all':!![]}];}return db[_0x22a9('0x29')][_0x22a9('0x40')](_0x559757);})[_0x22a9('0x24')](function(_0x36dc71){_0x266401['rows']=_0x36dc71;return _0x266401;})[_0x22a9('0x24')](respondWithFilteredResult(_0x3e4c67,_0x559757))[_0x22a9('0x41')](handleError(_0x3e4c67,null));};exports[_0x22a9('0x42')]=function(_0xcc730,_0x227f7b){var _0x229d4f={'raw':![],'where':{'id':_0xcc730[_0x22a9('0x43')]['id']}},_0x45c184={};_0x45c184[_0x22a9('0x2e')]=_['keys'](db['FreshsalesAccount']['rawAttributes']);_0x45c184['query']=_['keys'](_0xcc730[_0x22a9('0x30')]);_0x45c184[_0x22a9('0x38')]=_[_0x22a9('0x44')](_0x45c184[_0x22a9('0x2e')],_0x45c184[_0x22a9('0x30')]);_0x229d4f[_0x22a9('0x32')]=_[_0x22a9('0x44')](_0x45c184['model'],qs[_0x22a9('0x33')](_0xcc730['query'][_0x22a9('0x33')]));_0x229d4f[_0x22a9('0x32')]=_0x229d4f['attributes'][_0x22a9('0x34')]?_0x229d4f[_0x22a9('0x32')]:_0x45c184[_0x22a9('0x2e')];if(_0xcc730[_0x22a9('0x30')][_0x22a9('0x3e')]){_0x229d4f[_0x22a9('0x3f')]=[{'all':!![]}];}_0x229d4f=_[_0x22a9('0x3b')]({},_0x229d4f,_0xcc730[_0x22a9('0x45')]);return db['FreshsalesAccount']['find'](_0x229d4f)[_0x22a9('0x24')](handleEntityNotFound(_0x227f7b,null))[_0x22a9('0x24')](respondWithResult(_0x227f7b,null))[_0x22a9('0x41')](handleError(_0x227f7b,null));};exports[_0x22a9('0x46')]=function(_0x845e2b,_0x570a8e){return db[_0x22a9('0x29')][_0x22a9('0x46')](_0x845e2b['body'],{})[_0x22a9('0x24')](respondWithResult(_0x570a8e,0xc9))[_0x22a9('0x41')](handleError(_0x570a8e,null));};exports[_0x22a9('0x23')]=function(_0x2bfdfa,_0x364093){if(_0x2bfdfa['body']['id']){delete _0x2bfdfa['body']['id'];}return db['FreshsalesAccount'][_0x22a9('0x47')]({'where':{'id':_0x2bfdfa[_0x22a9('0x43')]['id']}})['then'](handleEntityNotFound(_0x364093,null))[_0x22a9('0x24')](saveUpdates(_0x2bfdfa[_0x22a9('0x48')],null))[_0x22a9('0x24')](respondWithResult(_0x364093,null))['catch'](handleError(_0x364093,null));};exports['destroy']=function(_0x375737,_0x3a0603){return db[_0x22a9('0x29')]['find']({'where':{'id':_0x375737[_0x22a9('0x43')]['id']}})[_0x22a9('0x24')](handleEntityNotFound(_0x3a0603,null))['then'](removeEntity(_0x3a0603,null))[_0x22a9('0x41')](handleError(_0x3a0603,null));};exports['getConfigurations']=function(_0x1b526c,_0x36419d,_0x4ccef6){var _0x2c745c={};var _0xac2cde={};var _0x1d042b;var _0x1fe6ba;return db[_0x22a9('0x29')][_0x22a9('0x49')]({'where':{'id':_0x1b526c[_0x22a9('0x43')]['id']}})[_0x22a9('0x24')](handleEntityNotFound(_0x36419d,null))['then'](function(_0x1d67d6){if(_0x1d67d6){_0x1d042b=_0x1d67d6;_0xac2cde[_0x22a9('0x2e')]=_[_0x22a9('0x31')](db[_0x22a9('0x4a')][_0x22a9('0x2a')]);_0xac2cde[_0x22a9('0x30')]=_[_0x22a9('0x31')](_0x1b526c[_0x22a9('0x30')]);_0xac2cde[_0x22a9('0x38')]=_[_0x22a9('0x44')](_0xac2cde[_0x22a9('0x2e')],_0xac2cde['query']);_0x2c745c[_0x22a9('0x32')]=_[_0x22a9('0x44')](_0xac2cde['model'],qs[_0x22a9('0x33')](_0x1b526c[_0x22a9('0x30')][_0x22a9('0x33')]));_0x2c745c[_0x22a9('0x32')]=_0x2c745c[_0x22a9('0x32')][_0x22a9('0x34')]?_0x2c745c[_0x22a9('0x32')]:_0xac2cde[_0x22a9('0x2e')];_0x2c745c[_0x22a9('0x4b')]=qs['sort'](_0x1b526c['query'][_0x22a9('0x36')]);_0x2c745c[_0x22a9('0x37')]=qs['filters'](_['pick'](_0x1b526c[_0x22a9('0x30')],_0xac2cde[_0x22a9('0x38')]));if(_0x1b526c[_0x22a9('0x30')]['filter']){_0x2c745c['where']=_['merge'](_0x2c745c[_0x22a9('0x37')],{'$or':_[_0x22a9('0x28')](_0x2c745c[_0x22a9('0x32')],function(_0xc0d08b){var _0xb36c={};_0xb36c[_0xc0d08b]={'$like':'%'+_0x1b526c[_0x22a9('0x30')]['filter']+'%'};return _0xb36c;})});}_0x2c745c=_[_0x22a9('0x3b')]({},_0x2c745c,_0x1b526c[_0x22a9('0x45')]);return _0x1d042b['getConfigurations'](_0x2c745c);}})[_0x22a9('0x24')](function(_0x2c753f){if(_0x2c753f){_0x1fe6ba=_0x2c753f[_0x22a9('0x34')];if(!_0x1b526c[_0x22a9('0x30')]['hasOwnProperty'](_0x22a9('0x4c'))){_0x2c745c[_0x22a9('0x1d')]=qs[_0x22a9('0x1d')](_0x1b526c[_0x22a9('0x30')][_0x22a9('0x1d')]);_0x2c745c[_0x22a9('0x1b')]=qs[_0x22a9('0x1b')](_0x1b526c[_0x22a9('0x30')]['offset']);}return _0x1d042b['getConfigurations'](_0x2c745c);}})[_0x22a9('0x24')](function(_0xb13a15){if(_0xb13a15){return _0xb13a15?{'count':_0x1fe6ba,'rows':_0xb13a15}:null;}})[_0x22a9('0x24')](respondWithResult(_0x36419d,null))[_0x22a9('0x41')](handleError(_0x36419d,null));};exports[_0x22a9('0x4d')]=function(_0x3d82eb,_0x3a7742,_0x38215b){if(_0x3d82eb[_0x22a9('0x48')]['id']){delete _0x3d82eb[_0x22a9('0x48')]['id'];}return db[_0x22a9('0x29')]['findOne']({'where':{'id':_0x3d82eb[_0x22a9('0x43')]['id']}})[_0x22a9('0x24')](handleEntityNotFound(_0x3a7742,null))[_0x22a9('0x24')](function(_0x4683b9){if(_0x4683b9){_0x3d82eb[_0x22a9('0x48')][_0x22a9('0x4e')]=_0x4683b9['id'];_0x3d82eb[_0x22a9('0x48')][_0x22a9('0x4f')]=integrations[_0x22a9('0x50')](_0x3d82eb[_0x22a9('0x48')][_0x22a9('0x51')],_0x3d82eb['body']['type']);_0x3d82eb[_0x22a9('0x48')][_0x22a9('0x52')]=integrations[_0x22a9('0x53')](_0x3d82eb[_0x22a9('0x48')]['channel'],_0x3d82eb[_0x22a9('0x48')]['type']);return db['FreshsalesConfiguration'][_0x22a9('0x46')](_0x3d82eb['body'],{'include':[{'model':db[_0x22a9('0x54')],'as':_0x22a9('0x4f')},{'model':db['FreshsalesField'],'as':_0x22a9('0x52')}]});}return null;})['then'](respondWithResult(_0x3a7742,null))[_0x22a9('0x41')](handleError(_0x3a7742,null));};exports[_0x22a9('0x55')]=function(_0x4ee225,_0x33e34b,_0x30f98f){var _0x554063='';var _0x44b744='';return db[_0x22a9('0x29')][_0x22a9('0x49')]({'where':{'id':_0x4ee225['params']['id']},'attributes':['id',_0x22a9('0x56'),_0x22a9('0x57'),'apiKey']})[_0x22a9('0x24')](handleEntityNotFound(_0x33e34b,null))[_0x22a9('0x24')](function(_0x3edb0d){if(_0x3edb0d){_0x44b744=_0x3edb0d['username'];_0x554063=_0x3edb0d[_0x22a9('0x57')];var _0x381f55=_0x3edb0d[_0x22a9('0x57')][_0x22a9('0x58')](-0x1);if(_0x381f55==='/'){_0x554063=_0x554063[_0x22a9('0x59')](0x0,_0x554063[_0x22a9('0x5a')](_0x381f55));}return rp({'method':_0x22a9('0x5b'),'uri':util[_0x22a9('0x5c')](_0x22a9('0x5d'),_0x554063,_0x22a9('0x5e')),'headers':{'Authorization':'Token\x20token='+_0x3edb0d[_0x22a9('0x5f')]},'json':!![]});}})[_0x22a9('0x24')](function(_0x3d3fd9){if(_0x3d3fd9){var _0x161f3d=_0x3d3fd9[_0x22a9('0x60')];var _0x1e123e=![];var _0x3cbc81=null;for(_0x3cbc81=0x0;_0x3cbc81<_0x161f3d['length'];_0x3cbc81++){if(_0x161f3d[_0x3cbc81][_0x22a9('0x61')]===_0x44b744){_0x1e123e=!![];}}if(_0x1e123e){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x22a9('0x62')});}}})[_0x22a9('0x24')](respondWithResult(_0x33e34b,null))[_0x22a9('0x41')](function(_0x2258b3){var _0x319471=_0x4ee225[_0x22a9('0x30')][_0x22a9('0x63')]?0x1f4:_0x2258b3[_0x22a9('0x64')]||0x1f4;logger[_0x22a9('0x26')](_0x22a9('0x65'),_0x22a9('0x55'),_0x319471,JSON[_0x22a9('0x66')](_0x2258b3));delete _0x2258b3['name'];if(_0x319471===0x191){_0x319471=0x190;}_0x33e34b[_0x22a9('0x19')](_0x319471)['send'](_0x4ee225['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x2258b3[_0x22a9('0x64')]}:_0x2258b3);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index bae220f..fdf7758 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 _0x9536=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts'];(function(_0x455344,_0x12bc4f){var _0x1859fa=function(_0xcf41d6){while(--_0xcf41d6){_0x455344['push'](_0x455344['shift']());}};_0x1859fa(++_0x12bc4f);}(_0x9536,0x179));var _0x6953=function(_0x3474ac,_0x22d0f7){_0x3474ac=_0x3474ac-0x0;var _0x5345ec=_0x9536[_0x3474ac];return _0x5345ec;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var logger=require(_0x6953('0x2'))(_0x6953('0x3'));var moment=require('moment');var BPromise=require(_0x6953('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6953('0x5'));var rimraf=require(_0x6953('0x6'));var config=require(_0x6953('0x7'));var attributes=require(_0x6953('0x8'));var integrations=require(_0x6953('0x9'));module['exports']=function(_0x2b273e,_0x2bb026){return _0x2b273e[_0x6953('0xa')](_0x6953('0xb'),attributes,{'tableName':_0x6953('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c60=['exports','define','FreshsalesAccount','lodash','util','../../config/logger','api','bluebird','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x466904,_0x25c2e1){var _0x2c9646=function(_0x20b76a){while(--_0x20b76a){_0x466904['push'](_0x466904['shift']());}};_0x2c9646(++_0x25c2e1);}(_0x4c60,0xc1));var _0x04c6=function(_0x369d51,_0x5e45f5){_0x369d51=_0x369d51-0x0;var _0x30406d=_0x4c60[_0x369d51];return _0x30406d;};'use strict';var _=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var logger=require(_0x04c6('0x2'))(_0x04c6('0x3'));var moment=require('moment');var BPromise=require(_0x04c6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x04c6('0x5'));var integrations=require(_0x04c6('0x6'));module[_0x04c6('0x7')]=function(_0x12bd5d,_0x2b9041){return _0x12bd5d[_0x04c6('0x8')](_0x04c6('0x9'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index bf5d6bd..570f8c7 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 _0x7046=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshsalesAccount','findAll','options','raw','where','attributes','include','map','model','then','ShowFreshsalesAccount','FreshsalesAccount','find'];(function(_0x21eb04,_0x44d5fd){var _0x53a34c=function(_0x2f3dde){while(--_0x2f3dde){_0x21eb04['push'](_0x21eb04['shift']());}};_0x53a34c(++_0x44d5fd);}(_0x7046,0x144));var _0x6704=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7046[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var moment=require(_0x6704('0x2'));var BPromise=require(_0x6704('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6704('0x4'));var db=require(_0x6704('0x5'))['db'];var utils=require(_0x6704('0x6'));var logger=require('../../config/logger')(_0x6704('0x7'));var config=require(_0x6704('0x8'));var jayson=require(_0x6704('0x9'));var client=jayson[_0x6704('0xa')][_0x6704('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4badf8,_0x5ced8,_0x49b8b6){return new BPromise(function(_0x56b1ff,_0x390ace){return client['request'](_0x4badf8,_0x49b8b6)['then'](function(_0x3ca599){logger[_0x6704('0xc')](_0x6704('0xd'),_0x5ced8,_0x6704('0xe'));logger[_0x6704('0xf')](_0x6704('0x10'),_0x5ced8,_0x6704('0xe'),JSON[_0x6704('0x11')](_0x3ca599));if(_0x3ca599['error']){if(_0x3ca599[_0x6704('0x12')][_0x6704('0x13')]===0x1f4){logger['error'](_0x6704('0xd'),_0x5ced8,_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);return _0x390ace(_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);}logger[_0x6704('0x12')](_0x6704('0xd'),_0x5ced8,_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);return _0x56b1ff(_0x3ca599['error'][_0x6704('0x14')]);}else{logger[_0x6704('0xc')](_0x6704('0xd'),_0x5ced8,'request\x20sent');_0x56b1ff(_0x3ca599[_0x6704('0x15')][_0x6704('0x14')]);}})[_0x6704('0x16')](function(_0x29fa46){logger[_0x6704('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x5ced8,_0x29fa46);_0x390ace(_0x29fa46);});});}exports[_0x6704('0x17')]=function(_0x31d732){var _0x135f4b=this;return new Promise(function(_0xe49450,_0x344ed9){return db['FreshsalesAccount'][_0x6704('0x18')]({'raw':_0x31d732[_0x6704('0x19')]?_0x31d732[_0x6704('0x19')][_0x6704('0x1a')]===undefined?!![]:![]:!![],'where':_0x31d732[_0x6704('0x19')]?_0x31d732[_0x6704('0x19')][_0x6704('0x1b')]||null:null,'attributes':_0x31d732['options']?_0x31d732[_0x6704('0x19')][_0x6704('0x1c')]||null:null,'limit':_0x31d732[_0x6704('0x19')]?_0x31d732['options']['limit']||null:null,'include':_0x31d732[_0x6704('0x19')]?_0x31d732[_0x6704('0x19')][_0x6704('0x1d')]?_[_0x6704('0x1e')](_0x31d732[_0x6704('0x19')]['include'],function(_0xf2c459){return{'model':db[_0xf2c459[_0x6704('0x1f')]],'as':_0xf2c459['as'],'attributes':_0xf2c459[_0x6704('0x1c')],'include':_0xf2c459[_0x6704('0x1d')]?_[_0x6704('0x1e')](_0xf2c459[_0x6704('0x1d')],function(_0x2acafd){return{'model':db[_0x2acafd[_0x6704('0x1f')]],'as':_0x2acafd['as'],'attributes':_0x2acafd[_0x6704('0x1c')],'include':_0x2acafd[_0x6704('0x1d')]?_[_0x6704('0x1e')](_0x2acafd[_0x6704('0x1d')],function(_0x118d93){return{'model':db[_0x118d93['model']],'as':_0x118d93['as'],'attributes':_0x118d93['attributes']};}):[]};}):[]};}):[]:[]})[_0x6704('0x20')](function(_0xf875dc){logger[_0x6704('0xc')](_0x6704('0x17'),_0x31d732);logger['debug'](_0x6704('0x17'),_0x31d732,JSON[_0x6704('0x11')](_0xf875dc));_0xe49450(_0xf875dc);})['catch'](function(_0x588814){logger[_0x6704('0x12')]('GetFreshsalesAccount',_0x588814[_0x6704('0x14')],_0x31d732);_0x344ed9(_0x135f4b['error'](0x1f4,_0x588814['message']));});});};exports[_0x6704('0x21')]=function(_0x115514){var _0x45a286=this;return new Promise(function(_0x4ffa53,_0x1c7132){return db[_0x6704('0x22')][_0x6704('0x23')]({'raw':_0x115514[_0x6704('0x19')]?_0x115514[_0x6704('0x19')][_0x6704('0x1a')]===undefined?!![]:![]:!![],'where':_0x115514[_0x6704('0x19')]?_0x115514[_0x6704('0x19')][_0x6704('0x1b')]||null:null,'attributes':_0x115514[_0x6704('0x19')]?_0x115514[_0x6704('0x19')][_0x6704('0x1c')]||null:null,'include':_0x115514[_0x6704('0x19')]?_0x115514[_0x6704('0x19')][_0x6704('0x1d')]?_[_0x6704('0x1e')](_0x115514[_0x6704('0x19')][_0x6704('0x1d')],function(_0x219494){return{'model':db[_0x219494[_0x6704('0x1f')]],'as':_0x219494['as'],'attributes':_0x219494[_0x6704('0x1c')],'include':_0x219494[_0x6704('0x1d')]?_[_0x6704('0x1e')](_0x219494[_0x6704('0x1d')],function(_0x30b914){return{'model':db[_0x30b914['model']],'as':_0x30b914['as'],'attributes':_0x30b914['attributes'],'include':_0x30b914['include']?_[_0x6704('0x1e')](_0x30b914[_0x6704('0x1d')],function(_0x18222f){return{'model':db[_0x18222f['model']],'as':_0x18222f['as'],'attributes':_0x18222f[_0x6704('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x15da25){logger[_0x6704('0xc')](_0x6704('0x21'),_0x115514);logger[_0x6704('0xf')](_0x6704('0x21'),_0x115514,JSON[_0x6704('0x11')](_0x15da25));_0x4ffa53(_0x15da25);})[_0x6704('0x16')](function(_0x2fba31){logger['error']('ShowFreshsalesAccount',_0x2fba31[_0x6704('0x14')],_0x115514);_0x1c7132(_0x45a286[_0x6704('0x12')](0x1f4,_0x2fba31['message']));});});}; \ No newline at end of file +var _0xb44a=['moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','debug','stringify','error','code','message','info','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','attributes','limit','include','map','model','ShowFreshsalesAccount','find','where'];(function(_0x5afc0e,_0x54e555){var _0x4d85eb=function(_0x4f4f12){while(--_0x4f4f12){_0x5afc0e['push'](_0x5afc0e['shift']());}};_0x4d85eb(++_0x54e555);}(_0xb44a,0x1c2));var _0xab44=function(_0x1e2321,_0x3ae1c5){_0x1e2321=_0x1e2321-0x0;var _0x1d346d=_0xb44a[_0x1e2321];return _0x1d346d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xab44('0x0'));var BPromise=require('bluebird');var rs=require(_0xab44('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xab44('0x2'));var logger=require('../../config/logger')(_0xab44('0x3'));var config=require(_0xab44('0x4'));var jayson=require(_0xab44('0x5'));var client=jayson[_0xab44('0x6')][_0xab44('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3303b1,_0x3ead8d,_0x495825){return new BPromise(function(_0x137a8c,_0x133a6d){return client[_0xab44('0x8')](_0x3303b1,_0x495825)[_0xab44('0x9')](function(_0xa14367){logger['info'](_0xab44('0xa'),_0x3ead8d,'request\x20sent');logger[_0xab44('0xb')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x3ead8d,'request\x20sent',JSON[_0xab44('0xc')](_0xa14367));if(_0xa14367[_0xab44('0xd')]){if(_0xa14367[_0xab44('0xd')][_0xab44('0xe')]===0x1f4){logger[_0xab44('0xd')](_0xab44('0xa'),_0x3ead8d,_0xa14367['error']['message']);return _0x133a6d(_0xa14367[_0xab44('0xd')]['message']);}logger[_0xab44('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x3ead8d,_0xa14367[_0xab44('0xd')][_0xab44('0xf')]);return _0x137a8c(_0xa14367[_0xab44('0xd')][_0xab44('0xf')]);}else{logger[_0xab44('0x10')](_0xab44('0xa'),_0x3ead8d,'request\x20sent');_0x137a8c(_0xa14367['result'][_0xab44('0xf')]);}})[_0xab44('0x11')](function(_0x14fe36){logger[_0xab44('0xd')](_0xab44('0xa'),_0x3ead8d,_0x14fe36);_0x133a6d(_0x14fe36);});});}exports[_0xab44('0x12')]=function(_0x354b09){var _0x44fa43=this;return new Promise(function(_0x310b15,_0xc4b3dc){return db[_0xab44('0x13')]['findAll']({'raw':_0x354b09[_0xab44('0x14')]?_0x354b09[_0xab44('0x14')][_0xab44('0x15')]===undefined?!![]:![]:!![],'where':_0x354b09[_0xab44('0x14')]?_0x354b09[_0xab44('0x14')]['where']||null:null,'attributes':_0x354b09[_0xab44('0x14')]?_0x354b09['options'][_0xab44('0x16')]||null:null,'limit':_0x354b09[_0xab44('0x14')]?_0x354b09[_0xab44('0x14')][_0xab44('0x17')]||null:null,'include':_0x354b09['options']?_0x354b09[_0xab44('0x14')][_0xab44('0x18')]?_[_0xab44('0x19')](_0x354b09[_0xab44('0x14')][_0xab44('0x18')],function(_0x402950){return{'model':db[_0x402950[_0xab44('0x1a')]],'as':_0x402950['as'],'attributes':_0x402950['attributes'],'include':_0x402950['include']?_[_0xab44('0x19')](_0x402950['include'],function(_0x2439f3){return{'model':db[_0x2439f3['model']],'as':_0x2439f3['as'],'attributes':_0x2439f3[_0xab44('0x16')],'include':_0x2439f3['include']?_['map'](_0x2439f3[_0xab44('0x18')],function(_0x25287b){return{'model':db[_0x25287b[_0xab44('0x1a')]],'as':_0x25287b['as'],'attributes':_0x25287b[_0xab44('0x16')]};}):[]};}):[]};}):[]:[]})[_0xab44('0x9')](function(_0x4e820c){logger[_0xab44('0x10')](_0xab44('0x12'),_0x354b09);logger['debug'](_0xab44('0x12'),_0x354b09,JSON[_0xab44('0xc')](_0x4e820c));_0x310b15(_0x4e820c);})[_0xab44('0x11')](function(_0x1cd486){logger[_0xab44('0xd')](_0xab44('0x12'),_0x1cd486['message'],_0x354b09);_0xc4b3dc(_0x44fa43[_0xab44('0xd')](0x1f4,_0x1cd486[_0xab44('0xf')]));});});};exports[_0xab44('0x1b')]=function(_0x47e1be){var _0x54cac8=this;return new Promise(function(_0x106d3a,_0x5082e4){return db['FreshsalesAccount'][_0xab44('0x1c')]({'raw':_0x47e1be[_0xab44('0x14')]?_0x47e1be[_0xab44('0x14')][_0xab44('0x15')]===undefined?!![]:![]:!![],'where':_0x47e1be[_0xab44('0x14')]?_0x47e1be[_0xab44('0x14')][_0xab44('0x1d')]||null:null,'attributes':_0x47e1be[_0xab44('0x14')]?_0x47e1be[_0xab44('0x14')][_0xab44('0x16')]||null:null,'include':_0x47e1be[_0xab44('0x14')]?_0x47e1be[_0xab44('0x14')][_0xab44('0x18')]?_[_0xab44('0x19')](_0x47e1be['options']['include'],function(_0x27e318){return{'model':db[_0x27e318[_0xab44('0x1a')]],'as':_0x27e318['as'],'attributes':_0x27e318['attributes'],'include':_0x27e318[_0xab44('0x18')]?_[_0xab44('0x19')](_0x27e318[_0xab44('0x18')],function(_0x1e0be7){return{'model':db[_0x1e0be7[_0xab44('0x1a')]],'as':_0x1e0be7['as'],'attributes':_0x1e0be7[_0xab44('0x16')],'include':_0x1e0be7[_0xab44('0x18')]?_[_0xab44('0x19')](_0x1e0be7[_0xab44('0x18')],function(_0xe26f9f){return{'model':db[_0xe26f9f[_0xab44('0x1a')]],'as':_0xe26f9f['as'],'attributes':_0xe26f9f[_0xab44('0x16')]};}):[]};}):[]};}):[]:[]})[_0xab44('0x9')](function(_0x532aad){logger[_0xab44('0x10')](_0xab44('0x1b'),_0x47e1be);logger[_0xab44('0xb')](_0xab44('0x1b'),_0x47e1be,JSON['stringify'](_0x532aad));_0x106d3a(_0x532aad);})[_0xab44('0x11')](function(_0x31b599){logger[_0xab44('0xd')](_0xab44('0x1b'),_0x31b599['message'],_0x47e1be);_0x5082e4(_0x54cac8[_0xab44('0xd')](0x1f4,_0x31b599[_0xab44('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 381fdf2..75c856f 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 _0x78fe=['index','get','/:id','isAuthenticated','show','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','create','put','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller'];(function(_0x13f0c4,_0x1e682b){var _0x2af030=function(_0x2a1e4f){while(--_0x2a1e4f){_0x13f0c4['push'](_0x13f0c4['shift']());}};_0x2af030(++_0x1e682b);}(_0x78fe,0x109));var _0xe78f=function(_0x2d8251,_0xa4ba5a){_0x2d8251=_0x2d8251-0x0;var _0x24769e=_0x78fe[_0x2d8251];return _0x24769e;};'use strict';var multer=require(_0xe78f('0x0'));var util=require(_0xe78f('0x1'));var path=require(_0xe78f('0x2'));var timeout=require(_0xe78f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe78f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe78f('0x5'));var config=require(_0xe78f('0x6'));var controller=require(_0xe78f('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xe78f('0x8')]);router[_0xe78f('0x9')](_0xe78f('0xa'),auth[_0xe78f('0xb')](),controller[_0xe78f('0xc')]);router[_0xe78f('0x9')]('/:id/subjects',auth[_0xe78f('0xb')](),controller[_0xe78f('0xd')]);router[_0xe78f('0x9')](_0xe78f('0xe'),auth[_0xe78f('0xb')](),controller[_0xe78f('0xf')]);router['get'](_0xe78f('0x10'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0xe78f('0xb')](),controller[_0xe78f('0x11')]);router[_0xe78f('0x12')](_0xe78f('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xe78f('0x13')](_0xe78f('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xe78f('0x14')]=router; \ No newline at end of file +var _0x0a74=['get','isAuthenticated','index','/:id','show','getDescriptions','/:id/fields','getFields','post','create','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller'];(function(_0x45ee03,_0x2f5319){var _0x13d535=function(_0x391904){while(--_0x391904){_0x45ee03['push'](_0x45ee03['shift']());}};_0x13d535(++_0x2f5319);}(_0x0a74,0xdd));var _0x40a7=function(_0x17ebd1,_0x5bc2e3){_0x17ebd1=_0x17ebd1-0x0;var _0x3fe498=_0x0a74[_0x17ebd1];return _0x3fe498;};'use strict';var multer=require(_0x40a7('0x0'));var util=require(_0x40a7('0x1'));var path=require(_0x40a7('0x2'));var timeout=require('connect-timeout');var express=require(_0x40a7('0x3'));var router=express[_0x40a7('0x4')]();var fs_extra=require(_0x40a7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x40a7('0x6'));var config=require(_0x40a7('0x7'));var controller=require(_0x40a7('0x8'));router[_0x40a7('0x9')]('/',auth[_0x40a7('0xa')](),controller[_0x40a7('0xb')]);router[_0x40a7('0x9')](_0x40a7('0xc'),auth['isAuthenticated'](),controller[_0x40a7('0xd')]);router[_0x40a7('0x9')]('/:id/subjects',auth[_0x40a7('0xa')](),controller['getSubjects']);router[_0x40a7('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x40a7('0xe')]);router[_0x40a7('0x9')](_0x40a7('0xf'),auth[_0x40a7('0xa')](),controller[_0x40a7('0x10')]);router[_0x40a7('0x11')]('/',auth[_0x40a7('0xa')](),controller[_0x40a7('0x12')]);router[_0x40a7('0x13')](_0x40a7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x40a7('0x14')](_0x40a7('0xc'),auth[_0x40a7('0xa')](),controller[_0x40a7('0x15')]);module[_0x40a7('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index de89c2c..ea61fed 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 _0x5ee9=['STRING'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x5ee9,0x11c));var _0x95ee=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x5ee9[_0x2dadb9];return _0x2f0097;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x95ee('0x0')]},'description':{'type':Sequelize[_0x95ee('0x0')]}}; \ No newline at end of file +var _0x357b=['sequelize','exports','STRING'];(function(_0x124b58,_0x1ffc70){var _0x6bef6f=function(_0x1a48a9){while(--_0x1a48a9){_0x124b58['push'](_0x124b58['shift']());}};_0x6bef6f(++_0x1ffc70);}(_0x357b,0x1d1));var _0xb357=function(_0xd4cfc2,_0x203be6){_0xd4cfc2=_0xd4cfc2-0x0;var _0x1069ae=_0x357b[_0xd4cfc2];return _0x1069ae;};'use strict';var Sequelize=require(_0xb357('0x0'));module[_0xb357('0x1')]={'name':{'type':Sequelize[_0xb357('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index e8f1dbb..9e569f4 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 _0xec39=['sort','where','filters','filter','type','VIRTUAL','options','FreshsalesConfiguration','includeAll','include','findAll','params','fields','length','find','catch','create','body','getSubjects','findOne','FreshsalesField','pick','merge','getDescriptions','getFields','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','undefined','count','offset','status','set','Content-Range','json','apply','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','key','map','query','keys','intersection','attributes','model','hasOwnProperty','nolimit','limit','order'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xec39,0xb9));var _0x9ec3=function(_0x913fd2,_0x15113e){_0x913fd2=_0x913fd2-0x0;var _0x187c5b=_0xec39[_0x913fd2];return _0x187c5b;};'use strict';var emlformat=require(_0x9ec3('0x0'));var rimraf=require(_0x9ec3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9ec3('0x2'));var rp=require('request-promise');var moment=require(_0x9ec3('0x3'));var BPromise=require(_0x9ec3('0x4'));var Mustache=require(_0x9ec3('0x5'));var util=require(_0x9ec3('0x6'));var path=require(_0x9ec3('0x7'));var sox=require('sox');var csv=require(_0x9ec3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9ec3('0x9'));var _=require(_0x9ec3('0xa'));var squel=require(_0x9ec3('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9ec3('0xc'));var toCsv=require(_0x9ec3('0x8'));var querystring=require(_0x9ec3('0xd'));var Papa=require(_0x9ec3('0xe'));var Redis=require(_0x9ec3('0xf'));var authService=require(_0x9ec3('0x10'));var qs=require(_0x9ec3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9ec3('0x12'));var logger=require(_0x9ec3('0x13'))(_0x9ec3('0x14'));var utils=require(_0x9ec3('0x15'));var config=require(_0x9ec3('0x16'));var licenseUtil=require(_0x9ec3('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb57d35,_0x496292){_0x496292=_0x496292||0xcc;return function(_0x228b2e){if(_0x228b2e){return _0xb57d35['sendStatus'](_0x496292);}return _0xb57d35['status'](_0x496292)[_0x9ec3('0x18')]();};}function respondWithResult(_0xa894cc,_0xdc0c3){_0xdc0c3=_0xdc0c3||0xc8;return function(_0x25bd61){if(_0x25bd61){return _0xa894cc['status'](_0xdc0c3)['json'](_0x25bd61);}};}function respondWithFilteredResult(_0x1aed27,_0x22241d){return function(_0x53a736){if(_0x53a736){var _0x2ab6eb=typeof _0x22241d['offset']===_0x9ec3('0x19')&&typeof _0x22241d['limit']===_0x9ec3('0x19');var _0x19259a=_0x53a736[_0x9ec3('0x1a')];var _0x2ec966=_0x2ab6eb?0x0:_0x22241d[_0x9ec3('0x1b')];var _0x582385=_0x2ab6eb?_0x53a736[_0x9ec3('0x1a')]:_0x22241d[_0x9ec3('0x1b')]+_0x22241d['limit'];var _0x4c502b;if(_0x582385>=_0x19259a){_0x582385=_0x19259a;_0x4c502b=0xc8;}else{_0x4c502b=0xce;}_0x1aed27[_0x9ec3('0x1c')](_0x4c502b);return _0x1aed27[_0x9ec3('0x1d')](_0x9ec3('0x1e'),_0x2ec966+'-'+_0x582385+'/'+_0x19259a)[_0x9ec3('0x1f')](_0x53a736);}return null;};}function patchUpdates(_0x26b560){return function(_0x57bc88){try{jsonpatch[_0x9ec3('0x20')](_0x57bc88,_0x26b560,!![]);}catch(_0x454ac9){return BPromise['reject'](_0x454ac9);}return _0x57bc88['save']();};}function saveUpdates(_0x5015f5,_0x54d9b9){return function(_0xcf554d){if(_0xcf554d){return _0xcf554d[_0x9ec3('0x21')](_0x5015f5)[_0x9ec3('0x22')](function(_0x1111de){return _0x1111de;});}return null;};}function removeEntity(_0x3482d2,_0x45a937){return function(_0x2de901){if(_0x2de901){return _0x2de901[_0x9ec3('0x23')]()['then'](function(){_0x3482d2['status'](0xcc)[_0x9ec3('0x18')]();});}};}function handleEntityNotFound(_0x4b147d,_0x1ec13c){return function(_0x1a7a0b){if(!_0x1a7a0b){_0x4b147d[_0x9ec3('0x24')](0x194);}return _0x1a7a0b;};}function handleError(_0x1549e3,_0x494b6f){_0x494b6f=_0x494b6f||0x1f4;return function(_0xa7d20c){logger[_0x9ec3('0x25')](_0xa7d20c[_0x9ec3('0x26')]);if(_0xa7d20c[_0x9ec3('0x27')]){delete _0xa7d20c[_0x9ec3('0x27')];}_0x1549e3['status'](_0x494b6f)[_0x9ec3('0x28')](_0xa7d20c);};}exports[_0x9ec3('0x29')]=function(_0x24aa7b,_0x483740){var _0x442de8={},_0x2f9e9a={},_0x11a954={'count':0x0,'rows':[]};var _0x354941=_['map'](db['FreshsalesConfiguration'][_0x9ec3('0x2a')],function(_0x14410a){return{'name':_0x14410a[_0x9ec3('0x2b')],'type':_0x14410a['type'][_0x9ec3('0x2c')]};});_0x2f9e9a['model']=_[_0x9ec3('0x2d')](_0x354941,_0x9ec3('0x27'));_0x2f9e9a[_0x9ec3('0x2e')]=_[_0x9ec3('0x2f')](_0x24aa7b[_0x9ec3('0x2e')]);_0x2f9e9a['filters']=_[_0x9ec3('0x30')](_0x2f9e9a['model'],_0x2f9e9a[_0x9ec3('0x2e')]);_0x442de8[_0x9ec3('0x31')]=_[_0x9ec3('0x30')](_0x2f9e9a[_0x9ec3('0x32')],qs['fields'](_0x24aa7b['query']['fields']));_0x442de8[_0x9ec3('0x31')]=_0x442de8['attributes']['length']?_0x442de8[_0x9ec3('0x31')]:_0x2f9e9a[_0x9ec3('0x32')];if(!_0x24aa7b[_0x9ec3('0x2e')][_0x9ec3('0x33')](_0x9ec3('0x34'))){_0x442de8['limit']=qs[_0x9ec3('0x35')](_0x24aa7b[_0x9ec3('0x2e')][_0x9ec3('0x35')]);_0x442de8[_0x9ec3('0x1b')]=qs[_0x9ec3('0x1b')](_0x24aa7b[_0x9ec3('0x2e')]['offset']);}_0x442de8[_0x9ec3('0x36')]=qs[_0x9ec3('0x37')](_0x24aa7b[_0x9ec3('0x2e')][_0x9ec3('0x37')]);_0x442de8[_0x9ec3('0x38')]=qs[_0x9ec3('0x39')](_['pick'](_0x24aa7b['query'],_0x2f9e9a['filters']),_0x354941);if(_0x24aa7b['query'][_0x9ec3('0x3a')]){_0x442de8[_0x9ec3('0x38')]=_['merge'](_0x442de8['where'],{'$or':_[_0x9ec3('0x2d')](_0x354941,function(_0x54b8dd){if(_0x54b8dd[_0x9ec3('0x3b')]!==_0x9ec3('0x3c')){var _0x1e1936={};_0x1e1936[_0x54b8dd['name']]={'$like':'%'+_0x24aa7b[_0x9ec3('0x2e')][_0x9ec3('0x3a')]+'%'};return _0x1e1936;}})});}_0x442de8=_['merge']({},_0x442de8,_0x24aa7b[_0x9ec3('0x3d')]);var _0x197bf6={'where':_0x442de8['where']};return db[_0x9ec3('0x3e')][_0x9ec3('0x1a')](_0x197bf6)[_0x9ec3('0x22')](function(_0x423677){_0x11a954[_0x9ec3('0x1a')]=_0x423677;if(_0x24aa7b[_0x9ec3('0x2e')][_0x9ec3('0x3f')]){_0x442de8[_0x9ec3('0x40')]=[{'all':!![]}];}return db[_0x9ec3('0x3e')][_0x9ec3('0x41')](_0x442de8);})[_0x9ec3('0x22')](function(_0x152630){_0x11a954['rows']=_0x152630;return _0x11a954;})[_0x9ec3('0x22')](respondWithFilteredResult(_0x483740,_0x442de8))['catch'](handleError(_0x483740,null));};exports['show']=function(_0x191e39,_0x3898cc){var _0x3efac6={'raw':![],'where':{'id':_0x191e39[_0x9ec3('0x42')]['id']}},_0x1dfa5f={};_0x1dfa5f[_0x9ec3('0x32')]=_['keys'](db[_0x9ec3('0x3e')][_0x9ec3('0x2a')]);_0x1dfa5f[_0x9ec3('0x2e')]=_['keys'](_0x191e39[_0x9ec3('0x2e')]);_0x1dfa5f[_0x9ec3('0x39')]=_[_0x9ec3('0x30')](_0x1dfa5f[_0x9ec3('0x32')],_0x1dfa5f[_0x9ec3('0x2e')]);_0x3efac6[_0x9ec3('0x31')]=_[_0x9ec3('0x30')](_0x1dfa5f[_0x9ec3('0x32')],qs[_0x9ec3('0x43')](_0x191e39[_0x9ec3('0x2e')][_0x9ec3('0x43')]));_0x3efac6[_0x9ec3('0x31')]=_0x3efac6['attributes'][_0x9ec3('0x44')]?_0x3efac6['attributes']:_0x1dfa5f['model'];if(_0x191e39['query'][_0x9ec3('0x3f')]){_0x3efac6[_0x9ec3('0x40')]=[{'all':!![]}];}_0x3efac6=_['merge']({},_0x3efac6,_0x191e39['options']);return db['FreshsalesConfiguration'][_0x9ec3('0x45')](_0x3efac6)['then'](handleEntityNotFound(_0x3898cc,null))[_0x9ec3('0x22')](respondWithResult(_0x3898cc,null))[_0x9ec3('0x46')](handleError(_0x3898cc,null));};exports[_0x9ec3('0x47')]=function(_0x3f15f5,_0x2c3e99){return db['FreshsalesConfiguration'][_0x9ec3('0x47')](_0x3f15f5[_0x9ec3('0x48')],{})[_0x9ec3('0x22')](respondWithResult(_0x2c3e99,0xc9))[_0x9ec3('0x46')](handleError(_0x2c3e99,null));};exports[_0x9ec3('0x21')]=function(_0xf10454,_0x2a6092){if(_0xf10454[_0x9ec3('0x48')]['id']){delete _0xf10454['body']['id'];}return db['FreshsalesConfiguration'][_0x9ec3('0x45')]({'where':{'id':_0xf10454[_0x9ec3('0x42')]['id']}})[_0x9ec3('0x22')](handleEntityNotFound(_0x2a6092,null))['then'](saveUpdates(_0xf10454[_0x9ec3('0x48')],null))[_0x9ec3('0x22')](respondWithResult(_0x2a6092,null))[_0x9ec3('0x46')](handleError(_0x2a6092,null));};exports[_0x9ec3('0x23')]=function(_0x3b4896,_0x40beb9){return db[_0x9ec3('0x3e')][_0x9ec3('0x45')]({'where':{'id':_0x3b4896[_0x9ec3('0x42')]['id']}})['then'](handleEntityNotFound(_0x40beb9,null))['then'](removeEntity(_0x40beb9,null))[_0x9ec3('0x46')](handleError(_0x40beb9,null));};exports[_0x9ec3('0x49')]=function(_0x556b68,_0x378c70,_0x52f30b){var _0x5db4d6={};var _0x2326b0={};var _0x330320;var _0x30d95d;return db['FreshsalesConfiguration'][_0x9ec3('0x4a')]({'where':{'id':_0x556b68['params']['id']}})[_0x9ec3('0x22')](handleEntityNotFound(_0x378c70,null))[_0x9ec3('0x22')](function(_0x2769dd){if(_0x2769dd){_0x330320=_0x2769dd;_0x2326b0[_0x9ec3('0x32')]=_[_0x9ec3('0x2f')](db[_0x9ec3('0x4b')][_0x9ec3('0x2a')]);_0x2326b0[_0x9ec3('0x2e')]=_[_0x9ec3('0x2f')](_0x556b68['query']);_0x2326b0[_0x9ec3('0x39')]=_['intersection'](_0x2326b0[_0x9ec3('0x32')],_0x2326b0[_0x9ec3('0x2e')]);_0x5db4d6[_0x9ec3('0x31')]=_['intersection'](_0x2326b0[_0x9ec3('0x32')],qs['fields'](_0x556b68[_0x9ec3('0x2e')][_0x9ec3('0x43')]));_0x5db4d6[_0x9ec3('0x31')]=_0x5db4d6[_0x9ec3('0x31')]['length']?_0x5db4d6['attributes']:_0x2326b0[_0x9ec3('0x32')];_0x5db4d6['order']=qs['sort'](_0x556b68['query'][_0x9ec3('0x37')]);_0x5db4d6[_0x9ec3('0x38')]=qs[_0x9ec3('0x39')](_[_0x9ec3('0x4c')](_0x556b68[_0x9ec3('0x2e')],_0x2326b0[_0x9ec3('0x39')]));if(_0x556b68['query']['filter']){_0x5db4d6[_0x9ec3('0x38')]=_[_0x9ec3('0x4d')](_0x5db4d6[_0x9ec3('0x38')],{'$or':_[_0x9ec3('0x2d')](_0x5db4d6['attributes'],function(_0x4d5218){var _0x3360c6={};_0x3360c6[_0x4d5218]={'$like':'%'+_0x556b68['query'][_0x9ec3('0x3a')]+'%'};return _0x3360c6;})});}_0x5db4d6=_['merge']({},_0x5db4d6,_0x556b68[_0x9ec3('0x3d')]);return _0x330320[_0x9ec3('0x49')](_0x5db4d6);}})[_0x9ec3('0x22')](function(_0x364467){if(_0x364467){_0x30d95d=_0x364467[_0x9ec3('0x44')];if(!_0x556b68[_0x9ec3('0x2e')][_0x9ec3('0x33')](_0x9ec3('0x34'))){_0x5db4d6[_0x9ec3('0x35')]=qs['limit'](_0x556b68[_0x9ec3('0x2e')][_0x9ec3('0x35')]);_0x5db4d6[_0x9ec3('0x1b')]=qs[_0x9ec3('0x1b')](_0x556b68[_0x9ec3('0x2e')][_0x9ec3('0x1b')]);}return _0x330320[_0x9ec3('0x49')](_0x5db4d6);}})[_0x9ec3('0x22')](function(_0x6b36e0){if(_0x6b36e0){return _0x6b36e0?{'count':_0x30d95d,'rows':_0x6b36e0}:null;}})['then'](respondWithResult(_0x378c70,null))['catch'](handleError(_0x378c70,null));};exports[_0x9ec3('0x4e')]=function(_0x562253,_0x326e0b,_0x319d26){var _0x335a51={};var _0x4f9a3a={};var _0x4ef4a7;var _0x96a998;return db[_0x9ec3('0x3e')][_0x9ec3('0x4a')]({'where':{'id':_0x562253[_0x9ec3('0x42')]['id']}})[_0x9ec3('0x22')](handleEntityNotFound(_0x326e0b,null))[_0x9ec3('0x22')](function(_0x5ea218){if(_0x5ea218){_0x4ef4a7=_0x5ea218;_0x4f9a3a[_0x9ec3('0x32')]=_[_0x9ec3('0x2f')](db[_0x9ec3('0x4b')][_0x9ec3('0x2a')]);_0x4f9a3a['query']=_[_0x9ec3('0x2f')](_0x562253[_0x9ec3('0x2e')]);_0x4f9a3a['filters']=_[_0x9ec3('0x30')](_0x4f9a3a[_0x9ec3('0x32')],_0x4f9a3a['query']);_0x335a51[_0x9ec3('0x31')]=_['intersection'](_0x4f9a3a[_0x9ec3('0x32')],qs['fields'](_0x562253[_0x9ec3('0x2e')][_0x9ec3('0x43')]));_0x335a51[_0x9ec3('0x31')]=_0x335a51[_0x9ec3('0x31')][_0x9ec3('0x44')]?_0x335a51[_0x9ec3('0x31')]:_0x4f9a3a[_0x9ec3('0x32')];_0x335a51[_0x9ec3('0x36')]=qs[_0x9ec3('0x37')](_0x562253[_0x9ec3('0x2e')]['sort']);_0x335a51[_0x9ec3('0x38')]=qs['filters'](_[_0x9ec3('0x4c')](_0x562253[_0x9ec3('0x2e')],_0x4f9a3a[_0x9ec3('0x39')]));if(_0x562253['query']['filter']){_0x335a51[_0x9ec3('0x38')]=_[_0x9ec3('0x4d')](_0x335a51['where'],{'$or':_[_0x9ec3('0x2d')](_0x335a51[_0x9ec3('0x31')],function(_0x48f0a7){var _0x4a4e9b={};_0x4a4e9b[_0x48f0a7]={'$like':'%'+_0x562253[_0x9ec3('0x2e')]['filter']+'%'};return _0x4a4e9b;})});}_0x335a51=_[_0x9ec3('0x4d')]({},_0x335a51,_0x562253['options']);return _0x4ef4a7[_0x9ec3('0x4e')](_0x335a51);}})[_0x9ec3('0x22')](function(_0x4e2cc9){if(_0x4e2cc9){_0x96a998=_0x4e2cc9[_0x9ec3('0x44')];if(!_0x562253['query']['hasOwnProperty']('nolimit')){_0x335a51['limit']=qs[_0x9ec3('0x35')](_0x562253[_0x9ec3('0x2e')][_0x9ec3('0x35')]);_0x335a51[_0x9ec3('0x1b')]=qs[_0x9ec3('0x1b')](_0x562253[_0x9ec3('0x2e')][_0x9ec3('0x1b')]);}return _0x4ef4a7[_0x9ec3('0x4e')](_0x335a51);}})[_0x9ec3('0x22')](function(_0x508314){if(_0x508314){return _0x508314?{'count':_0x96a998,'rows':_0x508314}:null;}})[_0x9ec3('0x22')](respondWithResult(_0x326e0b,null))[_0x9ec3('0x46')](handleError(_0x326e0b,null));};exports['getFields']=function(_0x4072e1,_0x365758,_0x53f45c){var _0x221e2b={};var _0x223e77={};var _0x56c200;var _0x2fd273;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x4072e1[_0x9ec3('0x42')]['id']}})[_0x9ec3('0x22')](handleEntityNotFound(_0x365758,null))[_0x9ec3('0x22')](function(_0x37dbd7){if(_0x37dbd7){_0x56c200=_0x37dbd7;_0x223e77[_0x9ec3('0x32')]=_[_0x9ec3('0x2f')](db['FreshsalesField']['rawAttributes']);_0x223e77[_0x9ec3('0x2e')]=_[_0x9ec3('0x2f')](_0x4072e1[_0x9ec3('0x2e')]);_0x223e77[_0x9ec3('0x39')]=_[_0x9ec3('0x30')](_0x223e77[_0x9ec3('0x32')],_0x223e77[_0x9ec3('0x2e')]);_0x221e2b[_0x9ec3('0x31')]=_[_0x9ec3('0x30')](_0x223e77[_0x9ec3('0x32')],qs[_0x9ec3('0x43')](_0x4072e1['query'][_0x9ec3('0x43')]));_0x221e2b['attributes']=_0x221e2b['attributes'][_0x9ec3('0x44')]?_0x221e2b[_0x9ec3('0x31')]:_0x223e77['model'];_0x221e2b[_0x9ec3('0x36')]=qs[_0x9ec3('0x37')](_0x4072e1[_0x9ec3('0x2e')][_0x9ec3('0x37')]);_0x221e2b[_0x9ec3('0x38')]=qs[_0x9ec3('0x39')](_['pick'](_0x4072e1['query'],_0x223e77['filters']));if(_0x4072e1[_0x9ec3('0x2e')][_0x9ec3('0x3a')]){_0x221e2b[_0x9ec3('0x38')]=_[_0x9ec3('0x4d')](_0x221e2b[_0x9ec3('0x38')],{'$or':_[_0x9ec3('0x2d')](_0x221e2b[_0x9ec3('0x31')],function(_0x3030a5){var _0x1098d3={};_0x1098d3[_0x3030a5]={'$like':'%'+_0x4072e1['query']['filter']+'%'};return _0x1098d3;})});}_0x221e2b=_['merge']({},_0x221e2b,_0x4072e1[_0x9ec3('0x3d')]);return _0x56c200[_0x9ec3('0x4f')](_0x221e2b);}})[_0x9ec3('0x22')](function(_0x390aa0){if(_0x390aa0){_0x2fd273=_0x390aa0[_0x9ec3('0x44')];if(!_0x4072e1[_0x9ec3('0x2e')][_0x9ec3('0x33')](_0x9ec3('0x34'))){_0x221e2b['limit']=qs[_0x9ec3('0x35')](_0x4072e1[_0x9ec3('0x2e')][_0x9ec3('0x35')]);_0x221e2b[_0x9ec3('0x1b')]=qs[_0x9ec3('0x1b')](_0x4072e1[_0x9ec3('0x2e')][_0x9ec3('0x1b')]);}return _0x56c200[_0x9ec3('0x4f')](_0x221e2b);}})['then'](function(_0x309a72){if(_0x309a72){return _0x309a72?{'count':_0x2fd273,'rows':_0x309a72}:null;}})[_0x9ec3('0x22')](respondWithResult(_0x365758,null))[_0x9ec3('0x46')](handleError(_0x365758,null));}; \ No newline at end of file +var _0x54f2=['query','keys','intersection','model','fields','attributes','nolimit','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','update','body','getSubjects','findOne','FreshsalesField','order','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','path','to-csv','fs-extra','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','then','sendStatus','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key'];(function(_0x32a89b,_0xc3b8e2){var _0x119ba5=function(_0x44870e){while(--_0x44870e){_0x32a89b['push'](_0x32a89b['shift']());}};_0x119ba5(++_0xc3b8e2);}(_0x54f2,0x18d));var _0x254f=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x54f2[_0x20a558];return _0x53d3f7;};'use strict';var emlformat=require(_0x254f('0x0'));var rimraf=require(_0x254f('0x1'));var zipdir=require(_0x254f('0x2'));var jsonpatch=require(_0x254f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x254f('0x4'));var sox=require('sox');var csv=require(_0x254f('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x254f('0x6'));var _=require('lodash');var squel=require(_0x254f('0x7'));var crypto=require(_0x254f('0x8'));var jsforce=require(_0x254f('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x254f('0x5'));var querystring=require(_0x254f('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x254f('0xb'));var as=require(_0x254f('0xc'));var hardwareService=require(_0x254f('0xd'));var logger=require(_0x254f('0xe'))(_0x254f('0xf'));var utils=require(_0x254f('0x10'));var config=require(_0x254f('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x254f('0x12'))['db'];function respondWithStatusCode(_0x5675ea,_0x296cab){_0x296cab=_0x296cab||0xcc;return function(_0x1b3dbc){if(_0x1b3dbc){return _0x5675ea['sendStatus'](_0x296cab);}return _0x5675ea['status'](_0x296cab)[_0x254f('0x13')]();};}function respondWithResult(_0x54237a,_0x231fae){_0x231fae=_0x231fae||0xc8;return function(_0x181024){if(_0x181024){return _0x54237a[_0x254f('0x14')](_0x231fae)[_0x254f('0x15')](_0x181024);}};}function respondWithFilteredResult(_0x48e144,_0x228c51){return function(_0x288ce3){if(_0x288ce3){var _0x435684=typeof _0x228c51[_0x254f('0x16')]===_0x254f('0x17')&&typeof _0x228c51[_0x254f('0x18')]===_0x254f('0x17');var _0x46eb1e=_0x288ce3[_0x254f('0x19')];var _0x548009=_0x435684?0x0:_0x228c51[_0x254f('0x16')];var _0xac78f3=_0x435684?_0x288ce3['count']:_0x228c51[_0x254f('0x16')]+_0x228c51[_0x254f('0x18')];var _0x5f1984;if(_0xac78f3>=_0x46eb1e){_0xac78f3=_0x46eb1e;_0x5f1984=0xc8;}else{_0x5f1984=0xce;}_0x48e144[_0x254f('0x14')](_0x5f1984);return _0x48e144['set'](_0x254f('0x1a'),_0x548009+'-'+_0xac78f3+'/'+_0x46eb1e)['json'](_0x288ce3);}return null;};}function patchUpdates(_0x1fc8e1){return function(_0x147d1b){try{jsonpatch['apply'](_0x147d1b,_0x1fc8e1,!![]);}catch(_0xddeca7){return BPromise[_0x254f('0x1b')](_0xddeca7);}return _0x147d1b[_0x254f('0x1c')]();};}function saveUpdates(_0x14e03c,_0x153428){return function(_0x79aba6){if(_0x79aba6){return _0x79aba6['update'](_0x14e03c)['then'](function(_0x5ac67a){return _0x5ac67a;});}return null;};}function removeEntity(_0x2e2d2e,_0xfaa928){return function(_0x12de0f){if(_0x12de0f){return _0x12de0f['destroy']()[_0x254f('0x1d')](function(){_0x2e2d2e[_0x254f('0x14')](0xcc)[_0x254f('0x13')]();});}};}function handleEntityNotFound(_0x301fb7,_0x3d3f25){return function(_0x44862d){if(!_0x44862d){_0x301fb7[_0x254f('0x1e')](0x194);}return _0x44862d;};}function handleError(_0x5de29c,_0x20c9b4){_0x20c9b4=_0x20c9b4||0x1f4;return function(_0x439612){logger['error'](_0x439612[_0x254f('0x1f')]);if(_0x439612['name']){delete _0x439612[_0x254f('0x20')];}_0x5de29c[_0x254f('0x14')](_0x20c9b4)[_0x254f('0x21')](_0x439612);};}exports[_0x254f('0x22')]=function(_0x4ea596,_0x25d3a4){var _0x149fcc={},_0x3c0460={},_0x1c142a={'count':0x0,'rows':[]};var _0x33fcc7=_[_0x254f('0x23')](db[_0x254f('0x24')][_0x254f('0x25')],function(_0x2f9a0b){return{'name':_0x2f9a0b[_0x254f('0x26')],'type':_0x2f9a0b[_0x254f('0x27')][_0x254f('0x28')]};});_0x3c0460['model']=_['map'](_0x33fcc7,_0x254f('0x20'));_0x3c0460[_0x254f('0x29')]=_[_0x254f('0x2a')](_0x4ea596[_0x254f('0x29')]);_0x3c0460['filters']=_[_0x254f('0x2b')](_0x3c0460[_0x254f('0x2c')],_0x3c0460[_0x254f('0x29')]);_0x149fcc['attributes']=_[_0x254f('0x2b')](_0x3c0460[_0x254f('0x2c')],qs[_0x254f('0x2d')](_0x4ea596[_0x254f('0x29')][_0x254f('0x2d')]));_0x149fcc[_0x254f('0x2e')]=_0x149fcc[_0x254f('0x2e')]['length']?_0x149fcc[_0x254f('0x2e')]:_0x3c0460[_0x254f('0x2c')];if(!_0x4ea596[_0x254f('0x29')]['hasOwnProperty'](_0x254f('0x2f'))){_0x149fcc[_0x254f('0x18')]=qs[_0x254f('0x18')](_0x4ea596[_0x254f('0x29')][_0x254f('0x18')]);_0x149fcc[_0x254f('0x16')]=qs[_0x254f('0x16')](_0x4ea596[_0x254f('0x29')][_0x254f('0x16')]);}_0x149fcc['order']=qs['sort'](_0x4ea596[_0x254f('0x29')][_0x254f('0x30')]);_0x149fcc['where']=qs[_0x254f('0x31')](_[_0x254f('0x32')](_0x4ea596[_0x254f('0x29')],_0x3c0460[_0x254f('0x31')]),_0x33fcc7);if(_0x4ea596['query'][_0x254f('0x33')]){_0x149fcc[_0x254f('0x34')]=_[_0x254f('0x35')](_0x149fcc[_0x254f('0x34')],{'$or':_[_0x254f('0x23')](_0x33fcc7,function(_0x1ff277){if(_0x1ff277['type']!=='VIRTUAL'){var _0x2a3e5f={};_0x2a3e5f[_0x1ff277[_0x254f('0x20')]]={'$like':'%'+_0x4ea596[_0x254f('0x29')]['filter']+'%'};return _0x2a3e5f;}})});}_0x149fcc=_[_0x254f('0x35')]({},_0x149fcc,_0x4ea596[_0x254f('0x36')]);var _0x4d1f52={'where':_0x149fcc['where']};return db[_0x254f('0x24')]['count'](_0x4d1f52)[_0x254f('0x1d')](function(_0x508592){_0x1c142a[_0x254f('0x19')]=_0x508592;if(_0x4ea596[_0x254f('0x29')][_0x254f('0x37')]){_0x149fcc[_0x254f('0x38')]=[{'all':!![]}];}return db[_0x254f('0x24')][_0x254f('0x39')](_0x149fcc);})[_0x254f('0x1d')](function(_0x280138){_0x1c142a[_0x254f('0x3a')]=_0x280138;return _0x1c142a;})[_0x254f('0x1d')](respondWithFilteredResult(_0x25d3a4,_0x149fcc))[_0x254f('0x3b')](handleError(_0x25d3a4,null));};exports[_0x254f('0x3c')]=function(_0x3fbca1,_0x57a0f0){var _0x31b474={'raw':![],'where':{'id':_0x3fbca1[_0x254f('0x3d')]['id']}},_0x2629bf={};_0x2629bf[_0x254f('0x2c')]=_['keys'](db[_0x254f('0x24')][_0x254f('0x25')]);_0x2629bf[_0x254f('0x29')]=_['keys'](_0x3fbca1[_0x254f('0x29')]);_0x2629bf[_0x254f('0x31')]=_[_0x254f('0x2b')](_0x2629bf[_0x254f('0x2c')],_0x2629bf['query']);_0x31b474['attributes']=_[_0x254f('0x2b')](_0x2629bf[_0x254f('0x2c')],qs['fields'](_0x3fbca1[_0x254f('0x29')][_0x254f('0x2d')]));_0x31b474[_0x254f('0x2e')]=_0x31b474[_0x254f('0x2e')][_0x254f('0x3e')]?_0x31b474[_0x254f('0x2e')]:_0x2629bf[_0x254f('0x2c')];if(_0x3fbca1[_0x254f('0x29')][_0x254f('0x37')]){_0x31b474[_0x254f('0x38')]=[{'all':!![]}];}_0x31b474=_[_0x254f('0x35')]({},_0x31b474,_0x3fbca1[_0x254f('0x36')]);return db[_0x254f('0x24')][_0x254f('0x3f')](_0x31b474)[_0x254f('0x1d')](handleEntityNotFound(_0x57a0f0,null))['then'](respondWithResult(_0x57a0f0,null))[_0x254f('0x3b')](handleError(_0x57a0f0,null));};exports[_0x254f('0x40')]=function(_0x26acf0,_0x56a117){return db[_0x254f('0x24')][_0x254f('0x40')](_0x26acf0['body'],{})[_0x254f('0x1d')](respondWithResult(_0x56a117,0xc9))['catch'](handleError(_0x56a117,null));};exports[_0x254f('0x41')]=function(_0x5bc673,_0x1d258e){if(_0x5bc673['body']['id']){delete _0x5bc673[_0x254f('0x42')]['id'];}return db[_0x254f('0x24')][_0x254f('0x3f')]({'where':{'id':_0x5bc673[_0x254f('0x3d')]['id']}})[_0x254f('0x1d')](handleEntityNotFound(_0x1d258e,null))[_0x254f('0x1d')](saveUpdates(_0x5bc673[_0x254f('0x42')],null))['then'](respondWithResult(_0x1d258e,null))[_0x254f('0x3b')](handleError(_0x1d258e,null));};exports['destroy']=function(_0x5a5844,_0x10bdc9){return db[_0x254f('0x24')][_0x254f('0x3f')]({'where':{'id':_0x5a5844[_0x254f('0x3d')]['id']}})[_0x254f('0x1d')](handleEntityNotFound(_0x10bdc9,null))[_0x254f('0x1d')](removeEntity(_0x10bdc9,null))[_0x254f('0x3b')](handleError(_0x10bdc9,null));};exports[_0x254f('0x43')]=function(_0x1d180a,_0x323912,_0xa7a177){var _0x52d0a6={};var _0xfd3c9c={};var _0x11a5f6;var _0x33886f;return db[_0x254f('0x24')][_0x254f('0x44')]({'where':{'id':_0x1d180a['params']['id']}})[_0x254f('0x1d')](handleEntityNotFound(_0x323912,null))[_0x254f('0x1d')](function(_0x2e2866){if(_0x2e2866){_0x11a5f6=_0x2e2866;_0xfd3c9c[_0x254f('0x2c')]=_[_0x254f('0x2a')](db[_0x254f('0x45')][_0x254f('0x25')]);_0xfd3c9c[_0x254f('0x29')]=_[_0x254f('0x2a')](_0x1d180a['query']);_0xfd3c9c[_0x254f('0x31')]=_[_0x254f('0x2b')](_0xfd3c9c[_0x254f('0x2c')],_0xfd3c9c[_0x254f('0x29')]);_0x52d0a6[_0x254f('0x2e')]=_['intersection'](_0xfd3c9c[_0x254f('0x2c')],qs['fields'](_0x1d180a[_0x254f('0x29')][_0x254f('0x2d')]));_0x52d0a6[_0x254f('0x2e')]=_0x52d0a6['attributes'][_0x254f('0x3e')]?_0x52d0a6['attributes']:_0xfd3c9c[_0x254f('0x2c')];_0x52d0a6[_0x254f('0x46')]=qs['sort'](_0x1d180a[_0x254f('0x29')]['sort']);_0x52d0a6['where']=qs[_0x254f('0x31')](_[_0x254f('0x32')](_0x1d180a[_0x254f('0x29')],_0xfd3c9c[_0x254f('0x31')]));if(_0x1d180a[_0x254f('0x29')]['filter']){_0x52d0a6[_0x254f('0x34')]=_['merge'](_0x52d0a6['where'],{'$or':_[_0x254f('0x23')](_0x52d0a6[_0x254f('0x2e')],function(_0x11f9f4){var _0x36bb3e={};_0x36bb3e[_0x11f9f4]={'$like':'%'+_0x1d180a[_0x254f('0x29')][_0x254f('0x33')]+'%'};return _0x36bb3e;})});}_0x52d0a6=_[_0x254f('0x35')]({},_0x52d0a6,_0x1d180a[_0x254f('0x36')]);return _0x11a5f6[_0x254f('0x43')](_0x52d0a6);}})[_0x254f('0x1d')](function(_0x13345b){if(_0x13345b){_0x33886f=_0x13345b[_0x254f('0x3e')];if(!_0x1d180a[_0x254f('0x29')][_0x254f('0x47')](_0x254f('0x2f'))){_0x52d0a6[_0x254f('0x18')]=qs['limit'](_0x1d180a[_0x254f('0x29')][_0x254f('0x18')]);_0x52d0a6['offset']=qs[_0x254f('0x16')](_0x1d180a['query'][_0x254f('0x16')]);}return _0x11a5f6['getSubjects'](_0x52d0a6);}})[_0x254f('0x1d')](function(_0xd0a9c2){if(_0xd0a9c2){return _0xd0a9c2?{'count':_0x33886f,'rows':_0xd0a9c2}:null;}})['then'](respondWithResult(_0x323912,null))['catch'](handleError(_0x323912,null));};exports[_0x254f('0x48')]=function(_0x97a144,_0x27c6fc,_0x1598a8){var _0x502f5a={};var _0x2f6d28={};var _0x401ac5;var _0x4d82ee;return db[_0x254f('0x24')][_0x254f('0x44')]({'where':{'id':_0x97a144[_0x254f('0x3d')]['id']}})[_0x254f('0x1d')](handleEntityNotFound(_0x27c6fc,null))['then'](function(_0x47b0e1){if(_0x47b0e1){_0x401ac5=_0x47b0e1;_0x2f6d28[_0x254f('0x2c')]=_[_0x254f('0x2a')](db[_0x254f('0x45')][_0x254f('0x25')]);_0x2f6d28[_0x254f('0x29')]=_[_0x254f('0x2a')](_0x97a144[_0x254f('0x29')]);_0x2f6d28[_0x254f('0x31')]=_[_0x254f('0x2b')](_0x2f6d28[_0x254f('0x2c')],_0x2f6d28[_0x254f('0x29')]);_0x502f5a[_0x254f('0x2e')]=_[_0x254f('0x2b')](_0x2f6d28[_0x254f('0x2c')],qs['fields'](_0x97a144[_0x254f('0x29')][_0x254f('0x2d')]));_0x502f5a[_0x254f('0x2e')]=_0x502f5a[_0x254f('0x2e')][_0x254f('0x3e')]?_0x502f5a[_0x254f('0x2e')]:_0x2f6d28['model'];_0x502f5a[_0x254f('0x46')]=qs['sort'](_0x97a144[_0x254f('0x29')][_0x254f('0x30')]);_0x502f5a[_0x254f('0x34')]=qs[_0x254f('0x31')](_['pick'](_0x97a144[_0x254f('0x29')],_0x2f6d28[_0x254f('0x31')]));if(_0x97a144[_0x254f('0x29')][_0x254f('0x33')]){_0x502f5a[_0x254f('0x34')]=_['merge'](_0x502f5a[_0x254f('0x34')],{'$or':_[_0x254f('0x23')](_0x502f5a[_0x254f('0x2e')],function(_0x293c00){var _0x210836={};_0x210836[_0x293c00]={'$like':'%'+_0x97a144[_0x254f('0x29')][_0x254f('0x33')]+'%'};return _0x210836;})});}_0x502f5a=_['merge']({},_0x502f5a,_0x97a144[_0x254f('0x36')]);return _0x401ac5['getDescriptions'](_0x502f5a);}})['then'](function(_0x3d8788){if(_0x3d8788){_0x4d82ee=_0x3d8788[_0x254f('0x3e')];if(!_0x97a144['query'][_0x254f('0x47')](_0x254f('0x2f'))){_0x502f5a['limit']=qs[_0x254f('0x18')](_0x97a144[_0x254f('0x29')][_0x254f('0x18')]);_0x502f5a[_0x254f('0x16')]=qs[_0x254f('0x16')](_0x97a144[_0x254f('0x29')]['offset']);}return _0x401ac5[_0x254f('0x48')](_0x502f5a);}})[_0x254f('0x1d')](function(_0x457222){if(_0x457222){return _0x457222?{'count':_0x4d82ee,'rows':_0x457222}:null;}})[_0x254f('0x1d')](respondWithResult(_0x27c6fc,null))[_0x254f('0x3b')](handleError(_0x27c6fc,null));};exports['getFields']=function(_0x159501,_0x1f7097,_0x4cbe37){var _0x901d76={};var _0x30d5b7={};var _0x2e704c;var _0x346ef2;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x159501[_0x254f('0x3d')]['id']}})[_0x254f('0x1d')](handleEntityNotFound(_0x1f7097,null))[_0x254f('0x1d')](function(_0x550ed3){if(_0x550ed3){_0x2e704c=_0x550ed3;_0x30d5b7[_0x254f('0x2c')]=_[_0x254f('0x2a')](db[_0x254f('0x45')][_0x254f('0x25')]);_0x30d5b7[_0x254f('0x29')]=_['keys'](_0x159501[_0x254f('0x29')]);_0x30d5b7[_0x254f('0x31')]=_[_0x254f('0x2b')](_0x30d5b7[_0x254f('0x2c')],_0x30d5b7[_0x254f('0x29')]);_0x901d76[_0x254f('0x2e')]=_[_0x254f('0x2b')](_0x30d5b7['model'],qs['fields'](_0x159501[_0x254f('0x29')][_0x254f('0x2d')]));_0x901d76[_0x254f('0x2e')]=_0x901d76[_0x254f('0x2e')][_0x254f('0x3e')]?_0x901d76['attributes']:_0x30d5b7[_0x254f('0x2c')];_0x901d76['order']=qs['sort'](_0x159501[_0x254f('0x29')][_0x254f('0x30')]);_0x901d76[_0x254f('0x34')]=qs['filters'](_[_0x254f('0x32')](_0x159501[_0x254f('0x29')],_0x30d5b7[_0x254f('0x31')]));if(_0x159501['query'][_0x254f('0x33')]){_0x901d76[_0x254f('0x34')]=_['merge'](_0x901d76[_0x254f('0x34')],{'$or':_['map'](_0x901d76[_0x254f('0x2e')],function(_0x5675ad){var _0x29beb1={};_0x29beb1[_0x5675ad]={'$like':'%'+_0x159501['query'][_0x254f('0x33')]+'%'};return _0x29beb1;})});}_0x901d76=_[_0x254f('0x35')]({},_0x901d76,_0x159501[_0x254f('0x36')]);return _0x2e704c['getFields'](_0x901d76);}})[_0x254f('0x1d')](function(_0x3facc4){if(_0x3facc4){_0x346ef2=_0x3facc4[_0x254f('0x3e')];if(!_0x159501[_0x254f('0x29')][_0x254f('0x47')](_0x254f('0x2f'))){_0x901d76[_0x254f('0x18')]=qs[_0x254f('0x18')](_0x159501['query'][_0x254f('0x18')]);_0x901d76[_0x254f('0x16')]=qs[_0x254f('0x16')](_0x159501['query'][_0x254f('0x16')]);}return _0x2e704c['getFields'](_0x901d76);}})[_0x254f('0x1d')](function(_0x8a4fd8){if(_0x8a4fd8){return _0x8a4fd8?{'count':_0x346ef2,'rows':_0x8a4fd8}:null;}})['then'](respondWithResult(_0x1f7097,null))[_0x254f('0x3b')](handleError(_0x1f7097,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index be003ce..05864ba 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 _0x6d90=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','int_freshsales_configurations','lodash'];(function(_0x4109b5,_0x4e1012){var _0x2312f4=function(_0x87b850){while(--_0x87b850){_0x4109b5['push'](_0x4109b5['shift']());}};_0x2312f4(++_0x4e1012);}(_0x6d90,0x178));var _0x06d9=function(_0x39051f,_0x38ef3f){_0x39051f=_0x39051f-0x0;var _0x41ae14=_0x6d90[_0x39051f];return _0x41ae14;};'use strict';var _=require(_0x06d9('0x0'));var util=require('util');var logger=require(_0x06d9('0x1'))(_0x06d9('0x2'));var moment=require(_0x06d9('0x3'));var BPromise=require(_0x06d9('0x4'));var rp=require(_0x06d9('0x5'));var fs=require('fs');var path=require(_0x06d9('0x6'));var rimraf=require(_0x06d9('0x7'));var config=require(_0x06d9('0x8'));var attributes=require(_0x06d9('0x9'));module['exports']=function(_0x1fa79c,_0x18e065){return _0x1fa79c[_0x06d9('0xa')](_0x06d9('0xb'),attributes,{'tableName':_0x06d9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c49=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','int_freshsales_configurations','lodash'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x6c49,0xa8));var _0x96c4=function(_0x1c46f5,_0x3a214e){_0x1c46f5=_0x1c46f5-0x0;var _0x2c423e=_0x6c49[_0x1c46f5];return _0x2c423e;};'use strict';var _=require(_0x96c4('0x0'));var util=require(_0x96c4('0x1'));var logger=require(_0x96c4('0x2'))(_0x96c4('0x3'));var moment=require(_0x96c4('0x4'));var BPromise=require(_0x96c4('0x5'));var rp=require(_0x96c4('0x6'));var fs=require('fs');var path=require(_0x96c4('0x7'));var rimraf=require(_0x96c4('0x8'));var config=require('../../config/environment');var attributes=require(_0x96c4('0x9'));module['exports']=function(_0x5bb825,_0x4e898e){return _0x5bb825[_0x96c4('0xa')](_0x96c4('0xb'),attributes,{'tableName':_0x96c4('0xc'),'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 4a147b5..d0c8ae0 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 _0x003b=['debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s'];(function(_0xfeaacb,_0x3b27cb){var _0x1ac128=function(_0x10ddb3){while(--_0x10ddb3){_0xfeaacb['push'](_0xfeaacb['shift']());}};_0x1ac128(++_0x3b27cb);}(_0x003b,0x11c));var _0xb003=function(_0x3353c9,_0x518888){_0x3353c9=_0x3353c9-0x0;var _0x20ea7c=_0x003b[_0x3353c9];return _0x20ea7c;};'use strict';var _=require(_0xb003('0x0'));var util=require(_0xb003('0x1'));var moment=require(_0xb003('0x2'));var BPromise=require(_0xb003('0x3'));var rs=require(_0xb003('0x4'));var fs=require('fs');var Redis=require(_0xb003('0x5'));var db=require(_0xb003('0x6'))['db'];var utils=require(_0xb003('0x7'));var logger=require(_0xb003('0x8'))(_0xb003('0x9'));var config=require(_0xb003('0xa'));var jayson=require(_0xb003('0xb'));var client=jayson['client'][_0xb003('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x167082,_0x4be82e,_0xce1f08){return new BPromise(function(_0xfd036e,_0x394b45){return client[_0xb003('0xd')](_0x167082,_0xce1f08)[_0xb003('0xe')](function(_0x2b2ebb){logger['info'](_0xb003('0xf'),_0x4be82e,'request\x20sent');logger[_0xb003('0x10')](_0xb003('0x11'),_0x4be82e,'request\x20sent',JSON['stringify'](_0x2b2ebb));if(_0x2b2ebb[_0xb003('0x12')]){if(_0x2b2ebb[_0xb003('0x12')][_0xb003('0x13')]===0x1f4){logger[_0xb003('0x12')](_0xb003('0xf'),_0x4be82e,_0x2b2ebb[_0xb003('0x12')]['message']);return _0x394b45(_0x2b2ebb[_0xb003('0x12')][_0xb003('0x14')]);}logger[_0xb003('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4be82e,_0x2b2ebb['error'][_0xb003('0x14')]);return _0xfd036e(_0x2b2ebb[_0xb003('0x12')][_0xb003('0x14')]);}else{logger[_0xb003('0x15')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4be82e,_0xb003('0x16'));_0xfd036e(_0x2b2ebb[_0xb003('0x17')][_0xb003('0x14')]);}})[_0xb003('0x18')](function(_0x48c449){logger[_0xb003('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4be82e,_0x48c449);_0x394b45(_0x48c449);});});} \ No newline at end of file +var _0x9319=['FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info'];(function(_0x39a7ab,_0x1e17b0){var _0xed408b=function(_0x2dbdec){while(--_0x2dbdec){_0x39a7ab['push'](_0x39a7ab['shift']());}};_0xed408b(++_0x1e17b0);}(_0x9319,0x15f));var _0x9931=function(_0x221ed3,_0xc5a679){_0x221ed3=_0x221ed3-0x0;var _0x19f721=_0x9319[_0x221ed3];return _0x19f721;};'use strict';var _=require('lodash');var util=require(_0x9931('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9931('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9931('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x9931('0x3'))(_0x9931('0x4'));var config=require(_0x9931('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x9931('0x6')][_0x9931('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4ae231,_0x4c00aa,_0x37c3aa){return new BPromise(function(_0xfa9889,_0x9f5ac3){return client['request'](_0x4ae231,_0x37c3aa)[_0x9931('0x8')](function(_0x249b1d){logger[_0x9931('0x9')](_0x9931('0xa'),_0x4c00aa,_0x9931('0xb'));logger['debug'](_0x9931('0xc'),_0x4c00aa,_0x9931('0xb'),JSON[_0x9931('0xd')](_0x249b1d));if(_0x249b1d[_0x9931('0xe')]){if(_0x249b1d[_0x9931('0xe')][_0x9931('0xf')]===0x1f4){logger[_0x9931('0xe')](_0x9931('0xa'),_0x4c00aa,_0x249b1d['error'][_0x9931('0x10')]);return _0x9f5ac3(_0x249b1d[_0x9931('0xe')][_0x9931('0x10')]);}logger['error'](_0x9931('0xa'),_0x4c00aa,_0x249b1d['error'][_0x9931('0x10')]);return _0xfa9889(_0x249b1d[_0x9931('0xe')]['message']);}else{logger[_0x9931('0x9')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4c00aa,_0x9931('0xb'));_0xfa9889(_0x249b1d[_0x9931('0x11')][_0x9931('0x10')]);}})[_0x9931('0x12')](function(_0x299a72){logger[_0x9931('0xe')](_0x9931('0xa'),_0x4c00aa,_0x299a72);_0x9f5ac3(_0x299a72);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index f495408..52a0d27 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 _0xcffe=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x3eebc3,_0x5a5470){var _0x211191=function(_0x1553de){while(--_0x1553de){_0x3eebc3['push'](_0x3eebc3['shift']());}};_0x211191(++_0x5a5470);}(_0xcffe,0x1a1));var _0xecff=function(_0x29c934,_0x3c30e2){_0x29c934=_0x29c934-0x0;var _0x4302de=_0xcffe[_0x29c934];return _0x4302de;};'use strict';var multer=require(_0xecff('0x0'));var util=require(_0xecff('0x1'));var path=require(_0xecff('0x2'));var timeout=require(_0xecff('0x3'));var express=require(_0xecff('0x4'));var router=express[_0xecff('0x5')]();var fs_extra=require(_0xecff('0x6'));var auth=require(_0xecff('0x7'));var interaction=require(_0xecff('0x8'));var config=require(_0xecff('0x9'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0xecff('0xa')](),controller[_0xecff('0xb')]);router[_0xecff('0xc')](_0xecff('0xd'),auth[_0xecff('0xa')](),controller[_0xecff('0xe')]);router[_0xecff('0xf')]('/',auth['isAuthenticated'](),controller[_0xecff('0x10')]);router[_0xecff('0x11')](_0xecff('0xd'),auth[_0xecff('0xa')](),controller[_0xecff('0x12')]);router['delete'](_0xecff('0xd'),auth[_0xecff('0xa')](),controller[_0xecff('0x13')]);module[_0xecff('0x14')]=router; \ No newline at end of file +var _0x89c4=['../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','/:id','show','create','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x38d9fc,_0x768e44){var _0x392fd9=function(_0x5201af){while(--_0x5201af){_0x38d9fc['push'](_0x38d9fc['shift']());}};_0x392fd9(++_0x768e44);}(_0x89c4,0x82));var _0x489c=function(_0x5b7af2,_0x1d9c47){_0x5b7af2=_0x5b7af2-0x0;var _0x167182=_0x89c4[_0x5b7af2];return _0x167182;};'use strict';var multer=require(_0x489c('0x0'));var util=require(_0x489c('0x1'));var path=require('path');var timeout=require(_0x489c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x489c('0x3'));var auth=require(_0x489c('0x4'));var interaction=require(_0x489c('0x5'));var config=require(_0x489c('0x6'));var controller=require(_0x489c('0x7'));router[_0x489c('0x8')]('/',auth[_0x489c('0x9')](),controller['index']);router[_0x489c('0x8')](_0x489c('0xa'),auth[_0x489c('0x9')](),controller[_0x489c('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x489c('0xc')]);router['put'](_0x489c('0xa'),auth[_0x489c('0x9')](),controller[_0x489c('0xd')]);router[_0x489c('0xe')](_0x489c('0xa'),auth[_0x489c('0x9')](),controller[_0x489c('0xf')]);module[_0x489c('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index c365dbc..7d96443 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 _0x1a36=['customVariable','keyValue','picklist','string','STRING','sequelize','exports','ENUM'];(function(_0x3dc927,_0x2b2192){var _0x11e332=function(_0x3eff0f){while(--_0x3eff0f){_0x3dc927['push'](_0x3dc927['shift']());}};_0x11e332(++_0x2b2192);}(_0x1a36,0x10d));var _0x61a3=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x1a36[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require(_0x61a3('0x0'));module[_0x61a3('0x1')]={'type':{'type':Sequelize[_0x61a3('0x2')]('string','variable',_0x61a3('0x3'),_0x61a3('0x4'),_0x61a3('0x5')),'defaultValue':_0x61a3('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x61a3('0x7')]},'keyType':{'type':Sequelize[_0x61a3('0x2')](_0x61a3('0x6'),'variable',_0x61a3('0x3'))},'keyContent':{'type':Sequelize[_0x61a3('0x7')]},'idField':{'type':Sequelize[_0x61a3('0x7')]},'nameField':{'type':Sequelize[_0x61a3('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x61a3('0x7')]}}; \ No newline at end of file +var _0xbbab=['keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbbab,0x176));var _0xbbba=function(_0x4a3963,_0x55aac1){_0x4a3963=_0x4a3963-0x0;var _0x25ba7b=_0xbbab[_0x4a3963];return _0x25ba7b;};'use strict';var Sequelize=require(_0xbbba('0x0'));module[_0xbbba('0x1')]={'type':{'type':Sequelize['ENUM'](_0xbbba('0x2'),_0xbbba('0x3'),'customVariable',_0xbbba('0x4'),_0xbbba('0x5')),'defaultValue':_0xbbba('0x2')},'content':{'type':Sequelize[_0xbbba('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xbbba('0x7')]('string',_0xbbba('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xbbba('0x6')]},'nameField':{'type':Sequelize[_0xbbba('0x6')]},'customField':{'type':Sequelize[_0xbbba('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbbba('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 2481fab..8d64f91 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 _0x49ab=['reject','update','then','destroy','stack','name','send','index','map','FreshsalesField','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','include','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply'];(function(_0x28d0f7,_0x579973){var _0x45d26b=function(_0x37dea1){while(--_0x37dea1){_0x28d0f7['push'](_0x28d0f7['shift']());}};_0x45d26b(++_0x579973);}(_0x49ab,0x1dd));var _0xb49a=function(_0x24f4ce,_0x7d4b84){_0x24f4ce=_0x24f4ce-0x0;var _0x53b38c=_0x49ab[_0x24f4ce];return _0x53b38c;};'use strict';var emlformat=require(_0xb49a('0x0'));var rimraf=require(_0xb49a('0x1'));var zipdir=require(_0xb49a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb49a('0x3'));var moment=require(_0xb49a('0x4'));var BPromise=require(_0xb49a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb49a('0x6'));var sox=require(_0xb49a('0x7'));var csv=require('to-csv');var ejs=require(_0xb49a('0x8'));var fs=require('fs');var fs_extra=require(_0xb49a('0x9'));var _=require(_0xb49a('0xa'));var squel=require(_0xb49a('0xb'));var crypto=require(_0xb49a('0xc'));var jsforce=require(_0xb49a('0xd'));var deskjs=require(_0xb49a('0xe'));var toCsv=require(_0xb49a('0xf'));var querystring=require(_0xb49a('0x10'));var Papa=require(_0xb49a('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb49a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb49a('0x13'))(_0xb49a('0x14'));var utils=require(_0xb49a('0x15'));var config=require(_0xb49a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb49a('0x17'))['db'];function respondWithStatusCode(_0x28c041,_0x29ca53){_0x29ca53=_0x29ca53||0xcc;return function(_0x261350){if(_0x261350){return _0x28c041[_0xb49a('0x18')](_0x29ca53);}return _0x28c041[_0xb49a('0x19')](_0x29ca53)[_0xb49a('0x1a')]();};}function respondWithResult(_0x51cc1b,_0x59b12e){_0x59b12e=_0x59b12e||0xc8;return function(_0x11c83f){if(_0x11c83f){return _0x51cc1b[_0xb49a('0x19')](_0x59b12e)[_0xb49a('0x1b')](_0x11c83f);}};}function respondWithFilteredResult(_0x351a9e,_0x26d2f9){return function(_0x412031){if(_0x412031){var _0x24294e=typeof _0x26d2f9[_0xb49a('0x1c')]===_0xb49a('0x1d')&&typeof _0x26d2f9[_0xb49a('0x1e')]===_0xb49a('0x1d');var _0x480a6a=_0x412031['count'];var _0x17bff7=_0x24294e?0x0:_0x26d2f9[_0xb49a('0x1c')];var _0x417d10=_0x24294e?_0x412031[_0xb49a('0x1f')]:_0x26d2f9[_0xb49a('0x1c')]+_0x26d2f9[_0xb49a('0x1e')];var _0x44c0a8;if(_0x417d10>=_0x480a6a){_0x417d10=_0x480a6a;_0x44c0a8=0xc8;}else{_0x44c0a8=0xce;}_0x351a9e[_0xb49a('0x19')](_0x44c0a8);return _0x351a9e['set'](_0xb49a('0x20'),_0x17bff7+'-'+_0x417d10+'/'+_0x480a6a)[_0xb49a('0x1b')](_0x412031);}return null;};}function patchUpdates(_0x448117){return function(_0xaae413){try{jsonpatch[_0xb49a('0x21')](_0xaae413,_0x448117,!![]);}catch(_0x17c53d){return BPromise[_0xb49a('0x22')](_0x17c53d);}return _0xaae413['save']();};}function saveUpdates(_0x2508a7,_0x5d776b){return function(_0x3cd130){if(_0x3cd130){return _0x3cd130[_0xb49a('0x23')](_0x2508a7)[_0xb49a('0x24')](function(_0x5af836){return _0x5af836;});}return null;};}function removeEntity(_0x28ae1d,_0x3b7034){return function(_0x39234d){if(_0x39234d){return _0x39234d[_0xb49a('0x25')]()[_0xb49a('0x24')](function(){_0x28ae1d['status'](0xcc)[_0xb49a('0x1a')]();});}};}function handleEntityNotFound(_0x3eeac1,_0x2edb1e){return function(_0x368560){if(!_0x368560){_0x3eeac1[_0xb49a('0x18')](0x194);}return _0x368560;};}function handleError(_0x24ad7,_0x2cceb5){_0x2cceb5=_0x2cceb5||0x1f4;return function(_0x34a10e){logger['error'](_0x34a10e[_0xb49a('0x26')]);if(_0x34a10e[_0xb49a('0x27')]){delete _0x34a10e[_0xb49a('0x27')];}_0x24ad7['status'](_0x2cceb5)[_0xb49a('0x28')](_0x34a10e);};}exports[_0xb49a('0x29')]=function(_0x4778af,_0x292d29){var _0x586e9a={},_0x347923={},_0x566918={'count':0x0,'rows':[]};var _0x40d655=_[_0xb49a('0x2a')](db[_0xb49a('0x2b')]['rawAttributes'],function(_0x55427f){return{'name':_0x55427f[_0xb49a('0x2c')],'type':_0x55427f[_0xb49a('0x2d')][_0xb49a('0x2e')]};});_0x347923[_0xb49a('0x2f')]=_['map'](_0x40d655,_0xb49a('0x27'));_0x347923[_0xb49a('0x30')]=_[_0xb49a('0x31')](_0x4778af['query']);_0x347923[_0xb49a('0x32')]=_[_0xb49a('0x33')](_0x347923[_0xb49a('0x2f')],_0x347923[_0xb49a('0x30')]);_0x586e9a[_0xb49a('0x34')]=_['intersection'](_0x347923[_0xb49a('0x2f')],qs[_0xb49a('0x35')](_0x4778af['query']['fields']));_0x586e9a[_0xb49a('0x34')]=_0x586e9a['attributes'][_0xb49a('0x36')]?_0x586e9a['attributes']:_0x347923['model'];if(!_0x4778af['query'][_0xb49a('0x37')]('nolimit')){_0x586e9a[_0xb49a('0x1e')]=qs['limit'](_0x4778af['query'][_0xb49a('0x1e')]);_0x586e9a[_0xb49a('0x1c')]=qs['offset'](_0x4778af['query'][_0xb49a('0x1c')]);}_0x586e9a[_0xb49a('0x38')]=qs[_0xb49a('0x39')](_0x4778af[_0xb49a('0x30')][_0xb49a('0x39')]);_0x586e9a['where']=qs[_0xb49a('0x32')](_[_0xb49a('0x3a')](_0x4778af[_0xb49a('0x30')],_0x347923[_0xb49a('0x32')]),_0x40d655);if(_0x4778af[_0xb49a('0x30')]['filter']){_0x586e9a[_0xb49a('0x3b')]=_[_0xb49a('0x3c')](_0x586e9a[_0xb49a('0x3b')],{'$or':_['map'](_0x40d655,function(_0x59fbff){if(_0x59fbff[_0xb49a('0x2d')]!==_0xb49a('0x3d')){var _0x29843c={};_0x29843c[_0x59fbff['name']]={'$like':'%'+_0x4778af[_0xb49a('0x30')][_0xb49a('0x3e')]+'%'};return _0x29843c;}})});}_0x586e9a=_[_0xb49a('0x3c')]({},_0x586e9a,_0x4778af[_0xb49a('0x3f')]);var _0x121d2={'where':_0x586e9a[_0xb49a('0x3b')]};return db[_0xb49a('0x2b')][_0xb49a('0x1f')](_0x121d2)[_0xb49a('0x24')](function(_0x1ec3f4){_0x566918[_0xb49a('0x1f')]=_0x1ec3f4;if(_0x4778af[_0xb49a('0x30')][_0xb49a('0x40')]){_0x586e9a['include']=[{'all':!![]}];}return db['FreshsalesField']['findAll'](_0x586e9a);})['then'](function(_0xe135e9){_0x566918[_0xb49a('0x41')]=_0xe135e9;return _0x566918;})[_0xb49a('0x24')](respondWithFilteredResult(_0x292d29,_0x586e9a))[_0xb49a('0x42')](handleError(_0x292d29,null));};exports[_0xb49a('0x43')]=function(_0x105ec6,_0x5a282a){var _0x5ad6c5={'raw':!![],'where':{'id':_0x105ec6['params']['id']}},_0x2efb1c={};_0x2efb1c[_0xb49a('0x2f')]=_[_0xb49a('0x31')](db[_0xb49a('0x2b')]['rawAttributes']);_0x2efb1c[_0xb49a('0x30')]=_[_0xb49a('0x31')](_0x105ec6['query']);_0x2efb1c[_0xb49a('0x32')]=_[_0xb49a('0x33')](_0x2efb1c[_0xb49a('0x2f')],_0x2efb1c[_0xb49a('0x30')]);_0x5ad6c5[_0xb49a('0x34')]=_[_0xb49a('0x33')](_0x2efb1c[_0xb49a('0x2f')],qs[_0xb49a('0x35')](_0x105ec6[_0xb49a('0x30')]['fields']));_0x5ad6c5[_0xb49a('0x34')]=_0x5ad6c5[_0xb49a('0x34')]['length']?_0x5ad6c5[_0xb49a('0x34')]:_0x2efb1c[_0xb49a('0x2f')];if(_0x105ec6['query'][_0xb49a('0x40')]){_0x5ad6c5[_0xb49a('0x44')]=[{'all':!![]}];}_0x5ad6c5=_[_0xb49a('0x3c')]({},_0x5ad6c5,_0x105ec6['options']);return db[_0xb49a('0x2b')][_0xb49a('0x45')](_0x5ad6c5)[_0xb49a('0x24')](handleEntityNotFound(_0x5a282a,null))['then'](respondWithResult(_0x5a282a,null))[_0xb49a('0x42')](handleError(_0x5a282a,null));};exports[_0xb49a('0x46')]=function(_0x103816,_0x41d76d){return db[_0xb49a('0x2b')][_0xb49a('0x46')](_0x103816[_0xb49a('0x47')],{})['then'](respondWithResult(_0x41d76d,0xc9))['catch'](handleError(_0x41d76d,null));};exports['update']=function(_0x2af565,_0x1a2006){if(_0x2af565[_0xb49a('0x47')]['id']){delete _0x2af565[_0xb49a('0x47')]['id'];}return db[_0xb49a('0x2b')][_0xb49a('0x45')]({'where':{'id':_0x2af565[_0xb49a('0x48')]['id']}})[_0xb49a('0x24')](handleEntityNotFound(_0x1a2006,null))[_0xb49a('0x24')](saveUpdates(_0x2af565['body'],null))[_0xb49a('0x24')](respondWithResult(_0x1a2006,null))[_0xb49a('0x42')](handleError(_0x1a2006,null));};exports['destroy']=function(_0x3977a6,_0x484ed0){return db[_0xb49a('0x2b')][_0xb49a('0x45')]({'where':{'id':_0x3977a6[_0xb49a('0x48')]['id']}})[_0xb49a('0x24')](handleEntityNotFound(_0x484ed0,null))[_0xb49a('0x24')](removeEntity(_0x484ed0,null))[_0xb49a('0x42')](handleError(_0x484ed0,null));}; \ No newline at end of file +var _0xa2e2=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','FreshsalesField','rawAttributes','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x4e28ba,_0xfe0c61){var _0x355c33=function(_0x31c17c){while(--_0x31c17c){_0x4e28ba['push'](_0x4e28ba['shift']());}};_0x355c33(++_0xfe0c61);}(_0xa2e2,0x82));var _0x2a2e=function(_0x262736,_0x1c6067){_0x262736=_0x262736-0x0;var _0x5e018a=_0xa2e2[_0x262736];return _0x5e018a;};'use strict';var emlformat=require(_0x2a2e('0x0'));var rimraf=require(_0x2a2e('0x1'));var zipdir=require(_0x2a2e('0x2'));var jsonpatch=require(_0x2a2e('0x3'));var rp=require(_0x2a2e('0x4'));var moment=require(_0x2a2e('0x5'));var BPromise=require(_0x2a2e('0x6'));var Mustache=require(_0x2a2e('0x7'));var util=require(_0x2a2e('0x8'));var path=require(_0x2a2e('0x9'));var sox=require(_0x2a2e('0xa'));var csv=require(_0x2a2e('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2a2e('0xc'));var crypto=require(_0x2a2e('0xd'));var jsforce=require(_0x2a2e('0xe'));var deskjs=require(_0x2a2e('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2a2e('0x10'));var Redis=require('ioredis');var authService=require(_0x2a2e('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2a2e('0x12'))(_0x2a2e('0x13'));var utils=require(_0x2a2e('0x14'));var config=require(_0x2a2e('0x15'));var licenseUtil=require(_0x2a2e('0x16'));var db=require(_0x2a2e('0x17'))['db'];function respondWithStatusCode(_0x50d798,_0x4495a0){_0x4495a0=_0x4495a0||0xcc;return function(_0x5d4028){if(_0x5d4028){return _0x50d798[_0x2a2e('0x18')](_0x4495a0);}return _0x50d798[_0x2a2e('0x19')](_0x4495a0)[_0x2a2e('0x1a')]();};}function respondWithResult(_0x29322d,_0x22e81f){_0x22e81f=_0x22e81f||0xc8;return function(_0x277505){if(_0x277505){return _0x29322d[_0x2a2e('0x19')](_0x22e81f)[_0x2a2e('0x1b')](_0x277505);}};}function respondWithFilteredResult(_0x8bd520,_0x521e2b){return function(_0x41e7c7){if(_0x41e7c7){var _0x18fd69=typeof _0x521e2b[_0x2a2e('0x1c')]===_0x2a2e('0x1d')&&typeof _0x521e2b['limit']==='undefined';var _0x4a15fd=_0x41e7c7[_0x2a2e('0x1e')];var _0x3889e3=_0x18fd69?0x0:_0x521e2b[_0x2a2e('0x1c')];var _0x3db776=_0x18fd69?_0x41e7c7[_0x2a2e('0x1e')]:_0x521e2b[_0x2a2e('0x1c')]+_0x521e2b[_0x2a2e('0x1f')];var _0x2bd105;if(_0x3db776>=_0x4a15fd){_0x3db776=_0x4a15fd;_0x2bd105=0xc8;}else{_0x2bd105=0xce;}_0x8bd520[_0x2a2e('0x19')](_0x2bd105);return _0x8bd520[_0x2a2e('0x20')](_0x2a2e('0x21'),_0x3889e3+'-'+_0x3db776+'/'+_0x4a15fd)[_0x2a2e('0x1b')](_0x41e7c7);}return null;};}function patchUpdates(_0x1db95a){return function(_0x5c8c7d){try{jsonpatch[_0x2a2e('0x22')](_0x5c8c7d,_0x1db95a,!![]);}catch(_0x324681){return BPromise[_0x2a2e('0x23')](_0x324681);}return _0x5c8c7d[_0x2a2e('0x24')]();};}function saveUpdates(_0x281807,_0x164212){return function(_0x331ffd){if(_0x331ffd){return _0x331ffd['update'](_0x281807)['then'](function(_0x187ccb){return _0x187ccb;});}return null;};}function removeEntity(_0x1c9915,_0x2e9802){return function(_0x275097){if(_0x275097){return _0x275097[_0x2a2e('0x25')]()[_0x2a2e('0x26')](function(){_0x1c9915['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x26afd4,_0x5d48d8){return function(_0xbd00da){if(!_0xbd00da){_0x26afd4['sendStatus'](0x194);}return _0xbd00da;};}function handleError(_0x55e784,_0x50a9cc){_0x50a9cc=_0x50a9cc||0x1f4;return function(_0x3349ad){logger[_0x2a2e('0x27')](_0x3349ad[_0x2a2e('0x28')]);if(_0x3349ad[_0x2a2e('0x29')]){delete _0x3349ad[_0x2a2e('0x29')];}_0x55e784[_0x2a2e('0x19')](_0x50a9cc)[_0x2a2e('0x2a')](_0x3349ad);};}exports[_0x2a2e('0x2b')]=function(_0x33142c,_0x272625){var _0x1b9d0b={},_0x803dd5={},_0xc9e7a8={'count':0x0,'rows':[]};var _0x1cc7d7=_['map'](db[_0x2a2e('0x2c')][_0x2a2e('0x2d')],function(_0x4624e7){return{'name':_0x4624e7['fieldName'],'type':_0x4624e7[_0x2a2e('0x2e')][_0x2a2e('0x2f')]};});_0x803dd5[_0x2a2e('0x30')]=_[_0x2a2e('0x31')](_0x1cc7d7,_0x2a2e('0x29'));_0x803dd5[_0x2a2e('0x32')]=_['keys'](_0x33142c[_0x2a2e('0x32')]);_0x803dd5[_0x2a2e('0x33')]=_['intersection'](_0x803dd5[_0x2a2e('0x30')],_0x803dd5[_0x2a2e('0x32')]);_0x1b9d0b['attributes']=_[_0x2a2e('0x34')](_0x803dd5[_0x2a2e('0x30')],qs[_0x2a2e('0x35')](_0x33142c[_0x2a2e('0x32')][_0x2a2e('0x35')]));_0x1b9d0b['attributes']=_0x1b9d0b[_0x2a2e('0x36')][_0x2a2e('0x37')]?_0x1b9d0b[_0x2a2e('0x36')]:_0x803dd5[_0x2a2e('0x30')];if(!_0x33142c['query'][_0x2a2e('0x38')](_0x2a2e('0x39'))){_0x1b9d0b[_0x2a2e('0x1f')]=qs[_0x2a2e('0x1f')](_0x33142c[_0x2a2e('0x32')][_0x2a2e('0x1f')]);_0x1b9d0b[_0x2a2e('0x1c')]=qs[_0x2a2e('0x1c')](_0x33142c[_0x2a2e('0x32')][_0x2a2e('0x1c')]);}_0x1b9d0b['order']=qs[_0x2a2e('0x3a')](_0x33142c[_0x2a2e('0x32')][_0x2a2e('0x3a')]);_0x1b9d0b[_0x2a2e('0x3b')]=qs['filters'](_[_0x2a2e('0x3c')](_0x33142c[_0x2a2e('0x32')],_0x803dd5[_0x2a2e('0x33')]),_0x1cc7d7);if(_0x33142c[_0x2a2e('0x32')]['filter']){_0x1b9d0b[_0x2a2e('0x3b')]=_[_0x2a2e('0x3d')](_0x1b9d0b[_0x2a2e('0x3b')],{'$or':_[_0x2a2e('0x31')](_0x1cc7d7,function(_0x432349){if(_0x432349[_0x2a2e('0x2e')]!=='VIRTUAL'){var _0x3efd6d={};_0x3efd6d[_0x432349[_0x2a2e('0x29')]]={'$like':'%'+_0x33142c[_0x2a2e('0x32')][_0x2a2e('0x3e')]+'%'};return _0x3efd6d;}})});}_0x1b9d0b=_[_0x2a2e('0x3d')]({},_0x1b9d0b,_0x33142c[_0x2a2e('0x3f')]);var _0x21a75d={'where':_0x1b9d0b[_0x2a2e('0x3b')]};return db['FreshsalesField'][_0x2a2e('0x1e')](_0x21a75d)['then'](function(_0x4a4fb5){_0xc9e7a8['count']=_0x4a4fb5;if(_0x33142c['query'][_0x2a2e('0x40')]){_0x1b9d0b['include']=[{'all':!![]}];}return db['FreshsalesField'][_0x2a2e('0x41')](_0x1b9d0b);})['then'](function(_0x57d065){_0xc9e7a8[_0x2a2e('0x42')]=_0x57d065;return _0xc9e7a8;})[_0x2a2e('0x26')](respondWithFilteredResult(_0x272625,_0x1b9d0b))[_0x2a2e('0x43')](handleError(_0x272625,null));};exports[_0x2a2e('0x44')]=function(_0x14b253,_0x10930d){var _0x6cd297={'raw':!![],'where':{'id':_0x14b253[_0x2a2e('0x45')]['id']}},_0x383f6a={};_0x383f6a[_0x2a2e('0x30')]=_['keys'](db['FreshsalesField'][_0x2a2e('0x2d')]);_0x383f6a[_0x2a2e('0x32')]=_[_0x2a2e('0x46')](_0x14b253[_0x2a2e('0x32')]);_0x383f6a['filters']=_['intersection'](_0x383f6a[_0x2a2e('0x30')],_0x383f6a['query']);_0x6cd297['attributes']=_['intersection'](_0x383f6a['model'],qs[_0x2a2e('0x35')](_0x14b253['query'][_0x2a2e('0x35')]));_0x6cd297[_0x2a2e('0x36')]=_0x6cd297[_0x2a2e('0x36')][_0x2a2e('0x37')]?_0x6cd297[_0x2a2e('0x36')]:_0x383f6a[_0x2a2e('0x30')];if(_0x14b253[_0x2a2e('0x32')][_0x2a2e('0x40')]){_0x6cd297[_0x2a2e('0x47')]=[{'all':!![]}];}_0x6cd297=_[_0x2a2e('0x3d')]({},_0x6cd297,_0x14b253['options']);return db[_0x2a2e('0x2c')][_0x2a2e('0x48')](_0x6cd297)[_0x2a2e('0x26')](handleEntityNotFound(_0x10930d,null))[_0x2a2e('0x26')](respondWithResult(_0x10930d,null))['catch'](handleError(_0x10930d,null));};exports[_0x2a2e('0x49')]=function(_0x4d5da,_0x5bb598){return db['FreshsalesField'][_0x2a2e('0x49')](_0x4d5da[_0x2a2e('0x4a')],{})[_0x2a2e('0x26')](respondWithResult(_0x5bb598,0xc9))[_0x2a2e('0x43')](handleError(_0x5bb598,null));};exports[_0x2a2e('0x4b')]=function(_0x1cfea5,_0x4131f0){if(_0x1cfea5['body']['id']){delete _0x1cfea5['body']['id'];}return db['FreshsalesField'][_0x2a2e('0x48')]({'where':{'id':_0x1cfea5[_0x2a2e('0x45')]['id']}})[_0x2a2e('0x26')](handleEntityNotFound(_0x4131f0,null))[_0x2a2e('0x26')](saveUpdates(_0x1cfea5['body'],null))[_0x2a2e('0x26')](respondWithResult(_0x4131f0,null))[_0x2a2e('0x43')](handleError(_0x4131f0,null));};exports[_0x2a2e('0x25')]=function(_0x5516be,_0xedc5eb){return db[_0x2a2e('0x2c')]['find']({'where':{'id':_0x5516be[_0x2a2e('0x45')]['id']}})[_0x2a2e('0x26')](handleEntityNotFound(_0xedc5eb,null))['then'](removeEntity(_0xedc5eb,null))[_0x2a2e('0x43')](handleError(_0xedc5eb,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index cd48e8e..af9a16c 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 _0xaebd=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','idField','FieldId','lodash'];(function(_0x58ad73,_0x495f5d){var _0x2ec776=function(_0x199d09){while(--_0x199d09){_0x58ad73['push'](_0x58ad73['shift']());}};_0x2ec776(++_0x495f5d);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x3c8df1,_0x5ccbdf){_0x3c8df1=_0x3c8df1-0x0;var _0xb37cce=_0xaebd[_0x3c8df1];return _0xb37cce;};'use strict';var _=require(_0xdaeb('0x0'));var util=require('util');var logger=require(_0xdaeb('0x1'))(_0xdaeb('0x2'));var moment=require(_0xdaeb('0x3'));var BPromise=require(_0xdaeb('0x4'));var rp=require(_0xdaeb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdaeb('0x6'));var config=require(_0xdaeb('0x7'));var attributes=require(_0xdaeb('0x8'));module[_0xdaeb('0x9')]=function(_0xee94f9,_0x4b7255){return _0xee94f9[_0xdaeb('0xa')](_0xdaeb('0xb'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xdaeb('0xc'),_0xdaeb('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x04d5=['FieldId','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','idField'];(function(_0x183263,_0x2e84ad){var _0x10d578=function(_0x37c0ee){while(--_0x37c0ee){_0x183263['push'](_0x183263['shift']());}};_0x10d578(++_0x2e84ad);}(_0x04d5,0xe1));var _0x504d=function(_0x5afdc4,_0x574bee){_0x5afdc4=_0x5afdc4-0x0;var _0x48f660=_0x04d5[_0x5afdc4];return _0x48f660;};'use strict';var _=require(_0x504d('0x0'));var util=require(_0x504d('0x1'));var logger=require('../../config/logger')(_0x504d('0x2'));var moment=require(_0x504d('0x3'));var BPromise=require(_0x504d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x504d('0x5'));var rimraf=require(_0x504d('0x6'));var config=require(_0x504d('0x7'));var attributes=require(_0x504d('0x8'));module[_0x504d('0x9')]=function(_0x535671,_0x289d44){return _0x535671[_0x504d('0xa')](_0x504d('0xb'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x504d('0xc'),_0x504d('0xd')],'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 5a96c3f..d1c7341 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 _0x5d17=['request','info','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3efd24,_0x307e53){var _0x5df6f2=function(_0x52503d){while(--_0x52503d){_0x3efd24['push'](_0x3efd24['shift']());}};_0x5df6f2(++_0x307e53);}(_0x5d17,0x114));var _0x75d1=function(_0x2c84e5,_0x58a7c7){_0x2c84e5=_0x2c84e5-0x0;var _0x4990ec=_0x5d17[_0x2c84e5];return _0x4990ec;};'use strict';var _=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x75d1('0x2'));var fs=require('fs');var Redis=require(_0x75d1('0x3'));var db=require(_0x75d1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x75d1('0x5'))(_0x75d1('0x6'));var config=require(_0x75d1('0x7'));var jayson=require(_0x75d1('0x8'));var client=jayson['client'][_0x75d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x116a51,_0x5c957a,_0x1ee61b){return new BPromise(function(_0x3a9d5e,_0x105607){return client[_0x75d1('0xa')](_0x116a51,_0x1ee61b)['then'](function(_0x4cf632){logger[_0x75d1('0xb')]('FreshsalesField,\x20%s,\x20%s',_0x5c957a,'request\x20sent');logger[_0x75d1('0xc')](_0x75d1('0xd'),_0x5c957a,'request\x20sent',JSON[_0x75d1('0xe')](_0x4cf632));if(_0x4cf632[_0x75d1('0xf')]){if(_0x4cf632[_0x75d1('0xf')][_0x75d1('0x10')]===0x1f4){logger[_0x75d1('0xf')](_0x75d1('0x11'),_0x5c957a,_0x4cf632['error'][_0x75d1('0x12')]);return _0x105607(_0x4cf632[_0x75d1('0xf')][_0x75d1('0x12')]);}logger[_0x75d1('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x5c957a,_0x4cf632['error']['message']);return _0x3a9d5e(_0x4cf632[_0x75d1('0xf')][_0x75d1('0x12')]);}else{logger[_0x75d1('0xb')]('FreshsalesField,\x20%s,\x20%s',_0x5c957a,_0x75d1('0x13'));_0x3a9d5e(_0x4cf632[_0x75d1('0x14')][_0x75d1('0x12')]);}})[_0x75d1('0x15')](function(_0x1160ca){logger[_0x75d1('0xf')](_0x75d1('0x11'),_0x5c957a,_0x1160ca);_0x105607(_0x1160ca);});});} \ No newline at end of file +var _0x5496=['../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x1e1ffc,_0x435b71){var _0x1bb06c=function(_0x121bc8){while(--_0x121bc8){_0x1e1ffc['push'](_0x1e1ffc['shift']());}};_0x1bb06c(++_0x435b71);}(_0x5496,0x175));var _0x6549=function(_0x337596,_0x510e20){_0x337596=_0x337596-0x0;var _0x8901d4=_0x5496[_0x337596];return _0x8901d4;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var moment=require(_0x6549('0x2'));var BPromise=require(_0x6549('0x3'));var rs=require(_0x6549('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6549('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6549('0x6'))(_0x6549('0x7'));var config=require(_0x6549('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6549('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d8cea,_0x4fcffd,_0x1ca8fc){return new BPromise(function(_0x3442c3,_0x1ef2a6){return client['request'](_0x1d8cea,_0x1ca8fc)[_0x6549('0xa')](function(_0x35d008){logger[_0x6549('0xb')](_0x6549('0xc'),_0x4fcffd,_0x6549('0xd'));logger[_0x6549('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x4fcffd,'request\x20sent',JSON[_0x6549('0xf')](_0x35d008));if(_0x35d008[_0x6549('0x10')]){if(_0x35d008[_0x6549('0x10')][_0x6549('0x11')]===0x1f4){logger[_0x6549('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x4fcffd,_0x35d008['error'][_0x6549('0x12')]);return _0x1ef2a6(_0x35d008[_0x6549('0x10')]['message']);}logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);return _0x3442c3(_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x4fcffd,_0x6549('0xd'));_0x3442c3(_0x35d008[_0x6549('0x13')]['message']);}})[_0x6549('0x14')](function(_0x67acc0){logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x67acc0);_0x1ef2a6(_0x67acc0);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 0df096a..1e36568 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(_0x5e85e1,_0x4dedd6){var _0x272ce0=function(_0x2b3ae0){while(--_0x2b3ae0){_0x5e85e1['push'](_0x5e85e1['shift']());}};_0x272ce0(++_0x4dedd6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x2bb0e0,_0x16f47b){var _0x46143d=function(_0x6175d2){while(--_0x6175d2){_0x2bb0e0['push'](_0x2bb0e0['shift']());}};_0x46143d(++_0x16f47b);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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 07b120f..e009ccd 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 _0x3134=['STRING','username','integrationTab','sequelize'];(function(_0x26bae6,_0x538703){var _0x22256e=function(_0x59a6ae){while(--_0x59a6ae){_0x26bae6['push'](_0x26bae6['shift']());}};_0x22256e(++_0x538703);}(_0x3134,0xdf));var _0x4313=function(_0x4112ed,_0x49564d){_0x4112ed=_0x4112ed-0x0;var _0x1ce7c2=_0x3134[_0x4112ed];return _0x1ce7c2;};'use strict';var Sequelize=require(_0x4313('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4313('0x1')]},'username':{'type':Sequelize[_0x4313('0x1')],'unique':_0x4313('0x2')},'remoteUri':{'type':Sequelize[_0x4313('0x1')]},'password':{'type':Sequelize[_0x4313('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x4313('0x1')]},'serverUrl':{'type':Sequelize[_0x4313('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x4313('0x3'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xd0ee=['STRING','ENUM','exports'];(function(_0x4c6e32,_0x5d0b20){var _0x5b9e47=function(_0x2f0bf6){while(--_0x2f0bf6){_0x4c6e32['push'](_0x4c6e32['shift']());}};_0x5b9e47(++_0x5d0b20);}(_0xd0ee,0x19a));var _0xed0e=function(_0x310669,_0xc4062c){_0x310669=_0x310669-0x0;var _0x240697=_0xd0ee[_0x310669];return _0x240697;};'use strict';var Sequelize=require('sequelize');module[_0xed0e('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xed0e('0x1')]},'username':{'type':Sequelize[_0xed0e('0x1')],'unique':'username'},'remoteUri':{'type':Sequelize[_0xed0e('0x1')]},'password':{'type':Sequelize[_0xed0e('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xed0e('0x1')]},'securityToken':{'type':Sequelize[_0xed0e('0x1')]},'serverUrl':{'type':Sequelize[_0xed0e('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xed0e('0x2')]('integrationTab','newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 2228f3f..13a9510 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 _0x1305=['sobject','describe','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','boolean','email','textarea','phone','remove','includes','custom','picklistValues','value','True','true','False','false','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','json','offset','undefined','limit','count','status','Content-Range','reject','save','update','then','destroy','end','name','send','index','map','SalesforceAccount','rawAttributes','type','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','rows','catch','show','include','find','create','body','params','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceField','getFields','Task','remoteUri','clientSecret','username','securityToken','slice','Connection','clientId','login','password','isNil','ticketType'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1305,0x18e));var _0x5130=function(_0x2161a8,_0x374c19){_0x2161a8=_0x2161a8-0x0;var _0x3025b3=_0x1305[_0x2161a8];return _0x3025b3;};'use strict';var emlformat=require(_0x5130('0x0'));var rimraf=require(_0x5130('0x1'));var zipdir=require(_0x5130('0x2'));var jsonpatch=require(_0x5130('0x3'));var rp=require(_0x5130('0x4'));var moment=require(_0x5130('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5130('0x6'));var util=require(_0x5130('0x7'));var path=require(_0x5130('0x8'));var sox=require(_0x5130('0x9'));var csv=require(_0x5130('0xa'));var ejs=require(_0x5130('0xb'));var fs=require('fs');var fs_extra=require(_0x5130('0xc'));var _=require(_0x5130('0xd'));var squel=require(_0x5130('0xe'));var crypto=require(_0x5130('0xf'));var jsforce=require(_0x5130('0x10'));var deskjs=require(_0x5130('0x11'));var toCsv=require(_0x5130('0xa'));var querystring=require('querystring');var Papa=require(_0x5130('0x12'));var Redis=require(_0x5130('0x13'));var authService=require(_0x5130('0x14'));var qs=require(_0x5130('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5130('0x16'));var logger=require(_0x5130('0x17'))(_0x5130('0x18'));var utils=require(_0x5130('0x19'));var config=require(_0x5130('0x1a'));var licenseUtil=require(_0x5130('0x1b'));var db=require('../../mysqldb')['db'];var integrations=require(_0x5130('0x1c'));function respondWithStatusCode(_0x570bbb,_0x408e99){_0x408e99=_0x408e99||0xcc;return function(_0x25e6b3){if(_0x25e6b3){return _0x570bbb[_0x5130('0x1d')](_0x408e99);}return _0x570bbb['status'](_0x408e99)['end']();};}function respondWithResult(_0x55713e,_0x2dd3a4){_0x2dd3a4=_0x2dd3a4||0xc8;return function(_0x1a91fa){if(_0x1a91fa){return _0x55713e['status'](_0x2dd3a4)[_0x5130('0x1e')](_0x1a91fa);}};}function respondWithFilteredResult(_0x1b598a,_0x32121b){return function(_0x26a900){if(_0x26a900){var _0x4c5f33=typeof _0x32121b[_0x5130('0x1f')]===_0x5130('0x20')&&typeof _0x32121b[_0x5130('0x21')]==='undefined';var _0x48f0ba=_0x26a900[_0x5130('0x22')];var _0x5c7992=_0x4c5f33?0x0:_0x32121b['offset'];var _0x87ac2e=_0x4c5f33?_0x26a900['count']:_0x32121b[_0x5130('0x1f')]+_0x32121b['limit'];var _0x45405e;if(_0x87ac2e>=_0x48f0ba){_0x87ac2e=_0x48f0ba;_0x45405e=0xc8;}else{_0x45405e=0xce;}_0x1b598a[_0x5130('0x23')](_0x45405e);return _0x1b598a['set'](_0x5130('0x24'),_0x5c7992+'-'+_0x87ac2e+'/'+_0x48f0ba)['json'](_0x26a900);}return null;};}function patchUpdates(_0x1d568a){return function(_0x355b43){try{jsonpatch['apply'](_0x355b43,_0x1d568a,!![]);}catch(_0x345510){return BPromise[_0x5130('0x25')](_0x345510);}return _0x355b43[_0x5130('0x26')]();};}function saveUpdates(_0x120a7e,_0x4d74f3){return function(_0x530318){if(_0x530318){return _0x530318[_0x5130('0x27')](_0x120a7e)[_0x5130('0x28')](function(_0x431796){return _0x431796;});}return null;};}function removeEntity(_0x32e60d,_0x20a11d){return function(_0x3868d5){if(_0x3868d5){return _0x3868d5[_0x5130('0x29')]()[_0x5130('0x28')](function(){_0x32e60d[_0x5130('0x23')](0xcc)[_0x5130('0x2a')]();});}};}function handleEntityNotFound(_0x1131d3,_0x6ffa8d){return function(_0x1ed2a1){if(!_0x1ed2a1){_0x1131d3[_0x5130('0x1d')](0x194);}return _0x1ed2a1;};}function handleError(_0x44bde6,_0x30c3ae){_0x30c3ae=_0x30c3ae||0x1f4;return function(_0x2932ff){logger['error'](_0x2932ff['stack']);if(_0x2932ff[_0x5130('0x2b')]){delete _0x2932ff['name'];}_0x44bde6[_0x5130('0x23')](_0x30c3ae)[_0x5130('0x2c')](_0x2932ff);};}exports[_0x5130('0x2d')]=function(_0x83b53d,_0x4060d1){var _0x19c85b={},_0x3e66c5={},_0x49af46={'count':0x0,'rows':[]};var _0x23910d=_[_0x5130('0x2e')](db[_0x5130('0x2f')][_0x5130('0x30')],function(_0x5c10d3){return{'name':_0x5c10d3['fieldName'],'type':_0x5c10d3[_0x5130('0x31')]['key']};});_0x3e66c5['model']=_[_0x5130('0x2e')](_0x23910d,'name');_0x3e66c5[_0x5130('0x32')]=_[_0x5130('0x33')](_0x83b53d[_0x5130('0x32')]);_0x3e66c5['filters']=_[_0x5130('0x34')](_0x3e66c5['model'],_0x3e66c5['query']);_0x19c85b[_0x5130('0x35')]=_[_0x5130('0x34')](_0x3e66c5[_0x5130('0x36')],qs[_0x5130('0x37')](_0x83b53d['query'][_0x5130('0x37')]));_0x19c85b[_0x5130('0x35')]=_0x19c85b['attributes'][_0x5130('0x38')]?_0x19c85b[_0x5130('0x35')]:_0x3e66c5[_0x5130('0x36')];if(!_0x83b53d[_0x5130('0x32')][_0x5130('0x39')](_0x5130('0x3a'))){_0x19c85b[_0x5130('0x21')]=qs[_0x5130('0x21')](_0x83b53d[_0x5130('0x32')]['limit']);_0x19c85b['offset']=qs[_0x5130('0x1f')](_0x83b53d['query'][_0x5130('0x1f')]);}_0x19c85b[_0x5130('0x3b')]=qs[_0x5130('0x3c')](_0x83b53d['query'][_0x5130('0x3c')]);_0x19c85b[_0x5130('0x3d')]=qs[_0x5130('0x3e')](_['pick'](_0x83b53d['query'],_0x3e66c5[_0x5130('0x3e')]),_0x23910d);if(_0x83b53d[_0x5130('0x32')][_0x5130('0x3f')]){_0x19c85b[_0x5130('0x3d')]=_[_0x5130('0x40')](_0x19c85b['where'],{'$or':_[_0x5130('0x2e')](_0x23910d,function(_0x4c26fd){if(_0x4c26fd[_0x5130('0x31')]!=='VIRTUAL'){var _0x4b3473={};_0x4b3473[_0x4c26fd['name']]={'$like':'%'+_0x83b53d[_0x5130('0x32')]['filter']+'%'};return _0x4b3473;}})});}_0x19c85b=_[_0x5130('0x40')]({},_0x19c85b,_0x83b53d[_0x5130('0x41')]);var _0x36eb25={'where':_0x19c85b[_0x5130('0x3d')]};return db[_0x5130('0x2f')]['count'](_0x36eb25)['then'](function(_0xb7b8ca){_0x49af46['count']=_0xb7b8ca;if(_0x83b53d[_0x5130('0x32')][_0x5130('0x42')]){_0x19c85b['include']=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x19c85b);})[_0x5130('0x28')](function(_0x577f72){_0x49af46[_0x5130('0x43')]=_0x577f72;return _0x49af46;})[_0x5130('0x28')](respondWithFilteredResult(_0x4060d1,_0x19c85b))[_0x5130('0x44')](handleError(_0x4060d1,null));};exports[_0x5130('0x45')]=function(_0x2a56f4,_0x3e426a){var _0x3811f6={'raw':![],'where':{'id':_0x2a56f4['params']['id']}},_0x5d0878={};_0x5d0878['model']=_[_0x5130('0x33')](db['SalesforceAccount'][_0x5130('0x30')]);_0x5d0878[_0x5130('0x32')]=_['keys'](_0x2a56f4[_0x5130('0x32')]);_0x5d0878['filters']=_[_0x5130('0x34')](_0x5d0878[_0x5130('0x36')],_0x5d0878[_0x5130('0x32')]);_0x3811f6[_0x5130('0x35')]=_['intersection'](_0x5d0878[_0x5130('0x36')],qs['fields'](_0x2a56f4[_0x5130('0x32')][_0x5130('0x37')]));_0x3811f6[_0x5130('0x35')]=_0x3811f6['attributes'][_0x5130('0x38')]?_0x3811f6[_0x5130('0x35')]:_0x5d0878[_0x5130('0x36')];if(_0x2a56f4[_0x5130('0x32')]['includeAll']){_0x3811f6[_0x5130('0x46')]=[{'all':!![]}];}_0x3811f6=_['merge']({},_0x3811f6,_0x2a56f4[_0x5130('0x41')]);return db[_0x5130('0x2f')][_0x5130('0x47')](_0x3811f6)[_0x5130('0x28')](handleEntityNotFound(_0x3e426a,null))[_0x5130('0x28')](respondWithResult(_0x3e426a,null))[_0x5130('0x44')](handleError(_0x3e426a,null));};exports[_0x5130('0x48')]=function(_0x162a17,_0x560130){return db['SalesforceAccount'][_0x5130('0x48')](_0x162a17[_0x5130('0x49')],{})[_0x5130('0x28')](respondWithResult(_0x560130,0xc9))[_0x5130('0x44')](handleError(_0x560130,null));};exports[_0x5130('0x27')]=function(_0x106f19,_0x4d610f){if(_0x106f19[_0x5130('0x49')]['id']){delete _0x106f19[_0x5130('0x49')]['id'];}return db[_0x5130('0x2f')][_0x5130('0x47')]({'where':{'id':_0x106f19['params']['id']}})[_0x5130('0x28')](handleEntityNotFound(_0x4d610f,null))[_0x5130('0x28')](saveUpdates(_0x106f19[_0x5130('0x49')],null))['then'](respondWithResult(_0x4d610f,null))[_0x5130('0x44')](handleError(_0x4d610f,null));};exports[_0x5130('0x29')]=function(_0x568221,_0xbce742){return db[_0x5130('0x2f')][_0x5130('0x47')]({'where':{'id':_0x568221[_0x5130('0x4a')]['id']}})[_0x5130('0x28')](handleEntityNotFound(_0xbce742,null))[_0x5130('0x28')](removeEntity(_0xbce742,null))[_0x5130('0x44')](handleError(_0xbce742,null));};exports[_0x5130('0x4b')]=function(_0x1d6da6,_0x28b1cf,_0x460c46){var _0x51e44d={};var _0x428eae={};var _0x36a0a7;var _0x278ec8;return db[_0x5130('0x2f')][_0x5130('0x4c')]({'where':{'id':_0x1d6da6[_0x5130('0x4a')]['id']}})[_0x5130('0x28')](handleEntityNotFound(_0x28b1cf,null))[_0x5130('0x28')](function(_0x321dd6){if(_0x321dd6){_0x36a0a7=_0x321dd6;_0x428eae['model']=_[_0x5130('0x33')](db[_0x5130('0x4d')]['rawAttributes']);_0x428eae[_0x5130('0x32')]=_[_0x5130('0x33')](_0x1d6da6[_0x5130('0x32')]);_0x428eae['filters']=_[_0x5130('0x34')](_0x428eae[_0x5130('0x36')],_0x428eae[_0x5130('0x32')]);_0x51e44d[_0x5130('0x35')]=_['intersection'](_0x428eae[_0x5130('0x36')],qs[_0x5130('0x37')](_0x1d6da6[_0x5130('0x32')][_0x5130('0x37')]));_0x51e44d[_0x5130('0x35')]=_0x51e44d['attributes'][_0x5130('0x38')]?_0x51e44d['attributes']:_0x428eae[_0x5130('0x36')];_0x51e44d[_0x5130('0x3b')]=qs[_0x5130('0x3c')](_0x1d6da6[_0x5130('0x32')]['sort']);_0x51e44d['where']=qs[_0x5130('0x3e')](_['pick'](_0x1d6da6[_0x5130('0x32')],_0x428eae[_0x5130('0x3e')]));if(_0x1d6da6[_0x5130('0x32')]['filter']){_0x51e44d[_0x5130('0x3d')]=_[_0x5130('0x40')](_0x51e44d[_0x5130('0x3d')],{'$or':_[_0x5130('0x2e')](_0x51e44d[_0x5130('0x35')],function(_0x30bbc7){var _0x1e9e16={};_0x1e9e16[_0x30bbc7]={'$like':'%'+_0x1d6da6[_0x5130('0x32')]['filter']+'%'};return _0x1e9e16;})});}_0x51e44d=_[_0x5130('0x40')]({},_0x51e44d,_0x1d6da6['options']);return _0x36a0a7['getConfigurations'](_0x51e44d);}})[_0x5130('0x28')](function(_0x3e11a8){if(_0x3e11a8){_0x278ec8=_0x3e11a8[_0x5130('0x38')];if(!_0x1d6da6['query']['hasOwnProperty']('nolimit')){_0x51e44d[_0x5130('0x21')]=qs[_0x5130('0x21')](_0x1d6da6[_0x5130('0x32')]['limit']);_0x51e44d[_0x5130('0x1f')]=qs[_0x5130('0x1f')](_0x1d6da6[_0x5130('0x32')][_0x5130('0x1f')]);}return _0x36a0a7[_0x5130('0x4b')](_0x51e44d);}})['then'](function(_0x2c1e54){if(_0x2c1e54){return _0x2c1e54?{'count':_0x278ec8,'rows':_0x2c1e54}:null;}})[_0x5130('0x28')](respondWithResult(_0x28b1cf,null))[_0x5130('0x44')](handleError(_0x28b1cf,null));};exports[_0x5130('0x4e')]=function(_0x33625e,_0x2f1772,_0x276f8f){if(_0x33625e[_0x5130('0x49')]['id']){delete _0x33625e[_0x5130('0x49')]['id'];}return db[_0x5130('0x2f')][_0x5130('0x4c')]({'where':{'id':_0x33625e[_0x5130('0x4a')]['id']}})[_0x5130('0x28')](handleEntityNotFound(_0x2f1772,null))[_0x5130('0x28')](function(_0x3c05cc){if(_0x3c05cc){_0x33625e[_0x5130('0x49')][_0x5130('0x4f')]=_0x3c05cc['id'];_0x33625e[_0x5130('0x49')][_0x5130('0x50')]=integrations[_0x5130('0x51')](_0x33625e[_0x5130('0x49')][_0x5130('0x52')],_0x33625e[_0x5130('0x49')][_0x5130('0x31')]);_0x33625e[_0x5130('0x49')][_0x5130('0x53')]=integrations['getDescriptions'](_0x33625e[_0x5130('0x49')][_0x5130('0x52')],_0x33625e[_0x5130('0x49')][_0x5130('0x31')]);return db[_0x5130('0x4d')][_0x5130('0x48')](_0x33625e[_0x5130('0x49')],{'include':[{'model':db[_0x5130('0x54')],'as':_0x5130('0x50')},{'model':db[_0x5130('0x54')],'as':_0x5130('0x53')}]});}return null;})[_0x5130('0x28')](respondWithResult(_0x2f1772,null))[_0x5130('0x44')](handleError(_0x2f1772,null));};exports[_0x5130('0x55')]=function(_0x5c61a1,_0x1a2267,_0x556bc2){var _0x89b42;var _0xee96b4='';var _0x3bd083=_0x5130('0x56');return db[_0x5130('0x2f')][_0x5130('0x4c')]({'where':{'id':_0x5c61a1[_0x5130('0x4a')]['id']},'attributes':['id',_0x5130('0x57'),'clientId',_0x5130('0x58'),_0x5130('0x59'),'password',_0x5130('0x5a')]})['then'](handleEntityNotFound(_0x1a2267,null))[_0x5130('0x28')](function(_0x2068ba){if(_0x2068ba){_0xee96b4=_0x2068ba[_0x5130('0x57')];var _0x440921=_0xee96b4[_0x5130('0x5b')](-0x1);if(_0x440921==='/'){_0xee96b4=_0xee96b4['substring'](0x0,_0xee96b4['lastIndexOf'](_0x440921));}_0x89b42=new jsforce[(_0x5130('0x5c'))]({'oauth2':{'loginUrl':_0xee96b4,'clientId':_0x2068ba[_0x5130('0x5d')],'clientSecret':_0x2068ba[_0x5130('0x58')]}});return _0x89b42[_0x5130('0x5e')](_0x2068ba['username'],_0x2068ba[_0x5130('0x5f')]['concat'](_0x2068ba[_0x5130('0x5a')]));}})[_0x5130('0x28')](function(_0x4fdcf7){if(_0x4fdcf7){if(!_[_0x5130('0x60')](_0x5c61a1[_0x5130('0x32')]['ticketType'])){_0x3bd083=_0x5c61a1[_0x5130('0x32')][_0x5130('0x61')];}return _0x89b42[_0x5130('0x62')](_0x3bd083)[_0x5130('0x63')]();}})[_0x5130('0x28')](function(_0x4ea9c6){var _0x217d46=['OwnerId',_0x5130('0x64'),_0x5130('0x65'),_0x5130('0x66'),_0x5130('0x67'),_0x5130('0x68')];var _0xc8d7d2=[_0x5130('0x69'),'int','picklist',_0x5130('0x6a'),_0x5130('0x6b'),_0x5130('0x6c'),_0x5130('0x6d')];if(_0x4ea9c6){_[_0x5130('0x6e')](_0x4ea9c6[_0x5130('0x37')],function(_0x3d4fb2){return _0x217d46[_0x5130('0x6f')](_0x3d4fb2['name'])||!_0xc8d7d2[_0x5130('0x6f')](_0x3d4fb2[_0x5130('0x31')]);});return{'count':_0x4ea9c6[_0x5130('0x37')]['length'],'rows':_['map'](_0x4ea9c6['fields'],function(_0x3708ab){return{'id':_0x3708ab['name'],'name':_0x3708ab['label'],'custom':_0x3708ab[_0x5130('0x70')],'options':_0x3708ab[_0x5130('0x71')][_0x5130('0x38')]>0x0?_[_0x5130('0x2e')](_0x3708ab['picklistValues'],function(_0x4c5a59){return{'name':_0x4c5a59['label'],'value':_0x4c5a59[_0x5130('0x72')]};}):_0x3708ab[_0x5130('0x31')]==_0x5130('0x6a')?[{'name':_0x5130('0x73'),'value':_0x5130('0x74')},{'name':_0x5130('0x75'),'value':_0x5130('0x76')}]:[]};})};}})[_0x5130('0x28')](respondWithResult(_0x1a2267,null))[_0x5130('0x44')](function(_0x34a64c){var _0x43572c=_0x5c61a1[_0x5130('0x32')][_0x5130('0x77')]?0x1f4:_0x34a64c['statusCode']||0x1f4;logger[_0x5130('0x78')](_0x5130('0x79'),'getFields',_0x43572c,JSON[_0x5130('0x7a')](_0x34a64c));delete _0x34a64c[_0x5130('0x2b')];if(_0x43572c===0x191){_0x43572c=0x190;}_0x1a2267[_0x5130('0x23')](_0x43572c)['send'](_0x5c61a1[_0x5130('0x32')][_0x5130('0x77')]?{'message':'Wrong\x20credentials','statusCode':_0x34a64c[_0x5130('0x7b')]}:_0x34a64c);});}; \ No newline at end of file +var _0x3263=['../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','SalesforceAccount','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','length','find','catch','create','body','findOne','SalesforceConfiguration','getConfigurations','nolimit','addConfiguration','getSubjects','Descriptions','getDescriptions','channel','getFields','Task','remoteUri','clientSecret','password','slice','lastIndexOf','clientId','login','securityToken','ticketType','sobject','describe','OwnerId','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','phone','includes','label','custom','picklistValues','value','True','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','papaparse','../../components/auth/service'];(function(_0x219143,_0x451ca3){var _0x501e6b=function(_0x5888fc){while(--_0x5888fc){_0x219143['push'](_0x219143['shift']());}};_0x501e6b(++_0x451ca3);}(_0x3263,0xde));var _0x3326=function(_0xc492a3,_0x2b42ee){_0xc492a3=_0xc492a3-0x0;var _0x414593=_0x3263[_0xc492a3];return _0x414593;};'use strict';var emlformat=require(_0x3326('0x0'));var rimraf=require(_0x3326('0x1'));var zipdir=require(_0x3326('0x2'));var jsonpatch=require(_0x3326('0x3'));var rp=require(_0x3326('0x4'));var moment=require('moment');var BPromise=require(_0x3326('0x5'));var Mustache=require(_0x3326('0x6'));var util=require('util');var path=require(_0x3326('0x7'));var sox=require(_0x3326('0x8'));var csv=require(_0x3326('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3326('0xa'));var _=require(_0x3326('0xb'));var squel=require(_0x3326('0xc'));var crypto=require('crypto');var jsforce=require(_0x3326('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3326('0x9'));var querystring=require('querystring');var Papa=require(_0x3326('0xe'));var Redis=require('ioredis');var authService=require(_0x3326('0xf'));var qs=require(_0x3326('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3326('0x11'));var logger=require('../../config/logger')(_0x3326('0x12'));var utils=require(_0x3326('0x13'));var config=require(_0x3326('0x14'));var licenseUtil=require(_0x3326('0x15'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5b68d0,_0x2ea0e4){_0x2ea0e4=_0x2ea0e4||0xcc;return function(_0xe64b97){if(_0xe64b97){return _0x5b68d0['sendStatus'](_0x2ea0e4);}return _0x5b68d0[_0x3326('0x16')](_0x2ea0e4)[_0x3326('0x17')]();};}function respondWithResult(_0x256d34,_0x107ca9){_0x107ca9=_0x107ca9||0xc8;return function(_0x1107f6){if(_0x1107f6){return _0x256d34['status'](_0x107ca9)[_0x3326('0x18')](_0x1107f6);}};}function respondWithFilteredResult(_0xcc84af,_0x4b5679){return function(_0x13945a){if(_0x13945a){var _0x502bc5=typeof _0x4b5679['offset']===_0x3326('0x19')&&typeof _0x4b5679[_0x3326('0x1a')]===_0x3326('0x19');var _0x586251=_0x13945a[_0x3326('0x1b')];var _0xd9e500=_0x502bc5?0x0:_0x4b5679[_0x3326('0x1c')];var _0x2ca3f4=_0x502bc5?_0x13945a[_0x3326('0x1b')]:_0x4b5679['offset']+_0x4b5679[_0x3326('0x1a')];var _0x515a06;if(_0x2ca3f4>=_0x586251){_0x2ca3f4=_0x586251;_0x515a06=0xc8;}else{_0x515a06=0xce;}_0xcc84af[_0x3326('0x16')](_0x515a06);return _0xcc84af['set'](_0x3326('0x1d'),_0xd9e500+'-'+_0x2ca3f4+'/'+_0x586251)[_0x3326('0x18')](_0x13945a);}return null;};}function patchUpdates(_0xf71a6a){return function(_0x595cb6){try{jsonpatch[_0x3326('0x1e')](_0x595cb6,_0xf71a6a,!![]);}catch(_0x310db7){return BPromise[_0x3326('0x1f')](_0x310db7);}return _0x595cb6[_0x3326('0x20')]();};}function saveUpdates(_0x31f575,_0x23c844){return function(_0x1e3627){if(_0x1e3627){return _0x1e3627[_0x3326('0x21')](_0x31f575)[_0x3326('0x22')](function(_0x171b4e){return _0x171b4e;});}return null;};}function removeEntity(_0x577433,_0x43160a){return function(_0x5e7bff){if(_0x5e7bff){return _0x5e7bff[_0x3326('0x23')]()[_0x3326('0x22')](function(){_0x577433[_0x3326('0x16')](0xcc)[_0x3326('0x17')]();});}};}function handleEntityNotFound(_0x47a628,_0x313d10){return function(_0x50f613){if(!_0x50f613){_0x47a628[_0x3326('0x24')](0x194);}return _0x50f613;};}function handleError(_0x2b9686,_0x14ea14){_0x14ea14=_0x14ea14||0x1f4;return function(_0x4014c6){logger[_0x3326('0x25')](_0x4014c6[_0x3326('0x26')]);if(_0x4014c6['name']){delete _0x4014c6[_0x3326('0x27')];}_0x2b9686[_0x3326('0x16')](_0x14ea14)['send'](_0x4014c6);};}exports[_0x3326('0x28')]=function(_0x43caa2,_0xd914d5){var _0x1f0cc4={},_0x3237b4={},_0x928d4d={'count':0x0,'rows':[]};var _0x193e41=_[_0x3326('0x29')](db[_0x3326('0x2a')][_0x3326('0x2b')],function(_0x845f57){return{'name':_0x845f57['fieldName'],'type':_0x845f57[_0x3326('0x2c')][_0x3326('0x2d')]};});_0x3237b4[_0x3326('0x2e')]=_[_0x3326('0x29')](_0x193e41,_0x3326('0x27'));_0x3237b4[_0x3326('0x2f')]=_['keys'](_0x43caa2['query']);_0x3237b4[_0x3326('0x30')]=_[_0x3326('0x31')](_0x3237b4['model'],_0x3237b4['query']);_0x1f0cc4[_0x3326('0x32')]=_['intersection'](_0x3237b4['model'],qs[_0x3326('0x33')](_0x43caa2[_0x3326('0x2f')][_0x3326('0x33')]));_0x1f0cc4['attributes']=_0x1f0cc4[_0x3326('0x32')]['length']?_0x1f0cc4['attributes']:_0x3237b4['model'];if(!_0x43caa2['query'][_0x3326('0x34')]('nolimit')){_0x1f0cc4[_0x3326('0x1a')]=qs[_0x3326('0x1a')](_0x43caa2[_0x3326('0x2f')][_0x3326('0x1a')]);_0x1f0cc4[_0x3326('0x1c')]=qs['offset'](_0x43caa2[_0x3326('0x2f')][_0x3326('0x1c')]);}_0x1f0cc4[_0x3326('0x35')]=qs[_0x3326('0x36')](_0x43caa2['query']['sort']);_0x1f0cc4[_0x3326('0x37')]=qs['filters'](_[_0x3326('0x38')](_0x43caa2['query'],_0x3237b4[_0x3326('0x30')]),_0x193e41);if(_0x43caa2[_0x3326('0x2f')][_0x3326('0x39')]){_0x1f0cc4[_0x3326('0x37')]=_[_0x3326('0x3a')](_0x1f0cc4[_0x3326('0x37')],{'$or':_[_0x3326('0x29')](_0x193e41,function(_0x4305d5){if(_0x4305d5[_0x3326('0x2c')]!==_0x3326('0x3b')){var _0x546e97={};_0x546e97[_0x4305d5['name']]={'$like':'%'+_0x43caa2['query']['filter']+'%'};return _0x546e97;}})});}_0x1f0cc4=_['merge']({},_0x1f0cc4,_0x43caa2[_0x3326('0x3c')]);var _0x5c212a={'where':_0x1f0cc4[_0x3326('0x37')]};return db[_0x3326('0x2a')][_0x3326('0x1b')](_0x5c212a)[_0x3326('0x22')](function(_0x462985){_0x928d4d[_0x3326('0x1b')]=_0x462985;if(_0x43caa2[_0x3326('0x2f')][_0x3326('0x3d')]){_0x1f0cc4[_0x3326('0x3e')]=[{'all':!![]}];}return db[_0x3326('0x2a')][_0x3326('0x3f')](_0x1f0cc4);})['then'](function(_0x4ae66){_0x928d4d[_0x3326('0x40')]=_0x4ae66;return _0x928d4d;})[_0x3326('0x22')](respondWithFilteredResult(_0xd914d5,_0x1f0cc4))['catch'](handleError(_0xd914d5,null));};exports[_0x3326('0x41')]=function(_0x3455af,_0x11c6bc){var _0x3131d5={'raw':![],'where':{'id':_0x3455af[_0x3326('0x42')]['id']}},_0x1179dd={};_0x1179dd['model']=_[_0x3326('0x43')](db[_0x3326('0x2a')][_0x3326('0x2b')]);_0x1179dd['query']=_[_0x3326('0x43')](_0x3455af[_0x3326('0x2f')]);_0x1179dd[_0x3326('0x30')]=_[_0x3326('0x31')](_0x1179dd[_0x3326('0x2e')],_0x1179dd[_0x3326('0x2f')]);_0x3131d5[_0x3326('0x32')]=_[_0x3326('0x31')](_0x1179dd['model'],qs[_0x3326('0x33')](_0x3455af[_0x3326('0x2f')][_0x3326('0x33')]));_0x3131d5['attributes']=_0x3131d5[_0x3326('0x32')][_0x3326('0x44')]?_0x3131d5['attributes']:_0x1179dd[_0x3326('0x2e')];if(_0x3455af[_0x3326('0x2f')][_0x3326('0x3d')]){_0x3131d5[_0x3326('0x3e')]=[{'all':!![]}];}_0x3131d5=_[_0x3326('0x3a')]({},_0x3131d5,_0x3455af[_0x3326('0x3c')]);return db[_0x3326('0x2a')][_0x3326('0x45')](_0x3131d5)[_0x3326('0x22')](handleEntityNotFound(_0x11c6bc,null))['then'](respondWithResult(_0x11c6bc,null))[_0x3326('0x46')](handleError(_0x11c6bc,null));};exports[_0x3326('0x47')]=function(_0x870196,_0x4f5017){return db[_0x3326('0x2a')][_0x3326('0x47')](_0x870196[_0x3326('0x48')],{})[_0x3326('0x22')](respondWithResult(_0x4f5017,0xc9))[_0x3326('0x46')](handleError(_0x4f5017,null));};exports['update']=function(_0x5554ac,_0xcb10d8){if(_0x5554ac['body']['id']){delete _0x5554ac[_0x3326('0x48')]['id'];}return db['SalesforceAccount'][_0x3326('0x45')]({'where':{'id':_0x5554ac[_0x3326('0x42')]['id']}})['then'](handleEntityNotFound(_0xcb10d8,null))[_0x3326('0x22')](saveUpdates(_0x5554ac['body'],null))[_0x3326('0x22')](respondWithResult(_0xcb10d8,null))['catch'](handleError(_0xcb10d8,null));};exports[_0x3326('0x23')]=function(_0x4237a8,_0x1f68b7){return db[_0x3326('0x2a')]['find']({'where':{'id':_0x4237a8[_0x3326('0x42')]['id']}})[_0x3326('0x22')](handleEntityNotFound(_0x1f68b7,null))[_0x3326('0x22')](removeEntity(_0x1f68b7,null))[_0x3326('0x46')](handleError(_0x1f68b7,null));};exports['getConfigurations']=function(_0x4258fd,_0x4bb948,_0x4a32ab){var _0x366a87={};var _0x2fc4d9={};var _0x29eae1;var _0x2107c8;return db['SalesforceAccount'][_0x3326('0x49')]({'where':{'id':_0x4258fd['params']['id']}})['then'](handleEntityNotFound(_0x4bb948,null))[_0x3326('0x22')](function(_0x17e781){if(_0x17e781){_0x29eae1=_0x17e781;_0x2fc4d9[_0x3326('0x2e')]=_[_0x3326('0x43')](db[_0x3326('0x4a')][_0x3326('0x2b')]);_0x2fc4d9['query']=_[_0x3326('0x43')](_0x4258fd[_0x3326('0x2f')]);_0x2fc4d9['filters']=_['intersection'](_0x2fc4d9[_0x3326('0x2e')],_0x2fc4d9['query']);_0x366a87[_0x3326('0x32')]=_['intersection'](_0x2fc4d9['model'],qs['fields'](_0x4258fd['query'][_0x3326('0x33')]));_0x366a87[_0x3326('0x32')]=_0x366a87[_0x3326('0x32')][_0x3326('0x44')]?_0x366a87['attributes']:_0x2fc4d9[_0x3326('0x2e')];_0x366a87[_0x3326('0x35')]=qs[_0x3326('0x36')](_0x4258fd[_0x3326('0x2f')]['sort']);_0x366a87[_0x3326('0x37')]=qs[_0x3326('0x30')](_['pick'](_0x4258fd[_0x3326('0x2f')],_0x2fc4d9['filters']));if(_0x4258fd[_0x3326('0x2f')][_0x3326('0x39')]){_0x366a87['where']=_['merge'](_0x366a87[_0x3326('0x37')],{'$or':_[_0x3326('0x29')](_0x366a87[_0x3326('0x32')],function(_0x359ef9){var _0x2d951f={};_0x2d951f[_0x359ef9]={'$like':'%'+_0x4258fd[_0x3326('0x2f')][_0x3326('0x39')]+'%'};return _0x2d951f;})});}_0x366a87=_['merge']({},_0x366a87,_0x4258fd['options']);return _0x29eae1[_0x3326('0x4b')](_0x366a87);}})[_0x3326('0x22')](function(_0x50edf4){if(_0x50edf4){_0x2107c8=_0x50edf4[_0x3326('0x44')];if(!_0x4258fd[_0x3326('0x2f')][_0x3326('0x34')](_0x3326('0x4c'))){_0x366a87[_0x3326('0x1a')]=qs['limit'](_0x4258fd['query']['limit']);_0x366a87[_0x3326('0x1c')]=qs[_0x3326('0x1c')](_0x4258fd['query'][_0x3326('0x1c')]);}return _0x29eae1[_0x3326('0x4b')](_0x366a87);}})['then'](function(_0x5dbe6b){if(_0x5dbe6b){return _0x5dbe6b?{'count':_0x2107c8,'rows':_0x5dbe6b}:null;}})[_0x3326('0x22')](respondWithResult(_0x4bb948,null))[_0x3326('0x46')](handleError(_0x4bb948,null));};exports[_0x3326('0x4d')]=function(_0x5b9f48,_0x4fa8ef,_0x3e912b){if(_0x5b9f48[_0x3326('0x48')]['id']){delete _0x5b9f48[_0x3326('0x48')]['id'];}return db[_0x3326('0x2a')]['findOne']({'where':{'id':_0x5b9f48['params']['id']}})['then'](handleEntityNotFound(_0x4fa8ef,null))[_0x3326('0x22')](function(_0xf4bf0){if(_0xf4bf0){_0x5b9f48[_0x3326('0x48')]['AccountId']=_0xf4bf0['id'];_0x5b9f48[_0x3326('0x48')]['Subjects']=integrations[_0x3326('0x4e')](_0x5b9f48['body']['channel'],_0x5b9f48[_0x3326('0x48')][_0x3326('0x2c')]);_0x5b9f48[_0x3326('0x48')][_0x3326('0x4f')]=integrations[_0x3326('0x50')](_0x5b9f48[_0x3326('0x48')][_0x3326('0x51')],_0x5b9f48['body'][_0x3326('0x2c')]);return db['SalesforceConfiguration'][_0x3326('0x47')](_0x5b9f48['body'],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db['SalesforceField'],'as':'Descriptions'}]});}return null;})[_0x3326('0x22')](respondWithResult(_0x4fa8ef,null))['catch'](handleError(_0x4fa8ef,null));};exports[_0x3326('0x52')]=function(_0x492a39,_0x11149a,_0x1f197f){var _0x3fda33;var _0x41a6de='';var _0x3b4c28=_0x3326('0x53');return db[_0x3326('0x2a')]['findOne']({'where':{'id':_0x492a39['params']['id']},'attributes':['id',_0x3326('0x54'),'clientId',_0x3326('0x55'),'username',_0x3326('0x56'),'securityToken']})[_0x3326('0x22')](handleEntityNotFound(_0x11149a,null))[_0x3326('0x22')](function(_0x18b96b){if(_0x18b96b){_0x41a6de=_0x18b96b[_0x3326('0x54')];var _0x682fb3=_0x41a6de[_0x3326('0x57')](-0x1);if(_0x682fb3==='/'){_0x41a6de=_0x41a6de['substring'](0x0,_0x41a6de[_0x3326('0x58')](_0x682fb3));}_0x3fda33=new jsforce['Connection']({'oauth2':{'loginUrl':_0x41a6de,'clientId':_0x18b96b[_0x3326('0x59')],'clientSecret':_0x18b96b['clientSecret']}});return _0x3fda33[_0x3326('0x5a')](_0x18b96b['username'],_0x18b96b[_0x3326('0x56')]['concat'](_0x18b96b[_0x3326('0x5b')]));}})[_0x3326('0x22')](function(_0x243036){if(_0x243036){if(!_['isNil'](_0x492a39[_0x3326('0x2f')][_0x3326('0x5c')])){_0x3b4c28=_0x492a39['query'][_0x3326('0x5c')];}return _0x3fda33[_0x3326('0x5d')](_0x3b4c28)[_0x3326('0x5e')]();}})['then'](function(_0x10fe9b){var _0x140efe=[_0x3326('0x5f'),'ActivityDate','IsReminderSet',_0x3326('0x60'),_0x3326('0x61'),_0x3326('0x62')];var _0x4cf678=[_0x3326('0x63'),_0x3326('0x64'),_0x3326('0x65'),_0x3326('0x66'),_0x3326('0x67'),_0x3326('0x68'),_0x3326('0x69')];if(_0x10fe9b){_['remove'](_0x10fe9b[_0x3326('0x33')],function(_0x42acae){return _0x140efe[_0x3326('0x6a')](_0x42acae['name'])||!_0x4cf678[_0x3326('0x6a')](_0x42acae[_0x3326('0x2c')]);});return{'count':_0x10fe9b['fields']['length'],'rows':_[_0x3326('0x29')](_0x10fe9b[_0x3326('0x33')],function(_0x1fc729){return{'id':_0x1fc729['name'],'name':_0x1fc729[_0x3326('0x6b')],'custom':_0x1fc729[_0x3326('0x6c')],'options':_0x1fc729[_0x3326('0x6d')][_0x3326('0x44')]>0x0?_[_0x3326('0x29')](_0x1fc729[_0x3326('0x6d')],function(_0xd0e5c6){return{'name':_0xd0e5c6[_0x3326('0x6b')],'value':_0xd0e5c6[_0x3326('0x6e')]};}):_0x1fc729['type']==_0x3326('0x66')?[{'name':_0x3326('0x6f'),'value':'true'},{'name':'False','value':_0x3326('0x70')}]:[]};})};}})[_0x3326('0x22')](respondWithResult(_0x11149a,null))['catch'](function(_0x3236fa){var _0x33cea6=_0x492a39[_0x3326('0x2f')][_0x3326('0x71')]?0x1f4:_0x3236fa[_0x3326('0x72')]||0x1f4;logger['error'](_0x3326('0x73'),_0x3326('0x52'),_0x33cea6,JSON[_0x3326('0x74')](_0x3236fa));delete _0x3236fa[_0x3326('0x27')];if(_0x33cea6===0x191){_0x33cea6=0x190;}_0x11149a[_0x3326('0x16')](_0x33cea6)[_0x3326('0x75')](_0x492a39['query'][_0x3326('0x71')]?{'message':_0x3326('0x76'),'statusCode':_0x3236fa[_0x3326('0x72')]}:_0x3236fa);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 96004af..6d2a613 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 _0xf712=['rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','SalesforceAccount','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x31febd,_0x2137bf){var _0x3a1ac5=function(_0x468661){while(--_0x468661){_0x31febd['push'](_0x31febd['shift']());}};_0x3a1ac5(++_0x2137bf);}(_0xf712,0x19c));var _0x2f71=function(_0x3f6854,_0xdea659){_0x3f6854=_0x3f6854-0x0;var _0x305078=_0xf712[_0x3f6854];return _0x305078;};'use strict';var _=require(_0x2f71('0x0'));var util=require('util');var logger=require(_0x2f71('0x1'))(_0x2f71('0x2'));var moment=require(_0x2f71('0x3'));var BPromise=require(_0x2f71('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2f71('0x5'));var rimraf=require(_0x2f71('0x6'));var config=require(_0x2f71('0x7'));var attributes=require(_0x2f71('0x8'));var integrations=require(_0x2f71('0x9'));module['exports']=function(_0x3508a2,_0x50a153){return _0x3508a2['define'](_0x2f71('0xa'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc36a=['bluebird','request-promise','../../config/environment','../../components/integrations/configuration','exports','int_salesforce_accounts','lodash','util','api'];(function(_0x237da8,_0x37b77a){var _0x558825=function(_0x45d7f1){while(--_0x45d7f1){_0x237da8['push'](_0x237da8['shift']());}};_0x558825(++_0x37b77a);}(_0xc36a,0x180));var _0xac36=function(_0x540aaf,_0x1fedf9){_0x540aaf=_0x540aaf-0x0;var _0x32d0da=_0xc36a[_0x540aaf];return _0x32d0da;};'use strict';var _=require(_0xac36('0x0'));var util=require(_0xac36('0x1'));var logger=require('../../config/logger')(_0xac36('0x2'));var moment=require('moment');var BPromise=require(_0xac36('0x3'));var rp=require(_0xac36('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac36('0x5'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xac36('0x6'));module[_0xac36('0x7')]=function(_0x42d539,_0xa2f50e){return _0x42d539['define']('SalesforceAccount',attributes,{'tableName':_0xac36('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 12831dd..c940ab7 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 _0xe88a=['message','info','request\x20sent','result','GetSalesforceAccount','findAll','options','raw','where','attributes','limit','include','model','map','catch','ShowSalesforceAccount','find','stringify','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','SalesforceAccount,\x20%s,\x20%s'];(function(_0x1586db,_0x468da3){var _0x201012=function(_0x27d6e5){while(--_0x27d6e5){_0x1586db['push'](_0x1586db['shift']());}};_0x201012(++_0x468da3);}(_0xe88a,0xc6));var _0xae88=function(_0x270383,_0x3d9f4f){_0x270383=_0x270383-0x0;var _0x15f380=_0xe88a[_0x270383];return _0x15f380;};'use strict';var _=require(_0xae88('0x0'));var util=require(_0xae88('0x1'));var moment=require('moment');var BPromise=require(_0xae88('0x2'));var rs=require(_0xae88('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xae88('0x4'))['db'];var utils=require(_0xae88('0x5'));var logger=require(_0xae88('0x6'))(_0xae88('0x7'));var config=require(_0xae88('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xae88('0x9')][_0xae88('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x111bbc,_0x461bb7,_0x155ea1){return new BPromise(function(_0x541ce5,_0xe5e072){return client[_0xae88('0xb')](_0x111bbc,_0x155ea1)[_0xae88('0xc')](function(_0x1f902b){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x461bb7,'request\x20sent');logger[_0xae88('0xd')](_0xae88('0xe'),_0x461bb7,'request\x20sent',JSON['stringify'](_0x1f902b));if(_0x1f902b[_0xae88('0xf')]){if(_0x1f902b[_0xae88('0xf')][_0xae88('0x10')]===0x1f4){logger[_0xae88('0xf')](_0xae88('0x11'),_0x461bb7,_0x1f902b['error'][_0xae88('0x12')]);return _0xe5e072(_0x1f902b[_0xae88('0xf')]['message']);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x461bb7,_0x1f902b[_0xae88('0xf')][_0xae88('0x12')]);return _0x541ce5(_0x1f902b['error']['message']);}else{logger[_0xae88('0x13')]('SalesforceAccount,\x20%s,\x20%s',_0x461bb7,_0xae88('0x14'));_0x541ce5(_0x1f902b[_0xae88('0x15')]['message']);}})['catch'](function(_0x44df6b){logger['error'](_0xae88('0x11'),_0x461bb7,_0x44df6b);_0xe5e072(_0x44df6b);});});}exports[_0xae88('0x16')]=function(_0xc1fe5f){var _0x194d8b=this;return new Promise(function(_0x5752d5,_0x31dee5){return db['SalesforceAccount'][_0xae88('0x17')]({'raw':_0xc1fe5f[_0xae88('0x18')]?_0xc1fe5f[_0xae88('0x18')][_0xae88('0x19')]===undefined?!![]:![]:!![],'where':_0xc1fe5f[_0xae88('0x18')]?_0xc1fe5f[_0xae88('0x18')][_0xae88('0x1a')]||null:null,'attributes':_0xc1fe5f[_0xae88('0x18')]?_0xc1fe5f[_0xae88('0x18')][_0xae88('0x1b')]||null:null,'limit':_0xc1fe5f[_0xae88('0x18')]?_0xc1fe5f[_0xae88('0x18')][_0xae88('0x1c')]||null:null,'include':_0xc1fe5f[_0xae88('0x18')]?_0xc1fe5f[_0xae88('0x18')][_0xae88('0x1d')]?_['map'](_0xc1fe5f['options']['include'],function(_0x49ce68){return{'model':db[_0x49ce68[_0xae88('0x1e')]],'as':_0x49ce68['as'],'attributes':_0x49ce68[_0xae88('0x1b')],'include':_0x49ce68[_0xae88('0x1d')]?_[_0xae88('0x1f')](_0x49ce68[_0xae88('0x1d')],function(_0x43426a){return{'model':db[_0x43426a[_0xae88('0x1e')]],'as':_0x43426a['as'],'attributes':_0x43426a[_0xae88('0x1b')],'include':_0x43426a['include']?_[_0xae88('0x1f')](_0x43426a[_0xae88('0x1d')],function(_0x418d1d){return{'model':db[_0x418d1d[_0xae88('0x1e')]],'as':_0x418d1d['as'],'attributes':_0x418d1d[_0xae88('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xae88('0xc')](function(_0x4b5c20){logger[_0xae88('0x13')](_0xae88('0x16'),_0xc1fe5f);logger[_0xae88('0xd')]('GetSalesforceAccount',_0xc1fe5f,JSON['stringify'](_0x4b5c20));_0x5752d5(_0x4b5c20);})[_0xae88('0x20')](function(_0x39cd36){logger[_0xae88('0xf')](_0xae88('0x16'),_0x39cd36[_0xae88('0x12')],_0xc1fe5f);_0x31dee5(_0x194d8b[_0xae88('0xf')](0x1f4,_0x39cd36['message']));});});};exports[_0xae88('0x21')]=function(_0x1aa629){var _0x148e22=this;return new Promise(function(_0x13a3a4,_0x2abc38){return db['SalesforceAccount'][_0xae88('0x22')]({'raw':_0x1aa629[_0xae88('0x18')]?_0x1aa629[_0xae88('0x18')][_0xae88('0x19')]===undefined?!![]:![]:!![],'where':_0x1aa629[_0xae88('0x18')]?_0x1aa629['options']['where']||null:null,'attributes':_0x1aa629['options']?_0x1aa629['options'][_0xae88('0x1b')]||null:null,'include':_0x1aa629['options']?_0x1aa629[_0xae88('0x18')]['include']?_['map'](_0x1aa629[_0xae88('0x18')][_0xae88('0x1d')],function(_0x5c287a){return{'model':db[_0x5c287a[_0xae88('0x1e')]],'as':_0x5c287a['as'],'attributes':_0x5c287a[_0xae88('0x1b')],'include':_0x5c287a['include']?_[_0xae88('0x1f')](_0x5c287a[_0xae88('0x1d')],function(_0x2f8e24){return{'model':db[_0x2f8e24['model']],'as':_0x2f8e24['as'],'attributes':_0x2f8e24[_0xae88('0x1b')],'include':_0x2f8e24['include']?_[_0xae88('0x1f')](_0x2f8e24['include'],function(_0x21931a){return{'model':db[_0x21931a[_0xae88('0x1e')]],'as':_0x21931a['as'],'attributes':_0x21931a[_0xae88('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xae88('0xc')](function(_0x3b22ae){logger['info'](_0xae88('0x21'),_0x1aa629);logger[_0xae88('0xd')](_0xae88('0x21'),_0x1aa629,JSON[_0xae88('0x23')](_0x3b22ae));_0x13a3a4(_0x3b22ae);})[_0xae88('0x20')](function(_0xa417d9){logger[_0xae88('0xf')](_0xae88('0x21'),_0xa417d9[_0xae88('0x12')],_0x1aa629);_0x2abc38(_0x148e22[_0xae88('0xf')](0x1f4,_0xa417d9[_0xae88('0x12')]));});});}; \ No newline at end of file +var _0x51f5=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowSalesforceAccount','find','info'];(function(_0x4eebb0,_0x50f22f){var _0x248579=function(_0x539e1a){while(--_0x539e1a){_0x4eebb0['push'](_0x4eebb0['shift']());}};_0x248579(++_0x50f22f);}(_0x51f5,0x1e1));var _0x551f=function(_0x2a33f4,_0x120189){_0x2a33f4=_0x2a33f4-0x0;var _0xc5e67a=_0x51f5[_0x2a33f4];return _0xc5e67a;};'use strict';var _=require(_0x551f('0x0'));var util=require(_0x551f('0x1'));var moment=require(_0x551f('0x2'));var BPromise=require(_0x551f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x551f('0x4'));var db=require(_0x551f('0x5'))['db'];var utils=require(_0x551f('0x6'));var logger=require(_0x551f('0x7'))(_0x551f('0x8'));var config=require(_0x551f('0x9'));var jayson=require(_0x551f('0xa'));var client=jayson[_0x551f('0xb')][_0x551f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x24a202,_0x4cde91,_0x115388){return new BPromise(function(_0x53352d,_0x40f004){return client['request'](_0x24a202,_0x115388)['then'](function(_0x17b084){logger['info'](_0x551f('0xd'),_0x4cde91,_0x551f('0xe'));logger[_0x551f('0xf')](_0x551f('0x10'),_0x4cde91,_0x551f('0xe'),JSON[_0x551f('0x11')](_0x17b084));if(_0x17b084[_0x551f('0x12')]){if(_0x17b084[_0x551f('0x12')]['code']===0x1f4){logger['error'](_0x551f('0xd'),_0x4cde91,_0x17b084[_0x551f('0x12')][_0x551f('0x13')]);return _0x40f004(_0x17b084[_0x551f('0x12')][_0x551f('0x13')]);}logger[_0x551f('0x12')](_0x551f('0xd'),_0x4cde91,_0x17b084[_0x551f('0x12')][_0x551f('0x13')]);return _0x53352d(_0x17b084['error'][_0x551f('0x13')]);}else{logger['info'](_0x551f('0xd'),_0x4cde91,_0x551f('0xe'));_0x53352d(_0x17b084[_0x551f('0x14')][_0x551f('0x13')]);}})[_0x551f('0x15')](function(_0x1f67c9){logger[_0x551f('0x12')](_0x551f('0xd'),_0x4cde91,_0x1f67c9);_0x40f004(_0x1f67c9);});});}exports[_0x551f('0x16')]=function(_0x18fc35){var _0x2da46e=this;return new Promise(function(_0x3a09a9,_0x5ed1a5){return db[_0x551f('0x17')][_0x551f('0x18')]({'raw':_0x18fc35[_0x551f('0x19')]?_0x18fc35[_0x551f('0x19')][_0x551f('0x1a')]===undefined?!![]:![]:!![],'where':_0x18fc35['options']?_0x18fc35[_0x551f('0x19')][_0x551f('0x1b')]||null:null,'attributes':_0x18fc35['options']?_0x18fc35[_0x551f('0x19')][_0x551f('0x1c')]||null:null,'limit':_0x18fc35[_0x551f('0x19')]?_0x18fc35['options'][_0x551f('0x1d')]||null:null,'include':_0x18fc35[_0x551f('0x19')]?_0x18fc35[_0x551f('0x19')][_0x551f('0x1e')]?_[_0x551f('0x1f')](_0x18fc35[_0x551f('0x19')][_0x551f('0x1e')],function(_0x1916c4){return{'model':db[_0x1916c4[_0x551f('0x20')]],'as':_0x1916c4['as'],'attributes':_0x1916c4[_0x551f('0x1c')],'include':_0x1916c4[_0x551f('0x1e')]?_['map'](_0x1916c4[_0x551f('0x1e')],function(_0x28e360){return{'model':db[_0x28e360['model']],'as':_0x28e360['as'],'attributes':_0x28e360['attributes'],'include':_0x28e360[_0x551f('0x1e')]?_[_0x551f('0x1f')](_0x28e360['include'],function(_0x15f5de){return{'model':db[_0x15f5de[_0x551f('0x20')]],'as':_0x15f5de['as'],'attributes':_0x15f5de[_0x551f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x551f('0x21')](function(_0x1ae5e8){logger['info'](_0x551f('0x16'),_0x18fc35);logger[_0x551f('0xf')](_0x551f('0x16'),_0x18fc35,JSON[_0x551f('0x11')](_0x1ae5e8));_0x3a09a9(_0x1ae5e8);})[_0x551f('0x15')](function(_0x46cc0e){logger[_0x551f('0x12')](_0x551f('0x16'),_0x46cc0e[_0x551f('0x13')],_0x18fc35);_0x5ed1a5(_0x2da46e['error'](0x1f4,_0x46cc0e['message']));});});};exports[_0x551f('0x22')]=function(_0x267822){var _0x1f2c32=this;return new Promise(function(_0x375012,_0x3a1813){return db[_0x551f('0x17')][_0x551f('0x23')]({'raw':_0x267822[_0x551f('0x19')]?_0x267822[_0x551f('0x19')][_0x551f('0x1a')]===undefined?!![]:![]:!![],'where':_0x267822[_0x551f('0x19')]?_0x267822[_0x551f('0x19')][_0x551f('0x1b')]||null:null,'attributes':_0x267822['options']?_0x267822[_0x551f('0x19')][_0x551f('0x1c')]||null:null,'include':_0x267822[_0x551f('0x19')]?_0x267822['options'][_0x551f('0x1e')]?_[_0x551f('0x1f')](_0x267822[_0x551f('0x19')]['include'],function(_0x354abd){return{'model':db[_0x354abd[_0x551f('0x20')]],'as':_0x354abd['as'],'attributes':_0x354abd['attributes'],'include':_0x354abd[_0x551f('0x1e')]?_[_0x551f('0x1f')](_0x354abd[_0x551f('0x1e')],function(_0x45a832){return{'model':db[_0x45a832[_0x551f('0x20')]],'as':_0x45a832['as'],'attributes':_0x45a832[_0x551f('0x1c')],'include':_0x45a832[_0x551f('0x1e')]?_[_0x551f('0x1f')](_0x45a832[_0x551f('0x1e')],function(_0x5e800b){return{'model':db[_0x5e800b['model']],'as':_0x5e800b['as'],'attributes':_0x5e800b['attributes']};}):[]};}):[]};}):[]:[]})[_0x551f('0x21')](function(_0x556869){logger[_0x551f('0x24')](_0x551f('0x22'),_0x267822);logger[_0x551f('0xf')]('ShowSalesforceAccount',_0x267822,JSON[_0x551f('0x11')](_0x556869));_0x375012(_0x556869);})[_0x551f('0x15')](function(_0x1625c1){logger['error'](_0x551f('0x22'),_0x1625c1[_0x551f('0x13')],_0x267822);_0x3a1813(_0x1f2c32[_0x551f('0x12')](0x1f4,_0x1625c1['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 7fe9563..80e5b26 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xdb28,0x106));var _0x8db2=function(_0x5b8449,_0x39409e){_0x5b8449=_0x5b8449-0x0;var _0x73cfcc=_0xdb28[_0x5b8449];return _0x73cfcc;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file +var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xdb28,0x106));var _0x8db2=function(_0x9048b7,_0x40a2f1){_0x9048b7=_0x9048b7-0x0;var _0x2d0299=_0xdb28[_0x9048b7];return _0x2d0299;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index aa512e8..51d53e6 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 _0x4df2=['exports','STRING','ENUM','Task','Case','contact_lead','account_contact_lead','account','nothing','contact','lead','sequelize'];(function(_0x5ac84c,_0x287781){var _0x3c53d2=function(_0x40cde0){while(--_0x40cde0){_0x5ac84c['push'](_0x5ac84c['shift']());}};_0x3c53d2(++_0x287781);}(_0x4df2,0xbf));var _0x24df=function(_0x15e9d1,_0x2cde5f){_0x15e9d1=_0x15e9d1-0x0;var _0x10470b=_0x4df2[_0x15e9d1];return _0x10470b;};'use strict';var Sequelize=require(_0x24df('0x0'));module[_0x24df('0x1')]={'name':{'type':Sequelize[_0x24df('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x24df('0x3')](_0x24df('0x4'),_0x24df('0x5')),'defaultValue':_0x24df('0x4')},'moduleSearch':{'type':Sequelize[_0x24df('0x3')](_0x24df('0x6'),'contact','lead',_0x24df('0x7'),_0x24df('0x8')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x24df('0x3')](_0x24df('0x9'),_0x24df('0xa'),_0x24df('0xb'),'account'),'defaultValue':_0x24df('0xb')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x24df('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x24df('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x24df('0x2')]}}; \ No newline at end of file +var _0x1a07=['contact_lead','nothing','account','sequelize','exports','STRING','ENUM','Task','Case','contact','lead'];(function(_0x1ef01e,_0x5d71d9){var _0x3b4988=function(_0x111f7e){while(--_0x111f7e){_0x1ef01e['push'](_0x1ef01e['shift']());}};_0x3b4988(++_0x5d71d9);}(_0x1a07,0xc9));var _0x71a0=function(_0x28cef5,_0x5ed280){_0x28cef5=_0x28cef5-0x0;var _0x5b4cf3=_0x1a07[_0x28cef5];return _0x5b4cf3;};'use strict';var Sequelize=require(_0x71a0('0x0'));module[_0x71a0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x71a0('0x2')]},'ticketType':{'type':Sequelize[_0x71a0('0x3')](_0x71a0('0x4'),_0x71a0('0x5')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x71a0('0x3')]('contact_lead',_0x71a0('0x6'),_0x71a0('0x7'),'account_contact_lead','account'),'defaultValue':_0x71a0('0x8')},'moduleCreate':{'type':Sequelize['ENUM'](_0x71a0('0x9'),_0x71a0('0x6'),_0x71a0('0x7'),_0x71a0('0xa')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x71a0('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x71a0('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x71a0('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x71a0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 2c68415..86763cf 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 _0x0a7f=['sendStatus','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','status','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','SalesforceConfiguration','includeAll','findAll','catch','params','keys','fields','find','create','body','findOne','getFields','getSubjects','order','getDescriptions','SalesforceField','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x4222bf,_0x6631a6){var _0x134727=function(_0x153fe2){while(--_0x153fe2){_0x4222bf['push'](_0x4222bf['shift']());}};_0x134727(++_0x6631a6);}(_0x0a7f,0xdf));var _0xf0a7=function(_0x93bdde,_0x26ca52){_0x93bdde=_0x93bdde-0x0;var _0x19fb76=_0x0a7f[_0x93bdde];return _0x19fb76;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf0a7('0x0'));var jsonpatch=require(_0xf0a7('0x1'));var rp=require(_0xf0a7('0x2'));var moment=require(_0xf0a7('0x3'));var BPromise=require(_0xf0a7('0x4'));var Mustache=require(_0xf0a7('0x5'));var util=require(_0xf0a7('0x6'));var path=require(_0xf0a7('0x7'));var sox=require(_0xf0a7('0x8'));var csv=require(_0xf0a7('0x9'));var ejs=require(_0xf0a7('0xa'));var fs=require('fs');var fs_extra=require(_0xf0a7('0xb'));var _=require(_0xf0a7('0xc'));var squel=require('squel');var crypto=require(_0xf0a7('0xd'));var jsforce=require(_0xf0a7('0xe'));var deskjs=require(_0xf0a7('0xf'));var toCsv=require(_0xf0a7('0x9'));var querystring=require(_0xf0a7('0x10'));var Papa=require(_0xf0a7('0x11'));var Redis=require(_0xf0a7('0x12'));var authService=require(_0xf0a7('0x13'));var qs=require(_0xf0a7('0x14'));var as=require(_0xf0a7('0x15'));var hardwareService=require(_0xf0a7('0x16'));var logger=require(_0xf0a7('0x17'))(_0xf0a7('0x18'));var utils=require(_0xf0a7('0x19'));var config=require(_0xf0a7('0x1a'));var licenseUtil=require(_0xf0a7('0x1b'));var db=require(_0xf0a7('0x1c'))['db'];function respondWithStatusCode(_0x42ecf0,_0x547730){_0x547730=_0x547730||0xcc;return function(_0x5acef1){if(_0x5acef1){return _0x42ecf0[_0xf0a7('0x1d')](_0x547730);}return _0x42ecf0['status'](_0x547730)[_0xf0a7('0x1e')]();};}function respondWithResult(_0x1dde1e,_0x591cd1){_0x591cd1=_0x591cd1||0xc8;return function(_0x22cde8){if(_0x22cde8){return _0x1dde1e['status'](_0x591cd1)[_0xf0a7('0x1f')](_0x22cde8);}};}function respondWithFilteredResult(_0x135c77,_0x395db2){return function(_0x5e4e0d){if(_0x5e4e0d){var _0x29e7aa=typeof _0x395db2[_0xf0a7('0x20')]===_0xf0a7('0x21')&&typeof _0x395db2[_0xf0a7('0x22')]==='undefined';var _0x4db72f=_0x5e4e0d[_0xf0a7('0x23')];var _0xc4ee05=_0x29e7aa?0x0:_0x395db2[_0xf0a7('0x20')];var _0x62c328=_0x29e7aa?_0x5e4e0d[_0xf0a7('0x23')]:_0x395db2[_0xf0a7('0x20')]+_0x395db2[_0xf0a7('0x22')];var _0x36af70;if(_0x62c328>=_0x4db72f){_0x62c328=_0x4db72f;_0x36af70=0xc8;}else{_0x36af70=0xce;}_0x135c77['status'](_0x36af70);return _0x135c77[_0xf0a7('0x24')]('Content-Range',_0xc4ee05+'-'+_0x62c328+'/'+_0x4db72f)[_0xf0a7('0x1f')](_0x5e4e0d);}return null;};}function patchUpdates(_0x475177){return function(_0x9a365a){try{jsonpatch[_0xf0a7('0x25')](_0x9a365a,_0x475177,!![]);}catch(_0x516da9){return BPromise[_0xf0a7('0x26')](_0x516da9);}return _0x9a365a[_0xf0a7('0x27')]();};}function saveUpdates(_0x39652c,_0x11150a){return function(_0x3deb88){if(_0x3deb88){return _0x3deb88[_0xf0a7('0x28')](_0x39652c)[_0xf0a7('0x29')](function(_0x2122b4){return _0x2122b4;});}return null;};}function removeEntity(_0x18bec8,_0xa1c207){return function(_0x434ee6){if(_0x434ee6){return _0x434ee6[_0xf0a7('0x2a')]()[_0xf0a7('0x29')](function(){_0x18bec8['status'](0xcc)[_0xf0a7('0x1e')]();});}};}function handleEntityNotFound(_0x1cd105,_0x428a93){return function(_0x37ebf5){if(!_0x37ebf5){_0x1cd105[_0xf0a7('0x1d')](0x194);}return _0x37ebf5;};}function handleError(_0x25312d,_0x4681d1){_0x4681d1=_0x4681d1||0x1f4;return function(_0x1fb7c3){logger[_0xf0a7('0x2b')](_0x1fb7c3['stack']);if(_0x1fb7c3['name']){delete _0x1fb7c3[_0xf0a7('0x2c')];}_0x25312d[_0xf0a7('0x2d')](_0x4681d1)[_0xf0a7('0x2e')](_0x1fb7c3);};}exports[_0xf0a7('0x2f')]=function(_0x5adbac,_0x20bbad){var _0x215f67={},_0x3e3ea3={},_0x46c7d0={'count':0x0,'rows':[]};var _0x453af1=_[_0xf0a7('0x30')](db['SalesforceConfiguration'][_0xf0a7('0x31')],function(_0x187294){return{'name':_0x187294[_0xf0a7('0x32')],'type':_0x187294[_0xf0a7('0x33')][_0xf0a7('0x34')]};});_0x3e3ea3[_0xf0a7('0x35')]=_[_0xf0a7('0x30')](_0x453af1,'name');_0x3e3ea3[_0xf0a7('0x36')]=_['keys'](_0x5adbac['query']);_0x3e3ea3['filters']=_['intersection'](_0x3e3ea3[_0xf0a7('0x35')],_0x3e3ea3[_0xf0a7('0x36')]);_0x215f67['attributes']=_[_0xf0a7('0x37')](_0x3e3ea3[_0xf0a7('0x35')],qs['fields'](_0x5adbac[_0xf0a7('0x36')]['fields']));_0x215f67[_0xf0a7('0x38')]=_0x215f67['attributes'][_0xf0a7('0x39')]?_0x215f67[_0xf0a7('0x38')]:_0x3e3ea3[_0xf0a7('0x35')];if(!_0x5adbac[_0xf0a7('0x36')][_0xf0a7('0x3a')](_0xf0a7('0x3b'))){_0x215f67[_0xf0a7('0x22')]=qs[_0xf0a7('0x22')](_0x5adbac[_0xf0a7('0x36')][_0xf0a7('0x22')]);_0x215f67[_0xf0a7('0x20')]=qs['offset'](_0x5adbac[_0xf0a7('0x36')]['offset']);}_0x215f67['order']=qs[_0xf0a7('0x3c')](_0x5adbac[_0xf0a7('0x36')][_0xf0a7('0x3c')]);_0x215f67[_0xf0a7('0x3d')]=qs[_0xf0a7('0x3e')](_[_0xf0a7('0x3f')](_0x5adbac[_0xf0a7('0x36')],_0x3e3ea3[_0xf0a7('0x3e')]),_0x453af1);if(_0x5adbac[_0xf0a7('0x36')][_0xf0a7('0x40')]){_0x215f67[_0xf0a7('0x3d')]=_['merge'](_0x215f67[_0xf0a7('0x3d')],{'$or':_[_0xf0a7('0x30')](_0x453af1,function(_0x11251e){if(_0x11251e[_0xf0a7('0x33')]!==_0xf0a7('0x41')){var _0x27fd16={};_0x27fd16[_0x11251e[_0xf0a7('0x2c')]]={'$like':'%'+_0x5adbac[_0xf0a7('0x36')][_0xf0a7('0x40')]+'%'};return _0x27fd16;}})});}_0x215f67=_[_0xf0a7('0x42')]({},_0x215f67,_0x5adbac[_0xf0a7('0x43')]);var _0x166530={'where':_0x215f67[_0xf0a7('0x3d')]};return db[_0xf0a7('0x44')]['count'](_0x166530)[_0xf0a7('0x29')](function(_0x52221b){_0x46c7d0['count']=_0x52221b;if(_0x5adbac[_0xf0a7('0x36')][_0xf0a7('0x45')]){_0x215f67['include']=[{'all':!![]}];}return db[_0xf0a7('0x44')][_0xf0a7('0x46')](_0x215f67);})[_0xf0a7('0x29')](function(_0x1f2031){_0x46c7d0['rows']=_0x1f2031;return _0x46c7d0;})[_0xf0a7('0x29')](respondWithFilteredResult(_0x20bbad,_0x215f67))[_0xf0a7('0x47')](handleError(_0x20bbad,null));};exports['show']=function(_0x30bafc,_0x183925){var _0x600aa={'raw':![],'where':{'id':_0x30bafc[_0xf0a7('0x48')]['id']}},_0x218496={};_0x218496[_0xf0a7('0x35')]=_[_0xf0a7('0x49')](db[_0xf0a7('0x44')]['rawAttributes']);_0x218496[_0xf0a7('0x36')]=_['keys'](_0x30bafc['query']);_0x218496[_0xf0a7('0x3e')]=_[_0xf0a7('0x37')](_0x218496['model'],_0x218496['query']);_0x600aa[_0xf0a7('0x38')]=_['intersection'](_0x218496[_0xf0a7('0x35')],qs[_0xf0a7('0x4a')](_0x30bafc[_0xf0a7('0x36')][_0xf0a7('0x4a')]));_0x600aa[_0xf0a7('0x38')]=_0x600aa[_0xf0a7('0x38')][_0xf0a7('0x39')]?_0x600aa[_0xf0a7('0x38')]:_0x218496[_0xf0a7('0x35')];if(_0x30bafc[_0xf0a7('0x36')][_0xf0a7('0x45')]){_0x600aa['include']=[{'all':!![]}];}_0x600aa=_[_0xf0a7('0x42')]({},_0x600aa,_0x30bafc['options']);return db[_0xf0a7('0x44')][_0xf0a7('0x4b')](_0x600aa)['then'](handleEntityNotFound(_0x183925,null))[_0xf0a7('0x29')](respondWithResult(_0x183925,null))[_0xf0a7('0x47')](handleError(_0x183925,null));};exports[_0xf0a7('0x4c')]=function(_0x365e69,_0x17191f){return db[_0xf0a7('0x44')][_0xf0a7('0x4c')](_0x365e69['body'],{})[_0xf0a7('0x29')](respondWithResult(_0x17191f,0xc9))[_0xf0a7('0x47')](handleError(_0x17191f,null));};exports[_0xf0a7('0x28')]=function(_0x2100d1,_0x206f79){if(_0x2100d1[_0xf0a7('0x4d')]['id']){delete _0x2100d1[_0xf0a7('0x4d')]['id'];}return db[_0xf0a7('0x44')]['find']({'where':{'id':_0x2100d1[_0xf0a7('0x48')]['id']}})[_0xf0a7('0x29')](handleEntityNotFound(_0x206f79,null))[_0xf0a7('0x29')](saveUpdates(_0x2100d1[_0xf0a7('0x4d')],null))[_0xf0a7('0x29')](respondWithResult(_0x206f79,null))[_0xf0a7('0x47')](handleError(_0x206f79,null));};exports[_0xf0a7('0x2a')]=function(_0x1619e1,_0xb2a1e7){return db['SalesforceConfiguration'][_0xf0a7('0x4b')]({'where':{'id':_0x1619e1[_0xf0a7('0x48')]['id']}})[_0xf0a7('0x29')](handleEntityNotFound(_0xb2a1e7,null))[_0xf0a7('0x29')](removeEntity(_0xb2a1e7,null))[_0xf0a7('0x47')](handleError(_0xb2a1e7,null));};exports['getFields']=function(_0x15266b,_0x3af944,_0x26f42c){var _0x4f1b95={};var _0xe19fcb={};var _0x1ec49a;var _0x3d5ba6;return db[_0xf0a7('0x44')][_0xf0a7('0x4e')]({'where':{'id':_0x15266b[_0xf0a7('0x48')]['id']}})[_0xf0a7('0x29')](handleEntityNotFound(_0x3af944,null))[_0xf0a7('0x29')](function(_0x284b45){if(_0x284b45){_0x1ec49a=_0x284b45;_0xe19fcb[_0xf0a7('0x35')]=_['keys'](db['SalesforceField'][_0xf0a7('0x31')]);_0xe19fcb['query']=_[_0xf0a7('0x49')](_0x15266b[_0xf0a7('0x36')]);_0xe19fcb[_0xf0a7('0x3e')]=_['intersection'](_0xe19fcb[_0xf0a7('0x35')],_0xe19fcb[_0xf0a7('0x36')]);_0x4f1b95[_0xf0a7('0x38')]=_['intersection'](_0xe19fcb[_0xf0a7('0x35')],qs['fields'](_0x15266b['query'][_0xf0a7('0x4a')]));_0x4f1b95[_0xf0a7('0x38')]=_0x4f1b95[_0xf0a7('0x38')][_0xf0a7('0x39')]?_0x4f1b95['attributes']:_0xe19fcb[_0xf0a7('0x35')];_0x4f1b95['order']=qs['sort'](_0x15266b[_0xf0a7('0x36')][_0xf0a7('0x3c')]);_0x4f1b95[_0xf0a7('0x3d')]=qs[_0xf0a7('0x3e')](_['pick'](_0x15266b[_0xf0a7('0x36')],_0xe19fcb[_0xf0a7('0x3e')]));if(_0x15266b[_0xf0a7('0x36')][_0xf0a7('0x40')]){_0x4f1b95[_0xf0a7('0x3d')]=_[_0xf0a7('0x42')](_0x4f1b95[_0xf0a7('0x3d')],{'$or':_[_0xf0a7('0x30')](_0x4f1b95[_0xf0a7('0x38')],function(_0x13c506){var _0x5848d8={};_0x5848d8[_0x13c506]={'$like':'%'+_0x15266b[_0xf0a7('0x36')]['filter']+'%'};return _0x5848d8;})});}_0x4f1b95=_[_0xf0a7('0x42')]({},_0x4f1b95,_0x15266b[_0xf0a7('0x43')]);return _0x1ec49a['getFields'](_0x4f1b95);}})[_0xf0a7('0x29')](function(_0x940421){if(_0x940421){_0x3d5ba6=_0x940421['length'];if(!_0x15266b[_0xf0a7('0x36')]['hasOwnProperty'](_0xf0a7('0x3b'))){_0x4f1b95[_0xf0a7('0x22')]=qs[_0xf0a7('0x22')](_0x15266b['query'][_0xf0a7('0x22')]);_0x4f1b95[_0xf0a7('0x20')]=qs[_0xf0a7('0x20')](_0x15266b['query'][_0xf0a7('0x20')]);}return _0x1ec49a[_0xf0a7('0x4f')](_0x4f1b95);}})[_0xf0a7('0x29')](function(_0x3d0bf0){if(_0x3d0bf0){return _0x3d0bf0?{'count':_0x3d5ba6,'rows':_0x3d0bf0}:null;}})[_0xf0a7('0x29')](respondWithResult(_0x3af944,null))['catch'](handleError(_0x3af944,null));};exports[_0xf0a7('0x50')]=function(_0xae7f84,_0x11ff3c,_0x3343c7){var _0x5cc846={};var _0x98c6e9={};var _0x3d7f6f;var _0x29de4f;return db['SalesforceConfiguration'][_0xf0a7('0x4e')]({'where':{'id':_0xae7f84['params']['id']}})[_0xf0a7('0x29')](handleEntityNotFound(_0x11ff3c,null))[_0xf0a7('0x29')](function(_0x5aca2b){if(_0x5aca2b){_0x3d7f6f=_0x5aca2b;_0x98c6e9['model']=_[_0xf0a7('0x49')](db['SalesforceField'][_0xf0a7('0x31')]);_0x98c6e9[_0xf0a7('0x36')]=_[_0xf0a7('0x49')](_0xae7f84[_0xf0a7('0x36')]);_0x98c6e9['filters']=_[_0xf0a7('0x37')](_0x98c6e9['model'],_0x98c6e9['query']);_0x5cc846[_0xf0a7('0x38')]=_['intersection'](_0x98c6e9[_0xf0a7('0x35')],qs[_0xf0a7('0x4a')](_0xae7f84[_0xf0a7('0x36')][_0xf0a7('0x4a')]));_0x5cc846[_0xf0a7('0x38')]=_0x5cc846[_0xf0a7('0x38')][_0xf0a7('0x39')]?_0x5cc846[_0xf0a7('0x38')]:_0x98c6e9['model'];_0x5cc846[_0xf0a7('0x51')]=qs['sort'](_0xae7f84[_0xf0a7('0x36')][_0xf0a7('0x3c')]);_0x5cc846[_0xf0a7('0x3d')]=qs['filters'](_[_0xf0a7('0x3f')](_0xae7f84[_0xf0a7('0x36')],_0x98c6e9[_0xf0a7('0x3e')]));if(_0xae7f84[_0xf0a7('0x36')][_0xf0a7('0x40')]){_0x5cc846['where']=_[_0xf0a7('0x42')](_0x5cc846['where'],{'$or':_[_0xf0a7('0x30')](_0x5cc846[_0xf0a7('0x38')],function(_0x7d7191){var _0x418ecc={};_0x418ecc[_0x7d7191]={'$like':'%'+_0xae7f84[_0xf0a7('0x36')][_0xf0a7('0x40')]+'%'};return _0x418ecc;})});}_0x5cc846=_[_0xf0a7('0x42')]({},_0x5cc846,_0xae7f84[_0xf0a7('0x43')]);return _0x3d7f6f[_0xf0a7('0x50')](_0x5cc846);}})[_0xf0a7('0x29')](function(_0x2cca39){if(_0x2cca39){_0x29de4f=_0x2cca39[_0xf0a7('0x39')];if(!_0xae7f84[_0xf0a7('0x36')][_0xf0a7('0x3a')](_0xf0a7('0x3b'))){_0x5cc846[_0xf0a7('0x22')]=qs['limit'](_0xae7f84[_0xf0a7('0x36')][_0xf0a7('0x22')]);_0x5cc846[_0xf0a7('0x20')]=qs[_0xf0a7('0x20')](_0xae7f84[_0xf0a7('0x36')][_0xf0a7('0x20')]);}return _0x3d7f6f[_0xf0a7('0x50')](_0x5cc846);}})['then'](function(_0x24a116){if(_0x24a116){return _0x24a116?{'count':_0x29de4f,'rows':_0x24a116}:null;}})[_0xf0a7('0x29')](respondWithResult(_0x11ff3c,null))[_0xf0a7('0x47')](handleError(_0x11ff3c,null));};exports[_0xf0a7('0x52')]=function(_0x1fa1d5,_0x12300c,_0x564fc3){var _0x2a6a64={};var _0x3eaa82={};var _0x15f687;var _0x3d3252;return db[_0xf0a7('0x44')][_0xf0a7('0x4e')]({'where':{'id':_0x1fa1d5[_0xf0a7('0x48')]['id']}})['then'](handleEntityNotFound(_0x12300c,null))['then'](function(_0x38c50f){if(_0x38c50f){_0x15f687=_0x38c50f;_0x3eaa82['model']=_[_0xf0a7('0x49')](db[_0xf0a7('0x53')]['rawAttributes']);_0x3eaa82[_0xf0a7('0x36')]=_[_0xf0a7('0x49')](_0x1fa1d5[_0xf0a7('0x36')]);_0x3eaa82[_0xf0a7('0x3e')]=_['intersection'](_0x3eaa82[_0xf0a7('0x35')],_0x3eaa82['query']);_0x2a6a64['attributes']=_[_0xf0a7('0x37')](_0x3eaa82[_0xf0a7('0x35')],qs[_0xf0a7('0x4a')](_0x1fa1d5[_0xf0a7('0x36')][_0xf0a7('0x4a')]));_0x2a6a64[_0xf0a7('0x38')]=_0x2a6a64['attributes'][_0xf0a7('0x39')]?_0x2a6a64[_0xf0a7('0x38')]:_0x3eaa82['model'];_0x2a6a64[_0xf0a7('0x51')]=qs['sort'](_0x1fa1d5['query'][_0xf0a7('0x3c')]);_0x2a6a64[_0xf0a7('0x3d')]=qs['filters'](_['pick'](_0x1fa1d5['query'],_0x3eaa82['filters']));if(_0x1fa1d5['query']['filter']){_0x2a6a64[_0xf0a7('0x3d')]=_[_0xf0a7('0x42')](_0x2a6a64[_0xf0a7('0x3d')],{'$or':_[_0xf0a7('0x30')](_0x2a6a64['attributes'],function(_0x352f6a){var _0x275740={};_0x275740[_0x352f6a]={'$like':'%'+_0x1fa1d5['query']['filter']+'%'};return _0x275740;})});}_0x2a6a64=_['merge']({},_0x2a6a64,_0x1fa1d5[_0xf0a7('0x43')]);return _0x15f687[_0xf0a7('0x52')](_0x2a6a64);}})[_0xf0a7('0x29')](function(_0x8ba933){if(_0x8ba933){_0x3d3252=_0x8ba933[_0xf0a7('0x39')];if(!_0x1fa1d5[_0xf0a7('0x36')][_0xf0a7('0x3a')](_0xf0a7('0x3b'))){_0x2a6a64[_0xf0a7('0x22')]=qs[_0xf0a7('0x22')](_0x1fa1d5['query'][_0xf0a7('0x22')]);_0x2a6a64[_0xf0a7('0x20')]=qs[_0xf0a7('0x20')](_0x1fa1d5[_0xf0a7('0x36')]['offset']);}return _0x15f687[_0xf0a7('0x52')](_0x2a6a64);}})['then'](function(_0x334051){if(_0x334051){return _0x334051?{'count':_0x3d3252,'rows':_0x334051}:null;}})['then'](respondWithResult(_0x12300c,null))[_0xf0a7('0x47')](handleError(_0x12300c,null));}; \ No newline at end of file +var _0x4e38=['keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','catch','show','params','length','find','create','body','getFields','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','map','SalesforceConfiguration','rawAttributes','fieldName','key','model','query'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4e38,0x108));var _0x84e3=function(_0x49885f,_0x5b47c5){_0x49885f=_0x49885f-0x0;var _0x58de56=_0x4e38[_0x49885f];return _0x58de56;};'use strict';var emlformat=require(_0x84e3('0x0'));var rimraf=require(_0x84e3('0x1'));var zipdir=require(_0x84e3('0x2'));var jsonpatch=require(_0x84e3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x84e3('0x4'));var util=require('util');var path=require(_0x84e3('0x5'));var sox=require(_0x84e3('0x6'));var csv=require(_0x84e3('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x84e3('0x8'));var _=require(_0x84e3('0x9'));var squel=require(_0x84e3('0xa'));var crypto=require(_0x84e3('0xb'));var jsforce=require(_0x84e3('0xc'));var deskjs=require(_0x84e3('0xd'));var toCsv=require(_0x84e3('0x7'));var querystring=require(_0x84e3('0xe'));var Papa=require('papaparse');var Redis=require(_0x84e3('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x84e3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x84e3('0x11'));var logger=require(_0x84e3('0x12'))(_0x84e3('0x13'));var utils=require(_0x84e3('0x14'));var config=require(_0x84e3('0x15'));var licenseUtil=require(_0x84e3('0x16'));var db=require(_0x84e3('0x17'))['db'];function respondWithStatusCode(_0x5a8ba6,_0x2f7c30){_0x2f7c30=_0x2f7c30||0xcc;return function(_0x213c29){if(_0x213c29){return _0x5a8ba6[_0x84e3('0x18')](_0x2f7c30);}return _0x5a8ba6[_0x84e3('0x19')](_0x2f7c30)[_0x84e3('0x1a')]();};}function respondWithResult(_0x3c0aab,_0x2b2a71){_0x2b2a71=_0x2b2a71||0xc8;return function(_0x39628f){if(_0x39628f){return _0x3c0aab[_0x84e3('0x19')](_0x2b2a71)[_0x84e3('0x1b')](_0x39628f);}};}function respondWithFilteredResult(_0x59236f,_0x4a31e9){return function(_0x278fb9){if(_0x278fb9){var _0x5223b3=typeof _0x4a31e9[_0x84e3('0x1c')]===_0x84e3('0x1d')&&typeof _0x4a31e9['limit']===_0x84e3('0x1d');var _0x5273d1=_0x278fb9[_0x84e3('0x1e')];var _0x268c68=_0x5223b3?0x0:_0x4a31e9[_0x84e3('0x1c')];var _0x31642b=_0x5223b3?_0x278fb9[_0x84e3('0x1e')]:_0x4a31e9[_0x84e3('0x1c')]+_0x4a31e9[_0x84e3('0x1f')];var _0x5d9f2f;if(_0x31642b>=_0x5273d1){_0x31642b=_0x5273d1;_0x5d9f2f=0xc8;}else{_0x5d9f2f=0xce;}_0x59236f[_0x84e3('0x19')](_0x5d9f2f);return _0x59236f[_0x84e3('0x20')]('Content-Range',_0x268c68+'-'+_0x31642b+'/'+_0x5273d1)[_0x84e3('0x1b')](_0x278fb9);}return null;};}function patchUpdates(_0x5f1d3f){return function(_0xc7e6d7){try{jsonpatch[_0x84e3('0x21')](_0xc7e6d7,_0x5f1d3f,!![]);}catch(_0x178dec){return BPromise['reject'](_0x178dec);}return _0xc7e6d7[_0x84e3('0x22')]();};}function saveUpdates(_0xbf4575,_0x13b76e){return function(_0x1a7589){if(_0x1a7589){return _0x1a7589[_0x84e3('0x23')](_0xbf4575)[_0x84e3('0x24')](function(_0x23da62){return _0x23da62;});}return null;};}function removeEntity(_0x1b7a7b,_0x18b522){return function(_0x2353c6){if(_0x2353c6){return _0x2353c6['destroy']()[_0x84e3('0x24')](function(){_0x1b7a7b[_0x84e3('0x19')](0xcc)[_0x84e3('0x1a')]();});}};}function handleEntityNotFound(_0x7afc92,_0x57fe79){return function(_0x1271a9){if(!_0x1271a9){_0x7afc92['sendStatus'](0x194);}return _0x1271a9;};}function handleError(_0x1bc37a,_0x50122e){_0x50122e=_0x50122e||0x1f4;return function(_0x140cb0){logger[_0x84e3('0x25')](_0x140cb0[_0x84e3('0x26')]);if(_0x140cb0[_0x84e3('0x27')]){delete _0x140cb0[_0x84e3('0x27')];}_0x1bc37a[_0x84e3('0x19')](_0x50122e)[_0x84e3('0x28')](_0x140cb0);};}exports['index']=function(_0x4a69e0,_0x2d9150){var _0x461933={},_0xdbf9f={},_0x1461e6={'count':0x0,'rows':[]};var _0x53183d=_[_0x84e3('0x29')](db[_0x84e3('0x2a')][_0x84e3('0x2b')],function(_0x4ecdd4){return{'name':_0x4ecdd4[_0x84e3('0x2c')],'type':_0x4ecdd4['type'][_0x84e3('0x2d')]};});_0xdbf9f[_0x84e3('0x2e')]=_['map'](_0x53183d,_0x84e3('0x27'));_0xdbf9f[_0x84e3('0x2f')]=_[_0x84e3('0x30')](_0x4a69e0[_0x84e3('0x2f')]);_0xdbf9f[_0x84e3('0x31')]=_[_0x84e3('0x32')](_0xdbf9f['model'],_0xdbf9f[_0x84e3('0x2f')]);_0x461933['attributes']=_[_0x84e3('0x32')](_0xdbf9f['model'],qs[_0x84e3('0x33')](_0x4a69e0[_0x84e3('0x2f')][_0x84e3('0x33')]));_0x461933['attributes']=_0x461933[_0x84e3('0x34')]['length']?_0x461933['attributes']:_0xdbf9f[_0x84e3('0x2e')];if(!_0x4a69e0[_0x84e3('0x2f')][_0x84e3('0x35')](_0x84e3('0x36'))){_0x461933[_0x84e3('0x1f')]=qs['limit'](_0x4a69e0[_0x84e3('0x2f')][_0x84e3('0x1f')]);_0x461933[_0x84e3('0x1c')]=qs[_0x84e3('0x1c')](_0x4a69e0['query'][_0x84e3('0x1c')]);}_0x461933[_0x84e3('0x37')]=qs[_0x84e3('0x38')](_0x4a69e0[_0x84e3('0x2f')][_0x84e3('0x38')]);_0x461933[_0x84e3('0x39')]=qs[_0x84e3('0x31')](_[_0x84e3('0x3a')](_0x4a69e0[_0x84e3('0x2f')],_0xdbf9f[_0x84e3('0x31')]),_0x53183d);if(_0x4a69e0[_0x84e3('0x2f')][_0x84e3('0x3b')]){_0x461933['where']=_[_0x84e3('0x3c')](_0x461933[_0x84e3('0x39')],{'$or':_[_0x84e3('0x29')](_0x53183d,function(_0x23953b){if(_0x23953b[_0x84e3('0x3d')]!==_0x84e3('0x3e')){var _0x315eae={};_0x315eae[_0x23953b[_0x84e3('0x27')]]={'$like':'%'+_0x4a69e0[_0x84e3('0x2f')][_0x84e3('0x3b')]+'%'};return _0x315eae;}})});}_0x461933=_[_0x84e3('0x3c')]({},_0x461933,_0x4a69e0[_0x84e3('0x3f')]);var _0x132b84={'where':_0x461933[_0x84e3('0x39')]};return db[_0x84e3('0x2a')][_0x84e3('0x1e')](_0x132b84)['then'](function(_0x22fdcd){_0x1461e6['count']=_0x22fdcd;if(_0x4a69e0[_0x84e3('0x2f')][_0x84e3('0x40')]){_0x461933[_0x84e3('0x41')]=[{'all':!![]}];}return db['SalesforceConfiguration']['findAll'](_0x461933);})[_0x84e3('0x24')](function(_0x4585e0){_0x1461e6['rows']=_0x4585e0;return _0x1461e6;})[_0x84e3('0x24')](respondWithFilteredResult(_0x2d9150,_0x461933))[_0x84e3('0x42')](handleError(_0x2d9150,null));};exports[_0x84e3('0x43')]=function(_0x2fb82f,_0x4bcfd0){var _0x17ff52={'raw':![],'where':{'id':_0x2fb82f[_0x84e3('0x44')]['id']}},_0x3d3025={};_0x3d3025['model']=_[_0x84e3('0x30')](db[_0x84e3('0x2a')][_0x84e3('0x2b')]);_0x3d3025[_0x84e3('0x2f')]=_[_0x84e3('0x30')](_0x2fb82f['query']);_0x3d3025[_0x84e3('0x31')]=_[_0x84e3('0x32')](_0x3d3025[_0x84e3('0x2e')],_0x3d3025['query']);_0x17ff52[_0x84e3('0x34')]=_['intersection'](_0x3d3025['model'],qs[_0x84e3('0x33')](_0x2fb82f[_0x84e3('0x2f')][_0x84e3('0x33')]));_0x17ff52['attributes']=_0x17ff52[_0x84e3('0x34')][_0x84e3('0x45')]?_0x17ff52['attributes']:_0x3d3025[_0x84e3('0x2e')];if(_0x2fb82f[_0x84e3('0x2f')][_0x84e3('0x40')]){_0x17ff52[_0x84e3('0x41')]=[{'all':!![]}];}_0x17ff52=_[_0x84e3('0x3c')]({},_0x17ff52,_0x2fb82f['options']);return db[_0x84e3('0x2a')][_0x84e3('0x46')](_0x17ff52)['then'](handleEntityNotFound(_0x4bcfd0,null))[_0x84e3('0x24')](respondWithResult(_0x4bcfd0,null))['catch'](handleError(_0x4bcfd0,null));};exports[_0x84e3('0x47')]=function(_0x44d8c7,_0x3ba5db){return db[_0x84e3('0x2a')]['create'](_0x44d8c7[_0x84e3('0x48')],{})[_0x84e3('0x24')](respondWithResult(_0x3ba5db,0xc9))[_0x84e3('0x42')](handleError(_0x3ba5db,null));};exports[_0x84e3('0x23')]=function(_0x46bc96,_0x4601e1){if(_0x46bc96[_0x84e3('0x48')]['id']){delete _0x46bc96[_0x84e3('0x48')]['id'];}return db[_0x84e3('0x2a')][_0x84e3('0x46')]({'where':{'id':_0x46bc96[_0x84e3('0x44')]['id']}})[_0x84e3('0x24')](handleEntityNotFound(_0x4601e1,null))[_0x84e3('0x24')](saveUpdates(_0x46bc96[_0x84e3('0x48')],null))['then'](respondWithResult(_0x4601e1,null))['catch'](handleError(_0x4601e1,null));};exports['destroy']=function(_0x5347bb,_0x562b52){return db['SalesforceConfiguration'][_0x84e3('0x46')]({'where':{'id':_0x5347bb[_0x84e3('0x44')]['id']}})[_0x84e3('0x24')](handleEntityNotFound(_0x562b52,null))[_0x84e3('0x24')](removeEntity(_0x562b52,null))[_0x84e3('0x42')](handleError(_0x562b52,null));};exports[_0x84e3('0x49')]=function(_0x2d660e,_0x12e61e,_0x1b806e){var _0x1076cc={};var _0x5028f3={};var _0x3c128d;var _0x2d3e84;return db[_0x84e3('0x2a')][_0x84e3('0x4a')]({'where':{'id':_0x2d660e[_0x84e3('0x44')]['id']}})[_0x84e3('0x24')](handleEntityNotFound(_0x12e61e,null))[_0x84e3('0x24')](function(_0x1a8f82){if(_0x1a8f82){_0x3c128d=_0x1a8f82;_0x5028f3[_0x84e3('0x2e')]=_[_0x84e3('0x30')](db[_0x84e3('0x4b')][_0x84e3('0x2b')]);_0x5028f3[_0x84e3('0x2f')]=_[_0x84e3('0x30')](_0x2d660e['query']);_0x5028f3[_0x84e3('0x31')]=_['intersection'](_0x5028f3[_0x84e3('0x2e')],_0x5028f3[_0x84e3('0x2f')]);_0x1076cc[_0x84e3('0x34')]=_[_0x84e3('0x32')](_0x5028f3[_0x84e3('0x2e')],qs['fields'](_0x2d660e[_0x84e3('0x2f')][_0x84e3('0x33')]));_0x1076cc[_0x84e3('0x34')]=_0x1076cc['attributes']['length']?_0x1076cc[_0x84e3('0x34')]:_0x5028f3[_0x84e3('0x2e')];_0x1076cc[_0x84e3('0x37')]=qs[_0x84e3('0x38')](_0x2d660e[_0x84e3('0x2f')][_0x84e3('0x38')]);_0x1076cc[_0x84e3('0x39')]=qs[_0x84e3('0x31')](_[_0x84e3('0x3a')](_0x2d660e[_0x84e3('0x2f')],_0x5028f3[_0x84e3('0x31')]));if(_0x2d660e['query'][_0x84e3('0x3b')]){_0x1076cc[_0x84e3('0x39')]=_['merge'](_0x1076cc[_0x84e3('0x39')],{'$or':_['map'](_0x1076cc['attributes'],function(_0x25428b){var _0x9083ae={};_0x9083ae[_0x25428b]={'$like':'%'+_0x2d660e['query'][_0x84e3('0x3b')]+'%'};return _0x9083ae;})});}_0x1076cc=_[_0x84e3('0x3c')]({},_0x1076cc,_0x2d660e[_0x84e3('0x3f')]);return _0x3c128d['getFields'](_0x1076cc);}})[_0x84e3('0x24')](function(_0x383878){if(_0x383878){_0x2d3e84=_0x383878[_0x84e3('0x45')];if(!_0x2d660e['query'][_0x84e3('0x35')](_0x84e3('0x36'))){_0x1076cc[_0x84e3('0x1f')]=qs[_0x84e3('0x1f')](_0x2d660e[_0x84e3('0x2f')][_0x84e3('0x1f')]);_0x1076cc[_0x84e3('0x1c')]=qs[_0x84e3('0x1c')](_0x2d660e[_0x84e3('0x2f')]['offset']);}return _0x3c128d[_0x84e3('0x49')](_0x1076cc);}})['then'](function(_0x43af03){if(_0x43af03){return _0x43af03?{'count':_0x2d3e84,'rows':_0x43af03}:null;}})[_0x84e3('0x24')](respondWithResult(_0x12e61e,null))[_0x84e3('0x42')](handleError(_0x12e61e,null));};exports[_0x84e3('0x4c')]=function(_0x64b0ab,_0x1d1895,_0x753bf7){var _0x409929={};var _0x4f81d8={};var _0x5aa4fa;var _0x2e1d82;return db[_0x84e3('0x2a')]['findOne']({'where':{'id':_0x64b0ab[_0x84e3('0x44')]['id']}})[_0x84e3('0x24')](handleEntityNotFound(_0x1d1895,null))[_0x84e3('0x24')](function(_0x41c472){if(_0x41c472){_0x5aa4fa=_0x41c472;_0x4f81d8['model']=_['keys'](db[_0x84e3('0x4b')][_0x84e3('0x2b')]);_0x4f81d8[_0x84e3('0x2f')]=_['keys'](_0x64b0ab[_0x84e3('0x2f')]);_0x4f81d8[_0x84e3('0x31')]=_[_0x84e3('0x32')](_0x4f81d8['model'],_0x4f81d8[_0x84e3('0x2f')]);_0x409929[_0x84e3('0x34')]=_[_0x84e3('0x32')](_0x4f81d8[_0x84e3('0x2e')],qs[_0x84e3('0x33')](_0x64b0ab[_0x84e3('0x2f')][_0x84e3('0x33')]));_0x409929[_0x84e3('0x34')]=_0x409929[_0x84e3('0x34')][_0x84e3('0x45')]?_0x409929['attributes']:_0x4f81d8[_0x84e3('0x2e')];_0x409929[_0x84e3('0x37')]=qs[_0x84e3('0x38')](_0x64b0ab[_0x84e3('0x2f')][_0x84e3('0x38')]);_0x409929[_0x84e3('0x39')]=qs['filters'](_[_0x84e3('0x3a')](_0x64b0ab[_0x84e3('0x2f')],_0x4f81d8['filters']));if(_0x64b0ab[_0x84e3('0x2f')][_0x84e3('0x3b')]){_0x409929[_0x84e3('0x39')]=_[_0x84e3('0x3c')](_0x409929[_0x84e3('0x39')],{'$or':_[_0x84e3('0x29')](_0x409929['attributes'],function(_0x8b769){var _0x4121e7={};_0x4121e7[_0x8b769]={'$like':'%'+_0x64b0ab[_0x84e3('0x2f')][_0x84e3('0x3b')]+'%'};return _0x4121e7;})});}_0x409929=_[_0x84e3('0x3c')]({},_0x409929,_0x64b0ab[_0x84e3('0x3f')]);return _0x5aa4fa[_0x84e3('0x4c')](_0x409929);}})[_0x84e3('0x24')](function(_0x4f5fb3){if(_0x4f5fb3){_0x2e1d82=_0x4f5fb3['length'];if(!_0x64b0ab['query']['hasOwnProperty'](_0x84e3('0x36'))){_0x409929[_0x84e3('0x1f')]=qs[_0x84e3('0x1f')](_0x64b0ab[_0x84e3('0x2f')][_0x84e3('0x1f')]);_0x409929['offset']=qs['offset'](_0x64b0ab[_0x84e3('0x2f')][_0x84e3('0x1c')]);}return _0x5aa4fa[_0x84e3('0x4c')](_0x409929);}})[_0x84e3('0x24')](function(_0x3c462c){if(_0x3c462c){return _0x3c462c?{'count':_0x2e1d82,'rows':_0x3c462c}:null;}})[_0x84e3('0x24')](respondWithResult(_0x1d1895,null))[_0x84e3('0x42')](handleError(_0x1d1895,null));};exports[_0x84e3('0x4d')]=function(_0x41bbc2,_0x5e4871,_0xa80366){var _0x13c949={};var _0x35f0db={};var _0x22f3d5;var _0xc788f9;return db['SalesforceConfiguration'][_0x84e3('0x4a')]({'where':{'id':_0x41bbc2[_0x84e3('0x44')]['id']}})[_0x84e3('0x24')](handleEntityNotFound(_0x5e4871,null))[_0x84e3('0x24')](function(_0x5959ba){if(_0x5959ba){_0x22f3d5=_0x5959ba;_0x35f0db['model']=_['keys'](db['SalesforceField'][_0x84e3('0x2b')]);_0x35f0db[_0x84e3('0x2f')]=_[_0x84e3('0x30')](_0x41bbc2[_0x84e3('0x2f')]);_0x35f0db['filters']=_[_0x84e3('0x32')](_0x35f0db['model'],_0x35f0db['query']);_0x13c949[_0x84e3('0x34')]=_[_0x84e3('0x32')](_0x35f0db[_0x84e3('0x2e')],qs[_0x84e3('0x33')](_0x41bbc2[_0x84e3('0x2f')]['fields']));_0x13c949[_0x84e3('0x34')]=_0x13c949[_0x84e3('0x34')]['length']?_0x13c949[_0x84e3('0x34')]:_0x35f0db[_0x84e3('0x2e')];_0x13c949['order']=qs[_0x84e3('0x38')](_0x41bbc2['query'][_0x84e3('0x38')]);_0x13c949[_0x84e3('0x39')]=qs['filters'](_[_0x84e3('0x3a')](_0x41bbc2[_0x84e3('0x2f')],_0x35f0db['filters']));if(_0x41bbc2[_0x84e3('0x2f')][_0x84e3('0x3b')]){_0x13c949[_0x84e3('0x39')]=_[_0x84e3('0x3c')](_0x13c949[_0x84e3('0x39')],{'$or':_[_0x84e3('0x29')](_0x13c949[_0x84e3('0x34')],function(_0xd0067a){var _0x36b166={};_0x36b166[_0xd0067a]={'$like':'%'+_0x41bbc2[_0x84e3('0x2f')][_0x84e3('0x3b')]+'%'};return _0x36b166;})});}_0x13c949=_[_0x84e3('0x3c')]({},_0x13c949,_0x41bbc2[_0x84e3('0x3f')]);return _0x22f3d5[_0x84e3('0x4d')](_0x13c949);}})[_0x84e3('0x24')](function(_0x2aa04e){if(_0x2aa04e){_0xc788f9=_0x2aa04e['length'];if(!_0x41bbc2[_0x84e3('0x2f')][_0x84e3('0x35')](_0x84e3('0x36'))){_0x13c949[_0x84e3('0x1f')]=qs[_0x84e3('0x1f')](_0x41bbc2[_0x84e3('0x2f')][_0x84e3('0x1f')]);_0x13c949[_0x84e3('0x1c')]=qs['offset'](_0x41bbc2[_0x84e3('0x2f')][_0x84e3('0x1c')]);}return _0x22f3d5[_0x84e3('0x4d')](_0x13c949);}})[_0x84e3('0x24')](function(_0x9f60c1){if(_0x9f60c1){return _0x9f60c1?{'count':_0xc788f9,'rows':_0x9f60c1}:null;}})[_0x84e3('0x24')](respondWithResult(_0x5e4871,null))[_0x84e3('0x42')](handleError(_0x5e4871,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 41aa256..c07ea80 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 _0x29ad=['path','rimraf','../../config/environment','exports','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x29ad,0xc9));var _0xd29a=function(_0x147820,_0x3f7f74){_0x147820=_0x147820-0x0;var _0xbea528=_0x29ad[_0x147820];return _0xbea528;};'use strict';var _=require(_0xd29a('0x0'));var util=require(_0xd29a('0x1'));var logger=require(_0xd29a('0x2'))(_0xd29a('0x3'));var moment=require(_0xd29a('0x4'));var BPromise=require(_0xd29a('0x5'));var rp=require(_0xd29a('0x6'));var fs=require('fs');var path=require(_0xd29a('0x7'));var rimraf=require(_0xd29a('0x8'));var config=require(_0xd29a('0x9'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xd29a('0xa')]=function(_0x10542c,_0x1bddb2){return _0x10542c['define'](_0xd29a('0xb'),attributes,{'tableName':_0xd29a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda67=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','util','../../config/logger'];(function(_0x467e46,_0x386931){var _0x5a9077=function(_0x47c964){while(--_0x47c964){_0x467e46['push'](_0x467e46['shift']());}};_0x5a9077(++_0x386931);}(_0xda67,0x1ac));var _0x7da6=function(_0x4afb00,_0x59ddb1){_0x4afb00=_0x4afb00-0x0;var _0x418fe8=_0xda67[_0x4afb00];return _0x418fe8;};'use strict';var _=require('lodash');var util=require(_0x7da6('0x0'));var logger=require(_0x7da6('0x1'))(_0x7da6('0x2'));var moment=require(_0x7da6('0x3'));var BPromise=require(_0x7da6('0x4'));var rp=require(_0x7da6('0x5'));var fs=require('fs');var path=require(_0x7da6('0x6'));var rimraf=require(_0x7da6('0x7'));var config=require(_0x7da6('0x8'));var attributes=require('./intSalesforceConfiguration.attributes');module['exports']=function(_0x1ab8ef,_0x228a54){return _0x1ab8ef[_0x7da6('0x9')]('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index dba93b4..9eb29fb 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 _0xbd9f=['debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x16b07e,_0x26222b){var _0x3581a9=function(_0x13b2db){while(--_0x13b2db){_0x16b07e['push'](_0x16b07e['shift']());}};_0x3581a9(++_0x26222b);}(_0xbd9f,0x1eb));var _0xfbd9=function(_0x29cd9e,_0x5146e1){_0x29cd9e=_0x29cd9e-0x0;var _0x53a4d3=_0xbd9f[_0x29cd9e];return _0x53a4d3;};'use strict';var _=require('lodash');var util=require(_0xfbd9('0x0'));var moment=require(_0xfbd9('0x1'));var BPromise=require('bluebird');var rs=require(_0xfbd9('0x2'));var fs=require('fs');var Redis=require(_0xfbd9('0x3'));var db=require(_0xfbd9('0x4'))['db'];var utils=require(_0xfbd9('0x5'));var logger=require(_0xfbd9('0x6'))(_0xfbd9('0x7'));var config=require(_0xfbd9('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfbd9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f3ce5,_0x4556bb,_0x2aa057){return new BPromise(function(_0x3256a5,_0x2d31e6){return client[_0xfbd9('0xa')](_0x4f3ce5,_0x2aa057)[_0xfbd9('0xb')](function(_0x3dda14){logger[_0xfbd9('0xc')](_0xfbd9('0xd'),_0x4556bb,_0xfbd9('0xe'));logger[_0xfbd9('0xf')](_0xfbd9('0x10'),_0x4556bb,_0xfbd9('0xe'),JSON[_0xfbd9('0x11')](_0x3dda14));if(_0x3dda14[_0xfbd9('0x12')]){if(_0x3dda14[_0xfbd9('0x12')][_0xfbd9('0x13')]===0x1f4){logger[_0xfbd9('0x12')](_0xfbd9('0xd'),_0x4556bb,_0x3dda14[_0xfbd9('0x12')]['message']);return _0x2d31e6(_0x3dda14[_0xfbd9('0x12')][_0xfbd9('0x14')]);}logger[_0xfbd9('0x12')](_0xfbd9('0xd'),_0x4556bb,_0x3dda14[_0xfbd9('0x12')][_0xfbd9('0x14')]);return _0x3256a5(_0x3dda14[_0xfbd9('0x12')]['message']);}else{logger[_0xfbd9('0xc')](_0xfbd9('0xd'),_0x4556bb,'request\x20sent');_0x3256a5(_0x3dda14[_0xfbd9('0x15')][_0xfbd9('0x14')]);}})[_0xfbd9('0x16')](function(_0x19e8fe){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x4556bb,_0x19e8fe);_0x2d31e6(_0x19e8fe);});});} \ No newline at end of file +var _0xc72e=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x53a509,_0x3ba255){var _0x1a7f14=function(_0xcb548){while(--_0xcb548){_0x53a509['push'](_0x53a509['shift']());}};_0x1a7f14(++_0x3ba255);}(_0xc72e,0x91));var _0xec72=function(_0x487b42,_0x3f9602){_0x487b42=_0x487b42-0x0;var _0x5e492d=_0xc72e[_0x487b42];return _0x5e492d;};'use strict';var _=require(_0xec72('0x0'));var util=require(_0xec72('0x1'));var moment=require(_0xec72('0x2'));var BPromise=require(_0xec72('0x3'));var rs=require(_0xec72('0x4'));var fs=require('fs');var Redis=require(_0xec72('0x5'));var db=require(_0xec72('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xec72('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xec72('0x8'));var client=jayson[_0xec72('0x9')][_0xec72('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43e2c4,_0x1948e7,_0x17583c){return new BPromise(function(_0x2a2d29,_0x2d11e3){return client['request'](_0x43e2c4,_0x17583c)['then'](function(_0xad407){logger[_0xec72('0xb')](_0xec72('0xc'),_0x1948e7,_0xec72('0xd'));logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x1948e7,'request\x20sent',JSON[_0xec72('0xe')](_0xad407));if(_0xad407[_0xec72('0xf')]){if(_0xad407[_0xec72('0xf')][_0xec72('0x10')]===0x1f4){logger[_0xec72('0xf')](_0xec72('0xc'),_0x1948e7,_0xad407['error']['message']);return _0x2d11e3(_0xad407[_0xec72('0xf')][_0xec72('0x11')]);}logger[_0xec72('0xf')](_0xec72('0xc'),_0x1948e7,_0xad407[_0xec72('0xf')][_0xec72('0x11')]);return _0x2a2d29(_0xad407[_0xec72('0xf')][_0xec72('0x11')]);}else{logger[_0xec72('0xb')](_0xec72('0xc'),_0x1948e7,_0xec72('0xd'));_0x2a2d29(_0xad407[_0xec72('0x12')][_0xec72('0x11')]);}})[_0xec72('0x13')](function(_0x44e569){logger['error'](_0xec72('0xc'),_0x1948e7,_0x44e569);_0x2d11e3(_0x44e569);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 5bbefb1..3cbf7e1 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 _0x4f00=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x4f00,0x1a3));var _0x04f0=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x4f00[_0x37bd26];return _0xe83dc4;};'use strict';var multer=require(_0x04f0('0x0'));var util=require('util');var path=require(_0x04f0('0x1'));var timeout=require(_0x04f0('0x2'));var express=require(_0x04f0('0x3'));var router=express[_0x04f0('0x4')]();var fs_extra=require(_0x04f0('0x5'));var auth=require(_0x04f0('0x6'));var interaction=require(_0x04f0('0x7'));var config=require('../../config/environment');var controller=require(_0x04f0('0x8'));router[_0x04f0('0x9')]('/',auth['isAuthenticated'](),controller[_0x04f0('0xa')]);router[_0x04f0('0x9')](_0x04f0('0xb'),auth[_0x04f0('0xc')](),controller[_0x04f0('0xd')]);router[_0x04f0('0xe')]('/',auth[_0x04f0('0xc')](),controller[_0x04f0('0xf')]);router[_0x04f0('0x10')]('/:id',auth[_0x04f0('0xc')](),controller[_0x04f0('0x11')]);router[_0x04f0('0x12')](_0x04f0('0xb'),auth[_0x04f0('0xc')](),controller[_0x04f0('0x13')]);module[_0x04f0('0x14')]=router; \ No newline at end of file +var _0x076f=['create','put','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post'];(function(_0x24a3c4,_0x2b5ff2){var _0x347523=function(_0x7c8bbc){while(--_0x7c8bbc){_0x24a3c4['push'](_0x24a3c4['shift']());}};_0x347523(++_0x2b5ff2);}(_0x076f,0x181));var _0xf076=function(_0x1bb352,_0x1160a2){_0x1bb352=_0x1bb352-0x0;var _0x4a22af=_0x076f[_0x1bb352];return _0x4a22af;};'use strict';var multer=require(_0xf076('0x0'));var util=require(_0xf076('0x1'));var path=require(_0xf076('0x2'));var timeout=require(_0xf076('0x3'));var express=require(_0xf076('0x4'));var router=express[_0xf076('0x5')]();var fs_extra=require(_0xf076('0x6'));var auth=require(_0xf076('0x7'));var interaction=require(_0xf076('0x8'));var config=require(_0xf076('0x9'));var controller=require('./intSalesforceField.controller');router[_0xf076('0xa')]('/',auth[_0xf076('0xb')](),controller['index']);router[_0xf076('0xa')]('/:id',auth[_0xf076('0xb')](),controller[_0xf076('0xc')]);router[_0xf076('0xd')]('/',auth[_0xf076('0xb')](),controller[_0xf076('0xe')]);router[_0xf076('0xf')](_0xf076('0x10'),auth[_0xf076('0xb')](),controller['update']);router[_0xf076('0x11')]('/:id',auth[_0xf076('0xb')](),controller['destroy']);module[_0xf076('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 d401b73..2f3087a 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 _0xf044=['keyValue','string','STRING','sequelize','exports','ENUM','variable','customVariable'];(function(_0x32c3ee,_0x33c20a){var _0x3108d1=function(_0x11481c){while(--_0x11481c){_0x32c3ee['push'](_0x32c3ee['shift']());}};_0x3108d1(++_0x33c20a);}(_0xf044,0x1e3));var _0x4f04=function(_0x4c3b9f,_0xc9acc){_0x4c3b9f=_0x4c3b9f-0x0;var _0x4b6958=_0xf044[_0x4c3b9f];return _0x4b6958;};'use strict';var Sequelize=require(_0x4f04('0x0'));module[_0x4f04('0x1')]={'type':{'type':Sequelize[_0x4f04('0x2')]('string',_0x4f04('0x3'),_0x4f04('0x4'),_0x4f04('0x5'),'picklist'),'defaultValue':_0x4f04('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4f04('0x7')]},'keyType':{'type':Sequelize[_0x4f04('0x2')](_0x4f04('0x6'),_0x4f04('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x4f04('0x7')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x4f04('0x7')]}}; \ No newline at end of file +var _0xd6c4=['variable','customVariable','keyValue','picklist','STRING','ENUM','sequelize','string'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd6c4,0xce));var _0x4d6c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd6c4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4d6c('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x4d6c('0x1'),_0x4d6c('0x2'),_0x4d6c('0x3'),_0x4d6c('0x4'),_0x4d6c('0x5')),'defaultValue':_0x4d6c('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4d6c('0x6')]},'keyType':{'type':Sequelize[_0x4d6c('0x7')](_0x4d6c('0x1'),'variable',_0x4d6c('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4d6c('0x6')]},'variableName':{'type':Sequelize[_0x4d6c('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 22fab36..d206562 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 _0x0963=['mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','catch','show','include','find','create','body','params','eml-format','zip-dir','fast-json-patch','bluebird'];(function(_0x53b72f,_0x29ffb2){var _0x27d610=function(_0x56f739){while(--_0x56f739){_0x53b72f['push'](_0x53b72f['shift']());}};_0x27d610(++_0x29ffb2);}(_0x0963,0x1b8));var _0x3096=function(_0x4b1473,_0x570c61){_0x4b1473=_0x4b1473-0x0;var _0x4eb602=_0x0963[_0x4b1473];return _0x4eb602;};'use strict';var emlformat=require(_0x3096('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3096('0x1'));var jsonpatch=require(_0x3096('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3096('0x3'));var Mustache=require(_0x3096('0x4'));var util=require('util');var path=require(_0x3096('0x5'));var sox=require(_0x3096('0x6'));var csv=require(_0x3096('0x7'));var ejs=require(_0x3096('0x8'));var fs=require('fs');var fs_extra=require(_0x3096('0x9'));var _=require(_0x3096('0xa'));var squel=require(_0x3096('0xb'));var crypto=require(_0x3096('0xc'));var jsforce=require(_0x3096('0xd'));var deskjs=require(_0x3096('0xe'));var toCsv=require(_0x3096('0x7'));var querystring=require('querystring');var Papa=require(_0x3096('0xf'));var Redis=require(_0x3096('0x10'));var authService=require(_0x3096('0x11'));var qs=require(_0x3096('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3096('0x13'));var logger=require(_0x3096('0x14'))(_0x3096('0x15'));var utils=require(_0x3096('0x16'));var config=require(_0x3096('0x17'));var licenseUtil=require(_0x3096('0x18'));var db=require(_0x3096('0x19'))['db'];function respondWithStatusCode(_0x21a20c,_0x3519b0){_0x3519b0=_0x3519b0||0xcc;return function(_0x448a92){if(_0x448a92){return _0x21a20c['sendStatus'](_0x3519b0);}return _0x21a20c['status'](_0x3519b0)['end']();};}function respondWithResult(_0x3c0355,_0x536270){_0x536270=_0x536270||0xc8;return function(_0x4b6524){if(_0x4b6524){return _0x3c0355[_0x3096('0x1a')](_0x536270)['json'](_0x4b6524);}};}function respondWithFilteredResult(_0x330dc3,_0x3fae5c){return function(_0x771cf9){if(_0x771cf9){var _0x1f4083=typeof _0x3fae5c[_0x3096('0x1b')]==='undefined'&&typeof _0x3fae5c[_0x3096('0x1c')]===_0x3096('0x1d');var _0x2b7003=_0x771cf9['count'];var _0x5d0571=_0x1f4083?0x0:_0x3fae5c[_0x3096('0x1b')];var _0x2aed35=_0x1f4083?_0x771cf9[_0x3096('0x1e')]:_0x3fae5c[_0x3096('0x1b')]+_0x3fae5c['limit'];var _0x520226;if(_0x2aed35>=_0x2b7003){_0x2aed35=_0x2b7003;_0x520226=0xc8;}else{_0x520226=0xce;}_0x330dc3['status'](_0x520226);return _0x330dc3[_0x3096('0x1f')](_0x3096('0x20'),_0x5d0571+'-'+_0x2aed35+'/'+_0x2b7003)[_0x3096('0x21')](_0x771cf9);}return null;};}function patchUpdates(_0x31a508){return function(_0xfa48e6){try{jsonpatch[_0x3096('0x22')](_0xfa48e6,_0x31a508,!![]);}catch(_0x438c42){return BPromise[_0x3096('0x23')](_0x438c42);}return _0xfa48e6['save']();};}function saveUpdates(_0x18d560,_0x4765e3){return function(_0xb29ae0){if(_0xb29ae0){return _0xb29ae0[_0x3096('0x24')](_0x18d560)[_0x3096('0x25')](function(_0x4124cb){return _0x4124cb;});}return null;};}function removeEntity(_0x4d4aaf,_0x475785){return function(_0x4014bb){if(_0x4014bb){return _0x4014bb[_0x3096('0x26')]()[_0x3096('0x25')](function(){_0x4d4aaf[_0x3096('0x1a')](0xcc)[_0x3096('0x27')]();});}};}function handleEntityNotFound(_0x731483,_0x23331e){return function(_0x4c9447){if(!_0x4c9447){_0x731483[_0x3096('0x28')](0x194);}return _0x4c9447;};}function handleError(_0x4e97ee,_0x33c6dc){_0x33c6dc=_0x33c6dc||0x1f4;return function(_0x56a0db){logger[_0x3096('0x29')](_0x56a0db[_0x3096('0x2a')]);if(_0x56a0db[_0x3096('0x2b')]){delete _0x56a0db[_0x3096('0x2b')];}_0x4e97ee[_0x3096('0x1a')](_0x33c6dc)[_0x3096('0x2c')](_0x56a0db);};}exports[_0x3096('0x2d')]=function(_0x599c27,_0x460cbd){var _0x3a8bcd={},_0x2e4c67={},_0x2a92e1={'count':0x0,'rows':[]};var _0x181128=_[_0x3096('0x2e')](db[_0x3096('0x2f')][_0x3096('0x30')],function(_0x5e6ab9){return{'name':_0x5e6ab9[_0x3096('0x31')],'type':_0x5e6ab9[_0x3096('0x32')]['key']};});_0x2e4c67['model']=_[_0x3096('0x2e')](_0x181128,'name');_0x2e4c67[_0x3096('0x33')]=_[_0x3096('0x34')](_0x599c27[_0x3096('0x33')]);_0x2e4c67[_0x3096('0x35')]=_[_0x3096('0x36')](_0x2e4c67[_0x3096('0x37')],_0x2e4c67[_0x3096('0x33')]);_0x3a8bcd[_0x3096('0x38')]=_['intersection'](_0x2e4c67[_0x3096('0x37')],qs['fields'](_0x599c27[_0x3096('0x33')][_0x3096('0x39')]));_0x3a8bcd['attributes']=_0x3a8bcd[_0x3096('0x38')]['length']?_0x3a8bcd[_0x3096('0x38')]:_0x2e4c67[_0x3096('0x37')];if(!_0x599c27['query'][_0x3096('0x3a')](_0x3096('0x3b'))){_0x3a8bcd['limit']=qs[_0x3096('0x1c')](_0x599c27['query']['limit']);_0x3a8bcd[_0x3096('0x1b')]=qs[_0x3096('0x1b')](_0x599c27[_0x3096('0x33')][_0x3096('0x1b')]);}_0x3a8bcd['order']=qs[_0x3096('0x3c')](_0x599c27[_0x3096('0x33')][_0x3096('0x3c')]);_0x3a8bcd[_0x3096('0x3d')]=qs['filters'](_[_0x3096('0x3e')](_0x599c27[_0x3096('0x33')],_0x2e4c67[_0x3096('0x35')]),_0x181128);if(_0x599c27[_0x3096('0x33')]['filter']){_0x3a8bcd['where']=_[_0x3096('0x3f')](_0x3a8bcd[_0x3096('0x3d')],{'$or':_[_0x3096('0x2e')](_0x181128,function(_0x4f180b){if(_0x4f180b['type']!=='VIRTUAL'){var _0x4c373d={};_0x4c373d[_0x4f180b['name']]={'$like':'%'+_0x599c27[_0x3096('0x33')][_0x3096('0x40')]+'%'};return _0x4c373d;}})});}_0x3a8bcd=_[_0x3096('0x3f')]({},_0x3a8bcd,_0x599c27[_0x3096('0x41')]);var _0x17a8ee={'where':_0x3a8bcd[_0x3096('0x3d')]};return db[_0x3096('0x2f')][_0x3096('0x1e')](_0x17a8ee)[_0x3096('0x25')](function(_0x59d05d){_0x2a92e1[_0x3096('0x1e')]=_0x59d05d;if(_0x599c27['query'][_0x3096('0x42')]){_0x3a8bcd['include']=[{'all':!![]}];}return db['SalesforceField']['findAll'](_0x3a8bcd);})[_0x3096('0x25')](function(_0xae34b1){_0x2a92e1['rows']=_0xae34b1;return _0x2a92e1;})[_0x3096('0x25')](respondWithFilteredResult(_0x460cbd,_0x3a8bcd))[_0x3096('0x43')](handleError(_0x460cbd,null));};exports[_0x3096('0x44')]=function(_0x4aa836,_0x2da6aa){var _0x588681={'raw':!![],'where':{'id':_0x4aa836['params']['id']}},_0x38d1d8={};_0x38d1d8[_0x3096('0x37')]=_[_0x3096('0x34')](db[_0x3096('0x2f')][_0x3096('0x30')]);_0x38d1d8['query']=_[_0x3096('0x34')](_0x4aa836['query']);_0x38d1d8['filters']=_[_0x3096('0x36')](_0x38d1d8[_0x3096('0x37')],_0x38d1d8[_0x3096('0x33')]);_0x588681[_0x3096('0x38')]=_[_0x3096('0x36')](_0x38d1d8[_0x3096('0x37')],qs[_0x3096('0x39')](_0x4aa836[_0x3096('0x33')]['fields']));_0x588681['attributes']=_0x588681['attributes']['length']?_0x588681[_0x3096('0x38')]:_0x38d1d8[_0x3096('0x37')];if(_0x4aa836[_0x3096('0x33')][_0x3096('0x42')]){_0x588681[_0x3096('0x45')]=[{'all':!![]}];}_0x588681=_[_0x3096('0x3f')]({},_0x588681,_0x4aa836[_0x3096('0x41')]);return db[_0x3096('0x2f')][_0x3096('0x46')](_0x588681)['then'](handleEntityNotFound(_0x2da6aa,null))['then'](respondWithResult(_0x2da6aa,null))[_0x3096('0x43')](handleError(_0x2da6aa,null));};exports[_0x3096('0x47')]=function(_0x1809cc,_0x313734){return db['SalesforceField'][_0x3096('0x47')](_0x1809cc[_0x3096('0x48')],{})['then'](respondWithResult(_0x313734,0xc9))[_0x3096('0x43')](handleError(_0x313734,null));};exports[_0x3096('0x24')]=function(_0x1902ce,_0x228fa6){if(_0x1902ce[_0x3096('0x48')]['id']){delete _0x1902ce[_0x3096('0x48')]['id'];}return db[_0x3096('0x2f')][_0x3096('0x46')]({'where':{'id':_0x1902ce[_0x3096('0x49')]['id']}})['then'](handleEntityNotFound(_0x228fa6,null))[_0x3096('0x25')](saveUpdates(_0x1902ce[_0x3096('0x48')],null))[_0x3096('0x25')](respondWithResult(_0x228fa6,null))[_0x3096('0x43')](handleError(_0x228fa6,null));};exports['destroy']=function(_0x3f3b17,_0x473bbe){return db['SalesforceField'][_0x3096('0x46')]({'where':{'id':_0x3f3b17['params']['id']}})[_0x3096('0x25')](handleEntityNotFound(_0x473bbe,null))[_0x3096('0x25')](removeEntity(_0x473bbe,null))[_0x3096('0x43')](handleError(_0x473bbe,null));}; \ No newline at end of file +var _0x7f98=['send','map','SalesforceField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','sort','where','pick','filter','merge','options','rows','show','params','includeAll','include','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name'];(function(_0x4e000b,_0x694eb1){var _0x4de7b6=function(_0x4fd45c){while(--_0x4fd45c){_0x4e000b['push'](_0x4e000b['shift']());}};_0x4de7b6(++_0x694eb1);}(_0x7f98,0x153));var _0x87f9=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x7f98[_0x16d10f];return _0x50c823;};'use strict';var emlformat=require(_0x87f9('0x0'));var rimraf=require(_0x87f9('0x1'));var zipdir=require(_0x87f9('0x2'));var jsonpatch=require(_0x87f9('0x3'));var rp=require(_0x87f9('0x4'));var moment=require(_0x87f9('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x87f9('0x6'));var sox=require(_0x87f9('0x7'));var csv=require(_0x87f9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x87f9('0x9'));var _=require(_0x87f9('0xa'));var squel=require(_0x87f9('0xb'));var crypto=require(_0x87f9('0xc'));var jsforce=require(_0x87f9('0xd'));var deskjs=require(_0x87f9('0xe'));var toCsv=require(_0x87f9('0x8'));var querystring=require(_0x87f9('0xf'));var Papa=require('papaparse');var Redis=require(_0x87f9('0x10'));var authService=require(_0x87f9('0x11'));var qs=require(_0x87f9('0x12'));var as=require(_0x87f9('0x13'));var hardwareService=require(_0x87f9('0x14'));var logger=require(_0x87f9('0x15'))(_0x87f9('0x16'));var utils=require(_0x87f9('0x17'));var config=require(_0x87f9('0x18'));var licenseUtil=require(_0x87f9('0x19'));var db=require(_0x87f9('0x1a'))['db'];function respondWithStatusCode(_0x1bc94f,_0x17d7ac){_0x17d7ac=_0x17d7ac||0xcc;return function(_0x2b1002){if(_0x2b1002){return _0x1bc94f['sendStatus'](_0x17d7ac);}return _0x1bc94f['status'](_0x17d7ac)[_0x87f9('0x1b')]();};}function respondWithResult(_0xe1d63f,_0x33df0a){_0x33df0a=_0x33df0a||0xc8;return function(_0x32651f){if(_0x32651f){return _0xe1d63f[_0x87f9('0x1c')](_0x33df0a)[_0x87f9('0x1d')](_0x32651f);}};}function respondWithFilteredResult(_0x4b67c0,_0x1e96b5){return function(_0x575a4b){if(_0x575a4b){var _0x3646ab=typeof _0x1e96b5[_0x87f9('0x1e')]==='undefined'&&typeof _0x1e96b5[_0x87f9('0x1f')]===_0x87f9('0x20');var _0x2cf96a=_0x575a4b['count'];var _0x56d6b3=_0x3646ab?0x0:_0x1e96b5[_0x87f9('0x1e')];var _0x200e92=_0x3646ab?_0x575a4b[_0x87f9('0x21')]:_0x1e96b5[_0x87f9('0x1e')]+_0x1e96b5[_0x87f9('0x1f')];var _0x43b2b2;if(_0x200e92>=_0x2cf96a){_0x200e92=_0x2cf96a;_0x43b2b2=0xc8;}else{_0x43b2b2=0xce;}_0x4b67c0[_0x87f9('0x1c')](_0x43b2b2);return _0x4b67c0[_0x87f9('0x22')](_0x87f9('0x23'),_0x56d6b3+'-'+_0x200e92+'/'+_0x2cf96a)[_0x87f9('0x1d')](_0x575a4b);}return null;};}function patchUpdates(_0x4dedcd){return function(_0x5beae5){try{jsonpatch[_0x87f9('0x24')](_0x5beae5,_0x4dedcd,!![]);}catch(_0x300630){return BPromise[_0x87f9('0x25')](_0x300630);}return _0x5beae5[_0x87f9('0x26')]();};}function saveUpdates(_0x290de7,_0x33b526){return function(_0x2d7ec3){if(_0x2d7ec3){return _0x2d7ec3[_0x87f9('0x27')](_0x290de7)[_0x87f9('0x28')](function(_0x3e28c6){return _0x3e28c6;});}return null;};}function removeEntity(_0x54c169,_0x4ff423){return function(_0x32e954){if(_0x32e954){return _0x32e954[_0x87f9('0x29')]()['then'](function(){_0x54c169[_0x87f9('0x1c')](0xcc)[_0x87f9('0x1b')]();});}};}function handleEntityNotFound(_0x1a1fe4,_0x2f65a6){return function(_0x397f47){if(!_0x397f47){_0x1a1fe4[_0x87f9('0x2a')](0x194);}return _0x397f47;};}function handleError(_0xdd379d,_0x2897f3){_0x2897f3=_0x2897f3||0x1f4;return function(_0x6f5376){logger[_0x87f9('0x2b')](_0x6f5376[_0x87f9('0x2c')]);if(_0x6f5376[_0x87f9('0x2d')]){delete _0x6f5376[_0x87f9('0x2d')];}_0xdd379d[_0x87f9('0x1c')](_0x2897f3)[_0x87f9('0x2e')](_0x6f5376);};}exports['index']=function(_0x230e06,_0x30e6f3){var _0x445a46={},_0x49d07f={},_0x55bdf6={'count':0x0,'rows':[]};var _0x59ebca=_[_0x87f9('0x2f')](db[_0x87f9('0x30')][_0x87f9('0x31')],function(_0x31ae56){return{'name':_0x31ae56[_0x87f9('0x32')],'type':_0x31ae56[_0x87f9('0x33')][_0x87f9('0x34')]};});_0x49d07f['model']=_['map'](_0x59ebca,_0x87f9('0x2d'));_0x49d07f[_0x87f9('0x35')]=_[_0x87f9('0x36')](_0x230e06[_0x87f9('0x35')]);_0x49d07f[_0x87f9('0x37')]=_[_0x87f9('0x38')](_0x49d07f[_0x87f9('0x39')],_0x49d07f[_0x87f9('0x35')]);_0x445a46['attributes']=_[_0x87f9('0x38')](_0x49d07f[_0x87f9('0x39')],qs[_0x87f9('0x3a')](_0x230e06[_0x87f9('0x35')][_0x87f9('0x3a')]));_0x445a46[_0x87f9('0x3b')]=_0x445a46[_0x87f9('0x3b')][_0x87f9('0x3c')]?_0x445a46[_0x87f9('0x3b')]:_0x49d07f[_0x87f9('0x39')];if(!_0x230e06[_0x87f9('0x35')]['hasOwnProperty'](_0x87f9('0x3d'))){_0x445a46[_0x87f9('0x1f')]=qs[_0x87f9('0x1f')](_0x230e06['query'][_0x87f9('0x1f')]);_0x445a46[_0x87f9('0x1e')]=qs['offset'](_0x230e06[_0x87f9('0x35')]['offset']);}_0x445a46['order']=qs['sort'](_0x230e06[_0x87f9('0x35')][_0x87f9('0x3e')]);_0x445a46[_0x87f9('0x3f')]=qs[_0x87f9('0x37')](_[_0x87f9('0x40')](_0x230e06[_0x87f9('0x35')],_0x49d07f[_0x87f9('0x37')]),_0x59ebca);if(_0x230e06[_0x87f9('0x35')][_0x87f9('0x41')]){_0x445a46[_0x87f9('0x3f')]=_['merge'](_0x445a46[_0x87f9('0x3f')],{'$or':_['map'](_0x59ebca,function(_0x110923){if(_0x110923['type']!=='VIRTUAL'){var _0x459f95={};_0x459f95[_0x110923[_0x87f9('0x2d')]]={'$like':'%'+_0x230e06[_0x87f9('0x35')][_0x87f9('0x41')]+'%'};return _0x459f95;}})});}_0x445a46=_[_0x87f9('0x42')]({},_0x445a46,_0x230e06[_0x87f9('0x43')]);var _0x1a2ed9={'where':_0x445a46[_0x87f9('0x3f')]};return db['SalesforceField'][_0x87f9('0x21')](_0x1a2ed9)[_0x87f9('0x28')](function(_0x2f61ff){_0x55bdf6[_0x87f9('0x21')]=_0x2f61ff;if(_0x230e06['query']['includeAll']){_0x445a46['include']=[{'all':!![]}];}return db[_0x87f9('0x30')]['findAll'](_0x445a46);})[_0x87f9('0x28')](function(_0x44b8fb){_0x55bdf6[_0x87f9('0x44')]=_0x44b8fb;return _0x55bdf6;})['then'](respondWithFilteredResult(_0x30e6f3,_0x445a46))['catch'](handleError(_0x30e6f3,null));};exports[_0x87f9('0x45')]=function(_0x276f85,_0x183354){var _0x1d54e9={'raw':!![],'where':{'id':_0x276f85[_0x87f9('0x46')]['id']}},_0x13837e={};_0x13837e[_0x87f9('0x39')]=_[_0x87f9('0x36')](db['SalesforceField'][_0x87f9('0x31')]);_0x13837e[_0x87f9('0x35')]=_['keys'](_0x276f85[_0x87f9('0x35')]);_0x13837e['filters']=_['intersection'](_0x13837e[_0x87f9('0x39')],_0x13837e[_0x87f9('0x35')]);_0x1d54e9[_0x87f9('0x3b')]=_['intersection'](_0x13837e[_0x87f9('0x39')],qs['fields'](_0x276f85[_0x87f9('0x35')][_0x87f9('0x3a')]));_0x1d54e9[_0x87f9('0x3b')]=_0x1d54e9[_0x87f9('0x3b')][_0x87f9('0x3c')]?_0x1d54e9[_0x87f9('0x3b')]:_0x13837e[_0x87f9('0x39')];if(_0x276f85[_0x87f9('0x35')][_0x87f9('0x47')]){_0x1d54e9[_0x87f9('0x48')]=[{'all':!![]}];}_0x1d54e9=_['merge']({},_0x1d54e9,_0x276f85[_0x87f9('0x43')]);return db['SalesforceField'][_0x87f9('0x49')](_0x1d54e9)[_0x87f9('0x28')](handleEntityNotFound(_0x183354,null))[_0x87f9('0x28')](respondWithResult(_0x183354,null))[_0x87f9('0x4a')](handleError(_0x183354,null));};exports[_0x87f9('0x4b')]=function(_0x22ae77,_0x44b980){return db[_0x87f9('0x30')]['create'](_0x22ae77[_0x87f9('0x4c')],{})[_0x87f9('0x28')](respondWithResult(_0x44b980,0xc9))[_0x87f9('0x4a')](handleError(_0x44b980,null));};exports[_0x87f9('0x27')]=function(_0x3d5111,_0x267da7){if(_0x3d5111[_0x87f9('0x4c')]['id']){delete _0x3d5111['body']['id'];}return db[_0x87f9('0x30')][_0x87f9('0x49')]({'where':{'id':_0x3d5111['params']['id']}})[_0x87f9('0x28')](handleEntityNotFound(_0x267da7,null))[_0x87f9('0x28')](saveUpdates(_0x3d5111['body'],null))['then'](respondWithResult(_0x267da7,null))[_0x87f9('0x4a')](handleError(_0x267da7,null));};exports[_0x87f9('0x29')]=function(_0x1f7a38,_0x106714){return db[_0x87f9('0x30')][_0x87f9('0x49')]({'where':{'id':_0x1f7a38[_0x87f9('0x46')]['id']}})[_0x87f9('0x28')](handleEntityNotFound(_0x106714,null))[_0x87f9('0x28')](removeEntity(_0x106714,null))[_0x87f9('0x4a')](handleError(_0x106714,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index d73c836..fb43200 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 _0xca0c=['SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','util','../../config/logger','moment','request-promise','path','./intSalesforceField.attributes','define'];(function(_0x55d8c5,_0x10287a){var _0x225ae5=function(_0x2ba03a){while(--_0x2ba03a){_0x55d8c5['push'](_0x55d8c5['shift']());}};_0x225ae5(++_0x10287a);}(_0xca0c,0x184));var _0xcca0=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xca0c[_0x5f0089];return _0x193892;};'use strict';var _=require(_0xcca0('0x0'));var util=require(_0xcca0('0x1'));var logger=require(_0xcca0('0x2'))('api');var moment=require(_0xcca0('0x3'));var BPromise=require('bluebird');var rp=require(_0xcca0('0x4'));var fs=require('fs');var path=require(_0xcca0('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcca0('0x6'));module['exports']=function(_0x4ea017,_0x2c0f63){return _0x4ea017[_0xcca0('0x7')](_0xcca0('0x8'),attributes,{'tableName':_0xcca0('0x9'),'paranoid':![],'indexes':[{'name':_0xcca0('0xa'),'fields':['idField',_0xcca0('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf3df=['lodash','api','moment','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index'];(function(_0x5802c5,_0x272ddf){var _0x41ee69=function(_0xdf9851){while(--_0xdf9851){_0x5802c5['push'](_0x5802c5['shift']());}};_0x41ee69(++_0x272ddf);}(_0xf3df,0x15c));var _0xff3d=function(_0x58fc2f,_0x111399){_0x58fc2f=_0x58fc2f-0x0;var _0x3a1312=_0xf3df[_0x58fc2f];return _0x3a1312;};'use strict';var _=require(_0xff3d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xff3d('0x1'));var moment=require(_0xff3d('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xff3d('0x3'));var rimraf=require(_0xff3d('0x4'));var config=require(_0xff3d('0x5'));var attributes=require(_0xff3d('0x6'));module[_0xff3d('0x7')]=function(_0x4648bf,_0x57150b){return _0x4648bf[_0xff3d('0x8')](_0xff3d('0x9'),attributes,{'tableName':_0xff3d('0xa'),'paranoid':![],'indexes':[{'name':_0xff3d('0xb'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 697edd4..7d4e0ea 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 _0xb4d9=['jayson/promise','http','request','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x275b16,_0xb0a60d){var _0x1f8ce0=function(_0x4004c5){while(--_0x4004c5){_0x275b16['push'](_0x275b16['shift']());}};_0x1f8ce0(++_0xb0a60d);}(_0xb4d9,0x1ad));var _0x9b4d=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xb4d9[_0x413feb];return _0x40ee88;};'use strict';var _=require('lodash');var util=require(_0x9b4d('0x0'));var moment=require(_0x9b4d('0x1'));var BPromise=require(_0x9b4d('0x2'));var rs=require(_0x9b4d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9b4d('0x4'))['db'];var utils=require(_0x9b4d('0x5'));var logger=require(_0x9b4d('0x6'))(_0x9b4d('0x7'));var config=require('../../config/environment');var jayson=require(_0x9b4d('0x8'));var client=jayson['client'][_0x9b4d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2496a6,_0x55973b,_0x2e4865){return new BPromise(function(_0x2a10e8,_0x2d86a1){return client[_0x9b4d('0xa')](_0x2496a6,_0x2e4865)['then'](function(_0x499810){logger['info']('SalesforceField,\x20%s,\x20%s',_0x55973b,_0x9b4d('0xb'));logger[_0x9b4d('0xc')](_0x9b4d('0xd'),_0x55973b,_0x9b4d('0xb'),JSON[_0x9b4d('0xe')](_0x499810));if(_0x499810[_0x9b4d('0xf')]){if(_0x499810['error'][_0x9b4d('0x10')]===0x1f4){logger['error'](_0x9b4d('0x11'),_0x55973b,_0x499810[_0x9b4d('0xf')][_0x9b4d('0x12')]);return _0x2d86a1(_0x499810[_0x9b4d('0xf')]['message']);}logger[_0x9b4d('0xf')]('SalesforceField,\x20%s,\x20%s',_0x55973b,_0x499810['error'][_0x9b4d('0x12')]);return _0x2a10e8(_0x499810['error'][_0x9b4d('0x12')]);}else{logger['info'](_0x9b4d('0x11'),_0x55973b,_0x9b4d('0xb'));_0x2a10e8(_0x499810['result']['message']);}})['catch'](function(_0x4d44e0){logger[_0x9b4d('0xf')]('SalesforceField,\x20%s,\x20%s',_0x55973b,_0x4d44e0);_0x2d86a1(_0x4d44e0);});});} \ No newline at end of file +var _0x7cbe=['client','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x14501a,_0x44b389){var _0x1330ec=function(_0x3523bf){while(--_0x3523bf){_0x14501a['push'](_0x14501a['shift']());}};_0x1330ec(++_0x44b389);}(_0x7cbe,0xf3));var _0xe7cb=function(_0x25df0e,_0x5398af){_0x25df0e=_0x25df0e-0x0;var _0x21fb15=_0x7cbe[_0x25df0e];return _0x21fb15;};'use strict';var _=require(_0xe7cb('0x0'));var util=require(_0xe7cb('0x1'));var moment=require(_0xe7cb('0x2'));var BPromise=require(_0xe7cb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe7cb('0x5'));var logger=require(_0xe7cb('0x6'))(_0xe7cb('0x7'));var config=require(_0xe7cb('0x8'));var jayson=require(_0xe7cb('0x9'));var client=jayson[_0xe7cb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51e38c,_0x1c3c08,_0x272202){return new BPromise(function(_0x119c6d,_0x46f928){return client[_0xe7cb('0xb')](_0x51e38c,_0x272202)[_0xe7cb('0xc')](function(_0x2cb614){logger['info'](_0xe7cb('0xd'),_0x1c3c08,_0xe7cb('0xe'));logger[_0xe7cb('0xf')](_0xe7cb('0x10'),_0x1c3c08,_0xe7cb('0xe'),JSON[_0xe7cb('0x11')](_0x2cb614));if(_0x2cb614[_0xe7cb('0x12')]){if(_0x2cb614[_0xe7cb('0x12')][_0xe7cb('0x13')]===0x1f4){logger[_0xe7cb('0x12')](_0xe7cb('0xd'),_0x1c3c08,_0x2cb614[_0xe7cb('0x12')][_0xe7cb('0x14')]);return _0x46f928(_0x2cb614['error'][_0xe7cb('0x14')]);}logger[_0xe7cb('0x12')](_0xe7cb('0xd'),_0x1c3c08,_0x2cb614['error'][_0xe7cb('0x14')]);return _0x119c6d(_0x2cb614[_0xe7cb('0x12')][_0xe7cb('0x14')]);}else{logger['info'](_0xe7cb('0xd'),_0x1c3c08,_0xe7cb('0xe'));_0x119c6d(_0x2cb614[_0xe7cb('0x15')][_0xe7cb('0x14')]);}})[_0xe7cb('0x16')](function(_0x2f597d){logger['error'](_0xe7cb('0xd'),_0x1c3c08,_0x2f597d);_0x46f928(_0x2f597d);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 6edb2f6..fc58f18 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 _0x08ca=['show','/:id/fields','getFields','create','post','addConfiguration','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x1e4f2d,_0x22e2bb){var _0xd05ce5=function(_0x4c7b43){while(--_0x4c7b43){_0x1e4f2d['push'](_0x1e4f2d['shift']());}};_0xd05ce5(++_0x22e2bb);}(_0x08ca,0xb2));var _0xa08c=function(_0x310227,_0x25eb57){_0x310227=_0x310227-0x0;var _0x4a3da3=_0x08ca[_0x310227];return _0x4a3da3;};'use strict';var multer=require(_0xa08c('0x0'));var util=require('util');var path=require(_0xa08c('0x1'));var timeout=require(_0xa08c('0x2'));var express=require(_0xa08c('0x3'));var router=express[_0xa08c('0x4')]();var fs_extra=require(_0xa08c('0x5'));var auth=require(_0xa08c('0x6'));var interaction=require(_0xa08c('0x7'));var config=require(_0xa08c('0x8'));var controller=require(_0xa08c('0x9'));router[_0xa08c('0xa')]('/',auth[_0xa08c('0xb')](),controller[_0xa08c('0xc')]);router['get'](_0xa08c('0xd'),auth[_0xa08c('0xb')](),controller[_0xa08c('0xe')]);router[_0xa08c('0xa')]('/:id/configurations',auth[_0xa08c('0xb')](),controller['getConfigurations']);router[_0xa08c('0xa')](_0xa08c('0xf'),auth['isAuthenticated'](),controller[_0xa08c('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa08c('0x11')]);router[_0xa08c('0x12')]('/:id/configurations',auth[_0xa08c('0xb')](),controller[_0xa08c('0x13')]);router[_0xa08c('0x14')](_0xa08c('0xd'),auth[_0xa08c('0xb')](),controller[_0xa08c('0x15')]);router['delete'](_0xa08c('0xd'),auth[_0xa08c('0xb')](),controller[_0xa08c('0x16')]);module[_0xa08c('0x17')]=router; \ No newline at end of file +var _0x91d0=['./intServicenowAccount.controller','isAuthenticated','get','/:id','show','getConfigurations','/:id/fields','getFields','create','post','/:id/configurations','addConfiguration','put','update','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4d20d4,_0x3d9480){var _0xfb6a43=function(_0xcff849){while(--_0xcff849){_0x4d20d4['push'](_0x4d20d4['shift']());}};_0xfb6a43(++_0x3d9480);}(_0x91d0,0xb6));var _0x091d=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x91d0[_0x1b2ff7];return _0x31656a;};'use strict';var multer=require('multer');var util=require(_0x091d('0x0'));var path=require(_0x091d('0x1'));var timeout=require('connect-timeout');var express=require(_0x091d('0x2'));var router=express['Router']();var fs_extra=require(_0x091d('0x3'));var auth=require(_0x091d('0x4'));var interaction=require(_0x091d('0x5'));var config=require(_0x091d('0x6'));var controller=require(_0x091d('0x7'));router['get']('/',auth[_0x091d('0x8')](),controller['index']);router[_0x091d('0x9')](_0x091d('0xa'),auth[_0x091d('0x8')](),controller[_0x091d('0xb')]);router[_0x091d('0x9')]('/:id/configurations',auth[_0x091d('0x8')](),controller[_0x091d('0xc')]);router[_0x091d('0x9')](_0x091d('0xd'),auth[_0x091d('0x8')](),controller[_0x091d('0xe')]);router['post']('/',auth[_0x091d('0x8')](),controller[_0x091d('0xf')]);router[_0x091d('0x10')](_0x091d('0x11'),auth[_0x091d('0x8')](),controller[_0x091d('0x12')]);router[_0x091d('0x13')](_0x091d('0xa'),auth[_0x091d('0x8')](),controller[_0x091d('0x14')]);router['delete'](_0x091d('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 2902619..8726228 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 _0x4c59=['remoteUri','sequelize','STRING','username'];(function(_0x32f75b,_0x16cde7){var _0x26f5c7=function(_0x2f80b8){while(--_0x2f80b8){_0x32f75b['push'](_0x32f75b['shift']());}};_0x26f5c7(++_0x16cde7);}(_0x4c59,0x115));var _0x94c5=function(_0x2bc8e0,_0x38204a){_0x2bc8e0=_0x2bc8e0-0x0;var _0xca8f97=_0x4c59[_0x2bc8e0];return _0xca8f97;};'use strict';var Sequelize=require(_0x94c5('0x0'));module['exports']={'name':{'type':Sequelize[_0x94c5('0x1')]},'description':{'type':Sequelize[_0x94c5('0x1')]},'username':{'type':Sequelize[_0x94c5('0x1')],'unique':_0x94c5('0x2')},'password':{'type':Sequelize[_0x94c5('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x94c5('0x1')],'unique':_0x94c5('0x3')},'serverUrl':{'type':Sequelize[_0x94c5('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x81e4=['username','remoteUri','sequelize','exports','STRING'];(function(_0x529a1f,_0x41480f){var _0x51177e=function(_0x544bed){while(--_0x544bed){_0x529a1f['push'](_0x529a1f['shift']());}};_0x51177e(++_0x41480f);}(_0x81e4,0x1a6));var _0x481e=function(_0x3c7152,_0x302b29){_0x3c7152=_0x3c7152-0x0;var _0x43aea5=_0x81e4[_0x3c7152];return _0x43aea5;};'use strict';var Sequelize=require(_0x481e('0x0'));module[_0x481e('0x1')]={'name':{'type':Sequelize[_0x481e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x481e('0x2')],'unique':_0x481e('0x3')},'password':{'type':Sequelize[_0x481e('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x481e('0x4')},'serverUrl':{'type':Sequelize[_0x481e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 5214c71..d957db6 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 _0xe472=['False','inactive','false','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','then','destroy','error','stack','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','rows','params','intersection','find','create','body','catch','update','getConfigurations','findOne','ServicenowConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','severity','category','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','calendar_stc','closed_at','delivery_plan','impact','business_service','priority','sys_domain_path','rfc','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','description','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','sys_id','contact_type','incident_state','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','sys_tags','upon_approval','correlation_id','username','email','remoteUri','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','GET','result','incident\x20table\x20objects','includes','name','internalType','label','push','all','assign','log','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','concat','ServiceNow\x20error:\x20','test','statusCode','True','true'];(function(_0x36391b,_0x1961ec){var _0x2b1cec=function(_0x379623){while(--_0x379623){_0x36391b['push'](_0x36391b['shift']());}};_0x2b1cec(++_0x1961ec);}(_0xe472,0xc1));var _0x2e47=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe472[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x2e47('0x0'));var rimraf=require(_0x2e47('0x1'));var zipdir=require(_0x2e47('0x2'));var jsonpatch=require(_0x2e47('0x3'));var rp=require(_0x2e47('0x4'));var moment=require(_0x2e47('0x5'));var BPromise=require(_0x2e47('0x6'));var Mustache=require(_0x2e47('0x7'));var util=require(_0x2e47('0x8'));var path=require(_0x2e47('0x9'));var sox=require(_0x2e47('0xa'));var csv=require(_0x2e47('0xb'));var ejs=require(_0x2e47('0xc'));var fs=require('fs');var fs_extra=require(_0x2e47('0xd'));var _=require(_0x2e47('0xe'));var squel=require(_0x2e47('0xf'));var crypto=require(_0x2e47('0x10'));var jsforce=require(_0x2e47('0x11'));var deskjs=require(_0x2e47('0x12'));var toCsv=require('to-csv');var querystring=require(_0x2e47('0x13'));var Papa=require(_0x2e47('0x14'));var Redis=require('ioredis');var authService=require(_0x2e47('0x15'));var qs=require(_0x2e47('0x16'));var as=require(_0x2e47('0x17'));var hardwareService=require(_0x2e47('0x18'));var logger=require('../../config/logger')('api');var utils=require(_0x2e47('0x19'));var config=require(_0x2e47('0x1a'));var licenseUtil=require(_0x2e47('0x1b'));var db=require(_0x2e47('0x1c'))['db'];var integrations=require(_0x2e47('0x1d'));function respondWithStatusCode(_0x3375d7,_0x37c709){_0x37c709=_0x37c709||0xcc;return function(_0x5ee878){if(_0x5ee878){return _0x3375d7[_0x2e47('0x1e')](_0x37c709);}return _0x3375d7[_0x2e47('0x1f')](_0x37c709)[_0x2e47('0x20')]();};}function respondWithResult(_0x4a52f3,_0x63770e){_0x63770e=_0x63770e||0xc8;return function(_0x40db18){if(_0x40db18){return _0x4a52f3[_0x2e47('0x1f')](_0x63770e)[_0x2e47('0x21')](_0x40db18);}};}function respondWithFilteredResult(_0x3eb216,_0x217113){return function(_0x47dd32){if(_0x47dd32){var _0x3ec0aa=typeof _0x217113[_0x2e47('0x22')]==='undefined'&&typeof _0x217113['limit']===_0x2e47('0x23');var _0x50103f=_0x47dd32[_0x2e47('0x24')];var _0x594f6c=_0x3ec0aa?0x0:_0x217113[_0x2e47('0x22')];var _0x36da56=_0x3ec0aa?_0x47dd32['count']:_0x217113[_0x2e47('0x22')]+_0x217113[_0x2e47('0x25')];var _0x5aec61;if(_0x36da56>=_0x50103f){_0x36da56=_0x50103f;_0x5aec61=0xc8;}else{_0x5aec61=0xce;}_0x3eb216[_0x2e47('0x1f')](_0x5aec61);return _0x3eb216[_0x2e47('0x26')]('Content-Range',_0x594f6c+'-'+_0x36da56+'/'+_0x50103f)[_0x2e47('0x21')](_0x47dd32);}return null;};}function patchUpdates(_0x10cf44){return function(_0x199e50){try{jsonpatch[_0x2e47('0x27')](_0x199e50,_0x10cf44,!![]);}catch(_0x37c26e){return BPromise[_0x2e47('0x28')](_0x37c26e);}return _0x199e50[_0x2e47('0x29')]();};}function saveUpdates(_0x578efe,_0x2050d7){return function(_0x42653d){if(_0x42653d){return _0x42653d['update'](_0x578efe)[_0x2e47('0x2a')](function(_0x4ae24d){return _0x4ae24d;});}return null;};}function removeEntity(_0x3a3a4c,_0x82fc37){return function(_0x1f662f){if(_0x1f662f){return _0x1f662f[_0x2e47('0x2b')]()[_0x2e47('0x2a')](function(){_0x3a3a4c[_0x2e47('0x1f')](0xcc)[_0x2e47('0x20')]();});}};}function handleEntityNotFound(_0x2fa7ec,_0x1479e0){return function(_0x5b7959){if(!_0x5b7959){_0x2fa7ec[_0x2e47('0x1e')](0x194);}return _0x5b7959;};}function handleError(_0x5a6d33,_0x5e03ef){_0x5e03ef=_0x5e03ef||0x1f4;return function(_0x4539d5){logger[_0x2e47('0x2c')](_0x4539d5[_0x2e47('0x2d')]);if(_0x4539d5['name']){delete _0x4539d5['name'];}_0x5a6d33[_0x2e47('0x1f')](_0x5e03ef)[_0x2e47('0x2e')](_0x4539d5);};}exports[_0x2e47('0x2f')]=function(_0x9e4103,_0x11d2aa){var _0xc72e6d={},_0x4144a5={},_0x27c4cb={'count':0x0,'rows':[]};var _0x81eaee=_[_0x2e47('0x30')](db[_0x2e47('0x31')][_0x2e47('0x32')],function(_0x47e5e4){return{'name':_0x47e5e4[_0x2e47('0x33')],'type':_0x47e5e4[_0x2e47('0x34')]['key']};});_0x4144a5[_0x2e47('0x35')]=_[_0x2e47('0x30')](_0x81eaee,'name');_0x4144a5[_0x2e47('0x36')]=_[_0x2e47('0x37')](_0x9e4103[_0x2e47('0x36')]);_0x4144a5['filters']=_['intersection'](_0x4144a5[_0x2e47('0x35')],_0x4144a5['query']);_0xc72e6d[_0x2e47('0x38')]=_['intersection'](_0x4144a5[_0x2e47('0x35')],qs[_0x2e47('0x39')](_0x9e4103[_0x2e47('0x36')][_0x2e47('0x39')]));_0xc72e6d[_0x2e47('0x38')]=_0xc72e6d['attributes'][_0x2e47('0x3a')]?_0xc72e6d[_0x2e47('0x38')]:_0x4144a5[_0x2e47('0x35')];if(!_0x9e4103[_0x2e47('0x36')][_0x2e47('0x3b')](_0x2e47('0x3c'))){_0xc72e6d[_0x2e47('0x25')]=qs[_0x2e47('0x25')](_0x9e4103[_0x2e47('0x36')]['limit']);_0xc72e6d[_0x2e47('0x22')]=qs[_0x2e47('0x22')](_0x9e4103[_0x2e47('0x36')][_0x2e47('0x22')]);}_0xc72e6d[_0x2e47('0x3d')]=qs[_0x2e47('0x3e')](_0x9e4103['query']['sort']);_0xc72e6d[_0x2e47('0x3f')]=qs[_0x2e47('0x40')](_['pick'](_0x9e4103[_0x2e47('0x36')],_0x4144a5[_0x2e47('0x40')]),_0x81eaee);if(_0x9e4103[_0x2e47('0x36')][_0x2e47('0x41')]){_0xc72e6d[_0x2e47('0x3f')]=_['merge'](_0xc72e6d[_0x2e47('0x3f')],{'$or':_[_0x2e47('0x30')](_0x81eaee,function(_0x26db18){if(_0x26db18[_0x2e47('0x34')]!==_0x2e47('0x42')){var _0x3d2c99={};_0x3d2c99[_0x26db18['name']]={'$like':'%'+_0x9e4103[_0x2e47('0x36')][_0x2e47('0x41')]+'%'};return _0x3d2c99;}})});}_0xc72e6d=_[_0x2e47('0x43')]({},_0xc72e6d,_0x9e4103[_0x2e47('0x44')]);var _0x148b75={'where':_0xc72e6d['where']};return db[_0x2e47('0x31')][_0x2e47('0x24')](_0x148b75)[_0x2e47('0x2a')](function(_0x317cd2){_0x27c4cb[_0x2e47('0x24')]=_0x317cd2;if(_0x9e4103['query'][_0x2e47('0x45')]){_0xc72e6d[_0x2e47('0x46')]=[{'all':!![]}];}return db[_0x2e47('0x31')]['findAll'](_0xc72e6d);})[_0x2e47('0x2a')](function(_0x17398b){_0x27c4cb[_0x2e47('0x47')]=_0x17398b;return _0x27c4cb;})['then'](respondWithFilteredResult(_0x11d2aa,_0xc72e6d))['catch'](handleError(_0x11d2aa,null));};exports['show']=function(_0x3d1289,_0x156978){var _0x5e8795={'raw':![],'where':{'id':_0x3d1289[_0x2e47('0x48')]['id']}},_0x3a6133={};_0x3a6133[_0x2e47('0x35')]=_[_0x2e47('0x37')](db[_0x2e47('0x31')][_0x2e47('0x32')]);_0x3a6133[_0x2e47('0x36')]=_[_0x2e47('0x37')](_0x3d1289[_0x2e47('0x36')]);_0x3a6133[_0x2e47('0x40')]=_[_0x2e47('0x49')](_0x3a6133[_0x2e47('0x35')],_0x3a6133[_0x2e47('0x36')]);_0x5e8795[_0x2e47('0x38')]=_['intersection'](_0x3a6133[_0x2e47('0x35')],qs[_0x2e47('0x39')](_0x3d1289[_0x2e47('0x36')][_0x2e47('0x39')]));_0x5e8795[_0x2e47('0x38')]=_0x5e8795[_0x2e47('0x38')][_0x2e47('0x3a')]?_0x5e8795[_0x2e47('0x38')]:_0x3a6133['model'];if(_0x3d1289[_0x2e47('0x36')][_0x2e47('0x45')]){_0x5e8795['include']=[{'all':!![]}];}_0x5e8795=_[_0x2e47('0x43')]({},_0x5e8795,_0x3d1289[_0x2e47('0x44')]);return db[_0x2e47('0x31')][_0x2e47('0x4a')](_0x5e8795)[_0x2e47('0x2a')](handleEntityNotFound(_0x156978,null))['then'](respondWithResult(_0x156978,null))['catch'](handleError(_0x156978,null));};exports[_0x2e47('0x4b')]=function(_0x176af8,_0x51c60f){return db['ServicenowAccount'][_0x2e47('0x4b')](_0x176af8[_0x2e47('0x4c')],{})[_0x2e47('0x2a')](respondWithResult(_0x51c60f,0xc9))[_0x2e47('0x4d')](handleError(_0x51c60f,null));};exports[_0x2e47('0x4e')]=function(_0x23ecfd,_0x3c4101){if(_0x23ecfd['body']['id']){delete _0x23ecfd['body']['id'];}return db[_0x2e47('0x31')][_0x2e47('0x4a')]({'where':{'id':_0x23ecfd[_0x2e47('0x48')]['id']}})[_0x2e47('0x2a')](handleEntityNotFound(_0x3c4101,null))[_0x2e47('0x2a')](saveUpdates(_0x23ecfd['body'],null))[_0x2e47('0x2a')](respondWithResult(_0x3c4101,null))[_0x2e47('0x4d')](handleError(_0x3c4101,null));};exports[_0x2e47('0x2b')]=function(_0x368c04,_0x2aad68){return db[_0x2e47('0x31')][_0x2e47('0x4a')]({'where':{'id':_0x368c04[_0x2e47('0x48')]['id']}})[_0x2e47('0x2a')](handleEntityNotFound(_0x2aad68,null))['then'](removeEntity(_0x2aad68,null))['catch'](handleError(_0x2aad68,null));};exports[_0x2e47('0x4f')]=function(_0x19d018,_0x59a5a7,_0x60852e){var _0x1b8a1c={};var _0x393f2f={};var _0x2c9e09;var _0x2f3a14;return db['ServicenowAccount'][_0x2e47('0x50')]({'where':{'id':_0x19d018[_0x2e47('0x48')]['id']}})[_0x2e47('0x2a')](handleEntityNotFound(_0x59a5a7,null))[_0x2e47('0x2a')](function(_0x64a3fb){if(_0x64a3fb){_0x2c9e09=_0x64a3fb;_0x393f2f['model']=_[_0x2e47('0x37')](db[_0x2e47('0x51')][_0x2e47('0x32')]);_0x393f2f[_0x2e47('0x36')]=_[_0x2e47('0x37')](_0x19d018[_0x2e47('0x36')]);_0x393f2f['filters']=_[_0x2e47('0x49')](_0x393f2f[_0x2e47('0x35')],_0x393f2f[_0x2e47('0x36')]);_0x1b8a1c[_0x2e47('0x38')]=_[_0x2e47('0x49')](_0x393f2f[_0x2e47('0x35')],qs[_0x2e47('0x39')](_0x19d018[_0x2e47('0x36')][_0x2e47('0x39')]));_0x1b8a1c['attributes']=_0x1b8a1c[_0x2e47('0x38')]['length']?_0x1b8a1c[_0x2e47('0x38')]:_0x393f2f[_0x2e47('0x35')];_0x1b8a1c['order']=qs['sort'](_0x19d018[_0x2e47('0x36')][_0x2e47('0x3e')]);_0x1b8a1c[_0x2e47('0x3f')]=qs['filters'](_[_0x2e47('0x52')](_0x19d018[_0x2e47('0x36')],_0x393f2f['filters']));if(_0x19d018[_0x2e47('0x36')][_0x2e47('0x41')]){_0x1b8a1c['where']=_[_0x2e47('0x43')](_0x1b8a1c['where'],{'$or':_['map'](_0x1b8a1c[_0x2e47('0x38')],function(_0x3f513a){var _0x267faf={};_0x267faf[_0x3f513a]={'$like':'%'+_0x19d018[_0x2e47('0x36')][_0x2e47('0x41')]+'%'};return _0x267faf;})});}_0x1b8a1c=_[_0x2e47('0x43')]({},_0x1b8a1c,_0x19d018[_0x2e47('0x44')]);return _0x2c9e09['getConfigurations'](_0x1b8a1c);}})[_0x2e47('0x2a')](function(_0x5d1e19){if(_0x5d1e19){_0x2f3a14=_0x5d1e19[_0x2e47('0x3a')];if(!_0x19d018[_0x2e47('0x36')]['hasOwnProperty'](_0x2e47('0x3c'))){_0x1b8a1c[_0x2e47('0x25')]=qs[_0x2e47('0x25')](_0x19d018[_0x2e47('0x36')][_0x2e47('0x25')]);_0x1b8a1c[_0x2e47('0x22')]=qs[_0x2e47('0x22')](_0x19d018['query'][_0x2e47('0x22')]);}return _0x2c9e09['getConfigurations'](_0x1b8a1c);}})[_0x2e47('0x2a')](function(_0x26efa6){if(_0x26efa6){return _0x26efa6?{'count':_0x2f3a14,'rows':_0x26efa6}:null;}})[_0x2e47('0x2a')](respondWithResult(_0x59a5a7,null))[_0x2e47('0x4d')](handleError(_0x59a5a7,null));};exports[_0x2e47('0x53')]=function(_0x3db7fe,_0x45c7ce,_0x257264){if(_0x3db7fe[_0x2e47('0x4c')]['id']){delete _0x3db7fe['body']['id'];}return db[_0x2e47('0x31')][_0x2e47('0x50')]({'where':{'id':_0x3db7fe[_0x2e47('0x48')]['id']}})['then'](handleEntityNotFound(_0x45c7ce,null))['then'](function(_0x29fc08){if(_0x29fc08){_0x3db7fe[_0x2e47('0x4c')][_0x2e47('0x54')]=_0x29fc08['id'];_0x3db7fe[_0x2e47('0x4c')][_0x2e47('0x55')]=integrations[_0x2e47('0x56')](_0x3db7fe[_0x2e47('0x4c')][_0x2e47('0x57')],_0x3db7fe[_0x2e47('0x4c')][_0x2e47('0x34')]);_0x3db7fe['body'][_0x2e47('0x58')]=integrations[_0x2e47('0x59')](_0x3db7fe[_0x2e47('0x4c')]['channel'],_0x3db7fe['body'][_0x2e47('0x34')]);return db[_0x2e47('0x51')][_0x2e47('0x4b')](_0x3db7fe[_0x2e47('0x4c')],{'include':[{'model':db['ServicenowField'],'as':_0x2e47('0x55')},{'model':db['ServicenowField'],'as':_0x2e47('0x58')}]});}return null;})['then'](respondWithResult(_0x45c7ce,null))[_0x2e47('0x4d')](handleError(_0x45c7ce,null));};exports[_0x2e47('0x5a')]=function(_0x571280,_0x3eeb84,_0x4b15e1){var _0x16c9fa=[_0x2e47('0x5b'),_0x2e47('0x5c'),_0x2e47('0x5d'),_0x2e47('0x5e'),_0x2e47('0x5f'),_0x2e47('0x60'),'incident_state',_0x2e47('0x61'),_0x2e47('0x62')];var _0x4e66ba=['parent',_0x2e47('0x5b'),_0x2e47('0x63'),_0x2e47('0x64'),_0x2e47('0x65'),_0x2e47('0x66'),_0x2e47('0x67'),_0x2e47('0x5c'),'approval_history','number',_0x2e47('0x68'),_0x2e47('0x69'),_0x2e47('0x6a'),_0x2e47('0x6b'),_0x2e47('0x6c'),_0x2e47('0x6d'),_0x2e47('0x6e'),'sys_created_by','knowledge',_0x2e47('0x3d'),_0x2e47('0x6f'),_0x2e47('0x70'),'cmdb_ci',_0x2e47('0x71'),_0x2e47('0x72'),'active','work_notes_list',_0x2e47('0x73'),_0x2e47('0x74'),_0x2e47('0x75'),_0x2e47('0x76'),_0x2e47('0x77'),'expected_start',_0x2e47('0x78'),_0x2e47('0x79'),_0x2e47('0x7a'),_0x2e47('0x7b'),_0x2e47('0x7c'),_0x2e47('0x7d'),_0x2e47('0x7e'),_0x2e47('0x7f'),_0x2e47('0x5e'),_0x2e47('0x80'),_0x2e47('0x81'),'close_code',_0x2e47('0x82'),_0x2e47('0x83'),_0x2e47('0x84'),_0x2e47('0x85'),_0x2e47('0x86'),'additional_assignee_list',_0x2e47('0x87'),_0x2e47('0x88'),'notify',_0x2e47('0x89'),_0x2e47('0x8a'),'closed_by',_0x2e47('0x8b'),_0x2e47('0x8c'),_0x2e47('0x8d'),_0x2e47('0x8e'),'reopened_by',_0x2e47('0x8f'),_0x2e47('0x90'),_0x2e47('0x91'),_0x2e47('0x92'),_0x2e47('0x93'),_0x2e47('0x94'),_0x2e47('0x95'),_0x2e47('0x61'),_0x2e47('0x96'),_0x2e47('0x97'),_0x2e47('0x98'),_0x2e47('0x99'),_0x2e47('0x9a'),_0x2e47('0x9b'),'reopen_count',_0x2e47('0x9c'),'escalation',_0x2e47('0x9d'),_0x2e47('0x9e'),'location',_0x2e47('0x62')];var _0x2bc469='';var _0x127588='';var _0x39b68f=[];var _0x292f30='';var _0x58ebb5='';var _0x2b1c2c=[];var _0xb10409='';var _0x22917b='';var _0x3e8770={};var _0xf54e04='';return db['ServicenowAccount'][_0x2e47('0x50')]({'where':{'id':_0x571280[_0x2e47('0x48')]['id']},'attributes':['id',_0x2e47('0x9f'),'password',_0x2e47('0xa0'),_0x2e47('0xa1'),_0x2e47('0xa2')]})['then'](handleEntityNotFound(_0x3eeb84,null))[_0x2e47('0x2a')](function(_0x52545e){if(_0x52545e){_0xf54e04=_0x52545e[_0x2e47('0xa1')];var _0x359e12=_0xf54e04[_0x2e47('0xa3')](-0x1);if(_0x359e12==='/'){_0xf54e04=_0xf54e04[_0x2e47('0xa4')](0x0,_0xf54e04[_0x2e47('0xa5')](_0x359e12));}_0x22917b=util['format'](_0x2e47('0xa6'),_0xf54e04);_0xb10409=util['format']('%s/api/now/table/',_0xf54e04);_0x3e8770={'user':_0x52545e['username'],'pass':_0x52545e['password']};var _0x2b8cba={'method':_0x2e47('0xa7'),'uri':_0x22917b+'incident?sysparm_display_value=all','auth':_0x3e8770,'json':!![]};return rp(_0x2b8cba);}})[_0x2e47('0x2a')](function(_0x31e1cf){if(_0x31e1cf[_0x2e47('0xa8')][_0x2e47('0x3a')]>0x0){_0x2bc469=_0x31e1cf[_0x2e47('0xa8')];}console['log'](_0x2e47('0xa9'),_0x2bc469);_0x2b1c2c=[];_0x127588=Object['assign']([],_0x2bc469);_['remove'](_0x127588,function(_0xfb3bc5){return!_0x16c9fa[_0x2e47('0xaa')](_0xfb3bc5[_0x2e47('0xab')]);});_0x127588['forEach'](function(_0x23e507){var _0xe840f4=createFieldObject(_0xb10409,_0x3e8770,_0x23e507[_0x2e47('0xac')],_0x23e507[_0x2e47('0xab')],_0x23e507[_0x2e47('0xad')],![]);_0x2b1c2c[_0x2e47('0xae')](_0xe840f4);});return Promise[_0x2e47('0xaf')](_0x2b1c2c);})[_0x2e47('0x2a')](function(_0x209692){_0x39b68f=_0x209692;_0x292f30=Object[_0x2e47('0xb0')]([],_0x2bc469);console[_0x2e47('0xb1')]('TCL:\x20_object',_0x2bc469);_[_0x2e47('0xb2')](_0x292f30,function(_0x2d4f9e){return _0x4e66ba[_0x2e47('0xaa')](_0x2d4f9e[_0x2e47('0xab')]);});console[_0x2e47('0xb1')](_0x2e47('0xb3'),_0x292f30);_0x2b1c2c=[];_0x292f30[_0x2e47('0xb4')](function(_0x1480c1){var _0x515707=createFieldObject(_0xb10409,_0x3e8770,_0x1480c1[_0x2e47('0xac')],_0x1480c1[_0x2e47('0xab')],_0x1480c1['label'],!![]);_0x2b1c2c['push'](_0x515707);});return Promise[_0x2e47('0xaf')](_0x2b1c2c);})[_0x2e47('0x2a')](function(_0x17e766){_0x58ebb5=_0x17e766;var _0x1f8d35=_0x39b68f[_0x2e47('0xb5')](_0x58ebb5);return{'count':_0x1f8d35[_0x2e47('0x3a')],'rows':_0x1f8d35};})[_0x2e47('0x2a')](respondWithResult(_0x3eeb84,null))[_0x2e47('0x4d')](function(_0x239b1f){console[_0x2e47('0xb1')](_0x2e47('0xb6')+_0x239b1f);var _0x20c905=_0x571280['query'][_0x2e47('0xb7')]?0x1f4:_0x239b1f[_0x2e47('0xb8')]||0x1f4;logger['error'](_0x239b1f[_0x2e47('0x2d')]);delete _0x239b1f[_0x2e47('0xab')];if(_0x20c905===0x191){_0x20c905=0x190;}_0x3eeb84[_0x2e47('0x1f')](_0x20c905)[_0x2e47('0x2e')](_0x571280['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x239b1f['statusCode']}:_0x239b1f);});};function createFieldObject(_0xfb1e56,_0x14690c,_0x356304,_0x3d7a2e,_0x2a57cb,_0x32ec18){return new Promise(function(_0x5c9e4a,_0x681d93){var _0x48e68e={'id':_0x3d7a2e,'name':_0x2a57cb,'custom':_0x32ec18};if(_0x356304==='boolean'){_0x48e68e[_0x2e47('0x44')]=[{'name':_0x2e47('0xb9'),'value':_0x2e47('0xba')},{'name':_0x2e47('0xbb'),'value':'false'}];_0x5c9e4a(_0x48e68e);}else{var _0x5c5d2e={'method':_0x2e47('0xa7'),'uri':_0xfb1e56+'sys_choice?sysparm_query=name=incident^element='+_0x3d7a2e,'auth':_0x14690c,'json':!![]};return rp(_0x5c5d2e)['then'](function(_0x49c4f2){var _0x414300=[];if(_0x49c4f2[_0x2e47('0xa8')][_0x2e47('0x3a')]>0x0){_0x49c4f2[_0x2e47('0xa8')]['forEach'](function(_0x1381ae){if(_0x1381ae[_0x2e47('0xbc')]===_0x2e47('0xbd')){var _0x4b5ef1={'name':_0x1381ae[_0x2e47('0xad')],'value':_0x1381ae['value']};_0x414300[_0x2e47('0xae')](_0x4b5ef1);}});}_0x48e68e['options']=_0x414300;if(_0x48e68e[_0x2e47('0x44')][_0x2e47('0x3a')]>0x0){_0x5c9e4a(_0x48e68e);}else{if(_0x32ec18==![]){_0x5c9e4a();}else{_0x5c9e4a(_0x48e68e);}}});}});} \ No newline at end of file +var _0x3b75=['Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','index','ServicenowAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','body','destroy','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','made_sla','hold_reason','knowledge','close_code','incident_state','category','caused_by','child_incidents','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','delivery_plan','impact','active','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','subcategory','work_notes','short_description','correlation_display','additional_assignee_list','notify','sys_class_name','close_notes','closed_by','follow_up','parent_incident','urgency','problem_id','reassignment_count','activity_due','severity','comments','approval','comments_and_work_notes','due_date','reopen_count','sys_tags','location','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','username','password','result','incident\x20table\x20objects','remove','includes','forEach','internalType','label','push','all','assign','log','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','ServiceNow\x20error:\x20','test','statusCode','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','json','undefined','count','offset','status','set'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x3b75,0x148));var _0x53b7=function(_0x2ab3d9,_0x50e716){_0x2ab3d9=_0x2ab3d9-0x0;var _0x210a54=_0x3b75[_0x2ab3d9];return _0x210a54;};'use strict';var emlformat=require(_0x53b7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x53b7('0x1'));var jsonpatch=require(_0x53b7('0x2'));var rp=require(_0x53b7('0x3'));var moment=require(_0x53b7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x53b7('0x5'));var util=require(_0x53b7('0x6'));var path=require(_0x53b7('0x7'));var sox=require(_0x53b7('0x8'));var csv=require(_0x53b7('0x9'));var ejs=require(_0x53b7('0xa'));var fs=require('fs');var fs_extra=require(_0x53b7('0xb'));var _=require(_0x53b7('0xc'));var squel=require(_0x53b7('0xd'));var crypto=require(_0x53b7('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x53b7('0x9'));var querystring=require(_0x53b7('0xf'));var Papa=require(_0x53b7('0x10'));var Redis=require(_0x53b7('0x11'));var authService=require(_0x53b7('0x12'));var qs=require(_0x53b7('0x13'));var as=require(_0x53b7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x53b7('0x15'))('api');var utils=require(_0x53b7('0x16'));var config=require(_0x53b7('0x17'));var licenseUtil=require(_0x53b7('0x18'));var db=require(_0x53b7('0x19'))['db'];var integrations=require(_0x53b7('0x1a'));function respondWithStatusCode(_0x2c58be,_0x2b9d0b){_0x2b9d0b=_0x2b9d0b||0xcc;return function(_0x3e29a3){if(_0x3e29a3){return _0x2c58be['sendStatus'](_0x2b9d0b);}return _0x2c58be['status'](_0x2b9d0b)[_0x53b7('0x1b')]();};}function respondWithResult(_0x2f7474,_0x48290e){_0x48290e=_0x48290e||0xc8;return function(_0x5f417){if(_0x5f417){return _0x2f7474['status'](_0x48290e)[_0x53b7('0x1c')](_0x5f417);}};}function respondWithFilteredResult(_0xbaa219,_0x47dc83){return function(_0x4da592){if(_0x4da592){var _0x8e5f06=typeof _0x47dc83['offset']===_0x53b7('0x1d')&&typeof _0x47dc83['limit']==='undefined';var _0x10ecf4=_0x4da592[_0x53b7('0x1e')];var _0x1af633=_0x8e5f06?0x0:_0x47dc83[_0x53b7('0x1f')];var _0x5541c2=_0x8e5f06?_0x4da592[_0x53b7('0x1e')]:_0x47dc83['offset']+_0x47dc83['limit'];var _0x3641fb;if(_0x5541c2>=_0x10ecf4){_0x5541c2=_0x10ecf4;_0x3641fb=0xc8;}else{_0x3641fb=0xce;}_0xbaa219[_0x53b7('0x20')](_0x3641fb);return _0xbaa219[_0x53b7('0x21')](_0x53b7('0x22'),_0x1af633+'-'+_0x5541c2+'/'+_0x10ecf4)[_0x53b7('0x1c')](_0x4da592);}return null;};}function patchUpdates(_0x38c9b7){return function(_0xea4467){try{jsonpatch[_0x53b7('0x23')](_0xea4467,_0x38c9b7,!![]);}catch(_0x513ca3){return BPromise[_0x53b7('0x24')](_0x513ca3);}return _0xea4467['save']();};}function saveUpdates(_0x4f45d3,_0x224bd4){return function(_0x4773b0){if(_0x4773b0){return _0x4773b0[_0x53b7('0x25')](_0x4f45d3)[_0x53b7('0x26')](function(_0x4eb9a6){return _0x4eb9a6;});}return null;};}function removeEntity(_0x98587,_0x5986ad){return function(_0x2e4f16){if(_0x2e4f16){return _0x2e4f16['destroy']()['then'](function(){_0x98587[_0x53b7('0x20')](0xcc)[_0x53b7('0x1b')]();});}};}function handleEntityNotFound(_0x261ed3,_0x45f743){return function(_0x1d1d22){if(!_0x1d1d22){_0x261ed3[_0x53b7('0x27')](0x194);}return _0x1d1d22;};}function handleError(_0x5ec734,_0x4232ee){_0x4232ee=_0x4232ee||0x1f4;return function(_0x3db2eb){logger[_0x53b7('0x28')](_0x3db2eb[_0x53b7('0x29')]);if(_0x3db2eb[_0x53b7('0x2a')]){delete _0x3db2eb[_0x53b7('0x2a')];}_0x5ec734[_0x53b7('0x20')](_0x4232ee)[_0x53b7('0x2b')](_0x3db2eb);};}exports[_0x53b7('0x2c')]=function(_0x5731af,_0x102912){var _0x271642={},_0x14757b={},_0x2225fe={'count':0x0,'rows':[]};var _0x471a85=_['map'](db[_0x53b7('0x2d')][_0x53b7('0x2e')],function(_0x3f2f0b){return{'name':_0x3f2f0b['fieldName'],'type':_0x3f2f0b[_0x53b7('0x2f')]['key']};});_0x14757b[_0x53b7('0x30')]=_['map'](_0x471a85,'name');_0x14757b[_0x53b7('0x31')]=_[_0x53b7('0x32')](_0x5731af[_0x53b7('0x31')]);_0x14757b[_0x53b7('0x33')]=_[_0x53b7('0x34')](_0x14757b['model'],_0x14757b[_0x53b7('0x31')]);_0x271642[_0x53b7('0x35')]=_[_0x53b7('0x34')](_0x14757b[_0x53b7('0x30')],qs['fields'](_0x5731af['query'][_0x53b7('0x36')]));_0x271642[_0x53b7('0x35')]=_0x271642[_0x53b7('0x35')][_0x53b7('0x37')]?_0x271642[_0x53b7('0x35')]:_0x14757b['model'];if(!_0x5731af[_0x53b7('0x31')][_0x53b7('0x38')](_0x53b7('0x39'))){_0x271642[_0x53b7('0x3a')]=qs[_0x53b7('0x3a')](_0x5731af[_0x53b7('0x31')][_0x53b7('0x3a')]);_0x271642[_0x53b7('0x1f')]=qs[_0x53b7('0x1f')](_0x5731af[_0x53b7('0x31')][_0x53b7('0x1f')]);}_0x271642[_0x53b7('0x3b')]=qs[_0x53b7('0x3c')](_0x5731af[_0x53b7('0x31')][_0x53b7('0x3c')]);_0x271642[_0x53b7('0x3d')]=qs[_0x53b7('0x33')](_[_0x53b7('0x3e')](_0x5731af['query'],_0x14757b[_0x53b7('0x33')]),_0x471a85);if(_0x5731af[_0x53b7('0x31')][_0x53b7('0x3f')]){_0x271642['where']=_[_0x53b7('0x40')](_0x271642[_0x53b7('0x3d')],{'$or':_[_0x53b7('0x41')](_0x471a85,function(_0x5c6194){if(_0x5c6194[_0x53b7('0x2f')]!==_0x53b7('0x42')){var _0x2137c0={};_0x2137c0[_0x5c6194[_0x53b7('0x2a')]]={'$like':'%'+_0x5731af[_0x53b7('0x31')][_0x53b7('0x3f')]+'%'};return _0x2137c0;}})});}_0x271642=_[_0x53b7('0x40')]({},_0x271642,_0x5731af[_0x53b7('0x43')]);var _0xd4b137={'where':_0x271642[_0x53b7('0x3d')]};return db[_0x53b7('0x2d')][_0x53b7('0x1e')](_0xd4b137)[_0x53b7('0x26')](function(_0x327849){_0x2225fe[_0x53b7('0x1e')]=_0x327849;if(_0x5731af[_0x53b7('0x31')]['includeAll']){_0x271642[_0x53b7('0x44')]=[{'all':!![]}];}return db[_0x53b7('0x2d')]['findAll'](_0x271642);})['then'](function(_0x343f4c){_0x2225fe[_0x53b7('0x45')]=_0x343f4c;return _0x2225fe;})['then'](respondWithFilteredResult(_0x102912,_0x271642))[_0x53b7('0x46')](handleError(_0x102912,null));};exports[_0x53b7('0x47')]=function(_0x5101e3,_0x475046){var _0x2b9a77={'raw':![],'where':{'id':_0x5101e3[_0x53b7('0x48')]['id']}},_0x1d20d5={};_0x1d20d5[_0x53b7('0x30')]=_['keys'](db[_0x53b7('0x2d')]['rawAttributes']);_0x1d20d5[_0x53b7('0x31')]=_[_0x53b7('0x32')](_0x5101e3[_0x53b7('0x31')]);_0x1d20d5[_0x53b7('0x33')]=_[_0x53b7('0x34')](_0x1d20d5[_0x53b7('0x30')],_0x1d20d5['query']);_0x2b9a77[_0x53b7('0x35')]=_[_0x53b7('0x34')](_0x1d20d5[_0x53b7('0x30')],qs[_0x53b7('0x36')](_0x5101e3['query']['fields']));_0x2b9a77['attributes']=_0x2b9a77[_0x53b7('0x35')][_0x53b7('0x37')]?_0x2b9a77[_0x53b7('0x35')]:_0x1d20d5['model'];if(_0x5101e3[_0x53b7('0x31')][_0x53b7('0x49')]){_0x2b9a77[_0x53b7('0x44')]=[{'all':!![]}];}_0x2b9a77=_['merge']({},_0x2b9a77,_0x5101e3[_0x53b7('0x43')]);return db[_0x53b7('0x2d')][_0x53b7('0x4a')](_0x2b9a77)[_0x53b7('0x26')](handleEntityNotFound(_0x475046,null))[_0x53b7('0x26')](respondWithResult(_0x475046,null))[_0x53b7('0x46')](handleError(_0x475046,null));};exports[_0x53b7('0x4b')]=function(_0x8757f2,_0x53e20c){return db[_0x53b7('0x2d')][_0x53b7('0x4b')](_0x8757f2[_0x53b7('0x4c')],{})[_0x53b7('0x26')](respondWithResult(_0x53e20c,0xc9))[_0x53b7('0x46')](handleError(_0x53e20c,null));};exports['update']=function(_0x1a39d4,_0x319260){if(_0x1a39d4[_0x53b7('0x4c')]['id']){delete _0x1a39d4['body']['id'];}return db['ServicenowAccount']['find']({'where':{'id':_0x1a39d4[_0x53b7('0x48')]['id']}})[_0x53b7('0x26')](handleEntityNotFound(_0x319260,null))['then'](saveUpdates(_0x1a39d4[_0x53b7('0x4c')],null))[_0x53b7('0x26')](respondWithResult(_0x319260,null))['catch'](handleError(_0x319260,null));};exports[_0x53b7('0x4d')]=function(_0x379f5b,_0x4f2db5){return db[_0x53b7('0x2d')][_0x53b7('0x4a')]({'where':{'id':_0x379f5b[_0x53b7('0x48')]['id']}})[_0x53b7('0x26')](handleEntityNotFound(_0x4f2db5,null))[_0x53b7('0x26')](removeEntity(_0x4f2db5,null))[_0x53b7('0x46')](handleError(_0x4f2db5,null));};exports[_0x53b7('0x4e')]=function(_0x616e3c,_0x4c31d1,_0x1883a0){var _0x4a4cdd={};var _0x4fbf75={};var _0x2c286c;var _0x32a342;return db[_0x53b7('0x2d')][_0x53b7('0x4f')]({'where':{'id':_0x616e3c[_0x53b7('0x48')]['id']}})[_0x53b7('0x26')](handleEntityNotFound(_0x4c31d1,null))[_0x53b7('0x26')](function(_0x2542e1){if(_0x2542e1){_0x2c286c=_0x2542e1;_0x4fbf75['model']=_[_0x53b7('0x32')](db[_0x53b7('0x50')][_0x53b7('0x2e')]);_0x4fbf75[_0x53b7('0x31')]=_[_0x53b7('0x32')](_0x616e3c['query']);_0x4fbf75['filters']=_[_0x53b7('0x34')](_0x4fbf75['model'],_0x4fbf75[_0x53b7('0x31')]);_0x4a4cdd[_0x53b7('0x35')]=_[_0x53b7('0x34')](_0x4fbf75[_0x53b7('0x30')],qs[_0x53b7('0x36')](_0x616e3c[_0x53b7('0x31')]['fields']));_0x4a4cdd['attributes']=_0x4a4cdd[_0x53b7('0x35')][_0x53b7('0x37')]?_0x4a4cdd['attributes']:_0x4fbf75[_0x53b7('0x30')];_0x4a4cdd[_0x53b7('0x3b')]=qs[_0x53b7('0x3c')](_0x616e3c[_0x53b7('0x31')][_0x53b7('0x3c')]);_0x4a4cdd[_0x53b7('0x3d')]=qs['filters'](_[_0x53b7('0x3e')](_0x616e3c[_0x53b7('0x31')],_0x4fbf75[_0x53b7('0x33')]));if(_0x616e3c['query'][_0x53b7('0x3f')]){_0x4a4cdd[_0x53b7('0x3d')]=_[_0x53b7('0x40')](_0x4a4cdd[_0x53b7('0x3d')],{'$or':_[_0x53b7('0x41')](_0x4a4cdd[_0x53b7('0x35')],function(_0x51356f){var _0x5141dc={};_0x5141dc[_0x51356f]={'$like':'%'+_0x616e3c[_0x53b7('0x31')][_0x53b7('0x3f')]+'%'};return _0x5141dc;})});}_0x4a4cdd=_['merge']({},_0x4a4cdd,_0x616e3c[_0x53b7('0x43')]);return _0x2c286c[_0x53b7('0x4e')](_0x4a4cdd);}})[_0x53b7('0x26')](function(_0x3d8597){if(_0x3d8597){_0x32a342=_0x3d8597[_0x53b7('0x37')];if(!_0x616e3c[_0x53b7('0x31')][_0x53b7('0x38')](_0x53b7('0x39'))){_0x4a4cdd[_0x53b7('0x3a')]=qs[_0x53b7('0x3a')](_0x616e3c[_0x53b7('0x31')][_0x53b7('0x3a')]);_0x4a4cdd[_0x53b7('0x1f')]=qs[_0x53b7('0x1f')](_0x616e3c[_0x53b7('0x31')][_0x53b7('0x1f')]);}return _0x2c286c[_0x53b7('0x4e')](_0x4a4cdd);}})[_0x53b7('0x26')](function(_0x5a12aa){if(_0x5a12aa){return _0x5a12aa?{'count':_0x32a342,'rows':_0x5a12aa}:null;}})[_0x53b7('0x26')](respondWithResult(_0x4c31d1,null))[_0x53b7('0x46')](handleError(_0x4c31d1,null));};exports[_0x53b7('0x51')]=function(_0x3e2864,_0x456570,_0x2f6adb){if(_0x3e2864['body']['id']){delete _0x3e2864[_0x53b7('0x4c')]['id'];}return db[_0x53b7('0x2d')][_0x53b7('0x4f')]({'where':{'id':_0x3e2864['params']['id']}})[_0x53b7('0x26')](handleEntityNotFound(_0x456570,null))['then'](function(_0x9aedc1){if(_0x9aedc1){_0x3e2864['body'][_0x53b7('0x52')]=_0x9aedc1['id'];_0x3e2864[_0x53b7('0x4c')][_0x53b7('0x53')]=integrations[_0x53b7('0x54')](_0x3e2864['body'][_0x53b7('0x55')],_0x3e2864[_0x53b7('0x4c')]['type']);_0x3e2864[_0x53b7('0x4c')][_0x53b7('0x56')]=integrations[_0x53b7('0x57')](_0x3e2864[_0x53b7('0x4c')][_0x53b7('0x55')],_0x3e2864[_0x53b7('0x4c')][_0x53b7('0x2f')]);return db['ServicenowConfiguration'][_0x53b7('0x4b')](_0x3e2864[_0x53b7('0x4c')],{'include':[{'model':db['ServicenowField'],'as':_0x53b7('0x53')},{'model':db['ServicenowField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x456570,null))['catch'](handleError(_0x456570,null));};exports[_0x53b7('0x58')]=function(_0x45ac78,_0x41bbca,_0x27c43b){var _0x5e8d55=[_0x53b7('0x59'),_0x53b7('0x5a'),_0x53b7('0x5b'),'subcategory',_0x53b7('0x5c'),'notify',_0x53b7('0x5d'),'severity',_0x53b7('0x5e')];var _0x218b02=['parent',_0x53b7('0x59'),_0x53b7('0x5f'),'watch_list','upon_reject','sys_updated_on',_0x53b7('0x60'),'hold_reason',_0x53b7('0x61'),_0x53b7('0x62'),_0x53b7('0x63'),'sys_updated_by',_0x53b7('0x64'),_0x53b7('0x65'),_0x53b7('0x66'),_0x53b7('0x67'),_0x53b7('0x68'),_0x53b7('0x69'),_0x53b7('0x5b'),_0x53b7('0x3b'),_0x53b7('0x6a'),_0x53b7('0x6b'),'cmdb_ci',_0x53b7('0x6c'),_0x53b7('0x6d'),_0x53b7('0x6e'),'work_notes_list',_0x53b7('0x6f'),_0x53b7('0x70'),_0x53b7('0x71'),_0x53b7('0x72'),_0x53b7('0x73'),_0x53b7('0x74'),_0x53b7('0x75'),'business_duration',_0x53b7('0x76'),_0x53b7('0x77'),_0x53b7('0x78'),_0x53b7('0x79'),_0x53b7('0x7a'),_0x53b7('0x7b'),_0x53b7('0x7c'),_0x53b7('0x7d'),_0x53b7('0x7e'),_0x53b7('0x5c'),_0x53b7('0x7f'),'delivery_task','work_start','assignment_group','business_stc',_0x53b7('0x80'),'description','calendar_duration',_0x53b7('0x81'),_0x53b7('0x82'),_0x53b7('0x83'),_0x53b7('0x84'),_0x53b7('0x85'),_0x53b7('0x86'),'sys_id','contact_type','reopened_by','incident_state',_0x53b7('0x87'),_0x53b7('0x88'),'company',_0x53b7('0x89'),_0x53b7('0x8a'),'assigned_to',_0x53b7('0x8b'),_0x53b7('0x8c'),'sla_due',_0x53b7('0x8d'),_0x53b7('0x8e'),_0x53b7('0x8f'),'sys_mod_count',_0x53b7('0x90'),_0x53b7('0x91'),'escalation','upon_approval','correlation_id',_0x53b7('0x92'),_0x53b7('0x5e')];var _0x2aaa10='';var _0x24b374='';var _0x762d98=[];var _0x4bb672='';var _0x24168a='';var _0x320be1=[];var _0x446191='';var _0xa250d2='';var _0x1f24ad={};var _0x32ded9='';return db[_0x53b7('0x2d')][_0x53b7('0x4f')]({'where':{'id':_0x45ac78[_0x53b7('0x48')]['id']},'attributes':['id','username','password',_0x53b7('0x93'),_0x53b7('0x94'),_0x53b7('0x95')]})[_0x53b7('0x26')](handleEntityNotFound(_0x41bbca,null))[_0x53b7('0x26')](function(_0x4a5ba1){if(_0x4a5ba1){_0x32ded9=_0x4a5ba1[_0x53b7('0x94')];var _0x415f06=_0x32ded9[_0x53b7('0x96')](-0x1);if(_0x415f06==='/'){_0x32ded9=_0x32ded9[_0x53b7('0x97')](0x0,_0x32ded9[_0x53b7('0x98')](_0x415f06));}_0xa250d2=util[_0x53b7('0x99')](_0x53b7('0x9a'),_0x32ded9);_0x446191=util[_0x53b7('0x99')](_0x53b7('0x9b'),_0x32ded9);_0x1f24ad={'user':_0x4a5ba1[_0x53b7('0x9c')],'pass':_0x4a5ba1[_0x53b7('0x9d')]};var _0x48dc1d={'method':'GET','uri':_0xa250d2+'incident?sysparm_display_value=all','auth':_0x1f24ad,'json':!![]};return rp(_0x48dc1d);}})['then'](function(_0x5112e6){if(_0x5112e6['result']['length']>0x0){_0x2aaa10=_0x5112e6[_0x53b7('0x9e')];}console['log'](_0x53b7('0x9f'),_0x2aaa10);_0x320be1=[];_0x24b374=Object['assign']([],_0x2aaa10);_[_0x53b7('0xa0')](_0x24b374,function(_0xe9df7c){return!_0x5e8d55[_0x53b7('0xa1')](_0xe9df7c[_0x53b7('0x2a')]);});_0x24b374[_0x53b7('0xa2')](function(_0x1f78d4){var _0x6d5668=createFieldObject(_0x446191,_0x1f24ad,_0x1f78d4[_0x53b7('0xa3')],_0x1f78d4[_0x53b7('0x2a')],_0x1f78d4[_0x53b7('0xa4')],![]);_0x320be1[_0x53b7('0xa5')](_0x6d5668);});return Promise[_0x53b7('0xa6')](_0x320be1);})['then'](function(_0x1f4f78){_0x762d98=_0x1f4f78;_0x4bb672=Object[_0x53b7('0xa7')]([],_0x2aaa10);console[_0x53b7('0xa8')](_0x53b7('0xa9'),_0x2aaa10);_[_0x53b7('0xa0')](_0x4bb672,function(_0x17c493){return _0x218b02[_0x53b7('0xa1')](_0x17c493[_0x53b7('0x2a')]);});console[_0x53b7('0xa8')](_0x53b7('0xaa'),_0x4bb672);_0x320be1=[];_0x4bb672[_0x53b7('0xa2')](function(_0x248723){var _0x33e0c1=createFieldObject(_0x446191,_0x1f24ad,_0x248723[_0x53b7('0xa3')],_0x248723['name'],_0x248723[_0x53b7('0xa4')],!![]);_0x320be1[_0x53b7('0xa5')](_0x33e0c1);});return Promise[_0x53b7('0xa6')](_0x320be1);})[_0x53b7('0x26')](function(_0x592eac){_0x24168a=_0x592eac;var _0x243695=_0x762d98['concat'](_0x24168a);return{'count':_0x243695[_0x53b7('0x37')],'rows':_0x243695};})[_0x53b7('0x26')](respondWithResult(_0x41bbca,null))[_0x53b7('0x46')](function(_0x5a3c6e){console[_0x53b7('0xa8')](_0x53b7('0xab')+_0x5a3c6e);var _0x42adf9=_0x45ac78[_0x53b7('0x31')]['test']?0x1f4:_0x5a3c6e['statusCode']||0x1f4;logger['error'](_0x5a3c6e['stack']);delete _0x5a3c6e[_0x53b7('0x2a')];if(_0x42adf9===0x191){_0x42adf9=0x190;}_0x41bbca[_0x53b7('0x20')](_0x42adf9)[_0x53b7('0x2b')](_0x45ac78['query'][_0x53b7('0xac')]?{'message':'Wrong\x20credentials','statusCode':_0x5a3c6e[_0x53b7('0xad')]}:_0x5a3c6e);});};function createFieldObject(_0x59e16e,_0x11754f,_0x2e7b17,_0x5bc2b8,_0x4a03c4,_0x1b0b0e){return new Promise(function(_0x1e959c,_0x82674){var _0x3e2c4a={'id':_0x5bc2b8,'name':_0x4a03c4,'custom':_0x1b0b0e};if(_0x2e7b17===_0x53b7('0xae')){_0x3e2c4a[_0x53b7('0x43')]=[{'name':_0x53b7('0xaf'),'value':_0x53b7('0xb0')},{'name':_0x53b7('0xb1'),'value':_0x53b7('0xb2')}];_0x1e959c(_0x3e2c4a);}else{var _0x36cbe2={'method':'GET','uri':_0x59e16e+_0x53b7('0xb3')+_0x5bc2b8,'auth':_0x11754f,'json':!![]};return rp(_0x36cbe2)[_0x53b7('0x26')](function(_0x2e076c){var _0x17c37c=[];if(_0x2e076c[_0x53b7('0x9e')][_0x53b7('0x37')]>0x0){_0x2e076c['result'][_0x53b7('0xa2')](function(_0x3b7e10){if(_0x3b7e10[_0x53b7('0xb4')]===_0x53b7('0xb2')){var _0x769b0c={'name':_0x3b7e10[_0x53b7('0xa4')],'value':_0x3b7e10['value']};_0x17c37c[_0x53b7('0xa5')](_0x769b0c);}});}_0x3e2c4a[_0x53b7('0x43')]=_0x17c37c;if(_0x3e2c4a[_0x53b7('0x43')][_0x53b7('0x37')]>0x0){_0x1e959c(_0x3e2c4a);}else{if(_0x1b0b0e==![]){_0x1e959c();}else{_0x1e959c(_0x3e2c4a);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 97df628..1b8f795 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(_0x374293,_0x57d310){var _0xf72f1=function(_0x5ca0f7){while(--_0x5ca0f7){_0x374293['push'](_0x374293['shift']());}};_0xf72f1(++_0x57d310);}(_0x46ed,0x168));var _0xd46e=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x46ed[_0x199572];return _0x13cfa3;};'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 _0x3f8a=['exports','define','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x36e69b,_0x28c20a){_0x36e69b=_0x36e69b-0x0;var _0x356b37=_0x3f8a[_0x36e69b];return _0x356b37;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var logger=require(_0xa3f8('0x2'))(_0xa3f8('0x3'));var moment=require('moment');var BPromise=require(_0xa3f8('0x4'));var rp=require(_0xa3f8('0x5'));var fs=require('fs');var path=require(_0xa3f8('0x6'));var rimraf=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var attributes=require(_0xa3f8('0x9'));var integrations=require(_0xa3f8('0xa'));module[_0xa3f8('0xb')]=function(_0x1f160a,_0xf895d9){return _0x1f160a[_0xa3f8('0xc')](_0xa3f8('0xd'),attributes,{'tableName':_0xa3f8('0xe'),'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 a17bdda..b78525d 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 _0xe35a=['http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetServicenowAccount','ServicenowAccount','options','where','attributes','map','include','model','find','raw','ShowServicenowAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x698d88,_0x483ad0){var _0x2a4463=function(_0x56fc33){while(--_0x56fc33){_0x698d88['push'](_0x698d88['shift']());}};_0x2a4463(++_0x483ad0);}(_0xe35a,0xf6));var _0xae35=function(_0x2377db,_0x14ec14){_0x2377db=_0x2377db-0x0;var _0x1c6ea0=_0xe35a[_0x2377db];return _0x1c6ea0;};'use strict';var _=require(_0xae35('0x0'));var util=require(_0xae35('0x1'));var moment=require(_0xae35('0x2'));var BPromise=require(_0xae35('0x3'));var rs=require(_0xae35('0x4'));var fs=require('fs');var Redis=require(_0xae35('0x5'));var db=require(_0xae35('0x6'))['db'];var utils=require(_0xae35('0x7'));var logger=require(_0xae35('0x8'))(_0xae35('0x9'));var config=require(_0xae35('0xa'));var jayson=require(_0xae35('0xb'));var client=jayson[_0xae35('0xc')][_0xae35('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x47b3c3,_0x359cfe,_0x4083ff){return new BPromise(function(_0x282aa5,_0x43c2ae){return client[_0xae35('0xe')](_0x47b3c3,_0x4083ff)[_0xae35('0xf')](function(_0x38aa44){logger[_0xae35('0x10')](_0xae35('0x11'),_0x359cfe,_0xae35('0x12'));logger[_0xae35('0x13')](_0xae35('0x14'),_0x359cfe,'request\x20sent',JSON[_0xae35('0x15')](_0x38aa44));if(_0x38aa44[_0xae35('0x16')]){if(_0x38aa44[_0xae35('0x16')]['code']===0x1f4){logger['error'](_0xae35('0x11'),_0x359cfe,_0x38aa44[_0xae35('0x16')][_0xae35('0x17')]);return _0x43c2ae(_0x38aa44[_0xae35('0x16')][_0xae35('0x17')]);}logger[_0xae35('0x16')](_0xae35('0x11'),_0x359cfe,_0x38aa44[_0xae35('0x16')][_0xae35('0x17')]);return _0x282aa5(_0x38aa44[_0xae35('0x16')][_0xae35('0x17')]);}else{logger[_0xae35('0x10')](_0xae35('0x11'),_0x359cfe,'request\x20sent');_0x282aa5(_0x38aa44[_0xae35('0x18')][_0xae35('0x17')]);}})[_0xae35('0x19')](function(_0x5ae4ce){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x359cfe,_0x5ae4ce);_0x43c2ae(_0x5ae4ce);});});}exports[_0xae35('0x1a')]=function(_0x4974cd){var _0x15520c=this;return new Promise(function(_0x49ad0b,_0x53c7e7){return db[_0xae35('0x1b')]['findAll']({'raw':_0x4974cd[_0xae35('0x1c')]?_0x4974cd[_0xae35('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4974cd[_0xae35('0x1c')]?_0x4974cd[_0xae35('0x1c')][_0xae35('0x1d')]||null:null,'attributes':_0x4974cd[_0xae35('0x1c')]?_0x4974cd[_0xae35('0x1c')][_0xae35('0x1e')]||null:null,'limit':_0x4974cd[_0xae35('0x1c')]?_0x4974cd[_0xae35('0x1c')]['limit']||null:null,'include':_0x4974cd['options']?_0x4974cd['options']['include']?_[_0xae35('0x1f')](_0x4974cd[_0xae35('0x1c')][_0xae35('0x20')],function(_0x4acac2){return{'model':db[_0x4acac2[_0xae35('0x21')]],'as':_0x4acac2['as'],'attributes':_0x4acac2[_0xae35('0x1e')],'include':_0x4acac2['include']?_[_0xae35('0x1f')](_0x4acac2[_0xae35('0x20')],function(_0x13f43f){return{'model':db[_0x13f43f[_0xae35('0x21')]],'as':_0x13f43f['as'],'attributes':_0x13f43f['attributes'],'include':_0x13f43f['include']?_[_0xae35('0x1f')](_0x13f43f[_0xae35('0x20')],function(_0xe42e){return{'model':db[_0xe42e[_0xae35('0x21')]],'as':_0xe42e['as'],'attributes':_0xe42e[_0xae35('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f5522){logger['info']('GetServicenowAccount',_0x4974cd);logger[_0xae35('0x13')](_0xae35('0x1a'),_0x4974cd,JSON['stringify'](_0x2f5522));_0x49ad0b(_0x2f5522);})[_0xae35('0x19')](function(_0xd8e9ab){logger[_0xae35('0x16')](_0xae35('0x1a'),_0xd8e9ab['message'],_0x4974cd);_0x53c7e7(_0x15520c[_0xae35('0x16')](0x1f4,_0xd8e9ab[_0xae35('0x17')]));});});};exports['ShowServicenowAccount']=function(_0x21e382){var _0x23397a=this;return new Promise(function(_0x41b432,_0x4a639d){return db[_0xae35('0x1b')][_0xae35('0x22')]({'raw':_0x21e382['options']?_0x21e382[_0xae35('0x1c')][_0xae35('0x23')]===undefined?!![]:![]:!![],'where':_0x21e382['options']?_0x21e382[_0xae35('0x1c')]['where']||null:null,'attributes':_0x21e382[_0xae35('0x1c')]?_0x21e382[_0xae35('0x1c')][_0xae35('0x1e')]||null:null,'include':_0x21e382[_0xae35('0x1c')]?_0x21e382['options']['include']?_[_0xae35('0x1f')](_0x21e382['options'][_0xae35('0x20')],function(_0x24a908){return{'model':db[_0x24a908[_0xae35('0x21')]],'as':_0x24a908['as'],'attributes':_0x24a908[_0xae35('0x1e')],'include':_0x24a908['include']?_[_0xae35('0x1f')](_0x24a908[_0xae35('0x20')],function(_0x587a93){return{'model':db[_0x587a93[_0xae35('0x21')]],'as':_0x587a93['as'],'attributes':_0x587a93['attributes'],'include':_0x587a93[_0xae35('0x20')]?_[_0xae35('0x1f')](_0x587a93[_0xae35('0x20')],function(_0x504738){return{'model':db[_0x504738[_0xae35('0x21')]],'as':_0x504738['as'],'attributes':_0x504738[_0xae35('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xae35('0xf')](function(_0x5dc65d){logger[_0xae35('0x10')]('ShowServicenowAccount',_0x21e382);logger['debug'](_0xae35('0x24'),_0x21e382,JSON[_0xae35('0x15')](_0x5dc65d));_0x41b432(_0x5dc65d);})[_0xae35('0x19')](function(_0x49cff5){logger[_0xae35('0x16')](_0xae35('0x24'),_0x49cff5[_0xae35('0x17')],_0x21e382);_0x4a639d(_0x23397a[_0xae35('0x16')](0x1f4,_0x49cff5[_0xae35('0x17')]));});});}; \ No newline at end of file +var _0xeab2=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetServicenowAccount','ServicenowAccount','options','raw','where','limit','map','attributes','include','model','debug','ShowServicenowAccount','find','lodash','util','moment','bluebird','randomstring'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xeab2,0x11b));var _0x2eab=function(_0x3f4891,_0x4e6f62){_0x3f4891=_0x3f4891-0x0;var _0x54f2d8=_0xeab2[_0x3f4891];return _0x54f2d8;};'use strict';var _=require(_0x2eab('0x0'));var util=require(_0x2eab('0x1'));var moment=require(_0x2eab('0x2'));var BPromise=require(_0x2eab('0x3'));var rs=require(_0x2eab('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2eab('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2eab('0x6'))(_0x2eab('0x7'));var config=require(_0x2eab('0x8'));var jayson=require(_0x2eab('0x9'));var client=jayson[_0x2eab('0xa')][_0x2eab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf4c8e8,_0x14d51b,_0x3da167){return new BPromise(function(_0x58d273,_0x38882c){return client[_0x2eab('0xc')](_0xf4c8e8,_0x3da167)[_0x2eab('0xd')](function(_0xe36b78){logger[_0x2eab('0xe')](_0x2eab('0xf'),_0x14d51b,_0x2eab('0x10'));logger['debug'](_0x2eab('0x11'),_0x14d51b,'request\x20sent',JSON[_0x2eab('0x12')](_0xe36b78));if(_0xe36b78['error']){if(_0xe36b78[_0x2eab('0x13')][_0x2eab('0x14')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x14d51b,_0xe36b78[_0x2eab('0x13')][_0x2eab('0x15')]);return _0x38882c(_0xe36b78[_0x2eab('0x13')][_0x2eab('0x15')]);}logger[_0x2eab('0x13')](_0x2eab('0xf'),_0x14d51b,_0xe36b78[_0x2eab('0x13')][_0x2eab('0x15')]);return _0x58d273(_0xe36b78[_0x2eab('0x13')][_0x2eab('0x15')]);}else{logger[_0x2eab('0xe')](_0x2eab('0xf'),_0x14d51b,_0x2eab('0x10'));_0x58d273(_0xe36b78['result']['message']);}})[_0x2eab('0x16')](function(_0x22fa51){logger[_0x2eab('0x13')](_0x2eab('0xf'),_0x14d51b,_0x22fa51);_0x38882c(_0x22fa51);});});}exports[_0x2eab('0x17')]=function(_0x336b62){var _0xb56a8c=this;return new Promise(function(_0xd18c0e,_0x36e680){return db[_0x2eab('0x18')]['findAll']({'raw':_0x336b62[_0x2eab('0x19')]?_0x336b62[_0x2eab('0x19')][_0x2eab('0x1a')]===undefined?!![]:![]:!![],'where':_0x336b62[_0x2eab('0x19')]?_0x336b62[_0x2eab('0x19')][_0x2eab('0x1b')]||null:null,'attributes':_0x336b62[_0x2eab('0x19')]?_0x336b62[_0x2eab('0x19')]['attributes']||null:null,'limit':_0x336b62[_0x2eab('0x19')]?_0x336b62[_0x2eab('0x19')][_0x2eab('0x1c')]||null:null,'include':_0x336b62['options']?_0x336b62[_0x2eab('0x19')]['include']?_[_0x2eab('0x1d')](_0x336b62['options']['include'],function(_0x3638ec){return{'model':db[_0x3638ec['model']],'as':_0x3638ec['as'],'attributes':_0x3638ec[_0x2eab('0x1e')],'include':_0x3638ec[_0x2eab('0x1f')]?_[_0x2eab('0x1d')](_0x3638ec['include'],function(_0x146b96){return{'model':db[_0x146b96[_0x2eab('0x20')]],'as':_0x146b96['as'],'attributes':_0x146b96[_0x2eab('0x1e')],'include':_0x146b96['include']?_['map'](_0x146b96[_0x2eab('0x1f')],function(_0x1f4f84){return{'model':db[_0x1f4f84[_0x2eab('0x20')]],'as':_0x1f4f84['as'],'attributes':_0x1f4f84[_0x2eab('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2eab('0xd')](function(_0xa99cdd){logger['info']('GetServicenowAccount',_0x336b62);logger[_0x2eab('0x21')](_0x2eab('0x17'),_0x336b62,JSON['stringify'](_0xa99cdd));_0xd18c0e(_0xa99cdd);})['catch'](function(_0x82f1fc){logger[_0x2eab('0x13')](_0x2eab('0x17'),_0x82f1fc[_0x2eab('0x15')],_0x336b62);_0x36e680(_0xb56a8c['error'](0x1f4,_0x82f1fc['message']));});});};exports[_0x2eab('0x22')]=function(_0x484860){var _0x2bb0df=this;return new Promise(function(_0x42d361,_0x1e718f){return db['ServicenowAccount'][_0x2eab('0x23')]({'raw':_0x484860[_0x2eab('0x19')]?_0x484860[_0x2eab('0x19')][_0x2eab('0x1a')]===undefined?!![]:![]:!![],'where':_0x484860[_0x2eab('0x19')]?_0x484860['options']['where']||null:null,'attributes':_0x484860[_0x2eab('0x19')]?_0x484860[_0x2eab('0x19')][_0x2eab('0x1e')]||null:null,'include':_0x484860[_0x2eab('0x19')]?_0x484860[_0x2eab('0x19')][_0x2eab('0x1f')]?_[_0x2eab('0x1d')](_0x484860[_0x2eab('0x19')]['include'],function(_0x2b72d2){return{'model':db[_0x2b72d2['model']],'as':_0x2b72d2['as'],'attributes':_0x2b72d2[_0x2eab('0x1e')],'include':_0x2b72d2[_0x2eab('0x1f')]?_[_0x2eab('0x1d')](_0x2b72d2[_0x2eab('0x1f')],function(_0x5b3eb1){return{'model':db[_0x5b3eb1[_0x2eab('0x20')]],'as':_0x5b3eb1['as'],'attributes':_0x5b3eb1[_0x2eab('0x1e')],'include':_0x5b3eb1[_0x2eab('0x1f')]?_[_0x2eab('0x1d')](_0x5b3eb1[_0x2eab('0x1f')],function(_0xe62b25){return{'model':db[_0xe62b25[_0x2eab('0x20')]],'as':_0xe62b25['as'],'attributes':_0xe62b25['attributes']};}):[]};}):[]};}):[]:[]})[_0x2eab('0xd')](function(_0xd4be53){logger['info']('ShowServicenowAccount',_0x484860);logger[_0x2eab('0x21')](_0x2eab('0x22'),_0x484860,JSON['stringify'](_0xd4be53));_0x42d361(_0xd4be53);})[_0x2eab('0x16')](function(_0xb11e04){logger['error'](_0x2eab('0x22'),_0xb11e04[_0x2eab('0x15')],_0x484860);_0x1e718f(_0x2bb0df[_0x2eab('0x13')](0x1f4,_0xb11e04[_0x2eab('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 5be6a3f..e951ef2 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 _0x82de=['post','create','update','delete','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','get','/:id/descriptions','getDescriptions'];(function(_0x257a28,_0x2cd00d){var _0x13bccc=function(_0x32c46f){while(--_0x32c46f){_0x257a28['push'](_0x257a28['shift']());}};_0x13bccc(++_0x2cd00d);}(_0x82de,0xca));var _0xe82d=function(_0x109371,_0x441c8e){_0x109371=_0x109371-0x0;var _0x4fd858=_0x82de[_0x109371];return _0x4fd858;};'use strict';var multer=require(_0xe82d('0x0'));var util=require(_0xe82d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe82d('0x2'));var router=express[_0xe82d('0x3')]();var fs_extra=require(_0xe82d('0x4'));var auth=require(_0xe82d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe82d('0x6'));var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth[_0xe82d('0x7')](),controller[_0xe82d('0x8')]);router['get'](_0xe82d('0x9'),auth[_0xe82d('0x7')](),controller[_0xe82d('0xa')]);router['get'](_0xe82d('0xb'),auth[_0xe82d('0x7')](),controller[_0xe82d('0xc')]);router['get'](_0xe82d('0xd'),auth[_0xe82d('0x7')](),controller[_0xe82d('0xe')]);router[_0xe82d('0xf')](_0xe82d('0x10'),auth['isAuthenticated'](),controller[_0xe82d('0x11')]);router[_0xe82d('0x12')]('/',auth[_0xe82d('0x7')](),controller[_0xe82d('0x13')]);router['put'](_0xe82d('0x9'),auth[_0xe82d('0x7')](),controller[_0xe82d('0x14')]);router[_0xe82d('0x15')](_0xe82d('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe636=['/:id/fields','/:id/subjects','getDescriptions','post','create','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0x2ce6de,_0x2b637f){var _0x5b1bc4=function(_0x4403da){while(--_0x4403da){_0x2ce6de['push'](_0x2ce6de['shift']());}};_0x5b1bc4(++_0x2b637f);}(_0xe636,0x80));var _0x6e63=function(_0x35d8af,_0x14fd75){_0x35d8af=_0x35d8af-0x0;var _0x1d08b0=_0xe636[_0x35d8af];return _0x1d08b0;};'use strict';var multer=require(_0x6e63('0x0'));var util=require('util');var path=require(_0x6e63('0x1'));var timeout=require(_0x6e63('0x2'));var express=require(_0x6e63('0x3'));var router=express[_0x6e63('0x4')]();var fs_extra=require(_0x6e63('0x5'));var auth=require(_0x6e63('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6e63('0x7'));var controller=require('./intServicenowConfiguration.controller');router[_0x6e63('0x8')]('/',auth[_0x6e63('0x9')](),controller[_0x6e63('0xa')]);router[_0x6e63('0x8')]('/:id',auth[_0x6e63('0x9')](),controller[_0x6e63('0xb')]);router[_0x6e63('0x8')](_0x6e63('0xc'),auth[_0x6e63('0x9')](),controller['getFields']);router[_0x6e63('0x8')](_0x6e63('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x6e63('0x8')]('/:id/descriptions',auth[_0x6e63('0x9')](),controller[_0x6e63('0xe')]);router[_0x6e63('0xf')]('/',auth['isAuthenticated'](),controller[_0x6e63('0x10')]);router['put'](_0x6e63('0x11'),auth[_0x6e63('0x9')](),controller['update']);router['delete'](_0x6e63('0x11'),auth[_0x6e63('0x9')](),controller[_0x6e63('0x12')]);module[_0x6e63('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 12cffeb..5e2df44 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 _0x6661=['exports','STRING'];(function(_0x56b886,_0x1ff474){var _0x164baf=function(_0x575d09){while(--_0x575d09){_0x56b886['push'](_0x56b886['shift']());}};_0x164baf(++_0x1ff474);}(_0x6661,0x1e6));var _0x1666=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x6661[_0x4e9d3c];return _0x2d0825;};'use strict';var Sequelize=require('sequelize');module[_0x1666('0x0')]={'name':{'type':Sequelize[_0x1666('0x1')]},'description':{'type':Sequelize[_0x1666('0x1')]}}; \ No newline at end of file +var _0xc2f8=['STRING','exports'];(function(_0x3c8860,_0x5c6c47){var _0x4a3e12=function(_0x395b03){while(--_0x395b03){_0x3c8860['push'](_0x3c8860['shift']());}};_0x4a3e12(++_0x5c6c47);}(_0xc2f8,0xf3));var _0x8c2f=function(_0x141c44,_0x5a6aca){_0x141c44=_0x141c44-0x0;var _0x31cc77=_0xc2f8[_0x141c44];return _0x31cc77;};'use strict';var Sequelize=require('sequelize');module[_0x8c2f('0x0')]={'name':{'type':Sequelize[_0x8c2f('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 3ed95ab..dbeb221 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 _0x19b3=['model','query','keys','filters','intersection','attributes','fields','length','nolimit','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','show','find','catch','create','body','params','destroy','getFields','ServicenowField','sort','findOne','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','undefined','count','offset','limit','status','set','Content-Range','reject','save','update','then','end','error','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','key'];(function(_0x50fe6d,_0x44f712){var _0x2a6968=function(_0x223a12){while(--_0x223a12){_0x50fe6d['push'](_0x50fe6d['shift']());}};_0x2a6968(++_0x44f712);}(_0x19b3,0x11a));var _0x319b=function(_0x57014b,_0x360c0f){_0x57014b=_0x57014b-0x0;var _0x2b258a=_0x19b3[_0x57014b];return _0x2b258a;};'use strict';var emlformat=require(_0x319b('0x0'));var rimraf=require(_0x319b('0x1'));var zipdir=require(_0x319b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x319b('0x3'));var moment=require(_0x319b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x319b('0x5'));var path=require(_0x319b('0x6'));var sox=require(_0x319b('0x7'));var csv=require('to-csv');var ejs=require(_0x319b('0x8'));var fs=require('fs');var fs_extra=require(_0x319b('0x9'));var _=require(_0x319b('0xa'));var squel=require(_0x319b('0xb'));var crypto=require(_0x319b('0xc'));var jsforce=require(_0x319b('0xd'));var deskjs=require(_0x319b('0xe'));var toCsv=require(_0x319b('0xf'));var querystring=require(_0x319b('0x10'));var Papa=require(_0x319b('0x11'));var Redis=require(_0x319b('0x12'));var authService=require(_0x319b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x319b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x319b('0x15'))(_0x319b('0x16'));var utils=require(_0x319b('0x17'));var config=require(_0x319b('0x18'));var licenseUtil=require(_0x319b('0x19'));var db=require(_0x319b('0x1a'))['db'];function respondWithStatusCode(_0x59b674,_0x201c2f){_0x201c2f=_0x201c2f||0xcc;return function(_0x5979bc){if(_0x5979bc){return _0x59b674[_0x319b('0x1b')](_0x201c2f);}return _0x59b674['status'](_0x201c2f)['end']();};}function respondWithResult(_0x4fd42a,_0x31ee0e){_0x31ee0e=_0x31ee0e||0xc8;return function(_0x1a1a44){if(_0x1a1a44){return _0x4fd42a['status'](_0x31ee0e)[_0x319b('0x1c')](_0x1a1a44);}};}function respondWithFilteredResult(_0x54d601,_0xf748f7){return function(_0x2ab80d){if(_0x2ab80d){var _0xe866cd=typeof _0xf748f7['offset']===_0x319b('0x1d')&&typeof _0xf748f7['limit']===_0x319b('0x1d');var _0x3b199a=_0x2ab80d[_0x319b('0x1e')];var _0x902b72=_0xe866cd?0x0:_0xf748f7['offset'];var _0xc6b2ba=_0xe866cd?_0x2ab80d[_0x319b('0x1e')]:_0xf748f7[_0x319b('0x1f')]+_0xf748f7[_0x319b('0x20')];var _0x30082d;if(_0xc6b2ba>=_0x3b199a){_0xc6b2ba=_0x3b199a;_0x30082d=0xc8;}else{_0x30082d=0xce;}_0x54d601[_0x319b('0x21')](_0x30082d);return _0x54d601[_0x319b('0x22')](_0x319b('0x23'),_0x902b72+'-'+_0xc6b2ba+'/'+_0x3b199a)[_0x319b('0x1c')](_0x2ab80d);}return null;};}function patchUpdates(_0x277927){return function(_0x271f03){try{jsonpatch['apply'](_0x271f03,_0x277927,!![]);}catch(_0x44320c){return BPromise[_0x319b('0x24')](_0x44320c);}return _0x271f03[_0x319b('0x25')]();};}function saveUpdates(_0x5ee691,_0x4f166f){return function(_0x5f061e){if(_0x5f061e){return _0x5f061e[_0x319b('0x26')](_0x5ee691)[_0x319b('0x27')](function(_0x40556c){return _0x40556c;});}return null;};}function removeEntity(_0x507fcc,_0x50a19d){return function(_0x16b46c){if(_0x16b46c){return _0x16b46c['destroy']()['then'](function(){_0x507fcc[_0x319b('0x21')](0xcc)[_0x319b('0x28')]();});}};}function handleEntityNotFound(_0x30a287,_0x5cbdb6){return function(_0x4da7c2){if(!_0x4da7c2){_0x30a287['sendStatus'](0x194);}return _0x4da7c2;};}function handleError(_0x2f5cbb,_0x3ccffd){_0x3ccffd=_0x3ccffd||0x1f4;return function(_0xd43c64){logger[_0x319b('0x29')](_0xd43c64['stack']);if(_0xd43c64[_0x319b('0x2a')]){delete _0xd43c64[_0x319b('0x2a')];}_0x2f5cbb[_0x319b('0x21')](_0x3ccffd)[_0x319b('0x2b')](_0xd43c64);};}exports[_0x319b('0x2c')]=function(_0x217bca,_0x4033dd){var _0x3b9f38={},_0x2c1e11={},_0x4bb352={'count':0x0,'rows':[]};var _0x1d9b6b=_[_0x319b('0x2d')](db[_0x319b('0x2e')][_0x319b('0x2f')],function(_0x2d2258){return{'name':_0x2d2258[_0x319b('0x30')],'type':_0x2d2258['type'][_0x319b('0x31')]};});_0x2c1e11[_0x319b('0x32')]=_[_0x319b('0x2d')](_0x1d9b6b,_0x319b('0x2a'));_0x2c1e11[_0x319b('0x33')]=_[_0x319b('0x34')](_0x217bca['query']);_0x2c1e11[_0x319b('0x35')]=_[_0x319b('0x36')](_0x2c1e11[_0x319b('0x32')],_0x2c1e11[_0x319b('0x33')]);_0x3b9f38[_0x319b('0x37')]=_[_0x319b('0x36')](_0x2c1e11[_0x319b('0x32')],qs[_0x319b('0x38')](_0x217bca[_0x319b('0x33')][_0x319b('0x38')]));_0x3b9f38[_0x319b('0x37')]=_0x3b9f38[_0x319b('0x37')][_0x319b('0x39')]?_0x3b9f38[_0x319b('0x37')]:_0x2c1e11[_0x319b('0x32')];if(!_0x217bca[_0x319b('0x33')]['hasOwnProperty'](_0x319b('0x3a'))){_0x3b9f38[_0x319b('0x20')]=qs[_0x319b('0x20')](_0x217bca[_0x319b('0x33')]['limit']);_0x3b9f38[_0x319b('0x1f')]=qs[_0x319b('0x1f')](_0x217bca[_0x319b('0x33')][_0x319b('0x1f')]);}_0x3b9f38['order']=qs['sort'](_0x217bca[_0x319b('0x33')]['sort']);_0x3b9f38['where']=qs['filters'](_[_0x319b('0x3b')](_0x217bca[_0x319b('0x33')],_0x2c1e11[_0x319b('0x35')]),_0x1d9b6b);if(_0x217bca[_0x319b('0x33')][_0x319b('0x3c')]){_0x3b9f38[_0x319b('0x3d')]=_[_0x319b('0x3e')](_0x3b9f38[_0x319b('0x3d')],{'$or':_[_0x319b('0x2d')](_0x1d9b6b,function(_0x314782){if(_0x314782[_0x319b('0x3f')]!==_0x319b('0x40')){var _0x2334e5={};_0x2334e5[_0x314782[_0x319b('0x2a')]]={'$like':'%'+_0x217bca['query']['filter']+'%'};return _0x2334e5;}})});}_0x3b9f38=_[_0x319b('0x3e')]({},_0x3b9f38,_0x217bca[_0x319b('0x41')]);var _0x479714={'where':_0x3b9f38[_0x319b('0x3d')]};return db[_0x319b('0x2e')][_0x319b('0x1e')](_0x479714)['then'](function(_0x3856cf){_0x4bb352['count']=_0x3856cf;if(_0x217bca[_0x319b('0x33')][_0x319b('0x42')]){_0x3b9f38[_0x319b('0x43')]=[{'all':!![]}];}return db[_0x319b('0x2e')][_0x319b('0x44')](_0x3b9f38);})[_0x319b('0x27')](function(_0x11aa73){_0x4bb352['rows']=_0x11aa73;return _0x4bb352;})['then'](respondWithFilteredResult(_0x4033dd,_0x3b9f38))['catch'](handleError(_0x4033dd,null));};exports[_0x319b('0x45')]=function(_0x2d7d76,_0x173795){var _0x134d5b={'raw':![],'where':{'id':_0x2d7d76['params']['id']}},_0x3d1458={};_0x3d1458[_0x319b('0x32')]=_[_0x319b('0x34')](db[_0x319b('0x2e')][_0x319b('0x2f')]);_0x3d1458['query']=_[_0x319b('0x34')](_0x2d7d76[_0x319b('0x33')]);_0x3d1458[_0x319b('0x35')]=_[_0x319b('0x36')](_0x3d1458[_0x319b('0x32')],_0x3d1458['query']);_0x134d5b[_0x319b('0x37')]=_[_0x319b('0x36')](_0x3d1458[_0x319b('0x32')],qs[_0x319b('0x38')](_0x2d7d76[_0x319b('0x33')][_0x319b('0x38')]));_0x134d5b[_0x319b('0x37')]=_0x134d5b[_0x319b('0x37')]['length']?_0x134d5b['attributes']:_0x3d1458['model'];if(_0x2d7d76[_0x319b('0x33')][_0x319b('0x42')]){_0x134d5b[_0x319b('0x43')]=[{'all':!![]}];}_0x134d5b=_[_0x319b('0x3e')]({},_0x134d5b,_0x2d7d76[_0x319b('0x41')]);return db[_0x319b('0x2e')][_0x319b('0x46')](_0x134d5b)['then'](handleEntityNotFound(_0x173795,null))[_0x319b('0x27')](respondWithResult(_0x173795,null))[_0x319b('0x47')](handleError(_0x173795,null));};exports[_0x319b('0x48')]=function(_0x5bead0,_0x1006be){return db['ServicenowConfiguration'][_0x319b('0x48')](_0x5bead0[_0x319b('0x49')],{})['then'](respondWithResult(_0x1006be,0xc9))[_0x319b('0x47')](handleError(_0x1006be,null));};exports['update']=function(_0x5627cd,_0x3bdb60){if(_0x5627cd['body']['id']){delete _0x5627cd[_0x319b('0x49')]['id'];}return db[_0x319b('0x2e')][_0x319b('0x46')]({'where':{'id':_0x5627cd[_0x319b('0x4a')]['id']}})[_0x319b('0x27')](handleEntityNotFound(_0x3bdb60,null))[_0x319b('0x27')](saveUpdates(_0x5627cd[_0x319b('0x49')],null))[_0x319b('0x27')](respondWithResult(_0x3bdb60,null))[_0x319b('0x47')](handleError(_0x3bdb60,null));};exports[_0x319b('0x4b')]=function(_0x3c6253,_0x30fd60){return db['ServicenowConfiguration'][_0x319b('0x46')]({'where':{'id':_0x3c6253[_0x319b('0x4a')]['id']}})[_0x319b('0x27')](handleEntityNotFound(_0x30fd60,null))[_0x319b('0x27')](removeEntity(_0x30fd60,null))[_0x319b('0x47')](handleError(_0x30fd60,null));};exports[_0x319b('0x4c')]=function(_0x38f509,_0x3f19a4,_0x373f03){var _0x3bdb3a={};var _0x24f578={};var _0x634e6a;var _0x23b577;return db[_0x319b('0x2e')]['findOne']({'where':{'id':_0x38f509[_0x319b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3f19a4,null))[_0x319b('0x27')](function(_0x21b096){if(_0x21b096){_0x634e6a=_0x21b096;_0x24f578[_0x319b('0x32')]=_['keys'](db[_0x319b('0x4d')]['rawAttributes']);_0x24f578[_0x319b('0x33')]=_[_0x319b('0x34')](_0x38f509[_0x319b('0x33')]);_0x24f578[_0x319b('0x35')]=_[_0x319b('0x36')](_0x24f578['model'],_0x24f578[_0x319b('0x33')]);_0x3bdb3a[_0x319b('0x37')]=_[_0x319b('0x36')](_0x24f578[_0x319b('0x32')],qs[_0x319b('0x38')](_0x38f509['query'][_0x319b('0x38')]));_0x3bdb3a[_0x319b('0x37')]=_0x3bdb3a[_0x319b('0x37')]['length']?_0x3bdb3a[_0x319b('0x37')]:_0x24f578[_0x319b('0x32')];_0x3bdb3a['order']=qs[_0x319b('0x4e')](_0x38f509['query'][_0x319b('0x4e')]);_0x3bdb3a['where']=qs[_0x319b('0x35')](_['pick'](_0x38f509[_0x319b('0x33')],_0x24f578[_0x319b('0x35')]));if(_0x38f509[_0x319b('0x33')][_0x319b('0x3c')]){_0x3bdb3a[_0x319b('0x3d')]=_[_0x319b('0x3e')](_0x3bdb3a['where'],{'$or':_[_0x319b('0x2d')](_0x3bdb3a['attributes'],function(_0x1a0f55){var _0x5168ed={};_0x5168ed[_0x1a0f55]={'$like':'%'+_0x38f509[_0x319b('0x33')][_0x319b('0x3c')]+'%'};return _0x5168ed;})});}_0x3bdb3a=_[_0x319b('0x3e')]({},_0x3bdb3a,_0x38f509[_0x319b('0x41')]);return _0x634e6a[_0x319b('0x4c')](_0x3bdb3a);}})[_0x319b('0x27')](function(_0x3ee910){if(_0x3ee910){_0x23b577=_0x3ee910[_0x319b('0x39')];if(!_0x38f509[_0x319b('0x33')]['hasOwnProperty'](_0x319b('0x3a'))){_0x3bdb3a['limit']=qs[_0x319b('0x20')](_0x38f509[_0x319b('0x33')][_0x319b('0x20')]);_0x3bdb3a[_0x319b('0x1f')]=qs[_0x319b('0x1f')](_0x38f509[_0x319b('0x33')][_0x319b('0x1f')]);}return _0x634e6a[_0x319b('0x4c')](_0x3bdb3a);}})[_0x319b('0x27')](function(_0x3a95e4){if(_0x3a95e4){return _0x3a95e4?{'count':_0x23b577,'rows':_0x3a95e4}:null;}})[_0x319b('0x27')](respondWithResult(_0x3f19a4,null))['catch'](handleError(_0x3f19a4,null));};exports['getSubjects']=function(_0x3c2957,_0x51c99e,_0x497c22){var _0x53f37e={};var _0x5852f9={};var _0x220a13;var _0x475c94;return db[_0x319b('0x2e')][_0x319b('0x4f')]({'where':{'id':_0x3c2957['params']['id']}})[_0x319b('0x27')](handleEntityNotFound(_0x51c99e,null))[_0x319b('0x27')](function(_0x1d25c4){if(_0x1d25c4){_0x220a13=_0x1d25c4;_0x5852f9['model']=_[_0x319b('0x34')](db[_0x319b('0x4d')]['rawAttributes']);_0x5852f9[_0x319b('0x33')]=_[_0x319b('0x34')](_0x3c2957[_0x319b('0x33')]);_0x5852f9['filters']=_[_0x319b('0x36')](_0x5852f9[_0x319b('0x32')],_0x5852f9['query']);_0x53f37e[_0x319b('0x37')]=_['intersection'](_0x5852f9[_0x319b('0x32')],qs[_0x319b('0x38')](_0x3c2957[_0x319b('0x33')][_0x319b('0x38')]));_0x53f37e[_0x319b('0x37')]=_0x53f37e['attributes']['length']?_0x53f37e['attributes']:_0x5852f9[_0x319b('0x32')];_0x53f37e['order']=qs['sort'](_0x3c2957[_0x319b('0x33')][_0x319b('0x4e')]);_0x53f37e[_0x319b('0x3d')]=qs['filters'](_[_0x319b('0x3b')](_0x3c2957[_0x319b('0x33')],_0x5852f9[_0x319b('0x35')]));if(_0x3c2957[_0x319b('0x33')][_0x319b('0x3c')]){_0x53f37e[_0x319b('0x3d')]=_[_0x319b('0x3e')](_0x53f37e['where'],{'$or':_['map'](_0x53f37e[_0x319b('0x37')],function(_0x1f58d6){var _0x309b41={};_0x309b41[_0x1f58d6]={'$like':'%'+_0x3c2957['query'][_0x319b('0x3c')]+'%'};return _0x309b41;})});}_0x53f37e=_[_0x319b('0x3e')]({},_0x53f37e,_0x3c2957[_0x319b('0x41')]);return _0x220a13[_0x319b('0x50')](_0x53f37e);}})[_0x319b('0x27')](function(_0x51252b){if(_0x51252b){_0x475c94=_0x51252b[_0x319b('0x39')];if(!_0x3c2957['query'][_0x319b('0x51')](_0x319b('0x3a'))){_0x53f37e[_0x319b('0x20')]=qs[_0x319b('0x20')](_0x3c2957[_0x319b('0x33')][_0x319b('0x20')]);_0x53f37e[_0x319b('0x1f')]=qs['offset'](_0x3c2957[_0x319b('0x33')][_0x319b('0x1f')]);}return _0x220a13[_0x319b('0x50')](_0x53f37e);}})[_0x319b('0x27')](function(_0x1e8706){if(_0x1e8706){return _0x1e8706?{'count':_0x475c94,'rows':_0x1e8706}:null;}})['then'](respondWithResult(_0x51c99e,null))[_0x319b('0x47')](handleError(_0x51c99e,null));};exports[_0x319b('0x52')]=function(_0x4d975c,_0x24cc64,_0x2a09cf){var _0xbe4543={};var _0x234510={};var _0x39cc7b;var _0xd61b2d;return db[_0x319b('0x2e')][_0x319b('0x4f')]({'where':{'id':_0x4d975c[_0x319b('0x4a')]['id']}})[_0x319b('0x27')](handleEntityNotFound(_0x24cc64,null))[_0x319b('0x27')](function(_0x3428af){if(_0x3428af){_0x39cc7b=_0x3428af;_0x234510[_0x319b('0x32')]=_[_0x319b('0x34')](db[_0x319b('0x4d')]['rawAttributes']);_0x234510[_0x319b('0x33')]=_['keys'](_0x4d975c[_0x319b('0x33')]);_0x234510['filters']=_[_0x319b('0x36')](_0x234510[_0x319b('0x32')],_0x234510[_0x319b('0x33')]);_0xbe4543[_0x319b('0x37')]=_['intersection'](_0x234510[_0x319b('0x32')],qs[_0x319b('0x38')](_0x4d975c[_0x319b('0x33')][_0x319b('0x38')]));_0xbe4543[_0x319b('0x37')]=_0xbe4543['attributes'][_0x319b('0x39')]?_0xbe4543['attributes']:_0x234510[_0x319b('0x32')];_0xbe4543['order']=qs[_0x319b('0x4e')](_0x4d975c[_0x319b('0x33')][_0x319b('0x4e')]);_0xbe4543[_0x319b('0x3d')]=qs[_0x319b('0x35')](_[_0x319b('0x3b')](_0x4d975c[_0x319b('0x33')],_0x234510[_0x319b('0x35')]));if(_0x4d975c[_0x319b('0x33')][_0x319b('0x3c')]){_0xbe4543[_0x319b('0x3d')]=_[_0x319b('0x3e')](_0xbe4543[_0x319b('0x3d')],{'$or':_[_0x319b('0x2d')](_0xbe4543[_0x319b('0x37')],function(_0xd9e43b){var _0x23cc65={};_0x23cc65[_0xd9e43b]={'$like':'%'+_0x4d975c[_0x319b('0x33')][_0x319b('0x3c')]+'%'};return _0x23cc65;})});}_0xbe4543=_['merge']({},_0xbe4543,_0x4d975c[_0x319b('0x41')]);return _0x39cc7b['getDescriptions'](_0xbe4543);}})[_0x319b('0x27')](function(_0xd8c312){if(_0xd8c312){_0xd61b2d=_0xd8c312[_0x319b('0x39')];if(!_0x4d975c[_0x319b('0x33')][_0x319b('0x51')]('nolimit')){_0xbe4543[_0x319b('0x20')]=qs['limit'](_0x4d975c['query'][_0x319b('0x20')]);_0xbe4543[_0x319b('0x1f')]=qs['offset'](_0x4d975c[_0x319b('0x33')][_0x319b('0x1f')]);}return _0x39cc7b[_0x319b('0x52')](_0xbe4543);}})[_0x319b('0x27')](function(_0x220002){if(_0x220002){return _0x220002?{'count':_0xd61b2d,'rows':_0x220002}:null;}})[_0x319b('0x27')](respondWithResult(_0x24cc64,null))[_0x319b('0x47')](handleError(_0x24cc64,null));}; \ No newline at end of file +var _0x6019=['../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','error','stack','map','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','name','options','ServicenowConfiguration','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','destroy','getFields','findOne','getSubjects','ServicenowField','getDescriptions','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x4fbb19,_0x327070){var _0x15239e=function(_0x51774c){while(--_0x51774c){_0x4fbb19['push'](_0x4fbb19['shift']());}};_0x15239e(++_0x327070);}(_0x6019,0x1bd));var _0x9601=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x6019[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x9601('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9601('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9601('0x2'));var moment=require(_0x9601('0x3'));var BPromise=require(_0x9601('0x4'));var Mustache=require('mustache');var util=require(_0x9601('0x5'));var path=require(_0x9601('0x6'));var sox=require(_0x9601('0x7'));var csv=require(_0x9601('0x8'));var ejs=require(_0x9601('0x9'));var fs=require('fs');var fs_extra=require(_0x9601('0xa'));var _=require('lodash');var squel=require(_0x9601('0xb'));var crypto=require('crypto');var jsforce=require(_0x9601('0xc'));var deskjs=require(_0x9601('0xd'));var toCsv=require(_0x9601('0x8'));var querystring=require('querystring');var Papa=require(_0x9601('0xe'));var Redis=require(_0x9601('0xf'));var authService=require(_0x9601('0x10'));var qs=require(_0x9601('0x11'));var as=require(_0x9601('0x12'));var hardwareService=require(_0x9601('0x13'));var logger=require(_0x9601('0x14'))(_0x9601('0x15'));var utils=require(_0x9601('0x16'));var config=require(_0x9601('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d141e,_0x2abdc2){_0x2abdc2=_0x2abdc2||0xcc;return function(_0x51ce75){if(_0x51ce75){return _0x4d141e[_0x9601('0x18')](_0x2abdc2);}return _0x4d141e[_0x9601('0x19')](_0x2abdc2)[_0x9601('0x1a')]();};}function respondWithResult(_0x23c5ff,_0xa794a6){_0xa794a6=_0xa794a6||0xc8;return function(_0x118d14){if(_0x118d14){return _0x23c5ff[_0x9601('0x19')](_0xa794a6)[_0x9601('0x1b')](_0x118d14);}};}function respondWithFilteredResult(_0x2f48c4,_0x5488e8){return function(_0x270ffe){if(_0x270ffe){var _0x2f30e7=typeof _0x5488e8[_0x9601('0x1c')]==='undefined'&&typeof _0x5488e8[_0x9601('0x1d')]===_0x9601('0x1e');var _0x5b00dc=_0x270ffe[_0x9601('0x1f')];var _0x74d142=_0x2f30e7?0x0:_0x5488e8[_0x9601('0x1c')];var _0x5052fd=_0x2f30e7?_0x270ffe[_0x9601('0x1f')]:_0x5488e8['offset']+_0x5488e8['limit'];var _0x19a565;if(_0x5052fd>=_0x5b00dc){_0x5052fd=_0x5b00dc;_0x19a565=0xc8;}else{_0x19a565=0xce;}_0x2f48c4[_0x9601('0x19')](_0x19a565);return _0x2f48c4['set'](_0x9601('0x20'),_0x74d142+'-'+_0x5052fd+'/'+_0x5b00dc)[_0x9601('0x1b')](_0x270ffe);}return null;};}function patchUpdates(_0x4dd9d0){return function(_0x5603ed){try{jsonpatch[_0x9601('0x21')](_0x5603ed,_0x4dd9d0,!![]);}catch(_0x565088){return BPromise[_0x9601('0x22')](_0x565088);}return _0x5603ed[_0x9601('0x23')]();};}function saveUpdates(_0x4c21ed,_0x44055c){return function(_0x3b0d9a){if(_0x3b0d9a){return _0x3b0d9a[_0x9601('0x24')](_0x4c21ed)[_0x9601('0x25')](function(_0x80c7fb){return _0x80c7fb;});}return null;};}function removeEntity(_0x480ce9,_0x36ea2a){return function(_0x49b616){if(_0x49b616){return _0x49b616['destroy']()[_0x9601('0x25')](function(){_0x480ce9[_0x9601('0x19')](0xcc)[_0x9601('0x1a')]();});}};}function handleEntityNotFound(_0x392c90,_0x36f781){return function(_0x2f163f){if(!_0x2f163f){_0x392c90[_0x9601('0x18')](0x194);}return _0x2f163f;};}function handleError(_0x2de42f,_0x2d7a63){_0x2d7a63=_0x2d7a63||0x1f4;return function(_0x1432e6){logger[_0x9601('0x26')](_0x1432e6[_0x9601('0x27')]);if(_0x1432e6['name']){delete _0x1432e6['name'];}_0x2de42f['status'](_0x2d7a63)['send'](_0x1432e6);};}exports['index']=function(_0x2d8f36,_0x16628d){var _0x365afe={},_0x17d28e={},_0x1a7091={'count':0x0,'rows':[]};var _0x4b921d=_[_0x9601('0x28')](db['ServicenowConfiguration']['rawAttributes'],function(_0x57fbd5){return{'name':_0x57fbd5['fieldName'],'type':_0x57fbd5[_0x9601('0x29')][_0x9601('0x2a')]};});_0x17d28e[_0x9601('0x2b')]=_['map'](_0x4b921d,'name');_0x17d28e[_0x9601('0x2c')]=_[_0x9601('0x2d')](_0x2d8f36[_0x9601('0x2c')]);_0x17d28e[_0x9601('0x2e')]=_[_0x9601('0x2f')](_0x17d28e[_0x9601('0x2b')],_0x17d28e[_0x9601('0x2c')]);_0x365afe[_0x9601('0x30')]=_[_0x9601('0x2f')](_0x17d28e[_0x9601('0x2b')],qs[_0x9601('0x31')](_0x2d8f36[_0x9601('0x2c')][_0x9601('0x31')]));_0x365afe[_0x9601('0x30')]=_0x365afe[_0x9601('0x30')]['length']?_0x365afe[_0x9601('0x30')]:_0x17d28e['model'];if(!_0x2d8f36[_0x9601('0x2c')][_0x9601('0x32')](_0x9601('0x33'))){_0x365afe['limit']=qs[_0x9601('0x1d')](_0x2d8f36['query'][_0x9601('0x1d')]);_0x365afe['offset']=qs[_0x9601('0x1c')](_0x2d8f36['query'][_0x9601('0x1c')]);}_0x365afe[_0x9601('0x34')]=qs[_0x9601('0x35')](_0x2d8f36[_0x9601('0x2c')][_0x9601('0x35')]);_0x365afe[_0x9601('0x36')]=qs[_0x9601('0x2e')](_[_0x9601('0x37')](_0x2d8f36[_0x9601('0x2c')],_0x17d28e['filters']),_0x4b921d);if(_0x2d8f36[_0x9601('0x2c')][_0x9601('0x38')]){_0x365afe['where']=_[_0x9601('0x39')](_0x365afe[_0x9601('0x36')],{'$or':_[_0x9601('0x28')](_0x4b921d,function(_0x1dd81c){if(_0x1dd81c['type']!=='VIRTUAL'){var _0x28781d={};_0x28781d[_0x1dd81c[_0x9601('0x3a')]]={'$like':'%'+_0x2d8f36[_0x9601('0x2c')][_0x9601('0x38')]+'%'};return _0x28781d;}})});}_0x365afe=_[_0x9601('0x39')]({},_0x365afe,_0x2d8f36[_0x9601('0x3b')]);var _0x241f45={'where':_0x365afe[_0x9601('0x36')]};return db[_0x9601('0x3c')]['count'](_0x241f45)[_0x9601('0x25')](function(_0xb3e8da){_0x1a7091[_0x9601('0x1f')]=_0xb3e8da;if(_0x2d8f36[_0x9601('0x2c')][_0x9601('0x3d')]){_0x365afe[_0x9601('0x3e')]=[{'all':!![]}];}return db[_0x9601('0x3c')]['findAll'](_0x365afe);})['then'](function(_0x164a1c){_0x1a7091[_0x9601('0x3f')]=_0x164a1c;return _0x1a7091;})[_0x9601('0x25')](respondWithFilteredResult(_0x16628d,_0x365afe))[_0x9601('0x40')](handleError(_0x16628d,null));};exports[_0x9601('0x41')]=function(_0x532ef8,_0x24fdff){var _0x371500={'raw':![],'where':{'id':_0x532ef8[_0x9601('0x42')]['id']}},_0x247179={};_0x247179[_0x9601('0x2b')]=_[_0x9601('0x2d')](db['ServicenowConfiguration'][_0x9601('0x43')]);_0x247179[_0x9601('0x2c')]=_[_0x9601('0x2d')](_0x532ef8[_0x9601('0x2c')]);_0x247179[_0x9601('0x2e')]=_[_0x9601('0x2f')](_0x247179['model'],_0x247179[_0x9601('0x2c')]);_0x371500['attributes']=_[_0x9601('0x2f')](_0x247179[_0x9601('0x2b')],qs['fields'](_0x532ef8[_0x9601('0x2c')][_0x9601('0x31')]));_0x371500[_0x9601('0x30')]=_0x371500[_0x9601('0x30')][_0x9601('0x44')]?_0x371500[_0x9601('0x30')]:_0x247179[_0x9601('0x2b')];if(_0x532ef8[_0x9601('0x2c')]['includeAll']){_0x371500['include']=[{'all':!![]}];}_0x371500=_[_0x9601('0x39')]({},_0x371500,_0x532ef8[_0x9601('0x3b')]);return db['ServicenowConfiguration'][_0x9601('0x45')](_0x371500)['then'](handleEntityNotFound(_0x24fdff,null))[_0x9601('0x25')](respondWithResult(_0x24fdff,null))['catch'](handleError(_0x24fdff,null));};exports['create']=function(_0x5820df,_0x42b176){return db['ServicenowConfiguration'][_0x9601('0x46')](_0x5820df[_0x9601('0x47')],{})[_0x9601('0x25')](respondWithResult(_0x42b176,0xc9))[_0x9601('0x40')](handleError(_0x42b176,null));};exports[_0x9601('0x24')]=function(_0x253034,_0x4997d8){if(_0x253034[_0x9601('0x47')]['id']){delete _0x253034['body']['id'];}return db[_0x9601('0x3c')]['find']({'where':{'id':_0x253034[_0x9601('0x42')]['id']}})[_0x9601('0x25')](handleEntityNotFound(_0x4997d8,null))[_0x9601('0x25')](saveUpdates(_0x253034[_0x9601('0x47')],null))[_0x9601('0x25')](respondWithResult(_0x4997d8,null))[_0x9601('0x40')](handleError(_0x4997d8,null));};exports[_0x9601('0x48')]=function(_0x3718de,_0x158e4a){return db[_0x9601('0x3c')][_0x9601('0x45')]({'where':{'id':_0x3718de[_0x9601('0x42')]['id']}})[_0x9601('0x25')](handleEntityNotFound(_0x158e4a,null))[_0x9601('0x25')](removeEntity(_0x158e4a,null))[_0x9601('0x40')](handleError(_0x158e4a,null));};exports[_0x9601('0x49')]=function(_0x567deb,_0x31e0eb,_0x9be417){var _0x6138d={};var _0xf0e312={};var _0x45e755;var _0x44cad6;return db[_0x9601('0x3c')][_0x9601('0x4a')]({'where':{'id':_0x567deb[_0x9601('0x42')]['id']}})['then'](handleEntityNotFound(_0x31e0eb,null))[_0x9601('0x25')](function(_0x224884){if(_0x224884){_0x45e755=_0x224884;_0xf0e312['model']=_[_0x9601('0x2d')](db['ServicenowField'][_0x9601('0x43')]);_0xf0e312[_0x9601('0x2c')]=_['keys'](_0x567deb[_0x9601('0x2c')]);_0xf0e312['filters']=_[_0x9601('0x2f')](_0xf0e312[_0x9601('0x2b')],_0xf0e312[_0x9601('0x2c')]);_0x6138d[_0x9601('0x30')]=_[_0x9601('0x2f')](_0xf0e312[_0x9601('0x2b')],qs[_0x9601('0x31')](_0x567deb[_0x9601('0x2c')][_0x9601('0x31')]));_0x6138d[_0x9601('0x30')]=_0x6138d['attributes'][_0x9601('0x44')]?_0x6138d[_0x9601('0x30')]:_0xf0e312[_0x9601('0x2b')];_0x6138d[_0x9601('0x34')]=qs[_0x9601('0x35')](_0x567deb[_0x9601('0x2c')]['sort']);_0x6138d[_0x9601('0x36')]=qs[_0x9601('0x2e')](_[_0x9601('0x37')](_0x567deb[_0x9601('0x2c')],_0xf0e312[_0x9601('0x2e')]));if(_0x567deb[_0x9601('0x2c')][_0x9601('0x38')]){_0x6138d[_0x9601('0x36')]=_[_0x9601('0x39')](_0x6138d[_0x9601('0x36')],{'$or':_[_0x9601('0x28')](_0x6138d[_0x9601('0x30')],function(_0x3257ef){var _0x566511={};_0x566511[_0x3257ef]={'$like':'%'+_0x567deb[_0x9601('0x2c')][_0x9601('0x38')]+'%'};return _0x566511;})});}_0x6138d=_[_0x9601('0x39')]({},_0x6138d,_0x567deb['options']);return _0x45e755[_0x9601('0x49')](_0x6138d);}})[_0x9601('0x25')](function(_0xf174f3){if(_0xf174f3){_0x44cad6=_0xf174f3[_0x9601('0x44')];if(!_0x567deb[_0x9601('0x2c')]['hasOwnProperty']('nolimit')){_0x6138d[_0x9601('0x1d')]=qs['limit'](_0x567deb[_0x9601('0x2c')][_0x9601('0x1d')]);_0x6138d['offset']=qs[_0x9601('0x1c')](_0x567deb[_0x9601('0x2c')]['offset']);}return _0x45e755[_0x9601('0x49')](_0x6138d);}})[_0x9601('0x25')](function(_0x59ebda){if(_0x59ebda){return _0x59ebda?{'count':_0x44cad6,'rows':_0x59ebda}:null;}})[_0x9601('0x25')](respondWithResult(_0x31e0eb,null))[_0x9601('0x40')](handleError(_0x31e0eb,null));};exports[_0x9601('0x4b')]=function(_0x280f45,_0x9f020e,_0x506c10){var _0x48e757={};var _0x3eaa12={};var _0x365460;var _0x3756f0;return db['ServicenowConfiguration'][_0x9601('0x4a')]({'where':{'id':_0x280f45[_0x9601('0x42')]['id']}})['then'](handleEntityNotFound(_0x9f020e,null))[_0x9601('0x25')](function(_0xacb54b){if(_0xacb54b){_0x365460=_0xacb54b;_0x3eaa12[_0x9601('0x2b')]=_[_0x9601('0x2d')](db[_0x9601('0x4c')][_0x9601('0x43')]);_0x3eaa12[_0x9601('0x2c')]=_[_0x9601('0x2d')](_0x280f45[_0x9601('0x2c')]);_0x3eaa12['filters']=_[_0x9601('0x2f')](_0x3eaa12[_0x9601('0x2b')],_0x3eaa12[_0x9601('0x2c')]);_0x48e757[_0x9601('0x30')]=_[_0x9601('0x2f')](_0x3eaa12[_0x9601('0x2b')],qs[_0x9601('0x31')](_0x280f45[_0x9601('0x2c')][_0x9601('0x31')]));_0x48e757[_0x9601('0x30')]=_0x48e757['attributes'][_0x9601('0x44')]?_0x48e757['attributes']:_0x3eaa12[_0x9601('0x2b')];_0x48e757[_0x9601('0x34')]=qs[_0x9601('0x35')](_0x280f45[_0x9601('0x2c')]['sort']);_0x48e757['where']=qs['filters'](_['pick'](_0x280f45[_0x9601('0x2c')],_0x3eaa12[_0x9601('0x2e')]));if(_0x280f45['query'][_0x9601('0x38')]){_0x48e757[_0x9601('0x36')]=_[_0x9601('0x39')](_0x48e757[_0x9601('0x36')],{'$or':_[_0x9601('0x28')](_0x48e757[_0x9601('0x30')],function(_0x3ddaea){var _0xa738eb={};_0xa738eb[_0x3ddaea]={'$like':'%'+_0x280f45['query'][_0x9601('0x38')]+'%'};return _0xa738eb;})});}_0x48e757=_[_0x9601('0x39')]({},_0x48e757,_0x280f45['options']);return _0x365460['getSubjects'](_0x48e757);}})[_0x9601('0x25')](function(_0x5a6a68){if(_0x5a6a68){_0x3756f0=_0x5a6a68['length'];if(!_0x280f45[_0x9601('0x2c')][_0x9601('0x32')](_0x9601('0x33'))){_0x48e757['limit']=qs[_0x9601('0x1d')](_0x280f45[_0x9601('0x2c')][_0x9601('0x1d')]);_0x48e757['offset']=qs[_0x9601('0x1c')](_0x280f45[_0x9601('0x2c')][_0x9601('0x1c')]);}return _0x365460[_0x9601('0x4b')](_0x48e757);}})[_0x9601('0x25')](function(_0x4a827c){if(_0x4a827c){return _0x4a827c?{'count':_0x3756f0,'rows':_0x4a827c}:null;}})['then'](respondWithResult(_0x9f020e,null))[_0x9601('0x40')](handleError(_0x9f020e,null));};exports['getDescriptions']=function(_0x4ca30c,_0x683df5,_0x1e0f9f){var _0x5e78fa={};var _0x3c7efd={};var _0x2f71b4;var _0x46c59b;return db[_0x9601('0x3c')][_0x9601('0x4a')]({'where':{'id':_0x4ca30c[_0x9601('0x42')]['id']}})[_0x9601('0x25')](handleEntityNotFound(_0x683df5,null))[_0x9601('0x25')](function(_0x164bb8){if(_0x164bb8){_0x2f71b4=_0x164bb8;_0x3c7efd[_0x9601('0x2b')]=_[_0x9601('0x2d')](db[_0x9601('0x4c')][_0x9601('0x43')]);_0x3c7efd['query']=_['keys'](_0x4ca30c[_0x9601('0x2c')]);_0x3c7efd[_0x9601('0x2e')]=_['intersection'](_0x3c7efd[_0x9601('0x2b')],_0x3c7efd['query']);_0x5e78fa[_0x9601('0x30')]=_[_0x9601('0x2f')](_0x3c7efd[_0x9601('0x2b')],qs[_0x9601('0x31')](_0x4ca30c[_0x9601('0x2c')]['fields']));_0x5e78fa[_0x9601('0x30')]=_0x5e78fa['attributes'][_0x9601('0x44')]?_0x5e78fa['attributes']:_0x3c7efd['model'];_0x5e78fa[_0x9601('0x34')]=qs['sort'](_0x4ca30c[_0x9601('0x2c')][_0x9601('0x35')]);_0x5e78fa['where']=qs[_0x9601('0x2e')](_[_0x9601('0x37')](_0x4ca30c[_0x9601('0x2c')],_0x3c7efd[_0x9601('0x2e')]));if(_0x4ca30c[_0x9601('0x2c')]['filter']){_0x5e78fa['where']=_[_0x9601('0x39')](_0x5e78fa[_0x9601('0x36')],{'$or':_['map'](_0x5e78fa[_0x9601('0x30')],function(_0x44e67f){var _0x16a827={};_0x16a827[_0x44e67f]={'$like':'%'+_0x4ca30c[_0x9601('0x2c')][_0x9601('0x38')]+'%'};return _0x16a827;})});}_0x5e78fa=_[_0x9601('0x39')]({},_0x5e78fa,_0x4ca30c[_0x9601('0x3b')]);return _0x2f71b4[_0x9601('0x4d')](_0x5e78fa);}})[_0x9601('0x25')](function(_0x1419f9){if(_0x1419f9){_0x46c59b=_0x1419f9[_0x9601('0x44')];if(!_0x4ca30c[_0x9601('0x2c')][_0x9601('0x32')](_0x9601('0x33'))){_0x5e78fa['limit']=qs[_0x9601('0x1d')](_0x4ca30c['query']['limit']);_0x5e78fa[_0x9601('0x1c')]=qs[_0x9601('0x1c')](_0x4ca30c[_0x9601('0x2c')][_0x9601('0x1c')]);}return _0x2f71b4[_0x9601('0x4d')](_0x5e78fa);}})[_0x9601('0x25')](function(_0x1cf4a7){if(_0x1cf4a7){return _0x1cf4a7?{'count':_0x46c59b,'rows':_0x1cf4a7}:null;}})[_0x9601('0x25')](respondWithResult(_0x683df5,null))[_0x9601('0x40')](handleError(_0x683df5,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 9fd7cee..9aded3e 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 _0xab23=['rimraf','../../config/environment','./intServicenowConfiguration.attributes','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x3d4876,_0x366386){var _0x58ca9d=function(_0x5bd045){while(--_0x5bd045){_0x3d4876['push'](_0x3d4876['shift']());}};_0x58ca9d(++_0x366386);}(_0xab23,0x1bc));var _0x3ab2=function(_0x50d4ea,_0x1ef246){_0x50d4ea=_0x50d4ea-0x0;var _0x539f1b=_0xab23[_0x50d4ea];return _0x539f1b;};'use strict';var _=require(_0x3ab2('0x0'));var util=require(_0x3ab2('0x1'));var logger=require(_0x3ab2('0x2'))(_0x3ab2('0x3'));var moment=require(_0x3ab2('0x4'));var BPromise=require(_0x3ab2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ab2('0x6'));var rimraf=require(_0x3ab2('0x7'));var config=require(_0x3ab2('0x8'));var attributes=require(_0x3ab2('0x9'));module['exports']=function(_0x5222ba,_0x3445f2){return _0x5222ba['define']('ServicenowConfiguration',attributes,{'tableName':_0x3ab2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3423=['ServicenowConfiguration','int_servicenow_configurations','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define'];(function(_0x460da7,_0x481829){var _0x43fc90=function(_0x2409c1){while(--_0x2409c1){_0x460da7['push'](_0x460da7['shift']());}};_0x43fc90(++_0x481829);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3342('0x0'))(_0x3342('0x1'));var moment=require(_0x3342('0x2'));var BPromise=require(_0x3342('0x3'));var rp=require(_0x3342('0x4'));var fs=require('fs');var path=require(_0x3342('0x5'));var rimraf=require(_0x3342('0x6'));var config=require(_0x3342('0x7'));var attributes=require(_0x3342('0x8'));module[_0x3342('0x9')]=function(_0x467453,_0x2ccbe0){return _0x467453[_0x3342('0xa')](_0x3342('0xb'),attributes,{'tableName':_0x3342('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index d55d023..1f9b089 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 _0x0f25=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x0f25,0xdf));var _0x50f2=function(_0x28e15d,_0x180107){_0x28e15d=_0x28e15d-0x0;var _0x9d2e35=_0x0f25[_0x28e15d];return _0x9d2e35;};'use strict';var _=require(_0x50f2('0x0'));var util=require(_0x50f2('0x1'));var moment=require('moment');var BPromise=require(_0x50f2('0x2'));var rs=require(_0x50f2('0x3'));var fs=require('fs');var Redis=require(_0x50f2('0x4'));var db=require(_0x50f2('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x50f2('0x6'));var config=require(_0x50f2('0x7'));var jayson=require(_0x50f2('0x8'));var client=jayson[_0x50f2('0x9')][_0x50f2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x379d0b,_0x19e3ce,_0x1dd289){return new BPromise(function(_0x191e17,_0x429f8c){return client['request'](_0x379d0b,_0x1dd289)['then'](function(_0x18f8c9){logger[_0x50f2('0xb')](_0x50f2('0xc'),_0x19e3ce,_0x50f2('0xd'));logger[_0x50f2('0xe')](_0x50f2('0xf'),_0x19e3ce,_0x50f2('0xd'),JSON[_0x50f2('0x10')](_0x18f8c9));if(_0x18f8c9[_0x50f2('0x11')]){if(_0x18f8c9[_0x50f2('0x11')][_0x50f2('0x12')]===0x1f4){logger[_0x50f2('0x11')](_0x50f2('0xc'),_0x19e3ce,_0x18f8c9[_0x50f2('0x11')][_0x50f2('0x13')]);return _0x429f8c(_0x18f8c9['error'][_0x50f2('0x13')]);}logger[_0x50f2('0x11')](_0x50f2('0xc'),_0x19e3ce,_0x18f8c9['error'][_0x50f2('0x13')]);return _0x191e17(_0x18f8c9[_0x50f2('0x11')]['message']);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x19e3ce,_0x50f2('0xd'));_0x191e17(_0x18f8c9[_0x50f2('0x14')][_0x50f2('0x13')]);}})[_0x50f2('0x15')](function(_0x254f5f){logger[_0x50f2('0x11')](_0x50f2('0xc'),_0x19e3ce,_0x254f5f);_0x429f8c(_0x254f5f);});});} \ No newline at end of file +var _0x4563=['http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x3f4891,_0x4e6f62){var _0x54f2d8=function(_0x2b11ee){while(--_0x2b11ee){_0x3f4891['push'](_0x3f4891['shift']());}};_0x54f2d8(++_0x4e6f62);}(_0x4563,0x194));var _0x3456=function(_0x554313,_0x4d1a47){_0x554313=_0x554313-0x0;var _0x484548=_0x4563[_0x554313];return _0x484548;};'use strict';var _=require(_0x3456('0x0'));var util=require(_0x3456('0x1'));var moment=require('moment');var BPromise=require(_0x3456('0x2'));var rs=require(_0x3456('0x3'));var fs=require('fs');var Redis=require(_0x3456('0x4'));var db=require(_0x3456('0x5'))['db'];var utils=require(_0x3456('0x6'));var logger=require(_0x3456('0x7'))('rpc');var config=require(_0x3456('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3456('0x9')][_0x3456('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ec388,_0x508918,_0x568641){return new BPromise(function(_0x32a6dc,_0xe34689){return client[_0x3456('0xb')](_0x2ec388,_0x568641)[_0x3456('0xc')](function(_0x2f25b7){logger[_0x3456('0xd')](_0x3456('0xe'),_0x508918,'request\x20sent');logger['debug'](_0x3456('0xf'),_0x508918,_0x3456('0x10'),JSON[_0x3456('0x11')](_0x2f25b7));if(_0x2f25b7['error']){if(_0x2f25b7[_0x3456('0x12')][_0x3456('0x13')]===0x1f4){logger['error'](_0x3456('0xe'),_0x508918,_0x2f25b7[_0x3456('0x12')][_0x3456('0x14')]);return _0xe34689(_0x2f25b7[_0x3456('0x12')]['message']);}logger[_0x3456('0x12')](_0x3456('0xe'),_0x508918,_0x2f25b7[_0x3456('0x12')]['message']);return _0x32a6dc(_0x2f25b7[_0x3456('0x12')][_0x3456('0x14')]);}else{logger[_0x3456('0xd')](_0x3456('0xe'),_0x508918,'request\x20sent');_0x32a6dc(_0x2f25b7[_0x3456('0x15')][_0x3456('0x14')]);}})[_0x3456('0x16')](function(_0x40eeb5){logger[_0x3456('0x12')](_0x3456('0xe'),_0x508918,_0x40eeb5);_0xe34689(_0x40eeb5);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 5ff02cd..cce2d21 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 _0xee69=['put','delete','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x404d8d,_0x5daf97){var _0x3281d5=function(_0x456ee8){while(--_0x456ee8){_0x404d8d['push'](_0x404d8d['shift']());}};_0x3281d5(++_0x5daf97);}(_0xee69,0x1ad));var _0x9ee6=function(_0x7161ee,_0x5dc9cd){_0x7161ee=_0x7161ee-0x0;var _0x297f09=_0xee69[_0x7161ee];return _0x297f09;};'use strict';var multer=require(_0x9ee6('0x0'));var util=require('util');var path=require(_0x9ee6('0x1'));var timeout=require(_0x9ee6('0x2'));var express=require(_0x9ee6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9ee6('0x4'));var config=require(_0x9ee6('0x5'));var controller=require('./intServicenowField.controller');router[_0x9ee6('0x6')]('/',auth['isAuthenticated'](),controller[_0x9ee6('0x7')]);router['get'](_0x9ee6('0x8'),auth[_0x9ee6('0x9')](),controller[_0x9ee6('0xa')]);router[_0x9ee6('0xb')]('/',auth[_0x9ee6('0x9')](),controller[_0x9ee6('0xc')]);router[_0x9ee6('0xd')]('/:id',auth[_0x9ee6('0x9')](),controller['update']);router[_0x9ee6('0xe')](_0x9ee6('0x8'),auth[_0x9ee6('0x9')](),controller[_0x9ee6('0xf')]);module[_0x9ee6('0x10')]=router; \ No newline at end of file +var _0xa82d=['get','/:id','post','put','update','delete','destroy','exports','path','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index'];(function(_0xc77819,_0x139fdc){var _0x1c9434=function(_0x11d15d){while(--_0x11d15d){_0xc77819['push'](_0xc77819['shift']());}};_0x1c9434(++_0x139fdc);}(_0xa82d,0xad));var _0xda82=function(_0x2408c3,_0x117956){_0x2408c3=_0x2408c3-0x0;var _0x1898d7=_0xa82d[_0x2408c3];return _0x1898d7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xda82('0x0'));var timeout=require('connect-timeout');var express=require(_0xda82('0x1'));var router=express[_0xda82('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xda82('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xda82('0x4'));var controller=require('./intServicenowField.controller');router['get']('/',auth[_0xda82('0x5')](),controller[_0xda82('0x6')]);router[_0xda82('0x7')](_0xda82('0x8'),auth[_0xda82('0x5')](),controller['show']);router[_0xda82('0x9')]('/',auth['isAuthenticated'](),controller['create']);router[_0xda82('0xa')](_0xda82('0x8'),auth[_0xda82('0x5')](),controller[_0xda82('0xb')]);router[_0xda82('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xda82('0xd')]);module[_0xda82('0xe')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 852d851..2bad835 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 _0x1fa6=['ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','STRING'];(function(_0x47c902,_0x220fd2){var _0x1ad6a0=function(_0xf9fdb0){while(--_0xf9fdb0){_0x47c902['push'](_0x47c902['shift']());}};_0x1ad6a0(++_0x220fd2);}(_0x1fa6,0x197));var _0x61fa=function(_0x372ec9,_0x459793){_0x372ec9=_0x372ec9-0x0;var _0x276275=_0x1fa6[_0x372ec9];return _0x276275;};'use strict';var Sequelize=require(_0x61fa('0x0'));module[_0x61fa('0x1')]={'type':{'type':Sequelize['ENUM'](_0x61fa('0x2'),_0x61fa('0x3'),_0x61fa('0x4'),_0x61fa('0x5'),'picklist'),'defaultValue':_0x61fa('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x61fa('0x6')]},'keyType':{'type':Sequelize[_0x61fa('0x7')]('string',_0x61fa('0x3'),_0x61fa('0x4'))},'keyContent':{'type':Sequelize[_0x61fa('0x6')]},'idField':{'type':Sequelize[_0x61fa('0x6')]},'nameField':{'type':Sequelize[_0x61fa('0x6')]},'customField':{'type':Sequelize[_0x61fa('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8952=['picklist','STRING','ENUM','BOOLEAN','exports','string','variable','customVariable','keyValue'];(function(_0x1baef3,_0x48273d){var _0x448277=function(_0x27146b){while(--_0x27146b){_0x1baef3['push'](_0x1baef3['shift']());}};_0x448277(++_0x48273d);}(_0x8952,0x109));var _0x2895=function(_0x5e9c1c,_0x4532be){_0x5e9c1c=_0x5e9c1c-0x0;var _0x192fbe=_0x8952[_0x5e9c1c];return _0x192fbe;};'use strict';var Sequelize=require('sequelize');module[_0x2895('0x0')]={'type':{'type':Sequelize['ENUM'](_0x2895('0x1'),_0x2895('0x2'),_0x2895('0x3'),_0x2895('0x4'),_0x2895('0x5')),'defaultValue':_0x2895('0x1')},'content':{'type':Sequelize[_0x2895('0x6')]},'key':{'type':Sequelize[_0x2895('0x6')]},'keyType':{'type':Sequelize[_0x2895('0x7')](_0x2895('0x1'),'variable',_0x2895('0x3'))},'keyContent':{'type':Sequelize[_0x2895('0x6')]},'idField':{'type':Sequelize[_0x2895('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x2895('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2895('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 879f3a9..a9f5b5f 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 _0x0982=['show','params','rawAttributes','include','find','body','destroy','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','sendStatus','error','name','send','index','ServicenowField','fieldName','type','key','model','map','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','rows','catch'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x0982,0x1cf));var _0x2098=function(_0x78083,_0x4bdc4b){_0x78083=_0x78083-0x0;var _0x473eb3=_0x0982[_0x78083];return _0x473eb3;};'use strict';var emlformat=require(_0x2098('0x0'));var rimraf=require(_0x2098('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2098('0x2'));var moment=require(_0x2098('0x3'));var BPromise=require(_0x2098('0x4'));var Mustache=require('mustache');var util=require(_0x2098('0x5'));var path=require(_0x2098('0x6'));var sox=require(_0x2098('0x7'));var csv=require(_0x2098('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2098('0x9'));var _=require(_0x2098('0xa'));var squel=require(_0x2098('0xb'));var crypto=require(_0x2098('0xc'));var jsforce=require(_0x2098('0xd'));var deskjs=require(_0x2098('0xe'));var toCsv=require(_0x2098('0x8'));var querystring=require('querystring');var Papa=require(_0x2098('0xf'));var Redis=require(_0x2098('0x10'));var authService=require(_0x2098('0x11'));var qs=require(_0x2098('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2098('0x13'));var logger=require(_0x2098('0x14'))(_0x2098('0x15'));var utils=require(_0x2098('0x16'));var config=require(_0x2098('0x17'));var licenseUtil=require(_0x2098('0x18'));var db=require(_0x2098('0x19'))['db'];function respondWithStatusCode(_0x2e430d,_0x3076a0){_0x3076a0=_0x3076a0||0xcc;return function(_0x3eb708){if(_0x3eb708){return _0x2e430d['sendStatus'](_0x3076a0);}return _0x2e430d[_0x2098('0x1a')](_0x3076a0)[_0x2098('0x1b')]();};}function respondWithResult(_0x47bf7f,_0x3ed434){_0x3ed434=_0x3ed434||0xc8;return function(_0x5bf099){if(_0x5bf099){return _0x47bf7f[_0x2098('0x1a')](_0x3ed434)[_0x2098('0x1c')](_0x5bf099);}};}function respondWithFilteredResult(_0x2ff9e2,_0x1ff124){return function(_0x4ae8c9){if(_0x4ae8c9){var _0x1853d2=typeof _0x1ff124[_0x2098('0x1d')]===_0x2098('0x1e')&&typeof _0x1ff124[_0x2098('0x1f')]===_0x2098('0x1e');var _0x4facda=_0x4ae8c9[_0x2098('0x20')];var _0x46eea7=_0x1853d2?0x0:_0x1ff124['offset'];var _0x536ea5=_0x1853d2?_0x4ae8c9[_0x2098('0x20')]:_0x1ff124[_0x2098('0x1d')]+_0x1ff124[_0x2098('0x1f')];var _0x5b8a96;if(_0x536ea5>=_0x4facda){_0x536ea5=_0x4facda;_0x5b8a96=0xc8;}else{_0x5b8a96=0xce;}_0x2ff9e2[_0x2098('0x1a')](_0x5b8a96);return _0x2ff9e2[_0x2098('0x21')](_0x2098('0x22'),_0x46eea7+'-'+_0x536ea5+'/'+_0x4facda)[_0x2098('0x1c')](_0x4ae8c9);}return null;};}function patchUpdates(_0x3490f8){return function(_0x322309){try{jsonpatch['apply'](_0x322309,_0x3490f8,!![]);}catch(_0xa49d49){return BPromise['reject'](_0xa49d49);}return _0x322309[_0x2098('0x23')]();};}function saveUpdates(_0x397632,_0x4ba012){return function(_0x3d1fce){if(_0x3d1fce){return _0x3d1fce[_0x2098('0x24')](_0x397632)[_0x2098('0x25')](function(_0x50d8c4){return _0x50d8c4;});}return null;};}function removeEntity(_0x52f3d0,_0x179630){return function(_0x2e603b){if(_0x2e603b){return _0x2e603b['destroy']()[_0x2098('0x25')](function(){_0x52f3d0['status'](0xcc)[_0x2098('0x1b')]();});}};}function handleEntityNotFound(_0x17eaf5,_0x18c07d){return function(_0x578ef4){if(!_0x578ef4){_0x17eaf5[_0x2098('0x26')](0x194);}return _0x578ef4;};}function handleError(_0x2d29c1,_0x56686f){_0x56686f=_0x56686f||0x1f4;return function(_0x2c947f){logger[_0x2098('0x27')](_0x2c947f['stack']);if(_0x2c947f[_0x2098('0x28')]){delete _0x2c947f[_0x2098('0x28')];}_0x2d29c1[_0x2098('0x1a')](_0x56686f)[_0x2098('0x29')](_0x2c947f);};}exports[_0x2098('0x2a')]=function(_0x11dff2,_0x5d9168){var _0x1546b6={},_0x1a124c={},_0x46438e={'count':0x0,'rows':[]};var _0x3573f3=_['map'](db[_0x2098('0x2b')]['rawAttributes'],function(_0x42c5d0){return{'name':_0x42c5d0[_0x2098('0x2c')],'type':_0x42c5d0[_0x2098('0x2d')][_0x2098('0x2e')]};});_0x1a124c[_0x2098('0x2f')]=_[_0x2098('0x30')](_0x3573f3,_0x2098('0x28'));_0x1a124c['query']=_[_0x2098('0x31')](_0x11dff2[_0x2098('0x32')]);_0x1a124c['filters']=_[_0x2098('0x33')](_0x1a124c[_0x2098('0x2f')],_0x1a124c[_0x2098('0x32')]);_0x1546b6['attributes']=_[_0x2098('0x33')](_0x1a124c['model'],qs[_0x2098('0x34')](_0x11dff2['query']['fields']));_0x1546b6[_0x2098('0x35')]=_0x1546b6[_0x2098('0x35')][_0x2098('0x36')]?_0x1546b6[_0x2098('0x35')]:_0x1a124c[_0x2098('0x2f')];if(!_0x11dff2['query'][_0x2098('0x37')](_0x2098('0x38'))){_0x1546b6[_0x2098('0x1f')]=qs[_0x2098('0x1f')](_0x11dff2[_0x2098('0x32')][_0x2098('0x1f')]);_0x1546b6[_0x2098('0x1d')]=qs[_0x2098('0x1d')](_0x11dff2[_0x2098('0x32')][_0x2098('0x1d')]);}_0x1546b6[_0x2098('0x39')]=qs[_0x2098('0x3a')](_0x11dff2['query'][_0x2098('0x3a')]);_0x1546b6[_0x2098('0x3b')]=qs['filters'](_[_0x2098('0x3c')](_0x11dff2[_0x2098('0x32')],_0x1a124c[_0x2098('0x3d')]),_0x3573f3);if(_0x11dff2['query'][_0x2098('0x3e')]){_0x1546b6['where']=_[_0x2098('0x3f')](_0x1546b6[_0x2098('0x3b')],{'$or':_[_0x2098('0x30')](_0x3573f3,function(_0x30195a){if(_0x30195a[_0x2098('0x2d')]!==_0x2098('0x40')){var _0x35612f={};_0x35612f[_0x30195a['name']]={'$like':'%'+_0x11dff2[_0x2098('0x32')][_0x2098('0x3e')]+'%'};return _0x35612f;}})});}_0x1546b6=_[_0x2098('0x3f')]({},_0x1546b6,_0x11dff2[_0x2098('0x41')]);var _0x5b864c={'where':_0x1546b6[_0x2098('0x3b')]};return db[_0x2098('0x2b')]['count'](_0x5b864c)[_0x2098('0x25')](function(_0x116977){_0x46438e['count']=_0x116977;if(_0x11dff2[_0x2098('0x32')][_0x2098('0x42')]){_0x1546b6['include']=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x1546b6);})[_0x2098('0x25')](function(_0x4f3670){_0x46438e[_0x2098('0x43')]=_0x4f3670;return _0x46438e;})[_0x2098('0x25')](respondWithFilteredResult(_0x5d9168,_0x1546b6))[_0x2098('0x44')](handleError(_0x5d9168,null));};exports[_0x2098('0x45')]=function(_0x171d76,_0x16dfcb){var _0x47def5={'raw':!![],'where':{'id':_0x171d76[_0x2098('0x46')]['id']}},_0xbb3357={};_0xbb3357[_0x2098('0x2f')]=_[_0x2098('0x31')](db['ServicenowField'][_0x2098('0x47')]);_0xbb3357[_0x2098('0x32')]=_['keys'](_0x171d76['query']);_0xbb3357[_0x2098('0x3d')]=_['intersection'](_0xbb3357[_0x2098('0x2f')],_0xbb3357[_0x2098('0x32')]);_0x47def5[_0x2098('0x35')]=_[_0x2098('0x33')](_0xbb3357[_0x2098('0x2f')],qs[_0x2098('0x34')](_0x171d76[_0x2098('0x32')]['fields']));_0x47def5[_0x2098('0x35')]=_0x47def5[_0x2098('0x35')][_0x2098('0x36')]?_0x47def5[_0x2098('0x35')]:_0xbb3357[_0x2098('0x2f')];if(_0x171d76[_0x2098('0x32')][_0x2098('0x42')]){_0x47def5[_0x2098('0x48')]=[{'all':!![]}];}_0x47def5=_['merge']({},_0x47def5,_0x171d76[_0x2098('0x41')]);return db[_0x2098('0x2b')][_0x2098('0x49')](_0x47def5)[_0x2098('0x25')](handleEntityNotFound(_0x16dfcb,null))[_0x2098('0x25')](respondWithResult(_0x16dfcb,null))['catch'](handleError(_0x16dfcb,null));};exports['create']=function(_0x2bbda8,_0x1a93e9){return db[_0x2098('0x2b')]['create'](_0x2bbda8['body'],{})[_0x2098('0x25')](respondWithResult(_0x1a93e9,0xc9))[_0x2098('0x44')](handleError(_0x1a93e9,null));};exports['update']=function(_0x24b75d,_0x820020){if(_0x24b75d['body']['id']){delete _0x24b75d[_0x2098('0x4a')]['id'];}return db[_0x2098('0x2b')][_0x2098('0x49')]({'where':{'id':_0x24b75d[_0x2098('0x46')]['id']}})[_0x2098('0x25')](handleEntityNotFound(_0x820020,null))[_0x2098('0x25')](saveUpdates(_0x24b75d[_0x2098('0x4a')],null))[_0x2098('0x25')](respondWithResult(_0x820020,null))[_0x2098('0x44')](handleError(_0x820020,null));};exports[_0x2098('0x4b')]=function(_0x5da81c,_0x513d9f){return db[_0x2098('0x2b')][_0x2098('0x49')]({'where':{'id':_0x5da81c[_0x2098('0x46')]['id']}})['then'](handleEntityNotFound(_0x513d9f,null))['then'](removeEntity(_0x513d9f,null))['catch'](handleError(_0x513d9f,null));}; \ No newline at end of file +var _0x59a9=['catch','show','params','keys','attributes','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','apply','reject','save','update','then','destroy','error','stack','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','name','query','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include'];(function(_0x801859,_0x52a490){var _0x4e04e7=function(_0x4c5ea4){while(--_0x4c5ea4){_0x801859['push'](_0x801859['shift']());}};_0x4e04e7(++_0x52a490);}(_0x59a9,0x1be));var _0x959a=function(_0x5d678d,_0x59449d){_0x5d678d=_0x5d678d-0x0;var _0xa2d580=_0x59a9[_0x5d678d];return _0xa2d580;};'use strict';var emlformat=require(_0x959a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x959a('0x1'));var jsonpatch=require(_0x959a('0x2'));var rp=require(_0x959a('0x3'));var moment=require(_0x959a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x959a('0x5'));var path=require(_0x959a('0x6'));var sox=require(_0x959a('0x7'));var csv=require(_0x959a('0x8'));var ejs=require(_0x959a('0x9'));var fs=require('fs');var fs_extra=require(_0x959a('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x959a('0xb'));var jsforce=require(_0x959a('0xc'));var deskjs=require(_0x959a('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x959a('0xe'));var Redis=require(_0x959a('0xf'));var authService=require(_0x959a('0x10'));var qs=require(_0x959a('0x11'));var as=require(_0x959a('0x12'));var hardwareService=require(_0x959a('0x13'));var logger=require('../../config/logger')(_0x959a('0x14'));var utils=require('../../config/utils');var config=require(_0x959a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x959a('0x16'))['db'];function respondWithStatusCode(_0x317e8f,_0x3cb6ec){_0x3cb6ec=_0x3cb6ec||0xcc;return function(_0x25d1e7){if(_0x25d1e7){return _0x317e8f[_0x959a('0x17')](_0x3cb6ec);}return _0x317e8f[_0x959a('0x18')](_0x3cb6ec)[_0x959a('0x19')]();};}function respondWithResult(_0x1b41ea,_0x5c36b7){_0x5c36b7=_0x5c36b7||0xc8;return function(_0x121885){if(_0x121885){return _0x1b41ea['status'](_0x5c36b7)[_0x959a('0x1a')](_0x121885);}};}function respondWithFilteredResult(_0x247812,_0x1ab7e7){return function(_0x1f9a3b){if(_0x1f9a3b){var _0x3ca831=typeof _0x1ab7e7['offset']===_0x959a('0x1b')&&typeof _0x1ab7e7[_0x959a('0x1c')]===_0x959a('0x1b');var _0x332ef9=_0x1f9a3b['count'];var _0x566e97=_0x3ca831?0x0:_0x1ab7e7[_0x959a('0x1d')];var _0x23977c=_0x3ca831?_0x1f9a3b[_0x959a('0x1e')]:_0x1ab7e7[_0x959a('0x1d')]+_0x1ab7e7[_0x959a('0x1c')];var _0x2fc534;if(_0x23977c>=_0x332ef9){_0x23977c=_0x332ef9;_0x2fc534=0xc8;}else{_0x2fc534=0xce;}_0x247812[_0x959a('0x18')](_0x2fc534);return _0x247812['set']('Content-Range',_0x566e97+'-'+_0x23977c+'/'+_0x332ef9)[_0x959a('0x1a')](_0x1f9a3b);}return null;};}function patchUpdates(_0xf21cbe){return function(_0x64705){try{jsonpatch[_0x959a('0x1f')](_0x64705,_0xf21cbe,!![]);}catch(_0x253442){return BPromise[_0x959a('0x20')](_0x253442);}return _0x64705[_0x959a('0x21')]();};}function saveUpdates(_0x243ae5,_0x7cac77){return function(_0x3c43e3){if(_0x3c43e3){return _0x3c43e3[_0x959a('0x22')](_0x243ae5)[_0x959a('0x23')](function(_0x36dd9f){return _0x36dd9f;});}return null;};}function removeEntity(_0x1ffc70,_0x4bff95){return function(_0x3c4939){if(_0x3c4939){return _0x3c4939[_0x959a('0x24')]()[_0x959a('0x23')](function(){_0x1ffc70[_0x959a('0x18')](0xcc)[_0x959a('0x19')]();});}};}function handleEntityNotFound(_0x409055,_0x2a6971){return function(_0x57a8ce){if(!_0x57a8ce){_0x409055[_0x959a('0x17')](0x194);}return _0x57a8ce;};}function handleError(_0x19eed3,_0x429216){_0x429216=_0x429216||0x1f4;return function(_0x2888c9){logger[_0x959a('0x25')](_0x2888c9[_0x959a('0x26')]);if(_0x2888c9['name']){delete _0x2888c9['name'];}_0x19eed3[_0x959a('0x18')](_0x429216)[_0x959a('0x27')](_0x2888c9);};}exports[_0x959a('0x28')]=function(_0x41d7ca,_0x249aa1){var _0x5571a3={},_0x1c7c4c={},_0x2e3daa={'count':0x0,'rows':[]};var _0x157d97=_[_0x959a('0x29')](db[_0x959a('0x2a')][_0x959a('0x2b')],function(_0x516aec){return{'name':_0x516aec[_0x959a('0x2c')],'type':_0x516aec[_0x959a('0x2d')][_0x959a('0x2e')]};});_0x1c7c4c[_0x959a('0x2f')]=_[_0x959a('0x29')](_0x157d97,_0x959a('0x30'));_0x1c7c4c[_0x959a('0x31')]=_['keys'](_0x41d7ca[_0x959a('0x31')]);_0x1c7c4c['filters']=_[_0x959a('0x32')](_0x1c7c4c[_0x959a('0x2f')],_0x1c7c4c[_0x959a('0x31')]);_0x5571a3['attributes']=_[_0x959a('0x32')](_0x1c7c4c['model'],qs[_0x959a('0x33')](_0x41d7ca[_0x959a('0x31')][_0x959a('0x33')]));_0x5571a3['attributes']=_0x5571a3['attributes'][_0x959a('0x34')]?_0x5571a3['attributes']:_0x1c7c4c[_0x959a('0x2f')];if(!_0x41d7ca[_0x959a('0x31')][_0x959a('0x35')](_0x959a('0x36'))){_0x5571a3[_0x959a('0x1c')]=qs[_0x959a('0x1c')](_0x41d7ca[_0x959a('0x31')][_0x959a('0x1c')]);_0x5571a3['offset']=qs[_0x959a('0x1d')](_0x41d7ca['query']['offset']);}_0x5571a3['order']=qs['sort'](_0x41d7ca[_0x959a('0x31')][_0x959a('0x37')]);_0x5571a3['where']=qs[_0x959a('0x38')](_[_0x959a('0x39')](_0x41d7ca['query'],_0x1c7c4c[_0x959a('0x38')]),_0x157d97);if(_0x41d7ca[_0x959a('0x31')][_0x959a('0x3a')]){_0x5571a3[_0x959a('0x3b')]=_[_0x959a('0x3c')](_0x5571a3['where'],{'$or':_[_0x959a('0x29')](_0x157d97,function(_0x1777a8){if(_0x1777a8[_0x959a('0x2d')]!==_0x959a('0x3d')){var _0x8e30a4={};_0x8e30a4[_0x1777a8[_0x959a('0x30')]]={'$like':'%'+_0x41d7ca[_0x959a('0x31')][_0x959a('0x3a')]+'%'};return _0x8e30a4;}})});}_0x5571a3=_[_0x959a('0x3c')]({},_0x5571a3,_0x41d7ca[_0x959a('0x3e')]);var _0x4a0a9f={'where':_0x5571a3['where']};return db[_0x959a('0x2a')]['count'](_0x4a0a9f)[_0x959a('0x23')](function(_0x2f666d){_0x2e3daa[_0x959a('0x1e')]=_0x2f666d;if(_0x41d7ca[_0x959a('0x31')][_0x959a('0x3f')]){_0x5571a3[_0x959a('0x40')]=[{'all':!![]}];}return db[_0x959a('0x2a')]['findAll'](_0x5571a3);})['then'](function(_0x2d927b){_0x2e3daa['rows']=_0x2d927b;return _0x2e3daa;})[_0x959a('0x23')](respondWithFilteredResult(_0x249aa1,_0x5571a3))[_0x959a('0x41')](handleError(_0x249aa1,null));};exports[_0x959a('0x42')]=function(_0x168e85,_0x9347ac){var _0x3c6fa9={'raw':!![],'where':{'id':_0x168e85[_0x959a('0x43')]['id']}},_0x557dad={};_0x557dad[_0x959a('0x2f')]=_['keys'](db[_0x959a('0x2a')][_0x959a('0x2b')]);_0x557dad[_0x959a('0x31')]=_[_0x959a('0x44')](_0x168e85[_0x959a('0x31')]);_0x557dad[_0x959a('0x38')]=_['intersection'](_0x557dad[_0x959a('0x2f')],_0x557dad[_0x959a('0x31')]);_0x3c6fa9[_0x959a('0x45')]=_[_0x959a('0x32')](_0x557dad['model'],qs['fields'](_0x168e85[_0x959a('0x31')][_0x959a('0x33')]));_0x3c6fa9[_0x959a('0x45')]=_0x3c6fa9[_0x959a('0x45')]['length']?_0x3c6fa9[_0x959a('0x45')]:_0x557dad[_0x959a('0x2f')];if(_0x168e85['query'][_0x959a('0x3f')]){_0x3c6fa9[_0x959a('0x40')]=[{'all':!![]}];}_0x3c6fa9=_[_0x959a('0x3c')]({},_0x3c6fa9,_0x168e85[_0x959a('0x3e')]);return db[_0x959a('0x2a')]['find'](_0x3c6fa9)['then'](handleEntityNotFound(_0x9347ac,null))[_0x959a('0x23')](respondWithResult(_0x9347ac,null))[_0x959a('0x41')](handleError(_0x9347ac,null));};exports['create']=function(_0x1cff58,_0x5e3f76){return db['ServicenowField'][_0x959a('0x46')](_0x1cff58[_0x959a('0x47')],{})[_0x959a('0x23')](respondWithResult(_0x5e3f76,0xc9))[_0x959a('0x41')](handleError(_0x5e3f76,null));};exports[_0x959a('0x22')]=function(_0x32580a,_0x14a4d0){if(_0x32580a[_0x959a('0x47')]['id']){delete _0x32580a[_0x959a('0x47')]['id'];}return db[_0x959a('0x2a')][_0x959a('0x48')]({'where':{'id':_0x32580a['params']['id']}})['then'](handleEntityNotFound(_0x14a4d0,null))[_0x959a('0x23')](saveUpdates(_0x32580a[_0x959a('0x47')],null))[_0x959a('0x23')](respondWithResult(_0x14a4d0,null))[_0x959a('0x41')](handleError(_0x14a4d0,null));};exports[_0x959a('0x24')]=function(_0x7f70d5,_0x4c2051){return db[_0x959a('0x2a')]['find']({'where':{'id':_0x7f70d5[_0x959a('0x43')]['id']}})['then'](handleEntityNotFound(_0x4c2051,null))[_0x959a('0x23')](removeEntity(_0x4c2051,null))[_0x959a('0x41')](handleError(_0x4c2051,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 0760414..e47bd86 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 _0x9fc2=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x9fc2,0xec));var _0x29fc=function(_0xe12368,_0x5ec6e7){_0xe12368=_0xe12368-0x0;var _0x2f541c=_0x9fc2[_0xe12368];return _0x2f541c;};'use strict';var _=require(_0x29fc('0x0'));var util=require(_0x29fc('0x1'));var logger=require(_0x29fc('0x2'))(_0x29fc('0x3'));var moment=require(_0x29fc('0x4'));var BPromise=require('bluebird');var rp=require(_0x29fc('0x5'));var fs=require('fs');var path=require(_0x29fc('0x6'));var rimraf=require(_0x29fc('0x7'));var config=require(_0x29fc('0x8'));var attributes=require(_0x29fc('0x9'));module[_0x29fc('0xa')]=function(_0x19e176,_0x341b03){return _0x19e176[_0x29fc('0xb')](_0x29fc('0xc'),attributes,{'tableName':_0x29fc('0xd'),'paranoid':![],'indexes':[{'name':_0x29fc('0xe'),'fields':[_0x29fc('0xf'),_0x29fc('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8fb7=['bluebird','path','rimraf','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x8fb7,0x13b));var _0x78fb=function(_0x23863b,_0x328aea){_0x23863b=_0x23863b-0x0;var _0x2b84fc=_0x8fb7[_0x23863b];return _0x2b84fc;};'use strict';var _=require(_0x78fb('0x0'));var util=require(_0x78fb('0x1'));var logger=require(_0x78fb('0x2'))(_0x78fb('0x3'));var moment=require(_0x78fb('0x4'));var BPromise=require(_0x78fb('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x78fb('0x6'));var rimraf=require(_0x78fb('0x7'));var config=require('../../config/environment');var attributes=require(_0x78fb('0x8'));module[_0x78fb('0x9')]=function(_0x3a0266,_0x5d6075){return _0x3a0266[_0x78fb('0xa')](_0x78fb('0xb'),attributes,{'tableName':_0x78fb('0xc'),'paranoid':![],'indexes':[{'name':_0x78fb('0xd'),'fields':[_0x78fb('0xe'),_0x78fb('0xf')],'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 4adfe47..65a4d36 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 _0xa9e0=['http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x387caa,_0x48bb57){var _0x54c738=function(_0x295c8a){while(--_0x295c8a){_0x387caa['push'](_0x387caa['shift']());}};_0x54c738(++_0x48bb57);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0x9ffd=['ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x7f6bb,_0x1fd536){var _0x2c1c57=function(_0x551b05){while(--_0x551b05){_0x7f6bb['push'](_0x7f6bb['shift']());}};_0x2c1c57(++_0x1fd536);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x5cc115,_0x25b640){_0x5cc115=_0x5cc115-0x0;var _0x5817ea=_0x9ffd[_0x5cc115];return _0x5817ea;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index a4acc1e..73e6c6c 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(_0x35a5cd,_0x497d7b){var _0x5e1c9c=function(_0x438ebc){while(--_0x438ebc){_0x35a5cd['push'](_0x35a5cd['shift']());}};_0x5e1c9c(++_0x497d7b);}(_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('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(_0x25efc8,_0x3443e0){var _0x52e34d=function(_0xd5679b){while(--_0xd5679b){_0x25efc8['push'](_0x25efc8['shift']());}};_0x52e34d(++_0x3443e0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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 9e9ad4a..1795c40 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(_0x2e22e5,_0x4c2356){var _0x20c4e5=function(_0x4b9999){while(--_0x4b9999){_0x2e22e5['push'](_0x2e22e5['shift']());}};_0x20c4e5(++_0x4c2356);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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(_0x2f6b3f,_0x2f68a0){var _0x10893f=function(_0xf41aea){while(--_0xf41aea){_0x2f6b3f['push'](_0x2f6b3f['shift']());}};_0x10893f(++_0x2f68a0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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 d7df695..bd3e7cf 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 _0x5df9=['key','model','keys','query','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','SugarcrmAccount','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','parent_type','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','Calls','module_fields','remove','includes','label','endsWith','values','value','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','type'];(function(_0x544099,_0x372b30){var _0x20ab09=function(_0x149613){while(--_0x149613){_0x544099['push'](_0x544099['shift']());}};_0x20ab09(++_0x372b30);}(_0x5df9,0x152));var _0x95df=function(_0x4da681,_0x3df36e){_0x4da681=_0x4da681-0x0;var _0x2e378d=_0x5df9[_0x4da681];return _0x2e378d;};'use strict';var emlformat=require(_0x95df('0x0'));var rimraf=require(_0x95df('0x1'));var zipdir=require(_0x95df('0x2'));var jsonpatch=require(_0x95df('0x3'));var rp=require(_0x95df('0x4'));var moment=require('moment');var BPromise=require(_0x95df('0x5'));var Mustache=require(_0x95df('0x6'));var util=require(_0x95df('0x7'));var path=require(_0x95df('0x8'));var sox=require(_0x95df('0x9'));var csv=require(_0x95df('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x95df('0xb'));var _=require('lodash');var squel=require(_0x95df('0xc'));var crypto=require(_0x95df('0xd'));var jsforce=require(_0x95df('0xe'));var deskjs=require(_0x95df('0xf'));var toCsv=require(_0x95df('0xa'));var querystring=require(_0x95df('0x10'));var Papa=require('papaparse');var Redis=require(_0x95df('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x95df('0x12'));var as=require(_0x95df('0x13'));var hardwareService=require(_0x95df('0x14'));var logger=require(_0x95df('0x15'))(_0x95df('0x16'));var utils=require(_0x95df('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x95df('0x18'));var db=require(_0x95df('0x19'))['db'];var integrations=require(_0x95df('0x1a'));function respondWithStatusCode(_0x5750c6,_0x4e2486){_0x4e2486=_0x4e2486||0xcc;return function(_0x378da5){if(_0x378da5){return _0x5750c6[_0x95df('0x1b')](_0x4e2486);}return _0x5750c6[_0x95df('0x1c')](_0x4e2486)[_0x95df('0x1d')]();};}function respondWithResult(_0x23f1bb,_0x3710b7){_0x3710b7=_0x3710b7||0xc8;return function(_0x4ca51d){if(_0x4ca51d){return _0x23f1bb[_0x95df('0x1c')](_0x3710b7)[_0x95df('0x1e')](_0x4ca51d);}};}function respondWithFilteredResult(_0x291715,_0x57bbec){return function(_0x1783aa){if(_0x1783aa){var _0x503a4b=typeof _0x57bbec[_0x95df('0x1f')]===_0x95df('0x20')&&typeof _0x57bbec[_0x95df('0x21')]===_0x95df('0x20');var _0x753158=_0x1783aa[_0x95df('0x22')];var _0x12c543=_0x503a4b?0x0:_0x57bbec[_0x95df('0x1f')];var _0xfa0fe9=_0x503a4b?_0x1783aa['count']:_0x57bbec[_0x95df('0x1f')]+_0x57bbec[_0x95df('0x21')];var _0x443fd2;if(_0xfa0fe9>=_0x753158){_0xfa0fe9=_0x753158;_0x443fd2=0xc8;}else{_0x443fd2=0xce;}_0x291715['status'](_0x443fd2);return _0x291715['set'](_0x95df('0x23'),_0x12c543+'-'+_0xfa0fe9+'/'+_0x753158)[_0x95df('0x1e')](_0x1783aa);}return null;};}function patchUpdates(_0xd423c2){return function(_0x248d21){try{jsonpatch[_0x95df('0x24')](_0x248d21,_0xd423c2,!![]);}catch(_0x1e80c3){return BPromise[_0x95df('0x25')](_0x1e80c3);}return _0x248d21[_0x95df('0x26')]();};}function saveUpdates(_0x2493ad,_0x60000d){return function(_0xf86857){if(_0xf86857){return _0xf86857[_0x95df('0x27')](_0x2493ad)[_0x95df('0x28')](function(_0x47999a){return _0x47999a;});}return null;};}function removeEntity(_0x2bce93,_0x1aaf5c){return function(_0x386e29){if(_0x386e29){return _0x386e29[_0x95df('0x29')]()[_0x95df('0x28')](function(){_0x2bce93[_0x95df('0x1c')](0xcc)[_0x95df('0x1d')]();});}};}function handleEntityNotFound(_0x5b13ad,_0x4ce42f){return function(_0x464bab){if(!_0x464bab){_0x5b13ad['sendStatus'](0x194);}return _0x464bab;};}function handleError(_0x200428,_0x5f3357){_0x5f3357=_0x5f3357||0x1f4;return function(_0x1f9194){logger['error'](_0x1f9194[_0x95df('0x2a')]);if(_0x1f9194[_0x95df('0x2b')]){delete _0x1f9194[_0x95df('0x2b')];}_0x200428['status'](_0x5f3357)[_0x95df('0x2c')](_0x1f9194);};}exports['index']=function(_0x19c18b,_0x12d50f){var _0x283ec1={},_0x20fe65={},_0x34f4f2={'count':0x0,'rows':[]};var _0x35f8ab=_[_0x95df('0x2d')](db['SugarcrmAccount'][_0x95df('0x2e')],function(_0x105003){return{'name':_0x105003[_0x95df('0x2f')],'type':_0x105003[_0x95df('0x30')][_0x95df('0x31')]};});_0x20fe65[_0x95df('0x32')]=_['map'](_0x35f8ab,_0x95df('0x2b'));_0x20fe65['query']=_[_0x95df('0x33')](_0x19c18b[_0x95df('0x34')]);_0x20fe65['filters']=_[_0x95df('0x35')](_0x20fe65[_0x95df('0x32')],_0x20fe65[_0x95df('0x34')]);_0x283ec1['attributes']=_['intersection'](_0x20fe65[_0x95df('0x32')],qs[_0x95df('0x36')](_0x19c18b[_0x95df('0x34')][_0x95df('0x36')]));_0x283ec1['attributes']=_0x283ec1['attributes'][_0x95df('0x37')]?_0x283ec1[_0x95df('0x38')]:_0x20fe65[_0x95df('0x32')];if(!_0x19c18b[_0x95df('0x34')][_0x95df('0x39')](_0x95df('0x3a'))){_0x283ec1[_0x95df('0x21')]=qs[_0x95df('0x21')](_0x19c18b[_0x95df('0x34')][_0x95df('0x21')]);_0x283ec1[_0x95df('0x1f')]=qs[_0x95df('0x1f')](_0x19c18b['query'][_0x95df('0x1f')]);}_0x283ec1[_0x95df('0x3b')]=qs[_0x95df('0x3c')](_0x19c18b[_0x95df('0x34')][_0x95df('0x3c')]);_0x283ec1[_0x95df('0x3d')]=qs[_0x95df('0x3e')](_[_0x95df('0x3f')](_0x19c18b[_0x95df('0x34')],_0x20fe65['filters']),_0x35f8ab);if(_0x19c18b[_0x95df('0x34')][_0x95df('0x40')]){_0x283ec1[_0x95df('0x3d')]=_['merge'](_0x283ec1[_0x95df('0x3d')],{'$or':_[_0x95df('0x2d')](_0x35f8ab,function(_0x3c4142){if(_0x3c4142[_0x95df('0x30')]!==_0x95df('0x41')){var _0xaf06b={};_0xaf06b[_0x3c4142[_0x95df('0x2b')]]={'$like':'%'+_0x19c18b[_0x95df('0x34')]['filter']+'%'};return _0xaf06b;}})});}_0x283ec1=_[_0x95df('0x42')]({},_0x283ec1,_0x19c18b[_0x95df('0x43')]);var _0x165948={'where':_0x283ec1[_0x95df('0x3d')]};return db[_0x95df('0x44')][_0x95df('0x22')](_0x165948)[_0x95df('0x28')](function(_0x321303){_0x34f4f2[_0x95df('0x22')]=_0x321303;if(_0x19c18b[_0x95df('0x34')][_0x95df('0x45')]){_0x283ec1[_0x95df('0x46')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x95df('0x47')](_0x283ec1);})['then'](function(_0x311f3d){_0x34f4f2[_0x95df('0x48')]=_0x311f3d;return _0x34f4f2;})[_0x95df('0x28')](respondWithFilteredResult(_0x12d50f,_0x283ec1))[_0x95df('0x49')](handleError(_0x12d50f,null));};exports[_0x95df('0x4a')]=function(_0x226585,_0x1b28d8){var _0x1f78e7={'raw':![],'where':{'id':_0x226585[_0x95df('0x4b')]['id']}},_0x457d3f={};_0x457d3f['model']=_[_0x95df('0x33')](db[_0x95df('0x44')][_0x95df('0x2e')]);_0x457d3f[_0x95df('0x34')]=_[_0x95df('0x33')](_0x226585[_0x95df('0x34')]);_0x457d3f['filters']=_[_0x95df('0x35')](_0x457d3f[_0x95df('0x32')],_0x457d3f[_0x95df('0x34')]);_0x1f78e7[_0x95df('0x38')]=_[_0x95df('0x35')](_0x457d3f[_0x95df('0x32')],qs['fields'](_0x226585[_0x95df('0x34')]['fields']));_0x1f78e7[_0x95df('0x38')]=_0x1f78e7[_0x95df('0x38')]['length']?_0x1f78e7[_0x95df('0x38')]:_0x457d3f[_0x95df('0x32')];if(_0x226585[_0x95df('0x34')][_0x95df('0x45')]){_0x1f78e7[_0x95df('0x46')]=[{'all':!![]}];}_0x1f78e7=_[_0x95df('0x42')]({},_0x1f78e7,_0x226585[_0x95df('0x43')]);return db['SugarcrmAccount'][_0x95df('0x4c')](_0x1f78e7)[_0x95df('0x28')](handleEntityNotFound(_0x1b28d8,null))[_0x95df('0x28')](respondWithResult(_0x1b28d8,null))[_0x95df('0x49')](handleError(_0x1b28d8,null));};exports[_0x95df('0x4d')]=function(_0x6f53c2,_0x2e7951){return db['SugarcrmAccount'][_0x95df('0x4d')](_0x6f53c2[_0x95df('0x4e')],{})[_0x95df('0x28')](respondWithResult(_0x2e7951,0xc9))[_0x95df('0x49')](handleError(_0x2e7951,null));};exports[_0x95df('0x27')]=function(_0x49e87e,_0x41283f){if(_0x49e87e[_0x95df('0x4e')]['id']){delete _0x49e87e[_0x95df('0x4e')]['id'];}return db[_0x95df('0x44')][_0x95df('0x4c')]({'where':{'id':_0x49e87e[_0x95df('0x4b')]['id']}})[_0x95df('0x28')](handleEntityNotFound(_0x41283f,null))[_0x95df('0x28')](saveUpdates(_0x49e87e[_0x95df('0x4e')],null))['then'](respondWithResult(_0x41283f,null))[_0x95df('0x49')](handleError(_0x41283f,null));};exports[_0x95df('0x29')]=function(_0xcf400c,_0x4c2e3e){return db[_0x95df('0x44')]['find']({'where':{'id':_0xcf400c['params']['id']}})['then'](handleEntityNotFound(_0x4c2e3e,null))['then'](removeEntity(_0x4c2e3e,null))[_0x95df('0x49')](handleError(_0x4c2e3e,null));};exports[_0x95df('0x4f')]=function(_0x464866,_0xebf52b,_0xb4402b){var _0x365eff={};var _0x4c91d9={};var _0x4f92bf;var _0xaa10b1;return db[_0x95df('0x44')][_0x95df('0x50')]({'where':{'id':_0x464866[_0x95df('0x4b')]['id']}})[_0x95df('0x28')](handleEntityNotFound(_0xebf52b,null))[_0x95df('0x28')](function(_0xba3855){if(_0xba3855){_0x4f92bf=_0xba3855;_0x4c91d9[_0x95df('0x32')]=_[_0x95df('0x33')](db[_0x95df('0x51')][_0x95df('0x2e')]);_0x4c91d9[_0x95df('0x34')]=_[_0x95df('0x33')](_0x464866['query']);_0x4c91d9['filters']=_[_0x95df('0x35')](_0x4c91d9[_0x95df('0x32')],_0x4c91d9[_0x95df('0x34')]);_0x365eff[_0x95df('0x38')]=_[_0x95df('0x35')](_0x4c91d9['model'],qs[_0x95df('0x36')](_0x464866[_0x95df('0x34')]['fields']));_0x365eff['attributes']=_0x365eff[_0x95df('0x38')][_0x95df('0x37')]?_0x365eff[_0x95df('0x38')]:_0x4c91d9[_0x95df('0x32')];_0x365eff[_0x95df('0x3b')]=qs[_0x95df('0x3c')](_0x464866[_0x95df('0x34')]['sort']);_0x365eff[_0x95df('0x3d')]=qs[_0x95df('0x3e')](_['pick'](_0x464866[_0x95df('0x34')],_0x4c91d9[_0x95df('0x3e')]));if(_0x464866[_0x95df('0x34')][_0x95df('0x40')]){_0x365eff[_0x95df('0x3d')]=_[_0x95df('0x42')](_0x365eff['where'],{'$or':_[_0x95df('0x2d')](_0x365eff['attributes'],function(_0x1be7d6){var _0x3fc06b={};_0x3fc06b[_0x1be7d6]={'$like':'%'+_0x464866[_0x95df('0x34')][_0x95df('0x40')]+'%'};return _0x3fc06b;})});}_0x365eff=_['merge']({},_0x365eff,_0x464866[_0x95df('0x43')]);return _0x4f92bf[_0x95df('0x4f')](_0x365eff);}})[_0x95df('0x28')](function(_0x292d39){if(_0x292d39){_0xaa10b1=_0x292d39[_0x95df('0x37')];if(!_0x464866[_0x95df('0x34')][_0x95df('0x39')](_0x95df('0x3a'))){_0x365eff[_0x95df('0x21')]=qs['limit'](_0x464866['query'][_0x95df('0x21')]);_0x365eff[_0x95df('0x1f')]=qs[_0x95df('0x1f')](_0x464866[_0x95df('0x34')][_0x95df('0x1f')]);}return _0x4f92bf[_0x95df('0x4f')](_0x365eff);}})[_0x95df('0x28')](function(_0x5e6157){if(_0x5e6157){return _0x5e6157?{'count':_0xaa10b1,'rows':_0x5e6157}:null;}})[_0x95df('0x28')](respondWithResult(_0xebf52b,null))[_0x95df('0x49')](handleError(_0xebf52b,null));};exports[_0x95df('0x52')]=function(_0x306943,_0x54e693,_0x7eee8e){if(_0x306943[_0x95df('0x4e')]['id']){delete _0x306943[_0x95df('0x4e')]['id'];}return db[_0x95df('0x44')]['findOne']({'where':{'id':_0x306943[_0x95df('0x4b')]['id']}})['then'](handleEntityNotFound(_0x54e693,null))[_0x95df('0x28')](function(_0x485b0a){if(_0x485b0a){_0x306943['body'][_0x95df('0x53')]=_0x485b0a['id'];_0x306943[_0x95df('0x4e')][_0x95df('0x54')]=integrations[_0x95df('0x55')](_0x306943[_0x95df('0x4e')][_0x95df('0x56')],_0x306943[_0x95df('0x4e')]['type']);_0x306943[_0x95df('0x4e')][_0x95df('0x57')]=integrations[_0x95df('0x58')](_0x306943[_0x95df('0x4e')]['channel'],_0x306943[_0x95df('0x4e')]['type']);return db[_0x95df('0x51')][_0x95df('0x4d')](_0x306943[_0x95df('0x4e')],{'include':[{'model':db[_0x95df('0x59')],'as':_0x95df('0x54')},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})[_0x95df('0x28')](respondWithResult(_0x54e693,null))[_0x95df('0x49')](handleError(_0x54e693,null));};exports[_0x95df('0x5a')]=function(_0x4f0edf,_0x3576b3,_0xd7507c){var _0x29c4c1='';var _0x388612=['id','name',_0x95df('0x5b'),_0x95df('0x5c'),_0x95df('0x5d'),_0x95df('0x5e'),_0x95df('0x5f'),'duration_minutes','parent_id',_0x95df('0x60'),_0x95df('0x61'),_0x95df('0x62')];return db[_0x95df('0x44')][_0x95df('0x50')]({'where':{'id':_0x4f0edf[_0x95df('0x4b')]['id']},'attributes':['id',_0x95df('0x63'),'password',_0x95df('0x64')]})[_0x95df('0x28')](handleEntityNotFound(_0x3576b3,null))[_0x95df('0x28')](function(_0x59be38){if(_0x59be38){_0x29c4c1=_0x59be38[_0x95df('0x64')];var _0x35282f=_0x29c4c1[_0x95df('0x65')](-0x1);if(_0x35282f==='/'){_0x29c4c1=_0x29c4c1[_0x95df('0x66')](0x0,_0x29c4c1[_0x95df('0x67')](_0x35282f));}return rp({'method':_0x95df('0x68'),'uri':util[_0x95df('0x69')](_0x95df('0x6a'),_0x29c4c1,_0x95df('0x6b')),'json':!![],'form':{'method':_0x95df('0x6c'),'input_type':_0x95df('0x6d'),'response_type':_0x95df('0x6d'),'rest_data':JSON[_0x95df('0x6e')]({'user_auth':{'user_name':_0x59be38[_0x95df('0x63')],'password':_0x59be38[_0x95df('0x6f')],'encryption':_0x95df('0x70')},'application':_0x95df('0x71')})}});}})[_0x95df('0x28')](function(_0x1513b5){if(_0x1513b5&&_0x1513b5['name']!==_0x95df('0x72')&&_0x1513b5[_0x95df('0x2b')]!==_0x95df('0x73')){return rp({'method':_0x95df('0x68'),'uri':util['format']('%s%s',_0x29c4c1,_0x95df('0x6b')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x95df('0x6d'),'response_type':_0x95df('0x6d'),'rest_data':JSON[_0x95df('0x6e')]({'session':_0x1513b5['id'],'module_name':_0x95df('0x74')})}})[_0x95df('0x28')](function(_0x247804){if(_0x247804){var _0x4a3116=_['values'](_0x247804[_0x95df('0x75')]);_[_0x95df('0x76')](_0x4a3116,function(_0xacd9cd){return _0x388612[_0x95df('0x77')](_0xacd9cd[_0x95df('0x2b')]);});return{'count':_0x4a3116[_0x95df('0x37')],'rows':_[_0x95df('0x2d')](_0x4a3116,function(_0x2bdae8){return{'id':_0x2bdae8['name'],'name':_0x2bdae8[_0x95df('0x78')],'custom':_[_0x95df('0x79')](_0x2bdae8[_0x95df('0x2b')],'_c')?!![]:![],'options':_0x2bdae8[_0x95df('0x43')]?_['map'](_[_0x95df('0x7a')](_0x2bdae8[_0x95df('0x43')]),function(_0x30bdf3){return{'name':_0x30bdf3[_0x95df('0x7b')],'value':_0x30bdf3['name']};}):[]};})};}})[_0x95df('0x28')](respondWithResult(_0x3576b3,null))[_0x95df('0x49')](function(_0x4757d9){var _0x39993f=_0x4f0edf[_0x95df('0x34')][_0x95df('0x7c')]?0x1f4:_0x4757d9[_0x95df('0x7d')]||0x1f4;logger[_0x95df('0x7e')](_0x95df('0x7f'),_0x95df('0x5a'),_0x39993f,JSON[_0x95df('0x6e')](_0x4757d9));delete _0x4757d9['name'];if(_0x39993f===0x191){_0x39993f=0x190;}_0x3576b3[_0x95df('0x1c')](_0x39993f)[_0x95df('0x2c')](_0x4f0edf[_0x95df('0x34')][_0x95df('0x7c')]?{'message':_0x95df('0x80'),'statusCode':_0x4757d9[_0x95df('0x7d')]}:_0x4757d9);});}else{var _0x451ec1=0x1f4;_0x3576b3[_0x95df('0x1c')](_0x451ec1)[_0x95df('0x2c')]({'message':_0x95df('0x80'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xcca1=['hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','SugarcrmConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getDescriptions','channel','SugarcrmField','getFields','assigned_user_id','description','date_start','duration_hours','parent_id','parent_name','slice','lastIndexOf','POST','format','/service/v4_1/rest.php','login','JSON','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','module_fields','includes','values','value','test','statusCode','error','Wrong\x20credentials','send','fast-json-patch','request-promise','moment','mustache','util','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','end','sendStatus','stack','name','index','SugarcrmAccount','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length'];(function(_0x550651,_0x32926b){var _0x53edcf=function(_0x1ebc42){while(--_0x1ebc42){_0x550651['push'](_0x550651['shift']());}};_0x53edcf(++_0x32926b);}(_0xcca1,0x1da));var _0x1cca=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcca1[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1cca('0x0'));var rp=require(_0x1cca('0x1'));var moment=require(_0x1cca('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1cca('0x3'));var util=require(_0x1cca('0x4'));var path=require('path');var sox=require(_0x1cca('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cca('0x6'));var _=require('lodash');var squel=require(_0x1cca('0x7'));var crypto=require(_0x1cca('0x8'));var jsforce=require(_0x1cca('0x9'));var deskjs=require(_0x1cca('0xa'));var toCsv=require(_0x1cca('0xb'));var querystring=require(_0x1cca('0xc'));var Papa=require('papaparse');var Redis=require(_0x1cca('0xd'));var authService=require(_0x1cca('0xe'));var qs=require(_0x1cca('0xf'));var as=require(_0x1cca('0x10'));var hardwareService=require(_0x1cca('0x11'));var logger=require(_0x1cca('0x12'))(_0x1cca('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1cca('0x14'))['db'];var integrations=require(_0x1cca('0x15'));function respondWithStatusCode(_0x3dd0de,_0x27bf7a){_0x27bf7a=_0x27bf7a||0xcc;return function(_0x2c5c90){if(_0x2c5c90){return _0x3dd0de['sendStatus'](_0x27bf7a);}return _0x3dd0de[_0x1cca('0x16')](_0x27bf7a)['end']();};}function respondWithResult(_0x325c6f,_0x468c32){_0x468c32=_0x468c32||0xc8;return function(_0x53defb){if(_0x53defb){return _0x325c6f['status'](_0x468c32)[_0x1cca('0x17')](_0x53defb);}};}function respondWithFilteredResult(_0x3dd5fb,_0x5d058f){return function(_0xab5e67){if(_0xab5e67){var _0x35156d=typeof _0x5d058f[_0x1cca('0x18')]===_0x1cca('0x19')&&typeof _0x5d058f['limit']===_0x1cca('0x19');var _0x2c7dc9=_0xab5e67[_0x1cca('0x1a')];var _0x26dc1b=_0x35156d?0x0:_0x5d058f[_0x1cca('0x18')];var _0x2fbe68=_0x35156d?_0xab5e67[_0x1cca('0x1a')]:_0x5d058f[_0x1cca('0x18')]+_0x5d058f[_0x1cca('0x1b')];var _0x4aa5bf;if(_0x2fbe68>=_0x2c7dc9){_0x2fbe68=_0x2c7dc9;_0x4aa5bf=0xc8;}else{_0x4aa5bf=0xce;}_0x3dd5fb[_0x1cca('0x16')](_0x4aa5bf);return _0x3dd5fb['set'](_0x1cca('0x1c'),_0x26dc1b+'-'+_0x2fbe68+'/'+_0x2c7dc9)[_0x1cca('0x17')](_0xab5e67);}return null;};}function patchUpdates(_0x3352f0){return function(_0x1d10ab){try{jsonpatch['apply'](_0x1d10ab,_0x3352f0,!![]);}catch(_0x166557){return BPromise[_0x1cca('0x1d')](_0x166557);}return _0x1d10ab[_0x1cca('0x1e')]();};}function saveUpdates(_0x31a8fe,_0x46a3e1){return function(_0x373585){if(_0x373585){return _0x373585[_0x1cca('0x1f')](_0x31a8fe)[_0x1cca('0x20')](function(_0x4bbb7c){return _0x4bbb7c;});}return null;};}function removeEntity(_0x5ef8e8,_0x3119fd){return function(_0x2d236b){if(_0x2d236b){return _0x2d236b['destroy']()[_0x1cca('0x20')](function(){_0x5ef8e8['status'](0xcc)[_0x1cca('0x21')]();});}};}function handleEntityNotFound(_0x394efc,_0x4f864c){return function(_0x4334aa){if(!_0x4334aa){_0x394efc[_0x1cca('0x22')](0x194);}return _0x4334aa;};}function handleError(_0x4f128d,_0x4de61b){_0x4de61b=_0x4de61b||0x1f4;return function(_0x1df65a){logger['error'](_0x1df65a[_0x1cca('0x23')]);if(_0x1df65a['name']){delete _0x1df65a[_0x1cca('0x24')];}_0x4f128d[_0x1cca('0x16')](_0x4de61b)['send'](_0x1df65a);};}exports[_0x1cca('0x25')]=function(_0x12d199,_0x3b79bc){var _0x1df174={},_0x8816f9={},_0x39b4d8={'count':0x0,'rows':[]};var _0x47701d=_['map'](db[_0x1cca('0x26')][_0x1cca('0x27')],function(_0x1f6991){return{'name':_0x1f6991['fieldName'],'type':_0x1f6991[_0x1cca('0x28')][_0x1cca('0x29')]};});_0x8816f9[_0x1cca('0x2a')]=_[_0x1cca('0x2b')](_0x47701d,_0x1cca('0x24'));_0x8816f9['query']=_[_0x1cca('0x2c')](_0x12d199[_0x1cca('0x2d')]);_0x8816f9[_0x1cca('0x2e')]=_[_0x1cca('0x2f')](_0x8816f9[_0x1cca('0x2a')],_0x8816f9[_0x1cca('0x2d')]);_0x1df174[_0x1cca('0x30')]=_[_0x1cca('0x2f')](_0x8816f9[_0x1cca('0x2a')],qs['fields'](_0x12d199['query'][_0x1cca('0x31')]));_0x1df174[_0x1cca('0x30')]=_0x1df174[_0x1cca('0x30')][_0x1cca('0x32')]?_0x1df174[_0x1cca('0x30')]:_0x8816f9[_0x1cca('0x2a')];if(!_0x12d199['query'][_0x1cca('0x33')](_0x1cca('0x34'))){_0x1df174[_0x1cca('0x1b')]=qs['limit'](_0x12d199[_0x1cca('0x2d')][_0x1cca('0x1b')]);_0x1df174[_0x1cca('0x18')]=qs[_0x1cca('0x18')](_0x12d199[_0x1cca('0x2d')][_0x1cca('0x18')]);}_0x1df174['order']=qs[_0x1cca('0x35')](_0x12d199[_0x1cca('0x2d')][_0x1cca('0x35')]);_0x1df174[_0x1cca('0x36')]=qs[_0x1cca('0x2e')](_[_0x1cca('0x37')](_0x12d199['query'],_0x8816f9[_0x1cca('0x2e')]),_0x47701d);if(_0x12d199[_0x1cca('0x2d')][_0x1cca('0x38')]){_0x1df174['where']=_[_0x1cca('0x39')](_0x1df174[_0x1cca('0x36')],{'$or':_[_0x1cca('0x2b')](_0x47701d,function(_0x10b20b){if(_0x10b20b[_0x1cca('0x28')]!=='VIRTUAL'){var _0x1c855e={};_0x1c855e[_0x10b20b['name']]={'$like':'%'+_0x12d199[_0x1cca('0x2d')][_0x1cca('0x38')]+'%'};return _0x1c855e;}})});}_0x1df174=_[_0x1cca('0x39')]({},_0x1df174,_0x12d199[_0x1cca('0x3a')]);var _0x558b8e={'where':_0x1df174['where']};return db[_0x1cca('0x26')][_0x1cca('0x1a')](_0x558b8e)[_0x1cca('0x20')](function(_0xa6e1a4){_0x39b4d8[_0x1cca('0x1a')]=_0xa6e1a4;if(_0x12d199[_0x1cca('0x2d')][_0x1cca('0x3b')]){_0x1df174[_0x1cca('0x3c')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x1cca('0x3d')](_0x1df174);})[_0x1cca('0x20')](function(_0x1da1f3){_0x39b4d8[_0x1cca('0x3e')]=_0x1da1f3;return _0x39b4d8;})[_0x1cca('0x20')](respondWithFilteredResult(_0x3b79bc,_0x1df174))['catch'](handleError(_0x3b79bc,null));};exports[_0x1cca('0x3f')]=function(_0x2bcbe8,_0x1fd269){var _0x433671={'raw':![],'where':{'id':_0x2bcbe8[_0x1cca('0x40')]['id']}},_0x1b0377={};_0x1b0377[_0x1cca('0x2a')]=_['keys'](db[_0x1cca('0x26')][_0x1cca('0x27')]);_0x1b0377[_0x1cca('0x2d')]=_[_0x1cca('0x2c')](_0x2bcbe8[_0x1cca('0x2d')]);_0x1b0377[_0x1cca('0x2e')]=_[_0x1cca('0x2f')](_0x1b0377[_0x1cca('0x2a')],_0x1b0377[_0x1cca('0x2d')]);_0x433671[_0x1cca('0x30')]=_[_0x1cca('0x2f')](_0x1b0377[_0x1cca('0x2a')],qs[_0x1cca('0x31')](_0x2bcbe8['query']['fields']));_0x433671['attributes']=_0x433671[_0x1cca('0x30')][_0x1cca('0x32')]?_0x433671[_0x1cca('0x30')]:_0x1b0377[_0x1cca('0x2a')];if(_0x2bcbe8[_0x1cca('0x2d')][_0x1cca('0x3b')]){_0x433671['include']=[{'all':!![]}];}_0x433671=_['merge']({},_0x433671,_0x2bcbe8[_0x1cca('0x3a')]);return db[_0x1cca('0x26')][_0x1cca('0x41')](_0x433671)[_0x1cca('0x20')](handleEntityNotFound(_0x1fd269,null))[_0x1cca('0x20')](respondWithResult(_0x1fd269,null))[_0x1cca('0x42')](handleError(_0x1fd269,null));};exports[_0x1cca('0x43')]=function(_0x395092,_0x5b307d){return db[_0x1cca('0x26')][_0x1cca('0x43')](_0x395092[_0x1cca('0x44')],{})[_0x1cca('0x20')](respondWithResult(_0x5b307d,0xc9))[_0x1cca('0x42')](handleError(_0x5b307d,null));};exports[_0x1cca('0x1f')]=function(_0x5cf016,_0x143cf6){if(_0x5cf016['body']['id']){delete _0x5cf016['body']['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x5cf016['params']['id']}})[_0x1cca('0x20')](handleEntityNotFound(_0x143cf6,null))[_0x1cca('0x20')](saveUpdates(_0x5cf016[_0x1cca('0x44')],null))['then'](respondWithResult(_0x143cf6,null))[_0x1cca('0x42')](handleError(_0x143cf6,null));};exports[_0x1cca('0x45')]=function(_0x276563,_0x137781){return db[_0x1cca('0x26')][_0x1cca('0x41')]({'where':{'id':_0x276563[_0x1cca('0x40')]['id']}})[_0x1cca('0x20')](handleEntityNotFound(_0x137781,null))[_0x1cca('0x20')](removeEntity(_0x137781,null))['catch'](handleError(_0x137781,null));};exports['getConfigurations']=function(_0x342d1d,_0x363a64,_0xb1f89){var _0x46c00c={};var _0x623a06={};var _0x4cd261;var _0x3e978c;return db[_0x1cca('0x26')]['findOne']({'where':{'id':_0x342d1d[_0x1cca('0x40')]['id']}})['then'](handleEntityNotFound(_0x363a64,null))[_0x1cca('0x20')](function(_0x2843e3){if(_0x2843e3){_0x4cd261=_0x2843e3;_0x623a06[_0x1cca('0x2a')]=_[_0x1cca('0x2c')](db[_0x1cca('0x46')]['rawAttributes']);_0x623a06['query']=_[_0x1cca('0x2c')](_0x342d1d[_0x1cca('0x2d')]);_0x623a06[_0x1cca('0x2e')]=_[_0x1cca('0x2f')](_0x623a06[_0x1cca('0x2a')],_0x623a06[_0x1cca('0x2d')]);_0x46c00c[_0x1cca('0x30')]=_['intersection'](_0x623a06[_0x1cca('0x2a')],qs[_0x1cca('0x31')](_0x342d1d[_0x1cca('0x2d')]['fields']));_0x46c00c['attributes']=_0x46c00c[_0x1cca('0x30')][_0x1cca('0x32')]?_0x46c00c[_0x1cca('0x30')]:_0x623a06[_0x1cca('0x2a')];_0x46c00c['order']=qs[_0x1cca('0x35')](_0x342d1d[_0x1cca('0x2d')][_0x1cca('0x35')]);_0x46c00c[_0x1cca('0x36')]=qs[_0x1cca('0x2e')](_[_0x1cca('0x37')](_0x342d1d[_0x1cca('0x2d')],_0x623a06[_0x1cca('0x2e')]));if(_0x342d1d['query'][_0x1cca('0x38')]){_0x46c00c['where']=_[_0x1cca('0x39')](_0x46c00c[_0x1cca('0x36')],{'$or':_['map'](_0x46c00c[_0x1cca('0x30')],function(_0xd21791){var _0x5d8ef7={};_0x5d8ef7[_0xd21791]={'$like':'%'+_0x342d1d['query'][_0x1cca('0x38')]+'%'};return _0x5d8ef7;})});}_0x46c00c=_[_0x1cca('0x39')]({},_0x46c00c,_0x342d1d['options']);return _0x4cd261[_0x1cca('0x47')](_0x46c00c);}})[_0x1cca('0x20')](function(_0x1e6f12){if(_0x1e6f12){_0x3e978c=_0x1e6f12['length'];if(!_0x342d1d[_0x1cca('0x2d')][_0x1cca('0x33')](_0x1cca('0x34'))){_0x46c00c[_0x1cca('0x1b')]=qs[_0x1cca('0x1b')](_0x342d1d['query'][_0x1cca('0x1b')]);_0x46c00c['offset']=qs['offset'](_0x342d1d[_0x1cca('0x2d')][_0x1cca('0x18')]);}return _0x4cd261['getConfigurations'](_0x46c00c);}})['then'](function(_0x27d455){if(_0x27d455){return _0x27d455?{'count':_0x3e978c,'rows':_0x27d455}:null;}})[_0x1cca('0x20')](respondWithResult(_0x363a64,null))[_0x1cca('0x42')](handleError(_0x363a64,null));};exports[_0x1cca('0x48')]=function(_0x6ccab9,_0x4eed30,_0x48dad6){if(_0x6ccab9['body']['id']){delete _0x6ccab9[_0x1cca('0x44')]['id'];}return db[_0x1cca('0x26')]['findOne']({'where':{'id':_0x6ccab9[_0x1cca('0x40')]['id']}})['then'](handleEntityNotFound(_0x4eed30,null))[_0x1cca('0x20')](function(_0x5b6f27){if(_0x5b6f27){_0x6ccab9['body'][_0x1cca('0x49')]=_0x5b6f27['id'];_0x6ccab9[_0x1cca('0x44')][_0x1cca('0x4a')]=integrations['getSubjects'](_0x6ccab9[_0x1cca('0x44')]['channel'],_0x6ccab9[_0x1cca('0x44')][_0x1cca('0x28')]);_0x6ccab9[_0x1cca('0x44')]['Descriptions']=integrations[_0x1cca('0x4b')](_0x6ccab9[_0x1cca('0x44')][_0x1cca('0x4c')],_0x6ccab9[_0x1cca('0x44')][_0x1cca('0x28')]);return db[_0x1cca('0x46')][_0x1cca('0x43')](_0x6ccab9[_0x1cca('0x44')],{'include':[{'model':db[_0x1cca('0x4d')],'as':_0x1cca('0x4a')},{'model':db[_0x1cca('0x4d')],'as':'Descriptions'}]});}return null;})[_0x1cca('0x20')](respondWithResult(_0x4eed30,null))[_0x1cca('0x42')](handleError(_0x4eed30,null));};exports[_0x1cca('0x4e')]=function(_0x51a89b,_0x19d521,_0x2585b7){var _0x2ee350='';var _0x3eb484=['id','name',_0x1cca('0x4f'),'created_by',_0x1cca('0x50'),_0x1cca('0x51'),_0x1cca('0x52'),'duration_minutes',_0x1cca('0x53'),'parent_type',_0x1cca('0x54'),'direction'];return db[_0x1cca('0x26')]['findOne']({'where':{'id':_0x51a89b[_0x1cca('0x40')]['id']},'attributes':['id','username','password','remoteUri']})[_0x1cca('0x20')](handleEntityNotFound(_0x19d521,null))[_0x1cca('0x20')](function(_0x266c45){if(_0x266c45){_0x2ee350=_0x266c45['remoteUri'];var _0x3b9be9=_0x2ee350[_0x1cca('0x55')](-0x1);if(_0x3b9be9==='/'){_0x2ee350=_0x2ee350['substring'](0x0,_0x2ee350[_0x1cca('0x56')](_0x3b9be9));}return rp({'method':_0x1cca('0x57'),'uri':util[_0x1cca('0x58')]('%s%s',_0x2ee350,_0x1cca('0x59')),'json':!![],'form':{'method':_0x1cca('0x5a'),'input_type':_0x1cca('0x5b'),'response_type':_0x1cca('0x5b'),'rest_data':JSON[_0x1cca('0x5c')]({'user_auth':{'user_name':_0x266c45[_0x1cca('0x5d')],'password':_0x266c45['password'],'encryption':_0x1cca('0x5e')},'application':_0x1cca('0x5f')})}});}})[_0x1cca('0x20')](function(_0x3cf5f3){if(_0x3cf5f3&&_0x3cf5f3['name']!=='Invalid\x20Login'&&_0x3cf5f3[_0x1cca('0x24')]!=='Password\x20Expired'){return rp({'method':_0x1cca('0x57'),'uri':util[_0x1cca('0x58')]('%s%s',_0x2ee350,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':_0x1cca('0x5b'),'response_type':'JSON','rest_data':JSON[_0x1cca('0x5c')]({'session':_0x3cf5f3['id'],'module_name':'Calls'})}})[_0x1cca('0x20')](function(_0x5f0f7e){if(_0x5f0f7e){var _0x433769=_['values'](_0x5f0f7e[_0x1cca('0x60')]);_['remove'](_0x433769,function(_0x565deb){return _0x3eb484[_0x1cca('0x61')](_0x565deb['name']);});return{'count':_0x433769['length'],'rows':_['map'](_0x433769,function(_0x1997e2){return{'id':_0x1997e2['name'],'name':_0x1997e2['label'],'custom':_['endsWith'](_0x1997e2[_0x1cca('0x24')],'_c')?!![]:![],'options':_0x1997e2['options']?_[_0x1cca('0x2b')](_[_0x1cca('0x62')](_0x1997e2[_0x1cca('0x3a')]),function(_0x4d84c9){return{'name':_0x4d84c9[_0x1cca('0x63')],'value':_0x4d84c9[_0x1cca('0x24')]};}):[]};})};}})[_0x1cca('0x20')](respondWithResult(_0x19d521,null))['catch'](function(_0x54d0cc){var _0xaf873e=_0x51a89b[_0x1cca('0x2d')][_0x1cca('0x64')]?0x1f4:_0x54d0cc[_0x1cca('0x65')]||0x1f4;logger[_0x1cca('0x66')]('getFields,\x20%s,\x20%s,\x20%s',_0x1cca('0x4e'),_0xaf873e,JSON['stringify'](_0x54d0cc));delete _0x54d0cc[_0x1cca('0x24')];if(_0xaf873e===0x191){_0xaf873e=0x190;}_0x19d521[_0x1cca('0x16')](_0xaf873e)['send'](_0x51a89b[_0x1cca('0x2d')]['test']?{'message':_0x1cca('0x67'),'statusCode':_0x54d0cc['statusCode']}:_0x54d0cc);});}else{var _0x141254=0x1f4;_0x19d521['status'](_0x141254)[_0x1cca('0x68')]({'message':_0x1cca('0x67'),'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 0c42fb4..5178731 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 _0x7a21=['lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','int_sugarcrm_accounts'];(function(_0x155c48,_0x5ac92d){var _0x4938fe=function(_0x3c62c1){while(--_0x3c62c1){_0x155c48['push'](_0x155c48['shift']());}};_0x4938fe(++_0x5ac92d);}(_0x7a21,0x1c8));var _0x17a2=function(_0x43d070,_0x5177d1){_0x43d070=_0x43d070-0x0;var _0x3c3285=_0x7a21[_0x43d070];return _0x3c3285;};'use strict';var _=require(_0x17a2('0x0'));var util=require(_0x17a2('0x1'));var logger=require(_0x17a2('0x2'))(_0x17a2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x17a2('0x4'));var fs=require('fs');var path=require(_0x17a2('0x5'));var rimraf=require('rimraf');var config=require(_0x17a2('0x6'));var attributes=require(_0x17a2('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x17a2('0x8')]=function(_0x55fd41,_0x40235c){return _0x55fd41[_0x17a2('0x9')](_0x17a2('0xa'),attributes,{'tableName':_0x17a2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ce1=['define','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x20b3ec,_0x2addb6){var _0x1d2d69=function(_0x3702f6){while(--_0x3702f6){_0x20b3ec['push'](_0x20b3ec['shift']());}};_0x1d2d69(++_0x2addb6);}(_0x8ce1,0xc7));var _0x18ce=function(_0x57cbfa,_0x3bbbe5){_0x57cbfa=_0x57cbfa-0x0;var _0x2a8f17=_0x8ce1[_0x57cbfa];return _0x2a8f17;};'use strict';var _=require(_0x18ce('0x0'));var util=require('util');var logger=require(_0x18ce('0x1'))(_0x18ce('0x2'));var moment=require(_0x18ce('0x3'));var BPromise=require(_0x18ce('0x4'));var rp=require(_0x18ce('0x5'));var fs=require('fs');var path=require(_0x18ce('0x6'));var rimraf=require(_0x18ce('0x7'));var config=require(_0x18ce('0x8'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x18ce('0x9'));module[_0x18ce('0xa')]=function(_0x55a03e,_0x31f7c4){return _0x55a03e[_0x18ce('0xb')](_0x18ce('0xc'),attributes,{'tableName':_0x18ce('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index e012f12..d20c565 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 _0x247c=['ShowSugarcrmAccount','find','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','attributes','limit','include','map','model'];(function(_0x38a6c6,_0x4062ca){var _0x142f0a=function(_0x1531ce){while(--_0x1531ce){_0x38a6c6['push'](_0x38a6c6['shift']());}};_0x142f0a(++_0x4062ca);}(_0x247c,0x78));var _0xc247=function(_0xb8135c,_0x46c002){_0xb8135c=_0xb8135c-0x0;var _0x4e54e5=_0x247c[_0xb8135c];return _0x4e54e5;};'use strict';var _=require(_0xc247('0x0'));var util=require(_0xc247('0x1'));var moment=require(_0xc247('0x2'));var BPromise=require('bluebird');var rs=require(_0xc247('0x3'));var fs=require('fs');var Redis=require(_0xc247('0x4'));var db=require(_0xc247('0x5'))['db'];var utils=require(_0xc247('0x6'));var logger=require(_0xc247('0x7'))(_0xc247('0x8'));var config=require(_0xc247('0x9'));var jayson=require(_0xc247('0xa'));var client=jayson[_0xc247('0xb')][_0xc247('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x51dc89,_0x1d1c6c,_0x1e81f6){return new BPromise(function(_0x109aec,_0xdd53f){return client[_0xc247('0xd')](_0x51dc89,_0x1e81f6)[_0xc247('0xe')](function(_0x120b7a){logger[_0xc247('0xf')](_0xc247('0x10'),_0x1d1c6c,_0xc247('0x11'));logger[_0xc247('0x12')](_0xc247('0x13'),_0x1d1c6c,_0xc247('0x11'),JSON[_0xc247('0x14')](_0x120b7a));if(_0x120b7a[_0xc247('0x15')]){if(_0x120b7a[_0xc247('0x15')][_0xc247('0x16')]===0x1f4){logger[_0xc247('0x15')]('SugarcrmAccount,\x20%s,\x20%s',_0x1d1c6c,_0x120b7a[_0xc247('0x15')][_0xc247('0x17')]);return _0xdd53f(_0x120b7a[_0xc247('0x15')][_0xc247('0x17')]);}logger['error'](_0xc247('0x10'),_0x1d1c6c,_0x120b7a[_0xc247('0x15')][_0xc247('0x17')]);return _0x109aec(_0x120b7a[_0xc247('0x15')][_0xc247('0x17')]);}else{logger[_0xc247('0xf')](_0xc247('0x10'),_0x1d1c6c,_0xc247('0x11'));_0x109aec(_0x120b7a[_0xc247('0x18')][_0xc247('0x17')]);}})[_0xc247('0x19')](function(_0xb77984){logger[_0xc247('0x15')](_0xc247('0x10'),_0x1d1c6c,_0xb77984);_0xdd53f(_0xb77984);});});}exports[_0xc247('0x1a')]=function(_0x18b4d0){var _0x321722=this;return new Promise(function(_0x2495ae,_0x5a4971){return db[_0xc247('0x1b')][_0xc247('0x1c')]({'raw':_0x18b4d0['options']?_0x18b4d0[_0xc247('0x1d')][_0xc247('0x1e')]===undefined?!![]:![]:!![],'where':_0x18b4d0[_0xc247('0x1d')]?_0x18b4d0[_0xc247('0x1d')]['where']||null:null,'attributes':_0x18b4d0['options']?_0x18b4d0[_0xc247('0x1d')][_0xc247('0x1f')]||null:null,'limit':_0x18b4d0[_0xc247('0x1d')]?_0x18b4d0[_0xc247('0x1d')][_0xc247('0x20')]||null:null,'include':_0x18b4d0[_0xc247('0x1d')]?_0x18b4d0[_0xc247('0x1d')][_0xc247('0x21')]?_[_0xc247('0x22')](_0x18b4d0[_0xc247('0x1d')][_0xc247('0x21')],function(_0x49630f){return{'model':db[_0x49630f[_0xc247('0x23')]],'as':_0x49630f['as'],'attributes':_0x49630f[_0xc247('0x1f')],'include':_0x49630f[_0xc247('0x21')]?_[_0xc247('0x22')](_0x49630f[_0xc247('0x21')],function(_0x59625b){return{'model':db[_0x59625b['model']],'as':_0x59625b['as'],'attributes':_0x59625b[_0xc247('0x1f')],'include':_0x59625b[_0xc247('0x21')]?_['map'](_0x59625b[_0xc247('0x21')],function(_0x403ed1){return{'model':db[_0x403ed1[_0xc247('0x23')]],'as':_0x403ed1['as'],'attributes':_0x403ed1[_0xc247('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc247('0xe')](function(_0x4877a8){logger[_0xc247('0xf')](_0xc247('0x1a'),_0x18b4d0);logger[_0xc247('0x12')](_0xc247('0x1a'),_0x18b4d0,JSON[_0xc247('0x14')](_0x4877a8));_0x2495ae(_0x4877a8);})[_0xc247('0x19')](function(_0x1345f3){logger[_0xc247('0x15')]('GetSugarcrmAccount',_0x1345f3[_0xc247('0x17')],_0x18b4d0);_0x5a4971(_0x321722[_0xc247('0x15')](0x1f4,_0x1345f3[_0xc247('0x17')]));});});};exports[_0xc247('0x24')]=function(_0x2d962c){var _0x5a921f=this;return new Promise(function(_0x2096cc,_0x2cc756){return db[_0xc247('0x1b')][_0xc247('0x25')]({'raw':_0x2d962c[_0xc247('0x1d')]?_0x2d962c[_0xc247('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x2d962c[_0xc247('0x1d')]?_0x2d962c['options'][_0xc247('0x26')]||null:null,'attributes':_0x2d962c[_0xc247('0x1d')]?_0x2d962c[_0xc247('0x1d')][_0xc247('0x1f')]||null:null,'include':_0x2d962c[_0xc247('0x1d')]?_0x2d962c[_0xc247('0x1d')]['include']?_[_0xc247('0x22')](_0x2d962c['options']['include'],function(_0x168bb5){return{'model':db[_0x168bb5[_0xc247('0x23')]],'as':_0x168bb5['as'],'attributes':_0x168bb5[_0xc247('0x1f')],'include':_0x168bb5[_0xc247('0x21')]?_[_0xc247('0x22')](_0x168bb5[_0xc247('0x21')],function(_0x536f38){return{'model':db[_0x536f38[_0xc247('0x23')]],'as':_0x536f38['as'],'attributes':_0x536f38['attributes'],'include':_0x536f38[_0xc247('0x21')]?_[_0xc247('0x22')](_0x536f38[_0xc247('0x21')],function(_0x3302bd){return{'model':db[_0x3302bd[_0xc247('0x23')]],'as':_0x3302bd['as'],'attributes':_0x3302bd['attributes']};}):[]};}):[]};}):[]:[]})[_0xc247('0xe')](function(_0x59f5cd){logger[_0xc247('0xf')]('ShowSugarcrmAccount',_0x2d962c);logger[_0xc247('0x12')](_0xc247('0x24'),_0x2d962c,JSON[_0xc247('0x14')](_0x59f5cd));_0x2096cc(_0x59f5cd);})[_0xc247('0x19')](function(_0x55be43){logger[_0xc247('0x15')](_0xc247('0x24'),_0x55be43[_0xc247('0x17')],_0x2d962c);_0x2cc756(_0x5a921f[_0xc247('0x15')](0x1f4,_0x55be43[_0xc247('0x17')]));});});}; \ No newline at end of file +var _0x1c0a=['debug','stringify','error','code','message','catch','SugarcrmAccount','options','raw','where','attributes','limit','include','map','model','GetSugarcrmAccount','find','ShowSugarcrmAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x1ff414,_0x12c95d){var _0x52c0fa=function(_0x57f936){while(--_0x57f936){_0x1ff414['push'](_0x1ff414['shift']());}};_0x52c0fa(++_0x12c95d);}(_0x1c0a,0x170));var _0xa1c0=function(_0x329a26,_0x5882d2){_0x329a26=_0x329a26-0x0;var _0x39d219=_0x1c0a[_0x329a26];return _0x39d219;};'use strict';var _=require(_0xa1c0('0x0'));var util=require(_0xa1c0('0x1'));var moment=require('moment');var BPromise=require(_0xa1c0('0x2'));var rs=require(_0xa1c0('0x3'));var fs=require('fs');var Redis=require(_0xa1c0('0x4'));var db=require(_0xa1c0('0x5'))['db'];var utils=require(_0xa1c0('0x6'));var logger=require(_0xa1c0('0x7'))(_0xa1c0('0x8'));var config=require(_0xa1c0('0x9'));var jayson=require(_0xa1c0('0xa'));var client=jayson[_0xa1c0('0xb')][_0xa1c0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e10b4,_0x5dab80,_0x29fef5){return new BPromise(function(_0x1d435c,_0x5c78bd){return client['request'](_0x3e10b4,_0x29fef5)[_0xa1c0('0xd')](function(_0x3f75a9){logger[_0xa1c0('0xe')](_0xa1c0('0xf'),_0x5dab80,_0xa1c0('0x10'));logger[_0xa1c0('0x11')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x5dab80,'request\x20sent',JSON[_0xa1c0('0x12')](_0x3f75a9));if(_0x3f75a9[_0xa1c0('0x13')]){if(_0x3f75a9[_0xa1c0('0x13')][_0xa1c0('0x14')]===0x1f4){logger[_0xa1c0('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x5dab80,_0x3f75a9[_0xa1c0('0x13')][_0xa1c0('0x15')]);return _0x5c78bd(_0x3f75a9['error']['message']);}logger[_0xa1c0('0x13')](_0xa1c0('0xf'),_0x5dab80,_0x3f75a9[_0xa1c0('0x13')]['message']);return _0x1d435c(_0x3f75a9[_0xa1c0('0x13')]['message']);}else{logger[_0xa1c0('0xe')](_0xa1c0('0xf'),_0x5dab80,'request\x20sent');_0x1d435c(_0x3f75a9['result'][_0xa1c0('0x15')]);}})[_0xa1c0('0x16')](function(_0xfa8296){logger[_0xa1c0('0x13')](_0xa1c0('0xf'),_0x5dab80,_0xfa8296);_0x5c78bd(_0xfa8296);});});}exports['GetSugarcrmAccount']=function(_0x165728){var _0x43fdbf=this;return new Promise(function(_0x116023,_0x13de91){return db[_0xa1c0('0x17')]['findAll']({'raw':_0x165728[_0xa1c0('0x18')]?_0x165728[_0xa1c0('0x18')][_0xa1c0('0x19')]===undefined?!![]:![]:!![],'where':_0x165728[_0xa1c0('0x18')]?_0x165728[_0xa1c0('0x18')][_0xa1c0('0x1a')]||null:null,'attributes':_0x165728['options']?_0x165728[_0xa1c0('0x18')][_0xa1c0('0x1b')]||null:null,'limit':_0x165728[_0xa1c0('0x18')]?_0x165728[_0xa1c0('0x18')][_0xa1c0('0x1c')]||null:null,'include':_0x165728[_0xa1c0('0x18')]?_0x165728[_0xa1c0('0x18')][_0xa1c0('0x1d')]?_[_0xa1c0('0x1e')](_0x165728[_0xa1c0('0x18')][_0xa1c0('0x1d')],function(_0x5804f2){return{'model':db[_0x5804f2[_0xa1c0('0x1f')]],'as':_0x5804f2['as'],'attributes':_0x5804f2[_0xa1c0('0x1b')],'include':_0x5804f2['include']?_[_0xa1c0('0x1e')](_0x5804f2[_0xa1c0('0x1d')],function(_0x220268){return{'model':db[_0x220268[_0xa1c0('0x1f')]],'as':_0x220268['as'],'attributes':_0x220268[_0xa1c0('0x1b')],'include':_0x220268[_0xa1c0('0x1d')]?_[_0xa1c0('0x1e')](_0x220268[_0xa1c0('0x1d')],function(_0x5c9e63){return{'model':db[_0x5c9e63[_0xa1c0('0x1f')]],'as':_0x5c9e63['as'],'attributes':_0x5c9e63[_0xa1c0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa1c0('0xd')](function(_0x1b6e57){logger[_0xa1c0('0xe')](_0xa1c0('0x20'),_0x165728);logger[_0xa1c0('0x11')](_0xa1c0('0x20'),_0x165728,JSON[_0xa1c0('0x12')](_0x1b6e57));_0x116023(_0x1b6e57);})['catch'](function(_0x11d31c){logger[_0xa1c0('0x13')](_0xa1c0('0x20'),_0x11d31c['message'],_0x165728);_0x13de91(_0x43fdbf[_0xa1c0('0x13')](0x1f4,_0x11d31c['message']));});});};exports['ShowSugarcrmAccount']=function(_0x1f9e42){var _0x4e65d1=this;return new Promise(function(_0x4a186a,_0x47498b){return db[_0xa1c0('0x17')][_0xa1c0('0x21')]({'raw':_0x1f9e42[_0xa1c0('0x18')]?_0x1f9e42[_0xa1c0('0x18')][_0xa1c0('0x19')]===undefined?!![]:![]:!![],'where':_0x1f9e42[_0xa1c0('0x18')]?_0x1f9e42[_0xa1c0('0x18')][_0xa1c0('0x1a')]||null:null,'attributes':_0x1f9e42[_0xa1c0('0x18')]?_0x1f9e42['options']['attributes']||null:null,'include':_0x1f9e42[_0xa1c0('0x18')]?_0x1f9e42[_0xa1c0('0x18')][_0xa1c0('0x1d')]?_['map'](_0x1f9e42[_0xa1c0('0x18')][_0xa1c0('0x1d')],function(_0x3b3d30){return{'model':db[_0x3b3d30['model']],'as':_0x3b3d30['as'],'attributes':_0x3b3d30['attributes'],'include':_0x3b3d30[_0xa1c0('0x1d')]?_[_0xa1c0('0x1e')](_0x3b3d30[_0xa1c0('0x1d')],function(_0x48b1d2){return{'model':db[_0x48b1d2['model']],'as':_0x48b1d2['as'],'attributes':_0x48b1d2[_0xa1c0('0x1b')],'include':_0x48b1d2[_0xa1c0('0x1d')]?_[_0xa1c0('0x1e')](_0x48b1d2[_0xa1c0('0x1d')],function(_0x5efa51){return{'model':db[_0x5efa51[_0xa1c0('0x1f')]],'as':_0x5efa51['as'],'attributes':_0x5efa51[_0xa1c0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa1c0('0xd')](function(_0x484512){logger[_0xa1c0('0xe')]('ShowSugarcrmAccount',_0x1f9e42);logger[_0xa1c0('0x11')](_0xa1c0('0x22'),_0x1f9e42,JSON[_0xa1c0('0x12')](_0x484512));_0x4a186a(_0x484512);})['catch'](function(_0x14003d){logger[_0xa1c0('0x13')](_0xa1c0('0x22'),_0x14003d[_0xa1c0('0x15')],_0x1f9e42);_0x47498b(_0x4e65d1[_0xa1c0('0x13')](0x1f4,_0x14003d[_0xa1c0('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index a9efb07..6244c3c 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 _0x69c3=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','index','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','exports','multer','util','express'];(function(_0x2866c7,_0x197fdd){var _0x3c5db2=function(_0x5f40db){while(--_0x5f40db){_0x2866c7['push'](_0x2866c7['shift']());}};_0x3c5db2(++_0x197fdd);}(_0x69c3,0xde));var _0x369c=function(_0x32de1c,_0x1b9e3b){_0x32de1c=_0x32de1c-0x0;var _0x34efc5=_0x69c3[_0x32de1c];return _0x34efc5;};'use strict';var multer=require(_0x369c('0x0'));var util=require(_0x369c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x369c('0x2'));var router=express[_0x369c('0x3')]();var fs_extra=require(_0x369c('0x4'));var auth=require(_0x369c('0x5'));var interaction=require(_0x369c('0x6'));var config=require(_0x369c('0x7'));var controller=require(_0x369c('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x369c('0x9')]);router[_0x369c('0xa')](_0x369c('0xb'),auth[_0x369c('0xc')](),controller[_0x369c('0xd')]);router[_0x369c('0xa')](_0x369c('0xe'),auth['isAuthenticated'](),controller[_0x369c('0xf')]);router['get'](_0x369c('0x10'),auth[_0x369c('0xc')](),controller[_0x369c('0x11')]);router[_0x369c('0xa')]('/:id/descriptions',auth[_0x369c('0xc')](),controller[_0x369c('0x12')]);router[_0x369c('0x13')]('/',auth[_0x369c('0xc')](),controller[_0x369c('0x14')]);router[_0x369c('0x15')](_0x369c('0xb'),auth[_0x369c('0xc')](),controller[_0x369c('0x16')]);router[_0x369c('0x17')](_0x369c('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x369c('0x18')]=router; \ No newline at end of file +var _0xf993=['isAuthenticated','index','/:id','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get'];(function(_0x1e5e99,_0x5c0839){var _0x571e0d=function(_0x5556f8){while(--_0x5556f8){_0x1e5e99['push'](_0x1e5e99['shift']());}};_0x571e0d(++_0x5c0839);}(_0xf993,0x1c1));var _0x3f99=function(_0x3759b7,_0x1420ad){_0x3759b7=_0x3759b7-0x0;var _0x1239f4=_0xf993[_0x3759b7];return _0x1239f4;};'use strict';var multer=require(_0x3f99('0x0'));var util=require(_0x3f99('0x1'));var path=require(_0x3f99('0x2'));var timeout=require(_0x3f99('0x3'));var express=require(_0x3f99('0x4'));var router=express[_0x3f99('0x5')]();var fs_extra=require(_0x3f99('0x6'));var auth=require(_0x3f99('0x7'));var interaction=require(_0x3f99('0x8'));var config=require('../../config/environment');var controller=require(_0x3f99('0x9'));router[_0x3f99('0xa')]('/',auth[_0x3f99('0xb')](),controller[_0x3f99('0xc')]);router[_0x3f99('0xa')](_0x3f99('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x3f99('0xa')]('/:id/fields',auth[_0x3f99('0xb')](),controller[_0x3f99('0xe')]);router[_0x3f99('0xa')]('/:id/subjects',auth[_0x3f99('0xb')](),controller[_0x3f99('0xf')]);router[_0x3f99('0xa')](_0x3f99('0x10'),auth['isAuthenticated'](),controller[_0x3f99('0x11')]);router[_0x3f99('0x12')]('/',auth[_0x3f99('0xb')](),controller[_0x3f99('0x13')]);router['put'](_0x3f99('0xd'),auth['isAuthenticated'](),controller[_0x3f99('0x14')]);router[_0x3f99('0x15')]('/:id',auth[_0x3f99('0xb')](),controller['destroy']);module[_0x3f99('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 0bde319..8181c83 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 _0x3806=['sequelize','exports','STRING'];(function(_0xf244e0,_0x20556c){var _0xe94095=function(_0x409d0a){while(--_0x409d0a){_0xf244e0['push'](_0xf244e0['shift']());}};_0xe94095(++_0x20556c);}(_0x3806,0x1e9));var _0x6380=function(_0x1dc63b,_0x5c7133){_0x1dc63b=_0x1dc63b-0x0;var _0x381bfb=_0x3806[_0x1dc63b];return _0x381bfb;};'use strict';var Sequelize=require(_0x6380('0x0'));module[_0x6380('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6380('0x2')]}}; \ No newline at end of file +var _0xb921=['STRING','sequelize','exports'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xb921,0xaf));var _0x1b92=function(_0x4b9298,_0x40ddcf){_0x4b9298=_0x4b9298-0x0;var _0x369af0=_0xb921[_0x4b9298];return _0x369af0;};'use strict';var Sequelize=require(_0x1b92('0x0'));module[_0x1b92('0x1')]={'name':{'type':Sequelize[_0x1b92('0x2')]},'description':{'type':Sequelize[_0x1b92('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 97a29e8..638c3fc 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 _0xd160=['path','sox','to-csv','ejs','fs-extra','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','SugarcrmConfiguration','rawAttributes','type','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','getSubjects','findOne','SugarcrmField','getDescriptions','eml-format','rimraf','request-promise','moment','bluebird','mustache','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd160,0xe9));var _0x0d16=function(_0xea35d1,_0x302471){_0xea35d1=_0xea35d1-0x0;var _0x1d7a7c=_0xd160[_0xea35d1];return _0x1d7a7c;};'use strict';var emlformat=require(_0x0d16('0x0'));var rimraf=require(_0x0d16('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d16('0x2'));var moment=require(_0x0d16('0x3'));var BPromise=require(_0x0d16('0x4'));var Mustache=require(_0x0d16('0x5'));var util=require(_0x0d16('0x6'));var path=require(_0x0d16('0x7'));var sox=require(_0x0d16('0x8'));var csv=require(_0x0d16('0x9'));var ejs=require(_0x0d16('0xa'));var fs=require('fs');var fs_extra=require(_0x0d16('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0d16('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0d16('0x9'));var querystring=require('querystring');var Papa=require(_0x0d16('0xd'));var Redis=require(_0x0d16('0xe'));var authService=require(_0x0d16('0xf'));var qs=require(_0x0d16('0x10'));var as=require(_0x0d16('0x11'));var hardwareService=require(_0x0d16('0x12'));var logger=require(_0x0d16('0x13'))('api');var utils=require(_0x0d16('0x14'));var config=require(_0x0d16('0x15'));var licenseUtil=require(_0x0d16('0x16'));var db=require(_0x0d16('0x17'))['db'];function respondWithStatusCode(_0x4d9e23,_0x4fdf72){_0x4fdf72=_0x4fdf72||0xcc;return function(_0x13cb66){if(_0x13cb66){return _0x4d9e23[_0x0d16('0x18')](_0x4fdf72);}return _0x4d9e23[_0x0d16('0x19')](_0x4fdf72)[_0x0d16('0x1a')]();};}function respondWithResult(_0x355167,_0x5a0acb){_0x5a0acb=_0x5a0acb||0xc8;return function(_0x3163c1){if(_0x3163c1){return _0x355167[_0x0d16('0x19')](_0x5a0acb)[_0x0d16('0x1b')](_0x3163c1);}};}function respondWithFilteredResult(_0x3a9693,_0x1fb499){return function(_0x3eedae){if(_0x3eedae){var _0x435fe1=typeof _0x1fb499[_0x0d16('0x1c')]===_0x0d16('0x1d')&&typeof _0x1fb499[_0x0d16('0x1e')]==='undefined';var _0x5928ff=_0x3eedae[_0x0d16('0x1f')];var _0x1c9d79=_0x435fe1?0x0:_0x1fb499[_0x0d16('0x1c')];var _0x519819=_0x435fe1?_0x3eedae[_0x0d16('0x1f')]:_0x1fb499['offset']+_0x1fb499[_0x0d16('0x1e')];var _0x3ffd7b;if(_0x519819>=_0x5928ff){_0x519819=_0x5928ff;_0x3ffd7b=0xc8;}else{_0x3ffd7b=0xce;}_0x3a9693[_0x0d16('0x19')](_0x3ffd7b);return _0x3a9693[_0x0d16('0x20')](_0x0d16('0x21'),_0x1c9d79+'-'+_0x519819+'/'+_0x5928ff)[_0x0d16('0x1b')](_0x3eedae);}return null;};}function patchUpdates(_0x452bc4){return function(_0x3cf515){try{jsonpatch[_0x0d16('0x22')](_0x3cf515,_0x452bc4,!![]);}catch(_0x56bb41){return BPromise[_0x0d16('0x23')](_0x56bb41);}return _0x3cf515['save']();};}function saveUpdates(_0x56bdf7,_0x113a1b){return function(_0x188842){if(_0x188842){return _0x188842[_0x0d16('0x24')](_0x56bdf7)[_0x0d16('0x25')](function(_0x26d175){return _0x26d175;});}return null;};}function removeEntity(_0x3e0a3e,_0x4e732b){return function(_0x4eff7d){if(_0x4eff7d){return _0x4eff7d[_0x0d16('0x26')]()[_0x0d16('0x25')](function(){_0x3e0a3e[_0x0d16('0x19')](0xcc)[_0x0d16('0x1a')]();});}};}function handleEntityNotFound(_0x3afcbd,_0x150df4){return function(_0x25f517){if(!_0x25f517){_0x3afcbd['sendStatus'](0x194);}return _0x25f517;};}function handleError(_0x27f66e,_0x39691f){_0x39691f=_0x39691f||0x1f4;return function(_0x5f1244){logger[_0x0d16('0x27')](_0x5f1244['stack']);if(_0x5f1244['name']){delete _0x5f1244[_0x0d16('0x28')];}_0x27f66e[_0x0d16('0x19')](_0x39691f)[_0x0d16('0x29')](_0x5f1244);};}exports[_0x0d16('0x2a')]=function(_0x5fd3f1,_0x565014){var _0x1b7eb6={},_0x36259b={},_0xb2e5f8={'count':0x0,'rows':[]};var _0x57911f=_[_0x0d16('0x2b')](db[_0x0d16('0x2c')][_0x0d16('0x2d')],function(_0xcaa164){return{'name':_0xcaa164['fieldName'],'type':_0xcaa164[_0x0d16('0x2e')]['key']};});_0x36259b[_0x0d16('0x2f')]=_[_0x0d16('0x2b')](_0x57911f,_0x0d16('0x28'));_0x36259b['query']=_[_0x0d16('0x30')](_0x5fd3f1['query']);_0x36259b[_0x0d16('0x31')]=_['intersection'](_0x36259b[_0x0d16('0x2f')],_0x36259b[_0x0d16('0x32')]);_0x1b7eb6[_0x0d16('0x33')]=_[_0x0d16('0x34')](_0x36259b[_0x0d16('0x2f')],qs['fields'](_0x5fd3f1[_0x0d16('0x32')][_0x0d16('0x35')]));_0x1b7eb6['attributes']=_0x1b7eb6[_0x0d16('0x33')][_0x0d16('0x36')]?_0x1b7eb6[_0x0d16('0x33')]:_0x36259b[_0x0d16('0x2f')];if(!_0x5fd3f1[_0x0d16('0x32')][_0x0d16('0x37')](_0x0d16('0x38'))){_0x1b7eb6['limit']=qs[_0x0d16('0x1e')](_0x5fd3f1[_0x0d16('0x32')][_0x0d16('0x1e')]);_0x1b7eb6['offset']=qs[_0x0d16('0x1c')](_0x5fd3f1[_0x0d16('0x32')]['offset']);}_0x1b7eb6[_0x0d16('0x39')]=qs[_0x0d16('0x3a')](_0x5fd3f1[_0x0d16('0x32')]['sort']);_0x1b7eb6[_0x0d16('0x3b')]=qs['filters'](_[_0x0d16('0x3c')](_0x5fd3f1['query'],_0x36259b[_0x0d16('0x31')]),_0x57911f);if(_0x5fd3f1[_0x0d16('0x32')][_0x0d16('0x3d')]){_0x1b7eb6['where']=_['merge'](_0x1b7eb6[_0x0d16('0x3b')],{'$or':_[_0x0d16('0x2b')](_0x57911f,function(_0x443c7f){if(_0x443c7f[_0x0d16('0x2e')]!==_0x0d16('0x3e')){var _0x1a812d={};_0x1a812d[_0x443c7f[_0x0d16('0x28')]]={'$like':'%'+_0x5fd3f1[_0x0d16('0x32')][_0x0d16('0x3d')]+'%'};return _0x1a812d;}})});}_0x1b7eb6=_[_0x0d16('0x3f')]({},_0x1b7eb6,_0x5fd3f1[_0x0d16('0x40')]);var _0x24fd55={'where':_0x1b7eb6[_0x0d16('0x3b')]};return db[_0x0d16('0x2c')]['count'](_0x24fd55)['then'](function(_0x3f1ee1){_0xb2e5f8[_0x0d16('0x1f')]=_0x3f1ee1;if(_0x5fd3f1[_0x0d16('0x32')][_0x0d16('0x41')]){_0x1b7eb6[_0x0d16('0x42')]=[{'all':!![]}];}return db[_0x0d16('0x2c')][_0x0d16('0x43')](_0x1b7eb6);})[_0x0d16('0x25')](function(_0x5d24a0){_0xb2e5f8[_0x0d16('0x44')]=_0x5d24a0;return _0xb2e5f8;})[_0x0d16('0x25')](respondWithFilteredResult(_0x565014,_0x1b7eb6))[_0x0d16('0x45')](handleError(_0x565014,null));};exports[_0x0d16('0x46')]=function(_0x3e1281,_0x494e53){var _0x52c0eb={'raw':![],'where':{'id':_0x3e1281[_0x0d16('0x47')]['id']}},_0x321235={};_0x321235[_0x0d16('0x2f')]=_[_0x0d16('0x30')](db[_0x0d16('0x2c')]['rawAttributes']);_0x321235[_0x0d16('0x32')]=_[_0x0d16('0x30')](_0x3e1281[_0x0d16('0x32')]);_0x321235['filters']=_[_0x0d16('0x34')](_0x321235[_0x0d16('0x2f')],_0x321235[_0x0d16('0x32')]);_0x52c0eb[_0x0d16('0x33')]=_[_0x0d16('0x34')](_0x321235[_0x0d16('0x2f')],qs[_0x0d16('0x35')](_0x3e1281['query']['fields']));_0x52c0eb['attributes']=_0x52c0eb[_0x0d16('0x33')][_0x0d16('0x36')]?_0x52c0eb['attributes']:_0x321235[_0x0d16('0x2f')];if(_0x3e1281[_0x0d16('0x32')][_0x0d16('0x41')]){_0x52c0eb[_0x0d16('0x42')]=[{'all':!![]}];}_0x52c0eb=_[_0x0d16('0x3f')]({},_0x52c0eb,_0x3e1281[_0x0d16('0x40')]);return db[_0x0d16('0x2c')][_0x0d16('0x48')](_0x52c0eb)['then'](handleEntityNotFound(_0x494e53,null))[_0x0d16('0x25')](respondWithResult(_0x494e53,null))[_0x0d16('0x45')](handleError(_0x494e53,null));};exports[_0x0d16('0x49')]=function(_0x2d85be,_0x1e7eba){return db['SugarcrmConfiguration'][_0x0d16('0x49')](_0x2d85be[_0x0d16('0x4a')],{})[_0x0d16('0x25')](respondWithResult(_0x1e7eba,0xc9))[_0x0d16('0x45')](handleError(_0x1e7eba,null));};exports[_0x0d16('0x24')]=function(_0x48db4c,_0x1f9218){if(_0x48db4c[_0x0d16('0x4a')]['id']){delete _0x48db4c[_0x0d16('0x4a')]['id'];}return db[_0x0d16('0x2c')]['find']({'where':{'id':_0x48db4c[_0x0d16('0x47')]['id']}})[_0x0d16('0x25')](handleEntityNotFound(_0x1f9218,null))[_0x0d16('0x25')](saveUpdates(_0x48db4c[_0x0d16('0x4a')],null))[_0x0d16('0x25')](respondWithResult(_0x1f9218,null))[_0x0d16('0x45')](handleError(_0x1f9218,null));};exports[_0x0d16('0x26')]=function(_0x5dfb97,_0x55915b){return db['SugarcrmConfiguration'][_0x0d16('0x48')]({'where':{'id':_0x5dfb97['params']['id']}})[_0x0d16('0x25')](handleEntityNotFound(_0x55915b,null))['then'](removeEntity(_0x55915b,null))[_0x0d16('0x45')](handleError(_0x55915b,null));};exports[_0x0d16('0x4b')]=function(_0x3a28ba,_0x536f05,_0x230cbb){var _0x1e7fdf={};var _0x477d9c={};var _0x43241c;var _0x10c9e9;return db[_0x0d16('0x2c')]['findOne']({'where':{'id':_0x3a28ba[_0x0d16('0x47')]['id']}})[_0x0d16('0x25')](handleEntityNotFound(_0x536f05,null))[_0x0d16('0x25')](function(_0x4404eb){if(_0x4404eb){_0x43241c=_0x4404eb;_0x477d9c[_0x0d16('0x2f')]=_[_0x0d16('0x30')](db['SugarcrmField'][_0x0d16('0x2d')]);_0x477d9c[_0x0d16('0x32')]=_[_0x0d16('0x30')](_0x3a28ba['query']);_0x477d9c['filters']=_['intersection'](_0x477d9c[_0x0d16('0x2f')],_0x477d9c[_0x0d16('0x32')]);_0x1e7fdf[_0x0d16('0x33')]=_[_0x0d16('0x34')](_0x477d9c[_0x0d16('0x2f')],qs['fields'](_0x3a28ba[_0x0d16('0x32')][_0x0d16('0x35')]));_0x1e7fdf['attributes']=_0x1e7fdf[_0x0d16('0x33')]['length']?_0x1e7fdf[_0x0d16('0x33')]:_0x477d9c[_0x0d16('0x2f')];_0x1e7fdf['order']=qs[_0x0d16('0x3a')](_0x3a28ba[_0x0d16('0x32')][_0x0d16('0x3a')]);_0x1e7fdf['where']=qs[_0x0d16('0x31')](_[_0x0d16('0x3c')](_0x3a28ba[_0x0d16('0x32')],_0x477d9c[_0x0d16('0x31')]));if(_0x3a28ba['query'][_0x0d16('0x3d')]){_0x1e7fdf[_0x0d16('0x3b')]=_[_0x0d16('0x3f')](_0x1e7fdf['where'],{'$or':_['map'](_0x1e7fdf['attributes'],function(_0x471f9e){var _0x56ecfa={};_0x56ecfa[_0x471f9e]={'$like':'%'+_0x3a28ba[_0x0d16('0x32')]['filter']+'%'};return _0x56ecfa;})});}_0x1e7fdf=_[_0x0d16('0x3f')]({},_0x1e7fdf,_0x3a28ba[_0x0d16('0x40')]);return _0x43241c[_0x0d16('0x4b')](_0x1e7fdf);}})[_0x0d16('0x25')](function(_0x35cd4a){if(_0x35cd4a){_0x10c9e9=_0x35cd4a[_0x0d16('0x36')];if(!_0x3a28ba[_0x0d16('0x32')][_0x0d16('0x37')]('nolimit')){_0x1e7fdf[_0x0d16('0x1e')]=qs[_0x0d16('0x1e')](_0x3a28ba[_0x0d16('0x32')][_0x0d16('0x1e')]);_0x1e7fdf[_0x0d16('0x1c')]=qs[_0x0d16('0x1c')](_0x3a28ba[_0x0d16('0x32')][_0x0d16('0x1c')]);}return _0x43241c['getFields'](_0x1e7fdf);}})[_0x0d16('0x25')](function(_0x201b05){if(_0x201b05){return _0x201b05?{'count':_0x10c9e9,'rows':_0x201b05}:null;}})[_0x0d16('0x25')](respondWithResult(_0x536f05,null))[_0x0d16('0x45')](handleError(_0x536f05,null));};exports[_0x0d16('0x4c')]=function(_0x1aa635,_0x32c607,_0x1b5867){var _0x319ee4={};var _0x2a8a85={};var _0x2a68b4;var _0x5a3aa7;return db['SugarcrmConfiguration'][_0x0d16('0x4d')]({'where':{'id':_0x1aa635['params']['id']}})[_0x0d16('0x25')](handleEntityNotFound(_0x32c607,null))[_0x0d16('0x25')](function(_0x1e36ba){if(_0x1e36ba){_0x2a68b4=_0x1e36ba;_0x2a8a85[_0x0d16('0x2f')]=_[_0x0d16('0x30')](db[_0x0d16('0x4e')][_0x0d16('0x2d')]);_0x2a8a85[_0x0d16('0x32')]=_[_0x0d16('0x30')](_0x1aa635['query']);_0x2a8a85['filters']=_[_0x0d16('0x34')](_0x2a8a85[_0x0d16('0x2f')],_0x2a8a85[_0x0d16('0x32')]);_0x319ee4[_0x0d16('0x33')]=_[_0x0d16('0x34')](_0x2a8a85[_0x0d16('0x2f')],qs[_0x0d16('0x35')](_0x1aa635[_0x0d16('0x32')]['fields']));_0x319ee4['attributes']=_0x319ee4['attributes'][_0x0d16('0x36')]?_0x319ee4[_0x0d16('0x33')]:_0x2a8a85[_0x0d16('0x2f')];_0x319ee4[_0x0d16('0x39')]=qs[_0x0d16('0x3a')](_0x1aa635['query'][_0x0d16('0x3a')]);_0x319ee4['where']=qs[_0x0d16('0x31')](_[_0x0d16('0x3c')](_0x1aa635[_0x0d16('0x32')],_0x2a8a85[_0x0d16('0x31')]));if(_0x1aa635[_0x0d16('0x32')][_0x0d16('0x3d')]){_0x319ee4[_0x0d16('0x3b')]=_[_0x0d16('0x3f')](_0x319ee4[_0x0d16('0x3b')],{'$or':_[_0x0d16('0x2b')](_0x319ee4[_0x0d16('0x33')],function(_0x584ba7){var _0x1fe7be={};_0x1fe7be[_0x584ba7]={'$like':'%'+_0x1aa635[_0x0d16('0x32')][_0x0d16('0x3d')]+'%'};return _0x1fe7be;})});}_0x319ee4=_[_0x0d16('0x3f')]({},_0x319ee4,_0x1aa635[_0x0d16('0x40')]);return _0x2a68b4[_0x0d16('0x4c')](_0x319ee4);}})[_0x0d16('0x25')](function(_0x4e2a52){if(_0x4e2a52){_0x5a3aa7=_0x4e2a52[_0x0d16('0x36')];if(!_0x1aa635[_0x0d16('0x32')][_0x0d16('0x37')](_0x0d16('0x38'))){_0x319ee4[_0x0d16('0x1e')]=qs[_0x0d16('0x1e')](_0x1aa635[_0x0d16('0x32')][_0x0d16('0x1e')]);_0x319ee4['offset']=qs[_0x0d16('0x1c')](_0x1aa635[_0x0d16('0x32')][_0x0d16('0x1c')]);}return _0x2a68b4['getSubjects'](_0x319ee4);}})[_0x0d16('0x25')](function(_0x3b7986){if(_0x3b7986){return _0x3b7986?{'count':_0x5a3aa7,'rows':_0x3b7986}:null;}})[_0x0d16('0x25')](respondWithResult(_0x32c607,null))[_0x0d16('0x45')](handleError(_0x32c607,null));};exports[_0x0d16('0x4f')]=function(_0x34b0eb,_0x345cf4,_0xaf4fee){var _0x379389={};var _0x1a0dcd={};var _0x30172a;var _0x4fbe72;return db[_0x0d16('0x2c')][_0x0d16('0x4d')]({'where':{'id':_0x34b0eb[_0x0d16('0x47')]['id']}})['then'](handleEntityNotFound(_0x345cf4,null))[_0x0d16('0x25')](function(_0x325534){if(_0x325534){_0x30172a=_0x325534;_0x1a0dcd[_0x0d16('0x2f')]=_[_0x0d16('0x30')](db[_0x0d16('0x4e')][_0x0d16('0x2d')]);_0x1a0dcd['query']=_[_0x0d16('0x30')](_0x34b0eb[_0x0d16('0x32')]);_0x1a0dcd[_0x0d16('0x31')]=_[_0x0d16('0x34')](_0x1a0dcd[_0x0d16('0x2f')],_0x1a0dcd['query']);_0x379389['attributes']=_['intersection'](_0x1a0dcd[_0x0d16('0x2f')],qs[_0x0d16('0x35')](_0x34b0eb['query'][_0x0d16('0x35')]));_0x379389[_0x0d16('0x33')]=_0x379389[_0x0d16('0x33')][_0x0d16('0x36')]?_0x379389[_0x0d16('0x33')]:_0x1a0dcd[_0x0d16('0x2f')];_0x379389[_0x0d16('0x39')]=qs['sort'](_0x34b0eb[_0x0d16('0x32')][_0x0d16('0x3a')]);_0x379389[_0x0d16('0x3b')]=qs[_0x0d16('0x31')](_['pick'](_0x34b0eb['query'],_0x1a0dcd[_0x0d16('0x31')]));if(_0x34b0eb[_0x0d16('0x32')]['filter']){_0x379389['where']=_[_0x0d16('0x3f')](_0x379389[_0x0d16('0x3b')],{'$or':_[_0x0d16('0x2b')](_0x379389[_0x0d16('0x33')],function(_0x4d4eb9){var _0x532b31={};_0x532b31[_0x4d4eb9]={'$like':'%'+_0x34b0eb['query'][_0x0d16('0x3d')]+'%'};return _0x532b31;})});}_0x379389=_[_0x0d16('0x3f')]({},_0x379389,_0x34b0eb[_0x0d16('0x40')]);return _0x30172a[_0x0d16('0x4f')](_0x379389);}})[_0x0d16('0x25')](function(_0x519ef9){if(_0x519ef9){_0x4fbe72=_0x519ef9['length'];if(!_0x34b0eb[_0x0d16('0x32')][_0x0d16('0x37')](_0x0d16('0x38'))){_0x379389[_0x0d16('0x1e')]=qs[_0x0d16('0x1e')](_0x34b0eb[_0x0d16('0x32')][_0x0d16('0x1e')]);_0x379389[_0x0d16('0x1c')]=qs[_0x0d16('0x1c')](_0x34b0eb[_0x0d16('0x32')][_0x0d16('0x1c')]);}return _0x30172a[_0x0d16('0x4f')](_0x379389);}})[_0x0d16('0x25')](function(_0x1adb26){if(_0x1adb26){return _0x1adb26?{'count':_0x4fbe72,'rows':_0x1adb26}:null;}})[_0x0d16('0x25')](respondWithResult(_0x345cf4,null))[_0x0d16('0x45')](handleError(_0x345cf4,null));}; \ No newline at end of file +var _0x0b2d=['../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','SugarcrmConfiguration','rows','catch','params','find','create','body','destroy','getFields','findOne','SugarcrmField','hasOwnProperty','getSubjects','getDescriptions','rimraf','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x1486e5,_0x39684f){var _0x29d89b=function(_0x4a0a80){while(--_0x4a0a80){_0x1486e5['push'](_0x1486e5['shift']());}};_0x29d89b(++_0x39684f);}(_0x0b2d,0xd5));var _0xd0b2=function(_0xb2cc48,_0x27038f){_0xb2cc48=_0xb2cc48-0x0;var _0x5c1466=_0x0b2d[_0xb2cc48];return _0x5c1466;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd0b2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd0b2('0x1'));var Mustache=require(_0xd0b2('0x2'));var util=require(_0xd0b2('0x3'));var path=require('path');var sox=require(_0xd0b2('0x4'));var csv=require(_0xd0b2('0x5'));var ejs=require(_0xd0b2('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd0b2('0x7'));var squel=require(_0xd0b2('0x8'));var crypto=require('crypto');var jsforce=require(_0xd0b2('0x9'));var deskjs=require(_0xd0b2('0xa'));var toCsv=require(_0xd0b2('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd0b2('0xb'));var qs=require(_0xd0b2('0xc'));var as=require(_0xd0b2('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd0b2('0xe'))(_0xd0b2('0xf'));var utils=require(_0xd0b2('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xd0b2('0x11'));var db=require(_0xd0b2('0x12'))['db'];function respondWithStatusCode(_0x2257e3,_0x11224c){_0x11224c=_0x11224c||0xcc;return function(_0x3ffb6f){if(_0x3ffb6f){return _0x2257e3[_0xd0b2('0x13')](_0x11224c);}return _0x2257e3['status'](_0x11224c)[_0xd0b2('0x14')]();};}function respondWithResult(_0x5e2660,_0x415ab7){_0x415ab7=_0x415ab7||0xc8;return function(_0x367b9d){if(_0x367b9d){return _0x5e2660['status'](_0x415ab7)[_0xd0b2('0x15')](_0x367b9d);}};}function respondWithFilteredResult(_0x545e75,_0x56db34){return function(_0x106d32){if(_0x106d32){var _0x2d571f=typeof _0x56db34[_0xd0b2('0x16')]===_0xd0b2('0x17')&&typeof _0x56db34['limit']===_0xd0b2('0x17');var _0xd507f4=_0x106d32[_0xd0b2('0x18')];var _0xe16784=_0x2d571f?0x0:_0x56db34[_0xd0b2('0x16')];var _0x574565=_0x2d571f?_0x106d32[_0xd0b2('0x18')]:_0x56db34[_0xd0b2('0x16')]+_0x56db34[_0xd0b2('0x19')];var _0x54765f;if(_0x574565>=_0xd507f4){_0x574565=_0xd507f4;_0x54765f=0xc8;}else{_0x54765f=0xce;}_0x545e75[_0xd0b2('0x1a')](_0x54765f);return _0x545e75[_0xd0b2('0x1b')](_0xd0b2('0x1c'),_0xe16784+'-'+_0x574565+'/'+_0xd507f4)[_0xd0b2('0x15')](_0x106d32);}return null;};}function patchUpdates(_0x55a778){return function(_0x58c760){try{jsonpatch[_0xd0b2('0x1d')](_0x58c760,_0x55a778,!![]);}catch(_0x4a6ba3){return BPromise[_0xd0b2('0x1e')](_0x4a6ba3);}return _0x58c760[_0xd0b2('0x1f')]();};}function saveUpdates(_0x364e5b,_0x5982b0){return function(_0x4a6f44){if(_0x4a6f44){return _0x4a6f44[_0xd0b2('0x20')](_0x364e5b)[_0xd0b2('0x21')](function(_0x435510){return _0x435510;});}return null;};}function removeEntity(_0x4a7dd8,_0x26b41a){return function(_0x245ade){if(_0x245ade){return _0x245ade['destroy']()[_0xd0b2('0x21')](function(){_0x4a7dd8[_0xd0b2('0x1a')](0xcc)[_0xd0b2('0x14')]();});}};}function handleEntityNotFound(_0x30c1a9,_0x246d12){return function(_0x226f7b){if(!_0x226f7b){_0x30c1a9['sendStatus'](0x194);}return _0x226f7b;};}function handleError(_0x480f49,_0x24b1e){_0x24b1e=_0x24b1e||0x1f4;return function(_0x285902){logger[_0xd0b2('0x22')](_0x285902[_0xd0b2('0x23')]);if(_0x285902['name']){delete _0x285902['name'];}_0x480f49[_0xd0b2('0x1a')](_0x24b1e)[_0xd0b2('0x24')](_0x285902);};}exports[_0xd0b2('0x25')]=function(_0x12b76f,_0x9f381e){var _0x58be38={},_0x55c371={},_0x1298f7={'count':0x0,'rows':[]};var _0x5383d7=_[_0xd0b2('0x26')](db['SugarcrmConfiguration'][_0xd0b2('0x27')],function(_0x3e886f){return{'name':_0x3e886f[_0xd0b2('0x28')],'type':_0x3e886f[_0xd0b2('0x29')][_0xd0b2('0x2a')]};});_0x55c371[_0xd0b2('0x2b')]=_[_0xd0b2('0x26')](_0x5383d7,_0xd0b2('0x2c'));_0x55c371[_0xd0b2('0x2d')]=_[_0xd0b2('0x2e')](_0x12b76f[_0xd0b2('0x2d')]);_0x55c371[_0xd0b2('0x2f')]=_['intersection'](_0x55c371[_0xd0b2('0x2b')],_0x55c371[_0xd0b2('0x2d')]);_0x58be38['attributes']=_[_0xd0b2('0x30')](_0x55c371[_0xd0b2('0x2b')],qs[_0xd0b2('0x31')](_0x12b76f[_0xd0b2('0x2d')][_0xd0b2('0x31')]));_0x58be38[_0xd0b2('0x32')]=_0x58be38['attributes'][_0xd0b2('0x33')]?_0x58be38[_0xd0b2('0x32')]:_0x55c371['model'];if(!_0x12b76f[_0xd0b2('0x2d')]['hasOwnProperty'](_0xd0b2('0x34'))){_0x58be38[_0xd0b2('0x19')]=qs[_0xd0b2('0x19')](_0x12b76f['query'][_0xd0b2('0x19')]);_0x58be38[_0xd0b2('0x16')]=qs['offset'](_0x12b76f[_0xd0b2('0x2d')]['offset']);}_0x58be38[_0xd0b2('0x35')]=qs[_0xd0b2('0x36')](_0x12b76f[_0xd0b2('0x2d')][_0xd0b2('0x36')]);_0x58be38[_0xd0b2('0x37')]=qs[_0xd0b2('0x2f')](_[_0xd0b2('0x38')](_0x12b76f[_0xd0b2('0x2d')],_0x55c371['filters']),_0x5383d7);if(_0x12b76f[_0xd0b2('0x2d')][_0xd0b2('0x39')]){_0x58be38['where']=_[_0xd0b2('0x3a')](_0x58be38[_0xd0b2('0x37')],{'$or':_[_0xd0b2('0x26')](_0x5383d7,function(_0x3014f3){if(_0x3014f3['type']!==_0xd0b2('0x3b')){var _0xe0fade={};_0xe0fade[_0x3014f3[_0xd0b2('0x2c')]]={'$like':'%'+_0x12b76f[_0xd0b2('0x2d')][_0xd0b2('0x39')]+'%'};return _0xe0fade;}})});}_0x58be38=_['merge']({},_0x58be38,_0x12b76f[_0xd0b2('0x3c')]);var _0x2b77ff={'where':_0x58be38[_0xd0b2('0x37')]};return db['SugarcrmConfiguration'][_0xd0b2('0x18')](_0x2b77ff)[_0xd0b2('0x21')](function(_0x4b72dd){_0x1298f7['count']=_0x4b72dd;if(_0x12b76f[_0xd0b2('0x2d')][_0xd0b2('0x3d')]){_0x58be38[_0xd0b2('0x3e')]=[{'all':!![]}];}return db[_0xd0b2('0x3f')]['findAll'](_0x58be38);})['then'](function(_0x5e8572){_0x1298f7[_0xd0b2('0x40')]=_0x5e8572;return _0x1298f7;})['then'](respondWithFilteredResult(_0x9f381e,_0x58be38))[_0xd0b2('0x41')](handleError(_0x9f381e,null));};exports['show']=function(_0x100d12,_0x593a80){var _0x4856f6={'raw':![],'where':{'id':_0x100d12[_0xd0b2('0x42')]['id']}},_0x176450={};_0x176450[_0xd0b2('0x2b')]=_[_0xd0b2('0x2e')](db['SugarcrmConfiguration']['rawAttributes']);_0x176450[_0xd0b2('0x2d')]=_[_0xd0b2('0x2e')](_0x100d12[_0xd0b2('0x2d')]);_0x176450[_0xd0b2('0x2f')]=_[_0xd0b2('0x30')](_0x176450[_0xd0b2('0x2b')],_0x176450[_0xd0b2('0x2d')]);_0x4856f6[_0xd0b2('0x32')]=_[_0xd0b2('0x30')](_0x176450['model'],qs[_0xd0b2('0x31')](_0x100d12[_0xd0b2('0x2d')][_0xd0b2('0x31')]));_0x4856f6[_0xd0b2('0x32')]=_0x4856f6[_0xd0b2('0x32')][_0xd0b2('0x33')]?_0x4856f6[_0xd0b2('0x32')]:_0x176450[_0xd0b2('0x2b')];if(_0x100d12['query'][_0xd0b2('0x3d')]){_0x4856f6[_0xd0b2('0x3e')]=[{'all':!![]}];}_0x4856f6=_[_0xd0b2('0x3a')]({},_0x4856f6,_0x100d12[_0xd0b2('0x3c')]);return db[_0xd0b2('0x3f')][_0xd0b2('0x43')](_0x4856f6)[_0xd0b2('0x21')](handleEntityNotFound(_0x593a80,null))[_0xd0b2('0x21')](respondWithResult(_0x593a80,null))[_0xd0b2('0x41')](handleError(_0x593a80,null));};exports[_0xd0b2('0x44')]=function(_0x4cf810,_0x16918f){return db[_0xd0b2('0x3f')][_0xd0b2('0x44')](_0x4cf810[_0xd0b2('0x45')],{})[_0xd0b2('0x21')](respondWithResult(_0x16918f,0xc9))[_0xd0b2('0x41')](handleError(_0x16918f,null));};exports[_0xd0b2('0x20')]=function(_0x18d91c,_0x79cc8d){if(_0x18d91c[_0xd0b2('0x45')]['id']){delete _0x18d91c[_0xd0b2('0x45')]['id'];}return db[_0xd0b2('0x3f')][_0xd0b2('0x43')]({'where':{'id':_0x18d91c[_0xd0b2('0x42')]['id']}})[_0xd0b2('0x21')](handleEntityNotFound(_0x79cc8d,null))[_0xd0b2('0x21')](saveUpdates(_0x18d91c['body'],null))[_0xd0b2('0x21')](respondWithResult(_0x79cc8d,null))['catch'](handleError(_0x79cc8d,null));};exports[_0xd0b2('0x46')]=function(_0x57f38e,_0x42bf29){return db[_0xd0b2('0x3f')]['find']({'where':{'id':_0x57f38e['params']['id']}})[_0xd0b2('0x21')](handleEntityNotFound(_0x42bf29,null))['then'](removeEntity(_0x42bf29,null))[_0xd0b2('0x41')](handleError(_0x42bf29,null));};exports[_0xd0b2('0x47')]=function(_0x847179,_0x4bedb9,_0x521634){var _0x15041b={};var _0xe07db7={};var _0x900118;var _0x5e7edf;return db['SugarcrmConfiguration'][_0xd0b2('0x48')]({'where':{'id':_0x847179['params']['id']}})[_0xd0b2('0x21')](handleEntityNotFound(_0x4bedb9,null))['then'](function(_0x3abbd2){if(_0x3abbd2){_0x900118=_0x3abbd2;_0xe07db7[_0xd0b2('0x2b')]=_['keys'](db[_0xd0b2('0x49')]['rawAttributes']);_0xe07db7[_0xd0b2('0x2d')]=_[_0xd0b2('0x2e')](_0x847179['query']);_0xe07db7['filters']=_[_0xd0b2('0x30')](_0xe07db7[_0xd0b2('0x2b')],_0xe07db7[_0xd0b2('0x2d')]);_0x15041b['attributes']=_[_0xd0b2('0x30')](_0xe07db7[_0xd0b2('0x2b')],qs[_0xd0b2('0x31')](_0x847179[_0xd0b2('0x2d')][_0xd0b2('0x31')]));_0x15041b[_0xd0b2('0x32')]=_0x15041b['attributes'][_0xd0b2('0x33')]?_0x15041b[_0xd0b2('0x32')]:_0xe07db7['model'];_0x15041b[_0xd0b2('0x35')]=qs[_0xd0b2('0x36')](_0x847179[_0xd0b2('0x2d')][_0xd0b2('0x36')]);_0x15041b[_0xd0b2('0x37')]=qs['filters'](_[_0xd0b2('0x38')](_0x847179[_0xd0b2('0x2d')],_0xe07db7[_0xd0b2('0x2f')]));if(_0x847179[_0xd0b2('0x2d')][_0xd0b2('0x39')]){_0x15041b[_0xd0b2('0x37')]=_[_0xd0b2('0x3a')](_0x15041b[_0xd0b2('0x37')],{'$or':_[_0xd0b2('0x26')](_0x15041b['attributes'],function(_0x460c02){var _0xda4393={};_0xda4393[_0x460c02]={'$like':'%'+_0x847179[_0xd0b2('0x2d')]['filter']+'%'};return _0xda4393;})});}_0x15041b=_[_0xd0b2('0x3a')]({},_0x15041b,_0x847179[_0xd0b2('0x3c')]);return _0x900118['getFields'](_0x15041b);}})[_0xd0b2('0x21')](function(_0x3a7544){if(_0x3a7544){_0x5e7edf=_0x3a7544[_0xd0b2('0x33')];if(!_0x847179[_0xd0b2('0x2d')][_0xd0b2('0x4a')](_0xd0b2('0x34'))){_0x15041b[_0xd0b2('0x19')]=qs[_0xd0b2('0x19')](_0x847179['query']['limit']);_0x15041b['offset']=qs[_0xd0b2('0x16')](_0x847179[_0xd0b2('0x2d')][_0xd0b2('0x16')]);}return _0x900118['getFields'](_0x15041b);}})[_0xd0b2('0x21')](function(_0x4c5eb4){if(_0x4c5eb4){return _0x4c5eb4?{'count':_0x5e7edf,'rows':_0x4c5eb4}:null;}})[_0xd0b2('0x21')](respondWithResult(_0x4bedb9,null))[_0xd0b2('0x41')](handleError(_0x4bedb9,null));};exports[_0xd0b2('0x4b')]=function(_0x302dc2,_0x20cbbd,_0xcdccad){var _0x21ec51={};var _0x56160b={};var _0x3a6789;var _0x48947c;return db['SugarcrmConfiguration'][_0xd0b2('0x48')]({'where':{'id':_0x302dc2[_0xd0b2('0x42')]['id']}})['then'](handleEntityNotFound(_0x20cbbd,null))[_0xd0b2('0x21')](function(_0x289491){if(_0x289491){_0x3a6789=_0x289491;_0x56160b[_0xd0b2('0x2b')]=_['keys'](db[_0xd0b2('0x49')][_0xd0b2('0x27')]);_0x56160b[_0xd0b2('0x2d')]=_[_0xd0b2('0x2e')](_0x302dc2[_0xd0b2('0x2d')]);_0x56160b[_0xd0b2('0x2f')]=_[_0xd0b2('0x30')](_0x56160b[_0xd0b2('0x2b')],_0x56160b[_0xd0b2('0x2d')]);_0x21ec51[_0xd0b2('0x32')]=_[_0xd0b2('0x30')](_0x56160b[_0xd0b2('0x2b')],qs[_0xd0b2('0x31')](_0x302dc2[_0xd0b2('0x2d')][_0xd0b2('0x31')]));_0x21ec51[_0xd0b2('0x32')]=_0x21ec51[_0xd0b2('0x32')][_0xd0b2('0x33')]?_0x21ec51[_0xd0b2('0x32')]:_0x56160b['model'];_0x21ec51['order']=qs[_0xd0b2('0x36')](_0x302dc2[_0xd0b2('0x2d')]['sort']);_0x21ec51[_0xd0b2('0x37')]=qs[_0xd0b2('0x2f')](_['pick'](_0x302dc2[_0xd0b2('0x2d')],_0x56160b['filters']));if(_0x302dc2[_0xd0b2('0x2d')][_0xd0b2('0x39')]){_0x21ec51['where']=_[_0xd0b2('0x3a')](_0x21ec51[_0xd0b2('0x37')],{'$or':_['map'](_0x21ec51[_0xd0b2('0x32')],function(_0x3f443d){var _0x44b80f={};_0x44b80f[_0x3f443d]={'$like':'%'+_0x302dc2['query'][_0xd0b2('0x39')]+'%'};return _0x44b80f;})});}_0x21ec51=_[_0xd0b2('0x3a')]({},_0x21ec51,_0x302dc2[_0xd0b2('0x3c')]);return _0x3a6789['getSubjects'](_0x21ec51);}})['then'](function(_0x424c47){if(_0x424c47){_0x48947c=_0x424c47['length'];if(!_0x302dc2[_0xd0b2('0x2d')]['hasOwnProperty'](_0xd0b2('0x34'))){_0x21ec51[_0xd0b2('0x19')]=qs[_0xd0b2('0x19')](_0x302dc2[_0xd0b2('0x2d')]['limit']);_0x21ec51[_0xd0b2('0x16')]=qs[_0xd0b2('0x16')](_0x302dc2['query'][_0xd0b2('0x16')]);}return _0x3a6789['getSubjects'](_0x21ec51);}})[_0xd0b2('0x21')](function(_0x2514c8){if(_0x2514c8){return _0x2514c8?{'count':_0x48947c,'rows':_0x2514c8}:null;}})[_0xd0b2('0x21')](respondWithResult(_0x20cbbd,null))[_0xd0b2('0x41')](handleError(_0x20cbbd,null));};exports[_0xd0b2('0x4c')]=function(_0x30e6b6,_0x2b63a1,_0x508e8a){var _0x2f7401={};var _0x24ae43={};var _0x42bc85;var _0x1c474f;return db[_0xd0b2('0x3f')][_0xd0b2('0x48')]({'where':{'id':_0x30e6b6[_0xd0b2('0x42')]['id']}})['then'](handleEntityNotFound(_0x2b63a1,null))['then'](function(_0x10a1b3){if(_0x10a1b3){_0x42bc85=_0x10a1b3;_0x24ae43[_0xd0b2('0x2b')]=_[_0xd0b2('0x2e')](db[_0xd0b2('0x49')][_0xd0b2('0x27')]);_0x24ae43[_0xd0b2('0x2d')]=_[_0xd0b2('0x2e')](_0x30e6b6[_0xd0b2('0x2d')]);_0x24ae43[_0xd0b2('0x2f')]=_[_0xd0b2('0x30')](_0x24ae43[_0xd0b2('0x2b')],_0x24ae43[_0xd0b2('0x2d')]);_0x2f7401['attributes']=_[_0xd0b2('0x30')](_0x24ae43[_0xd0b2('0x2b')],qs[_0xd0b2('0x31')](_0x30e6b6[_0xd0b2('0x2d')]['fields']));_0x2f7401['attributes']=_0x2f7401[_0xd0b2('0x32')][_0xd0b2('0x33')]?_0x2f7401[_0xd0b2('0x32')]:_0x24ae43[_0xd0b2('0x2b')];_0x2f7401['order']=qs[_0xd0b2('0x36')](_0x30e6b6[_0xd0b2('0x2d')][_0xd0b2('0x36')]);_0x2f7401[_0xd0b2('0x37')]=qs[_0xd0b2('0x2f')](_['pick'](_0x30e6b6[_0xd0b2('0x2d')],_0x24ae43[_0xd0b2('0x2f')]));if(_0x30e6b6[_0xd0b2('0x2d')][_0xd0b2('0x39')]){_0x2f7401[_0xd0b2('0x37')]=_[_0xd0b2('0x3a')](_0x2f7401[_0xd0b2('0x37')],{'$or':_[_0xd0b2('0x26')](_0x2f7401[_0xd0b2('0x32')],function(_0x1e4f07){var _0x42b5b1={};_0x42b5b1[_0x1e4f07]={'$like':'%'+_0x30e6b6[_0xd0b2('0x2d')][_0xd0b2('0x39')]+'%'};return _0x42b5b1;})});}_0x2f7401=_[_0xd0b2('0x3a')]({},_0x2f7401,_0x30e6b6[_0xd0b2('0x3c')]);return _0x42bc85[_0xd0b2('0x4c')](_0x2f7401);}})[_0xd0b2('0x21')](function(_0x162c2a){if(_0x162c2a){_0x1c474f=_0x162c2a[_0xd0b2('0x33')];if(!_0x30e6b6[_0xd0b2('0x2d')][_0xd0b2('0x4a')](_0xd0b2('0x34'))){_0x2f7401[_0xd0b2('0x19')]=qs[_0xd0b2('0x19')](_0x30e6b6[_0xd0b2('0x2d')][_0xd0b2('0x19')]);_0x2f7401[_0xd0b2('0x16')]=qs[_0xd0b2('0x16')](_0x30e6b6['query']['offset']);}return _0x42bc85[_0xd0b2('0x4c')](_0x2f7401);}})[_0xd0b2('0x21')](function(_0x4f0905){if(_0x4f0905){return _0x4f0905?{'count':_0x1c474f,'rows':_0x4f0905}:null;}})[_0xd0b2('0x21')](respondWithResult(_0x2b63a1,null))[_0xd0b2('0x41')](handleError(_0x2b63a1,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 88954d6..b835991 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 _0x2643=['exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes'];(function(_0x3de154,_0x31b94a){var _0x1caf73=function(_0x509b53){while(--_0x509b53){_0x3de154['push'](_0x3de154['shift']());}};_0x1caf73(++_0x31b94a);}(_0x2643,0x155));var _0x3264=function(_0x198c45,_0x11150a){_0x198c45=_0x198c45-0x0;var _0x1fa9de=_0x2643[_0x198c45];return _0x1fa9de;};'use strict';var _=require(_0x3264('0x0'));var util=require(_0x3264('0x1'));var logger=require(_0x3264('0x2'))('api');var moment=require(_0x3264('0x3'));var BPromise=require(_0x3264('0x4'));var rp=require(_0x3264('0x5'));var fs=require('fs');var path=require(_0x3264('0x6'));var rimraf=require(_0x3264('0x7'));var config=require(_0x3264('0x8'));var attributes=require(_0x3264('0x9'));module[_0x3264('0xa')]=function(_0x30d538,_0x5525d2){return _0x30d538['define'](_0x3264('0xb'),attributes,{'tableName':_0x3264('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f1c=['exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes'];(function(_0x27ddf5,_0x5a3e18){var _0x26e74a=function(_0x5f24ac){while(--_0x5f24ac){_0x27ddf5['push'](_0x27ddf5['shift']());}};_0x26e74a(++_0x5a3e18);}(_0x9f1c,0x19c));var _0xc9f1=function(_0x2a2eb4,_0x132f4e){_0x2a2eb4=_0x2a2eb4-0x0;var _0x4661f2=_0x9f1c[_0x2a2eb4];return _0x4661f2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc9f1('0x0'))(_0xc9f1('0x1'));var moment=require(_0xc9f1('0x2'));var BPromise=require('bluebird');var rp=require(_0xc9f1('0x3'));var fs=require('fs');var path=require(_0xc9f1('0x4'));var rimraf=require(_0xc9f1('0x5'));var config=require(_0xc9f1('0x6'));var attributes=require(_0xc9f1('0x7'));module[_0xc9f1('0x8')]=function(_0x517453,_0x5cfe64){return _0x517453[_0xc9f1('0x9')](_0xc9f1('0xa'),attributes,{'tableName':_0xc9f1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 179772f..9ca73da 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 _0xadc6=['then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x796aab,_0xb79b5c){var _0x93ba32=function(_0x56e55e){while(--_0x56e55e){_0x796aab['push'](_0x796aab['shift']());}};_0x93ba32(++_0xb79b5c);}(_0xadc6,0x170));var _0x6adc=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xadc6[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0x6adc('0x0'));var util=require(_0x6adc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6adc('0x2'));var fs=require('fs');var Redis=require(_0x6adc('0x3'));var db=require(_0x6adc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6adc('0x5'))(_0x6adc('0x6'));var config=require('../../config/environment');var jayson=require(_0x6adc('0x7'));var client=jayson[_0x6adc('0x8')][_0x6adc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b584e,_0x22b379,_0x45125d){return new BPromise(function(_0x3e39b4,_0xcbd2a0){return client['request'](_0x3b584e,_0x45125d)[_0x6adc('0xa')](function(_0x2d6c6e){logger[_0x6adc('0xb')](_0x6adc('0xc'),_0x22b379,_0x6adc('0xd'));logger['debug'](_0x6adc('0xe'),_0x22b379,_0x6adc('0xd'),JSON[_0x6adc('0xf')](_0x2d6c6e));if(_0x2d6c6e['error']){if(_0x2d6c6e[_0x6adc('0x10')][_0x6adc('0x11')]===0x1f4){logger[_0x6adc('0x10')](_0x6adc('0xc'),_0x22b379,_0x2d6c6e['error']['message']);return _0xcbd2a0(_0x2d6c6e[_0x6adc('0x10')][_0x6adc('0x12')]);}logger['error'](_0x6adc('0xc'),_0x22b379,_0x2d6c6e['error'][_0x6adc('0x12')]);return _0x3e39b4(_0x2d6c6e[_0x6adc('0x10')][_0x6adc('0x12')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x22b379,_0x6adc('0xd'));_0x3e39b4(_0x2d6c6e[_0x6adc('0x13')]['message']);}})[_0x6adc('0x14')](function(_0x21b4b3){logger[_0x6adc('0x10')](_0x6adc('0xc'),_0x22b379,_0x21b4b3);_0xcbd2a0(_0x21b4b3);});});} \ No newline at end of file +var _0x79e0=['message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error'];(function(_0x5c5962,_0x3cb466){var _0x3889e5=function(_0x792aba){while(--_0x792aba){_0x5c5962['push'](_0x5c5962['shift']());}};_0x3889e5(++_0x3cb466);}(_0x79e0,0x96));var _0x079e=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x79e0[_0x50aa2e];return _0x5e07f0;};'use strict';var _=require(_0x079e('0x0'));var util=require(_0x079e('0x1'));var moment=require('moment');var BPromise=require(_0x079e('0x2'));var rs=require(_0x079e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x079e('0x4'))['db'];var utils=require(_0x079e('0x5'));var logger=require(_0x079e('0x6'))('rpc');var config=require(_0x079e('0x7'));var jayson=require(_0x079e('0x8'));var client=jayson[_0x079e('0x9')][_0x079e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1590ee,_0x2c6467,_0x356861){return new BPromise(function(_0x3b8983,_0x4026a1){return client['request'](_0x1590ee,_0x356861)[_0x079e('0xb')](function(_0x511cbb){logger[_0x079e('0xc')](_0x079e('0xd'),_0x2c6467,_0x079e('0xe'));logger[_0x079e('0xf')](_0x079e('0x10'),_0x2c6467,_0x079e('0xe'),JSON['stringify'](_0x511cbb));if(_0x511cbb[_0x079e('0x11')]){if(_0x511cbb['error']['code']===0x1f4){logger[_0x079e('0x11')](_0x079e('0xd'),_0x2c6467,_0x511cbb[_0x079e('0x11')][_0x079e('0x12')]);return _0x4026a1(_0x511cbb[_0x079e('0x11')]['message']);}logger[_0x079e('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2c6467,_0x511cbb['error']['message']);return _0x3b8983(_0x511cbb[_0x079e('0x11')][_0x079e('0x12')]);}else{logger[_0x079e('0xc')](_0x079e('0xd'),_0x2c6467,'request\x20sent');_0x3b8983(_0x511cbb[_0x079e('0x13')][_0x079e('0x12')]);}})[_0x079e('0x14')](function(_0x4c5435){logger[_0x079e('0x11')](_0x079e('0xd'),_0x2c6467,_0x4c5435);_0x4026a1(_0x4c5435);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 61833a7..a7564c6 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 _0xf709=['isAuthenticated','index','get','/:id','show','post','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xf709,0x1ae));var _0x9f70=function(_0x586180,_0x67c06){_0x586180=_0x586180-0x0;var _0x4e47ae=_0xf709[_0x586180];return _0x4e47ae;};'use strict';var multer=require(_0x9f70('0x0'));var util=require(_0x9f70('0x1'));var path=require('path');var timeout=require(_0x9f70('0x2'));var express=require(_0x9f70('0x3'));var router=express[_0x9f70('0x4')]();var fs_extra=require(_0x9f70('0x5'));var auth=require(_0x9f70('0x6'));var interaction=require(_0x9f70('0x7'));var config=require(_0x9f70('0x8'));var controller=require(_0x9f70('0x9'));router['get']('/',auth[_0x9f70('0xa')](),controller[_0x9f70('0xb')]);router[_0x9f70('0xc')](_0x9f70('0xd'),auth['isAuthenticated'](),controller[_0x9f70('0xe')]);router[_0x9f70('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9f70('0x10')](_0x9f70('0xd'),auth['isAuthenticated'](),controller[_0x9f70('0x11')]);router[_0x9f70('0x12')](_0x9f70('0xd'),auth[_0x9f70('0xa')](),controller['destroy']);module[_0x9f70('0x13')]=router; \ No newline at end of file +var _0x50f6=['get','/:id','show','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','index'];(function(_0x21328f,_0x6c0824){var _0x326291=function(_0xd1f583){while(--_0xd1f583){_0x21328f['push'](_0x21328f['shift']());}};_0x326291(++_0x6c0824);}(_0x50f6,0xfe));var _0x650f=function(_0x2cf7e4,_0x1141bd){_0x2cf7e4=_0x2cf7e4-0x0;var _0x56578c=_0x50f6[_0x2cf7e4];return _0x56578c;};'use strict';var multer=require(_0x650f('0x0'));var util=require(_0x650f('0x1'));var path=require('path');var timeout=require(_0x650f('0x2'));var express=require(_0x650f('0x3'));var router=express[_0x650f('0x4')]();var fs_extra=require(_0x650f('0x5'));var auth=require(_0x650f('0x6'));var interaction=require(_0x650f('0x7'));var config=require(_0x650f('0x8'));var controller=require(_0x650f('0x9'));router['get']('/',auth[_0x650f('0xa')](),controller[_0x650f('0xb')]);router[_0x650f('0xc')](_0x650f('0xd'),auth[_0x650f('0xa')](),controller[_0x650f('0xe')]);router['post']('/',auth[_0x650f('0xa')](),controller['create']);router[_0x650f('0xf')](_0x650f('0xd'),auth[_0x650f('0xa')](),controller[_0x650f('0x10')]);router['delete']('/:id',auth[_0x650f('0xa')](),controller[_0x650f('0x11')]);module[_0x650f('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 4f99f23..a33d935 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 _0xc253=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x3037ae,_0x4f5dd6){var _0x233075=function(_0x4dcfb2){while(--_0x4dcfb2){_0x3037ae['push'](_0x3037ae['shift']());}};_0x233075(++_0x4f5dd6);}(_0xc253,0x1e7));var _0x3c25=function(_0x252ef1,_0x2e0041){_0x252ef1=_0x252ef1-0x0;var _0x25817c=_0xc253[_0x252ef1];return _0x25817c;};'use strict';var Sequelize=require(_0x3c25('0x0'));module[_0x3c25('0x1')]={'type':{'type':Sequelize[_0x3c25('0x2')](_0x3c25('0x3'),_0x3c25('0x4'),_0x3c25('0x5'),_0x3c25('0x6'),_0x3c25('0x7')),'defaultValue':_0x3c25('0x3')},'content':{'type':Sequelize[_0x3c25('0x8')]},'key':{'type':Sequelize[_0x3c25('0x8')]},'keyType':{'type':Sequelize['ENUM']('string',_0x3c25('0x4'),_0x3c25('0x5'))},'keyContent':{'type':Sequelize[_0x3c25('0x8')]},'idField':{'type':Sequelize[_0x3c25('0x8')]},'nameField':{'type':Sequelize[_0x3c25('0x8')]},'customField':{'type':Sequelize[_0x3c25('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3c25('0x8')]}}; \ No newline at end of file +var _0x0c13=['ENUM','string','variable','customVariable','picklist','STRING','sequelize','exports'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x0c13,0x1ae));var _0x30c1=function(_0x239650,_0x56aeda){_0x239650=_0x239650-0x0;var _0xee0bd6=_0x0c13[_0x239650];return _0xee0bd6;};'use strict';var Sequelize=require(_0x30c1('0x0'));module[_0x30c1('0x1')]={'type':{'type':Sequelize[_0x30c1('0x2')](_0x30c1('0x3'),_0x30c1('0x4'),_0x30c1('0x5'),'keyValue',_0x30c1('0x6')),'defaultValue':_0x30c1('0x3')},'content':{'type':Sequelize[_0x30c1('0x7')]},'key':{'type':Sequelize[_0x30c1('0x7')]},'keyType':{'type':Sequelize[_0x30c1('0x2')](_0x30c1('0x3'),_0x30c1('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x30c1('0x7')]},'idField':{'type':Sequelize[_0x30c1('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x30c1('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index b0a1580..11046a2 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 _0x891a=['key','model','query','keys','attributes','fields','length','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','count','findAll','rows','catch','show','params','intersection','includeAll','include','options','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','end','json','undefined','limit','offset','set','Content-Range','apply','reject','update','then','status','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type'];(function(_0x4b48d8,_0x3a5bf2){var _0xfa124=function(_0x46c9ac){while(--_0x46c9ac){_0x4b48d8['push'](_0x4b48d8['shift']());}};_0xfa124(++_0x3a5bf2);}(_0x891a,0xb6));var _0xa891=function(_0xe38e1a,_0x1888a8){_0xe38e1a=_0xe38e1a-0x0;var _0x1dbc9=_0x891a[_0xe38e1a];return _0x1dbc9;};'use strict';var emlformat=require(_0xa891('0x0'));var rimraf=require(_0xa891('0x1'));var zipdir=require(_0xa891('0x2'));var jsonpatch=require(_0xa891('0x3'));var rp=require(_0xa891('0x4'));var moment=require(_0xa891('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa891('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa891('0x7'));var _=require(_0xa891('0x8'));var squel=require(_0xa891('0x9'));var crypto=require(_0xa891('0xa'));var jsforce=require(_0xa891('0xb'));var deskjs=require(_0xa891('0xc'));var toCsv=require(_0xa891('0xd'));var querystring=require(_0xa891('0xe'));var Papa=require(_0xa891('0xf'));var Redis=require(_0xa891('0x10'));var authService=require(_0xa891('0x11'));var qs=require(_0xa891('0x12'));var as=require(_0xa891('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa891('0x14'));var utils=require(_0xa891('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa891('0x16'))['db'];function respondWithStatusCode(_0x959008,_0x4d69e2){_0x4d69e2=_0x4d69e2||0xcc;return function(_0x441614){if(_0x441614){return _0x959008[_0xa891('0x17')](_0x4d69e2);}return _0x959008['status'](_0x4d69e2)[_0xa891('0x18')]();};}function respondWithResult(_0x3b83eb,_0x2b776f){_0x2b776f=_0x2b776f||0xc8;return function(_0x2a1867){if(_0x2a1867){return _0x3b83eb['status'](_0x2b776f)[_0xa891('0x19')](_0x2a1867);}};}function respondWithFilteredResult(_0x40f681,_0x3e9175){return function(_0x42a47c){if(_0x42a47c){var _0x1eb68f=typeof _0x3e9175['offset']===_0xa891('0x1a')&&typeof _0x3e9175[_0xa891('0x1b')]===_0xa891('0x1a');var _0x470eaa=_0x42a47c['count'];var _0x215c26=_0x1eb68f?0x0:_0x3e9175[_0xa891('0x1c')];var _0x5a2c58=_0x1eb68f?_0x42a47c['count']:_0x3e9175['offset']+_0x3e9175['limit'];var _0x417929;if(_0x5a2c58>=_0x470eaa){_0x5a2c58=_0x470eaa;_0x417929=0xc8;}else{_0x417929=0xce;}_0x40f681['status'](_0x417929);return _0x40f681[_0xa891('0x1d')](_0xa891('0x1e'),_0x215c26+'-'+_0x5a2c58+'/'+_0x470eaa)[_0xa891('0x19')](_0x42a47c);}return null;};}function patchUpdates(_0x1bc56c){return function(_0x4f18f5){try{jsonpatch[_0xa891('0x1f')](_0x4f18f5,_0x1bc56c,!![]);}catch(_0x3f4f5b){return BPromise[_0xa891('0x20')](_0x3f4f5b);}return _0x4f18f5['save']();};}function saveUpdates(_0x128fbe,_0x463338){return function(_0x174f31){if(_0x174f31){return _0x174f31[_0xa891('0x21')](_0x128fbe)[_0xa891('0x22')](function(_0x1c90a1){return _0x1c90a1;});}return null;};}function removeEntity(_0x416013,_0x2beb77){return function(_0x4dbcd9){if(_0x4dbcd9){return _0x4dbcd9['destroy']()[_0xa891('0x22')](function(){_0x416013[_0xa891('0x23')](0xcc)[_0xa891('0x18')]();});}};}function handleEntityNotFound(_0x57a907,_0x1c862b){return function(_0x4b0e4e){if(!_0x4b0e4e){_0x57a907['sendStatus'](0x194);}return _0x4b0e4e;};}function handleError(_0x1039ca,_0x8172a0){_0x8172a0=_0x8172a0||0x1f4;return function(_0x106083){logger[_0xa891('0x24')](_0x106083[_0xa891('0x25')]);if(_0x106083[_0xa891('0x26')]){delete _0x106083['name'];}_0x1039ca['status'](_0x8172a0)[_0xa891('0x27')](_0x106083);};}exports[_0xa891('0x28')]=function(_0x2d1660,_0x58658a){var _0x22bc72={},_0x3edcd0={},_0x548d65={'count':0x0,'rows':[]};var _0x55b67d=_[_0xa891('0x29')](db[_0xa891('0x2a')][_0xa891('0x2b')],function(_0x10be6d){return{'name':_0x10be6d[_0xa891('0x2c')],'type':_0x10be6d[_0xa891('0x2d')][_0xa891('0x2e')]};});_0x3edcd0[_0xa891('0x2f')]=_[_0xa891('0x29')](_0x55b67d,_0xa891('0x26'));_0x3edcd0[_0xa891('0x30')]=_[_0xa891('0x31')](_0x2d1660['query']);_0x3edcd0['filters']=_['intersection'](_0x3edcd0[_0xa891('0x2f')],_0x3edcd0[_0xa891('0x30')]);_0x22bc72[_0xa891('0x32')]=_['intersection'](_0x3edcd0[_0xa891('0x2f')],qs[_0xa891('0x33')](_0x2d1660[_0xa891('0x30')][_0xa891('0x33')]));_0x22bc72['attributes']=_0x22bc72[_0xa891('0x32')][_0xa891('0x34')]?_0x22bc72['attributes']:_0x3edcd0[_0xa891('0x2f')];if(!_0x2d1660[_0xa891('0x30')]['hasOwnProperty'](_0xa891('0x35'))){_0x22bc72[_0xa891('0x1b')]=qs[_0xa891('0x1b')](_0x2d1660[_0xa891('0x30')][_0xa891('0x1b')]);_0x22bc72[_0xa891('0x1c')]=qs[_0xa891('0x1c')](_0x2d1660[_0xa891('0x30')][_0xa891('0x1c')]);}_0x22bc72[_0xa891('0x36')]=qs[_0xa891('0x37')](_0x2d1660[_0xa891('0x30')][_0xa891('0x37')]);_0x22bc72['where']=qs[_0xa891('0x38')](_[_0xa891('0x39')](_0x2d1660[_0xa891('0x30')],_0x3edcd0['filters']),_0x55b67d);if(_0x2d1660[_0xa891('0x30')][_0xa891('0x3a')]){_0x22bc72['where']=_[_0xa891('0x3b')](_0x22bc72[_0xa891('0x3c')],{'$or':_[_0xa891('0x29')](_0x55b67d,function(_0x450f8a){if(_0x450f8a['type']!==_0xa891('0x3d')){var _0x41d1eb={};_0x41d1eb[_0x450f8a['name']]={'$like':'%'+_0x2d1660[_0xa891('0x30')][_0xa891('0x3a')]+'%'};return _0x41d1eb;}})});}_0x22bc72=_['merge']({},_0x22bc72,_0x2d1660['options']);var _0x5ca4c1={'where':_0x22bc72[_0xa891('0x3c')]};return db[_0xa891('0x2a')][_0xa891('0x3e')](_0x5ca4c1)[_0xa891('0x22')](function(_0x37008e){_0x548d65[_0xa891('0x3e')]=_0x37008e;if(_0x2d1660[_0xa891('0x30')]['includeAll']){_0x22bc72['include']=[{'all':!![]}];}return db[_0xa891('0x2a')][_0xa891('0x3f')](_0x22bc72);})['then'](function(_0x3e189b){_0x548d65[_0xa891('0x40')]=_0x3e189b;return _0x548d65;})[_0xa891('0x22')](respondWithFilteredResult(_0x58658a,_0x22bc72))[_0xa891('0x41')](handleError(_0x58658a,null));};exports[_0xa891('0x42')]=function(_0x145873,_0x729ca5){var _0x165209={'raw':!![],'where':{'id':_0x145873[_0xa891('0x43')]['id']}},_0x3b47e0={};_0x3b47e0[_0xa891('0x2f')]=_['keys'](db['SugarcrmField']['rawAttributes']);_0x3b47e0[_0xa891('0x30')]=_[_0xa891('0x31')](_0x145873['query']);_0x3b47e0[_0xa891('0x38')]=_['intersection'](_0x3b47e0[_0xa891('0x2f')],_0x3b47e0[_0xa891('0x30')]);_0x165209[_0xa891('0x32')]=_[_0xa891('0x44')](_0x3b47e0['model'],qs[_0xa891('0x33')](_0x145873[_0xa891('0x30')][_0xa891('0x33')]));_0x165209[_0xa891('0x32')]=_0x165209[_0xa891('0x32')]['length']?_0x165209[_0xa891('0x32')]:_0x3b47e0[_0xa891('0x2f')];if(_0x145873[_0xa891('0x30')][_0xa891('0x45')]){_0x165209[_0xa891('0x46')]=[{'all':!![]}];}_0x165209=_[_0xa891('0x3b')]({},_0x165209,_0x145873[_0xa891('0x47')]);return db[_0xa891('0x2a')]['find'](_0x165209)['then'](handleEntityNotFound(_0x729ca5,null))[_0xa891('0x22')](respondWithResult(_0x729ca5,null))[_0xa891('0x41')](handleError(_0x729ca5,null));};exports[_0xa891('0x48')]=function(_0x36fa91,_0x22d677){return db[_0xa891('0x2a')][_0xa891('0x48')](_0x36fa91[_0xa891('0x49')],{})[_0xa891('0x22')](respondWithResult(_0x22d677,0xc9))[_0xa891('0x41')](handleError(_0x22d677,null));};exports[_0xa891('0x21')]=function(_0x103806,_0xaf021d){if(_0x103806[_0xa891('0x49')]['id']){delete _0x103806['body']['id'];}return db[_0xa891('0x2a')][_0xa891('0x4a')]({'where':{'id':_0x103806[_0xa891('0x43')]['id']}})['then'](handleEntityNotFound(_0xaf021d,null))[_0xa891('0x22')](saveUpdates(_0x103806[_0xa891('0x49')],null))[_0xa891('0x22')](respondWithResult(_0xaf021d,null))[_0xa891('0x41')](handleError(_0xaf021d,null));};exports[_0xa891('0x4b')]=function(_0x30804c,_0xdf1a3){return db[_0xa891('0x2a')]['find']({'where':{'id':_0x30804c[_0xa891('0x43')]['id']}})['then'](handleEntityNotFound(_0xdf1a3,null))[_0xa891('0x22')](removeEntity(_0xdf1a3,null))[_0xa891('0x41')](handleError(_0xdf1a3,null));}; \ No newline at end of file +var _0x1d8d=['ejs','lodash','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','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','destroy','then','error','stack','name','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','options','includeAll','findAll','rows','catch','show','keys','find','create','body','update','params','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv'];(function(_0x425877,_0x1774f1){var _0x193345=function(_0x14e852){while(--_0x14e852){_0x425877['push'](_0x425877['shift']());}};_0x193345(++_0x1774f1);}(_0x1d8d,0xd7));var _0xd1d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d8d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd1d8('0x0'));var rimraf=require(_0xd1d8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd1d8('0x2'));var rp=require(_0xd1d8('0x3'));var moment=require(_0xd1d8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd1d8('0x5'));var util=require(_0xd1d8('0x6'));var path=require(_0xd1d8('0x7'));var sox=require(_0xd1d8('0x8'));var csv=require(_0xd1d8('0x9'));var ejs=require(_0xd1d8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd1d8('0xb'));var squel=require(_0xd1d8('0xc'));var crypto=require(_0xd1d8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd1d8('0xe'));var toCsv=require(_0xd1d8('0x9'));var querystring=require(_0xd1d8('0xf'));var Papa=require(_0xd1d8('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd1d8('0x11'));var as=require(_0xd1d8('0x12'));var hardwareService=require(_0xd1d8('0x13'));var logger=require(_0xd1d8('0x14'))(_0xd1d8('0x15'));var utils=require(_0xd1d8('0x16'));var config=require(_0xd1d8('0x17'));var licenseUtil=require(_0xd1d8('0x18'));var db=require(_0xd1d8('0x19'))['db'];function respondWithStatusCode(_0x1a68be,_0x4e7bf6){_0x4e7bf6=_0x4e7bf6||0xcc;return function(_0x38ef0e){if(_0x38ef0e){return _0x1a68be[_0xd1d8('0x1a')](_0x4e7bf6);}return _0x1a68be[_0xd1d8('0x1b')](_0x4e7bf6)[_0xd1d8('0x1c')]();};}function respondWithResult(_0x4a0c11,_0x10e614){_0x10e614=_0x10e614||0xc8;return function(_0x4f10fd){if(_0x4f10fd){return _0x4a0c11['status'](_0x10e614)[_0xd1d8('0x1d')](_0x4f10fd);}};}function respondWithFilteredResult(_0x344ebb,_0x46c0de){return function(_0x48aabe){if(_0x48aabe){var _0x36b967=typeof _0x46c0de[_0xd1d8('0x1e')]==='undefined'&&typeof _0x46c0de[_0xd1d8('0x1f')]===_0xd1d8('0x20');var _0x1647c6=_0x48aabe['count'];var _0x2cf212=_0x36b967?0x0:_0x46c0de[_0xd1d8('0x1e')];var _0x325260=_0x36b967?_0x48aabe[_0xd1d8('0x21')]:_0x46c0de[_0xd1d8('0x1e')]+_0x46c0de[_0xd1d8('0x1f')];var _0x524d8b;if(_0x325260>=_0x1647c6){_0x325260=_0x1647c6;_0x524d8b=0xc8;}else{_0x524d8b=0xce;}_0x344ebb[_0xd1d8('0x1b')](_0x524d8b);return _0x344ebb[_0xd1d8('0x22')](_0xd1d8('0x23'),_0x2cf212+'-'+_0x325260+'/'+_0x1647c6)['json'](_0x48aabe);}return null;};}function patchUpdates(_0x9b55a0){return function(_0x16c905){try{jsonpatch[_0xd1d8('0x24')](_0x16c905,_0x9b55a0,!![]);}catch(_0x5110ee){return BPromise['reject'](_0x5110ee);}return _0x16c905[_0xd1d8('0x25')]();};}function saveUpdates(_0x8fbeb3,_0x5345d0){return function(_0x2f43ba){if(_0x2f43ba){return _0x2f43ba['update'](_0x8fbeb3)['then'](function(_0x121b72){return _0x121b72;});}return null;};}function removeEntity(_0x486406,_0x423ccb){return function(_0x2c94c2){if(_0x2c94c2){return _0x2c94c2[_0xd1d8('0x26')]()[_0xd1d8('0x27')](function(){_0x486406[_0xd1d8('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bf4c6,_0x225e74){return function(_0x199a59){if(!_0x199a59){_0x5bf4c6[_0xd1d8('0x1a')](0x194);}return _0x199a59;};}function handleError(_0x29a905,_0xe4bd5b){_0xe4bd5b=_0xe4bd5b||0x1f4;return function(_0x432db1){logger[_0xd1d8('0x28')](_0x432db1[_0xd1d8('0x29')]);if(_0x432db1[_0xd1d8('0x2a')]){delete _0x432db1[_0xd1d8('0x2a')];}_0x29a905['status'](_0xe4bd5b)['send'](_0x432db1);};}exports[_0xd1d8('0x2b')]=function(_0x5b7b05,_0x1d85dd){var _0x563984={},_0x25803d={},_0xd3d243={'count':0x0,'rows':[]};var _0x26c1e1=_[_0xd1d8('0x2c')](db[_0xd1d8('0x2d')][_0xd1d8('0x2e')],function(_0x101586){return{'name':_0x101586[_0xd1d8('0x2f')],'type':_0x101586[_0xd1d8('0x30')][_0xd1d8('0x31')]};});_0x25803d[_0xd1d8('0x32')]=_[_0xd1d8('0x2c')](_0x26c1e1,'name');_0x25803d[_0xd1d8('0x33')]=_['keys'](_0x5b7b05['query']);_0x25803d[_0xd1d8('0x34')]=_[_0xd1d8('0x35')](_0x25803d[_0xd1d8('0x32')],_0x25803d['query']);_0x563984[_0xd1d8('0x36')]=_['intersection'](_0x25803d[_0xd1d8('0x32')],qs[_0xd1d8('0x37')](_0x5b7b05[_0xd1d8('0x33')][_0xd1d8('0x37')]));_0x563984[_0xd1d8('0x36')]=_0x563984[_0xd1d8('0x36')][_0xd1d8('0x38')]?_0x563984[_0xd1d8('0x36')]:_0x25803d['model'];if(!_0x5b7b05[_0xd1d8('0x33')][_0xd1d8('0x39')](_0xd1d8('0x3a'))){_0x563984[_0xd1d8('0x1f')]=qs[_0xd1d8('0x1f')](_0x5b7b05['query'][_0xd1d8('0x1f')]);_0x563984[_0xd1d8('0x1e')]=qs[_0xd1d8('0x1e')](_0x5b7b05[_0xd1d8('0x33')]['offset']);}_0x563984['order']=qs[_0xd1d8('0x3b')](_0x5b7b05[_0xd1d8('0x33')][_0xd1d8('0x3b')]);_0x563984['where']=qs[_0xd1d8('0x34')](_[_0xd1d8('0x3c')](_0x5b7b05[_0xd1d8('0x33')],_0x25803d[_0xd1d8('0x34')]),_0x26c1e1);if(_0x5b7b05[_0xd1d8('0x33')]['filter']){_0x563984[_0xd1d8('0x3d')]=_[_0xd1d8('0x3e')](_0x563984['where'],{'$or':_[_0xd1d8('0x2c')](_0x26c1e1,function(_0x46f62f){if(_0x46f62f[_0xd1d8('0x30')]!=='VIRTUAL'){var _0x310628={};_0x310628[_0x46f62f[_0xd1d8('0x2a')]]={'$like':'%'+_0x5b7b05[_0xd1d8('0x33')]['filter']+'%'};return _0x310628;}})});}_0x563984=_[_0xd1d8('0x3e')]({},_0x563984,_0x5b7b05[_0xd1d8('0x3f')]);var _0x70120a={'where':_0x563984['where']};return db[_0xd1d8('0x2d')][_0xd1d8('0x21')](_0x70120a)[_0xd1d8('0x27')](function(_0xd60199){_0xd3d243[_0xd1d8('0x21')]=_0xd60199;if(_0x5b7b05[_0xd1d8('0x33')][_0xd1d8('0x40')]){_0x563984['include']=[{'all':!![]}];}return db['SugarcrmField'][_0xd1d8('0x41')](_0x563984);})['then'](function(_0x30de1a){_0xd3d243[_0xd1d8('0x42')]=_0x30de1a;return _0xd3d243;})['then'](respondWithFilteredResult(_0x1d85dd,_0x563984))[_0xd1d8('0x43')](handleError(_0x1d85dd,null));};exports[_0xd1d8('0x44')]=function(_0x58995a,_0x4f79d5){var _0x2910c9={'raw':!![],'where':{'id':_0x58995a['params']['id']}},_0x711b89={};_0x711b89[_0xd1d8('0x32')]=_['keys'](db[_0xd1d8('0x2d')]['rawAttributes']);_0x711b89[_0xd1d8('0x33')]=_[_0xd1d8('0x45')](_0x58995a[_0xd1d8('0x33')]);_0x711b89[_0xd1d8('0x34')]=_[_0xd1d8('0x35')](_0x711b89[_0xd1d8('0x32')],_0x711b89[_0xd1d8('0x33')]);_0x2910c9['attributes']=_[_0xd1d8('0x35')](_0x711b89[_0xd1d8('0x32')],qs[_0xd1d8('0x37')](_0x58995a[_0xd1d8('0x33')][_0xd1d8('0x37')]));_0x2910c9[_0xd1d8('0x36')]=_0x2910c9['attributes']['length']?_0x2910c9[_0xd1d8('0x36')]:_0x711b89['model'];if(_0x58995a[_0xd1d8('0x33')]['includeAll']){_0x2910c9['include']=[{'all':!![]}];}_0x2910c9=_[_0xd1d8('0x3e')]({},_0x2910c9,_0x58995a['options']);return db[_0xd1d8('0x2d')][_0xd1d8('0x46')](_0x2910c9)['then'](handleEntityNotFound(_0x4f79d5,null))[_0xd1d8('0x27')](respondWithResult(_0x4f79d5,null))[_0xd1d8('0x43')](handleError(_0x4f79d5,null));};exports[_0xd1d8('0x47')]=function(_0x2c658f,_0xb9afff){return db[_0xd1d8('0x2d')][_0xd1d8('0x47')](_0x2c658f[_0xd1d8('0x48')],{})[_0xd1d8('0x27')](respondWithResult(_0xb9afff,0xc9))[_0xd1d8('0x43')](handleError(_0xb9afff,null));};exports[_0xd1d8('0x49')]=function(_0x335b45,_0x1841ce){if(_0x335b45[_0xd1d8('0x48')]['id']){delete _0x335b45[_0xd1d8('0x48')]['id'];}return db[_0xd1d8('0x2d')][_0xd1d8('0x46')]({'where':{'id':_0x335b45['params']['id']}})['then'](handleEntityNotFound(_0x1841ce,null))['then'](saveUpdates(_0x335b45[_0xd1d8('0x48')],null))[_0xd1d8('0x27')](respondWithResult(_0x1841ce,null))[_0xd1d8('0x43')](handleError(_0x1841ce,null));};exports[_0xd1d8('0x26')]=function(_0x41e54d,_0x287f6f){return db[_0xd1d8('0x2d')]['find']({'where':{'id':_0x41e54d[_0xd1d8('0x4a')]['id']}})[_0xd1d8('0x27')](handleEntityNotFound(_0x287f6f,null))[_0xd1d8('0x27')](removeEntity(_0x287f6f,null))[_0xd1d8('0x43')](handleError(_0x287f6f,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 24cf4d1..b66e762 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 _0xcb9f=['./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','idField','FieldId','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x134192,_0x36adc5){var _0x3cd080=function(_0x134371){while(--_0x134371){_0x134192['push'](_0x134192['shift']());}};_0x3cd080(++_0x36adc5);}(_0xcb9f,0x69));var _0xfcb9=function(_0x242fca,_0x20a7f9){_0x242fca=_0x242fca-0x0;var _0x556943=_0xcb9f[_0x242fca];return _0x556943;};'use strict';var _=require('lodash');var util=require(_0xfcb9('0x0'));var logger=require('../../config/logger')(_0xfcb9('0x1'));var moment=require(_0xfcb9('0x2'));var BPromise=require(_0xfcb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfcb9('0x4'));var rimraf=require(_0xfcb9('0x5'));var config=require(_0xfcb9('0x6'));var attributes=require(_0xfcb9('0x7'));module[_0xfcb9('0x8')]=function(_0x2c60bb,_0x2d33f3){return _0x2c60bb[_0xfcb9('0x9')](_0xfcb9('0xa'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xfcb9('0xb'),'fields':[_0xfcb9('0xc'),_0xfcb9('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2286=['exports','define','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x5701ac,_0x3b7d9c){var _0x594a5d=function(_0x3a1380){while(--_0x3a1380){_0x5701ac['push'](_0x5701ac['shift']());}};_0x594a5d(++_0x3b7d9c);}(_0x2286,0x65));var _0x6228=function(_0x25cc6d,_0x3359d5){_0x25cc6d=_0x25cc6d-0x0;var _0x5188dd=_0x2286[_0x25cc6d];return _0x5188dd;};'use strict';var _=require('lodash');var util=require(_0x6228('0x0'));var logger=require(_0x6228('0x1'))(_0x6228('0x2'));var moment=require(_0x6228('0x3'));var BPromise=require('bluebird');var rp=require(_0x6228('0x4'));var fs=require('fs');var path=require(_0x6228('0x5'));var rimraf=require('rimraf');var config=require(_0x6228('0x6'));var attributes=require('./intSugarcrmField.attributes');module[_0x6228('0x7')]=function(_0x2a6048,_0x1d1736){return _0x2a6048[_0x6228('0x8')]('SugarcrmField',attributes,{'tableName':_0x6228('0x9'),'paranoid':![],'indexes':[{'name':_0x6228('0xa'),'fields':['idField',_0x6228('0xb')],'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 e340920..f272362 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 _0xae0c=['SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','jayson/promise','client','http','request','SugarcrmField,\x20%s,\x20%s','request\x20sent'];(function(_0x339e61,_0x67ff0e){var _0x9ebc34=function(_0x37e7cc){while(--_0x37e7cc){_0x339e61['push'](_0x339e61['shift']());}};_0x9ebc34(++_0x67ff0e);}(_0xae0c,0x1a4));var _0xcae0=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xae0c[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xcae0('0x0'));var util=require(_0xcae0('0x1'));var moment=require(_0xcae0('0x2'));var BPromise=require(_0xcae0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcae0('0x4'));var logger=require(_0xcae0('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcae0('0x6'));var client=jayson[_0xcae0('0x7')][_0xcae0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3db152,_0x137177,_0x5811f4){return new BPromise(function(_0x8d598b,_0xf28abe){return client[_0xcae0('0x9')](_0x3db152,_0x5811f4)['then'](function(_0x5b507a){logger['info'](_0xcae0('0xa'),_0x137177,_0xcae0('0xb'));logger['debug'](_0xcae0('0xc'),_0x137177,'request\x20sent',JSON[_0xcae0('0xd')](_0x5b507a));if(_0x5b507a['error']){if(_0x5b507a['error']['code']===0x1f4){logger[_0xcae0('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x137177,_0x5b507a[_0xcae0('0xe')]['message']);return _0xf28abe(_0x5b507a['error'][_0xcae0('0xf')]);}logger[_0xcae0('0xe')](_0xcae0('0xa'),_0x137177,_0x5b507a[_0xcae0('0xe')][_0xcae0('0xf')]);return _0x8d598b(_0x5b507a[_0xcae0('0xe')]['message']);}else{logger['info'](_0xcae0('0xa'),_0x137177,_0xcae0('0xb'));_0x8d598b(_0x5b507a[_0xcae0('0x10')][_0xcae0('0xf')]);}})[_0xcae0('0x11')](function(_0x44126a){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x137177,_0x44126a);_0xf28abe(_0x44126a);});});} \ No newline at end of file +var _0xe3c6=['SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xe3c6,0x143));var _0x6e3c=function(_0x442ede,_0x2c3376){_0x442ede=_0x442ede-0x0;var _0x3b7c68=_0xe3c6[_0x442ede];return _0x3b7c68;};'use strict';var _=require(_0x6e3c('0x0'));var util=require(_0x6e3c('0x1'));var moment=require(_0x6e3c('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e3c('0x3'));var fs=require('fs');var Redis=require(_0x6e3c('0x4'));var db=require(_0x6e3c('0x5'))['db'];var utils=require(_0x6e3c('0x6'));var logger=require(_0x6e3c('0x7'))(_0x6e3c('0x8'));var config=require(_0x6e3c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6e3c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4866a9,_0x16d755,_0x31d30a){return new BPromise(function(_0x17699e,_0xa61ab7){return client['request'](_0x4866a9,_0x31d30a)[_0x6e3c('0xb')](function(_0x504432){logger[_0x6e3c('0xc')](_0x6e3c('0xd'),_0x16d755,_0x6e3c('0xe'));logger[_0x6e3c('0xf')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x16d755,_0x6e3c('0xe'),JSON[_0x6e3c('0x10')](_0x504432));if(_0x504432[_0x6e3c('0x11')]){if(_0x504432[_0x6e3c('0x11')][_0x6e3c('0x12')]===0x1f4){logger[_0x6e3c('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x16d755,_0x504432[_0x6e3c('0x11')]['message']);return _0xa61ab7(_0x504432['error'][_0x6e3c('0x13')]);}logger[_0x6e3c('0x11')](_0x6e3c('0xd'),_0x16d755,_0x504432[_0x6e3c('0x11')]['message']);return _0x17699e(_0x504432['error']['message']);}else{logger[_0x6e3c('0xc')](_0x6e3c('0xd'),_0x16d755,_0x6e3c('0xe'));_0x17699e(_0x504432[_0x6e3c('0x14')]['message']);}})['catch'](function(_0x2883be){logger[_0x6e3c('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x16d755,_0x2883be);_0xa61ab7(_0x2883be);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index ae2126f..b709379 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 _0x07b9=['show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x07b9,0x143));var _0x907b=function(_0x13e724,_0x296739){_0x13e724=_0x13e724-0x0;var _0x334a44=_0x07b9[_0x13e724];return _0x334a44;};'use strict';var multer=require(_0x907b('0x0'));var util=require(_0x907b('0x1'));var path=require(_0x907b('0x2'));var timeout=require(_0x907b('0x3'));var express=require('express');var router=express[_0x907b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x907b('0x5'));var interaction=require(_0x907b('0x6'));var config=require(_0x907b('0x7'));var controller=require(_0x907b('0x8'));router[_0x907b('0x9')]('/',auth[_0x907b('0xa')](),controller[_0x907b('0xb')]);router['get'](_0x907b('0xc'),auth[_0x907b('0xa')](),controller[_0x907b('0xd')]);router[_0x907b('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x907b('0xe')]);router[_0x907b('0x9')](_0x907b('0xf'),auth[_0x907b('0xa')](),controller[_0x907b('0x10')]);router[_0x907b('0x11')]('/',auth[_0x907b('0xa')](),controller[_0x907b('0x12')]);router[_0x907b('0x11')](_0x907b('0x13'),auth['isAuthenticated'](),controller[_0x907b('0x14')]);router['put']('/:id',auth[_0x907b('0xa')](),controller[_0x907b('0x15')]);router[_0x907b('0x16')](_0x907b('0xc'),auth[_0x907b('0xa')](),controller[_0x907b('0x17')]);module['exports']=router; \ No newline at end of file +var _0x077a=['../../config/environment','get','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3b76e9,_0x39efb2){var _0x43489c=function(_0x1040a9){while(--_0x1040a9){_0x3b76e9['push'](_0x3b76e9['shift']());}};_0x43489c(++_0x39efb2);}(_0x077a,0x1f2));var _0xa077=function(_0x5e2cb4,_0x592c64){_0x5e2cb4=_0x5e2cb4-0x0;var _0x282902=_0x077a[_0x5e2cb4];return _0x282902;};'use strict';var multer=require(_0xa077('0x0'));var util=require('util');var path=require(_0xa077('0x1'));var timeout=require(_0xa077('0x2'));var express=require(_0xa077('0x3'));var router=express[_0xa077('0x4')]();var fs_extra=require(_0xa077('0x5'));var auth=require(_0xa077('0x6'));var interaction=require(_0xa077('0x7'));var config=require(_0xa077('0x8'));var controller=require('./intVtigerAccount.controller');router[_0xa077('0x9')]('/',auth[_0xa077('0xa')](),controller['index']);router['get']('/:id',auth[_0xa077('0xa')](),controller[_0xa077('0xb')]);router['get']('/:id/configurations',auth[_0xa077('0xa')](),controller[_0xa077('0xc')]);router[_0xa077('0x9')](_0xa077('0xd'),auth[_0xa077('0xa')](),controller[_0xa077('0xe')]);router[_0xa077('0xf')]('/',auth['isAuthenticated'](),controller[_0xa077('0x10')]);router[_0xa077('0xf')](_0xa077('0x11'),auth[_0xa077('0xa')](),controller['addConfiguration']);router['put'](_0xa077('0x12'),auth[_0xa077('0xa')](),controller[_0xa077('0x13')]);router[_0xa077('0x14')](_0xa077('0x12'),auth[_0xa077('0xa')](),controller[_0xa077('0x15')]);module[_0xa077('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 1c17085..29212dd 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 _0x7757=['HelpDesk','exports','STRING'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7757,0x18a));var _0x7775=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x7757[_0x47a7d0];return _0xb9bd08;};'use strict';var Sequelize=require('sequelize');module[_0x7775('0x0')]={'name':{'type':Sequelize[_0x7775('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7775('0x1')]},'username':{'type':Sequelize[_0x7775('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7775('0x2')},'remoteUri':{'type':Sequelize[_0x7775('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x1642=['exports','STRING','HelpDesk','sequelize'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x1642,0x67));var _0x2164=function(_0x3aff46,_0x11a9f7){_0x3aff46=_0x3aff46-0x0;var _0xb8f470=_0x1642[_0x3aff46];return _0xb8f470;};'use strict';var Sequelize=require(_0x2164('0x0'));module[_0x2164('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x2164('0x2')]},'username':{'type':Sequelize[_0x2164('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2164('0x3')},'remoteUri':{'type':Sequelize[_0x2164('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x2164('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x2164('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 2cb7404..9be10c6 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 _0xfd51=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','error','stack','name','send','index','map','VtigerAccount','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','fields','options','create','body','find','params','getConfigurations','nolimit','addConfiguration','findOne','AccountId','Subjects','getDescriptions','channel','VtigerConfiguration','VtigerField','Descriptions','md5','username','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','getchallenge','success','POST','token','describe','result','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','cf_','picklist','picklistValues','value','log','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x1e03e4,_0x362f76){var _0x4a887e=function(_0x13f548){while(--_0x13f548){_0x1e03e4['push'](_0x1e03e4['shift']());}};_0x4a887e(++_0x362f76);}(_0xfd51,0x1d5));var _0x1fd5=function(_0x1ade24,_0x1bb417){_0x1ade24=_0x1ade24-0x0;var _0x31d807=_0xfd51[_0x1ade24];return _0x31d807;};'use strict';var emlformat=require(_0x1fd5('0x0'));var rimraf=require(_0x1fd5('0x1'));var zipdir=require(_0x1fd5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1fd5('0x3'));var moment=require(_0x1fd5('0x4'));var BPromise=require(_0x1fd5('0x5'));var Mustache=require(_0x1fd5('0x6'));var util=require(_0x1fd5('0x7'));var path=require('path');var sox=require(_0x1fd5('0x8'));var csv=require(_0x1fd5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1fd5('0xa'));var _=require(_0x1fd5('0xb'));var squel=require(_0x1fd5('0xc'));var crypto=require(_0x1fd5('0xd'));var jsforce=require(_0x1fd5('0xe'));var deskjs=require(_0x1fd5('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1fd5('0x10'));var Papa=require(_0x1fd5('0x11'));var Redis=require(_0x1fd5('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1fd5('0x13'));var as=require(_0x1fd5('0x14'));var hardwareService=require(_0x1fd5('0x15'));var logger=require(_0x1fd5('0x16'))('api');var utils=require(_0x1fd5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1fd5('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x47b131,_0x260fed){_0x260fed=_0x260fed||0xcc;return function(_0x32ee6d){if(_0x32ee6d){return _0x47b131[_0x1fd5('0x19')](_0x260fed);}return _0x47b131[_0x1fd5('0x1a')](_0x260fed)[_0x1fd5('0x1b')]();};}function respondWithResult(_0x316290,_0x267db3){_0x267db3=_0x267db3||0xc8;return function(_0x487183){if(_0x487183){return _0x316290[_0x1fd5('0x1a')](_0x267db3)[_0x1fd5('0x1c')](_0x487183);}};}function respondWithFilteredResult(_0x331e85,_0x5b8443){return function(_0x5e1cb2){if(_0x5e1cb2){var _0x4978a1=typeof _0x5b8443[_0x1fd5('0x1d')]===_0x1fd5('0x1e')&&typeof _0x5b8443['limit']===_0x1fd5('0x1e');var _0x405854=_0x5e1cb2[_0x1fd5('0x1f')];var _0x36349d=_0x4978a1?0x0:_0x5b8443[_0x1fd5('0x1d')];var _0x4dad16=_0x4978a1?_0x5e1cb2[_0x1fd5('0x1f')]:_0x5b8443[_0x1fd5('0x1d')]+_0x5b8443[_0x1fd5('0x20')];var _0x13f27c;if(_0x4dad16>=_0x405854){_0x4dad16=_0x405854;_0x13f27c=0xc8;}else{_0x13f27c=0xce;}_0x331e85[_0x1fd5('0x1a')](_0x13f27c);return _0x331e85[_0x1fd5('0x21')]('Content-Range',_0x36349d+'-'+_0x4dad16+'/'+_0x405854)['json'](_0x5e1cb2);}return null;};}function patchUpdates(_0x14a4f9){return function(_0x334ab5){try{jsonpatch[_0x1fd5('0x22')](_0x334ab5,_0x14a4f9,!![]);}catch(_0x3a24be){return BPromise['reject'](_0x3a24be);}return _0x334ab5[_0x1fd5('0x23')]();};}function saveUpdates(_0x4a874e,_0x5b3936){return function(_0xb004f){if(_0xb004f){return _0xb004f[_0x1fd5('0x24')](_0x4a874e)[_0x1fd5('0x25')](function(_0x3104e2){return _0x3104e2;});}return null;};}function removeEntity(_0x2cac34,_0x4bcd6b){return function(_0x17526c){if(_0x17526c){return _0x17526c[_0x1fd5('0x26')]()[_0x1fd5('0x25')](function(){_0x2cac34[_0x1fd5('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35611c,_0x3d7ded){return function(_0x3cfa82){if(!_0x3cfa82){_0x35611c['sendStatus'](0x194);}return _0x3cfa82;};}function handleError(_0x18a9d9,_0x397c26){_0x397c26=_0x397c26||0x1f4;return function(_0x5c676f){logger[_0x1fd5('0x27')](_0x5c676f[_0x1fd5('0x28')]);if(_0x5c676f[_0x1fd5('0x29')]){delete _0x5c676f[_0x1fd5('0x29')];}_0x18a9d9[_0x1fd5('0x1a')](_0x397c26)[_0x1fd5('0x2a')](_0x5c676f);};}exports[_0x1fd5('0x2b')]=function(_0x53e5be,_0x5e69e2){var _0x39baee={},_0x552397={},_0x3ab6d9={'count':0x0,'rows':[]};var _0x2f8b4f=_[_0x1fd5('0x2c')](db[_0x1fd5('0x2d')][_0x1fd5('0x2e')],function(_0x23bb25){return{'name':_0x23bb25['fieldName'],'type':_0x23bb25[_0x1fd5('0x2f')][_0x1fd5('0x30')]};});_0x552397[_0x1fd5('0x31')]=_['map'](_0x2f8b4f,_0x1fd5('0x29'));_0x552397['query']=_[_0x1fd5('0x32')](_0x53e5be[_0x1fd5('0x33')]);_0x552397[_0x1fd5('0x34')]=_[_0x1fd5('0x35')](_0x552397[_0x1fd5('0x31')],_0x552397[_0x1fd5('0x33')]);_0x39baee[_0x1fd5('0x36')]=_[_0x1fd5('0x35')](_0x552397['model'],qs['fields'](_0x53e5be[_0x1fd5('0x33')]['fields']));_0x39baee['attributes']=_0x39baee[_0x1fd5('0x36')][_0x1fd5('0x37')]?_0x39baee['attributes']:_0x552397['model'];if(!_0x53e5be[_0x1fd5('0x33')][_0x1fd5('0x38')]('nolimit')){_0x39baee[_0x1fd5('0x20')]=qs['limit'](_0x53e5be[_0x1fd5('0x33')][_0x1fd5('0x20')]);_0x39baee[_0x1fd5('0x1d')]=qs[_0x1fd5('0x1d')](_0x53e5be[_0x1fd5('0x33')][_0x1fd5('0x1d')]);}_0x39baee['order']=qs[_0x1fd5('0x39')](_0x53e5be[_0x1fd5('0x33')]['sort']);_0x39baee['where']=qs['filters'](_[_0x1fd5('0x3a')](_0x53e5be[_0x1fd5('0x33')],_0x552397[_0x1fd5('0x34')]),_0x2f8b4f);if(_0x53e5be[_0x1fd5('0x33')][_0x1fd5('0x3b')]){_0x39baee[_0x1fd5('0x3c')]=_['merge'](_0x39baee[_0x1fd5('0x3c')],{'$or':_[_0x1fd5('0x2c')](_0x2f8b4f,function(_0x57fd62){if(_0x57fd62[_0x1fd5('0x2f')]!==_0x1fd5('0x3d')){var _0x2b3d1e={};_0x2b3d1e[_0x57fd62[_0x1fd5('0x29')]]={'$like':'%'+_0x53e5be[_0x1fd5('0x33')][_0x1fd5('0x3b')]+'%'};return _0x2b3d1e;}})});}_0x39baee=_[_0x1fd5('0x3e')]({},_0x39baee,_0x53e5be['options']);var _0x5eb196={'where':_0x39baee[_0x1fd5('0x3c')]};return db[_0x1fd5('0x2d')]['count'](_0x5eb196)[_0x1fd5('0x25')](function(_0xa0c177){_0x3ab6d9[_0x1fd5('0x1f')]=_0xa0c177;if(_0x53e5be[_0x1fd5('0x33')][_0x1fd5('0x3f')]){_0x39baee[_0x1fd5('0x40')]=[{'all':!![]}];}return db['VtigerAccount'][_0x1fd5('0x41')](_0x39baee);})[_0x1fd5('0x25')](function(_0x3d61fb){_0x3ab6d9[_0x1fd5('0x42')]=_0x3d61fb;return _0x3ab6d9;})[_0x1fd5('0x25')](respondWithFilteredResult(_0x5e69e2,_0x39baee))[_0x1fd5('0x43')](handleError(_0x5e69e2,null));};exports[_0x1fd5('0x44')]=function(_0x3e6895,_0x148492){var _0x6ee35={'raw':![],'where':{'id':_0x3e6895['params']['id']}},_0x5cdefe={};_0x5cdefe[_0x1fd5('0x31')]=_[_0x1fd5('0x32')](db['VtigerAccount'][_0x1fd5('0x2e')]);_0x5cdefe[_0x1fd5('0x33')]=_['keys'](_0x3e6895[_0x1fd5('0x33')]);_0x5cdefe['filters']=_[_0x1fd5('0x35')](_0x5cdefe[_0x1fd5('0x31')],_0x5cdefe['query']);_0x6ee35[_0x1fd5('0x36')]=_['intersection'](_0x5cdefe['model'],qs[_0x1fd5('0x45')](_0x3e6895[_0x1fd5('0x33')][_0x1fd5('0x45')]));_0x6ee35['attributes']=_0x6ee35[_0x1fd5('0x36')][_0x1fd5('0x37')]?_0x6ee35['attributes']:_0x5cdefe[_0x1fd5('0x31')];if(_0x3e6895[_0x1fd5('0x33')][_0x1fd5('0x3f')]){_0x6ee35['include']=[{'all':!![]}];}_0x6ee35=_['merge']({},_0x6ee35,_0x3e6895[_0x1fd5('0x46')]);return db[_0x1fd5('0x2d')]['find'](_0x6ee35)['then'](handleEntityNotFound(_0x148492,null))['then'](respondWithResult(_0x148492,null))[_0x1fd5('0x43')](handleError(_0x148492,null));};exports[_0x1fd5('0x47')]=function(_0xa1ec8e,_0x37c98f){return db[_0x1fd5('0x2d')][_0x1fd5('0x47')](_0xa1ec8e['body'],{})[_0x1fd5('0x25')](respondWithResult(_0x37c98f,0xc9))['catch'](handleError(_0x37c98f,null));};exports[_0x1fd5('0x24')]=function(_0x3ca1ec,_0x12087a){if(_0x3ca1ec[_0x1fd5('0x48')]['id']){delete _0x3ca1ec[_0x1fd5('0x48')]['id'];}return db[_0x1fd5('0x2d')][_0x1fd5('0x49')]({'where':{'id':_0x3ca1ec[_0x1fd5('0x4a')]['id']}})[_0x1fd5('0x25')](handleEntityNotFound(_0x12087a,null))[_0x1fd5('0x25')](saveUpdates(_0x3ca1ec[_0x1fd5('0x48')],null))['then'](respondWithResult(_0x12087a,null))[_0x1fd5('0x43')](handleError(_0x12087a,null));};exports[_0x1fd5('0x26')]=function(_0x322b0,_0x12ebdf){return db['VtigerAccount'][_0x1fd5('0x49')]({'where':{'id':_0x322b0[_0x1fd5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12ebdf,null))[_0x1fd5('0x25')](removeEntity(_0x12ebdf,null))[_0x1fd5('0x43')](handleError(_0x12ebdf,null));};exports[_0x1fd5('0x4b')]=function(_0x685134,_0xc936b8,_0x478e24){var _0x1631a5={};var _0x50a8e9={};var _0x5f2a30;var _0x238d15;return db[_0x1fd5('0x2d')]['findOne']({'where':{'id':_0x685134['params']['id']}})[_0x1fd5('0x25')](handleEntityNotFound(_0xc936b8,null))[_0x1fd5('0x25')](function(_0x2782a0){if(_0x2782a0){_0x5f2a30=_0x2782a0;_0x50a8e9[_0x1fd5('0x31')]=_[_0x1fd5('0x32')](db['VtigerConfiguration']['rawAttributes']);_0x50a8e9[_0x1fd5('0x33')]=_[_0x1fd5('0x32')](_0x685134['query']);_0x50a8e9['filters']=_[_0x1fd5('0x35')](_0x50a8e9[_0x1fd5('0x31')],_0x50a8e9[_0x1fd5('0x33')]);_0x1631a5['attributes']=_[_0x1fd5('0x35')](_0x50a8e9[_0x1fd5('0x31')],qs[_0x1fd5('0x45')](_0x685134[_0x1fd5('0x33')][_0x1fd5('0x45')]));_0x1631a5[_0x1fd5('0x36')]=_0x1631a5[_0x1fd5('0x36')][_0x1fd5('0x37')]?_0x1631a5['attributes']:_0x50a8e9[_0x1fd5('0x31')];_0x1631a5['order']=qs[_0x1fd5('0x39')](_0x685134[_0x1fd5('0x33')]['sort']);_0x1631a5['where']=qs[_0x1fd5('0x34')](_[_0x1fd5('0x3a')](_0x685134[_0x1fd5('0x33')],_0x50a8e9[_0x1fd5('0x34')]));if(_0x685134[_0x1fd5('0x33')][_0x1fd5('0x3b')]){_0x1631a5['where']=_['merge'](_0x1631a5[_0x1fd5('0x3c')],{'$or':_[_0x1fd5('0x2c')](_0x1631a5[_0x1fd5('0x36')],function(_0x2460b9){var _0x149271={};_0x149271[_0x2460b9]={'$like':'%'+_0x685134['query'][_0x1fd5('0x3b')]+'%'};return _0x149271;})});}_0x1631a5=_[_0x1fd5('0x3e')]({},_0x1631a5,_0x685134[_0x1fd5('0x46')]);return _0x5f2a30['getConfigurations'](_0x1631a5);}})[_0x1fd5('0x25')](function(_0x4160d4){if(_0x4160d4){_0x238d15=_0x4160d4['length'];if(!_0x685134[_0x1fd5('0x33')][_0x1fd5('0x38')](_0x1fd5('0x4c'))){_0x1631a5[_0x1fd5('0x20')]=qs[_0x1fd5('0x20')](_0x685134[_0x1fd5('0x33')][_0x1fd5('0x20')]);_0x1631a5[_0x1fd5('0x1d')]=qs[_0x1fd5('0x1d')](_0x685134[_0x1fd5('0x33')][_0x1fd5('0x1d')]);}return _0x5f2a30[_0x1fd5('0x4b')](_0x1631a5);}})[_0x1fd5('0x25')](function(_0x289114){if(_0x289114){return _0x289114?{'count':_0x238d15,'rows':_0x289114}:null;}})['then'](respondWithResult(_0xc936b8,null))[_0x1fd5('0x43')](handleError(_0xc936b8,null));};exports[_0x1fd5('0x4d')]=function(_0x266a80,_0x351a5c,_0x35858c){if(_0x266a80[_0x1fd5('0x48')]['id']){delete _0x266a80[_0x1fd5('0x48')]['id'];}return db['VtigerAccount'][_0x1fd5('0x4e')]({'where':{'id':_0x266a80[_0x1fd5('0x4a')]['id']}})[_0x1fd5('0x25')](handleEntityNotFound(_0x351a5c,null))[_0x1fd5('0x25')](function(_0x377ad4){if(_0x377ad4){_0x266a80['body'][_0x1fd5('0x4f')]=_0x377ad4['id'];_0x266a80[_0x1fd5('0x48')][_0x1fd5('0x50')]=integrations['getSubjects'](_0x266a80[_0x1fd5('0x48')]['channel'],_0x266a80[_0x1fd5('0x48')][_0x1fd5('0x2f')]);_0x266a80[_0x1fd5('0x48')]['Descriptions']=integrations[_0x1fd5('0x51')](_0x266a80[_0x1fd5('0x48')][_0x1fd5('0x52')],_0x266a80[_0x1fd5('0x48')][_0x1fd5('0x2f')]);return db[_0x1fd5('0x53')][_0x1fd5('0x47')](_0x266a80[_0x1fd5('0x48')],{'include':[{'model':db['VtigerField'],'as':_0x1fd5('0x50')},{'model':db[_0x1fd5('0x54')],'as':_0x1fd5('0x55')}]});}return null;})[_0x1fd5('0x25')](respondWithResult(_0x351a5c,null))[_0x1fd5('0x43')](handleError(_0x351a5c,null));};var md5=require(_0x1fd5('0x56'));exports['getFields']=function(_0x38ae75,_0x1fb235,_0x47cbc8){var _0x411cfd=null;var _0x965f02=null;var _0x322bcd=null;var _0x29e016=null;var _0x2f1979='';return db[_0x1fd5('0x2d')][_0x1fd5('0x4e')]({'where':{'id':_0x38ae75['params']['id']},'attributes':['id',_0x1fd5('0x29'),_0x1fd5('0x57'),'description',_0x1fd5('0x58'),_0x1fd5('0x59'),_0x1fd5('0x5a'),_0x1fd5('0x5b')]})[_0x1fd5('0x25')](handleEntityNotFound(_0x1fb235,null))[_0x1fd5('0x25')](function(_0x430fb5){if(_0x430fb5){_0x411cfd=_0x430fb5[_0x1fd5('0x57')];_0x965f02=_0x430fb5[_0x1fd5('0x5b')];_0x322bcd=_0x430fb5[_0x1fd5('0x58')];_0x2f1979=_0x430fb5[_0x1fd5('0x59')];var _0x1ba14d=_0x2f1979[_0x1fd5('0x5c')](-0x1);if(_0x1ba14d==='/'){_0x2f1979=_0x2f1979[_0x1fd5('0x5d')](0x0,_0x2f1979[_0x1fd5('0x5e')](_0x1ba14d));}_0x29e016=util[_0x1fd5('0x5f')](_0x1fd5('0x60'),_0x2f1979);var _0x481349={'method':'GET','uri':_0x29e016,'qs':{'operation':_0x1fd5('0x61'),'username':_0x430fb5['username']},'json':!![]};return rp(_0x481349);}})[_0x1fd5('0x25')](function(_0x42f310){if(_0x42f310[_0x1fd5('0x62')]){var _0x46b1b1={'method':_0x1fd5('0x63'),'uri':_0x29e016,'form':{'operation':'login','username':_0x411cfd,'accessKey':md5(_0x42f310['result'][_0x1fd5('0x64')]+_0x965f02)},'json':!![]};return rp(_0x46b1b1);}})[_0x1fd5('0x25')](function(_0x5e8a2c){if(_0x5e8a2c['success']){var _0x52e879={'method':'GET','uri':_0x29e016,'qs':{'operation':_0x1fd5('0x65'),'username':_0x411cfd,'sessionName':_0x5e8a2c[_0x1fd5('0x66')][_0x1fd5('0x67')],'elementType':_0x322bcd},'json':!![]};return rp(_0x52e879);}})['then'](function(_0x4bcea1){if(_0x4bcea1[_0x1fd5('0x62')]){var _0x670a01=[_0x1fd5('0x68'),_0x1fd5('0x69'),_0x1fd5('0x6a')];_[_0x1fd5('0x6b')](_0x4bcea1['result']['fields'],function(_0x2b32fc){return _0x670a01[_0x1fd5('0x6c')](_0x2b32fc['type']['name']);});_[_0x1fd5('0x6b')](_0x4bcea1[_0x1fd5('0x66')][_0x1fd5('0x45')],function(_0x7f3e3c){return _0x7f3e3c[_0x1fd5('0x6d')]===_0x1fd5('0x6e');});return{'count':_0x4bcea1['result'][_0x1fd5('0x45')][_0x1fd5('0x37')],'rows':_[_0x1fd5('0x2c')](_0x4bcea1['result'][_0x1fd5('0x45')],function(_0x114fe2){return{'id':_0x114fe2[_0x1fd5('0x29')],'name':_0x114fe2[_0x1fd5('0x6f')],'custom':_['startsWith'](_0x114fe2[_0x1fd5('0x29')],_0x1fd5('0x70'))?!![]:![],'options':_0x114fe2[_0x1fd5('0x2f')]['name']===_0x1fd5('0x71')&&_0x114fe2[_0x1fd5('0x2f')][_0x1fd5('0x72')][_0x1fd5('0x37')]>0x0?_['map'](_0x114fe2[_0x1fd5('0x2f')][_0x1fd5('0x72')],function(_0x40b341){return{'name':_0x40b341[_0x1fd5('0x6f')],'value':_0x40b341[_0x1fd5('0x73')]};}):[]};})};}})[_0x1fd5('0x25')](respondWithResult(_0x1fb235,null))['catch'](function(_0x1b8702){console[_0x1fd5('0x74')]('vTiger\x20error:\x20'+_0x1b8702);var _0x432942=_0x38ae75[_0x1fd5('0x33')][_0x1fd5('0x75')]?0x1f4:_0x1b8702[_0x1fd5('0x76')]||0x1f4;logger['error'](_0x1fd5('0x77'),_0x1fd5('0x78'),_0x432942,JSON[_0x1fd5('0x79')](_0x1b8702));delete _0x1b8702[_0x1fd5('0x29')];if(_0x432942===0x191){_0x432942=0x190;}_0x1fb235[_0x1fd5('0x1a')](_0x432942)[_0x1fd5('0x2a')](_0x38ae75['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x1b8702[_0x1fd5('0x76')]}:_0x1b8702);});}; \ No newline at end of file +var _0x1ddc=['offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','keys','length','options','create','body','find','findOne','VtigerConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','getFields','description','remoteUri','serverUrl','username','accessKey','moduleName','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','describe','reference','owner','remove','includes','editable','false','startsWith','cf_','picklist','picklistValues','label','value','log','vTiger\x20error:\x20','test','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status'];(function(_0x420d8d,_0x78b67f){var _0x4865d7=function(_0x2965df){while(--_0x2965df){_0x420d8d['push'](_0x420d8d['shift']());}};_0x4865d7(++_0x78b67f);}(_0x1ddc,0x1d6));var _0xc1dd=function(_0x4e6d79,_0xba37a4){_0x4e6d79=_0x4e6d79-0x0;var _0xf3ad74=_0x1ddc[_0x4e6d79];return _0xf3ad74;};'use strict';var emlformat=require(_0xc1dd('0x0'));var rimraf=require(_0xc1dd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc1dd('0x2'));var rp=require(_0xc1dd('0x3'));var moment=require('moment');var BPromise=require(_0xc1dd('0x4'));var Mustache=require(_0xc1dd('0x5'));var util=require('util');var path=require('path');var sox=require(_0xc1dd('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc1dd('0x7'));var squel=require(_0xc1dd('0x8'));var crypto=require(_0xc1dd('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc1dd('0xa'));var toCsv=require(_0xc1dd('0xb'));var querystring=require(_0xc1dd('0xc'));var Papa=require(_0xc1dd('0xd'));var Redis=require('ioredis');var authService=require(_0xc1dd('0xe'));var qs=require(_0xc1dd('0xf'));var as=require(_0xc1dd('0x10'));var hardwareService=require(_0xc1dd('0x11'));var logger=require(_0xc1dd('0x12'))(_0xc1dd('0x13'));var utils=require(_0xc1dd('0x14'));var config=require(_0xc1dd('0x15'));var licenseUtil=require(_0xc1dd('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4c0643,_0x3e1b44){_0x3e1b44=_0x3e1b44||0xcc;return function(_0x4c89eb){if(_0x4c89eb){return _0x4c0643[_0xc1dd('0x17')](_0x3e1b44);}return _0x4c0643['status'](_0x3e1b44)[_0xc1dd('0x18')]();};}function respondWithResult(_0x19c0e2,_0x333733){_0x333733=_0x333733||0xc8;return function(_0x587b20){if(_0x587b20){return _0x19c0e2[_0xc1dd('0x19')](_0x333733)['json'](_0x587b20);}};}function respondWithFilteredResult(_0x345ee2,_0x5dce24){return function(_0x27946d){if(_0x27946d){var _0x53827f=typeof _0x5dce24[_0xc1dd('0x1a')]===_0xc1dd('0x1b')&&typeof _0x5dce24['limit']===_0xc1dd('0x1b');var _0x4aa4c6=_0x27946d[_0xc1dd('0x1c')];var _0x29491e=_0x53827f?0x0:_0x5dce24[_0xc1dd('0x1a')];var _0xd433b7=_0x53827f?_0x27946d[_0xc1dd('0x1c')]:_0x5dce24['offset']+_0x5dce24[_0xc1dd('0x1d')];var _0x4caae3;if(_0xd433b7>=_0x4aa4c6){_0xd433b7=_0x4aa4c6;_0x4caae3=0xc8;}else{_0x4caae3=0xce;}_0x345ee2[_0xc1dd('0x19')](_0x4caae3);return _0x345ee2[_0xc1dd('0x1e')](_0xc1dd('0x1f'),_0x29491e+'-'+_0xd433b7+'/'+_0x4aa4c6)['json'](_0x27946d);}return null;};}function patchUpdates(_0x1e7a82){return function(_0x3eec86){try{jsonpatch[_0xc1dd('0x20')](_0x3eec86,_0x1e7a82,!![]);}catch(_0x5814bb){return BPromise[_0xc1dd('0x21')](_0x5814bb);}return _0x3eec86[_0xc1dd('0x22')]();};}function saveUpdates(_0x5563cb,_0xa9a8cb){return function(_0x43dd08){if(_0x43dd08){return _0x43dd08[_0xc1dd('0x23')](_0x5563cb)[_0xc1dd('0x24')](function(_0x452d6e){return _0x452d6e;});}return null;};}function removeEntity(_0x23378d,_0x124726){return function(_0x563b02){if(_0x563b02){return _0x563b02[_0xc1dd('0x25')]()[_0xc1dd('0x24')](function(){_0x23378d[_0xc1dd('0x19')](0xcc)[_0xc1dd('0x18')]();});}};}function handleEntityNotFound(_0x1e01ae,_0x409ed3){return function(_0x544735){if(!_0x544735){_0x1e01ae['sendStatus'](0x194);}return _0x544735;};}function handleError(_0x56f164,_0x3fd79d){_0x3fd79d=_0x3fd79d||0x1f4;return function(_0x1d73eb){logger['error'](_0x1d73eb[_0xc1dd('0x26')]);if(_0x1d73eb[_0xc1dd('0x27')]){delete _0x1d73eb[_0xc1dd('0x27')];}_0x56f164[_0xc1dd('0x19')](_0x3fd79d)[_0xc1dd('0x28')](_0x1d73eb);};}exports[_0xc1dd('0x29')]=function(_0x530760,_0x492025){var _0x4a0072={},_0x4ecb21={},_0x122b75={'count':0x0,'rows':[]};var _0x3a1b0d=_[_0xc1dd('0x2a')](db[_0xc1dd('0x2b')][_0xc1dd('0x2c')],function(_0x22570c){return{'name':_0x22570c[_0xc1dd('0x2d')],'type':_0x22570c['type'][_0xc1dd('0x2e')]};});_0x4ecb21[_0xc1dd('0x2f')]=_[_0xc1dd('0x2a')](_0x3a1b0d,_0xc1dd('0x27'));_0x4ecb21[_0xc1dd('0x30')]=_['keys'](_0x530760[_0xc1dd('0x30')]);_0x4ecb21['filters']=_[_0xc1dd('0x31')](_0x4ecb21[_0xc1dd('0x2f')],_0x4ecb21['query']);_0x4a0072[_0xc1dd('0x32')]=_['intersection'](_0x4ecb21[_0xc1dd('0x2f')],qs[_0xc1dd('0x33')](_0x530760['query'][_0xc1dd('0x33')]));_0x4a0072[_0xc1dd('0x32')]=_0x4a0072[_0xc1dd('0x32')]['length']?_0x4a0072[_0xc1dd('0x32')]:_0x4ecb21[_0xc1dd('0x2f')];if(!_0x530760[_0xc1dd('0x30')][_0xc1dd('0x34')](_0xc1dd('0x35'))){_0x4a0072[_0xc1dd('0x1d')]=qs['limit'](_0x530760[_0xc1dd('0x30')][_0xc1dd('0x1d')]);_0x4a0072[_0xc1dd('0x1a')]=qs[_0xc1dd('0x1a')](_0x530760[_0xc1dd('0x30')][_0xc1dd('0x1a')]);}_0x4a0072[_0xc1dd('0x36')]=qs[_0xc1dd('0x37')](_0x530760[_0xc1dd('0x30')][_0xc1dd('0x37')]);_0x4a0072[_0xc1dd('0x38')]=qs[_0xc1dd('0x39')](_[_0xc1dd('0x3a')](_0x530760['query'],_0x4ecb21[_0xc1dd('0x39')]),_0x3a1b0d);if(_0x530760[_0xc1dd('0x30')][_0xc1dd('0x3b')]){_0x4a0072[_0xc1dd('0x38')]=_[_0xc1dd('0x3c')](_0x4a0072[_0xc1dd('0x38')],{'$or':_[_0xc1dd('0x2a')](_0x3a1b0d,function(_0x4d334f){if(_0x4d334f[_0xc1dd('0x3d')]!=='VIRTUAL'){var _0x1912f2={};_0x1912f2[_0x4d334f[_0xc1dd('0x27')]]={'$like':'%'+_0x530760[_0xc1dd('0x30')][_0xc1dd('0x3b')]+'%'};return _0x1912f2;}})});}_0x4a0072=_[_0xc1dd('0x3c')]({},_0x4a0072,_0x530760['options']);var _0x56b7f2={'where':_0x4a0072[_0xc1dd('0x38')]};return db[_0xc1dd('0x2b')][_0xc1dd('0x1c')](_0x56b7f2)[_0xc1dd('0x24')](function(_0x2c6cc1){_0x122b75[_0xc1dd('0x1c')]=_0x2c6cc1;if(_0x530760[_0xc1dd('0x30')][_0xc1dd('0x3e')]){_0x4a0072[_0xc1dd('0x3f')]=[{'all':!![]}];}return db[_0xc1dd('0x2b')][_0xc1dd('0x40')](_0x4a0072);})[_0xc1dd('0x24')](function(_0x2b1bdd){_0x122b75[_0xc1dd('0x41')]=_0x2b1bdd;return _0x122b75;})[_0xc1dd('0x24')](respondWithFilteredResult(_0x492025,_0x4a0072))[_0xc1dd('0x42')](handleError(_0x492025,null));};exports[_0xc1dd('0x43')]=function(_0x11949f,_0x1c352a){var _0x75fee0={'raw':![],'where':{'id':_0x11949f[_0xc1dd('0x44')]['id']}},_0x2ffdaa={};_0x2ffdaa[_0xc1dd('0x2f')]=_['keys'](db[_0xc1dd('0x2b')][_0xc1dd('0x2c')]);_0x2ffdaa[_0xc1dd('0x30')]=_[_0xc1dd('0x45')](_0x11949f['query']);_0x2ffdaa[_0xc1dd('0x39')]=_[_0xc1dd('0x31')](_0x2ffdaa[_0xc1dd('0x2f')],_0x2ffdaa[_0xc1dd('0x30')]);_0x75fee0[_0xc1dd('0x32')]=_['intersection'](_0x2ffdaa[_0xc1dd('0x2f')],qs['fields'](_0x11949f[_0xc1dd('0x30')][_0xc1dd('0x33')]));_0x75fee0[_0xc1dd('0x32')]=_0x75fee0[_0xc1dd('0x32')][_0xc1dd('0x46')]?_0x75fee0[_0xc1dd('0x32')]:_0x2ffdaa[_0xc1dd('0x2f')];if(_0x11949f['query'][_0xc1dd('0x3e')]){_0x75fee0[_0xc1dd('0x3f')]=[{'all':!![]}];}_0x75fee0=_['merge']({},_0x75fee0,_0x11949f[_0xc1dd('0x47')]);return db['VtigerAccount']['find'](_0x75fee0)[_0xc1dd('0x24')](handleEntityNotFound(_0x1c352a,null))[_0xc1dd('0x24')](respondWithResult(_0x1c352a,null))[_0xc1dd('0x42')](handleError(_0x1c352a,null));};exports[_0xc1dd('0x48')]=function(_0x4745f2,_0x396604){return db['VtigerAccount'][_0xc1dd('0x48')](_0x4745f2[_0xc1dd('0x49')],{})[_0xc1dd('0x24')](respondWithResult(_0x396604,0xc9))[_0xc1dd('0x42')](handleError(_0x396604,null));};exports[_0xc1dd('0x23')]=function(_0x73884,_0x180083){if(_0x73884[_0xc1dd('0x49')]['id']){delete _0x73884[_0xc1dd('0x49')]['id'];}return db[_0xc1dd('0x2b')][_0xc1dd('0x4a')]({'where':{'id':_0x73884['params']['id']}})['then'](handleEntityNotFound(_0x180083,null))[_0xc1dd('0x24')](saveUpdates(_0x73884[_0xc1dd('0x49')],null))[_0xc1dd('0x24')](respondWithResult(_0x180083,null))[_0xc1dd('0x42')](handleError(_0x180083,null));};exports[_0xc1dd('0x25')]=function(_0x5cf8cd,_0x26c2de){return db[_0xc1dd('0x2b')][_0xc1dd('0x4a')]({'where':{'id':_0x5cf8cd[_0xc1dd('0x44')]['id']}})[_0xc1dd('0x24')](handleEntityNotFound(_0x26c2de,null))[_0xc1dd('0x24')](removeEntity(_0x26c2de,null))[_0xc1dd('0x42')](handleError(_0x26c2de,null));};exports['getConfigurations']=function(_0x19aae1,_0x3bd169,_0x2c61eb){var _0x5ede6f={};var _0x421959={};var _0x106ece;var _0x5aaf00;return db['VtigerAccount'][_0xc1dd('0x4b')]({'where':{'id':_0x19aae1[_0xc1dd('0x44')]['id']}})[_0xc1dd('0x24')](handleEntityNotFound(_0x3bd169,null))['then'](function(_0x1f488d){if(_0x1f488d){_0x106ece=_0x1f488d;_0x421959[_0xc1dd('0x2f')]=_[_0xc1dd('0x45')](db[_0xc1dd('0x4c')][_0xc1dd('0x2c')]);_0x421959[_0xc1dd('0x30')]=_[_0xc1dd('0x45')](_0x19aae1[_0xc1dd('0x30')]);_0x421959[_0xc1dd('0x39')]=_[_0xc1dd('0x31')](_0x421959[_0xc1dd('0x2f')],_0x421959['query']);_0x5ede6f[_0xc1dd('0x32')]=_[_0xc1dd('0x31')](_0x421959[_0xc1dd('0x2f')],qs[_0xc1dd('0x33')](_0x19aae1[_0xc1dd('0x30')][_0xc1dd('0x33')]));_0x5ede6f['attributes']=_0x5ede6f[_0xc1dd('0x32')]['length']?_0x5ede6f[_0xc1dd('0x32')]:_0x421959['model'];_0x5ede6f[_0xc1dd('0x36')]=qs['sort'](_0x19aae1[_0xc1dd('0x30')][_0xc1dd('0x37')]);_0x5ede6f['where']=qs[_0xc1dd('0x39')](_[_0xc1dd('0x3a')](_0x19aae1[_0xc1dd('0x30')],_0x421959['filters']));if(_0x19aae1[_0xc1dd('0x30')]['filter']){_0x5ede6f['where']=_[_0xc1dd('0x3c')](_0x5ede6f['where'],{'$or':_['map'](_0x5ede6f[_0xc1dd('0x32')],function(_0x3f40d5){var _0x1bac29={};_0x1bac29[_0x3f40d5]={'$like':'%'+_0x19aae1[_0xc1dd('0x30')][_0xc1dd('0x3b')]+'%'};return _0x1bac29;})});}_0x5ede6f=_['merge']({},_0x5ede6f,_0x19aae1[_0xc1dd('0x47')]);return _0x106ece[_0xc1dd('0x4d')](_0x5ede6f);}})[_0xc1dd('0x24')](function(_0x39ffb4){if(_0x39ffb4){_0x5aaf00=_0x39ffb4[_0xc1dd('0x46')];if(!_0x19aae1[_0xc1dd('0x30')]['hasOwnProperty']('nolimit')){_0x5ede6f[_0xc1dd('0x1d')]=qs['limit'](_0x19aae1['query']['limit']);_0x5ede6f[_0xc1dd('0x1a')]=qs[_0xc1dd('0x1a')](_0x19aae1['query'][_0xc1dd('0x1a')]);}return _0x106ece['getConfigurations'](_0x5ede6f);}})[_0xc1dd('0x24')](function(_0x4fd522){if(_0x4fd522){return _0x4fd522?{'count':_0x5aaf00,'rows':_0x4fd522}:null;}})[_0xc1dd('0x24')](respondWithResult(_0x3bd169,null))[_0xc1dd('0x42')](handleError(_0x3bd169,null));};exports[_0xc1dd('0x4e')]=function(_0x1681b6,_0x33ca43,_0x33a75f){if(_0x1681b6[_0xc1dd('0x49')]['id']){delete _0x1681b6[_0xc1dd('0x49')]['id'];}return db[_0xc1dd('0x2b')][_0xc1dd('0x4b')]({'where':{'id':_0x1681b6[_0xc1dd('0x44')]['id']}})[_0xc1dd('0x24')](handleEntityNotFound(_0x33ca43,null))[_0xc1dd('0x24')](function(_0x1f0085){if(_0x1f0085){_0x1681b6['body'][_0xc1dd('0x4f')]=_0x1f0085['id'];_0x1681b6[_0xc1dd('0x49')][_0xc1dd('0x50')]=integrations[_0xc1dd('0x51')](_0x1681b6[_0xc1dd('0x49')][_0xc1dd('0x52')],_0x1681b6[_0xc1dd('0x49')][_0xc1dd('0x3d')]);_0x1681b6[_0xc1dd('0x49')][_0xc1dd('0x53')]=integrations[_0xc1dd('0x54')](_0x1681b6[_0xc1dd('0x49')][_0xc1dd('0x52')],_0x1681b6[_0xc1dd('0x49')][_0xc1dd('0x3d')]);return db[_0xc1dd('0x4c')]['create'](_0x1681b6['body'],{'include':[{'model':db['VtigerField'],'as':_0xc1dd('0x50')},{'model':db[_0xc1dd('0x55')],'as':_0xc1dd('0x53')}]});}return null;})[_0xc1dd('0x24')](respondWithResult(_0x33ca43,null))[_0xc1dd('0x42')](handleError(_0x33ca43,null));};var md5=require('md5');exports[_0xc1dd('0x56')]=function(_0x5f02f8,_0x1fa6ec,_0x360dc1){var _0x408742=null;var _0xa4bcc9=null;var _0x3211d2=null;var _0x12219d=null;var _0x47b025='';return db[_0xc1dd('0x2b')][_0xc1dd('0x4b')]({'where':{'id':_0x5f02f8['params']['id']},'attributes':['id',_0xc1dd('0x27'),'username',_0xc1dd('0x57'),'moduleName',_0xc1dd('0x58'),_0xc1dd('0x59'),'accessKey']})[_0xc1dd('0x24')](handleEntityNotFound(_0x1fa6ec,null))[_0xc1dd('0x24')](function(_0x5d34ea){if(_0x5d34ea){_0x408742=_0x5d34ea[_0xc1dd('0x5a')];_0xa4bcc9=_0x5d34ea[_0xc1dd('0x5b')];_0x3211d2=_0x5d34ea[_0xc1dd('0x5c')];_0x47b025=_0x5d34ea[_0xc1dd('0x58')];var _0x542246=_0x47b025[_0xc1dd('0x5d')](-0x1);if(_0x542246==='/'){_0x47b025=_0x47b025[_0xc1dd('0x5e')](0x0,_0x47b025[_0xc1dd('0x5f')](_0x542246));}_0x12219d=util[_0xc1dd('0x60')](_0xc1dd('0x61'),_0x47b025);var _0x480544={'method':_0xc1dd('0x62'),'uri':_0x12219d,'qs':{'operation':_0xc1dd('0x63'),'username':_0x5d34ea[_0xc1dd('0x5a')]},'json':!![]};return rp(_0x480544);}})['then'](function(_0xfbe07){if(_0xfbe07[_0xc1dd('0x64')]){var _0x30eb9b={'method':_0xc1dd('0x65'),'uri':_0x12219d,'form':{'operation':_0xc1dd('0x66'),'username':_0x408742,'accessKey':md5(_0xfbe07[_0xc1dd('0x67')]['token']+_0xa4bcc9)},'json':!![]};return rp(_0x30eb9b);}})['then'](function(_0x16da07){if(_0x16da07[_0xc1dd('0x64')]){var _0xa3e2ce={'method':'GET','uri':_0x12219d,'qs':{'operation':_0xc1dd('0x68'),'username':_0x408742,'sessionName':_0x16da07[_0xc1dd('0x67')]['sessionName'],'elementType':_0x3211d2},'json':!![]};return rp(_0xa3e2ce);}})[_0xc1dd('0x24')](function(_0x1f350e){if(_0x1f350e[_0xc1dd('0x64')]){var _0x5080cc=['autogenerated',_0xc1dd('0x69'),_0xc1dd('0x6a')];_[_0xc1dd('0x6b')](_0x1f350e[_0xc1dd('0x67')]['fields'],function(_0xa9b477){return _0x5080cc[_0xc1dd('0x6c')](_0xa9b477[_0xc1dd('0x3d')][_0xc1dd('0x27')]);});_['remove'](_0x1f350e['result'][_0xc1dd('0x33')],function(_0x12ba2b){return _0x12ba2b[_0xc1dd('0x6d')]===_0xc1dd('0x6e');});return{'count':_0x1f350e[_0xc1dd('0x67')][_0xc1dd('0x33')]['length'],'rows':_[_0xc1dd('0x2a')](_0x1f350e[_0xc1dd('0x67')][_0xc1dd('0x33')],function(_0x2c0833){return{'id':_0x2c0833[_0xc1dd('0x27')],'name':_0x2c0833['label'],'custom':_[_0xc1dd('0x6f')](_0x2c0833[_0xc1dd('0x27')],_0xc1dd('0x70'))?!![]:![],'options':_0x2c0833[_0xc1dd('0x3d')][_0xc1dd('0x27')]===_0xc1dd('0x71')&&_0x2c0833[_0xc1dd('0x3d')][_0xc1dd('0x72')]['length']>0x0?_[_0xc1dd('0x2a')](_0x2c0833[_0xc1dd('0x3d')][_0xc1dd('0x72')],function(_0x27d84e){return{'name':_0x27d84e[_0xc1dd('0x73')],'value':_0x27d84e[_0xc1dd('0x74')]};}):[]};})};}})[_0xc1dd('0x24')](respondWithResult(_0x1fa6ec,null))[_0xc1dd('0x42')](function(_0x835d5b){console[_0xc1dd('0x75')](_0xc1dd('0x76')+_0x835d5b);var _0x188d33=_0x5f02f8[_0xc1dd('0x30')][_0xc1dd('0x77')]?0x1f4:_0x835d5b['statusCode']||0x1f4;logger[_0xc1dd('0x78')](_0xc1dd('0x79'),_0xc1dd('0x56'),_0x188d33,JSON['stringify'](_0x835d5b));delete _0x835d5b[_0xc1dd('0x27')];if(_0x188d33===0x191){_0x188d33=0x190;}_0x1fa6ec['status'](_0x188d33)[_0xc1dd('0x28')](_0x5f02f8[_0xc1dd('0x30')][_0xc1dd('0x77')]?{'message':_0xc1dd('0x7a'),'statusCode':_0x835d5b[_0xc1dd('0x7b')]}:_0x835d5b);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index e381415..bc844d9 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 _0x4db1=['util','../../config/logger','moment','bluebird','rimraf','./intVtigerAccount.attributes','exports','define','VtigerAccount','int_vtiger_accounts','lodash'];(function(_0x2564f9,_0x27c62f){var _0x1f2581=function(_0x1a43aa){while(--_0x1a43aa){_0x2564f9['push'](_0x2564f9['shift']());}};_0x1f2581(++_0x27c62f);}(_0x4db1,0x1a1));var _0x14db=function(_0x102881,_0x58d723){_0x102881=_0x102881-0x0;var _0x5c63d0=_0x4db1[_0x102881];return _0x5c63d0;};'use strict';var _=require(_0x14db('0x0'));var util=require(_0x14db('0x1'));var logger=require(_0x14db('0x2'))('api');var moment=require(_0x14db('0x3'));var BPromise=require(_0x14db('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x14db('0x5'));var config=require('../../config/environment');var attributes=require(_0x14db('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x14db('0x7')]=function(_0x37d818,_0x53d325){return _0x37d818[_0x14db('0x8')](_0x14db('0x9'),attributes,{'tableName':_0x14db('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe165=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','VtigerAccount','int_vtiger_accounts','lodash','../../config/logger'];(function(_0x402829,_0x230788){var _0x4c4d0f=function(_0x5225b8){while(--_0x5225b8){_0x402829['push'](_0x402829['shift']());}};_0x4c4d0f(++_0x230788);}(_0xe165,0x11c));var _0x5e16=function(_0x11161a,_0x12a67a){_0x11161a=_0x11161a-0x0;var _0x3231e3=_0xe165[_0x11161a];return _0x3231e3;};'use strict';var _=require(_0x5e16('0x0'));var util=require('util');var logger=require(_0x5e16('0x1'))(_0x5e16('0x2'));var moment=require(_0x5e16('0x3'));var BPromise=require(_0x5e16('0x4'));var rp=require(_0x5e16('0x5'));var fs=require('fs');var path=require(_0x5e16('0x6'));var rimraf=require(_0x5e16('0x7'));var config=require(_0x5e16('0x8'));var attributes=require(_0x5e16('0x9'));var integrations=require(_0x5e16('0xa'));module['exports']=function(_0x31642e,_0x2c6741){return _0x31642e['define'](_0x5e16('0xb'),attributes,{'tableName':_0x5e16('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 2213d2b..947b512 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 _0x6cb4=['where','attributes','limit','include','map','model','then','GetVtigerAccount','find','ShowVtigerAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','info','request\x20sent','debug','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','catch','VtigerAccount','findAll','options','raw'];(function(_0x464d60,_0x35a8ff){var _0x1b9545=function(_0x168b8b){while(--_0x168b8b){_0x464d60['push'](_0x464d60['shift']());}};_0x1b9545(++_0x35a8ff);}(_0x6cb4,0xff));var _0x46cb=function(_0x4bc03b,_0x752b41){_0x4bc03b=_0x4bc03b-0x0;var _0x51d743=_0x6cb4[_0x4bc03b];return _0x51d743;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var moment=require(_0x46cb('0x2'));var BPromise=require(_0x46cb('0x3'));var rs=require(_0x46cb('0x4'));var fs=require('fs');var Redis=require(_0x46cb('0x5'));var db=require(_0x46cb('0x6'))['db'];var utils=require(_0x46cb('0x7'));var logger=require(_0x46cb('0x8'))('rpc');var config=require(_0x46cb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x46cb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11262d,_0x148d0f,_0x31b35b){return new BPromise(function(_0x2d6c29,_0x24b4f5){return client[_0x46cb('0xb')](_0x11262d,_0x31b35b)['then'](function(_0x3d7663){logger[_0x46cb('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x148d0f,_0x46cb('0xd'));logger[_0x46cb('0xe')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x148d0f,_0x46cb('0xd'),JSON[_0x46cb('0xf')](_0x3d7663));if(_0x3d7663['error']){if(_0x3d7663['error']['code']===0x1f4){logger[_0x46cb('0x10')](_0x46cb('0x11'),_0x148d0f,_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);return _0x24b4f5(_0x3d7663['error'][_0x46cb('0x12')]);}logger[_0x46cb('0x10')](_0x46cb('0x11'),_0x148d0f,_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);return _0x2d6c29(_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);}else{logger[_0x46cb('0xc')](_0x46cb('0x11'),_0x148d0f,_0x46cb('0xd'));_0x2d6c29(_0x3d7663[_0x46cb('0x13')]['message']);}})[_0x46cb('0x14')](function(_0x5796d2){logger[_0x46cb('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x148d0f,_0x5796d2);_0x24b4f5(_0x5796d2);});});}exports['GetVtigerAccount']=function(_0x4e3454){var _0x1b6646=this;return new Promise(function(_0x1f2891,_0x4df1f0){return db[_0x46cb('0x15')][_0x46cb('0x16')]({'raw':_0x4e3454[_0x46cb('0x17')]?_0x4e3454[_0x46cb('0x17')][_0x46cb('0x18')]===undefined?!![]:![]:!![],'where':_0x4e3454[_0x46cb('0x17')]?_0x4e3454[_0x46cb('0x17')][_0x46cb('0x19')]||null:null,'attributes':_0x4e3454[_0x46cb('0x17')]?_0x4e3454[_0x46cb('0x17')][_0x46cb('0x1a')]||null:null,'limit':_0x4e3454[_0x46cb('0x17')]?_0x4e3454[_0x46cb('0x17')][_0x46cb('0x1b')]||null:null,'include':_0x4e3454[_0x46cb('0x17')]?_0x4e3454[_0x46cb('0x17')][_0x46cb('0x1c')]?_[_0x46cb('0x1d')](_0x4e3454[_0x46cb('0x17')][_0x46cb('0x1c')],function(_0xadcad6){return{'model':db[_0xadcad6[_0x46cb('0x1e')]],'as':_0xadcad6['as'],'attributes':_0xadcad6['attributes'],'include':_0xadcad6['include']?_[_0x46cb('0x1d')](_0xadcad6[_0x46cb('0x1c')],function(_0x2711ac){return{'model':db[_0x2711ac[_0x46cb('0x1e')]],'as':_0x2711ac['as'],'attributes':_0x2711ac[_0x46cb('0x1a')],'include':_0x2711ac['include']?_[_0x46cb('0x1d')](_0x2711ac['include'],function(_0x495886){return{'model':db[_0x495886['model']],'as':_0x495886['as'],'attributes':_0x495886[_0x46cb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x46cb('0x1f')](function(_0x2242e7){logger[_0x46cb('0xc')](_0x46cb('0x20'),_0x4e3454);logger[_0x46cb('0xe')](_0x46cb('0x20'),_0x4e3454,JSON[_0x46cb('0xf')](_0x2242e7));_0x1f2891(_0x2242e7);})[_0x46cb('0x14')](function(_0x12e01e){logger[_0x46cb('0x10')]('GetVtigerAccount',_0x12e01e[_0x46cb('0x12')],_0x4e3454);_0x4df1f0(_0x1b6646[_0x46cb('0x10')](0x1f4,_0x12e01e['message']));});});};exports['ShowVtigerAccount']=function(_0x15f5cf){var _0x5cbb22=this;return new Promise(function(_0x27c22d,_0x6f7953){return db[_0x46cb('0x15')][_0x46cb('0x21')]({'raw':_0x15f5cf[_0x46cb('0x17')]?_0x15f5cf[_0x46cb('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x15f5cf[_0x46cb('0x17')]?_0x15f5cf['options'][_0x46cb('0x19')]||null:null,'attributes':_0x15f5cf[_0x46cb('0x17')]?_0x15f5cf['options'][_0x46cb('0x1a')]||null:null,'include':_0x15f5cf[_0x46cb('0x17')]?_0x15f5cf[_0x46cb('0x17')][_0x46cb('0x1c')]?_[_0x46cb('0x1d')](_0x15f5cf['options'][_0x46cb('0x1c')],function(_0x49f80a){return{'model':db[_0x49f80a[_0x46cb('0x1e')]],'as':_0x49f80a['as'],'attributes':_0x49f80a[_0x46cb('0x1a')],'include':_0x49f80a[_0x46cb('0x1c')]?_['map'](_0x49f80a[_0x46cb('0x1c')],function(_0x4290c){return{'model':db[_0x4290c['model']],'as':_0x4290c['as'],'attributes':_0x4290c[_0x46cb('0x1a')],'include':_0x4290c[_0x46cb('0x1c')]?_[_0x46cb('0x1d')](_0x4290c[_0x46cb('0x1c')],function(_0x25be2d){return{'model':db[_0x25be2d[_0x46cb('0x1e')]],'as':_0x25be2d['as'],'attributes':_0x25be2d[_0x46cb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x46cb('0x1f')](function(_0x19e0ad){logger[_0x46cb('0xc')](_0x46cb('0x22'),_0x15f5cf);logger['debug']('ShowVtigerAccount',_0x15f5cf,JSON['stringify'](_0x19e0ad));_0x27c22d(_0x19e0ad);})[_0x46cb('0x14')](function(_0xf8aaec){logger[_0x46cb('0x10')](_0x46cb('0x22'),_0xf8aaec[_0x46cb('0x12')],_0x15f5cf);_0x6f7953(_0x5cbb22[_0x46cb('0x10')](0x1f4,_0xf8aaec['message']));});});}; \ No newline at end of file +var _0xab40=['VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','VtigerAccount','findAll','options','limit','include','model','map','attributes','GetVtigerAccount','ShowVtigerAccount','raw','where','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2bf214,_0x536123){var _0x26279d=function(_0x15f468){while(--_0x15f468){_0x2bf214['push'](_0x2bf214['shift']());}};_0x26279d(++_0x536123);}(_0xab40,0xcd));var _0x0ab4=function(_0xa996c7,_0x42adf0){_0xa996c7=_0xa996c7-0x0;var _0x10b842=_0xab40[_0xa996c7];return _0x10b842;};'use strict';var _=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ab4('0x2'));var db=require(_0x0ab4('0x3'))['db'];var utils=require(_0x0ab4('0x4'));var logger=require(_0x0ab4('0x5'))(_0x0ab4('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0ab4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10d92b,_0x46d16a,_0x11e99f){return new BPromise(function(_0x6d135d,_0x4cf8de){return client['request'](_0x10d92b,_0x11e99f)['then'](function(_0x24271e){logger[_0x0ab4('0x8')](_0x0ab4('0x9'),_0x46d16a,_0x0ab4('0xa'));logger[_0x0ab4('0xb')](_0x0ab4('0xc'),_0x46d16a,_0x0ab4('0xa'),JSON[_0x0ab4('0xd')](_0x24271e));if(_0x24271e['error']){if(_0x24271e['error'][_0x0ab4('0xe')]===0x1f4){logger['error'](_0x0ab4('0x9'),_0x46d16a,_0x24271e[_0x0ab4('0xf')][_0x0ab4('0x10')]);return _0x4cf8de(_0x24271e[_0x0ab4('0xf')][_0x0ab4('0x10')]);}logger[_0x0ab4('0xf')](_0x0ab4('0x9'),_0x46d16a,_0x24271e[_0x0ab4('0xf')][_0x0ab4('0x10')]);return _0x6d135d(_0x24271e[_0x0ab4('0xf')][_0x0ab4('0x10')]);}else{logger[_0x0ab4('0x8')](_0x0ab4('0x9'),_0x46d16a,_0x0ab4('0xa'));_0x6d135d(_0x24271e[_0x0ab4('0x11')][_0x0ab4('0x10')]);}})[_0x0ab4('0x12')](function(_0x2bdda7){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x46d16a,_0x2bdda7);_0x4cf8de(_0x2bdda7);});});}exports['GetVtigerAccount']=function(_0x17422f){var _0x30d5df=this;return new Promise(function(_0x2f50d2,_0x53723c){return db[_0x0ab4('0x13')][_0x0ab4('0x14')]({'raw':_0x17422f[_0x0ab4('0x15')]?_0x17422f[_0x0ab4('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x17422f['options']?_0x17422f[_0x0ab4('0x15')]['where']||null:null,'attributes':_0x17422f[_0x0ab4('0x15')]?_0x17422f[_0x0ab4('0x15')]['attributes']||null:null,'limit':_0x17422f[_0x0ab4('0x15')]?_0x17422f[_0x0ab4('0x15')][_0x0ab4('0x16')]||null:null,'include':_0x17422f[_0x0ab4('0x15')]?_0x17422f[_0x0ab4('0x15')]['include']?_['map'](_0x17422f[_0x0ab4('0x15')][_0x0ab4('0x17')],function(_0x392afe){return{'model':db[_0x392afe[_0x0ab4('0x18')]],'as':_0x392afe['as'],'attributes':_0x392afe['attributes'],'include':_0x392afe[_0x0ab4('0x17')]?_[_0x0ab4('0x19')](_0x392afe[_0x0ab4('0x17')],function(_0x4ea9aa){return{'model':db[_0x4ea9aa['model']],'as':_0x4ea9aa['as'],'attributes':_0x4ea9aa[_0x0ab4('0x1a')],'include':_0x4ea9aa[_0x0ab4('0x17')]?_[_0x0ab4('0x19')](_0x4ea9aa['include'],function(_0x519b23){return{'model':db[_0x519b23['model']],'as':_0x519b23['as'],'attributes':_0x519b23[_0x0ab4('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3bf844){logger[_0x0ab4('0x8')]('GetVtigerAccount',_0x17422f);logger['debug']('GetVtigerAccount',_0x17422f,JSON[_0x0ab4('0xd')](_0x3bf844));_0x2f50d2(_0x3bf844);})[_0x0ab4('0x12')](function(_0x1cfdad){logger[_0x0ab4('0xf')](_0x0ab4('0x1b'),_0x1cfdad['message'],_0x17422f);_0x53723c(_0x30d5df['error'](0x1f4,_0x1cfdad['message']));});});};exports[_0x0ab4('0x1c')]=function(_0x2b66d5){var _0x155d96=this;return new Promise(function(_0x182bbe,_0x46eda7){return db['VtigerAccount']['find']({'raw':_0x2b66d5[_0x0ab4('0x15')]?_0x2b66d5[_0x0ab4('0x15')][_0x0ab4('0x1d')]===undefined?!![]:![]:!![],'where':_0x2b66d5['options']?_0x2b66d5['options'][_0x0ab4('0x1e')]||null:null,'attributes':_0x2b66d5['options']?_0x2b66d5[_0x0ab4('0x15')][_0x0ab4('0x1a')]||null:null,'include':_0x2b66d5[_0x0ab4('0x15')]?_0x2b66d5[_0x0ab4('0x15')][_0x0ab4('0x17')]?_[_0x0ab4('0x19')](_0x2b66d5['options'][_0x0ab4('0x17')],function(_0x4696fc){return{'model':db[_0x4696fc[_0x0ab4('0x18')]],'as':_0x4696fc['as'],'attributes':_0x4696fc[_0x0ab4('0x1a')],'include':_0x4696fc['include']?_['map'](_0x4696fc[_0x0ab4('0x17')],function(_0x3e65a1){return{'model':db[_0x3e65a1[_0x0ab4('0x18')]],'as':_0x3e65a1['as'],'attributes':_0x3e65a1['attributes'],'include':_0x3e65a1['include']?_['map'](_0x3e65a1[_0x0ab4('0x17')],function(_0x35eab3){return{'model':db[_0x35eab3[_0x0ab4('0x18')]],'as':_0x35eab3['as'],'attributes':_0x35eab3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x492943){logger[_0x0ab4('0x8')](_0x0ab4('0x1c'),_0x2b66d5);logger[_0x0ab4('0xb')](_0x0ab4('0x1c'),_0x2b66d5,JSON[_0x0ab4('0xd')](_0x492943));_0x182bbe(_0x492943);})[_0x0ab4('0x12')](function(_0x52d9bf){logger[_0x0ab4('0xf')](_0x0ab4('0x1c'),_0x52d9bf[_0x0ab4('0x10')],_0x2b66d5);_0x46eda7(_0x155d96['error'](0x1f4,_0x52d9bf[_0x0ab4('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 6756c85..b815e49 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 _0x90f1=['get','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x13f0a2,_0x1b3623){var _0x4cd0b4=function(_0x28f044){while(--_0x28f044){_0x13f0a2['push'](_0x13f0a2['shift']());}};_0x4cd0b4(++_0x1b3623);}(_0x90f1,0xcd));var _0x190f=function(_0x186f8d,_0x45091c){_0x186f8d=_0x186f8d-0x0;var _0x38d63c=_0x90f1[_0x186f8d];return _0x38d63c;};'use strict';var multer=require('multer');var util=require(_0x190f('0x0'));var path=require(_0x190f('0x1'));var timeout=require(_0x190f('0x2'));var express=require(_0x190f('0x3'));var router=express[_0x190f('0x4')]();var fs_extra=require(_0x190f('0x5'));var auth=require(_0x190f('0x6'));var interaction=require(_0x190f('0x7'));var config=require(_0x190f('0x8'));var controller=require('./intVtigerConfiguration.controller');router['get']('/',auth[_0x190f('0x9')](),controller[_0x190f('0xa')]);router[_0x190f('0xb')]('/:id',auth[_0x190f('0x9')](),controller[_0x190f('0xc')]);router[_0x190f('0xb')]('/:id/fields',auth[_0x190f('0x9')](),controller['getFields']);router[_0x190f('0xb')](_0x190f('0xd'),auth['isAuthenticated'](),controller[_0x190f('0xe')]);router['get'](_0x190f('0xf'),auth[_0x190f('0x9')](),controller[_0x190f('0x10')]);router[_0x190f('0x11')]('/',auth[_0x190f('0x9')](),controller[_0x190f('0x12')]);router[_0x190f('0x13')](_0x190f('0x14'),auth[_0x190f('0x9')](),controller['update']);router[_0x190f('0x15')](_0x190f('0x14'),auth[_0x190f('0x9')](),controller[_0x190f('0x16')]);module[_0x190f('0x17')]=router; \ No newline at end of file +var _0x5e0e=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','update','delete','destroy','multer','util','connect-timeout'];(function(_0x215a62,_0x5cad36){var _0x23f20a=function(_0x344288){while(--_0x344288){_0x215a62['push'](_0x215a62['shift']());}};_0x23f20a(++_0x5cad36);}(_0x5e0e,0x70));var _0xe5e0=function(_0x1d5d3f,_0x3a9d08){_0x1d5d3f=_0x1d5d3f-0x0;var _0x6f9221=_0x5e0e[_0x1d5d3f];return _0x6f9221;};'use strict';var multer=require(_0xe5e0('0x0'));var util=require(_0xe5e0('0x1'));var path=require('path');var timeout=require(_0xe5e0('0x2'));var express=require(_0xe5e0('0x3'));var router=express['Router']();var fs_extra=require(_0xe5e0('0x4'));var auth=require(_0xe5e0('0x5'));var interaction=require(_0xe5e0('0x6'));var config=require(_0xe5e0('0x7'));var controller=require(_0xe5e0('0x8'));router[_0xe5e0('0x9')]('/',auth[_0xe5e0('0xa')](),controller[_0xe5e0('0xb')]);router[_0xe5e0('0x9')](_0xe5e0('0xc'),auth[_0xe5e0('0xa')](),controller[_0xe5e0('0xd')]);router[_0xe5e0('0x9')]('/:id/fields',auth[_0xe5e0('0xa')](),controller[_0xe5e0('0xe')]);router[_0xe5e0('0x9')](_0xe5e0('0xf'),auth['isAuthenticated'](),controller[_0xe5e0('0x10')]);router[_0xe5e0('0x9')](_0xe5e0('0x11'),auth[_0xe5e0('0xa')](),controller['getDescriptions']);router[_0xe5e0('0x12')]('/',auth[_0xe5e0('0xa')](),controller[_0xe5e0('0x13')]);router['put'](_0xe5e0('0xc'),auth['isAuthenticated'](),controller[_0xe5e0('0x14')]);router[_0xe5e0('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xe5e0('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 6ddda56..858b98a 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 _0x3dea=['sequelize','STRING'];(function(_0xdeacf1,_0x489de7){var _0x37cfc2=function(_0x2ae966){while(--_0x2ae966){_0xdeacf1['push'](_0xdeacf1['shift']());}};_0x37cfc2(++_0x489de7);}(_0x3dea,0x1b6));var _0xa3de=function(_0x3f52f6,_0x13ff60){_0x3f52f6=_0x3f52f6-0x0;var _0x4e90e7=_0x3dea[_0x3f52f6];return _0x4e90e7;};'use strict';var Sequelize=require(_0xa3de('0x0'));module['exports']={'name':{'type':Sequelize[_0xa3de('0x1')]},'description':{'type':Sequelize[_0xa3de('0x1')]}}; \ No newline at end of file +var _0xad40=['sequelize','exports','STRING'];(function(_0x2a99e2,_0x1803e4){var _0x23fb5f=function(_0x568ec9){while(--_0x568ec9){_0x2a99e2['push'](_0x2a99e2['shift']());}};_0x23fb5f(++_0x1803e4);}(_0xad40,0x171));var _0x0ad4=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xad40[_0x2b10c6];return _0x3789d2;};'use strict';var Sequelize=require(_0x0ad4('0x0'));module[_0x0ad4('0x1')]={'name':{'type':Sequelize[_0x0ad4('0x2')]},'description':{'type':Sequelize[_0x0ad4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 79eb218..52135a8 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 _0x34b2=['nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','VtigerConfiguration','findAll','rows','catch','show','keys','rawAttributes','create','body','find','params','getFields','VtigerField','order','hasOwnProperty','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','key','model','filters','intersection','attributes','fields','query','length'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x34b2,0x11c));var _0x234b=function(_0xeaa3bd,_0x166691){_0xeaa3bd=_0xeaa3bd-0x0;var _0x2e1174=_0x34b2[_0xeaa3bd];return _0x2e1174;};'use strict';var emlformat=require(_0x234b('0x0'));var rimraf=require(_0x234b('0x1'));var zipdir=require(_0x234b('0x2'));var jsonpatch=require(_0x234b('0x3'));var rp=require(_0x234b('0x4'));var moment=require(_0x234b('0x5'));var BPromise=require(_0x234b('0x6'));var Mustache=require(_0x234b('0x7'));var util=require(_0x234b('0x8'));var path=require(_0x234b('0x9'));var sox=require(_0x234b('0xa'));var csv=require(_0x234b('0xb'));var ejs=require(_0x234b('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x234b('0xd'));var jsforce=require(_0x234b('0xe'));var deskjs=require(_0x234b('0xf'));var toCsv=require(_0x234b('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x234b('0x10'));var authService=require(_0x234b('0x11'));var qs=require(_0x234b('0x12'));var as=require(_0x234b('0x13'));var hardwareService=require(_0x234b('0x14'));var logger=require(_0x234b('0x15'))(_0x234b('0x16'));var utils=require(_0x234b('0x17'));var config=require(_0x234b('0x18'));var licenseUtil=require(_0x234b('0x19'));var db=require(_0x234b('0x1a'))['db'];function respondWithStatusCode(_0x30b61d,_0x2eb390){_0x2eb390=_0x2eb390||0xcc;return function(_0x527c27){if(_0x527c27){return _0x30b61d[_0x234b('0x1b')](_0x2eb390);}return _0x30b61d[_0x234b('0x1c')](_0x2eb390)['end']();};}function respondWithResult(_0x2eb01c,_0x836f55){_0x836f55=_0x836f55||0xc8;return function(_0x580836){if(_0x580836){return _0x2eb01c[_0x234b('0x1c')](_0x836f55)[_0x234b('0x1d')](_0x580836);}};}function respondWithFilteredResult(_0x3ad95a,_0x9d98dd){return function(_0x2c3b6b){if(_0x2c3b6b){var _0x20d6cb=typeof _0x9d98dd[_0x234b('0x1e')]===_0x234b('0x1f')&&typeof _0x9d98dd[_0x234b('0x20')]==='undefined';var _0x107820=_0x2c3b6b[_0x234b('0x21')];var _0x18153a=_0x20d6cb?0x0:_0x9d98dd[_0x234b('0x1e')];var _0x4424a1=_0x20d6cb?_0x2c3b6b[_0x234b('0x21')]:_0x9d98dd[_0x234b('0x1e')]+_0x9d98dd[_0x234b('0x20')];var _0x30c5f4;if(_0x4424a1>=_0x107820){_0x4424a1=_0x107820;_0x30c5f4=0xc8;}else{_0x30c5f4=0xce;}_0x3ad95a[_0x234b('0x1c')](_0x30c5f4);return _0x3ad95a['set'](_0x234b('0x22'),_0x18153a+'-'+_0x4424a1+'/'+_0x107820)[_0x234b('0x1d')](_0x2c3b6b);}return null;};}function patchUpdates(_0x2a47e1){return function(_0x44d8d3){try{jsonpatch[_0x234b('0x23')](_0x44d8d3,_0x2a47e1,!![]);}catch(_0x5e5e2b){return BPromise[_0x234b('0x24')](_0x5e5e2b);}return _0x44d8d3[_0x234b('0x25')]();};}function saveUpdates(_0x50dfec,_0x184e98){return function(_0x115d47){if(_0x115d47){return _0x115d47[_0x234b('0x26')](_0x50dfec)[_0x234b('0x27')](function(_0x1f9e3f){return _0x1f9e3f;});}return null;};}function removeEntity(_0x18569b,_0x3daafa){return function(_0x1b8ead){if(_0x1b8ead){return _0x1b8ead[_0x234b('0x28')]()[_0x234b('0x27')](function(){_0x18569b[_0x234b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xaaa218,_0x540e6b){return function(_0x1f64d9){if(!_0x1f64d9){_0xaaa218[_0x234b('0x1b')](0x194);}return _0x1f64d9;};}function handleError(_0x42c42e,_0x273b10){_0x273b10=_0x273b10||0x1f4;return function(_0x493108){logger[_0x234b('0x29')](_0x493108[_0x234b('0x2a')]);if(_0x493108['name']){delete _0x493108[_0x234b('0x2b')];}_0x42c42e[_0x234b('0x1c')](_0x273b10)[_0x234b('0x2c')](_0x493108);};}exports[_0x234b('0x2d')]=function(_0x1de1dc,_0x5bf3c3){var _0x17c0f5={},_0x5d211b={},_0x439577={'count':0x0,'rows':[]};var _0x3b698f=_[_0x234b('0x2e')](db['VtigerConfiguration']['rawAttributes'],function(_0x4c8cde){return{'name':_0x4c8cde[_0x234b('0x2f')],'type':_0x4c8cde['type'][_0x234b('0x30')]};});_0x5d211b[_0x234b('0x31')]=_[_0x234b('0x2e')](_0x3b698f,_0x234b('0x2b'));_0x5d211b['query']=_['keys'](_0x1de1dc['query']);_0x5d211b[_0x234b('0x32')]=_[_0x234b('0x33')](_0x5d211b[_0x234b('0x31')],_0x5d211b['query']);_0x17c0f5[_0x234b('0x34')]=_[_0x234b('0x33')](_0x5d211b[_0x234b('0x31')],qs[_0x234b('0x35')](_0x1de1dc[_0x234b('0x36')][_0x234b('0x35')]));_0x17c0f5[_0x234b('0x34')]=_0x17c0f5[_0x234b('0x34')][_0x234b('0x37')]?_0x17c0f5['attributes']:_0x5d211b[_0x234b('0x31')];if(!_0x1de1dc[_0x234b('0x36')]['hasOwnProperty'](_0x234b('0x38'))){_0x17c0f5[_0x234b('0x20')]=qs['limit'](_0x1de1dc[_0x234b('0x36')][_0x234b('0x20')]);_0x17c0f5['offset']=qs[_0x234b('0x1e')](_0x1de1dc[_0x234b('0x36')][_0x234b('0x1e')]);}_0x17c0f5['order']=qs[_0x234b('0x39')](_0x1de1dc[_0x234b('0x36')]['sort']);_0x17c0f5[_0x234b('0x3a')]=qs['filters'](_[_0x234b('0x3b')](_0x1de1dc['query'],_0x5d211b['filters']),_0x3b698f);if(_0x1de1dc['query'][_0x234b('0x3c')]){_0x17c0f5[_0x234b('0x3a')]=_[_0x234b('0x3d')](_0x17c0f5[_0x234b('0x3a')],{'$or':_[_0x234b('0x2e')](_0x3b698f,function(_0x1013f2){if(_0x1013f2[_0x234b('0x3e')]!==_0x234b('0x3f')){var _0x2a15d2={};_0x2a15d2[_0x1013f2[_0x234b('0x2b')]]={'$like':'%'+_0x1de1dc['query'][_0x234b('0x3c')]+'%'};return _0x2a15d2;}})});}_0x17c0f5=_[_0x234b('0x3d')]({},_0x17c0f5,_0x1de1dc[_0x234b('0x40')]);var _0x515246={'where':_0x17c0f5[_0x234b('0x3a')]};return db['VtigerConfiguration']['count'](_0x515246)[_0x234b('0x27')](function(_0x6490cd){_0x439577['count']=_0x6490cd;if(_0x1de1dc[_0x234b('0x36')][_0x234b('0x41')]){_0x17c0f5[_0x234b('0x42')]=[{'all':!![]}];}return db[_0x234b('0x43')][_0x234b('0x44')](_0x17c0f5);})[_0x234b('0x27')](function(_0x3ee603){_0x439577[_0x234b('0x45')]=_0x3ee603;return _0x439577;})['then'](respondWithFilteredResult(_0x5bf3c3,_0x17c0f5))[_0x234b('0x46')](handleError(_0x5bf3c3,null));};exports[_0x234b('0x47')]=function(_0x6c89c5,_0x170bc4){var _0xbaaf03={'raw':![],'where':{'id':_0x6c89c5['params']['id']}},_0xa57fd9={};_0xa57fd9[_0x234b('0x31')]=_[_0x234b('0x48')](db[_0x234b('0x43')][_0x234b('0x49')]);_0xa57fd9[_0x234b('0x36')]=_[_0x234b('0x48')](_0x6c89c5['query']);_0xa57fd9[_0x234b('0x32')]=_['intersection'](_0xa57fd9['model'],_0xa57fd9[_0x234b('0x36')]);_0xbaaf03[_0x234b('0x34')]=_[_0x234b('0x33')](_0xa57fd9[_0x234b('0x31')],qs['fields'](_0x6c89c5['query'][_0x234b('0x35')]));_0xbaaf03['attributes']=_0xbaaf03[_0x234b('0x34')][_0x234b('0x37')]?_0xbaaf03[_0x234b('0x34')]:_0xa57fd9['model'];if(_0x6c89c5[_0x234b('0x36')]['includeAll']){_0xbaaf03[_0x234b('0x42')]=[{'all':!![]}];}_0xbaaf03=_[_0x234b('0x3d')]({},_0xbaaf03,_0x6c89c5[_0x234b('0x40')]);return db[_0x234b('0x43')]['find'](_0xbaaf03)[_0x234b('0x27')](handleEntityNotFound(_0x170bc4,null))[_0x234b('0x27')](respondWithResult(_0x170bc4,null))[_0x234b('0x46')](handleError(_0x170bc4,null));};exports[_0x234b('0x4a')]=function(_0x4b72ac,_0x47cc0e){return db['VtigerConfiguration']['create'](_0x4b72ac[_0x234b('0x4b')],{})[_0x234b('0x27')](respondWithResult(_0x47cc0e,0xc9))[_0x234b('0x46')](handleError(_0x47cc0e,null));};exports['update']=function(_0x538738,_0x5a0bef){if(_0x538738[_0x234b('0x4b')]['id']){delete _0x538738[_0x234b('0x4b')]['id'];}return db[_0x234b('0x43')][_0x234b('0x4c')]({'where':{'id':_0x538738[_0x234b('0x4d')]['id']}})[_0x234b('0x27')](handleEntityNotFound(_0x5a0bef,null))[_0x234b('0x27')](saveUpdates(_0x538738['body'],null))[_0x234b('0x27')](respondWithResult(_0x5a0bef,null))['catch'](handleError(_0x5a0bef,null));};exports[_0x234b('0x28')]=function(_0x391e31,_0x4df6f5){return db['VtigerConfiguration'][_0x234b('0x4c')]({'where':{'id':_0x391e31[_0x234b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4df6f5,null))[_0x234b('0x27')](removeEntity(_0x4df6f5,null))['catch'](handleError(_0x4df6f5,null));};exports[_0x234b('0x4e')]=function(_0x39e15c,_0x31d969,_0x57b591){var _0x54dd00={};var _0x18732c={};var _0x2fdae6;var _0x54449b;return db[_0x234b('0x43')]['findOne']({'where':{'id':_0x39e15c['params']['id']}})[_0x234b('0x27')](handleEntityNotFound(_0x31d969,null))[_0x234b('0x27')](function(_0x198877){if(_0x198877){_0x2fdae6=_0x198877;_0x18732c[_0x234b('0x31')]=_['keys'](db[_0x234b('0x4f')]['rawAttributes']);_0x18732c['query']=_[_0x234b('0x48')](_0x39e15c[_0x234b('0x36')]);_0x18732c[_0x234b('0x32')]=_[_0x234b('0x33')](_0x18732c[_0x234b('0x31')],_0x18732c[_0x234b('0x36')]);_0x54dd00['attributes']=_[_0x234b('0x33')](_0x18732c[_0x234b('0x31')],qs[_0x234b('0x35')](_0x39e15c[_0x234b('0x36')]['fields']));_0x54dd00[_0x234b('0x34')]=_0x54dd00[_0x234b('0x34')][_0x234b('0x37')]?_0x54dd00['attributes']:_0x18732c[_0x234b('0x31')];_0x54dd00[_0x234b('0x50')]=qs[_0x234b('0x39')](_0x39e15c[_0x234b('0x36')][_0x234b('0x39')]);_0x54dd00[_0x234b('0x3a')]=qs['filters'](_[_0x234b('0x3b')](_0x39e15c[_0x234b('0x36')],_0x18732c[_0x234b('0x32')]));if(_0x39e15c[_0x234b('0x36')]['filter']){_0x54dd00['where']=_[_0x234b('0x3d')](_0x54dd00[_0x234b('0x3a')],{'$or':_[_0x234b('0x2e')](_0x54dd00[_0x234b('0x34')],function(_0x55fd9c){var _0x5e1207={};_0x5e1207[_0x55fd9c]={'$like':'%'+_0x39e15c[_0x234b('0x36')]['filter']+'%'};return _0x5e1207;})});}_0x54dd00=_[_0x234b('0x3d')]({},_0x54dd00,_0x39e15c['options']);return _0x2fdae6[_0x234b('0x4e')](_0x54dd00);}})[_0x234b('0x27')](function(_0x222bd1){if(_0x222bd1){_0x54449b=_0x222bd1[_0x234b('0x37')];if(!_0x39e15c[_0x234b('0x36')][_0x234b('0x51')](_0x234b('0x38'))){_0x54dd00[_0x234b('0x20')]=qs[_0x234b('0x20')](_0x39e15c['query'][_0x234b('0x20')]);_0x54dd00[_0x234b('0x1e')]=qs['offset'](_0x39e15c[_0x234b('0x36')][_0x234b('0x1e')]);}return _0x2fdae6[_0x234b('0x4e')](_0x54dd00);}})[_0x234b('0x27')](function(_0x1e5008){if(_0x1e5008){return _0x1e5008?{'count':_0x54449b,'rows':_0x1e5008}:null;}})[_0x234b('0x27')](respondWithResult(_0x31d969,null))[_0x234b('0x46')](handleError(_0x31d969,null));};exports[_0x234b('0x52')]=function(_0x124220,_0x1d7116,_0x3f6f48){var _0x13c437={};var _0x2aab30={};var _0x471f47;var _0x458548;return db['VtigerConfiguration'][_0x234b('0x53')]({'where':{'id':_0x124220[_0x234b('0x4d')]['id']}})[_0x234b('0x27')](handleEntityNotFound(_0x1d7116,null))['then'](function(_0x38f082){if(_0x38f082){_0x471f47=_0x38f082;_0x2aab30['model']=_[_0x234b('0x48')](db[_0x234b('0x4f')][_0x234b('0x49')]);_0x2aab30[_0x234b('0x36')]=_[_0x234b('0x48')](_0x124220[_0x234b('0x36')]);_0x2aab30[_0x234b('0x32')]=_['intersection'](_0x2aab30['model'],_0x2aab30[_0x234b('0x36')]);_0x13c437['attributes']=_[_0x234b('0x33')](_0x2aab30[_0x234b('0x31')],qs['fields'](_0x124220[_0x234b('0x36')]['fields']));_0x13c437['attributes']=_0x13c437['attributes'][_0x234b('0x37')]?_0x13c437[_0x234b('0x34')]:_0x2aab30['model'];_0x13c437['order']=qs['sort'](_0x124220[_0x234b('0x36')][_0x234b('0x39')]);_0x13c437[_0x234b('0x3a')]=qs[_0x234b('0x32')](_['pick'](_0x124220[_0x234b('0x36')],_0x2aab30[_0x234b('0x32')]));if(_0x124220[_0x234b('0x36')][_0x234b('0x3c')]){_0x13c437['where']=_[_0x234b('0x3d')](_0x13c437['where'],{'$or':_[_0x234b('0x2e')](_0x13c437[_0x234b('0x34')],function(_0x2f2b0f){var _0x1f7c8c={};_0x1f7c8c[_0x2f2b0f]={'$like':'%'+_0x124220[_0x234b('0x36')][_0x234b('0x3c')]+'%'};return _0x1f7c8c;})});}_0x13c437=_['merge']({},_0x13c437,_0x124220[_0x234b('0x40')]);return _0x471f47[_0x234b('0x52')](_0x13c437);}})[_0x234b('0x27')](function(_0x236899){if(_0x236899){_0x458548=_0x236899[_0x234b('0x37')];if(!_0x124220[_0x234b('0x36')][_0x234b('0x51')](_0x234b('0x38'))){_0x13c437[_0x234b('0x20')]=qs[_0x234b('0x20')](_0x124220[_0x234b('0x36')][_0x234b('0x20')]);_0x13c437[_0x234b('0x1e')]=qs[_0x234b('0x1e')](_0x124220[_0x234b('0x36')][_0x234b('0x1e')]);}return _0x471f47[_0x234b('0x52')](_0x13c437);}})[_0x234b('0x27')](function(_0xf1637b){if(_0xf1637b){return _0xf1637b?{'count':_0x458548,'rows':_0xf1637b}:null;}})[_0x234b('0x27')](respondWithResult(_0x1d7116,null))['catch'](handleError(_0x1d7116,null));};exports[_0x234b('0x54')]=function(_0x15caa0,_0x34b13e,_0xf03698){var _0x5580f7={};var _0x22e5b8={};var _0x444c8f;var _0x21ae7d;return db[_0x234b('0x43')][_0x234b('0x53')]({'where':{'id':_0x15caa0[_0x234b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x34b13e,null))['then'](function(_0x19ad09){if(_0x19ad09){_0x444c8f=_0x19ad09;_0x22e5b8[_0x234b('0x31')]=_[_0x234b('0x48')](db['VtigerField'][_0x234b('0x49')]);_0x22e5b8[_0x234b('0x36')]=_[_0x234b('0x48')](_0x15caa0[_0x234b('0x36')]);_0x22e5b8[_0x234b('0x32')]=_['intersection'](_0x22e5b8[_0x234b('0x31')],_0x22e5b8[_0x234b('0x36')]);_0x5580f7[_0x234b('0x34')]=_[_0x234b('0x33')](_0x22e5b8[_0x234b('0x31')],qs[_0x234b('0x35')](_0x15caa0[_0x234b('0x36')]['fields']));_0x5580f7[_0x234b('0x34')]=_0x5580f7['attributes'][_0x234b('0x37')]?_0x5580f7[_0x234b('0x34')]:_0x22e5b8[_0x234b('0x31')];_0x5580f7[_0x234b('0x50')]=qs[_0x234b('0x39')](_0x15caa0[_0x234b('0x36')][_0x234b('0x39')]);_0x5580f7['where']=qs[_0x234b('0x32')](_['pick'](_0x15caa0[_0x234b('0x36')],_0x22e5b8[_0x234b('0x32')]));if(_0x15caa0[_0x234b('0x36')]['filter']){_0x5580f7[_0x234b('0x3a')]=_['merge'](_0x5580f7['where'],{'$or':_[_0x234b('0x2e')](_0x5580f7[_0x234b('0x34')],function(_0x364e73){var _0x1cedc0={};_0x1cedc0[_0x364e73]={'$like':'%'+_0x15caa0['query'][_0x234b('0x3c')]+'%'};return _0x1cedc0;})});}_0x5580f7=_[_0x234b('0x3d')]({},_0x5580f7,_0x15caa0[_0x234b('0x40')]);return _0x444c8f[_0x234b('0x54')](_0x5580f7);}})[_0x234b('0x27')](function(_0x5afa8e){if(_0x5afa8e){_0x21ae7d=_0x5afa8e['length'];if(!_0x15caa0['query'][_0x234b('0x51')](_0x234b('0x38'))){_0x5580f7[_0x234b('0x20')]=qs[_0x234b('0x20')](_0x15caa0[_0x234b('0x36')][_0x234b('0x20')]);_0x5580f7[_0x234b('0x1e')]=qs['offset'](_0x15caa0[_0x234b('0x36')][_0x234b('0x1e')]);}return _0x444c8f[_0x234b('0x54')](_0x5580f7);}})[_0x234b('0x27')](function(_0x2240a2){if(_0x2240a2){return _0x2240a2?{'count':_0x21ae7d,'rows':_0x2240a2}:null;}})[_0x234b('0x27')](respondWithResult(_0x34b13e,null))[_0x234b('0x46')](handleError(_0x34b13e,null));}; \ No newline at end of file +var _0xb6a9=['count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','VtigerConfiguration','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','findOne','sort','getFields','getSubjects','VtigerField','getDescriptions','eml-format','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0xb6a9,0x1c4));var _0x9b6a=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xb6a9[_0x38a7ac];return _0x53061a;};'use strict';var emlformat=require(_0x9b6a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9b6a('0x1'));var rp=require('request-promise');var moment=require(_0x9b6a('0x2'));var BPromise=require(_0x9b6a('0x3'));var Mustache=require('mustache');var util=require(_0x9b6a('0x4'));var path=require(_0x9b6a('0x5'));var sox=require(_0x9b6a('0x6'));var csv=require(_0x9b6a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9b6a('0x8'));var _=require(_0x9b6a('0x9'));var squel=require(_0x9b6a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9b6a('0xb'));var toCsv=require(_0x9b6a('0x7'));var querystring=require(_0x9b6a('0xc'));var Papa=require('papaparse');var Redis=require(_0x9b6a('0xd'));var authService=require(_0x9b6a('0xe'));var qs=require(_0x9b6a('0xf'));var as=require(_0x9b6a('0x10'));var hardwareService=require(_0x9b6a('0x11'));var logger=require(_0x9b6a('0x12'))(_0x9b6a('0x13'));var utils=require('../../config/utils');var config=require(_0x9b6a('0x14'));var licenseUtil=require(_0x9b6a('0x15'));var db=require(_0x9b6a('0x16'))['db'];function respondWithStatusCode(_0x2937ef,_0x15aee5){_0x15aee5=_0x15aee5||0xcc;return function(_0x3487c8){if(_0x3487c8){return _0x2937ef['sendStatus'](_0x15aee5);}return _0x2937ef[_0x9b6a('0x17')](_0x15aee5)[_0x9b6a('0x18')]();};}function respondWithResult(_0x4894ea,_0x211d61){_0x211d61=_0x211d61||0xc8;return function(_0x3ea844){if(_0x3ea844){return _0x4894ea[_0x9b6a('0x17')](_0x211d61)[_0x9b6a('0x19')](_0x3ea844);}};}function respondWithFilteredResult(_0x333dda,_0x51e795){return function(_0x23c40a){if(_0x23c40a){var _0x20517c=typeof _0x51e795[_0x9b6a('0x1a')]==='undefined'&&typeof _0x51e795['limit']===_0x9b6a('0x1b');var _0x5c1a88=_0x23c40a['count'];var _0x488b66=_0x20517c?0x0:_0x51e795[_0x9b6a('0x1a')];var _0x44b32a=_0x20517c?_0x23c40a[_0x9b6a('0x1c')]:_0x51e795[_0x9b6a('0x1a')]+_0x51e795[_0x9b6a('0x1d')];var _0x4f67d8;if(_0x44b32a>=_0x5c1a88){_0x44b32a=_0x5c1a88;_0x4f67d8=0xc8;}else{_0x4f67d8=0xce;}_0x333dda['status'](_0x4f67d8);return _0x333dda[_0x9b6a('0x1e')](_0x9b6a('0x1f'),_0x488b66+'-'+_0x44b32a+'/'+_0x5c1a88)[_0x9b6a('0x19')](_0x23c40a);}return null;};}function patchUpdates(_0x2adbcf){return function(_0x22d7cd){try{jsonpatch[_0x9b6a('0x20')](_0x22d7cd,_0x2adbcf,!![]);}catch(_0x45889b){return BPromise[_0x9b6a('0x21')](_0x45889b);}return _0x22d7cd[_0x9b6a('0x22')]();};}function saveUpdates(_0x2bb311,_0x484547){return function(_0x35f161){if(_0x35f161){return _0x35f161[_0x9b6a('0x23')](_0x2bb311)[_0x9b6a('0x24')](function(_0x298269){return _0x298269;});}return null;};}function removeEntity(_0x2a08a9,_0x44085f){return function(_0x2a4b09){if(_0x2a4b09){return _0x2a4b09[_0x9b6a('0x25')]()[_0x9b6a('0x24')](function(){_0x2a08a9[_0x9b6a('0x17')](0xcc)[_0x9b6a('0x18')]();});}};}function handleEntityNotFound(_0x2663ee,_0x31696e){return function(_0x556ae8){if(!_0x556ae8){_0x2663ee[_0x9b6a('0x26')](0x194);}return _0x556ae8;};}function handleError(_0x274eb9,_0x18134a){_0x18134a=_0x18134a||0x1f4;return function(_0x10c914){logger[_0x9b6a('0x27')](_0x10c914[_0x9b6a('0x28')]);if(_0x10c914[_0x9b6a('0x29')]){delete _0x10c914[_0x9b6a('0x29')];}_0x274eb9[_0x9b6a('0x17')](_0x18134a)['send'](_0x10c914);};}exports[_0x9b6a('0x2a')]=function(_0x1d74c4,_0x2126ae){var _0x224f0d={},_0x1a4dde={},_0xabfca3={'count':0x0,'rows':[]};var _0x2dc7be=_[_0x9b6a('0x2b')](db[_0x9b6a('0x2c')][_0x9b6a('0x2d')],function(_0x527cf5){return{'name':_0x527cf5['fieldName'],'type':_0x527cf5[_0x9b6a('0x2e')][_0x9b6a('0x2f')]};});_0x1a4dde[_0x9b6a('0x30')]=_[_0x9b6a('0x2b')](_0x2dc7be,_0x9b6a('0x29'));_0x1a4dde[_0x9b6a('0x31')]=_[_0x9b6a('0x32')](_0x1d74c4[_0x9b6a('0x31')]);_0x1a4dde['filters']=_[_0x9b6a('0x33')](_0x1a4dde[_0x9b6a('0x30')],_0x1a4dde[_0x9b6a('0x31')]);_0x224f0d[_0x9b6a('0x34')]=_[_0x9b6a('0x33')](_0x1a4dde[_0x9b6a('0x30')],qs[_0x9b6a('0x35')](_0x1d74c4[_0x9b6a('0x31')][_0x9b6a('0x35')]));_0x224f0d[_0x9b6a('0x34')]=_0x224f0d['attributes'][_0x9b6a('0x36')]?_0x224f0d[_0x9b6a('0x34')]:_0x1a4dde['model'];if(!_0x1d74c4[_0x9b6a('0x31')][_0x9b6a('0x37')](_0x9b6a('0x38'))){_0x224f0d[_0x9b6a('0x1d')]=qs[_0x9b6a('0x1d')](_0x1d74c4[_0x9b6a('0x31')][_0x9b6a('0x1d')]);_0x224f0d['offset']=qs['offset'](_0x1d74c4['query'][_0x9b6a('0x1a')]);}_0x224f0d[_0x9b6a('0x39')]=qs['sort'](_0x1d74c4['query']['sort']);_0x224f0d[_0x9b6a('0x3a')]=qs[_0x9b6a('0x3b')](_[_0x9b6a('0x3c')](_0x1d74c4[_0x9b6a('0x31')],_0x1a4dde[_0x9b6a('0x3b')]),_0x2dc7be);if(_0x1d74c4[_0x9b6a('0x31')][_0x9b6a('0x3d')]){_0x224f0d[_0x9b6a('0x3a')]=_[_0x9b6a('0x3e')](_0x224f0d[_0x9b6a('0x3a')],{'$or':_[_0x9b6a('0x2b')](_0x2dc7be,function(_0x36123b){if(_0x36123b[_0x9b6a('0x2e')]!=='VIRTUAL'){var _0x9279d8={};_0x9279d8[_0x36123b['name']]={'$like':'%'+_0x1d74c4[_0x9b6a('0x31')][_0x9b6a('0x3d')]+'%'};return _0x9279d8;}})});}_0x224f0d=_[_0x9b6a('0x3e')]({},_0x224f0d,_0x1d74c4['options']);var _0x2828e7={'where':_0x224f0d[_0x9b6a('0x3a')]};return db[_0x9b6a('0x2c')][_0x9b6a('0x1c')](_0x2828e7)[_0x9b6a('0x24')](function(_0x28be93){_0xabfca3['count']=_0x28be93;if(_0x1d74c4[_0x9b6a('0x31')]['includeAll']){_0x224f0d[_0x9b6a('0x3f')]=[{'all':!![]}];}return db[_0x9b6a('0x2c')][_0x9b6a('0x40')](_0x224f0d);})[_0x9b6a('0x24')](function(_0x72cafc){_0xabfca3[_0x9b6a('0x41')]=_0x72cafc;return _0xabfca3;})[_0x9b6a('0x24')](respondWithFilteredResult(_0x2126ae,_0x224f0d))[_0x9b6a('0x42')](handleError(_0x2126ae,null));};exports[_0x9b6a('0x43')]=function(_0x2d209e,_0x5e3961){var _0x4f1373={'raw':![],'where':{'id':_0x2d209e[_0x9b6a('0x44')]['id']}},_0xa84287={};_0xa84287[_0x9b6a('0x30')]=_[_0x9b6a('0x32')](db[_0x9b6a('0x2c')][_0x9b6a('0x2d')]);_0xa84287['query']=_[_0x9b6a('0x32')](_0x2d209e[_0x9b6a('0x31')]);_0xa84287['filters']=_[_0x9b6a('0x33')](_0xa84287['model'],_0xa84287[_0x9b6a('0x31')]);_0x4f1373[_0x9b6a('0x34')]=_[_0x9b6a('0x33')](_0xa84287[_0x9b6a('0x30')],qs['fields'](_0x2d209e[_0x9b6a('0x31')][_0x9b6a('0x35')]));_0x4f1373[_0x9b6a('0x34')]=_0x4f1373[_0x9b6a('0x34')][_0x9b6a('0x36')]?_0x4f1373[_0x9b6a('0x34')]:_0xa84287[_0x9b6a('0x30')];if(_0x2d209e[_0x9b6a('0x31')][_0x9b6a('0x45')]){_0x4f1373[_0x9b6a('0x3f')]=[{'all':!![]}];}_0x4f1373=_['merge']({},_0x4f1373,_0x2d209e[_0x9b6a('0x46')]);return db['VtigerConfiguration']['find'](_0x4f1373)[_0x9b6a('0x24')](handleEntityNotFound(_0x5e3961,null))[_0x9b6a('0x24')](respondWithResult(_0x5e3961,null))[_0x9b6a('0x42')](handleError(_0x5e3961,null));};exports[_0x9b6a('0x47')]=function(_0xfd7295,_0x397bb4){return db[_0x9b6a('0x2c')][_0x9b6a('0x47')](_0xfd7295['body'],{})[_0x9b6a('0x24')](respondWithResult(_0x397bb4,0xc9))[_0x9b6a('0x42')](handleError(_0x397bb4,null));};exports[_0x9b6a('0x23')]=function(_0x540bcb,_0x3037e9){if(_0x540bcb[_0x9b6a('0x48')]['id']){delete _0x540bcb[_0x9b6a('0x48')]['id'];}return db[_0x9b6a('0x2c')][_0x9b6a('0x49')]({'where':{'id':_0x540bcb['params']['id']}})['then'](handleEntityNotFound(_0x3037e9,null))['then'](saveUpdates(_0x540bcb[_0x9b6a('0x48')],null))[_0x9b6a('0x24')](respondWithResult(_0x3037e9,null))[_0x9b6a('0x42')](handleError(_0x3037e9,null));};exports['destroy']=function(_0x4592a7,_0x173990){return db[_0x9b6a('0x2c')]['find']({'where':{'id':_0x4592a7[_0x9b6a('0x44')]['id']}})[_0x9b6a('0x24')](handleEntityNotFound(_0x173990,null))['then'](removeEntity(_0x173990,null))[_0x9b6a('0x42')](handleError(_0x173990,null));};exports['getFields']=function(_0xe0c419,_0x1ba269,_0xbe6dd3){var _0x203f71={};var _0x514afb={};var _0x9c74e4;var _0x38bce9;return db[_0x9b6a('0x2c')][_0x9b6a('0x4a')]({'where':{'id':_0xe0c419[_0x9b6a('0x44')]['id']}})[_0x9b6a('0x24')](handleEntityNotFound(_0x1ba269,null))[_0x9b6a('0x24')](function(_0x505d1f){if(_0x505d1f){_0x9c74e4=_0x505d1f;_0x514afb[_0x9b6a('0x30')]=_[_0x9b6a('0x32')](db['VtigerField']['rawAttributes']);_0x514afb[_0x9b6a('0x31')]=_['keys'](_0xe0c419['query']);_0x514afb['filters']=_[_0x9b6a('0x33')](_0x514afb[_0x9b6a('0x30')],_0x514afb[_0x9b6a('0x31')]);_0x203f71['attributes']=_['intersection'](_0x514afb[_0x9b6a('0x30')],qs[_0x9b6a('0x35')](_0xe0c419[_0x9b6a('0x31')][_0x9b6a('0x35')]));_0x203f71['attributes']=_0x203f71[_0x9b6a('0x34')][_0x9b6a('0x36')]?_0x203f71[_0x9b6a('0x34')]:_0x514afb['model'];_0x203f71[_0x9b6a('0x39')]=qs[_0x9b6a('0x4b')](_0xe0c419[_0x9b6a('0x31')][_0x9b6a('0x4b')]);_0x203f71[_0x9b6a('0x3a')]=qs[_0x9b6a('0x3b')](_['pick'](_0xe0c419[_0x9b6a('0x31')],_0x514afb[_0x9b6a('0x3b')]));if(_0xe0c419[_0x9b6a('0x31')][_0x9b6a('0x3d')]){_0x203f71[_0x9b6a('0x3a')]=_['merge'](_0x203f71[_0x9b6a('0x3a')],{'$or':_['map'](_0x203f71[_0x9b6a('0x34')],function(_0x35a70b){var _0x3492ea={};_0x3492ea[_0x35a70b]={'$like':'%'+_0xe0c419[_0x9b6a('0x31')][_0x9b6a('0x3d')]+'%'};return _0x3492ea;})});}_0x203f71=_[_0x9b6a('0x3e')]({},_0x203f71,_0xe0c419[_0x9b6a('0x46')]);return _0x9c74e4['getFields'](_0x203f71);}})[_0x9b6a('0x24')](function(_0x2ef63d){if(_0x2ef63d){_0x38bce9=_0x2ef63d['length'];if(!_0xe0c419['query'][_0x9b6a('0x37')](_0x9b6a('0x38'))){_0x203f71[_0x9b6a('0x1d')]=qs[_0x9b6a('0x1d')](_0xe0c419[_0x9b6a('0x31')][_0x9b6a('0x1d')]);_0x203f71[_0x9b6a('0x1a')]=qs[_0x9b6a('0x1a')](_0xe0c419[_0x9b6a('0x31')][_0x9b6a('0x1a')]);}return _0x9c74e4[_0x9b6a('0x4c')](_0x203f71);}})[_0x9b6a('0x24')](function(_0x5aaf7c){if(_0x5aaf7c){return _0x5aaf7c?{'count':_0x38bce9,'rows':_0x5aaf7c}:null;}})[_0x9b6a('0x24')](respondWithResult(_0x1ba269,null))[_0x9b6a('0x42')](handleError(_0x1ba269,null));};exports['getSubjects']=function(_0x5787d1,_0x1f8d72,_0x4cf8c0){var _0x5c7483={};var _0x74be08={};var _0x14d4f6;var _0x365e0e;return db[_0x9b6a('0x2c')][_0x9b6a('0x4a')]({'where':{'id':_0x5787d1['params']['id']}})[_0x9b6a('0x24')](handleEntityNotFound(_0x1f8d72,null))['then'](function(_0x31290b){if(_0x31290b){_0x14d4f6=_0x31290b;_0x74be08[_0x9b6a('0x30')]=_['keys'](db['VtigerField'][_0x9b6a('0x2d')]);_0x74be08['query']=_[_0x9b6a('0x32')](_0x5787d1['query']);_0x74be08[_0x9b6a('0x3b')]=_['intersection'](_0x74be08[_0x9b6a('0x30')],_0x74be08[_0x9b6a('0x31')]);_0x5c7483[_0x9b6a('0x34')]=_[_0x9b6a('0x33')](_0x74be08[_0x9b6a('0x30')],qs[_0x9b6a('0x35')](_0x5787d1['query'][_0x9b6a('0x35')]));_0x5c7483[_0x9b6a('0x34')]=_0x5c7483['attributes'][_0x9b6a('0x36')]?_0x5c7483[_0x9b6a('0x34')]:_0x74be08[_0x9b6a('0x30')];_0x5c7483[_0x9b6a('0x39')]=qs[_0x9b6a('0x4b')](_0x5787d1[_0x9b6a('0x31')][_0x9b6a('0x4b')]);_0x5c7483[_0x9b6a('0x3a')]=qs[_0x9b6a('0x3b')](_['pick'](_0x5787d1[_0x9b6a('0x31')],_0x74be08[_0x9b6a('0x3b')]));if(_0x5787d1[_0x9b6a('0x31')][_0x9b6a('0x3d')]){_0x5c7483[_0x9b6a('0x3a')]=_['merge'](_0x5c7483['where'],{'$or':_[_0x9b6a('0x2b')](_0x5c7483[_0x9b6a('0x34')],function(_0x15f378){var _0x1c0ccf={};_0x1c0ccf[_0x15f378]={'$like':'%'+_0x5787d1[_0x9b6a('0x31')][_0x9b6a('0x3d')]+'%'};return _0x1c0ccf;})});}_0x5c7483=_[_0x9b6a('0x3e')]({},_0x5c7483,_0x5787d1[_0x9b6a('0x46')]);return _0x14d4f6[_0x9b6a('0x4d')](_0x5c7483);}})['then'](function(_0x40e113){if(_0x40e113){_0x365e0e=_0x40e113[_0x9b6a('0x36')];if(!_0x5787d1[_0x9b6a('0x31')][_0x9b6a('0x37')]('nolimit')){_0x5c7483[_0x9b6a('0x1d')]=qs[_0x9b6a('0x1d')](_0x5787d1[_0x9b6a('0x31')]['limit']);_0x5c7483[_0x9b6a('0x1a')]=qs[_0x9b6a('0x1a')](_0x5787d1[_0x9b6a('0x31')][_0x9b6a('0x1a')]);}return _0x14d4f6[_0x9b6a('0x4d')](_0x5c7483);}})[_0x9b6a('0x24')](function(_0x3285e9){if(_0x3285e9){return _0x3285e9?{'count':_0x365e0e,'rows':_0x3285e9}:null;}})[_0x9b6a('0x24')](respondWithResult(_0x1f8d72,null))[_0x9b6a('0x42')](handleError(_0x1f8d72,null));};exports['getDescriptions']=function(_0x596296,_0x955c94,_0x162e79){var _0x5b8bf7={};var _0xb3a23f={};var _0x308efd;var _0x57e64a;return db[_0x9b6a('0x2c')]['findOne']({'where':{'id':_0x596296[_0x9b6a('0x44')]['id']}})[_0x9b6a('0x24')](handleEntityNotFound(_0x955c94,null))['then'](function(_0x389149){if(_0x389149){_0x308efd=_0x389149;_0xb3a23f['model']=_['keys'](db[_0x9b6a('0x4e')][_0x9b6a('0x2d')]);_0xb3a23f[_0x9b6a('0x31')]=_[_0x9b6a('0x32')](_0x596296[_0x9b6a('0x31')]);_0xb3a23f[_0x9b6a('0x3b')]=_[_0x9b6a('0x33')](_0xb3a23f[_0x9b6a('0x30')],_0xb3a23f[_0x9b6a('0x31')]);_0x5b8bf7[_0x9b6a('0x34')]=_[_0x9b6a('0x33')](_0xb3a23f[_0x9b6a('0x30')],qs['fields'](_0x596296[_0x9b6a('0x31')][_0x9b6a('0x35')]));_0x5b8bf7[_0x9b6a('0x34')]=_0x5b8bf7[_0x9b6a('0x34')][_0x9b6a('0x36')]?_0x5b8bf7['attributes']:_0xb3a23f['model'];_0x5b8bf7[_0x9b6a('0x39')]=qs[_0x9b6a('0x4b')](_0x596296['query'][_0x9b6a('0x4b')]);_0x5b8bf7[_0x9b6a('0x3a')]=qs[_0x9b6a('0x3b')](_[_0x9b6a('0x3c')](_0x596296[_0x9b6a('0x31')],_0xb3a23f[_0x9b6a('0x3b')]));if(_0x596296['query'][_0x9b6a('0x3d')]){_0x5b8bf7[_0x9b6a('0x3a')]=_[_0x9b6a('0x3e')](_0x5b8bf7[_0x9b6a('0x3a')],{'$or':_['map'](_0x5b8bf7[_0x9b6a('0x34')],function(_0xb0a38b){var _0x50ce05={};_0x50ce05[_0xb0a38b]={'$like':'%'+_0x596296[_0x9b6a('0x31')]['filter']+'%'};return _0x50ce05;})});}_0x5b8bf7=_[_0x9b6a('0x3e')]({},_0x5b8bf7,_0x596296[_0x9b6a('0x46')]);return _0x308efd[_0x9b6a('0x4f')](_0x5b8bf7);}})[_0x9b6a('0x24')](function(_0xa9c015){if(_0xa9c015){_0x57e64a=_0xa9c015[_0x9b6a('0x36')];if(!_0x596296[_0x9b6a('0x31')][_0x9b6a('0x37')]('nolimit')){_0x5b8bf7[_0x9b6a('0x1d')]=qs[_0x9b6a('0x1d')](_0x596296[_0x9b6a('0x31')][_0x9b6a('0x1d')]);_0x5b8bf7[_0x9b6a('0x1a')]=qs[_0x9b6a('0x1a')](_0x596296[_0x9b6a('0x31')]['offset']);}return _0x308efd[_0x9b6a('0x4f')](_0x5b8bf7);}})['then'](function(_0x2f2671){if(_0x2f2671){return _0x2f2671?{'count':_0x57e64a,'rows':_0x2f2671}:null;}})[_0x9b6a('0x24')](respondWithResult(_0x955c94,null))[_0x9b6a('0x42')](handleError(_0x955c94,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 652b2a9..4750684 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 _0x88ec=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','VtigerConfiguration','int_vtiger_configurations','lodash'];(function(_0x2d4080,_0x340d7a){var _0x474afe=function(_0x11bf4d){while(--_0x11bf4d){_0x2d4080['push'](_0x2d4080['shift']());}};_0x474afe(++_0x340d7a);}(_0x88ec,0x1c6));var _0xc88e=function(_0x2f1c82,_0x549d2e){_0x2f1c82=_0x2f1c82-0x0;var _0x2ffa52=_0x88ec[_0x2f1c82];return _0x2ffa52;};'use strict';var _=require(_0xc88e('0x0'));var util=require(_0xc88e('0x1'));var logger=require(_0xc88e('0x2'))(_0xc88e('0x3'));var moment=require(_0xc88e('0x4'));var BPromise=require(_0xc88e('0x5'));var rp=require(_0xc88e('0x6'));var fs=require('fs');var path=require(_0xc88e('0x7'));var rimraf=require(_0xc88e('0x8'));var config=require(_0xc88e('0x9'));var attributes=require(_0xc88e('0xa'));module['exports']=function(_0x13e4a4,_0x9ccd56){return _0x13e4a4['define'](_0xc88e('0xb'),attributes,{'tableName':_0xc88e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1bd3=['VtigerConfiguration','int_vtiger_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','exports','define'];(function(_0x4ac824,_0x438cf8){var _0x46be3c=function(_0x7c3a9d){while(--_0x7c3a9d){_0x4ac824['push'](_0x4ac824['shift']());}};_0x46be3c(++_0x438cf8);}(_0x1bd3,0x141));var _0x31bd=function(_0x4b8e99,_0x5177bf){_0x4b8e99=_0x4b8e99-0x0;var _0x2f96ca=_0x1bd3[_0x4b8e99];return _0x2f96ca;};'use strict';var _=require(_0x31bd('0x0'));var util=require('util');var logger=require(_0x31bd('0x1'))(_0x31bd('0x2'));var moment=require(_0x31bd('0x3'));var BPromise=require(_0x31bd('0x4'));var rp=require(_0x31bd('0x5'));var fs=require('fs');var path=require(_0x31bd('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module[_0x31bd('0x7')]=function(_0x12182d,_0x57c338){return _0x12182d[_0x31bd('0x8')](_0x31bd('0x9'),attributes,{'tableName':_0x31bd('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 155a25d..5fa512d 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 _0xdcce=['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/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent'];(function(_0x78a7f8,_0x55bafd){var _0x132e7c=function(_0x57d9d8){while(--_0x57d9d8){_0x78a7f8['push'](_0x78a7f8['shift']());}};_0x132e7c(++_0x55bafd);}(_0xdcce,0x140));var _0xedcc=function(_0x9eaf72,_0x4455b0){_0x9eaf72=_0x9eaf72-0x0;var _0x115600=_0xdcce[_0x9eaf72];return _0x115600;};'use strict';var _=require(_0xedcc('0x0'));var util=require(_0xedcc('0x1'));var moment=require(_0xedcc('0x2'));var BPromise=require(_0xedcc('0x3'));var rs=require(_0xedcc('0x4'));var fs=require('fs');var Redis=require(_0xedcc('0x5'));var db=require(_0xedcc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xedcc('0x7'))(_0xedcc('0x8'));var config=require(_0xedcc('0x9'));var jayson=require(_0xedcc('0xa'));var client=jayson[_0xedcc('0xb')][_0xedcc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1b5a74,_0x1ebefc,_0x140372){return new BPromise(function(_0x36b860,_0x2b4539){return client[_0xedcc('0xd')](_0x1b5a74,_0x140372)['then'](function(_0x3e45cb){logger[_0xedcc('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x1ebefc,_0xedcc('0xf'));logger['debug'](_0xedcc('0x10'),_0x1ebefc,_0xedcc('0xf'),JSON[_0xedcc('0x11')](_0x3e45cb));if(_0x3e45cb[_0xedcc('0x12')]){if(_0x3e45cb['error'][_0xedcc('0x13')]===0x1f4){logger[_0xedcc('0x12')](_0xedcc('0x14'),_0x1ebefc,_0x3e45cb[_0xedcc('0x12')][_0xedcc('0x15')]);return _0x2b4539(_0x3e45cb[_0xedcc('0x12')][_0xedcc('0x15')]);}logger[_0xedcc('0x12')](_0xedcc('0x14'),_0x1ebefc,_0x3e45cb[_0xedcc('0x12')][_0xedcc('0x15')]);return _0x36b860(_0x3e45cb[_0xedcc('0x12')][_0xedcc('0x15')]);}else{logger[_0xedcc('0xe')](_0xedcc('0x14'),_0x1ebefc,_0xedcc('0xf'));_0x36b860(_0x3e45cb[_0xedcc('0x16')][_0xedcc('0x15')]);}})[_0xedcc('0x17')](function(_0x5e88ff){logger[_0xedcc('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x1ebefc,_0x5e88ff);_0x2b4539(_0x5e88ff);});});} \ No newline at end of file +var _0xa64a=['error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x590766,_0x26a057){var _0x4e2f10=function(_0x5d96a4){while(--_0x5d96a4){_0x590766['push'](_0x590766['shift']());}};_0x4e2f10(++_0x26a057);}(_0xa64a,0xd3));var _0xaa64=function(_0x332d2e,_0x40d0e0){_0x332d2e=_0x332d2e-0x0;var _0x301d23=_0xa64a[_0x332d2e];return _0x301d23;};'use strict';var _=require(_0xaa64('0x0'));var util=require(_0xaa64('0x1'));var moment=require(_0xaa64('0x2'));var BPromise=require(_0xaa64('0x3'));var rs=require(_0xaa64('0x4'));var fs=require('fs');var Redis=require(_0xaa64('0x5'));var db=require(_0xaa64('0x6'))['db'];var utils=require(_0xaa64('0x7'));var logger=require(_0xaa64('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xaa64('0x9'));var client=jayson[_0xaa64('0xa')][_0xaa64('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ccc05,_0x17a904,_0x5b9666){return new BPromise(function(_0xe6f435,_0x4898f2){return client[_0xaa64('0xc')](_0x1ccc05,_0x5b9666)[_0xaa64('0xd')](function(_0x4c1488){logger[_0xaa64('0xe')](_0xaa64('0xf'),_0x17a904,'request\x20sent');logger[_0xaa64('0x10')](_0xaa64('0x11'),_0x17a904,_0xaa64('0x12'),JSON['stringify'](_0x4c1488));if(_0x4c1488[_0xaa64('0x13')]){if(_0x4c1488['error'][_0xaa64('0x14')]===0x1f4){logger[_0xaa64('0x13')](_0xaa64('0xf'),_0x17a904,_0x4c1488[_0xaa64('0x13')][_0xaa64('0x15')]);return _0x4898f2(_0x4c1488['error'][_0xaa64('0x15')]);}logger[_0xaa64('0x13')](_0xaa64('0xf'),_0x17a904,_0x4c1488[_0xaa64('0x13')][_0xaa64('0x15')]);return _0xe6f435(_0x4c1488['error'][_0xaa64('0x15')]);}else{logger[_0xaa64('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x17a904,_0xaa64('0x12'));_0xe6f435(_0x4c1488[_0xaa64('0x16')][_0xaa64('0x15')]);}})['catch'](function(_0x4429f8){logger[_0xaa64('0x13')](_0xaa64('0xf'),_0x17a904,_0x4429f8);_0x4898f2(_0x4429f8);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 775ee25..86528d3 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 _0x900e=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x900e,0x151));var _0xe900=function(_0x236470,_0x752a84){_0x236470=_0x236470-0x0;var _0x2b858d=_0x900e[_0x236470];return _0x2b858d;};'use strict';var multer=require(_0xe900('0x0'));var util=require(_0xe900('0x1'));var path=require(_0xe900('0x2'));var timeout=require(_0xe900('0x3'));var express=require('express');var router=express[_0xe900('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe900('0x5'));var interaction=require(_0xe900('0x6'));var config=require(_0xe900('0x7'));var controller=require('./intVtigerField.controller');router[_0xe900('0x8')]('/',auth['isAuthenticated'](),controller[_0xe900('0x9')]);router['get']('/:id',auth[_0xe900('0xa')](),controller[_0xe900('0xb')]);router[_0xe900('0xc')]('/',auth[_0xe900('0xa')](),controller[_0xe900('0xd')]);router[_0xe900('0xe')](_0xe900('0xf'),auth[_0xe900('0xa')](),controller[_0xe900('0x10')]);router[_0xe900('0x11')](_0xe900('0xf'),auth[_0xe900('0xa')](),controller[_0xe900('0x12')]);module[_0xe900('0x13')]=router; \ No newline at end of file +var _0x2083=['Router','fs-extra','../../components/auth/service','./intVtigerField.controller','get','index','isAuthenticated','show','create','/:id','update','multer','util','path','connect-timeout','express'];(function(_0x1203b5,_0x35ad5f){var _0x1e3a8d=function(_0x146289){while(--_0x146289){_0x1203b5['push'](_0x1203b5['shift']());}};_0x1e3a8d(++_0x35ad5f);}(_0x2083,0x13b));var _0x3208=function(_0xc082d1,_0x21c3f4){_0xc082d1=_0xc082d1-0x0;var _0x51e4a6=_0x2083[_0xc082d1];return _0x51e4a6;};'use strict';var multer=require(_0x3208('0x0'));var util=require(_0x3208('0x1'));var path=require(_0x3208('0x2'));var timeout=require(_0x3208('0x3'));var express=require(_0x3208('0x4'));var router=express[_0x3208('0x5')]();var fs_extra=require(_0x3208('0x6'));var auth=require(_0x3208('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3208('0x8'));router[_0x3208('0x9')]('/',auth['isAuthenticated'](),controller[_0x3208('0xa')]);router['get']('/:id',auth[_0x3208('0xb')](),controller[_0x3208('0xc')]);router['post']('/',auth[_0x3208('0xb')](),controller[_0x3208('0xd')]);router['put'](_0x3208('0xe'),auth[_0x3208('0xb')](),controller[_0x3208('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 6c7fb81..706adb2 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 _0xdf2e=['sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','STRING','string'];(function(_0x3ede55,_0x5cdf58){var _0xd1894b=function(_0x3ebb9c){while(--_0x3ebb9c){_0x3ede55['push'](_0x3ede55['shift']());}};_0xd1894b(++_0x5cdf58);}(_0xdf2e,0xbd));var _0xedf2=function(_0x3311ae,_0x362cee){_0x3311ae=_0x3311ae-0x0;var _0x107949=_0xdf2e[_0x3311ae];return _0x107949;};'use strict';var Sequelize=require(_0xedf2('0x0'));module[_0xedf2('0x1')]={'type':{'type':Sequelize[_0xedf2('0x2')]('string',_0xedf2('0x3'),_0xedf2('0x4'),_0xedf2('0x5'),_0xedf2('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xedf2('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xedf2('0x2')](_0xedf2('0x8'),'variable',_0xedf2('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xedf2('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xedf2('0x7')]}}; \ No newline at end of file +var _0x87b8=['STRING','BOOLEAN','sequelize','exports','string','customVariable','keyValue','ENUM','variable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x87b8,0x107));var _0x887b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x87b8[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x887b('0x0'));module[_0x887b('0x1')]={'type':{'type':Sequelize['ENUM'](_0x887b('0x2'),'variable',_0x887b('0x3'),_0x887b('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x887b('0x5')]('string',_0x887b('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x887b('0x7')]},'idField':{'type':Sequelize[_0x887b('0x7')]},'nameField':{'type':Sequelize[_0x887b('0x7')]},'customField':{'type':Sequelize[_0x887b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x887b('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index f685cf6..ad0a7f3 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 _0x1e62=['index','map','VtigerField','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','end','error','stack','name'];(function(_0xbd458f,_0x2bc521){var _0x215db0=function(_0x41d4db){while(--_0x41d4db){_0xbd458f['push'](_0xbd458f['shift']());}};_0x215db0(++_0x2bc521);}(_0x1e62,0xba));var _0x21e6=function(_0x5aa181,_0x12b4ca){_0x5aa181=_0x5aa181-0x0;var _0x5a6b54=_0x1e62[_0x5aa181];return _0x5a6b54;};'use strict';var emlformat=require(_0x21e6('0x0'));var rimraf=require(_0x21e6('0x1'));var zipdir=require(_0x21e6('0x2'));var jsonpatch=require(_0x21e6('0x3'));var rp=require(_0x21e6('0x4'));var moment=require(_0x21e6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x21e6('0x6'));var util=require(_0x21e6('0x7'));var path=require(_0x21e6('0x8'));var sox=require(_0x21e6('0x9'));var csv=require(_0x21e6('0xa'));var ejs=require(_0x21e6('0xb'));var fs=require('fs');var fs_extra=require(_0x21e6('0xc'));var _=require(_0x21e6('0xd'));var squel=require(_0x21e6('0xe'));var crypto=require(_0x21e6('0xf'));var jsforce=require(_0x21e6('0x10'));var deskjs=require(_0x21e6('0x11'));var toCsv=require(_0x21e6('0xa'));var querystring=require('querystring');var Papa=require(_0x21e6('0x12'));var Redis=require(_0x21e6('0x13'));var authService=require(_0x21e6('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x21e6('0x15'));var hardwareService=require(_0x21e6('0x16'));var logger=require('../../config/logger')(_0x21e6('0x17'));var utils=require(_0x21e6('0x18'));var config=require(_0x21e6('0x19'));var licenseUtil=require(_0x21e6('0x1a'));var db=require(_0x21e6('0x1b'))['db'];function respondWithStatusCode(_0x2066e1,_0x1f31da){_0x1f31da=_0x1f31da||0xcc;return function(_0x300916){if(_0x300916){return _0x2066e1[_0x21e6('0x1c')](_0x1f31da);}return _0x2066e1[_0x21e6('0x1d')](_0x1f31da)['end']();};}function respondWithResult(_0x148e80,_0x58192a){_0x58192a=_0x58192a||0xc8;return function(_0x2aeac1){if(_0x2aeac1){return _0x148e80[_0x21e6('0x1d')](_0x58192a)[_0x21e6('0x1e')](_0x2aeac1);}};}function respondWithFilteredResult(_0x27510e,_0x5ad25a){return function(_0x26fafa){if(_0x26fafa){var _0xb4e3ea=typeof _0x5ad25a[_0x21e6('0x1f')]===_0x21e6('0x20')&&typeof _0x5ad25a[_0x21e6('0x21')]==='undefined';var _0x111d62=_0x26fafa[_0x21e6('0x22')];var _0x53460e=_0xb4e3ea?0x0:_0x5ad25a['offset'];var _0x57920d=_0xb4e3ea?_0x26fafa['count']:_0x5ad25a[_0x21e6('0x1f')]+_0x5ad25a['limit'];var _0xd52c9c;if(_0x57920d>=_0x111d62){_0x57920d=_0x111d62;_0xd52c9c=0xc8;}else{_0xd52c9c=0xce;}_0x27510e[_0x21e6('0x1d')](_0xd52c9c);return _0x27510e[_0x21e6('0x23')]('Content-Range',_0x53460e+'-'+_0x57920d+'/'+_0x111d62)['json'](_0x26fafa);}return null;};}function patchUpdates(_0x3f8a50){return function(_0x6afdf1){try{jsonpatch[_0x21e6('0x24')](_0x6afdf1,_0x3f8a50,!![]);}catch(_0x577047){return BPromise[_0x21e6('0x25')](_0x577047);}return _0x6afdf1[_0x21e6('0x26')]();};}function saveUpdates(_0x1475a9,_0x3275b9){return function(_0xbdf74d){if(_0xbdf74d){return _0xbdf74d['update'](_0x1475a9)[_0x21e6('0x27')](function(_0x32fd08){return _0x32fd08;});}return null;};}function removeEntity(_0x187c33,_0x40b3f3){return function(_0x1326a6){if(_0x1326a6){return _0x1326a6[_0x21e6('0x28')]()[_0x21e6('0x27')](function(){_0x187c33[_0x21e6('0x1d')](0xcc)[_0x21e6('0x29')]();});}};}function handleEntityNotFound(_0x473639,_0x2814f0){return function(_0x43f668){if(!_0x43f668){_0x473639[_0x21e6('0x1c')](0x194);}return _0x43f668;};}function handleError(_0x4dfa09,_0x33004d){_0x33004d=_0x33004d||0x1f4;return function(_0x4e46a6){logger[_0x21e6('0x2a')](_0x4e46a6[_0x21e6('0x2b')]);if(_0x4e46a6[_0x21e6('0x2c')]){delete _0x4e46a6[_0x21e6('0x2c')];}_0x4dfa09[_0x21e6('0x1d')](_0x33004d)['send'](_0x4e46a6);};}exports[_0x21e6('0x2d')]=function(_0x1b02df,_0x3b419a){var _0x351e1c={},_0x20532c={},_0x987604={'count':0x0,'rows':[]};var _0x5732e4=_[_0x21e6('0x2e')](db[_0x21e6('0x2f')][_0x21e6('0x30')],function(_0x187e34){return{'name':_0x187e34['fieldName'],'type':_0x187e34[_0x21e6('0x31')]['key']};});_0x20532c[_0x21e6('0x32')]=_[_0x21e6('0x2e')](_0x5732e4,'name');_0x20532c[_0x21e6('0x33')]=_[_0x21e6('0x34')](_0x1b02df[_0x21e6('0x33')]);_0x20532c[_0x21e6('0x35')]=_[_0x21e6('0x36')](_0x20532c[_0x21e6('0x32')],_0x20532c[_0x21e6('0x33')]);_0x351e1c[_0x21e6('0x37')]=_[_0x21e6('0x36')](_0x20532c[_0x21e6('0x32')],qs[_0x21e6('0x38')](_0x1b02df['query'][_0x21e6('0x38')]));_0x351e1c[_0x21e6('0x37')]=_0x351e1c[_0x21e6('0x37')][_0x21e6('0x39')]?_0x351e1c[_0x21e6('0x37')]:_0x20532c[_0x21e6('0x32')];if(!_0x1b02df[_0x21e6('0x33')][_0x21e6('0x3a')](_0x21e6('0x3b'))){_0x351e1c[_0x21e6('0x21')]=qs[_0x21e6('0x21')](_0x1b02df['query'][_0x21e6('0x21')]);_0x351e1c[_0x21e6('0x1f')]=qs['offset'](_0x1b02df[_0x21e6('0x33')][_0x21e6('0x1f')]);}_0x351e1c[_0x21e6('0x3c')]=qs[_0x21e6('0x3d')](_0x1b02df[_0x21e6('0x33')][_0x21e6('0x3d')]);_0x351e1c[_0x21e6('0x3e')]=qs[_0x21e6('0x35')](_[_0x21e6('0x3f')](_0x1b02df[_0x21e6('0x33')],_0x20532c[_0x21e6('0x35')]),_0x5732e4);if(_0x1b02df[_0x21e6('0x33')][_0x21e6('0x40')]){_0x351e1c[_0x21e6('0x3e')]=_[_0x21e6('0x41')](_0x351e1c[_0x21e6('0x3e')],{'$or':_[_0x21e6('0x2e')](_0x5732e4,function(_0x2c7b6a){if(_0x2c7b6a[_0x21e6('0x31')]!==_0x21e6('0x42')){var _0x565c20={};_0x565c20[_0x2c7b6a[_0x21e6('0x2c')]]={'$like':'%'+_0x1b02df['query'][_0x21e6('0x40')]+'%'};return _0x565c20;}})});}_0x351e1c=_['merge']({},_0x351e1c,_0x1b02df[_0x21e6('0x43')]);var _0xbb2d4e={'where':_0x351e1c[_0x21e6('0x3e')]};return db['VtigerField']['count'](_0xbb2d4e)[_0x21e6('0x27')](function(_0x99ddc){_0x987604[_0x21e6('0x22')]=_0x99ddc;if(_0x1b02df['query']['includeAll']){_0x351e1c[_0x21e6('0x44')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x351e1c);})[_0x21e6('0x27')](function(_0x138820){_0x987604['rows']=_0x138820;return _0x987604;})[_0x21e6('0x27')](respondWithFilteredResult(_0x3b419a,_0x351e1c))[_0x21e6('0x45')](handleError(_0x3b419a,null));};exports[_0x21e6('0x46')]=function(_0x4d7112,_0x4a41ee){var _0xb682de={'raw':!![],'where':{'id':_0x4d7112[_0x21e6('0x47')]['id']}},_0x473471={};_0x473471[_0x21e6('0x32')]=_['keys'](db['VtigerField']['rawAttributes']);_0x473471[_0x21e6('0x33')]=_[_0x21e6('0x34')](_0x4d7112[_0x21e6('0x33')]);_0x473471[_0x21e6('0x35')]=_[_0x21e6('0x36')](_0x473471[_0x21e6('0x32')],_0x473471[_0x21e6('0x33')]);_0xb682de['attributes']=_[_0x21e6('0x36')](_0x473471[_0x21e6('0x32')],qs['fields'](_0x4d7112[_0x21e6('0x33')][_0x21e6('0x38')]));_0xb682de[_0x21e6('0x37')]=_0xb682de[_0x21e6('0x37')][_0x21e6('0x39')]?_0xb682de['attributes']:_0x473471[_0x21e6('0x32')];if(_0x4d7112[_0x21e6('0x33')][_0x21e6('0x48')]){_0xb682de[_0x21e6('0x44')]=[{'all':!![]}];}_0xb682de=_[_0x21e6('0x41')]({},_0xb682de,_0x4d7112[_0x21e6('0x43')]);return db[_0x21e6('0x2f')]['find'](_0xb682de)['then'](handleEntityNotFound(_0x4a41ee,null))['then'](respondWithResult(_0x4a41ee,null))[_0x21e6('0x45')](handleError(_0x4a41ee,null));};exports[_0x21e6('0x49')]=function(_0x3d2ca5,_0x1cd10b){return db[_0x21e6('0x2f')][_0x21e6('0x49')](_0x3d2ca5[_0x21e6('0x4a')],{})['then'](respondWithResult(_0x1cd10b,0xc9))[_0x21e6('0x45')](handleError(_0x1cd10b,null));};exports[_0x21e6('0x4b')]=function(_0x3ee5cc,_0x269f29){if(_0x3ee5cc[_0x21e6('0x4a')]['id']){delete _0x3ee5cc[_0x21e6('0x4a')]['id'];}return db['VtigerField'][_0x21e6('0x4c')]({'where':{'id':_0x3ee5cc[_0x21e6('0x47')]['id']}})['then'](handleEntityNotFound(_0x269f29,null))[_0x21e6('0x27')](saveUpdates(_0x3ee5cc[_0x21e6('0x4a')],null))[_0x21e6('0x27')](respondWithResult(_0x269f29,null))[_0x21e6('0x45')](handleError(_0x269f29,null));};exports[_0x21e6('0x28')]=function(_0x2ea43c,_0x5caf79){return db[_0x21e6('0x2f')]['find']({'where':{'id':_0x2ea43c[_0x21e6('0x47')]['id']}})[_0x21e6('0x27')](handleEntityNotFound(_0x5caf79,null))[_0x21e6('0x27')](removeEntity(_0x5caf79,null))[_0x21e6('0x45')](handleError(_0x5caf79,null));}; \ No newline at end of file +var _0xd0b2=['destroy','sendStatus','error','stack','send','index','map','VtigerField','rawAttributes','fieldName','type','name','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','create','body','find','eml-format','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then'];(function(_0x593564,_0x43583f){var _0x211a89=function(_0x40afd6){while(--_0x40afd6){_0x593564['push'](_0x593564['shift']());}};_0x211a89(++_0x43583f);}(_0xd0b2,0x140));var _0x2d0b=function(_0x31db1a,_0x4b25a5){_0x31db1a=_0x31db1a-0x0;var _0x15dcb3=_0xd0b2[_0x31db1a];return _0x15dcb3;};'use strict';var emlformat=require(_0x2d0b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2d0b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2d0b('0x2'));var BPromise=require(_0x2d0b('0x3'));var Mustache=require(_0x2d0b('0x4'));var util=require(_0x2d0b('0x5'));var path=require(_0x2d0b('0x6'));var sox=require('sox');var csv=require(_0x2d0b('0x7'));var ejs=require(_0x2d0b('0x8'));var fs=require('fs');var fs_extra=require(_0x2d0b('0x9'));var _=require(_0x2d0b('0xa'));var squel=require('squel');var crypto=require(_0x2d0b('0xb'));var jsforce=require(_0x2d0b('0xc'));var deskjs=require(_0x2d0b('0xd'));var toCsv=require(_0x2d0b('0x7'));var querystring=require(_0x2d0b('0xe'));var Papa=require('papaparse');var Redis=require(_0x2d0b('0xf'));var authService=require(_0x2d0b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2d0b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2d0b('0x12'))(_0x2d0b('0x13'));var utils=require(_0x2d0b('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2d0b('0x15'))['db'];function respondWithStatusCode(_0x4c51ea,_0x25f6b7){_0x25f6b7=_0x25f6b7||0xcc;return function(_0x209394){if(_0x209394){return _0x4c51ea['sendStatus'](_0x25f6b7);}return _0x4c51ea[_0x2d0b('0x16')](_0x25f6b7)[_0x2d0b('0x17')]();};}function respondWithResult(_0x146504,_0x4ecdd7){_0x4ecdd7=_0x4ecdd7||0xc8;return function(_0x5ec355){if(_0x5ec355){return _0x146504['status'](_0x4ecdd7)[_0x2d0b('0x18')](_0x5ec355);}};}function respondWithFilteredResult(_0xe537f,_0x279bc8){return function(_0x22403c){if(_0x22403c){var _0xf86512=typeof _0x279bc8[_0x2d0b('0x19')]===_0x2d0b('0x1a')&&typeof _0x279bc8[_0x2d0b('0x1b')]===_0x2d0b('0x1a');var _0x4bfd8d=_0x22403c[_0x2d0b('0x1c')];var _0x22b6ce=_0xf86512?0x0:_0x279bc8[_0x2d0b('0x19')];var _0x3d3ba7=_0xf86512?_0x22403c['count']:_0x279bc8[_0x2d0b('0x19')]+_0x279bc8['limit'];var _0x41a1e4;if(_0x3d3ba7>=_0x4bfd8d){_0x3d3ba7=_0x4bfd8d;_0x41a1e4=0xc8;}else{_0x41a1e4=0xce;}_0xe537f[_0x2d0b('0x16')](_0x41a1e4);return _0xe537f[_0x2d0b('0x1d')](_0x2d0b('0x1e'),_0x22b6ce+'-'+_0x3d3ba7+'/'+_0x4bfd8d)[_0x2d0b('0x18')](_0x22403c);}return null;};}function patchUpdates(_0x49faf5){return function(_0xb8e78a){try{jsonpatch[_0x2d0b('0x1f')](_0xb8e78a,_0x49faf5,!![]);}catch(_0x3e82ae){return BPromise['reject'](_0x3e82ae);}return _0xb8e78a[_0x2d0b('0x20')]();};}function saveUpdates(_0x13eb8a,_0x24f5a4){return function(_0xf6818c){if(_0xf6818c){return _0xf6818c[_0x2d0b('0x21')](_0x13eb8a)[_0x2d0b('0x22')](function(_0x387aa9){return _0x387aa9;});}return null;};}function removeEntity(_0x7a1b6a,_0x5b85e6){return function(_0x571535){if(_0x571535){return _0x571535[_0x2d0b('0x23')]()[_0x2d0b('0x22')](function(){_0x7a1b6a[_0x2d0b('0x16')](0xcc)[_0x2d0b('0x17')]();});}};}function handleEntityNotFound(_0x516998,_0x1944f7){return function(_0x5ebaca){if(!_0x5ebaca){_0x516998[_0x2d0b('0x24')](0x194);}return _0x5ebaca;};}function handleError(_0x1f63d4,_0xa8c8cd){_0xa8c8cd=_0xa8c8cd||0x1f4;return function(_0x5acf1a){logger[_0x2d0b('0x25')](_0x5acf1a[_0x2d0b('0x26')]);if(_0x5acf1a['name']){delete _0x5acf1a['name'];}_0x1f63d4['status'](_0xa8c8cd)[_0x2d0b('0x27')](_0x5acf1a);};}exports[_0x2d0b('0x28')]=function(_0xd8cd42,_0x9e8956){var _0x2c398f={},_0x6e4cd3={},_0x2fa6a6={'count':0x0,'rows':[]};var _0x5f0bdd=_[_0x2d0b('0x29')](db[_0x2d0b('0x2a')][_0x2d0b('0x2b')],function(_0x30a169){return{'name':_0x30a169[_0x2d0b('0x2c')],'type':_0x30a169[_0x2d0b('0x2d')]['key']};});_0x6e4cd3['model']=_[_0x2d0b('0x29')](_0x5f0bdd,_0x2d0b('0x2e'));_0x6e4cd3[_0x2d0b('0x2f')]=_['keys'](_0xd8cd42[_0x2d0b('0x2f')]);_0x6e4cd3[_0x2d0b('0x30')]=_[_0x2d0b('0x31')](_0x6e4cd3[_0x2d0b('0x32')],_0x6e4cd3['query']);_0x2c398f['attributes']=_['intersection'](_0x6e4cd3['model'],qs[_0x2d0b('0x33')](_0xd8cd42[_0x2d0b('0x2f')][_0x2d0b('0x33')]));_0x2c398f[_0x2d0b('0x34')]=_0x2c398f[_0x2d0b('0x34')][_0x2d0b('0x35')]?_0x2c398f[_0x2d0b('0x34')]:_0x6e4cd3[_0x2d0b('0x32')];if(!_0xd8cd42[_0x2d0b('0x2f')][_0x2d0b('0x36')](_0x2d0b('0x37'))){_0x2c398f[_0x2d0b('0x1b')]=qs[_0x2d0b('0x1b')](_0xd8cd42[_0x2d0b('0x2f')][_0x2d0b('0x1b')]);_0x2c398f[_0x2d0b('0x19')]=qs[_0x2d0b('0x19')](_0xd8cd42['query'][_0x2d0b('0x19')]);}_0x2c398f['order']=qs[_0x2d0b('0x38')](_0xd8cd42['query'][_0x2d0b('0x38')]);_0x2c398f[_0x2d0b('0x39')]=qs[_0x2d0b('0x30')](_['pick'](_0xd8cd42[_0x2d0b('0x2f')],_0x6e4cd3[_0x2d0b('0x30')]),_0x5f0bdd);if(_0xd8cd42[_0x2d0b('0x2f')][_0x2d0b('0x3a')]){_0x2c398f[_0x2d0b('0x39')]=_[_0x2d0b('0x3b')](_0x2c398f[_0x2d0b('0x39')],{'$or':_[_0x2d0b('0x29')](_0x5f0bdd,function(_0x36a27f){if(_0x36a27f[_0x2d0b('0x2d')]!==_0x2d0b('0x3c')){var _0x314dba={};_0x314dba[_0x36a27f[_0x2d0b('0x2e')]]={'$like':'%'+_0xd8cd42['query'][_0x2d0b('0x3a')]+'%'};return _0x314dba;}})});}_0x2c398f=_[_0x2d0b('0x3b')]({},_0x2c398f,_0xd8cd42[_0x2d0b('0x3d')]);var _0x24bfdd={'where':_0x2c398f['where']};return db['VtigerField'][_0x2d0b('0x1c')](_0x24bfdd)[_0x2d0b('0x22')](function(_0xfb7e69){_0x2fa6a6['count']=_0xfb7e69;if(_0xd8cd42[_0x2d0b('0x2f')][_0x2d0b('0x3e')]){_0x2c398f[_0x2d0b('0x3f')]=[{'all':!![]}];}return db['VtigerField'][_0x2d0b('0x40')](_0x2c398f);})[_0x2d0b('0x22')](function(_0x20a5d9){_0x2fa6a6['rows']=_0x20a5d9;return _0x2fa6a6;})['then'](respondWithFilteredResult(_0x9e8956,_0x2c398f))[_0x2d0b('0x41')](handleError(_0x9e8956,null));};exports['show']=function(_0x599552,_0x44e145){var _0x2b98c4={'raw':!![],'where':{'id':_0x599552[_0x2d0b('0x42')]['id']}},_0x3d5be3={};_0x3d5be3['model']=_[_0x2d0b('0x43')](db[_0x2d0b('0x2a')][_0x2d0b('0x2b')]);_0x3d5be3[_0x2d0b('0x2f')]=_[_0x2d0b('0x43')](_0x599552[_0x2d0b('0x2f')]);_0x3d5be3['filters']=_[_0x2d0b('0x31')](_0x3d5be3[_0x2d0b('0x32')],_0x3d5be3[_0x2d0b('0x2f')]);_0x2b98c4[_0x2d0b('0x34')]=_['intersection'](_0x3d5be3[_0x2d0b('0x32')],qs['fields'](_0x599552[_0x2d0b('0x2f')]['fields']));_0x2b98c4[_0x2d0b('0x34')]=_0x2b98c4[_0x2d0b('0x34')][_0x2d0b('0x35')]?_0x2b98c4[_0x2d0b('0x34')]:_0x3d5be3[_0x2d0b('0x32')];if(_0x599552[_0x2d0b('0x2f')]['includeAll']){_0x2b98c4[_0x2d0b('0x3f')]=[{'all':!![]}];}_0x2b98c4=_['merge']({},_0x2b98c4,_0x599552[_0x2d0b('0x3d')]);return db[_0x2d0b('0x2a')]['find'](_0x2b98c4)['then'](handleEntityNotFound(_0x44e145,null))[_0x2d0b('0x22')](respondWithResult(_0x44e145,null))[_0x2d0b('0x41')](handleError(_0x44e145,null));};exports[_0x2d0b('0x44')]=function(_0x4576ba,_0x45fba3){return db['VtigerField']['create'](_0x4576ba['body'],{})[_0x2d0b('0x22')](respondWithResult(_0x45fba3,0xc9))[_0x2d0b('0x41')](handleError(_0x45fba3,null));};exports[_0x2d0b('0x21')]=function(_0x116204,_0x5ea2bb){if(_0x116204[_0x2d0b('0x45')]['id']){delete _0x116204[_0x2d0b('0x45')]['id'];}return db[_0x2d0b('0x2a')][_0x2d0b('0x46')]({'where':{'id':_0x116204[_0x2d0b('0x42')]['id']}})['then'](handleEntityNotFound(_0x5ea2bb,null))[_0x2d0b('0x22')](saveUpdates(_0x116204['body'],null))[_0x2d0b('0x22')](respondWithResult(_0x5ea2bb,null))[_0x2d0b('0x41')](handleError(_0x5ea2bb,null));};exports[_0x2d0b('0x23')]=function(_0xc11b9d,_0x301ae8){return db[_0x2d0b('0x2a')]['find']({'where':{'id':_0xc11b9d['params']['id']}})[_0x2d0b('0x22')](handleEntityNotFound(_0x301ae8,null))[_0x2d0b('0x22')](removeEntity(_0x301ae8,null))['catch'](handleError(_0x301ae8,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 884f29a..d1041f6 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 _0x9919=['int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intVtigerField.attributes','exports','define','VtigerField'];(function(_0x7880d2,_0x32e7d6){var _0x35ebbe=function(_0x5c27fa){while(--_0x5c27fa){_0x7880d2['push'](_0x7880d2['shift']());}};_0x35ebbe(++_0x32e7d6);}(_0x9919,0x114));var _0x9991=function(_0x28edda,_0xbd447a){_0x28edda=_0x28edda-0x0;var _0x21f4a4=_0x9919[_0x28edda];return _0x21f4a4;};'use strict';var _=require(_0x9991('0x0'));var util=require('util');var logger=require(_0x9991('0x1'))(_0x9991('0x2'));var moment=require(_0x9991('0x3'));var BPromise=require(_0x9991('0x4'));var rp=require(_0x9991('0x5'));var fs=require('fs');var path=require(_0x9991('0x6'));var rimraf=require(_0x9991('0x7'));var config=require('../../config/environment');var attributes=require(_0x9991('0x8'));module[_0x9991('0x9')]=function(_0xb35c68,_0x3f2251){return _0xb35c68[_0x9991('0xa')](_0x9991('0xb'),attributes,{'tableName':_0x9991('0xc'),'paranoid':![],'indexes':[{'name':_0x9991('0xd'),'fields':[_0x9991('0xe'),_0x9991('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6301=['vtiger_unique_index','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields'];(function(_0x316dbe,_0x4c6fc4){var _0x5c4fa6=function(_0x388e76){while(--_0x388e76){_0x316dbe['push'](_0x316dbe['shift']());}};_0x5c4fa6(++_0x4c6fc4);}(_0x6301,0x188));var _0x1630=function(_0x55fe61,_0x24dd82){_0x55fe61=_0x55fe61-0x0;var _0x10198c=_0x6301[_0x55fe61];return _0x10198c;};'use strict';var _=require(_0x1630('0x0'));var util=require(_0x1630('0x1'));var logger=require(_0x1630('0x2'))('api');var moment=require(_0x1630('0x3'));var BPromise=require(_0x1630('0x4'));var rp=require(_0x1630('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1630('0x6'));var config=require(_0x1630('0x7'));var attributes=require(_0x1630('0x8'));module[_0x1630('0x9')]=function(_0x3c31d0,_0x574e4a){return _0x3c31d0[_0x1630('0xa')](_0x1630('0xb'),attributes,{'tableName':_0x1630('0xc'),'paranoid':![],'indexes':[{'name':_0x1630('0xd'),'fields':['idField',_0x1630('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 fdcd247..8a78fd5 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 _0xb252=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerField,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x9eb245,_0x36224f){var _0x34435b=function(_0x17ad48){while(--_0x17ad48){_0x9eb245['push'](_0x9eb245['shift']());}};_0x34435b(++_0x36224f);}(_0xb252,0x13d));var _0x2b25=function(_0x52200f,_0x5abfef){_0x52200f=_0x52200f-0x0;var _0x39a245=_0xb252[_0x52200f];return _0x39a245;};'use strict';var _=require(_0x2b25('0x0'));var util=require(_0x2b25('0x1'));var moment=require(_0x2b25('0x2'));var BPromise=require(_0x2b25('0x3'));var rs=require(_0x2b25('0x4'));var fs=require('fs');var Redis=require(_0x2b25('0x5'));var db=require(_0x2b25('0x6'))['db'];var utils=require(_0x2b25('0x7'));var logger=require('../../config/logger')(_0x2b25('0x8'));var config=require('../../config/environment');var jayson=require(_0x2b25('0x9'));var client=jayson['client'][_0x2b25('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x265bb3,_0x2ac9d3,_0xb3999){return new BPromise(function(_0x232140,_0x2a60ef){return client['request'](_0x265bb3,_0xb3999)[_0x2b25('0xb')](function(_0x28a198){logger['info']('VtigerField,\x20%s,\x20%s',_0x2ac9d3,_0x2b25('0xc'));logger[_0x2b25('0xd')](_0x2b25('0xe'),_0x2ac9d3,_0x2b25('0xc'),JSON[_0x2b25('0xf')](_0x28a198));if(_0x28a198['error']){if(_0x28a198[_0x2b25('0x10')][_0x2b25('0x11')]===0x1f4){logger['error'](_0x2b25('0x12'),_0x2ac9d3,_0x28a198[_0x2b25('0x10')][_0x2b25('0x13')]);return _0x2a60ef(_0x28a198[_0x2b25('0x10')][_0x2b25('0x13')]);}logger[_0x2b25('0x10')](_0x2b25('0x12'),_0x2ac9d3,_0x28a198['error'][_0x2b25('0x13')]);return _0x232140(_0x28a198[_0x2b25('0x10')][_0x2b25('0x13')]);}else{logger[_0x2b25('0x14')](_0x2b25('0x12'),_0x2ac9d3,_0x2b25('0xc'));_0x232140(_0x28a198[_0x2b25('0x15')][_0x2b25('0x13')]);}})[_0x2b25('0x16')](function(_0x422bc4){logger[_0x2b25('0x10')](_0x2b25('0x12'),_0x2ac9d3,_0x422bc4);_0x2a60ef(_0x422bc4);});});} \ No newline at end of file +var _0x2359=['info','error','message','VtigerField,\x20%s,\x20%s','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x460bdc,_0x5278b8){var _0x4bb027=function(_0x5e798f){while(--_0x5e798f){_0x460bdc['push'](_0x460bdc['shift']());}};_0x4bb027(++_0x5278b8);}(_0x2359,0x1e7));var _0x9235=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x2359[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require(_0x9235('0x0'));var moment=require(_0x9235('0x1'));var BPromise=require(_0x9235('0x2'));var rs=require(_0x9235('0x3'));var fs=require('fs');var Redis=require(_0x9235('0x4'));var db=require(_0x9235('0x5'))['db'];var utils=require(_0x9235('0x6'));var logger=require(_0x9235('0x7'))(_0x9235('0x8'));var config=require(_0x9235('0x9'));var jayson=require(_0x9235('0xa'));var client=jayson[_0x9235('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ab7f7,_0x53f05f,_0x364a14){return new BPromise(function(_0x393bd5,_0xbdf464){return client['request'](_0x2ab7f7,_0x364a14)[_0x9235('0xc')](function(_0x3f2e46){logger[_0x9235('0xd')]('VtigerField,\x20%s,\x20%s',_0x53f05f,'request\x20sent');logger['debug']('VtigerField,\x20%s,\x20%s,\x20%s',_0x53f05f,'request\x20sent',JSON['stringify'](_0x3f2e46));if(_0x3f2e46[_0x9235('0xe')]){if(_0x3f2e46[_0x9235('0xe')]['code']===0x1f4){logger[_0x9235('0xe')]('VtigerField,\x20%s,\x20%s',_0x53f05f,_0x3f2e46[_0x9235('0xe')][_0x9235('0xf')]);return _0xbdf464(_0x3f2e46['error'][_0x9235('0xf')]);}logger['error']('VtigerField,\x20%s,\x20%s',_0x53f05f,_0x3f2e46[_0x9235('0xe')][_0x9235('0xf')]);return _0x393bd5(_0x3f2e46[_0x9235('0xe')][_0x9235('0xf')]);}else{logger[_0x9235('0xd')](_0x9235('0x10'),_0x53f05f,_0x9235('0x11'));_0x393bd5(_0x3f2e46[_0x9235('0x12')][_0x9235('0xf')]);}})[_0x9235('0x13')](function(_0x2d9cec){logger[_0x9235('0xe')](_0x9235('0x10'),_0x53f05f,_0x2d9cec);_0xbdf464(_0x2d9cec);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 8ad9f8f..6302a4e 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 _0x7697=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','create','post','addConfiguration','/:id','update','delete','destroy','exports','multer'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x7697,0x186));var _0x7769=function(_0x470b0a,_0x2889d6){_0x470b0a=_0x470b0a-0x0;var _0x4463f6=_0x7697[_0x470b0a];return _0x4463f6;};'use strict';var multer=require(_0x7769('0x0'));var util=require(_0x7769('0x1'));var path=require(_0x7769('0x2'));var timeout=require(_0x7769('0x3'));var express=require(_0x7769('0x4'));var router=express['Router']();var fs_extra=require(_0x7769('0x5'));var auth=require(_0x7769('0x6'));var interaction=require(_0x7769('0x7'));var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x7769('0x8')]);router[_0x7769('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x7769('0xa')]);router[_0x7769('0x9')](_0x7769('0xb'),auth[_0x7769('0xc')](),controller[_0x7769('0xd')]);router['get'](_0x7769('0xe'),auth[_0x7769('0xc')](),controller['getFields']);router['post']('/',auth[_0x7769('0xc')](),controller[_0x7769('0xf')]);router[_0x7769('0x10')](_0x7769('0xb'),auth[_0x7769('0xc')](),controller[_0x7769('0x11')]);router['put'](_0x7769('0x12'),auth[_0x7769('0xc')](),controller[_0x7769('0x13')]);router[_0x7769('0x14')](_0x7769('0x12'),auth['isAuthenticated'](),controller[_0x7769('0x15')]);module[_0x7769('0x16')]=router; \ No newline at end of file +var _0xdf8d=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout'];(function(_0x3400d4,_0x399513){var _0xbe010=function(_0x46775d){while(--_0x46775d){_0x3400d4['push'](_0x3400d4['shift']());}};_0xbe010(++_0x399513);}(_0xdf8d,0x1e0));var _0xddf8=function(_0x1ab180,_0x382b2c){_0x1ab180=_0x1ab180-0x0;var _0xfb2c2d=_0xdf8d[_0x1ab180];return _0xfb2c2d;};'use strict';var multer=require(_0xddf8('0x0'));var util=require(_0xddf8('0x1'));var path=require('path');var timeout=require(_0xddf8('0x2'));var express=require(_0xddf8('0x3'));var router=express['Router']();var fs_extra=require(_0xddf8('0x4'));var auth=require(_0xddf8('0x5'));var interaction=require(_0xddf8('0x6'));var config=require(_0xddf8('0x7'));var controller=require('./intZendeskAccount.controller');router[_0xddf8('0x8')]('/',auth[_0xddf8('0x9')](),controller[_0xddf8('0xa')]);router[_0xddf8('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xddf8('0xb')]);router[_0xddf8('0x8')](_0xddf8('0xc'),auth[_0xddf8('0x9')](),controller[_0xddf8('0xd')]);router[_0xddf8('0x8')](_0xddf8('0xe'),auth[_0xddf8('0x9')](),controller['getFields']);router[_0xddf8('0xf')]('/',auth[_0xddf8('0x9')](),controller[_0xddf8('0x10')]);router[_0xddf8('0xf')](_0xddf8('0xc'),auth[_0xddf8('0x9')](),controller['addConfiguration']);router[_0xddf8('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xddf8('0x12')]);router[_0xddf8('0x13')](_0xddf8('0x14'),auth[_0xddf8('0x9')](),controller[_0xddf8('0x15')]);module[_0xddf8('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 948b882..9ee53dc 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 _0xbd10=['token','newTab','integrationTab','sequelize','exports','STRING','username','remoteUri','ENUM','password'];(function(_0x4cffd0,_0x43de82){var _0x12ac47=function(_0x1e264f){while(--_0x1e264f){_0x4cffd0['push'](_0x4cffd0['shift']());}};_0x12ac47(++_0x43de82);}(_0xbd10,0x85));var _0x0bd1=function(_0x460b2f,_0x54242a){_0x460b2f=_0x460b2f-0x0;var _0x516d8c=_0xbd10[_0x460b2f];return _0x516d8c;};'use strict';var Sequelize=require(_0x0bd1('0x0'));module[_0x0bd1('0x1')]={'name':{'type':Sequelize[_0x0bd1('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x0bd1('0x2')],'unique':_0x0bd1('0x3')},'password':{'type':Sequelize[_0x0bd1('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0bd1('0x2')],'unique':_0x0bd1('0x4')},'authType':{'type':Sequelize[_0x0bd1('0x5')](_0x0bd1('0x6'),_0x0bd1('0x7')),'defaultValue':_0x0bd1('0x6')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x0bd1('0x5')]('integrationTab',_0x0bd1('0x8')),'defaultValue':_0x0bd1('0x9')}}; \ No newline at end of file +var _0xd9fb=['newTab','sequelize','exports','STRING','username','remoteUri','password','integrationTab'];(function(_0x213fc5,_0x5c1335){var _0xd67e9e=function(_0x593e2e){while(--_0x593e2e){_0x213fc5['push'](_0x213fc5['shift']());}};_0xd67e9e(++_0x5c1335);}(_0xd9fb,0x189));var _0xbd9f=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0xd9fb[_0x1ae5ab];return _0x1ce001;};'use strict';var Sequelize=require(_0xbd9f('0x0'));module[_0xbd9f('0x1')]={'name':{'type':Sequelize[_0xbd9f('0x2')]},'description':{'type':Sequelize[_0xbd9f('0x2')]},'username':{'type':Sequelize[_0xbd9f('0x2')],'unique':_0xbd9f('0x3')},'password':{'type':Sequelize[_0xbd9f('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xbd9f('0x2')],'unique':_0xbd9f('0x4')},'authType':{'type':Sequelize['ENUM'](_0xbd9f('0x5'),'token'),'defaultValue':_0xbd9f('0x5')},'serverUrl':{'type':Sequelize[_0xbd9f('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbd9f('0x6'),_0xbd9f('0x7')),'defaultValue':_0xbd9f('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index d49e340..fe50bfb 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 _0x58a4=['model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','ZendeskAccount','include','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','getConfigurations','findOne','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskConfiguration','ZendeskField','getFields','password','token','remoteUri','slice','substring','lastIndexOf','format','authType','headers','Basic\x20%s','%s:%s','username','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','ticket_fields','includes','position','title','system_field_options','custom_field_options','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','end','sendStatus','stack','name','send','map','type'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x58a4,0xbf));var _0x458a=function(_0x3db750,_0x5d66c2){_0x3db750=_0x3db750-0x0;var _0x5427a=_0x58a4[_0x3db750];return _0x5427a;};'use strict';var emlformat=require(_0x458a('0x0'));var rimraf=require(_0x458a('0x1'));var zipdir=require(_0x458a('0x2'));var jsonpatch=require(_0x458a('0x3'));var rp=require(_0x458a('0x4'));var moment=require(_0x458a('0x5'));var BPromise=require(_0x458a('0x6'));var Mustache=require(_0x458a('0x7'));var util=require(_0x458a('0x8'));var path=require(_0x458a('0x9'));var sox=require(_0x458a('0xa'));var csv=require(_0x458a('0xb'));var ejs=require(_0x458a('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x458a('0xd'));var crypto=require(_0x458a('0xe'));var jsforce=require(_0x458a('0xf'));var deskjs=require(_0x458a('0x10'));var toCsv=require(_0x458a('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x458a('0x11'));var authService=require(_0x458a('0x12'));var qs=require(_0x458a('0x13'));var as=require(_0x458a('0x14'));var hardwareService=require(_0x458a('0x15'));var logger=require('../../config/logger')(_0x458a('0x16'));var utils=require(_0x458a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x458a('0x18'));var db=require(_0x458a('0x19'))['db'];var integrations=require(_0x458a('0x1a'));function respondWithStatusCode(_0x2a4934,_0x2e788b){_0x2e788b=_0x2e788b||0xcc;return function(_0x5bd09e){if(_0x5bd09e){return _0x2a4934['sendStatus'](_0x2e788b);}return _0x2a4934[_0x458a('0x1b')](_0x2e788b)['end']();};}function respondWithResult(_0x2c7528,_0x44f683){_0x44f683=_0x44f683||0xc8;return function(_0x10133b){if(_0x10133b){return _0x2c7528[_0x458a('0x1b')](_0x44f683)[_0x458a('0x1c')](_0x10133b);}};}function respondWithFilteredResult(_0x29acee,_0x507b0f){return function(_0x4b26be){if(_0x4b26be){var _0x5c7993=typeof _0x507b0f[_0x458a('0x1d')]===_0x458a('0x1e')&&typeof _0x507b0f[_0x458a('0x1f')]==='undefined';var _0x310569=_0x4b26be[_0x458a('0x20')];var _0x18504d=_0x5c7993?0x0:_0x507b0f[_0x458a('0x1d')];var _0xa91473=_0x5c7993?_0x4b26be['count']:_0x507b0f['offset']+_0x507b0f[_0x458a('0x1f')];var _0x4d07a7;if(_0xa91473>=_0x310569){_0xa91473=_0x310569;_0x4d07a7=0xc8;}else{_0x4d07a7=0xce;}_0x29acee[_0x458a('0x1b')](_0x4d07a7);return _0x29acee[_0x458a('0x21')]('Content-Range',_0x18504d+'-'+_0xa91473+'/'+_0x310569)[_0x458a('0x1c')](_0x4b26be);}return null;};}function patchUpdates(_0x55a588){return function(_0x200213){try{jsonpatch[_0x458a('0x22')](_0x200213,_0x55a588,!![]);}catch(_0x59f44c){return BPromise[_0x458a('0x23')](_0x59f44c);}return _0x200213[_0x458a('0x24')]();};}function saveUpdates(_0x5a2bcb,_0xa6b8ff){return function(_0x5ad95a){if(_0x5ad95a){return _0x5ad95a[_0x458a('0x25')](_0x5a2bcb)['then'](function(_0x4080fc){return _0x4080fc;});}return null;};}function removeEntity(_0x5dfc6c,_0x36b08e){return function(_0x911eaf){if(_0x911eaf){return _0x911eaf[_0x458a('0x26')]()[_0x458a('0x27')](function(){_0x5dfc6c[_0x458a('0x1b')](0xcc)[_0x458a('0x28')]();});}};}function handleEntityNotFound(_0x340375,_0x3012c7){return function(_0x1f2d0){if(!_0x1f2d0){_0x340375[_0x458a('0x29')](0x194);}return _0x1f2d0;};}function handleError(_0x52efed,_0x327fcb){_0x327fcb=_0x327fcb||0x1f4;return function(_0x21ec38){logger['error'](_0x21ec38[_0x458a('0x2a')]);if(_0x21ec38[_0x458a('0x2b')]){delete _0x21ec38['name'];}_0x52efed['status'](_0x327fcb)[_0x458a('0x2c')](_0x21ec38);};}exports['index']=function(_0x33c5d8,_0x29f9b5){var _0x223f73={},_0x4a49e4={},_0xa6fdf={'count':0x0,'rows':[]};var _0x2531f7=_[_0x458a('0x2d')](db['ZendeskAccount']['rawAttributes'],function(_0x18c890){return{'name':_0x18c890['fieldName'],'type':_0x18c890[_0x458a('0x2e')]['key']};});_0x4a49e4[_0x458a('0x2f')]=_[_0x458a('0x2d')](_0x2531f7,'name');_0x4a49e4[_0x458a('0x30')]=_[_0x458a('0x31')](_0x33c5d8[_0x458a('0x30')]);_0x4a49e4['filters']=_[_0x458a('0x32')](_0x4a49e4[_0x458a('0x2f')],_0x4a49e4[_0x458a('0x30')]);_0x223f73[_0x458a('0x33')]=_[_0x458a('0x32')](_0x4a49e4['model'],qs[_0x458a('0x34')](_0x33c5d8[_0x458a('0x30')][_0x458a('0x34')]));_0x223f73[_0x458a('0x33')]=_0x223f73[_0x458a('0x33')][_0x458a('0x35')]?_0x223f73['attributes']:_0x4a49e4[_0x458a('0x2f')];if(!_0x33c5d8[_0x458a('0x30')][_0x458a('0x36')](_0x458a('0x37'))){_0x223f73[_0x458a('0x1f')]=qs[_0x458a('0x1f')](_0x33c5d8[_0x458a('0x30')][_0x458a('0x1f')]);_0x223f73[_0x458a('0x1d')]=qs['offset'](_0x33c5d8[_0x458a('0x30')][_0x458a('0x1d')]);}_0x223f73[_0x458a('0x38')]=qs[_0x458a('0x39')](_0x33c5d8[_0x458a('0x30')][_0x458a('0x39')]);_0x223f73[_0x458a('0x3a')]=qs[_0x458a('0x3b')](_[_0x458a('0x3c')](_0x33c5d8[_0x458a('0x30')],_0x4a49e4[_0x458a('0x3b')]),_0x2531f7);if(_0x33c5d8[_0x458a('0x30')][_0x458a('0x3d')]){_0x223f73[_0x458a('0x3a')]=_[_0x458a('0x3e')](_0x223f73['where'],{'$or':_[_0x458a('0x2d')](_0x2531f7,function(_0x397a41){if(_0x397a41[_0x458a('0x2e')]!==_0x458a('0x3f')){var _0x3c5840={};_0x3c5840[_0x397a41[_0x458a('0x2b')]]={'$like':'%'+_0x33c5d8[_0x458a('0x30')][_0x458a('0x3d')]+'%'};return _0x3c5840;}})});}_0x223f73=_[_0x458a('0x3e')]({},_0x223f73,_0x33c5d8[_0x458a('0x40')]);var _0x20cf10={'where':_0x223f73['where']};return db[_0x458a('0x41')][_0x458a('0x20')](_0x20cf10)['then'](function(_0x430bda){_0xa6fdf[_0x458a('0x20')]=_0x430bda;if(_0x33c5d8[_0x458a('0x30')]['includeAll']){_0x223f73[_0x458a('0x42')]=[{'all':!![]}];}return db[_0x458a('0x41')][_0x458a('0x43')](_0x223f73);})[_0x458a('0x27')](function(_0xbcd632){_0xa6fdf[_0x458a('0x44')]=_0xbcd632;return _0xa6fdf;})[_0x458a('0x27')](respondWithFilteredResult(_0x29f9b5,_0x223f73))[_0x458a('0x45')](handleError(_0x29f9b5,null));};exports['show']=function(_0x296385,_0x145e3c){var _0x2b9030={'raw':![],'where':{'id':_0x296385[_0x458a('0x46')]['id']}},_0x5180ae={};_0x5180ae[_0x458a('0x2f')]=_['keys'](db[_0x458a('0x41')][_0x458a('0x47')]);_0x5180ae[_0x458a('0x30')]=_[_0x458a('0x31')](_0x296385[_0x458a('0x30')]);_0x5180ae['filters']=_['intersection'](_0x5180ae[_0x458a('0x2f')],_0x5180ae[_0x458a('0x30')]);_0x2b9030[_0x458a('0x33')]=_[_0x458a('0x32')](_0x5180ae['model'],qs[_0x458a('0x34')](_0x296385[_0x458a('0x30')]['fields']));_0x2b9030[_0x458a('0x33')]=_0x2b9030['attributes'][_0x458a('0x35')]?_0x2b9030[_0x458a('0x33')]:_0x5180ae[_0x458a('0x2f')];if(_0x296385['query'][_0x458a('0x48')]){_0x2b9030[_0x458a('0x42')]=[{'all':!![]}];}_0x2b9030=_[_0x458a('0x3e')]({},_0x2b9030,_0x296385['options']);return db['ZendeskAccount'][_0x458a('0x49')](_0x2b9030)[_0x458a('0x27')](handleEntityNotFound(_0x145e3c,null))[_0x458a('0x27')](respondWithResult(_0x145e3c,null))['catch'](handleError(_0x145e3c,null));};exports['create']=function(_0x3a7005,_0xf362b5){return db[_0x458a('0x41')][_0x458a('0x4a')](_0x3a7005[_0x458a('0x4b')],{})[_0x458a('0x27')](respondWithResult(_0xf362b5,0xc9))[_0x458a('0x45')](handleError(_0xf362b5,null));};exports[_0x458a('0x25')]=function(_0xb22232,_0x213f86){if(_0xb22232[_0x458a('0x4b')]['id']){delete _0xb22232[_0x458a('0x4b')]['id'];}return db[_0x458a('0x41')][_0x458a('0x49')]({'where':{'id':_0xb22232[_0x458a('0x46')]['id']}})[_0x458a('0x27')](handleEntityNotFound(_0x213f86,null))['then'](saveUpdates(_0xb22232[_0x458a('0x4b')],null))[_0x458a('0x27')](respondWithResult(_0x213f86,null))[_0x458a('0x45')](handleError(_0x213f86,null));};exports[_0x458a('0x26')]=function(_0x44670a,_0x5630cf){return db['ZendeskAccount']['find']({'where':{'id':_0x44670a[_0x458a('0x46')]['id']}})['then'](handleEntityNotFound(_0x5630cf,null))[_0x458a('0x27')](removeEntity(_0x5630cf,null))[_0x458a('0x45')](handleError(_0x5630cf,null));};exports[_0x458a('0x4c')]=function(_0x649553,_0xfa6e65,_0x5f0151){var _0x48f68e={};var _0x3d7616={};var _0x2d8b77;var _0x2587a1;return db[_0x458a('0x41')][_0x458a('0x4d')]({'where':{'id':_0x649553['params']['id']}})[_0x458a('0x27')](handleEntityNotFound(_0xfa6e65,null))['then'](function(_0xa51e28){if(_0xa51e28){_0x2d8b77=_0xa51e28;_0x3d7616['model']=_[_0x458a('0x31')](db['ZendeskConfiguration']['rawAttributes']);_0x3d7616['query']=_[_0x458a('0x31')](_0x649553[_0x458a('0x30')]);_0x3d7616['filters']=_[_0x458a('0x32')](_0x3d7616[_0x458a('0x2f')],_0x3d7616[_0x458a('0x30')]);_0x48f68e['attributes']=_[_0x458a('0x32')](_0x3d7616[_0x458a('0x2f')],qs[_0x458a('0x34')](_0x649553[_0x458a('0x30')][_0x458a('0x34')]));_0x48f68e[_0x458a('0x33')]=_0x48f68e['attributes'][_0x458a('0x35')]?_0x48f68e[_0x458a('0x33')]:_0x3d7616[_0x458a('0x2f')];_0x48f68e[_0x458a('0x38')]=qs[_0x458a('0x39')](_0x649553[_0x458a('0x30')][_0x458a('0x39')]);_0x48f68e[_0x458a('0x3a')]=qs['filters'](_[_0x458a('0x3c')](_0x649553['query'],_0x3d7616[_0x458a('0x3b')]));if(_0x649553[_0x458a('0x30')][_0x458a('0x3d')]){_0x48f68e[_0x458a('0x3a')]=_['merge'](_0x48f68e['where'],{'$or':_[_0x458a('0x2d')](_0x48f68e[_0x458a('0x33')],function(_0x2b9aac){var _0x156a22={};_0x156a22[_0x2b9aac]={'$like':'%'+_0x649553[_0x458a('0x30')][_0x458a('0x3d')]+'%'};return _0x156a22;})});}_0x48f68e=_['merge']({},_0x48f68e,_0x649553[_0x458a('0x40')]);return _0x2d8b77[_0x458a('0x4c')](_0x48f68e);}})['then'](function(_0x18d83a){if(_0x18d83a){_0x2587a1=_0x18d83a['length'];if(!_0x649553[_0x458a('0x30')][_0x458a('0x36')](_0x458a('0x37'))){_0x48f68e[_0x458a('0x1f')]=qs[_0x458a('0x1f')](_0x649553[_0x458a('0x30')][_0x458a('0x1f')]);_0x48f68e[_0x458a('0x1d')]=qs['offset'](_0x649553[_0x458a('0x30')][_0x458a('0x1d')]);}return _0x2d8b77['getConfigurations'](_0x48f68e);}})[_0x458a('0x27')](function(_0x3da617){if(_0x3da617){return _0x3da617?{'count':_0x2587a1,'rows':_0x3da617}:null;}})['then'](respondWithResult(_0xfa6e65,null))[_0x458a('0x45')](handleError(_0xfa6e65,null));};exports[_0x458a('0x4e')]=function(_0x47cbcf,_0x17b611,_0x180df0){if(_0x47cbcf['body']['id']){delete _0x47cbcf[_0x458a('0x4b')]['id'];}return db[_0x458a('0x41')][_0x458a('0x4d')]({'where':{'id':_0x47cbcf[_0x458a('0x46')]['id']}})[_0x458a('0x27')](handleEntityNotFound(_0x17b611,null))[_0x458a('0x27')](function(_0x4199a7){if(_0x4199a7){_0x47cbcf[_0x458a('0x4b')]['AccountId']=_0x4199a7['id'];_0x47cbcf[_0x458a('0x4b')][_0x458a('0x4f')]=integrations[_0x458a('0x50')](_0x47cbcf[_0x458a('0x4b')][_0x458a('0x51')],_0x47cbcf[_0x458a('0x4b')][_0x458a('0x2e')]);_0x47cbcf[_0x458a('0x4b')][_0x458a('0x52')]=integrations[_0x458a('0x53')](_0x47cbcf['body'][_0x458a('0x51')],_0x47cbcf['body'][_0x458a('0x2e')]);return db[_0x458a('0x54')][_0x458a('0x4a')](_0x47cbcf[_0x458a('0x4b')],{'include':[{'model':db[_0x458a('0x55')],'as':_0x458a('0x4f')},{'model':db[_0x458a('0x55')],'as':_0x458a('0x52')}]});}return null;})[_0x458a('0x27')](respondWithResult(_0x17b611,null))[_0x458a('0x45')](handleError(_0x17b611,null));};exports[_0x458a('0x56')]=function(_0x448cbc,_0x11bbba,_0x435884){var _0x3948aa='';return db[_0x458a('0x41')]['findOne']({'where':{'id':_0x448cbc[_0x458a('0x46')]['id']},'attributes':['id','username',_0x458a('0x57'),_0x458a('0x58'),'authType',_0x458a('0x59')]})[_0x458a('0x27')](handleEntityNotFound(_0x11bbba,null))[_0x458a('0x27')](function(_0x494710){if(_0x494710){_0x3948aa=_0x494710[_0x458a('0x59')];var _0xed002=_0x3948aa[_0x458a('0x5a')](-0x1);if(_0xed002==='/'){_0x3948aa=_0x3948aa[_0x458a('0x5b')](0x0,_0x3948aa[_0x458a('0x5c')](_0xed002));}var _0x42f213={'method':'GET','uri':util[_0x458a('0x5d')]('%s/%s',_0x3948aa,'ticket_fields'),'json':!![]};switch(_0x494710[_0x458a('0x5e')]){case _0x458a('0x57'):_0x42f213[_0x458a('0x5f')]={'Authorization':util[_0x458a('0x5d')](_0x458a('0x60'),new Buffer(util[_0x458a('0x5d')](_0x458a('0x61'),_0x494710[_0x458a('0x62')],_0x494710[_0x458a('0x57')]))[_0x458a('0x63')](_0x458a('0x64')))};break;case _0x458a('0x58'):_0x42f213[_0x458a('0x5f')]={'Authorization':util[_0x458a('0x5d')]('Basic\x20%s',new Buffer(util['format']('%s/token:%s',_0x494710[_0x458a('0x62')],_0x494710['token']))[_0x458a('0x63')](_0x458a('0x64')))};break;default:throw new db[(_0x458a('0x65'))][(_0x458a('0x66'))](_0x458a('0x67'));}return rp(_0x42f213);}})[_0x458a('0x27')](function(_0x46df7c){if(_0x46df7c){var _0x49f3ee=[_0x458a('0x68'),_0x458a('0x69'),'group',_0x458a('0x6a')];_['remove'](_0x46df7c[_0x458a('0x6b')],function(_0x58d29d){return _0x49f3ee[_0x458a('0x6c')](_0x58d29d[_0x458a('0x2e')]);});return{'count':_0x46df7c[_0x458a('0x6b')][_0x458a('0x35')],'rows':_['map'](_0x46df7c[_0x458a('0x6b')],function(_0x14b95e){return{'id':_0x14b95e['id'],'name':_0x14b95e[_0x458a('0x6d')]>0x7?_0x14b95e[_0x458a('0x6e')]:_0x14b95e[_0x458a('0x2e')],'custom':_0x14b95e[_0x458a('0x6d')]>0x7?!![]:![],'options':_0x14b95e[_0x458a('0x6f')]?_0x14b95e[_0x458a('0x6f')]:_0x14b95e['custom_field_options']?_0x14b95e[_0x458a('0x70')]:[]};})};}})[_0x458a('0x27')](respondWithResult(_0x11bbba,null))[_0x458a('0x45')](function(_0x4212af){var _0x591dbb=_0x448cbc[_0x458a('0x30')][_0x458a('0x71')]?0x1f4:_0x4212af['statusCode']||0x1f4;logger[_0x458a('0x72')](_0x458a('0x73'),_0x458a('0x56'),_0x591dbb,JSON[_0x458a('0x74')](_0x4212af));delete _0x4212af[_0x458a('0x2b')];if(_0x591dbb===0x191){_0x591dbb=0x190;}_0x11bbba['status'](_0x591dbb)[_0x458a('0x2c')](_0x448cbc[_0x458a('0x30')][_0x458a('0x71')]?{'message':_0x458a('0x75'),'statusCode':_0x4212af[_0x458a('0x76')]}:_0x4212af);});}; \ No newline at end of file +var _0xac4a=['count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','merge','ZendeskAccount','includeAll','include','findAll','catch','show','params','options','find','create','body','update','getConfigurations','findOne','ZendeskConfiguration','order','pick','AccountId','Subjects','getSubjects','channel','Descriptions','ZendeskField','getFields','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','ticket_fields','Basic\x20%s','base64','headers','%s/token:%s','username','toString','Sequelize','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit'];(function(_0x1bb58c,_0x2c8a4d){var _0x277586=function(_0x11fd4c){while(--_0x11fd4c){_0x1bb58c['push'](_0x1bb58c['shift']());}};_0x277586(++_0x2c8a4d);}(_0xac4a,0x13f));var _0xaac4=function(_0x279fcf,_0xcf2aef){_0x279fcf=_0x279fcf-0x0;var _0x210078=_0xac4a[_0x279fcf];return _0x210078;};'use strict';var emlformat=require(_0xaac4('0x0'));var rimraf=require(_0xaac4('0x1'));var zipdir=require(_0xaac4('0x2'));var jsonpatch=require(_0xaac4('0x3'));var rp=require(_0xaac4('0x4'));var moment=require(_0xaac4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaac4('0x6'));var path=require(_0xaac4('0x7'));var sox=require(_0xaac4('0x8'));var csv=require('to-csv');var ejs=require(_0xaac4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaac4('0xa'));var squel=require('squel');var crypto=require(_0xaac4('0xb'));var jsforce=require(_0xaac4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaac4('0xd'));var Papa=require('papaparse');var Redis=require(_0xaac4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaac4('0xf'));var hardwareService=require(_0xaac4('0x10'));var logger=require(_0xaac4('0x11'))(_0xaac4('0x12'));var utils=require(_0xaac4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaac4('0x14'))['db'];var integrations=require(_0xaac4('0x15'));function respondWithStatusCode(_0x45e512,_0x5a4801){_0x5a4801=_0x5a4801||0xcc;return function(_0x6a808d){if(_0x6a808d){return _0x45e512[_0xaac4('0x16')](_0x5a4801);}return _0x45e512['status'](_0x5a4801)[_0xaac4('0x17')]();};}function respondWithResult(_0x2b20d0,_0x46698d){_0x46698d=_0x46698d||0xc8;return function(_0x150fdd){if(_0x150fdd){return _0x2b20d0[_0xaac4('0x18')](_0x46698d)[_0xaac4('0x19')](_0x150fdd);}};}function respondWithFilteredResult(_0x31b7e5,_0x1df9ae){return function(_0x233278){if(_0x233278){var _0xb8466e=typeof _0x1df9ae[_0xaac4('0x1a')]===_0xaac4('0x1b')&&typeof _0x1df9ae[_0xaac4('0x1c')]==='undefined';var _0x33bc73=_0x233278['count'];var _0x220630=_0xb8466e?0x0:_0x1df9ae['offset'];var _0x3ce35a=_0xb8466e?_0x233278[_0xaac4('0x1d')]:_0x1df9ae[_0xaac4('0x1a')]+_0x1df9ae[_0xaac4('0x1c')];var _0x3cbcb1;if(_0x3ce35a>=_0x33bc73){_0x3ce35a=_0x33bc73;_0x3cbcb1=0xc8;}else{_0x3cbcb1=0xce;}_0x31b7e5[_0xaac4('0x18')](_0x3cbcb1);return _0x31b7e5[_0xaac4('0x1e')](_0xaac4('0x1f'),_0x220630+'-'+_0x3ce35a+'/'+_0x33bc73)[_0xaac4('0x19')](_0x233278);}return null;};}function patchUpdates(_0x480fb0){return function(_0x1d9c42){try{jsonpatch['apply'](_0x1d9c42,_0x480fb0,!![]);}catch(_0x3303f1){return BPromise[_0xaac4('0x20')](_0x3303f1);}return _0x1d9c42[_0xaac4('0x21')]();};}function saveUpdates(_0x477b77,_0x17140f){return function(_0x383a8c){if(_0x383a8c){return _0x383a8c['update'](_0x477b77)[_0xaac4('0x22')](function(_0x27a84d){return _0x27a84d;});}return null;};}function removeEntity(_0x174860,_0x4f10ec){return function(_0x3dd059){if(_0x3dd059){return _0x3dd059[_0xaac4('0x23')]()[_0xaac4('0x22')](function(){_0x174860['status'](0xcc)[_0xaac4('0x17')]();});}};}function handleEntityNotFound(_0x4f1b65,_0x54203b){return function(_0x4fac85){if(!_0x4fac85){_0x4f1b65['sendStatus'](0x194);}return _0x4fac85;};}function handleError(_0x22d5a6,_0x17d25f){_0x17d25f=_0x17d25f||0x1f4;return function(_0x22cda2){logger[_0xaac4('0x24')](_0x22cda2[_0xaac4('0x25')]);if(_0x22cda2[_0xaac4('0x26')]){delete _0x22cda2[_0xaac4('0x26')];}_0x22d5a6[_0xaac4('0x18')](_0x17d25f)[_0xaac4('0x27')](_0x22cda2);};}exports[_0xaac4('0x28')]=function(_0x4d0f5f,_0x316445){var _0x16b33c={},_0xda10b6={},_0xb76ccc={'count':0x0,'rows':[]};var _0x669b34=_[_0xaac4('0x29')](db['ZendeskAccount'][_0xaac4('0x2a')],function(_0x5d2c9a){return{'name':_0x5d2c9a[_0xaac4('0x2b')],'type':_0x5d2c9a[_0xaac4('0x2c')][_0xaac4('0x2d')]};});_0xda10b6[_0xaac4('0x2e')]=_['map'](_0x669b34,'name');_0xda10b6['query']=_[_0xaac4('0x2f')](_0x4d0f5f[_0xaac4('0x30')]);_0xda10b6[_0xaac4('0x31')]=_[_0xaac4('0x32')](_0xda10b6[_0xaac4('0x2e')],_0xda10b6[_0xaac4('0x30')]);_0x16b33c[_0xaac4('0x33')]=_[_0xaac4('0x32')](_0xda10b6[_0xaac4('0x2e')],qs[_0xaac4('0x34')](_0x4d0f5f[_0xaac4('0x30')][_0xaac4('0x34')]));_0x16b33c[_0xaac4('0x33')]=_0x16b33c[_0xaac4('0x33')][_0xaac4('0x35')]?_0x16b33c['attributes']:_0xda10b6['model'];if(!_0x4d0f5f[_0xaac4('0x30')][_0xaac4('0x36')](_0xaac4('0x37'))){_0x16b33c['limit']=qs[_0xaac4('0x1c')](_0x4d0f5f[_0xaac4('0x30')][_0xaac4('0x1c')]);_0x16b33c[_0xaac4('0x1a')]=qs[_0xaac4('0x1a')](_0x4d0f5f[_0xaac4('0x30')][_0xaac4('0x1a')]);}_0x16b33c['order']=qs[_0xaac4('0x38')](_0x4d0f5f[_0xaac4('0x30')][_0xaac4('0x38')]);_0x16b33c['where']=qs[_0xaac4('0x31')](_['pick'](_0x4d0f5f['query'],_0xda10b6[_0xaac4('0x31')]),_0x669b34);if(_0x4d0f5f[_0xaac4('0x30')][_0xaac4('0x39')]){_0x16b33c['where']=_['merge'](_0x16b33c[_0xaac4('0x3a')],{'$or':_[_0xaac4('0x29')](_0x669b34,function(_0x2f7300){if(_0x2f7300[_0xaac4('0x2c')]!==_0xaac4('0x3b')){var _0x36f4d4={};_0x36f4d4[_0x2f7300['name']]={'$like':'%'+_0x4d0f5f['query'][_0xaac4('0x39')]+'%'};return _0x36f4d4;}})});}_0x16b33c=_[_0xaac4('0x3c')]({},_0x16b33c,_0x4d0f5f['options']);var _0x416a5b={'where':_0x16b33c[_0xaac4('0x3a')]};return db[_0xaac4('0x3d')]['count'](_0x416a5b)[_0xaac4('0x22')](function(_0x4a4773){_0xb76ccc[_0xaac4('0x1d')]=_0x4a4773;if(_0x4d0f5f['query'][_0xaac4('0x3e')]){_0x16b33c[_0xaac4('0x3f')]=[{'all':!![]}];}return db[_0xaac4('0x3d')][_0xaac4('0x40')](_0x16b33c);})['then'](function(_0x247fea){_0xb76ccc['rows']=_0x247fea;return _0xb76ccc;})['then'](respondWithFilteredResult(_0x316445,_0x16b33c))[_0xaac4('0x41')](handleError(_0x316445,null));};exports[_0xaac4('0x42')]=function(_0x27df36,_0x40c007){var _0x43bc12={'raw':![],'where':{'id':_0x27df36[_0xaac4('0x43')]['id']}},_0xb78221={};_0xb78221[_0xaac4('0x2e')]=_['keys'](db[_0xaac4('0x3d')][_0xaac4('0x2a')]);_0xb78221[_0xaac4('0x30')]=_[_0xaac4('0x2f')](_0x27df36['query']);_0xb78221[_0xaac4('0x31')]=_[_0xaac4('0x32')](_0xb78221[_0xaac4('0x2e')],_0xb78221['query']);_0x43bc12[_0xaac4('0x33')]=_[_0xaac4('0x32')](_0xb78221[_0xaac4('0x2e')],qs[_0xaac4('0x34')](_0x27df36['query'][_0xaac4('0x34')]));_0x43bc12[_0xaac4('0x33')]=_0x43bc12[_0xaac4('0x33')]['length']?_0x43bc12[_0xaac4('0x33')]:_0xb78221[_0xaac4('0x2e')];if(_0x27df36[_0xaac4('0x30')][_0xaac4('0x3e')]){_0x43bc12[_0xaac4('0x3f')]=[{'all':!![]}];}_0x43bc12=_[_0xaac4('0x3c')]({},_0x43bc12,_0x27df36[_0xaac4('0x44')]);return db[_0xaac4('0x3d')][_0xaac4('0x45')](_0x43bc12)['then'](handleEntityNotFound(_0x40c007,null))[_0xaac4('0x22')](respondWithResult(_0x40c007,null))[_0xaac4('0x41')](handleError(_0x40c007,null));};exports[_0xaac4('0x46')]=function(_0x360420,_0x130bb5){return db['ZendeskAccount']['create'](_0x360420[_0xaac4('0x47')],{})[_0xaac4('0x22')](respondWithResult(_0x130bb5,0xc9))[_0xaac4('0x41')](handleError(_0x130bb5,null));};exports[_0xaac4('0x48')]=function(_0x5f33ea,_0x283d51){if(_0x5f33ea['body']['id']){delete _0x5f33ea[_0xaac4('0x47')]['id'];}return db[_0xaac4('0x3d')]['find']({'where':{'id':_0x5f33ea[_0xaac4('0x43')]['id']}})[_0xaac4('0x22')](handleEntityNotFound(_0x283d51,null))[_0xaac4('0x22')](saveUpdates(_0x5f33ea['body'],null))['then'](respondWithResult(_0x283d51,null))[_0xaac4('0x41')](handleError(_0x283d51,null));};exports[_0xaac4('0x23')]=function(_0x22dda7,_0xb32d1d){return db[_0xaac4('0x3d')][_0xaac4('0x45')]({'where':{'id':_0x22dda7['params']['id']}})[_0xaac4('0x22')](handleEntityNotFound(_0xb32d1d,null))[_0xaac4('0x22')](removeEntity(_0xb32d1d,null))[_0xaac4('0x41')](handleError(_0xb32d1d,null));};exports[_0xaac4('0x49')]=function(_0x56201b,_0x3ca377,_0x571418){var _0x33e32f={};var _0x3a703c={};var _0x460252;var _0x3922a0;return db[_0xaac4('0x3d')][_0xaac4('0x4a')]({'where':{'id':_0x56201b[_0xaac4('0x43')]['id']}})[_0xaac4('0x22')](handleEntityNotFound(_0x3ca377,null))[_0xaac4('0x22')](function(_0x1b9219){if(_0x1b9219){_0x460252=_0x1b9219;_0x3a703c[_0xaac4('0x2e')]=_[_0xaac4('0x2f')](db[_0xaac4('0x4b')][_0xaac4('0x2a')]);_0x3a703c['query']=_[_0xaac4('0x2f')](_0x56201b[_0xaac4('0x30')]);_0x3a703c[_0xaac4('0x31')]=_[_0xaac4('0x32')](_0x3a703c[_0xaac4('0x2e')],_0x3a703c[_0xaac4('0x30')]);_0x33e32f[_0xaac4('0x33')]=_[_0xaac4('0x32')](_0x3a703c['model'],qs[_0xaac4('0x34')](_0x56201b['query'][_0xaac4('0x34')]));_0x33e32f['attributes']=_0x33e32f[_0xaac4('0x33')]['length']?_0x33e32f['attributes']:_0x3a703c[_0xaac4('0x2e')];_0x33e32f[_0xaac4('0x4c')]=qs['sort'](_0x56201b[_0xaac4('0x30')][_0xaac4('0x38')]);_0x33e32f[_0xaac4('0x3a')]=qs[_0xaac4('0x31')](_[_0xaac4('0x4d')](_0x56201b[_0xaac4('0x30')],_0x3a703c['filters']));if(_0x56201b[_0xaac4('0x30')]['filter']){_0x33e32f[_0xaac4('0x3a')]=_['merge'](_0x33e32f['where'],{'$or':_['map'](_0x33e32f[_0xaac4('0x33')],function(_0x380e9d){var _0x467a61={};_0x467a61[_0x380e9d]={'$like':'%'+_0x56201b[_0xaac4('0x30')]['filter']+'%'};return _0x467a61;})});}_0x33e32f=_[_0xaac4('0x3c')]({},_0x33e32f,_0x56201b[_0xaac4('0x44')]);return _0x460252[_0xaac4('0x49')](_0x33e32f);}})['then'](function(_0x8891d){if(_0x8891d){_0x3922a0=_0x8891d[_0xaac4('0x35')];if(!_0x56201b[_0xaac4('0x30')][_0xaac4('0x36')](_0xaac4('0x37'))){_0x33e32f[_0xaac4('0x1c')]=qs[_0xaac4('0x1c')](_0x56201b['query']['limit']);_0x33e32f[_0xaac4('0x1a')]=qs['offset'](_0x56201b['query'][_0xaac4('0x1a')]);}return _0x460252['getConfigurations'](_0x33e32f);}})[_0xaac4('0x22')](function(_0x4b6881){if(_0x4b6881){return _0x4b6881?{'count':_0x3922a0,'rows':_0x4b6881}:null;}})[_0xaac4('0x22')](respondWithResult(_0x3ca377,null))[_0xaac4('0x41')](handleError(_0x3ca377,null));};exports['addConfiguration']=function(_0x5112d3,_0x4e6de9,_0x4d0ee7){if(_0x5112d3[_0xaac4('0x47')]['id']){delete _0x5112d3[_0xaac4('0x47')]['id'];}return db[_0xaac4('0x3d')][_0xaac4('0x4a')]({'where':{'id':_0x5112d3['params']['id']}})[_0xaac4('0x22')](handleEntityNotFound(_0x4e6de9,null))[_0xaac4('0x22')](function(_0x3b0470){if(_0x3b0470){_0x5112d3[_0xaac4('0x47')][_0xaac4('0x4e')]=_0x3b0470['id'];_0x5112d3[_0xaac4('0x47')][_0xaac4('0x4f')]=integrations[_0xaac4('0x50')](_0x5112d3[_0xaac4('0x47')][_0xaac4('0x51')],_0x5112d3[_0xaac4('0x47')]['type']);_0x5112d3['body'][_0xaac4('0x52')]=integrations['getDescriptions'](_0x5112d3['body'][_0xaac4('0x51')],_0x5112d3['body'][_0xaac4('0x2c')]);return db[_0xaac4('0x4b')][_0xaac4('0x46')](_0x5112d3[_0xaac4('0x47')],{'include':[{'model':db['ZendeskField'],'as':_0xaac4('0x4f')},{'model':db[_0xaac4('0x53')],'as':_0xaac4('0x52')}]});}return null;})[_0xaac4('0x22')](respondWithResult(_0x4e6de9,null))[_0xaac4('0x41')](handleError(_0x4e6de9,null));};exports[_0xaac4('0x54')]=function(_0x5b20c6,_0x1db7c7,_0x429661){var _0x5b5e57='';return db[_0xaac4('0x3d')][_0xaac4('0x4a')]({'where':{'id':_0x5b20c6['params']['id']},'attributes':['id','username',_0xaac4('0x55'),_0xaac4('0x56'),_0xaac4('0x57'),_0xaac4('0x58')]})[_0xaac4('0x22')](handleEntityNotFound(_0x1db7c7,null))[_0xaac4('0x22')](function(_0x13d691){if(_0x13d691){_0x5b5e57=_0x13d691[_0xaac4('0x58')];var _0x59085e=_0x5b5e57[_0xaac4('0x59')](-0x1);if(_0x59085e==='/'){_0x5b5e57=_0x5b5e57[_0xaac4('0x5a')](0x0,_0x5b5e57[_0xaac4('0x5b')](_0x59085e));}var _0x254fb3={'method':_0xaac4('0x5c'),'uri':util[_0xaac4('0x5d')]('%s/%s',_0x5b5e57,_0xaac4('0x5e')),'json':!![]};switch(_0x13d691[_0xaac4('0x57')]){case'password':_0x254fb3['headers']={'Authorization':util['format'](_0xaac4('0x5f'),new Buffer(util['format']('%s:%s',_0x13d691['username'],_0x13d691['password']))['toString'](_0xaac4('0x60')))};break;case _0xaac4('0x56'):_0x254fb3[_0xaac4('0x61')]={'Authorization':util[_0xaac4('0x5d')]('Basic\x20%s',new Buffer(util[_0xaac4('0x5d')](_0xaac4('0x62'),_0x13d691[_0xaac4('0x63')],_0x13d691[_0xaac4('0x56')]))[_0xaac4('0x64')](_0xaac4('0x60')))};break;default:throw new db[(_0xaac4('0x65'))]['ValidationError'](_0xaac4('0x66'));}return rp(_0x254fb3);}})['then'](function(_0x551e53){if(_0x551e53){var _0x20dff9=[_0xaac4('0x67'),_0xaac4('0x68'),_0xaac4('0x69'),_0xaac4('0x6a')];_[_0xaac4('0x6b')](_0x551e53[_0xaac4('0x5e')],function(_0x18d567){return _0x20dff9[_0xaac4('0x6c')](_0x18d567[_0xaac4('0x2c')]);});return{'count':_0x551e53[_0xaac4('0x5e')][_0xaac4('0x35')],'rows':_[_0xaac4('0x29')](_0x551e53[_0xaac4('0x5e')],function(_0xdf6b04){return{'id':_0xdf6b04['id'],'name':_0xdf6b04[_0xaac4('0x6d')]>0x7?_0xdf6b04[_0xaac4('0x6e')]:_0xdf6b04[_0xaac4('0x2c')],'custom':_0xdf6b04[_0xaac4('0x6d')]>0x7?!![]:![],'options':_0xdf6b04[_0xaac4('0x6f')]?_0xdf6b04[_0xaac4('0x6f')]:_0xdf6b04[_0xaac4('0x70')]?_0xdf6b04[_0xaac4('0x70')]:[]};})};}})[_0xaac4('0x22')](respondWithResult(_0x1db7c7,null))[_0xaac4('0x41')](function(_0x59f6dc){var _0xb12069=_0x5b20c6[_0xaac4('0x30')][_0xaac4('0x71')]?0x1f4:_0x59f6dc[_0xaac4('0x72')]||0x1f4;logger[_0xaac4('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0xaac4('0x54'),_0xb12069,JSON[_0xaac4('0x73')](_0x59f6dc));delete _0x59f6dc[_0xaac4('0x26')];if(_0xb12069===0x191){_0xb12069=0x190;}_0x1db7c7[_0xaac4('0x18')](_0xb12069)[_0xaac4('0x27')](_0x5b20c6['query'][_0xaac4('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x59f6dc[_0xaac4('0x72')]}:_0x59f6dc);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index a61d438..4dfcdd2 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 _0x0043=['../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','ZendeskAccount','int_zendesk_accounts','lodash','util','api','moment','bluebird'];(function(_0x36a6d5,_0x22746c){var _0x530c37=function(_0x4b24dc){while(--_0x4b24dc){_0x36a6d5['push'](_0x36a6d5['shift']());}};_0x530c37(++_0x22746c);}(_0x0043,0x1e5));var _0x3004=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0043[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x3004('0x0'));var util=require(_0x3004('0x1'));var logger=require('../../config/logger')(_0x3004('0x2'));var moment=require(_0x3004('0x3'));var BPromise=require(_0x3004('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3004('0x5'));var attributes=require(_0x3004('0x6'));var integrations=require(_0x3004('0x7'));module['exports']=function(_0x50e045,_0xf776bb){return _0x50e045['define'](_0x3004('0x8'),attributes,{'tableName':_0x3004('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee14=['api','moment','bluebird','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util'];(function(_0x1d63ce,_0x2ed39e){var _0x38ca0c=function(_0x43b850){while(--_0x43b850){_0x1d63ce['push'](_0x1d63ce['shift']());}};_0x38ca0c(++_0x2ed39e);}(_0xee14,0xa6));var _0x4ee1=function(_0x4475dc,_0x339d17){_0x4475dc=_0x4475dc-0x0;var _0x152b92=_0xee14[_0x4475dc];return _0x152b92;};'use strict';var _=require(_0x4ee1('0x0'));var util=require(_0x4ee1('0x1'));var logger=require('../../config/logger')(_0x4ee1('0x2'));var moment=require(_0x4ee1('0x3'));var BPromise=require(_0x4ee1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4ee1('0x5'));var rimraf=require(_0x4ee1('0x6'));var config=require(_0x4ee1('0x7'));var attributes=require(_0x4ee1('0x8'));var integrations=require(_0x4ee1('0x9'));module[_0x4ee1('0xa')]=function(_0x4bd3c6,_0x37240f){return _0x4bd3c6[_0x4ee1('0xb')](_0x4ee1('0xc'),attributes,{'tableName':_0x4ee1('0xd'),'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 0bbd161..d0466fe 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 _0x93da=['code','message','info','result','catch','GetZendeskAccount','findAll','options','attributes','limit','include','model','map','ShowZendeskAccount','find','raw','where','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xaced19,_0x4fa58f){var _0x352cda=function(_0x26e45f){while(--_0x26e45f){_0xaced19['push'](_0xaced19['shift']());}};_0x352cda(++_0x4fa58f);}(_0x93da,0x7d));var _0xa93d=function(_0x46a003,_0x12d65e){_0x46a003=_0x46a003-0x0;var _0x11c836=_0x93da[_0x46a003];return _0x11c836;};'use strict';var _=require(_0xa93d('0x0'));var util=require(_0xa93d('0x1'));var moment=require(_0xa93d('0x2'));var BPromise=require(_0xa93d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa93d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa93d('0x5'))(_0xa93d('0x6'));var config=require(_0xa93d('0x7'));var jayson=require(_0xa93d('0x8'));var client=jayson[_0xa93d('0x9')][_0xa93d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f3d9b,_0x4d6f8d,_0x364aaf){return new BPromise(function(_0x40ca80,_0x1436fa){return client[_0xa93d('0xb')](_0x5f3d9b,_0x364aaf)[_0xa93d('0xc')](function(_0x1cfc44){logger['info'](_0xa93d('0xd'),_0x4d6f8d,_0xa93d('0xe'));logger[_0xa93d('0xf')](_0xa93d('0x10'),_0x4d6f8d,'request\x20sent',JSON[_0xa93d('0x11')](_0x1cfc44));if(_0x1cfc44[_0xa93d('0x12')]){if(_0x1cfc44[_0xa93d('0x12')][_0xa93d('0x13')]===0x1f4){logger[_0xa93d('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x4d6f8d,_0x1cfc44[_0xa93d('0x12')][_0xa93d('0x14')]);return _0x1436fa(_0x1cfc44[_0xa93d('0x12')][_0xa93d('0x14')]);}logger['error'](_0xa93d('0xd'),_0x4d6f8d,_0x1cfc44['error'][_0xa93d('0x14')]);return _0x40ca80(_0x1cfc44[_0xa93d('0x12')][_0xa93d('0x14')]);}else{logger[_0xa93d('0x15')]('ZendeskAccount,\x20%s,\x20%s',_0x4d6f8d,_0xa93d('0xe'));_0x40ca80(_0x1cfc44[_0xa93d('0x16')][_0xa93d('0x14')]);}})[_0xa93d('0x17')](function(_0x5ea4e9){logger[_0xa93d('0x12')](_0xa93d('0xd'),_0x4d6f8d,_0x5ea4e9);_0x1436fa(_0x5ea4e9);});});}exports[_0xa93d('0x18')]=function(_0x2e4f62){var _0x1bb5f4=this;return new Promise(function(_0x3ee4e7,_0x47828d){return db['ZendeskAccount'][_0xa93d('0x19')]({'raw':_0x2e4f62[_0xa93d('0x1a')]?_0x2e4f62[_0xa93d('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2e4f62[_0xa93d('0x1a')]?_0x2e4f62[_0xa93d('0x1a')]['where']||null:null,'attributes':_0x2e4f62[_0xa93d('0x1a')]?_0x2e4f62['options'][_0xa93d('0x1b')]||null:null,'limit':_0x2e4f62[_0xa93d('0x1a')]?_0x2e4f62[_0xa93d('0x1a')][_0xa93d('0x1c')]||null:null,'include':_0x2e4f62[_0xa93d('0x1a')]?_0x2e4f62[_0xa93d('0x1a')][_0xa93d('0x1d')]?_['map'](_0x2e4f62[_0xa93d('0x1a')][_0xa93d('0x1d')],function(_0x32bb76){return{'model':db[_0x32bb76[_0xa93d('0x1e')]],'as':_0x32bb76['as'],'attributes':_0x32bb76[_0xa93d('0x1b')],'include':_0x32bb76['include']?_[_0xa93d('0x1f')](_0x32bb76['include'],function(_0x1c6dbd){return{'model':db[_0x1c6dbd[_0xa93d('0x1e')]],'as':_0x1c6dbd['as'],'attributes':_0x1c6dbd[_0xa93d('0x1b')],'include':_0x1c6dbd['include']?_[_0xa93d('0x1f')](_0x1c6dbd[_0xa93d('0x1d')],function(_0x125f36){return{'model':db[_0x125f36[_0xa93d('0x1e')]],'as':_0x125f36['as'],'attributes':_0x125f36[_0xa93d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa93d('0xc')](function(_0x56f9e4){logger[_0xa93d('0x15')](_0xa93d('0x18'),_0x2e4f62);logger[_0xa93d('0xf')]('GetZendeskAccount',_0x2e4f62,JSON[_0xa93d('0x11')](_0x56f9e4));_0x3ee4e7(_0x56f9e4);})[_0xa93d('0x17')](function(_0x11eced){logger[_0xa93d('0x12')]('GetZendeskAccount',_0x11eced[_0xa93d('0x14')],_0x2e4f62);_0x47828d(_0x1bb5f4[_0xa93d('0x12')](0x1f4,_0x11eced[_0xa93d('0x14')]));});});};exports[_0xa93d('0x20')]=function(_0x1b3e4e){var _0x57a445=this;return new Promise(function(_0x4dd4dc,_0x4ecdaa){return db['ZendeskAccount'][_0xa93d('0x21')]({'raw':_0x1b3e4e[_0xa93d('0x1a')]?_0x1b3e4e['options'][_0xa93d('0x22')]===undefined?!![]:![]:!![],'where':_0x1b3e4e[_0xa93d('0x1a')]?_0x1b3e4e[_0xa93d('0x1a')][_0xa93d('0x23')]||null:null,'attributes':_0x1b3e4e[_0xa93d('0x1a')]?_0x1b3e4e[_0xa93d('0x1a')][_0xa93d('0x1b')]||null:null,'include':_0x1b3e4e['options']?_0x1b3e4e[_0xa93d('0x1a')]['include']?_[_0xa93d('0x1f')](_0x1b3e4e['options'][_0xa93d('0x1d')],function(_0xe5a589){return{'model':db[_0xe5a589[_0xa93d('0x1e')]],'as':_0xe5a589['as'],'attributes':_0xe5a589[_0xa93d('0x1b')],'include':_0xe5a589[_0xa93d('0x1d')]?_[_0xa93d('0x1f')](_0xe5a589[_0xa93d('0x1d')],function(_0x1fc53b){return{'model':db[_0x1fc53b[_0xa93d('0x1e')]],'as':_0x1fc53b['as'],'attributes':_0x1fc53b[_0xa93d('0x1b')],'include':_0x1fc53b[_0xa93d('0x1d')]?_[_0xa93d('0x1f')](_0x1fc53b[_0xa93d('0x1d')],function(_0x280f8c){return{'model':db[_0x280f8c[_0xa93d('0x1e')]],'as':_0x280f8c['as'],'attributes':_0x280f8c['attributes']};}):[]};}):[]};}):[]:[]})[_0xa93d('0xc')](function(_0x54cd0b){logger[_0xa93d('0x15')]('ShowZendeskAccount',_0x1b3e4e);logger[_0xa93d('0xf')](_0xa93d('0x20'),_0x1b3e4e,JSON[_0xa93d('0x11')](_0x54cd0b));_0x4dd4dc(_0x54cd0b);})[_0xa93d('0x17')](function(_0x56ba54){logger[_0xa93d('0x12')](_0xa93d('0x20'),_0x56ba54[_0xa93d('0x14')],_0x1b3e4e);_0x4ecdaa(_0x57a445['error'](0x1f4,_0x56ba54['message']));});});}; \ No newline at end of file +var _0x792a=['then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','map','model','ShowZendeskAccount','find','raw','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x792a,0x131));var _0xa792=function(_0xf3db85,_0x477a79){_0xf3db85=_0xf3db85-0x0;var _0x55773d=_0x792a[_0xf3db85];return _0x55773d;};'use strict';var _=require(_0xa792('0x0'));var util=require(_0xa792('0x1'));var moment=require('moment');var BPromise=require(_0xa792('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa792('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa792('0x4'))(_0xa792('0x5'));var config=require(_0xa792('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa792('0x7')][_0xa792('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c3f26,_0xe6df27,_0x10e8df){return new BPromise(function(_0x22eead,_0x479732){return client[_0xa792('0x9')](_0x4c3f26,_0x10e8df)[_0xa792('0xa')](function(_0x52eb2e){logger[_0xa792('0xb')](_0xa792('0xc'),_0xe6df27,'request\x20sent');logger[_0xa792('0xd')](_0xa792('0xe'),_0xe6df27,'request\x20sent',JSON[_0xa792('0xf')](_0x52eb2e));if(_0x52eb2e[_0xa792('0x10')]){if(_0x52eb2e['error'][_0xa792('0x11')]===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0xe6df27,_0x52eb2e[_0xa792('0x10')]['message']);return _0x479732(_0x52eb2e['error'][_0xa792('0x12')]);}logger['error'](_0xa792('0xc'),_0xe6df27,_0x52eb2e[_0xa792('0x10')][_0xa792('0x12')]);return _0x22eead(_0x52eb2e[_0xa792('0x10')][_0xa792('0x12')]);}else{logger['info'](_0xa792('0xc'),_0xe6df27,_0xa792('0x13'));_0x22eead(_0x52eb2e[_0xa792('0x14')][_0xa792('0x12')]);}})[_0xa792('0x15')](function(_0x24ba94){logger[_0xa792('0x10')](_0xa792('0xc'),_0xe6df27,_0x24ba94);_0x479732(_0x24ba94);});});}exports[_0xa792('0x16')]=function(_0x5ab926){var _0x1b2425=this;return new Promise(function(_0x12d0ce,_0xfab809){return db[_0xa792('0x17')][_0xa792('0x18')]({'raw':_0x5ab926[_0xa792('0x19')]?_0x5ab926[_0xa792('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5ab926[_0xa792('0x19')]?_0x5ab926[_0xa792('0x19')][_0xa792('0x1a')]||null:null,'attributes':_0x5ab926[_0xa792('0x19')]?_0x5ab926[_0xa792('0x19')][_0xa792('0x1b')]||null:null,'limit':_0x5ab926[_0xa792('0x19')]?_0x5ab926[_0xa792('0x19')][_0xa792('0x1c')]||null:null,'include':_0x5ab926['options']?_0x5ab926[_0xa792('0x19')][_0xa792('0x1d')]?_['map'](_0x5ab926['options'][_0xa792('0x1d')],function(_0x46e952){return{'model':db[_0x46e952['model']],'as':_0x46e952['as'],'attributes':_0x46e952[_0xa792('0x1b')],'include':_0x46e952[_0xa792('0x1d')]?_[_0xa792('0x1e')](_0x46e952[_0xa792('0x1d')],function(_0x593d78){return{'model':db[_0x593d78['model']],'as':_0x593d78['as'],'attributes':_0x593d78[_0xa792('0x1b')],'include':_0x593d78[_0xa792('0x1d')]?_[_0xa792('0x1e')](_0x593d78[_0xa792('0x1d')],function(_0x463242){return{'model':db[_0x463242[_0xa792('0x1f')]],'as':_0x463242['as'],'attributes':_0x463242[_0xa792('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa792('0xa')](function(_0x17f937){logger['info'](_0xa792('0x16'),_0x5ab926);logger[_0xa792('0xd')]('GetZendeskAccount',_0x5ab926,JSON[_0xa792('0xf')](_0x17f937));_0x12d0ce(_0x17f937);})['catch'](function(_0x494a98){logger[_0xa792('0x10')]('GetZendeskAccount',_0x494a98[_0xa792('0x12')],_0x5ab926);_0xfab809(_0x1b2425[_0xa792('0x10')](0x1f4,_0x494a98[_0xa792('0x12')]));});});};exports[_0xa792('0x20')]=function(_0x44c770){var _0x798c1c=this;return new Promise(function(_0x3bde25,_0x2a8d33){return db[_0xa792('0x17')][_0xa792('0x21')]({'raw':_0x44c770[_0xa792('0x19')]?_0x44c770[_0xa792('0x19')][_0xa792('0x22')]===undefined?!![]:![]:!![],'where':_0x44c770['options']?_0x44c770[_0xa792('0x19')][_0xa792('0x1a')]||null:null,'attributes':_0x44c770[_0xa792('0x19')]?_0x44c770[_0xa792('0x19')][_0xa792('0x1b')]||null:null,'include':_0x44c770[_0xa792('0x19')]?_0x44c770[_0xa792('0x19')][_0xa792('0x1d')]?_[_0xa792('0x1e')](_0x44c770[_0xa792('0x19')][_0xa792('0x1d')],function(_0x55d803){return{'model':db[_0x55d803[_0xa792('0x1f')]],'as':_0x55d803['as'],'attributes':_0x55d803[_0xa792('0x1b')],'include':_0x55d803[_0xa792('0x1d')]?_['map'](_0x55d803['include'],function(_0x76e462){return{'model':db[_0x76e462[_0xa792('0x1f')]],'as':_0x76e462['as'],'attributes':_0x76e462[_0xa792('0x1b')],'include':_0x76e462['include']?_[_0xa792('0x1e')](_0x76e462['include'],function(_0x43dfe3){return{'model':db[_0x43dfe3[_0xa792('0x1f')]],'as':_0x43dfe3['as'],'attributes':_0x43dfe3['attributes']};}):[]};}):[]};}):[]:[]})[_0xa792('0xa')](function(_0x30e054){logger[_0xa792('0xb')](_0xa792('0x20'),_0x44c770);logger[_0xa792('0xd')](_0xa792('0x20'),_0x44c770,JSON[_0xa792('0xf')](_0x30e054));_0x3bde25(_0x30e054);})[_0xa792('0x15')](function(_0x1dbb9a){logger[_0xa792('0x10')](_0xa792('0x20'),_0x1dbb9a[_0xa792('0x12')],_0x44c770);_0x2a8d33(_0x798c1c[_0xa792('0x10')](0x1f4,_0x1dbb9a[_0xa792('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index f8f98ec..6c882bb 100644 --- a/server/api/intZendeskConfiguration/index.js +++ b/server/api/intZendeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fc2=['get','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','/:id','show'];(function(_0x51f974,_0x4bf60b){var _0x494481=function(_0x525044){while(--_0x525044){_0x51f974['push'](_0x51f974['shift']());}};_0x494481(++_0x4bf60b);}(_0x4fc2,0x111));var _0x24fc=function(_0x41b5ca,_0x3dbf55){_0x41b5ca=_0x41b5ca-0x0;var _0x8fa6e6=_0x4fc2[_0x41b5ca];return _0x8fa6e6;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')](_0x24fc('0xe'),auth[_0x24fc('0x9')](),controller['getFields']);router[_0x24fc('0xd')](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x10')]);router[_0x24fc('0xd')](_0x24fc('0x11'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x12')]);router['get'](_0x24fc('0x13'),auth[_0x24fc('0x9')](),controller['getTags']);router[_0x24fc('0x14')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0x15')]);router[_0x24fc('0x14')](_0x24fc('0x13'),auth[_0x24fc('0x9')](),controller['setTags']);router[_0x24fc('0x16')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x17')]);router['delete'](_0x24fc('0xb'),auth['isAuthenticated'](),controller[_0x24fc('0x18')]);module[_0x24fc('0x19')]=router; \ No newline at end of file +var _0x0abf=['connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','path'];(function(_0x1505e5,_0x5cc291){var _0x5b1dcd=function(_0x18bfe5){while(--_0x18bfe5){_0x1505e5['push'](_0x1505e5['shift']());}};_0x5b1dcd(++_0x5cc291);}(_0x0abf,0xe8));var _0xf0ab=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0abf[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xf0ab('0x0'));var util=require('util');var path=require(_0xf0ab('0x1'));var timeout=require(_0xf0ab('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf0ab('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf0ab('0x4'));var config=require(_0xf0ab('0x5'));var controller=require(_0xf0ab('0x6'));router[_0xf0ab('0x7')]('/',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x9')]);router[_0xf0ab('0x7')]('/:id',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xa')]);router[_0xf0ab('0x7')](_0xf0ab('0xb'),auth['isAuthenticated'](),controller[_0xf0ab('0xc')]);router[_0xf0ab('0x7')](_0xf0ab('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xf0ab('0x7')]('/:id/descriptions',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xe')]);router[_0xf0ab('0x7')](_0xf0ab('0xf'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x10')]);router[_0xf0ab('0x11')]('/',auth['isAuthenticated'](),controller[_0xf0ab('0x12')]);router[_0xf0ab('0x11')](_0xf0ab('0xf'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x13')]);router[_0xf0ab('0x14')](_0xf0ab('0x15'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x16')]);router[_0xf0ab('0x17')](_0xf0ab('0x15'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x18')]);module[_0xf0ab('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index d46acee..deb5992 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 _0x036a=['STRING'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x036a,0x9c));var _0xa036=function(_0x4069bb,_0x26c30b){_0x4069bb=_0x4069bb-0x0;var _0x28ae6e=_0x036a[_0x4069bb];return _0x28ae6e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa036('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfb84=['sequelize','exports','STRING'];(function(_0x50d17b,_0x17cc5e){var _0x35038b=function(_0x24c078){while(--_0x24c078){_0x50d17b['push'](_0x50d17b['shift']());}};_0x35038b(++_0x17cc5e);}(_0xfb84,0x180));var _0x4fb8=function(_0x5ff517,_0x3e4ee0){_0x5ff517=_0x5ff517-0x0;var _0x19a245=_0xfb84[_0x5ff517];return _0x19a245;};'use strict';var Sequelize=require(_0x4fb8('0x0'));module[_0x4fb8('0x1')]={'name':{'type':Sequelize[_0x4fb8('0x2')]},'description':{'type':Sequelize[_0x4fb8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 217924a..6e3e2a0 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 _0x4d0e=['getSubjects','getDescriptions','findOne','getTags','Tag','setTags','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','end','json','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','offset','order','sort','where','merge','filter','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','destroy','getFields','ZendeskField','pick'];(function(_0x53b133,_0x176261){var _0x5647e0=function(_0x4c62b0){while(--_0x4c62b0){_0x53b133['push'](_0x53b133['shift']());}};_0x5647e0(++_0x176261);}(_0x4d0e,0x1e6));var _0xe4d0=function(_0x2ded3e,_0x49d938){_0x2ded3e=_0x2ded3e-0x0;var _0x1e3312=_0x4d0e[_0x2ded3e];return _0x1e3312;};'use strict';var emlformat=require(_0xe4d0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe4d0('0x1'));var jsonpatch=require(_0xe4d0('0x2'));var rp=require(_0xe4d0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe4d0('0x4'));var util=require(_0xe4d0('0x5'));var path=require('path');var sox=require(_0xe4d0('0x6'));var csv=require(_0xe4d0('0x7'));var ejs=require(_0xe4d0('0x8'));var fs=require('fs');var fs_extra=require(_0xe4d0('0x9'));var _=require('lodash');var squel=require(_0xe4d0('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe4d0('0xb'));var toCsv=require('to-csv');var querystring=require(_0xe4d0('0xc'));var Papa=require(_0xe4d0('0xd'));var Redis=require('ioredis');var authService=require(_0xe4d0('0xe'));var qs=require(_0xe4d0('0xf'));var as=require(_0xe4d0('0x10'));var hardwareService=require(_0xe4d0('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xe4d0('0x12'));var config=require(_0xe4d0('0x13'));var licenseUtil=require(_0xe4d0('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3466a1,_0x2e4684){_0x2e4684=_0x2e4684||0xcc;return function(_0x35d07d){if(_0x35d07d){return _0x3466a1['sendStatus'](_0x2e4684);}return _0x3466a1[_0xe4d0('0x15')](_0x2e4684)[_0xe4d0('0x16')]();};}function respondWithResult(_0x3b5b26,_0x481e80){_0x481e80=_0x481e80||0xc8;return function(_0x3de2a3){if(_0x3de2a3){return _0x3b5b26[_0xe4d0('0x15')](_0x481e80)[_0xe4d0('0x17')](_0x3de2a3);}};}function respondWithFilteredResult(_0x56917e,_0x26e913){return function(_0x41305d){if(_0x41305d){var _0x440d0e=typeof _0x26e913['offset']==='undefined'&&typeof _0x26e913[_0xe4d0('0x18')]===_0xe4d0('0x19');var _0x1c8842=_0x41305d[_0xe4d0('0x1a')];var _0x2dff59=_0x440d0e?0x0:_0x26e913['offset'];var _0x3a4b19=_0x440d0e?_0x41305d[_0xe4d0('0x1a')]:_0x26e913['offset']+_0x26e913[_0xe4d0('0x18')];var _0xc54b4c;if(_0x3a4b19>=_0x1c8842){_0x3a4b19=_0x1c8842;_0xc54b4c=0xc8;}else{_0xc54b4c=0xce;}_0x56917e['status'](_0xc54b4c);return _0x56917e[_0xe4d0('0x1b')](_0xe4d0('0x1c'),_0x2dff59+'-'+_0x3a4b19+'/'+_0x1c8842)[_0xe4d0('0x17')](_0x41305d);}return null;};}function patchUpdates(_0x5d15bf){return function(_0x5ea9e8){try{jsonpatch[_0xe4d0('0x1d')](_0x5ea9e8,_0x5d15bf,!![]);}catch(_0x1ce8ee){return BPromise[_0xe4d0('0x1e')](_0x1ce8ee);}return _0x5ea9e8[_0xe4d0('0x1f')]();};}function saveUpdates(_0x4ecb2c,_0x236f67){return function(_0x56be56){if(_0x56be56){return _0x56be56[_0xe4d0('0x20')](_0x4ecb2c)[_0xe4d0('0x21')](function(_0x3cc1a5){return _0x3cc1a5;});}return null;};}function removeEntity(_0x223670,_0x49798b){return function(_0x3326d6){if(_0x3326d6){return _0x3326d6['destroy']()[_0xe4d0('0x21')](function(){_0x223670[_0xe4d0('0x15')](0xcc)[_0xe4d0('0x16')]();});}};}function handleEntityNotFound(_0x2201a6,_0x12ce6d){return function(_0x3ac41f){if(!_0x3ac41f){_0x2201a6['sendStatus'](0x194);}return _0x3ac41f;};}function handleError(_0x221f8b,_0x5dde81){_0x5dde81=_0x5dde81||0x1f4;return function(_0x402286){logger[_0xe4d0('0x22')](_0x402286['stack']);if(_0x402286['name']){delete _0x402286[_0xe4d0('0x23')];}_0x221f8b['status'](_0x5dde81)[_0xe4d0('0x24')](_0x402286);};}exports[_0xe4d0('0x25')]=function(_0x2313ad,_0x52b096){var _0x4acdfd={},_0x575b51={},_0x128b52={'count':0x0,'rows':[]};var _0x48f284=_[_0xe4d0('0x26')](db[_0xe4d0('0x27')][_0xe4d0('0x28')],function(_0x5d0c67){return{'name':_0x5d0c67[_0xe4d0('0x29')],'type':_0x5d0c67[_0xe4d0('0x2a')]['key']};});_0x575b51[_0xe4d0('0x2b')]=_['map'](_0x48f284,_0xe4d0('0x23'));_0x575b51['query']=_[_0xe4d0('0x2c')](_0x2313ad[_0xe4d0('0x2d')]);_0x575b51[_0xe4d0('0x2e')]=_['intersection'](_0x575b51[_0xe4d0('0x2b')],_0x575b51['query']);_0x4acdfd[_0xe4d0('0x2f')]=_[_0xe4d0('0x30')](_0x575b51['model'],qs['fields'](_0x2313ad[_0xe4d0('0x2d')][_0xe4d0('0x31')]));_0x4acdfd['attributes']=_0x4acdfd[_0xe4d0('0x2f')]['length']?_0x4acdfd[_0xe4d0('0x2f')]:_0x575b51[_0xe4d0('0x2b')];if(!_0x2313ad[_0xe4d0('0x2d')][_0xe4d0('0x32')](_0xe4d0('0x33'))){_0x4acdfd[_0xe4d0('0x18')]=qs['limit'](_0x2313ad[_0xe4d0('0x2d')]['limit']);_0x4acdfd[_0xe4d0('0x34')]=qs[_0xe4d0('0x34')](_0x2313ad[_0xe4d0('0x2d')][_0xe4d0('0x34')]);}_0x4acdfd[_0xe4d0('0x35')]=qs[_0xe4d0('0x36')](_0x2313ad[_0xe4d0('0x2d')][_0xe4d0('0x36')]);_0x4acdfd[_0xe4d0('0x37')]=qs[_0xe4d0('0x2e')](_['pick'](_0x2313ad[_0xe4d0('0x2d')],_0x575b51[_0xe4d0('0x2e')]),_0x48f284);if(_0x2313ad[_0xe4d0('0x2d')]['filter']){_0x4acdfd['where']=_[_0xe4d0('0x38')](_0x4acdfd['where'],{'$or':_[_0xe4d0('0x26')](_0x48f284,function(_0x3c53cc){if(_0x3c53cc[_0xe4d0('0x2a')]!=='VIRTUAL'){var _0x37a904={};_0x37a904[_0x3c53cc[_0xe4d0('0x23')]]={'$like':'%'+_0x2313ad[_0xe4d0('0x2d')][_0xe4d0('0x39')]+'%'};return _0x37a904;}})});}_0x4acdfd=_[_0xe4d0('0x38')]({},_0x4acdfd,_0x2313ad[_0xe4d0('0x3a')]);var _0x27f0d1={'where':_0x4acdfd['where']};return db[_0xe4d0('0x27')]['count'](_0x27f0d1)[_0xe4d0('0x21')](function(_0x4b2f3f){_0x128b52[_0xe4d0('0x1a')]=_0x4b2f3f;if(_0x2313ad[_0xe4d0('0x2d')]['includeAll']){_0x4acdfd[_0xe4d0('0x3b')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xe4d0('0x3c')](_0x4acdfd);})[_0xe4d0('0x21')](function(_0x14318a){_0x128b52[_0xe4d0('0x3d')]=_0x14318a;return _0x128b52;})['then'](respondWithFilteredResult(_0x52b096,_0x4acdfd))[_0xe4d0('0x3e')](handleError(_0x52b096,null));};exports[_0xe4d0('0x3f')]=function(_0x279337,_0xeefcab){var _0x4d0246={'raw':![],'where':{'id':_0x279337[_0xe4d0('0x40')]['id']}},_0x2ae1b5={};_0x2ae1b5[_0xe4d0('0x2b')]=_[_0xe4d0('0x2c')](db[_0xe4d0('0x27')][_0xe4d0('0x28')]);_0x2ae1b5[_0xe4d0('0x2d')]=_[_0xe4d0('0x2c')](_0x279337['query']);_0x2ae1b5[_0xe4d0('0x2e')]=_['intersection'](_0x2ae1b5[_0xe4d0('0x2b')],_0x2ae1b5[_0xe4d0('0x2d')]);_0x4d0246['attributes']=_['intersection'](_0x2ae1b5[_0xe4d0('0x2b')],qs[_0xe4d0('0x31')](_0x279337[_0xe4d0('0x2d')][_0xe4d0('0x31')]));_0x4d0246[_0xe4d0('0x2f')]=_0x4d0246[_0xe4d0('0x2f')][_0xe4d0('0x41')]?_0x4d0246[_0xe4d0('0x2f')]:_0x2ae1b5[_0xe4d0('0x2b')];if(_0x279337[_0xe4d0('0x2d')][_0xe4d0('0x42')]){_0x4d0246['include']=[{'all':!![]}];}_0x4d0246=_['merge']({},_0x4d0246,_0x279337[_0xe4d0('0x3a')]);return db['ZendeskConfiguration'][_0xe4d0('0x43')](_0x4d0246)[_0xe4d0('0x21')](handleEntityNotFound(_0xeefcab,null))['then'](respondWithResult(_0xeefcab,null))['catch'](handleError(_0xeefcab,null));};exports['create']=function(_0x567ecb,_0x42e15c){return db[_0xe4d0('0x27')][_0xe4d0('0x44')](_0x567ecb['body'],{})['then'](respondWithResult(_0x42e15c,0xc9))[_0xe4d0('0x3e')](handleError(_0x42e15c,null));};exports[_0xe4d0('0x20')]=function(_0x4dae32,_0x113e9f){if(_0x4dae32[_0xe4d0('0x45')]['id']){delete _0x4dae32[_0xe4d0('0x45')]['id'];}return db[_0xe4d0('0x27')][_0xe4d0('0x43')]({'where':{'id':_0x4dae32[_0xe4d0('0x40')]['id']}})['then'](handleEntityNotFound(_0x113e9f,null))['then'](saveUpdates(_0x4dae32['body'],null))['then'](respondWithResult(_0x113e9f,null))[_0xe4d0('0x3e')](handleError(_0x113e9f,null));};exports[_0xe4d0('0x46')]=function(_0x11609,_0x25f928){return db[_0xe4d0('0x27')][_0xe4d0('0x43')]({'where':{'id':_0x11609[_0xe4d0('0x40')]['id']}})[_0xe4d0('0x21')](handleEntityNotFound(_0x25f928,null))[_0xe4d0('0x21')](removeEntity(_0x25f928,null))[_0xe4d0('0x3e')](handleError(_0x25f928,null));};exports[_0xe4d0('0x47')]=function(_0x5cf204,_0x53bda0,_0x14fccb){var _0x20fa36={};var _0x549727={};var _0x4be078;var _0x226892;return db[_0xe4d0('0x27')]['findOne']({'where':{'id':_0x5cf204['params']['id']}})['then'](handleEntityNotFound(_0x53bda0,null))[_0xe4d0('0x21')](function(_0x8f5e90){if(_0x8f5e90){_0x4be078=_0x8f5e90;_0x549727[_0xe4d0('0x2b')]=_[_0xe4d0('0x2c')](db[_0xe4d0('0x48')][_0xe4d0('0x28')]);_0x549727[_0xe4d0('0x2d')]=_[_0xe4d0('0x2c')](_0x5cf204['query']);_0x549727[_0xe4d0('0x2e')]=_[_0xe4d0('0x30')](_0x549727[_0xe4d0('0x2b')],_0x549727[_0xe4d0('0x2d')]);_0x20fa36[_0xe4d0('0x2f')]=_['intersection'](_0x549727['model'],qs['fields'](_0x5cf204['query'][_0xe4d0('0x31')]));_0x20fa36['attributes']=_0x20fa36['attributes'][_0xe4d0('0x41')]?_0x20fa36[_0xe4d0('0x2f')]:_0x549727[_0xe4d0('0x2b')];_0x20fa36[_0xe4d0('0x35')]=qs['sort'](_0x5cf204[_0xe4d0('0x2d')][_0xe4d0('0x36')]);_0x20fa36['where']=qs[_0xe4d0('0x2e')](_[_0xe4d0('0x49')](_0x5cf204['query'],_0x549727[_0xe4d0('0x2e')]));if(_0x5cf204[_0xe4d0('0x2d')][_0xe4d0('0x39')]){_0x20fa36[_0xe4d0('0x37')]=_[_0xe4d0('0x38')](_0x20fa36[_0xe4d0('0x37')],{'$or':_[_0xe4d0('0x26')](_0x20fa36['attributes'],function(_0x14573d){var _0x1ee651={};_0x1ee651[_0x14573d]={'$like':'%'+_0x5cf204[_0xe4d0('0x2d')]['filter']+'%'};return _0x1ee651;})});}_0x20fa36=_[_0xe4d0('0x38')]({},_0x20fa36,_0x5cf204[_0xe4d0('0x3a')]);return _0x4be078[_0xe4d0('0x47')](_0x20fa36);}})[_0xe4d0('0x21')](function(_0x3be8b4){if(_0x3be8b4){_0x226892=_0x3be8b4['length'];if(!_0x5cf204['query'][_0xe4d0('0x32')](_0xe4d0('0x33'))){_0x20fa36[_0xe4d0('0x18')]=qs[_0xe4d0('0x18')](_0x5cf204[_0xe4d0('0x2d')][_0xe4d0('0x18')]);_0x20fa36[_0xe4d0('0x34')]=qs[_0xe4d0('0x34')](_0x5cf204[_0xe4d0('0x2d')]['offset']);}return _0x4be078[_0xe4d0('0x47')](_0x20fa36);}})[_0xe4d0('0x21')](function(_0x265b6a){if(_0x265b6a){return _0x265b6a?{'count':_0x226892,'rows':_0x265b6a}:null;}})[_0xe4d0('0x21')](respondWithResult(_0x53bda0,null))['catch'](handleError(_0x53bda0,null));};exports[_0xe4d0('0x4a')]=function(_0x565799,_0x548795,_0x1bb153){var _0x818f71={};var _0xa86504={};var _0x4298b9;var _0x434f8f;return db[_0xe4d0('0x27')]['findOne']({'where':{'id':_0x565799[_0xe4d0('0x40')]['id']}})[_0xe4d0('0x21')](handleEntityNotFound(_0x548795,null))[_0xe4d0('0x21')](function(_0xd31e05){if(_0xd31e05){_0x4298b9=_0xd31e05;_0xa86504['model']=_[_0xe4d0('0x2c')](db['ZendeskField'][_0xe4d0('0x28')]);_0xa86504[_0xe4d0('0x2d')]=_[_0xe4d0('0x2c')](_0x565799['query']);_0xa86504[_0xe4d0('0x2e')]=_[_0xe4d0('0x30')](_0xa86504[_0xe4d0('0x2b')],_0xa86504['query']);_0x818f71['attributes']=_[_0xe4d0('0x30')](_0xa86504[_0xe4d0('0x2b')],qs[_0xe4d0('0x31')](_0x565799['query'][_0xe4d0('0x31')]));_0x818f71[_0xe4d0('0x2f')]=_0x818f71[_0xe4d0('0x2f')]['length']?_0x818f71[_0xe4d0('0x2f')]:_0xa86504[_0xe4d0('0x2b')];_0x818f71['order']=qs[_0xe4d0('0x36')](_0x565799[_0xe4d0('0x2d')]['sort']);_0x818f71['where']=qs[_0xe4d0('0x2e')](_[_0xe4d0('0x49')](_0x565799[_0xe4d0('0x2d')],_0xa86504['filters']));if(_0x565799['query'][_0xe4d0('0x39')]){_0x818f71[_0xe4d0('0x37')]=_[_0xe4d0('0x38')](_0x818f71['where'],{'$or':_[_0xe4d0('0x26')](_0x818f71[_0xe4d0('0x2f')],function(_0x5e70b2){var _0xf1847={};_0xf1847[_0x5e70b2]={'$like':'%'+_0x565799[_0xe4d0('0x2d')]['filter']+'%'};return _0xf1847;})});}_0x818f71=_[_0xe4d0('0x38')]({},_0x818f71,_0x565799[_0xe4d0('0x3a')]);return _0x4298b9['getSubjects'](_0x818f71);}})[_0xe4d0('0x21')](function(_0x3567d6){if(_0x3567d6){_0x434f8f=_0x3567d6['length'];if(!_0x565799[_0xe4d0('0x2d')]['hasOwnProperty'](_0xe4d0('0x33'))){_0x818f71[_0xe4d0('0x18')]=qs[_0xe4d0('0x18')](_0x565799[_0xe4d0('0x2d')][_0xe4d0('0x18')]);_0x818f71[_0xe4d0('0x34')]=qs[_0xe4d0('0x34')](_0x565799[_0xe4d0('0x2d')][_0xe4d0('0x34')]);}return _0x4298b9[_0xe4d0('0x4a')](_0x818f71);}})[_0xe4d0('0x21')](function(_0x3a1024){if(_0x3a1024){return _0x3a1024?{'count':_0x434f8f,'rows':_0x3a1024}:null;}})[_0xe4d0('0x21')](respondWithResult(_0x548795,null))[_0xe4d0('0x3e')](handleError(_0x548795,null));};exports[_0xe4d0('0x4b')]=function(_0x52f40c,_0x3e3347,_0x363b93){var _0x42aab7={};var _0x2ecb3f={};var _0x2b5638;var _0x4f42f3;return db[_0xe4d0('0x27')][_0xe4d0('0x4c')]({'where':{'id':_0x52f40c[_0xe4d0('0x40')]['id']}})[_0xe4d0('0x21')](handleEntityNotFound(_0x3e3347,null))[_0xe4d0('0x21')](function(_0x510852){if(_0x510852){_0x2b5638=_0x510852;_0x2ecb3f[_0xe4d0('0x2b')]=_[_0xe4d0('0x2c')](db[_0xe4d0('0x48')][_0xe4d0('0x28')]);_0x2ecb3f[_0xe4d0('0x2d')]=_['keys'](_0x52f40c[_0xe4d0('0x2d')]);_0x2ecb3f['filters']=_[_0xe4d0('0x30')](_0x2ecb3f[_0xe4d0('0x2b')],_0x2ecb3f[_0xe4d0('0x2d')]);_0x42aab7['attributes']=_[_0xe4d0('0x30')](_0x2ecb3f[_0xe4d0('0x2b')],qs['fields'](_0x52f40c['query'][_0xe4d0('0x31')]));_0x42aab7[_0xe4d0('0x2f')]=_0x42aab7[_0xe4d0('0x2f')][_0xe4d0('0x41')]?_0x42aab7[_0xe4d0('0x2f')]:_0x2ecb3f[_0xe4d0('0x2b')];_0x42aab7['order']=qs[_0xe4d0('0x36')](_0x52f40c[_0xe4d0('0x2d')][_0xe4d0('0x36')]);_0x42aab7[_0xe4d0('0x37')]=qs[_0xe4d0('0x2e')](_[_0xe4d0('0x49')](_0x52f40c[_0xe4d0('0x2d')],_0x2ecb3f[_0xe4d0('0x2e')]));if(_0x52f40c['query'][_0xe4d0('0x39')]){_0x42aab7[_0xe4d0('0x37')]=_[_0xe4d0('0x38')](_0x42aab7[_0xe4d0('0x37')],{'$or':_[_0xe4d0('0x26')](_0x42aab7[_0xe4d0('0x2f')],function(_0x1f4086){var _0x2e0d83={};_0x2e0d83[_0x1f4086]={'$like':'%'+_0x52f40c['query'][_0xe4d0('0x39')]+'%'};return _0x2e0d83;})});}_0x42aab7=_['merge']({},_0x42aab7,_0x52f40c[_0xe4d0('0x3a')]);return _0x2b5638[_0xe4d0('0x4b')](_0x42aab7);}})['then'](function(_0x15bef0){if(_0x15bef0){_0x4f42f3=_0x15bef0[_0xe4d0('0x41')];if(!_0x52f40c[_0xe4d0('0x2d')][_0xe4d0('0x32')](_0xe4d0('0x33'))){_0x42aab7[_0xe4d0('0x18')]=qs[_0xe4d0('0x18')](_0x52f40c[_0xe4d0('0x2d')][_0xe4d0('0x18')]);_0x42aab7['offset']=qs[_0xe4d0('0x34')](_0x52f40c[_0xe4d0('0x2d')]['offset']);}return _0x2b5638[_0xe4d0('0x4b')](_0x42aab7);}})[_0xe4d0('0x21')](function(_0x296dca){if(_0x296dca){return _0x296dca?{'count':_0x4f42f3,'rows':_0x296dca}:null;}})['then'](respondWithResult(_0x3e3347,null))[_0xe4d0('0x3e')](handleError(_0x3e3347,null));};exports[_0xe4d0('0x4d')]=function(_0x547d0d,_0x1bf6ac,_0x49fd6f){var _0x51faaf={};var _0x564afb={};var _0x214070;var _0x245f24;return db[_0xe4d0('0x27')][_0xe4d0('0x4c')]({'where':{'id':_0x547d0d[_0xe4d0('0x40')]['id']}})[_0xe4d0('0x21')](handleEntityNotFound(_0x1bf6ac,null))[_0xe4d0('0x21')](function(_0x24c825){if(_0x24c825){_0x214070=_0x24c825;_0x564afb[_0xe4d0('0x2b')]=_[_0xe4d0('0x2c')](db[_0xe4d0('0x4e')][_0xe4d0('0x28')]);_0x564afb[_0xe4d0('0x2d')]=_[_0xe4d0('0x2c')](_0x547d0d[_0xe4d0('0x2d')]);_0x564afb[_0xe4d0('0x2e')]=_['intersection'](_0x564afb[_0xe4d0('0x2b')],_0x564afb['query']);_0x51faaf[_0xe4d0('0x2f')]=_[_0xe4d0('0x30')](_0x564afb[_0xe4d0('0x2b')],qs[_0xe4d0('0x31')](_0x547d0d[_0xe4d0('0x2d')][_0xe4d0('0x31')]));_0x51faaf[_0xe4d0('0x2f')]=_0x51faaf[_0xe4d0('0x2f')][_0xe4d0('0x41')]?_0x51faaf['attributes']:_0x564afb[_0xe4d0('0x2b')];_0x51faaf[_0xe4d0('0x35')]=qs[_0xe4d0('0x36')](_0x547d0d['query'][_0xe4d0('0x36')]);_0x51faaf[_0xe4d0('0x37')]=qs[_0xe4d0('0x2e')](_[_0xe4d0('0x49')](_0x547d0d[_0xe4d0('0x2d')],_0x564afb[_0xe4d0('0x2e')]));if(_0x547d0d[_0xe4d0('0x2d')][_0xe4d0('0x39')]){_0x51faaf['where']=_['merge'](_0x51faaf[_0xe4d0('0x37')],{'$or':_[_0xe4d0('0x26')](_0x51faaf[_0xe4d0('0x2f')],function(_0xf5d23f){var _0xe1b7={};_0xe1b7[_0xf5d23f]={'$like':'%'+_0x547d0d[_0xe4d0('0x2d')][_0xe4d0('0x39')]+'%'};return _0xe1b7;})});}_0x51faaf=_['merge']({},_0x51faaf,_0x547d0d[_0xe4d0('0x3a')]);return _0x214070[_0xe4d0('0x4d')](_0x51faaf);}})['then'](function(_0x3b5868){if(_0x3b5868){_0x245f24=_0x3b5868[_0xe4d0('0x41')];if(!_0x547d0d['query'][_0xe4d0('0x32')](_0xe4d0('0x33'))){_0x51faaf[_0xe4d0('0x18')]=qs[_0xe4d0('0x18')](_0x547d0d[_0xe4d0('0x2d')][_0xe4d0('0x18')]);_0x51faaf[_0xe4d0('0x34')]=qs[_0xe4d0('0x34')](_0x547d0d[_0xe4d0('0x2d')][_0xe4d0('0x34')]);}return _0x214070['getTags'](_0x51faaf);}})[_0xe4d0('0x21')](function(_0x528a50){if(_0x528a50){return _0x528a50?{'count':_0x245f24,'rows':_0x528a50}:null;}})['then'](respondWithResult(_0x1bf6ac,null))['catch'](handleError(_0x1bf6ac,null));};exports[_0xe4d0('0x4f')]=function(_0x24c4c7,_0xf9e0ce,_0x234dad){if(_0x24c4c7[_0xe4d0('0x45')]['id']){delete _0x24c4c7['body']['id'];}return db['ZendeskConfiguration'][_0xe4d0('0x4c')]({'where':{'id':_0x24c4c7[_0xe4d0('0x40')]['id']}})['then'](handleEntityNotFound(_0xf9e0ce,null))['then'](function(_0x4763ac){if(_0x4763ac){return _0x4763ac['setTags'](_0x24c4c7[_0xe4d0('0x45')]['ids']||[]);}return null;})[_0xe4d0('0x21')](respondWithResult(_0xf9e0ce,null))[_0xe4d0('0x3e')](handleError(_0xf9e0ce,null));}; \ No newline at end of file +var _0x4bd6=['desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','ZendeskConfiguration','includeAll','include','rows','show','params','options','catch','create','body','find','findOne','ZendeskField','getFields','getSubjects','getDescriptions','getTags','setTags','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce'];(function(_0xbd8ca9,_0x74ca58){var _0x119dca=function(_0x263a9b){while(--_0x263a9b){_0xbd8ca9['push'](_0xbd8ca9['shift']());}};_0x119dca(++_0x74ca58);}(_0x4bd6,0x197));var _0x64bd=function(_0x39437c,_0x4eedbd){_0x39437c=_0x39437c-0x0;var _0x52047d=_0x4bd6[_0x39437c];return _0x52047d;};'use strict';var emlformat=require(_0x64bd('0x0'));var rimraf=require(_0x64bd('0x1'));var zipdir=require(_0x64bd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x64bd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x64bd('0x4'));var util=require(_0x64bd('0x5'));var path=require(_0x64bd('0x6'));var sox=require(_0x64bd('0x7'));var csv=require(_0x64bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x64bd('0x9'));var _=require(_0x64bd('0xa'));var squel=require(_0x64bd('0xb'));var crypto=require('crypto');var jsforce=require(_0x64bd('0xc'));var deskjs=require(_0x64bd('0xd'));var toCsv=require('to-csv');var querystring=require(_0x64bd('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x64bd('0xf'));var qs=require(_0x64bd('0x10'));var as=require(_0x64bd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x64bd('0x12'))(_0x64bd('0x13'));var utils=require(_0x64bd('0x14'));var config=require(_0x64bd('0x15'));var licenseUtil=require(_0x64bd('0x16'));var db=require(_0x64bd('0x17'))['db'];function respondWithStatusCode(_0x135cc7,_0x3ef6b8){_0x3ef6b8=_0x3ef6b8||0xcc;return function(_0x1d1727){if(_0x1d1727){return _0x135cc7[_0x64bd('0x18')](_0x3ef6b8);}return _0x135cc7[_0x64bd('0x19')](_0x3ef6b8)[_0x64bd('0x1a')]();};}function respondWithResult(_0x9ff13b,_0x1f17c1){_0x1f17c1=_0x1f17c1||0xc8;return function(_0x57c869){if(_0x57c869){return _0x9ff13b[_0x64bd('0x19')](_0x1f17c1)[_0x64bd('0x1b')](_0x57c869);}};}function respondWithFilteredResult(_0x2a466f,_0x22f08e){return function(_0x1c8833){if(_0x1c8833){var _0xd7e432=typeof _0x22f08e[_0x64bd('0x1c')]===_0x64bd('0x1d')&&typeof _0x22f08e[_0x64bd('0x1e')]===_0x64bd('0x1d');var _0x355861=_0x1c8833[_0x64bd('0x1f')];var _0x1377fc=_0xd7e432?0x0:_0x22f08e[_0x64bd('0x1c')];var _0x41daaf=_0xd7e432?_0x1c8833['count']:_0x22f08e['offset']+_0x22f08e[_0x64bd('0x1e')];var _0x353c4a;if(_0x41daaf>=_0x355861){_0x41daaf=_0x355861;_0x353c4a=0xc8;}else{_0x353c4a=0xce;}_0x2a466f[_0x64bd('0x19')](_0x353c4a);return _0x2a466f[_0x64bd('0x20')](_0x64bd('0x21'),_0x1377fc+'-'+_0x41daaf+'/'+_0x355861)['json'](_0x1c8833);}return null;};}function patchUpdates(_0x3c6bbd){return function(_0x2839bd){try{jsonpatch[_0x64bd('0x22')](_0x2839bd,_0x3c6bbd,!![]);}catch(_0x5076d2){return BPromise[_0x64bd('0x23')](_0x5076d2);}return _0x2839bd['save']();};}function saveUpdates(_0x474f80,_0x1c3609){return function(_0x3131f8){if(_0x3131f8){return _0x3131f8[_0x64bd('0x24')](_0x474f80)['then'](function(_0x59b0e0){return _0x59b0e0;});}return null;};}function removeEntity(_0x5180da,_0x4c2754){return function(_0x52a227){if(_0x52a227){return _0x52a227[_0x64bd('0x25')]()[_0x64bd('0x26')](function(){_0x5180da[_0x64bd('0x19')](0xcc)[_0x64bd('0x1a')]();});}};}function handleEntityNotFound(_0x59362e,_0x1d0c82){return function(_0x2752de){if(!_0x2752de){_0x59362e[_0x64bd('0x18')](0x194);}return _0x2752de;};}function handleError(_0x23210c,_0x193d52){_0x193d52=_0x193d52||0x1f4;return function(_0x166e94){logger[_0x64bd('0x27')](_0x166e94[_0x64bd('0x28')]);if(_0x166e94[_0x64bd('0x29')]){delete _0x166e94['name'];}_0x23210c[_0x64bd('0x19')](_0x193d52)[_0x64bd('0x2a')](_0x166e94);};}exports[_0x64bd('0x2b')]=function(_0xa73c50,_0x311c32){var _0x43c045={},_0x83a64={},_0xa13602={'count':0x0,'rows':[]};var _0x499644=_[_0x64bd('0x2c')](db['ZendeskConfiguration'][_0x64bd('0x2d')],function(_0x2a98c6){return{'name':_0x2a98c6[_0x64bd('0x2e')],'type':_0x2a98c6[_0x64bd('0x2f')][_0x64bd('0x30')]};});_0x83a64[_0x64bd('0x31')]=_[_0x64bd('0x2c')](_0x499644,'name');_0x83a64[_0x64bd('0x32')]=_[_0x64bd('0x33')](_0xa73c50[_0x64bd('0x32')]);_0x83a64[_0x64bd('0x34')]=_[_0x64bd('0x35')](_0x83a64['model'],_0x83a64[_0x64bd('0x32')]);_0x43c045[_0x64bd('0x36')]=_[_0x64bd('0x35')](_0x83a64['model'],qs[_0x64bd('0x37')](_0xa73c50[_0x64bd('0x32')][_0x64bd('0x37')]));_0x43c045[_0x64bd('0x36')]=_0x43c045[_0x64bd('0x36')][_0x64bd('0x38')]?_0x43c045[_0x64bd('0x36')]:_0x83a64[_0x64bd('0x31')];if(!_0xa73c50[_0x64bd('0x32')][_0x64bd('0x39')](_0x64bd('0x3a'))){_0x43c045[_0x64bd('0x1e')]=qs['limit'](_0xa73c50[_0x64bd('0x32')]['limit']);_0x43c045[_0x64bd('0x1c')]=qs[_0x64bd('0x1c')](_0xa73c50[_0x64bd('0x32')][_0x64bd('0x1c')]);}_0x43c045[_0x64bd('0x3b')]=qs[_0x64bd('0x3c')](_0xa73c50[_0x64bd('0x32')]['sort']);_0x43c045[_0x64bd('0x3d')]=qs['filters'](_[_0x64bd('0x3e')](_0xa73c50[_0x64bd('0x32')],_0x83a64[_0x64bd('0x34')]),_0x499644);if(_0xa73c50[_0x64bd('0x32')][_0x64bd('0x3f')]){_0x43c045[_0x64bd('0x3d')]=_['merge'](_0x43c045['where'],{'$or':_[_0x64bd('0x2c')](_0x499644,function(_0x4d185a){if(_0x4d185a['type']!==_0x64bd('0x40')){var _0x542ce0={};_0x542ce0[_0x4d185a['name']]={'$like':'%'+_0xa73c50[_0x64bd('0x32')][_0x64bd('0x3f')]+'%'};return _0x542ce0;}})});}_0x43c045=_[_0x64bd('0x41')]({},_0x43c045,_0xa73c50['options']);var _0x1ad35f={'where':_0x43c045['where']};return db[_0x64bd('0x42')][_0x64bd('0x1f')](_0x1ad35f)[_0x64bd('0x26')](function(_0x167b20){_0xa13602[_0x64bd('0x1f')]=_0x167b20;if(_0xa73c50[_0x64bd('0x32')][_0x64bd('0x43')]){_0x43c045[_0x64bd('0x44')]=[{'all':!![]}];}return db[_0x64bd('0x42')]['findAll'](_0x43c045);})[_0x64bd('0x26')](function(_0x256d21){_0xa13602[_0x64bd('0x45')]=_0x256d21;return _0xa13602;})['then'](respondWithFilteredResult(_0x311c32,_0x43c045))['catch'](handleError(_0x311c32,null));};exports[_0x64bd('0x46')]=function(_0x39b1d2,_0xe40c33){var _0x54f023={'raw':![],'where':{'id':_0x39b1d2[_0x64bd('0x47')]['id']}},_0x25cdf8={};_0x25cdf8[_0x64bd('0x31')]=_[_0x64bd('0x33')](db[_0x64bd('0x42')][_0x64bd('0x2d')]);_0x25cdf8['query']=_[_0x64bd('0x33')](_0x39b1d2[_0x64bd('0x32')]);_0x25cdf8[_0x64bd('0x34')]=_[_0x64bd('0x35')](_0x25cdf8[_0x64bd('0x31')],_0x25cdf8['query']);_0x54f023[_0x64bd('0x36')]=_[_0x64bd('0x35')](_0x25cdf8[_0x64bd('0x31')],qs['fields'](_0x39b1d2['query'][_0x64bd('0x37')]));_0x54f023[_0x64bd('0x36')]=_0x54f023[_0x64bd('0x36')][_0x64bd('0x38')]?_0x54f023['attributes']:_0x25cdf8['model'];if(_0x39b1d2[_0x64bd('0x32')][_0x64bd('0x43')]){_0x54f023[_0x64bd('0x44')]=[{'all':!![]}];}_0x54f023=_[_0x64bd('0x41')]({},_0x54f023,_0x39b1d2[_0x64bd('0x48')]);return db[_0x64bd('0x42')]['find'](_0x54f023)[_0x64bd('0x26')](handleEntityNotFound(_0xe40c33,null))[_0x64bd('0x26')](respondWithResult(_0xe40c33,null))[_0x64bd('0x49')](handleError(_0xe40c33,null));};exports[_0x64bd('0x4a')]=function(_0x4a60e3,_0x3669e5){return db[_0x64bd('0x42')][_0x64bd('0x4a')](_0x4a60e3[_0x64bd('0x4b')],{})[_0x64bd('0x26')](respondWithResult(_0x3669e5,0xc9))[_0x64bd('0x49')](handleError(_0x3669e5,null));};exports[_0x64bd('0x24')]=function(_0x59add1,_0x88ff37){if(_0x59add1['body']['id']){delete _0x59add1[_0x64bd('0x4b')]['id'];}return db['ZendeskConfiguration'][_0x64bd('0x4c')]({'where':{'id':_0x59add1[_0x64bd('0x47')]['id']}})[_0x64bd('0x26')](handleEntityNotFound(_0x88ff37,null))[_0x64bd('0x26')](saveUpdates(_0x59add1['body'],null))[_0x64bd('0x26')](respondWithResult(_0x88ff37,null))[_0x64bd('0x49')](handleError(_0x88ff37,null));};exports[_0x64bd('0x25')]=function(_0x4b88a9,_0x70975a){return db[_0x64bd('0x42')][_0x64bd('0x4c')]({'where':{'id':_0x4b88a9[_0x64bd('0x47')]['id']}})[_0x64bd('0x26')](handleEntityNotFound(_0x70975a,null))[_0x64bd('0x26')](removeEntity(_0x70975a,null))['catch'](handleError(_0x70975a,null));};exports['getFields']=function(_0x36c1e4,_0xa30cbc,_0x46c0ff){var _0x59f0fc={};var _0x3dbeea={};var _0x4b832b;var _0x26cb40;return db[_0x64bd('0x42')][_0x64bd('0x4d')]({'where':{'id':_0x36c1e4['params']['id']}})[_0x64bd('0x26')](handleEntityNotFound(_0xa30cbc,null))[_0x64bd('0x26')](function(_0x9b35a4){if(_0x9b35a4){_0x4b832b=_0x9b35a4;_0x3dbeea[_0x64bd('0x31')]=_[_0x64bd('0x33')](db[_0x64bd('0x4e')][_0x64bd('0x2d')]);_0x3dbeea[_0x64bd('0x32')]=_[_0x64bd('0x33')](_0x36c1e4[_0x64bd('0x32')]);_0x3dbeea['filters']=_[_0x64bd('0x35')](_0x3dbeea[_0x64bd('0x31')],_0x3dbeea[_0x64bd('0x32')]);_0x59f0fc[_0x64bd('0x36')]=_[_0x64bd('0x35')](_0x3dbeea[_0x64bd('0x31')],qs[_0x64bd('0x37')](_0x36c1e4[_0x64bd('0x32')][_0x64bd('0x37')]));_0x59f0fc[_0x64bd('0x36')]=_0x59f0fc['attributes'][_0x64bd('0x38')]?_0x59f0fc['attributes']:_0x3dbeea[_0x64bd('0x31')];_0x59f0fc[_0x64bd('0x3b')]=qs[_0x64bd('0x3c')](_0x36c1e4[_0x64bd('0x32')][_0x64bd('0x3c')]);_0x59f0fc[_0x64bd('0x3d')]=qs[_0x64bd('0x34')](_['pick'](_0x36c1e4[_0x64bd('0x32')],_0x3dbeea[_0x64bd('0x34')]));if(_0x36c1e4[_0x64bd('0x32')][_0x64bd('0x3f')]){_0x59f0fc[_0x64bd('0x3d')]=_[_0x64bd('0x41')](_0x59f0fc[_0x64bd('0x3d')],{'$or':_[_0x64bd('0x2c')](_0x59f0fc[_0x64bd('0x36')],function(_0x10ce3e){var _0x35759f={};_0x35759f[_0x10ce3e]={'$like':'%'+_0x36c1e4[_0x64bd('0x32')][_0x64bd('0x3f')]+'%'};return _0x35759f;})});}_0x59f0fc=_[_0x64bd('0x41')]({},_0x59f0fc,_0x36c1e4['options']);return _0x4b832b[_0x64bd('0x4f')](_0x59f0fc);}})[_0x64bd('0x26')](function(_0x13c367){if(_0x13c367){_0x26cb40=_0x13c367[_0x64bd('0x38')];if(!_0x36c1e4['query'][_0x64bd('0x39')](_0x64bd('0x3a'))){_0x59f0fc['limit']=qs['limit'](_0x36c1e4['query'][_0x64bd('0x1e')]);_0x59f0fc['offset']=qs[_0x64bd('0x1c')](_0x36c1e4['query'][_0x64bd('0x1c')]);}return _0x4b832b[_0x64bd('0x4f')](_0x59f0fc);}})[_0x64bd('0x26')](function(_0xa62e47){if(_0xa62e47){return _0xa62e47?{'count':_0x26cb40,'rows':_0xa62e47}:null;}})[_0x64bd('0x26')](respondWithResult(_0xa30cbc,null))['catch'](handleError(_0xa30cbc,null));};exports[_0x64bd('0x50')]=function(_0x1852df,_0x1d5e53,_0x4ac2cd){var _0x3b2f42={};var _0x5ef333={};var _0xfba1d2;var _0x371d35;return db[_0x64bd('0x42')]['findOne']({'where':{'id':_0x1852df[_0x64bd('0x47')]['id']}})[_0x64bd('0x26')](handleEntityNotFound(_0x1d5e53,null))['then'](function(_0x53e244){if(_0x53e244){_0xfba1d2=_0x53e244;_0x5ef333[_0x64bd('0x31')]=_[_0x64bd('0x33')](db[_0x64bd('0x4e')][_0x64bd('0x2d')]);_0x5ef333[_0x64bd('0x32')]=_[_0x64bd('0x33')](_0x1852df[_0x64bd('0x32')]);_0x5ef333['filters']=_[_0x64bd('0x35')](_0x5ef333[_0x64bd('0x31')],_0x5ef333[_0x64bd('0x32')]);_0x3b2f42[_0x64bd('0x36')]=_[_0x64bd('0x35')](_0x5ef333[_0x64bd('0x31')],qs[_0x64bd('0x37')](_0x1852df[_0x64bd('0x32')][_0x64bd('0x37')]));_0x3b2f42['attributes']=_0x3b2f42[_0x64bd('0x36')][_0x64bd('0x38')]?_0x3b2f42['attributes']:_0x5ef333[_0x64bd('0x31')];_0x3b2f42[_0x64bd('0x3b')]=qs['sort'](_0x1852df[_0x64bd('0x32')]['sort']);_0x3b2f42['where']=qs['filters'](_[_0x64bd('0x3e')](_0x1852df[_0x64bd('0x32')],_0x5ef333[_0x64bd('0x34')]));if(_0x1852df[_0x64bd('0x32')][_0x64bd('0x3f')]){_0x3b2f42[_0x64bd('0x3d')]=_['merge'](_0x3b2f42[_0x64bd('0x3d')],{'$or':_[_0x64bd('0x2c')](_0x3b2f42['attributes'],function(_0x2563d5){var _0x450c39={};_0x450c39[_0x2563d5]={'$like':'%'+_0x1852df[_0x64bd('0x32')][_0x64bd('0x3f')]+'%'};return _0x450c39;})});}_0x3b2f42=_['merge']({},_0x3b2f42,_0x1852df[_0x64bd('0x48')]);return _0xfba1d2[_0x64bd('0x50')](_0x3b2f42);}})[_0x64bd('0x26')](function(_0x1436d2){if(_0x1436d2){_0x371d35=_0x1436d2[_0x64bd('0x38')];if(!_0x1852df[_0x64bd('0x32')][_0x64bd('0x39')]('nolimit')){_0x3b2f42[_0x64bd('0x1e')]=qs[_0x64bd('0x1e')](_0x1852df[_0x64bd('0x32')]['limit']);_0x3b2f42[_0x64bd('0x1c')]=qs[_0x64bd('0x1c')](_0x1852df[_0x64bd('0x32')][_0x64bd('0x1c')]);}return _0xfba1d2[_0x64bd('0x50')](_0x3b2f42);}})[_0x64bd('0x26')](function(_0x2e5a9a){if(_0x2e5a9a){return _0x2e5a9a?{'count':_0x371d35,'rows':_0x2e5a9a}:null;}})[_0x64bd('0x26')](respondWithResult(_0x1d5e53,null))[_0x64bd('0x49')](handleError(_0x1d5e53,null));};exports[_0x64bd('0x51')]=function(_0x4f4d7a,_0x1f4b20,_0x4f1d42){var _0x465d9d={};var _0x7138e0={};var _0x37e0d2;var _0x237d0c;return db[_0x64bd('0x42')][_0x64bd('0x4d')]({'where':{'id':_0x4f4d7a['params']['id']}})['then'](handleEntityNotFound(_0x1f4b20,null))[_0x64bd('0x26')](function(_0xe9c59){if(_0xe9c59){_0x37e0d2=_0xe9c59;_0x7138e0['model']=_[_0x64bd('0x33')](db['ZendeskField'][_0x64bd('0x2d')]);_0x7138e0[_0x64bd('0x32')]=_[_0x64bd('0x33')](_0x4f4d7a[_0x64bd('0x32')]);_0x7138e0[_0x64bd('0x34')]=_[_0x64bd('0x35')](_0x7138e0[_0x64bd('0x31')],_0x7138e0[_0x64bd('0x32')]);_0x465d9d['attributes']=_['intersection'](_0x7138e0[_0x64bd('0x31')],qs[_0x64bd('0x37')](_0x4f4d7a['query'][_0x64bd('0x37')]));_0x465d9d[_0x64bd('0x36')]=_0x465d9d[_0x64bd('0x36')][_0x64bd('0x38')]?_0x465d9d[_0x64bd('0x36')]:_0x7138e0[_0x64bd('0x31')];_0x465d9d['order']=qs[_0x64bd('0x3c')](_0x4f4d7a[_0x64bd('0x32')][_0x64bd('0x3c')]);_0x465d9d[_0x64bd('0x3d')]=qs[_0x64bd('0x34')](_[_0x64bd('0x3e')](_0x4f4d7a[_0x64bd('0x32')],_0x7138e0[_0x64bd('0x34')]));if(_0x4f4d7a[_0x64bd('0x32')][_0x64bd('0x3f')]){_0x465d9d[_0x64bd('0x3d')]=_[_0x64bd('0x41')](_0x465d9d['where'],{'$or':_['map'](_0x465d9d['attributes'],function(_0x54cf66){var _0x4b0ab9={};_0x4b0ab9[_0x54cf66]={'$like':'%'+_0x4f4d7a[_0x64bd('0x32')][_0x64bd('0x3f')]+'%'};return _0x4b0ab9;})});}_0x465d9d=_['merge']({},_0x465d9d,_0x4f4d7a[_0x64bd('0x48')]);return _0x37e0d2[_0x64bd('0x51')](_0x465d9d);}})[_0x64bd('0x26')](function(_0x2c31ab){if(_0x2c31ab){_0x237d0c=_0x2c31ab[_0x64bd('0x38')];if(!_0x4f4d7a[_0x64bd('0x32')][_0x64bd('0x39')]('nolimit')){_0x465d9d[_0x64bd('0x1e')]=qs[_0x64bd('0x1e')](_0x4f4d7a[_0x64bd('0x32')][_0x64bd('0x1e')]);_0x465d9d[_0x64bd('0x1c')]=qs[_0x64bd('0x1c')](_0x4f4d7a[_0x64bd('0x32')][_0x64bd('0x1c')]);}return _0x37e0d2[_0x64bd('0x51')](_0x465d9d);}})['then'](function(_0x30c5b1){if(_0x30c5b1){return _0x30c5b1?{'count':_0x237d0c,'rows':_0x30c5b1}:null;}})[_0x64bd('0x26')](respondWithResult(_0x1f4b20,null))[_0x64bd('0x49')](handleError(_0x1f4b20,null));};exports[_0x64bd('0x52')]=function(_0x5c51c5,_0x4f2f68,_0x40a658){var _0x3d2bf5={};var _0x4f498e={};var _0x5c92f9;var _0x3898db;return db['ZendeskConfiguration'][_0x64bd('0x4d')]({'where':{'id':_0x5c51c5[_0x64bd('0x47')]['id']}})['then'](handleEntityNotFound(_0x4f2f68,null))['then'](function(_0x5bb065){if(_0x5bb065){_0x5c92f9=_0x5bb065;_0x4f498e[_0x64bd('0x31')]=_[_0x64bd('0x33')](db['Tag'][_0x64bd('0x2d')]);_0x4f498e[_0x64bd('0x32')]=_[_0x64bd('0x33')](_0x5c51c5[_0x64bd('0x32')]);_0x4f498e['filters']=_[_0x64bd('0x35')](_0x4f498e[_0x64bd('0x31')],_0x4f498e[_0x64bd('0x32')]);_0x3d2bf5[_0x64bd('0x36')]=_[_0x64bd('0x35')](_0x4f498e[_0x64bd('0x31')],qs['fields'](_0x5c51c5[_0x64bd('0x32')][_0x64bd('0x37')]));_0x3d2bf5[_0x64bd('0x36')]=_0x3d2bf5[_0x64bd('0x36')][_0x64bd('0x38')]?_0x3d2bf5[_0x64bd('0x36')]:_0x4f498e[_0x64bd('0x31')];_0x3d2bf5[_0x64bd('0x3b')]=qs[_0x64bd('0x3c')](_0x5c51c5[_0x64bd('0x32')][_0x64bd('0x3c')]);_0x3d2bf5[_0x64bd('0x3d')]=qs[_0x64bd('0x34')](_[_0x64bd('0x3e')](_0x5c51c5[_0x64bd('0x32')],_0x4f498e[_0x64bd('0x34')]));if(_0x5c51c5[_0x64bd('0x32')][_0x64bd('0x3f')]){_0x3d2bf5['where']=_[_0x64bd('0x41')](_0x3d2bf5[_0x64bd('0x3d')],{'$or':_['map'](_0x3d2bf5['attributes'],function(_0x2c4b0e){var _0x25cc53={};_0x25cc53[_0x2c4b0e]={'$like':'%'+_0x5c51c5['query'][_0x64bd('0x3f')]+'%'};return _0x25cc53;})});}_0x3d2bf5=_['merge']({},_0x3d2bf5,_0x5c51c5[_0x64bd('0x48')]);return _0x5c92f9[_0x64bd('0x52')](_0x3d2bf5);}})['then'](function(_0x2aa083){if(_0x2aa083){_0x3898db=_0x2aa083['length'];if(!_0x5c51c5[_0x64bd('0x32')][_0x64bd('0x39')](_0x64bd('0x3a'))){_0x3d2bf5[_0x64bd('0x1e')]=qs[_0x64bd('0x1e')](_0x5c51c5[_0x64bd('0x32')]['limit']);_0x3d2bf5[_0x64bd('0x1c')]=qs[_0x64bd('0x1c')](_0x5c51c5[_0x64bd('0x32')][_0x64bd('0x1c')]);}return _0x5c92f9[_0x64bd('0x52')](_0x3d2bf5);}})['then'](function(_0x3521e9){if(_0x3521e9){return _0x3521e9?{'count':_0x3898db,'rows':_0x3521e9}:null;}})['then'](respondWithResult(_0x4f2f68,null))[_0x64bd('0x49')](handleError(_0x4f2f68,null));};exports[_0x64bd('0x53')]=function(_0x144307,_0x57d6e5,_0x5b3d10){if(_0x144307[_0x64bd('0x4b')]['id']){delete _0x144307[_0x64bd('0x4b')]['id'];}return db[_0x64bd('0x42')][_0x64bd('0x4d')]({'where':{'id':_0x144307[_0x64bd('0x47')]['id']}})[_0x64bd('0x26')](handleEntityNotFound(_0x57d6e5,null))[_0x64bd('0x26')](function(_0x4e6e80){if(_0x4e6e80){return _0x4e6e80[_0x64bd('0x53')](_0x144307['body']['ids']||[]);}return null;})[_0x64bd('0x26')](respondWithResult(_0x57d6e5,null))[_0x64bd('0x49')](handleError(_0x57d6e5,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index ea70e35..4b9f786 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 _0x8e3f=['request-promise','rimraf','../../config/environment','exports','define','int_zendesk_configurations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x5c8879,_0x2b73cc){var _0x34bf6b=function(_0x506896){while(--_0x506896){_0x5c8879['push'](_0x5c8879['shift']());}};_0x34bf6b(++_0x2b73cc);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x8e3f[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var logger=require(_0xf8e3('0x2'))('api');var moment=require(_0xf8e3('0x3'));var BPromise=require(_0xf8e3('0x4'));var rp=require(_0xf8e3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf8e3('0x6'));var config=require(_0xf8e3('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xf8e3('0x8')]=function(_0xb21f8d,_0x2621c5){return _0xb21f8d[_0xf8e3('0x9')]('ZendeskConfiguration',attributes,{'tableName':_0xf8e3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb78e=['ZendeskConfiguration','int_zendesk_configurations','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','define'];(function(_0x5431ab,_0x4c7b68){var _0x503a1f=function(_0x3d90b5){while(--_0x3d90b5){_0x5431ab['push'](_0x5431ab['shift']());}};_0x503a1f(++_0x4c7b68);}(_0xb78e,0x1c9));var _0xeb78=function(_0x5a34ae,_0x5682d8){_0x5a34ae=_0x5a34ae-0x0;var _0x2841d7=_0xb78e[_0x5a34ae];return _0x2841d7;};'use strict';var _=require(_0xeb78('0x0'));var util=require(_0xeb78('0x1'));var logger=require('../../config/logger')(_0xeb78('0x2'));var moment=require(_0xeb78('0x3'));var BPromise=require(_0xeb78('0x4'));var rp=require(_0xeb78('0x5'));var fs=require('fs');var path=require(_0xeb78('0x6'));var rimraf=require(_0xeb78('0x7'));var config=require(_0xeb78('0x8'));var attributes=require(_0xeb78('0x9'));module['exports']=function(_0x3c35e7,_0x17a736){return _0x3c35e7[_0xeb78('0xa')](_0xeb78('0xb'),attributes,{'tableName':_0xeb78('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 65216e1..be20a60 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 _0x27e2=['rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x20ae13,_0x2a0c8e){var _0x533fd5=function(_0x3bb746){while(--_0x3bb746){_0x20ae13['push'](_0x20ae13['shift']());}};_0x533fd5(++_0x2a0c8e);}(_0x27e2,0x1f2));var _0x227e=function(_0x4a706f,_0x3018f0){_0x4a706f=_0x4a706f-0x0;var _0x5458f4=_0x27e2[_0x4a706f];return _0x5458f4;};'use strict';var _=require(_0x227e('0x0'));var util=require(_0x227e('0x1'));var moment=require(_0x227e('0x2'));var BPromise=require(_0x227e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x227e('0x4'));var db=require(_0x227e('0x5'))['db'];var utils=require(_0x227e('0x6'));var logger=require(_0x227e('0x7'))(_0x227e('0x8'));var config=require(_0x227e('0x9'));var jayson=require(_0x227e('0xa'));var client=jayson[_0x227e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2da55d,_0x44e18d,_0x3a6d31){return new BPromise(function(_0x66e9e6,_0x592d76){return client[_0x227e('0xc')](_0x2da55d,_0x3a6d31)['then'](function(_0x4f2519){logger[_0x227e('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x44e18d,_0x227e('0xe'));logger['debug'](_0x227e('0xf'),_0x44e18d,_0x227e('0xe'),JSON[_0x227e('0x10')](_0x4f2519));if(_0x4f2519['error']){if(_0x4f2519[_0x227e('0x11')][_0x227e('0x12')]===0x1f4){logger['error'](_0x227e('0x13'),_0x44e18d,_0x4f2519[_0x227e('0x11')][_0x227e('0x14')]);return _0x592d76(_0x4f2519[_0x227e('0x11')]['message']);}logger[_0x227e('0x11')](_0x227e('0x13'),_0x44e18d,_0x4f2519[_0x227e('0x11')][_0x227e('0x14')]);return _0x66e9e6(_0x4f2519[_0x227e('0x11')][_0x227e('0x14')]);}else{logger[_0x227e('0xd')](_0x227e('0x13'),_0x44e18d,_0x227e('0xe'));_0x66e9e6(_0x4f2519[_0x227e('0x15')][_0x227e('0x14')]);}})[_0x227e('0x16')](function(_0x40b593){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x44e18d,_0x40b593);_0x592d76(_0x40b593);});});} \ No newline at end of file +var _0xe223=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0x3f2caa,_0x193e9a){var _0xdbd6ba=function(_0x2df5b1){while(--_0x2df5b1){_0x3f2caa['push'](_0x3f2caa['shift']());}};_0xdbd6ba(++_0x193e9a);}(_0xe223,0x1d5));var _0x3e22=function(_0x290492,_0x18cfad){_0x290492=_0x290492-0x0;var _0x52b5bf=_0xe223[_0x290492];return _0x52b5bf;};'use strict';var _=require(_0x3e22('0x0'));var util=require(_0x3e22('0x1'));var moment=require(_0x3e22('0x2'));var BPromise=require(_0x3e22('0x3'));var rs=require(_0x3e22('0x4'));var fs=require('fs');var Redis=require(_0x3e22('0x5'));var db=require(_0x3e22('0x6'))['db'];var utils=require(_0x3e22('0x7'));var logger=require(_0x3e22('0x8'))(_0x3e22('0x9'));var config=require(_0x3e22('0xa'));var jayson=require(_0x3e22('0xb'));var client=jayson[_0x3e22('0xc')][_0x3e22('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2ae7f6,_0x3c1c29,_0x3972b6){return new BPromise(function(_0x2bf0af,_0x45a1f4){return client[_0x3e22('0xe')](_0x2ae7f6,_0x3972b6)[_0x3e22('0xf')](function(_0x61afec){logger[_0x3e22('0x10')](_0x3e22('0x11'),_0x3c1c29,'request\x20sent');logger[_0x3e22('0x12')](_0x3e22('0x13'),_0x3c1c29,_0x3e22('0x14'),JSON['stringify'](_0x61afec));if(_0x61afec[_0x3e22('0x15')]){if(_0x61afec[_0x3e22('0x15')][_0x3e22('0x16')]===0x1f4){logger['error'](_0x3e22('0x11'),_0x3c1c29,_0x61afec[_0x3e22('0x15')][_0x3e22('0x17')]);return _0x45a1f4(_0x61afec[_0x3e22('0x15')]['message']);}logger['error'](_0x3e22('0x11'),_0x3c1c29,_0x61afec[_0x3e22('0x15')]['message']);return _0x2bf0af(_0x61afec[_0x3e22('0x15')][_0x3e22('0x17')]);}else{logger[_0x3e22('0x10')](_0x3e22('0x11'),_0x3c1c29,_0x3e22('0x14'));_0x2bf0af(_0x61afec[_0x3e22('0x18')][_0x3e22('0x17')]);}})[_0x3e22('0x19')](function(_0x423633){logger['error'](_0x3e22('0x11'),_0x3c1c29,_0x423633);_0x45a1f4(_0x423633);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index b293fe9..0868eee 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 _0x7376=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','index','get','show','post','isAuthenticated','create','put','/:id'];(function(_0x4e1fa5,_0x2af818){var _0x58685e=function(_0x1dc109){while(--_0x1dc109){_0x4e1fa5['push'](_0x4e1fa5['shift']());}};_0x58685e(++_0x2af818);}(_0x7376,0x142));var _0x6737=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x7376[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x6737('0x0'));var util=require(_0x6737('0x1'));var path=require(_0x6737('0x2'));var timeout=require(_0x6737('0x3'));var express=require('express');var router=express[_0x6737('0x4')]();var fs_extra=require(_0x6737('0x5'));var auth=require(_0x6737('0x6'));var interaction=require(_0x6737('0x7'));var config=require(_0x6737('0x8'));var controller=require(_0x6737('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x6737('0xa')]);router[_0x6737('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x6737('0xc')]);router[_0x6737('0xd')]('/',auth[_0x6737('0xe')](),controller[_0x6737('0xf')]);router[_0x6737('0x10')](_0x6737('0x11'),auth[_0x6737('0xe')](),controller['update']);router['delete'](_0x6737('0x11'),auth[_0x6737('0xe')](),controller[_0x6737('0x12')]);module[_0x6737('0x13')]=router; \ No newline at end of file +var _0xacce=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0xacce,0x74));var _0xeacc=function(_0x30fa2e,_0x108f8a){_0x30fa2e=_0x30fa2e-0x0;var _0x4828d6=_0xacce[_0x30fa2e];return _0x4828d6;};'use strict';var multer=require(_0xeacc('0x0'));var util=require(_0xeacc('0x1'));var path=require(_0xeacc('0x2'));var timeout=require(_0xeacc('0x3'));var express=require(_0xeacc('0x4'));var router=express[_0xeacc('0x5')]();var fs_extra=require(_0xeacc('0x6'));var auth=require(_0xeacc('0x7'));var interaction=require(_0xeacc('0x8'));var config=require(_0xeacc('0x9'));var controller=require('./intZendeskField.controller');router[_0xeacc('0xa')]('/',auth[_0xeacc('0xb')](),controller['index']);router[_0xeacc('0xa')](_0xeacc('0xc'),auth[_0xeacc('0xb')](),controller[_0xeacc('0xd')]);router[_0xeacc('0xe')]('/',auth[_0xeacc('0xb')](),controller[_0xeacc('0xf')]);router[_0xeacc('0x10')](_0xeacc('0xc'),auth[_0xeacc('0xb')](),controller['update']);router[_0xeacc('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xeacc('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 3316d97..ae9be8e 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 _0x9f5b=['ENUM','variable','customVariable','picklist','string','STRING','BOOLEAN','exports'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x9f5b,0x147));var _0xb9f5=function(_0x29caf2,_0x21e2fb){_0x29caf2=_0x29caf2-0x0;var _0x31d5f4=_0x9f5b[_0x29caf2];return _0x31d5f4;};'use strict';var Sequelize=require('sequelize');module[_0xb9f5('0x0')]={'type':{'type':Sequelize[_0xb9f5('0x1')]('string',_0xb9f5('0x2'),_0xb9f5('0x3'),'keyValue',_0xb9f5('0x4')),'defaultValue':_0xb9f5('0x5')},'content':{'type':Sequelize[_0xb9f5('0x6')]},'key':{'type':Sequelize[_0xb9f5('0x6')]},'keyType':{'type':Sequelize[_0xb9f5('0x1')](_0xb9f5('0x5'),_0xb9f5('0x2'),_0xb9f5('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb9f5('0x6')]},'nameField':{'type':Sequelize[_0xb9f5('0x6')]},'customField':{'type':Sequelize[_0xb9f5('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb9f5('0x6')]}}; \ No newline at end of file +var _0x4440=['string','STRING','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist'];(function(_0x4dd359,_0x5e939e){var _0x263010=function(_0x3c085c){while(--_0x3c085c){_0x4dd359['push'](_0x4dd359['shift']());}};_0x263010(++_0x5e939e);}(_0x4440,0xda));var _0x0444=function(_0x1b6832,_0x294ada){_0x1b6832=_0x1b6832-0x0;var _0x4d2ddf=_0x4440[_0x1b6832];return _0x4d2ddf;};'use strict';var Sequelize=require(_0x0444('0x0'));module[_0x0444('0x1')]={'type':{'type':Sequelize[_0x0444('0x2')]('string',_0x0444('0x3'),_0x0444('0x4'),_0x0444('0x5'),_0x0444('0x6')),'defaultValue':_0x0444('0x7')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0444('0x2')](_0x0444('0x7'),_0x0444('0x3'),_0x0444('0x4'))},'keyContent':{'type':Sequelize[_0x0444('0x8')]},'idField':{'type':Sequelize[_0x0444('0x8')]},'nameField':{'type':Sequelize[_0x0444('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0444('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index b88a7ac..613e6e3 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 _0x7866=['set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','ZendeskField','rawAttributes','fieldName','type','model','map','keys','filters','intersection','attributes','query','fields','length','nolimit','order','sort','where','pick','merge','filter','count','includeAll','include','findAll','catch','show','params','options','find','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined'];(function(_0x24fb6d,_0x410ca2){var _0x44bc10=function(_0x5df0fd){while(--_0x5df0fd){_0x24fb6d['push'](_0x24fb6d['shift']());}};_0x44bc10(++_0x410ca2);}(_0x7866,0x114));var _0x6786=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x7866[_0x5ddaac];return _0x2a9c58;};'use strict';var emlformat=require(_0x6786('0x0'));var rimraf=require(_0x6786('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6786('0x2'));var rp=require(_0x6786('0x3'));var moment=require(_0x6786('0x4'));var BPromise=require(_0x6786('0x5'));var Mustache=require(_0x6786('0x6'));var util=require(_0x6786('0x7'));var path=require(_0x6786('0x8'));var sox=require(_0x6786('0x9'));var csv=require(_0x6786('0xa'));var ejs=require(_0x6786('0xb'));var fs=require('fs');var fs_extra=require(_0x6786('0xc'));var _=require(_0x6786('0xd'));var squel=require(_0x6786('0xe'));var crypto=require(_0x6786('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x6786('0x10'));var toCsv=require(_0x6786('0xa'));var querystring=require(_0x6786('0x11'));var Papa=require(_0x6786('0x12'));var Redis=require(_0x6786('0x13'));var authService=require(_0x6786('0x14'));var qs=require(_0x6786('0x15'));var as=require(_0x6786('0x16'));var hardwareService=require(_0x6786('0x17'));var logger=require(_0x6786('0x18'))(_0x6786('0x19'));var utils=require('../../config/utils');var config=require(_0x6786('0x1a'));var licenseUtil=require(_0x6786('0x1b'));var db=require(_0x6786('0x1c'))['db'];function respondWithStatusCode(_0x2f7cbb,_0x47f87b){_0x47f87b=_0x47f87b||0xcc;return function(_0x291863){if(_0x291863){return _0x2f7cbb[_0x6786('0x1d')](_0x47f87b);}return _0x2f7cbb['status'](_0x47f87b)[_0x6786('0x1e')]();};}function respondWithResult(_0x3f9940,_0x2f04af){_0x2f04af=_0x2f04af||0xc8;return function(_0x15d843){if(_0x15d843){return _0x3f9940[_0x6786('0x1f')](_0x2f04af)[_0x6786('0x20')](_0x15d843);}};}function respondWithFilteredResult(_0x1bfa1a,_0x45a70f){return function(_0x34243a){if(_0x34243a){var _0x7fbef6=typeof _0x45a70f[_0x6786('0x21')]==='undefined'&&typeof _0x45a70f[_0x6786('0x22')]===_0x6786('0x23');var _0x467d68=_0x34243a['count'];var _0xbbee86=_0x7fbef6?0x0:_0x45a70f['offset'];var _0x4b017a=_0x7fbef6?_0x34243a['count']:_0x45a70f['offset']+_0x45a70f[_0x6786('0x22')];var _0x3cd17e;if(_0x4b017a>=_0x467d68){_0x4b017a=_0x467d68;_0x3cd17e=0xc8;}else{_0x3cd17e=0xce;}_0x1bfa1a['status'](_0x3cd17e);return _0x1bfa1a[_0x6786('0x24')](_0x6786('0x25'),_0xbbee86+'-'+_0x4b017a+'/'+_0x467d68)[_0x6786('0x20')](_0x34243a);}return null;};}function patchUpdates(_0x5a245b){return function(_0x2bd6cb){try{jsonpatch[_0x6786('0x26')](_0x2bd6cb,_0x5a245b,!![]);}catch(_0x4a57cb){return BPromise[_0x6786('0x27')](_0x4a57cb);}return _0x2bd6cb['save']();};}function saveUpdates(_0x18398a,_0x5c1d70){return function(_0x215f98){if(_0x215f98){return _0x215f98[_0x6786('0x28')](_0x18398a)[_0x6786('0x29')](function(_0x406bbc){return _0x406bbc;});}return null;};}function removeEntity(_0x1ebec8,_0x15e156){return function(_0x1ba9bc){if(_0x1ba9bc){return _0x1ba9bc[_0x6786('0x2a')]()[_0x6786('0x29')](function(){_0x1ebec8['status'](0xcc)[_0x6786('0x1e')]();});}};}function handleEntityNotFound(_0x37e026,_0x594333){return function(_0x3af734){if(!_0x3af734){_0x37e026[_0x6786('0x1d')](0x194);}return _0x3af734;};}function handleError(_0x2256fe,_0xfa2576){_0xfa2576=_0xfa2576||0x1f4;return function(_0x53a8d9){logger[_0x6786('0x2b')](_0x53a8d9[_0x6786('0x2c')]);if(_0x53a8d9['name']){delete _0x53a8d9[_0x6786('0x2d')];}_0x2256fe[_0x6786('0x1f')](_0xfa2576)[_0x6786('0x2e')](_0x53a8d9);};}exports[_0x6786('0x2f')]=function(_0x17ef39,_0x119eaf){var _0x4f3850={},_0x4b7fe8={},_0x33d431={'count':0x0,'rows':[]};var _0x2bf8b7=_['map'](db[_0x6786('0x30')][_0x6786('0x31')],function(_0x53fd1f){return{'name':_0x53fd1f[_0x6786('0x32')],'type':_0x53fd1f[_0x6786('0x33')]['key']};});_0x4b7fe8[_0x6786('0x34')]=_[_0x6786('0x35')](_0x2bf8b7,_0x6786('0x2d'));_0x4b7fe8['query']=_[_0x6786('0x36')](_0x17ef39['query']);_0x4b7fe8[_0x6786('0x37')]=_[_0x6786('0x38')](_0x4b7fe8[_0x6786('0x34')],_0x4b7fe8['query']);_0x4f3850[_0x6786('0x39')]=_[_0x6786('0x38')](_0x4b7fe8[_0x6786('0x34')],qs['fields'](_0x17ef39[_0x6786('0x3a')][_0x6786('0x3b')]));_0x4f3850[_0x6786('0x39')]=_0x4f3850['attributes'][_0x6786('0x3c')]?_0x4f3850[_0x6786('0x39')]:_0x4b7fe8['model'];if(!_0x17ef39[_0x6786('0x3a')]['hasOwnProperty'](_0x6786('0x3d'))){_0x4f3850['limit']=qs['limit'](_0x17ef39[_0x6786('0x3a')]['limit']);_0x4f3850[_0x6786('0x21')]=qs[_0x6786('0x21')](_0x17ef39['query'][_0x6786('0x21')]);}_0x4f3850[_0x6786('0x3e')]=qs[_0x6786('0x3f')](_0x17ef39['query'][_0x6786('0x3f')]);_0x4f3850[_0x6786('0x40')]=qs[_0x6786('0x37')](_[_0x6786('0x41')](_0x17ef39[_0x6786('0x3a')],_0x4b7fe8[_0x6786('0x37')]),_0x2bf8b7);if(_0x17ef39[_0x6786('0x3a')]['filter']){_0x4f3850[_0x6786('0x40')]=_[_0x6786('0x42')](_0x4f3850[_0x6786('0x40')],{'$or':_[_0x6786('0x35')](_0x2bf8b7,function(_0x20af6e){if(_0x20af6e[_0x6786('0x33')]!=='VIRTUAL'){var _0x3c700f={};_0x3c700f[_0x20af6e['name']]={'$like':'%'+_0x17ef39[_0x6786('0x3a')][_0x6786('0x43')]+'%'};return _0x3c700f;}})});}_0x4f3850=_[_0x6786('0x42')]({},_0x4f3850,_0x17ef39['options']);var _0x3afcad={'where':_0x4f3850['where']};return db['ZendeskField'][_0x6786('0x44')](_0x3afcad)['then'](function(_0x34b5dc){_0x33d431[_0x6786('0x44')]=_0x34b5dc;if(_0x17ef39[_0x6786('0x3a')][_0x6786('0x45')]){_0x4f3850[_0x6786('0x46')]=[{'all':!![]}];}return db['ZendeskField'][_0x6786('0x47')](_0x4f3850);})[_0x6786('0x29')](function(_0x34ff2a){_0x33d431['rows']=_0x34ff2a;return _0x33d431;})[_0x6786('0x29')](respondWithFilteredResult(_0x119eaf,_0x4f3850))[_0x6786('0x48')](handleError(_0x119eaf,null));};exports[_0x6786('0x49')]=function(_0x564b25,_0x51d0bb){var _0x161c0b={'raw':!![],'where':{'id':_0x564b25[_0x6786('0x4a')]['id']}},_0x2e93ff={};_0x2e93ff[_0x6786('0x34')]=_[_0x6786('0x36')](db[_0x6786('0x30')]['rawAttributes']);_0x2e93ff['query']=_[_0x6786('0x36')](_0x564b25[_0x6786('0x3a')]);_0x2e93ff[_0x6786('0x37')]=_[_0x6786('0x38')](_0x2e93ff[_0x6786('0x34')],_0x2e93ff[_0x6786('0x3a')]);_0x161c0b['attributes']=_[_0x6786('0x38')](_0x2e93ff[_0x6786('0x34')],qs[_0x6786('0x3b')](_0x564b25[_0x6786('0x3a')][_0x6786('0x3b')]));_0x161c0b[_0x6786('0x39')]=_0x161c0b[_0x6786('0x39')][_0x6786('0x3c')]?_0x161c0b[_0x6786('0x39')]:_0x2e93ff[_0x6786('0x34')];if(_0x564b25['query']['includeAll']){_0x161c0b[_0x6786('0x46')]=[{'all':!![]}];}_0x161c0b=_[_0x6786('0x42')]({},_0x161c0b,_0x564b25[_0x6786('0x4b')]);return db[_0x6786('0x30')][_0x6786('0x4c')](_0x161c0b)[_0x6786('0x29')](handleEntityNotFound(_0x51d0bb,null))[_0x6786('0x29')](respondWithResult(_0x51d0bb,null))[_0x6786('0x48')](handleError(_0x51d0bb,null));};exports['create']=function(_0x1177dc,_0xb51fd7){return db[_0x6786('0x30')]['create'](_0x1177dc['body'],{})['then'](respondWithResult(_0xb51fd7,0xc9))[_0x6786('0x48')](handleError(_0xb51fd7,null));};exports[_0x6786('0x28')]=function(_0x189bb3,_0x444fed){if(_0x189bb3[_0x6786('0x4d')]['id']){delete _0x189bb3[_0x6786('0x4d')]['id'];}return db[_0x6786('0x30')]['find']({'where':{'id':_0x189bb3[_0x6786('0x4a')]['id']}})[_0x6786('0x29')](handleEntityNotFound(_0x444fed,null))[_0x6786('0x29')](saveUpdates(_0x189bb3[_0x6786('0x4d')],null))[_0x6786('0x29')](respondWithResult(_0x444fed,null))[_0x6786('0x48')](handleError(_0x444fed,null));};exports[_0x6786('0x2a')]=function(_0x3f8c4b,_0x3e1a8e){return db['ZendeskField'][_0x6786('0x4c')]({'where':{'id':_0x3f8c4b[_0x6786('0x4a')]['id']}})[_0x6786('0x29')](handleEntityNotFound(_0x3e1a8e,null))['then'](removeEntity(_0x3e1a8e,null))[_0x6786('0x48')](handleError(_0x3e1a8e,null));}; \ No newline at end of file +var _0x3d04=['apply','reject','update','then','destroy','error','name','map','ZendeskField','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','nolimit','order','where','merge','filter','includeAll','include','rows','catch','show','fields','length','options','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x3c68ea,_0x804049){var _0x1f99ba=function(_0x321d80){while(--_0x321d80){_0x3c68ea['push'](_0x3c68ea['shift']());}};_0x1f99ba(++_0x804049);}(_0x3d04,0x100));var _0x43d0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3d04[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x43d0('0x0'));var rimraf=require(_0x43d0('0x1'));var zipdir=require(_0x43d0('0x2'));var jsonpatch=require(_0x43d0('0x3'));var rp=require(_0x43d0('0x4'));var moment=require(_0x43d0('0x5'));var BPromise=require(_0x43d0('0x6'));var Mustache=require(_0x43d0('0x7'));var util=require(_0x43d0('0x8'));var path=require(_0x43d0('0x9'));var sox=require(_0x43d0('0xa'));var csv=require(_0x43d0('0xb'));var ejs=require(_0x43d0('0xc'));var fs=require('fs');var fs_extra=require(_0x43d0('0xd'));var _=require(_0x43d0('0xe'));var squel=require(_0x43d0('0xf'));var crypto=require(_0x43d0('0x10'));var jsforce=require(_0x43d0('0x11'));var deskjs=require(_0x43d0('0x12'));var toCsv=require('to-csv');var querystring=require(_0x43d0('0x13'));var Papa=require('papaparse');var Redis=require(_0x43d0('0x14'));var authService=require(_0x43d0('0x15'));var qs=require(_0x43d0('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x43d0('0x17'));var logger=require(_0x43d0('0x18'))(_0x43d0('0x19'));var utils=require(_0x43d0('0x1a'));var config=require(_0x43d0('0x1b'));var licenseUtil=require(_0x43d0('0x1c'));var db=require(_0x43d0('0x1d'))['db'];function respondWithStatusCode(_0x4bb501,_0x501a70){_0x501a70=_0x501a70||0xcc;return function(_0x2698d8){if(_0x2698d8){return _0x4bb501[_0x43d0('0x1e')](_0x501a70);}return _0x4bb501[_0x43d0('0x1f')](_0x501a70)[_0x43d0('0x20')]();};}function respondWithResult(_0x5b2e9a,_0x4db451){_0x4db451=_0x4db451||0xc8;return function(_0x20ff09){if(_0x20ff09){return _0x5b2e9a[_0x43d0('0x1f')](_0x4db451)[_0x43d0('0x21')](_0x20ff09);}};}function respondWithFilteredResult(_0x5621c0,_0x2161c7){return function(_0x27e216){if(_0x27e216){var _0x5a4237=typeof _0x2161c7[_0x43d0('0x22')]===_0x43d0('0x23')&&typeof _0x2161c7['limit']==='undefined';var _0x20dfb2=_0x27e216['count'];var _0xf3d87b=_0x5a4237?0x0:_0x2161c7[_0x43d0('0x22')];var _0x5b44b8=_0x5a4237?_0x27e216[_0x43d0('0x24')]:_0x2161c7['offset']+_0x2161c7[_0x43d0('0x25')];var _0x10b37c;if(_0x5b44b8>=_0x20dfb2){_0x5b44b8=_0x20dfb2;_0x10b37c=0xc8;}else{_0x10b37c=0xce;}_0x5621c0[_0x43d0('0x1f')](_0x10b37c);return _0x5621c0[_0x43d0('0x26')](_0x43d0('0x27'),_0xf3d87b+'-'+_0x5b44b8+'/'+_0x20dfb2)[_0x43d0('0x21')](_0x27e216);}return null;};}function patchUpdates(_0x587443){return function(_0x1236ad){try{jsonpatch[_0x43d0('0x28')](_0x1236ad,_0x587443,!![]);}catch(_0x57498c){return BPromise[_0x43d0('0x29')](_0x57498c);}return _0x1236ad['save']();};}function saveUpdates(_0x70187f,_0x4dd153){return function(_0x1d15ae){if(_0x1d15ae){return _0x1d15ae[_0x43d0('0x2a')](_0x70187f)[_0x43d0('0x2b')](function(_0x568369){return _0x568369;});}return null;};}function removeEntity(_0x3453ec,_0x3fe0c8){return function(_0x48d7b7){if(_0x48d7b7){return _0x48d7b7[_0x43d0('0x2c')]()[_0x43d0('0x2b')](function(){_0x3453ec[_0x43d0('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b792c,_0x324008){return function(_0xfcea28){if(!_0xfcea28){_0x3b792c['sendStatus'](0x194);}return _0xfcea28;};}function handleError(_0xdc9464,_0x41cb47){_0x41cb47=_0x41cb47||0x1f4;return function(_0x2dde62){logger[_0x43d0('0x2d')](_0x2dde62['stack']);if(_0x2dde62[_0x43d0('0x2e')]){delete _0x2dde62[_0x43d0('0x2e')];}_0xdc9464[_0x43d0('0x1f')](_0x41cb47)['send'](_0x2dde62);};}exports['index']=function(_0xe52f0f,_0xa500df){var _0x222ef2={},_0x1a36be={},_0x341575={'count':0x0,'rows':[]};var _0x55c3ba=_[_0x43d0('0x2f')](db[_0x43d0('0x30')][_0x43d0('0x31')],function(_0x592557){return{'name':_0x592557[_0x43d0('0x32')],'type':_0x592557[_0x43d0('0x33')]['key']};});_0x1a36be[_0x43d0('0x34')]=_['map'](_0x55c3ba,_0x43d0('0x2e'));_0x1a36be['query']=_[_0x43d0('0x35')](_0xe52f0f[_0x43d0('0x36')]);_0x1a36be[_0x43d0('0x37')]=_[_0x43d0('0x38')](_0x1a36be[_0x43d0('0x34')],_0x1a36be[_0x43d0('0x36')]);_0x222ef2[_0x43d0('0x39')]=_[_0x43d0('0x38')](_0x1a36be[_0x43d0('0x34')],qs['fields'](_0xe52f0f[_0x43d0('0x36')]['fields']));_0x222ef2[_0x43d0('0x39')]=_0x222ef2[_0x43d0('0x39')]['length']?_0x222ef2[_0x43d0('0x39')]:_0x1a36be[_0x43d0('0x34')];if(!_0xe52f0f[_0x43d0('0x36')]['hasOwnProperty'](_0x43d0('0x3a'))){_0x222ef2[_0x43d0('0x25')]=qs[_0x43d0('0x25')](_0xe52f0f[_0x43d0('0x36')][_0x43d0('0x25')]);_0x222ef2[_0x43d0('0x22')]=qs['offset'](_0xe52f0f['query'][_0x43d0('0x22')]);}_0x222ef2[_0x43d0('0x3b')]=qs['sort'](_0xe52f0f[_0x43d0('0x36')]['sort']);_0x222ef2['where']=qs[_0x43d0('0x37')](_['pick'](_0xe52f0f['query'],_0x1a36be[_0x43d0('0x37')]),_0x55c3ba);if(_0xe52f0f['query']['filter']){_0x222ef2[_0x43d0('0x3c')]=_[_0x43d0('0x3d')](_0x222ef2[_0x43d0('0x3c')],{'$or':_[_0x43d0('0x2f')](_0x55c3ba,function(_0x28f5cb){if(_0x28f5cb[_0x43d0('0x33')]!=='VIRTUAL'){var _0x109b7d={};_0x109b7d[_0x28f5cb['name']]={'$like':'%'+_0xe52f0f[_0x43d0('0x36')][_0x43d0('0x3e')]+'%'};return _0x109b7d;}})});}_0x222ef2=_[_0x43d0('0x3d')]({},_0x222ef2,_0xe52f0f['options']);var _0x2cf99={'where':_0x222ef2[_0x43d0('0x3c')]};return db[_0x43d0('0x30')][_0x43d0('0x24')](_0x2cf99)[_0x43d0('0x2b')](function(_0x34ca50){_0x341575[_0x43d0('0x24')]=_0x34ca50;if(_0xe52f0f[_0x43d0('0x36')][_0x43d0('0x3f')]){_0x222ef2[_0x43d0('0x40')]=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x222ef2);})[_0x43d0('0x2b')](function(_0x10b947){_0x341575[_0x43d0('0x41')]=_0x10b947;return _0x341575;})[_0x43d0('0x2b')](respondWithFilteredResult(_0xa500df,_0x222ef2))[_0x43d0('0x42')](handleError(_0xa500df,null));};exports[_0x43d0('0x43')]=function(_0x3e092e,_0x40cf5f){var _0x3ce7fc={'raw':!![],'where':{'id':_0x3e092e['params']['id']}},_0x41ab4e={};_0x41ab4e[_0x43d0('0x34')]=_[_0x43d0('0x35')](db['ZendeskField']['rawAttributes']);_0x41ab4e[_0x43d0('0x36')]=_['keys'](_0x3e092e[_0x43d0('0x36')]);_0x41ab4e[_0x43d0('0x37')]=_[_0x43d0('0x38')](_0x41ab4e['model'],_0x41ab4e[_0x43d0('0x36')]);_0x3ce7fc[_0x43d0('0x39')]=_[_0x43d0('0x38')](_0x41ab4e[_0x43d0('0x34')],qs[_0x43d0('0x44')](_0x3e092e['query'][_0x43d0('0x44')]));_0x3ce7fc[_0x43d0('0x39')]=_0x3ce7fc['attributes'][_0x43d0('0x45')]?_0x3ce7fc[_0x43d0('0x39')]:_0x41ab4e[_0x43d0('0x34')];if(_0x3e092e[_0x43d0('0x36')]['includeAll']){_0x3ce7fc[_0x43d0('0x40')]=[{'all':!![]}];}_0x3ce7fc=_['merge']({},_0x3ce7fc,_0x3e092e[_0x43d0('0x46')]);return db[_0x43d0('0x30')]['find'](_0x3ce7fc)[_0x43d0('0x2b')](handleEntityNotFound(_0x40cf5f,null))[_0x43d0('0x2b')](respondWithResult(_0x40cf5f,null))[_0x43d0('0x42')](handleError(_0x40cf5f,null));};exports['create']=function(_0x1b2408,_0x29a908){return db[_0x43d0('0x30')]['create'](_0x1b2408[_0x43d0('0x47')],{})[_0x43d0('0x2b')](respondWithResult(_0x29a908,0xc9))[_0x43d0('0x42')](handleError(_0x29a908,null));};exports['update']=function(_0x590113,_0x5550a7){if(_0x590113[_0x43d0('0x47')]['id']){delete _0x590113[_0x43d0('0x47')]['id'];}return db['ZendeskField'][_0x43d0('0x48')]({'where':{'id':_0x590113[_0x43d0('0x49')]['id']}})[_0x43d0('0x2b')](handleEntityNotFound(_0x5550a7,null))[_0x43d0('0x2b')](saveUpdates(_0x590113['body'],null))['then'](respondWithResult(_0x5550a7,null))[_0x43d0('0x42')](handleError(_0x5550a7,null));};exports[_0x43d0('0x2c')]=function(_0x52f5fc,_0x592593){return db['ZendeskField'][_0x43d0('0x48')]({'where':{'id':_0x52f5fc['params']['id']}})[_0x43d0('0x2b')](handleEntityNotFound(_0x592593,null))[_0x43d0('0x2b')](removeEntity(_0x592593,null))['catch'](handleError(_0x592593,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index e588ee1..c0dee35 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 _0xd73a=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','idField'];(function(_0x214266,_0x1f6f52){var _0x568f75=function(_0x541904){while(--_0x541904){_0x214266['push'](_0x214266['shift']());}};_0x568f75(++_0x1f6f52);}(_0xd73a,0x1d4));var _0xad73=function(_0x43c89f,_0x32a64f){_0x43c89f=_0x43c89f-0x0;var _0x56a4fb=_0xd73a[_0x43c89f];return _0x56a4fb;};'use strict';var _=require(_0xad73('0x0'));var util=require('util');var logger=require(_0xad73('0x1'))(_0xad73('0x2'));var moment=require(_0xad73('0x3'));var BPromise=require(_0xad73('0x4'));var rp=require(_0xad73('0x5'));var fs=require('fs');var path=require(_0xad73('0x6'));var rimraf=require('rimraf');var config=require(_0xad73('0x7'));var attributes=require(_0xad73('0x8'));module[_0xad73('0x9')]=function(_0x3eec30,_0x2dc28f){return _0x3eec30['define'](_0xad73('0xa'),attributes,{'tableName':_0xad73('0xb'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xad73('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf837=['int_zendesk_fields','zendesk_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZendeskField.attributes','exports','ZendeskField'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf837,0xc6));var _0x7f83=function(_0x421473,_0x2f45ca){_0x421473=_0x421473-0x0;var _0x2ae9de=_0xf837[_0x421473];return _0x2ae9de;};'use strict';var _=require(_0x7f83('0x0'));var util=require(_0x7f83('0x1'));var logger=require(_0x7f83('0x2'))(_0x7f83('0x3'));var moment=require(_0x7f83('0x4'));var BPromise=require(_0x7f83('0x5'));var rp=require(_0x7f83('0x6'));var fs=require('fs');var path=require(_0x7f83('0x7'));var rimraf=require(_0x7f83('0x8'));var config=require('../../config/environment');var attributes=require(_0x7f83('0x9'));module[_0x7f83('0xa')]=function(_0x5449e2,_0x352785){return _0x5449e2['define'](_0x7f83('0xb'),attributes,{'tableName':_0x7f83('0xc'),'paranoid':![],'indexes':[{'name':_0x7f83('0xd'),'fields':[_0x7f83('0xe'),'FieldId'],'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 fbca884..f473681 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 _0x013f=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x013f,0x8a));var _0xf013=function(_0x328ed1,_0x4dd43a){_0x328ed1=_0x328ed1-0x0;var _0x5a1256=_0x013f[_0x328ed1];return _0x5a1256;};'use strict';var _=require(_0xf013('0x0'));var util=require(_0xf013('0x1'));var moment=require(_0xf013('0x2'));var BPromise=require(_0xf013('0x3'));var rs=require(_0xf013('0x4'));var fs=require('fs');var Redis=require(_0xf013('0x5'));var db=require(_0xf013('0x6'))['db'];var utils=require(_0xf013('0x7'));var logger=require(_0xf013('0x8'))(_0xf013('0x9'));var config=require(_0xf013('0xa'));var jayson=require(_0xf013('0xb'));var client=jayson[_0xf013('0xc')][_0xf013('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x24c72d,_0x17b100,_0xd32fa6){return new BPromise(function(_0x28d5f0,_0xc6283e){return client['request'](_0x24c72d,_0xd32fa6)[_0xf013('0xe')](function(_0x5f1475){logger[_0xf013('0xf')](_0xf013('0x10'),_0x17b100,_0xf013('0x11'));logger[_0xf013('0x12')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x17b100,'request\x20sent',JSON[_0xf013('0x13')](_0x5f1475));if(_0x5f1475[_0xf013('0x14')]){if(_0x5f1475[_0xf013('0x14')][_0xf013('0x15')]===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x17b100,_0x5f1475[_0xf013('0x14')][_0xf013('0x16')]);return _0xc6283e(_0x5f1475[_0xf013('0x14')][_0xf013('0x16')]);}logger[_0xf013('0x14')](_0xf013('0x10'),_0x17b100,_0x5f1475[_0xf013('0x14')][_0xf013('0x16')]);return _0x28d5f0(_0x5f1475[_0xf013('0x14')][_0xf013('0x16')]);}else{logger['info'](_0xf013('0x10'),_0x17b100,_0xf013('0x11'));_0x28d5f0(_0x5f1475[_0xf013('0x17')][_0xf013('0x16')]);}})['catch'](function(_0x3297b2){logger[_0xf013('0x14')](_0xf013('0x10'),_0x17b100,_0x3297b2);_0xc6283e(_0x3297b2);});});} \ No newline at end of file +var _0x5047=['debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x744846,_0x24a961){var _0x46cf4b=function(_0x2cff0){while(--_0x2cff0){_0x744846['push'](_0x744846['shift']());}};_0x46cf4b(++_0x24a961);}(_0x5047,0x168));var _0x7504=function(_0xabfec4,_0x35076e){_0xabfec4=_0xabfec4-0x0;var _0x7bafa2=_0x5047[_0xabfec4];return _0x7bafa2;};'use strict';var _=require(_0x7504('0x0'));var util=require(_0x7504('0x1'));var moment=require('moment');var BPromise=require(_0x7504('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7504('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7504('0x4'))(_0x7504('0x5'));var config=require(_0x7504('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7504('0x7')][_0x7504('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x17b214,_0x52ed6b,_0x1e7d48){return new BPromise(function(_0x1283ed,_0x2d3814){return client[_0x7504('0x9')](_0x17b214,_0x1e7d48)[_0x7504('0xa')](function(_0x4f0f29){logger[_0x7504('0xb')](_0x7504('0xc'),_0x52ed6b,_0x7504('0xd'));logger[_0x7504('0xe')](_0x7504('0xf'),_0x52ed6b,'request\x20sent',JSON[_0x7504('0x10')](_0x4f0f29));if(_0x4f0f29[_0x7504('0x11')]){if(_0x4f0f29[_0x7504('0x11')][_0x7504('0x12')]===0x1f4){logger[_0x7504('0x11')]('ZendeskField,\x20%s,\x20%s',_0x52ed6b,_0x4f0f29[_0x7504('0x11')][_0x7504('0x13')]);return _0x2d3814(_0x4f0f29[_0x7504('0x11')]['message']);}logger[_0x7504('0x11')](_0x7504('0xc'),_0x52ed6b,_0x4f0f29[_0x7504('0x11')]['message']);return _0x1283ed(_0x4f0f29['error'][_0x7504('0x13')]);}else{logger[_0x7504('0xb')]('ZendeskField,\x20%s,\x20%s',_0x52ed6b,'request\x20sent');_0x1283ed(_0x4f0f29[_0x7504('0x14')][_0x7504('0x13')]);}})[_0x7504('0x15')](function(_0x3abad6){logger[_0x7504('0x11')](_0x7504('0xc'),_0x52ed6b,_0x3abad6);_0x2d3814(_0x3abad6);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 66193db..5ee2dc0 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 _0x80b3=['get','isAuthenticated','index','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4e76d1,_0x43f147){var _0xaa4393=function(_0x42fd3d){while(--_0x42fd3d){_0x4e76d1['push'](_0x4e76d1['shift']());}};_0xaa4393(++_0x43f147);}(_0x80b3,0x1b8));var _0x380b=function(_0x558696,_0x2a0e37){_0x558696=_0x558696-0x0;var _0x1f2f6e=_0x80b3[_0x558696];return _0x1f2f6e;};'use strict';var multer=require(_0x380b('0x0'));var util=require(_0x380b('0x1'));var path=require(_0x380b('0x2'));var timeout=require(_0x380b('0x3'));var express=require(_0x380b('0x4'));var router=express[_0x380b('0x5')]();var fs_extra=require(_0x380b('0x6'));var auth=require(_0x380b('0x7'));var interaction=require(_0x380b('0x8'));var config=require(_0x380b('0x9'));var controller=require('./intZohoAccount.controller');router[_0x380b('0xa')]('/',auth[_0x380b('0xb')](),controller[_0x380b('0xc')]);router['get']('/:id',auth[_0x380b('0xb')](),controller[_0x380b('0xd')]);router[_0x380b('0xa')](_0x380b('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x380b('0xa')](_0x380b('0xf'),auth[_0x380b('0xb')](),controller[_0x380b('0x10')]);router[_0x380b('0x11')]('/',auth[_0x380b('0xb')](),controller[_0x380b('0x12')]);router['post'](_0x380b('0xe'),auth[_0x380b('0xb')](),controller[_0x380b('0x13')]);router[_0x380b('0x14')](_0x380b('0x15'),auth[_0x380b('0xb')](),controller[_0x380b('0x16')]);router[_0x380b('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x380b('0x18')]);module['exports']=router; \ No newline at end of file +var _0xf2c0=['isAuthenticated','index','/:id','show','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf2c0,0x186));var _0x0f2c=function(_0x5f344c,_0x27959a){_0x5f344c=_0x5f344c-0x0;var _0x239a81=_0xf2c0[_0x5f344c];return _0x239a81;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0f2c('0x0'));var timeout=require(_0x0f2c('0x1'));var express=require(_0x0f2c('0x2'));var router=express[_0x0f2c('0x3')]();var fs_extra=require(_0x0f2c('0x4'));var auth=require(_0x0f2c('0x5'));var interaction=require(_0x0f2c('0x6'));var config=require(_0x0f2c('0x7'));var controller=require(_0x0f2c('0x8'));router[_0x0f2c('0x9')]('/',auth[_0x0f2c('0xa')](),controller[_0x0f2c('0xb')]);router[_0x0f2c('0x9')](_0x0f2c('0xc'),auth[_0x0f2c('0xa')](),controller[_0x0f2c('0xd')]);router[_0x0f2c('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0x0f2c('0x9')](_0x0f2c('0xe'),auth['isAuthenticated'](),controller[_0x0f2c('0xf')]);router[_0x0f2c('0x10')]('/',auth['isAuthenticated'](),controller[_0x0f2c('0x11')]);router['post'](_0x0f2c('0x12'),auth[_0x0f2c('0xa')](),controller[_0x0f2c('0x13')]);router[_0x0f2c('0x14')](_0x0f2c('0xc'),auth[_0x0f2c('0xa')](),controller[_0x0f2c('0x15')]);router[_0x0f2c('0x16')]('/:id',auth[_0x0f2c('0xa')](),controller[_0x0f2c('0x17')]);module[_0x0f2c('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 0d9e534..209baeb 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 _0x54ef=['STRING','sequelize','exports'];(function(_0x3891de,_0x55cfe5){var _0x521696=function(_0x1a8b8e){while(--_0x1a8b8e){_0x3891de['push'](_0x3891de['shift']());}};_0x521696(++_0x55cfe5);}(_0x54ef,0x112));var _0xf54e=function(_0x4e8cbb,_0x4b89ed){_0x4e8cbb=_0x4e8cbb-0x0;var _0x45ccb8=_0x54ef[_0x4e8cbb];return _0x45ccb8;};'use strict';var Sequelize=require(_0xf54e('0x0'));module[_0xf54e('0x1')]={'name':{'type':Sequelize[_0xf54e('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xf54e('0x2')]},'zone':{'type':Sequelize[_0xf54e('0x2')]},'clientId':{'type':Sequelize[_0xf54e('0x2')]},'clientSecret':{'type':Sequelize[_0xf54e('0x2')]},'serverUrl':{'type':Sequelize[_0xf54e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xf54e('0x2')]},'refreshToken':{'type':Sequelize[_0xf54e('0x2')]}}; \ No newline at end of file +var _0xbec5=['STRING','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbec5,0xe5));var _0x5bec=function(_0x2ad008,_0x45c253){_0x2ad008=_0x2ad008-0x0;var _0x4538cf=_0xbec5[_0x2ad008];return _0x4538cf;};'use strict';var Sequelize=require(_0x5bec('0x0'));module[_0x5bec('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5bec('0x2')]},'host':{'type':Sequelize[_0x5bec('0x2')]},'zone':{'type':Sequelize[_0x5bec('0x2')]},'clientId':{'type':Sequelize[_0x5bec('0x2')]},'clientSecret':{'type':Sequelize[_0x5bec('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0x5bec('0x2')]},'refreshToken':{'type':Sequelize[_0x5bec('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index f631e25..0fb594d 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 _0x90aa=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','params','findOne','ZohoConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','clientId','clientSecret','refresh_token','access_token','getFields','host','serverUrl','code','refreshToken','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','Calls','response','error','message','Owner','Subject','Description','Call_Duration','Call_Start_Time','Call_Type','remove','includes','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','stack','name','index','map','ZohoAccount','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x2b40e7,_0x391bbf){var _0x43202a=function(_0x28755e){while(--_0x28755e){_0x2b40e7['push'](_0x2b40e7['shift']());}};_0x43202a(++_0x391bbf);}(_0x90aa,0x155));var _0xa90a=function(_0x1d2926,_0x320f30){_0x1d2926=_0x1d2926-0x0;var _0x13f138=_0x90aa[_0x1d2926];return _0x13f138;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa90a('0x0'));var zipdir=require(_0xa90a('0x1'));var jsonpatch=require(_0xa90a('0x2'));var rp=require('request-promise');var moment=require(_0xa90a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa90a('0x4'));var util=require(_0xa90a('0x5'));var path=require(_0xa90a('0x6'));var sox=require('sox');var csv=require(_0xa90a('0x7'));var ejs=require(_0xa90a('0x8'));var fs=require('fs');var fs_extra=require(_0xa90a('0x9'));var _=require(_0xa90a('0xa'));var squel=require(_0xa90a('0xb'));var crypto=require(_0xa90a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa90a('0xd'));var toCsv=require(_0xa90a('0x7'));var querystring=require('querystring');var Papa=require(_0xa90a('0xe'));var Redis=require(_0xa90a('0xf'));var authService=require(_0xa90a('0x10'));var qs=require(_0xa90a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa90a('0x12'));var logger=require(_0xa90a('0x13'))(_0xa90a('0x14'));var utils=require(_0xa90a('0x15'));var config=require(_0xa90a('0x16'));var licenseUtil=require(_0xa90a('0x17'));var db=require(_0xa90a('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x23202e,_0x33d8aa){_0x33d8aa=_0x33d8aa||0xcc;return function(_0x382b99){if(_0x382b99){return _0x23202e[_0xa90a('0x19')](_0x33d8aa);}return _0x23202e[_0xa90a('0x1a')](_0x33d8aa)[_0xa90a('0x1b')]();};}function respondWithResult(_0x25e648,_0xc4cb0b){_0xc4cb0b=_0xc4cb0b||0xc8;return function(_0x1be430){if(_0x1be430){return _0x25e648[_0xa90a('0x1a')](_0xc4cb0b)[_0xa90a('0x1c')](_0x1be430);}};}function respondWithFilteredResult(_0x51523a,_0x3a7fe9){return function(_0x4717b5){if(_0x4717b5){var _0x15ac17=typeof _0x3a7fe9[_0xa90a('0x1d')]==='undefined'&&typeof _0x3a7fe9['limit']===_0xa90a('0x1e');var _0x4a1c90=_0x4717b5[_0xa90a('0x1f')];var _0x414de9=_0x15ac17?0x0:_0x3a7fe9[_0xa90a('0x1d')];var _0x149395=_0x15ac17?_0x4717b5[_0xa90a('0x1f')]:_0x3a7fe9[_0xa90a('0x1d')]+_0x3a7fe9[_0xa90a('0x20')];var _0x4b782b;if(_0x149395>=_0x4a1c90){_0x149395=_0x4a1c90;_0x4b782b=0xc8;}else{_0x4b782b=0xce;}_0x51523a[_0xa90a('0x1a')](_0x4b782b);return _0x51523a[_0xa90a('0x21')](_0xa90a('0x22'),_0x414de9+'-'+_0x149395+'/'+_0x4a1c90)['json'](_0x4717b5);}return null;};}function patchUpdates(_0x17a640){return function(_0x587884){try{jsonpatch['apply'](_0x587884,_0x17a640,!![]);}catch(_0x47d040){return BPromise[_0xa90a('0x23')](_0x47d040);}return _0x587884[_0xa90a('0x24')]();};}function saveUpdates(_0x490a64,_0x4a6f3a){return function(_0x347661){if(_0x347661){return _0x347661['update'](_0x490a64)[_0xa90a('0x25')](function(_0x371477){return _0x371477;});}return null;};}function removeEntity(_0x12339f,_0x43ddc8){return function(_0xb717bd){if(_0xb717bd){return _0xb717bd[_0xa90a('0x26')]()[_0xa90a('0x25')](function(){_0x12339f[_0xa90a('0x1a')](0xcc)[_0xa90a('0x1b')]();});}};}function handleEntityNotFound(_0x53c894,_0xf2c07){return function(_0x393106){if(!_0x393106){_0x53c894['sendStatus'](0x194);}return _0x393106;};}function handleError(_0x4c5a51,_0x51035f){_0x51035f=_0x51035f||0x1f4;return function(_0x34ddb3){logger['error'](_0x34ddb3[_0xa90a('0x27')]);if(_0x34ddb3[_0xa90a('0x28')]){delete _0x34ddb3['name'];}_0x4c5a51['status'](_0x51035f)['send'](_0x34ddb3);};}exports[_0xa90a('0x29')]=function(_0x129b62,_0x1c35b6){var _0x272685={},_0x1a1c7b={},_0x2d37e3={'count':0x0,'rows':[]};var _0x5b2582=_[_0xa90a('0x2a')](db[_0xa90a('0x2b')]['rawAttributes'],function(_0x333704){return{'name':_0x333704['fieldName'],'type':_0x333704[_0xa90a('0x2c')][_0xa90a('0x2d')]};});_0x1a1c7b[_0xa90a('0x2e')]=_[_0xa90a('0x2a')](_0x5b2582,_0xa90a('0x28'));_0x1a1c7b[_0xa90a('0x2f')]=_[_0xa90a('0x30')](_0x129b62[_0xa90a('0x2f')]);_0x1a1c7b[_0xa90a('0x31')]=_[_0xa90a('0x32')](_0x1a1c7b[_0xa90a('0x2e')],_0x1a1c7b[_0xa90a('0x2f')]);_0x272685[_0xa90a('0x33')]=_[_0xa90a('0x32')](_0x1a1c7b[_0xa90a('0x2e')],qs[_0xa90a('0x34')](_0x129b62[_0xa90a('0x2f')][_0xa90a('0x34')]));_0x272685[_0xa90a('0x33')]=_0x272685[_0xa90a('0x33')][_0xa90a('0x35')]?_0x272685[_0xa90a('0x33')]:_0x1a1c7b[_0xa90a('0x2e')];if(!_0x129b62[_0xa90a('0x2f')][_0xa90a('0x36')](_0xa90a('0x37'))){_0x272685[_0xa90a('0x20')]=qs[_0xa90a('0x20')](_0x129b62[_0xa90a('0x2f')][_0xa90a('0x20')]);_0x272685[_0xa90a('0x1d')]=qs[_0xa90a('0x1d')](_0x129b62[_0xa90a('0x2f')][_0xa90a('0x1d')]);}_0x272685[_0xa90a('0x38')]=qs[_0xa90a('0x39')](_0x129b62[_0xa90a('0x2f')][_0xa90a('0x39')]);_0x272685[_0xa90a('0x3a')]=qs['filters'](_[_0xa90a('0x3b')](_0x129b62[_0xa90a('0x2f')],_0x1a1c7b['filters']),_0x5b2582);if(_0x129b62[_0xa90a('0x2f')][_0xa90a('0x3c')]){_0x272685[_0xa90a('0x3a')]=_[_0xa90a('0x3d')](_0x272685['where'],{'$or':_[_0xa90a('0x2a')](_0x5b2582,function(_0x5f49ac){if(_0x5f49ac[_0xa90a('0x2c')]!=='VIRTUAL'){var _0x4e6648={};_0x4e6648[_0x5f49ac[_0xa90a('0x28')]]={'$like':'%'+_0x129b62[_0xa90a('0x2f')][_0xa90a('0x3c')]+'%'};return _0x4e6648;}})});}_0x272685=_[_0xa90a('0x3d')]({},_0x272685,_0x129b62[_0xa90a('0x3e')]);var _0x316c41={'where':_0x272685[_0xa90a('0x3a')]};return db[_0xa90a('0x2b')][_0xa90a('0x1f')](_0x316c41)[_0xa90a('0x25')](function(_0x7779da){_0x2d37e3[_0xa90a('0x1f')]=_0x7779da;if(_0x129b62[_0xa90a('0x2f')][_0xa90a('0x3f')]){_0x272685[_0xa90a('0x40')]=[{'all':!![]}];}return db[_0xa90a('0x2b')][_0xa90a('0x41')](_0x272685);})[_0xa90a('0x25')](function(_0x47adb7){_0x2d37e3[_0xa90a('0x42')]=_0x47adb7;return _0x2d37e3;})['then'](respondWithFilteredResult(_0x1c35b6,_0x272685))[_0xa90a('0x43')](handleError(_0x1c35b6,null));};exports['show']=function(_0xdba151,_0x283b45){var _0x5edc1d={'raw':![],'where':{'id':_0xdba151['params']['id']}},_0x27f5f2={};_0x27f5f2[_0xa90a('0x2e')]=_[_0xa90a('0x30')](db['ZohoAccount'][_0xa90a('0x44')]);_0x27f5f2[_0xa90a('0x2f')]=_['keys'](_0xdba151['query']);_0x27f5f2['filters']=_[_0xa90a('0x32')](_0x27f5f2[_0xa90a('0x2e')],_0x27f5f2[_0xa90a('0x2f')]);_0x5edc1d[_0xa90a('0x33')]=_[_0xa90a('0x32')](_0x27f5f2['model'],qs[_0xa90a('0x34')](_0xdba151['query'][_0xa90a('0x34')]));_0x5edc1d[_0xa90a('0x33')]=_0x5edc1d['attributes'][_0xa90a('0x35')]?_0x5edc1d[_0xa90a('0x33')]:_0x27f5f2['model'];if(_0xdba151[_0xa90a('0x2f')]['includeAll']){_0x5edc1d[_0xa90a('0x40')]=[{'all':!![]}];}_0x5edc1d=_[_0xa90a('0x3d')]({},_0x5edc1d,_0xdba151[_0xa90a('0x3e')]);return db[_0xa90a('0x2b')][_0xa90a('0x45')](_0x5edc1d)[_0xa90a('0x25')](handleEntityNotFound(_0x283b45,null))[_0xa90a('0x25')](respondWithResult(_0x283b45,null))[_0xa90a('0x43')](handleError(_0x283b45,null));};exports[_0xa90a('0x46')]=function(_0x38a523,_0x15212d){return db['ZohoAccount']['create'](_0x38a523[_0xa90a('0x47')],{})['then'](respondWithResult(_0x15212d,0xc9))[_0xa90a('0x43')](handleError(_0x15212d,null));};exports['update']=function(_0x1c77bd,_0x4dba28){if(_0x1c77bd[_0xa90a('0x47')]['id']){delete _0x1c77bd['body']['id'];}return db[_0xa90a('0x2b')]['find']({'where':{'id':_0x1c77bd[_0xa90a('0x48')]['id']}})[_0xa90a('0x25')](handleEntityNotFound(_0x4dba28,null))[_0xa90a('0x25')](saveUpdates(_0x1c77bd[_0xa90a('0x47')],null))[_0xa90a('0x25')](respondWithResult(_0x4dba28,null))[_0xa90a('0x43')](handleError(_0x4dba28,null));};exports['destroy']=function(_0x14fa5c,_0x1e3e89){return db['ZohoAccount']['find']({'where':{'id':_0x14fa5c[_0xa90a('0x48')]['id']}})['then'](handleEntityNotFound(_0x1e3e89,null))['then'](removeEntity(_0x1e3e89,null))[_0xa90a('0x43')](handleError(_0x1e3e89,null));};exports['getConfigurations']=function(_0x2b0e23,_0x4e5805,_0x392730){var _0x2f2949={};var _0x503419={};var _0x2d22f1;var _0x165163;return db['ZohoAccount'][_0xa90a('0x49')]({'where':{'id':_0x2b0e23[_0xa90a('0x48')]['id']}})['then'](handleEntityNotFound(_0x4e5805,null))[_0xa90a('0x25')](function(_0x396456){if(_0x396456){_0x2d22f1=_0x396456;_0x503419[_0xa90a('0x2e')]=_[_0xa90a('0x30')](db[_0xa90a('0x4a')][_0xa90a('0x44')]);_0x503419[_0xa90a('0x2f')]=_[_0xa90a('0x30')](_0x2b0e23[_0xa90a('0x2f')]);_0x503419[_0xa90a('0x31')]=_[_0xa90a('0x32')](_0x503419[_0xa90a('0x2e')],_0x503419[_0xa90a('0x2f')]);_0x2f2949[_0xa90a('0x33')]=_[_0xa90a('0x32')](_0x503419[_0xa90a('0x2e')],qs[_0xa90a('0x34')](_0x2b0e23[_0xa90a('0x2f')][_0xa90a('0x34')]));_0x2f2949[_0xa90a('0x33')]=_0x2f2949[_0xa90a('0x33')][_0xa90a('0x35')]?_0x2f2949[_0xa90a('0x33')]:_0x503419[_0xa90a('0x2e')];_0x2f2949[_0xa90a('0x38')]=qs[_0xa90a('0x39')](_0x2b0e23[_0xa90a('0x2f')][_0xa90a('0x39')]);_0x2f2949[_0xa90a('0x3a')]=qs[_0xa90a('0x31')](_[_0xa90a('0x3b')](_0x2b0e23[_0xa90a('0x2f')],_0x503419[_0xa90a('0x31')]));if(_0x2b0e23[_0xa90a('0x2f')]['filter']){_0x2f2949[_0xa90a('0x3a')]=_[_0xa90a('0x3d')](_0x2f2949[_0xa90a('0x3a')],{'$or':_[_0xa90a('0x2a')](_0x2f2949[_0xa90a('0x33')],function(_0x10380e){var _0x3d01ba={};_0x3d01ba[_0x10380e]={'$like':'%'+_0x2b0e23['query']['filter']+'%'};return _0x3d01ba;})});}_0x2f2949=_[_0xa90a('0x3d')]({},_0x2f2949,_0x2b0e23['options']);return _0x2d22f1[_0xa90a('0x4b')](_0x2f2949);}})[_0xa90a('0x25')](function(_0x5e1701){if(_0x5e1701){_0x165163=_0x5e1701['length'];if(!_0x2b0e23['query'][_0xa90a('0x36')](_0xa90a('0x37'))){_0x2f2949['limit']=qs['limit'](_0x2b0e23[_0xa90a('0x2f')][_0xa90a('0x20')]);_0x2f2949[_0xa90a('0x1d')]=qs[_0xa90a('0x1d')](_0x2b0e23[_0xa90a('0x2f')][_0xa90a('0x1d')]);}return _0x2d22f1[_0xa90a('0x4b')](_0x2f2949);}})[_0xa90a('0x25')](function(_0x15a137){if(_0x15a137){return _0x15a137?{'count':_0x165163,'rows':_0x15a137}:null;}})[_0xa90a('0x25')](respondWithResult(_0x4e5805,null))[_0xa90a('0x43')](handleError(_0x4e5805,null));};exports[_0xa90a('0x4c')]=function(_0x33fdc0,_0x33769b,_0x1b36b6){if(_0x33fdc0[_0xa90a('0x47')]['id']){delete _0x33fdc0[_0xa90a('0x47')]['id'];}return db[_0xa90a('0x2b')]['findOne']({'where':{'id':_0x33fdc0[_0xa90a('0x48')]['id']}})[_0xa90a('0x25')](handleEntityNotFound(_0x33769b,null))[_0xa90a('0x25')](function(_0x1f01b8){if(_0x1f01b8){_0x33fdc0[_0xa90a('0x47')][_0xa90a('0x4d')]=_0x1f01b8['id'];_0x33fdc0[_0xa90a('0x47')][_0xa90a('0x4e')]=integrations[_0xa90a('0x4f')](_0x33fdc0['body']['channel'],_0x33fdc0[_0xa90a('0x47')][_0xa90a('0x2c')]);_0x33fdc0[_0xa90a('0x47')][_0xa90a('0x50')]=integrations[_0xa90a('0x51')](_0x33fdc0[_0xa90a('0x47')][_0xa90a('0x52')],_0x33fdc0[_0xa90a('0x47')][_0xa90a('0x2c')]);return db['ZohoConfiguration'][_0xa90a('0x46')](_0x33fdc0['body'],{'include':[{'model':db[_0xa90a('0x53')],'as':'Subjects'},{'model':db[_0xa90a('0x53')],'as':_0xa90a('0x50')}]});}return null;})[_0xa90a('0x25')](respondWithResult(_0x33769b,null))[_0xa90a('0x43')](handleError(_0x33769b,null));};function getAccessToken(_0x284de9){return new Promise(function(_0x5e216b,_0x487de){var _0x18fac9;switch(_0x284de9[_0xa90a('0x54')]){case'US':_0x18fac9=_0xa90a('0x55');break;case'AU':_0x18fac9='https://accounts.zoho.com.au';break;case'EU':_0x18fac9=_0xa90a('0x56');break;case'IN':_0x18fac9=_0xa90a('0x57');break;case'CN':_0x18fac9=_0xa90a('0x58');break;default:_0x18fac9=_0xa90a('0x56');break;}var _0x43c3ff={'method':_0xa90a('0x59'),'uri':_0x18fac9+'/oauth/v2/token','qs':{'refresh_token':_0x284de9['refreshToken'],'client_id':_0x284de9[_0xa90a('0x5a')],'client_secret':_0x284de9[_0xa90a('0x5b')],'grant_type':_0xa90a('0x5c')},'json':!![]};return rp(_0x43c3ff)[_0xa90a('0x25')](function(_0x48054e){if(_0x48054e[_0xa90a('0x5d')]){_0x5e216b(_0x48054e['access_token']);}else{_0x487de('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xa90a('0x43')](function(_0x3a8c7e){_0x487de(_0x3a8c7e);});});}exports[_0xa90a('0x5e')]=function(_0x167b1f,_0x15bc2a,_0x1280a9){var _0x342b7e,_0x21e159,_0x594797,_0x528d33,_0x1e60d5;return db[_0xa90a('0x2b')][_0xa90a('0x49')]({'where':{'id':_0x167b1f['params']['id']},'attributes':['id',_0xa90a('0x5f'),_0xa90a('0x54'),'clientId','clientSecret',_0xa90a('0x60'),_0xa90a('0x61'),_0xa90a('0x62')]})['then'](handleEntityNotFound(_0x15bc2a,null))[_0xa90a('0x25')](function(_0xa94bde){_0x1e60d5=_0xa94bde;_0x342b7e=_0x1e60d5['host'];_0x21e159=_0x342b7e===_0xa90a('0x63')?'eu':_0xa90a('0x64');_0x594797=_0x1e60d5['serverUrl'];var _0x5b1716=_0x594797[_0xa90a('0x65')](-0x1);if(_0x5b1716==='/'||_0x5b1716==='\x5c'||_0x5b1716===':'){_0x594797=_0x594797[_0xa90a('0x66')](0x0,_0x594797[_0xa90a('0x67')](_0x5b1716));}if(!_0x1e60d5[_0xa90a('0x62')]){throw new Error(_0xa90a('0x68'));}return getAccessToken(_0x1e60d5);})[_0xa90a('0x25')](function(_0x30638d){if(_0x30638d){return rp({'method':_0xa90a('0x69'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x21e159),'qs':{'module':_0xa90a('0x6a')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x30638d},'json':!![]});}})[_0xa90a('0x25')](function(_0x2c0de0){if(_0x2c0de0){if(_0x2c0de0[_0xa90a('0x6b')]&&_0x2c0de0[_0xa90a('0x6b')][_0xa90a('0x6c')]){throw new Error(_0x2c0de0[_0xa90a('0x6b')][_0xa90a('0x6c')][_0xa90a('0x6d')]);}var _0x2372b1=[];var _0x324e42=[];var _0x57c342=[_0xa90a('0x6e'),_0xa90a('0x6f'),_0xa90a('0x70'),'WhoId',_0xa90a('0x71'),'Call_Result',_0xa90a('0x72'),_0xa90a('0x73')];_0x324e42=_[_0xa90a('0x74')](_0x2c0de0['fields'],function(_0x49db6e){return _0x57c342[_0xa90a('0x75')](_0x49db6e['api_name']);});for(var _0x2fe353=0x0;_0x2fe353<_0x324e42[_0xa90a('0x35')];_0x2fe353++){if(_0x324e42[_0x2fe353][_0xa90a('0x76')]===![]){_0x2372b1[_0xa90a('0x77')]({'id':_0x324e42[_0x2fe353]['id'],'name':_0x324e42[_0x2fe353][_0xa90a('0x78')],'custom':_0x324e42[_0x2fe353][_0xa90a('0x79')],'options':_0x324e42[_0x2fe353][_0xa90a('0x7a')]===_0xa90a('0x7b')&&_0x324e42[_0x2fe353][_0xa90a('0x7c')][_0xa90a('0x35')]>-0x1?_['map'](_0x324e42[_0x2fe353][_0xa90a('0x7c')],function(_0x1ebb93){return{'name':_0x1ebb93,'value':_0x1ebb93};}):[]});}}return{'count':_0x2372b1['length'],'rows':_0x2372b1};}else{return{'count':0x0,'rows':[]};}})[_0xa90a('0x25')](respondWithResult(_0x15bc2a,null))['catch'](function(_0xf46c5a){var _0xcd711b=_0x167b1f[_0xa90a('0x2f')][_0xa90a('0x7d')]?0x1f4:_0xf46c5a[_0xa90a('0x7e')]||0x1f4;logger[_0xa90a('0x6c')](_0xa90a('0x7f'),_0xa90a('0x5e'),_0xcd711b,JSON[_0xa90a('0x80')](_0xf46c5a));delete _0xf46c5a[_0xa90a('0x28')];if(_0xcd711b===0x191){_0xcd711b=0x190;}_0x15bc2a[_0xa90a('0x1a')](_0xcd711b)[_0xa90a('0x81')](_0x167b1f[_0xa90a('0x2f')][_0xa90a('0x7d')]?{'message':_0xa90a('0x82'),'statusCode':_0xf46c5a['statusCode']}:_0xf46c5a);});}; \ No newline at end of file +var _0x4a21=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','apply','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','options','includeAll','ZohoAccount','findAll','rows','include','merge','find','create','body','catch','destroy','findOne','params','ZohoConfiguration','order','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','zone','clientId','serverUrl','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','Calls','response','message','Owner','Subject','Description','Call_Duration','remove','includes','api_name','system_mandatory','data_type','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','eml-format','zip-dir','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x100db1,_0x1674a6){var _0xf1eeda=function(_0x2a9541){while(--_0x2a9541){_0x100db1['push'](_0x100db1['shift']());}};_0xf1eeda(++_0x1674a6);}(_0x4a21,0xe1));var _0x14a2=function(_0x3055ab,_0x4d1f74){_0x3055ab=_0x3055ab-0x0;var _0x31d336=_0x4a21[_0x3055ab];return _0x31d336;};'use strict';var emlformat=require(_0x14a2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x14a2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x14a2('0x2'));var Mustache=require(_0x14a2('0x3'));var util=require(_0x14a2('0x4'));var path=require(_0x14a2('0x5'));var sox=require('sox');var csv=require(_0x14a2('0x6'));var ejs=require(_0x14a2('0x7'));var fs=require('fs');var fs_extra=require(_0x14a2('0x8'));var _=require(_0x14a2('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x14a2('0xa'));var deskjs=require(_0x14a2('0xb'));var toCsv=require('to-csv');var querystring=require(_0x14a2('0xc'));var Papa=require('papaparse');var Redis=require(_0x14a2('0xd'));var authService=require(_0x14a2('0xe'));var qs=require(_0x14a2('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x14a2('0x10'));var logger=require(_0x14a2('0x11'))('api');var utils=require(_0x14a2('0x12'));var config=require(_0x14a2('0x13'));var licenseUtil=require(_0x14a2('0x14'));var db=require(_0x14a2('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2b480b,_0x53bcce){_0x53bcce=_0x53bcce||0xcc;return function(_0xfbe7b){if(_0xfbe7b){return _0x2b480b[_0x14a2('0x16')](_0x53bcce);}return _0x2b480b[_0x14a2('0x17')](_0x53bcce)['end']();};}function respondWithResult(_0x4065e4,_0x15314f){_0x15314f=_0x15314f||0xc8;return function(_0x4b5990){if(_0x4b5990){return _0x4065e4[_0x14a2('0x17')](_0x15314f)['json'](_0x4b5990);}};}function respondWithFilteredResult(_0x2a013c,_0x4143ae){return function(_0x1c8ed5){if(_0x1c8ed5){var _0x402c12=typeof _0x4143ae[_0x14a2('0x18')]==='undefined'&&typeof _0x4143ae[_0x14a2('0x19')]==='undefined';var _0x508e6f=_0x1c8ed5[_0x14a2('0x1a')];var _0x4965e1=_0x402c12?0x0:_0x4143ae[_0x14a2('0x18')];var _0x1f7989=_0x402c12?_0x1c8ed5[_0x14a2('0x1a')]:_0x4143ae[_0x14a2('0x18')]+_0x4143ae['limit'];var _0x1851e4;if(_0x1f7989>=_0x508e6f){_0x1f7989=_0x508e6f;_0x1851e4=0xc8;}else{_0x1851e4=0xce;}_0x2a013c[_0x14a2('0x17')](_0x1851e4);return _0x2a013c[_0x14a2('0x1b')](_0x14a2('0x1c'),_0x4965e1+'-'+_0x1f7989+'/'+_0x508e6f)[_0x14a2('0x1d')](_0x1c8ed5);}return null;};}function patchUpdates(_0x56182c){return function(_0xb4d247){try{jsonpatch[_0x14a2('0x1e')](_0xb4d247,_0x56182c,!![]);}catch(_0x5affd5){return BPromise['reject'](_0x5affd5);}return _0xb4d247[_0x14a2('0x1f')]();};}function saveUpdates(_0x5800d2,_0x3ba34c){return function(_0x1dbf2a){if(_0x1dbf2a){return _0x1dbf2a[_0x14a2('0x20')](_0x5800d2)[_0x14a2('0x21')](function(_0x4d2edf){return _0x4d2edf;});}return null;};}function removeEntity(_0x2ca0fc,_0x3e7f71){return function(_0xb88cbc){if(_0xb88cbc){return _0xb88cbc['destroy']()[_0x14a2('0x21')](function(){_0x2ca0fc[_0x14a2('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b3573,_0x337c6a){return function(_0x24fea4){if(!_0x24fea4){_0x3b3573[_0x14a2('0x16')](0x194);}return _0x24fea4;};}function handleError(_0x27eb66,_0x5a40d9){_0x5a40d9=_0x5a40d9||0x1f4;return function(_0x5a1a08){logger[_0x14a2('0x22')](_0x5a1a08[_0x14a2('0x23')]);if(_0x5a1a08[_0x14a2('0x24')]){delete _0x5a1a08[_0x14a2('0x24')];}_0x27eb66[_0x14a2('0x17')](_0x5a40d9)['send'](_0x5a1a08);};}exports[_0x14a2('0x25')]=function(_0x132b87,_0x4fdb07){var _0x3986e0={},_0x1ec8c3={},_0x157eaf={'count':0x0,'rows':[]};var _0x1affa6=_[_0x14a2('0x26')](db['ZohoAccount'][_0x14a2('0x27')],function(_0x2b3f40){return{'name':_0x2b3f40[_0x14a2('0x28')],'type':_0x2b3f40[_0x14a2('0x29')][_0x14a2('0x2a')]};});_0x1ec8c3[_0x14a2('0x2b')]=_['map'](_0x1affa6,_0x14a2('0x24'));_0x1ec8c3[_0x14a2('0x2c')]=_[_0x14a2('0x2d')](_0x132b87[_0x14a2('0x2c')]);_0x1ec8c3['filters']=_[_0x14a2('0x2e')](_0x1ec8c3['model'],_0x1ec8c3['query']);_0x3986e0[_0x14a2('0x2f')]=_[_0x14a2('0x2e')](_0x1ec8c3['model'],qs[_0x14a2('0x30')](_0x132b87[_0x14a2('0x2c')][_0x14a2('0x30')]));_0x3986e0[_0x14a2('0x2f')]=_0x3986e0['attributes'][_0x14a2('0x31')]?_0x3986e0[_0x14a2('0x2f')]:_0x1ec8c3[_0x14a2('0x2b')];if(!_0x132b87[_0x14a2('0x2c')][_0x14a2('0x32')](_0x14a2('0x33'))){_0x3986e0['limit']=qs[_0x14a2('0x19')](_0x132b87[_0x14a2('0x2c')][_0x14a2('0x19')]);_0x3986e0[_0x14a2('0x18')]=qs[_0x14a2('0x18')](_0x132b87['query']['offset']);}_0x3986e0['order']=qs['sort'](_0x132b87[_0x14a2('0x2c')][_0x14a2('0x34')]);_0x3986e0['where']=qs[_0x14a2('0x35')](_[_0x14a2('0x36')](_0x132b87[_0x14a2('0x2c')],_0x1ec8c3[_0x14a2('0x35')]),_0x1affa6);if(_0x132b87[_0x14a2('0x2c')][_0x14a2('0x37')]){_0x3986e0[_0x14a2('0x38')]=_['merge'](_0x3986e0[_0x14a2('0x38')],{'$or':_[_0x14a2('0x26')](_0x1affa6,function(_0x303bca){if(_0x303bca[_0x14a2('0x29')]!=='VIRTUAL'){var _0x102ec9={};_0x102ec9[_0x303bca[_0x14a2('0x24')]]={'$like':'%'+_0x132b87['query'][_0x14a2('0x37')]+'%'};return _0x102ec9;}})});}_0x3986e0=_['merge']({},_0x3986e0,_0x132b87[_0x14a2('0x39')]);var _0x5ef838={'where':_0x3986e0[_0x14a2('0x38')]};return db['ZohoAccount']['count'](_0x5ef838)[_0x14a2('0x21')](function(_0x5f2a3c){_0x157eaf[_0x14a2('0x1a')]=_0x5f2a3c;if(_0x132b87['query'][_0x14a2('0x3a')]){_0x3986e0['include']=[{'all':!![]}];}return db[_0x14a2('0x3b')][_0x14a2('0x3c')](_0x3986e0);})[_0x14a2('0x21')](function(_0x5ca085){_0x157eaf[_0x14a2('0x3d')]=_0x5ca085;return _0x157eaf;})[_0x14a2('0x21')](respondWithFilteredResult(_0x4fdb07,_0x3986e0))['catch'](handleError(_0x4fdb07,null));};exports['show']=function(_0x4f1d1b,_0x325234){var _0x5db361={'raw':![],'where':{'id':_0x4f1d1b['params']['id']}},_0x1e9b39={};_0x1e9b39[_0x14a2('0x2b')]=_['keys'](db[_0x14a2('0x3b')][_0x14a2('0x27')]);_0x1e9b39[_0x14a2('0x2c')]=_[_0x14a2('0x2d')](_0x4f1d1b[_0x14a2('0x2c')]);_0x1e9b39['filters']=_[_0x14a2('0x2e')](_0x1e9b39['model'],_0x1e9b39['query']);_0x5db361['attributes']=_[_0x14a2('0x2e')](_0x1e9b39[_0x14a2('0x2b')],qs[_0x14a2('0x30')](_0x4f1d1b[_0x14a2('0x2c')][_0x14a2('0x30')]));_0x5db361[_0x14a2('0x2f')]=_0x5db361[_0x14a2('0x2f')][_0x14a2('0x31')]?_0x5db361[_0x14a2('0x2f')]:_0x1e9b39[_0x14a2('0x2b')];if(_0x4f1d1b['query']['includeAll']){_0x5db361[_0x14a2('0x3e')]=[{'all':!![]}];}_0x5db361=_[_0x14a2('0x3f')]({},_0x5db361,_0x4f1d1b[_0x14a2('0x39')]);return db[_0x14a2('0x3b')][_0x14a2('0x40')](_0x5db361)[_0x14a2('0x21')](handleEntityNotFound(_0x325234,null))['then'](respondWithResult(_0x325234,null))['catch'](handleError(_0x325234,null));};exports[_0x14a2('0x41')]=function(_0x12b836,_0x5018fa){return db[_0x14a2('0x3b')]['create'](_0x12b836[_0x14a2('0x42')],{})[_0x14a2('0x21')](respondWithResult(_0x5018fa,0xc9))['catch'](handleError(_0x5018fa,null));};exports[_0x14a2('0x20')]=function(_0x4b3d50,_0x3d9076){if(_0x4b3d50[_0x14a2('0x42')]['id']){delete _0x4b3d50[_0x14a2('0x42')]['id'];}return db[_0x14a2('0x3b')][_0x14a2('0x40')]({'where':{'id':_0x4b3d50['params']['id']}})[_0x14a2('0x21')](handleEntityNotFound(_0x3d9076,null))[_0x14a2('0x21')](saveUpdates(_0x4b3d50[_0x14a2('0x42')],null))[_0x14a2('0x21')](respondWithResult(_0x3d9076,null))[_0x14a2('0x43')](handleError(_0x3d9076,null));};exports[_0x14a2('0x44')]=function(_0x59169c,_0x1f87ba){return db['ZohoAccount']['find']({'where':{'id':_0x59169c['params']['id']}})['then'](handleEntityNotFound(_0x1f87ba,null))[_0x14a2('0x21')](removeEntity(_0x1f87ba,null))[_0x14a2('0x43')](handleError(_0x1f87ba,null));};exports['getConfigurations']=function(_0x478705,_0x38d115,_0x3b3037){var _0x585cd6={};var _0x96c08f={};var _0x1a3bfe;var _0x2dbb37;return db[_0x14a2('0x3b')][_0x14a2('0x45')]({'where':{'id':_0x478705[_0x14a2('0x46')]['id']}})[_0x14a2('0x21')](handleEntityNotFound(_0x38d115,null))[_0x14a2('0x21')](function(_0xe0f1a4){if(_0xe0f1a4){_0x1a3bfe=_0xe0f1a4;_0x96c08f[_0x14a2('0x2b')]=_['keys'](db[_0x14a2('0x47')][_0x14a2('0x27')]);_0x96c08f[_0x14a2('0x2c')]=_['keys'](_0x478705[_0x14a2('0x2c')]);_0x96c08f[_0x14a2('0x35')]=_[_0x14a2('0x2e')](_0x96c08f[_0x14a2('0x2b')],_0x96c08f[_0x14a2('0x2c')]);_0x585cd6[_0x14a2('0x2f')]=_[_0x14a2('0x2e')](_0x96c08f[_0x14a2('0x2b')],qs[_0x14a2('0x30')](_0x478705[_0x14a2('0x2c')][_0x14a2('0x30')]));_0x585cd6['attributes']=_0x585cd6[_0x14a2('0x2f')][_0x14a2('0x31')]?_0x585cd6[_0x14a2('0x2f')]:_0x96c08f[_0x14a2('0x2b')];_0x585cd6[_0x14a2('0x48')]=qs[_0x14a2('0x34')](_0x478705['query'][_0x14a2('0x34')]);_0x585cd6[_0x14a2('0x38')]=qs['filters'](_['pick'](_0x478705['query'],_0x96c08f['filters']));if(_0x478705['query'][_0x14a2('0x37')]){_0x585cd6['where']=_[_0x14a2('0x3f')](_0x585cd6[_0x14a2('0x38')],{'$or':_[_0x14a2('0x26')](_0x585cd6['attributes'],function(_0x57e249){var _0x2338dc={};_0x2338dc[_0x57e249]={'$like':'%'+_0x478705[_0x14a2('0x2c')][_0x14a2('0x37')]+'%'};return _0x2338dc;})});}_0x585cd6=_['merge']({},_0x585cd6,_0x478705[_0x14a2('0x39')]);return _0x1a3bfe[_0x14a2('0x49')](_0x585cd6);}})[_0x14a2('0x21')](function(_0x4c9fb3){if(_0x4c9fb3){_0x2dbb37=_0x4c9fb3[_0x14a2('0x31')];if(!_0x478705[_0x14a2('0x2c')]['hasOwnProperty'](_0x14a2('0x33'))){_0x585cd6[_0x14a2('0x19')]=qs['limit'](_0x478705[_0x14a2('0x2c')]['limit']);_0x585cd6[_0x14a2('0x18')]=qs[_0x14a2('0x18')](_0x478705['query']['offset']);}return _0x1a3bfe[_0x14a2('0x49')](_0x585cd6);}})['then'](function(_0x287980){if(_0x287980){return _0x287980?{'count':_0x2dbb37,'rows':_0x287980}:null;}})[_0x14a2('0x21')](respondWithResult(_0x38d115,null))[_0x14a2('0x43')](handleError(_0x38d115,null));};exports[_0x14a2('0x4a')]=function(_0x4257e9,_0x174e14,_0x4f094b){if(_0x4257e9[_0x14a2('0x42')]['id']){delete _0x4257e9[_0x14a2('0x42')]['id'];}return db[_0x14a2('0x3b')]['findOne']({'where':{'id':_0x4257e9[_0x14a2('0x46')]['id']}})[_0x14a2('0x21')](handleEntityNotFound(_0x174e14,null))['then'](function(_0x494751){if(_0x494751){_0x4257e9['body'][_0x14a2('0x4b')]=_0x494751['id'];_0x4257e9['body'][_0x14a2('0x4c')]=integrations[_0x14a2('0x4d')](_0x4257e9[_0x14a2('0x42')][_0x14a2('0x4e')],_0x4257e9[_0x14a2('0x42')][_0x14a2('0x29')]);_0x4257e9[_0x14a2('0x42')][_0x14a2('0x4f')]=integrations[_0x14a2('0x50')](_0x4257e9[_0x14a2('0x42')][_0x14a2('0x4e')],_0x4257e9['body']['type']);return db['ZohoConfiguration']['create'](_0x4257e9[_0x14a2('0x42')],{'include':[{'model':db[_0x14a2('0x51')],'as':'Subjects'},{'model':db[_0x14a2('0x51')],'as':_0x14a2('0x4f')}]});}return null;})[_0x14a2('0x21')](respondWithResult(_0x174e14,null))[_0x14a2('0x43')](handleError(_0x174e14,null));};function getAccessToken(_0x4d331b){return new Promise(function(_0x198983,_0x3b6813){var _0x3e3ad7;switch(_0x4d331b['zone']){case'US':_0x3e3ad7=_0x14a2('0x52');break;case'AU':_0x3e3ad7=_0x14a2('0x53');break;case'EU':_0x3e3ad7=_0x14a2('0x54');break;case'IN':_0x3e3ad7='https://accounts.zoho.in';break;case'CN':_0x3e3ad7='https://accounts.zoho.com.cn';break;default:_0x3e3ad7=_0x14a2('0x54');break;}var _0x191dd2={'method':_0x14a2('0x55'),'uri':_0x3e3ad7+_0x14a2('0x56'),'qs':{'refresh_token':_0x4d331b[_0x14a2('0x57')],'client_id':_0x4d331b['clientId'],'client_secret':_0x4d331b[_0x14a2('0x58')],'grant_type':_0x14a2('0x59')},'json':!![]};return rp(_0x191dd2)['then'](function(_0x44248d){if(_0x44248d[_0x14a2('0x5a')]){_0x198983(_0x44248d[_0x14a2('0x5a')]);}else{_0x3b6813(_0x14a2('0x5b'));}})[_0x14a2('0x43')](function(_0x57c873){_0x3b6813(_0x57c873);});});}exports['getFields']=function(_0x4783f8,_0x322d9c,_0x218698){var _0x87fc41,_0x4e6418,_0xfdcfe0,_0x1ea862,_0x20f635;return db[_0x14a2('0x3b')][_0x14a2('0x45')]({'where':{'id':_0x4783f8['params']['id']},'attributes':['id',_0x14a2('0x5c'),_0x14a2('0x5d'),_0x14a2('0x5e'),'clientSecret',_0x14a2('0x5f'),'code',_0x14a2('0x57')]})[_0x14a2('0x21')](handleEntityNotFound(_0x322d9c,null))[_0x14a2('0x21')](function(_0x428f37){_0x20f635=_0x428f37;_0x87fc41=_0x20f635[_0x14a2('0x5c')];_0x4e6418=_0x87fc41===_0x14a2('0x60')?'eu':_0x14a2('0x61');_0xfdcfe0=_0x20f635[_0x14a2('0x5f')];var _0x1ca3b5=_0xfdcfe0[_0x14a2('0x62')](-0x1);if(_0x1ca3b5==='/'||_0x1ca3b5==='\x5c'||_0x1ca3b5===':'){_0xfdcfe0=_0xfdcfe0[_0x14a2('0x63')](0x0,_0xfdcfe0[_0x14a2('0x64')](_0x1ca3b5));}if(!_0x20f635[_0x14a2('0x57')]){throw new Error(_0x14a2('0x65'));}return getAccessToken(_0x20f635);})[_0x14a2('0x21')](function(_0x1268ba){if(_0x1268ba){return rp({'method':_0x14a2('0x66'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x4e6418),'qs':{'module':_0x14a2('0x67')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1268ba},'json':!![]});}})[_0x14a2('0x21')](function(_0x40c3f5){if(_0x40c3f5){if(_0x40c3f5[_0x14a2('0x68')]&&_0x40c3f5[_0x14a2('0x68')]['error']){throw new Error(_0x40c3f5['response']['error'][_0x14a2('0x69')]);}var _0x42b3d5=[];var _0x46dcd3=[];var _0x274fd3=[_0x14a2('0x6a'),_0x14a2('0x6b'),_0x14a2('0x6c'),'WhoId',_0x14a2('0x6d'),'Call_Result','Call_Start_Time','Call_Type'];_0x46dcd3=_[_0x14a2('0x6e')](_0x40c3f5[_0x14a2('0x30')],function(_0x258a5a){return _0x274fd3[_0x14a2('0x6f')](_0x258a5a[_0x14a2('0x70')]);});for(var _0x4747e8=0x0;_0x4747e8<_0x46dcd3[_0x14a2('0x31')];_0x4747e8++){if(_0x46dcd3[_0x4747e8][_0x14a2('0x71')]===![]){_0x42b3d5['push']({'id':_0x46dcd3[_0x4747e8]['id'],'name':_0x46dcd3[_0x4747e8]['display_label'],'custom':_0x46dcd3[_0x4747e8]['custom_field'],'options':_0x46dcd3[_0x4747e8][_0x14a2('0x72')]==='picklist'&&_0x46dcd3[_0x4747e8][_0x14a2('0x73')][_0x14a2('0x31')]>-0x1?_['map'](_0x46dcd3[_0x4747e8]['pick_list_values'],function(_0x4bb93d){return{'name':_0x4bb93d,'value':_0x4bb93d};}):[]});}}return{'count':_0x42b3d5['length'],'rows':_0x42b3d5};}else{return{'count':0x0,'rows':[]};}})[_0x14a2('0x21')](respondWithResult(_0x322d9c,null))['catch'](function(_0xccc88f){var _0x31d21a=_0x4783f8['query']['test']?0x1f4:_0xccc88f[_0x14a2('0x74')]||0x1f4;logger[_0x14a2('0x22')](_0x14a2('0x75'),_0x14a2('0x76'),_0x31d21a,JSON[_0x14a2('0x77')](_0xccc88f));delete _0xccc88f[_0x14a2('0x24')];if(_0x31d21a===0x191){_0x31d21a=0x190;}_0x322d9c['status'](_0x31d21a)['send'](_0x4783f8[_0x14a2('0x2c')][_0x14a2('0x78')]?{'message':_0x14a2('0x79'),'statusCode':_0xccc88f[_0x14a2('0x74')]}:_0xccc88f);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 04f2d0d..0678412 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 _0x0ab8=['https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','parse','refresh_token','refreshToken','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','catch','inspect','https://accounts.zoho.eu','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','api','moment','bluebird','rimraf','../../config/environment','define','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in'];(function(_0x23b0b4,_0x3552f7){var _0x52b4a6=function(_0x2c9db8){while(--_0x2c9db8){_0x23b0b4['push'](_0x23b0b4['shift']());}};_0x52b4a6(++_0x3552f7);}(_0x0ab8,0x197));var _0x80ab=function(_0x2b62e9,_0x5353a7){_0x2b62e9=_0x2b62e9-0x0;var _0x428428=_0x0ab8[_0x2b62e9];return _0x428428;};'use strict';var _=require(_0x80ab('0x0'));var util=require(_0x80ab('0x1'));var logger=require('../../config/logger')(_0x80ab('0x2'));var moment=require(_0x80ab('0x3'));var BPromise=require(_0x80ab('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x80ab('0x5'));var config=require(_0x80ab('0x6'));var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x1d0214,_0x395ed3){return _0x1d0214[_0x80ab('0x7')]('ZohoAccount',attributes,{'tableName':_0x80ab('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x47285d,_0x3d9ab9,_0x5bd5ee){if(_0x47285d[_0x80ab('0x9')](_0x80ab('0xa'))||_0x47285d[_0x80ab('0x9')](_0x80ab('0xb'))||_0x47285d[_0x80ab('0x9')](_0x80ab('0xc'))||_0x47285d[_0x80ab('0x9')](_0x80ab('0xd'))||_0x47285d[_0x80ab('0x9')](_0x80ab('0xe'))||_0x47285d[_0x80ab('0x9')](_0x80ab('0xf'))){var _0x5f3a60,_0x2747dc;_0x5f3a60=_0x47285d[_0x80ab('0xb')];var _0x327f16=_0x5f3a60[_0x80ab('0x10')](-0x1);if(_0x327f16==='/'||_0x327f16==='\x5c'||_0x327f16===':'){_0x5f3a60=_0x5f3a60[_0x80ab('0x11')](0x0,_0x5f3a60[_0x80ab('0x12')](_0x327f16));}switch(_0x47285d[_0x80ab('0xa')]){case'US':_0x2747dc=_0x80ab('0x13');break;case'AU':_0x2747dc=_0x80ab('0x14');break;case'IN':_0x2747dc=_0x80ab('0x15');break;case'CN':_0x2747dc=_0x80ab('0x16');break;default:_0x2747dc='https://accounts.zoho.eu';break;}var _0x31e0d1={'method':_0x80ab('0x17'),'uri':_0x2747dc+_0x80ab('0x18'),'form':{'grant_type':_0x80ab('0x19'),'client_id':_0x47285d['clientId'],'client_secret':_0x47285d[_0x80ab('0xd')],'redirect_uri':_0x47285d[_0x80ab('0xb')],'code':_0x47285d['code']},'headers':{'Content-Type':_0x80ab('0x1a')}};return rp(_0x31e0d1)['then'](function(_0x3d26d1){var _0x427376=JSON[_0x80ab('0x1b')](_0x3d26d1);if(_0x427376[_0x80ab('0x1c')]){_0x47285d[_0x80ab('0x1d')]=_0x427376['refresh_token'];logger['info'](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x47285d['name'],_0x47285d['id']));}else{logger[_0x80ab('0x1e')](util[_0x80ab('0x1f')](_0x80ab('0x20'),_0x47285d[_0x80ab('0x21')],_0x47285d['id']),util['inspect'](_0x427376,{'showHidden':![],'depth':null}));}return _0x5bd5ee(null,_0x3d9ab9);})[_0x80ab('0x22')](function(_0x403271){logger['error'](util[_0x80ab('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x47285d[_0x80ab('0x21')],_0x47285d['id']),util[_0x80ab('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x5bd5ee(_0x403271);});}else{return _0x5bd5ee(null,_0x3d9ab9);}},'beforeUpdate':function(_0x18d6f6,_0x1465c6,_0x43ec90){if(_0x18d6f6[_0x80ab('0x9')]('zone')||_0x18d6f6[_0x80ab('0x9')]('serverUrl')||_0x18d6f6[_0x80ab('0x9')](_0x80ab('0xc'))||_0x18d6f6[_0x80ab('0x9')](_0x80ab('0xd'))||_0x18d6f6[_0x80ab('0x9')](_0x80ab('0xe'))||_0x18d6f6[_0x80ab('0x9')](_0x80ab('0xf'))){var _0x2a3719,_0x1379dc;_0x2a3719=_0x18d6f6[_0x80ab('0xb')];var _0x18e9c2=_0x2a3719['slice'](-0x1);if(_0x18e9c2==='/'||_0x18e9c2==='\x5c'||_0x18e9c2===':'){_0x2a3719=_0x2a3719[_0x80ab('0x11')](0x0,_0x2a3719[_0x80ab('0x12')](_0x18e9c2));}switch(_0x18d6f6[_0x80ab('0xa')]){case'US':_0x1379dc=_0x80ab('0x13');break;case'AU':_0x1379dc=_0x80ab('0x14');break;case'IN':_0x1379dc=_0x80ab('0x15');break;case'CN':_0x1379dc=_0x80ab('0x16');break;default:_0x1379dc=_0x80ab('0x24');break;}var _0x2a15b8={'method':_0x80ab('0x17'),'uri':_0x1379dc+_0x80ab('0x18'),'form':{'grant_type':_0x80ab('0x19'),'client_id':_0x18d6f6[_0x80ab('0xc')],'client_secret':_0x18d6f6[_0x80ab('0xd')],'redirect_uri':_0x18d6f6[_0x80ab('0xb')],'code':_0x18d6f6[_0x80ab('0xe')]},'headers':{'Content-Type':_0x80ab('0x1a')}};return rp(_0x2a15b8)['then'](function(_0x572ad0){var _0x121f18=JSON[_0x80ab('0x1b')](_0x572ad0);if(_0x121f18[_0x80ab('0x1c')]){_0x18d6f6[_0x80ab('0x1d')]=_0x121f18[_0x80ab('0x1c')];logger[_0x80ab('0x25')](util['format'](_0x80ab('0x26'),_0x18d6f6['name'],_0x18d6f6['id']));}else{logger[_0x80ab('0x1e')](util[_0x80ab('0x1f')](_0x80ab('0x20'),_0x18d6f6['name'],_0x18d6f6['id']),util[_0x80ab('0x23')](_0x121f18,{'showHidden':![],'depth':null}));}return _0x43ec90(null,_0x1465c6);})[_0x80ab('0x22')](function(_0x31cb43){logger[_0x80ab('0x1e')](util[_0x80ab('0x1f')](_0x80ab('0x20'),_0x18d6f6[_0x80ab('0x21')],_0x18d6f6['id']),util[_0x80ab('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x43ec90(_0x31cb43);});}else{return _0x43ec90(null,_0x1465c6);}}}});}; \ No newline at end of file +var _0x1305=['util','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','ZohoAccount','zone','changed','clientId','clientSecret','code','host','serverUrl','slice','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','name','lastIndexOf','https://accounts.zoho.eu','authorization_code','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash'];(function(_0x50aabc,_0x39ca3f){var _0x2f464b=function(_0xb8f9ef){while(--_0xb8f9ef){_0x50aabc['push'](_0x50aabc['shift']());}};_0x2f464b(++_0x39ca3f);}(_0x1305,0xef));var _0x5130=function(_0x5a0ed0,_0x5d666e){_0x5a0ed0=_0x5a0ed0-0x0;var _0x244a98=_0x1305[_0x5a0ed0];return _0x244a98;};'use strict';var _=require(_0x5130('0x0'));var util=require(_0x5130('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5130('0x2'));var BPromise=require(_0x5130('0x3'));var rp=require(_0x5130('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5130('0x5'));var config=require(_0x5130('0x6'));var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x5130('0x7')]=function(_0x96903d,_0x22f474){return _0x96903d[_0x5130('0x8')](_0x5130('0x9'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x8bef1,_0xe9dfb2,_0x26860e){if(_0x8bef1['changed'](_0x5130('0xa'))||_0x8bef1['changed']('serverUrl')||_0x8bef1[_0x5130('0xb')](_0x5130('0xc'))||_0x8bef1[_0x5130('0xb')](_0x5130('0xd'))||_0x8bef1['changed'](_0x5130('0xe'))||_0x8bef1[_0x5130('0xb')](_0x5130('0xf'))){var _0x492dff,_0x3f5691;_0x492dff=_0x8bef1[_0x5130('0x10')];var _0x11fec6=_0x492dff[_0x5130('0x11')](-0x1);if(_0x11fec6==='/'||_0x11fec6==='\x5c'||_0x11fec6===':'){_0x492dff=_0x492dff[_0x5130('0x12')](0x0,_0x492dff['lastIndexOf'](_0x11fec6));}switch(_0x8bef1[_0x5130('0xa')]){case'US':_0x3f5691=_0x5130('0x13');break;case'AU':_0x3f5691=_0x5130('0x14');break;case'IN':_0x3f5691=_0x5130('0x15');break;case'CN':_0x3f5691=_0x5130('0x16');break;default:_0x3f5691='https://accounts.zoho.eu';break;}var _0x53871f={'method':_0x5130('0x17'),'uri':_0x3f5691+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x8bef1[_0x5130('0xc')],'client_secret':_0x8bef1[_0x5130('0xd')],'redirect_uri':_0x8bef1['serverUrl'],'code':_0x8bef1['code']},'headers':{'Content-Type':_0x5130('0x18')}};return rp(_0x53871f)[_0x5130('0x19')](function(_0x73f727){var _0x4f4146=JSON[_0x5130('0x1a')](_0x73f727);if(_0x4f4146[_0x5130('0x1b')]){_0x8bef1[_0x5130('0x1c')]=_0x4f4146['refresh_token'];logger[_0x5130('0x1d')](util[_0x5130('0x1e')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x8bef1['name'],_0x8bef1['id']));}else{logger[_0x5130('0x1f')](util[_0x5130('0x1e')](_0x5130('0x20'),_0x8bef1['name'],_0x8bef1['id']),util[_0x5130('0x21')](_0x4f4146,{'showHidden':![],'depth':null}));}return _0x26860e(null,_0xe9dfb2);})[_0x5130('0x22')](function(_0x32ff39){logger[_0x5130('0x1f')](util['format'](_0x5130('0x20'),_0x8bef1[_0x5130('0x23')],_0x8bef1['id']),util[_0x5130('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x26860e(_0x32ff39);});}else{return _0x26860e(null,_0xe9dfb2);}},'beforeUpdate':function(_0x3b13cc,_0x571dee,_0x49d4b3){if(_0x3b13cc[_0x5130('0xb')](_0x5130('0xa'))||_0x3b13cc[_0x5130('0xb')](_0x5130('0x10'))||_0x3b13cc[_0x5130('0xb')](_0x5130('0xc'))||_0x3b13cc['changed'](_0x5130('0xd'))||_0x3b13cc[_0x5130('0xb')]('code')||_0x3b13cc['changed']('host')){var _0x3c1e04,_0x34aa57;_0x3c1e04=_0x3b13cc[_0x5130('0x10')];var _0x3e828=_0x3c1e04[_0x5130('0x11')](-0x1);if(_0x3e828==='/'||_0x3e828==='\x5c'||_0x3e828===':'){_0x3c1e04=_0x3c1e04[_0x5130('0x12')](0x0,_0x3c1e04[_0x5130('0x24')](_0x3e828));}switch(_0x3b13cc[_0x5130('0xa')]){case'US':_0x34aa57=_0x5130('0x13');break;case'AU':_0x34aa57=_0x5130('0x14');break;case'IN':_0x34aa57=_0x5130('0x15');break;case'CN':_0x34aa57='https://accounts.zoho.com.cn';break;default:_0x34aa57=_0x5130('0x25');break;}var _0x517fe7={'method':_0x5130('0x17'),'uri':_0x34aa57+'/oauth/v2/token','form':{'grant_type':_0x5130('0x26'),'client_id':_0x3b13cc[_0x5130('0xc')],'client_secret':_0x3b13cc[_0x5130('0xd')],'redirect_uri':_0x3b13cc[_0x5130('0x10')],'code':_0x3b13cc[_0x5130('0xe')]},'headers':{'Content-Type':_0x5130('0x18')}};return rp(_0x517fe7)['then'](function(_0xce5b6b){var _0x10bb2b=JSON[_0x5130('0x1a')](_0xce5b6b);if(_0x10bb2b[_0x5130('0x1b')]){_0x3b13cc[_0x5130('0x1c')]=_0x10bb2b[_0x5130('0x1b')];logger[_0x5130('0x1d')](util[_0x5130('0x1e')](_0x5130('0x27'),_0x3b13cc[_0x5130('0x23')],_0x3b13cc['id']));}else{logger[_0x5130('0x1f')](util[_0x5130('0x1e')](_0x5130('0x20'),_0x3b13cc['name'],_0x3b13cc['id']),util[_0x5130('0x21')](_0x10bb2b,{'showHidden':![],'depth':null}));}return _0x49d4b3(null,_0x571dee);})['catch'](function(_0xdb2803){logger[_0x5130('0x1f')](util[_0x5130('0x1e')](_0x5130('0x20'),_0x3b13cc['name'],_0x3b13cc['id']),util[_0x5130('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x49d4b3(_0xdb2803);});}else{return _0x49d4b3(null,_0x571dee);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index c52c61c..1c84efb 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 _0x9536=['code','message','info','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowZohoAccount','find','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9536,0x179));var _0x6953=function(_0xbe40ad,_0x44343c){_0xbe40ad=_0xbe40ad-0x0;var _0x50fac9=_0x9536[_0xbe40ad];return _0x50fac9;};'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')]('ZohoAccount,\x20%s,\x20%s',_0x385f2d,_0x16b79b);_0x58ac30(_0x16b79b);});});}exports[_0x6953('0x17')]=function(_0x2da771){var _0x4b43ae=this;return new Promise(function(_0x10858a,_0x3207dd){return db[_0x6953('0x18')][_0x6953('0x19')]({'raw':_0x2da771[_0x6953('0x1a')]?_0x2da771['options'][_0x6953('0x1b')]===undefined?!![]:![]:!![],'where':_0x2da771[_0x6953('0x1a')]?_0x2da771[_0x6953('0x1a')][_0x6953('0x1c')]||null:null,'attributes':_0x2da771[_0x6953('0x1a')]?_0x2da771['options'][_0x6953('0x1d')]||null:null,'limit':_0x2da771[_0x6953('0x1a')]?_0x2da771['options'][_0x6953('0x1e')]||null:null,'include':_0x2da771[_0x6953('0x1a')]?_0x2da771[_0x6953('0x1a')][_0x6953('0x1f')]?_['map'](_0x2da771[_0x6953('0x1a')][_0x6953('0x1f')],function(_0x2a7f6a){return{'model':db[_0x2a7f6a['model']],'as':_0x2a7f6a['as'],'attributes':_0x2a7f6a['attributes'],'include':_0x2a7f6a['include']?_[_0x6953('0x20')](_0x2a7f6a[_0x6953('0x1f')],function(_0x550be4){return{'model':db[_0x550be4[_0x6953('0x21')]],'as':_0x550be4['as'],'attributes':_0x550be4['attributes'],'include':_0x550be4[_0x6953('0x1f')]?_[_0x6953('0x20')](_0x550be4[_0x6953('0x1f')],function(_0x2cc01e){return{'model':db[_0x2cc01e[_0x6953('0x21')]],'as':_0x2cc01e['as'],'attributes':_0x2cc01e[_0x6953('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dd890){logger[_0x6953('0x15')]('GetZohoAccount',_0x2da771);logger[_0x6953('0xf')]('GetZohoAccount',_0x2da771,JSON[_0x6953('0x11')](_0x3dd890));_0x10858a(_0x3dd890);})[_0x6953('0x16')](function(_0x426c7c){logger['error'](_0x6953('0x17'),_0x426c7c[_0x6953('0x14')],_0x2da771);_0x3207dd(_0x4b43ae[_0x6953('0x12')](0x1f4,_0x426c7c['message']));});});};exports[_0x6953('0x22')]=function(_0x132a71){var _0x481c6a=this;return new Promise(function(_0x4d856d,_0xd80e42){return db[_0x6953('0x18')][_0x6953('0x23')]({'raw':_0x132a71[_0x6953('0x1a')]?_0x132a71[_0x6953('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x132a71[_0x6953('0x1a')]?_0x132a71['options'][_0x6953('0x1c')]||null:null,'attributes':_0x132a71[_0x6953('0x1a')]?_0x132a71['options']['attributes']||null:null,'include':_0x132a71[_0x6953('0x1a')]?_0x132a71[_0x6953('0x1a')][_0x6953('0x1f')]?_['map'](_0x132a71[_0x6953('0x1a')]['include'],function(_0x4e95f1){return{'model':db[_0x4e95f1['model']],'as':_0x4e95f1['as'],'attributes':_0x4e95f1['attributes'],'include':_0x4e95f1[_0x6953('0x1f')]?_[_0x6953('0x20')](_0x4e95f1[_0x6953('0x1f')],function(_0x11f316){return{'model':db[_0x11f316[_0x6953('0x21')]],'as':_0x11f316['as'],'attributes':_0x11f316[_0x6953('0x1d')],'include':_0x11f316['include']?_[_0x6953('0x20')](_0x11f316['include'],function(_0x199c67){return{'model':db[_0x199c67['model']],'as':_0x199c67['as'],'attributes':_0x199c67[_0x6953('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6953('0xc')](function(_0xd81149){logger[_0x6953('0x15')]('ShowZohoAccount',_0x132a71);logger[_0x6953('0xf')](_0x6953('0x22'),_0x132a71,JSON[_0x6953('0x11')](_0xd81149));_0x4d856d(_0xd81149);})[_0x6953('0x16')](function(_0x40b6ea){logger[_0x6953('0x12')](_0x6953('0x22'),_0x40b6ea[_0x6953('0x14')],_0x132a71);_0xd80e42(_0x481c6a[_0x6953('0x12')](0x1f4,_0x40b6ea[_0x6953('0x14')]));});});}; \ No newline at end of file +var _0x3445=['bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZohoAccount,\x20%s,\x20%s','result','catch','GetZohoAccount','ZohoAccount','options','where','attributes','limit','map','include','model','ShowZohoAccount','find','lodash','util','moment'];(function(_0x2b9a64,_0x27225d){var _0x268d01=function(_0x4b33b9){while(--_0x4b33b9){_0x2b9a64['push'](_0x2b9a64['shift']());}};_0x268d01(++_0x27225d);}(_0x3445,0x1b7));var _0x5344=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3445[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5344('0x0'));var util=require(_0x5344('0x1'));var moment=require(_0x5344('0x2'));var BPromise=require(_0x5344('0x3'));var rs=require(_0x5344('0x4'));var fs=require('fs');var Redis=require(_0x5344('0x5'));var db=require(_0x5344('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5344('0x7'));var config=require(_0x5344('0x8'));var jayson=require(_0x5344('0x9'));var client=jayson[_0x5344('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ffe5f,_0x5642cb,_0x5a4f52){return new BPromise(function(_0x3f638c,_0x4adb8a){return client['request'](_0x4ffe5f,_0x5a4f52)[_0x5344('0xb')](function(_0xbc5346){logger[_0x5344('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x5642cb,_0x5344('0xd'));logger[_0x5344('0xe')](_0x5344('0xf'),_0x5642cb,_0x5344('0xd'),JSON[_0x5344('0x10')](_0xbc5346));if(_0xbc5346[_0x5344('0x11')]){if(_0xbc5346['error'][_0x5344('0x12')]===0x1f4){logger[_0x5344('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x5642cb,_0xbc5346[_0x5344('0x11')]['message']);return _0x4adb8a(_0xbc5346[_0x5344('0x11')]['message']);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x5642cb,_0xbc5346[_0x5344('0x11')][_0x5344('0x13')]);return _0x3f638c(_0xbc5346[_0x5344('0x11')][_0x5344('0x13')]);}else{logger[_0x5344('0xc')](_0x5344('0x14'),_0x5642cb,_0x5344('0xd'));_0x3f638c(_0xbc5346[_0x5344('0x15')][_0x5344('0x13')]);}})[_0x5344('0x16')](function(_0x4ae241){logger[_0x5344('0x11')](_0x5344('0x14'),_0x5642cb,_0x4ae241);_0x4adb8a(_0x4ae241);});});}exports[_0x5344('0x17')]=function(_0x215fbd){var _0x517b16=this;return new Promise(function(_0x4fb036,_0x508e34){return db[_0x5344('0x18')]['findAll']({'raw':_0x215fbd['options']?_0x215fbd['options']['raw']===undefined?!![]:![]:!![],'where':_0x215fbd[_0x5344('0x19')]?_0x215fbd[_0x5344('0x19')][_0x5344('0x1a')]||null:null,'attributes':_0x215fbd[_0x5344('0x19')]?_0x215fbd[_0x5344('0x19')][_0x5344('0x1b')]||null:null,'limit':_0x215fbd[_0x5344('0x19')]?_0x215fbd[_0x5344('0x19')][_0x5344('0x1c')]||null:null,'include':_0x215fbd[_0x5344('0x19')]?_0x215fbd['options']['include']?_[_0x5344('0x1d')](_0x215fbd[_0x5344('0x19')][_0x5344('0x1e')],function(_0x434e0d){return{'model':db[_0x434e0d[_0x5344('0x1f')]],'as':_0x434e0d['as'],'attributes':_0x434e0d['attributes'],'include':_0x434e0d[_0x5344('0x1e')]?_[_0x5344('0x1d')](_0x434e0d[_0x5344('0x1e')],function(_0x477c0a){return{'model':db[_0x477c0a['model']],'as':_0x477c0a['as'],'attributes':_0x477c0a[_0x5344('0x1b')],'include':_0x477c0a[_0x5344('0x1e')]?_[_0x5344('0x1d')](_0x477c0a[_0x5344('0x1e')],function(_0x4c120c){return{'model':db[_0x4c120c['model']],'as':_0x4c120c['as'],'attributes':_0x4c120c[_0x5344('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5344('0xb')](function(_0x3471a9){logger[_0x5344('0xc')]('GetZohoAccount',_0x215fbd);logger[_0x5344('0xe')](_0x5344('0x17'),_0x215fbd,JSON[_0x5344('0x10')](_0x3471a9));_0x4fb036(_0x3471a9);})[_0x5344('0x16')](function(_0x1867d6){logger[_0x5344('0x11')](_0x5344('0x17'),_0x1867d6['message'],_0x215fbd);_0x508e34(_0x517b16[_0x5344('0x11')](0x1f4,_0x1867d6['message']));});});};exports[_0x5344('0x20')]=function(_0x2ad28e){var _0x3dbb4e=this;return new Promise(function(_0xdaa060,_0x43a1e2){return db[_0x5344('0x18')][_0x5344('0x21')]({'raw':_0x2ad28e[_0x5344('0x19')]?_0x2ad28e[_0x5344('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2ad28e[_0x5344('0x19')]?_0x2ad28e[_0x5344('0x19')][_0x5344('0x1a')]||null:null,'attributes':_0x2ad28e[_0x5344('0x19')]?_0x2ad28e['options'][_0x5344('0x1b')]||null:null,'include':_0x2ad28e[_0x5344('0x19')]?_0x2ad28e['options'][_0x5344('0x1e')]?_[_0x5344('0x1d')](_0x2ad28e['options'][_0x5344('0x1e')],function(_0x3c0988){return{'model':db[_0x3c0988['model']],'as':_0x3c0988['as'],'attributes':_0x3c0988[_0x5344('0x1b')],'include':_0x3c0988[_0x5344('0x1e')]?_['map'](_0x3c0988[_0x5344('0x1e')],function(_0x332a1d){return{'model':db[_0x332a1d[_0x5344('0x1f')]],'as':_0x332a1d['as'],'attributes':_0x332a1d[_0x5344('0x1b')],'include':_0x332a1d[_0x5344('0x1e')]?_['map'](_0x332a1d['include'],function(_0x3fafb1){return{'model':db[_0x3fafb1['model']],'as':_0x3fafb1['as'],'attributes':_0x3fafb1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a430){logger[_0x5344('0xc')](_0x5344('0x20'),_0x2ad28e);logger['debug'](_0x5344('0x20'),_0x2ad28e,JSON['stringify'](_0x45a430));_0xdaa060(_0x45a430);})['catch'](function(_0x5e812f){logger[_0x5344('0x11')](_0x5344('0x20'),_0x5e812f[_0x5344('0x13')],_0x2ad28e);_0x43a1e2(_0x3dbb4e[_0x5344('0x11')](0x1f4,_0x5e812f[_0x5344('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 376b099..a7b7a9f 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 _0x85f6=['update','delete','/:id','exports','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getSubjects','/:id/descriptions','post','put'];(function(_0x2dc96f,_0x459058){var _0xd012da=function(_0x38d032){while(--_0x38d032){_0x2dc96f['push'](_0x2dc96f['shift']());}};_0xd012da(++_0x459058);}(_0x85f6,0x108));var _0x685f=function(_0x37dc31,_0xe7197b){_0x37dc31=_0x37dc31-0x0;var _0x28292c=_0x85f6[_0x37dc31];return _0x28292c;};'use strict';var multer=require('multer');var util=require(_0x685f('0x0'));var path=require(_0x685f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x685f('0x2')]();var fs_extra=require(_0x685f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x685f('0x4'));var config=require(_0x685f('0x5'));var controller=require(_0x685f('0x6'));router[_0x685f('0x7')]('/',auth[_0x685f('0x8')](),controller[_0x685f('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x685f('0xa')]);router[_0x685f('0x7')](_0x685f('0xb'),auth[_0x685f('0x8')](),controller['getFields']);router['get']('/:id/subjects',auth[_0x685f('0x8')](),controller[_0x685f('0xc')]);router[_0x685f('0x7')](_0x685f('0xd'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x685f('0xe')]('/',auth[_0x685f('0x8')](),controller['create']);router[_0x685f('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x685f('0x10')]);router[_0x685f('0x11')](_0x685f('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0x685f('0x13')]=router; \ No newline at end of file +var _0x6204=['express','Router','fs-extra','../../components/auth/service','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','destroy','exports','multer','util','connect-timeout'];(function(_0x5e4563,_0x3ff918){var _0x8d1bf5=function(_0x3bf7a9){while(--_0x3bf7a9){_0x5e4563['push'](_0x5e4563['shift']());}};_0x8d1bf5(++_0x3ff918);}(_0x6204,0x135));var _0x4620=function(_0x2183ca,_0xe25acc){_0x2183ca=_0x2183ca-0x0;var _0x2cf250=_0x6204[_0x2183ca];return _0x2cf250;};'use strict';var multer=require(_0x4620('0x0'));var util=require(_0x4620('0x1'));var path=require('path');var timeout=require(_0x4620('0x2'));var express=require(_0x4620('0x3'));var router=express[_0x4620('0x4')]();var fs_extra=require(_0x4620('0x5'));var auth=require(_0x4620('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4620('0x7'));router[_0x4620('0x8')]('/',auth[_0x4620('0x9')](),controller[_0x4620('0xa')]);router[_0x4620('0x8')](_0x4620('0xb'),auth[_0x4620('0x9')](),controller[_0x4620('0xc')]);router[_0x4620('0x8')](_0x4620('0xd'),auth[_0x4620('0x9')](),controller[_0x4620('0xe')]);router[_0x4620('0x8')](_0x4620('0xf'),auth[_0x4620('0x9')](),controller[_0x4620('0x10')]);router[_0x4620('0x8')](_0x4620('0x11'),auth[_0x4620('0x9')](),controller[_0x4620('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4620('0x13')]);router[_0x4620('0x14')](_0x4620('0xb'),auth[_0x4620('0x9')](),controller[_0x4620('0x15')]);router['delete']('/:id',auth[_0x4620('0x9')](),controller[_0x4620('0x16')]);module[_0x4620('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 31223de..89cade1 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 _0x3b2a=['exports','ENUM','lead','contact','contact_lead','STRING'];(function(_0x25c82e,_0x2bb68f){var _0x601d2c=function(_0x2eee18){while(--_0x2eee18){_0x25c82e['push'](_0x25c82e['shift']());}};_0x601d2c(++_0x2bb68f);}(_0x3b2a,0x90));var _0xa3b2=function(_0x3a8d7d,_0x47a83c){_0x3a8d7d=_0x3a8d7d-0x0;var _0xd9fd54=_0x3b2a[_0x3a8d7d];return _0xd9fd54;};'use strict';var Sequelize=require('sequelize');module[_0xa3b2('0x0')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xa3b2('0x1')](_0xa3b2('0x2'),_0xa3b2('0x3'),'nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xa3b2('0x1')](_0xa3b2('0x4'),_0xa3b2('0x3'),'lead'),'defaultValue':_0xa3b2('0x4')},'description':{'type':Sequelize[_0xa3b2('0x5')]}}; \ No newline at end of file +var _0x163b=['ENUM','lead','sequelize','exports','STRING','contact','nothing'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x163b,0x175));var _0xb163=function(_0x30f324,_0x262105){_0x30f324=_0x30f324-0x0;var _0x56d32c=_0x163b[_0x30f324];return _0x56d32c;};'use strict';var Sequelize=require(_0xb163('0x0'));module[_0xb163('0x1')]={'name':{'type':Sequelize[_0xb163('0x2')]},'moduleCreate':{'type':Sequelize['ENUM']('lead',_0xb163('0x3'),_0xb163('0x4')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xb163('0x5')]('contact_lead',_0xb163('0x3'),_0xb163('0x6')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xb163('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 4b7b33f..dceb16f 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 _0x8ff8=['include','findAll','rows','catch','show','params','keys','find','create','body','findOne','ZohoField','getFields','getSubjects','pick','nolimit','getDescriptions','eml-format','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll'];(function(_0x2e5011,_0x2ed248){var _0x4fed64=function(_0x5c3e84){while(--_0x5c3e84){_0x2e5011['push'](_0x2e5011['shift']());}};_0x4fed64(++_0x2ed248);}(_0x8ff8,0x65));var _0x88ff=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8ff8[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x88ff('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x88ff('0x1'));var moment=require(_0x88ff('0x2'));var BPromise=require(_0x88ff('0x3'));var Mustache=require(_0x88ff('0x4'));var util=require('util');var path=require(_0x88ff('0x5'));var sox=require('sox');var csv=require(_0x88ff('0x6'));var ejs=require(_0x88ff('0x7'));var fs=require('fs');var fs_extra=require(_0x88ff('0x8'));var _=require(_0x88ff('0x9'));var squel=require(_0x88ff('0xa'));var crypto=require(_0x88ff('0xb'));var jsforce=require(_0x88ff('0xc'));var deskjs=require(_0x88ff('0xd'));var toCsv=require(_0x88ff('0x6'));var querystring=require(_0x88ff('0xe'));var Papa=require(_0x88ff('0xf'));var Redis=require(_0x88ff('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x88ff('0x11'));var as=require(_0x88ff('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x88ff('0x13'))(_0x88ff('0x14'));var utils=require(_0x88ff('0x15'));var config=require(_0x88ff('0x16'));var licenseUtil=require(_0x88ff('0x17'));var db=require(_0x88ff('0x18'))['db'];function respondWithStatusCode(_0x9e17cd,_0x32b4c0){_0x32b4c0=_0x32b4c0||0xcc;return function(_0x5b44f2){if(_0x5b44f2){return _0x9e17cd[_0x88ff('0x19')](_0x32b4c0);}return _0x9e17cd[_0x88ff('0x1a')](_0x32b4c0)[_0x88ff('0x1b')]();};}function respondWithResult(_0x519260,_0x57860d){_0x57860d=_0x57860d||0xc8;return function(_0x5f2d3c){if(_0x5f2d3c){return _0x519260[_0x88ff('0x1a')](_0x57860d)[_0x88ff('0x1c')](_0x5f2d3c);}};}function respondWithFilteredResult(_0x5e82e1,_0x369b1c){return function(_0x394050){if(_0x394050){var _0x5d36be=typeof _0x369b1c[_0x88ff('0x1d')]===_0x88ff('0x1e')&&typeof _0x369b1c[_0x88ff('0x1f')]==='undefined';var _0x38c6d5=_0x394050[_0x88ff('0x20')];var _0x45b7e3=_0x5d36be?0x0:_0x369b1c[_0x88ff('0x1d')];var _0x451585=_0x5d36be?_0x394050['count']:_0x369b1c[_0x88ff('0x1d')]+_0x369b1c['limit'];var _0x40c47f;if(_0x451585>=_0x38c6d5){_0x451585=_0x38c6d5;_0x40c47f=0xc8;}else{_0x40c47f=0xce;}_0x5e82e1[_0x88ff('0x1a')](_0x40c47f);return _0x5e82e1[_0x88ff('0x21')](_0x88ff('0x22'),_0x45b7e3+'-'+_0x451585+'/'+_0x38c6d5)[_0x88ff('0x1c')](_0x394050);}return null;};}function patchUpdates(_0x360021){return function(_0x10e1f6){try{jsonpatch[_0x88ff('0x23')](_0x10e1f6,_0x360021,!![]);}catch(_0x59cbc9){return BPromise['reject'](_0x59cbc9);}return _0x10e1f6[_0x88ff('0x24')]();};}function saveUpdates(_0x3f62c2,_0x3ff2d0){return function(_0x39d64d){if(_0x39d64d){return _0x39d64d[_0x88ff('0x25')](_0x3f62c2)[_0x88ff('0x26')](function(_0x5a1443){return _0x5a1443;});}return null;};}function removeEntity(_0x156456,_0x1e3530){return function(_0xae38d7){if(_0xae38d7){return _0xae38d7[_0x88ff('0x27')]()[_0x88ff('0x26')](function(){_0x156456[_0x88ff('0x1a')](0xcc)[_0x88ff('0x1b')]();});}};}function handleEntityNotFound(_0x492363,_0x59b277){return function(_0x461600){if(!_0x461600){_0x492363[_0x88ff('0x19')](0x194);}return _0x461600;};}function handleError(_0x2a1276,_0x2df86c){_0x2df86c=_0x2df86c||0x1f4;return function(_0x4a0cea){logger[_0x88ff('0x28')](_0x4a0cea[_0x88ff('0x29')]);if(_0x4a0cea[_0x88ff('0x2a')]){delete _0x4a0cea['name'];}_0x2a1276[_0x88ff('0x1a')](_0x2df86c)[_0x88ff('0x2b')](_0x4a0cea);};}exports[_0x88ff('0x2c')]=function(_0x53f6f9,_0x303540){var _0x4704a9={},_0x18c7cc={},_0xb20c0a={'count':0x0,'rows':[]};var _0x4a0f11=_[_0x88ff('0x2d')](db[_0x88ff('0x2e')][_0x88ff('0x2f')],function(_0xaf0fbd){return{'name':_0xaf0fbd[_0x88ff('0x30')],'type':_0xaf0fbd[_0x88ff('0x31')][_0x88ff('0x32')]};});_0x18c7cc[_0x88ff('0x33')]=_[_0x88ff('0x2d')](_0x4a0f11,_0x88ff('0x2a'));_0x18c7cc[_0x88ff('0x34')]=_['keys'](_0x53f6f9[_0x88ff('0x34')]);_0x18c7cc[_0x88ff('0x35')]=_[_0x88ff('0x36')](_0x18c7cc[_0x88ff('0x33')],_0x18c7cc[_0x88ff('0x34')]);_0x4704a9[_0x88ff('0x37')]=_[_0x88ff('0x36')](_0x18c7cc[_0x88ff('0x33')],qs[_0x88ff('0x38')](_0x53f6f9[_0x88ff('0x34')][_0x88ff('0x38')]));_0x4704a9[_0x88ff('0x37')]=_0x4704a9[_0x88ff('0x37')][_0x88ff('0x39')]?_0x4704a9['attributes']:_0x18c7cc[_0x88ff('0x33')];if(!_0x53f6f9[_0x88ff('0x34')][_0x88ff('0x3a')]('nolimit')){_0x4704a9[_0x88ff('0x1f')]=qs[_0x88ff('0x1f')](_0x53f6f9['query'][_0x88ff('0x1f')]);_0x4704a9[_0x88ff('0x1d')]=qs[_0x88ff('0x1d')](_0x53f6f9[_0x88ff('0x34')][_0x88ff('0x1d')]);}_0x4704a9[_0x88ff('0x3b')]=qs[_0x88ff('0x3c')](_0x53f6f9[_0x88ff('0x34')]['sort']);_0x4704a9[_0x88ff('0x3d')]=qs['filters'](_['pick'](_0x53f6f9[_0x88ff('0x34')],_0x18c7cc[_0x88ff('0x35')]),_0x4a0f11);if(_0x53f6f9[_0x88ff('0x34')]['filter']){_0x4704a9['where']=_[_0x88ff('0x3e')](_0x4704a9[_0x88ff('0x3d')],{'$or':_[_0x88ff('0x2d')](_0x4a0f11,function(_0x37f0fd){if(_0x37f0fd[_0x88ff('0x31')]!==_0x88ff('0x3f')){var _0x15f921={};_0x15f921[_0x37f0fd[_0x88ff('0x2a')]]={'$like':'%'+_0x53f6f9[_0x88ff('0x34')][_0x88ff('0x40')]+'%'};return _0x15f921;}})});}_0x4704a9=_[_0x88ff('0x3e')]({},_0x4704a9,_0x53f6f9[_0x88ff('0x41')]);var _0x58a1bf={'where':_0x4704a9[_0x88ff('0x3d')]};return db[_0x88ff('0x2e')]['count'](_0x58a1bf)[_0x88ff('0x26')](function(_0x508301){_0xb20c0a[_0x88ff('0x20')]=_0x508301;if(_0x53f6f9[_0x88ff('0x34')][_0x88ff('0x42')]){_0x4704a9[_0x88ff('0x43')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x88ff('0x44')](_0x4704a9);})[_0x88ff('0x26')](function(_0x19fc9a){_0xb20c0a[_0x88ff('0x45')]=_0x19fc9a;return _0xb20c0a;})[_0x88ff('0x26')](respondWithFilteredResult(_0x303540,_0x4704a9))[_0x88ff('0x46')](handleError(_0x303540,null));};exports[_0x88ff('0x47')]=function(_0x2a54d8,_0x477b73){var _0x57ea77={'raw':![],'where':{'id':_0x2a54d8[_0x88ff('0x48')]['id']}},_0x53ef05={};_0x53ef05[_0x88ff('0x33')]=_[_0x88ff('0x49')](db[_0x88ff('0x2e')][_0x88ff('0x2f')]);_0x53ef05[_0x88ff('0x34')]=_['keys'](_0x2a54d8[_0x88ff('0x34')]);_0x53ef05['filters']=_[_0x88ff('0x36')](_0x53ef05[_0x88ff('0x33')],_0x53ef05[_0x88ff('0x34')]);_0x57ea77['attributes']=_[_0x88ff('0x36')](_0x53ef05[_0x88ff('0x33')],qs[_0x88ff('0x38')](_0x2a54d8['query']['fields']));_0x57ea77[_0x88ff('0x37')]=_0x57ea77[_0x88ff('0x37')][_0x88ff('0x39')]?_0x57ea77[_0x88ff('0x37')]:_0x53ef05[_0x88ff('0x33')];if(_0x2a54d8['query'][_0x88ff('0x42')]){_0x57ea77[_0x88ff('0x43')]=[{'all':!![]}];}_0x57ea77=_['merge']({},_0x57ea77,_0x2a54d8['options']);return db[_0x88ff('0x2e')][_0x88ff('0x4a')](_0x57ea77)[_0x88ff('0x26')](handleEntityNotFound(_0x477b73,null))['then'](respondWithResult(_0x477b73,null))['catch'](handleError(_0x477b73,null));};exports[_0x88ff('0x4b')]=function(_0x5a3367,_0x1e5a83){return db[_0x88ff('0x2e')]['create'](_0x5a3367[_0x88ff('0x4c')],{})[_0x88ff('0x26')](respondWithResult(_0x1e5a83,0xc9))['catch'](handleError(_0x1e5a83,null));};exports[_0x88ff('0x25')]=function(_0x54ef8e,_0x24455a){if(_0x54ef8e[_0x88ff('0x4c')]['id']){delete _0x54ef8e[_0x88ff('0x4c')]['id'];}return db['ZohoConfiguration']['find']({'where':{'id':_0x54ef8e[_0x88ff('0x48')]['id']}})[_0x88ff('0x26')](handleEntityNotFound(_0x24455a,null))[_0x88ff('0x26')](saveUpdates(_0x54ef8e[_0x88ff('0x4c')],null))[_0x88ff('0x26')](respondWithResult(_0x24455a,null))[_0x88ff('0x46')](handleError(_0x24455a,null));};exports[_0x88ff('0x27')]=function(_0x2d0d47,_0x3e8a47){return db[_0x88ff('0x2e')][_0x88ff('0x4a')]({'where':{'id':_0x2d0d47[_0x88ff('0x48')]['id']}})[_0x88ff('0x26')](handleEntityNotFound(_0x3e8a47,null))[_0x88ff('0x26')](removeEntity(_0x3e8a47,null))[_0x88ff('0x46')](handleError(_0x3e8a47,null));};exports['getFields']=function(_0x32329,_0x5edb02,_0x3f3e89){var _0x106855={};var _0x268573={};var _0xcc0cf3;var _0x4b0cb1;return db[_0x88ff('0x2e')][_0x88ff('0x4d')]({'where':{'id':_0x32329[_0x88ff('0x48')]['id']}})[_0x88ff('0x26')](handleEntityNotFound(_0x5edb02,null))[_0x88ff('0x26')](function(_0x34927f){if(_0x34927f){_0xcc0cf3=_0x34927f;_0x268573[_0x88ff('0x33')]=_[_0x88ff('0x49')](db[_0x88ff('0x4e')][_0x88ff('0x2f')]);_0x268573[_0x88ff('0x34')]=_[_0x88ff('0x49')](_0x32329[_0x88ff('0x34')]);_0x268573[_0x88ff('0x35')]=_[_0x88ff('0x36')](_0x268573['model'],_0x268573[_0x88ff('0x34')]);_0x106855[_0x88ff('0x37')]=_[_0x88ff('0x36')](_0x268573[_0x88ff('0x33')],qs[_0x88ff('0x38')](_0x32329[_0x88ff('0x34')][_0x88ff('0x38')]));_0x106855[_0x88ff('0x37')]=_0x106855[_0x88ff('0x37')][_0x88ff('0x39')]?_0x106855['attributes']:_0x268573[_0x88ff('0x33')];_0x106855[_0x88ff('0x3b')]=qs[_0x88ff('0x3c')](_0x32329[_0x88ff('0x34')][_0x88ff('0x3c')]);_0x106855['where']=qs[_0x88ff('0x35')](_['pick'](_0x32329[_0x88ff('0x34')],_0x268573[_0x88ff('0x35')]));if(_0x32329[_0x88ff('0x34')][_0x88ff('0x40')]){_0x106855[_0x88ff('0x3d')]=_[_0x88ff('0x3e')](_0x106855[_0x88ff('0x3d')],{'$or':_['map'](_0x106855[_0x88ff('0x37')],function(_0x4160c6){var _0x332e57={};_0x332e57[_0x4160c6]={'$like':'%'+_0x32329[_0x88ff('0x34')][_0x88ff('0x40')]+'%'};return _0x332e57;})});}_0x106855=_[_0x88ff('0x3e')]({},_0x106855,_0x32329[_0x88ff('0x41')]);return _0xcc0cf3[_0x88ff('0x4f')](_0x106855);}})[_0x88ff('0x26')](function(_0x328913){if(_0x328913){_0x4b0cb1=_0x328913[_0x88ff('0x39')];if(!_0x32329[_0x88ff('0x34')][_0x88ff('0x3a')]('nolimit')){_0x106855[_0x88ff('0x1f')]=qs[_0x88ff('0x1f')](_0x32329['query'][_0x88ff('0x1f')]);_0x106855[_0x88ff('0x1d')]=qs['offset'](_0x32329['query'][_0x88ff('0x1d')]);}return _0xcc0cf3[_0x88ff('0x4f')](_0x106855);}})[_0x88ff('0x26')](function(_0x18f1cf){if(_0x18f1cf){return _0x18f1cf?{'count':_0x4b0cb1,'rows':_0x18f1cf}:null;}})[_0x88ff('0x26')](respondWithResult(_0x5edb02,null))[_0x88ff('0x46')](handleError(_0x5edb02,null));};exports[_0x88ff('0x50')]=function(_0x715ed4,_0x4b17dd,_0x3d25e1){var _0x57d4d6={};var _0x3ec9c0={};var _0x990775;var _0x174f01;return db[_0x88ff('0x2e')]['findOne']({'where':{'id':_0x715ed4[_0x88ff('0x48')]['id']}})[_0x88ff('0x26')](handleEntityNotFound(_0x4b17dd,null))['then'](function(_0x17287e){if(_0x17287e){_0x990775=_0x17287e;_0x3ec9c0['model']=_[_0x88ff('0x49')](db['ZohoField'][_0x88ff('0x2f')]);_0x3ec9c0[_0x88ff('0x34')]=_['keys'](_0x715ed4[_0x88ff('0x34')]);_0x3ec9c0['filters']=_[_0x88ff('0x36')](_0x3ec9c0[_0x88ff('0x33')],_0x3ec9c0['query']);_0x57d4d6[_0x88ff('0x37')]=_['intersection'](_0x3ec9c0['model'],qs[_0x88ff('0x38')](_0x715ed4['query'][_0x88ff('0x38')]));_0x57d4d6[_0x88ff('0x37')]=_0x57d4d6[_0x88ff('0x37')][_0x88ff('0x39')]?_0x57d4d6[_0x88ff('0x37')]:_0x3ec9c0[_0x88ff('0x33')];_0x57d4d6[_0x88ff('0x3b')]=qs[_0x88ff('0x3c')](_0x715ed4['query'][_0x88ff('0x3c')]);_0x57d4d6['where']=qs[_0x88ff('0x35')](_[_0x88ff('0x51')](_0x715ed4['query'],_0x3ec9c0[_0x88ff('0x35')]));if(_0x715ed4['query'][_0x88ff('0x40')]){_0x57d4d6['where']=_['merge'](_0x57d4d6[_0x88ff('0x3d')],{'$or':_[_0x88ff('0x2d')](_0x57d4d6[_0x88ff('0x37')],function(_0x1a287e){var _0xd958e0={};_0xd958e0[_0x1a287e]={'$like':'%'+_0x715ed4[_0x88ff('0x34')][_0x88ff('0x40')]+'%'};return _0xd958e0;})});}_0x57d4d6=_[_0x88ff('0x3e')]({},_0x57d4d6,_0x715ed4['options']);return _0x990775[_0x88ff('0x50')](_0x57d4d6);}})[_0x88ff('0x26')](function(_0x1ba736){if(_0x1ba736){_0x174f01=_0x1ba736[_0x88ff('0x39')];if(!_0x715ed4[_0x88ff('0x34')][_0x88ff('0x3a')](_0x88ff('0x52'))){_0x57d4d6[_0x88ff('0x1f')]=qs[_0x88ff('0x1f')](_0x715ed4[_0x88ff('0x34')][_0x88ff('0x1f')]);_0x57d4d6[_0x88ff('0x1d')]=qs[_0x88ff('0x1d')](_0x715ed4['query'][_0x88ff('0x1d')]);}return _0x990775['getSubjects'](_0x57d4d6);}})[_0x88ff('0x26')](function(_0x2264fb){if(_0x2264fb){return _0x2264fb?{'count':_0x174f01,'rows':_0x2264fb}:null;}})[_0x88ff('0x26')](respondWithResult(_0x4b17dd,null))[_0x88ff('0x46')](handleError(_0x4b17dd,null));};exports[_0x88ff('0x53')]=function(_0x5197ed,_0x1f9baa,_0x98f530){var _0x11b268={};var _0x5ac93e={};var _0x2ca1e6;var _0x4c63da;return db['ZohoConfiguration'][_0x88ff('0x4d')]({'where':{'id':_0x5197ed['params']['id']}})[_0x88ff('0x26')](handleEntityNotFound(_0x1f9baa,null))['then'](function(_0x1ccef5){if(_0x1ccef5){_0x2ca1e6=_0x1ccef5;_0x5ac93e[_0x88ff('0x33')]=_['keys'](db['ZohoField'][_0x88ff('0x2f')]);_0x5ac93e[_0x88ff('0x34')]=_[_0x88ff('0x49')](_0x5197ed[_0x88ff('0x34')]);_0x5ac93e[_0x88ff('0x35')]=_[_0x88ff('0x36')](_0x5ac93e[_0x88ff('0x33')],_0x5ac93e['query']);_0x11b268['attributes']=_[_0x88ff('0x36')](_0x5ac93e[_0x88ff('0x33')],qs[_0x88ff('0x38')](_0x5197ed[_0x88ff('0x34')]['fields']));_0x11b268[_0x88ff('0x37')]=_0x11b268['attributes']['length']?_0x11b268[_0x88ff('0x37')]:_0x5ac93e['model'];_0x11b268[_0x88ff('0x3b')]=qs['sort'](_0x5197ed['query'][_0x88ff('0x3c')]);_0x11b268[_0x88ff('0x3d')]=qs[_0x88ff('0x35')](_['pick'](_0x5197ed['query'],_0x5ac93e['filters']));if(_0x5197ed[_0x88ff('0x34')]['filter']){_0x11b268[_0x88ff('0x3d')]=_[_0x88ff('0x3e')](_0x11b268[_0x88ff('0x3d')],{'$or':_['map'](_0x11b268[_0x88ff('0x37')],function(_0x37d4b4){var _0x40d769={};_0x40d769[_0x37d4b4]={'$like':'%'+_0x5197ed[_0x88ff('0x34')][_0x88ff('0x40')]+'%'};return _0x40d769;})});}_0x11b268=_[_0x88ff('0x3e')]({},_0x11b268,_0x5197ed[_0x88ff('0x41')]);return _0x2ca1e6['getDescriptions'](_0x11b268);}})[_0x88ff('0x26')](function(_0x34b1f4){if(_0x34b1f4){_0x4c63da=_0x34b1f4[_0x88ff('0x39')];if(!_0x5197ed[_0x88ff('0x34')][_0x88ff('0x3a')]('nolimit')){_0x11b268[_0x88ff('0x1f')]=qs[_0x88ff('0x1f')](_0x5197ed['query']['limit']);_0x11b268[_0x88ff('0x1d')]=qs[_0x88ff('0x1d')](_0x5197ed[_0x88ff('0x34')][_0x88ff('0x1d')]);}return _0x2ca1e6['getDescriptions'](_0x11b268);}})[_0x88ff('0x26')](function(_0x92023a){if(_0x92023a){return _0x92023a?{'count':_0x4c63da,'rows':_0x92023a}:null;}})[_0x88ff('0x26')](respondWithResult(_0x1f9baa,null))[_0x88ff('0x46')](handleError(_0x1f9baa,null));}; \ No newline at end of file +var _0xf9a2=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','params','options','find','catch','create','body','getFields','pick','findOne','getSubjects','getDescriptions','ZohoField','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x28669c,_0x1f62c4){var _0x4a3af6=function(_0x3e25d5){while(--_0x3e25d5){_0x28669c['push'](_0x28669c['shift']());}};_0x4a3af6(++_0x1f62c4);}(_0xf9a2,0x145));var _0x2f9a=function(_0x311cce,_0x4b687b){_0x311cce=_0x311cce-0x0;var _0x567ce4=_0xf9a2[_0x311cce];return _0x567ce4;};'use strict';var emlformat=require(_0x2f9a('0x0'));var rimraf=require(_0x2f9a('0x1'));var zipdir=require(_0x2f9a('0x2'));var jsonpatch=require(_0x2f9a('0x3'));var rp=require(_0x2f9a('0x4'));var moment=require(_0x2f9a('0x5'));var BPromise=require(_0x2f9a('0x6'));var Mustache=require(_0x2f9a('0x7'));var util=require(_0x2f9a('0x8'));var path=require(_0x2f9a('0x9'));var sox=require(_0x2f9a('0xa'));var csv=require(_0x2f9a('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2f9a('0xc'));var squel=require(_0x2f9a('0xd'));var crypto=require(_0x2f9a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2f9a('0xf'));var toCsv=require(_0x2f9a('0xb'));var querystring=require(_0x2f9a('0x10'));var Papa=require(_0x2f9a('0x11'));var Redis=require(_0x2f9a('0x12'));var authService=require(_0x2f9a('0x13'));var qs=require(_0x2f9a('0x14'));var as=require(_0x2f9a('0x15'));var hardwareService=require(_0x2f9a('0x16'));var logger=require(_0x2f9a('0x17'))(_0x2f9a('0x18'));var utils=require(_0x2f9a('0x19'));var config=require(_0x2f9a('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12b589,_0x29d8c5){_0x29d8c5=_0x29d8c5||0xcc;return function(_0x61eadc){if(_0x61eadc){return _0x12b589[_0x2f9a('0x1b')](_0x29d8c5);}return _0x12b589['status'](_0x29d8c5)['end']();};}function respondWithResult(_0x50e5a7,_0x442414){_0x442414=_0x442414||0xc8;return function(_0x52cf47){if(_0x52cf47){return _0x50e5a7['status'](_0x442414)[_0x2f9a('0x1c')](_0x52cf47);}};}function respondWithFilteredResult(_0x467066,_0x1b8ab5){return function(_0x1c5514){if(_0x1c5514){var _0x4590d9=typeof _0x1b8ab5[_0x2f9a('0x1d')]===_0x2f9a('0x1e')&&typeof _0x1b8ab5['limit']===_0x2f9a('0x1e');var _0xac938=_0x1c5514[_0x2f9a('0x1f')];var _0x5340fe=_0x4590d9?0x0:_0x1b8ab5[_0x2f9a('0x1d')];var _0x59e312=_0x4590d9?_0x1c5514[_0x2f9a('0x1f')]:_0x1b8ab5[_0x2f9a('0x1d')]+_0x1b8ab5[_0x2f9a('0x20')];var _0x33372c;if(_0x59e312>=_0xac938){_0x59e312=_0xac938;_0x33372c=0xc8;}else{_0x33372c=0xce;}_0x467066[_0x2f9a('0x21')](_0x33372c);return _0x467066[_0x2f9a('0x22')](_0x2f9a('0x23'),_0x5340fe+'-'+_0x59e312+'/'+_0xac938)[_0x2f9a('0x1c')](_0x1c5514);}return null;};}function patchUpdates(_0xf85ac2){return function(_0x3fa5aa){try{jsonpatch[_0x2f9a('0x24')](_0x3fa5aa,_0xf85ac2,!![]);}catch(_0x301970){return BPromise[_0x2f9a('0x25')](_0x301970);}return _0x3fa5aa[_0x2f9a('0x26')]();};}function saveUpdates(_0x501915,_0x5e4433){return function(_0x17c9e1){if(_0x17c9e1){return _0x17c9e1[_0x2f9a('0x27')](_0x501915)[_0x2f9a('0x28')](function(_0x3c341f){return _0x3c341f;});}return null;};}function removeEntity(_0x11f294,_0x33364b){return function(_0x444a60){if(_0x444a60){return _0x444a60[_0x2f9a('0x29')]()['then'](function(){_0x11f294['status'](0xcc)[_0x2f9a('0x2a')]();});}};}function handleEntityNotFound(_0x284333,_0x442f3c){return function(_0x364e44){if(!_0x364e44){_0x284333[_0x2f9a('0x1b')](0x194);}return _0x364e44;};}function handleError(_0x3555c6,_0x25a208){_0x25a208=_0x25a208||0x1f4;return function(_0x7cdf8f){logger[_0x2f9a('0x2b')](_0x7cdf8f[_0x2f9a('0x2c')]);if(_0x7cdf8f['name']){delete _0x7cdf8f[_0x2f9a('0x2d')];}_0x3555c6[_0x2f9a('0x21')](_0x25a208)[_0x2f9a('0x2e')](_0x7cdf8f);};}exports[_0x2f9a('0x2f')]=function(_0x2d16b7,_0x1452f9){var _0x2d7f3a={},_0x12f087={},_0xe33129={'count':0x0,'rows':[]};var _0x19681a=_[_0x2f9a('0x30')](db[_0x2f9a('0x31')][_0x2f9a('0x32')],function(_0x5ace3a){return{'name':_0x5ace3a[_0x2f9a('0x33')],'type':_0x5ace3a['type'][_0x2f9a('0x34')]};});_0x12f087[_0x2f9a('0x35')]=_[_0x2f9a('0x30')](_0x19681a,_0x2f9a('0x2d'));_0x12f087[_0x2f9a('0x36')]=_[_0x2f9a('0x37')](_0x2d16b7['query']);_0x12f087[_0x2f9a('0x38')]=_[_0x2f9a('0x39')](_0x12f087[_0x2f9a('0x35')],_0x12f087[_0x2f9a('0x36')]);_0x2d7f3a[_0x2f9a('0x3a')]=_[_0x2f9a('0x39')](_0x12f087[_0x2f9a('0x35')],qs[_0x2f9a('0x3b')](_0x2d16b7['query'][_0x2f9a('0x3b')]));_0x2d7f3a[_0x2f9a('0x3a')]=_0x2d7f3a[_0x2f9a('0x3a')][_0x2f9a('0x3c')]?_0x2d7f3a['attributes']:_0x12f087[_0x2f9a('0x35')];if(!_0x2d16b7[_0x2f9a('0x36')][_0x2f9a('0x3d')](_0x2f9a('0x3e'))){_0x2d7f3a[_0x2f9a('0x20')]=qs[_0x2f9a('0x20')](_0x2d16b7['query'][_0x2f9a('0x20')]);_0x2d7f3a[_0x2f9a('0x1d')]=qs[_0x2f9a('0x1d')](_0x2d16b7[_0x2f9a('0x36')][_0x2f9a('0x1d')]);}_0x2d7f3a[_0x2f9a('0x3f')]=qs['sort'](_0x2d16b7[_0x2f9a('0x36')][_0x2f9a('0x40')]);_0x2d7f3a[_0x2f9a('0x41')]=qs[_0x2f9a('0x38')](_['pick'](_0x2d16b7[_0x2f9a('0x36')],_0x12f087[_0x2f9a('0x38')]),_0x19681a);if(_0x2d16b7['query'][_0x2f9a('0x42')]){_0x2d7f3a['where']=_[_0x2f9a('0x43')](_0x2d7f3a[_0x2f9a('0x41')],{'$or':_[_0x2f9a('0x30')](_0x19681a,function(_0x4b0192){if(_0x4b0192[_0x2f9a('0x44')]!==_0x2f9a('0x45')){var _0x5db532={};_0x5db532[_0x4b0192['name']]={'$like':'%'+_0x2d16b7[_0x2f9a('0x36')][_0x2f9a('0x42')]+'%'};return _0x5db532;}})});}_0x2d7f3a=_[_0x2f9a('0x43')]({},_0x2d7f3a,_0x2d16b7['options']);var _0xaa530b={'where':_0x2d7f3a[_0x2f9a('0x41')]};return db[_0x2f9a('0x31')][_0x2f9a('0x1f')](_0xaa530b)[_0x2f9a('0x28')](function(_0x30bf39){_0xe33129[_0x2f9a('0x1f')]=_0x30bf39;if(_0x2d16b7[_0x2f9a('0x36')][_0x2f9a('0x46')]){_0x2d7f3a[_0x2f9a('0x47')]=[{'all':!![]}];}return db[_0x2f9a('0x31')][_0x2f9a('0x48')](_0x2d7f3a);})['then'](function(_0xf7f131){_0xe33129[_0x2f9a('0x49')]=_0xf7f131;return _0xe33129;})[_0x2f9a('0x28')](respondWithFilteredResult(_0x1452f9,_0x2d7f3a))['catch'](handleError(_0x1452f9,null));};exports['show']=function(_0x2876cf,_0x21be5e){var _0x1959b7={'raw':![],'where':{'id':_0x2876cf[_0x2f9a('0x4a')]['id']}},_0x50e4a0={};_0x50e4a0[_0x2f9a('0x35')]=_[_0x2f9a('0x37')](db[_0x2f9a('0x31')][_0x2f9a('0x32')]);_0x50e4a0['query']=_['keys'](_0x2876cf[_0x2f9a('0x36')]);_0x50e4a0[_0x2f9a('0x38')]=_[_0x2f9a('0x39')](_0x50e4a0[_0x2f9a('0x35')],_0x50e4a0[_0x2f9a('0x36')]);_0x1959b7[_0x2f9a('0x3a')]=_['intersection'](_0x50e4a0[_0x2f9a('0x35')],qs[_0x2f9a('0x3b')](_0x2876cf['query']['fields']));_0x1959b7[_0x2f9a('0x3a')]=_0x1959b7[_0x2f9a('0x3a')]['length']?_0x1959b7[_0x2f9a('0x3a')]:_0x50e4a0[_0x2f9a('0x35')];if(_0x2876cf['query'][_0x2f9a('0x46')]){_0x1959b7[_0x2f9a('0x47')]=[{'all':!![]}];}_0x1959b7=_[_0x2f9a('0x43')]({},_0x1959b7,_0x2876cf[_0x2f9a('0x4b')]);return db[_0x2f9a('0x31')][_0x2f9a('0x4c')](_0x1959b7)[_0x2f9a('0x28')](handleEntityNotFound(_0x21be5e,null))[_0x2f9a('0x28')](respondWithResult(_0x21be5e,null))[_0x2f9a('0x4d')](handleError(_0x21be5e,null));};exports['create']=function(_0x420700,_0x3b7329){return db[_0x2f9a('0x31')][_0x2f9a('0x4e')](_0x420700[_0x2f9a('0x4f')],{})[_0x2f9a('0x28')](respondWithResult(_0x3b7329,0xc9))[_0x2f9a('0x4d')](handleError(_0x3b7329,null));};exports['update']=function(_0x3f7903,_0xb57eec){if(_0x3f7903[_0x2f9a('0x4f')]['id']){delete _0x3f7903[_0x2f9a('0x4f')]['id'];}return db['ZohoConfiguration']['find']({'where':{'id':_0x3f7903[_0x2f9a('0x4a')]['id']}})['then'](handleEntityNotFound(_0xb57eec,null))[_0x2f9a('0x28')](saveUpdates(_0x3f7903[_0x2f9a('0x4f')],null))[_0x2f9a('0x28')](respondWithResult(_0xb57eec,null))['catch'](handleError(_0xb57eec,null));};exports['destroy']=function(_0xb103b2,_0x56cd76){return db['ZohoConfiguration']['find']({'where':{'id':_0xb103b2[_0x2f9a('0x4a')]['id']}})[_0x2f9a('0x28')](handleEntityNotFound(_0x56cd76,null))[_0x2f9a('0x28')](removeEntity(_0x56cd76,null))[_0x2f9a('0x4d')](handleError(_0x56cd76,null));};exports[_0x2f9a('0x50')]=function(_0x4fc3c5,_0x439859,_0x93225a){var _0x4d7428={};var _0x576497={};var _0x4587b5;var _0x25953b;return db[_0x2f9a('0x31')]['findOne']({'where':{'id':_0x4fc3c5['params']['id']}})[_0x2f9a('0x28')](handleEntityNotFound(_0x439859,null))[_0x2f9a('0x28')](function(_0x3a20ab){if(_0x3a20ab){_0x4587b5=_0x3a20ab;_0x576497[_0x2f9a('0x35')]=_['keys'](db['ZohoField'][_0x2f9a('0x32')]);_0x576497[_0x2f9a('0x36')]=_[_0x2f9a('0x37')](_0x4fc3c5[_0x2f9a('0x36')]);_0x576497[_0x2f9a('0x38')]=_['intersection'](_0x576497[_0x2f9a('0x35')],_0x576497[_0x2f9a('0x36')]);_0x4d7428[_0x2f9a('0x3a')]=_[_0x2f9a('0x39')](_0x576497[_0x2f9a('0x35')],qs['fields'](_0x4fc3c5[_0x2f9a('0x36')][_0x2f9a('0x3b')]));_0x4d7428['attributes']=_0x4d7428[_0x2f9a('0x3a')][_0x2f9a('0x3c')]?_0x4d7428[_0x2f9a('0x3a')]:_0x576497['model'];_0x4d7428[_0x2f9a('0x3f')]=qs[_0x2f9a('0x40')](_0x4fc3c5[_0x2f9a('0x36')]['sort']);_0x4d7428['where']=qs[_0x2f9a('0x38')](_[_0x2f9a('0x51')](_0x4fc3c5[_0x2f9a('0x36')],_0x576497[_0x2f9a('0x38')]));if(_0x4fc3c5[_0x2f9a('0x36')][_0x2f9a('0x42')]){_0x4d7428[_0x2f9a('0x41')]=_['merge'](_0x4d7428[_0x2f9a('0x41')],{'$or':_[_0x2f9a('0x30')](_0x4d7428[_0x2f9a('0x3a')],function(_0x30af04){var _0x3742e1={};_0x3742e1[_0x30af04]={'$like':'%'+_0x4fc3c5[_0x2f9a('0x36')][_0x2f9a('0x42')]+'%'};return _0x3742e1;})});}_0x4d7428=_[_0x2f9a('0x43')]({},_0x4d7428,_0x4fc3c5[_0x2f9a('0x4b')]);return _0x4587b5[_0x2f9a('0x50')](_0x4d7428);}})[_0x2f9a('0x28')](function(_0x4fbce2){if(_0x4fbce2){_0x25953b=_0x4fbce2[_0x2f9a('0x3c')];if(!_0x4fc3c5['query'][_0x2f9a('0x3d')](_0x2f9a('0x3e'))){_0x4d7428[_0x2f9a('0x20')]=qs[_0x2f9a('0x20')](_0x4fc3c5['query'][_0x2f9a('0x20')]);_0x4d7428['offset']=qs[_0x2f9a('0x1d')](_0x4fc3c5[_0x2f9a('0x36')][_0x2f9a('0x1d')]);}return _0x4587b5['getFields'](_0x4d7428);}})[_0x2f9a('0x28')](function(_0x532ad8){if(_0x532ad8){return _0x532ad8?{'count':_0x25953b,'rows':_0x532ad8}:null;}})[_0x2f9a('0x28')](respondWithResult(_0x439859,null))[_0x2f9a('0x4d')](handleError(_0x439859,null));};exports['getSubjects']=function(_0xb3d7e4,_0xb54837,_0xba0f9d){var _0x39f9c8={};var _0x535305={};var _0x1e6de5;var _0x29861b;return db[_0x2f9a('0x31')][_0x2f9a('0x52')]({'where':{'id':_0xb3d7e4[_0x2f9a('0x4a')]['id']}})[_0x2f9a('0x28')](handleEntityNotFound(_0xb54837,null))['then'](function(_0x4d0ae3){if(_0x4d0ae3){_0x1e6de5=_0x4d0ae3;_0x535305['model']=_[_0x2f9a('0x37')](db['ZohoField']['rawAttributes']);_0x535305['query']=_[_0x2f9a('0x37')](_0xb3d7e4['query']);_0x535305[_0x2f9a('0x38')]=_[_0x2f9a('0x39')](_0x535305[_0x2f9a('0x35')],_0x535305[_0x2f9a('0x36')]);_0x39f9c8[_0x2f9a('0x3a')]=_[_0x2f9a('0x39')](_0x535305['model'],qs['fields'](_0xb3d7e4[_0x2f9a('0x36')][_0x2f9a('0x3b')]));_0x39f9c8[_0x2f9a('0x3a')]=_0x39f9c8['attributes'][_0x2f9a('0x3c')]?_0x39f9c8[_0x2f9a('0x3a')]:_0x535305[_0x2f9a('0x35')];_0x39f9c8[_0x2f9a('0x3f')]=qs[_0x2f9a('0x40')](_0xb3d7e4[_0x2f9a('0x36')]['sort']);_0x39f9c8['where']=qs[_0x2f9a('0x38')](_[_0x2f9a('0x51')](_0xb3d7e4[_0x2f9a('0x36')],_0x535305['filters']));if(_0xb3d7e4['query'][_0x2f9a('0x42')]){_0x39f9c8[_0x2f9a('0x41')]=_[_0x2f9a('0x43')](_0x39f9c8['where'],{'$or':_[_0x2f9a('0x30')](_0x39f9c8[_0x2f9a('0x3a')],function(_0x7485db){var _0xebdd7c={};_0xebdd7c[_0x7485db]={'$like':'%'+_0xb3d7e4['query'][_0x2f9a('0x42')]+'%'};return _0xebdd7c;})});}_0x39f9c8=_['merge']({},_0x39f9c8,_0xb3d7e4[_0x2f9a('0x4b')]);return _0x1e6de5[_0x2f9a('0x53')](_0x39f9c8);}})[_0x2f9a('0x28')](function(_0x3cf49b){if(_0x3cf49b){_0x29861b=_0x3cf49b['length'];if(!_0xb3d7e4[_0x2f9a('0x36')][_0x2f9a('0x3d')]('nolimit')){_0x39f9c8[_0x2f9a('0x20')]=qs[_0x2f9a('0x20')](_0xb3d7e4[_0x2f9a('0x36')]['limit']);_0x39f9c8[_0x2f9a('0x1d')]=qs[_0x2f9a('0x1d')](_0xb3d7e4[_0x2f9a('0x36')]['offset']);}return _0x1e6de5[_0x2f9a('0x53')](_0x39f9c8);}})[_0x2f9a('0x28')](function(_0x818c2d){if(_0x818c2d){return _0x818c2d?{'count':_0x29861b,'rows':_0x818c2d}:null;}})[_0x2f9a('0x28')](respondWithResult(_0xb54837,null))[_0x2f9a('0x4d')](handleError(_0xb54837,null));};exports[_0x2f9a('0x54')]=function(_0x51685e,_0x4a38e9,_0x4b0e88){var _0x23e506={};var _0x4649c1={};var _0x290d8d;var _0x43b35f;return db[_0x2f9a('0x31')][_0x2f9a('0x52')]({'where':{'id':_0x51685e[_0x2f9a('0x4a')]['id']}})[_0x2f9a('0x28')](handleEntityNotFound(_0x4a38e9,null))[_0x2f9a('0x28')](function(_0x53f01c){if(_0x53f01c){_0x290d8d=_0x53f01c;_0x4649c1[_0x2f9a('0x35')]=_[_0x2f9a('0x37')](db[_0x2f9a('0x55')][_0x2f9a('0x32')]);_0x4649c1[_0x2f9a('0x36')]=_[_0x2f9a('0x37')](_0x51685e[_0x2f9a('0x36')]);_0x4649c1[_0x2f9a('0x38')]=_[_0x2f9a('0x39')](_0x4649c1[_0x2f9a('0x35')],_0x4649c1['query']);_0x23e506[_0x2f9a('0x3a')]=_['intersection'](_0x4649c1[_0x2f9a('0x35')],qs[_0x2f9a('0x3b')](_0x51685e[_0x2f9a('0x36')][_0x2f9a('0x3b')]));_0x23e506[_0x2f9a('0x3a')]=_0x23e506['attributes'][_0x2f9a('0x3c')]?_0x23e506[_0x2f9a('0x3a')]:_0x4649c1['model'];_0x23e506[_0x2f9a('0x3f')]=qs[_0x2f9a('0x40')](_0x51685e[_0x2f9a('0x36')]['sort']);_0x23e506[_0x2f9a('0x41')]=qs['filters'](_['pick'](_0x51685e[_0x2f9a('0x36')],_0x4649c1[_0x2f9a('0x38')]));if(_0x51685e[_0x2f9a('0x36')][_0x2f9a('0x42')]){_0x23e506[_0x2f9a('0x41')]=_[_0x2f9a('0x43')](_0x23e506[_0x2f9a('0x41')],{'$or':_[_0x2f9a('0x30')](_0x23e506['attributes'],function(_0x434099){var _0x1e1cde={};_0x1e1cde[_0x434099]={'$like':'%'+_0x51685e['query']['filter']+'%'};return _0x1e1cde;})});}_0x23e506=_[_0x2f9a('0x43')]({},_0x23e506,_0x51685e[_0x2f9a('0x4b')]);return _0x290d8d[_0x2f9a('0x54')](_0x23e506);}})[_0x2f9a('0x28')](function(_0x4de411){if(_0x4de411){_0x43b35f=_0x4de411['length'];if(!_0x51685e[_0x2f9a('0x36')][_0x2f9a('0x3d')]('nolimit')){_0x23e506[_0x2f9a('0x20')]=qs['limit'](_0x51685e[_0x2f9a('0x36')][_0x2f9a('0x20')]);_0x23e506[_0x2f9a('0x1d')]=qs['offset'](_0x51685e[_0x2f9a('0x36')][_0x2f9a('0x1d')]);}return _0x290d8d['getDescriptions'](_0x23e506);}})[_0x2f9a('0x28')](function(_0x2e06ec){if(_0x2e06ec){return _0x2e06ec?{'count':_0x43b35f,'rows':_0x2e06ec}:null;}})['then'](respondWithResult(_0x4a38e9,null))[_0x2f9a('0x4d')](handleError(_0x4a38e9,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 5a1dc4c..4174bd1 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 _0x6d88=['request-promise','path','rimraf','./intZohoConfiguration.attributes','exports','ZohoConfiguration','int_zoho_configurations','lodash','../../config/logger','api','moment'];(function(_0x474c66,_0xbce925){var _0xcbd9bf=function(_0x44019d){while(--_0x44019d){_0x474c66['push'](_0x474c66['shift']());}};_0xcbd9bf(++_0xbce925);}(_0x6d88,0x19e));var _0x86d8=function(_0x4e76b4,_0x18fc25){_0x4e76b4=_0x4e76b4-0x0;var _0x1d04c4=_0x6d88[_0x4e76b4];return _0x1d04c4;};'use strict';var _=require(_0x86d8('0x0'));var util=require('util');var logger=require(_0x86d8('0x1'))(_0x86d8('0x2'));var moment=require(_0x86d8('0x3'));var BPromise=require('bluebird');var rp=require(_0x86d8('0x4'));var fs=require('fs');var path=require(_0x86d8('0x5'));var rimraf=require(_0x86d8('0x6'));var config=require('../../config/environment');var attributes=require(_0x86d8('0x7'));module[_0x86d8('0x8')]=function(_0x387972,_0x1e974a){return _0x387972['define'](_0x86d8('0x9'),attributes,{'tableName':_0x86d8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4530=['request-promise','../../config/environment','int_zoho_configurations','lodash','util','api','moment','bluebird'];(function(_0xe525c9,_0x5c612d){var _0x5dc0d9=function(_0x44bafe){while(--_0x44bafe){_0xe525c9['push'](_0xe525c9['shift']());}};_0x5dc0d9(++_0x5c612d);}(_0x4530,0x143));var _0x0453=function(_0x2ec484,_0x2ae583){_0x2ec484=_0x2ec484-0x0;var _0x1f7eb5=_0x4530[_0x2ec484];return _0x1f7eb5;};'use strict';var _=require(_0x0453('0x0'));var util=require(_0x0453('0x1'));var logger=require('../../config/logger')(_0x0453('0x2'));var moment=require(_0x0453('0x3'));var BPromise=require(_0x0453('0x4'));var rp=require(_0x0453('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0453('0x6'));var attributes=require('./intZohoConfiguration.attributes');module['exports']=function(_0x69fcbf,_0x26ba2f){return _0x69fcbf['define']('ZohoConfiguration',attributes,{'tableName':_0x0453('0x7'),'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 32c3914..c59980e 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 _0x5cd0=['request\x20sent','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','message','ZohoConfiguration,\x20%s,\x20%s'];(function(_0x842225,_0x1ac2ef){var _0x4543fc=function(_0x236dd9){while(--_0x236dd9){_0x842225['push'](_0x842225['shift']());}};_0x4543fc(++_0x1ac2ef);}(_0x5cd0,0xe7));var _0x05cd=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5cd0[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x05cd('0x0'));var util=require(_0x05cd('0x1'));var moment=require(_0x05cd('0x2'));var BPromise=require(_0x05cd('0x3'));var rs=require(_0x05cd('0x4'));var fs=require('fs');var Redis=require(_0x05cd('0x5'));var db=require(_0x05cd('0x6'))['db'];var utils=require(_0x05cd('0x7'));var logger=require(_0x05cd('0x8'))(_0x05cd('0x9'));var config=require(_0x05cd('0xa'));var jayson=require(_0x05cd('0xb'));var client=jayson[_0x05cd('0xc')][_0x05cd('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x55abda,_0x55e96f,_0x448223){return new BPromise(function(_0x291f22,_0xba1b8d){return client[_0x05cd('0xe')](_0x55abda,_0x448223)[_0x05cd('0xf')](function(_0x5066b4){logger[_0x05cd('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x55e96f,'request\x20sent');logger[_0x05cd('0x11')](_0x05cd('0x12'),_0x55e96f,'request\x20sent',JSON['stringify'](_0x5066b4));if(_0x5066b4[_0x05cd('0x13')]){if(_0x5066b4['error']['code']===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x55e96f,_0x5066b4[_0x05cd('0x13')][_0x05cd('0x14')]);return _0xba1b8d(_0x5066b4[_0x05cd('0x13')][_0x05cd('0x14')]);}logger['error'](_0x05cd('0x15'),_0x55e96f,_0x5066b4[_0x05cd('0x13')][_0x05cd('0x14')]);return _0x291f22(_0x5066b4[_0x05cd('0x13')]['message']);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x55e96f,_0x05cd('0x16'));_0x291f22(_0x5066b4['result'][_0x05cd('0x14')]);}})['catch'](function(_0x23fdb8){logger[_0x05cd('0x13')](_0x05cd('0x15'),_0x55e96f,_0x23fdb8);_0xba1b8d(_0x23fdb8);});});} \ No newline at end of file +var _0xe00e=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x38899e,_0xa918a5){var _0x4c9362=function(_0x37530e){while(--_0x37530e){_0x38899e['push'](_0x38899e['shift']());}};_0x4c9362(++_0xa918a5);}(_0xe00e,0x15c));var _0xee00=function(_0x29021e,_0xc6eaf4){_0x29021e=_0x29021e-0x0;var _0x1aef12=_0xe00e[_0x29021e];return _0x1aef12;};'use strict';var _=require(_0xee00('0x0'));var util=require('util');var moment=require(_0xee00('0x1'));var BPromise=require(_0xee00('0x2'));var rs=require(_0xee00('0x3'));var fs=require('fs');var Redis=require(_0xee00('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xee00('0x5'));var logger=require(_0xee00('0x6'))(_0xee00('0x7'));var config=require(_0xee00('0x8'));var jayson=require(_0xee00('0x9'));var client=jayson[_0xee00('0xa')][_0xee00('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58b103,_0x5b0e03,_0x237c83){return new BPromise(function(_0xc40a98,_0x49b474){return client['request'](_0x58b103,_0x237c83)['then'](function(_0x467275){logger[_0xee00('0xc')](_0xee00('0xd'),_0x5b0e03,_0xee00('0xe'));logger[_0xee00('0xf')](_0xee00('0x10'),_0x5b0e03,_0xee00('0xe'),JSON[_0xee00('0x11')](_0x467275));if(_0x467275[_0xee00('0x12')]){if(_0x467275['error'][_0xee00('0x13')]===0x1f4){logger['error'](_0xee00('0xd'),_0x5b0e03,_0x467275[_0xee00('0x12')][_0xee00('0x14')]);return _0x49b474(_0x467275[_0xee00('0x12')][_0xee00('0x14')]);}logger[_0xee00('0x12')](_0xee00('0xd'),_0x5b0e03,_0x467275[_0xee00('0x12')][_0xee00('0x14')]);return _0xc40a98(_0x467275[_0xee00('0x12')]['message']);}else{logger[_0xee00('0xc')](_0xee00('0xd'),_0x5b0e03,_0xee00('0xe'));_0xc40a98(_0x467275[_0xee00('0x15')][_0xee00('0x14')]);}})[_0xee00('0x16')](function(_0x4b7a57){logger[_0xee00('0x12')](_0xee00('0xd'),_0x5b0e03,_0x4b7a57);_0x49b474(_0x4b7a57);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index d17ef76..38d826c 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 _0x301b=['index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intZohoField.controller','get','isAuthenticated'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0x301b,0xf9));var _0xb301=function(_0x458fa5,_0x389fdf){_0x458fa5=_0x458fa5-0x0;var _0x406452=_0x301b[_0x458fa5];return _0x406452;};'use strict';var multer=require(_0xb301('0x0'));var util=require(_0xb301('0x1'));var path=require(_0xb301('0x2'));var timeout=require(_0xb301('0x3'));var express=require(_0xb301('0x4'));var router=express[_0xb301('0x5')]();var fs_extra=require(_0xb301('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb301('0x7'));var config=require('../../config/environment');var controller=require(_0xb301('0x8'));router[_0xb301('0x9')]('/',auth[_0xb301('0xa')](),controller[_0xb301('0xb')]);router['get'](_0xb301('0xc'),auth[_0xb301('0xa')](),controller['show']);router[_0xb301('0xd')]('/',auth[_0xb301('0xa')](),controller[_0xb301('0xe')]);router[_0xb301('0xf')](_0xb301('0xc'),auth['isAuthenticated'](),controller[_0xb301('0x10')]);router[_0xb301('0x11')](_0xb301('0xc'),auth[_0xb301('0xa')](),controller[_0xb301('0x12')]);module[_0xb301('0x13')]=router; \ No newline at end of file +var _0x15a9=['show','post','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x34e666,_0x4ee316){var _0x593b64=function(_0xf168e6){while(--_0xf168e6){_0x34e666['push'](_0x34e666['shift']());}};_0x593b64(++_0x4ee316);}(_0x15a9,0x137));var _0x915a=function(_0x2b9d6a,_0x3eea10){_0x2b9d6a=_0x2b9d6a-0x0;var _0x44d29d=_0x15a9[_0x2b9d6a];return _0x44d29d;};'use strict';var multer=require(_0x915a('0x0'));var util=require(_0x915a('0x1'));var path=require(_0x915a('0x2'));var timeout=require(_0x915a('0x3'));var express=require(_0x915a('0x4'));var router=express[_0x915a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x915a('0x6'));var interaction=require(_0x915a('0x7'));var config=require(_0x915a('0x8'));var controller=require('./intZohoField.controller');router[_0x915a('0x9')]('/',auth[_0x915a('0xa')](),controller[_0x915a('0xb')]);router[_0x915a('0x9')]('/:id',auth[_0x915a('0xa')](),controller[_0x915a('0xc')]);router[_0x915a('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x915a('0xe')](_0x915a('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x915a('0x10')](_0x915a('0xf'),auth[_0x915a('0xa')](),controller[_0x915a('0x11')]);module[_0x915a('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 3d67cb7..6c25b32 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 _0x095f=['variable','customVariable','keyValue','STRING','exports','ENUM','string'];(function(_0x41f6d3,_0x41594d){var _0x425e9b=function(_0x2163f5){while(--_0x2163f5){_0x41f6d3['push'](_0x41f6d3['shift']());}};_0x425e9b(++_0x41594d);}(_0x095f,0x154));var _0xf095=function(_0x846a8b,_0x1b34ca){_0x846a8b=_0x846a8b-0x0;var _0x393701=_0x095f[_0x846a8b];return _0x393701;};'use strict';var Sequelize=require('sequelize');module[_0xf095('0x0')]={'type':{'type':Sequelize[_0xf095('0x1')](_0xf095('0x2'),_0xf095('0x3'),_0xf095('0x4'),_0xf095('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xf095('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf095('0x1')](_0xf095('0x2'),_0xf095('0x3'),_0xf095('0x4'))},'keyContent':{'type':Sequelize[_0xf095('0x6')]},'idField':{'type':Sequelize[_0xf095('0x6')]},'nameField':{'type':Sequelize[_0xf095('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf095('0x6')]}}; \ No newline at end of file +var _0xa709=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0xa709,0x1b1));var _0x9a70=function(_0x19a49f,_0x444d74){_0x19a49f=_0x19a49f-0x0;var _0x5351ae=_0xa709[_0x19a49f];return _0x5351ae;};'use strict';var Sequelize=require(_0x9a70('0x0'));module[_0x9a70('0x1')]={'type':{'type':Sequelize[_0x9a70('0x2')](_0x9a70('0x3'),_0x9a70('0x4'),_0x9a70('0x5'),_0x9a70('0x6'),_0x9a70('0x7')),'defaultValue':_0x9a70('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9a70('0x2')](_0x9a70('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x9a70('0x8')]},'idField':{'type':Sequelize[_0x9a70('0x8')]},'nameField':{'type':Sequelize[_0x9a70('0x8')]},'customField':{'type':Sequelize[_0x9a70('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9a70('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 8aba905..6248f55 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 _0xf0dc=['fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','stack','name','send','index','map','key','model','query','keys','filters','fields','length','attributes','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','ZohoField','findAll','rows','catch','rawAttributes','intersection','find','create','body','update','params','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs'];(function(_0x4041ef,_0x2e36ff){var _0x37f0a9=function(_0x41f2ae){while(--_0x41f2ae){_0x4041ef['push'](_0x4041ef['shift']());}};_0x37f0a9(++_0x2e36ff);}(_0xf0dc,0x117));var _0xcf0d=function(_0x3239f8,_0x4b77a5){_0x3239f8=_0x3239f8-0x0;var _0x49923a=_0xf0dc[_0x3239f8];return _0x49923a;};'use strict';var emlformat=require(_0xcf0d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcf0d('0x1'));var rp=require(_0xcf0d('0x2'));var moment=require(_0xcf0d('0x3'));var BPromise=require(_0xcf0d('0x4'));var Mustache=require(_0xcf0d('0x5'));var util=require(_0xcf0d('0x6'));var path=require('path');var sox=require(_0xcf0d('0x7'));var csv=require('to-csv');var ejs=require(_0xcf0d('0x8'));var fs=require('fs');var fs_extra=require(_0xcf0d('0x9'));var _=require(_0xcf0d('0xa'));var squel=require(_0xcf0d('0xb'));var crypto=require(_0xcf0d('0xc'));var jsforce=require(_0xcf0d('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcf0d('0xe'));var Redis=require(_0xcf0d('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcf0d('0x10'));var hardwareService=require(_0xcf0d('0x11'));var logger=require(_0xcf0d('0x12'))('api');var utils=require(_0xcf0d('0x13'));var config=require(_0xcf0d('0x14'));var licenseUtil=require(_0xcf0d('0x15'));var db=require(_0xcf0d('0x16'))['db'];function respondWithStatusCode(_0x530dd6,_0x56ecf3){_0x56ecf3=_0x56ecf3||0xcc;return function(_0x381d4c){if(_0x381d4c){return _0x530dd6[_0xcf0d('0x17')](_0x56ecf3);}return _0x530dd6[_0xcf0d('0x18')](_0x56ecf3)[_0xcf0d('0x19')]();};}function respondWithResult(_0x46368a,_0x275093){_0x275093=_0x275093||0xc8;return function(_0xd41b6){if(_0xd41b6){return _0x46368a['status'](_0x275093)[_0xcf0d('0x1a')](_0xd41b6);}};}function respondWithFilteredResult(_0x14ba34,_0x1c8166){return function(_0xcf319b){if(_0xcf319b){var _0x5def2d=typeof _0x1c8166[_0xcf0d('0x1b')]==='undefined'&&typeof _0x1c8166['limit']===_0xcf0d('0x1c');var _0xb7a0a3=_0xcf319b[_0xcf0d('0x1d')];var _0x1331f9=_0x5def2d?0x0:_0x1c8166[_0xcf0d('0x1b')];var _0x2b080e=_0x5def2d?_0xcf319b['count']:_0x1c8166['offset']+_0x1c8166[_0xcf0d('0x1e')];var _0x4a844b;if(_0x2b080e>=_0xb7a0a3){_0x2b080e=_0xb7a0a3;_0x4a844b=0xc8;}else{_0x4a844b=0xce;}_0x14ba34[_0xcf0d('0x18')](_0x4a844b);return _0x14ba34[_0xcf0d('0x1f')](_0xcf0d('0x20'),_0x1331f9+'-'+_0x2b080e+'/'+_0xb7a0a3)['json'](_0xcf319b);}return null;};}function patchUpdates(_0xd73f25){return function(_0x3a6b0b){try{jsonpatch[_0xcf0d('0x21')](_0x3a6b0b,_0xd73f25,!![]);}catch(_0x559421){return BPromise[_0xcf0d('0x22')](_0x559421);}return _0x3a6b0b['save']();};}function saveUpdates(_0x5b847a,_0x5ebbf9){return function(_0x10d918){if(_0x10d918){return _0x10d918['update'](_0x5b847a)[_0xcf0d('0x23')](function(_0x137f38){return _0x137f38;});}return null;};}function removeEntity(_0x4000bd,_0x232531){return function(_0xe4070c){if(_0xe4070c){return _0xe4070c['destroy']()[_0xcf0d('0x23')](function(){_0x4000bd[_0xcf0d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a633c,_0x3c30a4){return function(_0x143801){if(!_0x143801){_0x5a633c['sendStatus'](0x194);}return _0x143801;};}function handleError(_0x487a32,_0x22fc3d){_0x22fc3d=_0x22fc3d||0x1f4;return function(_0x57ebb8){logger['error'](_0x57ebb8[_0xcf0d('0x24')]);if(_0x57ebb8[_0xcf0d('0x25')]){delete _0x57ebb8[_0xcf0d('0x25')];}_0x487a32[_0xcf0d('0x18')](_0x22fc3d)[_0xcf0d('0x26')](_0x57ebb8);};}exports[_0xcf0d('0x27')]=function(_0x2dc144,_0x18871d){var _0x103511={},_0x13baed={},_0x1f20ea={'count':0x0,'rows':[]};var _0x437f3e=_[_0xcf0d('0x28')](db['ZohoField']['rawAttributes'],function(_0x1da1fa){return{'name':_0x1da1fa['fieldName'],'type':_0x1da1fa['type'][_0xcf0d('0x29')]};});_0x13baed[_0xcf0d('0x2a')]=_['map'](_0x437f3e,'name');_0x13baed[_0xcf0d('0x2b')]=_[_0xcf0d('0x2c')](_0x2dc144[_0xcf0d('0x2b')]);_0x13baed[_0xcf0d('0x2d')]=_['intersection'](_0x13baed[_0xcf0d('0x2a')],_0x13baed[_0xcf0d('0x2b')]);_0x103511['attributes']=_['intersection'](_0x13baed[_0xcf0d('0x2a')],qs['fields'](_0x2dc144['query'][_0xcf0d('0x2e')]));_0x103511['attributes']=_0x103511['attributes'][_0xcf0d('0x2f')]?_0x103511[_0xcf0d('0x30')]:_0x13baed[_0xcf0d('0x2a')];if(!_0x2dc144[_0xcf0d('0x2b')][_0xcf0d('0x31')]('nolimit')){_0x103511[_0xcf0d('0x1e')]=qs[_0xcf0d('0x1e')](_0x2dc144['query'][_0xcf0d('0x1e')]);_0x103511[_0xcf0d('0x1b')]=qs[_0xcf0d('0x1b')](_0x2dc144[_0xcf0d('0x2b')]['offset']);}_0x103511[_0xcf0d('0x32')]=qs['sort'](_0x2dc144[_0xcf0d('0x2b')][_0xcf0d('0x33')]);_0x103511[_0xcf0d('0x34')]=qs[_0xcf0d('0x2d')](_['pick'](_0x2dc144[_0xcf0d('0x2b')],_0x13baed[_0xcf0d('0x2d')]),_0x437f3e);if(_0x2dc144[_0xcf0d('0x2b')][_0xcf0d('0x35')]){_0x103511['where']=_[_0xcf0d('0x36')](_0x103511[_0xcf0d('0x34')],{'$or':_[_0xcf0d('0x28')](_0x437f3e,function(_0x2b15f4){if(_0x2b15f4[_0xcf0d('0x37')]!==_0xcf0d('0x38')){var _0x30b686={};_0x30b686[_0x2b15f4[_0xcf0d('0x25')]]={'$like':'%'+_0x2dc144['query'][_0xcf0d('0x35')]+'%'};return _0x30b686;}})});}_0x103511=_[_0xcf0d('0x36')]({},_0x103511,_0x2dc144[_0xcf0d('0x39')]);var _0x3d28e7={'where':_0x103511[_0xcf0d('0x34')]};return db['ZohoField'][_0xcf0d('0x1d')](_0x3d28e7)['then'](function(_0x3aa716){_0x1f20ea[_0xcf0d('0x1d')]=_0x3aa716;if(_0x2dc144['query'][_0xcf0d('0x3a')]){_0x103511[_0xcf0d('0x3b')]=[{'all':!![]}];}return db[_0xcf0d('0x3c')][_0xcf0d('0x3d')](_0x103511);})[_0xcf0d('0x23')](function(_0x49d04c){_0x1f20ea[_0xcf0d('0x3e')]=_0x49d04c;return _0x1f20ea;})[_0xcf0d('0x23')](respondWithFilteredResult(_0x18871d,_0x103511))[_0xcf0d('0x3f')](handleError(_0x18871d,null));};exports['show']=function(_0x2ada40,_0x483f66){var _0x57eab2={'raw':!![],'where':{'id':_0x2ada40['params']['id']}},_0x33977a={};_0x33977a[_0xcf0d('0x2a')]=_[_0xcf0d('0x2c')](db[_0xcf0d('0x3c')][_0xcf0d('0x40')]);_0x33977a[_0xcf0d('0x2b')]=_[_0xcf0d('0x2c')](_0x2ada40[_0xcf0d('0x2b')]);_0x33977a[_0xcf0d('0x2d')]=_[_0xcf0d('0x41')](_0x33977a['model'],_0x33977a[_0xcf0d('0x2b')]);_0x57eab2['attributes']=_[_0xcf0d('0x41')](_0x33977a['model'],qs[_0xcf0d('0x2e')](_0x2ada40[_0xcf0d('0x2b')]['fields']));_0x57eab2[_0xcf0d('0x30')]=_0x57eab2[_0xcf0d('0x30')][_0xcf0d('0x2f')]?_0x57eab2[_0xcf0d('0x30')]:_0x33977a[_0xcf0d('0x2a')];if(_0x2ada40[_0xcf0d('0x2b')][_0xcf0d('0x3a')]){_0x57eab2[_0xcf0d('0x3b')]=[{'all':!![]}];}_0x57eab2=_[_0xcf0d('0x36')]({},_0x57eab2,_0x2ada40[_0xcf0d('0x39')]);return db[_0xcf0d('0x3c')][_0xcf0d('0x42')](_0x57eab2)['then'](handleEntityNotFound(_0x483f66,null))[_0xcf0d('0x23')](respondWithResult(_0x483f66,null))[_0xcf0d('0x3f')](handleError(_0x483f66,null));};exports[_0xcf0d('0x43')]=function(_0x22144a,_0x32fd3a){return db['ZohoField'][_0xcf0d('0x43')](_0x22144a[_0xcf0d('0x44')],{})['then'](respondWithResult(_0x32fd3a,0xc9))[_0xcf0d('0x3f')](handleError(_0x32fd3a,null));};exports[_0xcf0d('0x45')]=function(_0x3fb2be,_0x342d77){if(_0x3fb2be[_0xcf0d('0x44')]['id']){delete _0x3fb2be[_0xcf0d('0x44')]['id'];}return db[_0xcf0d('0x3c')][_0xcf0d('0x42')]({'where':{'id':_0x3fb2be[_0xcf0d('0x46')]['id']}})[_0xcf0d('0x23')](handleEntityNotFound(_0x342d77,null))['then'](saveUpdates(_0x3fb2be['body'],null))['then'](respondWithResult(_0x342d77,null))[_0xcf0d('0x3f')](handleError(_0x342d77,null));};exports[_0xcf0d('0x47')]=function(_0x178b88,_0x22fce9){return db['ZohoField']['find']({'where':{'id':_0x178b88[_0xcf0d('0x46')]['id']}})[_0xcf0d('0x23')](handleEntityNotFound(_0x22fce9,null))[_0xcf0d('0x23')](removeEntity(_0x22fce9,null))[_0xcf0d('0x3f')](handleError(_0x22fce9,null));}; \ No newline at end of file +var _0xe9d6=['include','findAll','rows','params','keys','includeAll','catch','create','update','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','stack','name','send','index','map','ZohoField','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xe9d6,0x1c7));var _0x6e9d=function(_0x1bd730,_0x4de703){_0x1bd730=_0x1bd730-0x0;var _0x277714=_0xe9d6[_0x1bd730];return _0x277714;};'use strict';var emlformat=require(_0x6e9d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6e9d('0x1'));var jsonpatch=require(_0x6e9d('0x2'));var rp=require(_0x6e9d('0x3'));var moment=require(_0x6e9d('0x4'));var BPromise=require(_0x6e9d('0x5'));var Mustache=require(_0x6e9d('0x6'));var util=require(_0x6e9d('0x7'));var path=require(_0x6e9d('0x8'));var sox=require('sox');var csv=require(_0x6e9d('0x9'));var ejs=require(_0x6e9d('0xa'));var fs=require('fs');var fs_extra=require(_0x6e9d('0xb'));var _=require(_0x6e9d('0xc'));var squel=require(_0x6e9d('0xd'));var crypto=require('crypto');var jsforce=require(_0x6e9d('0xe'));var deskjs=require(_0x6e9d('0xf'));var toCsv=require(_0x6e9d('0x9'));var querystring=require(_0x6e9d('0x10'));var Papa=require(_0x6e9d('0x11'));var Redis=require(_0x6e9d('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e9d('0x13'));var logger=require(_0x6e9d('0x14'))(_0x6e9d('0x15'));var utils=require(_0x6e9d('0x16'));var config=require(_0x6e9d('0x17'));var licenseUtil=require(_0x6e9d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x530e35,_0xccb38f){_0xccb38f=_0xccb38f||0xcc;return function(_0x16bb40){if(_0x16bb40){return _0x530e35[_0x6e9d('0x19')](_0xccb38f);}return _0x530e35[_0x6e9d('0x1a')](_0xccb38f)[_0x6e9d('0x1b')]();};}function respondWithResult(_0x4f26eb,_0xa680c7){_0xa680c7=_0xa680c7||0xc8;return function(_0x5d4690){if(_0x5d4690){return _0x4f26eb[_0x6e9d('0x1a')](_0xa680c7)[_0x6e9d('0x1c')](_0x5d4690);}};}function respondWithFilteredResult(_0x442a7e,_0x596eec){return function(_0x429012){if(_0x429012){var _0x5531b7=typeof _0x596eec['offset']===_0x6e9d('0x1d')&&typeof _0x596eec[_0x6e9d('0x1e')]===_0x6e9d('0x1d');var _0x33e83f=_0x429012[_0x6e9d('0x1f')];var _0xf02876=_0x5531b7?0x0:_0x596eec[_0x6e9d('0x20')];var _0x356e44=_0x5531b7?_0x429012[_0x6e9d('0x1f')]:_0x596eec[_0x6e9d('0x20')]+_0x596eec[_0x6e9d('0x1e')];var _0x1d4095;if(_0x356e44>=_0x33e83f){_0x356e44=_0x33e83f;_0x1d4095=0xc8;}else{_0x1d4095=0xce;}_0x442a7e[_0x6e9d('0x1a')](_0x1d4095);return _0x442a7e[_0x6e9d('0x21')]('Content-Range',_0xf02876+'-'+_0x356e44+'/'+_0x33e83f)['json'](_0x429012);}return null;};}function patchUpdates(_0x1225b9){return function(_0x1587b4){try{jsonpatch[_0x6e9d('0x22')](_0x1587b4,_0x1225b9,!![]);}catch(_0x298f22){return BPromise[_0x6e9d('0x23')](_0x298f22);}return _0x1587b4[_0x6e9d('0x24')]();};}function saveUpdates(_0x152127,_0x3a69a8){return function(_0x29715f){if(_0x29715f){return _0x29715f['update'](_0x152127)[_0x6e9d('0x25')](function(_0xc1de14){return _0xc1de14;});}return null;};}function removeEntity(_0x476a4a,_0x25cdeb){return function(_0x239e88){if(_0x239e88){return _0x239e88[_0x6e9d('0x26')]()[_0x6e9d('0x25')](function(){_0x476a4a[_0x6e9d('0x1a')](0xcc)[_0x6e9d('0x1b')]();});}};}function handleEntityNotFound(_0x1644c8,_0x5ca0b8){return function(_0x30ebf1){if(!_0x30ebf1){_0x1644c8[_0x6e9d('0x19')](0x194);}return _0x30ebf1;};}function handleError(_0x53121d,_0x5ba6ca){_0x5ba6ca=_0x5ba6ca||0x1f4;return function(_0x48c964){logger['error'](_0x48c964[_0x6e9d('0x27')]);if(_0x48c964[_0x6e9d('0x28')]){delete _0x48c964[_0x6e9d('0x28')];}_0x53121d[_0x6e9d('0x1a')](_0x5ba6ca)[_0x6e9d('0x29')](_0x48c964);};}exports[_0x6e9d('0x2a')]=function(_0x4b6421,_0x24911f){var _0x3dba1={},_0x3cb52b={},_0x71c525={'count':0x0,'rows':[]};var _0x45669c=_[_0x6e9d('0x2b')](db[_0x6e9d('0x2c')][_0x6e9d('0x2d')],function(_0x228b15){return{'name':_0x228b15['fieldName'],'type':_0x228b15[_0x6e9d('0x2e')][_0x6e9d('0x2f')]};});_0x3cb52b[_0x6e9d('0x30')]=_[_0x6e9d('0x2b')](_0x45669c,_0x6e9d('0x28'));_0x3cb52b[_0x6e9d('0x31')]=_['keys'](_0x4b6421[_0x6e9d('0x31')]);_0x3cb52b[_0x6e9d('0x32')]=_[_0x6e9d('0x33')](_0x3cb52b[_0x6e9d('0x30')],_0x3cb52b[_0x6e9d('0x31')]);_0x3dba1['attributes']=_[_0x6e9d('0x33')](_0x3cb52b[_0x6e9d('0x30')],qs[_0x6e9d('0x34')](_0x4b6421['query'][_0x6e9d('0x34')]));_0x3dba1[_0x6e9d('0x35')]=_0x3dba1['attributes'][_0x6e9d('0x36')]?_0x3dba1[_0x6e9d('0x35')]:_0x3cb52b[_0x6e9d('0x30')];if(!_0x4b6421[_0x6e9d('0x31')]['hasOwnProperty'](_0x6e9d('0x37'))){_0x3dba1[_0x6e9d('0x1e')]=qs['limit'](_0x4b6421[_0x6e9d('0x31')][_0x6e9d('0x1e')]);_0x3dba1['offset']=qs[_0x6e9d('0x20')](_0x4b6421[_0x6e9d('0x31')]['offset']);}_0x3dba1[_0x6e9d('0x38')]=qs[_0x6e9d('0x39')](_0x4b6421[_0x6e9d('0x31')][_0x6e9d('0x39')]);_0x3dba1[_0x6e9d('0x3a')]=qs['filters'](_[_0x6e9d('0x3b')](_0x4b6421[_0x6e9d('0x31')],_0x3cb52b['filters']),_0x45669c);if(_0x4b6421[_0x6e9d('0x31')][_0x6e9d('0x3c')]){_0x3dba1[_0x6e9d('0x3a')]=_['merge'](_0x3dba1[_0x6e9d('0x3a')],{'$or':_[_0x6e9d('0x2b')](_0x45669c,function(_0x56a4fd){if(_0x56a4fd[_0x6e9d('0x2e')]!=='VIRTUAL'){var _0x3d776e={};_0x3d776e[_0x56a4fd[_0x6e9d('0x28')]]={'$like':'%'+_0x4b6421[_0x6e9d('0x31')]['filter']+'%'};return _0x3d776e;}})});}_0x3dba1=_[_0x6e9d('0x3d')]({},_0x3dba1,_0x4b6421[_0x6e9d('0x3e')]);var _0x2aeadf={'where':_0x3dba1['where']};return db[_0x6e9d('0x2c')]['count'](_0x2aeadf)[_0x6e9d('0x25')](function(_0x20a4ac){_0x71c525[_0x6e9d('0x1f')]=_0x20a4ac;if(_0x4b6421[_0x6e9d('0x31')]['includeAll']){_0x3dba1[_0x6e9d('0x3f')]=[{'all':!![]}];}return db[_0x6e9d('0x2c')][_0x6e9d('0x40')](_0x3dba1);})[_0x6e9d('0x25')](function(_0x26106a){_0x71c525[_0x6e9d('0x41')]=_0x26106a;return _0x71c525;})[_0x6e9d('0x25')](respondWithFilteredResult(_0x24911f,_0x3dba1))['catch'](handleError(_0x24911f,null));};exports['show']=function(_0x4d4b79,_0x51c360){var _0x1367ba={'raw':!![],'where':{'id':_0x4d4b79[_0x6e9d('0x42')]['id']}},_0x4ea2b5={};_0x4ea2b5[_0x6e9d('0x30')]=_[_0x6e9d('0x43')](db[_0x6e9d('0x2c')][_0x6e9d('0x2d')]);_0x4ea2b5[_0x6e9d('0x31')]=_[_0x6e9d('0x43')](_0x4d4b79[_0x6e9d('0x31')]);_0x4ea2b5['filters']=_[_0x6e9d('0x33')](_0x4ea2b5[_0x6e9d('0x30')],_0x4ea2b5[_0x6e9d('0x31')]);_0x1367ba[_0x6e9d('0x35')]=_[_0x6e9d('0x33')](_0x4ea2b5['model'],qs['fields'](_0x4d4b79[_0x6e9d('0x31')][_0x6e9d('0x34')]));_0x1367ba[_0x6e9d('0x35')]=_0x1367ba[_0x6e9d('0x35')]['length']?_0x1367ba[_0x6e9d('0x35')]:_0x4ea2b5[_0x6e9d('0x30')];if(_0x4d4b79[_0x6e9d('0x31')][_0x6e9d('0x44')]){_0x1367ba[_0x6e9d('0x3f')]=[{'all':!![]}];}_0x1367ba=_['merge']({},_0x1367ba,_0x4d4b79[_0x6e9d('0x3e')]);return db['ZohoField']['find'](_0x1367ba)['then'](handleEntityNotFound(_0x51c360,null))['then'](respondWithResult(_0x51c360,null))[_0x6e9d('0x45')](handleError(_0x51c360,null));};exports[_0x6e9d('0x46')]=function(_0x20bffa,_0x5abf6a){return db[_0x6e9d('0x2c')][_0x6e9d('0x46')](_0x20bffa['body'],{})[_0x6e9d('0x25')](respondWithResult(_0x5abf6a,0xc9))[_0x6e9d('0x45')](handleError(_0x5abf6a,null));};exports[_0x6e9d('0x47')]=function(_0x25c60f,_0x11dce3){if(_0x25c60f[_0x6e9d('0x48')]['id']){delete _0x25c60f[_0x6e9d('0x48')]['id'];}return db[_0x6e9d('0x2c')][_0x6e9d('0x49')]({'where':{'id':_0x25c60f[_0x6e9d('0x42')]['id']}})['then'](handleEntityNotFound(_0x11dce3,null))[_0x6e9d('0x25')](saveUpdates(_0x25c60f['body'],null))['then'](respondWithResult(_0x11dce3,null))[_0x6e9d('0x45')](handleError(_0x11dce3,null));};exports[_0x6e9d('0x26')]=function(_0x10d9ce,_0x1df256){return db[_0x6e9d('0x2c')][_0x6e9d('0x49')]({'where':{'id':_0x10d9ce[_0x6e9d('0x42')]['id']}})[_0x6e9d('0x25')](handleEntityNotFound(_0x1df256,null))[_0x6e9d('0x25')](removeEntity(_0x1df256,null))[_0x6e9d('0x45')](handleError(_0x1df256,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 9e1c122..1134422 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 _0x6343=['../../config/logger','api','rimraf','../../config/environment','exports','define','ZohoField','idField','FieldId'];(function(_0xe15975,_0x10c483){var _0x5443ba=function(_0xafb9ed){while(--_0xafb9ed){_0xe15975['push'](_0xe15975['shift']());}};_0x5443ba(++_0x10c483);}(_0x6343,0x168));var _0x3634=function(_0x2bb75e,_0x3d55a4){_0x2bb75e=_0x2bb75e-0x0;var _0x2ff7d9=_0x6343[_0x2bb75e];return _0x2ff7d9;};'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('./intZohoField.attributes');module[_0x3634('0x4')]=function(_0x388c18,_0x4bb496){return _0x388c18[_0x3634('0x5')](_0x3634('0x6'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x3634('0x7'),_0x3634('0x8')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x627e=['define','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x14b658,_0x3e3f45){var _0x4961fc=function(_0x58372a){while(--_0x58372a){_0x14b658['push'](_0x14b658['shift']());}};_0x4961fc(++_0x3e3f45);}(_0x627e,0x14a));var _0xe627=function(_0x63e08,_0x5a7ac2){_0x63e08=_0x63e08-0x0;var _0x2caac3=_0x627e[_0x63e08];return _0x2caac3;};'use strict';var _=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var logger=require(_0xe627('0x2'))(_0xe627('0x3'));var moment=require(_0xe627('0x4'));var BPromise=require('bluebird');var rp=require(_0xe627('0x5'));var fs=require('fs');var path=require(_0xe627('0x6'));var rimraf=require(_0xe627('0x7'));var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module['exports']=function(_0x1a1a3d,_0x3f2791){return _0x1a1a3d[_0xe627('0x8')](_0xe627('0x9'),attributes,{'tableName':_0xe627('0xa'),'paranoid':![],'indexes':[{'name':_0xe627('0xb'),'fields':['idField',_0xe627('0xc')],'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 330c23a..67deb6a 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 _0x6b13=['jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','ZohoField,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x15372f,_0x467b0c){var _0x52e750=function(_0x1dc03c){while(--_0x1dc03c){_0x15372f['push'](_0x15372f['shift']());}};_0x52e750(++_0x467b0c);}(_0x6b13,0x185));var _0x36b1=function(_0x526d6c,_0x1cc58a){_0x526d6c=_0x526d6c-0x0;var _0x43b854=_0x6b13[_0x526d6c];return _0x43b854;};'use strict';var _=require(_0x36b1('0x0'));var util=require(_0x36b1('0x1'));var moment=require(_0x36b1('0x2'));var BPromise=require(_0x36b1('0x3'));var rs=require(_0x36b1('0x4'));var fs=require('fs');var Redis=require(_0x36b1('0x5'));var db=require(_0x36b1('0x6'))['db'];var utils=require(_0x36b1('0x7'));var logger=require(_0x36b1('0x8'))(_0x36b1('0x9'));var config=require(_0x36b1('0xa'));var jayson=require(_0x36b1('0xb'));var client=jayson[_0x36b1('0xc')][_0x36b1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x21f18f,_0x545823,_0x14f7a5){return new BPromise(function(_0x5c0e92,_0x4b43e4){return client[_0x36b1('0xe')](_0x21f18f,_0x14f7a5)[_0x36b1('0xf')](function(_0x157456){logger[_0x36b1('0x10')]('ZohoField,\x20%s,\x20%s',_0x545823,'request\x20sent');logger['debug'](_0x36b1('0x11'),_0x545823,_0x36b1('0x12'),JSON[_0x36b1('0x13')](_0x157456));if(_0x157456['error']){if(_0x157456['error']['code']===0x1f4){logger[_0x36b1('0x14')]('ZohoField,\x20%s,\x20%s',_0x545823,_0x157456[_0x36b1('0x14')]['message']);return _0x4b43e4(_0x157456[_0x36b1('0x14')][_0x36b1('0x15')]);}logger[_0x36b1('0x14')](_0x36b1('0x16'),_0x545823,_0x157456[_0x36b1('0x14')][_0x36b1('0x15')]);return _0x5c0e92(_0x157456[_0x36b1('0x14')][_0x36b1('0x15')]);}else{logger['info'](_0x36b1('0x16'),_0x545823,_0x36b1('0x12'));_0x5c0e92(_0x157456[_0x36b1('0x17')][_0x36b1('0x15')]);}})[_0x36b1('0x18')](function(_0x5c0b60){logger['error']('ZohoField,\x20%s,\x20%s',_0x545823,_0x5c0b60);_0x4b43e4(_0x5c0b60);});});} \ No newline at end of file +var _0xa2f7=['client','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x16dbcd,_0x274516){var _0x34706e=function(_0x43433d){while(--_0x43433d){_0x16dbcd['push'](_0x16dbcd['shift']());}};_0x34706e(++_0x274516);}(_0xa2f7,0x1c2));var _0x7a2f=function(_0x128673,_0x374750){_0x128673=_0x128673-0x0;var _0x513695=_0xa2f7[_0x128673];return _0x513695;};'use strict';var _=require(_0x7a2f('0x0'));var util=require(_0x7a2f('0x1'));var moment=require(_0x7a2f('0x2'));var BPromise=require(_0x7a2f('0x3'));var rs=require(_0x7a2f('0x4'));var fs=require('fs');var Redis=require(_0x7a2f('0x5'));var db=require(_0x7a2f('0x6'))['db'];var utils=require(_0x7a2f('0x7'));var logger=require('../../config/logger')(_0x7a2f('0x8'));var config=require('../../config/environment');var jayson=require(_0x7a2f('0x9'));var client=jayson[_0x7a2f('0xa')][_0x7a2f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5864c6,_0xeb8f4c,_0xef93dc){return new BPromise(function(_0x161fe6,_0x585ee5){return client[_0x7a2f('0xc')](_0x5864c6,_0xef93dc)['then'](function(_0x13d364){logger[_0x7a2f('0xd')](_0x7a2f('0xe'),_0xeb8f4c,_0x7a2f('0xf'));logger[_0x7a2f('0x10')](_0x7a2f('0x11'),_0xeb8f4c,_0x7a2f('0xf'),JSON[_0x7a2f('0x12')](_0x13d364));if(_0x13d364[_0x7a2f('0x13')]){if(_0x13d364[_0x7a2f('0x13')]['code']===0x1f4){logger[_0x7a2f('0x13')](_0x7a2f('0xe'),_0xeb8f4c,_0x13d364[_0x7a2f('0x13')][_0x7a2f('0x14')]);return _0x585ee5(_0x13d364['error'][_0x7a2f('0x14')]);}logger[_0x7a2f('0x13')](_0x7a2f('0xe'),_0xeb8f4c,_0x13d364[_0x7a2f('0x13')][_0x7a2f('0x14')]);return _0x161fe6(_0x13d364[_0x7a2f('0x13')][_0x7a2f('0x14')]);}else{logger[_0x7a2f('0xd')](_0x7a2f('0xe'),_0xeb8f4c,_0x7a2f('0xf'));_0x161fe6(_0x13d364[_0x7a2f('0x15')][_0x7a2f('0x14')]);}})[_0x7a2f('0x16')](function(_0x4e2cdd){logger[_0x7a2f('0x13')](_0x7a2f('0xe'),_0xeb8f4c,_0x4e2cdd);_0x585ee5(_0x4e2cdd);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 02bb384..6eea75f 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4b2a90,_0x27f5ea){var _0x30bee3=function(_0x30fd3e){while(--_0x30fd3e){_0x4b2a90['push'](_0x4b2a90['shift']());}};_0x30bee3(++_0x27f5ea);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0x8f827,_0x9b29d3){var _0x10b2fa=function(_0x32611d){while(--_0x32611d){_0x8f827['push'](_0x8f827['shift']());}};_0x10b2fa(++_0x9b29d3);}(_0xe706,0xa3));var _0x6e70=function(_0x22bee0,_0x412ecb){_0x22bee0=_0x22bee0-0x0;var _0x2d295b=_0xe706[_0x22bee0];return _0x2d295b;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index d3794f5..279cb81 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 _0x9d53=['state','sequelize','STRING','INTEGER','BOOLEAN'];(function(_0xe129b8,_0x1eb668){var _0x44a9b0=function(_0x41c495){while(--_0x41c495){_0xe129b8['push'](_0xe129b8['shift']());}};_0x44a9b0(++_0x1eb668);}(_0x9d53,0xf1));var _0x39d5=function(_0x3f2833,_0x24dfad){_0x3f2833=_0x3f2833-0x0;var _0x236ab8=_0x9d53[_0x3f2833];return _0x236ab8;};'use strict';var Sequelize=require(_0x39d5('0x0'));module['exports']={'name':{'type':Sequelize[_0x39d5('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x39d5('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x39d5('0x1')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x39d5('0x1')]},'path':{'type':Sequelize[_0x39d5('0x1')]},'type':{'type':Sequelize[_0x39d5('0x1')]},'size':{'type':Sequelize[_0x39d5('0x2')]},'active':{'type':Sequelize[_0x39d5('0x3')],'defaultValue':![]},'author':{'type':Sequelize[_0x39d5('0x1')]},'logo':{'type':Sequelize[_0x39d5('0x1')]},'state':{'type':Sequelize[_0x39d5('0x1')],'unique':_0x39d5('0x4')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x39d5('0x1')]},'remoteUri':{'type':Sequelize[_0x39d5('0x1')]},'link':{'type':Sequelize[_0x39d5('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x78c7=['STRING','unique_name_and_version','INTEGER','state','exports'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x78c7,0x1c1));var _0x778c=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x78c7[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require('sequelize');module[_0x778c('0x0')]={'name':{'type':Sequelize[_0x778c('0x1')],'allowNull':![],'unique':_0x778c('0x2')},'version':{'type':Sequelize[_0x778c('0x1')],'allowNull':![],'unique':_0x778c('0x2')},'main':{'type':Sequelize[_0x778c('0x1')],'defaultValue':'app.js'},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x778c('0x1')]},'type':{'type':Sequelize[_0x778c('0x1')]},'size':{'type':Sequelize[_0x778c('0x3')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x778c('0x1')]},'logo':{'type':Sequelize[_0x778c('0x1')]},'state':{'type':Sequelize[_0x778c('0x1')],'unique':_0x778c('0x4')},'description':{'type':Sequelize[_0x778c('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x778c('0x1')]},'link':{'type':Sequelize[_0x778c('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 6ee446e..383255a 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 _0x5d58=['../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','then','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','Integration','include','findAll','rows','show','params','rawAttributes','keys','length','includeAll','merge','create','update','find','catch','destroy','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0xb1496a,_0x190543){var _0x301916=function(_0x4e17ab){while(--_0x4e17ab){_0xb1496a['push'](_0xb1496a['shift']());}};_0x301916(++_0x190543);}(_0x5d58,0x187));var _0x85d5=function(_0x498c1f,_0x3a0851){_0x498c1f=_0x498c1f-0x0;var _0xe362db=_0x5d58[_0x498c1f];return _0xe362db;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x85d5('0x0'));var BPromise=require(_0x85d5('0x1'));var Mustache=require('mustache');var util=require(_0x85d5('0x2'));var path=require(_0x85d5('0x3'));var sox=require('sox');var csv=require(_0x85d5('0x4'));var ejs=require(_0x85d5('0x5'));var fs=require('fs');var fs_extra=require(_0x85d5('0x6'));var _=require(_0x85d5('0x7'));var squel=require('squel');var crypto=require(_0x85d5('0x8'));var jsforce=require(_0x85d5('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x85d5('0x4'));var querystring=require('querystring');var Papa=require(_0x85d5('0xa'));var Redis=require(_0x85d5('0xb'));var authService=require(_0x85d5('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x85d5('0xd'))(_0x85d5('0xe'));var utils=require(_0x85d5('0xf'));var config=require(_0x85d5('0x10'));var licenseUtil=require(_0x85d5('0x11'));var db=require(_0x85d5('0x12'))['db'];function respondWithStatusCode(_0x31409d,_0x5897af){_0x5897af=_0x5897af||0xcc;return function(_0x4bbf2a){if(_0x4bbf2a){return _0x31409d['sendStatus'](_0x5897af);}return _0x31409d[_0x85d5('0x13')](_0x5897af)[_0x85d5('0x14')]();};}function respondWithResult(_0x339d4f,_0x1704f0){_0x1704f0=_0x1704f0||0xc8;return function(_0x18a20c){if(_0x18a20c){return _0x339d4f[_0x85d5('0x13')](_0x1704f0)[_0x85d5('0x15')](_0x18a20c);}};}function respondWithFilteredResult(_0x586382,_0x18e977){return function(_0x2d7c95){if(_0x2d7c95){var _0x1621ed=typeof _0x18e977[_0x85d5('0x16')]===_0x85d5('0x17')&&typeof _0x18e977[_0x85d5('0x18')]===_0x85d5('0x17');var _0x12bef9=_0x2d7c95[_0x85d5('0x19')];var _0x17acb0=_0x1621ed?0x0:_0x18e977[_0x85d5('0x16')];var _0x432bd6=_0x1621ed?_0x2d7c95[_0x85d5('0x19')]:_0x18e977[_0x85d5('0x16')]+_0x18e977[_0x85d5('0x18')];var _0x26981b;if(_0x432bd6>=_0x12bef9){_0x432bd6=_0x12bef9;_0x26981b=0xc8;}else{_0x26981b=0xce;}_0x586382[_0x85d5('0x13')](_0x26981b);return _0x586382[_0x85d5('0x1a')]('Content-Range',_0x17acb0+'-'+_0x432bd6+'/'+_0x12bef9)[_0x85d5('0x15')](_0x2d7c95);}return null;};}function patchUpdates(_0x133fa9){return function(_0x5f5755){try{jsonpatch[_0x85d5('0x1b')](_0x5f5755,_0x133fa9,!![]);}catch(_0x1264ca){return BPromise['reject'](_0x1264ca);}return _0x5f5755['save']();};}function saveUpdates(_0x347337,_0x5a1b9a){return function(_0x2f2bae){if(_0x2f2bae){return _0x2f2bae['update'](_0x347337)[_0x85d5('0x1c')](function(_0x1f8d27){return _0x1f8d27;});}return null;};}function removeEntity(_0x560b3a,_0x4e11c4){return function(_0x4da71b){if(_0x4da71b){return _0x4da71b['destroy']()[_0x85d5('0x1c')](function(){_0x560b3a[_0x85d5('0x13')](0xcc)[_0x85d5('0x14')]();});}};}function handleEntityNotFound(_0x466bbd,_0x12fea3){return function(_0xef2405){if(!_0xef2405){_0x466bbd['sendStatus'](0x194);}return _0xef2405;};}function handleError(_0x7e9a11,_0x4f8c66){_0x4f8c66=_0x4f8c66||0x1f4;return function(_0x1b3fae){logger[_0x85d5('0x1d')](_0x1b3fae[_0x85d5('0x1e')]);if(_0x1b3fae['name']){delete _0x1b3fae[_0x85d5('0x1f')];}_0x7e9a11[_0x85d5('0x13')](_0x4f8c66)[_0x85d5('0x20')](_0x1b3fae);};}exports[_0x85d5('0x21')]=function(_0x4605c5,_0x56031f){var _0x1cbef1={},_0x476c8b={},_0x330f8a={'count':0x0,'rows':[]};var _0x22a961=_[_0x85d5('0x22')](db['Integration']['rawAttributes'],function(_0x2ce7a9){return{'name':_0x2ce7a9[_0x85d5('0x23')],'type':_0x2ce7a9[_0x85d5('0x24')][_0x85d5('0x25')]};});_0x476c8b[_0x85d5('0x26')]=_['map'](_0x22a961,_0x85d5('0x1f'));_0x476c8b[_0x85d5('0x27')]=_['keys'](_0x4605c5['query']);_0x476c8b[_0x85d5('0x28')]=_[_0x85d5('0x29')](_0x476c8b['model'],_0x476c8b[_0x85d5('0x27')]);_0x1cbef1['attributes']=_[_0x85d5('0x29')](_0x476c8b[_0x85d5('0x26')],qs['fields'](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2a')]));_0x1cbef1[_0x85d5('0x2b')]=_0x1cbef1[_0x85d5('0x2b')]['length']?_0x1cbef1['attributes']:_0x476c8b[_0x85d5('0x26')];if(!_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2c')](_0x85d5('0x2d'))){_0x1cbef1[_0x85d5('0x18')]=qs[_0x85d5('0x18')](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x18')]);_0x1cbef1[_0x85d5('0x16')]=qs['offset'](_0x4605c5['query'][_0x85d5('0x16')]);}_0x1cbef1[_0x85d5('0x2e')]=qs[_0x85d5('0x2f')](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2f')]);_0x1cbef1[_0x85d5('0x30')]=qs[_0x85d5('0x28')](_[_0x85d5('0x31')](_0x4605c5['query'],_0x476c8b[_0x85d5('0x28')]),_0x22a961);if(_0x4605c5[_0x85d5('0x27')][_0x85d5('0x32')]){_0x1cbef1[_0x85d5('0x30')]=_['merge'](_0x1cbef1[_0x85d5('0x30')],{'$or':_[_0x85d5('0x22')](_0x22a961,function(_0x3282d3){if(_0x3282d3[_0x85d5('0x24')]!=='VIRTUAL'){var _0x34caed={};_0x34caed[_0x3282d3['name']]={'$like':'%'+_0x4605c5['query'][_0x85d5('0x32')]+'%'};return _0x34caed;}})});}_0x1cbef1=_['merge']({},_0x1cbef1,_0x4605c5[_0x85d5('0x33')]);var _0x5ddba7={'where':_0x1cbef1['where']};return db[_0x85d5('0x34')][_0x85d5('0x19')](_0x5ddba7)[_0x85d5('0x1c')](function(_0x1beffc){_0x330f8a[_0x85d5('0x19')]=_0x1beffc;if(_0x4605c5['query']['includeAll']){_0x1cbef1[_0x85d5('0x35')]=[{'all':!![]}];}return db[_0x85d5('0x34')][_0x85d5('0x36')](_0x1cbef1);})[_0x85d5('0x1c')](function(_0xdd8b3e){_0x330f8a[_0x85d5('0x37')]=_0xdd8b3e;return _0x330f8a;})['then'](respondWithFilteredResult(_0x56031f,_0x1cbef1))['catch'](handleError(_0x56031f,null));};exports[_0x85d5('0x38')]=function(_0x52c99b,_0xfbf466){var _0x18e94d={'raw':![],'where':{'id':_0x52c99b[_0x85d5('0x39')]['id']}},_0x7dd430={};_0x7dd430[_0x85d5('0x26')]=_['keys'](db['Integration'][_0x85d5('0x3a')]);_0x7dd430[_0x85d5('0x27')]=_[_0x85d5('0x3b')](_0x52c99b[_0x85d5('0x27')]);_0x7dd430[_0x85d5('0x28')]=_[_0x85d5('0x29')](_0x7dd430[_0x85d5('0x26')],_0x7dd430[_0x85d5('0x27')]);_0x18e94d[_0x85d5('0x2b')]=_[_0x85d5('0x29')](_0x7dd430[_0x85d5('0x26')],qs[_0x85d5('0x2a')](_0x52c99b[_0x85d5('0x27')][_0x85d5('0x2a')]));_0x18e94d[_0x85d5('0x2b')]=_0x18e94d[_0x85d5('0x2b')][_0x85d5('0x3c')]?_0x18e94d['attributes']:_0x7dd430['model'];if(_0x52c99b[_0x85d5('0x27')][_0x85d5('0x3d')]){_0x18e94d[_0x85d5('0x35')]=[{'all':!![]}];}_0x18e94d=_[_0x85d5('0x3e')]({},_0x18e94d,_0x52c99b[_0x85d5('0x33')]);return db[_0x85d5('0x34')]['find'](_0x18e94d)[_0x85d5('0x1c')](handleEntityNotFound(_0xfbf466,null))['then'](respondWithResult(_0xfbf466,null))['catch'](handleError(_0xfbf466,null));};exports[_0x85d5('0x3f')]=function(_0x13ab32,_0x12a03){return db[_0x85d5('0x34')][_0x85d5('0x3f')](_0x13ab32['body'],{})[_0x85d5('0x1c')](respondWithResult(_0x12a03,0xc9))['catch'](handleError(_0x12a03,null));};exports[_0x85d5('0x40')]=function(_0xd8db57,_0x219154){if(_0xd8db57['body']['id']){delete _0xd8db57['body']['id'];}return db['Integration'][_0x85d5('0x41')]({'where':{'id':_0xd8db57[_0x85d5('0x39')]['id']}})[_0x85d5('0x1c')](handleEntityNotFound(_0x219154,null))['then'](saveUpdates(_0xd8db57['body'],null))[_0x85d5('0x1c')](respondWithResult(_0x219154,null))[_0x85d5('0x42')](handleError(_0x219154,null));};exports[_0x85d5('0x43')]=function(_0x288b56,_0x4b2dce){return db[_0x85d5('0x34')][_0x85d5('0x41')]({'where':{'id':_0x288b56[_0x85d5('0x39')]['id']}})[_0x85d5('0x1c')](handleEntityNotFound(_0x4b2dce,null))[_0x85d5('0x1c')](removeEntity(_0x4b2dce,null))[_0x85d5('0x42')](handleError(_0x4b2dce,null));}; \ No newline at end of file +var _0x4137=['map','Integration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','params','includeAll','options','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','limit','count','set','apply','reject','save','update','destroy','then','end','sendStatus','error','name','send','index'];(function(_0x1c7144,_0x487e7f){var _0xdaedd9=function(_0x58393d){while(--_0x58393d){_0x1c7144['push'](_0x1c7144['shift']());}};_0xdaedd9(++_0x487e7f);}(_0x4137,0xf8));var _0x7413=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x4137[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0x7413('0x0'));var rimraf=require(_0x7413('0x1'));var zipdir=require(_0x7413('0x2'));var jsonpatch=require(_0x7413('0x3'));var rp=require(_0x7413('0x4'));var moment=require(_0x7413('0x5'));var BPromise=require(_0x7413('0x6'));var Mustache=require(_0x7413('0x7'));var util=require(_0x7413('0x8'));var path=require(_0x7413('0x9'));var sox=require(_0x7413('0xa'));var csv=require(_0x7413('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7413('0xc'));var _=require(_0x7413('0xd'));var squel=require(_0x7413('0xe'));var crypto=require(_0x7413('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7413('0x10'));var toCsv=require(_0x7413('0xb'));var querystring=require('querystring');var Papa=require(_0x7413('0x11'));var Redis=require(_0x7413('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7413('0x13'));var as=require(_0x7413('0x14'));var hardwareService=require(_0x7413('0x15'));var logger=require(_0x7413('0x16'))(_0x7413('0x17'));var utils=require('../../config/utils');var config=require(_0x7413('0x18'));var licenseUtil=require(_0x7413('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18a874,_0xa26ca4){_0xa26ca4=_0xa26ca4||0xcc;return function(_0x13e6bd){if(_0x13e6bd){return _0x18a874['sendStatus'](_0xa26ca4);}return _0x18a874['status'](_0xa26ca4)['end']();};}function respondWithResult(_0x2267f6,_0x336c4c){_0x336c4c=_0x336c4c||0xc8;return function(_0x49f0f6){if(_0x49f0f6){return _0x2267f6[_0x7413('0x1a')](_0x336c4c)[_0x7413('0x1b')](_0x49f0f6);}};}function respondWithFilteredResult(_0x4955d3,_0x38b3d1){return function(_0x50f301){if(_0x50f301){var _0x4b9a5b=typeof _0x38b3d1[_0x7413('0x1c')]==='undefined'&&typeof _0x38b3d1[_0x7413('0x1d')]==='undefined';var _0x2036b6=_0x50f301[_0x7413('0x1e')];var _0x19157f=_0x4b9a5b?0x0:_0x38b3d1[_0x7413('0x1c')];var _0x2a3417=_0x4b9a5b?_0x50f301[_0x7413('0x1e')]:_0x38b3d1['offset']+_0x38b3d1[_0x7413('0x1d')];var _0x17c062;if(_0x2a3417>=_0x2036b6){_0x2a3417=_0x2036b6;_0x17c062=0xc8;}else{_0x17c062=0xce;}_0x4955d3[_0x7413('0x1a')](_0x17c062);return _0x4955d3[_0x7413('0x1f')]('Content-Range',_0x19157f+'-'+_0x2a3417+'/'+_0x2036b6)[_0x7413('0x1b')](_0x50f301);}return null;};}function patchUpdates(_0x12d94d){return function(_0x206afc){try{jsonpatch[_0x7413('0x20')](_0x206afc,_0x12d94d,!![]);}catch(_0x409392){return BPromise[_0x7413('0x21')](_0x409392);}return _0x206afc[_0x7413('0x22')]();};}function saveUpdates(_0x4e18cb,_0x56a06a){return function(_0x5f12a2){if(_0x5f12a2){return _0x5f12a2[_0x7413('0x23')](_0x4e18cb)['then'](function(_0x1585ba){return _0x1585ba;});}return null;};}function removeEntity(_0x372944,_0x3b0c81){return function(_0x2fc0f4){if(_0x2fc0f4){return _0x2fc0f4[_0x7413('0x24')]()[_0x7413('0x25')](function(){_0x372944[_0x7413('0x1a')](0xcc)[_0x7413('0x26')]();});}};}function handleEntityNotFound(_0x1d455b,_0x5a8329){return function(_0x5cb15f){if(!_0x5cb15f){_0x1d455b[_0x7413('0x27')](0x194);}return _0x5cb15f;};}function handleError(_0x48c2dc,_0x46c895){_0x46c895=_0x46c895||0x1f4;return function(_0x71cbb4){logger[_0x7413('0x28')](_0x71cbb4['stack']);if(_0x71cbb4[_0x7413('0x29')]){delete _0x71cbb4[_0x7413('0x29')];}_0x48c2dc[_0x7413('0x1a')](_0x46c895)[_0x7413('0x2a')](_0x71cbb4);};}exports[_0x7413('0x2b')]=function(_0x2e521f,_0x5eb4d9){var _0x24dce7={},_0x4ed662={},_0x1d0bde={'count':0x0,'rows':[]};var _0x23e682=_[_0x7413('0x2c')](db[_0x7413('0x2d')][_0x7413('0x2e')],function(_0x2004ea){return{'name':_0x2004ea['fieldName'],'type':_0x2004ea[_0x7413('0x2f')][_0x7413('0x30')]};});_0x4ed662[_0x7413('0x31')]=_[_0x7413('0x2c')](_0x23e682,_0x7413('0x29'));_0x4ed662[_0x7413('0x32')]=_[_0x7413('0x33')](_0x2e521f['query']);_0x4ed662[_0x7413('0x34')]=_[_0x7413('0x35')](_0x4ed662[_0x7413('0x31')],_0x4ed662[_0x7413('0x32')]);_0x24dce7[_0x7413('0x36')]=_['intersection'](_0x4ed662[_0x7413('0x31')],qs['fields'](_0x2e521f[_0x7413('0x32')][_0x7413('0x37')]));_0x24dce7[_0x7413('0x36')]=_0x24dce7['attributes'][_0x7413('0x38')]?_0x24dce7['attributes']:_0x4ed662[_0x7413('0x31')];if(!_0x2e521f[_0x7413('0x32')]['hasOwnProperty']('nolimit')){_0x24dce7[_0x7413('0x1d')]=qs[_0x7413('0x1d')](_0x2e521f[_0x7413('0x32')]['limit']);_0x24dce7['offset']=qs[_0x7413('0x1c')](_0x2e521f['query']['offset']);}_0x24dce7[_0x7413('0x39')]=qs['sort'](_0x2e521f[_0x7413('0x32')][_0x7413('0x3a')]);_0x24dce7[_0x7413('0x3b')]=qs[_0x7413('0x34')](_[_0x7413('0x3c')](_0x2e521f['query'],_0x4ed662[_0x7413('0x34')]),_0x23e682);if(_0x2e521f[_0x7413('0x32')][_0x7413('0x3d')]){_0x24dce7[_0x7413('0x3b')]=_[_0x7413('0x3e')](_0x24dce7[_0x7413('0x3b')],{'$or':_[_0x7413('0x2c')](_0x23e682,function(_0x385156){if(_0x385156[_0x7413('0x2f')]!==_0x7413('0x3f')){var _0x5c03eb={};_0x5c03eb[_0x385156[_0x7413('0x29')]]={'$like':'%'+_0x2e521f['query'][_0x7413('0x3d')]+'%'};return _0x5c03eb;}})});}_0x24dce7=_['merge']({},_0x24dce7,_0x2e521f['options']);var _0x5b592c={'where':_0x24dce7['where']};return db['Integration'][_0x7413('0x1e')](_0x5b592c)['then'](function(_0x535e49){_0x1d0bde[_0x7413('0x1e')]=_0x535e49;if(_0x2e521f['query']['includeAll']){_0x24dce7[_0x7413('0x40')]=[{'all':!![]}];}return db[_0x7413('0x2d')][_0x7413('0x41')](_0x24dce7);})[_0x7413('0x25')](function(_0x8049c0){_0x1d0bde['rows']=_0x8049c0;return _0x1d0bde;})[_0x7413('0x25')](respondWithFilteredResult(_0x5eb4d9,_0x24dce7))['catch'](handleError(_0x5eb4d9,null));};exports[_0x7413('0x42')]=function(_0x1d8219,_0xa063d1){var _0xfe0daa={'raw':![],'where':{'id':_0x1d8219[_0x7413('0x43')]['id']}},_0x3f7da2={};_0x3f7da2[_0x7413('0x31')]=_[_0x7413('0x33')](db[_0x7413('0x2d')][_0x7413('0x2e')]);_0x3f7da2[_0x7413('0x32')]=_[_0x7413('0x33')](_0x1d8219[_0x7413('0x32')]);_0x3f7da2['filters']=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],_0x3f7da2[_0x7413('0x32')]);_0xfe0daa[_0x7413('0x36')]=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],qs[_0x7413('0x37')](_0x1d8219[_0x7413('0x32')][_0x7413('0x37')]));_0xfe0daa[_0x7413('0x36')]=_0xfe0daa[_0x7413('0x36')]['length']?_0xfe0daa[_0x7413('0x36')]:_0x3f7da2['model'];if(_0x1d8219[_0x7413('0x32')][_0x7413('0x44')]){_0xfe0daa[_0x7413('0x40')]=[{'all':!![]}];}_0xfe0daa=_[_0x7413('0x3e')]({},_0xfe0daa,_0x1d8219[_0x7413('0x45')]);return db[_0x7413('0x2d')][_0x7413('0x46')](_0xfe0daa)[_0x7413('0x25')](handleEntityNotFound(_0xa063d1,null))[_0x7413('0x25')](respondWithResult(_0xa063d1,null))[_0x7413('0x47')](handleError(_0xa063d1,null));};exports['create']=function(_0x513657,_0x3c1f1a){return db['Integration']['create'](_0x513657[_0x7413('0x48')],{})[_0x7413('0x25')](respondWithResult(_0x3c1f1a,0xc9))['catch'](handleError(_0x3c1f1a,null));};exports[_0x7413('0x23')]=function(_0x586d25,_0x562bae){if(_0x586d25[_0x7413('0x48')]['id']){delete _0x586d25['body']['id'];}return db[_0x7413('0x2d')][_0x7413('0x46')]({'where':{'id':_0x586d25[_0x7413('0x43')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x562bae,null))[_0x7413('0x25')](saveUpdates(_0x586d25[_0x7413('0x48')],null))[_0x7413('0x25')](respondWithResult(_0x562bae,null))[_0x7413('0x47')](handleError(_0x562bae,null));};exports[_0x7413('0x24')]=function(_0x2031e3,_0x50a27d){return db[_0x7413('0x2d')]['find']({'where':{'id':_0x2031e3['params']['id']}})['then'](handleEntityNotFound(_0x50a27d,null))[_0x7413('0x25')](removeEntity(_0x50a27d,null))[_0x7413('0x47')](handleError(_0x50a27d,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 5c20f5a..4743a72 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 _0x8ae7=['request-promise','path','../../config/environment','exports','define','Integration','integrations','lodash','../../config/logger','bluebird'];(function(_0x461884,_0x454653){var _0x12663a=function(_0x5b7823){while(--_0x5b7823){_0x461884['push'](_0x461884['shift']());}};_0x12663a(++_0x454653);}(_0x8ae7,0x1ab));var _0x78ae=function(_0x2b71ba,_0x151013){_0x2b71ba=_0x2b71ba-0x0;var _0x389bb7=_0x8ae7[_0x2b71ba];return _0x389bb7;};'use strict';var _=require(_0x78ae('0x0'));var util=require('util');var logger=require(_0x78ae('0x1'))('api');var moment=require('moment');var BPromise=require(_0x78ae('0x2'));var rp=require(_0x78ae('0x3'));var fs=require('fs');var path=require(_0x78ae('0x4'));var rimraf=require('rimraf');var config=require(_0x78ae('0x5'));var attributes=require('./integration.attributes');module[_0x78ae('0x6')]=function(_0x2a66cc,_0x125917){return _0x2a66cc[_0x78ae('0x7')](_0x78ae('0x8'),attributes,{'tableName':_0x78ae('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9b8=['../../config/environment','exports','Integration','integrations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x62a58,_0x56dea6){var _0xbe73b2=function(_0x52ee3a){while(--_0x52ee3a){_0x62a58['push'](_0x62a58['shift']());}};_0xbe73b2(++_0x56dea6);}(_0xd9b8,0x13c));var _0x8d9b=function(_0x5a636f,_0x3fec2b){_0x5a636f=_0x5a636f-0x0;var _0x6a8cfb=_0xd9b8[_0x5a636f];return _0x6a8cfb;};'use strict';var _=require(_0x8d9b('0x0'));var util=require('util');var logger=require(_0x8d9b('0x1'))(_0x8d9b('0x2'));var moment=require(_0x8d9b('0x3'));var BPromise=require(_0x8d9b('0x4'));var rp=require(_0x8d9b('0x5'));var fs=require('fs');var path=require(_0x8d9b('0x6'));var rimraf=require(_0x8d9b('0x7'));var config=require(_0x8d9b('0x8'));var attributes=require('./integration.attributes');module[_0x8d9b('0x9')]=function(_0x525d57,_0x50ba48){return _0x525d57['define'](_0x8d9b('0xa'),attributes,{'tableName':_0x8d9b('0xb'),'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 a1c6224..8340f42 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 _0x896e=['Integration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x5261a8,_0x482ee4){var _0x48c7de=function(_0x5392eb){while(--_0x5392eb){_0x5261a8['push'](_0x5261a8['shift']());}};_0x48c7de(++_0x482ee4);}(_0x896e,0x1e9));var _0xe896=function(_0x5104dc,_0x27b85e){_0x5104dc=_0x5104dc-0x0;var _0xe25f4e=_0x896e[_0x5104dc];return _0xe25f4e;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7a0721,_0x3b902c,_0x264eeb){return new BPromise(function(_0x43c619,_0x5a1909){return client[_0xe896('0xd')](_0x7a0721,_0x264eeb)[_0xe896('0xe')](function(_0x37a90d){logger['info'](_0xe896('0xf'),_0x3b902c,'request\x20sent');logger[_0xe896('0x10')]('Integration,\x20%s,\x20%s,\x20%s',_0x3b902c,_0xe896('0x11'),JSON[_0xe896('0x12')](_0x37a90d));if(_0x37a90d[_0xe896('0x13')]){if(_0x37a90d['error'][_0xe896('0x14')]===0x1f4){logger[_0xe896('0x13')](_0xe896('0xf'),_0x3b902c,_0x37a90d['error'][_0xe896('0x15')]);return _0x5a1909(_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);}logger['error'](_0xe896('0xf'),_0x3b902c,_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);return _0x43c619(_0x37a90d['error']['message']);}else{logger[_0xe896('0x16')](_0xe896('0xf'),_0x3b902c,'request\x20sent');_0x43c619(_0x37a90d['result'][_0xe896('0x15')]);}})[_0xe896('0x17')](function(_0x57f04b){logger[_0xe896('0x13')]('Integration,\x20%s,\x20%s',_0x3b902c,_0x57f04b);_0x5a1909(_0x57f04b);});});} \ No newline at end of file +var _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','Integration,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x578e76,_0x2047bb){var _0x26e58b=function(_0x560d3a){while(--_0x560d3a){_0x578e76['push'](_0x578e76['shift']());}};_0x26e58b(++_0x2047bb);}(_0x14a0,0x8e));var _0x014a=function(_0x145527,_0x39007a){_0x145527=_0x145527-0x0;var _0x4d86d6=_0x14a0[_0x145527];return _0x4d86d6;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('Integration,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('Integration,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('Integration,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index dc117ea..e2d8e8e 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 _0x7a54=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','post','put','update','delete','/:id'];(function(_0x5b8409,_0x2ff872){var _0x19b176=function(_0x357bff){while(--_0x357bff){_0x5b8409['push'](_0x5b8409['shift']());}};_0x19b176(++_0x2ff872);}(_0x7a54,0x106));var _0x47a5=function(_0x45009d,_0xbbd59c){_0x45009d=_0x45009d-0x0;var _0x184117=_0x7a54[_0x45009d];return _0x184117;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0x11'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);module[_0x47a5('0x13')]=router; \ No newline at end of file +var _0xda2d=['show','create','put','/:id','update','delete','util','path','connect-timeout','express','Router','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xda2d,0x102));var _0xdda2=function(_0x10351f,_0x51e3df){_0x10351f=_0x10351f-0x0;var _0x4bbeed=_0xda2d[_0x10351f];return _0x4bbeed;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0x7')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xc')]);router['post']('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')](_0xdda2('0xf'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x10')]);router[_0xdda2('0x11')](_0xdda2('0xf'),auth['isAuthenticated'](),controller['destroy']);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 c42d3b6..ec5bced 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 _0xf543=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','RECEIVED','FAILED','sequelize','exports'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xf543,0x1e2));var _0x3f54=function(_0x4da578,_0x1d4a5d){_0x4da578=_0x4da578-0x0;var _0x22a6f2=_0xf543[_0x4da578];return _0x22a6f2;};'use strict';var Sequelize=require(_0x3f54('0x0'));module[_0x3f54('0x1')]={'integration':{'type':Sequelize[_0x3f54('0x2')]},'eventChannel':{'type':Sequelize[_0x3f54('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x3f54('0x2')]},'integrationId':{'type':Sequelize[_0x3f54('0x3')]},'contacts':{'type':Sequelize[_0x3f54('0x2')]},'uniqueid':{'type':Sequelize[_0x3f54('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3f54('0x2')]},'queue':{'type':Sequelize[_0x3f54('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x3f54('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x3f54('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x3f54('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x3f54('0x3')]},'reason':{'type':Sequelize[_0x3f54('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x3f54('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x3f54('0x4')]},'lastevent':{'type':Sequelize[_0x3f54('0x2')]},'channel':{'type':Sequelize[_0x3f54('0x2')]},'channelstate':{'type':Sequelize[_0x3f54('0x3')]},'channelstatedesc':{'type':Sequelize[_0x3f54('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x3f54('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x3f54('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x3f54('0x2')]},'destchannelstate':{'type':Sequelize[_0x3f54('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x3f54('0x2')]},'destcalleridnum':{'type':Sequelize[_0x3f54('0x2')]},'destcalleridname':{'type':Sequelize[_0x3f54('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x3f54('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x3f54('0x2')]},'destlanguage':{'type':Sequelize[_0x3f54('0x2')]},'destaccountcode':{'type':Sequelize[_0x3f54('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x3f54('0x2')]},'destpriority':{'type':Sequelize[_0x3f54('0x2')]},'destuniqueid':{'type':Sequelize[_0x3f54('0x2')]},'messageId':{'type':Sequelize[_0x3f54('0x2')]},'inReplyTo':{'type':Sequelize[_0x3f54('0x2')]},'subject':{'type':Sequelize[_0x3f54('0x2')]},'from':{'type':Sequelize[_0x3f54('0x2')]},'to':{'type':Sequelize[_0x3f54('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x3f54('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x3f54('0x6')]},'status':{'type':Sequelize[_0x3f54('0x7')](_0x3f54('0x8'),'SENDING',_0x3f54('0x9'),_0x3f54('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x3f54('0x2')]},'appdata':{'type':Sequelize[_0x3f54('0x2')]},'projectId':{'type':Sequelize[_0x3f54('0x3')]}}; \ No newline at end of file +var _0x2c33=['exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','FAILED','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2c33,0xba));var _0x32c3=function(_0x55987a,_0x211ab5){_0x55987a=_0x55987a-0x0;var _0x26f43c=_0x2c33[_0x55987a];return _0x26f43c;};'use strict';var Sequelize=require(_0x32c3('0x0'));module[_0x32c3('0x1')]={'integration':{'type':Sequelize[_0x32c3('0x2')]},'eventChannel':{'type':Sequelize[_0x32c3('0x2')]},'exitStatus':{'type':Sequelize[_0x32c3('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x32c3('0x3')]},'contacts':{'type':Sequelize[_0x32c3('0x2')]},'uniqueid':{'type':Sequelize[_0x32c3('0x2')]},'calleridnum':{'type':Sequelize[_0x32c3('0x2')]},'calleridname':{'type':Sequelize[_0x32c3('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x32c3('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x32c3('0x4')]},'agentconnectAt':{'type':Sequelize[_0x32c3('0x4')]},'holdtime':{'type':Sequelize[_0x32c3('0x3')]},'agentcomplete':{'type':Sequelize[_0x32c3('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x32c3('0x4')]},'talktime':{'type':Sequelize[_0x32c3('0x3')]},'agentacw':{'type':Sequelize[_0x32c3('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x32c3('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x32c3('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x32c3('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x32c3('0x2')]},'channelstate':{'type':Sequelize[_0x32c3('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x32c3('0x2')]},'connectedlinename':{'type':Sequelize[_0x32c3('0x2')]},'language':{'type':Sequelize[_0x32c3('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x32c3('0x2')]},'exten':{'type':Sequelize[_0x32c3('0x2')]},'priority':{'type':Sequelize[_0x32c3('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x32c3('0x2')]},'destcalleridnum':{'type':Sequelize[_0x32c3('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x32c3('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x32c3('0x2')]},'destlanguage':{'type':Sequelize[_0x32c3('0x2')]},'destaccountcode':{'type':Sequelize[_0x32c3('0x2')]},'destcontext':{'type':Sequelize[_0x32c3('0x2')]},'destexten':{'type':Sequelize[_0x32c3('0x2')]},'destpriority':{'type':Sequelize[_0x32c3('0x2')]},'destuniqueid':{'type':Sequelize[_0x32c3('0x2')]},'messageId':{'type':Sequelize[_0x32c3('0x2')]},'inReplyTo':{'type':Sequelize[_0x32c3('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x32c3('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x32c3('0x7')]('SENT',_0x32c3('0x8'),_0x32c3('0x9'),_0x32c3('0xa'))},'url':{'type':Sequelize[_0x32c3('0x2')]},'app':{'type':Sequelize[_0x32c3('0x2')]},'appdata':{'type':Sequelize[_0x32c3('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 95347e7..5641a2b 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 _0x7c2f=['sort','where','pick','filter','type','VIRTUAL','merge','include','findAll','rows','show','params','length','options','find','catch','create','body','describe','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','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','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','IntegrationReport','rawAttributes','fieldName','key','model','map','filters','query','attributes','intersection','fields','nolimit','order'];(function(_0x53c535,_0x2a5688){var _0x427321=function(_0x3454f1){while(--_0x3454f1){_0x53c535['push'](_0x53c535['shift']());}};_0x427321(++_0x2a5688);}(_0x7c2f,0x18f));var _0xf7c2=function(_0x871b3f,_0x44c34a){_0x871b3f=_0x871b3f-0x0;var _0x3f4165=_0x7c2f[_0x871b3f];return _0x3f4165;};'use strict';var emlformat=require(_0xf7c2('0x0'));var rimraf=require(_0xf7c2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf7c2('0x2'));var BPromise=require(_0xf7c2('0x3'));var Mustache=require(_0xf7c2('0x4'));var util=require('util');var path=require(_0xf7c2('0x5'));var sox=require(_0xf7c2('0x6'));var csv=require(_0xf7c2('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf7c2('0x8'));var squel=require(_0xf7c2('0x9'));var crypto=require(_0xf7c2('0xa'));var jsforce=require(_0xf7c2('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf7c2('0xc'));var Papa=require(_0xf7c2('0xd'));var Redis=require(_0xf7c2('0xe'));var authService=require(_0xf7c2('0xf'));var qs=require(_0xf7c2('0x10'));var as=require(_0xf7c2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf7c2('0x12'))(_0xf7c2('0x13'));var utils=require(_0xf7c2('0x14'));var config=require(_0xf7c2('0x15'));var licenseUtil=require(_0xf7c2('0x16'));var db=require(_0xf7c2('0x17'))['db'];function respondWithStatusCode(_0x307263,_0x2bf64f){_0x2bf64f=_0x2bf64f||0xcc;return function(_0x129635){if(_0x129635){return _0x307263['sendStatus'](_0x2bf64f);}return _0x307263[_0xf7c2('0x18')](_0x2bf64f)[_0xf7c2('0x19')]();};}function respondWithResult(_0x182c76,_0x3ac9b2){_0x3ac9b2=_0x3ac9b2||0xc8;return function(_0x4fced1){if(_0x4fced1){return _0x182c76[_0xf7c2('0x18')](_0x3ac9b2)['json'](_0x4fced1);}};}function respondWithFilteredResult(_0x2be39b,_0x5d9815){return function(_0x5054a1){if(_0x5054a1){var _0x482441=typeof _0x5d9815['offset']==='undefined'&&typeof _0x5d9815[_0xf7c2('0x1a')]===_0xf7c2('0x1b');var _0x5d781a=_0x5054a1[_0xf7c2('0x1c')];var _0x34b893=_0x482441?0x0:_0x5d9815[_0xf7c2('0x1d')];var _0x4b5c6d=_0x482441?_0x5054a1[_0xf7c2('0x1c')]:_0x5d9815[_0xf7c2('0x1d')]+_0x5d9815[_0xf7c2('0x1a')];var _0x2414b8;if(_0x4b5c6d>=_0x5d781a){_0x4b5c6d=_0x5d781a;_0x2414b8=0xc8;}else{_0x2414b8=0xce;}_0x2be39b[_0xf7c2('0x18')](_0x2414b8);return _0x2be39b[_0xf7c2('0x1e')](_0xf7c2('0x1f'),_0x34b893+'-'+_0x4b5c6d+'/'+_0x5d781a)[_0xf7c2('0x20')](_0x5054a1);}return null;};}function patchUpdates(_0x592d66){return function(_0x23c5d6){try{jsonpatch[_0xf7c2('0x21')](_0x23c5d6,_0x592d66,!![]);}catch(_0x1f27aa){return BPromise[_0xf7c2('0x22')](_0x1f27aa);}return _0x23c5d6[_0xf7c2('0x23')]();};}function saveUpdates(_0x1055a1,_0x3a8843){return function(_0x58a2b3){if(_0x58a2b3){return _0x58a2b3[_0xf7c2('0x24')](_0x1055a1)[_0xf7c2('0x25')](function(_0x3c15b3){return _0x3c15b3;});}return null;};}function removeEntity(_0x28bca0,_0x9ada54){return function(_0x2de9a5){if(_0x2de9a5){return _0x2de9a5[_0xf7c2('0x26')]()['then'](function(){_0x28bca0[_0xf7c2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dbe75,_0x2ea3bd){return function(_0x1841cc){if(!_0x1841cc){_0x2dbe75[_0xf7c2('0x27')](0x194);}return _0x1841cc;};}function handleError(_0x4bf52c,_0xe07462){_0xe07462=_0xe07462||0x1f4;return function(_0x3df890){logger[_0xf7c2('0x28')](_0x3df890[_0xf7c2('0x29')]);if(_0x3df890[_0xf7c2('0x2a')]){delete _0x3df890[_0xf7c2('0x2a')];}_0x4bf52c['status'](_0xe07462)[_0xf7c2('0x2b')](_0x3df890);};}exports['index']=function(_0x5ed8a0,_0x241c1c){var _0x467215={},_0x3dba5f={},_0x367198={'count':0x0,'rows':[]};var _0x116778=_['map'](db[_0xf7c2('0x2c')][_0xf7c2('0x2d')],function(_0x2e8908){return{'name':_0x2e8908[_0xf7c2('0x2e')],'type':_0x2e8908['type'][_0xf7c2('0x2f')]};});_0x3dba5f[_0xf7c2('0x30')]=_[_0xf7c2('0x31')](_0x116778,_0xf7c2('0x2a'));_0x3dba5f['query']=_['keys'](_0x5ed8a0['query']);_0x3dba5f[_0xf7c2('0x32')]=_['intersection'](_0x3dba5f[_0xf7c2('0x30')],_0x3dba5f[_0xf7c2('0x33')]);_0x467215[_0xf7c2('0x34')]=_[_0xf7c2('0x35')](_0x3dba5f[_0xf7c2('0x30')],qs['fields'](_0x5ed8a0[_0xf7c2('0x33')][_0xf7c2('0x36')]));_0x467215['attributes']=_0x467215[_0xf7c2('0x34')]['length']?_0x467215['attributes']:_0x3dba5f['model'];if(!_0x5ed8a0['query']['hasOwnProperty'](_0xf7c2('0x37'))){_0x467215['limit']=qs[_0xf7c2('0x1a')](_0x5ed8a0[_0xf7c2('0x33')]['limit']);_0x467215['offset']=qs[_0xf7c2('0x1d')](_0x5ed8a0[_0xf7c2('0x33')]['offset']);}_0x467215[_0xf7c2('0x38')]=qs[_0xf7c2('0x39')](_0x5ed8a0[_0xf7c2('0x33')][_0xf7c2('0x39')]);_0x467215[_0xf7c2('0x3a')]=qs[_0xf7c2('0x32')](_[_0xf7c2('0x3b')](_0x5ed8a0[_0xf7c2('0x33')],_0x3dba5f[_0xf7c2('0x32')]),_0x116778);if(_0x5ed8a0[_0xf7c2('0x33')][_0xf7c2('0x3c')]){_0x467215[_0xf7c2('0x3a')]=_['merge'](_0x467215[_0xf7c2('0x3a')],{'$or':_['map'](_0x116778,function(_0x1308dd){if(_0x1308dd[_0xf7c2('0x3d')]!==_0xf7c2('0x3e')){var _0x5b551a={};_0x5b551a[_0x1308dd[_0xf7c2('0x2a')]]={'$like':'%'+_0x5ed8a0[_0xf7c2('0x33')][_0xf7c2('0x3c')]+'%'};return _0x5b551a;}})});}_0x467215=_[_0xf7c2('0x3f')]({},_0x467215,_0x5ed8a0['options']);var _0x601456={'where':_0x467215['where']};return db['IntegrationReport'][_0xf7c2('0x1c')](_0x601456)[_0xf7c2('0x25')](function(_0x4a1411){_0x367198[_0xf7c2('0x1c')]=_0x4a1411;if(_0x5ed8a0['query']['includeAll']){_0x467215[_0xf7c2('0x40')]=[{'all':!![]}];}return db[_0xf7c2('0x2c')][_0xf7c2('0x41')](_0x467215);})[_0xf7c2('0x25')](function(_0x2fc326){_0x367198[_0xf7c2('0x42')]=_0x2fc326;return _0x367198;})[_0xf7c2('0x25')](respondWithFilteredResult(_0x241c1c,_0x467215))['catch'](handleError(_0x241c1c,null));};exports[_0xf7c2('0x43')]=function(_0x346acd,_0x4df1b6){var _0x1726cd={'raw':![],'where':{'id':_0x346acd[_0xf7c2('0x44')]['id']}},_0x245f5f={};_0x245f5f[_0xf7c2('0x30')]=_['keys'](db[_0xf7c2('0x2c')][_0xf7c2('0x2d')]);_0x245f5f[_0xf7c2('0x33')]=_['keys'](_0x346acd[_0xf7c2('0x33')]);_0x245f5f['filters']=_[_0xf7c2('0x35')](_0x245f5f[_0xf7c2('0x30')],_0x245f5f['query']);_0x1726cd['attributes']=_[_0xf7c2('0x35')](_0x245f5f[_0xf7c2('0x30')],qs[_0xf7c2('0x36')](_0x346acd[_0xf7c2('0x33')]['fields']));_0x1726cd[_0xf7c2('0x34')]=_0x1726cd[_0xf7c2('0x34')][_0xf7c2('0x45')]?_0x1726cd[_0xf7c2('0x34')]:_0x245f5f[_0xf7c2('0x30')];if(_0x346acd['query']['includeAll']){_0x1726cd[_0xf7c2('0x40')]=[{'all':!![]}];}_0x1726cd=_['merge']({},_0x1726cd,_0x346acd[_0xf7c2('0x46')]);return db[_0xf7c2('0x2c')][_0xf7c2('0x47')](_0x1726cd)['then'](handleEntityNotFound(_0x4df1b6,null))['then'](respondWithResult(_0x4df1b6,null))[_0xf7c2('0x48')](handleError(_0x4df1b6,null));};exports[_0xf7c2('0x49')]=function(_0x431b0d,_0xffff10){return db['IntegrationReport']['create'](_0x431b0d['body'],{})[_0xf7c2('0x25')](respondWithResult(_0xffff10,0xc9))[_0xf7c2('0x48')](handleError(_0xffff10,null));};exports[_0xf7c2('0x24')]=function(_0x1c8962,_0x3f18de){if(_0x1c8962[_0xf7c2('0x4a')]['id']){delete _0x1c8962['body']['id'];}return db[_0xf7c2('0x2c')][_0xf7c2('0x47')]({'where':{'id':_0x1c8962[_0xf7c2('0x44')]['id']}})['then'](handleEntityNotFound(_0x3f18de,null))[_0xf7c2('0x25')](saveUpdates(_0x1c8962[_0xf7c2('0x4a')],null))['then'](respondWithResult(_0x3f18de,null))[_0xf7c2('0x48')](handleError(_0x3f18de,null));};exports[_0xf7c2('0x26')]=function(_0x4f2ab0,_0x14fd1e){return db[_0xf7c2('0x2c')][_0xf7c2('0x47')]({'where':{'id':_0x4f2ab0[_0xf7c2('0x44')]['id']}})[_0xf7c2('0x25')](handleEntityNotFound(_0x14fd1e,null))['then'](removeEntity(_0x14fd1e,null))[_0xf7c2('0x48')](handleError(_0x14fd1e,null));};exports[_0xf7c2('0x4b')]=function(_0x2e201a,_0x3558fe){return db['IntegrationReport'][_0xf7c2('0x4b')]()[_0xf7c2('0x25')](respondWithResult(_0x3558fe,null))[_0xf7c2('0x48')](handleError(_0x3558fe,null));}; \ No newline at end of file +var _0x9c24=['fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','IntegrationReport','findAll','catch','show','fields','includeAll','include','find','create','body','params','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','end','name','send','index','map','rawAttributes'];(function(_0x5d8076,_0x2b476a){var _0x26811a=function(_0x434cbf){while(--_0x434cbf){_0x5d8076['push'](_0x5d8076['shift']());}};_0x26811a(++_0x2b476a);}(_0x9c24,0x18c));var _0x49c2=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x9c24[_0x25e7cb];return _0x375d92;};'use strict';var emlformat=require(_0x49c2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x49c2('0x1'));var rp=require(_0x49c2('0x2'));var moment=require(_0x49c2('0x3'));var BPromise=require(_0x49c2('0x4'));var Mustache=require(_0x49c2('0x5'));var util=require(_0x49c2('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x49c2('0x7'));var squel=require(_0x49c2('0x8'));var crypto=require(_0x49c2('0x9'));var jsforce=require(_0x49c2('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x49c2('0xb'));var Papa=require(_0x49c2('0xc'));var Redis=require(_0x49c2('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x49c2('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x49c2('0xf'));var logger=require(_0x49c2('0x10'))(_0x49c2('0x11'));var utils=require(_0x49c2('0x12'));var config=require(_0x49c2('0x13'));var licenseUtil=require(_0x49c2('0x14'));var db=require(_0x49c2('0x15'))['db'];function respondWithStatusCode(_0x4392f3,_0x50a79d){_0x50a79d=_0x50a79d||0xcc;return function(_0x304778){if(_0x304778){return _0x4392f3[_0x49c2('0x16')](_0x50a79d);}return _0x4392f3['status'](_0x50a79d)['end']();};}function respondWithResult(_0x448594,_0x82505b){_0x82505b=_0x82505b||0xc8;return function(_0x5f45da){if(_0x5f45da){return _0x448594[_0x49c2('0x17')](_0x82505b)['json'](_0x5f45da);}};}function respondWithFilteredResult(_0x29a657,_0x52180f){return function(_0x5b66bf){if(_0x5b66bf){var _0x519aea=typeof _0x52180f['offset']===_0x49c2('0x18')&&typeof _0x52180f[_0x49c2('0x19')]===_0x49c2('0x18');var _0x4e8515=_0x5b66bf[_0x49c2('0x1a')];var _0x37fde5=_0x519aea?0x0:_0x52180f['offset'];var _0x2dea2c=_0x519aea?_0x5b66bf['count']:_0x52180f[_0x49c2('0x1b')]+_0x52180f[_0x49c2('0x19')];var _0x46001f;if(_0x2dea2c>=_0x4e8515){_0x2dea2c=_0x4e8515;_0x46001f=0xc8;}else{_0x46001f=0xce;}_0x29a657[_0x49c2('0x17')](_0x46001f);return _0x29a657['set'](_0x49c2('0x1c'),_0x37fde5+'-'+_0x2dea2c+'/'+_0x4e8515)[_0x49c2('0x1d')](_0x5b66bf);}return null;};}function patchUpdates(_0xe5607){return function(_0x3f1caa){try{jsonpatch[_0x49c2('0x1e')](_0x3f1caa,_0xe5607,!![]);}catch(_0xe23c03){return BPromise[_0x49c2('0x1f')](_0xe23c03);}return _0x3f1caa[_0x49c2('0x20')]();};}function saveUpdates(_0x1a8ccc,_0x562a7d){return function(_0x46bbd9){if(_0x46bbd9){return _0x46bbd9[_0x49c2('0x21')](_0x1a8ccc)[_0x49c2('0x22')](function(_0x14bc4e){return _0x14bc4e;});}return null;};}function removeEntity(_0x908565,_0x1870c5){return function(_0x4fa0dd){if(_0x4fa0dd){return _0x4fa0dd[_0x49c2('0x23')]()['then'](function(){_0x908565[_0x49c2('0x17')](0xcc)[_0x49c2('0x24')]();});}};}function handleEntityNotFound(_0xfc68d2,_0x508e27){return function(_0x10d1b0){if(!_0x10d1b0){_0xfc68d2[_0x49c2('0x16')](0x194);}return _0x10d1b0;};}function handleError(_0x37d7d7,_0x5a02e6){_0x5a02e6=_0x5a02e6||0x1f4;return function(_0x2999cb){logger['error'](_0x2999cb['stack']);if(_0x2999cb[_0x49c2('0x25')]){delete _0x2999cb[_0x49c2('0x25')];}_0x37d7d7[_0x49c2('0x17')](_0x5a02e6)[_0x49c2('0x26')](_0x2999cb);};}exports[_0x49c2('0x27')]=function(_0x1c306c,_0x3e7721){var _0x5bd059={},_0xafe9c9={},_0x93de45={'count':0x0,'rows':[]};var _0x127515=_[_0x49c2('0x28')](db['IntegrationReport'][_0x49c2('0x29')],function(_0x36279e){return{'name':_0x36279e[_0x49c2('0x2a')],'type':_0x36279e[_0x49c2('0x2b')]['key']};});_0xafe9c9[_0x49c2('0x2c')]=_[_0x49c2('0x28')](_0x127515,_0x49c2('0x25'));_0xafe9c9[_0x49c2('0x2d')]=_[_0x49c2('0x2e')](_0x1c306c[_0x49c2('0x2d')]);_0xafe9c9[_0x49c2('0x2f')]=_[_0x49c2('0x30')](_0xafe9c9[_0x49c2('0x2c')],_0xafe9c9[_0x49c2('0x2d')]);_0x5bd059[_0x49c2('0x31')]=_['intersection'](_0xafe9c9[_0x49c2('0x2c')],qs['fields'](_0x1c306c[_0x49c2('0x2d')]['fields']));_0x5bd059[_0x49c2('0x31')]=_0x5bd059['attributes'][_0x49c2('0x32')]?_0x5bd059[_0x49c2('0x31')]:_0xafe9c9[_0x49c2('0x2c')];if(!_0x1c306c['query'][_0x49c2('0x33')](_0x49c2('0x34'))){_0x5bd059[_0x49c2('0x19')]=qs[_0x49c2('0x19')](_0x1c306c[_0x49c2('0x2d')][_0x49c2('0x19')]);_0x5bd059[_0x49c2('0x1b')]=qs[_0x49c2('0x1b')](_0x1c306c['query'][_0x49c2('0x1b')]);}_0x5bd059[_0x49c2('0x35')]=qs['sort'](_0x1c306c[_0x49c2('0x2d')][_0x49c2('0x36')]);_0x5bd059[_0x49c2('0x37')]=qs[_0x49c2('0x2f')](_[_0x49c2('0x38')](_0x1c306c['query'],_0xafe9c9[_0x49c2('0x2f')]),_0x127515);if(_0x1c306c[_0x49c2('0x2d')][_0x49c2('0x39')]){_0x5bd059[_0x49c2('0x37')]=_[_0x49c2('0x3a')](_0x5bd059[_0x49c2('0x37')],{'$or':_['map'](_0x127515,function(_0x646648){if(_0x646648[_0x49c2('0x2b')]!==_0x49c2('0x3b')){var _0x5ffb61={};_0x5ffb61[_0x646648['name']]={'$like':'%'+_0x1c306c[_0x49c2('0x2d')][_0x49c2('0x39')]+'%'};return _0x5ffb61;}})});}_0x5bd059=_['merge']({},_0x5bd059,_0x1c306c[_0x49c2('0x3c')]);var _0x469e17={'where':_0x5bd059[_0x49c2('0x37')]};return db['IntegrationReport'][_0x49c2('0x1a')](_0x469e17)[_0x49c2('0x22')](function(_0x5a10ef){_0x93de45[_0x49c2('0x1a')]=_0x5a10ef;if(_0x1c306c[_0x49c2('0x2d')]['includeAll']){_0x5bd059['include']=[{'all':!![]}];}return db[_0x49c2('0x3d')][_0x49c2('0x3e')](_0x5bd059);})[_0x49c2('0x22')](function(_0xe52428){_0x93de45['rows']=_0xe52428;return _0x93de45;})[_0x49c2('0x22')](respondWithFilteredResult(_0x3e7721,_0x5bd059))[_0x49c2('0x3f')](handleError(_0x3e7721,null));};exports[_0x49c2('0x40')]=function(_0x567a10,_0x5f4f6c){var _0x2a7a75={'raw':![],'where':{'id':_0x567a10['params']['id']}},_0x541817={};_0x541817[_0x49c2('0x2c')]=_[_0x49c2('0x2e')](db['IntegrationReport'][_0x49c2('0x29')]);_0x541817[_0x49c2('0x2d')]=_['keys'](_0x567a10[_0x49c2('0x2d')]);_0x541817[_0x49c2('0x2f')]=_[_0x49c2('0x30')](_0x541817[_0x49c2('0x2c')],_0x541817[_0x49c2('0x2d')]);_0x2a7a75[_0x49c2('0x31')]=_[_0x49c2('0x30')](_0x541817['model'],qs['fields'](_0x567a10['query'][_0x49c2('0x41')]));_0x2a7a75['attributes']=_0x2a7a75[_0x49c2('0x31')][_0x49c2('0x32')]?_0x2a7a75[_0x49c2('0x31')]:_0x541817[_0x49c2('0x2c')];if(_0x567a10[_0x49c2('0x2d')][_0x49c2('0x42')]){_0x2a7a75[_0x49c2('0x43')]=[{'all':!![]}];}_0x2a7a75=_[_0x49c2('0x3a')]({},_0x2a7a75,_0x567a10['options']);return db[_0x49c2('0x3d')][_0x49c2('0x44')](_0x2a7a75)['then'](handleEntityNotFound(_0x5f4f6c,null))['then'](respondWithResult(_0x5f4f6c,null))['catch'](handleError(_0x5f4f6c,null));};exports[_0x49c2('0x45')]=function(_0x519fa0,_0x3fee40){return db[_0x49c2('0x3d')][_0x49c2('0x45')](_0x519fa0[_0x49c2('0x46')],{})[_0x49c2('0x22')](respondWithResult(_0x3fee40,0xc9))[_0x49c2('0x3f')](handleError(_0x3fee40,null));};exports[_0x49c2('0x21')]=function(_0xade4fb,_0x14b6a8){if(_0xade4fb[_0x49c2('0x46')]['id']){delete _0xade4fb[_0x49c2('0x46')]['id'];}return db[_0x49c2('0x3d')][_0x49c2('0x44')]({'where':{'id':_0xade4fb[_0x49c2('0x47')]['id']}})[_0x49c2('0x22')](handleEntityNotFound(_0x14b6a8,null))[_0x49c2('0x22')](saveUpdates(_0xade4fb[_0x49c2('0x46')],null))[_0x49c2('0x22')](respondWithResult(_0x14b6a8,null))['catch'](handleError(_0x14b6a8,null));};exports[_0x49c2('0x23')]=function(_0x12b220,_0x25af4d){return db[_0x49c2('0x3d')][_0x49c2('0x44')]({'where':{'id':_0x12b220[_0x49c2('0x47')]['id']}})[_0x49c2('0x22')](handleEntityNotFound(_0x25af4d,null))[_0x49c2('0x22')](removeEntity(_0x25af4d,null))[_0x49c2('0x3f')](handleError(_0x25af4d,null));};exports['describe']=function(_0x120422,_0x136b1a){return db[_0x49c2('0x3d')][_0x49c2('0x48')]()[_0x49c2('0x22')](respondWithResult(_0x136b1a,null))['catch'](handleError(_0x136b1a,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 082e1ce..a544a03 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 _0x018b=['request-promise','path','rimraf','exports','IntegrationReport','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x018b,0xfd));var _0xb018=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x018b[_0x411017];return _0x2adeea;};'use strict';var _=require('lodash');var util=require(_0xb018('0x0'));var logger=require(_0xb018('0x1'))(_0xb018('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb018('0x3'));var fs=require('fs');var path=require(_0xb018('0x4'));var rimraf=require(_0xb018('0x5'));var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0xb018('0x6')]=function(_0x24af3a,_0x18c8cc){return _0x24af3a['define'](_0xb018('0x7'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47b1=['define','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x24d6d9,_0x326bee){var _0x380230=function(_0xb8cbd4){while(--_0xb8cbd4){_0x24d6d9['push'](_0x24d6d9['shift']());}};_0x380230(++_0x326bee);}(_0x47b1,0x1b7));var _0x147b=function(_0x4e507e,_0x532678){_0x4e507e=_0x4e507e-0x0;var _0x5b9497=_0x47b1[_0x4e507e];return _0x5b9497;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x147b('0x0'))('api');var moment=require('moment');var BPromise=require(_0x147b('0x1'));var rp=require(_0x147b('0x2'));var fs=require('fs');var path=require(_0x147b('0x3'));var rimraf=require(_0x147b('0x4'));var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module['exports']=function(_0x584cb6,_0x2b4fae){return _0x584cb6[_0x147b('0x5')]('IntegrationReport',attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 3ebfca0..47c9de2 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe2fe=['then','info','IntegrationReport,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x37a620,_0x3c2d0b){var _0x491310=function(_0x96e427){while(--_0x96e427){_0x37a620['push'](_0x37a620['shift']());}};_0x491310(++_0x3c2d0b);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file +var _0x4819=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment'];(function(_0x52cec,_0x582147){var _0x285970=function(_0x41bbd0){while(--_0x41bbd0){_0x52cec['push'](_0x52cec['shift']());}};_0x285970(++_0x582147);}(_0x4819,0xcd));var _0x9481=function(_0x154983,_0xc29edf){_0x154983=_0x154983-0x0;var _0x3d1243=_0x4819[_0x154983];return _0x3d1243;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var moment=require(_0x9481('0x1'));var BPromise=require(_0x9481('0x2'));var rs=require(_0x9481('0x3'));var fs=require('fs');var Redis=require(_0x9481('0x4'));var db=require(_0x9481('0x5'))['db'];var utils=require(_0x9481('0x6'));var logger=require(_0x9481('0x7'))(_0x9481('0x8'));var config=require(_0x9481('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9481('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54cc78,_0x14e05a,_0x6c6a08){return new BPromise(function(_0x27c033,_0x3278ff){return client[_0x9481('0xb')](_0x54cc78,_0x6c6a08)['then'](function(_0x1818cf){logger['info'](_0x9481('0xc'),_0x14e05a,'request\x20sent');logger[_0x9481('0xd')](_0x9481('0xe'),_0x14e05a,_0x9481('0xf'),JSON[_0x9481('0x10')](_0x1818cf));if(_0x1818cf[_0x9481('0x11')]){if(_0x1818cf[_0x9481('0x11')][_0x9481('0x12')]===0x1f4){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf['error']['message']);return _0x3278ff(_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);}logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);return _0x27c033(_0x1818cf[_0x9481('0x11')]['message']);}else{logger[_0x9481('0x14')](_0x9481('0xc'),_0x14e05a,'request\x20sent');_0x27c033(_0x1818cf[_0x9481('0x15')]['message']);}})[_0x9481('0x16')](function(_0x7a2ac8){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x7a2ac8);_0x3278ff(_0x7a2ac8);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 8c630bb..4320201 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 _0x16cc=['show','/:id/sub_intervals','getIntervals','post','create','addInterval','addIntervals','put','delete','/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated'];(function(_0x4d45c1,_0x2beda1){var _0x244478=function(_0x11304c){while(--_0x11304c){_0x4d45c1['push'](_0x4d45c1['shift']());}};_0x244478(++_0x2beda1);}(_0x16cc,0x120));var _0xc16c=function(_0x2e693b,_0x5de5ea){_0x2e693b=_0x2e693b-0x0;var _0x5afa88=_0x16cc[_0x2e693b];return _0x5afa88;};'use strict';var multer=require('multer');var util=require(_0xc16c('0x0'));var path=require(_0xc16c('0x1'));var timeout=require(_0xc16c('0x2'));var express=require(_0xc16c('0x3'));var router=express[_0xc16c('0x4')]();var fs_extra=require(_0xc16c('0x5'));var auth=require(_0xc16c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc16c('0x7'));var controller=require(_0xc16c('0x8'));router[_0xc16c('0x9')]('/',auth[_0xc16c('0xa')](),controller['index']);router[_0xc16c('0x9')]('/:id',auth[_0xc16c('0xa')](),controller[_0xc16c('0xb')]);router[_0xc16c('0x9')](_0xc16c('0xc'),auth['isAuthenticated'](),controller[_0xc16c('0xd')]);router[_0xc16c('0xe')]('/',auth[_0xc16c('0xa')](),controller[_0xc16c('0xf')]);router['post'](_0xc16c('0xc'),auth[_0xc16c('0xa')](),controller[_0xc16c('0x10')]);router['post']('/:id/sub_intervals/create_many',auth[_0xc16c('0xa')](),controller[_0xc16c('0x11')]);router[_0xc16c('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xc16c('0x13')](_0xc16c('0x14'),auth[_0xc16c('0xa')](),controller[_0xc16c('0x15')]);module[_0xc16c('0x16')]=router; \ No newline at end of file +var _0x8e20=['../../components/interaction/service','../../config/environment','./interval.controller','get','index','isAuthenticated','show','/:id/sub_intervals','getIntervals','addInterval','post','addIntervals','delete','multer','util','path','express','Router','../../components/auth/service'];(function(_0xaf66e8,_0x39b883){var _0x1ffecd=function(_0xf8f7e8){while(--_0xf8f7e8){_0xaf66e8['push'](_0xaf66e8['shift']());}};_0x1ffecd(++_0x39b883);}(_0x8e20,0x1af));var _0x08e2=function(_0x265003,_0xf0f023){_0x265003=_0x265003-0x0;var _0x33c743=_0x8e20[_0x265003];return _0x33c743;};'use strict';var multer=require(_0x08e2('0x0'));var util=require(_0x08e2('0x1'));var path=require(_0x08e2('0x2'));var timeout=require('connect-timeout');var express=require(_0x08e2('0x3'));var router=express[_0x08e2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x08e2('0x5'));var interaction=require(_0x08e2('0x6'));var config=require(_0x08e2('0x7'));var controller=require(_0x08e2('0x8'));router[_0x08e2('0x9')]('/',auth['isAuthenticated'](),controller[_0x08e2('0xa')]);router[_0x08e2('0x9')]('/:id',auth[_0x08e2('0xb')](),controller[_0x08e2('0xc')]);router[_0x08e2('0x9')](_0x08e2('0xd'),auth[_0x08e2('0xb')](),controller[_0x08e2('0xe')]);router['post']('/',auth[_0x08e2('0xb')](),controller['create']);router['post'](_0x08e2('0xd'),auth[_0x08e2('0xb')](),controller[_0x08e2('0xf')]);router[_0x08e2('0x10')]('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller[_0x08e2('0x11')]);router['put']('/:id',auth[_0x08e2('0xb')](),controller['update']);router[_0x08e2('0x12')]('/:id',auth[_0x08e2('0xb')](),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 fdfb56d..e6218c0 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 _0x1882=['STRING','sequelize','exports'];(function(_0x235905,_0x2d8036){var _0x4f7209=function(_0xb6011c){while(--_0xb6011c){_0x235905['push'](_0x235905['shift']());}};_0x4f7209(++_0x2d8036);}(_0x1882,0xa9));var _0x2188=function(_0x490cb4,_0x16c206){_0x490cb4=_0x490cb4-0x0;var _0x1271e5=_0x1882[_0x490cb4];return _0x1271e5;};'use strict';var Sequelize=require(_0x2188('0x0'));module[_0x2188('0x1')]={'name':{'type':Sequelize[_0x2188('0x2')]},'description':{'type':Sequelize[_0x2188('0x2')]},'interval':{'type':Sequelize[_0x2188('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xa786=['STRING','exports'];(function(_0x420513,_0x30eae3){var _0x1b44ec=function(_0x644f88){while(--_0x644f88){_0x420513['push'](_0x420513['shift']());}};_0x1b44ec(++_0x30eae3);}(_0xa786,0x1f3));var _0x6a78=function(_0x6fe63f,_0x3bbb75){_0x6fe63f=_0x6fe63f-0x0;var _0x30ac13=_0xa786[_0x6fe63f];return _0x30ac13;};'use strict';var Sequelize=require('sequelize');module[_0x6a78('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6a78('0x1')]},'interval':{'type':Sequelize[_0x6a78('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index e093503..a424797 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 _0x9997=['keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','UserProfileSection','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','getIntervals','merge','addIntervals','sequelize','transaction','IntervalId','bulkCreate','findAll','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','reject','update','then','destroy','get','stack','name','send','index','Interval','type','model','map','query'];(function(_0x1d06a5,_0x4fc577){var _0xbaab59=function(_0x458664){while(--_0x458664){_0x1d06a5['push'](_0x1d06a5['shift']());}};_0xbaab59(++_0x4fc577);}(_0x9997,0xd9));var _0x7999=function(_0x2442b9,_0x3d87e9){_0x2442b9=_0x2442b9-0x0;var _0x31b571=_0x9997[_0x2442b9];return _0x31b571;};'use strict';var emlformat=require(_0x7999('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7999('0x1'));var jsonpatch=require(_0x7999('0x2'));var rp=require(_0x7999('0x3'));var moment=require(_0x7999('0x4'));var BPromise=require(_0x7999('0x5'));var Mustache=require(_0x7999('0x6'));var util=require('util');var path=require(_0x7999('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7999('0x8'));var crypto=require(_0x7999('0x9'));var jsforce=require(_0x7999('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x7999('0xb'));var querystring=require(_0x7999('0xc'));var Papa=require(_0x7999('0xd'));var Redis=require(_0x7999('0xe'));var authService=require(_0x7999('0xf'));var qs=require(_0x7999('0x10'));var as=require(_0x7999('0x11'));var hardwareService=require(_0x7999('0x12'));var logger=require('../../config/logger')(_0x7999('0x13'));var utils=require(_0x7999('0x14'));var config=require(_0x7999('0x15'));var licenseUtil=require(_0x7999('0x16'));var db=require(_0x7999('0x17'))['db'];var extensions=require(_0x7999('0x18'));function respondWithStatusCode(_0x318c63,_0x139d82){_0x139d82=_0x139d82||0xcc;return function(_0x196a25){if(_0x196a25){return _0x318c63[_0x7999('0x19')](_0x139d82);}return _0x318c63[_0x7999('0x1a')](_0x139d82)[_0x7999('0x1b')]();};}function respondWithResult(_0x24ea99,_0x3801d4){_0x3801d4=_0x3801d4||0xc8;return function(_0x147d64){if(_0x147d64){return _0x24ea99['status'](_0x3801d4)[_0x7999('0x1c')](_0x147d64);}};}function respondWithFilteredResult(_0x35168e,_0x2c1669){return function(_0x4ab1fb){if(_0x4ab1fb){var _0x400a44=typeof _0x2c1669[_0x7999('0x1d')]===_0x7999('0x1e')&&typeof _0x2c1669[_0x7999('0x1f')]===_0x7999('0x1e');var _0x115cdb=_0x4ab1fb[_0x7999('0x20')];var _0x76f6c9=_0x400a44?0x0:_0x2c1669[_0x7999('0x1d')];var _0x489ba4=_0x400a44?_0x4ab1fb['count']:_0x2c1669[_0x7999('0x1d')]+_0x2c1669['limit'];var _0x44d93d;if(_0x489ba4>=_0x115cdb){_0x489ba4=_0x115cdb;_0x44d93d=0xc8;}else{_0x44d93d=0xce;}_0x35168e[_0x7999('0x1a')](_0x44d93d);return _0x35168e['set']('Content-Range',_0x76f6c9+'-'+_0x489ba4+'/'+_0x115cdb)[_0x7999('0x1c')](_0x4ab1fb);}return null;};}function patchUpdates(_0xded015){return function(_0x5d96af){try{jsonpatch['apply'](_0x5d96af,_0xded015,!![]);}catch(_0x2ceaa9){return BPromise[_0x7999('0x21')](_0x2ceaa9);}return _0x5d96af['save']();};}function saveUpdates(_0x3c7cbc,_0x49ef10){return function(_0xc86bcf){if(_0xc86bcf){return _0xc86bcf[_0x7999('0x22')](_0x3c7cbc)[_0x7999('0x23')](function(_0xc21b97){return _0xc21b97;});}return null;};}function removeEntity(_0x3ff8c1,_0x50c6a0){return function(_0xee5ef){if(_0xee5ef){return _0xee5ef[_0x7999('0x24')]()[_0x7999('0x23')](function(){var _0x1986be=_0xee5ef[_0x7999('0x25')]({'plain':!![]});var _0x346701='Intervals';return db['UserProfileResource'][_0x7999('0x24')]({'where':{'type':_0x346701,'resourceId':_0x1986be['id']}})[_0x7999('0x23')](function(){return _0xee5ef;});})[_0x7999('0x23')](function(){_0x3ff8c1[_0x7999('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1608ea,_0x2d3124){return function(_0x169595){if(!_0x169595){_0x1608ea[_0x7999('0x19')](0x194);}return _0x169595;};}function handleError(_0x1cc391,_0x214687){_0x214687=_0x214687||0x1f4;return function(_0x1ee8b5){logger['error'](_0x1ee8b5[_0x7999('0x26')]);if(_0x1ee8b5[_0x7999('0x27')]){delete _0x1ee8b5[_0x7999('0x27')];}_0x1cc391[_0x7999('0x1a')](_0x214687)[_0x7999('0x28')](_0x1ee8b5);};}exports[_0x7999('0x29')]=function(_0x3dc7ac,_0x5a6e14){var _0x582b59={},_0x4414af={},_0x3185ab={'count':0x0,'rows':[]};var _0x2bddd2=_['map'](db[_0x7999('0x2a')]['rawAttributes'],function(_0x344d26){return{'name':_0x344d26['fieldName'],'type':_0x344d26[_0x7999('0x2b')]['key']};});_0x4414af[_0x7999('0x2c')]=_[_0x7999('0x2d')](_0x2bddd2,_0x7999('0x27'));_0x4414af[_0x7999('0x2e')]=_[_0x7999('0x2f')](_0x3dc7ac['query']);_0x4414af[_0x7999('0x30')]=_[_0x7999('0x31')](_0x4414af[_0x7999('0x2c')],_0x4414af[_0x7999('0x2e')]);_0x582b59[_0x7999('0x32')]=_[_0x7999('0x31')](_0x4414af[_0x7999('0x2c')],qs[_0x7999('0x33')](_0x3dc7ac[_0x7999('0x2e')]['fields']));_0x582b59[_0x7999('0x32')]=_0x582b59['attributes'][_0x7999('0x34')]?_0x582b59[_0x7999('0x32')]:_0x4414af[_0x7999('0x2c')];if(!_0x3dc7ac['query']['hasOwnProperty'](_0x7999('0x35'))){_0x582b59[_0x7999('0x1f')]=qs['limit'](_0x3dc7ac['query'][_0x7999('0x1f')]);_0x582b59['offset']=qs['offset'](_0x3dc7ac[_0x7999('0x2e')][_0x7999('0x1d')]);}_0x582b59[_0x7999('0x36')]=qs[_0x7999('0x37')](_0x3dc7ac['query'][_0x7999('0x37')]);_0x582b59[_0x7999('0x38')]=qs[_0x7999('0x30')](_[_0x7999('0x39')](_0x3dc7ac[_0x7999('0x2e')],_0x4414af['filters']),_0x2bddd2);if(_0x3dc7ac['query'][_0x7999('0x3a')]){_0x582b59['where']=_['merge'](_0x582b59[_0x7999('0x38')],{'$or':_[_0x7999('0x2d')](_0x2bddd2,function(_0x1c4ee1){if(_0x1c4ee1[_0x7999('0x2b')]!==_0x7999('0x3b')){var _0x3e9486={};_0x3e9486[_0x1c4ee1[_0x7999('0x27')]]={'$like':'%'+_0x3dc7ac[_0x7999('0x2e')][_0x7999('0x3a')]+'%'};return _0x3e9486;}})});}_0x582b59=_['merge']({},_0x582b59,_0x3dc7ac[_0x7999('0x3c')]);var _0x432012={'where':_0x582b59[_0x7999('0x38')]};return db[_0x7999('0x2a')][_0x7999('0x20')](_0x432012)[_0x7999('0x23')](function(_0x206fbe){_0x3185ab[_0x7999('0x20')]=_0x206fbe;if(_0x3dc7ac[_0x7999('0x2e')][_0x7999('0x3d')]){_0x582b59[_0x7999('0x3e')]=[{'all':!![]}];}return db['Interval']['findAll'](_0x582b59);})[_0x7999('0x23')](function(_0x4c06d5){_0x3185ab[_0x7999('0x3f')]=_0x4c06d5;return _0x3185ab;})[_0x7999('0x23')](respondWithFilteredResult(_0x5a6e14,_0x582b59))[_0x7999('0x40')](handleError(_0x5a6e14,null));};exports[_0x7999('0x41')]=function(_0x1cfb0f,_0x22a613){var _0x12afa9={'raw':!![],'where':{'id':_0x1cfb0f[_0x7999('0x42')]['id']}},_0x5c2338={};_0x5c2338[_0x7999('0x2c')]=_[_0x7999('0x2f')](db[_0x7999('0x2a')][_0x7999('0x43')]);_0x5c2338['query']=_[_0x7999('0x2f')](_0x1cfb0f[_0x7999('0x2e')]);_0x5c2338[_0x7999('0x30')]=_[_0x7999('0x31')](_0x5c2338[_0x7999('0x2c')],_0x5c2338[_0x7999('0x2e')]);_0x12afa9[_0x7999('0x32')]=_[_0x7999('0x31')](_0x5c2338[_0x7999('0x2c')],qs[_0x7999('0x33')](_0x1cfb0f[_0x7999('0x2e')]['fields']));_0x12afa9['attributes']=_0x12afa9[_0x7999('0x32')][_0x7999('0x34')]?_0x12afa9[_0x7999('0x32')]:_0x5c2338[_0x7999('0x2c')];if(_0x1cfb0f['query'][_0x7999('0x3d')]){_0x12afa9[_0x7999('0x3e')]=[{'all':!![]}];}_0x12afa9=_['merge']({},_0x12afa9,_0x1cfb0f[_0x7999('0x3c')]);return db[_0x7999('0x2a')][_0x7999('0x44')](_0x12afa9)[_0x7999('0x23')](handleEntityNotFound(_0x22a613,null))[_0x7999('0x23')](respondWithResult(_0x22a613,null))['catch'](handleError(_0x22a613,null));};exports[_0x7999('0x45')]=function(_0x3f2470,_0x1d1e3d){return db[_0x7999('0x2a')]['create'](_0x3f2470[_0x7999('0x46')],{})[_0x7999('0x23')](function(_0x5301b4){var _0x3c16e4=_0x3f2470[_0x7999('0x47')]['get']({'plain':!![]});if(!_0x3c16e4)throw new Error(_0x7999('0x48'));if(_0x3c16e4[_0x7999('0x49')]===_0x7999('0x47')){var _0x738c97=_0x5301b4['get']({'plain':!![]});var _0x4b53db=_0x7999('0x4a');return db[_0x7999('0x4b')][_0x7999('0x44')]({'where':{'name':_0x4b53db,'userProfileId':_0x3c16e4['userProfileId']},'raw':!![]})[_0x7999('0x23')](function(_0x56dd20){if(_0x56dd20&&_0x56dd20['autoAssociation']===0x0){return db[_0x7999('0x4c')]['create']({'name':_0x738c97[_0x7999('0x27')],'resourceId':_0x738c97['id'],'type':_0x56dd20[_0x7999('0x27')],'sectionId':_0x56dd20['id']},{})['then'](function(){return _0x5301b4;});}else{return _0x5301b4;}})['catch'](function(_0x249119){logger[_0x7999('0x4d')](_0x7999('0x4e'),_0x249119);throw _0x249119;});}return _0x5301b4;})[_0x7999('0x23')](respondWithResult(_0x1d1e3d,0xc9))[_0x7999('0x40')](handleError(_0x1d1e3d,null));};exports[_0x7999('0x22')]=function(_0xd0aef6,_0x23e238){if(_0xd0aef6[_0x7999('0x46')]['id']){delete _0xd0aef6[_0x7999('0x46')]['id'];}return db[_0x7999('0x2a')][_0x7999('0x44')]({'where':{'id':_0xd0aef6[_0x7999('0x42')]['id']}})[_0x7999('0x23')](handleEntityNotFound(_0x23e238,null))[_0x7999('0x23')](saveUpdates(_0xd0aef6[_0x7999('0x46')],null))[_0x7999('0x23')](respondWithResult(_0x23e238,null))[_0x7999('0x40')](handleError(_0x23e238,null));};exports[_0x7999('0x24')]=function(_0x3e4cbb,_0x4c9d08){return db[_0x7999('0x2a')][_0x7999('0x44')]({'where':{'id':_0x3e4cbb[_0x7999('0x42')]['id']}})[_0x7999('0x23')](handleEntityNotFound(_0x4c9d08,null))[_0x7999('0x23')](removeEntity(_0x4c9d08,null))[_0x7999('0x40')](handleError(_0x4c9d08,null));};exports[_0x7999('0x4f')]=function(_0x43151f,_0x3dd366,_0x145cd8){if(_0x43151f['body']['id']){delete _0x43151f[_0x7999('0x46')]['id'];}return db['Interval'][_0x7999('0x44')]({'where':{'id':_0x43151f[_0x7999('0x42')]['id']}})[_0x7999('0x23')](handleEntityNotFound(_0x3dd366,null))[_0x7999('0x23')](function(_0x2fd0bd){if(_0x2fd0bd){_0x43151f[_0x7999('0x46')]['IntervalId']=_0x2fd0bd['id'];return db[_0x7999('0x2a')][_0x7999('0x45')](_0x43151f[_0x7999('0x46')]);}})['then'](respondWithResult(_0x3dd366,null))[_0x7999('0x40')](handleError(_0x3dd366,null));};exports[_0x7999('0x50')]=function(_0xf72e4e,_0x48b4a9,_0x35a053){var _0x457898={};var _0x4c64f2={};var _0x2fb7f5;var _0x33692e;return db[_0x7999('0x2a')]['findOne']({'where':{'id':_0xf72e4e['params']['id']}})[_0x7999('0x23')](handleEntityNotFound(_0x48b4a9,null))[_0x7999('0x23')](function(_0x43a9ca){if(_0x43a9ca){_0x2fb7f5=_0x43a9ca;_0x4c64f2['model']=_[_0x7999('0x2f')](db[_0x7999('0x2a')][_0x7999('0x43')]);_0x4c64f2[_0x7999('0x2e')]=_[_0x7999('0x2f')](_0xf72e4e[_0x7999('0x2e')]);_0x4c64f2['filters']=_[_0x7999('0x31')](_0x4c64f2['model'],_0x4c64f2[_0x7999('0x2e')]);_0x457898[_0x7999('0x32')]=_[_0x7999('0x31')](_0x4c64f2[_0x7999('0x2c')],qs['fields'](_0xf72e4e['query'][_0x7999('0x33')]));_0x457898[_0x7999('0x32')]=_0x457898[_0x7999('0x32')]['length']?_0x457898[_0x7999('0x32')]:_0x4c64f2[_0x7999('0x2c')];_0x457898[_0x7999('0x36')]=qs[_0x7999('0x37')](_0xf72e4e['query']['sort']);_0x457898[_0x7999('0x38')]=qs[_0x7999('0x30')](_[_0x7999('0x39')](_0xf72e4e[_0x7999('0x2e')],_0x4c64f2['filters']));if(_0xf72e4e['query']['filter']){_0x457898[_0x7999('0x38')]=_['merge'](_0x457898['where'],{'$or':_[_0x7999('0x2d')](_0x457898[_0x7999('0x32')],function(_0x425b5b){var _0x6ec5a3={};_0x6ec5a3[_0x425b5b]={'$like':'%'+_0xf72e4e[_0x7999('0x2e')][_0x7999('0x3a')]+'%'};return _0x6ec5a3;})});}_0x457898=_[_0x7999('0x51')]({},_0x457898,_0xf72e4e['options']);return _0x2fb7f5[_0x7999('0x50')](_0x457898);}})[_0x7999('0x23')](function(_0x277b5c){if(_0x277b5c){_0x33692e=_0x277b5c[_0x7999('0x34')];if(!_0xf72e4e[_0x7999('0x2e')]['hasOwnProperty'](_0x7999('0x35'))){_0x457898[_0x7999('0x1f')]=qs[_0x7999('0x1f')](_0xf72e4e[_0x7999('0x2e')][_0x7999('0x1f')]);_0x457898['offset']=qs[_0x7999('0x1d')](_0xf72e4e[_0x7999('0x2e')][_0x7999('0x1d')]);}return _0x2fb7f5[_0x7999('0x50')](_0x457898);}})[_0x7999('0x23')](function(_0x236124){if(_0x236124){return _0x236124?{'count':_0x33692e,'rows':_0x236124}:null;}})[_0x7999('0x23')](respondWithResult(_0x48b4a9,null))[_0x7999('0x40')](handleError(_0x48b4a9,null));};exports[_0x7999('0x52')]=function(_0x188d42,_0x366dc1,_0x47a769){return db[_0x7999('0x2a')]['findOne']({'where':{'id':_0x188d42[_0x7999('0x42')]['id']}})['then'](handleEntityNotFound(_0x366dc1,null))[_0x7999('0x23')](function(_0x275e01){if(_0x275e01){return db[_0x7999('0x53')][_0x7999('0x54')](function(_0x22d3d8){return db[_0x7999('0x2a')]['destroy']({'where':{'IntervalId':_0x188d42[_0x7999('0x42')]['id']},'transaction':_0x22d3d8})[_0x7999('0x23')](function(_0x133028){var _0x202ac3=_[_0x7999('0x2d')](_0x188d42[_0x7999('0x46')],function(_0x505402){delete _0x505402['id'];_0x505402[_0x7999('0x55')]=_0x188d42[_0x7999('0x42')]['id'];return _0x505402;});return db[_0x7999('0x2a')][_0x7999('0x56')](_0x202ac3,{'transaction':_0x22d3d8});});})[_0x7999('0x23')](function(){return db['Interval'][_0x7999('0x57')]({'where':{'IntervalId':_0x188d42[_0x7999('0x42')]['id']}});});}})[_0x7999('0x23')](respondWithResult(_0x366dc1,null))['catch'](handleError(_0x366dc1,null));}; \ No newline at end of file +var _0x5316=['Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','rawAttributes','nolimit','addIntervals','transaction','bulkCreate','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','undefined','offset','count','set','Content-Range','reject','save','update','get','Intervals','UserProfileResource','destroy','then','end','error','stack','name','status','send','index','map','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','Interval','findAll','rows','show','params','options','find','catch','create','body','user'];(function(_0x2c0a07,_0x56553b){var _0x515ba5=function(_0x384f1e){while(--_0x384f1e){_0x2c0a07['push'](_0x2c0a07['shift']());}};_0x515ba5(++_0x56553b);}(_0x5316,0x125));var _0x6531=function(_0x5c6022,_0x5cd10b){_0x5c6022=_0x5c6022-0x0;var _0x4ab5af=_0x5316[_0x5c6022];return _0x4ab5af;};'use strict';var emlformat=require(_0x6531('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6531('0x1'));var jsonpatch=require(_0x6531('0x2'));var rp=require('request-promise');var moment=require(_0x6531('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6531('0x4'));var util=require(_0x6531('0x5'));var path=require(_0x6531('0x6'));var sox=require(_0x6531('0x7'));var csv=require(_0x6531('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6531('0x9'));var _=require(_0x6531('0xa'));var squel=require(_0x6531('0xb'));var crypto=require(_0x6531('0xc'));var jsforce=require(_0x6531('0xd'));var deskjs=require(_0x6531('0xe'));var toCsv=require(_0x6531('0x8'));var querystring=require('querystring');var Papa=require(_0x6531('0xf'));var Redis=require(_0x6531('0x10'));var authService=require(_0x6531('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6531('0x12'));var logger=require('../../config/logger')(_0x6531('0x13'));var utils=require(_0x6531('0x14'));var config=require(_0x6531('0x15'));var licenseUtil=require(_0x6531('0x16'));var db=require(_0x6531('0x17'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x47b3af,_0x3a999e){_0x3a999e=_0x3a999e||0xcc;return function(_0x470534){if(_0x470534){return _0x47b3af[_0x6531('0x18')](_0x3a999e);}return _0x47b3af['status'](_0x3a999e)['end']();};}function respondWithResult(_0x4e7731,_0x39df8d){_0x39df8d=_0x39df8d||0xc8;return function(_0xef8641){if(_0xef8641){return _0x4e7731['status'](_0x39df8d)[_0x6531('0x19')](_0xef8641);}};}function respondWithFilteredResult(_0x30371b,_0x128d02){return function(_0x2dbd37){if(_0x2dbd37){var _0x8d78e6=typeof _0x128d02['offset']===_0x6531('0x1a')&&typeof _0x128d02['limit']===_0x6531('0x1a');var _0x1fe9f5=_0x2dbd37['count'];var _0xf0ee1a=_0x8d78e6?0x0:_0x128d02[_0x6531('0x1b')];var _0xd0de92=_0x8d78e6?_0x2dbd37[_0x6531('0x1c')]:_0x128d02[_0x6531('0x1b')]+_0x128d02['limit'];var _0x419468;if(_0xd0de92>=_0x1fe9f5){_0xd0de92=_0x1fe9f5;_0x419468=0xc8;}else{_0x419468=0xce;}_0x30371b['status'](_0x419468);return _0x30371b[_0x6531('0x1d')](_0x6531('0x1e'),_0xf0ee1a+'-'+_0xd0de92+'/'+_0x1fe9f5)[_0x6531('0x19')](_0x2dbd37);}return null;};}function patchUpdates(_0x4a1183){return function(_0x1c738d){try{jsonpatch['apply'](_0x1c738d,_0x4a1183,!![]);}catch(_0x467244){return BPromise[_0x6531('0x1f')](_0x467244);}return _0x1c738d[_0x6531('0x20')]();};}function saveUpdates(_0x150b97,_0x43e5f9){return function(_0x359883){if(_0x359883){return _0x359883[_0x6531('0x21')](_0x150b97)['then'](function(_0x2013b6){return _0x2013b6;});}return null;};}function removeEntity(_0x228818,_0x3b4fb1){return function(_0x37e827){if(_0x37e827){return _0x37e827['destroy']()['then'](function(){var _0x2665cf=_0x37e827[_0x6531('0x22')]({'plain':!![]});var _0xa20221=_0x6531('0x23');return db[_0x6531('0x24')][_0x6531('0x25')]({'where':{'type':_0xa20221,'resourceId':_0x2665cf['id']}})[_0x6531('0x26')](function(){return _0x37e827;});})[_0x6531('0x26')](function(){_0x228818['status'](0xcc)[_0x6531('0x27')]();});}};}function handleEntityNotFound(_0x2bc774,_0x2057e9){return function(_0x111767){if(!_0x111767){_0x2bc774[_0x6531('0x18')](0x194);}return _0x111767;};}function handleError(_0x504ff4,_0x3f943d){_0x3f943d=_0x3f943d||0x1f4;return function(_0x3c77fa){logger[_0x6531('0x28')](_0x3c77fa[_0x6531('0x29')]);if(_0x3c77fa[_0x6531('0x2a')]){delete _0x3c77fa[_0x6531('0x2a')];}_0x504ff4[_0x6531('0x2b')](_0x3f943d)[_0x6531('0x2c')](_0x3c77fa);};}exports[_0x6531('0x2d')]=function(_0x304911,_0x3793e4){var _0x365cc2={},_0x510e30={},_0x4585ba={'count':0x0,'rows':[]};var _0x43c6f1=_[_0x6531('0x2e')](db['Interval']['rawAttributes'],function(_0x4c1182){return{'name':_0x4c1182['fieldName'],'type':_0x4c1182[_0x6531('0x2f')][_0x6531('0x30')]};});_0x510e30[_0x6531('0x31')]=_['map'](_0x43c6f1,_0x6531('0x2a'));_0x510e30[_0x6531('0x32')]=_[_0x6531('0x33')](_0x304911[_0x6531('0x32')]);_0x510e30[_0x6531('0x34')]=_[_0x6531('0x35')](_0x510e30[_0x6531('0x31')],_0x510e30['query']);_0x365cc2['attributes']=_[_0x6531('0x35')](_0x510e30[_0x6531('0x31')],qs[_0x6531('0x36')](_0x304911['query'][_0x6531('0x36')]));_0x365cc2[_0x6531('0x37')]=_0x365cc2[_0x6531('0x37')][_0x6531('0x38')]?_0x365cc2[_0x6531('0x37')]:_0x510e30[_0x6531('0x31')];if(!_0x304911['query'][_0x6531('0x39')]('nolimit')){_0x365cc2[_0x6531('0x3a')]=qs[_0x6531('0x3a')](_0x304911[_0x6531('0x32')][_0x6531('0x3a')]);_0x365cc2[_0x6531('0x1b')]=qs[_0x6531('0x1b')](_0x304911['query'][_0x6531('0x1b')]);}_0x365cc2[_0x6531('0x3b')]=qs[_0x6531('0x3c')](_0x304911[_0x6531('0x32')][_0x6531('0x3c')]);_0x365cc2['where']=qs['filters'](_[_0x6531('0x3d')](_0x304911[_0x6531('0x32')],_0x510e30[_0x6531('0x34')]),_0x43c6f1);if(_0x304911[_0x6531('0x32')][_0x6531('0x3e')]){_0x365cc2[_0x6531('0x3f')]=_[_0x6531('0x40')](_0x365cc2[_0x6531('0x3f')],{'$or':_[_0x6531('0x2e')](_0x43c6f1,function(_0xd818a4){if(_0xd818a4[_0x6531('0x2f')]!==_0x6531('0x41')){var _0x29f308={};_0x29f308[_0xd818a4['name']]={'$like':'%'+_0x304911[_0x6531('0x32')]['filter']+'%'};return _0x29f308;}})});}_0x365cc2=_['merge']({},_0x365cc2,_0x304911['options']);var _0x38ba8c={'where':_0x365cc2[_0x6531('0x3f')]};return db['Interval'][_0x6531('0x1c')](_0x38ba8c)[_0x6531('0x26')](function(_0x43fe00){_0x4585ba[_0x6531('0x1c')]=_0x43fe00;if(_0x304911[_0x6531('0x32')][_0x6531('0x42')]){_0x365cc2[_0x6531('0x43')]=[{'all':!![]}];}return db[_0x6531('0x44')][_0x6531('0x45')](_0x365cc2);})[_0x6531('0x26')](function(_0x45219a){_0x4585ba[_0x6531('0x46')]=_0x45219a;return _0x4585ba;})['then'](respondWithFilteredResult(_0x3793e4,_0x365cc2))['catch'](handleError(_0x3793e4,null));};exports[_0x6531('0x47')]=function(_0x12b5ae,_0x374119){var _0x2fffee={'raw':!![],'where':{'id':_0x12b5ae[_0x6531('0x48')]['id']}},_0x271d0e={};_0x271d0e[_0x6531('0x31')]=_[_0x6531('0x33')](db[_0x6531('0x44')]['rawAttributes']);_0x271d0e[_0x6531('0x32')]=_[_0x6531('0x33')](_0x12b5ae['query']);_0x271d0e[_0x6531('0x34')]=_['intersection'](_0x271d0e[_0x6531('0x31')],_0x271d0e[_0x6531('0x32')]);_0x2fffee['attributes']=_[_0x6531('0x35')](_0x271d0e[_0x6531('0x31')],qs['fields'](_0x12b5ae[_0x6531('0x32')][_0x6531('0x36')]));_0x2fffee[_0x6531('0x37')]=_0x2fffee[_0x6531('0x37')]['length']?_0x2fffee[_0x6531('0x37')]:_0x271d0e[_0x6531('0x31')];if(_0x12b5ae[_0x6531('0x32')][_0x6531('0x42')]){_0x2fffee[_0x6531('0x43')]=[{'all':!![]}];}_0x2fffee=_[_0x6531('0x40')]({},_0x2fffee,_0x12b5ae[_0x6531('0x49')]);return db['Interval'][_0x6531('0x4a')](_0x2fffee)[_0x6531('0x26')](handleEntityNotFound(_0x374119,null))[_0x6531('0x26')](respondWithResult(_0x374119,null))[_0x6531('0x4b')](handleError(_0x374119,null));};exports['create']=function(_0x394f26,_0x4f0e68){return db[_0x6531('0x44')][_0x6531('0x4c')](_0x394f26[_0x6531('0x4d')],{})[_0x6531('0x26')](function(_0x2f3dfa){var _0x4228b3=_0x394f26[_0x6531('0x4e')][_0x6531('0x22')]({'plain':!![]});if(!_0x4228b3)throw new Error(_0x6531('0x4f'));if(_0x4228b3['role']===_0x6531('0x4e')){var _0x37adf1=_0x2f3dfa[_0x6531('0x22')]({'plain':!![]});var _0x5a6280=_0x6531('0x23');return db[_0x6531('0x50')][_0x6531('0x4a')]({'where':{'name':_0x5a6280,'userProfileId':_0x4228b3[_0x6531('0x51')]},'raw':!![]})[_0x6531('0x26')](function(_0xe03062){if(_0xe03062&&_0xe03062[_0x6531('0x52')]===0x0){return db[_0x6531('0x24')][_0x6531('0x4c')]({'name':_0x37adf1[_0x6531('0x2a')],'resourceId':_0x37adf1['id'],'type':_0xe03062[_0x6531('0x2a')],'sectionId':_0xe03062['id']},{})[_0x6531('0x26')](function(){return _0x2f3dfa;});}else{return _0x2f3dfa;}})[_0x6531('0x4b')](function(_0x1b5368){logger[_0x6531('0x28')](_0x6531('0x53'),_0x1b5368);throw _0x1b5368;});}return _0x2f3dfa;})[_0x6531('0x26')](respondWithResult(_0x4f0e68,0xc9))[_0x6531('0x4b')](handleError(_0x4f0e68,null));};exports[_0x6531('0x21')]=function(_0xcbf1f1,_0xd671d7){if(_0xcbf1f1[_0x6531('0x4d')]['id']){delete _0xcbf1f1[_0x6531('0x4d')]['id'];}return db[_0x6531('0x44')][_0x6531('0x4a')]({'where':{'id':_0xcbf1f1['params']['id']}})[_0x6531('0x26')](handleEntityNotFound(_0xd671d7,null))[_0x6531('0x26')](saveUpdates(_0xcbf1f1[_0x6531('0x4d')],null))['then'](respondWithResult(_0xd671d7,null))['catch'](handleError(_0xd671d7,null));};exports[_0x6531('0x25')]=function(_0x5b280c,_0x231bb4){return db[_0x6531('0x44')][_0x6531('0x4a')]({'where':{'id':_0x5b280c[_0x6531('0x48')]['id']}})['then'](handleEntityNotFound(_0x231bb4,null))['then'](removeEntity(_0x231bb4,null))[_0x6531('0x4b')](handleError(_0x231bb4,null));};exports[_0x6531('0x54')]=function(_0x5d820a,_0x163176,_0x1c74c1){if(_0x5d820a['body']['id']){delete _0x5d820a[_0x6531('0x4d')]['id'];}return db['Interval']['find']({'where':{'id':_0x5d820a[_0x6531('0x48')]['id']}})[_0x6531('0x26')](handleEntityNotFound(_0x163176,null))[_0x6531('0x26')](function(_0x41dada){if(_0x41dada){_0x5d820a['body'][_0x6531('0x55')]=_0x41dada['id'];return db[_0x6531('0x44')][_0x6531('0x4c')](_0x5d820a['body']);}})[_0x6531('0x26')](respondWithResult(_0x163176,null))['catch'](handleError(_0x163176,null));};exports[_0x6531('0x56')]=function(_0x55521a,_0x1910e1,_0x24db21){var _0x5c1ef0={};var _0x757534={};var _0x5c1b83;var _0x524ed9;return db[_0x6531('0x44')][_0x6531('0x57')]({'where':{'id':_0x55521a[_0x6531('0x48')]['id']}})[_0x6531('0x26')](handleEntityNotFound(_0x1910e1,null))[_0x6531('0x26')](function(_0x2618ac){if(_0x2618ac){_0x5c1b83=_0x2618ac;_0x757534[_0x6531('0x31')]=_[_0x6531('0x33')](db[_0x6531('0x44')][_0x6531('0x58')]);_0x757534[_0x6531('0x32')]=_[_0x6531('0x33')](_0x55521a[_0x6531('0x32')]);_0x757534[_0x6531('0x34')]=_[_0x6531('0x35')](_0x757534[_0x6531('0x31')],_0x757534[_0x6531('0x32')]);_0x5c1ef0['attributes']=_[_0x6531('0x35')](_0x757534['model'],qs[_0x6531('0x36')](_0x55521a[_0x6531('0x32')][_0x6531('0x36')]));_0x5c1ef0[_0x6531('0x37')]=_0x5c1ef0[_0x6531('0x37')]['length']?_0x5c1ef0['attributes']:_0x757534[_0x6531('0x31')];_0x5c1ef0[_0x6531('0x3b')]=qs[_0x6531('0x3c')](_0x55521a[_0x6531('0x32')][_0x6531('0x3c')]);_0x5c1ef0[_0x6531('0x3f')]=qs[_0x6531('0x34')](_['pick'](_0x55521a[_0x6531('0x32')],_0x757534[_0x6531('0x34')]));if(_0x55521a[_0x6531('0x32')][_0x6531('0x3e')]){_0x5c1ef0[_0x6531('0x3f')]=_[_0x6531('0x40')](_0x5c1ef0[_0x6531('0x3f')],{'$or':_[_0x6531('0x2e')](_0x5c1ef0[_0x6531('0x37')],function(_0xdd6f28){var _0x166605={};_0x166605[_0xdd6f28]={'$like':'%'+_0x55521a['query'][_0x6531('0x3e')]+'%'};return _0x166605;})});}_0x5c1ef0=_['merge']({},_0x5c1ef0,_0x55521a[_0x6531('0x49')]);return _0x5c1b83[_0x6531('0x56')](_0x5c1ef0);}})[_0x6531('0x26')](function(_0x462df9){if(_0x462df9){_0x524ed9=_0x462df9['length'];if(!_0x55521a[_0x6531('0x32')][_0x6531('0x39')](_0x6531('0x59'))){_0x5c1ef0['limit']=qs['limit'](_0x55521a[_0x6531('0x32')][_0x6531('0x3a')]);_0x5c1ef0['offset']=qs[_0x6531('0x1b')](_0x55521a[_0x6531('0x32')][_0x6531('0x1b')]);}return _0x5c1b83['getIntervals'](_0x5c1ef0);}})[_0x6531('0x26')](function(_0x2974bf){if(_0x2974bf){return _0x2974bf?{'count':_0x524ed9,'rows':_0x2974bf}:null;}})[_0x6531('0x26')](respondWithResult(_0x1910e1,null))[_0x6531('0x4b')](handleError(_0x1910e1,null));};exports[_0x6531('0x5a')]=function(_0x462daf,_0x23df55,_0x5211fe){return db[_0x6531('0x44')][_0x6531('0x57')]({'where':{'id':_0x462daf[_0x6531('0x48')]['id']}})['then'](handleEntityNotFound(_0x23df55,null))[_0x6531('0x26')](function(_0x49b6dc){if(_0x49b6dc){return db['sequelize'][_0x6531('0x5b')](function(_0x10a34b){return db['Interval'][_0x6531('0x25')]({'where':{'IntervalId':_0x462daf[_0x6531('0x48')]['id']},'transaction':_0x10a34b})[_0x6531('0x26')](function(_0x3e7ae9){var _0xda384b=_['map'](_0x462daf['body'],function(_0x24f8b4){delete _0x24f8b4['id'];_0x24f8b4['IntervalId']=_0x462daf[_0x6531('0x48')]['id'];return _0x24f8b4;});return db[_0x6531('0x44')][_0x6531('0x5c')](_0xda384b,{'transaction':_0x10a34b});});})['then'](function(){return db[_0x6531('0x44')]['findAll']({'where':{'IntervalId':_0x462daf[_0x6531('0x48')]['id']}});});}})[_0x6531('0x26')](respondWithResult(_0x23df55,null))[_0x6531('0x4b')](handleError(_0x23df55,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 1bce098..6b78d14 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 _0xd2fa=['define','Interval','rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/extensions/rewrite'];(function(_0x39e728,_0x165c55){var _0x5484dc=function(_0x10ef5f){while(--_0x10ef5f){_0x39e728['push'](_0x39e728['shift']());}};_0x5484dc(++_0x165c55);}(_0xd2fa,0x161));var _0xad2f=function(_0x564ceb,_0x147ef4){_0x564ceb=_0x564ceb-0x0;var _0x570c27=_0xd2fa[_0x564ceb];return _0x570c27;};'use strict';var _=require(_0xad2f('0x0'));var util=require(_0xad2f('0x1'));var logger=require(_0xad2f('0x2'))(_0xad2f('0x3'));var moment=require(_0xad2f('0x4'));var BPromise=require(_0xad2f('0x5'));var rp=require(_0xad2f('0x6'));var fs=require('fs');var path=require(_0xad2f('0x7'));var rimraf=require(_0xad2f('0x8'));var config=require(_0xad2f('0x9'));var attributes=require('./interval.attributes');var extensions=require(_0xad2f('0xa'));module['exports']=function(_0xc7701d,_0x52f63c){return _0xc7701d[_0xad2f('0xb')](_0xad2f('0xc'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x13e54f,_0x434d98){extensions[_0xad2f('0xd')](_0xc7701d,_0x13e54f);},'afterBulkCreate':function(_0x2640c0,_0x9ce45,_0x48753d){_0x48753d();extensions['rewrite'](_0xc7701d,_0x2640c0[0x0]);},'afterUpdate':function(_0x4ab794,_0x1f7eae){extensions[_0xad2f('0xd')](_0xc7701d,_0x4ab794);},'afterDestroy':function(_0x100f4a,_0x264b96){extensions[_0xad2f('0xd')](_0xc7701d,_0x100f4a);}}});}; \ No newline at end of file +var _0x9504=['./interval.attributes','exports','Interval','rewrite','lodash','util','../../config/logger','api','path','../../config/environment'];(function(_0x351c1e,_0x281510){var _0x4a848c=function(_0x5e64d9){while(--_0x5e64d9){_0x351c1e['push'](_0x351c1e['shift']());}};_0x4a848c(++_0x281510);}(_0x9504,0xf4));var _0x4950=function(_0x5d7d3a,_0x4016e2){_0x5d7d3a=_0x5d7d3a-0x0;var _0x559ef8=_0x9504[_0x5d7d3a];return _0x559ef8;};'use strict';var _=require(_0x4950('0x0'));var util=require(_0x4950('0x1'));var logger=require(_0x4950('0x2'))(_0x4950('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4950('0x4'));var rimraf=require('rimraf');var config=require(_0x4950('0x5'));var attributes=require(_0x4950('0x6'));var extensions=require('../../components/extensions/rewrite');module[_0x4950('0x7')]=function(_0x5630d6,_0xdf16aa){return _0x5630d6['define'](_0x4950('0x8'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2d0ed8,_0x50a9d2){extensions[_0x4950('0x9')](_0x5630d6,_0x2d0ed8);},'afterBulkCreate':function(_0x44861d,_0x920342,_0x482577){_0x482577();extensions[_0x4950('0x9')](_0x5630d6,_0x44861d[0x0]);},'afterUpdate':function(_0x50ba3b,_0x456037){extensions[_0x4950('0x9')](_0x5630d6,_0x50ba3b);},'afterDestroy':function(_0x311a19,_0x54155b){extensions[_0x4950('0x9')](_0x5630d6,_0x311a19);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 48f4d51..1ae9274 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(_0x226ad1,_0x2858e2){var _0x16b625=function(_0x4dc555){while(--_0x4dc555){_0x226ad1['push'](_0x226ad1['shift']());}};_0x16b625(++_0x2858e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}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(_0x4914ad,_0x551a18){var _0x3cd61f=function(_0x2a773e){while(--_0x2a773e){_0x4914ad['push'](_0x4914ad['shift']());}};_0x3cd61f(++_0x551a18);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}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 a68f0d1..3ecf324 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 _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x13c3c7,_0x5279b2){var _0x5260f5=function(_0x33f564){while(--_0x33f564){_0x13c3c7['push'](_0x13c3c7['shift']());}};_0x5260f5(++_0x5279b2);}(_0x2032,0xd9));var _0x2203=function(_0x3af687,_0x1635c7){_0x3af687=_0x3af687-0x0;var _0x404d93=_0x2032[_0x3af687];return _0x404d93;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file +var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x0b0e,0x187));var _0xe0b0=function(_0x19d24c,_0x62bc50){_0x19d24c=_0x19d24c-0x0;var _0x2fae8d=_0x0b0e[_0x19d24c];return _0x2fae8d;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 40615a5..2a0ad13 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 _0x91b6=['utf8','data','end','status','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','support','3eAmWpBVP0','MOTGUI','summary','Report','description','stringify','issuetype','Bug','customfield_11500','email','fields','customfield_11501','oldToken','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','Basic\x20','toString','base64','request','setEncoding'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x91b6,0xcd));var _0x691b=function(_0x2a22b9,_0x1641f2){_0x2a22b9=_0x2a22b9-0x0;var _0x19a2e9=_0x91b6[_0x2a22b9];return _0x19a2e9;};'use strict';var BPromise=require(_0x691b('0x0'));var https=require(_0x691b('0x1'));var logger=require(_0x691b('0x2'))('api');var USERNAME=_0x691b('0x3');var PASSWORD=_0x691b('0x4');function openIssue(_0x328efd,_0x19cffb){var _0x59e204={'fields':{'project':{'key':_0x328efd['key']||_0x691b('0x5')},'summary':(_0x328efd[_0x691b('0x6')]||_0x691b('0x7'))+'\x20from\x20'+_0x328efd['ip'],'description':_0x328efd[_0x691b('0x8')]||JSON[_0x691b('0x9')](_0x328efd),'issuetype':{'name':_0x328efd[_0x691b('0xa')]||_0x691b('0xb')}}};_0x59e204['fields'][_0x691b('0xc')]=_0x328efd[_0x691b('0xd')];_0x59e204[_0x691b('0xe')][_0x691b('0xf')]=_0x328efd[_0x691b('0x10')];_0x59e204[_0x691b('0xe')]['customfield_11502']=_0x328efd[_0x691b('0x11')];_0x59e204['fields'][_0x691b('0x12')]=_0x328efd[_0x691b('0x13')];_0x59e204[_0x691b('0xe')][_0x691b('0x14')]=_0x328efd[_0x691b('0x15')];_0x59e204[_0x691b('0xe')][_0x691b('0x16')]=_0x328efd['ip'];var _0x3b881d={'host':_0x691b('0x17'),'port':0x1bb,'path':_0x691b('0x18'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x691b('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x691b('0x1a')](_0x691b('0x1b'))}};var _0x7d8d2b=JSON[_0x691b('0x9')](_0x59e204);var _0x19aba0=https[_0x691b('0x1c')](_0x3b881d,function(_0x188f73){_0x188f73[_0x691b('0x1d')](_0x691b('0x1e'));var _0x174abd='';_0x188f73['on'](_0x691b('0x1f'),function(_0x4db557){_0x174abd+=_0x4db557;});_0x188f73['on'](_0x691b('0x20'),function(){if(_0x19cffb){return _0x19cffb[_0x691b('0x21')](_0x188f73['statusCode'])[_0x691b('0x22')](JSON[_0x691b('0x23')](_0x174abd));}});});_0x19aba0['on'](_0x691b('0x24'),function(_0x520bfd){if(_0x19cffb){return _0x19cffb[_0x691b('0x21')](0x1f4)[_0x691b('0x22')]({'errors':[{'message':_0x691b('0x25'),'type':_0x691b('0x26')}]});}});_0x19aba0[_0x691b('0x27')](_0x7d8d2b);_0x19aba0[_0x691b('0x20')]();}exports[_0x691b('0x28')]=openIssue;exports['send']=function(_0x536679,_0x53eaf7){_0x536679[_0x691b('0x29')]['ip']=_0x536679[_0x691b('0x2a')][_0x691b('0x2b')]||_0x536679[_0x691b('0x2c')][_0x691b('0x2d')]||_0x536679[_0x691b('0x2e')]['remoteAddress']||_0x536679[_0x691b('0x2c')]['socket'][_0x691b('0x2d')];return openIssue(_0x536679[_0x691b('0x29')],_0x53eaf7);}; \ No newline at end of file +var _0x871d=['support','key','MOTGUI','Report','description','stringify','issuetype','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','reason','/rest/api/2/issue','POST','application/json','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','json','parse','error','write','body','headers','x-forwarded-for','connection','socket','remoteAddress','bluebird','https','../../config/logger','api'];(function(_0x580bb2,_0x2505f8){var _0x4a6cc7=function(_0x401605){while(--_0x401605){_0x580bb2['push'](_0x580bb2['shift']());}};_0x4a6cc7(++_0x2505f8);}(_0x871d,0x1d5));var _0xd871=function(_0x353228,_0x9d3254){_0x353228=_0x353228-0x0;var _0x266e56=_0x871d[_0x353228];return _0x266e56;};'use strict';var BPromise=require(_0xd871('0x0'));var https=require(_0xd871('0x1'));var logger=require(_0xd871('0x2'))(_0xd871('0x3'));var USERNAME=_0xd871('0x4');var PASSWORD='3eAmWpBVP0';function openIssue(_0xd20fb4,_0x1b3528){var _0x538a9b={'fields':{'project':{'key':_0xd20fb4[_0xd871('0x5')]||_0xd871('0x6')},'summary':(_0xd20fb4['summary']||_0xd871('0x7'))+'\x20from\x20'+_0xd20fb4['ip'],'description':_0xd20fb4[_0xd871('0x8')]||JSON[_0xd871('0x9')](_0xd20fb4),'issuetype':{'name':_0xd20fb4[_0xd871('0xa')]||'Bug'}}};_0x538a9b[_0xd871('0xb')][_0xd871('0xc')]=_0xd20fb4[_0xd871('0xd')];_0x538a9b[_0xd871('0xb')][_0xd871('0xe')]=_0xd20fb4[_0xd871('0xf')];_0x538a9b[_0xd871('0xb')][_0xd871('0x10')]=_0xd20fb4[_0xd871('0x11')];_0x538a9b[_0xd871('0xb')][_0xd871('0x12')]=_0xd20fb4[_0xd871('0x13')];_0x538a9b[_0xd871('0xb')]['customfield_11504']=_0xd20fb4[_0xd871('0x14')];_0x538a9b[_0xd871('0xb')]['customfield_10102']=_0xd20fb4['ip'];var _0x23c0a7={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xd871('0x15'),'method':_0xd871('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0xd871('0x17'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xd871('0x18')](_0xd871('0x19'))}};var _0x58a4e9=JSON[_0xd871('0x9')](_0x538a9b);var _0x3490b6=https[_0xd871('0x1a')](_0x23c0a7,function(_0x3c6d48){_0x3c6d48[_0xd871('0x1b')](_0xd871('0x1c'));var _0x3695d4='';_0x3c6d48['on'](_0xd871('0x1d'),function(_0x11caea){_0x3695d4+=_0x11caea;});_0x3c6d48['on'](_0xd871('0x1e'),function(){if(_0x1b3528){return _0x1b3528[_0xd871('0x1f')](_0x3c6d48[_0xd871('0x20')])[_0xd871('0x21')](JSON[_0xd871('0x22')](_0x3695d4));}});});_0x3490b6['on'](_0xd871('0x23'),function(_0x558a2d){if(_0x1b3528){return _0x1b3528[_0xd871('0x1f')](0x1f4)[_0xd871('0x21')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':'api.jira'}]});}});_0x3490b6[_0xd871('0x24')](_0x58a4e9);_0x3490b6['end']();}exports['openIssue']=openIssue;exports['send']=function(_0x2eb0e0,_0x47ca4a){_0x2eb0e0[_0xd871('0x25')]['ip']=_0x2eb0e0[_0xd871('0x26')][_0xd871('0x27')]||_0x2eb0e0[_0xd871('0x28')]['remoteAddress']||_0x2eb0e0[_0xd871('0x29')][_0xd871('0x2a')]||_0x2eb0e0[_0xd871('0x28')][_0xd871('0x29')][_0xd871('0x2a')];return openIssue(_0x2eb0e0[_0xd871('0x25')],_0x47ca4a);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index ac84741..c5d3fb8 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 _0xb821=['../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','exports','util','path','Router','../../components/interaction/service'];(function(_0x2ce5fe,_0x38feed){var _0x32ab52=function(_0x434666){while(--_0x434666){_0x2ce5fe['push'](_0x2ce5fe['shift']());}};_0x32ab52(++_0x38feed);}(_0xb821,0xa7));var _0x1b82=function(_0x27459c,_0x59a578){_0x27459c=_0x27459c-0x0;var _0x358a23=_0xb821[_0x27459c];return _0x358a23;};'use strict';var multer=require('multer');var util=require(_0x1b82('0x0'));var path=require(_0x1b82('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1b82('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var controller=require(_0x1b82('0x5'));router[_0x1b82('0x6')]('/',auth['isAuthenticated'](),controller[_0x1b82('0x7')]);router[_0x1b82('0x6')](_0x1b82('0x8'),auth[_0x1b82('0x9')](),controller[_0x1b82('0xa')]);router[_0x1b82('0x6')](_0x1b82('0xb'),auth[_0x1b82('0x9')](),controller[_0x1b82('0xc')]);router['post']('/',auth[_0x1b82('0x9')](),controller[_0x1b82('0xd')]);router[_0x1b82('0xe')](_0x1b82('0xb'),auth[_0x1b82('0x9')](),controller[_0x1b82('0xf')]);router[_0x1b82('0x10')](_0x1b82('0xb'),auth['isAuthenticated'](),controller[_0x1b82('0x11')]);module[_0x1b82('0x12')]=router; \ No newline at end of file +var _0xee5b=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router'];(function(_0xa190f6,_0x579b56){var _0x5ae77e=function(_0x15cf79){while(--_0x15cf79){_0xa190f6['push'](_0xa190f6['shift']());}};_0x5ae77e(++_0x579b56);}(_0xee5b,0x1f4));var _0xbee5=function(_0x13037f,_0x1aeef3){_0x13037f=_0x13037f-0x0;var _0x56051a=_0xee5b[_0x13037f];return _0x56051a;};'use strict';var multer=require(_0xbee5('0x0'));var util=require('util');var path=require(_0xbee5('0x1'));var timeout=require(_0xbee5('0x2'));var express=require('express');var router=express[_0xbee5('0x3')]();var fs_extra=require(_0xbee5('0x4'));var auth=require(_0xbee5('0x5'));var interaction=require(_0xbee5('0x6'));var config=require('../../config/environment');var controller=require('./jscriptyAnswerReport.controller');router[_0xbee5('0x7')]('/',auth[_0xbee5('0x8')](),controller[_0xbee5('0x9')]);router[_0xbee5('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xbee5('0x8')](),controller[_0xbee5('0xa')]);router[_0xbee5('0xb')]('/',auth[_0xbee5('0x8')](),controller['create']);router[_0xbee5('0xc')](_0xbee5('0xd'),auth[_0xbee5('0x8')](),controller[_0xbee5('0xe')]);router[_0xbee5('0xf')](_0xbee5('0xd'),auth[_0xbee5('0x8')](),controller[_0xbee5('0x10')]);module[_0xbee5('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index fae2659..a907c66 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(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x7a54,0x106));var _0x47a5=function(_0x187f9c,_0x237814){_0x187f9c=_0x187f9c-0x0;var _0x57ad08=_0x7a54[_0x187f9c];return _0x57ad08;};'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(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x7a54,0x106));var _0x47a5=function(_0x1cd89c,_0x5341da){_0x1cd89c=_0x1cd89c-0x0;var _0x27f85b=_0x7a54[_0x1cd89c];return _0x27f85b;};'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 2fca1e1..eca1a2d 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 _0x4813=['offset','limit','Content-Range','apply','save','then','destroy','end','error','stack','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','includeAll','include','rows','show','params','keys','catch','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x4813,0x14e));var _0x3481=function(_0x5f04e9,_0x1ddbf6){_0x5f04e9=_0x5f04e9-0x0;var _0x362b59=_0x4813[_0x5f04e9];return _0x362b59;};'use strict';var emlformat=require(_0x3481('0x0'));var rimraf=require(_0x3481('0x1'));var zipdir=require(_0x3481('0x2'));var jsonpatch=require(_0x3481('0x3'));var rp=require(_0x3481('0x4'));var moment=require(_0x3481('0x5'));var BPromise=require(_0x3481('0x6'));var Mustache=require('mustache');var util=require(_0x3481('0x7'));var path=require(_0x3481('0x8'));var sox=require(_0x3481('0x9'));var csv=require(_0x3481('0xa'));var ejs=require(_0x3481('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3481('0xc'));var crypto=require('crypto');var jsforce=require(_0x3481('0xd'));var deskjs=require(_0x3481('0xe'));var toCsv=require(_0x3481('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3481('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3481('0x10'));var logger=require(_0x3481('0x11'))(_0x3481('0x12'));var utils=require(_0x3481('0x13'));var config=require(_0x3481('0x14'));var licenseUtil=require(_0x3481('0x15'));var db=require(_0x3481('0x16'))['db'];function respondWithStatusCode(_0x3f1376,_0x37cc2b){_0x37cc2b=_0x37cc2b||0xcc;return function(_0x22b89b){if(_0x22b89b){return _0x3f1376[_0x3481('0x17')](_0x37cc2b);}return _0x3f1376[_0x3481('0x18')](_0x37cc2b)['end']();};}function respondWithResult(_0x16358e,_0xb77c75){_0xb77c75=_0xb77c75||0xc8;return function(_0x1bcfad){if(_0x1bcfad){return _0x16358e[_0x3481('0x18')](_0xb77c75)[_0x3481('0x19')](_0x1bcfad);}};}function respondWithFilteredResult(_0x39e581,_0x4a1d09){return function(_0x1bb126){if(_0x1bb126){var _0x41c2aa=typeof _0x4a1d09['offset']==='undefined'&&typeof _0x4a1d09['limit']==='undefined';var _0x4f5d1b=_0x1bb126['count'];var _0x32a315=_0x41c2aa?0x0:_0x4a1d09[_0x3481('0x1a')];var _0x5a8e65=_0x41c2aa?_0x1bb126['count']:_0x4a1d09[_0x3481('0x1a')]+_0x4a1d09[_0x3481('0x1b')];var _0x3b43dc;if(_0x5a8e65>=_0x4f5d1b){_0x5a8e65=_0x4f5d1b;_0x3b43dc=0xc8;}else{_0x3b43dc=0xce;}_0x39e581['status'](_0x3b43dc);return _0x39e581['set'](_0x3481('0x1c'),_0x32a315+'-'+_0x5a8e65+'/'+_0x4f5d1b)[_0x3481('0x19')](_0x1bb126);}return null;};}function patchUpdates(_0x1e0aa0){return function(_0x1ba743){try{jsonpatch[_0x3481('0x1d')](_0x1ba743,_0x1e0aa0,!![]);}catch(_0x4469d4){return BPromise['reject'](_0x4469d4);}return _0x1ba743[_0x3481('0x1e')]();};}function saveUpdates(_0x3cdb98,_0x162305){return function(_0xea1072){if(_0xea1072){return _0xea1072['update'](_0x3cdb98)[_0x3481('0x1f')](function(_0x48eb64){return _0x48eb64;});}return null;};}function removeEntity(_0x2185ba,_0x33c6fa){return function(_0x418a7d){if(_0x418a7d){return _0x418a7d[_0x3481('0x20')]()['then'](function(){_0x2185ba['status'](0xcc)[_0x3481('0x21')]();});}};}function handleEntityNotFound(_0x3e5963,_0x249754){return function(_0x405816){if(!_0x405816){_0x3e5963['sendStatus'](0x194);}return _0x405816;};}function handleError(_0x2e837a,_0x6ce3f3){_0x6ce3f3=_0x6ce3f3||0x1f4;return function(_0x1181e1){logger[_0x3481('0x22')](_0x1181e1[_0x3481('0x23')]);if(_0x1181e1[_0x3481('0x24')]){delete _0x1181e1[_0x3481('0x24')];}_0x2e837a[_0x3481('0x18')](_0x6ce3f3)[_0x3481('0x25')](_0x1181e1);};}exports[_0x3481('0x26')]=function(_0x4a20d5,_0x131363){var _0x4a8492={},_0xdcacba={},_0x1f079a={'count':0x0,'rows':[]};var _0x2864f1=_['map'](db[_0x3481('0x27')][_0x3481('0x28')],function(_0x2df894){return{'name':_0x2df894[_0x3481('0x29')],'type':_0x2df894[_0x3481('0x2a')]['key']};});_0xdcacba[_0x3481('0x2b')]=_[_0x3481('0x2c')](_0x2864f1,_0x3481('0x24'));_0xdcacba[_0x3481('0x2d')]=_['keys'](_0x4a20d5[_0x3481('0x2d')]);_0xdcacba[_0x3481('0x2e')]=_[_0x3481('0x2f')](_0xdcacba[_0x3481('0x2b')],_0xdcacba[_0x3481('0x2d')]);_0x4a8492[_0x3481('0x30')]=_[_0x3481('0x2f')](_0xdcacba[_0x3481('0x2b')],qs['fields'](_0x4a20d5[_0x3481('0x2d')][_0x3481('0x31')]));_0x4a8492[_0x3481('0x30')]=_0x4a8492['attributes'][_0x3481('0x32')]?_0x4a8492['attributes']:_0xdcacba[_0x3481('0x2b')];if(!_0x4a20d5['query'][_0x3481('0x33')]('nolimit')){_0x4a8492[_0x3481('0x1b')]=qs[_0x3481('0x1b')](_0x4a20d5[_0x3481('0x2d')]['limit']);_0x4a8492[_0x3481('0x1a')]=qs['offset'](_0x4a20d5[_0x3481('0x2d')]['offset']);}_0x4a8492[_0x3481('0x34')]=qs[_0x3481('0x35')](_0x4a20d5[_0x3481('0x2d')][_0x3481('0x35')]);_0x4a8492[_0x3481('0x36')]=qs[_0x3481('0x2e')](_[_0x3481('0x37')](_0x4a20d5[_0x3481('0x2d')],_0xdcacba[_0x3481('0x2e')]),_0x2864f1);if(_0x4a20d5['query'][_0x3481('0x38')]){_0x4a8492['where']=_[_0x3481('0x39')](_0x4a8492[_0x3481('0x36')],{'$or':_[_0x3481('0x2c')](_0x2864f1,function(_0x40fd6f){if(_0x40fd6f['type']!=='VIRTUAL'){var _0x2207fb={};_0x2207fb[_0x40fd6f[_0x3481('0x24')]]={'$like':'%'+_0x4a20d5[_0x3481('0x2d')][_0x3481('0x38')]+'%'};return _0x2207fb;}})});}_0x4a8492=_['merge']({},_0x4a8492,_0x4a20d5[_0x3481('0x3a')]);var _0x3c7874={'where':_0x4a8492[_0x3481('0x36')]};return db[_0x3481('0x27')][_0x3481('0x3b')](_0x3c7874)[_0x3481('0x1f')](function(_0x33c33f){_0x1f079a['count']=_0x33c33f;if(_0x4a20d5[_0x3481('0x2d')][_0x3481('0x3c')]){_0x4a8492[_0x3481('0x3d')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x4a8492);})[_0x3481('0x1f')](function(_0x420b8c){_0x1f079a[_0x3481('0x3e')]=_0x420b8c;return _0x1f079a;})['then'](respondWithFilteredResult(_0x131363,_0x4a8492))['catch'](handleError(_0x131363,null));};exports[_0x3481('0x3f')]=function(_0x335292,_0x3fc0e7){var _0xbccc9e={'raw':!![],'where':{'id':_0x335292[_0x3481('0x40')]['id']}},_0x5c4928={};_0x5c4928['model']=_[_0x3481('0x41')](db[_0x3481('0x27')][_0x3481('0x28')]);_0x5c4928[_0x3481('0x2d')]=_['keys'](_0x335292['query']);_0x5c4928['filters']=_['intersection'](_0x5c4928[_0x3481('0x2b')],_0x5c4928[_0x3481('0x2d')]);_0xbccc9e[_0x3481('0x30')]=_[_0x3481('0x2f')](_0x5c4928[_0x3481('0x2b')],qs[_0x3481('0x31')](_0x335292[_0x3481('0x2d')][_0x3481('0x31')]));_0xbccc9e[_0x3481('0x30')]=_0xbccc9e[_0x3481('0x30')][_0x3481('0x32')]?_0xbccc9e['attributes']:_0x5c4928['model'];if(_0x335292[_0x3481('0x2d')][_0x3481('0x3c')]){_0xbccc9e[_0x3481('0x3d')]=[{'all':!![]}];}_0xbccc9e=_[_0x3481('0x39')]({},_0xbccc9e,_0x335292['options']);return db[_0x3481('0x27')]['find'](_0xbccc9e)[_0x3481('0x1f')](handleEntityNotFound(_0x3fc0e7,null))[_0x3481('0x1f')](respondWithResult(_0x3fc0e7,null))[_0x3481('0x42')](handleError(_0x3fc0e7,null));};exports[_0x3481('0x43')]=function(_0x30f54e,_0x50dd72){return db[_0x3481('0x27')]['create'](_0x30f54e[_0x3481('0x44')],{})[_0x3481('0x1f')](respondWithResult(_0x50dd72,0xc9))['catch'](handleError(_0x50dd72,null));};exports[_0x3481('0x45')]=function(_0x54ec34,_0x27e106){if(_0x54ec34[_0x3481('0x44')]['id']){delete _0x54ec34[_0x3481('0x44')]['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0x54ec34[_0x3481('0x40')]['id']}})[_0x3481('0x1f')](handleEntityNotFound(_0x27e106,null))[_0x3481('0x1f')](saveUpdates(_0x54ec34[_0x3481('0x44')],null))['then'](respondWithResult(_0x27e106,null))[_0x3481('0x42')](handleError(_0x27e106,null));};exports[_0x3481('0x20')]=function(_0xdd5422,_0x4b7598){return db['JscriptyAnswerReport'][_0x3481('0x46')]({'where':{'id':_0xdd5422[_0x3481('0x40')]['id']}})['then'](handleEntityNotFound(_0x4b7598,null))[_0x3481('0x1f')](removeEntity(_0x4b7598,null))[_0x3481('0x42')](handleError(_0x4b7598,null));};exports[_0x3481('0x47')]=function(_0x222b83,_0x403ba9){return db['JscriptyAnswerReport'][_0x3481('0x47')]()[_0x3481('0x1f')](respondWithResult(_0x403ba9,null))[_0x3481('0x42')](handleError(_0x403ba9,null));}; \ No newline at end of file +var _0x3bd7=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','stack','name','send','index','map','rawAttributes','key','model','keys','filters','intersection','query','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','JscriptyAnswerReport','includeAll','include','findAll','rows','catch','show','params','create','update','body','find','describe','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','to-csv'];(function(_0x2d6806,_0x598d84){var _0x473f3d=function(_0x147a2a){while(--_0x147a2a){_0x2d6806['push'](_0x2d6806['shift']());}};_0x473f3d(++_0x598d84);}(_0x3bd7,0x199));var _0x73bd=function(_0x1073ad,_0x44bf0b){_0x1073ad=_0x1073ad-0x0;var _0x528474=_0x3bd7[_0x1073ad];return _0x528474;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x73bd('0x0'));var jsonpatch=require(_0x73bd('0x1'));var rp=require(_0x73bd('0x2'));var moment=require('moment');var BPromise=require(_0x73bd('0x3'));var Mustache=require(_0x73bd('0x4'));var util=require(_0x73bd('0x5'));var path=require('path');var sox=require(_0x73bd('0x6'));var csv=require('to-csv');var ejs=require(_0x73bd('0x7'));var fs=require('fs');var fs_extra=require(_0x73bd('0x8'));var _=require('lodash');var squel=require(_0x73bd('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x73bd('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x73bd('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x73bd('0xc'));var as=require(_0x73bd('0xd'));var hardwareService=require(_0x73bd('0xe'));var logger=require(_0x73bd('0xf'))(_0x73bd('0x10'));var utils=require(_0x73bd('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x73bd('0x12'));var db=require(_0x73bd('0x13'))['db'];function respondWithStatusCode(_0x31c882,_0x41f324){_0x41f324=_0x41f324||0xcc;return function(_0x2a5dea){if(_0x2a5dea){return _0x31c882[_0x73bd('0x14')](_0x41f324);}return _0x31c882['status'](_0x41f324)[_0x73bd('0x15')]();};}function respondWithResult(_0x5c4bc8,_0x189007){_0x189007=_0x189007||0xc8;return function(_0x3eab86){if(_0x3eab86){return _0x5c4bc8[_0x73bd('0x16')](_0x189007)[_0x73bd('0x17')](_0x3eab86);}};}function respondWithFilteredResult(_0x3e628a,_0x5ea8db){return function(_0x41663e){if(_0x41663e){var _0xfdf66=typeof _0x5ea8db[_0x73bd('0x18')]===_0x73bd('0x19')&&typeof _0x5ea8db[_0x73bd('0x1a')]===_0x73bd('0x19');var _0x10e371=_0x41663e[_0x73bd('0x1b')];var _0x21787b=_0xfdf66?0x0:_0x5ea8db['offset'];var _0x1e559b=_0xfdf66?_0x41663e[_0x73bd('0x1b')]:_0x5ea8db[_0x73bd('0x18')]+_0x5ea8db[_0x73bd('0x1a')];var _0x1cb0e3;if(_0x1e559b>=_0x10e371){_0x1e559b=_0x10e371;_0x1cb0e3=0xc8;}else{_0x1cb0e3=0xce;}_0x3e628a[_0x73bd('0x16')](_0x1cb0e3);return _0x3e628a[_0x73bd('0x1c')](_0x73bd('0x1d'),_0x21787b+'-'+_0x1e559b+'/'+_0x10e371)[_0x73bd('0x17')](_0x41663e);}return null;};}function patchUpdates(_0x57d1ec){return function(_0x459965){try{jsonpatch[_0x73bd('0x1e')](_0x459965,_0x57d1ec,!![]);}catch(_0x292f8c){return BPromise['reject'](_0x292f8c);}return _0x459965['save']();};}function saveUpdates(_0x4f23e6,_0x10b388){return function(_0x269e84){if(_0x269e84){return _0x269e84['update'](_0x4f23e6)[_0x73bd('0x1f')](function(_0x22574c){return _0x22574c;});}return null;};}function removeEntity(_0x5b7bbb,_0x325cc1){return function(_0x1e22c5){if(_0x1e22c5){return _0x1e22c5[_0x73bd('0x20')]()[_0x73bd('0x1f')](function(){_0x5b7bbb[_0x73bd('0x16')](0xcc)[_0x73bd('0x15')]();});}};}function handleEntityNotFound(_0x2dd70b,_0x36f7e0){return function(_0x840215){if(!_0x840215){_0x2dd70b[_0x73bd('0x14')](0x194);}return _0x840215;};}function handleError(_0x473527,_0x388698){_0x388698=_0x388698||0x1f4;return function(_0x52e910){logger['error'](_0x52e910[_0x73bd('0x21')]);if(_0x52e910[_0x73bd('0x22')]){delete _0x52e910['name'];}_0x473527[_0x73bd('0x16')](_0x388698)[_0x73bd('0x23')](_0x52e910);};}exports[_0x73bd('0x24')]=function(_0x5ada8d,_0x5ae04e){var _0x2f38fe={},_0x3f15f8={},_0x315318={'count':0x0,'rows':[]};var _0x5be8d6=_[_0x73bd('0x25')](db['JscriptyAnswerReport'][_0x73bd('0x26')],function(_0x2701da){return{'name':_0x2701da['fieldName'],'type':_0x2701da['type'][_0x73bd('0x27')]};});_0x3f15f8[_0x73bd('0x28')]=_[_0x73bd('0x25')](_0x5be8d6,_0x73bd('0x22'));_0x3f15f8['query']=_[_0x73bd('0x29')](_0x5ada8d['query']);_0x3f15f8[_0x73bd('0x2a')]=_[_0x73bd('0x2b')](_0x3f15f8[_0x73bd('0x28')],_0x3f15f8[_0x73bd('0x2c')]);_0x2f38fe['attributes']=_[_0x73bd('0x2b')](_0x3f15f8[_0x73bd('0x28')],qs[_0x73bd('0x2d')](_0x5ada8d[_0x73bd('0x2c')][_0x73bd('0x2d')]));_0x2f38fe[_0x73bd('0x2e')]=_0x2f38fe[_0x73bd('0x2e')][_0x73bd('0x2f')]?_0x2f38fe['attributes']:_0x3f15f8[_0x73bd('0x28')];if(!_0x5ada8d[_0x73bd('0x2c')]['hasOwnProperty'](_0x73bd('0x30'))){_0x2f38fe[_0x73bd('0x1a')]=qs['limit'](_0x5ada8d[_0x73bd('0x2c')]['limit']);_0x2f38fe[_0x73bd('0x18')]=qs['offset'](_0x5ada8d[_0x73bd('0x2c')][_0x73bd('0x18')]);}_0x2f38fe[_0x73bd('0x31')]=qs[_0x73bd('0x32')](_0x5ada8d[_0x73bd('0x2c')][_0x73bd('0x32')]);_0x2f38fe[_0x73bd('0x33')]=qs['filters'](_[_0x73bd('0x34')](_0x5ada8d[_0x73bd('0x2c')],_0x3f15f8['filters']),_0x5be8d6);if(_0x5ada8d[_0x73bd('0x2c')]['filter']){_0x2f38fe[_0x73bd('0x33')]=_[_0x73bd('0x35')](_0x2f38fe[_0x73bd('0x33')],{'$or':_[_0x73bd('0x25')](_0x5be8d6,function(_0x367597){if(_0x367597['type']!==_0x73bd('0x36')){var _0x2de851={};_0x2de851[_0x367597[_0x73bd('0x22')]]={'$like':'%'+_0x5ada8d['query'][_0x73bd('0x37')]+'%'};return _0x2de851;}})});}_0x2f38fe=_[_0x73bd('0x35')]({},_0x2f38fe,_0x5ada8d[_0x73bd('0x38')]);var _0x30e148={'where':_0x2f38fe[_0x73bd('0x33')]};return db[_0x73bd('0x39')][_0x73bd('0x1b')](_0x30e148)[_0x73bd('0x1f')](function(_0x519c3c){_0x315318[_0x73bd('0x1b')]=_0x519c3c;if(_0x5ada8d[_0x73bd('0x2c')][_0x73bd('0x3a')]){_0x2f38fe[_0x73bd('0x3b')]=[{'all':!![]}];}return db[_0x73bd('0x39')][_0x73bd('0x3c')](_0x2f38fe);})[_0x73bd('0x1f')](function(_0x48fed7){_0x315318[_0x73bd('0x3d')]=_0x48fed7;return _0x315318;})[_0x73bd('0x1f')](respondWithFilteredResult(_0x5ae04e,_0x2f38fe))[_0x73bd('0x3e')](handleError(_0x5ae04e,null));};exports[_0x73bd('0x3f')]=function(_0x532afd,_0x142532){var _0x234de7={'raw':!![],'where':{'id':_0x532afd[_0x73bd('0x40')]['id']}},_0xe91596={};_0xe91596[_0x73bd('0x28')]=_['keys'](db[_0x73bd('0x39')]['rawAttributes']);_0xe91596[_0x73bd('0x2c')]=_['keys'](_0x532afd[_0x73bd('0x2c')]);_0xe91596[_0x73bd('0x2a')]=_['intersection'](_0xe91596[_0x73bd('0x28')],_0xe91596[_0x73bd('0x2c')]);_0x234de7[_0x73bd('0x2e')]=_[_0x73bd('0x2b')](_0xe91596[_0x73bd('0x28')],qs['fields'](_0x532afd[_0x73bd('0x2c')][_0x73bd('0x2d')]));_0x234de7[_0x73bd('0x2e')]=_0x234de7[_0x73bd('0x2e')][_0x73bd('0x2f')]?_0x234de7[_0x73bd('0x2e')]:_0xe91596[_0x73bd('0x28')];if(_0x532afd[_0x73bd('0x2c')]['includeAll']){_0x234de7['include']=[{'all':!![]}];}_0x234de7=_[_0x73bd('0x35')]({},_0x234de7,_0x532afd[_0x73bd('0x38')]);return db[_0x73bd('0x39')]['find'](_0x234de7)[_0x73bd('0x1f')](handleEntityNotFound(_0x142532,null))['then'](respondWithResult(_0x142532,null))[_0x73bd('0x3e')](handleError(_0x142532,null));};exports[_0x73bd('0x41')]=function(_0x57df9e,_0x4905a4){return db['JscriptyAnswerReport'][_0x73bd('0x41')](_0x57df9e['body'],{})[_0x73bd('0x1f')](respondWithResult(_0x4905a4,0xc9))['catch'](handleError(_0x4905a4,null));};exports[_0x73bd('0x42')]=function(_0x1e2e28,_0x7b4baf){if(_0x1e2e28[_0x73bd('0x43')]['id']){delete _0x1e2e28['body']['id'];}return db[_0x73bd('0x39')][_0x73bd('0x44')]({'where':{'id':_0x1e2e28[_0x73bd('0x40')]['id']}})[_0x73bd('0x1f')](handleEntityNotFound(_0x7b4baf,null))[_0x73bd('0x1f')](saveUpdates(_0x1e2e28[_0x73bd('0x43')],null))[_0x73bd('0x1f')](respondWithResult(_0x7b4baf,null))[_0x73bd('0x3e')](handleError(_0x7b4baf,null));};exports['destroy']=function(_0x8b88f5,_0x47397d){return db['JscriptyAnswerReport'][_0x73bd('0x44')]({'where':{'id':_0x8b88f5[_0x73bd('0x40')]['id']}})[_0x73bd('0x1f')](handleEntityNotFound(_0x47397d,null))['then'](removeEntity(_0x47397d,null))[_0x73bd('0x3e')](handleError(_0x47397d,null));};exports[_0x73bd('0x45')]=function(_0x23b5ad,_0x2201c7){return db[_0x73bd('0x39')]['describe']()['then'](respondWithResult(_0x2201c7,null))['catch'](handleError(_0x2201c7,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 1c5b9da..b44cebe 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 _0x3b7d=['request-promise','path','rimraf','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','api','moment'];(function(_0x56d1b7,_0x1d88f5){var _0x184d91=function(_0x123bdb){while(--_0x123bdb){_0x56d1b7['push'](_0x56d1b7['shift']());}};_0x184d91(++_0x1d88f5);}(_0x3b7d,0x92));var _0xd3b7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3b7d[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xd3b7('0x0'));var util=require(_0xd3b7('0x1'));var logger=require('../../config/logger')(_0xd3b7('0x2'));var moment=require(_0xd3b7('0x3'));var BPromise=require('bluebird');var rp=require(_0xd3b7('0x4'));var fs=require('fs');var path=require(_0xd3b7('0x5'));var rimraf=require(_0xd3b7('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x4a92db,_0x56b10b){return _0x4a92db[_0xd3b7('0x7')](_0xd3b7('0x8'),attributes,{'tableName':_0xd3b7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e8d=['moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','api'];(function(_0x5e65d8,_0x31e7cc){var _0x373ee2=function(_0x34711b){while(--_0x34711b){_0x5e65d8['push'](_0x5e65d8['shift']());}};_0x373ee2(++_0x31e7cc);}(_0x0e8d,0xbd));var _0xd0e8=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x0e8d[_0x456fb1];return _0x4083d6;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd0e8('0x0'));var moment=require(_0xd0e8('0x1'));var BPromise=require(_0xd0e8('0x2'));var rp=require(_0xd0e8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd0e8('0x4'));var config=require(_0xd0e8('0x5'));var attributes=require(_0xd0e8('0x6'));module[_0xd0e8('0x7')]=function(_0x58fa8a,_0x3753f6){return _0x58fa8a[_0xd0e8('0x8')](_0xd0e8('0x9'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 6fdd4f9..1fc3277 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 _0x25f0=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message'];(function(_0x4911ed,_0x476941){var _0x230288=function(_0xcaa9c0){while(--_0xcaa9c0){_0x4911ed['push'](_0x4911ed['shift']());}};_0x230288(++_0x476941);}(_0x25f0,0xc8));var _0x025f=function(_0x1f7f0a,_0x3cd7fe){_0x1f7f0a=_0x1f7f0a-0x0;var _0x2dc727=_0x25f0[_0x1f7f0a];return _0x2dc727;};'use strict';var _=require(_0x025f('0x0'));var util=require(_0x025f('0x1'));var moment=require('moment');var BPromise=require(_0x025f('0x2'));var rs=require(_0x025f('0x3'));var fs=require('fs');var Redis=require(_0x025f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x025f('0x5'));var logger=require(_0x025f('0x6'))(_0x025f('0x7'));var config=require('../../config/environment');var jayson=require(_0x025f('0x8'));var client=jayson[_0x025f('0x9')][_0x025f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5dc0cb,_0x4d1a27,_0x41a3b3){return new BPromise(function(_0x65b2e2,_0x241e79){return client[_0x025f('0xb')](_0x5dc0cb,_0x41a3b3)[_0x025f('0xc')](function(_0x4046e1){logger[_0x025f('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4d1a27,_0x025f('0xe'));logger[_0x025f('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x4d1a27,_0x025f('0xe'),JSON['stringify'](_0x4046e1));if(_0x4046e1[_0x025f('0x10')]){if(_0x4046e1['error'][_0x025f('0x11')]===0x1f4){logger[_0x025f('0x10')](_0x025f('0x12'),_0x4d1a27,_0x4046e1[_0x025f('0x10')][_0x025f('0x13')]);return _0x241e79(_0x4046e1['error'][_0x025f('0x13')]);}logger[_0x025f('0x10')](_0x025f('0x12'),_0x4d1a27,_0x4046e1['error'][_0x025f('0x13')]);return _0x65b2e2(_0x4046e1[_0x025f('0x10')][_0x025f('0x13')]);}else{logger[_0x025f('0xd')](_0x025f('0x12'),_0x4d1a27,_0x025f('0xe'));_0x65b2e2(_0x4046e1[_0x025f('0x14')]['message']);}})[_0x025f('0x15')](function(_0x4ef2b1){logger[_0x025f('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4d1a27,_0x4ef2b1);_0x241e79(_0x4ef2b1);});});} \ No newline at end of file +var _0x5715=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','moment','bluebird','randomstring'];(function(_0xe97aab,_0x5d0f91){var _0x38ca16=function(_0xbf46b6){while(--_0xbf46b6){_0xe97aab['push'](_0xe97aab['shift']());}};_0x38ca16(++_0x5d0f91);}(_0x5715,0x15b));var _0x5571=function(_0x1df7b8,_0x2fe5e5){_0x1df7b8=_0x1df7b8-0x0;var _0x29d911=_0x5715[_0x1df7b8];return _0x29d911;};'use strict';var _=require(_0x5571('0x0'));var util=require(_0x5571('0x1'));var moment=require(_0x5571('0x2'));var BPromise=require(_0x5571('0x3'));var rs=require(_0x5571('0x4'));var fs=require('fs');var Redis=require(_0x5571('0x5'));var db=require(_0x5571('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5571('0x7'))(_0x5571('0x8'));var config=require(_0x5571('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5571('0xa')][_0x5571('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e0934,_0xf38679,_0x363b7a){return new BPromise(function(_0x5110ad,_0x3c5f09){return client[_0x5571('0xc')](_0x5e0934,_0x363b7a)[_0x5571('0xd')](function(_0x442866){logger[_0x5571('0xe')](_0x5571('0xf'),_0xf38679,_0x5571('0x10'));logger[_0x5571('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0xf38679,_0x5571('0x10'),JSON[_0x5571('0x12')](_0x442866));if(_0x442866[_0x5571('0x13')]){if(_0x442866[_0x5571('0x13')][_0x5571('0x14')]===0x1f4){logger[_0x5571('0x13')](_0x5571('0xf'),_0xf38679,_0x442866[_0x5571('0x13')][_0x5571('0x15')]);return _0x3c5f09(_0x442866[_0x5571('0x13')]['message']);}logger[_0x5571('0x13')](_0x5571('0xf'),_0xf38679,_0x442866['error']['message']);return _0x5110ad(_0x442866[_0x5571('0x13')][_0x5571('0x15')]);}else{logger['info'](_0x5571('0xf'),_0xf38679,_0x5571('0x10'));_0x5110ad(_0x442866['result']['message']);}})['catch'](function(_0x5320cb){logger[_0x5571('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xf38679,_0x5320cb);_0x3c5f09(_0x5320cb);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 75d98e4..6a672ba 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 _0x6fb9=['clone','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','getSessions','/:id/answers','getAnswers','/:id/summary','getSummary','post','create'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x6fb9,0x100));var _0x96fb=function(_0x4e4519,_0x392ae){_0x4e4519=_0x4e4519-0x0;var _0x340044=_0x6fb9[_0x4e4519];return _0x340044;};'use strict';var multer=require(_0x96fb('0x0'));var util=require(_0x96fb('0x1'));var path=require(_0x96fb('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x96fb('0x3')]();var fs_extra=require(_0x96fb('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x96fb('0x5'));var controller=require(_0x96fb('0x6'));router[_0x96fb('0x7')]('/',auth[_0x96fb('0x8')](),controller[_0x96fb('0x9')]);router[_0x96fb('0x7')](_0x96fb('0xa'),auth[_0x96fb('0x8')](),controller[_0x96fb('0xb')]);router[_0x96fb('0x7')]('/:id/sessions',auth['isAuthenticated'](),controller[_0x96fb('0xc')]);router['get'](_0x96fb('0xd'),auth[_0x96fb('0x8')](),controller[_0x96fb('0xe')]);router['get'](_0x96fb('0xf'),auth['isAuthenticated'](),timeout('30s'),controller[_0x96fb('0x10')]);router[_0x96fb('0x11')]('/',auth['isAuthenticated'](),controller[_0x96fb('0x12')]);router[_0x96fb('0x11')]('/:id/clone',auth['isAuthenticated'](),controller[_0x96fb('0x13')]);router[_0x96fb('0x14')](_0x96fb('0xa'),auth[_0x96fb('0x8')](),controller[_0x96fb('0x15')]);router[_0x96fb('0x16')](_0x96fb('0xa'),auth[_0x96fb('0x8')](),controller[_0x96fb('0x17')]);module[_0x96fb('0x18')]=router; \ No newline at end of file +var _0x3425=['/:id/summary','30s','getSummary','create','post','/:id/clone','clone','put','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers'];(function(_0x49488a,_0x1a5152){var _0x5de04e=function(_0x9af75f){while(--_0x9af75f){_0x49488a['push'](_0x49488a['shift']());}};_0x5de04e(++_0x1a5152);}(_0x3425,0x133));var _0x5342=function(_0x4501b9,_0x3dbfff){_0x4501b9=_0x4501b9-0x0;var _0x15dc34=_0x3425[_0x4501b9];return _0x15dc34;};'use strict';var multer=require(_0x5342('0x0'));var util=require(_0x5342('0x1'));var path=require('path');var timeout=require(_0x5342('0x2'));var express=require('express');var router=express[_0x5342('0x3')]();var fs_extra=require(_0x5342('0x4'));var auth=require(_0x5342('0x5'));var interaction=require(_0x5342('0x6'));var config=require(_0x5342('0x7'));var controller=require(_0x5342('0x8'));router[_0x5342('0x9')]('/',auth[_0x5342('0xa')](),controller['index']);router[_0x5342('0x9')](_0x5342('0xb'),auth['isAuthenticated'](),controller[_0x5342('0xc')]);router['get'](_0x5342('0xd'),auth[_0x5342('0xa')](),controller[_0x5342('0xe')]);router[_0x5342('0x9')](_0x5342('0xf'),auth[_0x5342('0xa')](),controller[_0x5342('0x10')]);router['get'](_0x5342('0x11'),auth[_0x5342('0xa')](),timeout(_0x5342('0x12')),controller[_0x5342('0x13')]);router['post']('/',auth[_0x5342('0xa')](),controller[_0x5342('0x14')]);router[_0x5342('0x15')](_0x5342('0x16'),auth[_0x5342('0xa')](),controller[_0x5342('0x17')]);router[_0x5342('0x18')](_0x5342('0xb'),auth[_0x5342('0xa')](),controller['update']);router[_0x5342('0x19')](_0x5342('0xb'),auth[_0x5342('0xa')](),controller['destroy']);module[_0x5342('0x1a')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index bf5fa1b..71d2372 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 _0xda45=['format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','STRING','name','TEXT','long','isObjectLike','setDataValue','stringify','isString','formData'];(function(_0x1ebd5f,_0x26d83d){var _0xefd5eb=function(_0x2a6b87){while(--_0x2a6b87){_0x1ebd5f['push'](_0x1ebd5f['shift']());}};_0xefd5eb(++_0x26d83d);}(_0xda45,0x6b));var _0x5da4=function(_0x16ed61,_0xb77b1e){_0x16ed61=_0x16ed61-0x0;var _0x1120e1=_0xda45[_0x16ed61];return _0x1120e1;};'use strict';var Sequelize=require(_0x5da4('0x0'));var _=require(_0x5da4('0x1'));var util=require(_0x5da4('0x2'));module['exports']={'name':{'type':Sequelize[_0x5da4('0x3')],'unique':_0x5da4('0x4')},'description':{'type':Sequelize[_0x5da4('0x3')]},'formData':{'type':Sequelize[_0x5da4('0x5')](_0x5da4('0x6')),'set':function(_0x289e66){if(_[_0x5da4('0x7')](_0x289e66)){this[_0x5da4('0x8')]('formData',JSON[_0x5da4('0x9')](_0x289e66));}else if(_[_0x5da4('0xa')](_0x289e66)){this[_0x5da4('0x8')](_0x5da4('0xb'),_0x289e66);}else{this['setDataValue'](_0x5da4('0xb'),util[_0x5da4('0xc')](_0x5da4('0xd'),this[_0x5da4('0xe')](_0x5da4('0x4'))||'',this['getDataValue'](_0x5da4('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x5da4('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x5da4('0x10')],'defaultValue':![]}}; \ No newline at end of file +var _0xb89e=['setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','sequelize','STRING','isObjectLike'];(function(_0x29cb61,_0x494484){var _0x21d3e0=function(_0x3e0ac4){while(--_0x3e0ac4){_0x29cb61['push'](_0x29cb61['shift']());}};_0x21d3e0(++_0x494484);}(_0xb89e,0x8c));var _0xeb89=function(_0x59b439,_0x14ae7b){_0x59b439=_0x59b439-0x0;var _0x521ea3=_0xb89e[_0x59b439];return _0x521ea3;};'use strict';var Sequelize=require(_0xeb89('0x0'));var _=require('lodash');var util=require('util');module['exports']={'name':{'type':Sequelize[_0xeb89('0x1')],'unique':'name'},'description':{'type':Sequelize[_0xeb89('0x1')]},'formData':{'type':Sequelize['TEXT']('long'),'set':function(_0x5dde14){if(_[_0xeb89('0x2')](_0x5dde14)){this[_0xeb89('0x3')](_0xeb89('0x4'),JSON[_0xeb89('0x5')](_0x5dde14));}else if(_[_0xeb89('0x6')](_0x5dde14)){this[_0xeb89('0x3')](_0xeb89('0x4'),_0x5dde14);}else{this[_0xeb89('0x3')]('formData',util[_0xeb89('0x7')](_0xeb89('0x8'),this[_0xeb89('0x9')](_0xeb89('0xa'))||'',this[_0xeb89('0x9')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 188096c..eeb7aa3 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 _0x3940=['include','find','create','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','body','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','getSessions','findOne','JscriptySessionReport','hasOwnProperty','ProjectId','rows','getAnswers','findAll','toString','indexOf','getSummary','starttime','parse','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Projects','error','stack','name','send','index','JscriptyProject','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','catch','show','params','keys','includeAll'];(function(_0x2053ea,_0x1ab2d4){var _0x2232c4=function(_0x4230df){while(--_0x4230df){_0x2053ea['push'](_0x2053ea['shift']());}};_0x2232c4(++_0x1ab2d4);}(_0x3940,0xa6));var _0x0394=function(_0x1c02fe,_0xcc2f73){_0x1c02fe=_0x1c02fe-0x0;var _0x35b578=_0x3940[_0x1c02fe];return _0x35b578;};'use strict';var emlformat=require(_0x0394('0x0'));var rimraf=require(_0x0394('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0394('0x2'));var rp=require('request-promise');var moment=require(_0x0394('0x3'));var BPromise=require(_0x0394('0x4'));var Mustache=require('mustache');var util=require(_0x0394('0x5'));var path=require('path');var sox=require(_0x0394('0x6'));var csv=require(_0x0394('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0394('0x8'));var _=require(_0x0394('0x9'));var squel=require('squel');var crypto=require(_0x0394('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0394('0xb'));var toCsv=require(_0x0394('0x7'));var querystring=require(_0x0394('0xc'));var Papa=require(_0x0394('0xd'));var Redis=require(_0x0394('0xe'));var authService=require(_0x0394('0xf'));var qs=require(_0x0394('0x10'));var as=require(_0x0394('0x11'));var hardwareService=require(_0x0394('0x12'));var logger=require(_0x0394('0x13'))('api');var utils=require(_0x0394('0x14'));var config=require(_0x0394('0x15'));var licenseUtil=require(_0x0394('0x16'));var db=require(_0x0394('0x17'))['db'];function respondWithStatusCode(_0x56fe9a,_0x10e241){_0x10e241=_0x10e241||0xcc;return function(_0x7c3d40){if(_0x7c3d40){return _0x56fe9a[_0x0394('0x18')](_0x10e241);}return _0x56fe9a['status'](_0x10e241)[_0x0394('0x19')]();};}function respondWithResult(_0x53cc66,_0x461257){_0x461257=_0x461257||0xc8;return function(_0x2ec0b5){if(_0x2ec0b5){return _0x53cc66[_0x0394('0x1a')](_0x461257)[_0x0394('0x1b')](_0x2ec0b5);}};}function respondWithFilteredResult(_0x401ed0,_0x283f98){return function(_0x2d3caf){if(_0x2d3caf){var _0x512fb1=typeof _0x283f98[_0x0394('0x1c')]===_0x0394('0x1d')&&typeof _0x283f98[_0x0394('0x1e')]===_0x0394('0x1d');var _0x3d28d1=_0x2d3caf[_0x0394('0x1f')];var _0x208aa3=_0x512fb1?0x0:_0x283f98['offset'];var _0x51c1b2=_0x512fb1?_0x2d3caf[_0x0394('0x1f')]:_0x283f98['offset']+_0x283f98[_0x0394('0x1e')];var _0x2b0342;if(_0x51c1b2>=_0x3d28d1){_0x51c1b2=_0x3d28d1;_0x2b0342=0xc8;}else{_0x2b0342=0xce;}_0x401ed0[_0x0394('0x1a')](_0x2b0342);return _0x401ed0[_0x0394('0x20')](_0x0394('0x21'),_0x208aa3+'-'+_0x51c1b2+'/'+_0x3d28d1)[_0x0394('0x1b')](_0x2d3caf);}return null;};}function patchUpdates(_0x5d805c){return function(_0x3039f3){try{jsonpatch[_0x0394('0x22')](_0x3039f3,_0x5d805c,!![]);}catch(_0xf9a971){return BPromise[_0x0394('0x23')](_0xf9a971);}return _0x3039f3[_0x0394('0x24')]();};}function saveUpdates(_0x3d8985,_0x798a55){return function(_0x5c8129){if(_0x5c8129){return _0x5c8129[_0x0394('0x25')](_0x3d8985)[_0x0394('0x26')](function(_0x39d784){return _0x39d784;});}return null;};}function removeEntity(_0xdfe68b,_0x5bb7c0){return function(_0x2a96fa){if(_0x2a96fa){return _0x2a96fa[_0x0394('0x27')]()[_0x0394('0x26')](function(){var _0x2f2a86=_0x2a96fa[_0x0394('0x28')]({'plain':!![]});var _0x48f574=_0x0394('0x29');return db['UserProfileResource'][_0x0394('0x27')]({'where':{'type':_0x48f574,'resourceId':_0x2f2a86['id']}})[_0x0394('0x26')](function(){return _0x2a96fa;});})[_0x0394('0x26')](function(){_0xdfe68b[_0x0394('0x1a')](0xcc)[_0x0394('0x19')]();});}};}function handleEntityNotFound(_0x3ecdde,_0x22dadc){return function(_0x46e329){if(!_0x46e329){_0x3ecdde[_0x0394('0x18')](0x194);}return _0x46e329;};}function handleError(_0x5dc568,_0x1d39d1){_0x1d39d1=_0x1d39d1||0x1f4;return function(_0x3bf593){logger[_0x0394('0x2a')](_0x3bf593[_0x0394('0x2b')]);if(_0x3bf593[_0x0394('0x2c')]){delete _0x3bf593[_0x0394('0x2c')];}_0x5dc568[_0x0394('0x1a')](_0x1d39d1)[_0x0394('0x2d')](_0x3bf593);};}exports[_0x0394('0x2e')]=function(_0x537fb8,_0x1060b0){var _0x284dfd={},_0x10a363={},_0x4c2df3={'count':0x0,'rows':[]};var _0x24e2e9=_['map'](db[_0x0394('0x2f')][_0x0394('0x30')],function(_0xdce1dc){return{'name':_0xdce1dc[_0x0394('0x31')],'type':_0xdce1dc[_0x0394('0x32')][_0x0394('0x33')]};});_0x10a363[_0x0394('0x34')]=_[_0x0394('0x35')](_0x24e2e9,_0x0394('0x2c'));_0x10a363[_0x0394('0x36')]=_['keys'](_0x537fb8[_0x0394('0x36')]);_0x10a363[_0x0394('0x37')]=_[_0x0394('0x38')](_0x10a363[_0x0394('0x34')],_0x10a363[_0x0394('0x36')]);_0x284dfd[_0x0394('0x39')]=_['intersection'](_0x10a363[_0x0394('0x34')],qs['fields'](_0x537fb8[_0x0394('0x36')][_0x0394('0x3a')]));_0x284dfd['attributes']=_0x284dfd[_0x0394('0x39')][_0x0394('0x3b')]?_0x284dfd[_0x0394('0x39')]:_0x10a363[_0x0394('0x34')];if(!_0x537fb8[_0x0394('0x36')]['hasOwnProperty'](_0x0394('0x3c'))){_0x284dfd['limit']=qs[_0x0394('0x1e')](_0x537fb8[_0x0394('0x36')][_0x0394('0x1e')]);_0x284dfd[_0x0394('0x1c')]=qs['offset'](_0x537fb8[_0x0394('0x36')][_0x0394('0x1c')]);}_0x284dfd[_0x0394('0x3d')]=qs[_0x0394('0x3e')](_0x537fb8[_0x0394('0x36')]['sort']);_0x284dfd[_0x0394('0x3f')]=qs[_0x0394('0x37')](_[_0x0394('0x40')](_0x537fb8[_0x0394('0x36')],_0x10a363[_0x0394('0x37')]),_0x24e2e9);if(_0x537fb8[_0x0394('0x36')][_0x0394('0x41')]){_0x284dfd[_0x0394('0x3f')]=_[_0x0394('0x42')](_0x284dfd[_0x0394('0x3f')],{'$or':_[_0x0394('0x35')](_0x24e2e9,function(_0xcce804){if(_0xcce804[_0x0394('0x32')]!==_0x0394('0x43')){var _0x4d2fa6={};_0x4d2fa6[_0xcce804[_0x0394('0x2c')]]={'$like':'%'+_0x537fb8[_0x0394('0x36')][_0x0394('0x41')]+'%'};return _0x4d2fa6;}})});}_0x284dfd=_[_0x0394('0x42')]({},_0x284dfd,_0x537fb8[_0x0394('0x44')]);var _0x46913b={'where':_0x284dfd[_0x0394('0x3f')]};return db[_0x0394('0x2f')][_0x0394('0x1f')](_0x46913b)[_0x0394('0x26')](function(_0x2d218f){_0x4c2df3[_0x0394('0x1f')]=_0x2d218f;if(_0x537fb8[_0x0394('0x36')]['includeAll']){_0x284dfd['include']=[{'all':!![]}];}return db[_0x0394('0x2f')]['findAll'](_0x284dfd);})['then'](function(_0x3e97bd){_0x4c2df3['rows']=_0x3e97bd;return _0x4c2df3;})[_0x0394('0x26')](respondWithFilteredResult(_0x1060b0,_0x284dfd))[_0x0394('0x45')](handleError(_0x1060b0,null));};exports[_0x0394('0x46')]=function(_0x30be71,_0x487593){var _0x14eb57={'raw':![],'where':{'id':_0x30be71[_0x0394('0x47')]['id']}},_0x39804a={};_0x39804a[_0x0394('0x34')]=_[_0x0394('0x48')](db[_0x0394('0x2f')][_0x0394('0x30')]);_0x39804a[_0x0394('0x36')]=_[_0x0394('0x48')](_0x30be71[_0x0394('0x36')]);_0x39804a['filters']=_[_0x0394('0x38')](_0x39804a[_0x0394('0x34')],_0x39804a[_0x0394('0x36')]);_0x14eb57[_0x0394('0x39')]=_['intersection'](_0x39804a[_0x0394('0x34')],qs['fields'](_0x30be71[_0x0394('0x36')][_0x0394('0x3a')]));_0x14eb57[_0x0394('0x39')]=_0x14eb57[_0x0394('0x39')]['length']?_0x14eb57[_0x0394('0x39')]:_0x39804a['model'];if(_0x30be71['query'][_0x0394('0x49')]){_0x14eb57[_0x0394('0x4a')]=[{'all':!![]}];}_0x14eb57=_['merge']({},_0x14eb57,_0x30be71[_0x0394('0x44')]);return db[_0x0394('0x2f')][_0x0394('0x4b')](_0x14eb57)[_0x0394('0x26')](handleEntityNotFound(_0x487593,null))['then'](respondWithResult(_0x487593,null))[_0x0394('0x45')](handleError(_0x487593,null));};exports['create']=function(_0x172c3c,_0x57a8ce){return db[_0x0394('0x2f')][_0x0394('0x4c')](_0x172c3c['body'],{})[_0x0394('0x26')](function(_0x44969b){var _0x134047=_0x172c3c[_0x0394('0x4d')][_0x0394('0x28')]({'plain':!![]});if(!_0x134047)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x134047['role']===_0x0394('0x4d')){var _0x1d3dd0=_0x44969b[_0x0394('0x28')]({'plain':!![]});var _0x204365=_0x0394('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x204365,'userProfileId':_0x134047[_0x0394('0x4e')]},'raw':!![]})[_0x0394('0x26')](function(_0x44c883){if(_0x44c883&&_0x44c883[_0x0394('0x4f')]===0x0){return db[_0x0394('0x50')]['create']({'name':_0x1d3dd0[_0x0394('0x2c')],'resourceId':_0x1d3dd0['id'],'type':_0x44c883[_0x0394('0x2c')],'sectionId':_0x44c883['id']},{})[_0x0394('0x26')](function(){return _0x44969b;});}else{return _0x44969b;}})[_0x0394('0x45')](function(_0x1664bc){logger['error'](_0x0394('0x51'),_0x1664bc);throw _0x1664bc;});}return _0x44969b;})[_0x0394('0x26')](respondWithResult(_0x57a8ce,0xc9))['catch'](handleError(_0x57a8ce,null));};exports[_0x0394('0x52')]=function(_0xa22f9a,_0x208875){var _0x360b2d={'where':{'id':_0xa22f9a[_0x0394('0x47')]['id']}},_0x202d41={};_0x202d41[_0x0394('0x34')]=_[_0x0394('0x48')](db['JscriptyProject']['rawAttributes']);_0x360b2d[_0x0394('0x39')]=_[_0x0394('0x38')](_0x202d41[_0x0394('0x34')],qs[_0x0394('0x3a')](_0xa22f9a[_0x0394('0x36')][_0x0394('0x3a')]));_0x360b2d[_0x0394('0x39')]=_0x360b2d[_0x0394('0x39')][_0x0394('0x3b')]?_0x360b2d[_0x0394('0x39')]:_0x202d41[_0x0394('0x34')];if(_0xa22f9a[_0x0394('0x36')]['includeAll']){_0x360b2d[_0x0394('0x4a')]=[{'all':!![]}];}_0x360b2d=_[_0x0394('0x42')]({},_0x360b2d,_0xa22f9a[_0x0394('0x44')]);return db[_0x0394('0x2f')][_0x0394('0x4b')](_0x360b2d)[_0x0394('0x26')](handleEntityNotFound(_0x208875,null))[_0x0394('0x26')](function(_0x31120d){if(_0x31120d){var _0x279dd7=_0x31120d[_0x0394('0x28')]({'plain':!![]});_0x279dd7=qs['omit'](_0x279dd7,['id',_0x0394('0x53'),_0x0394('0x54')]);_0xa22f9a[_0x0394('0x55')]=_[_0x0394('0x56')](_0xa22f9a['body'],['id',_0x0394('0x53'),'updatedAt']);return db[_0x0394('0x2f')]['create'](_[_0x0394('0x42')](_0x279dd7,_0xa22f9a[_0x0394('0x55')]),{'include':_0xa22f9a['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x48dc5e){var _0x350b7f=_0xa22f9a['user'][_0x0394('0x28')]({'plain':!![]});if(!_0x350b7f)throw new Error(_0x0394('0x57'));if(_0x350b7f['role']==='user'){var _0x43e131=_0x48dc5e[_0x0394('0x28')]({'plain':!![]});var _0x3c360b=_0x0394('0x29');return db[_0x0394('0x58')][_0x0394('0x4b')]({'where':{'name':_0x3c360b,'userProfileId':_0x350b7f[_0x0394('0x4e')]},'raw':!![]})['then'](function(_0x59fb62){if(_0x59fb62&&_0x59fb62['autoAssociation']===0x0){return db[_0x0394('0x50')]['create']({'name':_0x43e131[_0x0394('0x2c')],'resourceId':_0x43e131['id'],'type':_0x59fb62[_0x0394('0x2c')],'sectionId':_0x59fb62['id']},{})[_0x0394('0x26')](function(){return _0x48dc5e;});}else{return _0x48dc5e;}})[_0x0394('0x45')](function(_0x5cbcbe){logger[_0x0394('0x2a')](_0x0394('0x51'),_0x5cbcbe);throw _0x5cbcbe;});}return _0x48dc5e;});}})['then'](respondWithResult(_0x208875,0xc9))['catch'](handleError(_0x208875,null));};exports[_0x0394('0x25')]=function(_0x34154a,_0x3bce00){if(_0x34154a[_0x0394('0x55')]['id']){delete _0x34154a['body']['id'];}return db[_0x0394('0x2f')][_0x0394('0x4b')]({'where':{'id':_0x34154a['params']['id']}})[_0x0394('0x26')](handleEntityNotFound(_0x3bce00,null))[_0x0394('0x26')](saveUpdates(_0x34154a['body'],null))['then'](respondWithResult(_0x3bce00,null))['catch'](handleError(_0x3bce00,null));};exports[_0x0394('0x27')]=function(_0x8ad569,_0x4e062d){return db['JscriptyProject'][_0x0394('0x4b')]({'where':{'id':_0x8ad569['params']['id']}})['then'](handleEntityNotFound(_0x4e062d,null))['then'](removeEntity(_0x4e062d,null))[_0x0394('0x45')](handleError(_0x4e062d,null));};exports[_0x0394('0x59')]=function(_0x323742,_0x21bb4d,_0x42cb6a){var _0x2a7ea5={'raw':!![],'where':{}};var _0x4aa1d1={};var _0x2dba0d={'count':0x0,'rows':[]};return db[_0x0394('0x2f')][_0x0394('0x5a')]({'where':{'id':_0x323742[_0x0394('0x47')]['id']}})['then'](handleEntityNotFound(_0x21bb4d,null))[_0x0394('0x26')](function(_0x1140b0){if(_0x1140b0){_0x4aa1d1[_0x0394('0x34')]=_[_0x0394('0x48')](db[_0x0394('0x5b')][_0x0394('0x30')]);_0x4aa1d1[_0x0394('0x36')]=_[_0x0394('0x48')](_0x323742[_0x0394('0x36')]);_0x4aa1d1['filters']=_[_0x0394('0x38')](_0x4aa1d1[_0x0394('0x34')],_0x4aa1d1[_0x0394('0x36')]);_0x2a7ea5[_0x0394('0x39')]=_[_0x0394('0x38')](_0x4aa1d1[_0x0394('0x34')],qs[_0x0394('0x3a')](_0x323742[_0x0394('0x36')]['fields']));_0x2a7ea5[_0x0394('0x39')]=_0x2a7ea5[_0x0394('0x39')]['length']?_0x2a7ea5[_0x0394('0x39')]:_0x4aa1d1['model'];if(!_0x323742[_0x0394('0x36')][_0x0394('0x5c')](_0x0394('0x3c'))){_0x2a7ea5[_0x0394('0x1e')]=qs[_0x0394('0x1e')](_0x323742[_0x0394('0x36')][_0x0394('0x1e')]);_0x2a7ea5[_0x0394('0x1c')]=qs[_0x0394('0x1c')](_0x323742[_0x0394('0x36')][_0x0394('0x1c')]);}_0x2a7ea5[_0x0394('0x3d')]=qs[_0x0394('0x3e')](_0x323742[_0x0394('0x36')]['sort']);_0x2a7ea5[_0x0394('0x3f')]=qs[_0x0394('0x37')](_[_0x0394('0x40')](_0x323742['query'],_0x4aa1d1[_0x0394('0x37')]));_0x2a7ea5[_0x0394('0x3f')][_0x0394('0x5d')]=_0x1140b0['id'];if(_0x323742[_0x0394('0x36')][_0x0394('0x41')]){_0x2a7ea5[_0x0394('0x3f')]=_[_0x0394('0x42')](_0x2a7ea5['where'],{'$or':_[_0x0394('0x35')](_0x2a7ea5[_0x0394('0x39')],function(_0xb3513b){var _0x17e1d8={};_0x17e1d8[_0xb3513b]={'$like':'%'+_0x323742['query'][_0x0394('0x41')]+'%'};return _0x17e1d8;})});}_0x2a7ea5=_['merge']({},_0x2a7ea5,_0x323742[_0x0394('0x44')]);return db[_0x0394('0x5b')][_0x0394('0x1f')]({'where':_0x2a7ea5[_0x0394('0x3f')]})[_0x0394('0x26')](function(_0x43c4b9){_0x2dba0d['count']=_0x43c4b9;if(_0x323742[_0x0394('0x36')][_0x0394('0x49')]){_0x2a7ea5[_0x0394('0x4a')]=[{'all':!![]}];}return db[_0x0394('0x5b')]['findAll'](_0x2a7ea5);})[_0x0394('0x26')](function(_0x588abd){_0x2dba0d[_0x0394('0x5e')]=_0x588abd;return _0x2dba0d;});}})['then'](respondWithFilteredResult(_0x21bb4d,_0x2a7ea5))[_0x0394('0x45')](handleError(_0x21bb4d,null));};exports[_0x0394('0x5f')]=function(_0x57d148,_0x5e51dc,_0x446057){var _0x518662={'raw':!![],'where':{}};var _0x3f1cb6={};var _0x462b04={'count':0x0,'rows':[]};return db[_0x0394('0x2f')][_0x0394('0x5a')]({'where':{'id':_0x57d148['params']['id']}})['then'](handleEntityNotFound(_0x5e51dc,null))[_0x0394('0x26')](function(_0x82e170){if(_0x82e170){_0x3f1cb6['model']=_[_0x0394('0x48')](db['JscriptyAnswerReport'][_0x0394('0x30')]);_0x3f1cb6[_0x0394('0x36')]=_[_0x0394('0x48')](_0x57d148[_0x0394('0x36')]);_0x3f1cb6['filters']=_[_0x0394('0x38')](_0x3f1cb6[_0x0394('0x34')],_0x3f1cb6[_0x0394('0x36')]);_0x518662[_0x0394('0x39')]=_[_0x0394('0x38')](_0x3f1cb6[_0x0394('0x34')],qs[_0x0394('0x3a')](_0x57d148['query'][_0x0394('0x3a')]));_0x518662[_0x0394('0x39')]=_0x518662['attributes'][_0x0394('0x3b')]?_0x518662[_0x0394('0x39')]:_0x3f1cb6[_0x0394('0x34')];if(!_0x57d148['query']['hasOwnProperty'](_0x0394('0x3c'))){_0x518662[_0x0394('0x1e')]=qs[_0x0394('0x1e')](_0x57d148[_0x0394('0x36')][_0x0394('0x1e')]);_0x518662[_0x0394('0x1c')]=qs[_0x0394('0x1c')](_0x57d148[_0x0394('0x36')][_0x0394('0x1c')]);}_0x518662[_0x0394('0x3d')]=qs[_0x0394('0x3e')](_0x57d148[_0x0394('0x36')]['sort']);_0x518662[_0x0394('0x3f')]=qs[_0x0394('0x37')](_[_0x0394('0x40')](_0x57d148['query'],_0x3f1cb6['filters']));_0x518662[_0x0394('0x3f')][_0x0394('0x5d')]=_0x82e170['id'];if(_0x57d148['query'][_0x0394('0x41')]){_0x518662['where']=_[_0x0394('0x42')](_0x518662[_0x0394('0x3f')],{'$or':_[_0x0394('0x35')](_0x518662['attributes'],function(_0x9ebfa1){var _0x3f73c3={};_0x3f73c3[_0x9ebfa1]={'$like':'%'+_0x57d148[_0x0394('0x36')]['filter']+'%'};return _0x3f73c3;})});}_0x518662=_['merge']({},_0x518662,_0x57d148['options']);return db['JscriptyAnswerReport'][_0x0394('0x1f')]({'where':_0x518662[_0x0394('0x3f')]})[_0x0394('0x26')](function(_0x463658){_0x462b04[_0x0394('0x1f')]=_0x463658;if(_0x57d148[_0x0394('0x36')][_0x0394('0x49')]){_0x518662[_0x0394('0x4a')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x0394('0x60')](_0x518662);})[_0x0394('0x26')](function(_0x29bdee){_0x462b04[_0x0394('0x5e')]=_0x29bdee;return _0x462b04;});}})[_0x0394('0x26')](respondWithFilteredResult(_0x5e51dc,_0x518662))['catch'](handleError(_0x5e51dc,null));};function char(_0x550ce1){return'number'===typeof _0x550ce1?String['fromCharCode']['apply'](null,arguments):_0x550ce1;}function needsEncapsulation(_0x306fec){return!!_0x306fec&&(_0x306fec['toString']()['indexOf'](char(0xd))>=0x0||_0x306fec[_0x0394('0x61')]()[_0x0394('0x62')](char(0xa))>=0x0||_0x306fec[_0x0394('0x61')]()['indexOf'](char(0x2c))>=0x0||_0x306fec[_0x0394('0x61')]()[_0x0394('0x62')](char(0x22))>=0x0);}function encapsulate(_0x38f46f){var _0x575528=char(0x22),_0x2eb0a5='\x5c'+char(0x22),_0x30810e=_0x38f46f['toString']()['replace'](new RegExp(_0x575528,'g'),_0x2eb0a5);return _0x575528+_0x30810e+_0x575528;}exports[_0x0394('0x63')]=function(_0x51a22b,_0x4d9a37,_0x1296a2){var _0x171215,_0x570c2c;var _0x493703={'where':{'ProjectId':_0x51a22b[_0x0394('0x47')]['id']}};if(_0x51a22b['query']['startTime']){_0x493703[_0x0394('0x3f')][_0x0394('0x64')]=JSON[_0x0394('0x65')](_0x51a22b[_0x0394('0x36')][_0x0394('0x66')]);}return db[_0x0394('0x5b')]['findAll'](_0x493703)[_0x0394('0x26')](handleEntityNotFound(_0x4d9a37,null))[_0x0394('0x26')](function(_0xdc0ab2){if(_0xdc0ab2){_0x171215=_0xdc0ab2;return db[_0x0394('0x67')][_0x0394('0x60')]({'where':{'SessionId':{'$in':_['map'](_0x171215,'id')},'ProjectId':_0x51a22b[_0x0394('0x47')]['id']},'order':_0x0394('0x68')});}})[_0x0394('0x26')](handleEntityNotFound(_0x4d9a37,null))['then'](function(_0x120213){if(_0x120213){_0x570c2c=_0x120213;var _0x48dd85={};for(var _0x2726ec=0x0,_0x310161=_0x570c2c[_0x0394('0x3b')];_0x2726ec<_0x310161;_0x2726ec++){if(!_0x48dd85[_0x0394('0x5c')](_0x570c2c[_0x2726ec]['questionId'])){_0x48dd85[_0x570c2c[_0x2726ec][_0x0394('0x69')]]=needsEncapsulation(_0x570c2c[_0x2726ec]['question'])?encapsulate(_0x570c2c[_0x2726ec]['question']):_0x570c2c[_0x2726ec][_0x0394('0x6a')];}}var _0x13c180=[],_0x5b53dc={};for(var _0x432868=0x0,_0x48443f=_0x171215['length'];_0x432868<_0x48443f;_0x432868++){_0x5b53dc={'ProjectId':_0x51a22b['params']['id'],'SessionId':_0x171215[_0x432868]['id'],'StartTime':moment(_0x171215[_0x432868][_0x0394('0x64')])[_0x0394('0x6b')](_0x0394('0x6c'))};for(var _0x21cec4=0x0,_0x188562=_0x570c2c['length'];_0x21cec4<_0x188562;_0x21cec4++){if(_0x570c2c[_0x21cec4]['SessionId']==_0x171215[_0x432868]['id']&&_0x48dd85[_0x0394('0x5c')](_0x570c2c[_0x21cec4][_0x0394('0x69')])){_0x5b53dc[_0x48dd85[_0x570c2c[_0x21cec4][_0x0394('0x69')]]]=_0x570c2c[_0x21cec4][_0x0394('0x6d')];}}for(var _0x36c44e in _0x48dd85){if(!_0x5b53dc['hasOwnProperty'](_0x48dd85[_0x36c44e])){_0x5b53dc[_0x48dd85[_0x36c44e]]=null;}}_0x13c180['push'](_0x5b53dc);}return _0x13c180;}})[_0x0394('0x26')](function(_0x3a2fc4){if(!_[_0x0394('0x6e')](_0x3a2fc4)){var _0x13eec8=toCsv(_0x3a2fc4);var _0x50bdf7=Date[_0x0394('0x6f')]();fs[_0x0394('0x70')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x51a22b[_0x0394('0x47')]['id'],_0x50bdf7),_0x13eec8);_0x4d9a37[_0x0394('0x71')](_0x0394('0x72'),_0x0394('0x73')+util[_0x0394('0x6b')](_0x0394('0x74'),_0x51a22b[_0x0394('0x47')]['id'],_0x50bdf7));_0x4d9a37[_0x0394('0x71')](_0x0394('0x75'),'text/csv');return _0x4d9a37[_0x0394('0x76')](util[_0x0394('0x6b')](_0x0394('0x77'),_0x51a22b['params']['id'],_0x50bdf7));}else{return _0x4d9a37[_0x0394('0x18')](0xcc);}})[_0x0394('0x45')](handleError(_0x4d9a37,null));}; \ No newline at end of file +var _0xdb94=['where','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','findOne','pick','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','findAll','number','fromCharCode','toString','indexOf','startTime','parse','JscriptyQuestionReport','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','name','send','index','map','JscriptyProject','rawAttributes','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x50e0b4,_0x1057f7){var _0x2fa8b0=function(_0x3766bc){while(--_0x3766bc){_0x50e0b4['push'](_0x50e0b4['shift']());}};_0x2fa8b0(++_0x1057f7);}(_0xdb94,0xab));var _0x4db9=function(_0x4fcd39,_0x2037f3){_0x4fcd39=_0x4fcd39-0x0;var _0x3c5722=_0xdb94[_0x4fcd39];return _0x3c5722;};'use strict';var emlformat=require(_0x4db9('0x0'));var rimraf=require(_0x4db9('0x1'));var zipdir=require(_0x4db9('0x2'));var jsonpatch=require(_0x4db9('0x3'));var rp=require(_0x4db9('0x4'));var moment=require('moment');var BPromise=require(_0x4db9('0x5'));var Mustache=require(_0x4db9('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4db9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4db9('0x8'));var _=require('lodash');var squel=require(_0x4db9('0x9'));var crypto=require('crypto');var jsforce=require(_0x4db9('0xa'));var deskjs=require(_0x4db9('0xb'));var toCsv=require(_0x4db9('0xc'));var querystring=require(_0x4db9('0xd'));var Papa=require(_0x4db9('0xe'));var Redis=require(_0x4db9('0xf'));var authService=require(_0x4db9('0x10'));var qs=require(_0x4db9('0x11'));var as=require(_0x4db9('0x12'));var hardwareService=require(_0x4db9('0x13'));var logger=require(_0x4db9('0x14'))('api');var utils=require(_0x4db9('0x15'));var config=require(_0x4db9('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31222b,_0x5e644c){_0x5e644c=_0x5e644c||0xcc;return function(_0x571685){if(_0x571685){return _0x31222b[_0x4db9('0x17')](_0x5e644c);}return _0x31222b[_0x4db9('0x18')](_0x5e644c)['end']();};}function respondWithResult(_0xd37d63,_0x1f9638){_0x1f9638=_0x1f9638||0xc8;return function(_0x452896){if(_0x452896){return _0xd37d63[_0x4db9('0x18')](_0x1f9638)['json'](_0x452896);}};}function respondWithFilteredResult(_0x5e04ab,_0x102274){return function(_0x34de1a){if(_0x34de1a){var _0x4a037f=typeof _0x102274[_0x4db9('0x19')]===_0x4db9('0x1a')&&typeof _0x102274['limit']==='undefined';var _0x250a80=_0x34de1a[_0x4db9('0x1b')];var _0x462af3=_0x4a037f?0x0:_0x102274[_0x4db9('0x19')];var _0x1d3c33=_0x4a037f?_0x34de1a['count']:_0x102274[_0x4db9('0x19')]+_0x102274[_0x4db9('0x1c')];var _0x11012e;if(_0x1d3c33>=_0x250a80){_0x1d3c33=_0x250a80;_0x11012e=0xc8;}else{_0x11012e=0xce;}_0x5e04ab['status'](_0x11012e);return _0x5e04ab[_0x4db9('0x1d')](_0x4db9('0x1e'),_0x462af3+'-'+_0x1d3c33+'/'+_0x250a80)[_0x4db9('0x1f')](_0x34de1a);}return null;};}function patchUpdates(_0x4c92e8){return function(_0x46b522){try{jsonpatch[_0x4db9('0x20')](_0x46b522,_0x4c92e8,!![]);}catch(_0x4553c2){return BPromise[_0x4db9('0x21')](_0x4553c2);}return _0x46b522[_0x4db9('0x22')]();};}function saveUpdates(_0x159d9b,_0x3585d5){return function(_0x5aef3b){if(_0x5aef3b){return _0x5aef3b[_0x4db9('0x23')](_0x159d9b)[_0x4db9('0x24')](function(_0xcde40c){return _0xcde40c;});}return null;};}function removeEntity(_0x319475,_0x4aaa84){return function(_0x213daa){if(_0x213daa){return _0x213daa[_0x4db9('0x25')]()['then'](function(){var _0x2e97ab=_0x213daa[_0x4db9('0x26')]({'plain':!![]});var _0x2987c6='Projects';return db[_0x4db9('0x27')][_0x4db9('0x25')]({'where':{'type':_0x2987c6,'resourceId':_0x2e97ab['id']}})[_0x4db9('0x24')](function(){return _0x213daa;});})[_0x4db9('0x24')](function(){_0x319475[_0x4db9('0x18')](0xcc)[_0x4db9('0x28')]();});}};}function handleEntityNotFound(_0x385400,_0x2a56b8){return function(_0x3d0f12){if(!_0x3d0f12){_0x385400[_0x4db9('0x17')](0x194);}return _0x3d0f12;};}function handleError(_0x2fae0a,_0x355284){_0x355284=_0x355284||0x1f4;return function(_0x2d646d){logger[_0x4db9('0x29')](_0x2d646d['stack']);if(_0x2d646d['name']){delete _0x2d646d[_0x4db9('0x2a')];}_0x2fae0a[_0x4db9('0x18')](_0x355284)[_0x4db9('0x2b')](_0x2d646d);};}exports[_0x4db9('0x2c')]=function(_0x2af884,_0x459131){var _0x4dc946={},_0x375834={},_0x554eef={'count':0x0,'rows':[]};var _0x3b6a64=_[_0x4db9('0x2d')](db[_0x4db9('0x2e')][_0x4db9('0x2f')],function(_0x27d48c){return{'name':_0x27d48c['fieldName'],'type':_0x27d48c['type'][_0x4db9('0x30')]};});_0x375834['model']=_[_0x4db9('0x2d')](_0x3b6a64,_0x4db9('0x2a'));_0x375834['query']=_[_0x4db9('0x31')](_0x2af884[_0x4db9('0x32')]);_0x375834[_0x4db9('0x33')]=_['intersection'](_0x375834[_0x4db9('0x34')],_0x375834['query']);_0x4dc946[_0x4db9('0x35')]=_[_0x4db9('0x36')](_0x375834[_0x4db9('0x34')],qs['fields'](_0x2af884['query'][_0x4db9('0x37')]));_0x4dc946[_0x4db9('0x35')]=_0x4dc946[_0x4db9('0x35')][_0x4db9('0x38')]?_0x4dc946[_0x4db9('0x35')]:_0x375834[_0x4db9('0x34')];if(!_0x2af884[_0x4db9('0x32')][_0x4db9('0x39')](_0x4db9('0x3a'))){_0x4dc946['limit']=qs[_0x4db9('0x1c')](_0x2af884[_0x4db9('0x32')][_0x4db9('0x1c')]);_0x4dc946[_0x4db9('0x19')]=qs['offset'](_0x2af884[_0x4db9('0x32')][_0x4db9('0x19')]);}_0x4dc946[_0x4db9('0x3b')]=qs['sort'](_0x2af884[_0x4db9('0x32')][_0x4db9('0x3c')]);_0x4dc946[_0x4db9('0x3d')]=qs[_0x4db9('0x33')](_['pick'](_0x2af884['query'],_0x375834[_0x4db9('0x33')]),_0x3b6a64);if(_0x2af884[_0x4db9('0x32')][_0x4db9('0x3e')]){_0x4dc946[_0x4db9('0x3d')]=_[_0x4db9('0x3f')](_0x4dc946['where'],{'$or':_[_0x4db9('0x2d')](_0x3b6a64,function(_0x43b0d9){if(_0x43b0d9[_0x4db9('0x40')]!==_0x4db9('0x41')){var _0x2b2555={};_0x2b2555[_0x43b0d9['name']]={'$like':'%'+_0x2af884[_0x4db9('0x32')][_0x4db9('0x3e')]+'%'};return _0x2b2555;}})});}_0x4dc946=_[_0x4db9('0x3f')]({},_0x4dc946,_0x2af884['options']);var _0x37358f={'where':_0x4dc946[_0x4db9('0x3d')]};return db[_0x4db9('0x2e')][_0x4db9('0x1b')](_0x37358f)[_0x4db9('0x24')](function(_0x24aa2a){_0x554eef[_0x4db9('0x1b')]=_0x24aa2a;if(_0x2af884[_0x4db9('0x32')][_0x4db9('0x42')]){_0x4dc946[_0x4db9('0x43')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x4dc946);})['then'](function(_0x22a021){_0x554eef[_0x4db9('0x44')]=_0x22a021;return _0x554eef;})['then'](respondWithFilteredResult(_0x459131,_0x4dc946))[_0x4db9('0x45')](handleError(_0x459131,null));};exports[_0x4db9('0x46')]=function(_0x563416,_0x57a519){var _0x2eee28={'raw':![],'where':{'id':_0x563416[_0x4db9('0x47')]['id']}},_0x4f6c51={};_0x4f6c51[_0x4db9('0x34')]=_['keys'](db[_0x4db9('0x2e')][_0x4db9('0x2f')]);_0x4f6c51['query']=_[_0x4db9('0x31')](_0x563416[_0x4db9('0x32')]);_0x4f6c51[_0x4db9('0x33')]=_['intersection'](_0x4f6c51['model'],_0x4f6c51[_0x4db9('0x32')]);_0x2eee28[_0x4db9('0x35')]=_[_0x4db9('0x36')](_0x4f6c51[_0x4db9('0x34')],qs[_0x4db9('0x37')](_0x563416[_0x4db9('0x32')][_0x4db9('0x37')]));_0x2eee28[_0x4db9('0x35')]=_0x2eee28[_0x4db9('0x35')][_0x4db9('0x38')]?_0x2eee28[_0x4db9('0x35')]:_0x4f6c51[_0x4db9('0x34')];if(_0x563416[_0x4db9('0x32')]['includeAll']){_0x2eee28[_0x4db9('0x43')]=[{'all':!![]}];}_0x2eee28=_[_0x4db9('0x3f')]({},_0x2eee28,_0x563416[_0x4db9('0x48')]);return db[_0x4db9('0x2e')][_0x4db9('0x49')](_0x2eee28)[_0x4db9('0x24')](handleEntityNotFound(_0x57a519,null))[_0x4db9('0x24')](respondWithResult(_0x57a519,null))[_0x4db9('0x45')](handleError(_0x57a519,null));};exports[_0x4db9('0x4a')]=function(_0x2d6094,_0x10dccb){return db['JscriptyProject']['create'](_0x2d6094[_0x4db9('0x4b')],{})[_0x4db9('0x24')](function(_0x34b366){var _0x3e5131=_0x2d6094[_0x4db9('0x4c')][_0x4db9('0x26')]({'plain':!![]});if(!_0x3e5131)throw new Error(_0x4db9('0x4d'));if(_0x3e5131[_0x4db9('0x4e')]==='user'){var _0xd8eae3=_0x34b366[_0x4db9('0x26')]({'plain':!![]});var _0x121225=_0x4db9('0x4f');return db[_0x4db9('0x50')][_0x4db9('0x49')]({'where':{'name':_0x121225,'userProfileId':_0x3e5131[_0x4db9('0x51')]},'raw':!![]})[_0x4db9('0x24')](function(_0x479808){if(_0x479808&&_0x479808[_0x4db9('0x52')]===0x0){return db[_0x4db9('0x27')][_0x4db9('0x4a')]({'name':_0xd8eae3[_0x4db9('0x2a')],'resourceId':_0xd8eae3['id'],'type':_0x479808[_0x4db9('0x2a')],'sectionId':_0x479808['id']},{})[_0x4db9('0x24')](function(){return _0x34b366;});}else{return _0x34b366;}})['catch'](function(_0x188663){logger['error'](_0x4db9('0x53'),_0x188663);throw _0x188663;});}return _0x34b366;})['then'](respondWithResult(_0x10dccb,0xc9))['catch'](handleError(_0x10dccb,null));};exports[_0x4db9('0x54')]=function(_0x5996f2,_0x4643a1){var _0x219707={'where':{'id':_0x5996f2[_0x4db9('0x47')]['id']}},_0xef2f63={};_0xef2f63['model']=_[_0x4db9('0x31')](db['JscriptyProject'][_0x4db9('0x2f')]);_0x219707[_0x4db9('0x35')]=_['intersection'](_0xef2f63[_0x4db9('0x34')],qs['fields'](_0x5996f2[_0x4db9('0x32')][_0x4db9('0x37')]));_0x219707[_0x4db9('0x35')]=_0x219707[_0x4db9('0x35')][_0x4db9('0x38')]?_0x219707[_0x4db9('0x35')]:_0xef2f63[_0x4db9('0x34')];if(_0x5996f2[_0x4db9('0x32')][_0x4db9('0x42')]){_0x219707[_0x4db9('0x43')]=[{'all':!![]}];}_0x219707=_[_0x4db9('0x3f')]({},_0x219707,_0x5996f2[_0x4db9('0x48')]);return db[_0x4db9('0x2e')][_0x4db9('0x49')](_0x219707)[_0x4db9('0x24')](handleEntityNotFound(_0x4643a1,null))['then'](function(_0x225382){if(_0x225382){var _0x3ad16f=_0x225382['get']({'plain':!![]});_0x3ad16f=qs[_0x4db9('0x55')](_0x3ad16f,['id',_0x4db9('0x56'),_0x4db9('0x57')]);_0x5996f2[_0x4db9('0x4b')]=_[_0x4db9('0x55')](_0x5996f2[_0x4db9('0x4b')],['id',_0x4db9('0x56'),_0x4db9('0x57')]);return db[_0x4db9('0x2e')]['create'](_['merge'](_0x3ad16f,_0x5996f2[_0x4db9('0x4b')]),{'include':_0x5996f2[_0x4db9('0x32')][_0x4db9('0x42')]?[{'all':!![]}]:undefined})[_0x4db9('0x24')](function(_0x35e822){var _0x211c0a=_0x5996f2[_0x4db9('0x4c')][_0x4db9('0x26')]({'plain':!![]});if(!_0x211c0a)throw new Error(_0x4db9('0x4d'));if(_0x211c0a[_0x4db9('0x4e')]==='user'){var _0x2208bc=_0x35e822['get']({'plain':!![]});var _0x5bafe4='Projects';return db['UserProfileSection'][_0x4db9('0x49')]({'where':{'name':_0x5bafe4,'userProfileId':_0x211c0a['userProfileId']},'raw':!![]})['then'](function(_0x7aea3a){if(_0x7aea3a&&_0x7aea3a[_0x4db9('0x52')]===0x0){return db[_0x4db9('0x27')][_0x4db9('0x4a')]({'name':_0x2208bc[_0x4db9('0x2a')],'resourceId':_0x2208bc['id'],'type':_0x7aea3a[_0x4db9('0x2a')],'sectionId':_0x7aea3a['id']},{})[_0x4db9('0x24')](function(){return _0x35e822;});}else{return _0x35e822;}})[_0x4db9('0x45')](function(_0x2941ff){logger[_0x4db9('0x29')](_0x4db9('0x53'),_0x2941ff);throw _0x2941ff;});}return _0x35e822;});}})[_0x4db9('0x24')](respondWithResult(_0x4643a1,0xc9))[_0x4db9('0x45')](handleError(_0x4643a1,null));};exports[_0x4db9('0x23')]=function(_0xd84c6c,_0x37f6e3){if(_0xd84c6c['body']['id']){delete _0xd84c6c['body']['id'];}return db['JscriptyProject'][_0x4db9('0x49')]({'where':{'id':_0xd84c6c['params']['id']}})[_0x4db9('0x24')](handleEntityNotFound(_0x37f6e3,null))[_0x4db9('0x24')](saveUpdates(_0xd84c6c[_0x4db9('0x4b')],null))['then'](respondWithResult(_0x37f6e3,null))['catch'](handleError(_0x37f6e3,null));};exports[_0x4db9('0x25')]=function(_0x564bcc,_0x2f3746){return db[_0x4db9('0x2e')][_0x4db9('0x49')]({'where':{'id':_0x564bcc[_0x4db9('0x47')]['id']}})[_0x4db9('0x24')](handleEntityNotFound(_0x2f3746,null))['then'](removeEntity(_0x2f3746,null))[_0x4db9('0x45')](handleError(_0x2f3746,null));};exports['getSessions']=function(_0x2abc4d,_0x284591,_0xe8ce09){var _0x3a45d2={'raw':!![],'where':{}};var _0x12c1b5={};var _0x543d35={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x4db9('0x58')]({'where':{'id':_0x2abc4d[_0x4db9('0x47')]['id']}})['then'](handleEntityNotFound(_0x284591,null))['then'](function(_0x3a96d7){if(_0x3a96d7){_0x12c1b5['model']=_[_0x4db9('0x31')](db['JscriptySessionReport'][_0x4db9('0x2f')]);_0x12c1b5[_0x4db9('0x32')]=_['keys'](_0x2abc4d['query']);_0x12c1b5[_0x4db9('0x33')]=_[_0x4db9('0x36')](_0x12c1b5[_0x4db9('0x34')],_0x12c1b5[_0x4db9('0x32')]);_0x3a45d2[_0x4db9('0x35')]=_['intersection'](_0x12c1b5['model'],qs['fields'](_0x2abc4d['query'][_0x4db9('0x37')]));_0x3a45d2[_0x4db9('0x35')]=_0x3a45d2[_0x4db9('0x35')][_0x4db9('0x38')]?_0x3a45d2['attributes']:_0x12c1b5[_0x4db9('0x34')];if(!_0x2abc4d['query'][_0x4db9('0x39')](_0x4db9('0x3a'))){_0x3a45d2[_0x4db9('0x1c')]=qs[_0x4db9('0x1c')](_0x2abc4d[_0x4db9('0x32')][_0x4db9('0x1c')]);_0x3a45d2[_0x4db9('0x19')]=qs['offset'](_0x2abc4d[_0x4db9('0x32')][_0x4db9('0x19')]);}_0x3a45d2[_0x4db9('0x3b')]=qs['sort'](_0x2abc4d[_0x4db9('0x32')][_0x4db9('0x3c')]);_0x3a45d2['where']=qs['filters'](_[_0x4db9('0x59')](_0x2abc4d['query'],_0x12c1b5['filters']));_0x3a45d2[_0x4db9('0x3d')][_0x4db9('0x5a')]=_0x3a96d7['id'];if(_0x2abc4d[_0x4db9('0x32')]['filter']){_0x3a45d2['where']=_['merge'](_0x3a45d2['where'],{'$or':_['map'](_0x3a45d2[_0x4db9('0x35')],function(_0x3f4cb6){var _0x1d9657={};_0x1d9657[_0x3f4cb6]={'$like':'%'+_0x2abc4d[_0x4db9('0x32')][_0x4db9('0x3e')]+'%'};return _0x1d9657;})});}_0x3a45d2=_[_0x4db9('0x3f')]({},_0x3a45d2,_0x2abc4d[_0x4db9('0x48')]);return db[_0x4db9('0x5b')]['count']({'where':_0x3a45d2[_0x4db9('0x3d')]})[_0x4db9('0x24')](function(_0x3b4839){_0x543d35[_0x4db9('0x1b')]=_0x3b4839;if(_0x2abc4d[_0x4db9('0x32')][_0x4db9('0x42')]){_0x3a45d2[_0x4db9('0x43')]=[{'all':!![]}];}return db[_0x4db9('0x5b')]['findAll'](_0x3a45d2);})[_0x4db9('0x24')](function(_0x4a7e8b){_0x543d35[_0x4db9('0x44')]=_0x4a7e8b;return _0x543d35;});}})[_0x4db9('0x24')](respondWithFilteredResult(_0x284591,_0x3a45d2))[_0x4db9('0x45')](handleError(_0x284591,null));};exports[_0x4db9('0x5c')]=function(_0x4edbf6,_0x588f93,_0x315b1e){var _0x5912c9={'raw':!![],'where':{}};var _0x450ee1={};var _0x18939d={'count':0x0,'rows':[]};return db[_0x4db9('0x2e')][_0x4db9('0x58')]({'where':{'id':_0x4edbf6[_0x4db9('0x47')]['id']}})[_0x4db9('0x24')](handleEntityNotFound(_0x588f93,null))[_0x4db9('0x24')](function(_0xdd8823){if(_0xdd8823){_0x450ee1['model']=_[_0x4db9('0x31')](db[_0x4db9('0x5d')][_0x4db9('0x2f')]);_0x450ee1[_0x4db9('0x32')]=_['keys'](_0x4edbf6[_0x4db9('0x32')]);_0x450ee1[_0x4db9('0x33')]=_['intersection'](_0x450ee1[_0x4db9('0x34')],_0x450ee1[_0x4db9('0x32')]);_0x5912c9[_0x4db9('0x35')]=_['intersection'](_0x450ee1['model'],qs[_0x4db9('0x37')](_0x4edbf6[_0x4db9('0x32')]['fields']));_0x5912c9['attributes']=_0x5912c9[_0x4db9('0x35')][_0x4db9('0x38')]?_0x5912c9[_0x4db9('0x35')]:_0x450ee1[_0x4db9('0x34')];if(!_0x4edbf6[_0x4db9('0x32')][_0x4db9('0x39')](_0x4db9('0x3a'))){_0x5912c9[_0x4db9('0x1c')]=qs[_0x4db9('0x1c')](_0x4edbf6[_0x4db9('0x32')][_0x4db9('0x1c')]);_0x5912c9[_0x4db9('0x19')]=qs[_0x4db9('0x19')](_0x4edbf6[_0x4db9('0x32')][_0x4db9('0x19')]);}_0x5912c9['order']=qs[_0x4db9('0x3c')](_0x4edbf6['query'][_0x4db9('0x3c')]);_0x5912c9['where']=qs[_0x4db9('0x33')](_[_0x4db9('0x59')](_0x4edbf6[_0x4db9('0x32')],_0x450ee1[_0x4db9('0x33')]));_0x5912c9[_0x4db9('0x3d')][_0x4db9('0x5a')]=_0xdd8823['id'];if(_0x4edbf6[_0x4db9('0x32')][_0x4db9('0x3e')]){_0x5912c9[_0x4db9('0x3d')]=_[_0x4db9('0x3f')](_0x5912c9[_0x4db9('0x3d')],{'$or':_[_0x4db9('0x2d')](_0x5912c9['attributes'],function(_0xa7541a){var _0x15250b={};_0x15250b[_0xa7541a]={'$like':'%'+_0x4edbf6['query'][_0x4db9('0x3e')]+'%'};return _0x15250b;})});}_0x5912c9=_[_0x4db9('0x3f')]({},_0x5912c9,_0x4edbf6[_0x4db9('0x48')]);return db[_0x4db9('0x5d')]['count']({'where':_0x5912c9['where']})[_0x4db9('0x24')](function(_0x5f1307){_0x18939d[_0x4db9('0x1b')]=_0x5f1307;if(_0x4edbf6[_0x4db9('0x32')][_0x4db9('0x42')]){_0x5912c9[_0x4db9('0x43')]=[{'all':!![]}];}return db[_0x4db9('0x5d')][_0x4db9('0x5e')](_0x5912c9);})['then'](function(_0xe17e8e){_0x18939d[_0x4db9('0x44')]=_0xe17e8e;return _0x18939d;});}})[_0x4db9('0x24')](respondWithFilteredResult(_0x588f93,_0x5912c9))[_0x4db9('0x45')](handleError(_0x588f93,null));};function char(_0x1617b5){return _0x4db9('0x5f')===typeof _0x1617b5?String[_0x4db9('0x60')]['apply'](null,arguments):_0x1617b5;}function needsEncapsulation(_0x336a7c){return!!_0x336a7c&&(_0x336a7c[_0x4db9('0x61')]()[_0x4db9('0x62')](char(0xd))>=0x0||_0x336a7c[_0x4db9('0x61')]()['indexOf'](char(0xa))>=0x0||_0x336a7c['toString']()['indexOf'](char(0x2c))>=0x0||_0x336a7c[_0x4db9('0x61')]()[_0x4db9('0x62')](char(0x22))>=0x0);}function encapsulate(_0x281e84){var _0x50b622=char(0x22),_0x4ba50c='\x5c'+char(0x22),_0x10e3c9=_0x281e84[_0x4db9('0x61')]()['replace'](new RegExp(_0x50b622,'g'),_0x4ba50c);return _0x50b622+_0x10e3c9+_0x50b622;}exports['getSummary']=function(_0x30876e,_0x187df4,_0x48a88b){var _0x54ff64,_0x10d414;var _0x509637={'where':{'ProjectId':_0x30876e['params']['id']}};if(_0x30876e[_0x4db9('0x32')][_0x4db9('0x63')]){_0x509637[_0x4db9('0x3d')]['starttime']=JSON[_0x4db9('0x64')](_0x30876e['query'][_0x4db9('0x63')]);}return db['JscriptySessionReport'][_0x4db9('0x5e')](_0x509637)[_0x4db9('0x24')](handleEntityNotFound(_0x187df4,null))[_0x4db9('0x24')](function(_0x18cdd9){if(_0x18cdd9){_0x54ff64=_0x18cdd9;return db[_0x4db9('0x65')][_0x4db9('0x5e')]({'where':{'SessionId':{'$in':_[_0x4db9('0x2d')](_0x54ff64,'id')},'ProjectId':_0x30876e['params']['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x187df4,null))['then'](function(_0x1de02e){if(_0x1de02e){_0x10d414=_0x1de02e;var _0x47a48e={};for(var _0x1f5e81=0x0,_0x47b91e=_0x10d414['length'];_0x1f5e81<_0x47b91e;_0x1f5e81++){if(!_0x47a48e[_0x4db9('0x39')](_0x10d414[_0x1f5e81]['questionId'])){_0x47a48e[_0x10d414[_0x1f5e81][_0x4db9('0x66')]]=needsEncapsulation(_0x10d414[_0x1f5e81][_0x4db9('0x67')])?encapsulate(_0x10d414[_0x1f5e81][_0x4db9('0x67')]):_0x10d414[_0x1f5e81][_0x4db9('0x67')];}}var _0x2af043=[],_0x333566={};for(var _0x179e48=0x0,_0x23fd10=_0x54ff64[_0x4db9('0x38')];_0x179e48<_0x23fd10;_0x179e48++){_0x333566={'ProjectId':_0x30876e[_0x4db9('0x47')]['id'],'SessionId':_0x54ff64[_0x179e48]['id'],'StartTime':moment(_0x54ff64[_0x179e48][_0x4db9('0x68')])[_0x4db9('0x69')](_0x4db9('0x6a'))};for(var _0x2f19a6=0x0,_0x2f1200=_0x10d414['length'];_0x2f19a6<_0x2f1200;_0x2f19a6++){if(_0x10d414[_0x2f19a6][_0x4db9('0x6b')]==_0x54ff64[_0x179e48]['id']&&_0x47a48e[_0x4db9('0x39')](_0x10d414[_0x2f19a6][_0x4db9('0x66')])){_0x333566[_0x47a48e[_0x10d414[_0x2f19a6][_0x4db9('0x66')]]]=_0x10d414[_0x2f19a6][_0x4db9('0x6c')];}}for(var _0x293fb2 in _0x47a48e){if(!_0x333566[_0x4db9('0x39')](_0x47a48e[_0x293fb2])){_0x333566[_0x47a48e[_0x293fb2]]=null;}}_0x2af043['push'](_0x333566);}return _0x2af043;}})[_0x4db9('0x24')](function(_0x14cc77){if(!_['isEmpty'](_0x14cc77)){var _0x27a6df=toCsv(_0x14cc77);var _0x11602a=Date[_0x4db9('0x6d')]();fs['writeFileSync'](util['format'](_0x4db9('0x6e'),_0x30876e[_0x4db9('0x47')]['id'],_0x11602a),_0x27a6df);_0x187df4[_0x4db9('0x6f')](_0x4db9('0x70'),'attachment;\x20filename='+util[_0x4db9('0x69')](_0x4db9('0x71'),_0x30876e[_0x4db9('0x47')]['id'],_0x11602a));_0x187df4[_0x4db9('0x6f')](_0x4db9('0x72'),'text/csv');return _0x187df4[_0x4db9('0x73')](util[_0x4db9('0x69')](_0x4db9('0x6e'),_0x30876e['params']['id'],_0x11602a));}else{return _0x187df4[_0x4db9('0x17')](0xcc);}})['catch'](handleError(_0x187df4,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index f89515d..10e48e4 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 _0x29d4=['moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','lodash','../../config/logger','api'];(function(_0x3d19ab,_0x22831a){var _0x14db41=function(_0x5021cf){while(--_0x5021cf){_0x3d19ab['push'](_0x3d19ab['shift']());}};_0x14db41(++_0x22831a);}(_0x29d4,0x1a1));var _0x429d=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x29d4[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x429d('0x0'));var util=require('util');var logger=require(_0x429d('0x1'))(_0x429d('0x2'));var moment=require(_0x429d('0x3'));var BPromise=require(_0x429d('0x4'));var rp=require(_0x429d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x429d('0x6'));var config=require(_0x429d('0x7'));var attributes=require(_0x429d('0x8'));module[_0x429d('0x9')]=function(_0x1c55aa,_0xa71445){return _0x1c55aa[_0x429d('0xa')](_0x429d('0xb'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe314=['path','rimraf','../../config/environment','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3d0c20,_0x41e456){var _0x125600=function(_0x57b58e){while(--_0x57b58e){_0x3d0c20['push'](_0x3d0c20['shift']());}};_0x125600(++_0x41e456);}(_0xe314,0x7c));var _0x4e31=function(_0x37fb8e,_0x89aa78){_0x37fb8e=_0x37fb8e-0x0;var _0xbb9d43=_0xe314[_0x37fb8e];return _0xbb9d43;};'use strict';var _=require('lodash');var util=require(_0x4e31('0x0'));var logger=require(_0x4e31('0x1'))(_0x4e31('0x2'));var moment=require(_0x4e31('0x3'));var BPromise=require(_0x4e31('0x4'));var rp=require(_0x4e31('0x5'));var fs=require('fs');var path=require(_0x4e31('0x6'));var rimraf=require(_0x4e31('0x7'));var config=require(_0x4e31('0x8'));var attributes=require(_0x4e31('0x9'));module['exports']=function(_0x49b2a7,_0x3c5e06){return _0x49b2a7[_0x4e31('0xa')](_0x4e31('0xb'),attributes,{'tableName':_0x4e31('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 99bb0cd..0ce980c 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyProject,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x5481a9,_0x59fe7d){var _0x1d8fe6=function(_0x3278a0){while(--_0x3278a0){_0x5481a9['push'](_0x5481a9['shift']());}};_0x1d8fe6(++_0x59fe7d);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3d5019,_0x29a32b){_0x3d5019=_0x3d5019-0x0;var _0x5670a6=_0xb43b[_0x3d5019];return _0x5670a6;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file +var _0x0713=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1cca25,_0x2ca1bd){var _0x133d6e=function(_0x1f70a6){while(--_0x1f70a6){_0x1cca25['push'](_0x1cca25['shift']());}};_0x133d6e(++_0x2ca1bd);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 7c436d6..97b1af0 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 _0x660e=['describe','/:id','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe'];(function(_0x3271c7,_0x52d9c3){var _0x36e21e=function(_0x34337d){while(--_0x34337d){_0x3271c7['push'](_0x3271c7['shift']());}};_0x36e21e(++_0x52d9c3);}(_0x660e,0xa9));var _0xe660=function(_0x49920d,_0x2a06da){_0x49920d=_0x49920d-0x0;var _0x543df5=_0x660e[_0x49920d];return _0x543df5;};'use strict';var multer=require(_0xe660('0x0'));var util=require(_0xe660('0x1'));var path=require(_0xe660('0x2'));var timeout=require(_0xe660('0x3'));var express=require(_0xe660('0x4'));var router=express[_0xe660('0x5')]();var fs_extra=require(_0xe660('0x6'));var auth=require(_0xe660('0x7'));var interaction=require(_0xe660('0x8'));var config=require(_0xe660('0x9'));var controller=require(_0xe660('0xa'));router[_0xe660('0xb')]('/',auth[_0xe660('0xc')](),controller[_0xe660('0xd')]);router[_0xe660('0xb')](_0xe660('0xe'),auth['isAuthenticated'](),controller[_0xe660('0xf')]);router[_0xe660('0xb')](_0xe660('0x10'),auth[_0xe660('0xc')](),controller[_0xe660('0x11')]);router[_0xe660('0x12')]('/',auth[_0xe660('0xc')](),controller[_0xe660('0x13')]);router[_0xe660('0x14')](_0xe660('0x10'),auth[_0xe660('0xc')](),controller['update']);router[_0xe660('0x15')]('/:id',auth[_0xe660('0xc')](),controller[_0xe660('0x16')]);module['exports']=router; \ No newline at end of file +var _0xaf4a=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','index','get','/describe','/:id','create','put','update','destroy'];(function(_0x4154c1,_0x58277d){var _0x5c6a89=function(_0x3616da){while(--_0x3616da){_0x4154c1['push'](_0x4154c1['shift']());}};_0x5c6a89(++_0x58277d);}(_0xaf4a,0x18f));var _0xaaf4=function(_0x1ddef3,_0x381fb6){_0x1ddef3=_0x1ddef3-0x0;var _0x4c9970=_0xaf4a[_0x1ddef3];return _0x4c9970;};'use strict';var multer=require(_0xaaf4('0x0'));var util=require(_0xaaf4('0x1'));var path=require(_0xaaf4('0x2'));var timeout=require(_0xaaf4('0x3'));var express=require(_0xaaf4('0x4'));var router=express[_0xaaf4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xaaf4('0x6'));var interaction=require(_0xaaf4('0x7'));var config=require(_0xaaf4('0x8'));var controller=require(_0xaaf4('0x9'));router['get']('/',auth[_0xaaf4('0xa')](),controller[_0xaaf4('0xb')]);router[_0xaaf4('0xc')](_0xaaf4('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0xaaf4('0xc')](_0xaaf4('0xe'),auth[_0xaaf4('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xaaf4('0xf')]);router[_0xaaf4('0x10')](_0xaaf4('0xe'),auth[_0xaaf4('0xa')](),controller[_0xaaf4('0x11')]);router['delete'](_0xaaf4('0xe'),auth[_0xaaf4('0xa')](),controller[_0xaaf4('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 874b33b..caf5dea 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(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x7a54,0x106));var _0x47a5=function(_0x584074,_0x54f08a){_0x584074=_0x584074-0x0;var _0x35e325=_0x7a54[_0x584074];return _0x35e325;};'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(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x7a54,0x106));var _0x47a5=function(_0x1f2bf8,_0xbef253){_0x1f2bf8=_0x1f2bf8-0x0;var _0xc8d50b=_0x7a54[_0x1f2bf8];return _0xc8d50b;};'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 d999529..50c44d8 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 _0x0558=['catch','show','params','find','create','body','describe','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','JscriptyQuestionReport','includeAll','include','findAll'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0x0558,0x18d));var _0x8055=function(_0x52d231,_0x37bc71){_0x52d231=_0x52d231-0x0;var _0x550ac5=_0x0558[_0x52d231];return _0x550ac5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8055('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8055('0x1'));var moment=require('moment');var BPromise=require(_0x8055('0x2'));var Mustache=require(_0x8055('0x3'));var util=require(_0x8055('0x4'));var path=require(_0x8055('0x5'));var sox=require(_0x8055('0x6'));var csv=require(_0x8055('0x7'));var ejs=require(_0x8055('0x8'));var fs=require('fs');var fs_extra=require(_0x8055('0x9'));var _=require('lodash');var squel=require(_0x8055('0xa'));var crypto=require(_0x8055('0xb'));var jsforce=require(_0x8055('0xc'));var deskjs=require(_0x8055('0xd'));var toCsv=require(_0x8055('0x7'));var querystring=require(_0x8055('0xe'));var Papa=require(_0x8055('0xf'));var Redis=require('ioredis');var authService=require(_0x8055('0x10'));var qs=require(_0x8055('0x11'));var as=require(_0x8055('0x12'));var hardwareService=require(_0x8055('0x13'));var logger=require(_0x8055('0x14'))(_0x8055('0x15'));var utils=require(_0x8055('0x16'));var config=require(_0x8055('0x17'));var licenseUtil=require(_0x8055('0x18'));var db=require(_0x8055('0x19'))['db'];function respondWithStatusCode(_0x5f3f21,_0x44a801){_0x44a801=_0x44a801||0xcc;return function(_0x3f687b){if(_0x3f687b){return _0x5f3f21[_0x8055('0x1a')](_0x44a801);}return _0x5f3f21[_0x8055('0x1b')](_0x44a801)[_0x8055('0x1c')]();};}function respondWithResult(_0x3447fa,_0x4a53ef){_0x4a53ef=_0x4a53ef||0xc8;return function(_0x38369a){if(_0x38369a){return _0x3447fa['status'](_0x4a53ef)['json'](_0x38369a);}};}function respondWithFilteredResult(_0x5760fb,_0x5e51f5){return function(_0xc87bd3){if(_0xc87bd3){var _0x3eda58=typeof _0x5e51f5['offset']===_0x8055('0x1d')&&typeof _0x5e51f5[_0x8055('0x1e')]===_0x8055('0x1d');var _0x2acb9e=_0xc87bd3[_0x8055('0x1f')];var _0x5edacf=_0x3eda58?0x0:_0x5e51f5[_0x8055('0x20')];var _0x1eb235=_0x3eda58?_0xc87bd3[_0x8055('0x1f')]:_0x5e51f5[_0x8055('0x20')]+_0x5e51f5[_0x8055('0x1e')];var _0x518195;if(_0x1eb235>=_0x2acb9e){_0x1eb235=_0x2acb9e;_0x518195=0xc8;}else{_0x518195=0xce;}_0x5760fb[_0x8055('0x1b')](_0x518195);return _0x5760fb[_0x8055('0x21')]('Content-Range',_0x5edacf+'-'+_0x1eb235+'/'+_0x2acb9e)[_0x8055('0x22')](_0xc87bd3);}return null;};}function patchUpdates(_0x1a8b74){return function(_0x304e04){try{jsonpatch[_0x8055('0x23')](_0x304e04,_0x1a8b74,!![]);}catch(_0x1bc4f1){return BPromise[_0x8055('0x24')](_0x1bc4f1);}return _0x304e04[_0x8055('0x25')]();};}function saveUpdates(_0x9b3e08,_0x50d8db){return function(_0x2ae6f9){if(_0x2ae6f9){return _0x2ae6f9[_0x8055('0x26')](_0x9b3e08)[_0x8055('0x27')](function(_0x1df6b4){return _0x1df6b4;});}return null;};}function removeEntity(_0x4995d4,_0x3b5db1){return function(_0x4170c9){if(_0x4170c9){return _0x4170c9[_0x8055('0x28')]()[_0x8055('0x27')](function(){_0x4995d4[_0x8055('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33ffe1,_0x205397){return function(_0x44b2c5){if(!_0x44b2c5){_0x33ffe1[_0x8055('0x1a')](0x194);}return _0x44b2c5;};}function handleError(_0x431c79,_0x31d248){_0x31d248=_0x31d248||0x1f4;return function(_0x2cb163){logger[_0x8055('0x29')](_0x2cb163[_0x8055('0x2a')]);if(_0x2cb163[_0x8055('0x2b')]){delete _0x2cb163['name'];}_0x431c79[_0x8055('0x1b')](_0x31d248)[_0x8055('0x2c')](_0x2cb163);};}exports[_0x8055('0x2d')]=function(_0x3d48e5,_0x41e639){var _0x246a0d={},_0x1aad6b={},_0x387398={'count':0x0,'rows':[]};var _0x58b418=_[_0x8055('0x2e')](db['JscriptyQuestionReport'][_0x8055('0x2f')],function(_0x19950c){return{'name':_0x19950c['fieldName'],'type':_0x19950c[_0x8055('0x30')][_0x8055('0x31')]};});_0x1aad6b[_0x8055('0x32')]=_['map'](_0x58b418,_0x8055('0x2b'));_0x1aad6b[_0x8055('0x33')]=_[_0x8055('0x34')](_0x3d48e5['query']);_0x1aad6b['filters']=_[_0x8055('0x35')](_0x1aad6b[_0x8055('0x32')],_0x1aad6b[_0x8055('0x33')]);_0x246a0d[_0x8055('0x36')]=_[_0x8055('0x35')](_0x1aad6b[_0x8055('0x32')],qs[_0x8055('0x37')](_0x3d48e5[_0x8055('0x33')][_0x8055('0x37')]));_0x246a0d[_0x8055('0x36')]=_0x246a0d[_0x8055('0x36')][_0x8055('0x38')]?_0x246a0d['attributes']:_0x1aad6b[_0x8055('0x32')];if(!_0x3d48e5[_0x8055('0x33')][_0x8055('0x39')](_0x8055('0x3a'))){_0x246a0d['limit']=qs[_0x8055('0x1e')](_0x3d48e5[_0x8055('0x33')]['limit']);_0x246a0d['offset']=qs[_0x8055('0x20')](_0x3d48e5[_0x8055('0x33')][_0x8055('0x20')]);}_0x246a0d['order']=qs[_0x8055('0x3b')](_0x3d48e5[_0x8055('0x33')]['sort']);_0x246a0d[_0x8055('0x3c')]=qs[_0x8055('0x3d')](_[_0x8055('0x3e')](_0x3d48e5[_0x8055('0x33')],_0x1aad6b['filters']),_0x58b418);if(_0x3d48e5[_0x8055('0x33')][_0x8055('0x3f')]){_0x246a0d[_0x8055('0x3c')]=_[_0x8055('0x40')](_0x246a0d['where'],{'$or':_[_0x8055('0x2e')](_0x58b418,function(_0x183ad5){if(_0x183ad5['type']!==_0x8055('0x41')){var _0x160be8={};_0x160be8[_0x183ad5[_0x8055('0x2b')]]={'$like':'%'+_0x3d48e5[_0x8055('0x33')][_0x8055('0x3f')]+'%'};return _0x160be8;}})});}_0x246a0d=_[_0x8055('0x40')]({},_0x246a0d,_0x3d48e5[_0x8055('0x42')]);var _0x4467bd={'where':_0x246a0d[_0x8055('0x3c')]};return db[_0x8055('0x43')][_0x8055('0x1f')](_0x4467bd)['then'](function(_0x23b9e8){_0x387398[_0x8055('0x1f')]=_0x23b9e8;if(_0x3d48e5[_0x8055('0x33')][_0x8055('0x44')]){_0x246a0d[_0x8055('0x45')]=[{'all':!![]}];}return db[_0x8055('0x43')][_0x8055('0x46')](_0x246a0d);})['then'](function(_0x351726){_0x387398['rows']=_0x351726;return _0x387398;})['then'](respondWithFilteredResult(_0x41e639,_0x246a0d))[_0x8055('0x47')](handleError(_0x41e639,null));};exports[_0x8055('0x48')]=function(_0x8d28b1,_0x335f57){var _0x25397a={'raw':!![],'where':{'id':_0x8d28b1[_0x8055('0x49')]['id']}},_0x562326={};_0x562326[_0x8055('0x32')]=_[_0x8055('0x34')](db[_0x8055('0x43')][_0x8055('0x2f')]);_0x562326['query']=_[_0x8055('0x34')](_0x8d28b1[_0x8055('0x33')]);_0x562326[_0x8055('0x3d')]=_['intersection'](_0x562326[_0x8055('0x32')],_0x562326[_0x8055('0x33')]);_0x25397a['attributes']=_['intersection'](_0x562326[_0x8055('0x32')],qs['fields'](_0x8d28b1[_0x8055('0x33')][_0x8055('0x37')]));_0x25397a[_0x8055('0x36')]=_0x25397a['attributes'][_0x8055('0x38')]?_0x25397a[_0x8055('0x36')]:_0x562326[_0x8055('0x32')];if(_0x8d28b1[_0x8055('0x33')][_0x8055('0x44')]){_0x25397a[_0x8055('0x45')]=[{'all':!![]}];}_0x25397a=_[_0x8055('0x40')]({},_0x25397a,_0x8d28b1['options']);return db[_0x8055('0x43')][_0x8055('0x4a')](_0x25397a)[_0x8055('0x27')](handleEntityNotFound(_0x335f57,null))[_0x8055('0x27')](respondWithResult(_0x335f57,null))[_0x8055('0x47')](handleError(_0x335f57,null));};exports[_0x8055('0x4b')]=function(_0x59f86b,_0x1e7385){return db['JscriptyQuestionReport'][_0x8055('0x4b')](_0x59f86b[_0x8055('0x4c')],{})['then'](respondWithResult(_0x1e7385,0xc9))[_0x8055('0x47')](handleError(_0x1e7385,null));};exports[_0x8055('0x26')]=function(_0x4a15a1,_0x237147){if(_0x4a15a1[_0x8055('0x4c')]['id']){delete _0x4a15a1[_0x8055('0x4c')]['id'];}return db[_0x8055('0x43')][_0x8055('0x4a')]({'where':{'id':_0x4a15a1[_0x8055('0x49')]['id']}})['then'](handleEntityNotFound(_0x237147,null))['then'](saveUpdates(_0x4a15a1[_0x8055('0x4c')],null))[_0x8055('0x27')](respondWithResult(_0x237147,null))[_0x8055('0x47')](handleError(_0x237147,null));};exports[_0x8055('0x28')]=function(_0x3cb125,_0xdaf7e0){return db[_0x8055('0x43')][_0x8055('0x4a')]({'where':{'id':_0x3cb125[_0x8055('0x49')]['id']}})[_0x8055('0x27')](handleEntityNotFound(_0xdaf7e0,null))[_0x8055('0x27')](removeEntity(_0xdaf7e0,null))[_0x8055('0x47')](handleError(_0xdaf7e0,null));};exports[_0x8055('0x4d')]=function(_0x597841,_0x11ef9f){return db[_0x8055('0x43')][_0x8055('0x4d')]()[_0x8055('0x27')](respondWithResult(_0x11ef9f,null))[_0x8055('0x47')](handleError(_0x11ef9f,null));}; \ No newline at end of file +var _0xa3d8=['then','stack','send','index','map','fieldName','type','key','name','keys','query','filters','intersection','model','fields','attributes','length','order','sort','where','pick','filter','merge','options','JscriptyQuestionReport','includeAll','findAll','rows','params','rawAttributes','find','create','body','catch','update','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','save','destroy'];(function(_0x156d82,_0x38723c){var _0x5ef8d6=function(_0x1c840d){while(--_0x1c840d){_0x156d82['push'](_0x156d82['shift']());}};_0x5ef8d6(++_0x38723c);}(_0xa3d8,0xb6));var _0x8a3d=function(_0x5c9942,_0x11c23e){_0x5c9942=_0x5c9942-0x0;var _0x451eb5=_0xa3d8[_0x5c9942];return _0x451eb5;};'use strict';var emlformat=require(_0x8a3d('0x0'));var rimraf=require(_0x8a3d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8a3d('0x2'));var moment=require(_0x8a3d('0x3'));var BPromise=require(_0x8a3d('0x4'));var Mustache=require(_0x8a3d('0x5'));var util=require(_0x8a3d('0x6'));var path=require(_0x8a3d('0x7'));var sox=require(_0x8a3d('0x8'));var csv=require(_0x8a3d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a3d('0xa'));var _=require(_0x8a3d('0xb'));var squel=require(_0x8a3d('0xc'));var crypto=require(_0x8a3d('0xd'));var jsforce=require(_0x8a3d('0xe'));var deskjs=require(_0x8a3d('0xf'));var toCsv=require(_0x8a3d('0x9'));var querystring=require(_0x8a3d('0x10'));var Papa=require(_0x8a3d('0x11'));var Redis=require(_0x8a3d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8a3d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a3d('0x14'));var logger=require(_0x8a3d('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x8a3d('0x16'));var licenseUtil=require(_0x8a3d('0x17'));var db=require(_0x8a3d('0x18'))['db'];function respondWithStatusCode(_0x2e5f2b,_0xff4090){_0xff4090=_0xff4090||0xcc;return function(_0x1d83c7){if(_0x1d83c7){return _0x2e5f2b[_0x8a3d('0x19')](_0xff4090);}return _0x2e5f2b[_0x8a3d('0x1a')](_0xff4090)[_0x8a3d('0x1b')]();};}function respondWithResult(_0x4e5d40,_0xe99471){_0xe99471=_0xe99471||0xc8;return function(_0x322221){if(_0x322221){return _0x4e5d40['status'](_0xe99471)[_0x8a3d('0x1c')](_0x322221);}};}function respondWithFilteredResult(_0x526dee,_0x2e9159){return function(_0x57ab34){if(_0x57ab34){var _0x29ae1e=typeof _0x2e9159['offset']===_0x8a3d('0x1d')&&typeof _0x2e9159[_0x8a3d('0x1e')]==='undefined';var _0x4f66cc=_0x57ab34['count'];var _0x264d0a=_0x29ae1e?0x0:_0x2e9159[_0x8a3d('0x1f')];var _0x3cd79e=_0x29ae1e?_0x57ab34[_0x8a3d('0x20')]:_0x2e9159[_0x8a3d('0x1f')]+_0x2e9159[_0x8a3d('0x1e')];var _0x10fe3a;if(_0x3cd79e>=_0x4f66cc){_0x3cd79e=_0x4f66cc;_0x10fe3a=0xc8;}else{_0x10fe3a=0xce;}_0x526dee['status'](_0x10fe3a);return _0x526dee[_0x8a3d('0x21')]('Content-Range',_0x264d0a+'-'+_0x3cd79e+'/'+_0x4f66cc)['json'](_0x57ab34);}return null;};}function patchUpdates(_0x2c4612){return function(_0x12f12a){try{jsonpatch[_0x8a3d('0x22')](_0x12f12a,_0x2c4612,!![]);}catch(_0x2813ed){return BPromise['reject'](_0x2813ed);}return _0x12f12a[_0x8a3d('0x23')]();};}function saveUpdates(_0x1c88d8,_0x35358e){return function(_0x3b9833){if(_0x3b9833){return _0x3b9833['update'](_0x1c88d8)['then'](function(_0x41caee){return _0x41caee;});}return null;};}function removeEntity(_0x15050a,_0x2451ec){return function(_0x56977b){if(_0x56977b){return _0x56977b[_0x8a3d('0x24')]()[_0x8a3d('0x25')](function(){_0x15050a[_0x8a3d('0x1a')](0xcc)[_0x8a3d('0x1b')]();});}};}function handleEntityNotFound(_0x46e808,_0x34365a){return function(_0x37897a){if(!_0x37897a){_0x46e808[_0x8a3d('0x19')](0x194);}return _0x37897a;};}function handleError(_0x4caa00,_0x44bad9){_0x44bad9=_0x44bad9||0x1f4;return function(_0x44fa9a){logger['error'](_0x44fa9a[_0x8a3d('0x26')]);if(_0x44fa9a['name']){delete _0x44fa9a['name'];}_0x4caa00[_0x8a3d('0x1a')](_0x44bad9)[_0x8a3d('0x27')](_0x44fa9a);};}exports[_0x8a3d('0x28')]=function(_0x49aa20,_0x2be03f){var _0x66363={},_0x326982={},_0x15a798={'count':0x0,'rows':[]};var _0x5c4cc2=_[_0x8a3d('0x29')](db['JscriptyQuestionReport']['rawAttributes'],function(_0x482390){return{'name':_0x482390[_0x8a3d('0x2a')],'type':_0x482390[_0x8a3d('0x2b')][_0x8a3d('0x2c')]};});_0x326982['model']=_['map'](_0x5c4cc2,_0x8a3d('0x2d'));_0x326982['query']=_[_0x8a3d('0x2e')](_0x49aa20[_0x8a3d('0x2f')]);_0x326982[_0x8a3d('0x30')]=_[_0x8a3d('0x31')](_0x326982[_0x8a3d('0x32')],_0x326982['query']);_0x66363['attributes']=_[_0x8a3d('0x31')](_0x326982[_0x8a3d('0x32')],qs['fields'](_0x49aa20[_0x8a3d('0x2f')][_0x8a3d('0x33')]));_0x66363[_0x8a3d('0x34')]=_0x66363[_0x8a3d('0x34')][_0x8a3d('0x35')]?_0x66363[_0x8a3d('0x34')]:_0x326982['model'];if(!_0x49aa20['query']['hasOwnProperty']('nolimit')){_0x66363[_0x8a3d('0x1e')]=qs['limit'](_0x49aa20[_0x8a3d('0x2f')][_0x8a3d('0x1e')]);_0x66363[_0x8a3d('0x1f')]=qs[_0x8a3d('0x1f')](_0x49aa20[_0x8a3d('0x2f')]['offset']);}_0x66363[_0x8a3d('0x36')]=qs['sort'](_0x49aa20[_0x8a3d('0x2f')][_0x8a3d('0x37')]);_0x66363[_0x8a3d('0x38')]=qs[_0x8a3d('0x30')](_[_0x8a3d('0x39')](_0x49aa20['query'],_0x326982[_0x8a3d('0x30')]),_0x5c4cc2);if(_0x49aa20[_0x8a3d('0x2f')][_0x8a3d('0x3a')]){_0x66363[_0x8a3d('0x38')]=_['merge'](_0x66363['where'],{'$or':_[_0x8a3d('0x29')](_0x5c4cc2,function(_0x246202){if(_0x246202['type']!=='VIRTUAL'){var _0x5c0dbd={};_0x5c0dbd[_0x246202[_0x8a3d('0x2d')]]={'$like':'%'+_0x49aa20['query'][_0x8a3d('0x3a')]+'%'};return _0x5c0dbd;}})});}_0x66363=_[_0x8a3d('0x3b')]({},_0x66363,_0x49aa20[_0x8a3d('0x3c')]);var _0x23c9d9={'where':_0x66363[_0x8a3d('0x38')]};return db[_0x8a3d('0x3d')][_0x8a3d('0x20')](_0x23c9d9)[_0x8a3d('0x25')](function(_0x6f8235){_0x15a798['count']=_0x6f8235;if(_0x49aa20['query'][_0x8a3d('0x3e')]){_0x66363['include']=[{'all':!![]}];}return db[_0x8a3d('0x3d')][_0x8a3d('0x3f')](_0x66363);})['then'](function(_0x4ad9b7){_0x15a798[_0x8a3d('0x40')]=_0x4ad9b7;return _0x15a798;})[_0x8a3d('0x25')](respondWithFilteredResult(_0x2be03f,_0x66363))['catch'](handleError(_0x2be03f,null));};exports['show']=function(_0x5d414e,_0x3d374c){var _0x195ba4={'raw':!![],'where':{'id':_0x5d414e[_0x8a3d('0x41')]['id']}},_0x144597={};_0x144597[_0x8a3d('0x32')]=_['keys'](db[_0x8a3d('0x3d')][_0x8a3d('0x42')]);_0x144597['query']=_[_0x8a3d('0x2e')](_0x5d414e['query']);_0x144597[_0x8a3d('0x30')]=_[_0x8a3d('0x31')](_0x144597['model'],_0x144597[_0x8a3d('0x2f')]);_0x195ba4[_0x8a3d('0x34')]=_[_0x8a3d('0x31')](_0x144597[_0x8a3d('0x32')],qs[_0x8a3d('0x33')](_0x5d414e[_0x8a3d('0x2f')][_0x8a3d('0x33')]));_0x195ba4[_0x8a3d('0x34')]=_0x195ba4['attributes']['length']?_0x195ba4[_0x8a3d('0x34')]:_0x144597['model'];if(_0x5d414e[_0x8a3d('0x2f')][_0x8a3d('0x3e')]){_0x195ba4['include']=[{'all':!![]}];}_0x195ba4=_['merge']({},_0x195ba4,_0x5d414e[_0x8a3d('0x3c')]);return db[_0x8a3d('0x3d')][_0x8a3d('0x43')](_0x195ba4)[_0x8a3d('0x25')](handleEntityNotFound(_0x3d374c,null))[_0x8a3d('0x25')](respondWithResult(_0x3d374c,null))['catch'](handleError(_0x3d374c,null));};exports[_0x8a3d('0x44')]=function(_0x9df207,_0x2597cc){return db['JscriptyQuestionReport'][_0x8a3d('0x44')](_0x9df207[_0x8a3d('0x45')],{})['then'](respondWithResult(_0x2597cc,0xc9))[_0x8a3d('0x46')](handleError(_0x2597cc,null));};exports[_0x8a3d('0x47')]=function(_0x26a3bd,_0x5da1){if(_0x26a3bd[_0x8a3d('0x45')]['id']){delete _0x26a3bd['body']['id'];}return db['JscriptyQuestionReport']['find']({'where':{'id':_0x26a3bd['params']['id']}})[_0x8a3d('0x25')](handleEntityNotFound(_0x5da1,null))[_0x8a3d('0x25')](saveUpdates(_0x26a3bd[_0x8a3d('0x45')],null))[_0x8a3d('0x25')](respondWithResult(_0x5da1,null))[_0x8a3d('0x46')](handleError(_0x5da1,null));};exports[_0x8a3d('0x24')]=function(_0x58adf1,_0x5dec1c){return db[_0x8a3d('0x3d')][_0x8a3d('0x43')]({'where':{'id':_0x58adf1['params']['id']}})[_0x8a3d('0x25')](handleEntityNotFound(_0x5dec1c,null))[_0x8a3d('0x25')](removeEntity(_0x5dec1c,null))[_0x8a3d('0x46')](handleError(_0x5dec1c,null));};exports[_0x8a3d('0x48')]=function(_0x498180,_0x3dc834){return db[_0x8a3d('0x3d')]['describe']()['then'](respondWithResult(_0x3dc834,null))[_0x8a3d('0x46')](handleError(_0x3dc834,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 5de6fef..c7a99a5 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 _0xc7e7=['moment','bluebird','path','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions','util','../../config/logger','api'];(function(_0x4b0acb,_0x11e5d9){var _0x17fd28=function(_0xed485d){while(--_0xed485d){_0x4b0acb['push'](_0x4b0acb['shift']());}};_0x17fd28(++_0x11e5d9);}(_0xc7e7,0xc3));var _0x7c7e=function(_0x33078b,_0xf5b1d0){_0x33078b=_0x33078b-0x0;var _0x54bd8e=_0xc7e7[_0x33078b];return _0x54bd8e;};'use strict';var _=require('lodash');var util=require(_0x7c7e('0x0'));var logger=require(_0x7c7e('0x1'))(_0x7c7e('0x2'));var moment=require(_0x7c7e('0x3'));var BPromise=require(_0x7c7e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c7e('0x5'));var rimraf=require('rimraf');var config=require(_0x7c7e('0x6'));var attributes=require(_0x7c7e('0x7'));module[_0x7c7e('0x8')]=function(_0x3bd02d,_0x287a7c){return _0x3bd02d[_0x7c7e('0x9')]('JscriptyQuestionReport',attributes,{'tableName':_0x7c7e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29bd=['JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define'];(function(_0xd79494,_0x1fcda7){var _0x1c1698=function(_0x15e012){while(--_0x15e012){_0xd79494['push'](_0xd79494['shift']());}};_0x1c1698(++_0x1fcda7);}(_0x29bd,0x1e2));var _0xd29b=function(_0x2cfe1c,_0x3c3f57){_0x2cfe1c=_0x2cfe1c-0x0;var _0x5b6016=_0x29bd[_0x2cfe1c];return _0x5b6016;};'use strict';var _=require(_0xd29b('0x0'));var util=require(_0xd29b('0x1'));var logger=require(_0xd29b('0x2'))(_0xd29b('0x3'));var moment=require(_0xd29b('0x4'));var BPromise=require(_0xd29b('0x5'));var rp=require(_0xd29b('0x6'));var fs=require('fs');var path=require(_0xd29b('0x7'));var rimraf=require(_0xd29b('0x8'));var config=require(_0xd29b('0x9'));var attributes=require(_0xd29b('0xa'));module[_0xd29b('0xb')]=function(_0x2c2054,_0x1b927f){return _0x2c2054[_0xd29b('0xc')](_0xd29b('0xd'),attributes,{'tableName':_0xd29b('0xe'),'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 85a74c8..61ffa48 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 _0x17d2=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','ioredis'];(function(_0x10c8b6,_0x1dd53e){var _0x129dbf=function(_0x22bd4b){while(--_0x22bd4b){_0x10c8b6['push'](_0x10c8b6['shift']());}};_0x129dbf(++_0x1dd53e);}(_0x17d2,0xce));var _0x217d=function(_0x3569c4,_0x272a40){_0x3569c4=_0x3569c4-0x0;var _0x15d359=_0x17d2[_0x3569c4];return _0x15d359;};'use strict';var _=require(_0x217d('0x0'));var util=require(_0x217d('0x1'));var moment=require(_0x217d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x217d('0x3'));var db=require(_0x217d('0x4'))['db'];var utils=require(_0x217d('0x5'));var logger=require(_0x217d('0x6'))(_0x217d('0x7'));var config=require('../../config/environment');var jayson=require(_0x217d('0x8'));var client=jayson['client'][_0x217d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e220b,_0x2bb955,_0x4be38b){return new BPromise(function(_0x3b5555,_0x20632a){return client['request'](_0x3e220b,_0x4be38b)[_0x217d('0xa')](function(_0x1ad796){logger[_0x217d('0xb')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2bb955,'request\x20sent');logger[_0x217d('0xc')](_0x217d('0xd'),_0x2bb955,'request\x20sent',JSON['stringify'](_0x1ad796));if(_0x1ad796['error']){if(_0x1ad796[_0x217d('0xe')][_0x217d('0xf')]===0x1f4){logger['error'](_0x217d('0x10'),_0x2bb955,_0x1ad796[_0x217d('0xe')][_0x217d('0x11')]);return _0x20632a(_0x1ad796[_0x217d('0xe')][_0x217d('0x11')]);}logger[_0x217d('0xe')](_0x217d('0x10'),_0x2bb955,_0x1ad796[_0x217d('0xe')][_0x217d('0x11')]);return _0x3b5555(_0x1ad796[_0x217d('0xe')]['message']);}else{logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x2bb955,_0x217d('0x12'));_0x3b5555(_0x1ad796[_0x217d('0x13')]['message']);}})[_0x217d('0x14')](function(_0x179cc4){logger[_0x217d('0xe')](_0x217d('0x10'),_0x2bb955,_0x179cc4);_0x20632a(_0x179cc4);});});} \ No newline at end of file +var _0xd0f2=['http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x55bab0,_0x118bc2){var _0x339aed=function(_0x47bf46){while(--_0x47bf46){_0x55bab0['push'](_0x55bab0['shift']());}};_0x339aed(++_0x118bc2);}(_0xd0f2,0xfd));var _0x2d0f=function(_0xb20224,_0xa8674d){_0xb20224=_0xb20224-0x0;var _0x19921d=_0xd0f2[_0xb20224];return _0x19921d;};'use strict';var _=require('lodash');var util=require(_0x2d0f('0x0'));var moment=require('moment');var BPromise=require(_0x2d0f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d0f('0x2'));var db=require(_0x2d0f('0x3'))['db'];var utils=require(_0x2d0f('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x2d0f('0x5'));var jayson=require(_0x2d0f('0x6'));var client=jayson['client'][_0x2d0f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3cbd30,_0x2cae76,_0x53e36b){return new BPromise(function(_0x2864ff,_0x573af5){return client[_0x2d0f('0x8')](_0x3cbd30,_0x53e36b)[_0x2d0f('0x9')](function(_0x156e79){logger['info'](_0x2d0f('0xa'),_0x2cae76,_0x2d0f('0xb'));logger[_0x2d0f('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x2cae76,_0x2d0f('0xb'),JSON[_0x2d0f('0xd')](_0x156e79));if(_0x156e79['error']){if(_0x156e79[_0x2d0f('0xe')][_0x2d0f('0xf')]===0x1f4){logger[_0x2d0f('0xe')](_0x2d0f('0xa'),_0x2cae76,_0x156e79['error']['message']);return _0x573af5(_0x156e79[_0x2d0f('0xe')][_0x2d0f('0x10')]);}logger['error'](_0x2d0f('0xa'),_0x2cae76,_0x156e79[_0x2d0f('0xe')]['message']);return _0x2864ff(_0x156e79['error']['message']);}else{logger[_0x2d0f('0x11')](_0x2d0f('0xa'),_0x2cae76,_0x2d0f('0xb'));_0x2864ff(_0x156e79[_0x2d0f('0x12')][_0x2d0f('0x10')]);}})[_0x2d0f('0x13')](function(_0x2eeb9f){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x2cae76,_0x2eeb9f);_0x573af5(_0x2eeb9f);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 6f17951..5fc3d81 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 _0xbe4c=['update','delete','exports','util','path','express','fs-extra','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','/:id','getQuestions','create'];(function(_0x26fc81,_0x57fc19){var _0x9feece=function(_0x4344c3){while(--_0x4344c3){_0x26fc81['push'](_0x26fc81['shift']());}};_0x9feece(++_0x57fc19);}(_0xbe4c,0x120));var _0xcbe4=function(_0x1e62a1,_0x129a2f){_0x1e62a1=_0x1e62a1-0x0;var _0xfea8eb=_0xbe4c[_0x1e62a1];return _0xfea8eb;};'use strict';var multer=require('multer');var util=require(_0xcbe4('0x0'));var path=require(_0xcbe4('0x1'));var timeout=require('connect-timeout');var express=require(_0xcbe4('0x2'));var router=express['Router']();var fs_extra=require(_0xcbe4('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcbe4('0x4'));var controller=require(_0xcbe4('0x5'));router[_0xcbe4('0x6')]('/',auth[_0xcbe4('0x7')](),controller['index']);router['get'](_0xcbe4('0x8'),auth[_0xcbe4('0x7')](),controller['describe']);router[_0xcbe4('0x6')](_0xcbe4('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xcbe4('0x6')]('/:id/questions',auth['isAuthenticated'](),controller[_0xcbe4('0xa')]);router['post']('/',auth[_0xcbe4('0x7')](),controller[_0xcbe4('0xb')]);router['put'](_0xcbe4('0x9'),auth[_0xcbe4('0x7')](),controller[_0xcbe4('0xc')]);router[_0xcbe4('0xd')](_0xcbe4('0x9'),auth[_0xcbe4('0x7')](),controller['destroy']);module[_0xcbe4('0xe')]=router; \ No newline at end of file +var _0xcc8f=['../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get','index','isAuthenticated','describe','/:id','show','/:id/questions','getQuestions','post','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra'];(function(_0x497ddf,_0x1578b7){var _0x101c45=function(_0x57193d){while(--_0x57193d){_0x497ddf['push'](_0x497ddf['shift']());}};_0x101c45(++_0x1578b7);}(_0xcc8f,0x103));var _0xfcc8=function(_0x1075d9,_0x32a456){_0x1075d9=_0x1075d9-0x0;var _0x4caebf=_0xcc8f[_0x1075d9];return _0x4caebf;};'use strict';var multer=require(_0xfcc8('0x0'));var util=require('util');var path=require(_0xfcc8('0x1'));var timeout=require('connect-timeout');var express=require(_0xfcc8('0x2'));var router=express[_0xfcc8('0x3')]();var fs_extra=require(_0xfcc8('0x4'));var auth=require(_0xfcc8('0x5'));var interaction=require(_0xfcc8('0x6'));var config=require('../../config/environment');var controller=require(_0xfcc8('0x7'));router[_0xfcc8('0x8')]('/',auth['isAuthenticated'](),controller[_0xfcc8('0x9')]);router['get']('/describe',auth[_0xfcc8('0xa')](),controller[_0xfcc8('0xb')]);router[_0xfcc8('0x8')](_0xfcc8('0xc'),auth['isAuthenticated'](),controller[_0xfcc8('0xd')]);router[_0xfcc8('0x8')](_0xfcc8('0xe'),auth[_0xfcc8('0xa')](),controller[_0xfcc8('0xf')]);router[_0xfcc8('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfcc8('0x11')](_0xfcc8('0xc'),auth[_0xfcc8('0xa')](),controller[_0xfcc8('0x12')]);router[_0xfcc8('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xfcc8('0x14')]);module[_0xfcc8('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 5589e87..3899e5d 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 _0x2cdc=['setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','moment','sequelize','DATE'];(function(_0x3a6bde,_0x23eefb){var _0x4d6bc8=function(_0x9b6891){while(--_0x9b6891){_0x3a6bde['push'](_0x3a6bde['shift']());}};_0x4d6bc8(++_0x23eefb);}(_0x2cdc,0xbd));var _0xc2cd=function(_0x374f60,_0x551010){_0x374f60=_0x374f60-0x0;var _0x454eda=_0x2cdc[_0x374f60];return _0x454eda;};'use strict';var moment=require(_0xc2cd('0x0'));var Sequelize=require(_0xc2cd('0x1'));module['exports']={'starttime':{'type':Sequelize[_0xc2cd('0x2')],'set':function(_0x194f20){this[_0xc2cd('0x3')]('starttime',_0x194f20);this[_0xc2cd('0x3')](_0xc2cd('0x4'),moment()[_0xc2cd('0x5')](_0xc2cd('0x6')));}},'endtime':{'type':Sequelize[_0xc2cd('0x2')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xc2cd('0x7')]},'uniqueid':{'type':Sequelize[_0xc2cd('0x7')]},'calleridname':{'type':Sequelize[_0xc2cd('0x7')]},'calleridnum':{'type':Sequelize[_0xc2cd('0x7')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x6237=['exports','DATE','setDataValue','endtime','format','STRING','BOOLEAN','moment','sequelize'];(function(_0x18cac4,_0x57a4d5){var _0x2227c6=function(_0x72934d){while(--_0x72934d){_0x18cac4['push'](_0x18cac4['shift']());}};_0x2227c6(++_0x57a4d5);}(_0x6237,0xc4));var _0x7623=function(_0x4c7c25,_0x1e16a8){_0x4c7c25=_0x4c7c25-0x0;var _0x297619=_0x6237[_0x4c7c25];return _0x297619;};'use strict';var moment=require(_0x7623('0x0'));var Sequelize=require(_0x7623('0x1'));module[_0x7623('0x2')]={'starttime':{'type':Sequelize[_0x7623('0x3')],'set':function(_0x414269){this[_0x7623('0x4')]('starttime',_0x414269);this[_0x7623('0x4')](_0x7623('0x5'),moment()[_0x7623('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x7623('0x3')]},'membername':{'type':Sequelize[_0x7623('0x7')]},'projectname':{'type':Sequelize[_0x7623('0x7')]},'queue':{'type':Sequelize[_0x7623('0x7')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7623('0x7')]},'calleridnum':{'type':Sequelize[_0x7623('0x7')]},'completed':{'type':Sequelize[_0x7623('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 19ddabb..66765b7 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 _0xbea3=['length','includeAll','include','catch','body','find','describe','getQuestions','JscriptyQuestionReport','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','end','error','stack','name','index','JscriptySessionReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','params'];(function(_0x561a73,_0x5a7801){var _0x21a09e=function(_0x41bea6){while(--_0x41bea6){_0x561a73['push'](_0x561a73['shift']());}};_0x21a09e(++_0x5a7801);}(_0xbea3,0x19a));var _0x3bea=function(_0x5422f4,_0x1deab9){_0x5422f4=_0x5422f4-0x0;var _0x5e3913=_0xbea3[_0x5422f4];return _0x5e3913;};'use strict';var emlformat=require(_0x3bea('0x0'));var rimraf=require(_0x3bea('0x1'));var zipdir=require(_0x3bea('0x2'));var jsonpatch=require(_0x3bea('0x3'));var rp=require(_0x3bea('0x4'));var moment=require(_0x3bea('0x5'));var BPromise=require(_0x3bea('0x6'));var Mustache=require(_0x3bea('0x7'));var util=require(_0x3bea('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x3bea('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3bea('0xa'));var _=require(_0x3bea('0xb'));var squel=require(_0x3bea('0xc'));var crypto=require('crypto');var jsforce=require(_0x3bea('0xd'));var deskjs=require(_0x3bea('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3bea('0xf'));var Papa=require(_0x3bea('0x10'));var Redis=require(_0x3bea('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3bea('0x12'));var as=require(_0x3bea('0x13'));var hardwareService=require(_0x3bea('0x14'));var logger=require(_0x3bea('0x15'))(_0x3bea('0x16'));var utils=require(_0x3bea('0x17'));var config=require(_0x3bea('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3bea('0x19'))['db'];function respondWithStatusCode(_0x3b91e5,_0x212cd9){_0x212cd9=_0x212cd9||0xcc;return function(_0x5323d8){if(_0x5323d8){return _0x3b91e5[_0x3bea('0x1a')](_0x212cd9);}return _0x3b91e5[_0x3bea('0x1b')](_0x212cd9)['end']();};}function respondWithResult(_0x40ffb0,_0x45f1d5){_0x45f1d5=_0x45f1d5||0xc8;return function(_0xd8c932){if(_0xd8c932){return _0x40ffb0[_0x3bea('0x1b')](_0x45f1d5)[_0x3bea('0x1c')](_0xd8c932);}};}function respondWithFilteredResult(_0x16f828,_0x533603){return function(_0x160cc6){if(_0x160cc6){var _0x463680=typeof _0x533603[_0x3bea('0x1d')]==='undefined'&&typeof _0x533603['limit']===_0x3bea('0x1e');var _0x17b045=_0x160cc6[_0x3bea('0x1f')];var _0x1b9a4b=_0x463680?0x0:_0x533603[_0x3bea('0x1d')];var _0x47bf94=_0x463680?_0x160cc6[_0x3bea('0x1f')]:_0x533603[_0x3bea('0x1d')]+_0x533603[_0x3bea('0x20')];var _0x4c530e;if(_0x47bf94>=_0x17b045){_0x47bf94=_0x17b045;_0x4c530e=0xc8;}else{_0x4c530e=0xce;}_0x16f828[_0x3bea('0x1b')](_0x4c530e);return _0x16f828[_0x3bea('0x21')]('Content-Range',_0x1b9a4b+'-'+_0x47bf94+'/'+_0x17b045)[_0x3bea('0x1c')](_0x160cc6);}return null;};}function patchUpdates(_0x49e0a8){return function(_0x17e396){try{jsonpatch[_0x3bea('0x22')](_0x17e396,_0x49e0a8,!![]);}catch(_0x91d5b9){return BPromise[_0x3bea('0x23')](_0x91d5b9);}return _0x17e396[_0x3bea('0x24')]();};}function saveUpdates(_0x4dd7a7,_0x194a7b){return function(_0x5e3954){if(_0x5e3954){return _0x5e3954[_0x3bea('0x25')](_0x4dd7a7)['then'](function(_0x220772){return _0x220772;});}return null;};}function removeEntity(_0x5eb4c9,_0x8583c8){return function(_0x1d9902){if(_0x1d9902){return _0x1d9902['destroy']()[_0x3bea('0x26')](function(){_0x5eb4c9[_0x3bea('0x1b')](0xcc)[_0x3bea('0x27')]();});}};}function handleEntityNotFound(_0x5233d0,_0x12e091){return function(_0x38fa34){if(!_0x38fa34){_0x5233d0[_0x3bea('0x1a')](0x194);}return _0x38fa34;};}function handleError(_0x34584d,_0x5d6aa0){_0x5d6aa0=_0x5d6aa0||0x1f4;return function(_0x24b4ec){logger[_0x3bea('0x28')](_0x24b4ec[_0x3bea('0x29')]);if(_0x24b4ec[_0x3bea('0x2a')]){delete _0x24b4ec[_0x3bea('0x2a')];}_0x34584d[_0x3bea('0x1b')](_0x5d6aa0)['send'](_0x24b4ec);};}exports[_0x3bea('0x2b')]=function(_0x3e31dd,_0x4c4f41){var _0x693fc7={},_0x21f5ea={},_0x19d45b={'count':0x0,'rows':[]};var _0x4566d5=_['map'](db[_0x3bea('0x2c')][_0x3bea('0x2d')],function(_0x4b1126){return{'name':_0x4b1126[_0x3bea('0x2e')],'type':_0x4b1126[_0x3bea('0x2f')][_0x3bea('0x30')]};});_0x21f5ea[_0x3bea('0x31')]=_[_0x3bea('0x32')](_0x4566d5,_0x3bea('0x2a'));_0x21f5ea[_0x3bea('0x33')]=_[_0x3bea('0x34')](_0x3e31dd['query']);_0x21f5ea[_0x3bea('0x35')]=_['intersection'](_0x21f5ea[_0x3bea('0x31')],_0x21f5ea[_0x3bea('0x33')]);_0x693fc7[_0x3bea('0x36')]=_[_0x3bea('0x37')](_0x21f5ea[_0x3bea('0x31')],qs[_0x3bea('0x38')](_0x3e31dd[_0x3bea('0x33')]['fields']));_0x693fc7[_0x3bea('0x36')]=_0x693fc7[_0x3bea('0x36')]['length']?_0x693fc7[_0x3bea('0x36')]:_0x21f5ea['model'];if(!_0x3e31dd[_0x3bea('0x33')][_0x3bea('0x39')](_0x3bea('0x3a'))){_0x693fc7[_0x3bea('0x20')]=qs[_0x3bea('0x20')](_0x3e31dd[_0x3bea('0x33')][_0x3bea('0x20')]);_0x693fc7[_0x3bea('0x1d')]=qs[_0x3bea('0x1d')](_0x3e31dd[_0x3bea('0x33')][_0x3bea('0x1d')]);}_0x693fc7[_0x3bea('0x3b')]=qs[_0x3bea('0x3c')](_0x3e31dd['query'][_0x3bea('0x3c')]);_0x693fc7[_0x3bea('0x3d')]=qs[_0x3bea('0x35')](_[_0x3bea('0x3e')](_0x3e31dd[_0x3bea('0x33')],_0x21f5ea[_0x3bea('0x35')]),_0x4566d5);if(_0x3e31dd['query'][_0x3bea('0x3f')]){_0x693fc7[_0x3bea('0x3d')]=_[_0x3bea('0x40')](_0x693fc7[_0x3bea('0x3d')],{'$or':_['map'](_0x4566d5,function(_0x192ee8){if(_0x192ee8[_0x3bea('0x2f')]!==_0x3bea('0x41')){var _0x41c445={};_0x41c445[_0x192ee8[_0x3bea('0x2a')]]={'$like':'%'+_0x3e31dd[_0x3bea('0x33')][_0x3bea('0x3f')]+'%'};return _0x41c445;}})});}_0x693fc7=_[_0x3bea('0x40')]({},_0x693fc7,_0x3e31dd[_0x3bea('0x42')]);var _0x4d4ab8={'where':_0x693fc7[_0x3bea('0x3d')]};return db[_0x3bea('0x2c')][_0x3bea('0x1f')](_0x4d4ab8)[_0x3bea('0x26')](function(_0x15a032){_0x19d45b['count']=_0x15a032;if(_0x3e31dd[_0x3bea('0x33')]['includeAll']){_0x693fc7['include']=[{'all':!![]}];}return db[_0x3bea('0x2c')][_0x3bea('0x43')](_0x693fc7);})[_0x3bea('0x26')](function(_0x2d6e62){_0x19d45b[_0x3bea('0x44')]=_0x2d6e62;return _0x19d45b;})[_0x3bea('0x26')](respondWithFilteredResult(_0x4c4f41,_0x693fc7))['catch'](handleError(_0x4c4f41,null));};exports['show']=function(_0x41fd83,_0x3a08b0){var _0x14f783={'raw':!![],'where':{'id':_0x41fd83[_0x3bea('0x45')]['id']}},_0x17718b={};_0x17718b[_0x3bea('0x31')]=_[_0x3bea('0x34')](db[_0x3bea('0x2c')][_0x3bea('0x2d')]);_0x17718b['query']=_[_0x3bea('0x34')](_0x41fd83['query']);_0x17718b[_0x3bea('0x35')]=_[_0x3bea('0x37')](_0x17718b[_0x3bea('0x31')],_0x17718b[_0x3bea('0x33')]);_0x14f783[_0x3bea('0x36')]=_[_0x3bea('0x37')](_0x17718b[_0x3bea('0x31')],qs['fields'](_0x41fd83[_0x3bea('0x33')][_0x3bea('0x38')]));_0x14f783['attributes']=_0x14f783[_0x3bea('0x36')][_0x3bea('0x46')]?_0x14f783[_0x3bea('0x36')]:_0x17718b[_0x3bea('0x31')];if(_0x41fd83[_0x3bea('0x33')][_0x3bea('0x47')]){_0x14f783[_0x3bea('0x48')]=[{'all':!![]}];}_0x14f783=_[_0x3bea('0x40')]({},_0x14f783,_0x41fd83[_0x3bea('0x42')]);return db['JscriptySessionReport']['find'](_0x14f783)[_0x3bea('0x26')](handleEntityNotFound(_0x3a08b0,null))[_0x3bea('0x26')](respondWithResult(_0x3a08b0,null))[_0x3bea('0x49')](handleError(_0x3a08b0,null));};exports['create']=function(_0x4e4991,_0x5d6b2a){return db['JscriptySessionReport']['create'](_0x4e4991[_0x3bea('0x4a')],{})[_0x3bea('0x26')](respondWithResult(_0x5d6b2a,0xc9))['catch'](handleError(_0x5d6b2a,null));};exports['update']=function(_0x2325a1,_0x47d827){if(_0x2325a1['body']['id']){delete _0x2325a1[_0x3bea('0x4a')]['id'];}return db[_0x3bea('0x2c')][_0x3bea('0x4b')]({'where':{'id':_0x2325a1[_0x3bea('0x45')]['id']}})['then'](handleEntityNotFound(_0x47d827,null))[_0x3bea('0x26')](saveUpdates(_0x2325a1['body'],null))['then'](respondWithResult(_0x47d827,null))['catch'](handleError(_0x47d827,null));};exports['destroy']=function(_0x18737c,_0x4c03dc){return db[_0x3bea('0x2c')][_0x3bea('0x4b')]({'where':{'id':_0x18737c['params']['id']}})[_0x3bea('0x26')](handleEntityNotFound(_0x4c03dc,null))['then'](removeEntity(_0x4c03dc,null))[_0x3bea('0x49')](handleError(_0x4c03dc,null));};exports[_0x3bea('0x4c')]=function(_0x4f9e4b,_0x4809df){return db[_0x3bea('0x2c')][_0x3bea('0x4c')]()[_0x3bea('0x26')](respondWithResult(_0x4809df,null))[_0x3bea('0x49')](handleError(_0x4809df,null));};exports[_0x3bea('0x4d')]=function(_0x4c8936,_0x5f2338,_0x46d4af){var _0x3d2b69={'raw':!![],'where':{}};var _0x30c4f8={};var _0x356f2e={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x4c8936[_0x3bea('0x45')]['id']}})[_0x3bea('0x26')](handleEntityNotFound(_0x5f2338,null))[_0x3bea('0x26')](function(_0x23a2b5){if(_0x23a2b5){_0x30c4f8[_0x3bea('0x31')]=_[_0x3bea('0x34')](db[_0x3bea('0x4e')][_0x3bea('0x2d')]);_0x30c4f8[_0x3bea('0x33')]=_[_0x3bea('0x34')](_0x4c8936[_0x3bea('0x33')]);_0x30c4f8[_0x3bea('0x35')]=_['intersection'](_0x30c4f8['model'],_0x30c4f8[_0x3bea('0x33')]);_0x3d2b69['attributes']=_[_0x3bea('0x37')](_0x30c4f8['model'],qs[_0x3bea('0x38')](_0x4c8936[_0x3bea('0x33')][_0x3bea('0x38')]));_0x3d2b69[_0x3bea('0x36')]=_0x3d2b69['attributes'][_0x3bea('0x46')]?_0x3d2b69[_0x3bea('0x36')]:_0x30c4f8[_0x3bea('0x31')];if(!_0x4c8936[_0x3bea('0x33')][_0x3bea('0x39')](_0x3bea('0x3a'))){_0x3d2b69[_0x3bea('0x20')]=qs['limit'](_0x4c8936[_0x3bea('0x33')][_0x3bea('0x20')]);_0x3d2b69[_0x3bea('0x1d')]=qs[_0x3bea('0x1d')](_0x4c8936['query'][_0x3bea('0x1d')]);}_0x3d2b69['order']=qs[_0x3bea('0x3c')](_0x4c8936[_0x3bea('0x33')]['sort']);_0x3d2b69[_0x3bea('0x3d')]=qs['filters'](_[_0x3bea('0x3e')](_0x4c8936[_0x3bea('0x33')],_0x30c4f8[_0x3bea('0x35')]));_0x3d2b69[_0x3bea('0x3d')][_0x3bea('0x4f')]=_0x23a2b5['id'];if(_0x4c8936[_0x3bea('0x33')][_0x3bea('0x3f')]){_0x3d2b69['where']=_[_0x3bea('0x40')](_0x3d2b69[_0x3bea('0x3d')],{'$or':_[_0x3bea('0x32')](_0x3d2b69[_0x3bea('0x36')],function(_0x312ff9){var _0x391fc1={};_0x391fc1[_0x312ff9]={'$like':'%'+_0x4c8936['query'][_0x3bea('0x3f')]+'%'};return _0x391fc1;})});}_0x3d2b69=_['merge']({},_0x3d2b69,_0x4c8936['options']);return db[_0x3bea('0x4e')]['count']({'where':_0x3d2b69[_0x3bea('0x3d')]})[_0x3bea('0x26')](function(_0x16b320){_0x356f2e[_0x3bea('0x1f')]=_0x16b320;if(_0x4c8936[_0x3bea('0x33')][_0x3bea('0x47')]){_0x3d2b69[_0x3bea('0x48')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x3bea('0x43')](_0x3d2b69);})[_0x3bea('0x26')](function(_0xfd37b4){_0x356f2e[_0x3bea('0x44')]=_0xfd37b4;return _0x356f2e;});}})[_0x3bea('0x26')](respondWithFilteredResult(_0x5f2338,_0x3d2b69))['catch'](handleError(_0x5f2338,null));}; \ No newline at end of file +var _0x435f=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','error','name','index','map','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','JscriptySessionReport','include','findAll','rows','catch','show','params','rawAttributes','fields','includeAll','find','create','body','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse'];(function(_0xfa8c4,_0x129d61){var _0xbff44b=function(_0x47179c){while(--_0x47179c){_0xfa8c4['push'](_0xfa8c4['shift']());}};_0xbff44b(++_0x129d61);}(_0x435f,0x94));var _0xf435=function(_0x38c74b,_0x448307){_0x38c74b=_0x38c74b-0x0;var _0x40113e=_0x435f[_0x38c74b];return _0x40113e;};'use strict';var emlformat=require(_0xf435('0x0'));var rimraf=require(_0xf435('0x1'));var zipdir=require(_0xf435('0x2'));var jsonpatch=require(_0xf435('0x3'));var rp=require(_0xf435('0x4'));var moment=require(_0xf435('0x5'));var BPromise=require(_0xf435('0x6'));var Mustache=require('mustache');var util=require(_0xf435('0x7'));var path=require(_0xf435('0x8'));var sox=require(_0xf435('0x9'));var csv=require(_0xf435('0xa'));var ejs=require(_0xf435('0xb'));var fs=require('fs');var fs_extra=require(_0xf435('0xc'));var _=require('lodash');var squel=require(_0xf435('0xd'));var crypto=require(_0xf435('0xe'));var jsforce=require(_0xf435('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf435('0xa'));var querystring=require(_0xf435('0x10'));var Papa=require(_0xf435('0x11'));var Redis=require(_0xf435('0x12'));var authService=require(_0xf435('0x13'));var qs=require(_0xf435('0x14'));var as=require(_0xf435('0x15'));var hardwareService=require(_0xf435('0x16'));var logger=require(_0xf435('0x17'))(_0xf435('0x18'));var utils=require(_0xf435('0x19'));var config=require(_0xf435('0x1a'));var licenseUtil=require(_0xf435('0x1b'));var db=require(_0xf435('0x1c'))['db'];function respondWithStatusCode(_0x2b314a,_0x384a72){_0x384a72=_0x384a72||0xcc;return function(_0x2c7251){if(_0x2c7251){return _0x2b314a['sendStatus'](_0x384a72);}return _0x2b314a[_0xf435('0x1d')](_0x384a72)[_0xf435('0x1e')]();};}function respondWithResult(_0x37d559,_0x500b75){_0x500b75=_0x500b75||0xc8;return function(_0x4676a7){if(_0x4676a7){return _0x37d559[_0xf435('0x1d')](_0x500b75)[_0xf435('0x1f')](_0x4676a7);}};}function respondWithFilteredResult(_0x54dd58,_0x2d0af2){return function(_0x48898a){if(_0x48898a){var _0x332dc8=typeof _0x2d0af2[_0xf435('0x20')]===_0xf435('0x21')&&typeof _0x2d0af2[_0xf435('0x22')]===_0xf435('0x21');var _0x38c287=_0x48898a[_0xf435('0x23')];var _0x3d4a8a=_0x332dc8?0x0:_0x2d0af2[_0xf435('0x20')];var _0x1647bf=_0x332dc8?_0x48898a[_0xf435('0x23')]:_0x2d0af2[_0xf435('0x20')]+_0x2d0af2[_0xf435('0x22')];var _0x4c5a53;if(_0x1647bf>=_0x38c287){_0x1647bf=_0x38c287;_0x4c5a53=0xc8;}else{_0x4c5a53=0xce;}_0x54dd58[_0xf435('0x1d')](_0x4c5a53);return _0x54dd58['set']('Content-Range',_0x3d4a8a+'-'+_0x1647bf+'/'+_0x38c287)[_0xf435('0x1f')](_0x48898a);}return null;};}function patchUpdates(_0x13eb2b){return function(_0x2d0b38){try{jsonpatch[_0xf435('0x24')](_0x2d0b38,_0x13eb2b,!![]);}catch(_0x1e644a){return BPromise[_0xf435('0x25')](_0x1e644a);}return _0x2d0b38[_0xf435('0x26')]();};}function saveUpdates(_0x12d724,_0x3ea102){return function(_0x521a89){if(_0x521a89){return _0x521a89[_0xf435('0x27')](_0x12d724)['then'](function(_0x5f2485){return _0x5f2485;});}return null;};}function removeEntity(_0x67eb6f,_0x38bd39){return function(_0x280575){if(_0x280575){return _0x280575['destroy']()[_0xf435('0x28')](function(){_0x67eb6f[_0xf435('0x1d')](0xcc)[_0xf435('0x1e')]();});}};}function handleEntityNotFound(_0x3cda21,_0xe22868){return function(_0x5a14cd){if(!_0x5a14cd){_0x3cda21['sendStatus'](0x194);}return _0x5a14cd;};}function handleError(_0x383b40,_0x4cf490){_0x4cf490=_0x4cf490||0x1f4;return function(_0x2e46af){logger[_0xf435('0x29')](_0x2e46af['stack']);if(_0x2e46af[_0xf435('0x2a')]){delete _0x2e46af[_0xf435('0x2a')];}_0x383b40[_0xf435('0x1d')](_0x4cf490)['send'](_0x2e46af);};}exports[_0xf435('0x2b')]=function(_0xbd9c5e,_0x461bd2){var _0x5bd6e2={},_0x2fe30d={},_0x3d25c0={'count':0x0,'rows':[]};var _0x4fd773=_[_0xf435('0x2c')](db['JscriptySessionReport']['rawAttributes'],function(_0x4d376e){return{'name':_0x4d376e['fieldName'],'type':_0x4d376e[_0xf435('0x2d')][_0xf435('0x2e')]};});_0x2fe30d[_0xf435('0x2f')]=_[_0xf435('0x2c')](_0x4fd773,_0xf435('0x2a'));_0x2fe30d[_0xf435('0x30')]=_[_0xf435('0x31')](_0xbd9c5e[_0xf435('0x30')]);_0x2fe30d[_0xf435('0x32')]=_['intersection'](_0x2fe30d['model'],_0x2fe30d[_0xf435('0x30')]);_0x5bd6e2[_0xf435('0x33')]=_[_0xf435('0x34')](_0x2fe30d[_0xf435('0x2f')],qs['fields'](_0xbd9c5e[_0xf435('0x30')]['fields']));_0x5bd6e2[_0xf435('0x33')]=_0x5bd6e2[_0xf435('0x33')][_0xf435('0x35')]?_0x5bd6e2[_0xf435('0x33')]:_0x2fe30d[_0xf435('0x2f')];if(!_0xbd9c5e[_0xf435('0x30')][_0xf435('0x36')](_0xf435('0x37'))){_0x5bd6e2[_0xf435('0x22')]=qs[_0xf435('0x22')](_0xbd9c5e[_0xf435('0x30')]['limit']);_0x5bd6e2[_0xf435('0x20')]=qs[_0xf435('0x20')](_0xbd9c5e[_0xf435('0x30')][_0xf435('0x20')]);}_0x5bd6e2[_0xf435('0x38')]=qs[_0xf435('0x39')](_0xbd9c5e['query'][_0xf435('0x39')]);_0x5bd6e2[_0xf435('0x3a')]=qs[_0xf435('0x32')](_[_0xf435('0x3b')](_0xbd9c5e[_0xf435('0x30')],_0x2fe30d['filters']),_0x4fd773);if(_0xbd9c5e[_0xf435('0x30')][_0xf435('0x3c')]){_0x5bd6e2['where']=_['merge'](_0x5bd6e2[_0xf435('0x3a')],{'$or':_[_0xf435('0x2c')](_0x4fd773,function(_0x263230){if(_0x263230[_0xf435('0x2d')]!==_0xf435('0x3d')){var _0x368c9e={};_0x368c9e[_0x263230[_0xf435('0x2a')]]={'$like':'%'+_0xbd9c5e['query'][_0xf435('0x3c')]+'%'};return _0x368c9e;}})});}_0x5bd6e2=_[_0xf435('0x3e')]({},_0x5bd6e2,_0xbd9c5e[_0xf435('0x3f')]);var _0x5d10ba={'where':_0x5bd6e2[_0xf435('0x3a')]};return db[_0xf435('0x40')][_0xf435('0x23')](_0x5d10ba)[_0xf435('0x28')](function(_0x2c1a70){_0x3d25c0['count']=_0x2c1a70;if(_0xbd9c5e['query']['includeAll']){_0x5bd6e2[_0xf435('0x41')]=[{'all':!![]}];}return db[_0xf435('0x40')][_0xf435('0x42')](_0x5bd6e2);})[_0xf435('0x28')](function(_0x180359){_0x3d25c0[_0xf435('0x43')]=_0x180359;return _0x3d25c0;})[_0xf435('0x28')](respondWithFilteredResult(_0x461bd2,_0x5bd6e2))[_0xf435('0x44')](handleError(_0x461bd2,null));};exports[_0xf435('0x45')]=function(_0x5c8d5f,_0x20ade4){var _0x17a7e1={'raw':!![],'where':{'id':_0x5c8d5f[_0xf435('0x46')]['id']}},_0x6cb8ec={};_0x6cb8ec[_0xf435('0x2f')]=_['keys'](db[_0xf435('0x40')][_0xf435('0x47')]);_0x6cb8ec[_0xf435('0x30')]=_['keys'](_0x5c8d5f[_0xf435('0x30')]);_0x6cb8ec[_0xf435('0x32')]=_[_0xf435('0x34')](_0x6cb8ec[_0xf435('0x2f')],_0x6cb8ec[_0xf435('0x30')]);_0x17a7e1[_0xf435('0x33')]=_['intersection'](_0x6cb8ec[_0xf435('0x2f')],qs[_0xf435('0x48')](_0x5c8d5f[_0xf435('0x30')][_0xf435('0x48')]));_0x17a7e1[_0xf435('0x33')]=_0x17a7e1[_0xf435('0x33')][_0xf435('0x35')]?_0x17a7e1[_0xf435('0x33')]:_0x6cb8ec[_0xf435('0x2f')];if(_0x5c8d5f['query'][_0xf435('0x49')]){_0x17a7e1['include']=[{'all':!![]}];}_0x17a7e1=_['merge']({},_0x17a7e1,_0x5c8d5f[_0xf435('0x3f')]);return db[_0xf435('0x40')][_0xf435('0x4a')](_0x17a7e1)['then'](handleEntityNotFound(_0x20ade4,null))['then'](respondWithResult(_0x20ade4,null))[_0xf435('0x44')](handleError(_0x20ade4,null));};exports[_0xf435('0x4b')]=function(_0x376413,_0x6712af){return db[_0xf435('0x40')][_0xf435('0x4b')](_0x376413['body'],{})[_0xf435('0x28')](respondWithResult(_0x6712af,0xc9))['catch'](handleError(_0x6712af,null));};exports[_0xf435('0x27')]=function(_0x1d8b88,_0x14dbad){if(_0x1d8b88[_0xf435('0x4c')]['id']){delete _0x1d8b88[_0xf435('0x4c')]['id'];}return db[_0xf435('0x40')][_0xf435('0x4a')]({'where':{'id':_0x1d8b88[_0xf435('0x46')]['id']}})[_0xf435('0x28')](handleEntityNotFound(_0x14dbad,null))['then'](saveUpdates(_0x1d8b88['body'],null))[_0xf435('0x28')](respondWithResult(_0x14dbad,null))[_0xf435('0x44')](handleError(_0x14dbad,null));};exports[_0xf435('0x4d')]=function(_0x16d506,_0xe374cb){return db[_0xf435('0x40')][_0xf435('0x4a')]({'where':{'id':_0x16d506[_0xf435('0x46')]['id']}})[_0xf435('0x28')](handleEntityNotFound(_0xe374cb,null))[_0xf435('0x28')](removeEntity(_0xe374cb,null))[_0xf435('0x44')](handleError(_0xe374cb,null));};exports[_0xf435('0x4e')]=function(_0x788e97,_0x23a5e0){return db[_0xf435('0x40')]['describe']()[_0xf435('0x28')](respondWithResult(_0x23a5e0,null))[_0xf435('0x44')](handleError(_0x23a5e0,null));};exports[_0xf435('0x4f')]=function(_0x2e8959,_0x219a20,_0x5fb51a){var _0x1e4f47={'raw':!![],'where':{}};var _0x7fd66={};var _0x2df908={'count':0x0,'rows':[]};return db[_0xf435('0x40')][_0xf435('0x50')]({'where':{'id':_0x2e8959['params']['id']}})['then'](handleEntityNotFound(_0x219a20,null))[_0xf435('0x28')](function(_0x5a27b5){if(_0x5a27b5){_0x7fd66[_0xf435('0x2f')]=_['keys'](db[_0xf435('0x51')][_0xf435('0x47')]);_0x7fd66[_0xf435('0x30')]=_[_0xf435('0x31')](_0x2e8959[_0xf435('0x30')]);_0x7fd66[_0xf435('0x32')]=_[_0xf435('0x34')](_0x7fd66['model'],_0x7fd66['query']);_0x1e4f47[_0xf435('0x33')]=_['intersection'](_0x7fd66['model'],qs[_0xf435('0x48')](_0x2e8959[_0xf435('0x30')][_0xf435('0x48')]));_0x1e4f47[_0xf435('0x33')]=_0x1e4f47[_0xf435('0x33')]['length']?_0x1e4f47[_0xf435('0x33')]:_0x7fd66[_0xf435('0x2f')];if(!_0x2e8959[_0xf435('0x30')]['hasOwnProperty'](_0xf435('0x37'))){_0x1e4f47[_0xf435('0x22')]=qs['limit'](_0x2e8959[_0xf435('0x30')][_0xf435('0x22')]);_0x1e4f47['offset']=qs[_0xf435('0x20')](_0x2e8959['query'][_0xf435('0x20')]);}_0x1e4f47[_0xf435('0x38')]=qs['sort'](_0x2e8959[_0xf435('0x30')][_0xf435('0x39')]);_0x1e4f47[_0xf435('0x3a')]=qs[_0xf435('0x32')](_['pick'](_0x2e8959[_0xf435('0x30')],_0x7fd66[_0xf435('0x32')]));_0x1e4f47[_0xf435('0x3a')][_0xf435('0x52')]=_0x5a27b5['id'];if(_0x2e8959['query'][_0xf435('0x3c')]){_0x1e4f47[_0xf435('0x3a')]=_['merge'](_0x1e4f47[_0xf435('0x3a')],{'$or':_[_0xf435('0x2c')](_0x1e4f47[_0xf435('0x33')],function(_0x33f806){var _0x47df88={};_0x47df88[_0x33f806]={'$like':'%'+_0x2e8959[_0xf435('0x30')][_0xf435('0x3c')]+'%'};return _0x47df88;})});}_0x1e4f47=_[_0xf435('0x3e')]({},_0x1e4f47,_0x2e8959[_0xf435('0x3f')]);return db[_0xf435('0x51')]['count']({'where':_0x1e4f47[_0xf435('0x3a')]})[_0xf435('0x28')](function(_0x4bf4e3){_0x2df908[_0xf435('0x23')]=_0x4bf4e3;if(_0x2e8959['query'][_0xf435('0x49')]){_0x1e4f47[_0xf435('0x41')]=[{'all':!![]}];}return db[_0xf435('0x51')][_0xf435('0x42')](_0x1e4f47);})['then'](function(_0x11acce){_0x2df908['rows']=_0x11acce;return _0x2df908;});}})['then'](respondWithFilteredResult(_0x219a20,_0x1e4f47))[_0xf435('0x44')](handleError(_0x219a20,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 16ee9d1..5a7960e 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 _0x6c7b=['path','rimraf','./jscriptySessionReport.attributes','exports','define','report_jscripty_sessions','lodash','moment','request-promise'];(function(_0x3f3613,_0x482e34){var _0x2119b3=function(_0x4e98a8){while(--_0x4e98a8){_0x3f3613['push'](_0x3f3613['shift']());}};_0x2119b3(++_0x482e34);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x3e6432,_0x38edf1){_0x3e6432=_0x3e6432-0x0;var _0x33956e=_0x6c7b[_0x3e6432];return _0x33956e;};'use strict';var _=require(_0xb6c7('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb6c7('0x1'));var BPromise=require('bluebird');var rp=require(_0xb6c7('0x2'));var fs=require('fs');var path=require(_0xb6c7('0x3'));var rimraf=require(_0xb6c7('0x4'));var config=require('../../config/environment');var attributes=require(_0xb6c7('0x5'));module[_0xb6c7('0x6')]=function(_0xfe3eb9,_0x219abc){return _0xfe3eb9[_0xb6c7('0x7')]('JscriptySessionReport',attributes,{'tableName':_0xb6c7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ee1=['report_jscripty_sessions','lodash','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define'];(function(_0x39fad2,_0x407c11){var _0x313411=function(_0x1ee5c9){while(--_0x1ee5c9){_0x39fad2['push'](_0x39fad2['shift']());}};_0x313411(++_0x407c11);}(_0x7ee1,0x8d));var _0x17ee=function(_0x21bb77,_0x3d8a3c){_0x21bb77=_0x21bb77-0x0;var _0x58888e=_0x7ee1[_0x21bb77];return _0x58888e;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x17ee('0x1'));var BPromise=require(_0x17ee('0x2'));var rp=require(_0x17ee('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x17ee('0x4'));var config=require(_0x17ee('0x5'));var attributes=require(_0x17ee('0x6'));module[_0x17ee('0x7')]=function(_0x5c0617,_0x52b1db){return _0x5c0617[_0x17ee('0x8')]('JscriptySessionReport',attributes,{'tableName':_0x17ee('0x9'),'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 2077b41..551ca2f 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 _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(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x1967,0x173));var _0x7196=function(_0x341d98,_0x44a818){_0x341d98=_0x341d98-0x0;var _0x4a71af=_0x1967[_0x341d98];return _0x4a71af;};'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 +var _0x25e7=['JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info'];(function(_0x53cff9,_0x4e6f6b){var _0x379200=function(_0xe7ca29){while(--_0xe7ca29){_0x53cff9['push'](_0x53cff9['shift']());}};_0x379200(++_0x4e6f6b);}(_0x25e7,0x1d6));var _0x725e=function(_0x19fbdc,_0x2e1d6a){_0x19fbdc=_0x19fbdc-0x0;var _0x176533=_0x25e7[_0x19fbdc];return _0x176533;};'use strict';var _=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var moment=require(_0x725e('0x2'));var BPromise=require(_0x725e('0x3'));var rs=require(_0x725e('0x4'));var fs=require('fs');var Redis=require(_0x725e('0x5'));var db=require(_0x725e('0x6'))['db'];var utils=require(_0x725e('0x7'));var logger=require(_0x725e('0x8'))(_0x725e('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x725e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x481316,_0x111a50,_0x192c27){return new BPromise(function(_0x216b33,_0x67de0c){return client[_0x725e('0xb')](_0x481316,_0x192c27)[_0x725e('0xc')](function(_0x39858a){logger[_0x725e('0xd')](_0x725e('0xe'),_0x111a50,_0x725e('0xf'));logger[_0x725e('0x10')](_0x725e('0x11'),_0x111a50,'request\x20sent',JSON['stringify'](_0x39858a));if(_0x39858a[_0x725e('0x12')]){if(_0x39858a[_0x725e('0x12')]['code']===0x1f4){logger['error'](_0x725e('0xe'),_0x111a50,_0x39858a[_0x725e('0x12')]['message']);return _0x67de0c(_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);}logger[_0x725e('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x111a50,_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);return _0x216b33(_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);}else{logger[_0x725e('0xd')](_0x725e('0xe'),_0x111a50,'request\x20sent');_0x216b33(_0x39858a[_0x725e('0x14')][_0x725e('0x13')]);}})[_0x725e('0x15')](function(_0x54ac0f){logger[_0x725e('0x12')](_0x725e('0xe'),_0x111a50,_0x54ac0f);_0x67de0c(_0x54ac0f);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index d790b8a..a887871 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 _0x7a2d=['./license.controller','get','index','/:id','isAuthenticated','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x4509e,_0xd7e17){var _0x254bb2=function(_0x3dcbbf){while(--_0x3dcbbf){_0x4509e['push'](_0x4509e['shift']());}};_0x254bb2(++_0xd7e17);}(_0x7a2d,0x142));var _0xd7a2=function(_0x3ad279,_0x226683){_0x3ad279=_0x3ad279-0x0;var _0x1019f6=_0x7a2d[_0x3ad279];return _0x1019f6;};'use strict';var multer=require(_0xd7a2('0x0'));var util=require(_0xd7a2('0x1'));var path=require(_0xd7a2('0x2'));var timeout=require(_0xd7a2('0x3'));var express=require(_0xd7a2('0x4'));var router=express[_0xd7a2('0x5')]();var fs_extra=require(_0xd7a2('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd7a2('0x7'));var controller=require(_0xd7a2('0x8'));router[_0xd7a2('0x9')]('/',controller[_0xd7a2('0xa')]);router['put'](_0xd7a2('0xb'),auth[_0xd7a2('0xc')](),controller[_0xd7a2('0xd')]);module[_0xd7a2('0xe')]=router; \ No newline at end of file +var _0x8a28=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./license.controller','get','index','put','isAuthenticated','exports','multer','util'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x8a28,0xfd));var _0x88a2=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x8a28[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0x88a2('0x0'));var util=require(_0x88a2('0x1'));var path=require(_0x88a2('0x2'));var timeout=require(_0x88a2('0x3'));var express=require(_0x88a2('0x4'));var router=express[_0x88a2('0x5')]();var fs_extra=require(_0x88a2('0x6'));var auth=require(_0x88a2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x88a2('0x8'));var controller=require(_0x88a2('0x9'));router[_0x88a2('0xa')]('/',controller[_0x88a2('0xb')]);router[_0x88a2('0xc')]('/:id',auth[_0x88a2('0xd')](),controller['update']);module[_0x88a2('0xe')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 4aed647..7f32992 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 _0xa339=['TEXT','STRING','INTEGER','sequelize','exports'];(function(_0x5de701,_0x42e5b2){var _0x1c9155=function(_0x4da2d3){while(--_0x4da2d3){_0x5de701['push'](_0x5de701['shift']());}};_0x1c9155(++_0x42e5b2);}(_0xa339,0x11b));var _0x9a33=function(_0x44750e,_0x3f0095){_0x44750e=_0x44750e-0x0;var _0x52ee36=_0xa339[_0x44750e];return _0x52ee36;};'use strict';var Sequelize=require(_0x9a33('0x0'));module[_0x9a33('0x1')]={'license':{'type':Sequelize[_0x9a33('0x2')]},'data1':{'type':Sequelize[_0x9a33('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x9a33('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x450f=['sequelize','exports','STRING','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x450f,0x130));var _0xf450=function(_0x139674,_0x1ca8d8){_0x139674=_0x139674-0x0;var _0x191caa=_0x450f[_0x139674];return _0x191caa;};'use strict';var Sequelize=require(_0xf450('0x0'));module[_0xf450('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xf450('0x2')]},'data2':{'type':Sequelize[_0xf450('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xf450('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 0938693..062e770 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 _0x2ef3=['length','options','then','catch','body','params','get','checkLicense','demo','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','index','model','keys','rawAttributes','query','filters','intersection','attributes','fields'];(function(_0x148bd2,_0x3338c6){var _0x38c56f=function(_0x237939){while(--_0x237939){_0x148bd2['push'](_0x148bd2['shift']());}};_0x38c56f(++_0x3338c6);}(_0x2ef3,0xba));var _0x32ef=function(_0x49cc59,_0x205bfa){_0x49cc59=_0x49cc59-0x0;var _0x55616e=_0x2ef3[_0x49cc59];return _0x55616e;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}var utilLicense=require('../../config/license/util');exports[_0x32ef('0x29')]=function(_0x2f5d06,_0x5a04cd){var _0x12de1a={'raw':!![],'where':{'id':0x1}},_0x3c569d={};_0x3c569d[_0x32ef('0x2a')]=_[_0x32ef('0x2b')](db['License'][_0x32ef('0x2c')]);_0x3c569d[_0x32ef('0x2d')]=_[_0x32ef('0x2b')](_0x2f5d06[_0x32ef('0x2d')]);_0x3c569d[_0x32ef('0x2e')]=_[_0x32ef('0x2f')](_0x3c569d[_0x32ef('0x2a')],_0x3c569d['query']);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x3c569d[_0x32ef('0x2a')],qs[_0x32ef('0x31')](_0x2f5d06['query'][_0x32ef('0x31')]));_0x12de1a[_0x32ef('0x30')]=_0x12de1a[_0x32ef('0x30')][_0x32ef('0x32')]?_0x12de1a[_0x32ef('0x30')]:_0x3c569d['model'];_0x12de1a=_['merge']({},_0x12de1a,_0x2f5d06[_0x32ef('0x33')]);return utilLicense['getLicense'](_0x12de1a)[_0x32ef('0x34')](respondWithResult(_0x5a04cd,null))[_0x32ef('0x35')](handleError(_0x5a04cd,null));};exports[_0x32ef('0x24')]=function(_0x390670,_0x389583){if(_0x390670[_0x32ef('0x36')]['id']){delete _0x390670['body']['id'];}return db['License']['find']({'where':{'id':_0x390670[_0x32ef('0x37')]['id']}})[_0x32ef('0x34')](handleEntityNotFound(_0x389583,null))[_0x32ef('0x34')](function(_0x5f2443){var _0x4fb402=_0x5f2443[_0x32ef('0x38')]({'plain':!![]});return utilLicense[_0x32ef('0x39')](_0x4fb402,_0x390670[_0x32ef('0x36')]['key']);})['then'](function(_0xcbdec8){if(!_0xcbdec8[_0x32ef('0x3a')]){return saveUpdates(_0x390670[_0x32ef('0x36')],null);}return _0xcbdec8;})[_0x32ef('0x34')](respondWithResult(_0x389583,null))[_0x32ef('0x35')](handleError(_0x389583,null));}; \ No newline at end of file +var _0x814b=['json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','model','keys','rawAttributes','intersection','query','attributes','fields','length','merge','options','getLicense','catch','body','License','params','get','key','demo','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x451305,_0x54a8e3){var _0x52d130=function(_0x3db06e){while(--_0x3db06e){_0x451305['push'](_0x451305['shift']());}};_0x52d130(++_0x54a8e3);}(_0x814b,0x1a2));var _0xb814=function(_0x4ac48d,_0x171a68){_0x4ac48d=_0x4ac48d-0x0;var _0x7537af=_0x814b[_0x4ac48d];return _0x7537af;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];function respondWithStatusCode(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xcc;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0x1b')](_0x2cc46b);}return _0x35b10d[_0xb814('0x1c')](_0x2cc46b)[_0xb814('0x1d')]();};}function respondWithResult(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0xc8;return function(_0x3f4881){if(_0x3f4881){return _0xa0a2e5[_0xb814('0x1c')](_0x2ab627)[_0xb814('0x1e')](_0x3f4881);}};}function respondWithFilteredResult(_0x39bfcf,_0x303aca){return function(_0x3a71d6){if(_0x3a71d6){var _0x45e0d0=typeof _0x303aca[_0xb814('0x1f')]===_0xb814('0x20')&&typeof _0x303aca[_0xb814('0x21')]===_0xb814('0x20');var _0x48c9df=_0x3a71d6[_0xb814('0x22')];var _0x55ba16=_0x45e0d0?0x0:_0x303aca[_0xb814('0x1f')];var _0xfac75b=_0x45e0d0?_0x3a71d6['count']:_0x303aca['offset']+_0x303aca['limit'];var _0x399b43;if(_0xfac75b>=_0x48c9df){_0xfac75b=_0x48c9df;_0x399b43=0xc8;}else{_0x399b43=0xce;}_0x39bfcf['status'](_0x399b43);return _0x39bfcf['set'](_0xb814('0x23'),_0x55ba16+'-'+_0xfac75b+'/'+_0x48c9df)[_0xb814('0x1e')](_0x3a71d6);}return null;};}function patchUpdates(_0x25b6b6){return function(_0x4e139e){try{jsonpatch[_0xb814('0x24')](_0x4e139e,_0x25b6b6,!![]);}catch(_0x531032){return BPromise[_0xb814('0x25')](_0x531032);}return _0x4e139e[_0xb814('0x26')]();};}function saveUpdates(_0x3b267e,_0x470e81){return function(_0x27352e){if(_0x27352e){return _0x27352e[_0xb814('0x27')](_0x3b267e)[_0xb814('0x28')](function(_0x594470){return _0x594470;});}return null;};}function removeEntity(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(_0x3f81d0){return _0x3f81d0[_0xb814('0x29')]()[_0xb814('0x28')](function(){_0x2ead86[_0xb814('0x1c')](0xcc)[_0xb814('0x1d')]();});}};}function handleEntityNotFound(_0xb9e57d,_0x3d836c){return function(_0x5755ea){if(!_0x5755ea){_0xb9e57d[_0xb814('0x1b')](0x194);}return _0x5755ea;};}function handleError(_0xc0ef66,_0x1c2625){_0x1c2625=_0x1c2625||0x1f4;return function(_0x349394){logger[_0xb814('0x2a')](_0x349394[_0xb814('0x2b')]);if(_0x349394[_0xb814('0x2c')]){delete _0x349394[_0xb814('0x2c')];}_0xc0ef66['status'](_0x1c2625)[_0xb814('0x2d')](_0x349394);};}var utilLicense=require(_0xb814('0x19'));exports['index']=function(_0x9008b2,_0x37d24d){var _0x530744={'raw':!![],'where':{'id':0x1}},_0x499f22={};_0x499f22[_0xb814('0x2e')]=_[_0xb814('0x2f')](db['License'][_0xb814('0x30')]);_0x499f22['query']=_[_0xb814('0x2f')](_0x9008b2['query']);_0x499f22['filters']=_[_0xb814('0x31')](_0x499f22['model'],_0x499f22[_0xb814('0x32')]);_0x530744[_0xb814('0x33')]=_[_0xb814('0x31')](_0x499f22['model'],qs['fields'](_0x9008b2[_0xb814('0x32')][_0xb814('0x34')]));_0x530744['attributes']=_0x530744[_0xb814('0x33')][_0xb814('0x35')]?_0x530744[_0xb814('0x33')]:_0x499f22[_0xb814('0x2e')];_0x530744=_[_0xb814('0x36')]({},_0x530744,_0x9008b2[_0xb814('0x37')]);return utilLicense[_0xb814('0x38')](_0x530744)['then'](respondWithResult(_0x37d24d,null))[_0xb814('0x39')](handleError(_0x37d24d,null));};exports[_0xb814('0x27')]=function(_0x30de5a,_0x424e2b){if(_0x30de5a[_0xb814('0x3a')]['id']){delete _0x30de5a['body']['id'];}return db[_0xb814('0x3b')]['find']({'where':{'id':_0x30de5a[_0xb814('0x3c')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x424e2b,null))[_0xb814('0x28')](function(_0x492d5e){var _0x40b885=_0x492d5e[_0xb814('0x3d')]({'plain':!![]});return utilLicense['checkLicense'](_0x40b885,_0x30de5a[_0xb814('0x3a')][_0xb814('0x3e')]);})[_0xb814('0x28')](function(_0x1f7cd8){if(!_0x1f7cd8[_0xb814('0x3f')]){return saveUpdates(_0x30de5a[_0xb814('0x3a')],null);}return _0x1f7cd8;})['then'](respondWithResult(_0x424e2b,null))[_0xb814('0x39')](handleError(_0x424e2b,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 6eec448..11d629f 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 _0x3752=['rimraf','../../config/environment','./license.attributes','exports','define','License','license','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x41127b,_0x27dacb){var _0x1cc300=function(_0x3fd3ff){while(--_0x3fd3ff){_0x41127b['push'](_0x41127b['shift']());}};_0x1cc300(++_0x27dacb);}(_0x3752,0x165));var _0x2375=function(_0x416d75,_0x2c8e81){_0x416d75=_0x416d75-0x0;var _0x10af66=_0x3752[_0x416d75];return _0x10af66;};'use strict';var _=require('lodash');var util=require(_0x2375('0x0'));var logger=require(_0x2375('0x1'))(_0x2375('0x2'));var moment=require(_0x2375('0x3'));var BPromise=require(_0x2375('0x4'));var rp=require(_0x2375('0x5'));var fs=require('fs');var path=require(_0x2375('0x6'));var rimraf=require(_0x2375('0x7'));var config=require(_0x2375('0x8'));var attributes=require(_0x2375('0x9'));module[_0x2375('0xa')]=function(_0x25b8d8,_0x3bdfcd){return _0x25b8d8[_0x2375('0xb')](_0x2375('0xc'),attributes,{'tableName':_0x2375('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e6f=['path','rimraf','./license.attributes','exports','License','license','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x216f27,_0x39c925){var _0x1d2f17=function(_0x59fc55){while(--_0x59fc55){_0x216f27['push'](_0x216f27['shift']());}};_0x1d2f17(++_0x39c925);}(_0x0e6f,0x1b3));var _0xf0e6=function(_0x89cb3a,_0x385fd1){_0x89cb3a=_0x89cb3a-0x0;var _0x407cf1=_0x0e6f[_0x89cb3a];return _0x407cf1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf0e6('0x0'))(_0xf0e6('0x1'));var moment=require(_0xf0e6('0x2'));var BPromise=require(_0xf0e6('0x3'));var rp=require(_0xf0e6('0x4'));var fs=require('fs');var path=require(_0xf0e6('0x5'));var rimraf=require(_0xf0e6('0x6'));var config=require('../../config/environment');var attributes=require(_0xf0e6('0x7'));module[_0xf0e6('0x8')]=function(_0x281912,_0x43b3c7){return _0x281912['define'](_0xf0e6('0x9'),attributes,{'tableName':_0xf0e6('0xa'),'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 1589dde..ed23f06 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 _0x2eec=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','License,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x4c1d68,_0x34204d){var _0x4ae0a2=function(_0xb04bff){while(--_0xb04bff){_0x4c1d68['push'](_0x4c1d68['shift']());}};_0x4ae0a2(++_0x34204d);}(_0x2eec,0x1e5));var _0xc2ee=function(_0x1b9f88,_0x1b0f15){_0x1b9f88=_0x1b9f88-0x0;var _0x52c213=_0x2eec[_0x1b9f88];return _0x52c213;};'use strict';var _=require(_0xc2ee('0x0'));var util=require(_0xc2ee('0x1'));var moment=require(_0xc2ee('0x2'));var BPromise=require(_0xc2ee('0x3'));var rs=require(_0xc2ee('0x4'));var fs=require('fs');var Redis=require(_0xc2ee('0x5'));var db=require(_0xc2ee('0x6'))['db'];var utils=require(_0xc2ee('0x7'));var logger=require(_0xc2ee('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc2ee('0x9'));var client=jayson[_0xc2ee('0xa')][_0xc2ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e1b6f,_0x3c1786,_0x730fb0){return new BPromise(function(_0xcf3f03,_0x30c9f5){return client['request'](_0x5e1b6f,_0x730fb0)[_0xc2ee('0xc')](function(_0x4f51f3){logger[_0xc2ee('0xd')](_0xc2ee('0xe'),_0x3c1786,_0xc2ee('0xf'));logger[_0xc2ee('0x10')]('License,\x20%s,\x20%s,\x20%s',_0x3c1786,_0xc2ee('0xf'),JSON[_0xc2ee('0x11')](_0x4f51f3));if(_0x4f51f3[_0xc2ee('0x12')]){if(_0x4f51f3[_0xc2ee('0x12')][_0xc2ee('0x13')]===0x1f4){logger[_0xc2ee('0x12')](_0xc2ee('0xe'),_0x3c1786,_0x4f51f3[_0xc2ee('0x12')][_0xc2ee('0x14')]);return _0x30c9f5(_0x4f51f3[_0xc2ee('0x12')][_0xc2ee('0x14')]);}logger[_0xc2ee('0x12')](_0xc2ee('0xe'),_0x3c1786,_0x4f51f3['error']['message']);return _0xcf3f03(_0x4f51f3[_0xc2ee('0x12')]['message']);}else{logger[_0xc2ee('0xd')](_0xc2ee('0xe'),_0x3c1786,'request\x20sent');_0xcf3f03(_0x4f51f3[_0xc2ee('0x15')][_0xc2ee('0x14')]);}})[_0xc2ee('0x16')](function(_0x3fd0e0){logger[_0xc2ee('0x12')](_0xc2ee('0xe'),_0x3c1786,_0x3fd0e0);_0x30c9f5(_0x3fd0e0);});});} \ No newline at end of file +var _0xb9d9=['ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','error','License,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring'];(function(_0x4b8410,_0x4babf4){var _0x2d9bbf=function(_0x2a01d1){while(--_0x2a01d1){_0x4b8410['push'](_0x4b8410['shift']());}};_0x2d9bbf(++_0x4babf4);}(_0xb9d9,0x10a));var _0x9b9d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb9d9[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x9b9d('0x0'));var util=require(_0x9b9d('0x1'));var moment=require('moment');var BPromise=require(_0x9b9d('0x2'));var rs=require(_0x9b9d('0x3'));var fs=require('fs');var Redis=require(_0x9b9d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9b9d('0x5'));var logger=require('../../config/logger')(_0x9b9d('0x6'));var config=require('../../config/environment');var jayson=require(_0x9b9d('0x7'));var client=jayson[_0x9b9d('0x8')][_0x9b9d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1362a1,_0x15feb1,_0x455949){return new BPromise(function(_0x1a0d25,_0x2d4307){return client[_0x9b9d('0xa')](_0x1362a1,_0x455949)[_0x9b9d('0xb')](function(_0x5a724b){logger[_0x9b9d('0xc')]('License,\x20%s,\x20%s',_0x15feb1,_0x9b9d('0xd'));logger['debug']('License,\x20%s,\x20%s,\x20%s',_0x15feb1,_0x9b9d('0xd'),JSON['stringify'](_0x5a724b));if(_0x5a724b[_0x9b9d('0xe')]){if(_0x5a724b[_0x9b9d('0xe')]['code']===0x1f4){logger[_0x9b9d('0xe')](_0x9b9d('0xf'),_0x15feb1,_0x5a724b[_0x9b9d('0xe')][_0x9b9d('0x10')]);return _0x2d4307(_0x5a724b[_0x9b9d('0xe')][_0x9b9d('0x10')]);}logger['error']('License,\x20%s,\x20%s',_0x15feb1,_0x5a724b[_0x9b9d('0xe')][_0x9b9d('0x10')]);return _0x1a0d25(_0x5a724b[_0x9b9d('0xe')][_0x9b9d('0x10')]);}else{logger['info'](_0x9b9d('0xf'),_0x15feb1,_0x9b9d('0xd'));_0x1a0d25(_0x5a724b[_0x9b9d('0x11')]['message']);}})['catch'](function(_0x22714d){logger[_0x9b9d('0xe')](_0x9b9d('0xf'),_0x15feb1,_0x22714d);_0x2d4307(_0x22714d);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 401c329..79e5ddf 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 _0x3c82=['/:id/users','post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','delete','removeDispositions','removeAnswers','removeImap','/:id/out_servers','removeSmtp','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/verify','verifySmtp'];(function(_0x514b3b,_0x4973b1){var _0x336648=function(_0x417336){while(--_0x417336){_0x514b3b['push'](_0x514b3b['shift']());}};_0x336648(++_0x4973b1);}(_0x3c82,0x7b));var _0x23c8=function(_0x127215,_0x57c99b){_0x127215=_0x127215-0x0;var _0x4fd80d=_0x3c82[_0x127215];return _0x4fd80d;};'use strict';var multer=require(_0x23c8('0x0'));var util=require(_0x23c8('0x1'));var path=require(_0x23c8('0x2'));var timeout=require(_0x23c8('0x3'));var express=require(_0x23c8('0x4'));var router=express[_0x23c8('0x5')]();var fs_extra=require(_0x23c8('0x6'));var auth=require(_0x23c8('0x7'));var interaction=require(_0x23c8('0x8'));var config=require(_0x23c8('0x9'));var controller=require(_0x23c8('0xa'));router[_0x23c8('0xb')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x23c8('0xc'),auth[_0x23c8('0xd')](),controller['describe']);router[_0x23c8('0xb')](_0x23c8('0xe'),auth[_0x23c8('0xd')](),controller[_0x23c8('0xf')]);router[_0x23c8('0xb')](_0x23c8('0x10'),auth[_0x23c8('0xd')](),controller[_0x23c8('0x11')]);router[_0x23c8('0xb')](_0x23c8('0x12'),auth[_0x23c8('0xd')](),controller[_0x23c8('0x13')]);router[_0x23c8('0xb')](_0x23c8('0x14'),auth[_0x23c8('0xd')](),controller[_0x23c8('0x15')]);router[_0x23c8('0xb')]('/:id/out_servers',auth[_0x23c8('0xd')](),controller[_0x23c8('0x16')]);router[_0x23c8('0xb')](_0x23c8('0x17'),auth[_0x23c8('0xd')](),controller[_0x23c8('0x18')]);router['get'](_0x23c8('0x19'),auth[_0x23c8('0xd')](),controller[_0x23c8('0x1a')]);router['get'](_0x23c8('0x1b'),auth[_0x23c8('0xd')](),controller['getMessages']);router[_0x23c8('0xb')](_0x23c8('0x1c'),auth[_0x23c8('0xd')](),controller[_0x23c8('0x1d')]);router['get'](_0x23c8('0x1e'),auth[_0x23c8('0xd')](),controller['getAgents']);router[_0x23c8('0x1f')](_0x23c8('0x10'),auth[_0x23c8('0xd')](),controller[_0x23c8('0x20')]);router[_0x23c8('0x1f')](_0x23c8('0x12'),auth['isAuthenticated'](),controller[_0x23c8('0x21')]);router[_0x23c8('0x1f')]('/',auth[_0x23c8('0xd')](),controller[_0x23c8('0x22')]);router['post'](_0x23c8('0x14'),auth[_0x23c8('0xd')](),controller[_0x23c8('0x23')]);router['post']('/:id/out_servers',auth[_0x23c8('0xd')](),controller[_0x23c8('0x24')]);router[_0x23c8('0x1f')](_0x23c8('0x17'),auth[_0x23c8('0xd')](),controller[_0x23c8('0x25')]);router[_0x23c8('0x1f')]('/:id/applications',auth[_0x23c8('0xd')](),controller[_0x23c8('0x26')]);router[_0x23c8('0x1f')](_0x23c8('0x27'),auth[_0x23c8('0xd')](),controller[_0x23c8('0x28')]);router[_0x23c8('0x1f')]('/:id/users',auth['isAuthenticated'](),controller[_0x23c8('0x29')]);router[_0x23c8('0x2a')](_0x23c8('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x23c8('0x2b')](_0x23c8('0x10'),auth['isAuthenticated'](),controller[_0x23c8('0x2c')]);router[_0x23c8('0x2b')]('/:id/canned_answers',auth[_0x23c8('0xd')](),controller[_0x23c8('0x2d')]);router['delete'](_0x23c8('0x14'),auth[_0x23c8('0xd')](),controller[_0x23c8('0x2e')]);router[_0x23c8('0x2b')](_0x23c8('0x2f'),auth[_0x23c8('0xd')](),controller[_0x23c8('0x30')]);router['delete'](_0x23c8('0xe'),auth['isAuthenticated'](),controller[_0x23c8('0x31')]);router['delete'](_0x23c8('0x1e'),auth[_0x23c8('0xd')](),controller['removeAgents']);module[_0x23c8('0x32')]=router; \ No newline at end of file +var _0x782f=['getAgents','post','addAnswer','addImap','addSmtp','/:id/interactions','addApplications','/:id/send','send','addAgents','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users'];(function(_0x1a8cf7,_0x47ab80){var _0x5b2950=function(_0x5c6206){while(--_0x5c6206){_0x1a8cf7['push'](_0x1a8cf7['shift']());}};_0x5b2950(++_0x47ab80);}(_0x782f,0x1c3));var _0xf782=function(_0x28f6c3,_0x48bec1){_0x28f6c3=_0x28f6c3-0x0;var _0x2e3256=_0x782f[_0x28f6c3];return _0x2e3256;};'use strict';var multer=require(_0xf782('0x0'));var util=require('util');var path=require(_0xf782('0x1'));var timeout=require(_0xf782('0x2'));var express=require('express');var router=express[_0xf782('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf782('0x4'));var interaction=require(_0xf782('0x5'));var config=require('../../config/environment');var controller=require('./mailAccount.controller');router[_0xf782('0x6')]('/',auth['isAuthenticated'](),controller[_0xf782('0x7')]);router[_0xf782('0x6')](_0xf782('0x8'),auth[_0xf782('0x9')](),controller[_0xf782('0xa')]);router[_0xf782('0x6')](_0xf782('0xb'),auth[_0xf782('0x9')](),controller[_0xf782('0xc')]);router['get'](_0xf782('0xd'),auth[_0xf782('0x9')](),controller[_0xf782('0xe')]);router['get'](_0xf782('0xf'),auth[_0xf782('0x9')](),controller[_0xf782('0x10')]);router[_0xf782('0x6')](_0xf782('0x11'),auth[_0xf782('0x9')](),controller[_0xf782('0x12')]);router[_0xf782('0x6')](_0xf782('0x13'),auth['isAuthenticated'](),controller[_0xf782('0x14')]);router[_0xf782('0x6')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xf782('0x15')]);router[_0xf782('0x6')](_0xf782('0x16'),auth['isAuthenticated'](),controller[_0xf782('0x17')]);router[_0xf782('0x6')](_0xf782('0x18'),auth[_0xf782('0x9')](),controller[_0xf782('0x19')]);router['get'](_0xf782('0x1a'),auth[_0xf782('0x9')](),controller[_0xf782('0x1b')]);router[_0xf782('0x6')](_0xf782('0x1c'),auth[_0xf782('0x9')](),controller[_0xf782('0x1d')]);router[_0xf782('0x1e')](_0xf782('0xd'),auth[_0xf782('0x9')](),controller['addDisposition']);router[_0xf782('0x1e')](_0xf782('0xf'),auth[_0xf782('0x9')](),controller[_0xf782('0x1f')]);router['post']('/',auth[_0xf782('0x9')](),controller['create']);router['post'](_0xf782('0x11'),auth[_0xf782('0x9')](),controller[_0xf782('0x20')]);router[_0xf782('0x1e')](_0xf782('0x13'),auth[_0xf782('0x9')](),controller[_0xf782('0x21')]);router[_0xf782('0x1e')](_0xf782('0x22'),auth[_0xf782('0x9')](),controller['addInteraction']);router['post']('/:id/applications',auth[_0xf782('0x9')](),controller[_0xf782('0x23')]);router['post'](_0xf782('0x24'),auth[_0xf782('0x9')](),controller[_0xf782('0x25')]);router[_0xf782('0x1e')](_0xf782('0x1c'),auth[_0xf782('0x9')](),controller[_0xf782('0x26')]);router['put']('/:id',auth[_0xf782('0x9')](),controller[_0xf782('0x27')]);router[_0xf782('0x28')](_0xf782('0xd'),auth[_0xf782('0x9')](),controller[_0xf782('0x29')]);router[_0xf782('0x28')](_0xf782('0xf'),auth[_0xf782('0x9')](),controller[_0xf782('0x2a')]);router[_0xf782('0x28')]('/:id/in_servers',auth[_0xf782('0x9')](),controller[_0xf782('0x2b')]);router[_0xf782('0x28')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0xf782('0x2c')]);router[_0xf782('0x28')](_0xf782('0xb'),auth[_0xf782('0x9')](),controller[_0xf782('0x2d')]);router[_0xf782('0x28')](_0xf782('0x1c'),auth[_0xf782('0x9')](),controller[_0xf782('0x2e')]);module[_0xf782('0x2f')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 48dd91d..c0f9b82 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 _0x202c=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','BOOLEAN','TEXT','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0xb77dd4,_0x371dd8){var _0x29db3c=function(_0x37f493){while(--_0x37f493){_0xb77dd4['push'](_0xb77dd4['shift']());}};_0x29db3c(++_0x371dd8);}(_0x202c,0x178));var _0xc202=function(_0x684d5f,_0x4c5aa9){_0x684d5f=_0x684d5f-0x0;var _0x197a09=_0x202c[_0x684d5f];return _0x197a09;};'use strict';var Sequelize=require(_0xc202('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xc202('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0xc202('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xc202('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xc202('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xc202('0x3')]},'markAsUnread':{'type':Sequelize[_0xc202('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xc202('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xc202('0x4')](0x2)[_0xc202('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xc202('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc202('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc202('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc202('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc202('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc202('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc202('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc202('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0xc202('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xc202('0x2')],'defaultValue':![],'comment':_0xc202('0x8'),'set':function(_0x630e57){if(!_0x630e57)this[_0xc202('0x9')](_0xc202('0xa'),null);this['setDataValue'](_0xc202('0xb'),_0x630e57);}}}; \ No newline at end of file +var _0x43fd=['exports','BOOLEAN','STRING','Arial,Helvetica,sans-serif','INTEGER','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x15b0df,_0x45d1c6){var _0x18575c=function(_0x4baffe){while(--_0x4baffe){_0x15b0df['push'](_0x15b0df['shift']());}};_0x18575c(++_0x45d1c6);}(_0x43fd,0x1ec));var _0xd43f=function(_0x376651,_0x39a790){_0x376651=_0x376651-0x0;var _0x2f24e6=_0x43fd[_0x376651];return _0x2f24e6;};'use strict';var Sequelize=require('sequelize');module[_0xd43f('0x0')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0xd43f('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0xd43f('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xd43f('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xd43f('0x1')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xd43f('0x2')],'allowNull':![],'defaultValue':_0xd43f('0x3')},'fontSize':{'type':Sequelize[_0xd43f('0x4')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xd43f('0x5')],'defaultValue':function(){return _0xd43f('0x6');}},'notificationSound':{'type':Sequelize[_0xd43f('0x1')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd43f('0x1')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd43f('0x1')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd43f('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd43f('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd43f('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0xd43f('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xd43f('0x1')],'defaultValue':![],'comment':_0xd43f('0x8'),'set':function(_0x5eb0bb){if(!_0x5eb0bb)this[_0xd43f('0x9')](_0xd43f('0xa'),null);this[_0xd43f('0x9')](_0xd43f('0xb'),_0x5eb0bb);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 0988a3d..4fbaf84 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 _0x02b5=['merge','options','include','findAll','show','keys','includeAll','body','find','params','describe','addDisposition','MailAccountId','getDispositions','Disposition','rows','ids','addAnswer','CannedAnswer','create','findOne','nolimit','removeAnswers','isNil','active','description','cservice','cauthentication','user','cuser','cpassword','authentication','host','port','service','password','pass','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','addSmtp','removeSmtp','MailInteraction','addInteraction','CmContact','Contact','User','Owner','internal','Tag','Tags','color','tag','MailApplication','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','updatedAt','from','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','Contacts','ListId','messageId','attach','out','Interaction','Messages','VerifySmtp','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','html-to-text','juice','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','./mailAccount.socket','register','jayson/promise','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','offset','undefined','count','limit','json','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL'];(function(_0xb54705,_0x554359){var _0x1f4ecd=function(_0x168a30){while(--_0x168a30){_0xb54705['push'](_0xb54705['shift']());}};_0x1f4ecd(++_0x554359);}(_0x02b5,0x12c));var _0x502b=function(_0x59bcc6,_0xdc27e6){_0x59bcc6=_0x59bcc6-0x0;var _0x12c375=_0x02b5[_0x59bcc6];return _0x12c375;};'use strict';var emlformat=require(_0x502b('0x0'));var rimraf=require(_0x502b('0x1'));var zipdir=require(_0x502b('0x2'));var jsonpatch=require(_0x502b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x502b('0x4'));var Mustache=require(_0x502b('0x5'));var util=require(_0x502b('0x6'));var path=require(_0x502b('0x7'));var sox=require(_0x502b('0x8'));var csv=require(_0x502b('0x9'));var ejs=require(_0x502b('0xa'));var fs=require('fs');var fs_extra=require(_0x502b('0xb'));var _=require(_0x502b('0xc'));var squel=require(_0x502b('0xd'));var crypto=require(_0x502b('0xe'));var jsforce=require(_0x502b('0xf'));var deskjs=require(_0x502b('0x10'));var toCsv=require(_0x502b('0x9'));var querystring=require(_0x502b('0x11'));var Papa=require('papaparse');var htmlToText=require(_0x502b('0x12'));var juice=require(_0x502b('0x13'));var Redis=require(_0x502b('0x14'));var authService=require(_0x502b('0x15'));var qs=require(_0x502b('0x16'));var as=require(_0x502b('0x17'));var hardwareService=require(_0x502b('0x18'));var logger=require(_0x502b('0x19'))(_0x502b('0x1a'));var utils=require(_0x502b('0x1b'));var config=require(_0x502b('0x1c'));var licenseUtil=require(_0x502b('0x1d'));var db=require(_0x502b('0x1e'))['db'];config[_0x502b('0x1f')]=_[_0x502b('0x20')](config[_0x502b('0x1f')],{'host':_0x502b('0x21'),'port':0x18eb});var socket=require(_0x502b('0x22'))(new Redis(config[_0x502b('0x1f')]));require(_0x502b('0x23'))[_0x502b('0x24')](socket);var jayson=require(_0x502b('0x25'));var client=jayson['client'][_0x502b('0x26')]({'port':0x232b});function respondWithRpcPromise(_0x5c4ac0,_0x5613d6,_0x21bcae,_0x16a1c7){return new BPromise(function(_0xc0028e,_0x1b26e7){var _0x18ad60=_0x16a1c7||client;return _0x18ad60[_0x502b('0x27')](_0x5c4ac0,_0x21bcae)['then'](function(_0x4e744c){logger[_0x502b('0x28')](_0x502b('0x29'),_0x5613d6,_0x502b('0x2a'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x5613d6,_0x502b('0x2a'),JSON['stringify'](_0x4e744c));if(_0x4e744c[_0x502b('0x2b')]){if(_0x4e744c[_0x502b('0x2b')][_0x502b('0x2c')]===0x1f4){logger[_0x502b('0x2b')](_0x502b('0x29'),_0x5613d6,_0x4e744c[_0x502b('0x2b')][_0x502b('0x2d')]);return _0x1b26e7(_0x4e744c['error'][_0x502b('0x2d')]);}logger[_0x502b('0x2b')](_0x502b('0x29'),_0x5613d6,_0x4e744c[_0x502b('0x2b')][_0x502b('0x2d')]);return _0xc0028e(_0x4e744c[_0x502b('0x2b')][_0x502b('0x2d')]);}else{logger[_0x502b('0x28')](_0x502b('0x29'),_0x5613d6,_0x502b('0x2a'));_0xc0028e(_0x4e744c[_0x502b('0x2e')][_0x502b('0x2d')]);}})[_0x502b('0x2f')](function(_0x5842e8){logger['error'](_0x502b('0x29'),_0x5613d6,_0x5842e8);_0x1b26e7(_0x5842e8);});});}function respondWithStatusCode(_0x5732f3,_0x4eaf6a){_0x4eaf6a=_0x4eaf6a||0xcc;return function(_0x5e7038){if(_0x5e7038){return _0x5732f3[_0x502b('0x30')](_0x4eaf6a);}return _0x5732f3[_0x502b('0x31')](_0x4eaf6a)[_0x502b('0x32')]();};}function respondWithResult(_0x4c378e,_0x3920b4){_0x3920b4=_0x3920b4||0xc8;return function(_0x2b2d04){if(_0x2b2d04){return _0x4c378e['status'](_0x3920b4)['json'](_0x2b2d04);}};}function respondWithFilteredResult(_0x54b40c,_0x342455){return function(_0x4851a6){if(_0x4851a6){var _0x2692f3=typeof _0x342455[_0x502b('0x33')]===_0x502b('0x34')&&typeof _0x342455['limit']===_0x502b('0x34');var _0x4fff59=_0x4851a6[_0x502b('0x35')];var _0x1af899=_0x2692f3?0x0:_0x342455['offset'];var _0x4915b0=_0x2692f3?_0x4851a6['count']:_0x342455['offset']+_0x342455[_0x502b('0x36')];var _0x45785e;if(_0x4915b0>=_0x4fff59){_0x4915b0=_0x4fff59;_0x45785e=0xc8;}else{_0x45785e=0xce;}_0x54b40c[_0x502b('0x31')](_0x45785e);return _0x54b40c['set']('Content-Range',_0x1af899+'-'+_0x4915b0+'/'+_0x4fff59)[_0x502b('0x37')](_0x4851a6);}return null;};}function patchUpdates(_0x4601cc){return function(_0x3d33b1){try{jsonpatch[_0x502b('0x38')](_0x3d33b1,_0x4601cc,!![]);}catch(_0x25e08b){return BPromise[_0x502b('0x39')](_0x25e08b);}return _0x3d33b1[_0x502b('0x3a')]();};}function saveUpdates(_0x3dcb84,_0x4adac1){return function(_0x4d8eec){if(_0x4d8eec){return _0x4d8eec[_0x502b('0x3b')](_0x3dcb84)[_0x502b('0x3c')](function(_0x4100f2){return _0x4100f2;});}return null;};}function removeEntity(_0x1b4931,_0x28a41f){return function(_0x3a2a7f){if(_0x3a2a7f){return _0x3a2a7f[_0x502b('0x3d')]()[_0x502b('0x3c')](function(){var _0x3d0bb7=_0x3a2a7f[_0x502b('0x3e')]({'plain':!![]});var _0x5abfd1='MailAccounts';return db[_0x502b('0x3f')][_0x502b('0x3d')]({'where':{'type':_0x5abfd1,'resourceId':_0x3d0bb7['id']}})[_0x502b('0x3c')](function(){return _0x3a2a7f;});})[_0x502b('0x3c')](function(){_0x1b4931[_0x502b('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x474b68,_0x26333d){return function(_0x2b5cea){if(!_0x2b5cea){_0x474b68[_0x502b('0x30')](0x194);}return _0x2b5cea;};}function handleError(_0x50a2b0,_0x1f8b9c){_0x1f8b9c=_0x1f8b9c||0x1f4;return function(_0x1b7c53){logger['error'](_0x1b7c53[_0x502b('0x40')]);if(_0x1b7c53[_0x502b('0x41')]){delete _0x1b7c53['name'];}_0x50a2b0['status'](_0x1f8b9c)[_0x502b('0x42')](_0x1b7c53);};}exports[_0x502b('0x43')]=function(_0x442ccd,_0x5db8d0){var _0x35e3a1={'include':[{'model':db[_0x502b('0x44')],'as':_0x502b('0x45')},{'model':db[_0x502b('0x46')],'as':_0x502b('0x47')},{'model':db[_0x502b('0x48')],'as':_0x502b('0x49')}]},_0x2a785e={},_0x52a978={'count':0x0,'rows':[]};var _0x20d183=_[_0x502b('0x4a')](db[_0x502b('0x4b')][_0x502b('0x4c')],function(_0x11bff8){return{'name':_0x11bff8[_0x502b('0x4d')],'type':_0x11bff8[_0x502b('0x4e')][_0x502b('0x4f')]};});_0x2a785e[_0x502b('0x50')]=_[_0x502b('0x4a')](_0x20d183,_0x502b('0x41'));_0x2a785e[_0x502b('0x51')]=_['keys'](_0x442ccd[_0x502b('0x51')]);_0x2a785e['filters']=_[_0x502b('0x52')](_0x2a785e['model'],_0x2a785e[_0x502b('0x51')]);_0x35e3a1['attributes']=_[_0x502b('0x52')](_0x2a785e['model'],qs[_0x502b('0x53')](_0x442ccd[_0x502b('0x51')][_0x502b('0x53')]));_0x35e3a1[_0x502b('0x54')]=_0x35e3a1['attributes'][_0x502b('0x55')]?_0x35e3a1['attributes']:_0x2a785e['model'];if(!_0x442ccd[_0x502b('0x51')][_0x502b('0x56')]('nolimit')){_0x35e3a1[_0x502b('0x36')]=qs[_0x502b('0x36')](_0x442ccd['query']['limit']);_0x35e3a1[_0x502b('0x33')]=qs[_0x502b('0x33')](_0x442ccd[_0x502b('0x51')][_0x502b('0x33')]);}_0x35e3a1[_0x502b('0x57')]=qs[_0x502b('0x58')](_0x442ccd[_0x502b('0x51')][_0x502b('0x58')]);_0x35e3a1[_0x502b('0x59')]=qs[_0x502b('0x5a')](_[_0x502b('0x5b')](_0x442ccd['query'],_0x2a785e[_0x502b('0x5a')]),_0x20d183);if(_0x442ccd[_0x502b('0x51')][_0x502b('0x5c')]){_0x35e3a1['where']=_['merge'](_0x35e3a1['where'],{'$or':_[_0x502b('0x4a')](_0x20d183,function(_0x5cf7d1){if(_0x5cf7d1[_0x502b('0x4e')]!==_0x502b('0x5d')){var _0x1364e8={};_0x1364e8[_0x5cf7d1[_0x502b('0x41')]]={'$like':'%'+_0x442ccd[_0x502b('0x51')]['filter']+'%'};return _0x1364e8;}})});}_0x35e3a1=_[_0x502b('0x5e')]({},_0x35e3a1,_0x442ccd[_0x502b('0x5f')]);var _0x184ab1={'where':_0x35e3a1[_0x502b('0x59')]};return db[_0x502b('0x4b')][_0x502b('0x35')](_0x184ab1)[_0x502b('0x3c')](function(_0x50e526){_0x52a978['count']=_0x50e526;if(_0x442ccd[_0x502b('0x51')]['includeAll']){_0x35e3a1[_0x502b('0x60')]=[{'all':!![]}];}return db[_0x502b('0x4b')][_0x502b('0x61')](_0x35e3a1);})['then'](function(_0x4fe777){_0x52a978['rows']=_0x4fe777;return _0x52a978;})[_0x502b('0x3c')](respondWithFilteredResult(_0x5db8d0,_0x35e3a1))[_0x502b('0x2f')](handleError(_0x5db8d0,null));};exports[_0x502b('0x62')]=function(_0xd31163,_0xc896f2){var _0x723a4e={'raw':![],'where':{'id':_0xd31163['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x502b('0x45')},{'model':db[_0x502b('0x46')],'as':_0x502b('0x47')},{'model':db[_0x502b('0x48')],'as':_0x502b('0x49')}]},_0x54b837={};_0x54b837[_0x502b('0x50')]=_[_0x502b('0x63')](db[_0x502b('0x4b')][_0x502b('0x4c')]);_0x54b837['query']=_['keys'](_0xd31163[_0x502b('0x51')]);_0x54b837[_0x502b('0x5a')]=_['intersection'](_0x54b837[_0x502b('0x50')],_0x54b837[_0x502b('0x51')]);_0x723a4e['attributes']=_[_0x502b('0x52')](_0x54b837['model'],qs[_0x502b('0x53')](_0xd31163[_0x502b('0x51')][_0x502b('0x53')]));_0x723a4e[_0x502b('0x54')]=_0x723a4e[_0x502b('0x54')][_0x502b('0x55')]?_0x723a4e[_0x502b('0x54')]:_0x54b837[_0x502b('0x50')];if(_0xd31163[_0x502b('0x51')][_0x502b('0x64')]){_0x723a4e['include']=[{'all':!![]}];}_0x723a4e=_['merge']({},_0x723a4e,_0xd31163['options']);return db[_0x502b('0x4b')]['find'](_0x723a4e)[_0x502b('0x3c')](handleEntityNotFound(_0xc896f2,null))[_0x502b('0x3c')](respondWithResult(_0xc896f2,null))[_0x502b('0x2f')](handleError(_0xc896f2,null));};exports[_0x502b('0x3b')]=function(_0x1d5208,_0xbccf3b){if(_0x1d5208['body']['id']){delete _0x1d5208[_0x502b('0x65')]['id'];}return db[_0x502b('0x4b')][_0x502b('0x66')]({'where':{'id':_0x1d5208[_0x502b('0x67')]['id']},'include':[{'model':db[_0x502b('0x44')],'as':_0x502b('0x45')},{'model':db[_0x502b('0x46')],'as':_0x502b('0x47')},{'model':db[_0x502b('0x48')],'as':_0x502b('0x49')}]})[_0x502b('0x3c')](handleEntityNotFound(_0xbccf3b,null))[_0x502b('0x3c')](saveUpdates(_0x1d5208['body'],null))['then'](function(_0x41704a){if(_0x41704a&&_0x1d5208[_0x502b('0x65')][_0x502b('0x45')]){return db['MailServerIn'][_0x502b('0x3b')](_0x1d5208['body'][_0x502b('0x45')],{'where':{'MailAccountId':_0x41704a['id']}})[_0x502b('0x3c')](function(){return _0x41704a;});}return _0x41704a;})[_0x502b('0x3c')](function(_0x70a34d){if(_0x70a34d&&_0x1d5208['body'][_0x502b('0x47')]){return db[_0x502b('0x46')][_0x502b('0x3b')](_0x1d5208[_0x502b('0x65')][_0x502b('0x47')],{'where':{'MailAccountId':_0x70a34d['id']}})[_0x502b('0x3c')](function(){return _0x70a34d;});}return _0x70a34d;})['then'](respondWithResult(_0xbccf3b,null))[_0x502b('0x2f')](handleError(_0xbccf3b,null));};exports[_0x502b('0x68')]=function(_0x3eb795,_0x49e45c){return db[_0x502b('0x4b')]['describe']()['then'](respondWithResult(_0x49e45c,null))['catch'](handleError(_0x49e45c,null));};exports[_0x502b('0x69')]=function(_0x59dfd9,_0x20b1ae,_0x500237){if(_0x59dfd9[_0x502b('0x65')]['id']){delete _0x59dfd9[_0x502b('0x65')]['id'];}return db[_0x502b('0x4b')][_0x502b('0x66')]({'where':{'id':_0x59dfd9[_0x502b('0x67')]['id']}})[_0x502b('0x3c')](handleEntityNotFound(_0x20b1ae,null))[_0x502b('0x3c')](function(_0x28c875){if(_0x28c875){_0x59dfd9[_0x502b('0x65')][_0x502b('0x6a')]=_0x28c875['id'];return db['Disposition']['create'](_0x59dfd9['body']);}})['then'](respondWithResult(_0x20b1ae,null))[_0x502b('0x2f')](handleError(_0x20b1ae,null));};exports[_0x502b('0x6b')]=function(_0x2aad2c,_0x1d65e7,_0x1ce92d){var _0x2f0474={'raw':![],'where':{}};var _0x3ceb99={};var _0x3a080f={'count':0x0,'rows':[]};return db[_0x502b('0x4b')]['findOne']({'where':{'id':_0x2aad2c[_0x502b('0x67')]['id']}})[_0x502b('0x3c')](handleEntityNotFound(_0x1d65e7,null))[_0x502b('0x3c')](function(_0x491843){if(_0x491843){_0x3ceb99[_0x502b('0x50')]=_[_0x502b('0x63')](db[_0x502b('0x6c')][_0x502b('0x4c')]);_0x3ceb99[_0x502b('0x51')]=_['keys'](_0x2aad2c[_0x502b('0x51')]);_0x3ceb99['filters']=_[_0x502b('0x52')](_0x3ceb99[_0x502b('0x50')],_0x3ceb99['query']);_0x2f0474['attributes']=_[_0x502b('0x52')](_0x3ceb99['model'],qs[_0x502b('0x53')](_0x2aad2c[_0x502b('0x51')][_0x502b('0x53')]));_0x2f0474[_0x502b('0x54')]=_0x2f0474[_0x502b('0x54')][_0x502b('0x55')]?_0x2f0474[_0x502b('0x54')]:_0x3ceb99['model'];if(!_0x2aad2c[_0x502b('0x51')][_0x502b('0x56')]('nolimit')){_0x2f0474[_0x502b('0x36')]=qs[_0x502b('0x36')](_0x2aad2c[_0x502b('0x51')][_0x502b('0x36')]);_0x2f0474[_0x502b('0x33')]=qs[_0x502b('0x33')](_0x2aad2c['query'][_0x502b('0x33')]);}_0x2f0474['order']=qs[_0x502b('0x58')](_0x2aad2c['query']['sort']);_0x2f0474[_0x502b('0x59')]=qs[_0x502b('0x5a')](_[_0x502b('0x5b')](_0x2aad2c['query'],_0x3ceb99['filters']));_0x2f0474['where']['MailAccountId']=_0x491843['id'];if(_0x2aad2c[_0x502b('0x51')][_0x502b('0x5c')]){_0x2f0474['where']=_['merge'](_0x2f0474['where'],{'$or':_[_0x502b('0x4a')](_0x2f0474[_0x502b('0x54')],function(_0x4f168a){var _0x37065a={};_0x37065a[_0x4f168a]={'$like':'%'+_0x2aad2c[_0x502b('0x51')][_0x502b('0x5c')]+'%'};return _0x37065a;})});}_0x2f0474=_['merge']({},_0x2f0474,_0x2aad2c[_0x502b('0x5f')]);return db[_0x502b('0x6c')][_0x502b('0x35')]({'where':_0x2f0474[_0x502b('0x59')]})['then'](function(_0x3d7b11){_0x3a080f[_0x502b('0x35')]=_0x3d7b11;if(_0x2aad2c[_0x502b('0x51')][_0x502b('0x64')]){_0x2f0474[_0x502b('0x60')]=[{'all':!![]}];}return db[_0x502b('0x6c')]['findAll'](_0x2f0474);})[_0x502b('0x3c')](function(_0x10c31e){_0x3a080f[_0x502b('0x6d')]=_0x10c31e;return _0x3a080f;});}})[_0x502b('0x3c')](respondWithFilteredResult(_0x1d65e7,_0x2f0474))[_0x502b('0x2f')](handleError(_0x1d65e7,null));};exports['removeDispositions']=function(_0x5db8cd,_0x4e961d,_0xf9cf69){return db[_0x502b('0x4b')]['find']({'where':{'id':_0x5db8cd[_0x502b('0x67')]['id']}})['then'](handleEntityNotFound(_0x4e961d,null))[_0x502b('0x3c')](function(_0x2ff71e){if(_0x2ff71e){return _0x2ff71e['removeDispositions'](_0x5db8cd['query'][_0x502b('0x6e')]);}})[_0x502b('0x3c')](respondWithStatusCode(_0x4e961d,null))[_0x502b('0x2f')](handleError(_0x4e961d,null));};exports[_0x502b('0x6f')]=function(_0x363504,_0x1e25d7,_0x3ed9c4){if(_0x363504[_0x502b('0x65')]['id']){delete _0x363504['body']['id'];}return db[_0x502b('0x4b')][_0x502b('0x66')]({'where':{'id':_0x363504[_0x502b('0x67')]['id']}})['then'](handleEntityNotFound(_0x1e25d7,null))[_0x502b('0x3c')](function(_0x479166){if(_0x479166){_0x363504['body'][_0x502b('0x6a')]=_0x479166['id'];return db[_0x502b('0x70')][_0x502b('0x71')](_0x363504[_0x502b('0x65')]);}})['then'](respondWithResult(_0x1e25d7,null))[_0x502b('0x2f')](handleError(_0x1e25d7,null));};exports['getAnswers']=function(_0x25bf81,_0x5b5a05,_0x2e9ef5){var _0xd92360={'raw':![],'where':{}};var _0x2714ac={};var _0x3b667c={'count':0x0,'rows':[]};return db[_0x502b('0x4b')][_0x502b('0x72')]({'where':{'id':_0x25bf81[_0x502b('0x67')]['id']}})[_0x502b('0x3c')](handleEntityNotFound(_0x5b5a05,null))[_0x502b('0x3c')](function(_0x9764de){if(_0x9764de){_0x2714ac['model']=_['keys'](db[_0x502b('0x70')]['rawAttributes']);_0x2714ac[_0x502b('0x51')]=_[_0x502b('0x63')](_0x25bf81[_0x502b('0x51')]);_0x2714ac['filters']=_[_0x502b('0x52')](_0x2714ac[_0x502b('0x50')],_0x2714ac[_0x502b('0x51')]);_0xd92360[_0x502b('0x54')]=_[_0x502b('0x52')](_0x2714ac[_0x502b('0x50')],qs[_0x502b('0x53')](_0x25bf81[_0x502b('0x51')][_0x502b('0x53')]));_0xd92360[_0x502b('0x54')]=_0xd92360[_0x502b('0x54')][_0x502b('0x55')]?_0xd92360[_0x502b('0x54')]:_0x2714ac[_0x502b('0x50')];if(!_0x25bf81[_0x502b('0x51')]['hasOwnProperty'](_0x502b('0x73'))){_0xd92360[_0x502b('0x36')]=qs['limit'](_0x25bf81[_0x502b('0x51')][_0x502b('0x36')]);_0xd92360[_0x502b('0x33')]=qs[_0x502b('0x33')](_0x25bf81[_0x502b('0x51')][_0x502b('0x33')]);}_0xd92360[_0x502b('0x57')]=qs[_0x502b('0x58')](_0x25bf81[_0x502b('0x51')][_0x502b('0x58')]);_0xd92360['where']=qs['filters'](_[_0x502b('0x5b')](_0x25bf81[_0x502b('0x51')],_0x2714ac[_0x502b('0x5a')]));_0xd92360[_0x502b('0x59')][_0x502b('0x6a')]=_0x9764de['id'];if(_0x25bf81[_0x502b('0x51')][_0x502b('0x5c')]){_0xd92360[_0x502b('0x59')]=_['merge'](_0xd92360[_0x502b('0x59')],{'$or':_['map'](_0xd92360['attributes'],function(_0x1deb72){var _0x8f5455={};_0x8f5455[_0x1deb72]={'$like':'%'+_0x25bf81[_0x502b('0x51')]['filter']+'%'};return _0x8f5455;})});}_0xd92360=_[_0x502b('0x5e')]({},_0xd92360,_0x25bf81['options']);return db[_0x502b('0x70')][_0x502b('0x35')]({'where':_0xd92360[_0x502b('0x59')]})[_0x502b('0x3c')](function(_0x2b6aab){_0x3b667c[_0x502b('0x35')]=_0x2b6aab;if(_0x25bf81[_0x502b('0x51')]['includeAll']){_0xd92360['include']=[{'all':!![]}];}return db[_0x502b('0x70')][_0x502b('0x61')](_0xd92360);})[_0x502b('0x3c')](function(_0x5ed6d9){_0x3b667c[_0x502b('0x6d')]=_0x5ed6d9;return _0x3b667c;});}})[_0x502b('0x3c')](respondWithFilteredResult(_0x5b5a05,_0xd92360))[_0x502b('0x2f')](handleError(_0x5b5a05,null));};exports[_0x502b('0x74')]=function(_0x542e71,_0x42d501,_0x57dd24){return db[_0x502b('0x4b')][_0x502b('0x66')]({'where':{'id':_0x542e71[_0x502b('0x67')]['id']}})[_0x502b('0x3c')](handleEntityNotFound(_0x42d501,null))[_0x502b('0x3c')](function(_0x38621c){if(_0x38621c){return _0x38621c[_0x502b('0x74')](_0x542e71[_0x502b('0x51')][_0x502b('0x6e')]);}})[_0x502b('0x3c')](respondWithStatusCode(_0x42d501,null))[_0x502b('0x2f')](handleError(_0x42d501,null));};exports[_0x502b('0x71')]=function(_0x474316,_0x1477dd){var _0x58dbb4={'name':_0x474316[_0x502b('0x65')]['name'],'key':_0x474316[_0x502b('0x65')][_0x502b('0x4f')],'email':_0x474316[_0x502b('0x65')]['email'],'ListId':_0x474316[_0x502b('0x65')]['ListId'],'active':!_[_0x502b('0x75')](_0x474316[_0x502b('0x65')][_0x502b('0x76')])?_0x474316[_0x502b('0x65')]['active']:!![],'description':_0x474316['body'][_0x502b('0x77')]||null,'Imap':{},'Smtp':{}};if(_[_0x502b('0x75')](_0x474316[_0x502b('0x65')][_0x502b('0x78')])){if(_0x474316[_0x502b('0x65')][_0x502b('0x79')]){_0x58dbb4[_0x502b('0x45')]['user']=_0x58dbb4[_0x502b('0x47')][_0x502b('0x7a')]=_0x474316[_0x502b('0x65')][_0x502b('0x7b')];_0x58dbb4[_0x502b('0x45')]['password']=_0x58dbb4[_0x502b('0x47')]['pass']=_0x474316[_0x502b('0x65')][_0x502b('0x7c')];}else{_0x58dbb4[_0x502b('0x45')][_0x502b('0x7d')]=_0x58dbb4['Smtp'][_0x502b('0x7d')]=![];}_0x58dbb4[_0x502b('0x45')][_0x502b('0x7e')]=_0x474316[_0x502b('0x65')][_0x502b('0x45')][_0x502b('0x7e')];_0x58dbb4[_0x502b('0x45')][_0x502b('0x7f')]=_0x474316[_0x502b('0x65')][_0x502b('0x45')][_0x502b('0x7f')];_0x58dbb4[_0x502b('0x47')]['host']=_0x474316[_0x502b('0x65')][_0x502b('0x47')][_0x502b('0x7e')];_0x58dbb4['Smtp']['port']=_0x474316[_0x502b('0x65')]['Smtp'][_0x502b('0x7f')];}else{_0x58dbb4[_0x502b('0x45')][_0x502b('0x80')]=_0x58dbb4[_0x502b('0x47')][_0x502b('0x80')]=_0x474316[_0x502b('0x65')][_0x502b('0x78')];_0x58dbb4[_0x502b('0x45')][_0x502b('0x7a')]=_0x58dbb4[_0x502b('0x47')][_0x502b('0x7a')]=_0x474316['body']['cuser'];_0x58dbb4[_0x502b('0x45')][_0x502b('0x81')]=_0x58dbb4[_0x502b('0x47')][_0x502b('0x82')]=_0x474316[_0x502b('0x65')]['cpassword'];}return db[_0x502b('0x4b')][_0x502b('0x71')](_0x58dbb4,{'include':[{'model':db['MailServerOut'],'as':_0x502b('0x47')},{'model':db['MailServerIn'],'as':'Imap'}]})[_0x502b('0x3c')](function(_0x7b005b){var _0x3d3356=_0x474316[_0x502b('0x7a')][_0x502b('0x3e')]({'plain':!![]});if(!_0x3d3356)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d3356[_0x502b('0x83')]===_0x502b('0x7a')){var _0x1ebe38=_0x7b005b[_0x502b('0x3e')]({'plain':!![]});return db[_0x502b('0x84')][_0x502b('0x66')]({'where':{'name':_0x502b('0x85'),'userProfileId':_0x3d3356[_0x502b('0x86')]},'raw':!![]})[_0x502b('0x3c')](function(_0x312072){if(_0x312072&&_0x312072[_0x502b('0x87')]===0x0){return db[_0x502b('0x3f')][_0x502b('0x71')]({'name':_0x1ebe38['name'],'resourceId':_0x1ebe38['id'],'type':_0x312072[_0x502b('0x41')],'sectionId':_0x312072['id']},{})['then'](function(){return _0x7b005b;});}else{return _0x7b005b;}})[_0x502b('0x2f')](function(_0x297aa3){logger[_0x502b('0x2b')](_0x502b('0x88'),_0x297aa3);throw _0x297aa3;});}return _0x7b005b;})['then'](respondWithResult(_0x1477dd,0xc9))[_0x502b('0x2f')](handleError(_0x1477dd,null));};exports[_0x502b('0x89')]=function(_0x10f320,_0x2ae1e5,_0x573bba){return db['MailAccount'][_0x502b('0x72')]({'where':{'id':_0x10f320[_0x502b('0x67')]['id']}})[_0x502b('0x3c')](handleEntityNotFound(_0x2ae1e5,null))[_0x502b('0x3c')](function(_0x41bc2b){if(_0x41bc2b){return _0x41bc2b['getImap']();}return null;})[_0x502b('0x3c')](respondWithResult(_0x2ae1e5,null))['catch'](handleError(_0x2ae1e5,null));};exports[_0x502b('0x8a')]=function(_0x3d63b1,_0x4f32ec,_0x5be160){if(_0x3d63b1[_0x502b('0x65')]['id']){delete _0x3d63b1[_0x502b('0x65')]['id'];}return db[_0x502b('0x4b')][_0x502b('0x66')]({'where':{'id':_0x3d63b1[_0x502b('0x67')]['id']}})['then'](handleEntityNotFound(_0x4f32ec,null))[_0x502b('0x3c')](function(_0x5a2219){if(_0x5a2219){_0x3d63b1[_0x502b('0x65')]['MailAccountId']=_0x5a2219['id'];return db[_0x502b('0x44')][_0x502b('0x71')](_0x3d63b1[_0x502b('0x65')]);}})['then'](respondWithResult(_0x4f32ec,null))['catch'](handleError(_0x4f32ec,null));};exports[_0x502b('0x8b')]=function(_0x1d5b53,_0x29b9a8,_0x4cde92){return db[_0x502b('0x4b')][_0x502b('0x72')]({'where':{'id':_0x1d5b53[_0x502b('0x67')]['id']}})['then'](handleEntityNotFound(_0x29b9a8,null))[_0x502b('0x3c')](function(_0xa6a895){if(_0xa6a895){return _0xa6a895['setImap'](null);}return null;})[_0x502b('0x3c')](respondWithStatusCode(_0x29b9a8,null))[_0x502b('0x2f')](handleError(_0x29b9a8,null));};exports['getSmtp']=function(_0xda0367,_0x493c91,_0x233f9a){return db[_0x502b('0x4b')][_0x502b('0x72')]({'where':{'id':_0xda0367[_0x502b('0x67')]['id']}})[_0x502b('0x3c')](handleEntityNotFound(_0x493c91,null))[_0x502b('0x3c')](function(_0x49cc68){if(_0x49cc68){return _0x49cc68['getSmtp']();}return null;})['then'](respondWithResult(_0x493c91,null))[_0x502b('0x2f')](handleError(_0x493c91,null));};exports[_0x502b('0x8c')]=function(_0x19e619,_0x156aa8,_0x126e20){if(_0x19e619[_0x502b('0x65')]['id']){delete _0x19e619['body']['id'];}return db[_0x502b('0x4b')][_0x502b('0x66')]({'where':{'id':_0x19e619[_0x502b('0x67')]['id']}})[_0x502b('0x3c')](handleEntityNotFound(_0x156aa8,null))['then'](function(_0x289389){if(_0x289389){_0x19e619[_0x502b('0x65')][_0x502b('0x6a')]=_0x289389['id'];return db[_0x502b('0x46')][_0x502b('0x71')](_0x19e619[_0x502b('0x65')]);}})['then'](respondWithResult(_0x156aa8,null))[_0x502b('0x2f')](handleError(_0x156aa8,null));};exports[_0x502b('0x8d')]=function(_0x1ac719,_0x1f087a,_0x13124a){return db['MailAccount'][_0x502b('0x72')]({'where':{'id':_0x1ac719['params']['id']}})[_0x502b('0x3c')](handleEntityNotFound(_0x1f087a,null))[_0x502b('0x3c')](function(_0xb61b2b){if(_0xb61b2b){return _0xb61b2b['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0x1f087a,null))[_0x502b('0x2f')](handleError(_0x1f087a,null));};exports['addInteraction']=function(_0x5ada36,_0x4b5af5,_0x40fbc4){return db[_0x502b('0x8e')][_0x502b('0x66')]({'where':{'id':_0x5ada36[_0x502b('0x67')]['id']}})[_0x502b('0x3c')](handleEntityNotFound(_0x4b5af5,null))['then'](function(_0x512966){if(_0x512966){return _0x512966[_0x502b('0x8f')](_0x5ada36[_0x502b('0x65')]['ids'],_['omit'](_0x5ada36[_0x502b('0x65')],[_0x502b('0x6e'),'id'])||{});}})[_0x502b('0x3c')](respondWithResult(_0x4b5af5,null))['catch'](handleError(_0x4b5af5,null));};exports['getInteractions']=function(_0x220986,_0x32b70d,_0x89dd8d){var _0x311903={'raw':![],'where':{}};var _0x261836={};var _0x5a700c={'count':0x0,'rows':[]};return db['MailAccount'][_0x502b('0x72')]({'where':{'id':_0x220986[_0x502b('0x67')]['id']}})[_0x502b('0x3c')](handleEntityNotFound(_0x32b70d,null))[_0x502b('0x3c')](function(_0x1e2f24){if(_0x1e2f24){_0x261836[_0x502b('0x50')]=_[_0x502b('0x63')](db[_0x502b('0x8e')]['rawAttributes']);_0x261836['query']=_[_0x502b('0x63')](_0x220986[_0x502b('0x51')]);_0x261836[_0x502b('0x5a')]=_[_0x502b('0x52')](_0x261836[_0x502b('0x50')],_0x261836['query']);_0x311903[_0x502b('0x54')]=_[_0x502b('0x52')](_0x261836[_0x502b('0x50')],qs[_0x502b('0x53')](_0x220986['query']['fields']));_0x311903[_0x502b('0x54')]=_0x311903['attributes']['length']?_0x311903[_0x502b('0x54')]:_0x261836[_0x502b('0x50')];if(!_0x220986[_0x502b('0x51')][_0x502b('0x56')](_0x502b('0x73'))){_0x311903[_0x502b('0x36')]=qs['limit'](_0x220986[_0x502b('0x51')][_0x502b('0x36')]);_0x311903[_0x502b('0x33')]=qs[_0x502b('0x33')](_0x220986[_0x502b('0x51')][_0x502b('0x33')]);}_0x311903[_0x502b('0x57')]=qs[_0x502b('0x58')](_0x220986['query'][_0x502b('0x58')]);_0x311903['where']=qs[_0x502b('0x5a')](_[_0x502b('0x5b')](_0x220986['query'],_0x261836[_0x502b('0x5a')]));_0x311903[_0x502b('0x59')][_0x502b('0x6a')]=_0x1e2f24['id'];if(_0x220986[_0x502b('0x51')][_0x502b('0x5c')]){_0x311903[_0x502b('0x59')]=_['merge'](_0x311903[_0x502b('0x59')],{'$or':_[_0x502b('0x4a')](_0x311903[_0x502b('0x54')],function(_0x5b4c83){var _0x1f7118={};_0x1f7118[_0x5b4c83]={'$like':'%'+_0x220986[_0x502b('0x51')][_0x502b('0x5c')]+'%'};return _0x1f7118;})});}_0x311903=_['merge']({},_0x311903,_0x220986[_0x502b('0x5f')]);return db[_0x502b('0x8e')]['count']({'where':_0x311903[_0x502b('0x59')]})[_0x502b('0x3c')](function(_0x45299e){_0x5a700c['count']=_0x45299e;if(_0x220986[_0x502b('0x51')]['includeAll']){_0x311903[_0x502b('0x60')]=[{'model':db[_0x502b('0x90')],'as':_0x502b('0x91'),'required':![]},{'model':db[_0x502b('0x92')],'as':_0x502b('0x93'),'attributes':[_0x502b('0x41'),'fullname',_0x502b('0x94')],'required':![]},{'model':db[_0x502b('0x95')],'as':_0x502b('0x96'),'attributes':['id',_0x502b('0x41'),_0x502b('0x97')],'where':_0x220986[_0x502b('0x51')][_0x502b('0x98')]?{'id':_0x220986[_0x502b('0x51')][_0x502b('0x98')]}:undefined,'required':_0x220986[_0x502b('0x51')][_0x502b('0x98')]?!![]:![]}];}return db['MailInteraction'][_0x502b('0x61')](_0x311903);})['then'](function(_0x285cef){_0x5a700c[_0x502b('0x6d')]=_0x285cef;return _0x5a700c;});}})[_0x502b('0x3c')](respondWithFilteredResult(_0x32b70d,_0x311903))[_0x502b('0x2f')](handleError(_0x32b70d,null));};exports['addApplications']=function(_0xd252c2,_0x15b7cf,_0x5eb6d5){return db[_0x502b('0x4b')][_0x502b('0x72')]({'where':{'id':_0xd252c2[_0x502b('0x67')]['id']}})['then'](handleEntityNotFound(_0x15b7cf,null))[_0x502b('0x3c')](function(_0x24e45d){if(_0x24e45d){return db['sequelize']['transaction'](function(_0x584c06){return db[_0x502b('0x99')][_0x502b('0x3d')]({'where':{'MailAccountId':_0xd252c2[_0x502b('0x67')]['id']},'transaction':_0x584c06})[_0x502b('0x3c')](function(_0x4fef05){var _0x2a05d2=_['map'](_0xd252c2['body'],function(_0x1aa79a){_0x1aa79a['MailAccountId']=_0xd252c2['params']['id'];return _0x1aa79a;});return db[_0x502b('0x99')]['bulkCreate'](_0x2a05d2,{'transaction':_0x584c06});});})['then'](function(){return db['MailApplication'][_0x502b('0x9a')]({'where':{'MailAccountId':_0xd252c2[_0x502b('0x67')]['id']},'order':_0x502b('0x9b')});});}})[_0x502b('0x3c')](respondWithResult(_0x15b7cf,null))[_0x502b('0x2f')](handleError(_0x15b7cf,null));};exports[_0x502b('0x9c')]=function(_0x38b09b,_0x307945,_0x17d666){var _0x4717c1={};var _0x2ba2ca={};var _0x344868;var _0x1f8594;return db[_0x502b('0x4b')][_0x502b('0x72')]({'where':{'id':_0x38b09b[_0x502b('0x67')]['id']}})[_0x502b('0x3c')](handleEntityNotFound(_0x307945,null))[_0x502b('0x3c')](function(_0x33e25e){if(_0x33e25e){_0x344868=_0x33e25e;_0x2ba2ca[_0x502b('0x50')]=_[_0x502b('0x63')](db[_0x502b('0x99')][_0x502b('0x4c')]);_0x2ba2ca[_0x502b('0x51')]=_[_0x502b('0x63')](_0x38b09b['query']);_0x2ba2ca[_0x502b('0x5a')]=_['intersection'](_0x2ba2ca[_0x502b('0x50')],_0x2ba2ca[_0x502b('0x51')]);_0x4717c1[_0x502b('0x54')]=_['intersection'](_0x2ba2ca['model'],qs['fields'](_0x38b09b['query'][_0x502b('0x53')]));_0x4717c1[_0x502b('0x54')]=_0x4717c1[_0x502b('0x54')][_0x502b('0x55')]?_0x4717c1[_0x502b('0x54')]:_0x2ba2ca[_0x502b('0x50')];_0x4717c1['order']=qs['sort'](_0x38b09b[_0x502b('0x51')][_0x502b('0x58')]);_0x4717c1[_0x502b('0x59')]=qs[_0x502b('0x5a')](_[_0x502b('0x5b')](_0x38b09b[_0x502b('0x51')],_0x2ba2ca['filters']));if(_0x38b09b[_0x502b('0x51')][_0x502b('0x5c')]){_0x4717c1[_0x502b('0x59')]=_[_0x502b('0x5e')](_0x4717c1[_0x502b('0x59')],{'$or':_[_0x502b('0x4a')](_0x4717c1['attributes'],function(_0x5cd5f1){var _0xb06090={};_0xb06090[_0x5cd5f1]={'$like':'%'+_0x38b09b[_0x502b('0x51')][_0x502b('0x5c')]+'%'};return _0xb06090;})});}_0x4717c1=_[_0x502b('0x5e')]({},_0x4717c1,_0x38b09b['options']);return _0x344868[_0x502b('0x9c')](_0x4717c1);}})[_0x502b('0x3c')](function(_0x3664bd){if(_0x3664bd){_0x1f8594=_0x3664bd[_0x502b('0x55')];if(!_0x38b09b[_0x502b('0x51')][_0x502b('0x56')](_0x502b('0x73'))){_0x4717c1[_0x502b('0x36')]=qs[_0x502b('0x36')](_0x38b09b[_0x502b('0x51')][_0x502b('0x36')]);_0x4717c1[_0x502b('0x33')]=qs[_0x502b('0x33')](_0x38b09b['query']['offset']);}return _0x344868['getApplications'](_0x4717c1);}})[_0x502b('0x3c')](function(_0x53fec9){if(_0x53fec9){return _0x53fec9?{'count':_0x1f8594,'rows':_0x53fec9}:null;}})[_0x502b('0x3c')](respondWithResult(_0x307945,null))[_0x502b('0x2f')](handleError(_0x307945,null));};exports[_0x502b('0x9d')]=function(_0x39d15c,_0x2c60a1,_0x1d1926){var _0x203800={'raw':!![],'where':{}};var _0xa7fdc6={};var _0x340ce4={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x39d15c[_0x502b('0x67')]['id']}})['then'](handleEntityNotFound(_0x2c60a1,null))[_0x502b('0x3c')](function(_0x238583){if(_0x238583){_0xa7fdc6[_0x502b('0x50')]=_[_0x502b('0x63')](db[_0x502b('0x9e')][_0x502b('0x4c')]);_0xa7fdc6[_0x502b('0x51')]=_[_0x502b('0x63')](_0x39d15c[_0x502b('0x51')]);_0xa7fdc6[_0x502b('0x5a')]=_['intersection'](_0xa7fdc6['model'],_0xa7fdc6[_0x502b('0x51')]);_0x203800[_0x502b('0x54')]=_[_0x502b('0x52')](_0xa7fdc6['model'],qs[_0x502b('0x53')](_0x39d15c['query'][_0x502b('0x53')]));_0x203800[_0x502b('0x54')]=_0x203800['attributes'][_0x502b('0x55')]?_0x203800['attributes']:_0xa7fdc6[_0x502b('0x50')];if(!_0x39d15c['query'][_0x502b('0x56')](_0x502b('0x73'))){_0x203800[_0x502b('0x36')]=qs[_0x502b('0x36')](_0x39d15c[_0x502b('0x51')][_0x502b('0x36')]);_0x203800[_0x502b('0x33')]=qs[_0x502b('0x33')](_0x39d15c[_0x502b('0x51')][_0x502b('0x33')]);}_0x203800[_0x502b('0x57')]=qs[_0x502b('0x58')](_0x39d15c[_0x502b('0x51')][_0x502b('0x58')]);_0x203800['where']=qs['filters'](_[_0x502b('0x5b')](_0x39d15c[_0x502b('0x51')],_0xa7fdc6['filters']));_0x203800[_0x502b('0x59')][_0x502b('0x6a')]=_0x238583['id'];if(_0x39d15c[_0x502b('0x51')][_0x502b('0x5c')]){_0x203800['where']=_[_0x502b('0x5e')](_0x203800[_0x502b('0x59')],{'$or':_['map'](_0x203800['attributes'],function(_0xe77ac7){var _0x16f0b4={};_0x16f0b4[_0xe77ac7]={'$like':'%'+_0x39d15c['query'][_0x502b('0x5c')]+'%'};return _0x16f0b4;})});}if(_0x39d15c[_0x502b('0x51')]['$gte']){var _0x61466f=_0x39d15c[_0x502b('0x51')][_0x502b('0x9f')][_0x502b('0xa0')](',');var _0x39e7c8={};_0x39e7c8[_0x61466f[0x0]]={'$gte':moment(_0x61466f[0x1])[_0x502b('0xa1')](_0x502b('0xa2'))};_0x203800['where']=_[_0x502b('0x5e')](_0x203800[_0x502b('0x59')],_0x39e7c8);}_0x203800=_[_0x502b('0x5e')]({},_0x203800,_0x39d15c['options']);return db[_0x502b('0x9e')][_0x502b('0x35')]({'where':_0x203800[_0x502b('0x59')]})[_0x502b('0x3c')](function(_0x2900e1){_0x340ce4[_0x502b('0x35')]=_0x2900e1;if(_0x39d15c[_0x502b('0x51')]['includeAll']){_0x203800['include']=[{'all':!![]}];}return db[_0x502b('0x9e')][_0x502b('0x61')](_0x203800);})[_0x502b('0x3c')](function(_0x587c94){if(_0x39d15c['query'][_0x502b('0xa3')]===_0x502b('0xa4')){for(var _0x2e2158=0x0;_0x2e2158<_0x587c94[_0x502b('0x55')];_0x2e2158++){_0x587c94[_0x2e2158]['body']=juice(_0x587c94[_0x2e2158][_0x502b('0x65')]);}}_0x340ce4[_0x502b('0x6d')]=_0x587c94;return _0x340ce4;});}})[_0x502b('0x3c')](respondWithFilteredResult(_0x2c60a1,_0x203800))[_0x502b('0x2f')](handleError(_0x2c60a1,null));};exports[_0x502b('0x42')]=function(_0x120ef6,_0x47bc91,_0x2aa31c){var _0x2b0eda,_0x3eba94={},_0x399a19;if(_0x120ef6[_0x502b('0x65')]['to']){_0x399a19=_0x120ef6['body']['to'][_0x502b('0xa0')](',')[0x0];}return db[_0x502b('0x4b')][_0x502b('0x66')]({'where':{'id':_0x120ef6[_0x502b('0x67')]['id']},'include':[{'model':db[_0x502b('0xa5')],'as':_0x502b('0xa6'),'include':[{'model':db[_0x502b('0x90')],'as':'Contacts','where':{'email':_0x399a19},'limit':0x1,'order':[[_0x502b('0xa7'),'DESC']]}]},{'model':db[_0x502b('0x46')],'as':_0x502b('0x47'),'raw':!![]}]})['then'](handleEntityNotFound(_0x47bc91,null))[_0x502b('0x3c')](function(_0xe0054e){if(_0xe0054e){_0x2b0eda=_0xe0054e;if(_0xe0054e['Smtp']){if(_[_0x502b('0x75')](_0x120ef6[_0x502b('0x65')][_0x502b('0xa8')])){_0x120ef6[_0x502b('0x65')][_0x502b('0xa8')]=util[_0x502b('0xa1')](_0x502b('0xa9'),_0xe0054e[_0x502b('0x41')],_0xe0054e[_0x502b('0xaa')]||_0xe0054e[_0x502b('0x47')][_0x502b('0x7a')]);}if(_0x120ef6[_0x502b('0x65')][_0x502b('0xab')]&&_0x120ef6[_0x502b('0x65')]['attachments']['length']){for(var _0x5363b2=0x0;_0x5363b2<_0x120ef6[_0x502b('0x65')][_0x502b('0xab')][_0x502b('0x55')];_0x5363b2+=0x1){_0x120ef6[_0x502b('0x65')][_0x502b('0xab')][_0x5363b2]={'filename':_0x120ef6[_0x502b('0x65')][_0x502b('0xab')][_0x5363b2][_0x502b('0x41')],'path':path[_0x502b('0xac')](config[_0x502b('0xad')],_0x502b('0xae'),_0x120ef6[_0x502b('0x65')][_0x502b('0xab')][_0x5363b2][_0x502b('0xaf')])};}}var _0x3c86fc={'tls':{'rejectUnauthorized':![]}};if(_[_0x502b('0x75')](_0xe0054e['Smtp'][_0x502b('0x80')])){if(_0xe0054e[_0x502b('0x47')]['authentication']){_0x3c86fc[_0x502b('0xb0')]={'user':_0xe0054e[_0x502b('0x47')][_0x502b('0x7a')],'pass':_0xe0054e[_0x502b('0x47')][_0x502b('0x82')]};}_0x3c86fc['host']=_0xe0054e[_0x502b('0x47')][_0x502b('0x7e')];_0x3c86fc[_0x502b('0x7f')]=_0xe0054e['Smtp'][_0x502b('0x7f')];_0x3c86fc[_0x502b('0xb1')]=_0xe0054e[_0x502b('0x47')][_0x502b('0xb1')];}else{_0x3c86fc[_0x502b('0x80')]=_0xe0054e[_0x502b('0x47')][_0x502b('0x80')];_0x3c86fc['auth']={'user':_0xe0054e[_0x502b('0x47')][_0x502b('0x7a')],'pass':_0xe0054e[_0x502b('0x47')]['pass']};}return respondWithRpcPromise(_0x502b('0xb2'),_0x502b('0xb3'),{'account':_0x3c86fc,'message':_0x120ef6['body']});}else{throw new Error(_0x502b('0xb4'));}}})[_0x502b('0x3c')](function(_0x5e989a){if(_0x5e989a){_0x3eba94=_0x5e989a;if(_0x2b0eda[_0x502b('0xa6')]){if(_0x2b0eda['List']['Contacts'][_0x502b('0x55')]){return _0x2b0eda[_0x502b('0xa6')][_0x502b('0xb5')][0x0];}else{return db[_0x502b('0x90')]['create'](_['defaults'](_0x120ef6[_0x502b('0x65')],{'firstName':_0x120ef6[_0x502b('0x65')]['to'],'email':_0x120ef6['body']['to'],'phone':_0x120ef6['body']['to'],'ListId':_0x2b0eda[_0x502b('0xb6')]}));}}else{throw new Error(_0x502b('0xb4'));}}})[_0x502b('0x3c')](function(_0x5359c4){if(_0x5359c4){var _0x587804={'UserId':_0x120ef6[_0x502b('0x7a')]['id'],'ContactId':_0x5359c4['id'],'MailAccountId':_0x2b0eda['id'],'inReplyTo':_0x3eba94[_0x502b('0xb7')],'to':_0x120ef6[_0x502b('0x65')][_0x502b('0xa8')],'cc':_0x120ef6['body']['cc'],'subject':_0x120ef6['body']['subject'],'attach':_0x120ef6[_0x502b('0x65')][_0x502b('0xb8')],'firstMsgDirection':_0x502b('0xb9'),'lastMsgAt':moment()['format'](_0x502b('0xa2')),'lastMsgDirection':_0x502b('0xb9'),'Messages':[_['merge'](_0x120ef6[_0x502b('0x65')],{'messageId':_0x3eba94[_0x502b('0xb7')],'sentAt':moment()[_0x502b('0xa1')](_0x502b('0xa2')),'read':!![],'MailAccountId':_0x2b0eda['id'],'UserId':_0x120ef6[_0x502b('0x7a')]['id'],'ContactId':_0x5359c4['id']})]};if(_0x120ef6[_0x502b('0x65')][_0x502b('0xba')]){_0x587804=_['merge'](_0x587804,_0x120ef6[_0x502b('0x65')][_0x502b('0xba')]);}return db[_0x502b('0x8e')]['create'](_0x587804,{'include':[{'model':db['MailMessage'],'as':_0x502b('0xbb')}]});}})['then'](respondWithResult(_0x47bc91,null))[_0x502b('0x2f')](handleError(_0x47bc91,null));};exports['verifySmtp']=function(_0x1770d0,_0x195d98,_0x54e7dc){return db[_0x502b('0x4b')][_0x502b('0x66')]({'where':{'id':_0x1770d0[_0x502b('0x67')]['id']},'include':[{'model':db[_0x502b('0x46')],'as':_0x502b('0x47'),'raw':!![]}]})[_0x502b('0x3c')](handleEntityNotFound(_0x195d98,null))[_0x502b('0x3c')](function(_0x4197e9){if(_0x4197e9&&_0x4197e9[_0x502b('0x47')]){var _0x333698={'id':_0x4197e9['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4197e9[_0x502b('0x47')][_0x502b('0x80')]){_0x333698[_0x502b('0x80')]=_0x4197e9[_0x502b('0x47')][_0x502b('0x80')];}else{_0x333698[_0x502b('0x7e')]=_0x4197e9['Smtp'][_0x502b('0x7e')];_0x333698[_0x502b('0x7f')]=_0x4197e9[_0x502b('0x47')][_0x502b('0x7f')];_0x333698['secure']=_0x4197e9['Smtp'][_0x502b('0xb1')];}if(_0x4197e9['Smtp'][_0x502b('0x7d')]){_0x333698['auth']={'user':_0x4197e9[_0x502b('0x47')][_0x502b('0x7a')],'pass':_0x4197e9[_0x502b('0x47')][_0x502b('0x82')]};}return respondWithRpcPromise(_0x502b('0xbc'),'verifySmtp',{'account':_0x333698});}})[_0x502b('0x3c')](respondWithResult(_0x195d98,null))['catch'](handleError(_0x195d98,null));};exports['destroy']=function(_0x2d8307,_0x8d05ff){return db['MailAccount']['find']({'where':{'id':_0x2d8307['params']['id']}})[_0x502b('0x3c')](handleEntityNotFound(_0x8d05ff,null))[_0x502b('0x3c')](function(_0x5ca297){if(_0x5ca297&&_0x5ca297[_0x502b('0x80')]){throw new db['Sequelize']['ValidationError']('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x5ca297;})[_0x502b('0x3c')](removeEntity(_0x8d05ff,null))['catch'](handleError(_0x8d05ff,null));};exports[_0x502b('0xbd')]=function(_0x176b2a,_0x98aa54,_0x4212ee){return db[_0x502b('0x4b')][_0x502b('0x66')]({'where':{'id':_0x176b2a[_0x502b('0x67')]['id']}})['then'](handleEntityNotFound(_0x98aa54,null))['then'](function(_0x98c49f){if(_0x98c49f){return _0x98c49f[_0x502b('0xbd')](_0x176b2a[_0x502b('0x65')][_0x502b('0x6e')],_['omit'](_0x176b2a[_0x502b('0x65')],[_0x502b('0x6e'),'id'])||{})[_0x502b('0xbe')](function(_0x2aee6f){for(var _0x28da70=0x0;_0x28da70<_0x176b2a[_0x502b('0x65')][_0x502b('0x6e')][_0x502b('0x55')];_0x28da70+=0x1){socket['emit'](_0x502b('0xbf'),{'UserId':Number(_0x176b2a[_0x502b('0x65')][_0x502b('0x6e')][_0x28da70]),'MailAccountId':Number(_0x176b2a[_0x502b('0x67')]['id'])});}return _0x2aee6f;});}})[_0x502b('0x3c')](respondWithResult(_0x98aa54,null))[_0x502b('0x2f')](handleError(_0x98aa54,null));};exports['removeAgents']=function(_0x3cc884,_0x161cf2,_0x22d9c4){return db['MailAccount'][_0x502b('0x66')]({'where':{'id':_0x3cc884['params']['id']}})[_0x502b('0x3c')](handleEntityNotFound(_0x161cf2,null))[_0x502b('0x3c')](function(_0x5caa57){if(_0x5caa57){return _0x5caa57[_0x502b('0xc0')](_0x3cc884['query'][_0x502b('0x6e')])[_0x502b('0x3c')](function(){if(_[_0x502b('0xc1')](_0x3cc884[_0x502b('0x51')]['ids'])){for(var _0x4b3b21=0x0;_0x4b3b21<_0x3cc884[_0x502b('0x51')][_0x502b('0x6e')][_0x502b('0x55')];_0x4b3b21+=0x1){socket[_0x502b('0xc2')](_0x502b('0xc3'),{'UserId':Number(_0x3cc884['query'][_0x502b('0x6e')][_0x4b3b21]),'MailAccountId':Number(_0x3cc884[_0x502b('0x67')]['id'])});}}else{socket[_0x502b('0xc2')](_0x502b('0xc3'),{'UserId':Number(_0x3cc884[_0x502b('0x51')][_0x502b('0x6e')]),'MailAccountId':Number(_0x3cc884[_0x502b('0x67')]['id'])});}});}})[_0x502b('0x3c')](respondWithStatusCode(_0x161cf2,null))['catch'](handleError(_0x161cf2,null));};exports[_0x502b('0xc4')]=function(_0x15fb28,_0x5ecb6f,_0x1dcf24){var _0x170c1d={};var _0x40755f={};var _0x270fbd;var _0x1675bc;return db['MailAccount'][_0x502b('0x72')]({'where':{'id':_0x15fb28['params']['id']}})['then'](handleEntityNotFound(_0x5ecb6f,null))[_0x502b('0x3c')](function(_0x48f5ee){if(_0x48f5ee){_0x270fbd=_0x48f5ee;_0x40755f[_0x502b('0x50')]=_[_0x502b('0x63')](db[_0x502b('0x92')][_0x502b('0x4c')]);_0x40755f['query']=_['keys'](_0x15fb28['query']);_0x40755f[_0x502b('0x5a')]=_[_0x502b('0x52')](_0x40755f[_0x502b('0x50')],_0x40755f[_0x502b('0x51')]);_0x170c1d[_0x502b('0x54')]=_[_0x502b('0x52')](_0x40755f['model'],qs['fields'](_0x15fb28[_0x502b('0x51')][_0x502b('0x53')]));_0x170c1d['attributes']=_0x170c1d['attributes'][_0x502b('0x55')]?_0x170c1d[_0x502b('0x54')]:_0x40755f['model'];_0x170c1d['order']=qs[_0x502b('0x58')](_0x15fb28['query']['sort']);_0x170c1d[_0x502b('0x59')]=qs[_0x502b('0x5a')](_[_0x502b('0x5b')](_0x15fb28['query'],_0x40755f[_0x502b('0x5a')]));if(_0x15fb28['query'][_0x502b('0x5c')]){_0x170c1d['where']=_[_0x502b('0x5e')](_0x170c1d[_0x502b('0x59')],{'$or':_[_0x502b('0x4a')](_0x170c1d[_0x502b('0x54')],function(_0xf5243a){var _0xe33319={};_0xe33319[_0xf5243a]={'$like':'%'+_0x15fb28[_0x502b('0x51')][_0x502b('0x5c')]+'%'};return _0xe33319;})});}_0x170c1d=_['merge']({},_0x170c1d,_0x15fb28[_0x502b('0x5f')]);return _0x270fbd[_0x502b('0xc4')](_0x170c1d);}})['then'](function(_0x665fe4){if(_0x665fe4){_0x1675bc=_0x665fe4[_0x502b('0x55')];if(!_0x15fb28['query'][_0x502b('0x56')](_0x502b('0x73'))){_0x170c1d[_0x502b('0x36')]=qs[_0x502b('0x36')](_0x15fb28[_0x502b('0x51')][_0x502b('0x36')]);_0x170c1d[_0x502b('0x33')]=qs[_0x502b('0x33')](_0x15fb28[_0x502b('0x51')][_0x502b('0x33')]);}return _0x270fbd[_0x502b('0xc4')](_0x170c1d);}})[_0x502b('0x3c')](function(_0xeee49d){if(_0xeee49d){return _0xeee49d?{'count':_0x1675bc,'rows':_0xeee49d}:null;}})['then'](respondWithResult(_0x5ecb6f,null))[_0x502b('0x2f')](handleError(_0x5ecb6f,null));}; \ No newline at end of file +var _0x4b81=['service','cpassword','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','fullname','internal','Tag','Tags','tag','addApplications','sequelize','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','from','%s\x20<%s>','attachments','root','server/files/attachments','basename','auth','SendMail','sendMail','List\x20not\x20found','defaults','messageId','out','Interaction','verifySmtp','secure','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','emit','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','status','end','json','offset','undefined','limit','count','set','save','destroy','get','MailAccounts','UserProfileResource','stack','name','send','index','MailServerIn','Imap','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','rows','MailServerOut','length','include','find','body','params','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','order','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','key','email','ListId','isNil','active','description','cservice','cauthentication','user','cuser','password','pass','authentication','host','port'];(function(_0x2265fc,_0xe480f0){var _0x302b6e=function(_0x454044){while(--_0x454044){_0x2265fc['push'](_0x2265fc['shift']());}};_0x302b6e(++_0xe480f0);}(_0x4b81,0x104));var _0x14b8=function(_0x4097b7,_0xa1e60c){_0x4097b7=_0x4097b7-0x0;var _0x17bb87=_0x4b81[_0x4097b7];return _0x17bb87;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x14b8('0x0'));var zipdir=require(_0x14b8('0x1'));var jsonpatch=require(_0x14b8('0x2'));var rp=require(_0x14b8('0x3'));var moment=require('moment');var BPromise=require(_0x14b8('0x4'));var Mustache=require(_0x14b8('0x5'));var util=require('util');var path=require('path');var sox=require(_0x14b8('0x6'));var csv=require(_0x14b8('0x7'));var ejs=require(_0x14b8('0x8'));var fs=require('fs');var fs_extra=require(_0x14b8('0x9'));var _=require(_0x14b8('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x14b8('0xb'));var deskjs=require(_0x14b8('0xc'));var toCsv=require(_0x14b8('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var htmlToText=require(_0x14b8('0xd'));var juice=require(_0x14b8('0xe'));var Redis=require(_0x14b8('0xf'));var authService=require(_0x14b8('0x10'));var qs=require(_0x14b8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x14b8('0x12'));var logger=require(_0x14b8('0x13'))(_0x14b8('0x14'));var utils=require(_0x14b8('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x14b8('0x16')]=_['defaults'](config[_0x14b8('0x16')],{'host':_0x14b8('0x17'),'port':0x18eb});var socket=require(_0x14b8('0x18'))(new Redis(config[_0x14b8('0x16')]));require(_0x14b8('0x19'))[_0x14b8('0x1a')](socket);var jayson=require(_0x14b8('0x1b'));var client=jayson[_0x14b8('0x1c')][_0x14b8('0x1d')]({'port':0x232b});function respondWithRpcPromise(_0x42eb53,_0xa4f5ba,_0x1e12ae,_0x11394c){return new BPromise(function(_0x48bcc8,_0x491daa){var _0x1f6ba6=_0x11394c||client;return _0x1f6ba6[_0x14b8('0x1e')](_0x42eb53,_0x1e12ae)[_0x14b8('0x1f')](function(_0x265915){logger[_0x14b8('0x20')](_0x14b8('0x21'),_0xa4f5ba,'request\x20sent');logger['debug'](_0x14b8('0x22'),_0xa4f5ba,'request\x20sent',JSON[_0x14b8('0x23')](_0x265915));if(_0x265915['error']){if(_0x265915[_0x14b8('0x24')]['code']===0x1f4){logger[_0x14b8('0x24')]('MailAccount,\x20%s,\x20%s',_0xa4f5ba,_0x265915[_0x14b8('0x24')][_0x14b8('0x25')]);return _0x491daa(_0x265915[_0x14b8('0x24')][_0x14b8('0x25')]);}logger[_0x14b8('0x24')](_0x14b8('0x21'),_0xa4f5ba,_0x265915['error']['message']);return _0x48bcc8(_0x265915[_0x14b8('0x24')]['message']);}else{logger['info'](_0x14b8('0x21'),_0xa4f5ba,_0x14b8('0x26'));_0x48bcc8(_0x265915[_0x14b8('0x27')][_0x14b8('0x25')]);}})[_0x14b8('0x28')](function(_0x17ec42){logger[_0x14b8('0x24')]('MailAccount,\x20%s,\x20%s',_0xa4f5ba,_0x17ec42);_0x491daa(_0x17ec42);});});}function respondWithStatusCode(_0x371f34,_0x50f072){_0x50f072=_0x50f072||0xcc;return function(_0x41b054){if(_0x41b054){return _0x371f34['sendStatus'](_0x50f072);}return _0x371f34[_0x14b8('0x29')](_0x50f072)[_0x14b8('0x2a')]();};}function respondWithResult(_0x4501d2,_0x35a24c){_0x35a24c=_0x35a24c||0xc8;return function(_0xa9543f){if(_0xa9543f){return _0x4501d2['status'](_0x35a24c)[_0x14b8('0x2b')](_0xa9543f);}};}function respondWithFilteredResult(_0x46d661,_0xa30ece){return function(_0x1e0fc7){if(_0x1e0fc7){var _0x24e394=typeof _0xa30ece[_0x14b8('0x2c')]===_0x14b8('0x2d')&&typeof _0xa30ece[_0x14b8('0x2e')]===_0x14b8('0x2d');var _0x3b57cd=_0x1e0fc7[_0x14b8('0x2f')];var _0x3a45bf=_0x24e394?0x0:_0xa30ece[_0x14b8('0x2c')];var _0x3848fc=_0x24e394?_0x1e0fc7['count']:_0xa30ece['offset']+_0xa30ece[_0x14b8('0x2e')];var _0x599c07;if(_0x3848fc>=_0x3b57cd){_0x3848fc=_0x3b57cd;_0x599c07=0xc8;}else{_0x599c07=0xce;}_0x46d661[_0x14b8('0x29')](_0x599c07);return _0x46d661[_0x14b8('0x30')]('Content-Range',_0x3a45bf+'-'+_0x3848fc+'/'+_0x3b57cd)[_0x14b8('0x2b')](_0x1e0fc7);}return null;};}function patchUpdates(_0x3f3250){return function(_0x57f870){try{jsonpatch['apply'](_0x57f870,_0x3f3250,!![]);}catch(_0x15c96b){return BPromise['reject'](_0x15c96b);}return _0x57f870[_0x14b8('0x31')]();};}function saveUpdates(_0x4b0d3d,_0x182119){return function(_0x10dd80){if(_0x10dd80){return _0x10dd80['update'](_0x4b0d3d)[_0x14b8('0x1f')](function(_0x4dde75){return _0x4dde75;});}return null;};}function removeEntity(_0x3e0811,_0x56850d){return function(_0x3b8745){if(_0x3b8745){return _0x3b8745[_0x14b8('0x32')]()['then'](function(){var _0x1746a4=_0x3b8745[_0x14b8('0x33')]({'plain':!![]});var _0xb3492f=_0x14b8('0x34');return db[_0x14b8('0x35')]['destroy']({'where':{'type':_0xb3492f,'resourceId':_0x1746a4['id']}})[_0x14b8('0x1f')](function(){return _0x3b8745;});})[_0x14b8('0x1f')](function(){_0x3e0811[_0x14b8('0x29')](0xcc)[_0x14b8('0x2a')]();});}};}function handleEntityNotFound(_0x1b7482,_0xeb0b5c){return function(_0x4719a5){if(!_0x4719a5){_0x1b7482['sendStatus'](0x194);}return _0x4719a5;};}function handleError(_0x8e791f,_0x28273c){_0x28273c=_0x28273c||0x1f4;return function(_0x5a40ea){logger['error'](_0x5a40ea[_0x14b8('0x36')]);if(_0x5a40ea[_0x14b8('0x37')]){delete _0x5a40ea[_0x14b8('0x37')];}_0x8e791f[_0x14b8('0x29')](_0x28273c)[_0x14b8('0x38')](_0x5a40ea);};}exports[_0x14b8('0x39')]=function(_0x1fcf6d,_0x112d3d){var _0x26b7cc={'include':[{'model':db[_0x14b8('0x3a')],'as':_0x14b8('0x3b')},{'model':db['MailServerOut'],'as':_0x14b8('0x3c')},{'model':db[_0x14b8('0x3d')],'as':_0x14b8('0x3e')}]},_0x110cda={},_0x1611e3={'count':0x0,'rows':[]};var _0x4ba21a=_[_0x14b8('0x3f')](db[_0x14b8('0x40')][_0x14b8('0x41')],function(_0x159f48){return{'name':_0x159f48[_0x14b8('0x42')],'type':_0x159f48[_0x14b8('0x43')]['key']};});_0x110cda[_0x14b8('0x44')]=_[_0x14b8('0x3f')](_0x4ba21a,_0x14b8('0x37'));_0x110cda[_0x14b8('0x45')]=_[_0x14b8('0x46')](_0x1fcf6d['query']);_0x110cda[_0x14b8('0x47')]=_[_0x14b8('0x48')](_0x110cda['model'],_0x110cda[_0x14b8('0x45')]);_0x26b7cc[_0x14b8('0x49')]=_[_0x14b8('0x48')](_0x110cda['model'],qs[_0x14b8('0x4a')](_0x1fcf6d[_0x14b8('0x45')][_0x14b8('0x4a')]));_0x26b7cc[_0x14b8('0x49')]=_0x26b7cc[_0x14b8('0x49')]['length']?_0x26b7cc['attributes']:_0x110cda[_0x14b8('0x44')];if(!_0x1fcf6d[_0x14b8('0x45')][_0x14b8('0x4b')](_0x14b8('0x4c'))){_0x26b7cc['limit']=qs[_0x14b8('0x2e')](_0x1fcf6d[_0x14b8('0x45')][_0x14b8('0x2e')]);_0x26b7cc[_0x14b8('0x2c')]=qs[_0x14b8('0x2c')](_0x1fcf6d[_0x14b8('0x45')]['offset']);}_0x26b7cc['order']=qs[_0x14b8('0x4d')](_0x1fcf6d[_0x14b8('0x45')][_0x14b8('0x4d')]);_0x26b7cc[_0x14b8('0x4e')]=qs[_0x14b8('0x47')](_[_0x14b8('0x4f')](_0x1fcf6d[_0x14b8('0x45')],_0x110cda['filters']),_0x4ba21a);if(_0x1fcf6d[_0x14b8('0x45')]['filter']){_0x26b7cc[_0x14b8('0x4e')]=_[_0x14b8('0x50')](_0x26b7cc[_0x14b8('0x4e')],{'$or':_[_0x14b8('0x3f')](_0x4ba21a,function(_0xb0595f){if(_0xb0595f[_0x14b8('0x43')]!==_0x14b8('0x51')){var _0x26a7fe={};_0x26a7fe[_0xb0595f[_0x14b8('0x37')]]={'$like':'%'+_0x1fcf6d[_0x14b8('0x45')][_0x14b8('0x52')]+'%'};return _0x26a7fe;}})});}_0x26b7cc=_['merge']({},_0x26b7cc,_0x1fcf6d[_0x14b8('0x53')]);var _0x4ed436={'where':_0x26b7cc[_0x14b8('0x4e')]};return db[_0x14b8('0x40')]['count'](_0x4ed436)[_0x14b8('0x1f')](function(_0x482f84){_0x1611e3[_0x14b8('0x2f')]=_0x482f84;if(_0x1fcf6d[_0x14b8('0x45')][_0x14b8('0x54')]){_0x26b7cc['include']=[{'all':!![]}];}return db[_0x14b8('0x40')]['findAll'](_0x26b7cc);})[_0x14b8('0x1f')](function(_0x148e9a){_0x1611e3[_0x14b8('0x55')]=_0x148e9a;return _0x1611e3;})[_0x14b8('0x1f')](respondWithFilteredResult(_0x112d3d,_0x26b7cc))[_0x14b8('0x28')](handleError(_0x112d3d,null));};exports['show']=function(_0xc0a767,_0xdb7df1){var _0x2f7d81={'raw':![],'where':{'id':_0xc0a767['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x14b8('0x3b')},{'model':db[_0x14b8('0x56')],'as':'Smtp'},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x145b64={};_0x145b64[_0x14b8('0x44')]=_['keys'](db[_0x14b8('0x40')]['rawAttributes']);_0x145b64[_0x14b8('0x45')]=_[_0x14b8('0x46')](_0xc0a767['query']);_0x145b64[_0x14b8('0x47')]=_['intersection'](_0x145b64[_0x14b8('0x44')],_0x145b64[_0x14b8('0x45')]);_0x2f7d81[_0x14b8('0x49')]=_['intersection'](_0x145b64[_0x14b8('0x44')],qs[_0x14b8('0x4a')](_0xc0a767['query']['fields']));_0x2f7d81[_0x14b8('0x49')]=_0x2f7d81[_0x14b8('0x49')][_0x14b8('0x57')]?_0x2f7d81[_0x14b8('0x49')]:_0x145b64[_0x14b8('0x44')];if(_0xc0a767[_0x14b8('0x45')][_0x14b8('0x54')]){_0x2f7d81[_0x14b8('0x58')]=[{'all':!![]}];}_0x2f7d81=_[_0x14b8('0x50')]({},_0x2f7d81,_0xc0a767[_0x14b8('0x53')]);return db['MailAccount'][_0x14b8('0x59')](_0x2f7d81)['then'](handleEntityNotFound(_0xdb7df1,null))[_0x14b8('0x1f')](respondWithResult(_0xdb7df1,null))[_0x14b8('0x28')](handleError(_0xdb7df1,null));};exports['update']=function(_0x576925,_0x10a530){if(_0x576925[_0x14b8('0x5a')]['id']){delete _0x576925[_0x14b8('0x5a')]['id'];}return db[_0x14b8('0x40')]['find']({'where':{'id':_0x576925[_0x14b8('0x5b')]['id']},'include':[{'model':db[_0x14b8('0x3a')],'as':_0x14b8('0x3b')},{'model':db[_0x14b8('0x56')],'as':_0x14b8('0x3c')},{'model':db[_0x14b8('0x3d')],'as':_0x14b8('0x3e')}]})['then'](handleEntityNotFound(_0x10a530,null))[_0x14b8('0x1f')](saveUpdates(_0x576925[_0x14b8('0x5a')],null))[_0x14b8('0x1f')](function(_0x499ef5){if(_0x499ef5&&_0x576925[_0x14b8('0x5a')][_0x14b8('0x3b')]){return db[_0x14b8('0x3a')]['update'](_0x576925[_0x14b8('0x5a')][_0x14b8('0x3b')],{'where':{'MailAccountId':_0x499ef5['id']}})['then'](function(){return _0x499ef5;});}return _0x499ef5;})[_0x14b8('0x1f')](function(_0x495c54){if(_0x495c54&&_0x576925[_0x14b8('0x5a')]['Smtp']){return db[_0x14b8('0x56')]['update'](_0x576925[_0x14b8('0x5a')][_0x14b8('0x3c')],{'where':{'MailAccountId':_0x495c54['id']}})[_0x14b8('0x1f')](function(){return _0x495c54;});}return _0x495c54;})['then'](respondWithResult(_0x10a530,null))[_0x14b8('0x28')](handleError(_0x10a530,null));};exports['describe']=function(_0x4fd960,_0xa01ea4){return db['MailAccount'][_0x14b8('0x5c')]()[_0x14b8('0x1f')](respondWithResult(_0xa01ea4,null))[_0x14b8('0x28')](handleError(_0xa01ea4,null));};exports[_0x14b8('0x5d')]=function(_0x521686,_0x1f9fa9,_0x5e42cf){if(_0x521686[_0x14b8('0x5a')]['id']){delete _0x521686[_0x14b8('0x5a')]['id'];}return db[_0x14b8('0x40')]['find']({'where':{'id':_0x521686[_0x14b8('0x5b')]['id']}})[_0x14b8('0x1f')](handleEntityNotFound(_0x1f9fa9,null))['then'](function(_0x3e495c){if(_0x3e495c){_0x521686[_0x14b8('0x5a')][_0x14b8('0x5e')]=_0x3e495c['id'];return db[_0x14b8('0x5f')][_0x14b8('0x60')](_0x521686[_0x14b8('0x5a')]);}})[_0x14b8('0x1f')](respondWithResult(_0x1f9fa9,null))[_0x14b8('0x28')](handleError(_0x1f9fa9,null));};exports[_0x14b8('0x61')]=function(_0x13c5e1,_0x3f1fa0,_0x290b75){var _0x1bf1a4={'raw':![],'where':{}};var _0x5cc1eb={};var _0x533a32={'count':0x0,'rows':[]};return db[_0x14b8('0x40')][_0x14b8('0x62')]({'where':{'id':_0x13c5e1[_0x14b8('0x5b')]['id']}})[_0x14b8('0x1f')](handleEntityNotFound(_0x3f1fa0,null))[_0x14b8('0x1f')](function(_0x478312){if(_0x478312){_0x5cc1eb[_0x14b8('0x44')]=_[_0x14b8('0x46')](db[_0x14b8('0x5f')][_0x14b8('0x41')]);_0x5cc1eb[_0x14b8('0x45')]=_[_0x14b8('0x46')](_0x13c5e1[_0x14b8('0x45')]);_0x5cc1eb[_0x14b8('0x47')]=_['intersection'](_0x5cc1eb['model'],_0x5cc1eb[_0x14b8('0x45')]);_0x1bf1a4[_0x14b8('0x49')]=_[_0x14b8('0x48')](_0x5cc1eb[_0x14b8('0x44')],qs[_0x14b8('0x4a')](_0x13c5e1[_0x14b8('0x45')][_0x14b8('0x4a')]));_0x1bf1a4['attributes']=_0x1bf1a4[_0x14b8('0x49')][_0x14b8('0x57')]?_0x1bf1a4['attributes']:_0x5cc1eb['model'];if(!_0x13c5e1[_0x14b8('0x45')][_0x14b8('0x4b')](_0x14b8('0x4c'))){_0x1bf1a4[_0x14b8('0x2e')]=qs[_0x14b8('0x2e')](_0x13c5e1['query'][_0x14b8('0x2e')]);_0x1bf1a4['offset']=qs['offset'](_0x13c5e1['query'][_0x14b8('0x2c')]);}_0x1bf1a4[_0x14b8('0x63')]=qs[_0x14b8('0x4d')](_0x13c5e1[_0x14b8('0x45')][_0x14b8('0x4d')]);_0x1bf1a4[_0x14b8('0x4e')]=qs[_0x14b8('0x47')](_[_0x14b8('0x4f')](_0x13c5e1['query'],_0x5cc1eb[_0x14b8('0x47')]));_0x1bf1a4[_0x14b8('0x4e')][_0x14b8('0x5e')]=_0x478312['id'];if(_0x13c5e1[_0x14b8('0x45')][_0x14b8('0x52')]){_0x1bf1a4[_0x14b8('0x4e')]=_[_0x14b8('0x50')](_0x1bf1a4[_0x14b8('0x4e')],{'$or':_[_0x14b8('0x3f')](_0x1bf1a4[_0x14b8('0x49')],function(_0x13cc40){var _0x4bdf6b={};_0x4bdf6b[_0x13cc40]={'$like':'%'+_0x13c5e1[_0x14b8('0x45')][_0x14b8('0x52')]+'%'};return _0x4bdf6b;})});}_0x1bf1a4=_[_0x14b8('0x50')]({},_0x1bf1a4,_0x13c5e1['options']);return db['Disposition'][_0x14b8('0x2f')]({'where':_0x1bf1a4['where']})['then'](function(_0x35ecf0){_0x533a32[_0x14b8('0x2f')]=_0x35ecf0;if(_0x13c5e1['query'][_0x14b8('0x54')]){_0x1bf1a4[_0x14b8('0x58')]=[{'all':!![]}];}return db['Disposition'][_0x14b8('0x64')](_0x1bf1a4);})[_0x14b8('0x1f')](function(_0x6d1442){_0x533a32[_0x14b8('0x55')]=_0x6d1442;return _0x533a32;});}})[_0x14b8('0x1f')](respondWithFilteredResult(_0x3f1fa0,_0x1bf1a4))[_0x14b8('0x28')](handleError(_0x3f1fa0,null));};exports[_0x14b8('0x65')]=function(_0xc298fc,_0x4c3f86,_0x1b6dc1){return db[_0x14b8('0x40')][_0x14b8('0x59')]({'where':{'id':_0xc298fc['params']['id']}})[_0x14b8('0x1f')](handleEntityNotFound(_0x4c3f86,null))['then'](function(_0x179558){if(_0x179558){return _0x179558[_0x14b8('0x65')](_0xc298fc[_0x14b8('0x45')][_0x14b8('0x66')]);}})[_0x14b8('0x1f')](respondWithStatusCode(_0x4c3f86,null))[_0x14b8('0x28')](handleError(_0x4c3f86,null));};exports[_0x14b8('0x67')]=function(_0x414a8b,_0x37b6b2,_0x314a17){if(_0x414a8b[_0x14b8('0x5a')]['id']){delete _0x414a8b[_0x14b8('0x5a')]['id'];}return db['MailAccount'][_0x14b8('0x59')]({'where':{'id':_0x414a8b[_0x14b8('0x5b')]['id']}})['then'](handleEntityNotFound(_0x37b6b2,null))['then'](function(_0x41bf28){if(_0x41bf28){_0x414a8b[_0x14b8('0x5a')][_0x14b8('0x5e')]=_0x41bf28['id'];return db[_0x14b8('0x68')][_0x14b8('0x60')](_0x414a8b[_0x14b8('0x5a')]);}})[_0x14b8('0x1f')](respondWithResult(_0x37b6b2,null))[_0x14b8('0x28')](handleError(_0x37b6b2,null));};exports[_0x14b8('0x69')]=function(_0x23aca5,_0x233e69,_0x233f44){var _0x4c3a6a={'raw':![],'where':{}};var _0x2fc463={};var _0x24336f={'count':0x0,'rows':[]};return db[_0x14b8('0x40')][_0x14b8('0x62')]({'where':{'id':_0x23aca5[_0x14b8('0x5b')]['id']}})[_0x14b8('0x1f')](handleEntityNotFound(_0x233e69,null))[_0x14b8('0x1f')](function(_0x368108){if(_0x368108){_0x2fc463['model']=_['keys'](db[_0x14b8('0x68')][_0x14b8('0x41')]);_0x2fc463[_0x14b8('0x45')]=_['keys'](_0x23aca5[_0x14b8('0x45')]);_0x2fc463[_0x14b8('0x47')]=_[_0x14b8('0x48')](_0x2fc463[_0x14b8('0x44')],_0x2fc463[_0x14b8('0x45')]);_0x4c3a6a[_0x14b8('0x49')]=_[_0x14b8('0x48')](_0x2fc463[_0x14b8('0x44')],qs[_0x14b8('0x4a')](_0x23aca5[_0x14b8('0x45')][_0x14b8('0x4a')]));_0x4c3a6a[_0x14b8('0x49')]=_0x4c3a6a[_0x14b8('0x49')][_0x14b8('0x57')]?_0x4c3a6a[_0x14b8('0x49')]:_0x2fc463['model'];if(!_0x23aca5['query'][_0x14b8('0x4b')]('nolimit')){_0x4c3a6a[_0x14b8('0x2e')]=qs[_0x14b8('0x2e')](_0x23aca5['query'][_0x14b8('0x2e')]);_0x4c3a6a[_0x14b8('0x2c')]=qs[_0x14b8('0x2c')](_0x23aca5[_0x14b8('0x45')][_0x14b8('0x2c')]);}_0x4c3a6a['order']=qs['sort'](_0x23aca5[_0x14b8('0x45')]['sort']);_0x4c3a6a[_0x14b8('0x4e')]=qs[_0x14b8('0x47')](_[_0x14b8('0x4f')](_0x23aca5[_0x14b8('0x45')],_0x2fc463[_0x14b8('0x47')]));_0x4c3a6a[_0x14b8('0x4e')][_0x14b8('0x5e')]=_0x368108['id'];if(_0x23aca5['query'][_0x14b8('0x52')]){_0x4c3a6a[_0x14b8('0x4e')]=_[_0x14b8('0x50')](_0x4c3a6a[_0x14b8('0x4e')],{'$or':_[_0x14b8('0x3f')](_0x4c3a6a[_0x14b8('0x49')],function(_0x40e0fb){var _0x3c56de={};_0x3c56de[_0x40e0fb]={'$like':'%'+_0x23aca5[_0x14b8('0x45')]['filter']+'%'};return _0x3c56de;})});}_0x4c3a6a=_[_0x14b8('0x50')]({},_0x4c3a6a,_0x23aca5[_0x14b8('0x53')]);return db[_0x14b8('0x68')]['count']({'where':_0x4c3a6a['where']})[_0x14b8('0x1f')](function(_0x2c63b4){_0x24336f['count']=_0x2c63b4;if(_0x23aca5[_0x14b8('0x45')][_0x14b8('0x54')]){_0x4c3a6a[_0x14b8('0x58')]=[{'all':!![]}];}return db[_0x14b8('0x68')][_0x14b8('0x64')](_0x4c3a6a);})[_0x14b8('0x1f')](function(_0x22923a){_0x24336f['rows']=_0x22923a;return _0x24336f;});}})[_0x14b8('0x1f')](respondWithFilteredResult(_0x233e69,_0x4c3a6a))[_0x14b8('0x28')](handleError(_0x233e69,null));};exports['removeAnswers']=function(_0x306dfa,_0x49b03e,_0x26709d){return db['MailAccount'][_0x14b8('0x59')]({'where':{'id':_0x306dfa['params']['id']}})[_0x14b8('0x1f')](handleEntityNotFound(_0x49b03e,null))[_0x14b8('0x1f')](function(_0x27a4e3){if(_0x27a4e3){return _0x27a4e3[_0x14b8('0x6a')](_0x306dfa[_0x14b8('0x45')]['ids']);}})['then'](respondWithStatusCode(_0x49b03e,null))[_0x14b8('0x28')](handleError(_0x49b03e,null));};exports['create']=function(_0x4740d5,_0x4c355e){var _0x5c381a={'name':_0x4740d5['body'][_0x14b8('0x37')],'key':_0x4740d5[_0x14b8('0x5a')][_0x14b8('0x6b')],'email':_0x4740d5[_0x14b8('0x5a')][_0x14b8('0x6c')],'ListId':_0x4740d5[_0x14b8('0x5a')][_0x14b8('0x6d')],'active':!_[_0x14b8('0x6e')](_0x4740d5[_0x14b8('0x5a')][_0x14b8('0x6f')])?_0x4740d5['body'][_0x14b8('0x6f')]:!![],'description':_0x4740d5[_0x14b8('0x5a')][_0x14b8('0x70')]||null,'Imap':{},'Smtp':{}};if(_[_0x14b8('0x6e')](_0x4740d5[_0x14b8('0x5a')][_0x14b8('0x71')])){if(_0x4740d5[_0x14b8('0x5a')][_0x14b8('0x72')]){_0x5c381a[_0x14b8('0x3b')][_0x14b8('0x73')]=_0x5c381a[_0x14b8('0x3c')][_0x14b8('0x73')]=_0x4740d5[_0x14b8('0x5a')][_0x14b8('0x74')];_0x5c381a[_0x14b8('0x3b')][_0x14b8('0x75')]=_0x5c381a['Smtp'][_0x14b8('0x76')]=_0x4740d5[_0x14b8('0x5a')]['cpassword'];}else{_0x5c381a['Imap'][_0x14b8('0x77')]=_0x5c381a[_0x14b8('0x3c')][_0x14b8('0x77')]=![];}_0x5c381a['Imap'][_0x14b8('0x78')]=_0x4740d5['body'][_0x14b8('0x3b')]['host'];_0x5c381a[_0x14b8('0x3b')][_0x14b8('0x79')]=_0x4740d5['body'][_0x14b8('0x3b')][_0x14b8('0x79')];_0x5c381a[_0x14b8('0x3c')][_0x14b8('0x78')]=_0x4740d5[_0x14b8('0x5a')][_0x14b8('0x3c')][_0x14b8('0x78')];_0x5c381a[_0x14b8('0x3c')][_0x14b8('0x79')]=_0x4740d5[_0x14b8('0x5a')][_0x14b8('0x3c')][_0x14b8('0x79')];}else{_0x5c381a['Imap'][_0x14b8('0x7a')]=_0x5c381a['Smtp'][_0x14b8('0x7a')]=_0x4740d5[_0x14b8('0x5a')][_0x14b8('0x71')];_0x5c381a['Imap']['user']=_0x5c381a[_0x14b8('0x3c')]['user']=_0x4740d5[_0x14b8('0x5a')][_0x14b8('0x74')];_0x5c381a[_0x14b8('0x3b')]['password']=_0x5c381a[_0x14b8('0x3c')][_0x14b8('0x76')]=_0x4740d5[_0x14b8('0x5a')][_0x14b8('0x7b')];}return db['MailAccount']['create'](_0x5c381a,{'include':[{'model':db[_0x14b8('0x56')],'as':'Smtp'},{'model':db[_0x14b8('0x3a')],'as':_0x14b8('0x3b')}]})[_0x14b8('0x1f')](function(_0x3c4039){var _0x1a85e6=_0x4740d5[_0x14b8('0x73')][_0x14b8('0x33')]({'plain':!![]});if(!_0x1a85e6)throw new Error(_0x14b8('0x7c'));if(_0x1a85e6['role']===_0x14b8('0x73')){var _0xd0367c=_0x3c4039[_0x14b8('0x33')]({'plain':!![]});return db[_0x14b8('0x7d')][_0x14b8('0x59')]({'where':{'name':_0x14b8('0x34'),'userProfileId':_0x1a85e6[_0x14b8('0x7e')]},'raw':!![]})[_0x14b8('0x1f')](function(_0x2d973d){if(_0x2d973d&&_0x2d973d[_0x14b8('0x7f')]===0x0){return db[_0x14b8('0x35')][_0x14b8('0x60')]({'name':_0xd0367c[_0x14b8('0x37')],'resourceId':_0xd0367c['id'],'type':_0x2d973d[_0x14b8('0x37')],'sectionId':_0x2d973d['id']},{})[_0x14b8('0x1f')](function(){return _0x3c4039;});}else{return _0x3c4039;}})['catch'](function(_0x186a7c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x186a7c);throw _0x186a7c;});}return _0x3c4039;})[_0x14b8('0x1f')](respondWithResult(_0x4c355e,0xc9))['catch'](handleError(_0x4c355e,null));};exports[_0x14b8('0x80')]=function(_0x222a4f,_0x1226b5,_0xdd77bf){return db['MailAccount']['findOne']({'where':{'id':_0x222a4f['params']['id']}})[_0x14b8('0x1f')](handleEntityNotFound(_0x1226b5,null))[_0x14b8('0x1f')](function(_0x172bec){if(_0x172bec){return _0x172bec['getImap']();}return null;})[_0x14b8('0x1f')](respondWithResult(_0x1226b5,null))['catch'](handleError(_0x1226b5,null));};exports[_0x14b8('0x81')]=function(_0x49e3d1,_0x1087d9,_0x3c5216){if(_0x49e3d1[_0x14b8('0x5a')]['id']){delete _0x49e3d1['body']['id'];}return db[_0x14b8('0x40')][_0x14b8('0x59')]({'where':{'id':_0x49e3d1['params']['id']}})[_0x14b8('0x1f')](handleEntityNotFound(_0x1087d9,null))[_0x14b8('0x1f')](function(_0x1fb1d2){if(_0x1fb1d2){_0x49e3d1['body'][_0x14b8('0x5e')]=_0x1fb1d2['id'];return db['MailServerIn'][_0x14b8('0x60')](_0x49e3d1['body']);}})[_0x14b8('0x1f')](respondWithResult(_0x1087d9,null))[_0x14b8('0x28')](handleError(_0x1087d9,null));};exports[_0x14b8('0x82')]=function(_0x3efbe8,_0xbc10bd,_0x1cc0f4){return db['MailAccount']['findOne']({'where':{'id':_0x3efbe8[_0x14b8('0x5b')]['id']}})[_0x14b8('0x1f')](handleEntityNotFound(_0xbc10bd,null))[_0x14b8('0x1f')](function(_0x20fe30){if(_0x20fe30){return _0x20fe30[_0x14b8('0x83')](null);}return null;})[_0x14b8('0x1f')](respondWithStatusCode(_0xbc10bd,null))[_0x14b8('0x28')](handleError(_0xbc10bd,null));};exports[_0x14b8('0x84')]=function(_0x970900,_0x518ef7,_0x5a9f0e){return db['MailAccount'][_0x14b8('0x62')]({'where':{'id':_0x970900[_0x14b8('0x5b')]['id']}})[_0x14b8('0x1f')](handleEntityNotFound(_0x518ef7,null))[_0x14b8('0x1f')](function(_0x4adda){if(_0x4adda){return _0x4adda[_0x14b8('0x84')]();}return null;})[_0x14b8('0x1f')](respondWithResult(_0x518ef7,null))[_0x14b8('0x28')](handleError(_0x518ef7,null));};exports[_0x14b8('0x85')]=function(_0x40c3fa,_0x6e5d26,_0x560515){if(_0x40c3fa[_0x14b8('0x5a')]['id']){delete _0x40c3fa[_0x14b8('0x5a')]['id'];}return db[_0x14b8('0x40')][_0x14b8('0x59')]({'where':{'id':_0x40c3fa['params']['id']}})[_0x14b8('0x1f')](handleEntityNotFound(_0x6e5d26,null))['then'](function(_0x290e35){if(_0x290e35){_0x40c3fa[_0x14b8('0x5a')][_0x14b8('0x5e')]=_0x290e35['id'];return db[_0x14b8('0x56')][_0x14b8('0x60')](_0x40c3fa[_0x14b8('0x5a')]);}})[_0x14b8('0x1f')](respondWithResult(_0x6e5d26,null))[_0x14b8('0x28')](handleError(_0x6e5d26,null));};exports[_0x14b8('0x86')]=function(_0x2b43ec,_0x286b66,_0x3c28cd){return db[_0x14b8('0x40')][_0x14b8('0x62')]({'where':{'id':_0x2b43ec[_0x14b8('0x5b')]['id']}})[_0x14b8('0x1f')](handleEntityNotFound(_0x286b66,null))[_0x14b8('0x1f')](function(_0x543f4e){if(_0x543f4e){return _0x543f4e[_0x14b8('0x87')](null);}return null;})['then'](respondWithStatusCode(_0x286b66,null))[_0x14b8('0x28')](handleError(_0x286b66,null));};exports[_0x14b8('0x88')]=function(_0x4369c6,_0x1e76f2,_0x595a63){return db[_0x14b8('0x89')]['find']({'where':{'id':_0x4369c6[_0x14b8('0x5b')]['id']}})[_0x14b8('0x1f')](handleEntityNotFound(_0x1e76f2,null))['then'](function(_0x4d6aa9){if(_0x4d6aa9){return _0x4d6aa9['addInteraction'](_0x4369c6[_0x14b8('0x5a')][_0x14b8('0x66')],_[_0x14b8('0x8a')](_0x4369c6[_0x14b8('0x5a')],[_0x14b8('0x66'),'id'])||{});}})[_0x14b8('0x1f')](respondWithResult(_0x1e76f2,null))['catch'](handleError(_0x1e76f2,null));};exports[_0x14b8('0x8b')]=function(_0x23c23c,_0x383614,_0x3b0f36){var _0x295526={'raw':![],'where':{}};var _0x39d80b={};var _0x3fd9fd={'count':0x0,'rows':[]};return db[_0x14b8('0x40')][_0x14b8('0x62')]({'where':{'id':_0x23c23c[_0x14b8('0x5b')]['id']}})[_0x14b8('0x1f')](handleEntityNotFound(_0x383614,null))[_0x14b8('0x1f')](function(_0x3f1224){if(_0x3f1224){_0x39d80b[_0x14b8('0x44')]=_[_0x14b8('0x46')](db[_0x14b8('0x89')][_0x14b8('0x41')]);_0x39d80b[_0x14b8('0x45')]=_[_0x14b8('0x46')](_0x23c23c[_0x14b8('0x45')]);_0x39d80b['filters']=_[_0x14b8('0x48')](_0x39d80b[_0x14b8('0x44')],_0x39d80b[_0x14b8('0x45')]);_0x295526[_0x14b8('0x49')]=_[_0x14b8('0x48')](_0x39d80b[_0x14b8('0x44')],qs['fields'](_0x23c23c[_0x14b8('0x45')][_0x14b8('0x4a')]));_0x295526[_0x14b8('0x49')]=_0x295526['attributes'][_0x14b8('0x57')]?_0x295526[_0x14b8('0x49')]:_0x39d80b['model'];if(!_0x23c23c['query'][_0x14b8('0x4b')](_0x14b8('0x4c'))){_0x295526[_0x14b8('0x2e')]=qs[_0x14b8('0x2e')](_0x23c23c[_0x14b8('0x45')][_0x14b8('0x2e')]);_0x295526[_0x14b8('0x2c')]=qs['offset'](_0x23c23c['query'][_0x14b8('0x2c')]);}_0x295526[_0x14b8('0x63')]=qs['sort'](_0x23c23c[_0x14b8('0x45')]['sort']);_0x295526['where']=qs[_0x14b8('0x47')](_[_0x14b8('0x4f')](_0x23c23c['query'],_0x39d80b[_0x14b8('0x47')]));_0x295526[_0x14b8('0x4e')][_0x14b8('0x5e')]=_0x3f1224['id'];if(_0x23c23c['query']['filter']){_0x295526['where']=_['merge'](_0x295526[_0x14b8('0x4e')],{'$or':_['map'](_0x295526['attributes'],function(_0x43e085){var _0x4056a={};_0x4056a[_0x43e085]={'$like':'%'+_0x23c23c[_0x14b8('0x45')][_0x14b8('0x52')]+'%'};return _0x4056a;})});}_0x295526=_[_0x14b8('0x50')]({},_0x295526,_0x23c23c[_0x14b8('0x53')]);return db['MailInteraction'][_0x14b8('0x2f')]({'where':_0x295526[_0x14b8('0x4e')]})[_0x14b8('0x1f')](function(_0x505ea9){_0x3fd9fd[_0x14b8('0x2f')]=_0x505ea9;if(_0x23c23c['query'][_0x14b8('0x54')]){_0x295526[_0x14b8('0x58')]=[{'model':db[_0x14b8('0x8c')],'as':_0x14b8('0x8d'),'required':![]},{'model':db[_0x14b8('0x8e')],'as':'Owner','attributes':[_0x14b8('0x37'),_0x14b8('0x8f'),_0x14b8('0x90')],'required':![]},{'model':db[_0x14b8('0x91')],'as':_0x14b8('0x92'),'attributes':['id',_0x14b8('0x37'),'color'],'where':_0x23c23c[_0x14b8('0x45')][_0x14b8('0x93')]?{'id':_0x23c23c[_0x14b8('0x45')][_0x14b8('0x93')]}:undefined,'required':_0x23c23c['query'][_0x14b8('0x93')]?!![]:![]}];}return db[_0x14b8('0x89')][_0x14b8('0x64')](_0x295526);})['then'](function(_0x32dd28){_0x3fd9fd[_0x14b8('0x55')]=_0x32dd28;return _0x3fd9fd;});}})[_0x14b8('0x1f')](respondWithFilteredResult(_0x383614,_0x295526))[_0x14b8('0x28')](handleError(_0x383614,null));};exports[_0x14b8('0x94')]=function(_0x2615b3,_0x43c10a,_0x5720ee){return db[_0x14b8('0x40')]['findOne']({'where':{'id':_0x2615b3[_0x14b8('0x5b')]['id']}})['then'](handleEntityNotFound(_0x43c10a,null))['then'](function(_0x25b727){if(_0x25b727){return db[_0x14b8('0x95')]['transaction'](function(_0x40fa13){return db['MailApplication'][_0x14b8('0x32')]({'where':{'MailAccountId':_0x2615b3['params']['id']},'transaction':_0x40fa13})[_0x14b8('0x1f')](function(_0x2e0b3e){var _0x471eff=_[_0x14b8('0x3f')](_0x2615b3[_0x14b8('0x5a')],function(_0xd44056){_0xd44056['MailAccountId']=_0x2615b3[_0x14b8('0x5b')]['id'];return _0xd44056;});return db[_0x14b8('0x96')][_0x14b8('0x97')](_0x471eff,{'transaction':_0x40fa13});});})[_0x14b8('0x1f')](function(){return db[_0x14b8('0x96')][_0x14b8('0x98')]({'where':{'MailAccountId':_0x2615b3['params']['id']},'order':_0x14b8('0x99')});});}})[_0x14b8('0x1f')](respondWithResult(_0x43c10a,null))['catch'](handleError(_0x43c10a,null));};exports[_0x14b8('0x9a')]=function(_0x3a830f,_0x246a9d,_0x3b053a){var _0x5a87b5={};var _0x28b254={};var _0x19ce26;var _0x1e9ca2;return db[_0x14b8('0x40')]['findOne']({'where':{'id':_0x3a830f[_0x14b8('0x5b')]['id']}})[_0x14b8('0x1f')](handleEntityNotFound(_0x246a9d,null))[_0x14b8('0x1f')](function(_0x4eebbc){if(_0x4eebbc){_0x19ce26=_0x4eebbc;_0x28b254[_0x14b8('0x44')]=_['keys'](db['MailApplication']['rawAttributes']);_0x28b254[_0x14b8('0x45')]=_[_0x14b8('0x46')](_0x3a830f['query']);_0x28b254[_0x14b8('0x47')]=_[_0x14b8('0x48')](_0x28b254['model'],_0x28b254[_0x14b8('0x45')]);_0x5a87b5[_0x14b8('0x49')]=_[_0x14b8('0x48')](_0x28b254[_0x14b8('0x44')],qs[_0x14b8('0x4a')](_0x3a830f[_0x14b8('0x45')][_0x14b8('0x4a')]));_0x5a87b5['attributes']=_0x5a87b5[_0x14b8('0x49')][_0x14b8('0x57')]?_0x5a87b5[_0x14b8('0x49')]:_0x28b254[_0x14b8('0x44')];_0x5a87b5[_0x14b8('0x63')]=qs['sort'](_0x3a830f[_0x14b8('0x45')][_0x14b8('0x4d')]);_0x5a87b5[_0x14b8('0x4e')]=qs[_0x14b8('0x47')](_[_0x14b8('0x4f')](_0x3a830f[_0x14b8('0x45')],_0x28b254[_0x14b8('0x47')]));if(_0x3a830f[_0x14b8('0x45')][_0x14b8('0x52')]){_0x5a87b5['where']=_[_0x14b8('0x50')](_0x5a87b5[_0x14b8('0x4e')],{'$or':_[_0x14b8('0x3f')](_0x5a87b5[_0x14b8('0x49')],function(_0x235ed3){var _0x547dbf={};_0x547dbf[_0x235ed3]={'$like':'%'+_0x3a830f[_0x14b8('0x45')][_0x14b8('0x52')]+'%'};return _0x547dbf;})});}_0x5a87b5=_[_0x14b8('0x50')]({},_0x5a87b5,_0x3a830f[_0x14b8('0x53')]);return _0x19ce26['getApplications'](_0x5a87b5);}})[_0x14b8('0x1f')](function(_0x176399){if(_0x176399){_0x1e9ca2=_0x176399[_0x14b8('0x57')];if(!_0x3a830f[_0x14b8('0x45')][_0x14b8('0x4b')]('nolimit')){_0x5a87b5['limit']=qs[_0x14b8('0x2e')](_0x3a830f[_0x14b8('0x45')]['limit']);_0x5a87b5[_0x14b8('0x2c')]=qs[_0x14b8('0x2c')](_0x3a830f[_0x14b8('0x45')][_0x14b8('0x2c')]);}return _0x19ce26[_0x14b8('0x9a')](_0x5a87b5);}})[_0x14b8('0x1f')](function(_0x3d9631){if(_0x3d9631){return _0x3d9631?{'count':_0x1e9ca2,'rows':_0x3d9631}:null;}})[_0x14b8('0x1f')](respondWithResult(_0x246a9d,null))['catch'](handleError(_0x246a9d,null));};exports[_0x14b8('0x9b')]=function(_0x23d8ee,_0xa57f62,_0x3c007c){var _0x13386d={'raw':!![],'where':{}};var _0x1a3cf7={};var _0xc0dd60={'count':0x0,'rows':[]};return db[_0x14b8('0x40')][_0x14b8('0x62')]({'where':{'id':_0x23d8ee[_0x14b8('0x5b')]['id']}})[_0x14b8('0x1f')](handleEntityNotFound(_0xa57f62,null))[_0x14b8('0x1f')](function(_0x4066d3){if(_0x4066d3){_0x1a3cf7[_0x14b8('0x44')]=_[_0x14b8('0x46')](db[_0x14b8('0x9c')][_0x14b8('0x41')]);_0x1a3cf7[_0x14b8('0x45')]=_[_0x14b8('0x46')](_0x23d8ee[_0x14b8('0x45')]);_0x1a3cf7['filters']=_[_0x14b8('0x48')](_0x1a3cf7[_0x14b8('0x44')],_0x1a3cf7['query']);_0x13386d[_0x14b8('0x49')]=_[_0x14b8('0x48')](_0x1a3cf7[_0x14b8('0x44')],qs['fields'](_0x23d8ee[_0x14b8('0x45')]['fields']));_0x13386d['attributes']=_0x13386d[_0x14b8('0x49')][_0x14b8('0x57')]?_0x13386d[_0x14b8('0x49')]:_0x1a3cf7['model'];if(!_0x23d8ee['query'][_0x14b8('0x4b')](_0x14b8('0x4c'))){_0x13386d['limit']=qs['limit'](_0x23d8ee[_0x14b8('0x45')][_0x14b8('0x2e')]);_0x13386d[_0x14b8('0x2c')]=qs[_0x14b8('0x2c')](_0x23d8ee[_0x14b8('0x45')][_0x14b8('0x2c')]);}_0x13386d['order']=qs['sort'](_0x23d8ee['query'][_0x14b8('0x4d')]);_0x13386d[_0x14b8('0x4e')]=qs[_0x14b8('0x47')](_['pick'](_0x23d8ee[_0x14b8('0x45')],_0x1a3cf7[_0x14b8('0x47')]));_0x13386d['where'][_0x14b8('0x5e')]=_0x4066d3['id'];if(_0x23d8ee[_0x14b8('0x45')][_0x14b8('0x52')]){_0x13386d[_0x14b8('0x4e')]=_[_0x14b8('0x50')](_0x13386d['where'],{'$or':_['map'](_0x13386d[_0x14b8('0x49')],function(_0x3a07eb){var _0x24ea74={};_0x24ea74[_0x3a07eb]={'$like':'%'+_0x23d8ee[_0x14b8('0x45')]['filter']+'%'};return _0x24ea74;})});}if(_0x23d8ee['query']['$gte']){var _0x417f9b=_0x23d8ee[_0x14b8('0x45')]['$gte'][_0x14b8('0x9d')](',');var _0x35e3e9={};_0x35e3e9[_0x417f9b[0x0]]={'$gte':moment(_0x417f9b[0x1])[_0x14b8('0x9e')](_0x14b8('0x9f'))};_0x13386d[_0x14b8('0x4e')]=_['merge'](_0x13386d[_0x14b8('0x4e')],_0x35e3e9);}_0x13386d=_['merge']({},_0x13386d,_0x23d8ee[_0x14b8('0x53')]);return db[_0x14b8('0x9c')][_0x14b8('0x2f')]({'where':_0x13386d['where']})[_0x14b8('0x1f')](function(_0x5eebab){_0xc0dd60[_0x14b8('0x2f')]=_0x5eebab;if(_0x23d8ee[_0x14b8('0x45')][_0x14b8('0x54')]){_0x13386d[_0x14b8('0x58')]=[{'all':!![]}];}return db[_0x14b8('0x9c')][_0x14b8('0x64')](_0x13386d);})['then'](function(_0x25cdf7){if(_0x23d8ee[_0x14b8('0x45')]['inlineCss']==='true'){for(var _0x3e17e5=0x0;_0x3e17e5<_0x25cdf7[_0x14b8('0x57')];_0x3e17e5++){_0x25cdf7[_0x3e17e5][_0x14b8('0x5a')]=juice(_0x25cdf7[_0x3e17e5][_0x14b8('0x5a')]);}}_0xc0dd60[_0x14b8('0x55')]=_0x25cdf7;return _0xc0dd60;});}})[_0x14b8('0x1f')](respondWithFilteredResult(_0xa57f62,_0x13386d))[_0x14b8('0x28')](handleError(_0xa57f62,null));};exports[_0x14b8('0x38')]=function(_0x3d99d7,_0x2fa2c0,_0x530d0e){var _0x58ba4b,_0x5adebb={},_0x454c5f;if(_0x3d99d7[_0x14b8('0x5a')]['to']){_0x454c5f=_0x3d99d7[_0x14b8('0x5a')]['to'][_0x14b8('0x9d')](',')[0x0];}return db[_0x14b8('0x40')][_0x14b8('0x59')]({'where':{'id':_0x3d99d7['params']['id']},'include':[{'model':db[_0x14b8('0xa0')],'as':_0x14b8('0xa1'),'include':[{'model':db[_0x14b8('0x8c')],'as':_0x14b8('0xa2'),'where':{'email':_0x454c5f},'limit':0x1,'order':[['updatedAt',_0x14b8('0xa3')]]}]},{'model':db[_0x14b8('0x56')],'as':_0x14b8('0x3c'),'raw':!![]}]})[_0x14b8('0x1f')](handleEntityNotFound(_0x2fa2c0,null))['then'](function(_0x29c4b3){if(_0x29c4b3){_0x58ba4b=_0x29c4b3;if(_0x29c4b3[_0x14b8('0x3c')]){if(_[_0x14b8('0x6e')](_0x3d99d7['body'][_0x14b8('0xa4')])){_0x3d99d7[_0x14b8('0x5a')][_0x14b8('0xa4')]=util[_0x14b8('0x9e')](_0x14b8('0xa5'),_0x29c4b3[_0x14b8('0x37')],_0x29c4b3[_0x14b8('0x6c')]||_0x29c4b3[_0x14b8('0x3c')][_0x14b8('0x73')]);}if(_0x3d99d7['body']['attachments']&&_0x3d99d7['body']['attachments'][_0x14b8('0x57')]){for(var _0x3ded1b=0x0;_0x3ded1b<_0x3d99d7[_0x14b8('0x5a')]['attachments'][_0x14b8('0x57')];_0x3ded1b+=0x1){_0x3d99d7[_0x14b8('0x5a')][_0x14b8('0xa6')][_0x3ded1b]={'filename':_0x3d99d7[_0x14b8('0x5a')]['attachments'][_0x3ded1b][_0x14b8('0x37')],'path':path['join'](config[_0x14b8('0xa7')],_0x14b8('0xa8'),_0x3d99d7['body']['attachments'][_0x3ded1b][_0x14b8('0xa9')])};}}var _0x372fad={'tls':{'rejectUnauthorized':![]}};if(_[_0x14b8('0x6e')](_0x29c4b3['Smtp'][_0x14b8('0x7a')])){if(_0x29c4b3['Smtp'][_0x14b8('0x77')]){_0x372fad[_0x14b8('0xaa')]={'user':_0x29c4b3[_0x14b8('0x3c')][_0x14b8('0x73')],'pass':_0x29c4b3[_0x14b8('0x3c')]['pass']};}_0x372fad[_0x14b8('0x78')]=_0x29c4b3[_0x14b8('0x3c')][_0x14b8('0x78')];_0x372fad['port']=_0x29c4b3[_0x14b8('0x3c')][_0x14b8('0x79')];_0x372fad['secure']=_0x29c4b3[_0x14b8('0x3c')]['secure'];}else{_0x372fad[_0x14b8('0x7a')]=_0x29c4b3[_0x14b8('0x3c')][_0x14b8('0x7a')];_0x372fad[_0x14b8('0xaa')]={'user':_0x29c4b3[_0x14b8('0x3c')]['user'],'pass':_0x29c4b3[_0x14b8('0x3c')]['pass']};}return respondWithRpcPromise(_0x14b8('0xab'),_0x14b8('0xac'),{'account':_0x372fad,'message':_0x3d99d7[_0x14b8('0x5a')]});}else{throw new Error(_0x14b8('0xad'));}}})[_0x14b8('0x1f')](function(_0x47d3a4){if(_0x47d3a4){_0x5adebb=_0x47d3a4;if(_0x58ba4b['List']){if(_0x58ba4b[_0x14b8('0xa1')][_0x14b8('0xa2')][_0x14b8('0x57')]){return _0x58ba4b[_0x14b8('0xa1')][_0x14b8('0xa2')][0x0];}else{return db[_0x14b8('0x8c')][_0x14b8('0x60')](_[_0x14b8('0xae')](_0x3d99d7['body'],{'firstName':_0x3d99d7[_0x14b8('0x5a')]['to'],'email':_0x3d99d7[_0x14b8('0x5a')]['to'],'phone':_0x3d99d7[_0x14b8('0x5a')]['to'],'ListId':_0x58ba4b['ListId']}));}}else{throw new Error(_0x14b8('0xad'));}}})[_0x14b8('0x1f')](function(_0x2cbd82){if(_0x2cbd82){var _0x22fa49={'UserId':_0x3d99d7['user']['id'],'ContactId':_0x2cbd82['id'],'MailAccountId':_0x58ba4b['id'],'inReplyTo':_0x5adebb[_0x14b8('0xaf')],'to':_0x3d99d7[_0x14b8('0x5a')][_0x14b8('0xa4')],'cc':_0x3d99d7[_0x14b8('0x5a')]['cc'],'subject':_0x3d99d7[_0x14b8('0x5a')]['subject'],'attach':_0x3d99d7[_0x14b8('0x5a')]['attach'],'firstMsgDirection':_0x14b8('0xb0'),'lastMsgAt':moment()[_0x14b8('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'out','Messages':[_[_0x14b8('0x50')](_0x3d99d7['body'],{'messageId':_0x5adebb[_0x14b8('0xaf')],'sentAt':moment()[_0x14b8('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x58ba4b['id'],'UserId':_0x3d99d7[_0x14b8('0x73')]['id'],'ContactId':_0x2cbd82['id']})]};if(_0x3d99d7['body']['Interaction']){_0x22fa49=_[_0x14b8('0x50')](_0x22fa49,_0x3d99d7[_0x14b8('0x5a')][_0x14b8('0xb1')]);}return db['MailInteraction'][_0x14b8('0x60')](_0x22fa49,{'include':[{'model':db[_0x14b8('0x9c')],'as':'Messages'}]});}})[_0x14b8('0x1f')](respondWithResult(_0x2fa2c0,null))['catch'](handleError(_0x2fa2c0,null));};exports[_0x14b8('0xb2')]=function(_0x1d7d69,_0x264395,_0x29d17a){return db[_0x14b8('0x40')][_0x14b8('0x59')]({'where':{'id':_0x1d7d69[_0x14b8('0x5b')]['id']},'include':[{'model':db[_0x14b8('0x56')],'as':_0x14b8('0x3c'),'raw':!![]}]})['then'](handleEntityNotFound(_0x264395,null))['then'](function(_0x28cdc4){if(_0x28cdc4&&_0x28cdc4['Smtp']){var _0x5c18c4={'id':_0x28cdc4['id'],'tls':{'rejectUnauthorized':![]}};if(_0x28cdc4[_0x14b8('0x3c')]['service']){_0x5c18c4[_0x14b8('0x7a')]=_0x28cdc4['Smtp'][_0x14b8('0x7a')];}else{_0x5c18c4[_0x14b8('0x78')]=_0x28cdc4[_0x14b8('0x3c')][_0x14b8('0x78')];_0x5c18c4[_0x14b8('0x79')]=_0x28cdc4[_0x14b8('0x3c')]['port'];_0x5c18c4['secure']=_0x28cdc4[_0x14b8('0x3c')][_0x14b8('0xb3')];}if(_0x28cdc4[_0x14b8('0x3c')][_0x14b8('0x77')]){_0x5c18c4[_0x14b8('0xaa')]={'user':_0x28cdc4[_0x14b8('0x3c')][_0x14b8('0x73')],'pass':_0x28cdc4[_0x14b8('0x3c')]['pass']};}return respondWithRpcPromise('VerifySmtp',_0x14b8('0xb2'),{'account':_0x5c18c4});}})[_0x14b8('0x1f')](respondWithResult(_0x264395,null))[_0x14b8('0x28')](handleError(_0x264395,null));};exports['destroy']=function(_0x4ded26,_0x146a29){return db['MailAccount'][_0x14b8('0x59')]({'where':{'id':_0x4ded26['params']['id']}})['then'](handleEntityNotFound(_0x146a29,null))[_0x14b8('0x1f')](function(_0x338389){if(_0x338389&&_0x338389[_0x14b8('0x7a')]){throw new db[(_0x14b8('0xb4'))][(_0x14b8('0xb5'))](_0x14b8('0xb6'));}return _0x338389;})[_0x14b8('0x1f')](removeEntity(_0x146a29,null))[_0x14b8('0x28')](handleError(_0x146a29,null));};exports[_0x14b8('0xb7')]=function(_0x22f99c,_0x3d3e7f,_0x5be449){return db['MailAccount'][_0x14b8('0x59')]({'where':{'id':_0x22f99c['params']['id']}})[_0x14b8('0x1f')](handleEntityNotFound(_0x3d3e7f,null))['then'](function(_0x188ab6){if(_0x188ab6){return _0x188ab6['addAgents'](_0x22f99c[_0x14b8('0x5a')][_0x14b8('0x66')],_[_0x14b8('0x8a')](_0x22f99c[_0x14b8('0x5a')],[_0x14b8('0x66'),'id'])||{})[_0x14b8('0xb8')](function(_0x1249ae){for(var _0x11838d=0x0;_0x11838d<_0x22f99c['body'][_0x14b8('0x66')][_0x14b8('0x57')];_0x11838d+=0x1){socket['emit'](_0x14b8('0xb9'),{'UserId':Number(_0x22f99c[_0x14b8('0x5a')][_0x14b8('0x66')][_0x11838d]),'MailAccountId':Number(_0x22f99c[_0x14b8('0x5b')]['id'])});}return _0x1249ae;});}})[_0x14b8('0x1f')](respondWithResult(_0x3d3e7f,null))[_0x14b8('0x28')](handleError(_0x3d3e7f,null));};exports[_0x14b8('0xba')]=function(_0x24e7ed,_0x55b569,_0x235421){return db[_0x14b8('0x40')]['find']({'where':{'id':_0x24e7ed[_0x14b8('0x5b')]['id']}})[_0x14b8('0x1f')](handleEntityNotFound(_0x55b569,null))[_0x14b8('0x1f')](function(_0x1cfe91){if(_0x1cfe91){return _0x1cfe91['removeAgents'](_0x24e7ed[_0x14b8('0x45')][_0x14b8('0x66')])['then'](function(){if(_[_0x14b8('0xbb')](_0x24e7ed[_0x14b8('0x45')]['ids'])){for(var _0x28f353=0x0;_0x28f353<_0x24e7ed['query'][_0x14b8('0x66')][_0x14b8('0x57')];_0x28f353+=0x1){socket['emit'](_0x14b8('0xbc'),{'UserId':Number(_0x24e7ed[_0x14b8('0x45')][_0x14b8('0x66')][_0x28f353]),'MailAccountId':Number(_0x24e7ed[_0x14b8('0x5b')]['id'])});}}else{socket[_0x14b8('0xbd')](_0x14b8('0xbc'),{'UserId':Number(_0x24e7ed[_0x14b8('0x45')]['ids']),'MailAccountId':Number(_0x24e7ed[_0x14b8('0x5b')]['id'])});}});}})[_0x14b8('0x1f')](respondWithStatusCode(_0x55b569,null))[_0x14b8('0x28')](handleError(_0x55b569,null));};exports[_0x14b8('0xbe')]=function(_0x255b89,_0x110076,_0xb0eee7){var _0x286091={};var _0x446e20={};var _0x2028c5;var _0x3fba7a;return db[_0x14b8('0x40')]['findOne']({'where':{'id':_0x255b89[_0x14b8('0x5b')]['id']}})[_0x14b8('0x1f')](handleEntityNotFound(_0x110076,null))[_0x14b8('0x1f')](function(_0x42574b){if(_0x42574b){_0x2028c5=_0x42574b;_0x446e20[_0x14b8('0x44')]=_[_0x14b8('0x46')](db['User'][_0x14b8('0x41')]);_0x446e20[_0x14b8('0x45')]=_[_0x14b8('0x46')](_0x255b89[_0x14b8('0x45')]);_0x446e20[_0x14b8('0x47')]=_[_0x14b8('0x48')](_0x446e20['model'],_0x446e20['query']);_0x286091[_0x14b8('0x49')]=_[_0x14b8('0x48')](_0x446e20[_0x14b8('0x44')],qs[_0x14b8('0x4a')](_0x255b89['query'][_0x14b8('0x4a')]));_0x286091[_0x14b8('0x49')]=_0x286091[_0x14b8('0x49')][_0x14b8('0x57')]?_0x286091[_0x14b8('0x49')]:_0x446e20[_0x14b8('0x44')];_0x286091[_0x14b8('0x63')]=qs['sort'](_0x255b89[_0x14b8('0x45')][_0x14b8('0x4d')]);_0x286091[_0x14b8('0x4e')]=qs[_0x14b8('0x47')](_[_0x14b8('0x4f')](_0x255b89[_0x14b8('0x45')],_0x446e20['filters']));if(_0x255b89[_0x14b8('0x45')][_0x14b8('0x52')]){_0x286091[_0x14b8('0x4e')]=_[_0x14b8('0x50')](_0x286091[_0x14b8('0x4e')],{'$or':_['map'](_0x286091[_0x14b8('0x49')],function(_0x589e56){var _0xf71398={};_0xf71398[_0x589e56]={'$like':'%'+_0x255b89[_0x14b8('0x45')][_0x14b8('0x52')]+'%'};return _0xf71398;})});}_0x286091=_[_0x14b8('0x50')]({},_0x286091,_0x255b89['options']);return _0x2028c5[_0x14b8('0xbe')](_0x286091);}})[_0x14b8('0x1f')](function(_0x281032){if(_0x281032){_0x3fba7a=_0x281032[_0x14b8('0x57')];if(!_0x255b89[_0x14b8('0x45')][_0x14b8('0x4b')]('nolimit')){_0x286091[_0x14b8('0x2e')]=qs['limit'](_0x255b89[_0x14b8('0x45')]['limit']);_0x286091[_0x14b8('0x2c')]=qs[_0x14b8('0x2c')](_0x255b89['query'][_0x14b8('0x2c')]);}return _0x2028c5[_0x14b8('0xbe')](_0x286091);}})['then'](function(_0x42b71b){if(_0x42b71b){return _0x42b71b?{'count':_0x3fba7a,'rows':_0x42b71b}:null;}})[_0x14b8('0x1f')](respondWithResult(_0x110076,null))[_0x14b8('0x28')](handleError(_0x110076,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index b79cf3d..c4ce8b5 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 _0x6b4c=['events','../../mysqldb','MailAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x29a862,_0x23b978){var _0x298be9=function(_0x23d07c){while(--_0x23d07c){_0x29a862['push'](_0x29a862['shift']());}};_0x298be9(++_0x23b978);}(_0x6b4c,0x8c));var _0xc6b4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b4c[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xc6b4('0x0'));var MailAccount=require(_0xc6b4('0x1'))['db'][_0xc6b4('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xc6b4('0x3')](0x0);var events={'afterCreate':_0xc6b4('0x4'),'afterUpdate':_0xc6b4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4875fc){return function(_0x3a89a0,_0x211954,_0x3c631f){MailAccountEvents['emit'](_0x4875fc+':'+_0x3a89a0['id'],_0x3a89a0);MailAccountEvents[_0xc6b4('0x6')](_0x4875fc,_0x3a89a0);_0x3c631f(null);};}for(var e in events){if(events[_0xc6b4('0x7')](e)){var event=events[e];MailAccount[_0xc6b4('0x8')](e,emitEvent(event));}}module[_0xc6b4('0x9')]=MailAccountEvents; \ No newline at end of file +var _0x06ae=['save','update','remove','hasOwnProperty','hook','exports','../../mysqldb','MailAccount','setMaxListeners'];(function(_0x1205db,_0x2aea61){var _0x2665c7=function(_0x32c09b){while(--_0x32c09b){_0x1205db['push'](_0x1205db['shift']());}};_0x2665c7(++_0x2aea61);}(_0x06ae,0x16e));var _0xe06a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x06ae[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0xe06a('0x0'))['db'][_0xe06a('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xe06a('0x2')](0x0);var events={'afterCreate':_0xe06a('0x3'),'afterUpdate':_0xe06a('0x4'),'afterDestroy':_0xe06a('0x5')};function emitEvent(_0x2dfe68){return function(_0x1d695f,_0x1e7706,_0x4de363){MailAccountEvents['emit'](_0x2dfe68+':'+_0x1d695f['id'],_0x1d695f);MailAccountEvents['emit'](_0x2dfe68,_0x1d695f);_0x4de363(null);};}for(var e in events){if(events[_0xe06a('0x6')](e)){var event=events[e];MailAccount[_0xe06a('0x7')](e,emitEvent(event));}}module[_0xe06a('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index d4290ff..bc8fa70 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 _0xb91e=['../../config/environment','./mailAccount.attributes','exports','define','mail_accounts','api','moment','bluebird','request-promise','path'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xb91e,0x127));var _0xeb91=function(_0x234a63,_0x5e6f8d){_0x234a63=_0x234a63-0x0;var _0x34b269=_0xb91e[_0x234a63];return _0x34b269;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xeb91('0x0'));var moment=require(_0xeb91('0x1'));var BPromise=require(_0xeb91('0x2'));var rp=require(_0xeb91('0x3'));var fs=require('fs');var path=require(_0xeb91('0x4'));var rimraf=require('rimraf');var config=require(_0xeb91('0x5'));var attributes=require(_0xeb91('0x6'));module[_0xeb91('0x7')]=function(_0x4851a1,_0x48a1e9){return _0x4851a1[_0xeb91('0x8')]('MailAccount',attributes,{'tableName':_0xeb91('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf090=['MailAccount','mail_accounts','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./mailAccount.attributes','define'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xf090,0x12e));var _0x0f09=function(_0xaad32b,_0x427ba0){_0xaad32b=_0xaad32b-0x0;var _0x3a28fa=_0xf090[_0xaad32b];return _0x3a28fa;};'use strict';var _=require(_0x0f09('0x0'));var util=require(_0x0f09('0x1'));var logger=require(_0x0f09('0x2'))(_0x0f09('0x3'));var moment=require('moment');var BPromise=require(_0x0f09('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0f09('0x5'));var rimraf=require(_0x0f09('0x6'));var config=require(_0x0f09('0x7'));var attributes=require(_0x0f09('0x8'));module['exports']=function(_0x23fa58,_0x365406){return _0x23fa58[_0x0f09('0x9')](_0x0f09('0xa'),attributes,{'tableName':_0x0f09('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 e7861f5..e1276ce 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 _0x73cd=['mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','then','List','get','account','omit','applications','list','orderBy','priority','asc','autoclose','close','*,*,*,*','create','messageId','generate','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','MailInteraction','Contact\x20not\x20found','spread','update','subject','attach','interaction','created','attachments','originTo','originCc','ChatWebsiteId','originChannel','Email','Attachment','Attachments','UserId','User','agent','name','waitForTheAssignedAgent','startRouting','Start','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','request','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','GetMailAccount','MailAccount','options','raw','where','attributes','limit','include','map','model','stringify','catch','find','ShowMailAccount','mail','difference','keys','createdAt','updatedAt','CompanyId','body','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey'];(function(_0x592c14,_0x34cf86){var _0x1cc2eb=function(_0x28b4ec){while(--_0x28b4ec){_0x592c14['push'](_0x592c14['shift']());}};_0x1cc2eb(++_0x34cf86);}(_0x73cd,0x1d2));var _0xd73c=function(_0x29f730,_0x23d7ed){_0x29f730=_0x29f730-0x0;var _0x189806=_0x73cd[_0x29f730];return _0x189806;};'use strict';var _=require(_0xd73c('0x0'));var util=require(_0xd73c('0x1'));var moment=require(_0xd73c('0x2'));var BPromise=require(_0xd73c('0x3'));var rs=require(_0xd73c('0x4'));var fs=require('fs');var Redis=require(_0xd73c('0x5'));var db=require(_0xd73c('0x6'))['db'];var utils=require(_0xd73c('0x7'));var logger=require(_0xd73c('0x8'))(_0xd73c('0x9'));var config=require('../../config/environment');var jayson=require(_0xd73c('0xa'));var client=jayson[_0xd73c('0xb')][_0xd73c('0xc')]({'port':0x232c});config[_0xd73c('0xd')]=_[_0xd73c('0xe')](config['redis'],{'host':_0xd73c('0xf'),'port':0x18eb});var socket=require(_0xd73c('0x10'))(new Redis(config[_0xd73c('0xd')]));require(_0xd73c('0x11'))['register'](socket);function respondWithRpcPromise(_0xa6b042,_0x29f40a,_0x1df5a8){return new BPromise(function(_0x31cb19,_0x25b461){return client[_0xd73c('0x12')](_0xa6b042,_0x1df5a8)['then'](function(_0xc4c9a7){logger['info'](_0xd73c('0x13'),_0x29f40a,_0xd73c('0x14'));logger[_0xd73c('0x15')](_0xd73c('0x16'),_0x29f40a,_0xd73c('0x14'),JSON['stringify'](_0xc4c9a7));if(_0xc4c9a7['error']){if(_0xc4c9a7[_0xd73c('0x17')][_0xd73c('0x18')]===0x1f4){logger['error'](_0xd73c('0x13'),_0x29f40a,_0xc4c9a7[_0xd73c('0x17')][_0xd73c('0x19')]);return _0x25b461(_0xc4c9a7[_0xd73c('0x17')][_0xd73c('0x19')]);}logger[_0xd73c('0x17')](_0xd73c('0x13'),_0x29f40a,_0xc4c9a7[_0xd73c('0x17')][_0xd73c('0x19')]);return _0x31cb19(_0xc4c9a7[_0xd73c('0x17')]['message']);}else{logger[_0xd73c('0x1a')](_0xd73c('0x13'),_0x29f40a,'request\x20sent');_0x31cb19(_0xc4c9a7[_0xd73c('0x1b')][_0xd73c('0x19')]);}})['catch'](function(_0x11510f){logger[_0xd73c('0x17')](_0xd73c('0x13'),_0x29f40a,_0x11510f);_0x25b461(_0x11510f);});});}exports[_0xd73c('0x1c')]=function(_0x22350b){var _0x59c7b0=this;return new Promise(function(_0x1e4062,_0x5e0288){return db[_0xd73c('0x1d')]['findAll']({'raw':_0x22350b['options']?_0x22350b[_0xd73c('0x1e')][_0xd73c('0x1f')]===undefined?!![]:![]:!![],'where':_0x22350b[_0xd73c('0x1e')]?_0x22350b[_0xd73c('0x1e')][_0xd73c('0x20')]||null:null,'attributes':_0x22350b[_0xd73c('0x1e')]?_0x22350b[_0xd73c('0x1e')][_0xd73c('0x21')]||null:null,'limit':_0x22350b[_0xd73c('0x1e')]?_0x22350b[_0xd73c('0x1e')][_0xd73c('0x22')]||null:null,'include':_0x22350b['options']?_0x22350b['options'][_0xd73c('0x23')]?_[_0xd73c('0x24')](_0x22350b['options'][_0xd73c('0x23')],function(_0x8469f8){return{'model':db[_0x8469f8[_0xd73c('0x25')]],'as':_0x8469f8['as'],'attributes':_0x8469f8[_0xd73c('0x21')],'include':_0x8469f8['include']?_[_0xd73c('0x24')](_0x8469f8[_0xd73c('0x23')],function(_0x54874f){return{'model':db[_0x54874f[_0xd73c('0x25')]],'as':_0x54874f['as'],'attributes':_0x54874f['attributes'],'include':_0x54874f[_0xd73c('0x23')]?_[_0xd73c('0x24')](_0x54874f[_0xd73c('0x23')],function(_0x97ff11){return{'model':db[_0x97ff11['model']],'as':_0x97ff11['as'],'attributes':_0x97ff11[_0xd73c('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x19f222){logger[_0xd73c('0x1a')](_0xd73c('0x1c'),_0x22350b);logger['debug']('GetMailAccount',_0x22350b,JSON[_0xd73c('0x26')](_0x19f222));_0x1e4062(_0x19f222);})[_0xd73c('0x27')](function(_0x2cd6a2){logger[_0xd73c('0x17')]('GetMailAccount',_0x2cd6a2[_0xd73c('0x19')],_0x22350b);_0x5e0288(_0x59c7b0[_0xd73c('0x17')](0x1f4,_0x2cd6a2[_0xd73c('0x19')]));});});};exports['ShowMailAccount']=function(_0x3c60cf){var _0x4ab15a=this;return new Promise(function(_0x3a7634,_0x52ad11){return db[_0xd73c('0x1d')][_0xd73c('0x28')]({'raw':_0x3c60cf[_0xd73c('0x1e')]?_0x3c60cf[_0xd73c('0x1e')][_0xd73c('0x1f')]===undefined?!![]:![]:!![],'where':_0x3c60cf[_0xd73c('0x1e')]?_0x3c60cf[_0xd73c('0x1e')][_0xd73c('0x20')]||null:null,'attributes':_0x3c60cf['options']?_0x3c60cf[_0xd73c('0x1e')]['attributes']||null:null,'include':_0x3c60cf[_0xd73c('0x1e')]?_0x3c60cf[_0xd73c('0x1e')]['include']?_[_0xd73c('0x24')](_0x3c60cf[_0xd73c('0x1e')]['include'],function(_0x5c2452){return{'model':db[_0x5c2452[_0xd73c('0x25')]],'as':_0x5c2452['as'],'attributes':_0x5c2452[_0xd73c('0x21')],'include':_0x5c2452[_0xd73c('0x23')]?_['map'](_0x5c2452[_0xd73c('0x23')],function(_0x513e2e){return{'model':db[_0x513e2e[_0xd73c('0x25')]],'as':_0x513e2e['as'],'attributes':_0x513e2e[_0xd73c('0x21')],'include':_0x513e2e[_0xd73c('0x23')]?_[_0xd73c('0x24')](_0x513e2e[_0xd73c('0x23')],function(_0x225a8a){return{'model':db[_0x225a8a[_0xd73c('0x25')]],'as':_0x225a8a['as'],'attributes':_0x225a8a[_0xd73c('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x583ec8){logger[_0xd73c('0x1a')](_0xd73c('0x29'),_0x3c60cf);logger[_0xd73c('0x15')](_0xd73c('0x29'),_0x3c60cf,JSON[_0xd73c('0x26')](_0x583ec8));_0x3a7634(_0x583ec8);})['catch'](function(_0x12306b){logger[_0xd73c('0x17')]('ShowMailAccount',_0x12306b[_0xd73c('0x19')],_0x3c60cf);_0x52ad11(_0x4ab15a[_0xd73c('0x17')](0x1f4,_0x12306b[_0xd73c('0x19')]));});});};exports['NotifyMailAccount']=function(_0x1692d9){var _0xd8d972=this;return new Promise(function(_0x24dd65,_0x22800c){var _0x3b24e5={'body':_0x1692d9['body'],'channel':_0xd73c('0x2a')};var _0x41ae7c=_[_0xd73c('0x2b')](_[_0xd73c('0x2c')](db['CmContact']['rawAttributes']),[_0xd73c('0x2d'),_0xd73c('0x2e'),_0xd73c('0x2f'),'ListId']);var _0x7ba30f=![];if(_0x1692d9[_0xd73c('0x30')]['id']){delete _0x1692d9[_0xd73c('0x30')]['id'];}if(_[_0xd73c('0x31')](_0x1692d9[_0xd73c('0x30')][_0xd73c('0x32')])){return _0x22800c(_0xd8d972[_0xd73c('0x17')](0x1f4,'from\x20is\x20mandatory'));}if(_['isNil'](_0x1692d9[_0xd73c('0x30')][_0xd73c('0x30')])||_0x1692d9[_0xd73c('0x30')][_0xd73c('0x30')]===''){return _0x22800c(_0xd8d972[_0xd73c('0x17')](0x1f4,_0xd73c('0x33')));}if(_[_0xd73c('0x31')](_0x1692d9[_0xd73c('0x30')]['mapKey'])){return _0x22800c(_0xd8d972[_0xd73c('0x17')](0x1f4,_0xd73c('0x34')+_0x41ae7c));}if(!_['includes'](_0x41ae7c,_0x1692d9['body'][_0xd73c('0x35')])){return _0x22800c(_0xd8d972[_0xd73c('0x17')](0x1f4,_0xd73c('0x36')+_0x41ae7c));}var _0x26e2ca={};_0x26e2ca[_0x1692d9['body'][_0xd73c('0x35')]]=_0x1692d9[_0xd73c('0x30')][_0xd73c('0x32')];return db[_0xd73c('0x1d')][_0xd73c('0x28')]({'where':{'id':_0x1692d9['account']['id']},'include':[{'model':db[_0xd73c('0x37')],'as':'List','include':[{'model':db['CmContact'],'as':_0xd73c('0x38'),'where':_0x26e2ca,'limit':0x1,'order':[[_0xd73c('0x2e'),_0xd73c('0x39')]]}]},{'model':db[_0xd73c('0x3a')],'as':_0xd73c('0x3b')},{'model':db[_0xd73c('0x3c')],'as':_0xd73c('0x3d')}]})[_0xd73c('0x3e')](function(_0x290dcf){if(_0x290dcf&&_0x290dcf[_0xd73c('0x3f')]){var _0x397d9e=_0x290dcf[_0xd73c('0x40')]({'plain':!![]});_0x3b24e5[_0xd73c('0x41')]=_[_0xd73c('0x42')](_0x397d9e,['Applications',_0xd73c('0x3f')]);_0x3b24e5[_0xd73c('0x43')]=_0x397d9e[_0xd73c('0x3b')];_0x3b24e5[_0xd73c('0x44')]=_0x397d9e['List'];_0x3b24e5['applications']=_[_0xd73c('0x45')](_0x3b24e5[_0xd73c('0x43')],[_0xd73c('0x46')],[_0xd73c('0x47')]);if(_0x3b24e5[_0xd73c('0x41')]&&_0x3b24e5[_0xd73c('0x41')][_0xd73c('0x48')]){_0x3b24e5[_0xd73c('0x43')]['push']({'id':0x0,'priority':_0x3b24e5['applications']['length']+0x1,'app':_0xd73c('0x49'),'appdata':_0xd73c('0x48'),'interval':_0xd73c('0x4a')});}if(_0x3b24e5[_0xd73c('0x41')]['Applications']){delete _0x3b24e5[_0xd73c('0x41')]['Applications'];}if(_0x3b24e5[_0xd73c('0x41')][_0xd73c('0x3f')]){delete _0x3b24e5[_0xd73c('0x41')][_0xd73c('0x3f')];}if(_0x397d9e['List'][_0xd73c('0x38')]['length']){return _0x397d9e[_0xd73c('0x3f')][_0xd73c('0x38')][0x0];}var _0xcb2965=_[_0xd73c('0xe')](_0x1692d9[_0xd73c('0x30')],{'firstName':_0x1692d9[_0xd73c('0x30')]['from'],'ListId':_0x397d9e['ListId']});_0xcb2965[_0x1692d9[_0xd73c('0x30')][_0xd73c('0x35')]]=_0x1692d9['body'][_0xd73c('0x32')];return db['CmContact'][_0xd73c('0x4b')](_0xcb2965);}else{throw new Error('List\x20not\x20found');}})[_0xd73c('0x3e')](function(_0x4f7200){_0x3b24e5['contact']=_0x4f7200;if(_0x4f7200){if(!_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')][_0xd73c('0x4c')]){_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')][_0xd73c('0x4c')]=rs[_0xd73c('0x4d')]()+'\x20'+_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')][_0xd73c('0x32')];}var _0xcf128a={'ContactId':_0x4f7200['id'],'MailAccountId':_0x1692d9[_0xd73c('0x41')]['id'],'inReplyTo':_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')][_0xd73c('0x4c')],'to':_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')][_0xd73c('0x32')],'cc':_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')]['cc'],'subject':_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')]['subject'],'attach':_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')]['attach'],'lastMsgAt':moment()[_0xd73c('0x4e')](_0xd73c('0x4f')),'lastMsgDirection':'in'};return db['MailInteraction'][_0xd73c('0x28')]({'where':{'closed':![],'MailAccountId':_0x1692d9[_0xd73c('0x41')]['id']},'include':[{'model':db[_0xd73c('0x50')],'as':'Messages','attributes':[_0xd73c('0x4c')],'where':{'messageId':_0x1692d9['body'][_0xd73c('0x19')]['inReplyTo']}}]})[_0xd73c('0x3e')](function(_0x41a744){if(_0x41a744){return[_0x41a744,![]];}return db[_0xd73c('0x51')]['create'](_0xcf128a)['then'](function(_0x5bf293){return[_0x5bf293,!![]];});});}else{throw new Error(_0xd73c('0x52'));}})[_0xd73c('0x53')](function(_0x37efc0,_0x57dfd2){if(_0x37efc0){_0x7ba30f=_0x57dfd2;if(!_0x57dfd2){return _0x37efc0[_0xd73c('0x54')]({'inReplyTo':_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')][_0xd73c('0x4c')],'to':_0x1692d9['body'][_0xd73c('0x19')][_0xd73c('0x32')],'cc':_0x1692d9['body'][_0xd73c('0x19')]['cc'],'subject':_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')][_0xd73c('0x55')],'attach':_0x37efc0[_0xd73c('0x56')]?_0x37efc0[_0xd73c('0x56')]:_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')][_0xd73c('0x56')],'substatus':null,'substatusAt':moment()[_0xd73c('0x4e')](_0xd73c('0x4f')),'lastMsgAt':moment()[_0xd73c('0x4e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x37efc0;}}})[_0xd73c('0x3e')](function(_0x348c31){_0x3b24e5[_0xd73c('0x57')]=_0x348c31[_0xd73c('0x40')]({'plain':!![]});_0x3b24e5[_0xd73c('0x57')][_0xd73c('0x58')]=_0x7ba30f;return db[_0xd73c('0x50')][_0xd73c('0x4b')]({'body':_0x1692d9[_0xd73c('0x30')]['body'],'MailAccountId':_0x1692d9['account']['id'],'MailInteractionId':_0x348c31['id'],'direction':'in','ContactId':_0x3b24e5['contact']['id'],'messageId':_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')][_0xd73c('0x4c')],'from':_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')][_0xd73c('0x32')],'to':_0x1692d9['body'][_0xd73c('0x19')]['to'],'cc':_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')]['cc'],'subject':_0x1692d9['body'][_0xd73c('0x19')][_0xd73c('0x55')],'attach':_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')]['attach'],'Attachments':_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')][_0xd73c('0x59')],'originTo':_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')][_0xd73c('0x5a')],'originCc':_0x1692d9['body']['message'][_0xd73c('0x5b')],'bcc':_0x1692d9[_0xd73c('0x30')]['message']['bcc'],'ChatWebsiteId':_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')][_0xd73c('0x5c')]||null,'originChannel':_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')][_0xd73c('0x5d')]||_0xd73c('0x5e'),'ChatOfflineMessageId':_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0xd73c('0x5f')],'as':_0xd73c('0x60')}]});})[_0xd73c('0x3e')](function(_0xcffa05){_0x3b24e5['message']=_0xcffa05;if(_0x3b24e5[_0xd73c('0x57')][_0xd73c('0x61')]){return db[_0xd73c('0x62')][_0xd73c('0x28')]({'attributes':['id','name'],'where':{'id':_0x3b24e5[_0xd73c('0x57')][_0xd73c('0x61')]}})[_0xd73c('0x3e')](function(_0x975fc){if(_0x975fc){_0x3b24e5[_0xd73c('0x43')]['unshift']({'id':0x0,'priority':0x0,'app':_0xd73c('0x63'),'appdata':_0x975fc[_0xd73c('0x64')]+','+(_0x3b24e5['account'][_0xd73c('0x65')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xd73c('0x66'),_0x3b24e5);});}return respondWithRpcPromise(_0xd73c('0x67'),'startRouting',_0x3b24e5);})[_0xd73c('0x3e')](function(_0xc73614){_0x24dd65(_0xc73614);})[_0xd73c('0x27')](function(_0x41ac75){_0x22800c(_0xd8d972[_0xd73c('0x17')](0x1f4,_0x41ac75[_0xd73c('0x19')]));});});}; \ No newline at end of file +var _0xe000=['../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetMailAccount','MailAccount','findAll','options','where','map','model','attributes','include','stringify','catch','ShowMailAccount','find','raw','then','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','MailApplication','Applications','MailServerOut','Smtp','get','omit','applications','list','orderBy','priority','asc','autoclose','push','length','close','List\x20not\x20found','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','spread','update','interaction','contact','attachments','originTo','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachments','UserId','User','name','unshift','agent','startRouting','Start','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe000,0xd6));var _0x0e00=function(_0x25209b,_0x22cb69){_0x25209b=_0x25209b-0x0;var _0x37e13=_0xe000[_0x25209b];return _0x37e13;};'use strict';var _=require(_0x0e00('0x0'));var util=require(_0x0e00('0x1'));var moment=require('moment');var BPromise=require(_0x0e00('0x2'));var rs=require(_0x0e00('0x3'));var fs=require('fs');var Redis=require(_0x0e00('0x4'));var db=require(_0x0e00('0x5'))['db'];var utils=require(_0x0e00('0x6'));var logger=require('../../config/logger')(_0x0e00('0x7'));var config=require(_0x0e00('0x8'));var jayson=require(_0x0e00('0x9'));var client=jayson[_0x0e00('0xa')][_0x0e00('0xb')]({'port':0x232c});config['redis']=_[_0x0e00('0xc')](config[_0x0e00('0xd')],{'host':_0x0e00('0xe'),'port':0x18eb});var socket=require(_0x0e00('0xf'))(new Redis(config[_0x0e00('0xd')]));require('./mailAccount.socket')[_0x0e00('0x10')](socket);function respondWithRpcPromise(_0x3f65bb,_0x1c0ffd,_0x8eeab6){return new BPromise(function(_0x11ae8f,_0x2f37c2){return client[_0x0e00('0x11')](_0x3f65bb,_0x8eeab6)['then'](function(_0x464e71){logger[_0x0e00('0x12')](_0x0e00('0x13'),_0x1c0ffd,_0x0e00('0x14'));logger[_0x0e00('0x15')](_0x0e00('0x16'),_0x1c0ffd,_0x0e00('0x14'),JSON['stringify'](_0x464e71));if(_0x464e71[_0x0e00('0x17')]){if(_0x464e71[_0x0e00('0x17')][_0x0e00('0x18')]===0x1f4){logger[_0x0e00('0x17')](_0x0e00('0x13'),_0x1c0ffd,_0x464e71['error']['message']);return _0x2f37c2(_0x464e71[_0x0e00('0x17')][_0x0e00('0x19')]);}logger[_0x0e00('0x17')](_0x0e00('0x13'),_0x1c0ffd,_0x464e71['error'][_0x0e00('0x19')]);return _0x11ae8f(_0x464e71[_0x0e00('0x17')][_0x0e00('0x19')]);}else{logger['info'](_0x0e00('0x13'),_0x1c0ffd,_0x0e00('0x14'));_0x11ae8f(_0x464e71[_0x0e00('0x1a')][_0x0e00('0x19')]);}})['catch'](function(_0x5833a6){logger[_0x0e00('0x17')](_0x0e00('0x13'),_0x1c0ffd,_0x5833a6);_0x2f37c2(_0x5833a6);});});}exports[_0x0e00('0x1b')]=function(_0x581a43){var _0x3032c7=this;return new Promise(function(_0x6a0549,_0x5be3dd){return db[_0x0e00('0x1c')][_0x0e00('0x1d')]({'raw':_0x581a43[_0x0e00('0x1e')]?_0x581a43[_0x0e00('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x581a43[_0x0e00('0x1e')]?_0x581a43[_0x0e00('0x1e')][_0x0e00('0x1f')]||null:null,'attributes':_0x581a43[_0x0e00('0x1e')]?_0x581a43[_0x0e00('0x1e')]['attributes']||null:null,'limit':_0x581a43['options']?_0x581a43[_0x0e00('0x1e')]['limit']||null:null,'include':_0x581a43[_0x0e00('0x1e')]?_0x581a43[_0x0e00('0x1e')]['include']?_[_0x0e00('0x20')](_0x581a43['options']['include'],function(_0x5c505c){return{'model':db[_0x5c505c[_0x0e00('0x21')]],'as':_0x5c505c['as'],'attributes':_0x5c505c[_0x0e00('0x22')],'include':_0x5c505c['include']?_['map'](_0x5c505c['include'],function(_0x2bcfd1){return{'model':db[_0x2bcfd1[_0x0e00('0x21')]],'as':_0x2bcfd1['as'],'attributes':_0x2bcfd1['attributes'],'include':_0x2bcfd1[_0x0e00('0x23')]?_['map'](_0x2bcfd1[_0x0e00('0x23')],function(_0x2c11b7){return{'model':db[_0x2c11b7['model']],'as':_0x2c11b7['as'],'attributes':_0x2c11b7[_0x0e00('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a1e3d){logger[_0x0e00('0x12')]('GetMailAccount',_0x581a43);logger[_0x0e00('0x15')]('GetMailAccount',_0x581a43,JSON[_0x0e00('0x24')](_0x5a1e3d));_0x6a0549(_0x5a1e3d);})[_0x0e00('0x25')](function(_0x442444){logger[_0x0e00('0x17')](_0x0e00('0x1b'),_0x442444['message'],_0x581a43);_0x5be3dd(_0x3032c7[_0x0e00('0x17')](0x1f4,_0x442444[_0x0e00('0x19')]));});});};exports[_0x0e00('0x26')]=function(_0x43ae4b){var _0x4bd91d=this;return new Promise(function(_0x368daa,_0x383b2f){return db['MailAccount'][_0x0e00('0x27')]({'raw':_0x43ae4b['options']?_0x43ae4b[_0x0e00('0x1e')][_0x0e00('0x28')]===undefined?!![]:![]:!![],'where':_0x43ae4b['options']?_0x43ae4b[_0x0e00('0x1e')]['where']||null:null,'attributes':_0x43ae4b['options']?_0x43ae4b[_0x0e00('0x1e')][_0x0e00('0x22')]||null:null,'include':_0x43ae4b[_0x0e00('0x1e')]?_0x43ae4b[_0x0e00('0x1e')][_0x0e00('0x23')]?_[_0x0e00('0x20')](_0x43ae4b[_0x0e00('0x1e')][_0x0e00('0x23')],function(_0xf84ef1){return{'model':db[_0xf84ef1[_0x0e00('0x21')]],'as':_0xf84ef1['as'],'attributes':_0xf84ef1['attributes'],'include':_0xf84ef1[_0x0e00('0x23')]?_[_0x0e00('0x20')](_0xf84ef1[_0x0e00('0x23')],function(_0x2459ef){return{'model':db[_0x2459ef[_0x0e00('0x21')]],'as':_0x2459ef['as'],'attributes':_0x2459ef[_0x0e00('0x22')],'include':_0x2459ef['include']?_['map'](_0x2459ef[_0x0e00('0x23')],function(_0x271a92){return{'model':db[_0x271a92[_0x0e00('0x21')]],'as':_0x271a92['as'],'attributes':_0x271a92[_0x0e00('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0e00('0x29')](function(_0x14b6d1){logger[_0x0e00('0x12')](_0x0e00('0x26'),_0x43ae4b);logger[_0x0e00('0x15')]('ShowMailAccount',_0x43ae4b,JSON['stringify'](_0x14b6d1));_0x368daa(_0x14b6d1);})[_0x0e00('0x25')](function(_0xb3fafc){logger[_0x0e00('0x17')]('ShowMailAccount',_0xb3fafc['message'],_0x43ae4b);_0x383b2f(_0x4bd91d['error'](0x1f4,_0xb3fafc[_0x0e00('0x19')]));});});};exports[_0x0e00('0x2a')]=function(_0x498a08){var _0x3190ae=this;return new Promise(function(_0x4dbc67,_0x3148eb){var _0x1db39e={'body':_0x498a08[_0x0e00('0x2b')],'channel':_0x0e00('0x2c')};var _0x506438=_[_0x0e00('0x2d')](_[_0x0e00('0x2e')](db[_0x0e00('0x2f')][_0x0e00('0x30')]),[_0x0e00('0x31'),_0x0e00('0x32'),_0x0e00('0x33'),_0x0e00('0x34')]);var _0x4cf959=![];if(_0x498a08[_0x0e00('0x2b')]['id']){delete _0x498a08[_0x0e00('0x2b')]['id'];}if(_[_0x0e00('0x35')](_0x498a08[_0x0e00('0x2b')][_0x0e00('0x36')])){return _0x3148eb(_0x3190ae[_0x0e00('0x17')](0x1f4,_0x0e00('0x37')));}if(_[_0x0e00('0x35')](_0x498a08[_0x0e00('0x2b')][_0x0e00('0x2b')])||_0x498a08[_0x0e00('0x2b')][_0x0e00('0x2b')]===''){return _0x3148eb(_0x3190ae[_0x0e00('0x17')](0x1f4,_0x0e00('0x38')));}if(_[_0x0e00('0x35')](_0x498a08[_0x0e00('0x2b')][_0x0e00('0x39')])){return _0x3148eb(_0x3190ae[_0x0e00('0x17')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x506438));}if(!_[_0x0e00('0x3a')](_0x506438,_0x498a08[_0x0e00('0x2b')][_0x0e00('0x39')])){return _0x3148eb(_0x3190ae['error'](0x1f4,_0x0e00('0x3b')+_0x506438));}var _0x3621a6={};_0x3621a6[_0x498a08[_0x0e00('0x2b')][_0x0e00('0x39')]]=_0x498a08[_0x0e00('0x2b')]['from'];return db[_0x0e00('0x1c')][_0x0e00('0x27')]({'where':{'id':_0x498a08[_0x0e00('0x3c')]['id']},'include':[{'model':db[_0x0e00('0x3d')],'as':_0x0e00('0x3e'),'include':[{'model':db[_0x0e00('0x2f')],'as':_0x0e00('0x3f'),'where':_0x3621a6,'limit':0x1,'order':[[_0x0e00('0x32'),'DESC']]}]},{'model':db[_0x0e00('0x40')],'as':_0x0e00('0x41')},{'model':db[_0x0e00('0x42')],'as':_0x0e00('0x43')}]})[_0x0e00('0x29')](function(_0x34c65d){if(_0x34c65d&&_0x34c65d['List']){var _0x4e685d=_0x34c65d[_0x0e00('0x44')]({'plain':!![]});_0x1db39e[_0x0e00('0x3c')]=_[_0x0e00('0x45')](_0x4e685d,['Applications',_0x0e00('0x3e')]);_0x1db39e[_0x0e00('0x46')]=_0x4e685d[_0x0e00('0x41')];_0x1db39e[_0x0e00('0x47')]=_0x4e685d['List'];_0x1db39e['applications']=_[_0x0e00('0x48')](_0x1db39e[_0x0e00('0x46')],[_0x0e00('0x49')],[_0x0e00('0x4a')]);if(_0x1db39e[_0x0e00('0x3c')]&&_0x1db39e[_0x0e00('0x3c')][_0x0e00('0x4b')]){_0x1db39e[_0x0e00('0x46')][_0x0e00('0x4c')]({'id':0x0,'priority':_0x1db39e[_0x0e00('0x46')][_0x0e00('0x4d')]+0x1,'app':_0x0e00('0x4e'),'appdata':'autoclose','interval':'*,*,*,*'});}if(_0x1db39e['account'][_0x0e00('0x41')]){delete _0x1db39e[_0x0e00('0x3c')]['Applications'];}if(_0x1db39e[_0x0e00('0x3c')]['List']){delete _0x1db39e['account']['List'];}if(_0x4e685d[_0x0e00('0x3e')]['Contacts'][_0x0e00('0x4d')]){return _0x4e685d['List'][_0x0e00('0x3f')][0x0];}var _0x42f339=_[_0x0e00('0xc')](_0x498a08[_0x0e00('0x2b')],{'firstName':_0x498a08[_0x0e00('0x2b')][_0x0e00('0x36')],'ListId':_0x4e685d[_0x0e00('0x34')]});_0x42f339[_0x498a08[_0x0e00('0x2b')]['mapKey']]=_0x498a08[_0x0e00('0x2b')][_0x0e00('0x36')];return db[_0x0e00('0x2f')]['create'](_0x42f339);}else{throw new Error(_0x0e00('0x4f'));}})[_0x0e00('0x29')](function(_0x3c1c69){_0x1db39e['contact']=_0x3c1c69;if(_0x3c1c69){if(!_0x498a08[_0x0e00('0x2b')]['message'][_0x0e00('0x50')]){_0x498a08[_0x0e00('0x2b')][_0x0e00('0x19')]['messageId']=rs[_0x0e00('0x51')]()+'\x20'+_0x498a08[_0x0e00('0x2b')][_0x0e00('0x19')][_0x0e00('0x36')];}var _0x27766a={'ContactId':_0x3c1c69['id'],'MailAccountId':_0x498a08[_0x0e00('0x3c')]['id'],'inReplyTo':_0x498a08[_0x0e00('0x2b')][_0x0e00('0x19')]['messageId'],'to':_0x498a08[_0x0e00('0x2b')][_0x0e00('0x19')][_0x0e00('0x36')],'cc':_0x498a08[_0x0e00('0x2b')][_0x0e00('0x19')]['cc'],'subject':_0x498a08['body'][_0x0e00('0x19')][_0x0e00('0x52')],'attach':_0x498a08['body'][_0x0e00('0x19')][_0x0e00('0x53')],'lastMsgAt':moment()[_0x0e00('0x54')](_0x0e00('0x55')),'lastMsgDirection':'in'};return db[_0x0e00('0x56')][_0x0e00('0x27')]({'where':{'closed':![],'MailAccountId':_0x498a08[_0x0e00('0x3c')]['id']},'include':[{'model':db[_0x0e00('0x57')],'as':_0x0e00('0x58'),'attributes':[_0x0e00('0x50')],'where':{'messageId':_0x498a08['body'][_0x0e00('0x19')][_0x0e00('0x59')]}}]})['then'](function(_0x47f094){if(_0x47f094){return[_0x47f094,![]];}return db[_0x0e00('0x56')][_0x0e00('0x5a')](_0x27766a)[_0x0e00('0x29')](function(_0x5289fd){return[_0x5289fd,!![]];});});}else{throw new Error(_0x0e00('0x5b'));}})[_0x0e00('0x5c')](function(_0xe0efbf,_0x1fae19){if(_0xe0efbf){_0x4cf959=_0x1fae19;if(!_0x1fae19){return _0xe0efbf[_0x0e00('0x5d')]({'inReplyTo':_0x498a08[_0x0e00('0x2b')][_0x0e00('0x19')][_0x0e00('0x50')],'to':_0x498a08[_0x0e00('0x2b')][_0x0e00('0x19')]['from'],'cc':_0x498a08['body']['message']['cc'],'subject':_0x498a08['body'][_0x0e00('0x19')][_0x0e00('0x52')],'attach':_0xe0efbf['attach']?_0xe0efbf['attach']:_0x498a08[_0x0e00('0x2b')]['message']['attach'],'substatus':null,'substatusAt':moment()[_0x0e00('0x54')](_0x0e00('0x55')),'lastMsgAt':moment()['format'](_0x0e00('0x55')),'lastMsgDirection':'in'});}else{return _0xe0efbf;}}})['then'](function(_0xc4fa92){_0x1db39e[_0x0e00('0x5e')]=_0xc4fa92[_0x0e00('0x44')]({'plain':!![]});_0x1db39e[_0x0e00('0x5e')]['created']=_0x4cf959;return db[_0x0e00('0x57')][_0x0e00('0x5a')]({'body':_0x498a08[_0x0e00('0x2b')][_0x0e00('0x2b')],'MailAccountId':_0x498a08[_0x0e00('0x3c')]['id'],'MailInteractionId':_0xc4fa92['id'],'direction':'in','ContactId':_0x1db39e[_0x0e00('0x5f')]['id'],'messageId':_0x498a08[_0x0e00('0x2b')]['message'][_0x0e00('0x50')],'from':_0x498a08[_0x0e00('0x2b')][_0x0e00('0x19')][_0x0e00('0x36')],'to':_0x498a08[_0x0e00('0x2b')]['message']['to'],'cc':_0x498a08[_0x0e00('0x2b')][_0x0e00('0x19')]['cc'],'subject':_0x498a08[_0x0e00('0x2b')][_0x0e00('0x19')]['subject'],'attach':_0x498a08['body']['message']['attach'],'Attachments':_0x498a08[_0x0e00('0x2b')][_0x0e00('0x19')][_0x0e00('0x60')],'originTo':_0x498a08[_0x0e00('0x2b')][_0x0e00('0x19')][_0x0e00('0x61')],'originCc':_0x498a08[_0x0e00('0x2b')]['message'][_0x0e00('0x62')],'bcc':_0x498a08['body'][_0x0e00('0x19')]['bcc'],'ChatWebsiteId':_0x498a08[_0x0e00('0x2b')]['message'][_0x0e00('0x63')]||null,'originChannel':_0x498a08[_0x0e00('0x2b')]['message'][_0x0e00('0x64')]||_0x0e00('0x65'),'ChatOfflineMessageId':_0x498a08[_0x0e00('0x2b')]['message'][_0x0e00('0x66')]||null},{'include':[{'model':db['Attachment'],'as':_0x0e00('0x67')}]});})['then'](function(_0x9ed2d){_0x1db39e['message']=_0x9ed2d;if(_0x1db39e[_0x0e00('0x5e')][_0x0e00('0x68')]){return db[_0x0e00('0x69')][_0x0e00('0x27')]({'attributes':['id',_0x0e00('0x6a')],'where':{'id':_0x1db39e[_0x0e00('0x5e')][_0x0e00('0x68')]}})[_0x0e00('0x29')](function(_0x383719){if(_0x383719){_0x1db39e['applications'][_0x0e00('0x6b')]({'id':0x0,'priority':0x0,'app':_0x0e00('0x6c'),'appdata':_0x383719[_0x0e00('0x6a')]+','+(_0x1db39e[_0x0e00('0x3c')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x0e00('0x6d'),_0x1db39e);});}return respondWithRpcPromise(_0x0e00('0x6e'),_0x0e00('0x6d'),_0x1db39e);})[_0x0e00('0x29')](function(_0x4c2f1a){_0x4dbc67(_0x4c2f1a);})[_0x0e00('0x25')](function(_0x3f7d08){_0x3148eb(_0x3190ae[_0x0e00('0x17')](0x1f4,_0x3f7d08[_0x0e00('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 0eab508..6a5365f 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 _0x72f6=['remove','emit','removeListener','register','length','./mailAccount.events','save'];(function(_0x9b7f1c,_0xec93c3){var _0xa10e38=function(_0x4e3f8a){while(--_0x4e3f8a){_0x9b7f1c['push'](_0x9b7f1c['shift']());}};_0xa10e38(++_0xec93c3);}(_0x72f6,0x1a9));var _0x672f=function(_0x5888ea,_0x363875){_0x5888ea=_0x5888ea-0x0;var _0x13a7f0=_0x72f6[_0x5888ea];return _0x13a7f0;};'use strict';var MailAccountEvents=require(_0x672f('0x0'));var events=[_0x672f('0x1'),_0x672f('0x2'),'update'];function createListener(_0x2628a9,_0x3c453b){return function(_0x17ae6c){_0x3c453b[_0x672f('0x3')](_0x2628a9,_0x17ae6c);};}function removeListener(_0x4c4261,_0x403bf0){return function(){MailAccountEvents[_0x672f('0x4')](_0x4c4261,_0x403bf0);};}exports[_0x672f('0x5')]=function(_0x56d5c8){for(var _0x5cdec=0x0,_0x2b7630=events[_0x672f('0x6')];_0x5cdec<_0x2b7630;_0x5cdec++){var _0xdea452=events[_0x5cdec];var _0x19c0d2=createListener('mailAccount:'+_0xdea452,_0x56d5c8);MailAccountEvents['on'](_0xdea452,_0x19c0d2);}}; \ No newline at end of file +var _0xdc45=['emit','removeListener','./mailAccount.events','save','remove'];(function(_0x2aaa06,_0x5e6d1c){var _0x4889dd=function(_0x57c8cf){while(--_0x57c8cf){_0x2aaa06['push'](_0x2aaa06['shift']());}};_0x4889dd(++_0x5e6d1c);}(_0xdc45,0x156));var _0x5dc4=function(_0x45b81b,_0x4564f8){_0x45b81b=_0x45b81b-0x0;var _0x4595a5=_0xdc45[_0x45b81b];return _0x4595a5;};'use strict';var MailAccountEvents=require(_0x5dc4('0x0'));var events=[_0x5dc4('0x1'),_0x5dc4('0x2'),'update'];function createListener(_0x2dbeb3,_0x5a183e){return function(_0x54e418){_0x5a183e[_0x5dc4('0x3')](_0x2dbeb3,_0x54e418);};}function removeListener(_0x1277e9,_0x3dac9a){return function(){MailAccountEvents[_0x5dc4('0x4')](_0x1277e9,_0x3dac9a);};}exports['register']=function(_0x647fad){for(var _0x26db6b=0x0,_0x438a82=events['length'];_0x26db6b<_0x438a82;_0x26db6b++){var _0x5268e4=events[_0x26db6b];var _0xd60c91=createListener('mailAccount:'+_0x5268e4,_0x647fad);MailAccountEvents['on'](_0x5268e4,_0xd60c91);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 19f8bf7..9511706 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 _0xc74a=['put','update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show'];(function(_0x40cf33,_0x106e35){var _0x563278=function(_0x1b8f1f){while(--_0x1b8f1f){_0x40cf33['push'](_0x40cf33['shift']());}};_0x563278(++_0x106e35);}(_0xc74a,0x17a));var _0xac74=function(_0x4335f2,_0xd35860){_0x4335f2=_0x4335f2-0x0;var _0x320328=_0xc74a[_0x4335f2];return _0x320328;};'use strict';var multer=require(_0xac74('0x0'));var util=require('util');var path=require(_0xac74('0x1'));var timeout=require(_0xac74('0x2'));var express=require('express');var router=express[_0xac74('0x3')]();var fs_extra=require(_0xac74('0x4'));var auth=require(_0xac74('0x5'));var interaction=require(_0xac74('0x6'));var config=require(_0xac74('0x7'));var controller=require(_0xac74('0x8'));router[_0xac74('0x9')](_0xac74('0xa'),auth[_0xac74('0xb')](),controller[_0xac74('0xc')]);router[_0xac74('0xd')](_0xac74('0xa'),auth[_0xac74('0xb')](),controller[_0xac74('0xe')]);router[_0xac74('0xf')](_0xac74('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xac74('0x10')]=router; \ No newline at end of file +var _0x2de9=['../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x48c8d3,_0x2fd189){var _0x110edc=function(_0x2a8675){while(--_0x2a8675){_0x48c8d3['push'](_0x48c8d3['shift']());}};_0x110edc(++_0x2fd189);}(_0x2de9,0x1e7));var _0x92de=function(_0x5e2d59,_0x4cd049){_0x5e2d59=_0x5e2d59-0x0;var _0x2004c5=_0x2de9[_0x5e2d59];return _0x2004c5;};'use strict';var multer=require(_0x92de('0x0'));var util=require(_0x92de('0x1'));var path=require(_0x92de('0x2'));var timeout=require(_0x92de('0x3'));var express=require('express');var router=express[_0x92de('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x92de('0x5'));var interaction=require(_0x92de('0x6'));var config=require(_0x92de('0x7'));var controller=require('./mailApplication.controller');router[_0x92de('0x8')](_0x92de('0x9'),auth[_0x92de('0xa')](),controller[_0x92de('0xb')]);router[_0x92de('0xc')](_0x92de('0x9'),auth[_0x92de('0xa')](),controller[_0x92de('0xd')]);router[_0x92de('0xe')](_0x92de('0x9'),auth['isAuthenticated'](),controller[_0x92de('0xf')]);module[_0x92de('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 0d31c27..a860f64 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 _0x59b0=['noop','TEXT','exports','STRING'];(function(_0x137967,_0x36151f){var _0x597e5f=function(_0x530135){while(--_0x530135){_0x137967['push'](_0x137967['shift']());}};_0x597e5f(++_0x36151f);}(_0x59b0,0x12a));var _0x059b=function(_0x4fa0ea,_0x2cd534){_0x4fa0ea=_0x4fa0ea-0x0;var _0x51d027=_0x59b0[_0x4fa0ea];return _0x51d027;};'use strict';var Sequelize=require('sequelize');module[_0x059b('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x059b('0x1')],'allowNull':![],'defaultValue':_0x059b('0x2')},'appdata':{'type':Sequelize[_0x059b('0x3')]()},'description':{'type':Sequelize[_0x059b('0x1')]},'interval':{'type':Sequelize[_0x059b('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xd616=['STRING','noop','sequelize','INTEGER'];(function(_0x7fdc84,_0x431ee9){var _0x58b543=function(_0x587c69){while(--_0x587c69){_0x7fdc84['push'](_0x7fdc84['shift']());}};_0x58b543(++_0x431ee9);}(_0xd616,0xb6));var _0x6d61=function(_0x5d8e11,_0x1b2574){_0x5d8e11=_0x5d8e11-0x0;var _0x25fa53=_0xd616[_0x5d8e11];return _0x25fa53;};'use strict';var Sequelize=require(_0x6d61('0x0'));module['exports']={'priority':{'type':Sequelize[_0x6d61('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x6d61('0x2')],'allowNull':![],'defaultValue':_0x6d61('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x6d61('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 9bd8ab2..e4be718 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 _0xac4a=['Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x5c6464,_0x3a3b59){var _0x19b8ec=function(_0x2a3765){while(--_0x2a3765){_0x5c6464['push'](_0x5c6464['shift']());}};_0x19b8ec(++_0x3a3b59);}(_0xac4a,0x13f));var _0xaac4=function(_0x3c3cf7,_0x39a00f){_0x3c3cf7=_0x3c3cf7-0x0;var _0xf05967=_0xac4a[_0x3c3cf7];return _0xf05967;};'use strict';var emlformat=require(_0xaac4('0x0'));var rimraf=require(_0xaac4('0x1'));var zipdir=require(_0xaac4('0x2'));var jsonpatch=require(_0xaac4('0x3'));var rp=require(_0xaac4('0x4'));var moment=require(_0xaac4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaac4('0x6'));var path=require(_0xaac4('0x7'));var sox=require(_0xaac4('0x8'));var csv=require('to-csv');var ejs=require(_0xaac4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaac4('0xa'));var squel=require('squel');var crypto=require(_0xaac4('0xb'));var jsforce=require(_0xaac4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaac4('0xd'));var Papa=require('papaparse');var Redis=require(_0xaac4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaac4('0xf'));var hardwareService=require(_0xaac4('0x10'));var logger=require(_0xaac4('0x11'))(_0xaac4('0x12'));var utils=require(_0xaac4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaac4('0x14'))['db'];function respondWithStatusCode(_0x2e2d02,_0x45e512){_0x45e512=_0x45e512||0xcc;return function(_0x5a4801){if(_0x5a4801){return _0x2e2d02[_0xaac4('0x15')](_0x45e512);}return _0x2e2d02[_0xaac4('0x16')](_0x45e512)['end']();};}function respondWithResult(_0xf06b1d,_0x2b20d0){_0x2b20d0=_0x2b20d0||0xc8;return function(_0x46698d){if(_0x46698d){return _0xf06b1d[_0xaac4('0x16')](_0x2b20d0)[_0xaac4('0x17')](_0x46698d);}};}function respondWithFilteredResult(_0x2fbeb7,_0x31b7e5){return function(_0x1df9ae){if(_0x1df9ae){var _0x233278=typeof _0x31b7e5[_0xaac4('0x18')]===_0xaac4('0x19')&&typeof _0x31b7e5[_0xaac4('0x1a')]===_0xaac4('0x19');var _0x52686a=_0x1df9ae[_0xaac4('0x1b')];var _0x52085a=_0x233278?0x0:_0x31b7e5[_0xaac4('0x18')];var _0x5b6fd6=_0x233278?_0x1df9ae[_0xaac4('0x1b')]:_0x31b7e5[_0xaac4('0x18')]+_0x31b7e5[_0xaac4('0x1a')];var _0x271bcb;if(_0x5b6fd6>=_0x52686a){_0x5b6fd6=_0x52686a;_0x271bcb=0xc8;}else{_0x271bcb=0xce;}_0x2fbeb7[_0xaac4('0x16')](_0x271bcb);return _0x2fbeb7[_0xaac4('0x1c')](_0xaac4('0x1d'),_0x52085a+'-'+_0x5b6fd6+'/'+_0x52686a)[_0xaac4('0x17')](_0x1df9ae);}return null;};}function patchUpdates(_0x4166ee){return function(_0x480fb0){try{jsonpatch[_0xaac4('0x1e')](_0x480fb0,_0x4166ee,!![]);}catch(_0x4e1e89){return BPromise[_0xaac4('0x1f')](_0x4e1e89);}return _0x480fb0[_0xaac4('0x20')]();};}function saveUpdates(_0x43625c,_0x477b77){return function(_0x17140f){if(_0x17140f){return _0x17140f[_0xaac4('0x21')](_0x43625c)['then'](function(_0x43ccdc){return _0x43ccdc;});}return null;};}function removeEntity(_0x27a84d,_0x174860){return function(_0x4f10ec){if(_0x4f10ec){return _0x4f10ec[_0xaac4('0x22')]()[_0xaac4('0x23')](function(){_0x27a84d[_0xaac4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24186b,_0x4f1b65){return function(_0x54203b){if(!_0x54203b){_0x24186b['sendStatus'](0x194);}return _0x54203b;};}function handleError(_0x5a0bb3,_0x22d5a6){_0x22d5a6=_0x22d5a6||0x1f4;return function(_0x17d25f){logger[_0xaac4('0x24')](_0x17d25f[_0xaac4('0x25')]);if(_0x17d25f[_0xaac4('0x26')]){delete _0x17d25f[_0xaac4('0x26')];}_0x5a0bb3[_0xaac4('0x16')](_0x22d5a6)[_0xaac4('0x27')](_0x17d25f);};}exports[_0xaac4('0x28')]=function(_0x386c9b,_0x4d0f5f){var _0x316445={'raw':!![],'where':{'id':_0x386c9b[_0xaac4('0x29')]['id']}},_0x16b33c={};_0x16b33c[_0xaac4('0x2a')]=_[_0xaac4('0x2b')](db[_0xaac4('0x2c')]['rawAttributes']);_0x16b33c[_0xaac4('0x2d')]=_['keys'](_0x386c9b[_0xaac4('0x2d')]);_0x16b33c[_0xaac4('0x2e')]=_[_0xaac4('0x2f')](_0x16b33c[_0xaac4('0x2a')],_0x16b33c['query']);_0x316445['attributes']=_['intersection'](_0x16b33c[_0xaac4('0x2a')],qs[_0xaac4('0x30')](_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x30')]));_0x316445[_0xaac4('0x31')]=_0x316445[_0xaac4('0x31')][_0xaac4('0x32')]?_0x316445[_0xaac4('0x31')]:_0x16b33c[_0xaac4('0x2a')];if(_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x33')]){_0x316445[_0xaac4('0x34')]=[{'all':!![]}];}_0x316445=_[_0xaac4('0x35')]({},_0x316445,_0x386c9b[_0xaac4('0x36')]);return db[_0xaac4('0x2c')]['find'](_0x316445)['then'](handleEntityNotFound(_0x4d0f5f,null))[_0xaac4('0x23')](respondWithResult(_0x4d0f5f,null))[_0xaac4('0x37')](handleError(_0x4d0f5f,null));};exports[_0xaac4('0x21')]=function(_0x5e6080,_0x191d0f){if(_0x5e6080[_0xaac4('0x38')]['id']){delete _0x5e6080[_0xaac4('0x38')]['id'];}return db[_0xaac4('0x2c')][_0xaac4('0x39')]({'where':{'id':_0x5e6080[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x191d0f,null))['then'](saveUpdates(_0x5e6080[_0xaac4('0x38')],null))[_0xaac4('0x23')](respondWithResult(_0x191d0f,null))[_0xaac4('0x37')](handleError(_0x191d0f,null));};exports['destroy']=function(_0x36d84a,_0x497e7b){return db['MailApplication'][_0xaac4('0x39')]({'where':{'id':_0x36d84a[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x497e7b,null))['then'](removeEntity(_0x497e7b,null))['catch'](handleError(_0x497e7b,null));}; \ No newline at end of file +var _0x9bde=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','name','send','show','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','params','rimraf','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'];(function(_0xd98def,_0x19ebc7){var _0x55b182=function(_0x1d3372){while(--_0x1d3372){_0xd98def['push'](_0xd98def['shift']());}};_0x55b182(++_0x19ebc7);}(_0x9bde,0xe1));var _0xe9bd=function(_0x49b2e8,_0x5b2a39){_0x49b2e8=_0x49b2e8-0x0;var _0xcf58e7=_0x9bde[_0x49b2e8];return _0xcf58e7;};'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'];function respondWithStatusCode(_0x5e022a,_0x2c1d98){_0x2c1d98=_0x2c1d98||0xcc;return function(_0x4ac319){if(_0x4ac319){return _0x5e022a[_0xe9bd('0x19')](_0x2c1d98);}return _0x5e022a[_0xe9bd('0x1a')](_0x2c1d98)[_0xe9bd('0x1b')]();};}function respondWithResult(_0x51109f,_0x47ba5e){_0x47ba5e=_0x47ba5e||0xc8;return function(_0x46a95e){if(_0x46a95e){return _0x51109f[_0xe9bd('0x1a')](_0x47ba5e)[_0xe9bd('0x1c')](_0x46a95e);}};}function respondWithFilteredResult(_0x46a59b,_0x3360bd){return function(_0x389e7b){if(_0x389e7b){var _0x45a9f2=typeof _0x3360bd['offset']===_0xe9bd('0x1d')&&typeof _0x3360bd[_0xe9bd('0x1e')]===_0xe9bd('0x1d');var _0x494b27=_0x389e7b[_0xe9bd('0x1f')];var _0x3bae08=_0x45a9f2?0x0:_0x3360bd[_0xe9bd('0x20')];var _0x330733=_0x45a9f2?_0x389e7b['count']:_0x3360bd[_0xe9bd('0x20')]+_0x3360bd['limit'];var _0xc6b661;if(_0x330733>=_0x494b27){_0x330733=_0x494b27;_0xc6b661=0xc8;}else{_0xc6b661=0xce;}_0x46a59b['status'](_0xc6b661);return _0x46a59b[_0xe9bd('0x21')](_0xe9bd('0x22'),_0x3bae08+'-'+_0x330733+'/'+_0x494b27)[_0xe9bd('0x1c')](_0x389e7b);}return null;};}function patchUpdates(_0x3dda13){return function(_0x1acb82){try{jsonpatch[_0xe9bd('0x23')](_0x1acb82,_0x3dda13,!![]);}catch(_0x6593ce){return BPromise['reject'](_0x6593ce);}return _0x1acb82[_0xe9bd('0x24')]();};}function saveUpdates(_0x28cd17,_0x4ecaf5){return function(_0x37aec1){if(_0x37aec1){return _0x37aec1['update'](_0x28cd17)[_0xe9bd('0x25')](function(_0x1b9cc9){return _0x1b9cc9;});}return null;};}function removeEntity(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(_0x5bc4bf){return _0x5bc4bf[_0xe9bd('0x26')]()[_0xe9bd('0x25')](function(){_0x36f8c0[_0xe9bd('0x1a')](0xcc)[_0xe9bd('0x1b')]();});}};}function handleEntityNotFound(_0x2641be,_0xb52d45){return function(_0x399f3c){if(!_0x399f3c){_0x2641be[_0xe9bd('0x19')](0x194);}return _0x399f3c;};}function handleError(_0x1ae889,_0x5987af){_0x5987af=_0x5987af||0x1f4;return function(_0x3c211a){logger[_0xe9bd('0x27')](_0x3c211a['stack']);if(_0x3c211a[_0xe9bd('0x28')]){delete _0x3c211a[_0xe9bd('0x28')];}_0x1ae889[_0xe9bd('0x1a')](_0x5987af)[_0xe9bd('0x29')](_0x3c211a);};}exports[_0xe9bd('0x2a')]=function(_0x183601,_0x519f48){var _0x5b7f1d={'raw':!![],'where':{'id':_0x183601['params']['id']}},_0x1de54c={};_0x1de54c[_0xe9bd('0x2b')]=_[_0xe9bd('0x2c')](db[_0xe9bd('0x2d')][_0xe9bd('0x2e')]);_0x1de54c[_0xe9bd('0x2f')]=_['keys'](_0x183601['query']);_0x1de54c[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],_0x1de54c[_0xe9bd('0x2f')]);_0x5b7f1d[_0xe9bd('0x32')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],qs[_0xe9bd('0x33')](_0x183601[_0xe9bd('0x2f')]['fields']));_0x5b7f1d[_0xe9bd('0x32')]=_0x5b7f1d[_0xe9bd('0x32')][_0xe9bd('0x34')]?_0x5b7f1d['attributes']:_0x1de54c['model'];if(_0x183601[_0xe9bd('0x2f')][_0xe9bd('0x35')]){_0x5b7f1d[_0xe9bd('0x36')]=[{'all':!![]}];}_0x5b7f1d=_[_0xe9bd('0x37')]({},_0x5b7f1d,_0x183601[_0xe9bd('0x38')]);return db[_0xe9bd('0x2d')][_0xe9bd('0x39')](_0x5b7f1d)[_0xe9bd('0x25')](handleEntityNotFound(_0x519f48,null))[_0xe9bd('0x25')](respondWithResult(_0x519f48,null))[_0xe9bd('0x3a')](handleError(_0x519f48,null));};exports[_0xe9bd('0x3b')]=function(_0x549dd1,_0x2ad46e){if(_0x549dd1[_0xe9bd('0x3c')]['id']){delete _0x549dd1[_0xe9bd('0x3c')]['id'];}return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x549dd1[_0xe9bd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2ad46e,null))[_0xe9bd('0x25')](saveUpdates(_0x549dd1[_0xe9bd('0x3c')],null))['then'](respondWithResult(_0x2ad46e,null))[_0xe9bd('0x3a')](handleError(_0x2ad46e,null));};exports[_0xe9bd('0x26')]=function(_0x4c7d47,_0x4b1da0){return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x4c7d47['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x4b1da0,null))[_0xe9bd('0x25')](removeEntity(_0x4b1da0,null))[_0xe9bd('0x3a')](handleError(_0x4b1da0,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 52f57d4..7ccd5ab 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 _0x1eb6=['lodash','api','request-promise','path','../../config/environment','./mailApplication.attributes','define','mail_applications','utf8mb4'];(function(_0x548d7d,_0x2d41fc){var _0xb1c878=function(_0x570f09){while(--_0x570f09){_0x548d7d['push'](_0x548d7d['shift']());}};_0xb1c878(++_0x2d41fc);}(_0x1eb6,0xf3));var _0x61eb=function(_0x824db8,_0x56729a){_0x824db8=_0x824db8-0x0;var _0x4cb62d=_0x1eb6[_0x824db8];return _0x4cb62d;};'use strict';var _=require(_0x61eb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x61eb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x61eb('0x2'));var fs=require('fs');var path=require(_0x61eb('0x3'));var rimraf=require('rimraf');var config=require(_0x61eb('0x4'));var attributes=require(_0x61eb('0x5'));module['exports']=function(_0x3a3c98,_0x290909){return _0x3a3c98[_0x61eb('0x6')]('MailApplication',attributes,{'tableName':_0x61eb('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x61eb('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5ba6=['./mailApplication.attributes','exports','define','mail_applications','utf8mb4','utf8mb4_unicode_ci','util','moment','rimraf'];(function(_0xdca64d,_0x5410f1){var _0xe26a1c=function(_0x342120){while(--_0x342120){_0xdca64d['push'](_0xdca64d['shift']());}};_0xe26a1c(++_0x5410f1);}(_0x5ba6,0x138));var _0x65ba=function(_0x363743,_0x1d528b){_0x363743=_0x363743-0x0;var _0x514659=_0x5ba6[_0x363743];return _0x514659;};'use strict';var _=require('lodash');var util=require(_0x65ba('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x65ba('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x65ba('0x2'));var config=require('../../config/environment');var attributes=require(_0x65ba('0x3'));module[_0x65ba('0x4')]=function(_0x249334,_0x11b3fc){return _0x249334[_0x65ba('0x5')]('MailApplication',attributes,{'tableName':_0x65ba('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x65ba('0x7'),'collate':_0x65ba('0x8')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 91c1055..7953d0f 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 _0x0d9d=['info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateMailApplication','options','raw','attributes','limit','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x2c5ca3,_0x4e31fe){var _0x2499c6=function(_0x5e3aa0){while(--_0x5e3aa0){_0x2c5ca3['push'](_0x2c5ca3['shift']());}};_0x2499c6(++_0x4e31fe);}(_0x0d9d,0x1a6));var _0xd0d9=function(_0x299c9a,_0xcab813){_0x299c9a=_0x299c9a-0x0;var _0x5dcd93=_0x0d9d[_0x299c9a];return _0x5dcd93;};'use strict';var _=require(_0xd0d9('0x0'));var util=require(_0xd0d9('0x1'));var moment=require('moment');var BPromise=require(_0xd0d9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd0d9('0x3'));var db=require(_0xd0d9('0x4'))['db'];var utils=require(_0xd0d9('0x5'));var logger=require(_0xd0d9('0x6'))(_0xd0d9('0x7'));var config=require(_0xd0d9('0x8'));var jayson=require(_0xd0d9('0x9'));var client=jayson[_0xd0d9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28528c,_0x3ca4bd,_0x4f04aa){return new BPromise(function(_0x3bd264,_0x2674d7){return client[_0xd0d9('0xb')](_0x28528c,_0x4f04aa)[_0xd0d9('0xc')](function(_0x584617){logger[_0xd0d9('0xd')](_0xd0d9('0xe'),_0x3ca4bd,_0xd0d9('0xf'));logger[_0xd0d9('0x10')](_0xd0d9('0x11'),_0x3ca4bd,'request\x20sent',JSON['stringify'](_0x584617));if(_0x584617[_0xd0d9('0x12')]){if(_0x584617[_0xd0d9('0x12')][_0xd0d9('0x13')]===0x1f4){logger[_0xd0d9('0x12')](_0xd0d9('0xe'),_0x3ca4bd,_0x584617[_0xd0d9('0x12')][_0xd0d9('0x14')]);return _0x2674d7(_0x584617['error']['message']);}logger[_0xd0d9('0x12')](_0xd0d9('0xe'),_0x3ca4bd,_0x584617['error']['message']);return _0x3bd264(_0x584617[_0xd0d9('0x12')][_0xd0d9('0x14')]);}else{logger[_0xd0d9('0xd')]('MailApplication,\x20%s,\x20%s',_0x3ca4bd,_0xd0d9('0xf'));_0x3bd264(_0x584617[_0xd0d9('0x15')][_0xd0d9('0x14')]);}})[_0xd0d9('0x16')](function(_0x470383){logger['error'](_0xd0d9('0xe'),_0x3ca4bd,_0x470383);_0x2674d7(_0x470383);});});}exports[_0xd0d9('0x17')]=function(_0x28218a){var _0x26d548=this;return new Promise(function(_0x1672a9,_0x4f991){return db['MailApplication']['update'](_0x28218a['body'],{'raw':_0x28218a[_0xd0d9('0x18')]?_0x28218a[_0xd0d9('0x18')][_0xd0d9('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28218a[_0xd0d9('0x18')]?_0x28218a[_0xd0d9('0x18')]['where']||null:null,'attributes':_0x28218a[_0xd0d9('0x18')]?_0x28218a[_0xd0d9('0x18')][_0xd0d9('0x1a')]||null:null,'limit':_0x28218a[_0xd0d9('0x18')]?_0x28218a[_0xd0d9('0x18')][_0xd0d9('0x1b')]||null:null})['then'](function(_0x2bff23){logger[_0xd0d9('0xd')]('UpdateMailApplication',_0x28218a);logger[_0xd0d9('0x10')](_0xd0d9('0x17'),_0x28218a,JSON[_0xd0d9('0x1c')](_0x2bff23));_0x1672a9(_0x2bff23);})[_0xd0d9('0x16')](function(_0x2ed3bb){logger[_0xd0d9('0x12')](_0xd0d9('0x17'),_0x2ed3bb[_0xd0d9('0x14')],_0x28218a);_0x4f991(_0x26d548[_0xd0d9('0x12')](0x1f4,_0x2ed3bb[_0xd0d9('0x14')]));});});}; \ No newline at end of file +var _0xdbbb=['MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','MailApplication,\x20%s,\x20%s','message','catch','UpdateMailApplication','options','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0xdbbb,0x139));var _0xbdbb=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xdbbb[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xbdbb('0x0'));var util=require(_0xbdbb('0x1'));var moment=require(_0xbdbb('0x2'));var BPromise=require(_0xbdbb('0x3'));var rs=require(_0xbdbb('0x4'));var fs=require('fs');var Redis=require(_0xbdbb('0x5'));var db=require(_0xbdbb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbdbb('0x7'))(_0xbdbb('0x8'));var config=require(_0xbdbb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbdbb('0xa')][_0xbdbb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55a7b2,_0x4f741e,_0x213229){return new BPromise(function(_0x2e700a,_0x145982){return client[_0xbdbb('0xc')](_0x55a7b2,_0x213229)[_0xbdbb('0xd')](function(_0x7c378c){logger[_0xbdbb('0xe')]('MailApplication,\x20%s,\x20%s',_0x4f741e,_0xbdbb('0xf'));logger[_0xbdbb('0x10')](_0xbdbb('0x11'),_0x4f741e,_0xbdbb('0xf'),JSON[_0xbdbb('0x12')](_0x7c378c));if(_0x7c378c[_0xbdbb('0x13')]){if(_0x7c378c[_0xbdbb('0x13')][_0xbdbb('0x14')]===0x1f4){logger[_0xbdbb('0x13')](_0xbdbb('0x15'),_0x4f741e,_0x7c378c['error'][_0xbdbb('0x16')]);return _0x145982(_0x7c378c[_0xbdbb('0x13')][_0xbdbb('0x16')]);}logger['error'](_0xbdbb('0x15'),_0x4f741e,_0x7c378c[_0xbdbb('0x13')][_0xbdbb('0x16')]);return _0x2e700a(_0x7c378c['error'][_0xbdbb('0x16')]);}else{logger['info'](_0xbdbb('0x15'),_0x4f741e,_0xbdbb('0xf'));_0x2e700a(_0x7c378c['result'][_0xbdbb('0x16')]);}})[_0xbdbb('0x17')](function(_0x379f24){logger[_0xbdbb('0x13')]('MailApplication,\x20%s,\x20%s',_0x4f741e,_0x379f24);_0x145982(_0x379f24);});});}exports[_0xbdbb('0x18')]=function(_0x1f9ac9){var _0x46a9b5=this;return new Promise(function(_0x33463b,_0x1a7e91){return db['MailApplication']['update'](_0x1f9ac9['body'],{'raw':_0x1f9ac9[_0xbdbb('0x19')]?_0x1f9ac9[_0xbdbb('0x19')][_0xbdbb('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f9ac9['options']?_0x1f9ac9[_0xbdbb('0x19')][_0xbdbb('0x1b')]||null:null,'attributes':_0x1f9ac9[_0xbdbb('0x19')]?_0x1f9ac9['options'][_0xbdbb('0x1c')]||null:null,'limit':_0x1f9ac9[_0xbdbb('0x19')]?_0x1f9ac9[_0xbdbb('0x19')][_0xbdbb('0x1d')]||null:null})[_0xbdbb('0xd')](function(_0x58b0d4){logger[_0xbdbb('0xe')]('UpdateMailApplication',_0x1f9ac9);logger[_0xbdbb('0x10')](_0xbdbb('0x18'),_0x1f9ac9,JSON[_0xbdbb('0x12')](_0x58b0d4));_0x33463b(_0x58b0d4);})[_0xbdbb('0x17')](function(_0x3d1e44){logger['error'](_0xbdbb('0x18'),_0x3d1e44[_0xbdbb('0x16')],_0x1f9ac9);_0x1a7e91(_0x46a9b5[_0xbdbb('0x13')](0x1f4,_0x3d1e44[_0xbdbb('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 261333b..8a9fc96 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 _0xc7fe=['getMessages','/:id/download','download','post','create','/:id/messages','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','/:id','mailinteraction:update','update','delete','destroy','removeTags','exports','express','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','/describe','describe','show'];(function(_0x546cb3,_0x19094d){var _0x9fef30=function(_0x404c9f){while(--_0x404c9f){_0x546cb3['push'](_0x546cb3['shift']());}};_0x9fef30(++_0x19094d);}(_0xc7fe,0x9a));var _0xec7f=function(_0x355ce8,_0x5f1d0a){_0x355ce8=_0x355ce8-0x0;var _0x1db8b8=_0xc7fe[_0x355ce8];return _0x1db8b8;};'use strict';var express=require(_0xec7f('0x0'));var router=express['Router']();var auth=require(_0xec7f('0x1'));var interaction=require('../../components/interaction/service');var controller=require(_0xec7f('0x2'));router[_0xec7f('0x3')]('/',auth[_0xec7f('0x4')](),controller['index']);router['get'](_0xec7f('0x5'),auth[_0xec7f('0x4')](),controller[_0xec7f('0x6')]);router['get']('/:id',auth[_0xec7f('0x4')](),controller[_0xec7f('0x7')]);router[_0xec7f('0x3')]('/:id/messages',auth[_0xec7f('0x4')](),controller[_0xec7f('0x8')]);router[_0xec7f('0x3')](_0xec7f('0x9'),auth[_0xec7f('0x4')](),controller[_0xec7f('0xa')]);router[_0xec7f('0xb')]('/',auth['isAuthenticated'](),controller[_0xec7f('0xc')]);router['post'](_0xec7f('0xd'),auth['isAuthenticated'](),controller['addMessage']);router[_0xec7f('0xb')](_0xec7f('0xe'),auth[_0xec7f('0x4')](),interaction[_0xec7f('0xf')](_0xec7f('0x10'),_0xec7f('0x11')),controller[_0xec7f('0x12')]);router[_0xec7f('0x13')](_0xec7f('0x14'),auth['isAuthenticated'](),interaction['tracked'](_0xec7f('0x10'),_0xec7f('0x15')),controller[_0xec7f('0x16')]);router[_0xec7f('0x17')](_0xec7f('0x14'),auth[_0xec7f('0x4')](),interaction[_0xec7f('0xf')](_0xec7f('0x10'),'mailinteraction:destroy'),controller[_0xec7f('0x18')]);router['delete'](_0xec7f('0xe'),auth['isAuthenticated'](),controller[_0xec7f('0x19')]);module[_0xec7f('0x1a')]=router; \ No newline at end of file +var _0xafdc=['delete','mailinteraction:destroy','destroy','/:id/tags','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','mail','mailinteraction:addtags','put','mailinteraction:update','update'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xafdc,0x18c));var _0xcafd=function(_0x40a5c2,_0x427489){_0x40a5c2=_0x40a5c2-0x0;var _0x15ccdc=_0xafdc[_0x40a5c2];return _0x15ccdc;};'use strict';var express=require(_0xcafd('0x0'));var router=express[_0xcafd('0x1')]();var auth=require(_0xcafd('0x2'));var interaction=require(_0xcafd('0x3'));var controller=require(_0xcafd('0x4'));router[_0xcafd('0x5')]('/',auth[_0xcafd('0x6')](),controller['index']);router[_0xcafd('0x5')](_0xcafd('0x7'),auth['isAuthenticated'](),controller[_0xcafd('0x8')]);router['get'](_0xcafd('0x9'),auth[_0xcafd('0x6')](),controller[_0xcafd('0xa')]);router[_0xcafd('0x5')](_0xcafd('0xb'),auth[_0xcafd('0x6')](),controller[_0xcafd('0xc')]);router[_0xcafd('0x5')](_0xcafd('0xd'),auth[_0xcafd('0x6')](),controller[_0xcafd('0xe')]);router[_0xcafd('0xf')]('/',auth['isAuthenticated'](),controller[_0xcafd('0x10')]);router[_0xcafd('0xf')](_0xcafd('0xb'),auth[_0xcafd('0x6')](),controller[_0xcafd('0x11')]);router['post']('/:id/tags',auth['isAuthenticated'](),interaction[_0xcafd('0x12')](_0xcafd('0x13'),_0xcafd('0x14')),controller['addTags']);router[_0xcafd('0x15')](_0xcafd('0x9'),auth[_0xcafd('0x6')](),interaction[_0xcafd('0x12')](_0xcafd('0x13'),_0xcafd('0x16')),controller[_0xcafd('0x17')]);router[_0xcafd('0x18')](_0xcafd('0x9'),auth[_0xcafd('0x6')](),interaction[_0xcafd('0x12')](_0xcafd('0x13'),_0xcafd('0x19')),controller[_0xcafd('0x1a')]);router[_0xcafd('0x18')](_0xcafd('0x1b'),auth[_0xcafd('0x6')](),controller[_0xcafd('0x1c')]);module[_0xcafd('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 7111397..be9e440 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 _0xa6fa=['iconv','exports','BOOLEAN','STRING','long','DATE','ENUM','out'];(function(_0x5188ab,_0x4c2109){var _0x4597e7=function(_0x437336){while(--_0x437336){_0x5188ab['push'](_0x5188ab['shift']());}};_0x4597e7(++_0x4c2109);}(_0xa6fa,0x130));var _0xaa6f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xa6fa[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xaa6f('0x0'));module[_0xaa6f('0x1')]={'closed':{'type':Sequelize[_0xaa6f('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xaa6f('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xaa6f('0x3')]},'inReplyTo':{'type':Sequelize[_0xaa6f('0x3')](0x1fe)},'to':{'type':Sequelize[_0xaa6f('0x3')]},'cc':{'type':Sequelize['TEXT'](_0xaa6f('0x4'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xaa6f('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xaa6f('0x5')]},'substatus':{'type':Sequelize[_0xaa6f('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xaa6f('0x5')]},'firstMsgDirection':{'type':Sequelize[_0xaa6f('0x6')]('in',_0xaa6f('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xaa6f('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xaa6f('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xaa6f('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xa789=['out','sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM'];(function(_0x539dfc,_0x4c80ee){var _0x1c3bc7=function(_0x62148c){while(--_0x62148c){_0x539dfc['push'](_0x539dfc['shift']());}};_0x1c3bc7(++_0x4c80ee);}(_0xa789,0x8d));var _0x9a78=function(_0x3c26e0,_0x3505c4){_0x3c26e0=_0x3c26e0-0x0;var _0x1f0f67=_0xa789[_0x3c26e0];return _0x1f0f67;};'use strict';var Sequelize=require(_0x9a78('0x0'));var iconv=require(_0x9a78('0x1'));module[_0x9a78('0x2')]={'closed':{'type':Sequelize[_0x9a78('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9a78('0x4')]},'disposition':{'type':Sequelize[_0x9a78('0x5')]},'secondDisposition':{'type':Sequelize[_0x9a78('0x5')]},'thirdDisposition':{'type':Sequelize[_0x9a78('0x5')]},'note':{'type':Sequelize[_0x9a78('0x5')]},'inReplyTo':{'type':Sequelize[_0x9a78('0x5')](0x1fe)},'to':{'type':Sequelize[_0x9a78('0x5')]},'cc':{'type':Sequelize[_0x9a78('0x6')](_0x9a78('0x7'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x9a78('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x9a78('0x4')]},'substatus':{'type':Sequelize[_0x9a78('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x9a78('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x9a78('0x8')]('in',_0x9a78('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9a78('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x9a78('0x8')]('in',_0x9a78('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9a78('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 5ecc99b..be414b4 100644 --- a/server/api/mailInteraction/mailInteraction.controller.js +++ b/server/api/mailInteraction/mailInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','Setting','enableEmailPreview','all','rows','show','params','includeAll','include','options','create','body','addMessage','ids','omit','getMessages','nolimit','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','Tag','mailInteractionTags:save','download','join','root','server','tmp','attachments','Attachment','Attachments','subject','Messages','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','util','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','socket.io-emitter','redis','./mailInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','Users','fullname','Tags','split','forEach','push','TagIds','MailMessage','findOne','out','-id','plainBody','lastMsgText','trimStart','catch','index','MailInteraction','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','keys','some','compact','where','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','QueryTypes','SELECT','clone','i.id','order','contactName','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname'];(function(_0x78601a,_0x83dd){var _0x4ed023=function(_0x4cd33c){while(--_0x4cd33c){_0x78601a['push'](_0x78601a['shift']());}};_0x4ed023(++_0x83dd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x0a9e('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x0a9e('0x4'));var squel=require(_0x0a9e('0x5'));var juice=require(_0x0a9e('0x6'));var Redis=require(_0x0a9e('0x7'));var qs=require(_0x0a9e('0x8'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0x0a9e('0x9'))(_0x0a9e('0xa'));var config=require(_0x0a9e('0xb'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0a9e('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xd'))(new Redis(config[_0x0a9e('0xe')]));require(_0x0a9e('0xf'))[_0x0a9e('0x10')](socket);function respondWithStatusCode(_0xfeb75b,_0xbd1168){_0xbd1168=_0xbd1168||0xcc;return function(_0x4a4c56){if(_0x4a4c56){return _0xfeb75b['sendStatus'](_0xbd1168);}return _0xfeb75b['status'](_0xbd1168)['end']();};}function respondWithResult(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xc8;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x11')](_0x36471c)[_0x0a9e('0x12')](_0xd5b662);}};}function respondWithFilteredResult(_0x69aeb7,_0x5db4b0){return function(_0x4283ce){if(_0x4283ce){var _0x239b12=typeof _0x5db4b0[_0x0a9e('0x13')]===_0x0a9e('0x14')&&typeof _0x5db4b0[_0x0a9e('0x15')]===_0x0a9e('0x14');var _0x52a03d=_0x4283ce[_0x0a9e('0x16')];var _0x5d0880=_0x239b12?0x0:_0x5db4b0[_0x0a9e('0x13')];var _0x519dfd=_0x239b12?_0x4283ce[_0x0a9e('0x16')]:_0x5db4b0[_0x0a9e('0x13')]+_0x5db4b0['limit'];var _0x225616;if(_0x519dfd>=_0x52a03d){_0x519dfd=_0x52a03d;_0x225616=0xc8;}else{_0x225616=0xce;}_0x69aeb7['status'](_0x225616);return _0x69aeb7[_0x0a9e('0x17')](_0x0a9e('0x18'),_0x5d0880+'-'+_0x519dfd+'/'+_0x52a03d)[_0x0a9e('0x12')](_0x4283ce);}return null;};}function saveUpdates(_0x205fd6){return function(_0x31b1ca){if(_0x31b1ca){return _0x31b1ca[_0x0a9e('0x19')](_0x205fd6)[_0x0a9e('0x1a')](function(_0x20559e){return _0x20559e;});}return null;};}function removeEntity(_0x1314ae){return function(_0x112016){if(_0x112016){return _0x112016[_0x0a9e('0x1b')]()[_0x0a9e('0x1a')](function(){_0x1314ae['status'](0xcc)[_0x0a9e('0x1c')]();});}};}function handleEntityNotFound(_0x155cce){return function(_0x53682f){if(!_0x53682f){_0x155cce[_0x0a9e('0x1d')](0x194);}return _0x53682f;};}function handleError(_0x5a09ef,_0x588269){_0x588269=_0x588269||0x1f4;return function(_0x3a02e1){logger[_0x0a9e('0x1e')](_0x3a02e1[_0x0a9e('0x1f')]);if(_0x3a02e1[_0x0a9e('0x20')]){delete _0x3a02e1['name'];}_0x5a09ef[_0x0a9e('0x11')](_0x588269)[_0x0a9e('0x21')](_0x3a02e1);};}function getInteractionUsers(_0x3b45bc,_0x4d00e6){return new BPromise(function(_0x370d86,_0x42ac8f){try{if(_0x4d00e6[_0x3b45bc['id']]){_0x3b45bc[_0x0a9e('0x22')]=_['map'](_0x4d00e6[_0x3b45bc['id']],function(_0x59181e){return{'id':_0x59181e['id'],'fullname':_0x59181e[_0x0a9e('0x23')]};});}}catch(_0x3a8e58){_0x42ac8f(_0x3a8e58);}_0x370d86(_0x3b45bc);});}function getInteractionTags(_0x40c424,_0x33161b){return new BPromise(function(_0x526cf3,_0x384319){try{if(_0x40c424['TagIds']){_0x40c424[_0x0a9e('0x24')]=[];_0x40c424['TagIds'][_0x0a9e('0x25')](',')[_0x0a9e('0x26')](function(_0x25fba9){_0x40c424[_0x0a9e('0x24')][_0x0a9e('0x27')](_0x33161b[_0x25fba9]);});}delete _0x40c424[_0x0a9e('0x28')];}catch(_0x11c3b6){_0x384319(_0x11c3b6);}_0x526cf3(_0x40c424);});}function getLastMessageText(_0x14de77){return new BPromise(function(_0x5a101a,_0x3652a7){return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]({'where':{'$and':[{'MailInteractionId':_0x14de77['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0a9e('0x2b')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x0a9e('0x2c'),'raw':!![]})[_0x0a9e('0x1a')](function(_0x1843b2){if(_0x1843b2&&_0x1843b2[_0x0a9e('0x2d')]){_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1843b2[_0x0a9e('0x2d')]);}_0x5a101a(_0x14de77);})[_0x0a9e('0x30')](function(_0x1dbde2){_0x3652a7(_0x1dbde2);});});}function updateMailInteraction(_0x540530,_0x426950,_0x5d1e0e,_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return getInteractionUsers(_0x540530,_0x5d1e0e)[_0x0a9e('0x1a')](function(_0x25ce3a){return getInteractionTags(_0x25ce3a,_0x426950);})['then'](function(_0x66c1d2){if(_0x2407f9){_0x3ae878(getLastMessageText(_0x66c1d2));}else{_0x3ae878(_0x66c1d2);}})[_0x0a9e('0x30')](function(_0x40cb85){_0x1122db(_0x40cb85);});});}exports[_0x0a9e('0x31')]=function(_0x2b45ea,_0x409319){var _0x332d35={},_0x39e565={},_0x5583a4={'count':0x0,'rows':[]};var _0x44295a=_['map'](db[_0x0a9e('0x32')][_0x0a9e('0x33')],function(_0x2b7e7f){return{'name':_0x2b7e7f[_0x0a9e('0x34')],'type':_0x2b7e7f['type'][_0x0a9e('0x35')]};});_0x39e565[_0x0a9e('0x36')]=_[_0x0a9e('0x37')](_0x44295a,_0x0a9e('0x20'));_0x39e565['query']=_['keys'](_0x2b45ea[_0x0a9e('0x38')]);_0x39e565['filters']=_[_0x0a9e('0x39')](_0x39e565[_0x0a9e('0x36')],_0x39e565[_0x0a9e('0x38')]);_0x332d35[_0x0a9e('0x3a')]=_['intersection'](_0x39e565[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x2b45ea[_0x0a9e('0x38')]['fields']));_0x332d35[_0x0a9e('0x3a')]=_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x3c')]?_0x332d35['attributes']:_0x39e565['model'];if(!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3d')]('nolimit')){_0x332d35[_0x0a9e('0x15')]=qs[_0x0a9e('0x15')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x15')]);_0x332d35['offset']=qs['offset'](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x13')]);}_0x332d35['order']=qs[_0x0a9e('0x3e')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x332d35['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x2b45ea[_0x0a9e('0x38')],_0x39e565[_0x0a9e('0x3f')]),_0x44295a);var _0x13cb1f=[];var _0xeaa5e5=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x20'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')](_0x0a9e('0x45'));var _0x37f6cc=squel['select']()['field'](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x42')](_0x0a9e('0x48'))[_0x0a9e('0x44')](_0x0a9e('0x49'),'ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x2c2cb0=squel[_0x0a9e('0x41')]()['from'](_0x0a9e('0x4d'),'i')[_0x0a9e('0x4a')](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')]('mail_accounts','a',_0x0a9e('0x51'))['left_join'](_0x0a9e('0x52'),'me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it',_0x0a9e('0x54'))[_0x0a9e('0x4a')](_0x0a9e('0x45'),'t',_0x0a9e('0x55'));var _0x45c845=squel[_0x0a9e('0x56')]();var _0x45bf7f=[];var _0x5bbcde=squel[_0x0a9e('0x56')]();var _0x1bde3c;if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]){_0x1bde3c=as[_0x0a9e('0x58')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]);var _0x19383e=_0x1bde3c[_0x0a9e('0x59')];for(var _0x58a5c2=0x0;_0x58a5c2<_0x1bde3c[_0x0a9e('0x5a')][_0x0a9e('0x3c')];_0x58a5c2++){var _0x4f7240=_0x1bde3c['conditions'][_0x58a5c2];var _0x5ddf84='i';var _0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,[_0x0a9e('0x20'),_0x4f7240[_0x0a9e('0x42')]]);if(!_0x1adfee){switch(_0x4f7240[_0x0a9e('0x42')]){case _0x0a9e('0x5c'):if(_0x4f7240[_0x0a9e('0x5d')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')]('`'+_0x4f7240['field']+'`\x20=\x200');}else{_0x2c2cb0['having']('`'+_0x4f7240[_0x0a9e('0x42')]+_0x0a9e('0x5f'));}break;case _0x0a9e('0x60'):if(_0x4f7240['operator']===_0x0a9e('0x61')){if(_0x4f7240[_0x0a9e('0x5d')]['split']('\x20')['length']>0x1){_0x45c845[_0x19383e](_0x0a9e('0x62'),qs['getFullTextValue'](_0x4f7240[_0x0a9e('0x5d')]),null);}else{var _0x4c3845='%'+_0x4f7240[_0x0a9e('0x5d')]+'%';_0x45c845[_0x19383e](_0x0a9e('0x63'),_0x4c3845,_0x4c3845,_0x4c3845);}}else{_0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,['name',_0x0a9e('0x64')]);_0x4f7240[_0x0a9e('0x42')]='ContactId';_0x2244d6=as['buildExpression'](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6['value'][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'Tag':var _0xe22ccc=_0x4f7240['value']['split'](',')['map'](function(_0x2da03c){return Number(_0x2da03c);});_0xe22ccc['forEach'](function(_0x2f7092){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x2f7092+',%');});_0x45bf7f=_[_0x0a9e('0x69')](_0x45bf7f,_0xe22ccc);break;case _0x0a9e('0x6a'):if(_0x4f7240[_0x0a9e('0x6b')]===_0x0a9e('0x61')){_0x45c845[_0x19383e](_0x0a9e('0x6c'),'%'+_0x4f7240[_0x0a9e('0x5d')]+'%',null);}else{_0x1adfee=_['find'](_0x44295a,[_0x0a9e('0x20'),_0x0a9e('0x6d')]);_0x4f7240[_0x0a9e('0x42')]=_0x0a9e('0x6d');_0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'plainBody':_0x2244d6=as[_0x0a9e('0x6e')]('me',null,_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6['value']['start'],_0x2244d6[_0x0a9e('0x5d')]['end']);break;}}else{var _0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}}}else{var _0x5854cc=_(_0x2b45ea[_0x0a9e('0x38')])[_0x0a9e('0x6f')]()[_0x0a9e('0x37')](function(_0x5adf8f){return _[_0x0a9e('0x70')](_0x44295a,[_0x0a9e('0x20'),_0x5adf8f])?_0x5adf8f:undefined;})[_0x0a9e('0x71')]()[_0x0a9e('0x5d')]();if(!_['isEmpty'](_0x5854cc)){_0x5854cc[_0x0a9e('0x26')](function(_0xe05a5a){if(_0xe05a5a==='MailAccountId'){_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x73'),[][_0x0a9e('0x74')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]));}else if(_0xe05a5a===_0x0a9e('0x75')){var _0x4d4a35=JSON[_0x0a9e('0x76')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a])[_0x0a9e('0x77')];var _0x47bb43=JSON[_0x0a9e('0x76')](_0x2b45ea['query'][_0xe05a5a])['$lte'];_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x78'),_0x4d4a35,_0x47bb43);}else{if(_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]===_0x0a9e('0x79')){_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7a'));}else{_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7b'),_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]);}}});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7d'));}else{_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7e'));}}if(_0x2b45ea[_0x0a9e('0x38')]['tag']){_0x45bf7f=_[_0x0a9e('0x7f')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x80')])?_0x2b45ea['query'][_0x0a9e('0x80')]:new Array(_0x2b45ea[_0x0a9e('0x38')]['tag']);_0x45bf7f[_0x0a9e('0x26')](function(_0x56e31e){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x56e31e+',%');});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x81')]){var _0x4a43a8=_0x2b45ea['query']['filter'][_0x0a9e('0x82')]('\x5c','\x5c\x5c')[_0x0a9e('0x82')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x83')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x84'),_0x4a43a8+'%');}else if(qs[_0x0a9e('0x85')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x86'),_0x4a43a8+'%');}else{_0x45c845['or'](_0x0a9e('0x87'),qs[_0x0a9e('0x88')](_0x4a43a8))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a9e('0x88')](_0x4a43a8));}}}_0x2c2cb0[_0x0a9e('0x72')](_0x45c845);_0x2c2cb0[_0x0a9e('0x89')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x8a')][_0x0a9e('0x8b')],'raw':!![]};var _0x4c46c1=_0x2c2cb0[_0x0a9e('0x8c')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5c'));if(_0x332d35[_0x0a9e('0x8e')]){_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x26')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x8f')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x2c2cb0[_0x0a9e('0x8e')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x45bf7f)){_0x2c2cb0[_0x0a9e('0x5e')](_0x5bbcde);_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x91'),_0x45bf7f);}BPromise[_0x0a9e('0x92')]()[_0x0a9e('0x1a')](function(){if(!_0x1bde3c){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return;_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x94'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x94'));return;}if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]!==_0x0a9e('0x97'))return;return _0x2b45ea['user'][_0x0a9e('0x98')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x1a')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x99'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x99'));}else{_0x4c46c1['where']('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));_0x2c2cb0[_0x0a9e('0x72')]('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));}});})['then'](function(){if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]==='agent'&&!_0x1bde3c&&!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0x4c46c1[_0x0a9e('0x9b')](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x444f1f){_0x5583a4['count']=_0x444f1f[_0x0a9e('0x3c')];if(_0x5583a4[_0x0a9e('0x16')]===0x0)return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0xeaa5e5['toString'](),_0x2bdc44)[_0x0a9e('0x1a')](function(_0xf0db1){_0x13cb1f=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x9c')](_0x2bdc44,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3b')]){_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x26')](function(_0x5af453){_0x2c2cb0['field']('i.'+_0x5af453);});}else{_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x9d'),_0x0a9e('0x5c'));_0x2c2cb0['field'](_0x0a9e('0x9e'),_0x0a9e('0x9f'));_0x2c2cb0['field']('a.mandatoryDisposition',_0x0a9e('0xa0'));_0x2c2cb0['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa1'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa2'));_0x2c2cb0['field'](_0x0a9e('0xa3'));_0x2c2cb0['field'](_0x0a9e('0xa4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa5'));_0x2c2cb0[_0x0a9e('0x42')]('i.lastMsgAt');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa6'));_0x2c2cb0[_0x0a9e('0x42')]('i.subject');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa7'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa9'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xaa'));_0x2c2cb0['field'](_0x0a9e('0xab'));_0x2c2cb0[_0x0a9e('0x42')]('i.ContactId');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xac'));_0x2c2cb0[_0x0a9e('0x42')]('i.UserId');_0x2c2cb0[_0x0a9e('0x42')]('c.firstName',_0x0a9e('0xad'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb0'),_0x0a9e('0xb1'));_0x2c2cb0[_0x0a9e('0x42')]('c.phone',_0x0a9e('0xb2'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb3'),_0x0a9e('0xb4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb5'),_0x0a9e('0xb6'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb7'),_0x0a9e('0xb8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb9'),_0x0a9e('0xba'));_0x2c2cb0['field'](_0x0a9e('0xbb'),_0x0a9e('0x28'));}if(_0x332d35[_0x0a9e('0x15')])_0x2c2cb0[_0x0a9e('0x15')](_0x332d35[_0x0a9e('0x15')]);if(_0x332d35['offset'])_0x2c2cb0[_0x0a9e('0x13')](_0x332d35[_0x0a9e('0x13')]);return db['sequelize'][_0x0a9e('0x38')](_0x2c2cb0['toString'](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x27041d){if(_0x27041d[_0x0a9e('0x3c')]>0x0)_0x37f6cc[_0x0a9e('0x72')]('ui.MailInteractionId\x20IN\x20?',_[_0x0a9e('0x37')](_0x27041d,'id'));return db['sequelize'][_0x0a9e('0x38')](_0x37f6cc[_0x0a9e('0x9b')](),_0x2bdc44)['then'](function(_0x231c6a){var _0x63c9f7=_[_0x0a9e('0xbc')](_0x231c6a,'MailInteractionId');var _0x4c788f=[];return db[_0x0a9e('0xbd')][_0x0a9e('0x2a')]({'attributes':[_0x0a9e('0xbe')],'raw':!![]})[_0x0a9e('0x1a')](function(_0x3f2f40){var _0x2450a8=_0x3f2f40[_0x0a9e('0xbe')];_0x27041d[_0x0a9e('0x26')](function(_0x3f8124){_0x4c788f['push'](updateMailInteraction(_0x3f8124,_0x13cb1f,_0x63c9f7,_0x2450a8));});return BPromise[_0x0a9e('0xbf')](_0x4c788f);});});});})['then'](function(_0x287324){_0x5583a4[_0x0a9e('0xc0')]=_0x287324;return _0x5583a4;})[_0x0a9e('0x1a')](respondWithFilteredResult(_0x409319,_0x332d35))[_0x0a9e('0x30')](handleError(_0x409319,null));};exports[_0x0a9e('0xc1')]=function(_0x4e7273,_0x436313){var _0x4667bf={'raw':![],'where':{'id':_0x4e7273[_0x0a9e('0xc2')]['id']}},_0x2791c5={};_0x2791c5[_0x0a9e('0x36')]=_['keys'](db['MailInteraction'][_0x0a9e('0x33')]);_0x2791c5['query']=_[_0x0a9e('0x6f')](_0x4e7273[_0x0a9e('0x38')]);_0x2791c5[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x2791c5[_0x0a9e('0x36')],_0x2791c5[_0x0a9e('0x38')]);_0x4667bf['attributes']=_['intersection'](_0x2791c5[_0x0a9e('0x36')],qs['fields'](_0x4e7273[_0x0a9e('0x38')]['fields']));_0x4667bf[_0x0a9e('0x3a')]=_0x4667bf['attributes']['length']?_0x4667bf[_0x0a9e('0x3a')]:_0x2791c5[_0x0a9e('0x36')];if(_0x4e7273['query'][_0x0a9e('0xc3')]){_0x4667bf[_0x0a9e('0xc4')]=[{'all':!![]}];}_0x4667bf=_[_0x0a9e('0x9c')]({},_0x4667bf,_0x4e7273[_0x0a9e('0xc5')]);return db[_0x0a9e('0x32')]['find'](_0x4667bf)['then'](handleEntityNotFound(_0x436313,null))[_0x0a9e('0x1a')](respondWithResult(_0x436313,null))[_0x0a9e('0x30')](handleError(_0x436313,null));};exports[_0x0a9e('0xc6')]=function(_0x24beb6,_0x59303b){return db['MailInteraction'][_0x0a9e('0xc6')](_0x24beb6[_0x0a9e('0xc7')],{})['then'](respondWithResult(_0x59303b,0xc9))[_0x0a9e('0x30')](handleError(_0x59303b,null));};exports[_0x0a9e('0x19')]=function(_0xcacabb,_0x2427d5){if(_0xcacabb[_0x0a9e('0xc7')]['id']){delete _0xcacabb[_0x0a9e('0xc7')]['id'];}return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0xcacabb[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x2427d5,null))['then'](saveUpdates(_0xcacabb[_0x0a9e('0xc7')],null))[_0x0a9e('0x1a')](respondWithResult(_0x2427d5,null))[_0x0a9e('0x30')](handleError(_0x2427d5,null));};exports[_0x0a9e('0x1b')]=function(_0x1d0b02,_0x547e37){return db['MailInteraction'][_0x0a9e('0x5b')]({'where':{'id':_0x1d0b02[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x547e37,null))[_0x0a9e('0x1a')](removeEntity(_0x547e37,null))[_0x0a9e('0x30')](handleError(_0x547e37,null));};exports['describe']=function(_0x1339d0,_0x3c775a){return db[_0x0a9e('0x32')]['describe']()[_0x0a9e('0x1a')](respondWithResult(_0x3c775a,null))['catch'](handleError(_0x3c775a,null));};exports[_0x0a9e('0xc8')]=function(_0x4799d4,_0x25b745){return db[_0x0a9e('0x29')][_0x0a9e('0x5b')]({'where':{'id':_0x4799d4['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x25b745,null))['then'](function(_0x4383da){if(_0x4383da){return _0x4383da[_0x0a9e('0xc8')](_0x4799d4[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x4799d4[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{});}})[_0x0a9e('0x1a')](respondWithResult(_0x25b745,null))[_0x0a9e('0x30')](handleError(_0x25b745,null));};exports[_0x0a9e('0xcb')]=function(_0x4262d0,_0xc876d4){var _0x2415fe={'raw':![],'where':{}};var _0x399def={};var _0x98c62c={'count':0x0,'rows':[]};return db[_0x0a9e('0x32')]['findOne']({'where':{'id':_0x4262d0['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0xc876d4,null))['then'](function(_0x1d999b){if(_0x1d999b){_0x399def[_0x0a9e('0x36')]=_['keys'](db[_0x0a9e('0x29')][_0x0a9e('0x33')]);_0x399def[_0x0a9e('0x38')]=_[_0x0a9e('0x6f')](_0x4262d0['query']);_0x399def[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],_0x399def[_0x0a9e('0x38')]);_0x2415fe['attributes']=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x4262d0['query'][_0x0a9e('0x3b')]));_0x2415fe[_0x0a9e('0x3a')]=_0x2415fe[_0x0a9e('0x3a')]['length']?_0x2415fe[_0x0a9e('0x3a')]:_0x399def[_0x0a9e('0x36')];if(!_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3d')](_0x0a9e('0xcc'))){_0x2415fe['limit']=qs[_0x0a9e('0x15')](_0x4262d0[_0x0a9e('0x38')]['limit']);_0x2415fe[_0x0a9e('0x13')]=qs[_0x0a9e('0x13')](_0x4262d0[_0x0a9e('0x38')]['offset']);}_0x2415fe['order']=qs['sort'](_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x2415fe['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x4262d0[_0x0a9e('0x38')],_0x399def['filters']));_0x2415fe[_0x0a9e('0x72')][_0x0a9e('0xcd')]=_0x1d999b['id'];if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x81')]){_0x2415fe[_0x0a9e('0x72')]=_[_0x0a9e('0x9c')](_0x2415fe[_0x0a9e('0x72')],{'$or':_[_0x0a9e('0x37')](_0x2415fe[_0x0a9e('0x3a')],function(_0x5a1848){var _0x43c397={};_0x43c397[_0x5a1848]={'$like':'%'+_0x4262d0['query'][_0x0a9e('0x81')]+'%'};return _0x43c397;})});}if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]){var _0x3cf222=_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]['split'](',');var _0x1a0314={};_0x1a0314[_0x3cf222[0x0]]={'$gte':moment(_0x3cf222[0x1])[_0x0a9e('0xce')](_0x0a9e('0xcf'))};_0x2415fe[_0x0a9e('0x72')]=_['merge'](_0x2415fe[_0x0a9e('0x72')],_0x1a0314);}_0x2415fe=_[_0x0a9e('0x9c')]({},_0x2415fe,_0x4262d0[_0x0a9e('0xc5')]);return db[_0x0a9e('0x29')][_0x0a9e('0x16')]({'where':_0x2415fe[_0x0a9e('0x72')]})[_0x0a9e('0x1a')](function(_0x25931e){_0x98c62c[_0x0a9e('0x16')]=_0x25931e;if(_0x4262d0[_0x0a9e('0x38')]['includeAll']){_0x2415fe[_0x0a9e('0xc4')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0xd0')](_0x2415fe);})[_0x0a9e('0x1a')](function(_0xea8bd1){if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0xd1')]===_0x0a9e('0xd2')){for(var _0x566b90=0x0;_0x566b90<_0xea8bd1[_0x0a9e('0x3c')];_0x566b90++){_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]=juice(_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]);}}_0x98c62c['rows']=_0xea8bd1;return _0x98c62c;});}})[_0x0a9e('0x1a')](respondWithFilteredResult(_0xc876d4,_0x2415fe))[_0x0a9e('0x30')](handleError(_0xc876d4,null));};exports[_0x0a9e('0xd3')]=function(_0x97d5b5,_0x370b5e){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x97d5b5[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x370b5e,null))[_0x0a9e('0x1a')](function(_0x5a7dad){if(_0x5a7dad){return _0x5a7dad[_0x0a9e('0xd4')](_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x97d5b5[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{})['spread'](function(){return db[_0x0a9e('0xd5')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')]}});})[_0x0a9e('0x1a')](function(_0x2a07d0){socket['emit'](_0x0a9e('0xd6'),{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]});return{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]};});}})[_0x0a9e('0x1a')](respondWithResult(_0x370b5e,null))[_0x0a9e('0x30')](handleError(_0x370b5e,null));};exports['removeTags']=function(_0x57b1b1,_0x9484c8){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x57b1b1['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x9484c8,null))[_0x0a9e('0x1a')](function(_0x422f0a){if(_0x422f0a){return _0x422f0a['removeTags'](_0x57b1b1[_0x0a9e('0x38')][_0x0a9e('0xc9')]);}})[_0x0a9e('0x1a')](respondWithStatusCode(_0x9484c8,null))['catch'](handleError(_0x9484c8,null));};exports[_0x0a9e('0xd7')]=function(_0x336b30,_0x3b7213){var _0x549e03=moment()['unix']()['toString']();var _0x3b04fd=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdb'));var _0x532424=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdc'));var _0x33a26c=path[_0x0a9e('0xd8')](_0x3b04fd,_0x549e03);var _0x580dd6=util[_0x0a9e('0xce')]('transcript-%d-%s.zip',_0x336b30[_0x0a9e('0xc2')]['id'],_0x549e03);var _0x5c57e1=path[_0x0a9e('0xd8')](_0x3b04fd,_0x580dd6);var _0x57b7d4=[];if(_0x336b30[_0x0a9e('0x38')][_0x0a9e('0xdc')]){_0x57b7d4[_0x0a9e('0x27')]({'model':db[_0x0a9e('0xdd')],'as':_0x0a9e('0xde'),'raw':!![]});}var _0x251dd9=[{'model':db[_0x0a9e('0x29')],'as':'Messages','attributes':['id',_0x0a9e('0xc7'),_0x0a9e('0x44'),'to','cc','bcc',_0x0a9e('0xdf'),_0x0a9e('0x75')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x57b7d4}];return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x336b30[_0x0a9e('0xc2')]['id']},'include':_0x251dd9})['then'](handleEntityNotFound(_0x3b7213,null))[_0x0a9e('0x1a')](function(_0xf49ed4){if(_0xf49ed4&&_0xf49ed4[_0x0a9e('0xe0')]){var _0x3f0d64=_0xf49ed4[_0x0a9e('0xe1')]({'plain':!![]});fs[_0x0a9e('0xe2')](_0x33a26c);return BPromise[_0x0a9e('0xe3')](_0x3f0d64[_0x0a9e('0xe0')],function(_0x22767f,_0x426c3c){var _0x56e148={'from':_0x22767f[_0x0a9e('0x44')],'to':_0x22767f['to'],'subject':_0x22767f['subject'],'html':_0x22767f[_0x0a9e('0xc7')],'headers':{'Date':moment(_0x22767f[_0x0a9e('0x75')])[_0x0a9e('0xce')](_0x0a9e('0xe4'))},'attachments':[]};if(_0x22767f['cc']){_0x56e148[_0x0a9e('0xe5')]['Cc']=_0x22767f['cc'];}if(_0x22767f[_0x0a9e('0xe6')]){_0x56e148['headers'][_0x0a9e('0xe7')]=_0x22767f[_0x0a9e('0xe6')];}return new BPromise(function(_0x2977a7,_0x55a599){if(_0x22767f[_0x0a9e('0xde')]){for(var _0x402544=0x0;_0x402544<_0x22767f[_0x0a9e('0xde')][_0x0a9e('0x3c')];_0x402544++){var _0x31e1e0=_0x22767f[_0x0a9e('0xde')][_0x402544];var _0x1e93f5=path['join'](_0x532424,_0x31e1e0[_0x0a9e('0xe8')]);if(fs[_0x0a9e('0xe9')](_0x1e93f5)){_0x56e148[_0x0a9e('0xdc')][_0x0a9e('0x27')]({'name':_0x31e1e0[_0x0a9e('0x20')],'contentType':_0x31e1e0[_0x0a9e('0x65')],'data':fs[_0x0a9e('0xea')](_0x1e93f5)});}}}emlformat['build'](_0x56e148,function(_0x5c8720,_0x10aa22){if(_0x5c8720)return _0x55a599(_0x5c8720);fs[_0x0a9e('0xeb')](path[_0x0a9e('0xd8')](_0x33a26c,util[_0x0a9e('0xce')](_0x0a9e('0xec'),_0x426c3c)),_0x10aa22);return _0x2977a7(_0x10aa22);});});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x609711,_0x584854){zipdir(_0x33a26c,{'saveTo':_0x5c57e1},function(_0x39ea62,_0x1d7fc4){if(_0x39ea62)return _0x584854(_0x39ea62);return _0x609711(_0x1d7fc4);});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x2675a5,_0x1b1757){rimraf(_0x33a26c,function(_0x3c6082){if(_0x3c6082)_0x1b1757(_0x3c6082);return _0x2675a5();});});})[_0x0a9e('0x1a')](function(){return _0x3b7213['download'](_0x5c57e1,_0x580dd6,function(_0x311288){if(!_0x311288)fs[_0x0a9e('0xed')](_0x5c57e1);});});});}else{return _0x3b7213[_0x0a9e('0x1d')](0xc8);}})['catch'](handleError(_0x3b7213,null));}; \ No newline at end of file +var _0xa9e0=['o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','Setting','enableEmailPreview','all','rows','show','params','includeAll','include','options','create','body','addMessage','ids','omit','getMessages','nolimit','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','Tag','mailInteractionTags:save','download','join','root','server','tmp','attachments','Attachment','Attachments','subject','Messages','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','util','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','socket.io-emitter','redis','./mailInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','Users','fullname','Tags','split','forEach','push','TagIds','MailMessage','findOne','out','-id','plainBody','lastMsgText','trimStart','catch','index','MailInteraction','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','keys','some','compact','where','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','QueryTypes','SELECT','clone','i.id','order','contactName','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname'];(function(_0x54d245,_0x16c55a){var _0xe0b238=function(_0x477871){while(--_0x477871){_0x54d245['push'](_0x54d245['shift']());}};_0xe0b238(++_0x16c55a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x0a9e('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x0a9e('0x4'));var squel=require(_0x0a9e('0x5'));var juice=require(_0x0a9e('0x6'));var Redis=require(_0x0a9e('0x7'));var qs=require(_0x0a9e('0x8'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0x0a9e('0x9'))(_0x0a9e('0xa'));var config=require(_0x0a9e('0xb'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0a9e('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xd'))(new Redis(config[_0x0a9e('0xe')]));require(_0x0a9e('0xf'))[_0x0a9e('0x10')](socket);function respondWithStatusCode(_0xfeb75b,_0xbd1168){_0xbd1168=_0xbd1168||0xcc;return function(_0x4a4c56){if(_0x4a4c56){return _0xfeb75b['sendStatus'](_0xbd1168);}return _0xfeb75b['status'](_0xbd1168)['end']();};}function respondWithResult(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xc8;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x11')](_0x36471c)[_0x0a9e('0x12')](_0xd5b662);}};}function respondWithFilteredResult(_0x69aeb7,_0x5db4b0){return function(_0x4283ce){if(_0x4283ce){var _0x239b12=typeof _0x5db4b0[_0x0a9e('0x13')]===_0x0a9e('0x14')&&typeof _0x5db4b0[_0x0a9e('0x15')]===_0x0a9e('0x14');var _0x52a03d=_0x4283ce[_0x0a9e('0x16')];var _0x5d0880=_0x239b12?0x0:_0x5db4b0[_0x0a9e('0x13')];var _0x519dfd=_0x239b12?_0x4283ce[_0x0a9e('0x16')]:_0x5db4b0[_0x0a9e('0x13')]+_0x5db4b0['limit'];var _0x225616;if(_0x519dfd>=_0x52a03d){_0x519dfd=_0x52a03d;_0x225616=0xc8;}else{_0x225616=0xce;}_0x69aeb7['status'](_0x225616);return _0x69aeb7[_0x0a9e('0x17')](_0x0a9e('0x18'),_0x5d0880+'-'+_0x519dfd+'/'+_0x52a03d)[_0x0a9e('0x12')](_0x4283ce);}return null;};}function saveUpdates(_0x205fd6){return function(_0x31b1ca){if(_0x31b1ca){return _0x31b1ca[_0x0a9e('0x19')](_0x205fd6)[_0x0a9e('0x1a')](function(_0x20559e){return _0x20559e;});}return null;};}function removeEntity(_0x1314ae){return function(_0x112016){if(_0x112016){return _0x112016[_0x0a9e('0x1b')]()[_0x0a9e('0x1a')](function(){_0x1314ae['status'](0xcc)[_0x0a9e('0x1c')]();});}};}function handleEntityNotFound(_0x155cce){return function(_0x53682f){if(!_0x53682f){_0x155cce[_0x0a9e('0x1d')](0x194);}return _0x53682f;};}function handleError(_0x5a09ef,_0x588269){_0x588269=_0x588269||0x1f4;return function(_0x3a02e1){logger[_0x0a9e('0x1e')](_0x3a02e1[_0x0a9e('0x1f')]);if(_0x3a02e1[_0x0a9e('0x20')]){delete _0x3a02e1['name'];}_0x5a09ef[_0x0a9e('0x11')](_0x588269)[_0x0a9e('0x21')](_0x3a02e1);};}function getInteractionUsers(_0x3b45bc,_0x4d00e6){return new BPromise(function(_0x370d86,_0x42ac8f){try{if(_0x4d00e6[_0x3b45bc['id']]){_0x3b45bc[_0x0a9e('0x22')]=_['map'](_0x4d00e6[_0x3b45bc['id']],function(_0x59181e){return{'id':_0x59181e['id'],'fullname':_0x59181e[_0x0a9e('0x23')]};});}}catch(_0x3a8e58){_0x42ac8f(_0x3a8e58);}_0x370d86(_0x3b45bc);});}function getInteractionTags(_0x40c424,_0x33161b){return new BPromise(function(_0x526cf3,_0x384319){try{if(_0x40c424['TagIds']){_0x40c424[_0x0a9e('0x24')]=[];_0x40c424['TagIds'][_0x0a9e('0x25')](',')[_0x0a9e('0x26')](function(_0x25fba9){_0x40c424[_0x0a9e('0x24')][_0x0a9e('0x27')](_0x33161b[_0x25fba9]);});}delete _0x40c424[_0x0a9e('0x28')];}catch(_0x11c3b6){_0x384319(_0x11c3b6);}_0x526cf3(_0x40c424);});}function getLastMessageText(_0x14de77){return new BPromise(function(_0x5a101a,_0x3652a7){return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]({'where':{'$and':[{'MailInteractionId':_0x14de77['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0a9e('0x2b')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x0a9e('0x2c'),'raw':!![]})[_0x0a9e('0x1a')](function(_0x1843b2){if(_0x1843b2&&_0x1843b2[_0x0a9e('0x2d')]){_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1843b2[_0x0a9e('0x2d')]);}_0x5a101a(_0x14de77);})[_0x0a9e('0x30')](function(_0x1dbde2){_0x3652a7(_0x1dbde2);});});}function updateMailInteraction(_0x540530,_0x426950,_0x5d1e0e,_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return getInteractionUsers(_0x540530,_0x5d1e0e)[_0x0a9e('0x1a')](function(_0x25ce3a){return getInteractionTags(_0x25ce3a,_0x426950);})['then'](function(_0x66c1d2){if(_0x2407f9){_0x3ae878(getLastMessageText(_0x66c1d2));}else{_0x3ae878(_0x66c1d2);}})[_0x0a9e('0x30')](function(_0x40cb85){_0x1122db(_0x40cb85);});});}exports[_0x0a9e('0x31')]=function(_0x2b45ea,_0x409319){var _0x332d35={},_0x39e565={},_0x5583a4={'count':0x0,'rows':[]};var _0x44295a=_['map'](db[_0x0a9e('0x32')][_0x0a9e('0x33')],function(_0x2b7e7f){return{'name':_0x2b7e7f[_0x0a9e('0x34')],'type':_0x2b7e7f['type'][_0x0a9e('0x35')]};});_0x39e565[_0x0a9e('0x36')]=_[_0x0a9e('0x37')](_0x44295a,_0x0a9e('0x20'));_0x39e565['query']=_['keys'](_0x2b45ea[_0x0a9e('0x38')]);_0x39e565['filters']=_[_0x0a9e('0x39')](_0x39e565[_0x0a9e('0x36')],_0x39e565[_0x0a9e('0x38')]);_0x332d35[_0x0a9e('0x3a')]=_['intersection'](_0x39e565[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x2b45ea[_0x0a9e('0x38')]['fields']));_0x332d35[_0x0a9e('0x3a')]=_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x3c')]?_0x332d35['attributes']:_0x39e565['model'];if(!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3d')]('nolimit')){_0x332d35[_0x0a9e('0x15')]=qs[_0x0a9e('0x15')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x15')]);_0x332d35['offset']=qs['offset'](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x13')]);}_0x332d35['order']=qs[_0x0a9e('0x3e')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x332d35['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x2b45ea[_0x0a9e('0x38')],_0x39e565[_0x0a9e('0x3f')]),_0x44295a);var _0x13cb1f=[];var _0xeaa5e5=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x20'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')](_0x0a9e('0x45'));var _0x37f6cc=squel['select']()['field'](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x42')](_0x0a9e('0x48'))[_0x0a9e('0x44')](_0x0a9e('0x49'),'ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x2c2cb0=squel[_0x0a9e('0x41')]()['from'](_0x0a9e('0x4d'),'i')[_0x0a9e('0x4a')](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')]('mail_accounts','a',_0x0a9e('0x51'))['left_join'](_0x0a9e('0x52'),'me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it',_0x0a9e('0x54'))[_0x0a9e('0x4a')](_0x0a9e('0x45'),'t',_0x0a9e('0x55'));var _0x45c845=squel[_0x0a9e('0x56')]();var _0x45bf7f=[];var _0x5bbcde=squel[_0x0a9e('0x56')]();var _0x1bde3c;if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]){_0x1bde3c=as[_0x0a9e('0x58')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]);var _0x19383e=_0x1bde3c[_0x0a9e('0x59')];for(var _0x58a5c2=0x0;_0x58a5c2<_0x1bde3c[_0x0a9e('0x5a')][_0x0a9e('0x3c')];_0x58a5c2++){var _0x4f7240=_0x1bde3c['conditions'][_0x58a5c2];var _0x5ddf84='i';var _0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,[_0x0a9e('0x20'),_0x4f7240[_0x0a9e('0x42')]]);if(!_0x1adfee){switch(_0x4f7240[_0x0a9e('0x42')]){case _0x0a9e('0x5c'):if(_0x4f7240[_0x0a9e('0x5d')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')]('`'+_0x4f7240['field']+'`\x20=\x200');}else{_0x2c2cb0['having']('`'+_0x4f7240[_0x0a9e('0x42')]+_0x0a9e('0x5f'));}break;case _0x0a9e('0x60'):if(_0x4f7240['operator']===_0x0a9e('0x61')){if(_0x4f7240[_0x0a9e('0x5d')]['split']('\x20')['length']>0x1){_0x45c845[_0x19383e](_0x0a9e('0x62'),qs['getFullTextValue'](_0x4f7240[_0x0a9e('0x5d')]),null);}else{var _0x4c3845='%'+_0x4f7240[_0x0a9e('0x5d')]+'%';_0x45c845[_0x19383e](_0x0a9e('0x63'),_0x4c3845,_0x4c3845,_0x4c3845);}}else{_0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,['name',_0x0a9e('0x64')]);_0x4f7240[_0x0a9e('0x42')]='ContactId';_0x2244d6=as['buildExpression'](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6['value'][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'Tag':var _0xe22ccc=_0x4f7240['value']['split'](',')['map'](function(_0x2da03c){return Number(_0x2da03c);});_0xe22ccc['forEach'](function(_0x2f7092){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x2f7092+',%');});_0x45bf7f=_[_0x0a9e('0x69')](_0x45bf7f,_0xe22ccc);break;case _0x0a9e('0x6a'):if(_0x4f7240[_0x0a9e('0x6b')]===_0x0a9e('0x61')){_0x45c845[_0x19383e](_0x0a9e('0x6c'),'%'+_0x4f7240[_0x0a9e('0x5d')]+'%',null);}else{_0x1adfee=_['find'](_0x44295a,[_0x0a9e('0x20'),_0x0a9e('0x6d')]);_0x4f7240[_0x0a9e('0x42')]=_0x0a9e('0x6d');_0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'plainBody':_0x2244d6=as[_0x0a9e('0x6e')]('me',null,_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6['value']['start'],_0x2244d6[_0x0a9e('0x5d')]['end']);break;}}else{var _0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}}}else{var _0x5854cc=_(_0x2b45ea[_0x0a9e('0x38')])[_0x0a9e('0x6f')]()[_0x0a9e('0x37')](function(_0x5adf8f){return _[_0x0a9e('0x70')](_0x44295a,[_0x0a9e('0x20'),_0x5adf8f])?_0x5adf8f:undefined;})[_0x0a9e('0x71')]()[_0x0a9e('0x5d')]();if(!_['isEmpty'](_0x5854cc)){_0x5854cc[_0x0a9e('0x26')](function(_0xe05a5a){if(_0xe05a5a==='MailAccountId'){_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x73'),[][_0x0a9e('0x74')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]));}else if(_0xe05a5a===_0x0a9e('0x75')){var _0x4d4a35=JSON[_0x0a9e('0x76')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a])[_0x0a9e('0x77')];var _0x47bb43=JSON[_0x0a9e('0x76')](_0x2b45ea['query'][_0xe05a5a])['$lte'];_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x78'),_0x4d4a35,_0x47bb43);}else{if(_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]===_0x0a9e('0x79')){_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7a'));}else{_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7b'),_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]);}}});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7d'));}else{_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7e'));}}if(_0x2b45ea[_0x0a9e('0x38')]['tag']){_0x45bf7f=_[_0x0a9e('0x7f')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x80')])?_0x2b45ea['query'][_0x0a9e('0x80')]:new Array(_0x2b45ea[_0x0a9e('0x38')]['tag']);_0x45bf7f[_0x0a9e('0x26')](function(_0x56e31e){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x56e31e+',%');});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x81')]){var _0x4a43a8=_0x2b45ea['query']['filter'][_0x0a9e('0x82')]('\x5c','\x5c\x5c')[_0x0a9e('0x82')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x83')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x84'),_0x4a43a8+'%');}else if(qs[_0x0a9e('0x85')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x86'),_0x4a43a8+'%');}else{_0x45c845['or'](_0x0a9e('0x87'),qs[_0x0a9e('0x88')](_0x4a43a8))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a9e('0x88')](_0x4a43a8));}}}_0x2c2cb0[_0x0a9e('0x72')](_0x45c845);_0x2c2cb0[_0x0a9e('0x89')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x8a')][_0x0a9e('0x8b')],'raw':!![]};var _0x4c46c1=_0x2c2cb0[_0x0a9e('0x8c')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5c'));if(_0x332d35[_0x0a9e('0x8e')]){_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x26')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x8f')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x2c2cb0[_0x0a9e('0x8e')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x45bf7f)){_0x2c2cb0[_0x0a9e('0x5e')](_0x5bbcde);_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x91'),_0x45bf7f);}BPromise[_0x0a9e('0x92')]()[_0x0a9e('0x1a')](function(){if(!_0x1bde3c){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return;_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x94'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x94'));return;}if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]!==_0x0a9e('0x97'))return;return _0x2b45ea['user'][_0x0a9e('0x98')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x1a')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x99'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x99'));}else{_0x4c46c1['where']('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));_0x2c2cb0[_0x0a9e('0x72')]('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));}});})['then'](function(){if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]==='agent'&&!_0x1bde3c&&!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0x4c46c1[_0x0a9e('0x9b')](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x444f1f){_0x5583a4['count']=_0x444f1f[_0x0a9e('0x3c')];if(_0x5583a4[_0x0a9e('0x16')]===0x0)return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0xeaa5e5['toString'](),_0x2bdc44)[_0x0a9e('0x1a')](function(_0xf0db1){_0x13cb1f=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x9c')](_0x2bdc44,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3b')]){_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x26')](function(_0x5af453){_0x2c2cb0['field']('i.'+_0x5af453);});}else{_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x9d'),_0x0a9e('0x5c'));_0x2c2cb0['field'](_0x0a9e('0x9e'),_0x0a9e('0x9f'));_0x2c2cb0['field']('a.mandatoryDisposition',_0x0a9e('0xa0'));_0x2c2cb0['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa1'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa2'));_0x2c2cb0['field'](_0x0a9e('0xa3'));_0x2c2cb0['field'](_0x0a9e('0xa4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa5'));_0x2c2cb0[_0x0a9e('0x42')]('i.lastMsgAt');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa6'));_0x2c2cb0[_0x0a9e('0x42')]('i.subject');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa7'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa9'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xaa'));_0x2c2cb0['field'](_0x0a9e('0xab'));_0x2c2cb0[_0x0a9e('0x42')]('i.ContactId');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xac'));_0x2c2cb0[_0x0a9e('0x42')]('i.UserId');_0x2c2cb0[_0x0a9e('0x42')]('c.firstName',_0x0a9e('0xad'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb0'),_0x0a9e('0xb1'));_0x2c2cb0[_0x0a9e('0x42')]('c.phone',_0x0a9e('0xb2'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb3'),_0x0a9e('0xb4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb5'),_0x0a9e('0xb6'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb7'),_0x0a9e('0xb8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb9'),_0x0a9e('0xba'));_0x2c2cb0['field'](_0x0a9e('0xbb'),_0x0a9e('0x28'));}if(_0x332d35[_0x0a9e('0x15')])_0x2c2cb0[_0x0a9e('0x15')](_0x332d35[_0x0a9e('0x15')]);if(_0x332d35['offset'])_0x2c2cb0[_0x0a9e('0x13')](_0x332d35[_0x0a9e('0x13')]);return db['sequelize'][_0x0a9e('0x38')](_0x2c2cb0['toString'](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x27041d){if(_0x27041d[_0x0a9e('0x3c')]>0x0)_0x37f6cc[_0x0a9e('0x72')]('ui.MailInteractionId\x20IN\x20?',_[_0x0a9e('0x37')](_0x27041d,'id'));return db['sequelize'][_0x0a9e('0x38')](_0x37f6cc[_0x0a9e('0x9b')](),_0x2bdc44)['then'](function(_0x231c6a){var _0x63c9f7=_[_0x0a9e('0xbc')](_0x231c6a,'MailInteractionId');var _0x4c788f=[];return db[_0x0a9e('0xbd')][_0x0a9e('0x2a')]({'attributes':[_0x0a9e('0xbe')],'raw':!![]})[_0x0a9e('0x1a')](function(_0x3f2f40){var _0x2450a8=_0x3f2f40[_0x0a9e('0xbe')];_0x27041d[_0x0a9e('0x26')](function(_0x3f8124){_0x4c788f['push'](updateMailInteraction(_0x3f8124,_0x13cb1f,_0x63c9f7,_0x2450a8));});return BPromise[_0x0a9e('0xbf')](_0x4c788f);});});});})['then'](function(_0x287324){_0x5583a4[_0x0a9e('0xc0')]=_0x287324;return _0x5583a4;})[_0x0a9e('0x1a')](respondWithFilteredResult(_0x409319,_0x332d35))[_0x0a9e('0x30')](handleError(_0x409319,null));};exports[_0x0a9e('0xc1')]=function(_0x4e7273,_0x436313){var _0x4667bf={'raw':![],'where':{'id':_0x4e7273[_0x0a9e('0xc2')]['id']}},_0x2791c5={};_0x2791c5[_0x0a9e('0x36')]=_['keys'](db['MailInteraction'][_0x0a9e('0x33')]);_0x2791c5['query']=_[_0x0a9e('0x6f')](_0x4e7273[_0x0a9e('0x38')]);_0x2791c5[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x2791c5[_0x0a9e('0x36')],_0x2791c5[_0x0a9e('0x38')]);_0x4667bf['attributes']=_['intersection'](_0x2791c5[_0x0a9e('0x36')],qs['fields'](_0x4e7273[_0x0a9e('0x38')]['fields']));_0x4667bf[_0x0a9e('0x3a')]=_0x4667bf['attributes']['length']?_0x4667bf[_0x0a9e('0x3a')]:_0x2791c5[_0x0a9e('0x36')];if(_0x4e7273['query'][_0x0a9e('0xc3')]){_0x4667bf[_0x0a9e('0xc4')]=[{'all':!![]}];}_0x4667bf=_[_0x0a9e('0x9c')]({},_0x4667bf,_0x4e7273[_0x0a9e('0xc5')]);return db[_0x0a9e('0x32')]['find'](_0x4667bf)['then'](handleEntityNotFound(_0x436313,null))[_0x0a9e('0x1a')](respondWithResult(_0x436313,null))[_0x0a9e('0x30')](handleError(_0x436313,null));};exports[_0x0a9e('0xc6')]=function(_0x24beb6,_0x59303b){return db['MailInteraction'][_0x0a9e('0xc6')](_0x24beb6[_0x0a9e('0xc7')],{})['then'](respondWithResult(_0x59303b,0xc9))[_0x0a9e('0x30')](handleError(_0x59303b,null));};exports[_0x0a9e('0x19')]=function(_0xcacabb,_0x2427d5){if(_0xcacabb[_0x0a9e('0xc7')]['id']){delete _0xcacabb[_0x0a9e('0xc7')]['id'];}return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0xcacabb[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x2427d5,null))['then'](saveUpdates(_0xcacabb[_0x0a9e('0xc7')],null))[_0x0a9e('0x1a')](respondWithResult(_0x2427d5,null))[_0x0a9e('0x30')](handleError(_0x2427d5,null));};exports[_0x0a9e('0x1b')]=function(_0x1d0b02,_0x547e37){return db['MailInteraction'][_0x0a9e('0x5b')]({'where':{'id':_0x1d0b02[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x547e37,null))[_0x0a9e('0x1a')](removeEntity(_0x547e37,null))[_0x0a9e('0x30')](handleError(_0x547e37,null));};exports['describe']=function(_0x1339d0,_0x3c775a){return db[_0x0a9e('0x32')]['describe']()[_0x0a9e('0x1a')](respondWithResult(_0x3c775a,null))['catch'](handleError(_0x3c775a,null));};exports[_0x0a9e('0xc8')]=function(_0x4799d4,_0x25b745){return db[_0x0a9e('0x29')][_0x0a9e('0x5b')]({'where':{'id':_0x4799d4['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x25b745,null))['then'](function(_0x4383da){if(_0x4383da){return _0x4383da[_0x0a9e('0xc8')](_0x4799d4[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x4799d4[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{});}})[_0x0a9e('0x1a')](respondWithResult(_0x25b745,null))[_0x0a9e('0x30')](handleError(_0x25b745,null));};exports[_0x0a9e('0xcb')]=function(_0x4262d0,_0xc876d4){var _0x2415fe={'raw':![],'where':{}};var _0x399def={};var _0x98c62c={'count':0x0,'rows':[]};return db[_0x0a9e('0x32')]['findOne']({'where':{'id':_0x4262d0['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0xc876d4,null))['then'](function(_0x1d999b){if(_0x1d999b){_0x399def[_0x0a9e('0x36')]=_['keys'](db[_0x0a9e('0x29')][_0x0a9e('0x33')]);_0x399def[_0x0a9e('0x38')]=_[_0x0a9e('0x6f')](_0x4262d0['query']);_0x399def[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],_0x399def[_0x0a9e('0x38')]);_0x2415fe['attributes']=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x4262d0['query'][_0x0a9e('0x3b')]));_0x2415fe[_0x0a9e('0x3a')]=_0x2415fe[_0x0a9e('0x3a')]['length']?_0x2415fe[_0x0a9e('0x3a')]:_0x399def[_0x0a9e('0x36')];if(!_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3d')](_0x0a9e('0xcc'))){_0x2415fe['limit']=qs[_0x0a9e('0x15')](_0x4262d0[_0x0a9e('0x38')]['limit']);_0x2415fe[_0x0a9e('0x13')]=qs[_0x0a9e('0x13')](_0x4262d0[_0x0a9e('0x38')]['offset']);}_0x2415fe['order']=qs['sort'](_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x2415fe['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x4262d0[_0x0a9e('0x38')],_0x399def['filters']));_0x2415fe[_0x0a9e('0x72')][_0x0a9e('0xcd')]=_0x1d999b['id'];if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x81')]){_0x2415fe[_0x0a9e('0x72')]=_[_0x0a9e('0x9c')](_0x2415fe[_0x0a9e('0x72')],{'$or':_[_0x0a9e('0x37')](_0x2415fe[_0x0a9e('0x3a')],function(_0x5a1848){var _0x43c397={};_0x43c397[_0x5a1848]={'$like':'%'+_0x4262d0['query'][_0x0a9e('0x81')]+'%'};return _0x43c397;})});}if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]){var _0x3cf222=_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]['split'](',');var _0x1a0314={};_0x1a0314[_0x3cf222[0x0]]={'$gte':moment(_0x3cf222[0x1])[_0x0a9e('0xce')](_0x0a9e('0xcf'))};_0x2415fe[_0x0a9e('0x72')]=_['merge'](_0x2415fe[_0x0a9e('0x72')],_0x1a0314);}_0x2415fe=_[_0x0a9e('0x9c')]({},_0x2415fe,_0x4262d0[_0x0a9e('0xc5')]);return db[_0x0a9e('0x29')][_0x0a9e('0x16')]({'where':_0x2415fe[_0x0a9e('0x72')]})[_0x0a9e('0x1a')](function(_0x25931e){_0x98c62c[_0x0a9e('0x16')]=_0x25931e;if(_0x4262d0[_0x0a9e('0x38')]['includeAll']){_0x2415fe[_0x0a9e('0xc4')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0xd0')](_0x2415fe);})[_0x0a9e('0x1a')](function(_0xea8bd1){if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0xd1')]===_0x0a9e('0xd2')){for(var _0x566b90=0x0;_0x566b90<_0xea8bd1[_0x0a9e('0x3c')];_0x566b90++){_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]=juice(_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]);}}_0x98c62c['rows']=_0xea8bd1;return _0x98c62c;});}})[_0x0a9e('0x1a')](respondWithFilteredResult(_0xc876d4,_0x2415fe))[_0x0a9e('0x30')](handleError(_0xc876d4,null));};exports[_0x0a9e('0xd3')]=function(_0x97d5b5,_0x370b5e){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x97d5b5[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x370b5e,null))[_0x0a9e('0x1a')](function(_0x5a7dad){if(_0x5a7dad){return _0x5a7dad[_0x0a9e('0xd4')](_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x97d5b5[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{})['spread'](function(){return db[_0x0a9e('0xd5')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')]}});})[_0x0a9e('0x1a')](function(_0x2a07d0){socket['emit'](_0x0a9e('0xd6'),{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]});return{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]};});}})[_0x0a9e('0x1a')](respondWithResult(_0x370b5e,null))[_0x0a9e('0x30')](handleError(_0x370b5e,null));};exports['removeTags']=function(_0x57b1b1,_0x9484c8){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x57b1b1['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x9484c8,null))[_0x0a9e('0x1a')](function(_0x422f0a){if(_0x422f0a){return _0x422f0a['removeTags'](_0x57b1b1[_0x0a9e('0x38')][_0x0a9e('0xc9')]);}})[_0x0a9e('0x1a')](respondWithStatusCode(_0x9484c8,null))['catch'](handleError(_0x9484c8,null));};exports[_0x0a9e('0xd7')]=function(_0x336b30,_0x3b7213){var _0x549e03=moment()['unix']()['toString']();var _0x3b04fd=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdb'));var _0x532424=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdc'));var _0x33a26c=path[_0x0a9e('0xd8')](_0x3b04fd,_0x549e03);var _0x580dd6=util[_0x0a9e('0xce')]('transcript-%d-%s.zip',_0x336b30[_0x0a9e('0xc2')]['id'],_0x549e03);var _0x5c57e1=path[_0x0a9e('0xd8')](_0x3b04fd,_0x580dd6);var _0x57b7d4=[];if(_0x336b30[_0x0a9e('0x38')][_0x0a9e('0xdc')]){_0x57b7d4[_0x0a9e('0x27')]({'model':db[_0x0a9e('0xdd')],'as':_0x0a9e('0xde'),'raw':!![]});}var _0x251dd9=[{'model':db[_0x0a9e('0x29')],'as':'Messages','attributes':['id',_0x0a9e('0xc7'),_0x0a9e('0x44'),'to','cc','bcc',_0x0a9e('0xdf'),_0x0a9e('0x75')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x57b7d4}];return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x336b30[_0x0a9e('0xc2')]['id']},'include':_0x251dd9})['then'](handleEntityNotFound(_0x3b7213,null))[_0x0a9e('0x1a')](function(_0xf49ed4){if(_0xf49ed4&&_0xf49ed4[_0x0a9e('0xe0')]){var _0x3f0d64=_0xf49ed4[_0x0a9e('0xe1')]({'plain':!![]});fs[_0x0a9e('0xe2')](_0x33a26c);return BPromise[_0x0a9e('0xe3')](_0x3f0d64[_0x0a9e('0xe0')],function(_0x22767f,_0x426c3c){var _0x56e148={'from':_0x22767f[_0x0a9e('0x44')],'to':_0x22767f['to'],'subject':_0x22767f['subject'],'html':_0x22767f[_0x0a9e('0xc7')],'headers':{'Date':moment(_0x22767f[_0x0a9e('0x75')])[_0x0a9e('0xce')](_0x0a9e('0xe4'))},'attachments':[]};if(_0x22767f['cc']){_0x56e148[_0x0a9e('0xe5')]['Cc']=_0x22767f['cc'];}if(_0x22767f[_0x0a9e('0xe6')]){_0x56e148['headers'][_0x0a9e('0xe7')]=_0x22767f[_0x0a9e('0xe6')];}return new BPromise(function(_0x2977a7,_0x55a599){if(_0x22767f[_0x0a9e('0xde')]){for(var _0x402544=0x0;_0x402544<_0x22767f[_0x0a9e('0xde')][_0x0a9e('0x3c')];_0x402544++){var _0x31e1e0=_0x22767f[_0x0a9e('0xde')][_0x402544];var _0x1e93f5=path['join'](_0x532424,_0x31e1e0[_0x0a9e('0xe8')]);if(fs[_0x0a9e('0xe9')](_0x1e93f5)){_0x56e148[_0x0a9e('0xdc')][_0x0a9e('0x27')]({'name':_0x31e1e0[_0x0a9e('0x20')],'contentType':_0x31e1e0[_0x0a9e('0x65')],'data':fs[_0x0a9e('0xea')](_0x1e93f5)});}}}emlformat['build'](_0x56e148,function(_0x5c8720,_0x10aa22){if(_0x5c8720)return _0x55a599(_0x5c8720);fs[_0x0a9e('0xeb')](path[_0x0a9e('0xd8')](_0x33a26c,util[_0x0a9e('0xce')](_0x0a9e('0xec'),_0x426c3c)),_0x10aa22);return _0x2977a7(_0x10aa22);});});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x609711,_0x584854){zipdir(_0x33a26c,{'saveTo':_0x5c57e1},function(_0x39ea62,_0x1d7fc4){if(_0x39ea62)return _0x584854(_0x39ea62);return _0x609711(_0x1d7fc4);});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x2675a5,_0x1b1757){rimraf(_0x33a26c,function(_0x3c6082){if(_0x3c6082)_0x1b1757(_0x3c6082);return _0x2675a5();});});})[_0x0a9e('0x1a')](function(){return _0x3b7213['download'](_0x5c57e1,_0x580dd6,function(_0x311288){if(!_0x311288)fs[_0x0a9e('0xed')](_0x5c57e1);});});});}else{return _0x3b7213[_0x0a9e('0x1d')](0xc8);}})['catch'](handleError(_0x3b7213,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index ee7eec9..932d601 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 _0x22ac=['../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','map','findAll','then','emit','hasOwnProperty','events'];(function(_0x278611,_0x30486d){var _0x151676=function(_0x3dfe18){while(--_0x3dfe18){_0x278611['push'](_0x278611['shift']());}};_0x151676(++_0x30486d);}(_0x22ac,0x1bf));var _0xc22a=function(_0x180271,_0x2a7b1e){_0x180271=_0x180271-0x0;var _0x1cf12f=_0x22ac[_0x180271];return _0x1cf12f;};'use strict';var EventEmitter=require(_0xc22a('0x0'));var MailInteraction=require(_0xc22a('0x1'))['db'][_0xc22a('0x2')];var MailMessage=require('../../mysqldb')['db'][_0xc22a('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xc22a('0x4')](0x0);var events={'afterCreate':_0xc22a('0x5'),'afterUpdate':_0xc22a('0x6'),'afterDestroy':_0xc22a('0x7')};function emitEvent(_0x5bac41){return function(_0x2965d8,_0x66c644,_0x5475ec){_0x2965d8[_0xc22a('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1089bc){_0x2965d8[_0xc22a('0x9')](_0xc22a('0xa'),_0x1089bc[_0xc22a('0xb')](function(_0x164a2f){return{'id':_0x164a2f['id']};}));return MailMessage[_0xc22a('0xc')]({'where':{'MailInteractionId':_0x2965d8['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc22a('0xd')](function(_0x23d272){_0x2965d8[_0xc22a('0x9')]('unreadMessages',_0x23d272['length']);MailInteractionEvents[_0xc22a('0xe')](_0x5bac41+':'+_0x2965d8['id'],_0x2965d8);MailInteractionEvents[_0xc22a('0xe')](_0x5bac41,_0x2965d8);_0x5475ec(null);})['catch'](_0x5475ec(null));};}for(var e in events){if(events[_0xc22a('0xf')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0xf037=['save','update','getUsers','then','setDataValue','Users','unreadMessages','length','emit','hasOwnProperty','hook','exports','../../mysqldb','MailInteraction','MailMessage','setMaxListeners'];(function(_0x1e5146,_0x42dc0d){var _0x4816a3=function(_0x3d0f00){while(--_0x3d0f00){_0x1e5146['push'](_0x1e5146['shift']());}};_0x4816a3(++_0x42dc0d);}(_0xf037,0x1bc));var _0x7f03=function(_0x5cf3c0,_0x4363c1){_0x5cf3c0=_0x5cf3c0-0x0;var _0x39a680=_0xf037[_0x5cf3c0];return _0x39a680;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x7f03('0x0'))['db'][_0x7f03('0x1')];var MailMessage=require(_0x7f03('0x0'))['db'][_0x7f03('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x7f03('0x3')](0x0);var events={'afterCreate':_0x7f03('0x4'),'afterUpdate':_0x7f03('0x5'),'afterDestroy':'remove'};function emitEvent(_0x46e711){return function(_0x45e666,_0x2a2228,_0xda1913){_0x45e666[_0x7f03('0x6')]({'attributes':['id'],'raw':!![]})[_0x7f03('0x7')](function(_0x48b382){_0x45e666[_0x7f03('0x8')](_0x7f03('0x9'),_0x48b382['map'](function(_0x46362a){return{'id':_0x46362a['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x45e666['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7f03('0x7')](function(_0x4dc44c){_0x45e666[_0x7f03('0x8')](_0x7f03('0xa'),_0x4dc44c[_0x7f03('0xb')]);MailInteractionEvents[_0x7f03('0xc')](_0x46e711+':'+_0x45e666['id'],_0x45e666);MailInteractionEvents[_0x7f03('0xc')](_0x46e711,_0x45e666);_0xda1913(null);})['catch'](_0xda1913(null));};}for(var e in events){if(events[_0x7f03('0xd')](e)){var event=events[e];MailInteraction[_0x7f03('0xe')](e,emitEvent(event));}}module[_0x7f03('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 65dcd93..1cf0b2b 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 _0xf46c=['request-promise','rimraf','../../config/environment','./mailInteraction.attributes','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatusAt','models','get','MailMessage','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf46c,0xf7));var _0xcf46=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf46c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcf46('0x0'));var util=require(_0xcf46('0x1'));var logger=require(_0xcf46('0x2'))(_0xcf46('0x3'));var moment=require('moment');var BPromise=require(_0xcf46('0x4'));var rp=require(_0xcf46('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcf46('0x6'));var config=require(_0xcf46('0x7'));var attributes=require(_0xcf46('0x8'));module['exports']=function(_0xd4cf62,_0x53853c){return _0xd4cf62[_0xcf46('0x9')](_0xcf46('0xa'),attributes,{'tableName':_0xcf46('0xb'),'paranoid':![],'indexes':[{'name':_0xcf46('0xc'),'fields':[_0xcf46('0xd'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x36a97f,_0x1fa208,_0x1d15b7){if(_0x36a97f[_0xcf46('0xe')]){_0x36a97f['substatusAt']=moment()[_0xcf46('0xf')](_0xcf46('0x10'));}if(_0x36a97f[_0xcf46('0x11')]){_0x36a97f[_0xcf46('0x12')]=moment()[_0xcf46('0xf')](_0xcf46('0x10'));}_0x1d15b7(null,_0x1fa208);},'beforeUpdate':function(_0x1395b9,_0x460bb8,_0x56a618){if(_0x1395b9[_0xcf46('0x13')](_0xcf46('0xe'))){_0x1395b9[_0xcf46('0x14')]=_0x1395b9[_0xcf46('0xe')]?moment()['format'](_0xcf46('0x10')):null;}if(_0x1395b9['changed'](_0xcf46('0x11'))){_0x1395b9['closedAt']=moment()[_0xcf46('0xf')](_0xcf46('0x10'));_0x1395b9[_0xcf46('0xe')]=null;_0x1395b9[_0xcf46('0x14')]=null;}_0x56a618(null,_0x1395b9);},'afterUpdate':function(_0x238333,_0x4becbd,_0x13c245){var _0x181c9f=_0xd4cf62[_0xcf46('0x15')];var _0x2b4440=_0x238333[_0xcf46('0x16')]({'plain':!![]});if(_0x2b4440[_0xcf46('0x11')]){return _0x181c9f[_0xcf46('0x17')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x2b4440['id']}})[_0xcf46('0x18')](function(){_0x13c245();})[_0xcf46('0x19')](function(_0x5856ac){_0x13c245(_0x5856ac);});}else{_0x13c245();}}},'charset':_0xcf46('0x1a'),'collate':_0xcf46('0x1b')});}; \ No newline at end of file +var _0x5275=['catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','substatus','closed','models','get','MailMessage','update'];(function(_0x3a422c,_0x35c64f){var _0x4cdeba=function(_0x201325){while(--_0x201325){_0x3a422c['push'](_0x3a422c['shift']());}};_0x4cdeba(++_0x35c64f);}(_0x5275,0x17d));var _0x5527=function(_0x2fb561,_0x579dbf){_0x2fb561=_0x2fb561-0x0;var _0x2b7be3=_0x5275[_0x2fb561];return _0x2b7be3;};'use strict';var _=require(_0x5527('0x0'));var util=require('util');var logger=require(_0x5527('0x1'))(_0x5527('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5527('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5527('0x4'));var config=require(_0x5527('0x5'));var attributes=require(_0x5527('0x6'));module[_0x5527('0x7')]=function(_0x273d9e,_0x24ef9b){return _0x273d9e[_0x5527('0x8')](_0x5527('0x9'),attributes,{'tableName':_0x5527('0xa'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x5527('0xb'),'to'],'type':_0x5527('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x27cbef,_0x171f67,_0x366e08){if(_0x27cbef['substatus']){_0x27cbef[_0x5527('0xd')]=moment()[_0x5527('0xe')](_0x5527('0xf'));}if(_0x27cbef['closed']){_0x27cbef[_0x5527('0x10')]=moment()['format'](_0x5527('0xf'));}_0x366e08(null,_0x171f67);},'beforeUpdate':function(_0x1d9f0b,_0x12a728,_0xe17739){if(_0x1d9f0b[_0x5527('0x11')]('substatus')){_0x1d9f0b[_0x5527('0xd')]=_0x1d9f0b[_0x5527('0x12')]?moment()['format'](_0x5527('0xf')):null;}if(_0x1d9f0b[_0x5527('0x11')](_0x5527('0x13'))){_0x1d9f0b[_0x5527('0x10')]=moment()[_0x5527('0xe')]('YYYY-MM-DD\x20HH:mm:ss');_0x1d9f0b[_0x5527('0x12')]=null;_0x1d9f0b[_0x5527('0xd')]=null;}_0xe17739(null,_0x1d9f0b);},'afterUpdate':function(_0xa9750,_0x21d320,_0x24a4a3){var _0x455ab6=_0x273d9e[_0x5527('0x14')];var _0x4567ec=_0xa9750[_0x5527('0x15')]({'plain':!![]});if(_0x4567ec[_0x5527('0x13')]){return _0x455ab6[_0x5527('0x16')][_0x5527('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x4567ec['id']}})['then'](function(){_0x24a4a3();})[_0x5527('0x18')](function(_0xd48680){_0x24a4a3(_0xd48680);});}else{_0x24a4a3();}}},'charset':_0x5527('0x19'),'collate':_0x5527('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index acf8b4a..71fd7a6 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 _0x8239=['find','addTags','ids','omit','AddTags','stringify','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./mailInteraction.socket','register','request','then','info','request\x20sent','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','AddTagsToMailInteraction'];(function(_0x2bdb47,_0xb4f3dc){var _0x57d58c=function(_0x14ad9c){while(--_0x14ad9c){_0x2bdb47['push'](_0x2bdb47['shift']());}};_0x57d58c(++_0xb4f3dc);}(_0x8239,0x177));var _0x9823=function(_0x4737c4,_0x2a3ae5){_0x4737c4=_0x4737c4-0x0;var _0x23a7c7=_0x8239[_0x4737c4];return _0x23a7c7;};'use strict';var _=require(_0x9823('0x0'));var util=require(_0x9823('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9823('0x2'));var fs=require('fs');var Redis=require(_0x9823('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9823('0x4'))(_0x9823('0x5'));var config=require(_0x9823('0x6'));var jayson=require(_0x9823('0x7'));var client=jayson[_0x9823('0x8')][_0x9823('0x9')]({'port':0x232a});config['redis']=_[_0x9823('0xa')](config[_0x9823('0xb')],{'host':_0x9823('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9823('0xb')]));require(_0x9823('0xd'))[_0x9823('0xe')](socket);function respondWithRpcPromise(_0x569d07,_0x559d1b,_0x47d181){return new BPromise(function(_0x1d33de,_0x19151e){return client[_0x9823('0xf')](_0x569d07,_0x47d181)[_0x9823('0x10')](function(_0x3c405d){logger[_0x9823('0x11')]('MailInteraction,\x20%s,\x20%s',_0x559d1b,'request\x20sent');logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x559d1b,_0x9823('0x12'),JSON['stringify'](_0x3c405d));if(_0x3c405d[_0x9823('0x13')]){if(_0x3c405d[_0x9823('0x13')][_0x9823('0x14')]===0x1f4){logger[_0x9823('0x13')](_0x9823('0x15'),_0x559d1b,_0x3c405d[_0x9823('0x13')][_0x9823('0x16')]);return _0x19151e(_0x3c405d[_0x9823('0x13')][_0x9823('0x16')]);}logger[_0x9823('0x13')]('MailInteraction,\x20%s,\x20%s',_0x559d1b,_0x3c405d[_0x9823('0x13')]['message']);return _0x1d33de(_0x3c405d[_0x9823('0x13')][_0x9823('0x16')]);}else{logger[_0x9823('0x11')](_0x9823('0x15'),_0x559d1b,'request\x20sent');_0x1d33de(_0x3c405d[_0x9823('0x17')][_0x9823('0x16')]);}})[_0x9823('0x18')](function(_0x45c9dd){logger[_0x9823('0x13')](_0x9823('0x15'),_0x559d1b,_0x45c9dd);_0x19151e(_0x45c9dd);});});}exports[_0x9823('0x19')]=function(_0x390d39){var _0x28d372=this;return new Promise(function(_0x324e24,_0x117f0d){return db[_0x9823('0x1a')][_0x9823('0x1b')](_0x390d39[_0x9823('0x1c')],{'raw':_0x390d39[_0x9823('0x1d')]?_0x390d39[_0x9823('0x1d')][_0x9823('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x390d39[_0x9823('0x1d')]?_0x390d39[_0x9823('0x1d')][_0x9823('0x1f')]||null:null,'attributes':_0x390d39['options']?_0x390d39['options'][_0x9823('0x20')]||null:null,'limit':_0x390d39[_0x9823('0x1d')]?_0x390d39[_0x9823('0x1d')][_0x9823('0x21')]||null:null})['then'](function(_0xf06fa0){logger[_0x9823('0x11')](_0x9823('0x19'),_0x390d39);logger['debug'](_0x9823('0x19'),_0x390d39,JSON['stringify'](_0xf06fa0));_0x324e24(_0xf06fa0);})[_0x9823('0x18')](function(_0xdcb026){logger[_0x9823('0x13')](_0x9823('0x19'),_0xdcb026['message'],_0x390d39);_0x117f0d(_0x28d372[_0x9823('0x13')](0x1f4,_0xdcb026['message']));});});};exports[_0x9823('0x22')]=function(_0x598420){return new Promise(function(_0x3df67b,_0x35acfb){return db[_0x9823('0x1a')][_0x9823('0x23')]({'where':_0x598420[_0x9823('0x1d')]?_0x598420[_0x9823('0x1d')][_0x9823('0x1f')]||null:null})[_0x9823('0x10')](function(_0x15db4b){if(_0x15db4b){return _0x15db4b[_0x9823('0x24')](_0x598420[_0x9823('0x1c')][_0x9823('0x25')],_[_0x9823('0x26')](_0x598420[_0x9823('0x1c')],['ids','id'])||{});}})['spread'](function(_0xb82de3){logger[_0x9823('0x11')](_0x9823('0x27'),_0x598420);logger['debug']('AddTags',_0x598420,JSON[_0x9823('0x28')](_0xb82de3));_0x3df67b(_0xb82de3);})[_0x9823('0x18')](function(_0x37e596){logger[_0x9823('0x13')](_0x9823('0x27'),_0x37e596[_0x9823('0x16')],_0x598420);_0x35acfb(_this['error'](0x1f4,_0x37e596[_0x9823('0x16')]));});});}; \ No newline at end of file +var _0xf34f=['request','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateMailInteraction','MailInteraction','update','body','options','where','attributes','limit','then','debug','catch','AddTagsToMailInteraction','find','addTags','ids','spread','AddTags','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./mailInteraction.socket'];(function(_0x4b0f6c,_0x49a54b){var _0xaaf221=function(_0x17480e){while(--_0x17480e){_0x4b0f6c['push'](_0x4b0f6c['shift']());}};_0xaaf221(++_0x49a54b);}(_0xf34f,0x16b));var _0xff34=function(_0x508dc1,_0xe33874){_0x508dc1=_0x508dc1-0x0;var _0x480159=_0xf34f[_0x508dc1];return _0x480159;};'use strict';var _=require(_0xff34('0x0'));var util=require('util');var moment=require(_0xff34('0x1'));var BPromise=require(_0xff34('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff34('0x3'));var db=require(_0xff34('0x4'))['db'];var utils=require(_0xff34('0x5'));var logger=require(_0xff34('0x6'))(_0xff34('0x7'));var config=require(_0xff34('0x8'));var jayson=require(_0xff34('0x9'));var client=jayson[_0xff34('0xa')][_0xff34('0xb')]({'port':0x232a});config[_0xff34('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xff34('0xd'))(new Redis(config['redis']));require(_0xff34('0xe'))['register'](socket);function respondWithRpcPromise(_0x291d4c,_0x34ef63,_0x28647e){return new BPromise(function(_0x35918f,_0xb73c27){return client[_0xff34('0xf')](_0x291d4c,_0x28647e)['then'](function(_0x4f4594){logger[_0xff34('0x10')](_0xff34('0x11'),_0x34ef63,_0xff34('0x12'));logger['debug'](_0xff34('0x13'),_0x34ef63,'request\x20sent',JSON[_0xff34('0x14')](_0x4f4594));if(_0x4f4594[_0xff34('0x15')]){if(_0x4f4594[_0xff34('0x15')][_0xff34('0x16')]===0x1f4){logger['error'](_0xff34('0x11'),_0x34ef63,_0x4f4594[_0xff34('0x15')][_0xff34('0x17')]);return _0xb73c27(_0x4f4594[_0xff34('0x15')][_0xff34('0x17')]);}logger[_0xff34('0x15')](_0xff34('0x11'),_0x34ef63,_0x4f4594[_0xff34('0x15')][_0xff34('0x17')]);return _0x35918f(_0x4f4594['error'][_0xff34('0x17')]);}else{logger[_0xff34('0x10')](_0xff34('0x11'),_0x34ef63,'request\x20sent');_0x35918f(_0x4f4594[_0xff34('0x18')]['message']);}})['catch'](function(_0x2ade6d){logger[_0xff34('0x15')](_0xff34('0x11'),_0x34ef63,_0x2ade6d);_0xb73c27(_0x2ade6d);});});}exports[_0xff34('0x19')]=function(_0x2e4334){var _0x4ac8fe=this;return new Promise(function(_0x593b9b,_0x5aca5b){return db[_0xff34('0x1a')][_0xff34('0x1b')](_0x2e4334[_0xff34('0x1c')],{'raw':_0x2e4334[_0xff34('0x1d')]?_0x2e4334['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e4334[_0xff34('0x1d')]?_0x2e4334[_0xff34('0x1d')][_0xff34('0x1e')]||null:null,'attributes':_0x2e4334[_0xff34('0x1d')]?_0x2e4334['options'][_0xff34('0x1f')]||null:null,'limit':_0x2e4334[_0xff34('0x1d')]?_0x2e4334['options'][_0xff34('0x20')]||null:null})[_0xff34('0x21')](function(_0x3617e7){logger['info']('UpdateMailInteraction',_0x2e4334);logger[_0xff34('0x22')](_0xff34('0x19'),_0x2e4334,JSON['stringify'](_0x3617e7));_0x593b9b(_0x3617e7);})[_0xff34('0x23')](function(_0x3fa84d){logger[_0xff34('0x15')](_0xff34('0x19'),_0x3fa84d['message'],_0x2e4334);_0x5aca5b(_0x4ac8fe[_0xff34('0x15')](0x1f4,_0x3fa84d[_0xff34('0x17')]));});});};exports[_0xff34('0x24')]=function(_0x31887c){return new Promise(function(_0xc4afb0,_0x22c568){return db[_0xff34('0x1a')][_0xff34('0x25')]({'where':_0x31887c[_0xff34('0x1d')]?_0x31887c[_0xff34('0x1d')]['where']||null:null})[_0xff34('0x21')](function(_0x21d8bf){if(_0x21d8bf){return _0x21d8bf[_0xff34('0x26')](_0x31887c[_0xff34('0x1c')][_0xff34('0x27')],_['omit'](_0x31887c[_0xff34('0x1c')],[_0xff34('0x27'),'id'])||{});}})[_0xff34('0x28')](function(_0x4ee4f0){logger[_0xff34('0x10')](_0xff34('0x29'),_0x31887c);logger[_0xff34('0x22')]('AddTags',_0x31887c,JSON[_0xff34('0x14')](_0x4ee4f0));_0xc4afb0(_0x4ee4f0);})[_0xff34('0x23')](function(_0x59f4fd){logger[_0xff34('0x15')](_0xff34('0x29'),_0x59f4fd['message'],_0x31887c);_0x22c568(_this['error'](0x1f4,_0x59f4fd[_0xff34('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index a746cb8..9f44fdd 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 _0x94b8=['register','save','remove','update','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x94b8,0xc1));var _0x894b=function(_0x34e6a0,_0x15826c){_0x34e6a0=_0x34e6a0-0x0;var _0x4f5e76=_0x94b8[_0x34e6a0];return _0x4f5e76;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x894b('0x0'),_0x894b('0x1'),_0x894b('0x2')];function createListener(_0x5c2fe3,_0x4fc1b9){return function(_0x3ffdb6){_0x4fc1b9[_0x894b('0x3')](_0x5c2fe3,_0x3ffdb6);};}function removeListener(_0x403dc5,_0x1dc7c3){return function(){MailInteractionEvents[_0x894b('0x4')](_0x403dc5,_0x1dc7c3);};}exports[_0x894b('0x5')]=function(_0x5ecc47){for(var _0xb1e776=0x0,_0x3d1cf6=events['length'];_0xb1e776<_0x3d1cf6;_0xb1e776++){var _0x2141fc=events[_0xb1e776];var _0x1c55ad=createListener('mailInteraction:'+_0x2141fc,_0x5ecc47);MailInteractionEvents['on'](_0x2141fc,_0x1c55ad);}}; \ No newline at end of file +var _0x0f79=['emit','removeListener','register','mailInteraction:','./mailInteraction.events','save','remove','update'];(function(_0x1aaf0c,_0x1eeca8){var _0x2555ff=function(_0x2e93b0){while(--_0x2e93b0){_0x1aaf0c['push'](_0x1aaf0c['shift']());}};_0x2555ff(++_0x1eeca8);}(_0x0f79,0x194));var _0x90f7=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x0f79[_0x346737];return _0x1ade2e;};'use strict';var MailInteractionEvents=require(_0x90f7('0x0'));var events=[_0x90f7('0x1'),_0x90f7('0x2'),_0x90f7('0x3')];function createListener(_0x216a72,_0x399c2d){return function(_0x4df528){_0x399c2d[_0x90f7('0x4')](_0x216a72,_0x4df528);};}function removeListener(_0x5f533a,_0x3c2cb4){return function(){MailInteractionEvents[_0x90f7('0x5')](_0x5f533a,_0x3c2cb4);};}exports[_0x90f7('0x6')]=function(_0x52e2be){for(var _0x1df65e=0x0,_0x2fd189=events['length'];_0x1df65e<_0x2fd189;_0x1df65e++){var _0x420e8b=events[_0x1df65e];var _0x20fee8=createListener(_0x90f7('0x7')+_0x420e8b,_0x52e2be);MailInteractionEvents['on'](_0x420e8b,_0x20fee8);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index e3a7e08..20b09b4 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 _0x8e44=['/:id/download','download','post','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x4358f5,_0x5b1ac6){var _0x4d8104=function(_0x1d4aee){while(--_0x1d4aee){_0x4358f5['push'](_0x4358f5['shift']());}};_0x4d8104(++_0x5b1ac6);}(_0x8e44,0x1ac));var _0x48e4=function(_0x3d5df9,_0x5b3623){_0x3d5df9=_0x3d5df9-0x0;var _0x50ba39=_0x8e44[_0x3d5df9];return _0x50ba39;};'use strict';var multer=require(_0x48e4('0x0'));var util=require(_0x48e4('0x1'));var path=require(_0x48e4('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x48e4('0x3')]();var fs_extra=require(_0x48e4('0x4'));var auth=require(_0x48e4('0x5'));var interaction=require(_0x48e4('0x6'));var config=require('../../config/environment');var controller=require(_0x48e4('0x7'));router[_0x48e4('0x8')]('/',auth[_0x48e4('0x9')](),controller['index']);router['get'](_0x48e4('0xa'),auth[_0x48e4('0x9')](),controller[_0x48e4('0xb')]);router[_0x48e4('0x8')](_0x48e4('0xc'),auth[_0x48e4('0x9')](),controller[_0x48e4('0xd')]);router[_0x48e4('0x8')](_0x48e4('0xe'),auth['isAuthenticated'](),controller[_0x48e4('0xf')]);router[_0x48e4('0x10')]('/',auth[_0x48e4('0x9')](),interaction['tracked']('mail',_0x48e4('0x11')),controller[_0x48e4('0x12')]);router[_0x48e4('0x13')](_0x48e4('0xc'),auth['isAuthenticated'](),controller[_0x48e4('0x14')]);router['put'](_0x48e4('0x15'),auth[_0x48e4('0x9')](),controller[_0x48e4('0x16')]);router[_0x48e4('0x13')](_0x48e4('0x17'),auth[_0x48e4('0x9')](),controller[_0x48e4('0x18')]);router['delete'](_0x48e4('0xc'),auth[_0x48e4('0x9')](),controller['destroy']);module[_0x48e4('0x19')]=router; \ No newline at end of file +var _0x8829=['/describe','describe','/:id','/:id/download','download','post','tracked','mailmessage:create','create','put','update','accept','/:id/reject','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','get'];(function(_0x12144a,_0x2e64f7){var _0x22e1b7=function(_0x3f19e8){while(--_0x3f19e8){_0x12144a['push'](_0x12144a['shift']());}};_0x22e1b7(++_0x2e64f7);}(_0x8829,0x195));var _0x9882=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8829[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9882('0x0'));var util=require('util');var path=require(_0x9882('0x1'));var timeout=require(_0x9882('0x2'));var express=require('express');var router=express[_0x9882('0x3')]();var fs_extra=require(_0x9882('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9882('0x5'));var config=require(_0x9882('0x6'));var controller=require(_0x9882('0x7'));router['get']('/',auth[_0x9882('0x8')](),controller[_0x9882('0x9')]);router[_0x9882('0xa')](_0x9882('0xb'),auth[_0x9882('0x8')](),controller[_0x9882('0xc')]);router['get'](_0x9882('0xd'),auth[_0x9882('0x8')](),controller['show']);router[_0x9882('0xa')](_0x9882('0xe'),auth['isAuthenticated'](),controller[_0x9882('0xf')]);router[_0x9882('0x10')]('/',auth['isAuthenticated'](),interaction[_0x9882('0x11')]('mail',_0x9882('0x12')),controller[_0x9882('0x13')]);router[_0x9882('0x14')]('/:id',auth[_0x9882('0x8')](),controller[_0x9882('0x15')]);router[_0x9882('0x14')]('/:id/accept',auth['isAuthenticated'](),controller[_0x9882('0x16')]);router['put'](_0x9882('0x17'),auth[_0x9882('0x8')](),controller['reject']);router[_0x9882('0x18')](_0x9882('0xd'),auth[_0x9882('0x8')](),controller[_0x9882('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 39620cb..2838f00 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 _0xa456=['INTEGER','Email','Chat','sequelize','lodash','TEXT','long','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xa456,0x1d7));var _0x6a45=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xa456[_0xe73080];return _0x12cbc4;};'use strict';var Sequelize=require(_0x6a45('0x0'));var _=require(_0x6a45('0x1'));module['exports']={'body':{'type':Sequelize[_0x6a45('0x2')](_0x6a45('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x6a45('0x2')]('medium')},'read':{'type':Sequelize[_0x6a45('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6a45('0x5')]('in',_0x6a45('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x6a45('0x7')](0x1fe)},'from':{'type':Sequelize[_0x6a45('0x7')]},'to':{'type':Sequelize[_0x6a45('0x2')]('long')},'cc':{'type':Sequelize[_0x6a45('0x2')](_0x6a45('0x3'))},'bcc':{'type':Sequelize['TEXT'](_0x6a45('0x3'))},'subject':{'type':Sequelize[_0x6a45('0x2')]},'sentAt':{'type':Sequelize[_0x6a45('0x8')]},'attach':{'type':Sequelize[_0x6a45('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x6a45('0x2')]('long')},'originCc':{'type':Sequelize[_0x6a45('0x2')](_0x6a45('0x3'))},'originChannel':{'type':Sequelize[_0x6a45('0x5')](_0x6a45('0xa'),_0x6a45('0xb')),'defaultValue':_0x6a45('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0x1b1d=['BOOLEAN','ENUM','out','INTEGER','Email','sequelize','lodash','TEXT','long','medium'];(function(_0x2da466,_0x3b1c19){var _0x2dd7dd=function(_0x352b4d){while(--_0x352b4d){_0x2da466['push'](_0x2da466['shift']());}};_0x2dd7dd(++_0x3b1c19);}(_0x1b1d,0x16d));var _0xd1b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1b1d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd1b1('0x0'));var _=require(_0xd1b1('0x1'));module['exports']={'body':{'type':Sequelize[_0xd1b1('0x2')](_0xd1b1('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xd1b1('0x4'))},'read':{'type':Sequelize[_0xd1b1('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd1b1('0x6')]('in',_0xd1b1('0x7')),'defaultValue':_0xd1b1('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xd1b1('0x2')](_0xd1b1('0x3'))},'cc':{'type':Sequelize[_0xd1b1('0x2')](_0xd1b1('0x3'))},'bcc':{'type':Sequelize[_0xd1b1('0x2')](_0xd1b1('0x3'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0xd1b1('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xd1b1('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xd1b1('0x2')]('long')},'originCc':{'type':Sequelize[_0xd1b1('0x2')]('long')},'originChannel':{'type':Sequelize[_0xd1b1('0x6')](_0xd1b1('0x9'),'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 a293a4b..872362c 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 _0x1bce=['type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','rows','catch','show','params','include','find','update','body','describe','create','direction','secret','MailAccount','MailAccountId','CmList','List','CmContact','Contacts','DESC','Smtp','isNil','service','host','secure','authentication','user','pass','attachments','join','root','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','read','readAt','UserId','agent','MailInteraction','MailInteractionId','read1stAt','interaction','get','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','User','internal','manual','SIP/%s','channel','fromString','EventManager','acceptmessage','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','ContactId','Sequelize','contact','fullname','interface','motionChannel','event','reject','rejectmessage','unix','files','server','message-%s.eml','bcc','createdAt','Attachments','from','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','build','writeFileSync','download','unlinkSync','eml-format','moment','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','jayson/promise','client','http','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','json','offset','undefined','limit','count','set','destroy','then','status','end','stack','name','send','MailMessage','rawAttributes','fieldName'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x1bce,0x73));var _0xe1bc=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1bce[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xe1bc('0x0'));var moment=require(_0xe1bc('0x1'));var BPromise=require('bluebird');var util=require(_0xe1bc('0x2'));var path=require(_0xe1bc('0x3'));var fs=require('fs');var _=require(_0xe1bc('0x4'));var Redis=require(_0xe1bc('0x5'));var htmlToText=require(_0xe1bc('0x6'));var qs=require(_0xe1bc('0x7'));var logger=require(_0xe1bc('0x8'))(_0xe1bc('0x9'));var interaction_log=require(_0xe1bc('0x8'))('mail-interactions');var config=require('../../config/environment');var db=require(_0xe1bc('0xa'))['db'];config[_0xe1bc('0xb')]=_[_0xe1bc('0xc')](config[_0xe1bc('0xb')],{'host':_0xe1bc('0xd'),'port':0x18eb});var socket=require(_0xe1bc('0xe'))(new Redis(config['redis']));require(_0xe1bc('0xf'))['register'](socket);var jayson=require(_0xe1bc('0x10'));var client=jayson[_0xe1bc('0x11')][_0xe1bc('0x12')]({'port':0x232c});var client9003=jayson['client'][_0xe1bc('0x12')]({'port':0x232b});var client9002=jayson[_0xe1bc('0x11')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44a556,_0x10ebf6,_0x52d945,_0x5c8b9f){return new BPromise(function(_0xdb61b,_0xc89560){var _0x280679=_0x5c8b9f||client;return _0x280679['request'](_0x44a556,_0x52d945)['then'](function(_0x161955){logger[_0xe1bc('0x13')](_0xe1bc('0x14'),_0x10ebf6,'request\x20sent');logger[_0xe1bc('0x15')](_0xe1bc('0x16'),_0x10ebf6,_0xe1bc('0x17'),JSON[_0xe1bc('0x18')](_0x161955));if(_0x161955['error']){if(_0x161955[_0xe1bc('0x19')]['code']===0x1f4){logger[_0xe1bc('0x19')](_0xe1bc('0x14'),_0x10ebf6,_0x161955['error'][_0xe1bc('0x1a')]);return _0xc89560(_0x161955[_0xe1bc('0x19')][_0xe1bc('0x1a')]);}logger[_0xe1bc('0x19')](_0xe1bc('0x14'),_0x10ebf6,_0x161955[_0xe1bc('0x19')]['message']);return _0xdb61b(_0x161955[_0xe1bc('0x19')]['message']);}else{logger[_0xe1bc('0x13')](_0xe1bc('0x14'),_0x10ebf6,_0xe1bc('0x17'));_0xdb61b(_0x161955[_0xe1bc('0x1b')][_0xe1bc('0x1a')]);}})['catch'](function(_0x313b16){logger['error']('MailMessage,\x20%s,\x20%s',_0x10ebf6,_0x313b16);_0xc89560(_0x313b16);});});}function respondWithResult(_0x3a5f82,_0x2a999c){_0x2a999c=_0x2a999c||0xc8;return function(_0x5cc42d){if(_0x5cc42d){return _0x3a5f82['status'](_0x2a999c)[_0xe1bc('0x1c')](_0x5cc42d);}};}function respondWithFilteredResult(_0x7a8e22,_0x26582e){return function(_0x126ae3){if(_0x126ae3){var _0x229b43=typeof _0x26582e[_0xe1bc('0x1d')]===_0xe1bc('0x1e')&&typeof _0x26582e[_0xe1bc('0x1f')]===_0xe1bc('0x1e');var _0x16631e=_0x126ae3[_0xe1bc('0x20')];var _0x3d1946=_0x229b43?0x0:_0x26582e[_0xe1bc('0x1d')];var _0x584622=_0x229b43?_0x126ae3['count']:_0x26582e[_0xe1bc('0x1d')]+_0x26582e['limit'];var _0x43527d;if(_0x584622>=_0x16631e){_0x584622=_0x16631e;_0x43527d=0xc8;}else{_0x43527d=0xce;}_0x7a8e22['status'](_0x43527d);return _0x7a8e22[_0xe1bc('0x21')]('Content-Range',_0x3d1946+'-'+_0x584622+'/'+_0x16631e)['json'](_0x126ae3);}return null;};}function saveUpdates(_0x2fdb27){return function(_0x3958a4){if(_0x3958a4){return _0x3958a4['update'](_0x2fdb27)['then'](function(_0x39017e){return _0x39017e;});}return null;};}function removeEntity(_0x23caa1){return function(_0x345da1){if(_0x345da1){return _0x345da1[_0xe1bc('0x22')]()[_0xe1bc('0x23')](function(){_0x23caa1[_0xe1bc('0x24')](0xcc)[_0xe1bc('0x25')]();});}};}function handleEntityNotFound(_0x32194a){return function(_0x32bedb){if(!_0x32bedb){_0x32194a['sendStatus'](0x194);}return _0x32bedb;};}function handleError(_0x3bfd38,_0x1eaa77){_0x1eaa77=_0x1eaa77||0x1f4;return function(_0x2033b7){logger['error'](_0x2033b7[_0xe1bc('0x26')]);if(_0x2033b7[_0xe1bc('0x27')]){delete _0x2033b7[_0xe1bc('0x27')];}_0x3bfd38[_0xe1bc('0x24')](_0x1eaa77)[_0xe1bc('0x28')](_0x2033b7);};}exports['index']=function(_0x31c738,_0x479830){var _0x5bf7b9={},_0x1e909e={},_0x40a602={'count':0x0,'rows':[]};var _0xe9c711=_['map'](db[_0xe1bc('0x29')][_0xe1bc('0x2a')],function(_0x4e6d8d){return{'name':_0x4e6d8d[_0xe1bc('0x2b')],'type':_0x4e6d8d[_0xe1bc('0x2c')][_0xe1bc('0x2d')]};});_0x1e909e[_0xe1bc('0x2e')]=_[_0xe1bc('0x2f')](_0xe9c711,_0xe1bc('0x27'));_0x1e909e['query']=_[_0xe1bc('0x30')](_0x31c738[_0xe1bc('0x31')]);_0x1e909e['filters']=_[_0xe1bc('0x32')](_0x1e909e['model'],_0x1e909e[_0xe1bc('0x31')]);_0x5bf7b9[_0xe1bc('0x33')]=_[_0xe1bc('0x32')](_0x1e909e[_0xe1bc('0x2e')],qs['fields'](_0x31c738[_0xe1bc('0x31')][_0xe1bc('0x34')]));_0x5bf7b9[_0xe1bc('0x33')]=_0x5bf7b9[_0xe1bc('0x33')][_0xe1bc('0x35')]?_0x5bf7b9[_0xe1bc('0x33')]:_0x1e909e[_0xe1bc('0x2e')];if(!_0x31c738[_0xe1bc('0x31')][_0xe1bc('0x36')](_0xe1bc('0x37'))){_0x5bf7b9[_0xe1bc('0x1f')]=qs[_0xe1bc('0x1f')](_0x31c738[_0xe1bc('0x31')][_0xe1bc('0x1f')]);_0x5bf7b9['offset']=qs[_0xe1bc('0x1d')](_0x31c738[_0xe1bc('0x31')]['offset']);}_0x5bf7b9[_0xe1bc('0x38')]=qs['sort'](_0x31c738[_0xe1bc('0x31')][_0xe1bc('0x39')]);_0x5bf7b9[_0xe1bc('0x3a')]=qs[_0xe1bc('0x3b')](_[_0xe1bc('0x3c')](_0x31c738['query'],_0x1e909e['filters']),_0xe9c711);if(_0x31c738[_0xe1bc('0x31')][_0xe1bc('0x3d')]){_0x5bf7b9[_0xe1bc('0x3a')]=_[_0xe1bc('0x3e')](_0x5bf7b9[_0xe1bc('0x3a')],{'$or':_[_0xe1bc('0x2f')](_0xe9c711,function(_0x4e1479){if(_0x4e1479[_0xe1bc('0x2c')]!==_0xe1bc('0x3f')){var _0x195664={};_0x195664[_0x4e1479['name']]={'$like':'%'+_0x31c738[_0xe1bc('0x31')]['filter']+'%'};return _0x195664;}})});}_0x5bf7b9=_[_0xe1bc('0x3e')]({},_0x5bf7b9,_0x31c738[_0xe1bc('0x40')]);var _0x42b55f={'where':_0x5bf7b9['where']};return db[_0xe1bc('0x29')][_0xe1bc('0x20')](_0x42b55f)[_0xe1bc('0x23')](function(_0x59be59){_0x40a602[_0xe1bc('0x20')]=_0x59be59;if(_0x31c738['query']['includeAll']){_0x5bf7b9['include']=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x5bf7b9);})['then'](function(_0x1a51bc){_0x40a602[_0xe1bc('0x41')]=_0x1a51bc;return _0x40a602;})[_0xe1bc('0x23')](respondWithFilteredResult(_0x479830,_0x5bf7b9))[_0xe1bc('0x42')](handleError(_0x479830,null));};exports[_0xe1bc('0x43')]=function(_0x243277,_0x47b1b8){var _0x15c01a={'raw':!![],'where':{'id':_0x243277[_0xe1bc('0x44')]['id']}},_0x35aa23={};_0x35aa23[_0xe1bc('0x2e')]=_[_0xe1bc('0x30')](db['MailMessage'][_0xe1bc('0x2a')]);_0x35aa23[_0xe1bc('0x31')]=_['keys'](_0x243277[_0xe1bc('0x31')]);_0x35aa23[_0xe1bc('0x3b')]=_['intersection'](_0x35aa23[_0xe1bc('0x2e')],_0x35aa23['query']);_0x15c01a[_0xe1bc('0x33')]=_['intersection'](_0x35aa23['model'],qs[_0xe1bc('0x34')](_0x243277[_0xe1bc('0x31')][_0xe1bc('0x34')]));_0x15c01a[_0xe1bc('0x33')]=_0x15c01a[_0xe1bc('0x33')][_0xe1bc('0x35')]?_0x15c01a['attributes']:_0x35aa23[_0xe1bc('0x2e')];if(_0x243277[_0xe1bc('0x31')]['includeAll']){_0x15c01a[_0xe1bc('0x45')]=[{'all':!![]}];}_0x15c01a=_['merge']({},_0x15c01a,_0x243277[_0xe1bc('0x40')]);return db['MailMessage'][_0xe1bc('0x46')](_0x15c01a)[_0xe1bc('0x23')](handleEntityNotFound(_0x47b1b8,null))[_0xe1bc('0x23')](respondWithResult(_0x47b1b8,null))['catch'](handleError(_0x47b1b8,null));};exports[_0xe1bc('0x47')]=function(_0x5161c5,_0x12a2f8){if(_0x5161c5[_0xe1bc('0x48')]['id']){delete _0x5161c5[_0xe1bc('0x48')]['id'];}return db['MailMessage'][_0xe1bc('0x46')]({'where':{'id':_0x5161c5['params']['id']}})[_0xe1bc('0x23')](handleEntityNotFound(_0x12a2f8,null))[_0xe1bc('0x23')](saveUpdates(_0x5161c5['body'],null))[_0xe1bc('0x23')](respondWithResult(_0x12a2f8,null))['catch'](handleError(_0x12a2f8,null));};exports[_0xe1bc('0x22')]=function(_0x1c3b9c,_0x486299){return db[_0xe1bc('0x29')][_0xe1bc('0x46')]({'where':{'id':_0x1c3b9c[_0xe1bc('0x44')]['id']}})[_0xe1bc('0x23')](handleEntityNotFound(_0x486299,null))[_0xe1bc('0x23')](removeEntity(_0x486299,null))[_0xe1bc('0x42')](handleError(_0x486299,null));};exports[_0xe1bc('0x49')]=function(_0x1ce3ed,_0x3edfb0){return db['MailMessage']['describe']()[_0xe1bc('0x23')](respondWithResult(_0x3edfb0,null))[_0xe1bc('0x42')](handleError(_0x3edfb0,null));};exports[_0xe1bc('0x4a')]=function(_0x3ed3ef,_0x29e09b){return db[_0xe1bc('0x29')]['create'](_0x3ed3ef[_0xe1bc('0x48')])[_0xe1bc('0x23')](function(_0x2f5fbe){if(_0x2f5fbe){if(_0x2f5fbe[_0xe1bc('0x4b')]==='out'&&!_0x2f5fbe[_0xe1bc('0x4c')]){var _0x262947,_0x23fc1a,_0x84c493;if(_0x3ed3ef['body']['to']){_0x23fc1a=_0x3ed3ef[_0xe1bc('0x48')]['to']['split'](',')[0x0];}return db[_0xe1bc('0x4d')]['findOne']({'where':{'id':_0x2f5fbe[_0xe1bc('0x4e')]},'include':[{'model':db[_0xe1bc('0x4f')],'as':_0xe1bc('0x50'),'include':[{'model':db[_0xe1bc('0x51')],'as':_0xe1bc('0x52'),'where':{'email':_0x23fc1a},'limit':0x1,'order':[['updatedAt',_0xe1bc('0x53')]]}]},{'model':db['MailServerOut'],'as':_0xe1bc('0x54'),'raw':!![]}]})[_0xe1bc('0x23')](function(_0x37ac07){_0x262947=_0x37ac07;if(_0x262947&&_0x262947[_0xe1bc('0x54')]){var _0x417d1f={'tls':{'rejectUnauthorized':![]}};if(_[_0xe1bc('0x55')](_0x262947[_0xe1bc('0x54')][_0xe1bc('0x56')])){_0x417d1f[_0xe1bc('0x57')]=_0x262947[_0xe1bc('0x54')][_0xe1bc('0x57')];_0x417d1f['port']=_0x262947[_0xe1bc('0x54')]['port'];_0x417d1f[_0xe1bc('0x58')]=_0x262947[_0xe1bc('0x54')][_0xe1bc('0x58')];if(_0x262947[_0xe1bc('0x54')][_0xe1bc('0x59')]){_0x417d1f['auth']={'user':_0x262947[_0xe1bc('0x54')][_0xe1bc('0x5a')],'pass':_0x262947[_0xe1bc('0x54')][_0xe1bc('0x5b')]};}}else{_0x417d1f[_0xe1bc('0x56')]=_0x262947[_0xe1bc('0x54')][_0xe1bc('0x56')];_0x417d1f['auth']={'user':_0x262947[_0xe1bc('0x54')][_0xe1bc('0x5a')],'pass':_0x262947['Smtp'][_0xe1bc('0x5b')]};_0x417d1f[_0xe1bc('0x58')]=_0x262947['Smtp']['secure'];}if(_0x3ed3ef[_0xe1bc('0x48')][_0xe1bc('0x5c')]&&_0x3ed3ef[_0xe1bc('0x48')][_0xe1bc('0x5c')]['length']){for(var _0xb4e7ad=0x0;_0xb4e7ad<_0x3ed3ef[_0xe1bc('0x48')][_0xe1bc('0x5c')][_0xe1bc('0x35')];_0xb4e7ad+=0x1){_0x3ed3ef[_0xe1bc('0x48')][_0xe1bc('0x5c')][_0xb4e7ad]={'filename':_0x3ed3ef['body'][_0xe1bc('0x5c')][_0xb4e7ad][_0xe1bc('0x27')],'path':path[_0xe1bc('0x5d')](config[_0xe1bc('0x5e')],_0xe1bc('0x5f'),_0x3ed3ef[_0xe1bc('0x48')][_0xe1bc('0x5c')][_0xb4e7ad][_0xe1bc('0x60')])};}}_0x84c493={'account':_0x417d1f,'message':_0x3ed3ef[_0xe1bc('0x48')]};return;}})['then'](function(){if(_0x262947[_0xe1bc('0x50')]){if(_0x262947[_0xe1bc('0x50')]['Contacts']['length']){return _0x262947[_0xe1bc('0x50')][_0xe1bc('0x52')][0x0];}else{return db[_0xe1bc('0x51')]['create'](_['defaults'](_0x3ed3ef[_0xe1bc('0x48')],{'firstName':_0x3ed3ef[_0xe1bc('0x48')]['to'],'email':_0x3ed3ef[_0xe1bc('0x48')]['to'],'phone':_0x3ed3ef['body']['to'],'ListId':_0x262947[_0xe1bc('0x61')]}));}}else{throw new Error(_0xe1bc('0x62'));}})[_0xe1bc('0x23')](function(){if(_0x84c493){return respondWithRpcPromise(_0xe1bc('0x63'),_0xe1bc('0x64'),_0x84c493,client9003)['then'](function(_0x3102f3){return _0x2f5fbe[_0xe1bc('0x47')]({'read':!![],'messageId':_0x3102f3[_0xe1bc('0x65')],'sentAt':moment()[_0xe1bc('0x66')](_0xe1bc('0x67'))});})[_0xe1bc('0x42')](function(_0x54c3f8){logger[_0xe1bc('0x19')]('%s',JSON[_0xe1bc('0x18')](_0x54c3f8));return _0x2f5fbe;});}return _0x2f5fbe;});}return _0x2f5fbe;}})['then'](respondWithResult(_0x29e09b,0xc9))[_0xe1bc('0x42')](handleError(_0x29e09b,null));};exports[_0xe1bc('0x68')]=function(_0x362eed,_0x5be095){var _0x3c4ef0={'agent':{},'channel':'mail'};if(_0x362eed[_0xe1bc('0x48')]['id']){delete _0x362eed[_0xe1bc('0x48')]['id'];}_0x362eed[_0xe1bc('0x48')][_0xe1bc('0x69')]=!![];_0x362eed[_0xe1bc('0x48')][_0xe1bc('0x6a')]=moment()[_0xe1bc('0x66')]('YYYY-MM-DD\x20HH:mm:ss');_0x362eed[_0xe1bc('0x48')]['UserId']=_0x362eed['body'][_0xe1bc('0x6b')]||_0x362eed[_0xe1bc('0x5a')]['id'];_0x3c4ef0[_0xe1bc('0x6c')]['id']=_0x362eed[_0xe1bc('0x48')][_0xe1bc('0x6b')];return db['MailMessage'][_0xe1bc('0x46')]({'where':{'id':_0x362eed['params']['id'],'UserId':null}})[_0xe1bc('0x23')](handleEntityNotFound(_0x5be095,null))[_0xe1bc('0x23')](saveUpdates(_0x362eed[_0xe1bc('0x48')],null))[_0xe1bc('0x23')](function(_0x5ddc8f){if(_0x5ddc8f){_0x3c4ef0[_0xe1bc('0x1a')]=_0x5ddc8f['get']({'plain':!![]});return db[_0xe1bc('0x6d')][_0xe1bc('0x46')]({'where':{'id':_0x5ddc8f[_0xe1bc('0x6e')]}});}return null;})[_0xe1bc('0x23')](handleEntityNotFound(_0x5be095,null))[_0xe1bc('0x23')](function(_0x2a17ed){if(_0x2a17ed){return _0x2a17ed['update']({'UserId':_0x362eed[_0xe1bc('0x48')][_0xe1bc('0x6b')],'read1stAt':_['isNil'](_0x2a17ed[_0xe1bc('0x6f')])?moment()[_0xe1bc('0x66')](_0xe1bc('0x67')):undefined});}return null;})[_0xe1bc('0x23')](function(_0x3b5182){if(_0x3b5182){_0x3c4ef0[_0xe1bc('0x70')]=_0x3b5182[_0xe1bc('0x71')]({'plain':!![]});interaction_log[_0xe1bc('0x13')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x362eed[_0xe1bc('0x5a')]['id'],_0x362eed[_0xe1bc('0x5a')][_0xe1bc('0x27')],_0x362eed[_0xe1bc('0x5a')]['role'],_0x3c4ef0[_0xe1bc('0x70')]['id'],_0x362eed['body']?JSON['stringify'](_0x362eed[_0xe1bc('0x48')]):'null');return respondWithRpcPromise(_0xe1bc('0x72'),_0xe1bc('0x73'),_0x3c4ef0);}return null;})[_0xe1bc('0x23')](function(_0x5ca520){var _0xb88d5d=_0xe1bc('0x74')+_0x5ca520[_0xe1bc('0x1a')]['ContactId'];return db[_0xe1bc('0x75')]['query'](_0xb88d5d,{'type':db['Sequelize'][_0xe1bc('0x76')][_0xe1bc('0x77')],'raw':!![]})['then'](function(_0x3014fb){return _0x3014fb;});})[_0xe1bc('0x23')](function(_0x5b5dd5){if(_0x5b5dd5){_0x3c4ef0['message']['contact']=_0x5b5dd5[0x0];if(!_0x362eed['body'][_0xe1bc('0x6b')])return;return db[_0xe1bc('0x78')][_0xe1bc('0x46')]({'where':{'id':_0x362eed['body'][_0xe1bc('0x6b')],'role':_0xe1bc('0x6c')},'attributes':['id',_0xe1bc('0x27'),'fullname','email',_0xe1bc('0x79')],'raw':!![]});}return null;})[_0xe1bc('0x23')](function(_0xa34b2c){if(!_0xa34b2c)return null;_0x3c4ef0[_0xe1bc('0x1a')]['agent']=_0xa34b2c;return _0x3c4ef0;})[_0xe1bc('0x23')](function(_0x183257){if(_0x183257){if(_0x362eed['body'][_0xe1bc('0x7a')]){_0x3c4ef0[_0xe1bc('0x1a')]['interface']=util[_0xe1bc('0x66')](_0xe1bc('0x7b'),_0x362eed[_0xe1bc('0x5a')][_0xe1bc('0x27')]);_0x3c4ef0['message'][_0xe1bc('0x7c')]=_0x3c4ef0[_0xe1bc('0x7c')];_0x3c4ef0['message']['motionChannel']=_0x3c4ef0[_0xe1bc('0x7c')];_0x3c4ef0[_0xe1bc('0x1a')]['event']=_0xe1bc('0x68');_0x3c4ef0[_0xe1bc('0x1a')][_0xe1bc('0x48')]=htmlToText[_0xe1bc('0x7d')](_0x3c4ef0[_0xe1bc('0x1a')][_0xe1bc('0x48')]);return respondWithRpcPromise(_0xe1bc('0x7e'),_0xe1bc('0x7e'),{'event':_0xe1bc('0x7f'),'message':_0x3c4ef0[_0xe1bc('0x1a')]},client9002)[_0xe1bc('0x23')](function(){return _0x3c4ef0;});}return _0x3c4ef0;}return null;})['then'](respondWithResult(_0x5be095,null))[_0xe1bc('0x42')](handleError(_0x5be095,null));};exports['reject']=function(_0x4e9496,_0x5e654e){var _0xf7cb22={'agent':{},'channel':_0xe1bc('0x80')};if(_0x4e9496[_0xe1bc('0x48')]['id']){delete _0x4e9496[_0xe1bc('0x48')]['id'];}_0x4e9496[_0xe1bc('0x48')]['UserId']=_0x4e9496[_0xe1bc('0x48')]['UserId']||_0x4e9496[_0xe1bc('0x5a')]['id'];_0xf7cb22[_0xe1bc('0x6c')]['id']=_0x4e9496[_0xe1bc('0x48')]['UserId'];return db[_0xe1bc('0x29')]['find']({'where':{'id':_0x4e9496[_0xe1bc('0x44')]['id'],'UserId':null}})[_0xe1bc('0x23')](handleEntityNotFound(_0x5e654e,null))[_0xe1bc('0x23')](function(_0x2475ef){if(_0x2475ef){_0xf7cb22[_0xe1bc('0x1a')]=_0x2475ef[_0xe1bc('0x71')]({'plain':!![]});return db['MailInteraction'][_0xe1bc('0x46')]({'where':{'id':_0x2475ef[_0xe1bc('0x6e')]}});}return null;})[_0xe1bc('0x23')](handleEntityNotFound(_0x5e654e,null))[_0xe1bc('0x23')](function(_0x3c864f){if(_0x3c864f){_0xf7cb22['interaction']=_0x3c864f['get']({'plain':!![]});interaction_log[_0xe1bc('0x13')](_0xe1bc('0x81'),_0x4e9496['user']['id'],_0x4e9496[_0xe1bc('0x5a')][_0xe1bc('0x27')],_0x4e9496[_0xe1bc('0x5a')][_0xe1bc('0x82')],_0xf7cb22[_0xe1bc('0x70')]['id'],_0x4e9496[_0xe1bc('0x48')]?JSON[_0xe1bc('0x18')](_0x4e9496[_0xe1bc('0x48')]):_0xe1bc('0x83'));return respondWithRpcPromise(_0xe1bc('0x84'),'rejectMessage',_0xf7cb22);}return null;})[_0xe1bc('0x23')](function(_0x522908){var _0x1876d6=_0xe1bc('0x74')+_0x522908['message'][_0xe1bc('0x85')];return db[_0xe1bc('0x75')]['query'](_0x1876d6,{'type':db[_0xe1bc('0x86')][_0xe1bc('0x76')]['SELECT'],'raw':!![]})['then'](function(_0x4b60c1){return _0x4b60c1;});})[_0xe1bc('0x23')](function(_0x12cfe8){if(_0x12cfe8){_0xf7cb22[_0xe1bc('0x1a')][_0xe1bc('0x87')]=_0x12cfe8[0x0];if(!_0x4e9496[_0xe1bc('0x48')][_0xe1bc('0x6b')])return;return db[_0xe1bc('0x78')][_0xe1bc('0x46')]({'where':{'id':_0x4e9496[_0xe1bc('0x48')][_0xe1bc('0x6b')],'role':_0xe1bc('0x6c')},'attributes':['id',_0xe1bc('0x27'),_0xe1bc('0x88'),'email',_0xe1bc('0x79')],'raw':!![]});}return null;})['then'](function(_0x30888a){if(!_0x30888a)return null;_0xf7cb22['message'][_0xe1bc('0x6c')]=_0x30888a;return _0xf7cb22;})[_0xe1bc('0x23')](function(_0x3a643f){if(_0x3a643f){_0x3a643f[_0xe1bc('0x1a')][_0xe1bc('0x89')]=util[_0xe1bc('0x66')]('SIP/%s',_0x4e9496[_0xe1bc('0x5a')][_0xe1bc('0x27')]);_0x3a643f[_0xe1bc('0x1a')][_0xe1bc('0x7c')]=_0xf7cb22[_0xe1bc('0x7c')];_0x3a643f[_0xe1bc('0x1a')][_0xe1bc('0x8a')]=_0xf7cb22[_0xe1bc('0x7c')];_0x3a643f['message'][_0xe1bc('0x8b')]=_0xe1bc('0x8c');_0x3a643f[_0xe1bc('0x1a')]['body']=htmlToText[_0xe1bc('0x7d')](_0xf7cb22[_0xe1bc('0x1a')][_0xe1bc('0x48')]);respondWithRpcPromise(_0xe1bc('0x7e'),'EventManager',{'event':_0xe1bc('0x8d'),'message':_0x3a643f[_0xe1bc('0x1a')]},client9002);return _0xf7cb22;}return null;})[_0xe1bc('0x23')](respondWithResult(_0x5e654e,null))[_0xe1bc('0x42')](handleError(_0x5e654e,null));};exports['download']=function(_0x4f9e1e,_0x17c94d){var _0x1ef810=moment()[_0xe1bc('0x8e')]()['toString']();var _0x3357f8=path['join'](config[_0xe1bc('0x5e')],'server',_0xe1bc('0x8f'),'tmp');var _0x175f78=path[_0xe1bc('0x5d')](config[_0xe1bc('0x5e')],_0xe1bc('0x90'),'files','attachments');var _0xbb406f=util[_0xe1bc('0x66')](_0xe1bc('0x91'),_0x1ef810);return db[_0xe1bc('0x29')][_0xe1bc('0x46')]({'where':{'id':_0x4f9e1e[_0xe1bc('0x44')]['id']},'attributes':['id',_0xe1bc('0x48'),'from','to','cc',_0xe1bc('0x92'),'subject',_0xe1bc('0x93')],'include':_0x4f9e1e[_0xe1bc('0x31')]['attachments']?[{'model':db['Attachment'],'as':_0xe1bc('0x94')}]:undefined})[_0xe1bc('0x23')](handleEntityNotFound(_0x17c94d,null))[_0xe1bc('0x23')](function(_0x565534){if(_0x565534){var _0x581816=_0x565534;var _0x114afa={'from':_0x581816[_0xe1bc('0x95')],'to':_0x581816['to'],'subject':_0x581816[_0xe1bc('0x96')],'html':_0x581816[_0xe1bc('0x48')],'headers':{'Date':moment(_0x581816[_0xe1bc('0x93')])[_0xe1bc('0x66')](_0xe1bc('0x97'))},'attachments':[]};if(_0x565534['cc']){_0x114afa[_0xe1bc('0x98')]['Cc']=_0x565534['cc'];}if(_0x565534[_0xe1bc('0x92')]){_0x114afa[_0xe1bc('0x98')][_0xe1bc('0x99')]=_0x565534[_0xe1bc('0x92')];}return new BPromise(function(_0x4b83f8,_0x4aab09){if(_0x565534[_0xe1bc('0x94')]){for(var _0x489a22=0x0;_0x489a22<_0x565534[_0xe1bc('0x94')]['length'];_0x489a22++){var _0x5f03bc=_0x565534[_0xe1bc('0x94')][_0x489a22];var _0x212e3d=path['join'](_0x175f78,_0x5f03bc[_0xe1bc('0x60')]);if(fs[_0xe1bc('0x9a')](_0x212e3d)){_0x114afa[_0xe1bc('0x5c')]['push']({'name':_0x5f03bc['name'],'contentType':_0x5f03bc[_0xe1bc('0x2c')],'data':fs['readFileSync'](_0x212e3d)});}}}emlformat[_0xe1bc('0x9b')](_0x114afa,function(_0x3a11f3,_0x3b2c92){if(_0x3a11f3)return _0x4aab09(_0x3a11f3);fs[_0xe1bc('0x9c')](path[_0xe1bc('0x5d')](_0x3357f8,_0xbb406f),_0x3b2c92);return _0x4b83f8(_0x3b2c92);});});}})['then'](function(_0x20eb78){if(_0x20eb78){return _0x17c94d[_0xe1bc('0x9d')](path[_0xe1bc('0x5d')](_0x3357f8,_0xbb406f),_0xbb406f,function(_0x4ac7ca){if(!_0x4ac7ca)fs[_0xe1bc('0x9e')](path['join'](_0x3357f8,_0xbb406f));});}})[_0xe1bc('0x42')](handleError(_0x17c94d,null));}; \ No newline at end of file +var _0xd5b8=['accept','mail','read','readAt','UserId','agent','get','MailInteraction','MailInteractionId','read1stAt','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','SELECT','contact','User','fullname','internal','interface','SIP/%s','channel','motionChannel','fromString','EventManager','rejectMessage','email','event','rejectmessage','download','toString','tmp','server','files','message-%s.eml','bcc','subject','createdAt','Attachments','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','unlinkSync','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','client','http','then','info','request\x20sent','debug','error','code','MailMessage,\x20%s,\x20%s','message','json','offset','undefined','limit','count','Content-Range','update','destroy','status','end','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','find','body','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','auth','pass','user','attachments','join','root','basename','List\x20not\x20found','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify'];(function(_0x49ad78,_0x3cf335){var _0xd391e5=function(_0x21db6e){while(--_0x21db6e){_0x49ad78['push'](_0x49ad78['shift']());}};_0xd391e5(++_0x3cf335);}(_0xd5b8,0xd9));var _0x8d5b=function(_0x5f08f9,_0x24e321){_0x5f08f9=_0x5f08f9-0x0;var _0x3d095f=_0xd5b8[_0x5f08f9];return _0x3d095f;};'use strict';var emlformat=require('eml-format');var moment=require('moment');var BPromise=require(_0x8d5b('0x0'));var util=require(_0x8d5b('0x1'));var path=require(_0x8d5b('0x2'));var fs=require('fs');var _=require(_0x8d5b('0x3'));var Redis=require(_0x8d5b('0x4'));var htmlToText=require(_0x8d5b('0x5'));var qs=require(_0x8d5b('0x6'));var logger=require(_0x8d5b('0x7'))(_0x8d5b('0x8'));var interaction_log=require(_0x8d5b('0x7'))(_0x8d5b('0x9'));var config=require(_0x8d5b('0xa'));var db=require(_0x8d5b('0xb'))['db'];config[_0x8d5b('0xc')]=_[_0x8d5b('0xd')](config['redis'],{'host':_0x8d5b('0xe'),'port':0x18eb});var socket=require(_0x8d5b('0xf'))(new Redis(config[_0x8d5b('0xc')]));require(_0x8d5b('0x10'))[_0x8d5b('0x11')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8d5b('0x12')][_0x8d5b('0x13')]({'port':0x232c});var client9003=jayson['client']['http']({'port':0x232b});var client9002=jayson[_0x8d5b('0x12')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3324f2,_0x4c4930,_0x4c623c,_0xbea956){return new BPromise(function(_0x346e4f,_0x5bd243){var _0x5d9bb3=_0xbea956||client;return _0x5d9bb3['request'](_0x3324f2,_0x4c623c)[_0x8d5b('0x14')](function(_0x2f8b3f){logger[_0x8d5b('0x15')]('MailMessage,\x20%s,\x20%s',_0x4c4930,_0x8d5b('0x16'));logger[_0x8d5b('0x17')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x4c4930,_0x8d5b('0x16'),JSON['stringify'](_0x2f8b3f));if(_0x2f8b3f[_0x8d5b('0x18')]){if(_0x2f8b3f['error'][_0x8d5b('0x19')]===0x1f4){logger['error'](_0x8d5b('0x1a'),_0x4c4930,_0x2f8b3f[_0x8d5b('0x18')]['message']);return _0x5bd243(_0x2f8b3f['error'][_0x8d5b('0x1b')]);}logger['error'](_0x8d5b('0x1a'),_0x4c4930,_0x2f8b3f[_0x8d5b('0x18')][_0x8d5b('0x1b')]);return _0x346e4f(_0x2f8b3f[_0x8d5b('0x18')][_0x8d5b('0x1b')]);}else{logger[_0x8d5b('0x15')]('MailMessage,\x20%s,\x20%s',_0x4c4930,_0x8d5b('0x16'));_0x346e4f(_0x2f8b3f['result'][_0x8d5b('0x1b')]);}})['catch'](function(_0x4170f4){logger[_0x8d5b('0x18')](_0x8d5b('0x1a'),_0x4c4930,_0x4170f4);_0x5bd243(_0x4170f4);});});}function respondWithResult(_0x390607,_0x5b8e14){_0x5b8e14=_0x5b8e14||0xc8;return function(_0x5e88c8){if(_0x5e88c8){return _0x390607['status'](_0x5b8e14)[_0x8d5b('0x1c')](_0x5e88c8);}};}function respondWithFilteredResult(_0x4b9628,_0x5f2c3e){return function(_0x3a3602){if(_0x3a3602){var _0x575061=typeof _0x5f2c3e[_0x8d5b('0x1d')]===_0x8d5b('0x1e')&&typeof _0x5f2c3e[_0x8d5b('0x1f')]==='undefined';var _0x169e68=_0x3a3602[_0x8d5b('0x20')];var _0x1df5bb=_0x575061?0x0:_0x5f2c3e[_0x8d5b('0x1d')];var _0x20e496=_0x575061?_0x3a3602['count']:_0x5f2c3e[_0x8d5b('0x1d')]+_0x5f2c3e[_0x8d5b('0x1f')];var _0xb2951b;if(_0x20e496>=_0x169e68){_0x20e496=_0x169e68;_0xb2951b=0xc8;}else{_0xb2951b=0xce;}_0x4b9628['status'](_0xb2951b);return _0x4b9628['set'](_0x8d5b('0x21'),_0x1df5bb+'-'+_0x20e496+'/'+_0x169e68)[_0x8d5b('0x1c')](_0x3a3602);}return null;};}function saveUpdates(_0x23e3aa){return function(_0x5283be){if(_0x5283be){return _0x5283be[_0x8d5b('0x22')](_0x23e3aa)[_0x8d5b('0x14')](function(_0x5dfa74){return _0x5dfa74;});}return null;};}function removeEntity(_0xa556f8){return function(_0x2584b2){if(_0x2584b2){return _0x2584b2[_0x8d5b('0x23')]()['then'](function(){_0xa556f8[_0x8d5b('0x24')](0xcc)[_0x8d5b('0x25')]();});}};}function handleEntityNotFound(_0x2288b5){return function(_0x4c729b){if(!_0x4c729b){_0x2288b5[_0x8d5b('0x26')](0x194);}return _0x4c729b;};}function handleError(_0x20b9f2,_0x2e0069){_0x2e0069=_0x2e0069||0x1f4;return function(_0x2e34bd){logger[_0x8d5b('0x18')](_0x2e34bd[_0x8d5b('0x27')]);if(_0x2e34bd[_0x8d5b('0x28')]){delete _0x2e34bd['name'];}_0x20b9f2['status'](_0x2e0069)[_0x8d5b('0x29')](_0x2e34bd);};}exports[_0x8d5b('0x2a')]=function(_0x2a6c57,_0x3777c0){var _0x8ddd84={},_0x4f9e90={},_0x17dc59={'count':0x0,'rows':[]};var _0x71c7c4=_[_0x8d5b('0x2b')](db[_0x8d5b('0x2c')][_0x8d5b('0x2d')],function(_0x59ab37){return{'name':_0x59ab37['fieldName'],'type':_0x59ab37[_0x8d5b('0x2e')][_0x8d5b('0x2f')]};});_0x4f9e90['model']=_[_0x8d5b('0x2b')](_0x71c7c4,_0x8d5b('0x28'));_0x4f9e90[_0x8d5b('0x30')]=_[_0x8d5b('0x31')](_0x2a6c57[_0x8d5b('0x30')]);_0x4f9e90[_0x8d5b('0x32')]=_[_0x8d5b('0x33')](_0x4f9e90[_0x8d5b('0x34')],_0x4f9e90[_0x8d5b('0x30')]);_0x8ddd84[_0x8d5b('0x35')]=_[_0x8d5b('0x33')](_0x4f9e90[_0x8d5b('0x34')],qs['fields'](_0x2a6c57[_0x8d5b('0x30')][_0x8d5b('0x36')]));_0x8ddd84[_0x8d5b('0x35')]=_0x8ddd84[_0x8d5b('0x35')]['length']?_0x8ddd84['attributes']:_0x4f9e90[_0x8d5b('0x34')];if(!_0x2a6c57[_0x8d5b('0x30')][_0x8d5b('0x37')](_0x8d5b('0x38'))){_0x8ddd84[_0x8d5b('0x1f')]=qs[_0x8d5b('0x1f')](_0x2a6c57[_0x8d5b('0x30')][_0x8d5b('0x1f')]);_0x8ddd84[_0x8d5b('0x1d')]=qs[_0x8d5b('0x1d')](_0x2a6c57[_0x8d5b('0x30')][_0x8d5b('0x1d')]);}_0x8ddd84[_0x8d5b('0x39')]=qs[_0x8d5b('0x3a')](_0x2a6c57[_0x8d5b('0x30')][_0x8d5b('0x3a')]);_0x8ddd84['where']=qs[_0x8d5b('0x32')](_['pick'](_0x2a6c57['query'],_0x4f9e90[_0x8d5b('0x32')]),_0x71c7c4);if(_0x2a6c57[_0x8d5b('0x30')][_0x8d5b('0x3b')]){_0x8ddd84[_0x8d5b('0x3c')]=_[_0x8d5b('0x3d')](_0x8ddd84['where'],{'$or':_[_0x8d5b('0x2b')](_0x71c7c4,function(_0x3a803f){if(_0x3a803f['type']!==_0x8d5b('0x3e')){var _0x4e8fd1={};_0x4e8fd1[_0x3a803f['name']]={'$like':'%'+_0x2a6c57[_0x8d5b('0x30')]['filter']+'%'};return _0x4e8fd1;}})});}_0x8ddd84=_[_0x8d5b('0x3d')]({},_0x8ddd84,_0x2a6c57[_0x8d5b('0x3f')]);var _0x26c73c={'where':_0x8ddd84[_0x8d5b('0x3c')]};return db[_0x8d5b('0x2c')]['count'](_0x26c73c)['then'](function(_0x3cff46){_0x17dc59[_0x8d5b('0x20')]=_0x3cff46;if(_0x2a6c57[_0x8d5b('0x30')]['includeAll']){_0x8ddd84[_0x8d5b('0x40')]=[{'all':!![]}];}return db['MailMessage'][_0x8d5b('0x41')](_0x8ddd84);})[_0x8d5b('0x14')](function(_0x18d920){_0x17dc59[_0x8d5b('0x42')]=_0x18d920;return _0x17dc59;})[_0x8d5b('0x14')](respondWithFilteredResult(_0x3777c0,_0x8ddd84))[_0x8d5b('0x43')](handleError(_0x3777c0,null));};exports[_0x8d5b('0x44')]=function(_0x39f9e0,_0x7738a4){var _0x525327={'raw':!![],'where':{'id':_0x39f9e0[_0x8d5b('0x45')]['id']}},_0x92fffc={};_0x92fffc[_0x8d5b('0x34')]=_[_0x8d5b('0x31')](db[_0x8d5b('0x2c')][_0x8d5b('0x2d')]);_0x92fffc['query']=_[_0x8d5b('0x31')](_0x39f9e0[_0x8d5b('0x30')]);_0x92fffc[_0x8d5b('0x32')]=_[_0x8d5b('0x33')](_0x92fffc[_0x8d5b('0x34')],_0x92fffc[_0x8d5b('0x30')]);_0x525327['attributes']=_[_0x8d5b('0x33')](_0x92fffc[_0x8d5b('0x34')],qs['fields'](_0x39f9e0[_0x8d5b('0x30')][_0x8d5b('0x36')]));_0x525327[_0x8d5b('0x35')]=_0x525327[_0x8d5b('0x35')][_0x8d5b('0x46')]?_0x525327['attributes']:_0x92fffc['model'];if(_0x39f9e0[_0x8d5b('0x30')][_0x8d5b('0x47')]){_0x525327[_0x8d5b('0x40')]=[{'all':!![]}];}_0x525327=_['merge']({},_0x525327,_0x39f9e0['options']);return db[_0x8d5b('0x2c')][_0x8d5b('0x48')](_0x525327)[_0x8d5b('0x14')](handleEntityNotFound(_0x7738a4,null))[_0x8d5b('0x14')](respondWithResult(_0x7738a4,null))[_0x8d5b('0x43')](handleError(_0x7738a4,null));};exports[_0x8d5b('0x22')]=function(_0xa89068,_0x39eefa){if(_0xa89068[_0x8d5b('0x49')]['id']){delete _0xa89068[_0x8d5b('0x49')]['id'];}return db[_0x8d5b('0x2c')][_0x8d5b('0x48')]({'where':{'id':_0xa89068[_0x8d5b('0x45')]['id']}})[_0x8d5b('0x14')](handleEntityNotFound(_0x39eefa,null))[_0x8d5b('0x14')](saveUpdates(_0xa89068['body'],null))[_0x8d5b('0x14')](respondWithResult(_0x39eefa,null))[_0x8d5b('0x43')](handleError(_0x39eefa,null));};exports[_0x8d5b('0x23')]=function(_0x117abd,_0x59aadc){return db['MailMessage'][_0x8d5b('0x48')]({'where':{'id':_0x117abd[_0x8d5b('0x45')]['id']}})['then'](handleEntityNotFound(_0x59aadc,null))[_0x8d5b('0x14')](removeEntity(_0x59aadc,null))['catch'](handleError(_0x59aadc,null));};exports[_0x8d5b('0x4a')]=function(_0xa8b979,_0x21cfbc){return db[_0x8d5b('0x2c')][_0x8d5b('0x4a')]()[_0x8d5b('0x14')](respondWithResult(_0x21cfbc,null))['catch'](handleError(_0x21cfbc,null));};exports[_0x8d5b('0x4b')]=function(_0x53d492,_0x40d241){return db[_0x8d5b('0x2c')]['create'](_0x53d492[_0x8d5b('0x49')])['then'](function(_0x146f59){if(_0x146f59){if(_0x146f59[_0x8d5b('0x4c')]===_0x8d5b('0x4d')&&!_0x146f59[_0x8d5b('0x4e')]){var _0x2b8dd8,_0x55acc4,_0x3d821c;if(_0x53d492[_0x8d5b('0x49')]['to']){_0x55acc4=_0x53d492[_0x8d5b('0x49')]['to'][_0x8d5b('0x4f')](',')[0x0];}return db[_0x8d5b('0x50')][_0x8d5b('0x51')]({'where':{'id':_0x146f59[_0x8d5b('0x52')]},'include':[{'model':db[_0x8d5b('0x53')],'as':_0x8d5b('0x54'),'include':[{'model':db[_0x8d5b('0x55')],'as':_0x8d5b('0x56'),'where':{'email':_0x55acc4},'limit':0x1,'order':[[_0x8d5b('0x57'),_0x8d5b('0x58')]]}]},{'model':db[_0x8d5b('0x59')],'as':'Smtp','raw':!![]}]})['then'](function(_0x153792){_0x2b8dd8=_0x153792;if(_0x2b8dd8&&_0x2b8dd8[_0x8d5b('0x5a')]){var _0x4e1094={'tls':{'rejectUnauthorized':![]}};if(_[_0x8d5b('0x5b')](_0x2b8dd8[_0x8d5b('0x5a')][_0x8d5b('0x5c')])){_0x4e1094[_0x8d5b('0x5d')]=_0x2b8dd8['Smtp'][_0x8d5b('0x5d')];_0x4e1094[_0x8d5b('0x5e')]=_0x2b8dd8[_0x8d5b('0x5a')][_0x8d5b('0x5e')];_0x4e1094[_0x8d5b('0x5f')]=_0x2b8dd8[_0x8d5b('0x5a')]['secure'];if(_0x2b8dd8['Smtp']['authentication']){_0x4e1094[_0x8d5b('0x60')]={'user':_0x2b8dd8[_0x8d5b('0x5a')]['user'],'pass':_0x2b8dd8[_0x8d5b('0x5a')][_0x8d5b('0x61')]};}}else{_0x4e1094['service']=_0x2b8dd8[_0x8d5b('0x5a')][_0x8d5b('0x5c')];_0x4e1094[_0x8d5b('0x60')]={'user':_0x2b8dd8[_0x8d5b('0x5a')][_0x8d5b('0x62')],'pass':_0x2b8dd8['Smtp']['pass']};_0x4e1094[_0x8d5b('0x5f')]=_0x2b8dd8[_0x8d5b('0x5a')][_0x8d5b('0x5f')];}if(_0x53d492[_0x8d5b('0x49')][_0x8d5b('0x63')]&&_0x53d492['body']['attachments'][_0x8d5b('0x46')]){for(var _0x3a153f=0x0;_0x3a153f<_0x53d492['body'][_0x8d5b('0x63')][_0x8d5b('0x46')];_0x3a153f+=0x1){_0x53d492[_0x8d5b('0x49')][_0x8d5b('0x63')][_0x3a153f]={'filename':_0x53d492['body'][_0x8d5b('0x63')][_0x3a153f][_0x8d5b('0x28')],'path':path[_0x8d5b('0x64')](config[_0x8d5b('0x65')],'server/files/attachments',_0x53d492[_0x8d5b('0x49')][_0x8d5b('0x63')][_0x3a153f][_0x8d5b('0x66')])};}}_0x3d821c={'account':_0x4e1094,'message':_0x53d492[_0x8d5b('0x49')]};return;}})[_0x8d5b('0x14')](function(){if(_0x2b8dd8[_0x8d5b('0x54')]){if(_0x2b8dd8['List'][_0x8d5b('0x56')][_0x8d5b('0x46')]){return _0x2b8dd8[_0x8d5b('0x54')][_0x8d5b('0x56')][0x0];}else{return db[_0x8d5b('0x55')][_0x8d5b('0x4b')](_['defaults'](_0x53d492['body'],{'firstName':_0x53d492[_0x8d5b('0x49')]['to'],'email':_0x53d492['body']['to'],'phone':_0x53d492[_0x8d5b('0x49')]['to'],'ListId':_0x2b8dd8['ListId']}));}}else{throw new Error(_0x8d5b('0x67'));}})[_0x8d5b('0x14')](function(){if(_0x3d821c){return respondWithRpcPromise('SendMail',_0x8d5b('0x68'),_0x3d821c,client9003)[_0x8d5b('0x14')](function(_0x26fbaf){return _0x146f59[_0x8d5b('0x22')]({'read':!![],'messageId':_0x26fbaf[_0x8d5b('0x69')],'sentAt':moment()[_0x8d5b('0x6a')](_0x8d5b('0x6b'))});})['catch'](function(_0x3a9352){logger[_0x8d5b('0x18')]('%s',JSON[_0x8d5b('0x6c')](_0x3a9352));return _0x146f59;});}return _0x146f59;});}return _0x146f59;}})[_0x8d5b('0x14')](respondWithResult(_0x40d241,0xc9))[_0x8d5b('0x43')](handleError(_0x40d241,null));};exports[_0x8d5b('0x6d')]=function(_0x2e0d40,_0x22f9a3){var _0x129bee={'agent':{},'channel':_0x8d5b('0x6e')};if(_0x2e0d40['body']['id']){delete _0x2e0d40[_0x8d5b('0x49')]['id'];}_0x2e0d40[_0x8d5b('0x49')][_0x8d5b('0x6f')]=!![];_0x2e0d40[_0x8d5b('0x49')][_0x8d5b('0x70')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2e0d40[_0x8d5b('0x49')][_0x8d5b('0x71')]=_0x2e0d40[_0x8d5b('0x49')][_0x8d5b('0x71')]||_0x2e0d40[_0x8d5b('0x62')]['id'];_0x129bee[_0x8d5b('0x72')]['id']=_0x2e0d40[_0x8d5b('0x49')][_0x8d5b('0x71')];return db['MailMessage']['find']({'where':{'id':_0x2e0d40[_0x8d5b('0x45')]['id'],'UserId':null}})[_0x8d5b('0x14')](handleEntityNotFound(_0x22f9a3,null))['then'](saveUpdates(_0x2e0d40['body'],null))[_0x8d5b('0x14')](function(_0x4e09f8){if(_0x4e09f8){_0x129bee[_0x8d5b('0x1b')]=_0x4e09f8[_0x8d5b('0x73')]({'plain':!![]});return db[_0x8d5b('0x74')][_0x8d5b('0x48')]({'where':{'id':_0x4e09f8[_0x8d5b('0x75')]}});}return null;})['then'](handleEntityNotFound(_0x22f9a3,null))['then'](function(_0x16c67b){if(_0x16c67b){return _0x16c67b[_0x8d5b('0x22')]({'UserId':_0x2e0d40[_0x8d5b('0x49')][_0x8d5b('0x71')],'read1stAt':_[_0x8d5b('0x5b')](_0x16c67b[_0x8d5b('0x76')])?moment()[_0x8d5b('0x6a')](_0x8d5b('0x6b')):undefined});}return null;})[_0x8d5b('0x14')](function(_0x9f1953){if(_0x9f1953){_0x129bee[_0x8d5b('0x77')]=_0x9f1953['get']({'plain':!![]});interaction_log[_0x8d5b('0x15')](_0x8d5b('0x78'),_0x2e0d40[_0x8d5b('0x62')]['id'],_0x2e0d40[_0x8d5b('0x62')][_0x8d5b('0x28')],_0x2e0d40[_0x8d5b('0x62')][_0x8d5b('0x79')],_0x129bee['interaction']['id'],_0x2e0d40[_0x8d5b('0x49')]?JSON[_0x8d5b('0x6c')](_0x2e0d40[_0x8d5b('0x49')]):_0x8d5b('0x7a'));return respondWithRpcPromise('AcceptMessage',_0x8d5b('0x7b'),_0x129bee);}return null;})['then'](function(_0x36aee0){var _0x5ae5be=_0x8d5b('0x7c')+_0x36aee0['message'][_0x8d5b('0x7d')];return db[_0x8d5b('0x7e')][_0x8d5b('0x30')](_0x5ae5be,{'type':db[_0x8d5b('0x7f')][_0x8d5b('0x80')][_0x8d5b('0x81')],'raw':!![]})[_0x8d5b('0x14')](function(_0x2059bd){return _0x2059bd;});})['then'](function(_0x419eed){if(_0x419eed){_0x129bee[_0x8d5b('0x1b')][_0x8d5b('0x82')]=_0x419eed[0x0];if(!_0x2e0d40[_0x8d5b('0x49')]['UserId'])return;return db[_0x8d5b('0x83')][_0x8d5b('0x48')]({'where':{'id':_0x2e0d40[_0x8d5b('0x49')][_0x8d5b('0x71')],'role':_0x8d5b('0x72')},'attributes':['id',_0x8d5b('0x28'),_0x8d5b('0x84'),'email',_0x8d5b('0x85')],'raw':!![]});}return null;})[_0x8d5b('0x14')](function(_0xd91c31){if(!_0xd91c31)return null;_0x129bee['message']['agent']=_0xd91c31;return _0x129bee;})[_0x8d5b('0x14')](function(_0x2aacf4){if(_0x2aacf4){if(_0x2e0d40[_0x8d5b('0x49')]['manual']){_0x129bee[_0x8d5b('0x1b')][_0x8d5b('0x86')]=util[_0x8d5b('0x6a')](_0x8d5b('0x87'),_0x2e0d40[_0x8d5b('0x62')][_0x8d5b('0x28')]);_0x129bee[_0x8d5b('0x1b')]['channel']=_0x129bee[_0x8d5b('0x88')];_0x129bee[_0x8d5b('0x1b')][_0x8d5b('0x89')]=_0x129bee['channel'];_0x129bee[_0x8d5b('0x1b')]['event']=_0x8d5b('0x6d');_0x129bee[_0x8d5b('0x1b')][_0x8d5b('0x49')]=htmlToText[_0x8d5b('0x8a')](_0x129bee['message'][_0x8d5b('0x49')]);return respondWithRpcPromise(_0x8d5b('0x8b'),_0x8d5b('0x8b'),{'event':'acceptmessage','message':_0x129bee['message']},client9002)[_0x8d5b('0x14')](function(){return _0x129bee;});}return _0x129bee;}return null;})[_0x8d5b('0x14')](respondWithResult(_0x22f9a3,null))[_0x8d5b('0x43')](handleError(_0x22f9a3,null));};exports['reject']=function(_0x3c9305,_0x4e1dfa){var _0x2d2cbf={'agent':{},'channel':_0x8d5b('0x6e')};if(_0x3c9305[_0x8d5b('0x49')]['id']){delete _0x3c9305[_0x8d5b('0x49')]['id'];}_0x3c9305[_0x8d5b('0x49')][_0x8d5b('0x71')]=_0x3c9305[_0x8d5b('0x49')][_0x8d5b('0x71')]||_0x3c9305[_0x8d5b('0x62')]['id'];_0x2d2cbf[_0x8d5b('0x72')]['id']=_0x3c9305[_0x8d5b('0x49')][_0x8d5b('0x71')];return db[_0x8d5b('0x2c')][_0x8d5b('0x48')]({'where':{'id':_0x3c9305['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4e1dfa,null))[_0x8d5b('0x14')](function(_0x36c0c6){if(_0x36c0c6){_0x2d2cbf[_0x8d5b('0x1b')]=_0x36c0c6[_0x8d5b('0x73')]({'plain':!![]});return db[_0x8d5b('0x74')][_0x8d5b('0x48')]({'where':{'id':_0x36c0c6[_0x8d5b('0x75')]}});}return null;})[_0x8d5b('0x14')](handleEntityNotFound(_0x4e1dfa,null))[_0x8d5b('0x14')](function(_0xd1e5e1){if(_0xd1e5e1){_0x2d2cbf['interaction']=_0xd1e5e1['get']({'plain':!![]});interaction_log[_0x8d5b('0x15')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3c9305[_0x8d5b('0x62')]['id'],_0x3c9305[_0x8d5b('0x62')][_0x8d5b('0x28')],_0x3c9305['user'][_0x8d5b('0x79')],_0x2d2cbf[_0x8d5b('0x77')]['id'],_0x3c9305[_0x8d5b('0x49')]?JSON['stringify'](_0x3c9305[_0x8d5b('0x49')]):_0x8d5b('0x7a'));return respondWithRpcPromise('RejectMessage',_0x8d5b('0x8c'),_0x2d2cbf);}return null;})['then'](function(_0x3ae488){var _0x11b433=_0x8d5b('0x7c')+_0x3ae488[_0x8d5b('0x1b')]['ContactId'];return db[_0x8d5b('0x7e')][_0x8d5b('0x30')](_0x11b433,{'type':db['Sequelize']['QueryTypes'][_0x8d5b('0x81')],'raw':!![]})[_0x8d5b('0x14')](function(_0x800b28){return _0x800b28;});})[_0x8d5b('0x14')](function(_0x1db31d){if(_0x1db31d){_0x2d2cbf[_0x8d5b('0x1b')][_0x8d5b('0x82')]=_0x1db31d[0x0];if(!_0x3c9305[_0x8d5b('0x49')][_0x8d5b('0x71')])return;return db[_0x8d5b('0x83')][_0x8d5b('0x48')]({'where':{'id':_0x3c9305[_0x8d5b('0x49')][_0x8d5b('0x71')],'role':_0x8d5b('0x72')},'attributes':['id',_0x8d5b('0x28'),_0x8d5b('0x84'),_0x8d5b('0x8d'),_0x8d5b('0x85')],'raw':!![]});}return null;})[_0x8d5b('0x14')](function(_0x103251){if(!_0x103251)return null;_0x2d2cbf[_0x8d5b('0x1b')][_0x8d5b('0x72')]=_0x103251;return _0x2d2cbf;})[_0x8d5b('0x14')](function(_0x286aca){if(_0x286aca){_0x286aca[_0x8d5b('0x1b')][_0x8d5b('0x86')]=util[_0x8d5b('0x6a')](_0x8d5b('0x87'),_0x3c9305['user'][_0x8d5b('0x28')]);_0x286aca[_0x8d5b('0x1b')]['channel']=_0x2d2cbf[_0x8d5b('0x88')];_0x286aca[_0x8d5b('0x1b')][_0x8d5b('0x89')]=_0x2d2cbf[_0x8d5b('0x88')];_0x286aca[_0x8d5b('0x1b')][_0x8d5b('0x8e')]='reject';_0x286aca[_0x8d5b('0x1b')]['body']=htmlToText[_0x8d5b('0x8a')](_0x2d2cbf[_0x8d5b('0x1b')][_0x8d5b('0x49')]);respondWithRpcPromise(_0x8d5b('0x8b'),_0x8d5b('0x8b'),{'event':_0x8d5b('0x8f'),'message':_0x286aca[_0x8d5b('0x1b')]},client9002);return _0x2d2cbf;}return null;})[_0x8d5b('0x14')](respondWithResult(_0x4e1dfa,null))[_0x8d5b('0x43')](handleError(_0x4e1dfa,null));};exports[_0x8d5b('0x90')]=function(_0x555e42,_0x4bc893){var _0x573dc9=moment()['unix']()[_0x8d5b('0x91')]();var _0x4fe77e=path[_0x8d5b('0x64')](config[_0x8d5b('0x65')],'server','files',_0x8d5b('0x92'));var _0x2c4b9f=path[_0x8d5b('0x64')](config[_0x8d5b('0x65')],_0x8d5b('0x93'),_0x8d5b('0x94'),_0x8d5b('0x63'));var _0x47e937=util[_0x8d5b('0x6a')](_0x8d5b('0x95'),_0x573dc9);return db['MailMessage'][_0x8d5b('0x48')]({'where':{'id':_0x555e42[_0x8d5b('0x45')]['id']},'attributes':['id','body','from','to','cc',_0x8d5b('0x96'),_0x8d5b('0x97'),_0x8d5b('0x98')],'include':_0x555e42[_0x8d5b('0x30')][_0x8d5b('0x63')]?[{'model':db['Attachment'],'as':_0x8d5b('0x99')}]:undefined})[_0x8d5b('0x14')](handleEntityNotFound(_0x4bc893,null))['then'](function(_0x55f825){if(_0x55f825){var _0x3cada0=_0x55f825;var _0x255a5e={'from':_0x3cada0[_0x8d5b('0x9a')],'to':_0x3cada0['to'],'subject':_0x3cada0[_0x8d5b('0x97')],'html':_0x3cada0[_0x8d5b('0x49')],'headers':{'Date':moment(_0x3cada0['createdAt'])['format'](_0x8d5b('0x9b'))},'attachments':[]};if(_0x55f825['cc']){_0x255a5e[_0x8d5b('0x9c')]['Cc']=_0x55f825['cc'];}if(_0x55f825[_0x8d5b('0x96')]){_0x255a5e[_0x8d5b('0x9c')][_0x8d5b('0x9d')]=_0x55f825[_0x8d5b('0x96')];}return new BPromise(function(_0x561b79,_0x5c8123){if(_0x55f825['Attachments']){for(var _0x5473ee=0x0;_0x5473ee<_0x55f825['Attachments']['length'];_0x5473ee++){var _0x5c7470=_0x55f825[_0x8d5b('0x99')][_0x5473ee];var _0xfc192b=path[_0x8d5b('0x64')](_0x2c4b9f,_0x5c7470[_0x8d5b('0x66')]);if(fs[_0x8d5b('0x9e')](_0xfc192b)){_0x255a5e[_0x8d5b('0x63')][_0x8d5b('0x9f')]({'name':_0x5c7470[_0x8d5b('0x28')],'contentType':_0x5c7470[_0x8d5b('0x2e')],'data':fs[_0x8d5b('0xa0')](_0xfc192b)});}}}emlformat[_0x8d5b('0xa1')](_0x255a5e,function(_0x4bd88b,_0x489c37){if(_0x4bd88b)return _0x5c8123(_0x4bd88b);fs['writeFileSync'](path[_0x8d5b('0x64')](_0x4fe77e,_0x47e937),_0x489c37);return _0x561b79(_0x489c37);});});}})['then'](function(_0x293a91){if(_0x293a91){return _0x4bc893[_0x8d5b('0x90')](path[_0x8d5b('0x64')](_0x4fe77e,_0x47e937),_0x47e937,function(_0x512121){if(!_0x512121)fs[_0x8d5b('0xa2')](path['join'](_0x4fe77e,_0x47e937));});}})['catch'](handleError(_0x4bc893,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 4a3eb97..ec696ea 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 _0xaca0=['exports','events','../../mysqldb','MailMessage','setMaxListeners','save','remove','emit','hook'];(function(_0x5b5f81,_0xb86687){var _0x1e0e32=function(_0x1acba4){while(--_0x1acba4){_0x5b5f81['push'](_0x5b5f81['shift']());}};_0x1e0e32(++_0xb86687);}(_0xaca0,0x19f));var _0x0aca=function(_0x91b128,_0x412ea5){_0x91b128=_0x91b128-0x0;var _0x23a1f3=_0xaca0[_0x91b128];return _0x23a1f3;};'use strict';var EventEmitter=require(_0x0aca('0x0'));var MailMessage=require(_0x0aca('0x1'))['db'][_0x0aca('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x0aca('0x3')](0x0);var events={'afterCreate':_0x0aca('0x4'),'afterUpdate':'update','afterDestroy':_0x0aca('0x5')};function emitEvent(_0x3b6154){return function(_0x2d5ae9,_0x480562,_0x43b89e){MailMessageEvents['emit'](_0x3b6154+':'+_0x2d5ae9['id'],_0x2d5ae9);MailMessageEvents[_0x0aca('0x6')](_0x3b6154,_0x2d5ae9);_0x43b89e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x0aca('0x7')](e,emitEvent(event));}}module[_0x0aca('0x8')]=MailMessageEvents; \ No newline at end of file +var _0xb11c=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xb11c,0x1f2));var _0xcb11=function(_0x34e4c0,_0x575be7){_0x34e4c0=_0x34e4c0-0x0;var _0x558f6a=_0xb11c[_0x34e4c0];return _0x558f6a;};'use strict';var EventEmitter=require(_0xcb11('0x0'));var MailMessage=require(_0xcb11('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xcb11('0x2')](0x0);var events={'afterCreate':_0xcb11('0x3'),'afterUpdate':_0xcb11('0x4'),'afterDestroy':_0xcb11('0x5')};function emitEvent(_0x1d243d){return function(_0x1bd291,_0x1d5526,_0x4b7dff){MailMessageEvents[_0xcb11('0x6')](_0x1d243d+':'+_0x1bd291['id'],_0x1bd291);MailMessageEvents['emit'](_0x1d243d,_0x1bd291);_0x4b7dff(null);};}for(var e in events){if(events[_0xcb11('0x7')](e)){var event=events[e];MailMessage[_0xcb11('0x8')](e,emitEvent(event));}}module[_0xcb11('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 7b0987f..45a3c34 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 _0xf9eb=['findOne','MailInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','html-to-text','path','rimraf','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','isNil','UserId'];(function(_0xa30766,_0x6f613e){var _0x24e780=function(_0x3d58fb){while(--_0x3d58fb){_0xa30766['push'](_0xa30766['shift']());}};_0x24e780(++_0x6f613e);}(_0xf9eb,0x118));var _0xbf9e=function(_0x4b703b,_0x2a02cb){_0x4b703b=_0x4b703b-0x0;var _0x4d75a7=_0xf9eb[_0x4b703b];return _0x4d75a7;};'use strict';var _=require(_0xbf9e('0x0'));var util=require(_0xbf9e('0x1'));var logger=require('../../config/logger')(_0xbf9e('0x2'));var moment=require(_0xbf9e('0x3'));var BPromise=require(_0xbf9e('0x4'));var rp=require(_0xbf9e('0x5'));var htmlToText=require(_0xbf9e('0x6'));var fs=require('fs');var path=require(_0xbf9e('0x7'));var rimraf=require(_0xbf9e('0x8'));var config=require('../../config/environment');var attributes=require(_0xbf9e('0x9'));module['exports']=function(_0x13b83f,_0x4eb6e7){return _0x13b83f[_0xbf9e('0xa')](_0xbf9e('0xb'),attributes,{'tableName':_0xbf9e('0xc'),'paranoid':![],'indexes':[{'name':_0xbf9e('0xd'),'fields':['messageId']},{'name':_0xbf9e('0xe'),'fields':[_0xbf9e('0xf'),'subject'],'type':_0xbf9e('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1faf24,_0x582914,_0x3622e4){if(_0x1faf24[_0xbf9e('0x11')]){_0x1faf24[_0xbf9e('0xf')]=htmlToText[_0xbf9e('0x12')](_0x1faf24[_0xbf9e('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x3622e4(null,_0x582914);},'afterCreate':function(_0x55fd02,_0x335dff,_0x350c11){var _0x8dc531=_0x13b83f[_0xbf9e('0x13')];var _0x20f602=_0x55fd02[_0xbf9e('0x14')]({'plain':!![]});if(_0x20f602[_0xbf9e('0x15')][_0xbf9e('0x16')]()==='in'||_0x20f602[_0xbf9e('0x15')][_0xbf9e('0x16')]()===_0xbf9e('0x17')&&!_0x20f602['secret']&&!_[_0xbf9e('0x18')](_0x20f602[_0xbf9e('0x19')])){_0x8dc531['MailInteraction'][_0xbf9e('0x1a')]({'where':{'id':_0x20f602[_0xbf9e('0x1b')]}})[_0xbf9e('0x1c')](function(_0x2c2f77){if(_0x2c2f77){_0x2c2f77[_0xbf9e('0x1d')]({'lastMsgAt':_0x20f602['createdAt'],'lastMsgDirection':_0x20f602['direction']['toLowerCase']()});}})[_0xbf9e('0x1e')](function(_0x4db023){console[_0xbf9e('0x1f')](_0x4db023);});}_0x350c11();}},'charset':_0xbf9e('0x20'),'collate':_0xbf9e('0x21')});}; \ No newline at end of file +var _0x817b=['rimraf','../../config/environment','./mailMessage.attributes','exports','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path'];(function(_0x1b6198,_0x482c84){var _0x63840c=function(_0x285c90){while(--_0x285c90){_0x1b6198['push'](_0x1b6198['shift']());}};_0x63840c(++_0x482c84);}(_0x817b,0x156));var _0xb817=function(_0x4aede8,_0x183d33){_0x4aede8=_0x4aede8-0x0;var _0xba7e6d=_0x817b[_0x4aede8];return _0xba7e6d;};'use strict';var _=require(_0xb817('0x0'));var util=require(_0xb817('0x1'));var logger=require(_0xb817('0x2'))(_0xb817('0x3'));var moment=require(_0xb817('0x4'));var BPromise=require(_0xb817('0x5'));var rp=require(_0xb817('0x6'));var htmlToText=require(_0xb817('0x7'));var fs=require('fs');var path=require(_0xb817('0x8'));var rimraf=require(_0xb817('0x9'));var config=require(_0xb817('0xa'));var attributes=require(_0xb817('0xb'));module[_0xb817('0xc')]=function(_0x2db884,_0x1b0759){return _0x2db884['define'](_0xb817('0xd'),attributes,{'tableName':_0xb817('0xe'),'paranoid':![],'indexes':[{'name':_0xb817('0xf'),'fields':[_0xb817('0xf')]},{'name':_0xb817('0x10'),'fields':[_0xb817('0x11'),_0xb817('0x12')],'type':_0xb817('0x13')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2f8c73,_0xce703f,_0x7b7366){if(_0x2f8c73[_0xb817('0x14')]){_0x2f8c73[_0xb817('0x11')]=htmlToText[_0xb817('0x15')](_0x2f8c73['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x7b7366(null,_0xce703f);},'afterCreate':function(_0x10be48,_0x4f5d36,_0x15467a){var _0x3a1d64=_0x2db884[_0xb817('0x16')];var _0x5ad7da=_0x10be48[_0xb817('0x17')]({'plain':!![]});if(_0x5ad7da[_0xb817('0x18')]['toLowerCase']()==='in'||_0x5ad7da[_0xb817('0x18')][_0xb817('0x19')]()===_0xb817('0x1a')&&!_0x5ad7da[_0xb817('0x1b')]&&!_[_0xb817('0x1c')](_0x5ad7da[_0xb817('0x1d')])){_0x3a1d64[_0xb817('0x1e')]['findOne']({'where':{'id':_0x5ad7da[_0xb817('0x1f')]}})[_0xb817('0x20')](function(_0x429a20){if(_0x429a20){_0x429a20[_0xb817('0x21')]({'lastMsgAt':_0x5ad7da[_0xb817('0x22')],'lastMsgDirection':_0x5ad7da[_0xb817('0x18')][_0xb817('0x19')]()});}})[_0xb817('0x23')](function(_0x532291){console[_0xb817('0x24')](_0x532291);});}_0x15467a();}},'charset':_0xb817('0x25'),'collate':_0xb817('0x26')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 9a9e0ca..2f6202b 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 _0x4213=['request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x4213,0x77));var _0x3421=function(_0x33813c,_0x1fa834){_0x33813c=_0x33813c-0x0;var _0x4e37cf=_0x4213[_0x33813c];return _0x4e37cf;};'use strict';var _=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var moment=require(_0x3421('0x2'));var BPromise=require(_0x3421('0x3'));var rs=require(_0x3421('0x4'));var fs=require('fs');var Redis=require(_0x3421('0x5'));var db=require(_0x3421('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3421('0x7'))('rpc');var config=require(_0x3421('0x8'));var jayson=require(_0x3421('0x9'));var client=jayson[_0x3421('0xa')][_0x3421('0xb')]({'port':0x232a});config['redis']=_[_0x3421('0xc')](config[_0x3421('0xd')],{'host':_0x3421('0xe'),'port':0x18eb});var socket=require(_0x3421('0xf'))(new Redis(config[_0x3421('0xd')]));require('./mailMessage.socket')[_0x3421('0x10')](socket);function respondWithRpcPromise(_0x58d511,_0x4ff986,_0x12eee0){return new BPromise(function(_0x4b9d24,_0x2d8676){return client[_0x3421('0x11')](_0x58d511,_0x12eee0)[_0x3421('0x12')](function(_0x38b521){logger[_0x3421('0x13')](_0x3421('0x14'),_0x4ff986,_0x3421('0x15'));logger['debug'](_0x3421('0x16'),_0x4ff986,_0x3421('0x15'),JSON[_0x3421('0x17')](_0x38b521));if(_0x38b521[_0x3421('0x18')]){if(_0x38b521[_0x3421('0x18')][_0x3421('0x19')]===0x1f4){logger[_0x3421('0x18')]('MailMessage,\x20%s,\x20%s',_0x4ff986,_0x38b521[_0x3421('0x18')]['message']);return _0x2d8676(_0x38b521[_0x3421('0x18')][_0x3421('0x1a')]);}logger['error'](_0x3421('0x14'),_0x4ff986,_0x38b521['error'][_0x3421('0x1a')]);return _0x4b9d24(_0x38b521[_0x3421('0x18')]['message']);}else{logger[_0x3421('0x13')](_0x3421('0x14'),_0x4ff986,_0x3421('0x15'));_0x4b9d24(_0x38b521[_0x3421('0x1b')][_0x3421('0x1a')]);}})[_0x3421('0x1c')](function(_0x3f1b1d){logger[_0x3421('0x18')](_0x3421('0x14'),_0x4ff986,_0x3f1b1d);_0x2d8676(_0x3f1b1d);});});}exports[_0x3421('0x1d')]=function(_0x538a8b){var _0x50d9a5=this;return new Promise(function(_0x420114,_0x4b59a5){return db['MailMessage']['create'](_0x538a8b[_0x3421('0x1e')],{'raw':_0x538a8b[_0x3421('0x1f')]?_0x538a8b[_0x3421('0x1f')][_0x3421('0x20')]===undefined?!![]:![]:!![]})[_0x3421('0x12')](function(_0x39bed4){logger[_0x3421('0x13')](_0x3421('0x1d'),_0x538a8b);logger[_0x3421('0x21')](_0x3421('0x1d'),_0x538a8b,JSON['stringify'](_0x39bed4));_0x420114(_0x39bed4);})['catch'](function(_0x494423){logger[_0x3421('0x18')](_0x3421('0x1d'),_0x494423[_0x3421('0x1a')],_0x538a8b);_0x4b59a5(_0x50d9a5['error'](0x1f4,_0x494423['message']));});});}; \ No newline at end of file +var _0x5f2f=['MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','MailMessage','create','options','raw','CreateMailMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xff9765,_0x38f13a){var _0x1074c2=function(_0xc291a3){while(--_0xc291a3){_0xff9765['push'](_0xff9765['shift']());}};_0x1074c2(++_0x38f13a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4a4d8f,_0x13aae4){_0x4a4d8f=_0x4a4d8f-0x0;var _0xf1b3d5=_0x5f2f[_0x4a4d8f];return _0xf1b3d5;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./mailMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateMailMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 68c2827..8a8a889 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 _0xc5b1=['register','length','./mailMessage.events','save','remove'];(function(_0x52b661,_0x4cb8d1){var _0x550a19=function(_0xed32eb){while(--_0xed32eb){_0x52b661['push'](_0x52b661['shift']());}};_0x550a19(++_0x4cb8d1);}(_0xc5b1,0x106));var _0x1c5b=function(_0x5f3dcd,_0x2282c6){_0x5f3dcd=_0x5f3dcd-0x0;var _0x3e7b64=_0xc5b1[_0x5f3dcd];return _0x3e7b64;};'use strict';var MailMessageEvents=require(_0x1c5b('0x0'));var events=[_0x1c5b('0x1'),_0x1c5b('0x2'),'update'];function createListener(_0x50a847,_0x3f74c9){return function(_0x5eb32a){_0x3f74c9['emit'](_0x50a847,_0x5eb32a);};}function removeListener(_0x42d03a,_0x4f4765){return function(){MailMessageEvents['removeListener'](_0x42d03a,_0x4f4765);};}exports[_0x1c5b('0x3')]=function(_0x5501b9){for(var _0x18f991=0x0,_0x39422a=events[_0x1c5b('0x4')];_0x18f991<_0x39422a;_0x18f991++){var _0x3b8538=events[_0x18f991];var _0x41382b=createListener('mailMessage:'+_0x3b8538,_0x5501b9);MailMessageEvents['on'](_0x3b8538,_0x41382b);}}; \ No newline at end of file +var _0xa8a8=['length','mailMessage:','./mailMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x54b60c,_0x256f38){var _0x16363a=function(_0x17ae52){while(--_0x17ae52){_0x54b60c['push'](_0x54b60c['shift']());}};_0x16363a(++_0x256f38);}(_0xa8a8,0xec));var _0x8a8a=function(_0x2048b8,_0x309f97){_0x2048b8=_0x2048b8-0x0;var _0x50feb1=_0xa8a8[_0x2048b8];return _0x50feb1;};'use strict';var MailMessageEvents=require(_0x8a8a('0x0'));var events=[_0x8a8a('0x1'),_0x8a8a('0x2'),_0x8a8a('0x3')];function createListener(_0x5221bc,_0x2a2676){return function(_0x3296a6){_0x2a2676[_0x8a8a('0x4')](_0x5221bc,_0x3296a6);};}function removeListener(_0x3ed1de,_0x45515d){return function(){MailMessageEvents[_0x8a8a('0x5')](_0x3ed1de,_0x45515d);};}exports[_0x8a8a('0x6')]=function(_0x12db82){for(var _0x2e8193=0x0,_0x315fe9=events[_0x8a8a('0x7')];_0x2e8193<_0x315fe9;_0x2e8193++){var _0x8e7aa0=events[_0x2e8193];var _0x4225b9=createListener(_0x8a8a('0x8')+_0x8e7aa0,_0x12db82);MailMessageEvents['on'](_0x8e7aa0,_0x4225b9);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 9291d22..dc38317 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 _0x82f2=['multer','path','connect-timeout','express','fs-extra','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents'];(function(_0x32e649,_0x228649){var _0x14d386=function(_0x3fb3ed){while(--_0x3fb3ed){_0x32e649['push'](_0x32e649['shift']());}};_0x14d386(++_0x228649);}(_0x82f2,0x129));var _0x282f=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x82f2[_0x1b2ff7];return _0x31656a;};'use strict';var multer=require(_0x282f('0x0'));var util=require('util');var path=require(_0x282f('0x1'));var timeout=require(_0x282f('0x2'));var express=require(_0x282f('0x3'));var router=express['Router']();var fs_extra=require(_0x282f('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x282f('0x5'));var controller=require(_0x282f('0x6'));router[_0x282f('0x7')]('/',auth[_0x282f('0x8')](),controller[_0x282f('0x9')]);router['get'](_0x282f('0xa'),auth[_0x282f('0x8')](),controller[_0x282f('0xb')]);router[_0x282f('0x7')](_0x282f('0xc'),auth['isAuthenticated'](),controller[_0x282f('0xd')]);router[_0x282f('0x7')](_0x282f('0xe'),auth[_0x282f('0x8')](),controller[_0x282f('0xf')]);router[_0x282f('0x7')](_0x282f('0x10'),auth['isAuthenticated'](),controller[_0x282f('0x11')]);router[_0x282f('0x7')](_0x282f('0x12'),auth['isAuthenticated'](),controller['getAgents']);router[_0x282f('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x282f('0x13')]('/:id/teams',auth[_0x282f('0x8')](),controller[_0x282f('0x14')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x282f('0x15')]);router[_0x282f('0x16')](_0x282f('0xc'),auth[_0x282f('0x8')](),controller['update']);router[_0x282f('0x17')](_0x282f('0xc'),auth['isAuthenticated'](),controller[_0x282f('0x18')]);router[_0x282f('0x17')](_0x282f('0x10'),auth['isAuthenticated'](),controller[_0x282f('0x19')]);router[_0x282f('0x17')](_0x282f('0x12'),auth[_0x282f('0x8')](),controller[_0x282f('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x43d5=['destroy','delete','removeTeams','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put'];(function(_0x3fbceb,_0x300c19){var _0xed6597=function(_0x268080){while(--_0x268080){_0x3fbceb['push'](_0x3fbceb['shift']());}};_0xed6597(++_0x300c19);}(_0x43d5,0xce));var _0x543d=function(_0x4b6c03,_0x289c4f){_0x4b6c03=_0x4b6c03-0x0;var _0x38dc49=_0x43d5[_0x4b6c03];return _0x38dc49;};'use strict';var multer=require(_0x543d('0x0'));var util=require(_0x543d('0x1'));var path=require(_0x543d('0x2'));var timeout=require(_0x543d('0x3'));var express=require(_0x543d('0x4'));var router=express[_0x543d('0x5')]();var fs_extra=require(_0x543d('0x6'));var auth=require(_0x543d('0x7'));var interaction=require(_0x543d('0x8'));var config=require(_0x543d('0x9'));var controller=require('./mailQueue.controller');router[_0x543d('0xa')]('/',auth[_0x543d('0xb')](),controller[_0x543d('0xc')]);router[_0x543d('0xa')](_0x543d('0xd'),auth[_0x543d('0xb')](),controller['describe']);router[_0x543d('0xa')](_0x543d('0xe'),auth['isAuthenticated'](),controller[_0x543d('0xf')]);router[_0x543d('0xa')]('/:id/members',auth[_0x543d('0xb')](),controller[_0x543d('0x10')]);router['get'](_0x543d('0x11'),auth[_0x543d('0xb')](),controller[_0x543d('0x12')]);router['get'](_0x543d('0x13'),auth[_0x543d('0xb')](),controller[_0x543d('0x14')]);router[_0x543d('0x15')]('/',auth[_0x543d('0xb')](),controller[_0x543d('0x16')]);router['post']('/:id/teams',auth[_0x543d('0xb')](),controller[_0x543d('0x17')]);router[_0x543d('0x15')](_0x543d('0x13'),auth[_0x543d('0xb')](),controller[_0x543d('0x18')]);router[_0x543d('0x19')](_0x543d('0xe'),auth[_0x543d('0xb')](),controller['update']);router['delete']('/:id',auth[_0x543d('0xb')](),controller[_0x543d('0x1a')]);router[_0x543d('0x1b')](_0x543d('0x11'),auth['isAuthenticated'](),controller[_0x543d('0x1c')]);router[_0x543d('0x1b')](_0x543d('0x13'),auth[_0x543d('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index c4f3bc4..e234b72 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 _0xe440=['rrmemory','roundrobin','exports','STRING','name','INTEGER','ENUM'];(function(_0x3e8cd1,_0x4b5aa8){var _0x2aeb1b=function(_0x39b86b){while(--_0x39b86b){_0x3e8cd1['push'](_0x3e8cd1['shift']());}};_0x2aeb1b(++_0x4b5aa8);}(_0xe440,0x14b));var _0x0e44=function(_0x456406,_0x17a3c1){_0x456406=_0x456406-0x0;var _0x681a69=_0xe440[_0x456406];return _0x681a69;};'use strict';var Sequelize=require('sequelize');module[_0x0e44('0x0')]={'name':{'type':Sequelize[_0x0e44('0x1')],'unique':_0x0e44('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0e44('0x1')]},'timeout':{'type':Sequelize[_0x0e44('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0e44('0x4')](_0x0e44('0x5'),'beepall',_0x0e44('0x6'))}}; \ No newline at end of file +var _0x21ae=['INTEGER','ENUM','rrmemory','beepall','roundrobin','STRING'];(function(_0x20ab51,_0x246894){var _0x51a966=function(_0x40d2fd){while(--_0x40d2fd){_0x20ab51['push'](_0x20ab51['shift']());}};_0x51a966(++_0x246894);}(_0x21ae,0x1d3));var _0xe21a=function(_0x410341,_0x4cd4b2){_0x410341=_0x410341-0x0;var _0x4d23d2=_0x21ae[_0x410341];return _0x4d23d2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe21a('0x0')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xe21a('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe21a('0x2')](_0xe21a('0x3'),_0xe21a('0x4'),_0xe21a('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 6843acc..9b24c74 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 _0xa47d=['map','MailQueue','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','include','rows','show','params','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findAll','UserId','agent','mailPause','updatedAt','createdAt','format','SIP','getTeams','findOne','Team','addTeams','User','Agents','voicePause','interface','flatMap','sequelize','transaction','each','UserMailQueue','findOrCreate','forEach','emit','userMailQueue:save','ids','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','union','compact','removeAgents','userMailQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','UserProfileResource','then','error','name','send'];(function(_0x308095,_0x1fa756){var _0x11b198=function(_0x1bf6ee){while(--_0x1bf6ee){_0x308095['push'](_0x308095['shift']());}};_0x11b198(++_0x1fa756);}(_0xa47d,0xe7));var _0xda47=function(_0x3301df,_0x1a604c){_0x3301df=_0x3301df-0x0;var _0x219679=_0xa47d[_0x3301df];return _0x219679;};'use strict';var emlformat=require(_0xda47('0x0'));var rimraf=require(_0xda47('0x1'));var zipdir=require(_0xda47('0x2'));var jsonpatch=require(_0xda47('0x3'));var rp=require('request-promise');var moment=require(_0xda47('0x4'));var BPromise=require(_0xda47('0x5'));var Mustache=require(_0xda47('0x6'));var util=require(_0xda47('0x7'));var path=require(_0xda47('0x8'));var sox=require('sox');var csv=require(_0xda47('0x9'));var ejs=require(_0xda47('0xa'));var fs=require('fs');var fs_extra=require(_0xda47('0xb'));var _=require(_0xda47('0xc'));var squel=require(_0xda47('0xd'));var crypto=require('crypto');var jsforce=require(_0xda47('0xe'));var deskjs=require(_0xda47('0xf'));var toCsv=require(_0xda47('0x9'));var querystring=require(_0xda47('0x10'));var Papa=require(_0xda47('0x11'));var Redis=require('ioredis');var authService=require(_0xda47('0x12'));var qs=require(_0xda47('0x13'));var as=require(_0xda47('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xda47('0x15'))(_0xda47('0x16'));var utils=require(_0xda47('0x17'));var config=require(_0xda47('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xda47('0x19'))['db'];config[_0xda47('0x1a')]=_[_0xda47('0x1b')](config[_0xda47('0x1a')],{'host':_0xda47('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailQueue.socket')[_0xda47('0x1d')](socket);function respondWithStatusCode(_0x5bce05,_0x2d9396){_0x2d9396=_0x2d9396||0xcc;return function(_0x312756){if(_0x312756){return _0x5bce05[_0xda47('0x1e')](_0x2d9396);}return _0x5bce05['status'](_0x2d9396)[_0xda47('0x1f')]();};}function respondWithResult(_0x3438e2,_0x2eb4b5){_0x2eb4b5=_0x2eb4b5||0xc8;return function(_0x5c31fa){if(_0x5c31fa){return _0x3438e2[_0xda47('0x20')](_0x2eb4b5)[_0xda47('0x21')](_0x5c31fa);}};}function respondWithFilteredResult(_0x500d15,_0x37c2b0){return function(_0x5da4d7){if(_0x5da4d7){var _0x298550=typeof _0x37c2b0[_0xda47('0x22')]==='undefined'&&typeof _0x37c2b0[_0xda47('0x23')]===_0xda47('0x24');var _0x4ab860=_0x5da4d7[_0xda47('0x25')];var _0x406a62=_0x298550?0x0:_0x37c2b0[_0xda47('0x22')];var _0x59d7c0=_0x298550?_0x5da4d7[_0xda47('0x25')]:_0x37c2b0[_0xda47('0x22')]+_0x37c2b0[_0xda47('0x23')];var _0x5c6b63;if(_0x59d7c0>=_0x4ab860){_0x59d7c0=_0x4ab860;_0x5c6b63=0xc8;}else{_0x5c6b63=0xce;}_0x500d15[_0xda47('0x20')](_0x5c6b63);return _0x500d15['set'](_0xda47('0x26'),_0x406a62+'-'+_0x59d7c0+'/'+_0x4ab860)[_0xda47('0x21')](_0x5da4d7);}return null;};}function patchUpdates(_0x2bfb7f){return function(_0x43963b){try{jsonpatch[_0xda47('0x27')](_0x43963b,_0x2bfb7f,!![]);}catch(_0x1959ca){return BPromise[_0xda47('0x28')](_0x1959ca);}return _0x43963b[_0xda47('0x29')]();};}function saveUpdates(_0xa4d46f,_0x33e33d){return function(_0x39e67a){if(_0x39e67a){return _0x39e67a[_0xda47('0x2a')](_0xa4d46f)['then'](function(_0x15cd19){return _0x15cd19;});}return null;};}function removeEntity(_0x352ddc,_0x13106b){return function(_0xb6bddb){if(_0xb6bddb){return _0xb6bddb[_0xda47('0x2b')]()['then'](function(){var _0x358608=_0xb6bddb['get']({'plain':!![]});var _0x4f0299='MailQueues';return db[_0xda47('0x2c')][_0xda47('0x2b')]({'where':{'type':_0x4f0299,'resourceId':_0x358608['id']}})['then'](function(){return _0xb6bddb;});})[_0xda47('0x2d')](function(){_0x352ddc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x8d1885,_0x7f1f70){return function(_0x2f760e){if(!_0x2f760e){_0x8d1885[_0xda47('0x1e')](0x194);}return _0x2f760e;};}function handleError(_0x2c6edc,_0x30c759){_0x30c759=_0x30c759||0x1f4;return function(_0x2750d5){logger[_0xda47('0x2e')](_0x2750d5['stack']);if(_0x2750d5[_0xda47('0x2f')]){delete _0x2750d5[_0xda47('0x2f')];}_0x2c6edc[_0xda47('0x20')](_0x30c759)[_0xda47('0x30')](_0x2750d5);};}exports['index']=function(_0x567d30,_0xeec800){var _0x5eea02={},_0x16d7ba={},_0x42840b={'count':0x0,'rows':[]};var _0x34ef37=_[_0xda47('0x31')](db[_0xda47('0x32')][_0xda47('0x33')],function(_0x1a79a9){return{'name':_0x1a79a9[_0xda47('0x34')],'type':_0x1a79a9['type'][_0xda47('0x35')]};});_0x16d7ba['model']=_[_0xda47('0x31')](_0x34ef37,'name');_0x16d7ba[_0xda47('0x36')]=_[_0xda47('0x37')](_0x567d30['query']);_0x16d7ba[_0xda47('0x38')]=_[_0xda47('0x39')](_0x16d7ba[_0xda47('0x3a')],_0x16d7ba['query']);_0x5eea02[_0xda47('0x3b')]=_[_0xda47('0x39')](_0x16d7ba[_0xda47('0x3a')],qs['fields'](_0x567d30[_0xda47('0x36')][_0xda47('0x3c')]));_0x5eea02[_0xda47('0x3b')]=_0x5eea02['attributes'][_0xda47('0x3d')]?_0x5eea02['attributes']:_0x16d7ba[_0xda47('0x3a')];if(!_0x567d30['query'][_0xda47('0x3e')](_0xda47('0x3f'))){_0x5eea02[_0xda47('0x23')]=qs[_0xda47('0x23')](_0x567d30[_0xda47('0x36')]['limit']);_0x5eea02[_0xda47('0x22')]=qs[_0xda47('0x22')](_0x567d30[_0xda47('0x36')][_0xda47('0x22')]);}_0x5eea02[_0xda47('0x40')]=qs[_0xda47('0x41')](_0x567d30[_0xda47('0x36')]['sort']);_0x5eea02['where']=qs[_0xda47('0x38')](_[_0xda47('0x42')](_0x567d30[_0xda47('0x36')],_0x16d7ba[_0xda47('0x38')]),_0x34ef37);if(_0x567d30[_0xda47('0x36')][_0xda47('0x43')]){_0x5eea02[_0xda47('0x44')]=_[_0xda47('0x45')](_0x5eea02[_0xda47('0x44')],{'$or':_[_0xda47('0x31')](_0x34ef37,function(_0x3bdc9d){if(_0x3bdc9d[_0xda47('0x46')]!=='VIRTUAL'){var _0x39fce1={};_0x39fce1[_0x3bdc9d[_0xda47('0x2f')]]={'$like':'%'+_0x567d30['query'][_0xda47('0x43')]+'%'};return _0x39fce1;}})});}_0x5eea02=_[_0xda47('0x45')]({},_0x5eea02,_0x567d30[_0xda47('0x47')]);var _0x39ee54={'where':_0x5eea02[_0xda47('0x44')]};return db[_0xda47('0x32')]['count'](_0x39ee54)[_0xda47('0x2d')](function(_0x4d7f6f){_0x42840b[_0xda47('0x25')]=_0x4d7f6f;if(_0x567d30[_0xda47('0x36')]['includeAll']){_0x5eea02[_0xda47('0x48')]=[{'all':!![]}];}return db['MailQueue']['findAll'](_0x5eea02);})[_0xda47('0x2d')](function(_0x5b16b1){_0x42840b[_0xda47('0x49')]=_0x5b16b1;return _0x42840b;})[_0xda47('0x2d')](respondWithFilteredResult(_0xeec800,_0x5eea02))['catch'](handleError(_0xeec800,null));};exports[_0xda47('0x4a')]=function(_0x273dba,_0x1333c3){var _0x1bb0a3={'raw':!![],'where':{'id':_0x273dba[_0xda47('0x4b')]['id']}},_0xf48916={};_0xf48916[_0xda47('0x3a')]=_[_0xda47('0x37')](db['MailQueue'][_0xda47('0x33')]);_0xf48916[_0xda47('0x36')]=_[_0xda47('0x37')](_0x273dba[_0xda47('0x36')]);_0xf48916['filters']=_['intersection'](_0xf48916['model'],_0xf48916['query']);_0x1bb0a3['attributes']=_[_0xda47('0x39')](_0xf48916[_0xda47('0x3a')],qs[_0xda47('0x3c')](_0x273dba[_0xda47('0x36')][_0xda47('0x3c')]));_0x1bb0a3[_0xda47('0x3b')]=_0x1bb0a3['attributes']['length']?_0x1bb0a3['attributes']:_0xf48916[_0xda47('0x3a')];if(_0x273dba[_0xda47('0x36')][_0xda47('0x4c')]){_0x1bb0a3[_0xda47('0x48')]=[{'all':!![]}];}_0x1bb0a3=_['merge']({},_0x1bb0a3,_0x273dba[_0xda47('0x47')]);return db[_0xda47('0x32')][_0xda47('0x4d')](_0x1bb0a3)[_0xda47('0x2d')](handleEntityNotFound(_0x1333c3,null))['then'](respondWithResult(_0x1333c3,null))['catch'](handleError(_0x1333c3,null));};exports[_0xda47('0x4e')]=function(_0x157155,_0x3cdb3f){return db['MailQueue'][_0xda47('0x4e')](_0x157155[_0xda47('0x4f')],{})[_0xda47('0x2d')](function(_0x2ee7d9){var _0x2b5569=_0x157155[_0xda47('0x50')][_0xda47('0x51')]({'plain':!![]});if(!_0x2b5569)throw new Error(_0xda47('0x52'));if(_0x2b5569[_0xda47('0x53')]==='user'){var _0xdcdb62=_0x2ee7d9['get']({'plain':!![]});var _0x4a7ffe=_0xda47('0x54');return db[_0xda47('0x55')][_0xda47('0x4d')]({'where':{'name':_0x4a7ffe,'userProfileId':_0x2b5569['userProfileId']},'raw':!![]})[_0xda47('0x2d')](function(_0x34f54a){if(_0x34f54a&&_0x34f54a[_0xda47('0x56')]===0x0){return db[_0xda47('0x2c')][_0xda47('0x4e')]({'name':_0xdcdb62[_0xda47('0x2f')],'resourceId':_0xdcdb62['id'],'type':_0x34f54a[_0xda47('0x2f')],'sectionId':_0x34f54a['id']},{})[_0xda47('0x2d')](function(){return _0x2ee7d9;});}else{return _0x2ee7d9;}})[_0xda47('0x57')](function(_0x9f8105){logger['error'](_0xda47('0x58'),_0x9f8105);throw _0x9f8105;});}return _0x2ee7d9;})['then'](respondWithResult(_0x3cdb3f,0xc9))['catch'](handleError(_0x3cdb3f,null));};exports[_0xda47('0x2a')]=function(_0x68188,_0x215e0e){if(_0x68188[_0xda47('0x4f')]['id']){delete _0x68188[_0xda47('0x4f')]['id'];}return db[_0xda47('0x32')][_0xda47('0x4d')]({'where':{'id':_0x68188[_0xda47('0x4b')]['id']}})[_0xda47('0x2d')](handleEntityNotFound(_0x215e0e,null))[_0xda47('0x2d')](saveUpdates(_0x68188['body'],null))[_0xda47('0x2d')](respondWithResult(_0x215e0e,null))['catch'](handleError(_0x215e0e,null));};exports['destroy']=function(_0x1a148f,_0x44fc86){return db[_0xda47('0x32')][_0xda47('0x4d')]({'where':{'id':_0x1a148f[_0xda47('0x4b')]['id']}})[_0xda47('0x2d')](handleEntityNotFound(_0x44fc86,null))[_0xda47('0x2d')](removeEntity(_0x44fc86,null))[_0xda47('0x57')](handleError(_0x44fc86,null));};exports['describe']=function(_0x222b01,_0x115d4d){return db[_0xda47('0x32')][_0xda47('0x59')]()[_0xda47('0x2d')](respondWithResult(_0x115d4d,null))[_0xda47('0x57')](handleError(_0x115d4d,null));};exports[_0xda47('0x5a')]=function(_0x5316d1,_0x2bdfda,_0x236437){var _0x43d98b={'raw':!![],'where':{}},_0x3da70f={},_0x4654ca;return db[_0xda47('0x32')]['findOne']({'where':{'id':_0x5316d1[_0xda47('0x4b')]['id']}})[_0xda47('0x2d')](handleEntityNotFound(_0x2bdfda,null))[_0xda47('0x2d')](function(_0x111d85){if(_0x111d85){_0x4654ca=_0x111d85['get']({'plain':!![]});_0x3da70f['model']=_[_0xda47('0x37')](db['UserMailQueue'][_0xda47('0x33')]);_0x3da70f['query']=_[_0xda47('0x37')](_0x5316d1[_0xda47('0x36')]);_0x3da70f[_0xda47('0x38')]=_[_0xda47('0x39')](_0x3da70f[_0xda47('0x3a')],_0x3da70f['query']);_0x43d98b['attributes']=_[_0xda47('0x39')](_0x3da70f['model'],qs[_0xda47('0x3c')](_0x5316d1['query'][_0xda47('0x3c')]));_0x43d98b[_0xda47('0x3b')]=_0x43d98b[_0xda47('0x3b')][_0xda47('0x3d')]?_0x43d98b[_0xda47('0x3b')]:_0x3da70f[_0xda47('0x3a')];if(!_0x5316d1[_0xda47('0x36')][_0xda47('0x3e')](_0xda47('0x3f'))){_0x43d98b['limit']=qs[_0xda47('0x23')](_0x5316d1[_0xda47('0x36')][_0xda47('0x23')]);_0x43d98b[_0xda47('0x22')]=qs[_0xda47('0x22')](_0x5316d1[_0xda47('0x36')]['offset']);}_0x43d98b[_0xda47('0x40')]=qs[_0xda47('0x41')](_0x5316d1['query'][_0xda47('0x41')]);_0x43d98b['where']=qs[_0xda47('0x38')](_[_0xda47('0x42')](_0x5316d1[_0xda47('0x36')],_0x3da70f['filters']));_0x43d98b[_0xda47('0x44')]['MailQueueId']=_0x111d85['id'];if(_0x5316d1[_0xda47('0x36')][_0xda47('0x43')]){_0x43d98b['where']=_[_0xda47('0x45')](_0x43d98b[_0xda47('0x44')],{'$or':_[_0xda47('0x31')](_0x43d98b['attributes'],function(_0x35738a){var _0x247872={};_0x247872[_0x35738a]={'$like':'%'+_0x5316d1[_0xda47('0x36')]['filter']+'%'};return _0x247872;})});}_0x43d98b=_[_0xda47('0x45')]({},_0x43d98b,_0x5316d1[_0xda47('0x47')]);return db['UserMailQueue'][_0xda47('0x5b')](_0x43d98b);}})['then'](function(_0x13ecd8){if(_0x13ecd8){return db['User']['findAndCountAll']({'where':{'id':_[_0xda47('0x31')](_0x13ecd8,_0xda47('0x5c')),'role':_0xda47('0x5d')},'attributes':['id',_0xda47('0x2f'),_0xda47('0x5e'),_0xda47('0x5f'),_0xda47('0x60')]});}})['then'](function(_0x2a6e1f){if(_0x2a6e1f){return{'count':_0x2a6e1f[_0xda47('0x25')],'rows':_['map'](_0x2a6e1f[_0xda47('0x49')],function(_0x42ab72){return{'membername':_0x42ab72['name'],'UserId':_0x42ab72['id'],'queue_name':_0x4654ca[_0xda47('0x2f')],'MailQueueId':_0x4654ca['id'],'interface':util[_0xda47('0x61')]('%s/%s',_0xda47('0x62'),_0x42ab72[_0xda47('0x2f')]),'penalty':0x0,'paused':_0x42ab72[_0xda47('0x5e')],'createdAt':_0x42ab72[_0xda47('0x60')],'updatedAt':_0x42ab72[_0xda47('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xda47('0x2d')](respondWithFilteredResult(_0x2bdfda,_0x43d98b))[_0xda47('0x57')](handleError(_0x2bdfda,null));};exports[_0xda47('0x63')]=function(_0x512a19,_0x47b891,_0x3fee8f){var _0x403819={};var _0x2f702c={};var _0x1b76d9;var _0x24d413;return db[_0xda47('0x32')][_0xda47('0x64')]({'where':{'id':_0x512a19[_0xda47('0x4b')]['id']}})[_0xda47('0x2d')](handleEntityNotFound(_0x47b891,null))[_0xda47('0x2d')](function(_0x3892c6){if(_0x3892c6){_0x1b76d9=_0x3892c6;_0x2f702c[_0xda47('0x3a')]=_[_0xda47('0x37')](db[_0xda47('0x65')][_0xda47('0x33')]);_0x2f702c[_0xda47('0x36')]=_['keys'](_0x512a19[_0xda47('0x36')]);_0x2f702c[_0xda47('0x38')]=_[_0xda47('0x39')](_0x2f702c['model'],_0x2f702c[_0xda47('0x36')]);_0x403819[_0xda47('0x3b')]=_[_0xda47('0x39')](_0x2f702c[_0xda47('0x3a')],qs['fields'](_0x512a19[_0xda47('0x36')][_0xda47('0x3c')]));_0x403819[_0xda47('0x3b')]=_0x403819[_0xda47('0x3b')]['length']?_0x403819[_0xda47('0x3b')]:_0x2f702c[_0xda47('0x3a')];_0x403819[_0xda47('0x40')]=qs[_0xda47('0x41')](_0x512a19[_0xda47('0x36')][_0xda47('0x41')]);_0x403819[_0xda47('0x44')]=qs[_0xda47('0x38')](_[_0xda47('0x42')](_0x512a19[_0xda47('0x36')],_0x2f702c[_0xda47('0x38')]));if(_0x512a19[_0xda47('0x36')]['filter']){_0x403819[_0xda47('0x44')]=_[_0xda47('0x45')](_0x403819[_0xda47('0x44')],{'$or':_[_0xda47('0x31')](_0x403819['attributes'],function(_0x58b5c7){var _0x162786={};_0x162786[_0x58b5c7]={'$like':'%'+_0x512a19[_0xda47('0x36')][_0xda47('0x43')]+'%'};return _0x162786;})});}_0x403819=_[_0xda47('0x45')]({},_0x403819,_0x512a19[_0xda47('0x47')]);return _0x1b76d9[_0xda47('0x63')](_0x403819);}})['then'](function(_0x105642){if(_0x105642){_0x24d413=_0x105642[_0xda47('0x3d')];if(!_0x512a19['query']['hasOwnProperty'](_0xda47('0x3f'))){_0x403819['limit']=qs[_0xda47('0x23')](_0x512a19['query']['limit']);_0x403819['offset']=qs[_0xda47('0x22')](_0x512a19[_0xda47('0x36')][_0xda47('0x22')]);}return _0x1b76d9[_0xda47('0x63')](_0x403819);}})['then'](function(_0x55722f){if(_0x55722f){return _0x55722f?{'count':_0x24d413,'rows':_0x55722f}:null;}})[_0xda47('0x2d')](respondWithResult(_0x47b891,null))[_0xda47('0x57')](handleError(_0x47b891,null));};exports[_0xda47('0x66')]=function(_0x548fa2,_0x450a41,_0x1d7f36){var _0x38fc37=_0x548fa2[_0xda47('0x4f')]['ids'];return db['Team'][_0xda47('0x5b')]({'where':{'id':_0x38fc37},'attributes':['id'],'include':[{'model':db[_0xda47('0x67')],'as':_0xda47('0x68'),'attributes':['id',_0xda47('0x2f'),'online',_0xda47('0x69'),_0xda47('0x6a')],'raw':!![]}]})['then'](function(_0x324030){if(_0x324030){var _0x316dc2=_[_0xda47('0x6b')](_0x324030,function(_0x1b22af){var _0x4a5864=_0x1b22af[_0xda47('0x51')]({'plain':!![]});return _0x4a5864['Agents'];});return db[_0xda47('0x32')]['find']({'where':{'id':_0x548fa2['params']['id']}})[_0xda47('0x2d')](function(_0x257591){return db[_0xda47('0x6c')][_0xda47('0x6d')](function(_0x562a03){return _0x257591[_0xda47('0x66')](_0x38fc37,{'transaction':_0x562a03})[_0xda47('0x2d')](function(){return BPromise[_0xda47('0x6e')](_0x316dc2,function(_0x32f306){return db[_0xda47('0x6f')][_0xda47('0x70')]({'where':{'UserId':_0x32f306['id'],'MailQueueId':_0x548fa2['params']['id']},'transaction':_0x562a03});});})[_0xda47('0x2d')](function(){_0x316dc2[_0xda47('0x71')](function(_0x52ee14){socket[_0xda47('0x72')](_0xda47('0x73'),{'UserId':_0x52ee14['id'],'MailQueueId':_0x257591['id']});});});});});}})['then'](respondWithStatusCode(_0x450a41,null))[_0xda47('0x57')](handleError(_0x450a41,null));};exports['removeTeams']=function(_0xaf64b0,_0x453466,_0x9dd2d6){return db[_0xda47('0x65')][_0xda47('0x5b')]({'where':{'id':_0xaf64b0[_0xda47('0x36')][_0xda47('0x74')]},'attributes':['id'],'include':[{'model':db[_0xda47('0x67')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xda47('0x2d')](handleEntityNotFound(_0x453466,null))[_0xda47('0x2d')](function(_0xfac715){var _0x1b25af=_[_0xda47('0x31')](_0xfac715,'id');var _0x28de88=[];var _0x3af656=[];var _0x32a0ae=squel['select']();_0x32a0ae[_0xda47('0x75')](_0xda47('0x76'))[_0xda47('0x77')]('team_has_mail_queues','tq')[_0xda47('0x78')](_0xda47('0x79'),'ut',_0xda47('0x7a'))[_0xda47('0x44')](_0xda47('0x7b'),_0xaf64b0[_0xda47('0x4b')]['id']);for(var _0x51cf69=0x0;_0x51cf69<_0xfac715[_0xda47('0x3d')];_0x51cf69+=0x1){let _0x57fba8=_0xfac715[_0x51cf69];for(var _0x107f60=0x0;_0x107f60<_0x57fba8[_0xda47('0x68')][_0xda47('0x3d')];_0x107f60+=0x1){let _0x4136a4=_0x57fba8['Agents'][_0x107f60];var _0x48d31c=_0x32a0ae[_0xda47('0x7c')]();_0x48d31c[_0xda47('0x44')](_0xda47('0x7d'),_0x4136a4['id']);_0x3af656[_0xda47('0x7e')](db[_0xda47('0x6c')]['query'](_0x48d31c['toString'](),{'type':db[_0xda47('0x6c')][_0xda47('0x7f')][_0xda47('0x80')]})['then'](function(_0x81c5d5){if(_0x81c5d5[_0xda47('0x3d')]===0x1){return _0x4136a4['id'];}else{var _0x1f5c62=_[_0xda47('0x81')](_['map'](_0x81c5d5,_0xda47('0x82')),function(_0x240f6d){return _[_0xda47('0x83')](_0x1b25af,_0x240f6d);});if(_0x1f5c62){return _0x4136a4['id'];}}}));}}return BPromise['all'](_0x3af656)[_0xda47('0x2d')](function(_0x4b777d){_0x28de88=_(_0x28de88)[_0xda47('0x84')](_0x4b777d)[_0xda47('0x85')]()['value']();return db['MailQueue'][_0xda47('0x4d')]({'where':{'id':_0xaf64b0[_0xda47('0x4b')]['id']}})[_0xda47('0x2d')](function(_0x1b6588){return db[_0xda47('0x6c')]['transaction'](function(_0x2dd64a){return _0x1b6588['removeTeams'](_0xaf64b0[_0xda47('0x36')][_0xda47('0x74')],{'transaction':_0x2dd64a})['then'](function(){if(!_['isEmpty'](_0x28de88)){return _0x1b6588[_0xda47('0x86')](_0x28de88,{'transaction':_0x2dd64a});}})[_0xda47('0x2d')](function(){_0x28de88[_0xda47('0x71')](function(_0x4f6606){socket[_0xda47('0x72')](_0xda47('0x87'),{'UserId':_0x4f6606,'MailQueueId':_0x1b6588['id']});});});});});});})['then'](respondWithStatusCode(_0x453466,null))[_0xda47('0x57')](handleError(_0x453466,null));};exports['addAgents']=function(_0x4aa7b7,_0x571f2c,_0x2fb4c9){return db['MailQueue']['find']({'where':{'id':_0x4aa7b7['params']['id']}})[_0xda47('0x2d')](handleEntityNotFound(_0x571f2c,null))['then'](function(_0x719a72){if(_0x719a72){return _0x719a72[_0xda47('0x88')](_0x4aa7b7['body'][_0xda47('0x74')],_[_0xda47('0x89')](_0x4aa7b7['body'],[_0xda47('0x74'),'id'])||{})['spread'](function(_0x462949){for(var _0x4d5870=0x0;_0x4d5870<_0x4aa7b7['body'][_0xda47('0x74')]['length'];_0x4d5870+=0x1){socket['emit'](_0xda47('0x73'),{'UserId':Number(_0x4aa7b7['body'][_0xda47('0x74')][_0x4d5870]),'MailQueueId':Number(_0x4aa7b7['params']['id'])});}return _0x462949;});}})[_0xda47('0x2d')](respondWithResult(_0x571f2c,null))[_0xda47('0x57')](handleError(_0x571f2c,null));};exports[_0xda47('0x86')]=function(_0x1ae71b,_0x2fd56b,_0x510630){return db[_0xda47('0x32')]['find']({'where':{'id':_0x1ae71b[_0xda47('0x4b')]['id']}})[_0xda47('0x2d')](handleEntityNotFound(_0x2fd56b,null))[_0xda47('0x2d')](function(_0x275e4a){if(_0x275e4a){return _0x275e4a[_0xda47('0x86')](_0x1ae71b[_0xda47('0x36')][_0xda47('0x74')])[_0xda47('0x2d')](function(){if(_[_0xda47('0x8a')](_0x1ae71b[_0xda47('0x36')][_0xda47('0x74')])){for(var _0x2ec6ed=0x0;_0x2ec6ed<_0x1ae71b['query']['ids']['length'];_0x2ec6ed+=0x1){socket[_0xda47('0x72')](_0xda47('0x87'),{'UserId':Number(_0x1ae71b[_0xda47('0x36')]['ids'][_0x2ec6ed]),'MailQueueId':Number(_0x1ae71b[_0xda47('0x4b')]['id'])});}}else{socket[_0xda47('0x72')](_0xda47('0x87'),{'UserId':Number(_0x1ae71b['query'][_0xda47('0x74')]),'MailQueueId':Number(_0x1ae71b[_0xda47('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x2fd56b,null))['catch'](handleError(_0x2fd56b,null));};exports['getAgents']=function(_0x25279d,_0x28c6c9,_0x6bde1){var _0x452b96={};var _0x83406f={};var _0x5eedfb;var _0x2d90da;return db[_0xda47('0x32')][_0xda47('0x64')]({'where':{'id':_0x25279d[_0xda47('0x4b')]['id']}})[_0xda47('0x2d')](handleEntityNotFound(_0x28c6c9,null))[_0xda47('0x2d')](function(_0x2e2af5){if(_0x2e2af5){_0x5eedfb=_0x2e2af5;_0x83406f['model']=_[_0xda47('0x37')](db[_0xda47('0x67')][_0xda47('0x33')]);_0x83406f[_0xda47('0x36')]=_[_0xda47('0x37')](_0x25279d[_0xda47('0x36')]);_0x83406f[_0xda47('0x38')]=_[_0xda47('0x39')](_0x83406f[_0xda47('0x3a')],_0x83406f[_0xda47('0x36')]);_0x452b96[_0xda47('0x3b')]=_[_0xda47('0x39')](_0x83406f[_0xda47('0x3a')],qs[_0xda47('0x3c')](_0x25279d[_0xda47('0x36')]['fields']));_0x452b96[_0xda47('0x3b')]=_0x452b96[_0xda47('0x3b')][_0xda47('0x3d')]?_0x452b96[_0xda47('0x3b')]:_0x83406f['model'];_0x452b96[_0xda47('0x40')]=qs[_0xda47('0x41')](_0x25279d[_0xda47('0x36')][_0xda47('0x41')]);_0x452b96[_0xda47('0x44')]=qs['filters'](_['pick'](_0x25279d[_0xda47('0x36')],_0x83406f[_0xda47('0x38')]));if(_0x25279d[_0xda47('0x36')][_0xda47('0x43')]){_0x452b96[_0xda47('0x44')]=_[_0xda47('0x45')](_0x452b96['where'],{'$or':_[_0xda47('0x31')](_0x452b96[_0xda47('0x3b')],function(_0x28c40c){var _0x2ee889={};_0x2ee889[_0x28c40c]={'$like':'%'+_0x25279d[_0xda47('0x36')]['filter']+'%'};return _0x2ee889;})});}_0x452b96=_[_0xda47('0x45')]({},_0x452b96,_0x25279d[_0xda47('0x47')]);return _0x5eedfb[_0xda47('0x8b')](_0x452b96);}})[_0xda47('0x2d')](function(_0x50fd41){if(_0x50fd41){_0x2d90da=_0x50fd41[_0xda47('0x3d')];if(!_0x25279d[_0xda47('0x36')][_0xda47('0x3e')](_0xda47('0x3f'))){_0x452b96['limit']=qs[_0xda47('0x23')](_0x25279d[_0xda47('0x36')][_0xda47('0x23')]);_0x452b96[_0xda47('0x22')]=qs['offset'](_0x25279d['query'][_0xda47('0x22')]);}return _0x5eedfb[_0xda47('0x8b')](_0x452b96);}})[_0xda47('0x2d')](function(_0x414b01){if(_0x414b01){return _0x414b01?{'count':_0x2d90da,'rows':_0x414b01}:null;}})[_0xda47('0x2d')](respondWithResult(_0x28c6c9,null))['catch'](handleError(_0x28c6c9,null));}; \ No newline at end of file +var _0x86e4=['%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.UserId\x20=\x20?','push','toString','QueryTypes','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','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','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','end','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','error','name','send','index','map','MailQueue','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','params','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','rows','format'];(function(_0x57f6ad,_0x4795b6){var _0x425c09=function(_0xac3ba6){while(--_0xac3ba6){_0x57f6ad['push'](_0x57f6ad['shift']());}};_0x425c09(++_0x4795b6);}(_0x86e4,0x149));var _0x486e=function(_0x35e92e,_0x21581b){_0x35e92e=_0x35e92e-0x0;var _0x1205a8=_0x86e4[_0x35e92e];return _0x1205a8;};'use strict';var emlformat=require(_0x486e('0x0'));var rimraf=require(_0x486e('0x1'));var zipdir=require(_0x486e('0x2'));var jsonpatch=require(_0x486e('0x3'));var rp=require(_0x486e('0x4'));var moment=require(_0x486e('0x5'));var BPromise=require(_0x486e('0x6'));var Mustache=require(_0x486e('0x7'));var util=require(_0x486e('0x8'));var path=require(_0x486e('0x9'));var sox=require(_0x486e('0xa'));var csv=require(_0x486e('0xb'));var ejs=require(_0x486e('0xc'));var fs=require('fs');var fs_extra=require(_0x486e('0xd'));var _=require('lodash');var squel=require(_0x486e('0xe'));var crypto=require(_0x486e('0xf'));var jsforce=require(_0x486e('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x486e('0xb'));var querystring=require(_0x486e('0x11'));var Papa=require(_0x486e('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x486e('0x13'));var as=require(_0x486e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x486e('0x15'))(_0x486e('0x16'));var utils=require(_0x486e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x486e('0x18'));var db=require(_0x486e('0x19'))['db'];config[_0x486e('0x1a')]=_[_0x486e('0x1b')](config[_0x486e('0x1a')],{'host':_0x486e('0x1c'),'port':0x18eb});var socket=require(_0x486e('0x1d'))(new Redis(config[_0x486e('0x1a')]));require('./mailQueue.socket')[_0x486e('0x1e')](socket);function respondWithStatusCode(_0x3882e7,_0x44a56f){_0x44a56f=_0x44a56f||0xcc;return function(_0x421462){if(_0x421462){return _0x3882e7['sendStatus'](_0x44a56f);}return _0x3882e7['status'](_0x44a56f)[_0x486e('0x1f')]();};}function respondWithResult(_0xd32291,_0x37a2d7){_0x37a2d7=_0x37a2d7||0xc8;return function(_0x2be5a5){if(_0x2be5a5){return _0xd32291[_0x486e('0x20')](_0x37a2d7)[_0x486e('0x21')](_0x2be5a5);}};}function respondWithFilteredResult(_0x217f24,_0x1cffe7){return function(_0x4bc2ed){if(_0x4bc2ed){var _0x171c8f=typeof _0x1cffe7[_0x486e('0x22')]===_0x486e('0x23')&&typeof _0x1cffe7[_0x486e('0x24')]==='undefined';var _0x2f12ec=_0x4bc2ed['count'];var _0x4c9c4e=_0x171c8f?0x0:_0x1cffe7[_0x486e('0x22')];var _0x3f5a62=_0x171c8f?_0x4bc2ed[_0x486e('0x25')]:_0x1cffe7['offset']+_0x1cffe7['limit'];var _0xa33730;if(_0x3f5a62>=_0x2f12ec){_0x3f5a62=_0x2f12ec;_0xa33730=0xc8;}else{_0xa33730=0xce;}_0x217f24[_0x486e('0x20')](_0xa33730);return _0x217f24['set']('Content-Range',_0x4c9c4e+'-'+_0x3f5a62+'/'+_0x2f12ec)[_0x486e('0x21')](_0x4bc2ed);}return null;};}function patchUpdates(_0x2069f1){return function(_0x57d29c){try{jsonpatch[_0x486e('0x26')](_0x57d29c,_0x2069f1,!![]);}catch(_0x122425){return BPromise[_0x486e('0x27')](_0x122425);}return _0x57d29c[_0x486e('0x28')]();};}function saveUpdates(_0x1a9244,_0xf6979f){return function(_0x12d1b5){if(_0x12d1b5){return _0x12d1b5[_0x486e('0x29')](_0x1a9244)[_0x486e('0x2a')](function(_0x18ed34){return _0x18ed34;});}return null;};}function removeEntity(_0x2e704e,_0x5ee66e){return function(_0x170202){if(_0x170202){return _0x170202[_0x486e('0x2b')]()[_0x486e('0x2a')](function(){var _0x1daf71=_0x170202[_0x486e('0x2c')]({'plain':!![]});var _0x518577=_0x486e('0x2d');return db[_0x486e('0x2e')]['destroy']({'where':{'type':_0x518577,'resourceId':_0x1daf71['id']}})[_0x486e('0x2a')](function(){return _0x170202;});})['then'](function(){_0x2e704e[_0x486e('0x20')](0xcc)[_0x486e('0x1f')]();});}};}function handleEntityNotFound(_0x357aa8,_0x39c872){return function(_0x2874d3){if(!_0x2874d3){_0x357aa8['sendStatus'](0x194);}return _0x2874d3;};}function handleError(_0x14bdc7,_0xf51698){_0xf51698=_0xf51698||0x1f4;return function(_0xef599b){logger[_0x486e('0x2f')](_0xef599b['stack']);if(_0xef599b[_0x486e('0x30')]){delete _0xef599b[_0x486e('0x30')];}_0x14bdc7['status'](_0xf51698)[_0x486e('0x31')](_0xef599b);};}exports[_0x486e('0x32')]=function(_0x2880b1,_0x571452){var _0x5c7d4c={},_0x37ac19={},_0x3ec5e6={'count':0x0,'rows':[]};var _0x12cb6f=_[_0x486e('0x33')](db[_0x486e('0x34')][_0x486e('0x35')],function(_0x45e26b){return{'name':_0x45e26b[_0x486e('0x36')],'type':_0x45e26b[_0x486e('0x37')]['key']};});_0x37ac19[_0x486e('0x38')]=_['map'](_0x12cb6f,_0x486e('0x30'));_0x37ac19[_0x486e('0x39')]=_[_0x486e('0x3a')](_0x2880b1[_0x486e('0x39')]);_0x37ac19[_0x486e('0x3b')]=_[_0x486e('0x3c')](_0x37ac19[_0x486e('0x38')],_0x37ac19['query']);_0x5c7d4c[_0x486e('0x3d')]=_[_0x486e('0x3c')](_0x37ac19[_0x486e('0x38')],qs[_0x486e('0x3e')](_0x2880b1[_0x486e('0x39')]['fields']));_0x5c7d4c[_0x486e('0x3d')]=_0x5c7d4c[_0x486e('0x3d')]['length']?_0x5c7d4c[_0x486e('0x3d')]:_0x37ac19[_0x486e('0x38')];if(!_0x2880b1[_0x486e('0x39')][_0x486e('0x3f')](_0x486e('0x40'))){_0x5c7d4c['limit']=qs[_0x486e('0x24')](_0x2880b1[_0x486e('0x39')][_0x486e('0x24')]);_0x5c7d4c[_0x486e('0x22')]=qs[_0x486e('0x22')](_0x2880b1[_0x486e('0x39')][_0x486e('0x22')]);}_0x5c7d4c[_0x486e('0x41')]=qs[_0x486e('0x42')](_0x2880b1[_0x486e('0x39')][_0x486e('0x42')]);_0x5c7d4c[_0x486e('0x43')]=qs[_0x486e('0x3b')](_[_0x486e('0x44')](_0x2880b1['query'],_0x37ac19[_0x486e('0x3b')]),_0x12cb6f);if(_0x2880b1['query'][_0x486e('0x45')]){_0x5c7d4c['where']=_[_0x486e('0x46')](_0x5c7d4c[_0x486e('0x43')],{'$or':_[_0x486e('0x33')](_0x12cb6f,function(_0x174060){if(_0x174060['type']!==_0x486e('0x47')){var _0x198e47={};_0x198e47[_0x174060['name']]={'$like':'%'+_0x2880b1[_0x486e('0x39')][_0x486e('0x45')]+'%'};return _0x198e47;}})});}_0x5c7d4c=_[_0x486e('0x46')]({},_0x5c7d4c,_0x2880b1[_0x486e('0x48')]);var _0x2b9271={'where':_0x5c7d4c[_0x486e('0x43')]};return db['MailQueue'][_0x486e('0x25')](_0x2b9271)[_0x486e('0x2a')](function(_0x9a4cd8){_0x3ec5e6[_0x486e('0x25')]=_0x9a4cd8;if(_0x2880b1[_0x486e('0x39')]['includeAll']){_0x5c7d4c[_0x486e('0x49')]=[{'all':!![]}];}return db['MailQueue'][_0x486e('0x4a')](_0x5c7d4c);})[_0x486e('0x2a')](function(_0x5f1de2){_0x3ec5e6['rows']=_0x5f1de2;return _0x3ec5e6;})[_0x486e('0x2a')](respondWithFilteredResult(_0x571452,_0x5c7d4c))['catch'](handleError(_0x571452,null));};exports['show']=function(_0x3aeb08,_0x5de816){var _0x5d422={'raw':!![],'where':{'id':_0x3aeb08[_0x486e('0x4b')]['id']}},_0x4978c4={};_0x4978c4['model']=_['keys'](db[_0x486e('0x34')]['rawAttributes']);_0x4978c4[_0x486e('0x39')]=_[_0x486e('0x3a')](_0x3aeb08[_0x486e('0x39')]);_0x4978c4['filters']=_[_0x486e('0x3c')](_0x4978c4['model'],_0x4978c4[_0x486e('0x39')]);_0x5d422['attributes']=_[_0x486e('0x3c')](_0x4978c4['model'],qs[_0x486e('0x3e')](_0x3aeb08[_0x486e('0x39')]['fields']));_0x5d422[_0x486e('0x3d')]=_0x5d422[_0x486e('0x3d')][_0x486e('0x4c')]?_0x5d422['attributes']:_0x4978c4[_0x486e('0x38')];if(_0x3aeb08[_0x486e('0x39')][_0x486e('0x4d')]){_0x5d422['include']=[{'all':!![]}];}_0x5d422=_['merge']({},_0x5d422,_0x3aeb08[_0x486e('0x48')]);return db['MailQueue'][_0x486e('0x4e')](_0x5d422)['then'](handleEntityNotFound(_0x5de816,null))['then'](respondWithResult(_0x5de816,null))['catch'](handleError(_0x5de816,null));};exports[_0x486e('0x4f')]=function(_0x50ecaf,_0x5eea4b){return db[_0x486e('0x34')]['create'](_0x50ecaf[_0x486e('0x50')],{})['then'](function(_0x133fac){var _0x40bfcf=_0x50ecaf[_0x486e('0x51')][_0x486e('0x2c')]({'plain':!![]});if(!_0x40bfcf)throw new Error(_0x486e('0x52'));if(_0x40bfcf[_0x486e('0x53')]===_0x486e('0x51')){var _0x3dfaa4=_0x133fac[_0x486e('0x2c')]({'plain':!![]});var _0x123ff8=_0x486e('0x2d');return db[_0x486e('0x54')][_0x486e('0x4e')]({'where':{'name':_0x123ff8,'userProfileId':_0x40bfcf[_0x486e('0x55')]},'raw':!![]})[_0x486e('0x2a')](function(_0x1c5598){if(_0x1c5598&&_0x1c5598[_0x486e('0x56')]===0x0){return db[_0x486e('0x2e')][_0x486e('0x4f')]({'name':_0x3dfaa4[_0x486e('0x30')],'resourceId':_0x3dfaa4['id'],'type':_0x1c5598['name'],'sectionId':_0x1c5598['id']},{})[_0x486e('0x2a')](function(){return _0x133fac;});}else{return _0x133fac;}})[_0x486e('0x57')](function(_0x3b9f3e){logger['error'](_0x486e('0x58'),_0x3b9f3e);throw _0x3b9f3e;});}return _0x133fac;})[_0x486e('0x2a')](respondWithResult(_0x5eea4b,0xc9))[_0x486e('0x57')](handleError(_0x5eea4b,null));};exports[_0x486e('0x29')]=function(_0x2a6be6,_0x77ce3e){if(_0x2a6be6[_0x486e('0x50')]['id']){delete _0x2a6be6[_0x486e('0x50')]['id'];}return db[_0x486e('0x34')][_0x486e('0x4e')]({'where':{'id':_0x2a6be6['params']['id']}})[_0x486e('0x2a')](handleEntityNotFound(_0x77ce3e,null))[_0x486e('0x2a')](saveUpdates(_0x2a6be6[_0x486e('0x50')],null))['then'](respondWithResult(_0x77ce3e,null))['catch'](handleError(_0x77ce3e,null));};exports[_0x486e('0x2b')]=function(_0x3465d5,_0xfd3065){return db['MailQueue'][_0x486e('0x4e')]({'where':{'id':_0x3465d5[_0x486e('0x4b')]['id']}})[_0x486e('0x2a')](handleEntityNotFound(_0xfd3065,null))['then'](removeEntity(_0xfd3065,null))[_0x486e('0x57')](handleError(_0xfd3065,null));};exports['describe']=function(_0x1d75a3,_0x164d0c){return db[_0x486e('0x34')][_0x486e('0x59')]()['then'](respondWithResult(_0x164d0c,null))[_0x486e('0x57')](handleError(_0x164d0c,null));};exports[_0x486e('0x5a')]=function(_0x313b25,_0x25ab80,_0x5da41d){var _0x1ed638={'raw':!![],'where':{}},_0x13e2ba={},_0x19a579;return db[_0x486e('0x34')][_0x486e('0x5b')]({'where':{'id':_0x313b25['params']['id']}})[_0x486e('0x2a')](handleEntityNotFound(_0x25ab80,null))['then'](function(_0x252c92){if(_0x252c92){_0x19a579=_0x252c92[_0x486e('0x2c')]({'plain':!![]});_0x13e2ba[_0x486e('0x38')]=_[_0x486e('0x3a')](db[_0x486e('0x5c')]['rawAttributes']);_0x13e2ba[_0x486e('0x39')]=_[_0x486e('0x3a')](_0x313b25[_0x486e('0x39')]);_0x13e2ba['filters']=_[_0x486e('0x3c')](_0x13e2ba[_0x486e('0x38')],_0x13e2ba[_0x486e('0x39')]);_0x1ed638['attributes']=_[_0x486e('0x3c')](_0x13e2ba[_0x486e('0x38')],qs[_0x486e('0x3e')](_0x313b25[_0x486e('0x39')][_0x486e('0x3e')]));_0x1ed638[_0x486e('0x3d')]=_0x1ed638[_0x486e('0x3d')][_0x486e('0x4c')]?_0x1ed638['attributes']:_0x13e2ba[_0x486e('0x38')];if(!_0x313b25['query']['hasOwnProperty'](_0x486e('0x40'))){_0x1ed638['limit']=qs[_0x486e('0x24')](_0x313b25[_0x486e('0x39')]['limit']);_0x1ed638[_0x486e('0x22')]=qs[_0x486e('0x22')](_0x313b25[_0x486e('0x39')][_0x486e('0x22')]);}_0x1ed638[_0x486e('0x41')]=qs[_0x486e('0x42')](_0x313b25[_0x486e('0x39')][_0x486e('0x42')]);_0x1ed638[_0x486e('0x43')]=qs['filters'](_[_0x486e('0x44')](_0x313b25['query'],_0x13e2ba[_0x486e('0x3b')]));_0x1ed638['where'][_0x486e('0x5d')]=_0x252c92['id'];if(_0x313b25[_0x486e('0x39')][_0x486e('0x45')]){_0x1ed638[_0x486e('0x43')]=_['merge'](_0x1ed638[_0x486e('0x43')],{'$or':_['map'](_0x1ed638['attributes'],function(_0x395d83){var _0x1fce07={};_0x1fce07[_0x395d83]={'$like':'%'+_0x313b25['query'][_0x486e('0x45')]+'%'};return _0x1fce07;})});}_0x1ed638=_[_0x486e('0x46')]({},_0x1ed638,_0x313b25[_0x486e('0x48')]);return db[_0x486e('0x5c')]['findAll'](_0x1ed638);}})[_0x486e('0x2a')](function(_0x50a461){if(_0x50a461){return db[_0x486e('0x5e')][_0x486e('0x5f')]({'where':{'id':_[_0x486e('0x33')](_0x50a461,_0x486e('0x60')),'role':_0x486e('0x61')},'attributes':['id',_0x486e('0x30'),_0x486e('0x62'),_0x486e('0x63'),_0x486e('0x64')]});}})['then'](function(_0x43b176){if(_0x43b176){return{'count':_0x43b176[_0x486e('0x25')],'rows':_['map'](_0x43b176[_0x486e('0x65')],function(_0xf853d6){return{'membername':_0xf853d6['name'],'UserId':_0xf853d6['id'],'queue_name':_0x19a579[_0x486e('0x30')],'MailQueueId':_0x19a579['id'],'interface':util[_0x486e('0x66')](_0x486e('0x67'),_0x486e('0x68'),_0xf853d6['name']),'penalty':0x0,'paused':_0xf853d6[_0x486e('0x62')],'createdAt':_0xf853d6[_0x486e('0x64')],'updatedAt':_0xf853d6[_0x486e('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x486e('0x2a')](respondWithFilteredResult(_0x25ab80,_0x1ed638))[_0x486e('0x57')](handleError(_0x25ab80,null));};exports[_0x486e('0x69')]=function(_0x293275,_0x48a0ac,_0x19e583){var _0x4da50d={};var _0x263668={};var _0xc00ce6;var _0x201a3e;return db[_0x486e('0x34')][_0x486e('0x5b')]({'where':{'id':_0x293275[_0x486e('0x4b')]['id']}})[_0x486e('0x2a')](handleEntityNotFound(_0x48a0ac,null))['then'](function(_0x2e283b){if(_0x2e283b){_0xc00ce6=_0x2e283b;_0x263668[_0x486e('0x38')]=_['keys'](db[_0x486e('0x6a')]['rawAttributes']);_0x263668['query']=_['keys'](_0x293275[_0x486e('0x39')]);_0x263668[_0x486e('0x3b')]=_[_0x486e('0x3c')](_0x263668[_0x486e('0x38')],_0x263668[_0x486e('0x39')]);_0x4da50d[_0x486e('0x3d')]=_[_0x486e('0x3c')](_0x263668['model'],qs[_0x486e('0x3e')](_0x293275[_0x486e('0x39')]['fields']));_0x4da50d['attributes']=_0x4da50d[_0x486e('0x3d')][_0x486e('0x4c')]?_0x4da50d[_0x486e('0x3d')]:_0x263668[_0x486e('0x38')];_0x4da50d[_0x486e('0x41')]=qs[_0x486e('0x42')](_0x293275[_0x486e('0x39')][_0x486e('0x42')]);_0x4da50d[_0x486e('0x43')]=qs['filters'](_[_0x486e('0x44')](_0x293275[_0x486e('0x39')],_0x263668[_0x486e('0x3b')]));if(_0x293275[_0x486e('0x39')][_0x486e('0x45')]){_0x4da50d[_0x486e('0x43')]=_[_0x486e('0x46')](_0x4da50d[_0x486e('0x43')],{'$or':_[_0x486e('0x33')](_0x4da50d[_0x486e('0x3d')],function(_0x5b18ea){var _0x53e449={};_0x53e449[_0x5b18ea]={'$like':'%'+_0x293275[_0x486e('0x39')][_0x486e('0x45')]+'%'};return _0x53e449;})});}_0x4da50d=_[_0x486e('0x46')]({},_0x4da50d,_0x293275[_0x486e('0x48')]);return _0xc00ce6[_0x486e('0x69')](_0x4da50d);}})[_0x486e('0x2a')](function(_0x40bf19){if(_0x40bf19){_0x201a3e=_0x40bf19['length'];if(!_0x293275['query'][_0x486e('0x3f')](_0x486e('0x40'))){_0x4da50d[_0x486e('0x24')]=qs['limit'](_0x293275['query'][_0x486e('0x24')]);_0x4da50d['offset']=qs[_0x486e('0x22')](_0x293275[_0x486e('0x39')][_0x486e('0x22')]);}return _0xc00ce6[_0x486e('0x69')](_0x4da50d);}})[_0x486e('0x2a')](function(_0x4ae26b){if(_0x4ae26b){return _0x4ae26b?{'count':_0x201a3e,'rows':_0x4ae26b}:null;}})[_0x486e('0x2a')](respondWithResult(_0x48a0ac,null))[_0x486e('0x57')](handleError(_0x48a0ac,null));};exports[_0x486e('0x6b')]=function(_0x5bd70e,_0x2b0a89,_0x3cd750){var _0xb8f388=_0x5bd70e[_0x486e('0x50')][_0x486e('0x6c')];return db[_0x486e('0x6a')]['findAll']({'where':{'id':_0xb8f388},'attributes':['id'],'include':[{'model':db['User'],'as':_0x486e('0x6d'),'attributes':['id',_0x486e('0x30'),_0x486e('0x6e'),'voicePause',_0x486e('0x6f')],'raw':!![]}]})[_0x486e('0x2a')](function(_0x42e215){if(_0x42e215){var _0x3b6d49=_[_0x486e('0x70')](_0x42e215,function(_0xba54d7){var _0x24155b=_0xba54d7['get']({'plain':!![]});return _0x24155b[_0x486e('0x6d')];});return db[_0x486e('0x34')][_0x486e('0x4e')]({'where':{'id':_0x5bd70e[_0x486e('0x4b')]['id']}})[_0x486e('0x2a')](function(_0x23bd7d){return db[_0x486e('0x71')][_0x486e('0x72')](function(_0x12f795){return _0x23bd7d[_0x486e('0x6b')](_0xb8f388,{'transaction':_0x12f795})['then'](function(){return BPromise[_0x486e('0x73')](_0x3b6d49,function(_0x1a749f){return db[_0x486e('0x5c')][_0x486e('0x74')]({'where':{'UserId':_0x1a749f['id'],'MailQueueId':_0x5bd70e[_0x486e('0x4b')]['id']},'transaction':_0x12f795});});})[_0x486e('0x2a')](function(){_0x3b6d49[_0x486e('0x75')](function(_0xa47223){socket[_0x486e('0x76')](_0x486e('0x77'),{'UserId':_0xa47223['id'],'MailQueueId':_0x23bd7d['id']});});});});});}})['then'](respondWithStatusCode(_0x2b0a89,null))['catch'](handleError(_0x2b0a89,null));};exports['removeTeams']=function(_0x5f03c9,_0x4b9c16,_0x175576){return db['Team'][_0x486e('0x4a')]({'where':{'id':_0x5f03c9[_0x486e('0x39')][_0x486e('0x6c')]},'attributes':['id'],'include':[{'model':db[_0x486e('0x5e')],'as':_0x486e('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x486e('0x2a')](handleEntityNotFound(_0x4b9c16,null))[_0x486e('0x2a')](function(_0x4a6756){var _0x287d15=_['map'](_0x4a6756,'id');var _0x3226c0=[];var _0x4cf187=[];var _0x310424=squel['select']();_0x310424[_0x486e('0x78')](_0x486e('0x79'))[_0x486e('0x7a')](_0x486e('0x7b'),'tq')[_0x486e('0x7c')](_0x486e('0x7d'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x486e('0x43')]('MailQueueId\x20=\x20?',_0x5f03c9[_0x486e('0x4b')]['id']);for(var _0xdb52bf=0x0;_0xdb52bf<_0x4a6756[_0x486e('0x4c')];_0xdb52bf+=0x1){let _0x1403d0=_0x4a6756[_0xdb52bf];for(var _0x36dbaa=0x0;_0x36dbaa<_0x1403d0[_0x486e('0x6d')][_0x486e('0x4c')];_0x36dbaa+=0x1){let _0x2b6c77=_0x1403d0['Agents'][_0x36dbaa];var _0x287b80=_0x310424['clone']();_0x287b80[_0x486e('0x43')](_0x486e('0x7e'),_0x2b6c77['id']);_0x4cf187[_0x486e('0x7f')](db[_0x486e('0x71')][_0x486e('0x39')](_0x287b80[_0x486e('0x80')](),{'type':db[_0x486e('0x71')][_0x486e('0x81')]['SELECT']})[_0x486e('0x2a')](function(_0x5e4031){if(_0x5e4031[_0x486e('0x4c')]===0x1){return _0x2b6c77['id'];}else{var _0x266dd3=_['every'](_['map'](_0x5e4031,'TeamId'),function(_0x4d9568){return _[_0x486e('0x82')](_0x287d15,_0x4d9568);});if(_0x266dd3){return _0x2b6c77['id'];}}}));}}return BPromise[_0x486e('0x83')](_0x4cf187)['then'](function(_0x19943e){_0x3226c0=_(_0x3226c0)[_0x486e('0x84')](_0x19943e)[_0x486e('0x85')]()[_0x486e('0x86')]();return db[_0x486e('0x34')][_0x486e('0x4e')]({'where':{'id':_0x5f03c9[_0x486e('0x4b')]['id']}})[_0x486e('0x2a')](function(_0x3b4ed6){return db[_0x486e('0x71')][_0x486e('0x72')](function(_0x5a54be){return _0x3b4ed6[_0x486e('0x87')](_0x5f03c9[_0x486e('0x39')][_0x486e('0x6c')],{'transaction':_0x5a54be})['then'](function(){if(!_[_0x486e('0x88')](_0x3226c0)){return _0x3b4ed6[_0x486e('0x89')](_0x3226c0,{'transaction':_0x5a54be});}})['then'](function(){_0x3226c0['forEach'](function(_0x548f4b){socket[_0x486e('0x76')](_0x486e('0x8a'),{'UserId':_0x548f4b,'MailQueueId':_0x3b4ed6['id']});});});});});});})[_0x486e('0x2a')](respondWithStatusCode(_0x4b9c16,null))[_0x486e('0x57')](handleError(_0x4b9c16,null));};exports[_0x486e('0x8b')]=function(_0x356ae4,_0x5b0240,_0x51b48b){return db[_0x486e('0x34')][_0x486e('0x4e')]({'where':{'id':_0x356ae4[_0x486e('0x4b')]['id']}})[_0x486e('0x2a')](handleEntityNotFound(_0x5b0240,null))['then'](function(_0x37ad63){if(_0x37ad63){return _0x37ad63['addAgents'](_0x356ae4[_0x486e('0x50')]['ids'],_[_0x486e('0x8c')](_0x356ae4[_0x486e('0x50')],['ids','id'])||{})[_0x486e('0x8d')](function(_0x3cfa52){for(var _0x3de47a=0x0;_0x3de47a<_0x356ae4['body'][_0x486e('0x6c')][_0x486e('0x4c')];_0x3de47a+=0x1){socket[_0x486e('0x76')](_0x486e('0x77'),{'UserId':Number(_0x356ae4[_0x486e('0x50')]['ids'][_0x3de47a]),'MailQueueId':Number(_0x356ae4[_0x486e('0x4b')]['id'])});}return _0x3cfa52;});}})[_0x486e('0x2a')](respondWithResult(_0x5b0240,null))[_0x486e('0x57')](handleError(_0x5b0240,null));};exports[_0x486e('0x89')]=function(_0x4bd6ac,_0x1a304d,_0x368755){return db['MailQueue'][_0x486e('0x4e')]({'where':{'id':_0x4bd6ac[_0x486e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1a304d,null))[_0x486e('0x2a')](function(_0x34437f){if(_0x34437f){return _0x34437f[_0x486e('0x89')](_0x4bd6ac[_0x486e('0x39')]['ids'])[_0x486e('0x2a')](function(){if(_[_0x486e('0x8e')](_0x4bd6ac[_0x486e('0x39')][_0x486e('0x6c')])){for(var _0x42965a=0x0;_0x42965a<_0x4bd6ac[_0x486e('0x39')][_0x486e('0x6c')][_0x486e('0x4c')];_0x42965a+=0x1){socket[_0x486e('0x76')](_0x486e('0x8a'),{'UserId':Number(_0x4bd6ac[_0x486e('0x39')]['ids'][_0x42965a]),'MailQueueId':Number(_0x4bd6ac[_0x486e('0x4b')]['id'])});}}else{socket['emit'](_0x486e('0x8a'),{'UserId':Number(_0x4bd6ac[_0x486e('0x39')][_0x486e('0x6c')]),'MailQueueId':Number(_0x4bd6ac[_0x486e('0x4b')]['id'])});}});}})[_0x486e('0x2a')](respondWithStatusCode(_0x1a304d,null))[_0x486e('0x57')](handleError(_0x1a304d,null));};exports[_0x486e('0x8f')]=function(_0x2924d9,_0x1eadc0,_0x368307){var _0x5d14dd={};var _0x1a6fcf={};var _0x4b7f56;var _0x489073;return db[_0x486e('0x34')][_0x486e('0x5b')]({'where':{'id':_0x2924d9['params']['id']}})[_0x486e('0x2a')](handleEntityNotFound(_0x1eadc0,null))[_0x486e('0x2a')](function(_0x885c13){if(_0x885c13){_0x4b7f56=_0x885c13;_0x1a6fcf['model']=_[_0x486e('0x3a')](db[_0x486e('0x5e')][_0x486e('0x35')]);_0x1a6fcf[_0x486e('0x39')]=_[_0x486e('0x3a')](_0x2924d9[_0x486e('0x39')]);_0x1a6fcf[_0x486e('0x3b')]=_[_0x486e('0x3c')](_0x1a6fcf['model'],_0x1a6fcf[_0x486e('0x39')]);_0x5d14dd['attributes']=_['intersection'](_0x1a6fcf['model'],qs[_0x486e('0x3e')](_0x2924d9['query']['fields']));_0x5d14dd[_0x486e('0x3d')]=_0x5d14dd[_0x486e('0x3d')][_0x486e('0x4c')]?_0x5d14dd[_0x486e('0x3d')]:_0x1a6fcf[_0x486e('0x38')];_0x5d14dd['order']=qs[_0x486e('0x42')](_0x2924d9['query'][_0x486e('0x42')]);_0x5d14dd[_0x486e('0x43')]=qs[_0x486e('0x3b')](_[_0x486e('0x44')](_0x2924d9['query'],_0x1a6fcf[_0x486e('0x3b')]));if(_0x2924d9[_0x486e('0x39')][_0x486e('0x45')]){_0x5d14dd[_0x486e('0x43')]=_[_0x486e('0x46')](_0x5d14dd[_0x486e('0x43')],{'$or':_[_0x486e('0x33')](_0x5d14dd[_0x486e('0x3d')],function(_0x3ed3e4){var _0x336c29={};_0x336c29[_0x3ed3e4]={'$like':'%'+_0x2924d9[_0x486e('0x39')][_0x486e('0x45')]+'%'};return _0x336c29;})});}_0x5d14dd=_['merge']({},_0x5d14dd,_0x2924d9[_0x486e('0x48')]);return _0x4b7f56[_0x486e('0x8f')](_0x5d14dd);}})['then'](function(_0x5c6834){if(_0x5c6834){_0x489073=_0x5c6834[_0x486e('0x4c')];if(!_0x2924d9[_0x486e('0x39')][_0x486e('0x3f')]('nolimit')){_0x5d14dd['limit']=qs[_0x486e('0x24')](_0x2924d9['query']['limit']);_0x5d14dd[_0x486e('0x22')]=qs['offset'](_0x2924d9[_0x486e('0x39')][_0x486e('0x22')]);}return _0x4b7f56[_0x486e('0x8f')](_0x5d14dd);}})[_0x486e('0x2a')](function(_0x894386){if(_0x894386){return _0x894386?{'count':_0x489073,'rows':_0x894386}:null;}})['then'](respondWithResult(_0x1eadc0,null))['catch'](handleError(_0x1eadc0,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 44de0cf..da18e2a 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 _0xbdd3=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove'];(function(_0x1a7714,_0x25715a){var _0x5f2757=function(_0x56c404){while(--_0x56c404){_0x1a7714['push'](_0x1a7714['shift']());}};_0x5f2757(++_0x25715a);}(_0xbdd3,0x82));var _0x3bdd=function(_0x2b3b51,_0x3244ba){_0x2b3b51=_0x2b3b51-0x0;var _0x2b8395=_0xbdd3[_0x2b3b51];return _0x2b8395;};'use strict';var EventEmitter=require(_0x3bdd('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x3bdd('0x1')](0x0);var events={'afterCreate':_0x3bdd('0x2'),'afterUpdate':_0x3bdd('0x3'),'afterDestroy':_0x3bdd('0x4')};function emitEvent(_0x67482d){return function(_0x56505b,_0x17750f,_0x3d8b20){MailQueueEvents['emit'](_0x67482d+':'+_0x56505b['id'],_0x56505b);MailQueueEvents[_0x3bdd('0x5')](_0x67482d,_0x56505b);_0x3d8b20(null);};}for(var e in events){if(events[_0x3bdd('0x6')](e)){var event=events[e];MailQueue[_0x3bdd('0x7')](e,emitEvent(event));}}module[_0x3bdd('0x8')]=MailQueueEvents; \ No newline at end of file +var _0xaa6f=['events','../../mysqldb','MailQueue','setMaxListeners','save','update','emit','hook','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa6f,0x168));var _0xfaa6=function(_0x14f80f,_0x545ab3){_0x14f80f=_0x14f80f-0x0;var _0x39eb5e=_0xaa6f[_0x14f80f];return _0x39eb5e;};'use strict';var EventEmitter=require(_0xfaa6('0x0'));var MailQueue=require(_0xfaa6('0x1'))['db'][_0xfaa6('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xfaa6('0x3')](0x0);var events={'afterCreate':_0xfaa6('0x4'),'afterUpdate':_0xfaa6('0x5'),'afterDestroy':'remove'};function emitEvent(_0x16b141){return function(_0x14fcd2,_0x55e766,_0x24bf54){MailQueueEvents[_0xfaa6('0x6')](_0x16b141+':'+_0x14fcd2['id'],_0x14fcd2);MailQueueEvents[_0xfaa6('0x6')](_0x16b141,_0x14fcd2);_0x24bf54(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xfaa6('0x7')](e,emitEvent(event));}}module[_0xfaa6('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 b0e314e..763645d 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 _0xcef4=['bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','define','MailQueue','lodash','util','../../config/logger','api','moment'];(function(_0x3a7634,_0x2db384){var _0x23bbe9=function(_0x226734){while(--_0x226734){_0x3a7634['push'](_0x3a7634['shift']());}};_0x23bbe9(++_0x2db384);}(_0xcef4,0xcb));var _0x4cef=function(_0x430459,_0x58519c){_0x430459=_0x430459-0x0;var _0x3a2439=_0xcef4[_0x430459];return _0x3a2439;};'use strict';var _=require(_0x4cef('0x0'));var util=require(_0x4cef('0x1'));var logger=require(_0x4cef('0x2'))(_0x4cef('0x3'));var moment=require(_0x4cef('0x4'));var BPromise=require(_0x4cef('0x5'));var rp=require(_0x4cef('0x6'));var fs=require('fs');var path=require(_0x4cef('0x7'));var rimraf=require(_0x4cef('0x8'));var config=require(_0x4cef('0x9'));var attributes=require(_0x4cef('0xa'));module['exports']=function(_0x15746a,_0x4625ca){return _0x15746a[_0x4cef('0xb')](_0x4cef('0xc'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc43c=['define','MailQueue','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./mailQueue.attributes','exports'];(function(_0x1989ec,_0x2b3626){var _0x10e2a0=function(_0x1917a8){while(--_0x1917a8){_0x1989ec['push'](_0x1989ec['shift']());}};_0x10e2a0(++_0x2b3626);}(_0xc43c,0x14c));var _0xcc43=function(_0x3a1c5d,_0x4e3bcd){_0x3a1c5d=_0x3a1c5d-0x0;var _0x5030e7=_0xc43c[_0x3a1c5d];return _0x5030e7;};'use strict';var _=require(_0xcc43('0x0'));var util=require('util');var logger=require(_0xcc43('0x1'))(_0xcc43('0x2'));var moment=require(_0xcc43('0x3'));var BPromise=require('bluebird');var rp=require(_0xcc43('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcc43('0x5'));var config=require(_0xcc43('0x6'));var attributes=require(_0xcc43('0x7'));module[_0xcc43('0x8')]=function(_0x1de3b2,_0x563c7a){return _0x1de3b2[_0xcc43('0x9')](_0xcc43('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 9a9baab..c5a770e 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 _0x8440=['http','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailQueue','findAll','options','where','attributes','limit','map','include','model','GetMailQueue','debug','ShowMailQueue','raw','then','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4b8df0,_0x5c59f1){var _0x2ad3fe=function(_0x2244ae){while(--_0x2244ae){_0x4b8df0['push'](_0x4b8df0['shift']());}};_0x2ad3fe(++_0x5c59f1);}(_0x8440,0x122));var _0x0844=function(_0x3a1109,_0x41156d){_0x3a1109=_0x3a1109-0x0;var _0x3c1cea=_0x8440[_0x3a1109];return _0x3c1cea;};'use strict';var _=require(_0x0844('0x0'));var util=require(_0x0844('0x1'));var moment=require('moment');var BPromise=require(_0x0844('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0844('0x3'));var db=require(_0x0844('0x4'))['db'];var utils=require(_0x0844('0x5'));var logger=require(_0x0844('0x6'))(_0x0844('0x7'));var config=require(_0x0844('0x8'));var jayson=require(_0x0844('0x9'));var client=jayson[_0x0844('0xa')][_0x0844('0xb')]({'port':0x232a});config['redis']=_[_0x0844('0xc')](config[_0x0844('0xd')],{'host':_0x0844('0xe'),'port':0x18eb});var socket=require(_0x0844('0xf'))(new Redis(config[_0x0844('0xd')]));require(_0x0844('0x10'))[_0x0844('0x11')](socket);function respondWithRpcPromise(_0x279687,_0x59a88e,_0x13b4ce){return new BPromise(function(_0x3b24cd,_0x509580){return client[_0x0844('0x12')](_0x279687,_0x13b4ce)['then'](function(_0x41cf2e){logger[_0x0844('0x13')](_0x0844('0x14'),_0x59a88e,_0x0844('0x15'));logger['debug'](_0x0844('0x16'),_0x59a88e,'request\x20sent',JSON[_0x0844('0x17')](_0x41cf2e));if(_0x41cf2e[_0x0844('0x18')]){if(_0x41cf2e[_0x0844('0x18')][_0x0844('0x19')]===0x1f4){logger[_0x0844('0x18')](_0x0844('0x14'),_0x59a88e,_0x41cf2e[_0x0844('0x18')][_0x0844('0x1a')]);return _0x509580(_0x41cf2e['error'][_0x0844('0x1a')]);}logger[_0x0844('0x18')](_0x0844('0x14'),_0x59a88e,_0x41cf2e[_0x0844('0x18')][_0x0844('0x1a')]);return _0x3b24cd(_0x41cf2e[_0x0844('0x18')][_0x0844('0x1a')]);}else{logger[_0x0844('0x13')]('MailQueue,\x20%s,\x20%s',_0x59a88e,'request\x20sent');_0x3b24cd(_0x41cf2e[_0x0844('0x1b')][_0x0844('0x1a')]);}})[_0x0844('0x1c')](function(_0x1e3656){logger[_0x0844('0x18')](_0x0844('0x14'),_0x59a88e,_0x1e3656);_0x509580(_0x1e3656);});});}exports['GetMailQueue']=function(_0x525470){var _0x43d025=this;return new Promise(function(_0x479609,_0x544e67){return db[_0x0844('0x1d')][_0x0844('0x1e')]({'raw':_0x525470['options']?_0x525470[_0x0844('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x525470['options']?_0x525470[_0x0844('0x1f')][_0x0844('0x20')]||null:null,'attributes':_0x525470[_0x0844('0x1f')]?_0x525470[_0x0844('0x1f')][_0x0844('0x21')]||null:null,'limit':_0x525470[_0x0844('0x1f')]?_0x525470['options'][_0x0844('0x22')]||null:null,'include':_0x525470[_0x0844('0x1f')]?_0x525470[_0x0844('0x1f')]['include']?_[_0x0844('0x23')](_0x525470[_0x0844('0x1f')][_0x0844('0x24')],function(_0x2b9c15){return{'model':db[_0x2b9c15[_0x0844('0x25')]],'as':_0x2b9c15['as'],'attributes':_0x2b9c15[_0x0844('0x21')],'include':_0x2b9c15[_0x0844('0x24')]?_[_0x0844('0x23')](_0x2b9c15[_0x0844('0x24')],function(_0x1aa05e){return{'model':db[_0x1aa05e['model']],'as':_0x1aa05e['as'],'attributes':_0x1aa05e[_0x0844('0x21')],'include':_0x1aa05e['include']?_[_0x0844('0x23')](_0x1aa05e[_0x0844('0x24')],function(_0x17f97a){return{'model':db[_0x17f97a['model']],'as':_0x17f97a['as'],'attributes':_0x17f97a[_0x0844('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x699b45){logger[_0x0844('0x13')](_0x0844('0x26'),_0x525470);logger[_0x0844('0x27')](_0x0844('0x26'),_0x525470,JSON[_0x0844('0x17')](_0x699b45));_0x479609(_0x699b45);})[_0x0844('0x1c')](function(_0x1cc64d){logger['error'](_0x0844('0x26'),_0x1cc64d[_0x0844('0x1a')],_0x525470);_0x544e67(_0x43d025['error'](0x1f4,_0x1cc64d['message']));});});};exports[_0x0844('0x28')]=function(_0x2d0180){var _0x552b69=this;return new Promise(function(_0x270e29,_0x815bbd){return db[_0x0844('0x1d')]['find']({'raw':_0x2d0180[_0x0844('0x1f')]?_0x2d0180[_0x0844('0x1f')][_0x0844('0x29')]===undefined?!![]:![]:!![],'where':_0x2d0180[_0x0844('0x1f')]?_0x2d0180[_0x0844('0x1f')]['where']||null:null,'attributes':_0x2d0180[_0x0844('0x1f')]?_0x2d0180[_0x0844('0x1f')]['attributes']||null:null,'include':_0x2d0180['options']?_0x2d0180[_0x0844('0x1f')][_0x0844('0x24')]?_[_0x0844('0x23')](_0x2d0180[_0x0844('0x1f')][_0x0844('0x24')],function(_0x2b6ed7){return{'model':db[_0x2b6ed7['model']],'as':_0x2b6ed7['as'],'attributes':_0x2b6ed7[_0x0844('0x21')],'include':_0x2b6ed7[_0x0844('0x24')]?_['map'](_0x2b6ed7['include'],function(_0x221bad){return{'model':db[_0x221bad[_0x0844('0x25')]],'as':_0x221bad['as'],'attributes':_0x221bad[_0x0844('0x21')],'include':_0x221bad[_0x0844('0x24')]?_[_0x0844('0x23')](_0x221bad[_0x0844('0x24')],function(_0x11691e){return{'model':db[_0x11691e[_0x0844('0x25')]],'as':_0x11691e['as'],'attributes':_0x11691e['attributes']};}):[]};}):[]};}):[]:[]})[_0x0844('0x2a')](function(_0xea2ad5){logger[_0x0844('0x13')]('ShowMailQueue',_0x2d0180);logger[_0x0844('0x27')](_0x0844('0x28'),_0x2d0180,JSON[_0x0844('0x17')](_0xea2ad5));_0x270e29(_0xea2ad5);})[_0x0844('0x1c')](function(_0x557862){logger[_0x0844('0x18')](_0x0844('0x28'),_0x557862[_0x0844('0x1a')],_0x2d0180);_0x815bbd(_0x552b69[_0x0844('0x18')](0x1f4,_0x557862[_0x0844('0x1a')]));});});}; \ No newline at end of file +var _0xeacb=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./mailQueue.socket','register','request','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetMailQueue','MailQueue','findAll','options','where','attributes','limit','include','map','model','then','catch','ShowMailQueue','find','raw','lodash'];(function(_0x12c74c,_0x50b260){var _0x2af9ea=function(_0x291fd2){while(--_0x291fd2){_0x12c74c['push'](_0x12c74c['shift']());}};_0x2af9ea(++_0x50b260);}(_0xeacb,0x199));var _0xbeac=function(_0x46924d,_0x308b4f){_0x46924d=_0x46924d-0x0;var _0xf33153=_0xeacb[_0x46924d];return _0xf33153;};'use strict';var _=require(_0xbeac('0x0'));var util=require('util');var moment=require(_0xbeac('0x1'));var BPromise=require(_0xbeac('0x2'));var rs=require(_0xbeac('0x3'));var fs=require('fs');var Redis=require(_0xbeac('0x4'));var db=require(_0xbeac('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbeac('0x6'))(_0xbeac('0x7'));var config=require(_0xbeac('0x8'));var jayson=require(_0xbeac('0x9'));var client=jayson[_0xbeac('0xa')][_0xbeac('0xb')]({'port':0x232a});config[_0xbeac('0xc')]=_[_0xbeac('0xd')](config[_0xbeac('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbeac('0xc')]));require(_0xbeac('0xe'))[_0xbeac('0xf')](socket);function respondWithRpcPromise(_0x527658,_0x10421a,_0x52272f){return new BPromise(function(_0x29ce8c,_0x375ace){return client[_0xbeac('0x10')](_0x527658,_0x52272f)['then'](function(_0x16bc94){logger[_0xbeac('0x11')](_0xbeac('0x12'),_0x10421a,_0xbeac('0x13'));logger[_0xbeac('0x14')](_0xbeac('0x15'),_0x10421a,'request\x20sent',JSON[_0xbeac('0x16')](_0x16bc94));if(_0x16bc94[_0xbeac('0x17')]){if(_0x16bc94[_0xbeac('0x17')][_0xbeac('0x18')]===0x1f4){logger[_0xbeac('0x17')]('MailQueue,\x20%s,\x20%s',_0x10421a,_0x16bc94['error'][_0xbeac('0x19')]);return _0x375ace(_0x16bc94[_0xbeac('0x17')][_0xbeac('0x19')]);}logger['error'](_0xbeac('0x12'),_0x10421a,_0x16bc94[_0xbeac('0x17')][_0xbeac('0x19')]);return _0x29ce8c(_0x16bc94['error']['message']);}else{logger[_0xbeac('0x11')](_0xbeac('0x12'),_0x10421a,_0xbeac('0x13'));_0x29ce8c(_0x16bc94['result'][_0xbeac('0x19')]);}})['catch'](function(_0x38efbf){logger[_0xbeac('0x17')](_0xbeac('0x12'),_0x10421a,_0x38efbf);_0x375ace(_0x38efbf);});});}exports[_0xbeac('0x1a')]=function(_0x114fa3){var _0x1b0258=this;return new Promise(function(_0x2562e3,_0x1fd27a){return db[_0xbeac('0x1b')][_0xbeac('0x1c')]({'raw':_0x114fa3['options']?_0x114fa3['options']['raw']===undefined?!![]:![]:!![],'where':_0x114fa3[_0xbeac('0x1d')]?_0x114fa3[_0xbeac('0x1d')][_0xbeac('0x1e')]||null:null,'attributes':_0x114fa3[_0xbeac('0x1d')]?_0x114fa3[_0xbeac('0x1d')][_0xbeac('0x1f')]||null:null,'limit':_0x114fa3[_0xbeac('0x1d')]?_0x114fa3[_0xbeac('0x1d')][_0xbeac('0x20')]||null:null,'include':_0x114fa3[_0xbeac('0x1d')]?_0x114fa3[_0xbeac('0x1d')][_0xbeac('0x21')]?_[_0xbeac('0x22')](_0x114fa3['options']['include'],function(_0x33340d){return{'model':db[_0x33340d['model']],'as':_0x33340d['as'],'attributes':_0x33340d['attributes'],'include':_0x33340d[_0xbeac('0x21')]?_[_0xbeac('0x22')](_0x33340d[_0xbeac('0x21')],function(_0x51a0d8){return{'model':db[_0x51a0d8[_0xbeac('0x23')]],'as':_0x51a0d8['as'],'attributes':_0x51a0d8['attributes'],'include':_0x51a0d8[_0xbeac('0x21')]?_[_0xbeac('0x22')](_0x51a0d8['include'],function(_0x4a1e17){return{'model':db[_0x4a1e17[_0xbeac('0x23')]],'as':_0x4a1e17['as'],'attributes':_0x4a1e17[_0xbeac('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xbeac('0x24')](function(_0x4162f5){logger['info'](_0xbeac('0x1a'),_0x114fa3);logger[_0xbeac('0x14')](_0xbeac('0x1a'),_0x114fa3,JSON['stringify'](_0x4162f5));_0x2562e3(_0x4162f5);})[_0xbeac('0x25')](function(_0x56d532){logger[_0xbeac('0x17')](_0xbeac('0x1a'),_0x56d532['message'],_0x114fa3);_0x1fd27a(_0x1b0258[_0xbeac('0x17')](0x1f4,_0x56d532[_0xbeac('0x19')]));});});};exports[_0xbeac('0x26')]=function(_0x2791ef){var _0x3c83b3=this;return new Promise(function(_0x28085a,_0x5bcc38){return db['MailQueue'][_0xbeac('0x27')]({'raw':_0x2791ef['options']?_0x2791ef[_0xbeac('0x1d')][_0xbeac('0x28')]===undefined?!![]:![]:!![],'where':_0x2791ef['options']?_0x2791ef[_0xbeac('0x1d')][_0xbeac('0x1e')]||null:null,'attributes':_0x2791ef[_0xbeac('0x1d')]?_0x2791ef[_0xbeac('0x1d')][_0xbeac('0x1f')]||null:null,'include':_0x2791ef[_0xbeac('0x1d')]?_0x2791ef[_0xbeac('0x1d')][_0xbeac('0x21')]?_[_0xbeac('0x22')](_0x2791ef[_0xbeac('0x1d')][_0xbeac('0x21')],function(_0x113961){return{'model':db[_0x113961[_0xbeac('0x23')]],'as':_0x113961['as'],'attributes':_0x113961['attributes'],'include':_0x113961['include']?_[_0xbeac('0x22')](_0x113961[_0xbeac('0x21')],function(_0xf4ee1e){return{'model':db[_0xf4ee1e[_0xbeac('0x23')]],'as':_0xf4ee1e['as'],'attributes':_0xf4ee1e['attributes'],'include':_0xf4ee1e['include']?_['map'](_0xf4ee1e['include'],function(_0x2ef0ab){return{'model':db[_0x2ef0ab[_0xbeac('0x23')]],'as':_0x2ef0ab['as'],'attributes':_0x2ef0ab[_0xbeac('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xbeac('0x24')](function(_0x3ff5d5){logger[_0xbeac('0x11')](_0xbeac('0x26'),_0x2791ef);logger[_0xbeac('0x14')](_0xbeac('0x26'),_0x2791ef,JSON['stringify'](_0x3ff5d5));_0x28085a(_0x3ff5d5);})[_0xbeac('0x25')](function(_0x57fa17){logger[_0xbeac('0x17')](_0xbeac('0x26'),_0x57fa17[_0xbeac('0x19')],_0x2791ef);_0x5bcc38(_0x3c83b3[_0xbeac('0x17')](0x1f4,_0x57fa17[_0xbeac('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 8bbdf5e..7c5a29b 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 _0xb8c1=['length','save','remove','update','removeListener','register'];(function(_0x58c458,_0x445e5e){var _0x52a613=function(_0x1a59ba){while(--_0x1a59ba){_0x58c458['push'](_0x58c458['shift']());}};_0x52a613(++_0x445e5e);}(_0xb8c1,0x91));var _0x1b8c=function(_0x234156,_0xef15eb){_0x234156=_0x234156-0x0;var _0xff365c=_0xb8c1[_0x234156];return _0xff365c;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x1b8c('0x0'),_0x1b8c('0x1'),_0x1b8c('0x2')];function createListener(_0x38154f,_0x366b7b){return function(_0x128e34){_0x366b7b['emit'](_0x38154f,_0x128e34);};}function removeListener(_0x565f9e,_0x4e7ad2){return function(){MailQueueEvents[_0x1b8c('0x3')](_0x565f9e,_0x4e7ad2);};}exports[_0x1b8c('0x4')]=function(_0x44804c){for(var _0x460b86=0x0,_0x1710e1=events[_0x1b8c('0x5')];_0x460b86<_0x1710e1;_0x460b86++){var _0x23191c=events[_0x460b86];var _0xd96ed1=createListener('mailQueue:'+_0x23191c,_0x44804c);MailQueueEvents['on'](_0x23191c,_0xd96ed1);}}; \ No newline at end of file +var _0xf467=['./mailQueue.events','save','update','emit','removeListener','register','length'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0xf467,0x1b9));var _0x7f46=function(_0x34a10c,_0x163db8){_0x34a10c=_0x34a10c-0x0;var _0x23f4d5=_0xf467[_0x34a10c];return _0x23f4d5;};'use strict';var MailQueueEvents=require(_0x7f46('0x0'));var events=[_0x7f46('0x1'),'remove',_0x7f46('0x2')];function createListener(_0x2f31ac,_0x406315){return function(_0x26b675){_0x406315[_0x7f46('0x3')](_0x2f31ac,_0x26b675);};}function removeListener(_0x10a106,_0x58f8f1){return function(){MailQueueEvents[_0x7f46('0x4')](_0x10a106,_0x58f8f1);};}exports[_0x7f46('0x5')]=function(_0x212d1c){for(var _0x5e416d=0x0,_0x2cd3fd=events[_0x7f46('0x6')];_0x5e416d<_0x2cd3fd;_0x5e416d++){var _0x58ae07=events[_0x5e416d];var _0x3a1a12=createListener('mailQueue:'+_0x58ae07,_0x212d1c);MailQueueEvents['on'](_0x58ae07,_0x3a1a12);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index cc5788e..47f9a5c 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 _0x8181=['Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','destroy','exports','util','path','express'];(function(_0x95ad05,_0x3cadb6){var _0x2d79f4=function(_0x9868f2){while(--_0x9868f2){_0x95ad05['push'](_0x95ad05['shift']());}};_0x2d79f4(++_0x3cadb6);}(_0x8181,0x1c9));var _0x1818=function(_0x4a077d,_0x3c8a03){_0x4a077d=_0x4a077d-0x0;var _0x1afebb=_0x8181[_0x4a077d];return _0x1afebb;};'use strict';var multer=require('multer');var util=require(_0x1818('0x0'));var path=require(_0x1818('0x1'));var timeout=require('connect-timeout');var express=require(_0x1818('0x2'));var router=express[_0x1818('0x3')]();var fs_extra=require(_0x1818('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1818('0x5'));var config=require(_0x1818('0x6'));var controller=require(_0x1818('0x7'));router['get']('/',auth[_0x1818('0x8')](),controller[_0x1818('0x9')]);router[_0x1818('0xa')]('/describe',auth[_0x1818('0x8')](),controller[_0x1818('0xb')]);router[_0x1818('0xa')](_0x1818('0xc'),auth['isAuthenticated'](),controller[_0x1818('0xd')]);router[_0x1818('0xe')]('/',auth[_0x1818('0x8')](),controller[_0x1818('0xf')]);router[_0x1818('0x10')](_0x1818('0xc'),auth[_0x1818('0x8')](),controller[_0x1818('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x1818('0x12')]);module[_0x1818('0x13')]=router; \ No newline at end of file +var _0x93df=['./mailQueueReport.controller','get','index','describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x93df,0xe9));var _0xf93d=function(_0x580869,_0x540760){_0x580869=_0x580869-0x0;var _0x3bfc5d=_0x93df[_0x580869];return _0x3bfc5d;};'use strict';var multer=require(_0xf93d('0x0'));var util=require('util');var path=require(_0xf93d('0x1'));var timeout=require(_0xf93d('0x2'));var express=require(_0xf93d('0x3'));var router=express[_0xf93d('0x4')]();var fs_extra=require(_0xf93d('0x5'));var auth=require(_0xf93d('0x6'));var interaction=require(_0xf93d('0x7'));var config=require(_0xf93d('0x8'));var controller=require(_0xf93d('0x9'));router[_0xf93d('0xa')]('/',auth['isAuthenticated'](),controller[_0xf93d('0xb')]);router[_0xf93d('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xf93d('0xc')]);router[_0xf93d('0xa')](_0xf93d('0xd'),auth[_0xf93d('0xe')](),controller[_0xf93d('0xf')]);router[_0xf93d('0x10')]('/',auth[_0xf93d('0xe')](),controller[_0xf93d('0x11')]);router[_0xf93d('0x12')](_0xf93d('0xd'),auth[_0xf93d('0xe')](),controller[_0xf93d('0x13')]);router[_0xf93d('0x14')](_0xf93d('0xd'),auth[_0xf93d('0xe')](),controller[_0xf93d('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index c034172..4f37e35 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 _0xd7a0=['moment','exports','STRING','DATE'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xd7a0,0xa0));var _0x0d7a=function(_0x4d1cf8,_0x4aa563){_0x4d1cf8=_0x4d1cf8-0x0;var _0x1b60dd=_0xd7a0[_0x4d1cf8];return _0x1b60dd;};'use strict';var moment=require(_0x0d7a('0x0'));var Sequelize=require('sequelize');module[_0x0d7a('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x0d7a('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x0d7a('0x3')]},'acceptAt':{'type':Sequelize[_0x0d7a('0x3')]},'exitAt':{'type':Sequelize[_0x0d7a('0x3')]},'reason':{'type':Sequelize[_0x0d7a('0x2')]}}; \ No newline at end of file +var _0x7def=['moment','exports','STRING','DATE'];(function(_0x354a7b,_0x597a7f){var _0x3f55af=function(_0x3ddde6){while(--_0x3ddde6){_0x354a7b['push'](_0x354a7b['shift']());}};_0x3f55af(++_0x597a7f);}(_0x7def,0x74));var _0xf7de=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x7def[_0x363ef8];return _0x148822;};'use strict';var moment=require(_0xf7de('0x0'));var Sequelize=require('sequelize');module[_0xf7de('0x1')]={'uniqueid':{'type':Sequelize[_0xf7de('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xf7de('0x3')]},'leaveAt':{'type':Sequelize[_0xf7de('0x3')]},'acceptAt':{'type':Sequelize[_0xf7de('0x3')]},'exitAt':{'type':Sequelize[_0xf7de('0x3')]},'reason':{'type':Sequelize[_0xf7de('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index e14436d..f8709d3 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 _0xf2e3=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','error','stack','name','send','index','MailQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','map','VIRTUAL','then','includeAll','include','rows','catch','show','params','create','body','update','destroy','find','describe','eml-format'];(function(_0x523e45,_0xe413f1){var _0x2fbd50=function(_0x207d3f){while(--_0x207d3f){_0x523e45['push'](_0x523e45['shift']());}};_0x2fbd50(++_0xe413f1);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0xf2e3[_0x2adbeb];return _0x5e18a6;};'use strict';var emlformat=require(_0x3f2e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3f2e('0x1'));var jsonpatch=require(_0x3f2e('0x2'));var rp=require(_0x3f2e('0x3'));var moment=require(_0x3f2e('0x4'));var BPromise=require(_0x3f2e('0x5'));var Mustache=require(_0x3f2e('0x6'));var util=require(_0x3f2e('0x7'));var path=require(_0x3f2e('0x8'));var sox=require(_0x3f2e('0x9'));var csv=require('to-csv');var ejs=require(_0x3f2e('0xa'));var fs=require('fs');var fs_extra=require(_0x3f2e('0xb'));var _=require(_0x3f2e('0xc'));var squel=require(_0x3f2e('0xd'));var crypto=require(_0x3f2e('0xe'));var jsforce=require(_0x3f2e('0xf'));var deskjs=require(_0x3f2e('0x10'));var toCsv=require(_0x3f2e('0x11'));var querystring=require(_0x3f2e('0x12'));var Papa=require(_0x3f2e('0x13'));var Redis=require(_0x3f2e('0x14'));var authService=require(_0x3f2e('0x15'));var qs=require(_0x3f2e('0x16'));var as=require(_0x3f2e('0x17'));var hardwareService=require(_0x3f2e('0x18'));var logger=require(_0x3f2e('0x19'))(_0x3f2e('0x1a'));var utils=require(_0x3f2e('0x1b'));var config=require(_0x3f2e('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0x3f2e('0x1d'))['db'];function respondWithStatusCode(_0xaa6ef5,_0x5471f9){_0x5471f9=_0x5471f9||0xcc;return function(_0xe83663){if(_0xe83663){return _0xaa6ef5[_0x3f2e('0x1e')](_0x5471f9);}return _0xaa6ef5[_0x3f2e('0x1f')](_0x5471f9)[_0x3f2e('0x20')]();};}function respondWithResult(_0x3d20d1,_0x57cba7){_0x57cba7=_0x57cba7||0xc8;return function(_0x298080){if(_0x298080){return _0x3d20d1[_0x3f2e('0x1f')](_0x57cba7)[_0x3f2e('0x21')](_0x298080);}};}function respondWithFilteredResult(_0x4f2e38,_0x43f69e){return function(_0x218b44){if(_0x218b44){var _0x17ef58=typeof _0x43f69e[_0x3f2e('0x22')]===_0x3f2e('0x23')&&typeof _0x43f69e[_0x3f2e('0x24')]===_0x3f2e('0x23');var _0x155411=_0x218b44[_0x3f2e('0x25')];var _0xc00add=_0x17ef58?0x0:_0x43f69e[_0x3f2e('0x22')];var _0x5b9989=_0x17ef58?_0x218b44[_0x3f2e('0x25')]:_0x43f69e[_0x3f2e('0x22')]+_0x43f69e[_0x3f2e('0x24')];var _0xbe899c;if(_0x5b9989>=_0x155411){_0x5b9989=_0x155411;_0xbe899c=0xc8;}else{_0xbe899c=0xce;}_0x4f2e38[_0x3f2e('0x1f')](_0xbe899c);return _0x4f2e38['set']('Content-Range',_0xc00add+'-'+_0x5b9989+'/'+_0x155411)[_0x3f2e('0x21')](_0x218b44);}return null;};}function patchUpdates(_0x11f84c){return function(_0x38bbae){try{jsonpatch[_0x3f2e('0x26')](_0x38bbae,_0x11f84c,!![]);}catch(_0x4381e5){return BPromise[_0x3f2e('0x27')](_0x4381e5);}return _0x38bbae['save']();};}function saveUpdates(_0x5a7047,_0xf81165){return function(_0x37dab2){if(_0x37dab2){return _0x37dab2['update'](_0x5a7047)['then'](function(_0x46bb1c){return _0x46bb1c;});}return null;};}function removeEntity(_0x5646f5,_0x1b8c67){return function(_0x401ed9){if(_0x401ed9){return _0x401ed9['destroy']()['then'](function(){_0x5646f5['status'](0xcc)[_0x3f2e('0x20')]();});}};}function handleEntityNotFound(_0x3d7631,_0x4c61d9){return function(_0x11a7cc){if(!_0x11a7cc){_0x3d7631['sendStatus'](0x194);}return _0x11a7cc;};}function handleError(_0x1ad875,_0x598541){_0x598541=_0x598541||0x1f4;return function(_0x2806d0){logger[_0x3f2e('0x28')](_0x2806d0[_0x3f2e('0x29')]);if(_0x2806d0[_0x3f2e('0x2a')]){delete _0x2806d0[_0x3f2e('0x2a')];}_0x1ad875['status'](_0x598541)[_0x3f2e('0x2b')](_0x2806d0);};}exports[_0x3f2e('0x2c')]=function(_0x5eab38,_0x528063){var _0x2b9fda={},_0x1e5db4={},_0x35f421={'count':0x0,'rows':[]};var _0x22e6ad=_['map'](db[_0x3f2e('0x2d')][_0x3f2e('0x2e')],function(_0x37ddfe){return{'name':_0x37ddfe['fieldName'],'type':_0x37ddfe[_0x3f2e('0x2f')][_0x3f2e('0x30')]};});_0x1e5db4[_0x3f2e('0x31')]=_['map'](_0x22e6ad,_0x3f2e('0x2a'));_0x1e5db4[_0x3f2e('0x32')]=_[_0x3f2e('0x33')](_0x5eab38[_0x3f2e('0x32')]);_0x1e5db4[_0x3f2e('0x34')]=_[_0x3f2e('0x35')](_0x1e5db4['model'],_0x1e5db4[_0x3f2e('0x32')]);_0x2b9fda[_0x3f2e('0x36')]=_[_0x3f2e('0x35')](_0x1e5db4[_0x3f2e('0x31')],qs[_0x3f2e('0x37')](_0x5eab38[_0x3f2e('0x32')][_0x3f2e('0x37')]));_0x2b9fda['attributes']=_0x2b9fda[_0x3f2e('0x36')][_0x3f2e('0x38')]?_0x2b9fda[_0x3f2e('0x36')]:_0x1e5db4[_0x3f2e('0x31')];if(!_0x5eab38['query']['hasOwnProperty'](_0x3f2e('0x39'))){_0x2b9fda[_0x3f2e('0x24')]=qs[_0x3f2e('0x24')](_0x5eab38[_0x3f2e('0x32')][_0x3f2e('0x24')]);_0x2b9fda[_0x3f2e('0x22')]=qs[_0x3f2e('0x22')](_0x5eab38[_0x3f2e('0x32')][_0x3f2e('0x22')]);}_0x2b9fda[_0x3f2e('0x3a')]=qs['sort'](_0x5eab38[_0x3f2e('0x32')][_0x3f2e('0x3b')]);_0x2b9fda[_0x3f2e('0x3c')]=qs[_0x3f2e('0x34')](_['pick'](_0x5eab38[_0x3f2e('0x32')],_0x1e5db4[_0x3f2e('0x34')]),_0x22e6ad);if(_0x5eab38[_0x3f2e('0x32')][_0x3f2e('0x3d')]){_0x2b9fda[_0x3f2e('0x3c')]=_[_0x3f2e('0x3e')](_0x2b9fda[_0x3f2e('0x3c')],{'$or':_[_0x3f2e('0x3f')](_0x22e6ad,function(_0x4c5ac2){if(_0x4c5ac2[_0x3f2e('0x2f')]!==_0x3f2e('0x40')){var _0x238b6b={};_0x238b6b[_0x4c5ac2[_0x3f2e('0x2a')]]={'$like':'%'+_0x5eab38['query'][_0x3f2e('0x3d')]+'%'};return _0x238b6b;}})});}_0x2b9fda=_[_0x3f2e('0x3e')]({},_0x2b9fda,_0x5eab38['options']);var _0x3fc694={'where':_0x2b9fda[_0x3f2e('0x3c')]};return db['MailQueueReport'][_0x3f2e('0x25')](_0x3fc694)[_0x3f2e('0x41')](function(_0x849236){_0x35f421[_0x3f2e('0x25')]=_0x849236;if(_0x5eab38['query'][_0x3f2e('0x42')]){_0x2b9fda[_0x3f2e('0x43')]=[{'all':!![]}];}return db['MailQueueReport']['findAll'](_0x2b9fda);})[_0x3f2e('0x41')](function(_0x23de01){_0x35f421[_0x3f2e('0x44')]=_0x23de01;return _0x35f421;})['then'](respondWithFilteredResult(_0x528063,_0x2b9fda))[_0x3f2e('0x45')](handleError(_0x528063,null));};exports[_0x3f2e('0x46')]=function(_0x43b35a,_0xe9000a){var _0x24df56={'raw':!![],'where':{'id':_0x43b35a[_0x3f2e('0x47')]['id']}},_0x3668dc={};_0x3668dc[_0x3f2e('0x31')]=_[_0x3f2e('0x33')](db[_0x3f2e('0x2d')]['rawAttributes']);_0x3668dc['query']=_[_0x3f2e('0x33')](_0x43b35a[_0x3f2e('0x32')]);_0x3668dc['filters']=_['intersection'](_0x3668dc[_0x3f2e('0x31')],_0x3668dc[_0x3f2e('0x32')]);_0x24df56[_0x3f2e('0x36')]=_['intersection'](_0x3668dc[_0x3f2e('0x31')],qs[_0x3f2e('0x37')](_0x43b35a[_0x3f2e('0x32')]['fields']));_0x24df56[_0x3f2e('0x36')]=_0x24df56[_0x3f2e('0x36')][_0x3f2e('0x38')]?_0x24df56['attributes']:_0x3668dc[_0x3f2e('0x31')];if(_0x43b35a[_0x3f2e('0x32')][_0x3f2e('0x42')]){_0x24df56['include']=[{'all':!![]}];}_0x24df56=_[_0x3f2e('0x3e')]({},_0x24df56,_0x43b35a['options']);return db[_0x3f2e('0x2d')]['find'](_0x24df56)['then'](handleEntityNotFound(_0xe9000a,null))[_0x3f2e('0x41')](respondWithResult(_0xe9000a,null))[_0x3f2e('0x45')](handleError(_0xe9000a,null));};exports[_0x3f2e('0x48')]=function(_0x3d6fd2,_0x3e7fac){return db['MailQueueReport']['create'](_0x3d6fd2[_0x3f2e('0x49')],{})[_0x3f2e('0x41')](respondWithResult(_0x3e7fac,0xc9))[_0x3f2e('0x45')](handleError(_0x3e7fac,null));};exports[_0x3f2e('0x4a')]=function(_0x39dbd1,_0xb891b2){if(_0x39dbd1[_0x3f2e('0x49')]['id']){delete _0x39dbd1[_0x3f2e('0x49')]['id'];}return db[_0x3f2e('0x2d')]['find']({'where':{'id':_0x39dbd1['params']['id']}})[_0x3f2e('0x41')](handleEntityNotFound(_0xb891b2,null))['then'](saveUpdates(_0x39dbd1[_0x3f2e('0x49')],null))[_0x3f2e('0x41')](respondWithResult(_0xb891b2,null))[_0x3f2e('0x45')](handleError(_0xb891b2,null));};exports[_0x3f2e('0x4b')]=function(_0x4b6950,_0xd871da){return db['MailQueueReport'][_0x3f2e('0x4c')]({'where':{'id':_0x4b6950[_0x3f2e('0x47')]['id']}})['then'](handleEntityNotFound(_0xd871da,null))[_0x3f2e('0x41')](removeEntity(_0xd871da,null))['catch'](handleError(_0xd871da,null));};exports[_0x3f2e('0x4d')]=function(_0x336003,_0x9ccf3b){return db['MailQueueReport'][_0x3f2e('0x4d')]()[_0x3f2e('0x41')](respondWithResult(_0x9ccf3b,null))[_0x3f2e('0x45')](handleError(_0x9ccf3b,null));}; \ No newline at end of file +var _0x7b84=['sendStatus','status','end','json','offset','undefined','count','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','where','pick','merge','VIRTUAL','filter','MailQueueReport','includeAll','findAll','rows','catch','show','params','include','options','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x3ebda9,_0x29ee3a){var _0xbcd329=function(_0x5e75b8){while(--_0x5e75b8){_0x3ebda9['push'](_0x3ebda9['shift']());}};_0xbcd329(++_0x29ee3a);}(_0x7b84,0x17c));var _0x47b8=function(_0x5404ff,_0x3f777b){_0x5404ff=_0x5404ff-0x0;var _0x3e531e=_0x7b84[_0x5404ff];return _0x3e531e;};'use strict';var emlformat=require(_0x47b8('0x0'));var rimraf=require(_0x47b8('0x1'));var zipdir=require(_0x47b8('0x2'));var jsonpatch=require(_0x47b8('0x3'));var rp=require(_0x47b8('0x4'));var moment=require(_0x47b8('0x5'));var BPromise=require(_0x47b8('0x6'));var Mustache=require('mustache');var util=require(_0x47b8('0x7'));var path=require(_0x47b8('0x8'));var sox=require(_0x47b8('0x9'));var csv=require(_0x47b8('0xa'));var ejs=require(_0x47b8('0xb'));var fs=require('fs');var fs_extra=require(_0x47b8('0xc'));var _=require('lodash');var squel=require(_0x47b8('0xd'));var crypto=require(_0x47b8('0xe'));var jsforce=require(_0x47b8('0xf'));var deskjs=require(_0x47b8('0x10'));var toCsv=require(_0x47b8('0xa'));var querystring=require(_0x47b8('0x11'));var Papa=require(_0x47b8('0x12'));var Redis=require(_0x47b8('0x13'));var authService=require(_0x47b8('0x14'));var qs=require(_0x47b8('0x15'));var as=require(_0x47b8('0x16'));var hardwareService=require(_0x47b8('0x17'));var logger=require(_0x47b8('0x18'))(_0x47b8('0x19'));var utils=require(_0x47b8('0x1a'));var config=require(_0x47b8('0x1b'));var licenseUtil=require(_0x47b8('0x1c'));var db=require(_0x47b8('0x1d'))['db'];function respondWithStatusCode(_0x25a224,_0x289ac7){_0x289ac7=_0x289ac7||0xcc;return function(_0x1edb4b){if(_0x1edb4b){return _0x25a224[_0x47b8('0x1e')](_0x289ac7);}return _0x25a224[_0x47b8('0x1f')](_0x289ac7)[_0x47b8('0x20')]();};}function respondWithResult(_0x173015,_0x223121){_0x223121=_0x223121||0xc8;return function(_0xf66dd6){if(_0xf66dd6){return _0x173015['status'](_0x223121)[_0x47b8('0x21')](_0xf66dd6);}};}function respondWithFilteredResult(_0x340da0,_0x3e760a){return function(_0x1217a4){if(_0x1217a4){var _0x34d5a5=typeof _0x3e760a[_0x47b8('0x22')]===_0x47b8('0x23')&&typeof _0x3e760a['limit']===_0x47b8('0x23');var _0x5c2b2c=_0x1217a4['count'];var _0x4f7317=_0x34d5a5?0x0:_0x3e760a[_0x47b8('0x22')];var _0x36faf1=_0x34d5a5?_0x1217a4[_0x47b8('0x24')]:_0x3e760a['offset']+_0x3e760a['limit'];var _0x4f6716;if(_0x36faf1>=_0x5c2b2c){_0x36faf1=_0x5c2b2c;_0x4f6716=0xc8;}else{_0x4f6716=0xce;}_0x340da0[_0x47b8('0x1f')](_0x4f6716);return _0x340da0['set'](_0x47b8('0x25'),_0x4f7317+'-'+_0x36faf1+'/'+_0x5c2b2c)[_0x47b8('0x21')](_0x1217a4);}return null;};}function patchUpdates(_0x303f19){return function(_0xfccf56){try{jsonpatch['apply'](_0xfccf56,_0x303f19,!![]);}catch(_0xc20df1){return BPromise[_0x47b8('0x26')](_0xc20df1);}return _0xfccf56[_0x47b8('0x27')]();};}function saveUpdates(_0x2f75d2,_0x168cde){return function(_0x232708){if(_0x232708){return _0x232708['update'](_0x2f75d2)[_0x47b8('0x28')](function(_0x2a22e3){return _0x2a22e3;});}return null;};}function removeEntity(_0x5301f8,_0x22e7dd){return function(_0x247429){if(_0x247429){return _0x247429[_0x47b8('0x29')]()[_0x47b8('0x28')](function(){_0x5301f8['status'](0xcc)[_0x47b8('0x20')]();});}};}function handleEntityNotFound(_0x332c23,_0x319d17){return function(_0x3e3de0){if(!_0x3e3de0){_0x332c23[_0x47b8('0x1e')](0x194);}return _0x3e3de0;};}function handleError(_0xbf5ce9,_0x40918f){_0x40918f=_0x40918f||0x1f4;return function(_0x568c1e){logger[_0x47b8('0x2a')](_0x568c1e[_0x47b8('0x2b')]);if(_0x568c1e['name']){delete _0x568c1e[_0x47b8('0x2c')];}_0xbf5ce9[_0x47b8('0x1f')](_0x40918f)[_0x47b8('0x2d')](_0x568c1e);};}exports[_0x47b8('0x2e')]=function(_0x4da0e0,_0x162d96){var _0x5c347f={},_0x2c89fc={},_0x2255ab={'count':0x0,'rows':[]};var _0x33e653=_[_0x47b8('0x2f')](db['MailQueueReport'][_0x47b8('0x30')],function(_0x264dd9){return{'name':_0x264dd9[_0x47b8('0x31')],'type':_0x264dd9[_0x47b8('0x32')][_0x47b8('0x33')]};});_0x2c89fc[_0x47b8('0x34')]=_['map'](_0x33e653,'name');_0x2c89fc['query']=_[_0x47b8('0x35')](_0x4da0e0[_0x47b8('0x36')]);_0x2c89fc[_0x47b8('0x37')]=_['intersection'](_0x2c89fc['model'],_0x2c89fc['query']);_0x5c347f['attributes']=_[_0x47b8('0x38')](_0x2c89fc[_0x47b8('0x34')],qs[_0x47b8('0x39')](_0x4da0e0[_0x47b8('0x36')][_0x47b8('0x39')]));_0x5c347f[_0x47b8('0x3a')]=_0x5c347f[_0x47b8('0x3a')][_0x47b8('0x3b')]?_0x5c347f[_0x47b8('0x3a')]:_0x2c89fc['model'];if(!_0x4da0e0['query'][_0x47b8('0x3c')](_0x47b8('0x3d'))){_0x5c347f['limit']=qs['limit'](_0x4da0e0[_0x47b8('0x36')][_0x47b8('0x3e')]);_0x5c347f[_0x47b8('0x22')]=qs['offset'](_0x4da0e0[_0x47b8('0x36')][_0x47b8('0x22')]);}_0x5c347f['order']=qs['sort'](_0x4da0e0['query']['sort']);_0x5c347f[_0x47b8('0x3f')]=qs[_0x47b8('0x37')](_[_0x47b8('0x40')](_0x4da0e0[_0x47b8('0x36')],_0x2c89fc[_0x47b8('0x37')]),_0x33e653);if(_0x4da0e0[_0x47b8('0x36')]['filter']){_0x5c347f['where']=_[_0x47b8('0x41')](_0x5c347f[_0x47b8('0x3f')],{'$or':_[_0x47b8('0x2f')](_0x33e653,function(_0x4a9ed6){if(_0x4a9ed6['type']!==_0x47b8('0x42')){var _0x2c89bc={};_0x2c89bc[_0x4a9ed6['name']]={'$like':'%'+_0x4da0e0[_0x47b8('0x36')][_0x47b8('0x43')]+'%'};return _0x2c89bc;}})});}_0x5c347f=_['merge']({},_0x5c347f,_0x4da0e0['options']);var _0x493b69={'where':_0x5c347f['where']};return db[_0x47b8('0x44')][_0x47b8('0x24')](_0x493b69)[_0x47b8('0x28')](function(_0x28cf2c){_0x2255ab[_0x47b8('0x24')]=_0x28cf2c;if(_0x4da0e0['query'][_0x47b8('0x45')]){_0x5c347f['include']=[{'all':!![]}];}return db[_0x47b8('0x44')][_0x47b8('0x46')](_0x5c347f);})[_0x47b8('0x28')](function(_0x5bede8){_0x2255ab[_0x47b8('0x47')]=_0x5bede8;return _0x2255ab;})[_0x47b8('0x28')](respondWithFilteredResult(_0x162d96,_0x5c347f))[_0x47b8('0x48')](handleError(_0x162d96,null));};exports[_0x47b8('0x49')]=function(_0x3eaf01,_0x15b9a1){var _0x2d2971={'raw':!![],'where':{'id':_0x3eaf01[_0x47b8('0x4a')]['id']}},_0x569d29={};_0x569d29['model']=_[_0x47b8('0x35')](db[_0x47b8('0x44')][_0x47b8('0x30')]);_0x569d29[_0x47b8('0x36')]=_[_0x47b8('0x35')](_0x3eaf01[_0x47b8('0x36')]);_0x569d29['filters']=_['intersection'](_0x569d29[_0x47b8('0x34')],_0x569d29[_0x47b8('0x36')]);_0x2d2971[_0x47b8('0x3a')]=_['intersection'](_0x569d29[_0x47b8('0x34')],qs['fields'](_0x3eaf01[_0x47b8('0x36')][_0x47b8('0x39')]));_0x2d2971[_0x47b8('0x3a')]=_0x2d2971[_0x47b8('0x3a')][_0x47b8('0x3b')]?_0x2d2971['attributes']:_0x569d29[_0x47b8('0x34')];if(_0x3eaf01[_0x47b8('0x36')][_0x47b8('0x45')]){_0x2d2971[_0x47b8('0x4b')]=[{'all':!![]}];}_0x2d2971=_[_0x47b8('0x41')]({},_0x2d2971,_0x3eaf01[_0x47b8('0x4c')]);return db[_0x47b8('0x44')]['find'](_0x2d2971)[_0x47b8('0x28')](handleEntityNotFound(_0x15b9a1,null))['then'](respondWithResult(_0x15b9a1,null))[_0x47b8('0x48')](handleError(_0x15b9a1,null));};exports[_0x47b8('0x4d')]=function(_0x4a46eb,_0x132e9a){return db[_0x47b8('0x44')][_0x47b8('0x4d')](_0x4a46eb[_0x47b8('0x4e')],{})[_0x47b8('0x28')](respondWithResult(_0x132e9a,0xc9))[_0x47b8('0x48')](handleError(_0x132e9a,null));};exports[_0x47b8('0x4f')]=function(_0x381d3a,_0x4ad8a8){if(_0x381d3a[_0x47b8('0x4e')]['id']){delete _0x381d3a[_0x47b8('0x4e')]['id'];}return db[_0x47b8('0x44')]['find']({'where':{'id':_0x381d3a[_0x47b8('0x4a')]['id']}})[_0x47b8('0x28')](handleEntityNotFound(_0x4ad8a8,null))[_0x47b8('0x28')](saveUpdates(_0x381d3a[_0x47b8('0x4e')],null))['then'](respondWithResult(_0x4ad8a8,null))[_0x47b8('0x48')](handleError(_0x4ad8a8,null));};exports[_0x47b8('0x29')]=function(_0x51ac62,_0x270054){return db[_0x47b8('0x44')][_0x47b8('0x50')]({'where':{'id':_0x51ac62['params']['id']}})[_0x47b8('0x28')](handleEntityNotFound(_0x270054,null))['then'](removeEntity(_0x270054,null))[_0x47b8('0x48')](handleError(_0x270054,null));};exports['describe']=function(_0x2a03c2,_0x498512){return db[_0x47b8('0x44')][_0x47b8('0x51')]()[_0x47b8('0x28')](respondWithResult(_0x498512,null))[_0x47b8('0x48')](handleError(_0x498512,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index d10323a..84883bf 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 _0x2568=['./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2568,0x148));var _0x8256=function(_0x5177b9,_0x598b77){_0x5177b9=_0x5177b9-0x0;var _0x3f9640=_0x2568[_0x5177b9];return _0x3f9640;};'use strict';var _=require('lodash');var util=require(_0x8256('0x0'));var logger=require(_0x8256('0x1'))(_0x8256('0x2'));var moment=require(_0x8256('0x3'));var BPromise=require(_0x8256('0x4'));var rp=require(_0x8256('0x5'));var fs=require('fs');var path=require(_0x8256('0x6'));var rimraf=require('rimraf');var config=require(_0x8256('0x7'));var attributes=require(_0x8256('0x8'));module[_0x8256('0x9')]=function(_0x13ecbd,_0x3832c0){return _0x13ecbd[_0x8256('0xa')](_0x8256('0xb'),attributes,{'tableName':_0x8256('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8256('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0541=['../../config/logger','moment','bluebird','request-promise','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util'];(function(_0x5961dd,_0x29d68f){var _0x287121=function(_0x46efed){while(--_0x46efed){_0x5961dd['push'](_0x5961dd['shift']());}};_0x287121(++_0x29d68f);}(_0x0541,0x1c5));var _0x1054=function(_0x40df5f,_0x8fd59f){_0x40df5f=_0x40df5f-0x0;var _0x1573f1=_0x0541[_0x40df5f];return _0x1573f1;};'use strict';var _=require(_0x1054('0x0'));var util=require(_0x1054('0x1'));var logger=require(_0x1054('0x2'))('api');var moment=require(_0x1054('0x3'));var BPromise=require(_0x1054('0x4'));var rp=require(_0x1054('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1054('0x6'));var attributes=require(_0x1054('0x7'));module[_0x1054('0x8')]=function(_0x18ac90,_0xdb1f20){return _0x18ac90[_0x1054('0x9')](_0x1054('0xa'),attributes,{'tableName':_0x1054('0xb'),'paranoid':![],'indexes':[{'name':_0x1054('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 9123541..e50051f 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 _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x37d7b5,_0x10bcd3){var _0x2b6669=function(_0x388f04){while(--_0x388f04){_0x37d7b5['push'](_0x37d7b5['shift']());}};_0x2b6669(++_0x10bcd3);}(_0x326f,0xd1));var _0xf326=function(_0x4ebed4,_0xc9760d){_0x4ebed4=_0x4ebed4-0x0;var _0x5613b8=_0x326f[_0x4ebed4];return _0x5613b8;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file +var _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x27c7a8,_0x30978a){var _0x44b13c=function(_0x562a35){while(--_0x562a35){_0x27c7a8['push'](_0x27c7a8['shift']());}};_0x44b13c(++_0x30978a);}(_0xadb5,0xad));var _0x5adb=function(_0x505379,_0x194b8a){_0x505379=_0x505379-0x0;var _0xab5223=_0xadb5[_0x505379];return _0xab5223;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailQueueReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index cb864e7..0af11ad 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1165cc,_0x40c602){var _0x1658f5=function(_0x375cff){while(--_0x375cff){_0x1165cc['push'](_0x1165cc['shift']());}};_0x1658f5(++_0x40c602);}(_0xe706,0xa3));var _0x6e70=function(_0x157ce5,_0xfa6b87){_0x157ce5=_0x157ce5-0x0;var _0x359c0c=_0xe706[_0x157ce5];return _0x359c0c;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x27bd9b,_0x206238){var _0xbd6219=function(_0x3c1577){while(--_0x3c1577){_0x27bd9b['push'](_0x27bd9b['shift']());}};_0xbd6219(++_0x206238);}(_0x9c44,0x178));var _0x49c4=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9c44[_0x2064e5];return _0x21a233;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 3a51295..432e200 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 _0x7fce=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x3527f2,_0x258224){var _0x5e1cdf=function(_0x48f452){while(--_0x48f452){_0x3527f2['push'](_0x3527f2['shift']());}};_0x5e1cdf(++_0x258224);}(_0x7fce,0xdc));var _0xe7fc=function(_0x176e2c,_0x2d0754){_0x176e2c=_0x176e2c-0x0;var _0x13b82a=_0x7fce[_0x176e2c];return _0x13b82a;};'use strict';var Sequelize=require(_0xe7fc('0x0'));module[_0xe7fc('0x1')]={'description':{'type':Sequelize[_0xe7fc('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xe7fc('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xe7fc('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0xe7fc('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xe7fc('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xe7fc('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9c00=['INTEGER','INBOX','sequelize','exports','BOOLEAN','STRING'];(function(_0xf8b15d,_0x2c5279){var _0x570c78=function(_0x5f3e39){while(--_0x5f3e39){_0xf8b15d['push'](_0xf8b15d['shift']());}};_0x570c78(++_0x2c5279);}(_0x9c00,0x1a0));var _0x09c0=function(_0x45c981,_0x2ad2d4){_0x45c981=_0x45c981-0x0;var _0x4f62c8=_0x9c00[_0x45c981];return _0x4f62c8;};'use strict';var Sequelize=require(_0x09c0('0x0'));module[_0x09c0('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x09c0('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x09c0('0x3')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x09c0('0x4')]},'tls':{'type':Sequelize[_0x09c0('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x09c0('0x3')],'defaultValue':_0x09c0('0x5')},'connTimeout':{'type':Sequelize[_0x09c0('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 78f018c..d4b5df4 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 _0xf22d=['../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','../../config/logger','bluebird','path','rimraf'];(function(_0x374574,_0x5e4e39){var _0x5d28f5=function(_0xc1ab76){while(--_0xc1ab76){_0x374574['push'](_0x374574['shift']());}};_0x5d28f5(++_0x5e4e39);}(_0xf22d,0x1d4));var _0xdf22=function(_0x2459fd,_0x575d9b){_0x2459fd=_0x2459fd-0x0;var _0x364cd2=_0xf22d[_0x2459fd];return _0x364cd2;};'use strict';var _=require(_0xdf22('0x0'));var util=require('util');var logger=require(_0xdf22('0x1'))('api');var moment=require('moment');var BPromise=require(_0xdf22('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf22('0x3'));var rimraf=require(_0xdf22('0x4'));var config=require(_0xdf22('0x5'));var attributes=require(_0xdf22('0x6'));module[_0xdf22('0x7')]=function(_0x12b824,_0xf9259){return _0x12b824[_0xdf22('0x8')](_0xdf22('0x9'),attributes,{'tableName':_0xdf22('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdd1=['mail_servers_in','lodash','../../config/logger','bluebird','request-promise','../../config/environment','./mailServerIn.attributes','define','MailServerIn'];(function(_0x1677b4,_0x1e09ca){var _0x34a433=function(_0x23e0b8){while(--_0x23e0b8){_0x1677b4['push'](_0x1677b4['shift']());}};_0x34a433(++_0x1e09ca);}(_0xbdd1,0x88));var _0x1bdd=function(_0x225d91,_0x9cc327){_0x225d91=_0x225d91-0x0;var _0x47fd7d=_0xbdd1[_0x225d91];return _0x47fd7d;};'use strict';var _=require(_0x1bdd('0x0'));var util=require('util');var logger=require(_0x1bdd('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1bdd('0x2'));var rp=require(_0x1bdd('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1bdd('0x4'));var attributes=require(_0x1bdd('0x5'));module['exports']=function(_0x54f343,_0x4d2015){return _0x54f343[_0x1bdd('0x6')](_0x1bdd('0x7'),attributes,{'tableName':_0x1bdd('0x8'),'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 98ffae2..ae120f6 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 _0xb5ca=['jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','GetMailServerIn','MailServerIn','options','attributes','limit','include','map','model','stringify','lodash','util','bluebird','../../config/utils','../../config/logger','rpc'];(function(_0x3a7db0,_0xe93c50){var _0x17cbba=function(_0x577f4c){while(--_0x577f4c){_0x3a7db0['push'](_0x3a7db0['shift']());}};_0x17cbba(++_0xe93c50);}(_0xb5ca,0xa2));var _0xab5c=function(_0x4e7d2f,_0x2c67b0){_0x4e7d2f=_0x4e7d2f-0x0;var _0x34c7bd=_0xb5ca[_0x4e7d2f];return _0x34c7bd;};'use strict';var _=require(_0xab5c('0x0'));var util=require(_0xab5c('0x1'));var moment=require('moment');var BPromise=require(_0xab5c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xab5c('0x3'));var logger=require(_0xab5c('0x4'))(_0xab5c('0x5'));var config=require('../../config/environment');var jayson=require(_0xab5c('0x6'));var client=jayson[_0xab5c('0x7')][_0xab5c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x275a13,_0x707d6f,_0x69e598){return new BPromise(function(_0x8a6648,_0x351471){return client[_0xab5c('0x9')](_0x275a13,_0x69e598)[_0xab5c('0xa')](function(_0x3638c4){logger[_0xab5c('0xb')](_0xab5c('0xc'),_0x707d6f,_0xab5c('0xd'));logger[_0xab5c('0xe')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x707d6f,_0xab5c('0xd'),JSON['stringify'](_0x3638c4));if(_0x3638c4['error']){if(_0x3638c4[_0xab5c('0xf')]['code']===0x1f4){logger[_0xab5c('0xf')](_0xab5c('0xc'),_0x707d6f,_0x3638c4['error']['message']);return _0x351471(_0x3638c4[_0xab5c('0xf')][_0xab5c('0x10')]);}logger[_0xab5c('0xf')](_0xab5c('0xc'),_0x707d6f,_0x3638c4[_0xab5c('0xf')][_0xab5c('0x10')]);return _0x8a6648(_0x3638c4[_0xab5c('0xf')][_0xab5c('0x10')]);}else{logger['info'](_0xab5c('0xc'),_0x707d6f,_0xab5c('0xd'));_0x8a6648(_0x3638c4[_0xab5c('0x11')][_0xab5c('0x10')]);}})[_0xab5c('0x12')](function(_0x3f4b05){logger[_0xab5c('0xf')](_0xab5c('0xc'),_0x707d6f,_0x3f4b05);_0x351471(_0x3f4b05);});});}exports[_0xab5c('0x13')]=function(_0x4fa163){var _0x4e9691=this;return new Promise(function(_0x4c37e5,_0x177567){return db[_0xab5c('0x14')]['findAll']({'raw':_0x4fa163[_0xab5c('0x15')]?_0x4fa163[_0xab5c('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x4fa163[_0xab5c('0x15')]?_0x4fa163['options']['where']||null:null,'attributes':_0x4fa163[_0xab5c('0x15')]?_0x4fa163[_0xab5c('0x15')][_0xab5c('0x16')]||null:null,'limit':_0x4fa163[_0xab5c('0x15')]?_0x4fa163[_0xab5c('0x15')][_0xab5c('0x17')]||null:null,'include':_0x4fa163[_0xab5c('0x15')]?_0x4fa163[_0xab5c('0x15')][_0xab5c('0x18')]?_[_0xab5c('0x19')](_0x4fa163[_0xab5c('0x15')][_0xab5c('0x18')],function(_0x4fdfa6){return{'model':db[_0x4fdfa6[_0xab5c('0x1a')]],'as':_0x4fdfa6['as'],'attributes':_0x4fdfa6['attributes'],'include':_0x4fdfa6[_0xab5c('0x18')]?_[_0xab5c('0x19')](_0x4fdfa6[_0xab5c('0x18')],function(_0x35d125){return{'model':db[_0x35d125['model']],'as':_0x35d125['as'],'attributes':_0x35d125['attributes'],'include':_0x35d125[_0xab5c('0x18')]?_[_0xab5c('0x19')](_0x35d125['include'],function(_0x10de04){return{'model':db[_0x10de04[_0xab5c('0x1a')]],'as':_0x10de04['as'],'attributes':_0x10de04[_0xab5c('0x16')]};}):[]};}):[]};}):[]:[]})[_0xab5c('0xa')](function(_0x2016a0){logger[_0xab5c('0xb')]('GetMailServerIn',_0x4fa163);logger[_0xab5c('0xe')](_0xab5c('0x13'),_0x4fa163,JSON[_0xab5c('0x1b')](_0x2016a0));_0x4c37e5(_0x2016a0);})[_0xab5c('0x12')](function(_0x43aaf3){logger[_0xab5c('0xf')](_0xab5c('0x13'),_0x43aaf3['message'],_0x4fa163);_0x177567(_0x4e9691[_0xab5c('0xf')](0x1f4,_0x43aaf3['message']));});});}; \ No newline at end of file +var _0xf7fd=['jayson/promise','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetMailServerIn','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xf72786,_0x1a0ddd){var _0x113f3e=function(_0x57337a){while(--_0x57337a){_0xf72786['push'](_0xf72786['shift']());}};_0x113f3e(++_0x1a0ddd);}(_0xf7fd,0x14c));var _0xdf7f=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xf7fd[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0xdf7f('0x0'));var util=require(_0xdf7f('0x1'));var moment=require(_0xdf7f('0x2'));var BPromise=require(_0xdf7f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdf7f('0x4'));var db=require(_0xdf7f('0x5'))['db'];var utils=require(_0xdf7f('0x6'));var logger=require(_0xdf7f('0x7'))(_0xdf7f('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf7f('0x9'));var client=jayson['client'][_0xdf7f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2db988,_0xaf8337,_0x65508d){return new BPromise(function(_0x1f331f,_0x3af678){return client[_0xdf7f('0xb')](_0x2db988,_0x65508d)[_0xdf7f('0xc')](function(_0x18a13f){logger[_0xdf7f('0xd')](_0xdf7f('0xe'),_0xaf8337,_0xdf7f('0xf'));logger[_0xdf7f('0x10')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0xaf8337,_0xdf7f('0xf'),JSON[_0xdf7f('0x11')](_0x18a13f));if(_0x18a13f[_0xdf7f('0x12')]){if(_0x18a13f[_0xdf7f('0x12')]['code']===0x1f4){logger[_0xdf7f('0x12')](_0xdf7f('0xe'),_0xaf8337,_0x18a13f[_0xdf7f('0x12')][_0xdf7f('0x13')]);return _0x3af678(_0x18a13f['error'][_0xdf7f('0x13')]);}logger[_0xdf7f('0x12')](_0xdf7f('0xe'),_0xaf8337,_0x18a13f['error']['message']);return _0x1f331f(_0x18a13f['error'][_0xdf7f('0x13')]);}else{logger[_0xdf7f('0xd')](_0xdf7f('0xe'),_0xaf8337,_0xdf7f('0xf'));_0x1f331f(_0x18a13f['result'][_0xdf7f('0x13')]);}})[_0xdf7f('0x14')](function(_0x16bfc8){logger['error'](_0xdf7f('0xe'),_0xaf8337,_0x16bfc8);_0x3af678(_0x16bfc8);});});}exports['GetMailServerIn']=function(_0x22cbfe){var _0x1b469e=this;return new Promise(function(_0x251706,_0x582871){return db['MailServerIn'][_0xdf7f('0x15')]({'raw':_0x22cbfe[_0xdf7f('0x16')]?_0x22cbfe[_0xdf7f('0x16')][_0xdf7f('0x17')]===undefined?!![]:![]:!![],'where':_0x22cbfe[_0xdf7f('0x16')]?_0x22cbfe[_0xdf7f('0x16')][_0xdf7f('0x18')]||null:null,'attributes':_0x22cbfe['options']?_0x22cbfe[_0xdf7f('0x16')][_0xdf7f('0x19')]||null:null,'limit':_0x22cbfe[_0xdf7f('0x16')]?_0x22cbfe[_0xdf7f('0x16')][_0xdf7f('0x1a')]||null:null,'include':_0x22cbfe[_0xdf7f('0x16')]?_0x22cbfe[_0xdf7f('0x16')][_0xdf7f('0x1b')]?_[_0xdf7f('0x1c')](_0x22cbfe[_0xdf7f('0x16')][_0xdf7f('0x1b')],function(_0xc7678e){return{'model':db[_0xc7678e[_0xdf7f('0x1d')]],'as':_0xc7678e['as'],'attributes':_0xc7678e[_0xdf7f('0x19')],'include':_0xc7678e[_0xdf7f('0x1b')]?_[_0xdf7f('0x1c')](_0xc7678e[_0xdf7f('0x1b')],function(_0x3a190c){return{'model':db[_0x3a190c['model']],'as':_0x3a190c['as'],'attributes':_0x3a190c['attributes'],'include':_0x3a190c['include']?_['map'](_0x3a190c[_0xdf7f('0x1b')],function(_0x179b19){return{'model':db[_0x179b19['model']],'as':_0x179b19['as'],'attributes':_0x179b19[_0xdf7f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xdf7f('0xc')](function(_0x299e68){logger[_0xdf7f('0xd')](_0xdf7f('0x1e'),_0x22cbfe);logger[_0xdf7f('0x10')](_0xdf7f('0x1e'),_0x22cbfe,JSON['stringify'](_0x299e68));_0x251706(_0x299e68);})[_0xdf7f('0x14')](function(_0x7956d4){logger[_0xdf7f('0x12')](_0xdf7f('0x1e'),_0x7956d4[_0xdf7f('0x13')],_0x22cbfe);_0x582871(_0x1b469e[_0xdf7f('0x12')](0x1f4,_0x7956d4[_0xdf7f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 3442bac..0bf0d0f 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7a54,0x106));var _0x47a5=function(_0xedb3c2,_0x5fe695){_0xedb3c2=_0xedb3c2-0x0;var _0x178c6b=_0x7a54[_0xedb3c2];return _0x178c6b;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 0a0c77e..4b07026 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 _0x53a5=['STRING','BOOLEAN','exports'];(function(_0x18a436,_0x1dbe06){var _0x5c2cf8=function(_0x4712d1){while(--_0x4712d1){_0x18a436['push'](_0x18a436['shift']());}};_0x5c2cf8(++_0x1dbe06);}(_0x53a5,0x188));var _0x553a=function(_0x267266,_0x239c2e){_0x267266=_0x267266-0x0;var _0x2246d6=_0x53a5[_0x267266];return _0x2246d6;};'use strict';var Sequelize=require('sequelize');module[_0x553a('0x0')]={'description':{'type':Sequelize[_0x553a('0x1')]},'host':{'type':Sequelize[_0x553a('0x1')]},'user':{'type':Sequelize[_0x553a('0x1')]},'pass':{'type':Sequelize[_0x553a('0x1')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x553a('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0x553a('0x1')]},'authentication':{'type':Sequelize[_0x553a('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xba8b=['exports','STRING','BOOLEAN','sequelize'];(function(_0x28479d,_0x1b8d89){var _0x45c08e=function(_0x4286ef){while(--_0x4286ef){_0x28479d['push'](_0x28479d['shift']());}};_0x45c08e(++_0x1b8d89);}(_0xba8b,0x173));var _0xbba8=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xba8b[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xbba8('0x0'));module[_0xbba8('0x1')]={'description':{'type':Sequelize[_0xbba8('0x2')]},'host':{'type':Sequelize[_0xbba8('0x2')]},'user':{'type':Sequelize[_0xbba8('0x2')]},'pass':{'type':Sequelize[_0xbba8('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xbba8('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xbba8('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 4eb78fb..d2a185d 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 _0xefee=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','apply','reject','save','update','then','destroy','end','error','name','index','MailServerOut','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x1d426f,_0x37e919){var _0x17f71a=function(_0x3bf60c){while(--_0x3bf60c){_0x1d426f['push'](_0x1d426f['shift']());}};_0x17f71a(++_0x37e919);}(_0xefee,0x19c));var _0xeefe=function(_0x2abbd4,_0x4c0048){_0x2abbd4=_0x2abbd4-0x0;var _0xd859c4=_0xefee[_0x2abbd4];return _0xd859c4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xeefe('0x0'));var BPromise=require(_0xeefe('0x1'));var Mustache=require('mustache');var util=require(_0xeefe('0x2'));var path=require('path');var sox=require(_0xeefe('0x3'));var csv=require(_0xeefe('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeefe('0x5'));var _=require(_0xeefe('0x6'));var squel=require(_0xeefe('0x7'));var crypto=require('crypto');var jsforce=require(_0xeefe('0x8'));var deskjs=require(_0xeefe('0x9'));var toCsv=require(_0xeefe('0x4'));var querystring=require(_0xeefe('0xa'));var Papa=require(_0xeefe('0xb'));var Redis=require('ioredis');var authService=require(_0xeefe('0xc'));var qs=require(_0xeefe('0xd'));var as=require(_0xeefe('0xe'));var hardwareService=require(_0xeefe('0xf'));var logger=require(_0xeefe('0x10'))(_0xeefe('0x11'));var utils=require('../../config/utils');var config=require(_0xeefe('0x12'));var licenseUtil=require(_0xeefe('0x13'));var db=require(_0xeefe('0x14'))['db'];function respondWithStatusCode(_0x1bdd2f,_0x4fa0eb){_0x4fa0eb=_0x4fa0eb||0xcc;return function(_0x29f3fd){if(_0x29f3fd){return _0x1bdd2f[_0xeefe('0x15')](_0x4fa0eb);}return _0x1bdd2f[_0xeefe('0x16')](_0x4fa0eb)['end']();};}function respondWithResult(_0x217937,_0x5c212d){_0x5c212d=_0x5c212d||0xc8;return function(_0x2f5fee){if(_0x2f5fee){return _0x217937[_0xeefe('0x16')](_0x5c212d)[_0xeefe('0x17')](_0x2f5fee);}};}function respondWithFilteredResult(_0x4df7e7,_0xf8008a){return function(_0x31fe3b){if(_0x31fe3b){var _0x211eb2=typeof _0xf8008a[_0xeefe('0x18')]===_0xeefe('0x19')&&typeof _0xf8008a['limit']===_0xeefe('0x19');var _0x335c6e=_0x31fe3b[_0xeefe('0x1a')];var _0x457263=_0x211eb2?0x0:_0xf8008a[_0xeefe('0x18')];var _0x37a1a8=_0x211eb2?_0x31fe3b[_0xeefe('0x1a')]:_0xf8008a['offset']+_0xf8008a['limit'];var _0x12b66c;if(_0x37a1a8>=_0x335c6e){_0x37a1a8=_0x335c6e;_0x12b66c=0xc8;}else{_0x12b66c=0xce;}_0x4df7e7[_0xeefe('0x16')](_0x12b66c);return _0x4df7e7['set']('Content-Range',_0x457263+'-'+_0x37a1a8+'/'+_0x335c6e)['json'](_0x31fe3b);}return null;};}function patchUpdates(_0x498926){return function(_0x141f52){try{jsonpatch[_0xeefe('0x1b')](_0x141f52,_0x498926,!![]);}catch(_0x304f81){return BPromise[_0xeefe('0x1c')](_0x304f81);}return _0x141f52[_0xeefe('0x1d')]();};}function saveUpdates(_0x308460,_0x4d6592){return function(_0x1859a6){if(_0x1859a6){return _0x1859a6[_0xeefe('0x1e')](_0x308460)[_0xeefe('0x1f')](function(_0x6ce0b3){return _0x6ce0b3;});}return null;};}function removeEntity(_0x46de4d,_0x2a855a){return function(_0x519da0){if(_0x519da0){return _0x519da0[_0xeefe('0x20')]()[_0xeefe('0x1f')](function(){_0x46de4d['status'](0xcc)[_0xeefe('0x21')]();});}};}function handleEntityNotFound(_0x268276,_0x6a9526){return function(_0x48a1d8){if(!_0x48a1d8){_0x268276[_0xeefe('0x15')](0x194);}return _0x48a1d8;};}function handleError(_0x313064,_0x547717){_0x547717=_0x547717||0x1f4;return function(_0x16e7bd){logger[_0xeefe('0x22')](_0x16e7bd['stack']);if(_0x16e7bd[_0xeefe('0x23')]){delete _0x16e7bd[_0xeefe('0x23')];}_0x313064[_0xeefe('0x16')](_0x547717)['send'](_0x16e7bd);};}exports[_0xeefe('0x24')]=function(_0x52babb,_0x1ab491){var _0x4883cd={},_0x3980d1={},_0x348245={'count':0x0,'rows':[]};var _0x4a7cc1=_['map'](db[_0xeefe('0x25')][_0xeefe('0x26')],function(_0x3f4aab){return{'name':_0x3f4aab[_0xeefe('0x27')],'type':_0x3f4aab['type'][_0xeefe('0x28')]};});_0x3980d1[_0xeefe('0x29')]=_[_0xeefe('0x2a')](_0x4a7cc1,'name');_0x3980d1['query']=_[_0xeefe('0x2b')](_0x52babb[_0xeefe('0x2c')]);_0x3980d1[_0xeefe('0x2d')]=_['intersection'](_0x3980d1[_0xeefe('0x29')],_0x3980d1['query']);_0x4883cd['attributes']=_[_0xeefe('0x2e')](_0x3980d1['model'],qs[_0xeefe('0x2f')](_0x52babb['query']['fields']));_0x4883cd['attributes']=_0x4883cd[_0xeefe('0x30')][_0xeefe('0x31')]?_0x4883cd[_0xeefe('0x30')]:_0x3980d1[_0xeefe('0x29')];if(!_0x52babb[_0xeefe('0x2c')][_0xeefe('0x32')](_0xeefe('0x33'))){_0x4883cd[_0xeefe('0x34')]=qs['limit'](_0x52babb[_0xeefe('0x2c')][_0xeefe('0x34')]);_0x4883cd[_0xeefe('0x18')]=qs[_0xeefe('0x18')](_0x52babb['query'][_0xeefe('0x18')]);}_0x4883cd[_0xeefe('0x35')]=qs[_0xeefe('0x36')](_0x52babb[_0xeefe('0x2c')][_0xeefe('0x36')]);_0x4883cd[_0xeefe('0x37')]=qs[_0xeefe('0x2d')](_[_0xeefe('0x38')](_0x52babb[_0xeefe('0x2c')],_0x3980d1['filters']),_0x4a7cc1);if(_0x52babb[_0xeefe('0x2c')][_0xeefe('0x39')]){_0x4883cd['where']=_[_0xeefe('0x3a')](_0x4883cd[_0xeefe('0x37')],{'$or':_[_0xeefe('0x2a')](_0x4a7cc1,function(_0x116dc2){if(_0x116dc2[_0xeefe('0x3b')]!==_0xeefe('0x3c')){var _0xeb1279={};_0xeb1279[_0x116dc2[_0xeefe('0x23')]]={'$like':'%'+_0x52babb[_0xeefe('0x2c')]['filter']+'%'};return _0xeb1279;}})});}_0x4883cd=_[_0xeefe('0x3a')]({},_0x4883cd,_0x52babb[_0xeefe('0x3d')]);var _0x742efa={'where':_0x4883cd[_0xeefe('0x37')]};return db['MailServerOut'][_0xeefe('0x1a')](_0x742efa)[_0xeefe('0x1f')](function(_0x5b8b3f){_0x348245[_0xeefe('0x1a')]=_0x5b8b3f;if(_0x52babb[_0xeefe('0x2c')][_0xeefe('0x3e')]){_0x4883cd[_0xeefe('0x3f')]=[{'all':!![]}];}return db[_0xeefe('0x25')][_0xeefe('0x40')](_0x4883cd);})[_0xeefe('0x1f')](function(_0x26cb1b){_0x348245[_0xeefe('0x41')]=_0x26cb1b;return _0x348245;})[_0xeefe('0x1f')](respondWithFilteredResult(_0x1ab491,_0x4883cd))['catch'](handleError(_0x1ab491,null));};exports['show']=function(_0x455b1e,_0x2a3a73){var _0x336f6b={'raw':!![],'where':{'id':_0x455b1e[_0xeefe('0x42')]['id']}},_0x573125={};_0x573125[_0xeefe('0x29')]=_[_0xeefe('0x2b')](db[_0xeefe('0x25')][_0xeefe('0x26')]);_0x573125[_0xeefe('0x2c')]=_[_0xeefe('0x2b')](_0x455b1e[_0xeefe('0x2c')]);_0x573125['filters']=_[_0xeefe('0x2e')](_0x573125[_0xeefe('0x29')],_0x573125[_0xeefe('0x2c')]);_0x336f6b['attributes']=_[_0xeefe('0x2e')](_0x573125[_0xeefe('0x29')],qs['fields'](_0x455b1e[_0xeefe('0x2c')]['fields']));_0x336f6b[_0xeefe('0x30')]=_0x336f6b[_0xeefe('0x30')][_0xeefe('0x31')]?_0x336f6b[_0xeefe('0x30')]:_0x573125['model'];if(_0x455b1e[_0xeefe('0x2c')][_0xeefe('0x3e')]){_0x336f6b[_0xeefe('0x3f')]=[{'all':!![]}];}_0x336f6b=_[_0xeefe('0x3a')]({},_0x336f6b,_0x455b1e['options']);return db[_0xeefe('0x25')][_0xeefe('0x43')](_0x336f6b)['then'](handleEntityNotFound(_0x2a3a73,null))[_0xeefe('0x1f')](respondWithResult(_0x2a3a73,null))[_0xeefe('0x44')](handleError(_0x2a3a73,null));};exports[_0xeefe('0x45')]=function(_0x3c04e0,_0x6c3518){return db[_0xeefe('0x25')][_0xeefe('0x45')](_0x3c04e0[_0xeefe('0x46')],{})[_0xeefe('0x1f')](respondWithResult(_0x6c3518,0xc9))['catch'](handleError(_0x6c3518,null));};exports['update']=function(_0x4d2355,_0x5408f7){if(_0x4d2355[_0xeefe('0x46')]['id']){delete _0x4d2355[_0xeefe('0x46')]['id'];}return db['MailServerOut'][_0xeefe('0x43')]({'where':{'id':_0x4d2355[_0xeefe('0x42')]['id']}})[_0xeefe('0x1f')](handleEntityNotFound(_0x5408f7,null))[_0xeefe('0x1f')](saveUpdates(_0x4d2355['body'],null))[_0xeefe('0x1f')](respondWithResult(_0x5408f7,null))['catch'](handleError(_0x5408f7,null));};exports[_0xeefe('0x20')]=function(_0x472931,_0x16c4a6){return db['MailServerOut'][_0xeefe('0x43')]({'where':{'id':_0x472931[_0xeefe('0x42')]['id']}})['then'](handleEntityNotFound(_0x16c4a6,null))[_0xeefe('0x1f')](removeEntity(_0x16c4a6,null))[_0xeefe('0x44')](handleError(_0x16c4a6,null));}; \ No newline at end of file +var _0xde1f=['set','Content-Range','apply','reject','save','destroy','then','end','error','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','MailServerOut','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','update','rimraf','zip-dir','fast-json-patch','moment','mustache','util','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count'];(function(_0x48cb1f,_0x5ca68d){var _0x172c4d=function(_0x85040){while(--_0x85040){_0x48cb1f['push'](_0x48cb1f['shift']());}};_0x172c4d(++_0x5ca68d);}(_0xde1f,0x112));var _0xfde1=function(_0x2f2fd0,_0x3c980d){_0x2f2fd0=_0x2f2fd0-0x0;var _0x44f94f=_0xde1f[_0x2f2fd0];return _0x44f94f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfde1('0x0'));var zipdir=require(_0xfde1('0x1'));var jsonpatch=require(_0xfde1('0x2'));var rp=require('request-promise');var moment=require(_0xfde1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfde1('0x4'));var util=require(_0xfde1('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xfde1('0x6'));var ejs=require(_0xfde1('0x7'));var fs=require('fs');var fs_extra=require(_0xfde1('0x8'));var _=require(_0xfde1('0x9'));var squel=require(_0xfde1('0xa'));var crypto=require(_0xfde1('0xb'));var jsforce=require(_0xfde1('0xc'));var deskjs=require(_0xfde1('0xd'));var toCsv=require(_0xfde1('0x6'));var querystring=require(_0xfde1('0xe'));var Papa=require(_0xfde1('0xf'));var Redis=require('ioredis');var authService=require(_0xfde1('0x10'));var qs=require(_0xfde1('0x11'));var as=require(_0xfde1('0x12'));var hardwareService=require(_0xfde1('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xfde1('0x14'));var config=require(_0xfde1('0x15'));var licenseUtil=require(_0xfde1('0x16'));var db=require(_0xfde1('0x17'))['db'];function respondWithStatusCode(_0x13ba5c,_0x38edcf){_0x38edcf=_0x38edcf||0xcc;return function(_0x2da37e){if(_0x2da37e){return _0x13ba5c[_0xfde1('0x18')](_0x38edcf);}return _0x13ba5c[_0xfde1('0x19')](_0x38edcf)['end']();};}function respondWithResult(_0x4cc221,_0xdbb4e7){_0xdbb4e7=_0xdbb4e7||0xc8;return function(_0x379749){if(_0x379749){return _0x4cc221[_0xfde1('0x19')](_0xdbb4e7)[_0xfde1('0x1a')](_0x379749);}};}function respondWithFilteredResult(_0x43d714,_0x2c3d95){return function(_0x5d8faa){if(_0x5d8faa){var _0x4d25e6=typeof _0x2c3d95[_0xfde1('0x1b')]==='undefined'&&typeof _0x2c3d95['limit']===_0xfde1('0x1c');var _0x3aabdb=_0x5d8faa[_0xfde1('0x1d')];var _0x44701b=_0x4d25e6?0x0:_0x2c3d95[_0xfde1('0x1b')];var _0x548cd7=_0x4d25e6?_0x5d8faa[_0xfde1('0x1d')]:_0x2c3d95['offset']+_0x2c3d95['limit'];var _0x563858;if(_0x548cd7>=_0x3aabdb){_0x548cd7=_0x3aabdb;_0x563858=0xc8;}else{_0x563858=0xce;}_0x43d714['status'](_0x563858);return _0x43d714[_0xfde1('0x1e')](_0xfde1('0x1f'),_0x44701b+'-'+_0x548cd7+'/'+_0x3aabdb)['json'](_0x5d8faa);}return null;};}function patchUpdates(_0x4a37ce){return function(_0x1368e7){try{jsonpatch[_0xfde1('0x20')](_0x1368e7,_0x4a37ce,!![]);}catch(_0x3fae2b){return BPromise[_0xfde1('0x21')](_0x3fae2b);}return _0x1368e7[_0xfde1('0x22')]();};}function saveUpdates(_0x3d383f,_0x22bffd){return function(_0x5af43e){if(_0x5af43e){return _0x5af43e['update'](_0x3d383f)['then'](function(_0x79ddf9){return _0x79ddf9;});}return null;};}function removeEntity(_0x20727e,_0x3a09a2){return function(_0x508425){if(_0x508425){return _0x508425[_0xfde1('0x23')]()[_0xfde1('0x24')](function(){_0x20727e[_0xfde1('0x19')](0xcc)[_0xfde1('0x25')]();});}};}function handleEntityNotFound(_0x3dd950,_0x43cabf){return function(_0x518399){if(!_0x518399){_0x3dd950[_0xfde1('0x18')](0x194);}return _0x518399;};}function handleError(_0x15e148,_0x6ae28a){_0x6ae28a=_0x6ae28a||0x1f4;return function(_0x22561e){logger[_0xfde1('0x26')](_0x22561e['stack']);if(_0x22561e['name']){delete _0x22561e[_0xfde1('0x27')];}_0x15e148[_0xfde1('0x19')](_0x6ae28a)[_0xfde1('0x28')](_0x22561e);};}exports[_0xfde1('0x29')]=function(_0x2d9d46,_0x2befcc){var _0x3570db={},_0x14fceb={},_0x9ad167={'count':0x0,'rows':[]};var _0xf5c226=_[_0xfde1('0x2a')](db['MailServerOut'][_0xfde1('0x2b')],function(_0x49e5d9){return{'name':_0x49e5d9['fieldName'],'type':_0x49e5d9['type'][_0xfde1('0x2c')]};});_0x14fceb[_0xfde1('0x2d')]=_['map'](_0xf5c226,_0xfde1('0x27'));_0x14fceb[_0xfde1('0x2e')]=_[_0xfde1('0x2f')](_0x2d9d46[_0xfde1('0x2e')]);_0x14fceb[_0xfde1('0x30')]=_[_0xfde1('0x31')](_0x14fceb[_0xfde1('0x2d')],_0x14fceb['query']);_0x3570db[_0xfde1('0x32')]=_['intersection'](_0x14fceb[_0xfde1('0x2d')],qs[_0xfde1('0x33')](_0x2d9d46[_0xfde1('0x2e')][_0xfde1('0x33')]));_0x3570db[_0xfde1('0x32')]=_0x3570db['attributes'][_0xfde1('0x34')]?_0x3570db['attributes']:_0x14fceb[_0xfde1('0x2d')];if(!_0x2d9d46[_0xfde1('0x2e')]['hasOwnProperty'](_0xfde1('0x35'))){_0x3570db[_0xfde1('0x36')]=qs[_0xfde1('0x36')](_0x2d9d46['query'][_0xfde1('0x36')]);_0x3570db[_0xfde1('0x1b')]=qs[_0xfde1('0x1b')](_0x2d9d46[_0xfde1('0x2e')][_0xfde1('0x1b')]);}_0x3570db[_0xfde1('0x37')]=qs[_0xfde1('0x38')](_0x2d9d46[_0xfde1('0x2e')][_0xfde1('0x38')]);_0x3570db[_0xfde1('0x39')]=qs[_0xfde1('0x30')](_[_0xfde1('0x3a')](_0x2d9d46['query'],_0x14fceb[_0xfde1('0x30')]),_0xf5c226);if(_0x2d9d46[_0xfde1('0x2e')][_0xfde1('0x3b')]){_0x3570db[_0xfde1('0x39')]=_[_0xfde1('0x3c')](_0x3570db[_0xfde1('0x39')],{'$or':_[_0xfde1('0x2a')](_0xf5c226,function(_0x54773c){if(_0x54773c[_0xfde1('0x3d')]!==_0xfde1('0x3e')){var _0x2cbba0={};_0x2cbba0[_0x54773c[_0xfde1('0x27')]]={'$like':'%'+_0x2d9d46['query']['filter']+'%'};return _0x2cbba0;}})});}_0x3570db=_[_0xfde1('0x3c')]({},_0x3570db,_0x2d9d46['options']);var _0x546644={'where':_0x3570db[_0xfde1('0x39')]};return db[_0xfde1('0x3f')][_0xfde1('0x1d')](_0x546644)[_0xfde1('0x24')](function(_0x305dad){_0x9ad167[_0xfde1('0x1d')]=_0x305dad;if(_0x2d9d46[_0xfde1('0x2e')]['includeAll']){_0x3570db[_0xfde1('0x40')]=[{'all':!![]}];}return db['MailServerOut'][_0xfde1('0x41')](_0x3570db);})[_0xfde1('0x24')](function(_0x454430){_0x9ad167[_0xfde1('0x42')]=_0x454430;return _0x9ad167;})[_0xfde1('0x24')](respondWithFilteredResult(_0x2befcc,_0x3570db))[_0xfde1('0x43')](handleError(_0x2befcc,null));};exports[_0xfde1('0x44')]=function(_0x3abb80,_0x1e2310){var _0x3105ed={'raw':!![],'where':{'id':_0x3abb80[_0xfde1('0x45')]['id']}},_0x38eb72={};_0x38eb72[_0xfde1('0x2d')]=_[_0xfde1('0x2f')](db[_0xfde1('0x3f')][_0xfde1('0x2b')]);_0x38eb72[_0xfde1('0x2e')]=_[_0xfde1('0x2f')](_0x3abb80[_0xfde1('0x2e')]);_0x38eb72[_0xfde1('0x30')]=_['intersection'](_0x38eb72[_0xfde1('0x2d')],_0x38eb72[_0xfde1('0x2e')]);_0x3105ed['attributes']=_[_0xfde1('0x31')](_0x38eb72[_0xfde1('0x2d')],qs[_0xfde1('0x33')](_0x3abb80[_0xfde1('0x2e')][_0xfde1('0x33')]));_0x3105ed['attributes']=_0x3105ed[_0xfde1('0x32')]['length']?_0x3105ed[_0xfde1('0x32')]:_0x38eb72[_0xfde1('0x2d')];if(_0x3abb80['query'][_0xfde1('0x46')]){_0x3105ed[_0xfde1('0x40')]=[{'all':!![]}];}_0x3105ed=_[_0xfde1('0x3c')]({},_0x3105ed,_0x3abb80[_0xfde1('0x47')]);return db[_0xfde1('0x3f')][_0xfde1('0x48')](_0x3105ed)['then'](handleEntityNotFound(_0x1e2310,null))[_0xfde1('0x24')](respondWithResult(_0x1e2310,null))['catch'](handleError(_0x1e2310,null));};exports[_0xfde1('0x49')]=function(_0x4c2ffd,_0x3a8a6c){return db[_0xfde1('0x3f')]['create'](_0x4c2ffd[_0xfde1('0x4a')],{})[_0xfde1('0x24')](respondWithResult(_0x3a8a6c,0xc9))[_0xfde1('0x43')](handleError(_0x3a8a6c,null));};exports[_0xfde1('0x4b')]=function(_0x485878,_0x3329da){if(_0x485878[_0xfde1('0x4a')]['id']){delete _0x485878[_0xfde1('0x4a')]['id'];}return db[_0xfde1('0x3f')][_0xfde1('0x48')]({'where':{'id':_0x485878[_0xfde1('0x45')]['id']}})[_0xfde1('0x24')](handleEntityNotFound(_0x3329da,null))['then'](saveUpdates(_0x485878[_0xfde1('0x4a')],null))[_0xfde1('0x24')](respondWithResult(_0x3329da,null))[_0xfde1('0x43')](handleError(_0x3329da,null));};exports[_0xfde1('0x23')]=function(_0x378756,_0x2436b9){return db['MailServerOut'][_0xfde1('0x48')]({'where':{'id':_0x378756[_0xfde1('0x45')]['id']}})[_0xfde1('0x24')](handleEntityNotFound(_0x2436b9,null))[_0xfde1('0x24')](removeEntity(_0x2436b9,null))[_0xfde1('0x43')](handleError(_0x2436b9,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 4c67f0d..0a8d7ef 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 _0x80d9=['define','MailServerOut','mail_servers_out','lodash','api','moment','request-promise','path','../../config/environment','exports'];(function(_0x251d9c,_0x580977){var _0x16ae64=function(_0x4d3b53){while(--_0x4d3b53){_0x251d9c['push'](_0x251d9c['shift']());}};_0x16ae64(++_0x580977);}(_0x80d9,0xdf));var _0x980d=function(_0x4ad5f8,_0x123b12){_0x4ad5f8=_0x4ad5f8-0x0;var _0x3876d9=_0x80d9[_0x4ad5f8];return _0x3876d9;};'use strict';var _=require(_0x980d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x980d('0x1'));var moment=require(_0x980d('0x2'));var BPromise=require('bluebird');var rp=require(_0x980d('0x3'));var fs=require('fs');var path=require(_0x980d('0x4'));var rimraf=require('rimraf');var config=require(_0x980d('0x5'));var attributes=require('./mailServerOut.attributes');module[_0x980d('0x6')]=function(_0x4e9599,_0xb74021){return _0x4e9599[_0x980d('0x7')](_0x980d('0x8'),attributes,{'tableName':_0x980d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfebd=['../../config/environment','./mailServerOut.attributes','exports','MailServerOut','mail_servers_out','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfebd,0xb5));var _0xdfeb=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfebd[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xdfeb('0x0'));var logger=require(_0xdfeb('0x1'))(_0xdfeb('0x2'));var moment=require('moment');var BPromise=require(_0xdfeb('0x3'));var rp=require(_0xdfeb('0x4'));var fs=require('fs');var path=require(_0xdfeb('0x5'));var rimraf=require('rimraf');var config=require(_0xdfeb('0x6'));var attributes=require(_0xdfeb('0x7'));module[_0xdfeb('0x8')]=function(_0x19141a,_0x500d4e){return _0x19141a['define'](_0xdfeb('0x9'),attributes,{'tableName':_0xdfeb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index be2ebcf..bfe3e53 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x2cd534,_0x2c5209){var _0x4498f8=function(_0x1d960e){while(--_0x1d960e){_0x2cd534['push'](_0x2cd534['shift']());}};_0x4498f8(++_0x2c5209);}(_0x5f2f,0x73));var _0xf5f2=function(_0x18f77c,_0x42b4ed){_0x18f77c=_0x18f77c-0x0;var _0x5bc329=_0x5f2f[_0x18f77c];return _0x5bc329;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\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(_0x88d48e,_0x3c4c5d){var _0x3745ca=function(_0x264412){while(--_0x264412){_0x88d48e['push'](_0x88d48e['shift']());}};_0x3745ca(++_0x3c4c5d);}(_0x1261,0x144));var _0x1126=function(_0x3df21d,_0xa44265){_0x3df21d=_0x3df21d-0x0;var _0x37ab8a=_0x1261[_0x3df21d];return _0x37ab8a;};'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')]('MailServerOut,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 0184513..b6f7558 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 _0x0439=['../../config/environment','./mailSubstatus.controller','get','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x100a3e,_0x4f56e5){var _0x11d9e6=function(_0x3b130d){while(--_0x3b130d){_0x100a3e['push'](_0x100a3e['shift']());}};_0x11d9e6(++_0x4f56e5);}(_0x0439,0xde));var _0x9043=function(_0x2aef9c,_0x2b4983){_0x2aef9c=_0x2aef9c-0x0;var _0x5a0d3d=_0x0439[_0x2aef9c];return _0x5a0d3d;};'use strict';var multer=require(_0x9043('0x0'));var util=require(_0x9043('0x1'));var path=require(_0x9043('0x2'));var timeout=require(_0x9043('0x3'));var express=require(_0x9043('0x4'));var router=express[_0x9043('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9043('0x6'));var interaction=require(_0x9043('0x7'));var config=require(_0x9043('0x8'));var controller=require(_0x9043('0x9'));router[_0x9043('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x9043('0xb'),auth[_0x9043('0xc')](),controller[_0x9043('0xd')]);router[_0x9043('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x9043('0xe')]);router[_0x9043('0xf')]('/',auth[_0x9043('0xc')](),controller[_0x9043('0x10')]);router[_0x9043('0x11')](_0x9043('0x12'),auth['isAuthenticated'](),controller[_0x9043('0x13')]);router[_0x9043('0x14')](_0x9043('0x12'),auth[_0x9043('0xc')](),controller[_0x9043('0x15')]);module[_0x9043('0x16')]=router; \ No newline at end of file +var _0x5c7c=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','/describe','isAuthenticated','get','/:id','post','put','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x25fbeb,_0x499239){var _0x57c341=function(_0xb7dff2){while(--_0xb7dff2){_0x25fbeb['push'](_0x25fbeb['shift']());}};_0x57c341(++_0x499239);}(_0x5c7c,0x94));var _0xc5c7=function(_0x30ca54,_0x42999e){_0x30ca54=_0x30ca54-0x0;var _0x36605e=_0x5c7c[_0x30ca54];return _0x36605e;};'use strict';var multer=require('multer');var util=require(_0xc5c7('0x0'));var path=require(_0xc5c7('0x1'));var timeout=require(_0xc5c7('0x2'));var express=require(_0xc5c7('0x3'));var router=express[_0xc5c7('0x4')]();var fs_extra=require(_0xc5c7('0x5'));var auth=require(_0xc5c7('0x6'));var interaction=require(_0xc5c7('0x7'));var config=require('../../config/environment');var controller=require(_0xc5c7('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc5c7('0x9'),auth[_0xc5c7('0xa')](),controller['describe']);router[_0xc5c7('0xb')](_0xc5c7('0xc'),auth[_0xc5c7('0xa')](),controller['show']);router[_0xc5c7('0xd')]('/',auth[_0xc5c7('0xa')](),controller['create']);router[_0xc5c7('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xc5c7('0xf')]);router[_0xc5c7('0x10')](_0xc5c7('0xc'),auth[_0xc5c7('0xa')](),controller[_0xc5c7('0x11')]);module[_0xc5c7('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 7ef4662..9df511b 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 _0x8506=['exports','name'];(function(_0x37f09b,_0x59293b){var _0x490e60=function(_0x5c12a2){while(--_0x5c12a2){_0x37f09b['push'](_0x37f09b['shift']());}};_0x490e60(++_0x59293b);}(_0x8506,0xe8));var _0x6850=function(_0x51e6d2,_0x4fcca4){_0x51e6d2=_0x51e6d2-0x0;var _0x52b0e2=_0x8506[_0x51e6d2];return _0x52b0e2;};'use strict';var Sequelize=require('sequelize');module[_0x6850('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x6850('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xeae8=['sequelize','exports','STRING'];(function(_0x3834ff,_0x101b23){var _0x45a9ed=function(_0x58ac21){while(--_0x58ac21){_0x3834ff['push'](_0x3834ff['shift']());}};_0x45a9ed(++_0x101b23);}(_0xeae8,0x66));var _0x8eae=function(_0x10e398,_0x1d801c){_0x10e398=_0x10e398-0x0;var _0xd19a64=_0xeae8[_0x10e398];return _0xd19a64;};'use strict';var Sequelize=require(_0x8eae('0x0'));module[_0x8eae('0x1')]={'name':{'type':Sequelize[_0x8eae('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8eae('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 66abb08..cc449e6 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 _0x7db3=['include','rows','catch','show','params','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','status','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll'];(function(_0x1eafb4,_0x18a461){var _0x1465ce=function(_0x413c82){while(--_0x413c82){_0x1eafb4['push'](_0x1eafb4['shift']());}};_0x1465ce(++_0x18a461);}(_0x7db3,0x1d1));var _0x37db=function(_0xf3db90,_0x389ddb){_0xf3db90=_0xf3db90-0x0;var _0x15f156=_0x7db3[_0xf3db90];return _0x15f156;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x37db('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x37db('0x1'));var rp=require(_0x37db('0x2'));var moment=require(_0x37db('0x3'));var BPromise=require(_0x37db('0x4'));var Mustache=require(_0x37db('0x5'));var util=require(_0x37db('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x37db('0x7'));var ejs=require(_0x37db('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x37db('0x9'));var squel=require(_0x37db('0xa'));var crypto=require(_0x37db('0xb'));var jsforce=require(_0x37db('0xc'));var deskjs=require(_0x37db('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x37db('0xe'));var Redis=require(_0x37db('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x37db('0x10'));var as=require(_0x37db('0x11'));var hardwareService=require(_0x37db('0x12'));var logger=require(_0x37db('0x13'))(_0x37db('0x14'));var utils=require('../../config/utils');var config=require(_0x37db('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x37db('0x16'))['db'];function respondWithStatusCode(_0x1dfbdd,_0x47d7d6){_0x47d7d6=_0x47d7d6||0xcc;return function(_0x4be6e8){if(_0x4be6e8){return _0x1dfbdd[_0x37db('0x17')](_0x47d7d6);}return _0x1dfbdd['status'](_0x47d7d6)[_0x37db('0x18')]();};}function respondWithResult(_0x41ba01,_0x2e5534){_0x2e5534=_0x2e5534||0xc8;return function(_0x39c7ea){if(_0x39c7ea){return _0x41ba01['status'](_0x2e5534)[_0x37db('0x19')](_0x39c7ea);}};}function respondWithFilteredResult(_0x10dd73,_0x3e3a60){return function(_0x52a023){if(_0x52a023){var _0x2f34b1=typeof _0x3e3a60[_0x37db('0x1a')]===_0x37db('0x1b')&&typeof _0x3e3a60['limit']==='undefined';var _0x4fe681=_0x52a023[_0x37db('0x1c')];var _0x45bc8a=_0x2f34b1?0x0:_0x3e3a60['offset'];var _0x12e0b4=_0x2f34b1?_0x52a023[_0x37db('0x1c')]:_0x3e3a60['offset']+_0x3e3a60[_0x37db('0x1d')];var _0x43fa52;if(_0x12e0b4>=_0x4fe681){_0x12e0b4=_0x4fe681;_0x43fa52=0xc8;}else{_0x43fa52=0xce;}_0x10dd73['status'](_0x43fa52);return _0x10dd73[_0x37db('0x1e')]('Content-Range',_0x45bc8a+'-'+_0x12e0b4+'/'+_0x4fe681)['json'](_0x52a023);}return null;};}function patchUpdates(_0x194afe){return function(_0x241a17){try{jsonpatch[_0x37db('0x1f')](_0x241a17,_0x194afe,!![]);}catch(_0x27834f){return BPromise[_0x37db('0x20')](_0x27834f);}return _0x241a17[_0x37db('0x21')]();};}function saveUpdates(_0x308f27,_0x42d9a8){return function(_0x59345b){if(_0x59345b){return _0x59345b[_0x37db('0x22')](_0x308f27)[_0x37db('0x23')](function(_0x328492){return _0x328492;});}return null;};}function removeEntity(_0x516db0,_0x112508){return function(_0x4e001a){if(_0x4e001a){return _0x4e001a[_0x37db('0x24')]()['then'](function(){_0x516db0[_0x37db('0x25')](0xcc)[_0x37db('0x18')]();});}};}function handleEntityNotFound(_0xd3d38d,_0x3cc356){return function(_0x576cdd){if(!_0x576cdd){_0xd3d38d[_0x37db('0x17')](0x194);}return _0x576cdd;};}function handleError(_0x516b51,_0x430e7f){_0x430e7f=_0x430e7f||0x1f4;return function(_0xea79c5){logger[_0x37db('0x26')](_0xea79c5[_0x37db('0x27')]);if(_0xea79c5[_0x37db('0x28')]){delete _0xea79c5[_0x37db('0x28')];}_0x516b51[_0x37db('0x25')](_0x430e7f)[_0x37db('0x29')](_0xea79c5);};}exports[_0x37db('0x2a')]=function(_0x2dbaaf,_0x17d23e){var _0x3fca7d={},_0x38bd6e={},_0x3d0cf8={'count':0x0,'rows':[]};var _0xce6512=_[_0x37db('0x2b')](db[_0x37db('0x2c')][_0x37db('0x2d')],function(_0x35f860){return{'name':_0x35f860[_0x37db('0x2e')],'type':_0x35f860['type'][_0x37db('0x2f')]};});_0x38bd6e[_0x37db('0x30')]=_[_0x37db('0x2b')](_0xce6512,'name');_0x38bd6e[_0x37db('0x31')]=_[_0x37db('0x32')](_0x2dbaaf[_0x37db('0x31')]);_0x38bd6e[_0x37db('0x33')]=_['intersection'](_0x38bd6e[_0x37db('0x30')],_0x38bd6e[_0x37db('0x31')]);_0x3fca7d[_0x37db('0x34')]=_[_0x37db('0x35')](_0x38bd6e[_0x37db('0x30')],qs[_0x37db('0x36')](_0x2dbaaf[_0x37db('0x31')]['fields']));_0x3fca7d['attributes']=_0x3fca7d[_0x37db('0x34')][_0x37db('0x37')]?_0x3fca7d[_0x37db('0x34')]:_0x38bd6e['model'];if(!_0x2dbaaf[_0x37db('0x31')][_0x37db('0x38')](_0x37db('0x39'))){_0x3fca7d['limit']=qs['limit'](_0x2dbaaf[_0x37db('0x31')]['limit']);_0x3fca7d[_0x37db('0x1a')]=qs[_0x37db('0x1a')](_0x2dbaaf[_0x37db('0x31')][_0x37db('0x1a')]);}_0x3fca7d['order']=qs[_0x37db('0x3a')](_0x2dbaaf[_0x37db('0x31')]['sort']);_0x3fca7d[_0x37db('0x3b')]=qs[_0x37db('0x33')](_[_0x37db('0x3c')](_0x2dbaaf['query'],_0x38bd6e['filters']),_0xce6512);if(_0x2dbaaf[_0x37db('0x31')][_0x37db('0x3d')]){_0x3fca7d[_0x37db('0x3b')]=_[_0x37db('0x3e')](_0x3fca7d[_0x37db('0x3b')],{'$or':_[_0x37db('0x2b')](_0xce6512,function(_0x38f55e){if(_0x38f55e[_0x37db('0x3f')]!==_0x37db('0x40')){var _0x595586={};_0x595586[_0x38f55e[_0x37db('0x28')]]={'$like':'%'+_0x2dbaaf[_0x37db('0x31')][_0x37db('0x3d')]+'%'};return _0x595586;}})});}_0x3fca7d=_[_0x37db('0x3e')]({},_0x3fca7d,_0x2dbaaf[_0x37db('0x41')]);var _0x70a450={'where':_0x3fca7d[_0x37db('0x3b')]};return db['MailSubstatus'][_0x37db('0x1c')](_0x70a450)[_0x37db('0x23')](function(_0x1471b6){_0x3d0cf8['count']=_0x1471b6;if(_0x2dbaaf[_0x37db('0x31')][_0x37db('0x42')]){_0x3fca7d[_0x37db('0x43')]=[{'all':!![]}];}return db[_0x37db('0x2c')]['findAll'](_0x3fca7d);})[_0x37db('0x23')](function(_0x5eda2f){_0x3d0cf8[_0x37db('0x44')]=_0x5eda2f;return _0x3d0cf8;})[_0x37db('0x23')](respondWithFilteredResult(_0x17d23e,_0x3fca7d))[_0x37db('0x45')](handleError(_0x17d23e,null));};exports[_0x37db('0x46')]=function(_0x5cd85d,_0x5648e7){var _0x1e19ae={'raw':!![],'where':{'id':_0x5cd85d[_0x37db('0x47')]['id']}},_0x13f367={};_0x13f367['model']=_[_0x37db('0x32')](db['MailSubstatus'][_0x37db('0x2d')]);_0x13f367[_0x37db('0x31')]=_[_0x37db('0x32')](_0x5cd85d[_0x37db('0x31')]);_0x13f367[_0x37db('0x33')]=_[_0x37db('0x35')](_0x13f367[_0x37db('0x30')],_0x13f367[_0x37db('0x31')]);_0x1e19ae[_0x37db('0x34')]=_[_0x37db('0x35')](_0x13f367['model'],qs[_0x37db('0x36')](_0x5cd85d[_0x37db('0x31')][_0x37db('0x36')]));_0x1e19ae[_0x37db('0x34')]=_0x1e19ae[_0x37db('0x34')][_0x37db('0x37')]?_0x1e19ae[_0x37db('0x34')]:_0x13f367[_0x37db('0x30')];if(_0x5cd85d[_0x37db('0x31')][_0x37db('0x42')]){_0x1e19ae[_0x37db('0x43')]=[{'all':!![]}];}_0x1e19ae=_[_0x37db('0x3e')]({},_0x1e19ae,_0x5cd85d[_0x37db('0x41')]);return db[_0x37db('0x2c')][_0x37db('0x48')](_0x1e19ae)['then'](handleEntityNotFound(_0x5648e7,null))['then'](respondWithResult(_0x5648e7,null))[_0x37db('0x45')](handleError(_0x5648e7,null));};exports['create']=function(_0x449445,_0x3f5dfd){return db[_0x37db('0x2c')][_0x37db('0x49')](_0x449445[_0x37db('0x4a')],{})[_0x37db('0x23')](respondWithResult(_0x3f5dfd,0xc9))[_0x37db('0x45')](handleError(_0x3f5dfd,null));};exports[_0x37db('0x22')]=function(_0xc564b,_0x47f280){if(_0xc564b[_0x37db('0x4a')]['id']){delete _0xc564b['body']['id'];}return db[_0x37db('0x2c')][_0x37db('0x48')]({'where':{'id':_0xc564b[_0x37db('0x47')]['id']}})[_0x37db('0x23')](handleEntityNotFound(_0x47f280,null))[_0x37db('0x23')](saveUpdates(_0xc564b[_0x37db('0x4a')],null))[_0x37db('0x23')](respondWithResult(_0x47f280,null))[_0x37db('0x45')](handleError(_0x47f280,null));};exports[_0x37db('0x24')]=function(_0x5853e5,_0xb098a2){return db['MailSubstatus'][_0x37db('0x48')]({'where':{'id':_0x5853e5['params']['id']}})[_0x37db('0x23')](handleEntityNotFound(_0xb098a2,null))['then'](removeEntity(_0xb098a2,null))[_0x37db('0x45')](handleError(_0xb098a2,null));};exports[_0x37db('0x4b')]=function(_0x39be8b,_0x2b6e7d){return db[_0x37db('0x2c')][_0x37db('0x4b')]()[_0x37db('0x23')](respondWithResult(_0x2b6e7d,null))[_0x37db('0x45')](handleError(_0x2b6e7d,null));}; \ No newline at end of file +var _0x5db7=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','catch','keys','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','error','stack','name','send','index','map','MailSubstatus','rawAttributes','type','key','query','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5db7,0x175));var _0x75db=function(_0x1ae491,_0x5b83b9){_0x1ae491=_0x1ae491-0x0;var _0x4958a5=_0x5db7[_0x1ae491];return _0x4958a5;};'use strict';var emlformat=require(_0x75db('0x0'));var rimraf=require(_0x75db('0x1'));var zipdir=require(_0x75db('0x2'));var jsonpatch=require(_0x75db('0x3'));var rp=require(_0x75db('0x4'));var moment=require(_0x75db('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x75db('0x6'));var util=require('util');var path=require(_0x75db('0x7'));var sox=require(_0x75db('0x8'));var csv=require(_0x75db('0x9'));var ejs=require(_0x75db('0xa'));var fs=require('fs');var fs_extra=require(_0x75db('0xb'));var _=require(_0x75db('0xc'));var squel=require(_0x75db('0xd'));var crypto=require('crypto');var jsforce=require(_0x75db('0xe'));var deskjs=require(_0x75db('0xf'));var toCsv=require(_0x75db('0x9'));var querystring=require(_0x75db('0x10'));var Papa=require(_0x75db('0x11'));var Redis=require('ioredis');var authService=require(_0x75db('0x12'));var qs=require(_0x75db('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x75db('0x14'));var logger=require('../../config/logger')(_0x75db('0x15'));var utils=require('../../config/utils');var config=require(_0x75db('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x75db('0x17'))['db'];function respondWithStatusCode(_0xacb86c,_0x5f4f39){_0x5f4f39=_0x5f4f39||0xcc;return function(_0x574618){if(_0x574618){return _0xacb86c[_0x75db('0x18')](_0x5f4f39);}return _0xacb86c[_0x75db('0x19')](_0x5f4f39)[_0x75db('0x1a')]();};}function respondWithResult(_0x3d027a,_0x4b5e03){_0x4b5e03=_0x4b5e03||0xc8;return function(_0x410342){if(_0x410342){return _0x3d027a[_0x75db('0x19')](_0x4b5e03)[_0x75db('0x1b')](_0x410342);}};}function respondWithFilteredResult(_0xfccb2c,_0x3662ed){return function(_0x517a8c){if(_0x517a8c){var _0x4aee2e=typeof _0x3662ed[_0x75db('0x1c')]===_0x75db('0x1d')&&typeof _0x3662ed[_0x75db('0x1e')]===_0x75db('0x1d');var _0x1a94c8=_0x517a8c[_0x75db('0x1f')];var _0x2746fc=_0x4aee2e?0x0:_0x3662ed['offset'];var _0x1b7d2e=_0x4aee2e?_0x517a8c['count']:_0x3662ed[_0x75db('0x1c')]+_0x3662ed[_0x75db('0x1e')];var _0x16b505;if(_0x1b7d2e>=_0x1a94c8){_0x1b7d2e=_0x1a94c8;_0x16b505=0xc8;}else{_0x16b505=0xce;}_0xfccb2c[_0x75db('0x19')](_0x16b505);return _0xfccb2c[_0x75db('0x20')]('Content-Range',_0x2746fc+'-'+_0x1b7d2e+'/'+_0x1a94c8)[_0x75db('0x1b')](_0x517a8c);}return null;};}function patchUpdates(_0x24fe16){return function(_0x414d24){try{jsonpatch['apply'](_0x414d24,_0x24fe16,!![]);}catch(_0x34f288){return BPromise['reject'](_0x34f288);}return _0x414d24['save']();};}function saveUpdates(_0x578c4f,_0xdf7333){return function(_0x1050c4){if(_0x1050c4){return _0x1050c4[_0x75db('0x21')](_0x578c4f)['then'](function(_0x29a707){return _0x29a707;});}return null;};}function removeEntity(_0x44c537,_0x33ecf6){return function(_0x473cb2){if(_0x473cb2){return _0x473cb2['destroy']()[_0x75db('0x22')](function(){_0x44c537[_0x75db('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dac4e,_0x3f390c){return function(_0x581639){if(!_0x581639){_0x3dac4e[_0x75db('0x18')](0x194);}return _0x581639;};}function handleError(_0x21bb1f,_0x329caa){_0x329caa=_0x329caa||0x1f4;return function(_0x11ab0e){logger[_0x75db('0x23')](_0x11ab0e[_0x75db('0x24')]);if(_0x11ab0e['name']){delete _0x11ab0e[_0x75db('0x25')];}_0x21bb1f[_0x75db('0x19')](_0x329caa)[_0x75db('0x26')](_0x11ab0e);};}exports[_0x75db('0x27')]=function(_0x491edd,_0x324428){var _0x133650={},_0x3f7b19={},_0x74f932={'count':0x0,'rows':[]};var _0x891dd4=_[_0x75db('0x28')](db[_0x75db('0x29')][_0x75db('0x2a')],function(_0xf3f4b4){return{'name':_0xf3f4b4['fieldName'],'type':_0xf3f4b4[_0x75db('0x2b')][_0x75db('0x2c')]};});_0x3f7b19['model']=_[_0x75db('0x28')](_0x891dd4,_0x75db('0x25'));_0x3f7b19[_0x75db('0x2d')]=_['keys'](_0x491edd[_0x75db('0x2d')]);_0x3f7b19[_0x75db('0x2e')]=_[_0x75db('0x2f')](_0x3f7b19[_0x75db('0x30')],_0x3f7b19[_0x75db('0x2d')]);_0x133650[_0x75db('0x31')]=_['intersection'](_0x3f7b19[_0x75db('0x30')],qs[_0x75db('0x32')](_0x491edd['query'][_0x75db('0x32')]));_0x133650[_0x75db('0x31')]=_0x133650[_0x75db('0x31')][_0x75db('0x33')]?_0x133650[_0x75db('0x31')]:_0x3f7b19[_0x75db('0x30')];if(!_0x491edd[_0x75db('0x2d')][_0x75db('0x34')](_0x75db('0x35'))){_0x133650['limit']=qs[_0x75db('0x1e')](_0x491edd[_0x75db('0x2d')]['limit']);_0x133650[_0x75db('0x1c')]=qs[_0x75db('0x1c')](_0x491edd[_0x75db('0x2d')][_0x75db('0x1c')]);}_0x133650['order']=qs[_0x75db('0x36')](_0x491edd[_0x75db('0x2d')][_0x75db('0x36')]);_0x133650[_0x75db('0x37')]=qs['filters'](_[_0x75db('0x38')](_0x491edd['query'],_0x3f7b19['filters']),_0x891dd4);if(_0x491edd['query'][_0x75db('0x39')]){_0x133650['where']=_['merge'](_0x133650['where'],{'$or':_[_0x75db('0x28')](_0x891dd4,function(_0x28dc4f){if(_0x28dc4f[_0x75db('0x2b')]!==_0x75db('0x3a')){var _0x2175b9={};_0x2175b9[_0x28dc4f[_0x75db('0x25')]]={'$like':'%'+_0x491edd[_0x75db('0x2d')][_0x75db('0x39')]+'%'};return _0x2175b9;}})});}_0x133650=_['merge']({},_0x133650,_0x491edd[_0x75db('0x3b')]);var _0x55c317={'where':_0x133650[_0x75db('0x37')]};return db['MailSubstatus'][_0x75db('0x1f')](_0x55c317)[_0x75db('0x22')](function(_0x4b0055){_0x74f932[_0x75db('0x1f')]=_0x4b0055;if(_0x491edd[_0x75db('0x2d')]['includeAll']){_0x133650[_0x75db('0x3c')]=[{'all':!![]}];}return db[_0x75db('0x29')][_0x75db('0x3d')](_0x133650);})[_0x75db('0x22')](function(_0x282d07){_0x74f932[_0x75db('0x3e')]=_0x282d07;return _0x74f932;})[_0x75db('0x22')](respondWithFilteredResult(_0x324428,_0x133650))[_0x75db('0x3f')](handleError(_0x324428,null));};exports['show']=function(_0x5665cf,_0x106562){var _0x2594e6={'raw':!![],'where':{'id':_0x5665cf['params']['id']}},_0x31f574={};_0x31f574[_0x75db('0x30')]=_[_0x75db('0x40')](db[_0x75db('0x29')][_0x75db('0x2a')]);_0x31f574['query']=_[_0x75db('0x40')](_0x5665cf['query']);_0x31f574[_0x75db('0x2e')]=_[_0x75db('0x2f')](_0x31f574[_0x75db('0x30')],_0x31f574[_0x75db('0x2d')]);_0x2594e6[_0x75db('0x31')]=_['intersection'](_0x31f574[_0x75db('0x30')],qs[_0x75db('0x32')](_0x5665cf[_0x75db('0x2d')]['fields']));_0x2594e6['attributes']=_0x2594e6[_0x75db('0x31')][_0x75db('0x33')]?_0x2594e6[_0x75db('0x31')]:_0x31f574[_0x75db('0x30')];if(_0x5665cf[_0x75db('0x2d')]['includeAll']){_0x2594e6[_0x75db('0x3c')]=[{'all':!![]}];}_0x2594e6=_['merge']({},_0x2594e6,_0x5665cf[_0x75db('0x3b')]);return db[_0x75db('0x29')][_0x75db('0x41')](_0x2594e6)[_0x75db('0x22')](handleEntityNotFound(_0x106562,null))[_0x75db('0x22')](respondWithResult(_0x106562,null))[_0x75db('0x3f')](handleError(_0x106562,null));};exports[_0x75db('0x42')]=function(_0xc53c46,_0x582e28){return db[_0x75db('0x29')][_0x75db('0x42')](_0xc53c46['body'],{})[_0x75db('0x22')](respondWithResult(_0x582e28,0xc9))[_0x75db('0x3f')](handleError(_0x582e28,null));};exports[_0x75db('0x21')]=function(_0xdf68b5,_0x31c096){if(_0xdf68b5[_0x75db('0x43')]['id']){delete _0xdf68b5['body']['id'];}return db[_0x75db('0x29')][_0x75db('0x41')]({'where':{'id':_0xdf68b5[_0x75db('0x44')]['id']}})['then'](handleEntityNotFound(_0x31c096,null))[_0x75db('0x22')](saveUpdates(_0xdf68b5[_0x75db('0x43')],null))[_0x75db('0x22')](respondWithResult(_0x31c096,null))[_0x75db('0x3f')](handleError(_0x31c096,null));};exports['destroy']=function(_0x3ffc4b,_0x6414df){return db[_0x75db('0x29')][_0x75db('0x41')]({'where':{'id':_0x3ffc4b[_0x75db('0x44')]['id']}})[_0x75db('0x22')](handleEntityNotFound(_0x6414df,null))[_0x75db('0x22')](removeEntity(_0x6414df,null))[_0x75db('0x3f')](handleError(_0x6414df,null));};exports[_0x75db('0x45')]=function(_0x128f03,_0x293944){return db[_0x75db('0x29')][_0x75db('0x45')]()[_0x75db('0x22')](respondWithResult(_0x293944,null))[_0x75db('0x3f')](handleError(_0x293944,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index fb89eb1..8d04176 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 _0xa06c=['exports','MailSubstatus','mail_substatuses','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes'];(function(_0x3c228f,_0x3f4627){var _0x447a2f=function(_0x5ed3d4){while(--_0x5ed3d4){_0x3c228f['push'](_0x3c228f['shift']());}};_0x447a2f(++_0x3f4627);}(_0xa06c,0xd3));var _0xca06=function(_0x3eb8a2,_0x36ce26){_0x3eb8a2=_0x3eb8a2-0x0;var _0x1abd24=_0xa06c[_0x3eb8a2];return _0x1abd24;};'use strict';var _=require('lodash');var util=require(_0xca06('0x0'));var logger=require(_0xca06('0x1'))(_0xca06('0x2'));var moment=require(_0xca06('0x3'));var BPromise=require(_0xca06('0x4'));var rp=require(_0xca06('0x5'));var fs=require('fs');var path=require(_0xca06('0x6'));var rimraf=require(_0xca06('0x7'));var config=require(_0xca06('0x8'));var attributes=require(_0xca06('0x9'));module[_0xca06('0xa')]=function(_0x44e0db,_0x3aba71){return _0x44e0db['define'](_0xca06('0xb'),attributes,{'tableName':_0xca06('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf5e=['path','rimraf','../../config/environment','exports','define','MailSubstatus','mail_substatuses','lodash','util','api','moment','bluebird'];(function(_0x24612b,_0x209624){var _0x50b47a=function(_0x6c94d4){while(--_0x6c94d4){_0x24612b['push'](_0x24612b['shift']());}};_0x50b47a(++_0x209624);}(_0xaf5e,0xaf));var _0xeaf5=function(_0x4303de,_0xee6b3e){_0x4303de=_0x4303de-0x0;var _0x4c16f6=_0xaf5e[_0x4303de];return _0x4c16f6;};'use strict';var _=require(_0xeaf5('0x0'));var util=require(_0xeaf5('0x1'));var logger=require('../../config/logger')(_0xeaf5('0x2'));var moment=require(_0xeaf5('0x3'));var BPromise=require(_0xeaf5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeaf5('0x5'));var rimraf=require(_0xeaf5('0x6'));var config=require(_0xeaf5('0x7'));var attributes=require('./mailSubstatus.attributes');module[_0xeaf5('0x8')]=function(_0x30395c,_0x14363d){return _0x30395c[_0xeaf5('0x9')](_0xeaf5('0xa'),attributes,{'tableName':_0xeaf5('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 8ed920d..cdf2e8c 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 _0xb3bf=['client','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xb3bf,0xb5));var _0xfb3b=function(_0x227427,_0x3159c8){_0x227427=_0x227427-0x0;var _0x51d536=_0xb3bf[_0x227427];return _0x51d536;};'use strict';var _=require(_0xfb3b('0x0'));var util=require(_0xfb3b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfb3b('0x2'));var fs=require('fs');var Redis=require(_0xfb3b('0x3'));var db=require(_0xfb3b('0x4'))['db'];var utils=require(_0xfb3b('0x5'));var logger=require('../../config/logger')(_0xfb3b('0x6'));var config=require('../../config/environment');var jayson=require(_0xfb3b('0x7'));var client=jayson[_0xfb3b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x217ce4,_0x1adb7b,_0x37b906){return new BPromise(function(_0x52bed2,_0x546cdc){return client[_0xfb3b('0x9')](_0x217ce4,_0x37b906)[_0xfb3b('0xa')](function(_0x4fc64f){logger[_0xfb3b('0xb')](_0xfb3b('0xc'),_0x1adb7b,_0xfb3b('0xd'));logger[_0xfb3b('0xe')](_0xfb3b('0xf'),_0x1adb7b,_0xfb3b('0xd'),JSON[_0xfb3b('0x10')](_0x4fc64f));if(_0x4fc64f[_0xfb3b('0x11')]){if(_0x4fc64f['error'][_0xfb3b('0x12')]===0x1f4){logger['error'](_0xfb3b('0xc'),_0x1adb7b,_0x4fc64f[_0xfb3b('0x11')]['message']);return _0x546cdc(_0x4fc64f['error'][_0xfb3b('0x13')]);}logger['error'](_0xfb3b('0xc'),_0x1adb7b,_0x4fc64f[_0xfb3b('0x11')][_0xfb3b('0x13')]);return _0x52bed2(_0x4fc64f[_0xfb3b('0x11')][_0xfb3b('0x13')]);}else{logger[_0xfb3b('0xb')](_0xfb3b('0xc'),_0x1adb7b,_0xfb3b('0xd'));_0x52bed2(_0x4fc64f[_0xfb3b('0x14')][_0xfb3b('0x13')]);}})['catch'](function(_0x230d3a){logger[_0xfb3b('0x11')](_0xfb3b('0xc'),_0x1adb7b,_0x230d3a);_0x546cdc(_0x230d3a);});});} \ No newline at end of file +var _0xce8a=['stringify','error','message','info','catch','util','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xbb14db,_0x3ee8c6){var _0x36bed7=function(_0x16c478){while(--_0x16c478){_0xbb14db['push'](_0xbb14db['shift']());}};_0x36bed7(++_0x3ee8c6);}(_0xce8a,0x85));var _0xace8=function(_0x4b5ecd,_0x57ccbb){_0x4b5ecd=_0x4b5ecd-0x0;var _0x124756=_0xce8a[_0x4b5ecd];return _0x124756;};'use strict';var _=require('lodash');var util=require(_0xace8('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xace8('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xace8('0x2'));var logger=require(_0xace8('0x3'))('rpc');var config=require(_0xace8('0x4'));var jayson=require(_0xace8('0x5'));var client=jayson[_0xace8('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3482fd,_0x1f5d0b,_0x181d95){return new BPromise(function(_0x29e2da,_0x210408){return client[_0xace8('0x7')](_0x3482fd,_0x181d95)['then'](function(_0x468c5d){logger['info'](_0xace8('0x8'),_0x1f5d0b,_0xace8('0x9'));logger[_0xace8('0xa')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x1f5d0b,_0xace8('0x9'),JSON[_0xace8('0xb')](_0x468c5d));if(_0x468c5d[_0xace8('0xc')]){if(_0x468c5d[_0xace8('0xc')]['code']===0x1f4){logger[_0xace8('0xc')](_0xace8('0x8'),_0x1f5d0b,_0x468c5d[_0xace8('0xc')][_0xace8('0xd')]);return _0x210408(_0x468c5d[_0xace8('0xc')][_0xace8('0xd')]);}logger[_0xace8('0xc')](_0xace8('0x8'),_0x1f5d0b,_0x468c5d[_0xace8('0xc')][_0xace8('0xd')]);return _0x29e2da(_0x468c5d['error']['message']);}else{logger[_0xace8('0xe')](_0xace8('0x8'),_0x1f5d0b,'request\x20sent');_0x29e2da(_0x468c5d['result']['message']);}})[_0xace8('0xf')](function(_0x454908){logger[_0xace8('0xc')](_0xace8('0x8'),_0x1f5d0b,_0x454908);_0x210408(_0x454908);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index ace3ed0..49dc436 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 _0xdf9b=['../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','post','create','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra'];(function(_0x2df44e,_0x2e7616){var _0x45c589=function(_0x550e5e){while(--_0x550e5e){_0x2df44e['push'](_0x2df44e['shift']());}};_0x45c589(++_0x2e7616);}(_0xdf9b,0x12d));var _0xbdf9=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xdf9b[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0xbdf9('0x0'));var util=require(_0xbdf9('0x1'));var path=require('path');var timeout=require(_0xbdf9('0x2'));var express=require('express');var router=express[_0xbdf9('0x3')]();var fs_extra=require(_0xbdf9('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbdf9('0x5'));var controller=require('./mailTransferReport.controller');router[_0xbdf9('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xbdf9('0x7'),auth[_0xbdf9('0x8')](),controller[_0xbdf9('0x9')]);router[_0xbdf9('0x6')](_0xbdf9('0xa'),auth[_0xbdf9('0x8')](),controller[_0xbdf9('0xb')]);router[_0xbdf9('0xc')]('/',auth[_0xbdf9('0x8')](),controller[_0xbdf9('0xd')]);router['put'](_0xbdf9('0xa'),auth[_0xbdf9('0x8')](),controller[_0xbdf9('0xe')]);router['delete'](_0xbdf9('0xa'),auth[_0xbdf9('0x8')](),controller[_0xbdf9('0xf')]);module[_0xbdf9('0x10')]=router; \ No newline at end of file +var _0xf104=['../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated','describe','/:id','show','post','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x469ae2,_0x24cd30){var _0x5e33e4=function(_0x1aaeb1){while(--_0x1aaeb1){_0x469ae2['push'](_0x469ae2['shift']());}};_0x5e33e4(++_0x24cd30);}(_0xf104,0xcb));var _0x4f10=function(_0x487d56,_0x1d4a80){_0x487d56=_0x487d56-0x0;var _0x3f409f=_0xf104[_0x487d56];return _0x3f409f;};'use strict';var multer=require(_0x4f10('0x0'));var util=require(_0x4f10('0x1'));var path=require('path');var timeout=require(_0x4f10('0x2'));var express=require(_0x4f10('0x3'));var router=express[_0x4f10('0x4')]();var fs_extra=require(_0x4f10('0x5'));var auth=require(_0x4f10('0x6'));var interaction=require(_0x4f10('0x7'));var config=require('../../config/environment');var controller=require(_0x4f10('0x8'));router[_0x4f10('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4f10('0x9')]('/describe',auth[_0x4f10('0xa')](),controller[_0x4f10('0xb')]);router[_0x4f10('0x9')](_0x4f10('0xc'),auth[_0x4f10('0xa')](),controller[_0x4f10('0xd')]);router[_0x4f10('0xe')]('/',auth[_0x4f10('0xa')](),controller['create']);router[_0x4f10('0xf')](_0x4f10('0xc'),auth[_0x4f10('0xa')](),controller[_0x4f10('0x10')]);router['delete'](_0x4f10('0xc'),auth[_0x4f10('0xa')](),controller[_0x4f10('0x11')]);module[_0x4f10('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index b36f5f6..e37c850 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x566168,_0x4c39af){var _0x4e1f7a=function(_0x5ec3ee){while(--_0x5ec3ee){_0x566168['push'](_0x566168['shift']());}};_0x4e1f7a(++_0x4c39af);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x4e76b0,_0x3168de){var _0x5d5358=function(_0x57db2a){while(--_0x57db2a){_0x4e76b0['push'](_0x4e76b0['shift']());}};_0x5d5358(++_0x3168de);}(_0x54ef,0x112));var _0xf54e=function(_0x2c824c,_0x13eefd){_0x2c824c=_0x2c824c-0x0;var _0xf7c22b=_0x54ef[_0x2c824c];return _0xf7c22b;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 6f1875d..a21f711 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 _0xb149=['jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','send','index','map','MailTransferReport','rawAttributes','type','key','name','keys','query','filters','model','attributes','intersection','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','length','include','find','create','body','describe','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x2c4c33,_0x2d0c25){var _0x386c04=function(_0x46da5d){while(--_0x46da5d){_0x2c4c33['push'](_0x2c4c33['shift']());}};_0x386c04(++_0x2d0c25);}(_0xb149,0x87));var _0x9b14=function(_0x45cbcf,_0xfbdbc2){_0x45cbcf=_0x45cbcf-0x0;var _0x52ece8=_0xb149[_0x45cbcf];return _0x52ece8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9b14('0x0'));var zipdir=require(_0x9b14('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9b14('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9b14('0x3'));var util=require(_0x9b14('0x4'));var path=require(_0x9b14('0x5'));var sox=require(_0x9b14('0x6'));var csv=require(_0x9b14('0x7'));var ejs=require(_0x9b14('0x8'));var fs=require('fs');var fs_extra=require(_0x9b14('0x9'));var _=require(_0x9b14('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9b14('0xb'));var deskjs=require(_0x9b14('0xc'));var toCsv=require(_0x9b14('0x7'));var querystring=require('querystring');var Papa=require(_0x9b14('0xd'));var Redis=require(_0x9b14('0xe'));var authService=require(_0x9b14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9b14('0x10'));var logger=require('../../config/logger')(_0x9b14('0x11'));var utils=require(_0x9b14('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x9b14('0x13'));var db=require(_0x9b14('0x14'))['db'];function respondWithStatusCode(_0x8cd697,_0x548210){_0x548210=_0x548210||0xcc;return function(_0x152eb6){if(_0x152eb6){return _0x8cd697[_0x9b14('0x15')](_0x548210);}return _0x8cd697[_0x9b14('0x16')](_0x548210)[_0x9b14('0x17')]();};}function respondWithResult(_0x3d29b7,_0x4e4cbe){_0x4e4cbe=_0x4e4cbe||0xc8;return function(_0x19b10c){if(_0x19b10c){return _0x3d29b7[_0x9b14('0x16')](_0x4e4cbe)['json'](_0x19b10c);}};}function respondWithFilteredResult(_0x5c13c8,_0x20415a){return function(_0x45cede){if(_0x45cede){var _0x3f976c=typeof _0x20415a[_0x9b14('0x18')]===_0x9b14('0x19')&&typeof _0x20415a[_0x9b14('0x1a')]===_0x9b14('0x19');var _0xb5c4a5=_0x45cede[_0x9b14('0x1b')];var _0x157c59=_0x3f976c?0x0:_0x20415a[_0x9b14('0x18')];var _0x4a833e=_0x3f976c?_0x45cede[_0x9b14('0x1b')]:_0x20415a[_0x9b14('0x18')]+_0x20415a['limit'];var _0x3eebca;if(_0x4a833e>=_0xb5c4a5){_0x4a833e=_0xb5c4a5;_0x3eebca=0xc8;}else{_0x3eebca=0xce;}_0x5c13c8[_0x9b14('0x16')](_0x3eebca);return _0x5c13c8[_0x9b14('0x1c')](_0x9b14('0x1d'),_0x157c59+'-'+_0x4a833e+'/'+_0xb5c4a5)[_0x9b14('0x1e')](_0x45cede);}return null;};}function patchUpdates(_0x34c852){return function(_0x44992b){try{jsonpatch[_0x9b14('0x1f')](_0x44992b,_0x34c852,!![]);}catch(_0x4f81ac){return BPromise[_0x9b14('0x20')](_0x4f81ac);}return _0x44992b[_0x9b14('0x21')]();};}function saveUpdates(_0x4a2d3a,_0x22a8cf){return function(_0x2a44d4){if(_0x2a44d4){return _0x2a44d4[_0x9b14('0x22')](_0x4a2d3a)[_0x9b14('0x23')](function(_0x48aa05){return _0x48aa05;});}return null;};}function removeEntity(_0x84f939,_0x4ec193){return function(_0x1dd1bb){if(_0x1dd1bb){return _0x1dd1bb[_0x9b14('0x24')]()[_0x9b14('0x23')](function(){_0x84f939[_0x9b14('0x16')](0xcc)[_0x9b14('0x17')]();});}};}function handleEntityNotFound(_0xb08217,_0x5361a1){return function(_0xca1b4){if(!_0xca1b4){_0xb08217['sendStatus'](0x194);}return _0xca1b4;};}function handleError(_0x53fdcf,_0x2a20e3){_0x2a20e3=_0x2a20e3||0x1f4;return function(_0x5c2136){logger[_0x9b14('0x25')](_0x5c2136[_0x9b14('0x26')]);if(_0x5c2136['name']){delete _0x5c2136['name'];}_0x53fdcf[_0x9b14('0x16')](_0x2a20e3)[_0x9b14('0x27')](_0x5c2136);};}exports[_0x9b14('0x28')]=function(_0xfcd1c3,_0x58a549){var _0xd8301b={},_0xc97188={},_0x5c5af1={'count':0x0,'rows':[]};var _0x2124b2=_[_0x9b14('0x29')](db[_0x9b14('0x2a')][_0x9b14('0x2b')],function(_0x53e06b){return{'name':_0x53e06b['fieldName'],'type':_0x53e06b[_0x9b14('0x2c')][_0x9b14('0x2d')]};});_0xc97188['model']=_[_0x9b14('0x29')](_0x2124b2,_0x9b14('0x2e'));_0xc97188['query']=_[_0x9b14('0x2f')](_0xfcd1c3[_0x9b14('0x30')]);_0xc97188[_0x9b14('0x31')]=_['intersection'](_0xc97188[_0x9b14('0x32')],_0xc97188[_0x9b14('0x30')]);_0xd8301b[_0x9b14('0x33')]=_[_0x9b14('0x34')](_0xc97188[_0x9b14('0x32')],qs[_0x9b14('0x35')](_0xfcd1c3['query'][_0x9b14('0x35')]));_0xd8301b['attributes']=_0xd8301b[_0x9b14('0x33')]['length']?_0xd8301b[_0x9b14('0x33')]:_0xc97188[_0x9b14('0x32')];if(!_0xfcd1c3[_0x9b14('0x30')]['hasOwnProperty']('nolimit')){_0xd8301b[_0x9b14('0x1a')]=qs['limit'](_0xfcd1c3[_0x9b14('0x30')][_0x9b14('0x1a')]);_0xd8301b['offset']=qs['offset'](_0xfcd1c3[_0x9b14('0x30')][_0x9b14('0x18')]);}_0xd8301b[_0x9b14('0x36')]=qs[_0x9b14('0x37')](_0xfcd1c3[_0x9b14('0x30')][_0x9b14('0x37')]);_0xd8301b[_0x9b14('0x38')]=qs[_0x9b14('0x31')](_[_0x9b14('0x39')](_0xfcd1c3['query'],_0xc97188[_0x9b14('0x31')]),_0x2124b2);if(_0xfcd1c3[_0x9b14('0x30')][_0x9b14('0x3a')]){_0xd8301b['where']=_[_0x9b14('0x3b')](_0xd8301b[_0x9b14('0x38')],{'$or':_['map'](_0x2124b2,function(_0x394a67){if(_0x394a67[_0x9b14('0x2c')]!==_0x9b14('0x3c')){var _0x5a15f7={};_0x5a15f7[_0x394a67['name']]={'$like':'%'+_0xfcd1c3[_0x9b14('0x30')][_0x9b14('0x3a')]+'%'};return _0x5a15f7;}})});}_0xd8301b=_[_0x9b14('0x3b')]({},_0xd8301b,_0xfcd1c3[_0x9b14('0x3d')]);var _0x1fd215={'where':_0xd8301b[_0x9b14('0x38')]};return db['MailTransferReport'][_0x9b14('0x1b')](_0x1fd215)[_0x9b14('0x23')](function(_0x45e6bd){_0x5c5af1['count']=_0x45e6bd;if(_0xfcd1c3[_0x9b14('0x30')][_0x9b14('0x3e')]){_0xd8301b['include']=[{'all':!![]}];}return db[_0x9b14('0x2a')]['findAll'](_0xd8301b);})[_0x9b14('0x23')](function(_0x11e6d0){_0x5c5af1[_0x9b14('0x3f')]=_0x11e6d0;return _0x5c5af1;})[_0x9b14('0x23')](respondWithFilteredResult(_0x58a549,_0xd8301b))[_0x9b14('0x40')](handleError(_0x58a549,null));};exports[_0x9b14('0x41')]=function(_0x282bd6,_0x6a9410){var _0x6255ee={'raw':!![],'where':{'id':_0x282bd6[_0x9b14('0x42')]['id']}},_0x38c941={};_0x38c941[_0x9b14('0x32')]=_[_0x9b14('0x2f')](db[_0x9b14('0x2a')][_0x9b14('0x2b')]);_0x38c941[_0x9b14('0x30')]=_[_0x9b14('0x2f')](_0x282bd6['query']);_0x38c941[_0x9b14('0x31')]=_[_0x9b14('0x34')](_0x38c941['model'],_0x38c941[_0x9b14('0x30')]);_0x6255ee['attributes']=_['intersection'](_0x38c941[_0x9b14('0x32')],qs[_0x9b14('0x35')](_0x282bd6[_0x9b14('0x30')][_0x9b14('0x35')]));_0x6255ee[_0x9b14('0x33')]=_0x6255ee[_0x9b14('0x33')][_0x9b14('0x43')]?_0x6255ee[_0x9b14('0x33')]:_0x38c941[_0x9b14('0x32')];if(_0x282bd6['query'][_0x9b14('0x3e')]){_0x6255ee[_0x9b14('0x44')]=[{'all':!![]}];}_0x6255ee=_['merge']({},_0x6255ee,_0x282bd6['options']);return db[_0x9b14('0x2a')][_0x9b14('0x45')](_0x6255ee)[_0x9b14('0x23')](handleEntityNotFound(_0x6a9410,null))['then'](respondWithResult(_0x6a9410,null))['catch'](handleError(_0x6a9410,null));};exports[_0x9b14('0x46')]=function(_0x2b2af9,_0x330ec7){return db['MailTransferReport'][_0x9b14('0x46')](_0x2b2af9[_0x9b14('0x47')],{})['then'](respondWithResult(_0x330ec7,0xc9))[_0x9b14('0x40')](handleError(_0x330ec7,null));};exports['update']=function(_0x3b5cca,_0xbe9348){if(_0x3b5cca[_0x9b14('0x47')]['id']){delete _0x3b5cca[_0x9b14('0x47')]['id'];}return db['MailTransferReport']['find']({'where':{'id':_0x3b5cca['params']['id']}})[_0x9b14('0x23')](handleEntityNotFound(_0xbe9348,null))[_0x9b14('0x23')](saveUpdates(_0x3b5cca[_0x9b14('0x47')],null))[_0x9b14('0x23')](respondWithResult(_0xbe9348,null))[_0x9b14('0x40')](handleError(_0xbe9348,null));};exports[_0x9b14('0x24')]=function(_0x2c0d90,_0x561254){return db[_0x9b14('0x2a')][_0x9b14('0x45')]({'where':{'id':_0x2c0d90[_0x9b14('0x42')]['id']}})[_0x9b14('0x23')](handleEntityNotFound(_0x561254,null))[_0x9b14('0x23')](removeEntity(_0x561254,null))[_0x9b14('0x40')](handleError(_0x561254,null));};exports[_0x9b14('0x48')]=function(_0x36a874,_0x5c643d){return db[_0x9b14('0x2a')]['describe']()[_0x9b14('0x23')](respondWithResult(_0x5c643d,null))[_0x9b14('0x40')](handleError(_0x5c643d,null));}; \ No newline at end of file +var _0x35e9=['../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','MailTransferReport','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','find','catch','create','body','params','describe','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/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x1bc5fb,_0x3d1f55){var _0x4ebf13=function(_0x22c7e7){while(--_0x22c7e7){_0x1bc5fb['push'](_0x1bc5fb['shift']());}};_0x4ebf13(++_0x3d1f55);}(_0x35e9,0xce));var _0x935e=function(_0x60e812,_0x49c93b){_0x60e812=_0x60e812-0x0;var _0x359dbc=_0x35e9[_0x60e812];return _0x359dbc;};'use strict';var emlformat=require(_0x935e('0x0'));var rimraf=require(_0x935e('0x1'));var zipdir=require(_0x935e('0x2'));var jsonpatch=require(_0x935e('0x3'));var rp=require(_0x935e('0x4'));var moment=require(_0x935e('0x5'));var BPromise=require(_0x935e('0x6'));var Mustache=require(_0x935e('0x7'));var util=require(_0x935e('0x8'));var path=require(_0x935e('0x9'));var sox=require(_0x935e('0xa'));var csv=require('to-csv');var ejs=require(_0x935e('0xb'));var fs=require('fs');var fs_extra=require(_0x935e('0xc'));var _=require(_0x935e('0xd'));var squel=require(_0x935e('0xe'));var crypto=require(_0x935e('0xf'));var jsforce=require(_0x935e('0x10'));var deskjs=require(_0x935e('0x11'));var toCsv=require(_0x935e('0x12'));var querystring=require('querystring');var Papa=require(_0x935e('0x13'));var Redis=require(_0x935e('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x935e('0x15'));var as=require(_0x935e('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x935e('0x17'))(_0x935e('0x18'));var utils=require('../../config/utils');var config=require(_0x935e('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5da4c2,_0x362f79){_0x362f79=_0x362f79||0xcc;return function(_0xb5e83d){if(_0xb5e83d){return _0x5da4c2[_0x935e('0x1a')](_0x362f79);}return _0x5da4c2[_0x935e('0x1b')](_0x362f79)[_0x935e('0x1c')]();};}function respondWithResult(_0x5bf786,_0x7eb551){_0x7eb551=_0x7eb551||0xc8;return function(_0xdb4eed){if(_0xdb4eed){return _0x5bf786[_0x935e('0x1b')](_0x7eb551)[_0x935e('0x1d')](_0xdb4eed);}};}function respondWithFilteredResult(_0x5369bb,_0x2fa2c2){return function(_0x24559a){if(_0x24559a){var _0x20f7af=typeof _0x2fa2c2['offset']===_0x935e('0x1e')&&typeof _0x2fa2c2[_0x935e('0x1f')]===_0x935e('0x1e');var _0x3fbab0=_0x24559a[_0x935e('0x20')];var _0x309782=_0x20f7af?0x0:_0x2fa2c2[_0x935e('0x21')];var _0x1c29c5=_0x20f7af?_0x24559a[_0x935e('0x20')]:_0x2fa2c2[_0x935e('0x21')]+_0x2fa2c2[_0x935e('0x1f')];var _0x4836ea;if(_0x1c29c5>=_0x3fbab0){_0x1c29c5=_0x3fbab0;_0x4836ea=0xc8;}else{_0x4836ea=0xce;}_0x5369bb[_0x935e('0x1b')](_0x4836ea);return _0x5369bb[_0x935e('0x22')](_0x935e('0x23'),_0x309782+'-'+_0x1c29c5+'/'+_0x3fbab0)[_0x935e('0x1d')](_0x24559a);}return null;};}function patchUpdates(_0x8621c1){return function(_0x49e017){try{jsonpatch[_0x935e('0x24')](_0x49e017,_0x8621c1,!![]);}catch(_0x164f00){return BPromise[_0x935e('0x25')](_0x164f00);}return _0x49e017['save']();};}function saveUpdates(_0x21166e,_0x238e5d){return function(_0x7adb32){if(_0x7adb32){return _0x7adb32[_0x935e('0x26')](_0x21166e)[_0x935e('0x27')](function(_0x3ff91f){return _0x3ff91f;});}return null;};}function removeEntity(_0x141d89,_0x1bf555){return function(_0xe79820){if(_0xe79820){return _0xe79820[_0x935e('0x28')]()[_0x935e('0x27')](function(){_0x141d89[_0x935e('0x1b')](0xcc)[_0x935e('0x1c')]();});}};}function handleEntityNotFound(_0x1d5e39,_0x5e422e){return function(_0x71447d){if(!_0x71447d){_0x1d5e39[_0x935e('0x1a')](0x194);}return _0x71447d;};}function handleError(_0x5b99b2,_0x56dbde){_0x56dbde=_0x56dbde||0x1f4;return function(_0x312319){logger[_0x935e('0x29')](_0x312319[_0x935e('0x2a')]);if(_0x312319['name']){delete _0x312319[_0x935e('0x2b')];}_0x5b99b2[_0x935e('0x1b')](_0x56dbde)[_0x935e('0x2c')](_0x312319);};}exports[_0x935e('0x2d')]=function(_0x4ff43b,_0xb525cf){var _0x25f7b4={},_0x2a8764={},_0x30f64d={'count':0x0,'rows':[]};var _0x4226f4=_[_0x935e('0x2e')](db[_0x935e('0x2f')]['rawAttributes'],function(_0x52c888){return{'name':_0x52c888[_0x935e('0x30')],'type':_0x52c888['type'][_0x935e('0x31')]};});_0x2a8764['model']=_[_0x935e('0x2e')](_0x4226f4,_0x935e('0x2b'));_0x2a8764[_0x935e('0x32')]=_[_0x935e('0x33')](_0x4ff43b[_0x935e('0x32')]);_0x2a8764[_0x935e('0x34')]=_[_0x935e('0x35')](_0x2a8764[_0x935e('0x36')],_0x2a8764['query']);_0x25f7b4[_0x935e('0x37')]=_[_0x935e('0x35')](_0x2a8764[_0x935e('0x36')],qs[_0x935e('0x38')](_0x4ff43b[_0x935e('0x32')]['fields']));_0x25f7b4[_0x935e('0x37')]=_0x25f7b4[_0x935e('0x37')][_0x935e('0x39')]?_0x25f7b4['attributes']:_0x2a8764['model'];if(!_0x4ff43b[_0x935e('0x32')][_0x935e('0x3a')](_0x935e('0x3b'))){_0x25f7b4[_0x935e('0x1f')]=qs['limit'](_0x4ff43b[_0x935e('0x32')][_0x935e('0x1f')]);_0x25f7b4[_0x935e('0x21')]=qs[_0x935e('0x21')](_0x4ff43b[_0x935e('0x32')][_0x935e('0x21')]);}_0x25f7b4[_0x935e('0x3c')]=qs['sort'](_0x4ff43b[_0x935e('0x32')][_0x935e('0x3d')]);_0x25f7b4[_0x935e('0x3e')]=qs[_0x935e('0x34')](_[_0x935e('0x3f')](_0x4ff43b[_0x935e('0x32')],_0x2a8764['filters']),_0x4226f4);if(_0x4ff43b[_0x935e('0x32')][_0x935e('0x40')]){_0x25f7b4[_0x935e('0x3e')]=_[_0x935e('0x41')](_0x25f7b4[_0x935e('0x3e')],{'$or':_[_0x935e('0x2e')](_0x4226f4,function(_0x560447){if(_0x560447[_0x935e('0x42')]!=='VIRTUAL'){var _0x5cff22={};_0x5cff22[_0x560447[_0x935e('0x2b')]]={'$like':'%'+_0x4ff43b['query']['filter']+'%'};return _0x5cff22;}})});}_0x25f7b4=_[_0x935e('0x41')]({},_0x25f7b4,_0x4ff43b[_0x935e('0x43')]);var _0x581b2c={'where':_0x25f7b4[_0x935e('0x3e')]};return db['MailTransferReport'][_0x935e('0x20')](_0x581b2c)[_0x935e('0x27')](function(_0x42e06d){_0x30f64d[_0x935e('0x20')]=_0x42e06d;if(_0x4ff43b[_0x935e('0x32')][_0x935e('0x44')]){_0x25f7b4['include']=[{'all':!![]}];}return db[_0x935e('0x2f')][_0x935e('0x45')](_0x25f7b4);})[_0x935e('0x27')](function(_0x3b5c6b){_0x30f64d[_0x935e('0x46')]=_0x3b5c6b;return _0x30f64d;})[_0x935e('0x27')](respondWithFilteredResult(_0xb525cf,_0x25f7b4))['catch'](handleError(_0xb525cf,null));};exports['show']=function(_0x19eff6,_0x38a6a2){var _0x1c2084={'raw':!![],'where':{'id':_0x19eff6['params']['id']}},_0x2587c8={};_0x2587c8['model']=_[_0x935e('0x33')](db[_0x935e('0x2f')]['rawAttributes']);_0x2587c8[_0x935e('0x32')]=_[_0x935e('0x33')](_0x19eff6['query']);_0x2587c8['filters']=_['intersection'](_0x2587c8['model'],_0x2587c8['query']);_0x1c2084[_0x935e('0x37')]=_['intersection'](_0x2587c8[_0x935e('0x36')],qs[_0x935e('0x38')](_0x19eff6[_0x935e('0x32')][_0x935e('0x38')]));_0x1c2084[_0x935e('0x37')]=_0x1c2084[_0x935e('0x37')][_0x935e('0x39')]?_0x1c2084[_0x935e('0x37')]:_0x2587c8[_0x935e('0x36')];if(_0x19eff6['query']['includeAll']){_0x1c2084['include']=[{'all':!![]}];}_0x1c2084=_[_0x935e('0x41')]({},_0x1c2084,_0x19eff6[_0x935e('0x43')]);return db[_0x935e('0x2f')][_0x935e('0x47')](_0x1c2084)['then'](handleEntityNotFound(_0x38a6a2,null))['then'](respondWithResult(_0x38a6a2,null))[_0x935e('0x48')](handleError(_0x38a6a2,null));};exports[_0x935e('0x49')]=function(_0xf04c06,_0x39001a){return db[_0x935e('0x2f')][_0x935e('0x49')](_0xf04c06['body'],{})[_0x935e('0x27')](respondWithResult(_0x39001a,0xc9))[_0x935e('0x48')](handleError(_0x39001a,null));};exports[_0x935e('0x26')]=function(_0x2839cf,_0x5b74c1){if(_0x2839cf['body']['id']){delete _0x2839cf[_0x935e('0x4a')]['id'];}return db[_0x935e('0x2f')][_0x935e('0x47')]({'where':{'id':_0x2839cf[_0x935e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5b74c1,null))['then'](saveUpdates(_0x2839cf['body'],null))[_0x935e('0x27')](respondWithResult(_0x5b74c1,null))[_0x935e('0x48')](handleError(_0x5b74c1,null));};exports[_0x935e('0x28')]=function(_0x57e3ff,_0x2e2460){return db[_0x935e('0x2f')][_0x935e('0x47')]({'where':{'id':_0x57e3ff['params']['id']}})[_0x935e('0x27')](handleEntityNotFound(_0x2e2460,null))[_0x935e('0x27')](removeEntity(_0x2e2460,null))[_0x935e('0x48')](handleError(_0x2e2460,null));};exports[_0x935e('0x4c')]=function(_0x26a416,_0x2eb1cb){return db[_0x935e('0x2f')]['describe']()[_0x935e('0x27')](respondWithResult(_0x2eb1cb,null))[_0x935e('0x48')](handleError(_0x2eb1cb,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 06ad0b6..52cc54e 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 _0xd8b1=['api','moment','request-promise','path','../../config/environment','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xd8b1,0x105));var _0x1d8b=function(_0x4a6d67,_0x4ce7db){_0x4a6d67=_0x4a6d67-0x0;var _0x3152e3=_0xd8b1[_0x4a6d67];return _0x3152e3;};'use strict';var _=require(_0x1d8b('0x0'));var util=require(_0x1d8b('0x1'));var logger=require(_0x1d8b('0x2'))(_0x1d8b('0x3'));var moment=require(_0x1d8b('0x4'));var BPromise=require('bluebird');var rp=require(_0x1d8b('0x5'));var fs=require('fs');var path=require(_0x1d8b('0x6'));var rimraf=require('rimraf');var config=require(_0x1d8b('0x7'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x4d5ba0,_0x27534c){return _0x4d5ba0['define'](_0x1d8b('0x8'),attributes,{'tableName':_0x1d8b('0x9'),'paranoid':![],'indexes':[{'name':_0x1d8b('0xa'),'fields':[_0x1d8b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb815=['define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x44c9e7,_0x96cc71){var _0x515602=function(_0xdb85a6){while(--_0xdb85a6){_0x44c9e7['push'](_0x44c9e7['shift']());}};_0x515602(++_0x96cc71);}(_0xb815,0x160));var _0x5b81=function(_0x1ce67b,_0x5d1e9f){_0x1ce67b=_0x1ce67b-0x0;var _0xc64cb0=_0xb815[_0x1ce67b];return _0xc64cb0;};'use strict';var _=require(_0x5b81('0x0'));var util=require(_0x5b81('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5b81('0x2'));var BPromise=require('bluebird');var rp=require(_0x5b81('0x3'));var fs=require('fs');var path=require(_0x5b81('0x4'));var rimraf=require(_0x5b81('0x5'));var config=require(_0x5b81('0x6'));var attributes=require('./mailTransferReport.attributes');module[_0x5b81('0x7')]=function(_0x971823,_0xfb1bec){return _0x971823[_0x5b81('0x8')](_0x5b81('0x9'),attributes,{'tableName':_0x5b81('0xa'),'paranoid':![],'indexes':[{'name':_0x5b81('0xb'),'fields':[_0x5b81('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 8927d2c..2ea558b 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 _0xa6d1=['request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x375f15,_0x8ed8ba){var _0x124a1c=function(_0x51757b){while(--_0x51757b){_0x375f15['push'](_0x375f15['shift']());}};_0x124a1c(++_0x8ed8ba);}(_0xa6d1,0x17c));var _0x1a6d=function(_0x22e16d,_0x1838a7){_0x22e16d=_0x22e16d-0x0;var _0x5e513c=_0xa6d1[_0x22e16d];return _0x5e513c;};'use strict';var _=require(_0x1a6d('0x0'));var util=require(_0x1a6d('0x1'));var moment=require(_0x1a6d('0x2'));var BPromise=require(_0x1a6d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a6d('0x4'));var db=require(_0x1a6d('0x5'))['db'];var utils=require(_0x1a6d('0x6'));var logger=require(_0x1a6d('0x7'))(_0x1a6d('0x8'));var config=require('../../config/environment');var jayson=require(_0x1a6d('0x9'));var client=jayson[_0x1a6d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x397736,_0x5dc566,_0x58c5bc){return new BPromise(function(_0x1f0b0a,_0x279762){return client[_0x1a6d('0xb')](_0x397736,_0x58c5bc)[_0x1a6d('0xc')](function(_0x49266b){logger[_0x1a6d('0xd')](_0x1a6d('0xe'),_0x5dc566,_0x1a6d('0xf'));logger[_0x1a6d('0x10')](_0x1a6d('0x11'),_0x5dc566,_0x1a6d('0xf'),JSON[_0x1a6d('0x12')](_0x49266b));if(_0x49266b[_0x1a6d('0x13')]){if(_0x49266b[_0x1a6d('0x13')][_0x1a6d('0x14')]===0x1f4){logger['error'](_0x1a6d('0xe'),_0x5dc566,_0x49266b[_0x1a6d('0x13')][_0x1a6d('0x15')]);return _0x279762(_0x49266b[_0x1a6d('0x13')][_0x1a6d('0x15')]);}logger[_0x1a6d('0x13')](_0x1a6d('0xe'),_0x5dc566,_0x49266b[_0x1a6d('0x13')]['message']);return _0x1f0b0a(_0x49266b[_0x1a6d('0x13')][_0x1a6d('0x15')]);}else{logger[_0x1a6d('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x5dc566,_0x1a6d('0xf'));_0x1f0b0a(_0x49266b['result'][_0x1a6d('0x15')]);}})[_0x1a6d('0x16')](function(_0x2bffed){logger[_0x1a6d('0x13')](_0x1a6d('0xe'),_0x5dc566,_0x2bffed);_0x279762(_0x2bffed);});});} \ No newline at end of file +var _0x148c=['http','request','then','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1e621b,_0x33ffa2){var _0x4f4bac=function(_0x1db7fe){while(--_0x1db7fe){_0x1e621b['push'](_0x1e621b['shift']());}};_0x4f4bac(++_0x33ffa2);}(_0x148c,0xd3));var _0xc148=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x148c[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0xc148('0x0'));var util=require(_0xc148('0x1'));var moment=require(_0xc148('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc148('0x3'))['db'];var utils=require(_0xc148('0x4'));var logger=require(_0xc148('0x5'))(_0xc148('0x6'));var config=require(_0xc148('0x7'));var jayson=require(_0xc148('0x8'));var client=jayson['client'][_0xc148('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45108d,_0x4d4680,_0x30498d){return new BPromise(function(_0x5879fc,_0x4c48d6){return client[_0xc148('0xa')](_0x45108d,_0x30498d)[_0xc148('0xb')](function(_0x152e52){logger['info'](_0xc148('0xc'),_0x4d4680,'request\x20sent');logger[_0xc148('0xd')](_0xc148('0xe'),_0x4d4680,'request\x20sent',JSON['stringify'](_0x152e52));if(_0x152e52[_0xc148('0xf')]){if(_0x152e52[_0xc148('0xf')]['code']===0x1f4){logger[_0xc148('0xf')](_0xc148('0xc'),_0x4d4680,_0x152e52[_0xc148('0xf')][_0xc148('0x10')]);return _0x4c48d6(_0x152e52['error'][_0xc148('0x10')]);}logger[_0xc148('0xf')](_0xc148('0xc'),_0x4d4680,_0x152e52['error'][_0xc148('0x10')]);return _0x5879fc(_0x152e52['error'][_0xc148('0x10')]);}else{logger['info'](_0xc148('0xc'),_0x4d4680,_0xc148('0x11'));_0x5879fc(_0x152e52[_0xc148('0x12')][_0xc148('0x10')]);}})[_0xc148('0x13')](function(_0x51b2da){logger[_0xc148('0xf')](_0xc148('0xc'),_0x4d4680,_0x51b2da);_0x4c48d6(_0x51b2da);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 0e48ca7..17932f8 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 _0x1384=['multer','util','express','../../components/interaction/service','./memberReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x131f2f,_0x5158e1){var _0x8b2a79=function(_0x325316){while(--_0x325316){_0x131f2f['push'](_0x131f2f['shift']());}};_0x8b2a79(++_0x5158e1);}(_0x1384,0x1b0));var _0x4138=function(_0xcde562,_0x1b1cd4){_0xcde562=_0xcde562-0x0;var _0x57aca5=_0x1384[_0xcde562];return _0x57aca5;};'use strict';var multer=require(_0x4138('0x0'));var util=require(_0x4138('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4138('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4138('0x3'));var config=require('../../config/environment');var controller=require(_0x4138('0x4'));router['get']('/',auth[_0x4138('0x5')](),controller[_0x4138('0x6')]);router[_0x4138('0x7')]('/describe',auth[_0x4138('0x5')](),controller[_0x4138('0x8')]);router[_0x4138('0x7')](_0x4138('0x9'),auth['isAuthenticated'](),controller[_0x4138('0xa')]);router[_0x4138('0xb')]('/',auth[_0x4138('0x5')](),controller[_0x4138('0xc')]);router[_0x4138('0xd')](_0x4138('0x9'),auth[_0x4138('0x5')](),controller[_0x4138('0xe')]);router[_0x4138('0xf')](_0x4138('0x9'),auth[_0x4138('0x5')](),controller[_0x4138('0x10')]);module[_0x4138('0x11')]=router; \ No newline at end of file +var _0xcfec=['delete','exports','multer','util','path','connect-timeout','express','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update'];(function(_0x563af1,_0x37924c){var _0x58fccb=function(_0x509595){while(--_0x509595){_0x563af1['push'](_0x563af1['shift']());}};_0x58fccb(++_0x37924c);}(_0xcfec,0xec));var _0xccfe=function(_0xf4a6b1,_0x482ea6){_0xf4a6b1=_0xf4a6b1-0x0;var _0x24a9f9=_0xcfec[_0xf4a6b1];return _0x24a9f9;};'use strict';var multer=require(_0xccfe('0x0'));var util=require(_0xccfe('0x1'));var path=require(_0xccfe('0x2'));var timeout=require(_0xccfe('0x3'));var express=require(_0xccfe('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xccfe('0x5'));var controller=require('./memberReport.controller');router[_0xccfe('0x6')]('/',auth[_0xccfe('0x7')](),controller[_0xccfe('0x8')]);router['get'](_0xccfe('0x9'),auth[_0xccfe('0x7')](),controller[_0xccfe('0xa')]);router[_0xccfe('0x6')](_0xccfe('0xb'),auth['isAuthenticated'](),controller[_0xccfe('0xc')]);router['post']('/',auth[_0xccfe('0x7')](),controller[_0xccfe('0xd')]);router[_0xccfe('0xe')](_0xccfe('0xb'),auth['isAuthenticated'](),controller[_0xccfe('0xf')]);router[_0xccfe('0x10')](_0xccfe('0xb'),auth[_0xccfe('0x7')](),controller['destroy']);module[_0xccfe('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 653eff7..30b430e 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 _0x7eb9=['exitAt','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','seconds','setDataValue'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x7eb9,0xd9));var _0x97eb=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x7eb9[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x97eb('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize[_0x97eb('0x1')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x97eb('0x1')]},'type':{'type':Sequelize[_0x97eb('0x1')],'defaultValue':_0x97eb('0x2'),'comment':_0x97eb('0x3')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x97eb('0x4')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x5f78f4){var _0x5327d4=moment(_0x5f78f4);var _0x44595e=moment(this['getDataValue']('enterAt'));var _0x429ed6=_0x5327d4['diff'](_0x44595e,_0x97eb('0x5'));this[_0x97eb('0x6')](_0x97eb('0x7'),_0x5f78f4);this[_0x97eb('0x6')](_0x97eb('0x8'),_0x429ed6||null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x97eb('0x1')],'comment':_0x97eb('0x9')},'data3':{'type':Sequelize[_0x97eb('0x1')],'comment':_0x97eb('0xa')},'data4':{'type':Sequelize[_0x97eb('0x1')],'comment':_0x97eb('0xb')},'data5':{'type':Sequelize[_0x97eb('0x1')],'comment':_0x97eb('0xc')},'role':{'type':Sequelize[_0x97eb('0x1')]},'internal':{'type':Sequelize[_0x97eb('0xd')]},'uniqueid':{'type':Sequelize[_0x97eb('0x1')]}}; \ No newline at end of file +var _0xd3d1=['LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','sequelize','moment','STRING','DEFAULT\x20PAUSE'];(function(_0x42eea6,_0x125eec){var _0xcf414b=function(_0x39e6cb){while(--_0x39e6cb){_0x42eea6['push'](_0x42eea6['shift']());}};_0xcf414b(++_0x125eec);}(_0xd3d1,0x172));var _0x1d3d=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xd3d1[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0x1d3d('0x0'));var moment=require(_0x1d3d('0x1'));module['exports']={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x1d3d('0x2')]},'interface':{'type':Sequelize[_0x1d3d('0x2')]},'type':{'type':Sequelize[_0x1d3d('0x2')],'defaultValue':_0x1d3d('0x3'),'comment':_0x1d3d('0x4')},'duration':{'type':Sequelize[_0x1d3d('0x5')]},'enterAt':{'type':Sequelize[_0x1d3d('0x6')]},'exitAt':{'type':Sequelize[_0x1d3d('0x6')],'set':function(_0x1cbe06){var _0x449475=moment(_0x1cbe06);var _0x3831ce=moment(this[_0x1d3d('0x7')](_0x1d3d('0x8')));var _0x2c377c=_0x449475[_0x1d3d('0x9')](_0x3831ce,_0x1d3d('0xa'));this[_0x1d3d('0xb')]('exitAt',_0x1cbe06);this[_0x1d3d('0xb')](_0x1d3d('0xc'),_0x2c377c||null);}},'data1':{'type':Sequelize[_0x1d3d('0x2')],'comment':_0x1d3d('0xd')},'data2':{'type':Sequelize[_0x1d3d('0x2')],'comment':_0x1d3d('0xe')},'data3':{'type':Sequelize[_0x1d3d('0x2')],'comment':_0x1d3d('0xf')},'data4':{'type':Sequelize[_0x1d3d('0x2')],'comment':_0x1d3d('0x10')},'data5':{'type':Sequelize[_0x1d3d('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x1d3d('0x2')]},'internal':{'type':Sequelize[_0x1d3d('0x5')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 570cc60..d62507a 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 _0x008c=['destroy','sendStatus','send','index','MemberReport','rawAttributes','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then'];(function(_0x287b6a,_0x3b181d){var _0x4c070e=function(_0x5700ba){while(--_0x5700ba){_0x287b6a['push'](_0x287b6a['shift']());}};_0x4c070e(++_0x3b181d);}(_0x008c,0x188));var _0xc008=function(_0x4645bd,_0x1ad4c){_0x4645bd=_0x4645bd-0x0;var _0x59ebbb=_0x008c[_0x4645bd];return _0x59ebbb;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_0x2a7d4f,_0xc008('0x2b'));_0x32390d[_0xc008('0x2c')]=_[_0xc008('0x2d')](_0x25eae4[_0xc008('0x2c')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x32390d[_0xc008('0x29')],_0x32390d[_0xc008('0x2c')]);_0x24c14c[_0xc008('0x30')]=_['intersection'](_0x32390d[_0xc008('0x29')],qs[_0xc008('0x31')](_0x25eae4['query'][_0xc008('0x31')]));_0x24c14c[_0xc008('0x30')]=_0x24c14c[_0xc008('0x30')][_0xc008('0x32')]?_0x24c14c[_0xc008('0x30')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2c')][_0xc008('0x33')](_0xc008('0x34'))){_0x24c14c['limit']=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1b')]);}_0x24c14c['order']=qs[_0xc008('0x35')](_0x25eae4[_0xc008('0x2c')]['sort']);_0x24c14c[_0xc008('0x36')]=qs[_0xc008('0x2e')](_['pick'](_0x25eae4[_0xc008('0x2c')],_0x32390d[_0xc008('0x2e')]),_0x2a7d4f);if(_0x25eae4[_0xc008('0x2c')]['filter']){_0x24c14c['where']=_['merge'](_0x24c14c[_0xc008('0x36')],{'$or':_['map'](_0x2a7d4f,function(_0x3dd0ac){if(_0x3dd0ac[_0xc008('0x37')]!==_0xc008('0x38')){var _0x440459={};_0x440459[_0x3dd0ac[_0xc008('0x2b')]]={'$like':'%'+_0x25eae4[_0xc008('0x2c')][_0xc008('0x39')]+'%'};return _0x440459;}})});}_0x24c14c=_[_0xc008('0x3a')]({},_0x24c14c,_0x25eae4[_0xc008('0x3b')]);var _0x387dfd={'where':_0x24c14c[_0xc008('0x36')]};return db[_0xc008('0x26')][_0xc008('0x1e')](_0x387dfd)[_0xc008('0x21')](function(_0x4cace5){_0x209591[_0xc008('0x1e')]=_0x4cace5;if(_0x25eae4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x24c14c[_0xc008('0x3d')]=[{'all':!![]}];}return db['MemberReport'][_0xc008('0x3e')](_0x24c14c);})[_0xc008('0x21')](function(_0xc8cb91){_0x209591[_0xc008('0x3f')]=_0xc8cb91;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))['catch'](handleError(_0x529961,null));};exports[_0xc008('0x40')]=function(_0x3323f4,_0x3794b0){var _0x3e9a99={'raw':!![],'where':{'id':_0x3323f4['params']['id']}},_0x7279e8={};_0x7279e8[_0xc008('0x29')]=_[_0xc008('0x2d')](db[_0xc008('0x26')][_0xc008('0x27')]);_0x7279e8['query']=_[_0xc008('0x2d')](_0x3323f4[_0xc008('0x2c')]);_0x7279e8[_0xc008('0x2e')]=_['intersection'](_0x7279e8[_0xc008('0x29')],_0x7279e8['query']);_0x3e9a99[_0xc008('0x30')]=_['intersection'](_0x7279e8[_0xc008('0x29')],qs[_0xc008('0x31')](_0x3323f4['query'][_0xc008('0x31')]));_0x3e9a99[_0xc008('0x30')]=_0x3e9a99[_0xc008('0x30')]['length']?_0x3e9a99[_0xc008('0x30')]:_0x7279e8[_0xc008('0x29')];if(_0x3323f4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x3e9a99[_0xc008('0x3d')]=[{'all':!![]}];}_0x3e9a99=_[_0xc008('0x3a')]({},_0x3e9a99,_0x3323f4['options']);return db['MemberReport']['find'](_0x3e9a99)[_0xc008('0x21')](handleEntityNotFound(_0x3794b0,null))[_0xc008('0x21')](respondWithResult(_0x3794b0,null))[_0xc008('0x41')](handleError(_0x3794b0,null));};exports[_0xc008('0x42')]=function(_0x25289f,_0x24f6a4){return db[_0xc008('0x26')][_0xc008('0x42')](_0x25289f['body'],{})['then'](respondWithResult(_0x24f6a4,0xc9))['catch'](handleError(_0x24f6a4,null));};exports[_0xc008('0x20')]=function(_0x2651cf,_0x158eae){if(_0x2651cf['body']['id']){delete _0x2651cf[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x44')]({'where':{'id':_0x2651cf[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x158eae,null))[_0xc008('0x21')](saveUpdates(_0x2651cf[_0xc008('0x43')],null))[_0xc008('0x21')](respondWithResult(_0x158eae,null))[_0xc008('0x41')](handleError(_0x158eae,null));};exports[_0xc008('0x22')]=function(_0x52c444,_0x4c63d4){return db[_0xc008('0x26')]['find']({'where':{'id':_0x52c444[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x4c63d4,null))[_0xc008('0x21')](removeEntity(_0x4c63d4,null))['catch'](handleError(_0x4c63d4,null));};exports[_0xc008('0x46')]=function(_0x32b435,_0xee64){return db[_0xc008('0x26')][_0xc008('0x46')]()['then'](respondWithResult(_0xee64,null))[_0xc008('0x41')](handleError(_0xee64,null));}; \ No newline at end of file +var _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x825ea9,_0x56c3ea){var _0x4282a8=function(_0x9dd4e2){while(--_0x9dd4e2){_0x825ea9['push'](_0x825ea9['shift']());}};_0x4282a8(++_0x56c3ea);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 77abce2..bf14d92 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 _0x9525=['report_member','membername','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','MemberReport'];(function(_0x4f6d08,_0x1b3dd0){var _0x53a9c6=function(_0x2e0e0f){while(--_0x2e0e0f){_0x4f6d08['push'](_0x4f6d08['shift']());}};_0x53a9c6(++_0x1b3dd0);}(_0x9525,0x12e));var _0x5952=function(_0x4518e2,_0xdfa81a){_0x4518e2=_0x4518e2-0x0;var _0x565409=_0x9525[_0x4518e2];return _0x565409;};'use strict';var _=require(_0x5952('0x0'));var util=require('util');var logger=require(_0x5952('0x1'))(_0x5952('0x2'));var moment=require(_0x5952('0x3'));var BPromise=require(_0x5952('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5952('0x5'));var config=require(_0x5952('0x6'));var attributes=require('./memberReport.attributes');module[_0x5952('0x7')]=function(_0x46aba5,_0x4c6368){return _0x46aba5[_0x5952('0x8')](_0x5952('0x9'),attributes,{'tableName':_0x5952('0xa'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x5952('0xb'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe685=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','report_member','membername_interface','membername','interface','util'];(function(_0x2433d1,_0x13c659){var _0x14f6cb=function(_0x1b94d4){while(--_0x1b94d4){_0x2433d1['push'](_0x2433d1['shift']());}};_0x14f6cb(++_0x13c659);}(_0xe685,0xe0));var _0x5e68=function(_0x290813,_0x4ffb2b){_0x290813=_0x290813-0x0;var _0x2b543e=_0xe685[_0x290813];return _0x2b543e;};'use strict';var _=require('lodash');var util=require(_0x5e68('0x0'));var logger=require(_0x5e68('0x1'))(_0x5e68('0x2'));var moment=require(_0x5e68('0x3'));var BPromise=require(_0x5e68('0x4'));var rp=require(_0x5e68('0x5'));var fs=require('fs');var path=require(_0x5e68('0x6'));var rimraf=require(_0x5e68('0x7'));var config=require(_0x5e68('0x8'));var attributes=require('./memberReport.attributes');module[_0x5e68('0x9')]=function(_0x13e7ac,_0x4267ac){return _0x13e7ac[_0x5e68('0xa')]('MemberReport',attributes,{'tableName':_0x5e68('0xb'),'paranoid':![],'indexes':[{'name':_0x5e68('0xc'),'fields':[_0x5e68('0xd'),_0x5e68('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index b02fe88..e5bf562 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 _0x6bfc=['body','raw','CreateMemberReport','catch','UpdateMemberReport','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','GetMemberReport','findAll','options','attributes','limit','map','include','model','MemberReport','create'];(function(_0x2714ec,_0x36daa4){var _0x2608e5=function(_0x408468){while(--_0x408468){_0x2714ec['push'](_0x2714ec['shift']());}};_0x2608e5(++_0x36daa4);}(_0x6bfc,0x159));var _0xc6bf=function(_0x2db910,_0x2e9bb0){_0x2db910=_0x2db910-0x0;var _0x56129a=_0x6bfc[_0x2db910];return _0x56129a;};'use strict';var _=require('lodash');var util=require(_0xc6bf('0x0'));var moment=require(_0xc6bf('0x1'));var BPromise=require(_0xc6bf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc6bf('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc6bf('0x4'));var logger=require('../../config/logger')(_0xc6bf('0x5'));var config=require(_0xc6bf('0x6'));var jayson=require(_0xc6bf('0x7'));var client=jayson['client'][_0xc6bf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c9049,_0x47039a,_0x28d218){return new BPromise(function(_0x250311,_0x3b2815){return client[_0xc6bf('0x9')](_0x2c9049,_0x28d218)[_0xc6bf('0xa')](function(_0x52dac0){logger[_0xc6bf('0xb')](_0xc6bf('0xc'),_0x47039a,_0xc6bf('0xd'));logger[_0xc6bf('0xe')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x47039a,'request\x20sent',JSON[_0xc6bf('0xf')](_0x52dac0));if(_0x52dac0[_0xc6bf('0x10')]){if(_0x52dac0['error']['code']===0x1f4){logger[_0xc6bf('0x10')](_0xc6bf('0xc'),_0x47039a,_0x52dac0['error'][_0xc6bf('0x11')]);return _0x3b2815(_0x52dac0[_0xc6bf('0x10')][_0xc6bf('0x11')]);}logger[_0xc6bf('0x10')](_0xc6bf('0xc'),_0x47039a,_0x52dac0['error']['message']);return _0x250311(_0x52dac0[_0xc6bf('0x10')][_0xc6bf('0x11')]);}else{logger[_0xc6bf('0xb')](_0xc6bf('0xc'),_0x47039a,_0xc6bf('0xd'));_0x250311(_0x52dac0[_0xc6bf('0x12')][_0xc6bf('0x11')]);}})['catch'](function(_0x23498a){logger['error']('MemberReport,\x20%s,\x20%s',_0x47039a,_0x23498a);_0x3b2815(_0x23498a);});});}exports[_0xc6bf('0x13')]=function(_0x23a9e9){var _0x5bdc69=this;return new Promise(function(_0x370150,_0x1079db){return db['MemberReport'][_0xc6bf('0x14')]({'raw':_0x23a9e9['options']?_0x23a9e9['options']['raw']===undefined?!![]:![]:!![],'where':_0x23a9e9[_0xc6bf('0x15')]?_0x23a9e9[_0xc6bf('0x15')]['where']||null:null,'attributes':_0x23a9e9['options']?_0x23a9e9[_0xc6bf('0x15')][_0xc6bf('0x16')]||null:null,'limit':_0x23a9e9['options']?_0x23a9e9[_0xc6bf('0x15')][_0xc6bf('0x17')]||null:null,'include':_0x23a9e9[_0xc6bf('0x15')]?_0x23a9e9[_0xc6bf('0x15')]['include']?_[_0xc6bf('0x18')](_0x23a9e9[_0xc6bf('0x15')][_0xc6bf('0x19')],function(_0x1a0a50){return{'model':db[_0x1a0a50[_0xc6bf('0x1a')]],'as':_0x1a0a50['as'],'attributes':_0x1a0a50[_0xc6bf('0x16')],'include':_0x1a0a50[_0xc6bf('0x19')]?_[_0xc6bf('0x18')](_0x1a0a50['include'],function(_0x312138){return{'model':db[_0x312138[_0xc6bf('0x1a')]],'as':_0x312138['as'],'attributes':_0x312138[_0xc6bf('0x16')],'include':_0x312138['include']?_[_0xc6bf('0x18')](_0x312138[_0xc6bf('0x19')],function(_0x412e61){return{'model':db[_0x412e61[_0xc6bf('0x1a')]],'as':_0x412e61['as'],'attributes':_0x412e61[_0xc6bf('0x16')]};}):[]};}):[]};}):[]:[]})[_0xc6bf('0xa')](function(_0x5abf52){logger['info'](_0xc6bf('0x13'),_0x23a9e9);logger['debug'](_0xc6bf('0x13'),_0x23a9e9,JSON['stringify'](_0x5abf52));_0x370150(_0x5abf52);})['catch'](function(_0x2806e6){logger[_0xc6bf('0x10')](_0xc6bf('0x13'),_0x2806e6[_0xc6bf('0x11')],_0x23a9e9);_0x1079db(_0x5bdc69['error'](0x1f4,_0x2806e6['message']));});});};exports['CreateMemberReport']=function(_0x4f0234){var _0x32407b=this;return new Promise(function(_0xf49ed7,_0x1d46bd){return db[_0xc6bf('0x1b')][_0xc6bf('0x1c')](_0x4f0234[_0xc6bf('0x1d')],{'raw':_0x4f0234[_0xc6bf('0x15')]?_0x4f0234[_0xc6bf('0x15')][_0xc6bf('0x1e')]===undefined?!![]:![]:!![]})[_0xc6bf('0xa')](function(_0x2ec79e){logger[_0xc6bf('0xb')](_0xc6bf('0x1f'),_0x4f0234);logger[_0xc6bf('0xe')](_0xc6bf('0x1f'),_0x4f0234,JSON['stringify'](_0x2ec79e));_0xf49ed7(_0x2ec79e);})[_0xc6bf('0x20')](function(_0x1245d7){logger[_0xc6bf('0x10')](_0xc6bf('0x1f'),_0x1245d7['message'],_0x4f0234);_0x1d46bd(_0x32407b['error'](0x1f4,_0x1245d7[_0xc6bf('0x11')]));});});};exports[_0xc6bf('0x21')]=function(_0x11de46){var _0x3e3d15=this;return new Promise(function(_0x2e8363,_0x5ec7ce){return db[_0xc6bf('0x1b')]['update'](_0x11de46['body'],{'raw':_0x11de46[_0xc6bf('0x15')]?_0x11de46[_0xc6bf('0x15')][_0xc6bf('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11de46[_0xc6bf('0x15')]?_0x11de46[_0xc6bf('0x15')]['where']||null:null,'attributes':_0x11de46[_0xc6bf('0x15')]?_0x11de46[_0xc6bf('0x15')]['attributes']||null:null,'limit':_0x11de46[_0xc6bf('0x15')]?_0x11de46[_0xc6bf('0x15')][_0xc6bf('0x17')]||null:null})['then'](function(_0x5d1dbd){logger['info'](_0xc6bf('0x21'),_0x11de46);logger[_0xc6bf('0xe')](_0xc6bf('0x21'),_0x11de46,JSON['stringify'](_0x5d1dbd));_0x2e8363(_0x5d1dbd);})[_0xc6bf('0x20')](function(_0x559eb3){logger['error'](_0xc6bf('0x21'),_0x559eb3[_0xc6bf('0x11')],_0x11de46);_0x5ec7ce(_0x3e3d15[_0xc6bf('0x10')](0x1f4,_0x559eb3['message']));});});}; \ No newline at end of file +var _0x66c7=['then','create','body','CreateMemberReport','UpdateMemberReport','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','MemberReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','where','limit','include','attributes','map','model'];(function(_0x52b8ff,_0x19880b){var _0xfda2f8=function(_0x35806a){while(--_0x35806a){_0x52b8ff['push'](_0x52b8ff['shift']());}};_0xfda2f8(++_0x19880b);}(_0x66c7,0x15c));var _0x766c=function(_0x10c16d,_0x2b3e14){_0x10c16d=_0x10c16d-0x0;var _0x5896f4=_0x66c7[_0x10c16d];return _0x5896f4;};'use strict';var _=require(_0x766c('0x0'));var util=require(_0x766c('0x1'));var moment=require(_0x766c('0x2'));var BPromise=require('bluebird');var rs=require(_0x766c('0x3'));var fs=require('fs');var Redis=require(_0x766c('0x4'));var db=require(_0x766c('0x5'))['db'];var utils=require(_0x766c('0x6'));var logger=require(_0x766c('0x7'))(_0x766c('0x8'));var config=require('../../config/environment');var jayson=require(_0x766c('0x9'));var client=jayson[_0x766c('0xa')][_0x766c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb0b5f7,_0x46d290,_0x3c4683){return new BPromise(function(_0x22a524,_0x4488b8){return client['request'](_0xb0b5f7,_0x3c4683)['then'](function(_0x141744){logger[_0x766c('0xc')](_0x766c('0xd'),_0x46d290,'request\x20sent');logger[_0x766c('0xe')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x46d290,_0x766c('0xf'),JSON[_0x766c('0x10')](_0x141744));if(_0x141744[_0x766c('0x11')]){if(_0x141744[_0x766c('0x11')][_0x766c('0x12')]===0x1f4){logger[_0x766c('0x11')](_0x766c('0xd'),_0x46d290,_0x141744[_0x766c('0x11')][_0x766c('0x13')]);return _0x4488b8(_0x141744[_0x766c('0x11')][_0x766c('0x13')]);}logger[_0x766c('0x11')](_0x766c('0xd'),_0x46d290,_0x141744[_0x766c('0x11')][_0x766c('0x13')]);return _0x22a524(_0x141744['error']['message']);}else{logger['info'](_0x766c('0xd'),_0x46d290,_0x766c('0xf'));_0x22a524(_0x141744[_0x766c('0x14')][_0x766c('0x13')]);}})[_0x766c('0x15')](function(_0x357602){logger['error']('MemberReport,\x20%s,\x20%s',_0x46d290,_0x357602);_0x4488b8(_0x357602);});});}exports[_0x766c('0x16')]=function(_0x23c566){var _0x105f60=this;return new Promise(function(_0x47c887,_0x2cd2e7){return db[_0x766c('0x17')][_0x766c('0x18')]({'raw':_0x23c566['options']?_0x23c566['options']['raw']===undefined?!![]:![]:!![],'where':_0x23c566[_0x766c('0x19')]?_0x23c566['options'][_0x766c('0x1a')]||null:null,'attributes':_0x23c566[_0x766c('0x19')]?_0x23c566['options']['attributes']||null:null,'limit':_0x23c566[_0x766c('0x19')]?_0x23c566[_0x766c('0x19')][_0x766c('0x1b')]||null:null,'include':_0x23c566['options']?_0x23c566[_0x766c('0x19')][_0x766c('0x1c')]?_['map'](_0x23c566['options']['include'],function(_0x43d91f){return{'model':db[_0x43d91f['model']],'as':_0x43d91f['as'],'attributes':_0x43d91f[_0x766c('0x1d')],'include':_0x43d91f[_0x766c('0x1c')]?_[_0x766c('0x1e')](_0x43d91f['include'],function(_0x44659e){return{'model':db[_0x44659e[_0x766c('0x1f')]],'as':_0x44659e['as'],'attributes':_0x44659e[_0x766c('0x1d')],'include':_0x44659e[_0x766c('0x1c')]?_[_0x766c('0x1e')](_0x44659e[_0x766c('0x1c')],function(_0x5ad1d6){return{'model':db[_0x5ad1d6[_0x766c('0x1f')]],'as':_0x5ad1d6['as'],'attributes':_0x5ad1d6[_0x766c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x766c('0x20')](function(_0x3a6757){logger[_0x766c('0xc')]('GetMemberReport',_0x23c566);logger['debug'](_0x766c('0x16'),_0x23c566,JSON[_0x766c('0x10')](_0x3a6757));_0x47c887(_0x3a6757);})[_0x766c('0x15')](function(_0x549dde){logger[_0x766c('0x11')](_0x766c('0x16'),_0x549dde['message'],_0x23c566);_0x2cd2e7(_0x105f60[_0x766c('0x11')](0x1f4,_0x549dde['message']));});});};exports['CreateMemberReport']=function(_0x3a4561){var _0x10421d=this;return new Promise(function(_0x1eac49,_0x5b94cf){return db[_0x766c('0x17')][_0x766c('0x21')](_0x3a4561[_0x766c('0x22')],{'raw':_0x3a4561[_0x766c('0x19')]?_0x3a4561[_0x766c('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4659cc){logger[_0x766c('0xc')](_0x766c('0x23'),_0x3a4561);logger[_0x766c('0xe')](_0x766c('0x23'),_0x3a4561,JSON['stringify'](_0x4659cc));_0x1eac49(_0x4659cc);})[_0x766c('0x15')](function(_0x40c43a){logger[_0x766c('0x11')]('CreateMemberReport',_0x40c43a[_0x766c('0x13')],_0x3a4561);_0x5b94cf(_0x10421d['error'](0x1f4,_0x40c43a['message']));});});};exports[_0x766c('0x24')]=function(_0x4e5eec){var _0x26bd0b=this;return new Promise(function(_0x182a81,_0x2f96e3){return db[_0x766c('0x17')]['update'](_0x4e5eec['body'],{'raw':_0x4e5eec[_0x766c('0x19')]?_0x4e5eec[_0x766c('0x19')][_0x766c('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e5eec[_0x766c('0x19')]?_0x4e5eec[_0x766c('0x19')][_0x766c('0x1a')]||null:null,'attributes':_0x4e5eec[_0x766c('0x19')]?_0x4e5eec[_0x766c('0x19')][_0x766c('0x1d')]||null:null,'limit':_0x4e5eec[_0x766c('0x19')]?_0x4e5eec[_0x766c('0x19')][_0x766c('0x1b')]||null:null})[_0x766c('0x20')](function(_0x4b2b06){logger[_0x766c('0xc')]('UpdateMemberReport',_0x4e5eec);logger[_0x766c('0xe')]('UpdateMemberReport',_0x4e5eec,JSON[_0x766c('0x10')](_0x4b2b06));_0x182a81(_0x4b2b06);})[_0x766c('0x15')](function(_0x4832da){logger[_0x766c('0x11')](_0x766c('0x24'),_0x4832da['message'],_0x4e5eec);_0x2f96e3(_0x26bd0b[_0x766c('0x11')](0x1f4,_0x4832da['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index f38633d..bd79dc1 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 _0xadd2=['../../components/interaction/service','../../config/environment','./migration.controller','get','index','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xc5c376,_0x58f0d5){var _0x1facfe=function(_0x505792){while(--_0x505792){_0xc5c376['push'](_0xc5c376['shift']());}};_0x1facfe(++_0x58f0d5);}(_0xadd2,0xa5));var _0x2add=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xadd2[_0x178e48];return _0x440d7e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2add('0x0'));var timeout=require('connect-timeout');var express=require(_0x2add('0x1'));var router=express[_0x2add('0x2')]();var fs_extra=require(_0x2add('0x3'));var auth=require(_0x2add('0x4'));var interaction=require(_0x2add('0x5'));var config=require(_0x2add('0x6'));var controller=require(_0x2add('0x7'));router[_0x2add('0x8')]('/',controller[_0x2add('0x9')]);module['exports']=router; \ No newline at end of file +var _0x9a6b=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./migration.controller','get','index','exports','multer'];(function(_0x10f149,_0x47c6b6){var _0x1756c1=function(_0x1508d0){while(--_0x1508d0){_0x10f149['push'](_0x10f149['shift']());}};_0x1756c1(++_0x47c6b6);}(_0x9a6b,0x77));var _0xb9a6=function(_0x1d663b,_0x949809){_0x1d663b=_0x1d663b-0x0;var _0x10a749=_0x9a6b[_0x1d663b];return _0x10a749;};'use strict';var multer=require(_0xb9a6('0x0'));var util=require(_0xb9a6('0x1'));var path=require(_0xb9a6('0x2'));var timeout=require(_0xb9a6('0x3'));var express=require(_0xb9a6('0x4'));var router=express[_0xb9a6('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb9a6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb9a6('0x7'));var controller=require(_0xb9a6('0x8'));router[_0xb9a6('0x9')]('/',controller[_0xb9a6('0xa')]);module[_0xb9a6('0xb')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 26c8a6b..51c62c1 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 _0x085c=['exports','version'];(function(_0x2eb1f,_0x6b7803){var _0xc359c9=function(_0xe1148){while(--_0xe1148){_0x2eb1f['push'](_0x2eb1f['shift']());}};_0xc359c9(++_0x6b7803);}(_0x085c,0x88));var _0xc085=function(_0x3f7830,_0x2ef515){_0x3f7830=_0x3f7830-0x0;var _0x392bcf=_0x085c[_0x3f7830];return _0x392bcf;};'use strict';var Sequelize=require('sequelize');module[_0xc085('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0xc085('0x1')}}; \ No newline at end of file +var _0x5c5f=['STRING','version','exports'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x5c5f,0x125));var _0xf5c5=function(_0x3e6c96,_0x5b780b){_0x3e6c96=_0x3e6c96-0x0;var _0x43a176=_0x5c5f[_0x3e6c96];return _0x43a176;};'use strict';var Sequelize=require('sequelize');module[_0xf5c5('0x0')]={'version':{'type':Sequelize[_0xf5c5('0x1')],'unique':_0xf5c5('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index bf51585..e9fd994 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 _0x0142=['options','include','findAll','rows','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','then','destroy','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x248f3b,_0x42fba9){var _0x3368f8=function(_0x15158b){while(--_0x15158b){_0x248f3b['push'](_0x248f3b['shift']());}};_0x3368f8(++_0x42fba9);}(_0x0142,0x158));var _0x2014=function(_0x5c6bc9,_0x4276f7){_0x5c6bc9=_0x5c6bc9-0x0;var _0x5b1fa5=_0x0142[_0x5c6bc9];return _0x5b1fa5;};'use strict';var emlformat=require(_0x2014('0x0'));var rimraf=require(_0x2014('0x1'));var zipdir=require(_0x2014('0x2'));var jsonpatch=require(_0x2014('0x3'));var rp=require('request-promise');var moment=require(_0x2014('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2014('0x5'));var path=require('path');var sox=require(_0x2014('0x6'));var csv=require('to-csv');var ejs=require(_0x2014('0x7'));var fs=require('fs');var fs_extra=require(_0x2014('0x8'));var _=require(_0x2014('0x9'));var squel=require(_0x2014('0xa'));var crypto=require(_0x2014('0xb'));var jsforce=require(_0x2014('0xc'));var deskjs=require(_0x2014('0xd'));var toCsv=require(_0x2014('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2014('0xf'));var qs=require(_0x2014('0x10'));var as=require(_0x2014('0x11'));var hardwareService=require(_0x2014('0x12'));var logger=require('../../config/logger')(_0x2014('0x13'));var utils=require(_0x2014('0x14'));var config=require(_0x2014('0x15'));var licenseUtil=require(_0x2014('0x16'));var db=require(_0x2014('0x17'))['db'];function respondWithStatusCode(_0x19a1d1,_0x45ef86){_0x45ef86=_0x45ef86||0xcc;return function(_0x1ad337){if(_0x1ad337){return _0x19a1d1[_0x2014('0x18')](_0x45ef86);}return _0x19a1d1[_0x2014('0x19')](_0x45ef86)[_0x2014('0x1a')]();};}function respondWithResult(_0x581671,_0x4f593d){_0x4f593d=_0x4f593d||0xc8;return function(_0x4e7b79){if(_0x4e7b79){return _0x581671[_0x2014('0x19')](_0x4f593d)['json'](_0x4e7b79);}};}function respondWithFilteredResult(_0x2fadba,_0x1c45dd){return function(_0x4f4e62){if(_0x4f4e62){var _0x39ecf6=typeof _0x1c45dd[_0x2014('0x1b')]===_0x2014('0x1c')&&typeof _0x1c45dd['limit']==='undefined';var _0x241ce6=_0x4f4e62[_0x2014('0x1d')];var _0x1f86de=_0x39ecf6?0x0:_0x1c45dd[_0x2014('0x1b')];var _0x48c0cc=_0x39ecf6?_0x4f4e62[_0x2014('0x1d')]:_0x1c45dd[_0x2014('0x1b')]+_0x1c45dd[_0x2014('0x1e')];var _0x6efd51;if(_0x48c0cc>=_0x241ce6){_0x48c0cc=_0x241ce6;_0x6efd51=0xc8;}else{_0x6efd51=0xce;}_0x2fadba['status'](_0x6efd51);return _0x2fadba[_0x2014('0x1f')](_0x2014('0x20'),_0x1f86de+'-'+_0x48c0cc+'/'+_0x241ce6)[_0x2014('0x21')](_0x4f4e62);}return null;};}function patchUpdates(_0x453e65){return function(_0x10066a){try{jsonpatch[_0x2014('0x22')](_0x10066a,_0x453e65,!![]);}catch(_0xcab29d){return BPromise['reject'](_0xcab29d);}return _0x10066a[_0x2014('0x23')]();};}function saveUpdates(_0x447567,_0xeaacae){return function(_0x5b88df){if(_0x5b88df){return _0x5b88df['update'](_0x447567)[_0x2014('0x24')](function(_0x40e4f8){return _0x40e4f8;});}return null;};}function removeEntity(_0x4907c5,_0x473085){return function(_0x170f8f){if(_0x170f8f){return _0x170f8f[_0x2014('0x25')]()[_0x2014('0x24')](function(){_0x4907c5['status'](0xcc)[_0x2014('0x1a')]();});}};}function handleEntityNotFound(_0x53d1ab,_0x3b182f){return function(_0x2f6162){if(!_0x2f6162){_0x53d1ab[_0x2014('0x18')](0x194);}return _0x2f6162;};}function handleError(_0x5d49a8,_0x5d3d63){_0x5d3d63=_0x5d3d63||0x1f4;return function(_0x3c96ff){logger['error'](_0x3c96ff[_0x2014('0x26')]);if(_0x3c96ff[_0x2014('0x27')]){delete _0x3c96ff[_0x2014('0x27')];}_0x5d49a8[_0x2014('0x19')](_0x5d3d63)[_0x2014('0x28')](_0x3c96ff);};}exports[_0x2014('0x29')]=function(_0x28c3f7,_0x2d4a9a){var _0x2b9cf2={},_0x56924e={},_0x407457={'count':0x0,'rows':[]};var _0x41ce5a=_[_0x2014('0x2a')](db[_0x2014('0x2b')][_0x2014('0x2c')],function(_0x39823c){return{'name':_0x39823c[_0x2014('0x2d')],'type':_0x39823c[_0x2014('0x2e')]['key']};});_0x56924e['model']=_['map'](_0x41ce5a,'name');_0x56924e[_0x2014('0x2f')]=_[_0x2014('0x30')](_0x28c3f7[_0x2014('0x2f')]);_0x56924e[_0x2014('0x31')]=_['intersection'](_0x56924e['model'],_0x56924e[_0x2014('0x2f')]);_0x2b9cf2[_0x2014('0x32')]=_[_0x2014('0x33')](_0x56924e[_0x2014('0x34')],qs[_0x2014('0x35')](_0x28c3f7['query']['fields']));_0x2b9cf2[_0x2014('0x32')]=_0x2b9cf2['attributes'][_0x2014('0x36')]?_0x2b9cf2[_0x2014('0x32')]:_0x56924e['model'];if(!_0x28c3f7[_0x2014('0x2f')][_0x2014('0x37')](_0x2014('0x38'))){_0x2b9cf2[_0x2014('0x1e')]=qs['limit'](_0x28c3f7[_0x2014('0x2f')][_0x2014('0x1e')]);_0x2b9cf2[_0x2014('0x1b')]=qs[_0x2014('0x1b')](_0x28c3f7[_0x2014('0x2f')][_0x2014('0x1b')]);}_0x2b9cf2[_0x2014('0x39')]=qs[_0x2014('0x3a')](_0x28c3f7[_0x2014('0x2f')][_0x2014('0x3a')]);_0x2b9cf2[_0x2014('0x3b')]=qs[_0x2014('0x31')](_[_0x2014('0x3c')](_0x28c3f7[_0x2014('0x2f')],_0x56924e[_0x2014('0x31')]),_0x41ce5a);if(_0x28c3f7[_0x2014('0x2f')][_0x2014('0x3d')]){_0x2b9cf2['where']=_[_0x2014('0x3e')](_0x2b9cf2[_0x2014('0x3b')],{'$or':_[_0x2014('0x2a')](_0x41ce5a,function(_0x517509){if(_0x517509[_0x2014('0x2e')]!==_0x2014('0x3f')){var _0x36e446={};_0x36e446[_0x517509[_0x2014('0x27')]]={'$like':'%'+_0x28c3f7[_0x2014('0x2f')][_0x2014('0x3d')]+'%'};return _0x36e446;}})});}_0x2b9cf2=_[_0x2014('0x3e')]({},_0x2b9cf2,_0x28c3f7[_0x2014('0x40')]);var _0x3bf653={'where':_0x2b9cf2[_0x2014('0x3b')]};return db[_0x2014('0x2b')][_0x2014('0x1d')](_0x3bf653)['then'](function(_0x5696aa){_0x407457['count']=_0x5696aa;if(_0x28c3f7[_0x2014('0x2f')]['includeAll']){_0x2b9cf2[_0x2014('0x41')]=[{'all':!![]}];}return db[_0x2014('0x2b')][_0x2014('0x42')](_0x2b9cf2);})['then'](function(_0x548b71){_0x407457[_0x2014('0x43')]=_0x548b71;return _0x407457;})[_0x2014('0x24')](respondWithFilteredResult(_0x2d4a9a,_0x2b9cf2))['catch'](handleError(_0x2d4a9a,null));}; \ No newline at end of file +var _0x3e67=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','error','send','index','Migration','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','catch','eml-format','rimraf'];(function(_0x3b469c,_0x174d91){var _0x47fbca=function(_0xfd53fd){while(--_0xfd53fd){_0x3b469c['push'](_0x3b469c['shift']());}};_0x47fbca(++_0x174d91);}(_0x3e67,0x88));var _0x73e6=function(_0x102f97,_0x5bda2f){_0x102f97=_0x102f97-0x0;var _0xd22058=_0x3e67[_0x102f97];return _0xd22058;};'use strict';var emlformat=require(_0x73e6('0x0'));var rimraf=require(_0x73e6('0x1'));var zipdir=require(_0x73e6('0x2'));var jsonpatch=require(_0x73e6('0x3'));var rp=require(_0x73e6('0x4'));var moment=require(_0x73e6('0x5'));var BPromise=require(_0x73e6('0x6'));var Mustache=require('mustache');var util=require(_0x73e6('0x7'));var path=require(_0x73e6('0x8'));var sox=require(_0x73e6('0x9'));var csv=require(_0x73e6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x73e6('0xb'));var _=require(_0x73e6('0xc'));var squel=require(_0x73e6('0xd'));var crypto=require(_0x73e6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x73e6('0xf'));var toCsv=require(_0x73e6('0xa'));var querystring=require(_0x73e6('0x10'));var Papa=require(_0x73e6('0x11'));var Redis=require(_0x73e6('0x12'));var authService=require(_0x73e6('0x13'));var qs=require(_0x73e6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x73e6('0x15'))(_0x73e6('0x16'));var utils=require(_0x73e6('0x17'));var config=require(_0x73e6('0x18'));var licenseUtil=require(_0x73e6('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b4aa5,_0x2c47ce){_0x2c47ce=_0x2c47ce||0xcc;return function(_0x4496a4){if(_0x4496a4){return _0x5b4aa5[_0x73e6('0x1a')](_0x2c47ce);}return _0x5b4aa5[_0x73e6('0x1b')](_0x2c47ce)[_0x73e6('0x1c')]();};}function respondWithResult(_0x5cd89a,_0x363c07){_0x363c07=_0x363c07||0xc8;return function(_0x4b2843){if(_0x4b2843){return _0x5cd89a['status'](_0x363c07)[_0x73e6('0x1d')](_0x4b2843);}};}function respondWithFilteredResult(_0x5210ab,_0x5dbb6f){return function(_0x592fff){if(_0x592fff){var _0x522abc=typeof _0x5dbb6f['offset']===_0x73e6('0x1e')&&typeof _0x5dbb6f[_0x73e6('0x1f')]===_0x73e6('0x1e');var _0x781a62=_0x592fff[_0x73e6('0x20')];var _0x4e6aac=_0x522abc?0x0:_0x5dbb6f[_0x73e6('0x21')];var _0x16eb25=_0x522abc?_0x592fff[_0x73e6('0x20')]:_0x5dbb6f['offset']+_0x5dbb6f[_0x73e6('0x1f')];var _0x4f36d0;if(_0x16eb25>=_0x781a62){_0x16eb25=_0x781a62;_0x4f36d0=0xc8;}else{_0x4f36d0=0xce;}_0x5210ab['status'](_0x4f36d0);return _0x5210ab[_0x73e6('0x22')](_0x73e6('0x23'),_0x4e6aac+'-'+_0x16eb25+'/'+_0x781a62)['json'](_0x592fff);}return null;};}function patchUpdates(_0x522def){return function(_0x177fbc){try{jsonpatch[_0x73e6('0x24')](_0x177fbc,_0x522def,!![]);}catch(_0x923975){return BPromise['reject'](_0x923975);}return _0x177fbc[_0x73e6('0x25')]();};}function saveUpdates(_0x53d289,_0x9aba8c){return function(_0x1445c0){if(_0x1445c0){return _0x1445c0[_0x73e6('0x26')](_0x53d289)[_0x73e6('0x27')](function(_0x3508e5){return _0x3508e5;});}return null;};}function removeEntity(_0x81354b,_0x527bff){return function(_0x20ec61){if(_0x20ec61){return _0x20ec61[_0x73e6('0x28')]()[_0x73e6('0x27')](function(){_0x81354b[_0x73e6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c8d35,_0x5d4588){return function(_0x29b89d){if(!_0x29b89d){_0x3c8d35['sendStatus'](0x194);}return _0x29b89d;};}function handleError(_0x4354dc,_0x4ef294){_0x4ef294=_0x4ef294||0x1f4;return function(_0xa84bde){logger[_0x73e6('0x29')](_0xa84bde['stack']);if(_0xa84bde['name']){delete _0xa84bde['name'];}_0x4354dc[_0x73e6('0x1b')](_0x4ef294)[_0x73e6('0x2a')](_0xa84bde);};}exports[_0x73e6('0x2b')]=function(_0x40a9ff,_0x137053){var _0x5e106d={},_0x1694f8={},_0x47dbbe={'count':0x0,'rows':[]};var _0x4245e8=_['map'](db[_0x73e6('0x2c')][_0x73e6('0x2d')],function(_0x5bdf87){return{'name':_0x5bdf87[_0x73e6('0x2e')],'type':_0x5bdf87[_0x73e6('0x2f')][_0x73e6('0x30')]};});_0x1694f8[_0x73e6('0x31')]=_[_0x73e6('0x32')](_0x4245e8,_0x73e6('0x33'));_0x1694f8[_0x73e6('0x34')]=_[_0x73e6('0x35')](_0x40a9ff[_0x73e6('0x34')]);_0x1694f8[_0x73e6('0x36')]=_[_0x73e6('0x37')](_0x1694f8[_0x73e6('0x31')],_0x1694f8[_0x73e6('0x34')]);_0x5e106d['attributes']=_[_0x73e6('0x37')](_0x1694f8['model'],qs['fields'](_0x40a9ff['query']['fields']));_0x5e106d[_0x73e6('0x38')]=_0x5e106d[_0x73e6('0x38')]['length']?_0x5e106d['attributes']:_0x1694f8['model'];if(!_0x40a9ff['query'][_0x73e6('0x39')](_0x73e6('0x3a'))){_0x5e106d['limit']=qs[_0x73e6('0x1f')](_0x40a9ff[_0x73e6('0x34')][_0x73e6('0x1f')]);_0x5e106d[_0x73e6('0x21')]=qs[_0x73e6('0x21')](_0x40a9ff[_0x73e6('0x34')][_0x73e6('0x21')]);}_0x5e106d[_0x73e6('0x3b')]=qs[_0x73e6('0x3c')](_0x40a9ff[_0x73e6('0x34')][_0x73e6('0x3c')]);_0x5e106d[_0x73e6('0x3d')]=qs['filters'](_[_0x73e6('0x3e')](_0x40a9ff[_0x73e6('0x34')],_0x1694f8[_0x73e6('0x36')]),_0x4245e8);if(_0x40a9ff[_0x73e6('0x34')][_0x73e6('0x3f')]){_0x5e106d[_0x73e6('0x3d')]=_['merge'](_0x5e106d[_0x73e6('0x3d')],{'$or':_[_0x73e6('0x32')](_0x4245e8,function(_0x1bc848){if(_0x1bc848['type']!=='VIRTUAL'){var _0x1302e2={};_0x1302e2[_0x1bc848[_0x73e6('0x33')]]={'$like':'%'+_0x40a9ff[_0x73e6('0x34')]['filter']+'%'};return _0x1302e2;}})});}_0x5e106d=_[_0x73e6('0x40')]({},_0x5e106d,_0x40a9ff[_0x73e6('0x41')]);var _0x54686b={'where':_0x5e106d[_0x73e6('0x3d')]};return db[_0x73e6('0x2c')][_0x73e6('0x20')](_0x54686b)[_0x73e6('0x27')](function(_0x3d7afd){_0x47dbbe[_0x73e6('0x20')]=_0x3d7afd;if(_0x40a9ff[_0x73e6('0x34')][_0x73e6('0x42')]){_0x5e106d['include']=[{'all':!![]}];}return db['Migration'][_0x73e6('0x43')](_0x5e106d);})[_0x73e6('0x27')](function(_0x1f0b38){_0x47dbbe['rows']=_0x1f0b38;return _0x47dbbe;})[_0x73e6('0x27')](respondWithFilteredResult(_0x137053,_0x5e106d))[_0x73e6('0x44')](handleError(_0x137053,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 43d18f2..1ec3603 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 _0x210d=['Migration','migrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./migration.attributes','exports','define'];(function(_0x10364c,_0x3859a8){var _0xceda=function(_0x2e9b1f){while(--_0x2e9b1f){_0x10364c['push'](_0x10364c['shift']());}};_0xceda(++_0x3859a8);}(_0x210d,0x72));var _0xd210=function(_0x3a99f4,_0x2a81c1){_0x3a99f4=_0x3a99f4-0x0;var _0xea0b42=_0x210d[_0x3a99f4];return _0xea0b42;};'use strict';var _=require(_0xd210('0x0'));var util=require(_0xd210('0x1'));var logger=require(_0xd210('0x2'))(_0xd210('0x3'));var moment=require(_0xd210('0x4'));var BPromise=require(_0xd210('0x5'));var rp=require(_0xd210('0x6'));var fs=require('fs');var path=require(_0xd210('0x7'));var rimraf=require(_0xd210('0x8'));var config=require('../../config/environment');var attributes=require(_0xd210('0x9'));module[_0xd210('0xa')]=function(_0x59f54f,_0x33c448){return _0x59f54f[_0xd210('0xb')](_0xd210('0xc'),attributes,{'tableName':_0xd210('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1edd=['./migration.attributes','exports','define','Migration','util','../../config/logger','bluebird','path','../../config/environment'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x1edd,0x1c6));var _0xd1ed=function(_0x284bc3,_0x22dffe){_0x284bc3=_0x284bc3-0x0;var _0x41ac81=_0x1edd[_0x284bc3];return _0x41ac81;};'use strict';var _=require('lodash');var util=require(_0xd1ed('0x0'));var logger=require(_0xd1ed('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd1ed('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd1ed('0x3'));var rimraf=require('rimraf');var config=require(_0xd1ed('0x4'));var attributes=require(_0xd1ed('0x5'));module[_0xd1ed('0x6')]=function(_0x380887,_0x2adde9){return _0x380887[_0xd1ed('0x7')](_0xd1ed('0x8'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index bb4c938..c4786bf 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 _0x0aaf=['rpc','jayson/promise','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x4c9508,_0x101a7c){var _0x172479=function(_0x39c7b5){while(--_0x39c7b5){_0x4c9508['push'](_0x4c9508['shift']());}};_0x172479(++_0x101a7c);}(_0x0aaf,0x1c8));var _0xf0aa=function(_0x49b076,_0x4fb74e){_0x49b076=_0x49b076-0x0;var _0xa3609=_0x0aaf[_0x49b076];return _0xa3609;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf0aa('0x0'));var BPromise=require(_0xf0aa('0x1'));var rs=require(_0xf0aa('0x2'));var fs=require('fs');var Redis=require(_0xf0aa('0x3'));var db=require(_0xf0aa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0aa('0x5'))(_0xf0aa('0x6'));var config=require('../../config/environment');var jayson=require(_0xf0aa('0x7'));var client=jayson['client'][_0xf0aa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c2d11,_0xe4a744,_0x244745){return new BPromise(function(_0x38bf88,_0x579674){return client[_0xf0aa('0x9')](_0x4c2d11,_0x244745)[_0xf0aa('0xa')](function(_0x5b7efc){logger[_0xf0aa('0xb')](_0xf0aa('0xc'),_0xe4a744,_0xf0aa('0xd'));logger[_0xf0aa('0xe')](_0xf0aa('0xf'),_0xe4a744,_0xf0aa('0xd'),JSON[_0xf0aa('0x10')](_0x5b7efc));if(_0x5b7efc[_0xf0aa('0x11')]){if(_0x5b7efc[_0xf0aa('0x11')][_0xf0aa('0x12')]===0x1f4){logger[_0xf0aa('0x11')](_0xf0aa('0xc'),_0xe4a744,_0x5b7efc['error']['message']);return _0x579674(_0x5b7efc[_0xf0aa('0x11')][_0xf0aa('0x13')]);}logger['error']('Migration,\x20%s,\x20%s',_0xe4a744,_0x5b7efc[_0xf0aa('0x11')]['message']);return _0x38bf88(_0x5b7efc[_0xf0aa('0x11')]['message']);}else{logger[_0xf0aa('0xb')]('Migration,\x20%s,\x20%s',_0xe4a744,_0xf0aa('0xd'));_0x38bf88(_0x5b7efc[_0xf0aa('0x14')][_0xf0aa('0x13')]);}})[_0xf0aa('0x15')](function(_0x322ae0){logger[_0xf0aa('0x11')](_0xf0aa('0xc'),_0xe4a744,_0x322ae0);_0x579674(_0x322ae0);});});} \ No newline at end of file +var _0x87ae=['debug','Migration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','Migration,\x20%s,\x20%s','request\x20sent'];(function(_0x240261,_0x4fe66c){var _0x45c332=function(_0x4f367a){while(--_0x4f367a){_0x240261['push'](_0x240261['shift']());}};_0x45c332(++_0x4fe66c);}(_0x87ae,0xf5));var _0xe87a=function(_0x22e47a,_0x4ea10c){_0x22e47a=_0x22e47a-0x0;var _0x15a12a=_0x87ae[_0x22e47a];return _0x15a12a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe87a('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe87a('0x1'));var db=require(_0xe87a('0x2'))['db'];var utils=require(_0xe87a('0x3'));var logger=require('../../config/logger')(_0xe87a('0x4'));var config=require(_0xe87a('0x5'));var jayson=require(_0xe87a('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x125dd3,_0x2fbd6b,_0x5dff22){return new BPromise(function(_0x379db4,_0x455b3a){return client['request'](_0x125dd3,_0x5dff22)[_0xe87a('0x7')](function(_0x278d7c){logger['info'](_0xe87a('0x8'),_0x2fbd6b,_0xe87a('0x9'));logger[_0xe87a('0xa')](_0xe87a('0xb'),_0x2fbd6b,_0xe87a('0x9'),JSON[_0xe87a('0xc')](_0x278d7c));if(_0x278d7c['error']){if(_0x278d7c['error'][_0xe87a('0xd')]===0x1f4){logger[_0xe87a('0xe')](_0xe87a('0x8'),_0x2fbd6b,_0x278d7c['error'][_0xe87a('0xf')]);return _0x455b3a(_0x278d7c[_0xe87a('0xe')]['message']);}logger[_0xe87a('0xe')](_0xe87a('0x8'),_0x2fbd6b,_0x278d7c[_0xe87a('0xe')]['message']);return _0x379db4(_0x278d7c['error']['message']);}else{logger['info'](_0xe87a('0x8'),_0x2fbd6b,_0xe87a('0x9'));_0x379db4(_0x278d7c[_0xe87a('0x10')][_0xe87a('0xf')]);}})['catch'](function(_0x415147){logger[_0xe87a('0xe')]('Migration,\x20%s,\x20%s',_0x2fbd6b,_0x415147);_0x455b3a(_0x415147);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 7ae4ed8..e4b45b0 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 _0xf426=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy','exports'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xf426,0x168));var _0x6f42=function(_0x30b159,_0x3fbb50){_0x30b159=_0x30b159-0x0;var _0x23c3f9=_0xf426[_0x30b159];return _0x23c3f9;};'use strict';var multer=require(_0x6f42('0x0'));var util=require(_0x6f42('0x1'));var path=require('path');var timeout=require(_0x6f42('0x2'));var express=require(_0x6f42('0x3'));var router=express['Router']();var fs_extra=require(_0x6f42('0x4'));var auth=require(_0x6f42('0x5'));var interaction=require(_0x6f42('0x6'));var config=require(_0x6f42('0x7'));var controller=require(_0x6f42('0x8'));router[_0x6f42('0x9')]('/',auth[_0x6f42('0xa')](),controller[_0x6f42('0xb')]);router[_0x6f42('0x9')]('/:id',auth[_0x6f42('0xa')](),controller[_0x6f42('0xc')]);router['post']('/',auth[_0x6f42('0xa')](),controller[_0x6f42('0xd')]);router[_0x6f42('0xe')](_0x6f42('0xf'),auth['isAuthenticated'](),controller[_0x6f42('0x10')]);router[_0x6f42('0x11')](_0x6f42('0xf'),auth[_0x6f42('0xa')](),controller[_0x6f42('0x12')]);module[_0x6f42('0x13')]=router; \ No newline at end of file +var _0xb422=['../../components/interaction/service','./network.controller','isAuthenticated','index','get','show','post','put','update','delete','/:id','destroy','exports','connect-timeout','fs-extra'];(function(_0x1be181,_0x29d354){var _0x2f46d3=function(_0x381f28){while(--_0x381f28){_0x1be181['push'](_0x1be181['shift']());}};_0x2f46d3(++_0x29d354);}(_0xb422,0x85));var _0x2b42=function(_0x129bed,_0x529bf2){_0x129bed=_0x129bed-0x0;var _0x286f63=_0xb422[_0x129bed];return _0x286f63;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x2b42('0x0'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2b42('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x2b42('0x2'));var config=require('../../config/environment');var controller=require(_0x2b42('0x3'));router['get']('/',auth[_0x2b42('0x4')](),controller[_0x2b42('0x5')]);router[_0x2b42('0x6')]('/:id',auth[_0x2b42('0x4')](),controller[_0x2b42('0x7')]);router[_0x2b42('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2b42('0x9')]('/:id',auth[_0x2b42('0x4')](),controller[_0x2b42('0xa')]);router[_0x2b42('0xb')](_0x2b42('0xc'),auth['isAuthenticated'](),controller[_0x2b42('0xd')]);module[_0x2b42('0xe')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 502aeb4..fff5d0e 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 _0x30f2=['stun','STRING','exports','ENUM','externip'];(function(_0x228da4,_0x27cca9){var _0x26f6dc=function(_0x44d747){while(--_0x44d747){_0x228da4['push'](_0x228da4['shift']());}};_0x26f6dc(++_0x27cca9);}(_0x30f2,0x11f));var _0x230f=function(_0x4ef101,_0x33be6c){_0x4ef101=_0x4ef101-0x0;var _0x4c61a9=_0x30f2[_0x4ef101];return _0x4c61a9;};'use strict';var Sequelize=require('sequelize');module[_0x230f('0x0')]={'type':{'type':Sequelize[_0x230f('0x1')]('localnet',_0x230f('0x2'),_0x230f('0x3'),'turn')},'value':{'type':Sequelize[_0x230f('0x4')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcb18=['stun','turn','STRING','sequelize','exports','ENUM','externip'];(function(_0x375492,_0x4ed149){var _0x18ba5b=function(_0x154a12){while(--_0x154a12){_0x375492['push'](_0x375492['shift']());}};_0x18ba5b(++_0x4ed149);}(_0xcb18,0x129));var _0x8cb1=function(_0xbb1393,_0x10c4bc){_0xbb1393=_0xbb1393-0x0;var _0x1cd1e9=_0xcb18[_0xbb1393];return _0x1cd1e9;};'use strict';var Sequelize=require(_0x8cb1('0x0'));module[_0x8cb1('0x1')]={'type':{'type':Sequelize[_0x8cb1('0x2')]('localnet',_0x8cb1('0x3'),_0x8cb1('0x4'),_0x8cb1('0x5'))},'value':{'type':Sequelize[_0x8cb1('0x6')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 37d8e18..a3fbf8c 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 _0x427f=['../../config/license/util','../../mysqldb','jayson/promise','client','request','then','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','Network,\x20%s,\x20%s','message','info','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','stack','name','index','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','Network','rows','show','params','rawAttributes','include','find','create','sequelize','transaction','body','STUN','readFileSync','writeFileSync','toUpperCase','join','server/files/templates/turn_multiple.ejs','utf8','render','/etc/asterisk/turn_xcally.conf','Reload','res_stun_monitor.so','root','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','findAll','/etc/asterisk/stun_xcally.conf','TURN','server/files/templates/stun_multiple.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x2b2279,_0x5bbec2){var _0x2a8251=function(_0x23ce30){while(--_0x23ce30){_0x2b2279['push'](_0x2b2279['shift']());}};_0x2a8251(++_0x5bbec2);}(_0x427f,0xc4));var _0xf427=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x427f[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0xf427('0x0'));var rimraf=require(_0xf427('0x1'));var zipdir=require(_0xf427('0x2'));var jsonpatch=require(_0xf427('0x3'));var rp=require(_0xf427('0x4'));var moment=require(_0xf427('0x5'));var BPromise=require(_0xf427('0x6'));var Mustache=require(_0xf427('0x7'));var util=require('util');var path=require(_0xf427('0x8'));var sox=require(_0xf427('0x9'));var csv=require(_0xf427('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf427('0xb'));var squel=require(_0xf427('0xc'));var crypto=require(_0xf427('0xd'));var jsforce=require(_0xf427('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf427('0xf'));var Papa=require(_0xf427('0x10'));var Redis=require(_0xf427('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf427('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf427('0x13'));var logger=require(_0xf427('0x14'))(_0xf427('0x15'));var utils=require(_0xf427('0x16'));var config=require(_0xf427('0x17'));var licenseUtil=require(_0xf427('0x18'));var db=require(_0xf427('0x19'))['db'];var jayson=require(_0xf427('0x1a'));var client=jayson[_0xf427('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46657e,_0x4ea2e1,_0x1ba0f1,_0x30cbf0){return new BPromise(function(_0x6963e2,_0xc98ddf){var _0x5719fc=_0x30cbf0||client;return _0x5719fc[_0xf427('0x1c')](_0x46657e,_0x1ba0f1)[_0xf427('0x1d')](function(_0x2f0c5b){logger['info']('Network,\x20%s,\x20%s',_0x4ea2e1,_0xf427('0x1e'));logger['debug'](_0xf427('0x1f'),_0x4ea2e1,_0xf427('0x1e'),JSON[_0xf427('0x20')](_0x2f0c5b));if(_0x2f0c5b[_0xf427('0x21')]){if(_0x2f0c5b[_0xf427('0x21')]['code']===0x1f4){logger['error'](_0xf427('0x22'),_0x4ea2e1,_0x2f0c5b[_0xf427('0x21')][_0xf427('0x23')]);return _0xc98ddf(_0x2f0c5b[_0xf427('0x21')][_0xf427('0x23')]);}logger['error'](_0xf427('0x22'),_0x4ea2e1,_0x2f0c5b['error'][_0xf427('0x23')]);return _0x6963e2(_0x2f0c5b[_0xf427('0x21')]['message']);}else{logger[_0xf427('0x24')](_0xf427('0x22'),_0x4ea2e1,_0xf427('0x1e'));_0x6963e2(_0x2f0c5b[_0xf427('0x25')]['message']);}})[_0xf427('0x26')](function(_0x1bb886){logger[_0xf427('0x21')](_0xf427('0x22'),_0x4ea2e1,_0x1bb886);_0xc98ddf(_0x1bb886);});});}function respondWithStatusCode(_0x4033ec,_0x4603e1){_0x4603e1=_0x4603e1||0xcc;return function(_0x2928f1){if(_0x2928f1){return _0x4033ec[_0xf427('0x27')](_0x4603e1);}return _0x4033ec['status'](_0x4603e1)[_0xf427('0x28')]();};}function respondWithResult(_0x2eb746,_0x305325){_0x305325=_0x305325||0xc8;return function(_0x12ee6d){if(_0x12ee6d){return _0x2eb746[_0xf427('0x29')](_0x305325)[_0xf427('0x2a')](_0x12ee6d);}};}function respondWithFilteredResult(_0xa7c44f,_0x75df5a){return function(_0x17975e){if(_0x17975e){var _0x1bc62d=typeof _0x75df5a[_0xf427('0x2b')]===_0xf427('0x2c')&&typeof _0x75df5a[_0xf427('0x2d')]===_0xf427('0x2c');var _0x1edfb4=_0x17975e[_0xf427('0x2e')];var _0x28c012=_0x1bc62d?0x0:_0x75df5a['offset'];var _0x3eabde=_0x1bc62d?_0x17975e[_0xf427('0x2e')]:_0x75df5a[_0xf427('0x2b')]+_0x75df5a['limit'];var _0x9df334;if(_0x3eabde>=_0x1edfb4){_0x3eabde=_0x1edfb4;_0x9df334=0xc8;}else{_0x9df334=0xce;}_0xa7c44f[_0xf427('0x29')](_0x9df334);return _0xa7c44f[_0xf427('0x2f')](_0xf427('0x30'),_0x28c012+'-'+_0x3eabde+'/'+_0x1edfb4)[_0xf427('0x2a')](_0x17975e);}return null;};}function patchUpdates(_0x48de70){return function(_0x339331){try{jsonpatch[_0xf427('0x31')](_0x339331,_0x48de70,!![]);}catch(_0x51a0f4){return BPromise[_0xf427('0x32')](_0x51a0f4);}return _0x339331['save']();};}function saveUpdates(_0x1187ec,_0x35b344){return function(_0x2c2345){if(_0x2c2345){return _0x2c2345[_0xf427('0x33')](_0x1187ec)[_0xf427('0x1d')](function(_0x2ceded){return _0x2ceded;});}return null;};}function removeEntity(_0x23327e,_0x5f458a){return function(_0x59a89d){if(_0x59a89d){return _0x59a89d[_0xf427('0x34')]()['then'](function(){_0x23327e[_0xf427('0x29')](0xcc)[_0xf427('0x28')]();});}};}function handleEntityNotFound(_0x174071,_0x14571a){return function(_0x196976){if(!_0x196976){_0x174071[_0xf427('0x27')](0x194);}return _0x196976;};}function handleError(_0x1d44de,_0x2b1cef){_0x2b1cef=_0x2b1cef||0x1f4;return function(_0x3f733a){logger['error'](_0x3f733a[_0xf427('0x35')]);if(_0x3f733a[_0xf427('0x36')]){delete _0x3f733a['name'];}_0x1d44de[_0xf427('0x29')](_0x2b1cef)['send'](_0x3f733a);};}exports[_0xf427('0x37')]=function(_0x39159e,_0x26f029){var _0x293c96={},_0x356085={},_0x32cf36={'count':0x0,'rows':[]};var _0x1f26fc=_['map'](db['Network']['rawAttributes'],function(_0x61588f){return{'name':_0x61588f['fieldName'],'type':_0x61588f[_0xf427('0x38')][_0xf427('0x39')]};});_0x356085[_0xf427('0x3a')]=_[_0xf427('0x3b')](_0x1f26fc,_0xf427('0x36'));_0x356085['query']=_[_0xf427('0x3c')](_0x39159e[_0xf427('0x3d')]);_0x356085[_0xf427('0x3e')]=_[_0xf427('0x3f')](_0x356085['model'],_0x356085[_0xf427('0x3d')]);_0x293c96[_0xf427('0x40')]=_['intersection'](_0x356085['model'],qs[_0xf427('0x41')](_0x39159e[_0xf427('0x3d')][_0xf427('0x41')]));_0x293c96['attributes']=_0x293c96[_0xf427('0x40')][_0xf427('0x42')]?_0x293c96['attributes']:_0x356085['model'];if(!_0x39159e['query'][_0xf427('0x43')](_0xf427('0x44'))){_0x293c96[_0xf427('0x2d')]=qs[_0xf427('0x2d')](_0x39159e[_0xf427('0x3d')]['limit']);_0x293c96[_0xf427('0x2b')]=qs[_0xf427('0x2b')](_0x39159e[_0xf427('0x3d')][_0xf427('0x2b')]);}_0x293c96[_0xf427('0x45')]=qs[_0xf427('0x46')](_0x39159e[_0xf427('0x3d')][_0xf427('0x46')]);_0x293c96[_0xf427('0x47')]=qs['filters'](_[_0xf427('0x48')](_0x39159e[_0xf427('0x3d')],_0x356085[_0xf427('0x3e')]),_0x1f26fc);if(_0x39159e[_0xf427('0x3d')][_0xf427('0x49')]){_0x293c96[_0xf427('0x47')]=_[_0xf427('0x4a')](_0x293c96[_0xf427('0x47')],{'$or':_[_0xf427('0x3b')](_0x1f26fc,function(_0x3e95af){if(_0x3e95af[_0xf427('0x38')]!==_0xf427('0x4b')){var _0xe150da={};_0xe150da[_0x3e95af[_0xf427('0x36')]]={'$like':'%'+_0x39159e['query'][_0xf427('0x49')]+'%'};return _0xe150da;}})});}_0x293c96=_[_0xf427('0x4a')]({},_0x293c96,_0x39159e[_0xf427('0x4c')]);var _0x5d0f4a={'where':_0x293c96['where']};return db['Network']['count'](_0x5d0f4a)[_0xf427('0x1d')](function(_0x30de54){_0x32cf36[_0xf427('0x2e')]=_0x30de54;if(_0x39159e['query'][_0xf427('0x4d')]){_0x293c96['include']=[{'all':!![]}];}return db[_0xf427('0x4e')]['findAll'](_0x293c96);})[_0xf427('0x1d')](function(_0xd48b37){_0x32cf36[_0xf427('0x4f')]=_0xd48b37;return _0x32cf36;})[_0xf427('0x1d')](respondWithFilteredResult(_0x26f029,_0x293c96))[_0xf427('0x26')](handleError(_0x26f029,null));};exports[_0xf427('0x50')]=function(_0x3a75b3,_0x5c2cce){var _0x2ca267={'raw':!![],'where':{'id':_0x3a75b3[_0xf427('0x51')]['id']}},_0x197856={};_0x197856[_0xf427('0x3a')]=_[_0xf427('0x3c')](db[_0xf427('0x4e')][_0xf427('0x52')]);_0x197856[_0xf427('0x3d')]=_[_0xf427('0x3c')](_0x3a75b3['query']);_0x197856[_0xf427('0x3e')]=_['intersection'](_0x197856[_0xf427('0x3a')],_0x197856[_0xf427('0x3d')]);_0x2ca267['attributes']=_['intersection'](_0x197856[_0xf427('0x3a')],qs[_0xf427('0x41')](_0x3a75b3[_0xf427('0x3d')]['fields']));_0x2ca267[_0xf427('0x40')]=_0x2ca267[_0xf427('0x40')][_0xf427('0x42')]?_0x2ca267[_0xf427('0x40')]:_0x197856[_0xf427('0x3a')];if(_0x3a75b3[_0xf427('0x3d')][_0xf427('0x4d')]){_0x2ca267[_0xf427('0x53')]=[{'all':!![]}];}_0x2ca267=_[_0xf427('0x4a')]({},_0x2ca267,_0x3a75b3[_0xf427('0x4c')]);return db[_0xf427('0x4e')][_0xf427('0x54')](_0x2ca267)[_0xf427('0x1d')](handleEntityNotFound(_0x5c2cce,null))['then'](respondWithResult(_0x5c2cce,null))['catch'](handleError(_0x5c2cce,null));};exports[_0xf427('0x55')]=function(_0x4e26bf,_0x2d9cfb,_0x4a2835){var _0x2af7fa;return db[_0xf427('0x56')][_0xf427('0x57')](function(_0x558c96){return db[_0xf427('0x4e')]['create'](_0x4e26bf[_0xf427('0x58')],{'raw':!![]})[_0xf427('0x1d')](function(_0x49b9ec){_0x2af7fa=_0x49b9ec;return db['Network']['findAll']({'where':{'type':_0x4e26bf[_0xf427('0x58')][_0xf427('0x38')]},'raw':!![]});})[_0xf427('0x1d')](function(_0x359a7f){if(_0x2af7fa[_0xf427('0x38')]['toUpperCase']()==_0xf427('0x59')){var _0x91da05=fs[_0xf427('0x5a')](path['join'](config['root'],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x28fc7b=ejs['render'](_0x91da05,{'networks':_0x359a7f||[]});fs[_0xf427('0x5b')]('/etc/asterisk/stun_xcally.conf',_0x28fc7b);return respondWithRpcPromise('Reload','create',{'module':'res_stun_monitor.so'});}else if(_0x2af7fa[_0xf427('0x38')][_0xf427('0x5c')]()=='TURN'){var _0x38a19e=fs[_0xf427('0x5a')](path[_0xf427('0x5d')](config['root'],_0xf427('0x5e')),_0xf427('0x5f'));var _0x3b0b5b=ejs[_0xf427('0x60')](_0x38a19e,{'networks':_0x359a7f||[]});fs[_0xf427('0x5b')](_0xf427('0x61'),_0x3b0b5b);return respondWithRpcPromise(_0xf427('0x62'),_0xf427('0x55'),{'module':_0xf427('0x63')});}else{var _0x25caa9=fs['readFileSync'](path[_0xf427('0x5d')](config[_0xf427('0x64')],_0xf427('0x65')),'utf8');var _0x1e405b=ejs[_0xf427('0x60')](_0x25caa9,{'networks':_0x359a7f||[]});fs[_0xf427('0x5b')](util[_0xf427('0x66')](_0xf427('0x67'),_0x4e26bf[_0xf427('0x58')]['type'][_0xf427('0x68')]()),_0x1e405b);return respondWithRpcPromise(_0xf427('0x62'),'create',{'module':_0xf427('0x69')});}return null;})[_0xf427('0x1d')](function(){return _0x2af7fa;});})[_0xf427('0x1d')](respondWithResult(_0x2d9cfb,0xc9))['catch'](handleError(_0x2d9cfb,null));};exports[_0xf427('0x33')]=function(_0x435812,_0x331a3e,_0x3c1b4f){var _0x3973aa;return db[_0xf427('0x56')][_0xf427('0x57')](function(_0x529a29){return db[_0xf427('0x4e')]['find']({'where':{'id':_0x435812[_0xf427('0x51')]['id']}})['then'](handleEntityNotFound(_0x331a3e,null))[_0xf427('0x1d')](saveUpdates(_0x435812[_0xf427('0x58')],null))[_0xf427('0x1d')](function(_0x36dae8){if(_0x36dae8){_0x3973aa=_0x36dae8;return db['Network'][_0xf427('0x6a')]({'where':{'type':_0x3973aa[_0xf427('0x38')]},'raw':!![]});}return null;})[_0xf427('0x1d')](function(_0x7ba714){if(_0x3973aa[_0xf427('0x38')]['toUpperCase']()==_0xf427('0x59')){var _0x84e8c6=fs[_0xf427('0x5a')](path[_0xf427('0x5d')](config[_0xf427('0x64')],'server/files/templates/stun_multiple.ejs'),_0xf427('0x5f'));var _0xfe42eb=ejs[_0xf427('0x60')](_0x84e8c6,{'networks':_0x7ba714||[]});fs[_0xf427('0x5b')](_0xf427('0x6b'),_0xfe42eb);return respondWithRpcPromise('Reload',_0xf427('0x33'),{'module':_0xf427('0x63')});}else if(_0x3973aa[_0xf427('0x38')][_0xf427('0x5c')]()==_0xf427('0x6c')){var _0x542159=fs['readFileSync'](path[_0xf427('0x5d')](config['root'],_0xf427('0x5e')),_0xf427('0x5f'));var _0x2ab309=ejs['render'](_0x542159,{'networks':_0x7ba714||[]});fs[_0xf427('0x5b')](_0xf427('0x61'),_0x2ab309);return respondWithRpcPromise(_0xf427('0x62'),'update',{'module':_0xf427('0x63')});}else{var _0x49d623=fs[_0xf427('0x5a')](path[_0xf427('0x5d')](config['root'],_0xf427('0x65')),_0xf427('0x5f'));var _0x173e9f=ejs[_0xf427('0x60')](_0x49d623,{'networks':_0x7ba714||[]});fs['writeFileSync'](util[_0xf427('0x66')](_0xf427('0x67'),_0x435812[_0xf427('0x58')]['type'][_0xf427('0x68')]()),_0x173e9f);return respondWithRpcPromise('Reload','update',{'module':'chan_sip.so'});}return null;})[_0xf427('0x1d')](function(_0x42fa9c){if(_0x42fa9c){return _0x3973aa;}return null;});})[_0xf427('0x1d')](respondWithResult(_0x331a3e,null))[_0xf427('0x26')](handleError(_0x331a3e,null));};exports[_0xf427('0x34')]=function(_0xff25bc,_0x4e8f2b,_0x4ed2a9){var _0xd1559a;return db[_0xf427('0x4e')][_0xf427('0x54')]({'where':{'id':_0xff25bc[_0xf427('0x51')]['id']}})[_0xf427('0x1d')](function(_0x4d3dff){_0xd1559a=_0x4d3dff;return _0x4d3dff;})['then'](handleEntityNotFound(_0x4e8f2b,null))[_0xf427('0x1d')](removeEntity(_0x4e8f2b,null))[_0xf427('0x1d')](function(){if(_0xd1559a){return db[_0xf427('0x4e')][_0xf427('0x6a')]({'where':{'type':_0xd1559a[_0xf427('0x38')]},'raw':!![]});}})[_0xf427('0x1d')](function(_0x54645c){if(_0xd1559a[_0xf427('0x38')]['toUpperCase']()==_0xf427('0x59')){var _0x3c1157=fs[_0xf427('0x5a')](path[_0xf427('0x5d')](config[_0xf427('0x64')],_0xf427('0x6d')),_0xf427('0x5f'));var _0x290997=ejs[_0xf427('0x60')](_0x3c1157,{'networks':_0x54645c||[]});fs[_0xf427('0x5b')](_0xf427('0x6b'),_0x290997);return respondWithRpcPromise(_0xf427('0x62'),_0xf427('0x34'),{'module':_0xf427('0x63')});}else if(_0xd1559a['type'][_0xf427('0x5c')]()==_0xf427('0x6c')){var _0x1f32cc=fs[_0xf427('0x5a')](path['join'](config[_0xf427('0x64')],_0xf427('0x5e')),'utf8');var _0x1fad94=ejs[_0xf427('0x60')](_0x1f32cc,{'networks':_0x54645c||[]});fs[_0xf427('0x5b')]('/etc/asterisk/turn_xcally.conf',_0x1fad94);return respondWithRpcPromise('Reload',_0xf427('0x34'),{'module':_0xf427('0x63')});}else{var _0x50bd6a=fs[_0xf427('0x5a')](path['join'](config[_0xf427('0x64')],_0xf427('0x65')),_0xf427('0x5f'));var _0x38a4cb=ejs[_0xf427('0x60')](_0x50bd6a,{'networks':_0x54645c||[]});fs['writeFileSync'](util['format'](_0xf427('0x67'),_0xff25bc[_0xf427('0x58')][_0xf427('0x38')]['toLowerCase']()),_0x38a4cb);return respondWithRpcPromise(_0xf427('0x62'),_0xf427('0x34'),{'module':'chan_sip.so'});}return null;})[_0xf427('0x26')](handleError(_0x4e8f2b,null));}; \ No newline at end of file +var _0xade4=['render','Reload','res_stun_monitor.so','TURN','readFileSync','root','server/files/templates/turn_multiple.ejs','utf8','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','body','toLowerCase','chan_sip.so','sequelize','find','params','server/files/templates/stun_multiple.ejs','/etc/asterisk/stun_xcally.conf','format','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','undefined','offset','count','limit','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','Network','includeAll','include','rows','show','create','transaction','findAll','toUpperCase','STUN','join'];(function(_0x277579,_0x33f977){var _0x459a79=function(_0x20b8cc){while(--_0x20b8cc){_0x277579['push'](_0x277579['shift']());}};_0x459a79(++_0x33f977);}(_0xade4,0x159));var _0x4ade=function(_0x937f09,_0x10c8b3){_0x937f09=_0x937f09-0x0;var _0x2c1ae6=_0xade4[_0x937f09];return _0x2c1ae6;};'use strict';var emlformat=require(_0x4ade('0x0'));var rimraf=require(_0x4ade('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4ade('0x2'));var rp=require(_0x4ade('0x3'));var moment=require('moment');var BPromise=require(_0x4ade('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4ade('0x5'));var sox=require(_0x4ade('0x6'));var csv=require(_0x4ade('0x7'));var ejs=require(_0x4ade('0x8'));var fs=require('fs');var fs_extra=require(_0x4ade('0x9'));var _=require(_0x4ade('0xa'));var squel=require(_0x4ade('0xb'));var crypto=require(_0x4ade('0xc'));var jsforce=require(_0x4ade('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4ade('0x7'));var querystring=require(_0x4ade('0xe'));var Papa=require(_0x4ade('0xf'));var Redis=require(_0x4ade('0x10'));var authService=require(_0x4ade('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4ade('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4ade('0x13'))(_0x4ade('0x14'));var utils=require(_0x4ade('0x15'));var config=require(_0x4ade('0x16'));var licenseUtil=require(_0x4ade('0x17'));var db=require(_0x4ade('0x18'))['db'];var jayson=require(_0x4ade('0x19'));var client=jayson[_0x4ade('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x569fb6,_0x512ff8,_0xe870d1,_0x8fbc4e){return new BPromise(function(_0x102667,_0x2c13e2){var _0x3223f7=_0x8fbc4e||client;return _0x3223f7['request'](_0x569fb6,_0xe870d1)[_0x4ade('0x1b')](function(_0x4b05b8){logger[_0x4ade('0x1c')](_0x4ade('0x1d'),_0x512ff8,'request\x20sent');logger[_0x4ade('0x1e')](_0x4ade('0x1f'),_0x512ff8,'request\x20sent',JSON[_0x4ade('0x20')](_0x4b05b8));if(_0x4b05b8[_0x4ade('0x21')]){if(_0x4b05b8[_0x4ade('0x21')][_0x4ade('0x22')]===0x1f4){logger['error'](_0x4ade('0x1d'),_0x512ff8,_0x4b05b8['error']['message']);return _0x2c13e2(_0x4b05b8[_0x4ade('0x21')][_0x4ade('0x23')]);}logger[_0x4ade('0x21')](_0x4ade('0x1d'),_0x512ff8,_0x4b05b8[_0x4ade('0x21')][_0x4ade('0x23')]);return _0x102667(_0x4b05b8[_0x4ade('0x21')][_0x4ade('0x23')]);}else{logger['info']('Network,\x20%s,\x20%s',_0x512ff8,_0x4ade('0x24'));_0x102667(_0x4b05b8[_0x4ade('0x25')][_0x4ade('0x23')]);}})[_0x4ade('0x26')](function(_0x5dd97b){logger['error'](_0x4ade('0x1d'),_0x512ff8,_0x5dd97b);_0x2c13e2(_0x5dd97b);});});}function respondWithStatusCode(_0x4c857e,_0xd9c81f){_0xd9c81f=_0xd9c81f||0xcc;return function(_0x23f3e5){if(_0x23f3e5){return _0x4c857e[_0x4ade('0x27')](_0xd9c81f);}return _0x4c857e[_0x4ade('0x28')](_0xd9c81f)[_0x4ade('0x29')]();};}function respondWithResult(_0x4a34cd,_0x25aa37){_0x25aa37=_0x25aa37||0xc8;return function(_0x227ad3){if(_0x227ad3){return _0x4a34cd[_0x4ade('0x28')](_0x25aa37)[_0x4ade('0x2a')](_0x227ad3);}};}function respondWithFilteredResult(_0x4c53d3,_0x17656d){return function(_0x1c9957){if(_0x1c9957){var _0x297cf1=typeof _0x17656d['offset']===_0x4ade('0x2b')&&typeof _0x17656d['limit']===_0x4ade('0x2b');var _0x45a1ae=_0x1c9957['count'];var _0xd219ed=_0x297cf1?0x0:_0x17656d[_0x4ade('0x2c')];var _0x115cf1=_0x297cf1?_0x1c9957[_0x4ade('0x2d')]:_0x17656d[_0x4ade('0x2c')]+_0x17656d[_0x4ade('0x2e')];var _0x53aee6;if(_0x115cf1>=_0x45a1ae){_0x115cf1=_0x45a1ae;_0x53aee6=0xc8;}else{_0x53aee6=0xce;}_0x4c53d3[_0x4ade('0x28')](_0x53aee6);return _0x4c53d3['set'](_0x4ade('0x2f'),_0xd219ed+'-'+_0x115cf1+'/'+_0x45a1ae)[_0x4ade('0x2a')](_0x1c9957);}return null;};}function patchUpdates(_0xe7aad6){return function(_0x138277){try{jsonpatch[_0x4ade('0x30')](_0x138277,_0xe7aad6,!![]);}catch(_0x2ef2e0){return BPromise[_0x4ade('0x31')](_0x2ef2e0);}return _0x138277[_0x4ade('0x32')]();};}function saveUpdates(_0x23883a,_0x471a62){return function(_0x7d8040){if(_0x7d8040){return _0x7d8040[_0x4ade('0x33')](_0x23883a)[_0x4ade('0x1b')](function(_0x2fab01){return _0x2fab01;});}return null;};}function removeEntity(_0x1d30dd,_0x3cbbf6){return function(_0x244597){if(_0x244597){return _0x244597[_0x4ade('0x34')]()[_0x4ade('0x1b')](function(){_0x1d30dd[_0x4ade('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b6c92,_0x5b62d5){return function(_0x990724){if(!_0x990724){_0x2b6c92['sendStatus'](0x194);}return _0x990724;};}function handleError(_0x22e3f0,_0x832ef1){_0x832ef1=_0x832ef1||0x1f4;return function(_0x493d47){logger[_0x4ade('0x21')](_0x493d47[_0x4ade('0x35')]);if(_0x493d47[_0x4ade('0x36')]){delete _0x493d47['name'];}_0x22e3f0[_0x4ade('0x28')](_0x832ef1)['send'](_0x493d47);};}exports[_0x4ade('0x37')]=function(_0x51744c,_0x395389){var _0x288b96={},_0x600639={},_0x4259b7={'count':0x0,'rows':[]};var _0x451717=_[_0x4ade('0x38')](db['Network'][_0x4ade('0x39')],function(_0x310440){return{'name':_0x310440[_0x4ade('0x3a')],'type':_0x310440[_0x4ade('0x3b')]['key']};});_0x600639[_0x4ade('0x3c')]=_['map'](_0x451717,_0x4ade('0x36'));_0x600639[_0x4ade('0x3d')]=_[_0x4ade('0x3e')](_0x51744c['query']);_0x600639[_0x4ade('0x3f')]=_[_0x4ade('0x40')](_0x600639[_0x4ade('0x3c')],_0x600639[_0x4ade('0x3d')]);_0x288b96[_0x4ade('0x41')]=_[_0x4ade('0x40')](_0x600639[_0x4ade('0x3c')],qs[_0x4ade('0x42')](_0x51744c[_0x4ade('0x3d')][_0x4ade('0x42')]));_0x288b96['attributes']=_0x288b96[_0x4ade('0x41')][_0x4ade('0x43')]?_0x288b96['attributes']:_0x600639[_0x4ade('0x3c')];if(!_0x51744c['query'][_0x4ade('0x44')](_0x4ade('0x45'))){_0x288b96[_0x4ade('0x2e')]=qs[_0x4ade('0x2e')](_0x51744c[_0x4ade('0x3d')][_0x4ade('0x2e')]);_0x288b96[_0x4ade('0x2c')]=qs[_0x4ade('0x2c')](_0x51744c['query'][_0x4ade('0x2c')]);}_0x288b96['order']=qs[_0x4ade('0x46')](_0x51744c[_0x4ade('0x3d')][_0x4ade('0x46')]);_0x288b96[_0x4ade('0x47')]=qs[_0x4ade('0x3f')](_['pick'](_0x51744c[_0x4ade('0x3d')],_0x600639[_0x4ade('0x3f')]),_0x451717);if(_0x51744c['query'][_0x4ade('0x48')]){_0x288b96['where']=_[_0x4ade('0x49')](_0x288b96[_0x4ade('0x47')],{'$or':_[_0x4ade('0x38')](_0x451717,function(_0x317452){if(_0x317452['type']!==_0x4ade('0x4a')){var _0x2f07ec={};_0x2f07ec[_0x317452[_0x4ade('0x36')]]={'$like':'%'+_0x51744c[_0x4ade('0x3d')]['filter']+'%'};return _0x2f07ec;}})});}_0x288b96=_[_0x4ade('0x49')]({},_0x288b96,_0x51744c[_0x4ade('0x4b')]);var _0x751250={'where':_0x288b96['where']};return db[_0x4ade('0x4c')][_0x4ade('0x2d')](_0x751250)['then'](function(_0xcc5900){_0x4259b7[_0x4ade('0x2d')]=_0xcc5900;if(_0x51744c['query'][_0x4ade('0x4d')]){_0x288b96[_0x4ade('0x4e')]=[{'all':!![]}];}return db[_0x4ade('0x4c')]['findAll'](_0x288b96);})[_0x4ade('0x1b')](function(_0x7d4fbf){_0x4259b7[_0x4ade('0x4f')]=_0x7d4fbf;return _0x4259b7;})['then'](respondWithFilteredResult(_0x395389,_0x288b96))['catch'](handleError(_0x395389,null));};exports[_0x4ade('0x50')]=function(_0x2697e5,_0x2c5c0a){var _0x27d38d={'raw':!![],'where':{'id':_0x2697e5['params']['id']}},_0xa636b3={};_0xa636b3[_0x4ade('0x3c')]=_['keys'](db['Network'][_0x4ade('0x39')]);_0xa636b3[_0x4ade('0x3d')]=_[_0x4ade('0x3e')](_0x2697e5['query']);_0xa636b3[_0x4ade('0x3f')]=_[_0x4ade('0x40')](_0xa636b3['model'],_0xa636b3[_0x4ade('0x3d')]);_0x27d38d[_0x4ade('0x41')]=_[_0x4ade('0x40')](_0xa636b3[_0x4ade('0x3c')],qs[_0x4ade('0x42')](_0x2697e5[_0x4ade('0x3d')]['fields']));_0x27d38d['attributes']=_0x27d38d[_0x4ade('0x41')][_0x4ade('0x43')]?_0x27d38d['attributes']:_0xa636b3[_0x4ade('0x3c')];if(_0x2697e5[_0x4ade('0x3d')][_0x4ade('0x4d')]){_0x27d38d['include']=[{'all':!![]}];}_0x27d38d=_[_0x4ade('0x49')]({},_0x27d38d,_0x2697e5['options']);return db[_0x4ade('0x4c')]['find'](_0x27d38d)[_0x4ade('0x1b')](handleEntityNotFound(_0x2c5c0a,null))[_0x4ade('0x1b')](respondWithResult(_0x2c5c0a,null))[_0x4ade('0x26')](handleError(_0x2c5c0a,null));};exports[_0x4ade('0x51')]=function(_0x4ed899,_0x363981,_0x24598b){var _0x4d0aa8;return db['sequelize'][_0x4ade('0x52')](function(_0x42b1e9){return db['Network'][_0x4ade('0x51')](_0x4ed899['body'],{'raw':!![]})[_0x4ade('0x1b')](function(_0x426d9c){_0x4d0aa8=_0x426d9c;return db['Network'][_0x4ade('0x53')]({'where':{'type':_0x4ed899['body'][_0x4ade('0x3b')]},'raw':!![]});})[_0x4ade('0x1b')](function(_0x2bc719){if(_0x4d0aa8[_0x4ade('0x3b')][_0x4ade('0x54')]()==_0x4ade('0x55')){var _0x2d6759=fs['readFileSync'](path[_0x4ade('0x56')](config['root'],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x270641=ejs[_0x4ade('0x57')](_0x2d6759,{'networks':_0x2bc719||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x270641);return respondWithRpcPromise(_0x4ade('0x58'),_0x4ade('0x51'),{'module':_0x4ade('0x59')});}else if(_0x4d0aa8[_0x4ade('0x3b')][_0x4ade('0x54')]()==_0x4ade('0x5a')){var _0x2fc257=fs[_0x4ade('0x5b')](path['join'](config[_0x4ade('0x5c')],_0x4ade('0x5d')),_0x4ade('0x5e'));var _0x2f52f5=ejs[_0x4ade('0x57')](_0x2fc257,{'networks':_0x2bc719||[]});fs[_0x4ade('0x5f')](_0x4ade('0x60'),_0x2f52f5);return respondWithRpcPromise(_0x4ade('0x58'),_0x4ade('0x51'),{'module':_0x4ade('0x59')});}else{var _0x305cf5=fs[_0x4ade('0x5b')](path[_0x4ade('0x56')](config[_0x4ade('0x5c')],_0x4ade('0x61')),_0x4ade('0x5e'));var _0x5890b8=ejs[_0x4ade('0x57')](_0x305cf5,{'networks':_0x2bc719||[]});fs[_0x4ade('0x5f')](util['format'](_0x4ade('0x62'),_0x4ed899[_0x4ade('0x63')][_0x4ade('0x3b')][_0x4ade('0x64')]()),_0x5890b8);return respondWithRpcPromise(_0x4ade('0x58'),_0x4ade('0x51'),{'module':_0x4ade('0x65')});}return null;})[_0x4ade('0x1b')](function(){return _0x4d0aa8;});})[_0x4ade('0x1b')](respondWithResult(_0x363981,0xc9))[_0x4ade('0x26')](handleError(_0x363981,null));};exports[_0x4ade('0x33')]=function(_0x21c5e5,_0x442dd8,_0x2c81d4){var _0x29d4b3;return db[_0x4ade('0x66')][_0x4ade('0x52')](function(_0x1ff8f3){return db[_0x4ade('0x4c')][_0x4ade('0x67')]({'where':{'id':_0x21c5e5[_0x4ade('0x68')]['id']}})[_0x4ade('0x1b')](handleEntityNotFound(_0x442dd8,null))[_0x4ade('0x1b')](saveUpdates(_0x21c5e5[_0x4ade('0x63')],null))[_0x4ade('0x1b')](function(_0x2160d8){if(_0x2160d8){_0x29d4b3=_0x2160d8;return db[_0x4ade('0x4c')][_0x4ade('0x53')]({'where':{'type':_0x29d4b3['type']},'raw':!![]});}return null;})['then'](function(_0x379e82){if(_0x29d4b3[_0x4ade('0x3b')]['toUpperCase']()==_0x4ade('0x55')){var _0x588683=fs['readFileSync'](path['join'](config[_0x4ade('0x5c')],_0x4ade('0x69')),_0x4ade('0x5e'));var _0x2f78f5=ejs[_0x4ade('0x57')](_0x588683,{'networks':_0x379e82||[]});fs['writeFileSync'](_0x4ade('0x6a'),_0x2f78f5);return respondWithRpcPromise(_0x4ade('0x58'),_0x4ade('0x33'),{'module':_0x4ade('0x59')});}else if(_0x29d4b3['type'][_0x4ade('0x54')]()==_0x4ade('0x5a')){var _0x243822=fs[_0x4ade('0x5b')](path[_0x4ade('0x56')](config['root'],_0x4ade('0x5d')),_0x4ade('0x5e'));var _0x1e3cb4=ejs[_0x4ade('0x57')](_0x243822,{'networks':_0x379e82||[]});fs[_0x4ade('0x5f')](_0x4ade('0x60'),_0x1e3cb4);return respondWithRpcPromise(_0x4ade('0x58'),_0x4ade('0x33'),{'module':'res_stun_monitor.so'});}else{var _0xcb38f2=fs['readFileSync'](path[_0x4ade('0x56')](config[_0x4ade('0x5c')],_0x4ade('0x61')),_0x4ade('0x5e'));var _0xb5e9e5=ejs[_0x4ade('0x57')](_0xcb38f2,{'networks':_0x379e82||[]});fs['writeFileSync'](util[_0x4ade('0x6b')](_0x4ade('0x62'),_0x21c5e5['body']['type'][_0x4ade('0x64')]()),_0xb5e9e5);return respondWithRpcPromise(_0x4ade('0x58'),_0x4ade('0x33'),{'module':_0x4ade('0x65')});}return null;})[_0x4ade('0x1b')](function(_0x5a56d5){if(_0x5a56d5){return _0x29d4b3;}return null;});})[_0x4ade('0x1b')](respondWithResult(_0x442dd8,null))['catch'](handleError(_0x442dd8,null));};exports[_0x4ade('0x34')]=function(_0x1e901e,_0x24e66b,_0x15babd){var _0x106ab1;return db[_0x4ade('0x4c')][_0x4ade('0x67')]({'where':{'id':_0x1e901e['params']['id']}})[_0x4ade('0x1b')](function(_0x421865){_0x106ab1=_0x421865;return _0x421865;})[_0x4ade('0x1b')](handleEntityNotFound(_0x24e66b,null))['then'](removeEntity(_0x24e66b,null))[_0x4ade('0x1b')](function(){if(_0x106ab1){return db[_0x4ade('0x4c')][_0x4ade('0x53')]({'where':{'type':_0x106ab1[_0x4ade('0x3b')]},'raw':!![]});}})[_0x4ade('0x1b')](function(_0x1a6463){if(_0x106ab1['type']['toUpperCase']()==_0x4ade('0x55')){var _0x4d9b43=fs[_0x4ade('0x5b')](path[_0x4ade('0x56')](config[_0x4ade('0x5c')],_0x4ade('0x69')),_0x4ade('0x5e'));var _0x462eaf=ejs[_0x4ade('0x57')](_0x4d9b43,{'networks':_0x1a6463||[]});fs[_0x4ade('0x5f')](_0x4ade('0x6a'),_0x462eaf);return respondWithRpcPromise(_0x4ade('0x58'),'destroy',{'module':'res_stun_monitor.so'});}else if(_0x106ab1[_0x4ade('0x3b')]['toUpperCase']()==_0x4ade('0x5a')){var _0x3d0a2b=fs['readFileSync'](path[_0x4ade('0x56')](config[_0x4ade('0x5c')],'server/files/templates/turn_multiple.ejs'),_0x4ade('0x5e'));var _0x60c79d=ejs['render'](_0x3d0a2b,{'networks':_0x1a6463||[]});fs[_0x4ade('0x5f')]('/etc/asterisk/turn_xcally.conf',_0x60c79d);return respondWithRpcPromise(_0x4ade('0x58'),_0x4ade('0x34'),{'module':_0x4ade('0x59')});}else{var _0x3c84a5=fs['readFileSync'](path[_0x4ade('0x56')](config[_0x4ade('0x5c')],'server/files/templates/network.ejs'),'utf8');var _0x2954ba=ejs['render'](_0x3c84a5,{'networks':_0x1a6463||[]});fs[_0x4ade('0x5f')](util[_0x4ade('0x6b')](_0x4ade('0x62'),_0x1e901e[_0x4ade('0x63')][_0x4ade('0x3b')][_0x4ade('0x64')]()),_0x2954ba);return respondWithRpcPromise('Reload',_0x4ade('0x34'),{'module':_0x4ade('0x65')});}return null;})[_0x4ade('0x26')](handleError(_0x24e66b,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 1bf97c7..c7327ec 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 _0xe644=['path','rimraf','../../config/environment','./network.attributes','exports','define','Network','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x108b16,_0x40d753){var _0x4958e6=function(_0x11bb08){while(--_0x11bb08){_0x108b16['push'](_0x108b16['shift']());}};_0x4958e6(++_0x40d753);}(_0xe644,0x159));var _0x4e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe644[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4e64('0x0'));var util=require(_0x4e64('0x1'));var logger=require(_0x4e64('0x2'))(_0x4e64('0x3'));var moment=require(_0x4e64('0x4'));var BPromise=require(_0x4e64('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e64('0x6'));var rimraf=require(_0x4e64('0x7'));var config=require(_0x4e64('0x8'));var attributes=require(_0x4e64('0x9'));module[_0x4e64('0xa')]=function(_0x13fa90,_0x55c23b){return _0x13fa90[_0x4e64('0xb')](_0x4e64('0xc'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6599=['bluebird','path','../../config/environment','exports','network','util','../../config/logger','api','moment'];(function(_0x3d37ec,_0x1754de){var _0x3d899d=function(_0x412876){while(--_0x412876){_0x3d37ec['push'](_0x3d37ec['shift']());}};_0x3d899d(++_0x1754de);}(_0x6599,0xb0));var _0x9659=function(_0x5e2751,_0x518a55){_0x5e2751=_0x5e2751-0x0;var _0x139a39=_0x6599[_0x5e2751];return _0x139a39;};'use strict';var _=require('lodash');var util=require(_0x9659('0x0'));var logger=require(_0x9659('0x1'))(_0x9659('0x2'));var moment=require(_0x9659('0x3'));var BPromise=require(_0x9659('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9659('0x5'));var rimraf=require('rimraf');var config=require(_0x9659('0x6'));var attributes=require('./network.attributes');module[_0x9659('0x7')]=function(_0xb08ede,_0x159ac2){return _0xb08ede['define']('Network',attributes,{'tableName':_0x9659('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 2efe06c..1b8370a 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3c0a28,_0xb0de5b){var _0x5aab47=function(_0x41783f){while(--_0x41783f){_0x3c0a28['push'](_0x3c0a28['shift']());}};_0x5aab47(++_0xb0de5b);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xdecd09,_0x3213f8){var _0x19fce3=function(_0x27bf32){while(--_0x27bf32){_0xdecd09['push'](_0xdecd09['shift']());}};_0x19fce3(++_0x3213f8);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index f9dfa7c..ddaedcc 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 _0xe1a1=['getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','notify','addApplications','/:id/users','addAgents','send','/:id','update','delete','removeAgents','exports','multer','express','Router','fs-extra','../../components/auth/service','./openchannelAccount.controller','get','index','isAuthenticated'];(function(_0x5f1f29,_0x43efe9){var _0x325b70=function(_0x36105a){while(--_0x36105a){_0x5f1f29['push'](_0x5f1f29['shift']());}};_0x325b70(++_0x43efe9);}(_0xe1a1,0x1b7));var _0x1e1a=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xe1a1[_0x2c7618];return _0x5ce3f0;};'use strict';var multer=require(_0x1e1a('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1e1a('0x1'));var router=express[_0x1e1a('0x2')]();var fs_extra=require(_0x1e1a('0x3'));var auth=require(_0x1e1a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1e1a('0x5'));router[_0x1e1a('0x6')]('/',auth['isAuthenticated'](),controller[_0x1e1a('0x7')]);router[_0x1e1a('0x6')]('/describe',auth[_0x1e1a('0x8')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x1e1a('0x6')]('/:id/dispositions',auth[_0x1e1a('0x8')](),controller[_0x1e1a('0x9')]);router[_0x1e1a('0x6')](_0x1e1a('0xa'),auth['isAuthenticated'](),controller[_0x1e1a('0xb')]);router['get'](_0x1e1a('0xc'),auth[_0x1e1a('0x8')](),controller[_0x1e1a('0xd')]);router['get'](_0x1e1a('0xe'),auth['isAuthenticated'](),controller[_0x1e1a('0xf')]);router[_0x1e1a('0x6')]('/:id/users',auth[_0x1e1a('0x8')](),controller[_0x1e1a('0x10')]);router[_0x1e1a('0x11')]('/',auth['isAuthenticated'](),controller[_0x1e1a('0x12')]);router['post'](_0x1e1a('0x13'),auth['isAuthenticated'](),controller[_0x1e1a('0x14')]);router[_0x1e1a('0x11')](_0x1e1a('0xa'),auth['isAuthenticated'](),controller[_0x1e1a('0x15')]);router[_0x1e1a('0x11')]('/:id/notify',controller[_0x1e1a('0x16')]);router[_0x1e1a('0x11')](_0x1e1a('0xc'),auth[_0x1e1a('0x8')](),controller[_0x1e1a('0x17')]);router[_0x1e1a('0x11')](_0x1e1a('0x18'),auth['isAuthenticated'](),controller[_0x1e1a('0x19')]);router[_0x1e1a('0x11')]('/:id/send',auth[_0x1e1a('0x8')](),controller[_0x1e1a('0x1a')]);router['put'](_0x1e1a('0x1b'),auth[_0x1e1a('0x8')](),controller[_0x1e1a('0x1c')]);router['delete'](_0x1e1a('0x1b'),auth[_0x1e1a('0x8')](),controller['destroy']);router[_0x1e1a('0x1d')](_0x1e1a('0x13'),auth[_0x1e1a('0x8')](),controller['removeDispositions']);router[_0x1e1a('0x1d')](_0x1e1a('0xa'),auth[_0x1e1a('0x8')](),controller['removeAnswers']);router[_0x1e1a('0x1d')](_0x1e1a('0x18'),auth[_0x1e1a('0x8')](),controller[_0x1e1a('0x1e')]);module[_0x1e1a('0x1f')]=router; \ No newline at end of file +var _0xf0c8=['/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','/:id/notify','notify','addApplications','put','destroy','removeAnswers','delete','removeAgents','exports','util','path','connect-timeout','express','fs-extra','../../config/environment','./openchannelAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions'];(function(_0x46451c,_0x88ddd){var _0x12dce4=function(_0x2e4087){while(--_0x2e4087){_0x46451c['push'](_0x46451c['shift']());}};_0x12dce4(++_0x88ddd);}(_0xf0c8,0x1b4));var _0x8f0c=function(_0xa03344,_0x581292){_0xa03344=_0xa03344-0x0;var _0x38acfd=_0xf0c8[_0xa03344];return _0x38acfd;};'use strict';var multer=require('multer');var util=require(_0x8f0c('0x0'));var path=require(_0x8f0c('0x1'));var timeout=require(_0x8f0c('0x2'));var express=require(_0x8f0c('0x3'));var router=express['Router']();var fs_extra=require(_0x8f0c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8f0c('0x5'));var controller=require(_0x8f0c('0x6'));router[_0x8f0c('0x7')]('/',auth['isAuthenticated'](),controller[_0x8f0c('0x8')]);router[_0x8f0c('0x7')](_0x8f0c('0x9'),auth[_0x8f0c('0xa')](),controller[_0x8f0c('0xb')]);router['get'](_0x8f0c('0xc'),auth[_0x8f0c('0xa')](),controller[_0x8f0c('0xd')]);router['get']('/:id/dispositions',auth[_0x8f0c('0xa')](),controller[_0x8f0c('0xe')]);router[_0x8f0c('0x7')](_0x8f0c('0xf'),auth[_0x8f0c('0xa')](),controller['getAnswers']);router[_0x8f0c('0x7')](_0x8f0c('0x10'),auth[_0x8f0c('0xa')](),controller[_0x8f0c('0x11')]);router[_0x8f0c('0x7')](_0x8f0c('0x12'),auth[_0x8f0c('0xa')](),controller['getInteractions']);router[_0x8f0c('0x7')](_0x8f0c('0x13'),auth[_0x8f0c('0xa')](),controller[_0x8f0c('0x14')]);router[_0x8f0c('0x15')]('/',auth[_0x8f0c('0xa')](),controller[_0x8f0c('0x16')]);router[_0x8f0c('0x15')](_0x8f0c('0x17'),auth[_0x8f0c('0xa')](),controller[_0x8f0c('0x18')]);router['post'](_0x8f0c('0xf'),auth['isAuthenticated'](),controller[_0x8f0c('0x19')]);router[_0x8f0c('0x15')](_0x8f0c('0x1a'),controller[_0x8f0c('0x1b')]);router[_0x8f0c('0x15')](_0x8f0c('0x10'),auth[_0x8f0c('0xa')](),controller[_0x8f0c('0x1c')]);router['post'](_0x8f0c('0x13'),auth[_0x8f0c('0xa')](),controller['addAgents']);router[_0x8f0c('0x15')]('/:id/send',auth['isAuthenticated'](),controller['send']);router[_0x8f0c('0x1d')](_0x8f0c('0xc'),auth[_0x8f0c('0xa')](),controller['update']);router['delete'](_0x8f0c('0xc'),auth[_0x8f0c('0xa')](),controller[_0x8f0c('0x1e')]);router['delete']('/:id/dispositions',auth[_0x8f0c('0xa')](),controller['removeDispositions']);router['delete'](_0x8f0c('0xf'),auth['isAuthenticated'](),controller[_0x8f0c('0x1f')]);router[_0x8f0c('0x20')](_0x8f0c('0x13'),auth[_0x8f0c('0xa')](),controller[_0x8f0c('0x21')]);module[_0x8f0c('0x22')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 2d17c50..ebe551f 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 _0x34ad=['INTEGER','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','name','generate','STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x21c6b2,_0x397bf0){var _0x4ea468=function(_0xb8814e){while(--_0xb8814e){_0x21c6b2['push'](_0x21c6b2['shift']());}};_0x4ea468(++_0x397bf0);}(_0x34ad,0x1a7));var _0xd34a=function(_0x147c96,_0x309657){_0x147c96=_0x147c96-0x0;var _0x4ec711=_0x34ad[_0x147c96];return _0x4ec711;};'use strict';var Sequelize=require(_0xd34a('0x0'));var rs=require(_0xd34a('0x1'));module[_0xd34a('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xd34a('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xd34a('0x4')]();}},'replyUri':{'type':Sequelize[_0xd34a('0x5')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xd34a('0x5')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xd34a('0x6')],'defaultValue':function(){return _0xd34a('0x7');}},'notificationSound':{'type':Sequelize[_0xd34a('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd34a('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd34a('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xd34a('0x5')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd34a('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd34a('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd34a('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xd34a('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x428b42){if(!_0x428b42)this[_0xd34a('0xa')](_0xd34a('0xb'),null);this[_0xd34a('0xa')]('mandatoryDisposition',_0x428b42);}}}; \ No newline at end of file +var _0xffa8=['name','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','mandatoryDisposition','STRING'];(function(_0x34b9dd,_0x19aa29){var _0x2b454d=function(_0x5116c2){while(--_0x5116c2){_0x34b9dd['push'](_0x34b9dd['shift']());}};_0x2b454d(++_0x19aa29);}(_0xffa8,0xef));var _0x8ffa=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xffa8[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x8ffa('0x0')],'unique':_0x8ffa('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x8ffa('0x0')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x8ffa('0x2')]();}},'replyUri':{'type':Sequelize[_0x8ffa('0x0')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x8ffa('0x0')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x8ffa('0x3')],'defaultValue':function(){return _0x8ffa('0x4');}},'notificationSound':{'type':Sequelize[_0x8ffa('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8ffa('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8ffa('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x8ffa('0x0')]},'queueTransfer':{'type':Sequelize[_0x8ffa('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8ffa('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8ffa('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8ffa('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x8ffa('0x5')],'defaultValue':![],'comment':_0x8ffa('0x7'),'set':function(_0x150251){if(!_0x150251)this[_0x8ffa('0x8')]('mandatoryDispositionPauseId',null);this[_0x8ffa('0x8')](_0x8ffa('0x9'),_0x150251);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 11d3d54..a72e1bd 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 _0xd8f0=['result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','name','send','index','Pause','OpenchannelAccount','type','key','model','map','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','findAll','rows','show','params','mandatoryDispositionPause','keys','includeAll','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','rawAttributes','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','account','applications','list','orderBy','priority','asc','Applications','mapKey','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','transaction','bulkCreate','findAndCountAll','getApplications','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','http','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x3da12c,_0x477951){var _0xd10648=function(_0x227e67){while(--_0x227e67){_0x3da12c['push'](_0x3da12c['shift']());}};_0xd10648(++_0x477951);}(_0xd8f0,0x14e));var _0x0d8f=function(_0x10e2c9,_0x489aab){_0x10e2c9=_0x10e2c9-0x0;var _0x426947=_0xd8f0[_0x10e2c9];return _0x426947;};'use strict';var emlformat=require(_0x0d8f('0x0'));var rimraf=require(_0x0d8f('0x1'));var zipdir=require(_0x0d8f('0x2'));var jsonpatch=require(_0x0d8f('0x3'));var rp=require(_0x0d8f('0x4'));var moment=require(_0x0d8f('0x5'));var BPromise=require(_0x0d8f('0x6'));var Mustache=require(_0x0d8f('0x7'));var util=require(_0x0d8f('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8f('0x9'));var fs=require('fs');var fs_extra=require(_0x0d8f('0xa'));var _=require(_0x0d8f('0xb'));var squel=require(_0x0d8f('0xc'));var crypto=require(_0x0d8f('0xd'));var jsforce=require(_0x0d8f('0xe'));var deskjs=require(_0x0d8f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0d8f('0x10'));var Papa=require(_0x0d8f('0x11'));var Redis=require(_0x0d8f('0x12'));var authService=require(_0x0d8f('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d8f('0x14'));var logger=require(_0x0d8f('0x15'))(_0x0d8f('0x16'));var utils=require(_0x0d8f('0x17'));var config=require(_0x0d8f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0d8f('0x19'))['db'];config[_0x0d8f('0x1a')]=_[_0x0d8f('0x1b')](config['redis'],{'host':_0x0d8f('0x1c'),'port':0x18eb});var socket=require(_0x0d8f('0x1d'))(new Redis(config['redis']));require(_0x0d8f('0x1e'))['register'](socket);var jayson=require(_0x0d8f('0x1f'));var client=jayson['client'][_0x0d8f('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x0d8f('0x20')]({'port':0x232a});function respondWithRpcPromise(_0xa46e31,_0x4dbee1,_0x563152,_0x21eaf4){return new BPromise(function(_0x6b9b22,_0x43300a){var _0x17f84b=_0x21eaf4||client;return _0x17f84b[_0x0d8f('0x21')](_0xa46e31,_0x563152)[_0x0d8f('0x22')](function(_0x41bd84){logger['info'](_0x0d8f('0x23'),_0x4dbee1,_0x0d8f('0x24'));logger['debug'](_0x0d8f('0x25'),_0x4dbee1,'request\x20sent',JSON[_0x0d8f('0x26')](_0x41bd84));if(_0x41bd84['error']){if(_0x41bd84[_0x0d8f('0x27')]['code']===0x1f4){logger[_0x0d8f('0x27')]('OpenchannelAccount,\x20%s,\x20%s',_0x4dbee1,_0x41bd84[_0x0d8f('0x27')][_0x0d8f('0x28')]);return _0x43300a(_0x41bd84[_0x0d8f('0x27')][_0x0d8f('0x28')]);}logger['error'](_0x0d8f('0x23'),_0x4dbee1,_0x41bd84[_0x0d8f('0x27')][_0x0d8f('0x28')]);return _0x6b9b22(_0x41bd84[_0x0d8f('0x27')][_0x0d8f('0x28')]);}else{logger[_0x0d8f('0x29')](_0x0d8f('0x23'),_0x4dbee1,_0x0d8f('0x24'));_0x6b9b22(_0x41bd84[_0x0d8f('0x2a')][_0x0d8f('0x28')]);}})[_0x0d8f('0x2b')](function(_0x19206c){logger[_0x0d8f('0x27')]('OpenchannelAccount,\x20%s,\x20%s',_0x4dbee1,_0x19206c);_0x43300a(_0x19206c);});});}function respondWithStatusCode(_0xdfed3d,_0x10d0ea){_0x10d0ea=_0x10d0ea||0xcc;return function(_0x401c3e){if(_0x401c3e){return _0xdfed3d[_0x0d8f('0x2c')](_0x10d0ea);}return _0xdfed3d[_0x0d8f('0x2d')](_0x10d0ea)[_0x0d8f('0x2e')]();};}function respondWithResult(_0x332b58,_0x6478b){_0x6478b=_0x6478b||0xc8;return function(_0x248f91){if(_0x248f91){return _0x332b58['status'](_0x6478b)[_0x0d8f('0x2f')](_0x248f91);}};}function respondWithFilteredResult(_0x213a01,_0x122bc5){return function(_0x22f484){if(_0x22f484){var _0x1c21e4=typeof _0x122bc5[_0x0d8f('0x30')]===_0x0d8f('0x31')&&typeof _0x122bc5[_0x0d8f('0x32')]===_0x0d8f('0x31');var _0x26ad43=_0x22f484['count'];var _0xa294b=_0x1c21e4?0x0:_0x122bc5['offset'];var _0x225219=_0x1c21e4?_0x22f484[_0x0d8f('0x33')]:_0x122bc5['offset']+_0x122bc5[_0x0d8f('0x32')];var _0x547bf8;if(_0x225219>=_0x26ad43){_0x225219=_0x26ad43;_0x547bf8=0xc8;}else{_0x547bf8=0xce;}_0x213a01[_0x0d8f('0x2d')](_0x547bf8);return _0x213a01[_0x0d8f('0x34')](_0x0d8f('0x35'),_0xa294b+'-'+_0x225219+'/'+_0x26ad43)[_0x0d8f('0x2f')](_0x22f484);}return null;};}function patchUpdates(_0x4fc0cc){return function(_0x618d20){try{jsonpatch[_0x0d8f('0x36')](_0x618d20,_0x4fc0cc,!![]);}catch(_0x2b43fe){return BPromise[_0x0d8f('0x37')](_0x2b43fe);}return _0x618d20[_0x0d8f('0x38')]();};}function saveUpdates(_0x418fcb,_0x37e109){return function(_0x54c3aa){if(_0x54c3aa){return _0x54c3aa[_0x0d8f('0x39')](_0x418fcb)['then'](function(_0x1f6f60){return _0x1f6f60;});}return null;};}function removeEntity(_0x15609b,_0x2a9bc4){return function(_0x290a3b){if(_0x290a3b){return _0x290a3b[_0x0d8f('0x3a')]()[_0x0d8f('0x22')](function(){var _0x5156a7=_0x290a3b[_0x0d8f('0x3b')]({'plain':!![]});var _0xf08031=_0x0d8f('0x3c');return db[_0x0d8f('0x3d')][_0x0d8f('0x3a')]({'where':{'type':_0xf08031,'resourceId':_0x5156a7['id']}})[_0x0d8f('0x22')](function(){return _0x290a3b;});})[_0x0d8f('0x22')](function(){_0x15609b[_0x0d8f('0x2d')](0xcc)[_0x0d8f('0x2e')]();});}};}function handleEntityNotFound(_0x49b609,_0x28038b){return function(_0x1f03c0){if(!_0x1f03c0){_0x49b609[_0x0d8f('0x2c')](0x194);}return _0x1f03c0;};}function handleError(_0x3dd106,_0x3becb5){_0x3becb5=_0x3becb5||0x1f4;return function(_0x5703fa){logger[_0x0d8f('0x27')](_0x5703fa['stack']);if(_0x5703fa[_0x0d8f('0x3e')]){delete _0x5703fa[_0x0d8f('0x3e')];}_0x3dd106[_0x0d8f('0x2d')](_0x3becb5)[_0x0d8f('0x3f')](_0x5703fa);};}exports[_0x0d8f('0x40')]=function(_0x2414e9,_0x538fe8){var _0x4a7258={'include':[{'model':db[_0x0d8f('0x41')],'as':'mandatoryDispositionPause'}]},_0x29da6c={},_0x279d12={'count':0x0,'rows':[]};var _0x454441=_['map'](db[_0x0d8f('0x42')]['rawAttributes'],function(_0x4b565e){return{'name':_0x4b565e['fieldName'],'type':_0x4b565e[_0x0d8f('0x43')][_0x0d8f('0x44')]};});_0x29da6c[_0x0d8f('0x45')]=_[_0x0d8f('0x46')](_0x454441,_0x0d8f('0x3e'));_0x29da6c['query']=_['keys'](_0x2414e9['query']);_0x29da6c['filters']=_[_0x0d8f('0x47')](_0x29da6c[_0x0d8f('0x45')],_0x29da6c[_0x0d8f('0x48')]);_0x4a7258['attributes']=_['intersection'](_0x29da6c[_0x0d8f('0x45')],qs[_0x0d8f('0x49')](_0x2414e9[_0x0d8f('0x48')]['fields']));_0x4a7258['attributes']=_0x4a7258[_0x0d8f('0x4a')][_0x0d8f('0x4b')]?_0x4a7258['attributes']:_0x29da6c[_0x0d8f('0x45')];if(!_0x2414e9[_0x0d8f('0x48')][_0x0d8f('0x4c')](_0x0d8f('0x4d'))){_0x4a7258[_0x0d8f('0x32')]=qs[_0x0d8f('0x32')](_0x2414e9[_0x0d8f('0x48')][_0x0d8f('0x32')]);_0x4a7258[_0x0d8f('0x30')]=qs[_0x0d8f('0x30')](_0x2414e9['query'][_0x0d8f('0x30')]);}_0x4a7258[_0x0d8f('0x4e')]=qs[_0x0d8f('0x4f')](_0x2414e9[_0x0d8f('0x48')][_0x0d8f('0x4f')]);_0x4a7258[_0x0d8f('0x50')]=qs[_0x0d8f('0x51')](_['pick'](_0x2414e9[_0x0d8f('0x48')],_0x29da6c[_0x0d8f('0x51')]),_0x454441);if(_0x2414e9[_0x0d8f('0x48')][_0x0d8f('0x52')]){_0x4a7258[_0x0d8f('0x50')]=_[_0x0d8f('0x53')](_0x4a7258[_0x0d8f('0x50')],{'$or':_['map'](_0x454441,function(_0x3e4b00){if(_0x3e4b00['type']!==_0x0d8f('0x54')){var _0x16acb3={};_0x16acb3[_0x3e4b00['name']]={'$like':'%'+_0x2414e9[_0x0d8f('0x48')][_0x0d8f('0x52')]+'%'};return _0x16acb3;}})});}_0x4a7258=_['merge']({},_0x4a7258,_0x2414e9['options']);var _0x92e4e0={'where':_0x4a7258['where']};return db[_0x0d8f('0x42')][_0x0d8f('0x33')](_0x92e4e0)['then'](function(_0x1c218d){_0x279d12[_0x0d8f('0x33')]=_0x1c218d;if(_0x2414e9['query']['includeAll']){_0x4a7258['include']=[{'all':!![]}];}return db['OpenchannelAccount'][_0x0d8f('0x55')](_0x4a7258);})[_0x0d8f('0x22')](function(_0x2d7be1){_0x279d12[_0x0d8f('0x56')]=_0x2d7be1;return _0x279d12;})['then'](respondWithFilteredResult(_0x538fe8,_0x4a7258))['catch'](handleError(_0x538fe8,null));};exports[_0x0d8f('0x57')]=function(_0x4fa8d7,_0x238e4e){var _0x210cfd={'raw':![],'where':{'id':_0x4fa8d7[_0x0d8f('0x58')]['id']},'include':[{'model':db[_0x0d8f('0x41')],'as':_0x0d8f('0x59')}]},_0x1c776e={};_0x1c776e['model']=_[_0x0d8f('0x5a')](db[_0x0d8f('0x42')]['rawAttributes']);_0x1c776e[_0x0d8f('0x48')]=_[_0x0d8f('0x5a')](_0x4fa8d7[_0x0d8f('0x48')]);_0x1c776e['filters']=_[_0x0d8f('0x47')](_0x1c776e[_0x0d8f('0x45')],_0x1c776e[_0x0d8f('0x48')]);_0x210cfd['attributes']=_['intersection'](_0x1c776e['model'],qs[_0x0d8f('0x49')](_0x4fa8d7['query'][_0x0d8f('0x49')]));_0x210cfd[_0x0d8f('0x4a')]=_0x210cfd[_0x0d8f('0x4a')][_0x0d8f('0x4b')]?_0x210cfd[_0x0d8f('0x4a')]:_0x1c776e[_0x0d8f('0x45')];if(_0x4fa8d7[_0x0d8f('0x48')][_0x0d8f('0x5b')]){_0x210cfd[_0x0d8f('0x5c')]=[{'all':!![]}];}_0x210cfd=_[_0x0d8f('0x53')]({},_0x210cfd,_0x4fa8d7[_0x0d8f('0x5d')]);return db[_0x0d8f('0x42')][_0x0d8f('0x5e')](_0x210cfd)[_0x0d8f('0x22')](handleEntityNotFound(_0x238e4e,null))[_0x0d8f('0x22')](respondWithResult(_0x238e4e,null))[_0x0d8f('0x2b')](handleError(_0x238e4e,null));};exports[_0x0d8f('0x5f')]=function(_0x3e8e0e,_0x33c49d){return db['OpenchannelAccount'][_0x0d8f('0x5f')](_0x3e8e0e[_0x0d8f('0x60')],{})['then'](function(_0x5133bc){var _0x36c496=_0x3e8e0e[_0x0d8f('0x61')]['get']({'plain':!![]});if(!_0x36c496)throw new Error(_0x0d8f('0x62'));if(_0x36c496['role']==='user'){var _0x18c377=_0x5133bc['get']({'plain':!![]});var _0x1ce7dd=_0x0d8f('0x3c');return db[_0x0d8f('0x63')][_0x0d8f('0x5e')]({'where':{'name':_0x1ce7dd,'userProfileId':_0x36c496['userProfileId']},'raw':!![]})[_0x0d8f('0x22')](function(_0x7b8844){if(_0x7b8844&&_0x7b8844[_0x0d8f('0x64')]===0x0){return db['UserProfileResource']['create']({'name':_0x18c377[_0x0d8f('0x3e')],'resourceId':_0x18c377['id'],'type':_0x7b8844['name'],'sectionId':_0x7b8844['id']},{})['then'](function(){return _0x5133bc;});}else{return _0x5133bc;}})['catch'](function(_0x5df457){logger[_0x0d8f('0x27')](_0x0d8f('0x65'),_0x5df457);throw _0x5df457;});}return _0x5133bc;})[_0x0d8f('0x22')](respondWithResult(_0x33c49d,0xc9))[_0x0d8f('0x2b')](handleError(_0x33c49d,null));};exports[_0x0d8f('0x39')]=function(_0x3cac6e,_0x5e7055){if(_0x3cac6e[_0x0d8f('0x60')]['id']){delete _0x3cac6e[_0x0d8f('0x60')]['id'];}return db['OpenchannelAccount'][_0x0d8f('0x5e')]({'where':{'id':_0x3cac6e['params']['id']},'include':[{'model':db[_0x0d8f('0x41')],'as':_0x0d8f('0x59')}]})[_0x0d8f('0x22')](handleEntityNotFound(_0x5e7055,null))['then'](saveUpdates(_0x3cac6e[_0x0d8f('0x60')],null))[_0x0d8f('0x22')](respondWithResult(_0x5e7055,null))[_0x0d8f('0x2b')](handleError(_0x5e7055,null));};exports[_0x0d8f('0x3a')]=function(_0x3a14bb,_0xb7b59c){return db[_0x0d8f('0x42')][_0x0d8f('0x5e')]({'where':{'id':_0x3a14bb[_0x0d8f('0x58')]['id']}})[_0x0d8f('0x22')](handleEntityNotFound(_0xb7b59c,null))[_0x0d8f('0x22')](removeEntity(_0xb7b59c,null))[_0x0d8f('0x2b')](handleError(_0xb7b59c,null));};exports['describe']=function(_0x5d6370,_0x2dace2){return db['OpenchannelAccount'][_0x0d8f('0x66')]()[_0x0d8f('0x22')](respondWithResult(_0x2dace2,null))[_0x0d8f('0x2b')](handleError(_0x2dace2,null));};exports['addDisposition']=function(_0x334d0b,_0x535dd9,_0x16fc97){if(_0x334d0b['body']['id']){delete _0x334d0b['body']['id'];}return db[_0x0d8f('0x42')][_0x0d8f('0x5e')]({'where':{'id':_0x334d0b[_0x0d8f('0x58')]['id']}})[_0x0d8f('0x22')](handleEntityNotFound(_0x535dd9,null))['then'](function(_0x44b2e3){if(_0x44b2e3){_0x334d0b[_0x0d8f('0x60')][_0x0d8f('0x67')]=_0x44b2e3['id'];return db[_0x0d8f('0x68')][_0x0d8f('0x5f')](_0x334d0b[_0x0d8f('0x60')]);}})['then'](respondWithResult(_0x535dd9,null))[_0x0d8f('0x2b')](handleError(_0x535dd9,null));};exports[_0x0d8f('0x69')]=function(_0x2634df,_0x253da8,_0x11d6c6){var _0x554c04={'raw':![],'where':{}};var _0x2068dc={};var _0x1939e3={'count':0x0,'rows':[]};return db[_0x0d8f('0x42')][_0x0d8f('0x6a')]({'where':{'id':_0x2634df[_0x0d8f('0x58')]['id']}})[_0x0d8f('0x22')](handleEntityNotFound(_0x253da8,null))[_0x0d8f('0x22')](function(_0x55947d){if(_0x55947d){_0x2068dc[_0x0d8f('0x45')]=_[_0x0d8f('0x5a')](db[_0x0d8f('0x68')][_0x0d8f('0x6b')]);_0x2068dc[_0x0d8f('0x48')]=_[_0x0d8f('0x5a')](_0x2634df[_0x0d8f('0x48')]);_0x2068dc['filters']=_[_0x0d8f('0x47')](_0x2068dc[_0x0d8f('0x45')],_0x2068dc['query']);_0x554c04[_0x0d8f('0x4a')]=_['intersection'](_0x2068dc[_0x0d8f('0x45')],qs[_0x0d8f('0x49')](_0x2634df[_0x0d8f('0x48')][_0x0d8f('0x49')]));_0x554c04[_0x0d8f('0x4a')]=_0x554c04[_0x0d8f('0x4a')]['length']?_0x554c04['attributes']:_0x2068dc['model'];if(!_0x2634df[_0x0d8f('0x48')][_0x0d8f('0x4c')](_0x0d8f('0x4d'))){_0x554c04[_0x0d8f('0x32')]=qs[_0x0d8f('0x32')](_0x2634df[_0x0d8f('0x48')]['limit']);_0x554c04[_0x0d8f('0x30')]=qs['offset'](_0x2634df[_0x0d8f('0x48')]['offset']);}_0x554c04[_0x0d8f('0x4e')]=qs['sort'](_0x2634df[_0x0d8f('0x48')][_0x0d8f('0x4f')]);_0x554c04[_0x0d8f('0x50')]=qs['filters'](_[_0x0d8f('0x6c')](_0x2634df['query'],_0x2068dc[_0x0d8f('0x51')]));_0x554c04[_0x0d8f('0x50')][_0x0d8f('0x67')]=_0x55947d['id'];if(_0x2634df[_0x0d8f('0x48')][_0x0d8f('0x52')]){_0x554c04[_0x0d8f('0x50')]=_['merge'](_0x554c04['where'],{'$or':_[_0x0d8f('0x46')](_0x554c04['attributes'],function(_0x1e613b){var _0x418595={};_0x418595[_0x1e613b]={'$like':'%'+_0x2634df[_0x0d8f('0x48')][_0x0d8f('0x52')]+'%'};return _0x418595;})});}_0x554c04=_['merge']({},_0x554c04,_0x2634df[_0x0d8f('0x5d')]);return db['Disposition'][_0x0d8f('0x33')]({'where':_0x554c04[_0x0d8f('0x50')]})[_0x0d8f('0x22')](function(_0xd9cbb1){_0x1939e3[_0x0d8f('0x33')]=_0xd9cbb1;if(_0x2634df[_0x0d8f('0x48')][_0x0d8f('0x5b')]){_0x554c04[_0x0d8f('0x5c')]=[{'all':!![]}];}return db['Disposition'][_0x0d8f('0x55')](_0x554c04);})[_0x0d8f('0x22')](function(_0x4781c8){_0x1939e3['rows']=_0x4781c8;return _0x1939e3;});}})[_0x0d8f('0x22')](respondWithFilteredResult(_0x253da8,_0x554c04))[_0x0d8f('0x2b')](handleError(_0x253da8,null));};exports[_0x0d8f('0x6d')]=function(_0x86e18a,_0x4bd4af,_0x1007a3){return db[_0x0d8f('0x42')][_0x0d8f('0x5e')]({'where':{'id':_0x86e18a[_0x0d8f('0x58')]['id']}})['then'](handleEntityNotFound(_0x4bd4af,null))[_0x0d8f('0x22')](function(_0x1d6d0d){if(_0x1d6d0d){return _0x1d6d0d[_0x0d8f('0x6d')](_0x86e18a['query'][_0x0d8f('0x6e')]);}})[_0x0d8f('0x22')](respondWithStatusCode(_0x4bd4af,null))['catch'](handleError(_0x4bd4af,null));};exports[_0x0d8f('0x6f')]=function(_0x235e55,_0x4f3bd1,_0xb437f5){if(_0x235e55['body']['id']){delete _0x235e55[_0x0d8f('0x60')]['id'];}return db[_0x0d8f('0x42')][_0x0d8f('0x5e')]({'where':{'id':_0x235e55['params']['id']}})['then'](handleEntityNotFound(_0x4f3bd1,null))[_0x0d8f('0x22')](function(_0x4da3e6){if(_0x4da3e6){_0x235e55[_0x0d8f('0x60')][_0x0d8f('0x67')]=_0x4da3e6['id'];return db[_0x0d8f('0x70')][_0x0d8f('0x5f')](_0x235e55[_0x0d8f('0x60')]);}})[_0x0d8f('0x22')](respondWithResult(_0x4f3bd1,null))[_0x0d8f('0x2b')](handleError(_0x4f3bd1,null));};exports[_0x0d8f('0x71')]=function(_0x1870f3,_0x441556,_0x38aaeb){var _0x193409={'raw':![],'where':{}};var _0x1e3a66={};var _0x1a7f18={'count':0x0,'rows':[]};return db[_0x0d8f('0x42')][_0x0d8f('0x6a')]({'where':{'id':_0x1870f3[_0x0d8f('0x58')]['id']}})[_0x0d8f('0x22')](handleEntityNotFound(_0x441556,null))[_0x0d8f('0x22')](function(_0x43224c){if(_0x43224c){_0x1e3a66[_0x0d8f('0x45')]=_[_0x0d8f('0x5a')](db[_0x0d8f('0x70')]['rawAttributes']);_0x1e3a66[_0x0d8f('0x48')]=_['keys'](_0x1870f3[_0x0d8f('0x48')]);_0x1e3a66[_0x0d8f('0x51')]=_['intersection'](_0x1e3a66[_0x0d8f('0x45')],_0x1e3a66[_0x0d8f('0x48')]);_0x193409[_0x0d8f('0x4a')]=_[_0x0d8f('0x47')](_0x1e3a66[_0x0d8f('0x45')],qs[_0x0d8f('0x49')](_0x1870f3[_0x0d8f('0x48')][_0x0d8f('0x49')]));_0x193409[_0x0d8f('0x4a')]=_0x193409[_0x0d8f('0x4a')][_0x0d8f('0x4b')]?_0x193409['attributes']:_0x1e3a66[_0x0d8f('0x45')];if(!_0x1870f3[_0x0d8f('0x48')]['hasOwnProperty'](_0x0d8f('0x4d'))){_0x193409['limit']=qs['limit'](_0x1870f3[_0x0d8f('0x48')][_0x0d8f('0x32')]);_0x193409['offset']=qs[_0x0d8f('0x30')](_0x1870f3[_0x0d8f('0x48')]['offset']);}_0x193409[_0x0d8f('0x4e')]=qs['sort'](_0x1870f3[_0x0d8f('0x48')][_0x0d8f('0x4f')]);_0x193409[_0x0d8f('0x50')]=qs['filters'](_['pick'](_0x1870f3['query'],_0x1e3a66['filters']));_0x193409[_0x0d8f('0x50')][_0x0d8f('0x67')]=_0x43224c['id'];if(_0x1870f3['query'][_0x0d8f('0x52')]){_0x193409[_0x0d8f('0x50')]=_['merge'](_0x193409[_0x0d8f('0x50')],{'$or':_[_0x0d8f('0x46')](_0x193409['attributes'],function(_0x5e48ee){var _0xa8a6f6={};_0xa8a6f6[_0x5e48ee]={'$like':'%'+_0x1870f3[_0x0d8f('0x48')][_0x0d8f('0x52')]+'%'};return _0xa8a6f6;})});}_0x193409=_[_0x0d8f('0x53')]({},_0x193409,_0x1870f3[_0x0d8f('0x5d')]);return db['CannedAnswer'][_0x0d8f('0x33')]({'where':_0x193409[_0x0d8f('0x50')]})[_0x0d8f('0x22')](function(_0x41135e){_0x1a7f18['count']=_0x41135e;if(_0x1870f3['query'][_0x0d8f('0x5b')]){_0x193409[_0x0d8f('0x5c')]=[{'all':!![]}];}return db['CannedAnswer'][_0x0d8f('0x55')](_0x193409);})[_0x0d8f('0x22')](function(_0x336928){_0x1a7f18[_0x0d8f('0x56')]=_0x336928;return _0x1a7f18;});}})['then'](respondWithFilteredResult(_0x441556,_0x193409))[_0x0d8f('0x2b')](handleError(_0x441556,null));};exports['removeAnswers']=function(_0x53dee4,_0x87149c,_0x361e21){return db[_0x0d8f('0x42')]['find']({'where':{'id':_0x53dee4[_0x0d8f('0x58')]['id']}})['then'](handleEntityNotFound(_0x87149c,null))[_0x0d8f('0x22')](function(_0x113945){if(_0x113945){return _0x113945['removeAnswers'](_0x53dee4[_0x0d8f('0x48')][_0x0d8f('0x6e')]);}})[_0x0d8f('0x22')](respondWithStatusCode(_0x87149c,null))['catch'](handleError(_0x87149c,null));};exports[_0x0d8f('0x72')]=function(_0x481d25,_0x10a732,_0x313e33){var _0x3680a3={'body':_0x481d25[_0x0d8f('0x60')],'channel':_0x0d8f('0x73')};var _0x1cde19=[];var _0x279a7d=[];var _0x5e577f={};var _0x5e4b8f=![];return db[_0x0d8f('0x74')]['describe']()[_0x0d8f('0x22')](function(_0x5dd4b4){if(!_0x5dd4b4){throw new db[(_0x0d8f('0x75'))][(_0x0d8f('0x76'))](_0x0d8f('0x77'));}_0x1cde19=_[_0x0d8f('0x78')](_[_0x0d8f('0x5a')](_0x5dd4b4),['createdAt','updatedAt']);_0x279a7d=_[_0x0d8f('0x78')](_[_0x0d8f('0x5a')](_0x5dd4b4),['createdAt',_0x0d8f('0x79'),_0x0d8f('0x7a'),_0x0d8f('0x7b')]);if(_0x481d25['body']['id']){delete _0x481d25[_0x0d8f('0x60')]['id'];}if(_[_0x0d8f('0x7c')](_0x481d25[_0x0d8f('0x60')][_0x0d8f('0x7d')])){throw new db[(_0x0d8f('0x75'))]['ValidationError'](_0x0d8f('0x7e'));}if(_[_0x0d8f('0x7c')](_0x481d25[_0x0d8f('0x60')]['body'])||_0x481d25[_0x0d8f('0x60')][_0x0d8f('0x60')]===''){throw new db[(_0x0d8f('0x75'))][(_0x0d8f('0x76'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x481d25['body']['mapKey'])){throw new db['Sequelize'][(_0x0d8f('0x76'))](_0x0d8f('0x7f')+_0x279a7d);}if(!_[_0x0d8f('0x80')](_0x279a7d,_0x481d25[_0x0d8f('0x60')]['mapKey'])){throw new db['Sequelize'][(_0x0d8f('0x76'))](_0x0d8f('0x81')+_0x279a7d);}_0x5e577f[_0x481d25[_0x0d8f('0x60')]['mapKey']]=_0x481d25['body'][_0x0d8f('0x7d')];})['then'](function(){return db[_0x0d8f('0x42')][_0x0d8f('0x5e')]({'where':{'id':_0x481d25['params']['id']},'include':[{'model':db[_0x0d8f('0x82')],'as':_0x0d8f('0x83'),'include':[{'model':db[_0x0d8f('0x74')],'as':_0x0d8f('0x84'),'where':_0x5e577f,'limit':0x1,'order':[[_0x0d8f('0x79'),_0x0d8f('0x85')]]}]},{'model':db[_0x0d8f('0x86')],'as':'Applications'}]});})[_0x0d8f('0x22')](handleEntityNotFound(_0x10a732,null))[_0x0d8f('0x22')](function(_0x2333e5){if(_0x2333e5&&_0x2333e5['List']){_0x3680a3[_0x0d8f('0x87')]=_0x2333e5;_0x3680a3[_0x0d8f('0x88')]=_0x2333e5['Applications'];_0x3680a3[_0x0d8f('0x89')]=_0x2333e5[_0x0d8f('0x83')];_0x3680a3['applications']=_[_0x0d8f('0x8a')](_0x3680a3['applications'],[_0x0d8f('0x8b')],[_0x0d8f('0x8c')]);if(_0x3680a3['account']['Applications']){delete _0x3680a3[_0x0d8f('0x87')][_0x0d8f('0x8d')];}if(_0x3680a3[_0x0d8f('0x87')][_0x0d8f('0x83')]&&_0x3680a3[_0x0d8f('0x87')][_0x0d8f('0x83')][_0x0d8f('0x84')][_0x0d8f('0x4b')]){return _0x3680a3[_0x0d8f('0x87')]['List'][_0x0d8f('0x84')][0x0];}var _0x26b9dc=_[_0x0d8f('0x1b')](_0x481d25[_0x0d8f('0x60')],{'firstName':_0x481d25['body'][_0x0d8f('0x7d')],'ListId':_0x2333e5['ListId']});_0x26b9dc[_0x481d25[_0x0d8f('0x60')][_0x0d8f('0x8e')]]=_0x481d25['body'][_0x0d8f('0x7d')];return db[_0x0d8f('0x74')]['create'](_0x26b9dc,{'fields':_0x1cde19,'raw':!![]});}})[_0x0d8f('0x22')](handleEntityNotFound(_0x10a732,null))['then'](function(_0xa714f9){_0x3680a3[_0x0d8f('0x8f')]=_0xa714f9;if(_0xa714f9){var _0x897e61={'ContactId':_0xa714f9['id'],'OpenchannelAccountId':_0x481d25['params']['id'],'from':(_0xa714f9['firstName']||'')+'\x20'+(_0xa714f9[_0x0d8f('0x90')]||'')};var _0x289561={'OpenchannelAccountId':_0x481d25[_0x0d8f('0x58')]['id'],'closed':![]};if(_0x481d25['body'][_0x0d8f('0x91')]){_0x289561['threadId']=_0x481d25[_0x0d8f('0x60')][_0x0d8f('0x91')];return db[_0x0d8f('0x92')][_0x0d8f('0x5e')]({'where':_0x289561})[_0x0d8f('0x22')](function(_0x1b05be){if(_0x1b05be){return[_0x1b05be,![]];}_0x897e61['threadId']=_0x481d25[_0x0d8f('0x60')][_0x0d8f('0x91')];_0x897e61[_0x0d8f('0x93')]=_0x481d25['body']['externalUrl'];return db['OpenchannelInteraction']['create'](_0x897e61)['then'](function(_0x6b68a8){return[_0x6b68a8,!![]];});});}else{_0x289561[_0x0d8f('0x91')]=null;}_0x289561[_0x0d8f('0x94')]=_0xa714f9['id'];return db[_0x0d8f('0x92')]['find']({'where':_0x289561})[_0x0d8f('0x22')](function(_0x51bc61){if(_0x51bc61){return[_0x51bc61,![]];}return db[_0x0d8f('0x92')][_0x0d8f('0x5f')](_0x897e61)[_0x0d8f('0x22')](function(_0x2d7d4c){return[_0x2d7d4c,!![]];});});}})[_0x0d8f('0x95')](function(_0xeeeb3b,_0x584916){if(_0xeeeb3b){_0x5e4b8f=_0x584916;if(!_0x584916){var _0x496e52={'from':(_0x3680a3['contact']['firstName']||'')+'\x20'+(_0x3680a3[_0x0d8f('0x8f')][_0x0d8f('0x90')]||'')};if(_0x481d25[_0x0d8f('0x60')][_0x0d8f('0x91')]&&_0x481d25[_0x0d8f('0x60')]['messageId']&&_0x481d25[_0x0d8f('0x60')]['threadId']!=_0x481d25[_0x0d8f('0x60')][_0x0d8f('0x96')]){_0x496e52[_0x0d8f('0x91')]=_0x481d25[_0x0d8f('0x60')]['messageId'];}return _0xeeeb3b[_0x0d8f('0x39')](_0x496e52);}else{return _0xeeeb3b;}}})[_0x0d8f('0x22')](function(_0x4783f1){_0x3680a3[_0x0d8f('0x97')]=_0x4783f1[_0x0d8f('0x3b')]({'plain':!![]});_0x3680a3[_0x0d8f('0x97')]['created']=_0x5e4b8f;if(_0x3680a3[_0x0d8f('0x97')][_0x0d8f('0x98')]){if(_0x3680a3[_0x0d8f('0x87')][_0x0d8f('0x99')]){_0x3680a3[_0x0d8f('0x88')][_0x0d8f('0x9a')]({'id':0x0,'priority':_0x3680a3[_0x0d8f('0x88')][_0x0d8f('0x4b')]+0x1,'app':_0x0d8f('0x9b'),'appdata':_0x0d8f('0x9c'),'interval':_0x0d8f('0x9d')});}}return db[_0x0d8f('0x9e')][_0x0d8f('0x5f')]({'body':_0x481d25[_0x0d8f('0x60')][_0x0d8f('0x60')],'OpenchannelAccountId':_0x481d25[_0x0d8f('0x58')]['id'],'OpenchannelInteractionId':_0x4783f1['id'],'direction':'in','ContactId':_0x3680a3[_0x0d8f('0x8f')]['id'],'AttachmentId':_0x481d25[_0x0d8f('0x60')]['AttachmentId']});})['then'](function(_0x390809){_0x3680a3[_0x0d8f('0x28')]=_0x390809;if(_0x3680a3[_0x0d8f('0x97')][_0x0d8f('0x9f')]){return db[_0x0d8f('0xa0')]['find']({'attributes':['id','name'],'where':{'id':_0x3680a3['interaction']['UserId']}})[_0x0d8f('0x22')](function(_0x3b52ce){if(_0x3b52ce){_0x3680a3[_0x0d8f('0x88')][_0x0d8f('0xa1')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3b52ce[_0x0d8f('0x3e')]+','+(_0x3680a3[_0x0d8f('0x87')][_0x0d8f('0xa2')]||0xa),'interval':_0x0d8f('0x9d')});_0x3680a3[_0x0d8f('0xa3')]=![];}return respondWithRpcPromise('Start',_0x0d8f('0xa4'),_0x3680a3);});}return respondWithRpcPromise(_0x0d8f('0xa5'),'startRouting',_0x3680a3);})['then'](function(_0x5e7060){respondWithRpcPromise('EventManager',_0x0d8f('0xa6'),{'event':_0x0d8f('0x72'),'message':_0x5e7060},client9002);return _0x5e7060;})['then'](respondWithResult(_0x10a732,null))[_0x0d8f('0x2b')](handleError(_0x10a732,null));};exports['addApplications']=function(_0x33832e,_0x1659d2,_0x1558cd){return db[_0x0d8f('0x42')][_0x0d8f('0x6a')]({'where':{'id':_0x33832e['params']['id']}})[_0x0d8f('0x22')](handleEntityNotFound(_0x1659d2,null))[_0x0d8f('0x22')](function(_0x1f2bac){if(_0x1f2bac){return db['sequelize'][_0x0d8f('0xa7')](function(_0x4bdb81){return db['OpenchannelApplication'][_0x0d8f('0x3a')]({'where':{'OpenchannelAccountId':_0x33832e[_0x0d8f('0x58')]['id']},'transaction':_0x4bdb81})[_0x0d8f('0x22')](function(_0x4b2cb4){var _0x4f2c40=_[_0x0d8f('0x46')](_0x33832e[_0x0d8f('0x60')],function(_0x2ecbb0){_0x2ecbb0[_0x0d8f('0x67')]=_0x33832e[_0x0d8f('0x58')]['id'];return _0x2ecbb0;});return db['OpenchannelApplication'][_0x0d8f('0xa8')](_0x4f2c40,{'transaction':_0x4bdb81});});})[_0x0d8f('0x22')](function(){return db[_0x0d8f('0x86')][_0x0d8f('0xa9')]({'where':{'OpenchannelAccountId':_0x33832e['params']['id']},'order':_0x0d8f('0x8b')});});}})[_0x0d8f('0x22')](respondWithResult(_0x1659d2,null))[_0x0d8f('0x2b')](handleError(_0x1659d2,null));};exports[_0x0d8f('0xaa')]=function(_0x2999f0,_0x1bece5,_0x5b9ca9){var _0x5405b1={};var _0x4666b7={};var _0x44c2a2;var _0x549c9b;return db['OpenchannelAccount'][_0x0d8f('0x6a')]({'where':{'id':_0x2999f0[_0x0d8f('0x58')]['id']}})[_0x0d8f('0x22')](handleEntityNotFound(_0x1bece5,null))['then'](function(_0xffad3c){if(_0xffad3c){_0x44c2a2=_0xffad3c;_0x4666b7['model']=_[_0x0d8f('0x5a')](db[_0x0d8f('0x86')]['rawAttributes']);_0x4666b7[_0x0d8f('0x48')]=_[_0x0d8f('0x5a')](_0x2999f0[_0x0d8f('0x48')]);_0x4666b7[_0x0d8f('0x51')]=_[_0x0d8f('0x47')](_0x4666b7['model'],_0x4666b7[_0x0d8f('0x48')]);_0x5405b1['attributes']=_[_0x0d8f('0x47')](_0x4666b7['model'],qs['fields'](_0x2999f0[_0x0d8f('0x48')][_0x0d8f('0x49')]));_0x5405b1['attributes']=_0x5405b1[_0x0d8f('0x4a')][_0x0d8f('0x4b')]?_0x5405b1[_0x0d8f('0x4a')]:_0x4666b7[_0x0d8f('0x45')];_0x5405b1['order']=qs[_0x0d8f('0x4f')](_0x2999f0['query'][_0x0d8f('0x4f')]);_0x5405b1['where']=qs['filters'](_['pick'](_0x2999f0['query'],_0x4666b7[_0x0d8f('0x51')]));if(_0x2999f0[_0x0d8f('0x48')]['filter']){_0x5405b1[_0x0d8f('0x50')]=_[_0x0d8f('0x53')](_0x5405b1['where'],{'$or':_[_0x0d8f('0x46')](_0x5405b1[_0x0d8f('0x4a')],function(_0x18c3a5){var _0x51518e={};_0x51518e[_0x18c3a5]={'$like':'%'+_0x2999f0['query'][_0x0d8f('0x52')]+'%'};return _0x51518e;})});}_0x5405b1=_['merge']({},_0x5405b1,_0x2999f0[_0x0d8f('0x5d')]);return _0x44c2a2[_0x0d8f('0xaa')](_0x5405b1);}})[_0x0d8f('0x22')](function(_0x1a396e){if(_0x1a396e){_0x549c9b=_0x1a396e[_0x0d8f('0x4b')];if(!_0x2999f0['query']['hasOwnProperty']('nolimit')){_0x5405b1[_0x0d8f('0x32')]=qs[_0x0d8f('0x32')](_0x2999f0['query'][_0x0d8f('0x32')]);_0x5405b1[_0x0d8f('0x30')]=qs[_0x0d8f('0x30')](_0x2999f0[_0x0d8f('0x48')]['offset']);}return _0x44c2a2[_0x0d8f('0xaa')](_0x5405b1);}})[_0x0d8f('0x22')](function(_0x5bfcb7){if(_0x5bfcb7){return _0x5bfcb7?{'count':_0x549c9b,'rows':_0x5bfcb7}:null;}})['then'](respondWithResult(_0x1bece5,null))[_0x0d8f('0x2b')](handleError(_0x1bece5,null));};exports['getInteractions']=function(_0x48fa40,_0x3b1826,_0x1d5f9d){var _0x1a0ada={'raw':![],'where':{}};var _0x41e339={};var _0x5a860b={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x0d8f('0x6a')]({'where':{'id':_0x48fa40[_0x0d8f('0x58')]['id']}})[_0x0d8f('0x22')](handleEntityNotFound(_0x3b1826,null))[_0x0d8f('0x22')](function(_0x4092c0){if(_0x4092c0){_0x41e339['model']=_[_0x0d8f('0x5a')](db[_0x0d8f('0x92')][_0x0d8f('0x6b')]);_0x41e339[_0x0d8f('0x48')]=_[_0x0d8f('0x5a')](_0x48fa40[_0x0d8f('0x48')]);_0x41e339[_0x0d8f('0x51')]=_[_0x0d8f('0x47')](_0x41e339[_0x0d8f('0x45')],_0x41e339[_0x0d8f('0x48')]);_0x1a0ada[_0x0d8f('0x4a')]=_[_0x0d8f('0x47')](_0x41e339[_0x0d8f('0x45')],qs[_0x0d8f('0x49')](_0x48fa40['query'][_0x0d8f('0x49')]));_0x1a0ada[_0x0d8f('0x4a')]=_0x1a0ada[_0x0d8f('0x4a')]['length']?_0x1a0ada['attributes']:_0x41e339[_0x0d8f('0x45')];if(!_0x48fa40[_0x0d8f('0x48')][_0x0d8f('0x4c')]('nolimit')){_0x1a0ada[_0x0d8f('0x32')]=qs[_0x0d8f('0x32')](_0x48fa40[_0x0d8f('0x48')][_0x0d8f('0x32')]);_0x1a0ada['offset']=qs[_0x0d8f('0x30')](_0x48fa40[_0x0d8f('0x48')][_0x0d8f('0x30')]);}_0x1a0ada[_0x0d8f('0x4e')]=qs[_0x0d8f('0x4f')](_0x48fa40[_0x0d8f('0x48')]['sort']);_0x1a0ada[_0x0d8f('0x50')]=qs['filters'](_[_0x0d8f('0x6c')](_0x48fa40[_0x0d8f('0x48')],_0x41e339[_0x0d8f('0x51')]));_0x1a0ada[_0x0d8f('0x50')]['OpenchannelAccountId']=_0x4092c0['id'];if(_0x48fa40[_0x0d8f('0x48')]['filter']){_0x1a0ada[_0x0d8f('0x50')]=_[_0x0d8f('0x53')](_0x1a0ada[_0x0d8f('0x50')],{'$or':_[_0x0d8f('0x46')](_0x1a0ada[_0x0d8f('0x4a')],function(_0x22cb49){var _0x596cde={};_0x596cde[_0x22cb49]={'$like':'%'+_0x48fa40['query'][_0x0d8f('0x52')]+'%'};return _0x596cde;})});}_0x1a0ada=_[_0x0d8f('0x53')]({},_0x1a0ada,_0x48fa40[_0x0d8f('0x5d')]);return db[_0x0d8f('0x92')]['count']({'where':_0x1a0ada[_0x0d8f('0x50')]})[_0x0d8f('0x22')](function(_0x5ed580){_0x5a860b[_0x0d8f('0x33')]=_0x5ed580;if(_0x48fa40[_0x0d8f('0x48')]['includeAll']){_0x1a0ada[_0x0d8f('0x5c')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['User'],'as':_0x0d8f('0xab'),'attributes':[_0x0d8f('0x3e'),_0x0d8f('0xac'),_0x0d8f('0xad')],'required':![]},{'model':db[_0x0d8f('0xae')],'as':_0x0d8f('0xaf'),'attributes':['id',_0x0d8f('0x3e'),_0x0d8f('0xb0')],'where':_0x48fa40[_0x0d8f('0x48')][_0x0d8f('0xb1')]?{'id':_0x48fa40[_0x0d8f('0x48')][_0x0d8f('0xb1')]}:undefined,'required':_0x48fa40[_0x0d8f('0x48')]['tag']?!![]:![]}];}return db[_0x0d8f('0x92')][_0x0d8f('0x55')](_0x1a0ada);})[_0x0d8f('0x22')](function(_0x32974e){_0x5a860b[_0x0d8f('0x56')]=_0x32974e;return _0x5a860b;});}})[_0x0d8f('0x22')](respondWithFilteredResult(_0x3b1826,_0x1a0ada))['catch'](handleError(_0x3b1826,null));};exports[_0x0d8f('0xb2')]=function(_0x190840,_0x20d025,_0x251b99){return db['OpenchannelAccount'][_0x0d8f('0x5e')]({'where':{'id':_0x190840[_0x0d8f('0x58')]['id']}})[_0x0d8f('0x22')](handleEntityNotFound(_0x20d025,null))['then'](function(_0x4d2910){if(_0x4d2910){return _0x4d2910[_0x0d8f('0xb2')](_0x190840[_0x0d8f('0x60')][_0x0d8f('0x6e')],_[_0x0d8f('0xb3')](_0x190840[_0x0d8f('0x60')],[_0x0d8f('0x6e'),'id'])||{})['spread'](function(_0x3b3358){for(var _0x35396e=0x0;_0x35396e<_0x190840[_0x0d8f('0x60')][_0x0d8f('0x6e')][_0x0d8f('0x4b')];_0x35396e+=0x1){socket[_0x0d8f('0xb4')]('userOpenchannelAccount:save',{'UserId':Number(_0x190840[_0x0d8f('0x60')]['ids'][_0x35396e]),'OpenchannelAccountId':Number(_0x190840['params']['id'])});}return _0x3b3358;});}})[_0x0d8f('0x22')](respondWithResult(_0x20d025,null))[_0x0d8f('0x2b')](handleError(_0x20d025,null));};exports[_0x0d8f('0xb5')]=function(_0x19a6f8,_0x1dce40,_0x317251){return db[_0x0d8f('0x42')][_0x0d8f('0x5e')]({'where':{'id':_0x19a6f8[_0x0d8f('0x58')]['id']}})['then'](handleEntityNotFound(_0x1dce40,null))[_0x0d8f('0x22')](function(_0x522375){if(_0x522375){return _0x522375[_0x0d8f('0xb5')](_0x19a6f8[_0x0d8f('0x48')]['ids'])[_0x0d8f('0x22')](function(){if(_[_0x0d8f('0xb6')](_0x19a6f8[_0x0d8f('0x48')]['ids'])){for(var _0x3789fe=0x0;_0x3789fe<_0x19a6f8[_0x0d8f('0x48')]['ids'][_0x0d8f('0x4b')];_0x3789fe+=0x1){socket[_0x0d8f('0xb4')]('userOpenchannelAccount:remove',{'UserId':Number(_0x19a6f8[_0x0d8f('0x48')][_0x0d8f('0x6e')][_0x3789fe]),'OpenchannelAccountId':Number(_0x19a6f8[_0x0d8f('0x58')]['id'])});}}else{socket[_0x0d8f('0xb4')](_0x0d8f('0xb7'),{'UserId':Number(_0x19a6f8[_0x0d8f('0x48')][_0x0d8f('0x6e')]),'OpenchannelAccountId':Number(_0x19a6f8['params']['id'])});}});}})[_0x0d8f('0x22')](respondWithStatusCode(_0x1dce40,null))[_0x0d8f('0x2b')](handleError(_0x1dce40,null));};exports['getAgents']=function(_0x2caa28,_0x31e181,_0x560530){var _0x20a6a4={};var _0x37af16={};var _0x5acd10;var _0x47a3c2;return db[_0x0d8f('0x42')][_0x0d8f('0x6a')]({'where':{'id':_0x2caa28[_0x0d8f('0x58')]['id']}})[_0x0d8f('0x22')](handleEntityNotFound(_0x31e181,null))[_0x0d8f('0x22')](function(_0x417430){if(_0x417430){_0x5acd10=_0x417430;_0x37af16[_0x0d8f('0x45')]=_['keys'](db['User'][_0x0d8f('0x6b')]);_0x37af16[_0x0d8f('0x48')]=_[_0x0d8f('0x5a')](_0x2caa28[_0x0d8f('0x48')]);_0x37af16[_0x0d8f('0x51')]=_[_0x0d8f('0x47')](_0x37af16[_0x0d8f('0x45')],_0x37af16[_0x0d8f('0x48')]);_0x20a6a4[_0x0d8f('0x4a')]=_[_0x0d8f('0x47')](_0x37af16[_0x0d8f('0x45')],qs['fields'](_0x2caa28[_0x0d8f('0x48')][_0x0d8f('0x49')]));_0x20a6a4[_0x0d8f('0x4a')]=_0x20a6a4[_0x0d8f('0x4a')][_0x0d8f('0x4b')]?_0x20a6a4[_0x0d8f('0x4a')]:_0x37af16[_0x0d8f('0x45')];_0x20a6a4[_0x0d8f('0x4e')]=qs[_0x0d8f('0x4f')](_0x2caa28[_0x0d8f('0x48')][_0x0d8f('0x4f')]);_0x20a6a4['where']=qs[_0x0d8f('0x51')](_['pick'](_0x2caa28[_0x0d8f('0x48')],_0x37af16[_0x0d8f('0x51')]));if(_0x2caa28[_0x0d8f('0x48')][_0x0d8f('0x52')]){_0x20a6a4[_0x0d8f('0x50')]=_['merge'](_0x20a6a4[_0x0d8f('0x50')],{'$or':_[_0x0d8f('0x46')](_0x20a6a4[_0x0d8f('0x4a')],function(_0x3299a3){var _0x41b2e8={};_0x41b2e8[_0x3299a3]={'$like':'%'+_0x2caa28['query'][_0x0d8f('0x52')]+'%'};return _0x41b2e8;})});}_0x20a6a4=_[_0x0d8f('0x53')]({},_0x20a6a4,_0x2caa28[_0x0d8f('0x5d')]);return _0x5acd10['getAgents'](_0x20a6a4);}})['then'](function(_0xc8dc2f){if(_0xc8dc2f){_0x47a3c2=_0xc8dc2f[_0x0d8f('0x4b')];if(!_0x2caa28[_0x0d8f('0x48')][_0x0d8f('0x4c')](_0x0d8f('0x4d'))){_0x20a6a4['limit']=qs['limit'](_0x2caa28[_0x0d8f('0x48')][_0x0d8f('0x32')]);_0x20a6a4['offset']=qs[_0x0d8f('0x30')](_0x2caa28[_0x0d8f('0x48')][_0x0d8f('0x30')]);}return _0x5acd10[_0x0d8f('0xb8')](_0x20a6a4);}})['then'](function(_0x369a9e){if(_0x369a9e){return _0x369a9e?{'count':_0x47a3c2,'rows':_0x369a9e}:null;}})[_0x0d8f('0x22')](respondWithResult(_0x31e181,null))[_0x0d8f('0x2b')](handleError(_0x31e181,null));};exports[_0x0d8f('0x3f')]=function(_0x46be32,_0x742667,_0x5b008e){var _0x1170b3,_0x230401,_0x56d9c8;if(_[_0x0d8f('0x7c')](_0x46be32[_0x0d8f('0x60')]['body'])||_0x46be32['body'][_0x0d8f('0x60')]===''){throw new db['Sequelize']['ValidationError'](_0x0d8f('0xb9'));}if(_['isNil'](_0x46be32[_0x0d8f('0x60')]['to'])){}_0x1170b3=_0x46be32[_0x0d8f('0x60')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x46be32[_0x0d8f('0x58')]['id']}})['then'](handleEntityNotFound(_0x742667,null))[_0x0d8f('0x22')](function(_0x119e33){if(_0x119e33){return db[_0x0d8f('0x42')]['find']({'where':{'id':_0x119e33['id']},'include':[{'model':db[_0x0d8f('0x82')],'as':_0x0d8f('0x83'),'include':[{'model':db[_0x0d8f('0x74')],'as':_0x0d8f('0x84'),'where':{[_0x119e33[_0x0d8f('0x8e')]]:_0x1170b3},'limit':0x1,'order':[[_0x0d8f('0x79'),'DESC']]}]}]})[_0x0d8f('0x22')](handleEntityNotFound(_0x742667,null))[_0x0d8f('0x22')](function(_0x3d198e){if(_0x3d198e&&_0x3d198e[_0x0d8f('0x83')]){_0x230401=_0x3d198e['get']({'plain':!![]});if(_0x230401['List']&&_0x230401[_0x0d8f('0x83')]['Contacts']['length']){return _0x230401[_0x0d8f('0x83')][_0x0d8f('0x84')][0x0];}return db[_0x0d8f('0x74')][_0x0d8f('0x5f')](_[_0x0d8f('0x1b')](_0x46be32['body'],{'firstName':_0x1170b3,[_0x3d198e[_0x0d8f('0x8e')]]:_0x1170b3,'phone':_0x1170b3,'ListId':_0x230401[_0x0d8f('0x7b')]}));}})['then'](handleEntityNotFound(_0x742667,null))[_0x0d8f('0x22')](function(_0x1bc1ec){if(_0x1bc1ec){_0x56d9c8=_0x1bc1ec;return db[_0x0d8f('0x92')][_0x0d8f('0x5e')]({'where':{'ContactId':_0x56d9c8['id'],'closed':![],'OpenchannelAccountId':_0x230401['id']}})['then'](function(_0x232d3b){if(_0x232d3b){return[_0x232d3b,![]];}return db[_0x0d8f('0x92')][_0x0d8f('0x5f')]({'UserId':_0x46be32[_0x0d8f('0x61')]['id'],'ContactId':_0x56d9c8['id'],'OpenchannelAccountId':_0x230401['id'],'lastMsgDirection':'out','Messages':[_['merge'](_0x46be32[_0x0d8f('0x60')],{'read':![],'body':_0x46be32['body']['body'],'OpenchannelAccountId':_0x230401['id'],'UserId':_0x46be32[_0x0d8f('0x61')]['id'],'ContactId':_0x56d9c8['id']})]},{'include':[{'model':db[_0x0d8f('0x9e')],'as':_0x0d8f('0xba')}]})[_0x0d8f('0x22')](function(_0x41363b){return[_0x41363b,!![]];});});}})[_0x0d8f('0x95')](function(_0x1d9048,_0x4de229){if(_0x4de229){return _0x1d9048;}return db[_0x0d8f('0x9e')][_0x0d8f('0x5f')](_[_0x0d8f('0x53')](_0x46be32[_0x0d8f('0x60')],{'read':![],'body':_0x46be32[_0x0d8f('0x60')][_0x0d8f('0x60')],'OpenchannelAccountId':_0x230401['id'],'OpenchannelInteractionId':_0x1d9048['id'],'UserId':_0x46be32['user']['id'],'ContactId':_0x56d9c8['id']}))[_0x0d8f('0x22')](function(_0x1d0148){_0x1d9048['dataValues'][_0x0d8f('0xba')]=[];_0x1d9048['dataValues']['Messages'][_0x0d8f('0x9a')](_0x1d0148[_0x0d8f('0xbb')]);return _0x1d9048;});});}})[_0x0d8f('0x22')](respondWithResult(_0x742667,null))['catch'](handleError(_0x742667,null));}; \ No newline at end of file +var _0x0edd=['sequelize','transaction','bulkCreate','getApplications','nolimit','getInteractions','Contact','User','fullname','internal','Tag','Tags','tag','addAgents','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','Messages','dataValues','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','limit','undefined','count','offset','set','reject','save','update','destroy','get','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','fieldName','type','key','model','map','query','intersection','attributes','length','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','show','params','Pause','rawAttributes','fields','includeAll','OpenchannelAccount','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','find','userProfileId','autoAssociation','describe','Disposition','getDispositions','findOne','keys','hasOwnProperty','OpenchannelAccountId','removeDispositions','ids','CannedAnswer','removeAnswers','openchannel','CmContact','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','ValidationError','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','DESC','OpenchannelApplication','List','account','applications','Applications','list','orderBy','asc','Contacts','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','messageId','interaction','created','autoclose','push','close','*,*,*,*','AttachmentId','UserId','unshift','agent','forcedOwnership','Start','startRouting','EventManager','notify','addApplications'];(function(_0x8774d4,_0x4c504f){var _0x4c631b=function(_0x3c27f0){while(--_0x3c27f0){_0x8774d4['push'](_0x8774d4['shift']());}};_0x4c631b(++_0x4c504f);}(_0x0edd,0xd1));var _0xd0ed=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x0edd[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0xd0ed('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd0ed('0x1'));var jsonpatch=require(_0xd0ed('0x2'));var rp=require('request-promise');var moment=require(_0xd0ed('0x3'));var BPromise=require(_0xd0ed('0x4'));var Mustache=require(_0xd0ed('0x5'));var util=require(_0xd0ed('0x6'));var path=require(_0xd0ed('0x7'));var sox=require(_0xd0ed('0x8'));var csv=require('to-csv');var ejs=require(_0xd0ed('0x9'));var fs=require('fs');var fs_extra=require(_0xd0ed('0xa'));var _=require(_0xd0ed('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd0ed('0xc'));var deskjs=require(_0xd0ed('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd0ed('0xe'));var Papa=require(_0xd0ed('0xf'));var Redis=require(_0xd0ed('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd0ed('0x11'));var as=require(_0xd0ed('0x12'));var hardwareService=require(_0xd0ed('0x13'));var logger=require(_0xd0ed('0x14'))('api');var utils=require(_0xd0ed('0x15'));var config=require(_0xd0ed('0x16'));var licenseUtil=require(_0xd0ed('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xd0ed('0x18')](config['redis'],{'host':_0xd0ed('0x19'),'port':0x18eb});var socket=require(_0xd0ed('0x1a'))(new Redis(config['redis']));require(_0xd0ed('0x1b'))[_0xd0ed('0x1c')](socket);var jayson=require(_0xd0ed('0x1d'));var client=jayson[_0xd0ed('0x1e')][_0xd0ed('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0xd0ed('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x317991,_0x9190a1,_0x5101e6,_0x1bb396){return new BPromise(function(_0xc8a83,_0xbb3d42){var _0x248130=_0x1bb396||client;return _0x248130[_0xd0ed('0x20')](_0x317991,_0x5101e6)[_0xd0ed('0x21')](function(_0x4eec20){logger[_0xd0ed('0x22')](_0xd0ed('0x23'),_0x9190a1,_0xd0ed('0x24'));logger['debug'](_0xd0ed('0x25'),_0x9190a1,'request\x20sent',JSON[_0xd0ed('0x26')](_0x4eec20));if(_0x4eec20[_0xd0ed('0x27')]){if(_0x4eec20['error'][_0xd0ed('0x28')]===0x1f4){logger[_0xd0ed('0x27')](_0xd0ed('0x23'),_0x9190a1,_0x4eec20[_0xd0ed('0x27')][_0xd0ed('0x29')]);return _0xbb3d42(_0x4eec20[_0xd0ed('0x27')][_0xd0ed('0x29')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x9190a1,_0x4eec20[_0xd0ed('0x27')]['message']);return _0xc8a83(_0x4eec20[_0xd0ed('0x27')][_0xd0ed('0x29')]);}else{logger[_0xd0ed('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x9190a1,_0xd0ed('0x24'));_0xc8a83(_0x4eec20['result'][_0xd0ed('0x29')]);}})[_0xd0ed('0x2a')](function(_0x16b3f2){logger[_0xd0ed('0x27')]('OpenchannelAccount,\x20%s,\x20%s',_0x9190a1,_0x16b3f2);_0xbb3d42(_0x16b3f2);});});}function respondWithStatusCode(_0x33879f,_0x580c22){_0x580c22=_0x580c22||0xcc;return function(_0x501889){if(_0x501889){return _0x33879f[_0xd0ed('0x2b')](_0x580c22);}return _0x33879f[_0xd0ed('0x2c')](_0x580c22)[_0xd0ed('0x2d')]();};}function respondWithResult(_0x99c03e,_0xdb4a1a){_0xdb4a1a=_0xdb4a1a||0xc8;return function(_0x353f5b){if(_0x353f5b){return _0x99c03e['status'](_0xdb4a1a)[_0xd0ed('0x2e')](_0x353f5b);}};}function respondWithFilteredResult(_0x8d124d,_0x43eda9){return function(_0x3b94ef){if(_0x3b94ef){var _0x21d8d5=typeof _0x43eda9['offset']==='undefined'&&typeof _0x43eda9[_0xd0ed('0x2f')]===_0xd0ed('0x30');var _0x5e0cc4=_0x3b94ef[_0xd0ed('0x31')];var _0x4fd21e=_0x21d8d5?0x0:_0x43eda9['offset'];var _0x43ae23=_0x21d8d5?_0x3b94ef[_0xd0ed('0x31')]:_0x43eda9[_0xd0ed('0x32')]+_0x43eda9[_0xd0ed('0x2f')];var _0x1ac4e5;if(_0x43ae23>=_0x5e0cc4){_0x43ae23=_0x5e0cc4;_0x1ac4e5=0xc8;}else{_0x1ac4e5=0xce;}_0x8d124d[_0xd0ed('0x2c')](_0x1ac4e5);return _0x8d124d[_0xd0ed('0x33')]('Content-Range',_0x4fd21e+'-'+_0x43ae23+'/'+_0x5e0cc4)[_0xd0ed('0x2e')](_0x3b94ef);}return null;};}function patchUpdates(_0x3c62bc){return function(_0x4160e3){try{jsonpatch['apply'](_0x4160e3,_0x3c62bc,!![]);}catch(_0x34d437){return BPromise[_0xd0ed('0x34')](_0x34d437);}return _0x4160e3[_0xd0ed('0x35')]();};}function saveUpdates(_0x2ee36d,_0x231181){return function(_0x544b6a){if(_0x544b6a){return _0x544b6a[_0xd0ed('0x36')](_0x2ee36d)['then'](function(_0x592bdf){return _0x592bdf;});}return null;};}function removeEntity(_0x371c22,_0x41dfc0){return function(_0x56af33){if(_0x56af33){return _0x56af33[_0xd0ed('0x37')]()[_0xd0ed('0x21')](function(){var _0x583f63=_0x56af33[_0xd0ed('0x38')]({'plain':!![]});var _0x275e4c='OpenchannelAccounts';return db[_0xd0ed('0x39')][_0xd0ed('0x37')]({'where':{'type':_0x275e4c,'resourceId':_0x583f63['id']}})[_0xd0ed('0x21')](function(){return _0x56af33;});})[_0xd0ed('0x21')](function(){_0x371c22[_0xd0ed('0x2c')](0xcc)[_0xd0ed('0x2d')]();});}};}function handleEntityNotFound(_0x15d64e,_0x56d1e4){return function(_0x1f90b7){if(!_0x1f90b7){_0x15d64e[_0xd0ed('0x2b')](0x194);}return _0x1f90b7;};}function handleError(_0x388b75,_0xb93cbb){_0xb93cbb=_0xb93cbb||0x1f4;return function(_0x18ee3e){logger[_0xd0ed('0x27')](_0x18ee3e[_0xd0ed('0x3a')]);if(_0x18ee3e[_0xd0ed('0x3b')]){delete _0x18ee3e['name'];}_0x388b75[_0xd0ed('0x2c')](_0xb93cbb)[_0xd0ed('0x3c')](_0x18ee3e);};}exports[_0xd0ed('0x3d')]=function(_0x5adff7,_0x31f76a){var _0x53e104={'include':[{'model':db['Pause'],'as':_0xd0ed('0x3e')}]},_0x5935e9={},_0x2caab7={'count':0x0,'rows':[]};var _0x1a04f2=_['map'](db['OpenchannelAccount']['rawAttributes'],function(_0x3490eb){return{'name':_0x3490eb[_0xd0ed('0x3f')],'type':_0x3490eb[_0xd0ed('0x40')][_0xd0ed('0x41')]};});_0x5935e9[_0xd0ed('0x42')]=_[_0xd0ed('0x43')](_0x1a04f2,_0xd0ed('0x3b'));_0x5935e9[_0xd0ed('0x44')]=_['keys'](_0x5adff7[_0xd0ed('0x44')]);_0x5935e9['filters']=_[_0xd0ed('0x45')](_0x5935e9[_0xd0ed('0x42')],_0x5935e9[_0xd0ed('0x44')]);_0x53e104[_0xd0ed('0x46')]=_[_0xd0ed('0x45')](_0x5935e9[_0xd0ed('0x42')],qs['fields'](_0x5adff7[_0xd0ed('0x44')]['fields']));_0x53e104['attributes']=_0x53e104[_0xd0ed('0x46')][_0xd0ed('0x47')]?_0x53e104['attributes']:_0x5935e9[_0xd0ed('0x42')];if(!_0x5adff7[_0xd0ed('0x44')]['hasOwnProperty']('nolimit')){_0x53e104[_0xd0ed('0x2f')]=qs[_0xd0ed('0x2f')](_0x5adff7[_0xd0ed('0x44')][_0xd0ed('0x2f')]);_0x53e104['offset']=qs[_0xd0ed('0x32')](_0x5adff7['query'][_0xd0ed('0x32')]);}_0x53e104[_0xd0ed('0x48')]=qs['sort'](_0x5adff7[_0xd0ed('0x44')][_0xd0ed('0x49')]);_0x53e104['where']=qs[_0xd0ed('0x4a')](_[_0xd0ed('0x4b')](_0x5adff7[_0xd0ed('0x44')],_0x5935e9['filters']),_0x1a04f2);if(_0x5adff7[_0xd0ed('0x44')][_0xd0ed('0x4c')]){_0x53e104[_0xd0ed('0x4d')]=_['merge'](_0x53e104[_0xd0ed('0x4d')],{'$or':_[_0xd0ed('0x43')](_0x1a04f2,function(_0x28bcb7){if(_0x28bcb7[_0xd0ed('0x40')]!==_0xd0ed('0x4e')){var _0x4e4c63={};_0x4e4c63[_0x28bcb7[_0xd0ed('0x3b')]]={'$like':'%'+_0x5adff7[_0xd0ed('0x44')][_0xd0ed('0x4c')]+'%'};return _0x4e4c63;}})});}_0x53e104=_[_0xd0ed('0x4f')]({},_0x53e104,_0x5adff7[_0xd0ed('0x50')]);var _0x4116dd={'where':_0x53e104[_0xd0ed('0x4d')]};return db['OpenchannelAccount'][_0xd0ed('0x31')](_0x4116dd)[_0xd0ed('0x21')](function(_0x32eb07){_0x2caab7[_0xd0ed('0x31')]=_0x32eb07;if(_0x5adff7[_0xd0ed('0x44')]['includeAll']){_0x53e104[_0xd0ed('0x51')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0xd0ed('0x52')](_0x53e104);})[_0xd0ed('0x21')](function(_0x379e44){_0x2caab7[_0xd0ed('0x53')]=_0x379e44;return _0x2caab7;})[_0xd0ed('0x21')](respondWithFilteredResult(_0x31f76a,_0x53e104))[_0xd0ed('0x2a')](handleError(_0x31f76a,null));};exports[_0xd0ed('0x54')]=function(_0x150763,_0x5c3c5e){var _0x2545c7={'raw':![],'where':{'id':_0x150763[_0xd0ed('0x55')]['id']},'include':[{'model':db[_0xd0ed('0x56')],'as':_0xd0ed('0x3e')}]},_0x175993={};_0x175993['model']=_['keys'](db['OpenchannelAccount'][_0xd0ed('0x57')]);_0x175993['query']=_['keys'](_0x150763[_0xd0ed('0x44')]);_0x175993[_0xd0ed('0x4a')]=_[_0xd0ed('0x45')](_0x175993['model'],_0x175993['query']);_0x2545c7['attributes']=_[_0xd0ed('0x45')](_0x175993[_0xd0ed('0x42')],qs[_0xd0ed('0x58')](_0x150763[_0xd0ed('0x44')][_0xd0ed('0x58')]));_0x2545c7[_0xd0ed('0x46')]=_0x2545c7['attributes'][_0xd0ed('0x47')]?_0x2545c7[_0xd0ed('0x46')]:_0x175993['model'];if(_0x150763[_0xd0ed('0x44')][_0xd0ed('0x59')]){_0x2545c7[_0xd0ed('0x51')]=[{'all':!![]}];}_0x2545c7=_[_0xd0ed('0x4f')]({},_0x2545c7,_0x150763[_0xd0ed('0x50')]);return db[_0xd0ed('0x5a')]['find'](_0x2545c7)[_0xd0ed('0x21')](handleEntityNotFound(_0x5c3c5e,null))[_0xd0ed('0x21')](respondWithResult(_0x5c3c5e,null))[_0xd0ed('0x2a')](handleError(_0x5c3c5e,null));};exports[_0xd0ed('0x5b')]=function(_0x3a88dc,_0x31a01e){return db[_0xd0ed('0x5a')]['create'](_0x3a88dc[_0xd0ed('0x5c')],{})[_0xd0ed('0x21')](function(_0x273433){var _0x592ba8=_0x3a88dc[_0xd0ed('0x5d')]['get']({'plain':!![]});if(!_0x592ba8)throw new Error(_0xd0ed('0x5e'));if(_0x592ba8[_0xd0ed('0x5f')]===_0xd0ed('0x5d')){var _0x3aad11=_0x273433['get']({'plain':!![]});var _0x3f283b=_0xd0ed('0x60');return db[_0xd0ed('0x61')][_0xd0ed('0x62')]({'where':{'name':_0x3f283b,'userProfileId':_0x592ba8[_0xd0ed('0x63')]},'raw':!![]})[_0xd0ed('0x21')](function(_0x509d49){if(_0x509d49&&_0x509d49[_0xd0ed('0x64')]===0x0){return db[_0xd0ed('0x39')]['create']({'name':_0x3aad11[_0xd0ed('0x3b')],'resourceId':_0x3aad11['id'],'type':_0x509d49[_0xd0ed('0x3b')],'sectionId':_0x509d49['id']},{})[_0xd0ed('0x21')](function(){return _0x273433;});}else{return _0x273433;}})[_0xd0ed('0x2a')](function(_0x3b0046){logger[_0xd0ed('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b0046);throw _0x3b0046;});}return _0x273433;})['then'](respondWithResult(_0x31a01e,0xc9))[_0xd0ed('0x2a')](handleError(_0x31a01e,null));};exports[_0xd0ed('0x36')]=function(_0x44219e,_0xb4edf0){if(_0x44219e[_0xd0ed('0x5c')]['id']){delete _0x44219e[_0xd0ed('0x5c')]['id'];}return db['OpenchannelAccount'][_0xd0ed('0x62')]({'where':{'id':_0x44219e[_0xd0ed('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0xd0ed('0x3e')}]})['then'](handleEntityNotFound(_0xb4edf0,null))['then'](saveUpdates(_0x44219e[_0xd0ed('0x5c')],null))[_0xd0ed('0x21')](respondWithResult(_0xb4edf0,null))[_0xd0ed('0x2a')](handleError(_0xb4edf0,null));};exports[_0xd0ed('0x37')]=function(_0x408094,_0x356dd3){return db[_0xd0ed('0x5a')][_0xd0ed('0x62')]({'where':{'id':_0x408094[_0xd0ed('0x55')]['id']}})[_0xd0ed('0x21')](handleEntityNotFound(_0x356dd3,null))[_0xd0ed('0x21')](removeEntity(_0x356dd3,null))[_0xd0ed('0x2a')](handleError(_0x356dd3,null));};exports[_0xd0ed('0x65')]=function(_0x2d2bb5,_0x175411){return db[_0xd0ed('0x5a')]['describe']()[_0xd0ed('0x21')](respondWithResult(_0x175411,null))[_0xd0ed('0x2a')](handleError(_0x175411,null));};exports['addDisposition']=function(_0x3ade0e,_0x210119,_0x13f02f){if(_0x3ade0e[_0xd0ed('0x5c')]['id']){delete _0x3ade0e[_0xd0ed('0x5c')]['id'];}return db[_0xd0ed('0x5a')][_0xd0ed('0x62')]({'where':{'id':_0x3ade0e['params']['id']}})['then'](handleEntityNotFound(_0x210119,null))[_0xd0ed('0x21')](function(_0x502d62){if(_0x502d62){_0x3ade0e[_0xd0ed('0x5c')]['OpenchannelAccountId']=_0x502d62['id'];return db[_0xd0ed('0x66')][_0xd0ed('0x5b')](_0x3ade0e[_0xd0ed('0x5c')]);}})[_0xd0ed('0x21')](respondWithResult(_0x210119,null))[_0xd0ed('0x2a')](handleError(_0x210119,null));};exports[_0xd0ed('0x67')]=function(_0x1057d9,_0x2bf5fe,_0x1c0f4c){var _0x4aedd3={'raw':![],'where':{}};var _0x156cc3={};var _0x446739={'count':0x0,'rows':[]};return db[_0xd0ed('0x5a')][_0xd0ed('0x68')]({'where':{'id':_0x1057d9[_0xd0ed('0x55')]['id']}})[_0xd0ed('0x21')](handleEntityNotFound(_0x2bf5fe,null))[_0xd0ed('0x21')](function(_0x5dc85c){if(_0x5dc85c){_0x156cc3[_0xd0ed('0x42')]=_[_0xd0ed('0x69')](db[_0xd0ed('0x66')]['rawAttributes']);_0x156cc3[_0xd0ed('0x44')]=_[_0xd0ed('0x69')](_0x1057d9[_0xd0ed('0x44')]);_0x156cc3[_0xd0ed('0x4a')]=_[_0xd0ed('0x45')](_0x156cc3['model'],_0x156cc3[_0xd0ed('0x44')]);_0x4aedd3[_0xd0ed('0x46')]=_[_0xd0ed('0x45')](_0x156cc3[_0xd0ed('0x42')],qs[_0xd0ed('0x58')](_0x1057d9[_0xd0ed('0x44')][_0xd0ed('0x58')]));_0x4aedd3[_0xd0ed('0x46')]=_0x4aedd3[_0xd0ed('0x46')][_0xd0ed('0x47')]?_0x4aedd3['attributes']:_0x156cc3[_0xd0ed('0x42')];if(!_0x1057d9[_0xd0ed('0x44')][_0xd0ed('0x6a')]('nolimit')){_0x4aedd3['limit']=qs[_0xd0ed('0x2f')](_0x1057d9[_0xd0ed('0x44')][_0xd0ed('0x2f')]);_0x4aedd3[_0xd0ed('0x32')]=qs[_0xd0ed('0x32')](_0x1057d9[_0xd0ed('0x44')][_0xd0ed('0x32')]);}_0x4aedd3['order']=qs['sort'](_0x1057d9[_0xd0ed('0x44')][_0xd0ed('0x49')]);_0x4aedd3['where']=qs[_0xd0ed('0x4a')](_['pick'](_0x1057d9[_0xd0ed('0x44')],_0x156cc3[_0xd0ed('0x4a')]));_0x4aedd3[_0xd0ed('0x4d')][_0xd0ed('0x6b')]=_0x5dc85c['id'];if(_0x1057d9[_0xd0ed('0x44')][_0xd0ed('0x4c')]){_0x4aedd3[_0xd0ed('0x4d')]=_['merge'](_0x4aedd3[_0xd0ed('0x4d')],{'$or':_['map'](_0x4aedd3['attributes'],function(_0x32cde3){var _0x185c8e={};_0x185c8e[_0x32cde3]={'$like':'%'+_0x1057d9[_0xd0ed('0x44')]['filter']+'%'};return _0x185c8e;})});}_0x4aedd3=_[_0xd0ed('0x4f')]({},_0x4aedd3,_0x1057d9[_0xd0ed('0x50')]);return db[_0xd0ed('0x66')][_0xd0ed('0x31')]({'where':_0x4aedd3[_0xd0ed('0x4d')]})[_0xd0ed('0x21')](function(_0x43d0db){_0x446739[_0xd0ed('0x31')]=_0x43d0db;if(_0x1057d9[_0xd0ed('0x44')][_0xd0ed('0x59')]){_0x4aedd3['include']=[{'all':!![]}];}return db[_0xd0ed('0x66')][_0xd0ed('0x52')](_0x4aedd3);})[_0xd0ed('0x21')](function(_0x1fa6e0){_0x446739[_0xd0ed('0x53')]=_0x1fa6e0;return _0x446739;});}})['then'](respondWithFilteredResult(_0x2bf5fe,_0x4aedd3))[_0xd0ed('0x2a')](handleError(_0x2bf5fe,null));};exports[_0xd0ed('0x6c')]=function(_0x328fba,_0x7542ab,_0x4ea2ee){return db[_0xd0ed('0x5a')]['find']({'where':{'id':_0x328fba[_0xd0ed('0x55')]['id']}})[_0xd0ed('0x21')](handleEntityNotFound(_0x7542ab,null))['then'](function(_0x4b1dc5){if(_0x4b1dc5){return _0x4b1dc5[_0xd0ed('0x6c')](_0x328fba[_0xd0ed('0x44')][_0xd0ed('0x6d')]);}})[_0xd0ed('0x21')](respondWithStatusCode(_0x7542ab,null))[_0xd0ed('0x2a')](handleError(_0x7542ab,null));};exports['addAnswer']=function(_0x482222,_0x3b5470,_0x198a63){if(_0x482222['body']['id']){delete _0x482222[_0xd0ed('0x5c')]['id'];}return db['OpenchannelAccount'][_0xd0ed('0x62')]({'where':{'id':_0x482222[_0xd0ed('0x55')]['id']}})['then'](handleEntityNotFound(_0x3b5470,null))[_0xd0ed('0x21')](function(_0x30cfbd){if(_0x30cfbd){_0x482222['body']['OpenchannelAccountId']=_0x30cfbd['id'];return db[_0xd0ed('0x6e')]['create'](_0x482222[_0xd0ed('0x5c')]);}})[_0xd0ed('0x21')](respondWithResult(_0x3b5470,null))[_0xd0ed('0x2a')](handleError(_0x3b5470,null));};exports['getAnswers']=function(_0x2d75f1,_0x4df527,_0x50465b){var _0x442841={'raw':![],'where':{}};var _0x2a184b={};var _0x45bf49={'count':0x0,'rows':[]};return db[_0xd0ed('0x5a')][_0xd0ed('0x68')]({'where':{'id':_0x2d75f1[_0xd0ed('0x55')]['id']}})[_0xd0ed('0x21')](handleEntityNotFound(_0x4df527,null))['then'](function(_0x337350){if(_0x337350){_0x2a184b[_0xd0ed('0x42')]=_[_0xd0ed('0x69')](db[_0xd0ed('0x6e')][_0xd0ed('0x57')]);_0x2a184b[_0xd0ed('0x44')]=_[_0xd0ed('0x69')](_0x2d75f1[_0xd0ed('0x44')]);_0x2a184b[_0xd0ed('0x4a')]=_[_0xd0ed('0x45')](_0x2a184b[_0xd0ed('0x42')],_0x2a184b[_0xd0ed('0x44')]);_0x442841[_0xd0ed('0x46')]=_['intersection'](_0x2a184b[_0xd0ed('0x42')],qs[_0xd0ed('0x58')](_0x2d75f1[_0xd0ed('0x44')][_0xd0ed('0x58')]));_0x442841[_0xd0ed('0x46')]=_0x442841[_0xd0ed('0x46')][_0xd0ed('0x47')]?_0x442841[_0xd0ed('0x46')]:_0x2a184b[_0xd0ed('0x42')];if(!_0x2d75f1[_0xd0ed('0x44')][_0xd0ed('0x6a')]('nolimit')){_0x442841[_0xd0ed('0x2f')]=qs[_0xd0ed('0x2f')](_0x2d75f1[_0xd0ed('0x44')][_0xd0ed('0x2f')]);_0x442841[_0xd0ed('0x32')]=qs[_0xd0ed('0x32')](_0x2d75f1[_0xd0ed('0x44')]['offset']);}_0x442841[_0xd0ed('0x48')]=qs[_0xd0ed('0x49')](_0x2d75f1[_0xd0ed('0x44')][_0xd0ed('0x49')]);_0x442841[_0xd0ed('0x4d')]=qs['filters'](_[_0xd0ed('0x4b')](_0x2d75f1[_0xd0ed('0x44')],_0x2a184b[_0xd0ed('0x4a')]));_0x442841['where']['OpenchannelAccountId']=_0x337350['id'];if(_0x2d75f1[_0xd0ed('0x44')][_0xd0ed('0x4c')]){_0x442841[_0xd0ed('0x4d')]=_[_0xd0ed('0x4f')](_0x442841['where'],{'$or':_[_0xd0ed('0x43')](_0x442841[_0xd0ed('0x46')],function(_0x14f460){var _0x2e9956={};_0x2e9956[_0x14f460]={'$like':'%'+_0x2d75f1[_0xd0ed('0x44')][_0xd0ed('0x4c')]+'%'};return _0x2e9956;})});}_0x442841=_[_0xd0ed('0x4f')]({},_0x442841,_0x2d75f1[_0xd0ed('0x50')]);return db[_0xd0ed('0x6e')][_0xd0ed('0x31')]({'where':_0x442841[_0xd0ed('0x4d')]})[_0xd0ed('0x21')](function(_0x5062cc){_0x45bf49[_0xd0ed('0x31')]=_0x5062cc;if(_0x2d75f1[_0xd0ed('0x44')][_0xd0ed('0x59')]){_0x442841[_0xd0ed('0x51')]=[{'all':!![]}];}return db[_0xd0ed('0x6e')]['findAll'](_0x442841);})[_0xd0ed('0x21')](function(_0xc8bed0){_0x45bf49[_0xd0ed('0x53')]=_0xc8bed0;return _0x45bf49;});}})[_0xd0ed('0x21')](respondWithFilteredResult(_0x4df527,_0x442841))[_0xd0ed('0x2a')](handleError(_0x4df527,null));};exports[_0xd0ed('0x6f')]=function(_0x57f260,_0x30f8e4,_0x16be5d){return db[_0xd0ed('0x5a')]['find']({'where':{'id':_0x57f260[_0xd0ed('0x55')]['id']}})['then'](handleEntityNotFound(_0x30f8e4,null))[_0xd0ed('0x21')](function(_0x46471e){if(_0x46471e){return _0x46471e[_0xd0ed('0x6f')](_0x57f260[_0xd0ed('0x44')][_0xd0ed('0x6d')]);}})[_0xd0ed('0x21')](respondWithStatusCode(_0x30f8e4,null))['catch'](handleError(_0x30f8e4,null));};exports['notify']=function(_0x3620ae,_0x3d3b56,_0x34f270){var _0x210beb={'body':_0x3620ae[_0xd0ed('0x5c')],'channel':_0xd0ed('0x70')};var _0x3c63c9=[];var _0x244d17=[];var _0x81da26={};var _0x2a1a1e=![];return db[_0xd0ed('0x71')][_0xd0ed('0x65')]()[_0xd0ed('0x21')](function(_0x16b02b){if(!_0x16b02b){throw new db[(_0xd0ed('0x72'))]['ValidationError'](_0xd0ed('0x73'));}_0x3c63c9=_[_0xd0ed('0x74')](_[_0xd0ed('0x69')](_0x16b02b),['createdAt',_0xd0ed('0x75')]);_0x244d17=_[_0xd0ed('0x74')](_[_0xd0ed('0x69')](_0x16b02b),[_0xd0ed('0x76'),_0xd0ed('0x75'),_0xd0ed('0x77'),_0xd0ed('0x78')]);if(_0x3620ae['body']['id']){delete _0x3620ae[_0xd0ed('0x5c')]['id'];}if(_[_0xd0ed('0x79')](_0x3620ae['body']['from'])){throw new db[(_0xd0ed('0x72'))]['ValidationError'](_0xd0ed('0x7a'));}if(_[_0xd0ed('0x79')](_0x3620ae['body'][_0xd0ed('0x5c')])||_0x3620ae[_0xd0ed('0x5c')]['body']===''){throw new db['Sequelize'][(_0xd0ed('0x7b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xd0ed('0x79')](_0x3620ae[_0xd0ed('0x5c')]['mapKey'])){throw new db['Sequelize']['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x244d17);}if(!_['includes'](_0x244d17,_0x3620ae[_0xd0ed('0x5c')][_0xd0ed('0x7c')])){throw new db['Sequelize']['ValidationError'](_0xd0ed('0x7d')+_0x244d17);}_0x81da26[_0x3620ae[_0xd0ed('0x5c')][_0xd0ed('0x7c')]]=_0x3620ae[_0xd0ed('0x5c')][_0xd0ed('0x7e')];})[_0xd0ed('0x21')](function(){return db['OpenchannelAccount'][_0xd0ed('0x62')]({'where':{'id':_0x3620ae[_0xd0ed('0x55')]['id']},'include':[{'model':db[_0xd0ed('0x7f')],'as':'List','include':[{'model':db[_0xd0ed('0x71')],'as':'Contacts','where':_0x81da26,'limit':0x1,'order':[['updatedAt',_0xd0ed('0x80')]]}]},{'model':db[_0xd0ed('0x81')],'as':'Applications'}]});})[_0xd0ed('0x21')](handleEntityNotFound(_0x3d3b56,null))[_0xd0ed('0x21')](function(_0x47e5aa){if(_0x47e5aa&&_0x47e5aa[_0xd0ed('0x82')]){_0x210beb[_0xd0ed('0x83')]=_0x47e5aa;_0x210beb[_0xd0ed('0x84')]=_0x47e5aa[_0xd0ed('0x85')];_0x210beb[_0xd0ed('0x86')]=_0x47e5aa[_0xd0ed('0x82')];_0x210beb[_0xd0ed('0x84')]=_[_0xd0ed('0x87')](_0x210beb[_0xd0ed('0x84')],['priority'],[_0xd0ed('0x88')]);if(_0x210beb[_0xd0ed('0x83')]['Applications']){delete _0x210beb[_0xd0ed('0x83')][_0xd0ed('0x85')];}if(_0x210beb[_0xd0ed('0x83')][_0xd0ed('0x82')]&&_0x210beb['account'][_0xd0ed('0x82')][_0xd0ed('0x89')]['length']){return _0x210beb['account']['List'][_0xd0ed('0x89')][0x0];}var _0x19739a=_[_0xd0ed('0x18')](_0x3620ae['body'],{'firstName':_0x3620ae['body'][_0xd0ed('0x7e')],'ListId':_0x47e5aa['ListId']});_0x19739a[_0x3620ae[_0xd0ed('0x5c')][_0xd0ed('0x7c')]]=_0x3620ae[_0xd0ed('0x5c')][_0xd0ed('0x7e')];return db['CmContact'][_0xd0ed('0x5b')](_0x19739a,{'fields':_0x3c63c9,'raw':!![]});}})[_0xd0ed('0x21')](handleEntityNotFound(_0x3d3b56,null))[_0xd0ed('0x21')](function(_0xbb41e7){_0x210beb[_0xd0ed('0x8a')]=_0xbb41e7;if(_0xbb41e7){var _0x5647ff={'ContactId':_0xbb41e7['id'],'OpenchannelAccountId':_0x3620ae['params']['id'],'from':(_0xbb41e7['firstName']||'')+'\x20'+(_0xbb41e7[_0xd0ed('0x8b')]||'')};var _0x300cdc={'OpenchannelAccountId':_0x3620ae[_0xd0ed('0x55')]['id'],'closed':![]};if(_0x3620ae[_0xd0ed('0x5c')][_0xd0ed('0x8c')]){_0x300cdc[_0xd0ed('0x8c')]=_0x3620ae['body'][_0xd0ed('0x8c')];return db[_0xd0ed('0x8d')][_0xd0ed('0x62')]({'where':_0x300cdc})[_0xd0ed('0x21')](function(_0x2db473){if(_0x2db473){return[_0x2db473,![]];}_0x5647ff[_0xd0ed('0x8c')]=_0x3620ae[_0xd0ed('0x5c')][_0xd0ed('0x8c')];_0x5647ff[_0xd0ed('0x8e')]=_0x3620ae['body'][_0xd0ed('0x8e')];return db[_0xd0ed('0x8d')][_0xd0ed('0x5b')](_0x5647ff)[_0xd0ed('0x21')](function(_0x5a6e6f){return[_0x5a6e6f,!![]];});});}else{_0x300cdc['threadId']=null;}_0x300cdc[_0xd0ed('0x8f')]=_0xbb41e7['id'];return db[_0xd0ed('0x8d')]['find']({'where':_0x300cdc})[_0xd0ed('0x21')](function(_0x1e73c2){if(_0x1e73c2){return[_0x1e73c2,![]];}return db[_0xd0ed('0x8d')][_0xd0ed('0x5b')](_0x5647ff)[_0xd0ed('0x21')](function(_0x4104fd){return[_0x4104fd,!![]];});});}})[_0xd0ed('0x90')](function(_0x32243e,_0x4df277){if(_0x32243e){_0x2a1a1e=_0x4df277;if(!_0x4df277){var _0x92c7={'from':(_0x210beb[_0xd0ed('0x8a')][_0xd0ed('0x91')]||'')+'\x20'+(_0x210beb['contact'][_0xd0ed('0x8b')]||'')};if(_0x3620ae[_0xd0ed('0x5c')][_0xd0ed('0x8c')]&&_0x3620ae[_0xd0ed('0x5c')]['messageId']&&_0x3620ae[_0xd0ed('0x5c')][_0xd0ed('0x8c')]!=_0x3620ae[_0xd0ed('0x5c')][_0xd0ed('0x92')]){_0x92c7['threadId']=_0x3620ae[_0xd0ed('0x5c')][_0xd0ed('0x92')];}return _0x32243e[_0xd0ed('0x36')](_0x92c7);}else{return _0x32243e;}}})['then'](function(_0x266da5){_0x210beb[_0xd0ed('0x93')]=_0x266da5[_0xd0ed('0x38')]({'plain':!![]});_0x210beb[_0xd0ed('0x93')][_0xd0ed('0x94')]=_0x2a1a1e;if(_0x210beb[_0xd0ed('0x93')][_0xd0ed('0x94')]){if(_0x210beb['account'][_0xd0ed('0x95')]){_0x210beb[_0xd0ed('0x84')][_0xd0ed('0x96')]({'id':0x0,'priority':_0x210beb[_0xd0ed('0x84')]['length']+0x1,'app':_0xd0ed('0x97'),'appdata':'unmanaged','interval':_0xd0ed('0x98')});}}return db['OpenchannelMessage'][_0xd0ed('0x5b')]({'body':_0x3620ae[_0xd0ed('0x5c')][_0xd0ed('0x5c')],'OpenchannelAccountId':_0x3620ae['params']['id'],'OpenchannelInteractionId':_0x266da5['id'],'direction':'in','ContactId':_0x210beb[_0xd0ed('0x8a')]['id'],'AttachmentId':_0x3620ae[_0xd0ed('0x5c')][_0xd0ed('0x99')]});})['then'](function(_0x4282e6){_0x210beb['message']=_0x4282e6;if(_0x210beb['interaction']['UserId']){return db['User']['find']({'attributes':['id',_0xd0ed('0x3b')],'where':{'id':_0x210beb['interaction'][_0xd0ed('0x9a')]}})[_0xd0ed('0x21')](function(_0x4b7e8e){if(_0x4b7e8e){_0x210beb[_0xd0ed('0x84')][_0xd0ed('0x9b')]({'id':0x0,'priority':0x0,'app':_0xd0ed('0x9c'),'appdata':_0x4b7e8e[_0xd0ed('0x3b')]+','+(_0x210beb['account']['waitForTheAssignedAgent']||0xa),'interval':_0xd0ed('0x98')});_0x210beb[_0xd0ed('0x9d')]=![];}return respondWithRpcPromise(_0xd0ed('0x9e'),'startRouting',_0x210beb);});}return respondWithRpcPromise(_0xd0ed('0x9e'),_0xd0ed('0x9f'),_0x210beb);})[_0xd0ed('0x21')](function(_0x4fa26c){respondWithRpcPromise(_0xd0ed('0xa0'),'EventManager',{'event':_0xd0ed('0xa1'),'message':_0x4fa26c},client9002);return _0x4fa26c;})['then'](respondWithResult(_0x3d3b56,null))[_0xd0ed('0x2a')](handleError(_0x3d3b56,null));};exports[_0xd0ed('0xa2')]=function(_0x161eb6,_0x425e38,_0x20e40d){return db[_0xd0ed('0x5a')][_0xd0ed('0x68')]({'where':{'id':_0x161eb6[_0xd0ed('0x55')]['id']}})[_0xd0ed('0x21')](handleEntityNotFound(_0x425e38,null))[_0xd0ed('0x21')](function(_0x1a9faf){if(_0x1a9faf){return db[_0xd0ed('0xa3')][_0xd0ed('0xa4')](function(_0x3c74ac){return db[_0xd0ed('0x81')]['destroy']({'where':{'OpenchannelAccountId':_0x161eb6['params']['id']},'transaction':_0x3c74ac})[_0xd0ed('0x21')](function(_0x34ec35){var _0x598ae0=_[_0xd0ed('0x43')](_0x161eb6[_0xd0ed('0x5c')],function(_0x450176){_0x450176[_0xd0ed('0x6b')]=_0x161eb6[_0xd0ed('0x55')]['id'];return _0x450176;});return db[_0xd0ed('0x81')][_0xd0ed('0xa5')](_0x598ae0,{'transaction':_0x3c74ac});});})[_0xd0ed('0x21')](function(){return db[_0xd0ed('0x81')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x161eb6[_0xd0ed('0x55')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x425e38,null))['catch'](handleError(_0x425e38,null));};exports['getApplications']=function(_0x153949,_0x59a1f8,_0x283da8){var _0x4caa60={};var _0xffcf4a={};var _0x29a1a7;var _0x39c078;return db['OpenchannelAccount'][_0xd0ed('0x68')]({'where':{'id':_0x153949['params']['id']}})['then'](handleEntityNotFound(_0x59a1f8,null))['then'](function(_0x4ab1c8){if(_0x4ab1c8){_0x29a1a7=_0x4ab1c8;_0xffcf4a[_0xd0ed('0x42')]=_[_0xd0ed('0x69')](db[_0xd0ed('0x81')][_0xd0ed('0x57')]);_0xffcf4a[_0xd0ed('0x44')]=_[_0xd0ed('0x69')](_0x153949[_0xd0ed('0x44')]);_0xffcf4a[_0xd0ed('0x4a')]=_[_0xd0ed('0x45')](_0xffcf4a[_0xd0ed('0x42')],_0xffcf4a[_0xd0ed('0x44')]);_0x4caa60[_0xd0ed('0x46')]=_[_0xd0ed('0x45')](_0xffcf4a[_0xd0ed('0x42')],qs[_0xd0ed('0x58')](_0x153949['query']['fields']));_0x4caa60[_0xd0ed('0x46')]=_0x4caa60['attributes'][_0xd0ed('0x47')]?_0x4caa60[_0xd0ed('0x46')]:_0xffcf4a['model'];_0x4caa60[_0xd0ed('0x48')]=qs[_0xd0ed('0x49')](_0x153949[_0xd0ed('0x44')][_0xd0ed('0x49')]);_0x4caa60['where']=qs['filters'](_[_0xd0ed('0x4b')](_0x153949['query'],_0xffcf4a[_0xd0ed('0x4a')]));if(_0x153949[_0xd0ed('0x44')]['filter']){_0x4caa60[_0xd0ed('0x4d')]=_[_0xd0ed('0x4f')](_0x4caa60[_0xd0ed('0x4d')],{'$or':_[_0xd0ed('0x43')](_0x4caa60[_0xd0ed('0x46')],function(_0x513b89){var _0x185ac1={};_0x185ac1[_0x513b89]={'$like':'%'+_0x153949[_0xd0ed('0x44')][_0xd0ed('0x4c')]+'%'};return _0x185ac1;})});}_0x4caa60=_[_0xd0ed('0x4f')]({},_0x4caa60,_0x153949[_0xd0ed('0x50')]);return _0x29a1a7[_0xd0ed('0xa6')](_0x4caa60);}})['then'](function(_0x5c606b){if(_0x5c606b){_0x39c078=_0x5c606b[_0xd0ed('0x47')];if(!_0x153949[_0xd0ed('0x44')][_0xd0ed('0x6a')](_0xd0ed('0xa7'))){_0x4caa60['limit']=qs[_0xd0ed('0x2f')](_0x153949['query'][_0xd0ed('0x2f')]);_0x4caa60['offset']=qs[_0xd0ed('0x32')](_0x153949['query'][_0xd0ed('0x32')]);}return _0x29a1a7[_0xd0ed('0xa6')](_0x4caa60);}})['then'](function(_0x46dcb4){if(_0x46dcb4){return _0x46dcb4?{'count':_0x39c078,'rows':_0x46dcb4}:null;}})[_0xd0ed('0x21')](respondWithResult(_0x59a1f8,null))[_0xd0ed('0x2a')](handleError(_0x59a1f8,null));};exports[_0xd0ed('0xa8')]=function(_0xe63da8,_0x581ab1,_0x1d9a7b){var _0xafb952={'raw':![],'where':{}};var _0x19f9b8={};var _0x1c5676={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0xe63da8[_0xd0ed('0x55')]['id']}})[_0xd0ed('0x21')](handleEntityNotFound(_0x581ab1,null))['then'](function(_0x2a0eea){if(_0x2a0eea){_0x19f9b8[_0xd0ed('0x42')]=_['keys'](db[_0xd0ed('0x8d')][_0xd0ed('0x57')]);_0x19f9b8['query']=_['keys'](_0xe63da8[_0xd0ed('0x44')]);_0x19f9b8[_0xd0ed('0x4a')]=_['intersection'](_0x19f9b8['model'],_0x19f9b8['query']);_0xafb952[_0xd0ed('0x46')]=_[_0xd0ed('0x45')](_0x19f9b8[_0xd0ed('0x42')],qs[_0xd0ed('0x58')](_0xe63da8['query']['fields']));_0xafb952[_0xd0ed('0x46')]=_0xafb952['attributes'][_0xd0ed('0x47')]?_0xafb952['attributes']:_0x19f9b8[_0xd0ed('0x42')];if(!_0xe63da8[_0xd0ed('0x44')]['hasOwnProperty'](_0xd0ed('0xa7'))){_0xafb952[_0xd0ed('0x2f')]=qs['limit'](_0xe63da8[_0xd0ed('0x44')][_0xd0ed('0x2f')]);_0xafb952[_0xd0ed('0x32')]=qs[_0xd0ed('0x32')](_0xe63da8[_0xd0ed('0x44')][_0xd0ed('0x32')]);}_0xafb952['order']=qs[_0xd0ed('0x49')](_0xe63da8[_0xd0ed('0x44')][_0xd0ed('0x49')]);_0xafb952[_0xd0ed('0x4d')]=qs[_0xd0ed('0x4a')](_[_0xd0ed('0x4b')](_0xe63da8[_0xd0ed('0x44')],_0x19f9b8[_0xd0ed('0x4a')]));_0xafb952[_0xd0ed('0x4d')][_0xd0ed('0x6b')]=_0x2a0eea['id'];if(_0xe63da8[_0xd0ed('0x44')][_0xd0ed('0x4c')]){_0xafb952[_0xd0ed('0x4d')]=_[_0xd0ed('0x4f')](_0xafb952[_0xd0ed('0x4d')],{'$or':_[_0xd0ed('0x43')](_0xafb952[_0xd0ed('0x46')],function(_0x22366b){var _0x3c3508={};_0x3c3508[_0x22366b]={'$like':'%'+_0xe63da8[_0xd0ed('0x44')][_0xd0ed('0x4c')]+'%'};return _0x3c3508;})});}_0xafb952=_[_0xd0ed('0x4f')]({},_0xafb952,_0xe63da8[_0xd0ed('0x50')]);return db[_0xd0ed('0x8d')]['count']({'where':_0xafb952[_0xd0ed('0x4d')]})[_0xd0ed('0x21')](function(_0x3cad28){_0x1c5676[_0xd0ed('0x31')]=_0x3cad28;if(_0xe63da8['query']['includeAll']){_0xafb952[_0xd0ed('0x51')]=[{'model':db[_0xd0ed('0x71')],'as':_0xd0ed('0xa9'),'required':![]},{'model':db[_0xd0ed('0xaa')],'as':'Owner','attributes':[_0xd0ed('0x3b'),_0xd0ed('0xab'),_0xd0ed('0xac')],'required':![]},{'model':db[_0xd0ed('0xad')],'as':_0xd0ed('0xae'),'attributes':['id',_0xd0ed('0x3b'),'color'],'where':_0xe63da8[_0xd0ed('0x44')][_0xd0ed('0xaf')]?{'id':_0xe63da8[_0xd0ed('0x44')][_0xd0ed('0xaf')]}:undefined,'required':_0xe63da8[_0xd0ed('0x44')][_0xd0ed('0xaf')]?!![]:![]}];}return db[_0xd0ed('0x8d')][_0xd0ed('0x52')](_0xafb952);})['then'](function(_0x13d328){_0x1c5676[_0xd0ed('0x53')]=_0x13d328;return _0x1c5676;});}})['then'](respondWithFilteredResult(_0x581ab1,_0xafb952))[_0xd0ed('0x2a')](handleError(_0x581ab1,null));};exports['addAgents']=function(_0x4915b3,_0x3f203a,_0x144ffc){return db[_0xd0ed('0x5a')][_0xd0ed('0x62')]({'where':{'id':_0x4915b3['params']['id']}})[_0xd0ed('0x21')](handleEntityNotFound(_0x3f203a,null))[_0xd0ed('0x21')](function(_0x15ac01){if(_0x15ac01){return _0x15ac01[_0xd0ed('0xb0')](_0x4915b3[_0xd0ed('0x5c')]['ids'],_['omit'](_0x4915b3['body'],['ids','id'])||{})[_0xd0ed('0x90')](function(_0x47cd71){for(var _0x31720f=0x0;_0x31720f<_0x4915b3[_0xd0ed('0x5c')]['ids'][_0xd0ed('0x47')];_0x31720f+=0x1){socket[_0xd0ed('0xb1')]('userOpenchannelAccount:save',{'UserId':Number(_0x4915b3[_0xd0ed('0x5c')][_0xd0ed('0x6d')][_0x31720f]),'OpenchannelAccountId':Number(_0x4915b3[_0xd0ed('0x55')]['id'])});}return _0x47cd71;});}})[_0xd0ed('0x21')](respondWithResult(_0x3f203a,null))['catch'](handleError(_0x3f203a,null));};exports[_0xd0ed('0xb2')]=function(_0x222c69,_0x1979ca,_0x2e79d6){return db[_0xd0ed('0x5a')]['find']({'where':{'id':_0x222c69[_0xd0ed('0x55')]['id']}})[_0xd0ed('0x21')](handleEntityNotFound(_0x1979ca,null))[_0xd0ed('0x21')](function(_0x5539ef){if(_0x5539ef){return _0x5539ef[_0xd0ed('0xb2')](_0x222c69[_0xd0ed('0x44')][_0xd0ed('0x6d')])['then'](function(){if(_[_0xd0ed('0xb3')](_0x222c69[_0xd0ed('0x44')][_0xd0ed('0x6d')])){for(var _0x512872=0x0;_0x512872<_0x222c69[_0xd0ed('0x44')]['ids']['length'];_0x512872+=0x1){socket[_0xd0ed('0xb1')](_0xd0ed('0xb4'),{'UserId':Number(_0x222c69[_0xd0ed('0x44')][_0xd0ed('0x6d')][_0x512872]),'OpenchannelAccountId':Number(_0x222c69['params']['id'])});}}else{socket[_0xd0ed('0xb1')](_0xd0ed('0xb4'),{'UserId':Number(_0x222c69['query']['ids']),'OpenchannelAccountId':Number(_0x222c69[_0xd0ed('0x55')]['id'])});}});}})[_0xd0ed('0x21')](respondWithStatusCode(_0x1979ca,null))[_0xd0ed('0x2a')](handleError(_0x1979ca,null));};exports[_0xd0ed('0xb5')]=function(_0x4c6ae8,_0x1092fa,_0x11b8d2){var _0x6d131b={};var _0x56946a={};var _0x3f083b;var _0x428a2a;return db[_0xd0ed('0x5a')][_0xd0ed('0x68')]({'where':{'id':_0x4c6ae8[_0xd0ed('0x55')]['id']}})[_0xd0ed('0x21')](handleEntityNotFound(_0x1092fa,null))[_0xd0ed('0x21')](function(_0x5440ca){if(_0x5440ca){_0x3f083b=_0x5440ca;_0x56946a[_0xd0ed('0x42')]=_[_0xd0ed('0x69')](db[_0xd0ed('0xaa')]['rawAttributes']);_0x56946a['query']=_[_0xd0ed('0x69')](_0x4c6ae8[_0xd0ed('0x44')]);_0x56946a[_0xd0ed('0x4a')]=_[_0xd0ed('0x45')](_0x56946a[_0xd0ed('0x42')],_0x56946a[_0xd0ed('0x44')]);_0x6d131b[_0xd0ed('0x46')]=_[_0xd0ed('0x45')](_0x56946a[_0xd0ed('0x42')],qs[_0xd0ed('0x58')](_0x4c6ae8['query'][_0xd0ed('0x58')]));_0x6d131b['attributes']=_0x6d131b[_0xd0ed('0x46')]['length']?_0x6d131b[_0xd0ed('0x46')]:_0x56946a[_0xd0ed('0x42')];_0x6d131b[_0xd0ed('0x48')]=qs[_0xd0ed('0x49')](_0x4c6ae8[_0xd0ed('0x44')][_0xd0ed('0x49')]);_0x6d131b[_0xd0ed('0x4d')]=qs[_0xd0ed('0x4a')](_[_0xd0ed('0x4b')](_0x4c6ae8[_0xd0ed('0x44')],_0x56946a['filters']));if(_0x4c6ae8[_0xd0ed('0x44')]['filter']){_0x6d131b[_0xd0ed('0x4d')]=_[_0xd0ed('0x4f')](_0x6d131b['where'],{'$or':_['map'](_0x6d131b[_0xd0ed('0x46')],function(_0x5b5973){var _0x31548f={};_0x31548f[_0x5b5973]={'$like':'%'+_0x4c6ae8[_0xd0ed('0x44')][_0xd0ed('0x4c')]+'%'};return _0x31548f;})});}_0x6d131b=_[_0xd0ed('0x4f')]({},_0x6d131b,_0x4c6ae8[_0xd0ed('0x50')]);return _0x3f083b['getAgents'](_0x6d131b);}})[_0xd0ed('0x21')](function(_0x2839b4){if(_0x2839b4){_0x428a2a=_0x2839b4[_0xd0ed('0x47')];if(!_0x4c6ae8[_0xd0ed('0x44')]['hasOwnProperty'](_0xd0ed('0xa7'))){_0x6d131b[_0xd0ed('0x2f')]=qs[_0xd0ed('0x2f')](_0x4c6ae8[_0xd0ed('0x44')]['limit']);_0x6d131b[_0xd0ed('0x32')]=qs['offset'](_0x4c6ae8[_0xd0ed('0x44')][_0xd0ed('0x32')]);}return _0x3f083b[_0xd0ed('0xb5')](_0x6d131b);}})['then'](function(_0x2d4985){if(_0x2d4985){return _0x2d4985?{'count':_0x428a2a,'rows':_0x2d4985}:null;}})[_0xd0ed('0x21')](respondWithResult(_0x1092fa,null))[_0xd0ed('0x2a')](handleError(_0x1092fa,null));};exports['send']=function(_0x135392,_0x2940da,_0x3ccc66){var _0x2891af,_0x1b2f8a,_0xe12cd0;if(_[_0xd0ed('0x79')](_0x135392[_0xd0ed('0x5c')]['body'])||_0x135392[_0xd0ed('0x5c')][_0xd0ed('0x5c')]===''){throw new db[(_0xd0ed('0x72'))][(_0xd0ed('0x7b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xd0ed('0x79')](_0x135392['body']['to'])){}_0x2891af=_0x135392[_0xd0ed('0x5c')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x135392[_0xd0ed('0x55')]['id']}})[_0xd0ed('0x21')](handleEntityNotFound(_0x2940da,null))[_0xd0ed('0x21')](function(_0x252dc9){if(_0x252dc9){return db[_0xd0ed('0x5a')][_0xd0ed('0x62')]({'where':{'id':_0x252dc9['id']},'include':[{'model':db[_0xd0ed('0x7f')],'as':_0xd0ed('0x82'),'include':[{'model':db[_0xd0ed('0x71')],'as':_0xd0ed('0x89'),'where':{[_0x252dc9[_0xd0ed('0x7c')]]:_0x2891af},'limit':0x1,'order':[[_0xd0ed('0x75'),_0xd0ed('0x80')]]}]}]})[_0xd0ed('0x21')](handleEntityNotFound(_0x2940da,null))[_0xd0ed('0x21')](function(_0x3ad19e){if(_0x3ad19e&&_0x3ad19e['List']){_0x1b2f8a=_0x3ad19e[_0xd0ed('0x38')]({'plain':!![]});if(_0x1b2f8a['List']&&_0x1b2f8a[_0xd0ed('0x82')][_0xd0ed('0x89')]['length']){return _0x1b2f8a['List'][_0xd0ed('0x89')][0x0];}return db[_0xd0ed('0x71')][_0xd0ed('0x5b')](_[_0xd0ed('0x18')](_0x135392['body'],{'firstName':_0x2891af,[_0x3ad19e[_0xd0ed('0x7c')]]:_0x2891af,'phone':_0x2891af,'ListId':_0x1b2f8a['ListId']}));}})[_0xd0ed('0x21')](handleEntityNotFound(_0x2940da,null))['then'](function(_0xd1a2b0){if(_0xd1a2b0){_0xe12cd0=_0xd1a2b0;return db[_0xd0ed('0x8d')][_0xd0ed('0x62')]({'where':{'ContactId':_0xe12cd0['id'],'closed':![],'OpenchannelAccountId':_0x1b2f8a['id']}})['then'](function(_0x14cab1){if(_0x14cab1){return[_0x14cab1,![]];}return db[_0xd0ed('0x8d')][_0xd0ed('0x5b')]({'UserId':_0x135392[_0xd0ed('0x5d')]['id'],'ContactId':_0xe12cd0['id'],'OpenchannelAccountId':_0x1b2f8a['id'],'lastMsgDirection':_0xd0ed('0xb6'),'Messages':[_[_0xd0ed('0x4f')](_0x135392[_0xd0ed('0x5c')],{'read':![],'body':_0x135392['body'][_0xd0ed('0x5c')],'OpenchannelAccountId':_0x1b2f8a['id'],'UserId':_0x135392[_0xd0ed('0x5d')]['id'],'ContactId':_0xe12cd0['id']})]},{'include':[{'model':db[_0xd0ed('0xb7')],'as':_0xd0ed('0xb8')}]})[_0xd0ed('0x21')](function(_0x556d27){return[_0x556d27,!![]];});});}})[_0xd0ed('0x90')](function(_0x3b683c,_0xe99e97){if(_0xe99e97){return _0x3b683c;}return db['OpenchannelMessage']['create'](_[_0xd0ed('0x4f')](_0x135392[_0xd0ed('0x5c')],{'read':![],'body':_0x135392[_0xd0ed('0x5c')][_0xd0ed('0x5c')],'OpenchannelAccountId':_0x1b2f8a['id'],'OpenchannelInteractionId':_0x3b683c['id'],'UserId':_0x135392[_0xd0ed('0x5d')]['id'],'ContactId':_0xe12cd0['id']}))[_0xd0ed('0x21')](function(_0x1b90e6){_0x3b683c[_0xd0ed('0xb9')][_0xd0ed('0xb8')]=[];_0x3b683c[_0xd0ed('0xb9')][_0xd0ed('0xb8')][_0xd0ed('0x96')](_0x1b90e6[_0xd0ed('0xb9')]);return _0x3b683c;});});}})[_0xd0ed('0x21')](respondWithResult(_0x2940da,null))[_0xd0ed('0x2a')](handleError(_0x2940da,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 99908f9..9044aa7 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 _0x70e0=['emit','events','../../mysqldb','OpenchannelAccount','update','remove'];(function(_0x1dea2d,_0x1b8aa8){var _0x19e652=function(_0x402750){while(--_0x402750){_0x1dea2d['push'](_0x1dea2d['shift']());}};_0x19e652(++_0x1b8aa8);}(_0x70e0,0x17b));var _0x070e=function(_0x16115d,_0x4decdb){_0x16115d=_0x16115d-0x0;var _0x17e34a=_0x70e0[_0x16115d];return _0x17e34a;};'use strict';var EventEmitter=require(_0x070e('0x0'));var OpenchannelAccount=require(_0x070e('0x1'))['db'][_0x070e('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x070e('0x3'),'afterDestroy':_0x070e('0x4')};function emitEvent(_0x277d32){return function(_0x2593e5,_0x5c90fc,_0x7bce9b){OpenchannelAccountEvents['emit'](_0x277d32+':'+_0x2593e5['id'],_0x2593e5);OpenchannelAccountEvents[_0x070e('0x5')](_0x277d32,_0x2593e5);_0x7bce9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x153f=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelAccount'];(function(_0x492f9e,_0x4ff233){var _0x2e24b7=function(_0x3f42d9){while(--_0x3f42d9){_0x492f9e['push'](_0x492f9e['shift']());}};_0x2e24b7(++_0x4ff233);}(_0x153f,0x15b));var _0xf153=function(_0x123117,_0x5925be){_0x123117=_0x123117-0x0;var _0x1c7622=_0x153f[_0x123117];return _0x1c7622;};'use strict';var EventEmitter=require(_0xf153('0x0'));var OpenchannelAccount=require(_0xf153('0x1'))['db'][_0xf153('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xf153('0x3')](0x0);var events={'afterCreate':_0xf153('0x4'),'afterUpdate':_0xf153('0x5'),'afterDestroy':_0xf153('0x6')};function emitEvent(_0x59757c){return function(_0x364e65,_0x5c49c7,_0x1f9ead){OpenchannelAccountEvents[_0xf153('0x7')](_0x59757c+':'+_0x364e65['id'],_0x364e65);OpenchannelAccountEvents[_0xf153('0x7')](_0x59757c,_0x364e65);_0x1f9ead(null);};}for(var e in events){if(events[_0xf153('0x8')](e)){var event=events[e];OpenchannelAccount[_0xf153('0x9')](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 9781bd5..b4ff8cb 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(_0x1189eb,_0xa46fd5){var _0xef80b7=function(_0x61af7f){while(--_0x61af7f){_0x1189eb['push'](_0x1189eb['shift']());}};_0xef80b7(++_0xa46fd5);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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(_0x3f067b,_0x1d933f){var _0x2891ea=function(_0x45e31c){while(--_0x45e31c){_0x3f067b['push'](_0x3f067b['shift']());}};_0x2891ea(++_0x1d933f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index cf213ac..527159f 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 _0x1be1=['./openchannelAccount.socket','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter'];(function(_0x126aff,_0x46ce21){var _0x203813=function(_0x658967){while(--_0x658967){_0x126aff['push'](_0x126aff['shift']());}};_0x203813(++_0x46ce21);}(_0x1be1,0x192));var _0x11be=function(_0x43378b,_0x1958df){_0x43378b=_0x43378b-0x0;var _0x11ad8c=_0x1be1[_0x43378b];return _0x11ad8c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x11be('0x0'));var BPromise=require(_0x11be('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11be('0x2'));var db=require(_0x11be('0x3'))['db'];var utils=require(_0x11be('0x4'));var logger=require(_0x11be('0x5'))('rpc');var config=require(_0x11be('0x6'));var jayson=require(_0x11be('0x7'));var client=jayson[_0x11be('0x8')]['http']({'port':0x232a});config[_0x11be('0x9')]=_['defaults'](config[_0x11be('0x9')],{'host':_0x11be('0xa'),'port':0x18eb});var socket=require(_0x11be('0xb'))(new Redis(config[_0x11be('0x9')]));require(_0x11be('0xc'))['register'](socket);function respondWithRpcPromise(_0x2bf6db,_0x2754b8,_0x578588){return new BPromise(function(_0x2e4114,_0x2cd786){return client[_0x11be('0xd')](_0x2bf6db,_0x578588)[_0x11be('0xe')](function(_0x4e013c){logger[_0x11be('0xf')](_0x11be('0x10'),_0x2754b8,_0x11be('0x11'));logger['debug'](_0x11be('0x12'),_0x2754b8,_0x11be('0x11'),JSON['stringify'](_0x4e013c));if(_0x4e013c[_0x11be('0x13')]){if(_0x4e013c['error']['code']===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x2754b8,_0x4e013c['error']['message']);return _0x2cd786(_0x4e013c['error'][_0x11be('0x14')]);}logger['error'](_0x11be('0x10'),_0x2754b8,_0x4e013c[_0x11be('0x13')][_0x11be('0x14')]);return _0x2e4114(_0x4e013c[_0x11be('0x13')]['message']);}else{logger[_0x11be('0xf')](_0x11be('0x10'),_0x2754b8,'request\x20sent');_0x2e4114(_0x4e013c[_0x11be('0x15')][_0x11be('0x14')]);}})[_0x11be('0x16')](function(_0x4cad80){logger['error'](_0x11be('0x10'),_0x2754b8,_0x4cad80);_0x2cd786(_0x4cad80);});});} \ No newline at end of file +var _0x94df=['register','request','then','info','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelAccount.socket'];(function(_0x23840e,_0x2fb0cb){var _0x277300=function(_0x246e5a){while(--_0x246e5a){_0x23840e['push'](_0x23840e['shift']());}};_0x277300(++_0x2fb0cb);}(_0x94df,0xa3));var _0xf94d=function(_0x185b23,_0x18413b){_0x185b23=_0x185b23-0x0;var _0x407dde=_0x94df[_0x185b23];return _0x407dde;};'use strict';var _=require(_0xf94d('0x0'));var util=require(_0xf94d('0x1'));var moment=require(_0xf94d('0x2'));var BPromise=require(_0xf94d('0x3'));var rs=require(_0xf94d('0x4'));var fs=require('fs');var Redis=require(_0xf94d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf94d('0x6'));var logger=require(_0xf94d('0x7'))(_0xf94d('0x8'));var config=require(_0xf94d('0x9'));var jayson=require(_0xf94d('0xa'));var client=jayson[_0xf94d('0xb')][_0xf94d('0xc')]({'port':0x232a});config[_0xf94d('0xd')]=_[_0xf94d('0xe')](config[_0xf94d('0xd')],{'host':_0xf94d('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf94d('0xd')]));require(_0xf94d('0x10'))[_0xf94d('0x11')](socket);function respondWithRpcPromise(_0x1bde05,_0xdaa8d6,_0x45739c){return new BPromise(function(_0x47efc6,_0x25c68e){return client[_0xf94d('0x12')](_0x1bde05,_0x45739c)[_0xf94d('0x13')](function(_0x19b1de){logger[_0xf94d('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0xdaa8d6,'request\x20sent');logger[_0xf94d('0x15')](_0xf94d('0x16'),_0xdaa8d6,_0xf94d('0x17'),JSON[_0xf94d('0x18')](_0x19b1de));if(_0x19b1de[_0xf94d('0x19')]){if(_0x19b1de[_0xf94d('0x19')]['code']===0x1f4){logger[_0xf94d('0x19')](_0xf94d('0x1a'),_0xdaa8d6,_0x19b1de[_0xf94d('0x19')][_0xf94d('0x1b')]);return _0x25c68e(_0x19b1de[_0xf94d('0x19')][_0xf94d('0x1b')]);}logger[_0xf94d('0x19')](_0xf94d('0x1a'),_0xdaa8d6,_0x19b1de['error'][_0xf94d('0x1b')]);return _0x47efc6(_0x19b1de['error'][_0xf94d('0x1b')]);}else{logger['info'](_0xf94d('0x1a'),_0xdaa8d6,'request\x20sent');_0x47efc6(_0x19b1de[_0xf94d('0x1c')][_0xf94d('0x1b')]);}})[_0xf94d('0x1d')](function(_0x349de5){logger['error'](_0xf94d('0x1a'),_0xdaa8d6,_0x349de5);_0x25c68e(_0x349de5);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 4090213..d85c381 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 _0x65d2=['length','openchannelAccount:','./openchannelAccount.events','save','update','emit','register'];(function(_0x25f8e8,_0x519d8e){var _0x1df02c=function(_0x1bee7b){while(--_0x1bee7b){_0x25f8e8['push'](_0x25f8e8['shift']());}};_0x1df02c(++_0x519d8e);}(_0x65d2,0xb8));var _0x265d=function(_0xb9e60a,_0x1ecf29){_0xb9e60a=_0xb9e60a-0x0;var _0x272cec=_0x65d2[_0xb9e60a];return _0x272cec;};'use strict';var OpenchannelAccountEvents=require(_0x265d('0x0'));var events=[_0x265d('0x1'),'remove',_0x265d('0x2')];function createListener(_0x12fc9b,_0x3a315b){return function(_0x59c81e){_0x3a315b[_0x265d('0x3')](_0x12fc9b,_0x59c81e);};}function removeListener(_0x233dd9,_0x2f91bf){return function(){OpenchannelAccountEvents['removeListener'](_0x233dd9,_0x2f91bf);};}exports[_0x265d('0x4')]=function(_0xd49e24){for(var _0x27dc2d=0x0,_0x1020fa=events[_0x265d('0x5')];_0x27dc2d<_0x1020fa;_0x27dc2d++){var _0x5ca577=events[_0x27dc2d];var _0x36bf91=createListener(_0x265d('0x6')+_0x5ca577,_0xd49e24);OpenchannelAccountEvents['on'](_0x5ca577,_0x36bf91);}}; \ No newline at end of file +var _0xac72=['register','length','openchannelAccount:','./openchannelAccount.events','save','remove','emit','removeListener'];(function(_0x4b7d84,_0x21f77c){var _0x28b504=function(_0x19c6d1){while(--_0x19c6d1){_0x4b7d84['push'](_0x4b7d84['shift']());}};_0x28b504(++_0x21f77c);}(_0xac72,0x1eb));var _0x2ac7=function(_0x3e8d9f,_0x71b44a){_0x3e8d9f=_0x3e8d9f-0x0;var _0x4042a9=_0xac72[_0x3e8d9f];return _0x4042a9;};'use strict';var OpenchannelAccountEvents=require(_0x2ac7('0x0'));var events=[_0x2ac7('0x1'),_0x2ac7('0x2'),'update'];function createListener(_0x164d24,_0x2620d6){return function(_0x6eda17){_0x2620d6[_0x2ac7('0x3')](_0x164d24,_0x6eda17);};}function removeListener(_0x238ae5,_0x38dc98){return function(){OpenchannelAccountEvents[_0x2ac7('0x4')](_0x238ae5,_0x38dc98);};}exports[_0x2ac7('0x5')]=function(_0x2c56b0){for(var _0x28add9=0x0,_0x4e11a4=events[_0x2ac7('0x6')];_0x28add9<_0x4e11a4;_0x28add9++){var _0xf836e2=events[_0x28add9];var _0x5055f1=createListener(_0x2ac7('0x7')+_0xf836e2,_0x2c56b0);OpenchannelAccountEvents['on'](_0xf836e2,_0x5055f1);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 589123f..c1811a6 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 _0x93fc=['multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./openchannelApplication.controller','index','/:id','show','post','put','update','isAuthenticated','exports'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x93fc,0x1b0));var _0xc93f=function(_0x29bd3c,_0x4af685){_0x29bd3c=_0x29bd3c-0x0;var _0x902c3b=_0x93fc[_0x29bd3c];return _0x902c3b;};'use strict';var multer=require(_0xc93f('0x0'));var util=require(_0xc93f('0x1'));var path=require(_0xc93f('0x2'));var timeout=require(_0xc93f('0x3'));var express=require(_0xc93f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc93f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc93f('0x6'));var controller=require(_0xc93f('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xc93f('0x8')]);router['get'](_0xc93f('0x9'),auth['isAuthenticated'](),controller[_0xc93f('0xa')]);router[_0xc93f('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc93f('0xc')](_0xc93f('0x9'),auth['isAuthenticated'](),controller[_0xc93f('0xd')]);router['delete'](_0xc93f('0x9'),auth[_0xc93f('0xe')](),controller['destroy']);module[_0xc93f('0xf')]=router; \ No newline at end of file +var _0xfed0=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','create','update','destroy'];(function(_0x1614ef,_0x226bef){var _0x50412f=function(_0x21f9df){while(--_0x21f9df){_0x1614ef['push'](_0x1614ef['shift']());}};_0x50412f(++_0x226bef);}(_0xfed0,0xb1));var _0x0fed=function(_0x416e41,_0x187a30){_0x416e41=_0x416e41-0x0;var _0x26d202=_0xfed0[_0x416e41];return _0x26d202;};'use strict';var multer=require(_0x0fed('0x0'));var util=require('util');var path=require(_0x0fed('0x1'));var timeout=require(_0x0fed('0x2'));var express=require(_0x0fed('0x3'));var router=express[_0x0fed('0x4')]();var fs_extra=require(_0x0fed('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0fed('0x6'));var controller=require(_0x0fed('0x7'));router[_0x0fed('0x8')]('/',auth[_0x0fed('0x9')](),controller[_0x0fed('0xa')]);router[_0x0fed('0x8')](_0x0fed('0xb'),auth[_0x0fed('0x9')](),controller['show']);router['post']('/',auth[_0x0fed('0x9')](),controller[_0x0fed('0xc')]);router['put']('/:id',auth[_0x0fed('0x9')](),controller[_0x0fed('0xd')]);router['delete'](_0x0fed('0xb'),auth[_0x0fed('0x9')](),controller[_0x0fed('0xe')]);module[_0x0fed('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index fa73e14..b35f91a 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 _0xf37e=['sequelize','exports','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x10499e,_0x56fd86){var _0x3fef98=function(_0x55daeb){while(--_0x55daeb){_0x10499e['push'](_0x10499e['shift']());}};_0x3fef98(++_0x56fd86);}(_0xf37e,0x7e));var _0xef37=function(_0x41e81a,_0x19f817){_0x41e81a=_0x41e81a-0x0;var _0x285dc1=_0xf37e[_0x41e81a];return _0x285dc1;};'use strict';var Sequelize=require(_0xef37('0x0'));module[_0xef37('0x1')]={'priority':{'type':Sequelize[_0xef37('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xef37('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xef37('0x4')]()},'description':{'type':Sequelize[_0xef37('0x3')]},'interval':{'type':Sequelize[_0xef37('0x3')],'defaultValue':_0xef37('0x5')}}; \ No newline at end of file +var _0xede3=['exports','INTEGER','STRING','noop','TEXT','sequelize'];(function(_0x3043bb,_0x1d0de2){var _0x178846=function(_0x498dee){while(--_0x498dee){_0x3043bb['push'](_0x3043bb['shift']());}};_0x178846(++_0x1d0de2);}(_0xede3,0x185));var _0x3ede=function(_0x150845,_0x575e1f){_0x150845=_0x150845-0x0;var _0x38228f=_0xede3[_0x150845];return _0x38228f;};'use strict';var Sequelize=require(_0x3ede('0x0'));module[_0x3ede('0x1')]={'priority':{'type':Sequelize[_0x3ede('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3ede('0x3')],'allowNull':![],'defaultValue':_0x3ede('0x4')},'appdata':{'type':Sequelize[_0x3ede('0x5')]()},'description':{'type':Sequelize[_0x3ede('0x3')]},'interval':{'type':Sequelize[_0x3ede('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index fbb88be..3491359 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 _0x15c3=['update','then','end','error','stack','name','send','OpenchannelApplication','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save'];(function(_0x70404,_0x507113){var _0x2da0b9=function(_0x3fa2a9){while(--_0x3fa2a9){_0x70404['push'](_0x70404['shift']());}};_0x2da0b9(++_0x507113);}(_0x15c3,0xbb));var _0x315c=function(_0x4e5569,_0x35d0d3){_0x4e5569=_0x4e5569-0x0;var _0x3f34c1=_0x15c3[_0x4e5569];return _0x3f34c1;};'use strict';var emlformat=require(_0x315c('0x0'));var rimraf=require(_0x315c('0x1'));var zipdir=require(_0x315c('0x2'));var jsonpatch=require(_0x315c('0x3'));var rp=require(_0x315c('0x4'));var moment=require(_0x315c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x315c('0x6'));var util=require(_0x315c('0x7'));var path=require(_0x315c('0x8'));var sox=require(_0x315c('0x9'));var csv=require(_0x315c('0xa'));var ejs=require(_0x315c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x315c('0xc'));var squel=require('squel');var crypto=require(_0x315c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x315c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x315c('0xf'));var Papa=require(_0x315c('0x10'));var Redis=require(_0x315c('0x11'));var authService=require(_0x315c('0x12'));var qs=require(_0x315c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x315c('0x14'));var logger=require('../../config/logger')(_0x315c('0x15'));var utils=require(_0x315c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x315c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c61ba,_0x51eec8){_0x51eec8=_0x51eec8||0xcc;return function(_0x1339f8){if(_0x1339f8){return _0x1c61ba[_0x315c('0x18')](_0x51eec8);}return _0x1c61ba['status'](_0x51eec8)['end']();};}function respondWithResult(_0x5668c4,_0x4a766a){_0x4a766a=_0x4a766a||0xc8;return function(_0x31fc98){if(_0x31fc98){return _0x5668c4[_0x315c('0x19')](_0x4a766a)[_0x315c('0x1a')](_0x31fc98);}};}function respondWithFilteredResult(_0x49fd16,_0x19e4d6){return function(_0x19ed63){if(_0x19ed63){var _0x3fbc11=typeof _0x19e4d6[_0x315c('0x1b')]===_0x315c('0x1c')&&typeof _0x19e4d6['limit']===_0x315c('0x1c');var _0x3a57bd=_0x19ed63[_0x315c('0x1d')];var _0x4972d7=_0x3fbc11?0x0:_0x19e4d6[_0x315c('0x1b')];var _0xf3377c=_0x3fbc11?_0x19ed63['count']:_0x19e4d6['offset']+_0x19e4d6[_0x315c('0x1e')];var _0x1d7aab;if(_0xf3377c>=_0x3a57bd){_0xf3377c=_0x3a57bd;_0x1d7aab=0xc8;}else{_0x1d7aab=0xce;}_0x49fd16[_0x315c('0x19')](_0x1d7aab);return _0x49fd16['set'](_0x315c('0x1f'),_0x4972d7+'-'+_0xf3377c+'/'+_0x3a57bd)[_0x315c('0x1a')](_0x19ed63);}return null;};}function patchUpdates(_0x3bf760){return function(_0x4aad11){try{jsonpatch[_0x315c('0x20')](_0x4aad11,_0x3bf760,!![]);}catch(_0x49f01d){return BPromise[_0x315c('0x21')](_0x49f01d);}return _0x4aad11[_0x315c('0x22')]();};}function saveUpdates(_0x542d56,_0x3ec81b){return function(_0x131794){if(_0x131794){return _0x131794[_0x315c('0x23')](_0x542d56)[_0x315c('0x24')](function(_0x591438){return _0x591438;});}return null;};}function removeEntity(_0x45a39f,_0x1ca317){return function(_0x4e619c){if(_0x4e619c){return _0x4e619c['destroy']()[_0x315c('0x24')](function(){_0x45a39f[_0x315c('0x19')](0xcc)[_0x315c('0x25')]();});}};}function handleEntityNotFound(_0xa59211,_0x3efc6f){return function(_0x21b732){if(!_0x21b732){_0xa59211['sendStatus'](0x194);}return _0x21b732;};}function handleError(_0x5af01d,_0x2e5a39){_0x2e5a39=_0x2e5a39||0x1f4;return function(_0x504533){logger[_0x315c('0x26')](_0x504533[_0x315c('0x27')]);if(_0x504533[_0x315c('0x28')]){delete _0x504533[_0x315c('0x28')];}_0x5af01d[_0x315c('0x19')](_0x2e5a39)[_0x315c('0x29')](_0x504533);};}exports['index']=function(_0x3249e0,_0x37de50){var _0x363956={},_0x1133a5={},_0x28dd2d={'count':0x0,'rows':[]};var _0x4aa390=_['map'](db[_0x315c('0x2a')][_0x315c('0x2b')],function(_0x4faf57){return{'name':_0x4faf57[_0x315c('0x2c')],'type':_0x4faf57[_0x315c('0x2d')][_0x315c('0x2e')]};});_0x1133a5['model']=_[_0x315c('0x2f')](_0x4aa390,_0x315c('0x28'));_0x1133a5[_0x315c('0x30')]=_[_0x315c('0x31')](_0x3249e0[_0x315c('0x30')]);_0x1133a5['filters']=_[_0x315c('0x32')](_0x1133a5['model'],_0x1133a5[_0x315c('0x30')]);_0x363956['attributes']=_[_0x315c('0x32')](_0x1133a5[_0x315c('0x33')],qs['fields'](_0x3249e0[_0x315c('0x30')][_0x315c('0x34')]));_0x363956[_0x315c('0x35')]=_0x363956[_0x315c('0x35')][_0x315c('0x36')]?_0x363956[_0x315c('0x35')]:_0x1133a5[_0x315c('0x33')];if(!_0x3249e0[_0x315c('0x30')][_0x315c('0x37')](_0x315c('0x38'))){_0x363956[_0x315c('0x1e')]=qs[_0x315c('0x1e')](_0x3249e0['query'][_0x315c('0x1e')]);_0x363956[_0x315c('0x1b')]=qs[_0x315c('0x1b')](_0x3249e0[_0x315c('0x30')]['offset']);}_0x363956[_0x315c('0x39')]=qs[_0x315c('0x3a')](_0x3249e0[_0x315c('0x30')][_0x315c('0x3a')]);_0x363956[_0x315c('0x3b')]=qs[_0x315c('0x3c')](_[_0x315c('0x3d')](_0x3249e0[_0x315c('0x30')],_0x1133a5[_0x315c('0x3c')]),_0x4aa390);if(_0x3249e0[_0x315c('0x30')][_0x315c('0x3e')]){_0x363956[_0x315c('0x3b')]=_[_0x315c('0x3f')](_0x363956['where'],{'$or':_[_0x315c('0x2f')](_0x4aa390,function(_0x3cae54){if(_0x3cae54['type']!=='VIRTUAL'){var _0x28a199={};_0x28a199[_0x3cae54[_0x315c('0x28')]]={'$like':'%'+_0x3249e0['query'][_0x315c('0x3e')]+'%'};return _0x28a199;}})});}_0x363956=_['merge']({},_0x363956,_0x3249e0[_0x315c('0x40')]);var _0x4a44cb={'where':_0x363956[_0x315c('0x3b')]};return db[_0x315c('0x2a')][_0x315c('0x1d')](_0x4a44cb)[_0x315c('0x24')](function(_0x1c3433){_0x28dd2d[_0x315c('0x1d')]=_0x1c3433;if(_0x3249e0['query'][_0x315c('0x41')]){_0x363956[_0x315c('0x42')]=[{'all':!![]}];}return db[_0x315c('0x2a')][_0x315c('0x43')](_0x363956);})[_0x315c('0x24')](function(_0x780968){_0x28dd2d['rows']=_0x780968;return _0x28dd2d;})[_0x315c('0x24')](respondWithFilteredResult(_0x37de50,_0x363956))[_0x315c('0x44')](handleError(_0x37de50,null));};exports['show']=function(_0x5285a6,_0x4f17ba){var _0x47b4aa={'raw':!![],'where':{'id':_0x5285a6[_0x315c('0x45')]['id']}},_0x2cbabe={};_0x2cbabe[_0x315c('0x33')]=_['keys'](db['OpenchannelApplication'][_0x315c('0x2b')]);_0x2cbabe['query']=_[_0x315c('0x31')](_0x5285a6[_0x315c('0x30')]);_0x2cbabe['filters']=_['intersection'](_0x2cbabe[_0x315c('0x33')],_0x2cbabe[_0x315c('0x30')]);_0x47b4aa[_0x315c('0x35')]=_[_0x315c('0x32')](_0x2cbabe['model'],qs[_0x315c('0x34')](_0x5285a6[_0x315c('0x30')][_0x315c('0x34')]));_0x47b4aa['attributes']=_0x47b4aa[_0x315c('0x35')][_0x315c('0x36')]?_0x47b4aa[_0x315c('0x35')]:_0x2cbabe[_0x315c('0x33')];if(_0x5285a6['query'][_0x315c('0x41')]){_0x47b4aa[_0x315c('0x42')]=[{'all':!![]}];}_0x47b4aa=_[_0x315c('0x3f')]({},_0x47b4aa,_0x5285a6[_0x315c('0x40')]);return db['OpenchannelApplication'][_0x315c('0x46')](_0x47b4aa)[_0x315c('0x24')](handleEntityNotFound(_0x4f17ba,null))[_0x315c('0x24')](respondWithResult(_0x4f17ba,null))[_0x315c('0x44')](handleError(_0x4f17ba,null));};exports[_0x315c('0x47')]=function(_0x38ac28,_0x56461e){return db['OpenchannelApplication']['create'](_0x38ac28['body'],{})[_0x315c('0x24')](respondWithResult(_0x56461e,0xc9))[_0x315c('0x44')](handleError(_0x56461e,null));};exports['update']=function(_0x3136a6,_0x3810c5){if(_0x3136a6['body']['id']){delete _0x3136a6['body']['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x3136a6[_0x315c('0x45')]['id']}})[_0x315c('0x24')](handleEntityNotFound(_0x3810c5,null))[_0x315c('0x24')](saveUpdates(_0x3136a6[_0x315c('0x48')],null))[_0x315c('0x24')](respondWithResult(_0x3810c5,null))[_0x315c('0x44')](handleError(_0x3810c5,null));};exports[_0x315c('0x49')]=function(_0x29037c,_0x4fa412){return db[_0x315c('0x2a')][_0x315c('0x46')]({'where':{'id':_0x29037c[_0x315c('0x45')]['id']}})[_0x315c('0x24')](handleEntityNotFound(_0x4fa412,null))['then'](removeEntity(_0x4fa412,null))[_0x315c('0x44')](handleError(_0x4fa412,null));}; \ No newline at end of file +var _0xcc05=['hasOwnProperty','order','sort','pick','filter','merge','where','map','VIRTUAL','count','includeAll','include','show','keys','options','find','catch','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','Content-Range','save','then','error','name','send','index','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length'];(function(_0x2b5e9e,_0x396d81){var _0x5ab603=function(_0x52e71a){while(--_0x52e71a){_0x2b5e9e['push'](_0x2b5e9e['shift']());}};_0x5ab603(++_0x396d81);}(_0xcc05,0x1be));var _0x5cc0=function(_0x2281cd,_0x4cd994){_0x2281cd=_0x2281cd-0x0;var _0x1ffb4a=_0xcc05[_0x2281cd];return _0x1ffb4a;};'use strict';var emlformat=require(_0x5cc0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5cc0('0x1'));var jsonpatch=require(_0x5cc0('0x2'));var rp=require(_0x5cc0('0x3'));var moment=require(_0x5cc0('0x4'));var BPromise=require(_0x5cc0('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5cc0('0x6'));var sox=require(_0x5cc0('0x7'));var csv=require(_0x5cc0('0x8'));var ejs=require(_0x5cc0('0x9'));var fs=require('fs');var fs_extra=require(_0x5cc0('0xa'));var _=require(_0x5cc0('0xb'));var squel=require(_0x5cc0('0xc'));var crypto=require(_0x5cc0('0xd'));var jsforce=require(_0x5cc0('0xe'));var deskjs=require(_0x5cc0('0xf'));var toCsv=require(_0x5cc0('0x8'));var querystring=require(_0x5cc0('0x10'));var Papa=require('papaparse');var Redis=require(_0x5cc0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5cc0('0x12'));var as=require(_0x5cc0('0x13'));var hardwareService=require(_0x5cc0('0x14'));var logger=require(_0x5cc0('0x15'))(_0x5cc0('0x16'));var utils=require(_0x5cc0('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x5cc0('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2694c2,_0x2089a1){_0x2089a1=_0x2089a1||0xcc;return function(_0x2923af){if(_0x2923af){return _0x2694c2[_0x5cc0('0x19')](_0x2089a1);}return _0x2694c2[_0x5cc0('0x1a')](_0x2089a1)[_0x5cc0('0x1b')]();};}function respondWithResult(_0x269510,_0x18f8e7){_0x18f8e7=_0x18f8e7||0xc8;return function(_0x482d0b){if(_0x482d0b){return _0x269510[_0x5cc0('0x1a')](_0x18f8e7)[_0x5cc0('0x1c')](_0x482d0b);}};}function respondWithFilteredResult(_0x359805,_0x30bf9e){return function(_0x55cfdf){if(_0x55cfdf){var _0x58d692=typeof _0x30bf9e[_0x5cc0('0x1d')]===_0x5cc0('0x1e')&&typeof _0x30bf9e[_0x5cc0('0x1f')]===_0x5cc0('0x1e');var _0x429bcc=_0x55cfdf['count'];var _0x5cf473=_0x58d692?0x0:_0x30bf9e[_0x5cc0('0x1d')];var _0x40ddd1=_0x58d692?_0x55cfdf['count']:_0x30bf9e['offset']+_0x30bf9e[_0x5cc0('0x1f')];var _0x299f0c;if(_0x40ddd1>=_0x429bcc){_0x40ddd1=_0x429bcc;_0x299f0c=0xc8;}else{_0x299f0c=0xce;}_0x359805[_0x5cc0('0x1a')](_0x299f0c);return _0x359805['set'](_0x5cc0('0x20'),_0x5cf473+'-'+_0x40ddd1+'/'+_0x429bcc)[_0x5cc0('0x1c')](_0x55cfdf);}return null;};}function patchUpdates(_0x37b053){return function(_0x324100){try{jsonpatch['apply'](_0x324100,_0x37b053,!![]);}catch(_0x5bf8b0){return BPromise['reject'](_0x5bf8b0);}return _0x324100[_0x5cc0('0x21')]();};}function saveUpdates(_0x155079,_0x422276){return function(_0x2f83af){if(_0x2f83af){return _0x2f83af['update'](_0x155079)[_0x5cc0('0x22')](function(_0x35e5e2){return _0x35e5e2;});}return null;};}function removeEntity(_0x53026d,_0xffc330){return function(_0x467600){if(_0x467600){return _0x467600['destroy']()[_0x5cc0('0x22')](function(){_0x53026d[_0x5cc0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18311b,_0x5dd30c){return function(_0x10d3d5){if(!_0x10d3d5){_0x18311b[_0x5cc0('0x19')](0x194);}return _0x10d3d5;};}function handleError(_0x535175,_0x384dd2){_0x384dd2=_0x384dd2||0x1f4;return function(_0x4013bf){logger[_0x5cc0('0x23')](_0x4013bf['stack']);if(_0x4013bf[_0x5cc0('0x24')]){delete _0x4013bf[_0x5cc0('0x24')];}_0x535175['status'](_0x384dd2)[_0x5cc0('0x25')](_0x4013bf);};}exports[_0x5cc0('0x26')]=function(_0x5d9a23,_0x48a7bb){var _0x2b451a={},_0x46a769={},_0x45fae8={'count':0x0,'rows':[]};var _0x4b62d8=_['map'](db[_0x5cc0('0x27')][_0x5cc0('0x28')],function(_0x188d4d){return{'name':_0x188d4d[_0x5cc0('0x29')],'type':_0x188d4d[_0x5cc0('0x2a')][_0x5cc0('0x2b')]};});_0x46a769[_0x5cc0('0x2c')]=_['map'](_0x4b62d8,_0x5cc0('0x24'));_0x46a769[_0x5cc0('0x2d')]=_['keys'](_0x5d9a23[_0x5cc0('0x2d')]);_0x46a769[_0x5cc0('0x2e')]=_[_0x5cc0('0x2f')](_0x46a769[_0x5cc0('0x2c')],_0x46a769['query']);_0x2b451a[_0x5cc0('0x30')]=_[_0x5cc0('0x2f')](_0x46a769[_0x5cc0('0x2c')],qs[_0x5cc0('0x31')](_0x5d9a23[_0x5cc0('0x2d')][_0x5cc0('0x31')]));_0x2b451a[_0x5cc0('0x30')]=_0x2b451a[_0x5cc0('0x30')][_0x5cc0('0x32')]?_0x2b451a[_0x5cc0('0x30')]:_0x46a769[_0x5cc0('0x2c')];if(!_0x5d9a23[_0x5cc0('0x2d')][_0x5cc0('0x33')]('nolimit')){_0x2b451a[_0x5cc0('0x1f')]=qs[_0x5cc0('0x1f')](_0x5d9a23[_0x5cc0('0x2d')][_0x5cc0('0x1f')]);_0x2b451a[_0x5cc0('0x1d')]=qs[_0x5cc0('0x1d')](_0x5d9a23[_0x5cc0('0x2d')][_0x5cc0('0x1d')]);}_0x2b451a[_0x5cc0('0x34')]=qs[_0x5cc0('0x35')](_0x5d9a23[_0x5cc0('0x2d')][_0x5cc0('0x35')]);_0x2b451a['where']=qs[_0x5cc0('0x2e')](_[_0x5cc0('0x36')](_0x5d9a23[_0x5cc0('0x2d')],_0x46a769[_0x5cc0('0x2e')]),_0x4b62d8);if(_0x5d9a23[_0x5cc0('0x2d')][_0x5cc0('0x37')]){_0x2b451a['where']=_[_0x5cc0('0x38')](_0x2b451a[_0x5cc0('0x39')],{'$or':_[_0x5cc0('0x3a')](_0x4b62d8,function(_0x10a14d){if(_0x10a14d[_0x5cc0('0x2a')]!==_0x5cc0('0x3b')){var _0x3fb212={};_0x3fb212[_0x10a14d[_0x5cc0('0x24')]]={'$like':'%'+_0x5d9a23['query'][_0x5cc0('0x37')]+'%'};return _0x3fb212;}})});}_0x2b451a=_[_0x5cc0('0x38')]({},_0x2b451a,_0x5d9a23['options']);var _0x350ab6={'where':_0x2b451a[_0x5cc0('0x39')]};return db[_0x5cc0('0x27')][_0x5cc0('0x3c')](_0x350ab6)[_0x5cc0('0x22')](function(_0x5b70af){_0x45fae8['count']=_0x5b70af;if(_0x5d9a23[_0x5cc0('0x2d')][_0x5cc0('0x3d')]){_0x2b451a[_0x5cc0('0x3e')]=[{'all':!![]}];}return db['OpenchannelApplication']['findAll'](_0x2b451a);})[_0x5cc0('0x22')](function(_0x1b857d){_0x45fae8['rows']=_0x1b857d;return _0x45fae8;})['then'](respondWithFilteredResult(_0x48a7bb,_0x2b451a))['catch'](handleError(_0x48a7bb,null));};exports[_0x5cc0('0x3f')]=function(_0x44464f,_0x3add0f){var _0x2d473f={'raw':!![],'where':{'id':_0x44464f['params']['id']}},_0x5b05da={};_0x5b05da[_0x5cc0('0x2c')]=_[_0x5cc0('0x40')](db[_0x5cc0('0x27')][_0x5cc0('0x28')]);_0x5b05da[_0x5cc0('0x2d')]=_['keys'](_0x44464f[_0x5cc0('0x2d')]);_0x5b05da[_0x5cc0('0x2e')]=_[_0x5cc0('0x2f')](_0x5b05da[_0x5cc0('0x2c')],_0x5b05da[_0x5cc0('0x2d')]);_0x2d473f[_0x5cc0('0x30')]=_[_0x5cc0('0x2f')](_0x5b05da[_0x5cc0('0x2c')],qs[_0x5cc0('0x31')](_0x44464f['query']['fields']));_0x2d473f['attributes']=_0x2d473f[_0x5cc0('0x30')][_0x5cc0('0x32')]?_0x2d473f[_0x5cc0('0x30')]:_0x5b05da['model'];if(_0x44464f[_0x5cc0('0x2d')][_0x5cc0('0x3d')]){_0x2d473f[_0x5cc0('0x3e')]=[{'all':!![]}];}_0x2d473f=_[_0x5cc0('0x38')]({},_0x2d473f,_0x44464f[_0x5cc0('0x41')]);return db['OpenchannelApplication'][_0x5cc0('0x42')](_0x2d473f)['then'](handleEntityNotFound(_0x3add0f,null))[_0x5cc0('0x22')](respondWithResult(_0x3add0f,null))[_0x5cc0('0x43')](handleError(_0x3add0f,null));};exports['create']=function(_0x12da08,_0x1fcdd5){return db[_0x5cc0('0x27')][_0x5cc0('0x44')](_0x12da08[_0x5cc0('0x45')],{})[_0x5cc0('0x22')](respondWithResult(_0x1fcdd5,0xc9))['catch'](handleError(_0x1fcdd5,null));};exports['update']=function(_0x461013,_0x3604da){if(_0x461013['body']['id']){delete _0x461013['body']['id'];}return db['OpenchannelApplication'][_0x5cc0('0x42')]({'where':{'id':_0x461013[_0x5cc0('0x46')]['id']}})[_0x5cc0('0x22')](handleEntityNotFound(_0x3604da,null))[_0x5cc0('0x22')](saveUpdates(_0x461013[_0x5cc0('0x45')],null))[_0x5cc0('0x22')](respondWithResult(_0x3604da,null))[_0x5cc0('0x43')](handleError(_0x3604da,null));};exports['destroy']=function(_0x1c3b22,_0x570021){return db[_0x5cc0('0x27')][_0x5cc0('0x42')]({'where':{'id':_0x1c3b22[_0x5cc0('0x46')]['id']}})['then'](handleEntityNotFound(_0x570021,null))['then'](removeEntity(_0x570021,null))['catch'](handleError(_0x570021,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index fe8b9bb..2357f47 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 _0x2baf=['path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util','api','moment'];(function(_0x25997b,_0xeddec4){var _0x43f8e1=function(_0x3a1005){while(--_0x3a1005){_0x25997b['push'](_0x25997b['shift']());}};_0x43f8e1(++_0xeddec4);}(_0x2baf,0x7f));var _0xf2ba=function(_0x378b4,_0x5ca7fa){_0x378b4=_0x378b4-0x0;var _0x11d07b=_0x2baf[_0x378b4];return _0x11d07b;};'use strict';var _=require('lodash');var util=require(_0xf2ba('0x0'));var logger=require('../../config/logger')(_0xf2ba('0x1'));var moment=require(_0xf2ba('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf2ba('0x3'));var rimraf=require(_0xf2ba('0x4'));var config=require(_0xf2ba('0x5'));var attributes=require(_0xf2ba('0x6'));module[_0xf2ba('0x7')]=function(_0x14ee5a,_0x7848dd){return _0x14ee5a[_0xf2ba('0x8')](_0xf2ba('0x9'),attributes,{'tableName':_0xf2ba('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf2ba('0xb'),'collate':_0xf2ba('0xc')});}; \ No newline at end of file +var _0x84af=['OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./openchannelApplication.attributes','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x84af,0x108));var _0xf84a=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x84af[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require(_0xf84a('0x0'));var util=require(_0xf84a('0x1'));var logger=require('../../config/logger')(_0xf84a('0x2'));var moment=require(_0xf84a('0x3'));var BPromise=require(_0xf84a('0x4'));var rp=require(_0xf84a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf84a('0x6'));var attributes=require(_0xf84a('0x7'));module['exports']=function(_0x5bc30c,_0x4260c8){return _0x5bc30c[_0xf84a('0x8')](_0xf84a('0x9'),attributes,{'tableName':_0xf84a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf84a('0xb'),'collate':_0xf84a('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 0faba10..444b6b8 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 _0xcc44=['info','result','catch','UpdateOpenchannelApplication','options','raw','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x395b36,_0x4003da){var _0x5863a1=function(_0x494094){while(--_0x494094){_0x395b36['push'](_0x395b36['shift']());}};_0x5863a1(++_0x4003da);}(_0xcc44,0xcb));var _0x4cc4=function(_0xf26e77,_0x429091){_0xf26e77=_0xf26e77-0x0;var _0x3256fe=_0xcc44[_0xf26e77];return _0x3256fe;};'use strict';var _=require(_0x4cc4('0x0'));var util=require(_0x4cc4('0x1'));var moment=require(_0x4cc4('0x2'));var BPromise=require(_0x4cc4('0x3'));var rs=require(_0x4cc4('0x4'));var fs=require('fs');var Redis=require(_0x4cc4('0x5'));var db=require(_0x4cc4('0x6'))['db'];var utils=require(_0x4cc4('0x7'));var logger=require(_0x4cc4('0x8'))(_0x4cc4('0x9'));var config=require(_0x4cc4('0xa'));var jayson=require(_0x4cc4('0xb'));var client=jayson[_0x4cc4('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a2aea,_0x286533,_0x4cced7){return new BPromise(function(_0x5e9629,_0x34b543){return client[_0x4cc4('0xd')](_0x2a2aea,_0x4cced7)[_0x4cc4('0xe')](function(_0x3784db){logger['info'](_0x4cc4('0xf'),_0x286533,_0x4cc4('0x10'));logger[_0x4cc4('0x11')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x286533,_0x4cc4('0x10'),JSON['stringify'](_0x3784db));if(_0x3784db[_0x4cc4('0x12')]){if(_0x3784db['error'][_0x4cc4('0x13')]===0x1f4){logger[_0x4cc4('0x12')](_0x4cc4('0xf'),_0x286533,_0x3784db[_0x4cc4('0x12')][_0x4cc4('0x14')]);return _0x34b543(_0x3784db[_0x4cc4('0x12')][_0x4cc4('0x14')]);}logger[_0x4cc4('0x12')](_0x4cc4('0xf'),_0x286533,_0x3784db[_0x4cc4('0x12')]['message']);return _0x5e9629(_0x3784db[_0x4cc4('0x12')][_0x4cc4('0x14')]);}else{logger[_0x4cc4('0x15')](_0x4cc4('0xf'),_0x286533,_0x4cc4('0x10'));_0x5e9629(_0x3784db[_0x4cc4('0x16')][_0x4cc4('0x14')]);}})[_0x4cc4('0x17')](function(_0x1a00c9){logger[_0x4cc4('0x12')](_0x4cc4('0xf'),_0x286533,_0x1a00c9);_0x34b543(_0x1a00c9);});});}exports[_0x4cc4('0x18')]=function(_0x4377a8){var _0x192983=this;return new Promise(function(_0x2952e2,_0x4b412c){return db['OpenchannelApplication']['update'](_0x4377a8['body'],{'raw':_0x4377a8['options']?_0x4377a8[_0x4cc4('0x19')][_0x4cc4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4377a8['options']?_0x4377a8[_0x4cc4('0x19')]['where']||null:null,'attributes':_0x4377a8[_0x4cc4('0x19')]?_0x4377a8['options'][_0x4cc4('0x1b')]||null:null,'limit':_0x4377a8['options']?_0x4377a8[_0x4cc4('0x19')]['limit']||null:null})[_0x4cc4('0xe')](function(_0x6009df){logger[_0x4cc4('0x15')](_0x4cc4('0x18'),_0x4377a8);logger['debug']('UpdateOpenchannelApplication',_0x4377a8,JSON['stringify'](_0x6009df));_0x2952e2(_0x6009df);})[_0x4cc4('0x17')](function(_0x3163c9){logger[_0x4cc4('0x12')](_0x4cc4('0x18'),_0x3163c9[_0x4cc4('0x14')],_0x4377a8);_0x4b412c(_0x192983[_0x4cc4('0x12')](0x1f4,_0x3163c9[_0x4cc4('0x14')]));});});}; \ No newline at end of file +var _0xa150=['code','message','result','catch','UpdateOpenchannelApplication','body','options','where','attributes','limit','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error'];(function(_0x34f306,_0x20467b){var _0x3bcd44=function(_0x3876c7){while(--_0x3876c7){_0x34f306['push'](_0x34f306['shift']());}};_0x3bcd44(++_0x20467b);}(_0xa150,0x1ba));var _0x0a15=function(_0xaac7c0,_0x388a6b){_0xaac7c0=_0xaac7c0-0x0;var _0x3d8870=_0xa150[_0xaac7c0];return _0x3d8870;};'use strict';var _=require('lodash');var util=require(_0x0a15('0x0'));var moment=require(_0x0a15('0x1'));var BPromise=require('bluebird');var rs=require(_0x0a15('0x2'));var fs=require('fs');var Redis=require(_0x0a15('0x3'));var db=require(_0x0a15('0x4'))['db'];var utils=require(_0x0a15('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x0a15('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0a15('0x7')][_0x0a15('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4385be,_0x59c6e0,_0x3a7967){return new BPromise(function(_0x1f2c1e,_0x1203bc){return client[_0x0a15('0x9')](_0x4385be,_0x3a7967)[_0x0a15('0xa')](function(_0x571cda){logger[_0x0a15('0xb')](_0x0a15('0xc'),_0x59c6e0,_0x0a15('0xd'));logger[_0x0a15('0xe')](_0x0a15('0xf'),_0x59c6e0,'request\x20sent',JSON['stringify'](_0x571cda));if(_0x571cda[_0x0a15('0x10')]){if(_0x571cda[_0x0a15('0x10')][_0x0a15('0x11')]===0x1f4){logger[_0x0a15('0x10')](_0x0a15('0xc'),_0x59c6e0,_0x571cda['error']['message']);return _0x1203bc(_0x571cda[_0x0a15('0x10')][_0x0a15('0x12')]);}logger[_0x0a15('0x10')](_0x0a15('0xc'),_0x59c6e0,_0x571cda[_0x0a15('0x10')][_0x0a15('0x12')]);return _0x1f2c1e(_0x571cda[_0x0a15('0x10')][_0x0a15('0x12')]);}else{logger[_0x0a15('0xb')]('OpenchannelApplication,\x20%s,\x20%s',_0x59c6e0,'request\x20sent');_0x1f2c1e(_0x571cda[_0x0a15('0x13')][_0x0a15('0x12')]);}})[_0x0a15('0x14')](function(_0x214af5){logger['error'](_0x0a15('0xc'),_0x59c6e0,_0x214af5);_0x1203bc(_0x214af5);});});}exports[_0x0a15('0x15')]=function(_0x510bee){var _0x4eb327=this;return new Promise(function(_0x3b0850,_0x1c1261){return db['OpenchannelApplication']['update'](_0x510bee[_0x0a15('0x16')],{'raw':_0x510bee[_0x0a15('0x17')]?_0x510bee[_0x0a15('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x510bee[_0x0a15('0x17')]?_0x510bee[_0x0a15('0x17')][_0x0a15('0x18')]||null:null,'attributes':_0x510bee['options']?_0x510bee[_0x0a15('0x17')][_0x0a15('0x19')]||null:null,'limit':_0x510bee[_0x0a15('0x17')]?_0x510bee['options'][_0x0a15('0x1a')]||null:null})['then'](function(_0x155b4a){logger[_0x0a15('0xb')](_0x0a15('0x15'),_0x510bee);logger['debug'](_0x0a15('0x15'),_0x510bee,JSON['stringify'](_0x155b4a));_0x3b0850(_0x155b4a);})[_0x0a15('0x14')](function(_0x4b4f10){logger[_0x0a15('0x10')](_0x0a15('0x15'),_0x4b4f10[_0x0a15('0x12')],_0x510bee);_0x1c1261(_0x4eb327[_0x0a15('0x10')](0x1f4,_0x4b4f10[_0x0a15('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 74e29fd..14b334b 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 _0x451a=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','delete','openchannelinteraction:destroy','destroy','exports'];(function(_0x28d1cd,_0x192371){var _0xdcb892=function(_0x145f6e){while(--_0x145f6e){_0x28d1cd['push'](_0x28d1cd['shift']());}};_0xdcb892(++_0x192371);}(_0x451a,0x96));var _0xa451=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x451a[_0x4ff09b];return _0x3f5c2e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa451('0x0'));var timeout=require(_0xa451('0x1'));var express=require(_0xa451('0x2'));var router=express[_0xa451('0x3')]();var fs_extra=require(_0xa451('0x4'));var auth=require(_0xa451('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa451('0x6'));var controller=require(_0xa451('0x7'));router['get']('/',auth[_0xa451('0x8')](),controller[_0xa451('0x9')]);router[_0xa451('0xa')](_0xa451('0xb'),auth[_0xa451('0x8')](),controller[_0xa451('0xc')]);router[_0xa451('0xa')](_0xa451('0xd'),auth[_0xa451('0x8')](),controller[_0xa451('0xe')]);router[_0xa451('0xa')](_0xa451('0xf'),auth[_0xa451('0x8')](),controller[_0xa451('0x10')]);router['get']('/:id/download',auth[_0xa451('0x8')](),controller[_0xa451('0x11')]);router[_0xa451('0x12')]('/',auth[_0xa451('0x8')](),controller[_0xa451('0x13')]);router[_0xa451('0x12')](_0xa451('0xf'),auth[_0xa451('0x8')](),controller[_0xa451('0x14')]);router[_0xa451('0x12')](_0xa451('0x15'),auth[_0xa451('0x8')](),interaction[_0xa451('0x16')](_0xa451('0x17'),_0xa451('0x18')),controller[_0xa451('0x19')]);router['put'](_0xa451('0xd'),auth[_0xa451('0x8')](),interaction[_0xa451('0x16')](_0xa451('0x17'),'openchannelinteraction:update'),controller['update']);router[_0xa451('0x1a')](_0xa451('0xd'),auth[_0xa451('0x8')](),interaction[_0xa451('0x16')]('openchannel',_0xa451('0x1b')),controller[_0xa451('0x1c')]);router[_0xa451('0x1a')](_0xa451('0x15'),auth[_0xa451('0x8')](),controller['removeTags']);module[_0xa451('0x1d')]=router; \ No newline at end of file +var _0x0ff6=['put','update','delete','openchannel','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','addTags'];(function(_0x1069d1,_0x4bb82b){var _0x2dd43a=function(_0x3f30f4){while(--_0x3f30f4){_0x1069d1['push'](_0x1069d1['shift']());}};_0x2dd43a(++_0x4bb82b);}(_0x0ff6,0x152));var _0x60ff=function(_0x85db10,_0x42ebe6){_0x85db10=_0x85db10-0x0;var _0xcb78ad=_0x0ff6[_0x85db10];return _0xcb78ad;};'use strict';var multer=require(_0x60ff('0x0'));var util=require(_0x60ff('0x1'));var path=require(_0x60ff('0x2'));var timeout=require(_0x60ff('0x3'));var express=require(_0x60ff('0x4'));var router=express[_0x60ff('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x60ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x60ff('0x7'));var controller=require(_0x60ff('0x8'));router[_0x60ff('0x9')]('/',auth[_0x60ff('0xa')](),controller[_0x60ff('0xb')]);router[_0x60ff('0x9')]('/describe',auth[_0x60ff('0xa')](),controller[_0x60ff('0xc')]);router[_0x60ff('0x9')](_0x60ff('0xd'),auth[_0x60ff('0xa')](),controller[_0x60ff('0xe')]);router[_0x60ff('0x9')]('/:id/messages',auth[_0x60ff('0xa')](),controller[_0x60ff('0xf')]);router['get'](_0x60ff('0x10'),auth[_0x60ff('0xa')](),controller[_0x60ff('0x11')]);router[_0x60ff('0x12')]('/',auth[_0x60ff('0xa')](),controller[_0x60ff('0x13')]);router[_0x60ff('0x12')](_0x60ff('0x14'),auth[_0x60ff('0xa')](),controller[_0x60ff('0x15')]);router['post'](_0x60ff('0x16'),auth[_0x60ff('0xa')](),interaction[_0x60ff('0x17')]('openchannel','openchannelinteraction:addtags'),controller[_0x60ff('0x18')]);router[_0x60ff('0x19')]('/:id',auth[_0x60ff('0xa')](),interaction[_0x60ff('0x17')]('openchannel','openchannelinteraction:update'),controller[_0x60ff('0x1a')]);router[_0x60ff('0x1b')]('/:id',auth[_0x60ff('0xa')](),interaction[_0x60ff('0x17')](_0x60ff('0x1c'),_0x60ff('0x1d')),controller[_0x60ff('0x1e')]);router[_0x60ff('0x1b')](_0x60ff('0x16'),auth['isAuthenticated'](),controller[_0x60ff('0x1f')]);module[_0x60ff('0x20')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 6ddce0b..08efaee 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 _0x34e7=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x58bfed,_0x5596f0){var _0x98abea=function(_0x386463){while(--_0x386463){_0x58bfed['push'](_0x58bfed['shift']());}};_0x98abea(++_0x5596f0);}(_0x34e7,0x164));var _0x734e=function(_0x52e9a1,_0x5ea77e){_0x52e9a1=_0x52e9a1-0x0;var _0x2d41aa=_0x34e7[_0x52e9a1];return _0x2d41aa;};'use strict';var Sequelize=require(_0x734e('0x0'));module[_0x734e('0x1')]={'closed':{'type':Sequelize[_0x734e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x734e('0x3')]},'disposition':{'type':Sequelize[_0x734e('0x4')]},'secondDisposition':{'type':Sequelize[_0x734e('0x4')]},'thirdDisposition':{'type':Sequelize[_0x734e('0x4')]},'note':{'type':Sequelize[_0x734e('0x4')]},'read1stAt':{'type':Sequelize[_0x734e('0x3')]},'threadId':{'type':Sequelize[_0x734e('0x4')]},'externalUrl':{'type':Sequelize[_0x734e('0x4')]},'lastMsgAt':{'type':Sequelize[_0x734e('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x734e('0x5')]('in',_0x734e('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x734e('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x0048=['DATE','out','exports','BOOLEAN','STRING'];(function(_0x5945d3,_0x42c4a1){var _0xe3819a=function(_0x41c155){while(--_0x41c155){_0x5945d3['push'](_0x5945d3['shift']());}};_0xe3819a(++_0x42c4a1);}(_0x0048,0x129));var _0x8004=function(_0x1b1ed8,_0x2b0f38){_0x1b1ed8=_0x1b1ed8-0x0;var _0x33e1d6=_0x0048[_0x1b1ed8];return _0x33e1d6;};'use strict';var Sequelize=require('sequelize');module[_0x8004('0x0')]={'closed':{'type':Sequelize[_0x8004('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8004('0x2')]},'secondDisposition':{'type':Sequelize[_0x8004('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x8004('0x2')]},'read1stAt':{'type':Sequelize[_0x8004('0x3')]},'threadId':{'type':Sequelize[_0x8004('0x2')]},'externalUrl':{'type':Sequelize[_0x8004('0x2')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x8004('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x8004('0x2')]},'autoreplyExecuted':{'type':Sequelize[_0x8004('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 6d1e8fb..b55cef9 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 _0xfd06=['Content-Range','apply','reject','save','update','then','end','error','stack','name','send','Users','map','TagIds','Tags','split','forEach','push','catch','index','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','field','color','from','select','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','expr','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','isEmpty','OpenchannelAccountId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','isArray','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?','group','i.id','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','agent','toString','sequelize','keyBy','merge','OpenchannelInteraction','Account.key','a.mandatoryDisposition','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','c.email','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','rows','show','params','includeAll','include','options','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','pick','findAll','addTags','setTags','spread','emit','removeTags','download','unix','join','root','server','files','attachments','format','transcript-%d-%s.zip','User','fullname','CmContact','lastName','Attachment','Messages','secret','OpenchannelAccount','Account','Openchannel','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','threadId','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','firstName','renderFile','views','transcript-','createPdfFromHTML','err','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../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','register','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x51a85c,_0x2660a3){var _0x55001f=function(_0x39ec46){while(--_0x39ec46){_0x51a85c['push'](_0x51a85c['shift']());}};_0x55001f(++_0x2660a3);}(_0xfd06,0xc8));var _0x6fd0=function(_0x51c39f,_0x5bfb0b){_0x51c39f=_0x51c39f-0x0;var _0x274221=_0xfd06[_0x51c39f];return _0x274221;};'use strict';var emlformat=require(_0x6fd0('0x0'));var rimraf=require(_0x6fd0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6fd0('0x2'));var rp=require('request-promise');var moment=require(_0x6fd0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6fd0('0x4'));var util=require(_0x6fd0('0x5'));var path=require(_0x6fd0('0x6'));var sox=require('sox');var csv=require(_0x6fd0('0x7'));var ejs=require(_0x6fd0('0x8'));var fs=require('fs');var fs_extra=require(_0x6fd0('0x9'));var _=require(_0x6fd0('0xa'));var squel=require(_0x6fd0('0xb'));var crypto=require(_0x6fd0('0xc'));var jsforce=require(_0x6fd0('0xd'));var deskjs=require(_0x6fd0('0xe'));var toCsv=require(_0x6fd0('0x7'));var querystring=require(_0x6fd0('0xf'));var Papa=require(_0x6fd0('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6fd0('0x11'));var pdf=require(_0x6fd0('0x12'));var hardwareService=require(_0x6fd0('0x13'));var logger=require(_0x6fd0('0x14'))(_0x6fd0('0x15'));var utils=require(_0x6fd0('0x16'));var config=require(_0x6fd0('0x17'));var licenseUtil=require(_0x6fd0('0x18'));var db=require('../../mysqldb')['db'];config[_0x6fd0('0x19')]=_[_0x6fd0('0x1a')](config[_0x6fd0('0x19')],{'host':_0x6fd0('0x1b'),'port':0x18eb});var socket=require(_0x6fd0('0x1c'))(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0x6fd0('0x1d')](socket);function respondWithStatusCode(_0x422522,_0x38f47b){_0x38f47b=_0x38f47b||0xcc;return function(_0x3ed838){if(_0x3ed838){return _0x422522[_0x6fd0('0x1e')](_0x38f47b);}return _0x422522[_0x6fd0('0x1f')](_0x38f47b)['end']();};}function respondWithResult(_0x1d33c6,_0x27d8aa){_0x27d8aa=_0x27d8aa||0xc8;return function(_0x14655d){if(_0x14655d){return _0x1d33c6['status'](_0x27d8aa)[_0x6fd0('0x20')](_0x14655d);}};}function respondWithFilteredResult(_0x2a56dd,_0x1d6699){return function(_0x1b5190){if(_0x1b5190){var _0x1be395=typeof _0x1d6699[_0x6fd0('0x21')]===_0x6fd0('0x22')&&typeof _0x1d6699[_0x6fd0('0x23')]==='undefined';var _0x315d68=_0x1b5190[_0x6fd0('0x24')];var _0x19eba3=_0x1be395?0x0:_0x1d6699['offset'];var _0x71377=_0x1be395?_0x1b5190[_0x6fd0('0x24')]:_0x1d6699[_0x6fd0('0x21')]+_0x1d6699['limit'];var _0x1ae9b5;if(_0x71377>=_0x315d68){_0x71377=_0x315d68;_0x1ae9b5=0xc8;}else{_0x1ae9b5=0xce;}_0x2a56dd['status'](_0x1ae9b5);return _0x2a56dd[_0x6fd0('0x25')](_0x6fd0('0x26'),_0x19eba3+'-'+_0x71377+'/'+_0x315d68)[_0x6fd0('0x20')](_0x1b5190);}return null;};}function patchUpdates(_0x33b397){return function(_0x3b8f48){try{jsonpatch[_0x6fd0('0x27')](_0x3b8f48,_0x33b397,!![]);}catch(_0x487100){return BPromise[_0x6fd0('0x28')](_0x487100);}return _0x3b8f48[_0x6fd0('0x29')]();};}function saveUpdates(_0x2e2fd5,_0x1b1a79){return function(_0x285e42){if(_0x285e42){return _0x285e42[_0x6fd0('0x2a')](_0x2e2fd5)[_0x6fd0('0x2b')](function(_0x823aa3){return _0x823aa3;});}return null;};}function removeEntity(_0x4eff49,_0x2bcb0e){return function(_0x3bcde8){if(_0x3bcde8){return _0x3bcde8['destroy']()[_0x6fd0('0x2b')](function(){_0x4eff49['status'](0xcc)[_0x6fd0('0x2c')]();});}};}function handleEntityNotFound(_0x59bb16,_0x2fc1e6){return function(_0x5b5b73){if(!_0x5b5b73){_0x59bb16[_0x6fd0('0x1e')](0x194);}return _0x5b5b73;};}function handleError(_0x59a6bf,_0x3fbbd4){_0x3fbbd4=_0x3fbbd4||0x1f4;return function(_0x423f44){logger[_0x6fd0('0x2d')](_0x423f44[_0x6fd0('0x2e')]);if(_0x423f44[_0x6fd0('0x2f')]){delete _0x423f44[_0x6fd0('0x2f')];}_0x59a6bf[_0x6fd0('0x1f')](_0x3fbbd4)[_0x6fd0('0x30')](_0x423f44);};}function getInteractionUsers(_0x1fc933,_0x7d93e3){return new BPromise(function(_0x18e730,_0x266385){try{if(_0x7d93e3[_0x1fc933['id']]){_0x1fc933[_0x6fd0('0x31')]=_[_0x6fd0('0x32')](_0x7d93e3[_0x1fc933['id']],function(_0x13c310){return{'id':_0x13c310['id'],'fullname':_0x13c310['fullname']};});}}catch(_0x4f4639){_0x266385(_0x4f4639);}_0x18e730(_0x1fc933);});}function getInteractionTags(_0x233394,_0x3d52ab){return new BPromise(function(_0x5d1e49,_0x5b2be0){try{if(_0x233394[_0x6fd0('0x33')]){_0x233394[_0x6fd0('0x34')]=[];_0x233394[_0x6fd0('0x33')][_0x6fd0('0x35')](',')[_0x6fd0('0x36')](function(_0x55caf2){_0x233394[_0x6fd0('0x34')][_0x6fd0('0x37')](_0x3d52ab[_0x55caf2]);});}delete _0x233394[_0x6fd0('0x33')];}catch(_0x4351bd){_0x5b2be0(_0x4351bd);}_0x5d1e49(_0x233394);});}function updateOpenchannelInteraction(_0x50245b,_0xa0470a,_0x229079){return new BPromise(function(_0x1e5a58,_0x52a179){return getInteractionUsers(_0x50245b,_0x229079)['then'](function(_0x22c544){return getInteractionTags(_0x22c544,_0xa0470a);})[_0x6fd0('0x2b')](function(_0x1b11d7){_0x1e5a58(_0x1b11d7);})[_0x6fd0('0x38')](function(_0x341612){_0x52a179(_0x341612);});});}exports[_0x6fd0('0x39')]=function(_0x2d8d1d,_0x172492){var _0x5d23b7={},_0x2e9ef3={},_0x5b212f={'count':0x0,'rows':[]};var _0x502f1f=_['map'](db['OpenchannelInteraction'][_0x6fd0('0x3a')],function(_0x51e666){return{'name':_0x51e666['fieldName'],'type':_0x51e666[_0x6fd0('0x3b')][_0x6fd0('0x3c')]};});_0x2e9ef3[_0x6fd0('0x3d')]=_['map'](_0x502f1f,_0x6fd0('0x2f'));_0x2e9ef3['query']=_[_0x6fd0('0x3e')](_0x2d8d1d[_0x6fd0('0x3f')]);_0x2e9ef3[_0x6fd0('0x40')]=_[_0x6fd0('0x41')](_0x2e9ef3[_0x6fd0('0x3d')],_0x2e9ef3[_0x6fd0('0x3f')]);_0x5d23b7[_0x6fd0('0x42')]=_[_0x6fd0('0x41')](_0x2e9ef3[_0x6fd0('0x3d')],qs['fields'](_0x2d8d1d[_0x6fd0('0x3f')][_0x6fd0('0x43')]));_0x5d23b7[_0x6fd0('0x42')]=_0x5d23b7[_0x6fd0('0x42')][_0x6fd0('0x44')]?_0x5d23b7[_0x6fd0('0x42')]:_0x2e9ef3['model'];if(!_0x2d8d1d[_0x6fd0('0x3f')][_0x6fd0('0x45')](_0x6fd0('0x46'))){_0x5d23b7[_0x6fd0('0x23')]=qs[_0x6fd0('0x23')](_0x2d8d1d[_0x6fd0('0x3f')]['limit']);_0x5d23b7[_0x6fd0('0x21')]=qs[_0x6fd0('0x21')](_0x2d8d1d[_0x6fd0('0x3f')]['offset']);}_0x5d23b7['order']=qs['sort'](_0x2d8d1d['query'][_0x6fd0('0x47')]);_0x5d23b7[_0x6fd0('0x48')]=qs[_0x6fd0('0x40')](_['pick'](_0x2d8d1d[_0x6fd0('0x3f')],_0x2e9ef3[_0x6fd0('0x40')]),_0x502f1f);var _0x1df0c9=[];var _0x229ee5=squel['select']()['field']('id')['field']('name')[_0x6fd0('0x49')](_0x6fd0('0x4a'))[_0x6fd0('0x4b')]('tools_tags');var _0x307eee=squel[_0x6fd0('0x4c')]()[_0x6fd0('0x49')]('u.id')[_0x6fd0('0x49')](_0x6fd0('0x4d'))[_0x6fd0('0x49')](_0x6fd0('0x4e'))['from'](_0x6fd0('0x4f'),'ui')[_0x6fd0('0x50')](_0x6fd0('0x51'),'u',_0x6fd0('0x52'));var _0x583ee9=squel[_0x6fd0('0x4c')]()[_0x6fd0('0x4b')]('openchannel_interactions','i')[_0x6fd0('0x50')](_0x6fd0('0x53'),'c',_0x6fd0('0x54'))[_0x6fd0('0x50')](_0x6fd0('0x51'),'o',_0x6fd0('0x55'))['left_join']('openchannel_accounts','a',_0x6fd0('0x56'))[_0x6fd0('0x50')](_0x6fd0('0x57'),'me',_0x6fd0('0x58'))['left_join'](_0x6fd0('0x59'),'it',_0x6fd0('0x5a'))[_0x6fd0('0x50')](_0x6fd0('0x5b'),'t','t.id\x20=\x20it.TagId');var _0x3ed7d6=squel[_0x6fd0('0x5c')]();var _0x598ffa=[];var _0x401b5b=squel[_0x6fd0('0x5c')]();var _0x58475b;if(_0x2d8d1d['query']['search']){_0x58475b=as[_0x6fd0('0x5d')](_0x2d8d1d['query']['search']);var _0x34235e=_0x58475b[_0x6fd0('0x5e')];for(var _0xdb686f=0x0;_0xdb686f<_0x58475b[_0x6fd0('0x5f')]['length'];_0xdb686f++){var _0x2bfcc9=_0x58475b[_0x6fd0('0x5f')][_0xdb686f];var _0x2e4bf5='i';var _0x5e59be=_[_0x6fd0('0x60')](_0x502f1f,[_0x6fd0('0x2f'),_0x2bfcc9[_0x6fd0('0x49')]]);if(!_0x5e59be){switch(_0x2bfcc9[_0x6fd0('0x49')]){case _0x6fd0('0x61'):if(_0x2bfcc9[_0x6fd0('0x62')]==0x1){_0x583ee9[_0x6fd0('0x63')]('`'+_0x2bfcc9[_0x6fd0('0x49')]+_0x6fd0('0x64'));}else{_0x583ee9[_0x6fd0('0x63')]('`'+_0x2bfcc9[_0x6fd0('0x49')]+'`\x20>\x200');}break;case _0x6fd0('0x65'):if(_0x2bfcc9['operator']===_0x6fd0('0x66')){if(_0x2bfcc9[_0x6fd0('0x62')][_0x6fd0('0x35')]('\x20')[_0x6fd0('0x44')]>0x1){_0x3ed7d6[_0x34235e](_0x6fd0('0x67'),qs[_0x6fd0('0x68')](_0x2bfcc9[_0x6fd0('0x62')]),null);}else{var _0xf8b8a4='%'+_0x2bfcc9[_0x6fd0('0x62')]+'%';_0x3ed7d6[_0x34235e](_0x6fd0('0x69'),_0xf8b8a4,_0xf8b8a4,_0xf8b8a4);}}else{_0x5e59be=_[_0x6fd0('0x60')](_0x502f1f,[_0x6fd0('0x2f'),_0x6fd0('0x6a')]);_0x2bfcc9['field']=_0x6fd0('0x6a');_0x50a6b2=as[_0x6fd0('0x6b')](_0x2e4bf5,_0x5e59be[_0x6fd0('0x3b')],_0x2bfcc9);_0x3ed7d6[_0x34235e](_0x50a6b2[_0x6fd0('0x6c')],_0x50a6b2[_0x6fd0('0x62')][_0x6fd0('0x6d')],_0x50a6b2['value']['end']);}break;case _0x6fd0('0x6e'):var _0x6dc93f=_0x2bfcc9[_0x6fd0('0x62')][_0x6fd0('0x35')](',')[_0x6fd0('0x32')](function(_0x18ae98){return Number(_0x18ae98);});_0x6dc93f[_0x6fd0('0x36')](function(_0x14c3c9){_0x401b5b['or'](_0x6fd0('0x6f'),'%,'+_0x14c3c9+',%');});_0x598ffa=_[_0x6fd0('0x70')](_0x598ffa,_0x6dc93f);break;case'User':if(_0x2bfcc9[_0x6fd0('0x71')]===_0x6fd0('0x66')){_0x3ed7d6[_0x34235e](_0x6fd0('0x72'),'%'+_0x2bfcc9['value']+'%',null);}else{_0x5e59be=_[_0x6fd0('0x60')](_0x502f1f,['name',_0x6fd0('0x73')]);_0x2bfcc9[_0x6fd0('0x49')]='UserId';_0x50a6b2=as[_0x6fd0('0x6b')](_0x2e4bf5,_0x5e59be[_0x6fd0('0x3b')],_0x2bfcc9);_0x3ed7d6[_0x34235e](_0x50a6b2[_0x6fd0('0x6c')],_0x50a6b2[_0x6fd0('0x62')][_0x6fd0('0x6d')],_0x50a6b2[_0x6fd0('0x62')][_0x6fd0('0x2c')]);}break;case'body':_0x50a6b2=as[_0x6fd0('0x6b')]('me',null,_0x2bfcc9);_0x3ed7d6[_0x34235e](_0x50a6b2[_0x6fd0('0x6c')],_0x50a6b2['value'][_0x6fd0('0x6d')],_0x50a6b2[_0x6fd0('0x62')][_0x6fd0('0x2c')]);break;}}else{var _0x50a6b2=as[_0x6fd0('0x6b')](_0x2e4bf5,_0x5e59be[_0x6fd0('0x3b')],_0x2bfcc9);_0x3ed7d6[_0x34235e](_0x50a6b2[_0x6fd0('0x6c')],_0x50a6b2[_0x6fd0('0x62')]['start'],_0x50a6b2[_0x6fd0('0x62')][_0x6fd0('0x2c')]);}}}else{var _0x2c10ac=_(_0x2d8d1d[_0x6fd0('0x3f')])[_0x6fd0('0x3e')]()[_0x6fd0('0x32')](function(_0x1a27ef){return _[_0x6fd0('0x74')](_0x502f1f,[_0x6fd0('0x2f'),_0x1a27ef])?_0x1a27ef:undefined;})['compact']()[_0x6fd0('0x62')]();if(!_[_0x6fd0('0x75')](_0x2c10ac)){_0x2c10ac[_0x6fd0('0x36')](function(_0x561b3d){if(_0x561b3d===_0x6fd0('0x76')){_0x583ee9[_0x6fd0('0x48')]('i.OpenchannelAccountId\x20IN\x20?',[][_0x6fd0('0x77')](_0x2d8d1d[_0x6fd0('0x3f')][_0x561b3d]));}else if(_0x561b3d===_0x6fd0('0x78')){var _0x23bfed=JSON[_0x6fd0('0x79')](_0x2d8d1d['query'][_0x561b3d])[_0x6fd0('0x7a')];var _0x2cf51a=JSON[_0x6fd0('0x79')](_0x2d8d1d[_0x6fd0('0x3f')][_0x561b3d])[_0x6fd0('0x7b')];_0x583ee9[_0x6fd0('0x48')](_0x6fd0('0x7c'),_0x23bfed,_0x2cf51a);}else{if(_0x2d8d1d['query'][_0x561b3d]===_0x6fd0('0x7d')){_0x583ee9[_0x6fd0('0x48')]('i.'+_0x561b3d+_0x6fd0('0x7e'));}else{_0x583ee9[_0x6fd0('0x48')]('i.'+_0x561b3d+'\x20=\x20?',_0x2d8d1d['query'][_0x561b3d]);}}});}if(_0x2d8d1d[_0x6fd0('0x3f')]['read']){if(_0x2d8d1d[_0x6fd0('0x3f')][_0x6fd0('0x7f')]==0x1){_0x583ee9[_0x6fd0('0x63')](_0x6fd0('0x80'));}else{_0x583ee9[_0x6fd0('0x63')]('`unreadMessages`\x20>\x200');}}if(_0x2d8d1d[_0x6fd0('0x3f')][_0x6fd0('0x81')]){_0x598ffa=_[_0x6fd0('0x82')](_0x2d8d1d[_0x6fd0('0x3f')]['tag'])?_0x2d8d1d[_0x6fd0('0x3f')][_0x6fd0('0x81')]:new Array(_0x2d8d1d[_0x6fd0('0x3f')][_0x6fd0('0x81')]);_0x598ffa[_0x6fd0('0x36')](function(_0x78cd9b){_0x401b5b['or'](_0x6fd0('0x6f'),'%,'+_0x78cd9b+',%');});}if(_0x2d8d1d['query'][_0x6fd0('0x83')]){var _0x4503bc=_0x2d8d1d[_0x6fd0('0x3f')][_0x6fd0('0x83')][_0x6fd0('0x84')]('\x5c','\x5c\x5c')[_0x6fd0('0x84')](/'/g,'\x27\x27');if(qs[_0x6fd0('0x85')](_0x4503bc)){_0x3ed7d6['or'](_0x6fd0('0x86'),_0x4503bc+'%');}else{_0x3ed7d6['or'](_0x6fd0('0x87'),qs[_0x6fd0('0x68')](_0x4503bc))['or'](_0x6fd0('0x88'),_0x4503bc+'%')['or'](_0x6fd0('0x89'),_0x4503bc+'%');}}}_0x583ee9['where'](_0x3ed7d6);_0x583ee9[_0x6fd0('0x8a')](_0x6fd0('0x8b'));var _0x5de00e={'type':db['Sequelize'][_0x6fd0('0x8c')][_0x6fd0('0x8d')],'raw':!![]};var _0x4fba16=_0x583ee9['clone']();_0x4fba16[_0x6fd0('0x49')](_0x6fd0('0x8b'));_0x4fba16[_0x6fd0('0x49')](_0x6fd0('0x8e'),_0x6fd0('0x61'));if(_0x5d23b7[_0x6fd0('0x8f')]){_0x5d23b7[_0x6fd0('0x8f')][_0x6fd0('0x36')](function(_0xe5a1d0){var _0x276fd6=_0xe5a1d0[0x0]===_0x6fd0('0x90')?_0xe5a1d0[0x0]:'i.'+_0xe5a1d0[0x0];_0x583ee9[_0x6fd0('0x8f')](_0x276fd6,_0xe5a1d0[0x1]===_0x6fd0('0x91')?![]:!![]);});}if(!_[_0x6fd0('0x75')](_0x598ffa)){_0x583ee9[_0x6fd0('0x63')](_0x401b5b);_0x4fba16[_0x6fd0('0x48')]('t.id\x20IN\x20?',_0x598ffa);}BPromise[_0x6fd0('0x92')]()[_0x6fd0('0x2b')](function(){if(!_0x58475b){if(_0x2d8d1d[_0x6fd0('0x3f')]['OpenchannelAccountId'])return;_0x4fba16['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x583ee9[_0x6fd0('0x48')](_0x6fd0('0x93'));return;}if(_0x2d8d1d['user'][_0x6fd0('0x94')]!=='agent')return;return _0x2d8d1d[_0x6fd0('0x95')][_0x6fd0('0x96')]({'attributes':['id'],'raw':!![]})[_0x6fd0('0x2b')](function(_0x1c3cbd){if(_['isEmpty'](_0x1c3cbd)){_0x4fba16[_0x6fd0('0x48')](_0x6fd0('0x97'));_0x583ee9[_0x6fd0('0x48')](_0x6fd0('0x97'));}else{_0x4fba16[_0x6fd0('0x48')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x6fd0('0x32')](_0x1c3cbd,'id'));_0x583ee9[_0x6fd0('0x48')](_0x6fd0('0x98'),_['map'](_0x1c3cbd,'id'));}});})[_0x6fd0('0x2b')](function(){if(_0x2d8d1d[_0x6fd0('0x95')]['role']===_0x6fd0('0x99')&&!_0x58475b&&!_0x2d8d1d[_0x6fd0('0x3f')][_0x6fd0('0x76')])return[];return db['sequelize']['query'](_0x4fba16[_0x6fd0('0x9a')](),_0x5de00e);})[_0x6fd0('0x2b')](function(_0x2db76d){_0x5b212f['count']=_0x2db76d[_0x6fd0('0x44')];if(_0x5b212f['count']===0x0)return[];return db[_0x6fd0('0x9b')][_0x6fd0('0x3f')](_0x229ee5['toString'](),_0x5de00e)[_0x6fd0('0x2b')](function(_0x264baa){_0x1df0c9=_[_0x6fd0('0x9c')](_0x264baa,'id');_0x5de00e=_[_0x6fd0('0x9d')](_0x5de00e,{'model':db[_0x6fd0('0x9e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2d8d1d[_0x6fd0('0x3f')][_0x6fd0('0x43')]){_0x5d23b7[_0x6fd0('0x42')]['forEach'](function(_0x5b0e98){_0x583ee9['field']('i.'+_0x5b0e98);});}else{_0x583ee9[_0x6fd0('0x49')](_0x6fd0('0x8e'),_0x6fd0('0x61'));_0x583ee9[_0x6fd0('0x49')]('a.key',_0x6fd0('0x9f'));_0x583ee9[_0x6fd0('0x49')](_0x6fd0('0xa0'),_0x6fd0('0xa1'));_0x583ee9['field'](_0x6fd0('0xa2'),_0x6fd0('0x90'));_0x583ee9[_0x6fd0('0x49')](_0x6fd0('0xa3'));_0x583ee9[_0x6fd0('0x49')](_0x6fd0('0xa4'),'Contact.firstName');_0x583ee9[_0x6fd0('0x49')](_0x6fd0('0xa5'),'Contact.lastName');_0x583ee9['field'](_0x6fd0('0xa6'),'Contact.email');_0x583ee9[_0x6fd0('0x49')]('c.phone',_0x6fd0('0xa7'));_0x583ee9['field']('c.mobile',_0x6fd0('0xa8'));_0x583ee9['field'](_0x6fd0('0xa9'),_0x6fd0('0xaa'));_0x583ee9[_0x6fd0('0x49')](_0x6fd0('0xab'),_0x6fd0('0xac'));_0x583ee9[_0x6fd0('0x49')]('o.internal',_0x6fd0('0xad'));_0x583ee9['field'](_0x6fd0('0xae'),'TagIds');}if(_0x5d23b7['limit'])_0x583ee9['limit'](_0x5d23b7['limit']);if(_0x5d23b7[_0x6fd0('0x21')])_0x583ee9[_0x6fd0('0x21')](_0x5d23b7[_0x6fd0('0x21')]);return db['sequelize']['query'](_0x583ee9[_0x6fd0('0x9a')](),_0x5de00e);})['then'](function(_0x586779){if(_0x586779[_0x6fd0('0x44')]>0x0)_0x307eee[_0x6fd0('0x48')](_0x6fd0('0xaf'),_[_0x6fd0('0x32')](_0x586779,'id'));return db[_0x6fd0('0x9b')][_0x6fd0('0x3f')](_0x307eee[_0x6fd0('0x9a')](),_0x5de00e)[_0x6fd0('0x2b')](function(_0x2349f7){var _0x13a5bd=_[_0x6fd0('0xb0')](_0x2349f7,_0x6fd0('0xb1'));var _0x3f30c7=[];_0x586779[_0x6fd0('0x36')](function(_0x3afc96){_0x3f30c7['push'](updateOpenchannelInteraction(_0x3afc96,_0x1df0c9,_0x13a5bd));});return BPromise['all'](_0x3f30c7);});});})['then'](function(_0x200d6e){_0x5b212f[_0x6fd0('0xb2')]=_0x200d6e;return _0x5b212f;})[_0x6fd0('0x2b')](respondWithFilteredResult(_0x172492,_0x5d23b7))['catch'](handleError(_0x172492,null));};exports[_0x6fd0('0xb3')]=function(_0x9e50f,_0x2732f7){var _0x4ec999={};if(_0x9e50f[_0x6fd0('0x3f')]['type']&&_0x9e50f[_0x6fd0('0x3f')]['type']===_0x6fd0('0x4b')){_0x4ec999[_0x6fd0('0x4b')]=_0x9e50f[_0x6fd0('0xb4')]['id'];}else{_0x4ec999['id']=_0x9e50f[_0x6fd0('0xb4')]['id'];}var _0x4f7f34={'raw':![],'where':_0x4ec999},_0x5e4198={};_0x5e4198[_0x6fd0('0x3d')]=_['keys'](db['OpenchannelInteraction']['rawAttributes']);_0x5e4198['query']=_[_0x6fd0('0x3e')](_0x9e50f['query']);_0x5e4198[_0x6fd0('0x40')]=_[_0x6fd0('0x41')](_0x5e4198[_0x6fd0('0x3d')],_0x5e4198[_0x6fd0('0x3f')]);_0x4f7f34[_0x6fd0('0x42')]=_['intersection'](_0x5e4198['model'],qs['fields'](_0x9e50f[_0x6fd0('0x3f')][_0x6fd0('0x43')]));_0x4f7f34['attributes']=_0x4f7f34[_0x6fd0('0x42')][_0x6fd0('0x44')]?_0x4f7f34['attributes']:_0x5e4198['model'];if(_0x9e50f[_0x6fd0('0x3f')][_0x6fd0('0xb5')]){_0x4f7f34[_0x6fd0('0xb6')]=[{'all':!![]}];}_0x4f7f34=_['merge']({},_0x4f7f34,_0x9e50f[_0x6fd0('0xb7')]);return db['OpenchannelInteraction'][_0x6fd0('0x60')](_0x4f7f34)[_0x6fd0('0x2b')](handleEntityNotFound(_0x2732f7,null))['then'](respondWithResult(_0x2732f7,null))[_0x6fd0('0x38')](handleError(_0x2732f7,null));};exports['create']=function(_0x3a3ba5,_0x19fcc2){return db[_0x6fd0('0x9e')]['create'](_0x3a3ba5[_0x6fd0('0xb8')],{})['then'](respondWithResult(_0x19fcc2,0xc9))[_0x6fd0('0x38')](handleError(_0x19fcc2,null));};exports[_0x6fd0('0x2a')]=function(_0x14409e,_0xb2c4c9){if(_0x14409e['body']['id']){delete _0x14409e[_0x6fd0('0xb8')]['id'];}return db[_0x6fd0('0x9e')][_0x6fd0('0x60')]({'where':{'id':_0x14409e[_0x6fd0('0xb4')]['id']}})[_0x6fd0('0x2b')](handleEntityNotFound(_0xb2c4c9,null))['then'](saveUpdates(_0x14409e[_0x6fd0('0xb8')],null))[_0x6fd0('0x2b')](respondWithResult(_0xb2c4c9,null))[_0x6fd0('0x38')](handleError(_0xb2c4c9,null));};exports['destroy']=function(_0x5f9ac,_0x2a4604){return db[_0x6fd0('0x9e')]['find']({'where':{'id':_0x5f9ac[_0x6fd0('0xb4')]['id']}})[_0x6fd0('0x2b')](handleEntityNotFound(_0x2a4604,null))['then'](removeEntity(_0x2a4604,null))['catch'](handleError(_0x2a4604,null));};exports['describe']=function(_0x350ba4,_0x52a7a){return db['OpenchannelInteraction'][_0x6fd0('0xb9')]()[_0x6fd0('0x2b')](respondWithResult(_0x52a7a,null))[_0x6fd0('0x38')](handleError(_0x52a7a,null));};exports[_0x6fd0('0xba')]=function(_0x14a1a0,_0x53409e,_0x31a83e){return db[_0x6fd0('0xbb')]['find']({'where':{'id':_0x14a1a0[_0x6fd0('0xb4')]['id']}})['then'](handleEntityNotFound(_0x53409e,null))['then'](function(_0x2c4520){if(_0x2c4520){return _0x2c4520['addMessage'](_0x14a1a0['body'][_0x6fd0('0xbc')],_[_0x6fd0('0xbd')](_0x14a1a0[_0x6fd0('0xb8')],[_0x6fd0('0xbc'),'id'])||{});}})['then'](respondWithResult(_0x53409e,null))[_0x6fd0('0x38')](handleError(_0x53409e,null));};exports[_0x6fd0('0xbe')]=function(_0x4cc0fc,_0x5a75aa,_0x3eb423){var _0xf7d691={'raw':![],'where':{}};var _0x4b191e={};var _0x32663f={'count':0x0,'rows':[]};return db[_0x6fd0('0x9e')][_0x6fd0('0xbf')]({'where':{'id':_0x4cc0fc[_0x6fd0('0xb4')]['id']}})[_0x6fd0('0x2b')](handleEntityNotFound(_0x5a75aa,null))[_0x6fd0('0x2b')](function(_0x44cfc1){if(_0x44cfc1){_0x4b191e[_0x6fd0('0x3d')]=_[_0x6fd0('0x3e')](db[_0x6fd0('0xbb')]['rawAttributes']);_0x4b191e['query']=_[_0x6fd0('0x3e')](_0x4cc0fc[_0x6fd0('0x3f')]);_0x4b191e['filters']=_[_0x6fd0('0x41')](_0x4b191e[_0x6fd0('0x3d')],_0x4b191e[_0x6fd0('0x3f')]);_0xf7d691[_0x6fd0('0x42')]=_[_0x6fd0('0x41')](_0x4b191e[_0x6fd0('0x3d')],qs[_0x6fd0('0x43')](_0x4cc0fc['query']['fields']));_0xf7d691[_0x6fd0('0x42')]=_0xf7d691[_0x6fd0('0x42')][_0x6fd0('0x44')]?_0xf7d691[_0x6fd0('0x42')]:_0x4b191e[_0x6fd0('0x3d')];if(!_0x4cc0fc[_0x6fd0('0x3f')][_0x6fd0('0x45')](_0x6fd0('0x46'))){_0xf7d691[_0x6fd0('0x23')]=qs[_0x6fd0('0x23')](_0x4cc0fc[_0x6fd0('0x3f')][_0x6fd0('0x23')]);_0xf7d691['offset']=qs[_0x6fd0('0x21')](_0x4cc0fc[_0x6fd0('0x3f')][_0x6fd0('0x21')]);}_0xf7d691[_0x6fd0('0x8f')]=qs[_0x6fd0('0x47')](_0x4cc0fc['query'][_0x6fd0('0x47')]);_0xf7d691[_0x6fd0('0x48')]=qs[_0x6fd0('0x40')](_[_0x6fd0('0xc0')](_0x4cc0fc[_0x6fd0('0x3f')],_0x4b191e[_0x6fd0('0x40')]));_0xf7d691[_0x6fd0('0x48')]['OpenchannelInteractionId']=_0x44cfc1['id'];if(_0x4cc0fc[_0x6fd0('0x3f')][_0x6fd0('0x83')]){_0xf7d691[_0x6fd0('0x48')]=_[_0x6fd0('0x9d')](_0xf7d691[_0x6fd0('0x48')],{'$or':_[_0x6fd0('0x32')](_0xf7d691[_0x6fd0('0x42')],function(_0x1da565){var _0x5b60dc={};_0x5b60dc[_0x1da565]={'$like':'%'+_0x4cc0fc[_0x6fd0('0x3f')][_0x6fd0('0x83')]+'%'};return _0x5b60dc;})});}if(_0x4cc0fc[_0x6fd0('0x3f')][_0x6fd0('0x7a')]){var _0x48adf1=_0x4cc0fc[_0x6fd0('0x3f')][_0x6fd0('0x7a')][_0x6fd0('0x35')](',');var _0x59b9fb={};_0x59b9fb[_0x48adf1[0x0]]={'$gte':moment(_0x48adf1[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0xf7d691[_0x6fd0('0x48')]=_[_0x6fd0('0x9d')](_0xf7d691[_0x6fd0('0x48')],_0x59b9fb);}_0xf7d691=_[_0x6fd0('0x9d')]({},_0xf7d691,_0x4cc0fc[_0x6fd0('0xb7')]);return db[_0x6fd0('0xbb')][_0x6fd0('0x24')]({'where':_0xf7d691['where']})[_0x6fd0('0x2b')](function(_0x5bd4ce){_0x32663f['count']=_0x5bd4ce;if(_0x4cc0fc[_0x6fd0('0x3f')]['includeAll']){_0xf7d691[_0x6fd0('0xb6')]=[{'all':!![]}];}return db[_0x6fd0('0xbb')][_0x6fd0('0xc1')](_0xf7d691);})[_0x6fd0('0x2b')](function(_0x356b83){_0x32663f[_0x6fd0('0xb2')]=_0x356b83;return _0x32663f;});}})[_0x6fd0('0x2b')](respondWithFilteredResult(_0x5a75aa,_0xf7d691))[_0x6fd0('0x38')](handleError(_0x5a75aa,null));};exports[_0x6fd0('0xc2')]=function(_0x3e0d9e,_0x4063a1,_0x574a20){return db[_0x6fd0('0x9e')]['find']({'where':{'id':_0x3e0d9e['params']['id']}})[_0x6fd0('0x2b')](handleEntityNotFound(_0x4063a1,null))[_0x6fd0('0x2b')](function(_0x1293da){if(_0x1293da){return _0x1293da[_0x6fd0('0xc3')](_0x3e0d9e[_0x6fd0('0xb8')][_0x6fd0('0xbc')],_['omit'](_0x3e0d9e['body'],[_0x6fd0('0xbc'),'id'])||{})[_0x6fd0('0xc4')](function(){return db[_0x6fd0('0x6e')][_0x6fd0('0xc1')]({'attributes':['id',_0x6fd0('0x2f'),'color'],'where':{'id':_0x3e0d9e[_0x6fd0('0xb8')][_0x6fd0('0xbc')]}});})[_0x6fd0('0x2b')](function(_0x55830f){socket[_0x6fd0('0xc5')]('openchannelInteractionTags:save',{'id':Number(_0x3e0d9e[_0x6fd0('0xb4')]['id']),'tags':_0x55830f||[]});return{'id':Number(_0x3e0d9e[_0x6fd0('0xb4')]['id']),'tags':_0x55830f||[]};});}})[_0x6fd0('0x2b')](respondWithResult(_0x4063a1,null))['catch'](handleError(_0x4063a1,null));};exports[_0x6fd0('0xc6')]=function(_0x440b71,_0x28f495,_0x21cbab){return db[_0x6fd0('0x9e')]['find']({'where':{'id':_0x440b71[_0x6fd0('0xb4')]['id']}})[_0x6fd0('0x2b')](handleEntityNotFound(_0x28f495,null))[_0x6fd0('0x2b')](function(_0x4d0d13){if(_0x4d0d13){return _0x4d0d13['removeTags'](_0x440b71[_0x6fd0('0x3f')]['ids']);}})[_0x6fd0('0x2b')](respondWithStatusCode(_0x28f495,null))[_0x6fd0('0x38')](handleError(_0x28f495,null));};exports[_0x6fd0('0xc7')]=function(_0xe584db,_0x2b8ea7){var _0x56f0d4=moment()[_0x6fd0('0xc8')]()[_0x6fd0('0x9a')]();var _0x29f58c=path[_0x6fd0('0xc9')](config[_0x6fd0('0xca')],_0x6fd0('0xcb'),_0x6fd0('0xcc'),'tmp');var _0x2e5732=path['join'](config[_0x6fd0('0xca')],_0x6fd0('0xcb'),_0x6fd0('0xcc'),_0x6fd0('0xcd'));var _0x1a9378=path['join'](_0x29f58c,_0x56f0d4);var _0x2912a4=util[_0x6fd0('0xce')](_0x6fd0('0xcf'),_0xe584db[_0x6fd0('0xb4')]['id'],_0x56f0d4);var _0x1b46d3=path[_0x6fd0('0xc9')](_0x29f58c,_0x2912a4);var _0x3e1b43=[];_0x3e1b43[_0x6fd0('0x37')]({'model':db['User'],'as':_0x6fd0('0xd0'),'attributes':['id',_0x6fd0('0xd1')],'raw':!![]});_0x3e1b43[_0x6fd0('0x37')]({'model':db[_0x6fd0('0xd2')],'as':'Contact','attributes':['id','firstName',_0x6fd0('0xd3')],'raw':!![]});if(_0xe584db[_0x6fd0('0x3f')][_0x6fd0('0xcd')]){_0x3e1b43['push']({'model':db[_0x6fd0('0xd4')],'as':'Attachment','raw':!![]});}var _0x131631=[{'model':db[_0x6fd0('0xbb')],'as':_0x6fd0('0xd5'),'attributes':['id',_0x6fd0('0xb8'),_0x6fd0('0x78'),'direction',_0x6fd0('0xd6'),_0x6fd0('0x7f')],'include':_0x3e1b43}];_0x131631['push']({'model':db[_0x6fd0('0xd7')],'as':_0x6fd0('0xd8'),'attributes':['id',_0x6fd0('0x2f')]});_0x131631['push']({'model':db[_0x6fd0('0xd0')],'as':'Owner','attributes':['id','fullname']});return db[_0x6fd0('0x9e')][_0x6fd0('0x60')]({'where':{'id':_0xe584db[_0x6fd0('0xb4')]['id']},'include':_0x131631})[_0x6fd0('0x2b')](handleEntityNotFound(_0x2b8ea7,null))['then'](function(_0x330a2f){if(_0x330a2f){var _0xe392bb=_0x330a2f['get']({'plain':!![]});fs['mkdirSync'](_0x1a9378);var _0x12e546={'channel':_0x6fd0('0xd9'),'account':_0xe392bb[_0x6fd0('0xd8')]['name'],'agent':_0xe392bb['Owner']?_0xe392bb[_0x6fd0('0xda')][_0x6fd0('0xd1')]:_0x6fd0('0xdb'),'createdAt':moment(_0xe392bb[_0x6fd0('0x78')])[_0x6fd0('0xce')](_0x6fd0('0xdc'))[_0x6fd0('0x9a')](),'closedAt':_0xe392bb[_0x6fd0('0xdd')]?moment(_0xe392bb[_0x6fd0('0xde')])[_0x6fd0('0xce')](_0x6fd0('0xdc'))['toString']():'','disposition':_0xe392bb['disposition'],'visibility':_0xe392bb[_0x6fd0('0xdf')]?'Public':'Private','messages':_(_0xe392bb[_0x6fd0('0xd5')])[_0x6fd0('0x83')]({'secret':![]})[_0x6fd0('0x32')](function(_0x179c02){if(_0x179c02[_0x6fd0('0xd4')]){var _0x23bc0d=path['join'](_0x2e5732,_0x179c02[_0x6fd0('0xd4')][_0x6fd0('0xe0')]);if(fs[_0x6fd0('0xe1')](_0x23bc0d)){fs[_0x6fd0('0xe2')](_0x23bc0d)[_0x6fd0('0xe3')](fs[_0x6fd0('0xe4')](path['join'](_0x1a9378,_0x179c02[_0x6fd0('0xd4')][_0x6fd0('0xe0')])));}}return{'date':moment(_0x179c02[_0x6fd0('0x78')])[_0x6fd0('0xce')](_0x6fd0('0xdc'))['toString'](),'sender':_0x179c02[_0x6fd0('0xe5')]===_0x6fd0('0xe6')?_0x179c02[_0x6fd0('0xd0')]?_0x179c02[_0x6fd0('0xd0')][_0x6fd0('0xd1')]:_0x6fd0('0xe7'):_0x179c02[_0x6fd0('0x65')][_0x6fd0('0xe8')]+(_0x179c02['Contact'][_0x6fd0('0xd3')]?'\x20'+_0x179c02[_0x6fd0('0x65')][_0x6fd0('0xd3')]:''),'body':_0x179c02[_0x6fd0('0xd4')]?_0x179c02[_0x6fd0('0xd4')][_0x6fd0('0xe0')]:_0x179c02[_0x6fd0('0xb8')],'direction':_0x179c02[_0x6fd0('0xe5')]==='out'?'A':'C','secret':_0x179c02[_0x6fd0('0xd6')],'read':_0x179c02[_0x6fd0('0x7f')],'attachment':_0x179c02[_0x6fd0('0xd4')]};})['value']()};return ejs[_0x6fd0('0xe9')](path[_0x6fd0('0xc9')](config[_0x6fd0('0xca')],_0x6fd0('0xcb'),_0x6fd0('0xea'),'downloadInteraction.ejs'),{'interaction':_0x12e546})[_0x6fd0('0x2b')](function(_0x39adf1){var _0x1adfcf=path[_0x6fd0('0xc9')](_0x1a9378,_0x6fd0('0xeb')+_0xe392bb['id']+'-'+_0x56f0d4+'.pdf');var _0x3043c1={'path':_0x1adfcf,'channel':'Openchannel','interactionId':_0xe392bb['id']};return pdf[_0x6fd0('0xec')](_0x39adf1,_0x3043c1);})[_0x6fd0('0x2b')](function(){return new BPromise(function(_0x5632b9,_0x136a2e){zipdir(_0x1a9378,{'saveTo':_0x1b46d3},function(_0x3c1340,_0x2bf13a){if(_0x3c1340)return _0x136a2e(_0x3c1340);return _0x5632b9(_0x2bf13a);});})[_0x6fd0('0x2b')](function(){return new BPromise(function(_0x9dfe29,_0x547835){rimraf(_0x1a9378,function(_0x4ed3fe){if(_0x4ed3fe)_0x547835(_0x4ed3fe);return _0x9dfe29();});});})[_0x6fd0('0x2b')](function(){return _0x2b8ea7[_0x6fd0('0xc7')](_0x1b46d3,_0x2912a4,function(_0x1f3248){if(_0x1f3248){console['log'](_0x6fd0('0xed'),_0x1f3248);}else{fs['unlinkSync'](_0x1b46d3);}});});});}else{return _0x2b8ea7['sendStatus'](0xc8);}})[_0x6fd0('0x38')](handleError(_0x2b8ea7,null));}; \ No newline at end of file +var _0x483b=['User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','type','body','some','isEmpty','OpenchannelAccountId','concat','$gte','parse','$lte','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','rows','show','params','includeAll','include','merge','options','create','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','OpenchannelInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','spread','openchannelInteractionTags:save','removeTags','join','root','server','files','attachments','transcript-%d-%s.zip','CmContact','Contact','firstName','Attachment','Messages','createdAt','OpenchannelAccount','Account','Owner','get','mkdirSync','N.A.','closed','disposition','threadId','Public','existsSync','pipe','createWriteStream','basename','direction','out','lastName','secret','renderFile','views','downloadInteraction.ejs','transcript-','Openchannel','createPdfFromHTML','download','err','unlinkSync','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','update','then','destroy','error','name','send','fullname','TagIds','Tags','forEach','push','catch','index','map','OpenchannelInteraction','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','from','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_accounts','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?'];(function(_0x3d071f,_0x5a3d26){var _0x21ebfb=function(_0x5a2d01){while(--_0x5a2d01){_0x3d071f['push'](_0x3d071f['shift']());}};_0x21ebfb(++_0x5a3d26);}(_0x483b,0x165));var _0xb483=function(_0x164107,_0x54165f){_0x164107=_0x164107-0x0;var _0x209696=_0x483b[_0x164107];return _0x209696;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb483('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb483('0x1'));var moment=require(_0xb483('0x2'));var BPromise=require(_0xb483('0x3'));var Mustache=require(_0xb483('0x4'));var util=require(_0xb483('0x5'));var path=require(_0xb483('0x6'));var sox=require(_0xb483('0x7'));var csv=require(_0xb483('0x8'));var ejs=require(_0xb483('0x9'));var fs=require('fs');var fs_extra=require(_0xb483('0xa'));var _=require(_0xb483('0xb'));var squel=require(_0xb483('0xc'));var crypto=require('crypto');var jsforce=require(_0xb483('0xd'));var deskjs=require(_0xb483('0xe'));var toCsv=require(_0xb483('0x8'));var querystring=require(_0xb483('0xf'));var Papa=require(_0xb483('0x10'));var Redis=require(_0xb483('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb483('0x12'));var pdf=require(_0xb483('0x13'));var hardwareService=require(_0xb483('0x14'));var logger=require(_0xb483('0x15'))('api');var utils=require(_0xb483('0x16'));var config=require(_0xb483('0x17'));var licenseUtil=require(_0xb483('0x18'));var db=require('../../mysqldb')['db'];config[_0xb483('0x19')]=_[_0xb483('0x1a')](config[_0xb483('0x19')],{'host':_0xb483('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb483('0x19')]));require(_0xb483('0x1c'))[_0xb483('0x1d')](socket);function respondWithStatusCode(_0x21f4e6,_0x225ffa){_0x225ffa=_0x225ffa||0xcc;return function(_0x1105e6){if(_0x1105e6){return _0x21f4e6[_0xb483('0x1e')](_0x225ffa);}return _0x21f4e6[_0xb483('0x1f')](_0x225ffa)[_0xb483('0x20')]();};}function respondWithResult(_0xe28f83,_0x39197b){_0x39197b=_0x39197b||0xc8;return function(_0x660229){if(_0x660229){return _0xe28f83[_0xb483('0x1f')](_0x39197b)['json'](_0x660229);}};}function respondWithFilteredResult(_0x4d39c,_0x444594){return function(_0x3f3fe6){if(_0x3f3fe6){var _0x3b6e13=typeof _0x444594['offset']===_0xb483('0x21')&&typeof _0x444594[_0xb483('0x22')]===_0xb483('0x21');var _0x1f2054=_0x3f3fe6[_0xb483('0x23')];var _0x36e359=_0x3b6e13?0x0:_0x444594[_0xb483('0x24')];var _0x899356=_0x3b6e13?_0x3f3fe6[_0xb483('0x23')]:_0x444594[_0xb483('0x24')]+_0x444594[_0xb483('0x22')];var _0x2f89dc;if(_0x899356>=_0x1f2054){_0x899356=_0x1f2054;_0x2f89dc=0xc8;}else{_0x2f89dc=0xce;}_0x4d39c[_0xb483('0x1f')](_0x2f89dc);return _0x4d39c[_0xb483('0x25')](_0xb483('0x26'),_0x36e359+'-'+_0x899356+'/'+_0x1f2054)[_0xb483('0x27')](_0x3f3fe6);}return null;};}function patchUpdates(_0x22cdf1){return function(_0x46ee41){try{jsonpatch['apply'](_0x46ee41,_0x22cdf1,!![]);}catch(_0x55db96){return BPromise[_0xb483('0x28')](_0x55db96);}return _0x46ee41['save']();};}function saveUpdates(_0x23b45d,_0x4adf81){return function(_0x12477e){if(_0x12477e){return _0x12477e[_0xb483('0x29')](_0x23b45d)[_0xb483('0x2a')](function(_0x30d691){return _0x30d691;});}return null;};}function removeEntity(_0x2ca6ff,_0x3fb9bf){return function(_0x321b68){if(_0x321b68){return _0x321b68[_0xb483('0x2b')]()[_0xb483('0x2a')](function(){_0x2ca6ff[_0xb483('0x1f')](0xcc)[_0xb483('0x20')]();});}};}function handleEntityNotFound(_0x26f726,_0x737e6f){return function(_0x28c029){if(!_0x28c029){_0x26f726['sendStatus'](0x194);}return _0x28c029;};}function handleError(_0xc2aa17,_0x404147){_0x404147=_0x404147||0x1f4;return function(_0x254fef){logger[_0xb483('0x2c')](_0x254fef['stack']);if(_0x254fef['name']){delete _0x254fef[_0xb483('0x2d')];}_0xc2aa17['status'](_0x404147)[_0xb483('0x2e')](_0x254fef);};}function getInteractionUsers(_0x3803a7,_0x2618f){return new BPromise(function(_0x390a60,_0x4ed0be){try{if(_0x2618f[_0x3803a7['id']]){_0x3803a7['Users']=_['map'](_0x2618f[_0x3803a7['id']],function(_0x5ae672){return{'id':_0x5ae672['id'],'fullname':_0x5ae672[_0xb483('0x2f')]};});}}catch(_0x1c27d5){_0x4ed0be(_0x1c27d5);}_0x390a60(_0x3803a7);});}function getInteractionTags(_0x1bbc0f,_0xcc637b){return new BPromise(function(_0xeac2ab,_0x1a6f01){try{if(_0x1bbc0f[_0xb483('0x30')]){_0x1bbc0f[_0xb483('0x31')]=[];_0x1bbc0f[_0xb483('0x30')]['split'](',')[_0xb483('0x32')](function(_0x2a27c8){_0x1bbc0f[_0xb483('0x31')][_0xb483('0x33')](_0xcc637b[_0x2a27c8]);});}delete _0x1bbc0f['TagIds'];}catch(_0x249716){_0x1a6f01(_0x249716);}_0xeac2ab(_0x1bbc0f);});}function updateOpenchannelInteraction(_0x266e71,_0x3dc2a2,_0x1bf5e6){return new BPromise(function(_0x53ce8b,_0x1bcf3a){return getInteractionUsers(_0x266e71,_0x1bf5e6)[_0xb483('0x2a')](function(_0x268303){return getInteractionTags(_0x268303,_0x3dc2a2);})['then'](function(_0x55752a){_0x53ce8b(_0x55752a);})[_0xb483('0x34')](function(_0x4bae8b){_0x1bcf3a(_0x4bae8b);});});}exports[_0xb483('0x35')]=function(_0x3e39b5,_0x7aa6c9){var _0x1535eb={},_0x234a7a={},_0x34de54={'count':0x0,'rows':[]};var _0x26d718=_[_0xb483('0x36')](db[_0xb483('0x37')][_0xb483('0x38')],function(_0x14c98e){return{'name':_0x14c98e[_0xb483('0x39')],'type':_0x14c98e['type'][_0xb483('0x3a')]};});_0x234a7a[_0xb483('0x3b')]=_[_0xb483('0x36')](_0x26d718,_0xb483('0x2d'));_0x234a7a['query']=_[_0xb483('0x3c')](_0x3e39b5[_0xb483('0x3d')]);_0x234a7a[_0xb483('0x3e')]=_[_0xb483('0x3f')](_0x234a7a[_0xb483('0x3b')],_0x234a7a[_0xb483('0x3d')]);_0x1535eb[_0xb483('0x40')]=_[_0xb483('0x3f')](_0x234a7a[_0xb483('0x3b')],qs[_0xb483('0x41')](_0x3e39b5[_0xb483('0x3d')]['fields']));_0x1535eb[_0xb483('0x40')]=_0x1535eb[_0xb483('0x40')][_0xb483('0x42')]?_0x1535eb[_0xb483('0x40')]:_0x234a7a[_0xb483('0x3b')];if(!_0x3e39b5[_0xb483('0x3d')][_0xb483('0x43')](_0xb483('0x44'))){_0x1535eb['limit']=qs['limit'](_0x3e39b5['query'][_0xb483('0x22')]);_0x1535eb['offset']=qs[_0xb483('0x24')](_0x3e39b5[_0xb483('0x3d')]['offset']);}_0x1535eb['order']=qs[_0xb483('0x45')](_0x3e39b5[_0xb483('0x3d')][_0xb483('0x45')]);_0x1535eb[_0xb483('0x46')]=qs[_0xb483('0x3e')](_[_0xb483('0x47')](_0x3e39b5[_0xb483('0x3d')],_0x234a7a[_0xb483('0x3e')]),_0x26d718);var _0x180565=[];var _0x4bcf81=squel[_0xb483('0x48')]()[_0xb483('0x49')]('id')[_0xb483('0x49')](_0xb483('0x2d'))[_0xb483('0x49')](_0xb483('0x4a'))['from'](_0xb483('0x4b'));var _0x2fe83b=squel[_0xb483('0x48')]()[_0xb483('0x49')](_0xb483('0x4c'))[_0xb483('0x49')](_0xb483('0x4d'))['field'](_0xb483('0x4e'))[_0xb483('0x4f')]('user_has_openchannel_interactions','ui')[_0xb483('0x50')](_0xb483('0x51'),'u',_0xb483('0x52'));var _0x2c3af5=squel[_0xb483('0x48')]()['from'](_0xb483('0x53'),'i')['left_join']('cm_contacts','c',_0xb483('0x54'))[_0xb483('0x50')](_0xb483('0x51'),'o',_0xb483('0x55'))[_0xb483('0x50')](_0xb483('0x56'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0xb483('0x50')](_0xb483('0x57'),'me',_0xb483('0x58'))[_0xb483('0x50')]('openchannel_interaction_has_tags','it',_0xb483('0x59'))['left_join'](_0xb483('0x4b'),'t',_0xb483('0x5a'));var _0x37457d=squel[_0xb483('0x5b')]();var _0x17af4b=[];var _0x3716d6=squel[_0xb483('0x5b')]();var _0xbe1e20;if(_0x3e39b5[_0xb483('0x3d')]['search']){_0xbe1e20=as['parseSearch'](_0x3e39b5[_0xb483('0x3d')][_0xb483('0x5c')]);var _0x1b7b9a=_0xbe1e20['sqlOperator'];for(var _0x47d784=0x0;_0x47d784<_0xbe1e20['conditions'][_0xb483('0x42')];_0x47d784++){var _0x2f94f6=_0xbe1e20[_0xb483('0x5d')][_0x47d784];var _0x12d000='i';var _0x290a37=_[_0xb483('0x5e')](_0x26d718,[_0xb483('0x2d'),_0x2f94f6['field']]);if(!_0x290a37){switch(_0x2f94f6['field']){case _0xb483('0x5f'):if(_0x2f94f6[_0xb483('0x60')]==0x1){_0x2c3af5[_0xb483('0x61')]('`'+_0x2f94f6[_0xb483('0x49')]+_0xb483('0x62'));}else{_0x2c3af5[_0xb483('0x61')]('`'+_0x2f94f6['field']+_0xb483('0x63'));}break;case'Contact':if(_0x2f94f6['operator']===_0xb483('0x64')){if(_0x2f94f6['value'][_0xb483('0x65')]('\x20')['length']>0x1){_0x37457d[_0x1b7b9a](_0xb483('0x66'),qs[_0xb483('0x67')](_0x2f94f6[_0xb483('0x60')]),null);}else{var _0x1fb784='%'+_0x2f94f6[_0xb483('0x60')]+'%';_0x37457d[_0x1b7b9a](_0xb483('0x68'),_0x1fb784,_0x1fb784,_0x1fb784);}}else{_0x290a37=_['find'](_0x26d718,[_0xb483('0x2d'),_0xb483('0x69')]);_0x2f94f6[_0xb483('0x49')]=_0xb483('0x69');_0x289cd4=as[_0xb483('0x6a')](_0x12d000,_0x290a37['type'],_0x2f94f6);_0x37457d[_0x1b7b9a](_0x289cd4[_0xb483('0x6b')],_0x289cd4['value'][_0xb483('0x6c')],_0x289cd4[_0xb483('0x60')][_0xb483('0x20')]);}break;case _0xb483('0x6d'):var _0x221303=_0x2f94f6[_0xb483('0x60')]['split'](',')['map'](function(_0x2c9f41){return Number(_0x2c9f41);});_0x221303['forEach'](function(_0x681af){_0x3716d6['or'](_0xb483('0x6e'),'%,'+_0x681af+',%');});_0x17af4b=_['union'](_0x17af4b,_0x221303);break;case _0xb483('0x6f'):if(_0x2f94f6['operator']===_0xb483('0x64')){_0x37457d[_0x1b7b9a](_0xb483('0x70'),'%'+_0x2f94f6[_0xb483('0x60')]+'%',null);}else{_0x290a37=_[_0xb483('0x5e')](_0x26d718,[_0xb483('0x2d'),_0xb483('0x71')]);_0x2f94f6[_0xb483('0x49')]='UserId';_0x289cd4=as[_0xb483('0x6a')](_0x12d000,_0x290a37[_0xb483('0x72')],_0x2f94f6);_0x37457d[_0x1b7b9a](_0x289cd4[_0xb483('0x6b')],_0x289cd4[_0xb483('0x60')]['start'],_0x289cd4[_0xb483('0x60')][_0xb483('0x20')]);}break;case _0xb483('0x73'):_0x289cd4=as[_0xb483('0x6a')]('me',null,_0x2f94f6);_0x37457d[_0x1b7b9a](_0x289cd4[_0xb483('0x6b')],_0x289cd4[_0xb483('0x60')][_0xb483('0x6c')],_0x289cd4[_0xb483('0x60')][_0xb483('0x20')]);break;}}else{var _0x289cd4=as[_0xb483('0x6a')](_0x12d000,_0x290a37['type'],_0x2f94f6);_0x37457d[_0x1b7b9a](_0x289cd4['text'],_0x289cd4[_0xb483('0x60')][_0xb483('0x6c')],_0x289cd4[_0xb483('0x60')][_0xb483('0x20')]);}}}else{var _0x25a44a=_(_0x3e39b5[_0xb483('0x3d')])[_0xb483('0x3c')]()[_0xb483('0x36')](function(_0x778417){return _[_0xb483('0x74')](_0x26d718,[_0xb483('0x2d'),_0x778417])?_0x778417:undefined;})['compact']()[_0xb483('0x60')]();if(!_[_0xb483('0x75')](_0x25a44a)){_0x25a44a[_0xb483('0x32')](function(_0x33847a){if(_0x33847a===_0xb483('0x76')){_0x2c3af5[_0xb483('0x46')]('i.OpenchannelAccountId\x20IN\x20?',[][_0xb483('0x77')](_0x3e39b5[_0xb483('0x3d')][_0x33847a]));}else if(_0x33847a==='createdAt'){var _0x10ffd6=JSON['parse'](_0x3e39b5[_0xb483('0x3d')][_0x33847a])[_0xb483('0x78')];var _0x35586e=JSON[_0xb483('0x79')](_0x3e39b5[_0xb483('0x3d')][_0x33847a])[_0xb483('0x7a')];_0x2c3af5['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x10ffd6,_0x35586e);}else{if(_0x3e39b5[_0xb483('0x3d')][_0x33847a]==='null'){_0x2c3af5['where']('i.'+_0x33847a+'\x20IS\x20NULL');}else{_0x2c3af5[_0xb483('0x46')]('i.'+_0x33847a+_0xb483('0x7b'),_0x3e39b5[_0xb483('0x3d')][_0x33847a]);}}});}if(_0x3e39b5[_0xb483('0x3d')]['read']){if(_0x3e39b5[_0xb483('0x3d')][_0xb483('0x7c')]==0x1){_0x2c3af5[_0xb483('0x61')](_0xb483('0x7d'));}else{_0x2c3af5[_0xb483('0x61')](_0xb483('0x7e'));}}if(_0x3e39b5[_0xb483('0x3d')][_0xb483('0x7f')]){_0x17af4b=_[_0xb483('0x80')](_0x3e39b5[_0xb483('0x3d')][_0xb483('0x7f')])?_0x3e39b5[_0xb483('0x3d')][_0xb483('0x7f')]:new Array(_0x3e39b5[_0xb483('0x3d')][_0xb483('0x7f')]);_0x17af4b[_0xb483('0x32')](function(_0x38c602){_0x3716d6['or'](_0xb483('0x6e'),'%,'+_0x38c602+',%');});}if(_0x3e39b5[_0xb483('0x3d')][_0xb483('0x81')]){var _0x4631dd=_0x3e39b5[_0xb483('0x3d')][_0xb483('0x81')][_0xb483('0x82')]('\x5c','\x5c\x5c')[_0xb483('0x82')](/'/g,'\x27\x27');if(qs[_0xb483('0x83')](_0x4631dd)){_0x37457d['or'](_0xb483('0x84'),_0x4631dd+'%');}else{_0x37457d['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb483('0x67')](_0x4631dd))['or']('i.from\x20LIKE\x20?',_0x4631dd+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x4631dd+'%');}}}_0x2c3af5[_0xb483('0x46')](_0x37457d);_0x2c3af5['group'](_0xb483('0x85'));var _0x555d1d={'type':db[_0xb483('0x86')][_0xb483('0x87')][_0xb483('0x88')],'raw':!![]};var _0x131ce8=_0x2c3af5['clone']();_0x131ce8[_0xb483('0x49')](_0xb483('0x85'));_0x131ce8[_0xb483('0x49')](_0xb483('0x89'),_0xb483('0x5f'));if(_0x1535eb[_0xb483('0x8a')]){_0x1535eb[_0xb483('0x8a')][_0xb483('0x32')](function(_0xeba342){var _0x378326=_0xeba342[0x0]===_0xb483('0x8b')?_0xeba342[0x0]:'i.'+_0xeba342[0x0];_0x2c3af5['order'](_0x378326,_0xeba342[0x1]===_0xb483('0x8c')?![]:!![]);});}if(!_['isEmpty'](_0x17af4b)){_0x2c3af5[_0xb483('0x61')](_0x3716d6);_0x131ce8[_0xb483('0x46')](_0xb483('0x8d'),_0x17af4b);}BPromise[_0xb483('0x8e')]()[_0xb483('0x2a')](function(){if(!_0xbe1e20){if(_0x3e39b5[_0xb483('0x3d')][_0xb483('0x76')])return;_0x131ce8[_0xb483('0x46')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x2c3af5[_0xb483('0x46')](_0xb483('0x8f'));return;}if(_0x3e39b5['user'][_0xb483('0x90')]!==_0xb483('0x91'))return;return _0x3e39b5[_0xb483('0x92')][_0xb483('0x93')]({'attributes':['id'],'raw':!![]})[_0xb483('0x2a')](function(_0x2e7573){if(_['isEmpty'](_0x2e7573)){_0x131ce8[_0xb483('0x46')](_0xb483('0x94'));_0x2c3af5[_0xb483('0x46')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x131ce8[_0xb483('0x46')]('i.OpenchannelAccountId\x20IN\x20?',_[_0xb483('0x36')](_0x2e7573,'id'));_0x2c3af5['where'](_0xb483('0x95'),_['map'](_0x2e7573,'id'));}});})[_0xb483('0x2a')](function(){if(_0x3e39b5[_0xb483('0x92')]['role']===_0xb483('0x91')&&!_0xbe1e20&&!_0x3e39b5[_0xb483('0x3d')][_0xb483('0x76')])return[];return db[_0xb483('0x96')][_0xb483('0x3d')](_0x131ce8[_0xb483('0x97')](),_0x555d1d);})['then'](function(_0x34938d){_0x34de54[_0xb483('0x23')]=_0x34938d[_0xb483('0x42')];if(_0x34de54[_0xb483('0x23')]===0x0)return[];return db[_0xb483('0x96')]['query'](_0x4bcf81[_0xb483('0x97')](),_0x555d1d)['then'](function(_0x5d6167){_0x180565=_[_0xb483('0x98')](_0x5d6167,'id');_0x555d1d=_['merge'](_0x555d1d,{'model':db[_0xb483('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3e39b5[_0xb483('0x3d')][_0xb483('0x41')]){_0x1535eb[_0xb483('0x40')][_0xb483('0x32')](function(_0x124cfb){_0x2c3af5[_0xb483('0x49')]('i.'+_0x124cfb);});}else{_0x2c3af5[_0xb483('0x49')](_0xb483('0x89'),'unreadMessages');_0x2c3af5['field'](_0xb483('0x99'),_0xb483('0x9a'));_0x2c3af5[_0xb483('0x49')](_0xb483('0x9b'),_0xb483('0x9c'));_0x2c3af5['field']('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',_0xb483('0x8b'));_0x2c3af5[_0xb483('0x49')]('i.*');_0x2c3af5[_0xb483('0x49')](_0xb483('0x9d'),_0xb483('0x9e'));_0x2c3af5[_0xb483('0x49')](_0xb483('0x9f'),_0xb483('0xa0'));_0x2c3af5[_0xb483('0x49')]('c.email',_0xb483('0xa1'));_0x2c3af5['field'](_0xb483('0xa2'),'Contact.phone');_0x2c3af5[_0xb483('0x49')](_0xb483('0xa3'),_0xb483('0xa4'));_0x2c3af5[_0xb483('0x49')](_0xb483('0xa5'),_0xb483('0xa6'));_0x2c3af5[_0xb483('0x49')]('o.fullname',_0xb483('0xa7'));_0x2c3af5[_0xb483('0x49')](_0xb483('0xa8'),_0xb483('0xa9'));_0x2c3af5[_0xb483('0x49')](_0xb483('0xaa'),'TagIds');}if(_0x1535eb[_0xb483('0x22')])_0x2c3af5[_0xb483('0x22')](_0x1535eb[_0xb483('0x22')]);if(_0x1535eb['offset'])_0x2c3af5['offset'](_0x1535eb['offset']);return db[_0xb483('0x96')]['query'](_0x2c3af5[_0xb483('0x97')](),_0x555d1d);})['then'](function(_0xf866c5){if(_0xf866c5['length']>0x0)_0x2fe83b['where'](_0xb483('0xab'),_[_0xb483('0x36')](_0xf866c5,'id'));return db[_0xb483('0x96')]['query'](_0x2fe83b['toString'](),_0x555d1d)[_0xb483('0x2a')](function(_0x499f0a){var _0x1f4c94=_['groupBy'](_0x499f0a,'OpenchannelInteractionId');var _0x46665d=[];_0xf866c5[_0xb483('0x32')](function(_0x4f2bf8){_0x46665d[_0xb483('0x33')](updateOpenchannelInteraction(_0x4f2bf8,_0x180565,_0x1f4c94));});return BPromise['all'](_0x46665d);});});})[_0xb483('0x2a')](function(_0x4607f0){_0x34de54[_0xb483('0xac')]=_0x4607f0;return _0x34de54;})[_0xb483('0x2a')](respondWithFilteredResult(_0x7aa6c9,_0x1535eb))[_0xb483('0x34')](handleError(_0x7aa6c9,null));};exports[_0xb483('0xad')]=function(_0x4f437f,_0x1f4de3){var _0x400bfb={};if(_0x4f437f[_0xb483('0x3d')][_0xb483('0x72')]&&_0x4f437f[_0xb483('0x3d')][_0xb483('0x72')]==='from'){_0x400bfb[_0xb483('0x4f')]=_0x4f437f[_0xb483('0xae')]['id'];}else{_0x400bfb['id']=_0x4f437f['params']['id'];}var _0x1d24c7={'raw':![],'where':_0x400bfb},_0x18f69f={};_0x18f69f[_0xb483('0x3b')]=_['keys'](db[_0xb483('0x37')][_0xb483('0x38')]);_0x18f69f[_0xb483('0x3d')]=_[_0xb483('0x3c')](_0x4f437f[_0xb483('0x3d')]);_0x18f69f[_0xb483('0x3e')]=_[_0xb483('0x3f')](_0x18f69f['model'],_0x18f69f[_0xb483('0x3d')]);_0x1d24c7[_0xb483('0x40')]=_[_0xb483('0x3f')](_0x18f69f[_0xb483('0x3b')],qs['fields'](_0x4f437f['query'][_0xb483('0x41')]));_0x1d24c7[_0xb483('0x40')]=_0x1d24c7['attributes'][_0xb483('0x42')]?_0x1d24c7[_0xb483('0x40')]:_0x18f69f[_0xb483('0x3b')];if(_0x4f437f[_0xb483('0x3d')][_0xb483('0xaf')]){_0x1d24c7[_0xb483('0xb0')]=[{'all':!![]}];}_0x1d24c7=_[_0xb483('0xb1')]({},_0x1d24c7,_0x4f437f[_0xb483('0xb2')]);return db[_0xb483('0x37')][_0xb483('0x5e')](_0x1d24c7)['then'](handleEntityNotFound(_0x1f4de3,null))[_0xb483('0x2a')](respondWithResult(_0x1f4de3,null))[_0xb483('0x34')](handleError(_0x1f4de3,null));};exports[_0xb483('0xb3')]=function(_0xe50b85,_0x259b8e){return db[_0xb483('0x37')][_0xb483('0xb3')](_0xe50b85['body'],{})[_0xb483('0x2a')](respondWithResult(_0x259b8e,0xc9))[_0xb483('0x34')](handleError(_0x259b8e,null));};exports['update']=function(_0x12dced,_0xa4231c){if(_0x12dced[_0xb483('0x73')]['id']){delete _0x12dced[_0xb483('0x73')]['id'];}return db[_0xb483('0x37')][_0xb483('0x5e')]({'where':{'id':_0x12dced[_0xb483('0xae')]['id']}})[_0xb483('0x2a')](handleEntityNotFound(_0xa4231c,null))[_0xb483('0x2a')](saveUpdates(_0x12dced[_0xb483('0x73')],null))[_0xb483('0x2a')](respondWithResult(_0xa4231c,null))[_0xb483('0x34')](handleError(_0xa4231c,null));};exports[_0xb483('0x2b')]=function(_0x33af60,_0x2e11bc){return db[_0xb483('0x37')][_0xb483('0x5e')]({'where':{'id':_0x33af60['params']['id']}})['then'](handleEntityNotFound(_0x2e11bc,null))['then'](removeEntity(_0x2e11bc,null))[_0xb483('0x34')](handleError(_0x2e11bc,null));};exports['describe']=function(_0x2e5f87,_0x41a51f){return db['OpenchannelInteraction'][_0xb483('0xb4')]()['then'](respondWithResult(_0x41a51f,null))['catch'](handleError(_0x41a51f,null));};exports[_0xb483('0xb5')]=function(_0x58bbd0,_0xfd2fd6,_0xa9f8e3){return db[_0xb483('0xb6')]['find']({'where':{'id':_0x58bbd0['params']['id']}})[_0xb483('0x2a')](handleEntityNotFound(_0xfd2fd6,null))[_0xb483('0x2a')](function(_0x31a503){if(_0x31a503){return _0x31a503[_0xb483('0xb5')](_0x58bbd0[_0xb483('0x73')][_0xb483('0xb7')],_[_0xb483('0xb8')](_0x58bbd0[_0xb483('0x73')],['ids','id'])||{});}})[_0xb483('0x2a')](respondWithResult(_0xfd2fd6,null))[_0xb483('0x34')](handleError(_0xfd2fd6,null));};exports[_0xb483('0xb9')]=function(_0x4d6dcc,_0x3a389a,_0x2671c1){var _0x57cc45={'raw':![],'where':{}};var _0x167d04={};var _0x655042={'count':0x0,'rows':[]};return db[_0xb483('0x37')][_0xb483('0xba')]({'where':{'id':_0x4d6dcc[_0xb483('0xae')]['id']}})[_0xb483('0x2a')](handleEntityNotFound(_0x3a389a,null))[_0xb483('0x2a')](function(_0x20e20c){if(_0x20e20c){_0x167d04[_0xb483('0x3b')]=_[_0xb483('0x3c')](db['OpenchannelMessage']['rawAttributes']);_0x167d04[_0xb483('0x3d')]=_[_0xb483('0x3c')](_0x4d6dcc[_0xb483('0x3d')]);_0x167d04['filters']=_[_0xb483('0x3f')](_0x167d04[_0xb483('0x3b')],_0x167d04['query']);_0x57cc45[_0xb483('0x40')]=_[_0xb483('0x3f')](_0x167d04[_0xb483('0x3b')],qs[_0xb483('0x41')](_0x4d6dcc[_0xb483('0x3d')]['fields']));_0x57cc45['attributes']=_0x57cc45[_0xb483('0x40')][_0xb483('0x42')]?_0x57cc45['attributes']:_0x167d04[_0xb483('0x3b')];if(!_0x4d6dcc['query'][_0xb483('0x43')](_0xb483('0x44'))){_0x57cc45[_0xb483('0x22')]=qs[_0xb483('0x22')](_0x4d6dcc[_0xb483('0x3d')][_0xb483('0x22')]);_0x57cc45[_0xb483('0x24')]=qs['offset'](_0x4d6dcc['query'][_0xb483('0x24')]);}_0x57cc45[_0xb483('0x8a')]=qs['sort'](_0x4d6dcc['query'][_0xb483('0x45')]);_0x57cc45[_0xb483('0x46')]=qs[_0xb483('0x3e')](_[_0xb483('0x47')](_0x4d6dcc['query'],_0x167d04[_0xb483('0x3e')]));_0x57cc45[_0xb483('0x46')][_0xb483('0xbb')]=_0x20e20c['id'];if(_0x4d6dcc[_0xb483('0x3d')]['filter']){_0x57cc45[_0xb483('0x46')]=_[_0xb483('0xb1')](_0x57cc45[_0xb483('0x46')],{'$or':_[_0xb483('0x36')](_0x57cc45['attributes'],function(_0x7b6bc3){var _0x433a47={};_0x433a47[_0x7b6bc3]={'$like':'%'+_0x4d6dcc['query'][_0xb483('0x81')]+'%'};return _0x433a47;})});}if(_0x4d6dcc[_0xb483('0x3d')][_0xb483('0x78')]){var _0x599157=_0x4d6dcc[_0xb483('0x3d')][_0xb483('0x78')][_0xb483('0x65')](',');var _0x562d18={};_0x562d18[_0x599157[0x0]]={'$gte':moment(_0x599157[0x1])[_0xb483('0xbc')](_0xb483('0xbd'))};_0x57cc45[_0xb483('0x46')]=_['merge'](_0x57cc45[_0xb483('0x46')],_0x562d18);}_0x57cc45=_[_0xb483('0xb1')]({},_0x57cc45,_0x4d6dcc[_0xb483('0xb2')]);return db['OpenchannelMessage']['count']({'where':_0x57cc45[_0xb483('0x46')]})['then'](function(_0x379664){_0x655042[_0xb483('0x23')]=_0x379664;if(_0x4d6dcc[_0xb483('0x3d')][_0xb483('0xaf')]){_0x57cc45['include']=[{'all':!![]}];}return db[_0xb483('0xb6')][_0xb483('0xbe')](_0x57cc45);})[_0xb483('0x2a')](function(_0xe22c77){_0x655042[_0xb483('0xac')]=_0xe22c77;return _0x655042;});}})[_0xb483('0x2a')](respondWithFilteredResult(_0x3a389a,_0x57cc45))[_0xb483('0x34')](handleError(_0x3a389a,null));};exports['addTags']=function(_0x5df283,_0x423d8e,_0x365f3f){return db['OpenchannelInteraction'][_0xb483('0x5e')]({'where':{'id':_0x5df283['params']['id']}})[_0xb483('0x2a')](handleEntityNotFound(_0x423d8e,null))[_0xb483('0x2a')](function(_0x14cf9c){if(_0x14cf9c){return _0x14cf9c[_0xb483('0xbf')](_0x5df283[_0xb483('0x73')][_0xb483('0xb7')],_[_0xb483('0xb8')](_0x5df283[_0xb483('0x73')],[_0xb483('0xb7'),'id'])||{})[_0xb483('0xc0')](function(){return db[_0xb483('0x6d')][_0xb483('0xbe')]({'attributes':['id',_0xb483('0x2d'),'color'],'where':{'id':_0x5df283[_0xb483('0x73')][_0xb483('0xb7')]}});})[_0xb483('0x2a')](function(_0x3a1d63){socket['emit'](_0xb483('0xc1'),{'id':Number(_0x5df283[_0xb483('0xae')]['id']),'tags':_0x3a1d63||[]});return{'id':Number(_0x5df283[_0xb483('0xae')]['id']),'tags':_0x3a1d63||[]};});}})[_0xb483('0x2a')](respondWithResult(_0x423d8e,null))[_0xb483('0x34')](handleError(_0x423d8e,null));};exports[_0xb483('0xc2')]=function(_0x1b536d,_0x57a029,_0xb5afce){return db['OpenchannelInteraction'][_0xb483('0x5e')]({'where':{'id':_0x1b536d[_0xb483('0xae')]['id']}})[_0xb483('0x2a')](handleEntityNotFound(_0x57a029,null))[_0xb483('0x2a')](function(_0x332108){if(_0x332108){return _0x332108['removeTags'](_0x1b536d['query']['ids']);}})[_0xb483('0x2a')](respondWithStatusCode(_0x57a029,null))['catch'](handleError(_0x57a029,null));};exports['download']=function(_0x11437c,_0x181878){var _0x1fbed1=moment()['unix']()[_0xb483('0x97')]();var _0x45e2fb=path[_0xb483('0xc3')](config[_0xb483('0xc4')],_0xb483('0xc5'),'files','tmp');var _0x2170f5=path[_0xb483('0xc3')](config['root'],_0xb483('0xc5'),_0xb483('0xc6'),_0xb483('0xc7'));var _0x1de815=path[_0xb483('0xc3')](_0x45e2fb,_0x1fbed1);var _0x4097bc=util['format'](_0xb483('0xc8'),_0x11437c[_0xb483('0xae')]['id'],_0x1fbed1);var _0x552a13=path[_0xb483('0xc3')](_0x45e2fb,_0x4097bc);var _0x75e0e7=[];_0x75e0e7[_0xb483('0x33')]({'model':db[_0xb483('0x6f')],'as':_0xb483('0x6f'),'attributes':['id',_0xb483('0x2f')],'raw':!![]});_0x75e0e7[_0xb483('0x33')]({'model':db[_0xb483('0xc9')],'as':_0xb483('0xca'),'attributes':['id',_0xb483('0xcb'),'lastName'],'raw':!![]});if(_0x11437c[_0xb483('0x3d')][_0xb483('0xc7')]){_0x75e0e7[_0xb483('0x33')]({'model':db[_0xb483('0xcc')],'as':_0xb483('0xcc'),'raw':!![]});}var _0x38de48=[{'model':db[_0xb483('0xb6')],'as':_0xb483('0xcd'),'attributes':['id',_0xb483('0x73'),_0xb483('0xce'),'direction','secret',_0xb483('0x7c')],'include':_0x75e0e7}];_0x38de48['push']({'model':db[_0xb483('0xcf')],'as':_0xb483('0xd0'),'attributes':['id','name']});_0x38de48[_0xb483('0x33')]({'model':db['User'],'as':_0xb483('0xd1'),'attributes':['id',_0xb483('0x2f')]});return db[_0xb483('0x37')][_0xb483('0x5e')]({'where':{'id':_0x11437c[_0xb483('0xae')]['id']},'include':_0x38de48})[_0xb483('0x2a')](handleEntityNotFound(_0x181878,null))[_0xb483('0x2a')](function(_0x303347){if(_0x303347){var _0x190544=_0x303347[_0xb483('0xd2')]({'plain':!![]});fs[_0xb483('0xd3')](_0x1de815);var _0x414d9b={'channel':'Openchannel','account':_0x190544[_0xb483('0xd0')]['name'],'agent':_0x190544[_0xb483('0xd1')]?_0x190544[_0xb483('0xd1')][_0xb483('0x2f')]:_0xb483('0xd4'),'createdAt':moment(_0x190544[_0xb483('0xce')])[_0xb483('0xbc')](_0xb483('0xbd'))['toString'](),'closedAt':_0x190544[_0xb483('0xd5')]?moment(_0x190544['closedAt'])[_0xb483('0xbc')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb483('0x97')]():'','disposition':_0x190544[_0xb483('0xd6')],'visibility':_0x190544[_0xb483('0xd7')]?_0xb483('0xd8'):'Private','messages':_(_0x190544[_0xb483('0xcd')])['filter']({'secret':![]})['map'](function(_0x1b98ac){if(_0x1b98ac[_0xb483('0xcc')]){var _0x124f21=path['join'](_0x2170f5,_0x1b98ac[_0xb483('0xcc')]['basename']);if(fs[_0xb483('0xd9')](_0x124f21)){fs['createReadStream'](_0x124f21)[_0xb483('0xda')](fs[_0xb483('0xdb')](path[_0xb483('0xc3')](_0x1de815,_0x1b98ac[_0xb483('0xcc')][_0xb483('0xdc')])));}}return{'date':moment(_0x1b98ac['createdAt'])['format'](_0xb483('0xbd'))['toString'](),'sender':_0x1b98ac[_0xb483('0xdd')]===_0xb483('0xde')?_0x1b98ac[_0xb483('0x6f')]?_0x1b98ac[_0xb483('0x6f')]['fullname']:'System':_0x1b98ac['Contact']['firstName']+(_0x1b98ac[_0xb483('0xca')][_0xb483('0xdf')]?'\x20'+_0x1b98ac[_0xb483('0xca')][_0xb483('0xdf')]:''),'body':_0x1b98ac['Attachment']?_0x1b98ac[_0xb483('0xcc')][_0xb483('0xdc')]:_0x1b98ac['body'],'direction':_0x1b98ac['direction']==='out'?'A':'C','secret':_0x1b98ac[_0xb483('0xe0')],'read':_0x1b98ac['read'],'attachment':_0x1b98ac[_0xb483('0xcc')]};})[_0xb483('0x60')]()};return ejs[_0xb483('0xe1')](path['join'](config['root'],'server',_0xb483('0xe2'),_0xb483('0xe3')),{'interaction':_0x414d9b})[_0xb483('0x2a')](function(_0x4f3844){var _0x4e2fb1=path[_0xb483('0xc3')](_0x1de815,_0xb483('0xe4')+_0x190544['id']+'-'+_0x1fbed1+'.pdf');var _0x465b2a={'path':_0x4e2fb1,'channel':_0xb483('0xe5'),'interactionId':_0x190544['id']};return pdf[_0xb483('0xe6')](_0x4f3844,_0x465b2a);})[_0xb483('0x2a')](function(){return new BPromise(function(_0x336139,_0x41fd19){zipdir(_0x1de815,{'saveTo':_0x552a13},function(_0x4ef8bb,_0x44fc58){if(_0x4ef8bb)return _0x41fd19(_0x4ef8bb);return _0x336139(_0x44fc58);});})[_0xb483('0x2a')](function(){return new BPromise(function(_0xd13ddb,_0x316374){rimraf(_0x1de815,function(_0x46d740){if(_0x46d740)_0x316374(_0x46d740);return _0xd13ddb();});});})['then'](function(){return _0x181878[_0xb483('0xe7')](_0x552a13,_0x4097bc,function(_0x2906c9){if(_0x2906c9){console['log'](_0xb483('0xe8'),_0x2906c9);}else{fs[_0xb483('0xe9')](_0x552a13);}});});});}else{return _0x181878[_0xb483('0x1e')](0xc8);}})[_0xb483('0x34')](handleError(_0x181878,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index e472de0..4d164b0 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 _0x50bf=['exports','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook'];(function(_0x156a0d,_0x3946ce){var _0x98a9ba=function(_0x46c1b2){while(--_0x46c1b2){_0x156a0d['push'](_0x156a0d['shift']());}};_0x98a9ba(++_0x3946ce);}(_0x50bf,0x188));var _0xf50b=function(_0x540ae7,_0x436620){_0x540ae7=_0x540ae7-0x0;var _0x53615c=_0x50bf[_0x540ae7];return _0x53615c;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0xf50b('0x0'))['db'][_0xf50b('0x1')];var OpenchannelMessage=require('../../mysqldb')['db'][_0xf50b('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xf50b('0x3')](0x0);var events={'afterCreate':_0xf50b('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5baeb6){return function(_0xa24feb,_0x3d4ddb,_0x3e3be1){_0xa24feb[_0xf50b('0x5')]({'attributes':['id'],'raw':!![]})[_0xf50b('0x6')](function(_0x209554){_0xa24feb['setDataValue'](_0xf50b('0x7'),_0x209554[_0xf50b('0x8')](function(_0x3bf30a){return{'id':_0x3bf30a['id']};}));return OpenchannelMessage[_0xf50b('0x9')]({'where':{'OpenchannelInteractionId':_0xa24feb['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf50b('0x6')](function(_0xfe4d99){_0xa24feb[_0xf50b('0xa')](_0xf50b('0xb'),_0xfe4d99[_0xf50b('0xc')]);OpenchannelInteractionEvents[_0xf50b('0xd')](_0x5baeb6+':'+_0xa24feb['id'],_0xa24feb);OpenchannelInteractionEvents[_0xf50b('0xd')](_0x5baeb6,_0xa24feb);_0x3e3be1(null);})['catch'](_0x3e3be1(null));};}for(var e in events){if(events[_0xf50b('0xe')](e)){var event=events[e];OpenchannelInteraction[_0xf50b('0xf')](e,emitEvent(event));}}module[_0xf50b('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xc69d=['../../mysqldb','OpenchannelInteraction','OpenchannelMessage','save','update','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','hook','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc69d,0x150));var _0xdc69=function(_0x1d0499,_0x23e22f){_0x1d0499=_0x1d0499-0x0;var _0x153fb3=_0xc69d[_0x1d0499];return _0x153fb3;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0xdc69('0x0'))['db'][_0xdc69('0x1')];var OpenchannelMessage=require(_0xdc69('0x0'))['db'][_0xdc69('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdc69('0x3'),'afterUpdate':_0xdc69('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3c327c){return function(_0x2b6350,_0x18f9d4,_0x23b693){_0x2b6350[_0xdc69('0x5')]({'attributes':['id'],'raw':!![]})[_0xdc69('0x6')](function(_0x56d509){_0x2b6350['setDataValue'](_0xdc69('0x7'),_0x56d509[_0xdc69('0x8')](function(_0x4a19fc){return{'id':_0x4a19fc['id']};}));return OpenchannelMessage[_0xdc69('0x9')]({'where':{'OpenchannelInteractionId':_0x2b6350['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4750ab){_0x2b6350[_0xdc69('0xa')](_0xdc69('0xb'),_0x4750ab[_0xdc69('0xc')]);OpenchannelInteractionEvents[_0xdc69('0xd')](_0x3c327c+':'+_0x2b6350['id'],_0x2b6350);OpenchannelInteractionEvents[_0xdc69('0xd')](_0x3c327c,_0x2b6350);_0x23b693(null);})['catch'](_0x23b693(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xdc69('0xe')](e,emitEvent(event));}}module[_0xdc69('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 65f1799..7243c5b 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 _0xe178=['../../config/environment','define','OpenchannelInteraction','utf8mb4_unicode_ci','closed','closedAt','format','lodash','util','moment','bluebird','path','rimraf'];(function(_0x54ce82,_0x1df7f9){var _0x4aab4e=function(_0x7fae6b){while(--_0x7fae6b){_0x54ce82['push'](_0x54ce82['shift']());}};_0x4aab4e(++_0x1df7f9);}(_0xe178,0xb0));var _0x8e17=function(_0x5300d5,_0x3627f5){_0x5300d5=_0x5300d5-0x0;var _0x10047e=_0xe178[_0x5300d5];return _0x10047e;};'use strict';var _=require(_0x8e17('0x0'));var util=require(_0x8e17('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8e17('0x2'));var BPromise=require(_0x8e17('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e17('0x4'));var rimraf=require(_0x8e17('0x5'));var config=require(_0x8e17('0x6'));var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x5b637b,_0x3e85ad){return _0x5b637b[_0x8e17('0x7')](_0x8e17('0x8'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8e17('0x9'),'hooks':{'beforeUpdate':function(_0x4a3772,_0xc5f3cd,_0x3262c1){if(_0x4a3772['changed'](_0x8e17('0xa'))){_0x4a3772[_0x8e17('0xb')]=moment()[_0x8e17('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3262c1(null,_0x4a3772);}}});}; \ No newline at end of file +var _0x29c7=['utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','util','../../config/logger','api','moment','bluebird','path','./openchannelInteraction.attributes','OpenchannelInteraction'];(function(_0x2b6a22,_0x49cb90){var _0x280db7=function(_0x467546){while(--_0x467546){_0x2b6a22['push'](_0x2b6a22['shift']());}};_0x280db7(++_0x49cb90);}(_0x29c7,0x68));var _0x729c=function(_0x26cfe1,_0x104b27){_0x26cfe1=_0x26cfe1-0x0;var _0x1941dd=_0x29c7[_0x26cfe1];return _0x1941dd;};'use strict';var _=require('lodash');var util=require(_0x729c('0x0'));var logger=require(_0x729c('0x1'))(_0x729c('0x2'));var moment=require(_0x729c('0x3'));var BPromise=require(_0x729c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x729c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x729c('0x6'));module['exports']=function(_0x291fa3,_0x55d116){return _0x291fa3['define'](_0x729c('0x7'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x729c('0x8'),'collate':_0x729c('0x9'),'hooks':{'beforeUpdate':function(_0x36be73,_0x96b167,_0x1f1371){if(_0x36be73[_0x729c('0xa')](_0x729c('0xb'))){_0x36be73[_0x729c('0xc')]=moment()[_0x729c('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1f1371(null,_0x36be73);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 0aa6b74..b6b28c4 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 _0x1e2e=['message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','options','raw','where','attributes','limit','addTags','body','ids','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5ada23,_0x20c073){var _0x20d5cd=function(_0xb64b94){while(--_0xb64b94){_0x5ada23['push'](_0x5ada23['shift']());}};_0x20d5cd(++_0x20c073);}(_0x1e2e,0xd2));var _0xe1e2=function(_0x419550,_0x15cdf1){_0x419550=_0x419550-0x0;var _0x55f9ef=_0x1e2e[_0x419550];return _0x55f9ef;};'use strict';var _=require('lodash');var util=require(_0xe1e2('0x0'));var moment=require(_0xe1e2('0x1'));var BPromise=require(_0xe1e2('0x2'));var rs=require(_0xe1e2('0x3'));var fs=require('fs');var Redis=require(_0xe1e2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe1e2('0x5'));var logger=require('../../config/logger')(_0xe1e2('0x6'));var config=require('../../config/environment');var jayson=require(_0xe1e2('0x7'));var client=jayson[_0xe1e2('0x8')][_0xe1e2('0x9')]({'port':0x232a});config[_0xe1e2('0xa')]=_[_0xe1e2('0xb')](config[_0xe1e2('0xa')],{'host':_0xe1e2('0xc'),'port':0x18eb});var socket=require(_0xe1e2('0xd'))(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0xe1e2('0xe')](socket);function respondWithRpcPromise(_0x4097db,_0x2e9104,_0x3744fb){return new BPromise(function(_0x37a5da,_0x3cc4ed){return client['request'](_0x4097db,_0x3744fb)[_0xe1e2('0xf')](function(_0x2ba994){logger[_0xe1e2('0x10')](_0xe1e2('0x11'),_0x2e9104,_0xe1e2('0x12'));logger[_0xe1e2('0x13')](_0xe1e2('0x14'),_0x2e9104,_0xe1e2('0x12'),JSON[_0xe1e2('0x15')](_0x2ba994));if(_0x2ba994[_0xe1e2('0x16')]){if(_0x2ba994[_0xe1e2('0x16')][_0xe1e2('0x17')]===0x1f4){logger[_0xe1e2('0x16')](_0xe1e2('0x11'),_0x2e9104,_0x2ba994[_0xe1e2('0x16')][_0xe1e2('0x18')]);return _0x3cc4ed(_0x2ba994[_0xe1e2('0x16')][_0xe1e2('0x18')]);}logger['error'](_0xe1e2('0x11'),_0x2e9104,_0x2ba994[_0xe1e2('0x16')]['message']);return _0x37a5da(_0x2ba994[_0xe1e2('0x16')][_0xe1e2('0x18')]);}else{logger[_0xe1e2('0x10')](_0xe1e2('0x11'),_0x2e9104,_0xe1e2('0x12'));_0x37a5da(_0x2ba994[_0xe1e2('0x19')][_0xe1e2('0x18')]);}})[_0xe1e2('0x1a')](function(_0x5bc12a){logger[_0xe1e2('0x16')](_0xe1e2('0x11'),_0x2e9104,_0x5bc12a);_0x3cc4ed(_0x5bc12a);});});}exports[_0xe1e2('0x1b')]=function(_0x1c7f1b){var _0x14687d=this;return new Promise(function(_0x4b42c6,_0xc2a7b1){return db[_0xe1e2('0x1c')]['update'](_0x1c7f1b['body'],{'raw':_0x1c7f1b[_0xe1e2('0x1d')]?_0x1c7f1b[_0xe1e2('0x1d')][_0xe1e2('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c7f1b['options']?_0x1c7f1b[_0xe1e2('0x1d')][_0xe1e2('0x1f')]||null:null,'attributes':_0x1c7f1b[_0xe1e2('0x1d')]?_0x1c7f1b[_0xe1e2('0x1d')][_0xe1e2('0x20')]||null:null,'limit':_0x1c7f1b[_0xe1e2('0x1d')]?_0x1c7f1b[_0xe1e2('0x1d')][_0xe1e2('0x21')]||null:null})[_0xe1e2('0xf')](function(_0x1392fd){logger[_0xe1e2('0x10')](_0xe1e2('0x1b'),_0x1c7f1b);logger[_0xe1e2('0x13')](_0xe1e2('0x1b'),_0x1c7f1b,JSON[_0xe1e2('0x15')](_0x1392fd));_0x4b42c6(_0x1392fd);})[_0xe1e2('0x1a')](function(_0x347228){logger['error'](_0xe1e2('0x1b'),_0x347228[_0xe1e2('0x18')],_0x1c7f1b);_0xc2a7b1(_0x14687d[_0xe1e2('0x16')](0x1f4,_0x347228[_0xe1e2('0x18')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x9ca17a){return new Promise(function(_0x6a3ba5,_0x5a375d){return db[_0xe1e2('0x1c')]['find']({'where':_0x9ca17a[_0xe1e2('0x1d')]?_0x9ca17a[_0xe1e2('0x1d')][_0xe1e2('0x1f')]||null:null})[_0xe1e2('0xf')](function(_0x1c48ef){if(_0x1c48ef){return _0x1c48ef[_0xe1e2('0x22')](_0x9ca17a[_0xe1e2('0x23')][_0xe1e2('0x24')],_['omit'](_0x9ca17a[_0xe1e2('0x23')],[_0xe1e2('0x24'),'id'])||{});}})[_0xe1e2('0x25')](function(_0x133565){logger[_0xe1e2('0x10')](_0xe1e2('0x26'),_0x9ca17a);logger[_0xe1e2('0x13')]('AddTags',_0x9ca17a,JSON[_0xe1e2('0x15')](_0x133565));_0x6a3ba5(_0x133565);})[_0xe1e2('0x1a')](function(_0x5285b2){logger['error'](_0xe1e2('0x26'),_0x5285b2[_0xe1e2('0x18')],_0x9ca17a);_0x5a375d(_this['error'](0x1f4,_0x5285b2['message']));});});}; \ No newline at end of file +var _0x1c5f=['where','attributes','limit','find','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options'];(function(_0x41ef4b,_0x5b0985){var _0x3d3cfe=function(_0xcbfe28){while(--_0xcbfe28){_0x41ef4b['push'](_0x41ef4b['shift']());}};_0x3d3cfe(++_0x5b0985);}(_0x1c5f,0x87));var _0xf1c5=function(_0x3fe229,_0x2cf13e){_0x3fe229=_0x3fe229-0x0;var _0x5bfa10=_0x1c5f[_0x3fe229];return _0x5bfa10;};'use strict';var _=require('lodash');var util=require(_0xf1c5('0x0'));var moment=require(_0xf1c5('0x1'));var BPromise=require(_0xf1c5('0x2'));var rs=require(_0xf1c5('0x3'));var fs=require('fs');var Redis=require(_0xf1c5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf1c5('0x5'));var logger=require(_0xf1c5('0x6'))('rpc');var config=require(_0xf1c5('0x7'));var jayson=require(_0xf1c5('0x8'));var client=jayson[_0xf1c5('0x9')][_0xf1c5('0xa')]({'port':0x232a});config[_0xf1c5('0xb')]=_[_0xf1c5('0xc')](config[_0xf1c5('0xb')],{'host':_0xf1c5('0xd'),'port':0x18eb});var socket=require(_0xf1c5('0xe'))(new Redis(config[_0xf1c5('0xb')]));require('./openchannelInteraction.socket')[_0xf1c5('0xf')](socket);function respondWithRpcPromise(_0x2fd551,_0x13d04f,_0xe1903e){return new BPromise(function(_0x584bb5,_0x2c9273){return client[_0xf1c5('0x10')](_0x2fd551,_0xe1903e)[_0xf1c5('0x11')](function(_0x3dce73){logger[_0xf1c5('0x12')](_0xf1c5('0x13'),_0x13d04f,_0xf1c5('0x14'));logger[_0xf1c5('0x15')](_0xf1c5('0x16'),_0x13d04f,_0xf1c5('0x14'),JSON[_0xf1c5('0x17')](_0x3dce73));if(_0x3dce73[_0xf1c5('0x18')]){if(_0x3dce73[_0xf1c5('0x18')][_0xf1c5('0x19')]===0x1f4){logger[_0xf1c5('0x18')](_0xf1c5('0x13'),_0x13d04f,_0x3dce73[_0xf1c5('0x18')][_0xf1c5('0x1a')]);return _0x2c9273(_0x3dce73[_0xf1c5('0x18')][_0xf1c5('0x1a')]);}logger[_0xf1c5('0x18')](_0xf1c5('0x13'),_0x13d04f,_0x3dce73['error']['message']);return _0x584bb5(_0x3dce73[_0xf1c5('0x18')]['message']);}else{logger[_0xf1c5('0x12')](_0xf1c5('0x13'),_0x13d04f,_0xf1c5('0x14'));_0x584bb5(_0x3dce73['result'][_0xf1c5('0x1a')]);}})[_0xf1c5('0x1b')](function(_0x3acac9){logger[_0xf1c5('0x18')]('OpenchannelInteraction,\x20%s,\x20%s',_0x13d04f,_0x3acac9);_0x2c9273(_0x3acac9);});});}exports[_0xf1c5('0x1c')]=function(_0x3b2875){var _0x489340=this;return new Promise(function(_0x15c4b1,_0x33193f){return db[_0xf1c5('0x1d')][_0xf1c5('0x1e')](_0x3b2875[_0xf1c5('0x1f')],{'raw':_0x3b2875[_0xf1c5('0x20')]?_0x3b2875[_0xf1c5('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b2875[_0xf1c5('0x20')]?_0x3b2875['options'][_0xf1c5('0x21')]||null:null,'attributes':_0x3b2875['options']?_0x3b2875[_0xf1c5('0x20')][_0xf1c5('0x22')]||null:null,'limit':_0x3b2875[_0xf1c5('0x20')]?_0x3b2875['options'][_0xf1c5('0x23')]||null:null})[_0xf1c5('0x11')](function(_0x2c0da3){logger[_0xf1c5('0x12')](_0xf1c5('0x1c'),_0x3b2875);logger[_0xf1c5('0x15')](_0xf1c5('0x1c'),_0x3b2875,JSON[_0xf1c5('0x17')](_0x2c0da3));_0x15c4b1(_0x2c0da3);})[_0xf1c5('0x1b')](function(_0x124377){logger[_0xf1c5('0x18')]('UpdateOpenchannelInteraction',_0x124377[_0xf1c5('0x1a')],_0x3b2875);_0x33193f(_0x489340[_0xf1c5('0x18')](0x1f4,_0x124377[_0xf1c5('0x1a')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0xd02d2a){return new Promise(function(_0x4e6a62,_0xc76549){return db['OpenchannelInteraction'][_0xf1c5('0x24')]({'where':_0xd02d2a[_0xf1c5('0x20')]?_0xd02d2a['options'][_0xf1c5('0x21')]||null:null})[_0xf1c5('0x11')](function(_0x73edf9){if(_0x73edf9){return _0x73edf9[_0xf1c5('0x25')](_0xd02d2a[_0xf1c5('0x1f')][_0xf1c5('0x26')],_[_0xf1c5('0x27')](_0xd02d2a['body'],[_0xf1c5('0x26'),'id'])||{});}})[_0xf1c5('0x28')](function(_0x40d3b1){logger['info'](_0xf1c5('0x29'),_0xd02d2a);logger[_0xf1c5('0x15')]('AddTags',_0xd02d2a,JSON[_0xf1c5('0x17')](_0x40d3b1));_0x4e6a62(_0x40d3b1);})[_0xf1c5('0x1b')](function(_0x36a103){logger[_0xf1c5('0x18')](_0xf1c5('0x29'),_0x36a103[_0xf1c5('0x1a')],_0xd02d2a);_0xc76549(_this[_0xf1c5('0x18')](0x1f4,_0x36a103[_0xf1c5('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 7ed4788..51b12b1 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 _0x7d4f=['register','openchannelInteraction:','save','update','emit'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7d4f,0x12e));var _0xf7d4=function(_0x237836,_0x5c9545){_0x237836=_0x237836-0x0;var _0x57806b=_0x7d4f[_0x237836];return _0x57806b;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xf7d4('0x0'),'remove',_0xf7d4('0x1')];function createListener(_0x335917,_0x19f800){return function(_0x3786f9){_0x19f800[_0xf7d4('0x2')](_0x335917,_0x3786f9);};}function removeListener(_0x4556d2,_0x93582){return function(){OpenchannelInteractionEvents['removeListener'](_0x4556d2,_0x93582);};}exports[_0xf7d4('0x3')]=function(_0x711d0a){for(var _0x4552b9=0x0,_0x19acd7=events['length'];_0x4552b9<_0x19acd7;_0x4552b9++){var _0x2a5618=events[_0x4552b9];var _0x23dd5f=createListener(_0xf7d4('0x4')+_0x2a5618,_0x711d0a);OpenchannelInteractionEvents['on'](_0x2a5618,_0x23dd5f);}}; \ No newline at end of file +var _0xf8a5=['remove','update','emit','register','openchannelInteraction:','./openchannelInteraction.events','save'];(function(_0x25b3d5,_0x4f0a26){var _0x130bd9=function(_0x4ddb14){while(--_0x4ddb14){_0x25b3d5['push'](_0x25b3d5['shift']());}};_0x130bd9(++_0x4f0a26);}(_0xf8a5,0x91));var _0x5f8a=function(_0x203648,_0x4e0bb8){_0x203648=_0x203648-0x0;var _0x5ba682=_0xf8a5[_0x203648];return _0x5ba682;};'use strict';var OpenchannelInteractionEvents=require(_0x5f8a('0x0'));var events=[_0x5f8a('0x1'),_0x5f8a('0x2'),_0x5f8a('0x3')];function createListener(_0x38a610,_0x562d6d){return function(_0x42f242){_0x562d6d[_0x5f8a('0x4')](_0x38a610,_0x42f242);};}function removeListener(_0x4a729c,_0x1dd63b){return function(){OpenchannelInteractionEvents['removeListener'](_0x4a729c,_0x1dd63b);};}exports[_0x5f8a('0x5')]=function(_0x3d9b99){for(var _0x20c61f=0x0,_0x505793=events['length'];_0x20c61f<_0x505793;_0x20c61f++){var _0xe8110b=events[_0x20c61f];var _0x501da0=createListener(_0x5f8a('0x6')+_0xe8110b,_0x3d9b99);OpenchannelInteractionEvents['on'](_0xe8110b,_0x501da0);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index f301a8f..ee1021c 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 _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x2ba00c,_0x182642){var _0x21712b=function(_0x1bcf8e){while(--_0x1bcf8e){_0x2ba00c['push'](_0x2ba00c['shift']());}};_0x21712b(++_0x182642);}(_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'));var controller=require('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index c2a899f..6964f7b 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 _0x15b8=['DATE','STRING','exports','TEXT','medium','BOOLEAN','out'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x15b8,0xcd));var _0x815b=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x15b8[_0x422905];return _0x33dc6c;};'use strict';var Sequelize=require('sequelize');module[_0x815b('0x0')]={'body':{'type':Sequelize[_0x815b('0x1')](_0x815b('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x815b('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x815b('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x815b('0x4')),'defaultValue':_0x815b('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x815b('0x5')]},'providerName':{'type':Sequelize[_0x815b('0x6')]},'providerResponse':{'type':Sequelize[_0x815b('0x1')]}}; \ No newline at end of file +var _0xeef7=['exports','medium','BOOLEAN','out','DATE','STRING','sequelize'];(function(_0x2a3514,_0x47297d){var _0x1fdf04=function(_0x5943ba){while(--_0x5943ba){_0x2a3514['push'](_0x2a3514['shift']());}};_0x1fdf04(++_0x47297d);}(_0xeef7,0x7d));var _0x7eef=function(_0x52a391,_0x3ecdbe){_0x52a391=_0x52a391-0x0;var _0x562ff0=_0xeef7[_0x52a391];return _0x562ff0;};'use strict';var Sequelize=require(_0x7eef('0x0'));module[_0x7eef('0x1')]={'body':{'type':Sequelize['TEXT'](_0x7eef('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x7eef('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x7eef('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x7eef('0x5')]},'providerName':{'type':Sequelize[_0x7eef('0x6')]},'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 13166b5..f820896 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 _0x4c35=['end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','merge','filter','options','include','rows','show','params','find','create','body','update','describe','../../config/logger','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','contact','User','email','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','Sequelize','SELECT','fullname','internal','interface','rejectmessage','rimraf','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','sendStatus','status'];(function(_0x25e670,_0x53f0ce){var _0x5ad754=function(_0x583828){while(--_0x583828){_0x25e670['push'](_0x25e670['shift']());}};_0x5ad754(++_0x53f0ce);}(_0x4c35,0xd4));var _0x54c3=function(_0x2ff4bd,_0x4780a6){_0x2ff4bd=_0x2ff4bd-0x0;var _0x28edc6=_0x4c35[_0x2ff4bd];return _0x28edc6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x54c3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x54c3('0x1'));var rp=require('request-promise');var moment=require(_0x54c3('0x2'));var BPromise=require(_0x54c3('0x3'));var Mustache=require(_0x54c3('0x4'));var util=require('util');var path=require('path');var sox=require(_0x54c3('0x5'));var csv=require(_0x54c3('0x6'));var ejs=require(_0x54c3('0x7'));var fs=require('fs');var fs_extra=require(_0x54c3('0x8'));var _=require(_0x54c3('0x9'));var squel=require(_0x54c3('0xa'));var crypto=require('crypto');var jsforce=require(_0x54c3('0xb'));var deskjs=require(_0x54c3('0xc'));var toCsv=require('to-csv');var querystring=require(_0x54c3('0xd'));var Papa=require(_0x54c3('0xe'));var Redis=require(_0x54c3('0xf'));var authService=require(_0x54c3('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x54c3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x54c3('0x12'));var utils=require(_0x54c3('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x54c3('0x14'))['db'];config[_0x54c3('0x15')]=_[_0x54c3('0x16')](config[_0x54c3('0x15')],{'host':_0x54c3('0x17'),'port':0x18eb});var socket=require(_0x54c3('0x18'))(new Redis(config[_0x54c3('0x15')]));require(_0x54c3('0x19'))['register'](socket);var jayson=require(_0x54c3('0x1a'));var client=jayson[_0x54c3('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x54c3('0x1b')][_0x54c3('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xfdc370,_0x34bddd,_0x3db812,_0x2e422d){return new BPromise(function(_0x549bb7,_0x4c9217){var _0x307b37=_0x2e422d||client;return _0x307b37['request'](_0xfdc370,_0x3db812)['then'](function(_0x15683e){logger['info'](_0x54c3('0x1d'),_0x34bddd,_0x54c3('0x1e'));logger[_0x54c3('0x1f')](_0x54c3('0x20'),_0x34bddd,_0x54c3('0x1e'),JSON[_0x54c3('0x21')](_0x15683e));if(_0x15683e['error']){if(_0x15683e['error'][_0x54c3('0x22')]===0x1f4){logger[_0x54c3('0x23')](_0x54c3('0x1d'),_0x34bddd,_0x15683e[_0x54c3('0x23')]['message']);return _0x4c9217(_0x15683e[_0x54c3('0x23')]['message']);}logger[_0x54c3('0x23')](_0x54c3('0x1d'),_0x34bddd,_0x15683e['error'][_0x54c3('0x24')]);return _0x549bb7(_0x15683e[_0x54c3('0x23')][_0x54c3('0x24')]);}else{logger[_0x54c3('0x25')](_0x54c3('0x1d'),_0x34bddd,_0x54c3('0x1e'));_0x549bb7(_0x15683e[_0x54c3('0x26')]['message']);}})[_0x54c3('0x27')](function(_0x3d9873){logger[_0x54c3('0x23')](_0x54c3('0x1d'),_0x34bddd,_0x3d9873);_0x4c9217(_0x3d9873);});});}function respondWithStatusCode(_0x2e12c4,_0x13c6c9){_0x13c6c9=_0x13c6c9||0xcc;return function(_0x46a6c9){if(_0x46a6c9){return _0x2e12c4[_0x54c3('0x28')](_0x13c6c9);}return _0x2e12c4[_0x54c3('0x29')](_0x13c6c9)[_0x54c3('0x2a')]();};}function respondWithResult(_0x3da9f1,_0x33c5ea){_0x33c5ea=_0x33c5ea||0xc8;return function(_0x2b1b48){if(_0x2b1b48){return _0x3da9f1[_0x54c3('0x29')](_0x33c5ea)[_0x54c3('0x2b')](_0x2b1b48);}};}function respondWithFilteredResult(_0x4508ad,_0xc7dc0d){return function(_0x2f2bb2){if(_0x2f2bb2){var _0x522d4a=typeof _0xc7dc0d[_0x54c3('0x2c')]===_0x54c3('0x2d')&&typeof _0xc7dc0d[_0x54c3('0x2e')]===_0x54c3('0x2d');var _0x2f2ca3=_0x2f2bb2[_0x54c3('0x2f')];var _0x564f05=_0x522d4a?0x0:_0xc7dc0d[_0x54c3('0x2c')];var _0x3c20fa=_0x522d4a?_0x2f2bb2[_0x54c3('0x2f')]:_0xc7dc0d[_0x54c3('0x2c')]+_0xc7dc0d[_0x54c3('0x2e')];var _0x3351b0;if(_0x3c20fa>=_0x2f2ca3){_0x3c20fa=_0x2f2ca3;_0x3351b0=0xc8;}else{_0x3351b0=0xce;}_0x4508ad[_0x54c3('0x29')](_0x3351b0);return _0x4508ad[_0x54c3('0x30')](_0x54c3('0x31'),_0x564f05+'-'+_0x3c20fa+'/'+_0x2f2ca3)[_0x54c3('0x2b')](_0x2f2bb2);}return null;};}function patchUpdates(_0x41b0c8){return function(_0x48c1ef){try{jsonpatch[_0x54c3('0x32')](_0x48c1ef,_0x41b0c8,!![]);}catch(_0x292a83){return BPromise['reject'](_0x292a83);}return _0x48c1ef[_0x54c3('0x33')]();};}function saveUpdates(_0xa38366,_0x12a2a0){return function(_0x296e36){if(_0x296e36){return _0x296e36['update'](_0xa38366)[_0x54c3('0x34')](function(_0x119532){return _0x119532;});}return null;};}function removeEntity(_0x35a4cc,_0x218893){return function(_0x581f82){if(_0x581f82){return _0x581f82[_0x54c3('0x35')]()[_0x54c3('0x34')](function(){_0x35a4cc[_0x54c3('0x29')](0xcc)[_0x54c3('0x2a')]();});}};}function handleEntityNotFound(_0x2f05cc,_0x70624){return function(_0x5ef2f3){if(!_0x5ef2f3){_0x2f05cc[_0x54c3('0x28')](0x194);}return _0x5ef2f3;};}function handleError(_0x3ddd30,_0x2033f6){_0x2033f6=_0x2033f6||0x1f4;return function(_0x3204a5){logger['error'](_0x3204a5['stack']);if(_0x3204a5[_0x54c3('0x36')]){delete _0x3204a5['name'];}_0x3ddd30[_0x54c3('0x29')](_0x2033f6)[_0x54c3('0x37')](_0x3204a5);};}exports[_0x54c3('0x38')]=function(_0x4f71a7,_0xf6a369){var _0xa052cb={},_0x501d6b={},_0x489e15={'count':0x0,'rows':[]};var _0x179adc=_[_0x54c3('0x39')](db[_0x54c3('0x3a')][_0x54c3('0x3b')],function(_0x4779dc){return{'name':_0x4779dc[_0x54c3('0x3c')],'type':_0x4779dc[_0x54c3('0x3d')]['key']};});_0x501d6b[_0x54c3('0x3e')]=_['map'](_0x179adc,'name');_0x501d6b[_0x54c3('0x3f')]=_['keys'](_0x4f71a7[_0x54c3('0x3f')]);_0x501d6b['filters']=_['intersection'](_0x501d6b[_0x54c3('0x3e')],_0x501d6b['query']);_0xa052cb[_0x54c3('0x40')]=_['intersection'](_0x501d6b[_0x54c3('0x3e')],qs[_0x54c3('0x41')](_0x4f71a7[_0x54c3('0x3f')][_0x54c3('0x41')]));_0xa052cb[_0x54c3('0x40')]=_0xa052cb[_0x54c3('0x40')][_0x54c3('0x42')]?_0xa052cb['attributes']:_0x501d6b[_0x54c3('0x3e')];if(!_0x4f71a7[_0x54c3('0x3f')][_0x54c3('0x43')](_0x54c3('0x44'))){_0xa052cb[_0x54c3('0x2e')]=qs['limit'](_0x4f71a7[_0x54c3('0x3f')][_0x54c3('0x2e')]);_0xa052cb[_0x54c3('0x2c')]=qs[_0x54c3('0x2c')](_0x4f71a7[_0x54c3('0x3f')][_0x54c3('0x2c')]);}_0xa052cb['order']=qs[_0x54c3('0x45')](_0x4f71a7[_0x54c3('0x3f')]['sort']);_0xa052cb['where']=qs[_0x54c3('0x46')](_[_0x54c3('0x47')](_0x4f71a7[_0x54c3('0x3f')],_0x501d6b[_0x54c3('0x46')]),_0x179adc);if(_0x4f71a7[_0x54c3('0x3f')]['filter']){_0xa052cb[_0x54c3('0x48')]=_[_0x54c3('0x49')](_0xa052cb[_0x54c3('0x48')],{'$or':_[_0x54c3('0x39')](_0x179adc,function(_0x53e3d1){if(_0x53e3d1[_0x54c3('0x3d')]!=='VIRTUAL'){var _0x51aedd={};_0x51aedd[_0x53e3d1[_0x54c3('0x36')]]={'$like':'%'+_0x4f71a7[_0x54c3('0x3f')][_0x54c3('0x4a')]+'%'};return _0x51aedd;}})});}_0xa052cb=_[_0x54c3('0x49')]({},_0xa052cb,_0x4f71a7[_0x54c3('0x4b')]);var _0x4c3024={'where':_0xa052cb[_0x54c3('0x48')]};return db[_0x54c3('0x3a')][_0x54c3('0x2f')](_0x4c3024)['then'](function(_0x52ba86){_0x489e15[_0x54c3('0x2f')]=_0x52ba86;if(_0x4f71a7[_0x54c3('0x3f')]['includeAll']){_0xa052cb[_0x54c3('0x4c')]=[{'all':!![]}];}return db[_0x54c3('0x3a')]['findAll'](_0xa052cb);})[_0x54c3('0x34')](function(_0x23f57){_0x489e15[_0x54c3('0x4d')]=_0x23f57;return _0x489e15;})[_0x54c3('0x34')](respondWithFilteredResult(_0xf6a369,_0xa052cb))[_0x54c3('0x27')](handleError(_0xf6a369,null));};exports[_0x54c3('0x4e')]=function(_0x1ec60e,_0x24935c){var _0x1f075b={'raw':!![],'where':{'id':_0x1ec60e[_0x54c3('0x4f')]['id']}},_0x4806c8={};_0x4806c8['model']=_['keys'](db['OpenchannelMessage'][_0x54c3('0x3b')]);_0x4806c8[_0x54c3('0x3f')]=_['keys'](_0x1ec60e[_0x54c3('0x3f')]);_0x4806c8['filters']=_['intersection'](_0x4806c8[_0x54c3('0x3e')],_0x4806c8[_0x54c3('0x3f')]);_0x1f075b[_0x54c3('0x40')]=_['intersection'](_0x4806c8['model'],qs[_0x54c3('0x41')](_0x1ec60e['query'][_0x54c3('0x41')]));_0x1f075b[_0x54c3('0x40')]=_0x1f075b[_0x54c3('0x40')][_0x54c3('0x42')]?_0x1f075b['attributes']:_0x4806c8[_0x54c3('0x3e')];if(_0x1ec60e[_0x54c3('0x3f')]['includeAll']){_0x1f075b[_0x54c3('0x4c')]=[{'all':!![]}];}_0x1f075b=_['merge']({},_0x1f075b,_0x1ec60e[_0x54c3('0x4b')]);return db[_0x54c3('0x3a')][_0x54c3('0x50')](_0x1f075b)[_0x54c3('0x34')](handleEntityNotFound(_0x24935c,null))[_0x54c3('0x34')](respondWithResult(_0x24935c,null))[_0x54c3('0x27')](handleError(_0x24935c,null));};exports[_0x54c3('0x51')]=function(_0x1e2f0d,_0x1559b1){return db['OpenchannelMessage'][_0x54c3('0x51')](_0x1e2f0d[_0x54c3('0x52')],{})[_0x54c3('0x34')](respondWithResult(_0x1559b1,0xc9))[_0x54c3('0x27')](handleError(_0x1559b1,null));};exports[_0x54c3('0x53')]=function(_0x1f7586,_0x5816dc){if(_0x1f7586[_0x54c3('0x52')]['id']){delete _0x1f7586[_0x54c3('0x52')]['id'];}return db[_0x54c3('0x3a')]['find']({'where':{'id':_0x1f7586[_0x54c3('0x4f')]['id']}})[_0x54c3('0x34')](handleEntityNotFound(_0x5816dc,null))[_0x54c3('0x34')](saveUpdates(_0x1f7586[_0x54c3('0x52')],null))[_0x54c3('0x34')](respondWithResult(_0x5816dc,null))[_0x54c3('0x27')](handleError(_0x5816dc,null));};exports[_0x54c3('0x35')]=function(_0x1872e2,_0x4e1b4b){return db[_0x54c3('0x3a')][_0x54c3('0x50')]({'where':{'id':_0x1872e2[_0x54c3('0x4f')]['id']}})[_0x54c3('0x34')](handleEntityNotFound(_0x4e1b4b,null))['then'](removeEntity(_0x4e1b4b,null))[_0x54c3('0x27')](handleError(_0x4e1b4b,null));};exports[_0x54c3('0x54')]=function(_0x47d1dd,_0x1f9957){return db['OpenchannelMessage'][_0x54c3('0x54')]()[_0x54c3('0x34')](respondWithResult(_0x1f9957,null))[_0x54c3('0x27')](handleError(_0x1f9957,null));};var interaction_log=require(_0x54c3('0x55'))(_0x54c3('0x56'));exports[_0x54c3('0x57')]=function(_0x5ba3c0,_0xb8e0ca,_0x2295ca){var _0x548e09={'agent':{},'channel':_0x54c3('0x58')};if(_0x5ba3c0[_0x54c3('0x52')]['id']){delete _0x5ba3c0[_0x54c3('0x52')]['id'];}_0x5ba3c0[_0x54c3('0x52')][_0x54c3('0x59')]=!![];_0x5ba3c0[_0x54c3('0x52')][_0x54c3('0x5a')]=moment()[_0x54c3('0x5b')](_0x54c3('0x5c'));_0x5ba3c0[_0x54c3('0x52')][_0x54c3('0x5d')]=_0x5ba3c0[_0x54c3('0x52')][_0x54c3('0x5d')]||_0x5ba3c0[_0x54c3('0x5e')]['id'];_0x548e09[_0x54c3('0x5f')]['id']=_0x5ba3c0[_0x54c3('0x52')][_0x54c3('0x5d')];return db['OpenchannelMessage'][_0x54c3('0x50')]({'where':{'id':_0x5ba3c0['params']['id'],'UserId':null}})[_0x54c3('0x34')](handleEntityNotFound(_0xb8e0ca,null))[_0x54c3('0x34')](saveUpdates(_0x5ba3c0[_0x54c3('0x52')],null))['then'](function(_0x1e78c7){if(_0x1e78c7){_0x548e09[_0x54c3('0x24')]=_0x1e78c7[_0x54c3('0x60')]({'plain':!![]});return db['OpenchannelInteraction'][_0x54c3('0x50')]({'where':{'id':_0x1e78c7[_0x54c3('0x61')]}});}return null;})[_0x54c3('0x34')](handleEntityNotFound(_0xb8e0ca,null))[_0x54c3('0x34')](function(_0x592f41){if(_0x592f41){return _0x592f41['update']({'UserId':_0x5ba3c0[_0x54c3('0x52')]['UserId'],'read1stAt':_[_0x54c3('0x62')](_0x592f41[_0x54c3('0x63')])?moment()[_0x54c3('0x5b')](_0x54c3('0x5c')):undefined});}return null;})[_0x54c3('0x34')](function(_0xbf2910){if(_0xbf2910){_0x548e09[_0x54c3('0x64')]=_0xbf2910[_0x54c3('0x60')]({'plain':!![]});interaction_log['info'](_0x54c3('0x65'),_0x5ba3c0[_0x54c3('0x5e')]['id'],_0x5ba3c0[_0x54c3('0x5e')]['name'],_0x5ba3c0[_0x54c3('0x5e')]['role'],_0x548e09['interaction']['id'],_0x5ba3c0[_0x54c3('0x52')]?JSON[_0x54c3('0x21')](_0x5ba3c0['body']):_0x54c3('0x66'));return respondWithRpcPromise(_0x54c3('0x67'),_0x54c3('0x68'),_0x548e09);}return null;})[_0x54c3('0x34')](function(_0x393d61){var _0x1702af=_0x54c3('0x69')+_0x393d61['message']['ContactId'];return db[_0x54c3('0x6a')][_0x54c3('0x3f')](_0x1702af,{'type':db['Sequelize'][_0x54c3('0x6b')]['SELECT'],'raw':!![]})[_0x54c3('0x34')](function(_0x1030f2){return _0x1030f2;});})[_0x54c3('0x34')](function(_0x478d6f){if(_0x478d6f){_0x548e09[_0x54c3('0x24')][_0x54c3('0x6c')]=_0x478d6f[0x0];if(!_0x5ba3c0[_0x54c3('0x52')][_0x54c3('0x5d')])return;return db[_0x54c3('0x6d')][_0x54c3('0x50')]({'where':{'id':_0x5ba3c0[_0x54c3('0x52')][_0x54c3('0x5d')],'role':_0x54c3('0x5f')},'attributes':['id',_0x54c3('0x36'),'fullname',_0x54c3('0x6e'),'internal'],'raw':!![]});}return null;})[_0x54c3('0x34')](function(_0x2ab43d){if(!_0x2ab43d)return null;_0x548e09[_0x54c3('0x24')][_0x54c3('0x5f')]=_0x2ab43d;return _0x548e09;})['then'](function(_0x38884e){if(_0x38884e){if(_0x5ba3c0['body'][_0x54c3('0x6f')]){_0x548e09['message']['interface']=util[_0x54c3('0x5b')](_0x54c3('0x70'),_0x5ba3c0[_0x54c3('0x5e')]['name']);_0x548e09[_0x54c3('0x24')][_0x54c3('0x71')]=_0x548e09[_0x54c3('0x71')];_0x548e09['message'][_0x54c3('0x72')]=_0x548e09[_0x54c3('0x71')];_0x548e09['message'][_0x54c3('0x73')]=_0x54c3('0x57');return respondWithRpcPromise(_0x54c3('0x74'),'EventManager',{'event':_0x54c3('0x75'),'message':_0x548e09['message']},client9002)[_0x54c3('0x34')](function(){return _0x548e09;});}return _0x548e09;}return null;})['then'](respondWithResult(_0xb8e0ca,null))[_0x54c3('0x27')](handleError(_0xb8e0ca,null));};var interaction_log=require(_0x54c3('0x55'))(_0x54c3('0x56'));exports[_0x54c3('0x76')]=function(_0x11e80d,_0x4a01b0,_0x3c6be1){var _0xbd7940={'agent':{},'channel':_0x54c3('0x58')};if(_0x11e80d[_0x54c3('0x52')]['id']){delete _0x11e80d[_0x54c3('0x52')]['id'];}_0x11e80d['body'][_0x54c3('0x5d')]=_0x11e80d['body']['UserId']||_0x11e80d[_0x54c3('0x5e')]['id'];_0xbd7940[_0x54c3('0x5f')]['id']=_0x11e80d[_0x54c3('0x52')][_0x54c3('0x5d')];return db[_0x54c3('0x3a')][_0x54c3('0x50')]({'where':{'id':_0x11e80d[_0x54c3('0x4f')]['id'],'UserId':null}})[_0x54c3('0x34')](handleEntityNotFound(_0x4a01b0,null))[_0x54c3('0x34')](function(_0x4110db){if(_0x4110db){_0xbd7940['message']=_0x4110db['get']({'plain':!![]});return db[_0x54c3('0x77')][_0x54c3('0x50')]({'where':{'id':_0x4110db['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4a01b0,null))[_0x54c3('0x34')](function(_0x4bc401){if(_0x4bc401){_0xbd7940[_0x54c3('0x64')]=_0x4bc401['get']({'plain':!![]});interaction_log[_0x54c3('0x25')](_0x54c3('0x78'),_0x11e80d['user']['id'],_0x11e80d[_0x54c3('0x5e')][_0x54c3('0x36')],_0x11e80d[_0x54c3('0x5e')]['role'],_0xbd7940[_0x54c3('0x64')]['id'],_0x11e80d[_0x54c3('0x52')]?JSON[_0x54c3('0x21')](_0x11e80d[_0x54c3('0x52')]):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0xbd7940);}return null;})[_0x54c3('0x34')](function(_0x546688){var _0x31fe38='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x546688[_0x54c3('0x24')]['ContactId'];return db[_0x54c3('0x6a')][_0x54c3('0x3f')](_0x31fe38,{'type':db[_0x54c3('0x79')][_0x54c3('0x6b')][_0x54c3('0x7a')],'raw':!![]})[_0x54c3('0x34')](function(_0x5322f2){return _0x5322f2;});})['then'](function(_0x37ec4e){if(_0x37ec4e){_0xbd7940[_0x54c3('0x24')][_0x54c3('0x6c')]=_0x37ec4e[0x0];if(!_0x11e80d[_0x54c3('0x52')]['UserId'])return;return db[_0x54c3('0x6d')][_0x54c3('0x50')]({'where':{'id':_0x11e80d[_0x54c3('0x52')][_0x54c3('0x5d')],'role':_0x54c3('0x5f')},'attributes':['id',_0x54c3('0x36'),_0x54c3('0x7b'),_0x54c3('0x6e'),_0x54c3('0x7c')],'raw':!![]});}return null;})[_0x54c3('0x34')](function(_0x57bff2){if(!_0x57bff2)return null;_0xbd7940[_0x54c3('0x24')][_0x54c3('0x5f')]=_0x57bff2;return _0xbd7940;})['then'](function(_0x5f5159){if(_0x5f5159){_0x5f5159[_0x54c3('0x24')][_0x54c3('0x7d')]=util[_0x54c3('0x5b')]('SIP/%s',_0x11e80d['user']['name']);_0x5f5159[_0x54c3('0x24')][_0x54c3('0x71')]=_0xbd7940['channel'];_0x5f5159[_0x54c3('0x24')]['motionChannel']=_0xbd7940[_0x54c3('0x71')];_0x5f5159['message']['event']='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0x54c3('0x7e'),'message':_0x5f5159['message']},client9002);return _0xbd7940;}return null;})['then'](respondWithResult(_0x4a01b0,null))[_0x54c3('0x27')](handleError(_0x4a01b0,null));}; \ No newline at end of file +var _0x6b2a=['./openchannelMessage.socket','jayson/promise','client','http','request','then','info','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','code','OpenchannelMessage,\x20%s,\x20%s','error','message','result','catch','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','end','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','OpenchannelMessage','find','create','body','describe','../../config/logger','accept','read','readAt','format','UserId','user','get','OpenchannelInteraction','isNil','read1stAt','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','manual','interface','channel','motionChannel','EventManager','acceptmessage','openchannel-interactions','openchannel','OpenchannelInteractionId','RejectMessage','email','internal','SIP/%s','event','rejectmessage','eml-format','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter'];(function(_0x23023e,_0x4439d2){var _0xd41164=function(_0x2fc7d9){while(--_0x2fc7d9){_0x23023e['push'](_0x23023e['shift']());}};_0xd41164(++_0x4439d2);}(_0x6b2a,0xeb));var _0xa6b2=function(_0x116ee3,_0x2b5e23){_0x116ee3=_0x116ee3-0x0;var _0xa78321=_0x6b2a[_0x116ee3];return _0xa78321;};'use strict';var emlformat=require(_0xa6b2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa6b2('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xa6b2('0x2'));var util=require('util');var path=require(_0xa6b2('0x3'));var sox=require(_0xa6b2('0x4'));var csv=require(_0xa6b2('0x5'));var ejs=require(_0xa6b2('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa6b2('0x7'));var squel=require(_0xa6b2('0x8'));var crypto=require(_0xa6b2('0x9'));var jsforce=require(_0xa6b2('0xa'));var deskjs=require(_0xa6b2('0xb'));var toCsv=require(_0xa6b2('0x5'));var querystring=require(_0xa6b2('0xc'));var Papa=require(_0xa6b2('0xd'));var Redis=require(_0xa6b2('0xe'));var authService=require(_0xa6b2('0xf'));var qs=require(_0xa6b2('0x10'));var as=require(_0xa6b2('0x11'));var hardwareService=require(_0xa6b2('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xa6b2('0x13'));var config=require(_0xa6b2('0x14'));var licenseUtil=require(_0xa6b2('0x15'));var db=require(_0xa6b2('0x16'))['db'];config['redis']=_[_0xa6b2('0x17')](config[_0xa6b2('0x18')],{'host':_0xa6b2('0x19'),'port':0x18eb});var socket=require(_0xa6b2('0x1a'))(new Redis(config[_0xa6b2('0x18')]));require(_0xa6b2('0x1b'))['register'](socket);var jayson=require(_0xa6b2('0x1c'));var client=jayson[_0xa6b2('0x1d')][_0xa6b2('0x1e')]({'port':0x232c});var client9002=jayson[_0xa6b2('0x1d')][_0xa6b2('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3006d8,_0x615d40,_0x51a80a,_0x11201c){return new BPromise(function(_0x36eee5,_0x278364){var _0x32ee33=_0x11201c||client;return _0x32ee33[_0xa6b2('0x1f')](_0x3006d8,_0x51a80a)[_0xa6b2('0x20')](function(_0x14542f){logger[_0xa6b2('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x615d40,'request\x20sent');logger[_0xa6b2('0x22')](_0xa6b2('0x23'),_0x615d40,'request\x20sent',JSON[_0xa6b2('0x24')](_0x14542f));if(_0x14542f['error']){if(_0x14542f['error'][_0xa6b2('0x25')]===0x1f4){logger['error'](_0xa6b2('0x26'),_0x615d40,_0x14542f[_0xa6b2('0x27')][_0xa6b2('0x28')]);return _0x278364(_0x14542f[_0xa6b2('0x27')]['message']);}logger[_0xa6b2('0x27')](_0xa6b2('0x26'),_0x615d40,_0x14542f[_0xa6b2('0x27')]['message']);return _0x36eee5(_0x14542f[_0xa6b2('0x27')][_0xa6b2('0x28')]);}else{logger[_0xa6b2('0x21')](_0xa6b2('0x26'),_0x615d40,'request\x20sent');_0x36eee5(_0x14542f[_0xa6b2('0x29')]['message']);}})[_0xa6b2('0x2a')](function(_0x2036ce){logger[_0xa6b2('0x27')](_0xa6b2('0x26'),_0x615d40,_0x2036ce);_0x278364(_0x2036ce);});});}function respondWithStatusCode(_0xd7f79a,_0x5d5ce6){_0x5d5ce6=_0x5d5ce6||0xcc;return function(_0x2a6834){if(_0x2a6834){return _0xd7f79a['sendStatus'](_0x5d5ce6);}return _0xd7f79a[_0xa6b2('0x2b')](_0x5d5ce6)['end']();};}function respondWithResult(_0x3d1d61,_0x466a49){_0x466a49=_0x466a49||0xc8;return function(_0x252079){if(_0x252079){return _0x3d1d61[_0xa6b2('0x2b')](_0x466a49)[_0xa6b2('0x2c')](_0x252079);}};}function respondWithFilteredResult(_0x3abe81,_0xd55e5c){return function(_0x44561d){if(_0x44561d){var _0x75e4df=typeof _0xd55e5c[_0xa6b2('0x2d')]==='undefined'&&typeof _0xd55e5c[_0xa6b2('0x2e')]===_0xa6b2('0x2f');var _0x36befd=_0x44561d[_0xa6b2('0x30')];var _0x2ec8ca=_0x75e4df?0x0:_0xd55e5c[_0xa6b2('0x2d')];var _0x440189=_0x75e4df?_0x44561d[_0xa6b2('0x30')]:_0xd55e5c[_0xa6b2('0x2d')]+_0xd55e5c['limit'];var _0x33eaee;if(_0x440189>=_0x36befd){_0x440189=_0x36befd;_0x33eaee=0xc8;}else{_0x33eaee=0xce;}_0x3abe81['status'](_0x33eaee);return _0x3abe81[_0xa6b2('0x31')](_0xa6b2('0x32'),_0x2ec8ca+'-'+_0x440189+'/'+_0x36befd)['json'](_0x44561d);}return null;};}function patchUpdates(_0x397cae){return function(_0x57bf00){try{jsonpatch[_0xa6b2('0x33')](_0x57bf00,_0x397cae,!![]);}catch(_0x19ea24){return BPromise[_0xa6b2('0x34')](_0x19ea24);}return _0x57bf00['save']();};}function saveUpdates(_0x174ef5,_0x506a96){return function(_0x570de5){if(_0x570de5){return _0x570de5[_0xa6b2('0x35')](_0x174ef5)['then'](function(_0x6c42e9){return _0x6c42e9;});}return null;};}function removeEntity(_0x41ecd8,_0x382fb8){return function(_0x48044b){if(_0x48044b){return _0x48044b[_0xa6b2('0x36')]()[_0xa6b2('0x20')](function(){_0x41ecd8[_0xa6b2('0x2b')](0xcc)[_0xa6b2('0x37')]();});}};}function handleEntityNotFound(_0xabef96,_0x5e13e8){return function(_0x4956bc){if(!_0x4956bc){_0xabef96['sendStatus'](0x194);}return _0x4956bc;};}function handleError(_0x4dd579,_0x29e6d7){_0x29e6d7=_0x29e6d7||0x1f4;return function(_0x414a70){logger['error'](_0x414a70['stack']);if(_0x414a70[_0xa6b2('0x38')]){delete _0x414a70[_0xa6b2('0x38')];}_0x4dd579[_0xa6b2('0x2b')](_0x29e6d7)[_0xa6b2('0x39')](_0x414a70);};}exports[_0xa6b2('0x3a')]=function(_0x438b46,_0x1a9db4){var _0x29c872={},_0x5f229d={},_0x229fe3={'count':0x0,'rows':[]};var _0x127a3f=_[_0xa6b2('0x3b')](db['OpenchannelMessage'][_0xa6b2('0x3c')],function(_0x3c77b8){return{'name':_0x3c77b8['fieldName'],'type':_0x3c77b8['type'][_0xa6b2('0x3d')]};});_0x5f229d[_0xa6b2('0x3e')]=_[_0xa6b2('0x3b')](_0x127a3f,_0xa6b2('0x38'));_0x5f229d[_0xa6b2('0x3f')]=_[_0xa6b2('0x40')](_0x438b46['query']);_0x5f229d[_0xa6b2('0x41')]=_[_0xa6b2('0x42')](_0x5f229d[_0xa6b2('0x3e')],_0x5f229d['query']);_0x29c872['attributes']=_['intersection'](_0x5f229d[_0xa6b2('0x3e')],qs['fields'](_0x438b46['query'][_0xa6b2('0x43')]));_0x29c872[_0xa6b2('0x44')]=_0x29c872[_0xa6b2('0x44')][_0xa6b2('0x45')]?_0x29c872['attributes']:_0x5f229d[_0xa6b2('0x3e')];if(!_0x438b46[_0xa6b2('0x3f')][_0xa6b2('0x46')](_0xa6b2('0x47'))){_0x29c872[_0xa6b2('0x2e')]=qs[_0xa6b2('0x2e')](_0x438b46[_0xa6b2('0x3f')][_0xa6b2('0x2e')]);_0x29c872[_0xa6b2('0x2d')]=qs['offset'](_0x438b46[_0xa6b2('0x3f')][_0xa6b2('0x2d')]);}_0x29c872[_0xa6b2('0x48')]=qs['sort'](_0x438b46[_0xa6b2('0x3f')][_0xa6b2('0x49')]);_0x29c872[_0xa6b2('0x4a')]=qs[_0xa6b2('0x41')](_[_0xa6b2('0x4b')](_0x438b46[_0xa6b2('0x3f')],_0x5f229d[_0xa6b2('0x41')]),_0x127a3f);if(_0x438b46[_0xa6b2('0x3f')][_0xa6b2('0x4c')]){_0x29c872[_0xa6b2('0x4a')]=_[_0xa6b2('0x4d')](_0x29c872[_0xa6b2('0x4a')],{'$or':_[_0xa6b2('0x3b')](_0x127a3f,function(_0x58330d){if(_0x58330d['type']!==_0xa6b2('0x4e')){var _0x4cdc54={};_0x4cdc54[_0x58330d[_0xa6b2('0x38')]]={'$like':'%'+_0x438b46[_0xa6b2('0x3f')][_0xa6b2('0x4c')]+'%'};return _0x4cdc54;}})});}_0x29c872=_[_0xa6b2('0x4d')]({},_0x29c872,_0x438b46[_0xa6b2('0x4f')]);var _0x5b0d6f={'where':_0x29c872[_0xa6b2('0x4a')]};return db['OpenchannelMessage'][_0xa6b2('0x30')](_0x5b0d6f)[_0xa6b2('0x20')](function(_0xb9651c){_0x229fe3[_0xa6b2('0x30')]=_0xb9651c;if(_0x438b46[_0xa6b2('0x3f')][_0xa6b2('0x50')]){_0x29c872[_0xa6b2('0x51')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xa6b2('0x52')](_0x29c872);})[_0xa6b2('0x20')](function(_0x3193d4){_0x229fe3[_0xa6b2('0x53')]=_0x3193d4;return _0x229fe3;})[_0xa6b2('0x20')](respondWithFilteredResult(_0x1a9db4,_0x29c872))[_0xa6b2('0x2a')](handleError(_0x1a9db4,null));};exports['show']=function(_0xa08e03,_0x4ddb2c){var _0xd827fe={'raw':!![],'where':{'id':_0xa08e03[_0xa6b2('0x54')]['id']}},_0x30c6f7={};_0x30c6f7[_0xa6b2('0x3e')]=_['keys'](db['OpenchannelMessage'][_0xa6b2('0x3c')]);_0x30c6f7[_0xa6b2('0x3f')]=_[_0xa6b2('0x40')](_0xa08e03[_0xa6b2('0x3f')]);_0x30c6f7[_0xa6b2('0x41')]=_[_0xa6b2('0x42')](_0x30c6f7[_0xa6b2('0x3e')],_0x30c6f7[_0xa6b2('0x3f')]);_0xd827fe[_0xa6b2('0x44')]=_[_0xa6b2('0x42')](_0x30c6f7['model'],qs[_0xa6b2('0x43')](_0xa08e03[_0xa6b2('0x3f')][_0xa6b2('0x43')]));_0xd827fe[_0xa6b2('0x44')]=_0xd827fe[_0xa6b2('0x44')][_0xa6b2('0x45')]?_0xd827fe[_0xa6b2('0x44')]:_0x30c6f7[_0xa6b2('0x3e')];if(_0xa08e03[_0xa6b2('0x3f')][_0xa6b2('0x50')]){_0xd827fe['include']=[{'all':!![]}];}_0xd827fe=_['merge']({},_0xd827fe,_0xa08e03['options']);return db[_0xa6b2('0x55')][_0xa6b2('0x56')](_0xd827fe)[_0xa6b2('0x20')](handleEntityNotFound(_0x4ddb2c,null))[_0xa6b2('0x20')](respondWithResult(_0x4ddb2c,null))[_0xa6b2('0x2a')](handleError(_0x4ddb2c,null));};exports['create']=function(_0x97829f,_0x31141e){return db['OpenchannelMessage'][_0xa6b2('0x57')](_0x97829f['body'],{})[_0xa6b2('0x20')](respondWithResult(_0x31141e,0xc9))[_0xa6b2('0x2a')](handleError(_0x31141e,null));};exports[_0xa6b2('0x35')]=function(_0x1a9104,_0x55aabf){if(_0x1a9104[_0xa6b2('0x58')]['id']){delete _0x1a9104['body']['id'];}return db['OpenchannelMessage']['find']({'where':{'id':_0x1a9104[_0xa6b2('0x54')]['id']}})['then'](handleEntityNotFound(_0x55aabf,null))[_0xa6b2('0x20')](saveUpdates(_0x1a9104['body'],null))[_0xa6b2('0x20')](respondWithResult(_0x55aabf,null))[_0xa6b2('0x2a')](handleError(_0x55aabf,null));};exports[_0xa6b2('0x36')]=function(_0x341f44,_0x4084e2){return db[_0xa6b2('0x55')][_0xa6b2('0x56')]({'where':{'id':_0x341f44[_0xa6b2('0x54')]['id']}})['then'](handleEntityNotFound(_0x4084e2,null))[_0xa6b2('0x20')](removeEntity(_0x4084e2,null))[_0xa6b2('0x2a')](handleError(_0x4084e2,null));};exports[_0xa6b2('0x59')]=function(_0x3e462a,_0x3e0846){return db['OpenchannelMessage'][_0xa6b2('0x59')]()['then'](respondWithResult(_0x3e0846,null))[_0xa6b2('0x2a')](handleError(_0x3e0846,null));};var interaction_log=require(_0xa6b2('0x5a'))('openchannel-interactions');exports[_0xa6b2('0x5b')]=function(_0xdae14c,_0x2f45ea,_0xc79dcc){var _0x3c16cb={'agent':{},'channel':'openchannel'};if(_0xdae14c[_0xa6b2('0x58')]['id']){delete _0xdae14c['body']['id'];}_0xdae14c['body'][_0xa6b2('0x5c')]=!![];_0xdae14c['body'][_0xa6b2('0x5d')]=moment()[_0xa6b2('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0xdae14c[_0xa6b2('0x58')][_0xa6b2('0x5f')]=_0xdae14c[_0xa6b2('0x58')][_0xa6b2('0x5f')]||_0xdae14c[_0xa6b2('0x60')]['id'];_0x3c16cb['agent']['id']=_0xdae14c[_0xa6b2('0x58')][_0xa6b2('0x5f')];return db['OpenchannelMessage'][_0xa6b2('0x56')]({'where':{'id':_0xdae14c[_0xa6b2('0x54')]['id'],'UserId':null}})[_0xa6b2('0x20')](handleEntityNotFound(_0x2f45ea,null))[_0xa6b2('0x20')](saveUpdates(_0xdae14c[_0xa6b2('0x58')],null))[_0xa6b2('0x20')](function(_0x159732){if(_0x159732){_0x3c16cb['message']=_0x159732[_0xa6b2('0x61')]({'plain':!![]});return db[_0xa6b2('0x62')][_0xa6b2('0x56')]({'where':{'id':_0x159732['OpenchannelInteractionId']}});}return null;})[_0xa6b2('0x20')](handleEntityNotFound(_0x2f45ea,null))['then'](function(_0x2a63c1){if(_0x2a63c1){return _0x2a63c1[_0xa6b2('0x35')]({'UserId':_0xdae14c[_0xa6b2('0x58')][_0xa6b2('0x5f')],'read1stAt':_[_0xa6b2('0x63')](_0x2a63c1[_0xa6b2('0x64')])?moment()[_0xa6b2('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x366825){if(_0x366825){_0x3c16cb['interaction']=_0x366825[_0xa6b2('0x61')]({'plain':!![]});interaction_log[_0xa6b2('0x21')](_0xa6b2('0x65'),_0xdae14c['user']['id'],_0xdae14c['user']['name'],_0xdae14c[_0xa6b2('0x60')][_0xa6b2('0x66')],_0x3c16cb[_0xa6b2('0x67')]['id'],_0xdae14c['body']?JSON['stringify'](_0xdae14c[_0xa6b2('0x58')]):_0xa6b2('0x68'));return respondWithRpcPromise(_0xa6b2('0x69'),_0xa6b2('0x6a'),_0x3c16cb);}return null;})[_0xa6b2('0x20')](function(_0x5a724b){var _0x5356f0=_0xa6b2('0x6b')+_0x5a724b['message'][_0xa6b2('0x6c')];return db['sequelize'][_0xa6b2('0x3f')](_0x5356f0,{'type':db[_0xa6b2('0x6d')][_0xa6b2('0x6e')][_0xa6b2('0x6f')],'raw':!![]})[_0xa6b2('0x20')](function(_0x19ec69){return _0x19ec69;});})[_0xa6b2('0x20')](function(_0xa9bc29){if(_0xa9bc29){_0x3c16cb['message'][_0xa6b2('0x70')]=_0xa9bc29[0x0];if(!_0xdae14c[_0xa6b2('0x58')][_0xa6b2('0x5f')])return;return db[_0xa6b2('0x71')][_0xa6b2('0x56')]({'where':{'id':_0xdae14c['body'][_0xa6b2('0x5f')],'role':_0xa6b2('0x72')},'attributes':['id','name',_0xa6b2('0x73'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x4862c9){if(!_0x4862c9)return null;_0x3c16cb[_0xa6b2('0x28')][_0xa6b2('0x72')]=_0x4862c9;return _0x3c16cb;})[_0xa6b2('0x20')](function(_0x305092){if(_0x305092){if(_0xdae14c[_0xa6b2('0x58')][_0xa6b2('0x74')]){_0x3c16cb['message'][_0xa6b2('0x75')]=util['format']('SIP/%s',_0xdae14c[_0xa6b2('0x60')][_0xa6b2('0x38')]);_0x3c16cb[_0xa6b2('0x28')][_0xa6b2('0x76')]=_0x3c16cb[_0xa6b2('0x76')];_0x3c16cb[_0xa6b2('0x28')][_0xa6b2('0x77')]=_0x3c16cb[_0xa6b2('0x76')];_0x3c16cb[_0xa6b2('0x28')]['event']=_0xa6b2('0x5b');return respondWithRpcPromise(_0xa6b2('0x78'),_0xa6b2('0x78'),{'event':_0xa6b2('0x79'),'message':_0x3c16cb[_0xa6b2('0x28')]},client9002)[_0xa6b2('0x20')](function(){return _0x3c16cb;});}return _0x3c16cb;}return null;})['then'](respondWithResult(_0x2f45ea,null))[_0xa6b2('0x2a')](handleError(_0x2f45ea,null));};var interaction_log=require(_0xa6b2('0x5a'))(_0xa6b2('0x7a'));exports[_0xa6b2('0x34')]=function(_0x5efb92,_0x3dae58,_0x2271fc){var _0x877469={'agent':{},'channel':_0xa6b2('0x7b')};if(_0x5efb92['body']['id']){delete _0x5efb92[_0xa6b2('0x58')]['id'];}_0x5efb92[_0xa6b2('0x58')]['UserId']=_0x5efb92['body']['UserId']||_0x5efb92['user']['id'];_0x877469[_0xa6b2('0x72')]['id']=_0x5efb92[_0xa6b2('0x58')][_0xa6b2('0x5f')];return db[_0xa6b2('0x55')]['find']({'where':{'id':_0x5efb92['params']['id'],'UserId':null}})[_0xa6b2('0x20')](handleEntityNotFound(_0x3dae58,null))[_0xa6b2('0x20')](function(_0x369a58){if(_0x369a58){_0x877469[_0xa6b2('0x28')]=_0x369a58[_0xa6b2('0x61')]({'plain':!![]});return db['OpenchannelInteraction'][_0xa6b2('0x56')]({'where':{'id':_0x369a58[_0xa6b2('0x7c')]}});}return null;})[_0xa6b2('0x20')](handleEntityNotFound(_0x3dae58,null))[_0xa6b2('0x20')](function(_0xff45a3){if(_0xff45a3){_0x877469[_0xa6b2('0x67')]=_0xff45a3[_0xa6b2('0x61')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5efb92[_0xa6b2('0x60')]['id'],_0x5efb92[_0xa6b2('0x60')][_0xa6b2('0x38')],_0x5efb92[_0xa6b2('0x60')][_0xa6b2('0x66')],_0x877469[_0xa6b2('0x67')]['id'],_0x5efb92[_0xa6b2('0x58')]?JSON[_0xa6b2('0x24')](_0x5efb92[_0xa6b2('0x58')]):_0xa6b2('0x68'));return respondWithRpcPromise(_0xa6b2('0x7d'),'rejectMessage',_0x877469);}return null;})['then'](function(_0x143c3e){var _0x5be8d5=_0xa6b2('0x6b')+_0x143c3e[_0xa6b2('0x28')][_0xa6b2('0x6c')];return db['sequelize'][_0xa6b2('0x3f')](_0x5be8d5,{'type':db[_0xa6b2('0x6d')][_0xa6b2('0x6e')]['SELECT'],'raw':!![]})[_0xa6b2('0x20')](function(_0xdda044){return _0xdda044;});})[_0xa6b2('0x20')](function(_0x3d8917){if(_0x3d8917){_0x877469[_0xa6b2('0x28')]['contact']=_0x3d8917[0x0];if(!_0x5efb92['body'][_0xa6b2('0x5f')])return;return db[_0xa6b2('0x71')]['find']({'where':{'id':_0x5efb92[_0xa6b2('0x58')][_0xa6b2('0x5f')],'role':_0xa6b2('0x72')},'attributes':['id',_0xa6b2('0x38'),_0xa6b2('0x73'),_0xa6b2('0x7e'),_0xa6b2('0x7f')],'raw':!![]});}return null;})[_0xa6b2('0x20')](function(_0x56de1c){if(!_0x56de1c)return null;_0x877469[_0xa6b2('0x28')][_0xa6b2('0x72')]=_0x56de1c;return _0x877469;})['then'](function(_0x1739f3){if(_0x1739f3){_0x1739f3[_0xa6b2('0x28')]['interface']=util[_0xa6b2('0x5e')](_0xa6b2('0x80'),_0x5efb92[_0xa6b2('0x60')]['name']);_0x1739f3[_0xa6b2('0x28')][_0xa6b2('0x76')]=_0x877469[_0xa6b2('0x76')];_0x1739f3[_0xa6b2('0x28')]['motionChannel']=_0x877469['channel'];_0x1739f3[_0xa6b2('0x28')][_0xa6b2('0x81')]='reject';respondWithRpcPromise(_0xa6b2('0x78'),_0xa6b2('0x78'),{'event':_0xa6b2('0x82'),'message':_0x1739f3[_0xa6b2('0x28')]},client9002);return _0x877469;}return null;})['then'](respondWithResult(_0x3dae58,null))[_0xa6b2('0x2a')](handleError(_0x3dae58,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 55659ff..f430172 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 _0x0058=['OpenchannelMessage','setMaxListeners','save','remove','emit','hook','../../mysqldb'];(function(_0x119705,_0xba9427){var _0x2affc2=function(_0x16f7e2){while(--_0x16f7e2){_0x119705['push'](_0x119705['shift']());}};_0x2affc2(++_0xba9427);}(_0x0058,0x1e9));var _0x8005=function(_0x82754b,_0x419d29){_0x82754b=_0x82754b-0x0;var _0x4e0027=_0x0058[_0x82754b];return _0x4e0027;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x8005('0x0'))['db'][_0x8005('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x8005('0x2')](0x0);var events={'afterCreate':_0x8005('0x3'),'afterUpdate':'update','afterDestroy':_0x8005('0x4')};function emitEvent(_0x31af9f){return function(_0x1fa35f,_0x586ef2,_0x1e2655){OpenchannelMessageEvents[_0x8005('0x5')](_0x31af9f+':'+_0x1fa35f['id'],_0x1fa35f);OpenchannelMessageEvents[_0x8005('0x5')](_0x31af9f,_0x1fa35f);_0x1e2655(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x8005('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x2ce4=['hasOwnProperty','hook','events','setMaxListeners','save','update','remove','emit'];(function(_0x3e2489,_0x41d9dd){var _0x2254ce=function(_0x227e46){while(--_0x227e46){_0x3e2489['push'](_0x3e2489['shift']());}};_0x2254ce(++_0x41d9dd);}(_0x2ce4,0x1da));var _0x42ce=function(_0x5adc14,_0x3a01ec){_0x5adc14=_0x5adc14-0x0;var _0x50a613=_0x2ce4[_0x5adc14];return _0x50a613;};'use strict';var EventEmitter=require(_0x42ce('0x0'));var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x42ce('0x1')](0x0);var events={'afterCreate':_0x42ce('0x2'),'afterUpdate':_0x42ce('0x3'),'afterDestroy':_0x42ce('0x4')};function emitEvent(_0x58984d){return function(_0x3aa8e6,_0x2a4742,_0x39192f){OpenchannelMessageEvents[_0x42ce('0x5')](_0x58984d+':'+_0x3aa8e6['id'],_0x3aa8e6);OpenchannelMessageEvents[_0x42ce('0x5')](_0x58984d,_0x3aa8e6);_0x39192f(null);};}for(var e in events){if(events[_0x42ce('0x6')](e)){var event=events[e];OpenchannelMessage[_0x42ce('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 68188dd..48d88b8 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(_0x444cbd,_0x1cf41c){var _0xfc72fa=function(_0x42e371){while(--_0x42e371){_0x444cbd['push'](_0x444cbd['shift']());}};_0xfc72fa(++_0x1cf41c);}(_0xea28,0x13a));var _0x8ea2=function(_0x46d282,_0x259f89){_0x46d282=_0x46d282-0x0;var _0x2f91ac=_0xea28[_0x46d282];return _0x2f91ac;};'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 _0xd4a2=['OpenchannelInteractionId','then','createdAt','toLowerCase','catch','error','describe','OpenchannelAccount','Interactions','CmContact','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','method','POST','threadId','update','inspect','finally','utf8mb4','lodash','api','bluebird','path','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','out','secret','isNil','UserId','OpenchannelInteraction','findOne'];(function(_0xb5710b,_0x523785){var _0x4fc542=function(_0x3cd84b){while(--_0x3cd84b){_0xb5710b['push'](_0xb5710b['shift']());}};_0x4fc542(++_0x523785);}(_0xd4a2,0x173));var _0x2d4a=function(_0xd80d0b,_0x420bf5){_0xd80d0b=_0xd80d0b-0x0;var _0x146d56=_0xd4a2[_0xd80d0b];return _0x146d56;};'use strict';var _=require(_0x2d4a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2d4a('0x1'));var moment=require('moment');var BPromise=require(_0x2d4a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d4a('0x3'));var rimraf=require('rimraf');var config=require(_0x2d4a('0x4'));var attributes=require(_0x2d4a('0x5'));module[_0x2d4a('0x6')]=function(_0x3a88e2,_0x1ca10b){return _0x3a88e2['define'](_0x2d4a('0x7'),attributes,{'tableName':_0x2d4a('0x8'),'paranoid':![],'indexes':[{'name':_0x2d4a('0x9'),'fields':[_0x2d4a('0xa')],'type':_0x2d4a('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x535b2f,_0xb9f016,_0x113839){var _0x33b786=_0x3a88e2[_0x2d4a('0xc')];var _0x3abbbd=_0x535b2f[_0x2d4a('0xd')]({'plain':!![]});if(_0x3abbbd['direction']['toLowerCase']()==='in'||_0x3abbbd[_0x2d4a('0xe')]['toLowerCase']()===_0x2d4a('0xf')&&!_0x3abbbd[_0x2d4a('0x10')]&&!_[_0x2d4a('0x11')](_0x3abbbd[_0x2d4a('0x12')])){_0x33b786[_0x2d4a('0x13')][_0x2d4a('0x14')]({'where':{'id':_0x3abbbd[_0x2d4a('0x15')]}})[_0x2d4a('0x16')](function(_0x544622){if(_0x544622){_0x544622['update']({'lastMsgAt':_0x3abbbd[_0x2d4a('0x17')],'lastMsgDirection':_0x3abbbd['direction'][_0x2d4a('0x18')]()});}})[_0x2d4a('0x19')](function(_0x11896d){console[_0x2d4a('0x1a')](_0x11896d);});}if(_0x3abbbd['direction']===_0x2d4a('0xf')&&!_0x3abbbd['secret']){var _0x2838fa;_0x33b786['CmContact'][_0x2d4a('0x1b')]()[_0x2d4a('0x16')](function(_0x2188b2){return _0x33b786[_0x2d4a('0x1c')]['find']({'where':{'id':_0x3abbbd['OpenchannelAccountId']},'include':[{'model':_0x33b786['OpenchannelInteraction'],'as':_0x2d4a('0x1d'),'where':{'id':_0x3abbbd[_0x2d4a('0x15')]},'limit':0x1,'include':[{'model':_0x33b786[_0x2d4a('0x1e')],'as':_0x2d4a('0x1f'),'attributes':_[_0x2d4a('0x20')](_0x2188b2)}]}]});})[_0x2d4a('0x16')](function(_0x56445a){_0x2838fa=_0x56445a['get']({'plain':!![]});if(_0x2838fa&&_0x2838fa[_0x2d4a('0x21')]){logger[_0x2d4a('0x22')](_0x2d4a('0x23'),_0x2d4a('0x24'),util[_0x2d4a('0x25')](_0x2d4a('0x26'),_0x3abbbd['id'],_0x2838fa[_0x2d4a('0x21')]));if(_0x2838fa[_0x2d4a('0x1d')]&&_0x2838fa['Interactions'][_0x2d4a('0x27')]){_0x3abbbd[_0x2d4a('0x28')]=_[_0x2d4a('0x29')](_0x2838fa[_0x2d4a('0x1d')][0x0],_0x2d4a('0x1f'));_0x3abbbd[_0x2d4a('0x1f')]=_0x2838fa[_0x2d4a('0x1d')][0x0][_0x2d4a('0x1f')];}var _0xb9f016={'method':'POST','uri':encodeURI(_0x2838fa['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0xb9f016[_0x2d4a('0x2a')]){case'GET':_0xb9f016['qs']=_0x3abbbd;break;case _0x2d4a('0x2b'):_0xb9f016[_0x2d4a('0xa')]=_0x3abbbd;break;}return rp(_0xb9f016)[_0x2d4a('0x16')](function(_0x1d2fa6){logger[_0x2d4a('0x22')](_0x2d4a('0x23'),_0x2d4a('0x24'),util[_0x2d4a('0x25')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x3abbbd['id'],_0x2838fa[_0x2d4a('0x21')]));if(_0x1d2fa6['body'][_0x2d4a('0x2c')]&&_0x1d2fa6[_0x2d4a('0xa')][_0x2d4a('0x2c')]!=_0x3abbbd[_0x2d4a('0x28')][_0x2d4a('0x2c')]){return _0x33b786[_0x2d4a('0x13')][_0x2d4a('0x2d')]({'threadId':_0x1d2fa6[_0x2d4a('0xa')]['threadId']},{'logging':!![],'where':{'id':_0x3abbbd[_0x2d4a('0x28')]['id']}});}else{return;}})[_0x2d4a('0x16')](function(){return _0x535b2f[_0x2d4a('0x2d')]({'read':!![]});})[_0x2d4a('0x19')](function(_0x2b66af){logger['error'](_0x2d4a('0x23'),_0x2d4a('0x24'),util[_0x2d4a('0x2e')](_0x2b66af,{'showHidden':![],'depth':null}));_0x113839();});}else{_0x113839();}})[_0x2d4a('0x2f')](function(){_0x113839();});}else{_0x113839();}}},'charset':_0x2d4a('0x30'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index c1d0f68..a488e96 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(_0x36b3f8,_0x559f42){var _0x1a9456=function(_0x47380d){while(--_0x47380d){_0x36b3f8['push'](_0x36b3f8['shift']());}};_0x1a9456(++_0x559f42);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3f91af,_0x48325b){_0x3f91af=_0x3f91af-0x0;var _0xa47cd4=_0x5f2f[_0x3f91af];return _0xa47cd4;};'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(_0x51b1d4,_0x278dbb){var _0x4e0cee=function(_0x258c10){while(--_0x258c10){_0x51b1d4['push'](_0x51b1d4['shift']());}};_0x4e0cee(++_0x278dbb);}(_0x2ef3,0xba));var _0x32ef=function(_0x4779a0,_0x13cb6b){_0x4779a0=_0x4779a0-0x0;var _0x3833be=_0x2ef3[_0x4779a0];return _0x3833be;};'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 fca19fa..a9aab33 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 _0xb8a1=['update','emit','removeListener','length','openchannelMessage:','./openchannelMessage.events','save','remove'];(function(_0x270032,_0x22d83c){var _0xe49008=function(_0x52649f){while(--_0x52649f){_0x270032['push'](_0x270032['shift']());}};_0xe49008(++_0x22d83c);}(_0xb8a1,0x1bd));var _0x1b8a=function(_0x1b7a85,_0x632bf0){_0x1b7a85=_0x1b7a85-0x0;var _0x3a3029=_0xb8a1[_0x1b7a85];return _0x3a3029;};'use strict';var OpenchannelMessageEvents=require(_0x1b8a('0x0'));var events=[_0x1b8a('0x1'),_0x1b8a('0x2'),_0x1b8a('0x3')];function createListener(_0x50b43f,_0x3c5fcb){return function(_0x4e7d2a){_0x3c5fcb[_0x1b8a('0x4')](_0x50b43f,_0x4e7d2a);};}function removeListener(_0x531610,_0xd532e2){return function(){OpenchannelMessageEvents[_0x1b8a('0x5')](_0x531610,_0xd532e2);};}exports['register']=function(_0x3bc4f2){for(var _0x5c3092=0x0,_0x4ddd71=events[_0x1b8a('0x6')];_0x5c3092<_0x4ddd71;_0x5c3092++){var _0x13f884=events[_0x5c3092];var _0x220bdd=createListener(_0x1b8a('0x7')+_0x13f884,_0x3bc4f2);OpenchannelMessageEvents['on'](_0x13f884,_0x220bdd);}}; \ No newline at end of file +var _0x859b=['removeListener','register','length','./openchannelMessage.events','save','remove','update'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x859b,0xf8));var _0xb859=function(_0x534599,_0x4ae2f9){_0x534599=_0x534599-0x0;var _0xd63943=_0x859b[_0x534599];return _0xd63943;};'use strict';var OpenchannelMessageEvents=require(_0xb859('0x0'));var events=[_0xb859('0x1'),_0xb859('0x2'),_0xb859('0x3')];function createListener(_0x814925,_0x4ab240){return function(_0x4e56b9){_0x4ab240['emit'](_0x814925,_0x4e56b9);};}function removeListener(_0x5e6774,_0x34a0cb){return function(){OpenchannelMessageEvents[_0xb859('0x4')](_0x5e6774,_0x34a0cb);};}exports[_0xb859('0x5')]=function(_0x436226){for(var _0x54695e=0x0,_0x6550e1=events[_0xb859('0x6')];_0x54695e<_0x6550e1;_0x54695e++){var _0x3c1928=events[_0x54695e];var _0x30f63c=createListener('openchannelMessage:'+_0x3c1928,_0x436226);OpenchannelMessageEvents['on'](_0x3c1928,_0x30f63c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 65b18d4..59b7912 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 _0xc11d=['index','/describe','/:id','show','/:id/teams','getTeams','/:id/users','create','post','addTeams','update','delete','destroy','removeTeams','removeAgents','util','connect-timeout','express','Router','./openchannelQueue.controller','get','isAuthenticated'];(function(_0x5520a0,_0x143ac0){var _0x4ed976=function(_0x5ae266){while(--_0x5ae266){_0x5520a0['push'](_0x5520a0['shift']());}};_0x4ed976(++_0x143ac0);}(_0xc11d,0x1f3));var _0xdc11=function(_0x44770c,_0x2546c7){_0x44770c=_0x44770c-0x0;var _0x1ed083=_0xc11d[_0x44770c];return _0x1ed083;};'use strict';var multer=require('multer');var util=require(_0xdc11('0x0'));var path=require('path');var timeout=require(_0xdc11('0x1'));var express=require(_0xdc11('0x2'));var router=express[_0xdc11('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdc11('0x4'));router[_0xdc11('0x5')]('/',auth[_0xdc11('0x6')](),controller[_0xdc11('0x7')]);router[_0xdc11('0x5')](_0xdc11('0x8'),auth[_0xdc11('0x6')](),controller['describe']);router[_0xdc11('0x5')](_0xdc11('0x9'),auth[_0xdc11('0x6')](),controller[_0xdc11('0xa')]);router[_0xdc11('0x5')]('/:id/members',auth[_0xdc11('0x6')](),controller['getMembers']);router[_0xdc11('0x5')](_0xdc11('0xb'),auth[_0xdc11('0x6')](),controller[_0xdc11('0xc')]);router[_0xdc11('0x5')](_0xdc11('0xd'),auth[_0xdc11('0x6')](),controller['getAgents']);router['post']('/',auth[_0xdc11('0x6')](),controller[_0xdc11('0xe')]);router[_0xdc11('0xf')](_0xdc11('0xb'),auth['isAuthenticated'](),controller[_0xdc11('0x10')]);router[_0xdc11('0xf')](_0xdc11('0xd'),auth[_0xdc11('0x6')](),controller['addAgents']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xdc11('0x11')]);router[_0xdc11('0x12')](_0xdc11('0x9'),auth[_0xdc11('0x6')](),controller[_0xdc11('0x13')]);router['delete'](_0xdc11('0xb'),auth[_0xdc11('0x6')](),controller[_0xdc11('0x14')]);router[_0xdc11('0x12')](_0xdc11('0xd'),auth['isAuthenticated'](),controller[_0xdc11('0x15')]);module['exports']=router; \ No newline at end of file +var _0x6994=['addAgents','update','delete','/:id','destroy','removeTeams','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','isAuthenticated','describe','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post'];(function(_0x279d3d,_0x231715){var _0x22757c=function(_0x25ca3b){while(--_0x25ca3b){_0x279d3d['push'](_0x279d3d['shift']());}};_0x22757c(++_0x231715);}(_0x6994,0x73));var _0x4699=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x6994[_0x465a0c];return _0x1e202e;};'use strict';var multer=require('multer');var util=require(_0x4699('0x0'));var path=require(_0x4699('0x1'));var timeout=require('connect-timeout');var express=require(_0x4699('0x2'));var router=express[_0x4699('0x3')]();var fs_extra=require(_0x4699('0x4'));var auth=require(_0x4699('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4699('0x6'));var controller=require(_0x4699('0x7'));router[_0x4699('0x8')]('/',auth['isAuthenticated'](),controller[_0x4699('0x9')]);router[_0x4699('0x8')](_0x4699('0xa'),auth[_0x4699('0xb')](),controller[_0x4699('0xc')]);router[_0x4699('0x8')]('/:id',auth[_0x4699('0xb')](),controller['show']);router[_0x4699('0x8')](_0x4699('0xd'),auth[_0x4699('0xb')](),controller[_0x4699('0xe')]);router[_0x4699('0x8')](_0x4699('0xf'),auth[_0x4699('0xb')](),controller[_0x4699('0x10')]);router[_0x4699('0x8')](_0x4699('0x11'),auth['isAuthenticated'](),controller[_0x4699('0x12')]);router[_0x4699('0x13')]('/',auth[_0x4699('0xb')](),controller['create']);router['post'](_0x4699('0xf'),auth[_0x4699('0xb')](),controller['addTeams']);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x4699('0x14')]);router['put']('/:id',auth[_0x4699('0xb')](),controller[_0x4699('0x15')]);router[_0x4699('0x16')](_0x4699('0x17'),auth[_0x4699('0xb')](),controller[_0x4699('0x18')]);router[_0x4699('0x16')](_0x4699('0xf'),auth[_0x4699('0xb')](),controller[_0x4699('0x19')]);router[_0x4699('0x16')](_0x4699('0x11'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x4699('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index ffe3800..490499a 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 _0xb50e=['rrmemory','sequelize','exports','STRING','INTEGER'];(function(_0x29646d,_0x19f0d7){var _0x327cfa=function(_0x29c296){while(--_0x29c296){_0x29646d['push'](_0x29646d['shift']());}};_0x327cfa(++_0x19f0d7);}(_0xb50e,0xfb));var _0xeb50=function(_0x5ee58f,_0x3ad41f){_0x5ee58f=_0x5ee58f-0x0;var _0x330129=_0xb50e[_0x5ee58f];return _0x330129;};'use strict';var Sequelize=require(_0xeb50('0x0'));module[_0xeb50('0x1')]={'name':{'type':Sequelize[_0xeb50('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xeb50('0x2')]},'timeout':{'type':Sequelize[_0xeb50('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xeb50('0x4'),'beepall','roundrobin')}}; \ No newline at end of file +var _0xb260=['ENUM','rrmemory','beepall','sequelize','STRING','name','INTEGER'];(function(_0x5bf904,_0x53087d){var _0x5b1ae7=function(_0xd93f1b){while(--_0xd93f1b){_0x5bf904['push'](_0x5bf904['shift']());}};_0x5b1ae7(++_0x53087d);}(_0xb260,0x1a7));var _0x0b26=function(_0x1b7a99,_0x33a762){_0x1b7a99=_0x1b7a99-0x0;var _0x14f74e=_0xb260[_0x1b7a99];return _0x14f74e;};'use strict';var Sequelize=require(_0x0b26('0x0'));module['exports']={'name':{'type':Sequelize[_0x0b26('0x1')],'unique':_0x0b26('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0b26('0x1')]},'timeout':{'type':Sequelize[_0x0b26('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0b26('0x4')](_0x0b26('0x5'),_0x0b26('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index afbce6a..ff614e0 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 _0xd1b5=['sequelize','transaction','addTeams','each','emit','userOpenchannelQueue:save','removeTeams','select','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','forEach','addAgents','omit','spread','removeAgents','isArray','userOpenchannelQueue:remove','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','get','OpenchannelQueues','error','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','findAll','rows','catch','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','pick','OpenchannelQueueId','findAndCountAll','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','Team','ids','User','Agents','online','voicePause','interface','flatMap'];(function(_0x2963f2,_0x485525){var _0x126e94=function(_0xa5f12d){while(--_0xa5f12d){_0x2963f2['push'](_0x2963f2['shift']());}};_0x126e94(++_0x485525);}(_0xd1b5,0x1c0));var _0x5d1b=function(_0x540292,_0x30a2cd){_0x540292=_0x540292-0x0;var _0x1820bd=_0xd1b5[_0x540292];return _0x1820bd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5d1b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5d1b('0x1'));var rp=require(_0x5d1b('0x2'));var moment=require(_0x5d1b('0x3'));var BPromise=require(_0x5d1b('0x4'));var Mustache=require(_0x5d1b('0x5'));var util=require(_0x5d1b('0x6'));var path=require('path');var sox=require(_0x5d1b('0x7'));var csv=require(_0x5d1b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5d1b('0x9'));var _=require(_0x5d1b('0xa'));var squel=require('squel');var crypto=require(_0x5d1b('0xb'));var jsforce=require(_0x5d1b('0xc'));var deskjs=require(_0x5d1b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5d1b('0xe'));var Papa=require(_0x5d1b('0xf'));var Redis=require('ioredis');var authService=require(_0x5d1b('0x10'));var qs=require(_0x5d1b('0x11'));var as=require(_0x5d1b('0x12'));var hardwareService=require(_0x5d1b('0x13'));var logger=require(_0x5d1b('0x14'))(_0x5d1b('0x15'));var utils=require('../../config/utils');var config=require(_0x5d1b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5d1b('0x17'))['db'];config[_0x5d1b('0x18')]=_[_0x5d1b('0x19')](config[_0x5d1b('0x18')],{'host':_0x5d1b('0x1a'),'port':0x18eb});var socket=require(_0x5d1b('0x1b'))(new Redis(config['redis']));require('./openchannelQueue.socket')[_0x5d1b('0x1c')](socket);function respondWithStatusCode(_0x104b94,_0x46b938){_0x46b938=_0x46b938||0xcc;return function(_0x3de685){if(_0x3de685){return _0x104b94[_0x5d1b('0x1d')](_0x46b938);}return _0x104b94[_0x5d1b('0x1e')](_0x46b938)[_0x5d1b('0x1f')]();};}function respondWithResult(_0x526a81,_0x1dba14){_0x1dba14=_0x1dba14||0xc8;return function(_0x1b06ff){if(_0x1b06ff){return _0x526a81[_0x5d1b('0x1e')](_0x1dba14)[_0x5d1b('0x20')](_0x1b06ff);}};}function respondWithFilteredResult(_0x17ccdf,_0x4475d){return function(_0x5583ab){if(_0x5583ab){var _0x32640e=typeof _0x4475d[_0x5d1b('0x21')]===_0x5d1b('0x22')&&typeof _0x4475d[_0x5d1b('0x23')]===_0x5d1b('0x22');var _0x311549=_0x5583ab[_0x5d1b('0x24')];var _0x3565bb=_0x32640e?0x0:_0x4475d[_0x5d1b('0x21')];var _0x6fabb5=_0x32640e?_0x5583ab[_0x5d1b('0x24')]:_0x4475d[_0x5d1b('0x21')]+_0x4475d[_0x5d1b('0x23')];var _0x4e59c6;if(_0x6fabb5>=_0x311549){_0x6fabb5=_0x311549;_0x4e59c6=0xc8;}else{_0x4e59c6=0xce;}_0x17ccdf['status'](_0x4e59c6);return _0x17ccdf[_0x5d1b('0x25')]('Content-Range',_0x3565bb+'-'+_0x6fabb5+'/'+_0x311549)['json'](_0x5583ab);}return null;};}function patchUpdates(_0x303545){return function(_0x95739a){try{jsonpatch[_0x5d1b('0x26')](_0x95739a,_0x303545,!![]);}catch(_0xaf95d5){return BPromise[_0x5d1b('0x27')](_0xaf95d5);}return _0x95739a[_0x5d1b('0x28')]();};}function saveUpdates(_0x4dca51,_0x75dcde){return function(_0xac617b){if(_0xac617b){return _0xac617b[_0x5d1b('0x29')](_0x4dca51)['then'](function(_0x4d146a){return _0x4d146a;});}return null;};}function removeEntity(_0x119def,_0xaea5e8){return function(_0x5e558b){if(_0x5e558b){return _0x5e558b[_0x5d1b('0x2a')]()[_0x5d1b('0x2b')](function(){var _0x328f08=_0x5e558b[_0x5d1b('0x2c')]({'plain':!![]});var _0x4b32c2=_0x5d1b('0x2d');return db['UserProfileResource']['destroy']({'where':{'type':_0x4b32c2,'resourceId':_0x328f08['id']}})['then'](function(){return _0x5e558b;});})[_0x5d1b('0x2b')](function(){_0x119def[_0x5d1b('0x1e')](0xcc)[_0x5d1b('0x1f')]();});}};}function handleEntityNotFound(_0x5da17c,_0x3c76f8){return function(_0x36ee93){if(!_0x36ee93){_0x5da17c[_0x5d1b('0x1d')](0x194);}return _0x36ee93;};}function handleError(_0x13b5d7,_0x5daaf2){_0x5daaf2=_0x5daaf2||0x1f4;return function(_0x48064a){logger[_0x5d1b('0x2e')](_0x48064a['stack']);if(_0x48064a[_0x5d1b('0x2f')]){delete _0x48064a['name'];}_0x13b5d7['status'](_0x5daaf2)[_0x5d1b('0x30')](_0x48064a);};}exports[_0x5d1b('0x31')]=function(_0x552864,_0x5a1df8){var _0x4b995e={},_0x44f326={},_0x32cf8d={'count':0x0,'rows':[]};var _0x4ad652=_[_0x5d1b('0x32')](db[_0x5d1b('0x33')][_0x5d1b('0x34')],function(_0x5751a6){return{'name':_0x5751a6[_0x5d1b('0x35')],'type':_0x5751a6[_0x5d1b('0x36')][_0x5d1b('0x37')]};});_0x44f326[_0x5d1b('0x38')]=_['map'](_0x4ad652,_0x5d1b('0x2f'));_0x44f326[_0x5d1b('0x39')]=_['keys'](_0x552864[_0x5d1b('0x39')]);_0x44f326[_0x5d1b('0x3a')]=_[_0x5d1b('0x3b')](_0x44f326[_0x5d1b('0x38')],_0x44f326[_0x5d1b('0x39')]);_0x4b995e[_0x5d1b('0x3c')]=_[_0x5d1b('0x3b')](_0x44f326[_0x5d1b('0x38')],qs[_0x5d1b('0x3d')](_0x552864[_0x5d1b('0x39')]['fields']));_0x4b995e[_0x5d1b('0x3c')]=_0x4b995e[_0x5d1b('0x3c')][_0x5d1b('0x3e')]?_0x4b995e[_0x5d1b('0x3c')]:_0x44f326[_0x5d1b('0x38')];if(!_0x552864['query'][_0x5d1b('0x3f')](_0x5d1b('0x40'))){_0x4b995e[_0x5d1b('0x23')]=qs[_0x5d1b('0x23')](_0x552864[_0x5d1b('0x39')][_0x5d1b('0x23')]);_0x4b995e[_0x5d1b('0x21')]=qs[_0x5d1b('0x21')](_0x552864[_0x5d1b('0x39')][_0x5d1b('0x21')]);}_0x4b995e[_0x5d1b('0x41')]=qs[_0x5d1b('0x42')](_0x552864['query']['sort']);_0x4b995e['where']=qs[_0x5d1b('0x3a')](_['pick'](_0x552864[_0x5d1b('0x39')],_0x44f326[_0x5d1b('0x3a')]),_0x4ad652);if(_0x552864['query'][_0x5d1b('0x43')]){_0x4b995e[_0x5d1b('0x44')]=_[_0x5d1b('0x45')](_0x4b995e[_0x5d1b('0x44')],{'$or':_['map'](_0x4ad652,function(_0x46354e){if(_0x46354e[_0x5d1b('0x36')]!=='VIRTUAL'){var _0x105893={};_0x105893[_0x46354e['name']]={'$like':'%'+_0x552864['query']['filter']+'%'};return _0x105893;}})});}_0x4b995e=_[_0x5d1b('0x45')]({},_0x4b995e,_0x552864[_0x5d1b('0x46')]);var _0x3b16a6={'where':_0x4b995e[_0x5d1b('0x44')]};return db['OpenchannelQueue'][_0x5d1b('0x24')](_0x3b16a6)['then'](function(_0x245029){_0x32cf8d[_0x5d1b('0x24')]=_0x245029;if(_0x552864[_0x5d1b('0x39')][_0x5d1b('0x47')]){_0x4b995e['include']=[{'all':!![]}];}return db['OpenchannelQueue'][_0x5d1b('0x48')](_0x4b995e);})[_0x5d1b('0x2b')](function(_0x231881){_0x32cf8d[_0x5d1b('0x49')]=_0x231881;return _0x32cf8d;})[_0x5d1b('0x2b')](respondWithFilteredResult(_0x5a1df8,_0x4b995e))[_0x5d1b('0x4a')](handleError(_0x5a1df8,null));};exports['show']=function(_0x552ec4,_0x590a03){var _0x9b42d2={'raw':!![],'where':{'id':_0x552ec4[_0x5d1b('0x4b')]['id']}},_0x7e82dd={};_0x7e82dd[_0x5d1b('0x38')]=_['keys'](db[_0x5d1b('0x33')][_0x5d1b('0x34')]);_0x7e82dd[_0x5d1b('0x39')]=_[_0x5d1b('0x4c')](_0x552ec4[_0x5d1b('0x39')]);_0x7e82dd[_0x5d1b('0x3a')]=_['intersection'](_0x7e82dd[_0x5d1b('0x38')],_0x7e82dd[_0x5d1b('0x39')]);_0x9b42d2['attributes']=_[_0x5d1b('0x3b')](_0x7e82dd['model'],qs[_0x5d1b('0x3d')](_0x552ec4[_0x5d1b('0x39')][_0x5d1b('0x3d')]));_0x9b42d2[_0x5d1b('0x3c')]=_0x9b42d2[_0x5d1b('0x3c')]['length']?_0x9b42d2[_0x5d1b('0x3c')]:_0x7e82dd[_0x5d1b('0x38')];if(_0x552ec4[_0x5d1b('0x39')]['includeAll']){_0x9b42d2['include']=[{'all':!![]}];}_0x9b42d2=_[_0x5d1b('0x45')]({},_0x9b42d2,_0x552ec4[_0x5d1b('0x46')]);return db[_0x5d1b('0x33')][_0x5d1b('0x4d')](_0x9b42d2)[_0x5d1b('0x2b')](handleEntityNotFound(_0x590a03,null))[_0x5d1b('0x2b')](respondWithResult(_0x590a03,null))['catch'](handleError(_0x590a03,null));};exports[_0x5d1b('0x4e')]=function(_0x36d75b,_0x29ac12){return db[_0x5d1b('0x33')][_0x5d1b('0x4e')](_0x36d75b[_0x5d1b('0x4f')],{})[_0x5d1b('0x2b')](function(_0x421526){var _0x12968e=_0x36d75b['user']['get']({'plain':!![]});if(!_0x12968e)throw new Error(_0x5d1b('0x50'));if(_0x12968e[_0x5d1b('0x51')]===_0x5d1b('0x52')){var _0x553847=_0x421526[_0x5d1b('0x2c')]({'plain':!![]});var _0x11f7d3='OpenchannelQueues';return db[_0x5d1b('0x53')]['find']({'where':{'name':_0x11f7d3,'userProfileId':_0x12968e['userProfileId']},'raw':!![]})[_0x5d1b('0x2b')](function(_0x278ebe){if(_0x278ebe&&_0x278ebe[_0x5d1b('0x54')]===0x0){return db[_0x5d1b('0x55')][_0x5d1b('0x4e')]({'name':_0x553847[_0x5d1b('0x2f')],'resourceId':_0x553847['id'],'type':_0x278ebe[_0x5d1b('0x2f')],'sectionId':_0x278ebe['id']},{})[_0x5d1b('0x2b')](function(){return _0x421526;});}else{return _0x421526;}})['catch'](function(_0x340d57){logger['error'](_0x5d1b('0x56'),_0x340d57);throw _0x340d57;});}return _0x421526;})[_0x5d1b('0x2b')](respondWithResult(_0x29ac12,0xc9))['catch'](handleError(_0x29ac12,null));};exports[_0x5d1b('0x29')]=function(_0x9cb39c,_0x1b831f){if(_0x9cb39c[_0x5d1b('0x4f')]['id']){delete _0x9cb39c[_0x5d1b('0x4f')]['id'];}return db[_0x5d1b('0x33')]['find']({'where':{'id':_0x9cb39c[_0x5d1b('0x4b')]['id']}})[_0x5d1b('0x2b')](handleEntityNotFound(_0x1b831f,null))[_0x5d1b('0x2b')](saveUpdates(_0x9cb39c['body'],null))[_0x5d1b('0x2b')](respondWithResult(_0x1b831f,null))[_0x5d1b('0x4a')](handleError(_0x1b831f,null));};exports[_0x5d1b('0x2a')]=function(_0x1470d0,_0x49b0e3){return db[_0x5d1b('0x33')][_0x5d1b('0x4d')]({'where':{'id':_0x1470d0[_0x5d1b('0x4b')]['id']}})[_0x5d1b('0x2b')](handleEntityNotFound(_0x49b0e3,null))['then'](removeEntity(_0x49b0e3,null))['catch'](handleError(_0x49b0e3,null));};exports['describe']=function(_0x4ad37b,_0x3eff23){return db[_0x5d1b('0x33')][_0x5d1b('0x57')]()['then'](respondWithResult(_0x3eff23,null))[_0x5d1b('0x4a')](handleError(_0x3eff23,null));};exports[_0x5d1b('0x58')]=function(_0x47d1f4,_0x473f34,_0x573b27){var _0x1641ba={'raw':!![],'where':{}},_0x403b99={},_0x3fe4a7;return db[_0x5d1b('0x33')][_0x5d1b('0x59')]({'where':{'id':_0x47d1f4[_0x5d1b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x473f34,null))[_0x5d1b('0x2b')](function(_0x140b41){if(_0x140b41){_0x3fe4a7=_0x140b41[_0x5d1b('0x2c')]({'plain':!![]});_0x403b99['model']=_[_0x5d1b('0x4c')](db[_0x5d1b('0x5a')]['rawAttributes']);_0x403b99[_0x5d1b('0x39')]=_['keys'](_0x47d1f4['query']);_0x403b99[_0x5d1b('0x3a')]=_[_0x5d1b('0x3b')](_0x403b99[_0x5d1b('0x38')],_0x403b99[_0x5d1b('0x39')]);_0x1641ba[_0x5d1b('0x3c')]=_[_0x5d1b('0x3b')](_0x403b99['model'],qs[_0x5d1b('0x3d')](_0x47d1f4['query'][_0x5d1b('0x3d')]));_0x1641ba[_0x5d1b('0x3c')]=_0x1641ba['attributes'][_0x5d1b('0x3e')]?_0x1641ba[_0x5d1b('0x3c')]:_0x403b99[_0x5d1b('0x38')];if(!_0x47d1f4[_0x5d1b('0x39')]['hasOwnProperty'](_0x5d1b('0x40'))){_0x1641ba[_0x5d1b('0x23')]=qs[_0x5d1b('0x23')](_0x47d1f4[_0x5d1b('0x39')][_0x5d1b('0x23')]);_0x1641ba[_0x5d1b('0x21')]=qs[_0x5d1b('0x21')](_0x47d1f4[_0x5d1b('0x39')][_0x5d1b('0x21')]);}_0x1641ba['order']=qs[_0x5d1b('0x42')](_0x47d1f4[_0x5d1b('0x39')]['sort']);_0x1641ba[_0x5d1b('0x44')]=qs[_0x5d1b('0x3a')](_[_0x5d1b('0x5b')](_0x47d1f4[_0x5d1b('0x39')],_0x403b99[_0x5d1b('0x3a')]));_0x1641ba[_0x5d1b('0x44')][_0x5d1b('0x5c')]=_0x140b41['id'];if(_0x47d1f4[_0x5d1b('0x39')][_0x5d1b('0x43')]){_0x1641ba['where']=_[_0x5d1b('0x45')](_0x1641ba[_0x5d1b('0x44')],{'$or':_['map'](_0x1641ba[_0x5d1b('0x3c')],function(_0x1841cf){var _0x13fd0f={};_0x13fd0f[_0x1841cf]={'$like':'%'+_0x47d1f4[_0x5d1b('0x39')][_0x5d1b('0x43')]+'%'};return _0x13fd0f;})});}_0x1641ba=_[_0x5d1b('0x45')]({},_0x1641ba,_0x47d1f4[_0x5d1b('0x46')]);return db[_0x5d1b('0x5a')][_0x5d1b('0x48')](_0x1641ba);}})[_0x5d1b('0x2b')](function(_0x540a4b){if(_0x540a4b){return db['User'][_0x5d1b('0x5d')]({'where':{'id':_[_0x5d1b('0x32')](_0x540a4b,'UserId'),'role':'agent'},'attributes':['id',_0x5d1b('0x2f'),_0x5d1b('0x5e'),_0x5d1b('0x5f'),_0x5d1b('0x60')]});}})[_0x5d1b('0x2b')](function(_0x124323){if(_0x124323){return{'count':_0x124323[_0x5d1b('0x24')],'rows':_['map'](_0x124323['rows'],function(_0x449700){return{'membername':_0x449700[_0x5d1b('0x2f')],'UserId':_0x449700['id'],'queue_name':_0x3fe4a7[_0x5d1b('0x2f')],'OpenchannelQueueId':_0x3fe4a7['id'],'interface':util[_0x5d1b('0x61')](_0x5d1b('0x62'),_0x5d1b('0x63'),_0x449700[_0x5d1b('0x2f')]),'penalty':0x0,'paused':_0x449700[_0x5d1b('0x5e')],'createdAt':_0x449700[_0x5d1b('0x60')],'updatedAt':_0x449700['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5d1b('0x2b')](respondWithFilteredResult(_0x473f34,_0x1641ba))[_0x5d1b('0x4a')](handleError(_0x473f34,null));};exports['getTeams']=function(_0x5b1a77,_0x28bcac,_0x462a32){var _0x36d3bf={};var _0x5b9b4={};var _0x1b401c;var _0x50e5be;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x5b1a77[_0x5d1b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x28bcac,null))[_0x5d1b('0x2b')](function(_0x2f8090){if(_0x2f8090){_0x1b401c=_0x2f8090;_0x5b9b4[_0x5d1b('0x38')]=_[_0x5d1b('0x4c')](db[_0x5d1b('0x64')]['rawAttributes']);_0x5b9b4[_0x5d1b('0x39')]=_[_0x5d1b('0x4c')](_0x5b1a77['query']);_0x5b9b4[_0x5d1b('0x3a')]=_['intersection'](_0x5b9b4[_0x5d1b('0x38')],_0x5b9b4['query']);_0x36d3bf['attributes']=_['intersection'](_0x5b9b4[_0x5d1b('0x38')],qs[_0x5d1b('0x3d')](_0x5b1a77[_0x5d1b('0x39')][_0x5d1b('0x3d')]));_0x36d3bf['attributes']=_0x36d3bf[_0x5d1b('0x3c')][_0x5d1b('0x3e')]?_0x36d3bf['attributes']:_0x5b9b4[_0x5d1b('0x38')];_0x36d3bf[_0x5d1b('0x41')]=qs['sort'](_0x5b1a77[_0x5d1b('0x39')][_0x5d1b('0x42')]);_0x36d3bf[_0x5d1b('0x44')]=qs[_0x5d1b('0x3a')](_[_0x5d1b('0x5b')](_0x5b1a77[_0x5d1b('0x39')],_0x5b9b4[_0x5d1b('0x3a')]));if(_0x5b1a77['query'][_0x5d1b('0x43')]){_0x36d3bf[_0x5d1b('0x44')]=_['merge'](_0x36d3bf[_0x5d1b('0x44')],{'$or':_['map'](_0x36d3bf['attributes'],function(_0x6a2a8d){var _0x31c590={};_0x31c590[_0x6a2a8d]={'$like':'%'+_0x5b1a77['query'][_0x5d1b('0x43')]+'%'};return _0x31c590;})});}_0x36d3bf=_[_0x5d1b('0x45')]({},_0x36d3bf,_0x5b1a77[_0x5d1b('0x46')]);return _0x1b401c['getTeams'](_0x36d3bf);}})[_0x5d1b('0x2b')](function(_0x2f53b9){if(_0x2f53b9){_0x50e5be=_0x2f53b9['length'];if(!_0x5b1a77[_0x5d1b('0x39')]['hasOwnProperty'](_0x5d1b('0x40'))){_0x36d3bf[_0x5d1b('0x23')]=qs[_0x5d1b('0x23')](_0x5b1a77['query'][_0x5d1b('0x23')]);_0x36d3bf['offset']=qs['offset'](_0x5b1a77['query'][_0x5d1b('0x21')]);}return _0x1b401c['getTeams'](_0x36d3bf);}})[_0x5d1b('0x2b')](function(_0xce3ea8){if(_0xce3ea8){return _0xce3ea8?{'count':_0x50e5be,'rows':_0xce3ea8}:null;}})[_0x5d1b('0x2b')](respondWithResult(_0x28bcac,null))[_0x5d1b('0x4a')](handleError(_0x28bcac,null));};exports['addTeams']=function(_0x1c85ac,_0x27e3a6,_0x7d18f0){var _0x321ef0=_0x1c85ac[_0x5d1b('0x4f')][_0x5d1b('0x65')];return db[_0x5d1b('0x64')]['findAll']({'where':{'id':_0x321ef0},'attributes':['id'],'include':[{'model':db[_0x5d1b('0x66')],'as':_0x5d1b('0x67'),'attributes':['id',_0x5d1b('0x2f'),_0x5d1b('0x68'),_0x5d1b('0x69'),_0x5d1b('0x6a')],'raw':!![]}]})[_0x5d1b('0x2b')](function(_0xd08226){if(_0xd08226){var _0x2b2cf7=_[_0x5d1b('0x6b')](_0xd08226,function(_0x38fff3){var _0x2a851d=_0x38fff3['get']({'plain':!![]});return _0x2a851d[_0x5d1b('0x67')];});return db['OpenchannelQueue'][_0x5d1b('0x4d')]({'where':{'id':_0x1c85ac[_0x5d1b('0x4b')]['id']}})[_0x5d1b('0x2b')](function(_0x43d280){return db[_0x5d1b('0x6c')][_0x5d1b('0x6d')](function(_0x372766){return _0x43d280[_0x5d1b('0x6e')](_0x321ef0,{'transaction':_0x372766})[_0x5d1b('0x2b')](function(){return BPromise[_0x5d1b('0x6f')](_0x2b2cf7,function(_0xc97d6a){return db[_0x5d1b('0x5a')]['findOrCreate']({'where':{'UserId':_0xc97d6a['id'],'OpenchannelQueueId':_0x1c85ac[_0x5d1b('0x4b')]['id']},'transaction':_0x372766});});})[_0x5d1b('0x2b')](function(){_0x2b2cf7['forEach'](function(_0x1ffb66){socket[_0x5d1b('0x70')](_0x5d1b('0x71'),{'UserId':_0x1ffb66['id'],'OpenchannelQueueId':_0x43d280['id']});});});});});}})[_0x5d1b('0x2b')](respondWithStatusCode(_0x27e3a6,null))[_0x5d1b('0x4a')](handleError(_0x27e3a6,null));};exports[_0x5d1b('0x72')]=function(_0x11d204,_0x338fef,_0x90be69){return db[_0x5d1b('0x64')][_0x5d1b('0x48')]({'where':{'id':_0x11d204['query'][_0x5d1b('0x65')]},'attributes':['id'],'include':[{'model':db[_0x5d1b('0x66')],'as':_0x5d1b('0x67'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x338fef,null))[_0x5d1b('0x2b')](function(_0xf37b0a){var _0x39983=_['map'](_0xf37b0a,'id');var _0x1914cd=[];var _0x4decbd=[];var _0x4024e0=squel[_0x5d1b('0x73')]();_0x4024e0['field']('tq.TeamId')['from'](_0x5d1b('0x74'),'tq')['join'](_0x5d1b('0x75'),'ut',_0x5d1b('0x76'))['where'](_0x5d1b('0x77'),_0x11d204[_0x5d1b('0x4b')]['id']);for(var _0x151c17=0x0;_0x151c17<_0xf37b0a['length'];_0x151c17+=0x1){let _0x330617=_0xf37b0a[_0x151c17];for(var _0x3b2ccc=0x0;_0x3b2ccc<_0x330617[_0x5d1b('0x67')][_0x5d1b('0x3e')];_0x3b2ccc+=0x1){let _0x1823f5=_0x330617[_0x5d1b('0x67')][_0x3b2ccc];var _0x5002c8=_0x4024e0[_0x5d1b('0x78')]();_0x5002c8['where'](_0x5d1b('0x79'),_0x1823f5['id']);_0x4decbd['push'](db[_0x5d1b('0x6c')][_0x5d1b('0x39')](_0x5002c8[_0x5d1b('0x7a')](),{'type':db['sequelize'][_0x5d1b('0x7b')][_0x5d1b('0x7c')]})[_0x5d1b('0x2b')](function(_0x5c4bc7){if(_0x5c4bc7[_0x5d1b('0x3e')]===0x1){return _0x1823f5['id'];}else{var _0x36e63c=_[_0x5d1b('0x7d')](_['map'](_0x5c4bc7,_0x5d1b('0x7e')),function(_0x3cf857){return _[_0x5d1b('0x7f')](_0x39983,_0x3cf857);});if(_0x36e63c){return _0x1823f5['id'];}}}));}}return BPromise[_0x5d1b('0x80')](_0x4decbd)[_0x5d1b('0x2b')](function(_0x20730c){_0x1914cd=_(_0x1914cd)[_0x5d1b('0x81')](_0x20730c)['compact']()[_0x5d1b('0x82')]();return db['OpenchannelQueue'][_0x5d1b('0x4d')]({'where':{'id':_0x11d204[_0x5d1b('0x4b')]['id']}})[_0x5d1b('0x2b')](function(_0x482494){return db[_0x5d1b('0x6c')][_0x5d1b('0x6d')](function(_0x4bfab5){return _0x482494[_0x5d1b('0x72')](_0x11d204['query']['ids'],{'transaction':_0x4bfab5})['then'](function(){if(!_['isEmpty'](_0x1914cd)){return _0x482494['removeAgents'](_0x1914cd,{'transaction':_0x4bfab5});}})[_0x5d1b('0x2b')](function(){_0x1914cd[_0x5d1b('0x83')](function(_0xba8fdf){socket[_0x5d1b('0x70')]('userOpenchannelQueue:remove',{'UserId':_0xba8fdf,'OpenchannelQueueId':_0x482494['id']});});});});});});})['then'](respondWithStatusCode(_0x338fef,null))[_0x5d1b('0x4a')](handleError(_0x338fef,null));};exports[_0x5d1b('0x84')]=function(_0x5eba27,_0x3becc0,_0x148b6d){return db[_0x5d1b('0x33')][_0x5d1b('0x4d')]({'where':{'id':_0x5eba27['params']['id']}})[_0x5d1b('0x2b')](handleEntityNotFound(_0x3becc0,null))[_0x5d1b('0x2b')](function(_0x55f921){if(_0x55f921){return _0x55f921[_0x5d1b('0x84')](_0x5eba27[_0x5d1b('0x4f')]['ids'],_[_0x5d1b('0x85')](_0x5eba27['body'],[_0x5d1b('0x65'),'id'])||{})[_0x5d1b('0x86')](function(_0x52014c){for(var _0x3a9579=0x0;_0x3a9579<_0x5eba27[_0x5d1b('0x4f')][_0x5d1b('0x65')][_0x5d1b('0x3e')];_0x3a9579+=0x1){socket[_0x5d1b('0x70')](_0x5d1b('0x71'),{'UserId':Number(_0x5eba27[_0x5d1b('0x4f')][_0x5d1b('0x65')][_0x3a9579]),'OpenchannelQueueId':Number(_0x5eba27[_0x5d1b('0x4b')]['id'])});}return _0x52014c;});}})['then'](respondWithResult(_0x3becc0,null))[_0x5d1b('0x4a')](handleError(_0x3becc0,null));};exports[_0x5d1b('0x87')]=function(_0x1c26ca,_0x723cff,_0x359a98){return db['OpenchannelQueue']['find']({'where':{'id':_0x1c26ca[_0x5d1b('0x4b')]['id']}})[_0x5d1b('0x2b')](handleEntityNotFound(_0x723cff,null))[_0x5d1b('0x2b')](function(_0x116dbe){if(_0x116dbe){return _0x116dbe[_0x5d1b('0x87')](_0x1c26ca['query'][_0x5d1b('0x65')])[_0x5d1b('0x2b')](function(){if(_[_0x5d1b('0x88')](_0x1c26ca[_0x5d1b('0x39')]['ids'])){for(var _0x713a75=0x0;_0x713a75<_0x1c26ca[_0x5d1b('0x39')][_0x5d1b('0x65')][_0x5d1b('0x3e')];_0x713a75+=0x1){socket[_0x5d1b('0x70')](_0x5d1b('0x89'),{'UserId':Number(_0x1c26ca[_0x5d1b('0x39')][_0x5d1b('0x65')][_0x713a75]),'OpenchannelQueueId':Number(_0x1c26ca[_0x5d1b('0x4b')]['id'])});}}else{socket['emit'](_0x5d1b('0x89'),{'UserId':Number(_0x1c26ca[_0x5d1b('0x39')][_0x5d1b('0x65')]),'OpenchannelQueueId':Number(_0x1c26ca[_0x5d1b('0x4b')]['id'])});}});}})[_0x5d1b('0x2b')](respondWithStatusCode(_0x723cff,null))[_0x5d1b('0x4a')](handleError(_0x723cff,null));};exports['getAgents']=function(_0x871e2,_0x45cab8,_0x190d00){var _0x8ceb1e={};var _0x1a2013={};var _0x17029e;var _0x4b8f0a;return db[_0x5d1b('0x33')]['findOne']({'where':{'id':_0x871e2['params']['id']}})[_0x5d1b('0x2b')](handleEntityNotFound(_0x45cab8,null))['then'](function(_0x64e046){if(_0x64e046){_0x17029e=_0x64e046;_0x1a2013[_0x5d1b('0x38')]=_[_0x5d1b('0x4c')](db['User'][_0x5d1b('0x34')]);_0x1a2013[_0x5d1b('0x39')]=_[_0x5d1b('0x4c')](_0x871e2[_0x5d1b('0x39')]);_0x1a2013[_0x5d1b('0x3a')]=_[_0x5d1b('0x3b')](_0x1a2013['model'],_0x1a2013[_0x5d1b('0x39')]);_0x8ceb1e[_0x5d1b('0x3c')]=_['intersection'](_0x1a2013[_0x5d1b('0x38')],qs[_0x5d1b('0x3d')](_0x871e2[_0x5d1b('0x39')]['fields']));_0x8ceb1e[_0x5d1b('0x3c')]=_0x8ceb1e[_0x5d1b('0x3c')][_0x5d1b('0x3e')]?_0x8ceb1e[_0x5d1b('0x3c')]:_0x1a2013[_0x5d1b('0x38')];_0x8ceb1e['order']=qs['sort'](_0x871e2[_0x5d1b('0x39')]['sort']);_0x8ceb1e[_0x5d1b('0x44')]=qs[_0x5d1b('0x3a')](_[_0x5d1b('0x5b')](_0x871e2['query'],_0x1a2013[_0x5d1b('0x3a')]));if(_0x871e2[_0x5d1b('0x39')][_0x5d1b('0x43')]){_0x8ceb1e[_0x5d1b('0x44')]=_[_0x5d1b('0x45')](_0x8ceb1e['where'],{'$or':_[_0x5d1b('0x32')](_0x8ceb1e[_0x5d1b('0x3c')],function(_0x3b5085){var _0x367b28={};_0x367b28[_0x3b5085]={'$like':'%'+_0x871e2[_0x5d1b('0x39')]['filter']+'%'};return _0x367b28;})});}_0x8ceb1e=_[_0x5d1b('0x45')]({},_0x8ceb1e,_0x871e2[_0x5d1b('0x46')]);return _0x17029e[_0x5d1b('0x8a')](_0x8ceb1e);}})[_0x5d1b('0x2b')](function(_0x1a72f3){if(_0x1a72f3){_0x4b8f0a=_0x1a72f3[_0x5d1b('0x3e')];if(!_0x871e2[_0x5d1b('0x39')]['hasOwnProperty'](_0x5d1b('0x40'))){_0x8ceb1e['limit']=qs[_0x5d1b('0x23')](_0x871e2[_0x5d1b('0x39')][_0x5d1b('0x23')]);_0x8ceb1e[_0x5d1b('0x21')]=qs['offset'](_0x871e2[_0x5d1b('0x39')][_0x5d1b('0x21')]);}return _0x17029e[_0x5d1b('0x8a')](_0x8ceb1e);}})['then'](function(_0x269cf7){if(_0x269cf7){return _0x269cf7?{'count':_0x4b8f0a,'rows':_0x269cf7}:null;}})[_0x5d1b('0x2b')](respondWithResult(_0x45cab8,null))[_0x5d1b('0x4a')](handleError(_0x45cab8,null));}; \ No newline at end of file +var _0x79e9=['rawAttributes','type','model','map','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','include','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','OpenchannelQueueId','UserOpenchannelQueue','User','findAndCountAll','UserId','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','flatMap','sequelize','transaction','each','forEach','emit','userOpenchannelQueue:save','removeTeams','field','tq.TeamId','from','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','union','removeAgents','addAgents','omit','userOpenchannelQueue:remove','getAgents','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','get','OpenchannelQueues','UserProfileResource','end','error','name','index','OpenchannelQueue'];(function(_0x24dff1,_0x5cf3bb){var _0x499ebc=function(_0x5248a3){while(--_0x5248a3){_0x24dff1['push'](_0x24dff1['shift']());}};_0x499ebc(++_0x5cf3bb);}(_0x79e9,0x1d8));var _0x979e=function(_0x2b7f5e,_0x23dcad){_0x2b7f5e=_0x2b7f5e-0x0;var _0xc34160=_0x79e9[_0x2b7f5e];return _0xc34160;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x979e('0x0'));var jsonpatch=require(_0x979e('0x1'));var rp=require('request-promise');var moment=require(_0x979e('0x2'));var BPromise=require(_0x979e('0x3'));var Mustache=require(_0x979e('0x4'));var util=require(_0x979e('0x5'));var path=require(_0x979e('0x6'));var sox=require(_0x979e('0x7'));var csv=require(_0x979e('0x8'));var ejs=require(_0x979e('0x9'));var fs=require('fs');var fs_extra=require(_0x979e('0xa'));var _=require('lodash');var squel=require(_0x979e('0xb'));var crypto=require(_0x979e('0xc'));var jsforce=require(_0x979e('0xd'));var deskjs=require(_0x979e('0xe'));var toCsv=require(_0x979e('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x979e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x979e('0x10'));var as=require(_0x979e('0x11'));var hardwareService=require(_0x979e('0x12'));var logger=require(_0x979e('0x13'))('api');var utils=require(_0x979e('0x14'));var config=require(_0x979e('0x15'));var licenseUtil=require(_0x979e('0x16'));var db=require(_0x979e('0x17'))['db'];config[_0x979e('0x18')]=_[_0x979e('0x19')](config['redis'],{'host':_0x979e('0x1a'),'port':0x18eb});var socket=require(_0x979e('0x1b'))(new Redis(config['redis']));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0xc8292d,_0x6a3049){_0x6a3049=_0x6a3049||0xcc;return function(_0x1c560c){if(_0x1c560c){return _0xc8292d[_0x979e('0x1c')](_0x6a3049);}return _0xc8292d['status'](_0x6a3049)['end']();};}function respondWithResult(_0x11a4b1,_0x51e451){_0x51e451=_0x51e451||0xc8;return function(_0x390b43){if(_0x390b43){return _0x11a4b1[_0x979e('0x1d')](_0x51e451)[_0x979e('0x1e')](_0x390b43);}};}function respondWithFilteredResult(_0xa7ce6f,_0x1d4c5d){return function(_0x4d5e7b){if(_0x4d5e7b){var _0x37e827=typeof _0x1d4c5d[_0x979e('0x1f')]===_0x979e('0x20')&&typeof _0x1d4c5d[_0x979e('0x21')]===_0x979e('0x20');var _0x1479c5=_0x4d5e7b[_0x979e('0x22')];var _0x399385=_0x37e827?0x0:_0x1d4c5d['offset'];var _0x1be02c=_0x37e827?_0x4d5e7b[_0x979e('0x22')]:_0x1d4c5d['offset']+_0x1d4c5d[_0x979e('0x21')];var _0x5991ea;if(_0x1be02c>=_0x1479c5){_0x1be02c=_0x1479c5;_0x5991ea=0xc8;}else{_0x5991ea=0xce;}_0xa7ce6f['status'](_0x5991ea);return _0xa7ce6f['set'](_0x979e('0x23'),_0x399385+'-'+_0x1be02c+'/'+_0x1479c5)['json'](_0x4d5e7b);}return null;};}function patchUpdates(_0x5684a5){return function(_0x5d991a){try{jsonpatch['apply'](_0x5d991a,_0x5684a5,!![]);}catch(_0x5a426f){return BPromise[_0x979e('0x24')](_0x5a426f);}return _0x5d991a['save']();};}function saveUpdates(_0x305e70,_0x2ac06e){return function(_0x146106){if(_0x146106){return _0x146106[_0x979e('0x25')](_0x305e70)[_0x979e('0x26')](function(_0x25793c){return _0x25793c;});}return null;};}function removeEntity(_0x4f4127,_0x4dcfbc){return function(_0x2080a4){if(_0x2080a4){return _0x2080a4[_0x979e('0x27')]()[_0x979e('0x26')](function(){var _0x5d9065=_0x2080a4[_0x979e('0x28')]({'plain':!![]});var _0x2b9209=_0x979e('0x29');return db[_0x979e('0x2a')][_0x979e('0x27')]({'where':{'type':_0x2b9209,'resourceId':_0x5d9065['id']}})[_0x979e('0x26')](function(){return _0x2080a4;});})[_0x979e('0x26')](function(){_0x4f4127['status'](0xcc)[_0x979e('0x2b')]();});}};}function handleEntityNotFound(_0x3ec7c5,_0x21be9e){return function(_0x409ae3){if(!_0x409ae3){_0x3ec7c5[_0x979e('0x1c')](0x194);}return _0x409ae3;};}function handleError(_0x5a555c,_0x571ec1){_0x571ec1=_0x571ec1||0x1f4;return function(_0xea3233){logger[_0x979e('0x2c')](_0xea3233['stack']);if(_0xea3233[_0x979e('0x2d')]){delete _0xea3233[_0x979e('0x2d')];}_0x5a555c[_0x979e('0x1d')](_0x571ec1)['send'](_0xea3233);};}exports[_0x979e('0x2e')]=function(_0x203dd5,_0x9e3073){var _0x7be460={},_0x1940d5={},_0x35cf39={'count':0x0,'rows':[]};var _0x2536ed=_['map'](db[_0x979e('0x2f')][_0x979e('0x30')],function(_0x15e4d1){return{'name':_0x15e4d1['fieldName'],'type':_0x15e4d1[_0x979e('0x31')]['key']};});_0x1940d5[_0x979e('0x32')]=_[_0x979e('0x33')](_0x2536ed,_0x979e('0x2d'));_0x1940d5['query']=_[_0x979e('0x34')](_0x203dd5['query']);_0x1940d5[_0x979e('0x35')]=_['intersection'](_0x1940d5['model'],_0x1940d5['query']);_0x7be460['attributes']=_[_0x979e('0x36')](_0x1940d5[_0x979e('0x32')],qs['fields'](_0x203dd5[_0x979e('0x37')][_0x979e('0x38')]));_0x7be460['attributes']=_0x7be460[_0x979e('0x39')][_0x979e('0x3a')]?_0x7be460[_0x979e('0x39')]:_0x1940d5[_0x979e('0x32')];if(!_0x203dd5['query'][_0x979e('0x3b')](_0x979e('0x3c'))){_0x7be460['limit']=qs[_0x979e('0x21')](_0x203dd5[_0x979e('0x37')][_0x979e('0x21')]);_0x7be460['offset']=qs[_0x979e('0x1f')](_0x203dd5[_0x979e('0x37')][_0x979e('0x1f')]);}_0x7be460[_0x979e('0x3d')]=qs['sort'](_0x203dd5[_0x979e('0x37')][_0x979e('0x3e')]);_0x7be460[_0x979e('0x3f')]=qs['filters'](_[_0x979e('0x40')](_0x203dd5['query'],_0x1940d5[_0x979e('0x35')]),_0x2536ed);if(_0x203dd5[_0x979e('0x37')][_0x979e('0x41')]){_0x7be460[_0x979e('0x3f')]=_[_0x979e('0x42')](_0x7be460['where'],{'$or':_['map'](_0x2536ed,function(_0x5cd3e1){if(_0x5cd3e1[_0x979e('0x31')]!==_0x979e('0x43')){var _0x375d34={};_0x375d34[_0x5cd3e1[_0x979e('0x2d')]]={'$like':'%'+_0x203dd5[_0x979e('0x37')]['filter']+'%'};return _0x375d34;}})});}_0x7be460=_[_0x979e('0x42')]({},_0x7be460,_0x203dd5[_0x979e('0x44')]);var _0x3b8aa5={'where':_0x7be460[_0x979e('0x3f')]};return db[_0x979e('0x2f')][_0x979e('0x22')](_0x3b8aa5)[_0x979e('0x26')](function(_0x282fc1){_0x35cf39[_0x979e('0x22')]=_0x282fc1;if(_0x203dd5[_0x979e('0x37')]['includeAll']){_0x7be460['include']=[{'all':!![]}];}return db['OpenchannelQueue'][_0x979e('0x45')](_0x7be460);})['then'](function(_0x2d07a0){_0x35cf39[_0x979e('0x46')]=_0x2d07a0;return _0x35cf39;})['then'](respondWithFilteredResult(_0x9e3073,_0x7be460))['catch'](handleError(_0x9e3073,null));};exports[_0x979e('0x47')]=function(_0x5cbd45,_0x5b7980){var _0x3f2a8d={'raw':!![],'where':{'id':_0x5cbd45[_0x979e('0x48')]['id']}},_0x5c0330={};_0x5c0330[_0x979e('0x32')]=_['keys'](db[_0x979e('0x2f')][_0x979e('0x30')]);_0x5c0330[_0x979e('0x37')]=_[_0x979e('0x34')](_0x5cbd45[_0x979e('0x37')]);_0x5c0330[_0x979e('0x35')]=_[_0x979e('0x36')](_0x5c0330[_0x979e('0x32')],_0x5c0330['query']);_0x3f2a8d['attributes']=_['intersection'](_0x5c0330[_0x979e('0x32')],qs['fields'](_0x5cbd45['query'][_0x979e('0x38')]));_0x3f2a8d[_0x979e('0x39')]=_0x3f2a8d[_0x979e('0x39')]['length']?_0x3f2a8d[_0x979e('0x39')]:_0x5c0330['model'];if(_0x5cbd45[_0x979e('0x37')]['includeAll']){_0x3f2a8d[_0x979e('0x49')]=[{'all':!![]}];}_0x3f2a8d=_[_0x979e('0x42')]({},_0x3f2a8d,_0x5cbd45[_0x979e('0x44')]);return db['OpenchannelQueue']['find'](_0x3f2a8d)[_0x979e('0x26')](handleEntityNotFound(_0x5b7980,null))['then'](respondWithResult(_0x5b7980,null))[_0x979e('0x4a')](handleError(_0x5b7980,null));};exports[_0x979e('0x4b')]=function(_0x4b0c66,_0x19fa5a){return db[_0x979e('0x2f')][_0x979e('0x4b')](_0x4b0c66['body'],{})[_0x979e('0x26')](function(_0x2d229a){var _0x20c317=_0x4b0c66[_0x979e('0x4c')][_0x979e('0x28')]({'plain':!![]});if(!_0x20c317)throw new Error(_0x979e('0x4d'));if(_0x20c317[_0x979e('0x4e')]==='user'){var _0x1c7851=_0x2d229a['get']({'plain':!![]});var _0x593685=_0x979e('0x29');return db['UserProfileSection'][_0x979e('0x4f')]({'where':{'name':_0x593685,'userProfileId':_0x20c317['userProfileId']},'raw':!![]})[_0x979e('0x26')](function(_0x20f23a){if(_0x20f23a&&_0x20f23a[_0x979e('0x50')]===0x0){return db[_0x979e('0x2a')]['create']({'name':_0x1c7851[_0x979e('0x2d')],'resourceId':_0x1c7851['id'],'type':_0x20f23a[_0x979e('0x2d')],'sectionId':_0x20f23a['id']},{})[_0x979e('0x26')](function(){return _0x2d229a;});}else{return _0x2d229a;}})[_0x979e('0x4a')](function(_0x1c1f45){logger[_0x979e('0x2c')](_0x979e('0x51'),_0x1c1f45);throw _0x1c1f45;});}return _0x2d229a;})[_0x979e('0x26')](respondWithResult(_0x19fa5a,0xc9))[_0x979e('0x4a')](handleError(_0x19fa5a,null));};exports[_0x979e('0x25')]=function(_0x5efb70,_0x4dafac){if(_0x5efb70[_0x979e('0x52')]['id']){delete _0x5efb70[_0x979e('0x52')]['id'];}return db[_0x979e('0x2f')][_0x979e('0x4f')]({'where':{'id':_0x5efb70[_0x979e('0x48')]['id']}})[_0x979e('0x26')](handleEntityNotFound(_0x4dafac,null))['then'](saveUpdates(_0x5efb70[_0x979e('0x52')],null))[_0x979e('0x26')](respondWithResult(_0x4dafac,null))[_0x979e('0x4a')](handleError(_0x4dafac,null));};exports[_0x979e('0x27')]=function(_0x2d7a95,_0x43bec1){return db[_0x979e('0x2f')]['find']({'where':{'id':_0x2d7a95['params']['id']}})[_0x979e('0x26')](handleEntityNotFound(_0x43bec1,null))[_0x979e('0x26')](removeEntity(_0x43bec1,null))['catch'](handleError(_0x43bec1,null));};exports[_0x979e('0x53')]=function(_0x10d8c4,_0x19ce29){return db[_0x979e('0x2f')][_0x979e('0x53')]()[_0x979e('0x26')](respondWithResult(_0x19ce29,null))[_0x979e('0x4a')](handleError(_0x19ce29,null));};exports[_0x979e('0x54')]=function(_0x3c0ed1,_0x47851e,_0x3b0d13){var _0x27a5ba={'raw':!![],'where':{}},_0x5ad7e7={},_0x4cf6a0;return db[_0x979e('0x2f')][_0x979e('0x55')]({'where':{'id':_0x3c0ed1[_0x979e('0x48')]['id']}})[_0x979e('0x26')](handleEntityNotFound(_0x47851e,null))[_0x979e('0x26')](function(_0x4dd5ad){if(_0x4dd5ad){_0x4cf6a0=_0x4dd5ad[_0x979e('0x28')]({'plain':!![]});_0x5ad7e7['model']=_[_0x979e('0x34')](db['UserOpenchannelQueue'][_0x979e('0x30')]);_0x5ad7e7['query']=_[_0x979e('0x34')](_0x3c0ed1[_0x979e('0x37')]);_0x5ad7e7[_0x979e('0x35')]=_['intersection'](_0x5ad7e7['model'],_0x5ad7e7[_0x979e('0x37')]);_0x27a5ba[_0x979e('0x39')]=_[_0x979e('0x36')](_0x5ad7e7[_0x979e('0x32')],qs[_0x979e('0x38')](_0x3c0ed1[_0x979e('0x37')]['fields']));_0x27a5ba[_0x979e('0x39')]=_0x27a5ba[_0x979e('0x39')][_0x979e('0x3a')]?_0x27a5ba[_0x979e('0x39')]:_0x5ad7e7[_0x979e('0x32')];if(!_0x3c0ed1[_0x979e('0x37')][_0x979e('0x3b')](_0x979e('0x3c'))){_0x27a5ba[_0x979e('0x21')]=qs[_0x979e('0x21')](_0x3c0ed1[_0x979e('0x37')]['limit']);_0x27a5ba[_0x979e('0x1f')]=qs[_0x979e('0x1f')](_0x3c0ed1['query'][_0x979e('0x1f')]);}_0x27a5ba[_0x979e('0x3d')]=qs['sort'](_0x3c0ed1['query']['sort']);_0x27a5ba[_0x979e('0x3f')]=qs[_0x979e('0x35')](_[_0x979e('0x40')](_0x3c0ed1[_0x979e('0x37')],_0x5ad7e7[_0x979e('0x35')]));_0x27a5ba[_0x979e('0x3f')][_0x979e('0x56')]=_0x4dd5ad['id'];if(_0x3c0ed1[_0x979e('0x37')][_0x979e('0x41')]){_0x27a5ba['where']=_[_0x979e('0x42')](_0x27a5ba[_0x979e('0x3f')],{'$or':_[_0x979e('0x33')](_0x27a5ba[_0x979e('0x39')],function(_0x293d72){var _0x2a562b={};_0x2a562b[_0x293d72]={'$like':'%'+_0x3c0ed1[_0x979e('0x37')][_0x979e('0x41')]+'%'};return _0x2a562b;})});}_0x27a5ba=_[_0x979e('0x42')]({},_0x27a5ba,_0x3c0ed1['options']);return db[_0x979e('0x57')][_0x979e('0x45')](_0x27a5ba);}})[_0x979e('0x26')](function(_0xe03127){if(_0xe03127){return db[_0x979e('0x58')][_0x979e('0x59')]({'where':{'id':_[_0x979e('0x33')](_0xe03127,_0x979e('0x5a')),'role':'agent'},'attributes':['id',_0x979e('0x2d'),_0x979e('0x5b'),_0x979e('0x5c'),_0x979e('0x5d')]});}})[_0x979e('0x26')](function(_0xc75d4c){if(_0xc75d4c){return{'count':_0xc75d4c[_0x979e('0x22')],'rows':_[_0x979e('0x33')](_0xc75d4c[_0x979e('0x46')],function(_0x235de1){return{'membername':_0x235de1[_0x979e('0x2d')],'UserId':_0x235de1['id'],'queue_name':_0x4cf6a0['name'],'OpenchannelQueueId':_0x4cf6a0['id'],'interface':util[_0x979e('0x5e')](_0x979e('0x5f'),_0x979e('0x60'),_0x235de1[_0x979e('0x2d')]),'penalty':0x0,'paused':_0x235de1[_0x979e('0x5b')],'createdAt':_0x235de1[_0x979e('0x5d')],'updatedAt':_0x235de1[_0x979e('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x47851e,_0x27a5ba))[_0x979e('0x4a')](handleError(_0x47851e,null));};exports[_0x979e('0x61')]=function(_0x3de59f,_0x551489,_0x22dd91){var _0x2d3838={};var _0x4fcb12={};var _0x21a68a;var _0x23c649;return db[_0x979e('0x2f')]['findOne']({'where':{'id':_0x3de59f[_0x979e('0x48')]['id']}})['then'](handleEntityNotFound(_0x551489,null))[_0x979e('0x26')](function(_0xa9c28){if(_0xa9c28){_0x21a68a=_0xa9c28;_0x4fcb12[_0x979e('0x32')]=_[_0x979e('0x34')](db['Team']['rawAttributes']);_0x4fcb12[_0x979e('0x37')]=_['keys'](_0x3de59f[_0x979e('0x37')]);_0x4fcb12['filters']=_['intersection'](_0x4fcb12['model'],_0x4fcb12[_0x979e('0x37')]);_0x2d3838[_0x979e('0x39')]=_[_0x979e('0x36')](_0x4fcb12[_0x979e('0x32')],qs[_0x979e('0x38')](_0x3de59f[_0x979e('0x37')][_0x979e('0x38')]));_0x2d3838['attributes']=_0x2d3838['attributes'][_0x979e('0x3a')]?_0x2d3838[_0x979e('0x39')]:_0x4fcb12[_0x979e('0x32')];_0x2d3838[_0x979e('0x3d')]=qs[_0x979e('0x3e')](_0x3de59f['query'][_0x979e('0x3e')]);_0x2d3838[_0x979e('0x3f')]=qs[_0x979e('0x35')](_[_0x979e('0x40')](_0x3de59f[_0x979e('0x37')],_0x4fcb12[_0x979e('0x35')]));if(_0x3de59f[_0x979e('0x37')][_0x979e('0x41')]){_0x2d3838[_0x979e('0x3f')]=_[_0x979e('0x42')](_0x2d3838[_0x979e('0x3f')],{'$or':_['map'](_0x2d3838[_0x979e('0x39')],function(_0x1e14e5){var _0x30fd92={};_0x30fd92[_0x1e14e5]={'$like':'%'+_0x3de59f[_0x979e('0x37')][_0x979e('0x41')]+'%'};return _0x30fd92;})});}_0x2d3838=_[_0x979e('0x42')]({},_0x2d3838,_0x3de59f[_0x979e('0x44')]);return _0x21a68a[_0x979e('0x61')](_0x2d3838);}})[_0x979e('0x26')](function(_0x5c09c3){if(_0x5c09c3){_0x23c649=_0x5c09c3[_0x979e('0x3a')];if(!_0x3de59f[_0x979e('0x37')]['hasOwnProperty'](_0x979e('0x3c'))){_0x2d3838[_0x979e('0x21')]=qs[_0x979e('0x21')](_0x3de59f['query'][_0x979e('0x21')]);_0x2d3838[_0x979e('0x1f')]=qs[_0x979e('0x1f')](_0x3de59f[_0x979e('0x37')][_0x979e('0x1f')]);}return _0x21a68a[_0x979e('0x61')](_0x2d3838);}})[_0x979e('0x26')](function(_0x3667ef){if(_0x3667ef){return _0x3667ef?{'count':_0x23c649,'rows':_0x3667ef}:null;}})['then'](respondWithResult(_0x551489,null))[_0x979e('0x4a')](handleError(_0x551489,null));};exports[_0x979e('0x62')]=function(_0x267689,_0x3b1226,_0x58fc8b){var _0x57bdfa=_0x267689['body'][_0x979e('0x63')];return db[_0x979e('0x64')]['findAll']({'where':{'id':_0x57bdfa},'attributes':['id'],'include':[{'model':db[_0x979e('0x58')],'as':_0x979e('0x65'),'attributes':['id','name',_0x979e('0x66'),_0x979e('0x67'),'interface'],'raw':!![]}]})[_0x979e('0x26')](function(_0x409414){if(_0x409414){var _0x52600a=_[_0x979e('0x68')](_0x409414,function(_0x6ce5d4){var _0x12cee6=_0x6ce5d4[_0x979e('0x28')]({'plain':!![]});return _0x12cee6[_0x979e('0x65')];});return db[_0x979e('0x2f')]['find']({'where':{'id':_0x267689[_0x979e('0x48')]['id']}})[_0x979e('0x26')](function(_0x1e48ab){return db[_0x979e('0x69')][_0x979e('0x6a')](function(_0x149d09){return _0x1e48ab[_0x979e('0x62')](_0x57bdfa,{'transaction':_0x149d09})['then'](function(){return BPromise[_0x979e('0x6b')](_0x52600a,function(_0xc2614b){return db[_0x979e('0x57')]['findOrCreate']({'where':{'UserId':_0xc2614b['id'],'OpenchannelQueueId':_0x267689['params']['id']},'transaction':_0x149d09});});})[_0x979e('0x26')](function(){_0x52600a[_0x979e('0x6c')](function(_0x3152df){socket[_0x979e('0x6d')](_0x979e('0x6e'),{'UserId':_0x3152df['id'],'OpenchannelQueueId':_0x1e48ab['id']});});});});});}})['then'](respondWithStatusCode(_0x3b1226,null))[_0x979e('0x4a')](handleError(_0x3b1226,null));};exports[_0x979e('0x6f')]=function(_0xf95c33,_0x2f56c5,_0x30a7c2){return db[_0x979e('0x64')][_0x979e('0x45')]({'where':{'id':_0xf95c33[_0x979e('0x37')][_0x979e('0x63')]},'attributes':['id'],'include':[{'model':db[_0x979e('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x979e('0x26')](handleEntityNotFound(_0x2f56c5,null))[_0x979e('0x26')](function(_0x674992){var _0x196922=_['map'](_0x674992,'id');var _0x4f7281=[];var _0x16b7b7=[];var _0x4db5bb=squel['select']();_0x4db5bb[_0x979e('0x70')](_0x979e('0x71'))[_0x979e('0x72')]('team_has_openchannel_queues','tq')['join'](_0x979e('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x979e('0x3f')](_0x979e('0x74'),_0xf95c33['params']['id']);for(var _0x275e3a=0x0;_0x275e3a<_0x674992[_0x979e('0x3a')];_0x275e3a+=0x1){let _0x203d8d=_0x674992[_0x275e3a];for(var _0x4955df=0x0;_0x4955df<_0x203d8d[_0x979e('0x65')][_0x979e('0x3a')];_0x4955df+=0x1){let _0x154acc=_0x203d8d[_0x979e('0x65')][_0x4955df];var _0x586190=_0x4db5bb[_0x979e('0x75')]();_0x586190[_0x979e('0x3f')](_0x979e('0x76'),_0x154acc['id']);_0x16b7b7['push'](db[_0x979e('0x69')][_0x979e('0x37')](_0x586190['toString'](),{'type':db[_0x979e('0x69')][_0x979e('0x77')][_0x979e('0x78')]})['then'](function(_0x4ad141){if(_0x4ad141[_0x979e('0x3a')]===0x1){return _0x154acc['id'];}else{var _0x3cd4a0=_[_0x979e('0x79')](_[_0x979e('0x33')](_0x4ad141,_0x979e('0x7a')),function(_0x488aae){return _[_0x979e('0x7b')](_0x196922,_0x488aae);});if(_0x3cd4a0){return _0x154acc['id'];}}}));}}return BPromise['all'](_0x16b7b7)[_0x979e('0x26')](function(_0x498de0){_0x4f7281=_(_0x4f7281)[_0x979e('0x7c')](_0x498de0)['compact']()['value']();return db[_0x979e('0x2f')]['find']({'where':{'id':_0xf95c33['params']['id']}})[_0x979e('0x26')](function(_0x44b835){return db[_0x979e('0x69')][_0x979e('0x6a')](function(_0x3e1943){return _0x44b835[_0x979e('0x6f')](_0xf95c33[_0x979e('0x37')][_0x979e('0x63')],{'transaction':_0x3e1943})[_0x979e('0x26')](function(){if(!_['isEmpty'](_0x4f7281)){return _0x44b835[_0x979e('0x7d')](_0x4f7281,{'transaction':_0x3e1943});}})[_0x979e('0x26')](function(){_0x4f7281[_0x979e('0x6c')](function(_0x2f1ca7){socket[_0x979e('0x6d')]('userOpenchannelQueue:remove',{'UserId':_0x2f1ca7,'OpenchannelQueueId':_0x44b835['id']});});});});});});})[_0x979e('0x26')](respondWithStatusCode(_0x2f56c5,null))['catch'](handleError(_0x2f56c5,null));};exports[_0x979e('0x7e')]=function(_0x1a46d8,_0xb6d5fe,_0xccfe8a){return db['OpenchannelQueue']['find']({'where':{'id':_0x1a46d8[_0x979e('0x48')]['id']}})['then'](handleEntityNotFound(_0xb6d5fe,null))['then'](function(_0x4c1e1a){if(_0x4c1e1a){return _0x4c1e1a[_0x979e('0x7e')](_0x1a46d8['body'][_0x979e('0x63')],_[_0x979e('0x7f')](_0x1a46d8[_0x979e('0x52')],[_0x979e('0x63'),'id'])||{})['spread'](function(_0x1f52dd){for(var _0x5df5a9=0x0;_0x5df5a9<_0x1a46d8[_0x979e('0x52')][_0x979e('0x63')][_0x979e('0x3a')];_0x5df5a9+=0x1){socket[_0x979e('0x6d')](_0x979e('0x6e'),{'UserId':Number(_0x1a46d8[_0x979e('0x52')][_0x979e('0x63')][_0x5df5a9]),'OpenchannelQueueId':Number(_0x1a46d8[_0x979e('0x48')]['id'])});}return _0x1f52dd;});}})[_0x979e('0x26')](respondWithResult(_0xb6d5fe,null))[_0x979e('0x4a')](handleError(_0xb6d5fe,null));};exports[_0x979e('0x7d')]=function(_0x286b60,_0x42f0b2,_0x5ed58c){return db['OpenchannelQueue']['find']({'where':{'id':_0x286b60[_0x979e('0x48')]['id']}})[_0x979e('0x26')](handleEntityNotFound(_0x42f0b2,null))[_0x979e('0x26')](function(_0x1da0c1){if(_0x1da0c1){return _0x1da0c1['removeAgents'](_0x286b60[_0x979e('0x37')][_0x979e('0x63')])[_0x979e('0x26')](function(){if(_['isArray'](_0x286b60[_0x979e('0x37')][_0x979e('0x63')])){for(var _0x5b953a=0x0;_0x5b953a<_0x286b60[_0x979e('0x37')][_0x979e('0x63')][_0x979e('0x3a')];_0x5b953a+=0x1){socket[_0x979e('0x6d')]('userOpenchannelQueue:remove',{'UserId':Number(_0x286b60['query'][_0x979e('0x63')][_0x5b953a]),'OpenchannelQueueId':Number(_0x286b60[_0x979e('0x48')]['id'])});}}else{socket['emit'](_0x979e('0x80'),{'UserId':Number(_0x286b60['query']['ids']),'OpenchannelQueueId':Number(_0x286b60[_0x979e('0x48')]['id'])});}});}})[_0x979e('0x26')](respondWithStatusCode(_0x42f0b2,null))[_0x979e('0x4a')](handleError(_0x42f0b2,null));};exports[_0x979e('0x81')]=function(_0x1cfd6f,_0x44b273,_0x682e40){var _0x56d04b={};var _0x1ac75f={};var _0x455e31;var _0x2fc458;return db[_0x979e('0x2f')]['findOne']({'where':{'id':_0x1cfd6f[_0x979e('0x48')]['id']}})[_0x979e('0x26')](handleEntityNotFound(_0x44b273,null))[_0x979e('0x26')](function(_0x5f0e91){if(_0x5f0e91){_0x455e31=_0x5f0e91;_0x1ac75f[_0x979e('0x32')]=_[_0x979e('0x34')](db[_0x979e('0x58')][_0x979e('0x30')]);_0x1ac75f['query']=_[_0x979e('0x34')](_0x1cfd6f['query']);_0x1ac75f['filters']=_[_0x979e('0x36')](_0x1ac75f[_0x979e('0x32')],_0x1ac75f[_0x979e('0x37')]);_0x56d04b[_0x979e('0x39')]=_[_0x979e('0x36')](_0x1ac75f[_0x979e('0x32')],qs['fields'](_0x1cfd6f['query'][_0x979e('0x38')]));_0x56d04b[_0x979e('0x39')]=_0x56d04b[_0x979e('0x39')][_0x979e('0x3a')]?_0x56d04b[_0x979e('0x39')]:_0x1ac75f[_0x979e('0x32')];_0x56d04b['order']=qs[_0x979e('0x3e')](_0x1cfd6f[_0x979e('0x37')][_0x979e('0x3e')]);_0x56d04b[_0x979e('0x3f')]=qs[_0x979e('0x35')](_[_0x979e('0x40')](_0x1cfd6f[_0x979e('0x37')],_0x1ac75f[_0x979e('0x35')]));if(_0x1cfd6f[_0x979e('0x37')]['filter']){_0x56d04b['where']=_[_0x979e('0x42')](_0x56d04b[_0x979e('0x3f')],{'$or':_[_0x979e('0x33')](_0x56d04b[_0x979e('0x39')],function(_0x2e8d69){var _0x4d8aa7={};_0x4d8aa7[_0x2e8d69]={'$like':'%'+_0x1cfd6f[_0x979e('0x37')][_0x979e('0x41')]+'%'};return _0x4d8aa7;})});}_0x56d04b=_[_0x979e('0x42')]({},_0x56d04b,_0x1cfd6f[_0x979e('0x44')]);return _0x455e31[_0x979e('0x81')](_0x56d04b);}})[_0x979e('0x26')](function(_0x41dc82){if(_0x41dc82){_0x2fc458=_0x41dc82[_0x979e('0x3a')];if(!_0x1cfd6f[_0x979e('0x37')]['hasOwnProperty'](_0x979e('0x3c'))){_0x56d04b[_0x979e('0x21')]=qs[_0x979e('0x21')](_0x1cfd6f['query'][_0x979e('0x21')]);_0x56d04b[_0x979e('0x1f')]=qs['offset'](_0x1cfd6f[_0x979e('0x37')][_0x979e('0x1f')]);}return _0x455e31[_0x979e('0x81')](_0x56d04b);}})[_0x979e('0x26')](function(_0x5ecf96){if(_0x5ecf96){return _0x5ecf96?{'count':_0x2fc458,'rows':_0x5ecf96}:null;}})[_0x979e('0x26')](respondWithResult(_0x44b273,null))[_0x979e('0x4a')](handleError(_0x44b273,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 11b50c6..e2e8823 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 _0x3bc0=['../../mysqldb','OpenchannelQueue','save','update','remove','emit','hook','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3bc0,0x1b8));var _0x03bc=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x3bc0[_0x5f0089];return _0x193892;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x03bc('0x0'))['db'][_0x03bc('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x03bc('0x2'),'afterUpdate':_0x03bc('0x3'),'afterDestroy':_0x03bc('0x4')};function emitEvent(_0x11feb6){return function(_0x116c48,_0x7fb53d,_0x2b7017){OpenchannelQueueEvents[_0x03bc('0x5')](_0x11feb6+':'+_0x116c48['id'],_0x116c48);OpenchannelQueueEvents[_0x03bc('0x5')](_0x11feb6,_0x116c48);_0x2b7017(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x03bc('0x6')](e,emitEvent(event));}}module[_0x03bc('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x06af=['emit','hasOwnProperty','exports','events','../../mysqldb','OpenchannelQueue','update','remove'];(function(_0x21525d,_0x402163){var _0x2703c3=function(_0x10732b){while(--_0x10732b){_0x21525d['push'](_0x21525d['shift']());}};_0x2703c3(++_0x402163);}(_0x06af,0x10b));var _0xf06a=function(_0x42c1a7,_0x4d1ab0){_0x42c1a7=_0x42c1a7-0x0;var _0x186fa4=_0x06af[_0x42c1a7];return _0x186fa4;};'use strict';var EventEmitter=require(_0xf06a('0x0'));var OpenchannelQueue=require(_0xf06a('0x1'))['db'][_0xf06a('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xf06a('0x3'),'afterDestroy':_0xf06a('0x4')};function emitEvent(_0x49b12b){return function(_0x18424c,_0x1788fb,_0x385bef){OpenchannelQueueEvents[_0xf06a('0x5')](_0x49b12b+':'+_0x18424c['id'],_0x18424c);OpenchannelQueueEvents[_0xf06a('0x5')](_0x49b12b,_0x18424c);_0x385bef(null);};}for(var e in events){if(events[_0xf06a('0x6')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0xf06a('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 04ae42e..91ba1c9 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 _0x2bd9=['OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment','path','rimraf','exports','define'];(function(_0x2229f3,_0x2f4a11){var _0x3f3d28=function(_0x776613){while(--_0x776613){_0x2229f3['push'](_0x2229f3['shift']());}};_0x3f3d28(++_0x2f4a11);}(_0x2bd9,0xf4));var _0x92bd=function(_0x3baf60,_0x5b498b){_0x3baf60=_0x3baf60-0x0;var _0x48b546=_0x2bd9[_0x3baf60];return _0x48b546;};'use strict';var _=require(_0x92bd('0x0'));var util=require(_0x92bd('0x1'));var logger=require(_0x92bd('0x2'))(_0x92bd('0x3'));var moment=require(_0x92bd('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x92bd('0x5'));var rimraf=require(_0x92bd('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module[_0x92bd('0x7')]=function(_0x354fe1,_0x31f552){return _0x354fe1[_0x92bd('0x8')](_0x92bd('0x9'),attributes,{'tableName':_0x92bd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c47=['OpenchannelQueue','openchannel_queues','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','define'];(function(_0x26b80e,_0x5c9333){var _0x84a8a8=function(_0x2e5b4a){while(--_0x2e5b4a){_0x26b80e['push'](_0x26b80e['shift']());}};_0x84a8a8(++_0x5c9333);}(_0x9c47,0x8e));var _0x79c4=function(_0x453344,_0x2d900a){_0x453344=_0x453344-0x0;var _0x51004b=_0x9c47[_0x453344];return _0x51004b;};'use strict';var _=require(_0x79c4('0x0'));var util=require(_0x79c4('0x1'));var logger=require('../../config/logger')(_0x79c4('0x2'));var moment=require('moment');var BPromise=require(_0x79c4('0x3'));var rp=require(_0x79c4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x79c4('0x5'));var config=require(_0x79c4('0x6'));var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x38966d,_0x323dcb){return _0x38966d[_0x79c4('0x7')](_0x79c4('0x8'),attributes,{'tableName':_0x79c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index ac70548..f6a17da 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 _0xaedf=['../../config/logger','rpc','../../config/environment','client','redis','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetOpenchannelQueue','findAll','options','attributes','include','model','ShowOpenchannelQueue','OpenchannelQueue','find','raw','map','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaedf,0x11a));var _0xfaed=function(_0x1fb954,_0x2cec46){_0x1fb954=_0x1fb954-0x0;var _0x34f40=_0xaedf[_0x1fb954];return _0x34f40;};'use strict';var _=require(_0xfaed('0x0'));var util=require(_0xfaed('0x1'));var moment=require(_0xfaed('0x2'));var BPromise=require(_0xfaed('0x3'));var rs=require(_0xfaed('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfaed('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfaed('0x6'))(_0xfaed('0x7'));var config=require(_0xfaed('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfaed('0x9')]['http']({'port':0x232a});config[_0xfaed('0xa')]=_['defaults'](config[_0xfaed('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xfaed('0xb'))(new Redis(config[_0xfaed('0xa')]));require(_0xfaed('0xc'))[_0xfaed('0xd')](socket);function respondWithRpcPromise(_0x1df102,_0x2fccd5,_0x3bdcb1){return new BPromise(function(_0x2ed9b0,_0x4ef175){return client[_0xfaed('0xe')](_0x1df102,_0x3bdcb1)[_0xfaed('0xf')](function(_0xba990f){logger[_0xfaed('0x10')](_0xfaed('0x11'),_0x2fccd5,_0xfaed('0x12'));logger[_0xfaed('0x13')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x2fccd5,'request\x20sent',JSON[_0xfaed('0x14')](_0xba990f));if(_0xba990f[_0xfaed('0x15')]){if(_0xba990f[_0xfaed('0x15')][_0xfaed('0x16')]===0x1f4){logger['error'](_0xfaed('0x11'),_0x2fccd5,_0xba990f['error'][_0xfaed('0x17')]);return _0x4ef175(_0xba990f[_0xfaed('0x15')][_0xfaed('0x17')]);}logger[_0xfaed('0x15')](_0xfaed('0x11'),_0x2fccd5,_0xba990f[_0xfaed('0x15')]['message']);return _0x2ed9b0(_0xba990f[_0xfaed('0x15')][_0xfaed('0x17')]);}else{logger[_0xfaed('0x10')](_0xfaed('0x11'),_0x2fccd5,_0xfaed('0x12'));_0x2ed9b0(_0xba990f['result']['message']);}})[_0xfaed('0x18')](function(_0x619986){logger[_0xfaed('0x15')](_0xfaed('0x11'),_0x2fccd5,_0x619986);_0x4ef175(_0x619986);});});}exports[_0xfaed('0x19')]=function(_0x34e12a){var _0x2a739f=this;return new Promise(function(_0x252043,_0xb6f21a){return db['OpenchannelQueue'][_0xfaed('0x1a')]({'raw':_0x34e12a['options']?_0x34e12a[_0xfaed('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x34e12a[_0xfaed('0x1b')]?_0x34e12a[_0xfaed('0x1b')]['where']||null:null,'attributes':_0x34e12a[_0xfaed('0x1b')]?_0x34e12a[_0xfaed('0x1b')][_0xfaed('0x1c')]||null:null,'limit':_0x34e12a['options']?_0x34e12a[_0xfaed('0x1b')]['limit']||null:null,'include':_0x34e12a[_0xfaed('0x1b')]?_0x34e12a[_0xfaed('0x1b')][_0xfaed('0x1d')]?_['map'](_0x34e12a[_0xfaed('0x1b')][_0xfaed('0x1d')],function(_0x5c0ba2){return{'model':db[_0x5c0ba2[_0xfaed('0x1e')]],'as':_0x5c0ba2['as'],'attributes':_0x5c0ba2[_0xfaed('0x1c')],'include':_0x5c0ba2[_0xfaed('0x1d')]?_['map'](_0x5c0ba2[_0xfaed('0x1d')],function(_0x396a44){return{'model':db[_0x396a44['model']],'as':_0x396a44['as'],'attributes':_0x396a44[_0xfaed('0x1c')],'include':_0x396a44[_0xfaed('0x1d')]?_['map'](_0x396a44[_0xfaed('0x1d')],function(_0x4fe5b9){return{'model':db[_0x4fe5b9[_0xfaed('0x1e')]],'as':_0x4fe5b9['as'],'attributes':_0x4fe5b9[_0xfaed('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x556470){logger[_0xfaed('0x10')](_0xfaed('0x19'),_0x34e12a);logger['debug']('GetOpenchannelQueue',_0x34e12a,JSON['stringify'](_0x556470));_0x252043(_0x556470);})[_0xfaed('0x18')](function(_0x5c89ab){logger['error'](_0xfaed('0x19'),_0x5c89ab[_0xfaed('0x17')],_0x34e12a);_0xb6f21a(_0x2a739f[_0xfaed('0x15')](0x1f4,_0x5c89ab[_0xfaed('0x17')]));});});};exports[_0xfaed('0x1f')]=function(_0xa45e6c){var _0x3a7b4a=this;return new Promise(function(_0x443daa,_0x491fcd){return db[_0xfaed('0x20')][_0xfaed('0x21')]({'raw':_0xa45e6c[_0xfaed('0x1b')]?_0xa45e6c[_0xfaed('0x1b')][_0xfaed('0x22')]===undefined?!![]:![]:!![],'where':_0xa45e6c[_0xfaed('0x1b')]?_0xa45e6c[_0xfaed('0x1b')]['where']||null:null,'attributes':_0xa45e6c['options']?_0xa45e6c[_0xfaed('0x1b')][_0xfaed('0x1c')]||null:null,'include':_0xa45e6c[_0xfaed('0x1b')]?_0xa45e6c[_0xfaed('0x1b')][_0xfaed('0x1d')]?_[_0xfaed('0x23')](_0xa45e6c['options'][_0xfaed('0x1d')],function(_0x577c4f){return{'model':db[_0x577c4f[_0xfaed('0x1e')]],'as':_0x577c4f['as'],'attributes':_0x577c4f[_0xfaed('0x1c')],'include':_0x577c4f[_0xfaed('0x1d')]?_['map'](_0x577c4f[_0xfaed('0x1d')],function(_0x17d786){return{'model':db[_0x17d786[_0xfaed('0x1e')]],'as':_0x17d786['as'],'attributes':_0x17d786[_0xfaed('0x1c')],'include':_0x17d786[_0xfaed('0x1d')]?_[_0xfaed('0x23')](_0x17d786[_0xfaed('0x1d')],function(_0xe43ae1){return{'model':db[_0xe43ae1[_0xfaed('0x1e')]],'as':_0xe43ae1['as'],'attributes':_0xe43ae1[_0xfaed('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xfaed('0xf')](function(_0x15bc2e){logger[_0xfaed('0x10')](_0xfaed('0x1f'),_0xa45e6c);logger['debug'](_0xfaed('0x1f'),_0xa45e6c,JSON[_0xfaed('0x14')](_0x15bc2e));_0x443daa(_0x15bc2e);})['catch'](function(_0x6a9e8b){logger[_0xfaed('0x15')](_0xfaed('0x1f'),_0x6a9e8b[_0xfaed('0x17')],_0xa45e6c);_0x491fcd(_0x3a7b4a['error'](0x1f4,_0x6a9e8b[_0xfaed('0x17')]));});});}; \ No newline at end of file +var _0x3478=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowOpenchannelQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x58b332,_0x54787d){var _0xb8e97e=function(_0x418171){while(--_0x418171){_0x58b332['push'](_0x58b332['shift']());}};_0xb8e97e(++_0x54787d);}(_0x3478,0x10b));var _0x8347=function(_0x5d2523,_0x14bc7e){_0x5d2523=_0x5d2523-0x0;var _0x4b0e39=_0x3478[_0x5d2523];return _0x4b0e39;};'use strict';var _=require('lodash');var util=require(_0x8347('0x0'));var moment=require(_0x8347('0x1'));var BPromise=require(_0x8347('0x2'));var rs=require(_0x8347('0x3'));var fs=require('fs');var Redis=require(_0x8347('0x4'));var db=require(_0x8347('0x5'))['db'];var utils=require(_0x8347('0x6'));var logger=require(_0x8347('0x7'))(_0x8347('0x8'));var config=require('../../config/environment');var jayson=require(_0x8347('0x9'));var client=jayson[_0x8347('0xa')][_0x8347('0xb')]({'port':0x232a});config[_0x8347('0xc')]=_[_0x8347('0xd')](config[_0x8347('0xc')],{'host':_0x8347('0xe'),'port':0x18eb});var socket=require(_0x8347('0xf'))(new Redis(config[_0x8347('0xc')]));require('./openchannelQueue.socket')[_0x8347('0x10')](socket);function respondWithRpcPromise(_0x58e960,_0x3e7c9b,_0x421db4){return new BPromise(function(_0x7be020,_0x4ea486){return client['request'](_0x58e960,_0x421db4)[_0x8347('0x11')](function(_0x3bc91d){logger[_0x8347('0x12')](_0x8347('0x13'),_0x3e7c9b,_0x8347('0x14'));logger[_0x8347('0x15')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x3e7c9b,_0x8347('0x14'),JSON[_0x8347('0x16')](_0x3bc91d));if(_0x3bc91d[_0x8347('0x17')]){if(_0x3bc91d[_0x8347('0x17')][_0x8347('0x18')]===0x1f4){logger[_0x8347('0x17')](_0x8347('0x13'),_0x3e7c9b,_0x3bc91d[_0x8347('0x17')][_0x8347('0x19')]);return _0x4ea486(_0x3bc91d[_0x8347('0x17')][_0x8347('0x19')]);}logger[_0x8347('0x17')](_0x8347('0x13'),_0x3e7c9b,_0x3bc91d[_0x8347('0x17')]['message']);return _0x7be020(_0x3bc91d[_0x8347('0x17')]['message']);}else{logger['info'](_0x8347('0x13'),_0x3e7c9b,_0x8347('0x14'));_0x7be020(_0x3bc91d['result']['message']);}})['catch'](function(_0x2462d3){logger[_0x8347('0x17')](_0x8347('0x13'),_0x3e7c9b,_0x2462d3);_0x4ea486(_0x2462d3);});});}exports[_0x8347('0x1a')]=function(_0x2dc079){var _0x8ee20=this;return new Promise(function(_0x173088,_0x290368){return db[_0x8347('0x1b')][_0x8347('0x1c')]({'raw':_0x2dc079[_0x8347('0x1d')]?_0x2dc079['options'][_0x8347('0x1e')]===undefined?!![]:![]:!![],'where':_0x2dc079['options']?_0x2dc079['options'][_0x8347('0x1f')]||null:null,'attributes':_0x2dc079[_0x8347('0x1d')]?_0x2dc079['options'][_0x8347('0x20')]||null:null,'limit':_0x2dc079[_0x8347('0x1d')]?_0x2dc079[_0x8347('0x1d')][_0x8347('0x21')]||null:null,'include':_0x2dc079['options']?_0x2dc079[_0x8347('0x1d')][_0x8347('0x22')]?_[_0x8347('0x23')](_0x2dc079[_0x8347('0x1d')][_0x8347('0x22')],function(_0xf60160){return{'model':db[_0xf60160['model']],'as':_0xf60160['as'],'attributes':_0xf60160[_0x8347('0x20')],'include':_0xf60160[_0x8347('0x22')]?_[_0x8347('0x23')](_0xf60160[_0x8347('0x22')],function(_0xd645a8){return{'model':db[_0xd645a8['model']],'as':_0xd645a8['as'],'attributes':_0xd645a8['attributes'],'include':_0xd645a8[_0x8347('0x22')]?_['map'](_0xd645a8[_0x8347('0x22')],function(_0x4dcbb5){return{'model':db[_0x4dcbb5[_0x8347('0x24')]],'as':_0x4dcbb5['as'],'attributes':_0x4dcbb5[_0x8347('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8347('0x11')](function(_0x4eb787){logger['info'](_0x8347('0x1a'),_0x2dc079);logger[_0x8347('0x15')](_0x8347('0x1a'),_0x2dc079,JSON[_0x8347('0x16')](_0x4eb787));_0x173088(_0x4eb787);})[_0x8347('0x25')](function(_0x51f5df){logger[_0x8347('0x17')](_0x8347('0x1a'),_0x51f5df['message'],_0x2dc079);_0x290368(_0x8ee20[_0x8347('0x17')](0x1f4,_0x51f5df['message']));});});};exports[_0x8347('0x26')]=function(_0x4cba46){var _0x4dc960=this;return new Promise(function(_0x16d85b,_0x42463c){return db[_0x8347('0x1b')]['find']({'raw':_0x4cba46[_0x8347('0x1d')]?_0x4cba46['options'][_0x8347('0x1e')]===undefined?!![]:![]:!![],'where':_0x4cba46[_0x8347('0x1d')]?_0x4cba46['options']['where']||null:null,'attributes':_0x4cba46[_0x8347('0x1d')]?_0x4cba46[_0x8347('0x1d')][_0x8347('0x20')]||null:null,'include':_0x4cba46[_0x8347('0x1d')]?_0x4cba46[_0x8347('0x1d')][_0x8347('0x22')]?_[_0x8347('0x23')](_0x4cba46[_0x8347('0x1d')][_0x8347('0x22')],function(_0x18c3e8){return{'model':db[_0x18c3e8[_0x8347('0x24')]],'as':_0x18c3e8['as'],'attributes':_0x18c3e8[_0x8347('0x20')],'include':_0x18c3e8['include']?_['map'](_0x18c3e8[_0x8347('0x22')],function(_0xf99401){return{'model':db[_0xf99401[_0x8347('0x24')]],'as':_0xf99401['as'],'attributes':_0xf99401[_0x8347('0x20')],'include':_0xf99401['include']?_[_0x8347('0x23')](_0xf99401['include'],function(_0x217ba4){return{'model':db[_0x217ba4[_0x8347('0x24')]],'as':_0x217ba4['as'],'attributes':_0x217ba4[_0x8347('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8347('0x11')](function(_0x148717){logger['info'](_0x8347('0x26'),_0x4cba46);logger['debug'](_0x8347('0x26'),_0x4cba46,JSON['stringify'](_0x148717));_0x16d85b(_0x148717);})[_0x8347('0x25')](function(_0x4d544c){logger[_0x8347('0x17')](_0x8347('0x26'),_0x4d544c[_0x8347('0x19')],_0x4cba46);_0x42463c(_0x4dc960[_0x8347('0x17')](0x1f4,_0x4d544c['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 2b0ea04..4e9b3f3 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 _0xe5eb=['update','emit','removeListener','length','openchannelQueue:','./openchannelQueue.events','save','remove'];(function(_0x23427b,_0x4b3a02){var _0x5f374d=function(_0x1cb9b3){while(--_0x1cb9b3){_0x23427b['push'](_0x23427b['shift']());}};_0x5f374d(++_0x4b3a02);}(_0xe5eb,0x16d));var _0xbe5e=function(_0x31d506,_0x9a80e9){_0x31d506=_0x31d506-0x0;var _0x498ac6=_0xe5eb[_0x31d506];return _0x498ac6;};'use strict';var OpenchannelQueueEvents=require(_0xbe5e('0x0'));var events=[_0xbe5e('0x1'),_0xbe5e('0x2'),_0xbe5e('0x3')];function createListener(_0x170aa6,_0x58ace4){return function(_0x37b9bd){_0x58ace4[_0xbe5e('0x4')](_0x170aa6,_0x37b9bd);};}function removeListener(_0x226a49,_0x2cbd5){return function(){OpenchannelQueueEvents[_0xbe5e('0x5')](_0x226a49,_0x2cbd5);};}exports['register']=function(_0x3435bd){for(var _0x3154e5=0x0,_0x3e2fb7=events[_0xbe5e('0x6')];_0x3154e5<_0x3e2fb7;_0x3154e5++){var _0x8f5e6e=events[_0x3154e5];var _0x29a9cc=createListener(_0xbe5e('0x7')+_0x8f5e6e,_0x3435bd);OpenchannelQueueEvents['on'](_0x8f5e6e,_0x29a9cc);}}; \ No newline at end of file +var _0x1819=['remove','update','emit','removeListener','register','save'];(function(_0xea58e,_0x20f00c){var _0x3d42c8=function(_0x458bbf){while(--_0x458bbf){_0xea58e['push'](_0xea58e['shift']());}};_0x3d42c8(++_0x20f00c);}(_0x1819,0x89));var _0x9181=function(_0x2a238a,_0x1d5054){_0x2a238a=_0x2a238a-0x0;var _0xeef802=_0x1819[_0x2a238a];return _0xeef802;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x9181('0x0'),_0x9181('0x1'),_0x9181('0x2')];function createListener(_0x25ad1,_0x2d5a00){return function(_0x281ca4){_0x2d5a00[_0x9181('0x3')](_0x25ad1,_0x281ca4);};}function removeListener(_0x3e25b4,_0x2548c0){return function(){OpenchannelQueueEvents[_0x9181('0x4')](_0x3e25b4,_0x2548c0);};}exports[_0x9181('0x5')]=function(_0x259c78){for(var _0x4ca0c4=0x0,_0x50f8f4=events['length'];_0x4ca0c4<_0x50f8f4;_0x4ca0c4++){var _0x3e567f=events[_0x4ca0c4];var _0x268f3d=createListener('openchannelQueue:'+_0x3e567f,_0x259c78);OpenchannelQueueEvents['on'](_0x3e567f,_0x268f3d);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 2f07ee2..3816280 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 _0x1d55=['create','put','update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x11b844,_0x11f86e){var _0x35ca4a=function(_0x5f08a0){while(--_0x5f08a0){_0x11b844['push'](_0x11b844['shift']());}};_0x35ca4a(++_0x11f86e);}(_0x1d55,0x1e7));var _0x51d5=function(_0x56fe98,_0x43dc16){_0x56fe98=_0x56fe98-0x0;var _0x212f4f=_0x1d55[_0x56fe98];return _0x212f4f;};'use strict';var multer=require(_0x51d5('0x0'));var util=require(_0x51d5('0x1'));var path=require(_0x51d5('0x2'));var timeout=require(_0x51d5('0x3'));var express=require(_0x51d5('0x4'));var router=express['Router']();var fs_extra=require(_0x51d5('0x5'));var auth=require(_0x51d5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x51d5('0x7'));var controller=require(_0x51d5('0x8'));router[_0x51d5('0x9')]('/',auth[_0x51d5('0xa')](),controller[_0x51d5('0xb')]);router[_0x51d5('0x9')](_0x51d5('0xc'),auth['isAuthenticated'](),controller[_0x51d5('0xd')]);router['get'](_0x51d5('0xe'),auth[_0x51d5('0xa')](),controller[_0x51d5('0xf')]);router[_0x51d5('0x10')]('/',auth[_0x51d5('0xa')](),controller[_0x51d5('0x11')]);router[_0x51d5('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x51d5('0x13')]);router[_0x51d5('0x14')](_0x51d5('0xe'),auth[_0x51d5('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe390=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer'];(function(_0x7bb313,_0x8464a8){var _0x37b206=function(_0x3a479b){while(--_0x3a479b){_0x7bb313['push'](_0x7bb313['shift']());}};_0x37b206(++_0x8464a8);}(_0xe390,0xa7));var _0x0e39=function(_0x3b138f,_0x2ed8a3){_0x3b138f=_0x3b138f-0x0;var _0x5ab50c=_0xe390[_0x3b138f];return _0x5ab50c;};'use strict';var multer=require(_0x0e39('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0e39('0x1'));var express=require(_0x0e39('0x2'));var router=express['Router']();var fs_extra=require(_0x0e39('0x3'));var auth=require(_0x0e39('0x4'));var interaction=require(_0x0e39('0x5'));var config=require(_0x0e39('0x6'));var controller=require(_0x0e39('0x7'));router[_0x0e39('0x8')]('/',auth[_0x0e39('0x9')](),controller[_0x0e39('0xa')]);router[_0x0e39('0x8')](_0x0e39('0xb'),auth[_0x0e39('0x9')](),controller[_0x0e39('0xc')]);router[_0x0e39('0x8')](_0x0e39('0xd'),auth[_0x0e39('0x9')](),controller[_0x0e39('0xe')]);router[_0x0e39('0xf')]('/',auth[_0x0e39('0x9')](),controller[_0x0e39('0x10')]);router[_0x0e39('0x11')](_0x0e39('0xd'),auth[_0x0e39('0x9')](),controller[_0x0e39('0x12')]);router[_0x0e39('0x13')](_0x0e39('0xd'),auth[_0x0e39('0x9')](),controller[_0x0e39('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index e9e2cb1..6c9d1a8 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 _0x950d=['moment','sequelize','exports','STRING','DATE'];(function(_0x5cc3d4,_0xbcbf9b){var _0x17ca31=function(_0x5dbd6d){while(--_0x5dbd6d){_0x5cc3d4['push'](_0x5cc3d4['shift']());}};_0x17ca31(++_0xbcbf9b);}(_0x950d,0x96));var _0xd950=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x950d[_0x4baae2];return _0x1a2285;};'use strict';var moment=require(_0xd950('0x0'));var Sequelize=require(_0xd950('0x1'));module[_0xd950('0x2')]={'uniqueid':{'type':Sequelize[_0xd950('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xd950('0x3')]},'joinAt':{'type':Sequelize[_0xd950('0x4')]},'leaveAt':{'type':Sequelize[_0xd950('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xd950('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x13e6=['sequelize','STRING','DATE','moment'];(function(_0x31b5a5,_0x44376a){var _0x364cc9=function(_0x4e5f95){while(--_0x4e5f95){_0x31b5a5['push'](_0x31b5a5['shift']());}};_0x364cc9(++_0x44376a);}(_0x13e6,0x1b3));var _0x613e=function(_0x5b837c,_0x15e695){_0x5b837c=_0x5b837c-0x0;var _0x4f5a24=_0x13e6[_0x5b837c];return _0x4f5a24;};'use strict';var moment=require(_0x613e('0x0'));var Sequelize=require(_0x613e('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x613e('0x2')]},'joinAt':{'type':Sequelize[_0x613e('0x3')]},'leaveAt':{'type':Sequelize[_0x613e('0x3')]},'acceptAt':{'type':Sequelize[_0x613e('0x3')]},'exitAt':{'type':Sequelize[_0x613e('0x3')]},'reason':{'type':Sequelize[_0x613e('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 70f0dce..268b9bd 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 _0x500b=['rawAttributes','length','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','index','OpenchannelQueueReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','pick','filter','where','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show'];(function(_0x196086,_0x4c9912){var _0x4980a4=function(_0x45af52){while(--_0x45af52){_0x196086['push'](_0x196086['shift']());}};_0x4980a4(++_0x4c9912);}(_0x500b,0x136));var _0xb500=function(_0xa1de8d,_0x1399a8){_0xa1de8d=_0xa1de8d-0x0;var _0x478b44=_0x500b[_0xa1de8d];return _0x478b44;};'use strict';var emlformat=require(_0xb500('0x0'));var rimraf=require(_0xb500('0x1'));var zipdir=require(_0xb500('0x2'));var jsonpatch=require(_0xb500('0x3'));var rp=require('request-promise');var moment=require(_0xb500('0x4'));var BPromise=require(_0xb500('0x5'));var Mustache=require(_0xb500('0x6'));var util=require('util');var path=require(_0xb500('0x7'));var sox=require(_0xb500('0x8'));var csv=require(_0xb500('0x9'));var ejs=require(_0xb500('0xa'));var fs=require('fs');var fs_extra=require(_0xb500('0xb'));var _=require(_0xb500('0xc'));var squel=require('squel');var crypto=require(_0xb500('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb500('0xe'));var toCsv=require(_0xb500('0x9'));var querystring=require('querystring');var Papa=require(_0xb500('0xf'));var Redis=require(_0xb500('0x10'));var authService=require(_0xb500('0x11'));var qs=require(_0xb500('0x12'));var as=require(_0xb500('0x13'));var hardwareService=require(_0xb500('0x14'));var logger=require(_0xb500('0x15'))(_0xb500('0x16'));var utils=require('../../config/utils');var config=require(_0xb500('0x17'));var licenseUtil=require(_0xb500('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ac59b,_0x2f7f2f){_0x2f7f2f=_0x2f7f2f||0xcc;return function(_0x16309f){if(_0x16309f){return _0x2ac59b[_0xb500('0x19')](_0x2f7f2f);}return _0x2ac59b['status'](_0x2f7f2f)[_0xb500('0x1a')]();};}function respondWithResult(_0x502512,_0x1b3cef){_0x1b3cef=_0x1b3cef||0xc8;return function(_0x286872){if(_0x286872){return _0x502512[_0xb500('0x1b')](_0x1b3cef)['json'](_0x286872);}};}function respondWithFilteredResult(_0x48fb7f,_0x1277f4){return function(_0x53bece){if(_0x53bece){var _0x51d474=typeof _0x1277f4[_0xb500('0x1c')]===_0xb500('0x1d')&&typeof _0x1277f4[_0xb500('0x1e')]==='undefined';var _0x39046a=_0x53bece[_0xb500('0x1f')];var _0x30f93c=_0x51d474?0x0:_0x1277f4[_0xb500('0x1c')];var _0x5c35bb=_0x51d474?_0x53bece[_0xb500('0x1f')]:_0x1277f4['offset']+_0x1277f4[_0xb500('0x1e')];var _0x3677d7;if(_0x5c35bb>=_0x39046a){_0x5c35bb=_0x39046a;_0x3677d7=0xc8;}else{_0x3677d7=0xce;}_0x48fb7f[_0xb500('0x1b')](_0x3677d7);return _0x48fb7f[_0xb500('0x20')](_0xb500('0x21'),_0x30f93c+'-'+_0x5c35bb+'/'+_0x39046a)[_0xb500('0x22')](_0x53bece);}return null;};}function patchUpdates(_0x1c81d4){return function(_0x41b871){try{jsonpatch[_0xb500('0x23')](_0x41b871,_0x1c81d4,!![]);}catch(_0x16498c){return BPromise[_0xb500('0x24')](_0x16498c);}return _0x41b871['save']();};}function saveUpdates(_0x30fc85,_0x50fbc6){return function(_0x492d59){if(_0x492d59){return _0x492d59[_0xb500('0x25')](_0x30fc85)[_0xb500('0x26')](function(_0x137681){return _0x137681;});}return null;};}function removeEntity(_0x39c112,_0x5515ae){return function(_0x43f992){if(_0x43f992){return _0x43f992[_0xb500('0x27')]()[_0xb500('0x26')](function(){_0x39c112[_0xb500('0x1b')](0xcc)[_0xb500('0x1a')]();});}};}function handleEntityNotFound(_0x484690,_0x6e52e){return function(_0x56103c){if(!_0x56103c){_0x484690[_0xb500('0x19')](0x194);}return _0x56103c;};}function handleError(_0x51c968,_0x47bee7){_0x47bee7=_0x47bee7||0x1f4;return function(_0x19d46c){logger['error'](_0x19d46c[_0xb500('0x28')]);if(_0x19d46c[_0xb500('0x29')]){delete _0x19d46c[_0xb500('0x29')];}_0x51c968['status'](_0x47bee7)[_0xb500('0x2a')](_0x19d46c);};}exports[_0xb500('0x2b')]=function(_0x5c923d,_0x3bc4a6){var _0x1ad9c0={},_0x4f4d05={},_0x20473d={'count':0x0,'rows':[]};var _0x8968b3=_['map'](db[_0xb500('0x2c')]['rawAttributes'],function(_0x441242){return{'name':_0x441242[_0xb500('0x2d')],'type':_0x441242[_0xb500('0x2e')][_0xb500('0x2f')]};});_0x4f4d05[_0xb500('0x30')]=_['map'](_0x8968b3,_0xb500('0x29'));_0x4f4d05[_0xb500('0x31')]=_[_0xb500('0x32')](_0x5c923d['query']);_0x4f4d05[_0xb500('0x33')]=_[_0xb500('0x34')](_0x4f4d05[_0xb500('0x30')],_0x4f4d05[_0xb500('0x31')]);_0x1ad9c0['attributes']=_[_0xb500('0x34')](_0x4f4d05[_0xb500('0x30')],qs[_0xb500('0x35')](_0x5c923d[_0xb500('0x31')]['fields']));_0x1ad9c0[_0xb500('0x36')]=_0x1ad9c0[_0xb500('0x36')]['length']?_0x1ad9c0[_0xb500('0x36')]:_0x4f4d05[_0xb500('0x30')];if(!_0x5c923d[_0xb500('0x31')][_0xb500('0x37')](_0xb500('0x38'))){_0x1ad9c0[_0xb500('0x1e')]=qs['limit'](_0x5c923d[_0xb500('0x31')][_0xb500('0x1e')]);_0x1ad9c0[_0xb500('0x1c')]=qs['offset'](_0x5c923d[_0xb500('0x31')][_0xb500('0x1c')]);}_0x1ad9c0['order']=qs['sort'](_0x5c923d[_0xb500('0x31')]['sort']);_0x1ad9c0['where']=qs[_0xb500('0x33')](_[_0xb500('0x39')](_0x5c923d['query'],_0x4f4d05['filters']),_0x8968b3);if(_0x5c923d[_0xb500('0x31')][_0xb500('0x3a')]){_0x1ad9c0[_0xb500('0x3b')]=_['merge'](_0x1ad9c0['where'],{'$or':_[_0xb500('0x3c')](_0x8968b3,function(_0x1ab570){if(_0x1ab570[_0xb500('0x2e')]!==_0xb500('0x3d')){var _0x25c3f6={};_0x25c3f6[_0x1ab570[_0xb500('0x29')]]={'$like':'%'+_0x5c923d['query'][_0xb500('0x3a')]+'%'};return _0x25c3f6;}})});}_0x1ad9c0=_[_0xb500('0x3e')]({},_0x1ad9c0,_0x5c923d[_0xb500('0x3f')]);var _0x313125={'where':_0x1ad9c0[_0xb500('0x3b')]};return db[_0xb500('0x2c')][_0xb500('0x1f')](_0x313125)['then'](function(_0x41be09){_0x20473d['count']=_0x41be09;if(_0x5c923d['query'][_0xb500('0x40')]){_0x1ad9c0[_0xb500('0x41')]=[{'all':!![]}];}return db[_0xb500('0x2c')][_0xb500('0x42')](_0x1ad9c0);})['then'](function(_0x1bd736){_0x20473d[_0xb500('0x43')]=_0x1bd736;return _0x20473d;})[_0xb500('0x26')](respondWithFilteredResult(_0x3bc4a6,_0x1ad9c0))[_0xb500('0x44')](handleError(_0x3bc4a6,null));};exports[_0xb500('0x45')]=function(_0x503709,_0x252448){var _0x131a24={'raw':!![],'where':{'id':_0x503709['params']['id']}},_0x394a27={};_0x394a27[_0xb500('0x30')]=_[_0xb500('0x32')](db['OpenchannelQueueReport'][_0xb500('0x46')]);_0x394a27[_0xb500('0x31')]=_['keys'](_0x503709[_0xb500('0x31')]);_0x394a27['filters']=_[_0xb500('0x34')](_0x394a27[_0xb500('0x30')],_0x394a27[_0xb500('0x31')]);_0x131a24[_0xb500('0x36')]=_[_0xb500('0x34')](_0x394a27[_0xb500('0x30')],qs[_0xb500('0x35')](_0x503709[_0xb500('0x31')][_0xb500('0x35')]));_0x131a24[_0xb500('0x36')]=_0x131a24[_0xb500('0x36')][_0xb500('0x47')]?_0x131a24[_0xb500('0x36')]:_0x394a27[_0xb500('0x30')];if(_0x503709['query']['includeAll']){_0x131a24['include']=[{'all':!![]}];}_0x131a24=_['merge']({},_0x131a24,_0x503709['options']);return db['OpenchannelQueueReport'][_0xb500('0x48')](_0x131a24)[_0xb500('0x26')](handleEntityNotFound(_0x252448,null))[_0xb500('0x26')](respondWithResult(_0x252448,null))[_0xb500('0x44')](handleError(_0x252448,null));};exports['create']=function(_0x18c4d4,_0x54abf1){return db[_0xb500('0x2c')]['create'](_0x18c4d4[_0xb500('0x49')],{})[_0xb500('0x26')](respondWithResult(_0x54abf1,0xc9))['catch'](handleError(_0x54abf1,null));};exports['update']=function(_0x45c9d6,_0x548e39){if(_0x45c9d6[_0xb500('0x49')]['id']){delete _0x45c9d6['body']['id'];}return db[_0xb500('0x2c')][_0xb500('0x48')]({'where':{'id':_0x45c9d6['params']['id']}})[_0xb500('0x26')](handleEntityNotFound(_0x548e39,null))[_0xb500('0x26')](saveUpdates(_0x45c9d6[_0xb500('0x49')],null))[_0xb500('0x26')](respondWithResult(_0x548e39,null))[_0xb500('0x44')](handleError(_0x548e39,null));};exports[_0xb500('0x27')]=function(_0x390c48,_0x29307c){return db['OpenchannelQueueReport'][_0xb500('0x48')]({'where':{'id':_0x390c48[_0xb500('0x4a')]['id']}})[_0xb500('0x26')](handleEntityNotFound(_0x29307c,null))['then'](removeEntity(_0x29307c,null))[_0xb500('0x44')](handleError(_0x29307c,null));};exports[_0xb500('0x4b')]=function(_0x59bbee,_0x51b6cc){return db['OpenchannelQueueReport'][_0xb500('0x4b')]()[_0xb500('0x26')](respondWithResult(_0x51b6cc,null))[_0xb500('0x44')](handleError(_0x51b6cc,null));}; \ No newline at end of file +var _0x7768=['stack','name','send','index','map','OpenchannelQueueReport','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','limit','count','offset','set','Content-Range','apply','reject','destroy','then','end'];(function(_0xe2f6e9,_0x5622fb){var _0xd0a55d=function(_0x396e31){while(--_0x396e31){_0xe2f6e9['push'](_0xe2f6e9['shift']());}};_0xd0a55d(++_0x5622fb);}(_0x7768,0x103));var _0x8776=function(_0x145e8a,_0x49a5d3){_0x145e8a=_0x145e8a-0x0;var _0x57e4ab=_0x7768[_0x145e8a];return _0x57e4ab;};'use strict';var emlformat=require(_0x8776('0x0'));var rimraf=require(_0x8776('0x1'));var zipdir=require(_0x8776('0x2'));var jsonpatch=require(_0x8776('0x3'));var rp=require(_0x8776('0x4'));var moment=require(_0x8776('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8776('0x6'));var util=require(_0x8776('0x7'));var path=require(_0x8776('0x8'));var sox=require(_0x8776('0x9'));var csv=require(_0x8776('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8776('0xb'));var _=require(_0x8776('0xc'));var squel=require(_0x8776('0xd'));var crypto=require(_0x8776('0xe'));var jsforce=require(_0x8776('0xf'));var deskjs=require(_0x8776('0x10'));var toCsv=require(_0x8776('0xa'));var querystring=require('querystring');var Papa=require(_0x8776('0x11'));var Redis=require(_0x8776('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8776('0x13'));var as=require(_0x8776('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8776('0x15'));var utils=require(_0x8776('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8776('0x17'));var db=require(_0x8776('0x18'))['db'];function respondWithStatusCode(_0x16ea16,_0xbf30c0){_0xbf30c0=_0xbf30c0||0xcc;return function(_0x30a2f4){if(_0x30a2f4){return _0x16ea16[_0x8776('0x19')](_0xbf30c0);}return _0x16ea16[_0x8776('0x1a')](_0xbf30c0)['end']();};}function respondWithResult(_0x108fe1,_0x5a9f8f){_0x5a9f8f=_0x5a9f8f||0xc8;return function(_0x286c66){if(_0x286c66){return _0x108fe1['status'](_0x5a9f8f)['json'](_0x286c66);}};}function respondWithFilteredResult(_0x2c37e7,_0x4c4086){return function(_0x1f6272){if(_0x1f6272){var _0x251647=typeof _0x4c4086['offset']==='undefined'&&typeof _0x4c4086[_0x8776('0x1b')]==='undefined';var _0x4a9d0b=_0x1f6272[_0x8776('0x1c')];var _0x4b30b9=_0x251647?0x0:_0x4c4086[_0x8776('0x1d')];var _0x26b7e4=_0x251647?_0x1f6272[_0x8776('0x1c')]:_0x4c4086[_0x8776('0x1d')]+_0x4c4086['limit'];var _0x220025;if(_0x26b7e4>=_0x4a9d0b){_0x26b7e4=_0x4a9d0b;_0x220025=0xc8;}else{_0x220025=0xce;}_0x2c37e7[_0x8776('0x1a')](_0x220025);return _0x2c37e7[_0x8776('0x1e')](_0x8776('0x1f'),_0x4b30b9+'-'+_0x26b7e4+'/'+_0x4a9d0b)['json'](_0x1f6272);}return null;};}function patchUpdates(_0x119ee4){return function(_0x3dd83e){try{jsonpatch[_0x8776('0x20')](_0x3dd83e,_0x119ee4,!![]);}catch(_0x3fa5f5){return BPromise[_0x8776('0x21')](_0x3fa5f5);}return _0x3dd83e['save']();};}function saveUpdates(_0x410a6f,_0x1bc5ee){return function(_0x996e2f){if(_0x996e2f){return _0x996e2f['update'](_0x410a6f)['then'](function(_0x4900e7){return _0x4900e7;});}return null;};}function removeEntity(_0x8e7f97,_0x24727f){return function(_0x177139){if(_0x177139){return _0x177139[_0x8776('0x22')]()[_0x8776('0x23')](function(){_0x8e7f97[_0x8776('0x1a')](0xcc)[_0x8776('0x24')]();});}};}function handleEntityNotFound(_0x4f54c1,_0x1f897a){return function(_0xa62a30){if(!_0xa62a30){_0x4f54c1[_0x8776('0x19')](0x194);}return _0xa62a30;};}function handleError(_0x45c42e,_0x5267e5){_0x5267e5=_0x5267e5||0x1f4;return function(_0x2311c3){logger['error'](_0x2311c3[_0x8776('0x25')]);if(_0x2311c3[_0x8776('0x26')]){delete _0x2311c3[_0x8776('0x26')];}_0x45c42e[_0x8776('0x1a')](_0x5267e5)[_0x8776('0x27')](_0x2311c3);};}exports[_0x8776('0x28')]=function(_0x559be5,_0x14407e){var _0x417172={},_0xbef38b={},_0x3bb410={'count':0x0,'rows':[]};var _0x3b5ea6=_[_0x8776('0x29')](db[_0x8776('0x2a')]['rawAttributes'],function(_0xe0109e){return{'name':_0xe0109e[_0x8776('0x2b')],'type':_0xe0109e['type'][_0x8776('0x2c')]};});_0xbef38b[_0x8776('0x2d')]=_[_0x8776('0x29')](_0x3b5ea6,'name');_0xbef38b[_0x8776('0x2e')]=_[_0x8776('0x2f')](_0x559be5[_0x8776('0x2e')]);_0xbef38b[_0x8776('0x30')]=_['intersection'](_0xbef38b[_0x8776('0x2d')],_0xbef38b[_0x8776('0x2e')]);_0x417172[_0x8776('0x31')]=_[_0x8776('0x32')](_0xbef38b['model'],qs[_0x8776('0x33')](_0x559be5[_0x8776('0x2e')]['fields']));_0x417172[_0x8776('0x31')]=_0x417172[_0x8776('0x31')][_0x8776('0x34')]?_0x417172[_0x8776('0x31')]:_0xbef38b[_0x8776('0x2d')];if(!_0x559be5[_0x8776('0x2e')][_0x8776('0x35')](_0x8776('0x36'))){_0x417172[_0x8776('0x1b')]=qs[_0x8776('0x1b')](_0x559be5[_0x8776('0x2e')][_0x8776('0x1b')]);_0x417172[_0x8776('0x1d')]=qs[_0x8776('0x1d')](_0x559be5[_0x8776('0x2e')][_0x8776('0x1d')]);}_0x417172['order']=qs[_0x8776('0x37')](_0x559be5['query']['sort']);_0x417172[_0x8776('0x38')]=qs[_0x8776('0x30')](_[_0x8776('0x39')](_0x559be5[_0x8776('0x2e')],_0xbef38b[_0x8776('0x30')]),_0x3b5ea6);if(_0x559be5['query'][_0x8776('0x3a')]){_0x417172[_0x8776('0x38')]=_['merge'](_0x417172[_0x8776('0x38')],{'$or':_[_0x8776('0x29')](_0x3b5ea6,function(_0x28dce5){if(_0x28dce5['type']!==_0x8776('0x3b')){var _0xb9f821={};_0xb9f821[_0x28dce5[_0x8776('0x26')]]={'$like':'%'+_0x559be5[_0x8776('0x2e')][_0x8776('0x3a')]+'%'};return _0xb9f821;}})});}_0x417172=_[_0x8776('0x3c')]({},_0x417172,_0x559be5[_0x8776('0x3d')]);var _0x50cdee={'where':_0x417172[_0x8776('0x38')]};return db[_0x8776('0x2a')]['count'](_0x50cdee)['then'](function(_0x214e7c){_0x3bb410[_0x8776('0x1c')]=_0x214e7c;if(_0x559be5['query'][_0x8776('0x3e')]){_0x417172['include']=[{'all':!![]}];}return db[_0x8776('0x2a')][_0x8776('0x3f')](_0x417172);})[_0x8776('0x23')](function(_0x4eb3a9){_0x3bb410[_0x8776('0x40')]=_0x4eb3a9;return _0x3bb410;})[_0x8776('0x23')](respondWithFilteredResult(_0x14407e,_0x417172))[_0x8776('0x41')](handleError(_0x14407e,null));};exports[_0x8776('0x42')]=function(_0x5b0e94,_0x3a86ae){var _0x50ad7f={'raw':!![],'where':{'id':_0x5b0e94[_0x8776('0x43')]['id']}},_0x45b419={};_0x45b419[_0x8776('0x2d')]=_['keys'](db[_0x8776('0x2a')][_0x8776('0x44')]);_0x45b419['query']=_[_0x8776('0x2f')](_0x5b0e94[_0x8776('0x2e')]);_0x45b419[_0x8776('0x30')]=_[_0x8776('0x32')](_0x45b419['model'],_0x45b419['query']);_0x50ad7f['attributes']=_[_0x8776('0x32')](_0x45b419['model'],qs[_0x8776('0x33')](_0x5b0e94[_0x8776('0x2e')][_0x8776('0x33')]));_0x50ad7f[_0x8776('0x31')]=_0x50ad7f[_0x8776('0x31')][_0x8776('0x34')]?_0x50ad7f['attributes']:_0x45b419['model'];if(_0x5b0e94[_0x8776('0x2e')]['includeAll']){_0x50ad7f[_0x8776('0x45')]=[{'all':!![]}];}_0x50ad7f=_[_0x8776('0x3c')]({},_0x50ad7f,_0x5b0e94[_0x8776('0x3d')]);return db['OpenchannelQueueReport'][_0x8776('0x46')](_0x50ad7f)['then'](handleEntityNotFound(_0x3a86ae,null))['then'](respondWithResult(_0x3a86ae,null))[_0x8776('0x41')](handleError(_0x3a86ae,null));};exports[_0x8776('0x47')]=function(_0x488c88,_0x3b2073){return db[_0x8776('0x2a')]['create'](_0x488c88[_0x8776('0x48')],{})[_0x8776('0x23')](respondWithResult(_0x3b2073,0xc9))['catch'](handleError(_0x3b2073,null));};exports['update']=function(_0x33880c,_0x2da42d){if(_0x33880c[_0x8776('0x48')]['id']){delete _0x33880c[_0x8776('0x48')]['id'];}return db[_0x8776('0x2a')][_0x8776('0x46')]({'where':{'id':_0x33880c['params']['id']}})[_0x8776('0x23')](handleEntityNotFound(_0x2da42d,null))['then'](saveUpdates(_0x33880c[_0x8776('0x48')],null))[_0x8776('0x23')](respondWithResult(_0x2da42d,null))[_0x8776('0x41')](handleError(_0x2da42d,null));};exports[_0x8776('0x22')]=function(_0x5e2ea7,_0x4ac643){return db['OpenchannelQueueReport'][_0x8776('0x46')]({'where':{'id':_0x5e2ea7[_0x8776('0x43')]['id']}})[_0x8776('0x23')](handleEntityNotFound(_0x4ac643,null))[_0x8776('0x23')](removeEntity(_0x4ac643,null))[_0x8776('0x41')](handleError(_0x4ac643,null));};exports[_0x8776('0x49')]=function(_0x3ef10e,_0x715331){return db[_0x8776('0x2a')][_0x8776('0x49')]()['then'](respondWithResult(_0x715331,null))[_0x8776('0x41')](handleError(_0x715331,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 01c4569..f9b7fb7 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x1251a6,_0x5c0bea){var _0x2a324a=function(_0x5689f4){while(--_0x5689f4){_0x1251a6['push'](_0x1251a6['shift']());}};_0x2a324a(++_0x5c0bea);}(_0x1261,0x144));var _0x1126=function(_0x2f1ac4,_0x236a72){_0x2f1ac4=_0x2f1ac4-0x0;var _0x18e1a5=_0x1261[_0x2f1ac4];return _0x18e1a5;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x27579a,_0x9183cc){var _0x2ea277=function(_0x201f68){while(--_0x201f68){_0x27579a['push'](_0x27579a['shift']());}};_0x2ea277(++_0x9183cc);}(_0x1261,0x144));var _0x1126=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0x1261[_0x59befa];return _0x1dd63d;};'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 6f598ea..7045cdb 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 _0x793b=['debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','stringify','UpdateOpenchannelQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x793b,0x189));var _0xb793=function(_0xca811f,_0x3531ad){_0xca811f=_0xca811f-0x0;var _0x4939b8=_0x793b[_0xca811f];return _0x4939b8;};'use strict';var _=require(_0xb793('0x0'));var util=require(_0xb793('0x1'));var moment=require(_0xb793('0x2'));var BPromise=require(_0xb793('0x3'));var rs=require(_0xb793('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb793('0x5'))['db'];var utils=require(_0xb793('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xb793('0x7'));var jayson=require(_0xb793('0x8'));var client=jayson[_0xb793('0x9')][_0xb793('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39f110,_0x42d0c7,_0x134ac4){return new BPromise(function(_0x23a718,_0x149720){return client[_0xb793('0xb')](_0x39f110,_0x134ac4)[_0xb793('0xc')](function(_0x22c9ea){logger[_0xb793('0xd')](_0xb793('0xe'),_0x42d0c7,'request\x20sent');logger[_0xb793('0xf')](_0xb793('0x10'),_0x42d0c7,'request\x20sent',JSON['stringify'](_0x22c9ea));if(_0x22c9ea[_0xb793('0x11')]){if(_0x22c9ea[_0xb793('0x11')]['code']===0x1f4){logger[_0xb793('0x11')](_0xb793('0xe'),_0x42d0c7,_0x22c9ea['error'][_0xb793('0x12')]);return _0x149720(_0x22c9ea[_0xb793('0x11')][_0xb793('0x12')]);}logger[_0xb793('0x11')](_0xb793('0xe'),_0x42d0c7,_0x22c9ea[_0xb793('0x11')][_0xb793('0x12')]);return _0x23a718(_0x22c9ea['error'][_0xb793('0x12')]);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x42d0c7,_0xb793('0x13'));_0x23a718(_0x22c9ea[_0xb793('0x14')][_0xb793('0x12')]);}})[_0xb793('0x15')](function(_0x38d9f2){logger[_0xb793('0x11')](_0xb793('0xe'),_0x42d0c7,_0x38d9f2);_0x149720(_0x38d9f2);});});}exports[_0xb793('0x16')]=function(_0x977026){var _0x2914a2=this;return new Promise(function(_0x2c9e87,_0x101162){return db[_0xb793('0x17')][_0xb793('0x18')](_0x977026[_0xb793('0x19')],{'raw':_0x977026[_0xb793('0x1a')]?_0x977026['options'][_0xb793('0x1b')]===undefined?!![]:![]:!![]})[_0xb793('0xc')](function(_0x54bfd4){logger[_0xb793('0xd')](_0xb793('0x16'),_0x977026);logger[_0xb793('0xf')](_0xb793('0x16'),_0x977026,JSON[_0xb793('0x1c')](_0x54bfd4));_0x2c9e87(_0x54bfd4);})['catch'](function(_0x5ecf9c){logger[_0xb793('0x11')](_0xb793('0x16'),_0x5ecf9c[_0xb793('0x12')],_0x977026);_0x101162(_0x2914a2[_0xb793('0x11')](0x1f4,_0x5ecf9c[_0xb793('0x12')]));});});};exports[_0xb793('0x1d')]=function(_0x4d4544){var _0x1e470c=this;return new Promise(function(_0x503d69,_0x10947e){return db[_0xb793('0x17')][_0xb793('0x1e')](_0x4d4544[_0xb793('0x19')],{'raw':_0x4d4544[_0xb793('0x1a')]?_0x4d4544[_0xb793('0x1a')][_0xb793('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d4544['options']?_0x4d4544[_0xb793('0x1a')][_0xb793('0x1f')]||null:null,'attributes':_0x4d4544[_0xb793('0x1a')]?_0x4d4544[_0xb793('0x1a')][_0xb793('0x20')]||null:null,'limit':_0x4d4544[_0xb793('0x1a')]?_0x4d4544['options'][_0xb793('0x21')]||null:null})[_0xb793('0xc')](function(_0x107d78){logger['info'](_0xb793('0x1d'),_0x4d4544);logger[_0xb793('0xf')](_0xb793('0x1d'),_0x4d4544,JSON[_0xb793('0x1c')](_0x107d78));_0x503d69(_0x107d78);})['catch'](function(_0x493a8c){logger[_0xb793('0x11')]('UpdateOpenchannelQueueReport',_0x493a8c['message'],_0x4d4544);_0x10947e(_0x1e470c[_0xb793('0x11')](0x1f4,_0x493a8c[_0xb793('0x12')]));});});}; \ No newline at end of file +var _0xef0f=['OpenchannelQueueReport','create','options','raw','UpdateOpenchannelQueueReport','update','body','where','attributes','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xef0f,0x168));var _0xfef0=function(_0x3569fc,_0x2d533e){_0x3569fc=_0x3569fc-0x0;var _0x43b468=_0xef0f[_0x3569fc];return _0x43b468;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var moment=require(_0xfef0('0x1'));var BPromise=require(_0xfef0('0x2'));var rs=require(_0xfef0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfef0('0x4'))['db'];var utils=require(_0xfef0('0x5'));var logger=require(_0xfef0('0x6'))('rpc');var config=require(_0xfef0('0x7'));var jayson=require(_0xfef0('0x8'));var client=jayson[_0xfef0('0x9')][_0xfef0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xad43e,_0x11dfd7,_0x5130bd){return new BPromise(function(_0x41ec94,_0x58cf6d){return client[_0xfef0('0xb')](_0xad43e,_0x5130bd)[_0xfef0('0xc')](function(_0x3a81cc){logger[_0xfef0('0xd')](_0xfef0('0xe'),_0x11dfd7,_0xfef0('0xf'));logger[_0xfef0('0x10')](_0xfef0('0x11'),_0x11dfd7,_0xfef0('0xf'),JSON[_0xfef0('0x12')](_0x3a81cc));if(_0x3a81cc[_0xfef0('0x13')]){if(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x14')]===0x1f4){logger[_0xfef0('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x11dfd7,_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);return _0x58cf6d(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);}logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x3a81cc[_0xfef0('0x13')]['message']);return _0x41ec94(_0x3a81cc[_0xfef0('0x13')]['message']);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x11dfd7,_0xfef0('0xf'));_0x41ec94(_0x3a81cc[_0xfef0('0x16')][_0xfef0('0x15')]);}})[_0xfef0('0x17')](function(_0x2a96d9){logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x2a96d9);_0x58cf6d(_0x2a96d9);});});}exports[_0xfef0('0x18')]=function(_0x581459){var _0xd60678=this;return new Promise(function(_0x1642cd,_0x1577fa){return db[_0xfef0('0x19')][_0xfef0('0x1a')](_0x581459['body'],{'raw':_0x581459[_0xfef0('0x1b')]?_0x581459['options'][_0xfef0('0x1c')]===undefined?!![]:![]:!![]})[_0xfef0('0xc')](function(_0x28dee1){logger['info'](_0xfef0('0x18'),_0x581459);logger['debug'](_0xfef0('0x18'),_0x581459,JSON[_0xfef0('0x12')](_0x28dee1));_0x1642cd(_0x28dee1);})['catch'](function(_0x4897af){logger['error'](_0xfef0('0x18'),_0x4897af['message'],_0x581459);_0x1577fa(_0xd60678[_0xfef0('0x13')](0x1f4,_0x4897af[_0xfef0('0x15')]));});});};exports[_0xfef0('0x1d')]=function(_0x4483f2){var _0x249fe4=this;return new Promise(function(_0xd687ed,_0x5c9085){return db['OpenchannelQueueReport'][_0xfef0('0x1e')](_0x4483f2[_0xfef0('0x1f')],{'raw':_0x4483f2[_0xfef0('0x1b')]?_0x4483f2[_0xfef0('0x1b')][_0xfef0('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4483f2[_0xfef0('0x1b')]?_0x4483f2[_0xfef0('0x1b')][_0xfef0('0x20')]||null:null,'attributes':_0x4483f2[_0xfef0('0x1b')]?_0x4483f2['options'][_0xfef0('0x21')]||null:null,'limit':_0x4483f2[_0xfef0('0x1b')]?_0x4483f2[_0xfef0('0x1b')][_0xfef0('0x22')]||null:null})[_0xfef0('0xc')](function(_0x1ac4a3){logger[_0xfef0('0xd')](_0xfef0('0x1d'),_0x4483f2);logger[_0xfef0('0x10')](_0xfef0('0x1d'),_0x4483f2,JSON[_0xfef0('0x12')](_0x1ac4a3));_0xd687ed(_0x1ac4a3);})[_0xfef0('0x17')](function(_0x51af0f){logger[_0xfef0('0x13')]('UpdateOpenchannelQueueReport',_0x51af0f['message'],_0x4483f2);_0x5c9085(_0x249fe4[_0xfef0('0x13')](0x1f4,_0x51af0f[_0xfef0('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index af758d2..cf219ad 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 _0xf138=['../../components/auth/service','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','index','/describe','describe','get','/:id','create','put','destroy','exports','util','Router','fs-extra'];(function(_0x39398f,_0x147c1c){var _0x130f31=function(_0x121e89){while(--_0x121e89){_0x39398f['push'](_0x39398f['shift']());}};_0x130f31(++_0x147c1c);}(_0xf138,0x1cd));var _0x8f13=function(_0x201270,_0x473c0d){_0x201270=_0x201270-0x0;var _0x7981c8=_0xf138[_0x201270];return _0x7981c8;};'use strict';var multer=require('multer');var util=require(_0x8f13('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8f13('0x1')]();var fs_extra=require(_0x8f13('0x2'));var auth=require(_0x8f13('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8f13('0x4'));var controller=require(_0x8f13('0x5'));router['get']('/',auth[_0x8f13('0x6')](),controller[_0x8f13('0x7')]);router['get'](_0x8f13('0x8'),auth['isAuthenticated'](),controller[_0x8f13('0x9')]);router[_0x8f13('0xa')](_0x8f13('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x8f13('0xc')]);router[_0x8f13('0xd')](_0x8f13('0xb'),auth[_0x8f13('0x6')](),controller['update']);router['delete']('/:id',auth[_0x8f13('0x6')](),controller[_0x8f13('0xe')]);module[_0x8f13('0xf')]=router; \ No newline at end of file +var _0xc0cc=['isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelTransferReport.controller'];(function(_0x219d51,_0x51d87f){var _0x54254e=function(_0x4cb999){while(--_0x4cb999){_0x219d51['push'](_0x219d51['shift']());}};_0x54254e(++_0x51d87f);}(_0xc0cc,0x1c3));var _0xcc0c=function(_0x249b63,_0x1d7515){_0x249b63=_0x249b63-0x0;var _0x3b8209=_0xc0cc[_0x249b63];return _0x3b8209;};'use strict';var multer=require(_0xcc0c('0x0'));var util=require(_0xcc0c('0x1'));var path=require(_0xcc0c('0x2'));var timeout=require(_0xcc0c('0x3'));var express=require('express');var router=express[_0xcc0c('0x4')]();var fs_extra=require(_0xcc0c('0x5'));var auth=require(_0xcc0c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcc0c('0x7'));var controller=require(_0xcc0c('0x8'));router['get']('/',auth[_0xcc0c('0x9')](),controller[_0xcc0c('0xa')]);router[_0xcc0c('0xb')](_0xcc0c('0xc'),auth[_0xcc0c('0x9')](),controller[_0xcc0c('0xd')]);router[_0xcc0c('0xb')](_0xcc0c('0xe'),auth[_0xcc0c('0x9')](),controller[_0xcc0c('0xf')]);router[_0xcc0c('0x10')]('/',auth[_0xcc0c('0x9')](),controller[_0xcc0c('0x11')]);router[_0xcc0c('0x12')](_0xcc0c('0xe'),auth[_0xcc0c('0x9')](),controller[_0xcc0c('0x13')]);router[_0xcc0c('0x14')](_0xcc0c('0xe'),auth[_0xcc0c('0x9')](),controller[_0xcc0c('0x15')]);module[_0xcc0c('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index b6a18f9..bacd1fd 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x3563ec,_0x4df6c1){var _0x290a97=function(_0x44b1ec){while(--_0x44b1ec){_0x3563ec['push'](_0x3563ec['shift']());}};_0x290a97(++_0x4df6c1);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x2fff83,_0x29d5fe){_0x2fff83=_0x2fff83-0x0;var _0xa2a722=_0xf3cd[_0x2fff83];return _0xa2a722;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x1c870a,_0x5a68ec){var _0x2b315a=function(_0x455ef6){while(--_0x455ef6){_0x1c870a['push'](_0x1c870a['shift']());}};_0x2b315a(++_0x5a68ec);}(_0xe706,0xa3));var _0x6e70=function(_0x5bb1e9,_0x15f025){_0x5bb1e9=_0x5bb1e9-0x0;var _0x262c24=_0xe706[_0x5bb1e9];return _0x262c24;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index c7ea0ec..293bc99 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 _0xf503=['to-csv','ejs','fs-extra','lodash','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','name','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','where','merge','filter','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf503,0xce));var _0x3f50=function(_0x58e2a5,_0x4e822c){_0x58e2a5=_0x58e2a5-0x0;var _0x440ba0=_0xf503[_0x58e2a5];return _0x440ba0;};'use strict';var emlformat=require(_0x3f50('0x0'));var rimraf=require(_0x3f50('0x1'));var zipdir=require(_0x3f50('0x2'));var jsonpatch=require(_0x3f50('0x3'));var rp=require(_0x3f50('0x4'));var moment=require(_0x3f50('0x5'));var BPromise=require(_0x3f50('0x6'));var Mustache=require(_0x3f50('0x7'));var util=require(_0x3f50('0x8'));var path=require(_0x3f50('0x9'));var sox=require('sox');var csv=require(_0x3f50('0xa'));var ejs=require(_0x3f50('0xb'));var fs=require('fs');var fs_extra=require(_0x3f50('0xc'));var _=require(_0x3f50('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3f50('0xa'));var querystring=require(_0x3f50('0xe'));var Papa=require(_0x3f50('0xf'));var Redis=require('ioredis');var authService=require(_0x3f50('0x10'));var qs=require(_0x3f50('0x11'));var as=require(_0x3f50('0x12'));var hardwareService=require(_0x3f50('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x3f50('0x14'));var config=require(_0x3f50('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3f50('0x16'))['db'];function respondWithStatusCode(_0x1c24b5,_0x514251){_0x514251=_0x514251||0xcc;return function(_0x1290a9){if(_0x1290a9){return _0x1c24b5[_0x3f50('0x17')](_0x514251);}return _0x1c24b5[_0x3f50('0x18')](_0x514251)[_0x3f50('0x19')]();};}function respondWithResult(_0x5a6553,_0x133a22){_0x133a22=_0x133a22||0xc8;return function(_0x492ac4){if(_0x492ac4){return _0x5a6553[_0x3f50('0x18')](_0x133a22)[_0x3f50('0x1a')](_0x492ac4);}};}function respondWithFilteredResult(_0x5c1557,_0x28afec){return function(_0x4e01f6){if(_0x4e01f6){var _0x312126=typeof _0x28afec[_0x3f50('0x1b')]===_0x3f50('0x1c')&&typeof _0x28afec['limit']===_0x3f50('0x1c');var _0x3d4a2c=_0x4e01f6['count'];var _0x282368=_0x312126?0x0:_0x28afec[_0x3f50('0x1b')];var _0x1b7a37=_0x312126?_0x4e01f6[_0x3f50('0x1d')]:_0x28afec[_0x3f50('0x1b')]+_0x28afec[_0x3f50('0x1e')];var _0x469ef5;if(_0x1b7a37>=_0x3d4a2c){_0x1b7a37=_0x3d4a2c;_0x469ef5=0xc8;}else{_0x469ef5=0xce;}_0x5c1557[_0x3f50('0x18')](_0x469ef5);return _0x5c1557[_0x3f50('0x1f')]('Content-Range',_0x282368+'-'+_0x1b7a37+'/'+_0x3d4a2c)[_0x3f50('0x1a')](_0x4e01f6);}return null;};}function patchUpdates(_0x245458){return function(_0x5e5eaf){try{jsonpatch[_0x3f50('0x20')](_0x5e5eaf,_0x245458,!![]);}catch(_0x22d1c6){return BPromise[_0x3f50('0x21')](_0x22d1c6);}return _0x5e5eaf[_0x3f50('0x22')]();};}function saveUpdates(_0x3a26d6,_0x3a1263){return function(_0x199774){if(_0x199774){return _0x199774[_0x3f50('0x23')](_0x3a26d6)[_0x3f50('0x24')](function(_0x2c8d42){return _0x2c8d42;});}return null;};}function removeEntity(_0x17431b,_0x53e001){return function(_0x12233e){if(_0x12233e){return _0x12233e[_0x3f50('0x25')]()[_0x3f50('0x24')](function(){_0x17431b['status'](0xcc)[_0x3f50('0x19')]();});}};}function handleEntityNotFound(_0x52f2c0,_0x1cc25e){return function(_0x5000d6){if(!_0x5000d6){_0x52f2c0[_0x3f50('0x17')](0x194);}return _0x5000d6;};}function handleError(_0x101858,_0x4e75ad){_0x4e75ad=_0x4e75ad||0x1f4;return function(_0x1f1369){logger[_0x3f50('0x26')](_0x1f1369['stack']);if(_0x1f1369['name']){delete _0x1f1369[_0x3f50('0x27')];}_0x101858[_0x3f50('0x18')](_0x4e75ad)['send'](_0x1f1369);};}exports[_0x3f50('0x28')]=function(_0x20dce1,_0x31672b){var _0x78783d={},_0x57dbfb={},_0x126736={'count':0x0,'rows':[]};var _0x163f0a=_[_0x3f50('0x29')](db[_0x3f50('0x2a')][_0x3f50('0x2b')],function(_0x3f1727){return{'name':_0x3f1727[_0x3f50('0x2c')],'type':_0x3f1727[_0x3f50('0x2d')]['key']};});_0x57dbfb[_0x3f50('0x2e')]=_['map'](_0x163f0a,_0x3f50('0x27'));_0x57dbfb[_0x3f50('0x2f')]=_[_0x3f50('0x30')](_0x20dce1[_0x3f50('0x2f')]);_0x57dbfb[_0x3f50('0x31')]=_[_0x3f50('0x32')](_0x57dbfb[_0x3f50('0x2e')],_0x57dbfb['query']);_0x78783d[_0x3f50('0x33')]=_['intersection'](_0x57dbfb['model'],qs['fields'](_0x20dce1[_0x3f50('0x2f')][_0x3f50('0x34')]));_0x78783d[_0x3f50('0x33')]=_0x78783d[_0x3f50('0x33')][_0x3f50('0x35')]?_0x78783d['attributes']:_0x57dbfb[_0x3f50('0x2e')];if(!_0x20dce1[_0x3f50('0x2f')][_0x3f50('0x36')]('nolimit')){_0x78783d['limit']=qs[_0x3f50('0x1e')](_0x20dce1[_0x3f50('0x2f')][_0x3f50('0x1e')]);_0x78783d['offset']=qs[_0x3f50('0x1b')](_0x20dce1[_0x3f50('0x2f')][_0x3f50('0x1b')]);}_0x78783d['order']=qs[_0x3f50('0x37')](_0x20dce1[_0x3f50('0x2f')][_0x3f50('0x37')]);_0x78783d['where']=qs['filters'](_[_0x3f50('0x38')](_0x20dce1[_0x3f50('0x2f')],_0x57dbfb[_0x3f50('0x31')]),_0x163f0a);if(_0x20dce1[_0x3f50('0x2f')]['filter']){_0x78783d[_0x3f50('0x39')]=_[_0x3f50('0x3a')](_0x78783d[_0x3f50('0x39')],{'$or':_[_0x3f50('0x29')](_0x163f0a,function(_0x435d43){if(_0x435d43[_0x3f50('0x2d')]!=='VIRTUAL'){var _0x5a1bd8={};_0x5a1bd8[_0x435d43[_0x3f50('0x27')]]={'$like':'%'+_0x20dce1[_0x3f50('0x2f')][_0x3f50('0x3b')]+'%'};return _0x5a1bd8;}})});}_0x78783d=_[_0x3f50('0x3a')]({},_0x78783d,_0x20dce1[_0x3f50('0x3c')]);var _0x21ec62={'where':_0x78783d['where']};return db[_0x3f50('0x2a')][_0x3f50('0x1d')](_0x21ec62)[_0x3f50('0x24')](function(_0x54981e){_0x126736[_0x3f50('0x1d')]=_0x54981e;if(_0x20dce1[_0x3f50('0x2f')][_0x3f50('0x3d')]){_0x78783d['include']=[{'all':!![]}];}return db[_0x3f50('0x2a')][_0x3f50('0x3e')](_0x78783d);})['then'](function(_0x126216){_0x126736[_0x3f50('0x3f')]=_0x126216;return _0x126736;})[_0x3f50('0x24')](respondWithFilteredResult(_0x31672b,_0x78783d))[_0x3f50('0x40')](handleError(_0x31672b,null));};exports[_0x3f50('0x41')]=function(_0x3dd466,_0x3171fb){var _0x491cf7={'raw':!![],'where':{'id':_0x3dd466[_0x3f50('0x42')]['id']}},_0x41f2f0={};_0x41f2f0[_0x3f50('0x2e')]=_[_0x3f50('0x30')](db[_0x3f50('0x2a')][_0x3f50('0x2b')]);_0x41f2f0[_0x3f50('0x2f')]=_['keys'](_0x3dd466[_0x3f50('0x2f')]);_0x41f2f0[_0x3f50('0x31')]=_[_0x3f50('0x32')](_0x41f2f0[_0x3f50('0x2e')],_0x41f2f0[_0x3f50('0x2f')]);_0x491cf7[_0x3f50('0x33')]=_['intersection'](_0x41f2f0[_0x3f50('0x2e')],qs[_0x3f50('0x34')](_0x3dd466[_0x3f50('0x2f')][_0x3f50('0x34')]));_0x491cf7[_0x3f50('0x33')]=_0x491cf7[_0x3f50('0x33')][_0x3f50('0x35')]?_0x491cf7[_0x3f50('0x33')]:_0x41f2f0['model'];if(_0x3dd466[_0x3f50('0x2f')][_0x3f50('0x3d')]){_0x491cf7[_0x3f50('0x43')]=[{'all':!![]}];}_0x491cf7=_[_0x3f50('0x3a')]({},_0x491cf7,_0x3dd466[_0x3f50('0x3c')]);return db['OpenchannelTransferReport']['find'](_0x491cf7)[_0x3f50('0x24')](handleEntityNotFound(_0x3171fb,null))['then'](respondWithResult(_0x3171fb,null))['catch'](handleError(_0x3171fb,null));};exports[_0x3f50('0x44')]=function(_0x476b98,_0xd8de37){return db[_0x3f50('0x2a')]['create'](_0x476b98[_0x3f50('0x45')],{})[_0x3f50('0x24')](respondWithResult(_0xd8de37,0xc9))[_0x3f50('0x40')](handleError(_0xd8de37,null));};exports[_0x3f50('0x23')]=function(_0x33cdcd,_0x52d34e){if(_0x33cdcd[_0x3f50('0x45')]['id']){delete _0x33cdcd[_0x3f50('0x45')]['id'];}return db[_0x3f50('0x2a')]['find']({'where':{'id':_0x33cdcd[_0x3f50('0x42')]['id']}})[_0x3f50('0x24')](handleEntityNotFound(_0x52d34e,null))[_0x3f50('0x24')](saveUpdates(_0x33cdcd['body'],null))[_0x3f50('0x24')](respondWithResult(_0x52d34e,null))['catch'](handleError(_0x52d34e,null));};exports[_0x3f50('0x25')]=function(_0x11f0b6,_0x1005fe){return db[_0x3f50('0x2a')][_0x3f50('0x46')]({'where':{'id':_0x11f0b6[_0x3f50('0x42')]['id']}})[_0x3f50('0x24')](handleEntityNotFound(_0x1005fe,null))['then'](removeEntity(_0x1005fe,null))[_0x3f50('0x40')](handleError(_0x1005fe,null));};exports[_0x3f50('0x47')]=function(_0x2d7b92,_0x55bfe6){return db[_0x3f50('0x2a')][_0x3f50('0x47')]()[_0x3f50('0x24')](respondWithResult(_0x55bfe6,null))[_0x3f50('0x40')](handleError(_0x55bfe6,null));}; \ No newline at end of file +var _0x9a4a=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelTransferReport','includeAll','include','findAll','params','length','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0xf3c6fa,_0x5e45bf){var _0x3b0f28=function(_0x5d2267){while(--_0x5d2267){_0xf3c6fa['push'](_0xf3c6fa['shift']());}};_0x3b0f28(++_0x5e45bf);}(_0x9a4a,0xb2));var _0xa9a4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9a4a[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0xa9a4('0x0'));var rimraf=require(_0xa9a4('0x1'));var zipdir=require(_0xa9a4('0x2'));var jsonpatch=require(_0xa9a4('0x3'));var rp=require(_0xa9a4('0x4'));var moment=require(_0xa9a4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa9a4('0x6'));var util=require(_0xa9a4('0x7'));var path=require('path');var sox=require(_0xa9a4('0x8'));var csv=require(_0xa9a4('0x9'));var ejs=require(_0xa9a4('0xa'));var fs=require('fs');var fs_extra=require(_0xa9a4('0xb'));var _=require(_0xa9a4('0xc'));var squel=require(_0xa9a4('0xd'));var crypto=require(_0xa9a4('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa9a4('0xf'));var Redis=require(_0xa9a4('0x10'));var authService=require(_0xa9a4('0x11'));var qs=require(_0xa9a4('0x12'));var as=require(_0xa9a4('0x13'));var hardwareService=require(_0xa9a4('0x14'));var logger=require('../../config/logger')(_0xa9a4('0x15'));var utils=require(_0xa9a4('0x16'));var config=require(_0xa9a4('0x17'));var licenseUtil=require(_0xa9a4('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9aa68d,_0x9f1be6){_0x9f1be6=_0x9f1be6||0xcc;return function(_0x362cb3){if(_0x362cb3){return _0x9aa68d[_0xa9a4('0x19')](_0x9f1be6);}return _0x9aa68d[_0xa9a4('0x1a')](_0x9f1be6)[_0xa9a4('0x1b')]();};}function respondWithResult(_0x3aa6ad,_0x2e158d){_0x2e158d=_0x2e158d||0xc8;return function(_0x5a2772){if(_0x5a2772){return _0x3aa6ad[_0xa9a4('0x1a')](_0x2e158d)[_0xa9a4('0x1c')](_0x5a2772);}};}function respondWithFilteredResult(_0x42e715,_0x42d209){return function(_0xff6e0b){if(_0xff6e0b){var _0x206478=typeof _0x42d209[_0xa9a4('0x1d')]===_0xa9a4('0x1e')&&typeof _0x42d209[_0xa9a4('0x1f')]==='undefined';var _0x5c47e1=_0xff6e0b[_0xa9a4('0x20')];var _0x37f686=_0x206478?0x0:_0x42d209[_0xa9a4('0x1d')];var _0x4674aa=_0x206478?_0xff6e0b['count']:_0x42d209[_0xa9a4('0x1d')]+_0x42d209['limit'];var _0x3fd64d;if(_0x4674aa>=_0x5c47e1){_0x4674aa=_0x5c47e1;_0x3fd64d=0xc8;}else{_0x3fd64d=0xce;}_0x42e715[_0xa9a4('0x1a')](_0x3fd64d);return _0x42e715[_0xa9a4('0x21')](_0xa9a4('0x22'),_0x37f686+'-'+_0x4674aa+'/'+_0x5c47e1)[_0xa9a4('0x1c')](_0xff6e0b);}return null;};}function patchUpdates(_0xa650a2){return function(_0x26ed6f){try{jsonpatch[_0xa9a4('0x23')](_0x26ed6f,_0xa650a2,!![]);}catch(_0x108569){return BPromise['reject'](_0x108569);}return _0x26ed6f[_0xa9a4('0x24')]();};}function saveUpdates(_0x45759e,_0x3d85ad){return function(_0x18eb62){if(_0x18eb62){return _0x18eb62[_0xa9a4('0x25')](_0x45759e)[_0xa9a4('0x26')](function(_0x3fa7a2){return _0x3fa7a2;});}return null;};}function removeEntity(_0x2dbc30,_0x1f1ff5){return function(_0x5c9737){if(_0x5c9737){return _0x5c9737['destroy']()['then'](function(){_0x2dbc30[_0xa9a4('0x1a')](0xcc)[_0xa9a4('0x1b')]();});}};}function handleEntityNotFound(_0x163103,_0x222fd7){return function(_0xb60517){if(!_0xb60517){_0x163103[_0xa9a4('0x19')](0x194);}return _0xb60517;};}function handleError(_0x293c33,_0x6ae5f8){_0x6ae5f8=_0x6ae5f8||0x1f4;return function(_0x31af1a){logger[_0xa9a4('0x27')](_0x31af1a[_0xa9a4('0x28')]);if(_0x31af1a[_0xa9a4('0x29')]){delete _0x31af1a['name'];}_0x293c33[_0xa9a4('0x1a')](_0x6ae5f8)[_0xa9a4('0x2a')](_0x31af1a);};}exports[_0xa9a4('0x2b')]=function(_0x162fbc,_0xa4926c){var _0x5bc15a={},_0x114854={},_0x171fab={'count':0x0,'rows':[]};var _0x20e5f2=_[_0xa9a4('0x2c')](db['OpenchannelTransferReport'][_0xa9a4('0x2d')],function(_0x4b0a03){return{'name':_0x4b0a03[_0xa9a4('0x2e')],'type':_0x4b0a03[_0xa9a4('0x2f')][_0xa9a4('0x30')]};});_0x114854[_0xa9a4('0x31')]=_['map'](_0x20e5f2,_0xa9a4('0x29'));_0x114854[_0xa9a4('0x32')]=_[_0xa9a4('0x33')](_0x162fbc[_0xa9a4('0x32')]);_0x114854[_0xa9a4('0x34')]=_[_0xa9a4('0x35')](_0x114854[_0xa9a4('0x31')],_0x114854[_0xa9a4('0x32')]);_0x5bc15a[_0xa9a4('0x36')]=_[_0xa9a4('0x35')](_0x114854[_0xa9a4('0x31')],qs[_0xa9a4('0x37')](_0x162fbc['query']['fields']));_0x5bc15a[_0xa9a4('0x36')]=_0x5bc15a[_0xa9a4('0x36')]['length']?_0x5bc15a['attributes']:_0x114854['model'];if(!_0x162fbc[_0xa9a4('0x32')][_0xa9a4('0x38')](_0xa9a4('0x39'))){_0x5bc15a[_0xa9a4('0x1f')]=qs[_0xa9a4('0x1f')](_0x162fbc[_0xa9a4('0x32')][_0xa9a4('0x1f')]);_0x5bc15a['offset']=qs[_0xa9a4('0x1d')](_0x162fbc[_0xa9a4('0x32')][_0xa9a4('0x1d')]);}_0x5bc15a[_0xa9a4('0x3a')]=qs[_0xa9a4('0x3b')](_0x162fbc[_0xa9a4('0x32')][_0xa9a4('0x3b')]);_0x5bc15a[_0xa9a4('0x3c')]=qs['filters'](_[_0xa9a4('0x3d')](_0x162fbc[_0xa9a4('0x32')],_0x114854[_0xa9a4('0x34')]),_0x20e5f2);if(_0x162fbc[_0xa9a4('0x32')][_0xa9a4('0x3e')]){_0x5bc15a[_0xa9a4('0x3c')]=_[_0xa9a4('0x3f')](_0x5bc15a['where'],{'$or':_['map'](_0x20e5f2,function(_0x43cac0){if(_0x43cac0[_0xa9a4('0x2f')]!==_0xa9a4('0x40')){var _0x4b4096={};_0x4b4096[_0x43cac0['name']]={'$like':'%'+_0x162fbc[_0xa9a4('0x32')][_0xa9a4('0x3e')]+'%'};return _0x4b4096;}})});}_0x5bc15a=_['merge']({},_0x5bc15a,_0x162fbc[_0xa9a4('0x41')]);var _0x59e6de={'where':_0x5bc15a['where']};return db[_0xa9a4('0x42')][_0xa9a4('0x20')](_0x59e6de)[_0xa9a4('0x26')](function(_0x1849c2){_0x171fab[_0xa9a4('0x20')]=_0x1849c2;if(_0x162fbc[_0xa9a4('0x32')][_0xa9a4('0x43')]){_0x5bc15a[_0xa9a4('0x44')]=[{'all':!![]}];}return db[_0xa9a4('0x42')][_0xa9a4('0x45')](_0x5bc15a);})['then'](function(_0x3f040d){_0x171fab['rows']=_0x3f040d;return _0x171fab;})[_0xa9a4('0x26')](respondWithFilteredResult(_0xa4926c,_0x5bc15a))['catch'](handleError(_0xa4926c,null));};exports['show']=function(_0x135923,_0x314b0e){var _0x50c559={'raw':!![],'where':{'id':_0x135923[_0xa9a4('0x46')]['id']}},_0x4bbcf0={};_0x4bbcf0[_0xa9a4('0x31')]=_[_0xa9a4('0x33')](db[_0xa9a4('0x42')][_0xa9a4('0x2d')]);_0x4bbcf0[_0xa9a4('0x32')]=_[_0xa9a4('0x33')](_0x135923[_0xa9a4('0x32')]);_0x4bbcf0[_0xa9a4('0x34')]=_[_0xa9a4('0x35')](_0x4bbcf0[_0xa9a4('0x31')],_0x4bbcf0[_0xa9a4('0x32')]);_0x50c559['attributes']=_[_0xa9a4('0x35')](_0x4bbcf0[_0xa9a4('0x31')],qs[_0xa9a4('0x37')](_0x135923[_0xa9a4('0x32')][_0xa9a4('0x37')]));_0x50c559[_0xa9a4('0x36')]=_0x50c559[_0xa9a4('0x36')][_0xa9a4('0x47')]?_0x50c559['attributes']:_0x4bbcf0[_0xa9a4('0x31')];if(_0x135923[_0xa9a4('0x32')]['includeAll']){_0x50c559[_0xa9a4('0x44')]=[{'all':!![]}];}_0x50c559=_[_0xa9a4('0x3f')]({},_0x50c559,_0x135923[_0xa9a4('0x41')]);return db[_0xa9a4('0x42')][_0xa9a4('0x48')](_0x50c559)[_0xa9a4('0x26')](handleEntityNotFound(_0x314b0e,null))[_0xa9a4('0x26')](respondWithResult(_0x314b0e,null))[_0xa9a4('0x49')](handleError(_0x314b0e,null));};exports[_0xa9a4('0x4a')]=function(_0xa3d64d,_0x2e3f7a){return db[_0xa9a4('0x42')]['create'](_0xa3d64d['body'],{})[_0xa9a4('0x26')](respondWithResult(_0x2e3f7a,0xc9))['catch'](handleError(_0x2e3f7a,null));};exports[_0xa9a4('0x25')]=function(_0x3504ba,_0x197a33){if(_0x3504ba[_0xa9a4('0x4b')]['id']){delete _0x3504ba[_0xa9a4('0x4b')]['id'];}return db[_0xa9a4('0x42')][_0xa9a4('0x48')]({'where':{'id':_0x3504ba['params']['id']}})[_0xa9a4('0x26')](handleEntityNotFound(_0x197a33,null))[_0xa9a4('0x26')](saveUpdates(_0x3504ba[_0xa9a4('0x4b')],null))[_0xa9a4('0x26')](respondWithResult(_0x197a33,null))[_0xa9a4('0x49')](handleError(_0x197a33,null));};exports[_0xa9a4('0x4c')]=function(_0x3906ba,_0x50df36){return db[_0xa9a4('0x42')][_0xa9a4('0x48')]({'where':{'id':_0x3906ba['params']['id']}})['then'](handleEntityNotFound(_0x50df36,null))[_0xa9a4('0x26')](removeEntity(_0x50df36,null))['catch'](handleError(_0x50df36,null));};exports[_0xa9a4('0x4d')]=function(_0x9ef3e9,_0x418e8c){return db[_0xa9a4('0x42')][_0xa9a4('0x4d')]()[_0xa9a4('0x26')](respondWithResult(_0x418e8c,null))[_0xa9a4('0x49')](handleError(_0x418e8c,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 1f4b844..6b50bf9 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 _0xe380=['request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','uniqueid','util','../../config/logger','api','moment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe380,0x158));var _0x0e38=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xe380[_0x68c979];return _0x4f0001;};'use strict';var _=require('lodash');var util=require(_0x0e38('0x0'));var logger=require(_0x0e38('0x1'))(_0x0e38('0x2'));var moment=require(_0x0e38('0x3'));var BPromise=require('bluebird');var rp=require(_0x0e38('0x4'));var fs=require('fs');var path=require(_0x0e38('0x5'));var rimraf=require(_0x0e38('0x6'));var config=require(_0x0e38('0x7'));var attributes=require(_0x0e38('0x8'));module['exports']=function(_0x5e9d11,_0x5e4cce){return _0x5e9d11[_0x0e38('0x9')](_0x0e38('0xa'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x0e38('0xb'),'fields':[_0x0e38('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7310=['./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3eeda3,_0x44105c){var _0x3131d4=function(_0x32460e){while(--_0x32460e){_0x3eeda3['push'](_0x3eeda3['shift']());}};_0x3131d4(++_0x44105c);}(_0x7310,0x140));var _0x0731=function(_0x85c2ae,_0x1b2180){_0x85c2ae=_0x85c2ae-0x0;var _0x5275bd=_0x7310[_0x85c2ae];return _0x5275bd;};'use strict';var _=require(_0x0731('0x0'));var util=require(_0x0731('0x1'));var logger=require(_0x0731('0x2'))(_0x0731('0x3'));var moment=require(_0x0731('0x4'));var BPromise=require(_0x0731('0x5'));var rp=require(_0x0731('0x6'));var fs=require('fs');var path=require(_0x0731('0x7'));var rimraf=require(_0x0731('0x8'));var config=require(_0x0731('0x9'));var attributes=require(_0x0731('0xa'));module['exports']=function(_0x1fe229,_0x3d41b6){return _0x1fe229[_0x0731('0xb')](_0x0731('0xc'),attributes,{'tableName':_0x0731('0xd'),'paranoid':![],'indexes':[{'name':_0x0731('0xe'),'fields':[_0x0731('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index a7a2cc9..70ee04f 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 _0x9f7a=['../../config/environment','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','rpc'];(function(_0x2c7d87,_0x22b956){var _0x591bbb=function(_0x4e2270){while(--_0x4e2270){_0x2c7d87['push'](_0x2c7d87['shift']());}};_0x591bbb(++_0x22b956);}(_0x9f7a,0xf1));var _0xa9f7=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x9f7a[_0x1ccdf7];return _0x52a0ae;};'use strict';var _=require(_0xa9f7('0x0'));var util=require(_0xa9f7('0x1'));var moment=require(_0xa9f7('0x2'));var BPromise=require(_0xa9f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa9f7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa9f7('0x5'));var config=require(_0xa9f7('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa9f7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5497c8,_0x48e791,_0x5bf7ca){return new BPromise(function(_0x21010f,_0x58a3f3){return client[_0xa9f7('0x8')](_0x5497c8,_0x5bf7ca)[_0xa9f7('0x9')](function(_0x287478){logger['info'](_0xa9f7('0xa'),_0x48e791,_0xa9f7('0xb'));logger['debug'](_0xa9f7('0xc'),_0x48e791,_0xa9f7('0xb'),JSON[_0xa9f7('0xd')](_0x287478));if(_0x287478[_0xa9f7('0xe')]){if(_0x287478[_0xa9f7('0xe')][_0xa9f7('0xf')]===0x1f4){logger[_0xa9f7('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x48e791,_0x287478[_0xa9f7('0xe')]['message']);return _0x58a3f3(_0x287478[_0xa9f7('0xe')][_0xa9f7('0x10')]);}logger[_0xa9f7('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x48e791,_0x287478['error'][_0xa9f7('0x10')]);return _0x21010f(_0x287478['error']['message']);}else{logger[_0xa9f7('0x11')](_0xa9f7('0xa'),_0x48e791,_0xa9f7('0xb'));_0x21010f(_0x287478['result'][_0xa9f7('0x10')]);}})[_0xa9f7('0x12')](function(_0x2aeadd){logger['error'](_0xa9f7('0xa'),_0x48e791,_0x2aeadd);_0x58a3f3(_0x2aeadd);});});} \ No newline at end of file +var _0x1d25=['request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','OpenchannelTransferReport,\x20%s,\x20%s'];(function(_0x2cc9d5,_0x155d5a){var _0x1b47f9=function(_0x83e771){while(--_0x83e771){_0x2cc9d5['push'](_0x2cc9d5['shift']());}};_0x1b47f9(++_0x155d5a);}(_0x1d25,0xba));var _0x51d2=function(_0x27c068,_0x342981){_0x27c068=_0x27c068-0x0;var _0xe5a67f=_0x1d25[_0x27c068];return _0xe5a67f;};'use strict';var _=require(_0x51d2('0x0'));var util=require(_0x51d2('0x1'));var moment=require(_0x51d2('0x2'));var BPromise=require(_0x51d2('0x3'));var rs=require(_0x51d2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x51d2('0x5'))['db'];var utils=require(_0x51d2('0x6'));var logger=require('../../config/logger')(_0x51d2('0x7'));var config=require(_0x51d2('0x8'));var jayson=require(_0x51d2('0x9'));var client=jayson[_0x51d2('0xa')][_0x51d2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e6956,_0x56edda,_0x18e8a9){return new BPromise(function(_0x5a6b5f,_0x419156){return client['request'](_0x2e6956,_0x18e8a9)['then'](function(_0x30d7d0){logger[_0x51d2('0xc')](_0x51d2('0xd'),_0x56edda,_0x51d2('0xe'));logger['debug'](_0x51d2('0xf'),_0x56edda,_0x51d2('0xe'),JSON[_0x51d2('0x10')](_0x30d7d0));if(_0x30d7d0[_0x51d2('0x11')]){if(_0x30d7d0[_0x51d2('0x11')]['code']===0x1f4){logger[_0x51d2('0x11')](_0x51d2('0xd'),_0x56edda,_0x30d7d0['error']['message']);return _0x419156(_0x30d7d0[_0x51d2('0x11')][_0x51d2('0x12')]);}logger[_0x51d2('0x11')](_0x51d2('0xd'),_0x56edda,_0x30d7d0[_0x51d2('0x11')]['message']);return _0x5a6b5f(_0x30d7d0[_0x51d2('0x11')]['message']);}else{logger[_0x51d2('0xc')](_0x51d2('0xd'),_0x56edda,_0x51d2('0xe'));_0x5a6b5f(_0x30d7d0['result'][_0x51d2('0x12')]);}})[_0x51d2('0x13')](function(_0x14a682){logger[_0x51d2('0x11')](_0x51d2('0xd'),_0x56edda,_0x14a682);_0x419156(_0x14a682);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index f3c2e22..fc30af9 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 _0xe173=['post','put','/:id','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./pause.controller','get','isAuthenticated','show'];(function(_0x19373c,_0x3784cb){var _0x2732f7=function(_0x25a47b){while(--_0x25a47b){_0x19373c['push'](_0x19373c['shift']());}};_0x2732f7(++_0x3784cb);}(_0xe173,0x1a5));var _0x3e17=function(_0x4545cb,_0x4f904a){_0x4545cb=_0x4545cb-0x0;var _0x17b453=_0xe173[_0x4545cb];return _0x17b453;};'use strict';var multer=require(_0x3e17('0x0'));var util=require(_0x3e17('0x1'));var path=require(_0x3e17('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3e17('0x3')]();var fs_extra=require(_0x3e17('0x4'));var auth=require(_0x3e17('0x5'));var interaction=require(_0x3e17('0x6'));var config=require('../../config/environment');var controller=require(_0x3e17('0x7'));router[_0x3e17('0x8')]('/',auth[_0x3e17('0x9')](),controller['index']);router[_0x3e17('0x8')]('/:id',auth[_0x3e17('0x9')](),controller[_0x3e17('0xa')]);router[_0x3e17('0xb')]('/',auth[_0x3e17('0x9')](),controller['create']);router[_0x3e17('0xc')](_0x3e17('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x3e17('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x3e17('0xf')]);module['exports']=router; \ No newline at end of file +var _0xfbe6=['isAuthenticated','index','/:id','show','create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xfbe6,0x6d));var _0x6fbe=function(_0x42085e,_0x43630e){_0x42085e=_0x42085e-0x0;var _0x574013=_0xfbe6[_0x42085e];return _0x574013;};'use strict';var multer=require(_0x6fbe('0x0'));var util=require(_0x6fbe('0x1'));var path=require(_0x6fbe('0x2'));var timeout=require('connect-timeout');var express=require(_0x6fbe('0x3'));var router=express[_0x6fbe('0x4')]();var fs_extra=require(_0x6fbe('0x5'));var auth=require(_0x6fbe('0x6'));var interaction=require(_0x6fbe('0x7'));var config=require(_0x6fbe('0x8'));var controller=require(_0x6fbe('0x9'));router[_0x6fbe('0xa')]('/',auth[_0x6fbe('0xb')](),controller[_0x6fbe('0xc')]);router['get'](_0x6fbe('0xd'),auth[_0x6fbe('0xb')](),controller[_0x6fbe('0xe')]);router['post']('/',auth[_0x6fbe('0xb')](),controller[_0x6fbe('0xf')]);router[_0x6fbe('0x10')](_0x6fbe('0xd'),auth[_0x6fbe('0xb')](),controller[_0x6fbe('0x11')]);router[_0x6fbe('0x12')](_0x6fbe('0xd'),auth[_0x6fbe('0xb')](),controller[_0x6fbe('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 0877e97..0c35c2c 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 _0x784f=['name','STRING'];(function(_0x579baf,_0x4aaafa){var _0x4c601a=function(_0x462b53){while(--_0x462b53){_0x579baf['push'](_0x579baf['shift']());}};_0x4c601a(++_0x4aaafa);}(_0x784f,0x1bb));var _0xf784=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x784f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf784('0x0')],'unique':_0xf784('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xf784('0x0')]}}; \ No newline at end of file +var _0x8402=['sequelize','exports','name','STRING'];(function(_0x3b6574,_0xf5ce85){var _0x49b43f=function(_0x51bdd1){while(--_0x51bdd1){_0x3b6574['push'](_0x3b6574['shift']());}};_0x49b43f(++_0xf5ce85);}(_0x8402,0x124));var _0x2840=function(_0x4da3d7,_0x423235){_0x4da3d7=_0x4da3d7-0x0;var _0x499fee=_0x8402[_0x4da3d7];return _0x499fee;};'use strict';var Sequelize=require(_0x2840('0x0'));module[_0x2840('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2840('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x2840('0x3')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 5489341..2efe7e5 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 _0x2cba=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','count','set','Content-Range','apply','update','then','get','Pauses','destroy','error','name','send','Pause','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body'];(function(_0x1d0499,_0x23e22f){var _0x153fb3=function(_0x40c19c){while(--_0x40c19c){_0x1d0499['push'](_0x1d0499['shift']());}};_0x153fb3(++_0x23e22f);}(_0x2cba,0xa8));var _0xa2cb=function(_0x3bd62b,_0x648996){_0x3bd62b=_0x3bd62b-0x0;var _0xd03a31=_0x2cba[_0x3bd62b];return _0xd03a31;};'use strict';var emlformat=require(_0xa2cb('0x0'));var rimraf=require(_0xa2cb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa2cb('0x2'));var rp=require(_0xa2cb('0x3'));var moment=require(_0xa2cb('0x4'));var BPromise=require(_0xa2cb('0x5'));var Mustache=require(_0xa2cb('0x6'));var util=require(_0xa2cb('0x7'));var path=require('path');var sox=require(_0xa2cb('0x8'));var csv=require('to-csv');var ejs=require(_0xa2cb('0x9'));var fs=require('fs');var fs_extra=require(_0xa2cb('0xa'));var _=require(_0xa2cb('0xb'));var squel=require('squel');var crypto=require(_0xa2cb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa2cb('0xd'));var toCsv=require(_0xa2cb('0xe'));var querystring=require('querystring');var Papa=require(_0xa2cb('0xf'));var Redis=require('ioredis');var authService=require(_0xa2cb('0x10'));var qs=require(_0xa2cb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa2cb('0x12'));var logger=require(_0xa2cb('0x13'))(_0xa2cb('0x14'));var utils=require(_0xa2cb('0x15'));var config=require(_0xa2cb('0x16'));var licenseUtil=require(_0xa2cb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x321ed5,_0x2fb70b){_0x2fb70b=_0x2fb70b||0xcc;return function(_0xce4c14){if(_0xce4c14){return _0x321ed5[_0xa2cb('0x18')](_0x2fb70b);}return _0x321ed5[_0xa2cb('0x19')](_0x2fb70b)[_0xa2cb('0x1a')]();};}function respondWithResult(_0xeddc67,_0x2a80bb){_0x2a80bb=_0x2a80bb||0xc8;return function(_0x18b7bf){if(_0x18b7bf){return _0xeddc67['status'](_0x2a80bb)['json'](_0x18b7bf);}};}function respondWithFilteredResult(_0x5261b3,_0x4d3076){return function(_0x35282a){if(_0x35282a){var _0x2c00c0=typeof _0x4d3076[_0xa2cb('0x1b')]==='undefined'&&typeof _0x4d3076[_0xa2cb('0x1c')]==='undefined';var _0x44e9e9=_0x35282a[_0xa2cb('0x1d')];var _0x955967=_0x2c00c0?0x0:_0x4d3076[_0xa2cb('0x1b')];var _0x4e67e7=_0x2c00c0?_0x35282a[_0xa2cb('0x1d')]:_0x4d3076['offset']+_0x4d3076[_0xa2cb('0x1c')];var _0x4a8982;if(_0x4e67e7>=_0x44e9e9){_0x4e67e7=_0x44e9e9;_0x4a8982=0xc8;}else{_0x4a8982=0xce;}_0x5261b3[_0xa2cb('0x19')](_0x4a8982);return _0x5261b3[_0xa2cb('0x1e')](_0xa2cb('0x1f'),_0x955967+'-'+_0x4e67e7+'/'+_0x44e9e9)['json'](_0x35282a);}return null;};}function patchUpdates(_0x5db8af){return function(_0x427728){try{jsonpatch[_0xa2cb('0x20')](_0x427728,_0x5db8af,!![]);}catch(_0x5d3027){return BPromise['reject'](_0x5d3027);}return _0x427728['save']();};}function saveUpdates(_0x379a68,_0x2af959){return function(_0x3d3762){if(_0x3d3762){return _0x3d3762[_0xa2cb('0x21')](_0x379a68)[_0xa2cb('0x22')](function(_0x2a1c48){return _0x2a1c48;});}return null;};}function removeEntity(_0x2241c6,_0x4eb883){return function(_0x2295c9){if(_0x2295c9){return _0x2295c9['destroy']()[_0xa2cb('0x22')](function(){var _0x4282bd=_0x2295c9[_0xa2cb('0x23')]({'plain':!![]});var _0x3cfd7d=_0xa2cb('0x24');return db['UserProfileResource'][_0xa2cb('0x25')]({'where':{'type':_0x3cfd7d,'resourceId':_0x4282bd['id']}})[_0xa2cb('0x22')](function(){return _0x2295c9;});})['then'](function(){_0x2241c6[_0xa2cb('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c56b9,_0x4bb93f){return function(_0x2cc707){if(!_0x2cc707){_0x1c56b9[_0xa2cb('0x18')](0x194);}return _0x2cc707;};}function handleError(_0x57cc64,_0x36f3cf){_0x36f3cf=_0x36f3cf||0x1f4;return function(_0x17c378){logger[_0xa2cb('0x26')](_0x17c378['stack']);if(_0x17c378['name']){delete _0x17c378[_0xa2cb('0x27')];}_0x57cc64[_0xa2cb('0x19')](_0x36f3cf)[_0xa2cb('0x28')](_0x17c378);};}exports['index']=function(_0x17830a,_0x2b2750){var _0x40afd3={},_0x126dfd={},_0x430dbd={'count':0x0,'rows':[]};var _0x1730be=_['map'](db[_0xa2cb('0x29')][_0xa2cb('0x2a')],function(_0x30fcc4){return{'name':_0x30fcc4[_0xa2cb('0x2b')],'type':_0x30fcc4[_0xa2cb('0x2c')]['key']};});_0x126dfd[_0xa2cb('0x2d')]=_[_0xa2cb('0x2e')](_0x1730be,_0xa2cb('0x27'));_0x126dfd[_0xa2cb('0x2f')]=_[_0xa2cb('0x30')](_0x17830a['query']);_0x126dfd[_0xa2cb('0x31')]=_['intersection'](_0x126dfd[_0xa2cb('0x2d')],_0x126dfd[_0xa2cb('0x2f')]);_0x40afd3['attributes']=_[_0xa2cb('0x32')](_0x126dfd[_0xa2cb('0x2d')],qs[_0xa2cb('0x33')](_0x17830a[_0xa2cb('0x2f')]['fields']));_0x40afd3[_0xa2cb('0x34')]=_0x40afd3[_0xa2cb('0x34')][_0xa2cb('0x35')]?_0x40afd3['attributes']:_0x126dfd[_0xa2cb('0x2d')];if(!_0x17830a[_0xa2cb('0x2f')][_0xa2cb('0x36')]('nolimit')){_0x40afd3[_0xa2cb('0x1c')]=qs['limit'](_0x17830a[_0xa2cb('0x2f')][_0xa2cb('0x1c')]);_0x40afd3['offset']=qs[_0xa2cb('0x1b')](_0x17830a[_0xa2cb('0x2f')][_0xa2cb('0x1b')]);}_0x40afd3[_0xa2cb('0x37')]=qs['sort'](_0x17830a[_0xa2cb('0x2f')][_0xa2cb('0x38')]);_0x40afd3['where']=qs[_0xa2cb('0x31')](_[_0xa2cb('0x39')](_0x17830a[_0xa2cb('0x2f')],_0x126dfd['filters']),_0x1730be);if(_0x17830a[_0xa2cb('0x2f')][_0xa2cb('0x3a')]){_0x40afd3[_0xa2cb('0x3b')]=_[_0xa2cb('0x3c')](_0x40afd3[_0xa2cb('0x3b')],{'$or':_[_0xa2cb('0x2e')](_0x1730be,function(_0x5de203){if(_0x5de203['type']!=='VIRTUAL'){var _0x17c69a={};_0x17c69a[_0x5de203['name']]={'$like':'%'+_0x17830a[_0xa2cb('0x2f')]['filter']+'%'};return _0x17c69a;}})});}_0x40afd3=_[_0xa2cb('0x3c')]({},_0x40afd3,_0x17830a[_0xa2cb('0x3d')]);var _0x1640e3={'where':_0x40afd3[_0xa2cb('0x3b')]};return db[_0xa2cb('0x29')][_0xa2cb('0x1d')](_0x1640e3)[_0xa2cb('0x22')](function(_0x254ba2){_0x430dbd[_0xa2cb('0x1d')]=_0x254ba2;if(_0x17830a[_0xa2cb('0x2f')][_0xa2cb('0x3e')]){_0x40afd3[_0xa2cb('0x3f')]=[{'all':!![]}];}return db[_0xa2cb('0x29')][_0xa2cb('0x40')](_0x40afd3);})['then'](function(_0x4f1f94){_0x430dbd[_0xa2cb('0x41')]=_0x4f1f94;return _0x430dbd;})[_0xa2cb('0x22')](respondWithFilteredResult(_0x2b2750,_0x40afd3))[_0xa2cb('0x42')](handleError(_0x2b2750,null));};exports[_0xa2cb('0x43')]=function(_0x59139c,_0x1dec29){var _0x28f0cf={'raw':!![],'where':{'id':_0x59139c[_0xa2cb('0x44')]['id']}},_0x23ca30={};_0x23ca30[_0xa2cb('0x2d')]=_[_0xa2cb('0x30')](db[_0xa2cb('0x29')][_0xa2cb('0x2a')]);_0x23ca30['query']=_[_0xa2cb('0x30')](_0x59139c['query']);_0x23ca30[_0xa2cb('0x31')]=_[_0xa2cb('0x32')](_0x23ca30['model'],_0x23ca30['query']);_0x28f0cf[_0xa2cb('0x34')]=_['intersection'](_0x23ca30[_0xa2cb('0x2d')],qs[_0xa2cb('0x33')](_0x59139c[_0xa2cb('0x2f')][_0xa2cb('0x33')]));_0x28f0cf[_0xa2cb('0x34')]=_0x28f0cf[_0xa2cb('0x34')][_0xa2cb('0x35')]?_0x28f0cf[_0xa2cb('0x34')]:_0x23ca30[_0xa2cb('0x2d')];if(_0x59139c[_0xa2cb('0x2f')][_0xa2cb('0x3e')]){_0x28f0cf[_0xa2cb('0x3f')]=[{'all':!![]}];}_0x28f0cf=_[_0xa2cb('0x3c')]({},_0x28f0cf,_0x59139c['options']);return db[_0xa2cb('0x29')][_0xa2cb('0x45')](_0x28f0cf)[_0xa2cb('0x22')](handleEntityNotFound(_0x1dec29,null))[_0xa2cb('0x22')](respondWithResult(_0x1dec29,null))[_0xa2cb('0x42')](handleError(_0x1dec29,null));};exports[_0xa2cb('0x46')]=function(_0x23f0e8,_0x276cd2){return db['Pause'][_0xa2cb('0x46')](_0x23f0e8[_0xa2cb('0x47')],{})[_0xa2cb('0x22')](function(_0x26f7f0){var _0x5cadc3=_0x23f0e8['user'][_0xa2cb('0x23')]({'plain':!![]});if(!_0x5cadc3)throw new Error(_0xa2cb('0x48'));if(_0x5cadc3[_0xa2cb('0x49')]===_0xa2cb('0x4a')){var _0x6ddc42=_0x26f7f0[_0xa2cb('0x23')]({'plain':!![]});var _0x42d8c8=_0xa2cb('0x24');return db[_0xa2cb('0x4b')]['find']({'where':{'name':_0x42d8c8,'userProfileId':_0x5cadc3[_0xa2cb('0x4c')]},'raw':!![]})[_0xa2cb('0x22')](function(_0x425bd4){if(_0x425bd4&&_0x425bd4[_0xa2cb('0x4d')]===0x0){return db[_0xa2cb('0x4e')]['create']({'name':_0x6ddc42['name'],'resourceId':_0x6ddc42['id'],'type':_0x425bd4[_0xa2cb('0x27')],'sectionId':_0x425bd4['id']},{})[_0xa2cb('0x22')](function(){return _0x26f7f0;});}else{return _0x26f7f0;}})[_0xa2cb('0x42')](function(_0x27e003){logger['error'](_0xa2cb('0x4f'),_0x27e003);throw _0x27e003;});}return _0x26f7f0;})[_0xa2cb('0x22')](respondWithResult(_0x276cd2,0xc9))[_0xa2cb('0x42')](handleError(_0x276cd2,null));};exports['update']=function(_0x9f5a26,_0x417322){if(_0x9f5a26[_0xa2cb('0x47')]['id']){delete _0x9f5a26['body']['id'];}return db[_0xa2cb('0x29')][_0xa2cb('0x45')]({'where':{'id':_0x9f5a26[_0xa2cb('0x44')]['id']}})[_0xa2cb('0x22')](handleEntityNotFound(_0x417322,null))[_0xa2cb('0x22')](saveUpdates(_0x9f5a26[_0xa2cb('0x47')],null))[_0xa2cb('0x22')](respondWithResult(_0x417322,null))[_0xa2cb('0x42')](handleError(_0x417322,null));};exports[_0xa2cb('0x25')]=function(_0x56a744,_0xa9a19b){return db[_0xa2cb('0x29')][_0xa2cb('0x45')]({'where':{'id':_0x56a744['params']['id']}})[_0xa2cb('0x22')](handleEntityNotFound(_0xa9a19b,null))['then'](removeEntity(_0xa9a19b,null))['catch'](handleError(_0xa9a19b,null));}; \ No newline at end of file +var _0xbeba=['path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','then','destroy','get','Pauses','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','Pause','includeAll','include','rows','show','params','length','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','request-promise','moment','mustache','util'];(function(_0x2fbaf7,_0x352750){var _0x4b3c4d=function(_0x29d32e){while(--_0x29d32e){_0x2fbaf7['push'](_0x2fbaf7['shift']());}};_0x4b3c4d(++_0x352750);}(_0xbeba,0x1db));var _0xabeb=function(_0x2752f6,_0x4160d0){_0x2752f6=_0x2752f6-0x0;var _0x587bde=_0xbeba[_0x2752f6];return _0x587bde;};'use strict';var emlformat=require(_0xabeb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xabeb('0x1'));var moment=require(_0xabeb('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xabeb('0x3'));var util=require(_0xabeb('0x4'));var path=require(_0xabeb('0x5'));var sox=require(_0xabeb('0x6'));var csv=require(_0xabeb('0x7'));var ejs=require(_0xabeb('0x8'));var fs=require('fs');var fs_extra=require(_0xabeb('0x9'));var _=require('lodash');var squel=require(_0xabeb('0xa'));var crypto=require(_0xabeb('0xb'));var jsforce=require(_0xabeb('0xc'));var deskjs=require(_0xabeb('0xd'));var toCsv=require(_0xabeb('0x7'));var querystring=require(_0xabeb('0xe'));var Papa=require(_0xabeb('0xf'));var Redis=require('ioredis');var authService=require(_0xabeb('0x10'));var qs=require(_0xabeb('0x11'));var as=require(_0xabeb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xabeb('0x13'))(_0xabeb('0x14'));var utils=require(_0xabeb('0x15'));var config=require(_0xabeb('0x16'));var licenseUtil=require(_0xabeb('0x17'));var db=require(_0xabeb('0x18'))['db'];function respondWithStatusCode(_0x272d27,_0x309552){_0x309552=_0x309552||0xcc;return function(_0x44e03a){if(_0x44e03a){return _0x272d27[_0xabeb('0x19')](_0x309552);}return _0x272d27[_0xabeb('0x1a')](_0x309552)[_0xabeb('0x1b')]();};}function respondWithResult(_0x2f626b,_0x1f04fa){_0x1f04fa=_0x1f04fa||0xc8;return function(_0x16a90d){if(_0x16a90d){return _0x2f626b[_0xabeb('0x1a')](_0x1f04fa)['json'](_0x16a90d);}};}function respondWithFilteredResult(_0x47b479,_0x6e3e52){return function(_0x4379f9){if(_0x4379f9){var _0x3291a7=typeof _0x6e3e52[_0xabeb('0x1c')]===_0xabeb('0x1d')&&typeof _0x6e3e52[_0xabeb('0x1e')]===_0xabeb('0x1d');var _0x57fcad=_0x4379f9[_0xabeb('0x1f')];var _0x2425f0=_0x3291a7?0x0:_0x6e3e52['offset'];var _0x10f5c8=_0x3291a7?_0x4379f9['count']:_0x6e3e52[_0xabeb('0x1c')]+_0x6e3e52[_0xabeb('0x1e')];var _0x4bdc34;if(_0x10f5c8>=_0x57fcad){_0x10f5c8=_0x57fcad;_0x4bdc34=0xc8;}else{_0x4bdc34=0xce;}_0x47b479[_0xabeb('0x1a')](_0x4bdc34);return _0x47b479[_0xabeb('0x20')]('Content-Range',_0x2425f0+'-'+_0x10f5c8+'/'+_0x57fcad)['json'](_0x4379f9);}return null;};}function patchUpdates(_0x2600ce){return function(_0xbe0ec7){try{jsonpatch['apply'](_0xbe0ec7,_0x2600ce,!![]);}catch(_0x21d278){return BPromise['reject'](_0x21d278);}return _0xbe0ec7['save']();};}function saveUpdates(_0x146b85,_0x2aebb2){return function(_0x34f589){if(_0x34f589){return _0x34f589['update'](_0x146b85)[_0xabeb('0x21')](function(_0x5d4cf7){return _0x5d4cf7;});}return null;};}function removeEntity(_0x2b3f6a,_0x5cde4e){return function(_0x22f6d0){if(_0x22f6d0){return _0x22f6d0[_0xabeb('0x22')]()[_0xabeb('0x21')](function(){var _0x3a079c=_0x22f6d0[_0xabeb('0x23')]({'plain':!![]});var _0x46b92b=_0xabeb('0x24');return db['UserProfileResource'][_0xabeb('0x22')]({'where':{'type':_0x46b92b,'resourceId':_0x3a079c['id']}})['then'](function(){return _0x22f6d0;});})[_0xabeb('0x21')](function(){_0x2b3f6a[_0xabeb('0x1a')](0xcc)[_0xabeb('0x1b')]();});}};}function handleEntityNotFound(_0x2987ff,_0x15d708){return function(_0x1874fb){if(!_0x1874fb){_0x2987ff[_0xabeb('0x19')](0x194);}return _0x1874fb;};}function handleError(_0x826d40,_0x380595){_0x380595=_0x380595||0x1f4;return function(_0x40a4a7){logger['error'](_0x40a4a7['stack']);if(_0x40a4a7[_0xabeb('0x25')]){delete _0x40a4a7[_0xabeb('0x25')];}_0x826d40[_0xabeb('0x1a')](_0x380595)[_0xabeb('0x26')](_0x40a4a7);};}exports['index']=function(_0x13b51f,_0x2db14b){var _0x4c85c1={},_0x18973a={},_0x5841fc={'count':0x0,'rows':[]};var _0x5af0ca=_[_0xabeb('0x27')](db['Pause'][_0xabeb('0x28')],function(_0x3aec51){return{'name':_0x3aec51[_0xabeb('0x29')],'type':_0x3aec51[_0xabeb('0x2a')]['key']};});_0x18973a[_0xabeb('0x2b')]=_[_0xabeb('0x27')](_0x5af0ca,_0xabeb('0x25'));_0x18973a[_0xabeb('0x2c')]=_[_0xabeb('0x2d')](_0x13b51f[_0xabeb('0x2c')]);_0x18973a[_0xabeb('0x2e')]=_['intersection'](_0x18973a[_0xabeb('0x2b')],_0x18973a[_0xabeb('0x2c')]);_0x4c85c1[_0xabeb('0x2f')]=_[_0xabeb('0x30')](_0x18973a['model'],qs[_0xabeb('0x31')](_0x13b51f[_0xabeb('0x2c')][_0xabeb('0x31')]));_0x4c85c1[_0xabeb('0x2f')]=_0x4c85c1[_0xabeb('0x2f')]['length']?_0x4c85c1['attributes']:_0x18973a[_0xabeb('0x2b')];if(!_0x13b51f['query'][_0xabeb('0x32')](_0xabeb('0x33'))){_0x4c85c1[_0xabeb('0x1e')]=qs[_0xabeb('0x1e')](_0x13b51f[_0xabeb('0x2c')]['limit']);_0x4c85c1[_0xabeb('0x1c')]=qs[_0xabeb('0x1c')](_0x13b51f[_0xabeb('0x2c')][_0xabeb('0x1c')]);}_0x4c85c1[_0xabeb('0x34')]=qs['sort'](_0x13b51f[_0xabeb('0x2c')][_0xabeb('0x35')]);_0x4c85c1[_0xabeb('0x36')]=qs[_0xabeb('0x2e')](_[_0xabeb('0x37')](_0x13b51f['query'],_0x18973a[_0xabeb('0x2e')]),_0x5af0ca);if(_0x13b51f[_0xabeb('0x2c')][_0xabeb('0x38')]){_0x4c85c1['where']=_[_0xabeb('0x39')](_0x4c85c1['where'],{'$or':_[_0xabeb('0x27')](_0x5af0ca,function(_0x6d3f4f){if(_0x6d3f4f[_0xabeb('0x2a')]!==_0xabeb('0x3a')){var _0x4fcabc={};_0x4fcabc[_0x6d3f4f[_0xabeb('0x25')]]={'$like':'%'+_0x13b51f[_0xabeb('0x2c')]['filter']+'%'};return _0x4fcabc;}})});}_0x4c85c1=_['merge']({},_0x4c85c1,_0x13b51f['options']);var _0x43da9a={'where':_0x4c85c1[_0xabeb('0x36')]};return db[_0xabeb('0x3b')][_0xabeb('0x1f')](_0x43da9a)['then'](function(_0x5e92ff){_0x5841fc['count']=_0x5e92ff;if(_0x13b51f[_0xabeb('0x2c')][_0xabeb('0x3c')]){_0x4c85c1[_0xabeb('0x3d')]=[{'all':!![]}];}return db[_0xabeb('0x3b')]['findAll'](_0x4c85c1);})['then'](function(_0x42e936){_0x5841fc[_0xabeb('0x3e')]=_0x42e936;return _0x5841fc;})['then'](respondWithFilteredResult(_0x2db14b,_0x4c85c1))['catch'](handleError(_0x2db14b,null));};exports[_0xabeb('0x3f')]=function(_0x540c62,_0x39f1f8){var _0x27a483={'raw':!![],'where':{'id':_0x540c62[_0xabeb('0x40')]['id']}},_0x151182={};_0x151182['model']=_['keys'](db[_0xabeb('0x3b')][_0xabeb('0x28')]);_0x151182[_0xabeb('0x2c')]=_['keys'](_0x540c62['query']);_0x151182['filters']=_[_0xabeb('0x30')](_0x151182[_0xabeb('0x2b')],_0x151182[_0xabeb('0x2c')]);_0x27a483[_0xabeb('0x2f')]=_[_0xabeb('0x30')](_0x151182[_0xabeb('0x2b')],qs[_0xabeb('0x31')](_0x540c62['query'][_0xabeb('0x31')]));_0x27a483[_0xabeb('0x2f')]=_0x27a483[_0xabeb('0x2f')][_0xabeb('0x41')]?_0x27a483[_0xabeb('0x2f')]:_0x151182[_0xabeb('0x2b')];if(_0x540c62['query'][_0xabeb('0x3c')]){_0x27a483[_0xabeb('0x3d')]=[{'all':!![]}];}_0x27a483=_[_0xabeb('0x39')]({},_0x27a483,_0x540c62[_0xabeb('0x42')]);return db[_0xabeb('0x3b')]['find'](_0x27a483)['then'](handleEntityNotFound(_0x39f1f8,null))[_0xabeb('0x21')](respondWithResult(_0x39f1f8,null))[_0xabeb('0x43')](handleError(_0x39f1f8,null));};exports[_0xabeb('0x44')]=function(_0x3407aa,_0x335d88){return db[_0xabeb('0x3b')][_0xabeb('0x44')](_0x3407aa[_0xabeb('0x45')],{})[_0xabeb('0x21')](function(_0x35bace){var _0x51e5db=_0x3407aa[_0xabeb('0x46')][_0xabeb('0x23')]({'plain':!![]});if(!_0x51e5db)throw new Error(_0xabeb('0x47'));if(_0x51e5db[_0xabeb('0x48')]===_0xabeb('0x46')){var _0xe92b5e=_0x35bace['get']({'plain':!![]});var _0x21c40c=_0xabeb('0x24');return db['UserProfileSection'][_0xabeb('0x49')]({'where':{'name':_0x21c40c,'userProfileId':_0x51e5db[_0xabeb('0x4a')]},'raw':!![]})[_0xabeb('0x21')](function(_0x455999){if(_0x455999&&_0x455999[_0xabeb('0x4b')]===0x0){return db[_0xabeb('0x4c')][_0xabeb('0x44')]({'name':_0xe92b5e[_0xabeb('0x25')],'resourceId':_0xe92b5e['id'],'type':_0x455999[_0xabeb('0x25')],'sectionId':_0x455999['id']},{})[_0xabeb('0x21')](function(){return _0x35bace;});}else{return _0x35bace;}})[_0xabeb('0x43')](function(_0x5f4ca6){logger[_0xabeb('0x4d')](_0xabeb('0x4e'),_0x5f4ca6);throw _0x5f4ca6;});}return _0x35bace;})[_0xabeb('0x21')](respondWithResult(_0x335d88,0xc9))[_0xabeb('0x43')](handleError(_0x335d88,null));};exports[_0xabeb('0x4f')]=function(_0xad9eb9,_0x340c40){if(_0xad9eb9['body']['id']){delete _0xad9eb9[_0xabeb('0x45')]['id'];}return db['Pause'][_0xabeb('0x49')]({'where':{'id':_0xad9eb9[_0xabeb('0x40')]['id']}})[_0xabeb('0x21')](handleEntityNotFound(_0x340c40,null))[_0xabeb('0x21')](saveUpdates(_0xad9eb9[_0xabeb('0x45')],null))['then'](respondWithResult(_0x340c40,null))[_0xabeb('0x43')](handleError(_0x340c40,null));};exports[_0xabeb('0x22')]=function(_0x3a2f76,_0x453c96){return db[_0xabeb('0x3b')][_0xabeb('0x49')]({'where':{'id':_0x3a2f76[_0xabeb('0x40')]['id']}})['then'](handleEntityNotFound(_0x453c96,null))[_0xabeb('0x21')](removeEntity(_0x453c96,null))['catch'](handleError(_0x453c96,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 6ce5dee..03d178e 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 _0x9957=['exports','define','Pause','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./pause.attributes'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['tools_pauses','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x427b0e,_0x578605){var _0x42fbff=function(_0x305351){while(--_0x305351){_0x427b0e['push'](_0x427b0e['shift']());}};_0x42fbff(++_0x578605);}(_0x326f,0xd1));var _0xf326=function(_0x5da70f,_0x48fc61){_0x5da70f=_0x5da70f-0x0;var _0x42df0d=_0x326f[_0x5da70f];return _0x42df0d;};'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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index f30b74d..da96203 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(_0x29bf96,_0xd75d49){var _0x373574=function(_0x3467f7){while(--_0x3467f7){_0x29bf96['push'](_0x29bf96['shift']());}};_0x373574(++_0xd75d49);}(_0x7a54,0x106));var _0x47a5=function(_0x240412,_0x48ed81){_0x240412=_0x240412-0x0;var _0x4829b2=_0x7a54[_0x240412];return _0x4829b2;};'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(_0x19a9fa,_0x515941){var _0x2a5eb2=function(_0x531ac3){while(--_0x531ac3){_0x19a9fa['push'](_0x19a9fa['shift']());}};_0x2a5eb2(++_0x515941);}(_0xb10b,0x12a));var _0xbb10=function(_0x5ee300,_0x59f054){_0x5ee300=_0x5ee300-0x0;var _0x15717b=_0xb10b[_0x5ee300];return _0x15717b;};'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 4ffd736..2698e37 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 _0x2dae=['put','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook','webhookGet','/:id','isAuthenticated','show','download','diskStorage','join','root','originalname','replace','format','%s-%s%s','basename','extname','post','file','upload'];(function(_0x548334,_0x5c6a9b){var _0x374147=function(_0xc19150){while(--_0xc19150){_0x548334['push'](_0x548334['shift']());}};_0x374147(++_0x5c6a9b);}(_0x2dae,0xc3));var _0xe2da=function(_0x3d9176,_0x399d6f){_0x3d9176=_0x3d9176-0x0;var _0x12adc5=_0x2dae[_0x3d9176];return _0x12adc5;};'use strict';var multer=require(_0xe2da('0x0'));var util=require('util');var path=require(_0xe2da('0x1'));var timeout=require(_0xe2da('0x2'));var express=require(_0xe2da('0x3'));var router=express[_0xe2da('0x4')]();var fs_extra=require(_0xe2da('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe2da('0x6'));var config=require(_0xe2da('0x7'));var controller=require(_0xe2da('0x8'));router[_0xe2da('0x9')]('/',auth['isAuthenticated'](),controller[_0xe2da('0xa')]);router[_0xe2da('0x9')](_0xe2da('0xb'),controller[_0xe2da('0xc')]);router[_0xe2da('0x9')](_0xe2da('0xd'),auth[_0xe2da('0xe')](),controller[_0xe2da('0xf')]);router[_0xe2da('0x9')]('/:id/download',auth[_0xe2da('0xe')](),controller[_0xe2da('0x10')]);var upload=multer({'storage':multer[_0xe2da('0x11')]({'destination':function(_0x17086c,_0x3c1309,_0x44ec3e){_0x44ec3e(null,path[_0xe2da('0x12')](config[_0xe2da('0x13')],'server/files/plugins'));},'filename':function(_0xb98909,_0x5200b1,_0x4377c6){_0x5200b1[_0xe2da('0x14')]=_0x5200b1[_0xe2da('0x14')][_0xe2da('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4377c6(null,util[_0xe2da('0x16')](_0xe2da('0x17'),path[_0xe2da('0x18')](_0x5200b1['originalname'],path[_0xe2da('0x19')](_0x5200b1['originalname'])),Date['now'](),path[_0xe2da('0x19')](_0x5200b1[_0xe2da('0x14')])));}})});router[_0xe2da('0x1a')]('/',upload['single'](_0xe2da('0x1b')),controller[_0xe2da('0x1c')]);router[_0xe2da('0x1a')](_0xe2da('0xb'),controller['webhookPost']);router[_0xe2da('0x1d')](_0xe2da('0xd'),auth[_0xe2da('0xe')](),controller[_0xe2da('0x1e')]);router[_0xe2da('0x1f')]('/:id',auth[_0xe2da('0xe')](),controller[_0xe2da('0x1f')]);module['exports']=router; \ No newline at end of file +var _0xa8a8=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','/:id/download','download','diskStorage','join','server/files/plugins','originalname','format','%s-%s%s','basename','extname','now','single','file','upload','post','put','update','delete','multer','util'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xa8a8,0xec));var _0x8a8a=function(_0x58340b,_0x1c1e4b){_0x58340b=_0x58340b-0x0;var _0xfbda11=_0xa8a8[_0x58340b];return _0xfbda11;};'use strict';var multer=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var path=require(_0x8a8a('0x2'));var timeout=require(_0x8a8a('0x3'));var express=require('express');var router=express[_0x8a8a('0x4')]();var fs_extra=require(_0x8a8a('0x5'));var auth=require(_0x8a8a('0x6'));var interaction=require(_0x8a8a('0x7'));var config=require(_0x8a8a('0x8'));var controller=require(_0x8a8a('0x9'));router[_0x8a8a('0xa')]('/',auth[_0x8a8a('0xb')](),controller[_0x8a8a('0xc')]);router[_0x8a8a('0xa')](_0x8a8a('0xd'),controller[_0x8a8a('0xe')]);router[_0x8a8a('0xa')](_0x8a8a('0xf'),auth[_0x8a8a('0xb')](),controller['show']);router['get'](_0x8a8a('0x10'),auth['isAuthenticated'](),controller[_0x8a8a('0x11')]);var upload=multer({'storage':multer[_0x8a8a('0x12')]({'destination':function(_0x532621,_0x118380,_0x76b586){_0x76b586(null,path[_0x8a8a('0x13')](config['root'],_0x8a8a('0x14')));},'filename':function(_0x42fab7,_0x330796,_0x234481){_0x330796['originalname']=_0x330796[_0x8a8a('0x15')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x234481(null,util[_0x8a8a('0x16')](_0x8a8a('0x17'),path[_0x8a8a('0x18')](_0x330796[_0x8a8a('0x15')],path[_0x8a8a('0x19')](_0x330796[_0x8a8a('0x15')])),Date[_0x8a8a('0x1a')](),path['extname'](_0x330796[_0x8a8a('0x15')])));}})});router['post']('/',upload[_0x8a8a('0x1b')](_0x8a8a('0x1c')),controller[_0x8a8a('0x1d')]);router[_0x8a8a('0x1e')](_0x8a8a('0xd'),controller['webhookPost']);router[_0x8a8a('0x1f')](_0x8a8a('0xf'),auth[_0x8a8a('0xb')](),controller[_0x8a8a('0x20')]);router[_0x8a8a('0x21')](_0x8a8a('0xf'),auth['isAuthenticated'](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 93f43bb..adc9cc2 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 _0x8ed6=['adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','ENUM'];(function(_0x29ce14,_0x334166){var _0x48f289=function(_0x288d11){while(--_0x288d11){_0x29ce14['push'](_0x29ce14['shift']());}};_0x48f289(++_0x334166);}(_0x8ed6,0x1f3));var _0x68ed=function(_0x3a6bff,_0x1f4cfb){_0x3a6bff=_0x3a6bff-0x0;var _0x8aa90=_0x8ed6[_0x3a6bff];return _0x8aa90;};'use strict';var Sequelize=require('sequelize');module[_0x68ed('0x0')]={'name':{'type':Sequelize[_0x68ed('0x1')]},'type':{'type':Sequelize['ENUM'](_0x68ed('0x2'),'script')},'description':{'type':Sequelize[_0x68ed('0x3')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x68ed('0x1')],'comment':_0x68ed('0x4')},'active':{'type':Sequelize[_0x68ed('0x5')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x68ed('0x6')](_0x68ed('0x7'),_0x68ed('0x8'),_0x68ed('0x9'),'never'),'defaultValue':_0x68ed('0x9'),'comment':_0x68ed('0xa')},'icon':{'type':Sequelize[_0x68ed('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x68ed('0x1')]}}; \ No newline at end of file +var _0x3754=['ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING'];(function(_0x18c28d,_0x9de8a1){var _0x43e691=function(_0x4755c0){while(--_0x4755c0){_0x18c28d['push'](_0x18c28d['shift']());}};_0x43e691(++_0x9de8a1);}(_0x3754,0x1ca));var _0x4375=function(_0xc2da1,_0x39dace){_0xc2da1=_0xc2da1-0x0;var _0x4631d3=_0x3754[_0xc2da1];return _0x4631d3;};'use strict';var Sequelize=require('sequelize');module[_0x4375('0x0')]={'name':{'type':Sequelize[_0x4375('0x1')]},'type':{'type':Sequelize[_0x4375('0x2')](_0x4375('0x3'),'script')},'description':{'type':Sequelize[_0x4375('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x4375('0x1')],'comment':_0x4375('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x4375('0x6')},'sidebar':{'type':Sequelize[_0x4375('0x2')](_0x4375('0x7'),_0x4375('0x8'),'always','never'),'defaultValue':'always','comment':_0x4375('0x9')},'icon':{'type':Sequelize[_0x4375('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x4375('0x1')]},'scriptName':{'type':Sequelize[_0x4375('0x1')]},'scriptPath':{'type':Sequelize[_0x4375('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 293d4e8..521e7c4 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 _0x43f2=['order','sort','where','filter','merge','type','options','Plugin','include','findAll','params','find','catch','download','root','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','glob','**/*','join','server/files/plugins','node_modules/**/*','close','existsSync','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x46340f,_0x154fdc){var _0x4b6d32=function(_0x1a8d28){while(--_0x1a8d28){_0x46340f['push'](_0x46340f['shift']());}};_0x4b6d32(++_0x154fdc);}(_0x43f2,0x10e));var _0x243f=function(_0x5a9c06,_0x9f9141){_0x5a9c06=_0x5a9c06-0x0;var _0x57a33f=_0x43f2[_0x5a9c06];return _0x57a33f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x243f('0x0'));var rp=require(_0x243f('0x1'));var moment=require(_0x243f('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x243f('0x3'));var path=require(_0x243f('0x4'));var sox=require(_0x243f('0x5'));var csv=require(_0x243f('0x6'));var ejs=require(_0x243f('0x7'));var fs=require('fs');var fs_extra=require(_0x243f('0x8'));var _=require(_0x243f('0x9'));var squel=require(_0x243f('0xa'));var crypto=require('crypto');var jsforce=require(_0x243f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x243f('0x6'));var querystring=require(_0x243f('0xc'));var Papa=require(_0x243f('0xd'));var extract=require('extract-zip');var rimraf=require(_0x243f('0xe'));var archiver=require(_0x243f('0xf'));var Redis=require(_0x243f('0x10'));var authService=require(_0x243f('0x11'));var qs=require(_0x243f('0x12'));var as=require(_0x243f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x243f('0x14'));var utils=require(_0x243f('0x15'));var config=require(_0x243f('0x16'));var licenseUtil=require(_0x243f('0x17'));var db=require(_0x243f('0x18'))['db'];config[_0x243f('0x19')]=_[_0x243f('0x1a')](config[_0x243f('0x19')],{'host':_0x243f('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x243f('0x19')]));require('./plugin.socket')[_0x243f('0x1c')](socket);function respondWithStatusCode(_0x3cad9d,_0x5582dc){_0x5582dc=_0x5582dc||0xcc;return function(_0x45fa9c){if(_0x45fa9c){return _0x3cad9d['sendStatus'](_0x5582dc);}return _0x3cad9d['status'](_0x5582dc)[_0x243f('0x1d')]();};}function respondWithResult(_0x5e9951,_0x597240){_0x597240=_0x597240||0xc8;return function(_0x477010){if(_0x477010){return _0x5e9951[_0x243f('0x1e')](_0x597240)[_0x243f('0x1f')](_0x477010);}};}function respondWithFilteredResult(_0xb134f4,_0x323d3a){return function(_0x5e6567){if(_0x5e6567){var _0x43465a=typeof _0x323d3a[_0x243f('0x20')]===_0x243f('0x21')&&typeof _0x323d3a[_0x243f('0x22')]==='undefined';var _0x15f67d=_0x5e6567[_0x243f('0x23')];var _0x58230a=_0x43465a?0x0:_0x323d3a[_0x243f('0x20')];var _0x2fa3c=_0x43465a?_0x5e6567[_0x243f('0x23')]:_0x323d3a['offset']+_0x323d3a[_0x243f('0x22')];var _0x40b342;if(_0x2fa3c>=_0x15f67d){_0x2fa3c=_0x15f67d;_0x40b342=0xc8;}else{_0x40b342=0xce;}_0xb134f4['status'](_0x40b342);return _0xb134f4['set'](_0x243f('0x24'),_0x58230a+'-'+_0x2fa3c+'/'+_0x15f67d)[_0x243f('0x1f')](_0x5e6567);}return null;};}function patchUpdates(_0x80649b){return function(_0x3746a9){try{jsonpatch[_0x243f('0x25')](_0x3746a9,_0x80649b,!![]);}catch(_0x1f1e86){return BPromise[_0x243f('0x26')](_0x1f1e86);}return _0x3746a9[_0x243f('0x27')]();};}function saveUpdates(_0x3da920,_0xc5d3f0){return function(_0x25e547){if(_0x25e547){return _0x25e547[_0x243f('0x28')](_0x3da920)[_0x243f('0x29')](function(_0x594a2e){return _0x594a2e;});}return null;};}function removeEntity(_0x5d007a,_0x5c97f3){return function(_0x448c88){if(_0x448c88){return _0x448c88[_0x243f('0x2a')]()[_0x243f('0x29')](function(){var _0x56a51b=_0x448c88[_0x243f('0x2b')]({'plain':!![]});var _0x57bf67=_0x243f('0x2c');return db[_0x243f('0x2d')][_0x243f('0x2a')]({'where':{'type':_0x57bf67,'resourceId':_0x56a51b['id']}})['then'](function(){return _0x448c88;});})[_0x243f('0x29')](function(){_0x5d007a['status'](0xcc)[_0x243f('0x1d')]();});}};}function handleEntityNotFound(_0x2a0d0d,_0x3fcba4){return function(_0x4837f2){if(!_0x4837f2){_0x2a0d0d[_0x243f('0x2e')](0x194);}return _0x4837f2;};}function handleError(_0x5244c4,_0x3a707a){_0x3a707a=_0x3a707a||0x1f4;return function(_0x500573){logger[_0x243f('0x2f')](_0x500573[_0x243f('0x30')]);if(_0x500573[_0x243f('0x31')]){delete _0x500573['name'];}_0x5244c4[_0x243f('0x1e')](_0x3a707a)[_0x243f('0x32')](_0x500573);};}exports[_0x243f('0x33')]=function(_0x40467f,_0x55c204){var _0x43140f={},_0x230762={},_0x2f0444={'count':0x0,'rows':[]};var _0x532e28=_[_0x243f('0x34')](db['Plugin'][_0x243f('0x35')],function(_0x2163d8){return{'name':_0x2163d8['fieldName'],'type':_0x2163d8['type']['key']};});_0x230762['model']=_[_0x243f('0x34')](_0x532e28,_0x243f('0x31'));_0x230762['query']=_[_0x243f('0x36')](_0x40467f[_0x243f('0x37')]);_0x230762[_0x243f('0x38')]=_[_0x243f('0x39')](_0x230762[_0x243f('0x3a')],_0x230762[_0x243f('0x37')]);_0x43140f[_0x243f('0x3b')]=_[_0x243f('0x39')](_0x230762['model'],qs[_0x243f('0x3c')](_0x40467f[_0x243f('0x37')][_0x243f('0x3c')]));_0x43140f[_0x243f('0x3b')]=_0x43140f['attributes'][_0x243f('0x3d')]?_0x43140f[_0x243f('0x3b')]:_0x230762[_0x243f('0x3a')];if(!_0x40467f['query'][_0x243f('0x3e')](_0x243f('0x3f'))){_0x43140f['limit']=qs['limit'](_0x40467f[_0x243f('0x37')][_0x243f('0x22')]);_0x43140f[_0x243f('0x20')]=qs[_0x243f('0x20')](_0x40467f[_0x243f('0x37')][_0x243f('0x20')]);}_0x43140f[_0x243f('0x40')]=qs['sort'](_0x40467f[_0x243f('0x37')][_0x243f('0x41')]);_0x43140f[_0x243f('0x42')]=qs[_0x243f('0x38')](_['pick'](_0x40467f[_0x243f('0x37')],_0x230762[_0x243f('0x38')]),_0x532e28);if(_0x40467f[_0x243f('0x37')][_0x243f('0x43')]){_0x43140f['where']=_[_0x243f('0x44')](_0x43140f[_0x243f('0x42')],{'$or':_[_0x243f('0x34')](_0x532e28,function(_0x1abf37){if(_0x1abf37[_0x243f('0x45')]!=='VIRTUAL'){var _0x50b342={};_0x50b342[_0x1abf37[_0x243f('0x31')]]={'$like':'%'+_0x40467f[_0x243f('0x37')][_0x243f('0x43')]+'%'};return _0x50b342;}})});}_0x43140f=_[_0x243f('0x44')]({},_0x43140f,_0x40467f[_0x243f('0x46')]);var _0x1ef838={'where':_0x43140f['where']};return db[_0x243f('0x47')][_0x243f('0x23')](_0x1ef838)['then'](function(_0x1fbf04){_0x2f0444[_0x243f('0x23')]=_0x1fbf04;if(_0x40467f[_0x243f('0x37')]['includeAll']){_0x43140f[_0x243f('0x48')]=[{'all':!![]}];}return db['Plugin'][_0x243f('0x49')](_0x43140f);})['then'](function(_0xbd446d){_0x2f0444['rows']=_0xbd446d;return _0x2f0444;})[_0x243f('0x29')](respondWithFilteredResult(_0x55c204,_0x43140f))['catch'](handleError(_0x55c204,null));};exports['show']=function(_0x57697c,_0x4199ba){var _0x4b543c={'raw':!![],'where':{'id':_0x57697c[_0x243f('0x4a')]['id']}},_0x20918d={};_0x20918d[_0x243f('0x3a')]=_[_0x243f('0x36')](db[_0x243f('0x47')][_0x243f('0x35')]);_0x20918d['query']=_['keys'](_0x57697c[_0x243f('0x37')]);_0x20918d['filters']=_[_0x243f('0x39')](_0x20918d[_0x243f('0x3a')],_0x20918d[_0x243f('0x37')]);_0x4b543c[_0x243f('0x3b')]=_[_0x243f('0x39')](_0x20918d[_0x243f('0x3a')],qs[_0x243f('0x3c')](_0x57697c[_0x243f('0x37')][_0x243f('0x3c')]));_0x4b543c[_0x243f('0x3b')]=_0x4b543c[_0x243f('0x3b')][_0x243f('0x3d')]?_0x4b543c[_0x243f('0x3b')]:_0x20918d[_0x243f('0x3a')];if(_0x57697c[_0x243f('0x37')]['includeAll']){_0x4b543c[_0x243f('0x48')]=[{'all':!![]}];}_0x4b543c=_[_0x243f('0x44')]({},_0x4b543c,_0x57697c[_0x243f('0x46')]);return db[_0x243f('0x47')][_0x243f('0x4b')](_0x4b543c)[_0x243f('0x29')](handleEntityNotFound(_0x4199ba,null))[_0x243f('0x29')](respondWithResult(_0x4199ba,null))[_0x243f('0x4c')](handleError(_0x4199ba,null));};exports[_0x243f('0x4d')]=function(_0x4ffe70,_0x8b1335,_0x272ac1){return db[_0x243f('0x47')][_0x243f('0x4b')]({'where':{'id':_0x4ffe70[_0x243f('0x4a')]['id']},'attributes':[_0x243f('0x31'),_0x243f('0x4')],'raw':!![]})['then'](handleEntityNotFound(_0x8b1335,null))[_0x243f('0x29')](function(_0x622193){if(_0x622193){var _0x5bf101=path['join'](config[_0x243f('0x4e')],'server/files/plugins',util[_0x243f('0x4f')](_0x243f('0x50'),path[_0x243f('0x51')](_0x622193[_0x243f('0x4')])));var _0x27169b=fs[_0x243f('0x52')](_0x5bf101);var _0x12e014=archiver(_0x243f('0x53'),{'zlib':{'level':0x9}});_0x12e014['on'](_0x243f('0x54'),function(_0x588429){if(_0x588429[_0x243f('0x55')]===_0x243f('0x56')){logger['error'](_0x588429);}else{throw new db['Sequelize'][(_0x243f('0x57'))](_0x243f('0x58'));}});_0x12e014['on'](_0x243f('0x2f'),function(_0x13dc8e){throw new db[(_0x243f('0x59'))][(_0x243f('0x57'))](_0x243f('0x58'));});_0x12e014[_0x243f('0x5a')](_0x27169b);_0x12e014[_0x243f('0x5b')](_0x243f('0x5c'),{'cwd':path[_0x243f('0x5d')](config[_0x243f('0x4e')],_0x243f('0x5e'),path['dirname'](_0x622193[_0x243f('0x4')])),'ignore':[path[_0x243f('0x5d')](path[_0x243f('0x51')](_0x622193[_0x243f('0x4')]),_0x243f('0x5f')),path[_0x243f('0x5d')](path[_0x243f('0x51')](_0x622193[_0x243f('0x4')]),'attachments/**/*')],'nodir':!![]})['finalize']();_0x27169b['on'](_0x243f('0x60'),function(){if(!fs[_0x243f('0x61')](_0x5bf101)){throw new db[(_0x243f('0x59'))]['Error']('Plugin\x20not\x20found');}return _0x8b1335['download'](_0x5bf101,util[_0x243f('0x4f')]('%s.zip',path[_0x243f('0x51')](_0x622193['path'])),function(_0x4f395c){if(_0x4f395c){throw new db[(_0x243f('0x59'))][(_0x243f('0x57'))](_0x243f('0x62'));}fs[_0x243f('0x63')](_0x5bf101);logger[_0x243f('0x64')](_0x243f('0x65'));logger[_0x243f('0x64')](_0x243f('0x66'));});});}return null;})[_0x243f('0x4c')](handleError(_0x8b1335,null));};exports[_0x243f('0x67')]=function(_0x442b56,_0x2a358c,_0xe70e29){var _0x590b48=path[_0x243f('0x51')](_0x442b56[_0x243f('0x68')][_0x243f('0x69')],path[_0x243f('0x6a')](_0x442b56[_0x243f('0x68')]['filename']));var _0x461da3=path[_0x243f('0x5d')](config[_0x243f('0x4e')],_0x243f('0x5e'),_0x442b56[_0x243f('0x68')][_0x243f('0x69')]);var _0x3a5f5d=path[_0x243f('0x5d')](config[_0x243f('0x4e')],_0x243f('0x5e'),_0x590b48);logger[_0x243f('0x64')](_0x243f('0x6b'),_0x461da3);logger[_0x243f('0x64')](_0x243f('0x6c'),_0x3a5f5d);try{fs[_0x243f('0x6d')](_0x461da3,parseInt('0777',0x8));extract(_0x461da3,{'dir':_0x3a5f5d},function(_0x5046cb){if(_0x5046cb){logger['error'](_0x5046cb);handleError(_0x5046cb,!![]);};var _0x5f5d5d=fs[_0x243f('0x6e')](_0x3a5f5d);if(_0x5f5d5d[_0x243f('0x3d')]>0x1){removeReferences(_0x461da3,_0x3a5f5d);logger[_0x243f('0x2f')](_0x243f('0x6f'));return _0xe70e29(new Error(_0x243f('0x6f')));}var _0x54bec0=fs[_0x243f('0x70')](path['join'](_0x3a5f5d,_0x5f5d5d[0x0]));if(_0x54bec0['isFile']()){removeReferences(_0x461da3,_0x3a5f5d);logger[_0x243f('0x2f')](_0x243f('0x6f'));return _0xe70e29(new Error('Invalid\x20plugin\x20structure'));}if(_0x54bec0[_0x243f('0x71')]()){var _0x14e3cc=fs[_0x243f('0x6e')](path[_0x243f('0x5d')](_0x3a5f5d,_0x5f5d5d[0x0]));if(_0x14e3cc[_0x243f('0x3d')]===0x0){removeReferences(_0x461da3,_0x3a5f5d);logger[_0x243f('0x2f')](_0x243f('0x6f'));return _0xe70e29(new Error('Invalid\x20plugin\x20structure'));}var _0x544f3f=_0x14e3cc[_0x243f('0x72')](function(_0x152fea){return _0x152fea===_0x243f('0x73');});if(!_0x544f3f){return _0xe70e29(new Error('Plugin\x20manifest\x20missing'));}var _0x421814=fs['readFileSync'](path[_0x243f('0x5d')](_0x3a5f5d,_0x5f5d5d[0x0],_0x243f('0x73')));var _0x54c8ca=JSON[_0x243f('0x74')](_0x421814);if('undefined'==typeof _0x54c8ca[_0x243f('0x31')]){return _0xe70e29(new Error(_0x243f('0x75')));}if(_0x243f('0x21')==typeof _0x54c8ca[_0x243f('0x45')]){return _0xe70e29(new Error(_0x243f('0x76')));}if(_0x243f('0x21')==typeof _0x54c8ca[_0x243f('0x77')]){return _0xe70e29(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x54c8ca['parameters']){return _0xe70e29(new Error(_0x243f('0x78')));}if(_0x54c8ca['type']===_0x243f('0x79')){if(_0x243f('0x21')==typeof _0x54c8ca[_0x243f('0x7a')][_0x243f('0x7b')]){return _0xe70e29(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x54c8ca[_0x243f('0x7a')][_0x243f('0x7b')]['admin']&&_0x243f('0x21')==typeof _0x54c8ca[_0x243f('0x7a')][_0x243f('0x7b')][_0x243f('0x7c')]){return _0xe70e29(new Error(_0x243f('0x7d')));}}else if(_0x54c8ca['type']===_0x243f('0x7e')){if('undefined'==typeof _0x54c8ca[_0x243f('0x7a')]['scriptName']){return _0xe70e29(new Error(_0x243f('0x7f')));}if(_0x243f('0x21')==typeof _0x54c8ca[_0x243f('0x7a')][_0x243f('0x80')]){return _0xe70e29(new Error(_0x243f('0x81')));}}else{return _0xe70e29(new Error(_0x243f('0x82')));}var _0x489251=_0x54c8ca[_0x243f('0x31')];var _0x5e8d40=_0x54c8ca[_0x243f('0x83')];var _0x4ed6cb=_0x54c8ca['type'];var _0x2849a3=_0x54c8ca['sidebar']?_0x54c8ca[_0x243f('0x84')]:_0x243f('0x85');var _0x2e1905=_0x54c8ca[_0x243f('0x86')]?_0x54c8ca['icon']:'icon-apps';var _0x495f30='';var _0x289d3b='';var _0x56034b='';var _0x13ccc8='';var _0x4361fb=_0x54c8ca[_0x243f('0x77')];if(_0x4ed6cb===_0x243f('0x79')){if(_0x243f('0x21')!=typeof _0x54c8ca[_0x243f('0x7a')][_0x243f('0x7b')]['admin']){var _0x418f5d=_0x54c8ca['parameters']['views'][_0x243f('0x87')];if(!/^(f|ht)tps?:\/\//i[_0x243f('0x88')](_0x418f5d)){_0x495f30=path[_0x243f('0x5d')](_0x243f('0x89'),_0x590b48,_0x5f5d5d[0x0],_0x418f5d);}else{_0x495f30=_0x418f5d;}}else{logger[_0x243f('0x64')](_0x243f('0x8a'));}if('undefined'!=typeof _0x54c8ca[_0x243f('0x7a')][_0x243f('0x7b')][_0x243f('0x7c')]){var _0x54839e=_0x54c8ca[_0x243f('0x7a')][_0x243f('0x7b')][_0x243f('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x243f('0x88')](_0x54839e)){_0x289d3b=path['join'](_0x243f('0x89'),_0x590b48,_0x5f5d5d[0x0],_0x54839e);}else{_0x289d3b=_0x54839e;}}else{logger[_0x243f('0x64')](_0x243f('0x8b'));}}else if(_0x4ed6cb==='script'){_0x56034b=_0x54c8ca[_0x243f('0x7a')][_0x243f('0x8c')];_0x13ccc8=_0x54c8ca[_0x243f('0x7a')][_0x243f('0x80')];if(_0x243f('0x21')!=typeof _0x54c8ca[_0x243f('0x7a')]['views']){if('undefined'!=typeof _0x54c8ca[_0x243f('0x7a')][_0x243f('0x7b')][_0x243f('0x87')]){var _0x418f5d=_0x54c8ca['parameters']['views'][_0x243f('0x87')];if(!/^(f|ht)tps?:\/\//i[_0x243f('0x88')](_0x418f5d)){_0x495f30=path[_0x243f('0x5d')](_0x243f('0x89'),_0x590b48,_0x5f5d5d[0x0],_0x418f5d);}else{_0x495f30=_0x418f5d;}}if('undefined'!=typeof _0x54c8ca['parameters']['views'][_0x243f('0x7c')]){var _0x54839e=_0x54c8ca[_0x243f('0x7a')]['views'][_0x243f('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x243f('0x88')](_0x54839e)){_0x289d3b=path[_0x243f('0x5d')](_0x243f('0x89'),_0x590b48,_0x5f5d5d[0x0],_0x54839e);}else{_0x289d3b=_0x54839e;}}}}var _0x170ca8={'name':_0x489251,'description':_0x5e8d40,'path':path['join'](_0x590b48,_0x5f5d5d[0x0]),'type':_0x4ed6cb,'sidebar':_0x2849a3,'icon':_0x2e1905,'adminUrl':_0x495f30,'agentUrl':_0x289d3b,'scriptName':_0x56034b,'scriptPath':_0x13ccc8,'version':_0x4361fb};removeReferences(_0x461da3,null);return db['Plugin'][_0x243f('0x8d')](_0x170ca8)[_0x243f('0x29')](function(_0x5ce71b){var _0x406bfa={'role':_0x442b56[_0x243f('0x8e')][_0x243f('0x8f')],'userProfileId':_0x442b56[_0x243f('0x8e')][_0x243f('0x90')]};if(!_0x406bfa)throw new Error(_0x243f('0x91'));if(_0x406bfa[_0x243f('0x8f')]===_0x243f('0x92')){var _0x3c6103=_0x5ce71b[_0x243f('0x2b')]({'plain':!![]});return db[_0x243f('0x93')][_0x243f('0x4b')]({'where':{'name':_0x243f('0x2c'),'userProfileId':_0x406bfa[_0x243f('0x90')]},'raw':!![]})[_0x243f('0x29')](function(_0x4e2fca){if(_0x4e2fca&&_0x4e2fca['autoAssociation']===0x0){return db[_0x243f('0x2d')][_0x243f('0x8d')]({'name':_0x3c6103[_0x243f('0x31')],'resourceId':_0x3c6103['id'],'type':_0x4e2fca[_0x243f('0x31')],'sectionId':_0x4e2fca['id']},{})['then'](function(){return _0x5ce71b;});}else{return _0x5ce71b;}})['catch'](function(_0x2f1766){logger[_0x243f('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f1766);throw _0x2f1766;});}return _0x5ce71b;})[_0x243f('0x29')](respondWithResult(_0x2a358c,null))['catch'](handleError(_0x2a358c,null));}});}catch(_0x3a4203){_0x2a358c[_0x243f('0x1e')](0x1f4)[_0x243f('0x32')](_0x3a4203);}};function removeReferences(_0x2df9c7,_0x19cf03){try{if(_0x2df9c7){fs[_0x243f('0x63')](_0x2df9c7);logger[_0x243f('0x64')]('Zip\x20archive\x20removed');}if(_0x19cf03){rimraf(_0x19cf03,function(){});logger[_0x243f('0x64')](_0x243f('0x94'));}}catch(_0x116f7e){logger['error'](_0x116f7e);}}exports[_0x243f('0x28')]=function(_0x574c93,_0x96db42,_0x3afa70){return db[_0x243f('0x47')]['find']({'where':{'id':_0x574c93['params']['id']}})[_0x243f('0x29')](handleEntityNotFound(_0x96db42,null))[_0x243f('0x29')](saveUpdates(_0x574c93[_0x243f('0x8e')],null))[_0x243f('0x29')](respondWithResult(_0x96db42,null))[_0x243f('0x4c')](handleError(_0x96db42,null));};exports[_0x243f('0x95')]=function(_0x591b84,_0xd8fc8c,_0x43689b){return db[_0x243f('0x47')][_0x243f('0x4b')]({'where':{'id':_0x591b84[_0x243f('0x4a')]['id']}})[_0x243f('0x29')](function(_0x55ca9d){if(_0x55ca9d){return _0x55ca9d[_0x243f('0x2a')]();}})[_0x243f('0x29')](function(_0xc62adb){rimraf(path['join'](config[_0x243f('0x4e')],'server/files/plugins',path['dirname'](_0xc62adb[_0x243f('0x4')])),function(){});return _0xc62adb;})[_0x243f('0x29')](handleEntityNotFound(_0xd8fc8c,null))[_0x243f('0x29')](respondWithStatusCode(_0xd8fc8c,null))[_0x243f('0x4c')](handleError(_0xd8fc8c,null));};exports[_0x243f('0x96')]=function(_0x2e3a1b,_0x10ebde,_0x322440){return BPromise[_0x243f('0x97')]()[_0x243f('0x29')](function(){if(!_0x2e3a1b[_0x243f('0x37')]['path']){throw new Error(_0x243f('0x98'));}if(!_0x2e3a1b['query']['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x3600fd=_0x2e3a1b[_0x243f('0x37')][_0x243f('0x99')]?_0x2e3a1b[_0x243f('0x37')][_0x243f('0x99')]+':'+_0x2e3a1b[_0x243f('0x37')][_0x243f('0x9a')]:_0x243f('0x9b')+_0x2e3a1b['query']['port'];var _0x34a017=_0x2e3a1b['query'][_0x243f('0x1f')]?_0x2e3a1b[_0x243f('0x37')][_0x243f('0x1f')]:!![];var _0x1f710a=_0x2e3a1b[_0x243f('0x37')][_0x243f('0x9c')]?_0x2e3a1b[_0x243f('0x37')][_0x243f('0x9c')]:null;var _0x4a65d0={'method':_0x2e3a1b[_0x243f('0x9d')],'uri':util['format'](_0x243f('0x9e'),_0x3600fd,_0x2e3a1b[_0x243f('0x37')][_0x243f('0x4')]),'json':_0x34a017,'resolveWithFullResponse':!![],'encoding':_0x1f710a,'qs':_0x2e3a1b[_0x243f('0x37')]};if(_0x2e3a1b[_0x243f('0x9f')]){_0x4a65d0[_0x243f('0x9f')]=_0x2e3a1b[_0x243f('0x9f')];if(_0x4a65d0[_0x243f('0x9f')][_0x243f('0xa0')]){delete _0x4a65d0[_0x243f('0x9f')]['content-length'];}}if(_0x4a65d0[_0x243f('0x9f')][_0x243f('0xa1')]){delete _0x4a65d0[_0x243f('0x9f')][_0x243f('0xa1')];}return rp(_0x4a65d0);})[_0x243f('0x29')](function(_0x52e105){if(_0x52e105){_0x10ebde[_0x243f('0xa2')](_0x52e105[_0x243f('0x9f')]);logger[_0x243f('0x64')](_0x52e105[_0x243f('0x8e')]);if(_[_0x243f('0xa3')](_0x2e3a1b[_0x243f('0x37')][_0x243f('0x4')],_0x243f('0x4d'))&&_0x52e105[_0x243f('0xa4')]==0x1f4){return _0x10ebde[_0x243f('0x2e')](_0x52e105[_0x243f('0xa4')]);}else{return _0x10ebde[_0x243f('0x1e')](_0x52e105[_0x243f('0xa4')])[_0x243f('0x32')](_0x52e105[_0x243f('0x8e')]);}}else{return _0x10ebde[_0x243f('0x2e')](0xc8);}})['catch'](handleError(_0x10ebde,null));};exports[_0x243f('0xa5')]=function(_0x5cdf88,_0x3f1ada,_0x2f83b1){return BPromise[_0x243f('0x97')]()[_0x243f('0x29')](function(){if(!_0x5cdf88['query'][_0x243f('0x4')]){throw new Error(_0x243f('0x98'));}if(!_0x5cdf88[_0x243f('0x37')][_0x243f('0x9a')]){throw new Error(_0x243f('0xa6'));}var _0x320cbd=_0x5cdf88[_0x243f('0x37')][_0x243f('0x99')]?_0x5cdf88[_0x243f('0x37')][_0x243f('0x99')]+':'+_0x5cdf88['query'][_0x243f('0x9a')]:_0x243f('0x9b')+_0x5cdf88[_0x243f('0x37')][_0x243f('0x9a')];var _0x503c00=_0x5cdf88[_0x243f('0x37')][_0x243f('0x1f')]?_0x5cdf88[_0x243f('0x37')][_0x243f('0x1f')]:!![];var _0x227126=_0x5cdf88[_0x243f('0x37')][_0x243f('0x9c')]?_0x5cdf88['query'][_0x243f('0x9c')]:null;var _0x4fd34e={'method':_0x5cdf88['method'],'uri':util['format'](_0x243f('0x9e'),_0x320cbd,_0x5cdf88[_0x243f('0x37')][_0x243f('0x4')]),'json':_0x503c00,'resolveWithFullResponse':!![],'encoding':_0x227126,'body':_0x5cdf88[_0x243f('0x8e')]};if(_0x5cdf88['headers']){_0x4fd34e[_0x243f('0x9f')]=_0x5cdf88['headers'];if(_0x4fd34e['headers'][_0x243f('0xa0')]){delete _0x4fd34e['headers']['content-length'];}}if(_0x4fd34e[_0x243f('0x9f')][_0x243f('0xa1')]){delete _0x4fd34e[_0x243f('0x9f')][_0x243f('0xa1')];}return rp(_0x4fd34e);})['then'](function(_0x4d92d8){if(_0x4d92d8){_0x3f1ada[_0x243f('0xa2')](_0x4d92d8[_0x243f('0x9f')]);logger[_0x243f('0x64')](_0x4d92d8[_0x243f('0x8e')]);return _0x3f1ada['status'](_0x4d92d8['statusCode'])['send'](_0x4d92d8[_0x243f('0x8e')]);}else{return _0x3f1ada['sendStatus'](0xc8);}})[_0x243f('0x4c')](handleError(_0x3f1ada,null));}; \ No newline at end of file +var _0x0782=['Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','description','sidebar','icon','icon-apps','version','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','delete','webhookGet','port','hostname','encoding','method','%s%s','headers','content-length','content-type','endsWith','download','statusCode','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./plugin.socket','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','get','Plugins','sendStatus','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','options','includeAll','include','rows','catch','show','find','params','join','server/files/plugins','format','%s.zip','basename','createWriteStream','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','root','dirname','node_modules/**/*','attachments/**/*','close','existsSync','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename'];(function(_0x1911ed,_0x4e8c73){var _0x11edaa=function(_0x216008){while(--_0x216008){_0x1911ed['push'](_0x1911ed['shift']());}};_0x11edaa(++_0x4e8c73);}(_0x0782,0x171));var _0x2078=function(_0x35a274,_0x98b399){_0x35a274=_0x35a274-0x0;var _0x40d905=_0x0782[_0x35a274];return _0x40d905;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2078('0x0'));var zipdir=require(_0x2078('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2078('0x2'));var moment=require(_0x2078('0x3'));var BPromise=require(_0x2078('0x4'));var Mustache=require(_0x2078('0x5'));var util=require('util');var path=require(_0x2078('0x6'));var sox=require(_0x2078('0x7'));var csv=require('to-csv');var ejs=require(_0x2078('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2078('0x9'));var squel=require(_0x2078('0xa'));var crypto=require(_0x2078('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2078('0xc'));var toCsv=require(_0x2078('0xd'));var querystring=require(_0x2078('0xe'));var Papa=require(_0x2078('0xf'));var extract=require('extract-zip');var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require(_0x2078('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2078('0x11'));var as=require(_0x2078('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2078('0x13'))(_0x2078('0x14'));var utils=require('../../config/utils');var config=require(_0x2078('0x15'));var licenseUtil=require(_0x2078('0x16'));var db=require(_0x2078('0x17'))['db'];config[_0x2078('0x18')]=_[_0x2078('0x19')](config[_0x2078('0x18')],{'host':_0x2078('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2078('0x18')]));require(_0x2078('0x1b'))['register'](socket);function respondWithStatusCode(_0x36f779,_0x3c4ae7){_0x3c4ae7=_0x3c4ae7||0xcc;return function(_0x183f4a){if(_0x183f4a){return _0x36f779['sendStatus'](_0x3c4ae7);}return _0x36f779[_0x2078('0x1c')](_0x3c4ae7)[_0x2078('0x1d')]();};}function respondWithResult(_0xe23bfd,_0x357e7a){_0x357e7a=_0x357e7a||0xc8;return function(_0xa37991){if(_0xa37991){return _0xe23bfd[_0x2078('0x1c')](_0x357e7a)[_0x2078('0x1e')](_0xa37991);}};}function respondWithFilteredResult(_0x1a04bd,_0xbbd288){return function(_0x35923c){if(_0x35923c){var _0x9f294e=typeof _0xbbd288[_0x2078('0x1f')]==='undefined'&&typeof _0xbbd288['limit']===_0x2078('0x20');var _0x1c3568=_0x35923c[_0x2078('0x21')];var _0x2febdb=_0x9f294e?0x0:_0xbbd288[_0x2078('0x1f')];var _0x5bb203=_0x9f294e?_0x35923c[_0x2078('0x21')]:_0xbbd288[_0x2078('0x1f')]+_0xbbd288[_0x2078('0x22')];var _0x5ac280;if(_0x5bb203>=_0x1c3568){_0x5bb203=_0x1c3568;_0x5ac280=0xc8;}else{_0x5ac280=0xce;}_0x1a04bd[_0x2078('0x1c')](_0x5ac280);return _0x1a04bd[_0x2078('0x23')](_0x2078('0x24'),_0x2febdb+'-'+_0x5bb203+'/'+_0x1c3568)[_0x2078('0x1e')](_0x35923c);}return null;};}function patchUpdates(_0x43b6fe){return function(_0x128a00){try{jsonpatch['apply'](_0x128a00,_0x43b6fe,!![]);}catch(_0x19ed3c){return BPromise[_0x2078('0x25')](_0x19ed3c);}return _0x128a00[_0x2078('0x26')]();};}function saveUpdates(_0x161a50,_0x23c937){return function(_0x864de0){if(_0x864de0){return _0x864de0[_0x2078('0x27')](_0x161a50)[_0x2078('0x28')](function(_0x42d70a){return _0x42d70a;});}return null;};}function removeEntity(_0x1ca69b,_0x28cc28){return function(_0x4d6588){if(_0x4d6588){return _0x4d6588[_0x2078('0x29')]()['then'](function(){var _0x4dd63f=_0x4d6588[_0x2078('0x2a')]({'plain':!![]});var _0x183b4d=_0x2078('0x2b');return db['UserProfileResource'][_0x2078('0x29')]({'where':{'type':_0x183b4d,'resourceId':_0x4dd63f['id']}})['then'](function(){return _0x4d6588;});})[_0x2078('0x28')](function(){_0x1ca69b[_0x2078('0x1c')](0xcc)[_0x2078('0x1d')]();});}};}function handleEntityNotFound(_0x1abdaa,_0x213b4b){return function(_0x344701){if(!_0x344701){_0x1abdaa[_0x2078('0x2c')](0x194);}return _0x344701;};}function handleError(_0x284f7c,_0x494224){_0x494224=_0x494224||0x1f4;return function(_0x24f07c){logger[_0x2078('0x2d')](_0x24f07c[_0x2078('0x2e')]);if(_0x24f07c[_0x2078('0x2f')]){delete _0x24f07c['name'];}_0x284f7c[_0x2078('0x1c')](_0x494224)[_0x2078('0x30')](_0x24f07c);};}exports[_0x2078('0x31')]=function(_0x3bc7eb,_0x19d046){var _0x25de89={},_0x2a55e4={},_0x5b46ef={'count':0x0,'rows':[]};var _0x51d1a8=_[_0x2078('0x32')](db[_0x2078('0x33')][_0x2078('0x34')],function(_0x1692b1){return{'name':_0x1692b1[_0x2078('0x35')],'type':_0x1692b1[_0x2078('0x36')]['key']};});_0x2a55e4['model']=_[_0x2078('0x32')](_0x51d1a8,_0x2078('0x2f'));_0x2a55e4[_0x2078('0x37')]=_[_0x2078('0x38')](_0x3bc7eb[_0x2078('0x37')]);_0x2a55e4[_0x2078('0x39')]=_[_0x2078('0x3a')](_0x2a55e4[_0x2078('0x3b')],_0x2a55e4[_0x2078('0x37')]);_0x25de89[_0x2078('0x3c')]=_['intersection'](_0x2a55e4[_0x2078('0x3b')],qs[_0x2078('0x3d')](_0x3bc7eb[_0x2078('0x37')]['fields']));_0x25de89[_0x2078('0x3c')]=_0x25de89[_0x2078('0x3c')][_0x2078('0x3e')]?_0x25de89[_0x2078('0x3c')]:_0x2a55e4['model'];if(!_0x3bc7eb['query'][_0x2078('0x3f')](_0x2078('0x40'))){_0x25de89['limit']=qs[_0x2078('0x22')](_0x3bc7eb[_0x2078('0x37')][_0x2078('0x22')]);_0x25de89[_0x2078('0x1f')]=qs['offset'](_0x3bc7eb[_0x2078('0x37')][_0x2078('0x1f')]);}_0x25de89['order']=qs['sort'](_0x3bc7eb['query'][_0x2078('0x41')]);_0x25de89['where']=qs[_0x2078('0x39')](_['pick'](_0x3bc7eb[_0x2078('0x37')],_0x2a55e4[_0x2078('0x39')]),_0x51d1a8);if(_0x3bc7eb[_0x2078('0x37')][_0x2078('0x42')]){_0x25de89[_0x2078('0x43')]=_[_0x2078('0x44')](_0x25de89[_0x2078('0x43')],{'$or':_[_0x2078('0x32')](_0x51d1a8,function(_0x38508a){if(_0x38508a[_0x2078('0x36')]!=='VIRTUAL'){var _0x32b2ac={};_0x32b2ac[_0x38508a['name']]={'$like':'%'+_0x3bc7eb['query'][_0x2078('0x42')]+'%'};return _0x32b2ac;}})});}_0x25de89=_['merge']({},_0x25de89,_0x3bc7eb[_0x2078('0x45')]);var _0x42ad94={'where':_0x25de89['where']};return db[_0x2078('0x33')]['count'](_0x42ad94)[_0x2078('0x28')](function(_0x962147){_0x5b46ef[_0x2078('0x21')]=_0x962147;if(_0x3bc7eb[_0x2078('0x37')][_0x2078('0x46')]){_0x25de89[_0x2078('0x47')]=[{'all':!![]}];}return db['Plugin']['findAll'](_0x25de89);})[_0x2078('0x28')](function(_0x25a7b5){_0x5b46ef[_0x2078('0x48')]=_0x25a7b5;return _0x5b46ef;})['then'](respondWithFilteredResult(_0x19d046,_0x25de89))[_0x2078('0x49')](handleError(_0x19d046,null));};exports[_0x2078('0x4a')]=function(_0x30fea2,_0x9fbc40){var _0x4fde6e={'raw':!![],'where':{'id':_0x30fea2['params']['id']}},_0x481deb={};_0x481deb[_0x2078('0x3b')]=_[_0x2078('0x38')](db[_0x2078('0x33')][_0x2078('0x34')]);_0x481deb['query']=_[_0x2078('0x38')](_0x30fea2[_0x2078('0x37')]);_0x481deb['filters']=_[_0x2078('0x3a')](_0x481deb[_0x2078('0x3b')],_0x481deb['query']);_0x4fde6e[_0x2078('0x3c')]=_[_0x2078('0x3a')](_0x481deb[_0x2078('0x3b')],qs[_0x2078('0x3d')](_0x30fea2[_0x2078('0x37')][_0x2078('0x3d')]));_0x4fde6e[_0x2078('0x3c')]=_0x4fde6e[_0x2078('0x3c')][_0x2078('0x3e')]?_0x4fde6e[_0x2078('0x3c')]:_0x481deb[_0x2078('0x3b')];if(_0x30fea2[_0x2078('0x37')][_0x2078('0x46')]){_0x4fde6e[_0x2078('0x47')]=[{'all':!![]}];}_0x4fde6e=_[_0x2078('0x44')]({},_0x4fde6e,_0x30fea2[_0x2078('0x45')]);return db[_0x2078('0x33')][_0x2078('0x4b')](_0x4fde6e)[_0x2078('0x28')](handleEntityNotFound(_0x9fbc40,null))['then'](respondWithResult(_0x9fbc40,null))[_0x2078('0x49')](handleError(_0x9fbc40,null));};exports['download']=function(_0x20907e,_0xca4f04,_0x394b99){return db[_0x2078('0x33')]['find']({'where':{'id':_0x20907e[_0x2078('0x4c')]['id']},'attributes':[_0x2078('0x2f'),_0x2078('0x6')],'raw':!![]})[_0x2078('0x28')](handleEntityNotFound(_0xca4f04,null))[_0x2078('0x28')](function(_0x1ca0a1){if(_0x1ca0a1){var _0x10cbdf=path[_0x2078('0x4d')](config['root'],_0x2078('0x4e'),util[_0x2078('0x4f')](_0x2078('0x50'),path[_0x2078('0x51')](_0x1ca0a1[_0x2078('0x6')])));var _0x313df9=fs[_0x2078('0x52')](_0x10cbdf);var _0x4245ff=archiver('zip',{'zlib':{'level':0x9}});_0x4245ff['on']('warning',function(_0xf30b1c){if(_0xf30b1c['code']===_0x2078('0x53')){logger[_0x2078('0x2d')](_0xf30b1c);}else{throw new db['Sequelize']['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x4245ff['on'](_0x2078('0x2d'),function(_0x3d3c82){throw new db[(_0x2078('0x54'))][(_0x2078('0x55'))](_0x2078('0x56'));});_0x4245ff[_0x2078('0x57')](_0x313df9);_0x4245ff[_0x2078('0x58')]('**/*',{'cwd':path[_0x2078('0x4d')](config[_0x2078('0x59')],_0x2078('0x4e'),path[_0x2078('0x5a')](_0x1ca0a1['path'])),'ignore':[path[_0x2078('0x4d')](path[_0x2078('0x51')](_0x1ca0a1['path']),_0x2078('0x5b')),path['join'](path['basename'](_0x1ca0a1[_0x2078('0x6')]),_0x2078('0x5c'))],'nodir':!![]})['finalize']();_0x313df9['on'](_0x2078('0x5d'),function(){if(!fs[_0x2078('0x5e')](_0x10cbdf)){throw new db[(_0x2078('0x54'))][(_0x2078('0x55'))]('Plugin\x20not\x20found');}return _0xca4f04['download'](_0x10cbdf,util['format']('%s.zip',path[_0x2078('0x51')](_0x1ca0a1['path'])),function(_0x3a94b3){if(_0x3a94b3){throw new db[(_0x2078('0x54'))][(_0x2078('0x55'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x2078('0x5f')](_0x10cbdf);logger[_0x2078('0x60')](_0x2078('0x61'));logger[_0x2078('0x60')](_0x2078('0x62'));});});}return null;})[_0x2078('0x49')](handleError(_0xca4f04,null));};exports[_0x2078('0x63')]=function(_0x1df390,_0x25dbd0,_0x560a89){var _0x398ea0=path[_0x2078('0x51')](_0x1df390[_0x2078('0x64')][_0x2078('0x65')],path['extname'](_0x1df390[_0x2078('0x64')]['filename']));var _0x3d7019=path[_0x2078('0x4d')](config[_0x2078('0x59')],_0x2078('0x4e'),_0x1df390[_0x2078('0x64')][_0x2078('0x65')]);var _0x47b20d=path[_0x2078('0x4d')](config['root'],_0x2078('0x4e'),_0x398ea0);logger[_0x2078('0x60')](_0x2078('0x66'),_0x3d7019);logger[_0x2078('0x60')](_0x2078('0x67'),_0x47b20d);try{fs[_0x2078('0x68')](_0x3d7019,parseInt(_0x2078('0x69'),0x8));extract(_0x3d7019,{'dir':_0x47b20d},function(_0x567780){if(_0x567780){logger[_0x2078('0x2d')](_0x567780);handleError(_0x567780,!![]);};var _0x9fd0d=fs[_0x2078('0x6a')](_0x47b20d);if(_0x9fd0d[_0x2078('0x3e')]>0x1){removeReferences(_0x3d7019,_0x47b20d);logger[_0x2078('0x2d')]('Invalid\x20plugin\x20structure');return _0x560a89(new Error(_0x2078('0x6b')));}var _0x31fce1=fs['lstatSync'](path[_0x2078('0x4d')](_0x47b20d,_0x9fd0d[0x0]));if(_0x31fce1[_0x2078('0x6c')]()){removeReferences(_0x3d7019,_0x47b20d);logger[_0x2078('0x2d')](_0x2078('0x6b'));return _0x560a89(new Error(_0x2078('0x6b')));}if(_0x31fce1['isDirectory']()){var _0x29bf3d=fs[_0x2078('0x6a')](path['join'](_0x47b20d,_0x9fd0d[0x0]));if(_0x29bf3d[_0x2078('0x3e')]===0x0){removeReferences(_0x3d7019,_0x47b20d);logger['error'](_0x2078('0x6b'));return _0x560a89(new Error(_0x2078('0x6b')));}var _0x4d105a=_0x29bf3d[_0x2078('0x6d')](function(_0x438116){return _0x438116===_0x2078('0x6e');});if(!_0x4d105a){return _0x560a89(new Error(_0x2078('0x6f')));}var _0x23e1da=fs[_0x2078('0x70')](path[_0x2078('0x4d')](_0x47b20d,_0x9fd0d[0x0],_0x2078('0x6e')));var _0xeda851=JSON['parse'](_0x23e1da);if('undefined'==typeof _0xeda851[_0x2078('0x2f')]){return _0x560a89(new Error(_0x2078('0x71')));}if(_0x2078('0x20')==typeof _0xeda851['type']){return _0x560a89(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x2078('0x20')==typeof _0xeda851['version']){return _0x560a89(new Error(_0x2078('0x72')));}if(_0x2078('0x20')==typeof _0xeda851['parameters']){return _0x560a89(new Error(_0x2078('0x73')));}if(_0xeda851[_0x2078('0x36')]===_0x2078('0x74')){if('undefined'==typeof _0xeda851[_0x2078('0x75')][_0x2078('0x76')]){return _0x560a89(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x2078('0x20')==typeof _0xeda851[_0x2078('0x75')][_0x2078('0x76')]['admin']&&_0x2078('0x20')==typeof _0xeda851[_0x2078('0x75')][_0x2078('0x76')]['agent']){return _0x560a89(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0xeda851[_0x2078('0x36')]===_0x2078('0x77')){if('undefined'==typeof _0xeda851[_0x2078('0x75')][_0x2078('0x78')]){return _0x560a89(new Error(_0x2078('0x79')));}if(_0x2078('0x20')==typeof _0xeda851[_0x2078('0x75')][_0x2078('0x7a')]){return _0x560a89(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x560a89(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x436a95=_0xeda851['name'];var _0x3c1277=_0xeda851[_0x2078('0x7b')];var _0x2efb00=_0xeda851[_0x2078('0x36')];var _0x26ee50=_0xeda851[_0x2078('0x7c')]?_0xeda851['sidebar']:'always';var _0x3dba76=_0xeda851[_0x2078('0x7d')]?_0xeda851[_0x2078('0x7d')]:_0x2078('0x7e');var _0x368b30='';var _0x3b5b5a='';var _0x41143a='';var _0x38e937='';var _0x5f480c=_0xeda851[_0x2078('0x7f')];if(_0x2efb00===_0x2078('0x74')){if(_0x2078('0x20')!=typeof _0xeda851[_0x2078('0x75')][_0x2078('0x76')][_0x2078('0x80')]){var _0x5424c1=_0xeda851[_0x2078('0x75')]['views'][_0x2078('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x2078('0x81')](_0x5424c1)){_0x368b30=path[_0x2078('0x4d')](_0x2078('0x82'),_0x398ea0,_0x9fd0d[0x0],_0x5424c1);}else{_0x368b30=_0x5424c1;}}else{logger[_0x2078('0x60')](_0x2078('0x83'));}if(_0x2078('0x20')!=typeof _0xeda851['parameters'][_0x2078('0x76')][_0x2078('0x84')]){var _0x57689a=_0xeda851[_0x2078('0x75')][_0x2078('0x76')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x2078('0x81')](_0x57689a)){_0x3b5b5a=path[_0x2078('0x4d')](_0x2078('0x82'),_0x398ea0,_0x9fd0d[0x0],_0x57689a);}else{_0x3b5b5a=_0x57689a;}}else{logger['info'](_0x2078('0x85'));}}else if(_0x2efb00==='script'){_0x41143a=_0xeda851[_0x2078('0x75')][_0x2078('0x78')];_0x38e937=_0xeda851[_0x2078('0x75')]['scriptPath'];if('undefined'!=typeof _0xeda851[_0x2078('0x75')][_0x2078('0x76')]){if(_0x2078('0x20')!=typeof _0xeda851[_0x2078('0x75')][_0x2078('0x76')][_0x2078('0x80')]){var _0x5424c1=_0xeda851['parameters'][_0x2078('0x76')][_0x2078('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x2078('0x81')](_0x5424c1)){_0x368b30=path[_0x2078('0x4d')](_0x2078('0x82'),_0x398ea0,_0x9fd0d[0x0],_0x5424c1);}else{_0x368b30=_0x5424c1;}}if(_0x2078('0x20')!=typeof _0xeda851[_0x2078('0x75')][_0x2078('0x76')][_0x2078('0x84')]){var _0x57689a=_0xeda851[_0x2078('0x75')][_0x2078('0x76')][_0x2078('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x2078('0x81')](_0x57689a)){_0x3b5b5a=path[_0x2078('0x4d')](_0x2078('0x82'),_0x398ea0,_0x9fd0d[0x0],_0x57689a);}else{_0x3b5b5a=_0x57689a;}}}}var _0x2e6dd5={'name':_0x436a95,'description':_0x3c1277,'path':path[_0x2078('0x4d')](_0x398ea0,_0x9fd0d[0x0]),'type':_0x2efb00,'sidebar':_0x26ee50,'icon':_0x3dba76,'adminUrl':_0x368b30,'agentUrl':_0x3b5b5a,'scriptName':_0x41143a,'scriptPath':_0x38e937,'version':_0x5f480c};removeReferences(_0x3d7019,null);return db[_0x2078('0x33')][_0x2078('0x86')](_0x2e6dd5)['then'](function(_0x232885){var _0x1bd92e={'role':_0x1df390[_0x2078('0x87')][_0x2078('0x88')],'userProfileId':_0x1df390[_0x2078('0x87')][_0x2078('0x89')]};if(!_0x1bd92e)throw new Error(_0x2078('0x8a'));if(_0x1bd92e[_0x2078('0x88')]==='user'){var _0x3d0edc=_0x232885['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x2078('0x2b'),'userProfileId':_0x1bd92e[_0x2078('0x89')]},'raw':!![]})[_0x2078('0x28')](function(_0xeda19a){if(_0xeda19a&&_0xeda19a['autoAssociation']===0x0){return db[_0x2078('0x8b')][_0x2078('0x86')]({'name':_0x3d0edc[_0x2078('0x2f')],'resourceId':_0x3d0edc['id'],'type':_0xeda19a[_0x2078('0x2f')],'sectionId':_0xeda19a['id']},{})['then'](function(){return _0x232885;});}else{return _0x232885;}})[_0x2078('0x49')](function(_0x17a123){logger[_0x2078('0x2d')](_0x2078('0x8c'),_0x17a123);throw _0x17a123;});}return _0x232885;})[_0x2078('0x28')](respondWithResult(_0x25dbd0,null))[_0x2078('0x49')](handleError(_0x25dbd0,null));}});}catch(_0x3c209a){_0x25dbd0[_0x2078('0x1c')](0x1f4)[_0x2078('0x30')](_0x3c209a);}};function removeReferences(_0x48ffaa,_0x421b67){try{if(_0x48ffaa){fs['unlinkSync'](_0x48ffaa);logger['info'](_0x2078('0x8d'));}if(_0x421b67){rimraf(_0x421b67,function(){});logger[_0x2078('0x60')]('Extracted\x20folder\x20removed');}}catch(_0x2e61de){logger[_0x2078('0x2d')](_0x2e61de);}}exports[_0x2078('0x27')]=function(_0xc45343,_0x1abf5b,_0x130dc8){return db[_0x2078('0x33')][_0x2078('0x4b')]({'where':{'id':_0xc45343[_0x2078('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1abf5b,null))[_0x2078('0x28')](saveUpdates(_0xc45343[_0x2078('0x87')],null))[_0x2078('0x28')](respondWithResult(_0x1abf5b,null))[_0x2078('0x49')](handleError(_0x1abf5b,null));};exports[_0x2078('0x8e')]=function(_0x48fb74,_0x888d5c,_0x302dcc){return db[_0x2078('0x33')][_0x2078('0x4b')]({'where':{'id':_0x48fb74[_0x2078('0x4c')]['id']}})[_0x2078('0x28')](function(_0x37cd50){if(_0x37cd50){return _0x37cd50[_0x2078('0x29')]();}})[_0x2078('0x28')](function(_0xc5c3ef){rimraf(path[_0x2078('0x4d')](config[_0x2078('0x59')],_0x2078('0x4e'),path['dirname'](_0xc5c3ef[_0x2078('0x6')])),function(){});return _0xc5c3ef;})[_0x2078('0x28')](handleEntityNotFound(_0x888d5c,null))['then'](respondWithStatusCode(_0x888d5c,null))['catch'](handleError(_0x888d5c,null));};exports[_0x2078('0x8f')]=function(_0x3d1279,_0x3ebc9e,_0x32ad12){return BPromise['resolve']()['then'](function(){if(!_0x3d1279[_0x2078('0x37')][_0x2078('0x6')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x3d1279[_0x2078('0x37')][_0x2078('0x90')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x34b300=_0x3d1279[_0x2078('0x37')]['hostname']?_0x3d1279['query'][_0x2078('0x91')]+':'+_0x3d1279[_0x2078('0x37')]['port']:'http://localhost:'+_0x3d1279[_0x2078('0x37')][_0x2078('0x90')];var _0x4b1d0b=_0x3d1279[_0x2078('0x37')][_0x2078('0x1e')]?_0x3d1279[_0x2078('0x37')][_0x2078('0x1e')]:!![];var _0x10defb=_0x3d1279[_0x2078('0x37')][_0x2078('0x92')]?_0x3d1279[_0x2078('0x37')][_0x2078('0x92')]:null;var _0x52e8e9={'method':_0x3d1279[_0x2078('0x93')],'uri':util['format'](_0x2078('0x94'),_0x34b300,_0x3d1279[_0x2078('0x37')][_0x2078('0x6')]),'json':_0x4b1d0b,'resolveWithFullResponse':!![],'encoding':_0x10defb,'qs':_0x3d1279[_0x2078('0x37')]};if(_0x3d1279['headers']){_0x52e8e9[_0x2078('0x95')]=_0x3d1279[_0x2078('0x95')];if(_0x52e8e9[_0x2078('0x95')][_0x2078('0x96')]){delete _0x52e8e9['headers'][_0x2078('0x96')];}}if(_0x52e8e9[_0x2078('0x95')]['content-type']){delete _0x52e8e9['headers'][_0x2078('0x97')];}return rp(_0x52e8e9);})[_0x2078('0x28')](function(_0x59ca68){if(_0x59ca68){_0x3ebc9e[_0x2078('0x23')](_0x59ca68['headers']);logger[_0x2078('0x60')](_0x59ca68[_0x2078('0x87')]);if(_[_0x2078('0x98')](_0x3d1279['query'][_0x2078('0x6')],_0x2078('0x99'))&&_0x59ca68[_0x2078('0x9a')]==0x1f4){return _0x3ebc9e['sendStatus'](_0x59ca68[_0x2078('0x9a')]);}else{return _0x3ebc9e['status'](_0x59ca68[_0x2078('0x9a')])[_0x2078('0x30')](_0x59ca68[_0x2078('0x87')]);}}else{return _0x3ebc9e[_0x2078('0x2c')](0xc8);}})[_0x2078('0x49')](handleError(_0x3ebc9e,null));};exports['webhookPost']=function(_0x2863f0,_0x174c83,_0x34fde9){return BPromise['resolve']()[_0x2078('0x28')](function(){if(!_0x2863f0['query'][_0x2078('0x6')]){throw new Error(_0x2078('0x9b'));}if(!_0x2863f0[_0x2078('0x37')][_0x2078('0x90')]){throw new Error(_0x2078('0x9c'));}var _0x17aa0c=_0x2863f0['query'][_0x2078('0x91')]?_0x2863f0['query']['hostname']+':'+_0x2863f0['query'][_0x2078('0x90')]:'http://localhost:'+_0x2863f0[_0x2078('0x37')][_0x2078('0x90')];var _0x478825=_0x2863f0[_0x2078('0x37')][_0x2078('0x1e')]?_0x2863f0[_0x2078('0x37')][_0x2078('0x1e')]:!![];var _0x439ae0=_0x2863f0['query'][_0x2078('0x92')]?_0x2863f0['query']['encoding']:null;var _0xcbf6de={'method':_0x2863f0[_0x2078('0x93')],'uri':util[_0x2078('0x4f')]('%s%s',_0x17aa0c,_0x2863f0[_0x2078('0x37')][_0x2078('0x6')]),'json':_0x478825,'resolveWithFullResponse':!![],'encoding':_0x439ae0,'body':_0x2863f0[_0x2078('0x87')]};if(_0x2863f0[_0x2078('0x95')]){_0xcbf6de[_0x2078('0x95')]=_0x2863f0[_0x2078('0x95')];if(_0xcbf6de['headers'][_0x2078('0x96')]){delete _0xcbf6de[_0x2078('0x95')][_0x2078('0x96')];}}if(_0xcbf6de[_0x2078('0x95')][_0x2078('0x97')]){delete _0xcbf6de[_0x2078('0x95')][_0x2078('0x97')];}return rp(_0xcbf6de);})[_0x2078('0x28')](function(_0x490b66){if(_0x490b66){_0x174c83[_0x2078('0x23')](_0x490b66['headers']);logger[_0x2078('0x60')](_0x490b66[_0x2078('0x87')]);return _0x174c83[_0x2078('0x1c')](_0x490b66[_0x2078('0x9a')])[_0x2078('0x30')](_0x490b66[_0x2078('0x87')]);}else{return _0x174c83[_0x2078('0x2c')](0xc8);}})[_0x2078('0x49')](handleError(_0x174c83,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 18d246d..f5747fd 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 _0xf69d=['exports','events','../../mysqldb','Plugin','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x3c4dad,_0x25ffd5){var _0x1a4f49=function(_0x6fe6c){while(--_0x6fe6c){_0x3c4dad['push'](_0x3c4dad['shift']());}};_0x1a4f49(++_0x25ffd5);}(_0xf69d,0xd3));var _0xdf69=function(_0x4c9dc6,_0x2e350e){_0x4c9dc6=_0x4c9dc6-0x0;var _0x37efa1=_0xf69d[_0x4c9dc6];return _0x37efa1;};'use strict';var EventEmitter=require(_0xdf69('0x0'));var Plugin=require(_0xdf69('0x1'))['db'][_0xdf69('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xdf69('0x3')](0x0);var events={'afterCreate':_0xdf69('0x4'),'afterUpdate':'update','afterDestroy':_0xdf69('0x5')};function emitEvent(_0x342114){return function(_0x5b5eec,_0x13ecb6,_0x177ff7){PluginEvents[_0xdf69('0x6')](_0x342114+':'+_0x5b5eec['id'],_0x5b5eec);PluginEvents[_0xdf69('0x6')](_0x342114,_0x5b5eec);_0x177ff7(null);};}for(var e in events){if(events[_0xdf69('0x7')](e)){var event=events[e];Plugin[_0xdf69('0x8')](e,emitEvent(event));}}module[_0xdf69('0x9')]=PluginEvents; \ No newline at end of file +var _0x3ca4=['hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','update','remove','emit'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x3ca4,0x17d));var _0x43ca=function(_0x33612d,_0x553a7c){_0x33612d=_0x33612d-0x0;var _0x194b23=_0x3ca4[_0x33612d];return _0x194b23;};'use strict';var EventEmitter=require(_0x43ca('0x0'));var Plugin=require(_0x43ca('0x1'))['db'][_0x43ca('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x43ca('0x3'),'afterDestroy':_0x43ca('0x4')};function emitEvent(_0x21e96a){return function(_0x23ce52,_0x23c381,_0xc00cdb){PluginEvents[_0x43ca('0x5')](_0x21e96a+':'+_0x23ce52['id'],_0x23ce52);PluginEvents['emit'](_0x21e96a,_0x23ce52);_0xc00cdb(null);};}for(var e in events){if(events[_0x43ca('0x6')](e)){var event=events[e];Plugin[_0x43ca('0x7')](e,emitEvent(event));}}module[_0x43ca('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index f3dd184..23e1e71 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 _0x8440=['path','rimraf','../../config/environment','exports','define','Plugin','plugins','lodash','util','../../config/logger','moment','request-promise'];(function(_0x21e7ea,_0x2e2b6f){var _0x314225=function(_0x56dba1){while(--_0x56dba1){_0x21e7ea['push'](_0x21e7ea['shift']());}};_0x314225(++_0x2e2b6f);}(_0x8440,0x187));var _0x0844=function(_0x17e53a,_0x39c228){_0x17e53a=_0x17e53a-0x0;var _0x3565da=_0x8440[_0x17e53a];return _0x3565da;};'use strict';var _=require(_0x0844('0x0'));var util=require(_0x0844('0x1'));var logger=require(_0x0844('0x2'))('api');var moment=require(_0x0844('0x3'));var BPromise=require('bluebird');var rp=require(_0x0844('0x4'));var fs=require('fs');var path=require(_0x0844('0x5'));var rimraf=require(_0x0844('0x6'));var config=require(_0x0844('0x7'));var attributes=require('./plugin.attributes');module[_0x0844('0x8')]=function(_0x28659f,_0x29c5fc){return _0x28659f[_0x0844('0x9')](_0x0844('0xa'),attributes,{'tableName':_0x0844('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c9a=['request-promise','path','rimraf','exports','Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x209197,_0x5d42e8){var _0x25b992=function(_0xe2cd75){while(--_0xe2cd75){_0x209197['push'](_0x209197['shift']());}};_0x25b992(++_0x5d42e8);}(_0x4c9a,0x96));var _0xa4c9=function(_0x1f5727,_0x4b957c){_0x1f5727=_0x1f5727-0x0;var _0x2ba782=_0x4c9a[_0x1f5727];return _0x2ba782;};'use strict';var _=require(_0xa4c9('0x0'));var util=require(_0xa4c9('0x1'));var logger=require(_0xa4c9('0x2'))(_0xa4c9('0x3'));var moment=require(_0xa4c9('0x4'));var BPromise=require(_0xa4c9('0x5'));var rp=require(_0xa4c9('0x6'));var fs=require('fs');var path=require(_0xa4c9('0x7'));var rimraf=require(_0xa4c9('0x8'));var config=require('../../config/environment');var attributes=require('./plugin.attributes');module[_0xa4c9('0x9')]=function(_0x3dd5ff,_0x461985){return _0x3dd5ff['define'](_0xa4c9('0xa'),attributes,{'tableName':_0xa4c9('0xb'),'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 9d77ea8..f6d4ded 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 _0x57e4=['redis','defaults','localhost','socket.io-emitter','then','debug','request\x20sent','stringify','error','code','Plugin,\x20%s,\x20%s','message','info','result','catch','CreatePlugin','Plugin','create','body','options','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x57e4,0x1e5));var _0x457e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x57e4[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x457e('0x0'));var util=require('util');var moment=require(_0x457e('0x1'));var BPromise=require(_0x457e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x457e('0x3'));var db=require(_0x457e('0x4'))['db'];var utils=require(_0x457e('0x5'));var logger=require('../../config/logger')(_0x457e('0x6'));var config=require(_0x457e('0x7'));var jayson=require(_0x457e('0x8'));var client=jayson[_0x457e('0x9')][_0x457e('0xa')]({'port':0x232a});config[_0x457e('0xb')]=_[_0x457e('0xc')](config[_0x457e('0xb')],{'host':_0x457e('0xd'),'port':0x18eb});var socket=require(_0x457e('0xe'))(new Redis(config['redis']));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0xdc95c4,_0x101425,_0xd08dbe){return new BPromise(function(_0x54fe0f,_0x33f158){return client['request'](_0xdc95c4,_0xd08dbe)[_0x457e('0xf')](function(_0x4388d5){logger['info']('Plugin,\x20%s,\x20%s',_0x101425,'request\x20sent');logger[_0x457e('0x10')]('Plugin,\x20%s,\x20%s,\x20%s',_0x101425,_0x457e('0x11'),JSON[_0x457e('0x12')](_0x4388d5));if(_0x4388d5[_0x457e('0x13')]){if(_0x4388d5[_0x457e('0x13')][_0x457e('0x14')]===0x1f4){logger[_0x457e('0x13')](_0x457e('0x15'),_0x101425,_0x4388d5[_0x457e('0x13')]['message']);return _0x33f158(_0x4388d5[_0x457e('0x13')][_0x457e('0x16')]);}logger[_0x457e('0x13')]('Plugin,\x20%s,\x20%s',_0x101425,_0x4388d5['error'][_0x457e('0x16')]);return _0x54fe0f(_0x4388d5['error'][_0x457e('0x16')]);}else{logger[_0x457e('0x17')](_0x457e('0x15'),_0x101425,_0x457e('0x11'));_0x54fe0f(_0x4388d5[_0x457e('0x18')][_0x457e('0x16')]);}})[_0x457e('0x19')](function(_0x2bd03c){logger[_0x457e('0x13')](_0x457e('0x15'),_0x101425,_0x2bd03c);_0x33f158(_0x2bd03c);});});}exports[_0x457e('0x1a')]=function(_0x2bc89f){var _0x596ec1=this;return new Promise(function(_0x3a844e,_0x591ab8){return db[_0x457e('0x1b')][_0x457e('0x1c')](_0x2bc89f[_0x457e('0x1d')],{'raw':_0x2bc89f[_0x457e('0x1e')]?_0x2bc89f[_0x457e('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x457e('0xf')](function(_0xbabd0){logger[_0x457e('0x17')](_0x457e('0x1a'),_0x2bc89f);logger[_0x457e('0x10')](_0x457e('0x1a'),_0x2bc89f,JSON['stringify'](_0xbabd0));_0x3a844e(_0xbabd0);})['catch'](function(_0x55360e){logger[_0x457e('0x13')](_0x457e('0x1a'),_0x55360e[_0x457e('0x16')],_0x2bc89f);_0x591ab8(_0x596ec1[_0x457e('0x13')](0x1f4,_0x55360e[_0x457e('0x16')]));});});}; \ No newline at end of file +var _0x8dfb=['defaults','localhost','socket.io-emitter','register','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreatePlugin','create','body','options','raw','stringify','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis'];(function(_0x38b3a0,_0x377fcd){var _0x367532=function(_0x26333a){while(--_0x26333a){_0x38b3a0['push'](_0x38b3a0['shift']());}};_0x367532(++_0x377fcd);}(_0x8dfb,0x189));var _0xb8df=function(_0x4a8b72,_0xb54e90){_0x4a8b72=_0x4a8b72-0x0;var _0x217237=_0x8dfb[_0x4a8b72];return _0x217237;};'use strict';var _=require(_0xb8df('0x0'));var util=require('util');var moment=require(_0xb8df('0x1'));var BPromise=require('bluebird');var rs=require(_0xb8df('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb8df('0x3'))['db'];var utils=require(_0xb8df('0x4'));var logger=require(_0xb8df('0x5'))('rpc');var config=require(_0xb8df('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb8df('0x7')][_0xb8df('0x8')]({'port':0x232a});config[_0xb8df('0x9')]=_[_0xb8df('0xa')](config[_0xb8df('0x9')],{'host':_0xb8df('0xb'),'port':0x18eb});var socket=require(_0xb8df('0xc'))(new Redis(config[_0xb8df('0x9')]));require('./plugin.socket')[_0xb8df('0xd')](socket);function respondWithRpcPromise(_0xba0ea0,_0x3d19c3,_0x57da7c){return new BPromise(function(_0x1852dd,_0x3623d0){return client['request'](_0xba0ea0,_0x57da7c)[_0xb8df('0xe')](function(_0x1432fb){logger['info'](_0xb8df('0xf'),_0x3d19c3,_0xb8df('0x10'));logger[_0xb8df('0x11')](_0xb8df('0x12'),_0x3d19c3,_0xb8df('0x10'),JSON['stringify'](_0x1432fb));if(_0x1432fb[_0xb8df('0x13')]){if(_0x1432fb[_0xb8df('0x13')][_0xb8df('0x14')]===0x1f4){logger['error'](_0xb8df('0xf'),_0x3d19c3,_0x1432fb['error'][_0xb8df('0x15')]);return _0x3623d0(_0x1432fb[_0xb8df('0x13')][_0xb8df('0x15')]);}logger[_0xb8df('0x13')]('Plugin,\x20%s,\x20%s',_0x3d19c3,_0x1432fb[_0xb8df('0x13')]['message']);return _0x1852dd(_0x1432fb[_0xb8df('0x13')]['message']);}else{logger[_0xb8df('0x16')](_0xb8df('0xf'),_0x3d19c3,'request\x20sent');_0x1852dd(_0x1432fb[_0xb8df('0x17')][_0xb8df('0x15')]);}})[_0xb8df('0x18')](function(_0x192e0f){logger['error'](_0xb8df('0xf'),_0x3d19c3,_0x192e0f);_0x3623d0(_0x192e0f);});});}exports[_0xb8df('0x19')]=function(_0x24cbf3){var _0x3edd6e=this;return new Promise(function(_0x380805,_0x3aef44){return db['Plugin'][_0xb8df('0x1a')](_0x24cbf3[_0xb8df('0x1b')],{'raw':_0x24cbf3[_0xb8df('0x1c')]?_0x24cbf3['options'][_0xb8df('0x1d')]===undefined?!![]:![]:!![]})[_0xb8df('0xe')](function(_0x57781b){logger[_0xb8df('0x16')](_0xb8df('0x19'),_0x24cbf3);logger[_0xb8df('0x11')](_0xb8df('0x19'),_0x24cbf3,JSON[_0xb8df('0x1e')](_0x57781b));_0x380805(_0x57781b);})[_0xb8df('0x18')](function(_0x57a91e){logger[_0xb8df('0x13')](_0xb8df('0x19'),_0x57a91e[_0xb8df('0x15')],_0x24cbf3);_0x3aef44(_0x3edd6e[_0xb8df('0x13')](0x1f4,_0x57a91e[_0xb8df('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 235b854..b9c9bde 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 _0x2b82=['save','remove','emit','removeListener','register','length','plugin:','./plugin.events'];(function(_0x3d34ae,_0x12498b){var _0x4de56f=function(_0x5f0da1){while(--_0x5f0da1){_0x3d34ae['push'](_0x3d34ae['shift']());}};_0x4de56f(++_0x12498b);}(_0x2b82,0x1af));var _0x22b8=function(_0x4ca3b4,_0x12b782){_0x4ca3b4=_0x4ca3b4-0x0;var _0xa61962=_0x2b82[_0x4ca3b4];return _0xa61962;};'use strict';var PluginEvents=require(_0x22b8('0x0'));var events=[_0x22b8('0x1'),_0x22b8('0x2'),'update'];function createListener(_0x53161f,_0x3aa1ef){return function(_0x20c598){_0x3aa1ef[_0x22b8('0x3')](_0x53161f,_0x20c598);};}function removeListener(_0x1d1c97,_0x4f5596){return function(){PluginEvents[_0x22b8('0x4')](_0x1d1c97,_0x4f5596);};}exports[_0x22b8('0x5')]=function(_0x46dcfb){for(var _0x4f9cb1=0x0,_0x46e93d=events[_0x22b8('0x6')];_0x4f9cb1<_0x46e93d;_0x4f9cb1++){var _0x4f667f=events[_0x4f9cb1];var _0x2cf01b=createListener(_0x22b8('0x7')+_0x4f667f,_0x46dcfb);PluginEvents['on'](_0x4f667f,_0x2cf01b);}}; \ No newline at end of file +var _0x4972=['plugin:','./plugin.events','remove','update','emit','removeListener','register','length'];(function(_0x27056d,_0x1ea87a){var _0xe29c9e=function(_0x3ad46a){while(--_0x3ad46a){_0x27056d['push'](_0x27056d['shift']());}};_0xe29c9e(++_0x1ea87a);}(_0x4972,0x141));var _0x2497=function(_0x5d2afc,_0x41c01c){_0x5d2afc=_0x5d2afc-0x0;var _0x54a9af=_0x4972[_0x5d2afc];return _0x54a9af;};'use strict';var PluginEvents=require(_0x2497('0x0'));var events=['save',_0x2497('0x1'),_0x2497('0x2')];function createListener(_0x27b2ad,_0x1facc8){return function(_0x10f241){_0x1facc8[_0x2497('0x3')](_0x27b2ad,_0x10f241);};}function removeListener(_0x12fc6d,_0xed8e31){return function(){PluginEvents[_0x2497('0x4')](_0x12fc6d,_0xed8e31);};}exports[_0x2497('0x5')]=function(_0x1a272a){for(var _0x1528de=0x0,_0x145e85=events[_0x2497('0x6')];_0x1528de<_0x145e85;_0x1528de++){var _0x48a436=events[_0x1528de];var _0x3b67c7=createListener(_0x2497('0x7')+_0x48a436,_0x1a272a);PluginEvents['on'](_0x48a436,_0x3b67c7);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index b03ece4..637cd55 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(_0x4e5cd3,_0x21571e){var _0x556a16=function(_0xee3860){while(--_0xee3860){_0x4e5cd3['push'](_0x4e5cd3['shift']());}};_0x556a16(++_0x21571e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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(_0x444701,_0x17f591){var _0x1b93f7=function(_0x165ad0){while(--_0x165ad0){_0x444701['push'](_0x444701['shift']());}};_0x1b93f7(++_0x17f591);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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 9559adc..84852f4 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 _0x4fdb=['lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','status','json','error','stack','name','send','npm\x20install','info','index','then','reject','express','motion2','length','catch','show','describe','params','body','script','join','../../files/plugins','cwd','chdir','dump','restart','stop','hasOwnProperty','Unknown\x20status','destroy','Unknown\x20id'];(function(_0x53751f,_0x1ceffb){var _0xd85348=function(_0x241804){while(--_0x241804){_0x53751f['push'](_0x53751f['shift']());}};_0xd85348(++_0x1ceffb);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x5511b0,_0xd17819){_0x5511b0=_0x5511b0-0x0;var _0x4b766a=_0x4fdb[_0x5511b0];return _0x4b766a;};'use strict';var _=require(_0xb4fd('0x0'));var pm2=require(_0xb4fd('0x1'));var logger=require(_0xb4fd('0x2'))(_0xb4fd('0x3'));var path=require(_0xb4fd('0x4'));var exec=require(_0xb4fd('0x5'))[_0xb4fd('0x6')];var BPromise=require(_0xb4fd('0x7'));function handleEntityNotFound(_0x1c0b08,_0x5b73bb){return function(_0x308de6){if(!_0x308de6){_0x1c0b08['sendStatus'](0x194);;}return _0x308de6;};}function respondWithResult(_0x14052b,_0x5d8b39){_0x5d8b39=_0x5d8b39||0xc8;return function(_0x53273f){if(_0x53273f){return _0x14052b[_0xb4fd('0x8')](_0x5d8b39)[_0xb4fd('0x9')](_0x53273f);}return null;};}function handleError(_0x1151b5,_0x52dca2){_0x52dca2=_0x52dca2||0x1f4;return function(_0x526d3b){logger[_0xb4fd('0xa')](_0x526d3b[_0xb4fd('0xb')]);if(_0x526d3b[_0xb4fd('0xc')]){delete _0x526d3b['name'];}_0x1151b5[_0xb4fd('0x8')](_0x52dca2)[_0xb4fd('0xd')](_0x526d3b);};}function execChildProcess(){return new BPromise(function(_0x2148db,_0x23b08f){exec(_0xb4fd('0xe'),function(_0x502379,_0xd05458,_0x1f3e30){logger[_0xb4fd('0xf')](_0xd05458);logger[_0xb4fd('0xf')](_0x1f3e30);if(_0x502379){logger['error'](_0x502379);return _0x23b08f(_0x502379);}return _0x2148db(_0xd05458);});});}exports[_0xb4fd('0x10')]=function(_0x65f08a,_0x345d35){return pm2['list']()[_0xb4fd('0x11')](function(_0x1234d7){if(_0x1234d7){var _0xc35d8d=_[_0xb4fd('0x12')](_0x1234d7,function(_0x36e88f){return _0x36e88f[_0xb4fd('0xc')]===_0xb4fd('0x13')||_0x36e88f['name']===_0xb4fd('0x14');});return{'rows':_0xc35d8d,'count':_0xc35d8d[_0xb4fd('0x15')]};}return null;})[_0xb4fd('0x11')](respondWithResult(_0x345d35,null))[_0xb4fd('0x16')](handleError(_0x345d35,null));};exports[_0xb4fd('0x17')]=function(_0x137e51,_0x1d0812){return pm2[_0xb4fd('0x18')](_0x137e51[_0xb4fd('0x19')]['id'])[_0xb4fd('0x11')](respondWithResult(_0x1d0812,null))[_0xb4fd('0x11')](handleEntityNotFound(_0x1d0812,null))['catch'](handleError(_0x1d0812,null));};exports['create']=function(_0x504e80,_0x5c14c0){if(_0x504e80[_0xb4fd('0x1a')][_0xb4fd('0xc')]&&_0x504e80[_0xb4fd('0x1a')][_0xb4fd('0x1b')]){var _0x458133=path[_0xb4fd('0x1c')](__dirname,_0xb4fd('0x1d'),_0x504e80['body']['script']);var _0x216307=process[_0xb4fd('0x1e')]();process[_0xb4fd('0x1f')](path['dirname'](_0x458133));return execChildProcess()[_0xb4fd('0x11')](function(_0x49d42c){process[_0xb4fd('0x1f')](_0x216307);return pm2['start']({'name':_0x504e80[_0xb4fd('0x1a')][_0xb4fd('0xc')],'script':_0x458133});})[_0xb4fd('0x11')](function(_0x261eda){pm2[_0xb4fd('0x20')]();return _0x261eda[0x0];})[_0xb4fd('0x11')](respondWithResult(_0x5c14c0,0xc9))[_0xb4fd('0x16')](handleError(_0x5c14c0,null));}else{return _0x5c14c0[_0xb4fd('0x8')](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports['update']=function(_0x453982,_0x4bad85){if(_0x453982[_0xb4fd('0x1a')]['id']){delete _0x453982['body']['id'];}var _0x5738c2={'online':_0xb4fd('0x21'),'stopped':_0xb4fd('0x22')};if(_0x5738c2[_0xb4fd('0x23')](_0x453982['body'][_0xb4fd('0x8')])){return pm2[_0x5738c2[_0x453982[_0xb4fd('0x1a')][_0xb4fd('0x8')]]](_0x453982[_0xb4fd('0x19')]['id'])['then'](respondWithResult(_0x4bad85,0xc8))[_0xb4fd('0x16')](handleError(_0x4bad85,null));}else{return _0x4bad85[_0xb4fd('0x8')](0x1f4)['send']({'message':_0xb4fd('0x24')});}};exports[_0xb4fd('0x25')]=function(_0xbe7d2c,_0x597874){if(_0xbe7d2c[_0xb4fd('0x1a')]['id']){delete _0xbe7d2c[_0xb4fd('0x1a')]['id'];}if(_0xbe7d2c[_0xb4fd('0x19')]['id']){return pm2['delete'](_0xbe7d2c['params']['id'])['then'](function(_0x5f36e4){pm2[_0xb4fd('0x20')]();return _0x5f36e4[0x0];})[_0xb4fd('0x11')](respondWithResult(_0x597874,null))[_0xb4fd('0x16')](handleError(_0x597874,null));}else{return _0x597874[_0xb4fd('0x8')](0x1f4)[_0xb4fd('0xd')]({'message':_0xb4fd('0x26')});}}; \ No newline at end of file +var _0xf4eb=['join','../../files/plugins','cwd','chdir','start','Missing\x20name\x20and/or\x20path','restart','stop','params','destroy','dump','Unknown\x20id','lodash','child_process','sendStatus','json','error','stack','name','status','send','npm\x20install','info','list','then','express','length','catch','show','create','body','script'];(function(_0x2edebe,_0x1b8668){var _0x2072ae=function(_0x58361b){while(--_0x58361b){_0x2edebe['push'](_0x2edebe['shift']());}};_0x2072ae(++_0x1b8668);}(_0xf4eb,0xec));var _0xbf4e=function(_0x273b5f,_0x2af39b){_0x273b5f=_0x273b5f-0x0;var _0x559032=_0xf4eb[_0x273b5f];return _0x559032;};'use strict';var _=require(_0xbf4e('0x0'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')('api');var path=require('path');var exec=require(_0xbf4e('0x1'))['exec'];var BPromise=require('bluebird');function handleEntityNotFound(_0x2e3070,_0x1c7606){return function(_0x32d1d7){if(!_0x32d1d7){_0x2e3070[_0xbf4e('0x2')](0x194);;}return _0x32d1d7;};}function respondWithResult(_0xa4dcf5,_0x2fcfed){_0x2fcfed=_0x2fcfed||0xc8;return function(_0x15b99f){if(_0x15b99f){return _0xa4dcf5['status'](_0x2fcfed)[_0xbf4e('0x3')](_0x15b99f);}return null;};}function handleError(_0x5013c2,_0x5e23d4){_0x5e23d4=_0x5e23d4||0x1f4;return function(_0xa4280c){logger[_0xbf4e('0x4')](_0xa4280c[_0xbf4e('0x5')]);if(_0xa4280c[_0xbf4e('0x6')]){delete _0xa4280c[_0xbf4e('0x6')];}_0x5013c2[_0xbf4e('0x7')](_0x5e23d4)[_0xbf4e('0x8')](_0xa4280c);};}function execChildProcess(){return new BPromise(function(_0x580a26,_0x4d9a07){exec(_0xbf4e('0x9'),function(_0x5a8397,_0x448788,_0xcf6ba8){logger['info'](_0x448788);logger[_0xbf4e('0xa')](_0xcf6ba8);if(_0x5a8397){logger['error'](_0x5a8397);return _0x4d9a07(_0x5a8397);}return _0x580a26(_0x448788);});});}exports['index']=function(_0x209b25,_0x46c79c){return pm2[_0xbf4e('0xb')]()[_0xbf4e('0xc')](function(_0x3b74bd){if(_0x3b74bd){var _0x61bd54=_['reject'](_0x3b74bd,function(_0x59fb15){return _0x59fb15[_0xbf4e('0x6')]===_0xbf4e('0xd')||_0x59fb15[_0xbf4e('0x6')]==='motion2';});return{'rows':_0x61bd54,'count':_0x61bd54[_0xbf4e('0xe')]};}return null;})[_0xbf4e('0xc')](respondWithResult(_0x46c79c,null))[_0xbf4e('0xf')](handleError(_0x46c79c,null));};exports[_0xbf4e('0x10')]=function(_0x5a631e,_0x247322){return pm2['describe'](_0x5a631e['params']['id'])['then'](respondWithResult(_0x247322,null))['then'](handleEntityNotFound(_0x247322,null))[_0xbf4e('0xf')](handleError(_0x247322,null));};exports[_0xbf4e('0x11')]=function(_0x1fc800,_0x4d9c2a){if(_0x1fc800['body'][_0xbf4e('0x6')]&&_0x1fc800[_0xbf4e('0x12')][_0xbf4e('0x13')]){var _0x3a875b=path[_0xbf4e('0x14')](__dirname,_0xbf4e('0x15'),_0x1fc800[_0xbf4e('0x12')][_0xbf4e('0x13')]);var _0xd09e12=process[_0xbf4e('0x16')]();process[_0xbf4e('0x17')](path['dirname'](_0x3a875b));return execChildProcess()[_0xbf4e('0xc')](function(_0x2e7673){process['chdir'](_0xd09e12);return pm2[_0xbf4e('0x18')]({'name':_0x1fc800[_0xbf4e('0x12')][_0xbf4e('0x6')],'script':_0x3a875b});})[_0xbf4e('0xc')](function(_0x3a5d72){pm2['dump']();return _0x3a5d72[0x0];})[_0xbf4e('0xc')](respondWithResult(_0x4d9c2a,0xc9))[_0xbf4e('0xf')](handleError(_0x4d9c2a,null));}else{return _0x4d9c2a[_0xbf4e('0x7')](0x1f4)['send']({'message':_0xbf4e('0x19')});}};exports['update']=function(_0x5bcf71,_0x2bfccf){if(_0x5bcf71['body']['id']){delete _0x5bcf71[_0xbf4e('0x12')]['id'];}var _0x315df3={'online':_0xbf4e('0x1a'),'stopped':_0xbf4e('0x1b')};if(_0x315df3['hasOwnProperty'](_0x5bcf71[_0xbf4e('0x12')][_0xbf4e('0x7')])){return pm2[_0x315df3[_0x5bcf71[_0xbf4e('0x12')]['status']]](_0x5bcf71[_0xbf4e('0x1c')]['id'])['then'](respondWithResult(_0x2bfccf,0xc8))[_0xbf4e('0xf')](handleError(_0x2bfccf,null));}else{return _0x2bfccf[_0xbf4e('0x7')](0x1f4)[_0xbf4e('0x8')]({'message':'Unknown\x20status'});}};exports[_0xbf4e('0x1d')]=function(_0x362716,_0x2f3cf8){if(_0x362716[_0xbf4e('0x12')]['id']){delete _0x362716[_0xbf4e('0x12')]['id'];}if(_0x362716[_0xbf4e('0x1c')]['id']){return pm2['delete'](_0x362716[_0xbf4e('0x1c')]['id'])[_0xbf4e('0xc')](function(_0x5e32c0){pm2[_0xbf4e('0x1e')]();return _0x5e32c0[0x0];})[_0xbf4e('0xc')](respondWithResult(_0x2f3cf8,null))['catch'](handleError(_0x2f3cf8,null));}else{return _0x2f3cf8[_0xbf4e('0x7')](0x1f4)['send']({'message':_0xbf4e('0x1f')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 073f353..ba3be0a 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 _0xe9ef=['express','../../components/auth/service','./realtime.controller','/queues','getQueues','exports'];(function(_0x19a5dc,_0x3ff5d2){var _0x366514=function(_0x378f38){while(--_0x378f38){_0x19a5dc['push'](_0x19a5dc['shift']());}};_0x366514(++_0x3ff5d2);}(_0xe9ef,0x16e));var _0xfe9e=function(_0x22dac7,_0x45d32a){_0x22dac7=_0x22dac7-0x0;var _0x3e6cfa=_0xe9ef[_0x22dac7];return _0x3e6cfa;};'use strict';var express=require(_0xfe9e('0x0'));var router=express['Router']();var auth=require(_0xfe9e('0x1'));var controller=require(_0xfe9e('0x2'));router['get'](_0xfe9e('0x3'),auth['isAuthenticated'](),controller[_0xfe9e('0x4')]);module[_0xfe9e('0x5')]=router; \ No newline at end of file +var _0xdfb1=['/queues','isAuthenticated','getQueues','exports','express','Router','../../components/auth/service','./realtime.controller'];(function(_0x3438cf,_0x73b174){var _0x278698=function(_0xbba932){while(--_0xbba932){_0x3438cf['push'](_0x3438cf['shift']());}};_0x278698(++_0x73b174);}(_0xdfb1,0x8c));var _0x1dfb=function(_0x166edb,_0x3968fd){_0x166edb=_0x166edb-0x0;var _0x3a99e6=_0xdfb1[_0x166edb];return _0x3a99e6;};'use strict';var express=require(_0x1dfb('0x0'));var router=express[_0x1dfb('0x1')]();var auth=require(_0x1dfb('0x2'));var controller=require(_0x1dfb('0x3'));router['get'](_0x1dfb('0x4'),auth[_0x1dfb('0x5')](),controller[_0x1dfb('0x6')]);module[_0x1dfb('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 57b3cf1..3536594 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 _0x71ab=['getMembers','length','find','UserId','User','Pause','QueueId','findAll','agent','all','catch','lodash','../../components/parsers/qs','api','../../mysqldb','client','http','offset','undefined','limit','count','status','Content-Range','error','stack','name','mail','chat','sms','openchannel','fax','whatsapp','resolve','then','query','channel','includes','toLowerCase','Queue','map','rawAttributes','fieldName','type','key','getOptions','user','userProfileId','voice','outbound','QueueCampaigns','startCase','Queues','filter','UserProfile','getResources','findAndCountAll','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','loggedIn','available','talking','paused','push','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','rows','get','loggedInDb','waiting','agents','pick','getAgents','online'];(function(_0x4a0e8a,_0x5b4957){var _0x2eb49c=function(_0xccc30e){while(--_0xccc30e){_0x4a0e8a['push'](_0x4a0e8a['shift']());}};_0x2eb49c(++_0x5b4957);}(_0x71ab,0x64));var _0xb71a=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x71ab[_0x465028];return _0xb783d4;};'use strict';var util=require('util');var _=require(_0xb71a('0x0'));var jayson=require('jayson/promise');var qs=require(_0xb71a('0x1'));var logger=require('../../config/logger')(_0xb71a('0x2'));var db=require(_0xb71a('0x3'))['db'];var client=jayson[_0xb71a('0x4')][_0xb71a('0x5')]({'port':0x232a});var routingClient=jayson[_0xb71a('0x4')][_0xb71a('0x5')]({'port':0x232c});function respondWithFilteredResult(_0x2192e8,_0x38d931){return function(_0x22c072){if(_0x22c072){var _0x35a84e=typeof _0x38d931[_0xb71a('0x6')]===_0xb71a('0x7')&&typeof _0x38d931[_0xb71a('0x8')]===_0xb71a('0x7');var _0x18c7a6=_0x22c072[_0xb71a('0x9')];var _0x378c96=_0x35a84e?0x0:_0x38d931[_0xb71a('0x6')];var _0x517eed=_0x35a84e?_0x22c072[_0xb71a('0x9')]:_0x38d931['offset']+_0x38d931[_0xb71a('0x8')];var _0x343d2f;if(_0x517eed>=_0x18c7a6){_0x517eed=_0x18c7a6;_0x343d2f=0xc8;}else{_0x343d2f=0xce;}_0x2192e8[_0xb71a('0xa')](_0x343d2f);return _0x2192e8['set'](_0xb71a('0xb'),_0x378c96+'-'+_0x517eed+'/'+_0x18c7a6)['json'](_0x22c072);}return null;};}function handleError(_0x2a2d75,_0x50030d){_0x50030d=_0x50030d||0x1f4;return function(_0x50b43b){logger[_0xb71a('0xc')](_0x50b43b[_0xb71a('0xd')]);if(_0x50b43b[_0xb71a('0xe')]){delete _0x50b43b[_0xb71a('0xe')];}_0x2a2d75['status'](_0x50030d)['send'](_0x50b43b);};}exports['getQueues']=function(_0x12900a,_0xc189cd){var _0x15252a=[_0xb71a('0xf'),_0xb71a('0x10'),_0xb71a('0x11'),_0xb71a('0x12'),_0xb71a('0x13'),_0xb71a('0x14'),'voice'];var _0x1ca65e={'count':0x0,'rows':[]},_0x2d6369={},_0x374c8c;Promise[_0xb71a('0x15')]()[_0xb71a('0x16')](function(){if(_0x12900a[_0xb71a('0x17')][_0xb71a('0x18')]){if(!_[_0xb71a('0x19')](_0x15252a,_0x12900a[_0xb71a('0x17')][_0xb71a('0x18')][_0xb71a('0x1a')]()))throw new Error('Invalid\x20channel');_0x374c8c=_0x12900a['query'][_0xb71a('0x18')][_0xb71a('0x1a')]();}var _0x4a4f4e=_['startCase'](_0x374c8c)+_0xb71a('0x1b');var _0x4fe4fb=_[_0xb71a('0x1c')](db[_0x4a4f4e][_0xb71a('0x1d')],function(_0x3ac77b){return{'name':_0x3ac77b[_0xb71a('0x1e')],'type':_0x3ac77b[_0xb71a('0x1f')][_0xb71a('0x20')]};});_0x2d6369=qs[_0xb71a('0x21')](_0x4fe4fb,_0x12900a);if(_0x12900a[_0xb71a('0x22')]['role']===_0xb71a('0x22')){var _0x2c15bc={'params':{'id':_0x12900a[_0xb71a('0x22')][_0xb71a('0x23')]},'query':{'section':_0x374c8c===_0xb71a('0x24')&&_0x12900a[_0xb71a('0x17')][_0xb71a('0x1f')]===_0xb71a('0x25')?_0xb71a('0x26'):_[_0xb71a('0x27')](_0x374c8c)+_0xb71a('0x28'),'type':_0x12900a[_0xb71a('0x17')][_0xb71a('0x1f')],'nolimit':!![],'sort':'name','filter':_0x12900a[_0xb71a('0x17')][_0xb71a('0x29')]}};return db[_0xb71a('0x2a')][_0xb71a('0x2b')](_0x2c15bc);}return db[_0x4a4f4e][_0xb71a('0x2c')](_0x2d6369);})[_0xb71a('0x16')](function(_0x44826e){_0x1ca65e[_0xb71a('0x9')]=_0x44826e[_0xb71a('0x9')];var _0x421fcf=_0x374c8c===_0xb71a('0x24')?client:routingClient;return _0x421fcf['request'](_['startCase'](_0x374c8c)+_0xb71a('0x28'),_0x12900a)['then'](function(_0x70299a){if(_0x70299a[_0xb71a('0xc')])throw new Error(util['format'](_0xb71a('0x2d'),_0x374c8c));var _0xa42f25=_0x70299a[_0xb71a('0x2e')];var _0x251d82=[_0xb71a('0x2f'),_0xb71a('0x30'),'waiting',_0xb71a('0x31'),_0xb71a('0x32')];if(_0x374c8c===_0xb71a('0x24')&&_0x12900a[_0xb71a('0x17')]['type']===_0xb71a('0x25')){_0x251d82[_0xb71a('0x33')](_0xb71a('0x34'),_0xb71a('0x35'),_0xb71a('0x36'),_0xb71a('0x37'),_0xb71a('0x38'),_0xb71a('0x39'),_0xb71a('0x3a'),_0xb71a('0x3b'),'erlangCalls','erlangCallToSecond',_0xb71a('0x3c'),_0xb71a('0x3d'),_0xb71a('0x3e'),_0xb71a('0x3f'),_0xb71a('0x40'),_0xb71a('0x41'),_0xb71a('0x42'),'predictiveIntervalAnsweredCalls',_0xb71a('0x43'),'predictiveIntervalDroppedCallsCallersExit',_0xb71a('0x44'),_0xb71a('0x45'));}var _0x147002=_0x44826e[_0xb71a('0x46')]['map'](function(_0x39d12c){var _0x3ff4ed=_0x39d12c[_0xb71a('0x47')]({'plain':!![]});_0x3ff4ed[_0xb71a('0x32')]=0x0;_0x3ff4ed[_0xb71a('0x48')]=0x0;_0x3ff4ed[_0xb71a('0x2f')]=0x0;_0x3ff4ed[_0xb71a('0x30')]=0x0;_0x3ff4ed[_0xb71a('0x32')]=0x0;_0x3ff4ed[_0xb71a('0x49')]=0x0;if(_0x374c8c==='voice'){_0x3ff4ed[_0xb71a('0x31')]=0x0;if(_0x12900a['query'][_0xb71a('0x1f')]===_0xb71a('0x25')){_0x3ff4ed[_0xb71a('0x34')]=0x0;_0x3ff4ed[_0xb71a('0x35')]=0x0;}}_0x3ff4ed[_0xb71a('0x4a')]=[];var _0x18872b=_['find'](_0xa42f25['rows'],['id',_0x3ff4ed['id']]);if(_0x18872b)_['merge'](_0x3ff4ed,_[_0xb71a('0x4b')](_0x18872b,_0x251d82));if(_0x374c8c==='voice'){return _0x39d12c[_0xb71a('0x4c')]({'attributes':['id',_0xb71a('0xe'),_0xb71a('0x4d')],'joinTableAttributes':[],'raw':!![]})[_0xb71a('0x16')](function(_0x1cb355){return _0x39d12c[_0xb71a('0x4e')]({'raw':!![]})['then'](function(_0x29985a){for(var _0x7b5cc4=0x0;_0x7b5cc4<_0x1cb355[_0xb71a('0x4f')];_0x7b5cc4++){var _0x8bf582=_[_0xb71a('0x50')](_0x29985a,[_0xb71a('0x51'),_0x1cb355[_0x7b5cc4]['id']]);var _0x55cbca={'id':_0x1cb355[_0x7b5cc4]['id'],'name':_0x1cb355[_0x7b5cc4][_0xb71a('0xe')],'online':Boolean(_0x1cb355[_0x7b5cc4][_0xb71a('0x4d')]),'paused':_0x8bf582?Boolean(_0x8bf582[_0xb71a('0x32')]):![]};if(_0x55cbca[_0xb71a('0x4d')])_0x3ff4ed[_0xb71a('0x48')]++;if(_0x55cbca[_0xb71a('0x32')])_0x3ff4ed[_0xb71a('0x32')]++;_0x3ff4ed['agents']['push'](_0x55cbca);}return _0x3ff4ed;});});}else{var _0x2442f5=_0xb71a('0x52')+_[_0xb71a('0x27')](_0x374c8c)+_0xb71a('0x1b');var _0x4a763c=_0x374c8c+_0xb71a('0x53');return db[_0x2442f5]['findAll']({'where':{[_[_0xb71a('0x27')](_0x374c8c)+_0xb71a('0x54')]:_0x39d12c['id']},'raw':!![]})['then'](function(_0x437287){return db[_0xb71a('0x52')][_0xb71a('0x55')]({'attributes':['id',_0xb71a('0xe'),'online',_0x4a763c],'where':{'id':_[_0xb71a('0x1c')](_0x437287,_0xb71a('0x51')),'role':_0xb71a('0x56')},'raw':!![]});})['then'](function(_0x350c89){for(var _0x1cd434=0x0;_0x1cd434<_0x350c89[_0xb71a('0x4f')];_0x1cd434++){var _0x5e9eea={'id':_0x350c89[_0x1cd434]['id'],'name':_0x350c89[_0x1cd434][_0xb71a('0xe')],'online':Boolean(_0x350c89[_0x1cd434][_0xb71a('0x4d')]),'paused':Boolean(_0x350c89[_0x1cd434][_0x4a763c])};if(_0x5e9eea[_0xb71a('0x4d')])_0x3ff4ed[_0xb71a('0x48')]++;if(_0x5e9eea[_0xb71a('0x32')])_0x3ff4ed['paused']++;_0x3ff4ed[_0xb71a('0x4a')][_0xb71a('0x33')](_0x5e9eea);}return _0x3ff4ed;});}});return Promise[_0xb71a('0x57')](_0x147002);});})[_0xb71a('0x16')](function(_0x489c1f){_0x1ca65e['rows']=_0x489c1f;return _0x1ca65e;})[_0xb71a('0x16')](respondWithFilteredResult(_0xc189cd,_0x2d6369))[_0xb71a('0x58')](handleError(_0xc189cd,null));}; \ No newline at end of file +var _0x3e24=['UserId','loggedInDb','User','findAll','QueueId','agent','length','util','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','../../mysqldb','client','http','offset','limit','undefined','count','Content-Range','json','error','stack','name','status','send','getQueues','mail','chat','fax','whatsapp','voice','resolve','then','query','channel','Invalid\x20channel','toLowerCase','startCase','Queue','map','rawAttributes','type','key','getOptions','user','userProfileId','outbound','QueueCampaigns','Queues','UserProfile','getResources','findAndCountAll','request','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','loggedIn','available','waiting','talking','paused','push','pTalking','message','dialActive','Trunk','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','rows','get','originated','agents','find','merge','pick','getAgents','online'];(function(_0x11609e,_0x471e21){var _0x40731a=function(_0xb33f37){while(--_0xb33f37){_0x11609e['push'](_0x11609e['shift']());}};_0x40731a(++_0x471e21);}(_0x3e24,0x167));var _0x43e2=function(_0x1e5cc3,_0x238a87){_0x1e5cc3=_0x1e5cc3-0x0;var _0x15c596=_0x3e24[_0x1e5cc3];return _0x15c596;};'use strict';var util=require(_0x43e2('0x0'));var _=require(_0x43e2('0x1'));var jayson=require(_0x43e2('0x2'));var qs=require(_0x43e2('0x3'));var logger=require(_0x43e2('0x4'))('api');var db=require(_0x43e2('0x5'))['db'];var client=jayson[_0x43e2('0x6')]['http']({'port':0x232a});var routingClient=jayson[_0x43e2('0x6')][_0x43e2('0x7')]({'port':0x232c});function respondWithFilteredResult(_0x1a89fc,_0x28b144){return function(_0x43b5a7){if(_0x43b5a7){var _0x121e2e=typeof _0x28b144[_0x43e2('0x8')]==='undefined'&&typeof _0x28b144[_0x43e2('0x9')]===_0x43e2('0xa');var _0x4bd2ce=_0x43b5a7[_0x43e2('0xb')];var _0x2fdf85=_0x121e2e?0x0:_0x28b144['offset'];var _0x2ed387=_0x121e2e?_0x43b5a7[_0x43e2('0xb')]:_0x28b144['offset']+_0x28b144[_0x43e2('0x9')];var _0x48c5f3;if(_0x2ed387>=_0x4bd2ce){_0x2ed387=_0x4bd2ce;_0x48c5f3=0xc8;}else{_0x48c5f3=0xce;}_0x1a89fc['status'](_0x48c5f3);return _0x1a89fc['set'](_0x43e2('0xc'),_0x2fdf85+'-'+_0x2ed387+'/'+_0x4bd2ce)[_0x43e2('0xd')](_0x43b5a7);}return null;};}function handleError(_0x236b88,_0x44781a){_0x44781a=_0x44781a||0x1f4;return function(_0x43ba14){logger[_0x43e2('0xe')](_0x43ba14[_0x43e2('0xf')]);if(_0x43ba14[_0x43e2('0x10')]){delete _0x43ba14[_0x43e2('0x10')];}_0x236b88[_0x43e2('0x11')](_0x44781a)[_0x43e2('0x12')](_0x43ba14);};}exports[_0x43e2('0x13')]=function(_0x5ee7fc,_0x376bba){var _0x40fb7b=[_0x43e2('0x14'),_0x43e2('0x15'),'sms','openchannel',_0x43e2('0x16'),_0x43e2('0x17'),_0x43e2('0x18')];var _0x3a27eb={'count':0x0,'rows':[]},_0x105cb8={},_0x1b7cde;Promise[_0x43e2('0x19')]()[_0x43e2('0x1a')](function(){if(_0x5ee7fc[_0x43e2('0x1b')][_0x43e2('0x1c')]){if(!_['includes'](_0x40fb7b,_0x5ee7fc[_0x43e2('0x1b')][_0x43e2('0x1c')]['toLowerCase']()))throw new Error(_0x43e2('0x1d'));_0x1b7cde=_0x5ee7fc['query'][_0x43e2('0x1c')][_0x43e2('0x1e')]();}var _0x1fac53=_[_0x43e2('0x1f')](_0x1b7cde)+_0x43e2('0x20');var _0x5ae97b=_[_0x43e2('0x21')](db[_0x1fac53][_0x43e2('0x22')],function(_0x272934){return{'name':_0x272934['fieldName'],'type':_0x272934[_0x43e2('0x23')][_0x43e2('0x24')]};});_0x105cb8=qs[_0x43e2('0x25')](_0x5ae97b,_0x5ee7fc);if(_0x5ee7fc[_0x43e2('0x26')]['role']===_0x43e2('0x26')){var _0xc717d8={'params':{'id':_0x5ee7fc[_0x43e2('0x26')][_0x43e2('0x27')]},'query':{'section':_0x1b7cde===_0x43e2('0x18')&&_0x5ee7fc[_0x43e2('0x1b')][_0x43e2('0x23')]===_0x43e2('0x28')?_0x43e2('0x29'):_[_0x43e2('0x1f')](_0x1b7cde)+_0x43e2('0x2a'),'type':_0x5ee7fc[_0x43e2('0x1b')]['type'],'nolimit':!![],'sort':_0x43e2('0x10'),'filter':_0x5ee7fc[_0x43e2('0x1b')]['filter']}};return db[_0x43e2('0x2b')][_0x43e2('0x2c')](_0xc717d8);}return db[_0x1fac53][_0x43e2('0x2d')](_0x105cb8);})[_0x43e2('0x1a')](function(_0x3fd232){_0x3a27eb['count']=_0x3fd232[_0x43e2('0xb')];var _0xd1b43a=_0x1b7cde===_0x43e2('0x18')?client:routingClient;return _0xd1b43a[_0x43e2('0x2e')](_[_0x43e2('0x1f')](_0x1b7cde)+_0x43e2('0x2a'),_0x5ee7fc)['then'](function(_0x51226b){if(_0x51226b[_0x43e2('0xe')])throw new Error(util[_0x43e2('0x2f')](_0x43e2('0x30'),_0x1b7cde));var _0x3ecb6a=_0x51226b[_0x43e2('0x31')];var _0x5b9592=[_0x43e2('0x32'),_0x43e2('0x33'),_0x43e2('0x34'),_0x43e2('0x35'),_0x43e2('0x36')];if(_0x1b7cde===_0x43e2('0x18')&&_0x5ee7fc[_0x43e2('0x1b')]['type']==='outbound'){_0x5b9592[_0x43e2('0x37')](_0x43e2('0x38'),'originated',_0x43e2('0x39'),_0x43e2('0x3a'),'dialMethod',_0x43e2('0x3b'),'startPredictive','startProgressive','erlangCalls',_0x43e2('0x3c'),'erlangAbandonmentRate',_0x43e2('0x3d'),_0x43e2('0x3e'),_0x43e2('0x3f'),_0x43e2('0x40'),_0x43e2('0x41'),_0x43e2('0x42'),_0x43e2('0x43'),_0x43e2('0x44'),_0x43e2('0x45'),_0x43e2('0x46'),_0x43e2('0x47'));}var _0xf38103=_0x3fd232[_0x43e2('0x48')][_0x43e2('0x21')](function(_0x2f64a3){var _0x40b39b=_0x2f64a3[_0x43e2('0x49')]({'plain':!![]});_0x40b39b['paused']=0x0;_0x40b39b['loggedInDb']=0x0;_0x40b39b['loggedIn']=0x0;_0x40b39b[_0x43e2('0x33')]=0x0;_0x40b39b[_0x43e2('0x36')]=0x0;_0x40b39b['waiting']=0x0;if(_0x1b7cde==='voice'){_0x40b39b[_0x43e2('0x35')]=0x0;if(_0x5ee7fc[_0x43e2('0x1b')][_0x43e2('0x23')]===_0x43e2('0x28')){_0x40b39b[_0x43e2('0x38')]=0x0;_0x40b39b[_0x43e2('0x4a')]=0x0;}}_0x40b39b[_0x43e2('0x4b')]=[];var _0x3f03e5=_[_0x43e2('0x4c')](_0x3ecb6a[_0x43e2('0x48')],['id',_0x40b39b['id']]);if(_0x3f03e5)_[_0x43e2('0x4d')](_0x40b39b,_[_0x43e2('0x4e')](_0x3f03e5,_0x5b9592));if(_0x1b7cde===_0x43e2('0x18')){return _0x2f64a3[_0x43e2('0x4f')]({'attributes':['id','name',_0x43e2('0x50')],'joinTableAttributes':[],'raw':!![]})['then'](function(_0xc1fbb4){return _0x2f64a3['getMembers']({'raw':!![]})[_0x43e2('0x1a')](function(_0x2ce990){for(var _0x273323=0x0;_0x273323<_0xc1fbb4['length'];_0x273323++){var _0x18bdbb=_['find'](_0x2ce990,[_0x43e2('0x51'),_0xc1fbb4[_0x273323]['id']]);var _0x36f94a={'id':_0xc1fbb4[_0x273323]['id'],'name':_0xc1fbb4[_0x273323][_0x43e2('0x10')],'online':Boolean(_0xc1fbb4[_0x273323][_0x43e2('0x50')]),'paused':_0x18bdbb?Boolean(_0x18bdbb['paused']):![]};if(_0x36f94a['online'])_0x40b39b[_0x43e2('0x52')]++;if(_0x36f94a[_0x43e2('0x36')])_0x40b39b[_0x43e2('0x36')]++;_0x40b39b[_0x43e2('0x4b')]['push'](_0x36f94a);}return _0x40b39b;});});}else{var _0x2422b0=_0x43e2('0x53')+_[_0x43e2('0x1f')](_0x1b7cde)+_0x43e2('0x20');var _0x1cc2fe=_0x1b7cde+'Pause';return db[_0x2422b0][_0x43e2('0x54')]({'where':{[_['startCase'](_0x1b7cde)+_0x43e2('0x55')]:_0x2f64a3['id']},'raw':!![]})[_0x43e2('0x1a')](function(_0x4f5831){return db[_0x43e2('0x53')]['findAll']({'attributes':['id','name',_0x43e2('0x50'),_0x1cc2fe],'where':{'id':_[_0x43e2('0x21')](_0x4f5831,_0x43e2('0x51')),'role':_0x43e2('0x56')},'raw':!![]});})[_0x43e2('0x1a')](function(_0x52480e){for(var _0x1b001d=0x0;_0x1b001d<_0x52480e[_0x43e2('0x57')];_0x1b001d++){var _0x446c78={'id':_0x52480e[_0x1b001d]['id'],'name':_0x52480e[_0x1b001d][_0x43e2('0x10')],'online':Boolean(_0x52480e[_0x1b001d][_0x43e2('0x50')]),'paused':Boolean(_0x52480e[_0x1b001d][_0x1cc2fe])};if(_0x446c78[_0x43e2('0x50')])_0x40b39b[_0x43e2('0x52')]++;if(_0x446c78[_0x43e2('0x36')])_0x40b39b['paused']++;_0x40b39b[_0x43e2('0x4b')][_0x43e2('0x37')](_0x446c78);}return _0x40b39b;});}});return Promise['all'](_0xf38103);});})[_0x43e2('0x1a')](function(_0x2b82be){_0x3a27eb[_0x43e2('0x48')]=_0x2b82be;return _0x3a27eb;})[_0x43e2('0x1a')](respondWithFilteredResult(_0x376bba,_0x105cb8))['catch'](handleError(_0x376bba,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 4d4e4b9..68adab5 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x28fde4,_0x4fbc40){var _0xdc3f1b=function(_0x58f4be){while(--_0x58f4be){_0x28fde4['push'](_0x28fde4['shift']());}};_0xdc3f1b(++_0x4fbc40);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5557c2,_0x37de81){var _0x2c1eff=function(_0xdda650){while(--_0xdda650){_0x5557c2['push'](_0x5557c2['shift']());}};_0x2c1eff(++_0x37de81);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index e80c98b..aa77ecd 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 _0xc99e=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x7a568e,_0x274e62){var _0x3b5a1f=function(_0x50f97a){while(--_0x50f97a){_0x7a568e['push'](_0x7a568e['shift']());}};_0x3b5a1f(++_0x274e62);}(_0xc99e,0x6e));var _0xec99=function(_0x46c831,_0x1e8675){_0x46c831=_0x46c831-0x0;var _0x528b30=_0xc99e[_0x46c831];return _0x528b30;};'use strict';var Sequelize=require(_0xec99('0x0'));module[_0xec99('0x1')]={'state':{'type':Sequelize[_0xec99('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xec99('0x3')]},'scheduledat':{'type':Sequelize[_0xec99('0x4')]},'uniqueid':{'type':Sequelize[_0xec99('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xec99('0x4')]},'ringtime':{'type':Sequelize[_0xec99('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xec99('0x3')]},'campaigntype':{'type':Sequelize[_0xec99('0x3')]},'membername':{'type':Sequelize[_0xec99('0x3')]}}; \ No newline at end of file +var _0xa647=['exports','INTEGER','STRING','DATE','sequelize'];(function(_0x3312ee,_0x686154){var _0x5e5fbf=function(_0x3941db){while(--_0x3941db){_0x3312ee['push'](_0x3312ee['shift']());}};_0x5e5fbf(++_0x686154);}(_0xa647,0x81));var _0x7a64=function(_0x728d38,_0x3db7b9){_0x728d38=_0x728d38-0x0;var _0x2fa742=_0xa647[_0x728d38];return _0x2fa742;};'use strict';var Sequelize=require(_0x7a64('0x0'));module[_0x7a64('0x1')]={'state':{'type':Sequelize[_0x7a64('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x7a64('0x3')]},'scheduledat':{'type':Sequelize[_0x7a64('0x4')]},'uniqueid':{'type':Sequelize[_0x7a64('0x3')]},'starttime':{'type':Sequelize[_0x7a64('0x4')]},'responsetime':{'type':Sequelize[_0x7a64('0x4')]},'ringtime':{'type':Sequelize[_0x7a64('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x7a64('0x3')]},'campaigntype':{'type':Sequelize[_0x7a64('0x3')]},'membername':{'type':Sequelize[_0x7a64('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 19bb158..d8541cb 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 _0x0b0b=['path','rimraf','../../config/environment','exports','define','ReportAgentPreview','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x31052a,_0x2f2221){var _0x2f9ca0=function(_0xb138ce){while(--_0xb138ce){_0x31052a['push'](_0x31052a['shift']());}};_0x2f9ca0(++_0x2f2221);}(_0x0b0b,0x6e));var _0xb0b0=function(_0x3e8a65,_0x51abf6){_0x3e8a65=_0x3e8a65-0x0;var _0xde9345=_0x0b0b[_0x3e8a65];return _0xde9345;};'use strict';var _=require(_0xb0b0('0x0'));var util=require(_0xb0b0('0x1'));var logger=require(_0xb0b0('0x2'))(_0xb0b0('0x3'));var moment=require(_0xb0b0('0x4'));var BPromise=require(_0xb0b0('0x5'));var rp=require(_0xb0b0('0x6'));var fs=require('fs');var path=require(_0xb0b0('0x7'));var rimraf=require(_0xb0b0('0x8'));var config=require(_0xb0b0('0x9'));var attributes=require('./reportAgentPreview.attributes');module[_0xb0b0('0xa')]=function(_0x1c6046,_0x241714){return _0x1c6046[_0xb0b0('0xb')](_0xb0b0('0xc'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd153=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','lodash','util'];(function(_0x47d226,_0x51e66c){var _0x1ec372=function(_0x3a0860){while(--_0x3a0860){_0x47d226['push'](_0x47d226['shift']());}};_0x1ec372(++_0x51e66c);}(_0xd153,0x76));var _0x3d15=function(_0x55a541,_0x39e377){_0x55a541=_0x55a541-0x0;var _0x4b61f6=_0xd153[_0x55a541];return _0x4b61f6;};'use strict';var _=require(_0x3d15('0x0'));var util=require(_0x3d15('0x1'));var logger=require(_0x3d15('0x2'))(_0x3d15('0x3'));var moment=require('moment');var BPromise=require(_0x3d15('0x4'));var rp=require(_0x3d15('0x5'));var fs=require('fs');var path=require(_0x3d15('0x6'));var rimraf=require(_0x3d15('0x7'));var config=require(_0x3d15('0x8'));var attributes=require(_0x3d15('0x9'));module[_0x3d15('0xa')]=function(_0x44e908,_0x15319a){return _0x44e908[_0x3d15('0xb')]('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index fe348ed..c8b9926 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 _0x8720=['options','raw','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','catch','CreateReportAgentPreview','ReportAgentPreview','body'];(function(_0x33f3f8,_0x51b47a){var _0x2122db=function(_0x52fa7e){while(--_0x52fa7e){_0x33f3f8['push'](_0x33f3f8['shift']());}};_0x2122db(++_0x51b47a);}(_0x8720,0x11a));var _0x0872=function(_0x12fbd0,_0xf14427){_0x12fbd0=_0x12fbd0-0x0;var _0x56ab1d=_0x8720[_0x12fbd0];return _0x56ab1d;};'use strict';var _=require(_0x0872('0x0'));var util=require(_0x0872('0x1'));var moment=require(_0x0872('0x2'));var BPromise=require('bluebird');var rs=require(_0x0872('0x3'));var fs=require('fs');var Redis=require(_0x0872('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0872('0x5'));var logger=require('../../config/logger')(_0x0872('0x6'));var config=require(_0x0872('0x7'));var jayson=require(_0x0872('0x8'));var client=jayson[_0x0872('0x9')][_0x0872('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25f97d,_0x2a106b,_0x28374a){return new BPromise(function(_0x521aa5,_0x4b8c0b){return client[_0x0872('0xb')](_0x25f97d,_0x28374a)[_0x0872('0xc')](function(_0x4cd2ac){logger[_0x0872('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x2a106b,_0x0872('0xe'));logger[_0x0872('0xf')](_0x0872('0x10'),_0x2a106b,_0x0872('0xe'),JSON[_0x0872('0x11')](_0x4cd2ac));if(_0x4cd2ac[_0x0872('0x12')]){if(_0x4cd2ac[_0x0872('0x12')][_0x0872('0x13')]===0x1f4){logger['error'](_0x0872('0x14'),_0x2a106b,_0x4cd2ac[_0x0872('0x12')][_0x0872('0x15')]);return _0x4b8c0b(_0x4cd2ac[_0x0872('0x12')]['message']);}logger[_0x0872('0x12')](_0x0872('0x14'),_0x2a106b,_0x4cd2ac[_0x0872('0x12')]['message']);return _0x521aa5(_0x4cd2ac[_0x0872('0x12')][_0x0872('0x15')]);}else{logger['info'](_0x0872('0x14'),_0x2a106b,'request\x20sent');_0x521aa5(_0x4cd2ac['result']['message']);}})[_0x0872('0x16')](function(_0x1384a0){logger[_0x0872('0x12')](_0x0872('0x14'),_0x2a106b,_0x1384a0);_0x4b8c0b(_0x1384a0);});});}exports[_0x0872('0x17')]=function(_0x170112){var _0xd5be10=this;return new Promise(function(_0x2eeb43,_0x4b3bc9){return db[_0x0872('0x18')]['create'](_0x170112[_0x0872('0x19')],{'raw':_0x170112[_0x0872('0x1a')]?_0x170112['options'][_0x0872('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x5130a3){logger[_0x0872('0xd')](_0x0872('0x17'),_0x170112);logger[_0x0872('0xf')](_0x0872('0x17'),_0x170112,JSON[_0x0872('0x11')](_0x5130a3));_0x2eeb43(_0x5130a3);})[_0x0872('0x16')](function(_0x1383d1){logger[_0x0872('0x12')](_0x0872('0x17'),_0x1383d1[_0x0872('0x15')],_0x170112);_0x4b3bc9(_0xd5be10[_0x0872('0x12')](0x1f4,_0x1383d1[_0x0872('0x15')]));});});}; \ No newline at end of file +var _0xa65c=['stringify','error','code','message','result','ReportAgentPreview','body','options','raw','CreateReportAgentPreview','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xa65c,0xf5));var _0xca65=function(_0x34b56a,_0x1c48f4){_0x34b56a=_0x34b56a-0x0;var _0x3e7773=_0xa65c[_0x34b56a];return _0x3e7773;};'use strict';var _=require(_0xca65('0x0'));var util=require(_0xca65('0x1'));var moment=require('moment');var BPromise=require(_0xca65('0x2'));var rs=require(_0xca65('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca65('0x4'))['db'];var utils=require(_0xca65('0x5'));var logger=require(_0xca65('0x6'))(_0xca65('0x7'));var config=require(_0xca65('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xca65('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ea265,_0xed8231,_0xbbc238){return new BPromise(function(_0x362d1a,_0x218701){return client['request'](_0x5ea265,_0xbbc238)[_0xca65('0xa')](function(_0xab043){logger[_0xca65('0xb')](_0xca65('0xc'),_0xed8231,_0xca65('0xd'));logger[_0xca65('0xe')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0xed8231,_0xca65('0xd'),JSON[_0xca65('0xf')](_0xab043));if(_0xab043[_0xca65('0x10')]){if(_0xab043[_0xca65('0x10')][_0xca65('0x11')]===0x1f4){logger[_0xca65('0x10')](_0xca65('0xc'),_0xed8231,_0xab043[_0xca65('0x10')][_0xca65('0x12')]);return _0x218701(_0xab043['error'][_0xca65('0x12')]);}logger['error'](_0xca65('0xc'),_0xed8231,_0xab043['error'][_0xca65('0x12')]);return _0x362d1a(_0xab043[_0xca65('0x10')][_0xca65('0x12')]);}else{logger[_0xca65('0xb')](_0xca65('0xc'),_0xed8231,_0xca65('0xd'));_0x362d1a(_0xab043[_0xca65('0x13')][_0xca65('0x12')]);}})['catch'](function(_0x2dcfc0){logger['error'](_0xca65('0xc'),_0xed8231,_0x2dcfc0);_0x218701(_0x2dcfc0);});});}exports['CreateReportAgentPreview']=function(_0x1848e2){var _0x20c0c6=this;return new Promise(function(_0x19eb2c,_0x4c6d8d){return db[_0xca65('0x14')]['create'](_0x1848e2[_0xca65('0x15')],{'raw':_0x1848e2[_0xca65('0x16')]?_0x1848e2[_0xca65('0x16')][_0xca65('0x17')]===undefined?!![]:![]:!![]})[_0xca65('0xa')](function(_0xeb064c){logger[_0xca65('0xb')](_0xca65('0x18'),_0x1848e2);logger[_0xca65('0xe')]('CreateReportAgentPreview',_0x1848e2,JSON['stringify'](_0xeb064c));_0x19eb2c(_0xeb064c);})[_0xca65('0x19')](function(_0x206e0f){logger[_0xca65('0x10')](_0xca65('0x18'),_0x206e0f['message'],_0x1848e2);_0x4c6d8d(_0x20c0c6[_0xca65('0x10')](0x1f4,_0x206e0f[_0xca65('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 6997990..c4e1a06 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 _0xb1ba=['/chat/queues/:id','showChatQueues','post','/fax/queues/:id/notify','queueNotify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','showOpenchannelQueues','sms','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','path','express','Router','../../components/auth/service','./rpc.controller','get','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','mailQueues','/mail/accounts','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','mail','showMailQueues','/chat/queues/:id/notify','chat'];(function(_0xcd98ac,_0x301dc5){var _0x24402b=function(_0x32dd4c){while(--_0x32dd4c){_0xcd98ac['push'](_0xcd98ac['shift']());}};_0x24402b(++_0x301dc5);}(_0xb1ba,0x152));var _0xab1b=function(_0x388e58,_0x37b956){_0x388e58=_0x388e58-0x0;var _0x404de4=_0xb1ba[_0x388e58];return _0x404de4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xab1b('0x0'));var express=require(_0xab1b('0x1'));var router=express[_0xab1b('0x2')]();var auth=require(_0xab1b('0x3'));var controller=require(_0xab1b('0x4'));router[_0xab1b('0x5')]('/voice/channels',auth['isAuthenticated'](),controller[_0xab1b('0x6')]);router['get'](_0xab1b('0x7'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x9')]);router[_0xab1b('0x5')](_0xab1b('0xa'),auth[_0xab1b('0x8')](),controller['voiceChannelStopMixMonitor']);router[_0xab1b('0x5')](_0xab1b('0xb'),auth['isAuthenticated'](),controller[_0xab1b('0xc')]);router[_0xab1b('0x5')](_0xab1b('0xd'),auth[_0xab1b('0x8')](),controller['chatQueues']);router[_0xab1b('0x5')]('/mail/queues',auth[_0xab1b('0x8')](),controller[_0xab1b('0xe')]);router[_0xab1b('0x5')](_0xab1b('0xf'),auth[_0xab1b('0x8')](),controller['mailAccounts']);router[_0xab1b('0x5')]('/openchannel/queues',auth[_0xab1b('0x8')](),controller[_0xab1b('0x10')]);router['get'](_0xab1b('0x11'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x12')]);router[_0xab1b('0x5')](_0xab1b('0x13'),auth['isAuthenticated'](),controller[_0xab1b('0x14')]);router[_0xab1b('0x5')](_0xab1b('0x15'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x16')]);router[_0xab1b('0x5')]('/voice/queues/preview/:id',auth[_0xab1b('0x8')](),controller['voiceQueuesPreview']);router[_0xab1b('0x5')]('/voice/queues/channels',auth[_0xab1b('0x8')](),controller['voiceQueuesChannels']);router[_0xab1b('0x5')]('/voice/queues/channels/:uniqueid',auth[_0xab1b('0x8')](),controller['voiceQueuesChannel']);router[_0xab1b('0x5')](_0xab1b('0x17'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x18')]);router[_0xab1b('0x5')](_0xab1b('0x19'),auth[_0xab1b('0x8')](),controller['voiceQueuesChannelRedirect']);router[_0xab1b('0x5')](_0xab1b('0x1a'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x1b')]);router[_0xab1b('0x1c')](_0xab1b('0x1a'),auth['isAuthenticated'](),controller[_0xab1b('0x1d')]);router[_0xab1b('0x5')](_0xab1b('0x1e'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x1f')]);router[_0xab1b('0x5')]('/outbound/channels',auth[_0xab1b('0x8')](),controller[_0xab1b('0x20')]);router[_0xab1b('0x5')](_0xab1b('0x21'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x22')]);router['put'](_0xab1b('0x23'),auth['isAuthenticated'](),controller[_0xab1b('0x24')]);router[_0xab1b('0x5')](_0xab1b('0x25'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x26')]);router[_0xab1b('0x5')](_0xab1b('0x27'),auth['isAuthenticated'](),controller[_0xab1b('0x28')]);router[_0xab1b('0x5')](_0xab1b('0x29'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x2a')]);router['get'](_0xab1b('0x2b'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x2c')]);router[_0xab1b('0x5')](_0xab1b('0x2d'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x2e')]);router[_0xab1b('0x5')](_0xab1b('0x2f'),auth['isAuthenticated'](),controller[_0xab1b('0x30')]);router[_0xab1b('0x5')](_0xab1b('0x31'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x32')]);router[_0xab1b('0x5')](_0xab1b('0x33'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x34')]);router[_0xab1b('0x5')](_0xab1b('0x35'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x36')]);router['get']('/whatsapp/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xab1b('0x37')]);router[_0xab1b('0x5')](_0xab1b('0x38'),auth['isAuthenticated'](),controller[_0xab1b('0x39')]);router['post']('/mail/queues/:id/notify',auth[_0xab1b('0x8')](),controller['queueNotify'](_0xab1b('0x3a')));router[_0xab1b('0x5')]('/mail/queues/:id',auth[_0xab1b('0x8')](),controller[_0xab1b('0x3b')]);router['post'](_0xab1b('0x3c'),auth['isAuthenticated'](),controller['queueNotify'](_0xab1b('0x3d')));router[_0xab1b('0x5')](_0xab1b('0x3e'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x3f')]);router[_0xab1b('0x40')](_0xab1b('0x41'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x42')](_0xab1b('0x43')));router[_0xab1b('0x5')](_0xab1b('0x44'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x45')]);router[_0xab1b('0x40')](_0xab1b('0x46'),auth['isAuthenticated'](),controller[_0xab1b('0x42')]('openchannel'));router[_0xab1b('0x5')]('/openchannel/queues/:id',auth['isAuthenticated'](),controller[_0xab1b('0x47')]);router['post']('/sms/queues/:id/notify',auth[_0xab1b('0x8')](),controller[_0xab1b('0x42')](_0xab1b('0x48')));router[_0xab1b('0x40')]('/whatsapp/queues/:id/notify',auth['isAuthenticated'](),controller[_0xab1b('0x42')](_0xab1b('0x49')));router[_0xab1b('0x5')](_0xab1b('0x4a'),auth['isAuthenticated'](),controller[_0xab1b('0x4b')]);router[_0xab1b('0x5')](_0xab1b('0x4c'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x4d')]);router['post']('/agents/:id/notify',auth[_0xab1b('0x8')](),controller[_0xab1b('0x4e')]);module[_0xab1b('0x4f')]=router; \ No newline at end of file +var _0x6c5c=['/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','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/channels','outboundChannels','/agents','agents','agentCapacity','/telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','chat','/fax/queues/:id/notify','queueNotify','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','util','express','Router','../../components/auth/service','get','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','mailAccounts'];(function(_0x5c4ed6,_0x35f918){var _0x38ee25=function(_0x32aee7){while(--_0x32aee7){_0x5c4ed6['push'](_0x5c4ed6['shift']());}};_0x38ee25(++_0x35f918);}(_0x6c5c,0x124));var _0xc6c5=function(_0x356cec,_0x1340bb){_0x356cec=_0x356cec-0x0;var _0x2da0aa=_0x6c5c[_0x356cec];return _0x2da0aa;};'use strict';var multer=require('multer');var util=require(_0xc6c5('0x0'));var path=require('path');var express=require(_0xc6c5('0x1'));var router=express[_0xc6c5('0x2')]();var auth=require(_0xc6c5('0x3'));var controller=require('./rpc.controller');router[_0xc6c5('0x4')]('/voice/channels',auth[_0xc6c5('0x5')](),controller['voiceChannels']);router[_0xc6c5('0x4')](_0xc6c5('0x6'),auth['isAuthenticated'](),controller[_0xc6c5('0x7')]);router['get'](_0xc6c5('0x8'),auth[_0xc6c5('0x5')](),controller[_0xc6c5('0x9')]);router[_0xc6c5('0x4')](_0xc6c5('0xa'),auth[_0xc6c5('0x5')](),controller[_0xc6c5('0xb')]);router['get']('/chat/queues',auth[_0xc6c5('0x5')](),controller[_0xc6c5('0xc')]);router[_0xc6c5('0x4')](_0xc6c5('0xd'),auth[_0xc6c5('0x5')](),controller[_0xc6c5('0xe')]);router['get']('/mail/accounts',auth[_0xc6c5('0x5')](),controller[_0xc6c5('0xf')]);router[_0xc6c5('0x4')](_0xc6c5('0x10'),auth['isAuthenticated'](),controller[_0xc6c5('0x11')]);router[_0xc6c5('0x4')]('/sms/queues',auth[_0xc6c5('0x5')](),controller[_0xc6c5('0x12')]);router[_0xc6c5('0x4')](_0xc6c5('0x13'),auth[_0xc6c5('0x5')](),controller[_0xc6c5('0x14')]);router[_0xc6c5('0x4')](_0xc6c5('0x15'),auth[_0xc6c5('0x5')](),controller[_0xc6c5('0x16')]);router[_0xc6c5('0x4')](_0xc6c5('0x17'),auth[_0xc6c5('0x5')](),controller[_0xc6c5('0x18')]);router[_0xc6c5('0x4')]('/voice/queues/channels',auth[_0xc6c5('0x5')](),controller[_0xc6c5('0x19')]);router['get'](_0xc6c5('0x1a'),auth['isAuthenticated'](),controller[_0xc6c5('0x1b')]);router[_0xc6c5('0x4')](_0xc6c5('0x1c'),auth['isAuthenticated'](),controller[_0xc6c5('0x1d')]);router[_0xc6c5('0x4')](_0xc6c5('0x1e'),auth[_0xc6c5('0x5')](),controller[_0xc6c5('0x1f')]);router[_0xc6c5('0x4')](_0xc6c5('0x20'),auth[_0xc6c5('0x5')](),controller['showVoiceQueues']);router[_0xc6c5('0x21')](_0xc6c5('0x20'),auth['isAuthenticated'](),controller['updateVoiceQueue']);router[_0xc6c5('0x4')](_0xc6c5('0x22'),auth[_0xc6c5('0x5')](),controller['outbound']);router[_0xc6c5('0x4')](_0xc6c5('0x23'),auth['isAuthenticated'](),controller[_0xc6c5('0x24')]);router['get'](_0xc6c5('0x25'),auth[_0xc6c5('0x5')](),controller[_0xc6c5('0x26')]);router[_0xc6c5('0x21')]('/agents/:id/capacity',auth[_0xc6c5('0x5')](),controller[_0xc6c5('0x27')]);router[_0xc6c5('0x4')](_0xc6c5('0x28'),auth[_0xc6c5('0x5')](),controller['telephones']);router['get']('/trunks',auth[_0xc6c5('0x5')](),controller[_0xc6c5('0x29')]);router['get'](_0xc6c5('0x2a'),auth['isAuthenticated'](),controller[_0xc6c5('0x2b')]);router['get'](_0xc6c5('0x2c'),auth['isAuthenticated'](),controller[_0xc6c5('0x2d')]);router['get'](_0xc6c5('0x2e'),auth[_0xc6c5('0x5')](),controller[_0xc6c5('0x2f')]);router[_0xc6c5('0x4')](_0xc6c5('0x30'),auth[_0xc6c5('0x5')](),controller[_0xc6c5('0x31')]);router[_0xc6c5('0x4')](_0xc6c5('0x32'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0xc6c5('0x4')](_0xc6c5('0x33'),auth['isAuthenticated'](),controller['openchannelQueuesIdWaitingInteractions']);router['get']('/sms/queues/waitinginteractions',auth[_0xc6c5('0x5')](),controller[_0xc6c5('0x34')]);router[_0xc6c5('0x4')]('/whatsapp/queues/waitinginteractions',auth[_0xc6c5('0x5')](),controller[_0xc6c5('0x35')]);router[_0xc6c5('0x4')](_0xc6c5('0x36'),auth[_0xc6c5('0x5')](),controller[_0xc6c5('0x37')]);router['post']('/mail/queues/:id/notify',auth[_0xc6c5('0x5')](),controller['queueNotify']('mail'));router['get'](_0xc6c5('0x38'),auth[_0xc6c5('0x5')](),controller[_0xc6c5('0x39')]);router[_0xc6c5('0x3a')](_0xc6c5('0x3b'),auth[_0xc6c5('0x5')](),controller['queueNotify'](_0xc6c5('0x3c')));router['get']('/chat/queues/:id',auth[_0xc6c5('0x5')](),controller['showChatQueues']);router[_0xc6c5('0x3a')](_0xc6c5('0x3d'),auth[_0xc6c5('0x5')](),controller[_0xc6c5('0x3e')](_0xc6c5('0x3f')));router[_0xc6c5('0x4')]('/fax/queues/:id',auth[_0xc6c5('0x5')](),controller[_0xc6c5('0x40')]);router[_0xc6c5('0x3a')](_0xc6c5('0x41'),auth[_0xc6c5('0x5')](),controller[_0xc6c5('0x3e')](_0xc6c5('0x42')));router['get'](_0xc6c5('0x43'),auth[_0xc6c5('0x5')](),controller[_0xc6c5('0x44')]);router[_0xc6c5('0x3a')](_0xc6c5('0x45'),auth['isAuthenticated'](),controller[_0xc6c5('0x3e')](_0xc6c5('0x46')));router[_0xc6c5('0x3a')](_0xc6c5('0x47'),auth[_0xc6c5('0x5')](),controller[_0xc6c5('0x3e')]('whatsapp'));router[_0xc6c5('0x4')]('/sms/queues/:id',auth['isAuthenticated'](),controller[_0xc6c5('0x48')]);router[_0xc6c5('0x4')](_0xc6c5('0x49'),auth['isAuthenticated'](),controller[_0xc6c5('0x4a')]);router[_0xc6c5('0x3a')](_0xc6c5('0x4b'),auth['isAuthenticated'](),controller['agentNotify']);module[_0xc6c5('0x4c')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index e5a1b25..da6efd5 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 _0xb4c7=['query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','user','interaction','MemberReport','findAll','INTERACTION','length','updateAttributes','findOrCreate','format','SIP/%s','interface','agent','internal','AgentCapacity','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','WhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','indexOf','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','update','MessageId','From','QueueId','TransferReport','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','User','messageId','queue','InteractionId','Start','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','api','jayson/promise','client','http','request','then','error','code','message','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels'];(function(_0x44ec46,_0x1a702c){var _0x1a1b2a=function(_0x2b4dbe){while(--_0x2b4dbe){_0x44ec46['push'](_0x44ec46['shift']());}};_0x1a1b2a(++_0x1a702c);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x2d406c,_0x3f4bc3){_0x2d406c=_0x2d406c-0x0;var _0x3fcec8=_0xb4c7[_0x2d406c];return _0x3fcec8;};'use strict';var BPromise=require(_0x7b4c('0x0'));var moment=require(_0x7b4c('0x1'));var _=require(_0x7b4c('0x2'));var util=require(_0x7b4c('0x3'));var db=require(_0x7b4c('0x4'))['db'];var logger=require('../../config/logger')(_0x7b4c('0x5'));var jayson=require(_0x7b4c('0x6'));var amiClient=jayson[_0x7b4c('0x7')][_0x7b4c('0x8')]({'port':0x232a});var mailClient=jayson[_0x7b4c('0x7')]['http']({'port':0x232b});var routingClient=jayson[_0x7b4c('0x7')][_0x7b4c('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x2dd5c7,_0x4bf85d,_0x2d7b7e){return new BPromise(function(_0x21687f,_0x570daa){var _0x433aa2=_0x2d7b7e?_0x2d7b7e:amiClient;return _0x433aa2[_0x7b4c('0x9')](_0x2dd5c7,_0x4bf85d)[_0x7b4c('0xa')](function(_0x237e28){if(_0x237e28[_0x7b4c('0xb')]){if(_0x237e28[_0x7b4c('0xb')][_0x7b4c('0xc')]===0x1f4){return _0x570daa(_0x237e28[_0x7b4c('0xb')][_0x7b4c('0xd')]);}return _0x21687f(_0x237e28[_0x7b4c('0xb')]['message']);}else{_0x21687f(_0x237e28['result']);}})[_0x7b4c('0xe')](function(_0x18342b){_0x570daa(_0x18342b);});});}function respondWithResult(_0x38656b,_0x1722ad){_0x1722ad=_0x1722ad||0xc8;return function(_0x3e1558){if(_0x3e1558){return _0x38656b[_0x7b4c('0xf')](_0x1722ad)[_0x7b4c('0x10')](_0x3e1558);}return _0x38656b[_0x7b4c('0x11')](0x194);};}function handleError(_0x25b90b,_0x387488){_0x387488=_0x387488||0x1f4;return function(_0x593a19){logger[_0x7b4c('0xb')](_0x593a19[_0x7b4c('0x12')]);if(_0x593a19[_0x7b4c('0x13')]){delete _0x593a19[_0x7b4c('0x13')];}_0x25b90b[_0x7b4c('0xf')](_0x387488)[_0x7b4c('0x14')](_0x593a19);};}function findById(_0x1642e1){return function(_0x22c409){if(!_['isNil'](_0x1642e1)&&!_[_0x7b4c('0x15')](_0x22c409)&&!_[_0x7b4c('0x15')](_0x22c409[_0x7b4c('0x16')])){return _[_0x7b4c('0x17')](_0x22c409['rows'],function(_0x3ce10c){return _0x3ce10c['id']==_0x1642e1;});}return null;};}exports[_0x7b4c('0x18')]=function(_0x32110e,_0x380b79){return respondWithRpcPromise(_0x7b4c('0x19'),_0x32110e[_0x7b4c('0x1a')])[_0x7b4c('0xa')](respondWithResult(_0x380b79,null))[_0x7b4c('0xe')](handleError(_0x380b79,null));};exports[_0x7b4c('0x1b')]=function(_0x55e3df,_0x1f06ec){return respondWithRpcPromise(_0x7b4c('0x1c'),_[_0x7b4c('0x1d')](_0x55e3df[_0x7b4c('0x1a')],_0x55e3df[_0x7b4c('0x1e')]))[_0x7b4c('0xa')](respondWithResult(_0x1f06ec,null))[_0x7b4c('0xe')](handleError(_0x1f06ec,null));};exports[_0x7b4c('0x1f')]=function(_0x2ab9e1,_0x2c267c){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x7b4c('0x1d')](_0x2ab9e1[_0x7b4c('0x1a')],_0x2ab9e1[_0x7b4c('0x1e')]))[_0x7b4c('0xa')](respondWithResult(_0x2c267c,null))[_0x7b4c('0xe')](handleError(_0x2c267c,null));};exports[_0x7b4c('0x20')]=function(_0x37c059,_0x459eb4){return respondWithRpcPromise(_0x7b4c('0x21'),_0x37c059[_0x7b4c('0x1a')])[_0x7b4c('0xa')](respondWithResult(_0x459eb4,null))[_0x7b4c('0xe')](handleError(_0x459eb4,null));};exports[_0x7b4c('0x22')]=function(_0x501f75,_0x27f361){return respondWithRpcPromise(_0x7b4c('0x21'),_0x501f75[_0x7b4c('0x1a')])[_0x7b4c('0xa')](findById(_0x501f75[_0x7b4c('0x1e')]['id']))[_0x7b4c('0xa')](respondWithResult(_0x27f361,null))[_0x7b4c('0xe')](handleError(_0x27f361,null));};exports[_0x7b4c('0x23')]=function(_0x3e4a46,_0x9a799b){return respondWithRpcPromise(_0x7b4c('0x24'),_[_0x7b4c('0x1d')](_0x3e4a46[_0x7b4c('0x25')],_0x3e4a46[_0x7b4c('0x1e')]))[_0x7b4c('0xa')](respondWithResult(_0x9a799b,null))[_0x7b4c('0xe')](handleError(_0x9a799b,null));};exports[_0x7b4c('0x26')]=function(_0xce5781,_0x9d3d31){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0xce5781['query'],_0xce5781[_0x7b4c('0x1e')]))[_0x7b4c('0xa')](respondWithResult(_0x9d3d31,null))[_0x7b4c('0xe')](handleError(_0x9d3d31,null));};exports[_0x7b4c('0x27')]=function(_0x498391,_0x6e66e3){return respondWithRpcPromise(_0x7b4c('0x28'),_0x498391['query'])[_0x7b4c('0xa')](respondWithResult(_0x6e66e3,null))['catch'](handleError(_0x6e66e3,null));};exports[_0x7b4c('0x29')]=function(_0x3b9149,_0x159001){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x7b4c('0x1d')](_0x3b9149[_0x7b4c('0x1a')],_0x3b9149['params']))[_0x7b4c('0xa')](respondWithResult(_0x159001,null))[_0x7b4c('0xe')](handleError(_0x159001,null));};exports[_0x7b4c('0x2a')]=function(_0x2e0835,_0x56ff38){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x7b4c('0x1d')](_0x2e0835[_0x7b4c('0x1a')],_0x2e0835['params']))[_0x7b4c('0xa')](respondWithResult(_0x56ff38,null))['catch'](handleError(_0x56ff38,null));};exports['voiceQueuesChannelRedirect']=function(_0x11ca38,_0x16ae89){return respondWithRpcPromise(_0x7b4c('0x2b'),_[_0x7b4c('0x1d')](_0x11ca38['query'],_0x11ca38[_0x7b4c('0x1e')]))[_0x7b4c('0xa')](respondWithResult(_0x16ae89,null))[_0x7b4c('0xe')](handleError(_0x16ae89,null));};exports[_0x7b4c('0x2c')]=function(_0x346e0c,_0xddd16){return respondWithRpcPromise(_0x7b4c('0x2d'),_0x346e0c['query'])['then'](respondWithResult(_0xddd16,null))[_0x7b4c('0xe')](handleError(_0xddd16,null));};exports[_0x7b4c('0x2e')]=function(_0x31ef1e,_0x123a3a){return respondWithRpcPromise(_0x7b4c('0x2f'),_0x31ef1e['query'])[_0x7b4c('0xa')](respondWithResult(_0x123a3a,null))[_0x7b4c('0xe')](handleError(_0x123a3a,null));};exports[_0x7b4c('0x30')]=function(_0x26346a,_0x22f71b){var _0x25659d;return respondWithRpcPromise(_0x7b4c('0x31'),_0x26346a[_0x7b4c('0x1a')])[_0x7b4c('0xa')](function(_0x54cd10){_0x25659d=_0x54cd10;return respondWithRpcPromise(_0x7b4c('0x31'),_0x26346a['query'],routingClient);})[_0x7b4c('0xa')](function(_0x4dc71f){return _[_0x7b4c('0x1d')]({},_0x4dc71f,_0x25659d);})[_0x7b4c('0xa')](respondWithResult(_0x22f71b,null))['catch'](handleError(_0x22f71b,null));};exports['agentCapacity']=function(_0x354578,_0x4314b6){if(_0x354578[_0x7b4c('0x25')]&&_0x354578[_0x7b4c('0x25')]['interaction']&&_0x354578[_0x7b4c('0x32')]&&_0x354578[_0x7b4c('0x32')][_0x7b4c('0x13')]){for(var _0x5d4ed8 in _0x354578[_0x7b4c('0x25')]['interaction']){if(_0x354578['body'][_0x7b4c('0x33')]['hasOwnProperty'](_0x5d4ed8)){db[_0x7b4c('0x34')][_0x7b4c('0x35')]({'where':{'channel':_0x5d4ed8,'membername':_0x354578[_0x7b4c('0x32')][_0x7b4c('0x13')],'type':_0x7b4c('0x36'),'exitAt':null,'uniqueid':_0x354578[_0x7b4c('0x25')][_0x7b4c('0x33')][_0x5d4ed8]&&_0x354578[_0x7b4c('0x25')][_0x7b4c('0x33')][_0x5d4ed8]['length']?{'$notIn':_0x354578[_0x7b4c('0x25')]['interaction'][_0x5d4ed8]}:{'$ne':null}}})['then'](function(_0x23372c){var _0x1f1653=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x255cca=0x0,_0x2ce694=_0x23372c[_0x7b4c('0x37')];_0x255cca<_0x2ce694;_0x255cca+=0x1){_0x23372c[_0x255cca][_0x7b4c('0x38')]({'exitAt':_0x1f1653});}});for(var _0x8ebf9b=0x0;_0x8ebf9b<_0x354578[_0x7b4c('0x25')][_0x7b4c('0x33')][_0x5d4ed8][_0x7b4c('0x37')];_0x8ebf9b+=0x1){db['MemberReport'][_0x7b4c('0x39')]({'where':{'channel':_0x5d4ed8,'membername':_0x354578[_0x7b4c('0x32')][_0x7b4c('0x13')],'type':_0x7b4c('0x36'),'uniqueid':_0x354578[_0x7b4c('0x25')][_0x7b4c('0x33')][_0x5d4ed8][_0x8ebf9b],'exitAt':null},'defaults':{'channel':_0x5d4ed8,'membername':_0x354578[_0x7b4c('0x32')][_0x7b4c('0x13')],'interface':_[_0x7b4c('0x15')](_0x354578['user']['interface'])?util[_0x7b4c('0x3a')](_0x7b4c('0x3b'),_0x354578[_0x7b4c('0x32')]['name']):_0x354578[_0x7b4c('0x32')][_0x7b4c('0x3c')],'type':'INTERACTION','enterAt':moment()[_0x7b4c('0x3a')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x7b4c('0x3d'),'internal':_0x354578['user'][_0x7b4c('0x3e')],'uniqueid':_0x354578['body'][_0x7b4c('0x33')][_0x5d4ed8][_0x8ebf9b]}});}}}}return respondWithRpcPromise(_0x7b4c('0x3f'),{'id':_0x354578['params']['id'],'capacity':_0x354578['body'][_0x7b4c('0x40')]},routingClient)[_0x7b4c('0xa')](respondWithResult(_0x4314b6,null))[_0x7b4c('0xe')](handleError(_0x4314b6,null));};exports['telephones']=function(_0x56233b,_0x2fc5b5){return respondWithRpcPromise(_0x7b4c('0x41'),_0x56233b['query'])['then'](respondWithResult(_0x2fc5b5,null))[_0x7b4c('0xe')](handleError(_0x2fc5b5,null));};exports[_0x7b4c('0x42')]=function(_0x166fd1,_0x4b2207){return respondWithRpcPromise(_0x7b4c('0x43'),_0x166fd1[_0x7b4c('0x1a')])['then'](respondWithResult(_0x4b2207,null))['catch'](handleError(_0x4b2207,null));};exports[_0x7b4c('0x44')]=function(_0x4d8491,_0x59db20){return respondWithRpcPromise(_0x7b4c('0x45'),_0x4d8491['query'])['then'](respondWithResult(_0x59db20,null))[_0x7b4c('0xe')](handleError(_0x59db20,null));};exports[_0x7b4c('0x46')]=function(_0xde9f5,_0x17af17){return respondWithRpcPromise('ChatQueues',_0xde9f5['query'],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x17af17,null))[_0x7b4c('0xe')](handleError(_0x17af17,null));};exports[_0x7b4c('0x47')]=function(_0x59b358,_0x255262){return respondWithRpcPromise(_0x7b4c('0x48'),_0x59b358[_0x7b4c('0x1a')],routingClient)['then'](findById(_0x59b358[_0x7b4c('0x1e')]['id']))[_0x7b4c('0xa')](respondWithResult(_0x255262,null))['catch'](handleError(_0x255262,null));};exports[_0x7b4c('0x49')]=function(_0x186e7d,_0x30de26){return respondWithRpcPromise(_0x7b4c('0x4a'),_0x186e7d[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x30de26,null))[_0x7b4c('0xe')](handleError(_0x30de26,null));};exports['showMailQueues']=function(_0x4443d0,_0x2dc79a){return respondWithRpcPromise('MailQueues',_0x4443d0[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](findById(_0x4443d0[_0x7b4c('0x1e')]['id']))[_0x7b4c('0xa')](respondWithResult(_0x2dc79a,null))['catch'](handleError(_0x2dc79a,null));};exports[_0x7b4c('0x4b')]=function(_0x4e84a3,_0x542b85){return respondWithRpcPromise(_0x7b4c('0x4c'),_0x4e84a3[_0x7b4c('0x1a')],mailClient)[_0x7b4c('0xa')](respondWithResult(_0x542b85,null))[_0x7b4c('0xe')](handleError(_0x542b85,null));};exports[_0x7b4c('0x4d')]=function(_0x5b24f6,_0x4fcc9d){return respondWithRpcPromise(_0x7b4c('0x4e'),_0x5b24f6[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x4fcc9d,null))['catch'](handleError(_0x4fcc9d,null));};exports[_0x7b4c('0x4f')]=function(_0xc4dae0,_0x36fc5d){return respondWithRpcPromise('OpenchannelQueues',_0xc4dae0[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](findById(_0xc4dae0[_0x7b4c('0x1e')]['id']))['then'](respondWithResult(_0x36fc5d,null))[_0x7b4c('0xe')](handleError(_0x36fc5d,null));};exports[_0x7b4c('0x50')]=function(_0x4ac03e,_0x1c64d5){return respondWithRpcPromise('SmsQueues',_0x4ac03e[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x1c64d5,null))[_0x7b4c('0xe')](handleError(_0x1c64d5,null));};exports['showSmsQueues']=function(_0x5af2af,_0x237921){return respondWithRpcPromise(_0x7b4c('0x51'),_0x5af2af[_0x7b4c('0x1a')],routingClient)['then'](findById(_0x5af2af[_0x7b4c('0x1e')]['id']))['then'](respondWithResult(_0x237921,null))[_0x7b4c('0xe')](handleError(_0x237921,null));};exports[_0x7b4c('0x52')]=function(_0x1315bd,_0x5f3ed5){return respondWithRpcPromise(_0x7b4c('0x53'),_0x1315bd['query'],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x5f3ed5,null))[_0x7b4c('0xe')](handleError(_0x5f3ed5,null));};exports['showWhatsappQueues']=function(_0x7a38e,_0x13a882){return respondWithRpcPromise(_0x7b4c('0x53'),_0x7a38e[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](findById(_0x7a38e[_0x7b4c('0x1e')]['id']))[_0x7b4c('0xa')](respondWithResult(_0x13a882,null))[_0x7b4c('0xe')](handleError(_0x13a882,null));};exports['faxQueues']=function(_0x10d5b3,_0x2dc9a4){return respondWithRpcPromise(_0x7b4c('0x54'),_0x10d5b3[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x2dc9a4,null))[_0x7b4c('0xe')](handleError(_0x2dc9a4,null));};exports[_0x7b4c('0x55')]=function(_0x2a5f6e,_0x34fce4){return respondWithRpcPromise(_0x7b4c('0x54'),_0x2a5f6e[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](findById(_0x2a5f6e[_0x7b4c('0x1e')]['id']))[_0x7b4c('0xa')](respondWithResult(_0x34fce4,null))[_0x7b4c('0xe')](handleError(_0x34fce4,null));};exports[_0x7b4c('0x56')]=function(_0x168aa1,_0x36c7d9){return respondWithRpcPromise(_0x7b4c('0x57'),_0x168aa1[_0x7b4c('0x1a')])['then'](respondWithResult(_0x36c7d9,null))['catch'](handleError(_0x36c7d9,null));};exports[_0x7b4c('0x58')]=function(_0x15033e,_0x50069b){return respondWithRpcPromise(_0x7b4c('0x59'),_0x15033e[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x50069b,null))[_0x7b4c('0xe')](handleError(_0x50069b,null));};exports[_0x7b4c('0x5a')]=function(_0x15df66,_0x22a254){return respondWithRpcPromise(_0x7b4c('0x5b'),_0x15df66[_0x7b4c('0x1a')],routingClient)['then'](respondWithResult(_0x22a254,null))[_0x7b4c('0xe')](handleError(_0x22a254,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x35067f,_0x5477e3){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x35067f[_0x7b4c('0x1a')],routingClient)['then'](respondWithResult(_0x5477e3,null))['catch'](handleError(_0x5477e3,null));};exports[_0x7b4c('0x5c')]=function(_0x2d17ed,_0x328948){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x2d17ed[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](function(_0x10e789){if(_0x2d17ed[_0x7b4c('0x1a')][_0x7b4c('0x5d')]!==undefined){var _0x2837aa=_(_0x10e789[_0x7b4c('0x16')])[_0x7b4c('0x5e')]([_0x2d17ed[_0x7b4c('0x1a')][_0x7b4c('0x5d')],_0x2d17ed[_0x7b4c('0x1e')]['id']])[_0x7b4c('0x5f')](_0x7b4c('0x60'))[_0x7b4c('0x61')]()['value']();return _0x10e789[_0x7b4c('0x16')][_0x7b4c('0x5e')](function(_0x35e94a){return _0x2837aa[_0x7b4c('0x62')](_0x35e94a['queue_id'])>-0x1;});}else{return _0x10e789[_0x7b4c('0x16')][_0x7b4c('0x5e')](function(_0x149d53){return _0x149d53[_0x7b4c('0x60')]===parseInt(_0x2d17ed[_0x7b4c('0x1e')]['id']);});}})[_0x7b4c('0xa')](respondWithResult(_0x328948,null))[_0x7b4c('0xe')](handleError(_0x328948,null));};exports['smsQueuesWaitingInteractions']=function(_0x11c809,_0x108c99){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x11c809['query'],routingClient)['then'](respondWithResult(_0x108c99,null))[_0x7b4c('0xe')](handleError(_0x108c99,null));};exports[_0x7b4c('0x63')]=function(_0x24d4f9,_0x19804d){return respondWithRpcPromise(_0x7b4c('0x64'),_0x24d4f9[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x19804d,null))[_0x7b4c('0xe')](handleError(_0x19804d,null));};exports[_0x7b4c('0x65')]=function(_0x2bc889,_0x83e8bb){return respondWithRpcPromise(_0x7b4c('0x66'),_0x2bc889[_0x7b4c('0x1a')],routingClient)['then'](respondWithResult(_0x83e8bb,null))[_0x7b4c('0xe')](handleError(_0x83e8bb,null));};exports[_0x7b4c('0x67')]=function(_0x2afaa0){return function(_0x5dc6e6,_0x39c01d){var _0x392656,_0x1faa6f;var _0x3999bf=_[_0x7b4c('0x68')](_0x2afaa0);var _0x57f1a0=_0x2afaa0===_0x7b4c('0x69')?_0x7b4c('0x6a'):_0x7b4c('0x6b');return db[_0x3999bf+_0x7b4c('0x6c')]['findOne']({'raw':!![],'where':{'id':_0x5dc6e6[_0x7b4c('0x1e')]['id']}})[_0x7b4c('0xa')](function(_0xdfa0bc){if(_['isNil'](_0xdfa0bc)){throw new Error(_0x3999bf+_0x7b4c('0x6d'));}_0x392656=_0xdfa0bc;return db[_0x3999bf+_0x7b4c('0x6e')][_0x7b4c('0x6f')]({'where':{'id':_0x5dc6e6[_0x7b4c('0x25')]['messageId']},'include':[{'model':db[_0x3999bf+_0x7b4c('0x70')],'as':_0x7b4c('0x70')},{'model':db[_0x3999bf+_0x57f1a0],'as':_0x7b4c('0x6b')}]});})[_0x7b4c('0xa')](function(_0x50c382){if(_[_0x7b4c('0x15')](_0x50c382)){throw new Error(_0x3999bf+'\x20Message\x20not\x20found');}_0x1faa6f=_0x50c382;return _0x50c382[_0x7b4c('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x24690a={'uniqueid':_0x2afaa0+'.'+_0x1faa6f['id']+'.'+_0x1faa6f[_0x7b4c('0x70')]['id'],'FromUserId':_0x5dc6e6[_0x7b4c('0x32')]['id'],'type':'queue'};_0x24690a[_0x3999bf+_0x7b4c('0x72')]=_0x1faa6f['id'];_0x24690a[_0x3999bf+'InteractionId']=_0x1faa6f[_0x7b4c('0x70')]['id'];_0x24690a[_0x7b4c('0x73')+_0x3999bf+_0x57f1a0+'Id']=_0x1faa6f['Account']['id'];_0x24690a['To'+_0x3999bf+_0x7b4c('0x74')]=_0x392656['id'];return db[_0x3999bf+_0x7b4c('0x75')][_0x7b4c('0x76')](_0x24690a);})[_0x7b4c('0xa')](function(){return respondWithRpcPromise('Start',{'channel':_0x2afaa0,'interaction':_0x1faa6f[_0x7b4c('0x70')],'message':_0x1faa6f,'account':_0x1faa6f[_0x7b4c('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x392656[_0x7b4c('0x13')]+','+(_0x1faa6f[_0x7b4c('0x6b')][_0x7b4c('0x77')]||0x12c),'interval':_0x7b4c('0x78')}]},routingClient);})[_0x7b4c('0xa')](respondWithResult(_0x39c01d,null))[_0x7b4c('0xe')](handleError(_0x39c01d,null));};};exports[_0x7b4c('0x79')]=function(_0x4e9781,_0x5ec399){var _0xdb202,_0x433d74;if(_[_0x7b4c('0x15')](_0x4e9781[_0x7b4c('0x25')][_0x7b4c('0x7a')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x228b2b=_0x4e9781[_0x7b4c('0x25')][_0x7b4c('0x7a')];var _0x331db1=_['capitalize'](_0x228b2b);var _0x56ba6f=_0x228b2b===_0x7b4c('0x69')?_0x7b4c('0x6a'):_0x7b4c('0x6b');return db[_0x7b4c('0x7b')][_0x7b4c('0x6f')]({'raw':!![],'where':{'id':_0x4e9781['params']['id'],'role':_0x7b4c('0x3d')}})[_0x7b4c('0xa')](function(_0x450eca){if(_[_0x7b4c('0x15')](_0x450eca)){throw new Error('Agent\x20not\x20found');}_0xdb202=_0x450eca;return db[_0x331db1+'Message']['findOne']({'where':{'id':_0x4e9781[_0x7b4c('0x25')][_0x7b4c('0x7c')]},'include':[{'model':db[_0x331db1+_0x7b4c('0x70')],'as':'Interaction'},{'model':db[_0x331db1+_0x56ba6f],'as':_0x7b4c('0x6b')}]});})['then'](function(_0x530030){if(_[_0x7b4c('0x15')](_0x530030)){throw new Error(_0x331db1+'\x20Message\x20not\x20found');}_0x433d74=_0x530030;return _0x530030[_0x7b4c('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x7b4c('0xa')](function(){var _0x5e444a={'uniqueid':_0x228b2b+'.'+_0x433d74['id']+'.'+_0x433d74['Interaction']['id'],'FromUserId':_0x4e9781[_0x7b4c('0x32')]['id'],'type':_0x7b4c('0x7d'),'ToUserId':_0xdb202['id']};_0x5e444a[_0x331db1+_0x7b4c('0x72')]=_0x433d74['id'];_0x5e444a[_0x331db1+_0x7b4c('0x7e')]=_0x433d74['Interaction']['id'];_0x5e444a['From'+_0x331db1+_0x56ba6f+'Id']=_0x433d74[_0x7b4c('0x6b')]['id'];return db[_0x331db1+_0x7b4c('0x75')][_0x7b4c('0x76')](_0x5e444a);})[_0x7b4c('0xa')](function(){return respondWithRpcPromise(_0x7b4c('0x7f'),{'channel':_0x228b2b,'interaction':_0x433d74[_0x7b4c('0x70')],'message':_0x433d74,'account':_0x433d74[_0x7b4c('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0xdb202[_0x7b4c('0x13')]+','+(_0x433d74[_0x7b4c('0x6b')][_0x7b4c('0x80')]||0x12c),'interval':_0x7b4c('0x78')}]},routingClient);})[_0x7b4c('0xa')](respondWithResult(_0x5ec399,null))[_0x7b4c('0xe')](handleError(_0x5ec399,null));}; \ No newline at end of file +var _0x1cb9=['query','params','voiceChannelStopMixMonitor','voiceQueues','VoiceQueues','updateVoiceQueue','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelRedirect','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','MemberReport','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','length','findOrCreate','agent','AgentCapacity','telephones','trunks','Trunks','campaigns','Campaigns','ChatQueues','showChatQueues','MailQueues','mailAccounts','MailAccounts','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','map','value','filter','indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','findOne','\x20Queue\x20not\x20found','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','Agent\x20not\x20found','Message','bluebird','lodash','util','../../mysqldb','../../config/logger','jayson/promise','client','http','then','error','code','message','result','status','json','sendStatus','name','send','isNil','rows','find','voiceChannels','VoiceChannels','catch','voiceChannelMixMonitor','merge'];(function(_0x1757c8,_0x4aa781){var _0x3059f1=function(_0xb9d7f){while(--_0xb9d7f){_0x1757c8['push'](_0x1757c8['shift']());}};_0x3059f1(++_0x4aa781);}(_0x1cb9,0x14e));var _0x91cb=function(_0x10938e,_0x465bc6){_0x10938e=_0x10938e-0x0;var _0x43974d=_0x1cb9[_0x10938e];return _0x43974d;};'use strict';var BPromise=require(_0x91cb('0x0'));var moment=require('moment');var _=require(_0x91cb('0x1'));var util=require(_0x91cb('0x2'));var db=require(_0x91cb('0x3'))['db'];var logger=require(_0x91cb('0x4'))('api');var jayson=require(_0x91cb('0x5'));var amiClient=jayson[_0x91cb('0x6')]['http']({'port':0x232a});var mailClient=jayson[_0x91cb('0x6')][_0x91cb('0x7')]({'port':0x232b});var routingClient=jayson[_0x91cb('0x6')][_0x91cb('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){var _0x2fdfce=_0x4c1f56?_0x4c1f56:amiClient;return _0x2fdfce['request'](_0x3b9d98,_0x8f8a3b)[_0x91cb('0x8')](function(_0x317df0){if(_0x317df0[_0x91cb('0x9')]){if(_0x317df0[_0x91cb('0x9')][_0x91cb('0xa')]===0x1f4){return _0x5bda2f(_0x317df0[_0x91cb('0x9')][_0x91cb('0xb')]);}return _0x15c517(_0x317df0[_0x91cb('0x9')][_0x91cb('0xb')]);}else{_0x15c517(_0x317df0[_0x91cb('0xc')]);}})['catch'](function(_0x3c1f56){_0x5bda2f(_0x3c1f56);});});}function respondWithResult(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xc8;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0xd')](_0x4ba2f2)[_0x91cb('0xe')](_0x20e6e0);}return _0x366f09[_0x91cb('0xf')](0x194);};}function handleError(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0x1f4;return function(_0x4aae25){logger[_0x91cb('0x9')](_0x4aae25['stack']);if(_0x4aae25['name']){delete _0x4aae25[_0x91cb('0x10')];}_0x4a7d45[_0x91cb('0xd')](_0x4cc6ef)[_0x91cb('0x11')](_0x4aae25);};}function findById(_0x5ea796){return function(_0x238f11){if(!_[_0x91cb('0x12')](_0x5ea796)&&!_['isNil'](_0x238f11)&&!_[_0x91cb('0x12')](_0x238f11[_0x91cb('0x13')])){return _[_0x91cb('0x14')](_0x238f11[_0x91cb('0x13')],function(_0x5cc1c3){return _0x5cc1c3['id']==_0x5ea796;});}return null;};}exports[_0x91cb('0x15')]=function(_0x7dcf60,_0x4ca8e8){return respondWithRpcPromise(_0x91cb('0x16'),_0x7dcf60['query'])['then'](respondWithResult(_0x4ca8e8,null))[_0x91cb('0x17')](handleError(_0x4ca8e8,null));};exports[_0x91cb('0x18')]=function(_0x56e409,_0x51a1d5){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x91cb('0x19')](_0x56e409[_0x91cb('0x1a')],_0x56e409[_0x91cb('0x1b')]))[_0x91cb('0x8')](respondWithResult(_0x51a1d5,null))['catch'](handleError(_0x51a1d5,null));};exports[_0x91cb('0x1c')]=function(_0x43881c,_0x1fa837){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x91cb('0x19')](_0x43881c[_0x91cb('0x1a')],_0x43881c[_0x91cb('0x1b')]))[_0x91cb('0x8')](respondWithResult(_0x1fa837,null))[_0x91cb('0x17')](handleError(_0x1fa837,null));};exports[_0x91cb('0x1d')]=function(_0x414e60,_0x423c4f){return respondWithRpcPromise(_0x91cb('0x1e'),_0x414e60['query'])['then'](respondWithResult(_0x423c4f,null))[_0x91cb('0x17')](handleError(_0x423c4f,null));};exports['showVoiceQueues']=function(_0x1c67d2,_0x34d372){return respondWithRpcPromise(_0x91cb('0x1e'),_0x1c67d2['query'])[_0x91cb('0x8')](findById(_0x1c67d2['params']['id']))[_0x91cb('0x8')](respondWithResult(_0x34d372,null))[_0x91cb('0x17')](handleError(_0x34d372,null));};exports[_0x91cb('0x1f')]=function(_0x2fb473,_0x468908){return respondWithRpcPromise('UpdateVoiceQueue',_[_0x91cb('0x19')](_0x2fb473['body'],_0x2fb473[_0x91cb('0x1b')]))[_0x91cb('0x8')](respondWithResult(_0x468908,null))[_0x91cb('0x17')](handleError(_0x468908,null));};exports['voiceQueuesPreview']=function(_0x775c25,_0x146e1f){return respondWithRpcPromise(_0x91cb('0x20'),_[_0x91cb('0x19')](_0x775c25[_0x91cb('0x1a')],_0x775c25[_0x91cb('0x1b')]))[_0x91cb('0x8')](respondWithResult(_0x146e1f,null))[_0x91cb('0x17')](handleError(_0x146e1f,null));};exports[_0x91cb('0x21')]=function(_0x5e6ed3,_0x2ccf6e){return respondWithRpcPromise(_0x91cb('0x22'),_0x5e6ed3[_0x91cb('0x1a')])[_0x91cb('0x8')](respondWithResult(_0x2ccf6e,null))[_0x91cb('0x17')](handleError(_0x2ccf6e,null));};exports['voiceQueuesChannel']=function(_0x2409d3,_0x74b443){return respondWithRpcPromise(_0x91cb('0x23'),_[_0x91cb('0x19')](_0x2409d3[_0x91cb('0x1a')],_0x2409d3['params']))[_0x91cb('0x8')](respondWithResult(_0x74b443,null))['catch'](handleError(_0x74b443,null));};exports['voiceQueuesChannelHangup']=function(_0x479968,_0x2011fc){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x91cb('0x19')](_0x479968['query'],_0x479968['params']))[_0x91cb('0x8')](respondWithResult(_0x2011fc,null))[_0x91cb('0x17')](handleError(_0x2011fc,null));};exports[_0x91cb('0x24')]=function(_0x14319b,_0x2d8fb9){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x91cb('0x19')](_0x14319b[_0x91cb('0x1a')],_0x14319b[_0x91cb('0x1b')]))[_0x91cb('0x8')](respondWithResult(_0x2d8fb9,null))['catch'](handleError(_0x2d8fb9,null));};exports['outbound']=function(_0x1eed21,_0x135bf1){return respondWithRpcPromise('Outbound',_0x1eed21[_0x91cb('0x1a')])[_0x91cb('0x8')](respondWithResult(_0x135bf1,null))['catch'](handleError(_0x135bf1,null));};exports[_0x91cb('0x25')]=function(_0xddc409,_0x5f456c){return respondWithRpcPromise(_0x91cb('0x26'),_0xddc409['query'])[_0x91cb('0x8')](respondWithResult(_0x5f456c,null))[_0x91cb('0x17')](handleError(_0x5f456c,null));};exports[_0x91cb('0x27')]=function(_0x279ad5,_0x51d0ea){var _0x20bf50;return respondWithRpcPromise('Agents',_0x279ad5[_0x91cb('0x1a')])[_0x91cb('0x8')](function(_0x4e5b4b){_0x20bf50=_0x4e5b4b;return respondWithRpcPromise(_0x91cb('0x28'),_0x279ad5['query'],routingClient);})[_0x91cb('0x8')](function(_0x2eac87){return _[_0x91cb('0x19')]({},_0x2eac87,_0x20bf50);})[_0x91cb('0x8')](respondWithResult(_0x51d0ea,null))['catch'](handleError(_0x51d0ea,null));};exports[_0x91cb('0x29')]=function(_0x5af0e6,_0x2cf27e){if(_0x5af0e6[_0x91cb('0x2a')]&&_0x5af0e6[_0x91cb('0x2a')][_0x91cb('0x2b')]&&_0x5af0e6[_0x91cb('0x2c')]&&_0x5af0e6[_0x91cb('0x2c')][_0x91cb('0x10')]){for(var _0x3cc4c1 in _0x5af0e6['body'][_0x91cb('0x2b')]){if(_0x5af0e6['body'][_0x91cb('0x2b')]['hasOwnProperty'](_0x3cc4c1)){db[_0x91cb('0x2d')]['findAll']({'where':{'channel':_0x3cc4c1,'membername':_0x5af0e6[_0x91cb('0x2c')][_0x91cb('0x10')],'type':_0x91cb('0x2e'),'exitAt':null,'uniqueid':_0x5af0e6[_0x91cb('0x2a')]['interaction'][_0x3cc4c1]&&_0x5af0e6[_0x91cb('0x2a')][_0x91cb('0x2b')][_0x3cc4c1]['length']?{'$notIn':_0x5af0e6[_0x91cb('0x2a')][_0x91cb('0x2b')][_0x3cc4c1]}:{'$ne':null}}})[_0x91cb('0x8')](function(_0x32517d){var _0x267efb=moment()[_0x91cb('0x2f')](_0x91cb('0x30'));for(var _0x29d5a1=0x0,_0x396b81=_0x32517d['length'];_0x29d5a1<_0x396b81;_0x29d5a1+=0x1){_0x32517d[_0x29d5a1][_0x91cb('0x31')]({'exitAt':_0x267efb});}});for(var _0x3e20d1=0x0;_0x3e20d1<_0x5af0e6[_0x91cb('0x2a')][_0x91cb('0x2b')][_0x3cc4c1][_0x91cb('0x32')];_0x3e20d1+=0x1){db[_0x91cb('0x2d')][_0x91cb('0x33')]({'where':{'channel':_0x3cc4c1,'membername':_0x5af0e6[_0x91cb('0x2c')]['name'],'type':_0x91cb('0x2e'),'uniqueid':_0x5af0e6[_0x91cb('0x2a')][_0x91cb('0x2b')][_0x3cc4c1][_0x3e20d1],'exitAt':null},'defaults':{'channel':_0x3cc4c1,'membername':_0x5af0e6[_0x91cb('0x2c')]['name'],'interface':_[_0x91cb('0x12')](_0x5af0e6[_0x91cb('0x2c')]['interface'])?util[_0x91cb('0x2f')]('SIP/%s',_0x5af0e6[_0x91cb('0x2c')]['name']):_0x5af0e6['user']['interface'],'type':_0x91cb('0x2e'),'enterAt':moment()[_0x91cb('0x2f')](_0x91cb('0x30')),'role':_0x91cb('0x34'),'internal':_0x5af0e6[_0x91cb('0x2c')]['internal'],'uniqueid':_0x5af0e6['body'][_0x91cb('0x2b')][_0x3cc4c1][_0x3e20d1]}});}}}}return respondWithRpcPromise(_0x91cb('0x35'),{'id':_0x5af0e6[_0x91cb('0x1b')]['id'],'capacity':_0x5af0e6[_0x91cb('0x2a')]['capacity']},routingClient)['then'](respondWithResult(_0x2cf27e,null))['catch'](handleError(_0x2cf27e,null));};exports[_0x91cb('0x36')]=function(_0x490417,_0x3f22a1){return respondWithRpcPromise('Telephones',_0x490417[_0x91cb('0x1a')])[_0x91cb('0x8')](respondWithResult(_0x3f22a1,null))[_0x91cb('0x17')](handleError(_0x3f22a1,null));};exports[_0x91cb('0x37')]=function(_0x1884bc,_0x362532){return respondWithRpcPromise(_0x91cb('0x38'),_0x1884bc[_0x91cb('0x1a')])[_0x91cb('0x8')](respondWithResult(_0x362532,null))[_0x91cb('0x17')](handleError(_0x362532,null));};exports[_0x91cb('0x39')]=function(_0x5752ed,_0x1e445a){return respondWithRpcPromise(_0x91cb('0x3a'),_0x5752ed['query'])[_0x91cb('0x8')](respondWithResult(_0x1e445a,null))[_0x91cb('0x17')](handleError(_0x1e445a,null));};exports['chatQueues']=function(_0x2f5311,_0x166eeb){return respondWithRpcPromise(_0x91cb('0x3b'),_0x2f5311[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0x166eeb,null))[_0x91cb('0x17')](handleError(_0x166eeb,null));};exports[_0x91cb('0x3c')]=function(_0x274fff,_0x3320bd){return respondWithRpcPromise(_0x91cb('0x3b'),_0x274fff[_0x91cb('0x1a')],routingClient)['then'](findById(_0x274fff[_0x91cb('0x1b')]['id']))['then'](respondWithResult(_0x3320bd,null))[_0x91cb('0x17')](handleError(_0x3320bd,null));};exports['mailQueues']=function(_0x3dfff9,_0x1b2fec){return respondWithRpcPromise(_0x91cb('0x3d'),_0x3dfff9['query'],routingClient)[_0x91cb('0x8')](respondWithResult(_0x1b2fec,null))[_0x91cb('0x17')](handleError(_0x1b2fec,null));};exports['showMailQueues']=function(_0xef4754,_0x102025){return respondWithRpcPromise(_0x91cb('0x3d'),_0xef4754[_0x91cb('0x1a')],routingClient)['then'](findById(_0xef4754[_0x91cb('0x1b')]['id']))[_0x91cb('0x8')](respondWithResult(_0x102025,null))[_0x91cb('0x17')](handleError(_0x102025,null));};exports[_0x91cb('0x3e')]=function(_0x55a0e3,_0x11025a){return respondWithRpcPromise(_0x91cb('0x3f'),_0x55a0e3['query'],mailClient)['then'](respondWithResult(_0x11025a,null))[_0x91cb('0x17')](handleError(_0x11025a,null));};exports['openchannelQueues']=function(_0x1180ac,_0x1237fd){return respondWithRpcPromise('OpenchannelQueues',_0x1180ac['query'],routingClient)[_0x91cb('0x8')](respondWithResult(_0x1237fd,null))['catch'](handleError(_0x1237fd,null));};exports[_0x91cb('0x40')]=function(_0x961ebf,_0x33de58){return respondWithRpcPromise('OpenchannelQueues',_0x961ebf[_0x91cb('0x1a')],routingClient)['then'](findById(_0x961ebf[_0x91cb('0x1b')]['id']))[_0x91cb('0x8')](respondWithResult(_0x33de58,null))[_0x91cb('0x17')](handleError(_0x33de58,null));};exports[_0x91cb('0x41')]=function(_0x483172,_0xb37f8e){return respondWithRpcPromise(_0x91cb('0x42'),_0x483172[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0xb37f8e,null))[_0x91cb('0x17')](handleError(_0xb37f8e,null));};exports[_0x91cb('0x43')]=function(_0x14114d,_0x2785f9){return respondWithRpcPromise(_0x91cb('0x42'),_0x14114d[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](findById(_0x14114d[_0x91cb('0x1b')]['id']))['then'](respondWithResult(_0x2785f9,null))[_0x91cb('0x17')](handleError(_0x2785f9,null));};exports[_0x91cb('0x44')]=function(_0x474682,_0x51ab8a){return respondWithRpcPromise(_0x91cb('0x45'),_0x474682[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0x51ab8a,null))['catch'](handleError(_0x51ab8a,null));};exports[_0x91cb('0x46')]=function(_0x5a3c7d,_0x4484d6){return respondWithRpcPromise(_0x91cb('0x45'),_0x5a3c7d[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](findById(_0x5a3c7d['params']['id']))[_0x91cb('0x8')](respondWithResult(_0x4484d6,null))[_0x91cb('0x17')](handleError(_0x4484d6,null));};exports[_0x91cb('0x47')]=function(_0x404b50,_0x1bb16f){return respondWithRpcPromise(_0x91cb('0x48'),_0x404b50['query'],routingClient)[_0x91cb('0x8')](respondWithResult(_0x1bb16f,null))[_0x91cb('0x17')](handleError(_0x1bb16f,null));};exports[_0x91cb('0x49')]=function(_0x1f0ba2,_0x891569){return respondWithRpcPromise(_0x91cb('0x48'),_0x1f0ba2[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](findById(_0x1f0ba2[_0x91cb('0x1b')]['id']))[_0x91cb('0x8')](respondWithResult(_0x891569,null))[_0x91cb('0x17')](handleError(_0x891569,null));};exports[_0x91cb('0x4a')]=function(_0xda123b,_0x3eead5){return respondWithRpcPromise(_0x91cb('0x4b'),_0xda123b[_0x91cb('0x1a')])[_0x91cb('0x8')](respondWithResult(_0x3eead5,null))['catch'](handleError(_0x3eead5,null));};exports[_0x91cb('0x4c')]=function(_0x1455cd,_0x4b639d){return respondWithRpcPromise(_0x91cb('0x4d'),_0x1455cd[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0x4b639d,null))['catch'](handleError(_0x4b639d,null));};exports[_0x91cb('0x4e')]=function(_0x6ecba8,_0x5cd31c){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x6ecba8[_0x91cb('0x1a')],routingClient)['then'](respondWithResult(_0x5cd31c,null))[_0x91cb('0x17')](handleError(_0x5cd31c,null));};exports[_0x91cb('0x4f')]=function(_0x4e11e3,_0x43a8b1){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4e11e3[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0x43a8b1,null))['catch'](handleError(_0x43a8b1,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x16a21f,_0x43be3e){return respondWithRpcPromise(_0x91cb('0x50'),_0x16a21f['query'],routingClient)[_0x91cb('0x8')](function(_0x23a458){if(_0x16a21f[_0x91cb('0x1a')][_0x91cb('0x51')]!==undefined){var _0x570f6b=_(_0x23a458[_0x91cb('0x13')])['filter']([_0x16a21f[_0x91cb('0x1a')][_0x91cb('0x51')],_0x16a21f[_0x91cb('0x1b')]['id']])[_0x91cb('0x52')]('queue_id')['uniq']()[_0x91cb('0x53')]();return _0x23a458['rows'][_0x91cb('0x54')](function(_0x3dc6f9){return _0x570f6b[_0x91cb('0x55')](_0x3dc6f9[_0x91cb('0x56')])>-0x1;});}else{return _0x23a458[_0x91cb('0x13')][_0x91cb('0x54')](function(_0x12d3d1){return _0x12d3d1['queue_id']===parseInt(_0x16a21f[_0x91cb('0x1b')]['id']);});}})[_0x91cb('0x8')](respondWithResult(_0x43be3e,null))['catch'](handleError(_0x43be3e,null));};exports[_0x91cb('0x57')]=function(_0x4d5862,_0x35525c){return respondWithRpcPromise(_0x91cb('0x58'),_0x4d5862[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0x35525c,null))[_0x91cb('0x17')](handleError(_0x35525c,null));};exports[_0x91cb('0x59')]=function(_0x1459c4,_0x30259d){return respondWithRpcPromise(_0x91cb('0x5a'),_0x1459c4[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0x30259d,null))[_0x91cb('0x17')](handleError(_0x30259d,null));};exports[_0x91cb('0x5b')]=function(_0x14882d,_0x22ba54){return respondWithRpcPromise(_0x91cb('0x5c'),_0x14882d['query'],routingClient)[_0x91cb('0x8')](respondWithResult(_0x22ba54,null))['catch'](handleError(_0x22ba54,null));};exports[_0x91cb('0x5d')]=function(_0x123d72){return function(_0x13f358,_0x422928){var _0x319289,_0x1fa3c7;var _0x324bdb=_[_0x91cb('0x5e')](_0x123d72);var _0x569df1=_0x123d72===_0x91cb('0x5f')?_0x91cb('0x60'):'Account';return db[_0x324bdb+'Queue'][_0x91cb('0x61')]({'raw':!![],'where':{'id':_0x13f358['params']['id']}})['then'](function(_0x95f2de){if(_['isNil'](_0x95f2de)){throw new Error(_0x324bdb+_0x91cb('0x62'));}_0x319289=_0x95f2de;return db[_0x324bdb+'Message'][_0x91cb('0x61')]({'where':{'id':_0x13f358[_0x91cb('0x2a')][_0x91cb('0x63')]},'include':[{'model':db[_0x324bdb+_0x91cb('0x64')],'as':'Interaction'},{'model':db[_0x324bdb+_0x569df1],'as':_0x91cb('0x65')}]});})[_0x91cb('0x8')](function(_0x42d07b){if(_[_0x91cb('0x12')](_0x42d07b)){throw new Error(_0x324bdb+_0x91cb('0x66'));}_0x1fa3c7=_0x42d07b;return _0x42d07b[_0x91cb('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0x91cb('0x8')](function(){var _0x3cf8c5={'uniqueid':_0x123d72+'.'+_0x1fa3c7['id']+'.'+_0x1fa3c7[_0x91cb('0x64')]['id'],'FromUserId':_0x13f358[_0x91cb('0x2c')]['id'],'type':_0x91cb('0x68')};_0x3cf8c5[_0x324bdb+_0x91cb('0x69')]=_0x1fa3c7['id'];_0x3cf8c5[_0x324bdb+_0x91cb('0x6a')]=_0x1fa3c7[_0x91cb('0x64')]['id'];_0x3cf8c5[_0x91cb('0x6b')+_0x324bdb+_0x569df1+'Id']=_0x1fa3c7[_0x91cb('0x65')]['id'];_0x3cf8c5['To'+_0x324bdb+_0x91cb('0x6c')]=_0x319289['id'];return db[_0x324bdb+_0x91cb('0x6d')][_0x91cb('0x6e')](_0x3cf8c5);})[_0x91cb('0x8')](function(){return respondWithRpcPromise(_0x91cb('0x6f'),{'channel':_0x123d72,'interaction':_0x1fa3c7[_0x91cb('0x64')],'message':_0x1fa3c7,'account':_0x1fa3c7[_0x91cb('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x91cb('0x68'),'appdata':_0x319289[_0x91cb('0x10')]+','+(_0x1fa3c7['Account'][_0x91cb('0x70')]||0x12c),'interval':_0x91cb('0x71')}]},routingClient);})[_0x91cb('0x8')](respondWithResult(_0x422928,null))[_0x91cb('0x17')](handleError(_0x422928,null));};};exports[_0x91cb('0x72')]=function(_0x650ac9,_0x404457){var _0xa9de8b,_0x3bf154;if(_[_0x91cb('0x12')](_0x650ac9[_0x91cb('0x2a')]['channel'])){throw new Error(_0x91cb('0x73'));}var _0x4c459a=_0x650ac9['body'][_0x91cb('0x74')];var _0x265ffb=_[_0x91cb('0x5e')](_0x4c459a);var _0x446738=_0x4c459a===_0x91cb('0x5f')?_0x91cb('0x60'):_0x91cb('0x65');return db[_0x91cb('0x75')][_0x91cb('0x61')]({'raw':!![],'where':{'id':_0x650ac9[_0x91cb('0x1b')]['id'],'role':'agent'}})[_0x91cb('0x8')](function(_0xb784d5){if(_['isNil'](_0xb784d5)){throw new Error(_0x91cb('0x76'));}_0xa9de8b=_0xb784d5;return db[_0x265ffb+_0x91cb('0x77')]['findOne']({'where':{'id':_0x650ac9[_0x91cb('0x2a')][_0x91cb('0x63')]},'include':[{'model':db[_0x265ffb+_0x91cb('0x64')],'as':_0x91cb('0x64')},{'model':db[_0x265ffb+_0x446738],'as':_0x91cb('0x65')}]});})[_0x91cb('0x8')](function(_0x65c551){if(_[_0x91cb('0x12')](_0x65c551)){throw new Error(_0x265ffb+_0x91cb('0x66'));}_0x3bf154=_0x65c551;return _0x65c551[_0x91cb('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0x91cb('0x8')](function(){var _0x378cd0={'uniqueid':_0x4c459a+'.'+_0x3bf154['id']+'.'+_0x3bf154['Interaction']['id'],'FromUserId':_0x650ac9['user']['id'],'type':_0x91cb('0x68'),'ToUserId':_0xa9de8b['id']};_0x378cd0[_0x265ffb+_0x91cb('0x69')]=_0x3bf154['id'];_0x378cd0[_0x265ffb+_0x91cb('0x6a')]=_0x3bf154[_0x91cb('0x64')]['id'];_0x378cd0[_0x91cb('0x6b')+_0x265ffb+_0x446738+'Id']=_0x3bf154[_0x91cb('0x65')]['id'];return db[_0x265ffb+_0x91cb('0x6d')]['create'](_0x378cd0);})[_0x91cb('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x4c459a,'interaction':_0x3bf154[_0x91cb('0x64')],'message':_0x3bf154,'account':_0x3bf154[_0x91cb('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x91cb('0x34'),'appdata':_0xa9de8b[_0x91cb('0x10')]+','+(_0x3bf154[_0x91cb('0x65')]['agentTransferTimeout']||0x12c),'interval':_0x91cb('0x71')}]},routingClient);})[_0x91cb('0x8')](respondWithResult(_0x404457,null))[_0x91cb('0x17')](handleError(_0x404457,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 2aad9c4..a1ca404 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 _0x8816=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./schedule.controller','isAuthenticated','get','/:id','/:id/run','run','post','put','update','destroy','exports','multer','util','path'];(function(_0x34b27c,_0x21a430){var _0x1fc94a=function(_0x6a5da6){while(--_0x6a5da6){_0x34b27c['push'](_0x34b27c['shift']());}};_0x1fc94a(++_0x21a430);}(_0x8816,0x11a));var _0x6881=function(_0x59a017,_0x473279){_0x59a017=_0x59a017-0x0;var _0x324ed4=_0x8816[_0x59a017];return _0x324ed4;};'use strict';var multer=require(_0x6881('0x0'));var util=require(_0x6881('0x1'));var path=require(_0x6881('0x2'));var timeout=require(_0x6881('0x3'));var express=require(_0x6881('0x4'));var router=express[_0x6881('0x5')]();var fs_extra=require(_0x6881('0x6'));var auth=require(_0x6881('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6881('0x8'));router['get']('/',auth[_0x6881('0x9')](),controller['index']);router[_0x6881('0xa')](_0x6881('0xb'),auth[_0x6881('0x9')](),controller['show']);router[_0x6881('0xa')](_0x6881('0xc'),auth[_0x6881('0x9')](),controller[_0x6881('0xd')]);router[_0x6881('0xe')]('/',auth[_0x6881('0x9')](),controller['create']);router[_0x6881('0xf')](_0x6881('0xb'),auth[_0x6881('0x9')](),controller[_0x6881('0x10')]);router['delete'](_0x6881('0xb'),auth['isAuthenticated'](),controller[_0x6881('0x11')]);module[_0x6881('0x12')]=router; \ No newline at end of file +var _0x5ede=['isAuthenticated','/:id/run','create','put','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','./schedule.controller','get','index','/:id'];(function(_0x53ba51,_0x2f2321){var _0x2e776e=function(_0x16b5cf){while(--_0x16b5cf){_0x53ba51['push'](_0x53ba51['shift']());}};_0x2e776e(++_0x2f2321);}(_0x5ede,0x1e6));var _0xe5ed=function(_0x3c99ef,_0x50b107){_0x3c99ef=_0x3c99ef-0x0;var _0x17550c=_0x5ede[_0x3c99ef];return _0x17550c;};'use strict';var multer=require(_0xe5ed('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe5ed('0x1'));var express=require('express');var router=express[_0xe5ed('0x2')]();var fs_extra=require(_0xe5ed('0x3'));var auth=require(_0xe5ed('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe5ed('0x5'));router[_0xe5ed('0x6')]('/',auth['isAuthenticated'](),controller[_0xe5ed('0x7')]);router['get'](_0xe5ed('0x8'),auth[_0xe5ed('0x9')](),controller['show']);router[_0xe5ed('0x6')](_0xe5ed('0xa'),auth['isAuthenticated'](),controller['run']);router['post']('/',auth[_0xe5ed('0x9')](),controller[_0xe5ed('0xb')]);router[_0xe5ed('0xc')](_0xe5ed('0x8'),auth[_0xe5ed('0x9')](),controller['update']);router['delete'](_0xe5ed('0x8'),auth['isAuthenticated'](),controller[_0xe5ed('0xd')]);module[_0xe5ed('0xe')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index fddcef4..a1d2cd5 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 _0xe9df=['days','hours','xlsx','csv','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks'];(function(_0x202f5c,_0x5da5d7){var _0x45ad06=function(_0x29059b){while(--_0x29059b){_0x202f5c['push'](_0x202f5c['shift']());}};_0x45ad06(++_0x5da5d7);}(_0xe9df,0x72));var _0xfe9d=function(_0x1b2bc4,_0x3d0435){_0x1b2bc4=_0x1b2bc4-0x0;var _0x5c527d=_0xe9df[_0x1b2bc4];return _0x5c527d;};'use strict';var Sequelize=require(_0xfe9d('0x0'));module[_0xfe9d('0x1')]={'name':{'type':Sequelize[_0xfe9d('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xfe9d('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xfe9d('0x2')],'allowNull':![],'defaultValue':_0xfe9d('0x4')},'startAt':{'type':Sequelize[_0xfe9d('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xfe9d('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xfe9d('0x7')](_0xfe9d('0x8'),_0xfe9d('0x9'),_0xfe9d('0xa'),_0xfe9d('0xb'),_0xfe9d('0xc'),_0xfe9d('0xd'),'minutes'),'allowNull':![],'defaultValue':_0xfe9d('0xc')},'output':{'type':Sequelize[_0xfe9d('0x7')]('csv','pdf',_0xfe9d('0xe')),'allowNull':![],'defaultValue':_0xfe9d('0xf')},'type':{'type':Sequelize[_0xfe9d('0x7')](_0xfe9d('0x10'),'default'),'allowNull':![],'defaultValue':_0xfe9d('0x10')},'sendMail':{'type':Sequelize[_0xfe9d('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xfe9d('0x2')]},'cc':{'type':Sequelize[_0xfe9d('0x11')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0xfe9d('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x3fec=['TEXT','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','quarters','months','weeks','minutes','days','ENUM','csv','pdf','xlsx','custom','default'];(function(_0x5f159f,_0x445248){var _0x2609d3=function(_0x218344){while(--_0x218344){_0x5f159f['push'](_0x5f159f['shift']());}};_0x2609d3(++_0x445248);}(_0x3fec,0x171));var _0xc3fe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3fec[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc3fe('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xc3fe('0x0')]},'active':{'type':Sequelize[_0xc3fe('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xc3fe('0x0')],'allowNull':![],'defaultValue':_0xc3fe('0x2')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xc3fe('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years',_0xc3fe('0x4'),_0xc3fe('0x5'),_0xc3fe('0x6'),'days','hours',_0xc3fe('0x7')),'allowNull':![],'defaultValue':_0xc3fe('0x8')},'output':{'type':Sequelize[_0xc3fe('0x9')](_0xc3fe('0xa'),_0xc3fe('0xb'),_0xc3fe('0xc')),'allowNull':![],'defaultValue':_0xc3fe('0xa')},'type':{'type':Sequelize[_0xc3fe('0x9')](_0xc3fe('0xd'),_0xc3fe('0xe')),'allowNull':![],'defaultValue':_0xc3fe('0xd')},'sendMail':{'type':Sequelize[_0xc3fe('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0xc3fe('0x0')]},'cc':{'type':Sequelize[_0xc3fe('0xf')]},'bcc':{'type':Sequelize[_0xc3fe('0xf')]},'sendIfEmpty':{'type':Sequelize[_0xc3fe('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 23743f9..9148254 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 _0xb81e=['crypto','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','limit','count','set','Content-Range','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','send','map','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','Schedule','includeAll','include','findAll','catch','show','params','options','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x34cac5,_0x5a89ef){var _0x4a6172=function(_0x31b52c){while(--_0x31b52c){_0x34cac5['push'](_0x34cac5['shift']());}};_0x4a6172(++_0x5a89ef);}(_0xb81e,0xa0));var _0xeb81=function(_0x2ba7ed,_0x98b3ce){_0x2ba7ed=_0x2ba7ed-0x0;var _0x56c2b3=_0xb81e[_0x2ba7ed];return _0x56c2b3;};'use strict';var emlformat=require(_0xeb81('0x0'));var rimraf=require(_0xeb81('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb81('0x2'));var rp=require(_0xeb81('0x3'));var moment=require(_0xeb81('0x4'));var BPromise=require(_0xeb81('0x5'));var Mustache=require(_0xeb81('0x6'));var util=require('util');var path=require(_0xeb81('0x7'));var sox=require(_0xeb81('0x8'));var csv=require(_0xeb81('0x9'));var ejs=require(_0xeb81('0xa'));var fs=require('fs');var fs_extra=require(_0xeb81('0xb'));var _=require(_0xeb81('0xc'));var squel=require(_0xeb81('0xd'));var crypto=require(_0xeb81('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xeb81('0xf'));var toCsv=require('to-csv');var querystring=require(_0xeb81('0x10'));var Papa=require(_0xeb81('0x11'));var Redis=require(_0xeb81('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xeb81('0x13'));var as=require(_0xeb81('0x14'));var hardwareService=require(_0xeb81('0x15'));var logger=require('../../config/logger')(_0xeb81('0x16'));var utils=require(_0xeb81('0x17'));var config=require(_0xeb81('0x18'));var licenseUtil=require(_0xeb81('0x19'));var db=require(_0xeb81('0x1a'))['db'];function respondWithStatusCode(_0x2fd904,_0x332e32){_0x332e32=_0x332e32||0xcc;return function(_0x52c54f){if(_0x52c54f){return _0x2fd904[_0xeb81('0x1b')](_0x332e32);}return _0x2fd904[_0xeb81('0x1c')](_0x332e32)[_0xeb81('0x1d')]();};}function respondWithResult(_0x23ee0b,_0x124006){_0x124006=_0x124006||0xc8;return function(_0x46a1ba){if(_0x46a1ba){return _0x23ee0b['status'](_0x124006)[_0xeb81('0x1e')](_0x46a1ba);}};}function respondWithFilteredResult(_0x4950ed,_0x5ed189){return function(_0x300c90){if(_0x300c90){var _0x11e76d=typeof _0x5ed189[_0xeb81('0x1f')]===_0xeb81('0x20')&&typeof _0x5ed189[_0xeb81('0x21')]===_0xeb81('0x20');var _0x2b0a11=_0x300c90[_0xeb81('0x22')];var _0x545eae=_0x11e76d?0x0:_0x5ed189['offset'];var _0x3999ab=_0x11e76d?_0x300c90[_0xeb81('0x22')]:_0x5ed189[_0xeb81('0x1f')]+_0x5ed189[_0xeb81('0x21')];var _0x48a6fe;if(_0x3999ab>=_0x2b0a11){_0x3999ab=_0x2b0a11;_0x48a6fe=0xc8;}else{_0x48a6fe=0xce;}_0x4950ed[_0xeb81('0x1c')](_0x48a6fe);return _0x4950ed[_0xeb81('0x23')](_0xeb81('0x24'),_0x545eae+'-'+_0x3999ab+'/'+_0x2b0a11)['json'](_0x300c90);}return null;};}function patchUpdates(_0xf2399e){return function(_0xf7f661){try{jsonpatch['apply'](_0xf7f661,_0xf2399e,!![]);}catch(_0x224bad){return BPromise[_0xeb81('0x25')](_0x224bad);}return _0xf7f661[_0xeb81('0x26')]();};}function saveUpdates(_0x702d88,_0x50a611){return function(_0x127fbd){if(_0x127fbd){return _0x127fbd[_0xeb81('0x27')](_0x702d88)[_0xeb81('0x28')](function(_0x3a2da8){return _0x3a2da8;});}return null;};}function removeEntity(_0xa490b3,_0x565626){return function(_0xbe7007){if(_0xbe7007){return _0xbe7007[_0xeb81('0x29')]()[_0xeb81('0x28')](function(){var _0x31dc58=_0xbe7007[_0xeb81('0x2a')]({'plain':!![]});var _0x1ef096=_0xeb81('0x2b');return db[_0xeb81('0x2c')]['destroy']({'where':{'type':_0x1ef096,'resourceId':_0x31dc58['id']}})['then'](function(){return _0xbe7007;});})[_0xeb81('0x28')](function(){_0xa490b3[_0xeb81('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x376f73,_0x4251dd){return function(_0x431be9){if(!_0x431be9){_0x376f73[_0xeb81('0x1b')](0x194);}return _0x431be9;};}function handleError(_0x451c8b,_0x52186f){_0x52186f=_0x52186f||0x1f4;return function(_0x3de977){logger[_0xeb81('0x2d')](_0x3de977[_0xeb81('0x2e')]);if(_0x3de977[_0xeb81('0x2f')]){delete _0x3de977[_0xeb81('0x2f')];}_0x451c8b[_0xeb81('0x1c')](_0x52186f)[_0xeb81('0x30')](_0x3de977);};}exports['index']=function(_0x5cb552,_0x5de06e){var _0x4248a8={},_0x5b4704={},_0x35bfe5={'count':0x0,'rows':[]};var _0xd425bc=_[_0xeb81('0x31')](db['Schedule'][_0xeb81('0x32')],function(_0x30241b){return{'name':_0x30241b['fieldName'],'type':_0x30241b[_0xeb81('0x33')][_0xeb81('0x34')]};});_0x5b4704['model']=_[_0xeb81('0x31')](_0xd425bc,'name');_0x5b4704['query']=_[_0xeb81('0x35')](_0x5cb552[_0xeb81('0x36')]);_0x5b4704[_0xeb81('0x37')]=_[_0xeb81('0x38')](_0x5b4704[_0xeb81('0x39')],_0x5b4704[_0xeb81('0x36')]);_0x4248a8[_0xeb81('0x3a')]=_[_0xeb81('0x38')](_0x5b4704[_0xeb81('0x39')],qs[_0xeb81('0x3b')](_0x5cb552[_0xeb81('0x36')][_0xeb81('0x3b')]));_0x4248a8['attributes']=_0x4248a8[_0xeb81('0x3a')][_0xeb81('0x3c')]?_0x4248a8[_0xeb81('0x3a')]:_0x5b4704['model'];if(!_0x5cb552[_0xeb81('0x36')]['hasOwnProperty'](_0xeb81('0x3d'))){_0x4248a8['limit']=qs[_0xeb81('0x21')](_0x5cb552[_0xeb81('0x36')][_0xeb81('0x21')]);_0x4248a8['offset']=qs['offset'](_0x5cb552['query'][_0xeb81('0x1f')]);}_0x4248a8[_0xeb81('0x3e')]=qs['sort'](_0x5cb552[_0xeb81('0x36')][_0xeb81('0x3f')]);_0x4248a8[_0xeb81('0x40')]=qs[_0xeb81('0x37')](_[_0xeb81('0x41')](_0x5cb552[_0xeb81('0x36')],_0x5b4704[_0xeb81('0x37')]),_0xd425bc);if(_0x5cb552[_0xeb81('0x36')][_0xeb81('0x42')]){_0x4248a8[_0xeb81('0x40')]=_[_0xeb81('0x43')](_0x4248a8[_0xeb81('0x40')],{'$or':_[_0xeb81('0x31')](_0xd425bc,function(_0x5f5af9){if(_0x5f5af9[_0xeb81('0x33')]!==_0xeb81('0x44')){var _0x2d66bd={};_0x2d66bd[_0x5f5af9[_0xeb81('0x2f')]]={'$like':'%'+_0x5cb552[_0xeb81('0x36')][_0xeb81('0x42')]+'%'};return _0x2d66bd;}})});}_0x4248a8=_[_0xeb81('0x43')]({},_0x4248a8,_0x5cb552['options']);var _0x1ad910={'where':_0x4248a8[_0xeb81('0x40')]};return db[_0xeb81('0x45')][_0xeb81('0x22')](_0x1ad910)[_0xeb81('0x28')](function(_0x2db85b){_0x35bfe5[_0xeb81('0x22')]=_0x2db85b;if(_0x5cb552['query'][_0xeb81('0x46')]){_0x4248a8[_0xeb81('0x47')]=[{'all':!![]}];}return db[_0xeb81('0x45')][_0xeb81('0x48')](_0x4248a8);})['then'](function(_0x431cd7){_0x35bfe5['rows']=_0x431cd7;return _0x35bfe5;})['then'](respondWithFilteredResult(_0x5de06e,_0x4248a8))[_0xeb81('0x49')](handleError(_0x5de06e,null));};exports[_0xeb81('0x4a')]=function(_0x43ae26,_0xf751ff){var _0x519381={'raw':![],'where':{'id':_0x43ae26[_0xeb81('0x4b')]['id']}},_0x43d7a0={};_0x43d7a0['model']=_['keys'](db[_0xeb81('0x45')][_0xeb81('0x32')]);_0x43d7a0[_0xeb81('0x36')]=_[_0xeb81('0x35')](_0x43ae26['query']);_0x43d7a0['filters']=_['intersection'](_0x43d7a0[_0xeb81('0x39')],_0x43d7a0[_0xeb81('0x36')]);_0x519381[_0xeb81('0x3a')]=_[_0xeb81('0x38')](_0x43d7a0[_0xeb81('0x39')],qs[_0xeb81('0x3b')](_0x43ae26['query'][_0xeb81('0x3b')]));_0x519381[_0xeb81('0x3a')]=_0x519381['attributes'][_0xeb81('0x3c')]?_0x519381[_0xeb81('0x3a')]:_0x43d7a0[_0xeb81('0x39')];if(_0x43ae26[_0xeb81('0x36')][_0xeb81('0x46')]){_0x519381[_0xeb81('0x47')]=[{'all':!![]}];}_0x519381=_[_0xeb81('0x43')]({},_0x519381,_0x43ae26[_0xeb81('0x4c')]);return db['Schedule'][_0xeb81('0x4d')](_0x519381)['then'](handleEntityNotFound(_0xf751ff,null))[_0xeb81('0x28')](respondWithResult(_0xf751ff,null))[_0xeb81('0x49')](handleError(_0xf751ff,null));};exports[_0xeb81('0x4e')]=function(_0xc539a8,_0x532c5b){return db[_0xeb81('0x45')][_0xeb81('0x4e')](_0xc539a8[_0xeb81('0x4f')],{})[_0xeb81('0x28')](function(_0x275453){var _0x2219ac=_0xc539a8[_0xeb81('0x50')][_0xeb81('0x2a')]({'plain':!![]});if(!_0x2219ac)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2219ac[_0xeb81('0x51')]==='user'){var _0x3855f9=_0x275453[_0xeb81('0x2a')]({'plain':!![]});var _0x3099f2='Scheduler';return db[_0xeb81('0x52')][_0xeb81('0x4d')]({'where':{'name':_0x3099f2,'userProfileId':_0x2219ac['userProfileId']},'raw':!![]})[_0xeb81('0x28')](function(_0x6e7a65){if(_0x6e7a65&&_0x6e7a65[_0xeb81('0x53')]===0x0){return db[_0xeb81('0x2c')][_0xeb81('0x4e')]({'name':_0x3855f9[_0xeb81('0x2f')],'resourceId':_0x3855f9['id'],'type':_0x6e7a65[_0xeb81('0x2f')],'sectionId':_0x6e7a65['id']},{})[_0xeb81('0x28')](function(){return _0x275453;});}else{return _0x275453;}})[_0xeb81('0x49')](function(_0x4dd2fe){logger[_0xeb81('0x2d')](_0xeb81('0x54'),_0x4dd2fe);throw _0x4dd2fe;});}return _0x275453;})['then'](respondWithResult(_0x532c5b,0xc9))[_0xeb81('0x49')](handleError(_0x532c5b,null));};exports[_0xeb81('0x27')]=function(_0xff6c5,_0x1ccac8){if(_0xff6c5['body']['id']){delete _0xff6c5[_0xeb81('0x4f')]['id'];}return db[_0xeb81('0x45')][_0xeb81('0x4d')]({'where':{'id':_0xff6c5['params']['id']}})['then'](handleEntityNotFound(_0x1ccac8,null))[_0xeb81('0x28')](saveUpdates(_0xff6c5[_0xeb81('0x4f')],null))[_0xeb81('0x28')](respondWithResult(_0x1ccac8,null))[_0xeb81('0x49')](handleError(_0x1ccac8,null));};exports[_0xeb81('0x29')]=function(_0x53ee6b,_0x35f631){return db[_0xeb81('0x45')][_0xeb81('0x4d')]({'where':{'id':_0x53ee6b['params']['id']}})[_0xeb81('0x28')](handleEntityNotFound(_0x35f631,null))['then'](removeEntity(_0x35f631,null))[_0xeb81('0x49')](handleError(_0x35f631,null));};exports[_0xeb81('0x55')]=function(_0x4b07e2,_0x6578,_0x322091){var _0x2e8652=require(_0xeb81('0x56'));return db[_0xeb81('0x45')][_0xeb81('0x4d')]({'where':{'id':_0x4b07e2[_0xeb81('0x4b')]['id']},'raw':!![]})[_0xeb81('0x28')](handleEntityNotFound(_0x6578,null))['then'](function(){_0x2e8652[_0xeb81('0x55')](_0x4b07e2[_0xeb81('0x4b')]['id']);})[_0xeb81('0x28')](respondWithStatusCode(_0x6578,null))[_0xeb81('0x49')](handleError(_0x6578,null));}; \ No newline at end of file +var _0xe2b8=['findAll','rows','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','get','UserProfileResource','sendStatus','error','stack','name','send','map','Schedule','type','query','keys','intersection','attributes','model','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe2b8,0x106));var _0x8e2b=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xe2b8[_0x3b0731];return _0x4204d7;};'use strict';var emlformat=require(_0x8e2b('0x0'));var rimraf=require(_0x8e2b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8e2b('0x2'));var rp=require(_0x8e2b('0x3'));var moment=require(_0x8e2b('0x4'));var BPromise=require(_0x8e2b('0x5'));var Mustache=require(_0x8e2b('0x6'));var util=require('util');var path=require(_0x8e2b('0x7'));var sox=require(_0x8e2b('0x8'));var csv=require(_0x8e2b('0x9'));var ejs=require(_0x8e2b('0xa'));var fs=require('fs');var fs_extra=require(_0x8e2b('0xb'));var _=require(_0x8e2b('0xc'));var squel=require(_0x8e2b('0xd'));var crypto=require(_0x8e2b('0xe'));var jsforce=require(_0x8e2b('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8e2b('0x10'));var Papa=require(_0x8e2b('0x11'));var Redis=require(_0x8e2b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8e2b('0x13'));var as=require(_0x8e2b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8e2b('0x15'));var utils=require(_0x8e2b('0x16'));var config=require(_0x8e2b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8e2b('0x18'))['db'];function respondWithStatusCode(_0xf7bbaf,_0x14e406){_0x14e406=_0x14e406||0xcc;return function(_0x3ca6bd){if(_0x3ca6bd){return _0xf7bbaf['sendStatus'](_0x14e406);}return _0xf7bbaf[_0x8e2b('0x19')](_0x14e406)[_0x8e2b('0x1a')]();};}function respondWithResult(_0x3ec067,_0x4d5acd){_0x4d5acd=_0x4d5acd||0xc8;return function(_0x1beffc){if(_0x1beffc){return _0x3ec067[_0x8e2b('0x19')](_0x4d5acd)[_0x8e2b('0x1b')](_0x1beffc);}};}function respondWithFilteredResult(_0x569480,_0xae0757){return function(_0x279c17){if(_0x279c17){var _0x3b5a5e=typeof _0xae0757[_0x8e2b('0x1c')]===_0x8e2b('0x1d')&&typeof _0xae0757[_0x8e2b('0x1e')]==='undefined';var _0x34e66a=_0x279c17[_0x8e2b('0x1f')];var _0xa5c437=_0x3b5a5e?0x0:_0xae0757[_0x8e2b('0x1c')];var _0x152767=_0x3b5a5e?_0x279c17[_0x8e2b('0x1f')]:_0xae0757[_0x8e2b('0x1c')]+_0xae0757[_0x8e2b('0x1e')];var _0x2e7cef;if(_0x152767>=_0x34e66a){_0x152767=_0x34e66a;_0x2e7cef=0xc8;}else{_0x2e7cef=0xce;}_0x569480[_0x8e2b('0x19')](_0x2e7cef);return _0x569480[_0x8e2b('0x20')](_0x8e2b('0x21'),_0xa5c437+'-'+_0x152767+'/'+_0x34e66a)['json'](_0x279c17);}return null;};}function patchUpdates(_0x577912){return function(_0x30f493){try{jsonpatch[_0x8e2b('0x22')](_0x30f493,_0x577912,!![]);}catch(_0x23a745){return BPromise['reject'](_0x23a745);}return _0x30f493[_0x8e2b('0x23')]();};}function saveUpdates(_0x6c7f2,_0x550b7d){return function(_0x5efddb){if(_0x5efddb){return _0x5efddb[_0x8e2b('0x24')](_0x6c7f2)['then'](function(_0x55db43){return _0x55db43;});}return null;};}function removeEntity(_0x5cad34,_0x5e2394){return function(_0x33ad47){if(_0x33ad47){return _0x33ad47[_0x8e2b('0x25')]()[_0x8e2b('0x26')](function(){var _0x471112=_0x33ad47[_0x8e2b('0x27')]({'plain':!![]});var _0x581f65='Scheduler';return db[_0x8e2b('0x28')][_0x8e2b('0x25')]({'where':{'type':_0x581f65,'resourceId':_0x471112['id']}})['then'](function(){return _0x33ad47;});})[_0x8e2b('0x26')](function(){_0x5cad34[_0x8e2b('0x19')](0xcc)[_0x8e2b('0x1a')]();});}};}function handleEntityNotFound(_0x168c08,_0xf04287){return function(_0x50b87c){if(!_0x50b87c){_0x168c08[_0x8e2b('0x29')](0x194);}return _0x50b87c;};}function handleError(_0xef3ae8,_0x1ae2fa){_0x1ae2fa=_0x1ae2fa||0x1f4;return function(_0x166b06){logger[_0x8e2b('0x2a')](_0x166b06[_0x8e2b('0x2b')]);if(_0x166b06[_0x8e2b('0x2c')]){delete _0x166b06[_0x8e2b('0x2c')];}_0xef3ae8[_0x8e2b('0x19')](_0x1ae2fa)[_0x8e2b('0x2d')](_0x166b06);};}exports['index']=function(_0x3f527c,_0x514ab5){var _0x289bc7={},_0x18bec2={},_0x1d610d={'count':0x0,'rows':[]};var _0x18b164=_[_0x8e2b('0x2e')](db[_0x8e2b('0x2f')]['rawAttributes'],function(_0x3099bd){return{'name':_0x3099bd['fieldName'],'type':_0x3099bd[_0x8e2b('0x30')]['key']};});_0x18bec2['model']=_['map'](_0x18b164,_0x8e2b('0x2c'));_0x18bec2[_0x8e2b('0x31')]=_[_0x8e2b('0x32')](_0x3f527c[_0x8e2b('0x31')]);_0x18bec2['filters']=_[_0x8e2b('0x33')](_0x18bec2['model'],_0x18bec2[_0x8e2b('0x31')]);_0x289bc7[_0x8e2b('0x34')]=_[_0x8e2b('0x33')](_0x18bec2[_0x8e2b('0x35')],qs[_0x8e2b('0x36')](_0x3f527c['query'][_0x8e2b('0x36')]));_0x289bc7['attributes']=_0x289bc7[_0x8e2b('0x34')][_0x8e2b('0x37')]?_0x289bc7[_0x8e2b('0x34')]:_0x18bec2[_0x8e2b('0x35')];if(!_0x3f527c['query']['hasOwnProperty'](_0x8e2b('0x38'))){_0x289bc7[_0x8e2b('0x1e')]=qs[_0x8e2b('0x1e')](_0x3f527c[_0x8e2b('0x31')][_0x8e2b('0x1e')]);_0x289bc7[_0x8e2b('0x1c')]=qs['offset'](_0x3f527c['query'][_0x8e2b('0x1c')]);}_0x289bc7[_0x8e2b('0x39')]=qs[_0x8e2b('0x3a')](_0x3f527c[_0x8e2b('0x31')][_0x8e2b('0x3a')]);_0x289bc7[_0x8e2b('0x3b')]=qs[_0x8e2b('0x3c')](_[_0x8e2b('0x3d')](_0x3f527c[_0x8e2b('0x31')],_0x18bec2[_0x8e2b('0x3c')]),_0x18b164);if(_0x3f527c['query'][_0x8e2b('0x3e')]){_0x289bc7[_0x8e2b('0x3b')]=_[_0x8e2b('0x3f')](_0x289bc7[_0x8e2b('0x3b')],{'$or':_[_0x8e2b('0x2e')](_0x18b164,function(_0x31b5ac){if(_0x31b5ac[_0x8e2b('0x30')]!=='VIRTUAL'){var _0x4b690c={};_0x4b690c[_0x31b5ac[_0x8e2b('0x2c')]]={'$like':'%'+_0x3f527c[_0x8e2b('0x31')][_0x8e2b('0x3e')]+'%'};return _0x4b690c;}})});}_0x289bc7=_['merge']({},_0x289bc7,_0x3f527c[_0x8e2b('0x40')]);var _0x4c908d={'where':_0x289bc7['where']};return db[_0x8e2b('0x2f')]['count'](_0x4c908d)[_0x8e2b('0x26')](function(_0x4adbd8){_0x1d610d[_0x8e2b('0x1f')]=_0x4adbd8;if(_0x3f527c['query'][_0x8e2b('0x41')]){_0x289bc7['include']=[{'all':!![]}];}return db[_0x8e2b('0x2f')][_0x8e2b('0x42')](_0x289bc7);})[_0x8e2b('0x26')](function(_0x1804bc){_0x1d610d[_0x8e2b('0x43')]=_0x1804bc;return _0x1d610d;})['then'](respondWithFilteredResult(_0x514ab5,_0x289bc7))['catch'](handleError(_0x514ab5,null));};exports[_0x8e2b('0x44')]=function(_0x2f68bc,_0x294b23){var _0x340ce7={'raw':![],'where':{'id':_0x2f68bc[_0x8e2b('0x45')]['id']}},_0x3955e9={};_0x3955e9[_0x8e2b('0x35')]=_[_0x8e2b('0x32')](db[_0x8e2b('0x2f')][_0x8e2b('0x46')]);_0x3955e9[_0x8e2b('0x31')]=_[_0x8e2b('0x32')](_0x2f68bc['query']);_0x3955e9[_0x8e2b('0x3c')]=_['intersection'](_0x3955e9[_0x8e2b('0x35')],_0x3955e9[_0x8e2b('0x31')]);_0x340ce7[_0x8e2b('0x34')]=_['intersection'](_0x3955e9[_0x8e2b('0x35')],qs[_0x8e2b('0x36')](_0x2f68bc[_0x8e2b('0x31')]['fields']));_0x340ce7[_0x8e2b('0x34')]=_0x340ce7[_0x8e2b('0x34')][_0x8e2b('0x37')]?_0x340ce7['attributes']:_0x3955e9[_0x8e2b('0x35')];if(_0x2f68bc[_0x8e2b('0x31')][_0x8e2b('0x41')]){_0x340ce7['include']=[{'all':!![]}];}_0x340ce7=_[_0x8e2b('0x3f')]({},_0x340ce7,_0x2f68bc[_0x8e2b('0x40')]);return db[_0x8e2b('0x2f')][_0x8e2b('0x47')](_0x340ce7)['then'](handleEntityNotFound(_0x294b23,null))[_0x8e2b('0x26')](respondWithResult(_0x294b23,null))['catch'](handleError(_0x294b23,null));};exports[_0x8e2b('0x48')]=function(_0x498191,_0x3fadc2){return db[_0x8e2b('0x2f')][_0x8e2b('0x48')](_0x498191[_0x8e2b('0x49')],{})[_0x8e2b('0x26')](function(_0x167603){var _0x19d780=_0x498191[_0x8e2b('0x4a')][_0x8e2b('0x27')]({'plain':!![]});if(!_0x19d780)throw new Error(_0x8e2b('0x4b'));if(_0x19d780[_0x8e2b('0x4c')]===_0x8e2b('0x4a')){var _0x56e150=_0x167603[_0x8e2b('0x27')]({'plain':!![]});var _0xdc1d06='Scheduler';return db[_0x8e2b('0x4d')]['find']({'where':{'name':_0xdc1d06,'userProfileId':_0x19d780['userProfileId']},'raw':!![]})['then'](function(_0x12286c){if(_0x12286c&&_0x12286c[_0x8e2b('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x56e150[_0x8e2b('0x2c')],'resourceId':_0x56e150['id'],'type':_0x12286c['name'],'sectionId':_0x12286c['id']},{})[_0x8e2b('0x26')](function(){return _0x167603;});}else{return _0x167603;}})[_0x8e2b('0x4f')](function(_0x1ae782){logger[_0x8e2b('0x2a')](_0x8e2b('0x50'),_0x1ae782);throw _0x1ae782;});}return _0x167603;})[_0x8e2b('0x26')](respondWithResult(_0x3fadc2,0xc9))['catch'](handleError(_0x3fadc2,null));};exports[_0x8e2b('0x24')]=function(_0x359b6d,_0x46bc96){if(_0x359b6d['body']['id']){delete _0x359b6d[_0x8e2b('0x49')]['id'];}return db['Schedule']['find']({'where':{'id':_0x359b6d[_0x8e2b('0x45')]['id']}})[_0x8e2b('0x26')](handleEntityNotFound(_0x46bc96,null))['then'](saveUpdates(_0x359b6d[_0x8e2b('0x49')],null))[_0x8e2b('0x26')](respondWithResult(_0x46bc96,null))[_0x8e2b('0x4f')](handleError(_0x46bc96,null));};exports[_0x8e2b('0x25')]=function(_0x17ac04,_0x3bd5cf){return db[_0x8e2b('0x2f')][_0x8e2b('0x47')]({'where':{'id':_0x17ac04[_0x8e2b('0x45')]['id']}})[_0x8e2b('0x26')](handleEntityNotFound(_0x3bd5cf,null))[_0x8e2b('0x26')](removeEntity(_0x3bd5cf,null))[_0x8e2b('0x4f')](handleError(_0x3bd5cf,null));};exports[_0x8e2b('0x51')]=function(_0x46d05b,_0x1d8b28,_0x272d78){var _0xbaffb7=require('../../config/schedule');return db[_0x8e2b('0x2f')][_0x8e2b('0x47')]({'where':{'id':_0x46d05b[_0x8e2b('0x45')]['id']},'raw':!![]})[_0x8e2b('0x26')](handleEntityNotFound(_0x1d8b28,null))[_0x8e2b('0x26')](function(){_0xbaffb7['run'](_0x46d05b[_0x8e2b('0x45')]['id']);})['then'](respondWithStatusCode(_0x1d8b28,null))[_0x8e2b('0x4f')](handleError(_0x1d8b28,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index ef9cfee..68f98c3 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 _0xb32c=['define','Schedule','tools_schedules','lodash','util','api','request-promise','path','../../config/environment','exports'];(function(_0x823165,_0x9f4050){var _0x2f6f77=function(_0x12c38c){while(--_0x12c38c){_0x823165['push'](_0x823165['shift']());}};_0x2f6f77(++_0x9f4050);}(_0xb32c,0x7b));var _0xcb32=function(_0x1030e6,_0x2273ce){_0x1030e6=_0x1030e6-0x0;var _0x2cf67d=_0xb32c[_0x1030e6];return _0x2cf67d;};'use strict';var _=require(_0xcb32('0x0'));var util=require(_0xcb32('0x1'));var logger=require('../../config/logger')(_0xcb32('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcb32('0x3'));var fs=require('fs');var path=require(_0xcb32('0x4'));var rimraf=require('rimraf');var config=require(_0xcb32('0x5'));var attributes=require('./schedule.attributes');module[_0xcb32('0x6')]=function(_0x587e94,_0x373377){return _0x587e94[_0xcb32('0x7')](_0xcb32('0x8'),attributes,{'tableName':_0xcb32('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2041=['request-promise','path','rimraf','./schedule.attributes','define','Schedule','lodash','../../config/logger','moment','bluebird'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x2041,0x164));var _0x1204=function(_0x798ed9,_0x12633e){_0x798ed9=_0x798ed9-0x0;var _0x2204f1=_0x2041[_0x798ed9];return _0x2204f1;};'use strict';var _=require(_0x1204('0x0'));var util=require('util');var logger=require(_0x1204('0x1'))('api');var moment=require(_0x1204('0x2'));var BPromise=require(_0x1204('0x3'));var rp=require(_0x1204('0x4'));var fs=require('fs');var path=require(_0x1204('0x5'));var rimraf=require(_0x1204('0x6'));var config=require('../../config/environment');var attributes=require(_0x1204('0x7'));module['exports']=function(_0x10781f,_0x55063f){return _0x10781f[_0x1204('0x8')](_0x1204('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 2bb7563..8f73bdb 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 _0x04df=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request','then','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Schedule,\x20%s,\x20%s','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x551823,_0x304f96){var _0x2dca71=function(_0x524827){while(--_0x524827){_0x551823['push'](_0x551823['shift']());}};_0x2dca71(++_0x304f96);}(_0x04df,0x136));var _0xf04d=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x04df[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xf04d('0x0'));var util=require(_0xf04d('0x1'));var moment=require(_0xf04d('0x2'));var BPromise=require('bluebird');var rs=require(_0xf04d('0x3'));var fs=require('fs');var Redis=require(_0xf04d('0x4'));var db=require(_0xf04d('0x5'))['db'];var utils=require(_0xf04d('0x6'));var logger=require(_0xf04d('0x7'))('rpc');var config=require(_0xf04d('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a3152,_0x40eba4,_0x22ece4){return new BPromise(function(_0x322ffa,_0x3025e3){return client[_0xf04d('0x9')](_0x3a3152,_0x22ece4)[_0xf04d('0xa')](function(_0x5ce6a4){logger[_0xf04d('0xb')]('Schedule,\x20%s,\x20%s',_0x40eba4,_0xf04d('0xc'));logger[_0xf04d('0xd')](_0xf04d('0xe'),_0x40eba4,'request\x20sent',JSON[_0xf04d('0xf')](_0x5ce6a4));if(_0x5ce6a4[_0xf04d('0x10')]){if(_0x5ce6a4[_0xf04d('0x10')][_0xf04d('0x11')]===0x1f4){logger[_0xf04d('0x10')]('Schedule,\x20%s,\x20%s',_0x40eba4,_0x5ce6a4['error'][_0xf04d('0x12')]);return _0x3025e3(_0x5ce6a4[_0xf04d('0x10')]['message']);}logger[_0xf04d('0x10')](_0xf04d('0x13'),_0x40eba4,_0x5ce6a4[_0xf04d('0x10')][_0xf04d('0x12')]);return _0x322ffa(_0x5ce6a4[_0xf04d('0x10')][_0xf04d('0x12')]);}else{logger[_0xf04d('0xb')]('Schedule,\x20%s,\x20%s',_0x40eba4,_0xf04d('0xc'));_0x322ffa(_0x5ce6a4['result'][_0xf04d('0x12')]);}})[_0xf04d('0x14')](function(_0x3daebb){logger[_0xf04d('0x10')](_0xf04d('0x13'),_0x40eba4,_0x3daebb);_0x3025e3(_0x3daebb);});});} \ No newline at end of file +var _0xb566=['http','request','Schedule,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x2229da,_0x34c24f){var _0x36cbfd=function(_0x3a8147){while(--_0x3a8147){_0x2229da['push'](_0x2229da['shift']());}};_0x36cbfd(++_0x34c24f);}(_0xb566,0x1ef));var _0x6b56=function(_0x4e5552,_0x19ec4e){_0x4e5552=_0x4e5552-0x0;var _0x60a338=_0xb566[_0x4e5552];return _0x60a338;};'use strict';var _=require(_0x6b56('0x0'));var util=require(_0x6b56('0x1'));var moment=require(_0x6b56('0x2'));var BPromise=require(_0x6b56('0x3'));var rs=require(_0x6b56('0x4'));var fs=require('fs');var Redis=require(_0x6b56('0x5'));var db=require(_0x6b56('0x6'))['db'];var utils=require(_0x6b56('0x7'));var logger=require(_0x6b56('0x8'))('rpc');var config=require(_0x6b56('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6b56('0xa')][_0x6b56('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bb7db,_0x2ad8ed,_0x12a89d){return new BPromise(function(_0x359907,_0x5c3b1b){return client[_0x6b56('0xc')](_0x3bb7db,_0x12a89d)['then'](function(_0x229294){logger['info'](_0x6b56('0xd'),_0x2ad8ed,'request\x20sent');logger[_0x6b56('0xe')]('Schedule,\x20%s,\x20%s,\x20%s',_0x2ad8ed,'request\x20sent',JSON[_0x6b56('0xf')](_0x229294));if(_0x229294[_0x6b56('0x10')]){if(_0x229294[_0x6b56('0x10')][_0x6b56('0x11')]===0x1f4){logger['error'](_0x6b56('0xd'),_0x2ad8ed,_0x229294['error'][_0x6b56('0x12')]);return _0x5c3b1b(_0x229294['error'][_0x6b56('0x12')]);}logger[_0x6b56('0x10')](_0x6b56('0xd'),_0x2ad8ed,_0x229294[_0x6b56('0x10')][_0x6b56('0x12')]);return _0x359907(_0x229294['error'][_0x6b56('0x12')]);}else{logger['info'](_0x6b56('0xd'),_0x2ad8ed,_0x6b56('0x13'));_0x359907(_0x229294[_0x6b56('0x14')][_0x6b56('0x12')]);}})[_0x6b56('0x15')](function(_0x2d0eda){logger['error'](_0x6b56('0xd'),_0x2ad8ed,_0x2d0eda);_0x5c3b1b(_0x2d0eda);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 20486a1..a5d8865 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 _0xe005=['show','get','download','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./screenRecording.controller','isAuthenticated','index','/describe','describe','/:id'];(function(_0x451b36,_0x14dbae){var _0x181266=function(_0x58d6af){while(--_0x58d6af){_0x451b36['push'](_0x451b36['shift']());}};_0x181266(++_0x14dbae);}(_0xe005,0x17a));var _0x5e00=function(_0x146312,_0x4ca21a){_0x146312=_0x146312-0x0;var _0x3f8cf6=_0xe005[_0x146312];return _0x3f8cf6;};'use strict';var multer=require(_0x5e00('0x0'));var util=require(_0x5e00('0x1'));var path=require(_0x5e00('0x2'));var timeout=require(_0x5e00('0x3'));var express=require('express');var router=express[_0x5e00('0x4')]();var fs_extra=require(_0x5e00('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5e00('0x6'));var controller=require(_0x5e00('0x7'));router['get']('/',auth[_0x5e00('0x8')](),controller[_0x5e00('0x9')]);router['get'](_0x5e00('0xa'),auth['isAuthenticated'](),controller[_0x5e00('0xb')]);router['get'](_0x5e00('0xc'),auth[_0x5e00('0x8')](),controller[_0x5e00('0xd')]);router[_0x5e00('0xe')]('/:id/download',auth[_0x5e00('0x8')](),controller[_0x5e00('0xf')]);router[_0x5e00('0x10')]('/',auth['isAuthenticated'](),controller[_0x5e00('0x11')]);router[_0x5e00('0x12')](_0x5e00('0xc'),auth[_0x5e00('0x8')](),controller[_0x5e00('0x13')]);router[_0x5e00('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x5e00('0x15')]);module[_0x5e00('0x16')]=router; \ No newline at end of file +var _0xb512=['destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','create','put','update','delete'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xb512,0x1a4));var _0x2b51=function(_0x1d1d20,_0x25cde2){_0x1d1d20=_0x1d1d20-0x0;var _0x191963=_0xb512[_0x1d1d20];return _0x191963;};'use strict';var multer=require(_0x2b51('0x0'));var util=require('util');var path=require(_0x2b51('0x1'));var timeout=require(_0x2b51('0x2'));var express=require('express');var router=express[_0x2b51('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2b51('0x4'));var interaction=require(_0x2b51('0x5'));var config=require(_0x2b51('0x6'));var controller=require(_0x2b51('0x7'));router[_0x2b51('0x8')]('/',auth['isAuthenticated'](),controller[_0x2b51('0x9')]);router[_0x2b51('0x8')](_0x2b51('0xa'),auth[_0x2b51('0xb')](),controller[_0x2b51('0xc')]);router[_0x2b51('0x8')](_0x2b51('0xd'),auth[_0x2b51('0xb')](),controller[_0x2b51('0xe')]);router[_0x2b51('0x8')](_0x2b51('0xf'),auth[_0x2b51('0xb')](),controller['download']);router['post']('/',auth[_0x2b51('0xb')](),controller[_0x2b51('0x10')]);router[_0x2b51('0x11')](_0x2b51('0xd'),auth[_0x2b51('0xb')](),controller[_0x2b51('0x12')]);router[_0x2b51('0x13')]('/:id',auth[_0x2b51('0xb')](),controller[_0x2b51('0x14')]);module[_0x2b51('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index e99787d..1a58cb5 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 _0x49db=['../../config/environment','exports','getDataValue','value','extname','STRING','setDataValue','INTEGER','closedAt','duration','DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x49db,0xc5));var _0xb49d=function(_0x4cce3e,_0x4a1349){_0x4cce3e=_0x4cce3e-0x0;var _0x391e08=_0x49db[_0x4cce3e];return _0x391e08;};'use strict';var Sequelize=require(_0xb49d('0x0'));var moment=require(_0xb49d('0x1'));var path=require(_0xb49d('0x2'));var config=require(_0xb49d('0x3'));module[_0xb49d('0x4')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xb49d('0x5')](_0xb49d('0x6'))?path[_0xb49d('0x7')](this['getDataValue'](_0xb49d('0x6'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xb49d('0x8')],'set':function(_0x4180c8){var _0x15f52f=_0x4180c8['replace'](/\\/g,'/');this[_0xb49d('0x9')](_0xb49d('0x6'),_0x15f52f);}},'rating':{'type':Sequelize[_0xb49d('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xb49d('0xa')],'set':function(_0x3d4825){this[_0xb49d('0x9')]('startedAt',moment()['subtract'](_0x3d4825,'ms'));this[_0xb49d('0x9')](_0xb49d('0xb'),moment());this[_0xb49d('0x9')](_0xb49d('0xc'),_0x3d4825);}},'startedAt':{'type':Sequelize[_0xb49d('0xd')],'get':function(){return moment(this[_0xb49d('0x5')](_0xb49d('0xe')))[_0xb49d('0xf')](_0xb49d('0x10'))['toString']();}},'closedAt':{'type':Sequelize[_0xb49d('0xd')],'get':function(){return moment(this[_0xb49d('0x5')](_0xb49d('0xb')))[_0xb49d('0xf')]('MM-DD-YYYY\x20HH:mm')[_0xb49d('0x11')]();}},'createdAt':{'type':Sequelize[_0xb49d('0xd')],'get':function(){return moment(this['getDataValue'](_0xb49d('0x12')))[_0xb49d('0xf')](_0xb49d('0x10'))[_0xb49d('0x11')]();}},'updatedAt':{'type':Sequelize[_0xb49d('0xd')],'get':function(){return moment(this[_0xb49d('0x5')](_0xb49d('0x13')))['format'](_0xb49d('0x10'))[_0xb49d('0x11')]();}}}; \ No newline at end of file +var _0x5324=['sequelize','moment','path','../../config/environment','VIRTUAL','value','extname','getDataValue','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','format','MM-DD-YYYY\x20HH:mm','toString','DATE','updatedAt'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x5324,0x154));var _0x4532=function(_0x2f28da,_0x2b8970){_0x2f28da=_0x2f28da-0x0;var _0x43d5aa=_0x5324[_0x2f28da];return _0x43d5aa;};'use strict';var Sequelize=require(_0x4532('0x0'));var moment=require(_0x4532('0x1'));var path=require(_0x4532('0x2'));var config=require(_0x4532('0x3'));module['exports']={'format':{'type':Sequelize[_0x4532('0x4')],'get':function(){return this['getDataValue'](_0x4532('0x5'))?path[_0x4532('0x6')](this[_0x4532('0x7')](_0x4532('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x4532('0x8')]},'channel':{'type':Sequelize[_0x4532('0x8')]},'value':{'type':Sequelize[_0x4532('0x8')],'set':function(_0x352b6a){var _0x58e28c=_0x352b6a[_0x4532('0x9')](/\\/g,'/');this[_0x4532('0xa')](_0x4532('0x5'),_0x58e28c);}},'rating':{'type':Sequelize[_0x4532('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x4532('0xb')],'set':function(_0x4340a7){this[_0x4532('0xa')](_0x4532('0xc'),moment()[_0x4532('0xd')](_0x4340a7,'ms'));this[_0x4532('0xa')](_0x4532('0xe'),moment());this[_0x4532('0xa')]('duration',_0x4340a7);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x4532('0x7')]('startedAt'))[_0x4532('0xf')](_0x4532('0x10'))[_0x4532('0x11')]();}},'closedAt':{'type':Sequelize[_0x4532('0x12')],'get':function(){return moment(this['getDataValue'](_0x4532('0xe')))[_0x4532('0xf')](_0x4532('0x10'))[_0x4532('0x11')]();}},'createdAt':{'type':Sequelize[_0x4532('0x12')],'get':function(){return moment(this['getDataValue']('createdAt'))['format'](_0x4532('0x10'))[_0x4532('0x11')]();}},'updatedAt':{'type':Sequelize[_0x4532('0x12')],'get':function(){return moment(this[_0x4532('0x7')](_0x4532('0x13')))[_0x4532('0xf')](_0x4532('0x10'))[_0x4532('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 99a7da2..1488a55 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 _0xe14b=['include','findAll','catch','show','fields','length','includeAll','find','create','body','duration','closedAt','value','params','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','error','stack','name','send','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options'];(function(_0x5cb279,_0x2fa349){var _0x3458d0=function(_0xb887a4){while(--_0xb887a4){_0x5cb279['push'](_0x5cb279['shift']());}};_0x3458d0(++_0x2fa349);}(_0xe14b,0x93));var _0xbe14=function(_0x22c0fc,_0x14bec2){_0x22c0fc=_0x22c0fc-0x0;var _0x38a9a5=_0xe14b[_0x22c0fc];return _0x38a9a5;};'use strict';var emlformat=require(_0xbe14('0x0'));var rimraf=require(_0xbe14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe14('0x2'));var moment=require(_0xbe14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbe14('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbe14('0x5'));var csv=require(_0xbe14('0x6'));var ejs=require(_0xbe14('0x7'));var fs=require('fs');var fs_extra=require(_0xbe14('0x8'));var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=typeof _0x3dc4a9['offset']===_0xbe14('0x19')&&typeof _0x3dc4a9[_0xbe14('0x1a')]===_0xbe14('0x19');var _0x123ede=_0xf4ac9[_0xbe14('0x1b')];var _0x29ab73=_0x37ce4e?0x0:_0x3dc4a9[_0xbe14('0x1c')];var _0x5ea1f8=_0x37ce4e?_0xf4ac9[_0xbe14('0x1b')]:_0x3dc4a9[_0xbe14('0x1c')]+_0x3dc4a9[_0xbe14('0x1a')];var _0x433459;if(_0x5ea1f8>=_0x123ede){_0x5ea1f8=_0x123ede;_0x433459=0xc8;}else{_0x433459=0xce;}_0x3f58f5[_0xbe14('0x17')](_0x433459);return _0x3f58f5[_0xbe14('0x1d')]('Content-Range',_0x29ab73+'-'+_0x5ea1f8+'/'+_0x123ede)[_0xbe14('0x1e')](_0xf4ac9);}return null;};}function patchUpdates(_0x4a1bbd){return function(_0x417c8d){try{jsonpatch[_0xbe14('0x1f')](_0x417c8d,_0x4a1bbd,!![]);}catch(_0x188ec4){return BPromise['reject'](_0x188ec4);}return _0x417c8d[_0xbe14('0x20')]();};}function saveUpdates(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')](_0x56d845)['then'](function(_0x274018){return _0x274018;});}return null;};}function removeEntity(_0x3d3608,_0x505dbd){return function(_0x2da350){if(_0x2da350){return _0x2da350['destroy']()[_0xbe14('0x22')](function(){_0x3d3608['status'](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x5fa043,_0x1ee9c1){return function(_0x39cc81){if(!_0x39cc81){_0x5fa043[_0xbe14('0x16')](0x194);}return _0x39cc81;};}function handleError(_0x2703f5,_0x55d001){_0x55d001=_0x55d001||0x1f4;return function(_0x1822e0){logger[_0xbe14('0x23')](_0x1822e0[_0xbe14('0x24')]);if(_0x1822e0[_0xbe14('0x25')]){delete _0x1822e0['name'];}_0x2703f5[_0xbe14('0x17')](_0x55d001)[_0xbe14('0x26')](_0x1822e0);};}exports['index']=function(_0x3c3613,_0x3b3e84){var _0x1c7cc7={},_0x19252f={},_0x34d648={'count':0x0,'rows':[]};var _0x36d4b2=_[_0xbe14('0x27')](db[_0xbe14('0x28')][_0xbe14('0x29')],function(_0x16a159){return{'name':_0x16a159[_0xbe14('0x2a')],'type':_0x16a159[_0xbe14('0x2b')][_0xbe14('0x2c')]};});_0x19252f[_0xbe14('0x2d')]=_[_0xbe14('0x2e')](_[_0xbe14('0x27')](_0x36d4b2,_0xbe14('0x25')),[_0xbe14('0x2f')]);_0x19252f[_0xbe14('0x30')]=_[_0xbe14('0x31')](_0x3c3613['query']);_0x19252f[_0xbe14('0x32')]=_['intersection'](_0x19252f['model'],_0x19252f[_0xbe14('0x30')]);_0x1c7cc7['attributes']=_[_0xbe14('0x33')](_0x19252f[_0xbe14('0x2d')],qs['fields'](_0x3c3613['query']['fields']));_0x1c7cc7[_0xbe14('0x34')]=_0x1c7cc7[_0xbe14('0x34')]['length']?_0x1c7cc7[_0xbe14('0x34')]:_0x19252f[_0xbe14('0x2d')];if(!_0x3c3613[_0xbe14('0x30')][_0xbe14('0x35')](_0xbe14('0x36'))){_0x1c7cc7['limit']=qs['limit'](_0x3c3613[_0xbe14('0x30')]['limit']);_0x1c7cc7['offset']=qs['offset'](_0x3c3613[_0xbe14('0x30')][_0xbe14('0x1c')]);}_0x1c7cc7[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x3c3613[_0xbe14('0x30')][_0xbe14('0x38')]);_0x1c7cc7[_0xbe14('0x39')]=qs[_0xbe14('0x32')](_[_0xbe14('0x3a')](_0x3c3613[_0xbe14('0x30')],_0x19252f[_0xbe14('0x32')]),_0x36d4b2);if(_0x3c3613[_0xbe14('0x30')]['filter']){_0x1c7cc7['where']=_[_0xbe14('0x3b')](_0x1c7cc7[_0xbe14('0x39')],{'$or':_[_0xbe14('0x27')](_0x36d4b2,function(_0x520e09){if(_0x520e09[_0xbe14('0x2b')]!==_0xbe14('0x3c')){var _0xeda70e={};_0xeda70e[_0x520e09[_0xbe14('0x25')]]={'$like':'%'+_0x3c3613[_0xbe14('0x30')][_0xbe14('0x3d')]+'%'};return _0xeda70e;}})});}_0x1c7cc7=_[_0xbe14('0x3b')]({},_0x1c7cc7,_0x3c3613[_0xbe14('0x3e')]);var _0x1b2608={'where':_0x1c7cc7['where']};return db[_0xbe14('0x28')][_0xbe14('0x1b')](_0x1b2608)[_0xbe14('0x22')](function(_0x1b3118){_0x34d648[_0xbe14('0x1b')]=_0x1b3118;if(_0x3c3613[_0xbe14('0x30')]['includeAll']){_0x1c7cc7[_0xbe14('0x3f')]=[{'all':!![]}];}return db[_0xbe14('0x28')][_0xbe14('0x40')](_0x1c7cc7);})[_0xbe14('0x22')](function(_0x5cf713){_0x34d648['rows']=_0x5cf713;return _0x34d648;})[_0xbe14('0x22')](respondWithFilteredResult(_0x3b3e84,_0x1c7cc7))[_0xbe14('0x41')](handleError(_0x3b3e84,null));};exports[_0xbe14('0x42')]=function(_0x51c859,_0x5d5318){var _0x6b6aa8={'raw':![],'where':{'id':_0x51c859['params']['id']}},_0x59ae4d={};_0x59ae4d[_0xbe14('0x2d')]=_[_0xbe14('0x31')](db[_0xbe14('0x28')]['rawAttributes']);_0x59ae4d['query']=_['keys'](_0x51c859[_0xbe14('0x30')]);_0x59ae4d[_0xbe14('0x32')]=_[_0xbe14('0x33')](_0x59ae4d['model'],_0x59ae4d[_0xbe14('0x30')]);_0x6b6aa8[_0xbe14('0x34')]=_[_0xbe14('0x33')](_0x59ae4d[_0xbe14('0x2d')],qs['fields'](_0x51c859['query'][_0xbe14('0x43')]));_0x6b6aa8[_0xbe14('0x34')]=_0x6b6aa8[_0xbe14('0x34')][_0xbe14('0x44')]?_0x6b6aa8[_0xbe14('0x34')]:_0x59ae4d['model'];if(_0x51c859['query'][_0xbe14('0x45')]){_0x6b6aa8[_0xbe14('0x3f')]=[{'all':!![]}];}_0x6b6aa8=_[_0xbe14('0x3b')]({},_0x6b6aa8,_0x51c859[_0xbe14('0x3e')]);return db['ScreenRecording'][_0xbe14('0x46')](_0x6b6aa8)[_0xbe14('0x22')](handleEntityNotFound(_0x5d5318,null))['then'](respondWithResult(_0x5d5318,null))[_0xbe14('0x41')](handleError(_0x5d5318,null));};exports[_0xbe14('0x47')]=function(_0x2d6ee8,_0x36c20c){return db['ScreenRecording']['create'](_0x2d6ee8[_0xbe14('0x48')],{})[_0xbe14('0x22')](respondWithResult(_0x36c20c,0xc9))['catch'](handleError(_0x36c20c,null));};exports['update']=function(_0xca8cdb,_0x5d3726){if(_0xca8cdb[_0xbe14('0x48')]['id']){delete _0xca8cdb[_0xbe14('0x48')]['id'];}delete _0xca8cdb[_0xbe14('0x48')][_0xbe14('0x49')];delete _0xca8cdb[_0xbe14('0x48')]['createdAt'];delete _0xca8cdb[_0xbe14('0x48')][_0xbe14('0x4a')];delete _0xca8cdb[_0xbe14('0x48')][_0xbe14('0x4b')];return db[_0xbe14('0x28')]['find']({'where':{'id':_0xca8cdb[_0xbe14('0x4c')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x5d3726,null))[_0xbe14('0x22')](saveUpdates(_0xca8cdb[_0xbe14('0x48')],null))[_0xbe14('0x22')](respondWithResult(_0x5d3726,null))[_0xbe14('0x41')](handleError(_0x5d3726,null));};exports['describe']=function(_0x5aeea9,_0x3a49f7){return db[_0xbe14('0x28')][_0xbe14('0x4d')]()['then'](respondWithResult(_0x3a49f7,null))['catch'](handleError(_0x3a49f7,null));};exports[_0xbe14('0x4e')]=function(_0x134878,_0x50d78f,_0x339a86){var _0x32496a=require('../../components/encryptor');var _0x28f995=![];var _0x4a40d2={};if(_0x134878[_0xbe14('0x30')][_0xbe14('0x2b')]&&_0x134878[_0xbe14('0x30')]['type']===_0xbe14('0x4f')){_0x4a40d2[_0xbe14('0x4f')]=_0x134878['params']['id'];}else{_0x4a40d2['id']=_0x134878[_0xbe14('0x4c')]['id'];}return db[_0xbe14('0x28')][_0xbe14('0x46')]({'where':_0x4a40d2,'attributes':['id',_0xbe14('0x4b')],'raw':!![]})[_0xbe14('0x22')](handleEntityNotFound(_0x50d78f,null))['then'](function(_0x42a346){if(_0x42a346){var _0x34cd66=path[_0xbe14('0x50')](config[_0xbe14('0x51')],_0xbe14('0x52'),_0x42a346[_0xbe14('0x4b')]);var _0x1dd6c7=util['format'](_0xbe14('0x53'),_0x34cd66);if(fs[_0xbe14('0x54')](_0x1dd6c7)){_0x28f995=!![];return _0x32496a[_0xbe14('0x55')](_0x1dd6c7,_0x34cd66,config[_0xbe14('0x56')][_0xbe14('0x57')])[_0xbe14('0x22')](function(){return _0x42a346;});}return _0x42a346;}})[_0xbe14('0x22')](function(_0x32df3c){if(_0x32df3c){var _0x285b6e=path[_0xbe14('0x50')](config[_0xbe14('0x51')],'server/files/screen_recordings',_0x32df3c['value']);if(!fs['existsSync'](_0x285b6e)){throw new db[(_0xbe14('0x58'))][(_0xbe14('0x59'))](_0xbe14('0x5a'));}if(_0x32df3c[_0xbe14('0x5b')]){return _0x50d78f[_0xbe14('0x4e')](_0x285b6e,_0x32df3c[_0xbe14('0x5b')]+path[_0xbe14('0x5c')](_0x285b6e),function(){if(_0x28f995){fs[_0xbe14('0x5d')](_0x285b6e);}});}else{return _0x50d78f[_0xbe14('0x4e')](_0x285b6e,function(_0x451b0b){if(_0x28f995){fs[_0xbe14('0x5d')](_0x285b6e);}});}}})[_0xbe14('0x41')](function(_0x2088e4){if(_0x2088e4[_0xbe14('0x5e')]===_0xbe14('0x5a')){_0x50d78f[_0xbe14('0x17')](0x194)[_0xbe14('0x26')](_0xbe14('0x5f'));}else{return handleError(_0x50d78f,null);}});};exports[_0xbe14('0x60')]=function(_0x1a945b,_0x5f394c){return db[_0xbe14('0x28')][_0xbe14('0x46')]({'where':{'id':_0x1a945b[_0xbe14('0x4c')]['id']}})[_0xbe14('0x22')](function(_0x3ee6b7){if(_[_0xbe14('0x61')](_0x3ee6b7)){throw new ReferenceError(_0xbe14('0x62'));}return _0x3ee6b7;})[_0xbe14('0x22')](function(_0x23cb36){var _0x100d43=path['join'](config[_0xbe14('0x51')],_0xbe14('0x52'),_0x23cb36[_0xbe14('0x4b')]);logger[_0xbe14('0x63')](_0xbe14('0x64'),_0x100d43);if(!_['isNil'](_0x23cb36[_0xbe14('0x4b')])&&fs[_0xbe14('0x54')](_0x100d43)){logger[_0xbe14('0x63')](_0xbe14('0x65')+_0x100d43+_0xbe14('0x66'));fs['unlinkSync'](_0x100d43);}_0x100d43=_0x100d43+_0xbe14('0x67');if(!_[_0xbe14('0x61')](_0x23cb36[_0xbe14('0x4b')])&&fs[_0xbe14('0x54')](_0x100d43)){logger[_0xbe14('0x63')](_0xbe14('0x65')+_0x100d43+_0xbe14('0x66'));fs[_0xbe14('0x68')](_0x100d43);}return _0x23cb36;})['then'](function(_0x1bb588){if(!_0x1bb588)throw new InternalError();return _0x1bb588[_0xbe14('0x60')]();})[_0xbe14('0x22')](function(){_0x5f394c[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();})[_0xbe14('0x41')](handleError(_0x5f394c,null));}; \ No newline at end of file +var _0xae24=['status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','index','map','ScreenRecording','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','duration','createdAt','closedAt','find','describe','download','../../components/encryptor','uniqueid','value','join','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','eml-format','zip-dir','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xae24,0x182));var _0x4ae2=function(_0x303471,_0x1736e5){_0x303471=_0x303471-0x0;var _0x56b9e9=_0xae24[_0x303471];return _0x56b9e9;};'use strict';var emlformat=require(_0x4ae2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4ae2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ae2('0x2'));var moment=require(_0x4ae2('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ae2('0x4'));var path=require('path');var sox=require(_0x4ae2('0x5'));var csv=require(_0x4ae2('0x6'));var ejs=require(_0x4ae2('0x7'));var fs=require('fs');var fs_extra=require(_0x4ae2('0x8'));var _=require(_0x4ae2('0x9'));var squel=require(_0x4ae2('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4ae2('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4ae2('0xc'));var Redis=require(_0x4ae2('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x4ae2('0xe'));var as=require(_0x4ae2('0xf'));var hardwareService=require(_0x4ae2('0x10'));var logger=require(_0x4ae2('0x11'))('api');var utils=require(_0x4ae2('0x12'));var config=require(_0x4ae2('0x13'));var licenseUtil=require(_0x4ae2('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25d2b4,_0x22ac1e){_0x22ac1e=_0x22ac1e||0xcc;return function(_0x30d6c4){if(_0x30d6c4){return _0x25d2b4[_0x4ae2('0x15')](_0x22ac1e);}return _0x25d2b4[_0x4ae2('0x16')](_0x22ac1e)[_0x4ae2('0x17')]();};}function respondWithResult(_0x145287,_0x3cabc9){_0x3cabc9=_0x3cabc9||0xc8;return function(_0xd527a0){if(_0xd527a0){return _0x145287['status'](_0x3cabc9)['json'](_0xd527a0);}};}function respondWithFilteredResult(_0x4d5cab,_0x2f3936){return function(_0xf834a1){if(_0xf834a1){var _0x5f447a=typeof _0x2f3936[_0x4ae2('0x18')]===_0x4ae2('0x19')&&typeof _0x2f3936[_0x4ae2('0x1a')]===_0x4ae2('0x19');var _0x428d24=_0xf834a1[_0x4ae2('0x1b')];var _0x3d4259=_0x5f447a?0x0:_0x2f3936[_0x4ae2('0x18')];var _0x41b672=_0x5f447a?_0xf834a1[_0x4ae2('0x1b')]:_0x2f3936['offset']+_0x2f3936['limit'];var _0x44a2d3;if(_0x41b672>=_0x428d24){_0x41b672=_0x428d24;_0x44a2d3=0xc8;}else{_0x44a2d3=0xce;}_0x4d5cab[_0x4ae2('0x16')](_0x44a2d3);return _0x4d5cab['set'](_0x4ae2('0x1c'),_0x3d4259+'-'+_0x41b672+'/'+_0x428d24)[_0x4ae2('0x1d')](_0xf834a1);}return null;};}function patchUpdates(_0xccb3b){return function(_0x2ad222){try{jsonpatch[_0x4ae2('0x1e')](_0x2ad222,_0xccb3b,!![]);}catch(_0x497218){return BPromise[_0x4ae2('0x1f')](_0x497218);}return _0x2ad222['save']();};}function saveUpdates(_0x522165,_0x2ceec4){return function(_0x151b70){if(_0x151b70){return _0x151b70[_0x4ae2('0x20')](_0x522165)[_0x4ae2('0x21')](function(_0xca16bf){return _0xca16bf;});}return null;};}function removeEntity(_0x526768,_0x1005e0){return function(_0x4a0ddb){if(_0x4a0ddb){return _0x4a0ddb[_0x4ae2('0x22')]()[_0x4ae2('0x21')](function(){_0x526768[_0x4ae2('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43f112,_0x6f0cc6){return function(_0x2454b3){if(!_0x2454b3){_0x43f112[_0x4ae2('0x15')](0x194);}return _0x2454b3;};}function handleError(_0x1c2934,_0x255772){_0x255772=_0x255772||0x1f4;return function(_0x5b2e65){logger['error'](_0x5b2e65[_0x4ae2('0x23')]);if(_0x5b2e65[_0x4ae2('0x24')]){delete _0x5b2e65[_0x4ae2('0x24')];}_0x1c2934[_0x4ae2('0x16')](_0x255772)[_0x4ae2('0x25')](_0x5b2e65);};}exports[_0x4ae2('0x26')]=function(_0x57a377,_0x5ec1fd){var _0x3e2666={},_0x4e7741={},_0x554cff={'count':0x0,'rows':[]};var _0x5e9f03=_[_0x4ae2('0x27')](db[_0x4ae2('0x28')]['rawAttributes'],function(_0x883fd5){return{'name':_0x883fd5[_0x4ae2('0x29')],'type':_0x883fd5[_0x4ae2('0x2a')][_0x4ae2('0x2b')]};});_0x4e7741[_0x4ae2('0x2c')]=_[_0x4ae2('0x2d')](_[_0x4ae2('0x27')](_0x5e9f03,_0x4ae2('0x24')),[_0x4ae2('0x2e')]);_0x4e7741[_0x4ae2('0x2f')]=_[_0x4ae2('0x30')](_0x57a377[_0x4ae2('0x2f')]);_0x4e7741[_0x4ae2('0x31')]=_[_0x4ae2('0x32')](_0x4e7741[_0x4ae2('0x2c')],_0x4e7741[_0x4ae2('0x2f')]);_0x3e2666[_0x4ae2('0x33')]=_['intersection'](_0x4e7741[_0x4ae2('0x2c')],qs['fields'](_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x34')]));_0x3e2666['attributes']=_0x3e2666[_0x4ae2('0x33')][_0x4ae2('0x35')]?_0x3e2666[_0x4ae2('0x33')]:_0x4e7741[_0x4ae2('0x2c')];if(!_0x57a377['query'][_0x4ae2('0x36')](_0x4ae2('0x37'))){_0x3e2666[_0x4ae2('0x1a')]=qs[_0x4ae2('0x1a')](_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x1a')]);_0x3e2666[_0x4ae2('0x18')]=qs[_0x4ae2('0x18')](_0x57a377[_0x4ae2('0x2f')]['offset']);}_0x3e2666[_0x4ae2('0x38')]=qs['sort'](_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x39')]);_0x3e2666[_0x4ae2('0x3a')]=qs[_0x4ae2('0x31')](_[_0x4ae2('0x3b')](_0x57a377[_0x4ae2('0x2f')],_0x4e7741['filters']),_0x5e9f03);if(_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x3c')]){_0x3e2666[_0x4ae2('0x3a')]=_[_0x4ae2('0x3d')](_0x3e2666['where'],{'$or':_[_0x4ae2('0x27')](_0x5e9f03,function(_0x34a784){if(_0x34a784[_0x4ae2('0x2a')]!==_0x4ae2('0x3e')){var _0x232243={};_0x232243[_0x34a784[_0x4ae2('0x24')]]={'$like':'%'+_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x3c')]+'%'};return _0x232243;}})});}_0x3e2666=_[_0x4ae2('0x3d')]({},_0x3e2666,_0x57a377[_0x4ae2('0x3f')]);var _0x2aaef1={'where':_0x3e2666['where']};return db[_0x4ae2('0x28')][_0x4ae2('0x1b')](_0x2aaef1)[_0x4ae2('0x21')](function(_0x1473e6){_0x554cff['count']=_0x1473e6;if(_0x57a377['query'][_0x4ae2('0x40')]){_0x3e2666[_0x4ae2('0x41')]=[{'all':!![]}];}return db[_0x4ae2('0x28')][_0x4ae2('0x42')](_0x3e2666);})['then'](function(_0x3c0a56){_0x554cff[_0x4ae2('0x43')]=_0x3c0a56;return _0x554cff;})['then'](respondWithFilteredResult(_0x5ec1fd,_0x3e2666))[_0x4ae2('0x44')](handleError(_0x5ec1fd,null));};exports[_0x4ae2('0x45')]=function(_0x11a5d9,_0x5a9126){var _0x2f6431={'raw':![],'where':{'id':_0x11a5d9[_0x4ae2('0x46')]['id']}},_0x29e12c={};_0x29e12c[_0x4ae2('0x2c')]=_[_0x4ae2('0x30')](db[_0x4ae2('0x28')][_0x4ae2('0x47')]);_0x29e12c[_0x4ae2('0x2f')]=_['keys'](_0x11a5d9[_0x4ae2('0x2f')]);_0x29e12c[_0x4ae2('0x31')]=_['intersection'](_0x29e12c[_0x4ae2('0x2c')],_0x29e12c[_0x4ae2('0x2f')]);_0x2f6431['attributes']=_[_0x4ae2('0x32')](_0x29e12c[_0x4ae2('0x2c')],qs['fields'](_0x11a5d9[_0x4ae2('0x2f')][_0x4ae2('0x34')]));_0x2f6431[_0x4ae2('0x33')]=_0x2f6431['attributes']['length']?_0x2f6431[_0x4ae2('0x33')]:_0x29e12c[_0x4ae2('0x2c')];if(_0x11a5d9[_0x4ae2('0x2f')][_0x4ae2('0x40')]){_0x2f6431['include']=[{'all':!![]}];}_0x2f6431=_[_0x4ae2('0x3d')]({},_0x2f6431,_0x11a5d9[_0x4ae2('0x3f')]);return db[_0x4ae2('0x28')]['find'](_0x2f6431)[_0x4ae2('0x21')](handleEntityNotFound(_0x5a9126,null))[_0x4ae2('0x21')](respondWithResult(_0x5a9126,null))[_0x4ae2('0x44')](handleError(_0x5a9126,null));};exports['create']=function(_0x16bf0b,_0x24ec08){return db[_0x4ae2('0x28')][_0x4ae2('0x48')](_0x16bf0b[_0x4ae2('0x49')],{})[_0x4ae2('0x21')](respondWithResult(_0x24ec08,0xc9))[_0x4ae2('0x44')](handleError(_0x24ec08,null));};exports[_0x4ae2('0x20')]=function(_0x3a6110,_0xf6d12a){if(_0x3a6110['body']['id']){delete _0x3a6110[_0x4ae2('0x49')]['id'];}delete _0x3a6110[_0x4ae2('0x49')][_0x4ae2('0x4a')];delete _0x3a6110[_0x4ae2('0x49')][_0x4ae2('0x4b')];delete _0x3a6110[_0x4ae2('0x49')][_0x4ae2('0x4c')];delete _0x3a6110[_0x4ae2('0x49')]['value'];return db[_0x4ae2('0x28')][_0x4ae2('0x4d')]({'where':{'id':_0x3a6110['params']['id']}})[_0x4ae2('0x21')](handleEntityNotFound(_0xf6d12a,null))[_0x4ae2('0x21')](saveUpdates(_0x3a6110['body'],null))[_0x4ae2('0x21')](respondWithResult(_0xf6d12a,null))['catch'](handleError(_0xf6d12a,null));};exports[_0x4ae2('0x4e')]=function(_0x5e1c80,_0x1ae8bb){return db[_0x4ae2('0x28')][_0x4ae2('0x4e')]()[_0x4ae2('0x21')](respondWithResult(_0x1ae8bb,null))[_0x4ae2('0x44')](handleError(_0x1ae8bb,null));};exports[_0x4ae2('0x4f')]=function(_0x201260,_0xf77b17,_0x28de70){var _0x529355=require(_0x4ae2('0x50'));var _0x4284b4=![];var _0x825c3a={};if(_0x201260[_0x4ae2('0x2f')]['type']&&_0x201260[_0x4ae2('0x2f')][_0x4ae2('0x2a')]===_0x4ae2('0x51')){_0x825c3a['uniqueid']=_0x201260['params']['id'];}else{_0x825c3a['id']=_0x201260[_0x4ae2('0x46')]['id'];}return db[_0x4ae2('0x28')][_0x4ae2('0x4d')]({'where':_0x825c3a,'attributes':['id',_0x4ae2('0x52')],'raw':!![]})[_0x4ae2('0x21')](handleEntityNotFound(_0xf77b17,null))[_0x4ae2('0x21')](function(_0x18a8e6){if(_0x18a8e6){var _0x390c1f=path[_0x4ae2('0x53')](config['root'],_0x4ae2('0x54'),_0x18a8e6['value']);var _0x11f028=util[_0x4ae2('0x2e')](_0x4ae2('0x55'),_0x390c1f);if(fs[_0x4ae2('0x56')](_0x11f028)){_0x4284b4=!![];return _0x529355[_0x4ae2('0x57')](_0x11f028,_0x390c1f,config[_0x4ae2('0x58')][_0x4ae2('0x59')])[_0x4ae2('0x21')](function(){return _0x18a8e6;});}return _0x18a8e6;}})['then'](function(_0x496f98){if(_0x496f98){var _0x33fb77=path[_0x4ae2('0x53')](config[_0x4ae2('0x5a')],'server/files/screen_recordings',_0x496f98['value']);if(!fs[_0x4ae2('0x56')](_0x33fb77)){throw new db[(_0x4ae2('0x5b'))][(_0x4ae2('0x5c'))](_0x4ae2('0x5d'));}if(_0x496f98[_0x4ae2('0x5e')]){return _0xf77b17['download'](_0x33fb77,_0x496f98['filename']+path['extname'](_0x33fb77),function(){if(_0x4284b4){fs[_0x4ae2('0x5f')](_0x33fb77);}});}else{return _0xf77b17['download'](_0x33fb77,function(_0x4e54d1){if(_0x4284b4){fs[_0x4ae2('0x5f')](_0x33fb77);}});}}})['catch'](function(_0x3efbaf){if(_0x3efbaf['message']===_0x4ae2('0x5d')){_0xf77b17['status'](0x194)[_0x4ae2('0x25')]('Not\x20found');}else{return handleError(_0xf77b17,null);}});};exports[_0x4ae2('0x22')]=function(_0x981338,_0x3f46f3){return db[_0x4ae2('0x28')][_0x4ae2('0x4d')]({'where':{'id':_0x981338['params']['id']}})['then'](function(_0x344963){if(_[_0x4ae2('0x60')](_0x344963)){throw new ReferenceError('Entity\x20not\x20found');}return _0x344963;})[_0x4ae2('0x21')](function(_0x29183d){var _0x517800=path[_0x4ae2('0x53')](config[_0x4ae2('0x5a')],'server/files/screen_recordings',_0x29183d['value']);logger[_0x4ae2('0x61')](_0x4ae2('0x62'),_0x517800);if(!_['isNil'](_0x29183d[_0x4ae2('0x52')])&&fs[_0x4ae2('0x56')](_0x517800)){logger[_0x4ae2('0x61')](_0x4ae2('0x63')+_0x517800+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x4ae2('0x64')](_0x517800);}_0x517800=_0x517800+_0x4ae2('0x65');if(!_['isNil'](_0x29183d[_0x4ae2('0x52')])&&fs[_0x4ae2('0x56')](_0x517800)){logger[_0x4ae2('0x61')]('File:\x20\x22'+_0x517800+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x4ae2('0x64')](_0x517800);}return _0x29183d;})['then'](function(_0x3f24bb){if(!_0x3f24bb)throw new InternalError();return _0x3f24bb['destroy']();})[_0x4ae2('0x21')](function(){_0x3f46f3['status'](0xcc)[_0x4ae2('0x17')]();})['catch'](handleError(_0x3f46f3,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index c70002a..0532d2f 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 _0xd23f=['define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./screenRecording.attributes'];(function(_0x57a313,_0x12c11b){var _0x2c0274=function(_0x446748){while(--_0x446748){_0x57a313['push'](_0x57a313['shift']());}};_0x2c0274(++_0x12c11b);}(_0xd23f,0x82));var _0xfd23=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xd23f[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0xfd23('0x0'));var util=require(_0xfd23('0x1'));var logger=require(_0xfd23('0x2'))(_0xfd23('0x3'));var moment=require(_0xfd23('0x4'));var BPromise=require(_0xfd23('0x5'));var rp=require(_0xfd23('0x6'));var fs=require('fs');var path=require(_0xfd23('0x7'));var rimraf=require(_0xfd23('0x8'));var config=require('../../config/environment');var attributes=require(_0xfd23('0x9'));module['exports']=function(_0x33d34f,_0x15b33d){return _0x33d34f[_0xfd23('0xa')](_0xfd23('0xb'),attributes,{'tableName':_0xfd23('0xc'),'paranoid':![],'indexes':[{'name':_0xfd23('0xd'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe983=['moment','bluebird','request-promise','path','rimraf','./screenRecording.attributes','exports','screen_recordings','interactionid','../../config/logger'];(function(_0x7b949,_0x235039){var _0xa4d8db=function(_0x52796b){while(--_0x52796b){_0x7b949['push'](_0x7b949['shift']());}};_0xa4d8db(++_0x235039);}(_0xe983,0x18f));var _0x3e98=function(_0x3162cd,_0x1c04b7){_0x3162cd=_0x3162cd-0x0;var _0x301fb2=_0xe983[_0x3162cd];return _0x301fb2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3e98('0x0'))('api');var moment=require(_0x3e98('0x1'));var BPromise=require(_0x3e98('0x2'));var rp=require(_0x3e98('0x3'));var fs=require('fs');var path=require(_0x3e98('0x4'));var rimraf=require(_0x3e98('0x5'));var config=require('../../config/environment');var attributes=require(_0x3e98('0x6'));module[_0x3e98('0x7')]=function(_0x3a1b7f,_0x2f22b6){return _0x3a1b7f['define']('ScreenRecording',attributes,{'tableName':_0x3e98('0x8'),'paranoid':![],'indexes':[{'name':_0x3e98('0x9'),'fields':[_0x3e98('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index fad2dda..0530b48 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 _0xc094=['result','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x50a783,_0xac43c6){var _0x3cf726=function(_0x54819f){while(--_0x54819f){_0x50a783['push'](_0x50a783['shift']());}};_0x3cf726(++_0xac43c6);}(_0xc094,0x151));var _0x4c09=function(_0xa7177,_0x474041){_0xa7177=_0xa7177-0x0;var _0x2fb17f=_0xc094[_0xa7177];return _0x2fb17f;};'use strict';var _=require('lodash');var util=require(_0x4c09('0x0'));var moment=require(_0x4c09('0x1'));var BPromise=require('bluebird');var rs=require(_0x4c09('0x2'));var fs=require('fs');var Redis=require(_0x4c09('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4c09('0x4'));var logger=require(_0x4c09('0x5'))('rpc');var config=require(_0x4c09('0x6'));var jayson=require(_0x4c09('0x7'));var client=jayson[_0x4c09('0x8')][_0x4c09('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5aab43,_0x354eab,_0x599491){return new BPromise(function(_0x2fe6a2,_0x59dd8d){return client[_0x4c09('0xa')](_0x5aab43,_0x599491)[_0x4c09('0xb')](function(_0xf11dab){logger['info'](_0x4c09('0xc'),_0x354eab,_0x4c09('0xd'));logger[_0x4c09('0xe')](_0x4c09('0xf'),_0x354eab,_0x4c09('0xd'),JSON['stringify'](_0xf11dab));if(_0xf11dab[_0x4c09('0x10')]){if(_0xf11dab[_0x4c09('0x10')][_0x4c09('0x11')]===0x1f4){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x354eab,_0xf11dab[_0x4c09('0x10')][_0x4c09('0x12')]);return _0x59dd8d(_0xf11dab[_0x4c09('0x10')]['message']);}logger['error'](_0x4c09('0xc'),_0x354eab,_0xf11dab['error'][_0x4c09('0x12')]);return _0x2fe6a2(_0xf11dab[_0x4c09('0x10')][_0x4c09('0x12')]);}else{logger[_0x4c09('0x13')](_0x4c09('0xc'),_0x354eab,'request\x20sent');_0x2fe6a2(_0xf11dab[_0x4c09('0x14')][_0x4c09('0x12')]);}})['catch'](function(_0x11c263){logger['error'](_0x4c09('0xc'),_0x354eab,_0x11c263);_0x59dd8d(_0x11c263);});});} \ No newline at end of file +var _0x79f4=['jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x79f4,0xb6));var _0x479f=function(_0x361b40,_0x5563be){_0x361b40=_0x361b40-0x0;var _0x2994cb=_0x79f4[_0x361b40];return _0x2994cb;};'use strict';var _=require(_0x479f('0x0'));var util=require(_0x479f('0x1'));var moment=require(_0x479f('0x2'));var BPromise=require('bluebird');var rs=require(_0x479f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x479f('0x4'))['db'];var utils=require(_0x479f('0x5'));var logger=require('../../config/logger')(_0x479f('0x6'));var config=require('../../config/environment');var jayson=require(_0x479f('0x7'));var client=jayson[_0x479f('0x8')][_0x479f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a4850,_0x2fd2dd,_0x26575b){return new BPromise(function(_0x39e62f,_0x440379){return client[_0x479f('0xa')](_0x5a4850,_0x26575b)[_0x479f('0xb')](function(_0x15a614){logger[_0x479f('0xc')](_0x479f('0xd'),_0x2fd2dd,_0x479f('0xe'));logger[_0x479f('0xf')](_0x479f('0x10'),_0x2fd2dd,_0x479f('0xe'),JSON[_0x479f('0x11')](_0x15a614));if(_0x15a614['error']){if(_0x15a614[_0x479f('0x12')]['code']===0x1f4){logger['error'](_0x479f('0xd'),_0x2fd2dd,_0x15a614[_0x479f('0x12')]['message']);return _0x440379(_0x15a614[_0x479f('0x12')][_0x479f('0x13')]);}logger[_0x479f('0x12')](_0x479f('0xd'),_0x2fd2dd,_0x15a614['error'][_0x479f('0x13')]);return _0x39e62f(_0x15a614[_0x479f('0x12')]['message']);}else{logger[_0x479f('0xc')](_0x479f('0xd'),_0x2fd2dd,_0x479f('0xe'));_0x39e62f(_0x15a614['result']['message']);}})[_0x479f('0x14')](function(_0xbcd525){logger['error'](_0x479f('0xd'),_0x2fd2dd,_0xbcd525);_0x440379(_0xbcd525);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index f87a2fe..d686610 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 _0x8792=['multer','util','connect-timeout','Router','../../config/environment','./setting.controller','index','get','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','root','server/files/images/logos/','%s%s','logo','extname','originalname','post','single','file','addLogo','join','format','logologin','addLogoLogin','preferred','addPreferred','addFavicon','put','update','exports'];(function(_0x1198d1,_0x7c8ffe){var _0x5a8d4a=function(_0x2a9781){while(--_0x2a9781){_0x1198d1['push'](_0x1198d1['shift']());}};_0x5a8d4a(++_0x7c8ffe);}(_0x8792,0x148));var _0x2879=function(_0x909306,_0x1cad80){_0x909306=_0x909306-0x0;var _0x3a5131=_0x8792[_0x909306];return _0x3a5131;};'use strict';var multer=require(_0x2879('0x0'));var util=require(_0x2879('0x1'));var path=require('path');var timeout=require(_0x2879('0x2'));var express=require('express');var router=express[_0x2879('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2879('0x4'));var controller=require(_0x2879('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x2879('0x6')]);router[_0x2879('0x7')]('/now',controller['getDate']);router[_0x2879('0x7')](_0x2879('0x8'),controller[_0x2879('0x9')]);router[_0x2879('0x7')](_0x2879('0xa'),controller[_0x2879('0xb')]);router[_0x2879('0x7')](_0x2879('0xc'),controller[_0x2879('0xd')]);router[_0x2879('0x7')](_0x2879('0xe'),controller[_0x2879('0xf')]);router[_0x2879('0x7')](_0x2879('0x10'),controller[_0x2879('0x11')]);router[_0x2879('0x7')](_0x2879('0x12'),controller[_0x2879('0x13')]);var upload=multer({'storage':multer[_0x2879('0x14')]({'destination':function(_0x21ddaa,_0x3ba693,_0x45b4f9){_0x45b4f9(null,path['join'](config[_0x2879('0x15')],_0x2879('0x16')));},'filename':function(_0x2789dd,_0x252783,_0x2503b9){_0x2503b9(null,util['format'](_0x2879('0x17'),_0x2879('0x18'),path[_0x2879('0x19')](_0x252783[_0x2879('0x1a')])));}})});router[_0x2879('0x1b')]('/:id/logo',upload[_0x2879('0x1c')](_0x2879('0x1d')),controller[_0x2879('0x1e')]);var upload=multer({'storage':multer[_0x2879('0x14')]({'destination':function(_0xac8f27,_0x395cd3,_0x1fd914){_0x1fd914(null,path[_0x2879('0x1f')](config[_0x2879('0x15')],_0x2879('0x16')));},'filename':function(_0x5bf6bd,_0x2f9ade,_0x1f7784){_0x1f7784(null,util[_0x2879('0x20')]('%s%s',_0x2879('0x21'),path[_0x2879('0x19')](_0x2f9ade[_0x2879('0x1a')])));}})});router['post'](_0x2879('0xc'),upload[_0x2879('0x1c')]('file'),controller[_0x2879('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xd7ce1c,_0x3be9a8,_0x29954e){_0x29954e(null,path[_0x2879('0x1f')](config[_0x2879('0x15')],_0x2879('0x16')));},'filename':function(_0x53a047,_0x4e742a,_0x388dcf){_0x388dcf(null,util['format'](_0x2879('0x17'),_0x2879('0x23'),path[_0x2879('0x19')](_0x4e742a[_0x2879('0x1a')])));}})});router[_0x2879('0x1b')](_0x2879('0x10'),upload[_0x2879('0x1c')]('file'),controller[_0x2879('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2ad064,_0x1a0686,_0x3cca6a){_0x3cca6a(null,path['join'](config[_0x2879('0x15')],_0x2879('0x16')));},'filename':function(_0x56fea3,_0x385dbb,_0x1d0c00){_0x1d0c00(null,util[_0x2879('0x20')]('%s%s','favicon',path[_0x2879('0x19')](_0x385dbb[_0x2879('0x1a')])));}})});router[_0x2879('0x1b')](_0x2879('0x12'),upload[_0x2879('0x1c')](_0x2879('0x1d')),controller[_0x2879('0x25')]);router[_0x2879('0x26')](_0x2879('0x8'),auth['isAuthenticated'](),controller[_0x2879('0x27')]);module[_0x2879('0x28')]=router; \ No newline at end of file +var _0x45b3=['/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','extname','single','file','addLogo','logologin','originalname','post','addPreferred','%s%s','favicon','addFavicon','put','update','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/:id','show','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred'];(function(_0x5e08f5,_0x410043){var _0x4b3d92=function(_0x43c6b5){while(--_0x43c6b5){_0x5e08f5['push'](_0x5e08f5['shift']());}};_0x4b3d92(++_0x410043);}(_0x45b3,0x1e4));var _0x345b=function(_0x2e46a2,_0x52147a){_0x2e46a2=_0x2e46a2-0x0;var _0x3231ec=_0x45b3[_0x2e46a2];return _0x3231ec;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x345b('0x0'));var timeout=require(_0x345b('0x1'));var express=require(_0x345b('0x2'));var router=express[_0x345b('0x3')]();var fs_extra=require(_0x345b('0x4'));var auth=require(_0x345b('0x5'));var interaction=require(_0x345b('0x6'));var config=require(_0x345b('0x7'));var controller=require(_0x345b('0x8'));router[_0x345b('0x9')]('/',auth[_0x345b('0xa')](),controller[_0x345b('0xb')]);router[_0x345b('0x9')]('/now',controller['getDate']);router[_0x345b('0x9')](_0x345b('0xc'),controller[_0x345b('0xd')]);router[_0x345b('0x9')]('/:id/logo',controller[_0x345b('0xe')]);router[_0x345b('0x9')](_0x345b('0xf'),controller[_0x345b('0x10')]);router[_0x345b('0x9')](_0x345b('0x11'),controller['gdpr']);router['get'](_0x345b('0x12'),controller[_0x345b('0x13')]);router[_0x345b('0x9')](_0x345b('0x14'),controller[_0x345b('0x15')]);var upload=multer({'storage':multer[_0x345b('0x16')]({'destination':function(_0x528340,_0x3fb46f,_0x371c32){_0x371c32(null,path[_0x345b('0x17')](config[_0x345b('0x18')],_0x345b('0x19')));},'filename':function(_0x4e6f10,_0x28ea8a,_0x411188){_0x411188(null,util[_0x345b('0x1a')]('%s%s',_0x345b('0x1b'),path[_0x345b('0x1c')](_0x28ea8a['originalname'])));}})});router['post']('/:id/logo',upload[_0x345b('0x1d')](_0x345b('0x1e')),controller[_0x345b('0x1f')]);var upload=multer({'storage':multer[_0x345b('0x16')]({'destination':function(_0x47d55d,_0x8006e9,_0x18f7ec){_0x18f7ec(null,path[_0x345b('0x17')](config[_0x345b('0x18')],_0x345b('0x19')));},'filename':function(_0x5da8fc,_0x83dab1,_0x228501){_0x228501(null,util[_0x345b('0x1a')]('%s%s',_0x345b('0x20'),path[_0x345b('0x1c')](_0x83dab1[_0x345b('0x21')])));}})});router[_0x345b('0x22')](_0x345b('0xf'),upload['single'](_0x345b('0x1e')),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xe085fc,_0x3b8139,_0x95cda9){_0x95cda9(null,path[_0x345b('0x17')](config[_0x345b('0x18')],'server/files/images/logos/'));},'filename':function(_0x4f9e97,_0xc796,_0x274099){_0x274099(null,util[_0x345b('0x1a')]('%s%s','preferred',path[_0x345b('0x1c')](_0xc796[_0x345b('0x21')])));}})});router[_0x345b('0x22')](_0x345b('0x12'),upload[_0x345b('0x1d')]('file'),controller[_0x345b('0x23')]);var upload=multer({'storage':multer[_0x345b('0x16')]({'destination':function(_0x485592,_0x375045,_0x2d2cd2){_0x2d2cd2(null,path[_0x345b('0x17')](config[_0x345b('0x18')],'server/files/images/logos/'));},'filename':function(_0x358ad4,_0xd7230f,_0x2b2785){_0x2b2785(null,util[_0x345b('0x1a')](_0x345b('0x24'),_0x345b('0x25'),path[_0x345b('0x1c')](_0xd7230f['originalname'])));}})});router[_0x345b('0x22')](_0x345b('0x14'),upload[_0x345b('0x1d')]('file'),controller[_0x345b('0x26')]);router[_0x345b('0x27')](_0x345b('0xc'),auth[_0x345b('0xa')](),controller[_0x345b('0x28')]);module[_0x345b('0x29')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 8bddb29..a9a2bab 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 _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(_0x47e309,_0x1e771a){var _0x2e1900=function(_0x407297){while(--_0x407297){_0x47e309['push'](_0x47e309['shift']());}};_0x2e1900(++_0x1e771a);}(_0xadb5,0xad));var _0x5adb=function(_0x402d66,_0x122409){_0x402d66=_0x402d66-0x0;var _0x19220b=_0xadb5[_0x402d66];return _0x19220b;};'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 +var _0x7a54=['UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate'];(function(_0x41f174,_0x125cdc){var _0xcedd26=function(_0x105f8b){while(--_0x105f8b){_0x41f174['push'](_0x41f174['shift']());}};_0xcedd26(++_0x125cdc);}(_0x7a54,0x106));var _0x47a5=function(_0x52b2ea,_0x11caa1){_0x52b2ea=_0x52b2ea-0x0;var _0x33582c=_0x7a54[_0x52b2ea];return _0x33582c;};'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 diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 62beb94..3f9456a 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 _0xdffe=['destroy','end','sendStatus','stack','send','index','map','Setting','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','find','update','body','addLogo','file','filename','addLogoLogin','loginLogo','server/files/images/logos','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','upperFirst','custom','default_logo.svg','ValidationError','\x20not\x20found','download','getLogoLogin','getLicense','default','Sequelize','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','status','offset','undefined','count','Content-Range','json','apply','reject','save'];(function(_0x13bd46,_0x52279d){var _0xf60b7b=function(_0x1398fb){while(--_0x1398fb){_0x13bd46['push'](_0x13bd46['shift']());}};_0xf60b7b(++_0x52279d);}(_0xdffe,0x1d2));var _0xedff=function(_0x58836f,_0x5351e2){_0x58836f=_0x58836f-0x0;var _0x28f9b1=_0xdffe[_0x58836f];return _0x28f9b1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xedff('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xedff('0x1'));var rp=require(_0xedff('0x2'));var moment=require(_0xedff('0x3'));var BPromise=require(_0xedff('0x4'));var Mustache=require(_0xedff('0x5'));var util=require(_0xedff('0x6'));var path=require('path');var sox=require(_0xedff('0x7'));var csv=require(_0xedff('0x8'));var ejs=require(_0xedff('0x9'));var fs=require('fs');var fs_extra=require(_0xedff('0xa'));var _=require('lodash');var squel=require(_0xedff('0xb'));var crypto=require(_0xedff('0xc'));var jsforce=require(_0xedff('0xd'));var deskjs=require(_0xedff('0xe'));var toCsv=require(_0xedff('0x8'));var querystring=require(_0xedff('0xf'));var Papa=require(_0xedff('0x10'));var Redis=require(_0xedff('0x11'));var authService=require(_0xedff('0x12'));var qs=require(_0xedff('0x13'));var as=require(_0xedff('0x14'));var hardwareService=require(_0xedff('0x15'));var logger=require(_0xedff('0x16'))(_0xedff('0x17'));var utils=require(_0xedff('0x18'));var config=require(_0xedff('0x19'));var licenseUtil=require(_0xedff('0x1a'));var db=require(_0xedff('0x1b'))['db'];var jayson=require(_0xedff('0x1c'));var client=jayson['client'][_0xedff('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5edfa6,_0x5d9a1c,_0xcc68b9,_0x47a8a2){return new BPromise(function(_0x21b554,_0xddefb3){var _0x503e0f=_0x47a8a2||client;return _0x503e0f[_0xedff('0x1e')](_0x5edfa6,_0xcc68b9)[_0xedff('0x1f')](function(_0x4b74ea){logger[_0xedff('0x20')](_0xedff('0x21'),_0x5d9a1c,_0xedff('0x22'));logger[_0xedff('0x23')]('Setting,\x20%s,\x20%s,\x20%s',_0x5d9a1c,'request\x20sent',JSON[_0xedff('0x24')](_0x4b74ea));if(_0x4b74ea[_0xedff('0x25')]){if(_0x4b74ea['error'][_0xedff('0x26')]===0x1f4){logger[_0xedff('0x25')](_0xedff('0x21'),_0x5d9a1c,_0x4b74ea[_0xedff('0x25')][_0xedff('0x27')]);return _0xddefb3(_0x4b74ea[_0xedff('0x25')]['message']);}logger[_0xedff('0x25')](_0xedff('0x21'),_0x5d9a1c,_0x4b74ea[_0xedff('0x25')][_0xedff('0x27')]);return _0x21b554(_0x4b74ea[_0xedff('0x25')][_0xedff('0x27')]);}else{logger[_0xedff('0x20')](_0xedff('0x21'),_0x5d9a1c,'request\x20sent');_0x21b554(_0x4b74ea[_0xedff('0x28')][_0xedff('0x27')]);}})['catch'](function(_0x38fdf7){logger['error'](_0xedff('0x21'),_0x5d9a1c,_0x38fdf7);_0xddefb3(_0x38fdf7);});});}function respondWithStatusCode(_0x4ed54b,_0x4a70cf){_0x4a70cf=_0x4a70cf||0xcc;return function(_0x4640c7){if(_0x4640c7){return _0x4ed54b['sendStatus'](_0x4a70cf);}return _0x4ed54b[_0xedff('0x29')](_0x4a70cf)['end']();};}function respondWithResult(_0x2f4e46,_0xf8896){_0xf8896=_0xf8896||0xc8;return function(_0x57ee89){if(_0x57ee89){return _0x2f4e46[_0xedff('0x29')](_0xf8896)['json'](_0x57ee89);}};}function respondWithFilteredResult(_0x1286df,_0x5a8ebd){return function(_0x4505bc){if(_0x4505bc){var _0x39ea40=typeof _0x5a8ebd[_0xedff('0x2a')]===_0xedff('0x2b')&&typeof _0x5a8ebd['limit']===_0xedff('0x2b');var _0x118a87=_0x4505bc[_0xedff('0x2c')];var _0xc3c70e=_0x39ea40?0x0:_0x5a8ebd[_0xedff('0x2a')];var _0x1e450c=_0x39ea40?_0x4505bc[_0xedff('0x2c')]:_0x5a8ebd['offset']+_0x5a8ebd['limit'];var _0x2ade43;if(_0x1e450c>=_0x118a87){_0x1e450c=_0x118a87;_0x2ade43=0xc8;}else{_0x2ade43=0xce;}_0x1286df['status'](_0x2ade43);return _0x1286df['set'](_0xedff('0x2d'),_0xc3c70e+'-'+_0x1e450c+'/'+_0x118a87)[_0xedff('0x2e')](_0x4505bc);}return null;};}function patchUpdates(_0x1befd0){return function(_0x23bb76){try{jsonpatch[_0xedff('0x2f')](_0x23bb76,_0x1befd0,!![]);}catch(_0x5bc7c5){return BPromise[_0xedff('0x30')](_0x5bc7c5);}return _0x23bb76[_0xedff('0x31')]();};}function saveUpdates(_0x537dd5,_0x5a02ae){return function(_0x43c155){if(_0x43c155){return _0x43c155['update'](_0x537dd5)['then'](function(_0x42bae7){return _0x42bae7;});}return null;};}function removeEntity(_0xf2ae2c,_0x33a3c7){return function(_0x2508b6){if(_0x2508b6){return _0x2508b6[_0xedff('0x32')]()[_0xedff('0x1f')](function(){_0xf2ae2c[_0xedff('0x29')](0xcc)[_0xedff('0x33')]();});}};}function handleEntityNotFound(_0x1bd2cb,_0x5ced47){return function(_0x338042){if(!_0x338042){_0x1bd2cb[_0xedff('0x34')](0x194);}return _0x338042;};}function handleError(_0x4ca17f,_0x4433e8){_0x4433e8=_0x4433e8||0x1f4;return function(_0x2a2d5c){logger['error'](_0x2a2d5c[_0xedff('0x35')]);if(_0x2a2d5c['name']){delete _0x2a2d5c['name'];}_0x4ca17f['status'](_0x4433e8)[_0xedff('0x36')](_0x2a2d5c);};}exports[_0xedff('0x37')]=function(_0x55138e,_0x12cce3){var _0x33e136={},_0x2ded75={},_0x587cdc={'count':0x0,'rows':[]};var _0x3d0ee5=_[_0xedff('0x38')](db[_0xedff('0x39')]['rawAttributes'],function(_0xe6af44){return{'name':_0xe6af44[_0xedff('0x3a')],'type':_0xe6af44['type'][_0xedff('0x3b')]};});_0x2ded75[_0xedff('0x3c')]=_['map'](_0x3d0ee5,_0xedff('0x3d'));_0x2ded75[_0xedff('0x3e')]=_[_0xedff('0x3f')](_0x55138e[_0xedff('0x3e')]);_0x2ded75[_0xedff('0x40')]=_[_0xedff('0x41')](_0x2ded75[_0xedff('0x3c')],_0x2ded75[_0xedff('0x3e')]);_0x33e136[_0xedff('0x42')]=_['intersection'](_0x2ded75['model'],qs[_0xedff('0x43')](_0x55138e[_0xedff('0x3e')][_0xedff('0x43')]));_0x33e136[_0xedff('0x42')]=_0x33e136[_0xedff('0x42')][_0xedff('0x44')]?_0x33e136['attributes']:_0x2ded75[_0xedff('0x3c')];if(!_0x55138e[_0xedff('0x3e')][_0xedff('0x45')](_0xedff('0x46'))){_0x33e136[_0xedff('0x47')]=qs[_0xedff('0x47')](_0x55138e[_0xedff('0x3e')][_0xedff('0x47')]);_0x33e136['offset']=qs[_0xedff('0x2a')](_0x55138e[_0xedff('0x3e')][_0xedff('0x2a')]);}_0x33e136[_0xedff('0x48')]=qs[_0xedff('0x49')](_0x55138e[_0xedff('0x3e')][_0xedff('0x49')]);_0x33e136[_0xedff('0x4a')]=qs[_0xedff('0x40')](_['pick'](_0x55138e[_0xedff('0x3e')],_0x2ded75[_0xedff('0x40')]),_0x3d0ee5);if(_0x55138e[_0xedff('0x3e')][_0xedff('0x4b')]){_0x33e136[_0xedff('0x4a')]=_[_0xedff('0x4c')](_0x33e136[_0xedff('0x4a')],{'$or':_[_0xedff('0x38')](_0x3d0ee5,function(_0x1f18be){if(_0x1f18be[_0xedff('0x4d')]!==_0xedff('0x4e')){var _0x385451={};_0x385451[_0x1f18be[_0xedff('0x3d')]]={'$like':'%'+_0x55138e['query'][_0xedff('0x4b')]+'%'};return _0x385451;}})});}_0x33e136=_[_0xedff('0x4c')]({},_0x33e136,_0x55138e[_0xedff('0x4f')]);var _0x5c44c6={'where':_0x33e136[_0xedff('0x4a')]};return db['Setting'][_0xedff('0x2c')](_0x5c44c6)[_0xedff('0x1f')](function(_0x24a1c7){_0x587cdc[_0xedff('0x2c')]=_0x24a1c7;if(_0x55138e[_0xedff('0x3e')]['includeAll']){_0x33e136[_0xedff('0x50')]=[{'all':!![]}];}return db['Setting'][_0xedff('0x51')](_0x33e136);})[_0xedff('0x1f')](function(_0x46516e){_0x587cdc[_0xedff('0x52')]=_0x46516e;return _0x587cdc;})[_0xedff('0x1f')](respondWithFilteredResult(_0x12cce3,_0x33e136))[_0xedff('0x53')](handleError(_0x12cce3,null));};exports[_0xedff('0x54')]=function(_0x3f98f8,_0xe884fc){var _0x2ec422={'raw':![],'where':{'id':_0x3f98f8[_0xedff('0x55')]['id']}},_0x1dfa4d={};_0x1dfa4d[_0xedff('0x3c')]=_[_0xedff('0x3f')](db[_0xedff('0x39')][_0xedff('0x56')]);_0x1dfa4d[_0xedff('0x3e')]=_['keys'](_0x3f98f8[_0xedff('0x3e')]);_0x1dfa4d[_0xedff('0x40')]=_[_0xedff('0x41')](_0x1dfa4d['model'],_0x1dfa4d[_0xedff('0x3e')]);_0x2ec422[_0xedff('0x42')]=_[_0xedff('0x41')](_0x1dfa4d[_0xedff('0x3c')],qs[_0xedff('0x43')](_0x3f98f8[_0xedff('0x3e')]['fields']));_0x2ec422[_0xedff('0x42')]=_0x2ec422['attributes'][_0xedff('0x44')]?_0x2ec422[_0xedff('0x42')]:_0x1dfa4d[_0xedff('0x3c')];if(_0x3f98f8['query']['includeAll']){_0x2ec422[_0xedff('0x50')]=[{'all':!![]}];}_0x2ec422=_[_0xedff('0x4c')]({},_0x2ec422,_0x3f98f8[_0xedff('0x4f')]);return db[_0xedff('0x39')][_0xedff('0x57')](_0x2ec422)['then'](handleEntityNotFound(_0xe884fc,null))[_0xedff('0x1f')](respondWithResult(_0xe884fc,null))[_0xedff('0x53')](handleError(_0xe884fc,null));};exports[_0xedff('0x58')]=function(_0x565fa4,_0x121897){if(_0x565fa4[_0xedff('0x59')]['id']){delete _0x565fa4[_0xedff('0x59')]['id'];}return db[_0xedff('0x39')][_0xedff('0x57')]({'where':{'id':_0x565fa4[_0xedff('0x55')]['id']}})['then'](handleEntityNotFound(_0x121897,null))[_0xedff('0x1f')](saveUpdates(_0x565fa4[_0xedff('0x59')],null))[_0xedff('0x1f')](respondWithResult(_0x121897,null))[_0xedff('0x53')](handleError(_0x121897,null));};exports[_0xedff('0x5a')]=function(_0x1f38f7,_0x398a9b,_0x1d1011){if(_0x1f38f7['file']&&_0x1f38f7[_0xedff('0x5b')][_0xedff('0x5c')]){_0x1f38f7[_0xedff('0x59')]['logo']=_0x1f38f7[_0xedff('0x5b')][_0xedff('0x5c')];}return db[_0xedff('0x39')]['find']({'where':{'id':_0x1f38f7['params']['id']}})[_0xedff('0x1f')](handleEntityNotFound(_0x398a9b,null))[_0xedff('0x1f')](saveUpdates(_0x1f38f7[_0xedff('0x59')],null))[_0xedff('0x1f')](respondWithResult(_0x398a9b,null))[_0xedff('0x53')](handleError(_0x398a9b,null));};exports[_0xedff('0x5d')]=function(_0x5bc759,_0xf34622,_0x35e1f2){if(_0x5bc759[_0xedff('0x5b')]&&_0x5bc759[_0xedff('0x5b')][_0xedff('0x5c')]){_0x5bc759[_0xedff('0x59')][_0xedff('0x5e')]=_0x5bc759[_0xedff('0x5b')][_0xedff('0x5c')];}return db['Setting'][_0xedff('0x57')]({'where':{'id':_0x5bc759['params']['id']}})['then'](handleEntityNotFound(_0xf34622,null))[_0xedff('0x1f')](saveUpdates(_0x5bc759['body'],null))[_0xedff('0x1f')](respondWithResult(_0xf34622,null))[_0xedff('0x53')](handleError(_0xf34622,null));};var utilLicense=require(_0xedff('0x1a'));exports['getLogo']=function(_0xecb1a2,_0x3df697,_0x4290cf){var _0x9dd55b=_0xedff('0x5f');var _0x1ff959={'custom':![]};return utilLicense['getLicense']()[_0xedff('0x1f')](function(_0x47c50b){if(_0x47c50b){_0x1ff959=_0x47c50b;}return db[_0xedff('0x39')][_0xedff('0x57')]({'where':{'id':_0xecb1a2['params']['id']},'attributes':[_0xedff('0x60'),_0xedff('0x5e'),_0xedff('0x61'),_0xedff('0x62'),_0xedff('0x63'),_0xedff('0x64'),_0xedff('0x65'),_0xedff('0x66')],'raw':!![]});})[_0xedff('0x1f')](handleEntityNotFound(_0x3df697,null))['then'](function(_0x2e2715){if(_0x2e2715){var _0x38c83a=_0x2e2715[_0xedff('0x60')]&&fs[_0xedff('0x67')](path[_0xedff('0x68')](config[_0xedff('0x69')],_0x9dd55b,_[_0xedff('0x6a')](_0x2e2715['logo'])))?path['join'](config[_0xedff('0x69')],_0x9dd55b,_['toLower'](_0x2e2715['logo'])):path[_0xedff('0x68')](config[_0xedff('0x69')],_0x9dd55b,_[_0xedff('0x6a')]('default_logo.svg'));var _0x22868a='default'+_[_0xedff('0x6b')]('logo');if(_0x2e2715[_0x22868a]||!_0x1ff959[_0xedff('0x6c')]){_0x38c83a=path[_0xedff('0x68')](config[_0xedff('0x69')],_0x9dd55b,_[_0xedff('0x6a')](_0xedff('0x6d')));}if(!fs[_0xedff('0x67')](_0x38c83a)){throw new db['Sequelize'][(_0xedff('0x6e'))](_[_0xedff('0x6b')](_0xedff('0x60'))+_0xedff('0x6f'));}return _0x3df697[_0xedff('0x70')](_0x38c83a);}})[_0xedff('0x53')](handleError(_0x3df697,null));};var utilLicense=require(_0xedff('0x1a'));exports[_0xedff('0x71')]=function(_0x59019b,_0xa392ef,_0x591e1d){var _0x55e863=_0xedff('0x5f');var _0x5ef89f={'custom':![]};return utilLicense[_0xedff('0x72')]()[_0xedff('0x1f')](function(_0x23167a){if(_0x23167a){_0x5ef89f=_0x23167a;}return db[_0xedff('0x39')]['find']({'where':{'id':_0x59019b['params']['id']},'attributes':[_0xedff('0x60'),_0xedff('0x5e'),_0xedff('0x61'),_0xedff('0x62'),_0xedff('0x63'),'defaultLoginLogo',_0xedff('0x65'),'defaultFavicon'],'raw':!![]});})[_0xedff('0x1f')](handleEntityNotFound(_0xa392ef,null))[_0xedff('0x1f')](function(_0x22b074){if(_0x22b074){var _0x1521a7=_0x22b074[_0xedff('0x5e')]&&fs['existsSync'](path[_0xedff('0x68')](config[_0xedff('0x69')],_0x55e863,_[_0xedff('0x6a')](_0x22b074[_0xedff('0x5e')])))?path[_0xedff('0x68')](config[_0xedff('0x69')],_0x55e863,_['toLower'](_0x22b074[_0xedff('0x5e')])):path[_0xedff('0x68')](config[_0xedff('0x69')],_0x55e863,_[_0xedff('0x6a')]('default_loginLogo.svg'));var _0x2eadf4=_0xedff('0x73')+_[_0xedff('0x6b')](_0xedff('0x5e'));if(_0x22b074[_0x2eadf4]||!_0x5ef89f[_0xedff('0x6c')]){_0x1521a7=path[_0xedff('0x68')](config[_0xedff('0x69')],_0x55e863,_['toLower']('default_loginLogo.svg'));}if(!fs[_0xedff('0x67')](_0x1521a7)){throw new db[(_0xedff('0x74'))][(_0xedff('0x6e'))](_[_0xedff('0x6b')](_0xedff('0x5e'))+_0xedff('0x6f'));}return _0xa392ef['download'](_0x1521a7);}})[_0xedff('0x53')](handleError(_0xa392ef,null));};exports[_0xedff('0x75')]=function(_0x19ae5a,_0x424bb6){return db[_0xedff('0x39')][_0xedff('0x57')]({'where':{'id':_0x19ae5a[_0xedff('0x55')]['id']},'attributes':[_0xedff('0x76')]})[_0xedff('0x1f')](respondWithResult(_0x424bb6,null))['catch'](handleError(_0x424bb6,null));};exports[_0xedff('0x77')]=function(_0x4e773a,_0xea8ded,_0x501dbc){if(_0x4e773a['file']&&_0x4e773a['file'][_0xedff('0x5c')]){_0x4e773a[_0xedff('0x59')][_0xedff('0x61')]=_0x4e773a[_0xedff('0x5b')][_0xedff('0x5c')];}return db[_0xedff('0x39')][_0xedff('0x57')]({'where':{'id':_0x4e773a[_0xedff('0x55')]['id']}})['then'](handleEntityNotFound(_0xea8ded,null))[_0xedff('0x1f')](saveUpdates(_0x4e773a[_0xedff('0x59')],null))[_0xedff('0x1f')](respondWithResult(_0xea8ded,null))[_0xedff('0x53')](handleError(_0xea8ded,null));};var utilLicense=require(_0xedff('0x1a'));exports[_0xedff('0x78')]=function(_0x553eeb,_0xcdf306,_0x489159){var _0x4ebe99='server/files/images/logos';var _0x2b48be={'custom':![]};return utilLicense[_0xedff('0x72')]()[_0xedff('0x1f')](function(_0x3a4cc6){if(_0x3a4cc6){_0x2b48be=_0x3a4cc6;}return db[_0xedff('0x39')][_0xedff('0x57')]({'where':{'id':_0x553eeb[_0xedff('0x55')]['id']},'attributes':['logo',_0xedff('0x5e'),_0xedff('0x61'),'favicon',_0xedff('0x63'),_0xedff('0x64'),_0xedff('0x65'),_0xedff('0x66')],'raw':!![]});})[_0xedff('0x1f')](handleEntityNotFound(_0xcdf306,null))[_0xedff('0x1f')](function(_0x515fb4){if(_0x515fb4){var _0x590cd3=_0x515fb4['preferred']&&fs[_0xedff('0x67')](path[_0xedff('0x68')](config[_0xedff('0x69')],_0x4ebe99,_['toLower'](_0x515fb4[_0xedff('0x61')])))?path[_0xedff('0x68')](config[_0xedff('0x69')],_0x4ebe99,_[_0xedff('0x6a')](_0x515fb4[_0xedff('0x61')])):path[_0xedff('0x68')](config[_0xedff('0x69')],_0x4ebe99,_['toLower'](_0xedff('0x79')));var _0x142240=_0xedff('0x73')+_['upperFirst'](_0xedff('0x61'));if(_0x515fb4[_0x142240]||!_0x2b48be[_0xedff('0x6c')]||!_0x2b48be['preferred']){_0x590cd3=path[_0xedff('0x68')](config['root'],_0x4ebe99,_[_0xedff('0x6a')](_0xedff('0x79')));}if(!fs[_0xedff('0x67')](_0x590cd3)){throw new db['Sequelize'][(_0xedff('0x6e'))](_['upperFirst'](_0xedff('0x61'))+_0xedff('0x6f'));}return _0xcdf306[_0xedff('0x70')](_0x590cd3);}})[_0xedff('0x53')](handleError(_0xcdf306,null));};exports[_0xedff('0x7a')]=function(_0x35b783,_0x86f2d8,_0x28742c){if(_0x35b783['file']&&_0x35b783[_0xedff('0x5b')][_0xedff('0x5c')]){_0x35b783[_0xedff('0x59')][_0xedff('0x62')]=_0x35b783['file'][_0xedff('0x5c')];}return db[_0xedff('0x39')]['find']({'where':{'id':_0x35b783[_0xedff('0x55')]['id']}})['then'](handleEntityNotFound(_0x86f2d8,null))[_0xedff('0x1f')](saveUpdates(_0x35b783[_0xedff('0x59')],null))[_0xedff('0x1f')](respondWithResult(_0x86f2d8,null))[_0xedff('0x53')](handleError(_0x86f2d8,null));};var utilLicense=require(_0xedff('0x1a'));exports[_0xedff('0x7b')]=function(_0x4d2c7a,_0x59e5b7,_0x494eb6){var _0x11439f='server/files/images/logos';var _0x2b4463={'custom':![]};return utilLicense[_0xedff('0x72')]()[_0xedff('0x1f')](function(_0x585ab6){if(_0x585ab6){_0x2b4463=_0x585ab6;}return db[_0xedff('0x39')][_0xedff('0x57')]({'where':{'id':_0x4d2c7a[_0xedff('0x55')]['id']},'attributes':[_0xedff('0x60'),_0xedff('0x5e'),_0xedff('0x61'),_0xedff('0x62'),'defaultLogo',_0xedff('0x64'),_0xedff('0x65'),_0xedff('0x66')],'raw':!![]});})[_0xedff('0x1f')](handleEntityNotFound(_0x59e5b7,null))['then'](function(_0x4d044d){if(_0x4d044d){var _0x4962=_0x4d044d['favicon']&&fs[_0xedff('0x67')](path[_0xedff('0x68')](config[_0xedff('0x69')],_0x11439f,_[_0xedff('0x6a')](_0x4d044d[_0xedff('0x62')])))?path[_0xedff('0x68')](config[_0xedff('0x69')],_0x11439f,_['toLower'](_0x4d044d['favicon'])):path['join'](config[_0xedff('0x69')],_0x11439f,_[_0xedff('0x6a')]('default_favicon.ico'));var _0xa13f53=_0xedff('0x73')+_[_0xedff('0x6b')](_0xedff('0x62'));if(_0x4d044d[_0xa13f53]||!_0x2b4463[_0xedff('0x6c')]){_0x4962=path[_0xedff('0x68')](config[_0xedff('0x69')],_0x11439f,_[_0xedff('0x6a')]('default_favicon.ico'));}if(!fs[_0xedff('0x67')](_0x4962)){throw new db[(_0xedff('0x74'))][(_0xedff('0x6e'))](_[_0xedff('0x6b')](_0xedff('0x62'))+_0xedff('0x6f'));}return _0x59e5b7[_0xedff('0x70')](_0x4962);}})[_0xedff('0x53')](handleError(_0x59e5b7,null));};exports[_0xedff('0x7c')]=function(_0x16583b,_0x2cfdec){var _0x43637f={'offset':moment()['utcOffset']()};_0x43637f[_0xedff('0x7d')]=moment()[_0xedff('0x7e')](_0x43637f[_0xedff('0x2a')])[_0xedff('0x7f')](_0xedff('0x80'));return _0x2cfdec[_0xedff('0x29')](0xc8)[_0xedff('0x36')](_0x43637f);}; \ No newline at end of file +var _0x0f9f=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','json','offset','undefined','count','limit','set','update','destroy','end','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','rows','show','params','include','body','find','addLogo','file','logo','addLogoLogin','filename','getLogo','server/files/images/logos','getLicense','loginLogo','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','download','getLogoLogin','preferred','defaultPreferred','default_loginLogo.svg','\x20not\x20found','gdpr','getPreferred','default_preferred.png','addFavicon','default_favicon.ico','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring'];(function(_0x17ea69,_0x35616f){var _0x29c7eb=function(_0x52932f){while(--_0x52932f){_0x17ea69['push'](_0x17ea69['shift']());}};_0x29c7eb(++_0x35616f);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x46f868,_0x51a8c9){_0x46f868=_0x46f868-0x0;var _0xec84dc=_0x0f9f[_0x46f868];return _0xec84dc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf0f9('0x0'));var zipdir=require(_0xf0f9('0x1'));var jsonpatch=require(_0xf0f9('0x2'));var rp=require('request-promise');var moment=require(_0xf0f9('0x3'));var BPromise=require(_0xf0f9('0x4'));var Mustache=require(_0xf0f9('0x5'));var util=require(_0xf0f9('0x6'));var path=require(_0xf0f9('0x7'));var sox=require(_0xf0f9('0x8'));var csv=require(_0xf0f9('0x9'));var ejs=require(_0xf0f9('0xa'));var fs=require('fs');var fs_extra=require(_0xf0f9('0xb'));var _=require(_0xf0f9('0xc'));var squel=require('squel');var crypto=require(_0xf0f9('0xd'));var jsforce=require(_0xf0f9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf0f9('0x9'));var querystring=require(_0xf0f9('0xf'));var Papa=require(_0xf0f9('0x10'));var Redis=require('ioredis');var authService=require(_0xf0f9('0x11'));var qs=require(_0xf0f9('0x12'));var as=require(_0xf0f9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf0f9('0x14'));var utils=require(_0xf0f9('0x15'));var config=require(_0xf0f9('0x16'));var licenseUtil=require(_0xf0f9('0x17'));var db=require(_0xf0f9('0x18'))['db'];var jayson=require(_0xf0f9('0x19'));var client=jayson[_0xf0f9('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2910f2,_0x297fe1,_0x30bdaa,_0x200514){return new BPromise(function(_0x524169,_0x51d78a){var _0x459c76=_0x200514||client;return _0x459c76[_0xf0f9('0x1b')](_0x2910f2,_0x30bdaa)[_0xf0f9('0x1c')](function(_0x2e2955){logger[_0xf0f9('0x1d')](_0xf0f9('0x1e'),_0x297fe1,_0xf0f9('0x1f'));logger[_0xf0f9('0x20')](_0xf0f9('0x21'),_0x297fe1,_0xf0f9('0x1f'),JSON['stringify'](_0x2e2955));if(_0x2e2955['error']){if(_0x2e2955[_0xf0f9('0x22')][_0xf0f9('0x23')]===0x1f4){logger['error'](_0xf0f9('0x1e'),_0x297fe1,_0x2e2955['error']['message']);return _0x51d78a(_0x2e2955[_0xf0f9('0x22')][_0xf0f9('0x24')]);}logger[_0xf0f9('0x22')](_0xf0f9('0x1e'),_0x297fe1,_0x2e2955[_0xf0f9('0x22')]['message']);return _0x524169(_0x2e2955['error']['message']);}else{logger[_0xf0f9('0x1d')](_0xf0f9('0x1e'),_0x297fe1,_0xf0f9('0x1f'));_0x524169(_0x2e2955['result']['message']);}})[_0xf0f9('0x25')](function(_0x550728){logger[_0xf0f9('0x22')](_0xf0f9('0x1e'),_0x297fe1,_0x550728);_0x51d78a(_0x550728);});});}function respondWithStatusCode(_0x173c79,_0x570c68){_0x570c68=_0x570c68||0xcc;return function(_0x33dfca){if(_0x33dfca){return _0x173c79[_0xf0f9('0x26')](_0x570c68);}return _0x173c79[_0xf0f9('0x27')](_0x570c68)['end']();};}function respondWithResult(_0x384594,_0x33f070){_0x33f070=_0x33f070||0xc8;return function(_0x2879a2){if(_0x2879a2){return _0x384594[_0xf0f9('0x27')](_0x33f070)[_0xf0f9('0x28')](_0x2879a2);}};}function respondWithFilteredResult(_0x19d750,_0x5df7f5){return function(_0x28e1f6){if(_0x28e1f6){var _0x56663e=typeof _0x5df7f5[_0xf0f9('0x29')]===_0xf0f9('0x2a')&&typeof _0x5df7f5['limit']==='undefined';var _0x119793=_0x28e1f6['count'];var _0x2121b8=_0x56663e?0x0:_0x5df7f5[_0xf0f9('0x29')];var _0x269e47=_0x56663e?_0x28e1f6[_0xf0f9('0x2b')]:_0x5df7f5[_0xf0f9('0x29')]+_0x5df7f5[_0xf0f9('0x2c')];var _0x1377ed;if(_0x269e47>=_0x119793){_0x269e47=_0x119793;_0x1377ed=0xc8;}else{_0x1377ed=0xce;}_0x19d750[_0xf0f9('0x27')](_0x1377ed);return _0x19d750[_0xf0f9('0x2d')]('Content-Range',_0x2121b8+'-'+_0x269e47+'/'+_0x119793)[_0xf0f9('0x28')](_0x28e1f6);}return null;};}function patchUpdates(_0x28da31){return function(_0x534083){try{jsonpatch['apply'](_0x534083,_0x28da31,!![]);}catch(_0x49ce78){return BPromise['reject'](_0x49ce78);}return _0x534083['save']();};}function saveUpdates(_0x14f3cb,_0x490e91){return function(_0x31b6c4){if(_0x31b6c4){return _0x31b6c4[_0xf0f9('0x2e')](_0x14f3cb)['then'](function(_0x5b0df0){return _0x5b0df0;});}return null;};}function removeEntity(_0x436422,_0x5721a){return function(_0x3393bd){if(_0x3393bd){return _0x3393bd[_0xf0f9('0x2f')]()[_0xf0f9('0x1c')](function(){_0x436422[_0xf0f9('0x27')](0xcc)[_0xf0f9('0x30')]();});}};}function handleEntityNotFound(_0x30bc8e,_0x3c92f7){return function(_0xaf9500){if(!_0xaf9500){_0x30bc8e[_0xf0f9('0x26')](0x194);}return _0xaf9500;};}function handleError(_0x365f03,_0x286226){_0x286226=_0x286226||0x1f4;return function(_0x5a8b35){logger[_0xf0f9('0x22')](_0x5a8b35['stack']);if(_0x5a8b35[_0xf0f9('0x31')]){delete _0x5a8b35[_0xf0f9('0x31')];}_0x365f03[_0xf0f9('0x27')](_0x286226)[_0xf0f9('0x32')](_0x5a8b35);};}exports[_0xf0f9('0x33')]=function(_0x5ac68b,_0x1028a6){var _0x5e09ec={},_0x5c09ea={},_0x1188e1={'count':0x0,'rows':[]};var _0x3b37c2=_[_0xf0f9('0x34')](db[_0xf0f9('0x35')][_0xf0f9('0x36')],function(_0x4ac1d2){return{'name':_0x4ac1d2[_0xf0f9('0x37')],'type':_0x4ac1d2[_0xf0f9('0x38')][_0xf0f9('0x39')]};});_0x5c09ea[_0xf0f9('0x3a')]=_[_0xf0f9('0x34')](_0x3b37c2,'name');_0x5c09ea[_0xf0f9('0x3b')]=_[_0xf0f9('0x3c')](_0x5ac68b[_0xf0f9('0x3b')]);_0x5c09ea[_0xf0f9('0x3d')]=_[_0xf0f9('0x3e')](_0x5c09ea[_0xf0f9('0x3a')],_0x5c09ea['query']);_0x5e09ec[_0xf0f9('0x3f')]=_[_0xf0f9('0x3e')](_0x5c09ea[_0xf0f9('0x3a')],qs['fields'](_0x5ac68b[_0xf0f9('0x3b')][_0xf0f9('0x40')]));_0x5e09ec[_0xf0f9('0x3f')]=_0x5e09ec[_0xf0f9('0x3f')][_0xf0f9('0x41')]?_0x5e09ec[_0xf0f9('0x3f')]:_0x5c09ea[_0xf0f9('0x3a')];if(!_0x5ac68b[_0xf0f9('0x3b')][_0xf0f9('0x42')](_0xf0f9('0x43'))){_0x5e09ec[_0xf0f9('0x2c')]=qs[_0xf0f9('0x2c')](_0x5ac68b[_0xf0f9('0x3b')]['limit']);_0x5e09ec['offset']=qs[_0xf0f9('0x29')](_0x5ac68b['query']['offset']);}_0x5e09ec['order']=qs[_0xf0f9('0x44')](_0x5ac68b[_0xf0f9('0x3b')][_0xf0f9('0x44')]);_0x5e09ec[_0xf0f9('0x45')]=qs[_0xf0f9('0x3d')](_[_0xf0f9('0x46')](_0x5ac68b[_0xf0f9('0x3b')],_0x5c09ea[_0xf0f9('0x3d')]),_0x3b37c2);if(_0x5ac68b[_0xf0f9('0x3b')]['filter']){_0x5e09ec[_0xf0f9('0x45')]=_[_0xf0f9('0x47')](_0x5e09ec[_0xf0f9('0x45')],{'$or':_['map'](_0x3b37c2,function(_0x33d76f){if(_0x33d76f[_0xf0f9('0x38')]!==_0xf0f9('0x48')){var _0x4b0208={};_0x4b0208[_0x33d76f[_0xf0f9('0x31')]]={'$like':'%'+_0x5ac68b[_0xf0f9('0x3b')]['filter']+'%'};return _0x4b0208;}})});}_0x5e09ec=_[_0xf0f9('0x47')]({},_0x5e09ec,_0x5ac68b[_0xf0f9('0x49')]);var _0x1230e1={'where':_0x5e09ec[_0xf0f9('0x45')]};return db['Setting'][_0xf0f9('0x2b')](_0x1230e1)[_0xf0f9('0x1c')](function(_0xc29196){_0x1188e1[_0xf0f9('0x2b')]=_0xc29196;if(_0x5ac68b[_0xf0f9('0x3b')][_0xf0f9('0x4a')]){_0x5e09ec['include']=[{'all':!![]}];}return db[_0xf0f9('0x35')]['findAll'](_0x5e09ec);})[_0xf0f9('0x1c')](function(_0x38956b){_0x1188e1[_0xf0f9('0x4b')]=_0x38956b;return _0x1188e1;})[_0xf0f9('0x1c')](respondWithFilteredResult(_0x1028a6,_0x5e09ec))[_0xf0f9('0x25')](handleError(_0x1028a6,null));};exports[_0xf0f9('0x4c')]=function(_0x42c4ba,_0x443068){var _0x1f47fa={'raw':![],'where':{'id':_0x42c4ba[_0xf0f9('0x4d')]['id']}},_0x13bb13={};_0x13bb13[_0xf0f9('0x3a')]=_[_0xf0f9('0x3c')](db[_0xf0f9('0x35')][_0xf0f9('0x36')]);_0x13bb13[_0xf0f9('0x3b')]=_[_0xf0f9('0x3c')](_0x42c4ba[_0xf0f9('0x3b')]);_0x13bb13[_0xf0f9('0x3d')]=_[_0xf0f9('0x3e')](_0x13bb13[_0xf0f9('0x3a')],_0x13bb13[_0xf0f9('0x3b')]);_0x1f47fa[_0xf0f9('0x3f')]=_[_0xf0f9('0x3e')](_0x13bb13['model'],qs['fields'](_0x42c4ba[_0xf0f9('0x3b')]['fields']));_0x1f47fa[_0xf0f9('0x3f')]=_0x1f47fa[_0xf0f9('0x3f')][_0xf0f9('0x41')]?_0x1f47fa['attributes']:_0x13bb13[_0xf0f9('0x3a')];if(_0x42c4ba['query'][_0xf0f9('0x4a')]){_0x1f47fa[_0xf0f9('0x4e')]=[{'all':!![]}];}_0x1f47fa=_[_0xf0f9('0x47')]({},_0x1f47fa,_0x42c4ba[_0xf0f9('0x49')]);return db[_0xf0f9('0x35')]['find'](_0x1f47fa)[_0xf0f9('0x1c')](handleEntityNotFound(_0x443068,null))['then'](respondWithResult(_0x443068,null))[_0xf0f9('0x25')](handleError(_0x443068,null));};exports[_0xf0f9('0x2e')]=function(_0xb3467e,_0x43b402){if(_0xb3467e[_0xf0f9('0x4f')]['id']){delete _0xb3467e['body']['id'];}return db[_0xf0f9('0x35')][_0xf0f9('0x50')]({'where':{'id':_0xb3467e[_0xf0f9('0x4d')]['id']}})[_0xf0f9('0x1c')](handleEntityNotFound(_0x43b402,null))[_0xf0f9('0x1c')](saveUpdates(_0xb3467e[_0xf0f9('0x4f')],null))[_0xf0f9('0x1c')](respondWithResult(_0x43b402,null))[_0xf0f9('0x25')](handleError(_0x43b402,null));};exports[_0xf0f9('0x51')]=function(_0x406b45,_0x2884f1,_0x19e15a){if(_0x406b45[_0xf0f9('0x52')]&&_0x406b45[_0xf0f9('0x52')]['filename']){_0x406b45[_0xf0f9('0x4f')][_0xf0f9('0x53')]=_0x406b45[_0xf0f9('0x52')]['filename'];}return db[_0xf0f9('0x35')][_0xf0f9('0x50')]({'where':{'id':_0x406b45[_0xf0f9('0x4d')]['id']}})[_0xf0f9('0x1c')](handleEntityNotFound(_0x2884f1,null))[_0xf0f9('0x1c')](saveUpdates(_0x406b45['body'],null))[_0xf0f9('0x1c')](respondWithResult(_0x2884f1,null))[_0xf0f9('0x25')](handleError(_0x2884f1,null));};exports[_0xf0f9('0x54')]=function(_0x2f3cfb,_0x2807f9,_0x445c85){if(_0x2f3cfb[_0xf0f9('0x52')]&&_0x2f3cfb[_0xf0f9('0x52')][_0xf0f9('0x55')]){_0x2f3cfb[_0xf0f9('0x4f')]['loginLogo']=_0x2f3cfb[_0xf0f9('0x52')][_0xf0f9('0x55')];}return db['Setting'][_0xf0f9('0x50')]({'where':{'id':_0x2f3cfb['params']['id']}})[_0xf0f9('0x1c')](handleEntityNotFound(_0x2807f9,null))[_0xf0f9('0x1c')](saveUpdates(_0x2f3cfb[_0xf0f9('0x4f')],null))['then'](respondWithResult(_0x2807f9,null))[_0xf0f9('0x25')](handleError(_0x2807f9,null));};var utilLicense=require(_0xf0f9('0x17'));exports[_0xf0f9('0x56')]=function(_0x142984,_0x60dcbc,_0xbca4b3){var _0xdb0e6c=_0xf0f9('0x57');var _0x1ab0ed={'custom':![]};return utilLicense[_0xf0f9('0x58')]()[_0xf0f9('0x1c')](function(_0x162305){if(_0x162305){_0x1ab0ed=_0x162305;}return db['Setting'][_0xf0f9('0x50')]({'where':{'id':_0x142984[_0xf0f9('0x4d')]['id']},'attributes':[_0xf0f9('0x53'),_0xf0f9('0x59'),'preferred',_0xf0f9('0x5a'),_0xf0f9('0x5b'),_0xf0f9('0x5c'),'defaultPreferred',_0xf0f9('0x5d')],'raw':!![]});})[_0xf0f9('0x1c')](handleEntityNotFound(_0x60dcbc,null))['then'](function(_0x1a23f2){if(_0x1a23f2){var _0x405c38=_0x1a23f2['logo']&&fs[_0xf0f9('0x5e')](path[_0xf0f9('0x5f')](config[_0xf0f9('0x60')],_0xdb0e6c,_[_0xf0f9('0x61')](_0x1a23f2[_0xf0f9('0x53')])))?path[_0xf0f9('0x5f')](config[_0xf0f9('0x60')],_0xdb0e6c,_['toLower'](_0x1a23f2[_0xf0f9('0x53')])):path[_0xf0f9('0x5f')](config['root'],_0xdb0e6c,_[_0xf0f9('0x61')](_0xf0f9('0x62')));var _0x5bb76b=_0xf0f9('0x63')+_[_0xf0f9('0x64')]('logo');if(_0x1a23f2[_0x5bb76b]||!_0x1ab0ed[_0xf0f9('0x65')]){_0x405c38=path['join'](config[_0xf0f9('0x60')],_0xdb0e6c,_[_0xf0f9('0x61')](_0xf0f9('0x62')));}if(!fs['existsSync'](_0x405c38)){throw new db[(_0xf0f9('0x66'))][(_0xf0f9('0x67'))](_[_0xf0f9('0x64')](_0xf0f9('0x53'))+'\x20not\x20found');}return _0x60dcbc[_0xf0f9('0x68')](_0x405c38);}})[_0xf0f9('0x25')](handleError(_0x60dcbc,null));};var utilLicense=require(_0xf0f9('0x17'));exports[_0xf0f9('0x69')]=function(_0x3f7f16,_0x3652d6,_0x567e42){var _0x451346=_0xf0f9('0x57');var _0x12bfb0={'custom':![]};return utilLicense[_0xf0f9('0x58')]()['then'](function(_0x28c540){if(_0x28c540){_0x12bfb0=_0x28c540;}return db['Setting'][_0xf0f9('0x50')]({'where':{'id':_0x3f7f16[_0xf0f9('0x4d')]['id']},'attributes':[_0xf0f9('0x53'),_0xf0f9('0x59'),_0xf0f9('0x6a'),_0xf0f9('0x5a'),_0xf0f9('0x5b'),_0xf0f9('0x5c'),_0xf0f9('0x6b'),_0xf0f9('0x5d')],'raw':!![]});})[_0xf0f9('0x1c')](handleEntityNotFound(_0x3652d6,null))[_0xf0f9('0x1c')](function(_0x5323cd){if(_0x5323cd){var _0x27c566=_0x5323cd[_0xf0f9('0x59')]&&fs['existsSync'](path[_0xf0f9('0x5f')](config[_0xf0f9('0x60')],_0x451346,_['toLower'](_0x5323cd['loginLogo'])))?path[_0xf0f9('0x5f')](config[_0xf0f9('0x60')],_0x451346,_[_0xf0f9('0x61')](_0x5323cd[_0xf0f9('0x59')])):path[_0xf0f9('0x5f')](config[_0xf0f9('0x60')],_0x451346,_['toLower'](_0xf0f9('0x6c')));var _0x3aa811=_0xf0f9('0x63')+_[_0xf0f9('0x64')](_0xf0f9('0x59'));if(_0x5323cd[_0x3aa811]||!_0x12bfb0[_0xf0f9('0x65')]){_0x27c566=path[_0xf0f9('0x5f')](config[_0xf0f9('0x60')],_0x451346,_['toLower'](_0xf0f9('0x6c')));}if(!fs[_0xf0f9('0x5e')](_0x27c566)){throw new db[(_0xf0f9('0x66'))][(_0xf0f9('0x67'))](_['upperFirst']('loginLogo')+_0xf0f9('0x6d'));}return _0x3652d6[_0xf0f9('0x68')](_0x27c566);}})['catch'](handleError(_0x3652d6,null));};exports[_0xf0f9('0x6e')]=function(_0x2ff5e4,_0x891be1){return db['Setting'][_0xf0f9('0x50')]({'where':{'id':_0x2ff5e4[_0xf0f9('0x4d')]['id']},'attributes':['securePassword']})[_0xf0f9('0x1c')](respondWithResult(_0x891be1,null))[_0xf0f9('0x25')](handleError(_0x891be1,null));};exports['addPreferred']=function(_0x1b9ad3,_0xb3ab9b,_0x338e66){if(_0x1b9ad3[_0xf0f9('0x52')]&&_0x1b9ad3['file'][_0xf0f9('0x55')]){_0x1b9ad3[_0xf0f9('0x4f')][_0xf0f9('0x6a')]=_0x1b9ad3['file']['filename'];}return db[_0xf0f9('0x35')]['find']({'where':{'id':_0x1b9ad3[_0xf0f9('0x4d')]['id']}})[_0xf0f9('0x1c')](handleEntityNotFound(_0xb3ab9b,null))[_0xf0f9('0x1c')](saveUpdates(_0x1b9ad3[_0xf0f9('0x4f')],null))[_0xf0f9('0x1c')](respondWithResult(_0xb3ab9b,null))[_0xf0f9('0x25')](handleError(_0xb3ab9b,null));};var utilLicense=require(_0xf0f9('0x17'));exports[_0xf0f9('0x6f')]=function(_0x2108b8,_0x501935,_0x2f91d8){var _0x2729cb=_0xf0f9('0x57');var _0x2ac9ea={'custom':![]};return utilLicense[_0xf0f9('0x58')]()[_0xf0f9('0x1c')](function(_0x48420a){if(_0x48420a){_0x2ac9ea=_0x48420a;}return db[_0xf0f9('0x35')]['find']({'where':{'id':_0x2108b8[_0xf0f9('0x4d')]['id']},'attributes':[_0xf0f9('0x53'),_0xf0f9('0x59'),_0xf0f9('0x6a'),_0xf0f9('0x5a'),_0xf0f9('0x5b'),_0xf0f9('0x5c'),'defaultPreferred',_0xf0f9('0x5d')],'raw':!![]});})['then'](handleEntityNotFound(_0x501935,null))['then'](function(_0x2e908b){if(_0x2e908b){var _0x4da812=_0x2e908b[_0xf0f9('0x6a')]&&fs[_0xf0f9('0x5e')](path['join'](config[_0xf0f9('0x60')],_0x2729cb,_[_0xf0f9('0x61')](_0x2e908b[_0xf0f9('0x6a')])))?path[_0xf0f9('0x5f')](config[_0xf0f9('0x60')],_0x2729cb,_[_0xf0f9('0x61')](_0x2e908b[_0xf0f9('0x6a')])):path[_0xf0f9('0x5f')](config[_0xf0f9('0x60')],_0x2729cb,_[_0xf0f9('0x61')](_0xf0f9('0x70')));var _0x48a9b8=_0xf0f9('0x63')+_[_0xf0f9('0x64')]('preferred');if(_0x2e908b[_0x48a9b8]||!_0x2ac9ea[_0xf0f9('0x65')]||!_0x2ac9ea[_0xf0f9('0x6a')]){_0x4da812=path[_0xf0f9('0x5f')](config[_0xf0f9('0x60')],_0x2729cb,_[_0xf0f9('0x61')]('default_preferred.png'));}if(!fs[_0xf0f9('0x5e')](_0x4da812)){throw new db[(_0xf0f9('0x66'))]['ValidationError'](_[_0xf0f9('0x64')]('preferred')+'\x20not\x20found');}return _0x501935[_0xf0f9('0x68')](_0x4da812);}})['catch'](handleError(_0x501935,null));};exports[_0xf0f9('0x71')]=function(_0x5492e3,_0x1dfd92,_0x3c07e8){if(_0x5492e3['file']&&_0x5492e3[_0xf0f9('0x52')][_0xf0f9('0x55')]){_0x5492e3[_0xf0f9('0x4f')][_0xf0f9('0x5a')]=_0x5492e3[_0xf0f9('0x52')][_0xf0f9('0x55')];}return db[_0xf0f9('0x35')]['find']({'where':{'id':_0x5492e3[_0xf0f9('0x4d')]['id']}})[_0xf0f9('0x1c')](handleEntityNotFound(_0x1dfd92,null))[_0xf0f9('0x1c')](saveUpdates(_0x5492e3[_0xf0f9('0x4f')],null))['then'](respondWithResult(_0x1dfd92,null))['catch'](handleError(_0x1dfd92,null));};var utilLicense=require(_0xf0f9('0x17'));exports['getFavicon']=function(_0xd5a465,_0x59bda0,_0x57c458){var _0x41ecf7=_0xf0f9('0x57');var _0x10f131={'custom':![]};return utilLicense[_0xf0f9('0x58')]()[_0xf0f9('0x1c')](function(_0x4ec0ea){if(_0x4ec0ea){_0x10f131=_0x4ec0ea;}return db[_0xf0f9('0x35')][_0xf0f9('0x50')]({'where':{'id':_0xd5a465['params']['id']},'attributes':[_0xf0f9('0x53'),_0xf0f9('0x59'),_0xf0f9('0x6a'),'favicon',_0xf0f9('0x5b'),_0xf0f9('0x5c'),_0xf0f9('0x6b'),_0xf0f9('0x5d')],'raw':!![]});})[_0xf0f9('0x1c')](handleEntityNotFound(_0x59bda0,null))[_0xf0f9('0x1c')](function(_0x5eaa6d){if(_0x5eaa6d){var _0x2c24e7=_0x5eaa6d[_0xf0f9('0x5a')]&&fs['existsSync'](path[_0xf0f9('0x5f')](config['root'],_0x41ecf7,_[_0xf0f9('0x61')](_0x5eaa6d[_0xf0f9('0x5a')])))?path['join'](config[_0xf0f9('0x60')],_0x41ecf7,_[_0xf0f9('0x61')](_0x5eaa6d[_0xf0f9('0x5a')])):path[_0xf0f9('0x5f')](config[_0xf0f9('0x60')],_0x41ecf7,_[_0xf0f9('0x61')](_0xf0f9('0x72')));var _0xfdf5d2='default'+_[_0xf0f9('0x64')](_0xf0f9('0x5a'));if(_0x5eaa6d[_0xfdf5d2]||!_0x10f131['custom']){_0x2c24e7=path[_0xf0f9('0x5f')](config[_0xf0f9('0x60')],_0x41ecf7,_[_0xf0f9('0x61')](_0xf0f9('0x72')));}if(!fs[_0xf0f9('0x5e')](_0x2c24e7)){throw new db['Sequelize'][(_0xf0f9('0x67'))](_[_0xf0f9('0x64')](_0xf0f9('0x5a'))+_0xf0f9('0x6d'));}return _0x59bda0[_0xf0f9('0x68')](_0x2c24e7);}})[_0xf0f9('0x25')](handleError(_0x59bda0,null));};exports['getDate']=function(_0x294f68,_0x364349){var _0x2c61d5={'offset':moment()['utcOffset']()};_0x2c61d5[_0xf0f9('0x73')]=moment()[_0xf0f9('0x74')](_0x2c61d5[_0xf0f9('0x29')])[_0xf0f9('0x75')](_0xf0f9('0x76'));return _0x364349['status'](0xc8)[_0xf0f9('0x32')](_0x2c61d5);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index d81d167..4da2d38 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 _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x420f2a,_0x2cc58d){var _0x28f802=function(_0x3329cc){while(--_0x3329cc){_0x420f2a['push'](_0x420f2a['shift']());}};_0x28f802(++_0x2cc58d);}(_0x55ca,0x126));var _0xa55c=function(_0xfd5f37,_0x24a79c){_0xfd5f37=_0xfd5f37-0x0;var _0x11bd01=_0x55ca[_0xfd5f37];return _0x11bd01;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x44ae0b,_0x3e9865){var _0x69232a=function(_0x5ae588){while(--_0x5ae588){_0x44ae0b['push'](_0x44ae0b['shift']());}};_0x69232a(++_0x3e9865);}(_0x3e74,0x175));var _0x43e7=function(_0x4e59c5,_0x59799d){_0x4e59c5=_0x4e59c5-0x0;var _0x30111a=_0x3e74[_0x4e59c5];return _0x30111a;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index f950775..bb68794 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 _0x4f61=['ShowSetting','Setting','find','options','raw','where','include','map','model','attributes','then','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','info','result'];(function(_0x507f46,_0xda9145){var _0x5b80d5=function(_0x4ff360){while(--_0x4ff360){_0x507f46['push'](_0x507f46['shift']());}};_0x5b80d5(++_0xda9145);}(_0x4f61,0x185));var _0x14f6=function(_0x38320d,_0x212a29){_0x38320d=_0x38320d-0x0;var _0x5207a3=_0x4f61[_0x38320d];return _0x5207a3;};'use strict';var _=require('lodash');var util=require(_0x14f6('0x0'));var moment=require(_0x14f6('0x1'));var BPromise=require(_0x14f6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x14f6('0x3'));var db=require(_0x14f6('0x4'))['db'];var utils=require(_0x14f6('0x5'));var logger=require('../../config/logger')(_0x14f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x14f6('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5a522d,_0x56fcfa,_0x291c97){return new BPromise(function(_0x883a16,_0x5eb625){return client['request'](_0x5a522d,_0x291c97)['then'](function(_0xd53e8b){logger['info'](_0x14f6('0x8'),_0x56fcfa,_0x14f6('0x9'));logger[_0x14f6('0xa')](_0x14f6('0xb'),_0x56fcfa,_0x14f6('0x9'),JSON['stringify'](_0xd53e8b));if(_0xd53e8b[_0x14f6('0xc')]){if(_0xd53e8b[_0x14f6('0xc')][_0x14f6('0xd')]===0x1f4){logger[_0x14f6('0xc')](_0x14f6('0x8'),_0x56fcfa,_0xd53e8b[_0x14f6('0xc')]['message']);return _0x5eb625(_0xd53e8b['error']['message']);}logger[_0x14f6('0xc')](_0x14f6('0x8'),_0x56fcfa,_0xd53e8b[_0x14f6('0xc')][_0x14f6('0xe')]);return _0x883a16(_0xd53e8b[_0x14f6('0xc')]['message']);}else{logger[_0x14f6('0xf')](_0x14f6('0x8'),_0x56fcfa,_0x14f6('0x9'));_0x883a16(_0xd53e8b[_0x14f6('0x10')][_0x14f6('0xe')]);}})['catch'](function(_0x2e697d){logger['error'](_0x14f6('0x8'),_0x56fcfa,_0x2e697d);_0x5eb625(_0x2e697d);});});}exports[_0x14f6('0x11')]=function(_0xefff7c){var _0x3fbeed=this;return new Promise(function(_0x260964,_0x42877f){return db[_0x14f6('0x12')][_0x14f6('0x13')]({'raw':_0xefff7c[_0x14f6('0x14')]?_0xefff7c[_0x14f6('0x14')][_0x14f6('0x15')]===undefined?!![]:![]:!![],'where':_0xefff7c[_0x14f6('0x14')]?_0xefff7c[_0x14f6('0x14')][_0x14f6('0x16')]||null:null,'attributes':_0xefff7c['options']?_0xefff7c[_0x14f6('0x14')]['attributes']||null:null,'include':_0xefff7c[_0x14f6('0x14')]?_0xefff7c[_0x14f6('0x14')][_0x14f6('0x17')]?_[_0x14f6('0x18')](_0xefff7c[_0x14f6('0x14')][_0x14f6('0x17')],function(_0x23cb0f){return{'model':db[_0x23cb0f[_0x14f6('0x19')]],'as':_0x23cb0f['as'],'attributes':_0x23cb0f[_0x14f6('0x1a')],'include':_0x23cb0f[_0x14f6('0x17')]?_[_0x14f6('0x18')](_0x23cb0f[_0x14f6('0x17')],function(_0x25604a){return{'model':db[_0x25604a[_0x14f6('0x19')]],'as':_0x25604a['as'],'attributes':_0x25604a[_0x14f6('0x1a')],'include':_0x25604a['include']?_[_0x14f6('0x18')](_0x25604a[_0x14f6('0x17')],function(_0x5d916f){return{'model':db[_0x5d916f[_0x14f6('0x19')]],'as':_0x5d916f['as'],'attributes':_0x5d916f[_0x14f6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x14f6('0x1b')](function(_0x513d08){logger['info'](_0x14f6('0x11'),_0xefff7c);logger['debug'](_0x14f6('0x11'),_0xefff7c,JSON['stringify'](_0x513d08));_0x260964(_0x513d08);})[_0x14f6('0x1c')](function(_0x3e84b0){logger[_0x14f6('0xc')](_0x14f6('0x11'),_0x3e84b0[_0x14f6('0xe')],_0xefff7c);_0x42877f(_0x3fbeed[_0x14f6('0xc')](0x1f4,_0x3e84b0['message']));});});}; \ No newline at end of file +var _0x7d1f=['options','raw','where','attributes','include','map','model','ShowSetting','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','Setting'];(function(_0x5afdc0,_0x8624aa){var _0x1a2a9f=function(_0x3fb888){while(--_0x3fb888){_0x5afdc0['push'](_0x5afdc0['shift']());}};_0x1a2a9f(++_0x8624aa);}(_0x7d1f,0x173));var _0xf7d1=function(_0x259389,_0x41aa28){_0x259389=_0x259389-0x0;var _0x291756=_0x7d1f[_0x259389];return _0x291756;};'use strict';var _=require(_0xf7d1('0x0'));var util=require(_0xf7d1('0x1'));var moment=require(_0xf7d1('0x2'));var BPromise=require('bluebird');var rs=require(_0xf7d1('0x3'));var fs=require('fs');var Redis=require(_0xf7d1('0x4'));var db=require(_0xf7d1('0x5'))['db'];var utils=require(_0xf7d1('0x6'));var logger=require(_0xf7d1('0x7'))(_0xf7d1('0x8'));var config=require(_0xf7d1('0x9'));var jayson=require(_0xf7d1('0xa'));var client=jayson[_0xf7d1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x108304,_0x519c51,_0x53ce35){return new BPromise(function(_0x53cd98,_0x87af52){return client[_0xf7d1('0xc')](_0x108304,_0x53ce35)[_0xf7d1('0xd')](function(_0x3e8a9c){logger[_0xf7d1('0xe')](_0xf7d1('0xf'),_0x519c51,_0xf7d1('0x10'));logger[_0xf7d1('0x11')]('Setting,\x20%s,\x20%s,\x20%s',_0x519c51,_0xf7d1('0x10'),JSON[_0xf7d1('0x12')](_0x3e8a9c));if(_0x3e8a9c[_0xf7d1('0x13')]){if(_0x3e8a9c['error'][_0xf7d1('0x14')]===0x1f4){logger['error'](_0xf7d1('0xf'),_0x519c51,_0x3e8a9c[_0xf7d1('0x13')]['message']);return _0x87af52(_0x3e8a9c['error']['message']);}logger[_0xf7d1('0x13')](_0xf7d1('0xf'),_0x519c51,_0x3e8a9c[_0xf7d1('0x13')][_0xf7d1('0x15')]);return _0x53cd98(_0x3e8a9c[_0xf7d1('0x13')][_0xf7d1('0x15')]);}else{logger[_0xf7d1('0xe')](_0xf7d1('0xf'),_0x519c51,'request\x20sent');_0x53cd98(_0x3e8a9c[_0xf7d1('0x16')][_0xf7d1('0x15')]);}})[_0xf7d1('0x17')](function(_0x468a16){logger['error']('Setting,\x20%s,\x20%s',_0x519c51,_0x468a16);_0x87af52(_0x468a16);});});}exports['ShowSetting']=function(_0x57cedf){var _0x3ade39=this;return new Promise(function(_0x451e5d,_0x2f0893){return db[_0xf7d1('0x18')]['find']({'raw':_0x57cedf[_0xf7d1('0x19')]?_0x57cedf['options'][_0xf7d1('0x1a')]===undefined?!![]:![]:!![],'where':_0x57cedf[_0xf7d1('0x19')]?_0x57cedf[_0xf7d1('0x19')][_0xf7d1('0x1b')]||null:null,'attributes':_0x57cedf[_0xf7d1('0x19')]?_0x57cedf['options'][_0xf7d1('0x1c')]||null:null,'include':_0x57cedf[_0xf7d1('0x19')]?_0x57cedf['options'][_0xf7d1('0x1d')]?_[_0xf7d1('0x1e')](_0x57cedf[_0xf7d1('0x19')][_0xf7d1('0x1d')],function(_0x487019){return{'model':db[_0x487019['model']],'as':_0x487019['as'],'attributes':_0x487019[_0xf7d1('0x1c')],'include':_0x487019[_0xf7d1('0x1d')]?_['map'](_0x487019[_0xf7d1('0x1d')],function(_0x39e1f3){return{'model':db[_0x39e1f3[_0xf7d1('0x1f')]],'as':_0x39e1f3['as'],'attributes':_0x39e1f3[_0xf7d1('0x1c')],'include':_0x39e1f3[_0xf7d1('0x1d')]?_[_0xf7d1('0x1e')](_0x39e1f3[_0xf7d1('0x1d')],function(_0x2681a9){return{'model':db[_0x2681a9['model']],'as':_0x2681a9['as'],'attributes':_0x2681a9[_0xf7d1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf7d1('0xd')](function(_0x564b2e){logger[_0xf7d1('0xe')](_0xf7d1('0x20'),_0x57cedf);logger[_0xf7d1('0x11')]('ShowSetting',_0x57cedf,JSON['stringify'](_0x564b2e));_0x451e5d(_0x564b2e);})[_0xf7d1('0x17')](function(_0x3eb084){logger[_0xf7d1('0x13')](_0xf7d1('0x20'),_0x3eb084[_0xf7d1('0x15')],_0x57cedf);_0x2f0893(_0x3ade39[_0xf7d1('0x13')](0x1f4,_0x3eb084[_0xf7d1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 5914cb9..014f482 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 _0x7217=['/:id/send','status','put','update','delete','removeDispositions','removeAnswers','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','create','post','/:id/notify','notify','addApplications'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x7217,0x19e));var _0x7721=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x7217[_0x4cf98e];return _0x1623ac;};'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['getApplications']);router[_0x7721('0x8')](_0x7721('0x14'),auth['isAuthenticated'](),controller[_0x7721('0x15')]);router[_0x7721('0x8')](_0x7721('0x16'),controller[_0x7721('0x17')]);router['get'](_0x7721('0x18'),auth[_0x7721('0x9')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x1a')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller['addDisposition']);router[_0x7721('0x1a')]('/:id/canned_answers',auth[_0x7721('0x9')](),controller['addAnswer']);router[_0x7721('0x1a')](_0x7721('0x1b'),controller[_0x7721('0x1c')]);router[_0x7721('0x1a')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1d')]);router[_0x7721('0x1a')](_0x7721('0x1e'),auth[_0x7721('0x9')](),controller['send']);router[_0x7721('0x1a')](_0x7721('0x16'),controller[_0x7721('0x1f')]);router[_0x7721('0x1a')]('/:id/users',auth[_0x7721('0x9')](),controller['addAgents']);router[_0x7721('0x20')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0x21')]);router[_0x7721('0x22')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller['destroy']);router[_0x7721('0x22')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller[_0x7721('0x23')]);router[_0x7721('0x22')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x24')]);router[_0x7721('0x22')]('/:id/users',auth[_0x7721('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x8ef6=['addApplications','/:id/send','send','status','update','delete','destroy','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/status','statusGet','/:id/users','getAgents','create','post','addDisposition','addAnswer','notify'];(function(_0x5202dd,_0x3b33b8){var _0x9d2389=function(_0x3dc229){while(--_0x3dc229){_0x5202dd['push'](_0x5202dd['shift']());}};_0x9d2389(++_0x3b33b8);}(_0x8ef6,0xf2));var _0x68ef=function(_0xf561b0,_0x570fb4){_0xf561b0=_0xf561b0-0x0;var _0x4614cb=_0x8ef6[_0xf561b0];return _0x4614cb;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var fs_extra=require(_0x68ef('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var controller=require(_0x68ef('0x9'));router[_0x68ef('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x68ef('0xa')](_0x68ef('0xb'),auth[_0x68ef('0xc')](),controller['describe']);router[_0x68ef('0xa')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0xe')]);router[_0x68ef('0xa')](_0x68ef('0xf'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x10')]);router[_0x68ef('0xa')](_0x68ef('0x11'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x12')]);router['get'](_0x68ef('0x13'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x14')]);router[_0x68ef('0xa')](_0x68ef('0x15'),auth[_0x68ef('0xc')](),controller['getInteractions']);router[_0x68ef('0xa')](_0x68ef('0x16'),controller[_0x68ef('0x17')]);router['get'](_0x68ef('0x18'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x19')]);router['post']('/',auth[_0x68ef('0xc')](),controller[_0x68ef('0x1a')]);router[_0x68ef('0x1b')](_0x68ef('0xf'),auth['isAuthenticated'](),controller[_0x68ef('0x1c')]);router['post']('/:id/canned_answers',auth[_0x68ef('0xc')](),controller[_0x68ef('0x1d')]);router['post']('/:id/notify',controller[_0x68ef('0x1e')]);router[_0x68ef('0x1b')](_0x68ef('0x13'),auth['isAuthenticated'](),controller[_0x68ef('0x1f')]);router[_0x68ef('0x1b')](_0x68ef('0x20'),auth['isAuthenticated'](),controller[_0x68ef('0x21')]);router[_0x68ef('0x1b')]('/:id/status',controller[_0x68ef('0x22')]);router[_0x68ef('0x1b')](_0x68ef('0x18'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x23')]);router[_0x68ef('0x24')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x25')]);router[_0x68ef('0x24')](_0x68ef('0xf'),auth[_0x68ef('0xc')](),controller['removeDispositions']);router[_0x68ef('0x24')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0x68ef('0x24')](_0x68ef('0x18'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x26')]);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 6a2a4af..b278f71 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 _0x3cdf=['mandatoryDisposition','exports','STRING','name','ENUM','twilio','clicksend','plivo','clickatell','bandwidth','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0xbdf961,_0x5157cb){var _0x2fba0e=function(_0x2d7d53){while(--_0x2d7d53){_0xbdf961['push'](_0xbdf961['shift']());}};_0x2fba0e(++_0x5157cb);}(_0x3cdf,0x122));var _0xf3cd=function(_0x50e117,_0x21aa13){_0x50e117=_0x50e117-0x0;var _0x44bd14=_0x3cdf[_0x50e117];return _0x44bd14;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xf3cd('0x0')]={'name':{'type':Sequelize[_0xf3cd('0x1')],'unique':_0xf3cd('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xf3cd('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0xf3cd('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0xf3cd('0x1')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xf3cd('0x1')]},'type':{'type':Sequelize[_0xf3cd('0x3')](_0xf3cd('0x4'),'skebby','connectel',_0xf3cd('0x5'),_0xf3cd('0x6'),_0xf3cd('0x7'),_0xf3cd('0x8'),'csc','infobip','intelepeer')},'accountSid':{'type':Sequelize[_0xf3cd('0x1')]},'authId':{'type':Sequelize[_0xf3cd('0x1')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xf3cd('0x3')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xf3cd('0x1')]},'applicationId':{'type':Sequelize[_0xf3cd('0x1')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xf3cd('0x1')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xf3cd('0x1')]},'notificationTemplate':{'type':Sequelize[_0xf3cd('0x9')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xf3cd('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf3cd('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf3cd('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf3cd('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf3cd('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf3cd('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xf3cd('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf3cd('0xb')],'comment':_0xf3cd('0xc')},'mandatoryDisposition':{'type':Sequelize[_0xf3cd('0xa')],'defaultValue':![],'comment':_0xf3cd('0xd'),'set':function(_0x33b5b6){if(!_0x33b5b6)this[_0xf3cd('0xe')](_0xf3cd('0xf'),null);this[_0xf3cd('0xe')](_0xf3cd('0x10'),_0x33b5b6);}}}; \ No newline at end of file +var _0x52fa=['STRING','name','generate','twilio','skebby','clicksend','clickatell','bandwidth','csc','intelepeer','ENUM','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0xc0bf56,_0x476134){var _0x43ff64=function(_0x173815){while(--_0x173815){_0xc0bf56['push'](_0xc0bf56['shift']());}};_0x43ff64(++_0x476134);}(_0x52fa,0x1b7));var _0xa52f=function(_0x2d3176,_0x2a4c30){_0x2d3176=_0x2d3176-0x0;var _0xa50450=_0x52fa[_0x2d3176];return _0xa50450;};'use strict';var Sequelize=require(_0xa52f('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xa52f('0x1')],'unique':_0xa52f('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xa52f('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0xa52f('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0xa52f('0x1')],'defaultValue':function(){return rs[_0xa52f('0x3')]();}},'phone':{'type':Sequelize[_0xa52f('0x1')]},'type':{'type':Sequelize['ENUM'](_0xa52f('0x4'),_0xa52f('0x5'),'connectel',_0xa52f('0x6'),'plivo',_0xa52f('0x7'),_0xa52f('0x8'),_0xa52f('0x9'),'infobip',_0xa52f('0xa'))},'accountSid':{'type':Sequelize[_0xa52f('0x1')]},'authId':{'type':Sequelize[_0xa52f('0x1')]},'authToken':{'type':Sequelize[_0xa52f('0x1')]},'smsMethod':{'type':Sequelize[_0xa52f('0xb')]('SI','TI','GP')},'username':{'type':Sequelize[_0xa52f('0x1')]},'password':{'type':Sequelize[_0xa52f('0x1')]},'apiKey':{'type':Sequelize[_0xa52f('0x1')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0xa52f('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0xa52f('0x1')]},'notificationTemplate':{'type':Sequelize[_0xa52f('0xd')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa52f('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa52f('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa52f('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xa52f('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xa52f('0xf')},'mandatoryDisposition':{'type':Sequelize[_0xa52f('0xc')],'defaultValue':![],'comment':_0xa52f('0x10'),'set':function(_0x48f688){if(!_0x48f688)this[_0xa52f('0x11')](_0xa52f('0x12'),null);this[_0xa52f('0x11')](_0xa52f('0x13'),_0x48f688);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 0df454c..7428c3e 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 _0xa144=['getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','destroy','SmsAccounts','UserProfileResource','name','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','options','SmsAccount','includeAll','include','rows','catch','show','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','params','describe','addDisposition','SmsAccountId','getDispositions','findOne','Disposition','length','sort','findAll','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','sms','SmsApplication','Applications','account','applications','orderBy','CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','sender','text','clicksend','message_id','plivo','Text','results','csc','originatingAddress','clickatell','fromNumber','intelepeer','refid','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','omit','SmsInteraction','spread','interaction','created','autoclose','push','unmanaged','*,*,*,*','SmsMessage','AttachmentId','UserId','User','unshift','agent','Start','startRouting','receiveMessage','Content-Type','text/xml','send','\x0a','addApplications','transaction','bulkCreate','priority','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','inspect','skebby','skebby_dispatch_id','connectel','requestid','statusInt','status_code','infobip','groupName','bandwidth','redif','error_code','DELIVERED','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','emit','removeAgents','isArray','userSmsAccount:remove'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xa144,0x1bf));var _0x4a14=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa144[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x4a14('0x0'));var rimraf=require(_0x4a14('0x1'));var zipdir=require(_0x4a14('0x2'));var jsonpatch=require(_0x4a14('0x3'));var rp=require(_0x4a14('0x4'));var moment=require('moment');var BPromise=require(_0x4a14('0x5'));var Mustache=require(_0x4a14('0x6'));var util=require(_0x4a14('0x7'));var path=require(_0x4a14('0x8'));var sox=require(_0x4a14('0x9'));var csv=require(_0x4a14('0xa'));var ejs=require(_0x4a14('0xb'));var fs=require('fs');var fs_extra=require(_0x4a14('0xc'));var _=require(_0x4a14('0xd'));var squel=require(_0x4a14('0xe'));var crypto=require('crypto');var jsforce=require(_0x4a14('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x4a14('0xa'));var querystring=require('querystring');var Papa=require(_0x4a14('0x10'));var Redis=require('ioredis');var authService=require(_0x4a14('0x11'));var qs=require(_0x4a14('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4a14('0x13'));var logger=require(_0x4a14('0x14'))(_0x4a14('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4a14('0x16'));var db=require(_0x4a14('0x17'))['db'];config[_0x4a14('0x18')]=_[_0x4a14('0x19')](config[_0x4a14('0x18')],{'host':_0x4a14('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4a14('0x18')]));require('./smsAccount.socket')[_0x4a14('0x1b')](socket);var jayson=require(_0x4a14('0x1c'));var client=jayson[_0x4a14('0x1d')][_0x4a14('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x303a16,_0x4090a7,_0x1188cd,_0x32656a){return new BPromise(function(_0x50c0e6,_0x21fd7f){var _0x562777=_0x32656a||client;return _0x562777[_0x4a14('0x1f')](_0x303a16,_0x1188cd)[_0x4a14('0x20')](function(_0x49131f){logger[_0x4a14('0x21')](_0x4a14('0x22'),_0x4090a7,_0x4a14('0x23'));logger[_0x4a14('0x24')](_0x4a14('0x25'),_0x4090a7,_0x4a14('0x23'),JSON[_0x4a14('0x26')](_0x49131f));if(_0x49131f[_0x4a14('0x27')]){if(_0x49131f[_0x4a14('0x27')][_0x4a14('0x28')]===0x1f4){logger[_0x4a14('0x27')](_0x4a14('0x22'),_0x4090a7,_0x49131f[_0x4a14('0x27')]['message']);return _0x21fd7f(_0x49131f['error'][_0x4a14('0x29')]);}logger[_0x4a14('0x27')]('SmsAccount,\x20%s,\x20%s',_0x4090a7,_0x49131f['error'][_0x4a14('0x29')]);return _0x50c0e6(_0x49131f[_0x4a14('0x27')][_0x4a14('0x29')]);}else{logger[_0x4a14('0x21')]('SmsAccount,\x20%s,\x20%s',_0x4090a7,_0x4a14('0x23'));_0x50c0e6(_0x49131f['result'][_0x4a14('0x29')]);}})['catch'](function(_0x5b6bcb){logger[_0x4a14('0x27')](_0x4a14('0x22'),_0x4090a7,_0x5b6bcb);_0x21fd7f(_0x5b6bcb);});});}function respondWithStatusCode(_0x54fc86,_0x118dbd){_0x118dbd=_0x118dbd||0xcc;return function(_0x584457){if(_0x584457){return _0x54fc86[_0x4a14('0x2a')](_0x118dbd);}return _0x54fc86[_0x4a14('0x2b')](_0x118dbd)[_0x4a14('0x2c')]();};}function respondWithResult(_0x1dca0a,_0x3b92ea){_0x3b92ea=_0x3b92ea||0xc8;return function(_0x19c993){if(_0x19c993){return _0x1dca0a['status'](_0x3b92ea)[_0x4a14('0x2d')](_0x19c993);}};}function respondWithFilteredResult(_0x215268,_0xed62dd){return function(_0x5aa5b6){if(_0x5aa5b6){var _0x3d8f0d=typeof _0xed62dd[_0x4a14('0x2e')]===_0x4a14('0x2f')&&typeof _0xed62dd[_0x4a14('0x30')]===_0x4a14('0x2f');var _0x40239e=_0x5aa5b6[_0x4a14('0x31')];var _0x2294fa=_0x3d8f0d?0x0:_0xed62dd[_0x4a14('0x2e')];var _0x140efa=_0x3d8f0d?_0x5aa5b6[_0x4a14('0x31')]:_0xed62dd[_0x4a14('0x2e')]+_0xed62dd[_0x4a14('0x30')];var _0x15fbd5;if(_0x140efa>=_0x40239e){_0x140efa=_0x40239e;_0x15fbd5=0xc8;}else{_0x15fbd5=0xce;}_0x215268['status'](_0x15fbd5);return _0x215268['set']('Content-Range',_0x2294fa+'-'+_0x140efa+'/'+_0x40239e)['json'](_0x5aa5b6);}return null;};}function patchUpdates(_0x14a30a){return function(_0x424068){try{jsonpatch[_0x4a14('0x32')](_0x424068,_0x14a30a,!![]);}catch(_0x52b6c5){return BPromise[_0x4a14('0x33')](_0x52b6c5);}return _0x424068[_0x4a14('0x34')]();};}function saveUpdates(_0x3904c4,_0x4286c0){return function(_0x40ed09){if(_0x40ed09){return _0x40ed09[_0x4a14('0x35')](_0x3904c4)[_0x4a14('0x20')](function(_0x46cca9){return _0x46cca9;});}return null;};}function removeEntity(_0x4f1efe,_0x4b4aa6){return function(_0x1e7add){if(_0x1e7add){return _0x1e7add[_0x4a14('0x36')]()[_0x4a14('0x20')](function(){var _0x3dcc30=_0x1e7add['get']({'plain':!![]});var _0x8821bd=_0x4a14('0x37');return db[_0x4a14('0x38')][_0x4a14('0x36')]({'where':{'type':_0x8821bd,'resourceId':_0x3dcc30['id']}})[_0x4a14('0x20')](function(){return _0x1e7add;});})[_0x4a14('0x20')](function(){_0x4f1efe[_0x4a14('0x2b')](0xcc)[_0x4a14('0x2c')]();});}};}function handleEntityNotFound(_0x55858d,_0x2c5759){return function(_0x5938cf){if(!_0x5938cf){_0x55858d[_0x4a14('0x2a')](0x194);}return _0x5938cf;};}function handleError(_0x30b5ef,_0x293816){_0x293816=_0x293816||0x1f4;return function(_0x191f9e){logger[_0x4a14('0x27')](_0x191f9e['stack']);if(_0x191f9e[_0x4a14('0x39')]){delete _0x191f9e[_0x4a14('0x39')];}_0x30b5ef[_0x4a14('0x2b')](_0x293816)['send'](_0x191f9e);};}exports[_0x4a14('0x3a')]=function(_0x478a07,_0xadd059){var _0xfb70df={'include':[{'model':db[_0x4a14('0x3b')],'as':_0x4a14('0x3c')}]},_0x5ba385={},_0x41deef={'count':0x0,'rows':[]};var _0x31eaee=_[_0x4a14('0x3d')](db['SmsAccount'][_0x4a14('0x3e')],function(_0x109951){return{'name':_0x109951[_0x4a14('0x3f')],'type':_0x109951[_0x4a14('0x40')][_0x4a14('0x41')]};});_0x5ba385[_0x4a14('0x42')]=_[_0x4a14('0x3d')](_0x31eaee,'name');_0x5ba385[_0x4a14('0x43')]=_[_0x4a14('0x44')](_0x478a07[_0x4a14('0x43')]);_0x5ba385[_0x4a14('0x45')]=_[_0x4a14('0x46')](_0x5ba385['model'],_0x5ba385[_0x4a14('0x43')]);_0xfb70df[_0x4a14('0x47')]=_[_0x4a14('0x46')](_0x5ba385[_0x4a14('0x42')],qs[_0x4a14('0x48')](_0x478a07[_0x4a14('0x43')][_0x4a14('0x48')]));_0xfb70df[_0x4a14('0x47')]=_0xfb70df[_0x4a14('0x47')]['length']?_0xfb70df[_0x4a14('0x47')]:_0x5ba385[_0x4a14('0x42')];if(!_0x478a07[_0x4a14('0x43')][_0x4a14('0x49')](_0x4a14('0x4a'))){_0xfb70df[_0x4a14('0x30')]=qs['limit'](_0x478a07[_0x4a14('0x43')][_0x4a14('0x30')]);_0xfb70df[_0x4a14('0x2e')]=qs[_0x4a14('0x2e')](_0x478a07['query'][_0x4a14('0x2e')]);}_0xfb70df[_0x4a14('0x4b')]=qs['sort'](_0x478a07['query']['sort']);_0xfb70df[_0x4a14('0x4c')]=qs[_0x4a14('0x45')](_[_0x4a14('0x4d')](_0x478a07[_0x4a14('0x43')],_0x5ba385[_0x4a14('0x45')]),_0x31eaee);if(_0x478a07[_0x4a14('0x43')][_0x4a14('0x4e')]){_0xfb70df[_0x4a14('0x4c')]=_['merge'](_0xfb70df['where'],{'$or':_[_0x4a14('0x3d')](_0x31eaee,function(_0x51f078){if(_0x51f078['type']!==_0x4a14('0x4f')){var _0x335566={};_0x335566[_0x51f078[_0x4a14('0x39')]]={'$like':'%'+_0x478a07[_0x4a14('0x43')][_0x4a14('0x4e')]+'%'};return _0x335566;}})});}_0xfb70df=_[_0x4a14('0x50')]({},_0xfb70df,_0x478a07[_0x4a14('0x51')]);var _0x35a035={'where':_0xfb70df['where']};return db[_0x4a14('0x52')][_0x4a14('0x31')](_0x35a035)[_0x4a14('0x20')](function(_0x178355){_0x41deef[_0x4a14('0x31')]=_0x178355;if(_0x478a07['query'][_0x4a14('0x53')]){_0xfb70df[_0x4a14('0x54')]=[{'all':!![]}];}return db[_0x4a14('0x52')]['findAll'](_0xfb70df);})[_0x4a14('0x20')](function(_0x3468a5){_0x41deef[_0x4a14('0x55')]=_0x3468a5;return _0x41deef;})[_0x4a14('0x20')](respondWithFilteredResult(_0xadd059,_0xfb70df))[_0x4a14('0x56')](handleError(_0xadd059,null));};exports[_0x4a14('0x57')]=function(_0x27b739,_0x18b9ca){var _0x7a9790={'raw':![],'where':{'id':_0x27b739['params']['id']},'include':[{'model':db[_0x4a14('0x3b')],'as':_0x4a14('0x3c')}]},_0x5ccdea={};_0x5ccdea['model']=_[_0x4a14('0x44')](db[_0x4a14('0x52')]['rawAttributes']);_0x5ccdea[_0x4a14('0x43')]=_[_0x4a14('0x44')](_0x27b739[_0x4a14('0x43')]);_0x5ccdea[_0x4a14('0x45')]=_['intersection'](_0x5ccdea[_0x4a14('0x42')],_0x5ccdea[_0x4a14('0x43')]);_0x7a9790[_0x4a14('0x47')]=_[_0x4a14('0x46')](_0x5ccdea['model'],qs['fields'](_0x27b739[_0x4a14('0x43')][_0x4a14('0x48')]));_0x7a9790[_0x4a14('0x47')]=_0x7a9790[_0x4a14('0x47')]['length']?_0x7a9790[_0x4a14('0x47')]:_0x5ccdea[_0x4a14('0x42')];if(_0x27b739[_0x4a14('0x43')][_0x4a14('0x53')]){_0x7a9790[_0x4a14('0x54')]=[{'all':!![]}];}_0x7a9790=_[_0x4a14('0x50')]({},_0x7a9790,_0x27b739['options']);return db[_0x4a14('0x52')]['find'](_0x7a9790)[_0x4a14('0x20')](handleEntityNotFound(_0x18b9ca,null))[_0x4a14('0x20')](respondWithResult(_0x18b9ca,null))[_0x4a14('0x56')](handleError(_0x18b9ca,null));};exports[_0x4a14('0x58')]=function(_0x560208,_0x3afd4d){return db['SmsAccount']['create'](_0x560208[_0x4a14('0x59')],{})['then'](function(_0x417354){var _0x565130=_0x560208[_0x4a14('0x5a')][_0x4a14('0x5b')]({'plain':!![]});if(!_0x565130)throw new Error(_0x4a14('0x5c'));if(_0x565130[_0x4a14('0x5d')]==='user'){var _0x5e0509=_0x417354[_0x4a14('0x5b')]({'plain':!![]});var _0x5a7a18=_0x4a14('0x37');return db[_0x4a14('0x5e')][_0x4a14('0x5f')]({'where':{'name':_0x5a7a18,'userProfileId':_0x565130[_0x4a14('0x60')]},'raw':!![]})[_0x4a14('0x20')](function(_0x47e5b6){if(_0x47e5b6&&_0x47e5b6[_0x4a14('0x61')]===0x0){return db[_0x4a14('0x38')][_0x4a14('0x58')]({'name':_0x5e0509['name'],'resourceId':_0x5e0509['id'],'type':_0x47e5b6[_0x4a14('0x39')],'sectionId':_0x47e5b6['id']},{})[_0x4a14('0x20')](function(){return _0x417354;});}else{return _0x417354;}})[_0x4a14('0x56')](function(_0x2a256f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a256f);throw _0x2a256f;});}return _0x417354;})[_0x4a14('0x20')](respondWithResult(_0x3afd4d,0xc9))[_0x4a14('0x56')](handleError(_0x3afd4d,null));};exports[_0x4a14('0x35')]=function(_0x1617a7,_0x23e7e6){if(_0x1617a7['body']['id']){delete _0x1617a7['body']['id'];}return db['SmsAccount'][_0x4a14('0x5f')]({'where':{'id':_0x1617a7[_0x4a14('0x62')]['id']},'include':[{'model':db[_0x4a14('0x3b')],'as':_0x4a14('0x3c')}]})[_0x4a14('0x20')](handleEntityNotFound(_0x23e7e6,null))[_0x4a14('0x20')](saveUpdates(_0x1617a7[_0x4a14('0x59')],null))[_0x4a14('0x20')](respondWithResult(_0x23e7e6,null))[_0x4a14('0x56')](handleError(_0x23e7e6,null));};exports[_0x4a14('0x36')]=function(_0x517b66,_0x2181e0){return db[_0x4a14('0x52')][_0x4a14('0x5f')]({'where':{'id':_0x517b66[_0x4a14('0x62')]['id']}})[_0x4a14('0x20')](handleEntityNotFound(_0x2181e0,null))['then'](removeEntity(_0x2181e0,null))[_0x4a14('0x56')](handleError(_0x2181e0,null));};exports[_0x4a14('0x63')]=function(_0x2e867b,_0x2146fd){return db[_0x4a14('0x52')][_0x4a14('0x63')]()[_0x4a14('0x20')](respondWithResult(_0x2146fd,null))[_0x4a14('0x56')](handleError(_0x2146fd,null));};exports[_0x4a14('0x64')]=function(_0xe98619,_0xb0bd14,_0x1f11d5){if(_0xe98619['body']['id']){delete _0xe98619[_0x4a14('0x59')]['id'];}return db['SmsAccount'][_0x4a14('0x5f')]({'where':{'id':_0xe98619[_0x4a14('0x62')]['id']}})[_0x4a14('0x20')](handleEntityNotFound(_0xb0bd14,null))[_0x4a14('0x20')](function(_0x2a5e82){if(_0x2a5e82){_0xe98619[_0x4a14('0x59')][_0x4a14('0x65')]=_0x2a5e82['id'];return db['Disposition'][_0x4a14('0x58')](_0xe98619['body']);}})[_0x4a14('0x20')](respondWithResult(_0xb0bd14,null))[_0x4a14('0x56')](handleError(_0xb0bd14,null));};exports[_0x4a14('0x66')]=function(_0x2fcf94,_0x4db2e3,_0xd0e3fd){var _0x42715e={'raw':![],'where':{}};var _0x10be8f={};var _0x318bfc={'count':0x0,'rows':[]};return db['SmsAccount'][_0x4a14('0x67')]({'where':{'id':_0x2fcf94['params']['id']}})[_0x4a14('0x20')](handleEntityNotFound(_0x4db2e3,null))[_0x4a14('0x20')](function(_0x228390){if(_0x228390){_0x10be8f[_0x4a14('0x42')]=_[_0x4a14('0x44')](db[_0x4a14('0x68')][_0x4a14('0x3e')]);_0x10be8f[_0x4a14('0x43')]=_[_0x4a14('0x44')](_0x2fcf94[_0x4a14('0x43')]);_0x10be8f[_0x4a14('0x45')]=_[_0x4a14('0x46')](_0x10be8f[_0x4a14('0x42')],_0x10be8f[_0x4a14('0x43')]);_0x42715e[_0x4a14('0x47')]=_['intersection'](_0x10be8f[_0x4a14('0x42')],qs[_0x4a14('0x48')](_0x2fcf94[_0x4a14('0x43')][_0x4a14('0x48')]));_0x42715e[_0x4a14('0x47')]=_0x42715e[_0x4a14('0x47')][_0x4a14('0x69')]?_0x42715e[_0x4a14('0x47')]:_0x10be8f[_0x4a14('0x42')];if(!_0x2fcf94[_0x4a14('0x43')][_0x4a14('0x49')]('nolimit')){_0x42715e['limit']=qs[_0x4a14('0x30')](_0x2fcf94['query'][_0x4a14('0x30')]);_0x42715e[_0x4a14('0x2e')]=qs['offset'](_0x2fcf94[_0x4a14('0x43')]['offset']);}_0x42715e[_0x4a14('0x4b')]=qs[_0x4a14('0x6a')](_0x2fcf94['query'][_0x4a14('0x6a')]);_0x42715e['where']=qs['filters'](_['pick'](_0x2fcf94[_0x4a14('0x43')],_0x10be8f['filters']));_0x42715e[_0x4a14('0x4c')][_0x4a14('0x65')]=_0x228390['id'];if(_0x2fcf94[_0x4a14('0x43')][_0x4a14('0x4e')]){_0x42715e[_0x4a14('0x4c')]=_[_0x4a14('0x50')](_0x42715e[_0x4a14('0x4c')],{'$or':_['map'](_0x42715e[_0x4a14('0x47')],function(_0x28a7c3){var _0x38925f={};_0x38925f[_0x28a7c3]={'$like':'%'+_0x2fcf94[_0x4a14('0x43')]['filter']+'%'};return _0x38925f;})});}_0x42715e=_[_0x4a14('0x50')]({},_0x42715e,_0x2fcf94['options']);return db[_0x4a14('0x68')][_0x4a14('0x31')]({'where':_0x42715e['where']})[_0x4a14('0x20')](function(_0x532988){_0x318bfc[_0x4a14('0x31')]=_0x532988;if(_0x2fcf94[_0x4a14('0x43')][_0x4a14('0x53')]){_0x42715e[_0x4a14('0x54')]=[{'all':!![]}];}return db['Disposition'][_0x4a14('0x6b')](_0x42715e);})['then'](function(_0xa22ddf){_0x318bfc['rows']=_0xa22ddf;return _0x318bfc;});}})['then'](respondWithFilteredResult(_0x4db2e3,_0x42715e))['catch'](handleError(_0x4db2e3,null));};exports[_0x4a14('0x6c')]=function(_0x41ab48,_0x485fe6,_0x3594be){return db[_0x4a14('0x52')][_0x4a14('0x5f')]({'where':{'id':_0x41ab48['params']['id']}})[_0x4a14('0x20')](handleEntityNotFound(_0x485fe6,null))[_0x4a14('0x20')](function(_0x531929){if(_0x531929){return _0x531929[_0x4a14('0x6c')](_0x41ab48[_0x4a14('0x43')][_0x4a14('0x6d')]);}})[_0x4a14('0x20')](respondWithStatusCode(_0x485fe6,null))[_0x4a14('0x56')](handleError(_0x485fe6,null));};exports[_0x4a14('0x6e')]=function(_0x266c69,_0xe1973a,_0x4ff112){if(_0x266c69[_0x4a14('0x59')]['id']){delete _0x266c69[_0x4a14('0x59')]['id'];}return db[_0x4a14('0x52')][_0x4a14('0x5f')]({'where':{'id':_0x266c69['params']['id']}})[_0x4a14('0x20')](handleEntityNotFound(_0xe1973a,null))[_0x4a14('0x20')](function(_0x583ca4){if(_0x583ca4){_0x266c69[_0x4a14('0x59')][_0x4a14('0x65')]=_0x583ca4['id'];return db[_0x4a14('0x6f')][_0x4a14('0x58')](_0x266c69[_0x4a14('0x59')]);}})[_0x4a14('0x20')](respondWithResult(_0xe1973a,null))['catch'](handleError(_0xe1973a,null));};exports['getAnswers']=function(_0x45f8ab,_0x5ef2fb,_0x43b2de){var _0x1494ba={'raw':![],'where':{}};var _0x1ffee4={};var _0x346f4b={'count':0x0,'rows':[]};return db['SmsAccount'][_0x4a14('0x67')]({'where':{'id':_0x45f8ab[_0x4a14('0x62')]['id']}})['then'](handleEntityNotFound(_0x5ef2fb,null))[_0x4a14('0x20')](function(_0x3a6810){if(_0x3a6810){_0x1ffee4['model']=_[_0x4a14('0x44')](db[_0x4a14('0x6f')][_0x4a14('0x3e')]);_0x1ffee4[_0x4a14('0x43')]=_[_0x4a14('0x44')](_0x45f8ab[_0x4a14('0x43')]);_0x1ffee4['filters']=_['intersection'](_0x1ffee4['model'],_0x1ffee4[_0x4a14('0x43')]);_0x1494ba[_0x4a14('0x47')]=_['intersection'](_0x1ffee4[_0x4a14('0x42')],qs[_0x4a14('0x48')](_0x45f8ab[_0x4a14('0x43')]['fields']));_0x1494ba[_0x4a14('0x47')]=_0x1494ba[_0x4a14('0x47')][_0x4a14('0x69')]?_0x1494ba[_0x4a14('0x47')]:_0x1ffee4[_0x4a14('0x42')];if(!_0x45f8ab['query'][_0x4a14('0x49')](_0x4a14('0x4a'))){_0x1494ba[_0x4a14('0x30')]=qs[_0x4a14('0x30')](_0x45f8ab[_0x4a14('0x43')][_0x4a14('0x30')]);_0x1494ba[_0x4a14('0x2e')]=qs[_0x4a14('0x2e')](_0x45f8ab[_0x4a14('0x43')]['offset']);}_0x1494ba[_0x4a14('0x4b')]=qs[_0x4a14('0x6a')](_0x45f8ab[_0x4a14('0x43')][_0x4a14('0x6a')]);_0x1494ba[_0x4a14('0x4c')]=qs[_0x4a14('0x45')](_[_0x4a14('0x4d')](_0x45f8ab[_0x4a14('0x43')],_0x1ffee4['filters']));_0x1494ba[_0x4a14('0x4c')][_0x4a14('0x65')]=_0x3a6810['id'];if(_0x45f8ab[_0x4a14('0x43')][_0x4a14('0x4e')]){_0x1494ba[_0x4a14('0x4c')]=_[_0x4a14('0x50')](_0x1494ba[_0x4a14('0x4c')],{'$or':_[_0x4a14('0x3d')](_0x1494ba[_0x4a14('0x47')],function(_0x4c4943){var _0x29f1cf={};_0x29f1cf[_0x4c4943]={'$like':'%'+_0x45f8ab[_0x4a14('0x43')]['filter']+'%'};return _0x29f1cf;})});}_0x1494ba=_[_0x4a14('0x50')]({},_0x1494ba,_0x45f8ab[_0x4a14('0x51')]);return db[_0x4a14('0x6f')][_0x4a14('0x31')]({'where':_0x1494ba[_0x4a14('0x4c')]})['then'](function(_0x1315c9){_0x346f4b[_0x4a14('0x31')]=_0x1315c9;if(_0x45f8ab['query'][_0x4a14('0x53')]){_0x1494ba[_0x4a14('0x54')]=[{'all':!![]}];}return db['CannedAnswer'][_0x4a14('0x6b')](_0x1494ba);})[_0x4a14('0x20')](function(_0x267717){_0x346f4b['rows']=_0x267717;return _0x346f4b;});}})[_0x4a14('0x20')](respondWithFilteredResult(_0x5ef2fb,_0x1494ba))[_0x4a14('0x56')](handleError(_0x5ef2fb,null));};exports[_0x4a14('0x70')]=function(_0x4a1225,_0x3830a1,_0xbcaa00){return db['SmsAccount'][_0x4a14('0x5f')]({'where':{'id':_0x4a1225[_0x4a14('0x62')]['id']}})['then'](handleEntityNotFound(_0x3830a1,null))[_0x4a14('0x20')](function(_0x2f0c99){if(_0x2f0c99){return _0x2f0c99['removeAnswers'](_0x4a1225['query'][_0x4a14('0x6d')]);}})[_0x4a14('0x20')](respondWithStatusCode(_0x3830a1,null))['catch'](handleError(_0x3830a1,null));};exports['notify']=function(_0x40a2e5,_0x9377e3,_0x10982a){var _0x5dea66={'channel':_0x4a14('0x71')};var _0x426120=[];var _0x1c527f=[];var _0x264c0c={};return db['SmsAccount']['find']({'where':{'id':_0x40a2e5[_0x4a14('0x62')]['id']},'include':[{'model':db[_0x4a14('0x72')],'as':_0x4a14('0x73')}]})[_0x4a14('0x20')](handleEntityNotFound(_0x9377e3,null))[_0x4a14('0x20')](function(_0x204aae){_0x5dea66[_0x4a14('0x74')]=_0x204aae;_0x5dea66[_0x4a14('0x75')]=_[_0x4a14('0x76')](_0x204aae['Applications'],['priority'],['asc']);if(_0x5dea66[_0x4a14('0x74')]['Applications']){delete _0x5dea66[_0x4a14('0x74')][_0x4a14('0x73')];}return db[_0x4a14('0x77')][_0x4a14('0x63')]();})['then'](function(_0x5ac232){if(!_0x5ac232){throw new db['Sequelize'][(_0x4a14('0x78'))](_0x4a14('0x79'));}_0x426120=_[_0x4a14('0x7a')](_[_0x4a14('0x44')](_0x5ac232),['createdAt',_0x4a14('0x7b')]);_0x1c527f=_[_0x4a14('0x7a')](_[_0x4a14('0x44')](_0x5ac232),[_0x4a14('0x7c'),_0x4a14('0x7b'),_0x4a14('0x7d'),_0x4a14('0x7e')]);_0x5dea66[_0x4a14('0x59')]={'mapKey':_0x4a14('0x7f')};if(_0x5dea66[_0x4a14('0x74')][_0x4a14('0x40')]){switch(_0x5dea66['account'][_0x4a14('0x40')]){case _0x4a14('0x80'):_0x5dea66[_0x4a14('0x59')][_0x4a14('0x81')]=_0x40a2e5[_0x4a14('0x59')][_0x4a14('0x82')];_0x5dea66[_0x4a14('0x59')][_0x4a14('0x59')]=_0x40a2e5[_0x4a14('0x59')][_0x4a14('0x83')];_0x5dea66[_0x4a14('0x59')][_0x4a14('0x84')]=_0x40a2e5[_0x4a14('0x59')][_0x4a14('0x85')];break;case'skebby':_0x5dea66[_0x4a14('0x59')][_0x4a14('0x81')]='+'+_0x40a2e5[_0x4a14('0x59')][_0x4a14('0x86')];_0x5dea66[_0x4a14('0x59')]['body']=_0x40a2e5[_0x4a14('0x59')][_0x4a14('0x87')];break;case'connectel':_0x5dea66[_0x4a14('0x59')][_0x4a14('0x81')]=_0x40a2e5[_0x4a14('0x59')][_0x4a14('0x81')];_0x5dea66[_0x4a14('0x59')][_0x4a14('0x59')]=_0x40a2e5[_0x4a14('0x59')][_0x4a14('0x29')];break;case _0x4a14('0x88'):_0x5dea66['body'][_0x4a14('0x81')]=_0x40a2e5[_0x4a14('0x59')]['from'];_0x5dea66['body'][_0x4a14('0x59')]=_0x40a2e5[_0x4a14('0x59')][_0x4a14('0x59')];_0x5dea66[_0x4a14('0x59')][_0x4a14('0x84')]=_0x40a2e5[_0x4a14('0x59')][_0x4a14('0x89')];break;case _0x4a14('0x8a'):_0x5dea66[_0x4a14('0x59')][_0x4a14('0x81')]=_0x40a2e5[_0x4a14('0x59')]['From'];_0x5dea66['body'][_0x4a14('0x59')]=_0x40a2e5['body'][_0x4a14('0x8b')];_0x5dea66[_0x4a14('0x59')][_0x4a14('0x84')]=_0x40a2e5[_0x4a14('0x59')]['MessageUUID'];break;case'infobip':_0x5dea66[_0x4a14('0x59')][_0x4a14('0x81')]='+'+_0x40a2e5[_0x4a14('0x59')][_0x4a14('0x8c')][0x0][_0x4a14('0x81')];_0x5dea66[_0x4a14('0x59')][_0x4a14('0x59')]=_0x40a2e5['body'][_0x4a14('0x8c')][0x0]['text'];_0x5dea66['body'][_0x4a14('0x84')]=_0x40a2e5[_0x4a14('0x59')][_0x4a14('0x8c')][0x0][_0x4a14('0x84')];break;case _0x4a14('0x8d'):_0x5dea66['body']['from']=_0x40a2e5[_0x4a14('0x59')][_0x4a14('0x8e')];_0x5dea66[_0x4a14('0x59')]['body']=_0x40a2e5[_0x4a14('0x59')]['segmentedMessage'][_0x4a14('0x29')];break;case _0x4a14('0x8f'):_0x5dea66[_0x4a14('0x59')]['from']=_0x40a2e5[_0x4a14('0x59')][_0x4a14('0x90')];_0x5dea66[_0x4a14('0x59')][_0x4a14('0x59')]=_0x40a2e5[_0x4a14('0x59')][_0x4a14('0x87')];_0x5dea66[_0x4a14('0x59')][_0x4a14('0x84')]=_0x40a2e5['body']['replyMessageId'];break;case'bandwidth':_0x5dea66[_0x4a14('0x59')][_0x4a14('0x84')]=_0x40a2e5[_0x4a14('0x59')][0x0][_0x4a14('0x29')]['id'];_0x5dea66[_0x4a14('0x59')]['from']=_0x40a2e5[_0x4a14('0x59')][0x0]['message'][_0x4a14('0x81')];_0x5dea66['body'][_0x4a14('0x59')]=_0x40a2e5[_0x4a14('0x59')][0x0][_0x4a14('0x29')][_0x4a14('0x87')];break;case _0x4a14('0x91'):_0x5dea66['body'][_0x4a14('0x81')]=_0x40a2e5['body'][_0x4a14('0x81')];_0x5dea66['body'][_0x4a14('0x59')]=_0x40a2e5[_0x4a14('0x59')]['message'];_0x5dea66[_0x4a14('0x59')]['messageId']=_0x40a2e5[_0x4a14('0x59')][_0x4a14('0x92')];break;}}if(_0x5dea66[_0x4a14('0x59')]['id']){delete _0x5dea66[_0x4a14('0x59')]['id'];}if(_[_0x4a14('0x93')](_0x5dea66['body'][_0x4a14('0x81')])){throw new db[(_0x4a14('0x94'))]['ValidationError'](_0x4a14('0x95'));}if(_[_0x4a14('0x93')](_0x5dea66[_0x4a14('0x59')][_0x4a14('0x59')])||_0x5dea66[_0x4a14('0x59')][_0x4a14('0x59')]===''){throw new db[(_0x4a14('0x94'))]['ValidationError'](_0x4a14('0x96'));}if(_[_0x4a14('0x93')](_0x5dea66[_0x4a14('0x59')]['mapKey'])){throw new db[(_0x4a14('0x94'))]['ValidationError'](_0x4a14('0x97')+_0x1c527f);}if(!_['includes'](_0x1c527f,_0x5dea66[_0x4a14('0x59')][_0x4a14('0x98')])){throw new db[(_0x4a14('0x94'))][(_0x4a14('0x78'))](_0x4a14('0x99')+_0x1c527f);}_0x264c0c[_0x5dea66[_0x4a14('0x59')][_0x4a14('0x98')]]=_0x5dea66['body']['from'];return db[_0x4a14('0x9a')][_0x4a14('0x5f')]({'where':{'id':_0x5dea66[_0x4a14('0x74')][_0x4a14('0x7e')]},'include':[{'model':db[_0x4a14('0x77')],'as':_0x4a14('0x9b'),'where':_0x264c0c,'limit':0x1,'order':[[_0x4a14('0x7b'),_0x4a14('0x9c')]]}]});})[_0x4a14('0x20')](handleEntityNotFound(_0x9377e3,null))[_0x4a14('0x20')](function(_0x128a21){if(_0x128a21){_0x5dea66['list']=_[_0x4a14('0x9d')](_0x128a21,[_0x4a14('0x9b')]);if(_0x128a21[_0x4a14('0x9b')]['length']){return _0x128a21[_0x4a14('0x9b')][0x0];}var _0x1028ed=_[_0x4a14('0x19')](_0x5dea66[_0x4a14('0x59')],{'firstName':_0x5dea66[_0x4a14('0x59')][_0x4a14('0x81')],'ListId':_0x128a21['id']});_0x1028ed[_0x5dea66[_0x4a14('0x59')][_0x4a14('0x98')]]=_0x5dea66['body'][_0x4a14('0x81')];return db['CmContact'][_0x4a14('0x58')](_0x1028ed,{'fields':_0x426120,'raw':!![]});}})['then'](handleEntityNotFound(_0x9377e3,null))[_0x4a14('0x20')](function(_0x37c9ea){if(_0x37c9ea){_0x5dea66['contact']=_0x37c9ea;var _0x5d40a1={'ContactId':_0x37c9ea['id'],'phone':_0x5dea66[_0x4a14('0x59')][_0x4a14('0x81')],'SmsAccountId':_0x40a2e5['params']['id']};var _0x559728={'ContactId':_0x37c9ea['id'],'SmsAccountId':_0x40a2e5['params']['id'],'closed':![]};return db[_0x4a14('0x9e')][_0x4a14('0x5f')]({'where':_0x559728})[_0x4a14('0x20')](function(_0x2b52b2){if(_0x2b52b2){return[_0x2b52b2,![]];}return db[_0x4a14('0x9e')]['create'](_0x5d40a1)[_0x4a14('0x20')](function(_0x345514){return[_0x345514,!![]];});});}})[_0x4a14('0x9f')](function(_0x425d8a,_0x46f051){_0x5dea66[_0x4a14('0xa0')]=_0x425d8a[_0x4a14('0x5b')]({'plain':!![]});_0x5dea66[_0x4a14('0xa0')][_0x4a14('0xa1')]=![];if(_0x46f051){if(_0x5dea66[_0x4a14('0x74')][_0x4a14('0xa2')]){_0x5dea66['applications'][_0x4a14('0xa3')]({'id':0x0,'priority':_0x5dea66[_0x4a14('0x75')][_0x4a14('0x69')]+0x1,'app':'close','appdata':_0x4a14('0xa4'),'interval':_0x4a14('0xa5')});}_0x5dea66[_0x4a14('0xa0')]['created']=!![];}return db[_0x4a14('0xa6')]['create']({'phone':_0x5dea66[_0x4a14('0x59')][_0x4a14('0x81')],'messageId':_0x5dea66[_0x4a14('0x59')][_0x4a14('0x84')],'body':_0x5dea66[_0x4a14('0x59')]['body'],'SmsAccountId':_0x40a2e5[_0x4a14('0x62')]['id'],'SmsInteractionId':_0x425d8a['id'],'direction':'in','ContactId':_0x425d8a['ContactId'],'AttachmentId':_0x5dea66[_0x4a14('0x59')][_0x4a14('0xa7')]});})[_0x4a14('0x20')](function(_0x5be3bb){_0x5dea66[_0x4a14('0x29')]=_0x5be3bb;if(_0x5dea66[_0x4a14('0xa0')][_0x4a14('0xa8')]){return db[_0x4a14('0xa9')][_0x4a14('0x5f')]({'attributes':['id',_0x4a14('0x39')],'where':{'id':_0x5dea66[_0x4a14('0xa0')]['UserId']}})[_0x4a14('0x20')](function(_0x58357b){if(_0x58357b){_0x5dea66[_0x4a14('0x75')][_0x4a14('0xaa')]({'id':0x0,'priority':0x0,'app':_0x4a14('0xab'),'appdata':_0x58357b[_0x4a14('0x39')]+','+(_0x5dea66[_0x4a14('0x74')]['waitForTheAssignedAgent']||0xa),'interval':_0x4a14('0xa5')});}return respondWithRpcPromise(_0x4a14('0xac'),_0x4a14('0xad'),_0x5dea66);});}return respondWithRpcPromise(_0x4a14('0xac'),_0x4a14('0xad'),_0x5dea66);})[_0x4a14('0x20')](function(_0x19ac3a){if(_0x19ac3a){var _0x412b50=0xc8;var _0x182777=_0x4a14('0xae');logger[_0x4a14('0x21')](_0x4a14('0x25'),_0x182777,_0x412b50,'entity\x20found');logger[_0x4a14('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x182777,_0x412b50,'entity\x20found',JSON['stringify'](_0x19ac3a));if(_0x5dea66[_0x4a14('0x74')]['type']==='twilio'){return _0x9377e3[_0x4a14('0x2b')](_0x412b50)['set'](_0x4a14('0xaf'),_0x4a14('0xb0'))[_0x4a14('0xb1')](_0x4a14('0xb2'));}else{return _0x9377e3[_0x4a14('0x2b')](_0x412b50)['json'](_0x19ac3a);}}})['catch'](handleError(_0x9377e3,null));};exports[_0x4a14('0xb3')]=function(_0x5140d9,_0x416adc,_0x1683d2){return db[_0x4a14('0x52')][_0x4a14('0x67')]({'where':{'id':_0x5140d9[_0x4a14('0x62')]['id']}})['then'](handleEntityNotFound(_0x416adc,null))['then'](function(_0x478b6a){if(_0x478b6a){return db['sequelize'][_0x4a14('0xb4')](function(_0x20e16a){return db[_0x4a14('0x72')][_0x4a14('0x36')]({'where':{'SmsAccountId':_0x5140d9[_0x4a14('0x62')]['id']},'transaction':_0x20e16a})[_0x4a14('0x20')](function(_0x22552a){var _0x1e6dcd=_['map'](_0x5140d9[_0x4a14('0x59')],function(_0x156549){_0x156549[_0x4a14('0x65')]=_0x5140d9['params']['id'];return _0x156549;});return db[_0x4a14('0x72')][_0x4a14('0xb5')](_0x1e6dcd,{'transaction':_0x20e16a});});})[_0x4a14('0x20')](function(){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x5140d9[_0x4a14('0x62')]['id']},'order':_0x4a14('0xb6')});});}})[_0x4a14('0x20')](respondWithResult(_0x416adc,null))[_0x4a14('0x56')](handleError(_0x416adc,null));};exports[_0x4a14('0xb7')]=function(_0x206b88,_0x2f2960,_0x29be4d){var _0x480401={};var _0x33fcfb={};var _0x1b8419;var _0xa1907f;return db[_0x4a14('0x52')][_0x4a14('0x67')]({'where':{'id':_0x206b88[_0x4a14('0x62')]['id']}})['then'](handleEntityNotFound(_0x2f2960,null))[_0x4a14('0x20')](function(_0x3c6e0e){if(_0x3c6e0e){_0x1b8419=_0x3c6e0e;_0x33fcfb[_0x4a14('0x42')]=_[_0x4a14('0x44')](db['SmsApplication'][_0x4a14('0x3e')]);_0x33fcfb[_0x4a14('0x43')]=_['keys'](_0x206b88['query']);_0x33fcfb[_0x4a14('0x45')]=_[_0x4a14('0x46')](_0x33fcfb['model'],_0x33fcfb[_0x4a14('0x43')]);_0x480401['attributes']=_[_0x4a14('0x46')](_0x33fcfb['model'],qs['fields'](_0x206b88[_0x4a14('0x43')][_0x4a14('0x48')]));_0x480401['attributes']=_0x480401[_0x4a14('0x47')]['length']?_0x480401[_0x4a14('0x47')]:_0x33fcfb[_0x4a14('0x42')];_0x480401[_0x4a14('0x4b')]=qs[_0x4a14('0x6a')](_0x206b88[_0x4a14('0x43')][_0x4a14('0x6a')]);_0x480401[_0x4a14('0x4c')]=qs[_0x4a14('0x45')](_['pick'](_0x206b88[_0x4a14('0x43')],_0x33fcfb[_0x4a14('0x45')]));if(_0x206b88['query'][_0x4a14('0x4e')]){_0x480401[_0x4a14('0x4c')]=_[_0x4a14('0x50')](_0x480401[_0x4a14('0x4c')],{'$or':_[_0x4a14('0x3d')](_0x480401[_0x4a14('0x47')],function(_0xc696e2){var _0x2af42f={};_0x2af42f[_0xc696e2]={'$like':'%'+_0x206b88[_0x4a14('0x43')][_0x4a14('0x4e')]+'%'};return _0x2af42f;})});}_0x480401=_[_0x4a14('0x50')]({},_0x480401,_0x206b88[_0x4a14('0x51')]);return _0x1b8419[_0x4a14('0xb7')](_0x480401);}})[_0x4a14('0x20')](function(_0x14987f){if(_0x14987f){_0xa1907f=_0x14987f[_0x4a14('0x69')];if(!_0x206b88['query'][_0x4a14('0x49')](_0x4a14('0x4a'))){_0x480401[_0x4a14('0x30')]=qs[_0x4a14('0x30')](_0x206b88[_0x4a14('0x43')][_0x4a14('0x30')]);_0x480401['offset']=qs[_0x4a14('0x2e')](_0x206b88['query'][_0x4a14('0x2e')]);}return _0x1b8419[_0x4a14('0xb7')](_0x480401);}})['then'](function(_0x4d8348){if(_0x4d8348){return _0x4d8348?{'count':_0xa1907f,'rows':_0x4d8348}:null;}})[_0x4a14('0x20')](respondWithResult(_0x2f2960,null))[_0x4a14('0x56')](handleError(_0x2f2960,null));};exports[_0x4a14('0xb8')]=function(_0x3eeead,_0x4c1e70,_0x5ce8cf){var _0x4cfa2b={'raw':![],'where':{}};var _0x4cb708={};var _0x4f9f47={'count':0x0,'rows':[]};return db[_0x4a14('0x52')][_0x4a14('0x67')]({'where':{'id':_0x3eeead[_0x4a14('0x62')]['id']}})['then'](handleEntityNotFound(_0x4c1e70,null))[_0x4a14('0x20')](function(_0x53cad6){if(_0x53cad6){_0x4cb708[_0x4a14('0x42')]=_['keys'](db['SmsInteraction'][_0x4a14('0x3e')]);_0x4cb708['query']=_[_0x4a14('0x44')](_0x3eeead['query']);_0x4cb708['filters']=_[_0x4a14('0x46')](_0x4cb708[_0x4a14('0x42')],_0x4cb708['query']);_0x4cfa2b['attributes']=_[_0x4a14('0x46')](_0x4cb708[_0x4a14('0x42')],qs[_0x4a14('0x48')](_0x3eeead[_0x4a14('0x43')][_0x4a14('0x48')]));_0x4cfa2b[_0x4a14('0x47')]=_0x4cfa2b[_0x4a14('0x47')]['length']?_0x4cfa2b[_0x4a14('0x47')]:_0x4cb708['model'];if(!_0x3eeead[_0x4a14('0x43')]['hasOwnProperty']('nolimit')){_0x4cfa2b[_0x4a14('0x30')]=qs[_0x4a14('0x30')](_0x3eeead[_0x4a14('0x43')][_0x4a14('0x30')]);_0x4cfa2b['offset']=qs[_0x4a14('0x2e')](_0x3eeead[_0x4a14('0x43')][_0x4a14('0x2e')]);}_0x4cfa2b[_0x4a14('0x4b')]=qs['sort'](_0x3eeead[_0x4a14('0x43')][_0x4a14('0x6a')]);_0x4cfa2b[_0x4a14('0x4c')]=qs[_0x4a14('0x45')](_[_0x4a14('0x4d')](_0x3eeead['query'],_0x4cb708[_0x4a14('0x45')]));_0x4cfa2b[_0x4a14('0x4c')][_0x4a14('0x65')]=_0x53cad6['id'];if(_0x3eeead[_0x4a14('0x43')]['filter']){_0x4cfa2b['where']=_['merge'](_0x4cfa2b[_0x4a14('0x4c')],{'$or':_[_0x4a14('0x3d')](_0x4cfa2b[_0x4a14('0x47')],function(_0x342e47){var _0x245a88={};_0x245a88[_0x342e47]={'$like':'%'+_0x3eeead[_0x4a14('0x43')][_0x4a14('0x4e')]+'%'};return _0x245a88;})});}_0x4cfa2b=_[_0x4a14('0x50')]({},_0x4cfa2b,_0x3eeead[_0x4a14('0x51')]);return db[_0x4a14('0x9e')][_0x4a14('0x31')]({'where':_0x4cfa2b[_0x4a14('0x4c')]})[_0x4a14('0x20')](function(_0x1d13c2){_0x4f9f47[_0x4a14('0x31')]=_0x1d13c2;if(_0x3eeead[_0x4a14('0x43')][_0x4a14('0x53')]){_0x4cfa2b['include']=[{'model':db[_0x4a14('0x77')],'as':_0x4a14('0xb9'),'required':![]},{'model':db[_0x4a14('0xa9')],'as':_0x4a14('0xba'),'attributes':[_0x4a14('0x39'),_0x4a14('0xbb'),'internal'],'required':![]},{'model':db[_0x4a14('0xbc')],'as':_0x4a14('0xbd'),'attributes':['id',_0x4a14('0x39'),_0x4a14('0xbe')],'where':_0x3eeead[_0x4a14('0x43')][_0x4a14('0xbf')]?{'id':_0x3eeead[_0x4a14('0x43')][_0x4a14('0xbf')]}:undefined,'required':_0x3eeead[_0x4a14('0x43')]['tag']?!![]:![]}];}return db[_0x4a14('0x9e')][_0x4a14('0x6b')](_0x4cfa2b);})[_0x4a14('0x20')](function(_0x3a6658){_0x4f9f47['rows']=_0x3a6658;return _0x4f9f47;});}})['then'](respondWithFilteredResult(_0x4c1e70,_0x4cfa2b))[_0x4a14('0x56')](handleError(_0x4c1e70,null));};exports[_0x4a14('0xb1')]=function(_0x1f6adf,_0x2580a6,_0x11fbce){var _0x137a8f,_0x2a0b57,_0x166b57;if(_['isNil'](_0x1f6adf[_0x4a14('0x59')][_0x4a14('0x59')])||_0x1f6adf[_0x4a14('0x59')]['body']===''){throw new db[(_0x4a14('0x94'))][(_0x4a14('0x78'))](_0x4a14('0x96'));}if(_[_0x4a14('0x93')](_0x1f6adf['body']['to'])){throw new db[(_0x4a14('0x94'))]['ValidationError'](_0x4a14('0xc0'));}_0x137a8f=_0x1f6adf[_0x4a14('0x59')]['to'];return db[_0x4a14('0x52')][_0x4a14('0x5f')]({'where':{'id':_0x1f6adf['params']['id']},'include':[{'model':db[_0x4a14('0x9a')],'as':_0x4a14('0xc1'),'include':[{'model':db[_0x4a14('0x77')],'as':_0x4a14('0x9b'),'where':{'mobile':_0x137a8f},'limit':0x1,'order':[[_0x4a14('0x7b'),'DESC']]}]}]})[_0x4a14('0x20')](handleEntityNotFound(_0x2580a6,null))[_0x4a14('0x20')](function(_0x13adea){if(_0x13adea&&_0x13adea[_0x4a14('0xc1')]){_0x2a0b57=_0x13adea['get']({'plain':!![]});if(_0x2a0b57[_0x4a14('0xc1')]&&_0x2a0b57[_0x4a14('0xc1')][_0x4a14('0x9b')][_0x4a14('0x69')]){return _0x2a0b57[_0x4a14('0xc1')][_0x4a14('0x9b')][0x0];}return db[_0x4a14('0x77')]['create'](_[_0x4a14('0x19')](_0x1f6adf[_0x4a14('0x59')],{'firstName':_0x137a8f,'mobile':_0x137a8f,'phone':_0x137a8f,'ListId':_0x2a0b57['ListId']}));}})[_0x4a14('0x20')](handleEntityNotFound(_0x2580a6,null))['then'](function(_0x158b7a){if(_0x158b7a){_0x166b57=_0x158b7a;return db[_0x4a14('0x9e')][_0x4a14('0x5f')]({'where':{'ContactId':_0x166b57['id'],'closed':![],'SmsAccountId':_0x2a0b57['id']}})[_0x4a14('0x20')](function(_0xc5edbe){if(_0xc5edbe){return[_0xc5edbe,![]];}return db[_0x4a14('0x9e')][_0x4a14('0x58')]({'UserId':_0x1f6adf[_0x4a14('0x5a')]['id'],'ContactId':_0x166b57['id'],'SmsAccountId':_0x2a0b57['id'],'phone':_0x137a8f,'firstMsgDirection':_0x4a14('0xc2'),'Messages':[_[_0x4a14('0x50')](_0x1f6adf[_0x4a14('0x59')],{'read':![],'body':_0x1f6adf[_0x4a14('0x59')][_0x4a14('0x59')],'phone':_0x137a8f,'SmsAccountId':_0x2a0b57['id'],'UserId':_0x1f6adf['user']['id'],'ContactId':_0x166b57['id']})]},{'include':[{'model':db[_0x4a14('0xa6')],'as':_0x4a14('0xc3')}]})[_0x4a14('0x20')](function(_0xe219c0){return[_0xe219c0,!![]];});});}})[_0x4a14('0x9f')](function(_0x51dc08,_0x1cfb63){if(_0x1cfb63){return _0x51dc08;}return db['SmsMessage']['create'](_[_0x4a14('0x50')](_0x1f6adf[_0x4a14('0x59')],{'read':![],'body':_0x1f6adf[_0x4a14('0x59')]['body'],'phone':_0x137a8f,'SmsAccountId':_0x2a0b57['id'],'SmsInteractionId':_0x51dc08['id'],'UserId':_0x1f6adf[_0x4a14('0x5a')]['id'],'ContactId':_0x166b57['id']}))[_0x4a14('0x20')](function(_0xa603f5){_0x51dc08[_0x4a14('0xc4')][_0x4a14('0xc3')]=[];_0x51dc08[_0x4a14('0xc4')][_0x4a14('0xc3')][_0x4a14('0xa3')](_0xa603f5['dataValues']);return _0x51dc08;});})['then'](respondWithResult(_0x2580a6,null))[_0x4a14('0x56')](handleError(_0x2580a6,null));};exports[_0x4a14('0x2b')]=function(_0x59238e,_0x108ba6,_0x19a6d0){if(_0x59238e[_0x4a14('0x59')]['id']){delete _0x59238e[_0x4a14('0x59')]['id'];}var _0x2541be,_0x568db3,_0x3644c0;return db[_0x4a14('0x52')]['find']({'where':{'id':_0x59238e['params']['id']}})[_0x4a14('0x20')](handleEntityNotFound(_0x108ba6,null))[_0x4a14('0x20')](function(_0x14bed9){if(_0x14bed9){_0x3644c0=_0x14bed9;logger[_0x4a14('0x24')](_0x4a14('0x25'),'status','received\x20delivery\x20report\x20from',_0x14bed9[_0x4a14('0x40')],util[_0x4a14('0xc5')](_0x59238e[_0x4a14('0x59')],{'showHidden':![],'depth':null}));switch(_0x14bed9[_0x4a14('0x40')]){case _0x4a14('0xc6'):if(_0x59238e[_0x4a14('0x59')][_0x4a14('0xc7')]&&_0x59238e[_0x4a14('0x59')][_0x4a14('0x2b')]){_0x568db3=_0x59238e[_0x4a14('0x59')][_0x4a14('0x2b')];return db['SmsMessage'][_0x4a14('0x5f')]({'where':{'messageId':_0x59238e[_0x4a14('0x59')][_0x4a14('0xc7')]}});}break;case _0x4a14('0xc8'):if(_0x59238e[_0x4a14('0x59')][_0x4a14('0xc9')]&&_0x59238e['body'][_0x4a14('0xca')]){_0x568db3=_0x59238e[_0x4a14('0x59')][_0x4a14('0xca')];return db[_0x4a14('0xa6')][_0x4a14('0x5f')]({'where':{'messageId':_0x59238e[_0x4a14('0x59')][_0x4a14('0xc9')]}});}break;case _0x4a14('0x88'):if(_0x59238e['body'][_0x4a14('0x89')]&&_0x59238e[_0x4a14('0x59')]['status_code']){_0x568db3=_0x59238e['body'][_0x4a14('0xcb')];return db[_0x4a14('0xa6')]['find']({'where':{'messageId':_0x59238e['body'][_0x4a14('0x89')]}});}break;case _0x4a14('0xcc'):var _0x94458d=_0x59238e[_0x4a14('0x59')]['results'][0x0];if(_0x94458d[_0x4a14('0x84')]&&_0x94458d[_0x4a14('0x2b')][_0x4a14('0xcd')]==='DELIVERED'){_0x568db3=_0x94458d[_0x4a14('0x2b')][_0x4a14('0xcd')];return db[_0x4a14('0xa6')][_0x4a14('0x5f')]({'where':{'messageId':_0x94458d[_0x4a14('0x84')]}});}break;case _0x4a14('0x8f'):if(_0x59238e[_0x4a14('0x59')][_0x4a14('0x84')]&&_0x59238e[_0x4a14('0x59')][_0x4a14('0x2b')]){_0x568db3=_0x59238e[_0x4a14('0x59')][_0x4a14('0x2b')];return db[_0x4a14('0xa6')]['find']({'where':{'messageId':_0x59238e[_0x4a14('0x59')][_0x4a14('0x84')]}});}break;case _0x4a14('0xce'):if(_0x59238e[_0x4a14('0x59')][0x0][_0x4a14('0x29')]['id']){_0x568db3=_0x59238e[_0x4a14('0x59')][0x0][_0x4a14('0x40')];return db[_0x4a14('0xa6')][_0x4a14('0x5f')]({'where':{'messageId':_0x59238e['body'][0x0][_0x4a14('0x29')]['id']}});}break;case _0x4a14('0x91'):if(_0x59238e['body'][_0x4a14('0xcf')]&&_0x59238e[_0x4a14('0x59')]['status']){_0x568db3=_0x59238e[_0x4a14('0x59')][_0x4a14('0x2b')];return db['SmsMessage']['find']({'where':{'messageId':_0x59238e[_0x4a14('0x59')][_0x4a14('0xcf')]}});}break;}}})[_0x4a14('0x20')](handleEntityNotFound(_0x108ba6,null))[_0x4a14('0x20')](function(_0x27dbdc){if(_0x27dbdc){_0x2541be=_0x27dbdc;switch(_0x3644c0[_0x4a14('0x40')]){case _0x4a14('0xc6'):if(_0x568db3==='DELIVERED'){return _0x2541be[_0x4a14('0x35')]({'read':!![]});}else{logger[_0x4a14('0x27')](_0x4a14('0x25'),_0x4a14('0x2b'),_0x4a14('0xc6'),util[_0x4a14('0xc5')](_0x59238e[_0x4a14('0x59')],{'showHidden':![],'depth':null}));}break;case _0x4a14('0xc8'):if(_0x568db3==='1'){return _0x2541be[_0x4a14('0x35')]({'read':!![]});}else{logger[_0x4a14('0x27')](_0x4a14('0x25'),'status',_0x4a14('0xc6'),util[_0x4a14('0xc5')](_0x59238e['body'],{'showHidden':![],'depth':null}));}break;case _0x4a14('0x88'):if(!_0x59238e[_0x4a14('0x59')][_0x4a14('0xd0')]&&_0x568db3>=0xc8&&_0x568db3<=0xce){return _0x2541be[_0x4a14('0x35')]({'read':!![]});}else{logger[_0x4a14('0x27')](_0x4a14('0x25'),_0x4a14('0x2b'),_0x4a14('0x88'),util[_0x4a14('0xc5')](_0x59238e[_0x4a14('0x59')],{'showHidden':![],'depth':null}));}break;case _0x4a14('0xcc'):var _0x3f14d8=_0x59238e['body'][_0x4a14('0x8c')][0x0];if(_0x3f14d8[_0x4a14('0x2b')][_0x4a14('0xcd')]===_0x4a14('0xd1')){return _0x2541be[_0x4a14('0x35')]({'read':!![]});}else{logger['error'](_0x4a14('0x25'),_0x4a14('0x2b'),_0x4a14('0xcc'),util[_0x4a14('0xc5')](_0x59238e[_0x4a14('0x59')],{'showHidden':![],'depth':null}));}break;case _0x4a14('0x8f'):if(_0x568db3=='DELIVERED_TO_GATEWAY'||_0x568db3==_0x4a14('0xd2')){return _0x2541be[_0x4a14('0x35')]({'read':!![]});}else{logger[_0x4a14('0x27')](_0x4a14('0x25'),_0x4a14('0x2b'),_0x4a14('0x8f'),util[_0x4a14('0xc5')](_0x59238e[_0x4a14('0x59')],{'showHidden':![],'depth':null}));}break;case _0x4a14('0xce'):if(_0x568db3==_0x4a14('0xd3')){return _0x2541be[_0x4a14('0x35')]({'read':!![]});}else{logger[_0x4a14('0x27')](_0x4a14('0x25'),_0x4a14('0x2b'),_0x4a14('0xce'),util['inspect'](_0x59238e[_0x4a14('0x59')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x568db3===_0x4a14('0xd4')||_0x568db3===_0x4a14('0xd5')){return _0x2541be[_0x4a14('0x35')]({'read':!![]});}else{logger[_0x4a14('0x27')](_0x4a14('0x25'),'status',_0x4a14('0x91'),util[_0x4a14('0xc5')](_0x59238e[_0x4a14('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x2541be;}})[_0x4a14('0x20')](respondWithResult(_0x108ba6,null))[_0x4a14('0x56')](handleError(_0x108ba6,null));};exports[_0x4a14('0xd6')]=function(_0x1a0e3b,_0x565b8d,_0x37b15a){var _0x49a48f,_0x3c99d6,_0x2e6917;return db[_0x4a14('0x52')][_0x4a14('0x5f')]({'where':{'id':_0x1a0e3b[_0x4a14('0x62')]['id']}})[_0x4a14('0x20')](handleEntityNotFound(_0x565b8d,null))[_0x4a14('0x20')](function(_0x4db77b){if(_0x4db77b){_0x2e6917=_0x4db77b;logger[_0x4a14('0x24')](_0x4a14('0x25'),_0x4a14('0x2b'),_0x4a14('0xd7'),_0x4db77b[_0x4a14('0x40')],util[_0x4a14('0xc5')](_0x1a0e3b[_0x4a14('0x43')],{'showHidden':![],'depth':null}));switch(_0x4db77b[_0x4a14('0x40')]){case _0x4a14('0x8d'):if(_0x1a0e3b[_0x4a14('0x43')][_0x4a14('0xd8')]&&_0x1a0e3b[_0x4a14('0x43')][_0x4a14('0xd9')]){_0x3c99d6=_0x1a0e3b[_0x4a14('0x43')][_0x4a14('0xd9')];return db['SmsMessage'][_0x4a14('0x5f')]({'where':{'messageId':_0x1a0e3b[_0x4a14('0x43')]['message-id']}});}break;}}})[_0x4a14('0x20')](handleEntityNotFound(_0x565b8d,null))[_0x4a14('0x20')](function(_0x4b8cd9){if(_0x4b8cd9){_0x49a48f=_0x4b8cd9;switch(_0x2e6917[_0x4a14('0x40')]){case _0x4a14('0x8d'):if(_0x3c99d6==='2'||_0x3c99d6==='6'){return _0x49a48f['update']({'read':!![]});}else{logger[_0x4a14('0x27')](_0x4a14('0x25'),_0x4a14('0x2b'),_0x4a14('0x8d'),util[_0x4a14('0xc5')](_0x1a0e3b[_0x4a14('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x49a48f;}})['then'](respondWithResult(_0x565b8d,null))['catch'](handleError(_0x565b8d,null));};exports['addAgents']=function(_0x3bd855,_0x1414a9,_0x44d068){return db[_0x4a14('0x52')]['find']({'where':{'id':_0x3bd855[_0x4a14('0x62')]['id']}})[_0x4a14('0x20')](handleEntityNotFound(_0x1414a9,null))[_0x4a14('0x20')](function(_0x3a8d3b){if(_0x3a8d3b){return _0x3a8d3b['addAgents'](_0x3bd855[_0x4a14('0x59')][_0x4a14('0x6d')],_[_0x4a14('0x9d')](_0x3bd855[_0x4a14('0x59')],[_0x4a14('0x6d'),'id'])||{})[_0x4a14('0x9f')](function(_0xee5b1){for(var _0x261030=0x0;_0x261030<_0x3bd855['body'][_0x4a14('0x6d')][_0x4a14('0x69')];_0x261030+=0x1){socket[_0x4a14('0xda')]('userSmsAccount:save',{'UserId':Number(_0x3bd855[_0x4a14('0x59')]['ids'][_0x261030]),'SmsAccountId':Number(_0x3bd855[_0x4a14('0x62')]['id'])});}return _0xee5b1;});}})['then'](respondWithResult(_0x1414a9,null))[_0x4a14('0x56')](handleError(_0x1414a9,null));};exports['removeAgents']=function(_0x33d40b,_0x4f1de0,_0xae1904){return db[_0x4a14('0x52')][_0x4a14('0x5f')]({'where':{'id':_0x33d40b['params']['id']}})['then'](handleEntityNotFound(_0x4f1de0,null))[_0x4a14('0x20')](function(_0x48403e){if(_0x48403e){return _0x48403e[_0x4a14('0xdb')](_0x33d40b[_0x4a14('0x43')]['ids'])[_0x4a14('0x20')](function(){if(_[_0x4a14('0xdc')](_0x33d40b[_0x4a14('0x43')][_0x4a14('0x6d')])){for(var _0x3107ad=0x0;_0x3107ad<_0x33d40b['query'][_0x4a14('0x6d')][_0x4a14('0x69')];_0x3107ad+=0x1){socket[_0x4a14('0xda')](_0x4a14('0xdd'),{'UserId':Number(_0x33d40b[_0x4a14('0x43')][_0x4a14('0x6d')][_0x3107ad]),'SmsAccountId':Number(_0x33d40b[_0x4a14('0x62')]['id'])});}}else{socket[_0x4a14('0xda')](_0x4a14('0xdd'),{'UserId':Number(_0x33d40b[_0x4a14('0x43')][_0x4a14('0x6d')]),'SmsAccountId':Number(_0x33d40b[_0x4a14('0x62')]['id'])});}});}})[_0x4a14('0x20')](respondWithStatusCode(_0x4f1de0,null))[_0x4a14('0x56')](handleError(_0x4f1de0,null));};exports['getAgents']=function(_0x5ee949,_0x3695b7,_0x504c93){var _0x5aeb50={};var _0x236c9b={};var _0x48940a;var _0x2492a8;return db[_0x4a14('0x52')][_0x4a14('0x67')]({'where':{'id':_0x5ee949[_0x4a14('0x62')]['id']}})[_0x4a14('0x20')](handleEntityNotFound(_0x3695b7,null))['then'](function(_0x1eab40){if(_0x1eab40){_0x48940a=_0x1eab40;_0x236c9b['model']=_[_0x4a14('0x44')](db[_0x4a14('0xa9')][_0x4a14('0x3e')]);_0x236c9b[_0x4a14('0x43')]=_[_0x4a14('0x44')](_0x5ee949[_0x4a14('0x43')]);_0x236c9b['filters']=_[_0x4a14('0x46')](_0x236c9b[_0x4a14('0x42')],_0x236c9b[_0x4a14('0x43')]);_0x5aeb50[_0x4a14('0x47')]=_[_0x4a14('0x46')](_0x236c9b['model'],qs['fields'](_0x5ee949[_0x4a14('0x43')][_0x4a14('0x48')]));_0x5aeb50[_0x4a14('0x47')]=_0x5aeb50[_0x4a14('0x47')][_0x4a14('0x69')]?_0x5aeb50[_0x4a14('0x47')]:_0x236c9b[_0x4a14('0x42')];_0x5aeb50['order']=qs[_0x4a14('0x6a')](_0x5ee949[_0x4a14('0x43')][_0x4a14('0x6a')]);_0x5aeb50[_0x4a14('0x4c')]=qs['filters'](_[_0x4a14('0x4d')](_0x5ee949[_0x4a14('0x43')],_0x236c9b[_0x4a14('0x45')]));if(_0x5ee949[_0x4a14('0x43')][_0x4a14('0x4e')]){_0x5aeb50['where']=_[_0x4a14('0x50')](_0x5aeb50[_0x4a14('0x4c')],{'$or':_['map'](_0x5aeb50['attributes'],function(_0x4221df){var _0xedfc8f={};_0xedfc8f[_0x4221df]={'$like':'%'+_0x5ee949[_0x4a14('0x43')][_0x4a14('0x4e')]+'%'};return _0xedfc8f;})});}_0x5aeb50=_[_0x4a14('0x50')]({},_0x5aeb50,_0x5ee949['options']);return _0x48940a['getAgents'](_0x5aeb50);}})[_0x4a14('0x20')](function(_0x353b4d){if(_0x353b4d){_0x2492a8=_0x353b4d[_0x4a14('0x69')];if(!_0x5ee949[_0x4a14('0x43')][_0x4a14('0x49')](_0x4a14('0x4a'))){_0x5aeb50['limit']=qs[_0x4a14('0x30')](_0x5ee949[_0x4a14('0x43')][_0x4a14('0x30')]);_0x5aeb50[_0x4a14('0x2e')]=qs['offset'](_0x5ee949['query']['offset']);}return _0x48940a[_0x4a14('0xde')](_0x5aeb50);}})[_0x4a14('0x20')](function(_0x27d546){if(_0x27d546){return _0x27d546?{'count':_0x2492a8,'rows':_0x27d546}:null;}})[_0x4a14('0x20')](respondWithResult(_0x3695b7,null))[_0x4a14('0x56')](handleError(_0x3695b7,null));}; \ No newline at end of file +var _0x6a4e=['CmContact','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','ListId','mobile','twilio','From','messageId','from','sender','connectel','message_id','Text','MessageUUID','results','originatingAddress','segmentedMessage','clickatell','text','replyMessageId','bandwidth','intelepeer','refid','isNil','Sequelize','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','send','\x0a','addApplications','findAndCountAll','getApplications','Contact','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','dataValues','Messages','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','statusInt','requestid','clicksend','status_code','infobip','redif','DELIVERED','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','state','message-id','csc','addAgents','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','User','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','status','stack','name','Pause','map','SmsAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','limit','sort','where','pick','filter','VIRTUAL','includeAll','findAll','rows','catch','show','mandatoryDispositionPause','length','include','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','getDispositions','findOne','hasOwnProperty','order','SmsAccountId','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','priority'];(function(_0x2e3045,_0x21d689){var _0xe35c1c=function(_0x7696b6){while(--_0x7696b6){_0x2e3045['push'](_0x2e3045['shift']());}};_0xe35c1c(++_0x21d689);}(_0x6a4e,0x14f));var _0xe6a4=function(_0x352e4f,_0x45ba7a){_0x352e4f=_0x352e4f-0x0;var _0x46f43c=_0x6a4e[_0x352e4f];return _0x46f43c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe6a4('0x0'));var zipdir=require(_0xe6a4('0x1'));var jsonpatch=require(_0xe6a4('0x2'));var rp=require('request-promise');var moment=require(_0xe6a4('0x3'));var BPromise=require(_0xe6a4('0x4'));var Mustache=require(_0xe6a4('0x5'));var util=require(_0xe6a4('0x6'));var path=require(_0xe6a4('0x7'));var sox=require('sox');var csv=require(_0xe6a4('0x8'));var ejs=require(_0xe6a4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe6a4('0xa'));var squel=require(_0xe6a4('0xb'));var crypto=require(_0xe6a4('0xc'));var jsforce=require(_0xe6a4('0xd'));var deskjs=require(_0xe6a4('0xe'));var toCsv=require(_0xe6a4('0x8'));var querystring=require(_0xe6a4('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe6a4('0x10'));var qs=require(_0xe6a4('0x11'));var as=require(_0xe6a4('0x12'));var hardwareService=require(_0xe6a4('0x13'));var logger=require(_0xe6a4('0x14'))(_0xe6a4('0x15'));var utils=require(_0xe6a4('0x16'));var config=require(_0xe6a4('0x17'));var licenseUtil=require(_0xe6a4('0x18'));var db=require('../../mysqldb')['db'];config[_0xe6a4('0x19')]=_[_0xe6a4('0x1a')](config[_0xe6a4('0x19')],{'host':_0xe6a4('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe6a4('0x19')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0xe6a4('0x1c'));var client=jayson[_0xe6a4('0x1d')][_0xe6a4('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x4d4180,_0x3c98ad,_0x2b578f,_0x220dc8){return new BPromise(function(_0x4f0e2c,_0x547cce){var _0x2b8957=_0x220dc8||client;return _0x2b8957[_0xe6a4('0x1f')](_0x4d4180,_0x2b578f)[_0xe6a4('0x20')](function(_0x2d4c18){logger[_0xe6a4('0x21')](_0xe6a4('0x22'),_0x3c98ad,'request\x20sent');logger[_0xe6a4('0x23')](_0xe6a4('0x24'),_0x3c98ad,_0xe6a4('0x25'),JSON[_0xe6a4('0x26')](_0x2d4c18));if(_0x2d4c18['error']){if(_0x2d4c18[_0xe6a4('0x27')][_0xe6a4('0x28')]===0x1f4){logger[_0xe6a4('0x27')](_0xe6a4('0x22'),_0x3c98ad,_0x2d4c18[_0xe6a4('0x27')][_0xe6a4('0x29')]);return _0x547cce(_0x2d4c18[_0xe6a4('0x27')][_0xe6a4('0x29')]);}logger['error'](_0xe6a4('0x22'),_0x3c98ad,_0x2d4c18['error'][_0xe6a4('0x29')]);return _0x4f0e2c(_0x2d4c18[_0xe6a4('0x27')][_0xe6a4('0x29')]);}else{logger[_0xe6a4('0x21')](_0xe6a4('0x22'),_0x3c98ad,'request\x20sent');_0x4f0e2c(_0x2d4c18[_0xe6a4('0x2a')][_0xe6a4('0x29')]);}})['catch'](function(_0x16f091){logger[_0xe6a4('0x27')](_0xe6a4('0x22'),_0x3c98ad,_0x16f091);_0x547cce(_0x16f091);});});}function respondWithStatusCode(_0xbad18b,_0x3c4342){_0x3c4342=_0x3c4342||0xcc;return function(_0x1a6f46){if(_0x1a6f46){return _0xbad18b[_0xe6a4('0x2b')](_0x3c4342);}return _0xbad18b['status'](_0x3c4342)[_0xe6a4('0x2c')]();};}function respondWithResult(_0x1d59fe,_0x162f25){_0x162f25=_0x162f25||0xc8;return function(_0xa2fd3e){if(_0xa2fd3e){return _0x1d59fe['status'](_0x162f25)[_0xe6a4('0x2d')](_0xa2fd3e);}};}function respondWithFilteredResult(_0x3e4ddc,_0x432ab7){return function(_0x1f86ff){if(_0x1f86ff){var _0x2c0f42=typeof _0x432ab7[_0xe6a4('0x2e')]===_0xe6a4('0x2f')&&typeof _0x432ab7['limit']==='undefined';var _0x3ac0ce=_0x1f86ff[_0xe6a4('0x30')];var _0x1585d0=_0x2c0f42?0x0:_0x432ab7['offset'];var _0x40d584=_0x2c0f42?_0x1f86ff[_0xe6a4('0x30')]:_0x432ab7[_0xe6a4('0x2e')]+_0x432ab7['limit'];var _0x2f0800;if(_0x40d584>=_0x3ac0ce){_0x40d584=_0x3ac0ce;_0x2f0800=0xc8;}else{_0x2f0800=0xce;}_0x3e4ddc['status'](_0x2f0800);return _0x3e4ddc[_0xe6a4('0x31')](_0xe6a4('0x32'),_0x1585d0+'-'+_0x40d584+'/'+_0x3ac0ce)[_0xe6a4('0x2d')](_0x1f86ff);}return null;};}function patchUpdates(_0x2039c2){return function(_0x566d9b){try{jsonpatch[_0xe6a4('0x33')](_0x566d9b,_0x2039c2,!![]);}catch(_0x2428b7){return BPromise[_0xe6a4('0x34')](_0x2428b7);}return _0x566d9b[_0xe6a4('0x35')]();};}function saveUpdates(_0x4f0864,_0x4a9d0c){return function(_0x598b1d){if(_0x598b1d){return _0x598b1d[_0xe6a4('0x36')](_0x4f0864)['then'](function(_0x141ab3){return _0x141ab3;});}return null;};}function removeEntity(_0x1c4979,_0x387e9a){return function(_0xa71d94){if(_0xa71d94){return _0xa71d94[_0xe6a4('0x37')]()[_0xe6a4('0x20')](function(){var _0x395805=_0xa71d94[_0xe6a4('0x38')]({'plain':!![]});var _0x586be8=_0xe6a4('0x39');return db[_0xe6a4('0x3a')][_0xe6a4('0x37')]({'where':{'type':_0x586be8,'resourceId':_0x395805['id']}})[_0xe6a4('0x20')](function(){return _0xa71d94;});})['then'](function(){_0x1c4979[_0xe6a4('0x3b')](0xcc)[_0xe6a4('0x2c')]();});}};}function handleEntityNotFound(_0x576e0f,_0x368c10){return function(_0x5615e9){if(!_0x5615e9){_0x576e0f[_0xe6a4('0x2b')](0x194);}return _0x5615e9;};}function handleError(_0x50df6a,_0x33eb3c){_0x33eb3c=_0x33eb3c||0x1f4;return function(_0x26d909){logger['error'](_0x26d909[_0xe6a4('0x3c')]);if(_0x26d909[_0xe6a4('0x3d')]){delete _0x26d909['name'];}_0x50df6a[_0xe6a4('0x3b')](_0x33eb3c)['send'](_0x26d909);};}exports['index']=function(_0x1e7037,_0xcaf5da){var _0x313f58={'include':[{'model':db[_0xe6a4('0x3e')],'as':'mandatoryDispositionPause'}]},_0x508b39={},_0x16adb4={'count':0x0,'rows':[]};var _0x15806d=_[_0xe6a4('0x3f')](db[_0xe6a4('0x40')][_0xe6a4('0x41')],function(_0x4b7b50){return{'name':_0x4b7b50[_0xe6a4('0x42')],'type':_0x4b7b50[_0xe6a4('0x43')][_0xe6a4('0x44')]};});_0x508b39[_0xe6a4('0x45')]=_[_0xe6a4('0x3f')](_0x15806d,_0xe6a4('0x3d'));_0x508b39['query']=_[_0xe6a4('0x46')](_0x1e7037[_0xe6a4('0x47')]);_0x508b39[_0xe6a4('0x48')]=_[_0xe6a4('0x49')](_0x508b39[_0xe6a4('0x45')],_0x508b39[_0xe6a4('0x47')]);_0x313f58[_0xe6a4('0x4a')]=_[_0xe6a4('0x49')](_0x508b39['model'],qs[_0xe6a4('0x4b')](_0x1e7037['query'][_0xe6a4('0x4b')]));_0x313f58['attributes']=_0x313f58[_0xe6a4('0x4a')]['length']?_0x313f58['attributes']:_0x508b39[_0xe6a4('0x45')];if(!_0x1e7037[_0xe6a4('0x47')]['hasOwnProperty'](_0xe6a4('0x4c'))){_0x313f58[_0xe6a4('0x4d')]=qs['limit'](_0x1e7037[_0xe6a4('0x47')][_0xe6a4('0x4d')]);_0x313f58[_0xe6a4('0x2e')]=qs[_0xe6a4('0x2e')](_0x1e7037[_0xe6a4('0x47')][_0xe6a4('0x2e')]);}_0x313f58['order']=qs[_0xe6a4('0x4e')](_0x1e7037[_0xe6a4('0x47')][_0xe6a4('0x4e')]);_0x313f58[_0xe6a4('0x4f')]=qs['filters'](_[_0xe6a4('0x50')](_0x1e7037[_0xe6a4('0x47')],_0x508b39[_0xe6a4('0x48')]),_0x15806d);if(_0x1e7037[_0xe6a4('0x47')][_0xe6a4('0x51')]){_0x313f58['where']=_['merge'](_0x313f58[_0xe6a4('0x4f')],{'$or':_['map'](_0x15806d,function(_0x51bbb5){if(_0x51bbb5[_0xe6a4('0x43')]!==_0xe6a4('0x52')){var _0x1fc9d0={};_0x1fc9d0[_0x51bbb5[_0xe6a4('0x3d')]]={'$like':'%'+_0x1e7037['query'][_0xe6a4('0x51')]+'%'};return _0x1fc9d0;}})});}_0x313f58=_['merge']({},_0x313f58,_0x1e7037['options']);var _0x3400b4={'where':_0x313f58[_0xe6a4('0x4f')]};return db[_0xe6a4('0x40')]['count'](_0x3400b4)['then'](function(_0x7bcf74){_0x16adb4[_0xe6a4('0x30')]=_0x7bcf74;if(_0x1e7037[_0xe6a4('0x47')][_0xe6a4('0x53')]){_0x313f58['include']=[{'all':!![]}];}return db['SmsAccount'][_0xe6a4('0x54')](_0x313f58);})['then'](function(_0x351e5e){_0x16adb4[_0xe6a4('0x55')]=_0x351e5e;return _0x16adb4;})[_0xe6a4('0x20')](respondWithFilteredResult(_0xcaf5da,_0x313f58))[_0xe6a4('0x56')](handleError(_0xcaf5da,null));};exports[_0xe6a4('0x57')]=function(_0x4346e5,_0x4a476d){var _0x3b5c3d={'raw':![],'where':{'id':_0x4346e5['params']['id']},'include':[{'model':db['Pause'],'as':_0xe6a4('0x58')}]},_0x3d148e={};_0x3d148e[_0xe6a4('0x45')]=_[_0xe6a4('0x46')](db[_0xe6a4('0x40')][_0xe6a4('0x41')]);_0x3d148e['query']=_[_0xe6a4('0x46')](_0x4346e5[_0xe6a4('0x47')]);_0x3d148e[_0xe6a4('0x48')]=_['intersection'](_0x3d148e[_0xe6a4('0x45')],_0x3d148e[_0xe6a4('0x47')]);_0x3b5c3d['attributes']=_['intersection'](_0x3d148e[_0xe6a4('0x45')],qs[_0xe6a4('0x4b')](_0x4346e5[_0xe6a4('0x47')][_0xe6a4('0x4b')]));_0x3b5c3d[_0xe6a4('0x4a')]=_0x3b5c3d['attributes'][_0xe6a4('0x59')]?_0x3b5c3d[_0xe6a4('0x4a')]:_0x3d148e[_0xe6a4('0x45')];if(_0x4346e5[_0xe6a4('0x47')][_0xe6a4('0x53')]){_0x3b5c3d[_0xe6a4('0x5a')]=[{'all':!![]}];}_0x3b5c3d=_[_0xe6a4('0x5b')]({},_0x3b5c3d,_0x4346e5[_0xe6a4('0x5c')]);return db[_0xe6a4('0x40')][_0xe6a4('0x5d')](_0x3b5c3d)[_0xe6a4('0x20')](handleEntityNotFound(_0x4a476d,null))[_0xe6a4('0x20')](respondWithResult(_0x4a476d,null))[_0xe6a4('0x56')](handleError(_0x4a476d,null));};exports[_0xe6a4('0x5e')]=function(_0x3c474a,_0x260e1d){return db[_0xe6a4('0x40')][_0xe6a4('0x5e')](_0x3c474a[_0xe6a4('0x5f')],{})[_0xe6a4('0x20')](function(_0x88b014){var _0x30f0a3=_0x3c474a['user'][_0xe6a4('0x38')]({'plain':!![]});if(!_0x30f0a3)throw new Error(_0xe6a4('0x60'));if(_0x30f0a3['role']===_0xe6a4('0x61')){var _0x26a8ac=_0x88b014[_0xe6a4('0x38')]({'plain':!![]});var _0x316acc=_0xe6a4('0x39');return db['UserProfileSection']['find']({'where':{'name':_0x316acc,'userProfileId':_0x30f0a3[_0xe6a4('0x62')]},'raw':!![]})[_0xe6a4('0x20')](function(_0x43b07c){if(_0x43b07c&&_0x43b07c[_0xe6a4('0x63')]===0x0){return db[_0xe6a4('0x3a')]['create']({'name':_0x26a8ac[_0xe6a4('0x3d')],'resourceId':_0x26a8ac['id'],'type':_0x43b07c[_0xe6a4('0x3d')],'sectionId':_0x43b07c['id']},{})[_0xe6a4('0x20')](function(){return _0x88b014;});}else{return _0x88b014;}})[_0xe6a4('0x56')](function(_0x30faec){logger[_0xe6a4('0x27')](_0xe6a4('0x64'),_0x30faec);throw _0x30faec;});}return _0x88b014;})[_0xe6a4('0x20')](respondWithResult(_0x260e1d,0xc9))[_0xe6a4('0x56')](handleError(_0x260e1d,null));};exports['update']=function(_0xca7080,_0x2bfafb){if(_0xca7080[_0xe6a4('0x5f')]['id']){delete _0xca7080[_0xe6a4('0x5f')]['id'];}return db[_0xe6a4('0x40')][_0xe6a4('0x5d')]({'where':{'id':_0xca7080[_0xe6a4('0x65')]['id']},'include':[{'model':db[_0xe6a4('0x3e')],'as':_0xe6a4('0x58')}]})['then'](handleEntityNotFound(_0x2bfafb,null))[_0xe6a4('0x20')](saveUpdates(_0xca7080[_0xe6a4('0x5f')],null))[_0xe6a4('0x20')](respondWithResult(_0x2bfafb,null))[_0xe6a4('0x56')](handleError(_0x2bfafb,null));};exports['destroy']=function(_0x2fda1a,_0x46d926){return db[_0xe6a4('0x40')]['find']({'where':{'id':_0x2fda1a[_0xe6a4('0x65')]['id']}})[_0xe6a4('0x20')](handleEntityNotFound(_0x46d926,null))[_0xe6a4('0x20')](removeEntity(_0x46d926,null))[_0xe6a4('0x56')](handleError(_0x46d926,null));};exports[_0xe6a4('0x66')]=function(_0x39d15a,_0x316f69){return db[_0xe6a4('0x40')]['describe']()['then'](respondWithResult(_0x316f69,null))[_0xe6a4('0x56')](handleError(_0x316f69,null));};exports[_0xe6a4('0x67')]=function(_0x164c43,_0x258d9e,_0x5dbb97){if(_0x164c43[_0xe6a4('0x5f')]['id']){delete _0x164c43[_0xe6a4('0x5f')]['id'];}return db[_0xe6a4('0x40')][_0xe6a4('0x5d')]({'where':{'id':_0x164c43[_0xe6a4('0x65')]['id']}})[_0xe6a4('0x20')](handleEntityNotFound(_0x258d9e,null))[_0xe6a4('0x20')](function(_0x553952){if(_0x553952){_0x164c43[_0xe6a4('0x5f')]['SmsAccountId']=_0x553952['id'];return db[_0xe6a4('0x68')][_0xe6a4('0x5e')](_0x164c43['body']);}})['then'](respondWithResult(_0x258d9e,null))[_0xe6a4('0x56')](handleError(_0x258d9e,null));};exports[_0xe6a4('0x69')]=function(_0xd7a43b,_0x10cf1b,_0x5dddb5){var _0x2a4169={'raw':![],'where':{}};var _0xecfd06={};var _0x1f9b7f={'count':0x0,'rows':[]};return db['SmsAccount'][_0xe6a4('0x6a')]({'where':{'id':_0xd7a43b['params']['id']}})['then'](handleEntityNotFound(_0x10cf1b,null))[_0xe6a4('0x20')](function(_0x3ee9b3){if(_0x3ee9b3){_0xecfd06[_0xe6a4('0x45')]=_[_0xe6a4('0x46')](db[_0xe6a4('0x68')]['rawAttributes']);_0xecfd06[_0xe6a4('0x47')]=_[_0xe6a4('0x46')](_0xd7a43b[_0xe6a4('0x47')]);_0xecfd06[_0xe6a4('0x48')]=_[_0xe6a4('0x49')](_0xecfd06[_0xe6a4('0x45')],_0xecfd06['query']);_0x2a4169[_0xe6a4('0x4a')]=_[_0xe6a4('0x49')](_0xecfd06[_0xe6a4('0x45')],qs[_0xe6a4('0x4b')](_0xd7a43b[_0xe6a4('0x47')][_0xe6a4('0x4b')]));_0x2a4169[_0xe6a4('0x4a')]=_0x2a4169['attributes']['length']?_0x2a4169['attributes']:_0xecfd06[_0xe6a4('0x45')];if(!_0xd7a43b['query'][_0xe6a4('0x6b')](_0xe6a4('0x4c'))){_0x2a4169[_0xe6a4('0x4d')]=qs['limit'](_0xd7a43b[_0xe6a4('0x47')][_0xe6a4('0x4d')]);_0x2a4169['offset']=qs[_0xe6a4('0x2e')](_0xd7a43b['query'][_0xe6a4('0x2e')]);}_0x2a4169[_0xe6a4('0x6c')]=qs[_0xe6a4('0x4e')](_0xd7a43b[_0xe6a4('0x47')][_0xe6a4('0x4e')]);_0x2a4169[_0xe6a4('0x4f')]=qs[_0xe6a4('0x48')](_[_0xe6a4('0x50')](_0xd7a43b[_0xe6a4('0x47')],_0xecfd06[_0xe6a4('0x48')]));_0x2a4169['where'][_0xe6a4('0x6d')]=_0x3ee9b3['id'];if(_0xd7a43b[_0xe6a4('0x47')][_0xe6a4('0x51')]){_0x2a4169['where']=_[_0xe6a4('0x5b')](_0x2a4169['where'],{'$or':_[_0xe6a4('0x3f')](_0x2a4169[_0xe6a4('0x4a')],function(_0x1ba78b){var _0x2e60bc={};_0x2e60bc[_0x1ba78b]={'$like':'%'+_0xd7a43b['query'][_0xe6a4('0x51')]+'%'};return _0x2e60bc;})});}_0x2a4169=_[_0xe6a4('0x5b')]({},_0x2a4169,_0xd7a43b[_0xe6a4('0x5c')]);return db[_0xe6a4('0x68')][_0xe6a4('0x30')]({'where':_0x2a4169[_0xe6a4('0x4f')]})[_0xe6a4('0x20')](function(_0x36c7e9){_0x1f9b7f[_0xe6a4('0x30')]=_0x36c7e9;if(_0xd7a43b[_0xe6a4('0x47')][_0xe6a4('0x53')]){_0x2a4169[_0xe6a4('0x5a')]=[{'all':!![]}];}return db[_0xe6a4('0x68')][_0xe6a4('0x54')](_0x2a4169);})['then'](function(_0x1cfc73){_0x1f9b7f[_0xe6a4('0x55')]=_0x1cfc73;return _0x1f9b7f;});}})[_0xe6a4('0x20')](respondWithFilteredResult(_0x10cf1b,_0x2a4169))['catch'](handleError(_0x10cf1b,null));};exports[_0xe6a4('0x6e')]=function(_0x53df8c,_0x49c805,_0xdb0b4d){return db[_0xe6a4('0x40')][_0xe6a4('0x5d')]({'where':{'id':_0x53df8c[_0xe6a4('0x65')]['id']}})[_0xe6a4('0x20')](handleEntityNotFound(_0x49c805,null))[_0xe6a4('0x20')](function(_0x1cb838){if(_0x1cb838){return _0x1cb838[_0xe6a4('0x6e')](_0x53df8c[_0xe6a4('0x47')][_0xe6a4('0x6f')]);}})[_0xe6a4('0x20')](respondWithStatusCode(_0x49c805,null))['catch'](handleError(_0x49c805,null));};exports[_0xe6a4('0x70')]=function(_0x4e12c4,_0x46c5f1,_0x2bd5b0){if(_0x4e12c4['body']['id']){delete _0x4e12c4[_0xe6a4('0x5f')]['id'];}return db[_0xe6a4('0x40')]['find']({'where':{'id':_0x4e12c4[_0xe6a4('0x65')]['id']}})[_0xe6a4('0x20')](handleEntityNotFound(_0x46c5f1,null))[_0xe6a4('0x20')](function(_0x1a3913){if(_0x1a3913){_0x4e12c4[_0xe6a4('0x5f')][_0xe6a4('0x6d')]=_0x1a3913['id'];return db['CannedAnswer'][_0xe6a4('0x5e')](_0x4e12c4[_0xe6a4('0x5f')]);}})[_0xe6a4('0x20')](respondWithResult(_0x46c5f1,null))[_0xe6a4('0x56')](handleError(_0x46c5f1,null));};exports[_0xe6a4('0x71')]=function(_0x1d2397,_0x964b75,_0x45bd52){var _0x3cf1d2={'raw':![],'where':{}};var _0x156191={};var _0x226c4b={'count':0x0,'rows':[]};return db[_0xe6a4('0x40')][_0xe6a4('0x6a')]({'where':{'id':_0x1d2397['params']['id']}})[_0xe6a4('0x20')](handleEntityNotFound(_0x964b75,null))[_0xe6a4('0x20')](function(_0x6c933e){if(_0x6c933e){_0x156191[_0xe6a4('0x45')]=_[_0xe6a4('0x46')](db[_0xe6a4('0x72')][_0xe6a4('0x41')]);_0x156191[_0xe6a4('0x47')]=_['keys'](_0x1d2397[_0xe6a4('0x47')]);_0x156191[_0xe6a4('0x48')]=_['intersection'](_0x156191['model'],_0x156191[_0xe6a4('0x47')]);_0x3cf1d2[_0xe6a4('0x4a')]=_[_0xe6a4('0x49')](_0x156191[_0xe6a4('0x45')],qs[_0xe6a4('0x4b')](_0x1d2397[_0xe6a4('0x47')][_0xe6a4('0x4b')]));_0x3cf1d2[_0xe6a4('0x4a')]=_0x3cf1d2[_0xe6a4('0x4a')][_0xe6a4('0x59')]?_0x3cf1d2[_0xe6a4('0x4a')]:_0x156191['model'];if(!_0x1d2397[_0xe6a4('0x47')][_0xe6a4('0x6b')]('nolimit')){_0x3cf1d2[_0xe6a4('0x4d')]=qs['limit'](_0x1d2397[_0xe6a4('0x47')]['limit']);_0x3cf1d2[_0xe6a4('0x2e')]=qs[_0xe6a4('0x2e')](_0x1d2397[_0xe6a4('0x47')]['offset']);}_0x3cf1d2[_0xe6a4('0x6c')]=qs[_0xe6a4('0x4e')](_0x1d2397[_0xe6a4('0x47')][_0xe6a4('0x4e')]);_0x3cf1d2['where']=qs[_0xe6a4('0x48')](_[_0xe6a4('0x50')](_0x1d2397['query'],_0x156191[_0xe6a4('0x48')]));_0x3cf1d2['where']['SmsAccountId']=_0x6c933e['id'];if(_0x1d2397['query'][_0xe6a4('0x51')]){_0x3cf1d2[_0xe6a4('0x4f')]=_['merge'](_0x3cf1d2['where'],{'$or':_[_0xe6a4('0x3f')](_0x3cf1d2['attributes'],function(_0x47ab7e){var _0x24a843={};_0x24a843[_0x47ab7e]={'$like':'%'+_0x1d2397['query']['filter']+'%'};return _0x24a843;})});}_0x3cf1d2=_['merge']({},_0x3cf1d2,_0x1d2397['options']);return db[_0xe6a4('0x72')]['count']({'where':_0x3cf1d2['where']})[_0xe6a4('0x20')](function(_0x36e4e1){_0x226c4b[_0xe6a4('0x30')]=_0x36e4e1;if(_0x1d2397['query'][_0xe6a4('0x53')]){_0x3cf1d2[_0xe6a4('0x5a')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3cf1d2);})['then'](function(_0x19dea6){_0x226c4b[_0xe6a4('0x55')]=_0x19dea6;return _0x226c4b;});}})[_0xe6a4('0x20')](respondWithFilteredResult(_0x964b75,_0x3cf1d2))['catch'](handleError(_0x964b75,null));};exports[_0xe6a4('0x73')]=function(_0x1a45d8,_0x59eebc,_0x48a551){return db[_0xe6a4('0x40')][_0xe6a4('0x5d')]({'where':{'id':_0x1a45d8['params']['id']}})['then'](handleEntityNotFound(_0x59eebc,null))[_0xe6a4('0x20')](function(_0x3f14c0){if(_0x3f14c0){return _0x3f14c0[_0xe6a4('0x73')](_0x1a45d8[_0xe6a4('0x47')][_0xe6a4('0x6f')]);}})[_0xe6a4('0x20')](respondWithStatusCode(_0x59eebc,null))[_0xe6a4('0x56')](handleError(_0x59eebc,null));};exports[_0xe6a4('0x74')]=function(_0x4a4c48,_0x14c041,_0x3794cc){var _0x5a13cb={'channel':_0xe6a4('0x75')};var _0x805d01=[];var _0x285974=[];var _0xc5b1cd={};return db['SmsAccount']['find']({'where':{'id':_0x4a4c48[_0xe6a4('0x65')]['id']},'include':[{'model':db[_0xe6a4('0x76')],'as':_0xe6a4('0x77')}]})[_0xe6a4('0x20')](handleEntityNotFound(_0x14c041,null))[_0xe6a4('0x20')](function(_0x35e247){_0x5a13cb[_0xe6a4('0x78')]=_0x35e247;_0x5a13cb[_0xe6a4('0x79')]=_['orderBy'](_0x35e247[_0xe6a4('0x77')],[_0xe6a4('0x7a')],['asc']);if(_0x5a13cb['account'][_0xe6a4('0x77')]){delete _0x5a13cb[_0xe6a4('0x78')][_0xe6a4('0x77')];}return db[_0xe6a4('0x7b')]['describe']();})[_0xe6a4('0x20')](function(_0x4b6f7a){if(!_0x4b6f7a){throw new db['Sequelize']['ValidationError'](_0xe6a4('0x7c'));}_0x805d01=_['difference'](_[_0xe6a4('0x46')](_0x4b6f7a),[_0xe6a4('0x7d'),'updatedAt']);_0x285974=_[_0xe6a4('0x7e')](_['keys'](_0x4b6f7a),[_0xe6a4('0x7d'),_0xe6a4('0x7f'),_0xe6a4('0x80'),_0xe6a4('0x81')]);_0x5a13cb[_0xe6a4('0x5f')]={'mapKey':_0xe6a4('0x82')};if(_0x5a13cb[_0xe6a4('0x78')][_0xe6a4('0x43')]){switch(_0x5a13cb['account'][_0xe6a4('0x43')]){case _0xe6a4('0x83'):_0x5a13cb[_0xe6a4('0x5f')]['from']=_0x4a4c48[_0xe6a4('0x5f')][_0xe6a4('0x84')];_0x5a13cb[_0xe6a4('0x5f')]['body']=_0x4a4c48[_0xe6a4('0x5f')]['Body'];_0x5a13cb[_0xe6a4('0x5f')][_0xe6a4('0x85')]=_0x4a4c48[_0xe6a4('0x5f')]['MessageSid'];break;case'skebby':_0x5a13cb[_0xe6a4('0x5f')][_0xe6a4('0x86')]='+'+_0x4a4c48[_0xe6a4('0x5f')][_0xe6a4('0x87')];_0x5a13cb[_0xe6a4('0x5f')][_0xe6a4('0x5f')]=_0x4a4c48[_0xe6a4('0x5f')]['text'];break;case _0xe6a4('0x88'):_0x5a13cb[_0xe6a4('0x5f')][_0xe6a4('0x86')]=_0x4a4c48[_0xe6a4('0x5f')][_0xe6a4('0x86')];_0x5a13cb[_0xe6a4('0x5f')][_0xe6a4('0x5f')]=_0x4a4c48[_0xe6a4('0x5f')]['message'];break;case'clicksend':_0x5a13cb[_0xe6a4('0x5f')][_0xe6a4('0x86')]=_0x4a4c48[_0xe6a4('0x5f')]['from'];_0x5a13cb[_0xe6a4('0x5f')][_0xe6a4('0x5f')]=_0x4a4c48[_0xe6a4('0x5f')][_0xe6a4('0x5f')];_0x5a13cb[_0xe6a4('0x5f')][_0xe6a4('0x85')]=_0x4a4c48[_0xe6a4('0x5f')][_0xe6a4('0x89')];break;case'plivo':_0x5a13cb['body'][_0xe6a4('0x86')]=_0x4a4c48[_0xe6a4('0x5f')]['From'];_0x5a13cb[_0xe6a4('0x5f')][_0xe6a4('0x5f')]=_0x4a4c48['body'][_0xe6a4('0x8a')];_0x5a13cb[_0xe6a4('0x5f')]['messageId']=_0x4a4c48['body'][_0xe6a4('0x8b')];break;case'infobip':_0x5a13cb[_0xe6a4('0x5f')][_0xe6a4('0x86')]='+'+_0x4a4c48[_0xe6a4('0x5f')][_0xe6a4('0x8c')][0x0]['from'];_0x5a13cb['body'][_0xe6a4('0x5f')]=_0x4a4c48[_0xe6a4('0x5f')][_0xe6a4('0x8c')][0x0]['text'];_0x5a13cb[_0xe6a4('0x5f')][_0xe6a4('0x85')]=_0x4a4c48[_0xe6a4('0x5f')][_0xe6a4('0x8c')][0x0]['messageId'];break;case'csc':_0x5a13cb[_0xe6a4('0x5f')][_0xe6a4('0x86')]=_0x4a4c48[_0xe6a4('0x5f')][_0xe6a4('0x8d')];_0x5a13cb['body'][_0xe6a4('0x5f')]=_0x4a4c48[_0xe6a4('0x5f')][_0xe6a4('0x8e')][_0xe6a4('0x29')];break;case _0xe6a4('0x8f'):_0x5a13cb[_0xe6a4('0x5f')]['from']=_0x4a4c48['body']['fromNumber'];_0x5a13cb[_0xe6a4('0x5f')][_0xe6a4('0x5f')]=_0x4a4c48[_0xe6a4('0x5f')][_0xe6a4('0x90')];_0x5a13cb['body'][_0xe6a4('0x85')]=_0x4a4c48['body'][_0xe6a4('0x91')];break;case _0xe6a4('0x92'):_0x5a13cb[_0xe6a4('0x5f')][_0xe6a4('0x85')]=_0x4a4c48['body'][0x0][_0xe6a4('0x29')]['id'];_0x5a13cb['body'][_0xe6a4('0x86')]=_0x4a4c48['body'][0x0][_0xe6a4('0x29')][_0xe6a4('0x86')];_0x5a13cb[_0xe6a4('0x5f')][_0xe6a4('0x5f')]=_0x4a4c48[_0xe6a4('0x5f')][0x0][_0xe6a4('0x29')][_0xe6a4('0x90')];break;case _0xe6a4('0x93'):_0x5a13cb[_0xe6a4('0x5f')][_0xe6a4('0x86')]=_0x4a4c48[_0xe6a4('0x5f')][_0xe6a4('0x86')];_0x5a13cb['body']['body']=_0x4a4c48[_0xe6a4('0x5f')][_0xe6a4('0x29')];_0x5a13cb['body'][_0xe6a4('0x85')]=_0x4a4c48['body'][_0xe6a4('0x94')];break;}}if(_0x5a13cb['body']['id']){delete _0x5a13cb[_0xe6a4('0x5f')]['id'];}if(_[_0xe6a4('0x95')](_0x5a13cb['body'][_0xe6a4('0x86')])){throw new db[(_0xe6a4('0x96'))][(_0xe6a4('0x97'))](_0xe6a4('0x98'));}if(_[_0xe6a4('0x95')](_0x5a13cb[_0xe6a4('0x5f')][_0xe6a4('0x5f')])||_0x5a13cb['body'][_0xe6a4('0x5f')]===''){throw new db[(_0xe6a4('0x96'))]['ValidationError'](_0xe6a4('0x99'));}if(_[_0xe6a4('0x95')](_0x5a13cb['body']['mapKey'])){throw new db[(_0xe6a4('0x96'))][(_0xe6a4('0x97'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x285974);}if(!_['includes'](_0x285974,_0x5a13cb[_0xe6a4('0x5f')][_0xe6a4('0x9a')])){throw new db['Sequelize']['ValidationError'](_0xe6a4('0x9b')+_0x285974);}_0xc5b1cd[_0x5a13cb[_0xe6a4('0x5f')][_0xe6a4('0x9a')]]=_0x5a13cb['body']['from'];return db[_0xe6a4('0x9c')][_0xe6a4('0x5d')]({'where':{'id':_0x5a13cb[_0xe6a4('0x78')][_0xe6a4('0x81')]},'include':[{'model':db[_0xe6a4('0x7b')],'as':_0xe6a4('0x9d'),'where':_0xc5b1cd,'limit':0x1,'order':[[_0xe6a4('0x7f'),_0xe6a4('0x9e')]]}]});})[_0xe6a4('0x20')](handleEntityNotFound(_0x14c041,null))[_0xe6a4('0x20')](function(_0x186b4f){if(_0x186b4f){_0x5a13cb[_0xe6a4('0x9f')]=_[_0xe6a4('0xa0')](_0x186b4f,['Contacts']);if(_0x186b4f[_0xe6a4('0x9d')][_0xe6a4('0x59')]){return _0x186b4f[_0xe6a4('0x9d')][0x0];}var _0x3f181e=_[_0xe6a4('0x1a')](_0x5a13cb[_0xe6a4('0x5f')],{'firstName':_0x5a13cb[_0xe6a4('0x5f')][_0xe6a4('0x86')],'ListId':_0x186b4f['id']});_0x3f181e[_0x5a13cb[_0xe6a4('0x5f')][_0xe6a4('0x9a')]]=_0x5a13cb[_0xe6a4('0x5f')][_0xe6a4('0x86')];return db['CmContact']['create'](_0x3f181e,{'fields':_0x805d01,'raw':!![]});}})[_0xe6a4('0x20')](handleEntityNotFound(_0x14c041,null))[_0xe6a4('0x20')](function(_0x5a79c2){if(_0x5a79c2){_0x5a13cb[_0xe6a4('0xa1')]=_0x5a79c2;var _0x1d805c={'ContactId':_0x5a79c2['id'],'phone':_0x5a13cb[_0xe6a4('0x5f')][_0xe6a4('0x86')],'SmsAccountId':_0x4a4c48[_0xe6a4('0x65')]['id']};var _0x374e0c={'ContactId':_0x5a79c2['id'],'SmsAccountId':_0x4a4c48[_0xe6a4('0x65')]['id'],'closed':![]};return db[_0xe6a4('0xa2')]['find']({'where':_0x374e0c})[_0xe6a4('0x20')](function(_0x3474fb){if(_0x3474fb){return[_0x3474fb,![]];}return db['SmsInteraction'][_0xe6a4('0x5e')](_0x1d805c)[_0xe6a4('0x20')](function(_0x555a9b){return[_0x555a9b,!![]];});});}})[_0xe6a4('0xa3')](function(_0x3a9f66,_0x413bbc){_0x5a13cb[_0xe6a4('0xa4')]=_0x3a9f66[_0xe6a4('0x38')]({'plain':!![]});_0x5a13cb[_0xe6a4('0xa4')][_0xe6a4('0xa5')]=![];if(_0x413bbc){if(_0x5a13cb[_0xe6a4('0x78')][_0xe6a4('0xa6')]){_0x5a13cb[_0xe6a4('0x79')][_0xe6a4('0xa7')]({'id':0x0,'priority':_0x5a13cb[_0xe6a4('0x79')][_0xe6a4('0x59')]+0x1,'app':_0xe6a4('0xa8'),'appdata':_0xe6a4('0xa9'),'interval':_0xe6a4('0xaa')});}_0x5a13cb['interaction']['created']=!![];}return db[_0xe6a4('0xab')]['create']({'phone':_0x5a13cb[_0xe6a4('0x5f')][_0xe6a4('0x86')],'messageId':_0x5a13cb[_0xe6a4('0x5f')]['messageId'],'body':_0x5a13cb[_0xe6a4('0x5f')][_0xe6a4('0x5f')],'SmsAccountId':_0x4a4c48['params']['id'],'SmsInteractionId':_0x3a9f66['id'],'direction':'in','ContactId':_0x3a9f66[_0xe6a4('0xac')],'AttachmentId':_0x5a13cb[_0xe6a4('0x5f')][_0xe6a4('0xad')]});})[_0xe6a4('0x20')](function(_0x3cba85){_0x5a13cb['message']=_0x3cba85;if(_0x5a13cb[_0xe6a4('0xa4')][_0xe6a4('0xae')]){return db['User'][_0xe6a4('0x5d')]({'attributes':['id',_0xe6a4('0x3d')],'where':{'id':_0x5a13cb[_0xe6a4('0xa4')]['UserId']}})['then'](function(_0x51e7c7){if(_0x51e7c7){_0x5a13cb['applications'][_0xe6a4('0xaf')]({'id':0x0,'priority':0x0,'app':_0xe6a4('0xb0'),'appdata':_0x51e7c7[_0xe6a4('0x3d')]+','+(_0x5a13cb[_0xe6a4('0x78')][_0xe6a4('0xb1')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xe6a4('0xb2'),'startRouting',_0x5a13cb);});}return respondWithRpcPromise(_0xe6a4('0xb2'),'startRouting',_0x5a13cb);})[_0xe6a4('0x20')](function(_0xdcd314){if(_0xdcd314){var _0x3dc23f=0xc8;var _0x105769=_0xe6a4('0xb3');logger[_0xe6a4('0x21')](_0xe6a4('0x24'),_0x105769,_0x3dc23f,_0xe6a4('0xb4'));logger[_0xe6a4('0x23')](_0xe6a4('0xb5'),_0x105769,_0x3dc23f,_0xe6a4('0xb4'),JSON[_0xe6a4('0x26')](_0xdcd314));if(_0x5a13cb['account'][_0xe6a4('0x43')]===_0xe6a4('0x83')){return _0x14c041['status'](_0x3dc23f)['set'](_0xe6a4('0xb6'),_0xe6a4('0xb7'))[_0xe6a4('0xb8')](_0xe6a4('0xb9'));}else{return _0x14c041[_0xe6a4('0x3b')](_0x3dc23f)['json'](_0xdcd314);}}})['catch'](handleError(_0x14c041,null));};exports[_0xe6a4('0xba')]=function(_0x142b21,_0x48c4e5,_0x22d1ff){return db['SmsAccount'][_0xe6a4('0x6a')]({'where':{'id':_0x142b21[_0xe6a4('0x65')]['id']}})[_0xe6a4('0x20')](handleEntityNotFound(_0x48c4e5,null))[_0xe6a4('0x20')](function(_0x145c5e){if(_0x145c5e){return db['sequelize']['transaction'](function(_0x39285b){return db[_0xe6a4('0x76')][_0xe6a4('0x37')]({'where':{'SmsAccountId':_0x142b21[_0xe6a4('0x65')]['id']},'transaction':_0x39285b})[_0xe6a4('0x20')](function(_0x525f6d){var _0x2186c1=_[_0xe6a4('0x3f')](_0x142b21['body'],function(_0x15bf3e){_0x15bf3e[_0xe6a4('0x6d')]=_0x142b21[_0xe6a4('0x65')]['id'];return _0x15bf3e;});return db[_0xe6a4('0x76')]['bulkCreate'](_0x2186c1,{'transaction':_0x39285b});});})[_0xe6a4('0x20')](function(){return db[_0xe6a4('0x76')][_0xe6a4('0xbb')]({'where':{'SmsAccountId':_0x142b21[_0xe6a4('0x65')]['id']},'order':'priority'});});}})[_0xe6a4('0x20')](respondWithResult(_0x48c4e5,null))[_0xe6a4('0x56')](handleError(_0x48c4e5,null));};exports['getApplications']=function(_0x36e949,_0x5e35e3,_0x2eb767){var _0x156b59={};var _0x1d8d14={};var _0x336918;var _0x2aaa6c;return db[_0xe6a4('0x40')][_0xe6a4('0x6a')]({'where':{'id':_0x36e949[_0xe6a4('0x65')]['id']}})['then'](handleEntityNotFound(_0x5e35e3,null))[_0xe6a4('0x20')](function(_0x47e5a1){if(_0x47e5a1){_0x336918=_0x47e5a1;_0x1d8d14[_0xe6a4('0x45')]=_[_0xe6a4('0x46')](db['SmsApplication'][_0xe6a4('0x41')]);_0x1d8d14[_0xe6a4('0x47')]=_[_0xe6a4('0x46')](_0x36e949[_0xe6a4('0x47')]);_0x1d8d14[_0xe6a4('0x48')]=_[_0xe6a4('0x49')](_0x1d8d14[_0xe6a4('0x45')],_0x1d8d14['query']);_0x156b59[_0xe6a4('0x4a')]=_['intersection'](_0x1d8d14['model'],qs[_0xe6a4('0x4b')](_0x36e949['query'][_0xe6a4('0x4b')]));_0x156b59[_0xe6a4('0x4a')]=_0x156b59[_0xe6a4('0x4a')][_0xe6a4('0x59')]?_0x156b59['attributes']:_0x1d8d14[_0xe6a4('0x45')];_0x156b59['order']=qs['sort'](_0x36e949[_0xe6a4('0x47')][_0xe6a4('0x4e')]);_0x156b59[_0xe6a4('0x4f')]=qs[_0xe6a4('0x48')](_[_0xe6a4('0x50')](_0x36e949[_0xe6a4('0x47')],_0x1d8d14['filters']));if(_0x36e949[_0xe6a4('0x47')][_0xe6a4('0x51')]){_0x156b59[_0xe6a4('0x4f')]=_[_0xe6a4('0x5b')](_0x156b59[_0xe6a4('0x4f')],{'$or':_[_0xe6a4('0x3f')](_0x156b59[_0xe6a4('0x4a')],function(_0x3101e0){var _0x4a8392={};_0x4a8392[_0x3101e0]={'$like':'%'+_0x36e949['query'][_0xe6a4('0x51')]+'%'};return _0x4a8392;})});}_0x156b59=_[_0xe6a4('0x5b')]({},_0x156b59,_0x36e949['options']);return _0x336918['getApplications'](_0x156b59);}})[_0xe6a4('0x20')](function(_0x1e8ffb){if(_0x1e8ffb){_0x2aaa6c=_0x1e8ffb[_0xe6a4('0x59')];if(!_0x36e949[_0xe6a4('0x47')][_0xe6a4('0x6b')](_0xe6a4('0x4c'))){_0x156b59[_0xe6a4('0x4d')]=qs[_0xe6a4('0x4d')](_0x36e949[_0xe6a4('0x47')]['limit']);_0x156b59[_0xe6a4('0x2e')]=qs[_0xe6a4('0x2e')](_0x36e949[_0xe6a4('0x47')]['offset']);}return _0x336918[_0xe6a4('0xbc')](_0x156b59);}})['then'](function(_0x5156be){if(_0x5156be){return _0x5156be?{'count':_0x2aaa6c,'rows':_0x5156be}:null;}})[_0xe6a4('0x20')](respondWithResult(_0x5e35e3,null))['catch'](handleError(_0x5e35e3,null));};exports['getInteractions']=function(_0x41197b,_0x49971b,_0x306ffa){var _0x8989ab={'raw':![],'where':{}};var _0x3c530c={};var _0x220612={'count':0x0,'rows':[]};return db['SmsAccount'][_0xe6a4('0x6a')]({'where':{'id':_0x41197b[_0xe6a4('0x65')]['id']}})[_0xe6a4('0x20')](handleEntityNotFound(_0x49971b,null))[_0xe6a4('0x20')](function(_0x34efbf){if(_0x34efbf){_0x3c530c['model']=_['keys'](db[_0xe6a4('0xa2')][_0xe6a4('0x41')]);_0x3c530c['query']=_[_0xe6a4('0x46')](_0x41197b[_0xe6a4('0x47')]);_0x3c530c[_0xe6a4('0x48')]=_[_0xe6a4('0x49')](_0x3c530c['model'],_0x3c530c['query']);_0x8989ab[_0xe6a4('0x4a')]=_[_0xe6a4('0x49')](_0x3c530c[_0xe6a4('0x45')],qs[_0xe6a4('0x4b')](_0x41197b[_0xe6a4('0x47')][_0xe6a4('0x4b')]));_0x8989ab[_0xe6a4('0x4a')]=_0x8989ab[_0xe6a4('0x4a')][_0xe6a4('0x59')]?_0x8989ab[_0xe6a4('0x4a')]:_0x3c530c[_0xe6a4('0x45')];if(!_0x41197b['query'][_0xe6a4('0x6b')]('nolimit')){_0x8989ab['limit']=qs['limit'](_0x41197b[_0xe6a4('0x47')][_0xe6a4('0x4d')]);_0x8989ab[_0xe6a4('0x2e')]=qs[_0xe6a4('0x2e')](_0x41197b['query']['offset']);}_0x8989ab[_0xe6a4('0x6c')]=qs[_0xe6a4('0x4e')](_0x41197b['query'][_0xe6a4('0x4e')]);_0x8989ab['where']=qs['filters'](_[_0xe6a4('0x50')](_0x41197b[_0xe6a4('0x47')],_0x3c530c['filters']));_0x8989ab[_0xe6a4('0x4f')][_0xe6a4('0x6d')]=_0x34efbf['id'];if(_0x41197b[_0xe6a4('0x47')][_0xe6a4('0x51')]){_0x8989ab[_0xe6a4('0x4f')]=_['merge'](_0x8989ab[_0xe6a4('0x4f')],{'$or':_[_0xe6a4('0x3f')](_0x8989ab['attributes'],function(_0x30fa53){var _0x577bea={};_0x577bea[_0x30fa53]={'$like':'%'+_0x41197b[_0xe6a4('0x47')]['filter']+'%'};return _0x577bea;})});}_0x8989ab=_[_0xe6a4('0x5b')]({},_0x8989ab,_0x41197b[_0xe6a4('0x5c')]);return db[_0xe6a4('0xa2')][_0xe6a4('0x30')]({'where':_0x8989ab[_0xe6a4('0x4f')]})[_0xe6a4('0x20')](function(_0x42369f){_0x220612[_0xe6a4('0x30')]=_0x42369f;if(_0x41197b['query'][_0xe6a4('0x53')]){_0x8989ab[_0xe6a4('0x5a')]=[{'model':db[_0xe6a4('0x7b')],'as':_0xe6a4('0xbd'),'required':![]},{'model':db['User'],'as':_0xe6a4('0xbe'),'attributes':['name',_0xe6a4('0xbf'),_0xe6a4('0xc0')],'required':![]},{'model':db[_0xe6a4('0xc1')],'as':_0xe6a4('0xc2'),'attributes':['id','name',_0xe6a4('0xc3')],'where':_0x41197b['query'][_0xe6a4('0xc4')]?{'id':_0x41197b[_0xe6a4('0x47')][_0xe6a4('0xc4')]}:undefined,'required':_0x41197b[_0xe6a4('0x47')]['tag']?!![]:![]}];}return db[_0xe6a4('0xa2')][_0xe6a4('0x54')](_0x8989ab);})[_0xe6a4('0x20')](function(_0x249e25){_0x220612[_0xe6a4('0x55')]=_0x249e25;return _0x220612;});}})[_0xe6a4('0x20')](respondWithFilteredResult(_0x49971b,_0x8989ab))['catch'](handleError(_0x49971b,null));};exports[_0xe6a4('0xb8')]=function(_0x4e36cb,_0x2eecf0,_0x1d9875){var _0x3b417a,_0x39fef8,_0x55073b;if(_[_0xe6a4('0x95')](_0x4e36cb[_0xe6a4('0x5f')][_0xe6a4('0x5f')])||_0x4e36cb[_0xe6a4('0x5f')][_0xe6a4('0x5f')]===''){throw new db[(_0xe6a4('0x96'))][(_0xe6a4('0x97'))](_0xe6a4('0x99'));}if(_['isNil'](_0x4e36cb[_0xe6a4('0x5f')]['to'])){throw new db[(_0xe6a4('0x96'))][(_0xe6a4('0x97'))](_0xe6a4('0xc5'));}_0x3b417a=_0x4e36cb[_0xe6a4('0x5f')]['to'];return db[_0xe6a4('0x40')][_0xe6a4('0x5d')]({'where':{'id':_0x4e36cb['params']['id']},'include':[{'model':db[_0xe6a4('0x9c')],'as':_0xe6a4('0xc6'),'include':[{'model':db['CmContact'],'as':_0xe6a4('0x9d'),'where':{'mobile':_0x3b417a},'limit':0x1,'order':[[_0xe6a4('0x7f'),_0xe6a4('0x9e')]]}]}]})[_0xe6a4('0x20')](handleEntityNotFound(_0x2eecf0,null))[_0xe6a4('0x20')](function(_0x4deb52){if(_0x4deb52&&_0x4deb52[_0xe6a4('0xc6')]){_0x39fef8=_0x4deb52['get']({'plain':!![]});if(_0x39fef8['List']&&_0x39fef8[_0xe6a4('0xc6')][_0xe6a4('0x9d')][_0xe6a4('0x59')]){return _0x39fef8['List'][_0xe6a4('0x9d')][0x0];}return db[_0xe6a4('0x7b')][_0xe6a4('0x5e')](_[_0xe6a4('0x1a')](_0x4e36cb[_0xe6a4('0x5f')],{'firstName':_0x3b417a,'mobile':_0x3b417a,'phone':_0x3b417a,'ListId':_0x39fef8[_0xe6a4('0x81')]}));}})['then'](handleEntityNotFound(_0x2eecf0,null))[_0xe6a4('0x20')](function(_0x2b29b9){if(_0x2b29b9){_0x55073b=_0x2b29b9;return db[_0xe6a4('0xa2')][_0xe6a4('0x5d')]({'where':{'ContactId':_0x55073b['id'],'closed':![],'SmsAccountId':_0x39fef8['id']}})['then'](function(_0x46a4d1){if(_0x46a4d1){return[_0x46a4d1,![]];}return db[_0xe6a4('0xa2')][_0xe6a4('0x5e')]({'UserId':_0x4e36cb[_0xe6a4('0x61')]['id'],'ContactId':_0x55073b['id'],'SmsAccountId':_0x39fef8['id'],'phone':_0x3b417a,'firstMsgDirection':_0xe6a4('0xc7'),'Messages':[_[_0xe6a4('0x5b')](_0x4e36cb['body'],{'read':![],'body':_0x4e36cb['body'][_0xe6a4('0x5f')],'phone':_0x3b417a,'SmsAccountId':_0x39fef8['id'],'UserId':_0x4e36cb[_0xe6a4('0x61')]['id'],'ContactId':_0x55073b['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0xe6a4('0x20')](function(_0x374590){return[_0x374590,!![]];});});}})['spread'](function(_0x4e31b1,_0x5ada7f){if(_0x5ada7f){return _0x4e31b1;}return db[_0xe6a4('0xab')][_0xe6a4('0x5e')](_[_0xe6a4('0x5b')](_0x4e36cb[_0xe6a4('0x5f')],{'read':![],'body':_0x4e36cb[_0xe6a4('0x5f')]['body'],'phone':_0x3b417a,'SmsAccountId':_0x39fef8['id'],'SmsInteractionId':_0x4e31b1['id'],'UserId':_0x4e36cb[_0xe6a4('0x61')]['id'],'ContactId':_0x55073b['id']}))['then'](function(_0x1e2cba){_0x4e31b1[_0xe6a4('0xc8')][_0xe6a4('0xc9')]=[];_0x4e31b1['dataValues'][_0xe6a4('0xc9')][_0xe6a4('0xa7')](_0x1e2cba[_0xe6a4('0xc8')]);return _0x4e31b1;});})[_0xe6a4('0x20')](respondWithResult(_0x2eecf0,null))[_0xe6a4('0x56')](handleError(_0x2eecf0,null));};exports[_0xe6a4('0x3b')]=function(_0x4247a9,_0x4810f6,_0x5491e6){if(_0x4247a9[_0xe6a4('0x5f')]['id']){delete _0x4247a9[_0xe6a4('0x5f')]['id'];}var _0x566a72,_0x5e9906,_0x112a4c;return db['SmsAccount'][_0xe6a4('0x5d')]({'where':{'id':_0x4247a9['params']['id']}})[_0xe6a4('0x20')](handleEntityNotFound(_0x4810f6,null))[_0xe6a4('0x20')](function(_0x289a6d){if(_0x289a6d){_0x112a4c=_0x289a6d;logger[_0xe6a4('0x23')](_0xe6a4('0x24'),_0xe6a4('0x3b'),_0xe6a4('0xca'),_0x289a6d[_0xe6a4('0x43')],util[_0xe6a4('0xcb')](_0x4247a9[_0xe6a4('0x5f')],{'showHidden':![],'depth':null}));switch(_0x289a6d[_0xe6a4('0x43')]){case _0xe6a4('0xcc'):if(_0x4247a9[_0xe6a4('0x5f')][_0xe6a4('0xcd')]&&_0x4247a9['body'][_0xe6a4('0x3b')]){_0x5e9906=_0x4247a9[_0xe6a4('0x5f')][_0xe6a4('0x3b')];return db[_0xe6a4('0xab')]['find']({'where':{'messageId':_0x4247a9[_0xe6a4('0x5f')][_0xe6a4('0xcd')]}});}break;case _0xe6a4('0x88'):if(_0x4247a9[_0xe6a4('0x5f')]['requestid']&&_0x4247a9[_0xe6a4('0x5f')][_0xe6a4('0xce')]){_0x5e9906=_0x4247a9[_0xe6a4('0x5f')]['statusInt'];return db[_0xe6a4('0xab')][_0xe6a4('0x5d')]({'where':{'messageId':_0x4247a9[_0xe6a4('0x5f')][_0xe6a4('0xcf')]}});}break;case _0xe6a4('0xd0'):if(_0x4247a9[_0xe6a4('0x5f')]['message_id']&&_0x4247a9[_0xe6a4('0x5f')][_0xe6a4('0xd1')]){_0x5e9906=_0x4247a9[_0xe6a4('0x5f')]['status_code'];return db['SmsMessage'][_0xe6a4('0x5d')]({'where':{'messageId':_0x4247a9[_0xe6a4('0x5f')][_0xe6a4('0x89')]}});}break;case _0xe6a4('0xd2'):var _0x282b30=_0x4247a9[_0xe6a4('0x5f')][_0xe6a4('0x8c')][0x0];if(_0x282b30[_0xe6a4('0x85')]&&_0x282b30[_0xe6a4('0x3b')]['groupName']==='DELIVERED'){_0x5e9906=_0x282b30[_0xe6a4('0x3b')]['groupName'];return db[_0xe6a4('0xab')][_0xe6a4('0x5d')]({'where':{'messageId':_0x282b30[_0xe6a4('0x85')]}});}break;case _0xe6a4('0x8f'):if(_0x4247a9['body'][_0xe6a4('0x85')]&&_0x4247a9[_0xe6a4('0x5f')]['status']){_0x5e9906=_0x4247a9[_0xe6a4('0x5f')][_0xe6a4('0x3b')];return db['SmsMessage'][_0xe6a4('0x5d')]({'where':{'messageId':_0x4247a9['body'][_0xe6a4('0x85')]}});}break;case'bandwidth':if(_0x4247a9[_0xe6a4('0x5f')][0x0][_0xe6a4('0x29')]['id']){_0x5e9906=_0x4247a9['body'][0x0][_0xe6a4('0x43')];return db['SmsMessage'][_0xe6a4('0x5d')]({'where':{'messageId':_0x4247a9['body'][0x0][_0xe6a4('0x29')]['id']}});}break;case _0xe6a4('0x93'):if(_0x4247a9[_0xe6a4('0x5f')][_0xe6a4('0xd3')]&&_0x4247a9[_0xe6a4('0x5f')][_0xe6a4('0x3b')]){_0x5e9906=_0x4247a9[_0xe6a4('0x5f')][_0xe6a4('0x3b')];return db[_0xe6a4('0xab')][_0xe6a4('0x5d')]({'where':{'messageId':_0x4247a9['body']['redif']}});}break;}}})[_0xe6a4('0x20')](handleEntityNotFound(_0x4810f6,null))['then'](function(_0x50032a){if(_0x50032a){_0x566a72=_0x50032a;switch(_0x112a4c['type']){case'skebby':if(_0x5e9906==='DELIVERED'){return _0x566a72[_0xe6a4('0x36')]({'read':!![]});}else{logger[_0xe6a4('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe6a4('0x3b'),'skebby',util[_0xe6a4('0xcb')](_0x4247a9[_0xe6a4('0x5f')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x5e9906==='1'){return _0x566a72[_0xe6a4('0x36')]({'read':!![]});}else{logger[_0xe6a4('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xe6a4('0xcc'),util[_0xe6a4('0xcb')](_0x4247a9[_0xe6a4('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xe6a4('0xd0'):if(!_0x4247a9[_0xe6a4('0x5f')]['error_code']&&_0x5e9906>=0xc8&&_0x5e9906<=0xce){return _0x566a72[_0xe6a4('0x36')]({'read':!![]});}else{logger[_0xe6a4('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe6a4('0x3b'),_0xe6a4('0xd0'),util['inspect'](_0x4247a9[_0xe6a4('0x5f')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x4c0b2d=_0x4247a9['body'][_0xe6a4('0x8c')][0x0];if(_0x4c0b2d[_0xe6a4('0x3b')]['groupName']===_0xe6a4('0xd4')){return _0x566a72[_0xe6a4('0x36')]({'read':!![]});}else{logger[_0xe6a4('0x27')](_0xe6a4('0x24'),_0xe6a4('0x3b'),_0xe6a4('0xd2'),util[_0xe6a4('0xcb')](_0x4247a9[_0xe6a4('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xe6a4('0x8f'):if(_0x5e9906==_0xe6a4('0xd5')||_0x5e9906==_0xe6a4('0xd6')){return _0x566a72[_0xe6a4('0x36')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe6a4('0x3b'),_0xe6a4('0x8f'),util[_0xe6a4('0xcb')](_0x4247a9[_0xe6a4('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xe6a4('0x92'):if(_0x5e9906==_0xe6a4('0xd7')){return _0x566a72[_0xe6a4('0x36')]({'read':!![]});}else{logger[_0xe6a4('0x27')](_0xe6a4('0x24'),_0xe6a4('0x3b'),'bandwidth',util[_0xe6a4('0xcb')](_0x4247a9['body'],{'showHidden':![],'depth':null}));}break;case _0xe6a4('0x93'):if(_0x5e9906===_0xe6a4('0xd8')||_0x5e9906===_0xe6a4('0xd9')){return _0x566a72[_0xe6a4('0x36')]({'read':!![]});}else{logger[_0xe6a4('0x27')](_0xe6a4('0x24'),_0xe6a4('0x3b'),_0xe6a4('0x93'),util['inspect'](_0x4247a9[_0xe6a4('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x566a72;}})[_0xe6a4('0x20')](respondWithResult(_0x4810f6,null))[_0xe6a4('0x56')](handleError(_0x4810f6,null));};exports[_0xe6a4('0xda')]=function(_0x38cb27,_0x24446f,_0x26c059){var _0x3c70b7,_0x2ed95f,_0x57790d;return db['SmsAccount']['find']({'where':{'id':_0x38cb27[_0xe6a4('0x65')]['id']}})[_0xe6a4('0x20')](handleEntityNotFound(_0x24446f,null))[_0xe6a4('0x20')](function(_0x30debe){if(_0x30debe){_0x57790d=_0x30debe;logger[_0xe6a4('0x23')](_0xe6a4('0x24'),_0xe6a4('0x3b'),_0xe6a4('0xca'),_0x30debe['type'],util[_0xe6a4('0xcb')](_0x38cb27[_0xe6a4('0x47')],{'showHidden':![],'depth':null}));switch(_0x30debe[_0xe6a4('0x43')]){case'csc':if(_0x38cb27[_0xe6a4('0x47')]['message-id']&&_0x38cb27['query'][_0xe6a4('0xdb')]){_0x2ed95f=_0x38cb27['query'][_0xe6a4('0xdb')];return db[_0xe6a4('0xab')][_0xe6a4('0x5d')]({'where':{'messageId':_0x38cb27[_0xe6a4('0x47')][_0xe6a4('0xdc')]}});}break;}}})['then'](handleEntityNotFound(_0x24446f,null))[_0xe6a4('0x20')](function(_0x22b568){if(_0x22b568){_0x3c70b7=_0x22b568;switch(_0x57790d[_0xe6a4('0x43')]){case _0xe6a4('0xdd'):if(_0x2ed95f==='2'||_0x2ed95f==='6'){return _0x3c70b7['update']({'read':!![]});}else{logger[_0xe6a4('0x27')](_0xe6a4('0x24'),_0xe6a4('0x3b'),_0xe6a4('0xdd'),util[_0xe6a4('0xcb')](_0x38cb27[_0xe6a4('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x3c70b7;}})[_0xe6a4('0x20')](respondWithResult(_0x24446f,null))['catch'](handleError(_0x24446f,null));};exports['addAgents']=function(_0x40d3d7,_0x461665,_0x30a0e6){return db[_0xe6a4('0x40')][_0xe6a4('0x5d')]({'where':{'id':_0x40d3d7[_0xe6a4('0x65')]['id']}})[_0xe6a4('0x20')](handleEntityNotFound(_0x461665,null))[_0xe6a4('0x20')](function(_0x4fe338){if(_0x4fe338){return _0x4fe338[_0xe6a4('0xde')](_0x40d3d7['body'][_0xe6a4('0x6f')],_['omit'](_0x40d3d7['body'],[_0xe6a4('0x6f'),'id'])||{})[_0xe6a4('0xa3')](function(_0x2d3194){for(var _0x3330b0=0x0;_0x3330b0<_0x40d3d7['body']['ids'][_0xe6a4('0x59')];_0x3330b0+=0x1){socket['emit']('userSmsAccount:save',{'UserId':Number(_0x40d3d7['body'][_0xe6a4('0x6f')][_0x3330b0]),'SmsAccountId':Number(_0x40d3d7[_0xe6a4('0x65')]['id'])});}return _0x2d3194;});}})[_0xe6a4('0x20')](respondWithResult(_0x461665,null))[_0xe6a4('0x56')](handleError(_0x461665,null));};exports[_0xe6a4('0xdf')]=function(_0x777b02,_0x5d726b,_0x5b1e4f){return db[_0xe6a4('0x40')][_0xe6a4('0x5d')]({'where':{'id':_0x777b02[_0xe6a4('0x65')]['id']}})['then'](handleEntityNotFound(_0x5d726b,null))['then'](function(_0x2632ae){if(_0x2632ae){return _0x2632ae[_0xe6a4('0xdf')](_0x777b02[_0xe6a4('0x47')][_0xe6a4('0x6f')])[_0xe6a4('0x20')](function(){if(_[_0xe6a4('0xe0')](_0x777b02[_0xe6a4('0x47')][_0xe6a4('0x6f')])){for(var _0x22748c=0x0;_0x22748c<_0x777b02[_0xe6a4('0x47')][_0xe6a4('0x6f')]['length'];_0x22748c+=0x1){socket[_0xe6a4('0xe1')](_0xe6a4('0xe2'),{'UserId':Number(_0x777b02[_0xe6a4('0x47')][_0xe6a4('0x6f')][_0x22748c]),'SmsAccountId':Number(_0x777b02[_0xe6a4('0x65')]['id'])});}}else{socket['emit'](_0xe6a4('0xe2'),{'UserId':Number(_0x777b02[_0xe6a4('0x47')][_0xe6a4('0x6f')]),'SmsAccountId':Number(_0x777b02[_0xe6a4('0x65')]['id'])});}});}})[_0xe6a4('0x20')](respondWithStatusCode(_0x5d726b,null))['catch'](handleError(_0x5d726b,null));};exports[_0xe6a4('0xe3')]=function(_0x51a639,_0x45ceb7,_0x379d96){var _0x48031a={};var _0x3dcca2={};var _0x5a9c96;var _0x5e2bfa;return db[_0xe6a4('0x40')][_0xe6a4('0x6a')]({'where':{'id':_0x51a639[_0xe6a4('0x65')]['id']}})[_0xe6a4('0x20')](handleEntityNotFound(_0x45ceb7,null))[_0xe6a4('0x20')](function(_0x8b3200){if(_0x8b3200){_0x5a9c96=_0x8b3200;_0x3dcca2[_0xe6a4('0x45')]=_[_0xe6a4('0x46')](db[_0xe6a4('0xe4')][_0xe6a4('0x41')]);_0x3dcca2[_0xe6a4('0x47')]=_['keys'](_0x51a639[_0xe6a4('0x47')]);_0x3dcca2['filters']=_[_0xe6a4('0x49')](_0x3dcca2['model'],_0x3dcca2['query']);_0x48031a[_0xe6a4('0x4a')]=_['intersection'](_0x3dcca2[_0xe6a4('0x45')],qs[_0xe6a4('0x4b')](_0x51a639[_0xe6a4('0x47')][_0xe6a4('0x4b')]));_0x48031a[_0xe6a4('0x4a')]=_0x48031a[_0xe6a4('0x4a')]['length']?_0x48031a[_0xe6a4('0x4a')]:_0x3dcca2[_0xe6a4('0x45')];_0x48031a['order']=qs['sort'](_0x51a639[_0xe6a4('0x47')][_0xe6a4('0x4e')]);_0x48031a[_0xe6a4('0x4f')]=qs[_0xe6a4('0x48')](_[_0xe6a4('0x50')](_0x51a639[_0xe6a4('0x47')],_0x3dcca2[_0xe6a4('0x48')]));if(_0x51a639[_0xe6a4('0x47')][_0xe6a4('0x51')]){_0x48031a[_0xe6a4('0x4f')]=_[_0xe6a4('0x5b')](_0x48031a[_0xe6a4('0x4f')],{'$or':_['map'](_0x48031a[_0xe6a4('0x4a')],function(_0x2bf254){var _0x76db3d={};_0x76db3d[_0x2bf254]={'$like':'%'+_0x51a639[_0xe6a4('0x47')][_0xe6a4('0x51')]+'%'};return _0x76db3d;})});}_0x48031a=_[_0xe6a4('0x5b')]({},_0x48031a,_0x51a639[_0xe6a4('0x5c')]);return _0x5a9c96[_0xe6a4('0xe3')](_0x48031a);}})[_0xe6a4('0x20')](function(_0x225dd2){if(_0x225dd2){_0x5e2bfa=_0x225dd2['length'];if(!_0x51a639[_0xe6a4('0x47')][_0xe6a4('0x6b')](_0xe6a4('0x4c'))){_0x48031a[_0xe6a4('0x4d')]=qs[_0xe6a4('0x4d')](_0x51a639[_0xe6a4('0x47')]['limit']);_0x48031a[_0xe6a4('0x2e')]=qs[_0xe6a4('0x2e')](_0x51a639[_0xe6a4('0x47')]['offset']);}return _0x5a9c96[_0xe6a4('0xe3')](_0x48031a);}})[_0xe6a4('0x20')](function(_0x1b4201){if(_0x1b4201){return _0x1b4201?{'count':_0x5e2bfa,'rows':_0x1b4201}:null;}})[_0xe6a4('0x20')](respondWithResult(_0x45ceb7,null))[_0xe6a4('0x56')](handleError(_0x45ceb7,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index cc8d5e7..f815900 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 _0x7b97=['emit','hasOwnProperty','setMaxListeners','update'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x7b97,0x126));var _0x77b9=function(_0x72a33d,_0x5691da){_0x72a33d=_0x72a33d-0x0;var _0x2621d5=_0x7b97[_0x72a33d];return _0x2621d5;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x77b9('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0x77b9('0x1'),'afterDestroy':'remove'};function emitEvent(_0x6c661b){return function(_0x384627,_0x2a3c77,_0x4151b7){SmsAccountEvents[_0x77b9('0x2')](_0x6c661b+':'+_0x384627['id'],_0x384627);SmsAccountEvents[_0x77b9('0x2')](_0x6c661b,_0x384627);_0x4151b7(null);};}for(var e in events){if(events[_0x77b9('0x3')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x73d4=['exports','events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x73d4,0x169));var _0x473d=function(_0x5ea451,_0x133637){_0x5ea451=_0x5ea451-0x0;var _0x37a06a=_0x73d4[_0x5ea451];return _0x37a06a;};'use strict';var EventEmitter=require(_0x473d('0x0'));var SmsAccount=require(_0x473d('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x473d('0x2')](0x0);var events={'afterCreate':_0x473d('0x3'),'afterUpdate':'update','afterDestroy':_0x473d('0x4')};function emitEvent(_0x20786a){return function(_0xd748c6,_0x3b2f50,_0x1d84d1){SmsAccountEvents[_0x473d('0x5')](_0x20786a+':'+_0xd748c6['id'],_0xd748c6);SmsAccountEvents[_0x473d('0x5')](_0x20786a,_0xd748c6);_0x1d84d1(null);};}for(var e in events){if(events[_0x473d('0x6')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x473d('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 be5d9ab..740c6aa 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 _0x9e07=['moment','bluebird','request-promise','path','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','lodash','util','../../config/logger'];(function(_0x452820,_0x476b44){var _0x33015c=function(_0x1938c5){while(--_0x1938c5){_0x452820['push'](_0x452820['shift']());}};_0x33015c(++_0x476b44);}(_0x9e07,0xb1));var _0x79e0=function(_0x446230,_0x4be1d3){_0x446230=_0x446230-0x0;var _0xba9a89=_0x9e07[_0x446230];return _0xba9a89;};'use strict';var _=require(_0x79e0('0x0'));var util=require(_0x79e0('0x1'));var logger=require(_0x79e0('0x2'))('api');var moment=require(_0x79e0('0x3'));var BPromise=require(_0x79e0('0x4'));var rp=require(_0x79e0('0x5'));var fs=require('fs');var path=require(_0x79e0('0x6'));var rimraf=require('rimraf');var config=require(_0x79e0('0x7'));var attributes=require(_0x79e0('0x8'));module[_0x79e0('0x9')]=function(_0x5437ba,_0x1c6735){return _0x5437ba[_0x79e0('0xa')](_0x79e0('0xb'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22e9=['../../config/logger','request-promise','path','rimraf','./smsAccount.attributes','exports','define','sms_accounts','lodash','util'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x22e9,0x148));var _0x922e=function(_0x32aac9,_0x5eb63d){_0x32aac9=_0x32aac9-0x0;var _0x51bafd=_0x22e9[_0x32aac9];return _0x51bafd;};'use strict';var _=require(_0x922e('0x0'));var util=require(_0x922e('0x1'));var logger=require(_0x922e('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x922e('0x3'));var fs=require('fs');var path=require(_0x922e('0x4'));var rimraf=require(_0x922e('0x5'));var config=require('../../config/environment');var attributes=require(_0x922e('0x6'));module[_0x922e('0x7')]=function(_0x502fce,_0x300e5a){return _0x502fce[_0x922e('0x8')]('SmsAccount',attributes,{'tableName':_0x922e('0x9'),'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 16eec22..28cc9f5 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 _0x85a2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','where','attributes','map','include','model','lodash','util','moment'];(function(_0x4e55a9,_0x241b22){var _0x4a9b67=function(_0x2a3bd1){while(--_0x2a3bd1){_0x4e55a9['push'](_0x4e55a9['shift']());}};_0x4a9b67(++_0x241b22);}(_0x85a2,0x135));var _0x285a=function(_0x1dc591,_0x22643a){_0x1dc591=_0x1dc591-0x0;var _0x2d107b=_0x85a2[_0x1dc591];return _0x2d107b;};'use strict';var _=require(_0x285a('0x0'));var util=require(_0x285a('0x1'));var moment=require(_0x285a('0x2'));var BPromise=require(_0x285a('0x3'));var rs=require(_0x285a('0x4'));var fs=require('fs');var Redis=require(_0x285a('0x5'));var db=require(_0x285a('0x6'))['db'];var utils=require(_0x285a('0x7'));var logger=require(_0x285a('0x8'))('rpc');var config=require(_0x285a('0x9'));var jayson=require(_0x285a('0xa'));var client=jayson[_0x285a('0xb')][_0x285a('0xc')]({'port':0x232a});config[_0x285a('0xd')]=_[_0x285a('0xe')](config['redis'],{'host':_0x285a('0xf'),'port':0x18eb});var socket=require(_0x285a('0x10'))(new Redis(config[_0x285a('0xd')]));require(_0x285a('0x11'))['register'](socket);function respondWithRpcPromise(_0x309ffa,_0x54aee4,_0x86ceda){return new BPromise(function(_0xc26fcc,_0x1d524b){return client[_0x285a('0x12')](_0x309ffa,_0x86ceda)[_0x285a('0x13')](function(_0x1315e2){logger[_0x285a('0x14')](_0x285a('0x15'),_0x54aee4,_0x285a('0x16'));logger[_0x285a('0x17')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x54aee4,_0x285a('0x16'),JSON[_0x285a('0x18')](_0x1315e2));if(_0x1315e2[_0x285a('0x19')]){if(_0x1315e2['error'][_0x285a('0x1a')]===0x1f4){logger[_0x285a('0x19')](_0x285a('0x15'),_0x54aee4,_0x1315e2[_0x285a('0x19')]['message']);return _0x1d524b(_0x1315e2[_0x285a('0x19')]['message']);}logger[_0x285a('0x19')](_0x285a('0x15'),_0x54aee4,_0x1315e2[_0x285a('0x19')][_0x285a('0x1b')]);return _0xc26fcc(_0x1315e2[_0x285a('0x19')][_0x285a('0x1b')]);}else{logger[_0x285a('0x14')](_0x285a('0x15'),_0x54aee4,_0x285a('0x16'));_0xc26fcc(_0x1315e2[_0x285a('0x1c')][_0x285a('0x1b')]);}})[_0x285a('0x1d')](function(_0x271918){logger[_0x285a('0x19')]('SmsAccount,\x20%s,\x20%s',_0x54aee4,_0x271918);_0x1d524b(_0x271918);});});}exports[_0x285a('0x1e')]=function(_0x5ee20d){var _0x4fec04=this;return new Promise(function(_0x327de5,_0x3bf6a9){return db[_0x285a('0x1f')][_0x285a('0x20')]({'raw':_0x5ee20d[_0x285a('0x21')]?_0x5ee20d[_0x285a('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x5ee20d[_0x285a('0x21')]?_0x5ee20d[_0x285a('0x21')][_0x285a('0x22')]||null:null,'attributes':_0x5ee20d[_0x285a('0x21')]?_0x5ee20d[_0x285a('0x21')][_0x285a('0x23')]||null:null,'include':_0x5ee20d[_0x285a('0x21')]?_0x5ee20d[_0x285a('0x21')]['include']?_[_0x285a('0x24')](_0x5ee20d[_0x285a('0x21')][_0x285a('0x25')],function(_0x34cdc4){return{'model':db[_0x34cdc4[_0x285a('0x26')]],'as':_0x34cdc4['as'],'attributes':_0x34cdc4[_0x285a('0x23')],'include':_0x34cdc4[_0x285a('0x25')]?_[_0x285a('0x24')](_0x34cdc4[_0x285a('0x25')],function(_0x21c2b3){return{'model':db[_0x21c2b3['model']],'as':_0x21c2b3['as'],'attributes':_0x21c2b3[_0x285a('0x23')],'include':_0x21c2b3[_0x285a('0x25')]?_[_0x285a('0x24')](_0x21c2b3[_0x285a('0x25')],function(_0x1771ab){return{'model':db[_0x1771ab[_0x285a('0x26')]],'as':_0x1771ab['as'],'attributes':_0x1771ab[_0x285a('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x546c4a){logger[_0x285a('0x14')](_0x285a('0x1e'),_0x5ee20d);logger[_0x285a('0x17')](_0x285a('0x1e'),_0x5ee20d,JSON[_0x285a('0x18')](_0x546c4a));_0x327de5(_0x546c4a);})[_0x285a('0x1d')](function(_0x2c4043){logger[_0x285a('0x19')]('ShowSmsAccount',_0x2c4043[_0x285a('0x1b')],_0x5ee20d);_0x3bf6a9(_0x4fec04['error'](0x1f4,_0x2c4043['message']));});});}; \ No newline at end of file +var _0xa384=['client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','request','then','info','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsAccount,\x20%s,\x20%s','result','catch','SmsAccount','find','options','raw','where','attributes','include','model','map','ShowSmsAccount','debug','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x4b39ce,_0x1b3b7d){var _0x1d8506=function(_0x107df6){while(--_0x107df6){_0x4b39ce['push'](_0x4b39ce['shift']());}};_0x1d8506(++_0x1b3b7d);}(_0xa384,0x12f));var _0x4a38=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0xa384[_0x468b0f];return _0x3e74d9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4a38('0x0'));var BPromise=require(_0x4a38('0x1'));var rs=require(_0x4a38('0x2'));var fs=require('fs');var Redis=require(_0x4a38('0x3'));var db=require(_0x4a38('0x4'))['db'];var utils=require(_0x4a38('0x5'));var logger=require(_0x4a38('0x6'))(_0x4a38('0x7'));var config=require('../../config/environment');var jayson=require(_0x4a38('0x8'));var client=jayson[_0x4a38('0x9')][_0x4a38('0xa')]({'port':0x232a});config[_0x4a38('0xb')]=_[_0x4a38('0xc')](config['redis'],{'host':_0x4a38('0xd'),'port':0x18eb});var socket=require(_0x4a38('0xe'))(new Redis(config[_0x4a38('0xb')]));require(_0x4a38('0xf'))['register'](socket);function respondWithRpcPromise(_0x52b055,_0x54f769,_0x1710c2){return new BPromise(function(_0x4de7e2,_0x15f458){return client[_0x4a38('0x10')](_0x52b055,_0x1710c2)[_0x4a38('0x11')](function(_0x40d416){logger[_0x4a38('0x12')]('SmsAccount,\x20%s,\x20%s',_0x54f769,_0x4a38('0x13'));logger['debug'](_0x4a38('0x14'),_0x54f769,'request\x20sent',JSON[_0x4a38('0x15')](_0x40d416));if(_0x40d416[_0x4a38('0x16')]){if(_0x40d416[_0x4a38('0x16')][_0x4a38('0x17')]===0x1f4){logger[_0x4a38('0x16')]('SmsAccount,\x20%s,\x20%s',_0x54f769,_0x40d416['error']['message']);return _0x15f458(_0x40d416[_0x4a38('0x16')][_0x4a38('0x18')]);}logger[_0x4a38('0x16')](_0x4a38('0x19'),_0x54f769,_0x40d416[_0x4a38('0x16')][_0x4a38('0x18')]);return _0x4de7e2(_0x40d416[_0x4a38('0x16')][_0x4a38('0x18')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x54f769,'request\x20sent');_0x4de7e2(_0x40d416[_0x4a38('0x1a')][_0x4a38('0x18')]);}})[_0x4a38('0x1b')](function(_0x5a0bad){logger[_0x4a38('0x16')](_0x4a38('0x19'),_0x54f769,_0x5a0bad);_0x15f458(_0x5a0bad);});});}exports['ShowSmsAccount']=function(_0x124fe4){var _0x3fe33b=this;return new Promise(function(_0xa844b8,_0xd2a2ea){return db[_0x4a38('0x1c')][_0x4a38('0x1d')]({'raw':_0x124fe4[_0x4a38('0x1e')]?_0x124fe4[_0x4a38('0x1e')][_0x4a38('0x1f')]===undefined?!![]:![]:!![],'where':_0x124fe4[_0x4a38('0x1e')]?_0x124fe4['options'][_0x4a38('0x20')]||null:null,'attributes':_0x124fe4['options']?_0x124fe4['options'][_0x4a38('0x21')]||null:null,'include':_0x124fe4['options']?_0x124fe4[_0x4a38('0x1e')][_0x4a38('0x22')]?_['map'](_0x124fe4[_0x4a38('0x1e')][_0x4a38('0x22')],function(_0x12ee60){return{'model':db[_0x12ee60[_0x4a38('0x23')]],'as':_0x12ee60['as'],'attributes':_0x12ee60[_0x4a38('0x21')],'include':_0x12ee60[_0x4a38('0x22')]?_[_0x4a38('0x24')](_0x12ee60[_0x4a38('0x22')],function(_0x3502fc){return{'model':db[_0x3502fc[_0x4a38('0x23')]],'as':_0x3502fc['as'],'attributes':_0x3502fc[_0x4a38('0x21')],'include':_0x3502fc['include']?_['map'](_0x3502fc[_0x4a38('0x22')],function(_0x2ba8d6){return{'model':db[_0x2ba8d6[_0x4a38('0x23')]],'as':_0x2ba8d6['as'],'attributes':_0x2ba8d6[_0x4a38('0x21')]};}):[]};}):[]};}):[]:[]})[_0x4a38('0x11')](function(_0x58e022){logger['info'](_0x4a38('0x25'),_0x124fe4);logger[_0x4a38('0x26')](_0x4a38('0x25'),_0x124fe4,JSON['stringify'](_0x58e022));_0xa844b8(_0x58e022);})[_0x4a38('0x1b')](function(_0x1a69dd){logger[_0x4a38('0x16')](_0x4a38('0x25'),_0x1a69dd[_0x4a38('0x18')],_0x124fe4);_0xd2a2ea(_0x3fe33b[_0x4a38('0x16')](0x1f4,_0x1a69dd['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 92e385b..6ad2ff0 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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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 09cbf82..492fea1 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 _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x15a819,_0x19d3b3){var _0x36a82f=function(_0x1c8c70){while(--_0x1c8c70){_0x15a819['push'](_0x15a819['shift']());}};_0x36a82f(++_0x19d3b3);}(_0x008c,0x188));var _0xc008=function(_0x241f06,_0x3c7ef8){_0x241f06=_0x241f06-0x0;var _0x2ec3a1=_0x008c[_0x241f06];return _0x2ec3a1;};'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('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file +var _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x513d80,_0x1649db){var _0x174463=function(_0x3b3dcd){while(--_0x3b3dcd){_0x513d80['push'](_0x513d80['shift']());}};_0x174463(++_0x1649db);}(_0x34e8,0x12c));var _0x834e=function(_0x5f473f,_0x9038e0){_0x5f473f=_0x5f473f-0x0;var _0x269387=_0x34e8[_0x5f473f];return _0x269387;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 9bc9e5d..c74defe 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 _0x06e8=['TEXT','*,*,*,*','sequelize','exports','INTEGER','noop'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x06e8,0xf2));var _0x806e=function(_0x37f243,_0x115537){_0x37f243=_0x37f243-0x0;var _0x5e3bf1=_0x06e8[_0x37f243];return _0x5e3bf1;};'use strict';var Sequelize=require(_0x806e('0x0'));module[_0x806e('0x1')]={'priority':{'type':Sequelize[_0x806e('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x806e('0x3')},'appdata':{'type':Sequelize[_0x806e('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x806e('0x5')}}; \ No newline at end of file +var _0x8636=['STRING','noop','TEXT','*,*,*,*','INTEGER'];(function(_0x58b1db,_0x54b45f){var _0x362016=function(_0x10008b){while(--_0x10008b){_0x58b1db['push'](_0x58b1db['shift']());}};_0x362016(++_0x54b45f);}(_0x8636,0x149));var _0x6863=function(_0x1a79c6,_0x5bad0b){_0x1a79c6=_0x1a79c6-0x0;var _0x301647=_0x8636[_0x1a79c6];return _0x301647;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x6863('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x6863('0x1')],'allowNull':![],'defaultValue':_0x6863('0x2')},'appdata':{'type':Sequelize[_0x6863('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x6863('0x1')],'defaultValue':_0x6863('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index b207e6b..21d2209 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 _0xa28b=['send','map','SmsApplication','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','length','include','find','catch','create','body','update','params','rimraf','zip-dir','fast-json-patch','moment','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/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','then','destroy','error','stack','name'];(function(_0x17f85a,_0x12c0c3){var _0x4330c8=function(_0x19cafc){while(--_0x19cafc){_0x17f85a['push'](_0x17f85a['shift']());}};_0x4330c8(++_0x12c0c3);}(_0xa28b,0xab));var _0xba28=function(_0x4a89fb,_0x5a108a){_0x4a89fb=_0x4a89fb-0x0;var _0x265d0b=_0xa28b[_0x4a89fb];return _0x265d0b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xba28('0x0'));var zipdir=require(_0xba28('0x1'));var jsonpatch=require(_0xba28('0x2'));var rp=require('request-promise');var moment=require(_0xba28('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xba28('0x4'));var csv=require(_0xba28('0x5'));var ejs=require(_0xba28('0x6'));var fs=require('fs');var fs_extra=require(_0xba28('0x7'));var _=require(_0xba28('0x8'));var squel=require(_0xba28('0x9'));var crypto=require(_0xba28('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xba28('0xb'));var toCsv=require('to-csv');var querystring=require(_0xba28('0xc'));var Papa=require('papaparse');var Redis=require(_0xba28('0xd'));var authService=require(_0xba28('0xe'));var qs=require(_0xba28('0xf'));var as=require(_0xba28('0x10'));var hardwareService=require(_0xba28('0x11'));var logger=require('../../config/logger')(_0xba28('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xba28('0x13'));var db=require(_0xba28('0x14'))['db'];function respondWithStatusCode(_0x14ce85,_0x3ae370){_0x3ae370=_0x3ae370||0xcc;return function(_0x4ced09){if(_0x4ced09){return _0x14ce85[_0xba28('0x15')](_0x3ae370);}return _0x14ce85[_0xba28('0x16')](_0x3ae370)[_0xba28('0x17')]();};}function respondWithResult(_0x134ffa,_0x1f9cb8){_0x1f9cb8=_0x1f9cb8||0xc8;return function(_0x171521){if(_0x171521){return _0x134ffa['status'](_0x1f9cb8)[_0xba28('0x18')](_0x171521);}};}function respondWithFilteredResult(_0xa1227e,_0x151363){return function(_0x252594){if(_0x252594){var _0x30dff2=typeof _0x151363[_0xba28('0x19')]===_0xba28('0x1a')&&typeof _0x151363[_0xba28('0x1b')]===_0xba28('0x1a');var _0x4c8b9a=_0x252594[_0xba28('0x1c')];var _0x40613a=_0x30dff2?0x0:_0x151363[_0xba28('0x19')];var _0x1f3c7d=_0x30dff2?_0x252594['count']:_0x151363[_0xba28('0x19')]+_0x151363[_0xba28('0x1b')];var _0x54c86a;if(_0x1f3c7d>=_0x4c8b9a){_0x1f3c7d=_0x4c8b9a;_0x54c86a=0xc8;}else{_0x54c86a=0xce;}_0xa1227e[_0xba28('0x16')](_0x54c86a);return _0xa1227e[_0xba28('0x1d')]('Content-Range',_0x40613a+'-'+_0x1f3c7d+'/'+_0x4c8b9a)[_0xba28('0x18')](_0x252594);}return null;};}function patchUpdates(_0x8f3afd){return function(_0x52f190){try{jsonpatch[_0xba28('0x1e')](_0x52f190,_0x8f3afd,!![]);}catch(_0x23753a){return BPromise['reject'](_0x23753a);}return _0x52f190['save']();};}function saveUpdates(_0x2ef473,_0x128a4c){return function(_0x9d3ca9){if(_0x9d3ca9){return _0x9d3ca9['update'](_0x2ef473)[_0xba28('0x1f')](function(_0x3f9969){return _0x3f9969;});}return null;};}function removeEntity(_0x3aa8c0,_0x52f322){return function(_0x1153f2){if(_0x1153f2){return _0x1153f2[_0xba28('0x20')]()[_0xba28('0x1f')](function(){_0x3aa8c0[_0xba28('0x16')](0xcc)[_0xba28('0x17')]();});}};}function handleEntityNotFound(_0x3e930b,_0xc2017e){return function(_0x5607b7){if(!_0x5607b7){_0x3e930b['sendStatus'](0x194);}return _0x5607b7;};}function handleError(_0x13b5c8,_0x56a847){_0x56a847=_0x56a847||0x1f4;return function(_0xc32b6){logger[_0xba28('0x21')](_0xc32b6[_0xba28('0x22')]);if(_0xc32b6['name']){delete _0xc32b6[_0xba28('0x23')];}_0x13b5c8[_0xba28('0x16')](_0x56a847)[_0xba28('0x24')](_0xc32b6);};}exports['index']=function(_0x16b439,_0x396711){var _0x20a4e5={},_0x15b133={},_0x2ee581={'count':0x0,'rows':[]};var _0x54e434=_[_0xba28('0x25')](db[_0xba28('0x26')][_0xba28('0x27')],function(_0x51d369){return{'name':_0x51d369['fieldName'],'type':_0x51d369['type'][_0xba28('0x28')]};});_0x15b133[_0xba28('0x29')]=_[_0xba28('0x25')](_0x54e434,_0xba28('0x23'));_0x15b133[_0xba28('0x2a')]=_[_0xba28('0x2b')](_0x16b439[_0xba28('0x2a')]);_0x15b133[_0xba28('0x2c')]=_[_0xba28('0x2d')](_0x15b133[_0xba28('0x29')],_0x15b133['query']);_0x20a4e5[_0xba28('0x2e')]=_['intersection'](_0x15b133[_0xba28('0x29')],qs[_0xba28('0x2f')](_0x16b439['query'][_0xba28('0x2f')]));_0x20a4e5[_0xba28('0x2e')]=_0x20a4e5[_0xba28('0x2e')]['length']?_0x20a4e5['attributes']:_0x15b133[_0xba28('0x29')];if(!_0x16b439['query'][_0xba28('0x30')]('nolimit')){_0x20a4e5['limit']=qs[_0xba28('0x1b')](_0x16b439['query'][_0xba28('0x1b')]);_0x20a4e5['offset']=qs[_0xba28('0x19')](_0x16b439['query']['offset']);}_0x20a4e5[_0xba28('0x31')]=qs[_0xba28('0x32')](_0x16b439[_0xba28('0x2a')][_0xba28('0x32')]);_0x20a4e5['where']=qs[_0xba28('0x2c')](_[_0xba28('0x33')](_0x16b439[_0xba28('0x2a')],_0x15b133['filters']),_0x54e434);if(_0x16b439[_0xba28('0x2a')][_0xba28('0x34')]){_0x20a4e5[_0xba28('0x35')]=_[_0xba28('0x36')](_0x20a4e5['where'],{'$or':_['map'](_0x54e434,function(_0x31bfd9){if(_0x31bfd9['type']!==_0xba28('0x37')){var _0x2fb8f6={};_0x2fb8f6[_0x31bfd9['name']]={'$like':'%'+_0x16b439[_0xba28('0x2a')]['filter']+'%'};return _0x2fb8f6;}})});}_0x20a4e5=_[_0xba28('0x36')]({},_0x20a4e5,_0x16b439[_0xba28('0x38')]);var _0x634fad={'where':_0x20a4e5[_0xba28('0x35')]};return db[_0xba28('0x26')][_0xba28('0x1c')](_0x634fad)[_0xba28('0x1f')](function(_0x1a6dbd){_0x2ee581['count']=_0x1a6dbd;if(_0x16b439['query'][_0xba28('0x39')]){_0x20a4e5['include']=[{'all':!![]}];}return db[_0xba28('0x26')][_0xba28('0x3a')](_0x20a4e5);})[_0xba28('0x1f')](function(_0x38c655){_0x2ee581[_0xba28('0x3b')]=_0x38c655;return _0x2ee581;})[_0xba28('0x1f')](respondWithFilteredResult(_0x396711,_0x20a4e5))['catch'](handleError(_0x396711,null));};exports[_0xba28('0x3c')]=function(_0x4aaefd,_0x258819){var _0x595b30={'raw':!![],'where':{'id':_0x4aaefd['params']['id']}},_0x19ffae={};_0x19ffae['model']=_['keys'](db['SmsApplication'][_0xba28('0x27')]);_0x19ffae[_0xba28('0x2a')]=_[_0xba28('0x2b')](_0x4aaefd['query']);_0x19ffae[_0xba28('0x2c')]=_[_0xba28('0x2d')](_0x19ffae['model'],_0x19ffae[_0xba28('0x2a')]);_0x595b30[_0xba28('0x2e')]=_[_0xba28('0x2d')](_0x19ffae[_0xba28('0x29')],qs[_0xba28('0x2f')](_0x4aaefd['query'][_0xba28('0x2f')]));_0x595b30[_0xba28('0x2e')]=_0x595b30[_0xba28('0x2e')][_0xba28('0x3d')]?_0x595b30[_0xba28('0x2e')]:_0x19ffae[_0xba28('0x29')];if(_0x4aaefd['query'][_0xba28('0x39')]){_0x595b30[_0xba28('0x3e')]=[{'all':!![]}];}_0x595b30=_[_0xba28('0x36')]({},_0x595b30,_0x4aaefd['options']);return db[_0xba28('0x26')][_0xba28('0x3f')](_0x595b30)['then'](handleEntityNotFound(_0x258819,null))[_0xba28('0x1f')](respondWithResult(_0x258819,null))[_0xba28('0x40')](handleError(_0x258819,null));};exports['create']=function(_0x92f1ac,_0x2e87bf){return db[_0xba28('0x26')][_0xba28('0x41')](_0x92f1ac[_0xba28('0x42')],{})['then'](respondWithResult(_0x2e87bf,0xc9))[_0xba28('0x40')](handleError(_0x2e87bf,null));};exports[_0xba28('0x43')]=function(_0x5a1a18,_0x1f7bab){if(_0x5a1a18[_0xba28('0x42')]['id']){delete _0x5a1a18[_0xba28('0x42')]['id'];}return db[_0xba28('0x26')][_0xba28('0x3f')]({'where':{'id':_0x5a1a18[_0xba28('0x44')]['id']}})[_0xba28('0x1f')](handleEntityNotFound(_0x1f7bab,null))[_0xba28('0x1f')](saveUpdates(_0x5a1a18[_0xba28('0x42')],null))['then'](respondWithResult(_0x1f7bab,null))[_0xba28('0x40')](handleError(_0x1f7bab,null));};exports[_0xba28('0x20')]=function(_0x11c1a9,_0x136f0c){return db[_0xba28('0x26')][_0xba28('0x3f')]({'where':{'id':_0x11c1a9[_0xba28('0x44')]['id']}})[_0xba28('0x1f')](handleEntityNotFound(_0x136f0c,null))[_0xba28('0x1f')](removeEntity(_0x136f0c,null))[_0xba28('0x40')](handleError(_0x136f0c,null));}; \ No newline at end of file +var _0x2751=['attributes','fields','hasOwnProperty','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/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','map','SmsApplication','rawAttributes','fieldName','type','key','model','intersection','query'];(function(_0x56c363,_0x45f34b){var _0xb2f1ec=function(_0x358e2e){while(--_0x358e2e){_0x56c363['push'](_0x56c363['shift']());}};_0xb2f1ec(++_0x45f34b);}(_0x2751,0x197));var _0x1275=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2751[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1275('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1275('0x1'));var rp=require('request-promise');var moment=require(_0x1275('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1275('0x3'));var util=require(_0x1275('0x4'));var path=require(_0x1275('0x5'));var sox=require(_0x1275('0x6'));var csv=require(_0x1275('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1275('0x8'));var _=require(_0x1275('0x9'));var squel=require(_0x1275('0xa'));var crypto=require(_0x1275('0xb'));var jsforce=require(_0x1275('0xc'));var deskjs=require(_0x1275('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1275('0xe'));var Papa=require(_0x1275('0xf'));var Redis=require(_0x1275('0x10'));var authService=require(_0x1275('0x11'));var qs=require(_0x1275('0x12'));var as=require(_0x1275('0x13'));var hardwareService=require(_0x1275('0x14'));var logger=require(_0x1275('0x15'))(_0x1275('0x16'));var utils=require(_0x1275('0x17'));var config=require(_0x1275('0x18'));var licenseUtil=require(_0x1275('0x19'));var db=require(_0x1275('0x1a'))['db'];function respondWithStatusCode(_0x5e646b,_0xd09b){_0xd09b=_0xd09b||0xcc;return function(_0x12ea4a){if(_0x12ea4a){return _0x5e646b[_0x1275('0x1b')](_0xd09b);}return _0x5e646b[_0x1275('0x1c')](_0xd09b)[_0x1275('0x1d')]();};}function respondWithResult(_0x197907,_0x37a464){_0x37a464=_0x37a464||0xc8;return function(_0x2949fc){if(_0x2949fc){return _0x197907[_0x1275('0x1c')](_0x37a464)[_0x1275('0x1e')](_0x2949fc);}};}function respondWithFilteredResult(_0x502249,_0x21a1f5){return function(_0x5caf3f){if(_0x5caf3f){var _0x128eca=typeof _0x21a1f5[_0x1275('0x1f')]===_0x1275('0x20')&&typeof _0x21a1f5[_0x1275('0x21')]===_0x1275('0x20');var _0x19e9b4=_0x5caf3f[_0x1275('0x22')];var _0x21b36e=_0x128eca?0x0:_0x21a1f5[_0x1275('0x1f')];var _0x292c3c=_0x128eca?_0x5caf3f[_0x1275('0x22')]:_0x21a1f5[_0x1275('0x1f')]+_0x21a1f5[_0x1275('0x21')];var _0xebb431;if(_0x292c3c>=_0x19e9b4){_0x292c3c=_0x19e9b4;_0xebb431=0xc8;}else{_0xebb431=0xce;}_0x502249['status'](_0xebb431);return _0x502249[_0x1275('0x23')](_0x1275('0x24'),_0x21b36e+'-'+_0x292c3c+'/'+_0x19e9b4)[_0x1275('0x1e')](_0x5caf3f);}return null;};}function patchUpdates(_0x1bc088){return function(_0x4755d2){try{jsonpatch[_0x1275('0x25')](_0x4755d2,_0x1bc088,!![]);}catch(_0x42f45a){return BPromise[_0x1275('0x26')](_0x42f45a);}return _0x4755d2[_0x1275('0x27')]();};}function saveUpdates(_0x475a62,_0x55ec57){return function(_0x3e4c20){if(_0x3e4c20){return _0x3e4c20[_0x1275('0x28')](_0x475a62)[_0x1275('0x29')](function(_0x1219fd){return _0x1219fd;});}return null;};}function removeEntity(_0x4f4781,_0x3a6166){return function(_0xc60435){if(_0xc60435){return _0xc60435[_0x1275('0x2a')]()['then'](function(){_0x4f4781['status'](0xcc)[_0x1275('0x1d')]();});}};}function handleEntityNotFound(_0x10f971,_0x339526){return function(_0x4761bb){if(!_0x4761bb){_0x10f971[_0x1275('0x1b')](0x194);}return _0x4761bb;};}function handleError(_0x2f11d3,_0x41f1a9){_0x41f1a9=_0x41f1a9||0x1f4;return function(_0x1ed14a){logger[_0x1275('0x2b')](_0x1ed14a[_0x1275('0x2c')]);if(_0x1ed14a[_0x1275('0x2d')]){delete _0x1ed14a[_0x1275('0x2d')];}_0x2f11d3['status'](_0x41f1a9)['send'](_0x1ed14a);};}exports['index']=function(_0x2b068c,_0x4def17){var _0x559e81={},_0x1829e6={},_0x507db2={'count':0x0,'rows':[]};var _0x27c154=_[_0x1275('0x2e')](db[_0x1275('0x2f')][_0x1275('0x30')],function(_0x3f4bf3){return{'name':_0x3f4bf3[_0x1275('0x31')],'type':_0x3f4bf3[_0x1275('0x32')][_0x1275('0x33')]};});_0x1829e6[_0x1275('0x34')]=_[_0x1275('0x2e')](_0x27c154,_0x1275('0x2d'));_0x1829e6['query']=_['keys'](_0x2b068c['query']);_0x1829e6['filters']=_[_0x1275('0x35')](_0x1829e6[_0x1275('0x34')],_0x1829e6[_0x1275('0x36')]);_0x559e81[_0x1275('0x37')]=_[_0x1275('0x35')](_0x1829e6[_0x1275('0x34')],qs[_0x1275('0x38')](_0x2b068c[_0x1275('0x36')]['fields']));_0x559e81['attributes']=_0x559e81[_0x1275('0x37')]['length']?_0x559e81[_0x1275('0x37')]:_0x1829e6[_0x1275('0x34')];if(!_0x2b068c[_0x1275('0x36')][_0x1275('0x39')]('nolimit')){_0x559e81[_0x1275('0x21')]=qs[_0x1275('0x21')](_0x2b068c[_0x1275('0x36')][_0x1275('0x21')]);_0x559e81[_0x1275('0x1f')]=qs[_0x1275('0x1f')](_0x2b068c[_0x1275('0x36')][_0x1275('0x1f')]);}_0x559e81['order']=qs['sort'](_0x2b068c['query'][_0x1275('0x3a')]);_0x559e81[_0x1275('0x3b')]=qs[_0x1275('0x3c')](_[_0x1275('0x3d')](_0x2b068c[_0x1275('0x36')],_0x1829e6[_0x1275('0x3c')]),_0x27c154);if(_0x2b068c[_0x1275('0x36')][_0x1275('0x3e')]){_0x559e81['where']=_[_0x1275('0x3f')](_0x559e81['where'],{'$or':_[_0x1275('0x2e')](_0x27c154,function(_0x258e00){if(_0x258e00[_0x1275('0x32')]!=='VIRTUAL'){var _0x33f57d={};_0x33f57d[_0x258e00['name']]={'$like':'%'+_0x2b068c[_0x1275('0x36')][_0x1275('0x3e')]+'%'};return _0x33f57d;}})});}_0x559e81=_[_0x1275('0x3f')]({},_0x559e81,_0x2b068c[_0x1275('0x40')]);var _0x265260={'where':_0x559e81[_0x1275('0x3b')]};return db['SmsApplication']['count'](_0x265260)[_0x1275('0x29')](function(_0x513362){_0x507db2[_0x1275('0x22')]=_0x513362;if(_0x2b068c[_0x1275('0x36')][_0x1275('0x41')]){_0x559e81[_0x1275('0x42')]=[{'all':!![]}];}return db['SmsApplication'][_0x1275('0x43')](_0x559e81);})[_0x1275('0x29')](function(_0x5c181e){_0x507db2[_0x1275('0x44')]=_0x5c181e;return _0x507db2;})[_0x1275('0x29')](respondWithFilteredResult(_0x4def17,_0x559e81))[_0x1275('0x45')](handleError(_0x4def17,null));};exports[_0x1275('0x46')]=function(_0x4fa980,_0x2e1a16){var _0x4d0bf8={'raw':!![],'where':{'id':_0x4fa980[_0x1275('0x47')]['id']}},_0x38b80a={};_0x38b80a['model']=_['keys'](db[_0x1275('0x2f')][_0x1275('0x30')]);_0x38b80a[_0x1275('0x36')]=_[_0x1275('0x48')](_0x4fa980[_0x1275('0x36')]);_0x38b80a['filters']=_['intersection'](_0x38b80a[_0x1275('0x34')],_0x38b80a[_0x1275('0x36')]);_0x4d0bf8[_0x1275('0x37')]=_[_0x1275('0x35')](_0x38b80a[_0x1275('0x34')],qs[_0x1275('0x38')](_0x4fa980[_0x1275('0x36')][_0x1275('0x38')]));_0x4d0bf8[_0x1275('0x37')]=_0x4d0bf8[_0x1275('0x37')][_0x1275('0x49')]?_0x4d0bf8[_0x1275('0x37')]:_0x38b80a[_0x1275('0x34')];if(_0x4fa980['query'][_0x1275('0x41')]){_0x4d0bf8['include']=[{'all':!![]}];}_0x4d0bf8=_['merge']({},_0x4d0bf8,_0x4fa980['options']);return db['SmsApplication'][_0x1275('0x4a')](_0x4d0bf8)[_0x1275('0x29')](handleEntityNotFound(_0x2e1a16,null))['then'](respondWithResult(_0x2e1a16,null))[_0x1275('0x45')](handleError(_0x2e1a16,null));};exports[_0x1275('0x4b')]=function(_0x1b792b,_0x5e55e0){return db[_0x1275('0x2f')]['create'](_0x1b792b[_0x1275('0x4c')],{})[_0x1275('0x29')](respondWithResult(_0x5e55e0,0xc9))['catch'](handleError(_0x5e55e0,null));};exports[_0x1275('0x28')]=function(_0x1d70e6,_0x37c424){if(_0x1d70e6[_0x1275('0x4c')]['id']){delete _0x1d70e6[_0x1275('0x4c')]['id'];}return db[_0x1275('0x2f')][_0x1275('0x4a')]({'where':{'id':_0x1d70e6[_0x1275('0x47')]['id']}})['then'](handleEntityNotFound(_0x37c424,null))['then'](saveUpdates(_0x1d70e6[_0x1275('0x4c')],null))[_0x1275('0x29')](respondWithResult(_0x37c424,null))[_0x1275('0x45')](handleError(_0x37c424,null));};exports[_0x1275('0x2a')]=function(_0x27f4b9,_0x5efb72){return db[_0x1275('0x2f')][_0x1275('0x4a')]({'where':{'id':_0x27f4b9['params']['id']}})[_0x1275('0x29')](handleEntityNotFound(_0x5efb72,null))[_0x1275('0x29')](removeEntity(_0x5efb72,null))[_0x1275('0x45')](handleError(_0x5efb72,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 6fd6b43..33c4546 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 _0xb6fb=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','sms_applications','utf8mb4'];(function(_0x1e7ba7,_0x35eef2){var _0x94d667=function(_0x17edf7){while(--_0x17edf7){_0x1e7ba7['push'](_0x1e7ba7['shift']());}};_0x94d667(++_0x35eef2);}(_0xb6fb,0x1c3));var _0xbb6f=function(_0x3381f7,_0x815ced){_0x3381f7=_0x3381f7-0x0;var _0x31c2a7=_0xb6fb[_0x3381f7];return _0x31c2a7;};'use strict';var _=require(_0xbb6f('0x0'));var util=require(_0xbb6f('0x1'));var logger=require(_0xbb6f('0x2'))(_0xbb6f('0x3'));var moment=require(_0xbb6f('0x4'));var BPromise=require(_0xbb6f('0x5'));var rp=require(_0xbb6f('0x6'));var fs=require('fs');var path=require(_0xbb6f('0x7'));var rimraf=require(_0xbb6f('0x8'));var config=require(_0xbb6f('0x9'));var attributes=require('./smsApplication.attributes');module[_0xbb6f('0xa')]=function(_0x389a31,_0x18e2dc){return _0x389a31[_0xbb6f('0xb')]('SmsApplication',attributes,{'tableName':_0xbb6f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbb6f('0xd'),'collate':_0xbb6f('0xe')});}; \ No newline at end of file +var _0x1dda=['sms_applications','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1dda,0xa3));var _0xa1dd=function(_0x187399,_0x40c56d){_0x187399=_0x187399-0x0;var _0x40fa92=_0x1dda[_0x187399];return _0x40fa92;};'use strict';var _=require('lodash');var util=require(_0xa1dd('0x0'));var logger=require(_0xa1dd('0x1'))(_0xa1dd('0x2'));var moment=require('moment');var BPromise=require(_0xa1dd('0x3'));var rp=require(_0xa1dd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa1dd('0x5'));var config=require(_0xa1dd('0x6'));var attributes=require('./smsApplication.attributes');module[_0xa1dd('0x7')]=function(_0x5a6660,_0x23c597){return _0x5a6660['define']('SmsApplication',attributes,{'tableName':_0xa1dd('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 52b6a74..00e9b54 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 _0xa9e1=['ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','code','SmsApplication,\x20%s,\x20%s','message','error','request\x20sent','result','lodash','util','bluebird','randomstring'];(function(_0x5d31f3,_0x4239b0){var _0x1cc88c=function(_0x1be8fc){while(--_0x1be8fc){_0x5d31f3['push'](_0x5d31f3['shift']());}};_0x1cc88c(++_0x4239b0);}(_0xa9e1,0x7a));var _0x1a9e=function(_0x4e5552,_0x19ec4e){_0x4e5552=_0x4e5552-0x0;var _0x60a338=_0xa9e1[_0x4e5552];return _0x60a338;};'use strict';var _=require(_0x1a9e('0x0'));var util=require(_0x1a9e('0x1'));var moment=require('moment');var BPromise=require(_0x1a9e('0x2'));var rs=require(_0x1a9e('0x3'));var fs=require('fs');var Redis=require(_0x1a9e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a9e('0x5'));var logger=require('../../config/logger')(_0x1a9e('0x6'));var config=require('../../config/environment');var jayson=require(_0x1a9e('0x7'));var client=jayson[_0x1a9e('0x8')][_0x1a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc9409c,_0x2b8600,_0x91b2c3){return new BPromise(function(_0x9bf04c,_0x32c466){return client[_0x1a9e('0xa')](_0xc9409c,_0x91b2c3)[_0x1a9e('0xb')](function(_0x4f9f78){logger[_0x1a9e('0xc')]('SmsApplication,\x20%s,\x20%s',_0x2b8600,'request\x20sent');logger['debug'](_0x1a9e('0xd'),_0x2b8600,'request\x20sent',JSON[_0x1a9e('0xe')](_0x4f9f78));if(_0x4f9f78['error']){if(_0x4f9f78['error'][_0x1a9e('0xf')]===0x1f4){logger['error'](_0x1a9e('0x10'),_0x2b8600,_0x4f9f78['error'][_0x1a9e('0x11')]);return _0x32c466(_0x4f9f78[_0x1a9e('0x12')][_0x1a9e('0x11')]);}logger[_0x1a9e('0x12')](_0x1a9e('0x10'),_0x2b8600,_0x4f9f78[_0x1a9e('0x12')][_0x1a9e('0x11')]);return _0x9bf04c(_0x4f9f78[_0x1a9e('0x12')]['message']);}else{logger[_0x1a9e('0xc')](_0x1a9e('0x10'),_0x2b8600,_0x1a9e('0x13'));_0x9bf04c(_0x4f9f78[_0x1a9e('0x14')][_0x1a9e('0x11')]);}})['catch'](function(_0x303979){logger[_0x1a9e('0x12')](_0x1a9e('0x10'),_0x2b8600,_0x303979);_0x32c466(_0x303979);});});} \ No newline at end of file +var _0xf55c=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x784dca,_0x26111d){var _0x4acfd2=function(_0x176890){while(--_0x176890){_0x784dca['push'](_0x784dca['shift']());}};_0x4acfd2(++_0x26111d);}(_0xf55c,0x1e7));var _0xcf55=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xf55c[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0xcf55('0x0'));var util=require('util');var moment=require(_0xcf55('0x1'));var BPromise=require(_0xcf55('0x2'));var rs=require(_0xcf55('0x3'));var fs=require('fs');var Redis=require(_0xcf55('0x4'));var db=require(_0xcf55('0x5'))['db'];var utils=require(_0xcf55('0x6'));var logger=require(_0xcf55('0x7'))('rpc');var config=require(_0xcf55('0x8'));var jayson=require(_0xcf55('0x9'));var client=jayson[_0xcf55('0xa')][_0xcf55('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b3453,_0x29566b,_0x53deb4){return new BPromise(function(_0x7003f1,_0x3018aa){return client['request'](_0x4b3453,_0x53deb4)[_0xcf55('0xc')](function(_0x3ce5d2){logger[_0xcf55('0xd')](_0xcf55('0xe'),_0x29566b,_0xcf55('0xf'));logger[_0xcf55('0x10')](_0xcf55('0x11'),_0x29566b,'request\x20sent',JSON[_0xcf55('0x12')](_0x3ce5d2));if(_0x3ce5d2[_0xcf55('0x13')]){if(_0x3ce5d2['error']['code']===0x1f4){logger[_0xcf55('0x13')](_0xcf55('0xe'),_0x29566b,_0x3ce5d2[_0xcf55('0x13')][_0xcf55('0x14')]);return _0x3018aa(_0x3ce5d2[_0xcf55('0x13')][_0xcf55('0x14')]);}logger[_0xcf55('0x13')](_0xcf55('0xe'),_0x29566b,_0x3ce5d2[_0xcf55('0x13')][_0xcf55('0x14')]);return _0x7003f1(_0x3ce5d2[_0xcf55('0x13')][_0xcf55('0x14')]);}else{logger['info'](_0xcf55('0xe'),_0x29566b,_0xcf55('0xf'));_0x7003f1(_0x3ce5d2[_0xcf55('0x15')][_0xcf55('0x14')]);}})[_0xcf55('0x16')](function(_0x4b0c1a){logger[_0xcf55('0x13')](_0xcf55('0xe'),_0x29566b,_0x4b0c1a);_0x3018aa(_0x4b0c1a);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 9265c89..adc8e37 100644 --- a/server/api/smsInteraction/index.js +++ b/server/api/smsInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3423=['/:id','/:id/messages','download','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','put','delete','smsinteraction:destroy','destroy','removeTags','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x5581ba,_0x268887){var _0x1e927f=function(_0x1803b2){while(--_0x1803b2){_0x5581ba['push'](_0x5581ba['shift']());}};_0x1e927f(++_0x268887);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3342('0x0'));var timeout=require(_0x3342('0x1'));var express=require(_0x3342('0x2'));var router=express[_0x3342('0x3')]();var fs_extra=require(_0x3342('0x4'));var auth=require(_0x3342('0x5'));var interaction=require(_0x3342('0x6'));var config=require(_0x3342('0x7'));var controller=require(_0x3342('0x8'));router[_0x3342('0x9')]('/',auth[_0x3342('0xa')](),controller[_0x3342('0xb')]);router[_0x3342('0x9')](_0x3342('0xc'),auth[_0x3342('0xa')](),controller[_0x3342('0xd')]);router[_0x3342('0x9')](_0x3342('0xe'),auth[_0x3342('0xa')](),controller['show']);router['get'](_0x3342('0xf'),auth['isAuthenticated'](),controller['getMessages']);router['get']('/:id/download',auth[_0x3342('0xa')](),controller[_0x3342('0x10')]);router['post']('/',auth[_0x3342('0xa')](),controller['create']);router[_0x3342('0x11')](_0x3342('0xf'),auth['isAuthenticated'](),controller[_0x3342('0x12')]);router[_0x3342('0x11')](_0x3342('0x13'),auth[_0x3342('0xa')](),interaction[_0x3342('0x14')](_0x3342('0x15'),_0x3342('0x16')),controller['addTags']);router[_0x3342('0x17')](_0x3342('0xe'),auth['isAuthenticated'](),interaction[_0x3342('0x14')](_0x3342('0x15'),'smsinteraction:update'),controller['update']);router[_0x3342('0x18')](_0x3342('0xe'),auth[_0x3342('0xa')](),interaction[_0x3342('0x14')](_0x3342('0x15'),_0x3342('0x19')),controller[_0x3342('0x1a')]);router[_0x3342('0x18')](_0x3342('0x13'),auth['isAuthenticated'](),controller[_0x3342('0x1b')]);module[_0x3342('0x1c')]=router; \ No newline at end of file +var _0xbaf0=['sms','smsinteraction:addtags','addTags','put','/:id','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked'];(function(_0x1e7777,_0x2ae1b1){var _0x14aefd=function(_0x31eb86){while(--_0x31eb86){_0x1e7777['push'](_0x1e7777['shift']());}};_0x14aefd(++_0x2ae1b1);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'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('0x9')](_0x0baf('0xe'),auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x9')](_0x0baf('0x10'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x11')]);router[_0x0baf('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0baf('0x12')](_0x0baf('0xe'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x13')]);router['post'](_0x0baf('0x14'),auth['isAuthenticated'](),interaction[_0x0baf('0x15')](_0x0baf('0x16'),_0x0baf('0x17')),controller[_0x0baf('0x18')]);router[_0x0baf('0x19')](_0x0baf('0x1a'),auth['isAuthenticated'](),interaction['tracked'](_0x0baf('0x16'),_0x0baf('0x1b')),controller[_0x0baf('0x1c')]);router[_0x0baf('0x1d')](_0x0baf('0x1a'),auth[_0x0baf('0xa')](),interaction['tracked'](_0x0baf('0x16'),_0x0baf('0x1e')),controller[_0x0baf('0x1f')]);router[_0x0baf('0x1d')](_0x0baf('0x14'),auth[_0x0baf('0xa')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index fd2616a..55a0cd9 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 _0xbd3c=['out','BOOLEAN','sequelize','moment','exports','DATE','STRING','ENUM'];(function(_0x1e4dca,_0x44147a){var _0x355ca9=function(_0x4d49b2){while(--_0x4d49b2){_0x1e4dca['push'](_0x1e4dca['shift']());}};_0x355ca9(++_0x44147a);}(_0xbd3c,0xc2));var _0xcbd3=function(_0x2f3cb6,_0x3a455f){_0x2f3cb6=_0x2f3cb6-0x0;var _0x5dd5d5=_0xbd3c[_0x2f3cb6];return _0x5dd5d5;};'use strict';var Sequelize=require(_0xcbd3('0x0'));var moment=require(_0xcbd3('0x1'));module[_0xcbd3('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcbd3('0x3')]},'disposition':{'type':Sequelize[_0xcbd3('0x4')]},'secondDisposition':{'type':Sequelize[_0xcbd3('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xcbd3('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xcbd3('0x5')]('in',_0xcbd3('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xcbd3('0x5')]('in',_0xcbd3('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xcbd3('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x4677=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x3c97e3,_0x321677){var _0x9bb0ed=function(_0x3a0cb6){while(--_0x3a0cb6){_0x3c97e3['push'](_0x3c97e3['shift']());}};_0x9bb0ed(++_0x321677);}(_0x4677,0x155));var _0x7467=function(_0x5bd1cb,_0x5addbe){_0x5bd1cb=_0x5bd1cb-0x0;var _0x381ec5=_0x4677[_0x5bd1cb];return _0x381ec5;};'use strict';var Sequelize=require(_0x7467('0x0'));var moment=require('moment');module[_0x7467('0x1')]={'closed':{'type':Sequelize[_0x7467('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7467('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x7467('0x4')]},'thirdDisposition':{'type':Sequelize[_0x7467('0x4')]},'note':{'type':Sequelize[_0x7467('0x4')]},'phone':{'type':Sequelize[_0x7467('0x4')]},'read1stAt':{'type':Sequelize[_0x7467('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x7467('0x5')]('in',_0x7467('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7467('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x7467('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index c6e43da..6614beb 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 _0xc482=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','Users','map','fullname','TagIds','Tags','split','forEach','push','index','SmsInteraction','rawAttributes','fieldName','key','model','keys','query','attributes','fields','nolimit','order','sort','where','filters','pick','select','field','from','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','length','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','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','body','start','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','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','toString','keyBy','merge','unreadMessages','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','sequelize','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','params','includeAll','options','catch','create','describe','addMessage','ids','omit','getMessages','findOne','SmsMessage','intersection','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','include','addTags','setTags','spread','color','emit','smsInteractionTags:save','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','lastName','Messages','secret','SmsAccount','Account','Owner','get','mkdirSync','Sms','closed','closedAt','direction','out','System','firstName','renderFile','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger'];(function(_0x155041,_0x1f1f67){var _0x362077=function(_0x5ed84b){while(--_0x5ed84b){_0x155041['push'](_0x155041['shift']());}};_0x362077(++_0x1f1f67);}(_0xc482,0x1d2));var _0x2c48=function(_0x177aef,_0x30cc35){_0x177aef=_0x177aef-0x0;var _0x69136=_0xc482[_0x177aef];return _0x69136;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2c48('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2c48('0x1'));var moment=require(_0x2c48('0x2'));var BPromise=require(_0x2c48('0x3'));var Mustache=require(_0x2c48('0x4'));var util=require(_0x2c48('0x5'));var path=require(_0x2c48('0x6'));var sox=require(_0x2c48('0x7'));var csv=require('to-csv');var ejs=require(_0x2c48('0x8'));var fs=require('fs');var fs_extra=require(_0x2c48('0x9'));var _=require(_0x2c48('0xa'));var squel=require(_0x2c48('0xb'));var crypto=require('crypto');var jsforce=require(_0x2c48('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2c48('0xd'));var querystring=require('querystring');var Papa=require(_0x2c48('0xe'));var Redis=require('ioredis');var authService=require(_0x2c48('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2c48('0x10'));var pdf=require(_0x2c48('0x11'));var hardwareService=require(_0x2c48('0x12'));var logger=require(_0x2c48('0x13'))('api');var utils=require(_0x2c48('0x14'));var config=require(_0x2c48('0x15'));var licenseUtil=require(_0x2c48('0x16'));var db=require(_0x2c48('0x17'))['db'];config[_0x2c48('0x18')]=_[_0x2c48('0x19')](config[_0x2c48('0x18')],{'host':_0x2c48('0x1a'),'port':0x18eb});var socket=require(_0x2c48('0x1b'))(new Redis(config['redis']));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x30406f,_0x522b02){_0x522b02=_0x522b02||0xcc;return function(_0x12c6c7){if(_0x12c6c7){return _0x30406f[_0x2c48('0x1c')](_0x522b02);}return _0x30406f['status'](_0x522b02)[_0x2c48('0x1d')]();};}function respondWithResult(_0x17197e,_0x19cd8e){_0x19cd8e=_0x19cd8e||0xc8;return function(_0x22b05b){if(_0x22b05b){return _0x17197e[_0x2c48('0x1e')](_0x19cd8e)[_0x2c48('0x1f')](_0x22b05b);}};}function respondWithFilteredResult(_0x4bb469,_0x351025){return function(_0x4685f3){if(_0x4685f3){var _0x59980b=typeof _0x351025[_0x2c48('0x20')]==='undefined'&&typeof _0x351025[_0x2c48('0x21')]===_0x2c48('0x22');var _0x24447c=_0x4685f3[_0x2c48('0x23')];var _0x2f2ceb=_0x59980b?0x0:_0x351025[_0x2c48('0x20')];var _0x2bfcf9=_0x59980b?_0x4685f3[_0x2c48('0x23')]:_0x351025[_0x2c48('0x20')]+_0x351025['limit'];var _0x254ecb;if(_0x2bfcf9>=_0x24447c){_0x2bfcf9=_0x24447c;_0x254ecb=0xc8;}else{_0x254ecb=0xce;}_0x4bb469[_0x2c48('0x1e')](_0x254ecb);return _0x4bb469[_0x2c48('0x24')](_0x2c48('0x25'),_0x2f2ceb+'-'+_0x2bfcf9+'/'+_0x24447c)[_0x2c48('0x1f')](_0x4685f3);}return null;};}function patchUpdates(_0x2eeeaa){return function(_0x56370c){try{jsonpatch[_0x2c48('0x26')](_0x56370c,_0x2eeeaa,!![]);}catch(_0x58c64d){return BPromise[_0x2c48('0x27')](_0x58c64d);}return _0x56370c[_0x2c48('0x28')]();};}function saveUpdates(_0x4b0931,_0x1e2039){return function(_0x41771d){if(_0x41771d){return _0x41771d[_0x2c48('0x29')](_0x4b0931)[_0x2c48('0x2a')](function(_0xe17128){return _0xe17128;});}return null;};}function removeEntity(_0x2edeb2,_0x16fe6a){return function(_0x5f277c){if(_0x5f277c){return _0x5f277c[_0x2c48('0x2b')]()['then'](function(){_0x2edeb2[_0x2c48('0x1e')](0xcc)[_0x2c48('0x1d')]();});}};}function handleEntityNotFound(_0xa75439,_0x570d17){return function(_0x4af396){if(!_0x4af396){_0xa75439['sendStatus'](0x194);}return _0x4af396;};}function handleError(_0x13fe50,_0x402b56){_0x402b56=_0x402b56||0x1f4;return function(_0x2a20e5){logger[_0x2c48('0x2c')](_0x2a20e5[_0x2c48('0x2d')]);if(_0x2a20e5[_0x2c48('0x2e')]){delete _0x2a20e5[_0x2c48('0x2e')];}_0x13fe50[_0x2c48('0x1e')](_0x402b56)['send'](_0x2a20e5);};}function getInteractionUsers(_0x5abfa5,_0x396944){return new BPromise(function(_0x53d714,_0x5a791e){try{if(_0x396944[_0x5abfa5['id']]){_0x5abfa5[_0x2c48('0x2f')]=_[_0x2c48('0x30')](_0x396944[_0x5abfa5['id']],function(_0x4d52e3){return{'id':_0x4d52e3['id'],'fullname':_0x4d52e3[_0x2c48('0x31')]};});}}catch(_0x579bf1){_0x5a791e(_0x579bf1);}_0x53d714(_0x5abfa5);});}function getInteractionTags(_0x43311a,_0x33fdda){return new BPromise(function(_0x20f99a,_0x9d260a){try{if(_0x43311a[_0x2c48('0x32')]){_0x43311a[_0x2c48('0x33')]=[];_0x43311a['TagIds'][_0x2c48('0x34')](',')[_0x2c48('0x35')](function(_0x2a64ab){_0x43311a['Tags'][_0x2c48('0x36')](_0x33fdda[_0x2a64ab]);});}delete _0x43311a[_0x2c48('0x32')];}catch(_0x327f28){_0x9d260a(_0x327f28);}_0x20f99a(_0x43311a);});}function updateSmsInteraction(_0x2254bb,_0x4eafa9,_0x4374dc){return new BPromise(function(_0x173e46,_0x53caf4){return getInteractionUsers(_0x2254bb,_0x4374dc)['then'](function(_0x2ef6d6){return getInteractionTags(_0x2ef6d6,_0x4eafa9);})['then'](function(_0x376322){_0x173e46(_0x376322);})['catch'](function(_0x205dad){_0x53caf4(_0x205dad);});});}exports[_0x2c48('0x37')]=function(_0xf4b8b2,_0x598ae2){var _0x176f4e={},_0x59bbb3={},_0x47d016={'count':0x0,'rows':[]};var _0x3f4fec=_[_0x2c48('0x30')](db[_0x2c48('0x38')][_0x2c48('0x39')],function(_0x112bb7){return{'name':_0x112bb7[_0x2c48('0x3a')],'type':_0x112bb7['type'][_0x2c48('0x3b')]};});_0x59bbb3[_0x2c48('0x3c')]=_['map'](_0x3f4fec,_0x2c48('0x2e'));_0x59bbb3['query']=_[_0x2c48('0x3d')](_0xf4b8b2[_0x2c48('0x3e')]);_0x59bbb3['filters']=_['intersection'](_0x59bbb3[_0x2c48('0x3c')],_0x59bbb3[_0x2c48('0x3e')]);_0x176f4e[_0x2c48('0x3f')]=_['intersection'](_0x59bbb3[_0x2c48('0x3c')],qs[_0x2c48('0x40')](_0xf4b8b2[_0x2c48('0x3e')][_0x2c48('0x40')]));_0x176f4e[_0x2c48('0x3f')]=_0x176f4e[_0x2c48('0x3f')]['length']?_0x176f4e[_0x2c48('0x3f')]:_0x59bbb3[_0x2c48('0x3c')];if(!_0xf4b8b2[_0x2c48('0x3e')]['hasOwnProperty'](_0x2c48('0x41'))){_0x176f4e[_0x2c48('0x21')]=qs[_0x2c48('0x21')](_0xf4b8b2[_0x2c48('0x3e')][_0x2c48('0x21')]);_0x176f4e[_0x2c48('0x20')]=qs[_0x2c48('0x20')](_0xf4b8b2[_0x2c48('0x3e')][_0x2c48('0x20')]);}_0x176f4e[_0x2c48('0x42')]=qs[_0x2c48('0x43')](_0xf4b8b2['query']['sort']);_0x176f4e[_0x2c48('0x44')]=qs[_0x2c48('0x45')](_[_0x2c48('0x46')](_0xf4b8b2[_0x2c48('0x3e')],_0x59bbb3[_0x2c48('0x45')]),_0x3f4fec);var _0x186714=[];var _0x26f31a=squel[_0x2c48('0x47')]()[_0x2c48('0x48')]('id')['field']('name')[_0x2c48('0x48')]('color')[_0x2c48('0x49')]('tools_tags');var _0x4757d7=squel[_0x2c48('0x47')]()[_0x2c48('0x48')](_0x2c48('0x4a'))['field'](_0x2c48('0x4b'))[_0x2c48('0x48')](_0x2c48('0x4c'))['from'](_0x2c48('0x4d'),'ui')[_0x2c48('0x4e')]('users','u',_0x2c48('0x4f'));var _0x1d8664=squel[_0x2c48('0x47')]()[_0x2c48('0x49')](_0x2c48('0x50'),'i')[_0x2c48('0x4e')](_0x2c48('0x51'),'c',_0x2c48('0x52'))[_0x2c48('0x4e')](_0x2c48('0x53'),'o',_0x2c48('0x54'))[_0x2c48('0x4e')](_0x2c48('0x55'),'a',_0x2c48('0x56'))['left_join']('sms_messages','me',_0x2c48('0x57'))[_0x2c48('0x4e')](_0x2c48('0x58'),'it',_0x2c48('0x59'))['left_join'](_0x2c48('0x5a'),'t',_0x2c48('0x5b'));var _0x1ade35=squel[_0x2c48('0x5c')]();var _0x1f4820=[];var _0x8964f3=squel[_0x2c48('0x5c')]();var _0x3baaf1;if(_0xf4b8b2['query']['search']){_0x3baaf1=as[_0x2c48('0x5d')](_0xf4b8b2[_0x2c48('0x3e')][_0x2c48('0x5e')]);var _0x37dc80=_0x3baaf1['sqlOperator'];for(var _0x45caec=0x0;_0x45caec<_0x3baaf1['conditions']['length'];_0x45caec++){var _0x40d07d=_0x3baaf1[_0x2c48('0x5f')][_0x45caec];var _0x5abc98='i';var _0x3aad62=_[_0x2c48('0x60')](_0x3f4fec,[_0x2c48('0x2e'),_0x40d07d[_0x2c48('0x48')]]);if(!_0x3aad62){switch(_0x40d07d[_0x2c48('0x48')]){case'unreadMessages':if(_0x40d07d[_0x2c48('0x61')]==0x1){_0x1d8664[_0x2c48('0x62')]('`'+_0x40d07d['field']+_0x2c48('0x63'));}else{_0x1d8664[_0x2c48('0x62')]('`'+_0x40d07d[_0x2c48('0x48')]+_0x2c48('0x64'));}break;case _0x2c48('0x65'):if(_0x40d07d[_0x2c48('0x66')]===_0x2c48('0x67')){if(_0x40d07d[_0x2c48('0x61')]['split']('\x20')[_0x2c48('0x68')]>0x1){_0x1ade35[_0x37dc80](_0x2c48('0x69'),qs[_0x2c48('0x6a')](_0x40d07d[_0x2c48('0x61')]),null);}else{var _0xff7759='%'+_0x40d07d[_0x2c48('0x61')]+'%';_0x1ade35[_0x37dc80](_0x2c48('0x6b'),_0xff7759,_0xff7759,_0xff7759);}}else{_0x3aad62=_[_0x2c48('0x60')](_0x3f4fec,[_0x2c48('0x2e'),_0x2c48('0x6c')]);_0x40d07d[_0x2c48('0x48')]=_0x2c48('0x6c');_0x104a5f=as['buildExpression'](_0x5abc98,_0x3aad62[_0x2c48('0x6d')],_0x40d07d);_0x1ade35[_0x37dc80](_0x104a5f[_0x2c48('0x6e')],_0x104a5f['value']['start'],_0x104a5f[_0x2c48('0x61')][_0x2c48('0x1d')]);}break;case _0x2c48('0x6f'):var _0x2165c4=_0x40d07d[_0x2c48('0x61')][_0x2c48('0x34')](',')['map'](function(_0x26c6f2){return Number(_0x26c6f2);});_0x2165c4[_0x2c48('0x35')](function(_0x439ab1){_0x8964f3['or'](_0x2c48('0x70'),'%,'+_0x439ab1+',%');});_0x1f4820=_[_0x2c48('0x71')](_0x1f4820,_0x2165c4);break;case _0x2c48('0x72'):if(_0x40d07d[_0x2c48('0x66')]===_0x2c48('0x67')){_0x1ade35[_0x37dc80](_0x2c48('0x73'),'%'+_0x40d07d['value']+'%',null);}else{_0x3aad62=_[_0x2c48('0x60')](_0x3f4fec,[_0x2c48('0x2e'),_0x2c48('0x74')]);_0x40d07d['field']='UserId';_0x104a5f=as[_0x2c48('0x75')](_0x5abc98,_0x3aad62[_0x2c48('0x6d')],_0x40d07d);_0x1ade35[_0x37dc80](_0x104a5f[_0x2c48('0x6e')],_0x104a5f[_0x2c48('0x61')]['start'],_0x104a5f[_0x2c48('0x61')]['end']);}break;case _0x2c48('0x76'):_0x104a5f=as[_0x2c48('0x75')]('me',null,_0x40d07d);_0x1ade35[_0x37dc80](_0x104a5f[_0x2c48('0x6e')],_0x104a5f['value']['start'],_0x104a5f[_0x2c48('0x61')][_0x2c48('0x1d')]);break;}}else{var _0x104a5f=as[_0x2c48('0x75')](_0x5abc98,_0x3aad62[_0x2c48('0x6d')],_0x40d07d);_0x1ade35[_0x37dc80](_0x104a5f[_0x2c48('0x6e')],_0x104a5f[_0x2c48('0x61')][_0x2c48('0x77')],_0x104a5f[_0x2c48('0x61')][_0x2c48('0x1d')]);}}}else{var _0x46ba32=_(_0xf4b8b2['query'])['keys']()['map'](function(_0x3eaa5f){return _[_0x2c48('0x78')](_0x3f4fec,[_0x2c48('0x2e'),_0x3eaa5f])?_0x3eaa5f:undefined;})['compact']()[_0x2c48('0x61')]();if(!_[_0x2c48('0x79')](_0x46ba32)){_0x46ba32['forEach'](function(_0x5c27c5){if(_0x5c27c5===_0x2c48('0x7a')){_0x1d8664[_0x2c48('0x44')](_0x2c48('0x7b'),[]['concat'](_0xf4b8b2[_0x2c48('0x3e')][_0x5c27c5]));}else if(_0x5c27c5===_0x2c48('0x7c')){var _0x3a1d36=JSON[_0x2c48('0x7d')](_0xf4b8b2[_0x2c48('0x3e')][_0x5c27c5])[_0x2c48('0x7e')];var _0x2e2536=JSON[_0x2c48('0x7d')](_0xf4b8b2[_0x2c48('0x3e')][_0x5c27c5])[_0x2c48('0x7f')];_0x1d8664[_0x2c48('0x44')](_0x2c48('0x80'),_0x3a1d36,_0x2e2536);}else{if(_0xf4b8b2[_0x2c48('0x3e')][_0x5c27c5]===_0x2c48('0x81')){_0x1d8664[_0x2c48('0x44')]('i.'+_0x5c27c5+_0x2c48('0x82'));}else{_0x1d8664[_0x2c48('0x44')]('i.'+_0x5c27c5+_0x2c48('0x83'),_0xf4b8b2[_0x2c48('0x3e')][_0x5c27c5]);}}});}if(_0xf4b8b2[_0x2c48('0x3e')][_0x2c48('0x84')]){if(_0xf4b8b2['query'][_0x2c48('0x84')]==0x1){_0x1d8664['having'](_0x2c48('0x85'));}else{_0x1d8664[_0x2c48('0x62')](_0x2c48('0x86'));}}if(_0xf4b8b2[_0x2c48('0x3e')][_0x2c48('0x87')]){_0x1f4820=_[_0x2c48('0x88')](_0xf4b8b2[_0x2c48('0x3e')][_0x2c48('0x87')])?_0xf4b8b2['query']['tag']:new Array(_0xf4b8b2['query']['tag']);_0x1f4820[_0x2c48('0x35')](function(_0x4e84fb){_0x8964f3['or'](_0x2c48('0x70'),'%,'+_0x4e84fb+',%');});}if(_0xf4b8b2[_0x2c48('0x3e')][_0x2c48('0x89')]){var _0x4d0b5d=_0xf4b8b2[_0x2c48('0x3e')][_0x2c48('0x89')][_0x2c48('0x8a')]('\x5c','\x5c\x5c')[_0x2c48('0x8a')](/'/g,'\x27\x27');if(qs[_0x2c48('0x8b')](_0x4d0b5d)){_0x1ade35['or'](_0x2c48('0x8c'),_0x4d0b5d+'%')['or'](_0x2c48('0x8d'),_0x4d0b5d+'%');}else{_0x1ade35['or'](_0x2c48('0x8e'),qs[_0x2c48('0x6a')](_0x4d0b5d))['or'](_0x2c48('0x8f'),_0x4d0b5d+'%');}}}_0x1d8664[_0x2c48('0x44')](_0x1ade35);_0x1d8664[_0x2c48('0x90')](_0x2c48('0x91'));var _0x41dd5a={'type':db[_0x2c48('0x92')][_0x2c48('0x93')][_0x2c48('0x94')],'raw':!![]};var _0x3b6a39=_0x1d8664[_0x2c48('0x95')]();_0x3b6a39['field'](_0x2c48('0x91'));_0x3b6a39[_0x2c48('0x48')](_0x2c48('0x96'),'unreadMessages');if(_0x176f4e[_0x2c48('0x42')]){_0x176f4e[_0x2c48('0x42')][_0x2c48('0x35')](function(_0x1cabfd){var _0x356331=_0x1cabfd[0x0]===_0x2c48('0x97')?_0x1cabfd[0x0]:'i.'+_0x1cabfd[0x0];_0x1d8664[_0x2c48('0x42')](_0x356331,_0x1cabfd[0x1]===_0x2c48('0x98')?![]:!![]);});}if(!_[_0x2c48('0x79')](_0x1f4820)){_0x1d8664[_0x2c48('0x62')](_0x8964f3);_0x3b6a39[_0x2c48('0x44')](_0x2c48('0x99'),_0x1f4820);}BPromise[_0x2c48('0x9a')]()['then'](function(){if(!_0x3baaf1){if(_0xf4b8b2[_0x2c48('0x3e')][_0x2c48('0x7a')])return;_0x3b6a39[_0x2c48('0x44')](_0x2c48('0x9b'));_0x1d8664[_0x2c48('0x44')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0xf4b8b2['user']['role']!==_0x2c48('0x9c'))return;return _0xf4b8b2[_0x2c48('0x9d')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x1c1087){if(_['isEmpty'](_0x1c1087)){_0x3b6a39[_0x2c48('0x44')](_0x2c48('0x9e'));_0x1d8664[_0x2c48('0x44')](_0x2c48('0x9e'));}else{_0x3b6a39[_0x2c48('0x44')]('i.SmsAccountId\x20IN\x20?',_[_0x2c48('0x30')](_0x1c1087,'id'));_0x1d8664['where'](_0x2c48('0x7b'),_[_0x2c48('0x30')](_0x1c1087,'id'));}});})[_0x2c48('0x2a')](function(){if(_0xf4b8b2[_0x2c48('0x9d')][_0x2c48('0x9f')]===_0x2c48('0x9c')&&!_0x3baaf1&&!_0xf4b8b2[_0x2c48('0x3e')][_0x2c48('0x7a')])return[];return db['sequelize']['query'](_0x3b6a39[_0x2c48('0xa0')](),_0x41dd5a);})['then'](function(_0x573fbd){_0x47d016[_0x2c48('0x23')]=_0x573fbd[_0x2c48('0x68')];if(_0x47d016['count']===0x0)return[];return db['sequelize'][_0x2c48('0x3e')](_0x26f31a[_0x2c48('0xa0')](),_0x41dd5a)[_0x2c48('0x2a')](function(_0x2e870a){_0x186714=_[_0x2c48('0xa1')](_0x2e870a,'id');_0x41dd5a=_[_0x2c48('0xa2')](_0x41dd5a,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xf4b8b2[_0x2c48('0x3e')]['fields']){_0x176f4e['attributes'][_0x2c48('0x35')](function(_0x1482b4){_0x1d8664[_0x2c48('0x48')]('i.'+_0x1482b4);});}else{_0x1d8664[_0x2c48('0x48')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x2c48('0xa3'));_0x1d8664[_0x2c48('0x48')](_0x2c48('0xa4'),_0x2c48('0xa5'));_0x1d8664[_0x2c48('0x48')](_0x2c48('0xa6'),_0x2c48('0xa7'));_0x1d8664[_0x2c48('0x48')](_0x2c48('0xa8'),_0x2c48('0x97'));_0x1d8664['field'](_0x2c48('0xa9'));_0x1d8664[_0x2c48('0x48')](_0x2c48('0xaa'),_0x2c48('0xab'));_0x1d8664['field']('c.lastName',_0x2c48('0xac'));_0x1d8664[_0x2c48('0x48')]('c.email',_0x2c48('0xad'));_0x1d8664[_0x2c48('0x48')](_0x2c48('0xae'),_0x2c48('0xaf'));_0x1d8664[_0x2c48('0x48')](_0x2c48('0xb0'),'Contact.mobile');_0x1d8664['field'](_0x2c48('0xb1'),_0x2c48('0xb2'));_0x1d8664[_0x2c48('0x48')](_0x2c48('0xb3'),_0x2c48('0xb4'));_0x1d8664[_0x2c48('0x48')](_0x2c48('0xb5'),_0x2c48('0xb6'));_0x1d8664[_0x2c48('0x48')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x2c48('0x32'));}if(_0x176f4e[_0x2c48('0x21')])_0x1d8664[_0x2c48('0x21')](_0x176f4e['limit']);if(_0x176f4e[_0x2c48('0x20')])_0x1d8664['offset'](_0x176f4e[_0x2c48('0x20')]);return db[_0x2c48('0xb7')]['query'](_0x1d8664[_0x2c48('0xa0')](),_0x41dd5a);})[_0x2c48('0x2a')](function(_0x1c041b){if(_0x1c041b[_0x2c48('0x68')]>0x0)_0x4757d7[_0x2c48('0x44')](_0x2c48('0xb8'),_[_0x2c48('0x30')](_0x1c041b,'id'));return db['sequelize'][_0x2c48('0x3e')](_0x4757d7[_0x2c48('0xa0')](),_0x41dd5a)['then'](function(_0x432073){var _0x18655a=_[_0x2c48('0xb9')](_0x432073,_0x2c48('0xba'));var _0x225a46=[];_0x1c041b['forEach'](function(_0x16fba3){_0x225a46[_0x2c48('0x36')](updateSmsInteraction(_0x16fba3,_0x186714,_0x18655a));});return BPromise[_0x2c48('0xbb')](_0x225a46);});});})[_0x2c48('0x2a')](function(_0x7449c1){_0x47d016[_0x2c48('0xbc')]=_0x7449c1;return _0x47d016;})['then'](respondWithFilteredResult(_0x598ae2,_0x176f4e))['catch'](handleError(_0x598ae2,null));};exports['show']=function(_0x26c39a,_0x5ef669){var _0x4d6dd7={'raw':![],'where':{'id':_0x26c39a[_0x2c48('0xbd')]['id']}},_0xc47f7f={};_0xc47f7f[_0x2c48('0x3c')]=_[_0x2c48('0x3d')](db[_0x2c48('0x38')][_0x2c48('0x39')]);_0xc47f7f['query']=_[_0x2c48('0x3d')](_0x26c39a['query']);_0xc47f7f[_0x2c48('0x45')]=_['intersection'](_0xc47f7f[_0x2c48('0x3c')],_0xc47f7f[_0x2c48('0x3e')]);_0x4d6dd7[_0x2c48('0x3f')]=_['intersection'](_0xc47f7f[_0x2c48('0x3c')],qs[_0x2c48('0x40')](_0x26c39a['query']['fields']));_0x4d6dd7['attributes']=_0x4d6dd7[_0x2c48('0x3f')][_0x2c48('0x68')]?_0x4d6dd7[_0x2c48('0x3f')]:_0xc47f7f[_0x2c48('0x3c')];if(_0x26c39a[_0x2c48('0x3e')][_0x2c48('0xbe')]){_0x4d6dd7['include']=[{'all':!![]}];}_0x4d6dd7=_[_0x2c48('0xa2')]({},_0x4d6dd7,_0x26c39a[_0x2c48('0xbf')]);return db['SmsInteraction'][_0x2c48('0x60')](_0x4d6dd7)['then'](handleEntityNotFound(_0x5ef669,null))['then'](respondWithResult(_0x5ef669,null))[_0x2c48('0xc0')](handleError(_0x5ef669,null));};exports[_0x2c48('0xc1')]=function(_0x1afa62,_0x5e7c6e){return db[_0x2c48('0x38')][_0x2c48('0xc1')](_0x1afa62[_0x2c48('0x76')],{})[_0x2c48('0x2a')](respondWithResult(_0x5e7c6e,0xc9))['catch'](handleError(_0x5e7c6e,null));};exports['update']=function(_0x33e807,_0x368136){if(_0x33e807['body']['id']){delete _0x33e807['body']['id'];}return db[_0x2c48('0x38')][_0x2c48('0x60')]({'where':{'id':_0x33e807[_0x2c48('0xbd')]['id']}})[_0x2c48('0x2a')](handleEntityNotFound(_0x368136,null))['then'](saveUpdates(_0x33e807['body'],null))[_0x2c48('0x2a')](respondWithResult(_0x368136,null))['catch'](handleError(_0x368136,null));};exports['destroy']=function(_0x4b7657,_0x54b487){return db[_0x2c48('0x38')][_0x2c48('0x60')]({'where':{'id':_0x4b7657[_0x2c48('0xbd')]['id']}})[_0x2c48('0x2a')](handleEntityNotFound(_0x54b487,null))[_0x2c48('0x2a')](removeEntity(_0x54b487,null))['catch'](handleError(_0x54b487,null));};exports[_0x2c48('0xc2')]=function(_0x1de814,_0x336071){return db[_0x2c48('0x38')][_0x2c48('0xc2')]()[_0x2c48('0x2a')](respondWithResult(_0x336071,null))[_0x2c48('0xc0')](handleError(_0x336071,null));};exports[_0x2c48('0xc3')]=function(_0x2e649e,_0x4c2404,_0x2cf6df){return db['SmsMessage'][_0x2c48('0x60')]({'where':{'id':_0x2e649e[_0x2c48('0xbd')]['id']}})[_0x2c48('0x2a')](handleEntityNotFound(_0x4c2404,null))[_0x2c48('0x2a')](function(_0x5bdddb){if(_0x5bdddb){return _0x5bdddb[_0x2c48('0xc3')](_0x2e649e['body'][_0x2c48('0xc4')],_[_0x2c48('0xc5')](_0x2e649e[_0x2c48('0x76')],['ids','id'])||{});}})[_0x2c48('0x2a')](respondWithResult(_0x4c2404,null))['catch'](handleError(_0x4c2404,null));};exports[_0x2c48('0xc6')]=function(_0x2b2c32,_0x1bf12d,_0x4906af){var _0x22097f={'raw':![],'where':{}};var _0x30f747={};var _0x140075={'count':0x0,'rows':[]};return db[_0x2c48('0x38')][_0x2c48('0xc7')]({'where':{'id':_0x2b2c32['params']['id']}})[_0x2c48('0x2a')](handleEntityNotFound(_0x1bf12d,null))[_0x2c48('0x2a')](function(_0x3c8853){if(_0x3c8853){_0x30f747[_0x2c48('0x3c')]=_[_0x2c48('0x3d')](db[_0x2c48('0xc8')]['rawAttributes']);_0x30f747[_0x2c48('0x3e')]=_['keys'](_0x2b2c32[_0x2c48('0x3e')]);_0x30f747[_0x2c48('0x45')]=_[_0x2c48('0xc9')](_0x30f747[_0x2c48('0x3c')],_0x30f747[_0x2c48('0x3e')]);_0x22097f[_0x2c48('0x3f')]=_[_0x2c48('0xc9')](_0x30f747[_0x2c48('0x3c')],qs['fields'](_0x2b2c32[_0x2c48('0x3e')][_0x2c48('0x40')]));_0x22097f[_0x2c48('0x3f')]=_0x22097f[_0x2c48('0x3f')][_0x2c48('0x68')]?_0x22097f[_0x2c48('0x3f')]:_0x30f747[_0x2c48('0x3c')];if(!_0x2b2c32[_0x2c48('0x3e')][_0x2c48('0xca')]('nolimit')){_0x22097f[_0x2c48('0x21')]=qs[_0x2c48('0x21')](_0x2b2c32[_0x2c48('0x3e')]['limit']);_0x22097f[_0x2c48('0x20')]=qs[_0x2c48('0x20')](_0x2b2c32[_0x2c48('0x3e')]['offset']);}_0x22097f['order']=qs[_0x2c48('0x43')](_0x2b2c32[_0x2c48('0x3e')][_0x2c48('0x43')]);_0x22097f['where']=qs[_0x2c48('0x45')](_['pick'](_0x2b2c32[_0x2c48('0x3e')],_0x30f747[_0x2c48('0x45')]));_0x22097f['where'][_0x2c48('0xba')]=_0x3c8853['id'];if(_0x2b2c32[_0x2c48('0x3e')][_0x2c48('0x89')]){_0x22097f[_0x2c48('0x44')]=_[_0x2c48('0xa2')](_0x22097f[_0x2c48('0x44')],{'$or':_[_0x2c48('0x30')](_0x22097f[_0x2c48('0x3f')],function(_0x3d0a38){var _0x2e6124={};_0x2e6124[_0x3d0a38]={'$like':'%'+_0x2b2c32[_0x2c48('0x3e')][_0x2c48('0x89')]+'%'};return _0x2e6124;})});}if(_0x2b2c32[_0x2c48('0x3e')][_0x2c48('0x7e')]){var _0x4607e6=_0x2b2c32[_0x2c48('0x3e')][_0x2c48('0x7e')][_0x2c48('0x34')](',');var _0x5c46b8={};_0x5c46b8[_0x4607e6[0x0]]={'$gte':moment(_0x4607e6[0x1])[_0x2c48('0xcb')](_0x2c48('0xcc'))};_0x22097f[_0x2c48('0x44')]=_[_0x2c48('0xa2')](_0x22097f[_0x2c48('0x44')],_0x5c46b8);}_0x22097f=_[_0x2c48('0xa2')]({},_0x22097f,_0x2b2c32['options']);return db['SmsMessage'][_0x2c48('0x23')]({'where':_0x22097f['where']})[_0x2c48('0x2a')](function(_0xa0f57e){_0x140075['count']=_0xa0f57e;if(_0x2b2c32[_0x2c48('0x3e')][_0x2c48('0xbe')]){_0x22097f[_0x2c48('0xcd')]=[{'all':!![]}];}return db[_0x2c48('0xc8')]['findAll'](_0x22097f);})[_0x2c48('0x2a')](function(_0x81689d){_0x140075['rows']=_0x81689d;return _0x140075;});}})['then'](respondWithFilteredResult(_0x1bf12d,_0x22097f))[_0x2c48('0xc0')](handleError(_0x1bf12d,null));};exports[_0x2c48('0xce')]=function(_0x17d12f,_0x18ecac,_0x396ad8){return db[_0x2c48('0x38')]['find']({'where':{'id':_0x17d12f[_0x2c48('0xbd')]['id']}})[_0x2c48('0x2a')](handleEntityNotFound(_0x18ecac,null))[_0x2c48('0x2a')](function(_0x16d51c){if(_0x16d51c){return _0x16d51c[_0x2c48('0xcf')](_0x17d12f[_0x2c48('0x76')][_0x2c48('0xc4')],_[_0x2c48('0xc5')](_0x17d12f['body'],[_0x2c48('0xc4'),'id'])||{})[_0x2c48('0xd0')](function(){return db['Tag']['findAll']({'attributes':['id',_0x2c48('0x2e'),_0x2c48('0xd1')],'where':{'id':_0x17d12f[_0x2c48('0x76')]['ids']}});})[_0x2c48('0x2a')](function(_0x2ec8c9){socket[_0x2c48('0xd2')](_0x2c48('0xd3'),{'id':Number(_0x17d12f['params']['id']),'tags':_0x2ec8c9||[]});return{'id':Number(_0x17d12f[_0x2c48('0xbd')]['id']),'tags':_0x2ec8c9||[]};});}})[_0x2c48('0x2a')](respondWithResult(_0x18ecac,null))[_0x2c48('0xc0')](handleError(_0x18ecac,null));};exports['removeTags']=function(_0x457805,_0x25fec8,_0x4fc11d){return db['SmsInteraction'][_0x2c48('0x60')]({'where':{'id':_0x457805[_0x2c48('0xbd')]['id']}})['then'](handleEntityNotFound(_0x25fec8,null))[_0x2c48('0x2a')](function(_0x2317f2){if(_0x2317f2){return _0x2317f2['removeTags'](_0x457805[_0x2c48('0x3e')][_0x2c48('0xc4')]);}})['then'](respondWithStatusCode(_0x25fec8,null))[_0x2c48('0xc0')](handleError(_0x25fec8,null));};exports[_0x2c48('0xd4')]=function(_0xf3a024,_0x181c6a){var _0x56846e=moment()['unix']()['toString']();var _0x59db8d=path[_0x2c48('0xd5')](config[_0x2c48('0xd6')],_0x2c48('0xd7'),_0x2c48('0xd8'),_0x2c48('0xd9'));var _0x5d3ceb=path[_0x2c48('0xd5')](config[_0x2c48('0xd6')],'server','files',_0x2c48('0xda'));var _0x4aa29c=path[_0x2c48('0xd5')](_0x59db8d,_0x56846e);var _0x310267=util[_0x2c48('0xcb')](_0x2c48('0xdb'),_0xf3a024[_0x2c48('0xbd')]['id'],_0x56846e);var _0x849279=path[_0x2c48('0xd5')](_0x59db8d,_0x310267);var _0x5ad6c6=[];_0x5ad6c6[_0x2c48('0x36')]({'model':db['User'],'as':_0x2c48('0x72'),'attributes':['id',_0x2c48('0x31')],'raw':!![]});_0x5ad6c6[_0x2c48('0x36')]({'model':db[_0x2c48('0xdc')],'as':_0x2c48('0x65'),'attributes':['id','firstName',_0x2c48('0xdd')],'raw':!![]});var _0x553978=[{'model':db[_0x2c48('0xc8')],'as':_0x2c48('0xde'),'attributes':['id',_0x2c48('0x76'),'createdAt','direction',_0x2c48('0xdf'),_0x2c48('0x84')],'include':_0x5ad6c6}];_0x553978[_0x2c48('0x36')]({'model':db[_0x2c48('0xe0')],'as':_0x2c48('0xe1'),'attributes':['id',_0x2c48('0x2e')]});_0x553978['push']({'model':db[_0x2c48('0x72')],'as':_0x2c48('0xe2'),'attributes':['id',_0x2c48('0x31')]});return db[_0x2c48('0x38')][_0x2c48('0x60')]({'where':{'id':_0xf3a024[_0x2c48('0xbd')]['id']},'include':_0x553978})[_0x2c48('0x2a')](handleEntityNotFound(_0x181c6a,null))[_0x2c48('0x2a')](function(_0x126767){if(_0x126767){var _0x8ca709=_0x126767[_0x2c48('0xe3')]({'plain':!![]});fs[_0x2c48('0xe4')](_0x4aa29c);var _0x5b5652={'channel':_0x2c48('0xe5'),'account':_0x8ca709[_0x2c48('0xe1')]['name'],'agent':_0x8ca709[_0x2c48('0xe2')]?_0x8ca709[_0x2c48('0xe2')]['fullname']:'N.A.','createdAt':moment(_0x8ca709[_0x2c48('0x7c')])['format'](_0x2c48('0xcc'))[_0x2c48('0xa0')](),'closedAt':_0x8ca709[_0x2c48('0xe6')]?moment(_0x8ca709[_0x2c48('0xe7')])['format'](_0x2c48('0xcc'))[_0x2c48('0xa0')]():'','disposition':_0x8ca709['disposition'],'messages':_(_0x8ca709[_0x2c48('0xde')])[_0x2c48('0x89')]({'secret':![]})['map'](function(_0x6a5d7){return{'date':moment(_0x6a5d7['createdAt'])[_0x2c48('0xcb')](_0x2c48('0xcc'))[_0x2c48('0xa0')](),'sender':_0x6a5d7[_0x2c48('0xe8')]===_0x2c48('0xe9')?_0x6a5d7[_0x2c48('0x72')]?_0x6a5d7[_0x2c48('0x72')]['fullname']:_0x2c48('0xea'):_0x6a5d7[_0x2c48('0x65')][_0x2c48('0xeb')]+(_0x6a5d7[_0x2c48('0x65')][_0x2c48('0xdd')]?'\x20'+_0x6a5d7[_0x2c48('0x65')][_0x2c48('0xdd')]:''),'body':_0x6a5d7[_0x2c48('0x76')],'direction':_0x6a5d7[_0x2c48('0xe8')]===_0x2c48('0xe9')?'A':'C','secret':_0x6a5d7['secret'],'read':_0x6a5d7[_0x2c48('0x84')]};})['value']()};return ejs[_0x2c48('0xec')](path[_0x2c48('0xd5')](config[_0x2c48('0xd6')],_0x2c48('0xd7'),'views','downloadInteraction.ejs'),{'interaction':_0x5b5652})[_0x2c48('0x2a')](function(_0x5c26bd){var _0x290538=path[_0x2c48('0xd5')](_0x4aa29c,_0x2c48('0xed')+_0x8ca709['id']+'-'+_0x56846e+_0x2c48('0xee'));var _0x3969bf={'path':_0x290538,'channel':_0x2c48('0xe5'),'interactionId':_0x8ca709['id']};return pdf[_0x2c48('0xef')](_0x5c26bd,_0x3969bf);})[_0x2c48('0x2a')](function(){return new BPromise(function(_0x446171,_0x78fd72){zipdir(_0x4aa29c,{'saveTo':_0x849279},function(_0x16ba58,_0xeb7b00){if(_0x16ba58)return _0x78fd72(_0x16ba58);return _0x446171(_0xeb7b00);});})['then'](function(){return new BPromise(function(_0x1cdb2b,_0x1ede8b){rimraf(_0x4aa29c,function(_0x5deb43){if(_0x5deb43)_0x1ede8b(_0x5deb43);return _0x1cdb2b();});});})[_0x2c48('0x2a')](function(){return _0x181c6a[_0x2c48('0xd4')](_0x849279,_0x310267,function(_0x3b8141){if(_0x3b8141){console[_0x2c48('0xf0')](_0x2c48('0xf1'),_0x3b8141);}else{fs[_0x2c48('0xf2')](_0x849279);}});});});}else{return _0x181c6a[_0x2c48('0x1c')](0xc8);}})[_0x2c48('0xc0')](handleError(_0x181c6a,null));}; \ No newline at end of file +var _0xd66d=['c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.SmsInteractionId\x20IN\x20?','sequelize','groupBy','SmsInteractionId','all','rows','show','rawAttributes','includeAll','include','options','create','body','params','describe','addMessage','SmsMessage','ids','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','Tag','smsInteractionTags:save','removeTags','download','join','root','server','files','attachments','CmContact','firstName','lastName','Messages','Account','Owner','get','mkdirSync','Sms','closed','closedAt','disposition','out','System','direction','secret','renderFile','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','eml-format','zip-dir','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','fullname','TagIds','split','forEach','Tags','push','catch','index','SmsInteraction','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','field','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','sms_accounts','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','union','User','UserId','keys','compact','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','agent','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xd66d,0x12d));var _0xdd66=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xd66d[_0x1b2ff7];return _0x31656a;};'use strict';var emlformat=require(_0xdd66('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdd66('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdd66('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xdd66('0x3'));var util=require(_0xdd66('0x4'));var path=require('path');var sox=require(_0xdd66('0x5'));var csv=require(_0xdd66('0x6'));var ejs=require(_0xdd66('0x7'));var fs=require('fs');var fs_extra=require(_0xdd66('0x8'));var _=require(_0xdd66('0x9'));var squel=require(_0xdd66('0xa'));var crypto=require(_0xdd66('0xb'));var jsforce=require(_0xdd66('0xc'));var deskjs=require(_0xdd66('0xd'));var toCsv=require(_0xdd66('0x6'));var querystring=require(_0xdd66('0xe'));var Papa=require(_0xdd66('0xf'));var Redis=require(_0xdd66('0x10'));var authService=require(_0xdd66('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xdd66('0x12'));var hardwareService=require(_0xdd66('0x13'));var logger=require('../../config/logger')(_0xdd66('0x14'));var utils=require(_0xdd66('0x15'));var config=require(_0xdd66('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xdd66('0x17'))['db'];config[_0xdd66('0x18')]=_['defaults'](config[_0xdd66('0x18')],{'host':_0xdd66('0x19'),'port':0x18eb});var socket=require(_0xdd66('0x1a'))(new Redis(config['redis']));require(_0xdd66('0x1b'))[_0xdd66('0x1c')](socket);function respondWithStatusCode(_0x522b20,_0x25ec43){_0x25ec43=_0x25ec43||0xcc;return function(_0xea69b9){if(_0xea69b9){return _0x522b20[_0xdd66('0x1d')](_0x25ec43);}return _0x522b20[_0xdd66('0x1e')](_0x25ec43)[_0xdd66('0x1f')]();};}function respondWithResult(_0x5024c3,_0x3ff3df){_0x3ff3df=_0x3ff3df||0xc8;return function(_0x4f8227){if(_0x4f8227){return _0x5024c3[_0xdd66('0x1e')](_0x3ff3df)[_0xdd66('0x20')](_0x4f8227);}};}function respondWithFilteredResult(_0x3c3d06,_0x46bc8b){return function(_0x57e881){if(_0x57e881){var _0x4dad5c=typeof _0x46bc8b[_0xdd66('0x21')]==='undefined'&&typeof _0x46bc8b[_0xdd66('0x22')]===_0xdd66('0x23');var _0x3e8fa2=_0x57e881['count'];var _0x29e73d=_0x4dad5c?0x0:_0x46bc8b[_0xdd66('0x21')];var _0x15da3d=_0x4dad5c?_0x57e881[_0xdd66('0x24')]:_0x46bc8b[_0xdd66('0x21')]+_0x46bc8b['limit'];var _0x5216a2;if(_0x15da3d>=_0x3e8fa2){_0x15da3d=_0x3e8fa2;_0x5216a2=0xc8;}else{_0x5216a2=0xce;}_0x3c3d06['status'](_0x5216a2);return _0x3c3d06[_0xdd66('0x25')](_0xdd66('0x26'),_0x29e73d+'-'+_0x15da3d+'/'+_0x3e8fa2)[_0xdd66('0x20')](_0x57e881);}return null;};}function patchUpdates(_0x6a2a6c){return function(_0x487efc){try{jsonpatch[_0xdd66('0x27')](_0x487efc,_0x6a2a6c,!![]);}catch(_0x35f67c){return BPromise[_0xdd66('0x28')](_0x35f67c);}return _0x487efc[_0xdd66('0x29')]();};}function saveUpdates(_0x1e9e08,_0x526547){return function(_0x5d76dd){if(_0x5d76dd){return _0x5d76dd[_0xdd66('0x2a')](_0x1e9e08)[_0xdd66('0x2b')](function(_0x3ef6f8){return _0x3ef6f8;});}return null;};}function removeEntity(_0x5c2d16,_0x145250){return function(_0x161179){if(_0x161179){return _0x161179[_0xdd66('0x2c')]()[_0xdd66('0x2b')](function(){_0x5c2d16[_0xdd66('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4acb0a,_0x13c93b){return function(_0x2e46f1){if(!_0x2e46f1){_0x4acb0a['sendStatus'](0x194);}return _0x2e46f1;};}function handleError(_0x221441,_0x4f1524){_0x4f1524=_0x4f1524||0x1f4;return function(_0x31b5b5){logger['error'](_0x31b5b5[_0xdd66('0x2d')]);if(_0x31b5b5[_0xdd66('0x2e')]){delete _0x31b5b5['name'];}_0x221441['status'](_0x4f1524)[_0xdd66('0x2f')](_0x31b5b5);};}function getInteractionUsers(_0x1aa44a,_0x13841c){return new BPromise(function(_0x3ca3fa,_0x585d4d){try{if(_0x13841c[_0x1aa44a['id']]){_0x1aa44a['Users']=_[_0xdd66('0x30')](_0x13841c[_0x1aa44a['id']],function(_0x35623c){return{'id':_0x35623c['id'],'fullname':_0x35623c[_0xdd66('0x31')]};});}}catch(_0x5ad77b){_0x585d4d(_0x5ad77b);}_0x3ca3fa(_0x1aa44a);});}function getInteractionTags(_0x5be136,_0x9178d2){return new BPromise(function(_0x1185cf,_0x4e962b){try{if(_0x5be136[_0xdd66('0x32')]){_0x5be136['Tags']=[];_0x5be136['TagIds'][_0xdd66('0x33')](',')[_0xdd66('0x34')](function(_0x59af31){_0x5be136[_0xdd66('0x35')][_0xdd66('0x36')](_0x9178d2[_0x59af31]);});}delete _0x5be136[_0xdd66('0x32')];}catch(_0x36665a){_0x4e962b(_0x36665a);}_0x1185cf(_0x5be136);});}function updateSmsInteraction(_0x67a0cf,_0x275fff,_0x188ea2){return new BPromise(function(_0x13605e,_0x4b53f8){return getInteractionUsers(_0x67a0cf,_0x188ea2)[_0xdd66('0x2b')](function(_0x13df83){return getInteractionTags(_0x13df83,_0x275fff);})[_0xdd66('0x2b')](function(_0x2a50ba){_0x13605e(_0x2a50ba);})[_0xdd66('0x37')](function(_0x1ba0d8){_0x4b53f8(_0x1ba0d8);});});}exports[_0xdd66('0x38')]=function(_0xd80aac,_0x594d02){var _0x428028={},_0x3d9c12={},_0x5e3438={'count':0x0,'rows':[]};var _0x4138a7=_[_0xdd66('0x30')](db[_0xdd66('0x39')]['rawAttributes'],function(_0x1bf609){return{'name':_0x1bf609[_0xdd66('0x3a')],'type':_0x1bf609[_0xdd66('0x3b')][_0xdd66('0x3c')]};});_0x3d9c12[_0xdd66('0x3d')]=_[_0xdd66('0x30')](_0x4138a7,'name');_0x3d9c12[_0xdd66('0x3e')]=_['keys'](_0xd80aac[_0xdd66('0x3e')]);_0x3d9c12[_0xdd66('0x3f')]=_[_0xdd66('0x40')](_0x3d9c12[_0xdd66('0x3d')],_0x3d9c12['query']);_0x428028['attributes']=_['intersection'](_0x3d9c12[_0xdd66('0x3d')],qs['fields'](_0xd80aac[_0xdd66('0x3e')][_0xdd66('0x41')]));_0x428028['attributes']=_0x428028[_0xdd66('0x42')][_0xdd66('0x43')]?_0x428028[_0xdd66('0x42')]:_0x3d9c12[_0xdd66('0x3d')];if(!_0xd80aac[_0xdd66('0x3e')][_0xdd66('0x44')]('nolimit')){_0x428028[_0xdd66('0x22')]=qs[_0xdd66('0x22')](_0xd80aac[_0xdd66('0x3e')][_0xdd66('0x22')]);_0x428028['offset']=qs[_0xdd66('0x21')](_0xd80aac[_0xdd66('0x3e')][_0xdd66('0x21')]);}_0x428028['order']=qs[_0xdd66('0x45')](_0xd80aac[_0xdd66('0x3e')][_0xdd66('0x45')]);_0x428028[_0xdd66('0x46')]=qs[_0xdd66('0x3f')](_[_0xdd66('0x47')](_0xd80aac[_0xdd66('0x3e')],_0x3d9c12[_0xdd66('0x3f')]),_0x4138a7);var _0x8e34d9=[];var _0x324943=squel['select']()[_0xdd66('0x48')]('id')[_0xdd66('0x48')](_0xdd66('0x2e'))[_0xdd66('0x48')]('color')[_0xdd66('0x49')](_0xdd66('0x4a'));var _0x350b0c=squel['select']()['field'](_0xdd66('0x4b'))[_0xdd66('0x48')](_0xdd66('0x4c'))[_0xdd66('0x48')](_0xdd66('0x4d'))['from'](_0xdd66('0x4e'),'ui')[_0xdd66('0x4f')]('users','u',_0xdd66('0x50'));var _0x133d6f=squel['select']()[_0xdd66('0x49')](_0xdd66('0x51'),'i')[_0xdd66('0x4f')](_0xdd66('0x52'),'c',_0xdd66('0x53'))[_0xdd66('0x4f')](_0xdd66('0x54'),'o',_0xdd66('0x55'))[_0xdd66('0x4f')](_0xdd66('0x56'),'a','a.id\x20=\x20i.SmsAccountId')[_0xdd66('0x4f')]('sms_messages','me','me.SmsInteractionId\x20=\x20i.id')['left_join'](_0xdd66('0x57'),'it','it.SmsInteractionId\x20=\x20i.id')['left_join'](_0xdd66('0x4a'),'t',_0xdd66('0x58'));var _0x106c53=squel[_0xdd66('0x59')]();var _0x339034=[];var _0x7708d6=squel[_0xdd66('0x59')]();var _0x4576ba;if(_0xd80aac['query'][_0xdd66('0x5a')]){_0x4576ba=as[_0xdd66('0x5b')](_0xd80aac['query']['search']);var _0x55a9f0=_0x4576ba[_0xdd66('0x5c')];for(var _0x43f97f=0x0;_0x43f97f<_0x4576ba['conditions'][_0xdd66('0x43')];_0x43f97f++){var _0xe88bb3=_0x4576ba[_0xdd66('0x5d')][_0x43f97f];var _0x322534='i';var _0x4e1fa5=_[_0xdd66('0x5e')](_0x4138a7,['name',_0xe88bb3[_0xdd66('0x48')]]);if(!_0x4e1fa5){switch(_0xe88bb3[_0xdd66('0x48')]){case _0xdd66('0x5f'):if(_0xe88bb3[_0xdd66('0x60')]==0x1){_0x133d6f[_0xdd66('0x61')]('`'+_0xe88bb3[_0xdd66('0x48')]+_0xdd66('0x62'));}else{_0x133d6f[_0xdd66('0x61')]('`'+_0xe88bb3[_0xdd66('0x48')]+_0xdd66('0x63'));}break;case _0xdd66('0x64'):if(_0xe88bb3[_0xdd66('0x65')]===_0xdd66('0x66')){if(_0xe88bb3['value'][_0xdd66('0x33')]('\x20')[_0xdd66('0x43')]>0x1){_0x106c53[_0x55a9f0](_0xdd66('0x67'),qs[_0xdd66('0x68')](_0xe88bb3[_0xdd66('0x60')]),null);}else{var _0x3f5fb7='%'+_0xe88bb3[_0xdd66('0x60')]+'%';_0x106c53[_0x55a9f0]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3f5fb7,_0x3f5fb7,_0x3f5fb7);}}else{_0x4e1fa5=_[_0xdd66('0x5e')](_0x4138a7,[_0xdd66('0x2e'),_0xdd66('0x69')]);_0xe88bb3['field']=_0xdd66('0x69');_0x5ae9f9=as[_0xdd66('0x6a')](_0x322534,_0x4e1fa5[_0xdd66('0x3b')],_0xe88bb3);_0x106c53[_0x55a9f0](_0x5ae9f9[_0xdd66('0x6b')],_0x5ae9f9[_0xdd66('0x60')][_0xdd66('0x6c')],_0x5ae9f9[_0xdd66('0x60')][_0xdd66('0x1f')]);}break;case'Tag':var _0x85362b=_0xe88bb3[_0xdd66('0x60')][_0xdd66('0x33')](',')[_0xdd66('0x30')](function(_0x55087b){return Number(_0x55087b);});_0x85362b[_0xdd66('0x34')](function(_0x22ccd0){_0x7708d6['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x22ccd0+',%');});_0x339034=_[_0xdd66('0x6d')](_0x339034,_0x85362b);break;case _0xdd66('0x6e'):if(_0xe88bb3['operator']===_0xdd66('0x66')){_0x106c53[_0x55a9f0]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0xe88bb3[_0xdd66('0x60')]+'%',null);}else{_0x4e1fa5=_[_0xdd66('0x5e')](_0x4138a7,[_0xdd66('0x2e'),_0xdd66('0x6f')]);_0xe88bb3['field']='UserId';_0x5ae9f9=as[_0xdd66('0x6a')](_0x322534,_0x4e1fa5[_0xdd66('0x3b')],_0xe88bb3);_0x106c53[_0x55a9f0](_0x5ae9f9['text'],_0x5ae9f9[_0xdd66('0x60')][_0xdd66('0x6c')],_0x5ae9f9[_0xdd66('0x60')][_0xdd66('0x1f')]);}break;case'body':_0x5ae9f9=as['buildExpression']('me',null,_0xe88bb3);_0x106c53[_0x55a9f0](_0x5ae9f9['text'],_0x5ae9f9['value'][_0xdd66('0x6c')],_0x5ae9f9[_0xdd66('0x60')][_0xdd66('0x1f')]);break;}}else{var _0x5ae9f9=as[_0xdd66('0x6a')](_0x322534,_0x4e1fa5['type'],_0xe88bb3);_0x106c53[_0x55a9f0](_0x5ae9f9['text'],_0x5ae9f9['value'][_0xdd66('0x6c')],_0x5ae9f9[_0xdd66('0x60')][_0xdd66('0x1f')]);}}}else{var _0x21eef9=_(_0xd80aac[_0xdd66('0x3e')])[_0xdd66('0x70')]()['map'](function(_0x27192b){return _['some'](_0x4138a7,[_0xdd66('0x2e'),_0x27192b])?_0x27192b:undefined;})[_0xdd66('0x71')]()[_0xdd66('0x60')]();if(!_['isEmpty'](_0x21eef9)){_0x21eef9['forEach'](function(_0x2dd081){if(_0x2dd081===_0xdd66('0x72')){_0x133d6f[_0xdd66('0x46')](_0xdd66('0x73'),[][_0xdd66('0x74')](_0xd80aac[_0xdd66('0x3e')][_0x2dd081]));}else if(_0x2dd081===_0xdd66('0x75')){var _0x2f6969=JSON['parse'](_0xd80aac[_0xdd66('0x3e')][_0x2dd081])[_0xdd66('0x76')];var _0x9e8104=JSON[_0xdd66('0x77')](_0xd80aac[_0xdd66('0x3e')][_0x2dd081])[_0xdd66('0x78')];_0x133d6f['where'](_0xdd66('0x79'),_0x2f6969,_0x9e8104);}else{if(_0xd80aac[_0xdd66('0x3e')][_0x2dd081]===_0xdd66('0x7a')){_0x133d6f[_0xdd66('0x46')]('i.'+_0x2dd081+_0xdd66('0x7b'));}else{_0x133d6f[_0xdd66('0x46')]('i.'+_0x2dd081+_0xdd66('0x7c'),_0xd80aac[_0xdd66('0x3e')][_0x2dd081]);}}});}if(_0xd80aac[_0xdd66('0x3e')][_0xdd66('0x7d')]){if(_0xd80aac['query'][_0xdd66('0x7d')]==0x1){_0x133d6f[_0xdd66('0x61')](_0xdd66('0x7e'));}else{_0x133d6f[_0xdd66('0x61')](_0xdd66('0x7f'));}}if(_0xd80aac['query']['tag']){_0x339034=_[_0xdd66('0x80')](_0xd80aac[_0xdd66('0x3e')][_0xdd66('0x81')])?_0xd80aac[_0xdd66('0x3e')]['tag']:new Array(_0xd80aac[_0xdd66('0x3e')][_0xdd66('0x81')]);_0x339034[_0xdd66('0x34')](function(_0x5a7798){_0x7708d6['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5a7798+',%');});}if(_0xd80aac['query'][_0xdd66('0x82')]){var _0x2f4fb1=_0xd80aac['query']['filter']['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xdd66('0x83')](_0x2f4fb1)){_0x106c53['or'](_0xdd66('0x84'),_0x2f4fb1+'%')['or'](_0xdd66('0x85'),_0x2f4fb1+'%');}else{_0x106c53['or'](_0xdd66('0x86'),qs[_0xdd66('0x68')](_0x2f4fb1))['or'](_0xdd66('0x87'),_0x2f4fb1+'%');}}}_0x133d6f[_0xdd66('0x46')](_0x106c53);_0x133d6f[_0xdd66('0x88')](_0xdd66('0x89'));var _0x2bf8f4={'type':db[_0xdd66('0x8a')]['QueryTypes'][_0xdd66('0x8b')],'raw':!![]};var _0x5c20e7=_0x133d6f[_0xdd66('0x8c')]();_0x5c20e7['field']('i.id');_0x5c20e7[_0xdd66('0x48')](_0xdd66('0x8d'),'unreadMessages');if(_0x428028['order']){_0x428028[_0xdd66('0x8e')]['forEach'](function(_0x110a34){var _0x40ec24=_0x110a34[0x0]===_0xdd66('0x8f')?_0x110a34[0x0]:'i.'+_0x110a34[0x0];_0x133d6f[_0xdd66('0x8e')](_0x40ec24,_0x110a34[0x1]===_0xdd66('0x90')?![]:!![]);});}if(!_[_0xdd66('0x91')](_0x339034)){_0x133d6f[_0xdd66('0x61')](_0x7708d6);_0x5c20e7[_0xdd66('0x46')](_0xdd66('0x92'),_0x339034);}BPromise[_0xdd66('0x93')]()[_0xdd66('0x2b')](function(){if(!_0x4576ba){if(_0xd80aac[_0xdd66('0x3e')][_0xdd66('0x72')])return;_0x5c20e7[_0xdd66('0x46')](_0xdd66('0x94'));_0x133d6f['where'](_0xdd66('0x94'));return;}if(_0xd80aac[_0xdd66('0x95')]['role']!=='agent')return;return _0xd80aac['user'][_0xdd66('0x96')]({'attributes':['id'],'raw':!![]})[_0xdd66('0x2b')](function(_0x47c7e2){if(_[_0xdd66('0x91')](_0x47c7e2)){_0x5c20e7[_0xdd66('0x46')](_0xdd66('0x97'));_0x133d6f[_0xdd66('0x46')](_0xdd66('0x97'));}else{_0x5c20e7[_0xdd66('0x46')](_0xdd66('0x73'),_[_0xdd66('0x30')](_0x47c7e2,'id'));_0x133d6f[_0xdd66('0x46')](_0xdd66('0x73'),_[_0xdd66('0x30')](_0x47c7e2,'id'));}});})[_0xdd66('0x2b')](function(){if(_0xd80aac[_0xdd66('0x95')]['role']===_0xdd66('0x98')&&!_0x4576ba&&!_0xd80aac[_0xdd66('0x3e')][_0xdd66('0x72')])return[];return db['sequelize'][_0xdd66('0x3e')](_0x5c20e7['toString'](),_0x2bf8f4);})['then'](function(_0x513396){_0x5e3438[_0xdd66('0x24')]=_0x513396['length'];if(_0x5e3438[_0xdd66('0x24')]===0x0)return[];return db['sequelize']['query'](_0x324943['toString'](),_0x2bf8f4)[_0xdd66('0x2b')](function(_0x1e133c){_0x8e34d9=_[_0xdd66('0x99')](_0x1e133c,'id');_0x2bf8f4=_[_0xdd66('0x9a')](_0x2bf8f4,{'model':db[_0xdd66('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xd80aac[_0xdd66('0x3e')][_0xdd66('0x41')]){_0x428028[_0xdd66('0x42')][_0xdd66('0x34')](function(_0x416103){_0x133d6f[_0xdd66('0x48')]('i.'+_0x416103);});}else{_0x133d6f[_0xdd66('0x48')](_0xdd66('0x8d'),_0xdd66('0x5f'));_0x133d6f[_0xdd66('0x48')](_0xdd66('0x9b'),_0xdd66('0x9c'));_0x133d6f[_0xdd66('0x48')](_0xdd66('0x9d'),_0xdd66('0x9e'));_0x133d6f['field'](_0xdd66('0x9f'),_0xdd66('0x8f'));_0x133d6f[_0xdd66('0x48')](_0xdd66('0xa0'));_0x133d6f[_0xdd66('0x48')](_0xdd66('0xa1'),_0xdd66('0xa2'));_0x133d6f[_0xdd66('0x48')](_0xdd66('0xa3'),_0xdd66('0xa4'));_0x133d6f[_0xdd66('0x48')](_0xdd66('0xa5'),_0xdd66('0xa6'));_0x133d6f[_0xdd66('0x48')](_0xdd66('0xa7'),_0xdd66('0xa8'));_0x133d6f['field'](_0xdd66('0xa9'),_0xdd66('0xaa'));_0x133d6f[_0xdd66('0x48')](_0xdd66('0xab'),_0xdd66('0xac'));_0x133d6f['field'](_0xdd66('0xad'),_0xdd66('0xae'));_0x133d6f['field'](_0xdd66('0xaf'),_0xdd66('0xb0'));_0x133d6f['field'](_0xdd66('0xb1'),_0xdd66('0x32'));}if(_0x428028[_0xdd66('0x22')])_0x133d6f['limit'](_0x428028['limit']);if(_0x428028['offset'])_0x133d6f['offset'](_0x428028[_0xdd66('0x21')]);return db['sequelize'][_0xdd66('0x3e')](_0x133d6f[_0xdd66('0xb2')](),_0x2bf8f4);})[_0xdd66('0x2b')](function(_0x2c6dcd){if(_0x2c6dcd[_0xdd66('0x43')]>0x0)_0x350b0c['where'](_0xdd66('0xb3'),_[_0xdd66('0x30')](_0x2c6dcd,'id'));return db[_0xdd66('0xb4')][_0xdd66('0x3e')](_0x350b0c[_0xdd66('0xb2')](),_0x2bf8f4)[_0xdd66('0x2b')](function(_0x16c839){var _0x22b884=_[_0xdd66('0xb5')](_0x16c839,_0xdd66('0xb6'));var _0x45204f=[];_0x2c6dcd[_0xdd66('0x34')](function(_0x26a9f7){_0x45204f[_0xdd66('0x36')](updateSmsInteraction(_0x26a9f7,_0x8e34d9,_0x22b884));});return BPromise[_0xdd66('0xb7')](_0x45204f);});});})[_0xdd66('0x2b')](function(_0x1b9631){_0x5e3438[_0xdd66('0xb8')]=_0x1b9631;return _0x5e3438;})['then'](respondWithFilteredResult(_0x594d02,_0x428028))['catch'](handleError(_0x594d02,null));};exports[_0xdd66('0xb9')]=function(_0x3e451e,_0x5d1ad3){var _0x306228={'raw':![],'where':{'id':_0x3e451e['params']['id']}},_0x1dfe66={};_0x1dfe66['model']=_[_0xdd66('0x70')](db[_0xdd66('0x39')][_0xdd66('0xba')]);_0x1dfe66[_0xdd66('0x3e')]=_[_0xdd66('0x70')](_0x3e451e[_0xdd66('0x3e')]);_0x1dfe66[_0xdd66('0x3f')]=_['intersection'](_0x1dfe66[_0xdd66('0x3d')],_0x1dfe66['query']);_0x306228[_0xdd66('0x42')]=_[_0xdd66('0x40')](_0x1dfe66[_0xdd66('0x3d')],qs[_0xdd66('0x41')](_0x3e451e[_0xdd66('0x3e')][_0xdd66('0x41')]));_0x306228[_0xdd66('0x42')]=_0x306228['attributes'][_0xdd66('0x43')]?_0x306228[_0xdd66('0x42')]:_0x1dfe66[_0xdd66('0x3d')];if(_0x3e451e[_0xdd66('0x3e')][_0xdd66('0xbb')]){_0x306228[_0xdd66('0xbc')]=[{'all':!![]}];}_0x306228=_[_0xdd66('0x9a')]({},_0x306228,_0x3e451e[_0xdd66('0xbd')]);return db[_0xdd66('0x39')][_0xdd66('0x5e')](_0x306228)[_0xdd66('0x2b')](handleEntityNotFound(_0x5d1ad3,null))[_0xdd66('0x2b')](respondWithResult(_0x5d1ad3,null))[_0xdd66('0x37')](handleError(_0x5d1ad3,null));};exports[_0xdd66('0xbe')]=function(_0x62916f,_0x281625){return db['SmsInteraction']['create'](_0x62916f[_0xdd66('0xbf')],{})[_0xdd66('0x2b')](respondWithResult(_0x281625,0xc9))[_0xdd66('0x37')](handleError(_0x281625,null));};exports['update']=function(_0x2564db,_0x3d7ad0){if(_0x2564db[_0xdd66('0xbf')]['id']){delete _0x2564db['body']['id'];}return db[_0xdd66('0x39')][_0xdd66('0x5e')]({'where':{'id':_0x2564db[_0xdd66('0xc0')]['id']}})['then'](handleEntityNotFound(_0x3d7ad0,null))[_0xdd66('0x2b')](saveUpdates(_0x2564db['body'],null))['then'](respondWithResult(_0x3d7ad0,null))[_0xdd66('0x37')](handleError(_0x3d7ad0,null));};exports[_0xdd66('0x2c')]=function(_0x4e39c5,_0x2f5b2d){return db[_0xdd66('0x39')][_0xdd66('0x5e')]({'where':{'id':_0x4e39c5[_0xdd66('0xc0')]['id']}})[_0xdd66('0x2b')](handleEntityNotFound(_0x2f5b2d,null))[_0xdd66('0x2b')](removeEntity(_0x2f5b2d,null))[_0xdd66('0x37')](handleError(_0x2f5b2d,null));};exports[_0xdd66('0xc1')]=function(_0x283a29,_0x2fbed5){return db['SmsInteraction'][_0xdd66('0xc1')]()['then'](respondWithResult(_0x2fbed5,null))[_0xdd66('0x37')](handleError(_0x2fbed5,null));};exports[_0xdd66('0xc2')]=function(_0x592af5,_0x2c4c6e,_0x242423){return db[_0xdd66('0xc3')]['find']({'where':{'id':_0x592af5[_0xdd66('0xc0')]['id']}})[_0xdd66('0x2b')](handleEntityNotFound(_0x2c4c6e,null))[_0xdd66('0x2b')](function(_0x14370d){if(_0x14370d){return _0x14370d['addMessage'](_0x592af5[_0xdd66('0xbf')][_0xdd66('0xc4')],_[_0xdd66('0xc5')](_0x592af5[_0xdd66('0xbf')],[_0xdd66('0xc4'),'id'])||{});}})['then'](respondWithResult(_0x2c4c6e,null))[_0xdd66('0x37')](handleError(_0x2c4c6e,null));};exports[_0xdd66('0xc6')]=function(_0x5c8a6f,_0x5e98a8,_0x3664eb){var _0x476297={'raw':![],'where':{}};var _0x5a91fa={};var _0x5b7cc9={'count':0x0,'rows':[]};return db[_0xdd66('0x39')]['findOne']({'where':{'id':_0x5c8a6f[_0xdd66('0xc0')]['id']}})[_0xdd66('0x2b')](handleEntityNotFound(_0x5e98a8,null))[_0xdd66('0x2b')](function(_0x4a02a7){if(_0x4a02a7){_0x5a91fa[_0xdd66('0x3d')]=_[_0xdd66('0x70')](db['SmsMessage'][_0xdd66('0xba')]);_0x5a91fa[_0xdd66('0x3e')]=_[_0xdd66('0x70')](_0x5c8a6f[_0xdd66('0x3e')]);_0x5a91fa[_0xdd66('0x3f')]=_[_0xdd66('0x40')](_0x5a91fa[_0xdd66('0x3d')],_0x5a91fa[_0xdd66('0x3e')]);_0x476297[_0xdd66('0x42')]=_['intersection'](_0x5a91fa[_0xdd66('0x3d')],qs['fields'](_0x5c8a6f['query'][_0xdd66('0x41')]));_0x476297['attributes']=_0x476297[_0xdd66('0x42')][_0xdd66('0x43')]?_0x476297[_0xdd66('0x42')]:_0x5a91fa[_0xdd66('0x3d')];if(!_0x5c8a6f[_0xdd66('0x3e')][_0xdd66('0x44')]('nolimit')){_0x476297['limit']=qs[_0xdd66('0x22')](_0x5c8a6f['query'][_0xdd66('0x22')]);_0x476297[_0xdd66('0x21')]=qs[_0xdd66('0x21')](_0x5c8a6f[_0xdd66('0x3e')][_0xdd66('0x21')]);}_0x476297[_0xdd66('0x8e')]=qs['sort'](_0x5c8a6f['query'][_0xdd66('0x45')]);_0x476297[_0xdd66('0x46')]=qs['filters'](_[_0xdd66('0x47')](_0x5c8a6f['query'],_0x5a91fa[_0xdd66('0x3f')]));_0x476297[_0xdd66('0x46')]['SmsInteractionId']=_0x4a02a7['id'];if(_0x5c8a6f['query']['filter']){_0x476297['where']=_[_0xdd66('0x9a')](_0x476297[_0xdd66('0x46')],{'$or':_[_0xdd66('0x30')](_0x476297[_0xdd66('0x42')],function(_0x1a3305){var _0x9c41e2={};_0x9c41e2[_0x1a3305]={'$like':'%'+_0x5c8a6f[_0xdd66('0x3e')][_0xdd66('0x82')]+'%'};return _0x9c41e2;})});}if(_0x5c8a6f[_0xdd66('0x3e')][_0xdd66('0x76')]){var _0xe4eda5=_0x5c8a6f[_0xdd66('0x3e')]['$gte'][_0xdd66('0x33')](',');var _0x4bcce5={};_0x4bcce5[_0xe4eda5[0x0]]={'$gte':moment(_0xe4eda5[0x1])[_0xdd66('0xc7')](_0xdd66('0xc8'))};_0x476297[_0xdd66('0x46')]=_[_0xdd66('0x9a')](_0x476297['where'],_0x4bcce5);}_0x476297=_[_0xdd66('0x9a')]({},_0x476297,_0x5c8a6f[_0xdd66('0xbd')]);return db[_0xdd66('0xc3')][_0xdd66('0x24')]({'where':_0x476297['where']})['then'](function(_0x38ece2){_0x5b7cc9[_0xdd66('0x24')]=_0x38ece2;if(_0x5c8a6f[_0xdd66('0x3e')][_0xdd66('0xbb')]){_0x476297['include']=[{'all':!![]}];}return db[_0xdd66('0xc3')][_0xdd66('0xc9')](_0x476297);})[_0xdd66('0x2b')](function(_0x204cf8){_0x5b7cc9[_0xdd66('0xb8')]=_0x204cf8;return _0x5b7cc9;});}})[_0xdd66('0x2b')](respondWithFilteredResult(_0x5e98a8,_0x476297))[_0xdd66('0x37')](handleError(_0x5e98a8,null));};exports['addTags']=function(_0x45649d,_0x4e61a4,_0xc4978e){return db[_0xdd66('0x39')][_0xdd66('0x5e')]({'where':{'id':_0x45649d[_0xdd66('0xc0')]['id']}})[_0xdd66('0x2b')](handleEntityNotFound(_0x4e61a4,null))[_0xdd66('0x2b')](function(_0x31cc71){if(_0x31cc71){return _0x31cc71[_0xdd66('0xca')](_0x45649d[_0xdd66('0xbf')][_0xdd66('0xc4')],_[_0xdd66('0xc5')](_0x45649d['body'],[_0xdd66('0xc4'),'id'])||{})['spread'](function(){return db[_0xdd66('0xcb')][_0xdd66('0xc9')]({'attributes':['id',_0xdd66('0x2e'),'color'],'where':{'id':_0x45649d[_0xdd66('0xbf')][_0xdd66('0xc4')]}});})[_0xdd66('0x2b')](function(_0x552e00){socket['emit'](_0xdd66('0xcc'),{'id':Number(_0x45649d[_0xdd66('0xc0')]['id']),'tags':_0x552e00||[]});return{'id':Number(_0x45649d[_0xdd66('0xc0')]['id']),'tags':_0x552e00||[]};});}})[_0xdd66('0x2b')](respondWithResult(_0x4e61a4,null))['catch'](handleError(_0x4e61a4,null));};exports[_0xdd66('0xcd')]=function(_0x3e558e,_0x4325d3,_0x236f4e){return db[_0xdd66('0x39')][_0xdd66('0x5e')]({'where':{'id':_0x3e558e[_0xdd66('0xc0')]['id']}})[_0xdd66('0x2b')](handleEntityNotFound(_0x4325d3,null))[_0xdd66('0x2b')](function(_0x184654){if(_0x184654){return _0x184654[_0xdd66('0xcd')](_0x3e558e['query'][_0xdd66('0xc4')]);}})[_0xdd66('0x2b')](respondWithStatusCode(_0x4325d3,null))[_0xdd66('0x37')](handleError(_0x4325d3,null));};exports[_0xdd66('0xce')]=function(_0x33012e,_0x46b3ab){var _0x5644d3=moment()['unix']()[_0xdd66('0xb2')]();var _0xdcd519=path[_0xdd66('0xcf')](config[_0xdd66('0xd0')],_0xdd66('0xd1'),_0xdd66('0xd2'),'tmp');var _0x5ae2cb=path['join'](config['root'],_0xdd66('0xd1'),_0xdd66('0xd2'),_0xdd66('0xd3'));var _0x4e77cd=path['join'](_0xdcd519,_0x5644d3);var _0x124c9a=util[_0xdd66('0xc7')]('transcript-%d-%s.zip',_0x33012e[_0xdd66('0xc0')]['id'],_0x5644d3);var _0x8fdebf=path[_0xdd66('0xcf')](_0xdcd519,_0x124c9a);var _0x380762=[];_0x380762[_0xdd66('0x36')]({'model':db[_0xdd66('0x6e')],'as':'User','attributes':['id',_0xdd66('0x31')],'raw':!![]});_0x380762[_0xdd66('0x36')]({'model':db[_0xdd66('0xd4')],'as':_0xdd66('0x64'),'attributes':['id',_0xdd66('0xd5'),_0xdd66('0xd6')],'raw':!![]});var _0x5c8e47=[{'model':db['SmsMessage'],'as':_0xdd66('0xd7'),'attributes':['id','body',_0xdd66('0x75'),'direction','secret',_0xdd66('0x7d')],'include':_0x380762}];_0x5c8e47[_0xdd66('0x36')]({'model':db['SmsAccount'],'as':_0xdd66('0xd8'),'attributes':['id',_0xdd66('0x2e')]});_0x5c8e47[_0xdd66('0x36')]({'model':db[_0xdd66('0x6e')],'as':_0xdd66('0xd9'),'attributes':['id',_0xdd66('0x31')]});return db[_0xdd66('0x39')][_0xdd66('0x5e')]({'where':{'id':_0x33012e[_0xdd66('0xc0')]['id']},'include':_0x5c8e47})[_0xdd66('0x2b')](handleEntityNotFound(_0x46b3ab,null))[_0xdd66('0x2b')](function(_0x8e05da){if(_0x8e05da){var _0x278769=_0x8e05da[_0xdd66('0xda')]({'plain':!![]});fs[_0xdd66('0xdb')](_0x4e77cd);var _0x40e686={'channel':_0xdd66('0xdc'),'account':_0x278769[_0xdd66('0xd8')][_0xdd66('0x2e')],'agent':_0x278769['Owner']?_0x278769[_0xdd66('0xd9')][_0xdd66('0x31')]:'N.A.','createdAt':moment(_0x278769['createdAt'])[_0xdd66('0xc7')](_0xdd66('0xc8'))[_0xdd66('0xb2')](),'closedAt':_0x278769[_0xdd66('0xdd')]?moment(_0x278769[_0xdd66('0xde')])[_0xdd66('0xc7')]('YYYY-MM-DD\x20HH:mm:ss')[_0xdd66('0xb2')]():'','disposition':_0x278769[_0xdd66('0xdf')],'messages':_(_0x278769[_0xdd66('0xd7')])['filter']({'secret':![]})[_0xdd66('0x30')](function(_0x44a831){return{'date':moment(_0x44a831[_0xdd66('0x75')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xdd66('0xb2')](),'sender':_0x44a831['direction']===_0xdd66('0xe0')?_0x44a831[_0xdd66('0x6e')]?_0x44a831['User'][_0xdd66('0x31')]:_0xdd66('0xe1'):_0x44a831[_0xdd66('0x64')][_0xdd66('0xd5')]+(_0x44a831[_0xdd66('0x64')][_0xdd66('0xd6')]?'\x20'+_0x44a831['Contact']['lastName']:''),'body':_0x44a831[_0xdd66('0xbf')],'direction':_0x44a831[_0xdd66('0xe2')]===_0xdd66('0xe0')?'A':'C','secret':_0x44a831[_0xdd66('0xe3')],'read':_0x44a831[_0xdd66('0x7d')]};})[_0xdd66('0x60')]()};return ejs[_0xdd66('0xe4')](path[_0xdd66('0xcf')](config[_0xdd66('0xd0')],'server','views',_0xdd66('0xe5')),{'interaction':_0x40e686})[_0xdd66('0x2b')](function(_0x461e7e){var _0x595dec=path[_0xdd66('0xcf')](_0x4e77cd,_0xdd66('0xe6')+_0x278769['id']+'-'+_0x5644d3+_0xdd66('0xe7'));var _0x273b21={'path':_0x595dec,'channel':_0xdd66('0xdc'),'interactionId':_0x278769['id']};return pdf['createPdfFromHTML'](_0x461e7e,_0x273b21);})['then'](function(){return new BPromise(function(_0x52b409,_0x377010){zipdir(_0x4e77cd,{'saveTo':_0x8fdebf},function(_0x3fef40,_0x387ad2){if(_0x3fef40)return _0x377010(_0x3fef40);return _0x52b409(_0x387ad2);});})[_0xdd66('0x2b')](function(){return new BPromise(function(_0x374d2d,_0x41c1b6){rimraf(_0x4e77cd,function(_0x40b5cf){if(_0x40b5cf)_0x41c1b6(_0x40b5cf);return _0x374d2d();});});})[_0xdd66('0x2b')](function(){return _0x46b3ab[_0xdd66('0xce')](_0x8fdebf,_0x124c9a,function(_0x2f93c5){if(_0x2f93c5){console[_0xdd66('0xe8')](_0xdd66('0xe9'),_0x2f93c5);}else{fs[_0xdd66('0xea')](_0x8fdebf);}});});});}else{return _0x46b3ab[_0xdd66('0x1d')](0xc8);}})['catch'](handleError(_0x46b3ab,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index b2f0691..7536905 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 _0xadb5=['update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x41f9c3,_0x53117c){var _0x1201b3=function(_0x1d505e){while(--_0x1d505e){_0x41f9c3['push'](_0x41f9c3['shift']());}};_0x1201b3(++_0x53117c);}(_0xadb5,0xad));var _0x5adb=function(_0x56d871,_0x5cb372){_0x56d871=_0x56d871-0x0;var _0x2c2356=_0xadb5[_0x56d871];return _0x2c2356;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x5adb('0x0'))['db']['SmsInteraction'];var SmsMessage=require(_0x5adb('0x0'))['db'][_0x5adb('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x5adb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5adb('0x3'),'afterDestroy':_0x5adb('0x4')};function emitEvent(_0x2e3ef4){return function(_0x4cb1d1,_0x35a5d3,_0x168d89){_0x4cb1d1[_0x5adb('0x5')]({'attributes':['id'],'raw':!![]})[_0x5adb('0x6')](function(_0xdf3776){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0x8'),_0xdf3776[_0x5adb('0x9')](function(_0x41261c){return{'id':_0x41261c['id']};}));return SmsMessage[_0x5adb('0xa')]({'where':{'SmsInteractionId':_0x4cb1d1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5adb('0x6')](function(_0x336bad){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0xb'),_0x336bad['length']);SmsInteractionEvents['emit'](_0x2e3ef4+':'+_0x4cb1d1['id'],_0x4cb1d1);SmsInteractionEvents[_0x5adb('0xc')](_0x2e3ef4,_0x4cb1d1);_0x168d89(null);})[_0x5adb('0xd')](_0x168d89(null));};}for(var e in events){if(events[_0x5adb('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x5adb('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0x8e3f=['hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8e3f[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0xf8e3('0x0'));var SmsInteraction=require(_0xf8e3('0x1'))['db'][_0xf8e3('0x2')];var SmsMessage=require('../../mysqldb')['db'][_0xf8e3('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xf8e3('0x4')](0x0);var events={'afterCreate':_0xf8e3('0x5'),'afterUpdate':'update','afterDestroy':_0xf8e3('0x6')};function emitEvent(_0x41bc05){return function(_0x4dab56,_0x35e88f,_0xb21f8d){_0x4dab56[_0xf8e3('0x7')]({'attributes':['id'],'raw':!![]})[_0xf8e3('0x8')](function(_0x4e9e57){_0x4dab56[_0xf8e3('0x9')](_0xf8e3('0xa'),_0x4e9e57[_0xf8e3('0xb')](function(_0x95ad03){return{'id':_0x95ad03['id']};}));return SmsMessage[_0xf8e3('0xc')]({'where':{'SmsInteractionId':_0x4dab56['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf8e3('0x8')](function(_0x299a7e){_0x4dab56[_0xf8e3('0x9')](_0xf8e3('0xd'),_0x299a7e[_0xf8e3('0xe')]);SmsInteractionEvents[_0xf8e3('0xf')](_0x41bc05+':'+_0x4dab56['id'],_0x4dab56);SmsInteractionEvents[_0xf8e3('0xf')](_0x41bc05,_0x4dab56);_0xb21f8d(null);})['catch'](_0xb21f8d(null));};}for(var e in events){if(events[_0xf8e3('0x10')](e)){var event=events[e];SmsInteraction[_0xf8e3('0x11')](e,emitEvent(event));}}module[_0xf8e3('0x12')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index f680e00..65dec61 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 _0x5694=['./smsInteraction.attributes','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','request-promise','../../config/environment'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x5694,0x18f));var _0x4569=function(_0x2dbc96,_0x4e1677){_0x2dbc96=_0x2dbc96-0x0;var _0x35f4d0=_0x5694[_0x2dbc96];return _0x35f4d0;};'use strict';var _=require('lodash');var util=require(_0x4569('0x0'));var logger=require(_0x4569('0x1'))(_0x4569('0x2'));var moment=require(_0x4569('0x3'));var BPromise=require('bluebird');var rp=require(_0x4569('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4569('0x5'));var attributes=require(_0x4569('0x6'));module['exports']=function(_0x28d642,_0xb4b574){return _0x28d642[_0x4569('0x7')](_0x4569('0x8'),attributes,{'tableName':_0x4569('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x70d9ca,_0x4d7210,_0x1e083c){if(_0x70d9ca[_0x4569('0xa')](_0x4569('0xb'))){_0x70d9ca[_0x4569('0xc')]=moment()[_0x4569('0xd')](_0x4569('0xe'));}_0x1e083c(null,_0x70d9ca);}}});}; \ No newline at end of file +var _0x979d=['define','sms_interactions','changed','closed','format','lodash','../../config/logger','moment','bluebird','path','rimraf','exports'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x979d,0x191));var _0xd979=function(_0x31c63f,_0x3df7ef){_0x31c63f=_0x31c63f-0x0;var _0x10add0=_0x979d[_0x31c63f];return _0x10add0;};'use strict';var _=require(_0xd979('0x0'));var util=require('util');var logger=require(_0xd979('0x1'))('api');var moment=require(_0xd979('0x2'));var BPromise=require(_0xd979('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd979('0x4'));var rimraf=require(_0xd979('0x5'));var config=require('../../config/environment');var attributes=require('./smsInteraction.attributes');module[_0xd979('0x6')]=function(_0x13110e,_0x3e7a61){return _0x13110e[_0xd979('0x7')]('SmsInteraction',attributes,{'tableName':_0xd979('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2863a5,_0x10e1dc,_0x6c687a){if(_0x2863a5[_0xd979('0x9')](_0xd979('0xa'))){_0x2863a5['closedAt']=moment()[_0xd979('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x6c687a(null,_0x2863a5);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index d804735..477efaf 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 _0xc5a9=['then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SmsInteraction','update','options','raw','where','attributes','UpdateSmsInteraction','stringify','AddTagsToSmsInteraction','find','addTags','body','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request'];(function(_0x466af7,_0x2f7551){var _0x348c96=function(_0x2d7477){while(--_0x2d7477){_0x466af7['push'](_0x466af7['shift']());}};_0x348c96(++_0x2f7551);}(_0xc5a9,0x1b0));var _0x9c5a=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0xc5a9[_0x2f45ea];return _0x485a84;};'use strict';var _=require('lodash');var util=require(_0x9c5a('0x0'));var moment=require(_0x9c5a('0x1'));var BPromise=require(_0x9c5a('0x2'));var rs=require(_0x9c5a('0x3'));var fs=require('fs');var Redis=require(_0x9c5a('0x4'));var db=require(_0x9c5a('0x5'))['db'];var utils=require(_0x9c5a('0x6'));var logger=require('../../config/logger')(_0x9c5a('0x7'));var config=require(_0x9c5a('0x8'));var jayson=require(_0x9c5a('0x9'));var client=jayson[_0x9c5a('0xa')][_0x9c5a('0xb')]({'port':0x232a});config[_0x9c5a('0xc')]=_['defaults'](config[_0x9c5a('0xc')],{'host':_0x9c5a('0xd'),'port':0x18eb});var socket=require(_0x9c5a('0xe'))(new Redis(config[_0x9c5a('0xc')]));require(_0x9c5a('0xf'))[_0x9c5a('0x10')](socket);function respondWithRpcPromise(_0x4c19c2,_0x4b92ed,_0x444a5){return new BPromise(function(_0x4b3550,_0x768fbc){return client[_0x9c5a('0x11')](_0x4c19c2,_0x444a5)[_0x9c5a('0x12')](function(_0x12f438){logger[_0x9c5a('0x13')](_0x9c5a('0x14'),_0x4b92ed,_0x9c5a('0x15'));logger[_0x9c5a('0x16')](_0x9c5a('0x17'),_0x4b92ed,'request\x20sent',JSON['stringify'](_0x12f438));if(_0x12f438['error']){if(_0x12f438[_0x9c5a('0x18')][_0x9c5a('0x19')]===0x1f4){logger[_0x9c5a('0x18')](_0x9c5a('0x14'),_0x4b92ed,_0x12f438[_0x9c5a('0x18')][_0x9c5a('0x1a')]);return _0x768fbc(_0x12f438[_0x9c5a('0x18')][_0x9c5a('0x1a')]);}logger[_0x9c5a('0x18')](_0x9c5a('0x14'),_0x4b92ed,_0x12f438[_0x9c5a('0x18')]['message']);return _0x4b3550(_0x12f438['error']['message']);}else{logger[_0x9c5a('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x4b92ed,_0x9c5a('0x15'));_0x4b3550(_0x12f438[_0x9c5a('0x1b')]['message']);}})[_0x9c5a('0x1c')](function(_0x5de15b){logger[_0x9c5a('0x18')](_0x9c5a('0x14'),_0x4b92ed,_0x5de15b);_0x768fbc(_0x5de15b);});});}exports['UpdateSmsInteraction']=function(_0x4e90ea){var _0xde2e96=this;return new Promise(function(_0x3ec1c6,_0x1817c5){return db[_0x9c5a('0x1d')][_0x9c5a('0x1e')](_0x4e90ea['body'],{'raw':_0x4e90ea[_0x9c5a('0x1f')]?_0x4e90ea['options'][_0x9c5a('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e90ea[_0x9c5a('0x1f')]?_0x4e90ea[_0x9c5a('0x1f')][_0x9c5a('0x21')]||null:null,'attributes':_0x4e90ea['options']?_0x4e90ea['options'][_0x9c5a('0x22')]||null:null,'limit':_0x4e90ea[_0x9c5a('0x1f')]?_0x4e90ea[_0x9c5a('0x1f')]['limit']||null:null})['then'](function(_0x49343f){logger[_0x9c5a('0x13')](_0x9c5a('0x23'),_0x4e90ea);logger[_0x9c5a('0x16')]('UpdateSmsInteraction',_0x4e90ea,JSON[_0x9c5a('0x24')](_0x49343f));_0x3ec1c6(_0x49343f);})[_0x9c5a('0x1c')](function(_0x161afb){logger[_0x9c5a('0x18')](_0x9c5a('0x23'),_0x161afb[_0x9c5a('0x1a')],_0x4e90ea);_0x1817c5(_0xde2e96[_0x9c5a('0x18')](0x1f4,_0x161afb[_0x9c5a('0x1a')]));});});};exports[_0x9c5a('0x25')]=function(_0x54520a){return new Promise(function(_0x2a6ca9,_0x3a9c24){return db['SmsInteraction'][_0x9c5a('0x26')]({'where':_0x54520a[_0x9c5a('0x1f')]?_0x54520a[_0x9c5a('0x1f')]['where']||null:null})['then'](function(_0x2d12de){if(_0x2d12de){return _0x2d12de[_0x9c5a('0x27')](_0x54520a[_0x9c5a('0x28')][_0x9c5a('0x29')],_[_0x9c5a('0x2a')](_0x54520a['body'],['ids','id'])||{});}})[_0x9c5a('0x2b')](function(_0x10bfe6){logger[_0x9c5a('0x13')](_0x9c5a('0x2c'),_0x54520a);logger['debug'](_0x9c5a('0x2c'),_0x54520a,JSON['stringify'](_0x10bfe6));_0x2a6ca9(_0x10bfe6);})['catch'](function(_0x284c9e){logger[_0x9c5a('0x18')](_0x9c5a('0x2c'),_0x284c9e[_0x9c5a('0x1a')],_0x54520a);_0x3a9c24(_this[_0x9c5a('0x18')](0x1f4,_0x284c9e[_0x9c5a('0x1a')]));});});}; \ No newline at end of file +var _0xd2bf=['addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateSmsInteraction','update','body','options','raw','where','limit','AddTagsToSmsInteraction','SmsInteraction'];(function(_0x2d54ba,_0x3e6ed6){var _0x1a133e=function(_0x14e303){while(--_0x14e303){_0x2d54ba['push'](_0x2d54ba['shift']());}};_0x1a133e(++_0x3e6ed6);}(_0xd2bf,0x10d));var _0xfd2b=function(_0x4d2263,_0x3fbf0d){_0x4d2263=_0x4d2263-0x0;var _0x24aba0=_0xd2bf[_0x4d2263];return _0x24aba0;};'use strict';var _=require(_0xfd2b('0x0'));var util=require(_0xfd2b('0x1'));var moment=require('moment');var BPromise=require(_0xfd2b('0x2'));var rs=require(_0xfd2b('0x3'));var fs=require('fs');var Redis=require(_0xfd2b('0x4'));var db=require(_0xfd2b('0x5'))['db'];var utils=require(_0xfd2b('0x6'));var logger=require('../../config/logger')(_0xfd2b('0x7'));var config=require(_0xfd2b('0x8'));var jayson=require(_0xfd2b('0x9'));var client=jayson['client'][_0xfd2b('0xa')]({'port':0x232a});config[_0xfd2b('0xb')]=_[_0xfd2b('0xc')](config[_0xfd2b('0xb')],{'host':_0xfd2b('0xd'),'port':0x18eb});var socket=require(_0xfd2b('0xe'))(new Redis(config['redis']));require(_0xfd2b('0xf'))[_0xfd2b('0x10')](socket);function respondWithRpcPromise(_0x41929e,_0xaeb079,_0x24ae65){return new BPromise(function(_0x328af2,_0x2cd1c4){return client[_0xfd2b('0x11')](_0x41929e,_0x24ae65)[_0xfd2b('0x12')](function(_0x3b8a94){logger[_0xfd2b('0x13')](_0xfd2b('0x14'),_0xaeb079,_0xfd2b('0x15'));logger[_0xfd2b('0x16')](_0xfd2b('0x17'),_0xaeb079,_0xfd2b('0x15'),JSON[_0xfd2b('0x18')](_0x3b8a94));if(_0x3b8a94[_0xfd2b('0x19')]){if(_0x3b8a94['error'][_0xfd2b('0x1a')]===0x1f4){logger[_0xfd2b('0x19')](_0xfd2b('0x14'),_0xaeb079,_0x3b8a94['error'][_0xfd2b('0x1b')]);return _0x2cd1c4(_0x3b8a94[_0xfd2b('0x19')]['message']);}logger[_0xfd2b('0x19')](_0xfd2b('0x14'),_0xaeb079,_0x3b8a94['error'][_0xfd2b('0x1b')]);return _0x328af2(_0x3b8a94['error'][_0xfd2b('0x1b')]);}else{logger[_0xfd2b('0x13')](_0xfd2b('0x14'),_0xaeb079,_0xfd2b('0x15'));_0x328af2(_0x3b8a94[_0xfd2b('0x1c')][_0xfd2b('0x1b')]);}})[_0xfd2b('0x1d')](function(_0x5b613f){logger[_0xfd2b('0x19')](_0xfd2b('0x14'),_0xaeb079,_0x5b613f);_0x2cd1c4(_0x5b613f);});});}exports[_0xfd2b('0x1e')]=function(_0xb927af){var _0x517fa6=this;return new Promise(function(_0x5e24c7,_0x541d54){return db['SmsInteraction'][_0xfd2b('0x1f')](_0xb927af[_0xfd2b('0x20')],{'raw':_0xb927af[_0xfd2b('0x21')]?_0xb927af[_0xfd2b('0x21')][_0xfd2b('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb927af[_0xfd2b('0x21')]?_0xb927af['options'][_0xfd2b('0x23')]||null:null,'attributes':_0xb927af['options']?_0xb927af['options']['attributes']||null:null,'limit':_0xb927af[_0xfd2b('0x21')]?_0xb927af[_0xfd2b('0x21')][_0xfd2b('0x24')]||null:null})['then'](function(_0x5f3636){logger[_0xfd2b('0x13')](_0xfd2b('0x1e'),_0xb927af);logger[_0xfd2b('0x16')](_0xfd2b('0x1e'),_0xb927af,JSON[_0xfd2b('0x18')](_0x5f3636));_0x5e24c7(_0x5f3636);})[_0xfd2b('0x1d')](function(_0x2a2a2c){logger[_0xfd2b('0x19')]('UpdateSmsInteraction',_0x2a2a2c[_0xfd2b('0x1b')],_0xb927af);_0x541d54(_0x517fa6['error'](0x1f4,_0x2a2a2c[_0xfd2b('0x1b')]));});});};exports[_0xfd2b('0x25')]=function(_0x4ca1ed){return new Promise(function(_0x563eef,_0x581cb0){return db[_0xfd2b('0x26')]['find']({'where':_0x4ca1ed[_0xfd2b('0x21')]?_0x4ca1ed['options'][_0xfd2b('0x23')]||null:null})[_0xfd2b('0x12')](function(_0x267d10){if(_0x267d10){return _0x267d10[_0xfd2b('0x27')](_0x4ca1ed['body'][_0xfd2b('0x28')],_[_0xfd2b('0x29')](_0x4ca1ed[_0xfd2b('0x20')],[_0xfd2b('0x28'),'id'])||{});}})[_0xfd2b('0x2a')](function(_0x2dd51a){logger[_0xfd2b('0x13')](_0xfd2b('0x2b'),_0x4ca1ed);logger[_0xfd2b('0x16')](_0xfd2b('0x2b'),_0x4ca1ed,JSON[_0xfd2b('0x18')](_0x2dd51a));_0x563eef(_0x2dd51a);})[_0xfd2b('0x1d')](function(_0xce7bae){logger[_0xfd2b('0x19')](_0xfd2b('0x2b'),_0xce7bae[_0xfd2b('0x1b')],_0x4ca1ed);_0x581cb0(_this[_0xfd2b('0x19')](0x1f4,_0xce7bae['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index b3ad198..f54d546 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 _0xa7e7=['smsInteraction:','save','length'];(function(_0x5cab39,_0x46b044){var _0x3a4c62=function(_0x3c3951){while(--_0x3c3951){_0x5cab39['push'](_0x5cab39['shift']());}};_0x3a4c62(++_0x46b044);}(_0xa7e7,0x1c6));var _0x7a7e=function(_0x2c85ee,_0x24f140){_0x2c85ee=_0x2c85ee-0x0;var _0x36a392=_0xa7e7[_0x2c85ee];return _0x36a392;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x7a7e('0x0'),'remove','update'];function createListener(_0x38e48a,_0x3bc5e9){return function(_0x1e1080){_0x3bc5e9['emit'](_0x38e48a,_0x1e1080);};}function removeListener(_0x316217,_0x4c95b2){return function(){SmsInteractionEvents['removeListener'](_0x316217,_0x4c95b2);};}exports['register']=function(_0x4bad8b){for(var _0x4f0125=0x0,_0x4fe811=events[_0x7a7e('0x1')];_0x4f0125<_0x4fe811;_0x4f0125++){var _0x50f3ed=events[_0x4f0125];var _0x206620=createListener(_0x7a7e('0x2')+_0x50f3ed,_0x4bad8b);SmsInteractionEvents['on'](_0x50f3ed,_0x206620);}}; \ No newline at end of file +var _0x59b7=['length','smsInteraction:','./smsInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x65e81e,_0x56016d){var _0x500391=function(_0x1998cd){while(--_0x1998cd){_0x65e81e['push'](_0x65e81e['shift']());}};_0x500391(++_0x56016d);}(_0x59b7,0xbf));var _0x759b=function(_0x5f382e,_0x338ea3){_0x5f382e=_0x5f382e-0x0;var _0x149e11=_0x59b7[_0x5f382e];return _0x149e11;};'use strict';var SmsInteractionEvents=require(_0x759b('0x0'));var events=[_0x759b('0x1'),_0x759b('0x2'),_0x759b('0x3')];function createListener(_0x58d05b,_0xde1c09){return function(_0x1ff847){_0xde1c09[_0x759b('0x4')](_0x58d05b,_0x1ff847);};}function removeListener(_0x1b50db,_0x58df6f){return function(){SmsInteractionEvents[_0x759b('0x5')](_0x1b50db,_0x58df6f);};}exports[_0x759b('0x6')]=function(_0xc73de6){for(var _0x13ae30=0x0,_0x5a9c72=events[_0x759b('0x7')];_0x13ae30<_0x5a9c72;_0x13ae30++){var _0x549fd7=events[_0x13ae30];var _0x3c51e6=createListener(_0x759b('0x8')+_0x549fd7,_0xc73de6);SmsInteractionEvents['on'](_0x549fd7,_0x3c51e6);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index ea48569..861cfce 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 _0x97db=['/:id/reject','reject','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','show','post','sms','smsmessage:create','create','/:id/status','status','put','/:id','update','/:id/accept','accept'];(function(_0x14a862,_0x2b559d){var _0x245eb5=function(_0x6e014c){while(--_0x6e014c){_0x14a862['push'](_0x14a862['shift']());}};_0x245eb5(++_0x2b559d);}(_0x97db,0x1b4));var _0xb97d=function(_0x1c1c7a,_0x3232c1){_0x1c1c7a=_0x1c1c7a-0x0;var _0x4e8c58=_0x97db[_0x1c1c7a];return _0x4e8c58;};'use strict';var multer=require(_0xb97d('0x0'));var util=require(_0xb97d('0x1'));var path=require(_0xb97d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb97d('0x3')]();var fs_extra=require(_0xb97d('0x4'));var auth=require(_0xb97d('0x5'));var interaction=require(_0xb97d('0x6'));var config=require('../../config/environment');var controller=require('./smsMessage.controller');router[_0xb97d('0x7')]('/',auth[_0xb97d('0x8')](),controller['index']);router['get'](_0xb97d('0x9'),auth['isAuthenticated'](),controller[_0xb97d('0xa')]);router[_0xb97d('0x7')]('/:id',auth[_0xb97d('0x8')](),controller[_0xb97d('0xb')]);router[_0xb97d('0xc')]('/',auth[_0xb97d('0x8')](),interaction['tracked'](_0xb97d('0xd'),_0xb97d('0xe')),controller[_0xb97d('0xf')]);router[_0xb97d('0xc')](_0xb97d('0x10'),controller[_0xb97d('0x11')]);router[_0xb97d('0x12')](_0xb97d('0x13'),auth[_0xb97d('0x8')](),controller[_0xb97d('0x14')]);router[_0xb97d('0x12')](_0xb97d('0x15'),auth[_0xb97d('0x8')](),controller[_0xb97d('0x16')]);router[_0xb97d('0x12')](_0xb97d('0x17'),auth[_0xb97d('0x8')](),controller[_0xb97d('0x18')]);router['delete'](_0xb97d('0x13'),auth[_0xb97d('0x8')](),controller[_0xb97d('0x19')]);module[_0xb97d('0x1a')]=router; \ No newline at end of file +var _0x76c0=['put','/:id/accept','accept','reject','/:id','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','tracked','sms','create','post','/:id/status','update'];(function(_0x3e4cbb,_0x1ec2fd){var _0x78c593=function(_0x4398e6){while(--_0x4398e6){_0x3e4cbb['push'](_0x3e4cbb['shift']());}};_0x78c593(++_0x1ec2fd);}(_0x76c0,0x84));var _0x076c=function(_0x51782d,_0x8842f6){_0x51782d=_0x51782d-0x0;var _0x578061=_0x76c0[_0x51782d];return _0x578061;};'use strict';var multer=require('multer');var util=require(_0x076c('0x0'));var path=require(_0x076c('0x1'));var timeout=require(_0x076c('0x2'));var express=require(_0x076c('0x3'));var router=express[_0x076c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x076c('0x5'));var config=require(_0x076c('0x6'));var controller=require(_0x076c('0x7'));router[_0x076c('0x8')]('/',auth[_0x076c('0x9')](),controller[_0x076c('0xa')]);router[_0x076c('0x8')](_0x076c('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x076c('0x8')]('/:id',auth[_0x076c('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),interaction[_0x076c('0xc')](_0x076c('0xd'),'smsmessage:create'),controller[_0x076c('0xe')]);router[_0x076c('0xf')](_0x076c('0x10'),controller['status']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x076c('0x11')]);router[_0x076c('0x12')](_0x076c('0x13'),auth[_0x076c('0x9')](),controller[_0x076c('0x14')]);router[_0x076c('0x12')]('/:id/reject',auth[_0x076c('0x9')](),controller[_0x076c('0x15')]);router['delete'](_0x076c('0x16'),auth['isAuthenticated'](),controller[_0x076c('0x17')]);module[_0x076c('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index c3aee9c..bbe3467 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 _0x277c=['ENUM','out','STRING','sequelize','TEXT','medium','BOOLEAN'];(function(_0x5d3bf0,_0x5c1ff2){var _0x43262f=function(_0x565da0){while(--_0x565da0){_0x5d3bf0['push'](_0x5d3bf0['shift']());}};_0x43262f(++_0x5c1ff2);}(_0x277c,0x153));var _0xc277=function(_0x28da81,_0x22069f){_0x28da81=_0x28da81-0x0;var _0x1ac3fa=_0x277c[_0x28da81];return _0x1ac3fa;};'use strict';var Sequelize=require(_0xc277('0x0'));module['exports']={'body':{'type':Sequelize[_0xc277('0x1')](_0xc277('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc277('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc277('0x4')]('in',_0xc277('0x5')),'defaultValue':_0xc277('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc277('0x6')](0xbe)},'phone':{'type':Sequelize[_0xc277('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xc277('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x94ba=['STRING','sequelize','exports','TEXT','medium','BOOLEAN','out'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x94ba,0xbe));var _0xa94b=function(_0x40c05f,_0x4d79a1){_0x40c05f=_0x40c05f-0x0;var _0x145ffe=_0x94ba[_0x40c05f];return _0x145ffe;};'use strict';var Sequelize=require(_0xa94b('0x0'));module[_0xa94b('0x1')]={'body':{'type':Sequelize[_0xa94b('0x2')](_0xa94b('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xa94b('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa94b('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xa94b('0x6')](0xbe)},'phone':{'type':Sequelize[_0xa94b('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa94b('0x6')]},'providerResponse':{'type':Sequelize[_0xa94b('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 5a31b4e..647dd78 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 _0xc5b3=['motionChannel','event','EventManager','../../config/logger','reject','sms','RejectMessage','rejectMessage','ContactId','sequelize','fullname','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageUUID','indexOf','sent','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','http','client','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','json','offset','undefined','count','set','apply','save','update','then','destroy','end','stack','name','send','index','map','SmsMessage','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','show','params','include','catch','create','body','find','describe','sms-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','SmsInteraction','SmsInteractionId','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','User','agent','email','internal','manual','interface','SIP/%s','channel'];(function(_0x4aac5a,_0x15b04c){var _0x42e7bc=function(_0x1da766){while(--_0x1da766){_0x4aac5a['push'](_0x4aac5a['shift']());}};_0x42e7bc(++_0x15b04c);}(_0xc5b3,0x1ee));var _0x3c5b=function(_0x112fe3,_0x16b642){_0x112fe3=_0x112fe3-0x0;var _0x1ec903=_0xc5b3[_0x112fe3];return _0x1ec903;};'use strict';var emlformat=require(_0x3c5b('0x0'));var rimraf=require(_0x3c5b('0x1'));var zipdir=require(_0x3c5b('0x2'));var jsonpatch=require(_0x3c5b('0x3'));var rp=require(_0x3c5b('0x4'));var moment=require(_0x3c5b('0x5'));var BPromise=require(_0x3c5b('0x6'));var Mustache=require(_0x3c5b('0x7'));var util=require('util');var path=require(_0x3c5b('0x8'));var sox=require(_0x3c5b('0x9'));var csv=require('to-csv');var ejs=require(_0x3c5b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3c5b('0xb'));var squel=require(_0x3c5b('0xc'));var crypto=require(_0x3c5b('0xd'));var jsforce=require(_0x3c5b('0xe'));var deskjs=require(_0x3c5b('0xf'));var toCsv=require(_0x3c5b('0x10'));var querystring=require(_0x3c5b('0x11'));var Papa=require('papaparse');var Redis=require(_0x3c5b('0x12'));var authService=require(_0x3c5b('0x13'));var qs=require(_0x3c5b('0x14'));var as=require(_0x3c5b('0x15'));var hardwareService=require(_0x3c5b('0x16'));var logger=require('../../config/logger')(_0x3c5b('0x17'));var utils=require(_0x3c5b('0x18'));var config=require(_0x3c5b('0x19'));var licenseUtil=require(_0x3c5b('0x1a'));var db=require(_0x3c5b('0x1b'))['db'];config[_0x3c5b('0x1c')]=_[_0x3c5b('0x1d')](config['redis'],{'host':_0x3c5b('0x1e'),'port':0x18eb});var socket=require(_0x3c5b('0x1f'))(new Redis(config[_0x3c5b('0x1c')]));require(_0x3c5b('0x20'))['register'](socket);var jayson=require(_0x3c5b('0x21'));var client=jayson['client'][_0x3c5b('0x22')]({'port':0x232c});var client9002=jayson[_0x3c5b('0x23')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b1d45,_0x88069a,_0x5d64cb,_0x32c58e){return new BPromise(function(_0x1cbe52,_0x249642){var _0x5bc3e3=_0x32c58e||client;return _0x5bc3e3[_0x3c5b('0x24')](_0x2b1d45,_0x5d64cb)['then'](function(_0x40fe47){logger[_0x3c5b('0x25')](_0x3c5b('0x26'),_0x88069a,_0x3c5b('0x27'));logger[_0x3c5b('0x28')](_0x3c5b('0x29'),_0x88069a,'request\x20sent',JSON['stringify'](_0x40fe47));if(_0x40fe47[_0x3c5b('0x2a')]){if(_0x40fe47['error'][_0x3c5b('0x2b')]===0x1f4){logger[_0x3c5b('0x2a')](_0x3c5b('0x26'),_0x88069a,_0x40fe47['error'][_0x3c5b('0x2c')]);return _0x249642(_0x40fe47['error'][_0x3c5b('0x2c')]);}logger[_0x3c5b('0x2a')](_0x3c5b('0x26'),_0x88069a,_0x40fe47[_0x3c5b('0x2a')][_0x3c5b('0x2c')]);return _0x1cbe52(_0x40fe47[_0x3c5b('0x2a')][_0x3c5b('0x2c')]);}else{logger[_0x3c5b('0x25')]('SmsMessage,\x20%s,\x20%s',_0x88069a,_0x3c5b('0x27'));_0x1cbe52(_0x40fe47[_0x3c5b('0x2d')][_0x3c5b('0x2c')]);}})['catch'](function(_0x12e81a){logger['error']('SmsMessage,\x20%s,\x20%s',_0x88069a,_0x12e81a);_0x249642(_0x12e81a);});});}function respondWithStatusCode(_0x5a78c9,_0x4de3fa){_0x4de3fa=_0x4de3fa||0xcc;return function(_0x23503b){if(_0x23503b){return _0x5a78c9[_0x3c5b('0x2e')](_0x4de3fa);}return _0x5a78c9[_0x3c5b('0x2f')](_0x4de3fa)['end']();};}function respondWithResult(_0x155ae6,_0x5c7fc2){_0x5c7fc2=_0x5c7fc2||0xc8;return function(_0x3548e9){if(_0x3548e9){return _0x155ae6[_0x3c5b('0x2f')](_0x5c7fc2)[_0x3c5b('0x30')](_0x3548e9);}};}function respondWithFilteredResult(_0x38b947,_0x12440e){return function(_0x42c5e1){if(_0x42c5e1){var _0x37cd2f=typeof _0x12440e[_0x3c5b('0x31')]===_0x3c5b('0x32')&&typeof _0x12440e['limit']===_0x3c5b('0x32');var _0x217022=_0x42c5e1[_0x3c5b('0x33')];var _0x410ebf=_0x37cd2f?0x0:_0x12440e[_0x3c5b('0x31')];var _0x1c686a=_0x37cd2f?_0x42c5e1[_0x3c5b('0x33')]:_0x12440e[_0x3c5b('0x31')]+_0x12440e['limit'];var _0x5ac5c2;if(_0x1c686a>=_0x217022){_0x1c686a=_0x217022;_0x5ac5c2=0xc8;}else{_0x5ac5c2=0xce;}_0x38b947[_0x3c5b('0x2f')](_0x5ac5c2);return _0x38b947[_0x3c5b('0x34')]('Content-Range',_0x410ebf+'-'+_0x1c686a+'/'+_0x217022)[_0x3c5b('0x30')](_0x42c5e1);}return null;};}function patchUpdates(_0x1e2773){return function(_0x52a50b){try{jsonpatch[_0x3c5b('0x35')](_0x52a50b,_0x1e2773,!![]);}catch(_0x426363){return BPromise['reject'](_0x426363);}return _0x52a50b[_0x3c5b('0x36')]();};}function saveUpdates(_0x275d32,_0x388acd){return function(_0x3031d5){if(_0x3031d5){return _0x3031d5[_0x3c5b('0x37')](_0x275d32)[_0x3c5b('0x38')](function(_0x281e53){return _0x281e53;});}return null;};}function removeEntity(_0x3029b0,_0x382908){return function(_0x31a33c){if(_0x31a33c){return _0x31a33c[_0x3c5b('0x39')]()[_0x3c5b('0x38')](function(){_0x3029b0[_0x3c5b('0x2f')](0xcc)[_0x3c5b('0x3a')]();});}};}function handleEntityNotFound(_0x5c2c86,_0x3d9afc){return function(_0x37cc3f){if(!_0x37cc3f){_0x5c2c86[_0x3c5b('0x2e')](0x194);}return _0x37cc3f;};}function handleError(_0x561010,_0x4ebc4c){_0x4ebc4c=_0x4ebc4c||0x1f4;return function(_0x33b913){logger['error'](_0x33b913[_0x3c5b('0x3b')]);if(_0x33b913[_0x3c5b('0x3c')]){delete _0x33b913[_0x3c5b('0x3c')];}_0x561010[_0x3c5b('0x2f')](_0x4ebc4c)[_0x3c5b('0x3d')](_0x33b913);};}exports[_0x3c5b('0x3e')]=function(_0x24886d,_0x5c2674){var _0x4c16aa={},_0x49c18f={},_0x30a18e={'count':0x0,'rows':[]};var _0x4ed0d9=_[_0x3c5b('0x3f')](db[_0x3c5b('0x40')][_0x3c5b('0x41')],function(_0x4693c1){return{'name':_0x4693c1['fieldName'],'type':_0x4693c1[_0x3c5b('0x42')][_0x3c5b('0x43')]};});_0x49c18f[_0x3c5b('0x44')]=_['map'](_0x4ed0d9,'name');_0x49c18f[_0x3c5b('0x45')]=_[_0x3c5b('0x46')](_0x24886d[_0x3c5b('0x45')]);_0x49c18f[_0x3c5b('0x47')]=_[_0x3c5b('0x48')](_0x49c18f[_0x3c5b('0x44')],_0x49c18f['query']);_0x4c16aa['attributes']=_['intersection'](_0x49c18f[_0x3c5b('0x44')],qs[_0x3c5b('0x49')](_0x24886d[_0x3c5b('0x45')]['fields']));_0x4c16aa['attributes']=_0x4c16aa[_0x3c5b('0x4a')][_0x3c5b('0x4b')]?_0x4c16aa['attributes']:_0x49c18f[_0x3c5b('0x44')];if(!_0x24886d['query']['hasOwnProperty'](_0x3c5b('0x4c'))){_0x4c16aa[_0x3c5b('0x4d')]=qs[_0x3c5b('0x4d')](_0x24886d[_0x3c5b('0x45')][_0x3c5b('0x4d')]);_0x4c16aa[_0x3c5b('0x31')]=qs[_0x3c5b('0x31')](_0x24886d[_0x3c5b('0x45')][_0x3c5b('0x31')]);}_0x4c16aa[_0x3c5b('0x4e')]=qs[_0x3c5b('0x4f')](_0x24886d['query'][_0x3c5b('0x4f')]);_0x4c16aa['where']=qs[_0x3c5b('0x47')](_['pick'](_0x24886d[_0x3c5b('0x45')],_0x49c18f[_0x3c5b('0x47')]),_0x4ed0d9);if(_0x24886d[_0x3c5b('0x45')][_0x3c5b('0x50')]){_0x4c16aa[_0x3c5b('0x51')]=_[_0x3c5b('0x52')](_0x4c16aa[_0x3c5b('0x51')],{'$or':_[_0x3c5b('0x3f')](_0x4ed0d9,function(_0x50f138){if(_0x50f138[_0x3c5b('0x42')]!==_0x3c5b('0x53')){var _0xaa1592={};_0xaa1592[_0x50f138[_0x3c5b('0x3c')]]={'$like':'%'+_0x24886d['query'][_0x3c5b('0x50')]+'%'};return _0xaa1592;}})});}_0x4c16aa=_[_0x3c5b('0x52')]({},_0x4c16aa,_0x24886d[_0x3c5b('0x54')]);var _0x137919={'where':_0x4c16aa[_0x3c5b('0x51')]};return db[_0x3c5b('0x40')][_0x3c5b('0x33')](_0x137919)[_0x3c5b('0x38')](function(_0x36ff71){_0x30a18e[_0x3c5b('0x33')]=_0x36ff71;if(_0x24886d[_0x3c5b('0x45')][_0x3c5b('0x55')]){_0x4c16aa['include']=[{'all':!![]}];}return db['SmsMessage'][_0x3c5b('0x56')](_0x4c16aa);})[_0x3c5b('0x38')](function(_0xb6e9e){_0x30a18e['rows']=_0xb6e9e;return _0x30a18e;})[_0x3c5b('0x38')](respondWithFilteredResult(_0x5c2674,_0x4c16aa))['catch'](handleError(_0x5c2674,null));};exports[_0x3c5b('0x57')]=function(_0x1ec601,_0x5ec1a6){var _0x3807de={'raw':!![],'where':{'id':_0x1ec601[_0x3c5b('0x58')]['id']}},_0x7547f8={};_0x7547f8[_0x3c5b('0x44')]=_[_0x3c5b('0x46')](db[_0x3c5b('0x40')][_0x3c5b('0x41')]);_0x7547f8[_0x3c5b('0x45')]=_[_0x3c5b('0x46')](_0x1ec601[_0x3c5b('0x45')]);_0x7547f8[_0x3c5b('0x47')]=_[_0x3c5b('0x48')](_0x7547f8[_0x3c5b('0x44')],_0x7547f8['query']);_0x3807de[_0x3c5b('0x4a')]=_['intersection'](_0x7547f8[_0x3c5b('0x44')],qs[_0x3c5b('0x49')](_0x1ec601['query'][_0x3c5b('0x49')]));_0x3807de['attributes']=_0x3807de[_0x3c5b('0x4a')][_0x3c5b('0x4b')]?_0x3807de['attributes']:_0x7547f8[_0x3c5b('0x44')];if(_0x1ec601[_0x3c5b('0x45')]['includeAll']){_0x3807de[_0x3c5b('0x59')]=[{'all':!![]}];}_0x3807de=_[_0x3c5b('0x52')]({},_0x3807de,_0x1ec601[_0x3c5b('0x54')]);return db[_0x3c5b('0x40')]['find'](_0x3807de)[_0x3c5b('0x38')](handleEntityNotFound(_0x5ec1a6,null))[_0x3c5b('0x38')](respondWithResult(_0x5ec1a6,null))[_0x3c5b('0x5a')](handleError(_0x5ec1a6,null));};exports[_0x3c5b('0x5b')]=function(_0x365b4d,_0x46b647){return db[_0x3c5b('0x40')][_0x3c5b('0x5b')](_0x365b4d[_0x3c5b('0x5c')],{})[_0x3c5b('0x38')](respondWithResult(_0x46b647,0xc9))['catch'](handleError(_0x46b647,null));};exports[_0x3c5b('0x37')]=function(_0x174bb2,_0x12b28d){if(_0x174bb2[_0x3c5b('0x5c')]['id']){delete _0x174bb2['body']['id'];}return db[_0x3c5b('0x40')][_0x3c5b('0x5d')]({'where':{'id':_0x174bb2[_0x3c5b('0x58')]['id']}})[_0x3c5b('0x38')](handleEntityNotFound(_0x12b28d,null))[_0x3c5b('0x38')](saveUpdates(_0x174bb2[_0x3c5b('0x5c')],null))[_0x3c5b('0x38')](respondWithResult(_0x12b28d,null))[_0x3c5b('0x5a')](handleError(_0x12b28d,null));};exports[_0x3c5b('0x39')]=function(_0x5454a9,_0x5c2667){return db[_0x3c5b('0x40')][_0x3c5b('0x5d')]({'where':{'id':_0x5454a9[_0x3c5b('0x58')]['id']}})[_0x3c5b('0x38')](handleEntityNotFound(_0x5c2667,null))[_0x3c5b('0x38')](removeEntity(_0x5c2667,null))[_0x3c5b('0x5a')](handleError(_0x5c2667,null));};exports[_0x3c5b('0x5e')]=function(_0x281340,_0x338e2a){return db['SmsMessage'][_0x3c5b('0x5e')]()[_0x3c5b('0x38')](respondWithResult(_0x338e2a,null))['catch'](handleError(_0x338e2a,null));};var interaction_log=require('../../config/logger')(_0x3c5b('0x5f'));exports[_0x3c5b('0x60')]=function(_0x560f06,_0xa81213,_0x2838e4){var _0xf37db1={'agent':{},'channel':'sms'};if(_0x560f06[_0x3c5b('0x5c')]['id']){delete _0x560f06[_0x3c5b('0x5c')]['id'];}_0x560f06[_0x3c5b('0x5c')]['read']=!![];_0x560f06[_0x3c5b('0x5c')][_0x3c5b('0x61')]=moment()[_0x3c5b('0x62')](_0x3c5b('0x63'));_0x560f06[_0x3c5b('0x5c')][_0x3c5b('0x64')]=_0x560f06[_0x3c5b('0x5c')]['UserId']||_0x560f06['user']['id'];_0xf37db1['agent']['id']=_0x560f06[_0x3c5b('0x5c')][_0x3c5b('0x64')];return db[_0x3c5b('0x40')]['find']({'where':{'id':_0x560f06['params']['id'],'UserId':null}})[_0x3c5b('0x38')](handleEntityNotFound(_0xa81213,null))[_0x3c5b('0x38')](saveUpdates(_0x560f06[_0x3c5b('0x5c')],null))[_0x3c5b('0x38')](function(_0x2eb788){if(_0x2eb788){_0xf37db1['message']=_0x2eb788[_0x3c5b('0x65')]({'plain':!![]});return db[_0x3c5b('0x66')][_0x3c5b('0x5d')]({'where':{'id':_0x2eb788[_0x3c5b('0x67')]}});}return null;})[_0x3c5b('0x38')](handleEntityNotFound(_0xa81213,null))[_0x3c5b('0x38')](function(_0x2f3c53){if(_0x2f3c53){return _0x2f3c53[_0x3c5b('0x37')]({'UserId':_0x560f06[_0x3c5b('0x5c')][_0x3c5b('0x64')],'read1stAt':_['isNil'](_0x2f3c53[_0x3c5b('0x68')])?moment()[_0x3c5b('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x7ddd7d){if(_0x7ddd7d){_0xf37db1[_0x3c5b('0x69')]=_0x7ddd7d['get']({'plain':!![]});interaction_log['info'](_0x3c5b('0x6a'),_0x560f06['user']['id'],_0x560f06[_0x3c5b('0x6b')]['name'],_0x560f06[_0x3c5b('0x6b')][_0x3c5b('0x6c')],_0xf37db1['interaction']['id'],_0x560f06[_0x3c5b('0x5c')]?JSON[_0x3c5b('0x6d')](_0x560f06[_0x3c5b('0x5c')]):_0x3c5b('0x6e'));return respondWithRpcPromise(_0x3c5b('0x6f'),_0x3c5b('0x70'),_0xf37db1);}return null;})[_0x3c5b('0x38')](function(_0x5d67cc){var _0x17c76c=_0x3c5b('0x71')+_0x5d67cc[_0x3c5b('0x2c')]['ContactId'];return db['sequelize'][_0x3c5b('0x45')](_0x17c76c,{'type':db[_0x3c5b('0x72')][_0x3c5b('0x73')][_0x3c5b('0x74')],'raw':!![]})[_0x3c5b('0x38')](function(_0x55ec45){return _0x55ec45;});})[_0x3c5b('0x38')](function(_0x457e4c){if(_0x457e4c){_0xf37db1[_0x3c5b('0x2c')][_0x3c5b('0x75')]=_0x457e4c[0x0];if(!_0x560f06[_0x3c5b('0x5c')][_0x3c5b('0x64')])return;return db[_0x3c5b('0x76')][_0x3c5b('0x5d')]({'where':{'id':_0x560f06[_0x3c5b('0x5c')][_0x3c5b('0x64')],'role':_0x3c5b('0x77')},'attributes':['id',_0x3c5b('0x3c'),'fullname',_0x3c5b('0x78'),_0x3c5b('0x79')],'raw':!![]});}return null;})[_0x3c5b('0x38')](function(_0x561612){if(!_0x561612)return null;_0xf37db1[_0x3c5b('0x2c')][_0x3c5b('0x77')]=_0x561612;return _0xf37db1;})[_0x3c5b('0x38')](function(_0x369748){if(_0x369748){if(_0x560f06['body'][_0x3c5b('0x7a')]){_0xf37db1[_0x3c5b('0x2c')][_0x3c5b('0x7b')]=util['format'](_0x3c5b('0x7c'),_0x560f06[_0x3c5b('0x6b')][_0x3c5b('0x3c')]);_0xf37db1[_0x3c5b('0x2c')][_0x3c5b('0x7d')]=_0xf37db1['channel'];_0xf37db1['message'][_0x3c5b('0x7e')]=_0xf37db1[_0x3c5b('0x7d')];_0xf37db1[_0x3c5b('0x2c')][_0x3c5b('0x7f')]=_0x3c5b('0x60');return respondWithRpcPromise(_0x3c5b('0x80'),_0x3c5b('0x80'),{'event':'acceptmessage','message':_0xf37db1[_0x3c5b('0x2c')]},client9002)[_0x3c5b('0x38')](function(){return _0xf37db1;});}return _0xf37db1;}return null;})[_0x3c5b('0x38')](respondWithResult(_0xa81213,null))[_0x3c5b('0x5a')](handleError(_0xa81213,null));};var interaction_log=require(_0x3c5b('0x81'))(_0x3c5b('0x5f'));exports[_0x3c5b('0x82')]=function(_0x3923d8,_0x111833,_0x1e2f68){var _0x4b99f5={'agent':{},'channel':_0x3c5b('0x83')};if(_0x3923d8[_0x3c5b('0x5c')]['id']){delete _0x3923d8[_0x3c5b('0x5c')]['id'];}_0x3923d8[_0x3c5b('0x5c')][_0x3c5b('0x64')]=_0x3923d8['body'][_0x3c5b('0x64')]||_0x3923d8[_0x3c5b('0x6b')]['id'];_0x4b99f5[_0x3c5b('0x77')]['id']=_0x3923d8[_0x3c5b('0x5c')][_0x3c5b('0x64')];return db['SmsMessage']['find']({'where':{'id':_0x3923d8[_0x3c5b('0x58')]['id'],'UserId':null}})[_0x3c5b('0x38')](handleEntityNotFound(_0x111833,null))[_0x3c5b('0x38')](function(_0x831af8){if(_0x831af8){_0x4b99f5[_0x3c5b('0x2c')]=_0x831af8[_0x3c5b('0x65')]({'plain':!![]});return db['SmsInteraction'][_0x3c5b('0x5d')]({'where':{'id':_0x831af8['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x111833,null))[_0x3c5b('0x38')](function(_0x53f979){if(_0x53f979){_0x4b99f5[_0x3c5b('0x69')]=_0x53f979['get']({'plain':!![]});interaction_log[_0x3c5b('0x25')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3923d8[_0x3c5b('0x6b')]['id'],_0x3923d8['user']['name'],_0x3923d8[_0x3c5b('0x6b')][_0x3c5b('0x6c')],_0x4b99f5['interaction']['id'],_0x3923d8[_0x3c5b('0x5c')]?JSON[_0x3c5b('0x6d')](_0x3923d8[_0x3c5b('0x5c')]):'null');return respondWithRpcPromise(_0x3c5b('0x84'),_0x3c5b('0x85'),_0x4b99f5);}return null;})[_0x3c5b('0x38')](function(_0xd5fcd5){var _0x26a991=_0x3c5b('0x71')+_0xd5fcd5[_0x3c5b('0x2c')][_0x3c5b('0x86')];return db[_0x3c5b('0x87')][_0x3c5b('0x45')](_0x26a991,{'type':db['Sequelize'][_0x3c5b('0x73')][_0x3c5b('0x74')],'raw':!![]})[_0x3c5b('0x38')](function(_0x2660c6){return _0x2660c6;});})['then'](function(_0x4a59c7){if(_0x4a59c7){_0x4b99f5['message'][_0x3c5b('0x75')]=_0x4a59c7[0x0];if(!_0x3923d8[_0x3c5b('0x5c')]['UserId'])return;return db[_0x3c5b('0x76')][_0x3c5b('0x5d')]({'where':{'id':_0x3923d8[_0x3c5b('0x5c')][_0x3c5b('0x64')],'role':_0x3c5b('0x77')},'attributes':['id',_0x3c5b('0x3c'),_0x3c5b('0x88'),'email',_0x3c5b('0x79')],'raw':!![]});}return null;})[_0x3c5b('0x38')](function(_0x3aef91){if(!_0x3aef91)return null;_0x4b99f5['message']['agent']=_0x3aef91;return _0x4b99f5;})[_0x3c5b('0x38')](function(_0x318f05){if(_0x318f05){_0x318f05['message']['interface']=util[_0x3c5b('0x62')]('SIP/%s',_0x3923d8[_0x3c5b('0x6b')][_0x3c5b('0x3c')]);_0x318f05[_0x3c5b('0x2c')][_0x3c5b('0x7d')]=_0x4b99f5[_0x3c5b('0x7d')];_0x318f05[_0x3c5b('0x2c')]['motionChannel']=_0x4b99f5['channel'];_0x318f05['message'][_0x3c5b('0x7f')]=_0x3c5b('0x82');respondWithRpcPromise(_0x3c5b('0x80'),'EventManager',{'event':_0x3c5b('0x89'),'message':_0x318f05['message']},client9002);return _0x4b99f5;}return null;})['then'](respondWithResult(_0x111833,null))[_0x3c5b('0x5a')](handleError(_0x111833,null));};exports[_0x3c5b('0x2f')]=function(_0x140dea,_0x2f9a30,_0x39609f){if(_0x140dea[_0x3c5b('0x5c')]['id']){delete _0x140dea['body']['id'];}var _0x371860;return db[_0x3c5b('0x40')][_0x3c5b('0x5d')]({'where':{'id':_0x140dea[_0x3c5b('0x58')]['id']}})[_0x3c5b('0x38')](handleEntityNotFound(_0x2f9a30,null))[_0x3c5b('0x38')](function(_0x5aa399){if(_0x5aa399){_0x371860=_0x5aa399;return db[_0x3c5b('0x8a')][_0x3c5b('0x5d')]({'where':{'id':_0x5aa399[_0x3c5b('0x8b')]}});}})['then'](handleEntityNotFound(_0x2f9a30,null))['then'](function(_0x48da6d){if(_0x48da6d){logger[_0x3c5b('0x28')](_0x3c5b('0x29'),_0x3c5b('0x2f'),_0x3c5b('0x8c'),_0x48da6d[_0x3c5b('0x42')],util[_0x3c5b('0x8d')](_0x140dea['body'],{'showHidden':![],'depth':null}));switch(_0x48da6d[_0x3c5b('0x42')]){case _0x3c5b('0x8e'):if(_0x140dea[_0x3c5b('0x5c')][_0x3c5b('0x8f')]&&_0x140dea[_0x3c5b('0x5c')][_0x3c5b('0x8f')]===_0x371860[_0x3c5b('0x90')]){return _0x371860[_0x3c5b('0x37')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3c5b('0x2f'),'twilio',util[_0x3c5b('0x8d')](_0x140dea[_0x3c5b('0x5c')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x140dea[_0x3c5b('0x5c')][_0x3c5b('0x91')]&&_0x140dea[_0x3c5b('0x5c')][_0x3c5b('0x91')]===_0x371860['messageId']&&_[_0x3c5b('0x92')]([_0x3c5b('0x93'),'delivered'],_0x140dea[_0x3c5b('0x5c')][_0x3c5b('0x94')])>=0x0){return _0x371860[_0x3c5b('0x37')]({'read':!![]});}else{logger['error'](_0x3c5b('0x95'),_0x3c5b('0x2f'),_0x3c5b('0x96'),util[_0x3c5b('0x8d')](_0x140dea[_0x3c5b('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x3c5b('0x97'):var _0x1cf699=_0x140dea['body'][_0x3c5b('0x98')][0x0];if(_0x1cf699['status'][_0x3c5b('0x99')]===_0x3c5b('0x9a')){return _0x371860[_0x3c5b('0x37')]({'read':!![]});}else{logger[_0x3c5b('0x2a')](_0x3c5b('0x95'),_0x3c5b('0x2f'),_0x3c5b('0x97'),util[_0x3c5b('0x8d')](_0x140dea['body'],{'showHidden':![],'depth':null}));}break;}return _0x371860;}})[_0x3c5b('0x38')](respondWithResult(_0x2f9a30,null))[_0x3c5b('0x5a')](handleError(_0x2f9a30,null));}; \ No newline at end of file +var _0xe0dc=['message','result','status','end','json','offset','undefined','limit','count','reject','destroy','sendStatus','name','index','map','SmsMessage','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','rawAttributes','find','create','body','params','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','agent','UserId','SmsInteraction','SmsInteractionId','isNil','read1stAt','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','get','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','rejectMessage','sequelize','User','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','update','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','delivered','plivio','infobip','groupName','DELIVERED','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x311829,_0x4f55ef){var _0x6f1881=function(_0x51fde7){while(--_0x51fde7){_0x311829['push'](_0x311829['shift']());}};_0x6f1881(++_0x4f55ef);}(_0xe0dc,0x190));var _0xce0d=function(_0x49f66e,_0x3e2369){_0x49f66e=_0x49f66e-0x0;var _0x55a1e2=_0xe0dc[_0x49f66e];return _0x55a1e2;};'use strict';var emlformat=require(_0xce0d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xce0d('0x1'));var jsonpatch=require(_0xce0d('0x2'));var rp=require('request-promise');var moment=require(_0xce0d('0x3'));var BPromise=require(_0xce0d('0x4'));var Mustache=require(_0xce0d('0x5'));var util=require(_0xce0d('0x6'));var path=require('path');var sox=require(_0xce0d('0x7'));var csv=require('to-csv');var ejs=require(_0xce0d('0x8'));var fs=require('fs');var fs_extra=require(_0xce0d('0x9'));var _=require(_0xce0d('0xa'));var squel=require(_0xce0d('0xb'));var crypto=require(_0xce0d('0xc'));var jsforce=require(_0xce0d('0xd'));var deskjs=require(_0xce0d('0xe'));var toCsv=require(_0xce0d('0xf'));var querystring=require(_0xce0d('0x10'));var Papa=require(_0xce0d('0x11'));var Redis=require(_0xce0d('0x12'));var authService=require(_0xce0d('0x13'));var qs=require(_0xce0d('0x14'));var as=require(_0xce0d('0x15'));var hardwareService=require(_0xce0d('0x16'));var logger=require(_0xce0d('0x17'))(_0xce0d('0x18'));var utils=require(_0xce0d('0x19'));var config=require(_0xce0d('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xce0d('0x1b'))['db'];config[_0xce0d('0x1c')]=_[_0xce0d('0x1d')](config[_0xce0d('0x1c')],{'host':_0xce0d('0x1e'),'port':0x18eb});var socket=require(_0xce0d('0x1f'))(new Redis(config[_0xce0d('0x1c')]));require(_0xce0d('0x20'))[_0xce0d('0x21')](socket);var jayson=require(_0xce0d('0x22'));var client=jayson[_0xce0d('0x23')][_0xce0d('0x24')]({'port':0x232c});var client9002=jayson[_0xce0d('0x23')][_0xce0d('0x24')]({'port':0x232a});function respondWithRpcPromise(_0xef9e5f,_0x176c81,_0x936728,_0x39ed8){return new BPromise(function(_0x459c44,_0x3e7fa5){var _0x2044df=_0x39ed8||client;return _0x2044df[_0xce0d('0x25')](_0xef9e5f,_0x936728)[_0xce0d('0x26')](function(_0x1e03c1){logger[_0xce0d('0x27')](_0xce0d('0x28'),_0x176c81,_0xce0d('0x29'));logger[_0xce0d('0x2a')](_0xce0d('0x2b'),_0x176c81,_0xce0d('0x29'),JSON[_0xce0d('0x2c')](_0x1e03c1));if(_0x1e03c1[_0xce0d('0x2d')]){if(_0x1e03c1[_0xce0d('0x2d')][_0xce0d('0x2e')]===0x1f4){logger[_0xce0d('0x2d')](_0xce0d('0x28'),_0x176c81,_0x1e03c1[_0xce0d('0x2d')]['message']);return _0x3e7fa5(_0x1e03c1['error'][_0xce0d('0x2f')]);}logger['error'](_0xce0d('0x28'),_0x176c81,_0x1e03c1[_0xce0d('0x2d')][_0xce0d('0x2f')]);return _0x459c44(_0x1e03c1['error'][_0xce0d('0x2f')]);}else{logger['info'](_0xce0d('0x28'),_0x176c81,'request\x20sent');_0x459c44(_0x1e03c1[_0xce0d('0x30')][_0xce0d('0x2f')]);}})['catch'](function(_0x516609){logger[_0xce0d('0x2d')](_0xce0d('0x28'),_0x176c81,_0x516609);_0x3e7fa5(_0x516609);});});}function respondWithStatusCode(_0x2a3815,_0x41b228){_0x41b228=_0x41b228||0xcc;return function(_0xdab05c){if(_0xdab05c){return _0x2a3815['sendStatus'](_0x41b228);}return _0x2a3815[_0xce0d('0x31')](_0x41b228)[_0xce0d('0x32')]();};}function respondWithResult(_0x31ace8,_0x5b197c){_0x5b197c=_0x5b197c||0xc8;return function(_0x138f0d){if(_0x138f0d){return _0x31ace8['status'](_0x5b197c)[_0xce0d('0x33')](_0x138f0d);}};}function respondWithFilteredResult(_0x1eb234,_0x328842){return function(_0x435fd2){if(_0x435fd2){var _0x1a7f8c=typeof _0x328842[_0xce0d('0x34')]===_0xce0d('0x35')&&typeof _0x328842[_0xce0d('0x36')]===_0xce0d('0x35');var _0x1dc21a=_0x435fd2[_0xce0d('0x37')];var _0x336114=_0x1a7f8c?0x0:_0x328842['offset'];var _0x4a3308=_0x1a7f8c?_0x435fd2[_0xce0d('0x37')]:_0x328842[_0xce0d('0x34')]+_0x328842[_0xce0d('0x36')];var _0x2e41ea;if(_0x4a3308>=_0x1dc21a){_0x4a3308=_0x1dc21a;_0x2e41ea=0xc8;}else{_0x2e41ea=0xce;}_0x1eb234[_0xce0d('0x31')](_0x2e41ea);return _0x1eb234['set']('Content-Range',_0x336114+'-'+_0x4a3308+'/'+_0x1dc21a)[_0xce0d('0x33')](_0x435fd2);}return null;};}function patchUpdates(_0x382bc1){return function(_0x5587f5){try{jsonpatch['apply'](_0x5587f5,_0x382bc1,!![]);}catch(_0x4ab7fc){return BPromise[_0xce0d('0x38')](_0x4ab7fc);}return _0x5587f5['save']();};}function saveUpdates(_0x531c3a,_0x585c69){return function(_0x1aeed2){if(_0x1aeed2){return _0x1aeed2['update'](_0x531c3a)['then'](function(_0x550d65){return _0x550d65;});}return null;};}function removeEntity(_0x58096b,_0x4b7645){return function(_0x5cd4f0){if(_0x5cd4f0){return _0x5cd4f0[_0xce0d('0x39')]()[_0xce0d('0x26')](function(){_0x58096b[_0xce0d('0x31')](0xcc)[_0xce0d('0x32')]();});}};}function handleEntityNotFound(_0x2dbd8e,_0xb580d8){return function(_0x20464e){if(!_0x20464e){_0x2dbd8e[_0xce0d('0x3a')](0x194);}return _0x20464e;};}function handleError(_0x836d67,_0x541ecd){_0x541ecd=_0x541ecd||0x1f4;return function(_0x3dc50e){logger[_0xce0d('0x2d')](_0x3dc50e['stack']);if(_0x3dc50e[_0xce0d('0x3b')]){delete _0x3dc50e[_0xce0d('0x3b')];}_0x836d67['status'](_0x541ecd)['send'](_0x3dc50e);};}exports[_0xce0d('0x3c')]=function(_0x1f484d,_0x243c26){var _0x14d2c8={},_0x21fa1e={},_0x5914b3={'count':0x0,'rows':[]};var _0x5db66b=_[_0xce0d('0x3d')](db[_0xce0d('0x3e')]['rawAttributes'],function(_0x4d4297){return{'name':_0x4d4297[_0xce0d('0x3f')],'type':_0x4d4297[_0xce0d('0x40')][_0xce0d('0x41')]};});_0x21fa1e[_0xce0d('0x42')]=_[_0xce0d('0x3d')](_0x5db66b,_0xce0d('0x3b'));_0x21fa1e['query']=_[_0xce0d('0x43')](_0x1f484d[_0xce0d('0x44')]);_0x21fa1e[_0xce0d('0x45')]=_[_0xce0d('0x46')](_0x21fa1e[_0xce0d('0x42')],_0x21fa1e[_0xce0d('0x44')]);_0x14d2c8[_0xce0d('0x47')]=_[_0xce0d('0x46')](_0x21fa1e['model'],qs[_0xce0d('0x48')](_0x1f484d['query'][_0xce0d('0x48')]));_0x14d2c8[_0xce0d('0x47')]=_0x14d2c8[_0xce0d('0x47')][_0xce0d('0x49')]?_0x14d2c8[_0xce0d('0x47')]:_0x21fa1e['model'];if(!_0x1f484d[_0xce0d('0x44')][_0xce0d('0x4a')]('nolimit')){_0x14d2c8[_0xce0d('0x36')]=qs['limit'](_0x1f484d[_0xce0d('0x44')][_0xce0d('0x36')]);_0x14d2c8[_0xce0d('0x34')]=qs['offset'](_0x1f484d[_0xce0d('0x44')][_0xce0d('0x34')]);}_0x14d2c8['order']=qs['sort'](_0x1f484d[_0xce0d('0x44')][_0xce0d('0x4b')]);_0x14d2c8[_0xce0d('0x4c')]=qs[_0xce0d('0x45')](_[_0xce0d('0x4d')](_0x1f484d['query'],_0x21fa1e['filters']),_0x5db66b);if(_0x1f484d['query'][_0xce0d('0x4e')]){_0x14d2c8[_0xce0d('0x4c')]=_[_0xce0d('0x4f')](_0x14d2c8[_0xce0d('0x4c')],{'$or':_[_0xce0d('0x3d')](_0x5db66b,function(_0x334f57){if(_0x334f57[_0xce0d('0x40')]!=='VIRTUAL'){var _0x5accff={};_0x5accff[_0x334f57[_0xce0d('0x3b')]]={'$like':'%'+_0x1f484d[_0xce0d('0x44')][_0xce0d('0x4e')]+'%'};return _0x5accff;}})});}_0x14d2c8=_[_0xce0d('0x4f')]({},_0x14d2c8,_0x1f484d[_0xce0d('0x50')]);var _0x45f11d={'where':_0x14d2c8[_0xce0d('0x4c')]};return db['SmsMessage'][_0xce0d('0x37')](_0x45f11d)['then'](function(_0x50ac18){_0x5914b3[_0xce0d('0x37')]=_0x50ac18;if(_0x1f484d[_0xce0d('0x44')][_0xce0d('0x51')]){_0x14d2c8['include']=[{'all':!![]}];}return db[_0xce0d('0x3e')][_0xce0d('0x52')](_0x14d2c8);})['then'](function(_0x47452d){_0x5914b3[_0xce0d('0x53')]=_0x47452d;return _0x5914b3;})[_0xce0d('0x26')](respondWithFilteredResult(_0x243c26,_0x14d2c8))[_0xce0d('0x54')](handleError(_0x243c26,null));};exports[_0xce0d('0x55')]=function(_0x306657,_0x17919a){var _0x45b887={'raw':!![],'where':{'id':_0x306657['params']['id']}},_0x12b423={};_0x12b423[_0xce0d('0x42')]=_[_0xce0d('0x43')](db[_0xce0d('0x3e')][_0xce0d('0x56')]);_0x12b423['query']=_[_0xce0d('0x43')](_0x306657[_0xce0d('0x44')]);_0x12b423['filters']=_[_0xce0d('0x46')](_0x12b423['model'],_0x12b423[_0xce0d('0x44')]);_0x45b887['attributes']=_['intersection'](_0x12b423[_0xce0d('0x42')],qs[_0xce0d('0x48')](_0x306657[_0xce0d('0x44')][_0xce0d('0x48')]));_0x45b887[_0xce0d('0x47')]=_0x45b887[_0xce0d('0x47')][_0xce0d('0x49')]?_0x45b887[_0xce0d('0x47')]:_0x12b423[_0xce0d('0x42')];if(_0x306657[_0xce0d('0x44')]['includeAll']){_0x45b887['include']=[{'all':!![]}];}_0x45b887=_[_0xce0d('0x4f')]({},_0x45b887,_0x306657[_0xce0d('0x50')]);return db[_0xce0d('0x3e')][_0xce0d('0x57')](_0x45b887)[_0xce0d('0x26')](handleEntityNotFound(_0x17919a,null))[_0xce0d('0x26')](respondWithResult(_0x17919a,null))[_0xce0d('0x54')](handleError(_0x17919a,null));};exports[_0xce0d('0x58')]=function(_0x529f6d,_0x3884a3){return db[_0xce0d('0x3e')][_0xce0d('0x58')](_0x529f6d[_0xce0d('0x59')],{})[_0xce0d('0x26')](respondWithResult(_0x3884a3,0xc9))[_0xce0d('0x54')](handleError(_0x3884a3,null));};exports['update']=function(_0x4a2ce4,_0x482375){if(_0x4a2ce4['body']['id']){delete _0x4a2ce4[_0xce0d('0x59')]['id'];}return db['SmsMessage'][_0xce0d('0x57')]({'where':{'id':_0x4a2ce4[_0xce0d('0x5a')]['id']}})[_0xce0d('0x26')](handleEntityNotFound(_0x482375,null))['then'](saveUpdates(_0x4a2ce4['body'],null))[_0xce0d('0x26')](respondWithResult(_0x482375,null))[_0xce0d('0x54')](handleError(_0x482375,null));};exports[_0xce0d('0x39')]=function(_0x4e8fbe,_0x1c9702){return db['SmsMessage'][_0xce0d('0x57')]({'where':{'id':_0x4e8fbe['params']['id']}})[_0xce0d('0x26')](handleEntityNotFound(_0x1c9702,null))[_0xce0d('0x26')](removeEntity(_0x1c9702,null))[_0xce0d('0x54')](handleError(_0x1c9702,null));};exports[_0xce0d('0x5b')]=function(_0x5a52ef,_0xd47a82){return db[_0xce0d('0x3e')][_0xce0d('0x5b')]()['then'](respondWithResult(_0xd47a82,null))[_0xce0d('0x54')](handleError(_0xd47a82,null));};var interaction_log=require(_0xce0d('0x17'))(_0xce0d('0x5c'));exports[_0xce0d('0x5d')]=function(_0x57acd8,_0x5ef88a,_0x5d09e0){var _0x76d67a={'agent':{},'channel':_0xce0d('0x5e')};if(_0x57acd8[_0xce0d('0x59')]['id']){delete _0x57acd8['body']['id'];}_0x57acd8[_0xce0d('0x59')][_0xce0d('0x5f')]=!![];_0x57acd8['body'][_0xce0d('0x60')]=moment()[_0xce0d('0x61')](_0xce0d('0x62'));_0x57acd8[_0xce0d('0x59')]['UserId']=_0x57acd8[_0xce0d('0x59')]['UserId']||_0x57acd8['user']['id'];_0x76d67a[_0xce0d('0x63')]['id']=_0x57acd8[_0xce0d('0x59')][_0xce0d('0x64')];return db[_0xce0d('0x3e')]['find']({'where':{'id':_0x57acd8[_0xce0d('0x5a')]['id'],'UserId':null}})[_0xce0d('0x26')](handleEntityNotFound(_0x5ef88a,null))[_0xce0d('0x26')](saveUpdates(_0x57acd8[_0xce0d('0x59')],null))[_0xce0d('0x26')](function(_0x5d593f){if(_0x5d593f){_0x76d67a[_0xce0d('0x2f')]=_0x5d593f['get']({'plain':!![]});return db[_0xce0d('0x65')]['find']({'where':{'id':_0x5d593f[_0xce0d('0x66')]}});}return null;})[_0xce0d('0x26')](handleEntityNotFound(_0x5ef88a,null))[_0xce0d('0x26')](function(_0xa9a32a){if(_0xa9a32a){return _0xa9a32a['update']({'UserId':_0x57acd8[_0xce0d('0x59')][_0xce0d('0x64')],'read1stAt':_[_0xce0d('0x67')](_0xa9a32a[_0xce0d('0x68')])?moment()[_0xce0d('0x61')](_0xce0d('0x62')):undefined});}return null;})[_0xce0d('0x26')](function(_0x5d11e0){if(_0x5d11e0){_0x76d67a['interaction']=_0x5d11e0['get']({'plain':!![]});interaction_log['info'](_0xce0d('0x69'),_0x57acd8[_0xce0d('0x6a')]['id'],_0x57acd8[_0xce0d('0x6a')][_0xce0d('0x3b')],_0x57acd8[_0xce0d('0x6a')][_0xce0d('0x6b')],_0x76d67a['interaction']['id'],_0x57acd8[_0xce0d('0x59')]?JSON[_0xce0d('0x2c')](_0x57acd8[_0xce0d('0x59')]):_0xce0d('0x6c'));return respondWithRpcPromise(_0xce0d('0x6d'),'acceptMessage',_0x76d67a);}return null;})[_0xce0d('0x26')](function(_0x34d86c){var _0x23ad33=_0xce0d('0x6e')+_0x34d86c[_0xce0d('0x2f')][_0xce0d('0x6f')];return db['sequelize'][_0xce0d('0x44')](_0x23ad33,{'type':db[_0xce0d('0x70')]['QueryTypes']['SELECT'],'raw':!![]})[_0xce0d('0x26')](function(_0x507f74){return _0x507f74;});})[_0xce0d('0x26')](function(_0x533004){if(_0x533004){_0x76d67a[_0xce0d('0x2f')][_0xce0d('0x71')]=_0x533004[0x0];if(!_0x57acd8['body'][_0xce0d('0x64')])return;return db['User'][_0xce0d('0x57')]({'where':{'id':_0x57acd8['body'][_0xce0d('0x64')],'role':_0xce0d('0x63')},'attributes':['id','name',_0xce0d('0x72'),_0xce0d('0x73'),_0xce0d('0x74')],'raw':!![]});}return null;})['then'](function(_0x636f1a){if(!_0x636f1a)return null;_0x76d67a[_0xce0d('0x2f')][_0xce0d('0x63')]=_0x636f1a;return _0x76d67a;})[_0xce0d('0x26')](function(_0xc4278){if(_0xc4278){if(_0x57acd8[_0xce0d('0x59')][_0xce0d('0x75')]){_0x76d67a[_0xce0d('0x2f')][_0xce0d('0x76')]=util[_0xce0d('0x61')](_0xce0d('0x77'),_0x57acd8[_0xce0d('0x6a')][_0xce0d('0x3b')]);_0x76d67a[_0xce0d('0x2f')][_0xce0d('0x78')]=_0x76d67a[_0xce0d('0x78')];_0x76d67a[_0xce0d('0x2f')][_0xce0d('0x79')]=_0x76d67a['channel'];_0x76d67a[_0xce0d('0x2f')][_0xce0d('0x7a')]=_0xce0d('0x5d');return respondWithRpcPromise(_0xce0d('0x7b'),_0xce0d('0x7b'),{'event':_0xce0d('0x7c'),'message':_0x76d67a[_0xce0d('0x2f')]},client9002)['then'](function(){return _0x76d67a;});}return _0x76d67a;}return null;})[_0xce0d('0x26')](respondWithResult(_0x5ef88a,null))[_0xce0d('0x54')](handleError(_0x5ef88a,null));};var interaction_log=require(_0xce0d('0x17'))('sms-interactions');exports[_0xce0d('0x38')]=function(_0x2d120d,_0x2de70e,_0x8ad438){var _0x100a3c={'agent':{},'channel':_0xce0d('0x5e')};if(_0x2d120d[_0xce0d('0x59')]['id']){delete _0x2d120d[_0xce0d('0x59')]['id'];}_0x2d120d[_0xce0d('0x59')][_0xce0d('0x64')]=_0x2d120d[_0xce0d('0x59')][_0xce0d('0x64')]||_0x2d120d[_0xce0d('0x6a')]['id'];_0x100a3c[_0xce0d('0x63')]['id']=_0x2d120d[_0xce0d('0x59')][_0xce0d('0x64')];return db[_0xce0d('0x3e')][_0xce0d('0x57')]({'where':{'id':_0x2d120d[_0xce0d('0x5a')]['id'],'UserId':null}})[_0xce0d('0x26')](handleEntityNotFound(_0x2de70e,null))[_0xce0d('0x26')](function(_0x1acde6){if(_0x1acde6){_0x100a3c[_0xce0d('0x2f')]=_0x1acde6[_0xce0d('0x7d')]({'plain':!![]});return db[_0xce0d('0x65')]['find']({'where':{'id':_0x1acde6[_0xce0d('0x66')]}});}return null;})[_0xce0d('0x26')](handleEntityNotFound(_0x2de70e,null))['then'](function(_0x25d533){if(_0x25d533){_0x100a3c['interaction']=_0x25d533[_0xce0d('0x7d')]({'plain':!![]});interaction_log['info'](_0xce0d('0x7e'),_0x2d120d[_0xce0d('0x6a')]['id'],_0x2d120d['user']['name'],_0x2d120d[_0xce0d('0x6a')]['role'],_0x100a3c[_0xce0d('0x7f')]['id'],_0x2d120d['body']?JSON[_0xce0d('0x2c')](_0x2d120d['body']):_0xce0d('0x6c'));return respondWithRpcPromise('RejectMessage',_0xce0d('0x80'),_0x100a3c);}return null;})[_0xce0d('0x26')](function(_0x1662ce){var _0x336f9e=_0xce0d('0x6e')+_0x1662ce[_0xce0d('0x2f')]['ContactId'];return db[_0xce0d('0x81')]['query'](_0x336f9e,{'type':db[_0xce0d('0x70')]['QueryTypes']['SELECT'],'raw':!![]})[_0xce0d('0x26')](function(_0xb344b0){return _0xb344b0;});})[_0xce0d('0x26')](function(_0xbe8813){if(_0xbe8813){_0x100a3c[_0xce0d('0x2f')][_0xce0d('0x71')]=_0xbe8813[0x0];if(!_0x2d120d['body'][_0xce0d('0x64')])return;return db[_0xce0d('0x82')][_0xce0d('0x57')]({'where':{'id':_0x2d120d[_0xce0d('0x59')][_0xce0d('0x64')],'role':_0xce0d('0x63')},'attributes':['id',_0xce0d('0x3b'),_0xce0d('0x72'),_0xce0d('0x73'),_0xce0d('0x74')],'raw':!![]});}return null;})['then'](function(_0x35afd1){if(!_0x35afd1)return null;_0x100a3c[_0xce0d('0x2f')]['agent']=_0x35afd1;return _0x100a3c;})[_0xce0d('0x26')](function(_0x30015a){if(_0x30015a){_0x30015a[_0xce0d('0x2f')][_0xce0d('0x76')]=util[_0xce0d('0x61')](_0xce0d('0x77'),_0x2d120d[_0xce0d('0x6a')][_0xce0d('0x3b')]);_0x30015a[_0xce0d('0x2f')][_0xce0d('0x78')]=_0x100a3c[_0xce0d('0x78')];_0x30015a['message'][_0xce0d('0x79')]=_0x100a3c['channel'];_0x30015a[_0xce0d('0x2f')][_0xce0d('0x7a')]=_0xce0d('0x38');respondWithRpcPromise(_0xce0d('0x7b'),'EventManager',{'event':_0xce0d('0x83'),'message':_0x30015a['message']},client9002);return _0x100a3c;}return null;})['then'](respondWithResult(_0x2de70e,null))[_0xce0d('0x54')](handleError(_0x2de70e,null));};exports[_0xce0d('0x31')]=function(_0x338c55,_0x5aa658,_0x1dbb19){if(_0x338c55['body']['id']){delete _0x338c55[_0xce0d('0x59')]['id'];}var _0x4051ba;return db['SmsMessage'][_0xce0d('0x57')]({'where':{'id':_0x338c55['params']['id']}})['then'](handleEntityNotFound(_0x5aa658,null))[_0xce0d('0x26')](function(_0x367a26){if(_0x367a26){_0x4051ba=_0x367a26;return db[_0xce0d('0x84')][_0xce0d('0x57')]({'where':{'id':_0x367a26[_0xce0d('0x85')]}});}})[_0xce0d('0x26')](handleEntityNotFound(_0x5aa658,null))[_0xce0d('0x26')](function(_0x8dd6aa){if(_0x8dd6aa){logger[_0xce0d('0x2a')](_0xce0d('0x2b'),_0xce0d('0x31'),_0xce0d('0x86'),_0x8dd6aa[_0xce0d('0x40')],util['inspect'](_0x338c55['body'],{'showHidden':![],'depth':null}));switch(_0x8dd6aa[_0xce0d('0x40')]){case _0xce0d('0x87'):if(_0x338c55[_0xce0d('0x59')][_0xce0d('0x88')]&&_0x338c55[_0xce0d('0x59')][_0xce0d('0x88')]===_0x4051ba['messageId']){return _0x4051ba[_0xce0d('0x89')]({'read':!![]});}else{logger[_0xce0d('0x2d')](_0xce0d('0x8a'),_0xce0d('0x31'),'twilio',util[_0xce0d('0x8b')](_0x338c55[_0xce0d('0x59')],{'showHidden':![],'depth':null}));}break;case _0xce0d('0x8c'):if(_0x338c55[_0xce0d('0x59')]['MessageUUID']&&_0x338c55['body'][_0xce0d('0x8d')]===_0x4051ba['messageId']&&_[_0xce0d('0x8e')]([_0xce0d('0x8f'),_0xce0d('0x90')],_0x338c55['body']['Status'])>=0x0){return _0x4051ba[_0xce0d('0x89')]({'read':!![]});}else{logger[_0xce0d('0x2d')](_0xce0d('0x8a'),_0xce0d('0x31'),_0xce0d('0x91'),util[_0xce0d('0x8b')](_0x338c55[_0xce0d('0x59')],{'showHidden':![],'depth':null}));}break;case _0xce0d('0x92'):var _0x1886cc=_0x338c55[_0xce0d('0x59')]['results'][0x0];if(_0x1886cc[_0xce0d('0x31')][_0xce0d('0x93')]===_0xce0d('0x94')){return _0x4051ba[_0xce0d('0x89')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xce0d('0x31'),'infobip',util['inspect'](_0x338c55['body'],{'showHidden':![],'depth':null}));}break;}return _0x4051ba;}})['then'](respondWithResult(_0x5aa658,null))[_0xce0d('0x54')](handleError(_0x5aa658,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index df97a9b..1d1bc62 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 _0xc0c1=['hook','exports','../../mysqldb','SmsMessage','save','update','remove','emit','hasOwnProperty'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc0c1,0x1f1));var _0x1c0c=function(_0x4788e0,_0xac8f7f){_0x4788e0=_0x4788e0-0x0;var _0x2f88a6=_0xc0c1[_0x4788e0];return _0x2f88a6;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x1c0c('0x0'))['db'][_0x1c0c('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1c0c('0x2'),'afterUpdate':_0x1c0c('0x3'),'afterDestroy':_0x1c0c('0x4')};function emitEvent(_0x4919ac){return function(_0x1f6bed,_0x7da819,_0x96c7d8){SmsMessageEvents[_0x1c0c('0x5')](_0x4919ac+':'+_0x1f6bed['id'],_0x1f6bed);SmsMessageEvents[_0x1c0c('0x5')](_0x4919ac,_0x1f6bed);_0x96c7d8(null);};}for(var e in events){if(events[_0x1c0c('0x6')](e)){var event=events[e];SmsMessage[_0x1c0c('0x7')](e,emitEvent(event));}}module[_0x1c0c('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0x576d=['emit','hasOwnProperty','hook','exports','events','SmsMessage','setMaxListeners','save','update'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x576d,0x17e));var _0xd576=function(_0x402f93,_0x29a5a6){_0x402f93=_0x402f93-0x0;var _0x3fbb31=_0x576d[_0x402f93];return _0x3fbb31;};'use strict';var EventEmitter=require(_0xd576('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0xd576('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xd576('0x2')](0x0);var events={'afterCreate':_0xd576('0x3'),'afterUpdate':_0xd576('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3530c1){return function(_0x3f5efe,_0x2563c9,_0x12dc84){SmsMessageEvents['emit'](_0x3530c1+':'+_0x3f5efe['id'],_0x3f5efe);SmsMessageEvents[_0xd576('0x5')](_0x3530c1,_0x3f5efe);_0x12dc84(null);};}for(var e in events){if(events[_0xd576('0x6')](e)){var event=events[e];SmsMessage[_0xd576('0x7')](e,emitEvent(event));}}module[_0xd576('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 378bd17..3961afd 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 _0x6c4b=['keys','sort','length','md5','signature=','GET','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','refid','status','Token\x20not\x20received','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','SmsInteraction','then','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','messages','create','phone','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','username','smsMethod','sender','login?username=','&password=','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','requestid','clicksend','password','xCALLY\x20Motion','format','%s:%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','authId','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','message_uuid','plivo','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','csc','crypto','apiKey','text'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6c4b,0x93));var _0xb6c4=function(_0x10af12,_0x4cf4be){_0x10af12=_0x10af12-0x0;var _0x4ed7c8=_0x6c4b[_0x10af12];return _0x4ed7c8;};'use strict';var _=require(_0xb6c4('0x0'));var util=require(_0xb6c4('0x1'));var logger=require(_0xb6c4('0x2'))('api');var moment=require(_0xb6c4('0x3'));var BPromise=require(_0xb6c4('0x4'));var rp=require(_0xb6c4('0x5'));var fs=require('fs');var path=require(_0xb6c4('0x6'));var rimraf=require(_0xb6c4('0x7'));var config=require(_0xb6c4('0x8'));var attributes=require('./smsMessage.attributes');module['exports']=function(_0x1f7abc,_0x5a290a){return _0x1f7abc[_0xb6c4('0x9')](_0xb6c4('0xa'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xb6c4('0xb'),'fields':[_0xb6c4('0xb')]},{'name':_0xb6c4('0xc'),'fields':[_0xb6c4('0xd')],'type':_0xb6c4('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x46b134,_0x377543,_0x4dca82){var _0x22d6fa=_0x1f7abc[_0xb6c4('0xf')];var _0x19d7bf=_0x46b134[_0xb6c4('0x10')]({'plain':!![]});if(_0x19d7bf['direction'][_0xb6c4('0x11')]()==='in'||_0x19d7bf[_0xb6c4('0x12')][_0xb6c4('0x11')]()===_0xb6c4('0x13')&&!_0x19d7bf[_0xb6c4('0x14')]&&!_[_0xb6c4('0x15')](_0x19d7bf[_0xb6c4('0x16')])){_0x22d6fa[_0xb6c4('0x17')]['findOne']({'where':{'id':_0x19d7bf['SmsInteractionId']}})[_0xb6c4('0x18')](function(_0x48e451){if(_0x48e451){_0x48e451[_0xb6c4('0x19')]({'lastMsgAt':_0x19d7bf[_0xb6c4('0x1a')],'lastMsgDirection':_0x19d7bf[_0xb6c4('0x12')]['toLowerCase']()});}})[_0xb6c4('0x1b')](function(_0x1566a8){console[_0xb6c4('0x1c')](_0x1566a8);});}if(_0x19d7bf['direction']===_0xb6c4('0x13')&&!_0x19d7bf[_0xb6c4('0x14')]){var _0x3c3204;_0x22d6fa[_0xb6c4('0x1d')][_0xb6c4('0x1e')]({'where':{'id':_0x19d7bf[_0xb6c4('0x1f')]},'raw':!![]})[_0xb6c4('0x18')](function(_0x55eb35){_0x3c3204=_0x55eb35;if(_0x3c3204&&_0x3c3204['type']){switch(_0x3c3204[_0xb6c4('0x20')]){case _0xb6c4('0x21'):var _0x1a7076=require(_0xb6c4('0x21'));if(_0x3c3204[_0xb6c4('0x22')]&&_0x3c3204[_0xb6c4('0x23')]&&_0x3c3204['phone']){var _0x49c1b5=new _0x1a7076(_0x3c3204[_0xb6c4('0x22')],_0x3c3204[_0xb6c4('0x23')]);_0x49c1b5[_0xb6c4('0x24')][_0xb6c4('0x25')]({'body':_0x19d7bf[_0xb6c4('0xd')],'to':_0x19d7bf[_0xb6c4('0x26')],'from':_0x3c3204[_0xb6c4('0x26')],'statusCallback':_0x3c3204[_0xb6c4('0x27')]+_0xb6c4('0x28')+_0x19d7bf['id']+_0xb6c4('0x29')+_0x3c3204[_0xb6c4('0x2a')]})[_0xb6c4('0x18')](function(_0x3341aa){if(_0x3341aa['sid']){return _0x46b134[_0xb6c4('0x19')]({'messageId':_0x3341aa[_0xb6c4('0x2b')]});}})[_0xb6c4('0x1b')](function(_0x547b25){logger[_0xb6c4('0x1c')](_0xb6c4('0x2c'),_0xb6c4('0x2d'),_0xb6c4('0x21'),util[_0xb6c4('0x2e')](_0x547b25,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb6c4('0x2c'),_0xb6c4('0x2d'),_0xb6c4('0x21'),_0xb6c4('0x2f'));}break;case'skebby':var _0x166775='https://api.skebby.it/API/v1.0/REST/';if(_0x3c3204[_0xb6c4('0x30')]&&_0x3c3204['password']){var _0xe0e62e={'recipient':[_0x19d7bf[_0xb6c4('0x26')]],'message':_0x19d7bf[_0xb6c4('0xd')],'message_type':_0x3c3204[_0xb6c4('0x31')]};if(_0x3c3204[_0xb6c4('0x31')]&&_0x3c3204[_0xb6c4('0x31')]!=='SI'){_0xe0e62e[_0xb6c4('0x32')]=_0x3c3204[_0xb6c4('0x26')];}var _0x5266c2={'url':_0x166775+_0xb6c4('0x33')+_0x3c3204[_0xb6c4('0x30')]+_0xb6c4('0x34')+_0x3c3204['password'],'method':'GET'};rp(_0x5266c2)[_0xb6c4('0x18')](function(_0x205010){var _0x846441=_0x205010['split'](';');var _0x50cdee={'user_key':_0x846441[0x0],'session_key':_0x846441[0x1]};_0x5266c2={'url':_0x166775+_0xb6c4('0x35'),'method':_0xb6c4('0x36'),'headers':{'user_key':_0x50cdee[_0xb6c4('0x37')],'Session_key':_0x50cdee[_0xb6c4('0x38')]},'json':!![],'body':_0xe0e62e};return rp(_0x5266c2);})[_0xb6c4('0x18')](function(_0xfdfe1d){if(_0xfdfe1d[_0xb6c4('0x39')]>=0x1){var _0x68265b={'messageId':_0xfdfe1d[_0xb6c4('0x3a')]};if(_0x3c3204['smsMethod']!=='GP'||!_0x3c3204[_0xb6c4('0x3b')]){_0x68265b[_0xb6c4('0x3c')]=!![];}return _0x46b134[_0xb6c4('0x19')](_0x68265b);}else{return logger[_0xb6c4('0x1c')](_0xb6c4('0x2c'),_0xb6c4('0x2d'),_0xb6c4('0x3d'),util[_0xb6c4('0x2e')](_0xfdfe1d,{'showHidden':![],'depth':null}));}})[_0xb6c4('0x1b')](function(_0x2f79a1){return logger[_0xb6c4('0x1c')](_0xb6c4('0x2c'),_0xb6c4('0x2d'),'skebby',util['inspect'](_0x2f79a1,{'showHidden':![],'depth':null}));});}else{logger[_0xb6c4('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb6c4('0x2d'),_0xb6c4('0x3d'),_0xb6c4('0x3e'));}break;case _0xb6c4('0x3f'):if(_0x3c3204[_0xb6c4('0x23')]){var _0x412052={'recipient':_0x19d7bf[_0xb6c4('0x26')],'message':_0x19d7bf[_0xb6c4('0xd')],'sender':_0x3c3204[_0xb6c4('0x40')]||_0x3c3204[_0xb6c4('0x26')],'authorization':_0x3c3204[_0xb6c4('0x23')]};var _0x377543={'method':_0xb6c4('0x36'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x412052,'json':!![]};rp(_0x377543)[_0xb6c4('0x18')](function(_0x894946){var _0x33b69d={'messageId':_0x894946[_0xb6c4('0x41')]};if(!_0x3c3204[_0xb6c4('0x3b')]){_0x33b69d['read']=!![];}return _0x46b134[_0xb6c4('0x19')](_0x33b69d);})[_0xb6c4('0x1b')](function(_0xc50fdf){logger['error'](_0xb6c4('0x2c'),_0xb6c4('0x2d'),_0xb6c4('0x3f'),util[_0xb6c4('0x2e')](_0xc50fdf,{'showHidden':![],'depth':null}));});}else{logger[_0xb6c4('0x1c')](_0xb6c4('0x2c'),_0xb6c4('0x2d'),'connectel','Missing\x20parameters:\x20authToken');}break;case _0xb6c4('0x42'):if(_0x3c3204[_0xb6c4('0x30')]&&_0x3c3204[_0xb6c4('0x43')]){var _0x412052={'messages':[{'source':_0xb6c4('0x44'),'to':_0x19d7bf[_0xb6c4('0x26')],'body':_0x19d7bf[_0xb6c4('0xd')],'from':_0x3c3204[_0xb6c4('0x40')]||_0x3c3204[_0xb6c4('0x26')]}]};var _0x615726=util[_0xb6c4('0x45')](_0xb6c4('0x46'),_0x3c3204[_0xb6c4('0x30')],_0x3c3204['password']);var _0x377543={'method':_0xb6c4('0x36'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x412052,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x615726)[_0xb6c4('0x47')](_0xb6c4('0x48')))},'json':!![]};rp(_0x377543)['then'](function(_0x30767f){if(_0x30767f[_0xb6c4('0x49')]>=0xc8&&_0x30767f['http_code']<=0xce){if(_0x30767f[_0xb6c4('0x4a')]&&_0x30767f[_0xb6c4('0x4a')][_0xb6c4('0x4b')]>0x0){var _0x2cc7a7=_[_0xb6c4('0x4c')](_0x30767f[_0xb6c4('0x4a')]['messages']);var _0x348260={'messageId':_0x2cc7a7[_0xb6c4('0x4d')]};if(!_0x3c3204['deliveryReport']){_0x348260[_0xb6c4('0x3c')]=!![];}return _0x46b134[_0xb6c4('0x19')](_0x348260);}else{logger[_0xb6c4('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb6c4('0x2d'),_0xb6c4('0x4e'),util[_0xb6c4('0x2e')](_0x30767f,{'showHidden':![],'depth':null}));}}else{logger[_0xb6c4('0x1c')](_0xb6c4('0x2c'),'afterCreate',_0xb6c4('0x4e'),util[_0xb6c4('0x2e')](_0x30767f,{'showHidden':![],'depth':null}));}})[_0xb6c4('0x1b')](function(_0xa256a3){logger[_0xb6c4('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb6c4('0x2d'),_0xb6c4('0x4e'),util[_0xb6c4('0x2e')](_0xa256a3,{'showHidden':![],'depth':null}));});}else{logger[_0xb6c4('0x1c')](_0xb6c4('0x2c'),_0xb6c4('0x2d'),'clickSend',_0xb6c4('0x3e'));}break;case'plivo':if(_0x3c3204[_0xb6c4('0x4f')]&&_0x3c3204[_0xb6c4('0x23')]){var _0x412052={'dst':_0x19d7bf[_0xb6c4('0x26')],'text':_0x19d7bf[_0xb6c4('0xd')],'src':_0x3c3204[_0xb6c4('0x40')]||_0x3c3204[_0xb6c4('0x26')],'url':_0x3c3204['remote']+_0xb6c4('0x28')+_0x19d7bf['id']+'/status?token='+_0x3c3204[_0xb6c4('0x2a')]};var _0x615726=util['format'](_0xb6c4('0x46'),_0x3c3204[_0xb6c4('0x4f')],_0x3c3204['authToken']);var _0x377543={'method':_0xb6c4('0x36'),'uri':util[_0xb6c4('0x45')](_0xb6c4('0x50'),_0x3c3204[_0xb6c4('0x4f')]),'body':_0x412052,'headers':{'Authorization':util[_0xb6c4('0x45')](_0xb6c4('0x51'),new Buffer(_0x615726)['toString']('base64'))},'json':!![]};rp(_0x377543)['then'](function(_0x4d3443){var _0x2d4f29={'messageId':_0x4d3443[_0xb6c4('0x52')][0x0]};return _0x46b134[_0xb6c4('0x19')](_0x2d4f29);})[_0xb6c4('0x1b')](function(_0x37bc8a){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','plivo',util[_0xb6c4('0x2e')](_0x37bc8a,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb6c4('0x2c'),_0xb6c4('0x2d'),_0xb6c4('0x53'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xb6c4('0x54'):if(_0x3c3204[_0xb6c4('0x30')]&&_0x3c3204[_0xb6c4('0x43')]){if(_0x3c3204['baseUrl']){var _0x4d1329={'method':_0xb6c4('0x36'),'uri':_0x3c3204[_0xb6c4('0x55')]+'/auth/1/session','body':{'username':_0x3c3204[_0xb6c4('0x30')],'password':_0x3c3204[_0xb6c4('0x43')]},'json':!![]};return rp(_0x4d1329)[_0xb6c4('0x18')](function(_0x334a05){var _0x15c30c={'method':'POST','uri':_0x3c3204['baseUrl']+_0xb6c4('0x56'),'body':{'messages':[{'from':_0x3c3204['phone'],'destinations':[{'to':_0x19d7bf[_0xb6c4('0x26')]}],'text':_0x19d7bf[_0xb6c4('0xd')],'notifyUrl':_0x3c3204['remote']+_0xb6c4('0x28')+_0x19d7bf['id']+_0xb6c4('0x29')+_0x3c3204[_0xb6c4('0x2a')],'notifyContentType':_0xb6c4('0x57'),'callbackData':_0x3c3204[_0xb6c4('0x26')]+';'+_0x19d7bf[_0xb6c4('0xd')]}]},'headers':{'Authorization':_0xb6c4('0x58')+_0x334a05[_0xb6c4('0x2a')]},'json':!![]};return rp(_0x15c30c)[_0xb6c4('0x18')](function(_0x5e783a){if(_0x5e783a[_0xb6c4('0x24')]){var _0x4eab1e={'messageId':_0x5e783a[_0xb6c4('0x24')][0x0][_0xb6c4('0xb')]};if(!_0x3c3204[_0xb6c4('0x3b')]){_0x4eab1e[_0xb6c4('0x3c')]=!![];}return _0x46b134[_0xb6c4('0x19')](_0x4eab1e);}else{return logger[_0xb6c4('0x1c')](_0xb6c4('0x2c'),_0xb6c4('0x2d'),'infobip',util[_0xb6c4('0x2e')](_0x5e783a,{'showHidden':![],'depth':null}));}});})[_0xb6c4('0x1b')](function(_0x204ba4){return logger[_0xb6c4('0x1c')](_0xb6c4('0x2c'),_0xb6c4('0x2d'),_0xb6c4('0x54'),util[_0xb6c4('0x2e')](_0x204ba4,{'showHidden':![],'depth':null}));});}else{logger[_0xb6c4('0x1c')](_0xb6c4('0x2c'),'afterCreate',_0xb6c4('0x54'),'Missing\x20parameters:\x20base_url');}}else{logger['error'](_0xb6c4('0x2c'),_0xb6c4('0x2d'),_0xb6c4('0x54'),_0xb6c4('0x3e'));}break;case _0xb6c4('0x59'):var _0x3b16fc=require(_0xb6c4('0x5a'));if(_0x3c3204[_0xb6c4('0x5b')]){var _0x361123={};_0x361123['login']=_0x3c3204[_0xb6c4('0x30')];_0x361123[_0xb6c4('0x26')]=_0x19d7bf[_0xb6c4('0x26')];_0x361123[_0xb6c4('0x32')]=_0x3c3204[_0xb6c4('0x26')];_0x361123[_0xb6c4('0x5c')]=_0x19d7bf['body'];_0x361123['timestamp']=+new Date();var _0x27b984='';var _0x475338='';var _0x8d538f=Object[_0xb6c4('0x5d')](_0x361123);_0x8d538f[_0xb6c4('0x5e')]();for(var _0x741b84=0x0;_0x741b84<_0x8d538f[_0xb6c4('0x5f')];_0x741b84++){if(_0x27b984!=''){_0x27b984+='&';}_0x27b984+=_0x8d538f[_0x741b84]+'='+encodeURIComponent(_0x361123[_0x8d538f[_0x741b84]]);_0x475338+=_0x361123[_0x8d538f[_0x741b84]];}_0x475338+=_0x3c3204['apiKey'];_0x475338=_0x3b16fc['createHash'](_0xb6c4('0x60'))[_0xb6c4('0x19')](_0x475338)['digest']('hex');if(_0x27b984!==''){_0x27b984+='&';}_0x27b984+=_0xb6c4('0x61')+_0x475338;var _0x5266c2={'method':_0xb6c4('0x62'),'uri':_0x3c3204[_0xb6c4('0x55')]+_0xb6c4('0x63')+_0x27b984,'json':!![]};return rp(_0x5266c2)[_0xb6c4('0x18')](function(_0x4175bd){var _0x29a385=Object[_0xb6c4('0x5d')](_0x4175bd);if(_0x4175bd[_0x29a385[0x0]][_0xb6c4('0x1c')]&&parseInt(_0x4175bd[_0x29a385[0x0]][_0xb6c4('0x1c')])===0x0){var _0x1827b4={'messageId':_0x4175bd[_0x29a385[0x0]][_0xb6c4('0x64')]};if(!_0x3c3204[_0xb6c4('0x3b')]){_0x1827b4[_0xb6c4('0x3c')]=!![];}return _0x46b134[_0xb6c4('0x19')](_0x1827b4);}else{return logger[_0xb6c4('0x1c')](_0xb6c4('0x2c'),_0xb6c4('0x2d'),_0xb6c4('0x59'),util['inspect'](_0x4175bd[_0xb6c4('0x1c')],{'showHidden':![],'depth':null}));}})[_0xb6c4('0x1b')](function(_0xfed01e){return logger[_0xb6c4('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb6c4('0x2d'),'csc',util[_0xb6c4('0x2e')](_0xfed01e,{'showHidden':![],'depth':null}));});}else{logger[_0xb6c4('0x1c')](_0xb6c4('0x2c'),'afterCreate',_0xb6c4('0x59'),_0xb6c4('0x65'));}break;case _0xb6c4('0x66'):if(_0x3c3204[_0xb6c4('0x5b')]){var _0x325ae7={'method':'POST','uri':_0xb6c4('0x67'),'headers':{'Authorization':_0x3c3204[_0xb6c4('0x5b')]},'body':{'content':_0x19d7bf[_0xb6c4('0xd')],'to':[_0x19d7bf[_0xb6c4('0x26')]],'from':_0x3c3204['phone'],'binary':![],'clientMessageId':'uuid','charset':_0xb6c4('0x68')},'json':!![]};rp(_0x325ae7)['then'](function(_0xb89375){if(!_0xb89375['error']){var _0x46e43e={'messageId':_0xb89375[_0xb6c4('0x24')][0x0][_0xb6c4('0x69')]};if(!_0x3c3204['deliveryReport']){_0x46e43e['read']=!![];}return _0x46b134[_0xb6c4('0x19')](_0x46e43e);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb6c4('0x2d'),_0xb6c4('0x66'),util['inspect'](_0xb89375[_0xb6c4('0x1c')],{'showHidden':![],'depth':null}));}})[_0xb6c4('0x1b')](function(_0x3148b3){return logger[_0xb6c4('0x1c')](_0xb6c4('0x2c'),_0xb6c4('0x2d'),_0xb6c4('0x66'),util[_0xb6c4('0x2e')](_0x3148b3,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb6c4('0x2d'),_0xb6c4('0x66'),_0xb6c4('0x65'));}break;case _0xb6c4('0x6a'):if(_0x3c3204[_0xb6c4('0x30')]&&_0x3c3204[_0xb6c4('0x43')]){var _0x615726=util[_0xb6c4('0x45')]('%s:%s',_0x3c3204[_0xb6c4('0x30')],_0x3c3204[_0xb6c4('0x43')]);var _0x377543={'method':_0xb6c4('0x36'),'uri':_0xb6c4('0x6b')+_0x3c3204[_0xb6c4('0x6c')]+'/messages','body':{'to':[_0x19d7bf[_0xb6c4('0x26')]],'text':_0x19d7bf[_0xb6c4('0xd')],'from':_0x3c3204[_0xb6c4('0x26')],'applicationId':_0x3c3204[_0xb6c4('0x6d')]},'headers':{'Authorization':util[_0xb6c4('0x45')](_0xb6c4('0x51'),new Buffer(_0x615726)['toString'](_0xb6c4('0x48')))},'json':!![]};rp(_0x377543)['then'](function(_0x17b9f4){if(_0x17b9f4['id']){var _0x11494d={'messageId':_0x17b9f4['id']};return _0x46b134[_0xb6c4('0x19')](_0x11494d);}else{logger[_0xb6c4('0x1c')](_0xb6c4('0x2c'),_0xb6c4('0x2d'),_0xb6c4('0x6a'),util[_0xb6c4('0x2e')](_0x17b9f4,{'showHidden':![],'depth':null}));}})[_0xb6c4('0x1b')](function(_0x375509){logger[_0xb6c4('0x1c')](_0xb6c4('0x2c'),_0xb6c4('0x2d'),'bandwidth',util[_0xb6c4('0x2e')](_0x375509,{'showHidden':![],'depth':null}));});}else{logger[_0xb6c4('0x1c')](_0xb6c4('0x2c'),_0xb6c4('0x2d'),_0xb6c4('0x6a'),_0xb6c4('0x3e'));}break;case _0xb6c4('0x6e'):if(_0x3c3204[_0xb6c4('0x5b')]){var _0x4a5399={};var _0x5266c2={'method':_0xb6c4('0x36'),'uri':_0xb6c4('0x6f'),'headers':{'Authorization':_0xb6c4('0x70')+_0x3c3204[_0xb6c4('0x5b')],'Content-Type':'application/json'},'body':{'from':_0x3c3204[_0xb6c4('0x26')],'to':_0x19d7bf[_0xb6c4('0x26')],'text':_0x19d7bf[_0xb6c4('0xd')]},'json':!![]};return rp(_0x5266c2)[_0xb6c4('0x18')](function(_0x5ec505){if(_0x5ec505[_0xb6c4('0x71')]==0xca){_0x4a5399[_0xb6c4('0x72')]=_0x5ec505;var _0x4942c4={'method':_0xb6c4('0x36'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xb6c4('0x70')+_0x3c3204[_0xb6c4('0x5b')],'Content-Type':'application/json'},'body':{'refid':_0x4a5399[_0xb6c4('0x72')][_0xb6c4('0x73')]},'json':!![]};return rp(_0x4942c4)[_0xb6c4('0x18')](function(_0xc974ca){_0x4a5399[_0xb6c4('0x74')]=_0xc974ca;var _0x148399={'messageId':_0x4a5399[_0xb6c4('0x72')][_0xb6c4('0x73')],'read':!![]};return _0x46b134[_0xb6c4('0x19')](_0x148399);});}else{return logger[_0xb6c4('0x1c')](_0xb6c4('0x2c'),_0xb6c4('0x2d'),_0xb6c4('0x6e'),util['inspect'](_0x5ec505,{'showHidden':![],'depth':null}));}})[_0xb6c4('0x1b')](function(_0xc37aed){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','intelepeer',util[_0xb6c4('0x2e')](_0xc37aed,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xb6c4('0x2c'),_0xb6c4('0x2d'),'intelepeer',_0xb6c4('0x75'));}break;}}})[_0xb6c4('0x76')](function(){_0x4dca82();});}else{_0x4dca82();}}},'charset':'utf8mb4','collate':_0xb6c4('0x77')});}; \ No newline at end of file +var _0x122a=['split','sms','user_key','total_sent','internal_order_id','read','afterCreate','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','data','queued_count','message_id','clickSend','inspect','plivo','authId','remote','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','csc','crypto','login','text','timestamp','createHash','md5','digest','signature=','keys','Missing\x20parameters:\x20apiKey','apiKey','https://platform.clickatell.com/messages','UTF-8','apiMessageId','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path','../../config/environment','./smsMessage.attributes','exports','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','secret','isNil','SmsInteraction','findOne','SmsInteractionId','update','createdAt','toLowerCase','catch','error','out','SmsAccount','find','SmsAccountId','then','type','twilio','accountSid','authToken','phone','messages','create','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','&password=','password'];(function(_0x430f44,_0x4ae21b){var _0x1f6b0f=function(_0x35968f){while(--_0x35968f){_0x430f44['push'](_0x430f44['shift']());}};_0x1f6b0f(++_0x4ae21b);}(_0x122a,0xba));var _0xa122=function(_0x1f45c6,_0x42e037){_0x1f45c6=_0x1f45c6-0x0;var _0x175f73=_0x122a[_0x1f45c6];return _0x175f73;};'use strict';var _=require(_0xa122('0x0'));var util=require(_0xa122('0x1'));var logger=require(_0xa122('0x2'))(_0xa122('0x3'));var moment=require(_0xa122('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa122('0x5'));var rimraf=require('rimraf');var config=require(_0xa122('0x6'));var attributes=require(_0xa122('0x7'));module[_0xa122('0x8')]=function(_0x3c8130,_0x526272){return _0x3c8130['define']('SmsMessage',attributes,{'tableName':_0xa122('0x9'),'paranoid':![],'indexes':[{'name':_0xa122('0xa'),'fields':['messageId']},{'name':_0xa122('0xb'),'fields':[_0xa122('0xc')],'type':_0xa122('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x32314d,_0x5b2393,_0x532830){var _0x5479b7=_0x3c8130[_0xa122('0xe')];var _0x51f5de=_0x32314d[_0xa122('0xf')]({'plain':!![]});if(_0x51f5de[_0xa122('0x10')]['toLowerCase']()==='in'||_0x51f5de[_0xa122('0x10')]['toLowerCase']()==='out'&&!_0x51f5de[_0xa122('0x11')]&&!_[_0xa122('0x12')](_0x51f5de['UserId'])){_0x5479b7[_0xa122('0x13')][_0xa122('0x14')]({'where':{'id':_0x51f5de[_0xa122('0x15')]}})['then'](function(_0xdc178a){if(_0xdc178a){_0xdc178a[_0xa122('0x16')]({'lastMsgAt':_0x51f5de[_0xa122('0x17')],'lastMsgDirection':_0x51f5de[_0xa122('0x10')][_0xa122('0x18')]()});}})[_0xa122('0x19')](function(_0x5ec92a){console[_0xa122('0x1a')](_0x5ec92a);});}if(_0x51f5de[_0xa122('0x10')]===_0xa122('0x1b')&&!_0x51f5de[_0xa122('0x11')]){var _0x15c076;_0x5479b7[_0xa122('0x1c')][_0xa122('0x1d')]({'where':{'id':_0x51f5de[_0xa122('0x1e')]},'raw':!![]})[_0xa122('0x1f')](function(_0x5096cb){_0x15c076=_0x5096cb;if(_0x15c076&&_0x15c076[_0xa122('0x20')]){switch(_0x15c076[_0xa122('0x20')]){case _0xa122('0x21'):var _0x3a0ae3=require(_0xa122('0x21'));if(_0x15c076[_0xa122('0x22')]&&_0x15c076[_0xa122('0x23')]&&_0x15c076[_0xa122('0x24')]){var _0x319836=new _0x3a0ae3(_0x15c076['accountSid'],_0x15c076[_0xa122('0x23')]);_0x319836[_0xa122('0x25')][_0xa122('0x26')]({'body':_0x51f5de[_0xa122('0xc')],'to':_0x51f5de[_0xa122('0x24')],'from':_0x15c076[_0xa122('0x24')],'statusCallback':_0x15c076['remote']+_0xa122('0x27')+_0x51f5de['id']+_0xa122('0x28')+_0x15c076[_0xa122('0x29')]})[_0xa122('0x1f')](function(_0x15742e){if(_0x15742e[_0xa122('0x2a')]){return _0x32314d[_0xa122('0x16')]({'messageId':_0x15742e[_0xa122('0x2a')]});}})[_0xa122('0x19')](function(_0x5a295e){logger[_0xa122('0x1a')](_0xa122('0x2b'),'afterCreate',_0xa122('0x21'),util['inspect'](_0x5a295e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa122('0x2b'),'afterCreate',_0xa122('0x21'),_0xa122('0x2c'));}break;case _0xa122('0x2d'):var _0x11ffdf=_0xa122('0x2e');if(_0x15c076[_0xa122('0x2f')]&&_0x15c076['password']){var _0xe37991={'recipient':[_0x51f5de[_0xa122('0x24')]],'message':_0x51f5de[_0xa122('0xc')],'message_type':_0x15c076['smsMethod']};if(_0x15c076['smsMethod']&&_0x15c076[_0xa122('0x30')]!=='SI'){_0xe37991[_0xa122('0x31')]=_0x15c076[_0xa122('0x24')];}var _0x2dcee9={'url':_0x11ffdf+'login?username='+_0x15c076['username']+_0xa122('0x32')+_0x15c076[_0xa122('0x33')],'method':'GET'};rp(_0x2dcee9)[_0xa122('0x1f')](function(_0x3b967e){var _0x1662af=_0x3b967e[_0xa122('0x34')](';');var _0x2782d1={'user_key':_0x1662af[0x0],'session_key':_0x1662af[0x1]};_0x2dcee9={'url':_0x11ffdf+_0xa122('0x35'),'method':'POST','headers':{'user_key':_0x2782d1[_0xa122('0x36')],'Session_key':_0x2782d1['session_key']},'json':!![],'body':_0xe37991};return rp(_0x2dcee9);})[_0xa122('0x1f')](function(_0x4ba165){if(_0x4ba165[_0xa122('0x37')]>=0x1){var _0x1c3c2b={'messageId':_0x4ba165[_0xa122('0x38')]};if(_0x15c076[_0xa122('0x30')]!=='GP'||!_0x15c076['deliveryReport']){_0x1c3c2b[_0xa122('0x39')]=!![];}return _0x32314d['update'](_0x1c3c2b);}else{return logger[_0xa122('0x1a')](_0xa122('0x2b'),_0xa122('0x3a'),'skebby',util['inspect'](_0x4ba165,{'showHidden':![],'depth':null}));}})[_0xa122('0x19')](function(_0x112dab){return logger[_0xa122('0x1a')](_0xa122('0x2b'),_0xa122('0x3a'),_0xa122('0x2d'),util['inspect'](_0x112dab,{'showHidden':![],'depth':null}));});}else{logger[_0xa122('0x1a')](_0xa122('0x2b'),'afterCreate',_0xa122('0x2d'),_0xa122('0x3b'));}break;case _0xa122('0x3c'):if(_0x15c076[_0xa122('0x23')]){var _0x192368={'recipient':_0x51f5de['phone'],'message':_0x51f5de[_0xa122('0xc')],'sender':_0x15c076[_0xa122('0x3d')]||_0x15c076['phone'],'authorization':_0x15c076[_0xa122('0x23')]};var _0x5b2393={'method':_0xa122('0x3e'),'uri':_0xa122('0x3f'),'body':_0x192368,'json':!![]};rp(_0x5b2393)[_0xa122('0x1f')](function(_0x2d2b2a){var _0x2a65bf={'messageId':_0x2d2b2a[_0xa122('0x40')]};if(!_0x15c076[_0xa122('0x41')]){_0x2a65bf[_0xa122('0x39')]=!![];}return _0x32314d[_0xa122('0x16')](_0x2a65bf);})['catch'](function(_0x2de6c6){logger['error'](_0xa122('0x2b'),_0xa122('0x3a'),_0xa122('0x3c'),util['inspect'](_0x2de6c6,{'showHidden':![],'depth':null}));});}else{logger[_0xa122('0x1a')](_0xa122('0x2b'),_0xa122('0x3a'),'connectel','Missing\x20parameters:\x20authToken');}break;case _0xa122('0x42'):if(_0x15c076[_0xa122('0x2f')]&&_0x15c076[_0xa122('0x33')]){var _0x192368={'messages':[{'source':_0xa122('0x43'),'to':_0x51f5de['phone'],'body':_0x51f5de[_0xa122('0xc')],'from':_0x15c076[_0xa122('0x3d')]||_0x15c076[_0xa122('0x24')]}]};var _0x40626d=util[_0xa122('0x44')](_0xa122('0x45'),_0x15c076[_0xa122('0x2f')],_0x15c076[_0xa122('0x33')]);var _0x5b2393={'method':_0xa122('0x3e'),'uri':_0xa122('0x46'),'body':_0x192368,'headers':{'Authorization':util[_0xa122('0x44')]('Basic\x20%s',new Buffer(_0x40626d)[_0xa122('0x47')](_0xa122('0x48')))},'json':!![]};rp(_0x5b2393)[_0xa122('0x1f')](function(_0x212d3d){if(_0x212d3d[_0xa122('0x49')]>=0xc8&&_0x212d3d[_0xa122('0x49')]<=0xce){if(_0x212d3d[_0xa122('0x4a')]&&_0x212d3d['data'][_0xa122('0x4b')]>0x0){var _0x1ea3a2=_['head'](_0x212d3d['data'][_0xa122('0x25')]);var _0x496942={'messageId':_0x1ea3a2[_0xa122('0x4c')]};if(!_0x15c076[_0xa122('0x41')]){_0x496942[_0xa122('0x39')]=!![];}return _0x32314d[_0xa122('0x16')](_0x496942);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa122('0x3a'),_0xa122('0x4d'),util['inspect'](_0x212d3d,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xa122('0x2b'),_0xa122('0x3a'),_0xa122('0x4d'),util[_0xa122('0x4e')](_0x212d3d,{'showHidden':![],'depth':null}));}})[_0xa122('0x19')](function(_0x4e399b){logger[_0xa122('0x1a')](_0xa122('0x2b'),_0xa122('0x3a'),'clickSend',util[_0xa122('0x4e')](_0x4e399b,{'showHidden':![],'depth':null}));});}else{logger[_0xa122('0x1a')](_0xa122('0x2b'),'afterCreate',_0xa122('0x4d'),_0xa122('0x3b'));}break;case _0xa122('0x4f'):if(_0x15c076[_0xa122('0x50')]&&_0x15c076['authToken']){var _0x192368={'dst':_0x51f5de['phone'],'text':_0x51f5de[_0xa122('0xc')],'src':_0x15c076[_0xa122('0x3d')]||_0x15c076[_0xa122('0x24')],'url':_0x15c076[_0xa122('0x51')]+_0xa122('0x27')+_0x51f5de['id']+_0xa122('0x28')+_0x15c076[_0xa122('0x29')]};var _0x40626d=util[_0xa122('0x44')](_0xa122('0x45'),_0x15c076[_0xa122('0x50')],_0x15c076[_0xa122('0x23')]);var _0x5b2393={'method':_0xa122('0x3e'),'uri':util[_0xa122('0x44')](_0xa122('0x52'),_0x15c076[_0xa122('0x50')]),'body':_0x192368,'headers':{'Authorization':util[_0xa122('0x44')](_0xa122('0x53'),new Buffer(_0x40626d)[_0xa122('0x47')](_0xa122('0x48')))},'json':!![]};rp(_0x5b2393)[_0xa122('0x1f')](function(_0x54bc6d){var _0x552f22={'messageId':_0x54bc6d[_0xa122('0x54')][0x0]};return _0x32314d[_0xa122('0x16')](_0x552f22);})[_0xa122('0x19')](function(_0x1609e8){logger[_0xa122('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa122('0x3a'),'plivo',util[_0xa122('0x4e')](_0x1609e8,{'showHidden':![],'depth':null}));});}else{logger[_0xa122('0x1a')](_0xa122('0x2b'),_0xa122('0x3a'),_0xa122('0x4f'),_0xa122('0x55'));}break;case _0xa122('0x56'):if(_0x15c076['username']&&_0x15c076[_0xa122('0x33')]){if(_0x15c076[_0xa122('0x57')]){var _0x19154b={'method':_0xa122('0x3e'),'uri':_0x15c076[_0xa122('0x57')]+_0xa122('0x58'),'body':{'username':_0x15c076[_0xa122('0x2f')],'password':_0x15c076[_0xa122('0x33')]},'json':!![]};return rp(_0x19154b)[_0xa122('0x1f')](function(_0x65a156){var _0x39ed69={'method':_0xa122('0x3e'),'uri':_0x15c076[_0xa122('0x57')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x15c076[_0xa122('0x24')],'destinations':[{'to':_0x51f5de[_0xa122('0x24')]}],'text':_0x51f5de[_0xa122('0xc')],'notifyUrl':_0x15c076[_0xa122('0x51')]+_0xa122('0x27')+_0x51f5de['id']+'/status?token='+_0x15c076[_0xa122('0x29')],'notifyContentType':_0xa122('0x59'),'callbackData':_0x15c076[_0xa122('0x24')]+';'+_0x51f5de[_0xa122('0xc')]}]},'headers':{'Authorization':_0xa122('0x5a')+_0x65a156['token']},'json':!![]};return rp(_0x39ed69)[_0xa122('0x1f')](function(_0x43cf34){if(_0x43cf34[_0xa122('0x25')]){var _0x463fc6={'messageId':_0x43cf34['messages'][0x0][_0xa122('0xa')]};if(!_0x15c076['deliveryReport']){_0x463fc6[_0xa122('0x39')]=!![];}return _0x32314d[_0xa122('0x16')](_0x463fc6);}else{return logger[_0xa122('0x1a')](_0xa122('0x2b'),'afterCreate',_0xa122('0x56'),util[_0xa122('0x4e')](_0x43cf34,{'showHidden':![],'depth':null}));}});})[_0xa122('0x19')](function(_0x2a149b){return logger[_0xa122('0x1a')](_0xa122('0x2b'),_0xa122('0x3a'),_0xa122('0x56'),util['inspect'](_0x2a149b,{'showHidden':![],'depth':null}));});}else{logger[_0xa122('0x1a')](_0xa122('0x2b'),'afterCreate','infobip','Missing\x20parameters:\x20base_url');}}else{logger[_0xa122('0x1a')](_0xa122('0x2b'),'afterCreate',_0xa122('0x56'),_0xa122('0x3b'));}break;case _0xa122('0x5b'):var _0x5846b7=require(_0xa122('0x5c'));if(_0x15c076['apiKey']){var _0x41432a={};_0x41432a[_0xa122('0x5d')]=_0x15c076[_0xa122('0x2f')];_0x41432a[_0xa122('0x24')]=_0x51f5de[_0xa122('0x24')];_0x41432a['sender']=_0x15c076[_0xa122('0x24')];_0x41432a[_0xa122('0x5e')]=_0x51f5de['body'];_0x41432a[_0xa122('0x5f')]=+new Date();var _0x209a1d='';var _0x53a751='';var _0x337f88=Object['keys'](_0x41432a);_0x337f88['sort']();for(var _0xca2091=0x0;_0xca2091<_0x337f88['length'];_0xca2091++){if(_0x209a1d!=''){_0x209a1d+='&';}_0x209a1d+=_0x337f88[_0xca2091]+'='+encodeURIComponent(_0x41432a[_0x337f88[_0xca2091]]);_0x53a751+=_0x41432a[_0x337f88[_0xca2091]];}_0x53a751+=_0x15c076['apiKey'];_0x53a751=_0x5846b7[_0xa122('0x60')](_0xa122('0x61'))[_0xa122('0x16')](_0x53a751)[_0xa122('0x62')]('hex');if(_0x209a1d!==''){_0x209a1d+='&';}_0x209a1d+=_0xa122('0x63')+_0x53a751;var _0x2dcee9={'method':'GET','uri':_0x15c076[_0xa122('0x57')]+'/external/get/send.php?'+_0x209a1d,'json':!![]};return rp(_0x2dcee9)['then'](function(_0x58b7aa){var _0x1d267c=Object[_0xa122('0x64')](_0x58b7aa);if(_0x58b7aa[_0x1d267c[0x0]][_0xa122('0x1a')]&&parseInt(_0x58b7aa[_0x1d267c[0x0]][_0xa122('0x1a')])===0x0){var _0x1368df={'messageId':_0x58b7aa[_0x1d267c[0x0]]['id_sms']};if(!_0x15c076[_0xa122('0x41')]){_0x1368df[_0xa122('0x39')]=!![];}return _0x32314d['update'](_0x1368df);}else{return logger[_0xa122('0x1a')](_0xa122('0x2b'),_0xa122('0x3a'),_0xa122('0x5b'),util[_0xa122('0x4e')](_0x58b7aa[_0xa122('0x1a')],{'showHidden':![],'depth':null}));}})[_0xa122('0x19')](function(_0x2fa7fe){return logger['error'](_0xa122('0x2b'),_0xa122('0x3a'),_0xa122('0x5b'),util[_0xa122('0x4e')](_0x2fa7fe,{'showHidden':![],'depth':null}));});}else{logger[_0xa122('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa122('0x3a'),_0xa122('0x5b'),_0xa122('0x65'));}break;case'clickatell':if(_0x15c076[_0xa122('0x66')]){var _0x5ec4a8={'method':_0xa122('0x3e'),'uri':_0xa122('0x67'),'headers':{'Authorization':_0x15c076[_0xa122('0x66')]},'body':{'content':_0x51f5de[_0xa122('0xc')],'to':[_0x51f5de[_0xa122('0x24')]],'from':_0x15c076[_0xa122('0x24')],'binary':![],'clientMessageId':'uuid','charset':_0xa122('0x68')},'json':!![]};rp(_0x5ec4a8)['then'](function(_0x1b3aa8){if(!_0x1b3aa8[_0xa122('0x1a')]){var _0x341bd2={'messageId':_0x1b3aa8[_0xa122('0x25')][0x0][_0xa122('0x69')]};if(!_0x15c076[_0xa122('0x41')]){_0x341bd2[_0xa122('0x39')]=!![];}return _0x32314d[_0xa122('0x16')](_0x341bd2);}else{return logger[_0xa122('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa122('0x3a'),'clickatell',util['inspect'](_0x1b3aa8['error'],{'showHidden':![],'depth':null}));}})[_0xa122('0x19')](function(_0x20fa18){return logger['error'](_0xa122('0x2b'),_0xa122('0x3a'),_0xa122('0x6a'),util[_0xa122('0x4e')](_0x20fa18,{'showHidden':![],'depth':null}));});}else{logger[_0xa122('0x1a')](_0xa122('0x2b'),_0xa122('0x3a'),_0xa122('0x6a'),'Missing\x20parameters:\x20apiKey');}break;case _0xa122('0x6b'):if(_0x15c076[_0xa122('0x2f')]&&_0x15c076['password']){var _0x40626d=util[_0xa122('0x44')]('%s:%s',_0x15c076[_0xa122('0x2f')],_0x15c076[_0xa122('0x33')]);var _0x5b2393={'method':_0xa122('0x3e'),'uri':_0xa122('0x6c')+_0x15c076[_0xa122('0x6d')]+'/messages','body':{'to':[_0x51f5de[_0xa122('0x24')]],'text':_0x51f5de['body'],'from':_0x15c076[_0xa122('0x24')],'applicationId':_0x15c076['applicationId']},'headers':{'Authorization':util['format'](_0xa122('0x53'),new Buffer(_0x40626d)[_0xa122('0x47')](_0xa122('0x48')))},'json':!![]};rp(_0x5b2393)[_0xa122('0x1f')](function(_0x377ddf){if(_0x377ddf['id']){var _0xe70de6={'messageId':_0x377ddf['id']};return _0x32314d[_0xa122('0x16')](_0xe70de6);}else{logger[_0xa122('0x1a')](_0xa122('0x2b'),_0xa122('0x3a'),_0xa122('0x6b'),util[_0xa122('0x4e')](_0x377ddf,{'showHidden':![],'depth':null}));}})['catch'](function(_0x363975){logger[_0xa122('0x1a')](_0xa122('0x2b'),_0xa122('0x3a'),'bandwidth',util[_0xa122('0x4e')](_0x363975,{'showHidden':![],'depth':null}));});}else{logger[_0xa122('0x1a')](_0xa122('0x2b'),_0xa122('0x3a'),'bandwidth',_0xa122('0x3b'));}break;case _0xa122('0x6e'):if(_0x15c076[_0xa122('0x66')]){var _0x82fc9a={};var _0x2dcee9={'method':'POST','uri':_0xa122('0x6f'),'headers':{'Authorization':'Bearer\x20'+_0x15c076[_0xa122('0x66')],'Content-Type':_0xa122('0x59')},'body':{'from':_0x15c076['phone'],'to':_0x51f5de[_0xa122('0x24')],'text':_0x51f5de['body']},'json':!![]};return rp(_0x2dcee9)[_0xa122('0x1f')](function(_0xd7502b){if(_0xd7502b['code']==0xca){_0x82fc9a[_0xa122('0x70')]=_0xd7502b;var _0x494068={'method':'POST','uri':_0xa122('0x71'),'headers':{'Authorization':'Bearer\x20'+_0x15c076['apiKey'],'Content-Type':_0xa122('0x59')},'body':{'refid':_0x82fc9a[_0xa122('0x70')][_0xa122('0x72')]},'json':!![]};return rp(_0x494068)[_0xa122('0x1f')](function(_0x445e99){_0x82fc9a['status']=_0x445e99;var _0x23db84={'messageId':_0x82fc9a['message']['refid'],'read':!![]};return _0x32314d['update'](_0x23db84);});}else{return logger[_0xa122('0x1a')](_0xa122('0x2b'),'afterCreate',_0xa122('0x6e'),util['inspect'](_0xd7502b,{'showHidden':![],'depth':null}));}})[_0xa122('0x19')](function(_0x2aec56){return logger[_0xa122('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa122('0x6e'),util['inspect'](_0x2aec56,{'showHidden':![],'depth':null}));});}else{return logger[_0xa122('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa122('0x6e'),_0xa122('0x73'));}break;}}})[_0xa122('0x74')](function(){_0x532830();});}else{_0x532830();}}},'charset':_0xa122('0x75'),'collate':_0xa122('0x76')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 31175f0..0342fa6 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 _0x1a0e=['code','message','catch','SmsMessage','create','body','options','CreateSmsMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0xeea8e9,_0x511a75){var _0x406ef0=function(_0x416c4d){while(--_0x416c4d){_0xeea8e9['push'](_0xeea8e9['shift']());}};_0x406ef0(++_0x511a75);}(_0x1a0e,0x1b5));var _0xe1a0=function(_0x2e78db,_0x5ab8a1){_0x2e78db=_0x2e78db-0x0;var _0x195fb4=_0x1a0e[_0x2e78db];return _0x195fb4;};'use strict';var _=require(_0xe1a0('0x0'));var util=require(_0xe1a0('0x1'));var moment=require(_0xe1a0('0x2'));var BPromise=require(_0xe1a0('0x3'));var rs=require(_0xe1a0('0x4'));var fs=require('fs');var Redis=require(_0xe1a0('0x5'));var db=require(_0xe1a0('0x6'))['db'];var utils=require(_0xe1a0('0x7'));var logger=require('../../config/logger')(_0xe1a0('0x8'));var config=require(_0xe1a0('0x9'));var jayson=require(_0xe1a0('0xa'));var client=jayson[_0xe1a0('0xb')][_0xe1a0('0xc')]({'port':0x232a});config[_0xe1a0('0xd')]=_[_0xe1a0('0xe')](config[_0xe1a0('0xd')],{'host':_0xe1a0('0xf'),'port':0x18eb});var socket=require(_0xe1a0('0x10'))(new Redis(config[_0xe1a0('0xd')]));require('./smsMessage.socket')[_0xe1a0('0x11')](socket);function respondWithRpcPromise(_0xe110f6,_0x1e76db,_0x59b643){return new BPromise(function(_0x3bff72,_0x127db6){return client[_0xe1a0('0x12')](_0xe110f6,_0x59b643)['then'](function(_0x34d4bb){logger[_0xe1a0('0x13')](_0xe1a0('0x14'),_0x1e76db,_0xe1a0('0x15'));logger[_0xe1a0('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1e76db,_0xe1a0('0x15'),JSON[_0xe1a0('0x17')](_0x34d4bb));if(_0x34d4bb[_0xe1a0('0x18')]){if(_0x34d4bb[_0xe1a0('0x18')][_0xe1a0('0x19')]===0x1f4){logger['error'](_0xe1a0('0x14'),_0x1e76db,_0x34d4bb['error'][_0xe1a0('0x1a')]);return _0x127db6(_0x34d4bb[_0xe1a0('0x18')][_0xe1a0('0x1a')]);}logger[_0xe1a0('0x18')](_0xe1a0('0x14'),_0x1e76db,_0x34d4bb['error']['message']);return _0x3bff72(_0x34d4bb[_0xe1a0('0x18')]['message']);}else{logger['info'](_0xe1a0('0x14'),_0x1e76db,_0xe1a0('0x15'));_0x3bff72(_0x34d4bb['result'][_0xe1a0('0x1a')]);}})[_0xe1a0('0x1b')](function(_0x1fea2b){logger['error']('SmsMessage,\x20%s,\x20%s',_0x1e76db,_0x1fea2b);_0x127db6(_0x1fea2b);});});}exports['CreateSmsMessage']=function(_0x405e19){var _0x1d0150=this;return new Promise(function(_0x523d73,_0x457bb0){return db[_0xe1a0('0x1c')][_0xe1a0('0x1d')](_0x405e19[_0xe1a0('0x1e')],{'raw':_0x405e19[_0xe1a0('0x1f')]?_0x405e19[_0xe1a0('0x1f')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3d8e67){logger['info'](_0xe1a0('0x20'),_0x405e19);logger[_0xe1a0('0x16')](_0xe1a0('0x20'),_0x405e19,JSON[_0xe1a0('0x17')](_0x3d8e67));_0x523d73(_0x3d8e67);})[_0xe1a0('0x1b')](function(_0x54630b){logger['error'](_0xe1a0('0x20'),_0x54630b[_0xe1a0('0x1a')],_0x405e19);_0x457bb0(_0x1d0150['error'](0x1f4,_0x54630b[_0xe1a0('0x1a')]));});});}; \ No newline at end of file +var _0x3088=['raw','CreateSmsMessage','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','SmsMessage,\x20%s,\x20%s','catch','SmsMessage','body','options'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x3088,0x1c2));var _0x8308=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0x3088[_0x48d6a3];return _0x38bfa0;};'use strict';var _=require(_0x8308('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8308('0x1'));var fs=require('fs');var Redis=require(_0x8308('0x2'));var db=require(_0x8308('0x3'))['db'];var utils=require(_0x8308('0x4'));var logger=require(_0x8308('0x5'))(_0x8308('0x6'));var config=require(_0x8308('0x7'));var jayson=require(_0x8308('0x8'));var client=jayson['client'][_0x8308('0x9')]({'port':0x232a});config[_0x8308('0xa')]=_[_0x8308('0xb')](config[_0x8308('0xa')],{'host':_0x8308('0xc'),'port':0x18eb});var socket=require(_0x8308('0xd'))(new Redis(config['redis']));require('./smsMessage.socket')[_0x8308('0xe')](socket);function respondWithRpcPromise(_0xddf568,_0x523f45,_0x34029c){return new BPromise(function(_0x35276b,_0x419d44){return client[_0x8308('0xf')](_0xddf568,_0x34029c)[_0x8308('0x10')](function(_0x301c0d){logger[_0x8308('0x11')]('SmsMessage,\x20%s,\x20%s',_0x523f45,_0x8308('0x12'));logger[_0x8308('0x13')](_0x8308('0x14'),_0x523f45,_0x8308('0x12'),JSON[_0x8308('0x15')](_0x301c0d));if(_0x301c0d['error']){if(_0x301c0d['error'][_0x8308('0x16')]===0x1f4){logger[_0x8308('0x17')]('SmsMessage,\x20%s,\x20%s',_0x523f45,_0x301c0d[_0x8308('0x17')]['message']);return _0x419d44(_0x301c0d['error'][_0x8308('0x18')]);}logger[_0x8308('0x17')](_0x8308('0x19'),_0x523f45,_0x301c0d['error'][_0x8308('0x18')]);return _0x35276b(_0x301c0d[_0x8308('0x17')][_0x8308('0x18')]);}else{logger[_0x8308('0x11')](_0x8308('0x19'),_0x523f45,_0x8308('0x12'));_0x35276b(_0x301c0d['result'][_0x8308('0x18')]);}})[_0x8308('0x1a')](function(_0x3fd46d){logger[_0x8308('0x17')](_0x8308('0x19'),_0x523f45,_0x3fd46d);_0x419d44(_0x3fd46d);});});}exports['CreateSmsMessage']=function(_0x266d53){var _0x349f69=this;return new Promise(function(_0x585a93,_0x1449ff){return db[_0x8308('0x1b')]['create'](_0x266d53[_0x8308('0x1c')],{'raw':_0x266d53[_0x8308('0x1d')]?_0x266d53['options'][_0x8308('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x4410b9){logger['info'](_0x8308('0x1f'),_0x266d53);logger[_0x8308('0x13')]('CreateSmsMessage',_0x266d53,JSON['stringify'](_0x4410b9));_0x585a93(_0x4410b9);})['catch'](function(_0xf9300d){logger['error'](_0x8308('0x1f'),_0xf9300d['message'],_0x266d53);_0x1449ff(_0x349f69[_0x8308('0x17')](0x1f4,_0xf9300d[_0x8308('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index a1575cd..b7f1f0b 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 _0xe999=['length','smsMessage:','save','update','emit','removeListener','register'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xe999,0x136));var _0x9e99=function(_0xb70c5b,_0x19e6b3){_0xb70c5b=_0xb70c5b-0x0;var _0x9927c3=_0xe999[_0xb70c5b];return _0x9927c3;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x9e99('0x0'),'remove',_0x9e99('0x1')];function createListener(_0x13cb76,_0x7cb67f){return function(_0x550364){_0x7cb67f[_0x9e99('0x2')](_0x13cb76,_0x550364);};}function removeListener(_0x2bacb2,_0x693a74){return function(){SmsMessageEvents[_0x9e99('0x3')](_0x2bacb2,_0x693a74);};}exports[_0x9e99('0x4')]=function(_0x483e6b){for(var _0x1ec968=0x0,_0x33bc75=events[_0x9e99('0x5')];_0x1ec968<_0x33bc75;_0x1ec968++){var _0x682803=events[_0x1ec968];var _0x4a89c5=createListener(_0x9e99('0x6')+_0x682803,_0x483e6b);SmsMessageEvents['on'](_0x682803,_0x4a89c5);}}; \ No newline at end of file +var _0x082d=['remove','emit','removeListener','register','length','save'];(function(_0x14ad92,_0x3b4315){var _0x41ceae=function(_0x252cd1){while(--_0x252cd1){_0x14ad92['push'](_0x14ad92['shift']());}};_0x41ceae(++_0x3b4315);}(_0x082d,0x89));var _0xd082=function(_0x9cfe28,_0x1a335c){_0x9cfe28=_0x9cfe28-0x0;var _0x54a1d0=_0x082d[_0x9cfe28];return _0x54a1d0;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xd082('0x0'),_0xd082('0x1'),'update'];function createListener(_0x11493e,_0x5c0cd1){return function(_0x1dffaf){_0x5c0cd1[_0xd082('0x2')](_0x11493e,_0x1dffaf);};}function removeListener(_0x5e1405,_0x19e673){return function(){SmsMessageEvents[_0xd082('0x3')](_0x5e1405,_0x19e673);};}exports[_0xd082('0x4')]=function(_0x45c79d){for(var _0x207743=0x0,_0xf87570=events[_0xd082('0x5')];_0x207743<_0xf87570;_0x207743++){var _0x254be5=events[_0x207743];var _0x58d3b1=createListener('smsMessage:'+_0x254be5,_0x45c79d);SmsMessageEvents['on'](_0x254be5,_0x58d3b1);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 68a08f7..12e0407 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 _0xffa9=['show','/:id/members','getTeams','getAgents','post','/:id/teams','addTeams','/:id/users','addAgents','update','delete','destroy','removeAgents','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x3e630f,_0x1d4b4d){var _0x9ebd58=function(_0x533c88){while(--_0x533c88){_0x3e630f['push'](_0x3e630f['shift']());}};_0x9ebd58(++_0x1d4b4d);}(_0xffa9,0x16c));var _0x9ffa=function(_0x1aac60,_0x2e5ce5){_0x1aac60=_0x1aac60-0x0;var _0x186adf=_0xffa9[_0x1aac60];return _0x186adf;};'use strict';var multer=require('multer');var util=require(_0x9ffa('0x0'));var path=require(_0x9ffa('0x1'));var timeout=require(_0x9ffa('0x2'));var express=require(_0x9ffa('0x3'));var router=express['Router']();var fs_extra=require(_0x9ffa('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9ffa('0x5'));var config=require(_0x9ffa('0x6'));var controller=require('./smsQueue.controller');router[_0x9ffa('0x7')]('/',auth[_0x9ffa('0x8')](),controller[_0x9ffa('0x9')]);router[_0x9ffa('0x7')]('/describe',auth[_0x9ffa('0x8')](),controller['describe']);router['get'](_0x9ffa('0xa'),auth[_0x9ffa('0x8')](),controller[_0x9ffa('0xb')]);router['get'](_0x9ffa('0xc'),auth[_0x9ffa('0x8')](),controller['getMembers']);router[_0x9ffa('0x7')]('/:id/teams',auth[_0x9ffa('0x8')](),controller[_0x9ffa('0xd')]);router[_0x9ffa('0x7')]('/:id/users',auth[_0x9ffa('0x8')](),controller[_0x9ffa('0xe')]);router[_0x9ffa('0xf')]('/',auth[_0x9ffa('0x8')](),controller['create']);router[_0x9ffa('0xf')](_0x9ffa('0x10'),auth[_0x9ffa('0x8')](),controller[_0x9ffa('0x11')]);router[_0x9ffa('0xf')](_0x9ffa('0x12'),auth[_0x9ffa('0x8')](),controller[_0x9ffa('0x13')]);router['put'](_0x9ffa('0xa'),auth[_0x9ffa('0x8')](),controller[_0x9ffa('0x14')]);router[_0x9ffa('0x15')](_0x9ffa('0xa'),auth[_0x9ffa('0x8')](),controller[_0x9ffa('0x16')]);router[_0x9ffa('0x15')](_0x9ffa('0x10'),auth[_0x9ffa('0x8')](),controller['removeTeams']);router[_0x9ffa('0x15')](_0x9ffa('0x12'),auth[_0x9ffa('0x8')](),controller[_0x9ffa('0x17')]);module[_0x9ffa('0x18')]=router; \ No newline at end of file +var _0x58c8=['describe','/:id','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','destroy','delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','../../config/environment','./smsQueue.controller','get','isAuthenticated','index'];(function(_0x52e7a6,_0xbb9812){var _0x25b2e6=function(_0x56fec3){while(--_0x56fec3){_0x52e7a6['push'](_0x52e7a6['shift']());}};_0x25b2e6(++_0xbb9812);}(_0x58c8,0xc6));var _0x858c=function(_0x13d8f9,_0x1ec2aa){_0x13d8f9=_0x13d8f9-0x0;var _0x58055d=_0x58c8[_0x13d8f9];return _0x58055d;};'use strict';var multer=require(_0x858c('0x0'));var util=require(_0x858c('0x1'));var path=require('path');var timeout=require(_0x858c('0x2'));var express=require(_0x858c('0x3'));var router=express[_0x858c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x858c('0x5'));var controller=require(_0x858c('0x6'));router[_0x858c('0x7')]('/',auth[_0x858c('0x8')](),controller[_0x858c('0x9')]);router['get']('/describe',auth[_0x858c('0x8')](),controller[_0x858c('0xa')]);router[_0x858c('0x7')](_0x858c('0xb'),auth[_0x858c('0x8')](),controller['show']);router[_0x858c('0x7')]('/:id/members',auth[_0x858c('0x8')](),controller[_0x858c('0xc')]);router[_0x858c('0x7')](_0x858c('0xd'),auth[_0x858c('0x8')](),controller[_0x858c('0xe')]);router[_0x858c('0x7')](_0x858c('0xf'),auth['isAuthenticated'](),controller[_0x858c('0x10')]);router[_0x858c('0x11')]('/',auth[_0x858c('0x8')](),controller[_0x858c('0x12')]);router['post'](_0x858c('0xd'),auth[_0x858c('0x8')](),controller[_0x858c('0x13')]);router[_0x858c('0x11')](_0x858c('0xf'),auth[_0x858c('0x8')](),controller[_0x858c('0x14')]);router['put'](_0x858c('0xb'),auth[_0x858c('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x858c('0x15')]);router[_0x858c('0x16')](_0x858c('0xd'),auth['isAuthenticated'](),controller[_0x858c('0x17')]);router[_0x858c('0x16')](_0x858c('0xf'),auth['isAuthenticated'](),controller[_0x858c('0x18')]);module[_0x858c('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 f621f53..918a593 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 _0x2a97=['name','INTEGER','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x3ce0a7,_0x4bf1af){var _0x3d359a=function(_0x5dc909){while(--_0x5dc909){_0x3ce0a7['push'](_0x3ce0a7['shift']());}};_0x3d359a(++_0x4bf1af);}(_0x2a97,0x146));var _0x72a9=function(_0x2a69b2,_0xd13d12){_0x2a69b2=_0x2a69b2-0x0;var _0x2cde72=_0x2a97[_0x2a69b2];return _0x2cde72;};'use strict';var Sequelize=require(_0x72a9('0x0'));module[_0x72a9('0x1')]={'name':{'type':Sequelize[_0x72a9('0x2')],'unique':_0x72a9('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x72a9('0x2')]},'timeout':{'type':Sequelize[_0x72a9('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x72a9('0x5'),_0x72a9('0x6'))}}; \ No newline at end of file +var _0x2fa9=['STRING','INTEGER','rrmemory','beepall','roundrobin','exports'];(function(_0x31c649,_0x10624b){var _0x53c049=function(_0x42f45e){while(--_0x42f45e){_0x31c649['push'](_0x31c649['shift']());}};_0x53c049(++_0x10624b);}(_0x2fa9,0x19d));var _0x92fa=function(_0x3495f6,_0x9742fd){_0x3495f6=_0x3495f6-0x0;var _0x56aa77=_0x2fa9[_0x3495f6];return _0x56aa77;};'use strict';var Sequelize=require('sequelize');module[_0x92fa('0x0')]={'name':{'type':Sequelize[_0x92fa('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x92fa('0x1')]},'timeout':{'type':Sequelize[_0x92fa('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x92fa('0x3'),_0x92fa('0x4'),_0x92fa('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 65eff45..82365d6 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 _0xeda7=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','json','undefined','count','offset','limit','apply','reject','save','then','destroy','get','SmsQueues','UserProfileResource','end','error','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','filter','merge','options','includeAll','include','SmsQueue','findAll','rows','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','nolimit','order','pick','SmsQueueId','User','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','Team','getTeams','Agents','online','interface','flatMap','sequelize','transaction','addTeams','findOrCreate','forEach','ids','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','SmsQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','removeTeams','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','userSmsQueue:save','isArray','emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse'];(function(_0x5d55a4,_0x557084){var _0x579597=function(_0x518ec6){while(--_0x518ec6){_0x5d55a4['push'](_0x5d55a4['shift']());}};_0x579597(++_0x557084);}(_0xeda7,0x196));var _0x7eda=function(_0x209fcd,_0x1ecccc){_0x209fcd=_0x209fcd-0x0;var _0x501d5e=_0xeda7[_0x209fcd];return _0x501d5e;};'use strict';var emlformat=require(_0x7eda('0x0'));var rimraf=require(_0x7eda('0x1'));var zipdir=require(_0x7eda('0x2'));var jsonpatch=require(_0x7eda('0x3'));var rp=require(_0x7eda('0x4'));var moment=require(_0x7eda('0x5'));var BPromise=require(_0x7eda('0x6'));var Mustache=require(_0x7eda('0x7'));var util=require(_0x7eda('0x8'));var path=require(_0x7eda('0x9'));var sox=require(_0x7eda('0xa'));var csv=require(_0x7eda('0xb'));var ejs=require(_0x7eda('0xc'));var fs=require('fs');var fs_extra=require(_0x7eda('0xd'));var _=require(_0x7eda('0xe'));var squel=require(_0x7eda('0xf'));var crypto=require(_0x7eda('0x10'));var jsforce=require(_0x7eda('0x11'));var deskjs=require(_0x7eda('0x12'));var toCsv=require(_0x7eda('0xb'));var querystring=require('querystring');var Papa=require(_0x7eda('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7eda('0x14'));var as=require(_0x7eda('0x15'));var hardwareService=require(_0x7eda('0x16'));var logger=require(_0x7eda('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x7eda('0x18'));var licenseUtil=require(_0x7eda('0x19'));var db=require(_0x7eda('0x1a'))['db'];config[_0x7eda('0x1b')]=_['defaults'](config[_0x7eda('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x7eda('0x1c'))(new Redis(config[_0x7eda('0x1b')]));require(_0x7eda('0x1d'))[_0x7eda('0x1e')](socket);function respondWithStatusCode(_0x3de1be,_0x192ab2){_0x192ab2=_0x192ab2||0xcc;return function(_0x951dfa){if(_0x951dfa){return _0x3de1be[_0x7eda('0x1f')](_0x192ab2);}return _0x3de1be[_0x7eda('0x20')](_0x192ab2)['end']();};}function respondWithResult(_0x4d13db,_0x106f26){_0x106f26=_0x106f26||0xc8;return function(_0x5331a5){if(_0x5331a5){return _0x4d13db['status'](_0x106f26)[_0x7eda('0x21')](_0x5331a5);}};}function respondWithFilteredResult(_0x44c83e,_0x97792c){return function(_0x8a1a07){if(_0x8a1a07){var _0x586344=typeof _0x97792c['offset']==='undefined'&&typeof _0x97792c['limit']===_0x7eda('0x22');var _0x558ecb=_0x8a1a07[_0x7eda('0x23')];var _0x1e0bcd=_0x586344?0x0:_0x97792c[_0x7eda('0x24')];var _0x3e7786=_0x586344?_0x8a1a07['count']:_0x97792c[_0x7eda('0x24')]+_0x97792c[_0x7eda('0x25')];var _0x3d73ce;if(_0x3e7786>=_0x558ecb){_0x3e7786=_0x558ecb;_0x3d73ce=0xc8;}else{_0x3d73ce=0xce;}_0x44c83e[_0x7eda('0x20')](_0x3d73ce);return _0x44c83e['set']('Content-Range',_0x1e0bcd+'-'+_0x3e7786+'/'+_0x558ecb)[_0x7eda('0x21')](_0x8a1a07);}return null;};}function patchUpdates(_0x58c409){return function(_0x3a1ef8){try{jsonpatch[_0x7eda('0x26')](_0x3a1ef8,_0x58c409,!![]);}catch(_0x557fec){return BPromise[_0x7eda('0x27')](_0x557fec);}return _0x3a1ef8[_0x7eda('0x28')]();};}function saveUpdates(_0x1c064d,_0x331b5f){return function(_0x40dc99){if(_0x40dc99){return _0x40dc99['update'](_0x1c064d)[_0x7eda('0x29')](function(_0x2ca61d){return _0x2ca61d;});}return null;};}function removeEntity(_0x1a4950,_0x5ae8ff){return function(_0x30fc8e){if(_0x30fc8e){return _0x30fc8e[_0x7eda('0x2a')]()[_0x7eda('0x29')](function(){var _0x76f1b2=_0x30fc8e[_0x7eda('0x2b')]({'plain':!![]});var _0x41ca40=_0x7eda('0x2c');return db[_0x7eda('0x2d')][_0x7eda('0x2a')]({'where':{'type':_0x41ca40,'resourceId':_0x76f1b2['id']}})[_0x7eda('0x29')](function(){return _0x30fc8e;});})['then'](function(){_0x1a4950[_0x7eda('0x20')](0xcc)[_0x7eda('0x2e')]();});}};}function handleEntityNotFound(_0x300e20,_0x2c5af0){return function(_0x5661fe){if(!_0x5661fe){_0x300e20[_0x7eda('0x1f')](0x194);}return _0x5661fe;};}function handleError(_0xb0b2bd,_0x5e1957){_0x5e1957=_0x5e1957||0x1f4;return function(_0x1bef90){logger[_0x7eda('0x2f')](_0x1bef90['stack']);if(_0x1bef90[_0x7eda('0x30')]){delete _0x1bef90[_0x7eda('0x30')];}_0xb0b2bd[_0x7eda('0x20')](_0x5e1957)[_0x7eda('0x31')](_0x1bef90);};}exports[_0x7eda('0x32')]=function(_0x6a95e7,_0x17bdc1){var _0x234200={},_0xac4dc7={},_0x42fb31={'count':0x0,'rows':[]};var _0x516b44=_[_0x7eda('0x33')](db['SmsQueue'][_0x7eda('0x34')],function(_0xce5037){return{'name':_0xce5037[_0x7eda('0x35')],'type':_0xce5037[_0x7eda('0x36')]['key']};});_0xac4dc7[_0x7eda('0x37')]=_[_0x7eda('0x33')](_0x516b44,_0x7eda('0x30'));_0xac4dc7['query']=_[_0x7eda('0x38')](_0x6a95e7[_0x7eda('0x39')]);_0xac4dc7[_0x7eda('0x3a')]=_['intersection'](_0xac4dc7[_0x7eda('0x37')],_0xac4dc7[_0x7eda('0x39')]);_0x234200[_0x7eda('0x3b')]=_[_0x7eda('0x3c')](_0xac4dc7['model'],qs[_0x7eda('0x3d')](_0x6a95e7[_0x7eda('0x39')]['fields']));_0x234200[_0x7eda('0x3b')]=_0x234200[_0x7eda('0x3b')][_0x7eda('0x3e')]?_0x234200[_0x7eda('0x3b')]:_0xac4dc7['model'];if(!_0x6a95e7[_0x7eda('0x39')][_0x7eda('0x3f')]('nolimit')){_0x234200['limit']=qs[_0x7eda('0x25')](_0x6a95e7[_0x7eda('0x39')]['limit']);_0x234200[_0x7eda('0x24')]=qs[_0x7eda('0x24')](_0x6a95e7[_0x7eda('0x39')][_0x7eda('0x24')]);}_0x234200['order']=qs['sort'](_0x6a95e7[_0x7eda('0x39')][_0x7eda('0x40')]);_0x234200[_0x7eda('0x41')]=qs[_0x7eda('0x3a')](_['pick'](_0x6a95e7[_0x7eda('0x39')],_0xac4dc7[_0x7eda('0x3a')]),_0x516b44);if(_0x6a95e7[_0x7eda('0x39')][_0x7eda('0x42')]){_0x234200[_0x7eda('0x41')]=_[_0x7eda('0x43')](_0x234200['where'],{'$or':_[_0x7eda('0x33')](_0x516b44,function(_0x234e10){if(_0x234e10[_0x7eda('0x36')]!=='VIRTUAL'){var _0x1b385b={};_0x1b385b[_0x234e10[_0x7eda('0x30')]]={'$like':'%'+_0x6a95e7[_0x7eda('0x39')][_0x7eda('0x42')]+'%'};return _0x1b385b;}})});}_0x234200=_[_0x7eda('0x43')]({},_0x234200,_0x6a95e7[_0x7eda('0x44')]);var _0x1cabea={'where':_0x234200['where']};return db['SmsQueue'][_0x7eda('0x23')](_0x1cabea)[_0x7eda('0x29')](function(_0x425a16){_0x42fb31[_0x7eda('0x23')]=_0x425a16;if(_0x6a95e7[_0x7eda('0x39')][_0x7eda('0x45')]){_0x234200[_0x7eda('0x46')]=[{'all':!![]}];}return db[_0x7eda('0x47')][_0x7eda('0x48')](_0x234200);})[_0x7eda('0x29')](function(_0x17251a){_0x42fb31[_0x7eda('0x49')]=_0x17251a;return _0x42fb31;})[_0x7eda('0x29')](respondWithFilteredResult(_0x17bdc1,_0x234200))[_0x7eda('0x4a')](handleError(_0x17bdc1,null));};exports['show']=function(_0x1347fa,_0x38ef5e){var _0x4257b5={'raw':!![],'where':{'id':_0x1347fa[_0x7eda('0x4b')]['id']}},_0x5b3093={};_0x5b3093['model']=_[_0x7eda('0x38')](db[_0x7eda('0x47')][_0x7eda('0x34')]);_0x5b3093[_0x7eda('0x39')]=_['keys'](_0x1347fa[_0x7eda('0x39')]);_0x5b3093[_0x7eda('0x3a')]=_['intersection'](_0x5b3093[_0x7eda('0x37')],_0x5b3093['query']);_0x4257b5[_0x7eda('0x3b')]=_[_0x7eda('0x3c')](_0x5b3093[_0x7eda('0x37')],qs[_0x7eda('0x3d')](_0x1347fa['query']['fields']));_0x4257b5[_0x7eda('0x3b')]=_0x4257b5[_0x7eda('0x3b')][_0x7eda('0x3e')]?_0x4257b5[_0x7eda('0x3b')]:_0x5b3093[_0x7eda('0x37')];if(_0x1347fa[_0x7eda('0x39')][_0x7eda('0x45')]){_0x4257b5[_0x7eda('0x46')]=[{'all':!![]}];}_0x4257b5=_[_0x7eda('0x43')]({},_0x4257b5,_0x1347fa[_0x7eda('0x44')]);return db[_0x7eda('0x47')]['find'](_0x4257b5)[_0x7eda('0x29')](handleEntityNotFound(_0x38ef5e,null))[_0x7eda('0x29')](respondWithResult(_0x38ef5e,null))[_0x7eda('0x4a')](handleError(_0x38ef5e,null));};exports[_0x7eda('0x4c')]=function(_0x43ed16,_0x45ee89){return db['SmsQueue'][_0x7eda('0x4c')](_0x43ed16[_0x7eda('0x4d')],{})['then'](function(_0x47530d){var _0x4238e4=_0x43ed16[_0x7eda('0x4e')]['get']({'plain':!![]});if(!_0x4238e4)throw new Error(_0x7eda('0x4f'));if(_0x4238e4['role']===_0x7eda('0x4e')){var _0x479915=_0x47530d[_0x7eda('0x2b')]({'plain':!![]});var _0x1b4ac5='SmsQueues';return db[_0x7eda('0x50')][_0x7eda('0x51')]({'where':{'name':_0x1b4ac5,'userProfileId':_0x4238e4['userProfileId']},'raw':!![]})[_0x7eda('0x29')](function(_0x1211a5){if(_0x1211a5&&_0x1211a5[_0x7eda('0x52')]===0x0){return db[_0x7eda('0x2d')][_0x7eda('0x4c')]({'name':_0x479915[_0x7eda('0x30')],'resourceId':_0x479915['id'],'type':_0x1211a5[_0x7eda('0x30')],'sectionId':_0x1211a5['id']},{})[_0x7eda('0x29')](function(){return _0x47530d;});}else{return _0x47530d;}})[_0x7eda('0x4a')](function(_0x35a8e2){logger[_0x7eda('0x2f')](_0x7eda('0x53'),_0x35a8e2);throw _0x35a8e2;});}return _0x47530d;})['then'](respondWithResult(_0x45ee89,0xc9))[_0x7eda('0x4a')](handleError(_0x45ee89,null));};exports['update']=function(_0x4f7d8f,_0x418a77){if(_0x4f7d8f[_0x7eda('0x4d')]['id']){delete _0x4f7d8f[_0x7eda('0x4d')]['id'];}return db[_0x7eda('0x47')]['find']({'where':{'id':_0x4f7d8f[_0x7eda('0x4b')]['id']}})[_0x7eda('0x29')](handleEntityNotFound(_0x418a77,null))[_0x7eda('0x29')](saveUpdates(_0x4f7d8f[_0x7eda('0x4d')],null))[_0x7eda('0x29')](respondWithResult(_0x418a77,null))['catch'](handleError(_0x418a77,null));};exports[_0x7eda('0x2a')]=function(_0x1c3673,_0x1caf3f){return db[_0x7eda('0x47')][_0x7eda('0x51')]({'where':{'id':_0x1c3673[_0x7eda('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1caf3f,null))[_0x7eda('0x29')](removeEntity(_0x1caf3f,null))[_0x7eda('0x4a')](handleError(_0x1caf3f,null));};exports[_0x7eda('0x54')]=function(_0x1db30a,_0x2d2da8){return db[_0x7eda('0x47')][_0x7eda('0x54')]()['then'](respondWithResult(_0x2d2da8,null))[_0x7eda('0x4a')](handleError(_0x2d2da8,null));};exports[_0x7eda('0x55')]=function(_0x1b1841,_0x2509f7,_0x2f00e9){var _0x1aea6f={'raw':!![],'where':{}},_0x226bf4={},_0x435cf1;return db[_0x7eda('0x47')][_0x7eda('0x56')]({'where':{'id':_0x1b1841[_0x7eda('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2509f7,null))['then'](function(_0x572639){if(_0x572639){_0x435cf1=_0x572639[_0x7eda('0x2b')]({'plain':!![]});_0x226bf4[_0x7eda('0x37')]=_[_0x7eda('0x38')](db[_0x7eda('0x57')][_0x7eda('0x34')]);_0x226bf4[_0x7eda('0x39')]=_['keys'](_0x1b1841[_0x7eda('0x39')]);_0x226bf4[_0x7eda('0x3a')]=_['intersection'](_0x226bf4['model'],_0x226bf4[_0x7eda('0x39')]);_0x1aea6f[_0x7eda('0x3b')]=_['intersection'](_0x226bf4['model'],qs[_0x7eda('0x3d')](_0x1b1841[_0x7eda('0x39')]['fields']));_0x1aea6f[_0x7eda('0x3b')]=_0x1aea6f[_0x7eda('0x3b')][_0x7eda('0x3e')]?_0x1aea6f['attributes']:_0x226bf4[_0x7eda('0x37')];if(!_0x1b1841[_0x7eda('0x39')][_0x7eda('0x3f')](_0x7eda('0x58'))){_0x1aea6f[_0x7eda('0x25')]=qs[_0x7eda('0x25')](_0x1b1841[_0x7eda('0x39')][_0x7eda('0x25')]);_0x1aea6f[_0x7eda('0x24')]=qs['offset'](_0x1b1841[_0x7eda('0x39')][_0x7eda('0x24')]);}_0x1aea6f[_0x7eda('0x59')]=qs[_0x7eda('0x40')](_0x1b1841[_0x7eda('0x39')]['sort']);_0x1aea6f[_0x7eda('0x41')]=qs[_0x7eda('0x3a')](_[_0x7eda('0x5a')](_0x1b1841[_0x7eda('0x39')],_0x226bf4[_0x7eda('0x3a')]));_0x1aea6f['where'][_0x7eda('0x5b')]=_0x572639['id'];if(_0x1b1841['query']['filter']){_0x1aea6f[_0x7eda('0x41')]=_['merge'](_0x1aea6f[_0x7eda('0x41')],{'$or':_[_0x7eda('0x33')](_0x1aea6f[_0x7eda('0x3b')],function(_0x14afa9){var _0xaa63a4={};_0xaa63a4[_0x14afa9]={'$like':'%'+_0x1b1841[_0x7eda('0x39')]['filter']+'%'};return _0xaa63a4;})});}_0x1aea6f=_[_0x7eda('0x43')]({},_0x1aea6f,_0x1b1841[_0x7eda('0x44')]);return db[_0x7eda('0x57')]['findAll'](_0x1aea6f);}})['then'](function(_0x4236d8){if(_0x4236d8){return db[_0x7eda('0x5c')]['findAndCountAll']({'where':{'id':_[_0x7eda('0x33')](_0x4236d8,_0x7eda('0x5d')),'role':_0x7eda('0x5e')},'attributes':['id',_0x7eda('0x30'),_0x7eda('0x5f'),_0x7eda('0x60'),_0x7eda('0x61')]});}})[_0x7eda('0x29')](function(_0x408851){if(_0x408851){return{'count':_0x408851[_0x7eda('0x23')],'rows':_['map'](_0x408851['rows'],function(_0x3c44e6){return{'membername':_0x3c44e6[_0x7eda('0x30')],'UserId':_0x3c44e6['id'],'queue_name':_0x435cf1['name'],'SmsQueueId':_0x435cf1['id'],'interface':util['format'](_0x7eda('0x62'),_0x7eda('0x63'),_0x3c44e6['name']),'penalty':0x0,'paused':_0x3c44e6['smsPause'],'createdAt':_0x3c44e6[_0x7eda('0x61')],'updatedAt':_0x3c44e6[_0x7eda('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2509f7,_0x1aea6f))['catch'](handleError(_0x2509f7,null));};exports['getTeams']=function(_0x10070b,_0x24b974,_0x4716c9){var _0x3c8a6f={};var _0x12aa80={};var _0x3bf5e4;var _0x3f3b7c;return db[_0x7eda('0x47')][_0x7eda('0x56')]({'where':{'id':_0x10070b[_0x7eda('0x4b')]['id']}})[_0x7eda('0x29')](handleEntityNotFound(_0x24b974,null))[_0x7eda('0x29')](function(_0x388d19){if(_0x388d19){_0x3bf5e4=_0x388d19;_0x12aa80['model']=_[_0x7eda('0x38')](db[_0x7eda('0x64')][_0x7eda('0x34')]);_0x12aa80['query']=_[_0x7eda('0x38')](_0x10070b[_0x7eda('0x39')]);_0x12aa80[_0x7eda('0x3a')]=_[_0x7eda('0x3c')](_0x12aa80[_0x7eda('0x37')],_0x12aa80[_0x7eda('0x39')]);_0x3c8a6f['attributes']=_[_0x7eda('0x3c')](_0x12aa80[_0x7eda('0x37')],qs['fields'](_0x10070b[_0x7eda('0x39')][_0x7eda('0x3d')]));_0x3c8a6f[_0x7eda('0x3b')]=_0x3c8a6f[_0x7eda('0x3b')][_0x7eda('0x3e')]?_0x3c8a6f['attributes']:_0x12aa80[_0x7eda('0x37')];_0x3c8a6f[_0x7eda('0x59')]=qs[_0x7eda('0x40')](_0x10070b[_0x7eda('0x39')]['sort']);_0x3c8a6f['where']=qs['filters'](_[_0x7eda('0x5a')](_0x10070b['query'],_0x12aa80[_0x7eda('0x3a')]));if(_0x10070b['query'][_0x7eda('0x42')]){_0x3c8a6f['where']=_[_0x7eda('0x43')](_0x3c8a6f[_0x7eda('0x41')],{'$or':_[_0x7eda('0x33')](_0x3c8a6f[_0x7eda('0x3b')],function(_0x2bab0c){var _0x350213={};_0x350213[_0x2bab0c]={'$like':'%'+_0x10070b[_0x7eda('0x39')][_0x7eda('0x42')]+'%'};return _0x350213;})});}_0x3c8a6f=_[_0x7eda('0x43')]({},_0x3c8a6f,_0x10070b[_0x7eda('0x44')]);return _0x3bf5e4[_0x7eda('0x65')](_0x3c8a6f);}})['then'](function(_0x49e888){if(_0x49e888){_0x3f3b7c=_0x49e888[_0x7eda('0x3e')];if(!_0x10070b[_0x7eda('0x39')][_0x7eda('0x3f')](_0x7eda('0x58'))){_0x3c8a6f['limit']=qs[_0x7eda('0x25')](_0x10070b[_0x7eda('0x39')][_0x7eda('0x25')]);_0x3c8a6f[_0x7eda('0x24')]=qs['offset'](_0x10070b[_0x7eda('0x39')][_0x7eda('0x24')]);}return _0x3bf5e4['getTeams'](_0x3c8a6f);}})[_0x7eda('0x29')](function(_0x5cb329){if(_0x5cb329){return _0x5cb329?{'count':_0x3f3b7c,'rows':_0x5cb329}:null;}})[_0x7eda('0x29')](respondWithResult(_0x24b974,null))[_0x7eda('0x4a')](handleError(_0x24b974,null));};exports['addTeams']=function(_0x3c0be7,_0x52802a,_0x2c4780){var _0x514e7c=_0x3c0be7['body']['ids'];return db['Team'][_0x7eda('0x48')]({'where':{'id':_0x514e7c},'attributes':['id'],'include':[{'model':db[_0x7eda('0x5c')],'as':_0x7eda('0x66'),'attributes':['id',_0x7eda('0x30'),_0x7eda('0x67'),'voicePause',_0x7eda('0x68')],'raw':!![]}]})[_0x7eda('0x29')](function(_0x32efad){if(_0x32efad){var _0x2ef955=_[_0x7eda('0x69')](_0x32efad,function(_0x5ae719){var _0x5de51b=_0x5ae719[_0x7eda('0x2b')]({'plain':!![]});return _0x5de51b['Agents'];});return db['SmsQueue'][_0x7eda('0x51')]({'where':{'id':_0x3c0be7[_0x7eda('0x4b')]['id']}})[_0x7eda('0x29')](function(_0x33d4a4){return db[_0x7eda('0x6a')][_0x7eda('0x6b')](function(_0x3641fe){return _0x33d4a4[_0x7eda('0x6c')](_0x514e7c,{'transaction':_0x3641fe})['then'](function(){return BPromise['each'](_0x2ef955,function(_0x4b7e72){return db[_0x7eda('0x57')][_0x7eda('0x6d')]({'where':{'UserId':_0x4b7e72['id'],'SmsQueueId':_0x3c0be7[_0x7eda('0x4b')]['id']},'transaction':_0x3641fe});});})['then'](function(){_0x2ef955[_0x7eda('0x6e')](function(_0x4e44ec){socket['emit']('userSmsQueue:save',{'UserId':_0x4e44ec['id'],'SmsQueueId':_0x33d4a4['id']});});});});});}})[_0x7eda('0x29')](respondWithStatusCode(_0x52802a,null))['catch'](handleError(_0x52802a,null));};exports['removeTeams']=function(_0x3cb250,_0xa4e689,_0x4eed44){return db[_0x7eda('0x64')][_0x7eda('0x48')]({'where':{'id':_0x3cb250[_0x7eda('0x39')][_0x7eda('0x6f')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x7eda('0x29')](handleEntityNotFound(_0xa4e689,null))[_0x7eda('0x29')](function(_0x35e5dc){var _0x247528=_[_0x7eda('0x33')](_0x35e5dc,'id');var _0x253255=[];var _0x588c91=[];var _0x42de91=squel[_0x7eda('0x70')]();_0x42de91[_0x7eda('0x71')](_0x7eda('0x72'))[_0x7eda('0x73')](_0x7eda('0x74'),'tq')[_0x7eda('0x75')](_0x7eda('0x76'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7eda('0x41')](_0x7eda('0x77'),_0x3cb250[_0x7eda('0x4b')]['id']);for(var _0x55cf5d=0x0;_0x55cf5d<_0x35e5dc[_0x7eda('0x3e')];_0x55cf5d+=0x1){let _0x4dadb3=_0x35e5dc[_0x55cf5d];for(var _0x56d680=0x0;_0x56d680<_0x4dadb3[_0x7eda('0x66')][_0x7eda('0x3e')];_0x56d680+=0x1){let _0x2d7623=_0x4dadb3['Agents'][_0x56d680];var _0x365d67=_0x42de91[_0x7eda('0x78')]();_0x365d67[_0x7eda('0x41')]('ut.UserId\x20=\x20?',_0x2d7623['id']);_0x588c91[_0x7eda('0x79')](db[_0x7eda('0x6a')][_0x7eda('0x39')](_0x365d67[_0x7eda('0x7a')](),{'type':db[_0x7eda('0x6a')][_0x7eda('0x7b')][_0x7eda('0x7c')]})['then'](function(_0x1c5d95){if(_0x1c5d95['length']===0x1){return _0x2d7623['id'];}else{var _0x57173c=_[_0x7eda('0x7d')](_[_0x7eda('0x33')](_0x1c5d95,_0x7eda('0x7e')),function(_0x17b40b){return _[_0x7eda('0x7f')](_0x247528,_0x17b40b);});if(_0x57173c){return _0x2d7623['id'];}}}));}}return BPromise[_0x7eda('0x80')](_0x588c91)[_0x7eda('0x29')](function(_0x50d37d){_0x253255=_(_0x253255)[_0x7eda('0x81')](_0x50d37d)['compact']()[_0x7eda('0x82')]();return db[_0x7eda('0x47')][_0x7eda('0x51')]({'where':{'id':_0x3cb250[_0x7eda('0x4b')]['id']}})['then'](function(_0x2bf651){return db['sequelize'][_0x7eda('0x6b')](function(_0x10b4bb){return _0x2bf651[_0x7eda('0x83')](_0x3cb250[_0x7eda('0x39')]['ids'],{'transaction':_0x10b4bb})[_0x7eda('0x29')](function(){if(!_[_0x7eda('0x84')](_0x253255)){return _0x2bf651[_0x7eda('0x85')](_0x253255,{'transaction':_0x10b4bb});}})[_0x7eda('0x29')](function(){_0x253255[_0x7eda('0x6e')](function(_0xcb06a3){socket['emit'](_0x7eda('0x86'),{'UserId':_0xcb06a3,'SmsQueueId':_0x2bf651['id']});});});});});});})[_0x7eda('0x29')](respondWithStatusCode(_0xa4e689,null))[_0x7eda('0x4a')](handleError(_0xa4e689,null));};exports[_0x7eda('0x87')]=function(_0x1bcb98,_0x123f2e,_0x148460){return db[_0x7eda('0x47')][_0x7eda('0x51')]({'where':{'id':_0x1bcb98['params']['id']}})[_0x7eda('0x29')](handleEntityNotFound(_0x123f2e,null))[_0x7eda('0x29')](function(_0x3318a0){if(_0x3318a0){return _0x3318a0['addAgents'](_0x1bcb98['body'][_0x7eda('0x6f')],_[_0x7eda('0x88')](_0x1bcb98[_0x7eda('0x4d')],[_0x7eda('0x6f'),'id'])||{})[_0x7eda('0x89')](function(_0x299fa8){for(var _0x1c8f76=0x0;_0x1c8f76<_0x1bcb98[_0x7eda('0x4d')]['ids'][_0x7eda('0x3e')];_0x1c8f76+=0x1){socket['emit'](_0x7eda('0x8a'),{'UserId':Number(_0x1bcb98[_0x7eda('0x4d')]['ids'][_0x1c8f76]),'SmsQueueId':Number(_0x1bcb98['params']['id'])});}return _0x299fa8;});}})[_0x7eda('0x29')](respondWithResult(_0x123f2e,null))[_0x7eda('0x4a')](handleError(_0x123f2e,null));};exports[_0x7eda('0x85')]=function(_0x5b9831,_0x5b2dd0,_0x4dd4a3){return db[_0x7eda('0x47')][_0x7eda('0x51')]({'where':{'id':_0x5b9831[_0x7eda('0x4b')]['id']}})[_0x7eda('0x29')](handleEntityNotFound(_0x5b2dd0,null))[_0x7eda('0x29')](function(_0x14d69a){if(_0x14d69a){return _0x14d69a[_0x7eda('0x85')](_0x5b9831[_0x7eda('0x39')][_0x7eda('0x6f')])[_0x7eda('0x29')](function(){if(_[_0x7eda('0x8b')](_0x5b9831[_0x7eda('0x39')][_0x7eda('0x6f')])){for(var _0x24b79b=0x0;_0x24b79b<_0x5b9831[_0x7eda('0x39')][_0x7eda('0x6f')][_0x7eda('0x3e')];_0x24b79b+=0x1){socket['emit'](_0x7eda('0x86'),{'UserId':Number(_0x5b9831[_0x7eda('0x39')][_0x7eda('0x6f')][_0x24b79b]),'SmsQueueId':Number(_0x5b9831[_0x7eda('0x4b')]['id'])});}}else{socket[_0x7eda('0x8c')](_0x7eda('0x86'),{'UserId':Number(_0x5b9831[_0x7eda('0x39')][_0x7eda('0x6f')]),'SmsQueueId':Number(_0x5b9831[_0x7eda('0x4b')]['id'])});}});}})[_0x7eda('0x29')](respondWithStatusCode(_0x5b2dd0,null))[_0x7eda('0x4a')](handleError(_0x5b2dd0,null));};exports['getAgents']=function(_0x42a0a7,_0x117475,_0x2fb26a){var _0x52ddd7={};var _0x1b22d9={};var _0x35483e;var _0x428094;return db[_0x7eda('0x47')][_0x7eda('0x56')]({'where':{'id':_0x42a0a7[_0x7eda('0x4b')]['id']}})[_0x7eda('0x29')](handleEntityNotFound(_0x117475,null))[_0x7eda('0x29')](function(_0x42aec3){if(_0x42aec3){_0x35483e=_0x42aec3;_0x1b22d9[_0x7eda('0x37')]=_[_0x7eda('0x38')](db['User'][_0x7eda('0x34')]);_0x1b22d9[_0x7eda('0x39')]=_['keys'](_0x42a0a7[_0x7eda('0x39')]);_0x1b22d9[_0x7eda('0x3a')]=_[_0x7eda('0x3c')](_0x1b22d9[_0x7eda('0x37')],_0x1b22d9['query']);_0x52ddd7[_0x7eda('0x3b')]=_[_0x7eda('0x3c')](_0x1b22d9[_0x7eda('0x37')],qs['fields'](_0x42a0a7['query'][_0x7eda('0x3d')]));_0x52ddd7[_0x7eda('0x3b')]=_0x52ddd7[_0x7eda('0x3b')][_0x7eda('0x3e')]?_0x52ddd7[_0x7eda('0x3b')]:_0x1b22d9['model'];_0x52ddd7[_0x7eda('0x59')]=qs[_0x7eda('0x40')](_0x42a0a7[_0x7eda('0x39')][_0x7eda('0x40')]);_0x52ddd7['where']=qs[_0x7eda('0x3a')](_[_0x7eda('0x5a')](_0x42a0a7[_0x7eda('0x39')],_0x1b22d9[_0x7eda('0x3a')]));if(_0x42a0a7[_0x7eda('0x39')][_0x7eda('0x42')]){_0x52ddd7[_0x7eda('0x41')]=_[_0x7eda('0x43')](_0x52ddd7[_0x7eda('0x41')],{'$or':_['map'](_0x52ddd7['attributes'],function(_0x1950eb){var _0x155ca4={};_0x155ca4[_0x1950eb]={'$like':'%'+_0x42a0a7[_0x7eda('0x39')][_0x7eda('0x42')]+'%'};return _0x155ca4;})});}_0x52ddd7=_['merge']({},_0x52ddd7,_0x42a0a7[_0x7eda('0x44')]);return _0x35483e[_0x7eda('0x8d')](_0x52ddd7);}})[_0x7eda('0x29')](function(_0x309b7d){if(_0x309b7d){_0x428094=_0x309b7d[_0x7eda('0x3e')];if(!_0x42a0a7[_0x7eda('0x39')][_0x7eda('0x3f')]('nolimit')){_0x52ddd7[_0x7eda('0x25')]=qs[_0x7eda('0x25')](_0x42a0a7[_0x7eda('0x39')][_0x7eda('0x25')]);_0x52ddd7[_0x7eda('0x24')]=qs[_0x7eda('0x24')](_0x42a0a7['query'][_0x7eda('0x24')]);}return _0x35483e[_0x7eda('0x8d')](_0x52ddd7);}})[_0x7eda('0x29')](function(_0x5e106f){if(_0x5e106f){return _0x5e106f?{'count':_0x428094,'rows':_0x5e106f}:null;}})['then'](respondWithResult(_0x117475,null))[_0x7eda('0x4a')](handleError(_0x117475,null));}; \ No newline at end of file +var _0xc5e4=['moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsQueue.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','SmsQueues','UserProfileResource','error','stack','name','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','smsPause','getTeams','Team','addTeams','voicePause','interface','Agents','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','user_has_teams','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','ids','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','getAgents','rimraf','zip-dir','request-promise'];(function(_0x4a3589,_0x55edb7){var _0x38139d=function(_0x5ab255){while(--_0x5ab255){_0x4a3589['push'](_0x4a3589['shift']());}};_0x38139d(++_0x55edb7);}(_0xc5e4,0x117));var _0x4c5e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc5e4[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4c5e('0x0'));var zipdir=require(_0x4c5e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c5e('0x2'));var moment=require(_0x4c5e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4c5e('0x4'));var util=require(_0x4c5e('0x5'));var path=require(_0x4c5e('0x6'));var sox=require(_0x4c5e('0x7'));var csv=require(_0x4c5e('0x8'));var ejs=require(_0x4c5e('0x9'));var fs=require('fs');var fs_extra=require(_0x4c5e('0xa'));var _=require(_0x4c5e('0xb'));var squel=require('squel');var crypto=require(_0x4c5e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4c5e('0xd'));var toCsv=require(_0x4c5e('0x8'));var querystring=require(_0x4c5e('0xe'));var Papa=require(_0x4c5e('0xf'));var Redis=require(_0x4c5e('0x10'));var authService=require(_0x4c5e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4c5e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x4c5e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4c5e('0x14'));var db=require(_0x4c5e('0x15'))['db'];config[_0x4c5e('0x16')]=_['defaults'](config[_0x4c5e('0x16')],{'host':_0x4c5e('0x17'),'port':0x18eb});var socket=require(_0x4c5e('0x18'))(new Redis(config[_0x4c5e('0x16')]));require(_0x4c5e('0x19'))[_0x4c5e('0x1a')](socket);function respondWithStatusCode(_0x2c1504,_0x27d958){_0x27d958=_0x27d958||0xcc;return function(_0x58fddb){if(_0x58fddb){return _0x2c1504['sendStatus'](_0x27d958);}return _0x2c1504[_0x4c5e('0x1b')](_0x27d958)[_0x4c5e('0x1c')]();};}function respondWithResult(_0x39f45e,_0x1aa31d){_0x1aa31d=_0x1aa31d||0xc8;return function(_0x471836){if(_0x471836){return _0x39f45e[_0x4c5e('0x1b')](_0x1aa31d)[_0x4c5e('0x1d')](_0x471836);}};}function respondWithFilteredResult(_0x16343f,_0x42d120){return function(_0x25c4d6){if(_0x25c4d6){var _0x591c8c=typeof _0x42d120[_0x4c5e('0x1e')]===_0x4c5e('0x1f')&&typeof _0x42d120['limit']==='undefined';var _0x4a679d=_0x25c4d6[_0x4c5e('0x20')];var _0x405356=_0x591c8c?0x0:_0x42d120['offset'];var _0xf60755=_0x591c8c?_0x25c4d6['count']:_0x42d120[_0x4c5e('0x1e')]+_0x42d120[_0x4c5e('0x21')];var _0x6bf00c;if(_0xf60755>=_0x4a679d){_0xf60755=_0x4a679d;_0x6bf00c=0xc8;}else{_0x6bf00c=0xce;}_0x16343f[_0x4c5e('0x1b')](_0x6bf00c);return _0x16343f[_0x4c5e('0x22')](_0x4c5e('0x23'),_0x405356+'-'+_0xf60755+'/'+_0x4a679d)[_0x4c5e('0x1d')](_0x25c4d6);}return null;};}function patchUpdates(_0x4a0728){return function(_0x3ec01d){try{jsonpatch[_0x4c5e('0x24')](_0x3ec01d,_0x4a0728,!![]);}catch(_0x2293bb){return BPromise[_0x4c5e('0x25')](_0x2293bb);}return _0x3ec01d['save']();};}function saveUpdates(_0x5b3327,_0x48ca0d){return function(_0x52dec5){if(_0x52dec5){return _0x52dec5['update'](_0x5b3327)[_0x4c5e('0x26')](function(_0x2e9c75){return _0x2e9c75;});}return null;};}function removeEntity(_0x3712ca,_0x4cf766){return function(_0x13f33d){if(_0x13f33d){return _0x13f33d[_0x4c5e('0x27')]()[_0x4c5e('0x26')](function(){var _0x172346=_0x13f33d['get']({'plain':!![]});var _0xd424da=_0x4c5e('0x28');return db[_0x4c5e('0x29')][_0x4c5e('0x27')]({'where':{'type':_0xd424da,'resourceId':_0x172346['id']}})[_0x4c5e('0x26')](function(){return _0x13f33d;});})[_0x4c5e('0x26')](function(){_0x3712ca[_0x4c5e('0x1b')](0xcc)[_0x4c5e('0x1c')]();});}};}function handleEntityNotFound(_0x47a7ee,_0x39aa40){return function(_0x4de60b){if(!_0x4de60b){_0x47a7ee['sendStatus'](0x194);}return _0x4de60b;};}function handleError(_0x3d94c1,_0x377754){_0x377754=_0x377754||0x1f4;return function(_0x4a2dae){logger[_0x4c5e('0x2a')](_0x4a2dae[_0x4c5e('0x2b')]);if(_0x4a2dae[_0x4c5e('0x2c')]){delete _0x4a2dae[_0x4c5e('0x2c')];}_0x3d94c1[_0x4c5e('0x1b')](_0x377754)['send'](_0x4a2dae);};}exports['index']=function(_0x36aef4,_0x71f983){var _0x5529d4={},_0x1a4174={},_0x1cde7b={'count':0x0,'rows':[]};var _0x256cd5=_[_0x4c5e('0x2d')](db[_0x4c5e('0x2e')][_0x4c5e('0x2f')],function(_0x4b9719){return{'name':_0x4b9719[_0x4c5e('0x30')],'type':_0x4b9719[_0x4c5e('0x31')][_0x4c5e('0x32')]};});_0x1a4174[_0x4c5e('0x33')]=_[_0x4c5e('0x2d')](_0x256cd5,_0x4c5e('0x2c'));_0x1a4174[_0x4c5e('0x34')]=_['keys'](_0x36aef4[_0x4c5e('0x34')]);_0x1a4174[_0x4c5e('0x35')]=_[_0x4c5e('0x36')](_0x1a4174[_0x4c5e('0x33')],_0x1a4174[_0x4c5e('0x34')]);_0x5529d4[_0x4c5e('0x37')]=_[_0x4c5e('0x36')](_0x1a4174['model'],qs[_0x4c5e('0x38')](_0x36aef4[_0x4c5e('0x34')][_0x4c5e('0x38')]));_0x5529d4[_0x4c5e('0x37')]=_0x5529d4[_0x4c5e('0x37')][_0x4c5e('0x39')]?_0x5529d4[_0x4c5e('0x37')]:_0x1a4174[_0x4c5e('0x33')];if(!_0x36aef4['query'][_0x4c5e('0x3a')](_0x4c5e('0x3b'))){_0x5529d4[_0x4c5e('0x21')]=qs[_0x4c5e('0x21')](_0x36aef4[_0x4c5e('0x34')][_0x4c5e('0x21')]);_0x5529d4['offset']=qs[_0x4c5e('0x1e')](_0x36aef4[_0x4c5e('0x34')][_0x4c5e('0x1e')]);}_0x5529d4[_0x4c5e('0x3c')]=qs[_0x4c5e('0x3d')](_0x36aef4[_0x4c5e('0x34')][_0x4c5e('0x3d')]);_0x5529d4['where']=qs['filters'](_[_0x4c5e('0x3e')](_0x36aef4['query'],_0x1a4174['filters']),_0x256cd5);if(_0x36aef4[_0x4c5e('0x34')]['filter']){_0x5529d4[_0x4c5e('0x3f')]=_['merge'](_0x5529d4[_0x4c5e('0x3f')],{'$or':_[_0x4c5e('0x2d')](_0x256cd5,function(_0x1e56b8){if(_0x1e56b8[_0x4c5e('0x31')]!=='VIRTUAL'){var _0x55f230={};_0x55f230[_0x1e56b8['name']]={'$like':'%'+_0x36aef4['query'][_0x4c5e('0x40')]+'%'};return _0x55f230;}})});}_0x5529d4=_[_0x4c5e('0x41')]({},_0x5529d4,_0x36aef4[_0x4c5e('0x42')]);var _0x3ef5d6={'where':_0x5529d4[_0x4c5e('0x3f')]};return db['SmsQueue'][_0x4c5e('0x20')](_0x3ef5d6)[_0x4c5e('0x26')](function(_0x3a4723){_0x1cde7b[_0x4c5e('0x20')]=_0x3a4723;if(_0x36aef4['query'][_0x4c5e('0x43')]){_0x5529d4[_0x4c5e('0x44')]=[{'all':!![]}];}return db['SmsQueue'][_0x4c5e('0x45')](_0x5529d4);})['then'](function(_0x4da9de){_0x1cde7b[_0x4c5e('0x46')]=_0x4da9de;return _0x1cde7b;})[_0x4c5e('0x26')](respondWithFilteredResult(_0x71f983,_0x5529d4))[_0x4c5e('0x47')](handleError(_0x71f983,null));};exports[_0x4c5e('0x48')]=function(_0x102ff0,_0x54e68a){var _0x35c280={'raw':!![],'where':{'id':_0x102ff0[_0x4c5e('0x49')]['id']}},_0x1da26d={};_0x1da26d[_0x4c5e('0x33')]=_[_0x4c5e('0x4a')](db[_0x4c5e('0x2e')][_0x4c5e('0x2f')]);_0x1da26d[_0x4c5e('0x34')]=_['keys'](_0x102ff0[_0x4c5e('0x34')]);_0x1da26d[_0x4c5e('0x35')]=_['intersection'](_0x1da26d['model'],_0x1da26d['query']);_0x35c280['attributes']=_[_0x4c5e('0x36')](_0x1da26d[_0x4c5e('0x33')],qs[_0x4c5e('0x38')](_0x102ff0[_0x4c5e('0x34')]['fields']));_0x35c280[_0x4c5e('0x37')]=_0x35c280[_0x4c5e('0x37')][_0x4c5e('0x39')]?_0x35c280[_0x4c5e('0x37')]:_0x1da26d['model'];if(_0x102ff0[_0x4c5e('0x34')][_0x4c5e('0x43')]){_0x35c280['include']=[{'all':!![]}];}_0x35c280=_['merge']({},_0x35c280,_0x102ff0[_0x4c5e('0x42')]);return db[_0x4c5e('0x2e')][_0x4c5e('0x4b')](_0x35c280)['then'](handleEntityNotFound(_0x54e68a,null))[_0x4c5e('0x26')](respondWithResult(_0x54e68a,null))[_0x4c5e('0x47')](handleError(_0x54e68a,null));};exports[_0x4c5e('0x4c')]=function(_0x323c34,_0x48458a){return db['SmsQueue'][_0x4c5e('0x4c')](_0x323c34[_0x4c5e('0x4d')],{})[_0x4c5e('0x26')](function(_0xc0b36){var _0x2df29c=_0x323c34['user'][_0x4c5e('0x4e')]({'plain':!![]});if(!_0x2df29c)throw new Error(_0x4c5e('0x4f'));if(_0x2df29c[_0x4c5e('0x50')]===_0x4c5e('0x51')){var _0x496198=_0xc0b36[_0x4c5e('0x4e')]({'plain':!![]});var _0x4b4bda='SmsQueues';return db[_0x4c5e('0x52')][_0x4c5e('0x4b')]({'where':{'name':_0x4b4bda,'userProfileId':_0x2df29c[_0x4c5e('0x53')]},'raw':!![]})[_0x4c5e('0x26')](function(_0x32c458){if(_0x32c458&&_0x32c458[_0x4c5e('0x54')]===0x0){return db[_0x4c5e('0x29')]['create']({'name':_0x496198[_0x4c5e('0x2c')],'resourceId':_0x496198['id'],'type':_0x32c458['name'],'sectionId':_0x32c458['id']},{})[_0x4c5e('0x26')](function(){return _0xc0b36;});}else{return _0xc0b36;}})[_0x4c5e('0x47')](function(_0x3cf9ae){logger['error'](_0x4c5e('0x55'),_0x3cf9ae);throw _0x3cf9ae;});}return _0xc0b36;})[_0x4c5e('0x26')](respondWithResult(_0x48458a,0xc9))[_0x4c5e('0x47')](handleError(_0x48458a,null));};exports[_0x4c5e('0x56')]=function(_0xd13f7e,_0x5c327f){if(_0xd13f7e['body']['id']){delete _0xd13f7e[_0x4c5e('0x4d')]['id'];}return db[_0x4c5e('0x2e')]['find']({'where':{'id':_0xd13f7e['params']['id']}})[_0x4c5e('0x26')](handleEntityNotFound(_0x5c327f,null))[_0x4c5e('0x26')](saveUpdates(_0xd13f7e[_0x4c5e('0x4d')],null))[_0x4c5e('0x26')](respondWithResult(_0x5c327f,null))[_0x4c5e('0x47')](handleError(_0x5c327f,null));};exports[_0x4c5e('0x27')]=function(_0x386528,_0x4017c5){return db['SmsQueue'][_0x4c5e('0x4b')]({'where':{'id':_0x386528['params']['id']}})['then'](handleEntityNotFound(_0x4017c5,null))['then'](removeEntity(_0x4017c5,null))[_0x4c5e('0x47')](handleError(_0x4017c5,null));};exports[_0x4c5e('0x57')]=function(_0x10a37c,_0x529344){return db[_0x4c5e('0x2e')][_0x4c5e('0x57')]()[_0x4c5e('0x26')](respondWithResult(_0x529344,null))[_0x4c5e('0x47')](handleError(_0x529344,null));};exports[_0x4c5e('0x58')]=function(_0xd2fef2,_0x1bb29a,_0xa6b53e){var _0x252464={'raw':!![],'where':{}},_0x104d02={},_0x1d6fa9;return db['SmsQueue'][_0x4c5e('0x59')]({'where':{'id':_0xd2fef2[_0x4c5e('0x49')]['id']}})[_0x4c5e('0x26')](handleEntityNotFound(_0x1bb29a,null))[_0x4c5e('0x26')](function(_0xfec798){if(_0xfec798){_0x1d6fa9=_0xfec798[_0x4c5e('0x4e')]({'plain':!![]});_0x104d02['model']=_['keys'](db[_0x4c5e('0x5a')][_0x4c5e('0x2f')]);_0x104d02[_0x4c5e('0x34')]=_[_0x4c5e('0x4a')](_0xd2fef2[_0x4c5e('0x34')]);_0x104d02[_0x4c5e('0x35')]=_[_0x4c5e('0x36')](_0x104d02[_0x4c5e('0x33')],_0x104d02[_0x4c5e('0x34')]);_0x252464[_0x4c5e('0x37')]=_[_0x4c5e('0x36')](_0x104d02[_0x4c5e('0x33')],qs[_0x4c5e('0x38')](_0xd2fef2['query'][_0x4c5e('0x38')]));_0x252464[_0x4c5e('0x37')]=_0x252464[_0x4c5e('0x37')][_0x4c5e('0x39')]?_0x252464[_0x4c5e('0x37')]:_0x104d02[_0x4c5e('0x33')];if(!_0xd2fef2[_0x4c5e('0x34')][_0x4c5e('0x3a')]('nolimit')){_0x252464[_0x4c5e('0x21')]=qs[_0x4c5e('0x21')](_0xd2fef2['query']['limit']);_0x252464['offset']=qs[_0x4c5e('0x1e')](_0xd2fef2[_0x4c5e('0x34')]['offset']);}_0x252464['order']=qs[_0x4c5e('0x3d')](_0xd2fef2[_0x4c5e('0x34')][_0x4c5e('0x3d')]);_0x252464['where']=qs[_0x4c5e('0x35')](_['pick'](_0xd2fef2[_0x4c5e('0x34')],_0x104d02[_0x4c5e('0x35')]));_0x252464[_0x4c5e('0x3f')][_0x4c5e('0x5b')]=_0xfec798['id'];if(_0xd2fef2[_0x4c5e('0x34')][_0x4c5e('0x40')]){_0x252464['where']=_[_0x4c5e('0x41')](_0x252464['where'],{'$or':_[_0x4c5e('0x2d')](_0x252464[_0x4c5e('0x37')],function(_0x5419e5){var _0x149351={};_0x149351[_0x5419e5]={'$like':'%'+_0xd2fef2[_0x4c5e('0x34')]['filter']+'%'};return _0x149351;})});}_0x252464=_['merge']({},_0x252464,_0xd2fef2[_0x4c5e('0x42')]);return db[_0x4c5e('0x5a')][_0x4c5e('0x45')](_0x252464);}})[_0x4c5e('0x26')](function(_0x59153a){if(_0x59153a){return db[_0x4c5e('0x5c')][_0x4c5e('0x5d')]({'where':{'id':_[_0x4c5e('0x2d')](_0x59153a,_0x4c5e('0x5e')),'role':_0x4c5e('0x5f')},'attributes':['id',_0x4c5e('0x2c'),'smsPause',_0x4c5e('0x60'),_0x4c5e('0x61')]});}})[_0x4c5e('0x26')](function(_0x307a4b){if(_0x307a4b){return{'count':_0x307a4b[_0x4c5e('0x20')],'rows':_[_0x4c5e('0x2d')](_0x307a4b[_0x4c5e('0x46')],function(_0x566c58){return{'membername':_0x566c58[_0x4c5e('0x2c')],'UserId':_0x566c58['id'],'queue_name':_0x1d6fa9[_0x4c5e('0x2c')],'SmsQueueId':_0x1d6fa9['id'],'interface':util[_0x4c5e('0x62')](_0x4c5e('0x63'),_0x4c5e('0x64'),_0x566c58[_0x4c5e('0x2c')]),'penalty':0x0,'paused':_0x566c58[_0x4c5e('0x65')],'createdAt':_0x566c58[_0x4c5e('0x61')],'updatedAt':_0x566c58['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x4c5e('0x26')](respondWithFilteredResult(_0x1bb29a,_0x252464))[_0x4c5e('0x47')](handleError(_0x1bb29a,null));};exports[_0x4c5e('0x66')]=function(_0x252dc9,_0x26a58a,_0x2ceb09){var _0xd27693={};var _0xaae0e9={};var _0x94aea3;var _0x19cd1c;return db[_0x4c5e('0x2e')][_0x4c5e('0x59')]({'where':{'id':_0x252dc9['params']['id']}})[_0x4c5e('0x26')](handleEntityNotFound(_0x26a58a,null))['then'](function(_0x5e53dc){if(_0x5e53dc){_0x94aea3=_0x5e53dc;_0xaae0e9[_0x4c5e('0x33')]=_['keys'](db[_0x4c5e('0x67')]['rawAttributes']);_0xaae0e9[_0x4c5e('0x34')]=_[_0x4c5e('0x4a')](_0x252dc9[_0x4c5e('0x34')]);_0xaae0e9[_0x4c5e('0x35')]=_['intersection'](_0xaae0e9[_0x4c5e('0x33')],_0xaae0e9[_0x4c5e('0x34')]);_0xd27693[_0x4c5e('0x37')]=_['intersection'](_0xaae0e9[_0x4c5e('0x33')],qs['fields'](_0x252dc9[_0x4c5e('0x34')][_0x4c5e('0x38')]));_0xd27693[_0x4c5e('0x37')]=_0xd27693[_0x4c5e('0x37')][_0x4c5e('0x39')]?_0xd27693[_0x4c5e('0x37')]:_0xaae0e9[_0x4c5e('0x33')];_0xd27693['order']=qs[_0x4c5e('0x3d')](_0x252dc9[_0x4c5e('0x34')][_0x4c5e('0x3d')]);_0xd27693[_0x4c5e('0x3f')]=qs[_0x4c5e('0x35')](_['pick'](_0x252dc9['query'],_0xaae0e9[_0x4c5e('0x35')]));if(_0x252dc9[_0x4c5e('0x34')]['filter']){_0xd27693['where']=_[_0x4c5e('0x41')](_0xd27693[_0x4c5e('0x3f')],{'$or':_['map'](_0xd27693[_0x4c5e('0x37')],function(_0x46dd5c){var _0xad174a={};_0xad174a[_0x46dd5c]={'$like':'%'+_0x252dc9[_0x4c5e('0x34')][_0x4c5e('0x40')]+'%'};return _0xad174a;})});}_0xd27693=_[_0x4c5e('0x41')]({},_0xd27693,_0x252dc9[_0x4c5e('0x42')]);return _0x94aea3[_0x4c5e('0x66')](_0xd27693);}})[_0x4c5e('0x26')](function(_0x5b2f2a){if(_0x5b2f2a){_0x19cd1c=_0x5b2f2a[_0x4c5e('0x39')];if(!_0x252dc9[_0x4c5e('0x34')][_0x4c5e('0x3a')](_0x4c5e('0x3b'))){_0xd27693[_0x4c5e('0x21')]=qs['limit'](_0x252dc9[_0x4c5e('0x34')][_0x4c5e('0x21')]);_0xd27693[_0x4c5e('0x1e')]=qs['offset'](_0x252dc9['query'][_0x4c5e('0x1e')]);}return _0x94aea3[_0x4c5e('0x66')](_0xd27693);}})[_0x4c5e('0x26')](function(_0x202fdd){if(_0x202fdd){return _0x202fdd?{'count':_0x19cd1c,'rows':_0x202fdd}:null;}})[_0x4c5e('0x26')](respondWithResult(_0x26a58a,null))[_0x4c5e('0x47')](handleError(_0x26a58a,null));};exports[_0x4c5e('0x68')]=function(_0x5744ee,_0x3276ac,_0x395fef){var _0x1768ee=_0x5744ee[_0x4c5e('0x4d')]['ids'];return db[_0x4c5e('0x67')]['findAll']({'where':{'id':_0x1768ee},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x4c5e('0x2c'),'online',_0x4c5e('0x69'),_0x4c5e('0x6a')],'raw':!![]}]})['then'](function(_0x1e1b51){if(_0x1e1b51){var _0x54baa5=_['flatMap'](_0x1e1b51,function(_0xbe7274){var _0x292c84=_0xbe7274[_0x4c5e('0x4e')]({'plain':!![]});return _0x292c84[_0x4c5e('0x6b')];});return db[_0x4c5e('0x2e')][_0x4c5e('0x4b')]({'where':{'id':_0x5744ee['params']['id']}})[_0x4c5e('0x26')](function(_0x37ae8e){return db['sequelize']['transaction'](function(_0x378703){return _0x37ae8e['addTeams'](_0x1768ee,{'transaction':_0x378703})[_0x4c5e('0x26')](function(){return BPromise['each'](_0x54baa5,function(_0xd85f54){return db[_0x4c5e('0x5a')][_0x4c5e('0x6c')]({'where':{'UserId':_0xd85f54['id'],'SmsQueueId':_0x5744ee[_0x4c5e('0x49')]['id']},'transaction':_0x378703});});})['then'](function(){_0x54baa5[_0x4c5e('0x6d')](function(_0x1902d0){socket[_0x4c5e('0x6e')](_0x4c5e('0x6f'),{'UserId':_0x1902d0['id'],'SmsQueueId':_0x37ae8e['id']});});});});});}})['then'](respondWithStatusCode(_0x3276ac,null))[_0x4c5e('0x47')](handleError(_0x3276ac,null));};exports[_0x4c5e('0x70')]=function(_0x567d43,_0x29e5b6,_0x4ad031){return db['Team'][_0x4c5e('0x45')]({'where':{'id':_0x567d43[_0x4c5e('0x34')]['ids']},'attributes':['id'],'include':[{'model':db[_0x4c5e('0x5c')],'as':_0x4c5e('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x4c5e('0x26')](handleEntityNotFound(_0x29e5b6,null))['then'](function(_0xf18899){var _0x106c1f=_[_0x4c5e('0x2d')](_0xf18899,'id');var _0x4e23da=[];var _0x288d08=[];var _0x45e0ae=squel[_0x4c5e('0x71')]();_0x45e0ae[_0x4c5e('0x72')](_0x4c5e('0x73'))[_0x4c5e('0x74')](_0x4c5e('0x75'),'tq')['join'](_0x4c5e('0x76'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('SmsQueueId\x20=\x20?',_0x567d43[_0x4c5e('0x49')]['id']);for(var _0x85777d=0x0;_0x85777d<_0xf18899[_0x4c5e('0x39')];_0x85777d+=0x1){let _0x39425a=_0xf18899[_0x85777d];for(var _0x4ff4cd=0x0;_0x4ff4cd<_0x39425a[_0x4c5e('0x6b')][_0x4c5e('0x39')];_0x4ff4cd+=0x1){let _0x5bab5e=_0x39425a[_0x4c5e('0x6b')][_0x4ff4cd];var _0x1d95da=_0x45e0ae[_0x4c5e('0x77')]();_0x1d95da[_0x4c5e('0x3f')](_0x4c5e('0x78'),_0x5bab5e['id']);_0x288d08[_0x4c5e('0x79')](db[_0x4c5e('0x7a')][_0x4c5e('0x34')](_0x1d95da[_0x4c5e('0x7b')](),{'type':db[_0x4c5e('0x7a')][_0x4c5e('0x7c')][_0x4c5e('0x7d')]})[_0x4c5e('0x26')](function(_0x17751f){if(_0x17751f['length']===0x1){return _0x5bab5e['id'];}else{var _0x153644=_[_0x4c5e('0x7e')](_[_0x4c5e('0x2d')](_0x17751f,_0x4c5e('0x7f')),function(_0xd3cd72){return _[_0x4c5e('0x80')](_0x106c1f,_0xd3cd72);});if(_0x153644){return _0x5bab5e['id'];}}}));}}return BPromise[_0x4c5e('0x81')](_0x288d08)[_0x4c5e('0x26')](function(_0x309ab0){_0x4e23da=_(_0x4e23da)[_0x4c5e('0x82')](_0x309ab0)[_0x4c5e('0x83')]()[_0x4c5e('0x84')]();return db['SmsQueue'][_0x4c5e('0x4b')]({'where':{'id':_0x567d43[_0x4c5e('0x49')]['id']}})[_0x4c5e('0x26')](function(_0x313992){return db[_0x4c5e('0x7a')][_0x4c5e('0x85')](function(_0x574756){return _0x313992[_0x4c5e('0x70')](_0x567d43['query'][_0x4c5e('0x86')],{'transaction':_0x574756})[_0x4c5e('0x26')](function(){if(!_[_0x4c5e('0x87')](_0x4e23da)){return _0x313992[_0x4c5e('0x88')](_0x4e23da,{'transaction':_0x574756});}})['then'](function(){_0x4e23da[_0x4c5e('0x6d')](function(_0x51855d){socket[_0x4c5e('0x6e')](_0x4c5e('0x89'),{'UserId':_0x51855d,'SmsQueueId':_0x313992['id']});});});});});});})[_0x4c5e('0x26')](respondWithStatusCode(_0x29e5b6,null))[_0x4c5e('0x47')](handleError(_0x29e5b6,null));};exports[_0x4c5e('0x8a')]=function(_0x2db175,_0x2707ad,_0x5a1cae){return db[_0x4c5e('0x2e')][_0x4c5e('0x4b')]({'where':{'id':_0x2db175[_0x4c5e('0x49')]['id']}})[_0x4c5e('0x26')](handleEntityNotFound(_0x2707ad,null))[_0x4c5e('0x26')](function(_0x3b1357){if(_0x3b1357){return _0x3b1357[_0x4c5e('0x8a')](_0x2db175[_0x4c5e('0x4d')]['ids'],_[_0x4c5e('0x8b')](_0x2db175[_0x4c5e('0x4d')],[_0x4c5e('0x86'),'id'])||{})['spread'](function(_0x4189a9){for(var _0x55c6f4=0x0;_0x55c6f4<_0x2db175[_0x4c5e('0x4d')][_0x4c5e('0x86')]['length'];_0x55c6f4+=0x1){socket['emit']('userSmsQueue:save',{'UserId':Number(_0x2db175['body'][_0x4c5e('0x86')][_0x55c6f4]),'SmsQueueId':Number(_0x2db175[_0x4c5e('0x49')]['id'])});}return _0x4189a9;});}})[_0x4c5e('0x26')](respondWithResult(_0x2707ad,null))[_0x4c5e('0x47')](handleError(_0x2707ad,null));};exports[_0x4c5e('0x88')]=function(_0xfa3f1c,_0x352e56,_0x36b61a){return db[_0x4c5e('0x2e')][_0x4c5e('0x4b')]({'where':{'id':_0xfa3f1c[_0x4c5e('0x49')]['id']}})['then'](handleEntityNotFound(_0x352e56,null))['then'](function(_0x2a6fe6){if(_0x2a6fe6){return _0x2a6fe6[_0x4c5e('0x88')](_0xfa3f1c['query'][_0x4c5e('0x86')])[_0x4c5e('0x26')](function(){if(_['isArray'](_0xfa3f1c['query'][_0x4c5e('0x86')])){for(var _0x32f283=0x0;_0x32f283<_0xfa3f1c[_0x4c5e('0x34')][_0x4c5e('0x86')][_0x4c5e('0x39')];_0x32f283+=0x1){socket[_0x4c5e('0x6e')]('userSmsQueue:remove',{'UserId':Number(_0xfa3f1c[_0x4c5e('0x34')]['ids'][_0x32f283]),'SmsQueueId':Number(_0xfa3f1c[_0x4c5e('0x49')]['id'])});}}else{socket[_0x4c5e('0x6e')](_0x4c5e('0x89'),{'UserId':Number(_0xfa3f1c['query']['ids']),'SmsQueueId':Number(_0xfa3f1c[_0x4c5e('0x49')]['id'])});}});}})[_0x4c5e('0x26')](respondWithStatusCode(_0x352e56,null))[_0x4c5e('0x47')](handleError(_0x352e56,null));};exports[_0x4c5e('0x8c')]=function(_0x599da3,_0x1c2791,_0x90a83b){var _0x6e2ccd={};var _0x1ca045={};var _0x3be129;var _0x4ab6dd;return db['SmsQueue'][_0x4c5e('0x59')]({'where':{'id':_0x599da3['params']['id']}})[_0x4c5e('0x26')](handleEntityNotFound(_0x1c2791,null))[_0x4c5e('0x26')](function(_0x2bfaae){if(_0x2bfaae){_0x3be129=_0x2bfaae;_0x1ca045[_0x4c5e('0x33')]=_[_0x4c5e('0x4a')](db[_0x4c5e('0x5c')][_0x4c5e('0x2f')]);_0x1ca045[_0x4c5e('0x34')]=_[_0x4c5e('0x4a')](_0x599da3['query']);_0x1ca045[_0x4c5e('0x35')]=_['intersection'](_0x1ca045[_0x4c5e('0x33')],_0x1ca045[_0x4c5e('0x34')]);_0x6e2ccd[_0x4c5e('0x37')]=_[_0x4c5e('0x36')](_0x1ca045['model'],qs[_0x4c5e('0x38')](_0x599da3[_0x4c5e('0x34')][_0x4c5e('0x38')]));_0x6e2ccd[_0x4c5e('0x37')]=_0x6e2ccd[_0x4c5e('0x37')][_0x4c5e('0x39')]?_0x6e2ccd[_0x4c5e('0x37')]:_0x1ca045[_0x4c5e('0x33')];_0x6e2ccd[_0x4c5e('0x3c')]=qs[_0x4c5e('0x3d')](_0x599da3[_0x4c5e('0x34')][_0x4c5e('0x3d')]);_0x6e2ccd[_0x4c5e('0x3f')]=qs[_0x4c5e('0x35')](_[_0x4c5e('0x3e')](_0x599da3[_0x4c5e('0x34')],_0x1ca045['filters']));if(_0x599da3[_0x4c5e('0x34')][_0x4c5e('0x40')]){_0x6e2ccd[_0x4c5e('0x3f')]=_[_0x4c5e('0x41')](_0x6e2ccd[_0x4c5e('0x3f')],{'$or':_[_0x4c5e('0x2d')](_0x6e2ccd['attributes'],function(_0x546a32){var _0x2b0aa4={};_0x2b0aa4[_0x546a32]={'$like':'%'+_0x599da3[_0x4c5e('0x34')][_0x4c5e('0x40')]+'%'};return _0x2b0aa4;})});}_0x6e2ccd=_[_0x4c5e('0x41')]({},_0x6e2ccd,_0x599da3[_0x4c5e('0x42')]);return _0x3be129[_0x4c5e('0x8c')](_0x6e2ccd);}})[_0x4c5e('0x26')](function(_0x2970e6){if(_0x2970e6){_0x4ab6dd=_0x2970e6[_0x4c5e('0x39')];if(!_0x599da3[_0x4c5e('0x34')]['hasOwnProperty'](_0x4c5e('0x3b'))){_0x6e2ccd[_0x4c5e('0x21')]=qs[_0x4c5e('0x21')](_0x599da3['query'][_0x4c5e('0x21')]);_0x6e2ccd[_0x4c5e('0x1e')]=qs[_0x4c5e('0x1e')](_0x599da3['query'][_0x4c5e('0x1e')]);}return _0x3be129[_0x4c5e('0x8c')](_0x6e2ccd);}})['then'](function(_0x4480ae){if(_0x4480ae){return _0x4480ae?{'count':_0x4ab6dd,'rows':_0x4480ae}:null;}})[_0x4c5e('0x26')](respondWithResult(_0x1c2791,null))[_0x4c5e('0x47')](handleError(_0x1c2791,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 96849a9..e551cbd 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 _0xd37e=['save','update','emit','hasOwnProperty','hook','events','../../mysqldb','SmsQueue'];(function(_0x4c80c2,_0x1dd102){var _0x24e817=function(_0x4a3085){while(--_0x4a3085){_0x4c80c2['push'](_0x4c80c2['shift']());}};_0x24e817(++_0x1dd102);}(_0xd37e,0x17d));var _0xed37=function(_0x51733c,_0x448082){_0x51733c=_0x51733c-0x0;var _0x5f50f9=_0xd37e[_0x51733c];return _0x5f50f9;};'use strict';var EventEmitter=require(_0xed37('0x0'));var SmsQueue=require(_0xed37('0x1'))['db'][_0xed37('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xed37('0x3'),'afterUpdate':_0xed37('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2a6501){return function(_0x336823,_0x63b6a7,_0x5f195c){SmsQueueEvents['emit'](_0x2a6501+':'+_0x336823['id'],_0x336823);SmsQueueEvents[_0xed37('0x5')](_0x2a6501,_0x336823);_0x5f195c(null);};}for(var e in events){if(events[_0xed37('0x6')](e)){var event=events[e];SmsQueue[_0xed37('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x8134=['exports','events','SmsQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3718b7,_0x2da677){var _0xf8c91e=function(_0x2519b4){while(--_0x2519b4){_0x3718b7['push'](_0x3718b7['shift']());}};_0xf8c91e(++_0x2da677);}(_0x8134,0xa3));var _0x4813=function(_0x485b5c,_0x303eeb){_0x485b5c=_0x485b5c-0x0;var _0x1cd3bc=_0x8134[_0x485b5c];return _0x1cd3bc;};'use strict';var EventEmitter=require(_0x4813('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x4813('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x4813('0x2')](0x0);var events={'afterCreate':_0x4813('0x3'),'afterUpdate':_0x4813('0x4'),'afterDestroy':_0x4813('0x5')};function emitEvent(_0x15aad7){return function(_0x404e92,_0x3f6a14,_0x4b3d79){SmsQueueEvents[_0x4813('0x6')](_0x15aad7+':'+_0x404e92['id'],_0x404e92);SmsQueueEvents[_0x4813('0x6')](_0x15aad7,_0x404e92);_0x4b3d79(null);};}for(var e in events){if(events[_0x4813('0x7')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x4813('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index fc404dc..bca8050 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 _0xbcba=['path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x531a0a,_0x2680d0){var _0x23af6e=function(_0x3753c8){while(--_0x3753c8){_0x531a0a['push'](_0x531a0a['shift']());}};_0x23af6e(++_0x2680d0);}(_0xbcba,0x125));var _0xabcb=function(_0x313e46,_0x90ba88){_0x313e46=_0x313e46-0x0;var _0x5d704a=_0xbcba[_0x313e46];return _0x5d704a;};'use strict';var _=require(_0xabcb('0x0'));var util=require(_0xabcb('0x1'));var logger=require(_0xabcb('0x2'))(_0xabcb('0x3'));var moment=require(_0xabcb('0x4'));var BPromise=require(_0xabcb('0x5'));var rp=require(_0xabcb('0x6'));var fs=require('fs');var path=require(_0xabcb('0x7'));var rimraf=require(_0xabcb('0x8'));var config=require(_0xabcb('0x9'));var attributes=require(_0xabcb('0xa'));module[_0xabcb('0xb')]=function(_0x1f3ecd,_0x185d73){return _0x1f3ecd[_0xabcb('0xc')](_0xabcb('0xd'),attributes,{'tableName':_0xabcb('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf0c3=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','SmsQueue','lodash','util'];(function(_0x274640,_0x300c5b){var _0x32d222=function(_0x177509){while(--_0x177509){_0x274640['push'](_0x274640['shift']());}};_0x32d222(++_0x300c5b);}(_0xf0c3,0x19e));var _0x3f0c=function(_0xb0bca7,_0x184193){_0xb0bca7=_0xb0bca7-0x0;var _0x5ee58c=_0xf0c3[_0xb0bca7];return _0x5ee58c;};'use strict';var _=require(_0x3f0c('0x0'));var util=require(_0x3f0c('0x1'));var logger=require(_0x3f0c('0x2'))(_0x3f0c('0x3'));var moment=require(_0x3f0c('0x4'));var BPromise=require(_0x3f0c('0x5'));var rp=require(_0x3f0c('0x6'));var fs=require('fs');var path=require(_0x3f0c('0x7'));var rimraf=require(_0x3f0c('0x8'));var config=require(_0x3f0c('0x9'));var attributes=require(_0x3f0c('0xa'));module[_0x3f0c('0xb')]=function(_0x46905d,_0x58579c){return _0x46905d['define'](_0x3f0c('0xc'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 78d6406..fd13cd4 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 _0x63c9=['SmsQueue','findAll','options','raw','limit','include','map','model','attributes','find','ShowSmsQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x63c9,0x10d));var _0x963c=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x63c9[_0x468b0f];return _0x3e74d9;};'use strict';var _=require(_0x963c('0x0'));var util=require(_0x963c('0x1'));var moment=require(_0x963c('0x2'));var BPromise=require('bluebird');var rs=require(_0x963c('0x3'));var fs=require('fs');var Redis=require(_0x963c('0x4'));var db=require(_0x963c('0x5'))['db'];var utils=require(_0x963c('0x6'));var logger=require(_0x963c('0x7'))(_0x963c('0x8'));var config=require(_0x963c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x963c('0xa')][_0x963c('0xb')]({'port':0x232a});config[_0x963c('0xc')]=_[_0x963c('0xd')](config[_0x963c('0xc')],{'host':_0x963c('0xe'),'port':0x18eb});var socket=require(_0x963c('0xf'))(new Redis(config[_0x963c('0xc')]));require(_0x963c('0x10'))[_0x963c('0x11')](socket);function respondWithRpcPromise(_0x1af056,_0x39dd22,_0x4d3e91){return new BPromise(function(_0x52fc0c,_0x4131ff){return client[_0x963c('0x12')](_0x1af056,_0x4d3e91)[_0x963c('0x13')](function(_0x1b89cf){logger[_0x963c('0x14')](_0x963c('0x15'),_0x39dd22,_0x963c('0x16'));logger[_0x963c('0x17')](_0x963c('0x18'),_0x39dd22,'request\x20sent',JSON[_0x963c('0x19')](_0x1b89cf));if(_0x1b89cf[_0x963c('0x1a')]){if(_0x1b89cf['error'][_0x963c('0x1b')]===0x1f4){logger['error']('SmsQueue,\x20%s,\x20%s',_0x39dd22,_0x1b89cf[_0x963c('0x1a')]['message']);return _0x4131ff(_0x1b89cf[_0x963c('0x1a')][_0x963c('0x1c')]);}logger['error'](_0x963c('0x15'),_0x39dd22,_0x1b89cf[_0x963c('0x1a')][_0x963c('0x1c')]);return _0x52fc0c(_0x1b89cf[_0x963c('0x1a')][_0x963c('0x1c')]);}else{logger[_0x963c('0x14')]('SmsQueue,\x20%s,\x20%s',_0x39dd22,_0x963c('0x16'));_0x52fc0c(_0x1b89cf[_0x963c('0x1d')][_0x963c('0x1c')]);}})[_0x963c('0x1e')](function(_0x32f16f){logger[_0x963c('0x1a')](_0x963c('0x15'),_0x39dd22,_0x32f16f);_0x4131ff(_0x32f16f);});});}exports[_0x963c('0x1f')]=function(_0xce6bb7){var _0x550d57=this;return new Promise(function(_0x595ea2,_0x5bd720){return db[_0x963c('0x20')][_0x963c('0x21')]({'raw':_0xce6bb7['options']?_0xce6bb7[_0x963c('0x22')][_0x963c('0x23')]===undefined?!![]:![]:!![],'where':_0xce6bb7[_0x963c('0x22')]?_0xce6bb7[_0x963c('0x22')]['where']||null:null,'attributes':_0xce6bb7[_0x963c('0x22')]?_0xce6bb7[_0x963c('0x22')]['attributes']||null:null,'limit':_0xce6bb7[_0x963c('0x22')]?_0xce6bb7[_0x963c('0x22')][_0x963c('0x24')]||null:null,'include':_0xce6bb7[_0x963c('0x22')]?_0xce6bb7['options'][_0x963c('0x25')]?_[_0x963c('0x26')](_0xce6bb7[_0x963c('0x22')][_0x963c('0x25')],function(_0x1ac939){return{'model':db[_0x1ac939[_0x963c('0x27')]],'as':_0x1ac939['as'],'attributes':_0x1ac939['attributes'],'include':_0x1ac939[_0x963c('0x25')]?_['map'](_0x1ac939[_0x963c('0x25')],function(_0xbc1c59){return{'model':db[_0xbc1c59['model']],'as':_0xbc1c59['as'],'attributes':_0xbc1c59['attributes'],'include':_0xbc1c59[_0x963c('0x25')]?_[_0x963c('0x26')](_0xbc1c59[_0x963c('0x25')],function(_0x3936b3){return{'model':db[_0x3936b3[_0x963c('0x27')]],'as':_0x3936b3['as'],'attributes':_0x3936b3[_0x963c('0x28')]};}):[]};}):[]};}):[]:[]})[_0x963c('0x13')](function(_0x36bad1){logger['info'](_0x963c('0x1f'),_0xce6bb7);logger[_0x963c('0x17')](_0x963c('0x1f'),_0xce6bb7,JSON[_0x963c('0x19')](_0x36bad1));_0x595ea2(_0x36bad1);})[_0x963c('0x1e')](function(_0x211fe9){logger[_0x963c('0x1a')]('GetSmsQueue',_0x211fe9[_0x963c('0x1c')],_0xce6bb7);_0x5bd720(_0x550d57[_0x963c('0x1a')](0x1f4,_0x211fe9[_0x963c('0x1c')]));});});};exports['ShowSmsQueue']=function(_0x16a243){var _0x5175cd=this;return new Promise(function(_0x1d4b1c,_0x5e08b3){return db[_0x963c('0x20')][_0x963c('0x29')]({'raw':_0x16a243[_0x963c('0x22')]?_0x16a243['options'][_0x963c('0x23')]===undefined?!![]:![]:!![],'where':_0x16a243[_0x963c('0x22')]?_0x16a243[_0x963c('0x22')]['where']||null:null,'attributes':_0x16a243[_0x963c('0x22')]?_0x16a243[_0x963c('0x22')]['attributes']||null:null,'include':_0x16a243[_0x963c('0x22')]?_0x16a243['options'][_0x963c('0x25')]?_[_0x963c('0x26')](_0x16a243[_0x963c('0x22')][_0x963c('0x25')],function(_0x3cc400){return{'model':db[_0x3cc400[_0x963c('0x27')]],'as':_0x3cc400['as'],'attributes':_0x3cc400['attributes'],'include':_0x3cc400[_0x963c('0x25')]?_[_0x963c('0x26')](_0x3cc400[_0x963c('0x25')],function(_0xf54a01){return{'model':db[_0xf54a01[_0x963c('0x27')]],'as':_0xf54a01['as'],'attributes':_0xf54a01[_0x963c('0x28')],'include':_0xf54a01['include']?_[_0x963c('0x26')](_0xf54a01['include'],function(_0xc2c799){return{'model':db[_0xc2c799[_0x963c('0x27')]],'as':_0xc2c799['as'],'attributes':_0xc2c799[_0x963c('0x28')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5873f0){logger['info'](_0x963c('0x2a'),_0x16a243);logger[_0x963c('0x17')](_0x963c('0x2a'),_0x16a243,JSON[_0x963c('0x19')](_0x5873f0));_0x1d4b1c(_0x5873f0);})['catch'](function(_0x599e73){logger[_0x963c('0x1a')](_0x963c('0x2a'),_0x599e73[_0x963c('0x1c')],_0x16a243);_0x5e08b3(_0x5175cd['error'](0x1f4,_0x599e73['message']));});});}; \ No newline at end of file +var _0xd900=['limit','include','attributes','map','model','stringify','find','where','ShowSmsQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./smsQueue.socket','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetSmsQueue','SmsQueue','options','raw'];(function(_0x47cf24,_0x305eea){var _0x567f84=function(_0x16c31a){while(--_0x16c31a){_0x47cf24['push'](_0x47cf24['shift']());}};_0x567f84(++_0x305eea);}(_0xd900,0x121));var _0x0d90=function(_0x4539ca,_0x3a07cd){_0x4539ca=_0x4539ca-0x0;var _0x552d4a=_0xd900[_0x4539ca];return _0x552d4a;};'use strict';var _=require(_0x0d90('0x0'));var util=require('util');var moment=require(_0x0d90('0x1'));var BPromise=require(_0x0d90('0x2'));var rs=require(_0x0d90('0x3'));var fs=require('fs');var Redis=require(_0x0d90('0x4'));var db=require(_0x0d90('0x5'))['db'];var utils=require(_0x0d90('0x6'));var logger=require(_0x0d90('0x7'))(_0x0d90('0x8'));var config=require('../../config/environment');var jayson=require(_0x0d90('0x9'));var client=jayson[_0x0d90('0xa')][_0x0d90('0xb')]({'port':0x232a});config[_0x0d90('0xc')]=_[_0x0d90('0xd')](config[_0x0d90('0xc')],{'host':_0x0d90('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d90('0xc')]));require(_0x0d90('0xf'))['register'](socket);function respondWithRpcPromise(_0x66133d,_0x1cf977,_0x314989){return new BPromise(function(_0x4e8f68,_0x2f9765){return client[_0x0d90('0x10')](_0x66133d,_0x314989)[_0x0d90('0x11')](function(_0x98d0d3){logger[_0x0d90('0x12')](_0x0d90('0x13'),_0x1cf977,_0x0d90('0x14'));logger[_0x0d90('0x15')](_0x0d90('0x16'),_0x1cf977,_0x0d90('0x14'),JSON['stringify'](_0x98d0d3));if(_0x98d0d3['error']){if(_0x98d0d3[_0x0d90('0x17')]['code']===0x1f4){logger[_0x0d90('0x17')](_0x0d90('0x13'),_0x1cf977,_0x98d0d3['error'][_0x0d90('0x18')]);return _0x2f9765(_0x98d0d3[_0x0d90('0x17')]['message']);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x1cf977,_0x98d0d3[_0x0d90('0x17')][_0x0d90('0x18')]);return _0x4e8f68(_0x98d0d3[_0x0d90('0x17')][_0x0d90('0x18')]);}else{logger[_0x0d90('0x12')](_0x0d90('0x13'),_0x1cf977,'request\x20sent');_0x4e8f68(_0x98d0d3[_0x0d90('0x19')][_0x0d90('0x18')]);}})[_0x0d90('0x1a')](function(_0x102ebf){logger['error'](_0x0d90('0x13'),_0x1cf977,_0x102ebf);_0x2f9765(_0x102ebf);});});}exports[_0x0d90('0x1b')]=function(_0x2296a3){var _0x3e6ee8=this;return new Promise(function(_0x2c3503,_0x115e0d){return db[_0x0d90('0x1c')]['findAll']({'raw':_0x2296a3['options']?_0x2296a3[_0x0d90('0x1d')][_0x0d90('0x1e')]===undefined?!![]:![]:!![],'where':_0x2296a3[_0x0d90('0x1d')]?_0x2296a3[_0x0d90('0x1d')]['where']||null:null,'attributes':_0x2296a3[_0x0d90('0x1d')]?_0x2296a3[_0x0d90('0x1d')]['attributes']||null:null,'limit':_0x2296a3['options']?_0x2296a3[_0x0d90('0x1d')][_0x0d90('0x1f')]||null:null,'include':_0x2296a3[_0x0d90('0x1d')]?_0x2296a3[_0x0d90('0x1d')][_0x0d90('0x20')]?_['map'](_0x2296a3[_0x0d90('0x1d')][_0x0d90('0x20')],function(_0x3a7051){return{'model':db[_0x3a7051['model']],'as':_0x3a7051['as'],'attributes':_0x3a7051[_0x0d90('0x21')],'include':_0x3a7051[_0x0d90('0x20')]?_[_0x0d90('0x22')](_0x3a7051[_0x0d90('0x20')],function(_0x55b9ab){return{'model':db[_0x55b9ab['model']],'as':_0x55b9ab['as'],'attributes':_0x55b9ab['attributes'],'include':_0x55b9ab[_0x0d90('0x20')]?_[_0x0d90('0x22')](_0x55b9ab['include'],function(_0x4ad223){return{'model':db[_0x4ad223[_0x0d90('0x23')]],'as':_0x4ad223['as'],'attributes':_0x4ad223['attributes']};}):[]};}):[]};}):[]:[]})[_0x0d90('0x11')](function(_0x462c94){logger[_0x0d90('0x12')]('GetSmsQueue',_0x2296a3);logger[_0x0d90('0x15')]('GetSmsQueue',_0x2296a3,JSON[_0x0d90('0x24')](_0x462c94));_0x2c3503(_0x462c94);})[_0x0d90('0x1a')](function(_0x17bbf3){logger['error'](_0x0d90('0x1b'),_0x17bbf3['message'],_0x2296a3);_0x115e0d(_0x3e6ee8[_0x0d90('0x17')](0x1f4,_0x17bbf3[_0x0d90('0x18')]));});});};exports['ShowSmsQueue']=function(_0x3961f8){var _0x1b8331=this;return new Promise(function(_0x597884,_0x3fae29){return db[_0x0d90('0x1c')][_0x0d90('0x25')]({'raw':_0x3961f8[_0x0d90('0x1d')]?_0x3961f8[_0x0d90('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3961f8['options']?_0x3961f8[_0x0d90('0x1d')][_0x0d90('0x26')]||null:null,'attributes':_0x3961f8[_0x0d90('0x1d')]?_0x3961f8['options'][_0x0d90('0x21')]||null:null,'include':_0x3961f8['options']?_0x3961f8[_0x0d90('0x1d')][_0x0d90('0x20')]?_[_0x0d90('0x22')](_0x3961f8[_0x0d90('0x1d')][_0x0d90('0x20')],function(_0x521b9e){return{'model':db[_0x521b9e['model']],'as':_0x521b9e['as'],'attributes':_0x521b9e[_0x0d90('0x21')],'include':_0x521b9e['include']?_[_0x0d90('0x22')](_0x521b9e[_0x0d90('0x20')],function(_0x598222){return{'model':db[_0x598222[_0x0d90('0x23')]],'as':_0x598222['as'],'attributes':_0x598222[_0x0d90('0x21')],'include':_0x598222['include']?_[_0x0d90('0x22')](_0x598222['include'],function(_0x4f2072){return{'model':db[_0x4f2072['model']],'as':_0x4f2072['as'],'attributes':_0x4f2072[_0x0d90('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0d90('0x11')](function(_0x3e945b){logger['info']('ShowSmsQueue',_0x3961f8);logger[_0x0d90('0x15')](_0x0d90('0x27'),_0x3961f8,JSON[_0x0d90('0x24')](_0x3e945b));_0x597884(_0x3e945b);})[_0x0d90('0x1a')](function(_0x4106d7){logger[_0x0d90('0x17')](_0x0d90('0x27'),_0x4106d7[_0x0d90('0x18')],_0x3961f8);_0x3fae29(_0x1b8331['error'](0x1f4,_0x4106d7[_0x0d90('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 50c8bfa..4454eab 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 _0x68f7=['emit','length','smsQueue:','./smsQueue.events','remove','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68f7,0x17d));var _0x768f=function(_0x37ef38,_0x2cfe4e){_0x37ef38=_0x37ef38-0x0;var _0x499daa=_0x68f7[_0x37ef38];return _0x499daa;};'use strict';var SmsQueueEvents=require(_0x768f('0x0'));var events=['save',_0x768f('0x1'),_0x768f('0x2')];function createListener(_0x5a4dfd,_0x698724){return function(_0x43030f){_0x698724[_0x768f('0x3')](_0x5a4dfd,_0x43030f);};}function removeListener(_0x4c5acc,_0x3a190f){return function(){SmsQueueEvents['removeListener'](_0x4c5acc,_0x3a190f);};}exports['register']=function(_0x15e129){for(var _0x1df262=0x0,_0xe7ebed=events[_0x768f('0x4')];_0x1df262<_0xe7ebed;_0x1df262++){var _0x229748=events[_0x1df262];var _0x594e31=createListener(_0x768f('0x5')+_0x229748,_0x15e129);SmsQueueEvents['on'](_0x229748,_0x594e31);}}; \ No newline at end of file +var _0x3ebe=['length','smsQueue:','save','emit','removeListener'];(function(_0x3b4bb3,_0x5d440e){var _0x1fb80c=function(_0x6f810e){while(--_0x6f810e){_0x3b4bb3['push'](_0x3b4bb3['shift']());}};_0x1fb80c(++_0x5d440e);}(_0x3ebe,0xed));var _0xe3eb=function(_0x1a3b2,_0x3568b3){_0x1a3b2=_0x1a3b2-0x0;var _0x236dc0=_0x3ebe[_0x1a3b2];return _0x236dc0;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xe3eb('0x0'),'remove','update'];function createListener(_0x312bc0,_0x396f3c){return function(_0x3d37fc){_0x396f3c[_0xe3eb('0x1')](_0x312bc0,_0x3d37fc);};}function removeListener(_0x5d7c50,_0x2d4ece){return function(){SmsQueueEvents[_0xe3eb('0x2')](_0x5d7c50,_0x2d4ece);};}exports['register']=function(_0x852bf5){for(var _0x22f22d=0x0,_0xe19f70=events[_0xe3eb('0x3')];_0x22f22d<_0xe19f70;_0x22f22d++){var _0x46b459=events[_0x22f22d];var _0x3fb982=createListener(_0xe3eb('0x4')+_0x46b459,_0x852bf5);SmsQueueEvents['on'](_0x46b459,_0x3fb982);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 332288a..d83f52a 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 _0x04f1=['destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','index','get','/describe','isAuthenticated','/:id','show','create','put','update','delete'];(function(_0x26a627,_0x565249){var _0x43c3ed=function(_0xd87d61){while(--_0xd87d61){_0x26a627['push'](_0x26a627['shift']());}};_0x43c3ed(++_0x565249);}(_0x04f1,0x92));var _0x104f=function(_0x441373,_0x15b94){_0x441373=_0x441373-0x0;var _0x4a61b2=_0x04f1[_0x441373];return _0x4a61b2;};'use strict';var multer=require(_0x104f('0x0'));var util=require(_0x104f('0x1'));var path=require(_0x104f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x104f('0x3')]();var fs_extra=require(_0x104f('0x4'));var auth=require(_0x104f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x104f('0x6')]);router[_0x104f('0x7')](_0x104f('0x8'),auth[_0x104f('0x9')](),controller['describe']);router[_0x104f('0x7')](_0x104f('0xa'),auth[_0x104f('0x9')](),controller[_0x104f('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x104f('0xc')]);router[_0x104f('0xd')](_0x104f('0xa'),auth[_0x104f('0x9')](),controller[_0x104f('0xe')]);router[_0x104f('0xf')](_0x104f('0xa'),auth[_0x104f('0x9')](),controller[_0x104f('0x10')]);module[_0x104f('0x11')]=router; \ No newline at end of file +var _0x652f=['/:id','show','post','create','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','isAuthenticated','index','describe','get'];(function(_0x50f9a3,_0x3cc9b9){var _0x437d32=function(_0x42845b){while(--_0x42845b){_0x50f9a3['push'](_0x50f9a3['shift']());}};_0x437d32(++_0x3cc9b9);}(_0x652f,0xf1));var _0xf652=function(_0x5c5724,_0x567fb6){_0x5c5724=_0x5c5724-0x0;var _0x28c79a=_0x652f[_0x5c5724];return _0x28c79a;};'use strict';var multer=require('multer');var util=require(_0xf652('0x0'));var path=require('path');var timeout=require(_0xf652('0x1'));var express=require('express');var router=express[_0xf652('0x2')]();var fs_extra=require(_0xf652('0x3'));var auth=require(_0xf652('0x4'));var interaction=require(_0xf652('0x5'));var config=require('../../config/environment');var controller=require(_0xf652('0x6'));router['get']('/',auth[_0xf652('0x7')](),controller[_0xf652('0x8')]);router['get']('/describe',auth[_0xf652('0x7')](),controller[_0xf652('0x9')]);router[_0xf652('0xa')](_0xf652('0xb'),auth[_0xf652('0x7')](),controller[_0xf652('0xc')]);router[_0xf652('0xd')]('/',auth['isAuthenticated'](),controller[_0xf652('0xe')]);router['put']('/:id',auth[_0xf652('0x7')](),controller['update']);router[_0xf652('0xf')](_0xf652('0xb'),auth[_0xf652('0x7')](),controller[_0xf652('0x10')]);module[_0xf652('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 92ce92b..6764499 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 _0x3769=['moment','exports','STRING','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3769,0x15c));var _0x9376=function(_0x2ac843,_0x388376){_0x2ac843=_0x2ac843-0x0;var _0x2f90ac=_0x3769[_0x2ac843];return _0x2f90ac;};'use strict';var moment=require(_0x9376('0x0'));var Sequelize=require('sequelize');module[_0x9376('0x1')]={'uniqueid':{'type':Sequelize[_0x9376('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x9376('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x9376('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x9376('0x3')]},'reason':{'type':Sequelize[_0x9376('0x2')]}}; \ No newline at end of file +var _0xfb01=['exports','STRING','DATE','sequelize'];(function(_0xc60f63,_0xee19f7){var _0x2207e4=function(_0x28ea89){while(--_0x28ea89){_0xc60f63['push'](_0xc60f63['shift']());}};_0x2207e4(++_0xee19f7);}(_0xfb01,0x153));var _0x1fb0=function(_0x35af23,_0x9190f6){_0x35af23=_0x35af23-0x0;var _0x340506=_0xfb01[_0x35af23];return _0x340506;};'use strict';var moment=require('moment');var Sequelize=require(_0x1fb0('0x0'));module[_0x1fb0('0x1')]={'uniqueid':{'type':Sequelize[_0x1fb0('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x1fb0('0x2')]},'joinAt':{'type':Sequelize[_0x1fb0('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x1fb0('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 7133e5b..522a1a9 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 _0xf195=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','SmsQueueReport','includeAll','include','findAll','rows','catch','params','find','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x4c2d70,_0x3877ae){var _0x54831e=function(_0x28eddc){while(--_0x28eddc){_0x4c2d70['push'](_0x4c2d70['shift']());}};_0x54831e(++_0x3877ae);}(_0xf195,0xcd));var _0x5f19=function(_0x2b5513,_0x3fe5cd){_0x2b5513=_0x2b5513-0x0;var _0x578fd2=_0xf195[_0x2b5513];return _0x578fd2;};'use strict';var emlformat=require(_0x5f19('0x0'));var rimraf=require(_0x5f19('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5f19('0x2'));var rp=require('request-promise');var moment=require(_0x5f19('0x3'));var BPromise=require(_0x5f19('0x4'));var Mustache=require('mustache');var util=require(_0x5f19('0x5'));var path=require(_0x5f19('0x6'));var sox=require(_0x5f19('0x7'));var csv=require(_0x5f19('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5f19('0x9'));var _=require(_0x5f19('0xa'));var squel=require(_0x5f19('0xb'));var crypto=require(_0x5f19('0xc'));var jsforce=require(_0x5f19('0xd'));var deskjs=require(_0x5f19('0xe'));var toCsv=require(_0x5f19('0x8'));var querystring=require(_0x5f19('0xf'));var Papa=require(_0x5f19('0x10'));var Redis=require(_0x5f19('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5f19('0x12'));var as=require(_0x5f19('0x13'));var hardwareService=require(_0x5f19('0x14'));var logger=require(_0x5f19('0x15'))(_0x5f19('0x16'));var utils=require('../../config/utils');var config=require(_0x5f19('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43a419,_0x73b1f0){_0x73b1f0=_0x73b1f0||0xcc;return function(_0x2a8499){if(_0x2a8499){return _0x43a419[_0x5f19('0x18')](_0x73b1f0);}return _0x43a419[_0x5f19('0x19')](_0x73b1f0)[_0x5f19('0x1a')]();};}function respondWithResult(_0x2fb974,_0x3de32c){_0x3de32c=_0x3de32c||0xc8;return function(_0x23c5c1){if(_0x23c5c1){return _0x2fb974[_0x5f19('0x19')](_0x3de32c)[_0x5f19('0x1b')](_0x23c5c1);}};}function respondWithFilteredResult(_0x41b05a,_0xf25216){return function(_0x9764ba){if(_0x9764ba){var _0x46f7e3=typeof _0xf25216[_0x5f19('0x1c')]===_0x5f19('0x1d')&&typeof _0xf25216[_0x5f19('0x1e')]===_0x5f19('0x1d');var _0x55c7fb=_0x9764ba[_0x5f19('0x1f')];var _0x22c137=_0x46f7e3?0x0:_0xf25216[_0x5f19('0x1c')];var _0x40640b=_0x46f7e3?_0x9764ba[_0x5f19('0x1f')]:_0xf25216[_0x5f19('0x1c')]+_0xf25216['limit'];var _0x3301a2;if(_0x40640b>=_0x55c7fb){_0x40640b=_0x55c7fb;_0x3301a2=0xc8;}else{_0x3301a2=0xce;}_0x41b05a['status'](_0x3301a2);return _0x41b05a[_0x5f19('0x20')](_0x5f19('0x21'),_0x22c137+'-'+_0x40640b+'/'+_0x55c7fb)['json'](_0x9764ba);}return null;};}function patchUpdates(_0xb6c91){return function(_0x31afaf){try{jsonpatch[_0x5f19('0x22')](_0x31afaf,_0xb6c91,!![]);}catch(_0x268c17){return BPromise[_0x5f19('0x23')](_0x268c17);}return _0x31afaf['save']();};}function saveUpdates(_0xc4a438,_0xf60b7c){return function(_0x3f06ec){if(_0x3f06ec){return _0x3f06ec[_0x5f19('0x24')](_0xc4a438)[_0x5f19('0x25')](function(_0x10db23){return _0x10db23;});}return null;};}function removeEntity(_0x47f1c4,_0x49f47a){return function(_0x2c4f61){if(_0x2c4f61){return _0x2c4f61[_0x5f19('0x26')]()['then'](function(){_0x47f1c4[_0x5f19('0x19')](0xcc)[_0x5f19('0x1a')]();});}};}function handleEntityNotFound(_0x41e683,_0x4a7a1d){return function(_0x46d405){if(!_0x46d405){_0x41e683['sendStatus'](0x194);}return _0x46d405;};}function handleError(_0x3d5416,_0x15207f){_0x15207f=_0x15207f||0x1f4;return function(_0x43e2ae){logger[_0x5f19('0x27')](_0x43e2ae['stack']);if(_0x43e2ae[_0x5f19('0x28')]){delete _0x43e2ae[_0x5f19('0x28')];}_0x3d5416['status'](_0x15207f)['send'](_0x43e2ae);};}exports[_0x5f19('0x29')]=function(_0x1ee1ba,_0x44d271){var _0x30d8fb={},_0x114b61={},_0x498061={'count':0x0,'rows':[]};var _0x148ae6=_[_0x5f19('0x2a')](db['SmsQueueReport'][_0x5f19('0x2b')],function(_0x35c304){return{'name':_0x35c304[_0x5f19('0x2c')],'type':_0x35c304[_0x5f19('0x2d')]['key']};});_0x114b61[_0x5f19('0x2e')]=_['map'](_0x148ae6,_0x5f19('0x28'));_0x114b61['query']=_[_0x5f19('0x2f')](_0x1ee1ba[_0x5f19('0x30')]);_0x114b61[_0x5f19('0x31')]=_[_0x5f19('0x32')](_0x114b61['model'],_0x114b61[_0x5f19('0x30')]);_0x30d8fb[_0x5f19('0x33')]=_[_0x5f19('0x32')](_0x114b61[_0x5f19('0x2e')],qs[_0x5f19('0x34')](_0x1ee1ba[_0x5f19('0x30')][_0x5f19('0x34')]));_0x30d8fb[_0x5f19('0x33')]=_0x30d8fb[_0x5f19('0x33')][_0x5f19('0x35')]?_0x30d8fb[_0x5f19('0x33')]:_0x114b61[_0x5f19('0x2e')];if(!_0x1ee1ba[_0x5f19('0x30')][_0x5f19('0x36')](_0x5f19('0x37'))){_0x30d8fb[_0x5f19('0x1e')]=qs[_0x5f19('0x1e')](_0x1ee1ba[_0x5f19('0x30')][_0x5f19('0x1e')]);_0x30d8fb[_0x5f19('0x1c')]=qs[_0x5f19('0x1c')](_0x1ee1ba[_0x5f19('0x30')]['offset']);}_0x30d8fb[_0x5f19('0x38')]=qs[_0x5f19('0x39')](_0x1ee1ba['query'][_0x5f19('0x39')]);_0x30d8fb[_0x5f19('0x3a')]=qs[_0x5f19('0x31')](_[_0x5f19('0x3b')](_0x1ee1ba[_0x5f19('0x30')],_0x114b61['filters']),_0x148ae6);if(_0x1ee1ba[_0x5f19('0x30')]['filter']){_0x30d8fb[_0x5f19('0x3a')]=_[_0x5f19('0x3c')](_0x30d8fb['where'],{'$or':_[_0x5f19('0x2a')](_0x148ae6,function(_0x2337c9){if(_0x2337c9[_0x5f19('0x2d')]!==_0x5f19('0x3d')){var _0x17b78a={};_0x17b78a[_0x2337c9['name']]={'$like':'%'+_0x1ee1ba['query'][_0x5f19('0x3e')]+'%'};return _0x17b78a;}})});}_0x30d8fb=_[_0x5f19('0x3c')]({},_0x30d8fb,_0x1ee1ba[_0x5f19('0x3f')]);var _0x3372ca={'where':_0x30d8fb[_0x5f19('0x3a')]};return db[_0x5f19('0x40')][_0x5f19('0x1f')](_0x3372ca)['then'](function(_0x1ecae4){_0x498061[_0x5f19('0x1f')]=_0x1ecae4;if(_0x1ee1ba['query'][_0x5f19('0x41')]){_0x30d8fb[_0x5f19('0x42')]=[{'all':!![]}];}return db[_0x5f19('0x40')][_0x5f19('0x43')](_0x30d8fb);})[_0x5f19('0x25')](function(_0x10bc04){_0x498061[_0x5f19('0x44')]=_0x10bc04;return _0x498061;})['then'](respondWithFilteredResult(_0x44d271,_0x30d8fb))[_0x5f19('0x45')](handleError(_0x44d271,null));};exports['show']=function(_0x4d5c0a,_0x2da215){var _0x50e0e1={'raw':!![],'where':{'id':_0x4d5c0a[_0x5f19('0x46')]['id']}},_0x18522a={};_0x18522a['model']=_[_0x5f19('0x2f')](db['SmsQueueReport'][_0x5f19('0x2b')]);_0x18522a[_0x5f19('0x30')]=_[_0x5f19('0x2f')](_0x4d5c0a[_0x5f19('0x30')]);_0x18522a[_0x5f19('0x31')]=_[_0x5f19('0x32')](_0x18522a[_0x5f19('0x2e')],_0x18522a[_0x5f19('0x30')]);_0x50e0e1[_0x5f19('0x33')]=_[_0x5f19('0x32')](_0x18522a['model'],qs['fields'](_0x4d5c0a[_0x5f19('0x30')][_0x5f19('0x34')]));_0x50e0e1['attributes']=_0x50e0e1[_0x5f19('0x33')][_0x5f19('0x35')]?_0x50e0e1[_0x5f19('0x33')]:_0x18522a[_0x5f19('0x2e')];if(_0x4d5c0a[_0x5f19('0x30')][_0x5f19('0x41')]){_0x50e0e1[_0x5f19('0x42')]=[{'all':!![]}];}_0x50e0e1=_['merge']({},_0x50e0e1,_0x4d5c0a[_0x5f19('0x3f')]);return db[_0x5f19('0x40')][_0x5f19('0x47')](_0x50e0e1)[_0x5f19('0x25')](handleEntityNotFound(_0x2da215,null))['then'](respondWithResult(_0x2da215,null))['catch'](handleError(_0x2da215,null));};exports['create']=function(_0x4be821,_0x354b70){return db[_0x5f19('0x40')]['create'](_0x4be821[_0x5f19('0x48')],{})['then'](respondWithResult(_0x354b70,0xc9))[_0x5f19('0x45')](handleError(_0x354b70,null));};exports['update']=function(_0x2ad71e,_0x140811){if(_0x2ad71e[_0x5f19('0x48')]['id']){delete _0x2ad71e[_0x5f19('0x48')]['id'];}return db[_0x5f19('0x40')][_0x5f19('0x47')]({'where':{'id':_0x2ad71e[_0x5f19('0x46')]['id']}})[_0x5f19('0x25')](handleEntityNotFound(_0x140811,null))[_0x5f19('0x25')](saveUpdates(_0x2ad71e['body'],null))[_0x5f19('0x25')](respondWithResult(_0x140811,null))[_0x5f19('0x45')](handleError(_0x140811,null));};exports['destroy']=function(_0x26c402,_0x4f52aa){return db[_0x5f19('0x40')]['find']({'where':{'id':_0x26c402[_0x5f19('0x46')]['id']}})[_0x5f19('0x25')](handleEntityNotFound(_0x4f52aa,null))[_0x5f19('0x25')](removeEntity(_0x4f52aa,null))['catch'](handleError(_0x4f52aa,null));};exports[_0x5f19('0x49')]=function(_0xcebb91,_0x5ce68d){return db[_0x5f19('0x40')][_0x5f19('0x49')]()[_0x5f19('0x25')](respondWithResult(_0x5ce68d,null))['catch'](handleError(_0x5ce68d,null));}; \ No newline at end of file +var _0xd492=['create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','then','name','map','SmsQueueReport','fieldName','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','params','rawAttributes','intersection','include','options','find'];(function(_0x3bb03e,_0x164134){var _0x51e4a6=function(_0x120938){while(--_0x120938){_0x3bb03e['push'](_0x3bb03e['shift']());}};_0x51e4a6(++_0x164134);}(_0xd492,0x1ed));var _0x2d49=function(_0xf5e476,_0x1ba547){_0xf5e476=_0xf5e476-0x0;var _0x1a5fc9=_0xd492[_0xf5e476];return _0x1a5fc9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2d49('0x0'));var zipdir=require(_0x2d49('0x1'));var jsonpatch=require(_0x2d49('0x2'));var rp=require(_0x2d49('0x3'));var moment=require(_0x2d49('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2d49('0x5'));var util=require('util');var path=require(_0x2d49('0x6'));var sox=require(_0x2d49('0x7'));var csv=require('to-csv');var ejs=require(_0x2d49('0x8'));var fs=require('fs');var fs_extra=require(_0x2d49('0x9'));var _=require('lodash');var squel=require(_0x2d49('0xa'));var crypto=require(_0x2d49('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2d49('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2d49('0xd'));var Papa=require(_0x2d49('0xe'));var Redis=require(_0x2d49('0xf'));var authService=require(_0x2d49('0x10'));var qs=require(_0x2d49('0x11'));var as=require(_0x2d49('0x12'));var hardwareService=require(_0x2d49('0x13'));var logger=require(_0x2d49('0x14'))('api');var utils=require(_0x2d49('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2d49('0x16'));var db=require(_0x2d49('0x17'))['db'];function respondWithStatusCode(_0xceba3c,_0x545adb){_0x545adb=_0x545adb||0xcc;return function(_0x36885d){if(_0x36885d){return _0xceba3c['sendStatus'](_0x545adb);}return _0xceba3c[_0x2d49('0x18')](_0x545adb)[_0x2d49('0x19')]();};}function respondWithResult(_0x69d419,_0x4c641f){_0x4c641f=_0x4c641f||0xc8;return function(_0xc9423e){if(_0xc9423e){return _0x69d419['status'](_0x4c641f)[_0x2d49('0x1a')](_0xc9423e);}};}function respondWithFilteredResult(_0x730041,_0x5c519a){return function(_0x498b74){if(_0x498b74){var _0x54ed49=typeof _0x5c519a[_0x2d49('0x1b')]===_0x2d49('0x1c')&&typeof _0x5c519a[_0x2d49('0x1d')]===_0x2d49('0x1c');var _0x6e44c6=_0x498b74['count'];var _0x32041a=_0x54ed49?0x0:_0x5c519a['offset'];var _0x57a360=_0x54ed49?_0x498b74[_0x2d49('0x1e')]:_0x5c519a[_0x2d49('0x1b')]+_0x5c519a['limit'];var _0x4d10f4;if(_0x57a360>=_0x6e44c6){_0x57a360=_0x6e44c6;_0x4d10f4=0xc8;}else{_0x4d10f4=0xce;}_0x730041[_0x2d49('0x18')](_0x4d10f4);return _0x730041[_0x2d49('0x1f')](_0x2d49('0x20'),_0x32041a+'-'+_0x57a360+'/'+_0x6e44c6)[_0x2d49('0x1a')](_0x498b74);}return null;};}function patchUpdates(_0x28db4f){return function(_0x3fea6c){try{jsonpatch['apply'](_0x3fea6c,_0x28db4f,!![]);}catch(_0x11c09d){return BPromise[_0x2d49('0x21')](_0x11c09d);}return _0x3fea6c['save']();};}function saveUpdates(_0x32121a,_0x467283){return function(_0x24792f){if(_0x24792f){return _0x24792f[_0x2d49('0x22')](_0x32121a)['then'](function(_0x56b149){return _0x56b149;});}return null;};}function removeEntity(_0x2f8503,_0x5f56d0){return function(_0x1e28a1){if(_0x1e28a1){return _0x1e28a1[_0x2d49('0x23')]()[_0x2d49('0x24')](function(){_0x2f8503[_0x2d49('0x18')](0xcc)[_0x2d49('0x19')]();});}};}function handleEntityNotFound(_0x32adbb,_0x3479cc){return function(_0x923c0c){if(!_0x923c0c){_0x32adbb['sendStatus'](0x194);}return _0x923c0c;};}function handleError(_0x127466,_0x451437){_0x451437=_0x451437||0x1f4;return function(_0x11ec4f){logger['error'](_0x11ec4f['stack']);if(_0x11ec4f[_0x2d49('0x25')]){delete _0x11ec4f[_0x2d49('0x25')];}_0x127466[_0x2d49('0x18')](_0x451437)['send'](_0x11ec4f);};}exports['index']=function(_0x2b8551,_0xf7680d){var _0x32422b={},_0x517e67={},_0x3e36cf={'count':0x0,'rows':[]};var _0x26e2a9=_[_0x2d49('0x26')](db[_0x2d49('0x27')]['rawAttributes'],function(_0x360205){return{'name':_0x360205[_0x2d49('0x28')],'type':_0x360205['type']['key']};});_0x517e67[_0x2d49('0x29')]=_[_0x2d49('0x26')](_0x26e2a9,'name');_0x517e67[_0x2d49('0x2a')]=_[_0x2d49('0x2b')](_0x2b8551[_0x2d49('0x2a')]);_0x517e67[_0x2d49('0x2c')]=_['intersection'](_0x517e67[_0x2d49('0x29')],_0x517e67[_0x2d49('0x2a')]);_0x32422b['attributes']=_['intersection'](_0x517e67[_0x2d49('0x29')],qs['fields'](_0x2b8551[_0x2d49('0x2a')][_0x2d49('0x2d')]));_0x32422b[_0x2d49('0x2e')]=_0x32422b['attributes'][_0x2d49('0x2f')]?_0x32422b['attributes']:_0x517e67[_0x2d49('0x29')];if(!_0x2b8551[_0x2d49('0x2a')][_0x2d49('0x30')](_0x2d49('0x31'))){_0x32422b[_0x2d49('0x1d')]=qs['limit'](_0x2b8551[_0x2d49('0x2a')]['limit']);_0x32422b[_0x2d49('0x1b')]=qs['offset'](_0x2b8551['query'][_0x2d49('0x1b')]);}_0x32422b[_0x2d49('0x32')]=qs[_0x2d49('0x33')](_0x2b8551[_0x2d49('0x2a')]['sort']);_0x32422b[_0x2d49('0x34')]=qs[_0x2d49('0x2c')](_['pick'](_0x2b8551[_0x2d49('0x2a')],_0x517e67['filters']),_0x26e2a9);if(_0x2b8551[_0x2d49('0x2a')][_0x2d49('0x35')]){_0x32422b[_0x2d49('0x34')]=_[_0x2d49('0x36')](_0x32422b[_0x2d49('0x34')],{'$or':_['map'](_0x26e2a9,function(_0x31968f){if(_0x31968f[_0x2d49('0x37')]!==_0x2d49('0x38')){var _0x160921={};_0x160921[_0x31968f[_0x2d49('0x25')]]={'$like':'%'+_0x2b8551[_0x2d49('0x2a')][_0x2d49('0x35')]+'%'};return _0x160921;}})});}_0x32422b=_['merge']({},_0x32422b,_0x2b8551['options']);var _0x1f899c={'where':_0x32422b[_0x2d49('0x34')]};return db[_0x2d49('0x27')][_0x2d49('0x1e')](_0x1f899c)['then'](function(_0x2a275f){_0x3e36cf[_0x2d49('0x1e')]=_0x2a275f;if(_0x2b8551[_0x2d49('0x2a')][_0x2d49('0x39')]){_0x32422b['include']=[{'all':!![]}];}return db[_0x2d49('0x27')][_0x2d49('0x3a')](_0x32422b);})[_0x2d49('0x24')](function(_0x4ed610){_0x3e36cf[_0x2d49('0x3b')]=_0x4ed610;return _0x3e36cf;})[_0x2d49('0x24')](respondWithFilteredResult(_0xf7680d,_0x32422b))[_0x2d49('0x3c')](handleError(_0xf7680d,null));};exports['show']=function(_0x56e4be,_0x3b0458){var _0x1efc9e={'raw':!![],'where':{'id':_0x56e4be[_0x2d49('0x3d')]['id']}},_0x3b500e={};_0x3b500e['model']=_['keys'](db['SmsQueueReport'][_0x2d49('0x3e')]);_0x3b500e['query']=_[_0x2d49('0x2b')](_0x56e4be['query']);_0x3b500e['filters']=_[_0x2d49('0x3f')](_0x3b500e[_0x2d49('0x29')],_0x3b500e[_0x2d49('0x2a')]);_0x1efc9e[_0x2d49('0x2e')]=_[_0x2d49('0x3f')](_0x3b500e[_0x2d49('0x29')],qs[_0x2d49('0x2d')](_0x56e4be[_0x2d49('0x2a')]['fields']));_0x1efc9e[_0x2d49('0x2e')]=_0x1efc9e[_0x2d49('0x2e')][_0x2d49('0x2f')]?_0x1efc9e[_0x2d49('0x2e')]:_0x3b500e[_0x2d49('0x29')];if(_0x56e4be['query'][_0x2d49('0x39')]){_0x1efc9e[_0x2d49('0x40')]=[{'all':!![]}];}_0x1efc9e=_[_0x2d49('0x36')]({},_0x1efc9e,_0x56e4be[_0x2d49('0x41')]);return db[_0x2d49('0x27')][_0x2d49('0x42')](_0x1efc9e)[_0x2d49('0x24')](handleEntityNotFound(_0x3b0458,null))['then'](respondWithResult(_0x3b0458,null))[_0x2d49('0x3c')](handleError(_0x3b0458,null));};exports[_0x2d49('0x43')]=function(_0x54fe9e,_0x2f0878){return db[_0x2d49('0x27')][_0x2d49('0x43')](_0x54fe9e[_0x2d49('0x44')],{})[_0x2d49('0x24')](respondWithResult(_0x2f0878,0xc9))[_0x2d49('0x3c')](handleError(_0x2f0878,null));};exports[_0x2d49('0x22')]=function(_0x46163c,_0x128175){if(_0x46163c[_0x2d49('0x44')]['id']){delete _0x46163c[_0x2d49('0x44')]['id'];}return db[_0x2d49('0x27')][_0x2d49('0x42')]({'where':{'id':_0x46163c[_0x2d49('0x3d')]['id']}})[_0x2d49('0x24')](handleEntityNotFound(_0x128175,null))[_0x2d49('0x24')](saveUpdates(_0x46163c['body'],null))['then'](respondWithResult(_0x128175,null))[_0x2d49('0x3c')](handleError(_0x128175,null));};exports[_0x2d49('0x23')]=function(_0x16fb5b,_0x15c49d){return db[_0x2d49('0x27')][_0x2d49('0x42')]({'where':{'id':_0x16fb5b[_0x2d49('0x3d')]['id']}})[_0x2d49('0x24')](handleEntityNotFound(_0x15c49d,null))[_0x2d49('0x24')](removeEntity(_0x15c49d,null))['catch'](handleError(_0x15c49d,null));};exports[_0x2d49('0x45')]=function(_0x51775a,_0x4727ba){return db[_0x2d49('0x27')][_0x2d49('0x45')]()[_0x2d49('0x24')](respondWithResult(_0x4727ba,null))[_0x2d49('0x3c')](handleError(_0x4727ba,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 1659b4a..b75ea27 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2694e3,_0xa0a1ca){var _0x11b411=function(_0x35b956){while(--_0x35b956){_0x2694e3['push'](_0x2694e3['shift']());}};_0x11b411(++_0xa0a1ca);}(_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 logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 309ab0f..bf945f2 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 _0x04eb=['request','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','then','update','raw','where','limit','UpdateSmsQueueReport','lodash','util','moment','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x29461c,_0x10d76f){var _0x401fee=function(_0x490de6){while(--_0x490de6){_0x29461c['push'](_0x29461c['shift']());}};_0x401fee(++_0x10d76f);}(_0x04eb,0x6f));var _0xb04e=function(_0x210082,_0x570890){_0x210082=_0x210082-0x0;var _0x2f95ac=_0x04eb[_0x210082];return _0x2f95ac;};'use strict';var _=require(_0xb04e('0x0'));var util=require(_0xb04e('0x1'));var moment=require(_0xb04e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb04e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb04e('0x4'))('rpc');var config=require(_0xb04e('0x5'));var jayson=require(_0xb04e('0x6'));var client=jayson[_0xb04e('0x7')][_0xb04e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51c130,_0x13b05f,_0x4342c9){return new BPromise(function(_0x15379a,_0x15c413){return client[_0xb04e('0x9')](_0x51c130,_0x4342c9)['then'](function(_0x224bd3){logger['info'](_0xb04e('0xa'),_0x13b05f,_0xb04e('0xb'));logger[_0xb04e('0xc')](_0xb04e('0xd'),_0x13b05f,_0xb04e('0xb'),JSON[_0xb04e('0xe')](_0x224bd3));if(_0x224bd3[_0xb04e('0xf')]){if(_0x224bd3['error']['code']===0x1f4){logger[_0xb04e('0xf')](_0xb04e('0xa'),_0x13b05f,_0x224bd3['error'][_0xb04e('0x10')]);return _0x15c413(_0x224bd3[_0xb04e('0xf')][_0xb04e('0x10')]);}logger[_0xb04e('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x13b05f,_0x224bd3[_0xb04e('0xf')][_0xb04e('0x10')]);return _0x15379a(_0x224bd3[_0xb04e('0xf')][_0xb04e('0x10')]);}else{logger[_0xb04e('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x13b05f,_0xb04e('0xb'));_0x15379a(_0x224bd3['result'][_0xb04e('0x10')]);}})[_0xb04e('0x12')](function(_0x3338a2){logger[_0xb04e('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x13b05f,_0x3338a2);_0x15c413(_0x3338a2);});});}exports[_0xb04e('0x13')]=function(_0x22afa2){var _0x235121=this;return new Promise(function(_0x46b4bb,_0x124f9c){return db[_0xb04e('0x14')][_0xb04e('0x15')](_0x22afa2[_0xb04e('0x16')],{'raw':_0x22afa2['options']?_0x22afa2[_0xb04e('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xb04e('0x18')](function(_0x1cd1fe){logger[_0xb04e('0x11')](_0xb04e('0x13'),_0x22afa2);logger[_0xb04e('0xc')](_0xb04e('0x13'),_0x22afa2,JSON[_0xb04e('0xe')](_0x1cd1fe));_0x46b4bb(_0x1cd1fe);})['catch'](function(_0x1ad734){logger['error'](_0xb04e('0x13'),_0x1ad734[_0xb04e('0x10')],_0x22afa2);_0x124f9c(_0x235121[_0xb04e('0xf')](0x1f4,_0x1ad734[_0xb04e('0x10')]));});});};exports['UpdateSmsQueueReport']=function(_0x437a55){var _0x29d4b2=this;return new Promise(function(_0x577d2d,_0x2c61a5){return db[_0xb04e('0x14')][_0xb04e('0x19')](_0x437a55[_0xb04e('0x16')],{'raw':_0x437a55[_0xb04e('0x17')]?_0x437a55['options'][_0xb04e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x437a55[_0xb04e('0x17')]?_0x437a55['options'][_0xb04e('0x1b')]||null:null,'attributes':_0x437a55['options']?_0x437a55[_0xb04e('0x17')]['attributes']||null:null,'limit':_0x437a55[_0xb04e('0x17')]?_0x437a55[_0xb04e('0x17')][_0xb04e('0x1c')]||null:null})[_0xb04e('0x18')](function(_0xcf0282){logger[_0xb04e('0x11')](_0xb04e('0x1d'),_0x437a55);logger[_0xb04e('0xc')](_0xb04e('0x1d'),_0x437a55,JSON[_0xb04e('0xe')](_0xcf0282));_0x577d2d(_0xcf0282);})['catch'](function(_0x45d9d7){logger[_0xb04e('0xf')](_0xb04e('0x1d'),_0x45d9d7[_0xb04e('0x10')],_0x437a55);_0x2c61a5(_0x29d4b2[_0xb04e('0xf')](0x1f4,_0x45d9d7['message']));});});}; \ No newline at end of file +var _0x9000=['request\x20sent','stringify','error','message','result','create','body','options','raw','then','CreateSmsQueueReport','SmsQueueReport','update','where','attributes','limit','UpdateSmsQueueReport','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0xef367f,_0x4a711d){var _0x55f26a=function(_0x410652){while(--_0x410652){_0xef367f['push'](_0xef367f['shift']());}};_0x55f26a(++_0x4a711d);}(_0x9000,0x170));var _0x0900=function(_0x305b20,_0x5e57e9){_0x305b20=_0x305b20-0x0;var _0x26d64a=_0x9000[_0x305b20];return _0x26d64a;};'use strict';var _=require(_0x0900('0x0'));var util=require('util');var moment=require(_0x0900('0x1'));var BPromise=require(_0x0900('0x2'));var rs=require(_0x0900('0x3'));var fs=require('fs');var Redis=require(_0x0900('0x4'));var db=require(_0x0900('0x5'))['db'];var utils=require(_0x0900('0x6'));var logger=require(_0x0900('0x7'))(_0x0900('0x8'));var config=require('../../config/environment');var jayson=require(_0x0900('0x9'));var client=jayson[_0x0900('0xa')][_0x0900('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3eea62,_0x479fbc,_0x2f1278){return new BPromise(function(_0x23d9d3,_0xe11464){return client[_0x0900('0xc')](_0x3eea62,_0x2f1278)['then'](function(_0x454386){logger[_0x0900('0xd')](_0x0900('0xe'),_0x479fbc,'request\x20sent');logger[_0x0900('0xf')](_0x0900('0x10'),_0x479fbc,_0x0900('0x11'),JSON[_0x0900('0x12')](_0x454386));if(_0x454386[_0x0900('0x13')]){if(_0x454386[_0x0900('0x13')]['code']===0x1f4){logger[_0x0900('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x479fbc,_0x454386[_0x0900('0x13')][_0x0900('0x14')]);return _0xe11464(_0x454386['error']['message']);}logger[_0x0900('0x13')](_0x0900('0xe'),_0x479fbc,_0x454386[_0x0900('0x13')][_0x0900('0x14')]);return _0x23d9d3(_0x454386[_0x0900('0x13')][_0x0900('0x14')]);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x479fbc,'request\x20sent');_0x23d9d3(_0x454386[_0x0900('0x15')][_0x0900('0x14')]);}})['catch'](function(_0x473ed9){logger[_0x0900('0x13')](_0x0900('0xe'),_0x479fbc,_0x473ed9);_0xe11464(_0x473ed9);});});}exports['CreateSmsQueueReport']=function(_0x29e514){var _0x20e8eb=this;return new Promise(function(_0x1140c9,_0x1114b8){return db['SmsQueueReport'][_0x0900('0x16')](_0x29e514[_0x0900('0x17')],{'raw':_0x29e514['options']?_0x29e514[_0x0900('0x18')][_0x0900('0x19')]===undefined?!![]:![]:!![]})[_0x0900('0x1a')](function(_0x42970e){logger[_0x0900('0xd')]('CreateSmsQueueReport',_0x29e514);logger[_0x0900('0xf')](_0x0900('0x1b'),_0x29e514,JSON['stringify'](_0x42970e));_0x1140c9(_0x42970e);})['catch'](function(_0x1c5d7c){logger['error'](_0x0900('0x1b'),_0x1c5d7c['message'],_0x29e514);_0x1114b8(_0x20e8eb[_0x0900('0x13')](0x1f4,_0x1c5d7c[_0x0900('0x14')]));});});};exports['UpdateSmsQueueReport']=function(_0x53fd00){var _0x180fc8=this;return new Promise(function(_0x2840dd,_0x4843b4){return db[_0x0900('0x1c')][_0x0900('0x1d')](_0x53fd00[_0x0900('0x17')],{'raw':_0x53fd00[_0x0900('0x18')]?_0x53fd00[_0x0900('0x18')][_0x0900('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53fd00[_0x0900('0x18')]?_0x53fd00[_0x0900('0x18')][_0x0900('0x1e')]||null:null,'attributes':_0x53fd00[_0x0900('0x18')]?_0x53fd00[_0x0900('0x18')][_0x0900('0x1f')]||null:null,'limit':_0x53fd00[_0x0900('0x18')]?_0x53fd00[_0x0900('0x18')][_0x0900('0x20')]||null:null})[_0x0900('0x1a')](function(_0xbc57ff){logger['info'](_0x0900('0x21'),_0x53fd00);logger[_0x0900('0xf')](_0x0900('0x21'),_0x53fd00,JSON[_0x0900('0x12')](_0xbc57ff));_0x2840dd(_0xbc57ff);})[_0x0900('0x22')](function(_0x554c49){logger['error']('UpdateSmsQueueReport',_0x554c49['message'],_0x53fd00);_0x4843b4(_0x180fc8['error'](0x1f4,_0x554c49[_0x0900('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 7bd6c73..ec53fca 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 _0x3561=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','describe','show','post','create','/:id','delete','destroy'];(function(_0x286917,_0x390246){var _0x3327b3=function(_0x3159d1){while(--_0x3159d1){_0x286917['push'](_0x286917['shift']());}};_0x3327b3(++_0x390246);}(_0x3561,0x94));var _0x1356=function(_0x3493a1,_0x4d7052){_0x3493a1=_0x3493a1-0x0;var _0x22f6c2=_0x3561[_0x3493a1];return _0x22f6c2;};'use strict';var multer=require(_0x1356('0x0'));var util=require('util');var path=require(_0x1356('0x1'));var timeout=require(_0x1356('0x2'));var express=require(_0x1356('0x3'));var router=express[_0x1356('0x4')]();var fs_extra=require(_0x1356('0x5'));var auth=require(_0x1356('0x6'));var interaction=require(_0x1356('0x7'));var config=require(_0x1356('0x8'));var controller=require(_0x1356('0x9'));router[_0x1356('0xa')]('/',auth[_0x1356('0xb')](),controller[_0x1356('0xc')]);router[_0x1356('0xa')]('/describe',auth[_0x1356('0xb')](),controller[_0x1356('0xd')]);router[_0x1356('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x1356('0xe')]);router[_0x1356('0xf')]('/',auth['isAuthenticated'](),controller[_0x1356('0x10')]);router['put'](_0x1356('0x11'),auth[_0x1356('0xb')](),controller['update']);router[_0x1356('0x12')](_0x1356('0x11'),auth['isAuthenticated'](),controller[_0x1356('0x13')]);module[_0x1356('0x14')]=router; \ No newline at end of file +var _0xa23f=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','delete','exports','multer','util','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa23f,0x7c));var _0xfa23=function(_0x58e7cb,_0x3039b0){_0x58e7cb=_0x58e7cb-0x0;var _0x3f8a9b=_0xa23f[_0x58e7cb];return _0x3f8a9b;};'use strict';var multer=require(_0xfa23('0x0'));var util=require(_0xfa23('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfa23('0x2'));var router=express[_0xfa23('0x3')]();var fs_extra=require(_0xfa23('0x4'));var auth=require(_0xfa23('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfa23('0x6'));var controller=require('./smsTransferReport.controller');router[_0xfa23('0x7')]('/',auth[_0xfa23('0x8')](),controller[_0xfa23('0x9')]);router[_0xfa23('0x7')]('/describe',auth[_0xfa23('0x8')](),controller['describe']);router[_0xfa23('0x7')](_0xfa23('0xa'),auth[_0xfa23('0x8')](),controller[_0xfa23('0xb')]);router[_0xfa23('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfa23('0xd')]('/:id',auth[_0xfa23('0x8')](),controller['update']);router[_0xfa23('0xe')](_0xfa23('0xa'),auth[_0xfa23('0x8')](),controller['destroy']);module[_0xfa23('0xf')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index e6d0a88..5618c3b 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x277b55,_0x8ba28){var _0xff0d15=function(_0x1beefc){while(--_0x1beefc){_0x277b55['push'](_0x277b55['shift']());}};_0xff0d15(++_0x8ba28);}(_0x9c44,0x178));var _0x49c4=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x9c44[_0x18ab2a];return _0x16dcee;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x3caa6f,_0x426a72){var _0x5adcda=function(_0x1698cd){while(--_0x1698cd){_0x3caa6f['push'](_0x3caa6f['shift']());}};_0x5adcda(++_0x426a72);}(_0xf4eb,0xec));var _0xbf4e=function(_0x58aa68,_0x3fcc85){_0x58aa68=_0x58aa68-0x0;var _0x5cbedc=_0xf4eb[_0x58aa68];return _0x5cbedc;};'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/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 4ad7570..c43de3b 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 _0x7d10=['sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','send','SmsTransferReport','rawAttributes','fieldName','type','model','map','name','query','keys','filters','intersection','attributes','fields','length','limit','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','params','includeAll','find','create','body','describe','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path'];(function(_0x1ca995,_0x458edc){var _0x6c1cbb=function(_0x109124){while(--_0x109124){_0x1ca995['push'](_0x1ca995['shift']());}};_0x6c1cbb(++_0x458edc);}(_0x7d10,0x1a3));var _0x07d1=function(_0x3aafe9,_0x4a1ea1){_0x3aafe9=_0x3aafe9-0x0;var _0x42c5a9=_0x7d10[_0x3aafe9];return _0x42c5a9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x07d1('0x0'));var jsonpatch=require(_0x07d1('0x1'));var rp=require(_0x07d1('0x2'));var moment=require('moment');var BPromise=require(_0x07d1('0x3'));var Mustache=require(_0x07d1('0x4'));var util=require(_0x07d1('0x5'));var path=require(_0x07d1('0x6'));var sox=require(_0x07d1('0x7'));var csv=require(_0x07d1('0x8'));var ejs=require(_0x07d1('0x9'));var fs=require('fs');var fs_extra=require(_0x07d1('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x07d1('0xb'));var jsforce=require(_0x07d1('0xc'));var deskjs=require(_0x07d1('0xd'));var toCsv=require(_0x07d1('0x8'));var querystring=require('querystring');var Papa=require(_0x07d1('0xe'));var Redis=require(_0x07d1('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x07d1('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x07d1('0x11'))(_0x07d1('0x12'));var utils=require(_0x07d1('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x07d1('0x14'));var db=require(_0x07d1('0x15'))['db'];function respondWithStatusCode(_0x63bd3d,_0xaa2f1e){_0xaa2f1e=_0xaa2f1e||0xcc;return function(_0x2656ce){if(_0x2656ce){return _0x63bd3d[_0x07d1('0x16')](_0xaa2f1e);}return _0x63bd3d['status'](_0xaa2f1e)[_0x07d1('0x17')]();};}function respondWithResult(_0x41bd04,_0xb92ce2){_0xb92ce2=_0xb92ce2||0xc8;return function(_0x5c3a8c){if(_0x5c3a8c){return _0x41bd04[_0x07d1('0x18')](_0xb92ce2)[_0x07d1('0x19')](_0x5c3a8c);}};}function respondWithFilteredResult(_0x888536,_0x346ba2){return function(_0x15ac7e){if(_0x15ac7e){var _0x3c28ac=typeof _0x346ba2['offset']===_0x07d1('0x1a')&&typeof _0x346ba2['limit']==='undefined';var _0x2184b8=_0x15ac7e[_0x07d1('0x1b')];var _0xb21dc=_0x3c28ac?0x0:_0x346ba2[_0x07d1('0x1c')];var _0x437313=_0x3c28ac?_0x15ac7e[_0x07d1('0x1b')]:_0x346ba2[_0x07d1('0x1c')]+_0x346ba2['limit'];var _0x364101;if(_0x437313>=_0x2184b8){_0x437313=_0x2184b8;_0x364101=0xc8;}else{_0x364101=0xce;}_0x888536[_0x07d1('0x18')](_0x364101);return _0x888536[_0x07d1('0x1d')](_0x07d1('0x1e'),_0xb21dc+'-'+_0x437313+'/'+_0x2184b8)[_0x07d1('0x19')](_0x15ac7e);}return null;};}function patchUpdates(_0x14f6f9){return function(_0x171545){try{jsonpatch[_0x07d1('0x1f')](_0x171545,_0x14f6f9,!![]);}catch(_0x50db4c){return BPromise[_0x07d1('0x20')](_0x50db4c);}return _0x171545[_0x07d1('0x21')]();};}function saveUpdates(_0x1c504f,_0x4d159e){return function(_0x6144d){if(_0x6144d){return _0x6144d[_0x07d1('0x22')](_0x1c504f)[_0x07d1('0x23')](function(_0x1d8c28){return _0x1d8c28;});}return null;};}function removeEntity(_0xdbe99b,_0x27599c){return function(_0x481908){if(_0x481908){return _0x481908[_0x07d1('0x24')]()[_0x07d1('0x23')](function(){_0xdbe99b[_0x07d1('0x18')](0xcc)[_0x07d1('0x17')]();});}};}function handleEntityNotFound(_0x39a9c8,_0x18870f){return function(_0x915bef){if(!_0x915bef){_0x39a9c8[_0x07d1('0x16')](0x194);}return _0x915bef;};}function handleError(_0x296437,_0x196a26){_0x196a26=_0x196a26||0x1f4;return function(_0x28a324){logger[_0x07d1('0x25')](_0x28a324['stack']);if(_0x28a324['name']){delete _0x28a324['name'];}_0x296437[_0x07d1('0x18')](_0x196a26)[_0x07d1('0x26')](_0x28a324);};}exports['index']=function(_0x256492,_0x51095f){var _0x5906ad={},_0x4787b2={},_0x296313={'count':0x0,'rows':[]};var _0x36b7cf=_['map'](db[_0x07d1('0x27')][_0x07d1('0x28')],function(_0x2c5393){return{'name':_0x2c5393[_0x07d1('0x29')],'type':_0x2c5393[_0x07d1('0x2a')]['key']};});_0x4787b2[_0x07d1('0x2b')]=_[_0x07d1('0x2c')](_0x36b7cf,_0x07d1('0x2d'));_0x4787b2[_0x07d1('0x2e')]=_[_0x07d1('0x2f')](_0x256492['query']);_0x4787b2[_0x07d1('0x30')]=_[_0x07d1('0x31')](_0x4787b2[_0x07d1('0x2b')],_0x4787b2[_0x07d1('0x2e')]);_0x5906ad[_0x07d1('0x32')]=_['intersection'](_0x4787b2[_0x07d1('0x2b')],qs[_0x07d1('0x33')](_0x256492['query'][_0x07d1('0x33')]));_0x5906ad[_0x07d1('0x32')]=_0x5906ad['attributes'][_0x07d1('0x34')]?_0x5906ad[_0x07d1('0x32')]:_0x4787b2[_0x07d1('0x2b')];if(!_0x256492['query']['hasOwnProperty']('nolimit')){_0x5906ad[_0x07d1('0x35')]=qs[_0x07d1('0x35')](_0x256492[_0x07d1('0x2e')][_0x07d1('0x35')]);_0x5906ad[_0x07d1('0x1c')]=qs[_0x07d1('0x1c')](_0x256492[_0x07d1('0x2e')]['offset']);}_0x5906ad['order']=qs[_0x07d1('0x36')](_0x256492[_0x07d1('0x2e')][_0x07d1('0x36')]);_0x5906ad['where']=qs[_0x07d1('0x30')](_[_0x07d1('0x37')](_0x256492[_0x07d1('0x2e')],_0x4787b2[_0x07d1('0x30')]),_0x36b7cf);if(_0x256492[_0x07d1('0x2e')][_0x07d1('0x38')]){_0x5906ad[_0x07d1('0x39')]=_['merge'](_0x5906ad[_0x07d1('0x39')],{'$or':_['map'](_0x36b7cf,function(_0x338203){if(_0x338203[_0x07d1('0x2a')]!==_0x07d1('0x3a')){var _0x4eaabf={};_0x4eaabf[_0x338203[_0x07d1('0x2d')]]={'$like':'%'+_0x256492[_0x07d1('0x2e')][_0x07d1('0x38')]+'%'};return _0x4eaabf;}})});}_0x5906ad=_[_0x07d1('0x3b')]({},_0x5906ad,_0x256492[_0x07d1('0x3c')]);var _0x3bf35a={'where':_0x5906ad[_0x07d1('0x39')]};return db[_0x07d1('0x27')][_0x07d1('0x1b')](_0x3bf35a)[_0x07d1('0x23')](function(_0x3d53a8){_0x296313[_0x07d1('0x1b')]=_0x3d53a8;if(_0x256492[_0x07d1('0x2e')]['includeAll']){_0x5906ad[_0x07d1('0x3d')]=[{'all':!![]}];}return db[_0x07d1('0x27')][_0x07d1('0x3e')](_0x5906ad);})[_0x07d1('0x23')](function(_0x53a905){_0x296313[_0x07d1('0x3f')]=_0x53a905;return _0x296313;})[_0x07d1('0x23')](respondWithFilteredResult(_0x51095f,_0x5906ad))[_0x07d1('0x40')](handleError(_0x51095f,null));};exports['show']=function(_0xaa2214,_0x23eb79){var _0x9c8389={'raw':!![],'where':{'id':_0xaa2214[_0x07d1('0x41')]['id']}},_0x1c4f09={};_0x1c4f09[_0x07d1('0x2b')]=_[_0x07d1('0x2f')](db['SmsTransferReport'][_0x07d1('0x28')]);_0x1c4f09['query']=_[_0x07d1('0x2f')](_0xaa2214[_0x07d1('0x2e')]);_0x1c4f09[_0x07d1('0x30')]=_[_0x07d1('0x31')](_0x1c4f09[_0x07d1('0x2b')],_0x1c4f09[_0x07d1('0x2e')]);_0x9c8389[_0x07d1('0x32')]=_[_0x07d1('0x31')](_0x1c4f09[_0x07d1('0x2b')],qs[_0x07d1('0x33')](_0xaa2214[_0x07d1('0x2e')]['fields']));_0x9c8389['attributes']=_0x9c8389[_0x07d1('0x32')][_0x07d1('0x34')]?_0x9c8389[_0x07d1('0x32')]:_0x1c4f09[_0x07d1('0x2b')];if(_0xaa2214[_0x07d1('0x2e')][_0x07d1('0x42')]){_0x9c8389[_0x07d1('0x3d')]=[{'all':!![]}];}_0x9c8389=_['merge']({},_0x9c8389,_0xaa2214[_0x07d1('0x3c')]);return db[_0x07d1('0x27')][_0x07d1('0x43')](_0x9c8389)[_0x07d1('0x23')](handleEntityNotFound(_0x23eb79,null))[_0x07d1('0x23')](respondWithResult(_0x23eb79,null))[_0x07d1('0x40')](handleError(_0x23eb79,null));};exports['create']=function(_0x262f95,_0x4c1366){return db['SmsTransferReport'][_0x07d1('0x44')](_0x262f95[_0x07d1('0x45')],{})[_0x07d1('0x23')](respondWithResult(_0x4c1366,0xc9))[_0x07d1('0x40')](handleError(_0x4c1366,null));};exports['update']=function(_0x429a01,_0x55514c){if(_0x429a01[_0x07d1('0x45')]['id']){delete _0x429a01[_0x07d1('0x45')]['id'];}return db['SmsTransferReport'][_0x07d1('0x43')]({'where':{'id':_0x429a01['params']['id']}})[_0x07d1('0x23')](handleEntityNotFound(_0x55514c,null))[_0x07d1('0x23')](saveUpdates(_0x429a01['body'],null))[_0x07d1('0x23')](respondWithResult(_0x55514c,null))[_0x07d1('0x40')](handleError(_0x55514c,null));};exports[_0x07d1('0x24')]=function(_0x31448d,_0x5eec85){return db[_0x07d1('0x27')][_0x07d1('0x43')]({'where':{'id':_0x31448d[_0x07d1('0x41')]['id']}})['then'](handleEntityNotFound(_0x5eec85,null))[_0x07d1('0x23')](removeEntity(_0x5eec85,null))[_0x07d1('0x40')](handleError(_0x5eec85,null));};exports[_0x07d1('0x46')]=function(_0x2fad12,_0x567705){return db['SmsTransferReport'][_0x07d1('0x46')]()[_0x07d1('0x23')](respondWithResult(_0x567705,null))[_0x07d1('0x40')](handleError(_0x567705,null));}; \ No newline at end of file +var _0x7468=['fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','find','catch','create','body','describe','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','SmsTransferReport','rawAttributes'];(function(_0x359bbe,_0x5b7fcc){var _0x1b3353=function(_0x34b41c){while(--_0x34b41c){_0x359bbe['push'](_0x359bbe['shift']());}};_0x1b3353(++_0x5b7fcc);}(_0x7468,0x13c));var _0x8746=function(_0x272e15,_0x12940b){_0x272e15=_0x272e15-0x0;var _0x51f856=_0x7468[_0x272e15];return _0x51f856;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8746('0x0'));var zipdir=require(_0x8746('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8746('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8746('0x3'));var util=require(_0x8746('0x4'));var path=require(_0x8746('0x5'));var sox=require(_0x8746('0x6'));var csv=require(_0x8746('0x7'));var ejs=require(_0x8746('0x8'));var fs=require('fs');var fs_extra=require(_0x8746('0x9'));var _=require('lodash');var squel=require(_0x8746('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8746('0xb'));var toCsv=require(_0x8746('0x7'));var querystring=require(_0x8746('0xc'));var Papa=require('papaparse');var Redis=require(_0x8746('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x8746('0xe'));var as=require(_0x8746('0xf'));var hardwareService=require(_0x8746('0x10'));var logger=require('../../config/logger')(_0x8746('0x11'));var utils=require(_0x8746('0x12'));var config=require(_0x8746('0x13'));var licenseUtil=require(_0x8746('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b4227,_0x45da3c){_0x45da3c=_0x45da3c||0xcc;return function(_0x552260){if(_0x552260){return _0x2b4227[_0x8746('0x15')](_0x45da3c);}return _0x2b4227[_0x8746('0x16')](_0x45da3c)['end']();};}function respondWithResult(_0x2806ea,_0x294ffa){_0x294ffa=_0x294ffa||0xc8;return function(_0x4f3e29){if(_0x4f3e29){return _0x2806ea[_0x8746('0x16')](_0x294ffa)[_0x8746('0x17')](_0x4f3e29);}};}function respondWithFilteredResult(_0x472392,_0x3a4419){return function(_0x823146){if(_0x823146){var _0x1edbc8=typeof _0x3a4419[_0x8746('0x18')]===_0x8746('0x19')&&typeof _0x3a4419[_0x8746('0x1a')]==='undefined';var _0x135474=_0x823146['count'];var _0x14049f=_0x1edbc8?0x0:_0x3a4419['offset'];var _0x593f3c=_0x1edbc8?_0x823146[_0x8746('0x1b')]:_0x3a4419[_0x8746('0x18')]+_0x3a4419[_0x8746('0x1a')];var _0x5e102d;if(_0x593f3c>=_0x135474){_0x593f3c=_0x135474;_0x5e102d=0xc8;}else{_0x5e102d=0xce;}_0x472392[_0x8746('0x16')](_0x5e102d);return _0x472392[_0x8746('0x1c')](_0x8746('0x1d'),_0x14049f+'-'+_0x593f3c+'/'+_0x135474)[_0x8746('0x17')](_0x823146);}return null;};}function patchUpdates(_0x3137ec){return function(_0x967cb8){try{jsonpatch[_0x8746('0x1e')](_0x967cb8,_0x3137ec,!![]);}catch(_0x1bbfc8){return BPromise[_0x8746('0x1f')](_0x1bbfc8);}return _0x967cb8['save']();};}function saveUpdates(_0x4da788,_0x21e3ce){return function(_0x16a32c){if(_0x16a32c){return _0x16a32c[_0x8746('0x20')](_0x4da788)[_0x8746('0x21')](function(_0x5f5676){return _0x5f5676;});}return null;};}function removeEntity(_0x3467c6,_0x5baff9){return function(_0x14902e){if(_0x14902e){return _0x14902e[_0x8746('0x22')]()['then'](function(){_0x3467c6[_0x8746('0x16')](0xcc)[_0x8746('0x23')]();});}};}function handleEntityNotFound(_0x5dcd55,_0x5bfed8){return function(_0x40103f){if(!_0x40103f){_0x5dcd55['sendStatus'](0x194);}return _0x40103f;};}function handleError(_0x42eba7,_0x32e82f){_0x32e82f=_0x32e82f||0x1f4;return function(_0x1bab45){logger[_0x8746('0x24')](_0x1bab45[_0x8746('0x25')]);if(_0x1bab45['name']){delete _0x1bab45[_0x8746('0x26')];}_0x42eba7[_0x8746('0x16')](_0x32e82f)[_0x8746('0x27')](_0x1bab45);};}exports[_0x8746('0x28')]=function(_0x4d9070,_0x46c6f7){var _0x296cd9={},_0x337331={},_0xe16f35={'count':0x0,'rows':[]};var _0x192103=_[_0x8746('0x29')](db[_0x8746('0x2a')][_0x8746('0x2b')],function(_0x429c65){return{'name':_0x429c65[_0x8746('0x2c')],'type':_0x429c65[_0x8746('0x2d')][_0x8746('0x2e')]};});_0x337331[_0x8746('0x2f')]=_[_0x8746('0x29')](_0x192103,_0x8746('0x26'));_0x337331['query']=_[_0x8746('0x30')](_0x4d9070[_0x8746('0x31')]);_0x337331[_0x8746('0x32')]=_['intersection'](_0x337331[_0x8746('0x2f')],_0x337331[_0x8746('0x31')]);_0x296cd9[_0x8746('0x33')]=_[_0x8746('0x34')](_0x337331[_0x8746('0x2f')],qs[_0x8746('0x35')](_0x4d9070[_0x8746('0x31')][_0x8746('0x35')]));_0x296cd9['attributes']=_0x296cd9[_0x8746('0x33')]['length']?_0x296cd9[_0x8746('0x33')]:_0x337331[_0x8746('0x2f')];if(!_0x4d9070['query'][_0x8746('0x36')]('nolimit')){_0x296cd9[_0x8746('0x1a')]=qs[_0x8746('0x1a')](_0x4d9070['query'][_0x8746('0x1a')]);_0x296cd9[_0x8746('0x18')]=qs['offset'](_0x4d9070[_0x8746('0x31')][_0x8746('0x18')]);}_0x296cd9[_0x8746('0x37')]=qs[_0x8746('0x38')](_0x4d9070[_0x8746('0x31')][_0x8746('0x38')]);_0x296cd9[_0x8746('0x39')]=qs[_0x8746('0x32')](_[_0x8746('0x3a')](_0x4d9070[_0x8746('0x31')],_0x337331[_0x8746('0x32')]),_0x192103);if(_0x4d9070['query'][_0x8746('0x3b')]){_0x296cd9[_0x8746('0x39')]=_['merge'](_0x296cd9[_0x8746('0x39')],{'$or':_[_0x8746('0x29')](_0x192103,function(_0x25c12e){if(_0x25c12e['type']!=='VIRTUAL'){var _0x3e6913={};_0x3e6913[_0x25c12e['name']]={'$like':'%'+_0x4d9070[_0x8746('0x31')][_0x8746('0x3b')]+'%'};return _0x3e6913;}})});}_0x296cd9=_[_0x8746('0x3c')]({},_0x296cd9,_0x4d9070[_0x8746('0x3d')]);var _0x1a86d1={'where':_0x296cd9[_0x8746('0x39')]};return db[_0x8746('0x2a')][_0x8746('0x1b')](_0x1a86d1)['then'](function(_0x1f0e70){_0xe16f35['count']=_0x1f0e70;if(_0x4d9070[_0x8746('0x31')][_0x8746('0x3e')]){_0x296cd9[_0x8746('0x3f')]=[{'all':!![]}];}return db[_0x8746('0x2a')][_0x8746('0x40')](_0x296cd9);})[_0x8746('0x21')](function(_0x11a857){_0xe16f35['rows']=_0x11a857;return _0xe16f35;})[_0x8746('0x21')](respondWithFilteredResult(_0x46c6f7,_0x296cd9))['catch'](handleError(_0x46c6f7,null));};exports[_0x8746('0x41')]=function(_0x4db034,_0x5b1d33){var _0x3085ca={'raw':!![],'where':{'id':_0x4db034[_0x8746('0x42')]['id']}},_0x527ce1={};_0x527ce1['model']=_[_0x8746('0x30')](db[_0x8746('0x2a')]['rawAttributes']);_0x527ce1[_0x8746('0x31')]=_[_0x8746('0x30')](_0x4db034[_0x8746('0x31')]);_0x527ce1[_0x8746('0x32')]=_['intersection'](_0x527ce1[_0x8746('0x2f')],_0x527ce1[_0x8746('0x31')]);_0x3085ca['attributes']=_[_0x8746('0x34')](_0x527ce1[_0x8746('0x2f')],qs['fields'](_0x4db034['query']['fields']));_0x3085ca[_0x8746('0x33')]=_0x3085ca[_0x8746('0x33')]['length']?_0x3085ca[_0x8746('0x33')]:_0x527ce1[_0x8746('0x2f')];if(_0x4db034[_0x8746('0x31')][_0x8746('0x3e')]){_0x3085ca['include']=[{'all':!![]}];}_0x3085ca=_[_0x8746('0x3c')]({},_0x3085ca,_0x4db034[_0x8746('0x3d')]);return db[_0x8746('0x2a')][_0x8746('0x43')](_0x3085ca)[_0x8746('0x21')](handleEntityNotFound(_0x5b1d33,null))[_0x8746('0x21')](respondWithResult(_0x5b1d33,null))[_0x8746('0x44')](handleError(_0x5b1d33,null));};exports['create']=function(_0x219d45,_0x268a8e){return db[_0x8746('0x2a')][_0x8746('0x45')](_0x219d45[_0x8746('0x46')],{})[_0x8746('0x21')](respondWithResult(_0x268a8e,0xc9))['catch'](handleError(_0x268a8e,null));};exports[_0x8746('0x20')]=function(_0x1e9b33,_0x2b06bc){if(_0x1e9b33[_0x8746('0x46')]['id']){delete _0x1e9b33['body']['id'];}return db[_0x8746('0x2a')][_0x8746('0x43')]({'where':{'id':_0x1e9b33['params']['id']}})[_0x8746('0x21')](handleEntityNotFound(_0x2b06bc,null))[_0x8746('0x21')](saveUpdates(_0x1e9b33[_0x8746('0x46')],null))[_0x8746('0x21')](respondWithResult(_0x2b06bc,null))[_0x8746('0x44')](handleError(_0x2b06bc,null));};exports[_0x8746('0x22')]=function(_0x29a1a7,_0x35efd4){return db['SmsTransferReport'][_0x8746('0x43')]({'where':{'id':_0x29a1a7['params']['id']}})['then'](handleEntityNotFound(_0x35efd4,null))['then'](removeEntity(_0x35efd4,null))[_0x8746('0x44')](handleError(_0x35efd4,null));};exports[_0x8746('0x47')]=function(_0x10d5b3,_0xbca618){return db['SmsTransferReport']['describe']()[_0x8746('0x21')](respondWithResult(_0xbca618,null))[_0x8746('0x44')](handleError(_0xbca618,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 1e14f30..ebe26bd 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 _0x320e=['request-promise','path','../../config/environment','./smsTransferReport.attributes','exports','define','report_sms_transfer','uniqueid','lodash','moment','bluebird'];(function(_0x175fc7,_0x545448){var _0x39335c=function(_0x2c412e){while(--_0x2c412e){_0x175fc7['push'](_0x175fc7['shift']());}};_0x39335c(++_0x545448);}(_0x320e,0x8c));var _0xe320=function(_0x27926c,_0x37d579){_0x27926c=_0x27926c-0x0;var _0x584578=_0x320e[_0x27926c];return _0x584578;};'use strict';var _=require(_0xe320('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe320('0x1'));var BPromise=require(_0xe320('0x2'));var rp=require(_0xe320('0x3'));var fs=require('fs');var path=require(_0xe320('0x4'));var rimraf=require('rimraf');var config=require(_0xe320('0x5'));var attributes=require(_0xe320('0x6'));module[_0xe320('0x7')]=function(_0x3f4b14,_0x436712){return _0x3f4b14[_0xe320('0x8')]('SmsTransferReport',attributes,{'tableName':_0xe320('0x9'),'paranoid':![],'indexes':[{'name':_0xe320('0xa'),'fields':[_0xe320('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x90a8=['../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x13d5a3,_0x4fe4ec){var _0xf5e40d=function(_0x240fe2){while(--_0x240fe2){_0x13d5a3['push'](_0x13d5a3['shift']());}};_0xf5e40d(++_0x4fe4ec);}(_0x90a8,0x11a));var _0x890a=function(_0x385555,_0x20e47a){_0x385555=_0x385555-0x0;var _0x22474b=_0x90a8[_0x385555];return _0x22474b;};'use strict';var _=require('lodash');var util=require(_0x890a('0x0'));var logger=require(_0x890a('0x1'))('api');var moment=require(_0x890a('0x2'));var BPromise=require(_0x890a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x890a('0x4'));var rimraf=require(_0x890a('0x5'));var config=require(_0x890a('0x6'));var attributes=require(_0x890a('0x7'));module[_0x890a('0x8')]=function(_0x114346,_0x4780d0){return _0x114346[_0x890a('0x9')](_0x890a('0xa'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x890a('0xb'),'fields':[_0x890a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 0cf67e0..9910b91 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 _0x29d4=['request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsTransferReport,\x20%s,\x20%s'];(function(_0x31a99e,_0x4beb2b){var _0x245fe2=function(_0x185126){while(--_0x185126){_0x31a99e['push'](_0x31a99e['shift']());}};_0x245fe2(++_0x4beb2b);}(_0x29d4,0x1a1));var _0x429d=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x29d4[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x429d('0x0'));var util=require('util');var moment=require(_0x429d('0x1'));var BPromise=require(_0x429d('0x2'));var rs=require(_0x429d('0x3'));var fs=require('fs');var Redis=require(_0x429d('0x4'));var db=require(_0x429d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x429d('0x6'))(_0x429d('0x7'));var config=require(_0x429d('0x8'));var jayson=require(_0x429d('0x9'));var client=jayson[_0x429d('0xa')][_0x429d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56aa2f,_0x1ede3f,_0x4befb9){return new BPromise(function(_0x9fc337,_0x47cb29){return client[_0x429d('0xc')](_0x56aa2f,_0x4befb9)[_0x429d('0xd')](function(_0xe6f5b4){logger['info'](_0x429d('0xe'),_0x1ede3f,_0x429d('0xf'));logger['debug'](_0x429d('0x10'),_0x1ede3f,_0x429d('0xf'),JSON[_0x429d('0x11')](_0xe6f5b4));if(_0xe6f5b4['error']){if(_0xe6f5b4[_0x429d('0x12')][_0x429d('0x13')]===0x1f4){logger[_0x429d('0x12')](_0x429d('0xe'),_0x1ede3f,_0xe6f5b4['error'][_0x429d('0x14')]);return _0x47cb29(_0xe6f5b4[_0x429d('0x12')][_0x429d('0x14')]);}logger['error'](_0x429d('0xe'),_0x1ede3f,_0xe6f5b4[_0x429d('0x12')]['message']);return _0x9fc337(_0xe6f5b4[_0x429d('0x12')][_0x429d('0x14')]);}else{logger[_0x429d('0x15')](_0x429d('0xe'),_0x1ede3f,_0x429d('0xf'));_0x9fc337(_0xe6f5b4[_0x429d('0x16')]['message']);}})[_0x429d('0x17')](function(_0x53d19d){logger[_0x429d('0x12')](_0x429d('0xe'),_0x1ede3f,_0x53d19d);_0x47cb29(_0x53d19d);});});} \ No newline at end of file +var _0x30bc=['SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SmsTransferReport,\x20%s,\x20%s'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x30bc,0x149));var _0xc30b=function(_0xfd5211,_0x490686){_0xfd5211=_0xfd5211-0x0;var _0x19797d=_0x30bc[_0xfd5211];return _0x19797d;};'use strict';var _=require(_0xc30b('0x0'));var util=require(_0xc30b('0x1'));var moment=require(_0xc30b('0x2'));var BPromise=require('bluebird');var rs=require(_0xc30b('0x3'));var fs=require('fs');var Redis=require(_0xc30b('0x4'));var db=require(_0xc30b('0x5'))['db'];var utils=require(_0xc30b('0x6'));var logger=require(_0xc30b('0x7'))(_0xc30b('0x8'));var config=require(_0xc30b('0x9'));var jayson=require(_0xc30b('0xa'));var client=jayson[_0xc30b('0xb')][_0xc30b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5dff10,_0x2f7826,_0x1aca07){return new BPromise(function(_0x25e199,_0x1c912d){return client['request'](_0x5dff10,_0x1aca07)[_0xc30b('0xd')](function(_0x5b5055){logger[_0xc30b('0xe')](_0xc30b('0xf'),_0x2f7826,'request\x20sent');logger['debug'](_0xc30b('0x10'),_0x2f7826,_0xc30b('0x11'),JSON[_0xc30b('0x12')](_0x5b5055));if(_0x5b5055[_0xc30b('0x13')]){if(_0x5b5055[_0xc30b('0x13')][_0xc30b('0x14')]===0x1f4){logger['error'](_0xc30b('0xf'),_0x2f7826,_0x5b5055[_0xc30b('0x13')]['message']);return _0x1c912d(_0x5b5055[_0xc30b('0x13')][_0xc30b('0x15')]);}logger['error'](_0xc30b('0xf'),_0x2f7826,_0x5b5055['error']['message']);return _0x25e199(_0x5b5055['error'][_0xc30b('0x15')]);}else{logger['info'](_0xc30b('0xf'),_0x2f7826,_0xc30b('0x11'));_0x25e199(_0x5b5055[_0xc30b('0x16')][_0xc30b('0x15')]);}})['catch'](function(_0xff2b55){logger[_0xc30b('0x13')](_0xc30b('0xf'),_0x2f7826,_0xff2b55);_0x1c912d(_0xff2b55);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index e4a5845..11b53a6 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 _0xa2c8=['index','show','diskStorage','join','root','server/files/sounds/original/','originalname','format','%s-%s%s','now','extname','file','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated'];(function(_0x2e5cfd,_0x3e18a1){var _0x171636=function(_0xdf3162){while(--_0xdf3162){_0x2e5cfd['push'](_0x2e5cfd['shift']());}};_0x171636(++_0x3e18a1);}(_0xa2c8,0x99));var _0x8a2c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa2c8[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x8a2c('0x0'));var util=require(_0x8a2c('0x1'));var path=require(_0x8a2c('0x2'));var timeout=require(_0x8a2c('0x3'));var express=require(_0x8a2c('0x4'));var router=express[_0x8a2c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8a2c('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./sound.controller');router[_0x8a2c('0x7')]('/',auth[_0x8a2c('0x8')](),controller[_0x8a2c('0x9')]);router[_0x8a2c('0x7')]('/:id',auth[_0x8a2c('0x8')](),controller[_0x8a2c('0xa')]);router[_0x8a2c('0x7')]('/:id/download',auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0x8a2c('0xb')]({'destination':function(_0x29071b,_0x4e31b5,_0x1da83c){_0x1da83c(null,path[_0x8a2c('0xc')](config[_0x8a2c('0xd')],_0x8a2c('0xe')));},'filename':function(_0x1fc918,_0xab22e4,_0x5b4fcb){_0xab22e4[_0x8a2c('0xf')]=_0xab22e4[_0x8a2c('0xf')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5b4fcb(null,util[_0x8a2c('0x10')](_0x8a2c('0x11'),path['basename'](_0xab22e4['originalname'],path['extname'](_0xab22e4['originalname'])),Date[_0x8a2c('0x12')](),path[_0x8a2c('0x13')](_0xab22e4[_0x8a2c('0xf')])));}})});router['post']('/',upload['single'](_0x8a2c('0x14')),controller[_0x8a2c('0x15')]);router[_0x8a2c('0x16')](_0x8a2c('0x17'),auth[_0x8a2c('0x8')](),controller[_0x8a2c('0x18')]);router[_0x8a2c('0x19')](_0x8a2c('0x17'),auth['isAuthenticated'](),controller['delete']);module[_0x8a2c('0x1a')]=router; \ No newline at end of file +var _0x38b1=['create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','index','get','/:id','show','/:id/download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','now','extname','single'];(function(_0x45fe9c,_0x55e0d7){var _0x233d48=function(_0xa2ba2e){while(--_0xa2ba2e){_0x45fe9c['push'](_0x45fe9c['shift']());}};_0x233d48(++_0x55e0d7);}(_0x38b1,0xec));var _0x138b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x38b1[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x138b('0x0'));var util=require(_0x138b('0x1'));var path=require(_0x138b('0x2'));var timeout=require(_0x138b('0x3'));var express=require(_0x138b('0x4'));var router=express[_0x138b('0x5')]();var fs_extra=require(_0x138b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x138b('0x7'));var config=require(_0x138b('0x8'));var controller=require(_0x138b('0x9'));router['get']('/',auth[_0x138b('0xa')](),controller[_0x138b('0xb')]);router[_0x138b('0xc')](_0x138b('0xd'),auth[_0x138b('0xa')](),controller[_0x138b('0xe')]);router[_0x138b('0xc')](_0x138b('0xf'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0x138b('0x10')]({'destination':function(_0x29f685,_0x414f84,_0x1885e8){_0x1885e8(null,path[_0x138b('0x11')](config[_0x138b('0x12')],_0x138b('0x13')));},'filename':function(_0x4768da,_0x1aff55,_0x323611){_0x1aff55[_0x138b('0x14')]=_0x1aff55[_0x138b('0x14')][_0x138b('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x323611(null,util[_0x138b('0x16')](_0x138b('0x17'),path[_0x138b('0x18')](_0x1aff55['originalname'],path['extname'](_0x1aff55[_0x138b('0x14')])),Date[_0x138b('0x19')](),path[_0x138b('0x1a')](_0x1aff55['originalname'])));}})});router['post']('/',upload[_0x138b('0x1b')]('file'),controller[_0x138b('0x1c')]);router[_0x138b('0x1d')](_0x138b('0xd'),auth[_0x138b('0xa')](),controller[_0x138b('0x1e')]);router[_0x138b('0x1f')]('/:id',auth[_0x138b('0xa')](),controller[_0x138b('0x1f')]);module[_0x138b('0x20')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 63de4fd..54bddd1 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 _0x8369=['exports','name','STRING','FLOAT','BIGINT','INTEGER'];(function(_0x1fa470,_0x20539d){var _0x28c4dd=function(_0x1b04e4){while(--_0x1b04e4){_0x1fa470['push'](_0x1fa470['shift']());}};_0x28c4dd(++_0x20539d);}(_0x8369,0x1e6));var _0x9836=function(_0x446666,_0x3e4543){_0x446666=_0x446666-0x0;var _0x120e29=_0x8369[_0x446666];return _0x120e29;};'use strict';var Sequelize=require('sequelize');module[_0x9836('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x9836('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0x9836('0x2')]},'display_name':{'type':Sequelize[_0x9836('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x9836('0x2')]},'original_format':{'type':Sequelize[_0x9836('0x2')]},'original_duration':{'type':Sequelize[_0x9836('0x3')]},'original_sampleCount':{'type':Sequelize[_0x9836('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x9836('0x4')]},'original_sampleRate':{'type':Sequelize[_0x9836('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x9836('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x9836('0x4')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x27e2=['STRING','FLOAT','BIGINT','INTEGER','sequelize','exports'];(function(_0x591e0c,_0x37e294){var _0x317424=function(_0x1c8c58){while(--_0x1c8c58){_0x591e0c['push'](_0x591e0c['shift']());}};_0x317424(++_0x37e294);}(_0x27e2,0x7c));var _0x227e=function(_0x484582,_0x5898d2){_0x484582=_0x484582-0x0;var _0x3958d1=_0x27e2[_0x484582];return _0x3958d1;};'use strict';var Sequelize=require(_0x227e('0x0'));module[_0x227e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x227e('0x2')]},'display_name':{'type':Sequelize[_0x227e('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x227e('0x2')]},'original_format':{'type':Sequelize[_0x227e('0x2')]},'original_duration':{'type':Sequelize[_0x227e('0x3')]},'original_sampleCount':{'type':Sequelize[_0x227e('0x4')]},'original_channelCount':{'type':Sequelize[_0x227e('0x5')]},'original_bitRate':{'type':Sequelize[_0x227e('0x4')]},'original_sampleRate':{'type':Sequelize[_0x227e('0x5')]},'converted_format':{'type':Sequelize[_0x227e('0x2')]},'converted_duration':{'type':Sequelize[_0x227e('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x227e('0x5')]},'converted_bitRate':{'type':Sequelize[_0x227e('0x4')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 0914763..645fec9 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 _0x39ef=['converted_bitRate','converted_sampleRate','body','userProfileId','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','original_format','eml-format','bluebird','util','path','sox','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','update','destroy','then','get','Sounds','UserProfileResource','error','name','map','Sound','rawAttributes','type','key','model','keys','filters','query','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','include','options','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','format','%s.%s','create','file','originalname','extname','basename','filename','substring','wav','server/files/sounds/original','info','chmodSync','0777','unlinkSync','send','src','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount'];(function(_0x3ad338,_0x4ee52b){var _0x2576e2=function(_0xe96331){while(--_0xe96331){_0x3ad338['push'](_0x3ad338['shift']());}};_0x2576e2(++_0x4ee52b);}(_0x39ef,0x1c3));var _0xf39e=function(_0x1fa68b,_0x152e4e){_0x1fa68b=_0x1fa68b-0x0;var _0x32a3c6=_0x39ef[_0x1fa68b];return _0x32a3c6;};'use strict';var emlformat=require(_0xf39e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf39e('0x1'));var Mustache=require('mustache');var util=require(_0xf39e('0x2'));var path=require(_0xf39e('0x3'));var sox=require(_0xf39e('0x4'));var csv=require('to-csv');var ejs=require(_0xf39e('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf39e('0x6'));var crypto=require(_0xf39e('0x7'));var jsforce=require(_0xf39e('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf39e('0x9'));var Papa=require(_0xf39e('0xa'));var Redis=require(_0xf39e('0xb'));var authService=require(_0xf39e('0xc'));var qs=require(_0xf39e('0xd'));var as=require(_0xf39e('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf39e('0xf'))('api');var utils=require(_0xf39e('0x10'));var config=require(_0xf39e('0x11'));var licenseUtil=require(_0xf39e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7cfd27,_0x5cff72){_0x5cff72=_0x5cff72||0xcc;return function(_0x25a7cf){if(_0x25a7cf){return _0x7cfd27[_0xf39e('0x13')](_0x5cff72);}return _0x7cfd27[_0xf39e('0x14')](_0x5cff72)[_0xf39e('0x15')]();};}function respondWithResult(_0x460c48,_0x4700f2){_0x4700f2=_0x4700f2||0xc8;return function(_0x510e6d){if(_0x510e6d){return _0x460c48['status'](_0x4700f2)[_0xf39e('0x16')](_0x510e6d);}};}function respondWithFilteredResult(_0x57f8c1,_0x22a69b){return function(_0x20e7d4){if(_0x20e7d4){var _0x4829ac=typeof _0x22a69b[_0xf39e('0x17')]===_0xf39e('0x18')&&typeof _0x22a69b[_0xf39e('0x19')]===_0xf39e('0x18');var _0x4934ac=_0x20e7d4[_0xf39e('0x1a')];var _0x333a84=_0x4829ac?0x0:_0x22a69b['offset'];var _0x4daf61=_0x4829ac?_0x20e7d4[_0xf39e('0x1a')]:_0x22a69b['offset']+_0x22a69b['limit'];var _0x3cdf02;if(_0x4daf61>=_0x4934ac){_0x4daf61=_0x4934ac;_0x3cdf02=0xc8;}else{_0x3cdf02=0xce;}_0x57f8c1['status'](_0x3cdf02);return _0x57f8c1['set']('Content-Range',_0x333a84+'-'+_0x4daf61+'/'+_0x4934ac)['json'](_0x20e7d4);}return null;};}function patchUpdates(_0x427f65){return function(_0x2211cd){try{jsonpatch['apply'](_0x2211cd,_0x427f65,!![]);}catch(_0x382253){return BPromise[_0xf39e('0x1b')](_0x382253);}return _0x2211cd[_0xf39e('0x1c')]();};}function saveUpdates(_0x3ab65e,_0x3a0dce){return function(_0x3188d8){if(_0x3188d8){return _0x3188d8[_0xf39e('0x1d')](_0x3ab65e)['then'](function(_0x2adcb5){return _0x2adcb5;});}return null;};}function removeEntity(_0x557a1e,_0x46e3fa){return function(_0x4f4e07){if(_0x4f4e07){return _0x4f4e07[_0xf39e('0x1e')]()[_0xf39e('0x1f')](function(){var _0x4292c8=_0x4f4e07[_0xf39e('0x20')]({'plain':!![]});var _0x4ee8e8=_0xf39e('0x21');return db[_0xf39e('0x22')][_0xf39e('0x1e')]({'where':{'type':_0x4ee8e8,'resourceId':_0x4292c8['id']}})['then'](function(){return _0x4f4e07;});})['then'](function(){_0x557a1e[_0xf39e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9c6d63,_0x3d8cd0){return function(_0x165197){if(!_0x165197){_0x9c6d63[_0xf39e('0x13')](0x194);}return _0x165197;};}function handleError(_0x468439,_0xfd7801){_0xfd7801=_0xfd7801||0x1f4;return function(_0x3f5a80){logger[_0xf39e('0x23')](_0x3f5a80['stack']);if(_0x3f5a80['name']){delete _0x3f5a80[_0xf39e('0x24')];}_0x468439[_0xf39e('0x14')](_0xfd7801)['send'](_0x3f5a80);};}exports['index']=function(_0x1bcedf,_0x22cd00){var _0x4f6f3a={},_0x363320={},_0x3cdeb3={'count':0x0,'rows':[]};var _0x2c50a9=_[_0xf39e('0x25')](db[_0xf39e('0x26')][_0xf39e('0x27')],function(_0x2df2e8){return{'name':_0x2df2e8['fieldName'],'type':_0x2df2e8[_0xf39e('0x28')][_0xf39e('0x29')]};});_0x363320[_0xf39e('0x2a')]=_[_0xf39e('0x25')](_0x2c50a9,'name');_0x363320['query']=_[_0xf39e('0x2b')](_0x1bcedf['query']);_0x363320[_0xf39e('0x2c')]=_['intersection'](_0x363320[_0xf39e('0x2a')],_0x363320[_0xf39e('0x2d')]);_0x4f6f3a[_0xf39e('0x2e')]=_['intersection'](_0x363320[_0xf39e('0x2a')],qs[_0xf39e('0x2f')](_0x1bcedf[_0xf39e('0x2d')]['fields']));_0x4f6f3a['attributes']=_0x4f6f3a[_0xf39e('0x2e')][_0xf39e('0x30')]?_0x4f6f3a['attributes']:_0x363320[_0xf39e('0x2a')];if(!_0x1bcedf['query']['hasOwnProperty'](_0xf39e('0x31'))){_0x4f6f3a['limit']=qs['limit'](_0x1bcedf[_0xf39e('0x2d')][_0xf39e('0x19')]);_0x4f6f3a['offset']=qs[_0xf39e('0x17')](_0x1bcedf['query'][_0xf39e('0x17')]);}_0x4f6f3a['order']=qs['sort'](_0x1bcedf['query'][_0xf39e('0x32')]);_0x4f6f3a[_0xf39e('0x33')]=qs[_0xf39e('0x2c')](_[_0xf39e('0x34')](_0x1bcedf['query'],_0x363320[_0xf39e('0x2c')]),_0x2c50a9);if(_0x1bcedf[_0xf39e('0x2d')][_0xf39e('0x35')]){_0x4f6f3a[_0xf39e('0x33')]=_[_0xf39e('0x36')](_0x4f6f3a[_0xf39e('0x33')],{'$or':_[_0xf39e('0x25')](_0x2c50a9,function(_0x29f1c5){if(_0x29f1c5['type']!==_0xf39e('0x37')){var _0x3153f2={};_0x3153f2[_0x29f1c5[_0xf39e('0x24')]]={'$like':'%'+_0x1bcedf[_0xf39e('0x2d')][_0xf39e('0x35')]+'%'};return _0x3153f2;}})});}_0x4f6f3a=_[_0xf39e('0x36')]({},_0x4f6f3a,_0x1bcedf['options']);var _0x3a0c50={'where':_0x4f6f3a[_0xf39e('0x33')]};return db[_0xf39e('0x26')][_0xf39e('0x1a')](_0x3a0c50)[_0xf39e('0x1f')](function(_0x3c8068){_0x3cdeb3['count']=_0x3c8068;if(_0x1bcedf['query'][_0xf39e('0x38')]){_0x4f6f3a['include']=[{'all':!![]}];}return db[_0xf39e('0x26')][_0xf39e('0x39')](_0x4f6f3a);})[_0xf39e('0x1f')](function(_0x7dd856){_0x3cdeb3['rows']=_0x7dd856;return _0x3cdeb3;})[_0xf39e('0x1f')](respondWithFilteredResult(_0x22cd00,_0x4f6f3a))[_0xf39e('0x3a')](handleError(_0x22cd00,null));};exports[_0xf39e('0x3b')]=function(_0x117da2,_0x24f7ad){var _0x1ec825={'raw':!![],'where':{'id':_0x117da2[_0xf39e('0x3c')]['id']}},_0x526fe3={};_0x526fe3['model']=_[_0xf39e('0x2b')](db['Sound']['rawAttributes']);_0x526fe3[_0xf39e('0x2d')]=_[_0xf39e('0x2b')](_0x117da2[_0xf39e('0x2d')]);_0x526fe3[_0xf39e('0x2c')]=_['intersection'](_0x526fe3['model'],_0x526fe3[_0xf39e('0x2d')]);_0x1ec825[_0xf39e('0x2e')]=_['intersection'](_0x526fe3['model'],qs[_0xf39e('0x2f')](_0x117da2[_0xf39e('0x2d')][_0xf39e('0x2f')]));_0x1ec825[_0xf39e('0x2e')]=_0x1ec825[_0xf39e('0x2e')][_0xf39e('0x30')]?_0x1ec825[_0xf39e('0x2e')]:_0x526fe3[_0xf39e('0x2a')];if(_0x117da2[_0xf39e('0x2d')]['includeAll']){_0x1ec825[_0xf39e('0x3d')]=[{'all':!![]}];}_0x1ec825=_[_0xf39e('0x36')]({},_0x1ec825,_0x117da2[_0xf39e('0x3e')]);return db['Sound'][_0xf39e('0x3f')](_0x1ec825)['then'](handleEntityNotFound(_0x24f7ad,null))[_0xf39e('0x1f')](respondWithResult(_0x24f7ad,null))[_0xf39e('0x3a')](handleError(_0x24f7ad,null));};exports[_0xf39e('0x40')]=function(_0x53695e,_0x34d5e3,_0x7775cf){return db['Sound'][_0xf39e('0x3f')]({'where':{'id':_0x53695e['params']['id']},'attributes':[_0xf39e('0x24'),_0xf39e('0x41'),_0xf39e('0x42')],'raw':!![]})[_0xf39e('0x1f')](handleEntityNotFound(_0x34d5e3,null))[_0xf39e('0x1f')](function(_0x4be0f9){if(_0x4be0f9){if(!fs[_0xf39e('0x43')](path[_0xf39e('0x44')](config[_0xf39e('0x45')],_0xf39e('0x46'),_0x4be0f9[_0xf39e('0x41')]+'.'+_0x4be0f9['converted_format']))){throw new db['Sequelize']['ValidationError']('Sound\x20not\x20found');}return _0x34d5e3[_0xf39e('0x40')](path[_0xf39e('0x44')](config[_0xf39e('0x45')],_0xf39e('0x46'),util[_0xf39e('0x47')](_0xf39e('0x48'),_0x4be0f9[_0xf39e('0x41')],_0x4be0f9['converted_format'])),util[_0xf39e('0x47')](_0xf39e('0x48'),_0x4be0f9[_0xf39e('0x24')],_0x4be0f9[_0xf39e('0x42')]));}return null;})[_0xf39e('0x3a')](handleError(_0x34d5e3,null));};exports[_0xf39e('0x49')]=function(_0xaa709b,_0x20809a,_0x56c79e){var _0x5f065e={'name':path['basename'](_0xaa709b[_0xf39e('0x4a')][_0xf39e('0x4b')],path[_0xf39e('0x4c')](_0xaa709b[_0xf39e('0x4a')][_0xf39e('0x4b')])),'save_name':path[_0xf39e('0x4d')](_0xaa709b['file'][_0xf39e('0x4e')],path[_0xf39e('0x4c')](_0xaa709b[_0xf39e('0x4a')][_0xf39e('0x4e')])),'original_format':path[_0xf39e('0x4c')](_0xaa709b['file'][_0xf39e('0x4b')])[_0xf39e('0x4f')](0x1),'converted_format':_0xf39e('0x50')};var _0x2417e2=path[_0xf39e('0x44')](config[_0xf39e('0x45')],_0xf39e('0x51'),_0xaa709b[_0xf39e('0x4a')]['filename']);var _0x4bb22b=path[_0xf39e('0x44')](config[_0xf39e('0x45')],'server/files/sounds/converted',util[_0xf39e('0x47')](_0xf39e('0x48'),path[_0xf39e('0x4d')](_0xaa709b[_0xf39e('0x4a')][_0xf39e('0x4e')],path['extname'](_0xaa709b[_0xf39e('0x4a')][_0xf39e('0x4e')])),_0x5f065e[_0xf39e('0x42')]));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x2417e2);logger[_0xf39e('0x52')]('Sound\x20upload\x20destination:\x20%s',_0x4bb22b);try{fs[_0xf39e('0x53')](_0x2417e2,parseInt(_0xf39e('0x54'),0x8));var _0x4d57ac=sox['transcode'](_0x2417e2,_0x4bb22b,{'sampleRate':0x1f40,'format':_0xf39e('0x50'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4d57ac['on'](_0xf39e('0x23'),function(_0x4a6e82){fs[_0xf39e('0x55')](_0x2417e2);_0x20809a[_0xf39e('0x14')](0x1f4)[_0xf39e('0x56')](_0x4a6e82);});_0x4d57ac['on'](_0xf39e('0x57'),function(_0x382cc6){_0x5f065e['original_duration']=isNaN(_0x382cc6[_0xf39e('0x58')])?null:_0x382cc6[_0xf39e('0x58')]*0x3e8;_0x5f065e[_0xf39e('0x59')]=isNaN(_0x382cc6[_0xf39e('0x5a')])?null:_0x382cc6[_0xf39e('0x5a')];_0x5f065e['original_channelCount']=isNaN(_0x382cc6[_0xf39e('0x5b')])?null:_0x382cc6[_0xf39e('0x5b')];_0x5f065e[_0xf39e('0x5c')]=isNaN(_0x382cc6[_0xf39e('0x5d')])?null:_0x382cc6[_0xf39e('0x5d')];_0x5f065e[_0xf39e('0x5e')]=isNaN(_0x382cc6[_0xf39e('0x5f')])?null:_0x382cc6['sampleRate'];});_0x4d57ac['on']('dest',function(_0x39b556){_0x5f065e[_0xf39e('0x60')]=isNaN(_0x39b556[_0xf39e('0x58')])?null:_0x39b556[_0xf39e('0x58')]*0x3e8;_0x5f065e[_0xf39e('0x61')]=isNaN(_0x39b556[_0xf39e('0x5a')])?null:_0x39b556[_0xf39e('0x5a')];_0x5f065e[_0xf39e('0x62')]=isNaN(_0x39b556[_0xf39e('0x5b')])?null:_0x39b556[_0xf39e('0x5b')];_0x5f065e[_0xf39e('0x63')]=isNaN(_0x39b556[_0xf39e('0x5d')])?null:_0x39b556[_0xf39e('0x5d')];_0x5f065e[_0xf39e('0x64')]=isNaN(_0x39b556['sampleRate'])?null:_0x39b556[_0xf39e('0x5f')];});_0x4d57ac['on'](_0xf39e('0x15'),function(){fs[_0xf39e('0x53')](_0x4bb22b,parseInt(_0xf39e('0x54'),0x8));return db[_0xf39e('0x26')][_0xf39e('0x49')](_0x5f065e)[_0xf39e('0x1f')](function(_0x154467){var _0x4c1abb={'role':_0xaa709b['body']['role'],'userProfileId':_0xaa709b[_0xf39e('0x65')][_0xf39e('0x66')]};if(!_0x4c1abb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c1abb[_0xf39e('0x67')]===_0xf39e('0x68')){var _0x3758b0=_0x154467[_0xf39e('0x20')]({'plain':!![]});return db['UserProfileSection'][_0xf39e('0x3f')]({'where':{'name':_0xf39e('0x21'),'userProfileId':_0x4c1abb['userProfileId']},'raw':!![]})[_0xf39e('0x1f')](function(_0x5b62b2){if(_0x5b62b2&&_0x5b62b2[_0xf39e('0x69')]===0x0){return db['UserProfileResource']['create']({'name':_0x3758b0[_0xf39e('0x24')],'resourceId':_0x3758b0['id'],'type':_0x5b62b2[_0xf39e('0x24')],'sectionId':_0x5b62b2['id']},{})[_0xf39e('0x1f')](function(){return _0x154467;});}else{return _0x154467;}})[_0xf39e('0x3a')](function(_0x3dbef0){logger[_0xf39e('0x23')](_0xf39e('0x6a'),_0x3dbef0);throw _0x3dbef0;});}return _0x154467;})['then'](respondWithResult(_0x20809a,null))[_0xf39e('0x3a')](handleError(_0x20809a,null));});_0x4d57ac[_0xf39e('0x6b')]();}catch(_0x1d77f2){_0x20809a['status'](0x1f4)['send'](_0x1d77f2);}};exports[_0xf39e('0x1d')]=function(_0x1df02c,_0x50f6e0,_0x3c2349){return db[_0xf39e('0x26')][_0xf39e('0x3f')]({'where':{'id':_0x1df02c[_0xf39e('0x3c')]['id']}})[_0xf39e('0x1f')](handleEntityNotFound(_0x50f6e0,null))['then'](saveUpdates(_[_0xf39e('0x34')](_0x1df02c[_0xf39e('0x65')],[_0xf39e('0x24'),'description']),null))[_0xf39e('0x1f')](respondWithResult(_0x50f6e0,null))[_0xf39e('0x3a')](handleError(_0x50f6e0,null));};exports[_0xf39e('0x6c')]=function(_0x14fc7e,_0x2d00a1,_0x2bd413){return db['Sound'][_0xf39e('0x3f')]({'where':{'id':_0x14fc7e[_0xf39e('0x3c')]['id']}})[_0xf39e('0x1f')](function(_0x41d6db){if(_0x41d6db){return _0x41d6db[_0xf39e('0x1e')]();}})[_0xf39e('0x1f')](function(_0x169b4f){var _0x42a3fb=path[_0xf39e('0x44')](config[_0xf39e('0x45')],_0xf39e('0x51'),util[_0xf39e('0x47')](_0xf39e('0x48'),_0x169b4f[_0xf39e('0x41')],_0x169b4f[_0xf39e('0x6d')]));var _0x10f3e8=path[_0xf39e('0x44')](config['root'],_0xf39e('0x46'),util['format'](_0xf39e('0x48'),_0x169b4f['save_name'],_0x169b4f[_0xf39e('0x42')]));fs[_0xf39e('0x55')](_0x42a3fb);fs[_0xf39e('0x55')](_0x10f3e8);return _0x169b4f;})[_0xf39e('0x1f')](function(_0x3c5eb9){if(_0x3c5eb9){return _0x2d00a1[_0xf39e('0x14')](0xcc)[_0xf39e('0x15')]();}})['then'](handleEntityNotFound(_0x2d00a1,null))[_0xf39e('0x3a')](handleError(_0x2d00a1,null));}; \ No newline at end of file +var _0x5b17=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','Content-Range','update','destroy','then','get','Sounds','UserProfileResource','error','stack','name','index','Sound','rawAttributes','fieldName','type','model','map','keys','query','intersection','attributes','fields','length','nolimit','limit','order','sort','filters','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','find','download','save_name','existsSync','join','root','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','format','converted_format','%s.%s','create','basename','file','originalname','extname','filename','substring','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','wav','send','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','start','pick','description','delete','original_format','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','to-csv'];(function(_0x26fc81,_0x57fc19){var _0x9feece=function(_0x4344c3){while(--_0x4344c3){_0x26fc81['push'](_0x26fc81['shift']());}};_0x9feece(++_0x57fc19);}(_0x5b17,0x76));var _0x75b1=function(_0x2d280d,_0x3f0198){_0x2d280d=_0x2d280d-0x0;var _0x477f80=_0x5b17[_0x2d280d];return _0x477f80;};'use strict';var emlformat=require(_0x75b1('0x0'));var rimraf=require(_0x75b1('0x1'));var zipdir=require(_0x75b1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x75b1('0x3'));var moment=require(_0x75b1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x75b1('0x5'));var util=require(_0x75b1('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x75b1('0x7'));var ejs=require(_0x75b1('0x8'));var fs=require('fs');var fs_extra=require(_0x75b1('0x9'));var _=require(_0x75b1('0xa'));var squel=require(_0x75b1('0xb'));var crypto=require(_0x75b1('0xc'));var jsforce=require(_0x75b1('0xd'));var deskjs=require(_0x75b1('0xe'));var toCsv=require(_0x75b1('0x7'));var querystring=require(_0x75b1('0xf'));var Papa=require('papaparse');var Redis=require(_0x75b1('0x10'));var authService=require(_0x75b1('0x11'));var qs=require(_0x75b1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x75b1('0x13'));var logger=require(_0x75b1('0x14'))(_0x75b1('0x15'));var utils=require(_0x75b1('0x16'));var config=require(_0x75b1('0x17'));var licenseUtil=require(_0x75b1('0x18'));var db=require(_0x75b1('0x19'))['db'];function respondWithStatusCode(_0x153c14,_0x12659c){_0x12659c=_0x12659c||0xcc;return function(_0x8cf3bb){if(_0x8cf3bb){return _0x153c14[_0x75b1('0x1a')](_0x12659c);}return _0x153c14[_0x75b1('0x1b')](_0x12659c)[_0x75b1('0x1c')]();};}function respondWithResult(_0x31ed5e,_0x30d0cf){_0x30d0cf=_0x30d0cf||0xc8;return function(_0x2e64e6){if(_0x2e64e6){return _0x31ed5e[_0x75b1('0x1b')](_0x30d0cf)[_0x75b1('0x1d')](_0x2e64e6);}};}function respondWithFilteredResult(_0x3e9d16,_0x11e097){return function(_0x12d50f){if(_0x12d50f){var _0x480dcf=typeof _0x11e097['offset']===_0x75b1('0x1e')&&typeof _0x11e097['limit']===_0x75b1('0x1e');var _0x43eab0=_0x12d50f[_0x75b1('0x1f')];var _0x3f6e50=_0x480dcf?0x0:_0x11e097[_0x75b1('0x20')];var _0x3947c2=_0x480dcf?_0x12d50f[_0x75b1('0x1f')]:_0x11e097[_0x75b1('0x20')]+_0x11e097['limit'];var _0x5babce;if(_0x3947c2>=_0x43eab0){_0x3947c2=_0x43eab0;_0x5babce=0xc8;}else{_0x5babce=0xce;}_0x3e9d16[_0x75b1('0x1b')](_0x5babce);return _0x3e9d16['set'](_0x75b1('0x21'),_0x3f6e50+'-'+_0x3947c2+'/'+_0x43eab0)['json'](_0x12d50f);}return null;};}function patchUpdates(_0x557c51){return function(_0x1df7cd){try{jsonpatch['apply'](_0x1df7cd,_0x557c51,!![]);}catch(_0x23fc68){return BPromise['reject'](_0x23fc68);}return _0x1df7cd['save']();};}function saveUpdates(_0x569b1e,_0x40a004){return function(_0x58505c){if(_0x58505c){return _0x58505c[_0x75b1('0x22')](_0x569b1e)['then'](function(_0x855aa3){return _0x855aa3;});}return null;};}function removeEntity(_0x36be62,_0xc7f966){return function(_0x49900b){if(_0x49900b){return _0x49900b[_0x75b1('0x23')]()[_0x75b1('0x24')](function(){var _0x51ece5=_0x49900b[_0x75b1('0x25')]({'plain':!![]});var _0x4a3c33=_0x75b1('0x26');return db[_0x75b1('0x27')][_0x75b1('0x23')]({'where':{'type':_0x4a3c33,'resourceId':_0x51ece5['id']}})['then'](function(){return _0x49900b;});})[_0x75b1('0x24')](function(){_0x36be62[_0x75b1('0x1b')](0xcc)[_0x75b1('0x1c')]();});}};}function handleEntityNotFound(_0x2481cc,_0x35c330){return function(_0x5cd494){if(!_0x5cd494){_0x2481cc[_0x75b1('0x1a')](0x194);}return _0x5cd494;};}function handleError(_0x1b1f68,_0x2c5f8b){_0x2c5f8b=_0x2c5f8b||0x1f4;return function(_0x485399){logger[_0x75b1('0x28')](_0x485399[_0x75b1('0x29')]);if(_0x485399['name']){delete _0x485399[_0x75b1('0x2a')];}_0x1b1f68['status'](_0x2c5f8b)['send'](_0x485399);};}exports[_0x75b1('0x2b')]=function(_0xe4f35b,_0x4eb725){var _0x11749e={},_0x380ed3={},_0x5217fe={'count':0x0,'rows':[]};var _0x583164=_['map'](db[_0x75b1('0x2c')][_0x75b1('0x2d')],function(_0x543eab){return{'name':_0x543eab[_0x75b1('0x2e')],'type':_0x543eab[_0x75b1('0x2f')]['key']};});_0x380ed3[_0x75b1('0x30')]=_[_0x75b1('0x31')](_0x583164,_0x75b1('0x2a'));_0x380ed3['query']=_[_0x75b1('0x32')](_0xe4f35b[_0x75b1('0x33')]);_0x380ed3['filters']=_[_0x75b1('0x34')](_0x380ed3['model'],_0x380ed3[_0x75b1('0x33')]);_0x11749e[_0x75b1('0x35')]=_['intersection'](_0x380ed3['model'],qs[_0x75b1('0x36')](_0xe4f35b[_0x75b1('0x33')]['fields']));_0x11749e['attributes']=_0x11749e[_0x75b1('0x35')][_0x75b1('0x37')]?_0x11749e['attributes']:_0x380ed3['model'];if(!_0xe4f35b[_0x75b1('0x33')]['hasOwnProperty'](_0x75b1('0x38'))){_0x11749e[_0x75b1('0x39')]=qs[_0x75b1('0x39')](_0xe4f35b[_0x75b1('0x33')]['limit']);_0x11749e[_0x75b1('0x20')]=qs[_0x75b1('0x20')](_0xe4f35b['query'][_0x75b1('0x20')]);}_0x11749e[_0x75b1('0x3a')]=qs['sort'](_0xe4f35b[_0x75b1('0x33')][_0x75b1('0x3b')]);_0x11749e['where']=qs['filters'](_['pick'](_0xe4f35b[_0x75b1('0x33')],_0x380ed3[_0x75b1('0x3c')]),_0x583164);if(_0xe4f35b[_0x75b1('0x33')]['filter']){_0x11749e[_0x75b1('0x3d')]=_[_0x75b1('0x3e')](_0x11749e[_0x75b1('0x3d')],{'$or':_['map'](_0x583164,function(_0x2b322c){if(_0x2b322c[_0x75b1('0x2f')]!==_0x75b1('0x3f')){var _0x218ce1={};_0x218ce1[_0x2b322c[_0x75b1('0x2a')]]={'$like':'%'+_0xe4f35b[_0x75b1('0x33')][_0x75b1('0x40')]+'%'};return _0x218ce1;}})});}_0x11749e=_['merge']({},_0x11749e,_0xe4f35b[_0x75b1('0x41')]);var _0x47e960={'where':_0x11749e[_0x75b1('0x3d')]};return db['Sound'][_0x75b1('0x1f')](_0x47e960)[_0x75b1('0x24')](function(_0x5cb364){_0x5217fe['count']=_0x5cb364;if(_0xe4f35b[_0x75b1('0x33')][_0x75b1('0x42')]){_0x11749e[_0x75b1('0x43')]=[{'all':!![]}];}return db['Sound'][_0x75b1('0x44')](_0x11749e);})[_0x75b1('0x24')](function(_0x7c1e52){_0x5217fe[_0x75b1('0x45')]=_0x7c1e52;return _0x5217fe;})[_0x75b1('0x24')](respondWithFilteredResult(_0x4eb725,_0x11749e))[_0x75b1('0x46')](handleError(_0x4eb725,null));};exports['show']=function(_0x550a33,_0x2bc8af){var _0x41cc4b={'raw':!![],'where':{'id':_0x550a33[_0x75b1('0x47')]['id']}},_0x8aae5={};_0x8aae5[_0x75b1('0x30')]=_[_0x75b1('0x32')](db[_0x75b1('0x2c')]['rawAttributes']);_0x8aae5['query']=_[_0x75b1('0x32')](_0x550a33[_0x75b1('0x33')]);_0x8aae5[_0x75b1('0x3c')]=_['intersection'](_0x8aae5[_0x75b1('0x30')],_0x8aae5[_0x75b1('0x33')]);_0x41cc4b[_0x75b1('0x35')]=_[_0x75b1('0x34')](_0x8aae5['model'],qs[_0x75b1('0x36')](_0x550a33[_0x75b1('0x33')][_0x75b1('0x36')]));_0x41cc4b[_0x75b1('0x35')]=_0x41cc4b[_0x75b1('0x35')]['length']?_0x41cc4b[_0x75b1('0x35')]:_0x8aae5[_0x75b1('0x30')];if(_0x550a33[_0x75b1('0x33')]['includeAll']){_0x41cc4b[_0x75b1('0x43')]=[{'all':!![]}];}_0x41cc4b=_[_0x75b1('0x3e')]({},_0x41cc4b,_0x550a33[_0x75b1('0x41')]);return db['Sound'][_0x75b1('0x48')](_0x41cc4b)[_0x75b1('0x24')](handleEntityNotFound(_0x2bc8af,null))[_0x75b1('0x24')](respondWithResult(_0x2bc8af,null))[_0x75b1('0x46')](handleError(_0x2bc8af,null));};exports[_0x75b1('0x49')]=function(_0xcd1328,_0x1f1a60,_0x1735c7){return db[_0x75b1('0x2c')][_0x75b1('0x48')]({'where':{'id':_0xcd1328['params']['id']},'attributes':[_0x75b1('0x2a'),_0x75b1('0x4a'),'converted_format'],'raw':!![]})[_0x75b1('0x24')](handleEntityNotFound(_0x1f1a60,null))[_0x75b1('0x24')](function(_0x908553){if(_0x908553){if(!fs[_0x75b1('0x4b')](path[_0x75b1('0x4c')](config[_0x75b1('0x4d')],_0x75b1('0x4e'),_0x908553['save_name']+'.'+_0x908553['converted_format']))){throw new db[(_0x75b1('0x4f'))]['ValidationError'](_0x75b1('0x50'));}return _0x1f1a60[_0x75b1('0x49')](path['join'](config[_0x75b1('0x4d')],_0x75b1('0x4e'),util[_0x75b1('0x51')]('%s.%s',_0x908553[_0x75b1('0x4a')],_0x908553[_0x75b1('0x52')])),util[_0x75b1('0x51')](_0x75b1('0x53'),_0x908553[_0x75b1('0x2a')],_0x908553['converted_format']));}return null;})['catch'](handleError(_0x1f1a60,null));};exports[_0x75b1('0x54')]=function(_0x3bf4e4,_0x17e8d7,_0x3a5b57){var _0x1b859f={'name':path[_0x75b1('0x55')](_0x3bf4e4[_0x75b1('0x56')][_0x75b1('0x57')],path[_0x75b1('0x58')](_0x3bf4e4[_0x75b1('0x56')][_0x75b1('0x57')])),'save_name':path['basename'](_0x3bf4e4[_0x75b1('0x56')][_0x75b1('0x59')],path[_0x75b1('0x58')](_0x3bf4e4[_0x75b1('0x56')][_0x75b1('0x59')])),'original_format':path[_0x75b1('0x58')](_0x3bf4e4[_0x75b1('0x56')][_0x75b1('0x57')])[_0x75b1('0x5a')](0x1),'converted_format':'wav'};var _0x46bdd3=path[_0x75b1('0x4c')](config[_0x75b1('0x4d')],_0x75b1('0x5b'),_0x3bf4e4['file'][_0x75b1('0x59')]);var _0x26e43d=path[_0x75b1('0x4c')](config[_0x75b1('0x4d')],_0x75b1('0x4e'),util[_0x75b1('0x51')]('%s.%s',path['basename'](_0x3bf4e4[_0x75b1('0x56')]['filename'],path[_0x75b1('0x58')](_0x3bf4e4['file'][_0x75b1('0x59')])),_0x1b859f[_0x75b1('0x52')]));logger[_0x75b1('0x5c')](_0x75b1('0x5d'),_0x46bdd3);logger[_0x75b1('0x5c')](_0x75b1('0x5e'),_0x26e43d);try{fs[_0x75b1('0x5f')](_0x46bdd3,parseInt(_0x75b1('0x60'),0x8));var _0x5d8fa0=sox['transcode'](_0x46bdd3,_0x26e43d,{'sampleRate':0x1f40,'format':_0x75b1('0x61'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5d8fa0['on'](_0x75b1('0x28'),function(_0x53083e){fs['unlinkSync'](_0x46bdd3);_0x17e8d7[_0x75b1('0x1b')](0x1f4)[_0x75b1('0x62')](_0x53083e);});_0x5d8fa0['on'](_0x75b1('0x63'),function(_0x186593){_0x1b859f[_0x75b1('0x64')]=isNaN(_0x186593[_0x75b1('0x65')])?null:_0x186593[_0x75b1('0x65')]*0x3e8;_0x1b859f[_0x75b1('0x66')]=isNaN(_0x186593[_0x75b1('0x67')])?null:_0x186593['sampleCount'];_0x1b859f[_0x75b1('0x68')]=isNaN(_0x186593[_0x75b1('0x69')])?null:_0x186593[_0x75b1('0x69')];_0x1b859f[_0x75b1('0x6a')]=isNaN(_0x186593['bitRate'])?null:_0x186593['bitRate'];_0x1b859f[_0x75b1('0x6b')]=isNaN(_0x186593['sampleRate'])?null:_0x186593[_0x75b1('0x6c')];});_0x5d8fa0['on'](_0x75b1('0x6d'),function(_0x17cb92){_0x1b859f[_0x75b1('0x6e')]=isNaN(_0x17cb92[_0x75b1('0x65')])?null:_0x17cb92[_0x75b1('0x65')]*0x3e8;_0x1b859f[_0x75b1('0x6f')]=isNaN(_0x17cb92[_0x75b1('0x67')])?null:_0x17cb92['sampleCount'];_0x1b859f['converted_channelCount']=isNaN(_0x17cb92['channelCount'])?null:_0x17cb92['channelCount'];_0x1b859f['converted_bitRate']=isNaN(_0x17cb92[_0x75b1('0x70')])?null:_0x17cb92[_0x75b1('0x70')];_0x1b859f[_0x75b1('0x71')]=isNaN(_0x17cb92[_0x75b1('0x6c')])?null:_0x17cb92[_0x75b1('0x6c')];});_0x5d8fa0['on'](_0x75b1('0x1c'),function(){fs[_0x75b1('0x5f')](_0x26e43d,parseInt(_0x75b1('0x60'),0x8));return db['Sound'][_0x75b1('0x54')](_0x1b859f)[_0x75b1('0x24')](function(_0xbfb31c){var _0x2072de={'role':_0x3bf4e4[_0x75b1('0x72')][_0x75b1('0x73')],'userProfileId':_0x3bf4e4[_0x75b1('0x72')][_0x75b1('0x74')]};if(!_0x2072de)throw new Error(_0x75b1('0x75'));if(_0x2072de[_0x75b1('0x73')]===_0x75b1('0x76')){var _0x9c045a=_0xbfb31c['get']({'plain':!![]});return db[_0x75b1('0x77')][_0x75b1('0x48')]({'where':{'name':_0x75b1('0x26'),'userProfileId':_0x2072de['userProfileId']},'raw':!![]})[_0x75b1('0x24')](function(_0x2cf9a8){if(_0x2cf9a8&&_0x2cf9a8['autoAssociation']===0x0){return db['UserProfileResource'][_0x75b1('0x54')]({'name':_0x9c045a[_0x75b1('0x2a')],'resourceId':_0x9c045a['id'],'type':_0x2cf9a8[_0x75b1('0x2a')],'sectionId':_0x2cf9a8['id']},{})['then'](function(){return _0xbfb31c;});}else{return _0xbfb31c;}})[_0x75b1('0x46')](function(_0x6a63fe){logger[_0x75b1('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x6a63fe);throw _0x6a63fe;});}return _0xbfb31c;})['then'](respondWithResult(_0x17e8d7,null))['catch'](handleError(_0x17e8d7,null));});_0x5d8fa0[_0x75b1('0x78')]();}catch(_0x3cbd21){_0x17e8d7[_0x75b1('0x1b')](0x1f4)['send'](_0x3cbd21);}};exports[_0x75b1('0x22')]=function(_0x293004,_0x1463cb,_0x4a6997){return db[_0x75b1('0x2c')]['find']({'where':{'id':_0x293004['params']['id']}})[_0x75b1('0x24')](handleEntityNotFound(_0x1463cb,null))[_0x75b1('0x24')](saveUpdates(_[_0x75b1('0x79')](_0x293004[_0x75b1('0x72')],[_0x75b1('0x2a'),_0x75b1('0x7a')]),null))[_0x75b1('0x24')](respondWithResult(_0x1463cb,null))[_0x75b1('0x46')](handleError(_0x1463cb,null));};exports[_0x75b1('0x7b')]=function(_0x5b97c4,_0x37cd94,_0x2fbf73){return db[_0x75b1('0x2c')][_0x75b1('0x48')]({'where':{'id':_0x5b97c4[_0x75b1('0x47')]['id']}})[_0x75b1('0x24')](function(_0x11c700){if(_0x11c700){return _0x11c700['destroy']();}})[_0x75b1('0x24')](function(_0x2cae0e){var _0x443a6d=path[_0x75b1('0x4c')](config[_0x75b1('0x4d')],_0x75b1('0x5b'),util['format'](_0x75b1('0x53'),_0x2cae0e[_0x75b1('0x4a')],_0x2cae0e[_0x75b1('0x7c')]));var _0x394265=path[_0x75b1('0x4c')](config[_0x75b1('0x4d')],_0x75b1('0x4e'),util['format'](_0x75b1('0x53'),_0x2cae0e[_0x75b1('0x4a')],_0x2cae0e[_0x75b1('0x52')]));fs[_0x75b1('0x7d')](_0x443a6d);fs['unlinkSync'](_0x394265);return _0x2cae0e;})[_0x75b1('0x24')](function(_0x18a780){if(_0x18a780){return _0x37cd94[_0x75b1('0x1b')](0xcc)['end']();}})[_0x75b1('0x24')](handleEntityNotFound(_0x37cd94,null))[_0x75b1('0x46')](handleError(_0x37cd94,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index c76d575..4b1ded7 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 _0x7cd0=['rimraf','../../config/environment','./sound.attributes','exports','Sound','tools_sounds','lodash','../../config/logger','moment','bluebird','path'];(function(_0x3a52e1,_0x1dfbbe){var _0xe4f484=function(_0x4bcb8e){while(--_0x4bcb8e){_0x3a52e1['push'](_0x3a52e1['shift']());}};_0xe4f484(++_0x1dfbbe);}(_0x7cd0,0x192));var _0x07cd=function(_0x237587,_0x3922b7){_0x237587=_0x237587-0x0;var _0x485bd9=_0x7cd0[_0x237587];return _0x485bd9;};'use strict';var _=require(_0x07cd('0x0'));var util=require('util');var logger=require(_0x07cd('0x1'))('api');var moment=require(_0x07cd('0x2'));var BPromise=require(_0x07cd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x07cd('0x4'));var rimraf=require(_0x07cd('0x5'));var config=require(_0x07cd('0x6'));var attributes=require(_0x07cd('0x7'));module[_0x07cd('0x8')]=function(_0x419b71,_0x490605){return _0x419b71['define'](_0x07cd('0x9'),attributes,{'tableName':_0x07cd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x25b5=['Sound','tools_sounds','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./sound.attributes','exports'];(function(_0x50d7bb,_0x3548ab){var _0x5e5de3=function(_0xe7653d){while(--_0xe7653d){_0x50d7bb['push'](_0x50d7bb['shift']());}};_0x5e5de3(++_0x3548ab);}(_0x25b5,0x6a));var _0x525b=function(_0x2b5b36,_0x407b83){_0x2b5b36=_0x2b5b36-0x0;var _0x261eec=_0x25b5[_0x2b5b36];return _0x261eec;};'use strict';var _=require(_0x525b('0x0'));var util=require(_0x525b('0x1'));var logger=require(_0x525b('0x2'))(_0x525b('0x3'));var moment=require(_0x525b('0x4'));var BPromise=require(_0x525b('0x5'));var rp=require(_0x525b('0x6'));var fs=require('fs');var path=require(_0x525b('0x7'));var rimraf=require(_0x525b('0x8'));var config=require('../../config/environment');var attributes=require(_0x525b('0x9'));module[_0x525b('0xa')]=function(_0x104c52,_0x28780a){return _0x104c52['define'](_0x525b('0xb'),attributes,{'tableName':_0x525b('0xc'),'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 19c465c..a82f65c 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 _0xa231=['debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message','catch','ShowSound','Sound','find','options','raw','where','attributes','map','model','include','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','info','Sound,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa231,0x101));var _0x1a23=function(_0x1058d1,_0x122d13){_0x1058d1=_0x1058d1-0x0;var _0x3078cf=_0xa231[_0x1058d1];return _0x3078cf;};'use strict';var _=require(_0x1a23('0x0'));var util=require('util');var moment=require(_0x1a23('0x1'));var BPromise=require(_0x1a23('0x2'));var rs=require(_0x1a23('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a23('0x4'))['db'];var utils=require(_0x1a23('0x5'));var logger=require(_0x1a23('0x6'))('rpc');var config=require(_0x1a23('0x7'));var jayson=require(_0x1a23('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2eaa1c,_0x1094cd,_0x6044f1){return new BPromise(function(_0x69af9,_0x119457){return client['request'](_0x2eaa1c,_0x6044f1)[_0x1a23('0x9')](function(_0x51c25f){logger[_0x1a23('0xa')](_0x1a23('0xb'),_0x1094cd,_0x1a23('0xc'));logger[_0x1a23('0xd')](_0x1a23('0xe'),_0x1094cd,'request\x20sent',JSON['stringify'](_0x51c25f));if(_0x51c25f[_0x1a23('0xf')]){if(_0x51c25f[_0x1a23('0xf')][_0x1a23('0x10')]===0x1f4){logger[_0x1a23('0xf')](_0x1a23('0xb'),_0x1094cd,_0x51c25f[_0x1a23('0xf')]['message']);return _0x119457(_0x51c25f[_0x1a23('0xf')][_0x1a23('0x11')]);}logger[_0x1a23('0xf')](_0x1a23('0xb'),_0x1094cd,_0x51c25f['error'][_0x1a23('0x11')]);return _0x69af9(_0x51c25f['error'][_0x1a23('0x11')]);}else{logger[_0x1a23('0xa')](_0x1a23('0xb'),_0x1094cd,'request\x20sent');_0x69af9(_0x51c25f['result'][_0x1a23('0x11')]);}})[_0x1a23('0x12')](function(_0xd11ff6){logger[_0x1a23('0xf')](_0x1a23('0xb'),_0x1094cd,_0xd11ff6);_0x119457(_0xd11ff6);});});}exports[_0x1a23('0x13')]=function(_0x25fb84){var _0x59cb3b=this;return new Promise(function(_0x32d748,_0x3af98d){return db[_0x1a23('0x14')][_0x1a23('0x15')]({'raw':_0x25fb84[_0x1a23('0x16')]?_0x25fb84['options'][_0x1a23('0x17')]===undefined?!![]:![]:!![],'where':_0x25fb84[_0x1a23('0x16')]?_0x25fb84[_0x1a23('0x16')][_0x1a23('0x18')]||null:null,'attributes':_0x25fb84[_0x1a23('0x16')]?_0x25fb84['options'][_0x1a23('0x19')]||null:null,'include':_0x25fb84['options']?_0x25fb84[_0x1a23('0x16')]['include']?_[_0x1a23('0x1a')](_0x25fb84[_0x1a23('0x16')]['include'],function(_0x144256){return{'model':db[_0x144256[_0x1a23('0x1b')]],'as':_0x144256['as'],'attributes':_0x144256[_0x1a23('0x19')],'include':_0x144256[_0x1a23('0x1c')]?_['map'](_0x144256[_0x1a23('0x1c')],function(_0x3654ec){return{'model':db[_0x3654ec[_0x1a23('0x1b')]],'as':_0x3654ec['as'],'attributes':_0x3654ec[_0x1a23('0x19')],'include':_0x3654ec['include']?_['map'](_0x3654ec[_0x1a23('0x1c')],function(_0x38e6fc){return{'model':db[_0x38e6fc[_0x1a23('0x1b')]],'as':_0x38e6fc['as'],'attributes':_0x38e6fc[_0x1a23('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1a23('0x9')](function(_0x4cb08b){logger[_0x1a23('0xa')]('ShowSound',_0x25fb84);logger[_0x1a23('0xd')]('ShowSound',_0x25fb84,JSON[_0x1a23('0x1d')](_0x4cb08b));_0x32d748(_0x4cb08b);})['catch'](function(_0x1f95ef){logger[_0x1a23('0xf')](_0x1a23('0x13'),_0x1f95ef[_0x1a23('0x11')],_0x25fb84);_0x3af98d(_0x59cb3b[_0x1a23('0xf')](0x1f4,_0x1f95ef[_0x1a23('0x11')]));});});}; \ No newline at end of file +var _0x74ea=['then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSound','Sound','find','options','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x353c53,_0x2102c0){var _0x2c55da=function(_0x3fe2d5){while(--_0x3fe2d5){_0x353c53['push'](_0x353c53['shift']());}};_0x2c55da(++_0x2102c0);}(_0x74ea,0xbf));var _0xa74e=function(_0x245fce,_0x2b40d4){_0x245fce=_0x245fce-0x0;var _0x463a64=_0x74ea[_0x245fce];return _0x463a64;};'use strict';var _=require(_0xa74e('0x0'));var util=require(_0xa74e('0x1'));var moment=require(_0xa74e('0x2'));var BPromise=require(_0xa74e('0x3'));var rs=require(_0xa74e('0x4'));var fs=require('fs');var Redis=require(_0xa74e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa74e('0x6'));var logger=require(_0xa74e('0x7'))(_0xa74e('0x8'));var config=require(_0xa74e('0x9'));var jayson=require(_0xa74e('0xa'));var client=jayson[_0xa74e('0xb')][_0xa74e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7bb7b2,_0x2f8c97,_0x37ec84){return new BPromise(function(_0x49b37e,_0x4f5822){return client['request'](_0x7bb7b2,_0x37ec84)[_0xa74e('0xd')](function(_0x2c6bbc){logger[_0xa74e('0xe')](_0xa74e('0xf'),_0x2f8c97,_0xa74e('0x10'));logger[_0xa74e('0x11')](_0xa74e('0x12'),_0x2f8c97,_0xa74e('0x10'),JSON[_0xa74e('0x13')](_0x2c6bbc));if(_0x2c6bbc['error']){if(_0x2c6bbc[_0xa74e('0x14')][_0xa74e('0x15')]===0x1f4){logger[_0xa74e('0x14')]('Sound,\x20%s,\x20%s',_0x2f8c97,_0x2c6bbc[_0xa74e('0x14')]['message']);return _0x4f5822(_0x2c6bbc['error'][_0xa74e('0x16')]);}logger['error'](_0xa74e('0xf'),_0x2f8c97,_0x2c6bbc[_0xa74e('0x14')][_0xa74e('0x16')]);return _0x49b37e(_0x2c6bbc['error'][_0xa74e('0x16')]);}else{logger[_0xa74e('0xe')](_0xa74e('0xf'),_0x2f8c97,_0xa74e('0x10'));_0x49b37e(_0x2c6bbc[_0xa74e('0x17')][_0xa74e('0x16')]);}})[_0xa74e('0x18')](function(_0x27307f){logger[_0xa74e('0x14')]('Sound,\x20%s,\x20%s',_0x2f8c97,_0x27307f);_0x4f5822(_0x27307f);});});}exports[_0xa74e('0x19')]=function(_0x3718b5){var _0x4254d8=this;return new Promise(function(_0xb7e1d0,_0x482e61){return db[_0xa74e('0x1a')][_0xa74e('0x1b')]({'raw':_0x3718b5[_0xa74e('0x1c')]?_0x3718b5['options']['raw']===undefined?!![]:![]:!![],'where':_0x3718b5[_0xa74e('0x1c')]?_0x3718b5['options'][_0xa74e('0x1d')]||null:null,'attributes':_0x3718b5['options']?_0x3718b5[_0xa74e('0x1c')][_0xa74e('0x1e')]||null:null,'include':_0x3718b5[_0xa74e('0x1c')]?_0x3718b5[_0xa74e('0x1c')][_0xa74e('0x1f')]?_[_0xa74e('0x20')](_0x3718b5[_0xa74e('0x1c')][_0xa74e('0x1f')],function(_0x45745f){return{'model':db[_0x45745f[_0xa74e('0x21')]],'as':_0x45745f['as'],'attributes':_0x45745f['attributes'],'include':_0x45745f[_0xa74e('0x1f')]?_[_0xa74e('0x20')](_0x45745f['include'],function(_0x3ce145){return{'model':db[_0x3ce145[_0xa74e('0x21')]],'as':_0x3ce145['as'],'attributes':_0x3ce145[_0xa74e('0x1e')],'include':_0x3ce145[_0xa74e('0x1f')]?_[_0xa74e('0x20')](_0x3ce145[_0xa74e('0x1f')],function(_0x422027){return{'model':db[_0x422027[_0xa74e('0x21')]],'as':_0x422027['as'],'attributes':_0x422027['attributes']};}):[]};}):[]};}):[]:[]})[_0xa74e('0xd')](function(_0x2f7c80){logger[_0xa74e('0xe')](_0xa74e('0x19'),_0x3718b5);logger[_0xa74e('0x11')](_0xa74e('0x19'),_0x3718b5,JSON[_0xa74e('0x13')](_0x2f7c80));_0xb7e1d0(_0x2f7c80);})[_0xa74e('0x18')](function(_0xce6380){logger[_0xa74e('0x14')](_0xa74e('0x19'),_0xce6380[_0xa74e('0x16')],_0x3718b5);_0x482e61(_0x4254d8['error'](0x1f4,_0xce6380['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 2819376..62821c8 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['./squareMessage.controller','get','index','isAuthenticated','show','post','create','put','/:id','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3f8b5a,_0x550ae5){var _0x46f642=function(_0x58ce1f){while(--_0x58ce1f){_0x3f8b5a['push'](_0x3f8b5a['shift']());}};_0x46f642(++_0x550ae5);}(_0xb10b,0x12a));var _0xbb10=function(_0x3afb47,_0x54bee0){_0x3afb47=_0x3afb47-0x0;var _0xe566d2=_0xb10b[_0x3afb47];return _0xe566d2;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0xd')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['update']);router['delete'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x9a5932,_0x405165){var _0xed2523=function(_0x41328d){while(--_0x41328d){_0x9a5932['push'](_0x9a5932['shift']());}};_0xed2523(++_0x405165);}(_0x5eb8,0xb0));var _0x85eb=function(_0x3ed054,_0x4d4f16){_0x3ed054=_0x3ed054-0x0;var _0x16dd95=_0x5eb8[_0x3ed054];return _0x16dd95;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('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 5ff6321..79a4259 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 _0x95b7=['sequelize','STRING','TEXT','medium','ENUM','out'];(function(_0x328b9b,_0x13082a){var _0x3a2d51=function(_0x63002b){while(--_0x63002b){_0x328b9b['push'](_0x328b9b['shift']());}};_0x3a2d51(++_0x13082a);}(_0x95b7,0x1e6));var _0x795b=function(_0x3869c8,_0x2ff137){_0x3869c8=_0x3869c8-0x0;var _0x4caf60=_0x95b7[_0x3869c8];return _0x4caf60;};'use strict';var Sequelize=require(_0x795b('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x795b('0x1')]},'body':{'type':Sequelize[_0x795b('0x2')](_0x795b('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x795b('0x4')]('in',_0x795b('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x795b('0x1')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xef01=['exports','STRING','TEXT','medium','out'];(function(_0x9c2061,_0x146ae7){var _0xaad70=function(_0xef0d2e){while(--_0xef0d2e){_0x9c2061['push'](_0x9c2061['shift']());}};_0xaad70(++_0x146ae7);}(_0xef01,0x131));var _0x1ef0=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xef01[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0x1ef0('0x0')]={'uniqueid':{'type':Sequelize[_0x1ef0('0x1')]},'body':{'type':Sequelize[_0x1ef0('0x2')](_0x1ef0('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x1ef0('0x4')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index f46e754..93f3bb3 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 _0x437b=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','create','body','find','eml-format','fast-json-patch','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse'];(function(_0x412ebb,_0x33f125){var _0x3580f9=function(_0x3ae08f){while(--_0x3ae08f){_0x412ebb['push'](_0x412ebb['shift']());}};_0x3580f9(++_0x33f125);}(_0x437b,0x1a8));var _0xb437=function(_0x4450b1,_0x214ace){_0x4450b1=_0x4450b1-0x0;var _0x399b0b=_0x437b[_0x4450b1];return _0x399b0b;};'use strict';var emlformat=require(_0xb437('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb437('0x1'));var rp=require('request-promise');var moment=require(_0xb437('0x2'));var BPromise=require(_0xb437('0x3'));var Mustache=require(_0xb437('0x4'));var util=require('util');var path=require(_0xb437('0x5'));var sox=require('sox');var csv=require(_0xb437('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb437('0x7'));var _=require(_0xb437('0x8'));var squel=require(_0xb437('0x9'));var crypto=require(_0xb437('0xa'));var jsforce=require(_0xb437('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb437('0xc'));var Papa=require(_0xb437('0xd'));var Redis=require(_0xb437('0xe'));var authService=require(_0xb437('0xf'));var qs=require(_0xb437('0x10'));var as=require(_0xb437('0x11'));var hardwareService=require(_0xb437('0x12'));var logger=require(_0xb437('0x13'))(_0xb437('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2eb4c2,_0x286dbd){_0x286dbd=_0x286dbd||0xcc;return function(_0x510d40){if(_0x510d40){return _0x2eb4c2[_0xb437('0x15')](_0x286dbd);}return _0x2eb4c2[_0xb437('0x16')](_0x286dbd)[_0xb437('0x17')]();};}function respondWithResult(_0x2aa76e,_0x1ea6de){_0x1ea6de=_0x1ea6de||0xc8;return function(_0x2bf4ef){if(_0x2bf4ef){return _0x2aa76e[_0xb437('0x16')](_0x1ea6de)[_0xb437('0x18')](_0x2bf4ef);}};}function respondWithFilteredResult(_0x5311a9,_0x1e6589){return function(_0x39fb99){if(_0x39fb99){var _0x5e4c9f=typeof _0x1e6589[_0xb437('0x19')]===_0xb437('0x1a')&&typeof _0x1e6589['limit']===_0xb437('0x1a');var _0x5d31fd=_0x39fb99['count'];var _0x1e2129=_0x5e4c9f?0x0:_0x1e6589[_0xb437('0x19')];var _0x5acf98=_0x5e4c9f?_0x39fb99[_0xb437('0x1b')]:_0x1e6589[_0xb437('0x19')]+_0x1e6589[_0xb437('0x1c')];var _0x5ab764;if(_0x5acf98>=_0x5d31fd){_0x5acf98=_0x5d31fd;_0x5ab764=0xc8;}else{_0x5ab764=0xce;}_0x5311a9[_0xb437('0x16')](_0x5ab764);return _0x5311a9[_0xb437('0x1d')](_0xb437('0x1e'),_0x1e2129+'-'+_0x5acf98+'/'+_0x5d31fd)[_0xb437('0x18')](_0x39fb99);}return null;};}function patchUpdates(_0x5a8888){return function(_0x5adb78){try{jsonpatch[_0xb437('0x1f')](_0x5adb78,_0x5a8888,!![]);}catch(_0x5752f1){return BPromise['reject'](_0x5752f1);}return _0x5adb78[_0xb437('0x20')]();};}function saveUpdates(_0x4a01bf,_0x136140){return function(_0x4c64a9){if(_0x4c64a9){return _0x4c64a9[_0xb437('0x21')](_0x4a01bf)['then'](function(_0x458ded){return _0x458ded;});}return null;};}function removeEntity(_0xcebd70,_0x56f4d6){return function(_0x4c4969){if(_0x4c4969){return _0x4c4969[_0xb437('0x22')]()[_0xb437('0x23')](function(){_0xcebd70[_0xb437('0x16')](0xcc)[_0xb437('0x17')]();});}};}function handleEntityNotFound(_0x2016f1,_0x19ce31){return function(_0x1e3a07){if(!_0x1e3a07){_0x2016f1[_0xb437('0x15')](0x194);}return _0x1e3a07;};}function handleError(_0x53a71e,_0x761738){_0x761738=_0x761738||0x1f4;return function(_0x3e8345){logger[_0xb437('0x24')](_0x3e8345[_0xb437('0x25')]);if(_0x3e8345[_0xb437('0x26')]){delete _0x3e8345[_0xb437('0x26')];}_0x53a71e['status'](_0x761738)[_0xb437('0x27')](_0x3e8345);};}exports[_0xb437('0x28')]=function(_0x585753,_0x194ebf){var _0x10eb36={},_0x1dbc8d={},_0x5d0323={'count':0x0,'rows':[]};var _0x20b227=_[_0xb437('0x29')](db[_0xb437('0x2a')][_0xb437('0x2b')],function(_0xb5bfa){return{'name':_0xb5bfa[_0xb437('0x2c')],'type':_0xb5bfa[_0xb437('0x2d')][_0xb437('0x2e')]};});_0x1dbc8d[_0xb437('0x2f')]=_[_0xb437('0x29')](_0x20b227,_0xb437('0x26'));_0x1dbc8d[_0xb437('0x30')]=_[_0xb437('0x31')](_0x585753[_0xb437('0x30')]);_0x1dbc8d[_0xb437('0x32')]=_[_0xb437('0x33')](_0x1dbc8d['model'],_0x1dbc8d[_0xb437('0x30')]);_0x10eb36[_0xb437('0x34')]=_[_0xb437('0x33')](_0x1dbc8d[_0xb437('0x2f')],qs['fields'](_0x585753['query']['fields']));_0x10eb36['attributes']=_0x10eb36[_0xb437('0x34')][_0xb437('0x35')]?_0x10eb36[_0xb437('0x34')]:_0x1dbc8d['model'];if(!_0x585753[_0xb437('0x30')][_0xb437('0x36')](_0xb437('0x37'))){_0x10eb36[_0xb437('0x1c')]=qs[_0xb437('0x1c')](_0x585753[_0xb437('0x30')][_0xb437('0x1c')]);_0x10eb36[_0xb437('0x19')]=qs[_0xb437('0x19')](_0x585753[_0xb437('0x30')][_0xb437('0x19')]);}_0x10eb36[_0xb437('0x38')]=qs[_0xb437('0x39')](_0x585753[_0xb437('0x30')][_0xb437('0x39')]);_0x10eb36[_0xb437('0x3a')]=qs[_0xb437('0x32')](_[_0xb437('0x3b')](_0x585753['query'],_0x1dbc8d['filters']),_0x20b227);if(_0x585753[_0xb437('0x30')]['filter']){_0x10eb36['where']=_[_0xb437('0x3c')](_0x10eb36[_0xb437('0x3a')],{'$or':_[_0xb437('0x29')](_0x20b227,function(_0x381a0b){if(_0x381a0b[_0xb437('0x2d')]!==_0xb437('0x3d')){var _0xf4cb6b={};_0xf4cb6b[_0x381a0b[_0xb437('0x26')]]={'$like':'%'+_0x585753['query'][_0xb437('0x3e')]+'%'};return _0xf4cb6b;}})});}_0x10eb36=_[_0xb437('0x3c')]({},_0x10eb36,_0x585753[_0xb437('0x3f')]);var _0x45042a={'where':_0x10eb36[_0xb437('0x3a')]};return db['SquareMessage'][_0xb437('0x1b')](_0x45042a)[_0xb437('0x23')](function(_0x27ac7b){_0x5d0323[_0xb437('0x1b')]=_0x27ac7b;if(_0x585753[_0xb437('0x30')][_0xb437('0x40')]){_0x10eb36[_0xb437('0x41')]=[{'all':!![]}];}return db[_0xb437('0x2a')][_0xb437('0x42')](_0x10eb36);})[_0xb437('0x23')](function(_0x9976a1){_0x5d0323[_0xb437('0x43')]=_0x9976a1;return _0x5d0323;})[_0xb437('0x23')](respondWithFilteredResult(_0x194ebf,_0x10eb36))[_0xb437('0x44')](handleError(_0x194ebf,null));};exports['show']=function(_0x3c9e49,_0x927def){var _0x26d043={'raw':!![],'where':{'id':_0x3c9e49[_0xb437('0x45')]['id']}},_0x3bc816={};_0x3bc816['model']=_[_0xb437('0x31')](db[_0xb437('0x2a')][_0xb437('0x2b')]);_0x3bc816[_0xb437('0x30')]=_[_0xb437('0x31')](_0x3c9e49[_0xb437('0x30')]);_0x3bc816[_0xb437('0x32')]=_[_0xb437('0x33')](_0x3bc816[_0xb437('0x2f')],_0x3bc816[_0xb437('0x30')]);_0x26d043[_0xb437('0x34')]=_['intersection'](_0x3bc816[_0xb437('0x2f')],qs['fields'](_0x3c9e49[_0xb437('0x30')]['fields']));_0x26d043['attributes']=_0x26d043[_0xb437('0x34')][_0xb437('0x35')]?_0x26d043[_0xb437('0x34')]:_0x3bc816[_0xb437('0x2f')];if(_0x3c9e49['query'][_0xb437('0x40')]){_0x26d043['include']=[{'all':!![]}];}_0x26d043=_[_0xb437('0x3c')]({},_0x26d043,_0x3c9e49['options']);return db[_0xb437('0x2a')]['find'](_0x26d043)[_0xb437('0x23')](handleEntityNotFound(_0x927def,null))['then'](respondWithResult(_0x927def,null))['catch'](handleError(_0x927def,null));};exports[_0xb437('0x46')]=function(_0x527c64,_0x47c91d){return db[_0xb437('0x2a')]['create'](_0x527c64[_0xb437('0x47')],{})[_0xb437('0x23')](respondWithResult(_0x47c91d,0xc9))[_0xb437('0x44')](handleError(_0x47c91d,null));};exports[_0xb437('0x21')]=function(_0x2932d4,_0x5c3024){if(_0x2932d4['body']['id']){delete _0x2932d4[_0xb437('0x47')]['id'];}return db[_0xb437('0x2a')][_0xb437('0x48')]({'where':{'id':_0x2932d4[_0xb437('0x45')]['id']}})['then'](handleEntityNotFound(_0x5c3024,null))[_0xb437('0x23')](saveUpdates(_0x2932d4['body'],null))[_0xb437('0x23')](respondWithResult(_0x5c3024,null))['catch'](handleError(_0x5c3024,null));};exports['destroy']=function(_0x4e1017,_0x39f466){return db[_0xb437('0x2a')][_0xb437('0x48')]({'where':{'id':_0x4e1017['params']['id']}})['then'](handleEntityNotFound(_0x39f466,null))[_0xb437('0x23')](removeEntity(_0x39f466,null))['catch'](handleError(_0x39f466,null));}; \ No newline at end of file +var _0x4137=['findAll','catch','show','create','body','find','params','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','reject','save','update','then','destroy','stack','name','status','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','options','includeAll','include'];(function(_0x45816b,_0x141afe){var _0x1eca67=function(_0x43562e){while(--_0x43562e){_0x45816b['push'](_0x45816b['shift']());}};_0x1eca67(++_0x141afe);}(_0x4137,0xdf));var _0x7413=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x4137[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require(_0x7413('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7413('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7413('0x2'));var moment=require(_0x7413('0x3'));var BPromise=require(_0x7413('0x4'));var Mustache=require(_0x7413('0x5'));var util=require(_0x7413('0x6'));var path=require(_0x7413('0x7'));var sox=require(_0x7413('0x8'));var csv=require(_0x7413('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7413('0xa'));var _=require(_0x7413('0xb'));var squel=require(_0x7413('0xc'));var crypto=require(_0x7413('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7413('0xe'));var toCsv=require(_0x7413('0x9'));var querystring=require(_0x7413('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7413('0x10'));var qs=require(_0x7413('0x11'));var as=require(_0x7413('0x12'));var hardwareService=require(_0x7413('0x13'));var logger=require(_0x7413('0x14'))(_0x7413('0x15'));var utils=require(_0x7413('0x16'));var config=require(_0x7413('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7413('0x18'))['db'];function respondWithStatusCode(_0x3566ee,_0x4147ab){_0x4147ab=_0x4147ab||0xcc;return function(_0x3386d9){if(_0x3386d9){return _0x3566ee[_0x7413('0x19')](_0x4147ab);}return _0x3566ee['status'](_0x4147ab)[_0x7413('0x1a')]();};}function respondWithResult(_0x23dea9,_0x5c900a){_0x5c900a=_0x5c900a||0xc8;return function(_0x22b221){if(_0x22b221){return _0x23dea9['status'](_0x5c900a)[_0x7413('0x1b')](_0x22b221);}};}function respondWithFilteredResult(_0xf95605,_0x247432){return function(_0x28cc9c){if(_0x28cc9c){var _0x36150f=typeof _0x247432[_0x7413('0x1c')]===_0x7413('0x1d')&&typeof _0x247432[_0x7413('0x1e')]===_0x7413('0x1d');var _0x314675=_0x28cc9c[_0x7413('0x1f')];var _0x4e285e=_0x36150f?0x0:_0x247432['offset'];var _0x26b5c4=_0x36150f?_0x28cc9c['count']:_0x247432[_0x7413('0x1c')]+_0x247432[_0x7413('0x1e')];var _0xf1a49f;if(_0x26b5c4>=_0x314675){_0x26b5c4=_0x314675;_0xf1a49f=0xc8;}else{_0xf1a49f=0xce;}_0xf95605['status'](_0xf1a49f);return _0xf95605['set']('Content-Range',_0x4e285e+'-'+_0x26b5c4+'/'+_0x314675)['json'](_0x28cc9c);}return null;};}function patchUpdates(_0x5be836){return function(_0x2503e2){try{jsonpatch['apply'](_0x2503e2,_0x5be836,!![]);}catch(_0x5d8bd1){return BPromise[_0x7413('0x20')](_0x5d8bd1);}return _0x2503e2[_0x7413('0x21')]();};}function saveUpdates(_0x215e24,_0x11be20){return function(_0x1bb2a7){if(_0x1bb2a7){return _0x1bb2a7[_0x7413('0x22')](_0x215e24)[_0x7413('0x23')](function(_0xe2062){return _0xe2062;});}return null;};}function removeEntity(_0x359d5c,_0x2a2814){return function(_0x48f398){if(_0x48f398){return _0x48f398[_0x7413('0x24')]()[_0x7413('0x23')](function(){_0x359d5c['status'](0xcc)[_0x7413('0x1a')]();});}};}function handleEntityNotFound(_0x5e7ce8,_0x13f887){return function(_0x4b9e1d){if(!_0x4b9e1d){_0x5e7ce8[_0x7413('0x19')](0x194);}return _0x4b9e1d;};}function handleError(_0x2b0dd1,_0x59c0b5){_0x59c0b5=_0x59c0b5||0x1f4;return function(_0x391190){logger['error'](_0x391190[_0x7413('0x25')]);if(_0x391190[_0x7413('0x26')]){delete _0x391190[_0x7413('0x26')];}_0x2b0dd1[_0x7413('0x27')](_0x59c0b5)[_0x7413('0x28')](_0x391190);};}exports[_0x7413('0x29')]=function(_0x5e65c8,_0x360136){var _0xf56137={},_0x365ef8={},_0x1aadc2={'count':0x0,'rows':[]};var _0x133283=_[_0x7413('0x2a')](db[_0x7413('0x2b')][_0x7413('0x2c')],function(_0xe93c55){return{'name':_0xe93c55[_0x7413('0x2d')],'type':_0xe93c55[_0x7413('0x2e')][_0x7413('0x2f')]};});_0x365ef8[_0x7413('0x30')]=_['map'](_0x133283,_0x7413('0x26'));_0x365ef8[_0x7413('0x31')]=_[_0x7413('0x32')](_0x5e65c8[_0x7413('0x31')]);_0x365ef8[_0x7413('0x33')]=_[_0x7413('0x34')](_0x365ef8[_0x7413('0x30')],_0x365ef8['query']);_0xf56137[_0x7413('0x35')]=_[_0x7413('0x34')](_0x365ef8['model'],qs[_0x7413('0x36')](_0x5e65c8[_0x7413('0x31')]['fields']));_0xf56137[_0x7413('0x35')]=_0xf56137[_0x7413('0x35')][_0x7413('0x37')]?_0xf56137[_0x7413('0x35')]:_0x365ef8[_0x7413('0x30')];if(!_0x5e65c8['query']['hasOwnProperty'](_0x7413('0x38'))){_0xf56137['limit']=qs[_0x7413('0x1e')](_0x5e65c8[_0x7413('0x31')][_0x7413('0x1e')]);_0xf56137[_0x7413('0x1c')]=qs[_0x7413('0x1c')](_0x5e65c8[_0x7413('0x31')]['offset']);}_0xf56137[_0x7413('0x39')]=qs[_0x7413('0x3a')](_0x5e65c8['query']['sort']);_0xf56137[_0x7413('0x3b')]=qs[_0x7413('0x33')](_['pick'](_0x5e65c8[_0x7413('0x31')],_0x365ef8['filters']),_0x133283);if(_0x5e65c8['query'][_0x7413('0x3c')]){_0xf56137[_0x7413('0x3b')]=_[_0x7413('0x3d')](_0xf56137['where'],{'$or':_['map'](_0x133283,function(_0xe1b275){if(_0xe1b275['type']!=='VIRTUAL'){var _0x435446={};_0x435446[_0xe1b275[_0x7413('0x26')]]={'$like':'%'+_0x5e65c8[_0x7413('0x31')][_0x7413('0x3c')]+'%'};return _0x435446;}})});}_0xf56137=_[_0x7413('0x3d')]({},_0xf56137,_0x5e65c8[_0x7413('0x3e')]);var _0x255505={'where':_0xf56137[_0x7413('0x3b')]};return db[_0x7413('0x2b')][_0x7413('0x1f')](_0x255505)[_0x7413('0x23')](function(_0x3b09da){_0x1aadc2[_0x7413('0x1f')]=_0x3b09da;if(_0x5e65c8['query'][_0x7413('0x3f')]){_0xf56137[_0x7413('0x40')]=[{'all':!![]}];}return db[_0x7413('0x2b')][_0x7413('0x41')](_0xf56137);})['then'](function(_0x2a081d){_0x1aadc2['rows']=_0x2a081d;return _0x1aadc2;})[_0x7413('0x23')](respondWithFilteredResult(_0x360136,_0xf56137))[_0x7413('0x42')](handleError(_0x360136,null));};exports[_0x7413('0x43')]=function(_0x5e7286,_0x5383c0){var _0x3bc48f={'raw':!![],'where':{'id':_0x5e7286['params']['id']}},_0x151f4a={};_0x151f4a[_0x7413('0x30')]=_[_0x7413('0x32')](db[_0x7413('0x2b')][_0x7413('0x2c')]);_0x151f4a[_0x7413('0x31')]=_[_0x7413('0x32')](_0x5e7286[_0x7413('0x31')]);_0x151f4a[_0x7413('0x33')]=_[_0x7413('0x34')](_0x151f4a[_0x7413('0x30')],_0x151f4a[_0x7413('0x31')]);_0x3bc48f[_0x7413('0x35')]=_['intersection'](_0x151f4a[_0x7413('0x30')],qs[_0x7413('0x36')](_0x5e7286[_0x7413('0x31')][_0x7413('0x36')]));_0x3bc48f[_0x7413('0x35')]=_0x3bc48f[_0x7413('0x35')]['length']?_0x3bc48f[_0x7413('0x35')]:_0x151f4a['model'];if(_0x5e7286[_0x7413('0x31')][_0x7413('0x3f')]){_0x3bc48f[_0x7413('0x40')]=[{'all':!![]}];}_0x3bc48f=_[_0x7413('0x3d')]({},_0x3bc48f,_0x5e7286[_0x7413('0x3e')]);return db['SquareMessage']['find'](_0x3bc48f)[_0x7413('0x23')](handleEntityNotFound(_0x5383c0,null))[_0x7413('0x23')](respondWithResult(_0x5383c0,null))[_0x7413('0x42')](handleError(_0x5383c0,null));};exports[_0x7413('0x44')]=function(_0x298cd4,_0x516f91){return db[_0x7413('0x2b')][_0x7413('0x44')](_0x298cd4[_0x7413('0x45')],{})[_0x7413('0x23')](respondWithResult(_0x516f91,0xc9))[_0x7413('0x42')](handleError(_0x516f91,null));};exports['update']=function(_0x34a4f0,_0x4fc5c4){if(_0x34a4f0[_0x7413('0x45')]['id']){delete _0x34a4f0[_0x7413('0x45')]['id'];}return db['SquareMessage'][_0x7413('0x46')]({'where':{'id':_0x34a4f0['params']['id']}})[_0x7413('0x23')](handleEntityNotFound(_0x4fc5c4,null))[_0x7413('0x23')](saveUpdates(_0x34a4f0[_0x7413('0x45')],null))[_0x7413('0x23')](respondWithResult(_0x4fc5c4,null))[_0x7413('0x42')](handleError(_0x4fc5c4,null));};exports[_0x7413('0x24')]=function(_0x4588aa,_0x89f278){return db[_0x7413('0x2b')][_0x7413('0x46')]({'where':{'id':_0x4588aa[_0x7413('0x47')]['id']}})[_0x7413('0x23')](handleEntityNotFound(_0x89f278,null))[_0x7413('0x23')](removeEntity(_0x89f278,null))['catch'](handleError(_0x89f278,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 6120dcc..c6976ba 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 _0x5d98=['request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','define','square_messages','lodash','util','../../config/logger','moment'];(function(_0xc4e81c,_0x1374fe){var _0x30e247=function(_0x2d5617){while(--_0x2d5617){_0xc4e81c['push'](_0xc4e81c['shift']());}};_0x30e247(++_0x1374fe);}(_0x5d98,0x15c));var _0x85d9=function(_0x43ccb1,_0x23c325){_0x43ccb1=_0x43ccb1-0x0;var _0x2a9b79=_0x5d98[_0x43ccb1];return _0x2a9b79;};'use strict';var _=require(_0x85d9('0x0'));var util=require(_0x85d9('0x1'));var logger=require(_0x85d9('0x2'))('api');var moment=require(_0x85d9('0x3'));var BPromise=require('bluebird');var rp=require(_0x85d9('0x4'));var fs=require('fs');var path=require(_0x85d9('0x5'));var rimraf=require(_0x85d9('0x6'));var config=require(_0x85d9('0x7'));var attributes=require(_0x85d9('0x8'));module['exports']=function(_0x5c7e95,_0x32e7c2){return _0x5c7e95[_0x85d9('0x9')]('SquareMessage',attributes,{'tableName':_0x85d9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c42=['../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','api','moment','bluebird','request-promise','path'];(function(_0x48211f,_0xea37d){var _0x56ce75=function(_0x1b2d50){while(--_0x1b2d50){_0x48211f['push'](_0x48211f['shift']());}};_0x56ce75(++_0xea37d);}(_0x0c42,0x1da));var _0x20c4=function(_0x5400df,_0xdb9f84){_0x5400df=_0x5400df-0x0;var _0x40fdca=_0x0c42[_0x5400df];return _0x40fdca;};'use strict';var _=require(_0x20c4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x20c4('0x1'));var moment=require(_0x20c4('0x2'));var BPromise=require(_0x20c4('0x3'));var rp=require(_0x20c4('0x4'));var fs=require('fs');var path=require(_0x20c4('0x5'));var rimraf=require('rimraf');var config=require(_0x20c4('0x6'));var attributes=require(_0x20c4('0x7'));module[_0x20c4('0x8')]=function(_0x5b332a,_0xd37e87){return _0x5b332a[_0x20c4('0x9')](_0x20c4('0xa'),attributes,{'tableName':_0x20c4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 3c39c1f..cf679b9 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 _0x3d3d=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateSquareMessage','SquareMessage','body','options','stringify','catch','lodash'];(function(_0xbe5669,_0x105462){var _0x3a17b5=function(_0x123071){while(--_0x123071){_0xbe5669['push'](_0xbe5669['shift']());}};_0x3a17b5(++_0x105462);}(_0x3d3d,0x137));var _0xd3d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d3d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd3d3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd3d3('0x1'));var rs=require(_0xd3d3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd3d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd3d3('0x4'))(_0xd3d3('0x5'));var config=require(_0xd3d3('0x6'));var jayson=require(_0xd3d3('0x7'));var client=jayson[_0xd3d3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5742d6,_0x2ea34b,_0x5b335f){return new BPromise(function(_0x1770f,_0x48dac7){return client[_0xd3d3('0x9')](_0x5742d6,_0x5b335f)[_0xd3d3('0xa')](function(_0x4e2123){logger[_0xd3d3('0xb')](_0xd3d3('0xc'),_0x2ea34b,'request\x20sent');logger[_0xd3d3('0xd')](_0xd3d3('0xe'),_0x2ea34b,_0xd3d3('0xf'),JSON['stringify'](_0x4e2123));if(_0x4e2123['error']){if(_0x4e2123[_0xd3d3('0x10')][_0xd3d3('0x11')]===0x1f4){logger[_0xd3d3('0x10')]('SquareMessage,\x20%s,\x20%s',_0x2ea34b,_0x4e2123[_0xd3d3('0x10')][_0xd3d3('0x12')]);return _0x48dac7(_0x4e2123[_0xd3d3('0x10')]['message']);}logger['error']('SquareMessage,\x20%s,\x20%s',_0x2ea34b,_0x4e2123['error'][_0xd3d3('0x12')]);return _0x1770f(_0x4e2123[_0xd3d3('0x10')][_0xd3d3('0x12')]);}else{logger[_0xd3d3('0xb')](_0xd3d3('0xc'),_0x2ea34b,_0xd3d3('0xf'));_0x1770f(_0x4e2123[_0xd3d3('0x13')][_0xd3d3('0x12')]);}})['catch'](function(_0x4cebcc){logger[_0xd3d3('0x10')](_0xd3d3('0xc'),_0x2ea34b,_0x4cebcc);_0x48dac7(_0x4cebcc);});});}exports[_0xd3d3('0x14')]=function(_0x36d7bb){var _0x234505=this;return new Promise(function(_0x1db3d0,_0x33cb2d){return db[_0xd3d3('0x15')]['create'](_0x36d7bb[_0xd3d3('0x16')],{'raw':_0x36d7bb[_0xd3d3('0x17')]?_0x36d7bb[_0xd3d3('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x232088){logger[_0xd3d3('0xb')](_0xd3d3('0x14'),_0x36d7bb);logger[_0xd3d3('0xd')](_0xd3d3('0x14'),_0x36d7bb,JSON[_0xd3d3('0x18')](_0x232088));_0x1db3d0(_0x232088);})[_0xd3d3('0x19')](function(_0x4ba635){logger[_0xd3d3('0x10')](_0xd3d3('0x14'),_0x4ba635[_0xd3d3('0x12')],_0x36d7bb);_0x33cb2d(_0x234505[_0xd3d3('0x10')](0x1f4,_0x4ba635[_0xd3d3('0x12')]));});});}; \ No newline at end of file +var _0x554c=['catch','SquareMessage','create','body','options','raw','CreateSquareMessage','stringify','lodash','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x554c,0x1a8));var _0xc554=function(_0x23aa6f,_0x47359e){_0x23aa6f=_0x23aa6f-0x0;var _0x3e9139=_0x554c[_0x23aa6f];return _0x3e9139;};'use strict';var _=require(_0xc554('0x0'));var util=require('util');var moment=require(_0xc554('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc554('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc554('0x3'))(_0xc554('0x4'));var config=require(_0xc554('0x5'));var jayson=require(_0xc554('0x6'));var client=jayson['client'][_0xc554('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5f4559,_0x3cf5f1,_0x6a7010){return new BPromise(function(_0x6b2e7b,_0x378da6){return client['request'](_0x5f4559,_0x6a7010)[_0xc554('0x8')](function(_0x271810){logger[_0xc554('0x9')](_0xc554('0xa'),_0x3cf5f1,_0xc554('0xb'));logger[_0xc554('0xc')](_0xc554('0xd'),_0x3cf5f1,_0xc554('0xb'),JSON['stringify'](_0x271810));if(_0x271810[_0xc554('0xe')]){if(_0x271810[_0xc554('0xe')][_0xc554('0xf')]===0x1f4){logger[_0xc554('0xe')]('SquareMessage,\x20%s,\x20%s',_0x3cf5f1,_0x271810[_0xc554('0xe')][_0xc554('0x10')]);return _0x378da6(_0x271810[_0xc554('0xe')][_0xc554('0x10')]);}logger['error'](_0xc554('0xa'),_0x3cf5f1,_0x271810[_0xc554('0xe')][_0xc554('0x10')]);return _0x6b2e7b(_0x271810[_0xc554('0xe')][_0xc554('0x10')]);}else{logger['info'](_0xc554('0xa'),_0x3cf5f1,_0xc554('0xb'));_0x6b2e7b(_0x271810[_0xc554('0x11')][_0xc554('0x10')]);}})[_0xc554('0x12')](function(_0x72f2ad){logger[_0xc554('0xe')]('SquareMessage,\x20%s,\x20%s',_0x3cf5f1,_0x72f2ad);_0x378da6(_0x72f2ad);});});}exports['CreateSquareMessage']=function(_0x5a1240){var _0x27f944=this;return new Promise(function(_0x3ddf81,_0x34795){return db[_0xc554('0x13')][_0xc554('0x14')](_0x5a1240[_0xc554('0x15')],{'raw':_0x5a1240['options']?_0x5a1240[_0xc554('0x16')][_0xc554('0x17')]===undefined?!![]:![]:!![]})[_0xc554('0x8')](function(_0x35149d){logger[_0xc554('0x9')]('CreateSquareMessage',_0x5a1240);logger[_0xc554('0xc')](_0xc554('0x18'),_0x5a1240,JSON[_0xc554('0x19')](_0x35149d));_0x3ddf81(_0x35149d);})[_0xc554('0x12')](function(_0x42d272){logger[_0xc554('0xe')](_0xc554('0x18'),_0x42d272[_0xc554('0x10')],_0x5a1240);_0x34795(_0x27f944[_0xc554('0xe')](0x1f4,_0x42d272[_0xc554('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 94103c9..b676d9a 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 _0xe4bb=['isAuthenticated','index','show','15s','test','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./squareOdbc.controller','get'];(function(_0x5cd2ab,_0x2d162b){var _0x4663db=function(_0x54a66d){while(--_0x54a66d){_0x5cd2ab['push'](_0x5cd2ab['shift']());}};_0x4663db(++_0x2d162b);}(_0xe4bb,0x19c));var _0xbe4b=function(_0x50893e,_0xdae1be){_0x50893e=_0x50893e-0x0;var _0x55196b=_0xe4bb[_0x50893e];return _0x55196b;};'use strict';var multer=require(_0xbe4b('0x0'));var util=require(_0xbe4b('0x1'));var path=require(_0xbe4b('0x2'));var timeout=require(_0xbe4b('0x3'));var express=require('express');var router=express[_0xbe4b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbe4b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe4b('0x6'));router[_0xbe4b('0x7')]('/',auth[_0xbe4b('0x8')](),controller[_0xbe4b('0x9')]);router[_0xbe4b('0x7')]('/:id',auth[_0xbe4b('0x8')](),controller[_0xbe4b('0xa')]);router['get']('/:id/test',auth['isAuthenticated'](),timeout(_0xbe4b('0xb')),controller[_0xbe4b('0xc')]);router[_0xbe4b('0xd')]('/',auth[_0xbe4b('0x8')](),controller[_0xbe4b('0xe')]);router[_0xbe4b('0xf')](_0xbe4b('0x10'),auth[_0xbe4b('0x8')](),controller['update']);router[_0xbe4b('0x11')](_0xbe4b('0x10'),auth[_0xbe4b('0x8')](),controller[_0xbe4b('0x12')]);module[_0xbe4b('0x13')]=router; \ No newline at end of file +var _0x7849=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','show','/:id/test','15s','test','create','put','/:id','update','delete','destroy','exports','util'];(function(_0x495772,_0x43a2c8){var _0x5e0567=function(_0x49a872){while(--_0x49a872){_0x495772['push'](_0x495772['shift']());}};_0x5e0567(++_0x43a2c8);}(_0x7849,0xf1));var _0x9784=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7849[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x9784('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9784('0x1'));var router=express[_0x9784('0x2')]();var fs_extra=require(_0x9784('0x3'));var auth=require(_0x9784('0x4'));var interaction=require(_0x9784('0x5'));var config=require(_0x9784('0x6'));var controller=require(_0x9784('0x7'));router[_0x9784('0x8')]('/',auth[_0x9784('0x9')](),controller[_0x9784('0xa')]);router[_0x9784('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x9784('0xb')]);router[_0x9784('0x8')](_0x9784('0xc'),auth[_0x9784('0x9')](),timeout(_0x9784('0xd')),controller[_0x9784('0xe')]);router['post']('/',auth[_0x9784('0x9')](),controller[_0x9784('0xf')]);router[_0x9784('0x10')](_0x9784('0x11'),auth[_0x9784('0x9')](),controller[_0x9784('0x12')]);router[_0x9784('0x13')](_0x9784('0x11'),auth[_0x9784('0x9')](),controller[_0x9784('0x14')]);module[_0x9784('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 81012ea..246ad08 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 _0x9df1=['STRING','sequelize','name'];(function(_0x5a53f1,_0x282b3d){var _0x10f225=function(_0x1f7ee5){while(--_0x1f7ee5){_0x5a53f1['push'](_0x5a53f1['shift']());}};_0x10f225(++_0x282b3d);}(_0x9df1,0xbb));var _0x19df=function(_0x57e913,_0x3cef90){_0x57e913=_0x57e913-0x0;var _0x50ed36=_0x9df1[_0x57e913];return _0x50ed36;};'use strict';var Sequelize=require(_0x19df('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x19df('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0x19df('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbe61=['exports','STRING','name','sequelize'];(function(_0xec12cc,_0x14e3ce){var _0x1c4c8e=function(_0xc798b6){while(--_0xc798b6){_0xec12cc['push'](_0xec12cc['shift']());}};_0x1c4c8e(++_0x14e3ce);}(_0xbe61,0x193));var _0x1be6=function(_0x2adb79,_0x18e31a){_0x2adb79=_0x2adb79-0x0;var _0x2a662d=_0xbe61[_0x2adb79];return _0x2a662d;};'use strict';var Sequelize=require(_0x1be6('0x0'));module[_0x1be6('0x1')]={'name':{'type':Sequelize[_0x1be6('0x2')],'unique':_0x1be6('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x1be6('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 3383f13..48aa70b 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 _0xefbf=['limit','set','Content-Range','apply','reject','save','update','then','get','ODBC','UserProfileResource','destroy','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','show','keys','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','params','test','dsn','odbc','openSync','closeSync','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','count'];(function(_0x29311d,_0x3f9e23){var _0xa29b8f=function(_0x2bb490){while(--_0x2bb490){_0x29311d['push'](_0x29311d['shift']());}};_0xa29b8f(++_0x3f9e23);}(_0xefbf,0x191));var _0xfefb=function(_0x4c008b,_0xa7851a){_0x4c008b=_0x4c008b-0x0;var _0x25f2cb=_0xefbf[_0x4c008b];return _0x25f2cb;};'use strict';var emlformat=require(_0xfefb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfefb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfefb('0x2'));var moment=require('moment');var BPromise=require(_0xfefb('0x3'));var Mustache=require(_0xfefb('0x4'));var util=require(_0xfefb('0x5'));var path=require(_0xfefb('0x6'));var sox=require(_0xfefb('0x7'));var csv=require(_0xfefb('0x8'));var ejs=require(_0xfefb('0x9'));var fs=require('fs');var fs_extra=require(_0xfefb('0xa'));var _=require(_0xfefb('0xb'));var squel=require(_0xfefb('0xc'));var crypto=require(_0xfefb('0xd'));var jsforce=require(_0xfefb('0xe'));var deskjs=require(_0xfefb('0xf'));var toCsv=require(_0xfefb('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfefb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfefb('0x11'));var as=require(_0xfefb('0x12'));var hardwareService=require(_0xfefb('0x13'));var logger=require('../../config/logger')(_0xfefb('0x14'));var utils=require(_0xfefb('0x15'));var config=require(_0xfefb('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17f325,_0x3c8824){_0x3c8824=_0x3c8824||0xcc;return function(_0x1ab8d0){if(_0x1ab8d0){return _0x17f325[_0xfefb('0x17')](_0x3c8824);}return _0x17f325[_0xfefb('0x18')](_0x3c8824)[_0xfefb('0x19')]();};}function respondWithResult(_0x5a11fc,_0x206354){_0x206354=_0x206354||0xc8;return function(_0x28907f){if(_0x28907f){return _0x5a11fc[_0xfefb('0x18')](_0x206354)['json'](_0x28907f);}};}function respondWithFilteredResult(_0x4f95e3,_0x100e89){return function(_0x578997){if(_0x578997){var _0x50debc=typeof _0x100e89[_0xfefb('0x1a')]===_0xfefb('0x1b')&&typeof _0x100e89['limit']===_0xfefb('0x1b');var _0x12b43f=_0x578997[_0xfefb('0x1c')];var _0x53551e=_0x50debc?0x0:_0x100e89[_0xfefb('0x1a')];var _0x1b80ca=_0x50debc?_0x578997[_0xfefb('0x1c')]:_0x100e89[_0xfefb('0x1a')]+_0x100e89[_0xfefb('0x1d')];var _0x45eb27;if(_0x1b80ca>=_0x12b43f){_0x1b80ca=_0x12b43f;_0x45eb27=0xc8;}else{_0x45eb27=0xce;}_0x4f95e3['status'](_0x45eb27);return _0x4f95e3[_0xfefb('0x1e')](_0xfefb('0x1f'),_0x53551e+'-'+_0x1b80ca+'/'+_0x12b43f)['json'](_0x578997);}return null;};}function patchUpdates(_0x117a3a){return function(_0x162a89){try{jsonpatch[_0xfefb('0x20')](_0x162a89,_0x117a3a,!![]);}catch(_0x3aedba){return BPromise[_0xfefb('0x21')](_0x3aedba);}return _0x162a89[_0xfefb('0x22')]();};}function saveUpdates(_0x248603,_0xf1b5b0){return function(_0x21a3ea){if(_0x21a3ea){return _0x21a3ea[_0xfefb('0x23')](_0x248603)[_0xfefb('0x24')](function(_0x2ca43f){return _0x2ca43f;});}return null;};}function removeEntity(_0x5ce1de,_0x359ff3){return function(_0x103fdb){if(_0x103fdb){return _0x103fdb['destroy']()['then'](function(){var _0x3a46a4=_0x103fdb[_0xfefb('0x25')]({'plain':!![]});var _0x44155a=_0xfefb('0x26');return db[_0xfefb('0x27')][_0xfefb('0x28')]({'where':{'type':_0x44155a,'resourceId':_0x3a46a4['id']}})['then'](function(){return _0x103fdb;});})[_0xfefb('0x24')](function(){_0x5ce1de[_0xfefb('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ca74e,_0x446190){return function(_0x59dd01){if(!_0x59dd01){_0x4ca74e[_0xfefb('0x17')](0x194);}return _0x59dd01;};}function handleError(_0x4c74e8,_0x29339e){_0x29339e=_0x29339e||0x1f4;return function(_0x3daef8){logger[_0xfefb('0x29')](_0x3daef8[_0xfefb('0x2a')]);if(_0x3daef8[_0xfefb('0x2b')]){delete _0x3daef8[_0xfefb('0x2b')];}_0x4c74e8[_0xfefb('0x18')](_0x29339e)[_0xfefb('0x2c')](_0x3daef8);};}exports[_0xfefb('0x2d')]=function(_0x2e5270,_0x3beba9){var _0x1ee906={},_0x4f70de={},_0x57b891={'count':0x0,'rows':[]};var _0x5a42cc=_[_0xfefb('0x2e')](db[_0xfefb('0x2f')][_0xfefb('0x30')],function(_0x318418){return{'name':_0x318418[_0xfefb('0x31')],'type':_0x318418[_0xfefb('0x32')]['key']};});_0x4f70de[_0xfefb('0x33')]=_[_0xfefb('0x2e')](_0x5a42cc,_0xfefb('0x2b'));_0x4f70de[_0xfefb('0x34')]=_['keys'](_0x2e5270[_0xfefb('0x34')]);_0x4f70de[_0xfefb('0x35')]=_['intersection'](_0x4f70de[_0xfefb('0x33')],_0x4f70de['query']);_0x1ee906['attributes']=_[_0xfefb('0x36')](_0x4f70de[_0xfefb('0x33')],qs[_0xfefb('0x37')](_0x2e5270[_0xfefb('0x34')][_0xfefb('0x37')]));_0x1ee906[_0xfefb('0x38')]=_0x1ee906[_0xfefb('0x38')][_0xfefb('0x39')]?_0x1ee906[_0xfefb('0x38')]:_0x4f70de[_0xfefb('0x33')];if(!_0x2e5270[_0xfefb('0x34')][_0xfefb('0x3a')](_0xfefb('0x3b'))){_0x1ee906[_0xfefb('0x1d')]=qs['limit'](_0x2e5270['query'][_0xfefb('0x1d')]);_0x1ee906[_0xfefb('0x1a')]=qs[_0xfefb('0x1a')](_0x2e5270[_0xfefb('0x34')][_0xfefb('0x1a')]);}_0x1ee906['order']=qs['sort'](_0x2e5270['query'][_0xfefb('0x3c')]);_0x1ee906[_0xfefb('0x3d')]=qs['filters'](_[_0xfefb('0x3e')](_0x2e5270[_0xfefb('0x34')],_0x4f70de['filters']),_0x5a42cc);if(_0x2e5270[_0xfefb('0x34')][_0xfefb('0x3f')]){_0x1ee906['where']=_[_0xfefb('0x40')](_0x1ee906[_0xfefb('0x3d')],{'$or':_[_0xfefb('0x2e')](_0x5a42cc,function(_0x4c8027){if(_0x4c8027[_0xfefb('0x32')]!==_0xfefb('0x41')){var _0x5930bd={};_0x5930bd[_0x4c8027[_0xfefb('0x2b')]]={'$like':'%'+_0x2e5270[_0xfefb('0x34')][_0xfefb('0x3f')]+'%'};return _0x5930bd;}})});}_0x1ee906=_[_0xfefb('0x40')]({},_0x1ee906,_0x2e5270[_0xfefb('0x42')]);var _0x176cd8={'where':_0x1ee906['where']};return db[_0xfefb('0x2f')][_0xfefb('0x1c')](_0x176cd8)[_0xfefb('0x24')](function(_0x1bc95a){_0x57b891['count']=_0x1bc95a;if(_0x2e5270[_0xfefb('0x34')][_0xfefb('0x43')]){_0x1ee906[_0xfefb('0x44')]=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x1ee906);})['then'](function(_0x52b583){_0x57b891['rows']=_0x52b583;return _0x57b891;})['then'](respondWithFilteredResult(_0x3beba9,_0x1ee906))['catch'](handleError(_0x3beba9,null));};exports[_0xfefb('0x45')]=function(_0x59c02e,_0x4b5205){var _0x10cf50={'raw':!![],'where':{'id':_0x59c02e['params']['id']}},_0x1e5a5b={};_0x1e5a5b[_0xfefb('0x33')]=_[_0xfefb('0x46')](db['SquareOdbc']['rawAttributes']);_0x1e5a5b['query']=_[_0xfefb('0x46')](_0x59c02e['query']);_0x1e5a5b[_0xfefb('0x35')]=_['intersection'](_0x1e5a5b[_0xfefb('0x33')],_0x1e5a5b[_0xfefb('0x34')]);_0x10cf50[_0xfefb('0x38')]=_[_0xfefb('0x36')](_0x1e5a5b[_0xfefb('0x33')],qs[_0xfefb('0x37')](_0x59c02e[_0xfefb('0x34')][_0xfefb('0x37')]));_0x10cf50[_0xfefb('0x38')]=_0x10cf50['attributes'][_0xfefb('0x39')]?_0x10cf50[_0xfefb('0x38')]:_0x1e5a5b[_0xfefb('0x33')];if(_0x59c02e[_0xfefb('0x34')]['includeAll']){_0x10cf50[_0xfefb('0x44')]=[{'all':!![]}];}_0x10cf50=_['merge']({},_0x10cf50,_0x59c02e[_0xfefb('0x42')]);return db[_0xfefb('0x2f')][_0xfefb('0x47')](_0x10cf50)['then'](handleEntityNotFound(_0x4b5205,null))[_0xfefb('0x24')](respondWithResult(_0x4b5205,null))[_0xfefb('0x48')](handleError(_0x4b5205,null));};exports[_0xfefb('0x49')]=function(_0x2da76a,_0x4c5cc2){return db[_0xfefb('0x2f')][_0xfefb('0x49')](_0x2da76a[_0xfefb('0x4a')],{})['then'](function(_0x27ac72){var _0x497526=_0x2da76a[_0xfefb('0x4b')][_0xfefb('0x25')]({'plain':!![]});if(!_0x497526)throw new Error(_0xfefb('0x4c'));if(_0x497526['role']==='user'){var _0x244a3c=_0x27ac72[_0xfefb('0x25')]({'plain':!![]});var _0x51adaa=_0xfefb('0x26');return db[_0xfefb('0x4d')]['find']({'where':{'name':_0x51adaa,'userProfileId':_0x497526[_0xfefb('0x4e')]},'raw':!![]})[_0xfefb('0x24')](function(_0x3f9faf){if(_0x3f9faf&&_0x3f9faf[_0xfefb('0x4f')]===0x0){return db[_0xfefb('0x27')]['create']({'name':_0x244a3c[_0xfefb('0x2b')],'resourceId':_0x244a3c['id'],'type':_0x3f9faf[_0xfefb('0x2b')],'sectionId':_0x3f9faf['id']},{})[_0xfefb('0x24')](function(){return _0x27ac72;});}else{return _0x27ac72;}})['catch'](function(_0x1c99e5){logger[_0xfefb('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c99e5);throw _0x1c99e5;});}return _0x27ac72;})['then'](respondWithResult(_0x4c5cc2,0xc9))['catch'](handleError(_0x4c5cc2,null));};exports[_0xfefb('0x23')]=function(_0xcc6416,_0x4bf24f){if(_0xcc6416[_0xfefb('0x4a')]['id']){delete _0xcc6416['body']['id'];}return db[_0xfefb('0x2f')][_0xfefb('0x47')]({'where':{'id':_0xcc6416['params']['id']}})[_0xfefb('0x24')](handleEntityNotFound(_0x4bf24f,null))['then'](saveUpdates(_0xcc6416[_0xfefb('0x4a')],null))['then'](respondWithResult(_0x4bf24f,null))[_0xfefb('0x48')](handleError(_0x4bf24f,null));};exports[_0xfefb('0x28')]=function(_0x46f035,_0x5dd72e){return db[_0xfefb('0x2f')][_0xfefb('0x47')]({'where':{'id':_0x46f035[_0xfefb('0x50')]['id']}})['then'](handleEntityNotFound(_0x5dd72e,null))[_0xfefb('0x24')](removeEntity(_0x5dd72e,null))['catch'](handleError(_0x5dd72e,null));};exports[_0xfefb('0x51')]=function(_0x3547b4,_0x2a827f,_0x33cc20){var _0x157d05;return db[_0xfefb('0x2f')][_0xfefb('0x47')]({'where':{'id':_0x3547b4['params']['id']},'attributes':['id',_0xfefb('0x52')]})[_0xfefb('0x24')](handleEntityNotFound(_0x2a827f,null))[_0xfefb('0x24')](function(_0x37b7f7){if(_0x37b7f7){var _0xbacb8a=require(_0xfefb('0x53'))();_0xbacb8a[_0xfefb('0x54')](_0x37b7f7[_0xfefb('0x52')]);_0xbacb8a[_0xfefb('0x55')]();return _0x37b7f7;}})[_0xfefb('0x24')](respondWithResult(_0x2a827f,null))[_0xfefb('0x48')](handleError(_0x2a827f,null));}; \ No newline at end of file +var _0x9fe0=['keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','SquareOdbc','includeAll','include','findAll','rows','catch','rawAttributes','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','then','error','stack','name','send','index','fieldName','key','model','map','query'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x9fe0,0xe1));var _0x09fe=function(_0x99a359,_0x35d990){_0x99a359=_0x99a359-0x0;var _0x1ad812=_0x9fe0[_0x99a359];return _0x1ad812;};'use strict';var emlformat=require(_0x09fe('0x0'));var rimraf=require(_0x09fe('0x1'));var zipdir=require(_0x09fe('0x2'));var jsonpatch=require(_0x09fe('0x3'));var rp=require(_0x09fe('0x4'));var moment=require(_0x09fe('0x5'));var BPromise=require(_0x09fe('0x6'));var Mustache=require(_0x09fe('0x7'));var util=require('util');var path=require(_0x09fe('0x8'));var sox=require(_0x09fe('0x9'));var csv=require(_0x09fe('0xa'));var ejs=require(_0x09fe('0xb'));var fs=require('fs');var fs_extra=require(_0x09fe('0xc'));var _=require(_0x09fe('0xd'));var squel=require(_0x09fe('0xe'));var crypto=require(_0x09fe('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x09fe('0x10'));var toCsv=require(_0x09fe('0xa'));var querystring=require(_0x09fe('0x11'));var Papa=require('papaparse');var Redis=require(_0x09fe('0x12'));var authService=require(_0x09fe('0x13'));var qs=require(_0x09fe('0x14'));var as=require(_0x09fe('0x15'));var hardwareService=require(_0x09fe('0x16'));var logger=require(_0x09fe('0x17'))(_0x09fe('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x09fe('0x19'));var db=require(_0x09fe('0x1a'))['db'];function respondWithStatusCode(_0x5a435e,_0x2f5eca){_0x2f5eca=_0x2f5eca||0xcc;return function(_0x227087){if(_0x227087){return _0x5a435e['sendStatus'](_0x2f5eca);}return _0x5a435e[_0x09fe('0x1b')](_0x2f5eca)[_0x09fe('0x1c')]();};}function respondWithResult(_0xae79d1,_0x5c730c){_0x5c730c=_0x5c730c||0xc8;return function(_0xdae3a4){if(_0xdae3a4){return _0xae79d1[_0x09fe('0x1b')](_0x5c730c)[_0x09fe('0x1d')](_0xdae3a4);}};}function respondWithFilteredResult(_0x1576c1,_0x158c59){return function(_0x1714ca){if(_0x1714ca){var _0x18e1a7=typeof _0x158c59['offset']===_0x09fe('0x1e')&&typeof _0x158c59['limit']===_0x09fe('0x1e');var _0x5938c2=_0x1714ca[_0x09fe('0x1f')];var _0xb5143b=_0x18e1a7?0x0:_0x158c59[_0x09fe('0x20')];var _0x5bd632=_0x18e1a7?_0x1714ca[_0x09fe('0x1f')]:_0x158c59[_0x09fe('0x20')]+_0x158c59[_0x09fe('0x21')];var _0x290d2e;if(_0x5bd632>=_0x5938c2){_0x5bd632=_0x5938c2;_0x290d2e=0xc8;}else{_0x290d2e=0xce;}_0x1576c1[_0x09fe('0x1b')](_0x290d2e);return _0x1576c1[_0x09fe('0x22')](_0x09fe('0x23'),_0xb5143b+'-'+_0x5bd632+'/'+_0x5938c2)[_0x09fe('0x1d')](_0x1714ca);}return null;};}function patchUpdates(_0x1f63c4){return function(_0x2f7871){try{jsonpatch[_0x09fe('0x24')](_0x2f7871,_0x1f63c4,!![]);}catch(_0x45c5b7){return BPromise[_0x09fe('0x25')](_0x45c5b7);}return _0x2f7871[_0x09fe('0x26')]();};}function saveUpdates(_0x1edc50,_0x2b01b5){return function(_0x2e6ed9){if(_0x2e6ed9){return _0x2e6ed9[_0x09fe('0x27')](_0x1edc50)['then'](function(_0x289361){return _0x289361;});}return null;};}function removeEntity(_0x21ce18,_0x5b0451){return function(_0x123157){if(_0x123157){return _0x123157[_0x09fe('0x28')]()['then'](function(){var _0x583ee2=_0x123157[_0x09fe('0x29')]({'plain':!![]});var _0x592850='ODBC';return db[_0x09fe('0x2a')][_0x09fe('0x28')]({'where':{'type':_0x592850,'resourceId':_0x583ee2['id']}})[_0x09fe('0x2b')](function(){return _0x123157;});})[_0x09fe('0x2b')](function(){_0x21ce18['status'](0xcc)[_0x09fe('0x1c')]();});}};}function handleEntityNotFound(_0xfe763d,_0x104d00){return function(_0x410c40){if(!_0x410c40){_0xfe763d['sendStatus'](0x194);}return _0x410c40;};}function handleError(_0x2d476c,_0x5364a4){_0x5364a4=_0x5364a4||0x1f4;return function(_0x1cfae0){logger[_0x09fe('0x2c')](_0x1cfae0[_0x09fe('0x2d')]);if(_0x1cfae0[_0x09fe('0x2e')]){delete _0x1cfae0[_0x09fe('0x2e')];}_0x2d476c['status'](_0x5364a4)[_0x09fe('0x2f')](_0x1cfae0);};}exports[_0x09fe('0x30')]=function(_0x2a44a4,_0x36bb08){var _0xb01174={},_0xf772e0={},_0x3da4a6={'count':0x0,'rows':[]};var _0x419104=_['map'](db['SquareOdbc']['rawAttributes'],function(_0x55ea3e){return{'name':_0x55ea3e[_0x09fe('0x31')],'type':_0x55ea3e['type'][_0x09fe('0x32')]};});_0xf772e0[_0x09fe('0x33')]=_[_0x09fe('0x34')](_0x419104,_0x09fe('0x2e'));_0xf772e0[_0x09fe('0x35')]=_[_0x09fe('0x36')](_0x2a44a4[_0x09fe('0x35')]);_0xf772e0['filters']=_[_0x09fe('0x37')](_0xf772e0[_0x09fe('0x33')],_0xf772e0[_0x09fe('0x35')]);_0xb01174[_0x09fe('0x38')]=_['intersection'](_0xf772e0['model'],qs[_0x09fe('0x39')](_0x2a44a4[_0x09fe('0x35')][_0x09fe('0x39')]));_0xb01174['attributes']=_0xb01174[_0x09fe('0x38')][_0x09fe('0x3a')]?_0xb01174[_0x09fe('0x38')]:_0xf772e0[_0x09fe('0x33')];if(!_0x2a44a4[_0x09fe('0x35')][_0x09fe('0x3b')](_0x09fe('0x3c'))){_0xb01174[_0x09fe('0x21')]=qs[_0x09fe('0x21')](_0x2a44a4[_0x09fe('0x35')][_0x09fe('0x21')]);_0xb01174[_0x09fe('0x20')]=qs['offset'](_0x2a44a4[_0x09fe('0x35')]['offset']);}_0xb01174[_0x09fe('0x3d')]=qs[_0x09fe('0x3e')](_0x2a44a4[_0x09fe('0x35')][_0x09fe('0x3e')]);_0xb01174[_0x09fe('0x3f')]=qs['filters'](_[_0x09fe('0x40')](_0x2a44a4['query'],_0xf772e0[_0x09fe('0x41')]),_0x419104);if(_0x2a44a4[_0x09fe('0x35')][_0x09fe('0x42')]){_0xb01174[_0x09fe('0x3f')]=_[_0x09fe('0x43')](_0xb01174[_0x09fe('0x3f')],{'$or':_[_0x09fe('0x34')](_0x419104,function(_0x25cec4){if(_0x25cec4[_0x09fe('0x44')]!==_0x09fe('0x45')){var _0x2d4a5a={};_0x2d4a5a[_0x25cec4[_0x09fe('0x2e')]]={'$like':'%'+_0x2a44a4['query'][_0x09fe('0x42')]+'%'};return _0x2d4a5a;}})});}_0xb01174=_[_0x09fe('0x43')]({},_0xb01174,_0x2a44a4[_0x09fe('0x46')]);var _0x2501f3={'where':_0xb01174[_0x09fe('0x3f')]};return db[_0x09fe('0x47')]['count'](_0x2501f3)[_0x09fe('0x2b')](function(_0xbbf7f7){_0x3da4a6[_0x09fe('0x1f')]=_0xbbf7f7;if(_0x2a44a4[_0x09fe('0x35')][_0x09fe('0x48')]){_0xb01174[_0x09fe('0x49')]=[{'all':!![]}];}return db[_0x09fe('0x47')][_0x09fe('0x4a')](_0xb01174);})[_0x09fe('0x2b')](function(_0x3b1e73){_0x3da4a6[_0x09fe('0x4b')]=_0x3b1e73;return _0x3da4a6;})['then'](respondWithFilteredResult(_0x36bb08,_0xb01174))[_0x09fe('0x4c')](handleError(_0x36bb08,null));};exports['show']=function(_0x4eb516,_0x59a101){var _0x270d44={'raw':!![],'where':{'id':_0x4eb516['params']['id']}},_0x3f0644={};_0x3f0644[_0x09fe('0x33')]=_[_0x09fe('0x36')](db[_0x09fe('0x47')][_0x09fe('0x4d')]);_0x3f0644[_0x09fe('0x35')]=_[_0x09fe('0x36')](_0x4eb516['query']);_0x3f0644[_0x09fe('0x41')]=_['intersection'](_0x3f0644[_0x09fe('0x33')],_0x3f0644[_0x09fe('0x35')]);_0x270d44[_0x09fe('0x38')]=_[_0x09fe('0x37')](_0x3f0644[_0x09fe('0x33')],qs[_0x09fe('0x39')](_0x4eb516[_0x09fe('0x35')]['fields']));_0x270d44[_0x09fe('0x38')]=_0x270d44[_0x09fe('0x38')]['length']?_0x270d44['attributes']:_0x3f0644[_0x09fe('0x33')];if(_0x4eb516[_0x09fe('0x35')][_0x09fe('0x48')]){_0x270d44[_0x09fe('0x49')]=[{'all':!![]}];}_0x270d44=_[_0x09fe('0x43')]({},_0x270d44,_0x4eb516[_0x09fe('0x46')]);return db[_0x09fe('0x47')]['find'](_0x270d44)['then'](handleEntityNotFound(_0x59a101,null))[_0x09fe('0x2b')](respondWithResult(_0x59a101,null))[_0x09fe('0x4c')](handleError(_0x59a101,null));};exports[_0x09fe('0x4e')]=function(_0x12e7f2,_0x235cb5){return db['SquareOdbc']['create'](_0x12e7f2[_0x09fe('0x4f')],{})[_0x09fe('0x2b')](function(_0x26ca1e){var _0x290623=_0x12e7f2['user'][_0x09fe('0x29')]({'plain':!![]});if(!_0x290623)throw new Error(_0x09fe('0x50'));if(_0x290623[_0x09fe('0x51')]===_0x09fe('0x52')){var _0x73c65a=_0x26ca1e['get']({'plain':!![]});var _0x583675='ODBC';return db[_0x09fe('0x53')][_0x09fe('0x54')]({'where':{'name':_0x583675,'userProfileId':_0x290623['userProfileId']},'raw':!![]})['then'](function(_0x8f4ad6){if(_0x8f4ad6&&_0x8f4ad6[_0x09fe('0x55')]===0x0){return db[_0x09fe('0x2a')][_0x09fe('0x4e')]({'name':_0x73c65a['name'],'resourceId':_0x73c65a['id'],'type':_0x8f4ad6[_0x09fe('0x2e')],'sectionId':_0x8f4ad6['id']},{})[_0x09fe('0x2b')](function(){return _0x26ca1e;});}else{return _0x26ca1e;}})['catch'](function(_0x5781d8){logger[_0x09fe('0x2c')](_0x09fe('0x56'),_0x5781d8);throw _0x5781d8;});}return _0x26ca1e;})[_0x09fe('0x2b')](respondWithResult(_0x235cb5,0xc9))[_0x09fe('0x4c')](handleError(_0x235cb5,null));};exports[_0x09fe('0x27')]=function(_0x5d284a,_0x4808a5){if(_0x5d284a[_0x09fe('0x4f')]['id']){delete _0x5d284a[_0x09fe('0x4f')]['id'];}return db[_0x09fe('0x47')][_0x09fe('0x54')]({'where':{'id':_0x5d284a['params']['id']}})[_0x09fe('0x2b')](handleEntityNotFound(_0x4808a5,null))[_0x09fe('0x2b')](saveUpdates(_0x5d284a[_0x09fe('0x4f')],null))['then'](respondWithResult(_0x4808a5,null))[_0x09fe('0x4c')](handleError(_0x4808a5,null));};exports[_0x09fe('0x28')]=function(_0x212b88,_0x2abbc9){return db[_0x09fe('0x47')][_0x09fe('0x54')]({'where':{'id':_0x212b88[_0x09fe('0x57')]['id']}})[_0x09fe('0x2b')](handleEntityNotFound(_0x2abbc9,null))[_0x09fe('0x2b')](removeEntity(_0x2abbc9,null))[_0x09fe('0x4c')](handleError(_0x2abbc9,null));};exports[_0x09fe('0x58')]=function(_0x3a21e7,_0x39cfe9,_0x5b8244){var _0x3e6bf7;return db[_0x09fe('0x47')][_0x09fe('0x54')]({'where':{'id':_0x3a21e7[_0x09fe('0x57')]['id']},'attributes':['id',_0x09fe('0x59')]})[_0x09fe('0x2b')](handleEntityNotFound(_0x39cfe9,null))[_0x09fe('0x2b')](function(_0x2fdf58){if(_0x2fdf58){var _0x4ccc40=require(_0x09fe('0x5a'))();_0x4ccc40[_0x09fe('0x5b')](_0x2fdf58[_0x09fe('0x59')]);_0x4ccc40[_0x09fe('0x5c')]();return _0x2fdf58;}})[_0x09fe('0x2b')](respondWithResult(_0x39cfe9,null))[_0x09fe('0x4c')](handleError(_0x39cfe9,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index fe1d116..64118eb 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 _0xca60=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','square_odbc','lodash','util'];(function(_0x25ad66,_0x46e4dc){var _0x141bc4=function(_0x3a7f8e){while(--_0x3a7f8e){_0x25ad66['push'](_0x25ad66['shift']());}};_0x141bc4(++_0x46e4dc);}(_0xca60,0x106));var _0x0ca6=function(_0x510b98,_0x4c4cbb){_0x510b98=_0x510b98-0x0;var _0x45e775=_0xca60[_0x510b98];return _0x45e775;};'use strict';var _=require(_0x0ca6('0x0'));var util=require(_0x0ca6('0x1'));var logger=require(_0x0ca6('0x2'))('api');var moment=require(_0x0ca6('0x3'));var BPromise=require(_0x0ca6('0x4'));var rp=require(_0x0ca6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0ca6('0x6'));var config=require(_0x0ca6('0x7'));var attributes=require(_0x0ca6('0x8'));module[_0x0ca6('0x9')]=function(_0x544eb3,_0x181d0e){return _0x544eb3[_0x0ca6('0xa')]('SquareOdbc',attributes,{'tableName':_0x0ca6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7127=['path','rimraf','exports','define','SquareOdbc','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xfe3767,_0x70c299){var _0x5d68ea=function(_0x26e07a){while(--_0x26e07a){_0xfe3767['push'](_0xfe3767['shift']());}};_0x5d68ea(++_0x70c299);}(_0x7127,0xb9));var _0x7712=function(_0x45dccf,_0x2b4c7a){_0x45dccf=_0x45dccf-0x0;var _0x3546df=_0x7127[_0x45dccf];return _0x3546df;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7712('0x0'))(_0x7712('0x1'));var moment=require(_0x7712('0x2'));var BPromise=require(_0x7712('0x3'));var rp=require(_0x7712('0x4'));var fs=require('fs');var path=require(_0x7712('0x5'));var rimraf=require(_0x7712('0x6'));var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0x7712('0x7')]=function(_0x4e134b,_0x4b78e0){return _0x4e134b[_0x7712('0x8')](_0x7712('0x9'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 38f94fa..f4d585a 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 _0x187e=['where','attributes','include','map','model','ShowSquareOdbc','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SquareOdbc','options','raw'];(function(_0x59c3c1,_0x2b8e45){var _0xfd7c10=function(_0x44cdce){while(--_0x44cdce){_0x59c3c1['push'](_0x59c3c1['shift']());}};_0xfd7c10(++_0x2b8e45);}(_0x187e,0x1d5));var _0xe187=function(_0x3b685e,_0xb93ffa){_0x3b685e=_0x3b685e-0x0;var _0x437168=_0x187e[_0x3b685e];return _0x437168;};'use strict';var _=require(_0xe187('0x0'));var util=require(_0xe187('0x1'));var moment=require(_0xe187('0x2'));var BPromise=require(_0xe187('0x3'));var rs=require(_0xe187('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe187('0x5'))['db'];var utils=require(_0xe187('0x6'));var logger=require(_0xe187('0x7'))('rpc');var config=require(_0xe187('0x8'));var jayson=require(_0xe187('0x9'));var client=jayson['client'][_0xe187('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x993875,_0xc0c751,_0x392294){return new BPromise(function(_0x2610e6,_0x52e4a5){return client[_0xe187('0xb')](_0x993875,_0x392294)[_0xe187('0xc')](function(_0x37fa4a){logger[_0xe187('0xd')](_0xe187('0xe'),_0xc0c751,_0xe187('0xf'));logger[_0xe187('0x10')](_0xe187('0x11'),_0xc0c751,'request\x20sent',JSON['stringify'](_0x37fa4a));if(_0x37fa4a[_0xe187('0x12')]){if(_0x37fa4a[_0xe187('0x12')][_0xe187('0x13')]===0x1f4){logger[_0xe187('0x12')](_0xe187('0xe'),_0xc0c751,_0x37fa4a[_0xe187('0x12')][_0xe187('0x14')]);return _0x52e4a5(_0x37fa4a['error']['message']);}logger[_0xe187('0x12')](_0xe187('0xe'),_0xc0c751,_0x37fa4a['error'][_0xe187('0x14')]);return _0x2610e6(_0x37fa4a['error'][_0xe187('0x14')]);}else{logger['info'](_0xe187('0xe'),_0xc0c751,_0xe187('0xf'));_0x2610e6(_0x37fa4a[_0xe187('0x15')][_0xe187('0x14')]);}})[_0xe187('0x16')](function(_0x4943cf){logger['error'](_0xe187('0xe'),_0xc0c751,_0x4943cf);_0x52e4a5(_0x4943cf);});});}exports['ShowSquareOdbc']=function(_0x461130){var _0x319014=this;return new Promise(function(_0x1b35e1,_0x39e692){return db[_0xe187('0x17')]['find']({'raw':_0x461130[_0xe187('0x18')]?_0x461130['options'][_0xe187('0x19')]===undefined?!![]:![]:!![],'where':_0x461130[_0xe187('0x18')]?_0x461130[_0xe187('0x18')][_0xe187('0x1a')]||null:null,'attributes':_0x461130[_0xe187('0x18')]?_0x461130['options'][_0xe187('0x1b')]||null:null,'include':_0x461130[_0xe187('0x18')]?_0x461130[_0xe187('0x18')][_0xe187('0x1c')]?_[_0xe187('0x1d')](_0x461130['options'][_0xe187('0x1c')],function(_0x2f2947){return{'model':db[_0x2f2947[_0xe187('0x1e')]],'as':_0x2f2947['as'],'attributes':_0x2f2947[_0xe187('0x1b')],'include':_0x2f2947[_0xe187('0x1c')]?_[_0xe187('0x1d')](_0x2f2947['include'],function(_0x4d7c47){return{'model':db[_0x4d7c47[_0xe187('0x1e')]],'as':_0x4d7c47['as'],'attributes':_0x4d7c47[_0xe187('0x1b')],'include':_0x4d7c47[_0xe187('0x1c')]?_[_0xe187('0x1d')](_0x4d7c47[_0xe187('0x1c')],function(_0xc0ffe){return{'model':db[_0xc0ffe[_0xe187('0x1e')]],'as':_0xc0ffe['as'],'attributes':_0xc0ffe['attributes']};}):[]};}):[]};}):[]:[]})[_0xe187('0xc')](function(_0x2e9527){logger['info'](_0xe187('0x1f'),_0x461130);logger[_0xe187('0x10')](_0xe187('0x1f'),_0x461130,JSON[_0xe187('0x20')](_0x2e9527));_0x1b35e1(_0x2e9527);})[_0xe187('0x16')](function(_0x20253c){logger[_0xe187('0x12')](_0xe187('0x1f'),_0x20253c[_0xe187('0x14')],_0x461130);_0x39e692(_0x319014[_0xe187('0x12')](0x1f4,_0x20253c[_0xe187('0x14')]));});});}; \ No newline at end of file +var _0x7ed6=['request\x20sent','debug','stringify','error','code','message','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','include','map','model','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','SquareOdbc,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7ed6,0x150));var _0x67ed=function(_0x31cbca,_0x4b98eb){_0x31cbca=_0x31cbca-0x0;var _0x119de5=_0x7ed6[_0x31cbca];return _0x119de5;};'use strict';var _=require('lodash');var util=require(_0x67ed('0x0'));var moment=require(_0x67ed('0x1'));var BPromise=require('bluebird');var rs=require(_0x67ed('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x67ed('0x3'))['db'];var utils=require(_0x67ed('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x67ed('0x5'));var jayson=require(_0x67ed('0x6'));var client=jayson['client'][_0x67ed('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x33294c,_0x54378,_0x36e854){return new BPromise(function(_0xa660c2,_0x298255){return client[_0x67ed('0x8')](_0x33294c,_0x36e854)[_0x67ed('0x9')](function(_0x4220e2){logger[_0x67ed('0xa')](_0x67ed('0xb'),_0x54378,_0x67ed('0xc'));logger[_0x67ed('0xd')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x54378,_0x67ed('0xc'),JSON[_0x67ed('0xe')](_0x4220e2));if(_0x4220e2[_0x67ed('0xf')]){if(_0x4220e2[_0x67ed('0xf')][_0x67ed('0x10')]===0x1f4){logger['error'](_0x67ed('0xb'),_0x54378,_0x4220e2[_0x67ed('0xf')][_0x67ed('0x11')]);return _0x298255(_0x4220e2[_0x67ed('0xf')][_0x67ed('0x11')]);}logger['error'](_0x67ed('0xb'),_0x54378,_0x4220e2[_0x67ed('0xf')][_0x67ed('0x11')]);return _0xa660c2(_0x4220e2[_0x67ed('0xf')][_0x67ed('0x11')]);}else{logger[_0x67ed('0xa')](_0x67ed('0xb'),_0x54378,_0x67ed('0xc'));_0xa660c2(_0x4220e2['result']['message']);}})[_0x67ed('0x12')](function(_0x517682){logger[_0x67ed('0xf')](_0x67ed('0xb'),_0x54378,_0x517682);_0x298255(_0x517682);});});}exports[_0x67ed('0x13')]=function(_0x189969){var _0x5e7f8b=this;return new Promise(function(_0x3428fc,_0x20461c){return db[_0x67ed('0x14')][_0x67ed('0x15')]({'raw':_0x189969[_0x67ed('0x16')]?_0x189969[_0x67ed('0x16')][_0x67ed('0x17')]===undefined?!![]:![]:!![],'where':_0x189969[_0x67ed('0x16')]?_0x189969[_0x67ed('0x16')][_0x67ed('0x18')]||null:null,'attributes':_0x189969[_0x67ed('0x16')]?_0x189969['options'][_0x67ed('0x19')]||null:null,'include':_0x189969[_0x67ed('0x16')]?_0x189969[_0x67ed('0x16')][_0x67ed('0x1a')]?_[_0x67ed('0x1b')](_0x189969['options'][_0x67ed('0x1a')],function(_0x1a4102){return{'model':db[_0x1a4102[_0x67ed('0x1c')]],'as':_0x1a4102['as'],'attributes':_0x1a4102[_0x67ed('0x19')],'include':_0x1a4102['include']?_[_0x67ed('0x1b')](_0x1a4102[_0x67ed('0x1a')],function(_0x46ef93){return{'model':db[_0x46ef93[_0x67ed('0x1c')]],'as':_0x46ef93['as'],'attributes':_0x46ef93['attributes'],'include':_0x46ef93[_0x67ed('0x1a')]?_['map'](_0x46ef93[_0x67ed('0x1a')],function(_0x3134f9){return{'model':db[_0x3134f9[_0x67ed('0x1c')]],'as':_0x3134f9['as'],'attributes':_0x3134f9[_0x67ed('0x19')]};}):[]};}):[]};}):[]:[]})[_0x67ed('0x9')](function(_0x1bb4df){logger[_0x67ed('0xa')](_0x67ed('0x13'),_0x189969);logger[_0x67ed('0xd')](_0x67ed('0x13'),_0x189969,JSON[_0x67ed('0xe')](_0x1bb4df));_0x3428fc(_0x1bb4df);})[_0x67ed('0x12')](function(_0x44980e){logger[_0x67ed('0xf')](_0x67ed('0x13'),_0x44980e[_0x67ed('0x11')],_0x189969);_0x20461c(_0x5e7f8b['error'](0x1f4,_0x44980e[_0x67ed('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 558111c..54e6852 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 _0x4dcb=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','/:id/users','getUsers','post','create','addUsers','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1f01ec,_0x6622ab){var _0x141f9e=function(_0x3a0a07){while(--_0x3a0a07){_0x1f01ec['push'](_0x1f01ec['shift']());}};_0x141f9e(++_0x6622ab);}(_0x4dcb,0x186));var _0xb4dc=function(_0x154213,_0x37efc7){_0x154213=_0x154213-0x0;var _0x170001=_0x4dcb[_0x154213];return _0x170001;};'use strict';var multer=require('multer');var util=require(_0xb4dc('0x0'));var path=require(_0xb4dc('0x1'));var timeout=require(_0xb4dc('0x2'));var express=require(_0xb4dc('0x3'));var router=express[_0xb4dc('0x4')]();var fs_extra=require(_0xb4dc('0x5'));var auth=require(_0xb4dc('0x6'));var interaction=require(_0xb4dc('0x7'));var config=require(_0xb4dc('0x8'));var controller=require('./squareProject.controller');router['get']('/',auth[_0xb4dc('0x9')](),controller['index']);router[_0xb4dc('0xa')](_0xb4dc('0xb'),auth[_0xb4dc('0x9')](),controller[_0xb4dc('0xc')]);router[_0xb4dc('0xa')](_0xb4dc('0xd'),auth['isAuthenticated'](),controller[_0xb4dc('0xe')]);router[_0xb4dc('0xf')]('/',auth[_0xb4dc('0x9')](),controller[_0xb4dc('0x10')]);router[_0xb4dc('0xf')](_0xb4dc('0xd'),auth[_0xb4dc('0x9')](),controller[_0xb4dc('0x11')]);router[_0xb4dc('0x12')](_0xb4dc('0xb'),auth[_0xb4dc('0x9')](),controller[_0xb4dc('0x13')]);router[_0xb4dc('0x14')]('/:id',auth[_0xb4dc('0x9')](),controller[_0xb4dc('0x15')]);router[_0xb4dc('0x14')](_0xb4dc('0xd'),auth[_0xb4dc('0x9')](),controller['removeUsers']);module['exports']=router; \ No newline at end of file +var _0xb12d=['create','addUsers','put','update','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','index','/:id','isAuthenticated','show','/:id/users','post'];(function(_0x4aefa0,_0x242eaa){var _0x17086c=function(_0xbcec1a){while(--_0xbcec1a){_0x4aefa0['push'](_0x4aefa0['shift']());}};_0x17086c(++_0x242eaa);}(_0xb12d,0x124));var _0xdb12=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xb12d[_0x29d94e];return _0x106237;};'use strict';var multer=require(_0xdb12('0x0'));var util=require(_0xdb12('0x1'));var path=require(_0xdb12('0x2'));var timeout=require('connect-timeout');var express=require(_0xdb12('0x3'));var router=express['Router']();var fs_extra=require(_0xdb12('0x4'));var auth=require(_0xdb12('0x5'));var interaction=require(_0xdb12('0x6'));var config=require(_0xdb12('0x7'));var controller=require(_0xdb12('0x8'));router[_0xdb12('0x9')]('/',auth['isAuthenticated'](),controller[_0xdb12('0xa')]);router[_0xdb12('0x9')](_0xdb12('0xb'),auth[_0xdb12('0xc')](),controller[_0xdb12('0xd')]);router[_0xdb12('0x9')](_0xdb12('0xe'),auth[_0xdb12('0xc')](),controller['getUsers']);router[_0xdb12('0xf')]('/',auth['isAuthenticated'](),controller[_0xdb12('0x10')]);router[_0xdb12('0xf')](_0xdb12('0xe'),auth['isAuthenticated'](),controller[_0xdb12('0x11')]);router[_0xdb12('0x12')](_0xdb12('0xb'),auth['isAuthenticated'](),controller[_0xdb12('0x13')]);router['delete'](_0xdb12('0xb'),auth[_0xdb12('0xc')](),controller[_0xdb12('0x14')]);router['delete'](_0xdb12('0xe'),auth[_0xdb12('0xc')](),controller['removeUsers']);module[_0xdb12('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 cfae103..9896432 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 _0xe056=['long','getDataValue','toString','utf8','production','DATE','sequelize','exports','name','TEXT','BLOB'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0xe056,0xab));var _0x6e05=function(_0x1f0679,_0x53d43c){_0x1f0679=_0x1f0679-0x0;var _0x3dc3a4=_0xe056[_0x1f0679];return _0x3dc3a4;};'use strict';var Sequelize=require(_0x6e05('0x0'));module[_0x6e05('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6e05('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x6e05('0x3')]},'preproduction':{'type':Sequelize[_0x6e05('0x4')](_0x6e05('0x5')),'get':function(){if(this[_0x6e05('0x6')]('preproduction')){return this[_0x6e05('0x6')]('preproduction')[_0x6e05('0x7')](_0x6e05('0x8'));}}},'production':{'type':Sequelize[_0x6e05('0x4')]('long'),'get':function(){if(this[_0x6e05('0x6')](_0x6e05('0x9'))){return this[_0x6e05('0x6')](_0x6e05('0x9'))[_0x6e05('0x7')]('utf8');}}},'savedAt':{'type':Sequelize[_0x6e05('0xa')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xb680=['production','toString','sequelize','exports','STRING','name','BLOB','long','getDataValue','preproduction','utf8'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xb680,0x1db));var _0x0b68=function(_0x5a32bb,_0x2d24ca){_0x5a32bb=_0x5a32bb-0x0;var _0x594bce=_0xb680[_0x5a32bb];return _0x594bce;};'use strict';var Sequelize=require(_0x0b68('0x0'));module[_0x0b68('0x1')]={'name':{'type':Sequelize[_0x0b68('0x2')],'unique':_0x0b68('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x0b68('0x4')](_0x0b68('0x5')),'get':function(){if(this[_0x0b68('0x6')](_0x0b68('0x7'))){return this[_0x0b68('0x6')]('preproduction')['toString'](_0x0b68('0x8'));}}},'production':{'type':Sequelize[_0x0b68('0x4')](_0x0b68('0x5')),'get':function(){if(this[_0x0b68('0x6')]('production')){return this['getDataValue'](_0x0b68('0x9'))[_0x0b68('0xa')](_0x0b68('0x8'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index e7d8776..560709a 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 _0x87ab=['type','key','model','map','name','keys','query','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','rawAttributes','options','create','SquareProject','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','SquareProjects','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','addUsers','ids','omit','removeUsers','isArray','userSquareProject:remove','emit','getUsers','order','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','register','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','UserProfileResource','end','sendStatus','error','send','fieldName'];(function(_0x280e0c,_0x321f6e){var _0x525645=function(_0x2aa56f){while(--_0x2aa56f){_0x280e0c['push'](_0x280e0c['shift']());}};_0x525645(++_0x321f6e);}(_0x87ab,0x157));var _0xb87a=function(_0x442a73,_0x4ab9db){_0x442a73=_0x442a73-0x0;var _0xc00b47=_0x87ab[_0x442a73];return _0xc00b47;};'use strict';var emlformat=require(_0xb87a('0x0'));var rimraf=require(_0xb87a('0x1'));var zipdir=require(_0xb87a('0x2'));var jsonpatch=require(_0xb87a('0x3'));var rp=require(_0xb87a('0x4'));var moment=require(_0xb87a('0x5'));var BPromise=require(_0xb87a('0x6'));var Mustache=require(_0xb87a('0x7'));var util=require(_0xb87a('0x8'));var path=require(_0xb87a('0x9'));var sox=require(_0xb87a('0xa'));var csv=require(_0xb87a('0xb'));var ejs=require(_0xb87a('0xc'));var fs=require('fs');var fs_extra=require(_0xb87a('0xd'));var _=require(_0xb87a('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb87a('0xf'));var deskjs=require(_0xb87a('0x10'));var toCsv=require(_0xb87a('0xb'));var querystring=require(_0xb87a('0x11'));var Papa=require(_0xb87a('0x12'));var Redis=require('ioredis');var authService=require(_0xb87a('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb87a('0x14'))('api');var utils=require(_0xb87a('0x15'));var config=require(_0xb87a('0x16'));var licenseUtil=require(_0xb87a('0x17'));var db=require(_0xb87a('0x18'))['db'];config[_0xb87a('0x19')]=_[_0xb87a('0x1a')](config[_0xb87a('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xb87a('0x1b'))(new Redis(config[_0xb87a('0x19')]));require(_0xb87a('0x1c'))[_0xb87a('0x1d')](socket);function respondWithStatusCode(_0x492a69,_0x305e00){_0x305e00=_0x305e00||0xcc;return function(_0x18b334){if(_0x18b334){return _0x492a69['sendStatus'](_0x305e00);}return _0x492a69[_0xb87a('0x1e')](_0x305e00)['end']();};}function respondWithResult(_0x53f17d,_0x4a4236){_0x4a4236=_0x4a4236||0xc8;return function(_0x322dd6){if(_0x322dd6){return _0x53f17d[_0xb87a('0x1e')](_0x4a4236)['json'](_0x322dd6);}};}function respondWithFilteredResult(_0x19367c,_0x2569a4){return function(_0x5998cb){if(_0x5998cb){var _0x374d2b=typeof _0x2569a4[_0xb87a('0x1f')]===_0xb87a('0x20')&&typeof _0x2569a4['limit']==='undefined';var _0x292f8c=_0x5998cb['count'];var _0x462f20=_0x374d2b?0x0:_0x2569a4[_0xb87a('0x1f')];var _0x52b82b=_0x374d2b?_0x5998cb[_0xb87a('0x21')]:_0x2569a4[_0xb87a('0x1f')]+_0x2569a4[_0xb87a('0x22')];var _0x18fd8d;if(_0x52b82b>=_0x292f8c){_0x52b82b=_0x292f8c;_0x18fd8d=0xc8;}else{_0x18fd8d=0xce;}_0x19367c[_0xb87a('0x1e')](_0x18fd8d);return _0x19367c[_0xb87a('0x23')](_0xb87a('0x24'),_0x462f20+'-'+_0x52b82b+'/'+_0x292f8c)[_0xb87a('0x25')](_0x5998cb);}return null;};}function patchUpdates(_0x26d88e){return function(_0x5a5c5d){try{jsonpatch[_0xb87a('0x26')](_0x5a5c5d,_0x26d88e,!![]);}catch(_0x7ec935){return BPromise[_0xb87a('0x27')](_0x7ec935);}return _0x5a5c5d[_0xb87a('0x28')]();};}function saveUpdates(_0x454c83,_0x2e2640){return function(_0x1eb4f6){if(_0x1eb4f6){return _0x1eb4f6['update'](_0x454c83)[_0xb87a('0x29')](function(_0x27f6c8){return _0x27f6c8;});}return null;};}function removeEntity(_0x4b4e4f,_0x2c47a1){return function(_0x15f495){if(_0x15f495){return _0x15f495[_0xb87a('0x2a')]()['then'](function(){var _0x37e7e3=_0x15f495['get']({'plain':!![]});var _0x586d05='SquareProjects';return db[_0xb87a('0x2b')][_0xb87a('0x2a')]({'where':{'type':_0x586d05,'resourceId':_0x37e7e3['id']}})[_0xb87a('0x29')](function(){return _0x15f495;});})[_0xb87a('0x29')](function(){_0x4b4e4f[_0xb87a('0x1e')](0xcc)[_0xb87a('0x2c')]();});}};}function handleEntityNotFound(_0x109fae,_0x3278bd){return function(_0x5673c2){if(!_0x5673c2){_0x109fae[_0xb87a('0x2d')](0x194);}return _0x5673c2;};}function handleError(_0x12f317,_0x5be794){_0x5be794=_0x5be794||0x1f4;return function(_0x2683b0){logger[_0xb87a('0x2e')](_0x2683b0['stack']);if(_0x2683b0['name']){delete _0x2683b0['name'];}_0x12f317[_0xb87a('0x1e')](_0x5be794)[_0xb87a('0x2f')](_0x2683b0);};}exports['index']=function(_0x541b26,_0x36eb09){var _0x3aec25={},_0xa1e025={},_0x337a2c={'count':0x0,'rows':[]};var _0x10837b=_['map'](db['SquareProject']['rawAttributes'],function(_0x44e41f){return{'name':_0x44e41f[_0xb87a('0x30')],'type':_0x44e41f[_0xb87a('0x31')][_0xb87a('0x32')]};});_0xa1e025[_0xb87a('0x33')]=_[_0xb87a('0x34')](_0x10837b,_0xb87a('0x35'));_0xa1e025['query']=_[_0xb87a('0x36')](_0x541b26[_0xb87a('0x37')]);_0xa1e025[_0xb87a('0x38')]=_[_0xb87a('0x39')](_0xa1e025[_0xb87a('0x33')],_0xa1e025[_0xb87a('0x37')]);_0x3aec25[_0xb87a('0x3a')]=_[_0xb87a('0x39')](_0xa1e025[_0xb87a('0x33')],qs[_0xb87a('0x3b')](_0x541b26[_0xb87a('0x37')]['fields']));_0x3aec25[_0xb87a('0x3a')]=_0x3aec25[_0xb87a('0x3a')][_0xb87a('0x3c')]?_0x3aec25[_0xb87a('0x3a')]:_0xa1e025[_0xb87a('0x33')];if(!_0x541b26[_0xb87a('0x37')]['hasOwnProperty']('nolimit')){_0x3aec25[_0xb87a('0x22')]=qs[_0xb87a('0x22')](_0x541b26['query'][_0xb87a('0x22')]);_0x3aec25[_0xb87a('0x1f')]=qs[_0xb87a('0x1f')](_0x541b26['query'][_0xb87a('0x1f')]);}_0x3aec25['order']=qs[_0xb87a('0x3d')](_0x541b26[_0xb87a('0x37')][_0xb87a('0x3d')]);_0x3aec25[_0xb87a('0x3e')]=qs[_0xb87a('0x38')](_[_0xb87a('0x3f')](_0x541b26['query'],_0xa1e025[_0xb87a('0x38')]),_0x10837b);if(_0x541b26['query'][_0xb87a('0x40')]){_0x3aec25[_0xb87a('0x3e')]=_[_0xb87a('0x41')](_0x3aec25['where'],{'$or':_[_0xb87a('0x34')](_0x10837b,function(_0x55734f){if(_0x55734f[_0xb87a('0x31')]!==_0xb87a('0x42')){var _0x552224={};_0x552224[_0x55734f['name']]={'$like':'%'+_0x541b26[_0xb87a('0x37')][_0xb87a('0x40')]+'%'};return _0x552224;}})});}_0x3aec25=_[_0xb87a('0x41')]({},_0x3aec25,_0x541b26['options']);var _0xa3135b={'where':_0x3aec25['where']};return db['SquareProject'][_0xb87a('0x21')](_0xa3135b)[_0xb87a('0x29')](function(_0x12b3b3){_0x337a2c[_0xb87a('0x21')]=_0x12b3b3;if(_0x541b26[_0xb87a('0x37')][_0xb87a('0x43')]){_0x3aec25[_0xb87a('0x44')]=[{'all':!![]}];}return db['SquareProject']['findAll'](_0x3aec25);})['then'](function(_0x2e6f91){_0x337a2c[_0xb87a('0x45')]=_0x2e6f91;return _0x337a2c;})[_0xb87a('0x29')](respondWithFilteredResult(_0x36eb09,_0x3aec25))[_0xb87a('0x46')](handleError(_0x36eb09,null));};exports[_0xb87a('0x47')]=function(_0x1471c1,_0x1c9e47){var _0xba91e4={'raw':![],'where':{'id':_0x1471c1[_0xb87a('0x48')]['id']}},_0x525376={};_0x525376[_0xb87a('0x33')]=_[_0xb87a('0x36')](db['SquareProject'][_0xb87a('0x49')]);_0x525376[_0xb87a('0x37')]=_[_0xb87a('0x36')](_0x1471c1[_0xb87a('0x37')]);_0x525376[_0xb87a('0x38')]=_['intersection'](_0x525376[_0xb87a('0x33')],_0x525376[_0xb87a('0x37')]);_0xba91e4[_0xb87a('0x3a')]=_['intersection'](_0x525376['model'],qs[_0xb87a('0x3b')](_0x1471c1[_0xb87a('0x37')][_0xb87a('0x3b')]));_0xba91e4[_0xb87a('0x3a')]=_0xba91e4[_0xb87a('0x3a')][_0xb87a('0x3c')]?_0xba91e4[_0xb87a('0x3a')]:_0x525376[_0xb87a('0x33')];if(_0x1471c1[_0xb87a('0x37')][_0xb87a('0x43')]){_0xba91e4[_0xb87a('0x44')]=[{'all':!![]}];}_0xba91e4=_[_0xb87a('0x41')]({},_0xba91e4,_0x1471c1[_0xb87a('0x4a')]);return db['SquareProject']['find'](_0xba91e4)[_0xb87a('0x29')](handleEntityNotFound(_0x1c9e47,null))[_0xb87a('0x29')](respondWithResult(_0x1c9e47,null))['catch'](handleError(_0x1c9e47,null));};exports[_0xb87a('0x4b')]=function(_0x204d09,_0x47ad1b){return db[_0xb87a('0x4c')][_0xb87a('0x4b')](_0x204d09[_0xb87a('0x4d')],{})['then'](function(_0x4cff93){var _0x4badba=_0x204d09[_0xb87a('0x4e')][_0xb87a('0x4f')]({'plain':!![]});if(!_0x4badba)throw new Error(_0xb87a('0x50'));if(_0x4badba['role']===_0xb87a('0x4e')){var _0x5cd10b=_0x4cff93[_0xb87a('0x4f')]({'plain':!![]});var _0x38913a=_0xb87a('0x51');return db[_0xb87a('0x52')]['find']({'where':{'name':_0x38913a,'userProfileId':_0x4badba[_0xb87a('0x53')]},'raw':!![]})[_0xb87a('0x29')](function(_0x2d32b8){if(_0x2d32b8&&_0x2d32b8['autoAssociation']===0x0){return db[_0xb87a('0x2b')][_0xb87a('0x4b')]({'name':_0x5cd10b[_0xb87a('0x35')],'resourceId':_0x5cd10b['id'],'type':_0x2d32b8[_0xb87a('0x35')],'sectionId':_0x2d32b8['id']},{})['then'](function(){return _0x4cff93;});}else{return _0x4cff93;}})[_0xb87a('0x46')](function(_0x568d47){logger[_0xb87a('0x2e')](_0xb87a('0x54'),_0x568d47);throw _0x568d47;});}return _0x4cff93;})['then'](respondWithResult(_0x47ad1b,0xc9))['catch'](handleError(_0x47ad1b,null));};exports[_0xb87a('0x55')]=function(_0x46f5e9,_0x5168ff){if(_0x46f5e9[_0xb87a('0x4d')]['id']){delete _0x46f5e9[_0xb87a('0x4d')]['id'];}return db[_0xb87a('0x4c')][_0xb87a('0x56')]({'where':{'id':_0x46f5e9['params']['id']}})['then'](handleEntityNotFound(_0x5168ff,null))[_0xb87a('0x29')](saveUpdates(_0x46f5e9[_0xb87a('0x4d')],null))[_0xb87a('0x29')](respondWithResult(_0x5168ff,null))[_0xb87a('0x46')](handleError(_0x5168ff,null));};exports[_0xb87a('0x2a')]=function(_0x246224,_0x2300d0){return db[_0xb87a('0x4c')][_0xb87a('0x56')]({'where':{'id':_0x246224[_0xb87a('0x48')]['id']}})[_0xb87a('0x29')](handleEntityNotFound(_0x2300d0,null))[_0xb87a('0x29')](removeEntity(_0x2300d0,null))[_0xb87a('0x46')](handleError(_0x2300d0,null));};exports[_0xb87a('0x57')]=function(_0x13573d,_0x16ba7a,_0x649e39){return db['SquareProject'][_0xb87a('0x56')]({'where':{'id':_0x13573d['params']['id']}})['then'](handleEntityNotFound(_0x16ba7a,null))['then'](function(_0x2d4d28){if(_0x2d4d28){return _0x2d4d28[_0xb87a('0x57')](_0x13573d[_0xb87a('0x4d')][_0xb87a('0x58')],_[_0xb87a('0x59')](_0x13573d[_0xb87a('0x4d')],['ids','id'])||{});}})['then'](respondWithResult(_0x16ba7a,null))[_0xb87a('0x46')](handleError(_0x16ba7a,null));};exports[_0xb87a('0x5a')]=function(_0x331333,_0x300688,_0x3511cd){return db['SquareProject'][_0xb87a('0x56')]({'where':{'id':_0x331333[_0xb87a('0x48')]['id']}})[_0xb87a('0x29')](handleEntityNotFound(_0x300688,null))[_0xb87a('0x29')](function(_0x1ab3d7){if(_0x1ab3d7){return _0x1ab3d7[_0xb87a('0x5a')](_0x331333[_0xb87a('0x37')][_0xb87a('0x58')])[_0xb87a('0x29')](function(){if(_[_0xb87a('0x5b')](_0x331333[_0xb87a('0x37')]['ids'])){for(var _0x5b2d16=0x0;_0x5b2d16<_0x331333[_0xb87a('0x37')][_0xb87a('0x58')][_0xb87a('0x3c')];_0x5b2d16+=0x1){socket['emit'](_0xb87a('0x5c'),{'UserId':Number(_0x331333[_0xb87a('0x37')][_0xb87a('0x58')][_0x5b2d16]),'SquareProjectId':Number(_0x331333[_0xb87a('0x48')]['id'])});}}else{socket[_0xb87a('0x5d')](_0xb87a('0x5c'),{'UserId':Number(_0x331333[_0xb87a('0x37')][_0xb87a('0x58')]),'SquareProjectId':Number(_0x331333['params']['id'])});}});}})['then'](respondWithStatusCode(_0x300688,null))['catch'](handleError(_0x300688,null));};exports[_0xb87a('0x5e')]=function(_0x1131cd,_0x5556e1,_0x4d6b9c){var _0x24af94={};var _0x106daa={};var _0x4992d3;var _0x5ca4c2;return db[_0xb87a('0x4c')]['findOne']({'where':{'id':_0x1131cd['params']['id']}})[_0xb87a('0x29')](handleEntityNotFound(_0x5556e1,null))[_0xb87a('0x29')](function(_0x2c3b3a){if(_0x2c3b3a){_0x4992d3=_0x2c3b3a;_0x106daa[_0xb87a('0x33')]=_['keys'](db['User'][_0xb87a('0x49')]);_0x106daa[_0xb87a('0x37')]=_[_0xb87a('0x36')](_0x1131cd[_0xb87a('0x37')]);_0x106daa[_0xb87a('0x38')]=_['intersection'](_0x106daa[_0xb87a('0x33')],_0x106daa[_0xb87a('0x37')]);_0x24af94[_0xb87a('0x3a')]=_[_0xb87a('0x39')](_0x106daa[_0xb87a('0x33')],qs[_0xb87a('0x3b')](_0x1131cd[_0xb87a('0x37')][_0xb87a('0x3b')]));_0x24af94['attributes']=_0x24af94[_0xb87a('0x3a')][_0xb87a('0x3c')]?_0x24af94[_0xb87a('0x3a')]:_0x106daa[_0xb87a('0x33')];_0x24af94[_0xb87a('0x5f')]=qs[_0xb87a('0x3d')](_0x1131cd['query'][_0xb87a('0x3d')]);_0x24af94[_0xb87a('0x3e')]=qs['filters'](_['pick'](_0x1131cd[_0xb87a('0x37')],_0x106daa['filters']));if(_0x1131cd[_0xb87a('0x37')][_0xb87a('0x40')]){_0x24af94['where']=_[_0xb87a('0x41')](_0x24af94[_0xb87a('0x3e')],{'$or':_[_0xb87a('0x34')](_0x24af94[_0xb87a('0x3a')],function(_0x48680a){var _0x28dcfe={};_0x28dcfe[_0x48680a]={'$like':'%'+_0x1131cd[_0xb87a('0x37')][_0xb87a('0x40')]+'%'};return _0x28dcfe;})});}_0x24af94=_[_0xb87a('0x41')]({},_0x24af94,_0x1131cd[_0xb87a('0x4a')]);return _0x4992d3['getUsers'](_0x24af94);}})[_0xb87a('0x29')](function(_0x45e063){if(_0x45e063){_0x5ca4c2=_0x45e063[_0xb87a('0x3c')];if(!_0x1131cd[_0xb87a('0x37')][_0xb87a('0x60')](_0xb87a('0x61'))){_0x24af94[_0xb87a('0x22')]=qs['limit'](_0x1131cd[_0xb87a('0x37')][_0xb87a('0x22')]);_0x24af94[_0xb87a('0x1f')]=qs[_0xb87a('0x1f')](_0x1131cd[_0xb87a('0x37')][_0xb87a('0x1f')]);}return _0x4992d3[_0xb87a('0x5e')](_0x24af94);}})[_0xb87a('0x29')](function(_0x5230ca){if(_0x5230ca){return _0x5230ca?{'count':_0x5ca4c2,'rows':_0x5230ca}:null;}})['then'](respondWithResult(_0x5556e1,null))[_0xb87a('0x46')](handleError(_0x5556e1,null));}; \ No newline at end of file +var _0x49d6=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','findOne','order','getUsers','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','get','SquareProjects','UserProfileResource','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type','key','model','query'];(function(_0x2806de,_0x94c463){var _0x229f8f=function(_0x21df06){while(--_0x21df06){_0x2806de['push'](_0x2806de['shift']());}};_0x229f8f(++_0x94c463);}(_0x49d6,0x153));var _0x649d=function(_0xaa9488,_0x5c60e7){_0xaa9488=_0xaa9488-0x0;var _0x3cb247=_0x49d6[_0xaa9488];return _0x3cb247;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x649d('0x0'));var zipdir=require(_0x649d('0x1'));var jsonpatch=require(_0x649d('0x2'));var rp=require(_0x649d('0x3'));var moment=require(_0x649d('0x4'));var BPromise=require(_0x649d('0x5'));var Mustache=require(_0x649d('0x6'));var util=require(_0x649d('0x7'));var path=require(_0x649d('0x8'));var sox=require(_0x649d('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x649d('0xa'));var _=require(_0x649d('0xb'));var squel=require(_0x649d('0xc'));var crypto=require('crypto');var jsforce=require(_0x649d('0xd'));var deskjs=require(_0x649d('0xe'));var toCsv=require(_0x649d('0xf'));var querystring=require(_0x649d('0x10'));var Papa=require(_0x649d('0x11'));var Redis=require(_0x649d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x649d('0x13'));var as=require(_0x649d('0x14'));var hardwareService=require(_0x649d('0x15'));var logger=require(_0x649d('0x16'))(_0x649d('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x649d('0x18'));var db=require(_0x649d('0x19'))['db'];config[_0x649d('0x1a')]=_[_0x649d('0x1b')](config[_0x649d('0x1a')],{'host':_0x649d('0x1c'),'port':0x18eb});var socket=require(_0x649d('0x1d'))(new Redis(config[_0x649d('0x1a')]));require(_0x649d('0x1e'))['register'](socket);function respondWithStatusCode(_0x1002ce,_0x386a2e){_0x386a2e=_0x386a2e||0xcc;return function(_0x495a72){if(_0x495a72){return _0x1002ce[_0x649d('0x1f')](_0x386a2e);}return _0x1002ce[_0x649d('0x20')](_0x386a2e)[_0x649d('0x21')]();};}function respondWithResult(_0x3ba8d5,_0x4ee51e){_0x4ee51e=_0x4ee51e||0xc8;return function(_0x19b212){if(_0x19b212){return _0x3ba8d5['status'](_0x4ee51e)[_0x649d('0x22')](_0x19b212);}};}function respondWithFilteredResult(_0x55b9f2,_0x1fd124){return function(_0x3bf134){if(_0x3bf134){var _0x539e74=typeof _0x1fd124[_0x649d('0x23')]===_0x649d('0x24')&&typeof _0x1fd124['limit']===_0x649d('0x24');var _0x2c3149=_0x3bf134[_0x649d('0x25')];var _0x1da9e4=_0x539e74?0x0:_0x1fd124['offset'];var _0x128077=_0x539e74?_0x3bf134[_0x649d('0x25')]:_0x1fd124[_0x649d('0x23')]+_0x1fd124[_0x649d('0x26')];var _0x24a589;if(_0x128077>=_0x2c3149){_0x128077=_0x2c3149;_0x24a589=0xc8;}else{_0x24a589=0xce;}_0x55b9f2['status'](_0x24a589);return _0x55b9f2['set']('Content-Range',_0x1da9e4+'-'+_0x128077+'/'+_0x2c3149)[_0x649d('0x22')](_0x3bf134);}return null;};}function patchUpdates(_0x5154f2){return function(_0x3996ec){try{jsonpatch[_0x649d('0x27')](_0x3996ec,_0x5154f2,!![]);}catch(_0x16d24f){return BPromise[_0x649d('0x28')](_0x16d24f);}return _0x3996ec[_0x649d('0x29')]();};}function saveUpdates(_0x53a37f,_0x41cb7f){return function(_0x353053){if(_0x353053){return _0x353053[_0x649d('0x2a')](_0x53a37f)[_0x649d('0x2b')](function(_0x2301e8){return _0x2301e8;});}return null;};}function removeEntity(_0x33bfcd,_0x1e4b3c){return function(_0x598d61){if(_0x598d61){return _0x598d61[_0x649d('0x2c')]()[_0x649d('0x2b')](function(){var _0x2ab234=_0x598d61[_0x649d('0x2d')]({'plain':!![]});var _0x43fd38=_0x649d('0x2e');return db[_0x649d('0x2f')][_0x649d('0x2c')]({'where':{'type':_0x43fd38,'resourceId':_0x2ab234['id']}})[_0x649d('0x2b')](function(){return _0x598d61;});})[_0x649d('0x2b')](function(){_0x33bfcd[_0x649d('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42e198,_0x3f23f5){return function(_0x8c3669){if(!_0x8c3669){_0x42e198['sendStatus'](0x194);}return _0x8c3669;};}function handleError(_0x374911,_0x1e30ba){_0x1e30ba=_0x1e30ba||0x1f4;return function(_0x2c8768){logger[_0x649d('0x30')](_0x2c8768[_0x649d('0x31')]);if(_0x2c8768['name']){delete _0x2c8768[_0x649d('0x32')];}_0x374911[_0x649d('0x20')](_0x1e30ba)[_0x649d('0x33')](_0x2c8768);};}exports[_0x649d('0x34')]=function(_0xf67e1d,_0x16432f){var _0x12e26b={},_0x350fb1={},_0x1d1765={'count':0x0,'rows':[]};var _0x1146db=_[_0x649d('0x35')](db[_0x649d('0x36')][_0x649d('0x37')],function(_0xa9d7e5){return{'name':_0xa9d7e5[_0x649d('0x38')],'type':_0xa9d7e5[_0x649d('0x39')][_0x649d('0x3a')]};});_0x350fb1[_0x649d('0x3b')]=_[_0x649d('0x35')](_0x1146db,_0x649d('0x32'));_0x350fb1[_0x649d('0x3c')]=_[_0x649d('0x3d')](_0xf67e1d[_0x649d('0x3c')]);_0x350fb1[_0x649d('0x3e')]=_[_0x649d('0x3f')](_0x350fb1[_0x649d('0x3b')],_0x350fb1[_0x649d('0x3c')]);_0x12e26b[_0x649d('0x40')]=_[_0x649d('0x3f')](_0x350fb1[_0x649d('0x3b')],qs[_0x649d('0x41')](_0xf67e1d[_0x649d('0x3c')][_0x649d('0x41')]));_0x12e26b[_0x649d('0x40')]=_0x12e26b[_0x649d('0x40')][_0x649d('0x42')]?_0x12e26b[_0x649d('0x40')]:_0x350fb1[_0x649d('0x3b')];if(!_0xf67e1d[_0x649d('0x3c')][_0x649d('0x43')](_0x649d('0x44'))){_0x12e26b['limit']=qs[_0x649d('0x26')](_0xf67e1d[_0x649d('0x3c')][_0x649d('0x26')]);_0x12e26b[_0x649d('0x23')]=qs[_0x649d('0x23')](_0xf67e1d[_0x649d('0x3c')][_0x649d('0x23')]);}_0x12e26b['order']=qs['sort'](_0xf67e1d[_0x649d('0x3c')][_0x649d('0x45')]);_0x12e26b[_0x649d('0x46')]=qs[_0x649d('0x3e')](_[_0x649d('0x47')](_0xf67e1d['query'],_0x350fb1[_0x649d('0x3e')]),_0x1146db);if(_0xf67e1d[_0x649d('0x3c')][_0x649d('0x48')]){_0x12e26b[_0x649d('0x46')]=_[_0x649d('0x49')](_0x12e26b[_0x649d('0x46')],{'$or':_[_0x649d('0x35')](_0x1146db,function(_0x57c5f6){if(_0x57c5f6['type']!=='VIRTUAL'){var _0x334d8b={};_0x334d8b[_0x57c5f6[_0x649d('0x32')]]={'$like':'%'+_0xf67e1d['query'][_0x649d('0x48')]+'%'};return _0x334d8b;}})});}_0x12e26b=_[_0x649d('0x49')]({},_0x12e26b,_0xf67e1d[_0x649d('0x4a')]);var _0x122f6e={'where':_0x12e26b[_0x649d('0x46')]};return db[_0x649d('0x36')][_0x649d('0x25')](_0x122f6e)[_0x649d('0x2b')](function(_0x10a5ef){_0x1d1765[_0x649d('0x25')]=_0x10a5ef;if(_0xf67e1d[_0x649d('0x3c')][_0x649d('0x4b')]){_0x12e26b[_0x649d('0x4c')]=[{'all':!![]}];}return db[_0x649d('0x36')][_0x649d('0x4d')](_0x12e26b);})[_0x649d('0x2b')](function(_0x49fb7c){_0x1d1765[_0x649d('0x4e')]=_0x49fb7c;return _0x1d1765;})['then'](respondWithFilteredResult(_0x16432f,_0x12e26b))[_0x649d('0x4f')](handleError(_0x16432f,null));};exports[_0x649d('0x50')]=function(_0x295b1b,_0x289f19){var _0x2a143c={'raw':![],'where':{'id':_0x295b1b[_0x649d('0x51')]['id']}},_0x24e269={};_0x24e269[_0x649d('0x3b')]=_[_0x649d('0x3d')](db[_0x649d('0x36')][_0x649d('0x37')]);_0x24e269[_0x649d('0x3c')]=_[_0x649d('0x3d')](_0x295b1b[_0x649d('0x3c')]);_0x24e269[_0x649d('0x3e')]=_[_0x649d('0x3f')](_0x24e269[_0x649d('0x3b')],_0x24e269[_0x649d('0x3c')]);_0x2a143c[_0x649d('0x40')]=_['intersection'](_0x24e269[_0x649d('0x3b')],qs[_0x649d('0x41')](_0x295b1b['query'][_0x649d('0x41')]));_0x2a143c['attributes']=_0x2a143c['attributes'][_0x649d('0x42')]?_0x2a143c['attributes']:_0x24e269['model'];if(_0x295b1b[_0x649d('0x3c')]['includeAll']){_0x2a143c[_0x649d('0x4c')]=[{'all':!![]}];}_0x2a143c=_[_0x649d('0x49')]({},_0x2a143c,_0x295b1b[_0x649d('0x4a')]);return db['SquareProject'][_0x649d('0x52')](_0x2a143c)['then'](handleEntityNotFound(_0x289f19,null))[_0x649d('0x2b')](respondWithResult(_0x289f19,null))['catch'](handleError(_0x289f19,null));};exports[_0x649d('0x53')]=function(_0x283153,_0x161d37){return db[_0x649d('0x36')]['create'](_0x283153[_0x649d('0x54')],{})[_0x649d('0x2b')](function(_0x3233ef){var _0x50b5cc=_0x283153[_0x649d('0x55')][_0x649d('0x2d')]({'plain':!![]});if(!_0x50b5cc)throw new Error(_0x649d('0x56'));if(_0x50b5cc['role']===_0x649d('0x55')){var _0x537649=_0x3233ef[_0x649d('0x2d')]({'plain':!![]});var _0x4e0d33='SquareProjects';return db[_0x649d('0x57')][_0x649d('0x52')]({'where':{'name':_0x4e0d33,'userProfileId':_0x50b5cc[_0x649d('0x58')]},'raw':!![]})[_0x649d('0x2b')](function(_0x40962e){if(_0x40962e&&_0x40962e[_0x649d('0x59')]===0x0){return db[_0x649d('0x2f')]['create']({'name':_0x537649[_0x649d('0x32')],'resourceId':_0x537649['id'],'type':_0x40962e[_0x649d('0x32')],'sectionId':_0x40962e['id']},{})[_0x649d('0x2b')](function(){return _0x3233ef;});}else{return _0x3233ef;}})[_0x649d('0x4f')](function(_0x2ab742){logger[_0x649d('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ab742);throw _0x2ab742;});}return _0x3233ef;})['then'](respondWithResult(_0x161d37,0xc9))[_0x649d('0x4f')](handleError(_0x161d37,null));};exports['update']=function(_0x276fc4,_0x32af6e){if(_0x276fc4[_0x649d('0x54')]['id']){delete _0x276fc4[_0x649d('0x54')]['id'];}return db[_0x649d('0x36')][_0x649d('0x52')]({'where':{'id':_0x276fc4[_0x649d('0x51')]['id']}})[_0x649d('0x2b')](handleEntityNotFound(_0x32af6e,null))['then'](saveUpdates(_0x276fc4['body'],null))[_0x649d('0x2b')](respondWithResult(_0x32af6e,null))['catch'](handleError(_0x32af6e,null));};exports[_0x649d('0x2c')]=function(_0x4a1e27,_0x4798af){return db[_0x649d('0x36')][_0x649d('0x52')]({'where':{'id':_0x4a1e27[_0x649d('0x51')]['id']}})[_0x649d('0x2b')](handleEntityNotFound(_0x4798af,null))[_0x649d('0x2b')](removeEntity(_0x4798af,null))['catch'](handleError(_0x4798af,null));};exports[_0x649d('0x5a')]=function(_0x3dceb1,_0x450797,_0xf6c869){return db['SquareProject']['find']({'where':{'id':_0x3dceb1['params']['id']}})[_0x649d('0x2b')](handleEntityNotFound(_0x450797,null))[_0x649d('0x2b')](function(_0x2f09ea){if(_0x2f09ea){return _0x2f09ea[_0x649d('0x5a')](_0x3dceb1['body'][_0x649d('0x5b')],_[_0x649d('0x5c')](_0x3dceb1['body'],[_0x649d('0x5b'),'id'])||{});}})[_0x649d('0x2b')](respondWithResult(_0x450797,null))[_0x649d('0x4f')](handleError(_0x450797,null));};exports[_0x649d('0x5d')]=function(_0x13672b,_0x2fae16,_0x2d6e27){return db['SquareProject'][_0x649d('0x52')]({'where':{'id':_0x13672b[_0x649d('0x51')]['id']}})[_0x649d('0x2b')](handleEntityNotFound(_0x2fae16,null))['then'](function(_0x4285e6){if(_0x4285e6){return _0x4285e6[_0x649d('0x5d')](_0x13672b[_0x649d('0x3c')][_0x649d('0x5b')])['then'](function(){if(_[_0x649d('0x5e')](_0x13672b[_0x649d('0x3c')]['ids'])){for(var _0x1e9290=0x0;_0x1e9290<_0x13672b[_0x649d('0x3c')][_0x649d('0x5b')]['length'];_0x1e9290+=0x1){socket[_0x649d('0x5f')](_0x649d('0x60'),{'UserId':Number(_0x13672b[_0x649d('0x3c')][_0x649d('0x5b')][_0x1e9290]),'SquareProjectId':Number(_0x13672b[_0x649d('0x51')]['id'])});}}else{socket['emit']('userSquareProject:remove',{'UserId':Number(_0x13672b[_0x649d('0x3c')][_0x649d('0x5b')]),'SquareProjectId':Number(_0x13672b[_0x649d('0x51')]['id'])});}});}})[_0x649d('0x2b')](respondWithStatusCode(_0x2fae16,null))['catch'](handleError(_0x2fae16,null));};exports['getUsers']=function(_0x130db4,_0x5d6ef0,_0x2c46b2){var _0x235f9d={};var _0x1a3a2f={};var _0x5104f8;var _0x2cd69e;return db['SquareProject'][_0x649d('0x61')]({'where':{'id':_0x130db4[_0x649d('0x51')]['id']}})[_0x649d('0x2b')](handleEntityNotFound(_0x5d6ef0,null))[_0x649d('0x2b')](function(_0x5abac3){if(_0x5abac3){_0x5104f8=_0x5abac3;_0x1a3a2f['model']=_[_0x649d('0x3d')](db['User'][_0x649d('0x37')]);_0x1a3a2f[_0x649d('0x3c')]=_[_0x649d('0x3d')](_0x130db4['query']);_0x1a3a2f[_0x649d('0x3e')]=_[_0x649d('0x3f')](_0x1a3a2f[_0x649d('0x3b')],_0x1a3a2f[_0x649d('0x3c')]);_0x235f9d['attributes']=_[_0x649d('0x3f')](_0x1a3a2f[_0x649d('0x3b')],qs[_0x649d('0x41')](_0x130db4['query'][_0x649d('0x41')]));_0x235f9d[_0x649d('0x40')]=_0x235f9d[_0x649d('0x40')][_0x649d('0x42')]?_0x235f9d[_0x649d('0x40')]:_0x1a3a2f[_0x649d('0x3b')];_0x235f9d[_0x649d('0x62')]=qs['sort'](_0x130db4['query'][_0x649d('0x45')]);_0x235f9d[_0x649d('0x46')]=qs['filters'](_[_0x649d('0x47')](_0x130db4[_0x649d('0x3c')],_0x1a3a2f[_0x649d('0x3e')]));if(_0x130db4[_0x649d('0x3c')][_0x649d('0x48')]){_0x235f9d[_0x649d('0x46')]=_[_0x649d('0x49')](_0x235f9d['where'],{'$or':_[_0x649d('0x35')](_0x235f9d[_0x649d('0x40')],function(_0x574b3d){var _0xef7a17={};_0xef7a17[_0x574b3d]={'$like':'%'+_0x130db4[_0x649d('0x3c')]['filter']+'%'};return _0xef7a17;})});}_0x235f9d=_[_0x649d('0x49')]({},_0x235f9d,_0x130db4[_0x649d('0x4a')]);return _0x5104f8[_0x649d('0x63')](_0x235f9d);}})[_0x649d('0x2b')](function(_0x1df4fa){if(_0x1df4fa){_0x2cd69e=_0x1df4fa[_0x649d('0x42')];if(!_0x130db4[_0x649d('0x3c')][_0x649d('0x43')]('nolimit')){_0x235f9d[_0x649d('0x26')]=qs[_0x649d('0x26')](_0x130db4[_0x649d('0x3c')][_0x649d('0x26')]);_0x235f9d[_0x649d('0x23')]=qs[_0x649d('0x23')](_0x130db4[_0x649d('0x3c')][_0x649d('0x23')]);}return _0x5104f8[_0x649d('0x63')](_0x235f9d);}})[_0x649d('0x2b')](function(_0x437b27){if(_0x437b27){return _0x437b27?{'count':_0x2cd69e,'rows':_0x437b27}:null;}})[_0x649d('0x2b')](respondWithResult(_0x5d6ef0,null))['catch'](handleError(_0x5d6ef0,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 2bc188e..d0682f3 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 _0xa7e8=['hasOwnProperty','exports','events','../../mysqldb','SquareProject','update','emit'];(function(_0x453378,_0x2f360c){var _0xab3d9e=function(_0x58c2c8){while(--_0x58c2c8){_0x453378['push'](_0x453378['shift']());}};_0xab3d9e(++_0x2f360c);}(_0xa7e8,0xe2));var _0x8a7e=function(_0x4059b8,_0x3f7596){_0x4059b8=_0x4059b8-0x0;var _0x1b2fbf=_0xa7e8[_0x4059b8];return _0x1b2fbf;};'use strict';var EventEmitter=require(_0x8a7e('0x0'));var SquareProject=require(_0x8a7e('0x1'))['db'][_0x8a7e('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8a7e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x45ec30){return function(_0x3cfde3,_0x302352,_0x47af21){SquareProjectEvents[_0x8a7e('0x4')](_0x45ec30+':'+_0x3cfde3['id'],_0x3cfde3);SquareProjectEvents[_0x8a7e('0x4')](_0x45ec30,_0x3cfde3);_0x47af21(null);};}for(var e in events){if(events[_0x8a7e('0x5')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x8a7e('0x6')]=SquareProjectEvents; \ No newline at end of file +var _0x4b95=['update','remove','emit','hasOwnProperty','events','../../mysqldb','SquareProject','setMaxListeners','save'];(function(_0x641816,_0x576173){var _0x5088e2=function(_0x56a893){while(--_0x56a893){_0x641816['push'](_0x641816['shift']());}};_0x5088e2(++_0x576173);}(_0x4b95,0x17e));var _0x54b9=function(_0x4c9cb5,_0xcf85d4){_0x4c9cb5=_0x4c9cb5-0x0;var _0x20310b=_0x4b95[_0x4c9cb5];return _0x20310b;};'use strict';var EventEmitter=require(_0x54b9('0x0'));var SquareProject=require(_0x54b9('0x1'))['db'][_0x54b9('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x54b9('0x3')](0x0);var events={'afterCreate':_0x54b9('0x4'),'afterUpdate':_0x54b9('0x5'),'afterDestroy':_0x54b9('0x6')};function emitEvent(_0x29c071){return function(_0x4019d6,_0x1f3fe8,_0x248aa7){SquareProjectEvents['emit'](_0x29c071+':'+_0x4019d6['id'],_0x4019d6);SquareProjectEvents[_0x54b9('0x7')](_0x29c071,_0x4019d6);_0x248aa7(null);};}for(var e in events){if(events[_0x54b9('0x8')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 3402395..afdfac2 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 _0xc362=['changed','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','api','moment','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects'];(function(_0x4f41cf,_0xdf03fe){var _0x5e19d0=function(_0x5af4ab){while(--_0x5af4ab){_0x4f41cf['push'](_0x4f41cf['shift']());}};_0x5e19d0(++_0xdf03fe);}(_0xc362,0x116));var _0x2c36=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc362[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2c36('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2c36('0x1'));var moment=require(_0x2c36('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c36('0x3'));var rimraf=require(_0x2c36('0x4'));var config=require(_0x2c36('0x5'));var attributes=require(_0x2c36('0x6'));module[_0x2c36('0x7')]=function(_0x208cec,_0x1a05b0){return _0x208cec[_0x2c36('0x8')](_0x2c36('0x9'),attributes,{'tableName':_0x2c36('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x36eba4,_0x48b0ed,_0x1217f9){if(_0x36eba4[_0x2c36('0xb')](_0x2c36('0xc'))){_0x36eba4['savedAt']=moment()[_0x2c36('0xd')](_0x2c36('0xe'));}if(_0x36eba4[_0x2c36('0xb')](_0x2c36('0xf'))){_0x36eba4[_0x2c36('0x10')]=moment()[_0x2c36('0xd')](_0x2c36('0xe'));}_0x1217f9(null,_0x36eba4);}}});}; \ No newline at end of file +var _0xd54b=['exports','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./squareProject.attributes'];(function(_0x44ea1b,_0x36bbd3){var _0x239690=function(_0x3ec34b){while(--_0x3ec34b){_0x44ea1b['push'](_0x44ea1b['shift']());}};_0x239690(++_0x36bbd3);}(_0xd54b,0x126));var _0xbd54=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd54b[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xbd54('0x0'));var util=require(_0xbd54('0x1'));var logger=require(_0xbd54('0x2'))(_0xbd54('0x3'));var moment=require(_0xbd54('0x4'));var BPromise=require('bluebird');var rp=require(_0xbd54('0x5'));var fs=require('fs');var path=require(_0xbd54('0x6'));var rimraf=require(_0xbd54('0x7'));var config=require(_0xbd54('0x8'));var attributes=require(_0xbd54('0x9'));module[_0xbd54('0xa')]=function(_0x367bf9,_0x2c2892){return _0x367bf9['define'](_0xbd54('0xb'),attributes,{'tableName':_0xbd54('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1aea5b,_0x2893da,_0x25531c){if(_0x1aea5b[_0xbd54('0xd')](_0xbd54('0xe'))){_0x1aea5b[_0xbd54('0xf')]=moment()[_0xbd54('0x10')](_0xbd54('0x11'));}if(_0x1aea5b[_0xbd54('0xd')](_0xbd54('0x12'))){_0x1aea5b['publishedAt']=moment()[_0xbd54('0x10')](_0xbd54('0x11'));}_0x25531c(null,_0x1aea5b);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 6ee77d6..7af8472 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 _0x4dfc=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareProject','find','options','attributes','include','model','map','debug','ShowSquareProject','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x591db7,_0x150445){var _0x4ad760=function(_0x5dd24e){while(--_0x5dd24e){_0x591db7['push'](_0x591db7['shift']());}};_0x4ad760(++_0x150445);}(_0x4dfc,0x162));var _0xc4df=function(_0x39479f,_0x822ae4){_0x39479f=_0x39479f-0x0;var _0x4a6d96=_0x4dfc[_0x39479f];return _0x4a6d96;};'use strict';var _=require(_0xc4df('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc4df('0x1'));var rs=require(_0xc4df('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc4df('0x3'))['db'];var utils=require(_0xc4df('0x4'));var logger=require(_0xc4df('0x5'))(_0xc4df('0x6'));var config=require(_0xc4df('0x7'));var jayson=require(_0xc4df('0x8'));var client=jayson[_0xc4df('0x9')][_0xc4df('0xa')]({'port':0x232a});config[_0xc4df('0xb')]=_[_0xc4df('0xc')](config[_0xc4df('0xb')],{'host':_0xc4df('0xd'),'port':0x18eb});var socket=require(_0xc4df('0xe'))(new Redis(config['redis']));require('./squareProject.socket')[_0xc4df('0xf')](socket);function respondWithRpcPromise(_0x3c86da,_0x126c0d,_0x4c9763){return new BPromise(function(_0x421e53,_0x4bff26){return client[_0xc4df('0x10')](_0x3c86da,_0x4c9763)[_0xc4df('0x11')](function(_0x1123c2){logger[_0xc4df('0x12')](_0xc4df('0x13'),_0x126c0d,_0xc4df('0x14'));logger['debug'](_0xc4df('0x15'),_0x126c0d,_0xc4df('0x14'),JSON[_0xc4df('0x16')](_0x1123c2));if(_0x1123c2[_0xc4df('0x17')]){if(_0x1123c2[_0xc4df('0x17')][_0xc4df('0x18')]===0x1f4){logger[_0xc4df('0x17')](_0xc4df('0x13'),_0x126c0d,_0x1123c2[_0xc4df('0x17')]['message']);return _0x4bff26(_0x1123c2[_0xc4df('0x17')]['message']);}logger[_0xc4df('0x17')]('SquareProject,\x20%s,\x20%s',_0x126c0d,_0x1123c2[_0xc4df('0x17')][_0xc4df('0x19')]);return _0x421e53(_0x1123c2[_0xc4df('0x17')][_0xc4df('0x19')]);}else{logger['info']('SquareProject,\x20%s,\x20%s',_0x126c0d,'request\x20sent');_0x421e53(_0x1123c2['result'][_0xc4df('0x19')]);}})['catch'](function(_0x355d92){logger[_0xc4df('0x17')](_0xc4df('0x13'),_0x126c0d,_0x355d92);_0x4bff26(_0x355d92);});});}exports['ShowSquareProject']=function(_0x39bf34){var _0x23731b=this;return new Promise(function(_0x44ddd1,_0x1db555){return db[_0xc4df('0x1a')][_0xc4df('0x1b')]({'raw':_0x39bf34[_0xc4df('0x1c')]?_0x39bf34[_0xc4df('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x39bf34[_0xc4df('0x1c')]?_0x39bf34['options']['where']||null:null,'attributes':_0x39bf34[_0xc4df('0x1c')]?_0x39bf34['options'][_0xc4df('0x1d')]||null:null,'include':_0x39bf34[_0xc4df('0x1c')]?_0x39bf34[_0xc4df('0x1c')][_0xc4df('0x1e')]?_['map'](_0x39bf34[_0xc4df('0x1c')][_0xc4df('0x1e')],function(_0x491404){return{'model':db[_0x491404[_0xc4df('0x1f')]],'as':_0x491404['as'],'attributes':_0x491404['attributes'],'include':_0x491404[_0xc4df('0x1e')]?_[_0xc4df('0x20')](_0x491404[_0xc4df('0x1e')],function(_0x3eb8c6){return{'model':db[_0x3eb8c6['model']],'as':_0x3eb8c6['as'],'attributes':_0x3eb8c6[_0xc4df('0x1d')],'include':_0x3eb8c6[_0xc4df('0x1e')]?_[_0xc4df('0x20')](_0x3eb8c6['include'],function(_0x1b52ec){return{'model':db[_0x1b52ec['model']],'as':_0x1b52ec['as'],'attributes':_0x1b52ec['attributes']};}):[]};}):[]};}):[]:[]})[_0xc4df('0x11')](function(_0x4e99e2){logger['info']('ShowSquareProject',_0x39bf34);logger[_0xc4df('0x21')](_0xc4df('0x22'),_0x39bf34,JSON['stringify'](_0x4e99e2));_0x44ddd1(_0x4e99e2);})[_0xc4df('0x23')](function(_0x5c131a){logger['error'](_0xc4df('0x22'),_0x5c131a[_0xc4df('0x19')],_0x39bf34);_0x1db555(_0x23731b[_0xc4df('0x17')](0x1f4,_0x5c131a[_0xc4df('0x19')]));});});}; \ No newline at end of file +var _0x4710=['defaults','socket.io-emitter','register','request','then','SquareProject,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','ShowSquareProject','find','options','where','map','include','attributes','model','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis'];(function(_0x4c3a93,_0x118217){var _0x4ef60b=function(_0x44c6f3){while(--_0x44c6f3){_0x4c3a93['push'](_0x4c3a93['shift']());}};_0x4ef60b(++_0x118217);}(_0x4710,0x79));var _0x0471=function(_0x1bf5af,_0x175dc2){_0x1bf5af=_0x1bf5af-0x0;var _0x40604a=_0x4710[_0x1bf5af];return _0x40604a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0471('0x0'));var BPromise=require(_0x0471('0x1'));var rs=require(_0x0471('0x2'));var fs=require('fs');var Redis=require(_0x0471('0x3'));var db=require(_0x0471('0x4'))['db'];var utils=require(_0x0471('0x5'));var logger=require(_0x0471('0x6'))(_0x0471('0x7'));var config=require(_0x0471('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0471('0x9')]({'port':0x232a});config[_0x0471('0xa')]=_[_0x0471('0xb')](config[_0x0471('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0471('0xc'))(new Redis(config[_0x0471('0xa')]));require('./squareProject.socket')[_0x0471('0xd')](socket);function respondWithRpcPromise(_0x483cf6,_0x25acdf,_0xe258b9){return new BPromise(function(_0x4d2a24,_0x16c4fd){return client[_0x0471('0xe')](_0x483cf6,_0xe258b9)[_0x0471('0xf')](function(_0x23cf71){logger['info'](_0x0471('0x10'),_0x25acdf,'request\x20sent');logger[_0x0471('0x11')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x25acdf,_0x0471('0x12'),JSON['stringify'](_0x23cf71));if(_0x23cf71[_0x0471('0x13')]){if(_0x23cf71[_0x0471('0x13')][_0x0471('0x14')]===0x1f4){logger[_0x0471('0x13')](_0x0471('0x10'),_0x25acdf,_0x23cf71['error']['message']);return _0x16c4fd(_0x23cf71[_0x0471('0x13')]['message']);}logger[_0x0471('0x13')](_0x0471('0x10'),_0x25acdf,_0x23cf71[_0x0471('0x13')][_0x0471('0x15')]);return _0x4d2a24(_0x23cf71['error'][_0x0471('0x15')]);}else{logger[_0x0471('0x16')]('SquareProject,\x20%s,\x20%s',_0x25acdf,_0x0471('0x12'));_0x4d2a24(_0x23cf71['result']['message']);}})[_0x0471('0x17')](function(_0x552672){logger['error']('SquareProject,\x20%s,\x20%s',_0x25acdf,_0x552672);_0x16c4fd(_0x552672);});});}exports[_0x0471('0x18')]=function(_0x166730){var _0xbb5649=this;return new Promise(function(_0x1e8d01,_0x3119e9){return db['SquareProject'][_0x0471('0x19')]({'raw':_0x166730['options']?_0x166730[_0x0471('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x166730[_0x0471('0x1a')]?_0x166730[_0x0471('0x1a')][_0x0471('0x1b')]||null:null,'attributes':_0x166730[_0x0471('0x1a')]?_0x166730['options']['attributes']||null:null,'include':_0x166730['options']?_0x166730[_0x0471('0x1a')]['include']?_[_0x0471('0x1c')](_0x166730[_0x0471('0x1a')][_0x0471('0x1d')],function(_0x153ede){return{'model':db[_0x153ede['model']],'as':_0x153ede['as'],'attributes':_0x153ede[_0x0471('0x1e')],'include':_0x153ede[_0x0471('0x1d')]?_[_0x0471('0x1c')](_0x153ede[_0x0471('0x1d')],function(_0x2e0b43){return{'model':db[_0x2e0b43[_0x0471('0x1f')]],'as':_0x2e0b43['as'],'attributes':_0x2e0b43[_0x0471('0x1e')],'include':_0x2e0b43['include']?_[_0x0471('0x1c')](_0x2e0b43['include'],function(_0x36092a){return{'model':db[_0x36092a[_0x0471('0x1f')]],'as':_0x36092a['as'],'attributes':_0x36092a[_0x0471('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0471('0xf')](function(_0xc4c270){logger['info'](_0x0471('0x18'),_0x166730);logger[_0x0471('0x11')](_0x0471('0x18'),_0x166730,JSON[_0x0471('0x20')](_0xc4c270));_0x1e8d01(_0xc4c270);})[_0x0471('0x17')](function(_0x11b14d){logger[_0x0471('0x13')](_0x0471('0x18'),_0x11b14d[_0x0471('0x15')],_0x166730);_0x3119e9(_0xbb5649['error'](0x1f4,_0x11b14d[_0x0471('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 3791b10..80139ed 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 _0x9acb=['squareProject:','./squareProject.events','save','remove','update','emit','removeListener','register','length'];(function(_0x234ae1,_0x42bdd6){var _0x227ba0=function(_0x1f6531){while(--_0x1f6531){_0x234ae1['push'](_0x234ae1['shift']());}};_0x227ba0(++_0x42bdd6);}(_0x9acb,0x91));var _0xb9ac=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x9acb[_0x134c2e];return _0x2825db;};'use strict';var SquareProjectEvents=require(_0xb9ac('0x0'));var events=[_0xb9ac('0x1'),_0xb9ac('0x2'),_0xb9ac('0x3')];function createListener(_0x2e3ffe,_0x35cea3){return function(_0x2c723f){_0x35cea3[_0xb9ac('0x4')](_0x2e3ffe,_0x2c723f);};}function removeListener(_0x25fad7,_0x139ce4){return function(){SquareProjectEvents[_0xb9ac('0x5')](_0x25fad7,_0x139ce4);};}exports[_0xb9ac('0x6')]=function(_0x433732){for(var _0x4d0ea3=0x0,_0xeb7a9c=events[_0xb9ac('0x7')];_0x4d0ea3<_0xeb7a9c;_0x4d0ea3++){var _0xef4b29=events[_0x4d0ea3];var _0x413bcb=createListener(_0xb9ac('0x8')+_0xef4b29,_0x433732);SquareProjectEvents['on'](_0xef4b29,_0x413bcb);}}; \ No newline at end of file +var _0x5de5=['length','squareProject:','./squareProject.events','save','update','removeListener','register'];(function(_0x8854ad,_0x4ad0a1){var _0x1c5af5=function(_0x1942fb){while(--_0x1942fb){_0x8854ad['push'](_0x8854ad['shift']());}};_0x1c5af5(++_0x4ad0a1);}(_0x5de5,0x152));var _0x55de=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5de5[_0x14add3];return _0x4a174f;};'use strict';var SquareProjectEvents=require(_0x55de('0x0'));var events=[_0x55de('0x1'),'remove',_0x55de('0x2')];function createListener(_0x1b2df6,_0x28620a){return function(_0x2632f0){_0x28620a['emit'](_0x1b2df6,_0x2632f0);};}function removeListener(_0x400250,_0x1e673f){return function(){SquareProjectEvents[_0x55de('0x3')](_0x400250,_0x1e673f);};}exports[_0x55de('0x4')]=function(_0x1c46c6){for(var _0x4c11ff=0x0,_0x226234=events[_0x55de('0x5')];_0x4c11ff<_0x226234;_0x4c11ff++){var _0x3e1b56=events[_0x4c11ff];var _0x5a3734=createListener(_0x55de('0x6')+_0x3e1b56,_0x1c46c6);SquareProjectEvents['on'](_0x3e1b56,_0x5a3734);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 1890e55..341d7e7 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareRecording.controller','isAuthenticated','get','/:id','show','/:id/download','download','post','create','put'];(function(_0x3552e0,_0x6aab7f){var _0x24b02c=function(_0x26e238){while(--_0x26e238){_0x3552e0['push'](_0x3552e0['shift']());}};_0x24b02c(++_0x6aab7f);}(_0x53ec,0x192));var _0xc53e=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x53ec[_0x2261ce];return _0x524640;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router[_0xc53e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x12')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller[_0xc53e('0x13')]);module[_0xc53e('0x14')]=router; \ No newline at end of file +var _0xe14b=['Router','../../components/auth/service','./squareRecording.controller','get','isAuthenticated','index','/:id','download','post','delete','destroy','exports','multer','util','express'];(function(_0x4d62bd,_0x5d264a){var _0x154097=function(_0x260b2a){while(--_0x260b2a){_0x4d62bd['push'](_0x4d62bd['shift']());}};_0x154097(++_0x5d264a);}(_0xe14b,0x93));var _0xbe14=function(_0x2c2d02,_0x516d6b){_0x2c2d02=_0x2c2d02-0x0;var _0x4ed1d7=_0xe14b[_0x2c2d02];return _0x4ed1d7;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['show']);router['get']('/:id/download',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')]('/',auth[_0xbe14('0x7')](),controller['create']);router['put'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0xc')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xd')]);module[_0xbe14('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 8a24536..77e8138 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 _0xda19=['getDataValue','exports','STRING','VIRTUAL'];(function(_0x1f27df,_0x4f1a64){var _0x286ee2=function(_0x255ea7){while(--_0x255ea7){_0x1f27df['push'](_0x1f27df['shift']());}};_0x286ee2(++_0x4f1a64);}(_0xda19,0xd5));var _0x9da1=function(_0x4c9019,_0x1720ae){_0x4c9019=_0x4c9019-0x0;var _0x1ba741=_0xda19[_0x4c9019];return _0x1ba741;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'uniqueid':{'type':Sequelize[_0x9da1('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9da1('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x9da1('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x9da1('0x1')]},'dnid':{'type':Sequelize[_0x9da1('0x1')]},'projectName':{'type':Sequelize[_0x9da1('0x1')]},'saveName':{'type':Sequelize[_0x9da1('0x1')]},'filename':{'type':Sequelize[_0x9da1('0x1')]},'savePath':{'type':Sequelize[_0x9da1('0x1')]},'format':{'type':Sequelize[_0x9da1('0x2')],'get':function(){var _0x2c3cdd='';var _0x1c24e6=this[_0x9da1('0x3')]('savePath');if(_0x1c24e6){_0x2c3cdd=_0x1c24e6['substring'](_0x1c24e6['lastIndexOf']('.'));}return _0x2c3cdd;}}}; \ No newline at end of file +var _0xbd51=['VIRTUAL','getDataValue','savePath','lastIndexOf','sequelize','STRING'];(function(_0x3c8b25,_0x5a4502){var _0x393e0b=function(_0x27db0d){while(--_0x27db0d){_0x3c8b25['push'](_0x3c8b25['shift']());}};_0x393e0b(++_0x5a4502);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x5997af,_0x1f62db){_0x5997af=_0x5997af-0x0;var _0x40c253=_0xbd51[_0x5997af];return _0x40c253;};'use strict';var Sequelize=require(_0x1bd5('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x1bd5('0x1')]},'callerid':{'type':Sequelize[_0x1bd5('0x1')]},'calleridname':{'type':Sequelize[_0x1bd5('0x1')]},'context':{'type':Sequelize[_0x1bd5('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x1bd5('0x1')]},'saveName':{'type':Sequelize[_0x1bd5('0x1')]},'filename':{'type':Sequelize[_0x1bd5('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x1bd5('0x2')],'get':function(){var _0x30a385='';var _0x19077c=this[_0x1bd5('0x3')](_0x1bd5('0x4'));if(_0x19077c){_0x30a385=_0x19077c['substring'](_0x19077c[_0x1bd5('0x5')]('.'));}return _0x30a385;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 028460b..dd029ad 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 _0xf847=['VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','SquareRecording','find','create','body','update','download','../../components/encryptor','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found','unlink','Not\x20found','destroy','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','error','stack','name','send','index','rawAttributes','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x13e4db,_0x45ac7e){var _0x5bface=function(_0x45c447){while(--_0x45c447){_0x13e4db['push'](_0x13e4db['shift']());}};_0x5bface(++_0x45ac7e);}(_0xf847,0x148));var _0x7f84=function(_0x36511e,_0x31477c){_0x36511e=_0x36511e-0x0;var _0x17de6f=_0xf847[_0x36511e];return _0x17de6f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7f84('0x0'));var zipdir=require(_0x7f84('0x1'));var jsonpatch=require(_0x7f84('0x2'));var rp=require(_0x7f84('0x3'));var moment=require(_0x7f84('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7f84('0x5'));var util=require(_0x7f84('0x6'));var path=require(_0x7f84('0x7'));var sox=require('sox');var csv=require(_0x7f84('0x8'));var ejs=require(_0x7f84('0x9'));var fs=require('fs');var fs_extra=require(_0x7f84('0xa'));var _=require(_0x7f84('0xb'));var squel=require(_0x7f84('0xc'));var crypto=require(_0x7f84('0xd'));var jsforce=require(_0x7f84('0xe'));var deskjs=require(_0x7f84('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7f84('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7f84('0x11'));var hardwareService=require(_0x7f84('0x12'));var logger=require(_0x7f84('0x13'))(_0x7f84('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7f84('0x15'));var db=require(_0x7f84('0x16'))['db'];function respondWithStatusCode(_0x4cade9,_0xca9f3){_0xca9f3=_0xca9f3||0xcc;return function(_0x287e80){if(_0x287e80){return _0x4cade9[_0x7f84('0x17')](_0xca9f3);}return _0x4cade9[_0x7f84('0x18')](_0xca9f3)[_0x7f84('0x19')]();};}function respondWithResult(_0x12e376,_0x5e5e10){_0x5e5e10=_0x5e5e10||0xc8;return function(_0xb81871){if(_0xb81871){return _0x12e376[_0x7f84('0x18')](_0x5e5e10)[_0x7f84('0x1a')](_0xb81871);}};}function respondWithFilteredResult(_0xdba0cc,_0x541c6b){return function(_0x1a7214){if(_0x1a7214){var _0x47628e=typeof _0x541c6b[_0x7f84('0x1b')]==='undefined'&&typeof _0x541c6b[_0x7f84('0x1c')]===_0x7f84('0x1d');var _0x128872=_0x1a7214[_0x7f84('0x1e')];var _0x1062d1=_0x47628e?0x0:_0x541c6b[_0x7f84('0x1b')];var _0x11b536=_0x47628e?_0x1a7214[_0x7f84('0x1e')]:_0x541c6b['offset']+_0x541c6b[_0x7f84('0x1c')];var _0x5aa068;if(_0x11b536>=_0x128872){_0x11b536=_0x128872;_0x5aa068=0xc8;}else{_0x5aa068=0xce;}_0xdba0cc[_0x7f84('0x18')](_0x5aa068);return _0xdba0cc[_0x7f84('0x1f')](_0x7f84('0x20'),_0x1062d1+'-'+_0x11b536+'/'+_0x128872)[_0x7f84('0x1a')](_0x1a7214);}return null;};}function patchUpdates(_0x2cc417){return function(_0x596df8){try{jsonpatch['apply'](_0x596df8,_0x2cc417,!![]);}catch(_0x1d4a87){return BPromise[_0x7f84('0x21')](_0x1d4a87);}return _0x596df8[_0x7f84('0x22')]();};}function saveUpdates(_0x524d88,_0x4e059d){return function(_0x3ddd18){if(_0x3ddd18){return _0x3ddd18['update'](_0x524d88)['then'](function(_0x35c2e6){return _0x35c2e6;});}return null;};}function removeEntity(_0x3199df,_0x5d91e7){return function(_0x428c67){if(_0x428c67){return _0x428c67['destroy']()[_0x7f84('0x23')](function(){_0x3199df[_0x7f84('0x18')](0xcc)[_0x7f84('0x19')]();});}};}function handleEntityNotFound(_0x757688,_0x1841e6){return function(_0x48559b){if(!_0x48559b){_0x757688[_0x7f84('0x17')](0x194);}return _0x48559b;};}function handleError(_0x5f2d86,_0x283b3e){_0x283b3e=_0x283b3e||0x1f4;return function(_0x32035a){logger[_0x7f84('0x24')](_0x32035a[_0x7f84('0x25')]);if(_0x32035a['name']){delete _0x32035a[_0x7f84('0x26')];}_0x5f2d86[_0x7f84('0x18')](_0x283b3e)[_0x7f84('0x27')](_0x32035a);};}exports[_0x7f84('0x28')]=function(_0x5c1c28,_0x843bb){var _0x4cee5a={},_0x40decd={},_0x4005f0={'count':0x0,'rows':[]};var _0x58aa8c=_['map'](db['SquareRecording'][_0x7f84('0x29')],function(_0x426279){return{'name':_0x426279['fieldName'],'type':_0x426279[_0x7f84('0x2a')]['key']};});_0x40decd[_0x7f84('0x2b')]=_[_0x7f84('0x2c')](_0x58aa8c,'name');_0x40decd[_0x7f84('0x2d')]=_[_0x7f84('0x2e')](_0x5c1c28[_0x7f84('0x2d')]);_0x40decd[_0x7f84('0x2f')]=_[_0x7f84('0x30')](_0x40decd[_0x7f84('0x2b')],_0x40decd[_0x7f84('0x2d')]);_0x4cee5a['attributes']=_[_0x7f84('0x30')](_0x40decd[_0x7f84('0x2b')],qs[_0x7f84('0x31')](_0x5c1c28[_0x7f84('0x2d')][_0x7f84('0x31')]));_0x4cee5a[_0x7f84('0x32')]=_0x4cee5a[_0x7f84('0x32')][_0x7f84('0x33')]?_0x4cee5a[_0x7f84('0x32')]:_0x40decd[_0x7f84('0x2b')];if(!_0x5c1c28[_0x7f84('0x2d')][_0x7f84('0x34')](_0x7f84('0x35'))){_0x4cee5a[_0x7f84('0x1c')]=qs[_0x7f84('0x1c')](_0x5c1c28[_0x7f84('0x2d')][_0x7f84('0x1c')]);_0x4cee5a[_0x7f84('0x1b')]=qs['offset'](_0x5c1c28[_0x7f84('0x2d')][_0x7f84('0x1b')]);}_0x4cee5a[_0x7f84('0x36')]=qs[_0x7f84('0x37')](_0x5c1c28['query']['sort']);_0x4cee5a[_0x7f84('0x38')]=qs[_0x7f84('0x2f')](_[_0x7f84('0x39')](_0x5c1c28[_0x7f84('0x2d')],_0x40decd[_0x7f84('0x2f')]),_0x58aa8c);if(_0x5c1c28[_0x7f84('0x2d')][_0x7f84('0x3a')]){_0x4cee5a[_0x7f84('0x38')]=_[_0x7f84('0x3b')](_0x4cee5a[_0x7f84('0x38')],{'$or':_[_0x7f84('0x2c')](_0x58aa8c,function(_0x3cbf59){if(_0x3cbf59['type']!==_0x7f84('0x3c')){var _0x42a17e={};_0x42a17e[_0x3cbf59[_0x7f84('0x26')]]={'$like':'%'+_0x5c1c28['query'][_0x7f84('0x3a')]+'%'};return _0x42a17e;}})});}_0x4cee5a=_[_0x7f84('0x3b')]({},_0x4cee5a,_0x5c1c28[_0x7f84('0x3d')]);var _0x44cb38={'where':_0x4cee5a[_0x7f84('0x38')]};return db['SquareRecording'][_0x7f84('0x1e')](_0x44cb38)[_0x7f84('0x23')](function(_0x5c6e0c){_0x4005f0[_0x7f84('0x1e')]=_0x5c6e0c;if(_0x5c1c28[_0x7f84('0x2d')][_0x7f84('0x3e')]){_0x4cee5a[_0x7f84('0x3f')]=[{'all':!![]}];}return db['SquareRecording'][_0x7f84('0x40')](_0x4cee5a);})['then'](function(_0x2b9245){_0x4005f0[_0x7f84('0x41')]=_0x2b9245;return _0x4005f0;})[_0x7f84('0x23')](respondWithFilteredResult(_0x843bb,_0x4cee5a))[_0x7f84('0x42')](handleError(_0x843bb,null));};exports[_0x7f84('0x43')]=function(_0x5f41d7,_0x41679d){var _0x38ee88={'raw':!![],'where':{'id':_0x5f41d7[_0x7f84('0x44')]['id']}},_0x83aac={};_0x83aac['model']=_[_0x7f84('0x2e')](db[_0x7f84('0x45')]['rawAttributes']);_0x83aac[_0x7f84('0x2d')]=_[_0x7f84('0x2e')](_0x5f41d7[_0x7f84('0x2d')]);_0x83aac[_0x7f84('0x2f')]=_[_0x7f84('0x30')](_0x83aac[_0x7f84('0x2b')],_0x83aac[_0x7f84('0x2d')]);_0x38ee88[_0x7f84('0x32')]=_[_0x7f84('0x30')](_0x83aac[_0x7f84('0x2b')],qs[_0x7f84('0x31')](_0x5f41d7[_0x7f84('0x2d')][_0x7f84('0x31')]));_0x38ee88['attributes']=_0x38ee88[_0x7f84('0x32')][_0x7f84('0x33')]?_0x38ee88[_0x7f84('0x32')]:_0x83aac[_0x7f84('0x2b')];if(_0x5f41d7[_0x7f84('0x2d')][_0x7f84('0x3e')]){_0x38ee88['include']=[{'all':!![]}];}_0x38ee88=_[_0x7f84('0x3b')]({},_0x38ee88,_0x5f41d7[_0x7f84('0x3d')]);return db[_0x7f84('0x45')][_0x7f84('0x46')](_0x38ee88)[_0x7f84('0x23')](handleEntityNotFound(_0x41679d,null))['then'](respondWithResult(_0x41679d,null))[_0x7f84('0x42')](handleError(_0x41679d,null));};exports[_0x7f84('0x47')]=function(_0xf176ab,_0x1810a5){return db[_0x7f84('0x45')][_0x7f84('0x47')](_0xf176ab[_0x7f84('0x48')],{})['then'](respondWithResult(_0x1810a5,0xc9))[_0x7f84('0x42')](handleError(_0x1810a5,null));};exports[_0x7f84('0x49')]=function(_0x23a0a8,_0x5dcdcc){if(_0x23a0a8[_0x7f84('0x48')]['id']){delete _0x23a0a8[_0x7f84('0x48')]['id'];}return db['SquareRecording']['find']({'where':{'id':_0x23a0a8['params']['id']}})[_0x7f84('0x23')](handleEntityNotFound(_0x5dcdcc,null))[_0x7f84('0x23')](saveUpdates(_0x23a0a8['body'],null))[_0x7f84('0x23')](respondWithResult(_0x5dcdcc,null))[_0x7f84('0x42')](handleError(_0x5dcdcc,null));};exports[_0x7f84('0x4a')]=function(_0x13910b,_0x47fad4,_0xc89dd6){var _0x4ad6ff=require(_0x7f84('0x4b'));var _0x3a2f36=![];var _0x364840={};if(_0x13910b[_0x7f84('0x2d')]['type']&&_0x13910b[_0x7f84('0x2d')][_0x7f84('0x2a')]==='uniqueid'){_0x364840['uniqueid']=_0x13910b[_0x7f84('0x44')]['id'];}else{_0x364840['id']=_0x13910b[_0x7f84('0x44')]['id'];}return db[_0x7f84('0x45')][_0x7f84('0x46')]({'where':_0x364840,'attributes':['id',_0x7f84('0x4c'),_0x7f84('0x4d')],'raw':!![]})[_0x7f84('0x23')](handleEntityNotFound(_0x47fad4,null))[_0x7f84('0x23')](function(_0x301120){if(_0x301120){var _0x19c59d=_0x301120[_0x7f84('0x4c')];var _0x1c0034=util[_0x7f84('0x4e')](_0x7f84('0x4f'),_0x19c59d);if(fs[_0x7f84('0x50')](_0x1c0034)){_0x3a2f36=!![];return _0x4ad6ff[_0x7f84('0x51')](_0x1c0034,_0x19c59d,config[_0x7f84('0x52')]['recording'])[_0x7f84('0x23')](function(){return _0x301120;});}return _0x301120;}})[_0x7f84('0x23')](function(_0x4dd54c){if(_0x4dd54c){var _0x243ef3=_0x4dd54c[_0x7f84('0x4c')];if(!fs[_0x7f84('0x50')](_0x243ef3)){throw new db[(_0x7f84('0x53'))][(_0x7f84('0x54'))](_0x7f84('0x55'));}if(_0x4dd54c['filename']){return _0x47fad4[_0x7f84('0x4a')](_0x243ef3,_0x4dd54c[_0x7f84('0x4d')]+path['extname'](_0x243ef3),function(){if(_0x3a2f36){fs[_0x7f84('0x56')](_0x243ef3);}});}else{return _0x47fad4[_0x7f84('0x4a')](_0x243ef3,function(_0x2c6e71){if(_0x3a2f36){fs[_0x7f84('0x56')](_0x243ef3);}});}}})[_0x7f84('0x42')](function(_0x59d799){if(_0x59d799['message']==='SquareRecording\x20not\x20found'){_0x47fad4[_0x7f84('0x18')](0x194)['send'](_0x7f84('0x57'));}else{return handleError(_0x47fad4,null);}});};exports[_0x7f84('0x58')]=function(_0x31f4f2,_0x175edc){return db[_0x7f84('0x45')][_0x7f84('0x46')]({'where':{'id':_0x31f4f2[_0x7f84('0x44')]['id']}})[_0x7f84('0x23')](function(_0x4374b5){if(_[_0x7f84('0x59')](_0x4374b5)){throw new ReferenceError(_0x7f84('0x5a'));}return _0x4374b5;})[_0x7f84('0x23')](function(_0x2764ad){var _0x3f5a23=_0x2764ad[_0x7f84('0x4c')];logger['info'](_0x7f84('0x5b'),_0x3f5a23);if(!_[_0x7f84('0x59')](_0x2764ad[_0x7f84('0x4c')])&&fs[_0x7f84('0x50')](_0x3f5a23)){logger[_0x7f84('0x5c')](_0x7f84('0x5d')+_0x3f5a23+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x7f84('0x5e')](_0x3f5a23);}_0x3f5a23=_0x3f5a23+_0x7f84('0x5f');if(!_[_0x7f84('0x59')](_0x2764ad['savePath'])&&fs[_0x7f84('0x50')](_0x3f5a23)){logger['info'](_0x7f84('0x5d')+_0x3f5a23+_0x7f84('0x60'));fs[_0x7f84('0x5e')](_0x3f5a23);}return _0x2764ad;})[_0x7f84('0x23')](function(_0xafc175){if(!_0xafc175)throw new InternalError();return _0xafc175[_0x7f84('0x58')]();})[_0x7f84('0x23')](function(){_0x175edc[_0x7f84('0x18')](0xcc)[_0x7f84('0x19')]();})[_0x7f84('0x42')](handleError(_0x175edc,null));}; \ No newline at end of file +var _0x3327=['count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','SquareRecording','include','findAll','rows','catch','show','find','create','body','../../components/encryptor','uniqueid','params','filename','secrets','recording','existsSync','Sequelize','ValidationError','download','extname','unlink','message','SquareRecording\x20not\x20found','isNil','Entity\x20not\x20found','savePath','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0xbc4d3d,_0x48a206){var _0x4210b4=function(_0x1b96c7){while(--_0x1b96c7){_0xbc4d3d['push'](_0xbc4d3d['shift']());}};_0x4210b4(++_0x48a206);}(_0x3327,0x100));var _0x7332=function(_0x183187,_0x1bcb4e){_0x183187=_0x183187-0x0;var _0x697610=_0x3327[_0x183187];return _0x697610;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7332('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7332('0x1'));var moment=require(_0x7332('0x2'));var BPromise=require(_0x7332('0x3'));var Mustache=require(_0x7332('0x4'));var util=require('util');var path=require(_0x7332('0x5'));var sox=require(_0x7332('0x6'));var csv=require(_0x7332('0x7'));var ejs=require(_0x7332('0x8'));var fs=require('fs');var fs_extra=require(_0x7332('0x9'));var _=require(_0x7332('0xa'));var squel=require(_0x7332('0xb'));var crypto=require(_0x7332('0xc'));var jsforce=require(_0x7332('0xd'));var deskjs=require(_0x7332('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7332('0xf'));var Redis=require(_0x7332('0x10'));var authService=require(_0x7332('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7332('0x12'));var hardwareService=require(_0x7332('0x13'));var logger=require(_0x7332('0x14'))(_0x7332('0x15'));var utils=require('../../config/utils');var config=require(_0x7332('0x16'));var licenseUtil=require(_0x7332('0x17'));var db=require(_0x7332('0x18'))['db'];function respondWithStatusCode(_0x51dc95,_0x259909){_0x259909=_0x259909||0xcc;return function(_0x19957d){if(_0x19957d){return _0x51dc95[_0x7332('0x19')](_0x259909);}return _0x51dc95[_0x7332('0x1a')](_0x259909)[_0x7332('0x1b')]();};}function respondWithResult(_0x27feae,_0x111624){_0x111624=_0x111624||0xc8;return function(_0x1d9969){if(_0x1d9969){return _0x27feae[_0x7332('0x1a')](_0x111624)[_0x7332('0x1c')](_0x1d9969);}};}function respondWithFilteredResult(_0xb997a1,_0x9f6fe1){return function(_0x4e6452){if(_0x4e6452){var _0x262422=typeof _0x9f6fe1[_0x7332('0x1d')]===_0x7332('0x1e')&&typeof _0x9f6fe1[_0x7332('0x1f')]===_0x7332('0x1e');var _0xc81bce=_0x4e6452[_0x7332('0x20')];var _0x1025e0=_0x262422?0x0:_0x9f6fe1[_0x7332('0x1d')];var _0x5e1d25=_0x262422?_0x4e6452['count']:_0x9f6fe1[_0x7332('0x1d')]+_0x9f6fe1[_0x7332('0x1f')];var _0x3c4691;if(_0x5e1d25>=_0xc81bce){_0x5e1d25=_0xc81bce;_0x3c4691=0xc8;}else{_0x3c4691=0xce;}_0xb997a1[_0x7332('0x1a')](_0x3c4691);return _0xb997a1[_0x7332('0x21')](_0x7332('0x22'),_0x1025e0+'-'+_0x5e1d25+'/'+_0xc81bce)['json'](_0x4e6452);}return null;};}function patchUpdates(_0xb7947){return function(_0x57800a){try{jsonpatch[_0x7332('0x23')](_0x57800a,_0xb7947,!![]);}catch(_0x3d81c6){return BPromise[_0x7332('0x24')](_0x3d81c6);}return _0x57800a[_0x7332('0x25')]();};}function saveUpdates(_0x5043aa,_0xa06c6e){return function(_0x92c28b){if(_0x92c28b){return _0x92c28b[_0x7332('0x26')](_0x5043aa)[_0x7332('0x27')](function(_0x204c92){return _0x204c92;});}return null;};}function removeEntity(_0x4cef66,_0x18330d){return function(_0x20878c){if(_0x20878c){return _0x20878c[_0x7332('0x28')]()['then'](function(){_0x4cef66['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x58d196,_0x5206a0){return function(_0x3128af){if(!_0x3128af){_0x58d196[_0x7332('0x19')](0x194);}return _0x3128af;};}function handleError(_0x18bea6,_0xa7d48c){_0xa7d48c=_0xa7d48c||0x1f4;return function(_0x318d02){logger[_0x7332('0x29')](_0x318d02[_0x7332('0x2a')]);if(_0x318d02[_0x7332('0x2b')]){delete _0x318d02['name'];}_0x18bea6['status'](_0xa7d48c)[_0x7332('0x2c')](_0x318d02);};}exports[_0x7332('0x2d')]=function(_0x2d9bcc,_0x14350e){var _0x38885c={},_0x323082={},_0x5a278d={'count':0x0,'rows':[]};var _0x22ea7b=_[_0x7332('0x2e')](db['SquareRecording'][_0x7332('0x2f')],function(_0x594ced){return{'name':_0x594ced[_0x7332('0x30')],'type':_0x594ced[_0x7332('0x31')][_0x7332('0x32')]};});_0x323082[_0x7332('0x33')]=_[_0x7332('0x2e')](_0x22ea7b,'name');_0x323082[_0x7332('0x34')]=_[_0x7332('0x35')](_0x2d9bcc[_0x7332('0x34')]);_0x323082['filters']=_[_0x7332('0x36')](_0x323082[_0x7332('0x33')],_0x323082['query']);_0x38885c[_0x7332('0x37')]=_[_0x7332('0x36')](_0x323082[_0x7332('0x33')],qs[_0x7332('0x38')](_0x2d9bcc[_0x7332('0x34')][_0x7332('0x38')]));_0x38885c[_0x7332('0x37')]=_0x38885c[_0x7332('0x37')][_0x7332('0x39')]?_0x38885c[_0x7332('0x37')]:_0x323082[_0x7332('0x33')];if(!_0x2d9bcc['query']['hasOwnProperty'](_0x7332('0x3a'))){_0x38885c['limit']=qs[_0x7332('0x1f')](_0x2d9bcc[_0x7332('0x34')][_0x7332('0x1f')]);_0x38885c['offset']=qs[_0x7332('0x1d')](_0x2d9bcc[_0x7332('0x34')]['offset']);}_0x38885c[_0x7332('0x3b')]=qs[_0x7332('0x3c')](_0x2d9bcc[_0x7332('0x34')][_0x7332('0x3c')]);_0x38885c[_0x7332('0x3d')]=qs[_0x7332('0x3e')](_[_0x7332('0x3f')](_0x2d9bcc['query'],_0x323082[_0x7332('0x3e')]),_0x22ea7b);if(_0x2d9bcc[_0x7332('0x34')][_0x7332('0x40')]){_0x38885c[_0x7332('0x3d')]=_[_0x7332('0x41')](_0x38885c[_0x7332('0x3d')],{'$or':_['map'](_0x22ea7b,function(_0x190822){if(_0x190822['type']!=='VIRTUAL'){var _0x4ac266={};_0x4ac266[_0x190822[_0x7332('0x2b')]]={'$like':'%'+_0x2d9bcc[_0x7332('0x34')][_0x7332('0x40')]+'%'};return _0x4ac266;}})});}_0x38885c=_[_0x7332('0x41')]({},_0x38885c,_0x2d9bcc['options']);var _0x27274f={'where':_0x38885c[_0x7332('0x3d')]};return db[_0x7332('0x42')][_0x7332('0x20')](_0x27274f)[_0x7332('0x27')](function(_0x194b3e){_0x5a278d[_0x7332('0x20')]=_0x194b3e;if(_0x2d9bcc[_0x7332('0x34')]['includeAll']){_0x38885c[_0x7332('0x43')]=[{'all':!![]}];}return db['SquareRecording'][_0x7332('0x44')](_0x38885c);})['then'](function(_0x34bc32){_0x5a278d[_0x7332('0x45')]=_0x34bc32;return _0x5a278d;})[_0x7332('0x27')](respondWithFilteredResult(_0x14350e,_0x38885c))[_0x7332('0x46')](handleError(_0x14350e,null));};exports[_0x7332('0x47')]=function(_0x57aca3,_0x2050b3){var _0x383dd1={'raw':!![],'where':{'id':_0x57aca3['params']['id']}},_0x285015={};_0x285015[_0x7332('0x33')]=_[_0x7332('0x35')](db[_0x7332('0x42')][_0x7332('0x2f')]);_0x285015[_0x7332('0x34')]=_[_0x7332('0x35')](_0x57aca3['query']);_0x285015[_0x7332('0x3e')]=_[_0x7332('0x36')](_0x285015[_0x7332('0x33')],_0x285015[_0x7332('0x34')]);_0x383dd1[_0x7332('0x37')]=_['intersection'](_0x285015[_0x7332('0x33')],qs[_0x7332('0x38')](_0x57aca3[_0x7332('0x34')][_0x7332('0x38')]));_0x383dd1[_0x7332('0x37')]=_0x383dd1[_0x7332('0x37')][_0x7332('0x39')]?_0x383dd1[_0x7332('0x37')]:_0x285015[_0x7332('0x33')];if(_0x57aca3[_0x7332('0x34')]['includeAll']){_0x383dd1[_0x7332('0x43')]=[{'all':!![]}];}_0x383dd1=_[_0x7332('0x41')]({},_0x383dd1,_0x57aca3['options']);return db['SquareRecording'][_0x7332('0x48')](_0x383dd1)[_0x7332('0x27')](handleEntityNotFound(_0x2050b3,null))[_0x7332('0x27')](respondWithResult(_0x2050b3,null))[_0x7332('0x46')](handleError(_0x2050b3,null));};exports[_0x7332('0x49')]=function(_0x479256,_0x59a014){return db[_0x7332('0x42')][_0x7332('0x49')](_0x479256[_0x7332('0x4a')],{})[_0x7332('0x27')](respondWithResult(_0x59a014,0xc9))[_0x7332('0x46')](handleError(_0x59a014,null));};exports[_0x7332('0x26')]=function(_0x33c423,_0x2ade99){if(_0x33c423['body']['id']){delete _0x33c423[_0x7332('0x4a')]['id'];}return db['SquareRecording'][_0x7332('0x48')]({'where':{'id':_0x33c423['params']['id']}})['then'](handleEntityNotFound(_0x2ade99,null))[_0x7332('0x27')](saveUpdates(_0x33c423[_0x7332('0x4a')],null))[_0x7332('0x27')](respondWithResult(_0x2ade99,null))['catch'](handleError(_0x2ade99,null));};exports['download']=function(_0xa17c6a,_0x1c9120,_0x5461ac){var _0x4ecf86=require(_0x7332('0x4b'));var _0x3d295d=![];var _0x1fcd67={};if(_0xa17c6a['query'][_0x7332('0x31')]&&_0xa17c6a[_0x7332('0x34')][_0x7332('0x31')]===_0x7332('0x4c')){_0x1fcd67[_0x7332('0x4c')]=_0xa17c6a['params']['id'];}else{_0x1fcd67['id']=_0xa17c6a[_0x7332('0x4d')]['id'];}return db[_0x7332('0x42')][_0x7332('0x48')]({'where':_0x1fcd67,'attributes':['id','savePath',_0x7332('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x1c9120,null))['then'](function(_0xe5337c){if(_0xe5337c){var _0x1627fa=_0xe5337c['savePath'];var _0xbb85b=util['format']('%s.cypher',_0x1627fa);if(fs['existsSync'](_0xbb85b)){_0x3d295d=!![];return _0x4ecf86['decryptFile'](_0xbb85b,_0x1627fa,config[_0x7332('0x4f')][_0x7332('0x50')])[_0x7332('0x27')](function(){return _0xe5337c;});}return _0xe5337c;}})['then'](function(_0x9438){if(_0x9438){var _0x4f3414=_0x9438['savePath'];if(!fs[_0x7332('0x51')](_0x4f3414)){throw new db[(_0x7332('0x52'))][(_0x7332('0x53'))]('SquareRecording\x20not\x20found');}if(_0x9438[_0x7332('0x4e')]){return _0x1c9120[_0x7332('0x54')](_0x4f3414,_0x9438[_0x7332('0x4e')]+path[_0x7332('0x55')](_0x4f3414),function(){if(_0x3d295d){fs[_0x7332('0x56')](_0x4f3414);}});}else{return _0x1c9120[_0x7332('0x54')](_0x4f3414,function(_0x206122){if(_0x3d295d){fs[_0x7332('0x56')](_0x4f3414);}});}}})[_0x7332('0x46')](function(_0x9aac78){if(_0x9aac78[_0x7332('0x57')]===_0x7332('0x58')){_0x1c9120[_0x7332('0x1a')](0x194)[_0x7332('0x2c')]('Not\x20found');}else{return handleError(_0x1c9120,null);}});};exports[_0x7332('0x28')]=function(_0x35d0a4,_0x3c87a8){return db[_0x7332('0x42')][_0x7332('0x48')]({'where':{'id':_0x35d0a4[_0x7332('0x4d')]['id']}})['then'](function(_0x10d4c8){if(_[_0x7332('0x59')](_0x10d4c8)){throw new ReferenceError(_0x7332('0x5a'));}return _0x10d4c8;})[_0x7332('0x27')](function(_0x57973f){var _0x411fa0=_0x57973f[_0x7332('0x5b')];logger[_0x7332('0x5c')](_0x7332('0x5d'),_0x411fa0);if(!_['isNil'](_0x57973f[_0x7332('0x5b')])&&fs['existsSync'](_0x411fa0)){logger['info']('File:\x20\x22'+_0x411fa0+_0x7332('0x5e'));fs['unlinkSync'](_0x411fa0);}_0x411fa0=_0x411fa0+'.cypher';if(!_[_0x7332('0x59')](_0x57973f[_0x7332('0x5b')])&&fs[_0x7332('0x51')](_0x411fa0)){logger[_0x7332('0x5c')]('File:\x20\x22'+_0x411fa0+_0x7332('0x5e'));fs[_0x7332('0x5f')](_0x411fa0);}return _0x57973f;})[_0x7332('0x27')](function(_0x287ea8){if(!_0x287ea8)throw new InternalError();return _0x287ea8[_0x7332('0x28')]();})[_0x7332('0x27')](function(){_0x3c87a8[_0x7332('0x1a')](0xcc)[_0x7332('0x1b')]();})[_0x7332('0x46')](handleError(_0x3c87a8,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index fc00987..816c851 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 _0xc7b3=['api','moment','bluebird','request-promise','path','rimraf','./squareRecording.attributes','exports','define','SquareRecording','lodash','util'];(function(_0x4d43e0,_0x3a83bd){var _0x2516af=function(_0x8706a5){while(--_0x8706a5){_0x4d43e0['push'](_0x4d43e0['shift']());}};_0x2516af(++_0x3a83bd);}(_0xc7b3,0x1c6));var _0x3c7b=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xc7b3[_0x209941];return _0x1e8729;};'use strict';var _=require(_0x3c7b('0x0'));var util=require(_0x3c7b('0x1'));var logger=require('../../config/logger')(_0x3c7b('0x2'));var moment=require(_0x3c7b('0x3'));var BPromise=require(_0x3c7b('0x4'));var rp=require(_0x3c7b('0x5'));var fs=require('fs');var path=require(_0x3c7b('0x6'));var rimraf=require(_0x3c7b('0x7'));var config=require('../../config/environment');var attributes=require(_0x3c7b('0x8'));module[_0x3c7b('0x9')]=function(_0x1fa371,_0x55975f){return _0x1fa371[_0x3c7b('0xa')](_0x3c7b('0xb'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2aa3=['square_recordings','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording'];(function(_0x476fa0,_0x5e9e92){var _0xfb5761=function(_0x19e457){while(--_0x19e457){_0x476fa0['push'](_0x476fa0['shift']());}};_0xfb5761(++_0x5e9e92);}(_0x2aa3,0x83));var _0x32aa=function(_0x2d4440,_0x500496){_0x2d4440=_0x2d4440-0x0;var _0x11708a=_0x2aa3[_0x2d4440];return _0x11708a;};'use strict';var _=require(_0x32aa('0x0'));var util=require(_0x32aa('0x1'));var logger=require(_0x32aa('0x2'))(_0x32aa('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x32aa('0x4'));var fs=require('fs');var path=require(_0x32aa('0x5'));var rimraf=require(_0x32aa('0x6'));var config=require(_0x32aa('0x7'));var attributes=require(_0x32aa('0x8'));module[_0x32aa('0x9')]=function(_0x53ab98,_0x17346a){return _0x53ab98[_0x32aa('0xa')](_0x32aa('0xb'),attributes,{'tableName':_0x32aa('0xc'),'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 20f7bcc..2f06ef9 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 _0x995c=['catch','CreateSquareRecording','SquareRecording','create','body','options','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','stringify','error','SquareRecording,\x20%s,\x20%s','message','info','result'];(function(_0x48b5a2,_0x5014c7){var _0xc7f542=function(_0xa288f5){while(--_0xa288f5){_0x48b5a2['push'](_0x48b5a2['shift']());}};_0xc7f542(++_0x5014c7);}(_0x995c,0xd2));var _0xc995=function(_0x1daf90,_0xe9dcfa){_0x1daf90=_0x1daf90-0x0;var _0x18d544=_0x995c[_0x1daf90];return _0x18d544;};'use strict';var _=require(_0xc995('0x0'));var util=require(_0xc995('0x1'));var moment=require(_0xc995('0x2'));var BPromise=require(_0xc995('0x3'));var rs=require(_0xc995('0x4'));var fs=require('fs');var Redis=require(_0xc995('0x5'));var db=require(_0xc995('0x6'))['db'];var utils=require(_0xc995('0x7'));var logger=require(_0xc995('0x8'))('rpc');var config=require(_0xc995('0x9'));var jayson=require(_0xc995('0xa'));var client=jayson[_0xc995('0xb')][_0xc995('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x54f351,_0x3b7dac,_0x568d22){return new BPromise(function(_0x1bfbce,_0x1c0b22){return client[_0xc995('0xd')](_0x54f351,_0x568d22)['then'](function(_0x2eec2f){logger['info']('SquareRecording,\x20%s,\x20%s',_0x3b7dac,_0xc995('0xe'));logger[_0xc995('0xf')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x3b7dac,'request\x20sent',JSON[_0xc995('0x10')](_0x2eec2f));if(_0x2eec2f[_0xc995('0x11')]){if(_0x2eec2f['error']['code']===0x1f4){logger['error'](_0xc995('0x12'),_0x3b7dac,_0x2eec2f[_0xc995('0x11')][_0xc995('0x13')]);return _0x1c0b22(_0x2eec2f['error'][_0xc995('0x13')]);}logger['error'](_0xc995('0x12'),_0x3b7dac,_0x2eec2f[_0xc995('0x11')]['message']);return _0x1bfbce(_0x2eec2f['error']['message']);}else{logger[_0xc995('0x14')](_0xc995('0x12'),_0x3b7dac,_0xc995('0xe'));_0x1bfbce(_0x2eec2f[_0xc995('0x15')]['message']);}})[_0xc995('0x16')](function(_0x538cdb){logger[_0xc995('0x11')]('SquareRecording,\x20%s,\x20%s',_0x3b7dac,_0x538cdb);_0x1c0b22(_0x538cdb);});});}exports[_0xc995('0x17')]=function(_0x262f89){var _0x3dc47e=this;return new Promise(function(_0x21c0e1,_0x2cbf3e){return db[_0xc995('0x18')][_0xc995('0x19')](_0x262f89[_0xc995('0x1a')],{'raw':_0x262f89[_0xc995('0x1b')]?_0x262f89[_0xc995('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xc995('0x1c')](function(_0x3e5e54){logger[_0xc995('0x14')](_0xc995('0x17'),_0x262f89);logger['debug']('CreateSquareRecording',_0x262f89,JSON[_0xc995('0x10')](_0x3e5e54));_0x21c0e1(_0x3e5e54);})[_0xc995('0x16')](function(_0x1299db){logger[_0xc995('0x11')](_0xc995('0x17'),_0x1299db['message'],_0x262f89);_0x2cbf3e(_0x3dc47e[_0xc995('0x11')](0x1f4,_0x1299db[_0xc995('0x13')]));});});}; \ No newline at end of file +var _0x59e6=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','CreateSquareRecording','SquareRecording','create','body','options','info','catch','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x31b57a,_0x3dddf3){var _0x2df3dd=function(_0x394522){while(--_0x394522){_0x31b57a['push'](_0x31b57a['shift']());}};_0x2df3dd(++_0x3dddf3);}(_0x59e6,0x1f3));var _0x659e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x59e6[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x659e('0x0'));var util=require(_0x659e('0x1'));var moment=require(_0x659e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x659e('0x3'));var db=require(_0x659e('0x4'))['db'];var utils=require(_0x659e('0x5'));var logger=require('../../config/logger')(_0x659e('0x6'));var config=require(_0x659e('0x7'));var jayson=require(_0x659e('0x8'));var client=jayson[_0x659e('0x9')][_0x659e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x392f74,_0x2b5966,_0x488c40){return new BPromise(function(_0x5badf5,_0x5470ae){return client[_0x659e('0xb')](_0x392f74,_0x488c40)[_0x659e('0xc')](function(_0x303c94){logger['info']('SquareRecording,\x20%s,\x20%s',_0x2b5966,'request\x20sent');logger[_0x659e('0xd')](_0x659e('0xe'),_0x2b5966,_0x659e('0xf'),JSON[_0x659e('0x10')](_0x303c94));if(_0x303c94[_0x659e('0x11')]){if(_0x303c94['error'][_0x659e('0x12')]===0x1f4){logger[_0x659e('0x11')](_0x659e('0x13'),_0x2b5966,_0x303c94['error'][_0x659e('0x14')]);return _0x5470ae(_0x303c94[_0x659e('0x11')]['message']);}logger['error'](_0x659e('0x13'),_0x2b5966,_0x303c94[_0x659e('0x11')][_0x659e('0x14')]);return _0x5badf5(_0x303c94[_0x659e('0x11')][_0x659e('0x14')]);}else{logger['info'](_0x659e('0x13'),_0x2b5966,_0x659e('0xf'));_0x5badf5(_0x303c94['result'][_0x659e('0x14')]);}})['catch'](function(_0x5ed674){logger[_0x659e('0x11')](_0x659e('0x13'),_0x2b5966,_0x5ed674);_0x5470ae(_0x5ed674);});});}exports[_0x659e('0x15')]=function(_0x350551){var _0x3a31b=this;return new Promise(function(_0x3c5546,_0x3ee83e){return db[_0x659e('0x16')][_0x659e('0x17')](_0x350551[_0x659e('0x18')],{'raw':_0x350551[_0x659e('0x19')]?_0x350551[_0x659e('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2112e4){logger[_0x659e('0x1a')](_0x659e('0x15'),_0x350551);logger['debug'](_0x659e('0x15'),_0x350551,JSON[_0x659e('0x10')](_0x2112e4));_0x3c5546(_0x2112e4);})[_0x659e('0x1b')](function(_0x5d5512){logger[_0x659e('0x11')]('CreateSquareRecording',_0x5d5512['message'],_0x350551);_0x3ee83e(_0x3a31b[_0x659e('0x11')](0x1f4,_0x5d5512['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 8441988..4342629 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x96643c,_0x5e101c){var _0x359103=function(_0x216871){while(--_0x216871){_0x96643c['push'](_0x96643c['shift']());}};_0x359103(++_0x5e101c);}(_0xe706,0xa3));var _0x6e70=function(_0x34bfd8,_0x24eaa3){_0x34bfd8=_0x34bfd8-0x0;var _0x122c91=_0xe706[_0x34bfd8];return _0x122c91;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x10be3d,_0x3babee){var _0x3f623b=function(_0x376f5a){while(--_0x376f5a){_0x10be3d['push'](_0x10be3d['shift']());}};_0x3f623b(++_0x3babee);}(_0xe706,0xa3));var _0x6e70=function(_0xfd49ed,_0x1272e1){_0xfd49ed=_0xfd49ed-0x0;var _0x355f54=_0xe706[_0xfd49ed];return _0x355f54;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index fa670de..93d50b7 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 _0x7525=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x1098db,_0x39ba6b){var _0x14f090=function(_0x473ffe){while(--_0x473ffe){_0x1098db['push'](_0x1098db['shift']());}};_0x14f090(++_0x39ba6b);}(_0x7525,0x1a2));var _0x5752=function(_0x34e9da,_0xd22403){_0x34e9da=_0x34e9da-0x0;var _0x343289=_0x7525[_0x34e9da];return _0x343289;};'use strict';var Sequelize=require(_0x5752('0x0'));module[_0x5752('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x5752('0x2')]},'request':{'type':Sequelize[_0x5752('0x2')]},'channel':{'type':Sequelize[_0x5752('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5752('0x2')]},'uniqueid':{'type':Sequelize[_0x5752('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x5752('0x2')]},'calleridname':{'type':Sequelize[_0x5752('0x2')]},'callingpres':{'type':Sequelize[_0x5752('0x2')]},'callingani2':{'type':Sequelize[_0x5752('0x2')]},'callington':{'type':Sequelize[_0x5752('0x2')]},'callingtns':{'type':Sequelize[_0x5752('0x2')]},'dnid':{'type':Sequelize[_0x5752('0x2')]},'rdnis':{'type':Sequelize[_0x5752('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5752('0x2')]},'enhanced':{'type':Sequelize[_0x5752('0x2')]},'accountcode':{'type':Sequelize[_0x5752('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x5752('0x2')]},'joinAt':{'type':Sequelize[_0x5752('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x5752('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x9820=['DATE','BOOLEAN','sequelize','STRING'];(function(_0x4e90ef,_0x55e668){var _0x1fd07c=function(_0x17f7ee){while(--_0x17f7ee){_0x4e90ef['push'](_0x4e90ef['shift']());}};_0x1fd07c(++_0x55e668);}(_0x9820,0xb6));var _0x0982=function(_0x1490d3,_0x3f8039){_0x1490d3=_0x1490d3-0x0;var _0x1369f5=_0x9820[_0x1490d3];return _0x1369f5;};'use strict';var Sequelize=require(_0x0982('0x0'));module['exports']={'network':{'type':Sequelize[_0x0982('0x1')]},'network_script':{'type':Sequelize[_0x0982('0x1')]},'request':{'type':Sequelize[_0x0982('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0982('0x1')]},'uniqueid':{'type':Sequelize[_0x0982('0x1')]},'version':{'type':Sequelize[_0x0982('0x1')]},'callerid':{'type':Sequelize[_0x0982('0x1')]},'calleridname':{'type':Sequelize[_0x0982('0x1')]},'callingpres':{'type':Sequelize[_0x0982('0x1')]},'callingani2':{'type':Sequelize[_0x0982('0x1')]},'callington':{'type':Sequelize[_0x0982('0x1')]},'callingtns':{'type':Sequelize[_0x0982('0x1')]},'dnid':{'type':Sequelize[_0x0982('0x1')]},'rdnis':{'type':Sequelize[_0x0982('0x1')]},'context':{'type':Sequelize[_0x0982('0x1')]},'extension':{'type':Sequelize[_0x0982('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x0982('0x1')]},'accountcode':{'type':Sequelize[_0x0982('0x1')]},'threadid':{'type':Sequelize[_0x0982('0x1')]},'project_name':{'type':Sequelize[_0x0982('0x1')]},'joinAt':{'type':Sequelize[_0x0982('0x2')]},'leaveAt':{'type':Sequelize[_0x0982('0x2')]},'bot':{'type':Sequelize[_0x0982('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 e87d6a2..09c1941 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 _0x9159=['create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','SquareReport','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','map','VIRTUAL','merge','options','count','includeAll','include','findAll','params','keys','find','catch'];(function(_0x493ace,_0x56830c){var _0x2bebe9=function(_0x468553){while(--_0x468553){_0x493ace['push'](_0x493ace['shift']());}};_0x2bebe9(++_0x56830c);}(_0x9159,0x1ba));var _0x9915=function(_0xca04ff,_0xcb449f){_0xca04ff=_0xca04ff-0x0;var _0x6b547=_0x9159[_0xca04ff];return _0x6b547;};'use strict';var emlformat=require(_0x9915('0x0'));var rimraf=require(_0x9915('0x1'));var zipdir=require(_0x9915('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9915('0x3'));var moment=require(_0x9915('0x4'));var BPromise=require(_0x9915('0x5'));var Mustache=require('mustache');var util=require(_0x9915('0x6'));var path=require(_0x9915('0x7'));var sox=require('sox');var csv=require(_0x9915('0x8'));var ejs=require(_0x9915('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9915('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9915('0xb'));var toCsv=require(_0x9915('0x8'));var querystring=require('querystring');var Papa=require(_0x9915('0xc'));var Redis=require(_0x9915('0xd'));var authService=require(_0x9915('0xe'));var qs=require(_0x9915('0xf'));var as=require(_0x9915('0x10'));var hardwareService=require(_0x9915('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x9915('0x12'));var config=require(_0x9915('0x13'));var licenseUtil=require(_0x9915('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbb0dd0,_0x425af3){_0x425af3=_0x425af3||0xcc;return function(_0x5a4d9a){if(_0x5a4d9a){return _0xbb0dd0['sendStatus'](_0x425af3);}return _0xbb0dd0[_0x9915('0x15')](_0x425af3)[_0x9915('0x16')]();};}function respondWithResult(_0xe8fc3,_0x4f8f2c){_0x4f8f2c=_0x4f8f2c||0xc8;return function(_0x2ec0fa){if(_0x2ec0fa){return _0xe8fc3[_0x9915('0x15')](_0x4f8f2c)[_0x9915('0x17')](_0x2ec0fa);}};}function respondWithFilteredResult(_0x41cdd7,_0x28a65e){return function(_0x4f954e){if(_0x4f954e){var _0x35d70f=typeof _0x28a65e[_0x9915('0x18')]===_0x9915('0x19')&&typeof _0x28a65e[_0x9915('0x1a')]===_0x9915('0x19');var _0x320cc7=_0x4f954e['count'];var _0x5e3d39=_0x35d70f?0x0:_0x28a65e[_0x9915('0x18')];var _0x54c578=_0x35d70f?_0x4f954e['count']:_0x28a65e[_0x9915('0x18')]+_0x28a65e[_0x9915('0x1a')];var _0x280f5a;if(_0x54c578>=_0x320cc7){_0x54c578=_0x320cc7;_0x280f5a=0xc8;}else{_0x280f5a=0xce;}_0x41cdd7[_0x9915('0x15')](_0x280f5a);return _0x41cdd7[_0x9915('0x1b')](_0x9915('0x1c'),_0x5e3d39+'-'+_0x54c578+'/'+_0x320cc7)[_0x9915('0x17')](_0x4f954e);}return null;};}function patchUpdates(_0x2d0f61){return function(_0x462ffe){try{jsonpatch[_0x9915('0x1d')](_0x462ffe,_0x2d0f61,!![]);}catch(_0x499599){return BPromise[_0x9915('0x1e')](_0x499599);}return _0x462ffe['save']();};}function saveUpdates(_0x1eabde,_0x121783){return function(_0x16460f){if(_0x16460f){return _0x16460f[_0x9915('0x1f')](_0x1eabde)[_0x9915('0x20')](function(_0x1cc00f){return _0x1cc00f;});}return null;};}function removeEntity(_0x292e5d,_0x173801){return function(_0x1deccc){if(_0x1deccc){return _0x1deccc['destroy']()[_0x9915('0x20')](function(){_0x292e5d['status'](0xcc)[_0x9915('0x16')]();});}};}function handleEntityNotFound(_0x1ad0b8,_0x368104){return function(_0x50fb18){if(!_0x50fb18){_0x1ad0b8['sendStatus'](0x194);}return _0x50fb18;};}function handleError(_0x4aab31,_0x39176a){_0x39176a=_0x39176a||0x1f4;return function(_0x6a90fd){logger[_0x9915('0x21')](_0x6a90fd[_0x9915('0x22')]);if(_0x6a90fd[_0x9915('0x23')]){delete _0x6a90fd[_0x9915('0x23')];}_0x4aab31[_0x9915('0x15')](_0x39176a)[_0x9915('0x24')](_0x6a90fd);};}exports[_0x9915('0x25')]=function(_0x46dc88,_0x5332b1){var _0x59ae26={},_0xdbedbc={},_0x25da16={'count':0x0,'rows':[]};var _0x3d6bfd=_['map'](db[_0x9915('0x26')][_0x9915('0x27')],function(_0x165796){return{'name':_0x165796[_0x9915('0x28')],'type':_0x165796[_0x9915('0x29')][_0x9915('0x2a')]};});_0xdbedbc['model']=_['map'](_0x3d6bfd,'name');_0xdbedbc[_0x9915('0x2b')]=_['keys'](_0x46dc88['query']);_0xdbedbc[_0x9915('0x2c')]=_[_0x9915('0x2d')](_0xdbedbc['model'],_0xdbedbc[_0x9915('0x2b')]);_0x59ae26[_0x9915('0x2e')]=_[_0x9915('0x2d')](_0xdbedbc[_0x9915('0x2f')],qs[_0x9915('0x30')](_0x46dc88[_0x9915('0x2b')][_0x9915('0x30')]));_0x59ae26[_0x9915('0x2e')]=_0x59ae26[_0x9915('0x2e')][_0x9915('0x31')]?_0x59ae26[_0x9915('0x2e')]:_0xdbedbc[_0x9915('0x2f')];if(!_0x46dc88['query'][_0x9915('0x32')](_0x9915('0x33'))){_0x59ae26[_0x9915('0x1a')]=qs['limit'](_0x46dc88['query'][_0x9915('0x1a')]);_0x59ae26[_0x9915('0x18')]=qs[_0x9915('0x18')](_0x46dc88['query']['offset']);}_0x59ae26[_0x9915('0x34')]=qs[_0x9915('0x35')](_0x46dc88[_0x9915('0x2b')][_0x9915('0x35')]);_0x59ae26['where']=qs['filters'](_[_0x9915('0x36')](_0x46dc88[_0x9915('0x2b')],_0xdbedbc[_0x9915('0x2c')]),_0x3d6bfd);if(_0x46dc88['query'][_0x9915('0x37')]){_0x59ae26[_0x9915('0x38')]=_['merge'](_0x59ae26[_0x9915('0x38')],{'$or':_[_0x9915('0x39')](_0x3d6bfd,function(_0x11ecc9){if(_0x11ecc9[_0x9915('0x29')]!==_0x9915('0x3a')){var _0x5d2812={};_0x5d2812[_0x11ecc9[_0x9915('0x23')]]={'$like':'%'+_0x46dc88[_0x9915('0x2b')][_0x9915('0x37')]+'%'};return _0x5d2812;}})});}_0x59ae26=_[_0x9915('0x3b')]({},_0x59ae26,_0x46dc88[_0x9915('0x3c')]);var _0x5a3a99={'where':_0x59ae26['where']};return db[_0x9915('0x26')]['count'](_0x5a3a99)[_0x9915('0x20')](function(_0x126551){_0x25da16[_0x9915('0x3d')]=_0x126551;if(_0x46dc88[_0x9915('0x2b')][_0x9915('0x3e')]){_0x59ae26[_0x9915('0x3f')]=[{'all':!![]}];}return db[_0x9915('0x26')][_0x9915('0x40')](_0x59ae26);})[_0x9915('0x20')](function(_0x5c1a12){_0x25da16['rows']=_0x5c1a12;return _0x25da16;})[_0x9915('0x20')](respondWithFilteredResult(_0x5332b1,_0x59ae26))['catch'](handleError(_0x5332b1,null));};exports['show']=function(_0x4b9625,_0x1879ad){var _0x43c85d={'raw':!![],'where':{'id':_0x4b9625[_0x9915('0x41')]['id']}},_0x25cfb6={};_0x25cfb6[_0x9915('0x2f')]=_[_0x9915('0x42')](db[_0x9915('0x26')][_0x9915('0x27')]);_0x25cfb6[_0x9915('0x2b')]=_['keys'](_0x4b9625[_0x9915('0x2b')]);_0x25cfb6[_0x9915('0x2c')]=_['intersection'](_0x25cfb6[_0x9915('0x2f')],_0x25cfb6[_0x9915('0x2b')]);_0x43c85d[_0x9915('0x2e')]=_['intersection'](_0x25cfb6[_0x9915('0x2f')],qs[_0x9915('0x30')](_0x4b9625['query']['fields']));_0x43c85d[_0x9915('0x2e')]=_0x43c85d[_0x9915('0x2e')][_0x9915('0x31')]?_0x43c85d[_0x9915('0x2e')]:_0x25cfb6[_0x9915('0x2f')];if(_0x4b9625[_0x9915('0x2b')][_0x9915('0x3e')]){_0x43c85d[_0x9915('0x3f')]=[{'all':!![]}];}_0x43c85d=_[_0x9915('0x3b')]({},_0x43c85d,_0x4b9625[_0x9915('0x3c')]);return db[_0x9915('0x26')][_0x9915('0x43')](_0x43c85d)[_0x9915('0x20')](handleEntityNotFound(_0x1879ad,null))[_0x9915('0x20')](respondWithResult(_0x1879ad,null))[_0x9915('0x44')](handleError(_0x1879ad,null));};exports[_0x9915('0x45')]=function(_0xcc0a31,_0x307093){return db[_0x9915('0x26')][_0x9915('0x45')](_0xcc0a31[_0x9915('0x46')],{})[_0x9915('0x20')](respondWithResult(_0x307093,0xc9))[_0x9915('0x44')](handleError(_0x307093,null));};exports[_0x9915('0x1f')]=function(_0x291686,_0x4ac1c3){if(_0x291686[_0x9915('0x46')]['id']){delete _0x291686[_0x9915('0x46')]['id'];}return db[_0x9915('0x26')][_0x9915('0x43')]({'where':{'id':_0x291686[_0x9915('0x41')]['id']}})['then'](handleEntityNotFound(_0x4ac1c3,null))[_0x9915('0x20')](saveUpdates(_0x291686['body'],null))['then'](respondWithResult(_0x4ac1c3,null))[_0x9915('0x44')](handleError(_0x4ac1c3,null));};exports[_0x9915('0x47')]=function(_0x1f948b,_0x3491b4){return db['SquareReport'][_0x9915('0x43')]({'where':{'id':_0x1f948b[_0x9915('0x41')]['id']}})[_0x9915('0x20')](handleEntityNotFound(_0x3491b4,null))[_0x9915('0x20')](removeEntity(_0x3491b4,null))[_0x9915('0x44')](handleError(_0x3491b4,null));};exports['describe']=function(_0x391db4,_0x29887b){return db[_0x9915('0x26')][_0x9915('0x48')]()[_0x9915('0x20')](respondWithResult(_0x29887b,null))[_0x9915('0x44')](handleError(_0x29887b,null));}; \ No newline at end of file +var _0x5efe=['model','map','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','catch','show','params','keys','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','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','save','update','destroy','then','end','stack','name','send','index','SquareReport','rawAttributes','type','key'];(function(_0x227f92,_0x3ac589){var _0x4ae01e=function(_0x391c8e){while(--_0x391c8e){_0x227f92['push'](_0x227f92['shift']());}};_0x4ae01e(++_0x3ac589);}(_0x5efe,0xb0));var _0xe5ef=function(_0xc8155a,_0x131c58){_0xc8155a=_0xc8155a-0x0;var _0x110993=_0x5efe[_0xc8155a];return _0x110993;};'use strict';var emlformat=require(_0xe5ef('0x0'));var rimraf=require(_0xe5ef('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe5ef('0x2'));var rp=require(_0xe5ef('0x3'));var moment=require(_0xe5ef('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe5ef('0x5'));var util=require(_0xe5ef('0x6'));var path=require(_0xe5ef('0x7'));var sox=require(_0xe5ef('0x8'));var csv=require(_0xe5ef('0x9'));var ejs=require(_0xe5ef('0xa'));var fs=require('fs');var fs_extra=require(_0xe5ef('0xb'));var _=require(_0xe5ef('0xc'));var squel=require(_0xe5ef('0xd'));var crypto=require(_0xe5ef('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe5ef('0xf'));var toCsv=require(_0xe5ef('0x9'));var querystring=require(_0xe5ef('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe5ef('0x11'));var qs=require(_0xe5ef('0x12'));var as=require(_0xe5ef('0x13'));var hardwareService=require(_0xe5ef('0x14'));var logger=require(_0xe5ef('0x15'))(_0xe5ef('0x16'));var utils=require(_0xe5ef('0x17'));var config=require(_0xe5ef('0x18'));var licenseUtil=require(_0xe5ef('0x19'));var db=require(_0xe5ef('0x1a'))['db'];function respondWithStatusCode(_0x191480,_0x2df96f){_0x2df96f=_0x2df96f||0xcc;return function(_0xe3ee01){if(_0xe3ee01){return _0x191480[_0xe5ef('0x1b')](_0x2df96f);}return _0x191480[_0xe5ef('0x1c')](_0x2df96f)['end']();};}function respondWithResult(_0x3ad534,_0x20e21f){_0x20e21f=_0x20e21f||0xc8;return function(_0x4239ec){if(_0x4239ec){return _0x3ad534[_0xe5ef('0x1c')](_0x20e21f)['json'](_0x4239ec);}};}function respondWithFilteredResult(_0x4520c7,_0x2e98e6){return function(_0x357ef2){if(_0x357ef2){var _0x2e5209=typeof _0x2e98e6[_0xe5ef('0x1d')]===_0xe5ef('0x1e')&&typeof _0x2e98e6[_0xe5ef('0x1f')]===_0xe5ef('0x1e');var _0x5cf404=_0x357ef2[_0xe5ef('0x20')];var _0x59de1d=_0x2e5209?0x0:_0x2e98e6[_0xe5ef('0x1d')];var _0x635218=_0x2e5209?_0x357ef2[_0xe5ef('0x20')]:_0x2e98e6['offset']+_0x2e98e6[_0xe5ef('0x1f')];var _0x3360e2;if(_0x635218>=_0x5cf404){_0x635218=_0x5cf404;_0x3360e2=0xc8;}else{_0x3360e2=0xce;}_0x4520c7[_0xe5ef('0x1c')](_0x3360e2);return _0x4520c7['set'](_0xe5ef('0x21'),_0x59de1d+'-'+_0x635218+'/'+_0x5cf404)[_0xe5ef('0x22')](_0x357ef2);}return null;};}function patchUpdates(_0x2c755b){return function(_0x6f41e4){try{jsonpatch[_0xe5ef('0x23')](_0x6f41e4,_0x2c755b,!![]);}catch(_0x74ccd1){return BPromise['reject'](_0x74ccd1);}return _0x6f41e4[_0xe5ef('0x24')]();};}function saveUpdates(_0x71fd51,_0x2c4bbf){return function(_0x5a2284){if(_0x5a2284){return _0x5a2284[_0xe5ef('0x25')](_0x71fd51)['then'](function(_0x5b004d){return _0x5b004d;});}return null;};}function removeEntity(_0x96c88d,_0x31ec02){return function(_0xb6cf60){if(_0xb6cf60){return _0xb6cf60[_0xe5ef('0x26')]()[_0xe5ef('0x27')](function(){_0x96c88d[_0xe5ef('0x1c')](0xcc)[_0xe5ef('0x28')]();});}};}function handleEntityNotFound(_0x649020,_0x1071eb){return function(_0x1bdbcf){if(!_0x1bdbcf){_0x649020[_0xe5ef('0x1b')](0x194);}return _0x1bdbcf;};}function handleError(_0x5dc634,_0x10dbce){_0x10dbce=_0x10dbce||0x1f4;return function(_0x33aa56){logger['error'](_0x33aa56[_0xe5ef('0x29')]);if(_0x33aa56[_0xe5ef('0x2a')]){delete _0x33aa56['name'];}_0x5dc634['status'](_0x10dbce)[_0xe5ef('0x2b')](_0x33aa56);};}exports[_0xe5ef('0x2c')]=function(_0x18a4e4,_0xbc4347){var _0xf5542b={},_0x1b298a={},_0xd9bad4={'count':0x0,'rows':[]};var _0x37bebd=_['map'](db[_0xe5ef('0x2d')][_0xe5ef('0x2e')],function(_0x2b5b9a){return{'name':_0x2b5b9a['fieldName'],'type':_0x2b5b9a[_0xe5ef('0x2f')][_0xe5ef('0x30')]};});_0x1b298a[_0xe5ef('0x31')]=_[_0xe5ef('0x32')](_0x37bebd,_0xe5ef('0x2a'));_0x1b298a['query']=_['keys'](_0x18a4e4[_0xe5ef('0x33')]);_0x1b298a['filters']=_[_0xe5ef('0x34')](_0x1b298a[_0xe5ef('0x31')],_0x1b298a[_0xe5ef('0x33')]);_0xf5542b[_0xe5ef('0x35')]=_[_0xe5ef('0x34')](_0x1b298a[_0xe5ef('0x31')],qs[_0xe5ef('0x36')](_0x18a4e4[_0xe5ef('0x33')][_0xe5ef('0x36')]));_0xf5542b[_0xe5ef('0x35')]=_0xf5542b['attributes'][_0xe5ef('0x37')]?_0xf5542b[_0xe5ef('0x35')]:_0x1b298a[_0xe5ef('0x31')];if(!_0x18a4e4['query'][_0xe5ef('0x38')]('nolimit')){_0xf5542b[_0xe5ef('0x1f')]=qs[_0xe5ef('0x1f')](_0x18a4e4['query'][_0xe5ef('0x1f')]);_0xf5542b['offset']=qs[_0xe5ef('0x1d')](_0x18a4e4[_0xe5ef('0x33')][_0xe5ef('0x1d')]);}_0xf5542b[_0xe5ef('0x39')]=qs[_0xe5ef('0x3a')](_0x18a4e4[_0xe5ef('0x33')][_0xe5ef('0x3a')]);_0xf5542b[_0xe5ef('0x3b')]=qs[_0xe5ef('0x3c')](_[_0xe5ef('0x3d')](_0x18a4e4['query'],_0x1b298a['filters']),_0x37bebd);if(_0x18a4e4[_0xe5ef('0x33')][_0xe5ef('0x3e')]){_0xf5542b[_0xe5ef('0x3b')]=_['merge'](_0xf5542b[_0xe5ef('0x3b')],{'$or':_[_0xe5ef('0x32')](_0x37bebd,function(_0x3234ba){if(_0x3234ba['type']!=='VIRTUAL'){var _0x57801c={};_0x57801c[_0x3234ba['name']]={'$like':'%'+_0x18a4e4[_0xe5ef('0x33')]['filter']+'%'};return _0x57801c;}})});}_0xf5542b=_[_0xe5ef('0x3f')]({},_0xf5542b,_0x18a4e4[_0xe5ef('0x40')]);var _0x1e10c5={'where':_0xf5542b[_0xe5ef('0x3b')]};return db[_0xe5ef('0x2d')][_0xe5ef('0x20')](_0x1e10c5)[_0xe5ef('0x27')](function(_0x41ef38){_0xd9bad4[_0xe5ef('0x20')]=_0x41ef38;if(_0x18a4e4[_0xe5ef('0x33')][_0xe5ef('0x41')]){_0xf5542b['include']=[{'all':!![]}];}return db[_0xe5ef('0x2d')][_0xe5ef('0x42')](_0xf5542b);})[_0xe5ef('0x27')](function(_0x42a59a){_0xd9bad4['rows']=_0x42a59a;return _0xd9bad4;})['then'](respondWithFilteredResult(_0xbc4347,_0xf5542b))[_0xe5ef('0x43')](handleError(_0xbc4347,null));};exports[_0xe5ef('0x44')]=function(_0x35a7e2,_0x45fc24){var _0x53d88d={'raw':!![],'where':{'id':_0x35a7e2[_0xe5ef('0x45')]['id']}},_0xd3be29={};_0xd3be29[_0xe5ef('0x31')]=_[_0xe5ef('0x46')](db[_0xe5ef('0x2d')][_0xe5ef('0x2e')]);_0xd3be29[_0xe5ef('0x33')]=_['keys'](_0x35a7e2[_0xe5ef('0x33')]);_0xd3be29[_0xe5ef('0x3c')]=_[_0xe5ef('0x34')](_0xd3be29['model'],_0xd3be29['query']);_0x53d88d[_0xe5ef('0x35')]=_[_0xe5ef('0x34')](_0xd3be29[_0xe5ef('0x31')],qs[_0xe5ef('0x36')](_0x35a7e2[_0xe5ef('0x33')][_0xe5ef('0x36')]));_0x53d88d[_0xe5ef('0x35')]=_0x53d88d[_0xe5ef('0x35')][_0xe5ef('0x37')]?_0x53d88d['attributes']:_0xd3be29[_0xe5ef('0x31')];if(_0x35a7e2[_0xe5ef('0x33')][_0xe5ef('0x41')]){_0x53d88d['include']=[{'all':!![]}];}_0x53d88d=_[_0xe5ef('0x3f')]({},_0x53d88d,_0x35a7e2['options']);return db[_0xe5ef('0x2d')]['find'](_0x53d88d)[_0xe5ef('0x27')](handleEntityNotFound(_0x45fc24,null))['then'](respondWithResult(_0x45fc24,null))['catch'](handleError(_0x45fc24,null));};exports[_0xe5ef('0x47')]=function(_0x15c75b,_0x42feea){return db['SquareReport']['create'](_0x15c75b[_0xe5ef('0x48')],{})[_0xe5ef('0x27')](respondWithResult(_0x42feea,0xc9))[_0xe5ef('0x43')](handleError(_0x42feea,null));};exports[_0xe5ef('0x25')]=function(_0x514d85,_0x46ab2f){if(_0x514d85['body']['id']){delete _0x514d85[_0xe5ef('0x48')]['id'];}return db['SquareReport'][_0xe5ef('0x49')]({'where':{'id':_0x514d85['params']['id']}})[_0xe5ef('0x27')](handleEntityNotFound(_0x46ab2f,null))['then'](saveUpdates(_0x514d85[_0xe5ef('0x48')],null))[_0xe5ef('0x27')](respondWithResult(_0x46ab2f,null))['catch'](handleError(_0x46ab2f,null));};exports[_0xe5ef('0x26')]=function(_0x528e25,_0x2ed3eb){return db[_0xe5ef('0x2d')][_0xe5ef('0x49')]({'where':{'id':_0x528e25[_0xe5ef('0x45')]['id']}})[_0xe5ef('0x27')](handleEntityNotFound(_0x2ed3eb,null))['then'](removeEntity(_0x2ed3eb,null))['catch'](handleError(_0x2ed3eb,null));};exports[_0xe5ef('0x4a')]=function(_0x1da5b8,_0xb842c8){return db[_0xe5ef('0x2d')][_0xe5ef('0x4a')]()['then'](respondWithResult(_0xb842c8,null))[_0xe5ef('0x43')](handleError(_0xb842c8,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 34c67bf..ac7c994 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 _0xfd4d=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname'];(function(_0x436c38,_0x1b41bc){var _0x448768=function(_0xa17c59){while(--_0xa17c59){_0x436c38['push'](_0x436c38['shift']());}};_0x448768(++_0x1b41bc);}(_0xfd4d,0x1dc));var _0xdfd4=function(_0x5d4317,_0x175caf){_0x5d4317=_0x5d4317-0x0;var _0x42e674=_0xfd4d[_0x5d4317];return _0x42e674;};'use strict';var _=require(_0xdfd4('0x0'));var util=require('util');var logger=require(_0xdfd4('0x1'))(_0xdfd4('0x2'));var moment=require(_0xdfd4('0x3'));var BPromise=require('bluebird');var rp=require(_0xdfd4('0x4'));var fs=require('fs');var path=require(_0xdfd4('0x5'));var rimraf=require(_0xdfd4('0x6'));var config=require(_0xdfd4('0x7'));var attributes=require(_0xdfd4('0x8'));module[_0xdfd4('0x9')]=function(_0x1ba529,_0x3cd97b){return _0x1ba529[_0xdfd4('0xa')](_0xdfd4('0xb'),attributes,{'tableName':_0xdfd4('0xc'),'paranoid':![],'indexes':[{'name':_0xdfd4('0xd'),'fields':['uniqueid','project_name']},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0xec2a=['project_name','leaveAt','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','report_square','uid_pname'];(function(_0x1bab1f,_0x1b51e8){var _0xeb960=function(_0x3199a6){while(--_0x3199a6){_0x1bab1f['push'](_0x1bab1f['shift']());}};_0xeb960(++_0x1b51e8);}(_0xec2a,0xd4));var _0xaec2=function(_0x4f1749,_0x998e73){_0x4f1749=_0x4f1749-0x0;var _0x9a9ab3=_0xec2a[_0x4f1749];return _0x9a9ab3;};'use strict';var _=require(_0xaec2('0x0'));var util=require('util');var logger=require(_0xaec2('0x1'))('api');var moment=require(_0xaec2('0x2'));var BPromise=require(_0xaec2('0x3'));var rp=require(_0xaec2('0x4'));var fs=require('fs');var path=require(_0xaec2('0x5'));var rimraf=require(_0xaec2('0x6'));var config=require(_0xaec2('0x7'));var attributes=require('./squareReport.attributes');module[_0xaec2('0x8')]=function(_0x20d0fb,_0x5638d2){return _0x20d0fb[_0xaec2('0x9')]('SquareReport',attributes,{'tableName':_0xaec2('0xa'),'paranoid':![],'indexes':[{'name':_0xaec2('0xb'),'fields':['uniqueid',_0xaec2('0xc')]},{'name':_0xaec2('0xd'),'fields':[_0xaec2('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 fe172a0..c7d1a46 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 _0x445a=['debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','UpdateSquareReport','where','attributes','limit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x445a,0x18d));var _0xa445=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x445a[_0x432682];return _0x463d05;};'use strict';var _=require(_0xa445('0x0'));var util=require(_0xa445('0x1'));var moment=require(_0xa445('0x2'));var BPromise=require(_0xa445('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa445('0x4'));var db=require(_0xa445('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa445('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa445('0x7'));var client=jayson[_0xa445('0x8')][_0xa445('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4bee35,_0x1e2a2c,_0xd041cb){return new BPromise(function(_0x3a19f8,_0x46f219){return client[_0xa445('0xa')](_0x4bee35,_0xd041cb)[_0xa445('0xb')](function(_0xaad3ea){logger[_0xa445('0xc')](_0xa445('0xd'),_0x1e2a2c,_0xa445('0xe'));logger['debug'](_0xa445('0xf'),_0x1e2a2c,_0xa445('0xe'),JSON[_0xa445('0x10')](_0xaad3ea));if(_0xaad3ea[_0xa445('0x11')]){if(_0xaad3ea[_0xa445('0x11')][_0xa445('0x12')]===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0x1e2a2c,_0xaad3ea[_0xa445('0x11')][_0xa445('0x13')]);return _0x46f219(_0xaad3ea[_0xa445('0x11')][_0xa445('0x13')]);}logger[_0xa445('0x11')]('SquareReport,\x20%s,\x20%s',_0x1e2a2c,_0xaad3ea[_0xa445('0x11')]['message']);return _0x3a19f8(_0xaad3ea[_0xa445('0x11')][_0xa445('0x13')]);}else{logger['info'](_0xa445('0xd'),_0x1e2a2c,'request\x20sent');_0x3a19f8(_0xaad3ea[_0xa445('0x14')][_0xa445('0x13')]);}})[_0xa445('0x15')](function(_0x1866c5){logger['error']('SquareReport,\x20%s,\x20%s',_0x1e2a2c,_0x1866c5);_0x46f219(_0x1866c5);});});}exports[_0xa445('0x16')]=function(_0xb8b538){var _0x44de1c=this;return new Promise(function(_0x295844,_0x43c07d){return db[_0xa445('0x17')][_0xa445('0x18')](_0xb8b538[_0xa445('0x19')],{'raw':_0xb8b538[_0xa445('0x1a')]?_0xb8b538['options'][_0xa445('0x1b')]===undefined?!![]:![]:!![]})[_0xa445('0xb')](function(_0x393e0f){logger[_0xa445('0xc')](_0xa445('0x16'),_0xb8b538);logger['debug'](_0xa445('0x16'),_0xb8b538,JSON[_0xa445('0x10')](_0x393e0f));_0x295844(_0x393e0f);})[_0xa445('0x15')](function(_0x1e7e7d){logger[_0xa445('0x11')]('CreateSquareReport',_0x1e7e7d[_0xa445('0x13')],_0xb8b538);_0x43c07d(_0x44de1c['error'](0x1f4,_0x1e7e7d[_0xa445('0x13')]));});});};exports[_0xa445('0x1c')]=function(_0x57bf11){var _0x5537e2=this;return new Promise(function(_0x43b59c,_0x5dd94a){return db[_0xa445('0x17')]['update'](_0x57bf11['body'],{'raw':_0x57bf11[_0xa445('0x1a')]?_0x57bf11['options'][_0xa445('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57bf11['options']?_0x57bf11[_0xa445('0x1a')][_0xa445('0x1d')]||null:null,'attributes':_0x57bf11[_0xa445('0x1a')]?_0x57bf11[_0xa445('0x1a')][_0xa445('0x1e')]||null:null,'limit':_0x57bf11[_0xa445('0x1a')]?_0x57bf11['options'][_0xa445('0x1f')]||null:null})[_0xa445('0xb')](function(_0x156e17){logger['info'](_0xa445('0x1c'),_0x57bf11);logger[_0xa445('0x20')](_0xa445('0x1c'),_0x57bf11,JSON[_0xa445('0x10')](_0x156e17));_0x43b59c(_0x156e17);})[_0xa445('0x15')](function(_0x353983){logger[_0xa445('0x11')]('UpdateSquareReport',_0x353983[_0xa445('0x13')],_0x57bf11);_0x5dd94a(_0x5537e2[_0xa445('0x11')](0x1f4,_0x353983[_0xa445('0x13')]));});});}; \ No newline at end of file +var _0xe7d7=['update','where','attributes','lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','then','SquareReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','CreateSquareReport','SquareReport','create','body','options','raw','debug','catch','UpdateSquareReport'];(function(_0x1ce4ed,_0xec09fa){var _0x5ba558=function(_0x1a4c08){while(--_0x1a4c08){_0x1ce4ed['push'](_0x1ce4ed['shift']());}};_0x5ba558(++_0xec09fa);}(_0xe7d7,0xeb));var _0x7e7d=function(_0x231059,_0x3d24bc){_0x231059=_0x231059-0x0;var _0x3cd6e0=_0xe7d7[_0x231059];return _0x3cd6e0;};'use strict';var _=require(_0x7e7d('0x0'));var util=require(_0x7e7d('0x1'));var moment=require(_0x7e7d('0x2'));var BPromise=require('bluebird');var rs=require(_0x7e7d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7e7d('0x4'));var logger=require(_0x7e7d('0x5'))('rpc');var config=require(_0x7e7d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7e7d('0x7')][_0x7e7d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5acebc,_0x357727,_0xe9734d){return new BPromise(function(_0x4c0bab,_0x2d20b9){return client['request'](_0x5acebc,_0xe9734d)[_0x7e7d('0x9')](function(_0x2e1826){logger['info'](_0x7e7d('0xa'),_0x357727,_0x7e7d('0xb'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x357727,_0x7e7d('0xb'),JSON[_0x7e7d('0xc')](_0x2e1826));if(_0x2e1826[_0x7e7d('0xd')]){if(_0x2e1826[_0x7e7d('0xd')]['code']===0x1f4){logger['error'](_0x7e7d('0xa'),_0x357727,_0x2e1826[_0x7e7d('0xd')][_0x7e7d('0xe')]);return _0x2d20b9(_0x2e1826[_0x7e7d('0xd')][_0x7e7d('0xe')]);}logger['error'](_0x7e7d('0xa'),_0x357727,_0x2e1826[_0x7e7d('0xd')]['message']);return _0x4c0bab(_0x2e1826['error'][_0x7e7d('0xe')]);}else{logger[_0x7e7d('0xf')](_0x7e7d('0xa'),_0x357727,_0x7e7d('0xb'));_0x4c0bab(_0x2e1826[_0x7e7d('0x10')]['message']);}})['catch'](function(_0x260efb){logger['error'](_0x7e7d('0xa'),_0x357727,_0x260efb);_0x2d20b9(_0x260efb);});});}exports[_0x7e7d('0x11')]=function(_0x123ecd){var _0xd57e94=this;return new Promise(function(_0x249839,_0x4efe68){return db[_0x7e7d('0x12')][_0x7e7d('0x13')](_0x123ecd[_0x7e7d('0x14')],{'raw':_0x123ecd[_0x7e7d('0x15')]?_0x123ecd[_0x7e7d('0x15')][_0x7e7d('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x2d5996){logger[_0x7e7d('0xf')](_0x7e7d('0x11'),_0x123ecd);logger[_0x7e7d('0x17')](_0x7e7d('0x11'),_0x123ecd,JSON['stringify'](_0x2d5996));_0x249839(_0x2d5996);})[_0x7e7d('0x18')](function(_0x2b9e3d){logger[_0x7e7d('0xd')](_0x7e7d('0x11'),_0x2b9e3d[_0x7e7d('0xe')],_0x123ecd);_0x4efe68(_0xd57e94[_0x7e7d('0xd')](0x1f4,_0x2b9e3d[_0x7e7d('0xe')]));});});};exports[_0x7e7d('0x19')]=function(_0x2a0210){var _0xcabca2=this;return new Promise(function(_0x4b1044,_0x3267de){return db[_0x7e7d('0x12')][_0x7e7d('0x1a')](_0x2a0210['body'],{'raw':_0x2a0210[_0x7e7d('0x15')]?_0x2a0210[_0x7e7d('0x15')][_0x7e7d('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a0210[_0x7e7d('0x15')]?_0x2a0210[_0x7e7d('0x15')][_0x7e7d('0x1b')]||null:null,'attributes':_0x2a0210[_0x7e7d('0x15')]?_0x2a0210[_0x7e7d('0x15')][_0x7e7d('0x1c')]||null:null,'limit':_0x2a0210[_0x7e7d('0x15')]?_0x2a0210[_0x7e7d('0x15')]['limit']||null:null})[_0x7e7d('0x9')](function(_0x38852e){logger[_0x7e7d('0xf')](_0x7e7d('0x19'),_0x2a0210);logger['debug']('UpdateSquareReport',_0x2a0210,JSON[_0x7e7d('0xc')](_0x38852e));_0x4b1044(_0x38852e);})[_0x7e7d('0x18')](function(_0x22f5a4){logger[_0x7e7d('0xd')]('UpdateSquareReport',_0x22f5a4[_0x7e7d('0xe')],_0x2a0210);_0x3267de(_0xcabca2['error'](0x1f4,_0x22f5a4[_0x7e7d('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index ef040a6..536314a 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 _0x4b63=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports'];(function(_0x102039,_0xc5e588){var _0x43388d=function(_0x4c5790){while(--_0x4c5790){_0x102039['push'](_0x102039['shift']());}};_0x43388d(++_0xc5e588);}(_0x4b63,0x143));var _0x34b6=function(_0x8f47ba,_0x512d97){_0x8f47ba=_0x8f47ba-0x0;var _0x36918c=_0x4b63[_0x8f47ba];return _0x36918c;};'use strict';var multer=require(_0x34b6('0x0'));var util=require('util');var path=require(_0x34b6('0x1'));var timeout=require(_0x34b6('0x2'));var express=require('express');var router=express[_0x34b6('0x3')]();var fs_extra=require(_0x34b6('0x4'));var auth=require(_0x34b6('0x5'));var interaction=require(_0x34b6('0x6'));var config=require(_0x34b6('0x7'));var controller=require(_0x34b6('0x8'));router['get']('/',auth[_0x34b6('0x9')](),controller[_0x34b6('0xa')]);router['get']('/describe',auth[_0x34b6('0x9')](),controller['describe']);router['get'](_0x34b6('0xb'),auth[_0x34b6('0x9')](),controller[_0x34b6('0xc')]);router[_0x34b6('0xd')]('/',auth[_0x34b6('0x9')](),controller['create']);router[_0x34b6('0xe')](_0x34b6('0xb'),auth[_0x34b6('0x9')](),controller[_0x34b6('0xf')]);router[_0x34b6('0x10')](_0x34b6('0xb'),auth['isAuthenticated'](),controller[_0x34b6('0x11')]);module[_0x34b6('0x12')]=router; \ No newline at end of file +var _0x9408=['post','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe'];(function(_0x1bb0c2,_0xdd42ff){var _0x135a24=function(_0x2541ab){while(--_0x2541ab){_0x1bb0c2['push'](_0x1bb0c2['shift']());}};_0x135a24(++_0xdd42ff);}(_0x9408,0xef));var _0x8940=function(_0x3ee6df,_0x452ff4){_0x3ee6df=_0x3ee6df-0x0;var _0x289245=_0x9408[_0x3ee6df];return _0x289245;};'use strict';var multer=require(_0x8940('0x0'));var util=require(_0x8940('0x1'));var path=require(_0x8940('0x2'));var timeout=require(_0x8940('0x3'));var express=require(_0x8940('0x4'));var router=express[_0x8940('0x5')]();var fs_extra=require(_0x8940('0x6'));var auth=require(_0x8940('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0x8940('0x8')]('/',auth[_0x8940('0x9')](),controller[_0x8940('0xa')]);router[_0x8940('0x8')](_0x8940('0xb'),auth[_0x8940('0x9')](),controller[_0x8940('0xc')]);router[_0x8940('0x8')]('/:id',auth[_0x8940('0x9')](),controller['show']);router[_0x8940('0xd')]('/',auth[_0x8940('0x9')](),controller['create']);router[_0x8940('0xe')]('/:id',auth[_0x8940('0x9')](),controller[_0x8940('0xf')]);router[_0x8940('0x10')]('/:id',auth[_0x8940('0x9')](),controller['destroy']);module[_0x8940('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index daeb1c8..f11dd00 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 _0x43b5=['sequelize','exports','STRING','TEXT'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x43b5,0x198));var _0x543b=function(_0x13743b,_0x246844){_0x13743b=_0x13743b-0x0;var _0x2374aa=_0x43b5[_0x13743b];return _0x2374aa;};'use strict';var Sequelize=require(_0x543b('0x0'));module[_0x543b('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x543b('0x2')]},'application':{'type':Sequelize[_0x543b('0x2')]},'data':{'type':Sequelize[_0x543b('0x3')]},'project_name':{'type':Sequelize[_0x543b('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x15a0=['TEXT','STRING'];(function(_0x25ef04,_0xc17ea5){var _0x4a0eb5=function(_0x385187){while(--_0x385187){_0x25ef04['push'](_0x25ef04['shift']());}};_0x4a0eb5(++_0xc17ea5);}(_0x15a0,0x15d));var _0x015a=function(_0x4cd690,_0x4797cc){_0x4cd690=_0x4cd690-0x0;var _0x4a74a9=_0x15a0[_0x4cd690];return _0x4a74a9;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x015a('0x0')]},'application':{'type':Sequelize[_0x015a('0x0')]},'data':{'type':Sequelize[_0x015a('0x1')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x015a('0x0')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 1511f36..b080b9d 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 _0xb6e5=['../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','SquareDetailsReport','rawAttributes','model','map','keys','filters','attributes','intersection','fields','query','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x18b2a2,_0x68b277){var _0x3054f9=function(_0x2059b4){while(--_0x2059b4){_0x18b2a2['push'](_0x18b2a2['shift']());}};_0x3054f9(++_0x68b277);}(_0xb6e5,0x81));var _0x5b6e=function(_0x62f0cd,_0x5172ba){_0x62f0cd=_0x62f0cd-0x0;var _0x1e15e1=_0xb6e5[_0x62f0cd];return _0x1e15e1;};'use strict';var emlformat=require(_0x5b6e('0x0'));var rimraf=require(_0x5b6e('0x1'));var zipdir=require(_0x5b6e('0x2'));var jsonpatch=require(_0x5b6e('0x3'));var rp=require(_0x5b6e('0x4'));var moment=require(_0x5b6e('0x5'));var BPromise=require(_0x5b6e('0x6'));var Mustache=require('mustache');var util=require(_0x5b6e('0x7'));var path=require(_0x5b6e('0x8'));var sox=require(_0x5b6e('0x9'));var csv=require('to-csv');var ejs=require(_0x5b6e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5b6e('0xb'));var squel=require(_0x5b6e('0xc'));var crypto=require(_0x5b6e('0xd'));var jsforce=require(_0x5b6e('0xe'));var deskjs=require(_0x5b6e('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5b6e('0x10'));var Papa=require(_0x5b6e('0x11'));var Redis=require(_0x5b6e('0x12'));var authService=require(_0x5b6e('0x13'));var qs=require(_0x5b6e('0x14'));var as=require(_0x5b6e('0x15'));var hardwareService=require(_0x5b6e('0x16'));var logger=require(_0x5b6e('0x17'))(_0x5b6e('0x18'));var utils=require('../../config/utils');var config=require(_0x5b6e('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x5b6e('0x1a'))['db'];function respondWithStatusCode(_0x5cfece,_0x53d585){_0x53d585=_0x53d585||0xcc;return function(_0x10435d){if(_0x10435d){return _0x5cfece[_0x5b6e('0x1b')](_0x53d585);}return _0x5cfece['status'](_0x53d585)[_0x5b6e('0x1c')]();};}function respondWithResult(_0x3bbeff,_0x235356){_0x235356=_0x235356||0xc8;return function(_0x13fb99){if(_0x13fb99){return _0x3bbeff[_0x5b6e('0x1d')](_0x235356)[_0x5b6e('0x1e')](_0x13fb99);}};}function respondWithFilteredResult(_0x89385a,_0x44a5f5){return function(_0x1142f2){if(_0x1142f2){var _0x22c1fc=typeof _0x44a5f5[_0x5b6e('0x1f')]===_0x5b6e('0x20')&&typeof _0x44a5f5[_0x5b6e('0x21')]===_0x5b6e('0x20');var _0x5d577d=_0x1142f2['count'];var _0x336955=_0x22c1fc?0x0:_0x44a5f5[_0x5b6e('0x1f')];var _0x52bfb3=_0x22c1fc?_0x1142f2[_0x5b6e('0x22')]:_0x44a5f5['offset']+_0x44a5f5[_0x5b6e('0x21')];var _0x56ac7b;if(_0x52bfb3>=_0x5d577d){_0x52bfb3=_0x5d577d;_0x56ac7b=0xc8;}else{_0x56ac7b=0xce;}_0x89385a[_0x5b6e('0x1d')](_0x56ac7b);return _0x89385a[_0x5b6e('0x23')](_0x5b6e('0x24'),_0x336955+'-'+_0x52bfb3+'/'+_0x5d577d)[_0x5b6e('0x1e')](_0x1142f2);}return null;};}function patchUpdates(_0x15df92){return function(_0x2f609e){try{jsonpatch[_0x5b6e('0x25')](_0x2f609e,_0x15df92,!![]);}catch(_0x1076c4){return BPromise['reject'](_0x1076c4);}return _0x2f609e[_0x5b6e('0x26')]();};}function saveUpdates(_0x1ed102,_0x11fd67){return function(_0x183f89){if(_0x183f89){return _0x183f89[_0x5b6e('0x27')](_0x1ed102)[_0x5b6e('0x28')](function(_0x460803){return _0x460803;});}return null;};}function removeEntity(_0xe250c2,_0x346c02){return function(_0x5e85f2){if(_0x5e85f2){return _0x5e85f2[_0x5b6e('0x29')]()[_0x5b6e('0x28')](function(){_0xe250c2[_0x5b6e('0x1d')](0xcc)[_0x5b6e('0x1c')]();});}};}function handleEntityNotFound(_0x456dfc,_0x369b04){return function(_0x4faad0){if(!_0x4faad0){_0x456dfc['sendStatus'](0x194);}return _0x4faad0;};}function handleError(_0x1ea8fb,_0x3666d0){_0x3666d0=_0x3666d0||0x1f4;return function(_0x49b3d5){logger[_0x5b6e('0x2a')](_0x49b3d5[_0x5b6e('0x2b')]);if(_0x49b3d5[_0x5b6e('0x2c')]){delete _0x49b3d5[_0x5b6e('0x2c')];}_0x1ea8fb[_0x5b6e('0x1d')](_0x3666d0)['send'](_0x49b3d5);};}exports[_0x5b6e('0x2d')]=function(_0x171b4b,_0x5b7d34){var _0x3219b0={},_0x3af2b2={},_0x1560c0={'count':0x0,'rows':[]};var _0x251a70=_['map'](db[_0x5b6e('0x2e')][_0x5b6e('0x2f')],function(_0x110cf9){return{'name':_0x110cf9['fieldName'],'type':_0x110cf9['type']['key']};});_0x3af2b2[_0x5b6e('0x30')]=_[_0x5b6e('0x31')](_0x251a70,'name');_0x3af2b2['query']=_[_0x5b6e('0x32')](_0x171b4b['query']);_0x3af2b2[_0x5b6e('0x33')]=_['intersection'](_0x3af2b2[_0x5b6e('0x30')],_0x3af2b2['query']);_0x3219b0[_0x5b6e('0x34')]=_[_0x5b6e('0x35')](_0x3af2b2[_0x5b6e('0x30')],qs[_0x5b6e('0x36')](_0x171b4b[_0x5b6e('0x37')][_0x5b6e('0x36')]));_0x3219b0[_0x5b6e('0x34')]=_0x3219b0[_0x5b6e('0x34')][_0x5b6e('0x38')]?_0x3219b0[_0x5b6e('0x34')]:_0x3af2b2[_0x5b6e('0x30')];if(!_0x171b4b['query'][_0x5b6e('0x39')](_0x5b6e('0x3a'))){_0x3219b0[_0x5b6e('0x21')]=qs[_0x5b6e('0x21')](_0x171b4b[_0x5b6e('0x37')][_0x5b6e('0x21')]);_0x3219b0['offset']=qs['offset'](_0x171b4b[_0x5b6e('0x37')][_0x5b6e('0x1f')]);}_0x3219b0[_0x5b6e('0x3b')]=qs['sort'](_0x171b4b[_0x5b6e('0x37')][_0x5b6e('0x3c')]);_0x3219b0[_0x5b6e('0x3d')]=qs['filters'](_['pick'](_0x171b4b[_0x5b6e('0x37')],_0x3af2b2[_0x5b6e('0x33')]),_0x251a70);if(_0x171b4b[_0x5b6e('0x37')][_0x5b6e('0x3e')]){_0x3219b0[_0x5b6e('0x3d')]=_[_0x5b6e('0x3f')](_0x3219b0[_0x5b6e('0x3d')],{'$or':_[_0x5b6e('0x31')](_0x251a70,function(_0x2aa1a7){if(_0x2aa1a7[_0x5b6e('0x40')]!==_0x5b6e('0x41')){var _0x531e57={};_0x531e57[_0x2aa1a7[_0x5b6e('0x2c')]]={'$like':'%'+_0x171b4b[_0x5b6e('0x37')][_0x5b6e('0x3e')]+'%'};return _0x531e57;}})});}_0x3219b0=_[_0x5b6e('0x3f')]({},_0x3219b0,_0x171b4b[_0x5b6e('0x42')]);var _0x463abe={'where':_0x3219b0[_0x5b6e('0x3d')]};return db['SquareDetailsReport'][_0x5b6e('0x22')](_0x463abe)[_0x5b6e('0x28')](function(_0x1d477c){_0x1560c0[_0x5b6e('0x22')]=_0x1d477c;if(_0x171b4b[_0x5b6e('0x37')][_0x5b6e('0x43')]){_0x3219b0[_0x5b6e('0x44')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x5b6e('0x45')](_0x3219b0);})[_0x5b6e('0x28')](function(_0x24bb7b){_0x1560c0['rows']=_0x24bb7b;return _0x1560c0;})[_0x5b6e('0x28')](respondWithFilteredResult(_0x5b7d34,_0x3219b0))[_0x5b6e('0x46')](handleError(_0x5b7d34,null));};exports[_0x5b6e('0x47')]=function(_0x4af99a,_0x3b66a1){var _0x4b12cb={'raw':!![],'where':{'id':_0x4af99a[_0x5b6e('0x48')]['id']}},_0x58d324={};_0x58d324[_0x5b6e('0x30')]=_[_0x5b6e('0x32')](db['SquareDetailsReport'][_0x5b6e('0x2f')]);_0x58d324[_0x5b6e('0x37')]=_[_0x5b6e('0x32')](_0x4af99a[_0x5b6e('0x37')]);_0x58d324[_0x5b6e('0x33')]=_[_0x5b6e('0x35')](_0x58d324[_0x5b6e('0x30')],_0x58d324['query']);_0x4b12cb[_0x5b6e('0x34')]=_[_0x5b6e('0x35')](_0x58d324['model'],qs[_0x5b6e('0x36')](_0x4af99a['query'][_0x5b6e('0x36')]));_0x4b12cb[_0x5b6e('0x34')]=_0x4b12cb[_0x5b6e('0x34')]['length']?_0x4b12cb['attributes']:_0x58d324[_0x5b6e('0x30')];if(_0x4af99a[_0x5b6e('0x37')]['includeAll']){_0x4b12cb['include']=[{'all':!![]}];}_0x4b12cb=_[_0x5b6e('0x3f')]({},_0x4b12cb,_0x4af99a[_0x5b6e('0x42')]);return db[_0x5b6e('0x2e')][_0x5b6e('0x49')](_0x4b12cb)[_0x5b6e('0x28')](handleEntityNotFound(_0x3b66a1,null))[_0x5b6e('0x28')](respondWithResult(_0x3b66a1,null))[_0x5b6e('0x46')](handleError(_0x3b66a1,null));};exports[_0x5b6e('0x4a')]=function(_0x57f0f5,_0x2c0078){return db[_0x5b6e('0x2e')][_0x5b6e('0x4a')](_0x57f0f5[_0x5b6e('0x4b')],{})[_0x5b6e('0x28')](respondWithResult(_0x2c0078,0xc9))[_0x5b6e('0x46')](handleError(_0x2c0078,null));};exports[_0x5b6e('0x27')]=function(_0x3dde72,_0x34d97f){if(_0x3dde72[_0x5b6e('0x4b')]['id']){delete _0x3dde72['body']['id'];}return db[_0x5b6e('0x2e')]['find']({'where':{'id':_0x3dde72['params']['id']}})[_0x5b6e('0x28')](handleEntityNotFound(_0x34d97f,null))[_0x5b6e('0x28')](saveUpdates(_0x3dde72[_0x5b6e('0x4b')],null))[_0x5b6e('0x28')](respondWithResult(_0x34d97f,null))[_0x5b6e('0x46')](handleError(_0x34d97f,null));};exports['destroy']=function(_0x3c4224,_0x5b46aa){return db[_0x5b6e('0x2e')]['find']({'where':{'id':_0x3c4224[_0x5b6e('0x48')]['id']}})[_0x5b6e('0x28')](handleEntityNotFound(_0x5b46aa,null))['then'](removeEntity(_0x5b46aa,null))[_0x5b6e('0x46')](handleError(_0x5b46aa,null));};exports['describe']=function(_0x23118b,_0x191891){return db[_0x5b6e('0x2e')]['describe']()[_0x5b6e('0x28')](respondWithResult(_0x191891,null))['catch'](handleError(_0x191891,null));}; \ No newline at end of file +var _0xb4d8=['body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','SquareDetailsReport','includeAll','include','findAll','show','params','find','catch','create'];(function(_0x101c58,_0x46506d){var _0x4f58fe=function(_0x4b56df){while(--_0x4b56df){_0x101c58['push'](_0x101c58['shift']());}};_0x4f58fe(++_0x46506d);}(_0xb4d8,0xe8));var _0x8b4d=function(_0x323f2e,_0x495061){_0x323f2e=_0x323f2e-0x0;var _0x4300db=_0xb4d8[_0x323f2e];return _0x4300db;};'use strict';var emlformat=require(_0x8b4d('0x0'));var rimraf=require(_0x8b4d('0x1'));var zipdir=require(_0x8b4d('0x2'));var jsonpatch=require(_0x8b4d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8b4d('0x4'));var Mustache=require(_0x8b4d('0x5'));var util=require(_0x8b4d('0x6'));var path=require(_0x8b4d('0x7'));var sox=require(_0x8b4d('0x8'));var csv=require('to-csv');var ejs=require(_0x8b4d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8b4d('0xa'));var jsforce=require(_0x8b4d('0xb'));var deskjs=require(_0x8b4d('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8b4d('0xd'));var Papa=require(_0x8b4d('0xe'));var Redis=require('ioredis');var authService=require(_0x8b4d('0xf'));var qs=require(_0x8b4d('0x10'));var as=require(_0x8b4d('0x11'));var hardwareService=require(_0x8b4d('0x12'));var logger=require(_0x8b4d('0x13'))(_0x8b4d('0x14'));var utils=require(_0x8b4d('0x15'));var config=require(_0x8b4d('0x16'));var licenseUtil=require(_0x8b4d('0x17'));var db=require(_0x8b4d('0x18'))['db'];function respondWithStatusCode(_0x5b1770,_0x55294b){_0x55294b=_0x55294b||0xcc;return function(_0x3ca5c7){if(_0x3ca5c7){return _0x5b1770[_0x8b4d('0x19')](_0x55294b);}return _0x5b1770[_0x8b4d('0x1a')](_0x55294b)[_0x8b4d('0x1b')]();};}function respondWithResult(_0x1087d5,_0x1ed035){_0x1ed035=_0x1ed035||0xc8;return function(_0x4e0ede){if(_0x4e0ede){return _0x1087d5['status'](_0x1ed035)[_0x8b4d('0x1c')](_0x4e0ede);}};}function respondWithFilteredResult(_0x1a9a34,_0x2387be){return function(_0x41ef02){if(_0x41ef02){var _0x5bab3b=typeof _0x2387be[_0x8b4d('0x1d')]===_0x8b4d('0x1e')&&typeof _0x2387be[_0x8b4d('0x1f')]===_0x8b4d('0x1e');var _0x325133=_0x41ef02[_0x8b4d('0x20')];var _0x36cbbe=_0x5bab3b?0x0:_0x2387be[_0x8b4d('0x1d')];var _0x279fdb=_0x5bab3b?_0x41ef02[_0x8b4d('0x20')]:_0x2387be[_0x8b4d('0x1d')]+_0x2387be[_0x8b4d('0x1f')];var _0x37e6c1;if(_0x279fdb>=_0x325133){_0x279fdb=_0x325133;_0x37e6c1=0xc8;}else{_0x37e6c1=0xce;}_0x1a9a34[_0x8b4d('0x1a')](_0x37e6c1);return _0x1a9a34[_0x8b4d('0x21')]('Content-Range',_0x36cbbe+'-'+_0x279fdb+'/'+_0x325133)[_0x8b4d('0x1c')](_0x41ef02);}return null;};}function patchUpdates(_0x4efe2e){return function(_0x337d3a){try{jsonpatch[_0x8b4d('0x22')](_0x337d3a,_0x4efe2e,!![]);}catch(_0x2dfa73){return BPromise[_0x8b4d('0x23')](_0x2dfa73);}return _0x337d3a[_0x8b4d('0x24')]();};}function saveUpdates(_0x437518,_0x387853){return function(_0x47da01){if(_0x47da01){return _0x47da01['update'](_0x437518)[_0x8b4d('0x25')](function(_0x58c420){return _0x58c420;});}return null;};}function removeEntity(_0x58bb90,_0x51e6bb){return function(_0x4de1d8){if(_0x4de1d8){return _0x4de1d8['destroy']()['then'](function(){_0x58bb90[_0x8b4d('0x1a')](0xcc)[_0x8b4d('0x1b')]();});}};}function handleEntityNotFound(_0x3e8ddd,_0x1f44f6){return function(_0x13f0a5){if(!_0x13f0a5){_0x3e8ddd[_0x8b4d('0x19')](0x194);}return _0x13f0a5;};}function handleError(_0x438910,_0x3e201b){_0x3e201b=_0x3e201b||0x1f4;return function(_0x111614){logger[_0x8b4d('0x26')](_0x111614[_0x8b4d('0x27')]);if(_0x111614[_0x8b4d('0x28')]){delete _0x111614['name'];}_0x438910['status'](_0x3e201b)[_0x8b4d('0x29')](_0x111614);};}exports[_0x8b4d('0x2a')]=function(_0x42a90a,_0x21b947){var _0x328997={},_0x5782be={},_0x31b10b={'count':0x0,'rows':[]};var _0x114389=_[_0x8b4d('0x2b')](db['SquareDetailsReport'][_0x8b4d('0x2c')],function(_0x3d65c1){return{'name':_0x3d65c1[_0x8b4d('0x2d')],'type':_0x3d65c1[_0x8b4d('0x2e')][_0x8b4d('0x2f')]};});_0x5782be[_0x8b4d('0x30')]=_['map'](_0x114389,'name');_0x5782be[_0x8b4d('0x31')]=_[_0x8b4d('0x32')](_0x42a90a[_0x8b4d('0x31')]);_0x5782be[_0x8b4d('0x33')]=_[_0x8b4d('0x34')](_0x5782be[_0x8b4d('0x30')],_0x5782be[_0x8b4d('0x31')]);_0x328997[_0x8b4d('0x35')]=_['intersection'](_0x5782be[_0x8b4d('0x30')],qs[_0x8b4d('0x36')](_0x42a90a['query'][_0x8b4d('0x36')]));_0x328997[_0x8b4d('0x35')]=_0x328997[_0x8b4d('0x35')][_0x8b4d('0x37')]?_0x328997['attributes']:_0x5782be[_0x8b4d('0x30')];if(!_0x42a90a[_0x8b4d('0x31')]['hasOwnProperty'](_0x8b4d('0x38'))){_0x328997[_0x8b4d('0x1f')]=qs[_0x8b4d('0x1f')](_0x42a90a[_0x8b4d('0x31')][_0x8b4d('0x1f')]);_0x328997[_0x8b4d('0x1d')]=qs[_0x8b4d('0x1d')](_0x42a90a[_0x8b4d('0x31')]['offset']);}_0x328997[_0x8b4d('0x39')]=qs[_0x8b4d('0x3a')](_0x42a90a[_0x8b4d('0x31')][_0x8b4d('0x3a')]);_0x328997[_0x8b4d('0x3b')]=qs['filters'](_[_0x8b4d('0x3c')](_0x42a90a[_0x8b4d('0x31')],_0x5782be[_0x8b4d('0x33')]),_0x114389);if(_0x42a90a['query'][_0x8b4d('0x3d')]){_0x328997[_0x8b4d('0x3b')]=_['merge'](_0x328997['where'],{'$or':_[_0x8b4d('0x2b')](_0x114389,function(_0x3a451b){if(_0x3a451b['type']!==_0x8b4d('0x3e')){var _0x18cf23={};_0x18cf23[_0x3a451b[_0x8b4d('0x28')]]={'$like':'%'+_0x42a90a[_0x8b4d('0x31')][_0x8b4d('0x3d')]+'%'};return _0x18cf23;}})});}_0x328997=_['merge']({},_0x328997,_0x42a90a['options']);var _0x584164={'where':_0x328997[_0x8b4d('0x3b')]};return db[_0x8b4d('0x3f')][_0x8b4d('0x20')](_0x584164)[_0x8b4d('0x25')](function(_0x23d59d){_0x31b10b[_0x8b4d('0x20')]=_0x23d59d;if(_0x42a90a[_0x8b4d('0x31')][_0x8b4d('0x40')]){_0x328997[_0x8b4d('0x41')]=[{'all':!![]}];}return db[_0x8b4d('0x3f')][_0x8b4d('0x42')](_0x328997);})['then'](function(_0x2e77bb){_0x31b10b['rows']=_0x2e77bb;return _0x31b10b;})[_0x8b4d('0x25')](respondWithFilteredResult(_0x21b947,_0x328997))['catch'](handleError(_0x21b947,null));};exports[_0x8b4d('0x43')]=function(_0x1cb6db,_0x46b6cd){var _0x324cf7={'raw':!![],'where':{'id':_0x1cb6db[_0x8b4d('0x44')]['id']}},_0x21c444={};_0x21c444['model']=_['keys'](db[_0x8b4d('0x3f')][_0x8b4d('0x2c')]);_0x21c444['query']=_[_0x8b4d('0x32')](_0x1cb6db[_0x8b4d('0x31')]);_0x21c444[_0x8b4d('0x33')]=_[_0x8b4d('0x34')](_0x21c444['model'],_0x21c444[_0x8b4d('0x31')]);_0x324cf7[_0x8b4d('0x35')]=_['intersection'](_0x21c444[_0x8b4d('0x30')],qs['fields'](_0x1cb6db[_0x8b4d('0x31')][_0x8b4d('0x36')]));_0x324cf7[_0x8b4d('0x35')]=_0x324cf7[_0x8b4d('0x35')][_0x8b4d('0x37')]?_0x324cf7['attributes']:_0x21c444[_0x8b4d('0x30')];if(_0x1cb6db[_0x8b4d('0x31')][_0x8b4d('0x40')]){_0x324cf7[_0x8b4d('0x41')]=[{'all':!![]}];}_0x324cf7=_['merge']({},_0x324cf7,_0x1cb6db['options']);return db[_0x8b4d('0x3f')][_0x8b4d('0x45')](_0x324cf7)[_0x8b4d('0x25')](handleEntityNotFound(_0x46b6cd,null))[_0x8b4d('0x25')](respondWithResult(_0x46b6cd,null))[_0x8b4d('0x46')](handleError(_0x46b6cd,null));};exports[_0x8b4d('0x47')]=function(_0x1bd51c,_0x19c56d){return db[_0x8b4d('0x3f')]['create'](_0x1bd51c[_0x8b4d('0x48')],{})[_0x8b4d('0x25')](respondWithResult(_0x19c56d,0xc9))[_0x8b4d('0x46')](handleError(_0x19c56d,null));};exports[_0x8b4d('0x49')]=function(_0x46afd3,_0x34de9e){if(_0x46afd3[_0x8b4d('0x48')]['id']){delete _0x46afd3[_0x8b4d('0x48')]['id'];}return db[_0x8b4d('0x3f')][_0x8b4d('0x45')]({'where':{'id':_0x46afd3[_0x8b4d('0x44')]['id']}})['then'](handleEntityNotFound(_0x34de9e,null))[_0x8b4d('0x25')](saveUpdates(_0x46afd3[_0x8b4d('0x48')],null))['then'](respondWithResult(_0x34de9e,null))['catch'](handleError(_0x34de9e,null));};exports[_0x8b4d('0x4a')]=function(_0x290523,_0x1a8fa6){return db[_0x8b4d('0x3f')]['find']({'where':{'id':_0x290523[_0x8b4d('0x44')]['id']}})[_0x8b4d('0x25')](handleEntityNotFound(_0x1a8fa6,null))[_0x8b4d('0x25')](removeEntity(_0x1a8fa6,null))[_0x8b4d('0x46')](handleError(_0x1a8fa6,null));};exports[_0x8b4d('0x4b')]=function(_0x43a781,_0x55906d){return db[_0x8b4d('0x3f')][_0x8b4d('0x4b')]()['then'](respondWithResult(_0x55906d,null))[_0x8b4d('0x46')](handleError(_0x55906d,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 2585f92..b41a081 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 _0xf174=['../../config/logger','api','bluebird','request-promise','path','rimraf','./squareReportDetail.attributes','SquareDetailsReport','report_square_details','lodash','util'];(function(_0x56ed3c,_0x255f45){var _0xdf5c88=function(_0x413a6a){while(--_0x413a6a){_0x56ed3c['push'](_0x56ed3c['shift']());}};_0xdf5c88(++_0x255f45);}(_0xf174,0x148));var _0x4f17=function(_0x404417,_0x5bfd1d){_0x404417=_0x404417-0x0;var _0x54c72d=_0xf174[_0x404417];return _0x54c72d;};'use strict';var _=require(_0x4f17('0x0'));var util=require(_0x4f17('0x1'));var logger=require(_0x4f17('0x2'))(_0x4f17('0x3'));var moment=require('moment');var BPromise=require(_0x4f17('0x4'));var rp=require(_0x4f17('0x5'));var fs=require('fs');var path=require(_0x4f17('0x6'));var rimraf=require(_0x4f17('0x7'));var config=require('../../config/environment');var attributes=require(_0x4f17('0x8'));module['exports']=function(_0x37818b,_0x1567f3){return _0x37818b['define'](_0x4f17('0x9'),attributes,{'tableName':_0x4f17('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb0f8=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','lodash','util'];(function(_0x2211b6,_0x592bc2){var _0x2963b5=function(_0x3f3ae5){while(--_0x3f3ae5){_0x2211b6['push'](_0x2211b6['shift']());}};_0x2963b5(++_0x592bc2);}(_0xb0f8,0x1ba));var _0x8b0f=function(_0x3665da,_0x291f07){_0x3665da=_0x3665da-0x0;var _0x5765f=_0xb0f8[_0x3665da];return _0x5765f;};'use strict';var _=require(_0x8b0f('0x0'));var util=require(_0x8b0f('0x1'));var logger=require(_0x8b0f('0x2'))('api');var moment=require(_0x8b0f('0x3'));var BPromise=require('bluebird');var rp=require(_0x8b0f('0x4'));var fs=require('fs');var path=require(_0x8b0f('0x5'));var rimraf=require(_0x8b0f('0x6'));var config=require(_0x8b0f('0x7'));var attributes=require(_0x8b0f('0x8'));module[_0x8b0f('0x9')]=function(_0x465f64,_0x352871){return _0x465f64[_0x8b0f('0xa')](_0x8b0f('0xb'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 858e90c..6d35927 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 _0xd5fc=['SquareDetailsReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','create','body','options','CreateSquareDetailsReport','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0xd5fc,0xae));var _0xcd5f=function(_0x591e52,_0x3da792){_0x591e52=_0x591e52-0x0;var _0x3af11a=_0xd5fc[_0x591e52];return _0x3af11a;};'use strict';var _=require(_0xcd5f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcd5f('0x1'));var fs=require('fs');var Redis=require(_0xcd5f('0x2'));var db=require(_0xcd5f('0x3'))['db'];var utils=require(_0xcd5f('0x4'));var logger=require(_0xcd5f('0x5'))(_0xcd5f('0x6'));var config=require('../../config/environment');var jayson=require(_0xcd5f('0x7'));var client=jayson['client'][_0xcd5f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x159b3f,_0x5af696,_0x58d65d){return new BPromise(function(_0x4e668e,_0x102ce9){return client['request'](_0x159b3f,_0x58d65d)[_0xcd5f('0x9')](function(_0x3e63d4){logger['info'](_0xcd5f('0xa'),_0x5af696,'request\x20sent');logger[_0xcd5f('0xb')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x5af696,_0xcd5f('0xc'),JSON[_0xcd5f('0xd')](_0x3e63d4));if(_0x3e63d4[_0xcd5f('0xe')]){if(_0x3e63d4[_0xcd5f('0xe')]['code']===0x1f4){logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x3e63d4['error'][_0xcd5f('0xf')]);return _0x102ce9(_0x3e63d4[_0xcd5f('0xe')][_0xcd5f('0xf')]);}logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x3e63d4['error'][_0xcd5f('0xf')]);return _0x4e668e(_0x3e63d4[_0xcd5f('0xe')][_0xcd5f('0xf')]);}else{logger[_0xcd5f('0x10')](_0xcd5f('0xa'),_0x5af696,_0xcd5f('0xc'));_0x4e668e(_0x3e63d4[_0xcd5f('0x11')]['message']);}})[_0xcd5f('0x12')](function(_0x33ab1a){logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x33ab1a);_0x102ce9(_0x33ab1a);});});}exports['CreateSquareDetailsReport']=function(_0x1a4cb6){var _0x56a874=this;return new Promise(function(_0xb23761,_0x36c60c){return db['SquareDetailsReport'][_0xcd5f('0x13')](_0x1a4cb6[_0xcd5f('0x14')],{'raw':_0x1a4cb6['options']?_0x1a4cb6[_0xcd5f('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xcd5f('0x9')](function(_0x5c3c9f){logger['info'](_0xcd5f('0x16'),_0x1a4cb6);logger['debug']('CreateSquareDetailsReport',_0x1a4cb6,JSON['stringify'](_0x5c3c9f));_0xb23761(_0x5c3c9f);})[_0xcd5f('0x12')](function(_0x5c03b9){logger[_0xcd5f('0xe')](_0xcd5f('0x16'),_0x5c03b9[_0xcd5f('0xf')],_0x1a4cb6);_0x36c60c(_0x56a874[_0xcd5f('0xe')](0x1f4,_0x5c03b9[_0xcd5f('0xf')]));});});}; \ No newline at end of file +var _0xa5fa=['../../config/environment','jayson/promise','client','http','request','info','debug','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','then','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x37a9d7,_0x2b6fde){var _0x1343d3=function(_0x3bde45){while(--_0x3bde45){_0x37a9d7['push'](_0x37a9d7['shift']());}};_0x1343d3(++_0x2b6fde);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x14064a,_0xdc7bf0){_0x14064a=_0x14064a-0x0;var _0x4f993e=_0xa5fa[_0x14064a];return _0x4f993e;};'use strict';var _=require('lodash');var util=require(_0xaa5f('0x0'));var moment=require(_0xaa5f('0x1'));var BPromise=require(_0xaa5f('0x2'));var rs=require(_0xaa5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa5f('0x4'))['db'];var utils=require(_0xaa5f('0x5'));var logger=require('../../config/logger')(_0xaa5f('0x6'));var config=require(_0xaa5f('0x7'));var jayson=require(_0xaa5f('0x8'));var client=jayson[_0xaa5f('0x9')][_0xaa5f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13b606,_0x302138,_0xc326df){return new BPromise(function(_0x74f64f,_0x3f550e){return client[_0xaa5f('0xb')](_0x13b606,_0xc326df)['then'](function(_0x1674c2){logger[_0xaa5f('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x302138,'request\x20sent');logger[_0xaa5f('0xd')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x302138,'request\x20sent',JSON[_0xaa5f('0xe')](_0x1674c2));if(_0x1674c2['error']){if(_0x1674c2[_0xaa5f('0xf')][_0xaa5f('0x10')]===0x1f4){logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1674c2[_0xaa5f('0xf')]['message']);return _0x3f550e(_0x1674c2[_0xaa5f('0xf')]['message']);}logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1674c2[_0xaa5f('0xf')][_0xaa5f('0x12')]);return _0x74f64f(_0x1674c2[_0xaa5f('0xf')]['message']);}else{logger['info'](_0xaa5f('0x11'),_0x302138,_0xaa5f('0x13'));_0x74f64f(_0x1674c2[_0xaa5f('0x14')][_0xaa5f('0x12')]);}})[_0xaa5f('0x15')](function(_0x1fa36a){logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1fa36a);_0x3f550e(_0x1fa36a);});});}exports[_0xaa5f('0x16')]=function(_0x3d874f){var _0x22175f=this;return new Promise(function(_0x1019e8,_0x4f4cd5){return db[_0xaa5f('0x17')][_0xaa5f('0x18')](_0x3d874f[_0xaa5f('0x19')],{'raw':_0x3d874f[_0xaa5f('0x1a')]?_0x3d874f[_0xaa5f('0x1a')][_0xaa5f('0x1b')]===undefined?!![]:![]:!![]})[_0xaa5f('0x1c')](function(_0x194691){logger[_0xaa5f('0xc')](_0xaa5f('0x16'),_0x3d874f);logger[_0xaa5f('0xd')](_0xaa5f('0x16'),_0x3d874f,JSON[_0xaa5f('0xe')](_0x194691));_0x1019e8(_0x194691);})['catch'](function(_0x1e917d){logger['error'](_0xaa5f('0x16'),_0x1e917d[_0xaa5f('0x12')],_0x3d874f);_0x4f4cd5(_0x22175f['error'](0x1f4,_0x1e917d[_0xaa5f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 08055c8..b5b1e2e 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 _0x8da9=['killProcess','exports','express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','index'];(function(_0x4839a2,_0x1f67eb){var _0x465147=function(_0x4eae2e){while(--_0x4eae2e){_0x4839a2['push'](_0x4839a2['shift']());}};_0x465147(++_0x1f67eb);}(_0x8da9,0x146));var _0x98da=function(_0x4f3e5a,_0x1ee150){_0x4f3e5a=_0x4f3e5a-0x0;var _0x452880=_0x8da9[_0x4f3e5a];return _0x452880;};'use strict';var express=require(_0x98da('0x0'));var router=express[_0x98da('0x1')]();var auth=require(_0x98da('0x2'));var controller=require(_0x98da('0x3'));router[_0x98da('0x4')]('/',auth[_0x98da('0x5')](),controller[_0x98da('0x6')]);router['get']('/process/:pid/kill',auth['isAuthenticated'](),controller[_0x98da('0x7')]);module[_0x98da('0x8')]=router; \ No newline at end of file +var _0x0a05=['Router','../../components/auth/service','get','isAuthenticated','/process/:pid/kill','killProcess','exports','express'];(function(_0x5f5c34,_0x23e89){var _0x48c0a7=function(_0x12124a){while(--_0x12124a){_0x5f5c34['push'](_0x5f5c34['shift']());}};_0x48c0a7(++_0x23e89);}(_0x0a05,0x19f));var _0x50a0=function(_0x4a5494,_0x3ad336){_0x4a5494=_0x4a5494-0x0;var _0x57cbb5=_0x0a05[_0x4a5494];return _0x57cbb5;};'use strict';var express=require(_0x50a0('0x0'));var router=express[_0x50a0('0x1')]();var auth=require(_0x50a0('0x2'));var controller=require('./system.controller');router[_0x50a0('0x3')]('/',auth[_0x50a0('0x4')](),controller['index']);router[_0x50a0('0x3')](_0x50a0('0x5'),auth[_0x50a0('0x4')](),controller[_0x50a0('0x6')]);module[_0x50a0('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index e82963a..61ac332 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 _0x3794=['indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','format','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','exec','../../config/logger','api','util','bluebird','lodash','error','inspect','name','send','getAllData','then','json','catch','status','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x3794,0x8d));var _0x4379=function(_0x671369,_0x433da5){_0x671369=_0x671369-0x0;var _0x33f2b4=_0x3794[_0x671369];return _0x33f2b4;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0x4379('0x0')];var logger=require(_0x4379('0x1'))(_0x4379('0x2'));var util=require(_0x4379('0x3'));var BPromise=require(_0x4379('0x4'));var _=require(_0x4379('0x5'));function handleError(_0x174632,_0x3192fb,_0x511571){_0x3192fb=_0x3192fb||0x1f4;return function(_0x5d2aa){logger[_0x4379('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x511571,_0x3192fb,util[_0x4379('0x7')](_0x5d2aa,{'showHidden':![],'depth':null}));delete _0x5d2aa[_0x4379('0x8')];_0x174632['status'](_0x3192fb)[_0x4379('0x9')](_0x5d2aa);};}exports['index']=function(_0x21cf3a,_0x3a6a75){return info[_0x4379('0xa')]()[_0x4379('0xb')](function(_0x2b4b27){return _0x3a6a75['status'](0xc8)[_0x4379('0xc')](_0x2b4b27);})[_0x4379('0xd')](function(_0x379aea){return _0x3a6a75[_0x4379('0xe')](0x1f4)[_0x4379('0xc')](_0x379aea);});};exports['killProcess']=function(_0x521295,_0x167f39){var _0x2d56d9=[_0x4379('0xf')];return new BPromise(function(_0x422352,_0x363967){return exec(util['format'](_0x4379('0x10'),_0x521295[_0x4379('0x11')][_0x4379('0x12')]),function(_0x56548b,_0x5061b9,_0x1985eb){if(_0x56548b){return _0x363967(_0x56548b);}return _0x422352(_0x5061b9);});})[_0x4379('0xb')](function(_0x42bdba){var _0x4b2d84=![];var _0x52794f=_0x42bdba[_0x4379('0x13')](/\n/);for(var _0x1a14e9=0x0,_0x109f7f=_0x2d56d9[_0x4379('0x14')];_0x1a14e9<_0x109f7f,_0x4b2d84===![];_0x1a14e9+=0x1){if(_0x42bdba[_0x4379('0x15')](_0x2d56d9[_0x1a14e9])>=0x0){_0x4b2d84=!![];}}if(!_0x4b2d84){throw new Error(util['format'](_0x4379('0x16'),_0x521295[_0x4379('0x11')]['pid']));}process[_0x4379('0x17')](_0x521295['params'][_0x4379('0x12')],'SIGINT');return _0x167f39[_0x4379('0xe')](0xc8)[_0x4379('0xc')]({'message':util[_0x4379('0x18')](_0x4379('0x19'),_0x521295[_0x4379('0x11')]['pid'])});})[_0x4379('0xd')](handleError(_0x167f39,null,_0x4379('0x1a')));}; \ No newline at end of file +var _0x5e27=['components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','api','util','bluebird','error','name','status','send','getAllData','then','json','catch','killProcess'];(function(_0x1bcd77,_0x29c5c4){var _0x3b498c=function(_0x12be7c){while(--_0x12be7c){_0x1bcd77['push'](_0x1bcd77['shift']());}};_0x3b498c(++_0x29c5c4);}(_0x5e27,0x135));var _0x75e2=function(_0x333f21,_0x1503d7){_0x333f21=_0x333f21-0x0;var _0x3d02fc=_0x5e27[_0x333f21];return _0x3d02fc;};'use strict';var info=require(_0x75e2('0x0'));var exec=require(_0x75e2('0x1'))['exec'];var logger=require(_0x75e2('0x2'))(_0x75e2('0x3'));var util=require(_0x75e2('0x4'));var BPromise=require(_0x75e2('0x5'));var _=require('lodash');function handleError(_0x96a5ab,_0x420b66,_0x4b8b41){_0x420b66=_0x420b66||0x1f4;return function(_0x1d0cf9){logger[_0x75e2('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x4b8b41,_0x420b66,util['inspect'](_0x1d0cf9,{'showHidden':![],'depth':null}));delete _0x1d0cf9[_0x75e2('0x7')];_0x96a5ab[_0x75e2('0x8')](_0x420b66)[_0x75e2('0x9')](_0x1d0cf9);};}exports['index']=function(_0x421c4e,_0x4d1ad6){return info[_0x75e2('0xa')]()[_0x75e2('0xb')](function(_0x2232fc){return _0x4d1ad6['status'](0xc8)[_0x75e2('0xc')](_0x2232fc);})[_0x75e2('0xd')](function(_0x2958bf){return _0x4d1ad6['status'](0x1f4)[_0x75e2('0xc')](_0x2958bf);});};exports[_0x75e2('0xe')]=function(_0x3a00c0,_0x539ecd){var _0x5950ec=[_0x75e2('0xf')];return new BPromise(function(_0x465589,_0x3f5e17){return exec(util[_0x75e2('0x10')](_0x75e2('0x11'),_0x3a00c0[_0x75e2('0x12')][_0x75e2('0x13')]),function(_0x4b6748,_0x46fe5a,_0x32d259){if(_0x4b6748){return _0x3f5e17(_0x4b6748);}return _0x465589(_0x46fe5a);});})[_0x75e2('0xb')](function(_0x33c1e2){var _0x1c144b=![];var _0x49f019=_0x33c1e2[_0x75e2('0x14')](/\n/);for(var _0x10fd00=0x0,_0x2bc8aa=_0x5950ec[_0x75e2('0x15')];_0x10fd00<_0x2bc8aa,_0x1c144b===![];_0x10fd00+=0x1){if(_0x33c1e2[_0x75e2('0x16')](_0x5950ec[_0x10fd00])>=0x0){_0x1c144b=!![];}}if(!_0x1c144b){throw new Error(util[_0x75e2('0x10')](_0x75e2('0x17'),_0x3a00c0[_0x75e2('0x12')]['pid']));}process[_0x75e2('0x18')](_0x3a00c0[_0x75e2('0x12')]['pid'],_0x75e2('0x19'));return _0x539ecd[_0x75e2('0x8')](0xc8)[_0x75e2('0xc')]({'message':util['format'](_0x75e2('0x1a'),_0x3a00c0[_0x75e2('0x12')]['pid'])});})[_0x75e2('0xd')](handleError(_0x539ecd,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index f369dd4..dc40ea6 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 _0xe2ec=['../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x1e263a,_0xfae772){var _0x92c6cb=function(_0x193952){while(--_0x193952){_0x1e263a['push'](_0x1e263a['shift']());}};_0x92c6cb(++_0xfae772);}(_0xe2ec,0xe1));var _0xce2e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xe2ec[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require(_0xce2e('0x0'));var util=require(_0xce2e('0x1'));var path=require(_0xce2e('0x2'));var timeout=require('connect-timeout');var express=require(_0xce2e('0x3'));var router=express[_0xce2e('0x4')]();var fs_extra=require(_0xce2e('0x5'));var auth=require(_0xce2e('0x6'));var interaction=require(_0xce2e('0x7'));var config=require(_0xce2e('0x8'));var controller=require(_0xce2e('0x9'));router[_0xce2e('0xa')]('/',auth[_0xce2e('0xb')](),controller[_0xce2e('0xc')]);router['get']('/:id',auth[_0xce2e('0xb')](),controller[_0xce2e('0xd')]);router[_0xce2e('0xe')]('/',auth[_0xce2e('0xb')](),controller[_0xce2e('0xf')]);router['put'](_0xce2e('0x10'),auth[_0xce2e('0xb')](),controller[_0xce2e('0x11')]);router[_0xce2e('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xce2e('0x13')]);module[_0xce2e('0x14')]=router; \ No newline at end of file +var _0xefd8=['show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id'];(function(_0x28f729,_0x5dbd61){var _0x264ce0=function(_0x4a7bb3){while(--_0x4a7bb3){_0x28f729['push'](_0x28f729['shift']());}};_0x264ce0(++_0x5dbd61);}(_0xefd8,0x1d3));var _0x8efd=function(_0x18a74e,_0x5e7e9c){_0x18a74e=_0x18a74e-0x0;var _0x51ae2d=_0xefd8[_0x18a74e];return _0x51ae2d;};'use strict';var multer=require(_0x8efd('0x0'));var util=require(_0x8efd('0x1'));var path=require(_0x8efd('0x2'));var timeout=require(_0x8efd('0x3'));var express=require(_0x8efd('0x4'));var router=express[_0x8efd('0x5')]();var fs_extra=require(_0x8efd('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8efd('0x7'));var controller=require(_0x8efd('0x8'));router[_0x8efd('0x9')]('/',auth[_0x8efd('0xa')](),controller[_0x8efd('0xb')]);router[_0x8efd('0x9')](_0x8efd('0xc'),auth[_0x8efd('0xa')](),controller[_0x8efd('0xd')]);router[_0x8efd('0xe')]('/',auth[_0x8efd('0xa')](),controller[_0x8efd('0xf')]);router[_0x8efd('0x10')](_0x8efd('0xc'),auth[_0x8efd('0xa')](),controller[_0x8efd('0x11')]);router[_0x8efd('0x12')](_0x8efd('0xc'),auth['isAuthenticated'](),controller[_0x8efd('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 9f1be87..834d9c4 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 _0x24b3=['STRING','sequelize','exports'];(function(_0x54496d,_0x5b8572){var _0x40e626=function(_0xb6475c){while(--_0xb6475c){_0x54496d['push'](_0x54496d['shift']());}};_0x40e626(++_0x5b8572);}(_0x24b3,0xd3));var _0x324b=function(_0x3629ab,_0xe33f9f){_0x3629ab=_0x3629ab-0x0;var _0x3ba9c1=_0x24b3[_0x3629ab];return _0x3ba9c1;};'use strict';var Sequelize=require(_0x324b('0x0'));module[_0x324b('0x1')]={'name':{'type':Sequelize[_0x324b('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x324b('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfa28=['exports','STRING','name','#0091EA','sequelize'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xfa28,0x1c6));var _0x8fa2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xfa28[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x8fa2('0x0'));module[_0x8fa2('0x1')]={'name':{'type':Sequelize[_0x8fa2('0x2')],'unique':_0x8fa2('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x8fa2('0x2')],'defaultValue':_0x8fa2('0x4')},'description':{'type':Sequelize[_0x8fa2('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 8ccac4b..91b5e2b 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 _0xe28e=['stack','name','send','index','map','Tag','fieldName','key','model','query','keys','attributes','intersection','fields','limit','order','sort','where','filters','pick','VIRTUAL','merge','include','catch','show','rawAttributes','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','set','json','apply','reject','save','update','destroy','then','get','Tags','UserProfileResource','error'];(function(_0x41b840,_0x1a3baf){var _0x2a0adf=function(_0x2eb5a7){while(--_0x2eb5a7){_0x41b840['push'](_0x41b840['shift']());}};_0x2a0adf(++_0x1a3baf);}(_0xe28e,0x1ba));var _0xee28=function(_0x2bbd25,_0x58575b){_0x2bbd25=_0x2bbd25-0x0;var _0x44ae3e=_0xe28e[_0x2bbd25];return _0x44ae3e;};'use strict';var emlformat=require(_0xee28('0x0'));var rimraf=require(_0xee28('0x1'));var zipdir=require(_0xee28('0x2'));var jsonpatch=require(_0xee28('0x3'));var rp=require(_0xee28('0x4'));var moment=require(_0xee28('0x5'));var BPromise=require(_0xee28('0x6'));var Mustache=require(_0xee28('0x7'));var util=require(_0xee28('0x8'));var path=require(_0xee28('0x9'));var sox=require(_0xee28('0xa'));var csv=require(_0xee28('0xb'));var ejs=require(_0xee28('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee28('0xd'));var squel=require(_0xee28('0xe'));var crypto=require(_0xee28('0xf'));var jsforce=require(_0xee28('0x10'));var deskjs=require(_0xee28('0x11'));var toCsv=require(_0xee28('0xb'));var querystring=require(_0xee28('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xee28('0x13'));var as=require(_0xee28('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee28('0x15'))(_0xee28('0x16'));var utils=require('../../config/utils');var config=require(_0xee28('0x17'));var licenseUtil=require(_0xee28('0x18'));var db=require(_0xee28('0x19'))['db'];function respondWithStatusCode(_0x2488cf,_0x267031){_0x267031=_0x267031||0xcc;return function(_0x46e784){if(_0x46e784){return _0x2488cf[_0xee28('0x1a')](_0x267031);}return _0x2488cf['status'](_0x267031)[_0xee28('0x1b')]();};}function respondWithResult(_0x1df69a,_0x555b9c){_0x555b9c=_0x555b9c||0xc8;return function(_0x331b7c){if(_0x331b7c){return _0x1df69a[_0xee28('0x1c')](_0x555b9c)['json'](_0x331b7c);}};}function respondWithFilteredResult(_0x11ac93,_0x17c99a){return function(_0x3d3a5c){if(_0x3d3a5c){var _0x343358=typeof _0x17c99a[_0xee28('0x1d')]===_0xee28('0x1e')&&typeof _0x17c99a['limit']===_0xee28('0x1e');var _0x5de212=_0x3d3a5c[_0xee28('0x1f')];var _0x19472a=_0x343358?0x0:_0x17c99a['offset'];var _0x355b07=_0x343358?_0x3d3a5c['count']:_0x17c99a[_0xee28('0x1d')]+_0x17c99a['limit'];var _0x28da88;if(_0x355b07>=_0x5de212){_0x355b07=_0x5de212;_0x28da88=0xc8;}else{_0x28da88=0xce;}_0x11ac93['status'](_0x28da88);return _0x11ac93[_0xee28('0x20')]('Content-Range',_0x19472a+'-'+_0x355b07+'/'+_0x5de212)[_0xee28('0x21')](_0x3d3a5c);}return null;};}function patchUpdates(_0x2a01ff){return function(_0x96f5db){try{jsonpatch[_0xee28('0x22')](_0x96f5db,_0x2a01ff,!![]);}catch(_0x21ee24){return BPromise[_0xee28('0x23')](_0x21ee24);}return _0x96f5db[_0xee28('0x24')]();};}function saveUpdates(_0x4bda53,_0x342798){return function(_0x44d7ff){if(_0x44d7ff){return _0x44d7ff[_0xee28('0x25')](_0x4bda53)['then'](function(_0x5b500b){return _0x5b500b;});}return null;};}function removeEntity(_0x17d8e4,_0x4a524d){return function(_0x1519ae){if(_0x1519ae){return _0x1519ae[_0xee28('0x26')]()[_0xee28('0x27')](function(){var _0x3acfc9=_0x1519ae[_0xee28('0x28')]({'plain':!![]});var _0x95d917=_0xee28('0x29');return db[_0xee28('0x2a')][_0xee28('0x26')]({'where':{'type':_0x95d917,'resourceId':_0x3acfc9['id']}})['then'](function(){return _0x1519ae;});})[_0xee28('0x27')](function(){_0x17d8e4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x54528b,_0x587aac){return function(_0x51eae7){if(!_0x51eae7){_0x54528b[_0xee28('0x1a')](0x194);}return _0x51eae7;};}function handleError(_0x884e7d,_0x3b64ad){_0x3b64ad=_0x3b64ad||0x1f4;return function(_0x469889){logger[_0xee28('0x2b')](_0x469889[_0xee28('0x2c')]);if(_0x469889[_0xee28('0x2d')]){delete _0x469889['name'];}_0x884e7d[_0xee28('0x1c')](_0x3b64ad)[_0xee28('0x2e')](_0x469889);};}exports[_0xee28('0x2f')]=function(_0x49644a,_0x14f7c4){var _0x2890ad={},_0x213e45={},_0xf0b169={'count':0x0,'rows':[]};var _0x1421bc=_[_0xee28('0x30')](db[_0xee28('0x31')]['rawAttributes'],function(_0x15f294){return{'name':_0x15f294[_0xee28('0x32')],'type':_0x15f294['type'][_0xee28('0x33')]};});_0x213e45[_0xee28('0x34')]=_[_0xee28('0x30')](_0x1421bc,_0xee28('0x2d'));_0x213e45[_0xee28('0x35')]=_[_0xee28('0x36')](_0x49644a[_0xee28('0x35')]);_0x213e45['filters']=_['intersection'](_0x213e45['model'],_0x213e45[_0xee28('0x35')]);_0x2890ad[_0xee28('0x37')]=_[_0xee28('0x38')](_0x213e45[_0xee28('0x34')],qs[_0xee28('0x39')](_0x49644a[_0xee28('0x35')]['fields']));_0x2890ad[_0xee28('0x37')]=_0x2890ad[_0xee28('0x37')]['length']?_0x2890ad['attributes']:_0x213e45[_0xee28('0x34')];if(!_0x49644a[_0xee28('0x35')]['hasOwnProperty']('nolimit')){_0x2890ad[_0xee28('0x3a')]=qs[_0xee28('0x3a')](_0x49644a['query'][_0xee28('0x3a')]);_0x2890ad[_0xee28('0x1d')]=qs[_0xee28('0x1d')](_0x49644a[_0xee28('0x35')][_0xee28('0x1d')]);}_0x2890ad[_0xee28('0x3b')]=qs[_0xee28('0x3c')](_0x49644a[_0xee28('0x35')][_0xee28('0x3c')]);_0x2890ad[_0xee28('0x3d')]=qs[_0xee28('0x3e')](_[_0xee28('0x3f')](_0x49644a['query'],_0x213e45[_0xee28('0x3e')]),_0x1421bc);if(_0x49644a['query']['filter']){_0x2890ad[_0xee28('0x3d')]=_['merge'](_0x2890ad[_0xee28('0x3d')],{'$or':_['map'](_0x1421bc,function(_0x2b73d9){if(_0x2b73d9['type']!==_0xee28('0x40')){var _0x211345={};_0x211345[_0x2b73d9[_0xee28('0x2d')]]={'$like':'%'+_0x49644a[_0xee28('0x35')]['filter']+'%'};return _0x211345;}})});}_0x2890ad=_[_0xee28('0x41')]({},_0x2890ad,_0x49644a['options']);var _0x45ed94={'where':_0x2890ad[_0xee28('0x3d')]};return db[_0xee28('0x31')][_0xee28('0x1f')](_0x45ed94)[_0xee28('0x27')](function(_0x2e046e){_0xf0b169[_0xee28('0x1f')]=_0x2e046e;if(_0x49644a['query']['includeAll']){_0x2890ad[_0xee28('0x42')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x2890ad);})[_0xee28('0x27')](function(_0x14bd8d){_0xf0b169['rows']=_0x14bd8d;return _0xf0b169;})[_0xee28('0x27')](respondWithFilteredResult(_0x14f7c4,_0x2890ad))[_0xee28('0x43')](handleError(_0x14f7c4,null));};exports[_0xee28('0x44')]=function(_0x24cfaa,_0x460c61){var _0x2351f7={'raw':!![],'where':{'id':_0x24cfaa['params']['id']}},_0x1735a9={};_0x1735a9[_0xee28('0x34')]=_[_0xee28('0x36')](db[_0xee28('0x31')][_0xee28('0x45')]);_0x1735a9[_0xee28('0x35')]=_['keys'](_0x24cfaa[_0xee28('0x35')]);_0x1735a9[_0xee28('0x3e')]=_['intersection'](_0x1735a9[_0xee28('0x34')],_0x1735a9[_0xee28('0x35')]);_0x2351f7[_0xee28('0x37')]=_[_0xee28('0x38')](_0x1735a9[_0xee28('0x34')],qs[_0xee28('0x39')](_0x24cfaa['query'][_0xee28('0x39')]));_0x2351f7['attributes']=_0x2351f7['attributes'][_0xee28('0x46')]?_0x2351f7[_0xee28('0x37')]:_0x1735a9['model'];if(_0x24cfaa[_0xee28('0x35')][_0xee28('0x47')]){_0x2351f7[_0xee28('0x42')]=[{'all':!![]}];}_0x2351f7=_['merge']({},_0x2351f7,_0x24cfaa['options']);return db[_0xee28('0x31')][_0xee28('0x48')](_0x2351f7)[_0xee28('0x27')](handleEntityNotFound(_0x460c61,null))[_0xee28('0x27')](respondWithResult(_0x460c61,null))[_0xee28('0x43')](handleError(_0x460c61,null));};exports[_0xee28('0x49')]=function(_0x2574c5,_0x2b5f36){return db[_0xee28('0x31')][_0xee28('0x49')](_0x2574c5['body'],{})[_0xee28('0x27')](function(_0x5e174f){var _0x21a66a=_0x2574c5[_0xee28('0x4a')][_0xee28('0x28')]({'plain':!![]});if(!_0x21a66a)throw new Error(_0xee28('0x4b'));if(_0x21a66a[_0xee28('0x4c')]==='user'){var _0x5247fe=_0x5e174f['get']({'plain':!![]});var _0x1b15a4='Tags';return db['UserProfileSection'][_0xee28('0x48')]({'where':{'name':_0x1b15a4,'userProfileId':_0x21a66a['userProfileId']},'raw':!![]})[_0xee28('0x27')](function(_0x1f6754){if(_0x1f6754&&_0x1f6754[_0xee28('0x4d')]===0x0){return db[_0xee28('0x2a')][_0xee28('0x49')]({'name':_0x5247fe[_0xee28('0x2d')],'resourceId':_0x5247fe['id'],'type':_0x1f6754[_0xee28('0x2d')],'sectionId':_0x1f6754['id']},{})[_0xee28('0x27')](function(){return _0x5e174f;});}else{return _0x5e174f;}})[_0xee28('0x43')](function(_0x10d393){logger['error'](_0xee28('0x4e'),_0x10d393);throw _0x10d393;});}return _0x5e174f;})[_0xee28('0x27')](respondWithResult(_0x2b5f36,0xc9))[_0xee28('0x43')](handleError(_0x2b5f36,null));};exports['update']=function(_0x5b9ced,_0x57d865){if(_0x5b9ced['body']['id']){delete _0x5b9ced[_0xee28('0x4f')]['id'];}return db[_0xee28('0x31')][_0xee28('0x48')]({'where':{'id':_0x5b9ced['params']['id']}})[_0xee28('0x27')](handleEntityNotFound(_0x57d865,null))[_0xee28('0x27')](saveUpdates(_0x5b9ced[_0xee28('0x4f')],null))[_0xee28('0x27')](respondWithResult(_0x57d865,null))[_0xee28('0x43')](handleError(_0x57d865,null));};exports['destroy']=function(_0x2a5da9,_0x1c6696){return db[_0xee28('0x31')]['find']({'where':{'id':_0x2a5da9[_0xee28('0x50')]['id']}})[_0xee28('0x27')](handleEntityNotFound(_0x1c6696,null))[_0xee28('0x27')](removeEntity(_0x1c6696,null))[_0xee28('0x43')](handleError(_0x1c6696,null));}; \ No newline at end of file +var _0xc788=['where','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','Tags','error','stack','name','index','map','Tag','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter'];(function(_0x2770ce,_0x74b2e7){var _0x313d4a=function(_0x2e18c8){while(--_0x2e18c8){_0x2770ce['push'](_0x2770ce['shift']());}};_0x313d4a(++_0x74b2e7);}(_0xc788,0xc4));var _0x8c78=function(_0x6b4e41,_0x3ed208){_0x6b4e41=_0x6b4e41-0x0;var _0x346877=_0xc788[_0x6b4e41];return _0x346877;};'use strict';var emlformat=require(_0x8c78('0x0'));var rimraf=require(_0x8c78('0x1'));var zipdir=require(_0x8c78('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8c78('0x3'));var BPromise=require(_0x8c78('0x4'));var Mustache=require(_0x8c78('0x5'));var util=require(_0x8c78('0x6'));var path=require(_0x8c78('0x7'));var sox=require('sox');var csv=require(_0x8c78('0x8'));var ejs=require(_0x8c78('0x9'));var fs=require('fs');var fs_extra=require(_0x8c78('0xa'));var _=require(_0x8c78('0xb'));var squel=require(_0x8c78('0xc'));var crypto=require('crypto');var jsforce=require(_0x8c78('0xd'));var deskjs=require(_0x8c78('0xe'));var toCsv=require(_0x8c78('0x8'));var querystring=require(_0x8c78('0xf'));var Papa=require(_0x8c78('0x10'));var Redis=require(_0x8c78('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8c78('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8c78('0x13'));var logger=require(_0x8c78('0x14'))('api');var utils=require(_0x8c78('0x15'));var config=require(_0x8c78('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8c78('0x17'))['db'];function respondWithStatusCode(_0x4b2eca,_0x56a802){_0x56a802=_0x56a802||0xcc;return function(_0x349dfa){if(_0x349dfa){return _0x4b2eca[_0x8c78('0x18')](_0x56a802);}return _0x4b2eca[_0x8c78('0x19')](_0x56a802)[_0x8c78('0x1a')]();};}function respondWithResult(_0x2eedff,_0x3d1306){_0x3d1306=_0x3d1306||0xc8;return function(_0xe5f8ae){if(_0xe5f8ae){return _0x2eedff[_0x8c78('0x19')](_0x3d1306)[_0x8c78('0x1b')](_0xe5f8ae);}};}function respondWithFilteredResult(_0x1157d0,_0x4ff4b0){return function(_0x1fa78e){if(_0x1fa78e){var _0x293cfe=typeof _0x4ff4b0['offset']===_0x8c78('0x1c')&&typeof _0x4ff4b0[_0x8c78('0x1d')]===_0x8c78('0x1c');var _0x23824e=_0x1fa78e[_0x8c78('0x1e')];var _0x461eff=_0x293cfe?0x0:_0x4ff4b0['offset'];var _0x4f7bf9=_0x293cfe?_0x1fa78e[_0x8c78('0x1e')]:_0x4ff4b0['offset']+_0x4ff4b0['limit'];var _0xece4f0;if(_0x4f7bf9>=_0x23824e){_0x4f7bf9=_0x23824e;_0xece4f0=0xc8;}else{_0xece4f0=0xce;}_0x1157d0['status'](_0xece4f0);return _0x1157d0[_0x8c78('0x1f')](_0x8c78('0x20'),_0x461eff+'-'+_0x4f7bf9+'/'+_0x23824e)['json'](_0x1fa78e);}return null;};}function patchUpdates(_0x6c9a12){return function(_0x5b111b){try{jsonpatch[_0x8c78('0x21')](_0x5b111b,_0x6c9a12,!![]);}catch(_0x3af73c){return BPromise['reject'](_0x3af73c);}return _0x5b111b[_0x8c78('0x22')]();};}function saveUpdates(_0x188cc3,_0x499603){return function(_0x2bc595){if(_0x2bc595){return _0x2bc595[_0x8c78('0x23')](_0x188cc3)[_0x8c78('0x24')](function(_0x9581c6){return _0x9581c6;});}return null;};}function removeEntity(_0x215940,_0x20f483){return function(_0xbfdf6f){if(_0xbfdf6f){return _0xbfdf6f[_0x8c78('0x25')]()[_0x8c78('0x24')](function(){var _0x4a7d20=_0xbfdf6f[_0x8c78('0x26')]({'plain':!![]});var _0x458763=_0x8c78('0x27');return db['UserProfileResource'][_0x8c78('0x25')]({'where':{'type':_0x458763,'resourceId':_0x4a7d20['id']}})['then'](function(){return _0xbfdf6f;});})[_0x8c78('0x24')](function(){_0x215940[_0x8c78('0x19')](0xcc)[_0x8c78('0x1a')]();});}};}function handleEntityNotFound(_0x496c51,_0x583a74){return function(_0x2568d5){if(!_0x2568d5){_0x496c51['sendStatus'](0x194);}return _0x2568d5;};}function handleError(_0x20b128,_0x4376da){_0x4376da=_0x4376da||0x1f4;return function(_0x394c1d){logger[_0x8c78('0x28')](_0x394c1d[_0x8c78('0x29')]);if(_0x394c1d[_0x8c78('0x2a')]){delete _0x394c1d['name'];}_0x20b128[_0x8c78('0x19')](_0x4376da)['send'](_0x394c1d);};}exports[_0x8c78('0x2b')]=function(_0x17f4c8,_0xb69c52){var _0x4e764f={},_0x1f1a0c={},_0x3816d2={'count':0x0,'rows':[]};var _0x4f0005=_[_0x8c78('0x2c')](db[_0x8c78('0x2d')][_0x8c78('0x2e')],function(_0x487a4c){return{'name':_0x487a4c[_0x8c78('0x2f')],'type':_0x487a4c[_0x8c78('0x30')][_0x8c78('0x31')]};});_0x1f1a0c['model']=_[_0x8c78('0x2c')](_0x4f0005,_0x8c78('0x2a'));_0x1f1a0c['query']=_[_0x8c78('0x32')](_0x17f4c8[_0x8c78('0x33')]);_0x1f1a0c[_0x8c78('0x34')]=_[_0x8c78('0x35')](_0x1f1a0c[_0x8c78('0x36')],_0x1f1a0c[_0x8c78('0x33')]);_0x4e764f[_0x8c78('0x37')]=_[_0x8c78('0x35')](_0x1f1a0c[_0x8c78('0x36')],qs[_0x8c78('0x38')](_0x17f4c8['query'][_0x8c78('0x38')]));_0x4e764f[_0x8c78('0x37')]=_0x4e764f[_0x8c78('0x37')][_0x8c78('0x39')]?_0x4e764f[_0x8c78('0x37')]:_0x1f1a0c['model'];if(!_0x17f4c8[_0x8c78('0x33')][_0x8c78('0x3a')](_0x8c78('0x3b'))){_0x4e764f['limit']=qs[_0x8c78('0x1d')](_0x17f4c8[_0x8c78('0x33')]['limit']);_0x4e764f[_0x8c78('0x3c')]=qs['offset'](_0x17f4c8[_0x8c78('0x33')][_0x8c78('0x3c')]);}_0x4e764f[_0x8c78('0x3d')]=qs[_0x8c78('0x3e')](_0x17f4c8['query'][_0x8c78('0x3e')]);_0x4e764f['where']=qs[_0x8c78('0x34')](_[_0x8c78('0x3f')](_0x17f4c8[_0x8c78('0x33')],_0x1f1a0c['filters']),_0x4f0005);if(_0x17f4c8['query'][_0x8c78('0x40')]){_0x4e764f[_0x8c78('0x41')]=_[_0x8c78('0x42')](_0x4e764f[_0x8c78('0x41')],{'$or':_[_0x8c78('0x2c')](_0x4f0005,function(_0x484931){if(_0x484931[_0x8c78('0x30')]!==_0x8c78('0x43')){var _0x1f0a2b={};_0x1f0a2b[_0x484931[_0x8c78('0x2a')]]={'$like':'%'+_0x17f4c8[_0x8c78('0x33')][_0x8c78('0x40')]+'%'};return _0x1f0a2b;}})});}_0x4e764f=_[_0x8c78('0x42')]({},_0x4e764f,_0x17f4c8['options']);var _0x3995f4={'where':_0x4e764f[_0x8c78('0x41')]};return db['Tag']['count'](_0x3995f4)[_0x8c78('0x24')](function(_0x1612d5){_0x3816d2['count']=_0x1612d5;if(_0x17f4c8[_0x8c78('0x33')][_0x8c78('0x44')]){_0x4e764f['include']=[{'all':!![]}];}return db[_0x8c78('0x2d')][_0x8c78('0x45')](_0x4e764f);})['then'](function(_0x10d521){_0x3816d2[_0x8c78('0x46')]=_0x10d521;return _0x3816d2;})[_0x8c78('0x24')](respondWithFilteredResult(_0xb69c52,_0x4e764f))[_0x8c78('0x47')](handleError(_0xb69c52,null));};exports[_0x8c78('0x48')]=function(_0x4e4880,_0x545d90){var _0x2841c2={'raw':!![],'where':{'id':_0x4e4880[_0x8c78('0x49')]['id']}},_0x2f6a6b={};_0x2f6a6b[_0x8c78('0x36')]=_[_0x8c78('0x32')](db[_0x8c78('0x2d')][_0x8c78('0x2e')]);_0x2f6a6b[_0x8c78('0x33')]=_[_0x8c78('0x32')](_0x4e4880[_0x8c78('0x33')]);_0x2f6a6b[_0x8c78('0x34')]=_['intersection'](_0x2f6a6b[_0x8c78('0x36')],_0x2f6a6b[_0x8c78('0x33')]);_0x2841c2[_0x8c78('0x37')]=_[_0x8c78('0x35')](_0x2f6a6b[_0x8c78('0x36')],qs['fields'](_0x4e4880[_0x8c78('0x33')][_0x8c78('0x38')]));_0x2841c2[_0x8c78('0x37')]=_0x2841c2[_0x8c78('0x37')][_0x8c78('0x39')]?_0x2841c2['attributes']:_0x2f6a6b[_0x8c78('0x36')];if(_0x4e4880['query']['includeAll']){_0x2841c2[_0x8c78('0x4a')]=[{'all':!![]}];}_0x2841c2=_[_0x8c78('0x42')]({},_0x2841c2,_0x4e4880[_0x8c78('0x4b')]);return db['Tag'][_0x8c78('0x4c')](_0x2841c2)[_0x8c78('0x24')](handleEntityNotFound(_0x545d90,null))[_0x8c78('0x24')](respondWithResult(_0x545d90,null))[_0x8c78('0x47')](handleError(_0x545d90,null));};exports[_0x8c78('0x4d')]=function(_0x38083e,_0x26103c){return db[_0x8c78('0x2d')][_0x8c78('0x4d')](_0x38083e['body'],{})[_0x8c78('0x24')](function(_0x1fcf97){var _0xba0de6=_0x38083e[_0x8c78('0x4e')]['get']({'plain':!![]});if(!_0xba0de6)throw new Error(_0x8c78('0x4f'));if(_0xba0de6[_0x8c78('0x50')]===_0x8c78('0x4e')){var _0x431125=_0x1fcf97['get']({'plain':!![]});var _0x336b95=_0x8c78('0x27');return db[_0x8c78('0x51')]['find']({'where':{'name':_0x336b95,'userProfileId':_0xba0de6[_0x8c78('0x52')]},'raw':!![]})['then'](function(_0xae80d){if(_0xae80d&&_0xae80d[_0x8c78('0x53')]===0x0){return db[_0x8c78('0x54')][_0x8c78('0x4d')]({'name':_0x431125[_0x8c78('0x2a')],'resourceId':_0x431125['id'],'type':_0xae80d[_0x8c78('0x2a')],'sectionId':_0xae80d['id']},{})[_0x8c78('0x24')](function(){return _0x1fcf97;});}else{return _0x1fcf97;}})[_0x8c78('0x47')](function(_0x19d807){logger[_0x8c78('0x28')](_0x8c78('0x55'),_0x19d807);throw _0x19d807;});}return _0x1fcf97;})[_0x8c78('0x24')](respondWithResult(_0x26103c,0xc9))[_0x8c78('0x47')](handleError(_0x26103c,null));};exports[_0x8c78('0x23')]=function(_0x54b40d,_0x22fe6c){if(_0x54b40d[_0x8c78('0x56')]['id']){delete _0x54b40d[_0x8c78('0x56')]['id'];}return db[_0x8c78('0x2d')]['find']({'where':{'id':_0x54b40d[_0x8c78('0x49')]['id']}})[_0x8c78('0x24')](handleEntityNotFound(_0x22fe6c,null))[_0x8c78('0x24')](saveUpdates(_0x54b40d[_0x8c78('0x56')],null))[_0x8c78('0x24')](respondWithResult(_0x22fe6c,null))[_0x8c78('0x47')](handleError(_0x22fe6c,null));};exports['destroy']=function(_0x1e616c,_0x42a34e){return db['Tag'][_0x8c78('0x4c')]({'where':{'id':_0x1e616c['params']['id']}})[_0x8c78('0x24')](handleEntityNotFound(_0x42a34e,null))[_0x8c78('0x24')](removeEntity(_0x42a34e,null))[_0x8c78('0x47')](handleError(_0x42a34e,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 2ed2017..5b5329e 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 _0x2b1e=['rimraf','exports','define','Tag','lodash','util','api','bluebird','request-promise','path'];(function(_0xc17730,_0x161eff){var _0x3d9ee0=function(_0x896275){while(--_0x896275){_0xc17730['push'](_0xc17730['shift']());}};_0x3d9ee0(++_0x161eff);}(_0x2b1e,0x72));var _0xe2b1=function(_0x53961e,_0x2ec410){_0x53961e=_0x53961e-0x0;var _0x53523a=_0x2b1e[_0x53961e];return _0x53523a;};'use strict';var _=require(_0xe2b1('0x0'));var util=require(_0xe2b1('0x1'));var logger=require('../../config/logger')(_0xe2b1('0x2'));var moment=require('moment');var BPromise=require(_0xe2b1('0x3'));var rp=require(_0xe2b1('0x4'));var fs=require('fs');var path=require(_0xe2b1('0x5'));var rimraf=require(_0xe2b1('0x6'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0xe2b1('0x7')]=function(_0x4837cd,_0x172367){return _0x4837cd[_0xe2b1('0x8')](_0xe2b1('0x9'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1232=['bluebird','request-promise','path','rimraf','../../config/environment','define','Tag','tools_tags','lodash','../../config/logger','api','moment'];(function(_0x2a5b40,_0x31a3e8){var _0x4ae065=function(_0x400e70){while(--_0x400e70){_0x2a5b40['push'](_0x2a5b40['shift']());}};_0x4ae065(++_0x31a3e8);}(_0x1232,0x188));var _0x2123=function(_0x2378d2,_0x4b260a){_0x2378d2=_0x2378d2-0x0;var _0x536901=_0x1232[_0x2378d2];return _0x536901;};'use strict';var _=require(_0x2123('0x0'));var util=require('util');var logger=require(_0x2123('0x1'))(_0x2123('0x2'));var moment=require(_0x2123('0x3'));var BPromise=require(_0x2123('0x4'));var rp=require(_0x2123('0x5'));var fs=require('fs');var path=require(_0x2123('0x6'));var rimraf=require(_0x2123('0x7'));var config=require(_0x2123('0x8'));var attributes=require('./tag.attributes');module['exports']=function(_0x14fd1f,_0x7996f2){return _0x14fd1f[_0x2123('0x9')](_0x2123('0xa'),attributes,{'tableName':_0x2123('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 2465efc..03c07ab 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 _0x84ab=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','Tag,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x2287c3,_0x2b34e2){var _0x448916=function(_0x25b23a){while(--_0x25b23a){_0x2287c3['push'](_0x2287c3['shift']());}};_0x448916(++_0x2b34e2);}(_0x84ab,0x12f));var _0xb84a=function(_0x4a0e68,_0x45c08c){_0x4a0e68=_0x4a0e68-0x0;var _0x4fb274=_0x84ab[_0x4a0e68];return _0x4fb274;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var moment=require(_0xb84a('0x2'));var BPromise=require(_0xb84a('0x3'));var rs=require(_0xb84a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb84a('0x5'))['db'];var utils=require(_0xb84a('0x6'));var logger=require('../../config/logger')(_0xb84a('0x7'));var config=require(_0xb84a('0x8'));var jayson=require(_0xb84a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4dc496,_0xd445b5,_0x4fac4d){return new BPromise(function(_0x3e9086,_0x8d9dbe){return client['request'](_0x4dc496,_0x4fac4d)[_0xb84a('0xa')](function(_0x525cb7){logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,_0xb84a('0xd'));logger['debug']('Tag,\x20%s,\x20%s,\x20%s',_0xd445b5,'request\x20sent',JSON[_0xb84a('0xe')](_0x525cb7));if(_0x525cb7[_0xb84a('0xf')]){if(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x10')]===0x1f4){logger[_0xb84a('0xf')]('Tag,\x20%s,\x20%s',_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x8d9dbe(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x3e9086(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}else{logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,'request\x20sent');_0x3e9086(_0x525cb7[_0xb84a('0x12')][_0xb84a('0x11')]);}})[_0xb84a('0x13')](function(_0x3c0b54){logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x3c0b54);_0x8d9dbe(_0x3c0b54);});});} \ No newline at end of file +var _0x8d9b=['rpc','../../config/environment','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8d9b,0x104));var _0xb8d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d9b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb8d9('0x0'));var util=require(_0xb8d9('0x1'));var moment=require(_0xb8d9('0x2'));var BPromise=require(_0xb8d9('0x3'));var rs=require(_0xb8d9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb8d9('0x5'));var logger=require('../../config/logger')(_0xb8d9('0x6'));var config=require(_0xb8d9('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x21c87d,_0x537b18,_0x53339b){return new BPromise(function(_0x4c2b8f,_0x13352e){return client[_0xb8d9('0x8')](_0x21c87d,_0x53339b)[_0xb8d9('0x9')](function(_0x2189b1){logger[_0xb8d9('0xa')](_0xb8d9('0xb'),_0x537b18,_0xb8d9('0xc'));logger['debug'](_0xb8d9('0xd'),_0x537b18,'request\x20sent',JSON[_0xb8d9('0xe')](_0x2189b1));if(_0x2189b1[_0xb8d9('0xf')]){if(_0x2189b1[_0xb8d9('0xf')][_0xb8d9('0x10')]===0x1f4){logger[_0xb8d9('0xf')](_0xb8d9('0xb'),_0x537b18,_0x2189b1[_0xb8d9('0xf')][_0xb8d9('0x11')]);return _0x13352e(_0x2189b1[_0xb8d9('0xf')][_0xb8d9('0x11')]);}logger[_0xb8d9('0xf')](_0xb8d9('0xb'),_0x537b18,_0x2189b1[_0xb8d9('0xf')][_0xb8d9('0x11')]);return _0x4c2b8f(_0x2189b1['error'][_0xb8d9('0x11')]);}else{logger[_0xb8d9('0xa')](_0xb8d9('0xb'),_0x537b18,_0xb8d9('0xc'));_0x4c2b8f(_0x2189b1[_0xb8d9('0x12')]['message']);}})['catch'](function(_0x5b7d5a){logger[_0xb8d9('0xf')](_0xb8d9('0xb'),_0x537b18,_0x5b7d5a);_0x13352e(_0x5b7d5a);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 7cea6e8..964e3e4 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 2f8ff94..adcbb24 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 _0xb7e7=['STRING','sequelize'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0xb7e7[_0x5834bc];return _0x3e183a;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0xe706=['STRING','sequelize','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xe706,0xa3));var _0x6e70=function(_0x72a33d,_0x5691da){_0x72a33d=_0x72a33d-0x0;var _0x2621d5=_0xe706[_0x72a33d];return _0x2621d5;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index bb8bdd8..a545f4d 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 _0x2e1c=['user','role','Teams','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','getQueues','findOne','channel','isValidChannel','capitalize','toLowerCase','Queues','ValidationError','Unknown\x20channel','add','ids','removeQueues','Sequelize','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','sequelize','through','QueueId','TeamVoiceQueue','Queue','findOrCreate','emit','Queue:save','online','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','TeamVoicePrefix','VoicePrefixId','spread','isArray','transaction','removeAgents','Queue:remove','UserVoicePrefix','getAgents','User','nolimit','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./team.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Team','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','catch','show','rawAttributes','keys'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x2e1c,0x1c8));var _0xc2e1=function(_0xb24013,_0x294d90){_0xb24013=_0xb24013-0x0;var _0x5a78eb=_0x2e1c[_0xb24013];return _0x5a78eb;};'use strict';var emlformat=require(_0xc2e1('0x0'));var rimraf=require(_0xc2e1('0x1'));var zipdir=require(_0xc2e1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc2e1('0x3'));var moment=require(_0xc2e1('0x4'));var BPromise=require(_0xc2e1('0x5'));var Mustache=require(_0xc2e1('0x6'));var util=require('util');var path=require(_0xc2e1('0x7'));var sox=require(_0xc2e1('0x8'));var csv=require('to-csv');var ejs=require(_0xc2e1('0x9'));var fs=require('fs');var fs_extra=require(_0xc2e1('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc2e1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc2e1('0xc'));var toCsv=require(_0xc2e1('0xd'));var querystring=require(_0xc2e1('0xe'));var Papa=require(_0xc2e1('0xf'));var Redis=require(_0xc2e1('0x10'));var authService=require(_0xc2e1('0x11'));var qs=require(_0xc2e1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc2e1('0x13'));var logger=require('../../config/logger')(_0xc2e1('0x14'));var utils=require('../../config/utils');var config=require(_0xc2e1('0x15'));var licenseUtil=require(_0xc2e1('0x16'));var db=require('../../mysqldb')['db'];config[_0xc2e1('0x17')]=_[_0xc2e1('0x18')](config[_0xc2e1('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xc2e1('0x19'))(new Redis(config[_0xc2e1('0x17')]));require(_0xc2e1('0x1a'))[_0xc2e1('0x1b')](socket);function respondWithStatusCode(_0x5ae645,_0x4852bf){_0x4852bf=_0x4852bf||0xcc;return function(_0x3b5a1a){if(_0x3b5a1a){return _0x5ae645[_0xc2e1('0x1c')](_0x4852bf);}return _0x5ae645['status'](_0x4852bf)[_0xc2e1('0x1d')]();};}function respondWithResult(_0x2b5344,_0xb4e59f){_0xb4e59f=_0xb4e59f||0xc8;return function(_0x3a09ff){if(_0x3a09ff){return _0x2b5344['status'](_0xb4e59f)[_0xc2e1('0x1e')](_0x3a09ff);}};}function respondWithFilteredResult(_0xdff2ca,_0x594148){return function(_0x29ce89){if(_0x29ce89){var _0x2ec1ff=typeof _0x594148[_0xc2e1('0x1f')]===_0xc2e1('0x20')&&typeof _0x594148[_0xc2e1('0x21')]===_0xc2e1('0x20');var _0x4391ca=_0x29ce89[_0xc2e1('0x22')];var _0x1c2b9d=_0x2ec1ff?0x0:_0x594148[_0xc2e1('0x1f')];var _0xd63a8b=_0x2ec1ff?_0x29ce89[_0xc2e1('0x22')]:_0x594148[_0xc2e1('0x1f')]+_0x594148[_0xc2e1('0x21')];var _0x27ac6e;if(_0xd63a8b>=_0x4391ca){_0xd63a8b=_0x4391ca;_0x27ac6e=0xc8;}else{_0x27ac6e=0xce;}_0xdff2ca[_0xc2e1('0x23')](_0x27ac6e);return _0xdff2ca[_0xc2e1('0x24')](_0xc2e1('0x25'),_0x1c2b9d+'-'+_0xd63a8b+'/'+_0x4391ca)[_0xc2e1('0x1e')](_0x29ce89);}return null;};}function patchUpdates(_0x3a554c){return function(_0x452da8){try{jsonpatch[_0xc2e1('0x26')](_0x452da8,_0x3a554c,!![]);}catch(_0x433981){return BPromise[_0xc2e1('0x27')](_0x433981);}return _0x452da8['save']();};}function saveUpdates(_0x522094,_0x3c0310){return function(_0x4756c0){if(_0x4756c0){return _0x4756c0[_0xc2e1('0x28')](_0x522094)[_0xc2e1('0x29')](function(_0x3ad17d){return _0x3ad17d;});}return null;};}function removeEntity(_0x13eff7,_0x24925b){return function(_0x26d921){if(_0x26d921){return _0x26d921[_0xc2e1('0x2a')]()['then'](function(){var _0x4790d1=_0x26d921[_0xc2e1('0x2b')]({'plain':!![]});var _0x552968='Teams';return db[_0xc2e1('0x2c')][_0xc2e1('0x2a')]({'where':{'type':_0x552968,'resourceId':_0x4790d1['id']}})['then'](function(){return _0x26d921;});})['then'](function(){_0x13eff7[_0xc2e1('0x23')](0xcc)[_0xc2e1('0x1d')]();});}};}function handleEntityNotFound(_0x323232,_0xa93bdb){return function(_0x42859b){if(!_0x42859b){_0x323232[_0xc2e1('0x1c')](0x194);}return _0x42859b;};}function handleError(_0x352bbb,_0x586125){_0x586125=_0x586125||0x1f4;return function(_0x4b1c07){logger[_0xc2e1('0x2d')](_0x4b1c07[_0xc2e1('0x2e')]);if(_0x4b1c07['name']){delete _0x4b1c07[_0xc2e1('0x2f')];}_0x352bbb[_0xc2e1('0x23')](_0x586125)[_0xc2e1('0x30')](_0x4b1c07);};}exports[_0xc2e1('0x31')]=function(_0x50c63a,_0x7a040d){var _0x54c893={},_0x354705={},_0x9e35d7={'count':0x0,'rows':[]};var _0x2035a8=_[_0xc2e1('0x32')](db[_0xc2e1('0x33')]['rawAttributes'],function(_0x2a6549){return{'name':_0x2a6549[_0xc2e1('0x34')],'type':_0x2a6549[_0xc2e1('0x35')]['key']};});_0x354705[_0xc2e1('0x36')]=_[_0xc2e1('0x32')](_0x2035a8,_0xc2e1('0x2f'));_0x354705[_0xc2e1('0x37')]=_['keys'](_0x50c63a['query']);_0x354705[_0xc2e1('0x38')]=_[_0xc2e1('0x39')](_0x354705[_0xc2e1('0x36')],_0x354705['query']);_0x54c893[_0xc2e1('0x3a')]=_[_0xc2e1('0x39')](_0x354705[_0xc2e1('0x36')],qs[_0xc2e1('0x3b')](_0x50c63a['query'][_0xc2e1('0x3b')]));_0x54c893[_0xc2e1('0x3a')]=_0x54c893[_0xc2e1('0x3a')][_0xc2e1('0x3c')]?_0x54c893[_0xc2e1('0x3a')]:_0x354705['model'];if(!_0x50c63a[_0xc2e1('0x37')][_0xc2e1('0x3d')]('nolimit')){_0x54c893[_0xc2e1('0x21')]=qs[_0xc2e1('0x21')](_0x50c63a[_0xc2e1('0x37')]['limit']);_0x54c893[_0xc2e1('0x1f')]=qs[_0xc2e1('0x1f')](_0x50c63a[_0xc2e1('0x37')][_0xc2e1('0x1f')]);}_0x54c893[_0xc2e1('0x3e')]=qs[_0xc2e1('0x3f')](_0x50c63a['query']['sort']);_0x54c893['where']=qs['filters'](_[_0xc2e1('0x40')](_0x50c63a['query'],_0x354705[_0xc2e1('0x38')]),_0x2035a8);if(_0x50c63a[_0xc2e1('0x37')]['filter']){_0x54c893[_0xc2e1('0x41')]=_[_0xc2e1('0x42')](_0x54c893[_0xc2e1('0x41')],{'$or':_[_0xc2e1('0x32')](_0x2035a8,function(_0x38e828){if(_0x38e828['type']!==_0xc2e1('0x43')){var _0x5a9704={};_0x5a9704[_0x38e828['name']]={'$like':'%'+_0x50c63a[_0xc2e1('0x37')][_0xc2e1('0x44')]+'%'};return _0x5a9704;}})});}_0x54c893=_[_0xc2e1('0x42')]({},_0x54c893,_0x50c63a['options']);var _0x3e5bc0={'where':_0x54c893[_0xc2e1('0x41')]};return db['Team'][_0xc2e1('0x22')](_0x3e5bc0)[_0xc2e1('0x29')](function(_0x13fe0b){_0x9e35d7[_0xc2e1('0x22')]=_0x13fe0b;if(_0x50c63a[_0xc2e1('0x37')][_0xc2e1('0x45')]){_0x54c893[_0xc2e1('0x46')]=[{'all':!![]}];}return db[_0xc2e1('0x33')][_0xc2e1('0x47')](_0x54c893);})[_0xc2e1('0x29')](function(_0x13a96a){_0x9e35d7['rows']=_0x13a96a;return _0x9e35d7;})['then'](respondWithFilteredResult(_0x7a040d,_0x54c893))[_0xc2e1('0x48')](handleError(_0x7a040d,null));};exports[_0xc2e1('0x49')]=function(_0x235ea8,_0x1d9193){var _0x8e12b1={'raw':![],'where':{'id':_0x235ea8['params']['id']}},_0x59a264={};_0x59a264[_0xc2e1('0x36')]=_['keys'](db[_0xc2e1('0x33')][_0xc2e1('0x4a')]);_0x59a264[_0xc2e1('0x37')]=_[_0xc2e1('0x4b')](_0x235ea8[_0xc2e1('0x37')]);_0x59a264[_0xc2e1('0x38')]=_[_0xc2e1('0x39')](_0x59a264['model'],_0x59a264['query']);_0x8e12b1[_0xc2e1('0x3a')]=_[_0xc2e1('0x39')](_0x59a264[_0xc2e1('0x36')],qs[_0xc2e1('0x3b')](_0x235ea8[_0xc2e1('0x37')][_0xc2e1('0x3b')]));_0x8e12b1[_0xc2e1('0x3a')]=_0x8e12b1[_0xc2e1('0x3a')]['length']?_0x8e12b1[_0xc2e1('0x3a')]:_0x59a264[_0xc2e1('0x36')];if(_0x235ea8[_0xc2e1('0x37')][_0xc2e1('0x45')]){_0x8e12b1[_0xc2e1('0x46')]=[{'all':!![]}];}_0x8e12b1=_[_0xc2e1('0x42')]({},_0x8e12b1,_0x235ea8['options']);return db[_0xc2e1('0x33')]['find'](_0x8e12b1)[_0xc2e1('0x29')](handleEntityNotFound(_0x1d9193,null))['then'](respondWithResult(_0x1d9193,null))[_0xc2e1('0x48')](handleError(_0x1d9193,null));};exports['create']=function(_0x4de476,_0x46e1ff){return db[_0xc2e1('0x33')]['create'](_0x4de476['body'],{})[_0xc2e1('0x29')](function(_0x352f5e){var _0x12e255=_0x4de476[_0xc2e1('0x4c')][_0xc2e1('0x2b')]({'plain':!![]});if(!_0x12e255)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12e255[_0xc2e1('0x4d')]===_0xc2e1('0x4c')){var _0x234204=_0x352f5e['get']({'plain':!![]});var _0x2f6858=_0xc2e1('0x4e');return db['UserProfileSection'][_0xc2e1('0x4f')]({'where':{'name':_0x2f6858,'userProfileId':_0x12e255['userProfileId']},'raw':!![]})[_0xc2e1('0x29')](function(_0x5c7c23){if(_0x5c7c23&&_0x5c7c23[_0xc2e1('0x50')]===0x0){return db[_0xc2e1('0x2c')]['create']({'name':_0x234204['name'],'resourceId':_0x234204['id'],'type':_0x5c7c23[_0xc2e1('0x2f')],'sectionId':_0x5c7c23['id']},{})[_0xc2e1('0x29')](function(){return _0x352f5e;});}else{return _0x352f5e;}})[_0xc2e1('0x48')](function(_0x519251){logger[_0xc2e1('0x2d')](_0xc2e1('0x51'),_0x519251);throw _0x519251;});}return _0x352f5e;})[_0xc2e1('0x29')](respondWithResult(_0x46e1ff,0xc9))[_0xc2e1('0x48')](handleError(_0x46e1ff,null));};exports[_0xc2e1('0x28')]=function(_0x87d9dd,_0x38c10c){if(_0x87d9dd[_0xc2e1('0x52')]['id']){delete _0x87d9dd[_0xc2e1('0x52')]['id'];}return db['Team'][_0xc2e1('0x4f')]({'where':{'id':_0x87d9dd[_0xc2e1('0x53')]['id']}})[_0xc2e1('0x29')](handleEntityNotFound(_0x38c10c,null))[_0xc2e1('0x29')](saveUpdates(_0x87d9dd['body'],null))[_0xc2e1('0x29')](respondWithResult(_0x38c10c,null))['catch'](handleError(_0x38c10c,null));};exports[_0xc2e1('0x2a')]=function(_0x142b2f,_0x24789e){return db[_0xc2e1('0x33')][_0xc2e1('0x4f')]({'where':{'id':_0x142b2f[_0xc2e1('0x53')]['id']}})[_0xc2e1('0x29')](handleEntityNotFound(_0x24789e,null))[_0xc2e1('0x29')](removeEntity(_0x24789e,null))[_0xc2e1('0x48')](handleError(_0x24789e,null));};exports[_0xc2e1('0x54')]=function(_0x149c3d,_0x588f84,_0x558497){return db[_0xc2e1('0x33')][_0xc2e1('0x55')]({'where':{'id':_0x149c3d[_0xc2e1('0x53')]['id']}})['then'](handleEntityNotFound(_0x588f84,null))['then'](function(_0x35c903){if(!_0x149c3d[_0xc2e1('0x37')][_0xc2e1('0x56')]||!utils[_0xc2e1('0x57')](_0x149c3d[_0xc2e1('0x37')][_0xc2e1('0x56')])){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}var _0x24e1ee={};var _0xfa1c90={};_0xfa1c90[_0xc2e1('0x36')]=_[_0xc2e1('0x4b')](db[_[_0xc2e1('0x58')](_0x149c3d[_0xc2e1('0x37')]['channel'][_0xc2e1('0x59')]())+'Queue'][_0xc2e1('0x4a')]);_0xfa1c90[_0xc2e1('0x37')]=_['keys'](_0x149c3d[_0xc2e1('0x37')]);_0xfa1c90[_0xc2e1('0x38')]=_[_0xc2e1('0x39')](_0xfa1c90[_0xc2e1('0x36')],_0xfa1c90['query']);_0x24e1ee[_0xc2e1('0x3a')]=_['intersection'](_0xfa1c90[_0xc2e1('0x36')],qs[_0xc2e1('0x3b')](_0x149c3d[_0xc2e1('0x37')]['fields']));_0x24e1ee[_0xc2e1('0x3a')]=_0x24e1ee['attributes'][_0xc2e1('0x3c')]?_0x24e1ee['attributes']:_0xfa1c90[_0xc2e1('0x36')];_0x24e1ee[_0xc2e1('0x21')]=qs[_0xc2e1('0x21')](_0x149c3d[_0xc2e1('0x37')][_0xc2e1('0x21')]);_0x24e1ee['offset']=qs['offset'](_0x149c3d['query'][_0xc2e1('0x1f')]);_0x24e1ee[_0xc2e1('0x3e')]=qs['sort'](_0x149c3d[_0xc2e1('0x37')]['sort']);_0x24e1ee[_0xc2e1('0x41')]=qs['filters'](_[_0xc2e1('0x40')](_0x149c3d['query'],_0xfa1c90[_0xc2e1('0x38')]));_0x24e1ee=_[_0xc2e1('0x42')]({},_0x24e1ee,_0x149c3d['options']);return _0x35c903[_0xc2e1('0x2b')+_[_0xc2e1('0x58')](_0x149c3d[_0xc2e1('0x37')][_0xc2e1('0x56')][_0xc2e1('0x59')]())+_0xc2e1('0x5a')](_0x24e1ee);})[_0xc2e1('0x29')](respondWithResult(_0x588f84,null))[_0xc2e1('0x48')](handleError(_0x588f84,null));};exports['addQueues']=function(_0x12c9a4,_0x4b6c5f,_0x35fd4a){return db[_0xc2e1('0x33')]['findOne']({'where':{'id':_0x12c9a4[_0xc2e1('0x53')]['id']}})[_0xc2e1('0x29')](function(_0x1b25df){if(_0x1b25df){if(!_0x12c9a4[_0xc2e1('0x52')][_0xc2e1('0x56')]||!utils['isValidChannel'](_0x12c9a4[_0xc2e1('0x52')][_0xc2e1('0x56')])){throw new db['Sequelize'][(_0xc2e1('0x5b'))](_0xc2e1('0x5c'));}return _0x1b25df[_0xc2e1('0x5d')+_[_0xc2e1('0x58')](_0x12c9a4[_0xc2e1('0x52')][_0xc2e1('0x56')][_0xc2e1('0x59')]())+_0xc2e1('0x5a')](_0x12c9a4[_0xc2e1('0x52')][_0xc2e1('0x5e')]);}return null;})[_0xc2e1('0x29')](handleEntityNotFound(_0x4b6c5f,null))[_0xc2e1('0x29')](respondWithStatusCode(_0x4b6c5f,null))[_0xc2e1('0x48')](handleError(_0x4b6c5f,null));};exports[_0xc2e1('0x5f')]=function(_0x20a18d,_0x1211f2,_0x4f3bd1){return db['Team']['findOne']({'where':{'id':_0x20a18d[_0xc2e1('0x53')]['id']}})[_0xc2e1('0x29')](function(_0x270bb4){if(_0x270bb4){if(!_0x20a18d[_0xc2e1('0x37')]['channel']||!utils[_0xc2e1('0x57')](_0x20a18d[_0xc2e1('0x37')][_0xc2e1('0x56')])){throw new db[(_0xc2e1('0x60'))]['ValidationError'](_0xc2e1('0x5c'));}return _0x270bb4[_0xc2e1('0x61')+_['capitalize'](_0x20a18d[_0xc2e1('0x37')][_0xc2e1('0x56')]['toLowerCase']())+_0xc2e1('0x5a')](_0x20a18d[_0xc2e1('0x37')]['ids']);}return null;})[_0xc2e1('0x29')](handleEntityNotFound(_0x1211f2,null))[_0xc2e1('0x29')](respondWithStatusCode(_0x1211f2,null))[_0xc2e1('0x48')](handleError(_0x1211f2,null));};exports[_0xc2e1('0x62')]=function(_0x9e9c75,_0x3d4cd8){var _0x2e001d=_['isArray'](_0x9e9c75[_0xc2e1('0x52')]['ids'])?_0x9e9c75['body'][_0xc2e1('0x5e')]:[_0x9e9c75['body'][_0xc2e1('0x5e')]];var _0x355149=_0x9e9c75['params']['id'];return db['Team'][_0xc2e1('0x4f')]({'where':{'id':_0x355149}})['then'](handleEntityNotFound(_0x3d4cd8,null))[_0xc2e1('0x29')](function(_0x5bf1d6){if(_0x5bf1d6){var _0x2ffd3e=[_0xc2e1('0x63'),_0xc2e1('0x64'),_0xc2e1('0x65'),_0xc2e1('0x66'),_0xc2e1('0x67'),_0xc2e1('0x68'),_0xc2e1('0x69')];return db[_0xc2e1('0x6a')]['transaction'](function(_0x54d34f){var _0x1ecfa3=_[_0xc2e1('0x32')](_0x2ffd3e,function(_0x5708ce){var _0x25889c={'attributes':['id',_0xc2e1('0x2f')]};if(_0x5708ce===_0xc2e1('0x63')){_0x25889c[_0xc2e1('0x6b')]={'attributes':['penalty']};}return _0x5bf1d6[_0xc2e1('0x2b')+_0x5708ce+'Queues'](_0x25889c)[_0xc2e1('0x29')](function(_0x2925dc){var _0xf1fd64=_['map'](_0x2925dc,function(_0x5853c6){var _0x29cc83=_[_0xc2e1('0x32')](_0x2e001d,function(_0x48bb78){var _0x2e09db={'where':{'UserId':_0x48bb78,[_0x5708ce+_0xc2e1('0x6c')]:_0x5853c6['id']},'transaction':_0x54d34f};if(_0x5708ce==='Voice'){_0x2e09db['defaults']={'penalty':_0x5853c6[_0xc2e1('0x6d')]['penalty']};}return db['User'+_0x5708ce+_0xc2e1('0x6e')][_0xc2e1('0x6f')](_0x2e09db)[_0xc2e1('0x29')](function(){socket[_0xc2e1('0x70')](_0xc2e1('0x4c')+_0x5708ce+_0xc2e1('0x71'),{'UserId':_0x48bb78,[_0x5708ce+_0xc2e1('0x6c')]:_0x5853c6['id']});if(_0x5708ce!=='Voice'){return;}return db['User'][_0xc2e1('0x47')]({'where':{'id':_0x2e001d,'online':0x1},'attributes':['id',_0xc2e1('0x2f'),_0xc2e1('0x72'),'voicePause',_0xc2e1('0x73')],'raw':!![]})[_0xc2e1('0x29')](function(_0x4f800c){var _0x1acf62=_['map'](_0x4f800c,function(_0x589208){return db[_0xc2e1('0x74')][_0xc2e1('0x75')]({'membername':_0x589208[_0xc2e1('0x2f')],'UserId':_0x589208['id'],'queue_name':_0x5853c6[_0xc2e1('0x2f')],'VoiceQueueId':_0x5853c6['id'],'interface':_[_0xc2e1('0x76')](_0x589208[_0xc2e1('0x73')])?util[_0xc2e1('0x77')](_0xc2e1('0x78'),_0x589208[_0xc2e1('0x2f')]):_0x589208[_0xc2e1('0x73')],'paused':_0x589208['voicePause']||![],'penalty':_0x5853c6[_0xc2e1('0x6d')]['penalty']},{'transaction':_0x54d34f});});return Promise[_0xc2e1('0x79')](_0x1acf62);});});});return Promise[_0xc2e1('0x79')](_0x29cc83);});return Promise[_0xc2e1('0x79')](_0xf1fd64);})[_0xc2e1('0x29')](function(){return db[_0xc2e1('0x7a')][_0xc2e1('0x55')]({'where':{'teamId':_0x355149}})[_0xc2e1('0x29')](function(_0x165679){if(_0x165679){var _0x405b46=_[_0xc2e1('0x32')](_0x2e001d,function(_0x4dfe48){db['UserVoicePrefix'][_0xc2e1('0x75')]({'UserId':_0x4dfe48,'VoicePrefixId':_0x165679[_0xc2e1('0x7b')]});});return Promise[_0xc2e1('0x79')](_0x405b46);}});});});return Promise[_0xc2e1('0x79')](_0x1ecfa3)[_0xc2e1('0x29')](function(){return _0x5bf1d6['addAgents'](_0x2e001d,{'transaction':_0x54d34f})[_0xc2e1('0x7c')](function(_0x3ee275){return _0x3ee275;});});});}})[_0xc2e1('0x29')](respondWithResult(_0x3d4cd8,null))[_0xc2e1('0x48')](handleError(_0x3d4cd8,null));};exports['removeAgents']=function(_0x1204ef,_0x453a51){var _0x504d92=_[_0xc2e1('0x7d')](_0x1204ef[_0xc2e1('0x37')]['ids'])?_0x1204ef[_0xc2e1('0x37')][_0xc2e1('0x5e')]:[_0x1204ef[_0xc2e1('0x37')][_0xc2e1('0x5e')]];var _0x3eb4bf=_0x1204ef[_0xc2e1('0x53')]['id'];return db['Team']['find']({'where':{'id':_0x3eb4bf}})[_0xc2e1('0x29')](handleEntityNotFound(_0x453a51,null))[_0xc2e1('0x29')](function(_0x1e09e9){if(_0x1e09e9){var _0x18ebe3=[_0xc2e1('0x63'),_0xc2e1('0x64'),_0xc2e1('0x65'),'Sms',_0xc2e1('0x67'),'Openchannel',_0xc2e1('0x69')];return db[_0xc2e1('0x6a')][_0xc2e1('0x7e')](function(_0x2a9563){var _0x4ae56f=_[_0xc2e1('0x32')](_0x18ebe3,function(_0x71b62e){var _0x48bc98={'attributes':['id',_0xc2e1('0x2f')]};return _0x1e09e9['get'+_0x71b62e+_0xc2e1('0x5a')](_0x48bc98)[_0xc2e1('0x29')](function(_0x1bf7e9){var _0x328704=_['map'](_0x1bf7e9,function(_0x133982){return _0x133982[_0xc2e1('0x7f')](_0x504d92,{'transaction':_0x2a9563})[_0xc2e1('0x29')](function(){var _0x1c01bd=_[_0xc2e1('0x32')](_0x504d92,function(_0x561532){socket['emit'](_0xc2e1('0x4c')+_0x71b62e+_0xc2e1('0x80'),{'UserId':Number(_0x561532),[_0x71b62e+'QueueId']:_0x133982['id']});if(_0x71b62e!=='Voice'){return;}return db[_0xc2e1('0x74')]['destroy']({'where':{'VoiceQueueId':_0x133982['id'],'UserId':_0x561532},'transaction':_0x2a9563});});return Promise[_0xc2e1('0x79')](_0x1c01bd);});});return Promise[_0xc2e1('0x79')](_0x328704);});});return Promise[_0xc2e1('0x79')](_0x4ae56f)[_0xc2e1('0x29')](function(){return _0x1e09e9[_0xc2e1('0x7f')](_0x504d92,{'transaction':_0x2a9563});})[_0xc2e1('0x29')](function(){return db[_0xc2e1('0x7a')][_0xc2e1('0x55')]({'where':{'teamId':_0x3eb4bf}})['then'](function(_0x5126a6){if(_0x5126a6){var _0x34dab6=_['map'](_0x504d92,function(_0xe605e5){db[_0xc2e1('0x81')][_0xc2e1('0x2a')]({'where':{'UserId':_0xe605e5,'VoicePrefixId':_0x5126a6[_0xc2e1('0x7b')]}});});return Promise[_0xc2e1('0x79')](_0x34dab6);}});});});}})[_0xc2e1('0x29')](respondWithStatusCode(_0x453a51,null))['catch'](handleError(_0x453a51,null));};exports[_0xc2e1('0x82')]=function(_0x1eb36c,_0x197f80,_0x25c73f){var _0x5e167c={};var _0x27bea8={};var _0x312d87;var _0x3e746d;return db[_0xc2e1('0x33')]['findOne']({'where':{'id':_0x1eb36c['params']['id']}})[_0xc2e1('0x29')](handleEntityNotFound(_0x197f80,null))['then'](function(_0x22343f){if(_0x22343f){_0x312d87=_0x22343f;_0x27bea8[_0xc2e1('0x36')]=_[_0xc2e1('0x4b')](db[_0xc2e1('0x83')]['rawAttributes']);_0x27bea8[_0xc2e1('0x37')]=_[_0xc2e1('0x4b')](_0x1eb36c['query']);_0x27bea8[_0xc2e1('0x38')]=_[_0xc2e1('0x39')](_0x27bea8[_0xc2e1('0x36')],_0x27bea8[_0xc2e1('0x37')]);_0x5e167c[_0xc2e1('0x3a')]=_[_0xc2e1('0x39')](_0x27bea8[_0xc2e1('0x36')],qs['fields'](_0x1eb36c['query'][_0xc2e1('0x3b')]));_0x5e167c[_0xc2e1('0x3a')]=_0x5e167c[_0xc2e1('0x3a')][_0xc2e1('0x3c')]?_0x5e167c['attributes']:_0x27bea8[_0xc2e1('0x36')];_0x5e167c['order']=qs[_0xc2e1('0x3f')](_0x1eb36c[_0xc2e1('0x37')][_0xc2e1('0x3f')]);_0x5e167c['where']=qs[_0xc2e1('0x38')](_[_0xc2e1('0x40')](_0x1eb36c[_0xc2e1('0x37')],_0x27bea8[_0xc2e1('0x38')]));if(_0x1eb36c[_0xc2e1('0x37')][_0xc2e1('0x44')]){_0x5e167c[_0xc2e1('0x41')]=_[_0xc2e1('0x42')](_0x5e167c[_0xc2e1('0x41')],{'$or':_[_0xc2e1('0x32')](_0x5e167c[_0xc2e1('0x3a')],function(_0x3905c0){var _0x2f6006={};_0x2f6006[_0x3905c0]={'$like':'%'+_0x1eb36c[_0xc2e1('0x37')][_0xc2e1('0x44')]+'%'};return _0x2f6006;})});}_0x5e167c=_[_0xc2e1('0x42')]({},_0x5e167c,_0x1eb36c['options']);return _0x312d87['getAgents'](_0x5e167c);}})[_0xc2e1('0x29')](function(_0x1f9e03){if(_0x1f9e03){_0x3e746d=_0x1f9e03[_0xc2e1('0x3c')];if(!_0x1eb36c[_0xc2e1('0x37')]['hasOwnProperty'](_0xc2e1('0x84'))){_0x5e167c['limit']=qs[_0xc2e1('0x21')](_0x1eb36c[_0xc2e1('0x37')][_0xc2e1('0x21')]);_0x5e167c[_0xc2e1('0x1f')]=qs[_0xc2e1('0x1f')](_0x1eb36c[_0xc2e1('0x37')][_0xc2e1('0x1f')]);}return _0x312d87['getAgents'](_0x5e167c);}})[_0xc2e1('0x29')](function(_0x1d015e){if(_0x1d015e){return _0x1d015e?{'count':_0x3e746d,'rows':_0x1d015e}:null;}})[_0xc2e1('0x29')](respondWithResult(_0x197f80,null))[_0xc2e1('0x48')](handleError(_0x197f80,null));}; \ No newline at end of file +var _0x0eb7=['upsert','isNil','format','SIP/%s','UserVoicePrefix','VoicePrefixId','all','spread','removeAgents','Whatsapp','transaction','TeamVoicePrefix','getAgents','User','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','sendStatus','status','end','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','index','Team','fieldName','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','map','type','VIRTUAL','options','includeAll','rows','catch','show','params','keys','rawAttributes','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','toLowerCase','Queue','Sequelize','capitalize','Queues','ids','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','sequelize','through','penalty','defaults','TeamVoiceQueue','emit','Queue:save','findAll','online','voicePause','interface','UserVoiceQueueRt'];(function(_0xf26869,_0x3f15b6){var _0xe6e2fb=function(_0x39dac6){while(--_0x39dac6){_0xf26869['push'](_0xf26869['shift']());}};_0xe6e2fb(++_0x3f15b6);}(_0x0eb7,0x96));var _0x70eb=function(_0xe1607f,_0x4dad2d){_0xe1607f=_0xe1607f-0x0;var _0x792fc8=_0x0eb7[_0xe1607f];return _0x792fc8;};'use strict';var emlformat=require(_0x70eb('0x0'));var rimraf=require(_0x70eb('0x1'));var zipdir=require(_0x70eb('0x2'));var jsonpatch=require(_0x70eb('0x3'));var rp=require(_0x70eb('0x4'));var moment=require(_0x70eb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x70eb('0x6'));var util=require(_0x70eb('0x7'));var path=require('path');var sox=require(_0x70eb('0x8'));var csv=require('to-csv');var ejs=require(_0x70eb('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x70eb('0xa'));var squel=require('squel');var crypto=require(_0x70eb('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x70eb('0xc'));var querystring=require(_0x70eb('0xd'));var Papa=require(_0x70eb('0xe'));var Redis=require(_0x70eb('0xf'));var authService=require(_0x70eb('0x10'));var qs=require(_0x70eb('0x11'));var as=require(_0x70eb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x70eb('0x13'))('api');var utils=require(_0x70eb('0x14'));var config=require(_0x70eb('0x15'));var licenseUtil=require(_0x70eb('0x16'));var db=require(_0x70eb('0x17'))['db'];config[_0x70eb('0x18')]=_['defaults'](config['redis'],{'host':_0x70eb('0x19'),'port':0x18eb});var socket=require(_0x70eb('0x1a'))(new Redis(config[_0x70eb('0x18')]));require(_0x70eb('0x1b'))['register'](socket);function respondWithStatusCode(_0x27f375,_0x5ea579){_0x5ea579=_0x5ea579||0xcc;return function(_0x3b755e){if(_0x3b755e){return _0x27f375[_0x70eb('0x1c')](_0x5ea579);}return _0x27f375[_0x70eb('0x1d')](_0x5ea579)[_0x70eb('0x1e')]();};}function respondWithResult(_0x351005,_0x268261){_0x268261=_0x268261||0xc8;return function(_0x157b27){if(_0x157b27){return _0x351005[_0x70eb('0x1d')](_0x268261)['json'](_0x157b27);}};}function respondWithFilteredResult(_0x519c6c,_0x445752){return function(_0x4f3b84){if(_0x4f3b84){var _0x563a03=typeof _0x445752['offset']==='undefined'&&typeof _0x445752[_0x70eb('0x1f')]===_0x70eb('0x20');var _0x1c9199=_0x4f3b84[_0x70eb('0x21')];var _0x3098ef=_0x563a03?0x0:_0x445752['offset'];var _0xaaf0a8=_0x563a03?_0x4f3b84['count']:_0x445752['offset']+_0x445752['limit'];var _0x468911;if(_0xaaf0a8>=_0x1c9199){_0xaaf0a8=_0x1c9199;_0x468911=0xc8;}else{_0x468911=0xce;}_0x519c6c[_0x70eb('0x1d')](_0x468911);return _0x519c6c[_0x70eb('0x22')](_0x70eb('0x23'),_0x3098ef+'-'+_0xaaf0a8+'/'+_0x1c9199)[_0x70eb('0x24')](_0x4f3b84);}return null;};}function patchUpdates(_0x594c96){return function(_0x1fae3b){try{jsonpatch[_0x70eb('0x25')](_0x1fae3b,_0x594c96,!![]);}catch(_0x1e532e){return BPromise[_0x70eb('0x26')](_0x1e532e);}return _0x1fae3b['save']();};}function saveUpdates(_0x557d7e,_0x72e6f0){return function(_0x17e4ed){if(_0x17e4ed){return _0x17e4ed[_0x70eb('0x27')](_0x557d7e)[_0x70eb('0x28')](function(_0x4c800f){return _0x4c800f;});}return null;};}function removeEntity(_0x585cc1,_0x4ba286){return function(_0x22b117){if(_0x22b117){return _0x22b117[_0x70eb('0x29')]()[_0x70eb('0x28')](function(){var _0x5daac6=_0x22b117[_0x70eb('0x2a')]({'plain':!![]});var _0x2b86e2='Teams';return db[_0x70eb('0x2b')][_0x70eb('0x29')]({'where':{'type':_0x2b86e2,'resourceId':_0x5daac6['id']}})[_0x70eb('0x28')](function(){return _0x22b117;});})[_0x70eb('0x28')](function(){_0x585cc1[_0x70eb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d1de9,_0x3c1b0c){return function(_0xdc1f43){if(!_0xdc1f43){_0x5d1de9[_0x70eb('0x1c')](0x194);}return _0xdc1f43;};}function handleError(_0x1bb9ee,_0x5e96f3){_0x5e96f3=_0x5e96f3||0x1f4;return function(_0x129232){logger[_0x70eb('0x2c')](_0x129232[_0x70eb('0x2d')]);if(_0x129232['name']){delete _0x129232[_0x70eb('0x2e')];}_0x1bb9ee[_0x70eb('0x1d')](_0x5e96f3)['send'](_0x129232);};}exports[_0x70eb('0x2f')]=function(_0x396e4d,_0x4730b4){var _0x419e78={},_0x665787={},_0x144798={'count':0x0,'rows':[]};var _0x3a111a=_['map'](db[_0x70eb('0x30')]['rawAttributes'],function(_0x163f2a){return{'name':_0x163f2a[_0x70eb('0x31')],'type':_0x163f2a['type']['key']};});_0x665787[_0x70eb('0x32')]=_['map'](_0x3a111a,_0x70eb('0x2e'));_0x665787[_0x70eb('0x33')]=_['keys'](_0x396e4d[_0x70eb('0x33')]);_0x665787[_0x70eb('0x34')]=_[_0x70eb('0x35')](_0x665787[_0x70eb('0x32')],_0x665787[_0x70eb('0x33')]);_0x419e78[_0x70eb('0x36')]=_[_0x70eb('0x35')](_0x665787['model'],qs[_0x70eb('0x37')](_0x396e4d[_0x70eb('0x33')]['fields']));_0x419e78[_0x70eb('0x36')]=_0x419e78[_0x70eb('0x36')]['length']?_0x419e78[_0x70eb('0x36')]:_0x665787[_0x70eb('0x32')];if(!_0x396e4d[_0x70eb('0x33')][_0x70eb('0x38')](_0x70eb('0x39'))){_0x419e78[_0x70eb('0x1f')]=qs['limit'](_0x396e4d[_0x70eb('0x33')]['limit']);_0x419e78[_0x70eb('0x3a')]=qs[_0x70eb('0x3a')](_0x396e4d['query'][_0x70eb('0x3a')]);}_0x419e78[_0x70eb('0x3b')]=qs[_0x70eb('0x3c')](_0x396e4d['query'][_0x70eb('0x3c')]);_0x419e78[_0x70eb('0x3d')]=qs['filters'](_['pick'](_0x396e4d[_0x70eb('0x33')],_0x665787['filters']),_0x3a111a);if(_0x396e4d[_0x70eb('0x33')][_0x70eb('0x3e')]){_0x419e78[_0x70eb('0x3d')]=_[_0x70eb('0x3f')](_0x419e78[_0x70eb('0x3d')],{'$or':_[_0x70eb('0x40')](_0x3a111a,function(_0x28aabc){if(_0x28aabc[_0x70eb('0x41')]!==_0x70eb('0x42')){var _0x4915f4={};_0x4915f4[_0x28aabc[_0x70eb('0x2e')]]={'$like':'%'+_0x396e4d[_0x70eb('0x33')][_0x70eb('0x3e')]+'%'};return _0x4915f4;}})});}_0x419e78=_[_0x70eb('0x3f')]({},_0x419e78,_0x396e4d[_0x70eb('0x43')]);var _0x358a42={'where':_0x419e78[_0x70eb('0x3d')]};return db[_0x70eb('0x30')][_0x70eb('0x21')](_0x358a42)[_0x70eb('0x28')](function(_0xb3e62b){_0x144798['count']=_0xb3e62b;if(_0x396e4d[_0x70eb('0x33')][_0x70eb('0x44')]){_0x419e78['include']=[{'all':!![]}];}return db[_0x70eb('0x30')]['findAll'](_0x419e78);})[_0x70eb('0x28')](function(_0xa370ca){_0x144798[_0x70eb('0x45')]=_0xa370ca;return _0x144798;})[_0x70eb('0x28')](respondWithFilteredResult(_0x4730b4,_0x419e78))[_0x70eb('0x46')](handleError(_0x4730b4,null));};exports[_0x70eb('0x47')]=function(_0x22f778,_0x1941bb){var _0x2f6ac0={'raw':![],'where':{'id':_0x22f778[_0x70eb('0x48')]['id']}},_0x4e42d8={};_0x4e42d8[_0x70eb('0x32')]=_[_0x70eb('0x49')](db[_0x70eb('0x30')][_0x70eb('0x4a')]);_0x4e42d8[_0x70eb('0x33')]=_[_0x70eb('0x49')](_0x22f778[_0x70eb('0x33')]);_0x4e42d8['filters']=_[_0x70eb('0x35')](_0x4e42d8[_0x70eb('0x32')],_0x4e42d8['query']);_0x2f6ac0[_0x70eb('0x36')]=_['intersection'](_0x4e42d8[_0x70eb('0x32')],qs[_0x70eb('0x37')](_0x22f778[_0x70eb('0x33')][_0x70eb('0x37')]));_0x2f6ac0[_0x70eb('0x36')]=_0x2f6ac0['attributes'][_0x70eb('0x4b')]?_0x2f6ac0[_0x70eb('0x36')]:_0x4e42d8[_0x70eb('0x32')];if(_0x22f778[_0x70eb('0x33')][_0x70eb('0x44')]){_0x2f6ac0[_0x70eb('0x4c')]=[{'all':!![]}];}_0x2f6ac0=_[_0x70eb('0x3f')]({},_0x2f6ac0,_0x22f778[_0x70eb('0x43')]);return db['Team'][_0x70eb('0x4d')](_0x2f6ac0)['then'](handleEntityNotFound(_0x1941bb,null))[_0x70eb('0x28')](respondWithResult(_0x1941bb,null))[_0x70eb('0x46')](handleError(_0x1941bb,null));};exports[_0x70eb('0x4e')]=function(_0x1565f2,_0x4db6bf){return db[_0x70eb('0x30')][_0x70eb('0x4e')](_0x1565f2[_0x70eb('0x4f')],{})['then'](function(_0x459f57){var _0x1d63c2=_0x1565f2[_0x70eb('0x50')][_0x70eb('0x2a')]({'plain':!![]});if(!_0x1d63c2)throw new Error(_0x70eb('0x51'));if(_0x1d63c2[_0x70eb('0x52')]==='user'){var _0x4c79ec=_0x459f57['get']({'plain':!![]});var _0x20c796=_0x70eb('0x53');return db[_0x70eb('0x54')][_0x70eb('0x4d')]({'where':{'name':_0x20c796,'userProfileId':_0x1d63c2['userProfileId']},'raw':!![]})[_0x70eb('0x28')](function(_0x2d72d7){if(_0x2d72d7&&_0x2d72d7[_0x70eb('0x55')]===0x0){return db[_0x70eb('0x2b')][_0x70eb('0x4e')]({'name':_0x4c79ec[_0x70eb('0x2e')],'resourceId':_0x4c79ec['id'],'type':_0x2d72d7['name'],'sectionId':_0x2d72d7['id']},{})[_0x70eb('0x28')](function(){return _0x459f57;});}else{return _0x459f57;}})[_0x70eb('0x46')](function(_0x2617e5){logger[_0x70eb('0x2c')](_0x70eb('0x56'),_0x2617e5);throw _0x2617e5;});}return _0x459f57;})[_0x70eb('0x28')](respondWithResult(_0x4db6bf,0xc9))[_0x70eb('0x46')](handleError(_0x4db6bf,null));};exports['update']=function(_0x499f61,_0x4b6066){if(_0x499f61[_0x70eb('0x4f')]['id']){delete _0x499f61[_0x70eb('0x4f')]['id'];}return db['Team'][_0x70eb('0x4d')]({'where':{'id':_0x499f61[_0x70eb('0x48')]['id']}})[_0x70eb('0x28')](handleEntityNotFound(_0x4b6066,null))[_0x70eb('0x28')](saveUpdates(_0x499f61[_0x70eb('0x4f')],null))[_0x70eb('0x28')](respondWithResult(_0x4b6066,null))[_0x70eb('0x46')](handleError(_0x4b6066,null));};exports[_0x70eb('0x29')]=function(_0x19749b,_0x22b6c1){return db['Team'][_0x70eb('0x4d')]({'where':{'id':_0x19749b['params']['id']}})['then'](handleEntityNotFound(_0x22b6c1,null))[_0x70eb('0x28')](removeEntity(_0x22b6c1,null))[_0x70eb('0x46')](handleError(_0x22b6c1,null));};exports[_0x70eb('0x57')]=function(_0x69a7ac,_0xa897e9,_0x464851){return db[_0x70eb('0x30')][_0x70eb('0x58')]({'where':{'id':_0x69a7ac['params']['id']}})[_0x70eb('0x28')](handleEntityNotFound(_0xa897e9,null))['then'](function(_0x1b442c){if(!_0x69a7ac[_0x70eb('0x33')][_0x70eb('0x59')]||!utils[_0x70eb('0x5a')](_0x69a7ac['query']['channel'])){throw new db['Sequelize'][(_0x70eb('0x5b'))](_0x70eb('0x5c'));}var _0x1f3177={};var _0x1b65e6={};_0x1b65e6['model']=_['keys'](db[_['capitalize'](_0x69a7ac['query'][_0x70eb('0x59')][_0x70eb('0x5d')]())+_0x70eb('0x5e')][_0x70eb('0x4a')]);_0x1b65e6[_0x70eb('0x33')]=_[_0x70eb('0x49')](_0x69a7ac[_0x70eb('0x33')]);_0x1b65e6[_0x70eb('0x34')]=_[_0x70eb('0x35')](_0x1b65e6['model'],_0x1b65e6[_0x70eb('0x33')]);_0x1f3177[_0x70eb('0x36')]=_[_0x70eb('0x35')](_0x1b65e6[_0x70eb('0x32')],qs['fields'](_0x69a7ac[_0x70eb('0x33')][_0x70eb('0x37')]));_0x1f3177[_0x70eb('0x36')]=_0x1f3177[_0x70eb('0x36')][_0x70eb('0x4b')]?_0x1f3177['attributes']:_0x1b65e6['model'];_0x1f3177[_0x70eb('0x1f')]=qs[_0x70eb('0x1f')](_0x69a7ac[_0x70eb('0x33')][_0x70eb('0x1f')]);_0x1f3177[_0x70eb('0x3a')]=qs[_0x70eb('0x3a')](_0x69a7ac[_0x70eb('0x33')][_0x70eb('0x3a')]);_0x1f3177[_0x70eb('0x3b')]=qs[_0x70eb('0x3c')](_0x69a7ac[_0x70eb('0x33')][_0x70eb('0x3c')]);_0x1f3177[_0x70eb('0x3d')]=qs['filters'](_['pick'](_0x69a7ac['query'],_0x1b65e6[_0x70eb('0x34')]));_0x1f3177=_[_0x70eb('0x3f')]({},_0x1f3177,_0x69a7ac['options']);return _0x1b442c[_0x70eb('0x2a')+_['capitalize'](_0x69a7ac[_0x70eb('0x33')][_0x70eb('0x59')][_0x70eb('0x5d')]())+'Queues'](_0x1f3177);})[_0x70eb('0x28')](respondWithResult(_0xa897e9,null))[_0x70eb('0x46')](handleError(_0xa897e9,null));};exports['addQueues']=function(_0x411929,_0x1f5578,_0x3bef52){return db[_0x70eb('0x30')]['findOne']({'where':{'id':_0x411929[_0x70eb('0x48')]['id']}})['then'](function(_0x25adc9){if(_0x25adc9){if(!_0x411929[_0x70eb('0x4f')][_0x70eb('0x59')]||!utils[_0x70eb('0x5a')](_0x411929['body'][_0x70eb('0x59')])){throw new db[(_0x70eb('0x5f'))][(_0x70eb('0x5b'))]('Unknown\x20channel');}return _0x25adc9['add'+_[_0x70eb('0x60')](_0x411929['body'][_0x70eb('0x59')]['toLowerCase']())+_0x70eb('0x61')](_0x411929[_0x70eb('0x4f')][_0x70eb('0x62')]);}return null;})[_0x70eb('0x28')](handleEntityNotFound(_0x1f5578,null))['then'](respondWithStatusCode(_0x1f5578,null))[_0x70eb('0x46')](handleError(_0x1f5578,null));};exports['removeQueues']=function(_0x512cca,_0x461a57,_0x223be8){return db[_0x70eb('0x30')]['findOne']({'where':{'id':_0x512cca[_0x70eb('0x48')]['id']}})[_0x70eb('0x28')](function(_0x2ff689){if(_0x2ff689){if(!_0x512cca['query'][_0x70eb('0x59')]||!utils[_0x70eb('0x5a')](_0x512cca['query'][_0x70eb('0x59')])){throw new db['Sequelize'][(_0x70eb('0x5b'))](_0x70eb('0x5c'));}return _0x2ff689[_0x70eb('0x63')+_[_0x70eb('0x60')](_0x512cca[_0x70eb('0x33')][_0x70eb('0x59')][_0x70eb('0x5d')]())+_0x70eb('0x61')](_0x512cca[_0x70eb('0x33')][_0x70eb('0x62')]);}return null;})['then'](handleEntityNotFound(_0x461a57,null))[_0x70eb('0x28')](respondWithStatusCode(_0x461a57,null))[_0x70eb('0x46')](handleError(_0x461a57,null));};exports[_0x70eb('0x64')]=function(_0x4e2725,_0x2d938f){var _0x19c5b3=_[_0x70eb('0x65')](_0x4e2725[_0x70eb('0x4f')][_0x70eb('0x62')])?_0x4e2725[_0x70eb('0x4f')]['ids']:[_0x4e2725['body'][_0x70eb('0x62')]];var _0xe3ea1f=_0x4e2725['params']['id'];return db['Team']['find']({'where':{'id':_0xe3ea1f}})[_0x70eb('0x28')](handleEntityNotFound(_0x2d938f,null))['then'](function(_0x3d4724){if(_0x3d4724){var _0x52aaec=[_0x70eb('0x66'),_0x70eb('0x67'),_0x70eb('0x68'),_0x70eb('0x69'),_0x70eb('0x6a'),_0x70eb('0x6b'),'Whatsapp'];return db[_0x70eb('0x6c')]['transaction'](function(_0x3c57ed){var _0x19fab1=_[_0x70eb('0x40')](_0x52aaec,function(_0xc28dd){var _0x109832={'attributes':['id',_0x70eb('0x2e')]};if(_0xc28dd===_0x70eb('0x66')){_0x109832[_0x70eb('0x6d')]={'attributes':[_0x70eb('0x6e')]};}return _0x3d4724['get'+_0xc28dd+'Queues'](_0x109832)[_0x70eb('0x28')](function(_0x53001e){var _0x2eb729=_[_0x70eb('0x40')](_0x53001e,function(_0xd84b66){var _0x10f79f=_[_0x70eb('0x40')](_0x19c5b3,function(_0x4e7808){var _0x26d8b4={'where':{'UserId':_0x4e7808,[_0xc28dd+'QueueId']:_0xd84b66['id']},'transaction':_0x3c57ed};if(_0xc28dd===_0x70eb('0x66')){_0x26d8b4[_0x70eb('0x6f')]={'penalty':_0xd84b66[_0x70eb('0x70')][_0x70eb('0x6e')]};}return db['User'+_0xc28dd+'Queue']['findOrCreate'](_0x26d8b4)[_0x70eb('0x28')](function(){socket[_0x70eb('0x71')](_0x70eb('0x50')+_0xc28dd+_0x70eb('0x72'),{'UserId':_0x4e7808,[_0xc28dd+'QueueId']:_0xd84b66['id']});if(_0xc28dd!==_0x70eb('0x66')){return;}return db['User'][_0x70eb('0x73')]({'where':{'id':_0x19c5b3,'online':0x1},'attributes':['id',_0x70eb('0x2e'),_0x70eb('0x74'),_0x70eb('0x75'),_0x70eb('0x76')],'raw':!![]})[_0x70eb('0x28')](function(_0x2e47f5){var _0x44dc7e=_[_0x70eb('0x40')](_0x2e47f5,function(_0x2fd3fc){return db[_0x70eb('0x77')][_0x70eb('0x78')]({'membername':_0x2fd3fc['name'],'UserId':_0x2fd3fc['id'],'queue_name':_0xd84b66[_0x70eb('0x2e')],'VoiceQueueId':_0xd84b66['id'],'interface':_[_0x70eb('0x79')](_0x2fd3fc[_0x70eb('0x76')])?util[_0x70eb('0x7a')](_0x70eb('0x7b'),_0x2fd3fc[_0x70eb('0x2e')]):_0x2fd3fc['interface'],'paused':_0x2fd3fc[_0x70eb('0x75')]||![],'penalty':_0xd84b66['TeamVoiceQueue']['penalty']},{'transaction':_0x3c57ed});});return Promise['all'](_0x44dc7e);});});});return Promise['all'](_0x10f79f);});return Promise['all'](_0x2eb729);})['then'](function(){return db['TeamVoicePrefix'][_0x70eb('0x58')]({'where':{'teamId':_0xe3ea1f}})[_0x70eb('0x28')](function(_0x27948b){if(_0x27948b){var _0x166915=_[_0x70eb('0x40')](_0x19c5b3,function(_0x46844b){db[_0x70eb('0x7c')][_0x70eb('0x78')]({'UserId':_0x46844b,'VoicePrefixId':_0x27948b[_0x70eb('0x7d')]});});return Promise[_0x70eb('0x7e')](_0x166915);}});});});return Promise['all'](_0x19fab1)['then'](function(){return _0x3d4724[_0x70eb('0x64')](_0x19c5b3,{'transaction':_0x3c57ed})[_0x70eb('0x7f')](function(_0x393131){return _0x393131;});});});}})[_0x70eb('0x28')](respondWithResult(_0x2d938f,null))[_0x70eb('0x46')](handleError(_0x2d938f,null));};exports[_0x70eb('0x80')]=function(_0x3cd09b,_0x29cbd5){var _0x6a7ece=_[_0x70eb('0x65')](_0x3cd09b[_0x70eb('0x33')]['ids'])?_0x3cd09b[_0x70eb('0x33')][_0x70eb('0x62')]:[_0x3cd09b[_0x70eb('0x33')][_0x70eb('0x62')]];var _0x3b8df6=_0x3cd09b[_0x70eb('0x48')]['id'];return db[_0x70eb('0x30')][_0x70eb('0x4d')]({'where':{'id':_0x3b8df6}})[_0x70eb('0x28')](handleEntityNotFound(_0x29cbd5,null))[_0x70eb('0x28')](function(_0x17af9d){if(_0x17af9d){var _0x2fde88=[_0x70eb('0x66'),_0x70eb('0x67'),'Mail','Sms','Fax',_0x70eb('0x6b'),_0x70eb('0x81')];return db[_0x70eb('0x6c')][_0x70eb('0x82')](function(_0x2907ce){var _0x44824c=_['map'](_0x2fde88,function(_0x4dd729){var _0x39fb4d={'attributes':['id',_0x70eb('0x2e')]};return _0x17af9d[_0x70eb('0x2a')+_0x4dd729+_0x70eb('0x61')](_0x39fb4d)['then'](function(_0x1bbac2){var _0x7f7e70=_[_0x70eb('0x40')](_0x1bbac2,function(_0x26c044){return _0x26c044[_0x70eb('0x80')](_0x6a7ece,{'transaction':_0x2907ce})[_0x70eb('0x28')](function(){var _0x55a4fa=_['map'](_0x6a7ece,function(_0x2016b5){socket[_0x70eb('0x71')](_0x70eb('0x50')+_0x4dd729+'Queue:remove',{'UserId':Number(_0x2016b5),[_0x4dd729+'QueueId']:_0x26c044['id']});if(_0x4dd729!==_0x70eb('0x66')){return;}return db[_0x70eb('0x77')][_0x70eb('0x29')]({'where':{'VoiceQueueId':_0x26c044['id'],'UserId':_0x2016b5},'transaction':_0x2907ce});});return Promise['all'](_0x55a4fa);});});return Promise[_0x70eb('0x7e')](_0x7f7e70);});});return Promise[_0x70eb('0x7e')](_0x44824c)[_0x70eb('0x28')](function(){return _0x17af9d['removeAgents'](_0x6a7ece,{'transaction':_0x2907ce});})['then'](function(){return db[_0x70eb('0x83')]['findOne']({'where':{'teamId':_0x3b8df6}})[_0x70eb('0x28')](function(_0x5556d2){if(_0x5556d2){var _0x115b14=_[_0x70eb('0x40')](_0x6a7ece,function(_0x97baa8){db[_0x70eb('0x7c')][_0x70eb('0x29')]({'where':{'UserId':_0x97baa8,'VoicePrefixId':_0x5556d2['VoicePrefixId']}});});return Promise[_0x70eb('0x7e')](_0x115b14);}});});});}})['then'](respondWithStatusCode(_0x29cbd5,null))[_0x70eb('0x46')](handleError(_0x29cbd5,null));};exports[_0x70eb('0x84')]=function(_0x4302a7,_0xcc8536,_0x3d8bea){var _0x148027={};var _0x57c9f2={};var _0x28ef5a;var _0x404dc1;return db[_0x70eb('0x30')][_0x70eb('0x58')]({'where':{'id':_0x4302a7[_0x70eb('0x48')]['id']}})['then'](handleEntityNotFound(_0xcc8536,null))['then'](function(_0x3e775d){if(_0x3e775d){_0x28ef5a=_0x3e775d;_0x57c9f2['model']=_[_0x70eb('0x49')](db[_0x70eb('0x85')][_0x70eb('0x4a')]);_0x57c9f2['query']=_['keys'](_0x4302a7[_0x70eb('0x33')]);_0x57c9f2[_0x70eb('0x34')]=_['intersection'](_0x57c9f2[_0x70eb('0x32')],_0x57c9f2['query']);_0x148027[_0x70eb('0x36')]=_[_0x70eb('0x35')](_0x57c9f2[_0x70eb('0x32')],qs[_0x70eb('0x37')](_0x4302a7[_0x70eb('0x33')][_0x70eb('0x37')]));_0x148027[_0x70eb('0x36')]=_0x148027['attributes']['length']?_0x148027[_0x70eb('0x36')]:_0x57c9f2[_0x70eb('0x32')];_0x148027[_0x70eb('0x3b')]=qs[_0x70eb('0x3c')](_0x4302a7['query']['sort']);_0x148027[_0x70eb('0x3d')]=qs[_0x70eb('0x34')](_[_0x70eb('0x86')](_0x4302a7[_0x70eb('0x33')],_0x57c9f2[_0x70eb('0x34')]));if(_0x4302a7['query'][_0x70eb('0x3e')]){_0x148027[_0x70eb('0x3d')]=_[_0x70eb('0x3f')](_0x148027['where'],{'$or':_[_0x70eb('0x40')](_0x148027[_0x70eb('0x36')],function(_0xaf40a0){var _0x3191dc={};_0x3191dc[_0xaf40a0]={'$like':'%'+_0x4302a7[_0x70eb('0x33')][_0x70eb('0x3e')]+'%'};return _0x3191dc;})});}_0x148027=_[_0x70eb('0x3f')]({},_0x148027,_0x4302a7[_0x70eb('0x43')]);return _0x28ef5a['getAgents'](_0x148027);}})[_0x70eb('0x28')](function(_0x4f13f2){if(_0x4f13f2){_0x404dc1=_0x4f13f2[_0x70eb('0x4b')];if(!_0x4302a7[_0x70eb('0x33')]['hasOwnProperty'](_0x70eb('0x39'))){_0x148027[_0x70eb('0x1f')]=qs[_0x70eb('0x1f')](_0x4302a7[_0x70eb('0x33')][_0x70eb('0x1f')]);_0x148027['offset']=qs['offset'](_0x4302a7['query'][_0x70eb('0x3a')]);}return _0x28ef5a[_0x70eb('0x84')](_0x148027);}})[_0x70eb('0x28')](function(_0x4741fe){if(_0x4741fe){return _0x4741fe?{'count':_0x404dc1,'rows':_0x4741fe}:null;}})[_0x70eb('0x28')](respondWithResult(_0xcc8536,null))['catch'](handleError(_0xcc8536,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 7c3318e..d1271a6 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 _0xd79f=['hook','exports','../../mysqldb','save','remove','emit'];(function(_0x5e4548,_0x15f588){var _0x228870=function(_0x2f95fb){while(--_0x2f95fb){_0x5e4548['push'](_0x5e4548['shift']());}};_0x228870(++_0x15f588);}(_0xd79f,0x122));var _0xfd79=function(_0x2aaf41,_0x24923a){_0x2aaf41=_0x2aaf41-0x0;var _0x22b0b0=_0xd79f[_0x2aaf41];return _0x22b0b0;};'use strict';var EventEmitter=require('events');var Team=require(_0xfd79('0x0'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfd79('0x1'),'afterUpdate':'update','afterDestroy':_0xfd79('0x2')};function emitEvent(_0x1ea7f4){return function(_0x526f1d,_0x486878,_0x1a4393){TeamEvents[_0xfd79('0x3')](_0x1ea7f4+':'+_0x526f1d['id'],_0x526f1d);TeamEvents[_0xfd79('0x3')](_0x1ea7f4,_0x526f1d);_0x1a4393(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0xfd79('0x4')](e,emitEvent(event));}}module[_0xfd79('0x5')]=TeamEvents; \ No newline at end of file +var _0x8062=['setMaxListeners','emit','hasOwnProperty','hook','exports','events','Team'];(function(_0x4327fe,_0x4f8040){var _0x138651=function(_0x418acc){while(--_0x418acc){_0x4327fe['push'](_0x4327fe['shift']());}};_0x138651(++_0x4f8040);}(_0x8062,0x8a));var _0x2806=function(_0xc949fc,_0x433f6a){_0xc949fc=_0xc949fc-0x0;var _0x5882f3=_0x8062[_0xc949fc];return _0x5882f3;};'use strict';var EventEmitter=require(_0x2806('0x0'));var Team=require('../../mysqldb')['db'][_0x2806('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x2806('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4afc67){return function(_0x419a34,_0x4e9c19,_0x5693bf){TeamEvents['emit'](_0x4afc67+':'+_0x419a34['id'],_0x419a34);TeamEvents[_0x2806('0x3')](_0x4afc67,_0x419a34);_0x5693bf(null);};}for(var e in events){if(events[_0x2806('0x4')](e)){var event=events[e];Team[_0x2806('0x5')](e,emitEvent(event));}}module[_0x2806('0x6')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index b0ab23c..3f826bb 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 _0xa582=['moment','bluebird','request-promise','path','exports','Team','teams','lodash','../../config/logger','api'];(function(_0x1c36a8,_0x49c835){var _0xb622c5=function(_0x24f4f3){while(--_0x24f4f3){_0x1c36a8['push'](_0x1c36a8['shift']());}};_0xb622c5(++_0x49c835);}(_0xa582,0x16f));var _0x2a58=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xa582[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x2a58('0x0'));var util=require('util');var logger=require(_0x2a58('0x1'))(_0x2a58('0x2'));var moment=require(_0x2a58('0x3'));var BPromise=require(_0x2a58('0x4'));var rp=require(_0x2a58('0x5'));var fs=require('fs');var path=require(_0x2a58('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./team.attributes');module[_0x2a58('0x7')]=function(_0xe91cc1,_0x5b5973){return _0xe91cc1['define'](_0x2a58('0x8'),attributes,{'tableName':_0x2a58('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e53=['bluebird','request-promise','path','rimraf','../../config/environment','lodash','util','../../config/logger','moment'];(function(_0x25b3d5,_0x4f0a26){var _0x130bd9=function(_0x4ddb14){while(--_0x4ddb14){_0x25b3d5['push'](_0x25b3d5['shift']());}};_0x130bd9(++_0x4f0a26);}(_0x6e53,0x1d0));var _0x36e5=function(_0x1510b9,_0x2b0346){_0x1510b9=_0x1510b9-0x0;var _0x380390=_0x6e53[_0x1510b9];return _0x380390;};'use strict';var _=require(_0x36e5('0x0'));var util=require(_0x36e5('0x1'));var logger=require(_0x36e5('0x2'))('api');var moment=require(_0x36e5('0x3'));var BPromise=require(_0x36e5('0x4'));var rp=require(_0x36e5('0x5'));var fs=require('fs');var path=require(_0x36e5('0x6'));var rimraf=require(_0x36e5('0x7'));var config=require(_0x36e5('0x8'));var attributes=require('./team.attributes');module['exports']=function(_0x4bb216,_0xe70677){return _0x4bb216['define']('Team',attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index d1be874..13e5ec6 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 _0x739b=['socket.io-emitter','./team.socket','register','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost'];(function(_0x3d27a,_0x31311d){var _0x314fd7=function(_0x20ac55){while(--_0x20ac55){_0x3d27a['push'](_0x3d27a['shift']());}};_0x314fd7(++_0x31311d);}(_0x739b,0x15d));var _0xb739=function(_0x5039c0,_0x1be5b1){_0x5039c0=_0x5039c0-0x0;var _0x36b65b=_0x739b[_0x5039c0];return _0x36b65b;};'use strict';var _=require(_0xb739('0x0'));var util=require(_0xb739('0x1'));var moment=require(_0xb739('0x2'));var BPromise=require(_0xb739('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb739('0x4'));var db=require(_0xb739('0x5'))['db'];var utils=require(_0xb739('0x6'));var logger=require(_0xb739('0x7'))(_0xb739('0x8'));var config=require(_0xb739('0x9'));var jayson=require(_0xb739('0xa'));var client=jayson[_0xb739('0xb')]['http']({'port':0x232a});config[_0xb739('0xc')]=_[_0xb739('0xd')](config['redis'],{'host':_0xb739('0xe'),'port':0x18eb});var socket=require(_0xb739('0xf'))(new Redis(config[_0xb739('0xc')]));require(_0xb739('0x10'))[_0xb739('0x11')](socket);function respondWithRpcPromise(_0x2c734c,_0x443ac6,_0x2bd357){return new BPromise(function(_0x16b9e0,_0x145059){return client['request'](_0x2c734c,_0x2bd357)[_0xb739('0x12')](function(_0x519d2d){logger[_0xb739('0x13')](_0xb739('0x14'),_0x443ac6,_0xb739('0x15'));logger['debug'](_0xb739('0x16'),_0x443ac6,_0xb739('0x15'),JSON[_0xb739('0x17')](_0x519d2d));if(_0x519d2d[_0xb739('0x18')]){if(_0x519d2d[_0xb739('0x18')]['code']===0x1f4){logger[_0xb739('0x18')](_0xb739('0x14'),_0x443ac6,_0x519d2d['error']['message']);return _0x145059(_0x519d2d[_0xb739('0x18')][_0xb739('0x19')]);}logger['error']('Team,\x20%s,\x20%s',_0x443ac6,_0x519d2d[_0xb739('0x18')][_0xb739('0x19')]);return _0x16b9e0(_0x519d2d[_0xb739('0x18')]['message']);}else{logger[_0xb739('0x13')](_0xb739('0x14'),_0x443ac6,_0xb739('0x15'));_0x16b9e0(_0x519d2d[_0xb739('0x1a')][_0xb739('0x19')]);}})[_0xb739('0x1b')](function(_0x3ef948){logger[_0xb739('0x18')](_0xb739('0x14'),_0x443ac6,_0x3ef948);_0x145059(_0x3ef948);});});} \ No newline at end of file +var _0x3097=['catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x4067ac,_0x363603){var _0x53d74d=function(_0x492ad4){while(--_0x492ad4){_0x4067ac['push'](_0x4067ac['shift']());}};_0x53d74d(++_0x363603);}(_0x3097,0xeb));var _0x7309=function(_0x465669,_0x59b497){_0x465669=_0x465669-0x0;var _0x58ce66=_0x3097[_0x465669];return _0x58ce66;};'use strict';var _=require(_0x7309('0x0'));var util=require('util');var moment=require(_0x7309('0x1'));var BPromise=require('bluebird');var rs=require(_0x7309('0x2'));var fs=require('fs');var Redis=require(_0x7309('0x3'));var db=require(_0x7309('0x4'))['db'];var utils=require(_0x7309('0x5'));var logger=require(_0x7309('0x6'))(_0x7309('0x7'));var config=require(_0x7309('0x8'));var jayson=require(_0x7309('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x7309('0xa')]=_[_0x7309('0xb')](config[_0x7309('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x7309('0xc'))(new Redis(config['redis']));require(_0x7309('0xd'))[_0x7309('0xe')](socket);function respondWithRpcPromise(_0x4d9fab,_0x56bf62,_0x52d050){return new BPromise(function(_0x4f550d,_0x3f5849){return client[_0x7309('0xf')](_0x4d9fab,_0x52d050)[_0x7309('0x10')](function(_0x1eb1f6){logger[_0x7309('0x11')](_0x7309('0x12'),_0x56bf62,'request\x20sent');logger[_0x7309('0x13')](_0x7309('0x14'),_0x56bf62,_0x7309('0x15'),JSON[_0x7309('0x16')](_0x1eb1f6));if(_0x1eb1f6[_0x7309('0x17')]){if(_0x1eb1f6['error']['code']===0x1f4){logger[_0x7309('0x17')](_0x7309('0x12'),_0x56bf62,_0x1eb1f6[_0x7309('0x17')]['message']);return _0x3f5849(_0x1eb1f6['error'][_0x7309('0x18')]);}logger[_0x7309('0x17')]('Team,\x20%s,\x20%s',_0x56bf62,_0x1eb1f6[_0x7309('0x17')]['message']);return _0x4f550d(_0x1eb1f6[_0x7309('0x17')][_0x7309('0x18')]);}else{logger['info']('Team,\x20%s,\x20%s',_0x56bf62,_0x7309('0x15'));_0x4f550d(_0x1eb1f6['result'][_0x7309('0x18')]);}})[_0x7309('0x19')](function(_0x29f1e3){logger[_0x7309('0x17')]('Team,\x20%s,\x20%s',_0x56bf62,_0x29f1e3);_0x3f5849(_0x29f1e3);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index e53e7a7..2042ef0 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 _0x2b2a=['register','save','remove','emit'];(function(_0x36e727,_0x22ca20){var _0x770a82=function(_0x4115b1){while(--_0x4115b1){_0x36e727['push'](_0x36e727['shift']());}};_0x770a82(++_0x22ca20);}(_0x2b2a,0x149));var _0xa2b2=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x2b2a[_0x126558];return _0x1f6d14;};'use strict';var TeamEvents=require('./team.events');var events=[_0xa2b2('0x0'),_0xa2b2('0x1'),'update'];function createListener(_0x2bea8e,_0x4e0560){return function(_0x4be2da){_0x4e0560[_0xa2b2('0x2')](_0x2bea8e,_0x4be2da);};}function removeListener(_0x7c415f,_0x53014d){return function(){TeamEvents['removeListener'](_0x7c415f,_0x53014d);};}exports[_0xa2b2('0x3')]=function(_0x2c0c87){for(var _0x29690f=0x0,_0x655546=events['length'];_0x29690f<_0x655546;_0x29690f++){var _0x5e066d=events[_0x29690f];var _0x47bc23=createListener('team:'+_0x5e066d,_0x2c0c87);TeamEvents['on'](_0x5e066d,_0x47bc23);}}; \ No newline at end of file +var _0x3abf=['emit','removeListener','register','team:','./team.events','save','remove','update'];(function(_0x5ade27,_0x4d592d){var _0x5c11d7=function(_0x5148cc){while(--_0x5148cc){_0x5ade27['push'](_0x5ade27['shift']());}};_0x5c11d7(++_0x4d592d);}(_0x3abf,0x16c));var _0xf3ab=function(_0x4fa3dc,_0x39680b){_0x4fa3dc=_0x4fa3dc-0x0;var _0x55de8c=_0x3abf[_0x4fa3dc];return _0x55de8c;};'use strict';var TeamEvents=require(_0xf3ab('0x0'));var events=[_0xf3ab('0x1'),_0xf3ab('0x2'),_0xf3ab('0x3')];function createListener(_0x26bebe,_0x3932c0){return function(_0x38a4c8){_0x3932c0[_0xf3ab('0x4')](_0x26bebe,_0x38a4c8);};}function removeListener(_0x4167ff,_0x3b0e23){return function(){TeamEvents[_0xf3ab('0x5')](_0x4167ff,_0x3b0e23);};}exports[_0xf3ab('0x6')]=function(_0x87f297){for(var _0x25088c=0x0,_0x261a28=events['length'];_0x25088c<_0x261a28;_0x25088c++){var _0x31b5f7=events[_0x25088c];var _0x403cc7=createListener(_0xf3ab('0x7')+_0x31b5f7,_0x87f297);TeamEvents['on'](_0x31b5f7,_0x403cc7);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 1aa3b9d..a68603c 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 _0x37b4=['INTEGER','sequelize'];(function(_0x224704,_0x5e2a62){var _0x4890c5=function(_0x4417f2){while(--_0x4417f2){_0x224704['push'](_0x224704['shift']());}};_0x4890c5(++_0x5e2a62);}(_0x37b4,0xef));var _0x437b=function(_0x343dab,_0x134185){_0x343dab=_0x343dab-0x0;var _0xa7e52d=_0x37b4[_0x343dab];return _0xa7e52d;};'use strict';var Sequelize=require(_0x437b('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x437b('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x437b('0x1')]}}; \ No newline at end of file +var _0x2a92=['exports','INTEGER','sequelize'];(function(_0x36d2c1,_0x4c7f59){var _0x4e2759=function(_0x33c036){while(--_0x33c036){_0x36d2c1['push'](_0x36d2c1['shift']());}};_0x4e2759(++_0x4c7f59);}(_0x2a92,0xbf));var _0x22a9=function(_0x50f6e5,_0x151ccb){_0x50f6e5=_0x50f6e5-0x0;var _0x5988c5=_0x2a92[_0x50f6e5];return _0x5988c5;};'use strict';var Sequelize=require(_0x22a9('0x0'));module[_0x22a9('0x1')]={'TeamId':{'type':Sequelize[_0x22a9('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x22a9('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 3d441dd..91e126c 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 _0xb350=['define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./teamVoicePrefix.attributes','exports'];(function(_0x537fff,_0x4a9362){var _0x3c9874=function(_0x10b37d){while(--_0x10b37d){_0x537fff['push'](_0x537fff['shift']());}};_0x3c9874(++_0x4a9362);}(_0xb350,0x6f));var _0x0b35=function(_0xd06063,_0x2d9035){_0xd06063=_0xd06063-0x0;var _0x4dc9dd=_0xb350[_0xd06063];return _0x4dc9dd;};'use strict';var _=require(_0x0b35('0x0'));var util=require(_0x0b35('0x1'));var logger=require(_0x0b35('0x2'))(_0x0b35('0x3'));var moment=require('moment');var BPromise=require(_0x0b35('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b35('0x5'));var rimraf=require('rimraf');var config=require(_0x0b35('0x6'));var attributes=require(_0x0b35('0x7'));module[_0x0b35('0x8')]=function(_0x1218c3,_0x417722){return _0x1218c3[_0x0b35('0x9')](_0x0b35('0xa'),attributes,{'tableName':_0x0b35('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf4c=['moment','bluebird','request-promise','rimraf','../../config/environment','./teamVoicePrefix.attributes','define','TeamVoicePrefix','team_has_voice_prefixes','util','../../config/logger'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0xaf4c,0x1ed));var _0xcaf4=function(_0x259ef6,_0x1c2978){_0x259ef6=_0x259ef6-0x0;var _0x17541d=_0xaf4c[_0x259ef6];return _0x17541d;};'use strict';var _=require('lodash');var util=require(_0xcaf4('0x0'));var logger=require(_0xcaf4('0x1'))('api');var moment=require(_0xcaf4('0x2'));var BPromise=require(_0xcaf4('0x3'));var rp=require(_0xcaf4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcaf4('0x5'));var config=require(_0xcaf4('0x6'));var attributes=require(_0xcaf4('0x7'));module['exports']=function(_0x21ad95,_0x548527){return _0x21ad95[_0xcaf4('0x8')](_0xcaf4('0x9'),attributes,{'tableName':_0xcaf4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 221ff65..56ae702 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x148634,_0xb2a21c){var _0x4bf6ae=function(_0x46bc48){while(--_0x46bc48){_0x148634['push'](_0x148634['shift']());}};_0x4bf6ae(++_0xb2a21c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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(_0x22bf8b,_0x52923a){var _0x38cae2=function(_0x11736a){while(--_0x11736a){_0x22bf8b['push'](_0x22bf8b['shift']());}};_0x38cae2(++_0x52923a);}(_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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 706885a..50650ac 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 _0x85e7=['INTEGER','sequelize'];(function(_0x1e5102,_0x43b35b){var _0x1a6705=function(_0x2d8f3e){while(--_0x2d8f3e){_0x1e5102['push'](_0x1e5102['shift']());}};_0x1a6705(++_0x43b35b);}(_0x85e7,0xad));var _0x785e=function(_0x18b910,_0x182ef0){_0x18b910=_0x18b910-0x0;var _0x59c95d=_0x85e7[_0x18b910];return _0x59c95d;};'use strict';var Sequelize=require(_0x785e('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x785e('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x05da=['INTEGER','exports'];(function(_0xbc4560,_0x4020b8){var _0x298cfb=function(_0x254423){while(--_0x254423){_0xbc4560['push'](_0xbc4560['shift']());}};_0x298cfb(++_0x4020b8);}(_0x05da,0x7d));var _0xa05d=function(_0x1c95b7,_0x1a00ac){_0x1c95b7=_0x1c95b7-0x0;var _0x4a2907=_0x05da[_0x1c95b7];return _0x4a2907;};'use strict';var Sequelize=require('sequelize');module[_0xa05d('0x0')]={'penalty':{'type':Sequelize[_0xa05d('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 2de60fb..c9472aa 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 _0x130d=['rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x218947,_0x22c2a0){var _0x25c3bd=function(_0x4b6652){while(--_0x4b6652){_0x218947['push'](_0x218947['shift']());}};_0x25c3bd(++_0x22c2a0);}(_0x130d,0x125));var _0xd130=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x130d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd130('0x0'));var util=require('util');var logger=require(_0xd130('0x1'))('api');var moment=require(_0xd130('0x2'));var BPromise=require(_0xd130('0x3'));var rp=require(_0xd130('0x4'));var fs=require('fs');var path=require(_0xd130('0x5'));var rimraf=require(_0xd130('0x6'));var config=require(_0xd130('0x7'));var attributes=require(_0xd130('0x8'));module[_0xd130('0x9')]=function(_0x287e61,_0x4689a8){return _0x287e61[_0xd130('0xa')](_0xd130('0xb'),attributes,{'tableName':_0xd130('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6308=['bluebird','request-promise','path','rimraf','../../config/environment','define','TeamVoiceQueue','team_has_voice_queues','lodash','../../config/logger'];(function(_0x28c547,_0x3e2a16){var _0x399b56=function(_0x39fe6b){while(--_0x39fe6b){_0x28c547['push'](_0x28c547['shift']());}};_0x399b56(++_0x3e2a16);}(_0x6308,0x1f2));var _0x8630=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0x6308[_0x2aecb2];return _0x3ebb80;};'use strict';var _=require(_0x8630('0x0'));var util=require('util');var logger=require(_0x8630('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8630('0x2'));var rp=require(_0x8630('0x3'));var fs=require('fs');var path=require(_0x8630('0x4'));var rimraf=require(_0x8630('0x5'));var config=require(_0x8630('0x6'));var attributes=require('./teamVoiceQueue.attributes');module['exports']=function(_0x1d62c8,_0x571543){return _0x1d62c8[_0x8630('0x7')](_0x8630('0x8'),attributes,{'tableName':_0x8630('0x9'),'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 cd52751..783b55b 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 _0x1fe2=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','TeamVoiceQueue,\x20%s,\x20%s','info','result','catch','lodash'];(function(_0x191ff0,_0x50515a){var _0x1003ac=function(_0x3c920d){while(--_0x3c920d){_0x191ff0['push'](_0x191ff0['shift']());}};_0x1003ac(++_0x50515a);}(_0x1fe2,0x72));var _0x21fe=function(_0x256098,_0xe6d89c){_0x256098=_0x256098-0x0;var _0x4eb2ac=_0x1fe2[_0x256098];return _0x4eb2ac;};'use strict';var _=require(_0x21fe('0x0'));var util=require(_0x21fe('0x1'));var moment=require(_0x21fe('0x2'));var BPromise=require('bluebird');var rs=require(_0x21fe('0x3'));var fs=require('fs');var Redis=require(_0x21fe('0x4'));var db=require(_0x21fe('0x5'))['db'];var utils=require(_0x21fe('0x6'));var logger=require(_0x21fe('0x7'))('rpc');var config=require(_0x21fe('0x8'));var jayson=require(_0x21fe('0x9'));var client=jayson[_0x21fe('0xa')][_0x21fe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b4e82,_0x4a45ba,_0x223ec5){return new BPromise(function(_0x14536f,_0x431336){return client[_0x21fe('0xc')](_0x2b4e82,_0x223ec5)['then'](function(_0x3f660d){logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x4a45ba,'request\x20sent');logger['debug'](_0x21fe('0xd'),_0x4a45ba,_0x21fe('0xe'),JSON[_0x21fe('0xf')](_0x3f660d));if(_0x3f660d['error']){if(_0x3f660d[_0x21fe('0x10')][_0x21fe('0x11')]===0x1f4){logger[_0x21fe('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4a45ba,_0x3f660d[_0x21fe('0x10')][_0x21fe('0x12')]);return _0x431336(_0x3f660d[_0x21fe('0x10')]['message']);}logger[_0x21fe('0x10')](_0x21fe('0x13'),_0x4a45ba,_0x3f660d[_0x21fe('0x10')][_0x21fe('0x12')]);return _0x14536f(_0x3f660d[_0x21fe('0x10')][_0x21fe('0x12')]);}else{logger[_0x21fe('0x14')](_0x21fe('0x13'),_0x4a45ba,'request\x20sent');_0x14536f(_0x3f660d[_0x21fe('0x15')]['message']);}})[_0x21fe('0x16')](function(_0x3fa079){logger[_0x21fe('0x10')](_0x21fe('0x13'),_0x4a45ba,_0x3fa079);_0x431336(_0x3fa079);});});} \ No newline at end of file +var _0x639a=['TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x423642,_0xd5fd07){var _0x4cbd0b=function(_0x5172d5){while(--_0x5172d5){_0x423642['push'](_0x423642['shift']());}};_0x4cbd0b(++_0xd5fd07);}(_0x639a,0xec));var _0xa639=function(_0x49b315,_0x5ca5bd){_0x49b315=_0x49b315-0x0;var _0x584439=_0x639a[_0x49b315];return _0x584439;};'use strict';var _=require('lodash');var util=require(_0xa639('0x0'));var moment=require(_0xa639('0x1'));var BPromise=require(_0xa639('0x2'));var rs=require(_0xa639('0x3'));var fs=require('fs');var Redis=require(_0xa639('0x4'));var db=require(_0xa639('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa639('0x6'))(_0xa639('0x7'));var config=require(_0xa639('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa639('0x9')][_0xa639('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29d2e4,_0x4223f6,_0x4c4ebf){return new BPromise(function(_0xfb7f17,_0x3ec583){return client[_0xa639('0xb')](_0x29d2e4,_0x4c4ebf)[_0xa639('0xc')](function(_0x324365){logger[_0xa639('0xd')](_0xa639('0xe'),_0x4223f6,_0xa639('0xf'));logger[_0xa639('0x10')](_0xa639('0x11'),_0x4223f6,_0xa639('0xf'),JSON[_0xa639('0x12')](_0x324365));if(_0x324365[_0xa639('0x13')]){if(_0x324365[_0xa639('0x13')]['code']===0x1f4){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x4223f6,_0x324365[_0xa639('0x13')][_0xa639('0x14')]);return _0x3ec583(_0x324365['error']['message']);}logger[_0xa639('0x13')](_0xa639('0xe'),_0x4223f6,_0x324365['error'][_0xa639('0x14')]);return _0xfb7f17(_0x324365[_0xa639('0x13')][_0xa639('0x14')]);}else{logger['info'](_0xa639('0xe'),_0x4223f6,_0xa639('0xf'));_0xfb7f17(_0x324365[_0xa639('0x15')][_0xa639('0x14')]);}})[_0xa639('0x16')](function(_0x5924bd){logger[_0xa639('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4223f6,_0x5924bd);_0x3ec583(_0x5924bd);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 35b1205..f1a8182 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 _0xa7b5=['post','create','put','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xa7b5,0x15a));var _0x5a7b=function(_0x5933d0,_0x2af3b0){_0x5933d0=_0x5933d0-0x0;var _0x323374=_0xa7b5[_0x5933d0];return _0x323374;};'use strict';var multer=require(_0x5a7b('0x0'));var util=require('util');var path=require(_0x5a7b('0x1'));var timeout=require('connect-timeout');var express=require(_0x5a7b('0x2'));var router=express[_0x5a7b('0x3')]();var fs_extra=require(_0x5a7b('0x4'));var auth=require(_0x5a7b('0x5'));var interaction=require(_0x5a7b('0x6'));var config=require(_0x5a7b('0x7'));var controller=require(_0x5a7b('0x8'));router[_0x5a7b('0x9')]('/',auth[_0x5a7b('0xa')](),controller[_0x5a7b('0xb')]);router[_0x5a7b('0x9')](_0x5a7b('0xc'),auth[_0x5a7b('0xa')](),controller[_0x5a7b('0xd')]);router[_0x5a7b('0xe')]('/',auth[_0x5a7b('0xa')](),controller[_0x5a7b('0xf')]);router[_0x5a7b('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x5a7b('0x11')]);router['delete'](_0x5a7b('0xc'),auth[_0x5a7b('0xa')](),controller[_0x5a7b('0x12')]);module[_0x5a7b('0x13')]=router; \ No newline at end of file +var _0x33af=['fs-extra','../../components/auth/service','../../components/interaction/service','./template.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0xc0be57,_0x2d1e96){var _0x2d786d=function(_0x5c91fc){while(--_0x5c91fc){_0xc0be57['push'](_0xc0be57['shift']());}};_0x2d786d(++_0x2d1e96);}(_0x33af,0xec));var _0xf33a=function(_0x550151,_0x49d953){_0x550151=_0x550151-0x0;var _0x1ba3cb=_0x33af[_0x550151];return _0x1ba3cb;};'use strict';var multer=require('multer');var util=require(_0xf33a('0x0'));var path=require('path');var timeout=require(_0xf33a('0x1'));var express=require(_0xf33a('0x2'));var router=express[_0xf33a('0x3')]();var fs_extra=require(_0xf33a('0x4'));var auth=require(_0xf33a('0x5'));var interaction=require(_0xf33a('0x6'));var config=require('../../config/environment');var controller=require(_0xf33a('0x7'));router[_0xf33a('0x8')]('/',auth['isAuthenticated'](),controller[_0xf33a('0x9')]);router[_0xf33a('0x8')](_0xf33a('0xa'),auth[_0xf33a('0xb')](),controller[_0xf33a('0xc')]);router[_0xf33a('0xd')]('/',auth['isAuthenticated'](),controller[_0xf33a('0xe')]);router[_0xf33a('0xf')](_0xf33a('0xa'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x10')]);router[_0xf33a('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xf33a('0x12')]);module[_0xf33a('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 9f55075..ee2f1e4 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 _0x58ef=['sequelize','exports','STRING','TEXT'];(function(_0x141957,_0x31f654){var _0x42abdd=function(_0x41ba2f){while(--_0x41ba2f){_0x141957['push'](_0x141957['shift']());}};_0x42abdd(++_0x31f654);}(_0x58ef,0x154));var _0xf58e=function(_0x2cb9de,_0x57f1d4){_0x2cb9de=_0x2cb9de-0x0;var _0x65384c=_0x58ef[_0x2cb9de];return _0x65384c;};'use strict';var Sequelize=require(_0xf58e('0x0'));module[_0xf58e('0x1')]={'name':{'type':Sequelize[_0xf58e('0x2')]},'description':{'type':Sequelize[_0xf58e('0x2')]},'html':{'type':Sequelize[_0xf58e('0x3')]}}; \ No newline at end of file +var _0xdc52=['sequelize','exports','STRING','TEXT'];(function(_0x2bc058,_0x127a3f){var _0x4478fd=function(_0x4536fa){while(--_0x4536fa){_0x2bc058['push'](_0x2bc058['shift']());}};_0x4478fd(++_0x127a3f);}(_0xdc52,0x134));var _0x2dc5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc52[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2dc5('0x0'));module[_0x2dc5('0x1')]={'name':{'type':Sequelize[_0x2dc5('0x2')]},'description':{'type':Sequelize[_0x2dc5('0x2')]},'html':{'type':Sequelize[_0x2dc5('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index e80bdc5..6afa5d9 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 _0x6553=['role','Templates','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','Template','includeAll','include','catch','show','merge','find','create','body','user'];(function(_0x33f841,_0x55f458){var _0x527e28=function(_0x51e628){while(--_0x51e628){_0x33f841['push'](_0x33f841['shift']());}};_0x527e28(++_0x55f458);}(_0x6553,0x153));var _0x3655=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6553[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x3655('0x0'));var rimraf=require(_0x3655('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3655('0x2'));var rp=require(_0x3655('0x3'));var moment=require(_0x3655('0x4'));var BPromise=require(_0x3655('0x5'));var Mustache=require('mustache');var util=require(_0x3655('0x6'));var path=require(_0x3655('0x7'));var sox=require(_0x3655('0x8'));var csv=require(_0x3655('0x9'));var ejs=require(_0x3655('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3655('0xb'));var squel=require(_0x3655('0xc'));var crypto=require(_0x3655('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3655('0xe'));var toCsv=require(_0x3655('0x9'));var querystring=require(_0x3655('0xf'));var Papa=require(_0x3655('0x10'));var Redis=require('ioredis');var authService=require(_0x3655('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3655('0x12'));var hardwareService=require(_0x3655('0x13'));var logger=require(_0x3655('0x14'))('api');var utils=require(_0x3655('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3655('0x16'));var db=require(_0x3655('0x17'))['db'];function respondWithStatusCode(_0x3af8fd,_0xecc532){_0xecc532=_0xecc532||0xcc;return function(_0x3f4a7f){if(_0x3f4a7f){return _0x3af8fd[_0x3655('0x18')](_0xecc532);}return _0x3af8fd[_0x3655('0x19')](_0xecc532)[_0x3655('0x1a')]();};}function respondWithResult(_0x471676,_0x2633e1){_0x2633e1=_0x2633e1||0xc8;return function(_0x55026e){if(_0x55026e){return _0x471676[_0x3655('0x19')](_0x2633e1)['json'](_0x55026e);}};}function respondWithFilteredResult(_0x5621e8,_0xf49d26){return function(_0x3c40b6){if(_0x3c40b6){var _0x3bc12f=typeof _0xf49d26[_0x3655('0x1b')]===_0x3655('0x1c')&&typeof _0xf49d26[_0x3655('0x1d')]===_0x3655('0x1c');var _0x8dc3a8=_0x3c40b6['count'];var _0x2d13a6=_0x3bc12f?0x0:_0xf49d26[_0x3655('0x1b')];var _0x4edccd=_0x3bc12f?_0x3c40b6[_0x3655('0x1e')]:_0xf49d26[_0x3655('0x1b')]+_0xf49d26[_0x3655('0x1d')];var _0x24438a;if(_0x4edccd>=_0x8dc3a8){_0x4edccd=_0x8dc3a8;_0x24438a=0xc8;}else{_0x24438a=0xce;}_0x5621e8[_0x3655('0x19')](_0x24438a);return _0x5621e8[_0x3655('0x1f')]('Content-Range',_0x2d13a6+'-'+_0x4edccd+'/'+_0x8dc3a8)['json'](_0x3c40b6);}return null;};}function patchUpdates(_0x42ea39){return function(_0x56f269){try{jsonpatch[_0x3655('0x20')](_0x56f269,_0x42ea39,!![]);}catch(_0x585f87){return BPromise[_0x3655('0x21')](_0x585f87);}return _0x56f269[_0x3655('0x22')]();};}function saveUpdates(_0xc09d4e,_0x2455b8){return function(_0x4c49b0){if(_0x4c49b0){return _0x4c49b0[_0x3655('0x23')](_0xc09d4e)[_0x3655('0x24')](function(_0x5ce2f8){return _0x5ce2f8;});}return null;};}function removeEntity(_0x477dce,_0xd99b60){return function(_0x41f405){if(_0x41f405){return _0x41f405[_0x3655('0x25')]()[_0x3655('0x24')](function(){var _0x2cfced=_0x41f405[_0x3655('0x26')]({'plain':!![]});var _0x4a0dab='Templates';return db[_0x3655('0x27')][_0x3655('0x25')]({'where':{'type':_0x4a0dab,'resourceId':_0x2cfced['id']}})[_0x3655('0x24')](function(){return _0x41f405;});})['then'](function(){_0x477dce['status'](0xcc)[_0x3655('0x1a')]();});}};}function handleEntityNotFound(_0x1083df,_0x92ced9){return function(_0x301751){if(!_0x301751){_0x1083df[_0x3655('0x18')](0x194);}return _0x301751;};}function handleError(_0x4ac941,_0x5cc8fa){_0x5cc8fa=_0x5cc8fa||0x1f4;return function(_0x25c73e){logger[_0x3655('0x28')](_0x25c73e[_0x3655('0x29')]);if(_0x25c73e[_0x3655('0x2a')]){delete _0x25c73e[_0x3655('0x2a')];}_0x4ac941[_0x3655('0x19')](_0x5cc8fa)[_0x3655('0x2b')](_0x25c73e);};}exports['index']=function(_0x1570e0,_0x54b545){var _0x2cbfa5={},_0x346aaa={},_0x4e25e1={'count':0x0,'rows':[]};var _0x337f08=_[_0x3655('0x2c')](db['Template'][_0x3655('0x2d')],function(_0x16b9b1){return{'name':_0x16b9b1[_0x3655('0x2e')],'type':_0x16b9b1[_0x3655('0x2f')][_0x3655('0x30')]};});_0x346aaa[_0x3655('0x31')]=_[_0x3655('0x2c')](_0x337f08,_0x3655('0x2a'));_0x346aaa[_0x3655('0x32')]=_[_0x3655('0x33')](_0x1570e0[_0x3655('0x32')]);_0x346aaa[_0x3655('0x34')]=_[_0x3655('0x35')](_0x346aaa[_0x3655('0x31')],_0x346aaa[_0x3655('0x32')]);_0x2cbfa5[_0x3655('0x36')]=_[_0x3655('0x35')](_0x346aaa['model'],qs[_0x3655('0x37')](_0x1570e0[_0x3655('0x32')][_0x3655('0x37')]));_0x2cbfa5[_0x3655('0x36')]=_0x2cbfa5[_0x3655('0x36')][_0x3655('0x38')]?_0x2cbfa5['attributes']:_0x346aaa[_0x3655('0x31')];if(!_0x1570e0[_0x3655('0x32')][_0x3655('0x39')](_0x3655('0x3a'))){_0x2cbfa5['limit']=qs['limit'](_0x1570e0[_0x3655('0x32')][_0x3655('0x1d')]);_0x2cbfa5[_0x3655('0x1b')]=qs[_0x3655('0x1b')](_0x1570e0[_0x3655('0x32')][_0x3655('0x1b')]);}_0x2cbfa5[_0x3655('0x3b')]=qs[_0x3655('0x3c')](_0x1570e0[_0x3655('0x32')]['sort']);_0x2cbfa5[_0x3655('0x3d')]=qs['filters'](_[_0x3655('0x3e')](_0x1570e0[_0x3655('0x32')],_0x346aaa[_0x3655('0x34')]),_0x337f08);if(_0x1570e0['query'][_0x3655('0x3f')]){_0x2cbfa5['where']=_['merge'](_0x2cbfa5[_0x3655('0x3d')],{'$or':_[_0x3655('0x2c')](_0x337f08,function(_0x3a3d03){if(_0x3a3d03[_0x3655('0x2f')]!==_0x3655('0x40')){var _0x590497={};_0x590497[_0x3a3d03['name']]={'$like':'%'+_0x1570e0['query'][_0x3655('0x3f')]+'%'};return _0x590497;}})});}_0x2cbfa5=_['merge']({},_0x2cbfa5,_0x1570e0[_0x3655('0x41')]);var _0x3d97b1={'where':_0x2cbfa5[_0x3655('0x3d')]};return db[_0x3655('0x42')]['count'](_0x3d97b1)[_0x3655('0x24')](function(_0x2f49e6){_0x4e25e1[_0x3655('0x1e')]=_0x2f49e6;if(_0x1570e0[_0x3655('0x32')][_0x3655('0x43')]){_0x2cbfa5[_0x3655('0x44')]=[{'all':!![]}];}return db[_0x3655('0x42')]['findAll'](_0x2cbfa5);})[_0x3655('0x24')](function(_0x15b84f){_0x4e25e1['rows']=_0x15b84f;return _0x4e25e1;})[_0x3655('0x24')](respondWithFilteredResult(_0x54b545,_0x2cbfa5))[_0x3655('0x45')](handleError(_0x54b545,null));};exports[_0x3655('0x46')]=function(_0x8dd1e5,_0x4488a7){var _0xec6e6f={'raw':!![],'where':{'id':_0x8dd1e5['params']['id']}},_0x37b8bf={};_0x37b8bf[_0x3655('0x31')]=_['keys'](db[_0x3655('0x42')]['rawAttributes']);_0x37b8bf['query']=_['keys'](_0x8dd1e5['query']);_0x37b8bf['filters']=_['intersection'](_0x37b8bf[_0x3655('0x31')],_0x37b8bf[_0x3655('0x32')]);_0xec6e6f['attributes']=_[_0x3655('0x35')](_0x37b8bf[_0x3655('0x31')],qs['fields'](_0x8dd1e5[_0x3655('0x32')][_0x3655('0x37')]));_0xec6e6f[_0x3655('0x36')]=_0xec6e6f['attributes'][_0x3655('0x38')]?_0xec6e6f[_0x3655('0x36')]:_0x37b8bf[_0x3655('0x31')];if(_0x8dd1e5[_0x3655('0x32')][_0x3655('0x43')]){_0xec6e6f[_0x3655('0x44')]=[{'all':!![]}];}_0xec6e6f=_[_0x3655('0x47')]({},_0xec6e6f,_0x8dd1e5['options']);return db[_0x3655('0x42')][_0x3655('0x48')](_0xec6e6f)['then'](handleEntityNotFound(_0x4488a7,null))[_0x3655('0x24')](respondWithResult(_0x4488a7,null))['catch'](handleError(_0x4488a7,null));};exports[_0x3655('0x49')]=function(_0x101d10,_0x352062){return db[_0x3655('0x42')][_0x3655('0x49')](_0x101d10[_0x3655('0x4a')],{})['then'](function(_0x453b6b){var _0x35eea2=_0x101d10[_0x3655('0x4b')]['get']({'plain':!![]});if(!_0x35eea2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35eea2[_0x3655('0x4c')]===_0x3655('0x4b')){var _0x10e053=_0x453b6b[_0x3655('0x26')]({'plain':!![]});var _0x5da7df=_0x3655('0x4d');return db[_0x3655('0x4e')]['find']({'where':{'name':_0x5da7df,'userProfileId':_0x35eea2[_0x3655('0x4f')]},'raw':!![]})['then'](function(_0x44fe43){if(_0x44fe43&&_0x44fe43[_0x3655('0x50')]===0x0){return db[_0x3655('0x27')][_0x3655('0x49')]({'name':_0x10e053[_0x3655('0x2a')],'resourceId':_0x10e053['id'],'type':_0x44fe43[_0x3655('0x2a')],'sectionId':_0x44fe43['id']},{})['then'](function(){return _0x453b6b;});}else{return _0x453b6b;}})[_0x3655('0x45')](function(_0x18ffaf){logger[_0x3655('0x28')](_0x3655('0x51'),_0x18ffaf);throw _0x18ffaf;});}return _0x453b6b;})[_0x3655('0x24')](respondWithResult(_0x352062,0xc9))[_0x3655('0x45')](handleError(_0x352062,null));};exports[_0x3655('0x23')]=function(_0x43ffeb,_0x3e5fa0){if(_0x43ffeb[_0x3655('0x4a')]['id']){delete _0x43ffeb['body']['id'];}return db['Template'][_0x3655('0x48')]({'where':{'id':_0x43ffeb[_0x3655('0x52')]['id']}})[_0x3655('0x24')](handleEntityNotFound(_0x3e5fa0,null))[_0x3655('0x24')](saveUpdates(_0x43ffeb[_0x3655('0x4a')],null))[_0x3655('0x24')](respondWithResult(_0x3e5fa0,null))[_0x3655('0x45')](handleError(_0x3e5fa0,null));};exports[_0x3655('0x25')]=function(_0x777517,_0x2189e3){return db['Template']['find']({'where':{'id':_0x777517[_0x3655('0x52')]['id']}})[_0x3655('0x24')](handleEntityNotFound(_0x2189e3,null))[_0x3655('0x24')](removeEntity(_0x2189e3,null))[_0x3655('0x45')](handleError(_0x2189e3,null));}; \ No newline at end of file +var _0xa179=['where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','include','create','body','role','user','userProfileId','autoAssociation','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','get','Templates','UserProfileResource','destroy','sendStatus','error','name','send','map','Template','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort'];(function(_0x542d9e,_0x110c21){var _0x39233a=function(_0x3ebcde){while(--_0x3ebcde){_0x542d9e['push'](_0x542d9e['shift']());}};_0x39233a(++_0x110c21);}(_0xa179,0x153));var _0x9a17=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa179[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9a17('0x0'));var rimraf=require(_0x9a17('0x1'));var zipdir=require(_0x9a17('0x2'));var jsonpatch=require(_0x9a17('0x3'));var rp=require(_0x9a17('0x4'));var moment=require(_0x9a17('0x5'));var BPromise=require(_0x9a17('0x6'));var Mustache=require(_0x9a17('0x7'));var util=require(_0x9a17('0x8'));var path=require('path');var sox=require(_0x9a17('0x9'));var csv=require(_0x9a17('0xa'));var ejs=require(_0x9a17('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9a17('0xc'));var crypto=require('crypto');var jsforce=require(_0x9a17('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9a17('0xe'));var Papa=require('papaparse');var Redis=require(_0x9a17('0xf'));var authService=require(_0x9a17('0x10'));var qs=require(_0x9a17('0x11'));var as=require(_0x9a17('0x12'));var hardwareService=require(_0x9a17('0x13'));var logger=require(_0x9a17('0x14'))(_0x9a17('0x15'));var utils=require('../../config/utils');var config=require(_0x9a17('0x16'));var licenseUtil=require(_0x9a17('0x17'));var db=require(_0x9a17('0x18'))['db'];function respondWithStatusCode(_0x2295fe,_0x28681e){_0x28681e=_0x28681e||0xcc;return function(_0x725881){if(_0x725881){return _0x2295fe['sendStatus'](_0x28681e);}return _0x2295fe[_0x9a17('0x19')](_0x28681e)[_0x9a17('0x1a')]();};}function respondWithResult(_0x1bedbe,_0x1868d2){_0x1868d2=_0x1868d2||0xc8;return function(_0x5bbbe1){if(_0x5bbbe1){return _0x1bedbe[_0x9a17('0x19')](_0x1868d2)[_0x9a17('0x1b')](_0x5bbbe1);}};}function respondWithFilteredResult(_0x59365b,_0x24ddb3){return function(_0x33e136){if(_0x33e136){var _0x44e859=typeof _0x24ddb3[_0x9a17('0x1c')]==='undefined'&&typeof _0x24ddb3[_0x9a17('0x1d')]===_0x9a17('0x1e');var _0x374aee=_0x33e136[_0x9a17('0x1f')];var _0x5efb05=_0x44e859?0x0:_0x24ddb3[_0x9a17('0x1c')];var _0x3a4b7e=_0x44e859?_0x33e136[_0x9a17('0x1f')]:_0x24ddb3[_0x9a17('0x1c')]+_0x24ddb3[_0x9a17('0x1d')];var _0x3f47e3;if(_0x3a4b7e>=_0x374aee){_0x3a4b7e=_0x374aee;_0x3f47e3=0xc8;}else{_0x3f47e3=0xce;}_0x59365b[_0x9a17('0x19')](_0x3f47e3);return _0x59365b[_0x9a17('0x20')](_0x9a17('0x21'),_0x5efb05+'-'+_0x3a4b7e+'/'+_0x374aee)['json'](_0x33e136);}return null;};}function patchUpdates(_0x4daa85){return function(_0x15e715){try{jsonpatch[_0x9a17('0x22')](_0x15e715,_0x4daa85,!![]);}catch(_0x551e4b){return BPromise['reject'](_0x551e4b);}return _0x15e715['save']();};}function saveUpdates(_0x3846db,_0x3da8be){return function(_0x45a2c8){if(_0x45a2c8){return _0x45a2c8[_0x9a17('0x23')](_0x3846db)['then'](function(_0x14029a){return _0x14029a;});}return null;};}function removeEntity(_0x154037,_0x11b38f){return function(_0x29945d){if(_0x29945d){return _0x29945d['destroy']()[_0x9a17('0x24')](function(){var _0x2f9304=_0x29945d[_0x9a17('0x25')]({'plain':!![]});var _0x466580=_0x9a17('0x26');return db[_0x9a17('0x27')][_0x9a17('0x28')]({'where':{'type':_0x466580,'resourceId':_0x2f9304['id']}})[_0x9a17('0x24')](function(){return _0x29945d;});})['then'](function(){_0x154037['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xc72110,_0x49224c){return function(_0x5e8ca2){if(!_0x5e8ca2){_0xc72110[_0x9a17('0x29')](0x194);}return _0x5e8ca2;};}function handleError(_0x39dcad,_0x489cf4){_0x489cf4=_0x489cf4||0x1f4;return function(_0x282db1){logger[_0x9a17('0x2a')](_0x282db1['stack']);if(_0x282db1[_0x9a17('0x2b')]){delete _0x282db1[_0x9a17('0x2b')];}_0x39dcad['status'](_0x489cf4)[_0x9a17('0x2c')](_0x282db1);};}exports['index']=function(_0x47a635,_0x41f8e9){var _0x3bd416={},_0x309566={},_0x250b56={'count':0x0,'rows':[]};var _0x668cb7=_[_0x9a17('0x2d')](db[_0x9a17('0x2e')][_0x9a17('0x2f')],function(_0x51fb8b){return{'name':_0x51fb8b[_0x9a17('0x30')],'type':_0x51fb8b[_0x9a17('0x31')]['key']};});_0x309566[_0x9a17('0x32')]=_[_0x9a17('0x2d')](_0x668cb7,_0x9a17('0x2b'));_0x309566[_0x9a17('0x33')]=_[_0x9a17('0x34')](_0x47a635[_0x9a17('0x33')]);_0x309566[_0x9a17('0x35')]=_[_0x9a17('0x36')](_0x309566['model'],_0x309566['query']);_0x3bd416[_0x9a17('0x37')]=_[_0x9a17('0x36')](_0x309566[_0x9a17('0x32')],qs[_0x9a17('0x38')](_0x47a635[_0x9a17('0x33')]['fields']));_0x3bd416['attributes']=_0x3bd416['attributes'][_0x9a17('0x39')]?_0x3bd416[_0x9a17('0x37')]:_0x309566[_0x9a17('0x32')];if(!_0x47a635[_0x9a17('0x33')]['hasOwnProperty'](_0x9a17('0x3a'))){_0x3bd416[_0x9a17('0x1d')]=qs[_0x9a17('0x1d')](_0x47a635[_0x9a17('0x33')][_0x9a17('0x1d')]);_0x3bd416[_0x9a17('0x1c')]=qs['offset'](_0x47a635[_0x9a17('0x33')][_0x9a17('0x1c')]);}_0x3bd416[_0x9a17('0x3b')]=qs[_0x9a17('0x3c')](_0x47a635[_0x9a17('0x33')][_0x9a17('0x3c')]);_0x3bd416[_0x9a17('0x3d')]=qs[_0x9a17('0x35')](_[_0x9a17('0x3e')](_0x47a635[_0x9a17('0x33')],_0x309566[_0x9a17('0x35')]),_0x668cb7);if(_0x47a635[_0x9a17('0x33')]['filter']){_0x3bd416['where']=_[_0x9a17('0x3f')](_0x3bd416[_0x9a17('0x3d')],{'$or':_['map'](_0x668cb7,function(_0x7a894){if(_0x7a894[_0x9a17('0x31')]!==_0x9a17('0x40')){var _0x1819fc={};_0x1819fc[_0x7a894[_0x9a17('0x2b')]]={'$like':'%'+_0x47a635[_0x9a17('0x33')][_0x9a17('0x41')]+'%'};return _0x1819fc;}})});}_0x3bd416=_[_0x9a17('0x3f')]({},_0x3bd416,_0x47a635[_0x9a17('0x42')]);var _0x39ecfa={'where':_0x3bd416[_0x9a17('0x3d')]};return db[_0x9a17('0x2e')]['count'](_0x39ecfa)[_0x9a17('0x24')](function(_0x31725e){_0x250b56[_0x9a17('0x1f')]=_0x31725e;if(_0x47a635[_0x9a17('0x33')][_0x9a17('0x43')]){_0x3bd416['include']=[{'all':!![]}];}return db[_0x9a17('0x2e')][_0x9a17('0x44')](_0x3bd416);})[_0x9a17('0x24')](function(_0x4cc6b0){_0x250b56['rows']=_0x4cc6b0;return _0x250b56;})[_0x9a17('0x24')](respondWithFilteredResult(_0x41f8e9,_0x3bd416))[_0x9a17('0x45')](handleError(_0x41f8e9,null));};exports[_0x9a17('0x46')]=function(_0x10426b,_0x57f1ed){var _0x325e69={'raw':!![],'where':{'id':_0x10426b[_0x9a17('0x47')]['id']}},_0x45e4c3={};_0x45e4c3[_0x9a17('0x32')]=_['keys'](db[_0x9a17('0x2e')][_0x9a17('0x2f')]);_0x45e4c3['query']=_['keys'](_0x10426b[_0x9a17('0x33')]);_0x45e4c3['filters']=_[_0x9a17('0x36')](_0x45e4c3[_0x9a17('0x32')],_0x45e4c3[_0x9a17('0x33')]);_0x325e69[_0x9a17('0x37')]=_[_0x9a17('0x36')](_0x45e4c3['model'],qs[_0x9a17('0x38')](_0x10426b['query'][_0x9a17('0x38')]));_0x325e69[_0x9a17('0x37')]=_0x325e69[_0x9a17('0x37')][_0x9a17('0x39')]?_0x325e69[_0x9a17('0x37')]:_0x45e4c3[_0x9a17('0x32')];if(_0x10426b[_0x9a17('0x33')]['includeAll']){_0x325e69[_0x9a17('0x48')]=[{'all':!![]}];}_0x325e69=_[_0x9a17('0x3f')]({},_0x325e69,_0x10426b[_0x9a17('0x42')]);return db[_0x9a17('0x2e')]['find'](_0x325e69)[_0x9a17('0x24')](handleEntityNotFound(_0x57f1ed,null))[_0x9a17('0x24')](respondWithResult(_0x57f1ed,null))[_0x9a17('0x45')](handleError(_0x57f1ed,null));};exports[_0x9a17('0x49')]=function(_0x7d48d8,_0x5485ad){return db['Template']['create'](_0x7d48d8[_0x9a17('0x4a')],{})[_0x9a17('0x24')](function(_0x19ffea){var _0xf405b7=_0x7d48d8['user'][_0x9a17('0x25')]({'plain':!![]});if(!_0xf405b7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf405b7[_0x9a17('0x4b')]===_0x9a17('0x4c')){var _0x151f65=_0x19ffea[_0x9a17('0x25')]({'plain':!![]});var _0x494125=_0x9a17('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x494125,'userProfileId':_0xf405b7[_0x9a17('0x4d')]},'raw':!![]})[_0x9a17('0x24')](function(_0x1416ce){if(_0x1416ce&&_0x1416ce[_0x9a17('0x4e')]===0x0){return db[_0x9a17('0x27')][_0x9a17('0x49')]({'name':_0x151f65[_0x9a17('0x2b')],'resourceId':_0x151f65['id'],'type':_0x1416ce[_0x9a17('0x2b')],'sectionId':_0x1416ce['id']},{})['then'](function(){return _0x19ffea;});}else{return _0x19ffea;}})[_0x9a17('0x45')](function(_0x50068e){logger[_0x9a17('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50068e);throw _0x50068e;});}return _0x19ffea;})[_0x9a17('0x24')](respondWithResult(_0x5485ad,0xc9))[_0x9a17('0x45')](handleError(_0x5485ad,null));};exports[_0x9a17('0x23')]=function(_0x4fcb94,_0x382ddc){if(_0x4fcb94['body']['id']){delete _0x4fcb94[_0x9a17('0x4a')]['id'];}return db[_0x9a17('0x2e')][_0x9a17('0x4f')]({'where':{'id':_0x4fcb94[_0x9a17('0x47')]['id']}})['then'](handleEntityNotFound(_0x382ddc,null))[_0x9a17('0x24')](saveUpdates(_0x4fcb94[_0x9a17('0x4a')],null))['then'](respondWithResult(_0x382ddc,null))[_0x9a17('0x45')](handleError(_0x382ddc,null));};exports['destroy']=function(_0x5a186b,_0x355771){return db['Template']['find']({'where':{'id':_0x5a186b[_0x9a17('0x47')]['id']}})[_0x9a17('0x24')](handleEntityNotFound(_0x355771,null))[_0x9a17('0x24')](removeEntity(_0x355771,null))['catch'](handleError(_0x355771,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 7d337c8..bff41a4 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 _0x2afb=['api','moment','bluebird','request-promise','path','define','Template','lodash','util','../../config/logger'];(function(_0x2e56b1,_0x3ee61a){var _0x4c1d3f=function(_0x1c8bab){while(--_0x1c8bab){_0x2e56b1['push'](_0x2e56b1['shift']());}};_0x4c1d3f(++_0x3ee61a);}(_0x2afb,0x165));var _0xb2af=function(_0x2986fb,_0x9482a0){_0x2986fb=_0x2986fb-0x0;var _0xb3c156=_0x2afb[_0x2986fb];return _0xb3c156;};'use strict';var _=require(_0xb2af('0x0'));var util=require(_0xb2af('0x1'));var logger=require(_0xb2af('0x2'))(_0xb2af('0x3'));var moment=require(_0xb2af('0x4'));var BPromise=require(_0xb2af('0x5'));var rp=require(_0xb2af('0x6'));var fs=require('fs');var path=require(_0xb2af('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./template.attributes');module['exports']=function(_0x5c6018,_0x7a4847){return _0x5c6018[_0xb2af('0x8')](_0xb2af('0x9'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdeb6=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./template.attributes','Template','tools_templates','lodash'];(function(_0x3a9481,_0x25a086){var _0x544a2f=function(_0x1a8917){while(--_0x1a8917){_0x3a9481['push'](_0x3a9481['shift']());}};_0x544a2f(++_0x25a086);}(_0xdeb6,0xf1));var _0x6deb=function(_0x504c88,_0x1c3016){_0x504c88=_0x504c88-0x0;var _0xb5611e=_0xdeb6[_0x504c88];return _0xb5611e;};'use strict';var _=require(_0x6deb('0x0'));var util=require(_0x6deb('0x1'));var logger=require(_0x6deb('0x2'))(_0x6deb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6deb('0x4'));var fs=require('fs');var path=require(_0x6deb('0x5'));var rimraf=require(_0x6deb('0x6'));var config=require(_0x6deb('0x7'));var attributes=require(_0x6deb('0x8'));module['exports']=function(_0x10b3f1,_0x1b4b25){return _0x10b3f1['define'](_0x6deb('0x9'),attributes,{'tableName':_0x6deb('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 a75f50e..2fdf5a6 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 _0xd3ec=['request','then','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetTemplate','Template','findAll','options','where','attributes','limit','include','model','map','info','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x5fdf81,_0x50ab35){var _0x31198a=function(_0x1b8158){while(--_0x1b8158){_0x5fdf81['push'](_0x5fdf81['shift']());}};_0x31198a(++_0x50ab35);}(_0xd3ec,0x1c9));var _0xcd3e=function(_0x4ca789,_0x2340b2){_0x4ca789=_0x4ca789-0x0;var _0x2efc92=_0xd3ec[_0x4ca789];return _0x2efc92;};'use strict';var _=require(_0xcd3e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcd3e('0x1'));var fs=require('fs');var Redis=require(_0xcd3e('0x2'));var db=require(_0xcd3e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcd3e('0x4'))(_0xcd3e('0x5'));var config=require('../../config/environment');var jayson=require(_0xcd3e('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xbfa4b4,_0x45dfba,_0x18cdd7){return new BPromise(function(_0x3e3946,_0x6206ba){return client[_0xcd3e('0x7')](_0xbfa4b4,_0x18cdd7)[_0xcd3e('0x8')](function(_0x469bae){logger['info'](_0xcd3e('0x9'),_0x45dfba,_0xcd3e('0xa'));logger[_0xcd3e('0xb')](_0xcd3e('0xc'),_0x45dfba,'request\x20sent',JSON[_0xcd3e('0xd')](_0x469bae));if(_0x469bae[_0xcd3e('0xe')]){if(_0x469bae[_0xcd3e('0xe')]['code']===0x1f4){logger[_0xcd3e('0xe')](_0xcd3e('0x9'),_0x45dfba,_0x469bae['error'][_0xcd3e('0xf')]);return _0x6206ba(_0x469bae[_0xcd3e('0xe')][_0xcd3e('0xf')]);}logger[_0xcd3e('0xe')](_0xcd3e('0x9'),_0x45dfba,_0x469bae['error'][_0xcd3e('0xf')]);return _0x3e3946(_0x469bae[_0xcd3e('0xe')]['message']);}else{logger['info']('Template,\x20%s,\x20%s',_0x45dfba,_0xcd3e('0xa'));_0x3e3946(_0x469bae[_0xcd3e('0x10')][_0xcd3e('0xf')]);}})[_0xcd3e('0x11')](function(_0x3158a1){logger[_0xcd3e('0xe')](_0xcd3e('0x9'),_0x45dfba,_0x3158a1);_0x6206ba(_0x3158a1);});});}exports[_0xcd3e('0x12')]=function(_0x5889f0){var _0x2021d2=this;return new Promise(function(_0x151190,_0x1e076a){return db[_0xcd3e('0x13')][_0xcd3e('0x14')]({'raw':_0x5889f0[_0xcd3e('0x15')]?_0x5889f0[_0xcd3e('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x5889f0[_0xcd3e('0x15')]?_0x5889f0[_0xcd3e('0x15')][_0xcd3e('0x16')]||null:null,'attributes':_0x5889f0[_0xcd3e('0x15')]?_0x5889f0[_0xcd3e('0x15')][_0xcd3e('0x17')]||null:null,'limit':_0x5889f0[_0xcd3e('0x15')]?_0x5889f0[_0xcd3e('0x15')][_0xcd3e('0x18')]||null:null,'include':_0x5889f0['options']?_0x5889f0[_0xcd3e('0x15')][_0xcd3e('0x19')]?_['map'](_0x5889f0['options'][_0xcd3e('0x19')],function(_0x3adc99){return{'model':db[_0x3adc99[_0xcd3e('0x1a')]],'as':_0x3adc99['as'],'attributes':_0x3adc99[_0xcd3e('0x17')],'include':_0x3adc99[_0xcd3e('0x19')]?_[_0xcd3e('0x1b')](_0x3adc99[_0xcd3e('0x19')],function(_0x3d4e80){return{'model':db[_0x3d4e80[_0xcd3e('0x1a')]],'as':_0x3d4e80['as'],'attributes':_0x3d4e80[_0xcd3e('0x17')],'include':_0x3d4e80[_0xcd3e('0x19')]?_['map'](_0x3d4e80[_0xcd3e('0x19')],function(_0x2df55d){return{'model':db[_0x2df55d[_0xcd3e('0x1a')]],'as':_0x2df55d['as'],'attributes':_0x2df55d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3569fb){logger[_0xcd3e('0x1c')](_0xcd3e('0x12'),_0x5889f0);logger['debug']('GetTemplate',_0x5889f0,JSON[_0xcd3e('0xd')](_0x3569fb));_0x151190(_0x3569fb);})[_0xcd3e('0x11')](function(_0x428302){logger[_0xcd3e('0xe')](_0xcd3e('0x12'),_0x428302[_0xcd3e('0xf')],_0x5889f0);_0x1e076a(_0x2021d2[_0xcd3e('0xe')](0x1f4,_0x428302[_0xcd3e('0xf')]));});});}; \ No newline at end of file +var _0xe20c=['Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetTemplate','Template','findAll','options','where','limit','map','include','model','attributes','lodash','moment','randomstring','ioredis','../../config/logger','client','request','then','info'];(function(_0x4a23c0,_0x13c0a4){var _0x1a26e2=function(_0x45bb7a){while(--_0x45bb7a){_0x4a23c0['push'](_0x4a23c0['shift']());}};_0x1a26e2(++_0x13c0a4);}(_0xe20c,0x9f));var _0xce20=function(_0x41dc07,_0x581739){_0x41dc07=_0x41dc07-0x0;var _0x4d6315=_0xe20c[_0x41dc07];return _0x4d6315;};'use strict';var _=require(_0xce20('0x0'));var util=require('util');var moment=require(_0xce20('0x1'));var BPromise=require('bluebird');var rs=require(_0xce20('0x2'));var fs=require('fs');var Redis=require(_0xce20('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xce20('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xce20('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x115fae,_0x5febc9,_0x24b640){return new BPromise(function(_0x613f1,_0x1f76cf){return client[_0xce20('0x6')](_0x115fae,_0x24b640)[_0xce20('0x7')](function(_0x36fcb3){logger[_0xce20('0x8')](_0xce20('0x9'),_0x5febc9,_0xce20('0xa'));logger[_0xce20('0xb')](_0xce20('0xc'),_0x5febc9,'request\x20sent',JSON[_0xce20('0xd')](_0x36fcb3));if(_0x36fcb3[_0xce20('0xe')]){if(_0x36fcb3[_0xce20('0xe')][_0xce20('0xf')]===0x1f4){logger[_0xce20('0xe')](_0xce20('0x9'),_0x5febc9,_0x36fcb3[_0xce20('0xe')]['message']);return _0x1f76cf(_0x36fcb3[_0xce20('0xe')][_0xce20('0x10')]);}logger[_0xce20('0xe')](_0xce20('0x9'),_0x5febc9,_0x36fcb3[_0xce20('0xe')][_0xce20('0x10')]);return _0x613f1(_0x36fcb3[_0xce20('0xe')][_0xce20('0x10')]);}else{logger[_0xce20('0x8')](_0xce20('0x9'),_0x5febc9,_0xce20('0xa'));_0x613f1(_0x36fcb3[_0xce20('0x11')][_0xce20('0x10')]);}})['catch'](function(_0x51c499){logger[_0xce20('0xe')]('Template,\x20%s,\x20%s',_0x5febc9,_0x51c499);_0x1f76cf(_0x51c499);});});}exports[_0xce20('0x12')]=function(_0x9d7d14){var _0x5c54e4=this;return new Promise(function(_0x3afc81,_0x507342){return db[_0xce20('0x13')][_0xce20('0x14')]({'raw':_0x9d7d14['options']?_0x9d7d14[_0xce20('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x9d7d14['options']?_0x9d7d14[_0xce20('0x15')][_0xce20('0x16')]||null:null,'attributes':_0x9d7d14[_0xce20('0x15')]?_0x9d7d14[_0xce20('0x15')]['attributes']||null:null,'limit':_0x9d7d14[_0xce20('0x15')]?_0x9d7d14[_0xce20('0x15')][_0xce20('0x17')]||null:null,'include':_0x9d7d14[_0xce20('0x15')]?_0x9d7d14['options']['include']?_[_0xce20('0x18')](_0x9d7d14[_0xce20('0x15')][_0xce20('0x19')],function(_0x26c06e){return{'model':db[_0x26c06e[_0xce20('0x1a')]],'as':_0x26c06e['as'],'attributes':_0x26c06e['attributes'],'include':_0x26c06e['include']?_[_0xce20('0x18')](_0x26c06e[_0xce20('0x19')],function(_0x5ea2c5){return{'model':db[_0x5ea2c5[_0xce20('0x1a')]],'as':_0x5ea2c5['as'],'attributes':_0x5ea2c5[_0xce20('0x1b')],'include':_0x5ea2c5[_0xce20('0x19')]?_[_0xce20('0x18')](_0x5ea2c5['include'],function(_0x436262){return{'model':db[_0x436262[_0xce20('0x1a')]],'as':_0x436262['as'],'attributes':_0x436262['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4cd5ee){logger[_0xce20('0x8')](_0xce20('0x12'),_0x9d7d14);logger[_0xce20('0xb')](_0xce20('0x12'),_0x9d7d14,JSON[_0xce20('0xd')](_0x4cd5ee));_0x3afc81(_0x4cd5ee);})['catch'](function(_0x3b9881){logger[_0xce20('0xe')](_0xce20('0x12'),_0x3b9881[_0xce20('0x10')],_0x9d7d14);_0x507342(_0x5c54e4['error'](0x1f4,_0x3b9881[_0xce20('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 0e14ab2..959f11e 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 _0x96bb=['/:id/any_conditions','/:id/actions','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','/:id','/:id/all_conditions','getAllConditions','getAnyConditions','getActions','post','addAllCondition'];(function(_0x4dff55,_0x18cd20){var _0x53b1a8=function(_0x1758be){while(--_0x1758be){_0x4dff55['push'](_0x4dff55['shift']());}};_0x53b1a8(++_0x18cd20);}(_0x96bb,0x9c));var _0xb96b=function(_0x111165,_0x4f9303){_0x111165=_0x111165-0x0;var _0x64f7b6=_0x96bb[_0x111165];return _0x64f7b6;};'use strict';var multer=require('multer');var util=require(_0xb96b('0x0'));var path=require(_0xb96b('0x1'));var timeout=require(_0xb96b('0x2'));var express=require(_0xb96b('0x3'));var router=express[_0xb96b('0x4')]();var fs_extra=require(_0xb96b('0x5'));var auth=require(_0xb96b('0x6'));var interaction=require(_0xb96b('0x7'));var config=require(_0xb96b('0x8'));var controller=require(_0xb96b('0x9'));router[_0xb96b('0xa')]('/',auth[_0xb96b('0xb')](),controller['index']);router['get'](_0xb96b('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xb96b('0xa')](_0xb96b('0xd'),auth[_0xb96b('0xb')](),controller[_0xb96b('0xe')]);router[_0xb96b('0xa')]('/:id/any_conditions',auth[_0xb96b('0xb')](),controller[_0xb96b('0xf')]);router['get']('/:id/actions',auth[_0xb96b('0xb')](),controller[_0xb96b('0x10')]);router['post']('/',auth[_0xb96b('0xb')](),controller['create']);router[_0xb96b('0x11')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0xb96b('0x12')]);router['post'](_0xb96b('0x13'),auth[_0xb96b('0xb')](),controller['addAnyCondition']);router[_0xb96b('0x11')](_0xb96b('0x14'),auth[_0xb96b('0xb')](),controller['addAction']);router[_0xb96b('0x15')](_0xb96b('0xc'),auth[_0xb96b('0xb')](),controller[_0xb96b('0x16')]);router['delete']('/:id',auth[_0xb96b('0xb')](),controller[_0xb96b('0x17')]);module[_0xb96b('0x18')]=router; \ No newline at end of file +var _0x55ec=['../../components/interaction/service','./trigger.controller','get','isAuthenticated','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','addAllCondition','addAnyCondition','addAction','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4fbd9c,_0x45a9d6){var _0x21f2d4=function(_0x56c46d){while(--_0x56c46d){_0x4fbd9c['push'](_0x4fbd9c['shift']());}};_0x21f2d4(++_0x45a9d6);}(_0x55ec,0x9a));var _0xc55e=function(_0x2d2258,_0x2ce510){_0x2d2258=_0x2d2258-0x0;var _0x18e155=_0x55ec[_0x2d2258];return _0x18e155;};'use strict';var multer=require(_0xc55e('0x0'));var util=require(_0xc55e('0x1'));var path=require(_0xc55e('0x2'));var timeout=require(_0xc55e('0x3'));var express=require(_0xc55e('0x4'));var router=express[_0xc55e('0x5')]();var fs_extra=require(_0xc55e('0x6'));var auth=require(_0xc55e('0x7'));var interaction=require(_0xc55e('0x8'));var config=require('../../config/environment');var controller=require(_0xc55e('0x9'));router[_0xc55e('0xa')]('/',auth[_0xc55e('0xb')](),controller['index']);router[_0xc55e('0xa')](_0xc55e('0xc'),auth[_0xc55e('0xb')](),controller[_0xc55e('0xd')]);router[_0xc55e('0xa')](_0xc55e('0xe'),auth[_0xc55e('0xb')](),controller[_0xc55e('0xf')]);router[_0xc55e('0xa')](_0xc55e('0x10'),auth[_0xc55e('0xb')](),controller[_0xc55e('0x11')]);router[_0xc55e('0xa')](_0xc55e('0x12'),auth[_0xc55e('0xb')](),controller['getActions']);router[_0xc55e('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc55e('0x13')](_0xc55e('0xe'),auth[_0xc55e('0xb')](),controller[_0xc55e('0x14')]);router['post'](_0xc55e('0x10'),auth[_0xc55e('0xb')](),controller[_0xc55e('0x15')]);router['post'](_0xc55e('0x12'),auth[_0xc55e('0xb')](),controller[_0xc55e('0x16')]);router['put']('/:id',auth[_0xc55e('0xb')](),controller[_0xc55e('0x17')]);router[_0xc55e('0x18')](_0xc55e('0xc'),auth[_0xc55e('0xb')](),controller[_0xc55e('0x19')]);module[_0xc55e('0x1a')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 78e7098..6df2237 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 _0x4f3f=['exports','STRING'];(function(_0x24c405,_0x56d6fb){var _0x383aef=function(_0x20da69){while(--_0x20da69){_0x24c405['push'](_0x24c405['shift']());}};_0x383aef(++_0x56d6fb);}(_0x4f3f,0x102));var _0xf4f3=function(_0x24d611,_0xf5742d){_0x24d611=_0x24d611-0x0;var _0x581ac0=_0x4f3f[_0x24d611];return _0x581ac0;};'use strict';var Sequelize=require('sequelize');module[_0xf4f3('0x0')]={'name':{'type':Sequelize[_0xf4f3('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf4f3('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xd004=['sequelize','exports','STRING','BOOLEAN'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd004,0x180));var _0x4d00=function(_0x291c9b,_0x52cdf2){_0x291c9b=_0x291c9b-0x0;var _0x5c392b=_0xd004[_0x291c9b];return _0x5c392b;};'use strict';var Sequelize=require(_0x4d00('0x0'));module[_0x4d00('0x1')]={'name':{'type':Sequelize[_0x4d00('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4d00('0x2')]},'status':{'type':Sequelize[_0x4d00('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 214d9d1..3bd1fa0 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 _0x1d78=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','Triggers','UserProfileResource','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','sort','where','merge','filter','options','Trigger','includeAll','include','findAll','rows','show','params','keys','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','order','length','hasOwnProperty','nolimit','pick','getAnyConditions','TriggerId','Action','getActions','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x3c64ab,_0x130481){var _0x14346c=function(_0x3942e5){while(--_0x3942e5){_0x3c64ab['push'](_0x3c64ab['shift']());}};_0x14346c(++_0x130481);}(_0x1d78,0x1c6));var _0x81d7=function(_0xd37178,_0x54616a){_0xd37178=_0xd37178-0x0;var _0x468262=_0x1d78[_0xd37178];return _0x468262;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x81d7('0x0'));var zipdir=require(_0x81d7('0x1'));var jsonpatch=require(_0x81d7('0x2'));var rp=require('request-promise');var moment=require(_0x81d7('0x3'));var BPromise=require(_0x81d7('0x4'));var Mustache=require(_0x81d7('0x5'));var util=require(_0x81d7('0x6'));var path=require('path');var sox=require(_0x81d7('0x7'));var csv=require(_0x81d7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x81d7('0x9'));var _=require(_0x81d7('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x81d7('0xb'));var deskjs=require(_0x81d7('0xc'));var toCsv=require('to-csv');var querystring=require(_0x81d7('0xd'));var Papa=require(_0x81d7('0xe'));var Redis=require(_0x81d7('0xf'));var authService=require(_0x81d7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x81d7('0x11'));var hardwareService=require(_0x81d7('0x12'));var logger=require(_0x81d7('0x13'))(_0x81d7('0x14'));var utils=require(_0x81d7('0x15'));var config=require(_0x81d7('0x16'));var licenseUtil=require(_0x81d7('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c7d45,_0x74bcb){_0x74bcb=_0x74bcb||0xcc;return function(_0x2e8438){if(_0x2e8438){return _0x3c7d45[_0x81d7('0x18')](_0x74bcb);}return _0x3c7d45[_0x81d7('0x19')](_0x74bcb)[_0x81d7('0x1a')]();};}function respondWithResult(_0x10f55d,_0x3ff680){_0x3ff680=_0x3ff680||0xc8;return function(_0x4ff65b){if(_0x4ff65b){return _0x10f55d[_0x81d7('0x19')](_0x3ff680)[_0x81d7('0x1b')](_0x4ff65b);}};}function respondWithFilteredResult(_0x599b8f,_0x2d9b69){return function(_0x3cc430){if(_0x3cc430){var _0x220c5d=typeof _0x2d9b69[_0x81d7('0x1c')]===_0x81d7('0x1d')&&typeof _0x2d9b69[_0x81d7('0x1e')]===_0x81d7('0x1d');var _0x1c7654=_0x3cc430[_0x81d7('0x1f')];var _0x1bf333=_0x220c5d?0x0:_0x2d9b69[_0x81d7('0x1c')];var _0x5665d5=_0x220c5d?_0x3cc430[_0x81d7('0x1f')]:_0x2d9b69['offset']+_0x2d9b69['limit'];var _0x7e7836;if(_0x5665d5>=_0x1c7654){_0x5665d5=_0x1c7654;_0x7e7836=0xc8;}else{_0x7e7836=0xce;}_0x599b8f[_0x81d7('0x19')](_0x7e7836);return _0x599b8f[_0x81d7('0x20')]('Content-Range',_0x1bf333+'-'+_0x5665d5+'/'+_0x1c7654)[_0x81d7('0x1b')](_0x3cc430);}return null;};}function patchUpdates(_0x2c844f){return function(_0x32a26f){try{jsonpatch[_0x81d7('0x21')](_0x32a26f,_0x2c844f,!![]);}catch(_0x56114b){return BPromise[_0x81d7('0x22')](_0x56114b);}return _0x32a26f[_0x81d7('0x23')]();};}function saveUpdates(_0x369dea,_0x3a8585){return function(_0x3467ea){if(_0x3467ea){return _0x3467ea[_0x81d7('0x24')](_0x369dea)[_0x81d7('0x25')](function(_0x1ffe34){return _0x1ffe34;});}return null;};}function removeEntity(_0x10d7c7,_0x12b3df){return function(_0x48ff7d){if(_0x48ff7d){return _0x48ff7d[_0x81d7('0x26')]()[_0x81d7('0x25')](function(){var _0x301a2e=_0x48ff7d['get']({'plain':!![]});var _0x5474ec=_0x81d7('0x27');return db[_0x81d7('0x28')][_0x81d7('0x26')]({'where':{'type':_0x5474ec,'resourceId':_0x301a2e['id']}})[_0x81d7('0x25')](function(){return _0x48ff7d;});})['then'](function(){_0x10d7c7[_0x81d7('0x19')](0xcc)[_0x81d7('0x1a')]();});}};}function handleEntityNotFound(_0x2d5f09,_0x5d57a8){return function(_0x5bd7b7){if(!_0x5bd7b7){_0x2d5f09['sendStatus'](0x194);}return _0x5bd7b7;};}function handleError(_0x404c55,_0x42e1c1){_0x42e1c1=_0x42e1c1||0x1f4;return function(_0x11d3f5){logger['error'](_0x11d3f5['stack']);if(_0x11d3f5[_0x81d7('0x29')]){delete _0x11d3f5[_0x81d7('0x29')];}_0x404c55[_0x81d7('0x19')](_0x42e1c1)[_0x81d7('0x2a')](_0x11d3f5);};}exports[_0x81d7('0x2b')]=function(_0x5152c0,_0x5b369d){var _0xdd2bcb={},_0x36ec03={},_0x11e4f0={'count':0x0,'rows':[]};var _0x8e9050=_[_0x81d7('0x2c')](db['Trigger'][_0x81d7('0x2d')],function(_0x3d1a07){return{'name':_0x3d1a07[_0x81d7('0x2e')],'type':_0x3d1a07[_0x81d7('0x2f')][_0x81d7('0x30')]};});_0x36ec03['model']=_[_0x81d7('0x2c')](_0x8e9050,_0x81d7('0x29'));_0x36ec03['query']=_['keys'](_0x5152c0[_0x81d7('0x31')]);_0x36ec03[_0x81d7('0x32')]=_[_0x81d7('0x33')](_0x36ec03[_0x81d7('0x34')],_0x36ec03[_0x81d7('0x31')]);_0xdd2bcb[_0x81d7('0x35')]=_['intersection'](_0x36ec03['model'],qs[_0x81d7('0x36')](_0x5152c0['query'][_0x81d7('0x36')]));_0xdd2bcb[_0x81d7('0x35')]=_0xdd2bcb[_0x81d7('0x35')]['length']?_0xdd2bcb[_0x81d7('0x35')]:_0x36ec03[_0x81d7('0x34')];if(!_0x5152c0['query']['hasOwnProperty']('nolimit')){_0xdd2bcb[_0x81d7('0x1e')]=qs[_0x81d7('0x1e')](_0x5152c0[_0x81d7('0x31')][_0x81d7('0x1e')]);_0xdd2bcb[_0x81d7('0x1c')]=qs[_0x81d7('0x1c')](_0x5152c0[_0x81d7('0x31')][_0x81d7('0x1c')]);}_0xdd2bcb['order']=qs[_0x81d7('0x37')](_0x5152c0[_0x81d7('0x31')]['sort']);_0xdd2bcb[_0x81d7('0x38')]=qs[_0x81d7('0x32')](_['pick'](_0x5152c0[_0x81d7('0x31')],_0x36ec03[_0x81d7('0x32')]),_0x8e9050);if(_0x5152c0['query']['filter']){_0xdd2bcb[_0x81d7('0x38')]=_[_0x81d7('0x39')](_0xdd2bcb[_0x81d7('0x38')],{'$or':_['map'](_0x8e9050,function(_0x100c01){if(_0x100c01['type']!=='VIRTUAL'){var _0x2605da={};_0x2605da[_0x100c01[_0x81d7('0x29')]]={'$like':'%'+_0x5152c0[_0x81d7('0x31')][_0x81d7('0x3a')]+'%'};return _0x2605da;}})});}_0xdd2bcb=_['merge']({},_0xdd2bcb,_0x5152c0[_0x81d7('0x3b')]);var _0x4ef933={'where':_0xdd2bcb[_0x81d7('0x38')]};return db[_0x81d7('0x3c')]['count'](_0x4ef933)[_0x81d7('0x25')](function(_0x3177e3){_0x11e4f0[_0x81d7('0x1f')]=_0x3177e3;if(_0x5152c0[_0x81d7('0x31')][_0x81d7('0x3d')]){_0xdd2bcb[_0x81d7('0x3e')]=[{'all':!![]}];}return db['Trigger'][_0x81d7('0x3f')](_0xdd2bcb);})[_0x81d7('0x25')](function(_0x34decc){_0x11e4f0[_0x81d7('0x40')]=_0x34decc;return _0x11e4f0;})[_0x81d7('0x25')](respondWithFilteredResult(_0x5b369d,_0xdd2bcb))['catch'](handleError(_0x5b369d,null));};exports[_0x81d7('0x41')]=function(_0x5acd8f,_0x6f3127){var _0x21c5ca={'raw':![],'where':{'id':_0x5acd8f[_0x81d7('0x42')]['id']}},_0x566469={};_0x566469['model']=_[_0x81d7('0x43')](db[_0x81d7('0x3c')]['rawAttributes']);_0x566469[_0x81d7('0x31')]=_[_0x81d7('0x43')](_0x5acd8f[_0x81d7('0x31')]);_0x566469[_0x81d7('0x32')]=_['intersection'](_0x566469['model'],_0x566469['query']);_0x21c5ca[_0x81d7('0x35')]=_[_0x81d7('0x33')](_0x566469['model'],qs[_0x81d7('0x36')](_0x5acd8f['query'][_0x81d7('0x36')]));_0x21c5ca[_0x81d7('0x35')]=_0x21c5ca[_0x81d7('0x35')]['length']?_0x21c5ca[_0x81d7('0x35')]:_0x566469[_0x81d7('0x34')];if(_0x5acd8f[_0x81d7('0x31')][_0x81d7('0x3d')]){_0x21c5ca[_0x81d7('0x3e')]=[{'all':!![]}];}_0x21c5ca=_[_0x81d7('0x39')]({},_0x21c5ca,_0x5acd8f[_0x81d7('0x3b')]);return db[_0x81d7('0x3c')]['find'](_0x21c5ca)[_0x81d7('0x25')](handleEntityNotFound(_0x6f3127,null))[_0x81d7('0x25')](respondWithResult(_0x6f3127,null))[_0x81d7('0x44')](handleError(_0x6f3127,null));};exports[_0x81d7('0x45')]=function(_0x45acb6,_0x58cf52){return db[_0x81d7('0x3c')][_0x81d7('0x45')](_0x45acb6[_0x81d7('0x46')],{})[_0x81d7('0x25')](function(_0x3d339e){var _0x3e8979=_0x45acb6[_0x81d7('0x47')][_0x81d7('0x48')]({'plain':!![]});if(!_0x3e8979)throw new Error(_0x81d7('0x49'));if(_0x3e8979[_0x81d7('0x4a')]===_0x81d7('0x47')){var _0x4ad901=_0x3d339e['get']({'plain':!![]});var _0x18b3ad=_0x81d7('0x27');return db['UserProfileSection'][_0x81d7('0x4b')]({'where':{'name':_0x18b3ad,'userProfileId':_0x3e8979[_0x81d7('0x4c')]},'raw':!![]})[_0x81d7('0x25')](function(_0x183605){if(_0x183605&&_0x183605[_0x81d7('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x4ad901[_0x81d7('0x29')],'resourceId':_0x4ad901['id'],'type':_0x183605['name'],'sectionId':_0x183605['id']},{})[_0x81d7('0x25')](function(){return _0x3d339e;});}else{return _0x3d339e;}})['catch'](function(_0x2aef55){logger['error'](_0x81d7('0x4e'),_0x2aef55);throw _0x2aef55;});}return _0x3d339e;})[_0x81d7('0x25')](respondWithResult(_0x58cf52,0xc9))[_0x81d7('0x44')](handleError(_0x58cf52,null));};exports[_0x81d7('0x24')]=function(_0x380cd1,_0x521e6c){if(_0x380cd1['body']['id']){delete _0x380cd1['body']['id'];}return db[_0x81d7('0x3c')][_0x81d7('0x4b')]({'where':{'id':_0x380cd1[_0x81d7('0x42')]['id']}})[_0x81d7('0x25')](handleEntityNotFound(_0x521e6c,null))[_0x81d7('0x25')](saveUpdates(_0x380cd1['body'],null))[_0x81d7('0x25')](respondWithResult(_0x521e6c,null))[_0x81d7('0x44')](handleError(_0x521e6c,null));};exports[_0x81d7('0x26')]=function(_0x3e6057,_0x36b568){return db[_0x81d7('0x3c')][_0x81d7('0x4b')]({'where':{'id':_0x3e6057[_0x81d7('0x42')]['id']}})[_0x81d7('0x25')](handleEntityNotFound(_0x36b568,null))[_0x81d7('0x25')](removeEntity(_0x36b568,null))[_0x81d7('0x44')](handleError(_0x36b568,null));};exports[_0x81d7('0x4f')]=function(_0x145e0f,_0x910b6a,_0x280b55){if(_0x145e0f[_0x81d7('0x46')]['id']){delete _0x145e0f['body']['id'];}return db[_0x81d7('0x3c')][_0x81d7('0x4b')]({'where':{'id':_0x145e0f[_0x81d7('0x42')]['id']}})['then'](handleEntityNotFound(_0x910b6a,null))[_0x81d7('0x25')](function(_0x38ae76){if(_0x38ae76){_0x145e0f[_0x81d7('0x46')][_0x81d7('0x50')]=_0x38ae76['id'];return db[_0x81d7('0x51')][_0x81d7('0x45')](_0x145e0f[_0x81d7('0x46')]);}})[_0x81d7('0x25')](respondWithResult(_0x910b6a,null))['catch'](handleError(_0x910b6a,null));};exports[_0x81d7('0x52')]=function(_0x38485b,_0x1079a8,_0x557c77){if(_0x38485b[_0x81d7('0x46')]['id']){delete _0x38485b[_0x81d7('0x46')]['id'];}return db[_0x81d7('0x3c')][_0x81d7('0x4b')]({'where':{'id':_0x38485b['params']['id']}})[_0x81d7('0x25')](handleEntityNotFound(_0x1079a8,null))['then'](function(_0xe09585){if(_0xe09585){_0x38485b[_0x81d7('0x46')][_0x81d7('0x53')]=_0xe09585['id'];return db['Condition'][_0x81d7('0x45')](_0x38485b[_0x81d7('0x46')]);}})[_0x81d7('0x25')](respondWithResult(_0x1079a8,null))[_0x81d7('0x44')](handleError(_0x1079a8,null));};exports[_0x81d7('0x54')]=function(_0x4aa9bd,_0x270e9e,_0x506dd6){var _0x1104a4={};var _0x25427f={};var _0x1362b1;var _0x1833c9;return db[_0x81d7('0x3c')][_0x81d7('0x55')]({'where':{'id':_0x4aa9bd[_0x81d7('0x42')]['id']}})[_0x81d7('0x25')](handleEntityNotFound(_0x270e9e,null))[_0x81d7('0x25')](function(_0x1aa20d){if(_0x1aa20d){_0x1362b1=_0x1aa20d;_0x25427f[_0x81d7('0x34')]=_[_0x81d7('0x43')](db[_0x81d7('0x51')][_0x81d7('0x2d')]);_0x25427f[_0x81d7('0x31')]=_[_0x81d7('0x43')](_0x4aa9bd['query']);_0x25427f['filters']=_[_0x81d7('0x33')](_0x25427f[_0x81d7('0x34')],_0x25427f[_0x81d7('0x31')]);_0x1104a4[_0x81d7('0x35')]=_['intersection'](_0x25427f[_0x81d7('0x34')],qs[_0x81d7('0x36')](_0x4aa9bd[_0x81d7('0x31')][_0x81d7('0x36')]));_0x1104a4[_0x81d7('0x35')]=_0x1104a4[_0x81d7('0x35')]['length']?_0x1104a4[_0x81d7('0x35')]:_0x25427f[_0x81d7('0x34')];_0x1104a4[_0x81d7('0x56')]=qs['sort'](_0x4aa9bd[_0x81d7('0x31')][_0x81d7('0x37')]);_0x1104a4['where']=qs['filters'](_['pick'](_0x4aa9bd[_0x81d7('0x31')],_0x25427f[_0x81d7('0x32')]));if(_0x4aa9bd[_0x81d7('0x31')][_0x81d7('0x3a')]){_0x1104a4[_0x81d7('0x38')]=_[_0x81d7('0x39')](_0x1104a4[_0x81d7('0x38')],{'$or':_[_0x81d7('0x2c')](_0x1104a4[_0x81d7('0x35')],function(_0x4b7e6a){var _0x12c740={};_0x12c740[_0x4b7e6a]={'$like':'%'+_0x4aa9bd[_0x81d7('0x31')][_0x81d7('0x3a')]+'%'};return _0x12c740;})});}_0x1104a4=_[_0x81d7('0x39')]({},_0x1104a4,_0x4aa9bd[_0x81d7('0x3b')]);return _0x1362b1['getAllConditions'](_0x1104a4);}})['then'](function(_0x574d64){if(_0x574d64){_0x1833c9=_0x574d64[_0x81d7('0x57')];if(!_0x4aa9bd[_0x81d7('0x31')][_0x81d7('0x58')](_0x81d7('0x59'))){_0x1104a4[_0x81d7('0x1e')]=qs[_0x81d7('0x1e')](_0x4aa9bd[_0x81d7('0x31')][_0x81d7('0x1e')]);_0x1104a4[_0x81d7('0x1c')]=qs[_0x81d7('0x1c')](_0x4aa9bd['query'][_0x81d7('0x1c')]);}return _0x1362b1[_0x81d7('0x54')](_0x1104a4);}})[_0x81d7('0x25')](function(_0x1b23d2){if(_0x1b23d2){return _0x1b23d2?{'count':_0x1833c9,'rows':_0x1b23d2}:null;}})[_0x81d7('0x25')](respondWithResult(_0x270e9e,null))[_0x81d7('0x44')](handleError(_0x270e9e,null));};exports['getAnyConditions']=function(_0x162916,_0x1f5404,_0x10e50d){var _0x2c2173={};var _0x30bdcf={};var _0x2153da;var _0x432d79;return db['Trigger'][_0x81d7('0x55')]({'where':{'id':_0x162916[_0x81d7('0x42')]['id']}})['then'](handleEntityNotFound(_0x1f5404,null))[_0x81d7('0x25')](function(_0x15e8cb){if(_0x15e8cb){_0x2153da=_0x15e8cb;_0x30bdcf[_0x81d7('0x34')]=_[_0x81d7('0x43')](db[_0x81d7('0x51')][_0x81d7('0x2d')]);_0x30bdcf['query']=_['keys'](_0x162916['query']);_0x30bdcf['filters']=_[_0x81d7('0x33')](_0x30bdcf[_0x81d7('0x34')],_0x30bdcf[_0x81d7('0x31')]);_0x2c2173[_0x81d7('0x35')]=_['intersection'](_0x30bdcf[_0x81d7('0x34')],qs['fields'](_0x162916[_0x81d7('0x31')][_0x81d7('0x36')]));_0x2c2173[_0x81d7('0x35')]=_0x2c2173[_0x81d7('0x35')]['length']?_0x2c2173[_0x81d7('0x35')]:_0x30bdcf[_0x81d7('0x34')];_0x2c2173[_0x81d7('0x56')]=qs[_0x81d7('0x37')](_0x162916[_0x81d7('0x31')][_0x81d7('0x37')]);_0x2c2173[_0x81d7('0x38')]=qs['filters'](_[_0x81d7('0x5a')](_0x162916[_0x81d7('0x31')],_0x30bdcf['filters']));if(_0x162916['query'][_0x81d7('0x3a')]){_0x2c2173[_0x81d7('0x38')]=_['merge'](_0x2c2173[_0x81d7('0x38')],{'$or':_['map'](_0x2c2173[_0x81d7('0x35')],function(_0x57bea9){var _0x5c148b={};_0x5c148b[_0x57bea9]={'$like':'%'+_0x162916[_0x81d7('0x31')][_0x81d7('0x3a')]+'%'};return _0x5c148b;})});}_0x2c2173=_[_0x81d7('0x39')]({},_0x2c2173,_0x162916['options']);return _0x2153da[_0x81d7('0x5b')](_0x2c2173);}})['then'](function(_0x391f47){if(_0x391f47){_0x432d79=_0x391f47[_0x81d7('0x57')];if(!_0x162916[_0x81d7('0x31')]['hasOwnProperty'](_0x81d7('0x59'))){_0x2c2173['limit']=qs[_0x81d7('0x1e')](_0x162916[_0x81d7('0x31')][_0x81d7('0x1e')]);_0x2c2173[_0x81d7('0x1c')]=qs[_0x81d7('0x1c')](_0x162916['query'][_0x81d7('0x1c')]);}return _0x2153da['getAnyConditions'](_0x2c2173);}})[_0x81d7('0x25')](function(_0x43fb63){if(_0x43fb63){return _0x43fb63?{'count':_0x432d79,'rows':_0x43fb63}:null;}})[_0x81d7('0x25')](respondWithResult(_0x1f5404,null))[_0x81d7('0x44')](handleError(_0x1f5404,null));};exports['addAction']=function(_0x2e9ad8,_0x315336,_0x2af51a){if(_0x2e9ad8[_0x81d7('0x46')]['id']){delete _0x2e9ad8['body']['id'];}return db[_0x81d7('0x3c')][_0x81d7('0x4b')]({'where':{'id':_0x2e9ad8['params']['id']}})[_0x81d7('0x25')](handleEntityNotFound(_0x315336,null))[_0x81d7('0x25')](function(_0x3e6bd4){if(_0x3e6bd4){_0x2e9ad8['body'][_0x81d7('0x5c')]=_0x3e6bd4['id'];return db[_0x81d7('0x5d')]['create'](_0x2e9ad8['body']);}})[_0x81d7('0x25')](respondWithResult(_0x315336,null))[_0x81d7('0x44')](handleError(_0x315336,null));};exports[_0x81d7('0x5e')]=function(_0x47029c,_0x16979e,_0x1aff75){var _0x1953f3={};var _0x318bac={};var _0x3bbda0;var _0x1acb24;return db[_0x81d7('0x3c')][_0x81d7('0x55')]({'where':{'id':_0x47029c[_0x81d7('0x42')]['id']}})[_0x81d7('0x25')](handleEntityNotFound(_0x16979e,null))[_0x81d7('0x25')](function(_0x3f9620){if(_0x3f9620){_0x3bbda0=_0x3f9620;_0x318bac[_0x81d7('0x34')]=_['keys'](db['Action'][_0x81d7('0x2d')]);_0x318bac[_0x81d7('0x31')]=_[_0x81d7('0x43')](_0x47029c[_0x81d7('0x31')]);_0x318bac['filters']=_[_0x81d7('0x33')](_0x318bac[_0x81d7('0x34')],_0x318bac[_0x81d7('0x31')]);_0x1953f3['attributes']=_['intersection'](_0x318bac[_0x81d7('0x34')],qs[_0x81d7('0x36')](_0x47029c[_0x81d7('0x31')]['fields']));_0x1953f3[_0x81d7('0x35')]=_0x1953f3[_0x81d7('0x35')][_0x81d7('0x57')]?_0x1953f3[_0x81d7('0x35')]:_0x318bac[_0x81d7('0x34')];_0x1953f3[_0x81d7('0x56')]=qs['sort'](_0x47029c[_0x81d7('0x31')][_0x81d7('0x37')]);_0x1953f3[_0x81d7('0x38')]=qs[_0x81d7('0x32')](_[_0x81d7('0x5a')](_0x47029c['query'],_0x318bac[_0x81d7('0x32')]));if(_0x47029c[_0x81d7('0x31')][_0x81d7('0x3a')]){_0x1953f3[_0x81d7('0x38')]=_[_0x81d7('0x39')](_0x1953f3[_0x81d7('0x38')],{'$or':_['map'](_0x1953f3['attributes'],function(_0x4543d4){var _0x4defa5={};_0x4defa5[_0x4543d4]={'$like':'%'+_0x47029c[_0x81d7('0x31')][_0x81d7('0x3a')]+'%'};return _0x4defa5;})});}_0x1953f3=_[_0x81d7('0x39')]({},_0x1953f3,_0x47029c['options']);return _0x3bbda0[_0x81d7('0x5e')](_0x1953f3);}})[_0x81d7('0x25')](function(_0x25c24c){if(_0x25c24c){_0x1acb24=_0x25c24c[_0x81d7('0x57')];if(!_0x47029c[_0x81d7('0x31')][_0x81d7('0x58')](_0x81d7('0x59'))){_0x1953f3[_0x81d7('0x1e')]=qs[_0x81d7('0x1e')](_0x47029c[_0x81d7('0x31')]['limit']);_0x1953f3[_0x81d7('0x1c')]=qs[_0x81d7('0x1c')](_0x47029c[_0x81d7('0x31')][_0x81d7('0x1c')]);}return _0x3bbda0[_0x81d7('0x5e')](_0x1953f3);}})['then'](function(_0x4f40b1){if(_0x4f40b1){return _0x4f40b1?{'count':_0x1acb24,'rows':_0x4f40b1}:null;}})[_0x81d7('0x25')](respondWithResult(_0x16979e,null))[_0x81d7('0x44')](handleError(_0x16979e,null));}; \ No newline at end of file +var _0x2432=['update','then','get','Triggers','UserProfileResource','destroy','end','error','name','map','Trigger','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','user','role','userProfileId','addAllCondition','TriggerAllId','TriggerAnyId','Condition','getAllConditions','findOne','order','getAnyConditions','pick','nolimit','addAction','TriggerId','Action','getActions','eml-format','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','save'];(function(_0x3fa5bf,_0x4af5bf){var _0x3a3d6f=function(_0x33efb5){while(--_0x33efb5){_0x3fa5bf['push'](_0x3fa5bf['shift']());}};_0x3a3d6f(++_0x4af5bf);}(_0x2432,0x136));var _0x2243=function(_0x5cbd8b,_0x3fe88a){_0x5cbd8b=_0x5cbd8b-0x0;var _0x16d0f6=_0x2432[_0x5cbd8b];return _0x16d0f6;};'use strict';var emlformat=require(_0x2243('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2243('0x1'));var jsonpatch=require(_0x2243('0x2'));var rp=require('request-promise');var moment=require(_0x2243('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2243('0x4'));var path=require(_0x2243('0x5'));var sox=require(_0x2243('0x6'));var csv=require(_0x2243('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2243('0x8'));var _=require('lodash');var squel=require(_0x2243('0x9'));var crypto=require(_0x2243('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2243('0x7'));var querystring=require(_0x2243('0xb'));var Papa=require('papaparse');var Redis=require(_0x2243('0xc'));var authService=require(_0x2243('0xd'));var qs=require(_0x2243('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2243('0xf'));var logger=require(_0x2243('0x10'))('api');var utils=require(_0x2243('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x2243('0x12'));var db=require(_0x2243('0x13'))['db'];function respondWithStatusCode(_0x45527a,_0x4cdb97){_0x4cdb97=_0x4cdb97||0xcc;return function(_0x24c9dd){if(_0x24c9dd){return _0x45527a[_0x2243('0x14')](_0x4cdb97);}return _0x45527a[_0x2243('0x15')](_0x4cdb97)['end']();};}function respondWithResult(_0x151983,_0x186b55){_0x186b55=_0x186b55||0xc8;return function(_0x59b6ca){if(_0x59b6ca){return _0x151983[_0x2243('0x15')](_0x186b55)['json'](_0x59b6ca);}};}function respondWithFilteredResult(_0x43675c,_0x1dba39){return function(_0x4cfa18){if(_0x4cfa18){var _0x14ef19=typeof _0x1dba39[_0x2243('0x16')]===_0x2243('0x17')&&typeof _0x1dba39[_0x2243('0x18')]==='undefined';var _0x188634=_0x4cfa18[_0x2243('0x19')];var _0x9526dd=_0x14ef19?0x0:_0x1dba39[_0x2243('0x16')];var _0x5ef067=_0x14ef19?_0x4cfa18[_0x2243('0x19')]:_0x1dba39[_0x2243('0x16')]+_0x1dba39[_0x2243('0x18')];var _0x144dda;if(_0x5ef067>=_0x188634){_0x5ef067=_0x188634;_0x144dda=0xc8;}else{_0x144dda=0xce;}_0x43675c[_0x2243('0x15')](_0x144dda);return _0x43675c['set'](_0x2243('0x1a'),_0x9526dd+'-'+_0x5ef067+'/'+_0x188634)[_0x2243('0x1b')](_0x4cfa18);}return null;};}function patchUpdates(_0x59fc84){return function(_0x203692){try{jsonpatch[_0x2243('0x1c')](_0x203692,_0x59fc84,!![]);}catch(_0x59088d){return BPromise['reject'](_0x59088d);}return _0x203692[_0x2243('0x1d')]();};}function saveUpdates(_0x166afc,_0x5786c3){return function(_0x334925){if(_0x334925){return _0x334925[_0x2243('0x1e')](_0x166afc)['then'](function(_0x88d78c){return _0x88d78c;});}return null;};}function removeEntity(_0x325587,_0x5a3e44){return function(_0x2ed54f){if(_0x2ed54f){return _0x2ed54f['destroy']()[_0x2243('0x1f')](function(){var _0x321103=_0x2ed54f[_0x2243('0x20')]({'plain':!![]});var _0x2b01d1=_0x2243('0x21');return db[_0x2243('0x22')][_0x2243('0x23')]({'where':{'type':_0x2b01d1,'resourceId':_0x321103['id']}})[_0x2243('0x1f')](function(){return _0x2ed54f;});})[_0x2243('0x1f')](function(){_0x325587['status'](0xcc)[_0x2243('0x24')]();});}};}function handleEntityNotFound(_0xb9fb40,_0xaacb97){return function(_0x422686){if(!_0x422686){_0xb9fb40['sendStatus'](0x194);}return _0x422686;};}function handleError(_0x5a15a1,_0x4f30d5){_0x4f30d5=_0x4f30d5||0x1f4;return function(_0x5ef977){logger[_0x2243('0x25')](_0x5ef977['stack']);if(_0x5ef977['name']){delete _0x5ef977[_0x2243('0x26')];}_0x5a15a1[_0x2243('0x15')](_0x4f30d5)['send'](_0x5ef977);};}exports['index']=function(_0x2053d9,_0x5d51a0){var _0x469978={},_0x229797={},_0x5e03f8={'count':0x0,'rows':[]};var _0x23eac9=_[_0x2243('0x27')](db[_0x2243('0x28')][_0x2243('0x29')],function(_0x10500d){return{'name':_0x10500d[_0x2243('0x2a')],'type':_0x10500d[_0x2243('0x2b')]['key']};});_0x229797[_0x2243('0x2c')]=_[_0x2243('0x27')](_0x23eac9,_0x2243('0x26'));_0x229797[_0x2243('0x2d')]=_['keys'](_0x2053d9[_0x2243('0x2d')]);_0x229797[_0x2243('0x2e')]=_[_0x2243('0x2f')](_0x229797[_0x2243('0x2c')],_0x229797['query']);_0x469978[_0x2243('0x30')]=_[_0x2243('0x2f')](_0x229797['model'],qs['fields'](_0x2053d9[_0x2243('0x2d')][_0x2243('0x31')]));_0x469978[_0x2243('0x30')]=_0x469978[_0x2243('0x30')][_0x2243('0x32')]?_0x469978[_0x2243('0x30')]:_0x229797[_0x2243('0x2c')];if(!_0x2053d9['query'][_0x2243('0x33')]('nolimit')){_0x469978[_0x2243('0x18')]=qs['limit'](_0x2053d9[_0x2243('0x2d')]['limit']);_0x469978[_0x2243('0x16')]=qs[_0x2243('0x16')](_0x2053d9[_0x2243('0x2d')][_0x2243('0x16')]);}_0x469978['order']=qs[_0x2243('0x34')](_0x2053d9['query'][_0x2243('0x34')]);_0x469978['where']=qs[_0x2243('0x2e')](_['pick'](_0x2053d9[_0x2243('0x2d')],_0x229797['filters']),_0x23eac9);if(_0x2053d9[_0x2243('0x2d')]['filter']){_0x469978[_0x2243('0x35')]=_[_0x2243('0x36')](_0x469978[_0x2243('0x35')],{'$or':_[_0x2243('0x27')](_0x23eac9,function(_0x470ec1){if(_0x470ec1[_0x2243('0x2b')]!==_0x2243('0x37')){var _0x580400={};_0x580400[_0x470ec1['name']]={'$like':'%'+_0x2053d9[_0x2243('0x2d')][_0x2243('0x38')]+'%'};return _0x580400;}})});}_0x469978=_[_0x2243('0x36')]({},_0x469978,_0x2053d9[_0x2243('0x39')]);var _0x53ace1={'where':_0x469978[_0x2243('0x35')]};return db[_0x2243('0x28')]['count'](_0x53ace1)[_0x2243('0x1f')](function(_0x179fd3){_0x5e03f8[_0x2243('0x19')]=_0x179fd3;if(_0x2053d9[_0x2243('0x2d')][_0x2243('0x3a')]){_0x469978[_0x2243('0x3b')]=[{'all':!![]}];}return db[_0x2243('0x28')][_0x2243('0x3c')](_0x469978);})[_0x2243('0x1f')](function(_0x152dd6){_0x5e03f8[_0x2243('0x3d')]=_0x152dd6;return _0x5e03f8;})['then'](respondWithFilteredResult(_0x5d51a0,_0x469978))[_0x2243('0x3e')](handleError(_0x5d51a0,null));};exports['show']=function(_0x31bae7,_0x1217f9){var _0x16f0a2={'raw':![],'where':{'id':_0x31bae7[_0x2243('0x3f')]['id']}},_0x6a3de1={};_0x6a3de1[_0x2243('0x2c')]=_[_0x2243('0x40')](db[_0x2243('0x28')][_0x2243('0x29')]);_0x6a3de1['query']=_[_0x2243('0x40')](_0x31bae7[_0x2243('0x2d')]);_0x6a3de1['filters']=_[_0x2243('0x2f')](_0x6a3de1['model'],_0x6a3de1['query']);_0x16f0a2[_0x2243('0x30')]=_[_0x2243('0x2f')](_0x6a3de1['model'],qs[_0x2243('0x31')](_0x31bae7[_0x2243('0x2d')][_0x2243('0x31')]));_0x16f0a2[_0x2243('0x30')]=_0x16f0a2[_0x2243('0x30')][_0x2243('0x32')]?_0x16f0a2['attributes']:_0x6a3de1['model'];if(_0x31bae7[_0x2243('0x2d')][_0x2243('0x3a')]){_0x16f0a2[_0x2243('0x3b')]=[{'all':!![]}];}_0x16f0a2=_['merge']({},_0x16f0a2,_0x31bae7['options']);return db[_0x2243('0x28')][_0x2243('0x41')](_0x16f0a2)[_0x2243('0x1f')](handleEntityNotFound(_0x1217f9,null))[_0x2243('0x1f')](respondWithResult(_0x1217f9,null))[_0x2243('0x3e')](handleError(_0x1217f9,null));};exports[_0x2243('0x42')]=function(_0x3fd095,_0x2fc55d){return db['Trigger'][_0x2243('0x42')](_0x3fd095[_0x2243('0x43')],{})[_0x2243('0x1f')](function(_0x15d67d){var _0x19ee0f=_0x3fd095[_0x2243('0x44')][_0x2243('0x20')]({'plain':!![]});if(!_0x19ee0f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19ee0f[_0x2243('0x45')]==='user'){var _0x3a157a=_0x15d67d[_0x2243('0x20')]({'plain':!![]});var _0x5c38e1=_0x2243('0x21');return db['UserProfileSection'][_0x2243('0x41')]({'where':{'name':_0x5c38e1,'userProfileId':_0x19ee0f[_0x2243('0x46')]},'raw':!![]})[_0x2243('0x1f')](function(_0x46c69a){if(_0x46c69a&&_0x46c69a['autoAssociation']===0x0){return db[_0x2243('0x22')][_0x2243('0x42')]({'name':_0x3a157a['name'],'resourceId':_0x3a157a['id'],'type':_0x46c69a[_0x2243('0x26')],'sectionId':_0x46c69a['id']},{})[_0x2243('0x1f')](function(){return _0x15d67d;});}else{return _0x15d67d;}})['catch'](function(_0x46f31b){logger[_0x2243('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x46f31b);throw _0x46f31b;});}return _0x15d67d;})['then'](respondWithResult(_0x2fc55d,0xc9))[_0x2243('0x3e')](handleError(_0x2fc55d,null));};exports[_0x2243('0x1e')]=function(_0x3f1284,_0x13c0ac){if(_0x3f1284[_0x2243('0x43')]['id']){delete _0x3f1284[_0x2243('0x43')]['id'];}return db['Trigger'][_0x2243('0x41')]({'where':{'id':_0x3f1284[_0x2243('0x3f')]['id']}})[_0x2243('0x1f')](handleEntityNotFound(_0x13c0ac,null))[_0x2243('0x1f')](saveUpdates(_0x3f1284[_0x2243('0x43')],null))[_0x2243('0x1f')](respondWithResult(_0x13c0ac,null))[_0x2243('0x3e')](handleError(_0x13c0ac,null));};exports[_0x2243('0x23')]=function(_0x42b7b2,_0x10e984){return db[_0x2243('0x28')][_0x2243('0x41')]({'where':{'id':_0x42b7b2[_0x2243('0x3f')]['id']}})['then'](handleEntityNotFound(_0x10e984,null))[_0x2243('0x1f')](removeEntity(_0x10e984,null))[_0x2243('0x3e')](handleError(_0x10e984,null));};exports[_0x2243('0x47')]=function(_0xaf5983,_0x3da298,_0x3b6676){if(_0xaf5983[_0x2243('0x43')]['id']){delete _0xaf5983[_0x2243('0x43')]['id'];}return db[_0x2243('0x28')]['find']({'where':{'id':_0xaf5983[_0x2243('0x3f')]['id']}})[_0x2243('0x1f')](handleEntityNotFound(_0x3da298,null))[_0x2243('0x1f')](function(_0x1fe2e2){if(_0x1fe2e2){_0xaf5983[_0x2243('0x43')][_0x2243('0x48')]=_0x1fe2e2['id'];return db['Condition'][_0x2243('0x42')](_0xaf5983[_0x2243('0x43')]);}})[_0x2243('0x1f')](respondWithResult(_0x3da298,null))['catch'](handleError(_0x3da298,null));};exports['addAnyCondition']=function(_0x5ac94d,_0x2e7d35,_0x1c9e02){if(_0x5ac94d[_0x2243('0x43')]['id']){delete _0x5ac94d['body']['id'];}return db['Trigger'][_0x2243('0x41')]({'where':{'id':_0x5ac94d[_0x2243('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2e7d35,null))[_0x2243('0x1f')](function(_0x107418){if(_0x107418){_0x5ac94d[_0x2243('0x43')][_0x2243('0x49')]=_0x107418['id'];return db[_0x2243('0x4a')][_0x2243('0x42')](_0x5ac94d[_0x2243('0x43')]);}})[_0x2243('0x1f')](respondWithResult(_0x2e7d35,null))[_0x2243('0x3e')](handleError(_0x2e7d35,null));};exports[_0x2243('0x4b')]=function(_0x3e2a09,_0x48e7b0,_0x29dae8){var _0x2b3ab0={};var _0x2428d9={};var _0x17c113;var _0x4db33c;return db[_0x2243('0x28')][_0x2243('0x4c')]({'where':{'id':_0x3e2a09['params']['id']}})[_0x2243('0x1f')](handleEntityNotFound(_0x48e7b0,null))[_0x2243('0x1f')](function(_0x4e6f09){if(_0x4e6f09){_0x17c113=_0x4e6f09;_0x2428d9[_0x2243('0x2c')]=_[_0x2243('0x40')](db[_0x2243('0x4a')]['rawAttributes']);_0x2428d9[_0x2243('0x2d')]=_[_0x2243('0x40')](_0x3e2a09[_0x2243('0x2d')]);_0x2428d9[_0x2243('0x2e')]=_[_0x2243('0x2f')](_0x2428d9[_0x2243('0x2c')],_0x2428d9['query']);_0x2b3ab0[_0x2243('0x30')]=_[_0x2243('0x2f')](_0x2428d9['model'],qs[_0x2243('0x31')](_0x3e2a09[_0x2243('0x2d')][_0x2243('0x31')]));_0x2b3ab0['attributes']=_0x2b3ab0['attributes']['length']?_0x2b3ab0[_0x2243('0x30')]:_0x2428d9['model'];_0x2b3ab0[_0x2243('0x4d')]=qs['sort'](_0x3e2a09['query']['sort']);_0x2b3ab0[_0x2243('0x35')]=qs['filters'](_['pick'](_0x3e2a09['query'],_0x2428d9[_0x2243('0x2e')]));if(_0x3e2a09[_0x2243('0x2d')]['filter']){_0x2b3ab0[_0x2243('0x35')]=_['merge'](_0x2b3ab0[_0x2243('0x35')],{'$or':_[_0x2243('0x27')](_0x2b3ab0[_0x2243('0x30')],function(_0x24a2fc){var _0x22a866={};_0x22a866[_0x24a2fc]={'$like':'%'+_0x3e2a09['query'][_0x2243('0x38')]+'%'};return _0x22a866;})});}_0x2b3ab0=_[_0x2243('0x36')]({},_0x2b3ab0,_0x3e2a09[_0x2243('0x39')]);return _0x17c113['getAllConditions'](_0x2b3ab0);}})[_0x2243('0x1f')](function(_0x577fa1){if(_0x577fa1){_0x4db33c=_0x577fa1[_0x2243('0x32')];if(!_0x3e2a09[_0x2243('0x2d')][_0x2243('0x33')]('nolimit')){_0x2b3ab0[_0x2243('0x18')]=qs[_0x2243('0x18')](_0x3e2a09['query'][_0x2243('0x18')]);_0x2b3ab0['offset']=qs[_0x2243('0x16')](_0x3e2a09[_0x2243('0x2d')][_0x2243('0x16')]);}return _0x17c113[_0x2243('0x4b')](_0x2b3ab0);}})[_0x2243('0x1f')](function(_0x312d1f){if(_0x312d1f){return _0x312d1f?{'count':_0x4db33c,'rows':_0x312d1f}:null;}})[_0x2243('0x1f')](respondWithResult(_0x48e7b0,null))['catch'](handleError(_0x48e7b0,null));};exports[_0x2243('0x4e')]=function(_0x11e33a,_0x26fd23,_0x356ef4){var _0x4970ce={};var _0x5deb84={};var _0x384ea1;var _0x215ada;return db[_0x2243('0x28')][_0x2243('0x4c')]({'where':{'id':_0x11e33a[_0x2243('0x3f')]['id']}})[_0x2243('0x1f')](handleEntityNotFound(_0x26fd23,null))['then'](function(_0x394fc3){if(_0x394fc3){_0x384ea1=_0x394fc3;_0x5deb84['model']=_['keys'](db[_0x2243('0x4a')][_0x2243('0x29')]);_0x5deb84[_0x2243('0x2d')]=_[_0x2243('0x40')](_0x11e33a['query']);_0x5deb84[_0x2243('0x2e')]=_['intersection'](_0x5deb84[_0x2243('0x2c')],_0x5deb84[_0x2243('0x2d')]);_0x4970ce[_0x2243('0x30')]=_['intersection'](_0x5deb84[_0x2243('0x2c')],qs[_0x2243('0x31')](_0x11e33a[_0x2243('0x2d')][_0x2243('0x31')]));_0x4970ce[_0x2243('0x30')]=_0x4970ce['attributes'][_0x2243('0x32')]?_0x4970ce[_0x2243('0x30')]:_0x5deb84[_0x2243('0x2c')];_0x4970ce['order']=qs[_0x2243('0x34')](_0x11e33a[_0x2243('0x2d')][_0x2243('0x34')]);_0x4970ce[_0x2243('0x35')]=qs[_0x2243('0x2e')](_[_0x2243('0x4f')](_0x11e33a[_0x2243('0x2d')],_0x5deb84['filters']));if(_0x11e33a[_0x2243('0x2d')][_0x2243('0x38')]){_0x4970ce['where']=_[_0x2243('0x36')](_0x4970ce[_0x2243('0x35')],{'$or':_[_0x2243('0x27')](_0x4970ce[_0x2243('0x30')],function(_0x554239){var _0x38e5fb={};_0x38e5fb[_0x554239]={'$like':'%'+_0x11e33a[_0x2243('0x2d')]['filter']+'%'};return _0x38e5fb;})});}_0x4970ce=_['merge']({},_0x4970ce,_0x11e33a[_0x2243('0x39')]);return _0x384ea1['getAnyConditions'](_0x4970ce);}})['then'](function(_0x49b188){if(_0x49b188){_0x215ada=_0x49b188[_0x2243('0x32')];if(!_0x11e33a[_0x2243('0x2d')][_0x2243('0x33')](_0x2243('0x50'))){_0x4970ce[_0x2243('0x18')]=qs['limit'](_0x11e33a['query'][_0x2243('0x18')]);_0x4970ce['offset']=qs['offset'](_0x11e33a[_0x2243('0x2d')][_0x2243('0x16')]);}return _0x384ea1[_0x2243('0x4e')](_0x4970ce);}})[_0x2243('0x1f')](function(_0x35fcab){if(_0x35fcab){return _0x35fcab?{'count':_0x215ada,'rows':_0x35fcab}:null;}})['then'](respondWithResult(_0x26fd23,null))['catch'](handleError(_0x26fd23,null));};exports[_0x2243('0x51')]=function(_0x4d3a42,_0x485041,_0x1df258){if(_0x4d3a42[_0x2243('0x43')]['id']){delete _0x4d3a42[_0x2243('0x43')]['id'];}return db['Trigger'][_0x2243('0x41')]({'where':{'id':_0x4d3a42[_0x2243('0x3f')]['id']}})[_0x2243('0x1f')](handleEntityNotFound(_0x485041,null))[_0x2243('0x1f')](function(_0x266514){if(_0x266514){_0x4d3a42[_0x2243('0x43')][_0x2243('0x52')]=_0x266514['id'];return db[_0x2243('0x53')][_0x2243('0x42')](_0x4d3a42[_0x2243('0x43')]);}})['then'](respondWithResult(_0x485041,null))[_0x2243('0x3e')](handleError(_0x485041,null));};exports[_0x2243('0x54')]=function(_0x49d6d7,_0x335f3f,_0x2c02f8){var _0x3f41de={};var _0x66a6b6={};var _0x838ea0;var _0x2118f2;return db['Trigger'][_0x2243('0x4c')]({'where':{'id':_0x49d6d7['params']['id']}})[_0x2243('0x1f')](handleEntityNotFound(_0x335f3f,null))['then'](function(_0x3088a5){if(_0x3088a5){_0x838ea0=_0x3088a5;_0x66a6b6[_0x2243('0x2c')]=_[_0x2243('0x40')](db[_0x2243('0x53')][_0x2243('0x29')]);_0x66a6b6['query']=_[_0x2243('0x40')](_0x49d6d7[_0x2243('0x2d')]);_0x66a6b6[_0x2243('0x2e')]=_[_0x2243('0x2f')](_0x66a6b6['model'],_0x66a6b6[_0x2243('0x2d')]);_0x3f41de[_0x2243('0x30')]=_[_0x2243('0x2f')](_0x66a6b6[_0x2243('0x2c')],qs[_0x2243('0x31')](_0x49d6d7[_0x2243('0x2d')][_0x2243('0x31')]));_0x3f41de[_0x2243('0x30')]=_0x3f41de['attributes'][_0x2243('0x32')]?_0x3f41de[_0x2243('0x30')]:_0x66a6b6[_0x2243('0x2c')];_0x3f41de[_0x2243('0x4d')]=qs[_0x2243('0x34')](_0x49d6d7['query'][_0x2243('0x34')]);_0x3f41de[_0x2243('0x35')]=qs[_0x2243('0x2e')](_['pick'](_0x49d6d7[_0x2243('0x2d')],_0x66a6b6[_0x2243('0x2e')]));if(_0x49d6d7[_0x2243('0x2d')][_0x2243('0x38')]){_0x3f41de[_0x2243('0x35')]=_[_0x2243('0x36')](_0x3f41de[_0x2243('0x35')],{'$or':_[_0x2243('0x27')](_0x3f41de[_0x2243('0x30')],function(_0x25828f){var _0x350add={};_0x350add[_0x25828f]={'$like':'%'+_0x49d6d7[_0x2243('0x2d')]['filter']+'%'};return _0x350add;})});}_0x3f41de=_[_0x2243('0x36')]({},_0x3f41de,_0x49d6d7[_0x2243('0x39')]);return _0x838ea0[_0x2243('0x54')](_0x3f41de);}})[_0x2243('0x1f')](function(_0x16ece0){if(_0x16ece0){_0x2118f2=_0x16ece0[_0x2243('0x32')];if(!_0x49d6d7['query']['hasOwnProperty'](_0x2243('0x50'))){_0x3f41de[_0x2243('0x18')]=qs[_0x2243('0x18')](_0x49d6d7[_0x2243('0x2d')][_0x2243('0x18')]);_0x3f41de['offset']=qs['offset'](_0x49d6d7[_0x2243('0x2d')]['offset']);}return _0x838ea0[_0x2243('0x54')](_0x3f41de);}})['then'](function(_0x3f422c){if(_0x3f422c){return _0x3f422c?{'count':_0x2118f2,'rows':_0x3f422c}:null;}})[_0x2243('0x1f')](respondWithResult(_0x335f3f,null))[_0x2243('0x3e')](handleError(_0x335f3f,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index d30e6dd..a5b9cbd 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 _0x6753=['bluebird','request-promise','rimraf','../../config/environment','define','Trigger','tools_triggers','lodash','util','../../config/logger','api'];(function(_0x768f7f,_0x3d7b62){var _0x4d29e1=function(_0x377f41){while(--_0x377f41){_0x768f7f['push'](_0x768f7f['shift']());}};_0x4d29e1(++_0x3d7b62);}(_0x6753,0xa1));var _0x3675=function(_0x3d7427,_0x278fd9){_0x3d7427=_0x3d7427-0x0;var _0x1a7764=_0x6753[_0x3d7427];return _0x1a7764;};'use strict';var _=require(_0x3675('0x0'));var util=require(_0x3675('0x1'));var logger=require(_0x3675('0x2'))(_0x3675('0x3'));var moment=require('moment');var BPromise=require(_0x3675('0x4'));var rp=require(_0x3675('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3675('0x6'));var config=require(_0x3675('0x7'));var attributes=require('./trigger.attributes');module['exports']=function(_0x4e4e73,_0x396a35){return _0x4e4e73[_0x3675('0x8')](_0x3675('0x9'),attributes,{'tableName':_0x3675('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa991=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./trigger.attributes','exports','define','tools_triggers','lodash'];(function(_0x267967,_0x3286bd){var _0x23a111=function(_0x101b08){while(--_0x101b08){_0x267967['push'](_0x267967['shift']());}};_0x23a111(++_0x3286bd);}(_0xa991,0x143));var _0x1a99=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xa991[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x1a99('0x0'));var util=require('util');var logger=require(_0x1a99('0x1'))(_0x1a99('0x2'));var moment=require(_0x1a99('0x3'));var BPromise=require(_0x1a99('0x4'));var rp=require(_0x1a99('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1a99('0x6'));var config=require(_0x1a99('0x7'));var attributes=require(_0x1a99('0x8'));module[_0x1a99('0x9')]=function(_0x22990b,_0xabf36a){return _0x22990b[_0x1a99('0xa')]('Trigger',attributes,{'tableName':_0x1a99('0xb'),'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 af6a036..9445408 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 _0x7054=['catch','ShowTrigger','Trigger','find','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','error','code','message','findAll','options','raw','map','include','attributes','model','GetTrigger','debug','stringify'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7054,0x125));var _0x4705=function(_0x25cb87,_0xc2d352){_0x25cb87=_0x25cb87-0x0;var _0x3a7537=_0x7054[_0x25cb87];return _0x3a7537;};'use strict';var _=require(_0x4705('0x0'));var util=require(_0x4705('0x1'));var moment=require(_0x4705('0x2'));var BPromise=require(_0x4705('0x3'));var rs=require(_0x4705('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4705('0x5'))['db'];var utils=require(_0x4705('0x6'));var logger=require('../../config/logger')(_0x4705('0x7'));var config=require(_0x4705('0x8'));var jayson=require(_0x4705('0x9'));var client=jayson[_0x4705('0xa')][_0x4705('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47e778,_0x1c5bf7,_0x496223){return new BPromise(function(_0x50e204,_0x474db8){return client[_0x4705('0xc')](_0x47e778,_0x496223)[_0x4705('0xd')](function(_0x3dd18a){logger[_0x4705('0xe')](_0x4705('0xf'),_0x1c5bf7,_0x4705('0x10'));logger['debug'](_0x4705('0x11'),_0x1c5bf7,'request\x20sent',JSON['stringify'](_0x3dd18a));if(_0x3dd18a[_0x4705('0x12')]){if(_0x3dd18a['error'][_0x4705('0x13')]===0x1f4){logger[_0x4705('0x12')](_0x4705('0xf'),_0x1c5bf7,_0x3dd18a[_0x4705('0x12')][_0x4705('0x14')]);return _0x474db8(_0x3dd18a['error'][_0x4705('0x14')]);}logger['error']('Trigger,\x20%s,\x20%s',_0x1c5bf7,_0x3dd18a[_0x4705('0x12')]['message']);return _0x50e204(_0x3dd18a[_0x4705('0x12')][_0x4705('0x14')]);}else{logger['info'](_0x4705('0xf'),_0x1c5bf7,_0x4705('0x10'));_0x50e204(_0x3dd18a['result'][_0x4705('0x14')]);}})['catch'](function(_0x565c0f){logger[_0x4705('0x12')](_0x4705('0xf'),_0x1c5bf7,_0x565c0f);_0x474db8(_0x565c0f);});});}exports['GetTrigger']=function(_0x319671){var _0x4b7594=this;return new Promise(function(_0x10eda6,_0xcab255){return db['Trigger'][_0x4705('0x15')]({'raw':_0x319671[_0x4705('0x16')]?_0x319671['options'][_0x4705('0x17')]===undefined?!![]:![]:!![],'where':_0x319671[_0x4705('0x16')]?_0x319671[_0x4705('0x16')]['where']||null:null,'attributes':_0x319671[_0x4705('0x16')]?_0x319671[_0x4705('0x16')]['attributes']||null:null,'limit':_0x319671[_0x4705('0x16')]?_0x319671[_0x4705('0x16')]['limit']||null:null,'include':_0x319671[_0x4705('0x16')]?_0x319671[_0x4705('0x16')]['include']?_[_0x4705('0x18')](_0x319671[_0x4705('0x16')][_0x4705('0x19')],function(_0x3bbc23){return{'model':db[_0x3bbc23['model']],'as':_0x3bbc23['as'],'attributes':_0x3bbc23[_0x4705('0x1a')],'include':_0x3bbc23['include']?_[_0x4705('0x18')](_0x3bbc23['include'],function(_0xbe6cc6){return{'model':db[_0xbe6cc6[_0x4705('0x1b')]],'as':_0xbe6cc6['as'],'attributes':_0xbe6cc6[_0x4705('0x1a')],'include':_0xbe6cc6[_0x4705('0x19')]?_[_0x4705('0x18')](_0xbe6cc6[_0x4705('0x19')],function(_0x48e24f){return{'model':db[_0x48e24f['model']],'as':_0x48e24f['as'],'attributes':_0x48e24f[_0x4705('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb6219d){logger[_0x4705('0xe')](_0x4705('0x1c'),_0x319671);logger[_0x4705('0x1d')](_0x4705('0x1c'),_0x319671,JSON[_0x4705('0x1e')](_0xb6219d));_0x10eda6(_0xb6219d);})[_0x4705('0x1f')](function(_0xeebe15){logger[_0x4705('0x12')]('GetTrigger',_0xeebe15[_0x4705('0x14')],_0x319671);_0xcab255(_0x4b7594[_0x4705('0x12')](0x1f4,_0xeebe15[_0x4705('0x14')]));});});};exports[_0x4705('0x20')]=function(_0x1c6377){var _0x1e50ff=this;return new Promise(function(_0x314b2e,_0x15308a){return db[_0x4705('0x21')][_0x4705('0x22')]({'raw':_0x1c6377[_0x4705('0x16')]?_0x1c6377['options'][_0x4705('0x17')]===undefined?!![]:![]:!![],'where':_0x1c6377['options']?_0x1c6377[_0x4705('0x16')][_0x4705('0x23')]||null:null,'attributes':_0x1c6377[_0x4705('0x16')]?_0x1c6377[_0x4705('0x16')]['attributes']||null:null,'include':_0x1c6377['options']?_0x1c6377['options'][_0x4705('0x19')]?_[_0x4705('0x18')](_0x1c6377[_0x4705('0x16')]['include'],function(_0x5ccfba){return{'model':db[_0x5ccfba[_0x4705('0x1b')]],'as':_0x5ccfba['as'],'attributes':_0x5ccfba[_0x4705('0x1a')],'include':_0x5ccfba[_0x4705('0x19')]?_[_0x4705('0x18')](_0x5ccfba[_0x4705('0x19')],function(_0x10e2b8){return{'model':db[_0x10e2b8['model']],'as':_0x10e2b8['as'],'attributes':_0x10e2b8['attributes'],'include':_0x10e2b8[_0x4705('0x19')]?_[_0x4705('0x18')](_0x10e2b8[_0x4705('0x19')],function(_0x4d77f2){return{'model':db[_0x4d77f2[_0x4705('0x1b')]],'as':_0x4d77f2['as'],'attributes':_0x4d77f2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a4d70){logger[_0x4705('0xe')]('ShowTrigger',_0x1c6377);logger[_0x4705('0x1d')](_0x4705('0x20'),_0x1c6377,JSON[_0x4705('0x1e')](_0x5a4d70));_0x314b2e(_0x5a4d70);})['catch'](function(_0x3db76d){logger[_0x4705('0x12')]('ShowTrigger',_0x3db76d[_0x4705('0x14')],_0x1c6377);_0x15308a(_0x1e50ff['error'](0x1f4,_0x3db76d[_0x4705('0x14')]));});});}; \ No newline at end of file +var _0x76c2=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','Trigger','options','raw','where','include','map','model','attributes','GetTrigger','debug','find','ShowTrigger','lodash','util'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x76c2,0x82));var _0x276c=function(_0x2b10e8,_0x47c911){_0x2b10e8=_0x2b10e8-0x0;var _0x25791b=_0x76c2[_0x2b10e8];return _0x25791b;};'use strict';var _=require(_0x276c('0x0'));var util=require(_0x276c('0x1'));var moment=require('moment');var BPromise=require(_0x276c('0x2'));var rs=require(_0x276c('0x3'));var fs=require('fs');var Redis=require(_0x276c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x276c('0x5'));var logger=require(_0x276c('0x6'))(_0x276c('0x7'));var config=require(_0x276c('0x8'));var jayson=require(_0x276c('0x9'));var client=jayson[_0x276c('0xa')][_0x276c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c5c22,_0x92414b,_0x5516e7){return new BPromise(function(_0x502145,_0x2783cf){return client[_0x276c('0xc')](_0x5c5c22,_0x5516e7)[_0x276c('0xd')](function(_0x30b39f){logger[_0x276c('0xe')](_0x276c('0xf'),_0x92414b,_0x276c('0x10'));logger['debug']('Trigger,\x20%s,\x20%s,\x20%s',_0x92414b,_0x276c('0x10'),JSON[_0x276c('0x11')](_0x30b39f));if(_0x30b39f[_0x276c('0x12')]){if(_0x30b39f['error']['code']===0x1f4){logger[_0x276c('0x12')](_0x276c('0xf'),_0x92414b,_0x30b39f[_0x276c('0x12')][_0x276c('0x13')]);return _0x2783cf(_0x30b39f['error']['message']);}logger['error']('Trigger,\x20%s,\x20%s',_0x92414b,_0x30b39f['error']['message']);return _0x502145(_0x30b39f[_0x276c('0x12')][_0x276c('0x13')]);}else{logger[_0x276c('0xe')](_0x276c('0xf'),_0x92414b,'request\x20sent');_0x502145(_0x30b39f['result']['message']);}})[_0x276c('0x14')](function(_0x418d76){logger[_0x276c('0x12')](_0x276c('0xf'),_0x92414b,_0x418d76);_0x2783cf(_0x418d76);});});}exports['GetTrigger']=function(_0x11c5bd){var _0x33da29=this;return new Promise(function(_0x70b292,_0x306d5a){return db[_0x276c('0x15')]['findAll']({'raw':_0x11c5bd[_0x276c('0x16')]?_0x11c5bd[_0x276c('0x16')][_0x276c('0x17')]===undefined?!![]:![]:!![],'where':_0x11c5bd['options']?_0x11c5bd[_0x276c('0x16')][_0x276c('0x18')]||null:null,'attributes':_0x11c5bd['options']?_0x11c5bd[_0x276c('0x16')]['attributes']||null:null,'limit':_0x11c5bd['options']?_0x11c5bd['options']['limit']||null:null,'include':_0x11c5bd[_0x276c('0x16')]?_0x11c5bd[_0x276c('0x16')][_0x276c('0x19')]?_[_0x276c('0x1a')](_0x11c5bd[_0x276c('0x16')][_0x276c('0x19')],function(_0x1c2dfc){return{'model':db[_0x1c2dfc[_0x276c('0x1b')]],'as':_0x1c2dfc['as'],'attributes':_0x1c2dfc[_0x276c('0x1c')],'include':_0x1c2dfc[_0x276c('0x19')]?_[_0x276c('0x1a')](_0x1c2dfc[_0x276c('0x19')],function(_0x4a17d4){return{'model':db[_0x4a17d4[_0x276c('0x1b')]],'as':_0x4a17d4['as'],'attributes':_0x4a17d4[_0x276c('0x1c')],'include':_0x4a17d4[_0x276c('0x19')]?_[_0x276c('0x1a')](_0x4a17d4['include'],function(_0x24c725){return{'model':db[_0x24c725[_0x276c('0x1b')]],'as':_0x24c725['as'],'attributes':_0x24c725[_0x276c('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x355f0c){logger[_0x276c('0xe')](_0x276c('0x1d'),_0x11c5bd);logger[_0x276c('0x1e')](_0x276c('0x1d'),_0x11c5bd,JSON[_0x276c('0x11')](_0x355f0c));_0x70b292(_0x355f0c);})[_0x276c('0x14')](function(_0x502625){logger[_0x276c('0x12')](_0x276c('0x1d'),_0x502625[_0x276c('0x13')],_0x11c5bd);_0x306d5a(_0x33da29[_0x276c('0x12')](0x1f4,_0x502625[_0x276c('0x13')]));});});};exports['ShowTrigger']=function(_0x43cc19){var _0x420952=this;return new Promise(function(_0x528dce,_0x3d940e){return db[_0x276c('0x15')][_0x276c('0x1f')]({'raw':_0x43cc19[_0x276c('0x16')]?_0x43cc19[_0x276c('0x16')][_0x276c('0x17')]===undefined?!![]:![]:!![],'where':_0x43cc19['options']?_0x43cc19['options'][_0x276c('0x18')]||null:null,'attributes':_0x43cc19['options']?_0x43cc19[_0x276c('0x16')][_0x276c('0x1c')]||null:null,'include':_0x43cc19[_0x276c('0x16')]?_0x43cc19[_0x276c('0x16')][_0x276c('0x19')]?_[_0x276c('0x1a')](_0x43cc19[_0x276c('0x16')]['include'],function(_0x6c8cd3){return{'model':db[_0x6c8cd3[_0x276c('0x1b')]],'as':_0x6c8cd3['as'],'attributes':_0x6c8cd3[_0x276c('0x1c')],'include':_0x6c8cd3[_0x276c('0x19')]?_[_0x276c('0x1a')](_0x6c8cd3[_0x276c('0x19')],function(_0x33fcc0){return{'model':db[_0x33fcc0[_0x276c('0x1b')]],'as':_0x33fcc0['as'],'attributes':_0x33fcc0[_0x276c('0x1c')],'include':_0x33fcc0[_0x276c('0x19')]?_[_0x276c('0x1a')](_0x33fcc0[_0x276c('0x19')],function(_0x253850){return{'model':db[_0x253850[_0x276c('0x1b')]],'as':_0x253850['as'],'attributes':_0x253850[_0x276c('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x59aae0){logger[_0x276c('0xe')](_0x276c('0x20'),_0x43cc19);logger['debug']('ShowTrigger',_0x43cc19,JSON[_0x276c('0x11')](_0x59aae0));_0x528dce(_0x59aae0);})[_0x276c('0x14')](function(_0x14329b){logger[_0x276c('0x12')]('ShowTrigger',_0x14329b[_0x276c('0x13')],_0x43cc19);_0x3d940e(_0x420952[_0x276c('0x12')](0x1f4,_0x14329b['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 8e821f4..d499869 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 _0xf330=['../../components/interaction/service','../../config/environment','./trunk.controller','isAuthenticated','index','get','/:id','show','post','/:id/clone','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x324010,_0x23670f){var _0x11cc09=function(_0x313177){while(--_0x313177){_0x324010['push'](_0x324010['shift']());}};_0x11cc09(++_0x23670f);}(_0xf330,0xa9));var _0x0f33=function(_0x1fa4ea,_0x592ea0){_0x1fa4ea=_0x1fa4ea-0x0;var _0x21d671=_0xf330[_0x1fa4ea];return _0x21d671;};'use strict';var multer=require(_0x0f33('0x0'));var util=require(_0x0f33('0x1'));var path=require('path');var timeout=require(_0x0f33('0x2'));var express=require(_0x0f33('0x3'));var router=express[_0x0f33('0x4')]();var fs_extra=require(_0x0f33('0x5'));var auth=require(_0x0f33('0x6'));var interaction=require(_0x0f33('0x7'));var config=require(_0x0f33('0x8'));var controller=require(_0x0f33('0x9'));router['get']('/',auth[_0x0f33('0xa')](),controller[_0x0f33('0xb')]);router[_0x0f33('0xc')](_0x0f33('0xd'),auth[_0x0f33('0xa')](),controller[_0x0f33('0xe')]);router[_0x0f33('0xf')](_0x0f33('0x10'),auth[_0x0f33('0xa')](),controller['clone']);router[_0x0f33('0xf')]('/',auth[_0x0f33('0xa')](),controller[_0x0f33('0x11')]);router[_0x0f33('0x12')](_0x0f33('0xd'),auth[_0x0f33('0xa')](),controller[_0x0f33('0x13')]);router['delete'](_0x0f33('0xd'),auth[_0x0f33('0xa')](),controller[_0x0f33('0x14')]);module[_0x0f33('0x15')]=router; \ No newline at end of file +var _0xed51=['/:id','post','/:id/clone','clone','create','put','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xed51,0x1e3));var _0x1ed5=function(_0x5e2a97,_0x1b82d8){_0x5e2a97=_0x5e2a97-0x0;var _0x48bc85=_0xed51[_0x5e2a97];return _0x48bc85;};'use strict';var multer=require(_0x1ed5('0x0'));var util=require(_0x1ed5('0x1'));var path=require('path');var timeout=require(_0x1ed5('0x2'));var express=require(_0x1ed5('0x3'));var router=express[_0x1ed5('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1ed5('0x5'));var config=require(_0x1ed5('0x6'));var controller=require(_0x1ed5('0x7'));router[_0x1ed5('0x8')]('/',auth[_0x1ed5('0x9')](),controller['index']);router[_0x1ed5('0x8')](_0x1ed5('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x1ed5('0xb')](_0x1ed5('0xc'),auth[_0x1ed5('0x9')](),controller[_0x1ed5('0xd')]);router[_0x1ed5('0xb')]('/',auth[_0x1ed5('0x9')](),controller[_0x1ed5('0xe')]);router[_0x1ed5('0xf')](_0x1ed5('0xa'),auth[_0x1ed5('0x9')](),controller['update']);router['delete'](_0x1ed5('0xa'),auth[_0x1ed5('0x9')](),controller[_0x1ed5('0x10')]);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 bd8afe9..2c97daa 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 _0x96ac=['ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','setDataValue','join','transport','getDataValue','split','rfc2833','info','shortinfo','inband','auto','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','yes','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uas','pai','fingerprint','certificate','active','actpass','update','BOOLEAN','sequelize','exports','name','ENUM','friend','user','peer','STRING','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN'];(function(_0xfb65aa,_0x1651a6){var _0x2aee31=function(_0x492245){while(--_0x492245){_0xfb65aa['push'](_0xfb65aa['shift']());}};_0x2aee31(++_0x1651a6);}(_0x96ac,0xc2));var _0xc96a=function(_0x16dc44,_0x3d3edd){_0x16dc44=_0x16dc44-0x0;var _0x3a60da=_0x96ac[_0x16dc44];return _0x3a60da;};'use strict';var Sequelize=require(_0xc96a('0x0'));module[_0xc96a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc96a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x4'),_0xc96a('0x5'),_0xc96a('0x6')),'allowNull':![],'defaultValue':_0xc96a('0x4')},'context':{'type':Sequelize[_0xc96a('0x7')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x8'),_0xc96a('0x9'),_0xc96a('0xa'),_0xc96a('0xb'),_0xc96a('0xc'),_0xc96a('0xd'),'PROHIB_FAILED_SCREEN',_0xc96a('0xe'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0xc96a('0x7')]},'secret':{'type':Sequelize[_0xc96a('0x7')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xc96a('0x7')],'defaultValue':'udp','set':function(_0x2de326){this[_0xc96a('0xf')]('transport',_0x2de326?_0x2de326[_0xc96a('0x10')](','):null);},'get':function(){return this['getDataValue'](_0xc96a('0x11'))?this[_0xc96a('0x12')]('transport')[_0xc96a('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x14'),_0xc96a('0x15'),_0xc96a('0x16'),_0xc96a('0x17'),_0xc96a('0x18')),'defaultValue':_0xc96a('0x14')},'directmedia':{'type':Sequelize[_0xc96a('0x3')]('yes','no','nonat','update',_0xc96a('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc96a('0x3')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xc96a('0x7')]},'directmediadeny':{'type':Sequelize[_0xc96a('0x7')]},'nat':{'type':Sequelize[_0xc96a('0x7')],'defaultValue':_0xc96a('0x1a'),'set':function(_0x5b2506){this[_0xc96a('0xf')]('nat',_0x5b2506?_0x5b2506['join'](','):null);},'get':function(){return this[_0xc96a('0x12')]('nat')?this[_0xc96a('0x12')](_0xc96a('0x1b'))['split'](','):null;},'comment':_0xc96a('0x1c')},'callgroup':{'type':Sequelize[_0xc96a('0x7')]},'namedcallgroup':{'type':Sequelize[_0xc96a('0x7')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xc96a('0x7')]},'language':{'type':Sequelize[_0xc96a('0x7')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xc96a('0x7')],'defaultValue':_0xc96a('0x1d')},'allow':{'type':Sequelize[_0xc96a('0x7')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x244151){this[_0xc96a('0xf')]('allow',_0x244151?_0x244151[_0xc96a('0x10')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xc96a('0x12')](_0xc96a('0x1e'))?this[_0xc96a('0x12')]('allow')[_0xc96a('0x13')](';'):null;},'comment':_0xc96a('0x1f')},'autoframing':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0xc96a('0x21'),'set':function(_0x383bea){this[_0xc96a('0xf')](_0xc96a('0x22'),_0x383bea?_0x383bea['join'](','):null);},'get':function(){return this['getDataValue'](_0xc96a('0x22'))?this[_0xc96a('0x12')](_0xc96a('0x22'))['split'](','):null;},'comment':_0xc96a('0x23')},'trustrpid':{'type':Sequelize['ENUM'](_0xc96a('0x20'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xc96a('0x20'),'no',_0xc96a('0x24'))},'promiscredir':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no')},'useclientcode':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no')},'accountcode':{'type':Sequelize[_0xc96a('0x25')](0xb)},'setvar':{'type':Sequelize[_0xc96a('0x7')]},'callerid':{'type':Sequelize[_0xc96a('0x7')],'defaultValue':_0xc96a('0x26')},'amaflags':{'type':Sequelize[_0xc96a('0x7')]},'callcounter':{'type':Sequelize[_0xc96a('0x3')]('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xc96a('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no')},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no')},'allowtransfer':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no')},'ignoresdpversion':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no')},'subscribecontext':{'type':Sequelize[_0xc96a('0x7')]},'template':{'type':Sequelize[_0xc96a('0x7')]},'videosupport':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no',_0xc96a('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0xc96a('0x3')]('yes','no')},'mailbox':{'type':Sequelize[_0xc96a('0x7')]},'session_timers':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x28'),_0xc96a('0x29'),_0xc96a('0x2a'))},'session_expires':{'type':Sequelize[_0xc96a('0x25')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xc96a('0x3')]('uac',_0xc96a('0x2b')),'defaultValue':_0xc96a('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0xc96a('0x7')]},'regexten':{'type':Sequelize[_0xc96a('0x7')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xc96a('0x3')]('yes','no'),'defaultValue':_0xc96a('0x20')},'keepalive':{'type':Sequelize[_0xc96a('0x25')](0xb)},'defaultip':{'type':Sequelize[_0xc96a('0x7')]},'defaultuser':{'type':Sequelize[_0xc96a('0x7')]},'rtptimeout':{'type':Sequelize[_0xc96a('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xc96a('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no',_0xc96a('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc96a('0x7')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xc96a('0x25')](0xb)},'timerb':{'type':Sequelize[_0xc96a('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0xc96a('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0xc96a('0x7')]},'contactdeny':{'type':Sequelize[_0xc96a('0x7')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xc96a('0x7')]},'use_q850_reason':{'type':Sequelize[_0xc96a('0x7')]},'maxforwards':{'type':Sequelize[_0xc96a('0x25')](0xb)},'encryption':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no')},'force_avp':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no')},'icesupport':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no')},'dtlsenable':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no')},'dtlsverify':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no',_0xc96a('0x2d'),_0xc96a('0x2e'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xc96a('0x7')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xc96a('0x7')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x2f'),'passive',_0xc96a('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc96a('0x7')]},'usereqphone':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc96a('0x7')]},'recordofffeature':{'type':Sequelize[_0xc96a('0x7')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xc96a('0x3')]('yes','no')},'subscribemwi':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no')},'vmexten':{'type':Sequelize[_0xc96a('0x7')]},'mohinterpret':{'type':Sequelize[_0xc96a('0x7')]},'mohsuggest':{'type':Sequelize[_0xc96a('0x7')]},'parkinglot':{'type':Sequelize[_0xc96a('0x7')]},'description':{'type':Sequelize[_0xc96a('0x7')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0xc96a('0x3')]('yes','no','nonat',_0xc96a('0x31'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xc96a('0x7')]},'otherFields':{'type':Sequelize[_0xc96a('0x7')]},'active':{'type':Sequelize[_0xc96a('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x7427=['transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','setDataValue','nat','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','uas','pai','certificate','passive','actpass','dynamic','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_PASSED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7427,0x102));var _0x7742=function(_0x303c30,_0x16edcb){_0x303c30=_0x303c30-0x0;var _0x43161b=_0x7427[_0x303c30];return _0x43161b;};'use strict';var Sequelize=require('sequelize');module[_0x7742('0x0')]={'name':{'type':Sequelize[_0x7742('0x1')],'allowNull':![],'unique':_0x7742('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7742('0x3')](_0x7742('0x4'),_0x7742('0x5'),_0x7742('0x6')),'allowNull':![],'defaultValue':_0x7742('0x4')},'context':{'type':Sequelize[_0x7742('0x1')],'allowNull':![],'defaultValue':_0x7742('0x7')},'callingpres':{'type':Sequelize[_0x7742('0x3')]('ALLOWED_NOT_SCREENED',_0x7742('0x8'),'ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED',_0x7742('0x9'),_0x7742('0xa'),'PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x7742('0x1')]},'md5secret':{'type':Sequelize[_0x7742('0x1')]},'remotesecret':{'type':Sequelize[_0x7742('0x1')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x7742('0xb'),'set':function(_0x43550e){this['setDataValue'](_0x7742('0xc'),_0x43550e?_0x43550e[_0x7742('0xd')](','):null);},'get':function(){return this[_0x7742('0xe')](_0x7742('0xc'))?this['getDataValue'](_0x7742('0xc'))[_0x7742('0xf')](','):null;},'comment':_0x7742('0x10')},'dtmfmode':{'type':Sequelize[_0x7742('0x3')](_0x7742('0x11'),_0x7742('0x12'),'shortinfo',_0x7742('0x13'),_0x7742('0x14')),'defaultValue':_0x7742('0x11')},'directmedia':{'type':Sequelize[_0x7742('0x3')](_0x7742('0x15'),'no',_0x7742('0x16'),_0x7742('0x17'),_0x7742('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x7742('0x3')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x7742('0x1')]},'nat':{'type':Sequelize[_0x7742('0x1')],'defaultValue':_0x7742('0x19'),'set':function(_0xb7c9ae){this[_0x7742('0x1a')](_0x7742('0x1b'),_0xb7c9ae?_0xb7c9ae[_0x7742('0xd')](','):null);},'get':function(){return this[_0x7742('0xe')]('nat')?this[_0x7742('0xe')](_0x7742('0x1b'))[_0x7742('0xf')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x7742('0x1')]},'namedcallgroup':{'type':Sequelize[_0x7742('0x1')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x7742('0x1')]},'language':{'type':Sequelize[_0x7742('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7742('0x1c'),'set':function(_0x349894){this[_0x7742('0x1a')](_0x7742('0x1d'),_0x349894?_0x349894[_0x7742('0xd')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x7742('0x1d'))?this[_0x7742('0xe')](_0x7742('0x1d'))[_0x7742('0xf')](';'):null;},'comment':_0x7742('0x1e')},'autoframing':{'type':Sequelize[_0x7742('0x3')](_0x7742('0x15'),'no')},'insecure':{'type':Sequelize[_0x7742('0x1')],'defaultValue':'port,invite','set':function(_0x4724ef){this[_0x7742('0x1a')](_0x7742('0x1f'),_0x4724ef?_0x4724ef[_0x7742('0xd')](','):null);},'get':function(){return this[_0x7742('0xe')]('insecure')?this[_0x7742('0xe')]('insecure')[_0x7742('0xf')](','):null;},'comment':_0x7742('0x20')},'trustrpid':{'type':Sequelize[_0x7742('0x3')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x7742('0x3')](_0x7742('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x7742('0x3')](_0x7742('0x15'),'no',_0x7742('0x21'))},'promiscredir':{'type':Sequelize['ENUM'](_0x7742('0x15'),'no')},'useclientcode':{'type':Sequelize[_0x7742('0x3')](_0x7742('0x15'),'no')},'accountcode':{'type':Sequelize[_0x7742('0x22')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x7742('0x23')},'amaflags':{'type':Sequelize[_0x7742('0x1')]},'callcounter':{'type':Sequelize[_0x7742('0x3')]('yes','no'),'defaultValue':_0x7742('0x15')},'busylevel':{'type':Sequelize[_0x7742('0x22')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x7742('0x15'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x7742('0x15'),'no')},'allowtransfer':{'type':Sequelize[_0x7742('0x3')](_0x7742('0x15'),'no')},'ignoresdpversion':{'type':Sequelize[_0x7742('0x3')](_0x7742('0x15'),'no')},'subscribecontext':{'type':Sequelize[_0x7742('0x1')]},'template':{'type':Sequelize[_0x7742('0x1')]},'videosupport':{'type':Sequelize['ENUM'](_0x7742('0x15'),'no',_0x7742('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x7742('0x22')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x7742('0x3')](_0x7742('0x15'),'no')},'mailbox':{'type':Sequelize[_0x7742('0x1')]},'session_timers':{'type':Sequelize[_0x7742('0x3')](_0x7742('0x25'),_0x7742('0x26'),'originate')},'session_expires':{'type':Sequelize[_0x7742('0x22')](0xb)},'session_minse':{'type':Sequelize[_0x7742('0x22')](0xb)},'session_refresher':{'type':Sequelize[_0x7742('0x3')]('uac',_0x7742('0x27')),'defaultValue':_0x7742('0x27')},'t38pt_usertpsource':{'type':Sequelize[_0x7742('0x1')]},'regexten':{'type':Sequelize[_0x7742('0x1')]},'fromdomain':{'type':Sequelize[_0x7742('0x1')]},'fromuser':{'type':Sequelize[_0x7742('0x1')]},'port':{'type':Sequelize[_0x7742('0x22')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x7742('0x15'),'no'),'defaultValue':_0x7742('0x15')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x7742('0x1')]},'defaultuser':{'type':Sequelize[_0x7742('0x1')]},'rtptimeout':{'type':Sequelize[_0x7742('0x22')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x7742('0x22')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x7742('0x22')](0xb)},'sendrpid':{'type':Sequelize[_0x7742('0x3')](_0x7742('0x15'),'no',_0x7742('0x28')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x7742('0x1')]},'timert1':{'type':Sequelize[_0x7742('0x22')](0xb)},'timerb':{'type':Sequelize[_0x7742('0x22')](0xb)},'qualifyfreq':{'type':Sequelize[_0x7742('0x22')](0xb)},'contactpermit':{'type':Sequelize[_0x7742('0x1')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x7742('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x7742('0x1')]},'use_q850_reason':{'type':Sequelize[_0x7742('0x1')]},'maxforwards':{'type':Sequelize[_0x7742('0x22')](0xb)},'encryption':{'type':Sequelize[_0x7742('0x3')](_0x7742('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x7742('0x3')](_0x7742('0x15'),'no')},'force_avp':{'type':Sequelize[_0x7742('0x3')]('yes','no')},'icesupport':{'type':Sequelize[_0x7742('0x3')](_0x7742('0x15'),'no')},'dtlsenable':{'type':Sequelize[_0x7742('0x3')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x7742('0x3')](_0x7742('0x15'),'no','fingerprint',_0x7742('0x29'))},'dtlsrekey':{'type':Sequelize[_0x7742('0x22')](0xb)},'dtlscertfile':{'type':Sequelize[_0x7742('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x7742('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x7742('0x1')]},'dtlssetup':{'type':Sequelize[_0x7742('0x3')]('active',_0x7742('0x2a'),_0x7742('0x2b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x7742('0x1')]},'usereqphone':{'type':Sequelize[_0x7742('0x3')](_0x7742('0x15'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x7742('0x1')]},'call_limit':{'type':Sequelize[_0x7742('0x22')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x7742('0x3')](_0x7742('0x15'),'no')},'subscribemwi':{'type':Sequelize[_0x7742('0x3')](_0x7742('0x15'),'no')},'vmexten':{'type':Sequelize[_0x7742('0x1')]},'mohinterpret':{'type':Sequelize[_0x7742('0x1')]},'mohsuggest':{'type':Sequelize[_0x7742('0x1')]},'parkinglot':{'type':Sequelize[_0x7742('0x1')]},'description':{'type':Sequelize[_0x7742('0x1')]},'host':{'type':Sequelize[_0x7742('0x1')],'defaultValue':_0x7742('0x2c')},'canreinvite':{'type':Sequelize['ENUM'](_0x7742('0x15'),'no',_0x7742('0x16'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x7742('0x1')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x7742('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 3384ec2..dea9eba 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 _0x24ca=['lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','get','Trunks','UserProfileResource','destroy','then','end','name','send','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','rawAttributes','keys','find','clone','length','omit','createdAt','updatedAt','create','user','role','userProfileId','autoAssociation','body','join','root','server/files/templates/trunk.ejs','readFileSync','server/files/templates/registry.ejs','utf8','writeFileSync','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_trunks.conf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x4d6e3f,_0x48e790){var _0x2f7002=function(_0x28fdaa){while(--_0x28fdaa){_0x4d6e3f['push'](_0x4d6e3f['shift']());}};_0x2f7002(++_0x48e790);}(_0x24ca,0x1bc));var _0xa24c=function(_0x33c9f8,_0x5aedbb){_0x33c9f8=_0x33c9f8-0x0;var _0x2d7004=_0x24ca[_0x33c9f8];return _0x2d7004;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];var jayson=require(_0xa24c('0x1b'));var client=jayson[_0xa24c('0x1c')][_0xa24c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5a9486,_0x3ad0bf,_0x3c23fc,_0x26ff28){return new BPromise(function(_0x2fcd8b,_0x1cb08e){var _0x2d185c=_0x26ff28||client;return _0x2d185c[_0xa24c('0x1e')](_0x5a9486,_0x3c23fc)['then'](function(_0x47a063){logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,'request\x20sent');logger['debug'](_0xa24c('0x21'),_0x3ad0bf,_0xa24c('0x22'),JSON['stringify'](_0x47a063));if(_0x47a063[_0xa24c('0x23')]){if(_0x47a063['error'][_0xa24c('0x24')]===0x1f4){logger[_0xa24c('0x23')](_0xa24c('0x20'),_0x3ad0bf,_0x47a063[_0xa24c('0x23')]['message']);return _0x1cb08e(_0x47a063[_0xa24c('0x23')][_0xa24c('0x25')]);}logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x47a063['error']['message']);return _0x2fcd8b(_0x47a063['error'][_0xa24c('0x25')]);}else{logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,_0xa24c('0x22'));_0x2fcd8b(_0x47a063['result'][_0xa24c('0x25')]);}})['catch'](function(_0x224bca){logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x224bca);_0x1cb08e(_0x224bca);});});}function respondWithStatusCode(_0x346ee8,_0x363d52){_0x363d52=_0x363d52||0xcc;return function(_0x43a0c0){if(_0x43a0c0){return _0x346ee8[_0xa24c('0x26')](_0x363d52);}return _0x346ee8[_0xa24c('0x27')](_0x363d52)['end']();};}function respondWithResult(_0xec9167,_0x5cc9cb){_0x5cc9cb=_0x5cc9cb||0xc8;return function(_0x2365f9){if(_0x2365f9){return _0xec9167[_0xa24c('0x27')](_0x5cc9cb)[_0xa24c('0x28')](_0x2365f9);}};}function respondWithFilteredResult(_0x51dc3f,_0x1beb55){return function(_0x31c4d9){if(_0x31c4d9){var _0x14fd5a=typeof _0x1beb55[_0xa24c('0x29')]===_0xa24c('0x2a')&&typeof _0x1beb55[_0xa24c('0x2b')]===_0xa24c('0x2a');var _0x5b23f4=_0x31c4d9[_0xa24c('0x2c')];var _0x28675f=_0x14fd5a?0x0:_0x1beb55[_0xa24c('0x29')];var _0x12dbdc=_0x14fd5a?_0x31c4d9['count']:_0x1beb55[_0xa24c('0x29')]+_0x1beb55[_0xa24c('0x2b')];var _0x97c08;if(_0x12dbdc>=_0x5b23f4){_0x12dbdc=_0x5b23f4;_0x97c08=0xc8;}else{_0x97c08=0xce;}_0x51dc3f['status'](_0x97c08);return _0x51dc3f[_0xa24c('0x2d')](_0xa24c('0x2e'),_0x28675f+'-'+_0x12dbdc+'/'+_0x5b23f4)[_0xa24c('0x28')](_0x31c4d9);}return null;};}function patchUpdates(_0x4ae35c){return function(_0x245fb2){try{jsonpatch['apply'](_0x245fb2,_0x4ae35c,!![]);}catch(_0x1102ab){return BPromise[_0xa24c('0x2f')](_0x1102ab);}return _0x245fb2[_0xa24c('0x30')]();};}function saveUpdates(_0x5d025a,_0x1f52f8){return function(_0x53f90){if(_0x53f90){return _0x53f90[_0xa24c('0x31')](_0x5d025a)['then'](function(_0x1c1ed3){return _0x1c1ed3;});}return null;};}function removeEntity(_0x57c340,_0xa20091){return function(_0x42ba21){if(_0x42ba21){return _0x42ba21['destroy']()['then'](function(){var _0x20a276=_0x42ba21[_0xa24c('0x32')]({'plain':!![]});var _0x182e86=_0xa24c('0x33');return db[_0xa24c('0x34')][_0xa24c('0x35')]({'where':{'type':_0x182e86,'resourceId':_0x20a276['id']}})[_0xa24c('0x36')](function(){return _0x42ba21;});})['then'](function(){_0x57c340[_0xa24c('0x27')](0xcc)[_0xa24c('0x37')]();});}};}function handleEntityNotFound(_0x12825d,_0xbd24c0){return function(_0xc6337b){if(!_0xc6337b){_0x12825d[_0xa24c('0x26')](0x194);}return _0xc6337b;};}function handleError(_0x86902f,_0x81d471){_0x81d471=_0x81d471||0x1f4;return function(_0x1ea166){logger[_0xa24c('0x23')](_0x1ea166['stack']);if(_0x1ea166[_0xa24c('0x38')]){delete _0x1ea166[_0xa24c('0x38')];}_0x86902f[_0xa24c('0x27')](_0x81d471)[_0xa24c('0x39')](_0x1ea166);};}exports['index']=function(_0x56a485,_0x19a65f){var _0x56ef4d={},_0xb690b5={},_0x13f272={'count':0x0,'rows':[]};var _0x22a316=_[_0xa24c('0x3a')](db[_0xa24c('0x3b')]['rawAttributes'],function(_0x532875){return{'name':_0x532875[_0xa24c('0x3c')],'type':_0x532875[_0xa24c('0x3d')][_0xa24c('0x3e')]};});_0xb690b5[_0xa24c('0x3f')]=_[_0xa24c('0x3a')](_0x22a316,_0xa24c('0x38'));_0xb690b5['query']=_['keys'](_0x56a485[_0xa24c('0x40')]);_0xb690b5[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],_0xb690b5[_0xa24c('0x40')]);_0x56ef4d['attributes']=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],qs['fields'](_0x56a485['query'][_0xa24c('0x43')]));_0x56ef4d[_0xa24c('0x44')]=_0x56ef4d[_0xa24c('0x44')]['length']?_0x56ef4d['attributes']:_0xb690b5[_0xa24c('0x3f')];if(!_0x56a485[_0xa24c('0x40')][_0xa24c('0x45')](_0xa24c('0x46'))){_0x56ef4d[_0xa24c('0x2b')]=qs[_0xa24c('0x2b')](_0x56a485[_0xa24c('0x40')][_0xa24c('0x2b')]);_0x56ef4d['offset']=qs['offset'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x29')]);}_0x56ef4d[_0xa24c('0x47')]=qs['sort'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x48')]);_0x56ef4d[_0xa24c('0x49')]=qs[_0xa24c('0x41')](_[_0xa24c('0x4a')](_0x56a485[_0xa24c('0x40')],_0xb690b5[_0xa24c('0x41')]),_0x22a316);if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]){_0x56ef4d[_0xa24c('0x49')]=_['merge'](_0x56ef4d[_0xa24c('0x49')],{'$or':_[_0xa24c('0x3a')](_0x22a316,function(_0x39a6cd){if(_0x39a6cd['type']!==_0xa24c('0x4c')){var _0x247d2c={};_0x247d2c[_0x39a6cd[_0xa24c('0x38')]]={'$like':'%'+_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]+'%'};return _0x247d2c;}})});}_0x56ef4d=_[_0xa24c('0x4d')]({},_0x56ef4d,_0x56a485[_0xa24c('0x4e')]);var _0x46f725={'where':_0x56ef4d[_0xa24c('0x49')]};return db[_0xa24c('0x3b')][_0xa24c('0x2c')](_0x46f725)['then'](function(_0x29a84d){_0x13f272[_0xa24c('0x2c')]=_0x29a84d;if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x56ef4d[_0xa24c('0x50')]=[{'all':!![]}];}return db[_0xa24c('0x3b')][_0xa24c('0x51')](_0x56ef4d);})[_0xa24c('0x36')](function(_0x184179){_0x13f272['rows']=_0x184179;return _0x13f272;})['then'](respondWithFilteredResult(_0x19a65f,_0x56ef4d))[_0xa24c('0x52')](handleError(_0x19a65f,null));};exports['show']=function(_0xc078ef,_0x1f436c){var _0x4ec677={'raw':![],'where':{'id':_0xc078ef[_0xa24c('0x53')]['id']}},_0x24b3df={};_0x24b3df[_0xa24c('0x3f')]=_['keys'](db['Trunk'][_0xa24c('0x54')]);_0x24b3df['query']=_[_0xa24c('0x55')](_0xc078ef[_0xa24c('0x40')]);_0x24b3df[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],_0x24b3df[_0xa24c('0x40')]);_0x4ec677[_0xa24c('0x44')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0xc078ef['query'][_0xa24c('0x43')]));_0x4ec677[_0xa24c('0x44')]=_0x4ec677[_0xa24c('0x44')]['length']?_0x4ec677['attributes']:_0x24b3df['model'];if(_0xc078ef[_0xa24c('0x40')]['includeAll']){_0x4ec677[_0xa24c('0x50')]=[{'all':!![]}];}_0x4ec677=_[_0xa24c('0x4d')]({},_0x4ec677,_0xc078ef['options']);return db[_0xa24c('0x3b')][_0xa24c('0x56')](_0x4ec677)[_0xa24c('0x36')](handleEntityNotFound(_0x1f436c,null))[_0xa24c('0x36')](respondWithResult(_0x1f436c,null))[_0xa24c('0x52')](handleError(_0x1f436c,null));};exports[_0xa24c('0x57')]=function(_0x3816f7,_0xbeab78){var _0x518c2a={'where':{'id':_0x3816f7['params']['id']}},_0x172645={};_0x172645['model']=_['keys'](db['Trunk']['rawAttributes']);_0x518c2a[_0xa24c('0x44')]=_['intersection'](_0x172645[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0x3816f7[_0xa24c('0x40')][_0xa24c('0x43')]));_0x518c2a[_0xa24c('0x44')]=_0x518c2a[_0xa24c('0x44')][_0xa24c('0x58')]?_0x518c2a[_0xa24c('0x44')]:_0x172645[_0xa24c('0x3f')];if(_0x3816f7[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x518c2a[_0xa24c('0x50')]=[{'all':!![]}];}_0x518c2a=_[_0xa24c('0x4d')]({},_0x518c2a,_0x3816f7[_0xa24c('0x4e')]);return db[_0xa24c('0x3b')]['find'](_0x518c2a)[_0xa24c('0x36')](handleEntityNotFound(_0xbeab78,null))[_0xa24c('0x36')](function(_0x5264a7){if(_0x5264a7){var _0x1e08bb=_0x5264a7[_0xa24c('0x32')]({'plain':!![]});_0x1e08bb=qs[_0xa24c('0x59')](_0x1e08bb,['id',_0xa24c('0x5a'),'updatedAt']);_0x3816f7['body']=_[_0xa24c('0x59')](_0x3816f7['body'],['id','createdAt',_0xa24c('0x5b')]);return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_[_0xa24c('0x4d')](_0x1e08bb,_0x3816f7['body']),{'include':_0x3816f7['query'][_0xa24c('0x4f')]?[{'all':!![]}]:undefined})['then'](function(_0x52a895){var _0xfcc193=_0x3816f7[_0xa24c('0x5d')][_0xa24c('0x32')]({'plain':!![]});if(!_0xfcc193)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfcc193[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5c3285=_0x52a895[_0xa24c('0x32')]({'plain':!![]});var _0x3f306d=_0xa24c('0x33');return db['UserProfileSection'][_0xa24c('0x56')]({'where':{'name':_0x3f306d,'userProfileId':_0xfcc193[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x7aab6e){if(_0x7aab6e&&_0x7aab6e[_0xa24c('0x60')]===0x0){return db['UserProfileResource'][_0xa24c('0x5c')]({'name':_0x5c3285[_0xa24c('0x38')],'resourceId':_0x5c3285['id'],'type':_0x7aab6e[_0xa24c('0x38')],'sectionId':_0x7aab6e['id']},{})[_0xa24c('0x36')](function(){return _0x52a895;});}else{return _0x52a895;}})[_0xa24c('0x52')](function(_0x2ca3fa){logger[_0xa24c('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ca3fa);throw _0x2ca3fa;});}return _0x52a895;});}})[_0xa24c('0x36')](respondWithResult(_0xbeab78,0xc9))[_0xa24c('0x52')](handleError(_0xbeab78,null));};exports['create']=function(_0xb1048a,_0x3e455b,_0x14da5e){var _0xb460b4;return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_0xb1048a[_0xa24c('0x61')],{'raw':!![]})[_0xa24c('0x36')](function(_0x38cc30){_0xb460b4=_0x38cc30;return db[_0xa24c('0x3b')]['findAll']({'raw':!![]});})[_0xa24c('0x36')](function(_0x3a4abd){var _0x3b894f=fs['readFileSync'](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x64')),'utf8');var _0x3ac3a0=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4f9b56=ejs['render'](_0x3b894f,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4f9b56);if(_0xb460b4[_0xa24c('0x69')]){var _0x1879ae=ejs[_0xa24c('0x6a')](_0x3ac3a0,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')](_0xa24c('0x6b'),_0x1879ae);}})['then'](function(){return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x5c'),{'module':_0xa24c('0x6d')});})[_0xa24c('0x36')](function(){var _0x987aca=_0xb1048a[_0xa24c('0x5d')]['get']({'plain':!![]});if(!_0x987aca)throw new Error(_0xa24c('0x6e'));if(_0x987aca[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5b9ad7=_0xb460b4['get']({'plain':!![]});return db[_0xa24c('0x6f')]['find']({'where':{'name':_0xa24c('0x33'),'userProfileId':_0x987aca[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x180da2){if(_0x180da2&&_0x180da2['autoAssociation']===0x0){return db[_0xa24c('0x34')][_0xa24c('0x5c')]({'name':_0x5b9ad7['name'],'resourceId':_0x5b9ad7['id'],'type':_0x180da2[_0xa24c('0x38')],'sectionId':_0x180da2['id']},{})[_0xa24c('0x36')](function(){return _0xb460b4;});}else{return _0xb460b4;}})[_0xa24c('0x52')](function(_0x3e0c08){logger[_0xa24c('0x23')](_0xa24c('0x70'),_0x3e0c08);throw _0x3e0c08;});}return _0xb460b4;})[_0xa24c('0x36')](respondWithResult(_0x3e455b,0xc9))[_0xa24c('0x52')](handleError(_0x3e455b,null));};exports['update']=function(_0x12508e,_0x3c2726,_0x2cae90){var _0x28c3ff;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x12508e[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3c2726,null))[_0xa24c('0x36')](saveUpdates(_0x12508e[_0xa24c('0x61')],null))[_0xa24c('0x36')](function(_0x5b0127){if(_0x5b0127){_0x28c3ff=_0x5b0127;return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});}})['then'](function(_0x141ccf){if(_0x141ccf){var _0x3f212f=fs[_0xa24c('0x65')](path['join'](config['root'],_0xa24c('0x64')),_0xa24c('0x67'));var _0x53928f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x336898=ejs['render'](_0x3f212f,{'trunks':_0x141ccf||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x336898);var _0x263dab=ejs['render'](_0x53928f,{'trunks':_0x141ccf||[]});fs['writeFileSync'](_0xa24c('0x6b'),_0x263dab);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x31'),{'module':_0xa24c('0x6d')});}return null;})[_0xa24c('0x36')](function(_0x45b2fe){if(_0x45b2fe){return _0x28c3ff;}})[_0xa24c('0x36')](respondWithResult(_0x3c2726,null))[_0xa24c('0x52')](handleError(_0x3c2726,null));};exports[_0xa24c('0x35')]=function(_0x4ee10d,_0x3897ca,_0xa077c8){var _0x16e1db;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x4ee10d[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3897ca,null))[_0xa24c('0x36')](removeEntity(_0x3897ca,null))[_0xa24c('0x36')](function(){return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});})[_0xa24c('0x36')](function(_0x4ecbe9){var _0x1fe0f3=fs[_0xa24c('0x65')](path['join'](config[_0xa24c('0x63')],_0xa24c('0x64')),_0xa24c('0x67'));var _0x4af78f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config['root'],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4c108f=ejs['render'](_0x1fe0f3,{'trunks':_0x4ecbe9});var _0x124d52=ejs[_0xa24c('0x6a')](_0x4af78f,{'trunks':_0x4ecbe9});fs[_0xa24c('0x68')](_0xa24c('0x71'),_0x4c108f);fs['writeFileSync'](_0xa24c('0x6b'),_0x124d52);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x35'),{'module':'chan_sip.so'});})['catch'](handleError(_0x3897ca,null));}; \ No newline at end of file +var _0x98a8=['../../mysqldb','jayson/promise','client','request','Trunk,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','Trunks','UserProfileResource','stack','name','map','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Trunk','include','show','params','keys','rawAttributes','includeAll','clone','find','createdAt','updatedAt','body','omit','create','user','role','UserProfileSection','userProfileId','autoAssociation','findAll','readFileSync','root','server/files/templates/trunk.ejs','join','server/files/templates/registry.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x3deb40,_0x476322){var _0x500eac=function(_0x273aad){while(--_0x273aad){_0x3deb40['push'](_0x3deb40['shift']());}};_0x500eac(++_0x476322);}(_0x98a8,0x12c));var _0x898a=function(_0x241e9f,_0x4f2030){_0x241e9f=_0x241e9f-0x0;var _0x41b383=_0x98a8[_0x241e9f];return _0x41b383;};'use strict';var emlformat=require(_0x898a('0x0'));var rimraf=require(_0x898a('0x1'));var zipdir=require(_0x898a('0x2'));var jsonpatch=require(_0x898a('0x3'));var rp=require(_0x898a('0x4'));var moment=require(_0x898a('0x5'));var BPromise=require(_0x898a('0x6'));var Mustache=require('mustache');var util=require(_0x898a('0x7'));var path=require(_0x898a('0x8'));var sox=require(_0x898a('0x9'));var csv=require(_0x898a('0xa'));var ejs=require(_0x898a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xa'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];var jayson=require(_0x898a('0x19'));var client=jayson[_0x898a('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bfded,_0x5b5c9c,_0x373d53,_0x1f5be4){return new BPromise(function(_0xb24335,_0x116fbe){var _0x1873e9=_0x1f5be4||client;return _0x1873e9[_0x898a('0x1b')](_0x5bfded,_0x373d53)['then'](function(_0x47033c){logger['info'](_0x898a('0x1c'),_0x5b5c9c,'request\x20sent');logger[_0x898a('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x5b5c9c,_0x898a('0x1e'),JSON['stringify'](_0x47033c));if(_0x47033c[_0x898a('0x1f')]){if(_0x47033c[_0x898a('0x1f')][_0x898a('0x20')]===0x1f4){logger['error'](_0x898a('0x1c'),_0x5b5c9c,_0x47033c['error']['message']);return _0x116fbe(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5b5c9c,_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);return _0xb24335(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}else{logger[_0x898a('0x22')](_0x898a('0x1c'),_0x5b5c9c,_0x898a('0x1e'));_0xb24335(_0x47033c['result'][_0x898a('0x21')]);}})[_0x898a('0x23')](function(_0x11cae2){logger[_0x898a('0x1f')](_0x898a('0x1c'),_0x5b5c9c,_0x11cae2);_0x116fbe(_0x11cae2);});});}function respondWithStatusCode(_0x310bfa,_0x4e254d){_0x4e254d=_0x4e254d||0xcc;return function(_0x274cdf){if(_0x274cdf){return _0x310bfa[_0x898a('0x24')](_0x4e254d);}return _0x310bfa[_0x898a('0x25')](_0x4e254d)[_0x898a('0x26')]();};}function respondWithResult(_0x3901ab,_0x1426e3){_0x1426e3=_0x1426e3||0xc8;return function(_0x5b7719){if(_0x5b7719){return _0x3901ab[_0x898a('0x25')](_0x1426e3)['json'](_0x5b7719);}};}function respondWithFilteredResult(_0x513c6b,_0x53ddb2){return function(_0x3678be){if(_0x3678be){var _0x1f4d86=typeof _0x53ddb2[_0x898a('0x27')]===_0x898a('0x28')&&typeof _0x53ddb2[_0x898a('0x29')]===_0x898a('0x28');var _0x398e98=_0x3678be[_0x898a('0x2a')];var _0xd31922=_0x1f4d86?0x0:_0x53ddb2['offset'];var _0x4b3e68=_0x1f4d86?_0x3678be['count']:_0x53ddb2[_0x898a('0x27')]+_0x53ddb2[_0x898a('0x29')];var _0x3b7704;if(_0x4b3e68>=_0x398e98){_0x4b3e68=_0x398e98;_0x3b7704=0xc8;}else{_0x3b7704=0xce;}_0x513c6b[_0x898a('0x25')](_0x3b7704);return _0x513c6b[_0x898a('0x2b')](_0x898a('0x2c'),_0xd31922+'-'+_0x4b3e68+'/'+_0x398e98)[_0x898a('0x2d')](_0x3678be);}return null;};}function patchUpdates(_0xf74645){return function(_0x18773a){try{jsonpatch[_0x898a('0x2e')](_0x18773a,_0xf74645,!![]);}catch(_0x44c5d2){return BPromise[_0x898a('0x2f')](_0x44c5d2);}return _0x18773a['save']();};}function saveUpdates(_0x7a1eb5,_0x17a5f3){return function(_0x26eead){if(_0x26eead){return _0x26eead[_0x898a('0x30')](_0x7a1eb5)[_0x898a('0x31')](function(_0x47af5b){return _0x47af5b;});}return null;};}function removeEntity(_0x48cefb,_0x20a3fe){return function(_0x1e2fd4){if(_0x1e2fd4){return _0x1e2fd4[_0x898a('0x32')]()['then'](function(){var _0x105477=_0x1e2fd4[_0x898a('0x33')]({'plain':!![]});var _0x5eafc7=_0x898a('0x34');return db[_0x898a('0x35')][_0x898a('0x32')]({'where':{'type':_0x5eafc7,'resourceId':_0x105477['id']}})[_0x898a('0x31')](function(){return _0x1e2fd4;});})[_0x898a('0x31')](function(){_0x48cefb['status'](0xcc)[_0x898a('0x26')]();});}};}function handleEntityNotFound(_0x5baf5b,_0x573eb3){return function(_0x14e2dc){if(!_0x14e2dc){_0x5baf5b['sendStatus'](0x194);}return _0x14e2dc;};}function handleError(_0x3c9588,_0x4b3aac){_0x4b3aac=_0x4b3aac||0x1f4;return function(_0x37cb11){logger['error'](_0x37cb11[_0x898a('0x36')]);if(_0x37cb11[_0x898a('0x37')]){delete _0x37cb11[_0x898a('0x37')];}_0x3c9588['status'](_0x4b3aac)['send'](_0x37cb11);};}exports['index']=function(_0x1575d2,_0x429c32){var _0x5a228f={},_0xdd019d={},_0x3d3463={'count':0x0,'rows':[]};var _0xe84f7e=_[_0x898a('0x38')](db['Trunk']['rawAttributes'],function(_0x3aed01){return{'name':_0x3aed01[_0x898a('0x39')],'type':_0x3aed01['type']['key']};});_0xdd019d[_0x898a('0x3a')]=_[_0x898a('0x38')](_0xe84f7e,_0x898a('0x37'));_0xdd019d[_0x898a('0x3b')]=_['keys'](_0x1575d2[_0x898a('0x3b')]);_0xdd019d[_0x898a('0x3c')]=_['intersection'](_0xdd019d['model'],_0xdd019d['query']);_0x5a228f[_0x898a('0x3d')]=_[_0x898a('0x3e')](_0xdd019d[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x3f')]));_0x5a228f[_0x898a('0x3d')]=_0x5a228f[_0x898a('0x3d')][_0x898a('0x40')]?_0x5a228f[_0x898a('0x3d')]:_0xdd019d[_0x898a('0x3a')];if(!_0x1575d2[_0x898a('0x3b')][_0x898a('0x41')](_0x898a('0x42'))){_0x5a228f[_0x898a('0x29')]=qs['limit'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x29')]);_0x5a228f[_0x898a('0x27')]=qs['offset'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x27')]);}_0x5a228f[_0x898a('0x43')]=qs[_0x898a('0x44')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x44')]);_0x5a228f[_0x898a('0x45')]=qs[_0x898a('0x3c')](_['pick'](_0x1575d2[_0x898a('0x3b')],_0xdd019d[_0x898a('0x3c')]),_0xe84f7e);if(_0x1575d2[_0x898a('0x3b')][_0x898a('0x46')]){_0x5a228f['where']=_[_0x898a('0x47')](_0x5a228f[_0x898a('0x45')],{'$or':_['map'](_0xe84f7e,function(_0x241677){if(_0x241677['type']!==_0x898a('0x48')){var _0x5137c4={};_0x5137c4[_0x241677['name']]={'$like':'%'+_0x1575d2[_0x898a('0x3b')]['filter']+'%'};return _0x5137c4;}})});}_0x5a228f=_[_0x898a('0x47')]({},_0x5a228f,_0x1575d2[_0x898a('0x49')]);var _0x4d6ac0={'where':_0x5a228f[_0x898a('0x45')]};return db[_0x898a('0x4a')]['count'](_0x4d6ac0)[_0x898a('0x31')](function(_0x199437){_0x3d3463[_0x898a('0x2a')]=_0x199437;if(_0x1575d2[_0x898a('0x3b')]['includeAll']){_0x5a228f[_0x898a('0x4b')]=[{'all':!![]}];}return db[_0x898a('0x4a')]['findAll'](_0x5a228f);})[_0x898a('0x31')](function(_0x1d8c16){_0x3d3463['rows']=_0x1d8c16;return _0x3d3463;})[_0x898a('0x31')](respondWithFilteredResult(_0x429c32,_0x5a228f))['catch'](handleError(_0x429c32,null));};exports[_0x898a('0x4c')]=function(_0x41f291,_0x32ccb9){var _0x50f9e3={'raw':![],'where':{'id':_0x41f291[_0x898a('0x4d')]['id']}},_0x2f6cb3={};_0x2f6cb3[_0x898a('0x3a')]=_[_0x898a('0x4e')](db['Trunk'][_0x898a('0x4f')]);_0x2f6cb3['query']=_[_0x898a('0x4e')](_0x41f291[_0x898a('0x3b')]);_0x2f6cb3[_0x898a('0x3c')]=_['intersection'](_0x2f6cb3[_0x898a('0x3a')],_0x2f6cb3[_0x898a('0x3b')]);_0x50f9e3[_0x898a('0x3d')]=_['intersection'](_0x2f6cb3['model'],qs[_0x898a('0x3f')](_0x41f291[_0x898a('0x3b')][_0x898a('0x3f')]));_0x50f9e3[_0x898a('0x3d')]=_0x50f9e3[_0x898a('0x3d')][_0x898a('0x40')]?_0x50f9e3[_0x898a('0x3d')]:_0x2f6cb3[_0x898a('0x3a')];if(_0x41f291[_0x898a('0x3b')][_0x898a('0x50')]){_0x50f9e3[_0x898a('0x4b')]=[{'all':!![]}];}_0x50f9e3=_['merge']({},_0x50f9e3,_0x41f291[_0x898a('0x49')]);return db[_0x898a('0x4a')]['find'](_0x50f9e3)[_0x898a('0x31')](handleEntityNotFound(_0x32ccb9,null))['then'](respondWithResult(_0x32ccb9,null))['catch'](handleError(_0x32ccb9,null));};exports[_0x898a('0x51')]=function(_0x124f9b,_0x209529){var _0x5bfd61={'where':{'id':_0x124f9b[_0x898a('0x4d')]['id']}},_0x556fd8={};_0x556fd8[_0x898a('0x3a')]=_['keys'](db[_0x898a('0x4a')][_0x898a('0x4f')]);_0x5bfd61['attributes']=_[_0x898a('0x3e')](_0x556fd8[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x124f9b['query'][_0x898a('0x3f')]));_0x5bfd61[_0x898a('0x3d')]=_0x5bfd61[_0x898a('0x3d')][_0x898a('0x40')]?_0x5bfd61[_0x898a('0x3d')]:_0x556fd8[_0x898a('0x3a')];if(_0x124f9b['query'][_0x898a('0x50')]){_0x5bfd61['include']=[{'all':!![]}];}_0x5bfd61=_[_0x898a('0x47')]({},_0x5bfd61,_0x124f9b[_0x898a('0x49')]);return db[_0x898a('0x4a')][_0x898a('0x52')](_0x5bfd61)[_0x898a('0x31')](handleEntityNotFound(_0x209529,null))[_0x898a('0x31')](function(_0x2486a5){if(_0x2486a5){var _0x75ff57=_0x2486a5[_0x898a('0x33')]({'plain':!![]});_0x75ff57=qs['omit'](_0x75ff57,['id',_0x898a('0x53'),_0x898a('0x54')]);_0x124f9b[_0x898a('0x55')]=_[_0x898a('0x56')](_0x124f9b[_0x898a('0x55')],['id',_0x898a('0x53'),_0x898a('0x54')]);return db[_0x898a('0x4a')][_0x898a('0x57')](_[_0x898a('0x47')](_0x75ff57,_0x124f9b[_0x898a('0x55')]),{'include':_0x124f9b[_0x898a('0x3b')][_0x898a('0x50')]?[{'all':!![]}]:undefined})[_0x898a('0x31')](function(_0x22f9ba){var _0x5f42ae=_0x124f9b[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x5f42ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f42ae[_0x898a('0x59')]===_0x898a('0x58')){var _0x5f0944=_0x22f9ba[_0x898a('0x33')]({'plain':!![]});var _0x1daecd=_0x898a('0x34');return db[_0x898a('0x5a')]['find']({'where':{'name':_0x1daecd,'userProfileId':_0x5f42ae[_0x898a('0x5b')]},'raw':!![]})[_0x898a('0x31')](function(_0x137935){if(_0x137935&&_0x137935[_0x898a('0x5c')]===0x0){return db['UserProfileResource'][_0x898a('0x57')]({'name':_0x5f0944[_0x898a('0x37')],'resourceId':_0x5f0944['id'],'type':_0x137935['name'],'sectionId':_0x137935['id']},{})[_0x898a('0x31')](function(){return _0x22f9ba;});}else{return _0x22f9ba;}})[_0x898a('0x23')](function(_0x5b7019){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b7019);throw _0x5b7019;});}return _0x22f9ba;});}})[_0x898a('0x31')](respondWithResult(_0x209529,0xc9))['catch'](handleError(_0x209529,null));};exports['create']=function(_0x5ed35e,_0xfdd6d8,_0x473f5c){var _0x3909c5;return db[_0x898a('0x4a')]['create'](_0x5ed35e['body'],{'raw':!![]})[_0x898a('0x31')](function(_0x232be0){_0x3909c5=_0x232be0;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x41cf94){var _0x30051d=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x42fda8=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),_0x898a('0x63'));var _0x3bcc3d=ejs[_0x898a('0x64')](_0x30051d,{'trunks':_0x41cf94||[]});fs[_0x898a('0x65')](_0x898a('0x66'),_0x3bcc3d);if(_0x3909c5[_0x898a('0x67')]){var _0x307849=ejs[_0x898a('0x64')](_0x42fda8,{'trunks':_0x41cf94||[]});fs['writeFileSync'](_0x898a('0x68'),_0x307849);}})['then'](function(){return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x57'),{'module':_0x898a('0x6a')});})['then'](function(){var _0x31102d=_0x5ed35e[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x31102d)throw new Error(_0x898a('0x6b'));if(_0x31102d[_0x898a('0x59')]==='user'){var _0x4b9487=_0x3909c5[_0x898a('0x33')]({'plain':!![]});return db[_0x898a('0x5a')][_0x898a('0x52')]({'where':{'name':_0x898a('0x34'),'userProfileId':_0x31102d['userProfileId']},'raw':!![]})[_0x898a('0x31')](function(_0x3d3451){if(_0x3d3451&&_0x3d3451[_0x898a('0x5c')]===0x0){return db[_0x898a('0x35')][_0x898a('0x57')]({'name':_0x4b9487[_0x898a('0x37')],'resourceId':_0x4b9487['id'],'type':_0x3d3451[_0x898a('0x37')],'sectionId':_0x3d3451['id']},{})[_0x898a('0x31')](function(){return _0x3909c5;});}else{return _0x3909c5;}})['catch'](function(_0x32a207){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32a207);throw _0x32a207;});}return _0x3909c5;})[_0x898a('0x31')](respondWithResult(_0xfdd6d8,0xc9))['catch'](handleError(_0xfdd6d8,null));};exports[_0x898a('0x30')]=function(_0x4b2575,_0x2471d8,_0x387f2c){var _0x3b07dc;return db[_0x898a('0x4a')][_0x898a('0x52')]({'where':{'id':_0x4b2575[_0x898a('0x4d')]['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x2471d8,null))[_0x898a('0x31')](saveUpdates(_0x4b2575[_0x898a('0x55')],null))['then'](function(_0x3fe54b){if(_0x3fe54b){_0x3b07dc=_0x3fe54b;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});}})[_0x898a('0x31')](function(_0x290972){if(_0x290972){var _0x1d594b=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x4fad03=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config['root'],'server/files/templates/registry.ejs'),_0x898a('0x63'));var _0x4a79a4=ejs[_0x898a('0x64')](_0x1d594b,{'trunks':_0x290972||[]});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4a79a4);var _0x3f6815=ejs[_0x898a('0x64')](_0x4fad03,{'trunks':_0x290972||[]});fs[_0x898a('0x65')](_0x898a('0x68'),_0x3f6815);return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x30'),{'module':_0x898a('0x6a')});}return null;})['then'](function(_0x3237e8){if(_0x3237e8){return _0x3b07dc;}})[_0x898a('0x31')](respondWithResult(_0x2471d8,null))[_0x898a('0x23')](handleError(_0x2471d8,null));};exports['destroy']=function(_0x27560f,_0x61247c,_0x5c6247){var _0x39e917;return db['Trunk']['find']({'where':{'id':_0x27560f['params']['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x61247c,null))[_0x898a('0x31')](removeEntity(_0x61247c,null))[_0x898a('0x31')](function(){return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x12e54b){var _0x50dd52=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x24670c=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),'utf8');var _0x5847cb=ejs['render'](_0x50dd52,{'trunks':_0x12e54b});var _0x3b8fb5=ejs[_0x898a('0x64')](_0x24670c,{'trunks':_0x12e54b});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5847cb);fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_registers.conf',_0x3b8fb5);return respondWithRpcPromise('Reload',_0x898a('0x32'),{'module':_0x898a('0x6a')});})[_0x898a('0x23')](handleError(_0x61247c,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 10fbf6e..4af4bdf 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 _0x6df8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','Trunk','tools_trunks','lodash','../../config/logger','api'];(function(_0x18fe74,_0x4e6b5d){var _0xdf7bbc=function(_0x474ad1){while(--_0x474ad1){_0x18fe74['push'](_0x18fe74['shift']());}};_0xdf7bbc(++_0x4e6b5d);}(_0x6df8,0x10e));var _0x86df=function(_0x5c1c0f,_0x72c16){_0x5c1c0f=_0x5c1c0f-0x0;var _0x23a98c=_0x6df8[_0x5c1c0f];return _0x23a98c;};'use strict';var _=require(_0x86df('0x0'));var util=require('util');var logger=require(_0x86df('0x1'))(_0x86df('0x2'));var moment=require(_0x86df('0x3'));var BPromise=require(_0x86df('0x4'));var rp=require(_0x86df('0x5'));var fs=require('fs');var path=require(_0x86df('0x6'));var rimraf=require(_0x86df('0x7'));var config=require(_0x86df('0x8'));var attributes=require(_0x86df('0x9'));module[_0x86df('0xa')]=function(_0x19b2bf,_0x38d1dc){return _0x19b2bf['define'](_0x86df('0xb'),attributes,{'tableName':_0x86df('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb365=['define','tools_trunks','../../config/logger','api','moment','request-promise','path','../../config/environment','./trunk.attributes'];(function(_0x2d3ab3,_0x47d90b){var _0x321f9e=function(_0x50a53d){while(--_0x50a53d){_0x2d3ab3['push'](_0x2d3ab3['shift']());}};_0x321f9e(++_0x47d90b);}(_0xb365,0xda));var _0x5b36=function(_0x4d2a40,_0x25674d){_0x4d2a40=_0x4d2a40-0x0;var _0x1f5d60=_0xb365[_0x4d2a40];return _0x1f5d60;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5b36('0x0'))(_0x5b36('0x1'));var moment=require(_0x5b36('0x2'));var BPromise=require('bluebird');var rp=require(_0x5b36('0x3'));var fs=require('fs');var path=require(_0x5b36('0x4'));var rimraf=require('rimraf');var config=require(_0x5b36('0x5'));var attributes=require(_0x5b36('0x6'));module['exports']=function(_0xc29f8e,_0x3c00eb){return _0xc29f8e[_0x5b36('0x7')]('Trunk',attributes,{'tableName':_0x5b36('0x8'),'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 3018320..b264736 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 _0xb2c9=['options','raw','where','attributes','limit','include','model','map','info','find','ShowTrunk','debug','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrunk','Trunk','findAll'];(function(_0x8e4e8,_0x158fc4){var _0x21fa1b=function(_0x56eb9c){while(--_0x56eb9c){_0x8e4e8['push'](_0x8e4e8['shift']());}};_0x21fa1b(++_0x158fc4);}(_0xb2c9,0xde));var _0x9b2c=function(_0x4389d6,_0x58768d){_0x4389d6=_0x4389d6-0x0;var _0x3f279b=_0xb2c9[_0x4389d6];return _0x3f279b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9b2c('0x0'));var BPromise=require(_0x9b2c('0x1'));var rs=require(_0x9b2c('0x2'));var fs=require('fs');var Redis=require(_0x9b2c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9b2c('0x4'));var logger=require('../../config/logger')(_0x9b2c('0x5'));var config=require(_0x9b2c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9b2c('0x7')][_0x9b2c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ec288,_0x38cbc2,_0x12b07b){return new BPromise(function(_0x4eb31f,_0x30d6c1){return client[_0x9b2c('0x9')](_0x3ec288,_0x12b07b)[_0x9b2c('0xa')](function(_0x12c83c){logger['info'](_0x9b2c('0xb'),_0x38cbc2,_0x9b2c('0xc'));logger['debug'](_0x9b2c('0xd'),_0x38cbc2,'request\x20sent',JSON[_0x9b2c('0xe')](_0x12c83c));if(_0x12c83c[_0x9b2c('0xf')]){if(_0x12c83c[_0x9b2c('0xf')][_0x9b2c('0x10')]===0x1f4){logger[_0x9b2c('0xf')](_0x9b2c('0xb'),_0x38cbc2,_0x12c83c[_0x9b2c('0xf')][_0x9b2c('0x11')]);return _0x30d6c1(_0x12c83c[_0x9b2c('0xf')][_0x9b2c('0x11')]);}logger[_0x9b2c('0xf')](_0x9b2c('0xb'),_0x38cbc2,_0x12c83c[_0x9b2c('0xf')]['message']);return _0x4eb31f(_0x12c83c[_0x9b2c('0xf')]['message']);}else{logger['info'](_0x9b2c('0xb'),_0x38cbc2,_0x9b2c('0xc'));_0x4eb31f(_0x12c83c[_0x9b2c('0x12')][_0x9b2c('0x11')]);}})[_0x9b2c('0x13')](function(_0x40b70e){logger['error'](_0x9b2c('0xb'),_0x38cbc2,_0x40b70e);_0x30d6c1(_0x40b70e);});});}exports[_0x9b2c('0x14')]=function(_0x1639eb){var _0x23c940=this;return new Promise(function(_0x35a9ca,_0x32cc78){return db[_0x9b2c('0x15')][_0x9b2c('0x16')]({'raw':_0x1639eb[_0x9b2c('0x17')]?_0x1639eb[_0x9b2c('0x17')][_0x9b2c('0x18')]===undefined?!![]:![]:!![],'where':_0x1639eb['options']?_0x1639eb['options'][_0x9b2c('0x19')]||null:null,'attributes':_0x1639eb['options']?_0x1639eb[_0x9b2c('0x17')][_0x9b2c('0x1a')]||null:null,'limit':_0x1639eb[_0x9b2c('0x17')]?_0x1639eb[_0x9b2c('0x17')][_0x9b2c('0x1b')]||null:null,'include':_0x1639eb[_0x9b2c('0x17')]?_0x1639eb[_0x9b2c('0x17')][_0x9b2c('0x1c')]?_['map'](_0x1639eb[_0x9b2c('0x17')][_0x9b2c('0x1c')],function(_0xe8fae1){return{'model':db[_0xe8fae1[_0x9b2c('0x1d')]],'as':_0xe8fae1['as'],'attributes':_0xe8fae1['attributes'],'include':_0xe8fae1[_0x9b2c('0x1c')]?_['map'](_0xe8fae1[_0x9b2c('0x1c')],function(_0x171122){return{'model':db[_0x171122[_0x9b2c('0x1d')]],'as':_0x171122['as'],'attributes':_0x171122[_0x9b2c('0x1a')],'include':_0x171122['include']?_[_0x9b2c('0x1e')](_0x171122[_0x9b2c('0x1c')],function(_0x41ac3e){return{'model':db[_0x41ac3e[_0x9b2c('0x1d')]],'as':_0x41ac3e['as'],'attributes':_0x41ac3e['attributes']};}):[]};}):[]};}):[]:[]})[_0x9b2c('0xa')](function(_0x119258){logger[_0x9b2c('0x1f')](_0x9b2c('0x14'),_0x1639eb);logger['debug'](_0x9b2c('0x14'),_0x1639eb,JSON['stringify'](_0x119258));_0x35a9ca(_0x119258);})[_0x9b2c('0x13')](function(_0x44b801){logger[_0x9b2c('0xf')]('GetTrunk',_0x44b801['message'],_0x1639eb);_0x32cc78(_0x23c940[_0x9b2c('0xf')](0x1f4,_0x44b801[_0x9b2c('0x11')]));});});};exports['ShowTrunk']=function(_0x1210f7){var _0x14cf72=this;return new Promise(function(_0x567c0d,_0x48450b){return db[_0x9b2c('0x15')][_0x9b2c('0x20')]({'raw':_0x1210f7['options']?_0x1210f7[_0x9b2c('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1210f7[_0x9b2c('0x17')]?_0x1210f7[_0x9b2c('0x17')][_0x9b2c('0x19')]||null:null,'attributes':_0x1210f7[_0x9b2c('0x17')]?_0x1210f7[_0x9b2c('0x17')][_0x9b2c('0x1a')]||null:null,'include':_0x1210f7[_0x9b2c('0x17')]?_0x1210f7[_0x9b2c('0x17')][_0x9b2c('0x1c')]?_['map'](_0x1210f7[_0x9b2c('0x17')][_0x9b2c('0x1c')],function(_0x26019c){return{'model':db[_0x26019c[_0x9b2c('0x1d')]],'as':_0x26019c['as'],'attributes':_0x26019c[_0x9b2c('0x1a')],'include':_0x26019c[_0x9b2c('0x1c')]?_[_0x9b2c('0x1e')](_0x26019c['include'],function(_0x3f052a){return{'model':db[_0x3f052a[_0x9b2c('0x1d')]],'as':_0x3f052a['as'],'attributes':_0x3f052a['attributes'],'include':_0x3f052a[_0x9b2c('0x1c')]?_[_0x9b2c('0x1e')](_0x3f052a[_0x9b2c('0x1c')],function(_0x31542a){return{'model':db[_0x31542a['model']],'as':_0x31542a['as'],'attributes':_0x31542a[_0x9b2c('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1227eb){logger[_0x9b2c('0x1f')](_0x9b2c('0x21'),_0x1210f7);logger[_0x9b2c('0x22')](_0x9b2c('0x21'),_0x1210f7,JSON[_0x9b2c('0xe')](_0x1227eb));_0x567c0d(_0x1227eb);})[_0x9b2c('0x13')](function(_0x256e70){logger[_0x9b2c('0xf')]('ShowTrunk',_0x256e70[_0x9b2c('0x11')],_0x1210f7);_0x48450b(_0x14cf72['error'](0x1f4,_0x256e70[_0x9b2c('0x11')]));});});}; \ No newline at end of file +var _0x8a47=['Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetTrunk','Trunk','findAll','options','raw','where','attributes','include','map','model','catch','ShowTrunk','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info'];(function(_0x54bac5,_0x8d3a16){var _0xc15971=function(_0x254653){while(--_0x254653){_0x54bac5['push'](_0x54bac5['shift']());}};_0xc15971(++_0x8d3a16);}(_0x8a47,0x17e));var _0x78a4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8a47[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x78a4('0x0'));var util=require(_0x78a4('0x1'));var moment=require(_0x78a4('0x2'));var BPromise=require(_0x78a4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x78a4('0x4'));var db=require(_0x78a4('0x5'))['db'];var utils=require(_0x78a4('0x6'));var logger=require(_0x78a4('0x7'))('rpc');var config=require(_0x78a4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x78a4('0x9')][_0x78a4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51f2a4,_0x557478,_0xc590fa){return new BPromise(function(_0x584545,_0x15270f){return client[_0x78a4('0xb')](_0x51f2a4,_0xc590fa)[_0x78a4('0xc')](function(_0x46adf1){logger[_0x78a4('0xd')](_0x78a4('0xe'),_0x557478,_0x78a4('0xf'));logger[_0x78a4('0x10')](_0x78a4('0x11'),_0x557478,_0x78a4('0xf'),JSON[_0x78a4('0x12')](_0x46adf1));if(_0x46adf1[_0x78a4('0x13')]){if(_0x46adf1[_0x78a4('0x13')][_0x78a4('0x14')]===0x1f4){logger['error'](_0x78a4('0xe'),_0x557478,_0x46adf1[_0x78a4('0x13')][_0x78a4('0x15')]);return _0x15270f(_0x46adf1[_0x78a4('0x13')][_0x78a4('0x15')]);}logger['error'](_0x78a4('0xe'),_0x557478,_0x46adf1[_0x78a4('0x13')][_0x78a4('0x15')]);return _0x584545(_0x46adf1[_0x78a4('0x13')][_0x78a4('0x15')]);}else{logger[_0x78a4('0xd')](_0x78a4('0xe'),_0x557478,_0x78a4('0xf'));_0x584545(_0x46adf1[_0x78a4('0x16')][_0x78a4('0x15')]);}})['catch'](function(_0x2ae155){logger[_0x78a4('0x13')](_0x78a4('0xe'),_0x557478,_0x2ae155);_0x15270f(_0x2ae155);});});}exports[_0x78a4('0x17')]=function(_0x16bd28){var _0x2b3aa8=this;return new Promise(function(_0x213ff9,_0x1c7d3e){return db[_0x78a4('0x18')][_0x78a4('0x19')]({'raw':_0x16bd28['options']?_0x16bd28[_0x78a4('0x1a')][_0x78a4('0x1b')]===undefined?!![]:![]:!![],'where':_0x16bd28[_0x78a4('0x1a')]?_0x16bd28[_0x78a4('0x1a')][_0x78a4('0x1c')]||null:null,'attributes':_0x16bd28[_0x78a4('0x1a')]?_0x16bd28[_0x78a4('0x1a')][_0x78a4('0x1d')]||null:null,'limit':_0x16bd28[_0x78a4('0x1a')]?_0x16bd28[_0x78a4('0x1a')]['limit']||null:null,'include':_0x16bd28['options']?_0x16bd28['options'][_0x78a4('0x1e')]?_[_0x78a4('0x1f')](_0x16bd28[_0x78a4('0x1a')][_0x78a4('0x1e')],function(_0x1d906e){return{'model':db[_0x1d906e[_0x78a4('0x20')]],'as':_0x1d906e['as'],'attributes':_0x1d906e['attributes'],'include':_0x1d906e['include']?_['map'](_0x1d906e[_0x78a4('0x1e')],function(_0x1c7eab){return{'model':db[_0x1c7eab[_0x78a4('0x20')]],'as':_0x1c7eab['as'],'attributes':_0x1c7eab['attributes'],'include':_0x1c7eab[_0x78a4('0x1e')]?_[_0x78a4('0x1f')](_0x1c7eab[_0x78a4('0x1e')],function(_0x368e3b){return{'model':db[_0x368e3b[_0x78a4('0x20')]],'as':_0x368e3b['as'],'attributes':_0x368e3b[_0x78a4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x78a4('0xc')](function(_0x316246){logger['info'](_0x78a4('0x17'),_0x16bd28);logger[_0x78a4('0x10')](_0x78a4('0x17'),_0x16bd28,JSON[_0x78a4('0x12')](_0x316246));_0x213ff9(_0x316246);})[_0x78a4('0x21')](function(_0x46466c){logger[_0x78a4('0x13')](_0x78a4('0x17'),_0x46466c[_0x78a4('0x15')],_0x16bd28);_0x1c7d3e(_0x2b3aa8[_0x78a4('0x13')](0x1f4,_0x46466c[_0x78a4('0x15')]));});});};exports[_0x78a4('0x22')]=function(_0x46018a){var _0x51b062=this;return new Promise(function(_0x4ef503,_0x420070){return db[_0x78a4('0x18')][_0x78a4('0x23')]({'raw':_0x46018a['options']?_0x46018a['options'][_0x78a4('0x1b')]===undefined?!![]:![]:!![],'where':_0x46018a[_0x78a4('0x1a')]?_0x46018a['options'][_0x78a4('0x1c')]||null:null,'attributes':_0x46018a['options']?_0x46018a[_0x78a4('0x1a')]['attributes']||null:null,'include':_0x46018a[_0x78a4('0x1a')]?_0x46018a[_0x78a4('0x1a')]['include']?_[_0x78a4('0x1f')](_0x46018a['options'][_0x78a4('0x1e')],function(_0x1ab38f){return{'model':db[_0x1ab38f[_0x78a4('0x20')]],'as':_0x1ab38f['as'],'attributes':_0x1ab38f[_0x78a4('0x1d')],'include':_0x1ab38f[_0x78a4('0x1e')]?_['map'](_0x1ab38f[_0x78a4('0x1e')],function(_0x536d7c){return{'model':db[_0x536d7c[_0x78a4('0x20')]],'as':_0x536d7c['as'],'attributes':_0x536d7c['attributes'],'include':_0x536d7c[_0x78a4('0x1e')]?_['map'](_0x536d7c[_0x78a4('0x1e')],function(_0x329e1b){return{'model':db[_0x329e1b[_0x78a4('0x20')]],'as':_0x329e1b['as'],'attributes':_0x329e1b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x471562){logger['info'](_0x78a4('0x22'),_0x46018a);logger[_0x78a4('0x10')]('ShowTrunk',_0x46018a,JSON[_0x78a4('0x12')](_0x471562));_0x4ef503(_0x471562);})['catch'](function(_0x35cc25){logger[_0x78a4('0x13')]('ShowTrunk',_0x35cc25[_0x78a4('0x15')],_0x46018a);_0x420070(_0x51b062['error'](0x1f4,_0x35cc25['message']));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 5663494..42fe028 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 _0xcf9e=['format','%s-%s','now','originalname','/:id/avatar','addAvatar','/:id/login','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/teams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addOpenchannelAccounts','/:id/chat_websites','addWhatsappAccounts','/:id/square_projects','addSquareProjects','createApiKey','put','removeQueues','delete','removeTeams','removeChatInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','/:id/sms_accounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','/:id','show','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getSquareProjects','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','root','server/files/images/'];(function(_0x1ddd0,_0x15f9f4){var _0x4d86d0=function(_0x3173d7){while(--_0x3173d7){_0x1ddd0['push'](_0x1ddd0['shift']());}};_0x4d86d0(++_0x15f9f4);}(_0xcf9e,0x1a6));var _0xecf9=function(_0x46cfaf,_0x226a65){_0x46cfaf=_0x46cfaf-0x0;var _0x2671ba=_0xcf9e[_0x46cfaf];return _0x2671ba;};'use strict';var multer=require(_0xecf9('0x0'));var util=require(_0xecf9('0x1'));var path=require('path');var timeout=require(_0xecf9('0x2'));var express=require(_0xecf9('0x3'));var router=express[_0xecf9('0x4')]();var fs_extra=require(_0xecf9('0x5'));var auth=require(_0xecf9('0x6'));var interaction=require(_0xecf9('0x7'));var config=require(_0xecf9('0x8'));var controller=require(_0xecf9('0x9'));router[_0xecf9('0xa')]('/',auth[_0xecf9('0xb')](),controller[_0xecf9('0xc')]);router['get'](_0xecf9('0xd'),auth['isAuthenticated'](),controller[_0xecf9('0xe')]);router['get'](_0xecf9('0xf'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x10')]);router[_0xecf9('0xa')](_0xecf9('0x11'),auth[_0xecf9('0xb')](),controller['getPresence']);router[_0xecf9('0xa')](_0xecf9('0x12'),auth['isAuthenticated'](),controller[_0xecf9('0x13')]);router[_0xecf9('0xa')]('/:id/avatar',controller[_0xecf9('0x14')]);router[_0xecf9('0xa')](_0xecf9('0x15'),auth['isAuthenticated'](),controller[_0xecf9('0x16')]);router[_0xecf9('0xa')](_0xecf9('0x17'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x18')]);router['get'](_0xecf9('0x19'),auth['isAuthenticated'](),controller[_0xecf9('0x1a')]);router[_0xecf9('0xa')](_0xecf9('0x1b'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x1c')]);router[_0xecf9('0xa')](_0xecf9('0x1d'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x1e')]);router[_0xecf9('0xa')](_0xecf9('0x1f'),auth['isAuthenticated'](),controller[_0xecf9('0x20')]);router['get'](_0xecf9('0x21'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x22')]);router['get'](_0xecf9('0x23'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x24')]);router[_0xecf9('0xa')](_0xecf9('0x25'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x26')]);router[_0xecf9('0xa')]('/:id/mail/interactions',auth[_0xecf9('0xb')](),controller[_0xecf9('0x27')]);router[_0xecf9('0xa')](_0xecf9('0x28'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x29')]);router['get']('/:id/fax/interactions',auth[_0xecf9('0xb')](),controller[_0xecf9('0x2a')]);router[_0xecf9('0xa')](_0xecf9('0x2b'),auth['isAuthenticated'](),controller[_0xecf9('0x2c')]);router[_0xecf9('0xa')]('/:id/teams',auth['isAuthenticated'](),controller[_0xecf9('0x2d')]);router[_0xecf9('0xa')](_0xecf9('0x2e'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x2f')]);router['get'](_0xecf9('0x30'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x31')]);router['get'](_0xecf9('0x32'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x33')]);router[_0xecf9('0xa')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xecf9('0x34')]);router[_0xecf9('0xa')](_0xecf9('0x35'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x36')]);router[_0xecf9('0xa')](_0xecf9('0x37'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x38')]);router['get']('/:id/sms_accounts',auth[_0xecf9('0xb')](),controller[_0xecf9('0x39')]);router['get']('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xecf9('0x3a')]);router[_0xecf9('0xa')](_0xecf9('0x3b'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x3c')]);router[_0xecf9('0xa')]('/:id/square_projects',auth[_0xecf9('0xb')](),controller[_0xecf9('0x3d')]);router[_0xecf9('0xa')]('/:id/scheduled_calls',auth[_0xecf9('0xb')](),controller[_0xecf9('0x3e')]);router[_0xecf9('0xa')](_0xecf9('0x3f'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x40')]);router[_0xecf9('0x41')](_0xecf9('0x17'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x42')]);router['post']('/',auth[_0xecf9('0xb')](),controller[_0xecf9('0x43')]);router[_0xecf9('0x41')](_0xecf9('0x44'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x45')]);router[_0xecf9('0x41')](_0xecf9('0x19'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x46')]);var upload=multer({'storage':multer[_0xecf9('0x47')]({'destination':function(_0x5ebc87,_0x3e870a,_0x30621d){_0x30621d(null,path['join'](config[_0xecf9('0x48')],_0xecf9('0x49')));},'filename':function(_0x3e2ea2,_0x11dcdc,_0x45caf6){_0x45caf6(null,util[_0xecf9('0x4a')](_0xecf9('0x4b'),Date[_0xecf9('0x4c')](),_0x11dcdc[_0xecf9('0x4d')]));}})});router[_0xecf9('0x41')](_0xecf9('0x4e'),upload['single']('file'),controller[_0xecf9('0x4f')]);router['post'](_0xecf9('0x50'),auth['isAuthenticated'](),controller['login']);router[_0xecf9('0x41')]('/:id/logout',auth['isAuthenticated'](),controller[_0xecf9('0x51')]);router[_0xecf9('0x41')](_0xecf9('0x52'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x53')]);router[_0xecf9('0x41')](_0xecf9('0x54'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x55')]);router[_0xecf9('0x41')](_0xecf9('0x56'),auth['isAuthenticated'](),controller['addTeams']);router[_0xecf9('0x41')](_0xecf9('0x57'),auth['isAuthenticated'](),controller[_0xecf9('0x58')]);router[_0xecf9('0x41')](_0xecf9('0x59'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x5a')]);router[_0xecf9('0x41')]('/:id/fax_interactions',auth[_0xecf9('0xb')](),controller[_0xecf9('0x5b')]);router[_0xecf9('0x41')](_0xecf9('0x5c'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x5d')]);router['post'](_0xecf9('0x5e'),auth['isAuthenticated'](),controller[_0xecf9('0x5f')]);router[_0xecf9('0x41')](_0xecf9('0x60'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x61')]);router['post'](_0xecf9('0x62'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x63')]);router[_0xecf9('0x41')](_0xecf9('0x35'),auth[_0xecf9('0xb')](),controller['addMailAccounts']);router[_0xecf9('0x41')](_0xecf9('0x37'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x64')]);router[_0xecf9('0x41')]('/:id/sms_accounts',auth[_0xecf9('0xb')](),controller['addSmsAccounts']);router['post'](_0xecf9('0x65'),auth[_0xecf9('0xb')](),controller['addChatWebsites']);router[_0xecf9('0x41')](_0xecf9('0x3b'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x66')]);router[_0xecf9('0x41')](_0xecf9('0x67'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x68')]);router[_0xecf9('0x41')](_0xecf9('0x3f'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x69')]);router[_0xecf9('0x6a')](_0xecf9('0x12'),auth[_0xecf9('0xb')](),controller['update']);router[_0xecf9('0x6a')]('/:id/password',auth[_0xecf9('0xb')](),controller['changePassword']);router['delete']('/:id/queues',auth[_0xecf9('0xb')](),controller[_0xecf9('0x6b')]);router[_0xecf9('0x6c')](_0xecf9('0x56'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x6d')]);router[_0xecf9('0x6c')](_0xecf9('0x12'),auth[_0xecf9('0xb')](),controller['destroy']);router[_0xecf9('0x6c')](_0xecf9('0x57'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x6e')]);router[_0xecf9('0x6c')]('/:id/mail_interactions',auth[_0xecf9('0xb')](),controller['removeMailInteractions']);router[_0xecf9('0x6c')](_0xecf9('0x6f'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x70')]);router[_0xecf9('0x6c')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0xecf9('0x71')]);router[_0xecf9('0x6c')](_0xecf9('0x5e'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x72')]);router[_0xecf9('0x6c')](_0xecf9('0x60'),auth[_0xecf9('0xb')](),controller['removeWhatsappInteractions']);router[_0xecf9('0x6c')]('/:id/fax_accounts',auth[_0xecf9('0xb')](),controller[_0xecf9('0x73')]);router['delete'](_0xecf9('0x35'),auth['isAuthenticated'](),controller[_0xecf9('0x74')]);router[_0xecf9('0x6c')]('/:id/openchannel_accounts',auth[_0xecf9('0xb')](),controller[_0xecf9('0x75')]);router[_0xecf9('0x6c')](_0xecf9('0x76'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x77')]);router[_0xecf9('0x6c')]('/:id/chat_websites',auth[_0xecf9('0xb')](),controller[_0xecf9('0x78')]);router[_0xecf9('0x6c')](_0xecf9('0x3b'),auth['isAuthenticated'](),controller[_0xecf9('0x79')]);router[_0xecf9('0x6c')]('/:id/square_projects',auth[_0xecf9('0xb')](),controller['removeSquareProjects']);router['delete'](_0xecf9('0x3f'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x7a')]);module[_0xecf9('0x7b')]=router; \ No newline at end of file +var _0xc60d=['/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','put','/:id','update','/:id/password','delete','removeQueues','destroy','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','describe','/whoami','whoami','/presence','show','/:id/avatar','/:id/open_tabs','getOpenTabs','getContacts','/:id/queues','/:id/queues_rt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','/:id/fax_accounts','getFaxAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','addQueues','join','server/files/images/','%s-%s','now','originalname','file','addAvatar','/:id/login','login','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions'];(function(_0x1feb6a,_0x17d3f6){var _0x4fb30b=function(_0x13936f){while(--_0x13936f){_0x1feb6a['push'](_0x1feb6a['shift']());}};_0x4fb30b(++_0x17d3f6);}(_0xc60d,0x95));var _0xdc60=function(_0x4fe19c,_0x45d0fe){_0x4fe19c=_0x4fe19c-0x0;var _0x952ac7=_0xc60d[_0x4fe19c];return _0x952ac7;};'use strict';var multer=require('multer');var util=require(_0xdc60('0x0'));var path=require('path');var timeout=require(_0xdc60('0x1'));var express=require(_0xdc60('0x2'));var router=express[_0xdc60('0x3')]();var fs_extra=require(_0xdc60('0x4'));var auth=require(_0xdc60('0x5'));var interaction=require(_0xdc60('0x6'));var config=require(_0xdc60('0x7'));var controller=require(_0xdc60('0x8'));router[_0xdc60('0x9')]('/',auth[_0xdc60('0xa')](),controller['index']);router[_0xdc60('0x9')](_0xdc60('0xb'),auth[_0xdc60('0xa')](),controller[_0xdc60('0xc')]);router[_0xdc60('0x9')](_0xdc60('0xd'),auth[_0xdc60('0xa')](),controller[_0xdc60('0xe')]);router['get'](_0xdc60('0xf'),auth['isAuthenticated'](),controller['getPresence']);router['get']('/:id',auth[_0xdc60('0xa')](),controller[_0xdc60('0x10')]);router['get'](_0xdc60('0x11'),controller['getAvatar']);router[_0xdc60('0x9')](_0xdc60('0x12'),auth[_0xdc60('0xa')](),controller[_0xdc60('0x13')]);router[_0xdc60('0x9')]('/:id/contacts',auth[_0xdc60('0xa')](),controller[_0xdc60('0x14')]);router[_0xdc60('0x9')](_0xdc60('0x15'),auth[_0xdc60('0xa')](),controller['getQueues']);router[_0xdc60('0x9')](_0xdc60('0x16'),auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router[_0xdc60('0x9')]('/:id/groups',auth[_0xdc60('0xa')](),controller[_0xdc60('0x17')]);router['get'](_0xdc60('0x18'),auth[_0xdc60('0xa')](),controller[_0xdc60('0x19')]);router['get'](_0xdc60('0x1a'),auth['isAuthenticated'](),controller[_0xdc60('0x1b')]);router[_0xdc60('0x9')](_0xdc60('0x1c'),auth[_0xdc60('0xa')](),controller['getChatInteractions']);router[_0xdc60('0x9')](_0xdc60('0x1d'),auth[_0xdc60('0xa')](),controller[_0xdc60('0x1e')]);router[_0xdc60('0x9')](_0xdc60('0x1f'),auth[_0xdc60('0xa')](),controller[_0xdc60('0x20')]);router[_0xdc60('0x9')](_0xdc60('0x21'),auth[_0xdc60('0xa')](),controller['getSmsInteractions']);router['get']('/:id/fax/interactions',auth[_0xdc60('0xa')](),controller[_0xdc60('0x22')]);router['get'](_0xdc60('0x23'),auth[_0xdc60('0xa')](),controller[_0xdc60('0x24')]);router[_0xdc60('0x9')](_0xdc60('0x25'),auth[_0xdc60('0xa')](),controller[_0xdc60('0x26')]);router['get'](_0xdc60('0x27'),auth[_0xdc60('0xa')](),controller[_0xdc60('0x28')]);router[_0xdc60('0x9')]('/:id/agents',auth[_0xdc60('0xa')](),controller[_0xdc60('0x29')]);router[_0xdc60('0x9')]('/:id/prefixes',auth[_0xdc60('0xa')](),controller['getVoicePrefixes']);router[_0xdc60('0x9')](_0xdc60('0x2a'),auth['isAuthenticated'](),controller[_0xdc60('0x2b')]);router['get']('/:id/mail_accounts',auth[_0xdc60('0xa')](),controller['getMailAccounts']);router['get'](_0xdc60('0x2c'),auth['isAuthenticated'](),controller[_0xdc60('0x2d')]);router[_0xdc60('0x9')](_0xdc60('0x2e'),auth['isAuthenticated'](),controller[_0xdc60('0x2f')]);router['get']('/:id/chat_websites',auth[_0xdc60('0xa')](),controller[_0xdc60('0x30')]);router[_0xdc60('0x9')](_0xdc60('0x31'),auth[_0xdc60('0xa')](),controller['getWhatsappAccounts']);router['get'](_0xdc60('0x32'),auth[_0xdc60('0xa')](),controller[_0xdc60('0x33')]);router['get'](_0xdc60('0x34'),auth[_0xdc60('0xa')](),controller['getScheduledCalls']);router['get'](_0xdc60('0x35'),auth[_0xdc60('0xa')](),controller[_0xdc60('0x36')]);router[_0xdc60('0x37')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xdc60('0x38')]);router[_0xdc60('0x37')]('/',auth[_0xdc60('0xa')](),controller[_0xdc60('0x39')]);router[_0xdc60('0x37')](_0xdc60('0x3a'),auth[_0xdc60('0xa')](),controller[_0xdc60('0x3b')]);router[_0xdc60('0x37')](_0xdc60('0x15'),auth[_0xdc60('0xa')](),controller[_0xdc60('0x3c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x328c42,_0x9c93b9,_0x2158e0){_0x2158e0(null,path[_0xdc60('0x3d')](config['root'],_0xdc60('0x3e')));},'filename':function(_0x22a3a9,_0x58538c,_0xf46ce){_0xf46ce(null,util['format'](_0xdc60('0x3f'),Date[_0xdc60('0x40')](),_0x58538c[_0xdc60('0x41')]));}})});router['post'](_0xdc60('0x11'),upload['single'](_0xdc60('0x42')),controller[_0xdc60('0x43')]);router[_0xdc60('0x37')](_0xdc60('0x44'),auth[_0xdc60('0xa')](),controller[_0xdc60('0x45')]);router[_0xdc60('0x37')]('/:id/logout',auth[_0xdc60('0xa')](),controller['logout']);router[_0xdc60('0x37')](_0xdc60('0x46'),auth[_0xdc60('0xa')](),controller[_0xdc60('0x47')]);router[_0xdc60('0x37')](_0xdc60('0x48'),auth[_0xdc60('0xa')](),controller[_0xdc60('0x49')]);router['post'](_0xdc60('0x25'),auth[_0xdc60('0xa')](),controller[_0xdc60('0x4a')]);router['post'](_0xdc60('0x4b'),auth[_0xdc60('0xa')](),controller[_0xdc60('0x4c')]);router['post'](_0xdc60('0x4d'),auth[_0xdc60('0xa')](),controller[_0xdc60('0x4e')]);router[_0xdc60('0x37')](_0xdc60('0x4f'),auth[_0xdc60('0xa')](),controller[_0xdc60('0x50')]);router[_0xdc60('0x37')](_0xdc60('0x51'),auth[_0xdc60('0xa')](),controller['addSmsInteractions']);router[_0xdc60('0x37')](_0xdc60('0x52'),auth['isAuthenticated'](),controller[_0xdc60('0x53')]);router[_0xdc60('0x37')](_0xdc60('0x54'),auth[_0xdc60('0xa')](),controller[_0xdc60('0x55')]);router['post']('/:id/fax_accounts',auth[_0xdc60('0xa')](),controller[_0xdc60('0x56')]);router[_0xdc60('0x37')](_0xdc60('0x57'),auth[_0xdc60('0xa')](),controller[_0xdc60('0x58')]);router[_0xdc60('0x37')](_0xdc60('0x2c'),auth[_0xdc60('0xa')](),controller[_0xdc60('0x59')]);router[_0xdc60('0x37')]('/:id/sms_accounts',auth[_0xdc60('0xa')](),controller['addSmsAccounts']);router[_0xdc60('0x37')](_0xdc60('0x5a'),auth[_0xdc60('0xa')](),controller[_0xdc60('0x5b')]);router[_0xdc60('0x37')](_0xdc60('0x31'),auth['isAuthenticated'](),controller[_0xdc60('0x5c')]);router['post']('/:id/square_projects',auth[_0xdc60('0xa')](),controller[_0xdc60('0x5d')]);router[_0xdc60('0x37')](_0xdc60('0x35'),auth['isAuthenticated'](),controller[_0xdc60('0x5e')]);router[_0xdc60('0x5f')](_0xdc60('0x60'),auth[_0xdc60('0xa')](),controller[_0xdc60('0x61')]);router[_0xdc60('0x5f')](_0xdc60('0x62'),auth[_0xdc60('0xa')](),controller['changePassword']);router[_0xdc60('0x63')]('/:id/queues',auth[_0xdc60('0xa')](),controller[_0xdc60('0x64')]);router[_0xdc60('0x63')](_0xdc60('0x25'),auth[_0xdc60('0xa')](),controller['removeTeams']);router[_0xdc60('0x63')](_0xdc60('0x60'),auth[_0xdc60('0xa')](),controller[_0xdc60('0x65')]);router[_0xdc60('0x63')](_0xdc60('0x4b'),auth[_0xdc60('0xa')](),controller['removeChatInteractions']);router[_0xdc60('0x63')](_0xdc60('0x4d'),auth['isAuthenticated'](),controller[_0xdc60('0x66')]);router[_0xdc60('0x63')](_0xdc60('0x4f'),auth[_0xdc60('0xa')](),controller[_0xdc60('0x67')]);router['delete'](_0xdc60('0x51'),auth[_0xdc60('0xa')](),controller[_0xdc60('0x68')]);router['delete'](_0xdc60('0x52'),auth[_0xdc60('0xa')](),controller[_0xdc60('0x69')]);router[_0xdc60('0x63')](_0xdc60('0x54'),auth[_0xdc60('0xa')](),controller['removeWhatsappInteractions']);router[_0xdc60('0x63')](_0xdc60('0x2a'),auth[_0xdc60('0xa')](),controller[_0xdc60('0x6a')]);router[_0xdc60('0x63')](_0xdc60('0x57'),auth[_0xdc60('0xa')](),controller['removeMailAccounts']);router[_0xdc60('0x63')](_0xdc60('0x2c'),auth['isAuthenticated'](),controller[_0xdc60('0x6b')]);router['delete'](_0xdc60('0x2e'),auth['isAuthenticated'](),controller[_0xdc60('0x6c')]);router[_0xdc60('0x63')]('/:id/chat_websites',auth['isAuthenticated'](),controller['removeChatWebsites']);router[_0xdc60('0x63')](_0xdc60('0x31'),auth['isAuthenticated'](),controller[_0xdc60('0x6d')]);router['delete']('/:id/square_projects',auth[_0xdc60('0xa')](),controller[_0xdc60('0x6e')]);router[_0xdc60('0x63')]('/:id/api_key',auth[_0xdc60('0xa')](),controller[_0xdc60('0x6f')]);module[_0xdc60('0x70')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index fa48a1b..404c4c3 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 _0x55c1=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','refuse','uas','fingerprint','certificate','active','passive','update,nonat','TEXT','get','udp','encryption','avpf','force_avp','icesupport','dtlsenable','dtlssetup','dtlsprivatekey','dtlsverify','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','getDataValue','internal','toLowerCase','ENUM','user','agent','local','callerid','\x22%s\x22\x20<%s>','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','transport','join','split'];(function(_0x2d93be,_0x730aea){var _0x23ee45=function(_0x4f399f){while(--_0x4f399f){_0x2d93be['push'](_0x2d93be['shift']());}};_0x23ee45(++_0x730aea);}(_0x55c1,0x1e5));var _0x155c=function(_0x3ff78f,_0x4bfafd){_0x3ff78f=_0x3ff78f-0x0;var _0x5abe3c=_0x55c1[_0x3ff78f];return _0x5abe3c;};'use strict';var Sequelize=require(_0x155c('0x0'));var moment=require(_0x155c('0x1'));var util=require('util');var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x155c('0x2')],'allowNull':![],'unique':_0x155c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x30444a){this[_0x155c('0x4')](_0x155c('0x3'),_0x30444a);this['setDataValue'](_0x155c('0x5'),_0x30444a);},'comment':_0x155c('0x6')},'fullname':{'type':Sequelize[_0x155c('0x2')],'allowNull':![],'set':function(_0x4df902){this[_0x155c('0x4')](_0x155c('0x7'),_0x4df902);this[_0x155c('0x4')]('callerid',util['format']('\x22%s\x22\x20<%s>',_0x4df902,this[_0x155c('0x8')](_0x155c('0x9'))));}},'alias':{'type':Sequelize[_0x155c('0x2')]},'email':{'type':Sequelize[_0x155c('0x2')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x228de5){if(_0x228de5){this[_0x155c('0x4')]('email',_0x228de5[_0x155c('0xa')]());}}},'role':{'type':Sequelize[_0x155c('0xb')]('admin',_0x155c('0xc'),_0x155c('0xd'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x155c('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x155c('0x2')],'defaultValue':_0x155c('0xe')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x155c('0x9'),'set':function(_0x37903b){this[_0x155c('0x4')](_0x155c('0x9'),_0x37903b);this[_0x155c('0x4')]('accountcode',_0x37903b);this[_0x155c('0x4')](_0x155c('0xf'),util['format'](_0x155c('0x10'),this['getDataValue'](_0x155c('0x7')),_0x37903b));}},'salt':{'type':Sequelize[_0x155c('0x2')]},'phone':{'type':Sequelize[_0x155c('0x2')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x155c('0x2')]},'zipcode':{'type':Sequelize[_0x155c('0x2')]},'userpic':{'type':Sequelize[_0x155c('0x2')]},'city':{'type':Sequelize[_0x155c('0x2')]},'country':{'type':Sequelize[_0x155c('0x2')]},'online':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x155c('0x12')]},'voicePause':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x155c('0x2')],'defaultValue':_0x155c('0x13')},'lastPauseAt':{'type':Sequelize[_0x155c('0x12')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x155c('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x155c('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x155c('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x155c('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x155c('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x155c('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x155c('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'description':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'host':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![],'defaultValue':_0x155c('0x15')},'ipaddr':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'port':{'type':Sequelize[_0x155c('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x155c('0x16'),'user','peer'),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x155c('0x17')},'callingpres':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x18'),'ALLOWED_PASSED_SCREEN',_0x155c('0x19'),_0x155c('0x1a'),_0x155c('0x1b'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'permit':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'transport':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![],'defaultValue':'udp','set':function(_0x2a84e7){this['setDataValue'](_0x155c('0x1c'),_0x2a84e7?_0x2a84e7[_0x155c('0x1d')](','):null);},'get':function(){return this['getDataValue'](_0x155c('0x1c'))?this[_0x155c('0x8')]('transport')[_0x155c('0x1e')](','):null;},'comment':_0x155c('0x1f')},'dtmfmode':{'type':Sequelize['ENUM'](_0x155c('0x20'),_0x155c('0x21'),_0x155c('0x22'),_0x155c('0x23'),_0x155c('0x24')),'allowNull':!![],'defaultValue':_0x155c('0x20')},'directmedia':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no',_0x155c('0x26'),_0x155c('0x27'),_0x155c('0x28')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x155c('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x155c('0x29'),'set':function(_0x2b9482){this['setDataValue']('nat',_0x2b9482?_0x2b9482[_0x155c('0x1d')](','):null);},'get':function(){return this[_0x155c('0x8')](_0x155c('0x2a'))?this['getDataValue'](_0x155c('0x2a'))[_0x155c('0x1e')](','):null;},'comment':_0x155c('0x2b')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x155c('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x155c('0x2')]},'language':{'type':Sequelize[_0x155c('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x155c('0x2')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x155c('0x2')],'allowNull':![],'defaultValue':_0x155c('0x2c'),'set':function(_0x22fe10){this['setDataValue'](_0x155c('0x2d'),_0x22fe10?_0x22fe10[_0x155c('0x1d')](';'):_0x155c('0x2c'));},'get':function(){return this[_0x155c('0x8')](_0x155c('0x2d'))?this['getDataValue']('allow')[_0x155c('0x1e')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x155c('0xb')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x3848e1){this[_0x155c('0x4')](_0x155c('0x2e'),_0x3848e1?_0x3848e1[_0x155c('0x1d')](','):null);},'get':function(){return this[_0x155c('0x8')]('insecure')?this[_0x155c('0x8')](_0x155c('0x2e'))[_0x155c('0x1e')](','):null;},'comment':_0x155c('0x2f')},'trustrpid':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no',_0x155c('0x30')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x155c('0x25'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x155c('0xb')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![],'defaultValue':_0x155c('0x31')},'amaflags':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no'),'allowNull':!![],'defaultValue':_0x155c('0x25')},'busylevel':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x155c('0xb')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no',_0x155c('0x32')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x155c('0x25'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM']('accept',_0x155c('0x33'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x155c('0xb')]('uac','uas'),'allowNull':!![],'defaultValue':_0x155c('0x34')},'t38pt_usertpsource':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no'),'allowNull':!![],'defaultValue':_0x155c('0x25')},'keepalive':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x155c('0x25'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x155c('0xb')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x155c('0x25'),'no',_0x155c('0x35'),_0x155c('0x36')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x37'),_0x155c('0x38'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x155c('0x25'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x155c('0xb')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x155c('0xb')]('yes','no','nonat',_0x155c('0x27'),_0x155c('0x39')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x155c('0x12')]},'passwordResetAt':{'type':Sequelize[_0x155c('0x12')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x155c('0x3a')]},'showWebBar':{'type':Sequelize[_0x155c('0x14')],'defaultValue':0x0,'set':function(_0x3476b9){this[_0x155c('0x4')]('showWebBar',_0x3476b9);var _0x582220=this[_0x155c('0x3b')]({'plain':!![]});switch(_0x3476b9){case 0x0:case 0x1:var _0x165e9=_0x582220[_0x155c('0x1c')]?_['isArray'](_0x582220[_0x155c('0x1c')])?_0x582220[_0x155c('0x1c')][_0x155c('0x1d')]():_0x582220[_0x155c('0x1c')]:_0x155c('0x3c');if(_0x165e9==='wss'){_0x165e9=_0x155c('0x3c');}this[_0x155c('0x4')](_0x155c('0x1c'),_0x165e9);this[_0x155c('0x4')](_0x155c('0x3d'),'no');this['setDataValue'](_0x155c('0x3e'),null);this[_0x155c('0x4')](_0x155c('0x3f'),null);this['setDataValue'](_0x155c('0x40'),null);this['setDataValue'](_0x155c('0x41'),null);this[_0x155c('0x4')]('dtlsverify',null);this[_0x155c('0x4')](_0x155c('0x42'),null);this[_0x155c('0x4')]('dtlscertfile',null);this[_0x155c('0x4')](_0x155c('0x43'),null);this[_0x155c('0x4')]('rtcp_mux','no');break;case 0x2:this[_0x155c('0x4')](_0x155c('0x1c'),'wss');this[_0x155c('0x4')]('encryption',_0x155c('0x25'));this[_0x155c('0x4')](_0x155c('0x3e'),_0x155c('0x25'));this[_0x155c('0x4')]('force_avp',_0x155c('0x25'));this[_0x155c('0x4')]('icesupport',_0x155c('0x25'));this[_0x155c('0x4')](_0x155c('0x41'),_0x155c('0x25'));this['setDataValue'](_0x155c('0x44'),'no');this[_0x155c('0x4')]('dtlssetup',_0x155c('0x45'));this[_0x155c('0x4')](_0x155c('0x46'),_0x582220[_0x155c('0x46')]||_0x155c('0x47'));this[_0x155c('0x4')](_0x155c('0x43'),_0x582220['dtlsprivatekey']||_0x155c('0x48'));this[_0x155c('0x4')](_0x155c('0x49'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x31ca0f){this[_0x155c('0x4')](_0x155c('0x4a'),_0x31ca0f?_0x31ca0f['join'](','):[]);},'get':function(){return this['getDataValue'](_0x155c('0x4a'))?_[_0x155c('0x4b')](this['getDataValue'](_0x155c('0x4a'))[_0x155c('0x1e')](','),function(_0x690148){return parseInt(_0x690148,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x155c('0x2')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x155c('0x2')]},'phoneBarBusyNumber':{'type':Sequelize[_0x155c('0x2')]},'phoneBarUnconditional':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x155c('0x11')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x155c('0x2')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x155c('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x155c('0x25'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x155c('0x11')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x155c('0x4c')],'get':function(){return this[_0x155c('0x8')](_0x155c('0x4d'))?this[_0x155c('0x8')](_0x155c('0x4d')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![],'set':function(_0x15f172){if(typeof _0x15f172===_0x155c('0x4e')){var _0xb22afe=_0x15f172==='1'?!![]:_0x15f172==='0'?![]:_0x15f172===_0x155c('0x4f')?!![]:_0x15f172===_0x155c('0x50')?![]:![];this['setDataValue'](_0x155c('0x51'),_0xb22afe);}else{this['setDataValue'](_0x155c('0x51'),_0x15f172);}}},'blocked':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![],'set':function(_0x1faa6e){this[_0x155c('0x4')](_0x155c('0x52'),_0x1faa6e);if(_0x1faa6e===!![]){this[_0x155c('0x4')](_0x155c('0x53'),moment());this[_0x155c('0x4')](_0x155c('0x54'),0x0);}else{this['setDataValue'](_0x155c('0x53'),null);}}},'blockedAt':{'type':Sequelize[_0x155c('0x12')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x155c('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x155c('0x11')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x155c('0x14')](0x5)[_0x155c('0x55')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x155c('0x11')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x155c('0x11')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x155c('0x11')],'defaultValue':!![]}}; \ No newline at end of file +var _0x553a=['info','shortinfo','inband','auto','rfc2833','update','yes','force_rport,comedia','nat','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]','always','accept','refuse','originate','uac','uas','fingerprint','certificate','actpass','nonat','isArray','udp','wss','encryption','avpf','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','moment','lodash','exports','STRING','setDataValue','defaultuser','fullname','callerid','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','admin','user','agent','local','format','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'];(function(_0x8a23cc,_0x206133){var _0x2c15b4=function(_0x29c988){while(--_0x29c988){_0x8a23cc['push'](_0x8a23cc['shift']());}};_0x2c15b4(++_0x206133);}(_0x553a,0x192));var _0xa553=function(_0x560623,_0x5c748a){_0x560623=_0x560623-0x0;var _0x2a9089=_0x553a[_0x560623];return _0x2a9089;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa553('0x0'));var util=require('util');var _=require(_0xa553('0x1'));module[_0xa553('0x2')]={'name':{'type':Sequelize[_0xa553('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4d5106){this[_0xa553('0x4')]('name',_0x4d5106);this['setDataValue'](_0xa553('0x5'),_0x4d5106);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x18da5d){this[_0xa553('0x4')](_0xa553('0x6'),_0x18da5d);this['setDataValue'](_0xa553('0x7'),util['format'](_0xa553('0x8'),_0x18da5d,this[_0xa553('0x9')](_0xa553('0xa'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa553('0xb'),'validate':{'isEmail':!![]},'set':function(_0x58c170){if(_0x58c170){this[_0xa553('0x4')](_0xa553('0xb'),_0x58c170[_0xa553('0xc')]());}}},'role':{'type':Sequelize['ENUM'](_0xa553('0xd'),_0xa553('0xe'),_0xa553('0xf'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0xa553('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xa553('0x3')],'defaultValue':_0xa553('0x10')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':'internal','set':function(_0x15b224){this[_0xa553('0x4')](_0xa553('0xa'),_0x15b224);this[_0xa553('0x4')]('accountcode',_0x15b224);this[_0xa553('0x4')]('callerid',util[_0xa553('0x11')]('\x22%s\x22\x20<%s>',this['getDataValue'](_0xa553('0x6')),_0x15b224));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xa553('0x3')]},'mobile':{'type':Sequelize[_0xa553('0x3')]},'address':{'type':Sequelize[_0xa553('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xa553('0x3')]},'city':{'type':Sequelize[_0xa553('0x3')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xa553('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xa553('0x13')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xa553('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xa553('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xa553('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xa553('0x12')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xa553('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0xa553('0x14')},'lastPauseAt':{'type':Sequelize[_0xa553('0x13')]},'chatCapacity':{'type':Sequelize[_0xa553('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xa553('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xa553('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xa553('0x12')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xa553('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xa553('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xa553('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xa553('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xa553('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xa553('0x12')],'defaultValue':![]},'description':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![],'defaultValue':_0xa553('0x16')},'ipaddr':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0xa553('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xa553('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xa553('0x17')](_0xa553('0x18'),_0xa553('0xe'),_0xa553('0x19')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![],'defaultValue':_0xa553('0x1a')},'callingpres':{'type':Sequelize[_0xa553('0x17')](_0xa553('0x1b'),_0xa553('0x1c'),_0xa553('0x1d'),_0xa553('0x1e'),_0xa553('0x1f'),_0xa553('0x20'),_0xa553('0x21'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x20830f){this[_0xa553('0x4')](_0xa553('0x22'),_0x20830f?_0x20830f[_0xa553('0x23')](','):null);},'get':function(){return this[_0xa553('0x9')]('transport')?this[_0xa553('0x9')]('transport')[_0xa553('0x24')](','):null;},'comment':_0xa553('0x25')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0xa553('0x26'),_0xa553('0x27'),_0xa553('0x28'),_0xa553('0x29')),'allowNull':!![],'defaultValue':_0xa553('0x2a')},'directmedia':{'type':Sequelize[_0xa553('0x17')]('yes','no','nonat',_0xa553('0x2b'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xa553('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![],'defaultValue':_0xa553('0x2d'),'set':function(_0x1728b0){this[_0xa553('0x4')](_0xa553('0x2e'),_0x1728b0?_0x1728b0[_0xa553('0x23')](','):null);},'get':function(){return this[_0xa553('0x9')](_0xa553('0x2e'))?this[_0xa553('0x9')](_0xa553('0x2e'))[_0xa553('0x24')](','):null;},'comment':_0xa553('0x2f')},'callgroup':{'type':Sequelize[_0xa553('0x3')]},'namedcallgroup':{'type':Sequelize[_0xa553('0x3')]},'pickupgroup':{'type':Sequelize[_0xa553('0x3')]},'namedpickupgroup':{'type':Sequelize[_0xa553('0x3')]},'language':{'type':Sequelize[_0xa553('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xa553('0x3')]},'disallow':{'type':Sequelize[_0xa553('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0xa553('0x3')],'allowNull':![],'defaultValue':_0xa553('0x30'),'set':function(_0x222d8e){this[_0xa553('0x4')](_0xa553('0x31'),_0x222d8e?_0x222d8e[_0xa553('0x23')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xa553('0x9')]('allow')?this[_0xa553('0x9')](_0xa553('0x31'))[_0xa553('0x24')](';'):null;},'comment':_0xa553('0x32')},'autoframing':{'type':Sequelize[_0xa553('0x17')](_0xa553('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![],'set':function(_0xfbccf4){this[_0xa553('0x4')](_0xa553('0x33'),_0xfbccf4?_0xfbccf4[_0xa553('0x23')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0xa553('0x9')]('insecure')[_0xa553('0x24')](','):null;},'comment':_0xa553('0x34')},'trustrpid':{'type':Sequelize['ENUM'](_0xa553('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xa553('0x17')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xa553('0x17')](_0xa553('0x2c'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xa553('0x17')](_0xa553('0x2c'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xa553('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xa553('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xa553('0x17')](_0xa553('0x2c'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xa553('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xa553('0x17')](_0xa553('0x2c'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xa553('0x17')](_0xa553('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xa553('0x17')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xa553('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xa553('0x17')](_0xa553('0x2c'),'no',_0xa553('0x35')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa553('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xa553('0x17')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xa553('0x17')](_0xa553('0x36'),_0xa553('0x37'),_0xa553('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xa553('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xa553('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xa553('0x17')](_0xa553('0x39'),'uas'),'allowNull':!![],'defaultValue':_0xa553('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xa553('0x17')]('yes','no'),'allowNull':!![],'defaultValue':_0xa553('0x2c')},'keepalive':{'type':Sequelize[_0xa553('0x15')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xa553('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xa553('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xa553('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xa553('0x17')](_0xa553('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xa553('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xa553('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xa553('0x17')](_0xa553('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xa553('0x17')](_0xa553('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0xa553('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xa553('0x17')](_0xa553('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xa553('0x17')](_0xa553('0x2c'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xa553('0x17')](_0xa553('0x2c'),'no',_0xa553('0x3b'),_0xa553('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xa553('0x17')]('active','passive',_0xa553('0x3d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xa553('0x17')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xa553('0x17')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xa553('0x17')](_0xa553('0x2c'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xa553('0x17')](_0xa553('0x2c'),'no',_0xa553('0x3e'),_0xa553('0x2b'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xa553('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0xa553('0x13')]},'passwordResetAt':{'type':Sequelize[_0xa553('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0xa553('0x15')],'defaultValue':0x0,'set':function(_0x3aae77){this[_0xa553('0x4')]('showWebBar',_0x3aae77);var _0x244124=this['get']({'plain':!![]});switch(_0x3aae77){case 0x0:case 0x1:var _0x4f8a3d=_0x244124[_0xa553('0x22')]?_[_0xa553('0x3f')](_0x244124['transport'])?_0x244124[_0xa553('0x22')][_0xa553('0x23')]():_0x244124[_0xa553('0x22')]:_0xa553('0x40');if(_0x4f8a3d===_0xa553('0x41')){_0x4f8a3d=_0xa553('0x40');}this[_0xa553('0x4')](_0xa553('0x22'),_0x4f8a3d);this['setDataValue'](_0xa553('0x42'),'no');this[_0xa553('0x4')](_0xa553('0x43'),null);this['setDataValue'](_0xa553('0x44'),null);this[_0xa553('0x4')]('icesupport',null);this['setDataValue'](_0xa553('0x45'),null);this[_0xa553('0x4')](_0xa553('0x46'),null);this[_0xa553('0x4')](_0xa553('0x47'),null);this[_0xa553('0x4')](_0xa553('0x48'),null);this[_0xa553('0x4')](_0xa553('0x49'),null);this[_0xa553('0x4')](_0xa553('0x4a'),'no');break;case 0x2:this['setDataValue']('transport','wss');this[_0xa553('0x4')](_0xa553('0x42'),_0xa553('0x2c'));this[_0xa553('0x4')](_0xa553('0x43'),_0xa553('0x2c'));this[_0xa553('0x4')](_0xa553('0x44'),_0xa553('0x2c'));this[_0xa553('0x4')]('icesupport',_0xa553('0x2c'));this[_0xa553('0x4')]('dtlsenable',_0xa553('0x2c'));this[_0xa553('0x4')](_0xa553('0x46'),'no');this[_0xa553('0x4')](_0xa553('0x47'),_0xa553('0x3d'));this[_0xa553('0x4')](_0xa553('0x48'),_0x244124[_0xa553('0x48')]||_0xa553('0x4b'));this['setDataValue']('dtlsprivatekey',_0x244124[_0xa553('0x49')]||_0xa553('0x4c'));this[_0xa553('0x4')]('rtcp_mux',_0xa553('0x2c'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x34e59e){this[_0xa553('0x4')](_0xa553('0x4d'),_0x34e59e?_0x34e59e['join'](','):[]);},'get':function(){return this['getDataValue'](_0xa553('0x4d'))?_[_0xa553('0x4e')](this[_0xa553('0x9')](_0xa553('0x4d'))[_0xa553('0x24')](','),function(_0x6089ff){return parseInt(_0x6089ff,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xa553('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xa553('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0xa553('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xa553('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xa553('0x12')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xa553('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xa553('0x12')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xa553('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xa553('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xa553('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xa553('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xa553('0x17')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xa553('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xa553('0x3')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xa553('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xa553('0x4f')],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this[_0xa553('0x9')](_0xa553('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xa553('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xa553('0x12')],'defaultValue':![]},'interface':{'type':Sequelize[_0xa553('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xa553('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xa553('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xa553('0x12')],'defaultValue':![],'set':function(_0x487830){if(typeof _0x487830===_0xa553('0x51')){var _0x3f89be=_0x487830==='1'?!![]:_0x487830==='0'?![]:_0x487830==='true'?!![]:_0x487830===_0xa553('0x52')?![]:![];this[_0xa553('0x4')](_0xa553('0x53'),_0x3f89be);}else{this[_0xa553('0x4')]('screenrecording',_0x487830);}}},'blocked':{'type':Sequelize[_0xa553('0x12')],'defaultValue':![],'set':function(_0x4c2265){this[_0xa553('0x4')](_0xa553('0x54'),_0x4c2265);if(_0x4c2265===!![]){this[_0xa553('0x4')](_0xa553('0x55'),moment());this['setDataValue'](_0xa553('0x56'),0x0);}else{this[_0xa553('0x4')](_0xa553('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0xa553('0x13')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xa553('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xa553('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xa553('0x15')](0x5)[_0xa553('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xa553('0x12')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xa553('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xa553('0x12')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 4cc7540..456b92c 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 _0xd117=['register','defaults','localhost','http','request','then','info','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','json','offset','limit','count','set','update','get','Users','Agents','agent','Telephones','map','value','includes','role','destroy','stack','name','send','index','rawAttributes','fieldName','key','filter','salt','where','User','query','include','attributes','push','rows','openTabs','true','chat','dataValues','sms','whatsapp','all','params','model','differenceBy','keys','password','filters','intersection','fields','includeAll','merge','options','find','openchannel','mail','body','describe','addContacts','omit','ids','internal','Setting','findById','securePassword','max','isNil','min_internal','sequelize','QueryTypes','SELECT','length','from','voicemail','mailbox','VoiceMail','fullname','permissions','101','102','103','104','105','106','107','108','100','114','115','create','user','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','autoAssociation','bulkCreate','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','each','telephone','isEmpty','some','compact','UserProfileResource','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','add','capitalize','toLowerCase','Queues','penalty','spread','QueueId','emit','Queue:save','voice','findAll','format','UserVoiceQueueRt','upsert','isValidChannel','Unknown\x20channel','remove','Queue:remove','addAvatar','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','userpic','download','existsSync','server/files/images/','getOpenTabs','fax','ChatOpenTabs','createdAt','FaxOpenTabs','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','SmsOpenTabs','SMS','WhatsappOpenTabs','getContacts','CmContact','order','sort','pick','CmList','Tag','color','tag','Queue','Unknown\x20role','hasOwnProperty','nolimit','getVoiceQueuesRt','getGroups','getRecordings','VoiceRecording','UserId','ScreenRecording','getChatInteractions','ChatInteraction','OpenchannelInteraction','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','WhatsappInteraction','getWhatsappInteractions','login','phone','mobile','LOCAL/%s@from-sip/n','SIP/%s','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','PAUSE','LOGININPAUSE','concat','logout','pause','QueuePause','updateAttributes','type','DEFAULT\x20PAUSE','unpause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','manual','Pause','getTeams','Team','addTeams','Voice','setDataValue','Chat','getMailQueues','getSmsQueues','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','transaction','addAgent','getDataValue','VoicePrefixId','removeTeams','getChatQueues','Mail','removeAgent','getLists','getAgents','values','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','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','user_has_openchannel_interactions:remove','addWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lt','$lte','$eq','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','lastName','Contact','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','nonce','token','removeApiKey','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','resolve','teams','queues','VoiceQueue','inbound','flatten','lower','col','asc','desc','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','ringing','busy','slice','toUpperCase','select','field','ui.','InteractionId','user_has_','_interactions','ui.UserId\x20=\x20?','toString','OpenTabs','moment','bluebird','util','path','lodash','squel','jayson/promise','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./user.socket'];(function(_0x4fc56d,_0x38525b){var _0x355527=function(_0x1519be){while(--_0x1519be){_0x4fc56d['push'](_0x4fc56d['shift']());}};_0x355527(++_0x38525b);}(_0xd117,0x182));var _0x7d11=function(_0x1e93fa,_0x210f48){_0x1e93fa=_0x1e93fa-0x0;var _0xd4e1e6=_0xd117[_0x1e93fa];return _0xd4e1e6;};'use strict';var moment=require(_0x7d11('0x0'));var BPromise=require(_0x7d11('0x1'));var util=require(_0x7d11('0x2'));var path=require(_0x7d11('0x3'));var fs=require('fs');var _=require(_0x7d11('0x4'));var squel=require(_0x7d11('0x5'));var jayson=require(_0x7d11('0x6'));var Redis=require(_0x7d11('0x7'));var authService=require(_0x7d11('0x8'));var qs=require(_0x7d11('0x9'));var logger=require(_0x7d11('0xa'))(_0x7d11('0xb'));var utils=require(_0x7d11('0xc'));var config=require(_0x7d11('0xd'));var licenseUtil=require(_0x7d11('0xe'));var db=require(_0x7d11('0xf'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x7d11('0x10')]));require(_0x7d11('0x11'))[_0x7d11('0x12')](socket);config['redis']=_[_0x7d11('0x13')](config[_0x7d11('0x10')],{'host':_0x7d11('0x14'),'port':0x18eb});var client=jayson['client'][_0x7d11('0x15')]({'port':0x232a});var values;function respondWithRpcPromise(_0x48b0f1,_0x58a6fd,_0xb15984,_0x5c6d5d){return new BPromise(function(_0x4a8668,_0xc52a95){var _0x48f576=_0x5c6d5d||client;return _0x48f576[_0x7d11('0x16')](_0x48b0f1,_0xb15984)[_0x7d11('0x17')](function(_0x5ee572){logger[_0x7d11('0x18')](_0x7d11('0x19'),_0x58a6fd,'request\x20sent');logger[_0x7d11('0x1a')](_0x7d11('0x1b'),_0x58a6fd,_0x7d11('0x1c'),JSON[_0x7d11('0x1d')](_0x5ee572));if(_0x5ee572[_0x7d11('0x1e')]){if(_0x5ee572[_0x7d11('0x1e')][_0x7d11('0x1f')]===0x1f4){logger[_0x7d11('0x1e')]('User,\x20%s,\x20%s',_0x58a6fd,_0x5ee572[_0x7d11('0x1e')][_0x7d11('0x20')]);return _0xc52a95(_0x5ee572[_0x7d11('0x1e')][_0x7d11('0x20')]);}logger[_0x7d11('0x1e')]('User,\x20%s,\x20%s',_0x58a6fd,_0x5ee572[_0x7d11('0x1e')][_0x7d11('0x20')]);return _0x4a8668(_0x5ee572['error']['message']);}else{logger[_0x7d11('0x18')]('User,\x20%s,\x20%s',_0x58a6fd,_0x7d11('0x1c'));_0x4a8668(_0x5ee572['result'][_0x7d11('0x20')]);}})[_0x7d11('0x21')](function(_0x328f8e){logger[_0x7d11('0x1e')](_0x7d11('0x19'),_0x58a6fd,_0x328f8e);_0xc52a95(_0x328f8e);});});}function respondWithStatusCode(_0x117bb9,_0x4297f8){_0x4297f8=_0x4297f8||0xcc;return function(_0x3d2574){if(_0x3d2574){return _0x117bb9['sendStatus'](_0x4297f8);}return _0x117bb9[_0x7d11('0x22')](_0x4297f8)['end']();};}function respondWithResult(_0x58455b,_0x5c3898){_0x5c3898=_0x5c3898||0xc8;return function(_0x27a818){if(_0x27a818){return _0x58455b[_0x7d11('0x22')](_0x5c3898)[_0x7d11('0x23')](_0x27a818);}};}function respondWithFilteredResult(_0x1a7853,_0x355d14){return function(_0xd938df){if(_0xd938df){var _0x282e5c=typeof _0x355d14[_0x7d11('0x24')]==='undefined'&&typeof _0x355d14[_0x7d11('0x25')]==='undefined';var _0x4bfa76=_0xd938df['count'];var _0x3ba092=_0x282e5c?0x0:_0x355d14['offset'];var _0x180e1e=_0x282e5c?_0xd938df[_0x7d11('0x26')]:_0x355d14[_0x7d11('0x24')]+_0x355d14['limit'];var _0x46f76a;if(_0x180e1e>=_0x4bfa76){_0x180e1e=_0x4bfa76;_0x46f76a=0xc8;}else{_0x46f76a=0xce;}_0x1a7853[_0x7d11('0x22')](_0x46f76a);return _0x1a7853[_0x7d11('0x27')]('Content-Range',_0x3ba092+'-'+_0x180e1e+'/'+_0x4bfa76)[_0x7d11('0x23')](_0xd938df);}return null;};}function saveUpdates(_0x35a789){return function(_0x18c049){if(_0x18c049){return _0x18c049[_0x7d11('0x28')](_0x35a789)['then'](function(_0x1a7745){return _0x1a7745;});}return null;};}function removeEntity(_0x512f7f){return function(_0x1bc218){if(_0x1bc218){return _0x1bc218['destroy']()[_0x7d11('0x17')](function(){var _0xba4e80=_0x1bc218[_0x7d11('0x29')]({'plain':!![]});if(_0xba4e80['role']==='admin')return;var _0x8e0a53=[{'name':_0x7d11('0x2a'),'value':'user','ignore':!![]},{'name':_0x7d11('0x2b'),'value':_0x7d11('0x2c'),'ignore':![]},{'name':_0x7d11('0x2d'),'value':'telephone','ignore':![]}];var _0x9c6609=_(_0x8e0a53)['filter']('ignore')[_0x7d11('0x2e')]('value')[_0x7d11('0x2f')]();if(_[_0x7d11('0x30')](_0x9c6609,_0xba4e80[_0x7d11('0x31')])){return;}var _0x35b997=_['find'](_0x8e0a53,[_0x7d11('0x2f'),_0xba4e80[_0x7d11('0x31')]])['name'];return db['UserProfileResource'][_0x7d11('0x32')]({'where':{'type':_0x35b997,'resourceId':_0xba4e80['id']}})[_0x7d11('0x17')](function(){return _0x1bc218;});})['then'](function(){_0x512f7f[_0x7d11('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c0113){return function(_0x1286d6){if(!_0x1286d6){_0x5c0113['sendStatus'](0x194);}return _0x1286d6;};}function handleError(_0x4e53be,_0x3414cd){_0x3414cd=_0x3414cd||0x1f4;return function(_0x30e2fa){logger[_0x7d11('0x1e')](_0x30e2fa[_0x7d11('0x33')]);if(_0x30e2fa[_0x7d11('0x34')]){delete _0x30e2fa[_0x7d11('0x34')];}_0x4e53be[_0x7d11('0x22')](_0x3414cd)[_0x7d11('0x35')](_0x30e2fa);};}exports[_0x7d11('0x36')]=function(_0x16cf5d,_0x1a9f18){var _0x779731={},_0x5d2305={'count':0x0,'rows':[]};var _0x157731=_(db['User'][_0x7d11('0x37')])[_0x7d11('0x2e')](function(_0x36be62){return{'name':_0x36be62[_0x7d11('0x38')],'type':_0x36be62['type'][_0x7d11('0x39')]};})[_0x7d11('0x3a')](function(_0x19284){return!_[_0x7d11('0x30')](['password',_0x7d11('0x3b')],_0x19284['name']);})[_0x7d11('0x2f')]();_0x779731=qs['getOptions'](_0x157731,_0x16cf5d);var _0xede1cc={'where':_0x779731[_0x7d11('0x3c')]};return db[_0x7d11('0x3d')][_0x7d11('0x26')](_0xede1cc)['then'](function(_0x57b827){_0x5d2305[_0x7d11('0x26')]=_0x57b827;if(_0x16cf5d[_0x7d11('0x3e')]['includeAll']){_0x779731[_0x7d11('0x3f')]=[{'all':!![]}];}if(!_[_0x7d11('0x30')](_0x779731[_0x7d11('0x40')],'id')){_0x779731[_0x7d11('0x40')][_0x7d11('0x41')]('id');}return db[_0x7d11('0x3d')]['findAll'](_0x779731);})[_0x7d11('0x17')](function(_0x5cf6a6){_0x5d2305[_0x7d11('0x42')]=_0x5cf6a6;if(_0x16cf5d[_0x7d11('0x3e')][_0x7d11('0x43')]===_0x7d11('0x44')){var _0x2a0c2f=[];for(var _0x29da73=0x0;_0x29da73<_0x5d2305['rows']['length'];_0x29da73++){_0x2a0c2f['push'](get_open_tabs(_0x7d11('0x45'),_0x5d2305[_0x7d11('0x42')][_0x29da73][_0x7d11('0x46')]));_0x2a0c2f[_0x7d11('0x41')](get_open_tabs(_0x7d11('0x47'),_0x5d2305['rows'][_0x29da73][_0x7d11('0x46')]));_0x2a0c2f[_0x7d11('0x41')](get_open_tabs('fax',_0x5d2305[_0x7d11('0x42')][_0x29da73][_0x7d11('0x46')]));_0x2a0c2f[_0x7d11('0x41')](get_open_tabs('mail',_0x5d2305[_0x7d11('0x42')][_0x29da73][_0x7d11('0x46')]));_0x2a0c2f[_0x7d11('0x41')](get_open_tabs('openchannel',_0x5d2305[_0x7d11('0x42')][_0x29da73]['dataValues']));_0x2a0c2f[_0x7d11('0x41')](get_open_tabs(_0x7d11('0x48'),_0x5d2305[_0x7d11('0x42')][_0x29da73][_0x7d11('0x46')]));}return BPromise[_0x7d11('0x49')](_0x2a0c2f)[_0x7d11('0x17')](function(_0x161213){return _0x5d2305;});}else{return _0x5d2305;}})[_0x7d11('0x17')](respondWithFilteredResult(_0x1a9f18,_0x779731))[_0x7d11('0x21')](handleError(_0x1a9f18,null));};exports['show']=function(_0x50d458,_0x49a21c){var _0x10c0e9={'raw':![],'where':{'id':_0x50d458[_0x7d11('0x4a')]['id']}},_0x1e5bb5={};_0x1e5bb5[_0x7d11('0x4b')]=_[_0x7d11('0x4c')](_[_0x7d11('0x4d')](db[_0x7d11('0x3d')][_0x7d11('0x37')]),[_0x7d11('0x4e'),_0x7d11('0x3b')]);_0x1e5bb5[_0x7d11('0x3e')]=_[_0x7d11('0x4d')](_0x50d458['query']);_0x1e5bb5[_0x7d11('0x4f')]=_[_0x7d11('0x50')](_0x1e5bb5[_0x7d11('0x4b')],_0x1e5bb5['query']);_0x10c0e9['attributes']=_[_0x7d11('0x50')](_0x1e5bb5[_0x7d11('0x4b')],qs[_0x7d11('0x51')](_0x50d458['query']['fields']));_0x10c0e9[_0x7d11('0x40')]=_0x10c0e9[_0x7d11('0x40')]['length']?_0x10c0e9[_0x7d11('0x40')]:_0x1e5bb5[_0x7d11('0x4b')];if(_0x50d458[_0x7d11('0x3e')][_0x7d11('0x52')]){_0x10c0e9['include']=[{'all':!![]}];}_0x10c0e9=_[_0x7d11('0x53')]({},_0x10c0e9,_0x50d458[_0x7d11('0x54')]);if(!_[_0x7d11('0x30')](_0x10c0e9['attributes'],'id')){_0x10c0e9['attributes'][_0x7d11('0x41')]('id');}return db[_0x7d11('0x3d')][_0x7d11('0x55')](_0x10c0e9)[_0x7d11('0x17')](handleEntityNotFound(_0x49a21c,null))[_0x7d11('0x17')](function(_0x4c7d7a){var _0x46a8e1=[];values=_0x4c7d7a;if(_0x50d458[_0x7d11('0x3e')][_0x7d11('0x43')]===_0x7d11('0x44')){_0x46a8e1['push'](get_open_tabs('chat',_0x4c7d7a[_0x7d11('0x46')]));_0x46a8e1[_0x7d11('0x41')](get_open_tabs(_0x7d11('0x47'),_0x4c7d7a[_0x7d11('0x46')]));_0x46a8e1[_0x7d11('0x41')](get_open_tabs(_0x7d11('0x56'),_0x4c7d7a[_0x7d11('0x46')]));_0x46a8e1[_0x7d11('0x41')](get_open_tabs(_0x7d11('0x48'),_0x4c7d7a[_0x7d11('0x46')]));_0x46a8e1['push'](get_open_tabs('fax',_0x4c7d7a['dataValues']));_0x46a8e1[_0x7d11('0x41')](get_open_tabs(_0x7d11('0x57'),_0x4c7d7a[_0x7d11('0x46')]));return BPromise['all'](_0x46a8e1);}else{return values;}})[_0x7d11('0x17')](function(_0x222375){return values;})[_0x7d11('0x17')](respondWithResult(_0x49a21c,null))[_0x7d11('0x21')](handleError(_0x49a21c,null));};exports[_0x7d11('0x28')]=function(_0x178a3a,_0x505573){if(_0x178a3a[_0x7d11('0x58')]['id']){delete _0x178a3a[_0x7d11('0x58')]['id'];}delete _0x178a3a[_0x7d11('0x58')]['role'];return db['User']['find']({'where':{'id':_0x178a3a['params']['id']}})[_0x7d11('0x17')](handleEntityNotFound(_0x505573,null))['then'](saveUpdates(_0x178a3a['body'],null))['then'](respondWithResult(_0x505573,null))[_0x7d11('0x21')](handleError(_0x505573,null));};exports[_0x7d11('0x59')]=function(_0x1072f1,_0x407f2c){return db[_0x7d11('0x3d')][_0x7d11('0x59')]()['then'](respondWithResult(_0x407f2c,null))[_0x7d11('0x21')](handleError(_0x407f2c,null));};exports['addContacts']=function(_0x34aab4,_0x49f904){return db[_0x7d11('0x3d')][_0x7d11('0x55')]({'where':{'id':_0x34aab4['params']['id']}})[_0x7d11('0x17')](handleEntityNotFound(_0x49f904,null))[_0x7d11('0x17')](function(_0x2581d5){if(_0x2581d5){return _0x2581d5[_0x7d11('0x5a')](_0x34aab4['body']['ids'],_[_0x7d11('0x5b')](_0x34aab4[_0x7d11('0x58')],[_0x7d11('0x5c'),'id'])||{});}})[_0x7d11('0x17')](respondWithResult(_0x49f904,null))[_0x7d11('0x21')](handleError(_0x49f904,null));};function validateUser(_0x492183){return new BPromise(function(_0x2b9ba0,_0x5ad800){if(_0x492183[_0x7d11('0x5d')])return _0x2b9ba0(_0x492183);return db[_0x7d11('0x5e')][_0x7d11('0x5f')](0x1)[_0x7d11('0x17')](function(_0x4df2da){if(_0x4df2da[_0x7d11('0x60')])authService['validatePasswordPattern'](_0x492183[_0x7d11('0x4e')]);db[_0x7d11('0x3d')][_0x7d11('0x61')](_0x7d11('0x5d'))[_0x7d11('0x17')](function(_0x776b20){if(_[_0x7d11('0x62')](_0x776b20)){_0x492183[_0x7d11('0x5d')]=_0x4df2da[_0x7d11('0x63')]||0x1;return;}if(_[_0x7d11('0x62')](_0x4df2da[_0x7d11('0x63')])||_0x4df2da[_0x7d11('0x63')]===_0x776b20){_0x492183[_0x7d11('0x5d')]=_0x776b20+0x1;return;}if(_0x4df2da[_0x7d11('0x63')]>_0x776b20){_0x492183['internal']=_0x4df2da[_0x7d11('0x63')];return;}return db['sequelize'][_0x7d11('0x3e')]('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)',{'type':db[_0x7d11('0x64')][_0x7d11('0x65')][_0x7d11('0x66')]})[_0x7d11('0x17')](function(_0x4aac67){if(_0x4aac67&&_0x4aac67['length']){for(var _0x1351ee=0x0,_0x15938b=_0x4aac67[_0x7d11('0x67')];_0x1351ee<_0x15938b&&_['isNil'](_0x492183[_0x7d11('0x5d')]);_0x1351ee++){if(_0x4df2da[_0x7d11('0x63')]<=_0x4aac67[_0x1351ee][_0x7d11('0x68')]){_0x492183[_0x7d11('0x5d')]=_0x4aac67[_0x1351ee][_0x7d11('0x68')];}else if(_0x4df2da[_0x7d11('0x63')]>_0x4aac67[_0x1351ee]['from']&&_0x4df2da[_0x7d11('0x63')]<=_0x4aac67[_0x1351ee]['to']){_0x492183['internal']=_0x4df2da[_0x7d11('0x63')];}}}if(_['isNil'](_0x492183['internal'])){_0x492183[_0x7d11('0x5d')]=_0x776b20+0x1;}return _0x2b9ba0(_0x492183);});});})[_0x7d11('0x21')](function(_0xeed31b){_0x5ad800(_0xeed31b);});});}function updateUser(_0x14ee15){return new BPromise(function(_0x119da7,_0x2da548){try{if(_0x14ee15[_0x7d11('0x69')]){_0x14ee15[_0x7d11('0x6a')]=_0x14ee15[_0x7d11('0x5d')];_0x14ee15[_0x7d11('0x6b')]={'mailbox':_0x14ee15[_0x7d11('0x5d')],'password':_0x14ee15['password'],'fullname':_0x14ee15[_0x7d11('0x6c')],'email':_0x14ee15['email']};}if(_0x14ee15[_0x7d11('0x31')]===_0x7d11('0x2c')){if(!_0x14ee15[_0x7d11('0x6d')])_0x14ee15[_0x7d11('0x6d')]=[_0x7d11('0x6e'),_0x7d11('0x6f'),_0x7d11('0x70'),'113','110',_0x7d11('0x71'),_0x7d11('0x72'),_0x7d11('0x73'),_0x7d11('0x74'),_0x7d11('0x75'),'109',_0x7d11('0x76'),'111',_0x7d11('0x77'),_0x7d11('0x78')];}_0x119da7(_0x14ee15);}catch(_0x1bddb4){_0x2da548(_0x1bddb4);}});}exports[_0x7d11('0x79')]=function(_0x1b5e35,_0x1c02c8){if(_0x1b5e35[_0x7d11('0x7a')][_0x7d11('0x31')]==='agent')throw new Error('Unauthorized');if(_0x1b5e35[_0x7d11('0x58')][_0x7d11('0x31')]===_0x7d11('0x7a')&&_0x1b5e35['user']['role']!==_0x7d11('0x7b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x1b5e35[_0x7d11('0x58')][_0x7d11('0x31')]===_0x7d11('0x7b')&&_0x1b5e35[_0x7d11('0x7a')]['role']!==_0x7d11('0x7b')){throw new Error(_0x7d11('0x7c'));}return licenseUtil[_0x7d11('0x7d')]([_0x1b5e35[_0x7d11('0x58')]])[_0x7d11('0x17')](function(){return validateUser(_0x1b5e35[_0x7d11('0x58')]);})[_0x7d11('0x17')](function(_0x1b719a){return updateUser(_0x1b719a)['then'](function(_0x41f989){if(_0x41f989[_0x7d11('0x31')]===_0x7d11('0x7b')){_0x41f989[_0x7d11('0x7e')]=_0x1b5e35[_0x7d11('0x7a')]['settingsEnabled'];delete _0x41f989[_0x7d11('0x7f')];}return _0x41f989;});})[_0x7d11('0x17')](function(_0xa4d2ad){return db[_0x7d11('0x3d')][_0x7d11('0x79')](_0xa4d2ad,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})['then'](function(_0x1fdae2){if(_0x1b5e35['body'][_0x7d11('0x31')]==='user')return _0x1fdae2;if(_0x1b5e35['user'][_0x7d11('0x31')]!==_0x7d11('0x7a'))return _0x1fdae2;return db[_0x7d11('0x80')][_0x7d11('0x55')]({'where':{'name':_0x1fdae2[_0x7d11('0x31')]===_0x7d11('0x2c')?_0x7d11('0x2b'):_0x7d11('0x2d'),'userProfileId':_0x1b5e35[_0x7d11('0x7a')][_0x7d11('0x7f')]},'raw':!![]})['then'](function(_0xfdfcb7){if(!_0xfdfcb7||_0xfdfcb7[_0x7d11('0x81')]!=0x0)return _0x1fdae2;return db['UserProfileResource'][_0x7d11('0x79')]({'name':_0x1fdae2[_0x7d11('0x34')],'resourceId':_0x1fdae2['id'],'type':_0xfdfcb7[_0x7d11('0x34')],'sectionId':_0xfdfcb7['id']},{})[_0x7d11('0x17')](function(){return _0x1fdae2;});})['catch'](function(_0x573fa9){logger[_0x7d11('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x573fa9);throw _0x573fa9;});})[_0x7d11('0x17')](respondWithResult(_0x1c02c8,0xc9))[_0x7d11('0x21')](handleError(_0x1c02c8,null));};exports[_0x7d11('0x82')]=function(_0x13ccd5,_0x1565d9){var _0x269f3f=_0x13ccd5[_0x7d11('0x58')];var _0x596228=[];if(_0x13ccd5[_0x7d11('0x7a')][_0x7d11('0x31')]===_0x7d11('0x2c'))throw new Error(_0x7d11('0x83'));if(_['some'](_0x269f3f,[_0x7d11('0x31'),_0x7d11('0x7a')])&&_0x13ccd5['user'][_0x7d11('0x31')]!==_0x7d11('0x7b')){throw new Error(_0x7d11('0x84'));}if(_['some'](_0x269f3f,[_0x7d11('0x31'),_0x7d11('0x7b')])&&_0x13ccd5['user'][_0x7d11('0x31')]!==_0x7d11('0x7b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x7d11('0x7d')](_0x269f3f)['then'](function(){return validateUser(_0x269f3f[0x0]);})['then'](function(){for(var _0x4ba3f6=0x1;_0x4ba3f6<_0x269f3f['length'];_0x4ba3f6++){var _0x526e65=_0x269f3f[_0x4ba3f6-0x1][_0x7d11('0x5d')];if(!_0x269f3f[_0x4ba3f6][_0x7d11('0x5d')])_0x269f3f[_0x4ba3f6][_0x7d11('0x5d')]=_0x526e65+0x1;_0x596228[_0x7d11('0x41')](validateUser(_0x269f3f[_0x4ba3f6]));}return BPromise[_0x7d11('0x49')](_0x596228);})[_0x7d11('0x17')](function(){_0x596228=[];for(var _0x1a2df6=0x0;_0x1a2df6<_0x269f3f[_0x7d11('0x67')];_0x1a2df6++){_0x596228[_0x7d11('0x41')](updateUser(_0x269f3f[_0x1a2df6]));}return BPromise['all'](_0x596228);})['then'](function(){return BPromise[_0x7d11('0x85')](_0x269f3f,function(_0x158e0f){return db['User']['create'](_0x158e0f,{'include':[{'model':db[_0x7d11('0x6b')],'as':_0x7d11('0x6b')}]})[_0x7d11('0x17')](function(_0x391d7){_0x158e0f['id']=_0x391d7['id'];return _0x158e0f;});});})['then'](function(_0x542596){if(_0x13ccd5['body'][_0x7d11('0x31')]===_0x7d11('0x7a'))return _0x542596;if(_0x13ccd5[_0x7d11('0x7a')]['role']!==_0x7d11('0x7a'))return _0x542596;var _0x238cfd=_['some'](_0x542596,function(_0x4aafef){return _0x4aafef[_0x7d11('0x31')]==='agent'||_0x4aafef['role']===_0x7d11('0x86');});if(!_0x238cfd)return _0x542596;return db[_0x7d11('0x80')]['findAll']({'where':{'name':{'$or':['Agents',_0x7d11('0x2d')]},'userProfileId':_0x13ccd5[_0x7d11('0x7a')][_0x7d11('0x7f')]},'raw':!![]})[_0x7d11('0x17')](function(_0x4af02c){if(_[_0x7d11('0x87')](_0x4af02c)||!_[_0x7d11('0x88')](_0x4af02c,[_0x7d11('0x81'),0x0]))return _0x542596;_0x596228=[];var _0x83416b=_(_0x4af02c)['map'](function(_0xdd679a){if(_0xdd679a[_0x7d11('0x81')]===0x1)return;return _0xdd679a[_0x7d11('0x34')]==='Agents'?_0x7d11('0x2c'):'telephone';})[_0x7d11('0x89')]()['value']();for(var _0x1a0e19=0x0;_0x1a0e19<_0x542596[_0x7d11('0x67')];_0x1a0e19++){if(!_[_0x7d11('0x30')](_0x83416b,_0x542596[_0x1a0e19][_0x7d11('0x31')]))return;var _0x38094f=_0x542596[_0x1a0e19][_0x7d11('0x31')]==='agent'?'Agents':_0x7d11('0x2d');_0x596228[_0x7d11('0x41')](db[_0x7d11('0x8a')][_0x7d11('0x79')]({'name':_0x542596[_0x1a0e19]['name'],'resourceId':_0x542596[_0x1a0e19]['id'],'type':_0x38094f,'sectionId':_[_0x7d11('0x55')](_0x4af02c,[_0x7d11('0x34'),_0x38094f])['id']},{}));}return BPromise[_0x7d11('0x49')](_0x596228);});})[_0x7d11('0x17')](respondWithResult(_0x1565d9,0xc9))['catch'](handleError(_0x1565d9,null));};exports[_0x7d11('0x8b')]=function(_0x2bac2a,_0x3aad38){if(_0x2bac2a[_0x7d11('0x58')]['id']){delete _0x2bac2a[_0x7d11('0x58')]['id'];}return db[_0x7d11('0x3d')]['find']({'where':{'id':_0x2bac2a[_0x7d11('0x4a')]['id']}})['then'](function(_0xe03909){if(!_0xe03909)return null;if(_0xe03909['id']===_0x2bac2a['user']['id']){if(!_0x2bac2a[_0x7d11('0x58')][_0x7d11('0x8c')]||!_0x2bac2a[_0x7d11('0x58')][_0x7d11('0x8d')]){throw new db[(_0x7d11('0x8e'))][(_0x7d11('0x8f'))](_0x7d11('0x90'));}if(!_0xe03909[_0x7d11('0x91')](_0x2bac2a[_0x7d11('0x58')][_0x7d11('0x8c')])){throw new db['Sequelize'][(_0x7d11('0x8f'))]('Wrong\x20credentials');}if(_0x2bac2a[_0x7d11('0x58')][_0x7d11('0x8c')]===_0x2bac2a[_0x7d11('0x58')][_0x7d11('0x8d')]){throw new db[(_0x7d11('0x8e'))]['ValidationError']('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x2bac2a[_0x7d11('0x7a')][_0x7d11('0x31')]==='admin'){if(!_0x2bac2a[_0x7d11('0x58')][_0x7d11('0x8d')]){throw new db[(_0x7d11('0x8e'))][(_0x7d11('0x8f'))](_0x7d11('0x92'));}}else if(_0x2bac2a['user']['role']==='user'){if(!_0x2bac2a['body'][_0x7d11('0x8d')]){throw new db[(_0x7d11('0x8e'))]['ValidationError'](_0x7d11('0x92'));}if(_0xe03909[_0x7d11('0x31')]!==_0x7d11('0x2c')){throw new db[(_0x7d11('0x8e'))][(_0x7d11('0x8f'))](_0x7d11('0x83'));}}else{throw new db[(_0x7d11('0x8e'))][(_0x7d11('0x8f'))]('Unauthorized');}return _0xe03909;})[_0x7d11('0x17')](handleEntityNotFound(_0x3aad38,null))[_0x7d11('0x17')](function(_0x54fd6a){return db[_0x7d11('0x5e')][_0x7d11('0x93')]({'attributes':['id',_0x7d11('0x60'),_0x7d11('0x94'),_0x7d11('0x95')]})[_0x7d11('0x17')](function(_0x1b8ad6){if(_0x1b8ad6[_0x7d11('0x60')])authService[_0x7d11('0x96')](_0x2bac2a[_0x7d11('0x58')][_0x7d11('0x8d')]);if(!_0x1b8ad6[_0x7d11('0x94')]||!_0x54fd6a['previousPasswords'])return _0x54fd6a;authService['validatePasswordHistory'](_0x2bac2a[_0x7d11('0x58')][_0x7d11('0x8d')],_0x54fd6a[_0x7d11('0x97')],_0x1b8ad6['passwordHistoryLimit']);return _0x54fd6a;})[_0x7d11('0x17')](saveUpdates({'password':_0x2bac2a['body'][_0x7d11('0x8d')],'passwordResetAt':_0x2bac2a[_0x7d11('0x7a')]['id']==_0x2bac2a[_0x7d11('0x4a')]['id']?moment():null,'previousPasswords':authService[_0x7d11('0x98')](_0x2bac2a[_0x7d11('0x58')][_0x7d11('0x8d')],_0x54fd6a[_0x7d11('0x97')])},null));})[_0x7d11('0x17')](respondWithResult(_0x3aad38,null))[_0x7d11('0x21')](handleError(_0x3aad38,null));};exports[_0x7d11('0x99')]=function(_0x358178,_0x460c72){var _0x2c3a17=_0x358178[_0x7d11('0x58')][_0x7d11('0x9a')];return db[_0x7d11('0x3d')][_0x7d11('0x55')]({'where':{'id':_0x358178[_0x7d11('0x4a')]['id']},'attributes':['id','name','role',_0x7d11('0x9b'),_0x7d11('0x9c'),_0x7d11('0x9d'),_0x7d11('0x9e')]})[_0x7d11('0x17')](handleEntityNotFound(_0x460c72,null))['then'](function(_0x59d543){if(_0x59d543){if(!utils['isValidChannel'](_0x2c3a17)){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}return _0x59d543[_0x7d11('0x9f')+_[_0x7d11('0xa0')](_0x2c3a17[_0x7d11('0xa1')]())+_0x7d11('0xa2')](_0x358178[_0x7d11('0x58')][_0x7d11('0x5c')],{'penalty':_0x358178[_0x7d11('0x58')][_0x7d11('0xa3')]||0x0})[_0x7d11('0xa4')](function(_0x1570be){for(var _0x4135f7=0x0;_0x4135f7<_0x358178[_0x7d11('0x58')][_0x7d11('0x5c')]['length'];_0x4135f7+=0x1){var _0x51b469={'UserId':Number(_0x358178['params']['id'])};_0x51b469[_['capitalize'](_0x2c3a17['toLowerCase']())+_0x7d11('0xa5')]=Number(_0x358178[_0x7d11('0x58')][_0x7d11('0x5c')][_0x4135f7]);socket[_0x7d11('0xa6')](_0x7d11('0x7a')+_[_0x7d11('0xa0')](_0x2c3a17[_0x7d11('0xa1')]())+_0x7d11('0xa7'),_0x51b469);}return _0x1570be;})[_0x7d11('0x17')](function(){if(_0x2c3a17===_0x7d11('0xa8')){return db['VoiceQueue'][_0x7d11('0xa9')]({'where':{'id':_0x358178[_0x7d11('0x58')][_0x7d11('0x5c')]||[]},'raw':!![],'attributes':['id',_0x7d11('0x34')]});}})[_0x7d11('0x17')](function(_0x43a20c){var _0x53887c=_0x59d543[_0x7d11('0x29')]({'plain':!![]});var _0x25c8e4=[];if(_0x2c3a17===_0x7d11('0xa8')&&_0x53887c[_0x7d11('0x31')]==='agent'&&_0x53887c[_0x7d11('0x9b')]){for(var _0xbdc907=0x0;_0xbdc907<_0x43a20c['length'];_0xbdc907+=0x1){_0x25c8e4[_0x7d11('0x41')]({'membername':_0x53887c[_0x7d11('0x34')],'UserId':_0x53887c['id'],'queue_name':_0x43a20c[_0xbdc907][_0x7d11('0x34')],'VoiceQueueId':_0x43a20c[_0xbdc907]['id'],'interface':_['isNil'](_0x53887c[_0x7d11('0x9e')])?util[_0x7d11('0xaa')]('SIP/%s',_0x53887c[_0x7d11('0x34')]):_0x53887c[_0x7d11('0x9e')],'paused':_0x53887c[_0x7d11('0x9d')]||![],'penalty':_0x358178[_0x7d11('0x58')]['penalty']||0x0});}return BPromise['each'](_0x25c8e4,function(_0x83a280){return db[_0x7d11('0xab')][_0x7d11('0xac')](_0x83a280);});}return _0x59d543;});}})[_0x7d11('0x17')](respondWithStatusCode(_0x460c72,null))[_0x7d11('0x21')](handleError(_0x460c72,null));};exports['removeQueues']=function(_0x462e6b,_0x1398e8){var _0x45f8e0;return db[_0x7d11('0x3d')]['find']({'where':{'id':_0x462e6b[_0x7d11('0x4a')]['id']},'attributes':['id',_0x7d11('0x34'),_0x7d11('0x31')]})['then'](handleEntityNotFound(_0x1398e8,null))[_0x7d11('0x17')](function(_0x3fb52a){if(_0x3fb52a){_0x45f8e0=_0x3fb52a;if(!_0x462e6b[_0x7d11('0x3e')]['channel']||!utils[_0x7d11('0xad')](_0x462e6b[_0x7d11('0x3e')][_0x7d11('0x9a')])){throw new db[(_0x7d11('0x8e'))][(_0x7d11('0x8f'))](_0x7d11('0xae'));}return _0x3fb52a[_0x7d11('0xaf')+_['capitalize'](_0x462e6b[_0x7d11('0x3e')]['channel'][_0x7d11('0xa1')]())+_0x7d11('0xa2')](_0x462e6b[_0x7d11('0x3e')][_0x7d11('0x5c')]);}})['then'](function(_0x2e4eac){if(_['isArray'](_0x462e6b['query'][_0x7d11('0x5c')])){for(var _0x1ebd24=0x0;_0x1ebd24<_0x462e6b['query'][_0x7d11('0x5c')]['length'];_0x1ebd24+=0x1){var _0x451e24={'UserId':Number(_0x462e6b['params']['id'])};_0x451e24[_['capitalize'](_0x462e6b[_0x7d11('0x3e')]['channel'][_0x7d11('0xa1')]())+_0x7d11('0xa5')]=Number(_0x462e6b['query'][_0x7d11('0x5c')][_0x1ebd24]);socket['emit']('user'+_[_0x7d11('0xa0')](_0x462e6b['query']['channel']['toLowerCase']())+_0x7d11('0xb0'),_0x451e24);}}else{var _0x451e24={'UserId':Number(_0x462e6b[_0x7d11('0x4a')]['id'])};_0x451e24[_[_0x7d11('0xa0')](_0x462e6b[_0x7d11('0x3e')]['channel'][_0x7d11('0xa1')]())+_0x7d11('0xa5')]=Number(_0x462e6b[_0x7d11('0x3e')][_0x7d11('0x5c')]);socket[_0x7d11('0xa6')](_0x7d11('0x7a')+_['capitalize'](_0x462e6b[_0x7d11('0x3e')][_0x7d11('0x9a')][_0x7d11('0xa1')]())+_0x7d11('0xb0'),_0x451e24);}return _0x2e4eac;})[_0x7d11('0x17')](function(){if(_0x462e6b[_0x7d11('0x3e')]['channel']===_0x7d11('0xa8')){return db[_0x7d11('0xab')][_0x7d11('0x32')]({'where':{'UserId':_0x462e6b['params']['id'],'VoiceQueueId':_0x462e6b[_0x7d11('0x3e')][_0x7d11('0x5c')]},'individualHooks':!![]})[_0x7d11('0x17')](function(){return _0x45f8e0;});}return _0x45f8e0;})['then'](respondWithStatusCode(_0x1398e8,null))[_0x7d11('0x21')](handleError(_0x1398e8,null));};exports[_0x7d11('0xb1')]=function(_0x945c35,_0xd55b9b){_0x945c35[_0x7d11('0x58')]['userpic']=_0x945c35[_0x7d11('0xb2')][_0x7d11('0xb3')];return db[_0x7d11('0x3d')][_0x7d11('0x55')]({'where':{'id':_0x945c35[_0x7d11('0x4a')]['id']}})['then'](handleEntityNotFound(_0xd55b9b,null))['then'](saveUpdates(_0x945c35[_0x7d11('0x58')],null))[_0x7d11('0x17')](respondWithResult(_0xd55b9b,null))[_0x7d11('0x21')](handleError(_0xd55b9b,null));};exports[_0x7d11('0xb4')]=function(_0x388028,_0x3e8c11){var _0x3aceef=path[_0x7d11('0xb5')](config[_0x7d11('0xb6')],_0x7d11('0xb7'));return db[_0x7d11('0x3d')][_0x7d11('0x55')]({'where':{'id':_0x388028['params']['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x3e8c11,null))[_0x7d11('0x17')](function(_0x2ff073){if(_0x2ff073){if(_[_0x7d11('0x62')](_0x2ff073[_0x7d11('0xb8')])){return _0x3e8c11[_0x7d11('0xb9')](_0x3aceef);}else{if(!fs[_0x7d11('0xba')](path[_0x7d11('0xb5')](config[_0x7d11('0xb6')],_0x7d11('0xbb'),_0x2ff073['userpic']))){return _0x3e8c11[_0x7d11('0xb9')](_0x3aceef);}return _0x3e8c11[_0x7d11('0xb9')](path[_0x7d11('0xb5')](config['root'],_0x7d11('0xbb'),_0x2ff073[_0x7d11('0xb8')]));}}})[_0x7d11('0x21')](handleError(_0x3e8c11,null));};exports[_0x7d11('0xbc')]=function(_0x39c200,_0x250b96){return db['User'][_0x7d11('0x55')]({'where':{'id':_0x39c200['params']['id']},'attributes':['id']})[_0x7d11('0x17')](handleEntityNotFound(_0x250b96,null))[_0x7d11('0x17')](function(_0x248f58){var _0x1b65aa=[];values=_0x248f58[_0x7d11('0x46')];_0x1b65aa['push'](get_open_tabs('chat',_0x248f58['dataValues']));_0x1b65aa[_0x7d11('0x41')](get_open_tabs(_0x7d11('0x47'),_0x248f58[_0x7d11('0x46')]));_0x1b65aa[_0x7d11('0x41')](get_open_tabs(_0x7d11('0x56'),_0x248f58['dataValues']));_0x1b65aa[_0x7d11('0x41')](get_open_tabs(_0x7d11('0x48'),_0x248f58['dataValues']));_0x1b65aa[_0x7d11('0x41')](get_open_tabs(_0x7d11('0xbd'),_0x248f58[_0x7d11('0x46')]));_0x1b65aa[_0x7d11('0x41')](get_open_tabs('mail',_0x248f58['dataValues']));return BPromise[_0x7d11('0x49')](_0x1b65aa);})['then'](function(_0x10890c){var _0x58e579=[];if(_0x10890c){for(var _0x3604e7=0x0;_0x3604e7=_0x2a6832){_0x2155f1=_0x2a6832;_0x297df7=0xc8;}else{_0x297df7=0xce;}_0x53181b[_0xef61('0x20')](_0x297df7);return _0x53181b[_0xef61('0x24')](_0xef61('0x25'),_0x2419a9+'-'+_0x2155f1+'/'+_0x2a6832)[_0xef61('0x26')](_0x3782c6);}return null;};}function saveUpdates(_0x63edd4){return function(_0x1f3572){if(_0x1f3572){return _0x1f3572[_0xef61('0x27')](_0x63edd4)[_0xef61('0x16')](function(_0x393ea9){return _0x393ea9;});}return null;};}function removeEntity(_0x587e26){return function(_0x2fe908){if(_0x2fe908){return _0x2fe908[_0xef61('0x28')]()[_0xef61('0x16')](function(){var _0x4f35ad=_0x2fe908['get']({'plain':!![]});if(_0x4f35ad[_0xef61('0x29')]===_0xef61('0x2a'))return;var _0x122176=[{'name':'Users','value':_0xef61('0x2b'),'ignore':!![]},{'name':_0xef61('0x2c'),'value':'agent','ignore':![]},{'name':_0xef61('0x2d'),'value':'telephone','ignore':![]}];var _0x4c7fd3=_(_0x122176)[_0xef61('0x2e')]('ignore')[_0xef61('0x2f')]('value')[_0xef61('0x30')]();if(_[_0xef61('0x31')](_0x4c7fd3,_0x4f35ad[_0xef61('0x29')])){return;}var _0x14c05c=_[_0xef61('0x32')](_0x122176,[_0xef61('0x30'),_0x4f35ad[_0xef61('0x29')]])[_0xef61('0x33')];return db[_0xef61('0x34')][_0xef61('0x28')]({'where':{'type':_0x14c05c,'resourceId':_0x4f35ad['id']}})['then'](function(){return _0x2fe908;});})[_0xef61('0x16')](function(){_0x587e26[_0xef61('0x20')](0xcc)[_0xef61('0x35')]();});}};}function handleEntityNotFound(_0x1c1760){return function(_0x310954){if(!_0x310954){_0x1c1760['sendStatus'](0x194);}return _0x310954;};}function handleError(_0x1c38dc,_0x3b7373){_0x3b7373=_0x3b7373||0x1f4;return function(_0x291944){logger['error'](_0x291944['stack']);if(_0x291944['name']){delete _0x291944[_0xef61('0x33')];}_0x1c38dc['status'](_0x3b7373)['send'](_0x291944);};}exports['index']=function(_0x3ee764,_0x294063){var _0x54e37a={},_0x508dc7={'count':0x0,'rows':[]};var _0x53c9ef=_(db['User'][_0xef61('0x36')])[_0xef61('0x2f')](function(_0x5e1128){return{'name':_0x5e1128[_0xef61('0x37')],'type':_0x5e1128[_0xef61('0x38')][_0xef61('0x39')]};})[_0xef61('0x2e')](function(_0x49e7c4){return!_[_0xef61('0x31')]([_0xef61('0x3a'),_0xef61('0x3b')],_0x49e7c4[_0xef61('0x33')]);})['value']();_0x54e37a=qs['getOptions'](_0x53c9ef,_0x3ee764);var _0x32109d={'where':_0x54e37a[_0xef61('0x3c')]};return db[_0xef61('0x3d')]['count'](_0x32109d)[_0xef61('0x16')](function(_0x361705){_0x508dc7[_0xef61('0x23')]=_0x361705;if(_0x3ee764[_0xef61('0x3e')]['includeAll']){_0x54e37a['include']=[{'all':!![]}];}if(!_['includes'](_0x54e37a[_0xef61('0x3f')],'id')){_0x54e37a[_0xef61('0x3f')][_0xef61('0x40')]('id');}return db[_0xef61('0x3d')][_0xef61('0x41')](_0x54e37a);})[_0xef61('0x16')](function(_0xc9b467){_0x508dc7['rows']=_0xc9b467;if(_0x3ee764[_0xef61('0x3e')][_0xef61('0x42')]===_0xef61('0x43')){var _0x898c74=[];for(var _0x51fac1=0x0;_0x51fac1<_0x508dc7[_0xef61('0x44')][_0xef61('0x45')];_0x51fac1++){_0x898c74[_0xef61('0x40')](get_open_tabs(_0xef61('0x46'),_0x508dc7[_0xef61('0x44')][_0x51fac1][_0xef61('0x47')]));_0x898c74['push'](get_open_tabs(_0xef61('0x48'),_0x508dc7[_0xef61('0x44')][_0x51fac1][_0xef61('0x47')]));_0x898c74['push'](get_open_tabs(_0xef61('0x49'),_0x508dc7[_0xef61('0x44')][_0x51fac1][_0xef61('0x47')]));_0x898c74[_0xef61('0x40')](get_open_tabs(_0xef61('0x4a'),_0x508dc7[_0xef61('0x44')][_0x51fac1]['dataValues']));_0x898c74[_0xef61('0x40')](get_open_tabs(_0xef61('0x4b'),_0x508dc7['rows'][_0x51fac1][_0xef61('0x47')]));_0x898c74[_0xef61('0x40')](get_open_tabs(_0xef61('0x4c'),_0x508dc7[_0xef61('0x44')][_0x51fac1]['dataValues']));}return BPromise[_0xef61('0x4d')](_0x898c74)[_0xef61('0x16')](function(_0x5e614b){return _0x508dc7;});}else{return _0x508dc7;}})['then'](respondWithFilteredResult(_0x294063,_0x54e37a))[_0xef61('0x1f')](handleError(_0x294063,null));};exports[_0xef61('0x4e')]=function(_0x53bd30,_0xe9d203){var _0x132c77={'raw':![],'where':{'id':_0x53bd30[_0xef61('0x4f')]['id']}},_0x13d0f8={};_0x13d0f8[_0xef61('0x50')]=_[_0xef61('0x51')](_[_0xef61('0x52')](db['User'][_0xef61('0x36')]),['password',_0xef61('0x3b')]);_0x13d0f8[_0xef61('0x3e')]=_[_0xef61('0x52')](_0x53bd30[_0xef61('0x3e')]);_0x13d0f8[_0xef61('0x53')]=_[_0xef61('0x54')](_0x13d0f8[_0xef61('0x50')],_0x13d0f8[_0xef61('0x3e')]);_0x132c77[_0xef61('0x3f')]=_['intersection'](_0x13d0f8[_0xef61('0x50')],qs[_0xef61('0x55')](_0x53bd30['query']['fields']));_0x132c77[_0xef61('0x3f')]=_0x132c77[_0xef61('0x3f')]['length']?_0x132c77[_0xef61('0x3f')]:_0x13d0f8['model'];if(_0x53bd30[_0xef61('0x3e')][_0xef61('0x56')]){_0x132c77[_0xef61('0x57')]=[{'all':!![]}];}_0x132c77=_[_0xef61('0x58')]({},_0x132c77,_0x53bd30[_0xef61('0x59')]);if(!_[_0xef61('0x31')](_0x132c77['attributes'],'id')){_0x132c77[_0xef61('0x3f')][_0xef61('0x40')]('id');}return db['User'][_0xef61('0x32')](_0x132c77)[_0xef61('0x16')](handleEntityNotFound(_0xe9d203,null))['then'](function(_0x54a936){var _0x93441a=[];values=_0x54a936;if(_0x53bd30['query']['openTabs']==='true'){_0x93441a[_0xef61('0x40')](get_open_tabs(_0xef61('0x46'),_0x54a936['dataValues']));_0x93441a[_0xef61('0x40')](get_open_tabs(_0xef61('0x48'),_0x54a936[_0xef61('0x47')]));_0x93441a[_0xef61('0x40')](get_open_tabs(_0xef61('0x4b'),_0x54a936[_0xef61('0x47')]));_0x93441a[_0xef61('0x40')](get_open_tabs(_0xef61('0x4c'),_0x54a936['dataValues']));_0x93441a['push'](get_open_tabs(_0xef61('0x49'),_0x54a936[_0xef61('0x47')]));_0x93441a[_0xef61('0x40')](get_open_tabs(_0xef61('0x4a'),_0x54a936[_0xef61('0x47')]));return BPromise['all'](_0x93441a);}else{return values;}})[_0xef61('0x16')](function(_0x572d5f){return values;})['then'](respondWithResult(_0xe9d203,null))[_0xef61('0x1f')](handleError(_0xe9d203,null));};exports[_0xef61('0x27')]=function(_0x224f3a,_0x525a5e){if(_0x224f3a[_0xef61('0x5a')]['id']){delete _0x224f3a[_0xef61('0x5a')]['id'];}delete _0x224f3a[_0xef61('0x5a')][_0xef61('0x29')];return db[_0xef61('0x3d')][_0xef61('0x32')]({'where':{'id':_0x224f3a[_0xef61('0x4f')]['id']}})[_0xef61('0x16')](handleEntityNotFound(_0x525a5e,null))[_0xef61('0x16')](saveUpdates(_0x224f3a[_0xef61('0x5a')],null))['then'](respondWithResult(_0x525a5e,null))[_0xef61('0x1f')](handleError(_0x525a5e,null));};exports['describe']=function(_0x503e8c,_0x4386a7){return db[_0xef61('0x3d')][_0xef61('0x5b')]()[_0xef61('0x16')](respondWithResult(_0x4386a7,null))[_0xef61('0x1f')](handleError(_0x4386a7,null));};exports[_0xef61('0x5c')]=function(_0x5e98a9,_0x4c7a9a){return db[_0xef61('0x3d')][_0xef61('0x32')]({'where':{'id':_0x5e98a9[_0xef61('0x4f')]['id']}})[_0xef61('0x16')](handleEntityNotFound(_0x4c7a9a,null))[_0xef61('0x16')](function(_0x3ae98c){if(_0x3ae98c){return _0x3ae98c[_0xef61('0x5c')](_0x5e98a9[_0xef61('0x5a')][_0xef61('0x5d')],_[_0xef61('0x5e')](_0x5e98a9[_0xef61('0x5a')],['ids','id'])||{});}})[_0xef61('0x16')](respondWithResult(_0x4c7a9a,null))[_0xef61('0x1f')](handleError(_0x4c7a9a,null));};function validateUser(_0x485945){return new BPromise(function(_0x4559a6,_0x1856ee){if(_0x485945[_0xef61('0x5f')])return _0x4559a6(_0x485945);return db[_0xef61('0x60')][_0xef61('0x61')](0x1)[_0xef61('0x16')](function(_0x3e4678){if(_0x3e4678[_0xef61('0x62')])authService['validatePasswordPattern'](_0x485945[_0xef61('0x3a')]);db['User']['max']('internal')[_0xef61('0x16')](function(_0x205f80){if(_[_0xef61('0x63')](_0x205f80)){_0x485945['internal']=_0x3e4678[_0xef61('0x64')]||0x1;return;}if(_[_0xef61('0x63')](_0x3e4678[_0xef61('0x64')])||_0x3e4678[_0xef61('0x64')]===_0x205f80){_0x485945[_0xef61('0x5f')]=_0x205f80+0x1;return;}if(_0x3e4678[_0xef61('0x64')]>_0x205f80){_0x485945[_0xef61('0x5f')]=_0x3e4678[_0xef61('0x64')];return;}return db[_0xef61('0x65')][_0xef61('0x3e')](_0xef61('0x66'),{'type':db[_0xef61('0x65')][_0xef61('0x67')][_0xef61('0x68')]})[_0xef61('0x16')](function(_0x5931a4){if(_0x5931a4&&_0x5931a4[_0xef61('0x45')]){for(var _0x117d37=0x0,_0x529a78=_0x5931a4[_0xef61('0x45')];_0x117d37<_0x529a78&&_[_0xef61('0x63')](_0x485945[_0xef61('0x5f')]);_0x117d37++){if(_0x3e4678[_0xef61('0x64')]<=_0x5931a4[_0x117d37][_0xef61('0x69')]){_0x485945[_0xef61('0x5f')]=_0x5931a4[_0x117d37]['from'];}else if(_0x3e4678[_0xef61('0x64')]>_0x5931a4[_0x117d37][_0xef61('0x69')]&&_0x3e4678['min_internal']<=_0x5931a4[_0x117d37]['to']){_0x485945[_0xef61('0x5f')]=_0x3e4678['min_internal'];}}}if(_[_0xef61('0x63')](_0x485945[_0xef61('0x5f')])){_0x485945['internal']=_0x205f80+0x1;}return _0x4559a6(_0x485945);});});})[_0xef61('0x1f')](function(_0x512415){_0x1856ee(_0x512415);});});}function updateUser(_0x3cba7f){return new BPromise(function(_0x3f9882,_0x4c880e){try{if(_0x3cba7f['voicemail']){_0x3cba7f[_0xef61('0x6a')]=_0x3cba7f[_0xef61('0x5f')];_0x3cba7f[_0xef61('0x6b')]={'mailbox':_0x3cba7f[_0xef61('0x5f')],'password':_0x3cba7f[_0xef61('0x3a')],'fullname':_0x3cba7f['fullname'],'email':_0x3cba7f[_0xef61('0x6c')]};}if(_0x3cba7f[_0xef61('0x29')]===_0xef61('0x6d')){if(!_0x3cba7f[_0xef61('0x6e')])_0x3cba7f[_0xef61('0x6e')]=[_0xef61('0x6f'),'102',_0xef61('0x70'),'113',_0xef61('0x71'),_0xef61('0x72'),_0xef61('0x73'),_0xef61('0x74'),_0xef61('0x75'),_0xef61('0x76'),_0xef61('0x77'),_0xef61('0x78'),_0xef61('0x79'),_0xef61('0x7a'),_0xef61('0x7b')];}_0x3f9882(_0x3cba7f);}catch(_0x253b51){_0x4c880e(_0x253b51);}});}exports[_0xef61('0x7c')]=function(_0x5c2166,_0x3f4ff8){if(_0x5c2166[_0xef61('0x2b')][_0xef61('0x29')]===_0xef61('0x6d'))throw new Error('Unauthorized');if(_0x5c2166[_0xef61('0x5a')]['role']==='user'&&_0x5c2166[_0xef61('0x2b')]['role']!==_0xef61('0x2a')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x5c2166['body'][_0xef61('0x29')]===_0xef61('0x2a')&&_0x5c2166['user'][_0xef61('0x29')]!=='admin'){throw new Error(_0xef61('0x7d'));}return licenseUtil[_0xef61('0x7e')]([_0x5c2166[_0xef61('0x5a')]])[_0xef61('0x16')](function(){return validateUser(_0x5c2166['body']);})[_0xef61('0x16')](function(_0x59813e){return updateUser(_0x59813e)[_0xef61('0x16')](function(_0x2ddf83){if(_0x2ddf83[_0xef61('0x29')]===_0xef61('0x2a')){_0x2ddf83[_0xef61('0x7f')]=_0x5c2166[_0xef61('0x2b')][_0xef61('0x7f')];delete _0x2ddf83[_0xef61('0x80')];}return _0x2ddf83;});})[_0xef61('0x16')](function(_0x540b68){return db[_0xef61('0x3d')]['create'](_0x540b68,{'include':[{'model':db[_0xef61('0x6b')],'as':_0xef61('0x6b')}]});})['then'](function(_0x43eb12){if(_0x5c2166['body']['role']===_0xef61('0x2b'))return _0x43eb12;if(_0x5c2166[_0xef61('0x2b')]['role']!==_0xef61('0x2b'))return _0x43eb12;return db[_0xef61('0x81')]['find']({'where':{'name':_0x43eb12[_0xef61('0x29')]===_0xef61('0x6d')?'Agents':_0xef61('0x2d'),'userProfileId':_0x5c2166['user'][_0xef61('0x80')]},'raw':!![]})[_0xef61('0x16')](function(_0x1d0dd8){if(!_0x1d0dd8||_0x1d0dd8[_0xef61('0x82')]!=0x0)return _0x43eb12;return db['UserProfileResource'][_0xef61('0x7c')]({'name':_0x43eb12[_0xef61('0x33')],'resourceId':_0x43eb12['id'],'type':_0x1d0dd8[_0xef61('0x33')],'sectionId':_0x1d0dd8['id']},{})['then'](function(){return _0x43eb12;});})[_0xef61('0x1f')](function(_0x2a0edb){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a0edb);throw _0x2a0edb;});})[_0xef61('0x16')](respondWithResult(_0x3f4ff8,0xc9))[_0xef61('0x1f')](handleError(_0x3f4ff8,null));};exports[_0xef61('0x83')]=function(_0x3d829e,_0x15ddb0){var _0x1b3b78=_0x3d829e[_0xef61('0x5a')];var _0x113f9c=[];if(_0x3d829e[_0xef61('0x2b')][_0xef61('0x29')]===_0xef61('0x6d'))throw new Error(_0xef61('0x84'));if(_[_0xef61('0x85')](_0x1b3b78,[_0xef61('0x29'),_0xef61('0x2b')])&&_0x3d829e[_0xef61('0x2b')]['role']!==_0xef61('0x2a')){throw new Error(_0xef61('0x86'));}if(_[_0xef61('0x85')](_0x1b3b78,[_0xef61('0x29'),_0xef61('0x2a')])&&_0x3d829e[_0xef61('0x2b')][_0xef61('0x29')]!==_0xef61('0x2a')){throw new Error(_0xef61('0x87'));}return licenseUtil[_0xef61('0x7e')](_0x1b3b78)[_0xef61('0x16')](function(){return validateUser(_0x1b3b78[0x0]);})[_0xef61('0x16')](function(){for(var _0x4e8a39=0x1;_0x4e8a39<_0x1b3b78[_0xef61('0x45')];_0x4e8a39++){var _0xe465b9=_0x1b3b78[_0x4e8a39-0x1]['internal'];if(!_0x1b3b78[_0x4e8a39][_0xef61('0x5f')])_0x1b3b78[_0x4e8a39][_0xef61('0x5f')]=_0xe465b9+0x1;_0x113f9c[_0xef61('0x40')](validateUser(_0x1b3b78[_0x4e8a39]));}return BPromise[_0xef61('0x4d')](_0x113f9c);})[_0xef61('0x16')](function(){_0x113f9c=[];for(var _0x51a988=0x0;_0x51a988<_0x1b3b78[_0xef61('0x45')];_0x51a988++){_0x113f9c['push'](updateUser(_0x1b3b78[_0x51a988]));}return BPromise[_0xef61('0x4d')](_0x113f9c);})[_0xef61('0x16')](function(){return BPromise[_0xef61('0x88')](_0x1b3b78,function(_0x19b1a0){return db[_0xef61('0x3d')][_0xef61('0x7c')](_0x19b1a0,{'include':[{'model':db[_0xef61('0x6b')],'as':_0xef61('0x6b')}]})['then'](function(_0x3f68db){_0x19b1a0['id']=_0x3f68db['id'];return _0x19b1a0;});});})[_0xef61('0x16')](function(_0x28f142){if(_0x3d829e[_0xef61('0x5a')][_0xef61('0x29')]===_0xef61('0x2b'))return _0x28f142;if(_0x3d829e[_0xef61('0x2b')][_0xef61('0x29')]!==_0xef61('0x2b'))return _0x28f142;var _0x53678e=_[_0xef61('0x85')](_0x28f142,function(_0xe57b4d){return _0xe57b4d[_0xef61('0x29')]===_0xef61('0x6d')||_0xe57b4d['role']==='telephone';});if(!_0x53678e)return _0x28f142;return db[_0xef61('0x81')][_0xef61('0x41')]({'where':{'name':{'$or':[_0xef61('0x2c'),_0xef61('0x2d')]},'userProfileId':_0x3d829e[_0xef61('0x2b')][_0xef61('0x80')]},'raw':!![]})[_0xef61('0x16')](function(_0x4c2d94){if(_[_0xef61('0x89')](_0x4c2d94)||!_[_0xef61('0x85')](_0x4c2d94,[_0xef61('0x82'),0x0]))return _0x28f142;_0x113f9c=[];var _0x22e342=_(_0x4c2d94)[_0xef61('0x2f')](function(_0x4fa56b){if(_0x4fa56b[_0xef61('0x82')]===0x1)return;return _0x4fa56b['name']===_0xef61('0x2c')?_0xef61('0x6d'):_0xef61('0x8a');})[_0xef61('0x8b')]()[_0xef61('0x30')]();for(var _0xa23aa9=0x0;_0xa23aa9<_0x28f142['length'];_0xa23aa9++){if(!_[_0xef61('0x31')](_0x22e342,_0x28f142[_0xa23aa9][_0xef61('0x29')]))return;var _0xc67b1b=_0x28f142[_0xa23aa9][_0xef61('0x29')]===_0xef61('0x6d')?_0xef61('0x2c'):_0xef61('0x2d');_0x113f9c['push'](db[_0xef61('0x34')][_0xef61('0x7c')]({'name':_0x28f142[_0xa23aa9][_0xef61('0x33')],'resourceId':_0x28f142[_0xa23aa9]['id'],'type':_0xc67b1b,'sectionId':_['find'](_0x4c2d94,['name',_0xc67b1b])['id']},{}));}return BPromise[_0xef61('0x4d')](_0x113f9c);});})[_0xef61('0x16')](respondWithResult(_0x15ddb0,0xc9))['catch'](handleError(_0x15ddb0,null));};exports[_0xef61('0x8c')]=function(_0x1a9418,_0x30e931){if(_0x1a9418[_0xef61('0x5a')]['id']){delete _0x1a9418[_0xef61('0x5a')]['id'];}return db[_0xef61('0x3d')][_0xef61('0x32')]({'where':{'id':_0x1a9418[_0xef61('0x4f')]['id']}})['then'](function(_0x321b02){if(!_0x321b02)return null;if(_0x321b02['id']===_0x1a9418[_0xef61('0x2b')]['id']){if(!_0x1a9418[_0xef61('0x5a')][_0xef61('0x8d')]||!_0x1a9418[_0xef61('0x5a')]['newPassword']){throw new db[(_0xef61('0x8e'))]['ValidationError'](_0xef61('0x8f'));}if(!_0x321b02[_0xef61('0x90')](_0x1a9418[_0xef61('0x5a')]['oldPassword'])){throw new db['Sequelize'][(_0xef61('0x91'))](_0xef61('0x92'));}if(_0x1a9418['body']['oldPassword']===_0x1a9418[_0xef61('0x5a')][_0xef61('0x93')]){throw new db[(_0xef61('0x8e'))][(_0xef61('0x91'))](_0xef61('0x94'));}}else if(_0x1a9418[_0xef61('0x2b')][_0xef61('0x29')]===_0xef61('0x2a')){if(!_0x1a9418[_0xef61('0x5a')][_0xef61('0x93')]){throw new db[(_0xef61('0x8e'))]['ValidationError'](_0xef61('0x95'));}}else if(_0x1a9418[_0xef61('0x2b')]['role']===_0xef61('0x2b')){if(!_0x1a9418[_0xef61('0x5a')][_0xef61('0x93')]){throw new db[(_0xef61('0x8e'))][(_0xef61('0x91'))](_0xef61('0x95'));}if(_0x321b02['role']!==_0xef61('0x6d')){throw new db[(_0xef61('0x8e'))][(_0xef61('0x91'))](_0xef61('0x84'));}}else{throw new db[(_0xef61('0x8e'))][(_0xef61('0x91'))]('Unauthorized');}return _0x321b02;})['then'](handleEntityNotFound(_0x30e931,null))[_0xef61('0x16')](function(_0x13d2f4){return db[_0xef61('0x60')][_0xef61('0x96')]({'attributes':['id',_0xef61('0x62'),_0xef61('0x97'),_0xef61('0x98')]})['then'](function(_0x569dc7){if(_0x569dc7[_0xef61('0x62')])authService[_0xef61('0x99')](_0x1a9418[_0xef61('0x5a')][_0xef61('0x93')]);if(!_0x569dc7[_0xef61('0x97')]||!_0x13d2f4['previousPasswords'])return _0x13d2f4;authService[_0xef61('0x9a')](_0x1a9418['body'][_0xef61('0x93')],_0x13d2f4['previousPasswords'],_0x569dc7[_0xef61('0x98')]);return _0x13d2f4;})['then'](saveUpdates({'password':_0x1a9418['body'][_0xef61('0x93')],'passwordResetAt':_0x1a9418[_0xef61('0x2b')]['id']==_0x1a9418[_0xef61('0x4f')]['id']?moment():null,'previousPasswords':authService[_0xef61('0x9b')](_0x1a9418[_0xef61('0x5a')]['newPassword'],_0x13d2f4['previousPasswords'])},null));})['then'](respondWithResult(_0x30e931,null))[_0xef61('0x1f')](handleError(_0x30e931,null));};exports['addQueues']=function(_0x35155e,_0x132875){var _0x2ba1e7=_0x35155e[_0xef61('0x5a')][_0xef61('0x9c')];return db[_0xef61('0x3d')][_0xef61('0x32')]({'where':{'id':_0x35155e['params']['id']},'attributes':['id',_0xef61('0x33'),'role',_0xef61('0x9d'),_0xef61('0x9e'),_0xef61('0x9f'),_0xef61('0xa0')]})['then'](handleEntityNotFound(_0x132875,null))[_0xef61('0x16')](function(_0x45c0f4){if(_0x45c0f4){if(!utils[_0xef61('0xa1')](_0x2ba1e7)){throw new db['Sequelize']['ValidationError'](_0xef61('0xa2'));}return _0x45c0f4[_0xef61('0xa3')+_['capitalize'](_0x2ba1e7[_0xef61('0xa4')]())+_0xef61('0xa5')](_0x35155e['body']['ids'],{'penalty':_0x35155e[_0xef61('0x5a')][_0xef61('0xa6')]||0x0})['spread'](function(_0x1090ba){for(var _0x5d2765=0x0;_0x5d2765<_0x35155e[_0xef61('0x5a')]['ids'][_0xef61('0x45')];_0x5d2765+=0x1){var _0x4be6f2={'UserId':Number(_0x35155e[_0xef61('0x4f')]['id'])};_0x4be6f2[_['capitalize'](_0x2ba1e7[_0xef61('0xa4')]())+_0xef61('0xa7')]=Number(_0x35155e['body'][_0xef61('0x5d')][_0x5d2765]);socket[_0xef61('0xa8')](_0xef61('0x2b')+_['capitalize'](_0x2ba1e7['toLowerCase']())+_0xef61('0xa9'),_0x4be6f2);}return _0x1090ba;})[_0xef61('0x16')](function(){if(_0x2ba1e7==='voice'){return db['VoiceQueue'][_0xef61('0x41')]({'where':{'id':_0x35155e[_0xef61('0x5a')]['ids']||[]},'raw':!![],'attributes':['id',_0xef61('0x33')]});}})['then'](function(_0x3dc1f2){var _0x87fe0e=_0x45c0f4[_0xef61('0xaa')]({'plain':!![]});var _0x128ddc=[];if(_0x2ba1e7===_0xef61('0xab')&&_0x87fe0e[_0xef61('0x29')]==='agent'&&_0x87fe0e['online']){for(var _0x780325=0x0;_0x780325<_0x3dc1f2[_0xef61('0x45')];_0x780325+=0x1){_0x128ddc[_0xef61('0x40')]({'membername':_0x87fe0e[_0xef61('0x33')],'UserId':_0x87fe0e['id'],'queue_name':_0x3dc1f2[_0x780325][_0xef61('0x33')],'VoiceQueueId':_0x3dc1f2[_0x780325]['id'],'interface':_[_0xef61('0x63')](_0x87fe0e[_0xef61('0xa0')])?util[_0xef61('0xac')]('SIP/%s',_0x87fe0e[_0xef61('0x33')]):_0x87fe0e[_0xef61('0xa0')],'paused':_0x87fe0e[_0xef61('0x9f')]||![],'penalty':_0x35155e[_0xef61('0x5a')][_0xef61('0xa6')]||0x0});}return BPromise[_0xef61('0x88')](_0x128ddc,function(_0x6b01f9){return db['UserVoiceQueueRt'][_0xef61('0xad')](_0x6b01f9);});}return _0x45c0f4;});}})[_0xef61('0x16')](respondWithStatusCode(_0x132875,null))[_0xef61('0x1f')](handleError(_0x132875,null));};exports[_0xef61('0xae')]=function(_0x318887,_0x3f77d1){var _0x4216f8;return db['User'][_0xef61('0x32')]({'where':{'id':_0x318887[_0xef61('0x4f')]['id']},'attributes':['id',_0xef61('0x33'),_0xef61('0x29')]})[_0xef61('0x16')](handleEntityNotFound(_0x3f77d1,null))[_0xef61('0x16')](function(_0x3ef5fd){if(_0x3ef5fd){_0x4216f8=_0x3ef5fd;if(!_0x318887['query'][_0xef61('0x9c')]||!utils[_0xef61('0xa1')](_0x318887['query']['channel'])){throw new db['Sequelize'][(_0xef61('0x91'))](_0xef61('0xa2'));}return _0x3ef5fd[_0xef61('0xaf')+_['capitalize'](_0x318887[_0xef61('0x3e')][_0xef61('0x9c')][_0xef61('0xa4')]())+_0xef61('0xa5')](_0x318887['query'][_0xef61('0x5d')]);}})[_0xef61('0x16')](function(_0x23a826){if(_[_0xef61('0xb0')](_0x318887[_0xef61('0x3e')]['ids'])){for(var _0x471206=0x0;_0x471206<_0x318887[_0xef61('0x3e')][_0xef61('0x5d')][_0xef61('0x45')];_0x471206+=0x1){var _0x223514={'UserId':Number(_0x318887[_0xef61('0x4f')]['id'])};_0x223514[_[_0xef61('0xb1')](_0x318887[_0xef61('0x3e')][_0xef61('0x9c')][_0xef61('0xa4')]())+_0xef61('0xa7')]=Number(_0x318887['query'][_0xef61('0x5d')][_0x471206]);socket['emit']('user'+_['capitalize'](_0x318887['query'][_0xef61('0x9c')][_0xef61('0xa4')]())+_0xef61('0xb2'),_0x223514);}}else{var _0x223514={'UserId':Number(_0x318887[_0xef61('0x4f')]['id'])};_0x223514[_['capitalize'](_0x318887['query'][_0xef61('0x9c')]['toLowerCase']())+_0xef61('0xa7')]=Number(_0x318887[_0xef61('0x3e')][_0xef61('0x5d')]);socket['emit'](_0xef61('0x2b')+_[_0xef61('0xb1')](_0x318887[_0xef61('0x3e')][_0xef61('0x9c')][_0xef61('0xa4')]())+_0xef61('0xb2'),_0x223514);}return _0x23a826;})['then'](function(){if(_0x318887[_0xef61('0x3e')][_0xef61('0x9c')]===_0xef61('0xab')){return db[_0xef61('0xb3')]['destroy']({'where':{'UserId':_0x318887['params']['id'],'VoiceQueueId':_0x318887[_0xef61('0x3e')][_0xef61('0x5d')]},'individualHooks':!![]})[_0xef61('0x16')](function(){return _0x4216f8;});}return _0x4216f8;})['then'](respondWithStatusCode(_0x3f77d1,null))[_0xef61('0x1f')](handleError(_0x3f77d1,null));};exports[_0xef61('0xb4')]=function(_0x527c04,_0x3a40e9){_0x527c04[_0xef61('0x5a')]['userpic']=_0x527c04[_0xef61('0xb5')][_0xef61('0xb6')];return db[_0xef61('0x3d')][_0xef61('0x32')]({'where':{'id':_0x527c04[_0xef61('0x4f')]['id']}})[_0xef61('0x16')](handleEntityNotFound(_0x3a40e9,null))[_0xef61('0x16')](saveUpdates(_0x527c04['body'],null))[_0xef61('0x16')](respondWithResult(_0x3a40e9,null))[_0xef61('0x1f')](handleError(_0x3a40e9,null));};exports['getAvatar']=function(_0xf43ed,_0x50ca36){var _0x38e790=path[_0xef61('0xb7')](config[_0xef61('0xb8')],_0xef61('0xb9'));return db[_0xef61('0x3d')][_0xef61('0x32')]({'where':{'id':_0xf43ed[_0xef61('0x4f')]['id']},'attributes':['id',_0xef61('0xba')],'raw':!![]})['then'](handleEntityNotFound(_0x50ca36,null))[_0xef61('0x16')](function(_0x392cb9){if(_0x392cb9){if(_['isNil'](_0x392cb9[_0xef61('0xba')])){return _0x50ca36[_0xef61('0xbb')](_0x38e790);}else{if(!fs[_0xef61('0xbc')](path['join'](config[_0xef61('0xb8')],_0xef61('0xbd'),_0x392cb9['userpic']))){return _0x50ca36[_0xef61('0xbb')](_0x38e790);}return _0x50ca36['download'](path['join'](config[_0xef61('0xb8')],'server/files/images/',_0x392cb9[_0xef61('0xba')]));}}})[_0xef61('0x1f')](handleError(_0x50ca36,null));};exports[_0xef61('0xbe')]=function(_0x3bf8a9,_0x227940){return db[_0xef61('0x3d')][_0xef61('0x32')]({'where':{'id':_0x3bf8a9[_0xef61('0x4f')]['id']},'attributes':['id']})[_0xef61('0x16')](handleEntityNotFound(_0x227940,null))[_0xef61('0x16')](function(_0x2998f1){var _0x57fa3e=[];values=_0x2998f1[_0xef61('0x47')];_0x57fa3e[_0xef61('0x40')](get_open_tabs(_0xef61('0x46'),_0x2998f1[_0xef61('0x47')]));_0x57fa3e[_0xef61('0x40')](get_open_tabs(_0xef61('0x48'),_0x2998f1[_0xef61('0x47')]));_0x57fa3e[_0xef61('0x40')](get_open_tabs(_0xef61('0x4b'),_0x2998f1['dataValues']));_0x57fa3e[_0xef61('0x40')](get_open_tabs(_0xef61('0x4c'),_0x2998f1[_0xef61('0x47')]));_0x57fa3e[_0xef61('0x40')](get_open_tabs(_0xef61('0x49'),_0x2998f1[_0xef61('0x47')]));_0x57fa3e[_0xef61('0x40')](get_open_tabs(_0xef61('0x4a'),_0x2998f1[_0xef61('0x47')]));return BPromise[_0xef61('0x4d')](_0x57fa3e);})['then'](function(_0x54bad6){var _0x4fb086=[];if(_0x54bad6){for(var _0x432f67=0x0;_0x432f67=_0x21ca0b['agents']){throw new Error(_0x54d0('0x51'));}})[_0x54d0('0x10')](function(){if(_0x20d412){return db['UserVoiceQueueRt'][_0x54d0('0x4a')]({'where':{'membername':_0x20d412[_0x54d0('0x2d')]},'individualHooks':!![]});}})['then'](function(){if(_0x20d412){return _0x20d412['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x1561b2){if(_0x20d412){if(_0x1561b2){var _0x40f047=[];_0x6bdb33=_0x1561b2;if(_0x6bdb33[_0x54d0('0x2f')]){for(var _0xc146b8=0x0;_0xc146b8<_0x6bdb33[_0x54d0('0x2f')];_0xc146b8++){_0x40f047['push'](db[_0x54d0('0x2b')]['upsert']({'membername':_0x20d412[_0x54d0('0x2d')],'UserId':_0x20d412['id'],'queue_name':_0x6bdb33[_0xc146b8]['name'],'VoiceQueueId':_0x6bdb33[_0xc146b8]['id'],'interface':_0x31b743,'paused':_0x20d412[_0x54d0('0x52')]||![],'penalty':_0x6bdb33[_0xc146b8][_0x54d0('0x53')]||0x0}));}return BPromise[_0x54d0('0x48')](_0x40f047);}}}})[_0x54d0('0x10')](function(){if(_0x20d412){return db[_0x54d0('0x2c')][_0x54d0('0x1c')]({'where':{'membername':_0x20d412[_0x54d0('0x2d')],'exitAt':null}});}})['then'](function(_0x3cf5b9){if(_0x20d412){if(_0x3cf5b9&&_0x3cf5b9[_0x54d0('0x2f')]){var _0x4523f8=[];_0x3cf5b9['forEach'](function(_0x136ac2){_0x4523f8[_0x54d0('0x34')](_0x136ac2[_0x54d0('0x3f')]({'exitAt':moment()['format'](_0x54d0('0x31'))}));});return BPromise[_0x54d0('0x48')](_0x4523f8);}}})[_0x54d0('0x10')](function(_0x39090c){if(_0x20d412){var _0x28988e=[];var _0x3ffa3a=[];var _0x4945c5=utils[_0x54d0('0x54')]();var _0x2d426b={'membername':_0x20d412[_0x54d0('0x2d')],'interface':_0x31b743,'enterAt':moment()[_0x54d0('0x30')](_0x54d0('0x31')),'role':_0x20d412[_0x54d0('0x29')],'internal':_0x20d412['internal']};_0x4945c5[_0x54d0('0x33')](function(_0x51bd4f){_0x28988e[_0x54d0('0x34')](_[_0x54d0('0x55')]({'channel':_0x51bd4f,'type':_0x54d0('0x56'),'data1':_0x54d0('0x57'),'data2':_0x31b743},_0x2d426b));if(_0x20d412[_0x54d0('0x52')]){_0x3ffa3a['push'](_[_0x54d0('0x55')]({'channel':_0x51bd4f,'type':_0x54d0('0x2e'),'data1':_0x54d0('0x58')},_0x2d426b));}});return db[_0x54d0('0x2c')][_0x54d0('0x59')](_0x28988e[_0x54d0('0x5a')](_0x3ffa3a),{'individualHooks':!![]});}})[_0x54d0('0x10')](function(){if(_0x20d412){return _0x20d412['update']({'online':!![],'lastLoginAt':moment()[_0x54d0('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x20d412[_0x54d0('0x52')]||![],'mailPause':_0x20d412[_0x54d0('0x52')]||![],'chatPause':_0x20d412[_0x54d0('0x52')]||![],'faxPause':_0x20d412[_0x54d0('0x52')]||![],'smsPause':_0x20d412[_0x54d0('0x52')]||![],'openchannelPause':_0x20d412[_0x54d0('0x52')]||![],'pauseType':_0x20d412[_0x54d0('0x52')]?_0x54d0('0x58'):null,'lastPauseAt':moment()[_0x54d0('0x30')](_0x54d0('0x31')),'interface':_0x31b743});}})[_0x54d0('0x10')](function(_0x2a0c9e){_0x2b076c(_0x2a0c9e);})['catch'](function(_0x492815){_0x14b221(_0x41bba9[_0x54d0('0x16')](0x1f4,_0x492815['message']));});});}; \ No newline at end of file +var _0xf3fb=['getLicense','agents','destroy','upsert','merge','LOGIN','LOGININPAUSE','concat','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','register','request','then','info','User,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','GetUser','User','findAll','options','raw','where','limit','include','model','attributes','map','stringify','ShowUser','find','PauseUser','name','role','internal','interface','update','MemberReport','PAUSE','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','push','isNil','SIP/%s','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','UnpauseUser','findOne','channel','isValidChannel','Unknown\x20channel','voice','UserVoiceQueueRt','system','chat','sms','openchannel','whatsapp','set','%s%s','Pause','forEach','all','LogoutUser','LoginUser','mobile','loginInPause','agent','../../config/license/util'];(function(_0x48d0e0,_0x106d7d){var _0x52f631=function(_0x509b01){while(--_0x509b01){_0x48d0e0['push'](_0x48d0e0['shift']());}};_0x52f631(++_0x106d7d);}(_0xf3fb,0xba));var _0xbf3f=function(_0x378f89,_0x13f5c7){_0x378f89=_0x378f89-0x0;var _0x3239d5=_0xf3fb[_0x378f89];return _0x3239d5;};'use strict';var _=require(_0xbf3f('0x0'));var util=require(_0xbf3f('0x1'));var moment=require(_0xbf3f('0x2'));var BPromise=require(_0xbf3f('0x3'));var rs=require(_0xbf3f('0x4'));var fs=require('fs');var Redis=require(_0xbf3f('0x5'));var db=require(_0xbf3f('0x6'))['db'];var utils=require(_0xbf3f('0x7'));var logger=require(_0xbf3f('0x8'))('rpc');var config=require(_0xbf3f('0x9'));var jayson=require(_0xbf3f('0xa'));var client=jayson[_0xbf3f('0xb')][_0xbf3f('0xc')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./user.socket')[_0xbf3f('0xd')](socket);function respondWithRpcPromise(_0x516227,_0x25415a,_0x5bc6c7){return new BPromise(function(_0x4883ba,_0x400ff5){return client[_0xbf3f('0xe')](_0x516227,_0x5bc6c7)[_0xbf3f('0xf')](function(_0x4c6048){logger[_0xbf3f('0x10')](_0xbf3f('0x11'),_0x25415a,'request\x20sent');logger[_0xbf3f('0x12')]('User,\x20%s,\x20%s,\x20%s',_0x25415a,_0xbf3f('0x13'),JSON['stringify'](_0x4c6048));if(_0x4c6048['error']){if(_0x4c6048['error']['code']===0x1f4){logger[_0xbf3f('0x14')](_0xbf3f('0x11'),_0x25415a,_0x4c6048[_0xbf3f('0x14')][_0xbf3f('0x15')]);return _0x400ff5(_0x4c6048[_0xbf3f('0x14')][_0xbf3f('0x15')]);}logger[_0xbf3f('0x14')](_0xbf3f('0x11'),_0x25415a,_0x4c6048[_0xbf3f('0x14')][_0xbf3f('0x15')]);return _0x4883ba(_0x4c6048[_0xbf3f('0x14')][_0xbf3f('0x15')]);}else{logger[_0xbf3f('0x10')](_0xbf3f('0x11'),_0x25415a,_0xbf3f('0x13'));_0x4883ba(_0x4c6048[_0xbf3f('0x16')][_0xbf3f('0x15')]);}})[_0xbf3f('0x17')](function(_0xb76bc3){logger[_0xbf3f('0x14')](_0xbf3f('0x11'),_0x25415a,_0xb76bc3);_0x400ff5(_0xb76bc3);});});}exports[_0xbf3f('0x18')]=function(_0x5cb75e){var _0x4d5079=this;return new Promise(function(_0x3e4eff,_0x444be0){return db[_0xbf3f('0x19')][_0xbf3f('0x1a')]({'raw':_0x5cb75e[_0xbf3f('0x1b')]?_0x5cb75e[_0xbf3f('0x1b')][_0xbf3f('0x1c')]===undefined?!![]:![]:!![],'where':_0x5cb75e[_0xbf3f('0x1b')]?_0x5cb75e['options'][_0xbf3f('0x1d')]||null:null,'attributes':_0x5cb75e['options']?_0x5cb75e[_0xbf3f('0x1b')]['attributes']||null:null,'limit':_0x5cb75e[_0xbf3f('0x1b')]?_0x5cb75e[_0xbf3f('0x1b')][_0xbf3f('0x1e')]||null:null,'include':_0x5cb75e[_0xbf3f('0x1b')]?_0x5cb75e['options'][_0xbf3f('0x1f')]?_['map'](_0x5cb75e[_0xbf3f('0x1b')][_0xbf3f('0x1f')],function(_0x170b02){return{'model':db[_0x170b02[_0xbf3f('0x20')]],'as':_0x170b02['as'],'attributes':_0x170b02[_0xbf3f('0x21')],'include':_0x170b02[_0xbf3f('0x1f')]?_[_0xbf3f('0x22')](_0x170b02[_0xbf3f('0x1f')],function(_0x47adf5){return{'model':db[_0x47adf5['model']],'as':_0x47adf5['as'],'attributes':_0x47adf5['attributes'],'include':_0x47adf5[_0xbf3f('0x1f')]?_[_0xbf3f('0x22')](_0x47adf5[_0xbf3f('0x1f')],function(_0x14023b){return{'model':db[_0x14023b[_0xbf3f('0x20')]],'as':_0x14023b['as'],'attributes':_0x14023b[_0xbf3f('0x21')]};}):[]};}):[]};}):[]:[]})[_0xbf3f('0xf')](function(_0x47c49e){logger['info'](_0xbf3f('0x18'),_0x5cb75e);logger[_0xbf3f('0x12')](_0xbf3f('0x18'),_0x5cb75e,JSON[_0xbf3f('0x23')](_0x47c49e));_0x3e4eff(_0x47c49e);})[_0xbf3f('0x17')](function(_0x5704cb){logger[_0xbf3f('0x14')](_0xbf3f('0x18'),_0x5704cb['message'],_0x5cb75e);_0x444be0(_0x4d5079[_0xbf3f('0x14')](0x1f4,_0x5704cb['message']));});});};exports[_0xbf3f('0x24')]=function(_0x4ca712){var _0x2d6e81=this;return new Promise(function(_0xc984f8,_0x185a1c){return db[_0xbf3f('0x19')][_0xbf3f('0x25')]({'raw':_0x4ca712[_0xbf3f('0x1b')]?_0x4ca712[_0xbf3f('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4ca712[_0xbf3f('0x1b')]?_0x4ca712[_0xbf3f('0x1b')][_0xbf3f('0x1d')]||null:null,'attributes':_0x4ca712[_0xbf3f('0x1b')]?_0x4ca712['options'][_0xbf3f('0x21')]||null:null,'include':_0x4ca712[_0xbf3f('0x1b')]?_0x4ca712[_0xbf3f('0x1b')]['include']?_[_0xbf3f('0x22')](_0x4ca712['options'][_0xbf3f('0x1f')],function(_0x46ebda){return{'model':db[_0x46ebda[_0xbf3f('0x20')]],'as':_0x46ebda['as'],'attributes':_0x46ebda[_0xbf3f('0x21')],'include':_0x46ebda[_0xbf3f('0x1f')]?_['map'](_0x46ebda[_0xbf3f('0x1f')],function(_0x2b269f){return{'model':db[_0x2b269f[_0xbf3f('0x20')]],'as':_0x2b269f['as'],'attributes':_0x2b269f['attributes'],'include':_0x2b269f[_0xbf3f('0x1f')]?_[_0xbf3f('0x22')](_0x2b269f[_0xbf3f('0x1f')],function(_0x193378){return{'model':db[_0x193378[_0xbf3f('0x20')]],'as':_0x193378['as'],'attributes':_0x193378[_0xbf3f('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f52b9){logger['info'](_0xbf3f('0x24'),_0x4ca712);logger['debug'](_0xbf3f('0x24'),_0x4ca712,JSON[_0xbf3f('0x23')](_0x2f52b9));_0xc984f8(_0x2f52b9);})[_0xbf3f('0x17')](function(_0x4920ef){logger[_0xbf3f('0x14')]('ShowUser',_0x4920ef[_0xbf3f('0x15')],_0x4ca712);_0x185a1c(_0x2d6e81['error'](0x1f4,_0x4920ef['message']));});});};exports[_0xbf3f('0x26')]=function(_0x37a05a){var _0x628d11=this;return new Promise(function(_0x3474ab,_0x37630e){var _0x39705f;return db['User'][_0xbf3f('0x25')]({'where':_0x37a05a[_0xbf3f('0x1b')]['where']||{},'attributes':['id',_0xbf3f('0x27'),_0xbf3f('0x28'),_0xbf3f('0x29'),_0xbf3f('0x2a')]})[_0xbf3f('0xf')](function(_0xbe03c3){if(_0xbe03c3){_0x39705f=_0xbe03c3;return db['UserVoiceQueueRt'][_0xbf3f('0x2b')]({'paused':0x1},{'where':{'UserId':_0x39705f['id']},'individualHooks':!![]});}})[_0xbf3f('0xf')](function(){if(_0x39705f){return db[_0xbf3f('0x2c')]['findAll']({'where':{'membername':_0x39705f['name'],'type':_0xbf3f('0x2d'),'exitAt':null}});}})[_0xbf3f('0xf')](function(_0x384cde){if(_0x39705f){if(_0x384cde&&_0x384cde['length']){var _0x47f39d=moment()[_0xbf3f('0x2e')](_0xbf3f('0x2f'));for(var _0x5f2d56=0x0,_0x18666a=_0x384cde[_0xbf3f('0x30')];_0x5f2d56<_0x18666a;_0x5f2d56++){_0x384cde[_0x5f2d56][_0xbf3f('0x31')]({'exitAt':_0x47f39d});}}}})[_0xbf3f('0xf')](function(){if(_0x39705f){var _0x3ed527=[];var _0x558e1d=utils['getChannels']();_0x558e1d['forEach'](function(_0x287c36){_0x3ed527[_0xbf3f('0x32')]({'channel':_0x287c36,'membername':_0x39705f[_0xbf3f('0x27')],'interface':_[_0xbf3f('0x33')](_0x39705f[_0xbf3f('0x2a')])?util[_0xbf3f('0x2e')](_0xbf3f('0x34'),_0x39705f[_0xbf3f('0x27')]):_0x39705f[_0xbf3f('0x2a')],'type':'PAUSE','enterAt':moment()[_0xbf3f('0x2e')](_0xbf3f('0x2f')),'data1':_0x37a05a[_0xbf3f('0x35')][_0xbf3f('0x36')]||_0xbf3f('0x37'),'role':_0x39705f[_0xbf3f('0x28')],'internal':_0x39705f['internal'],'uniqueid':_0x37a05a['body'][_0xbf3f('0x38')]||null});});return db[_0xbf3f('0x2c')][_0xbf3f('0x39')](_0x3ed527,{'individualHooks':!![]});}})['then'](function(){if(_0x39705f){return _0x39705f['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x37a05a[_0xbf3f('0x35')][_0xbf3f('0x36')]||_0xbf3f('0x37'),'lastPauseAt':moment()[_0xbf3f('0x2e')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xbf3f('0xf')](function(_0x532b2f){_0x3474ab(_0x532b2f);})[_0xbf3f('0x17')](function(_0x4f37e1){_0x37630e(_0x628d11[_0xbf3f('0x14')](0x1f4,_0x4f37e1['message']));});});};exports[_0xbf3f('0x3a')]=function(_0x4cbf65){var _0x3fa40f=this;return new Promise(function(_0x234ab9,_0x57f54f){var _0x4966fe;return db['User'][_0xbf3f('0x3b')]({'where':_0x4cbf65[_0xbf3f('0x1b')]['where']||{},'attributes':['id',_0xbf3f('0x27')]})[_0xbf3f('0xf')](function(_0x173dab){if(_0x173dab){_0x4966fe=_0x173dab;if(_0x4cbf65[_0xbf3f('0x35')][_0xbf3f('0x3c')]&&!utils[_0xbf3f('0x3d')](_0x4cbf65[_0xbf3f('0x35')][_0xbf3f('0x3c')])){throw new Error(_0xbf3f('0x3e'));}switch(_0x4cbf65[_0xbf3f('0x35')][_0xbf3f('0x3c')]){case _0xbf3f('0x3f'):return db[_0xbf3f('0x40')][_0xbf3f('0x2b')]({'paused':0x0},{'where':{'UserId':_0x4966fe['id']}})[_0xbf3f('0xf')](function(){return db[_0xbf3f('0x2c')][_0xbf3f('0x25')]({'where':{'channel':_0x4cbf65['body'][_0xbf3f('0x3c')],'membername':_0x4966fe[_0xbf3f('0x27')],'type':_0xbf3f('0x2d'),'exitAt':null}});})[_0xbf3f('0xf')](function(_0x27d286){if(_0x27d286){return _0x27d286[_0xbf3f('0x2b')]({'exitAt':moment()[_0xbf3f('0x2e')](_0xbf3f('0x2f')),'data2':_0xbf3f('0x41')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x4966fe[_0xbf3f('0x2b')]({'voicePause':![]});});case'mail':case _0xbf3f('0x42'):case'fax':case _0xbf3f('0x43'):case _0xbf3f('0x44'):case _0xbf3f('0x45'):return db[_0xbf3f('0x2c')]['find']({'where':{'channel':_0x4cbf65['body']['channel'],'membername':_0x4966fe[_0xbf3f('0x27')],'type':_0xbf3f('0x2d'),'exitAt':null}})[_0xbf3f('0xf')](function(_0x15e93b){return _0x15e93b[_0xbf3f('0x2b')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xbf3f('0x41')},{'individualHooks':!![]});})[_0xbf3f('0xf')](function(){var _0x2490c2={};_[_0xbf3f('0x46')](_0x2490c2,util['format'](_0xbf3f('0x47'),_0x4cbf65[_0xbf3f('0x35')][_0xbf3f('0x3c')],_0xbf3f('0x48')),![]);return _0x4966fe[_0xbf3f('0x2b')](_0x2490c2);});default:return db[_0xbf3f('0x40')][_0xbf3f('0x2b')]({'paused':0x0},{'where':{'UserId':_0x4966fe['id']}})[_0xbf3f('0xf')](function(){return db[_0xbf3f('0x2c')][_0xbf3f('0x1a')]({'where':{'membername':_0x4966fe[_0xbf3f('0x27')],'type':_0xbf3f('0x2d'),'exitAt':null}});})[_0xbf3f('0xf')](function(_0x489b6e){var _0x3f078d=[];_0x489b6e[_0xbf3f('0x49')](function(_0x2c254a){_0x3f078d[_0xbf3f('0x32')](_0x2c254a[_0xbf3f('0x2b')]({'exitAt':moment()[_0xbf3f('0x2e')](_0xbf3f('0x2f')),'data2':_0xbf3f('0x41')}));});return BPromise[_0xbf3f('0x4a')](_0x3f078d);})[_0xbf3f('0xf')](function(){return _0x4966fe[_0xbf3f('0x2b')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xbf3f('0xf')](function(_0x2b8c5b){_0x234ab9(_0x2b8c5b);})[_0xbf3f('0x17')](function(_0x1027be){_0x57f54f(_0x3fa40f[_0xbf3f('0x14')](0x1f4,_0x1027be[_0xbf3f('0x15')]));});});};exports[_0xbf3f('0x4b')]=function(_0x4288d9){var _0x5ea74f=this;return new Promise(function(_0xd98bc6,_0x1f6e06){var _0x10dbba;return db[_0xbf3f('0x19')][_0xbf3f('0x3b')]({'where':_0x4288d9[_0xbf3f('0x1b')][_0xbf3f('0x1d')]||{},'attributes':['id',_0xbf3f('0x27')]})[_0xbf3f('0xf')](function(_0x3d9a75){if(_0x3d9a75){_0x10dbba=_0x3d9a75;return db[_0xbf3f('0x40')]['destroy']({'where':{'membername':_0x10dbba[_0xbf3f('0x27')]},'individualHooks':!![]});}})[_0xbf3f('0xf')](function(){if(_0x10dbba){return db[_0xbf3f('0x2c')][_0xbf3f('0x1a')]({'where':{'membername':_0x10dbba[_0xbf3f('0x27')],'exitAt':null}});}})[_0xbf3f('0xf')](function(_0x382fed){if(_0x10dbba){if(_0x382fed&&_0x382fed[_0xbf3f('0x30')]){var _0x4fa185=[];_0x382fed[_0xbf3f('0x49')](function(_0x105859){_0x4fa185['push'](_0x105859[_0xbf3f('0x2b')]({'exitAt':moment()[_0xbf3f('0x2e')](_0xbf3f('0x2f'))}));});return BPromise[_0xbf3f('0x4a')](_0x4fa185);}}})['then'](function(){if(_0x10dbba){return _0x10dbba['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x36eb24){_0xd98bc6(_0x36eb24);})['catch'](function(_0x534d4d){_0x1f6e06(_0x5ea74f[_0xbf3f('0x14')](0x1f4,_0x534d4d[_0xbf3f('0x15')]));});});};exports[_0xbf3f('0x4c')]=function(_0x2a4dd2){var _0x2679d9=this;return new Promise(function(_0x27e888,_0x24a0c9){var _0x1c292d;var _0x4aff64;var _0x55f6b8;var _0x45c526;return db[_0xbf3f('0x19')]['findOne']({'where':_0x2a4dd2['options'][_0xbf3f('0x1d')]||{},'attributes':['id',_0xbf3f('0x27'),_0xbf3f('0x28'),_0xbf3f('0x4d'),'phone',_0xbf3f('0x29'),_0xbf3f('0x4e'),_0xbf3f('0x2a')]})['then'](function(_0x5a274e){if(_0x5a274e){_0x1c292d=_0x5a274e;_0x45c526=_0x2a4dd2[_0xbf3f('0x35')][_0xbf3f('0x2a')]?_0x2a4dd2[_0xbf3f('0x35')][_0xbf3f('0x2a')]:util[_0xbf3f('0x2e')]('SIP/%s',_0x1c292d['name']);return db[_0xbf3f('0x19')]['count']({'where':{'role':_0xbf3f('0x4f'),'online':!![],'id':{'$ne':_0x1c292d['id']}}});}})[_0xbf3f('0xf')](function(_0xc9436c){if(_0xc9436c){_0x55f6b8=_0xc9436c;return require(_0xbf3f('0x50'))[_0xbf3f('0x51')]();}})['then'](function(_0x5a2da4){if(_0x5a2da4&&_0x5a2da4[_0xbf3f('0x52')]&&_0x55f6b8>=_0x5a2da4['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0xbf3f('0xf')](function(){if(_0x1c292d){return db[_0xbf3f('0x40')][_0xbf3f('0x53')]({'where':{'membername':_0x1c292d[_0xbf3f('0x27')]},'individualHooks':!![]});}})[_0xbf3f('0xf')](function(){if(_0x1c292d){return _0x1c292d['getVoiceQueues']({'raw':!![]});}})[_0xbf3f('0xf')](function(_0x4b3cc1){if(_0x1c292d){if(_0x4b3cc1){var _0x34f259=[];_0x4aff64=_0x4b3cc1;if(_0x4aff64[_0xbf3f('0x30')]){for(var _0x5bdf1d=0x0;_0x5bdf1d<_0x4aff64[_0xbf3f('0x30')];_0x5bdf1d++){_0x34f259[_0xbf3f('0x32')](db[_0xbf3f('0x40')][_0xbf3f('0x54')]({'membername':_0x1c292d['name'],'UserId':_0x1c292d['id'],'queue_name':_0x4aff64[_0x5bdf1d][_0xbf3f('0x27')],'VoiceQueueId':_0x4aff64[_0x5bdf1d]['id'],'interface':_0x45c526,'paused':_0x1c292d['loginInPause']||![],'penalty':_0x4aff64[_0x5bdf1d]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xbf3f('0x4a')](_0x34f259);}}}})[_0xbf3f('0xf')](function(){if(_0x1c292d){return db['MemberReport'][_0xbf3f('0x1a')]({'where':{'membername':_0x1c292d[_0xbf3f('0x27')],'exitAt':null}});}})['then'](function(_0x2d06f3){if(_0x1c292d){if(_0x2d06f3&&_0x2d06f3[_0xbf3f('0x30')]){var _0x3a4780=[];_0x2d06f3[_0xbf3f('0x49')](function(_0x352dec){_0x3a4780['push'](_0x352dec[_0xbf3f('0x2b')]({'exitAt':moment()[_0xbf3f('0x2e')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xbf3f('0x4a')](_0x3a4780);}}})[_0xbf3f('0xf')](function(_0x1d2c45){if(_0x1c292d){var _0x3b1d28=[];var _0x3e7a24=[];var _0x256b2e=utils['getChannels']();var _0x49de38={'membername':_0x1c292d[_0xbf3f('0x27')],'interface':_0x45c526,'enterAt':moment()[_0xbf3f('0x2e')](_0xbf3f('0x2f')),'role':_0x1c292d[_0xbf3f('0x28')],'internal':_0x1c292d[_0xbf3f('0x29')]};_0x256b2e[_0xbf3f('0x49')](function(_0x35a649){_0x3b1d28[_0xbf3f('0x32')](_[_0xbf3f('0x55')]({'channel':_0x35a649,'type':_0xbf3f('0x56'),'data1':'callysquare','data2':_0x45c526},_0x49de38));if(_0x1c292d['loginInPause']){_0x3e7a24[_0xbf3f('0x32')](_[_0xbf3f('0x55')]({'channel':_0x35a649,'type':'PAUSE','data1':_0xbf3f('0x57')},_0x49de38));}});return db['MemberReport']['bulkCreate'](_0x3b1d28[_0xbf3f('0x58')](_0x3e7a24),{'individualHooks':!![]});}})['then'](function(){if(_0x1c292d){return _0x1c292d[_0xbf3f('0x2b')]({'online':!![],'lastLoginAt':moment()[_0xbf3f('0x2e')](_0xbf3f('0x2f')),'voicePause':_0x1c292d['loginInPause']||![],'mailPause':_0x1c292d[_0xbf3f('0x4e')]||![],'chatPause':_0x1c292d['loginInPause']||![],'faxPause':_0x1c292d[_0xbf3f('0x4e')]||![],'smsPause':_0x1c292d[_0xbf3f('0x4e')]||![],'openchannelPause':_0x1c292d['loginInPause']||![],'pauseType':_0x1c292d[_0xbf3f('0x4e')]?_0xbf3f('0x57'):null,'lastPauseAt':moment()[_0xbf3f('0x2e')](_0xbf3f('0x2f')),'interface':_0x45c526});}})[_0xbf3f('0xf')](function(_0x261994){_0x27e888(_0x261994);})[_0xbf3f('0x17')](function(_0x5d3732){_0x24a0c9(_0x2679d9[_0xbf3f('0x14')](0x1f4,_0x5d3732[_0xbf3f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 68acbac..7719404 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 _0x695e=['removeListener','register','length','user:','./user.events','save','remove','update','emit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x695e,0x94));var _0xe695=function(_0x2d7712,_0x39aba4){_0x2d7712=_0x2d7712-0x0;var _0x2efa08=_0x695e[_0x2d7712];return _0x2efa08;};'use strict';var UserEvents=require(_0xe695('0x0'));var events=[_0xe695('0x1'),_0xe695('0x2'),_0xe695('0x3')];function createListener(_0x4fa15e,_0x3d2797){return function(_0x2290b1){_0x3d2797[_0xe695('0x4')](_0x4fa15e,_0x2290b1);};}function removeListener(_0x99ba3d,_0x602df3){return function(){UserEvents[_0xe695('0x5')](_0x99ba3d,_0x602df3);};}exports[_0xe695('0x6')]=function(_0x348d08){for(var _0xd0b8a0=0x0,_0x306825=events[_0xe695('0x7')];_0xd0b8a0<_0x306825;_0xd0b8a0++){var _0x79a5df=events[_0xd0b8a0];var _0x375b1f=createListener(_0xe695('0x8')+_0x79a5df,_0x348d08);UserEvents['on'](_0x79a5df,_0x375b1f);}}; \ No newline at end of file +var _0x13bc=['user:','./user.events','remove','emit','removeListener','register'];(function(_0x2bd7f2,_0x478c7e){var _0x14d845=function(_0x271082){while(--_0x271082){_0x2bd7f2['push'](_0x2bd7f2['shift']());}};_0x14d845(++_0x478c7e);}(_0x13bc,0xa3));var _0xc13b=function(_0x44d499,_0x31af8c){_0x44d499=_0x44d499-0x0;var _0x5f59bf=_0x13bc[_0x44d499];return _0x5f59bf;};'use strict';var UserEvents=require(_0xc13b('0x0'));var events=['save',_0xc13b('0x1'),'update'];function createListener(_0x2b96a5,_0x114d53){return function(_0x14bdd9){_0x114d53[_0xc13b('0x2')](_0x2b96a5,_0x14bdd9);};}function removeListener(_0x15b8fc,_0x29f967){return function(){UserEvents[_0xc13b('0x3')](_0x15b8fc,_0x29f967);};}exports[_0xc13b('0x4')]=function(_0x5ac472){for(var _0x333126=0x0,_0x8f49d6=events['length'];_0x333126<_0x8f49d6;_0x333126++){var _0x4d8357=events[_0x333126];var _0x572a37=createListener(_0xc13b('0x5')+_0x4d8357,_0x5ac472);UserEvents['on'](_0x4d8357,_0x572a37);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 03a61a4..f6d8ed2 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1ad39c,_0x4b13b0){var _0x22fa19=function(_0x272c8a){while(--_0x272c8a){_0x1ad39c['push'](_0x1ad39c['shift']());}};_0x22fa19(++_0x4b13b0);}(_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(_0x3948ad,_0x583304){var _0x128a91=function(_0x34fe58){while(--_0x34fe58){_0x3948ad['push'](_0x3948ad['shift']());}};_0x128a91(++_0x583304);}(_0x70e0,0x17b));var _0x070e=function(_0x5c8123,_0x540f93){_0x5c8123=_0x5c8123-0x0;var _0x5aed17=_0x70e0[_0x5c8123];return _0x5aed17;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index d848811..c7476d8 100644 --- a/server/api/userChatQueue/userChatQueue.attributes.js +++ b/server/api/userChatQueue/userChatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce0a=['INTEGER'];(function(_0x2cd04b,_0xd130f9){var _0x213da5=function(_0x2e0e68){while(--_0x2e0e68){_0x2cd04b['push'](_0x2cd04b['shift']());}};_0x213da5(++_0xd130f9);}(_0xce0a,0xbb));var _0xace0=function(_0x34e752,_0x32e2a2){_0x34e752=_0x34e752-0x0;var _0x7c6347=_0xce0a[_0x34e752];return _0x7c6347;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xace0('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x235a=['exports','sequelize'];(function(_0x3ca40d,_0xc80e1c){var _0x5b749f=function(_0x10d264){while(--_0x10d264){_0x3ca40d['push'](_0x3ca40d['shift']());}};_0x5b749f(++_0xc80e1c);}(_0x235a,0xc7));var _0xa235=function(_0x119567,_0x5b2fd8){_0x119567=_0x119567-0x0;var _0x2ec1e1=_0x235a[_0x119567];return _0x2ec1e1;};'use strict';var Sequelize=require(_0xa235('0x0'));module[_0xa235('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index c38c89e..1adc0ca 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 _0xc99f=['../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','moment','bluebird','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc99f,0x1e6));var _0xfc99=function(_0x207114,_0x25902e){_0x207114=_0x207114-0x0;var _0x14d3b4=_0xc99f[_0x207114];return _0x14d3b4;};'use strict';var _=require(_0xfc99('0x0'));var util=require(_0xfc99('0x1'));var logger=require(_0xfc99('0x2'))('api');var moment=require(_0xfc99('0x3'));var BPromise=require(_0xfc99('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfc99('0x5'));var config=require(_0xfc99('0x6'));var attributes=require(_0xfc99('0x7'));module[_0xfc99('0x8')]=function(_0x133c5d,_0x14b045){return _0x133c5d[_0xfc99('0x9')](_0xfc99('0xa'),attributes,{'tableName':_0xfc99('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x736f=['UserChatQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userChatQueue.attributes','exports','define'];(function(_0x2ceec2,_0x5d607a){var _0xbbe84e=function(_0x41a1ad){while(--_0x41a1ad){_0x2ceec2['push'](_0x2ceec2['shift']());}};_0xbbe84e(++_0x5d607a);}(_0x736f,0xaa));var _0xf736=function(_0x317b0e,_0x984a20){_0x317b0e=_0x317b0e-0x0;var _0x3cd572=_0x736f[_0x317b0e];return _0x3cd572;};'use strict';var _=require(_0xf736('0x0'));var util=require(_0xf736('0x1'));var logger=require(_0xf736('0x2'))(_0xf736('0x3'));var moment=require(_0xf736('0x4'));var BPromise=require(_0xf736('0x5'));var rp=require(_0xf736('0x6'));var fs=require('fs');var path=require(_0xf736('0x7'));var rimraf=require(_0xf736('0x8'));var config=require('../../config/environment');var attributes=require(_0xf736('0x9'));module[_0xf736('0xa')]=function(_0x570f0f,_0x364592){return _0x570f0f[_0xf736('0xb')](_0xf736('0xc'),attributes,{'tableName':'user_has_chat_queues','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 594e1fc..7fd2494 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 _0xe339=['UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x56b056,_0x2a557f){var _0x4536d1=function(_0x47ca71){while(--_0x47ca71){_0x56b056['push'](_0x56b056['shift']());}};_0x4536d1(++_0x2a557f);}(_0xe339,0x169));var _0x9e33=function(_0x1a13b1,_0x4d1d25){_0x1a13b1=_0x1a13b1-0x0;var _0x395e05=_0xe339[_0x1a13b1];return _0x395e05;};'use strict';var _=require(_0x9e33('0x0'));var util=require(_0x9e33('0x1'));var moment=require(_0x9e33('0x2'));var BPromise=require(_0x9e33('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e33('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9e33('0x5'))('rpc');var config=require(_0x9e33('0x6'));var jayson=require(_0x9e33('0x7'));var client=jayson[_0x9e33('0x8')][_0x9e33('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ea33d,_0x310691,_0x533f2d){return new BPromise(function(_0x54f729,_0x152a0f){return client[_0x9e33('0xa')](_0x3ea33d,_0x533f2d)[_0x9e33('0xb')](function(_0x4ce9a7){logger[_0x9e33('0xc')](_0x9e33('0xd'),_0x310691,_0x9e33('0xe'));logger[_0x9e33('0xf')](_0x9e33('0x10'),_0x310691,_0x9e33('0xe'),JSON[_0x9e33('0x11')](_0x4ce9a7));if(_0x4ce9a7[_0x9e33('0x12')]){if(_0x4ce9a7[_0x9e33('0x12')]['code']===0x1f4){logger['error'](_0x9e33('0xd'),_0x310691,_0x4ce9a7[_0x9e33('0x12')][_0x9e33('0x13')]);return _0x152a0f(_0x4ce9a7[_0x9e33('0x12')]['message']);}logger[_0x9e33('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x310691,_0x4ce9a7['error'][_0x9e33('0x13')]);return _0x54f729(_0x4ce9a7['error']['message']);}else{logger[_0x9e33('0xc')](_0x9e33('0xd'),_0x310691,_0x9e33('0xe'));_0x54f729(_0x4ce9a7[_0x9e33('0x14')]['message']);}})[_0x9e33('0x15')](function(_0x12127c){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x310691,_0x12127c);_0x152a0f(_0x12127c);});});} \ No newline at end of file +var _0xaaa0=['rpc','jayson/promise','client','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5ec457,_0x58c44f){var _0xe4f054=function(_0x397bca){while(--_0x397bca){_0x5ec457['push'](_0x5ec457['shift']());}};_0xe4f054(++_0x58c44f);}(_0xaaa0,0x1f3));var _0x0aaa=function(_0x5b8696,_0x2580b0){_0x5b8696=_0x5b8696-0x0;var _0xb79d35=_0xaaa0[_0x5b8696];return _0xb79d35;};'use strict';var _=require(_0x0aaa('0x0'));var util=require(_0x0aaa('0x1'));var moment=require(_0x0aaa('0x2'));var BPromise=require(_0x0aaa('0x3'));var rs=require(_0x0aaa('0x4'));var fs=require('fs');var Redis=require(_0x0aaa('0x5'));var db=require(_0x0aaa('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0aaa('0x7'));var config=require('../../config/environment');var jayson=require(_0x0aaa('0x8'));var client=jayson[_0x0aaa('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10d209,_0x1c63f7,_0x4f6377){return new BPromise(function(_0x27b68c,_0x1290ee){return client[_0x0aaa('0xa')](_0x10d209,_0x4f6377)[_0x0aaa('0xb')](function(_0x1fb6fb){logger['info'](_0x0aaa('0xc'),_0x1c63f7,_0x0aaa('0xd'));logger[_0x0aaa('0xe')](_0x0aaa('0xf'),_0x1c63f7,_0x0aaa('0xd'),JSON[_0x0aaa('0x10')](_0x1fb6fb));if(_0x1fb6fb[_0x0aaa('0x11')]){if(_0x1fb6fb[_0x0aaa('0x11')][_0x0aaa('0x12')]===0x1f4){logger[_0x0aaa('0x11')](_0x0aaa('0xc'),_0x1c63f7,_0x1fb6fb[_0x0aaa('0x11')]['message']);return _0x1290ee(_0x1fb6fb[_0x0aaa('0x11')][_0x0aaa('0x13')]);}logger['error']('UserChatQueue,\x20%s,\x20%s',_0x1c63f7,_0x1fb6fb[_0x0aaa('0x11')][_0x0aaa('0x13')]);return _0x27b68c(_0x1fb6fb[_0x0aaa('0x11')][_0x0aaa('0x13')]);}else{logger[_0x0aaa('0x14')]('UserChatQueue,\x20%s,\x20%s',_0x1c63f7,_0x0aaa('0xd'));_0x27b68c(_0x1fb6fb[_0x0aaa('0x15')]['message']);}})[_0x0aaa('0x16')](function(_0x3e34e9){logger[_0x0aaa('0x11')](_0x0aaa('0xc'),_0x1c63f7,_0x3e34e9);_0x1290ee(_0x3e34e9);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 44f18d9..21994c1 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x51f2c0,_0xb7c46e){var _0x34ffd5=function(_0x2238c0){while(--_0x2238c0){_0x51f2c0['push'](_0x51f2c0['shift']());}};_0x34ffd5(++_0xb7c46e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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(_0x4377f8,_0x54ce9f){var _0x45c400=function(_0x1ad9ec){while(--_0x1ad9ec){_0x4377f8['push'](_0x4377f8['shift']());}};_0x45c400(++_0x54ce9f);}(_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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index b76e382..1198a57 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 _0x1c0d=['STRING','exports','INTEGER'];(function(_0x1d1d09,_0x504d77){var _0x8827e=function(_0x4f3128){while(--_0x4f3128){_0x1d1d09['push'](_0x1d1d09['shift']());}};_0x8827e(++_0x504d77);}(_0x1c0d,0x8e));var _0xd1c0=function(_0x1237dc,_0x1f9831){_0x1237dc=_0x1237dc-0x0;var _0x4e65e3=_0x1c0d[_0x1237dc];return _0x4e65e3;};'use strict';var Sequelize=require('sequelize');module[_0xd1c0('0x0')]={'penalty':{'type':Sequelize[_0xd1c0('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xd1c0('0x2')]}}; \ No newline at end of file +var _0x0e36=['STRING','sequelize','INTEGER'];(function(_0x1efe63,_0x4eaa61){var _0x442c2a=function(_0x5122aa){while(--_0x5122aa){_0x1efe63['push'](_0x1efe63['shift']());}};_0x442c2a(++_0x4eaa61);}(_0x0e36,0x16f));var _0x60e3=function(_0x16745b,_0x33862e){_0x16745b=_0x16745b-0x0;var _0x96bc87=_0x0e36[_0x16745b];return _0x96bc87;};'use strict';var Sequelize=require(_0x60e3('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x60e3('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x60e3('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x60e3('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 20d8e3c..9f7ddd5 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 _0x0568=['exports','define','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes'];(function(_0x242181,_0x1ba64b){var _0x949b7f=function(_0x11ffc3){while(--_0x11ffc3){_0x242181['push'](_0x242181['shift']());}};_0x949b7f(++_0x1ba64b);}(_0x0568,0x86));var _0x8056=function(_0x40cd86,_0x5920ff){_0x40cd86=_0x40cd86-0x0;var _0x22d8a3=_0x0568[_0x40cd86];return _0x22d8a3;};'use strict';var _=require('lodash');var util=require(_0x8056('0x0'));var logger=require('../../config/logger')(_0x8056('0x1'));var moment=require(_0x8056('0x2'));var BPromise=require(_0x8056('0x3'));var rp=require(_0x8056('0x4'));var fs=require('fs');var path=require(_0x8056('0x5'));var rimraf=require(_0x8056('0x6'));var config=require(_0x8056('0x7'));var attributes=require(_0x8056('0x8'));module[_0x8056('0x9')]=function(_0x54d77f,_0x4151f3){return _0x54d77f[_0x8056('0xa')]('UserFaxQueue',attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x05e2=['./userFaxQueue.attributes','exports','UserFaxQueue','user_has_fax_queues','lodash','util','api','bluebird','request-promise','rimraf'];(function(_0x1a1af4,_0x37fef4){var _0x4e60b4=function(_0x1babe1){while(--_0x1babe1){_0x1a1af4['push'](_0x1a1af4['shift']());}};_0x4e60b4(++_0x37fef4);}(_0x05e2,0x126));var _0x205e=function(_0x19efbc,_0x10b7d7){_0x19efbc=_0x19efbc-0x0;var _0x205c5e=_0x05e2[_0x19efbc];return _0x205c5e;};'use strict';var _=require(_0x205e('0x0'));var util=require(_0x205e('0x1'));var logger=require('../../config/logger')(_0x205e('0x2'));var moment=require('moment');var BPromise=require(_0x205e('0x3'));var rp=require(_0x205e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x205e('0x5'));var config=require('../../config/environment');var attributes=require(_0x205e('0x6'));module[_0x205e('0x7')]=function(_0x2119c3,_0x5d37df){return _0x2119c3['define'](_0x205e('0x8'),attributes,{'tableName':_0x205e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 18fa918..3138b42 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 _0x020e=['code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4a3d64,_0x1d5806){var _0x32e223=function(_0x4901d8){while(--_0x4901d8){_0x4a3d64['push'](_0x4a3d64['shift']());}};_0x32e223(++_0x1d5806);}(_0x020e,0x1c7));var _0xe020=function(_0xbfb2b5,_0x2ad9f1){_0xbfb2b5=_0xbfb2b5-0x0;var _0x105957=_0x020e[_0xbfb2b5];return _0x105957;};'use strict';var _=require(_0xe020('0x0'));var util=require(_0xe020('0x1'));var moment=require(_0xe020('0x2'));var BPromise=require(_0xe020('0x3'));var rs=require(_0xe020('0x4'));var fs=require('fs');var Redis=require(_0xe020('0x5'));var db=require(_0xe020('0x6'))['db'];var utils=require(_0xe020('0x7'));var logger=require(_0xe020('0x8'))('rpc');var config=require(_0xe020('0x9'));var jayson=require(_0xe020('0xa'));var client=jayson[_0xe020('0xb')][_0xe020('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e920c,_0x5ca241,_0x13b1ce){return new BPromise(function(_0x4044cb,_0x1c0704){return client['request'](_0x3e920c,_0x13b1ce)[_0xe020('0xd')](function(_0x408a5f){logger[_0xe020('0xe')](_0xe020('0xf'),_0x5ca241,'request\x20sent');logger[_0xe020('0x10')](_0xe020('0x11'),_0x5ca241,'request\x20sent',JSON[_0xe020('0x12')](_0x408a5f));if(_0x408a5f['error']){if(_0x408a5f[_0xe020('0x13')][_0xe020('0x14')]===0x1f4){logger[_0xe020('0x13')](_0xe020('0xf'),_0x5ca241,_0x408a5f[_0xe020('0x13')][_0xe020('0x15')]);return _0x1c0704(_0x408a5f['error']['message']);}logger['error'](_0xe020('0xf'),_0x5ca241,_0x408a5f[_0xe020('0x13')]['message']);return _0x4044cb(_0x408a5f[_0xe020('0x13')][_0xe020('0x15')]);}else{logger[_0xe020('0xe')](_0xe020('0xf'),_0x5ca241,_0xe020('0x16'));_0x4044cb(_0x408a5f[_0xe020('0x17')]['message']);}})[_0xe020('0x18')](function(_0x1a3914){logger[_0xe020('0x13')](_0xe020('0xf'),_0x5ca241,_0x1a3914);_0x1c0704(_0x1a3914);});});} \ No newline at end of file +var _0xda36=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','info','request\x20sent','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','result','lodash','bluebird'];(function(_0x33a765,_0x46ace1){var _0x5028ab=function(_0x69e7b7){while(--_0x69e7b7){_0x33a765['push'](_0x33a765['shift']());}};_0x5028ab(++_0x46ace1);}(_0xda36,0x64));var _0x6da3=function(_0x2008cf,_0x58d1ee){_0x2008cf=_0x2008cf-0x0;var _0x8c222d=_0xda36[_0x2008cf];return _0x8c222d;};'use strict';var _=require(_0x6da3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6da3('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6da3('0x2'));var db=require(_0x6da3('0x3'))['db'];var utils=require(_0x6da3('0x4'));var logger=require(_0x6da3('0x5'))(_0x6da3('0x6'));var config=require(_0x6da3('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x126b33,_0x5180f2,_0x56f3d8){return new BPromise(function(_0x35b5c6,_0x313ac5){return client[_0x6da3('0x8')](_0x126b33,_0x56f3d8)['then'](function(_0x572405){logger[_0x6da3('0x9')]('UserFaxQueue,\x20%s,\x20%s',_0x5180f2,_0x6da3('0xa'));logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x5180f2,_0x6da3('0xa'),JSON[_0x6da3('0xb')](_0x572405));if(_0x572405[_0x6da3('0xc')]){if(_0x572405[_0x6da3('0xc')][_0x6da3('0xd')]===0x1f4){logger[_0x6da3('0xc')](_0x6da3('0xe'),_0x5180f2,_0x572405[_0x6da3('0xc')][_0x6da3('0xf')]);return _0x313ac5(_0x572405['error'][_0x6da3('0xf')]);}logger[_0x6da3('0xc')](_0x6da3('0xe'),_0x5180f2,_0x572405[_0x6da3('0xc')][_0x6da3('0xf')]);return _0x35b5c6(_0x572405[_0x6da3('0xc')][_0x6da3('0xf')]);}else{logger['info'](_0x6da3('0xe'),_0x5180f2,_0x6da3('0xa'));_0x35b5c6(_0x572405[_0x6da3('0x10')][_0x6da3('0xf')]);}})['catch'](function(_0x254752){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x5180f2,_0x254752);_0x313ac5(_0x254752);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 0a5bdd0..38a6e6d 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x14b5c2,_0x155f08){var _0x10f07d=function(_0x3c1095){while(--_0x3c1095){_0x14b5c2['push'](_0x14b5c2['shift']());}};_0x10f07d(++_0x155f08);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5311a1,_0x304912){_0x5311a1=_0x5311a1-0x0;var _0x2acb9f=_0xcb91[_0x5311a1];return _0x2acb9f;};'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(_0x32869c,_0x55b45f){var _0x1b6366=function(_0x1762b5){while(--_0x1762b5){_0x32869c['push'](_0x32869c['shift']());}};_0x1b6366(++_0x55b45f);}(_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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 5771d38..7b31281 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 _0xba5f=['exports','INTEGER'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xba5f,0x6c));var _0xfba5=function(_0x538b9,_0x1b91e3){_0x538b9=_0x538b9-0x0;var _0x3a92cc=_0xba5f[_0x538b9];return _0x3a92cc;};'use strict';var Sequelize=require('sequelize');module[_0xfba5('0x0')]={'penalty':{'type':Sequelize[_0xfba5('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x53f8=['exports','INTEGER'];(function(_0x46de08,_0x350a03){var _0x11dcff=function(_0x213b4d){while(--_0x213b4d){_0x46de08['push'](_0x46de08['shift']());}};_0x11dcff(++_0x350a03);}(_0x53f8,0x7a));var _0x853f=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x53f8[_0xc0a3d3];return _0x3386e8;};'use strict';var Sequelize=require('sequelize');module[_0x853f('0x0')]={'penalty':{'type':Sequelize[_0x853f('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 5a3e127..7d92a3b 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 _0x8f06=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','util'];(function(_0x3e4cbf,_0x17d245){var _0x2d47c8=function(_0x4693f8){while(--_0x4693f8){_0x3e4cbf['push'](_0x3e4cbf['shift']());}};_0x2d47c8(++_0x17d245);}(_0x8f06,0x12a));var _0x68f0=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x8f06[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0x68f0('0x0'));var logger=require(_0x68f0('0x1'))(_0x68f0('0x2'));var moment=require(_0x68f0('0x3'));var BPromise=require(_0x68f0('0x4'));var rp=require(_0x68f0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68f0('0x6'));var config=require(_0x68f0('0x7'));var attributes=require(_0x68f0('0x8'));module[_0x68f0('0x9')]=function(_0x4c6af0,_0x31a5a1){return _0x4c6af0[_0x68f0('0xa')](_0x68f0('0xb'),attributes,{'tableName':_0x68f0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb95c=['../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues','../../config/logger','moment','request-promise','rimraf'];(function(_0xd0d120,_0x191ed9){var _0x104878=function(_0x526e3f){while(--_0x526e3f){_0xd0d120['push'](_0xd0d120['shift']());}};_0x104878(++_0x191ed9);}(_0xb95c,0x19a));var _0xcb95=function(_0x2d84fe,_0x77f035){_0x2d84fe=_0x2d84fe-0x0;var _0x1ddcd2=_0xb95c[_0x2d84fe];return _0x1ddcd2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcb95('0x0'))('api');var moment=require(_0xcb95('0x1'));var BPromise=require('bluebird');var rp=require(_0xcb95('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcb95('0x3'));var config=require(_0xcb95('0x4'));var attributes=require(_0xcb95('0x5'));module[_0xcb95('0x6')]=function(_0x5cb2b8,_0x3ba84a){return _0x5cb2b8[_0xcb95('0x7')]('UserMailQueue',attributes,{'tableName':_0xcb95('0x8'),'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 2044d02..7bf656f 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 _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x7217,0x19e));var _0x7721=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x7217[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file +var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x8a284d,_0xf51bf2){var _0x3a55f0=function(_0x29d604){while(--_0x29d604){_0x8a284d['push'](_0x8a284d['shift']());}};_0x3a55f0(++_0xf51bf2);}(_0xe14b,0x93));var _0xbe14=function(_0x24ebb7,_0x2281ca){_0x24ebb7=_0x24ebb7-0x0;var _0x1dd79f=_0xe14b[_0x24ebb7];return _0x1dd79f;};'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 diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 3458b50..77198db 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 _0x1d92=['Router','./userNotification.controller','post','isAuthenticated','exports','multer','connect-timeout','express'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x1d92,0x18d));var _0x21d9=function(_0x5426e2,_0x5f2968){_0x5426e2=_0x5426e2-0x0;var _0x920dc=_0x1d92[_0x5426e2];return _0x920dc;};'use strict';var multer=require(_0x21d9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x21d9('0x1'));var express=require(_0x21d9('0x2'));var router=express[_0x21d9('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x21d9('0x4'));router[_0x21d9('0x5')]('/',auth[_0x21d9('0x6')](),controller['sendUserNotification']);module[_0x21d9('0x7')]=router; \ No newline at end of file +var _0x80fc=['post','isAuthenticated','sendUserNotification','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./userNotification.controller'];(function(_0x31cdf3,_0x4f2183){var _0x5623f8=function(_0x4377bc){while(--_0x4377bc){_0x31cdf3['push'](_0x31cdf3['shift']());}};_0x5623f8(++_0x4f2183);}(_0x80fc,0x190));var _0xc80f=function(_0xf4d826,_0x549e73){_0xf4d826=_0xf4d826-0x0;var _0x5d8d5b=_0x80fc[_0xf4d826];return _0x5d8d5b;};'use strict';var multer=require('multer');var util=require(_0xc80f('0x0'));var path=require('path');var timeout=require(_0xc80f('0x1'));var express=require(_0xc80f('0x2'));var router=express[_0xc80f('0x3')]();var fs_extra=require(_0xc80f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc80f('0x5'));var config=require('../../config/environment');var controller=require(_0xc80f('0x6'));router[_0xc80f('0x7')]('/',auth[_0xc80f('0x8')](),controller[_0xc80f('0x9')]);module[_0xc80f('0xa')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 318a538..e7b0e27 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 _0x52a1=['TEXT','BOOLEAN','exports','STRING'];(function(_0xf3c843,_0x8ff24e){var _0x3191c6=function(_0x2f1ef7){while(--_0x2f1ef7){_0xf3c843['push'](_0xf3c843['shift']());}};_0x3191c6(++_0x8ff24e);}(_0x52a1,0x1ba));var _0x152a=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x52a1[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require('sequelize');module[_0x152a('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x152a('0x1')]},'recipientsId':{'type':Sequelize[_0x152a('0x2')]},'recipientsDescription':{'type':Sequelize[_0x152a('0x1')]},'beep':{'type':Sequelize[_0x152a('0x3')]}}; \ No newline at end of file +var _0x1a8f=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x311755,_0x44ebcd){var _0x2e5a34=function(_0x469147){while(--_0x469147){_0x311755['push'](_0x311755['shift']());}};_0x2e5a34(++_0x44ebcd);}(_0x1a8f,0xcc));var _0xf1a8=function(_0x51aee3,_0x30c7e4){_0x51aee3=_0x51aee3-0x0;var _0x346280=_0x1a8f[_0x51aee3];return _0x346280;};'use strict';var Sequelize=require(_0xf1a8('0x0'));module[_0xf1a8('0x1')]={'body':{'type':Sequelize[_0xf1a8('0x2')]},'senderName':{'type':Sequelize[_0xf1a8('0x3')]},'recipientsId':{'type':Sequelize[_0xf1a8('0x2')]},'recipientsDescription':{'type':Sequelize[_0xf1a8('0x3')]},'beep':{'type':Sequelize[_0xf1a8('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index d9acb23..8db5545 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 _0x919a=['limit','count','offset','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','sendUserNotification','body','hasOwnProperty','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','user','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','sortBy','join','sequelize','UserNotification','create','recipient','emit','userNotification:send','catch','text','Template','findOne','render','forEach','User','union','ids','includes','queue','replace','Queue','all','flatten','map','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','end','status','undefined'];(function(_0x1306f3,_0x1da761){var _0xc1c7bf=function(_0x1ca08e){while(--_0x1ca08e){_0x1306f3['push'](_0x1306f3['shift']());}};_0xc1c7bf(++_0x1da761);}(_0x919a,0x10e));var _0xa919=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x919a[_0x525c7b];return _0x27b33e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa919('0x0'));var jsonpatch=require(_0xa919('0x1'));var rp=require(_0xa919('0x2'));var moment=require(_0xa919('0x3'));var BPromise=require(_0xa919('0x4'));var Mustache=require(_0xa919('0x5'));var util=require('util');var path=require(_0xa919('0x6'));var sox=require(_0xa919('0x7'));var csv=require(_0xa919('0x8'));var ejs=require(_0xa919('0x9'));var fs=require('fs');var fs_extra=require(_0xa919('0xa'));var _=require(_0xa919('0xb'));var squel=require(_0xa919('0xc'));var crypto=require(_0xa919('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa919('0xe'));var toCsv=require(_0xa919('0x8'));var querystring=require(_0xa919('0xf'));var Papa=require(_0xa919('0x10'));var Redis=require(_0xa919('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa919('0x12'));var as=require(_0xa919('0x13'));var hardwareService=require(_0xa919('0x14'));var logger=require('../../config/logger')(_0xa919('0x15'));var utils=require(_0xa919('0x16'));var config=require(_0xa919('0x17'));var licenseUtil=require(_0xa919('0x18'));var db=require(_0xa919('0x19'))['db'];config[_0xa919('0x1a')]=_[_0xa919('0x1b')](config[_0xa919('0x1a')],{'host':_0xa919('0x1c'),'port':0x18eb});var socket=require(_0xa919('0x1d'))(new Redis(config[_0xa919('0x1a')]));require(_0xa919('0x1e'))[_0xa919('0x1f')](socket);function respondWithStatusCode(_0x25c867,_0x2e1ad0){_0x2e1ad0=_0x2e1ad0||0xcc;return function(_0x74fa24){if(_0x74fa24){return _0x25c867[_0xa919('0x20')](_0x2e1ad0);}return _0x25c867['status'](_0x2e1ad0)[_0xa919('0x21')]();};}function respondWithResult(_0x8a9a8b,_0x2d63aa){_0x2d63aa=_0x2d63aa||0xc8;return function(_0x24b878){if(_0x24b878){return _0x8a9a8b[_0xa919('0x22')](_0x2d63aa)['json'](_0x24b878);}};}function respondWithFilteredResult(_0x269c9c,_0x5a0885){return function(_0x51be65){if(_0x51be65){var _0x5591e4=typeof _0x5a0885['offset']===_0xa919('0x23')&&typeof _0x5a0885[_0xa919('0x24')]===_0xa919('0x23');var _0x306717=_0x51be65[_0xa919('0x25')];var _0x701d0b=_0x5591e4?0x0:_0x5a0885[_0xa919('0x26')];var _0x1824d0=_0x5591e4?_0x51be65[_0xa919('0x25')]:_0x5a0885[_0xa919('0x26')]+_0x5a0885[_0xa919('0x24')];var _0x22e50a;if(_0x1824d0>=_0x306717){_0x1824d0=_0x306717;_0x22e50a=0xc8;}else{_0x22e50a=0xce;}_0x269c9c[_0xa919('0x22')](_0x22e50a);return _0x269c9c[_0xa919('0x27')](_0xa919('0x28'),_0x701d0b+'-'+_0x1824d0+'/'+_0x306717)['json'](_0x51be65);}return null;};}function patchUpdates(_0x5e4c23){return function(_0x501012){try{jsonpatch[_0xa919('0x29')](_0x501012,_0x5e4c23,!![]);}catch(_0x40d592){return BPromise[_0xa919('0x2a')](_0x40d592);}return _0x501012['save']();};}function saveUpdates(_0x1212d7,_0x29796e){return function(_0x2b3997){if(_0x2b3997){return _0x2b3997[_0xa919('0x2b')](_0x1212d7)['then'](function(_0x927c31){return _0x927c31;});}return null;};}function removeEntity(_0x5bb07c,_0x3b6eec){return function(_0x21f542){if(_0x21f542){return _0x21f542[_0xa919('0x2c')]()[_0xa919('0x2d')](function(){_0x5bb07c[_0xa919('0x22')](0xcc)[_0xa919('0x21')]();});}};}function handleEntityNotFound(_0x116cb6,_0x5c97b5){return function(_0x3367cb){if(!_0x3367cb){_0x116cb6[_0xa919('0x20')](0x194);}return _0x3367cb;};}function handleError(_0x43b204,_0x158e30){_0x158e30=_0x158e30||0x1f4;return function(_0x25b1e1){logger[_0xa919('0x2e')](_0x25b1e1[_0xa919('0x2f')]);if(_0x25b1e1[_0xa919('0x30')]){delete _0x25b1e1[_0xa919('0x30')];}_0x43b204['status'](_0x158e30)[_0xa919('0x31')](_0x25b1e1);};}exports[_0xa919('0x32')]=function(_0x57fe75,_0x1a197a,_0x57bd63){if(!_0x57fe75[_0xa919('0x33')]['hasOwnProperty']('text')&&!_0x57fe75[_0xa919('0x33')][_0xa919('0x34')](_0xa919('0x35'))){throw new db['Sequelize'][(_0xa919('0x36'))](_0xa919('0x37'));}else{if(_0x57fe75[_0xa919('0x33')][_0xa919('0x34')]('TemplateId')&&!_0x57fe75[_0xa919('0x33')]['hasOwnProperty'](_0xa919('0x38'))){throw new db[(_0xa919('0x39'))][(_0xa919('0x36'))](_0xa919('0x3a'));}if(!_0x57fe75[_0xa919('0x33')][_0xa919('0x34')]('recipients')){throw new db[(_0xa919('0x39'))][(_0xa919('0x36'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x2c9c1e=JSON[_0xa919('0x3b')](_0x57fe75[_0xa919('0x33')][_0xa919('0x3c')]);}catch(_0x504b6e){logger[_0xa919('0x2e')](_0x504b6e);throw new db[(_0xa919('0x39'))][(_0xa919('0x36'))](_0xa919('0x3d'));}var _0x3beed0=['chatqueue',_0xa919('0x3e'),_0xa919('0x3f'),_0xa919('0x40'),_0xa919('0x41'),_0xa919('0x42'),_0xa919('0x43'),'team',_0xa919('0x44')];if(_[_0xa919('0x45')](_0x2c9c1e,function(_0x3a4159){return!_['includes'](_0x3beed0,_0x3a4159[_0xa919('0x46')][_0xa919('0x47')]());})){throw new db[(_0xa919('0x39'))][(_0xa919('0x36'))](_0xa919('0x48'));}}}var _0x285899={};_0x285899[_0xa919('0x49')]=_0x57fe75[_0xa919('0x33')][_0xa919('0x34')](_0xa919('0x49'))?_0x57fe75[_0xa919('0x33')]['senderName']:_0x57fe75[_0xa919('0x44')][_0xa919('0x4a')];_0x285899[_0xa919('0x4b')]=_[_0xa919('0x4c')](_0x57fe75[_0xa919('0x33')][_0xa919('0x4b')])?null:_0x57fe75[_0xa919('0x33')][_0xa919('0x4b')];_0x285899['beep']=_0x57fe75[_0xa919('0x33')][_0xa919('0x4d')]||![];_0x285899['SenderId']=_0x57fe75[_0xa919('0x44')]['id'];return getContent(_0x57fe75['body'])[_0xa919('0x2d')](function(_0x511857){_0x285899[_0xa919('0x33')]=_0x511857;return getRecipients(_0x2c9c1e);})[_0xa919('0x2d')](function(_0x191b35){_0x285899['recipientsId']=_[_0xa919('0x4e')](_0x191b35)[_0xa919('0x4f')](',');return db[_0xa919('0x50')]['transaction'](function(_0x1cc0bb){return db[_0xa919('0x51')][_0xa919('0x52')](_0x285899,{'raw':!![],'transaction':_0x1cc0bb})[_0xa919('0x2d')](function(_0x30dfde){var _0x250d48={'sender':_0x285899['senderName'],'description':_0x285899['recipientsDescription'],'content':_0x285899[_0xa919('0x33')],'beep':_0x285899[_0xa919('0x4d')]};_0x191b35['forEach'](function(_0x39c6ef){_0x250d48[_0xa919('0x53')]=_0x39c6ef;socket[_0xa919('0x54')](_0xa919('0x55'),_0x250d48);});return _0x30dfde;});});})['then'](respondWithResult(_0x1a197a,0xc9))[_0xa919('0x56')](handleError(_0x1a197a,null));};function getContent(_0x3c299e){return new BPromise(function(_0x1ac7d9,_0x4b11e2){if(_0x3c299e[_0xa919('0x57')]){_0x1ac7d9(_0x3c299e[_0xa919('0x57')]);return;}return db[_0xa919('0x58')][_0xa919('0x59')]({'attributes':['html'],'where':{'id':_0x3c299e[_0xa919('0x35')]},'raw':!![]})['then'](function(_0x218d49){if(!_0x218d49)throw new db[(_0xa919('0x39'))][(_0xa919('0x36'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x23a910=Mustache[_0xa919('0x5a')](_0x218d49['html'],_0x3c299e[_0xa919('0x38')]);_0x1ac7d9(_0x23a910);})['catch'](function(_0x49e796){_0x4b11e2(_0x49e796);});});}function getRecipients(_0x286451){return new BPromise(function(_0xe0e5cb,_0x1bb610){var _0xe33f25=[];var _0x194da3=[];_0x286451[_0xa919('0x5b')](function(_0x30386e){var _0x536a50=_['startCase'](_0x30386e['model'][_0xa919('0x47')]());if(_0x536a50===_0xa919('0x5c')){_0xe33f25=_[_0xa919('0x5d')](_0xe33f25,_0x30386e[_0xa919('0x5e')]);}else{if(_[_0xa919('0x5f')](_0x536a50,_0xa919('0x60')))_0x536a50=_0x536a50[_0xa919('0x61')](_0xa919('0x60'),_0xa919('0x62'));_0x30386e[_0xa919('0x5e')]['forEach'](function(_0x3d6065){_0x194da3['push'](getAgents(_0x536a50,_0x3d6065));});}});return BPromise[_0xa919('0x63')](_0x194da3)[_0xa919('0x2d')](function(_0x271299){_0xe33f25=_[_0xa919('0x5d')](_0xe33f25,_[_0xa919('0x64')](_0x271299));_0xe0e5cb(_0xe33f25);})[_0xa919('0x56')](function(_0x20ad4e){_0x1bb610(_0x20ad4e);});});}function getAgents(_0x323ea1,_0x3de8da){return new BPromise(function(_0x46f153,_0x4ee9e8){return db[_0x323ea1][_0xa919('0x59')]({'where':{'id':_0x3de8da}})[_0xa919('0x2d')](function(_0x2ee26e){return _0x2ee26e['getAgents']({'attributes':['id'],'raw':!![]})[_0xa919('0x2d')](function(_0x3f6393){var _0x5348c1=_[_0xa919('0x65')](_0x3f6393,'id');_0x46f153(_0x5348c1);});})['catch'](function(_0x2c5cd0){_0x4ee9e8(_0x2c5cd0);});});} \ No newline at end of file +var _0xaa28=['ids','replace','queue','Queue','push','all','flatten','findOne','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','status','limit','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','end','sendStatus','error','stack','name','send','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','smsqueue','voicequeue','team','user','some','includes','model','toLowerCase','senderName','fullname','isEmpty','recipientsDescription','beep','recipientsId','sequelize','transaction','create','forEach','recipient','userNotification:send','catch','Template','html','render','startCase','union'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0xaa28,0x125));var _0x8aa2=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xaa28[_0x2d2c16];return _0x53f2fb;};'use strict';var emlformat=require(_0x8aa2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8aa2('0x1'));var rp=require(_0x8aa2('0x2'));var moment=require('moment');var BPromise=require(_0x8aa2('0x3'));var Mustache=require(_0x8aa2('0x4'));var util=require(_0x8aa2('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8aa2('0x6'));var fs=require('fs');var fs_extra=require(_0x8aa2('0x7'));var _=require(_0x8aa2('0x8'));var squel=require('squel');var crypto=require(_0x8aa2('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8aa2('0xa'));var toCsv=require(_0x8aa2('0xb'));var querystring=require(_0x8aa2('0xc'));var Papa=require(_0x8aa2('0xd'));var Redis=require(_0x8aa2('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8aa2('0xf'));var hardwareService=require(_0x8aa2('0x10'));var logger=require(_0x8aa2('0x11'))(_0x8aa2('0x12'));var utils=require(_0x8aa2('0x13'));var config=require(_0x8aa2('0x14'));var licenseUtil=require(_0x8aa2('0x15'));var db=require(_0x8aa2('0x16'))['db'];config[_0x8aa2('0x17')]=_[_0x8aa2('0x18')](config[_0x8aa2('0x17')],{'host':_0x8aa2('0x19'),'port':0x18eb});var socket=require(_0x8aa2('0x1a'))(new Redis(config[_0x8aa2('0x17')]));require(_0x8aa2('0x1b'))[_0x8aa2('0x1c')](socket);function respondWithStatusCode(_0x27ff5c,_0x4b9b4f){_0x4b9b4f=_0x4b9b4f||0xcc;return function(_0xaa0fdc){if(_0xaa0fdc){return _0x27ff5c['sendStatus'](_0x4b9b4f);}return _0x27ff5c[_0x8aa2('0x1d')](_0x4b9b4f)['end']();};}function respondWithResult(_0x432c4d,_0x50a4c7){_0x50a4c7=_0x50a4c7||0xc8;return function(_0x35eb36){if(_0x35eb36){return _0x432c4d[_0x8aa2('0x1d')](_0x50a4c7)['json'](_0x35eb36);}};}function respondWithFilteredResult(_0x708ea9,_0x571002){return function(_0x3a2e75){if(_0x3a2e75){var _0x531086=typeof _0x571002['offset']==='undefined'&&typeof _0x571002[_0x8aa2('0x1e')]==='undefined';var _0x554e97=_0x3a2e75[_0x8aa2('0x1f')];var _0x378989=_0x531086?0x0:_0x571002['offset'];var _0x2cf588=_0x531086?_0x3a2e75['count']:_0x571002[_0x8aa2('0x20')]+_0x571002[_0x8aa2('0x1e')];var _0x55ac28;if(_0x2cf588>=_0x554e97){_0x2cf588=_0x554e97;_0x55ac28=0xc8;}else{_0x55ac28=0xce;}_0x708ea9['status'](_0x55ac28);return _0x708ea9[_0x8aa2('0x21')](_0x8aa2('0x22'),_0x378989+'-'+_0x2cf588+'/'+_0x554e97)[_0x8aa2('0x23')](_0x3a2e75);}return null;};}function patchUpdates(_0x44b4c4){return function(_0x5e124c){try{jsonpatch[_0x8aa2('0x24')](_0x5e124c,_0x44b4c4,!![]);}catch(_0x149bcd){return BPromise[_0x8aa2('0x25')](_0x149bcd);}return _0x5e124c['save']();};}function saveUpdates(_0x260f0f,_0x28e08f){return function(_0x1159c9){if(_0x1159c9){return _0x1159c9[_0x8aa2('0x26')](_0x260f0f)[_0x8aa2('0x27')](function(_0x14668b){return _0x14668b;});}return null;};}function removeEntity(_0x18a598,_0x51b650){return function(_0x471aeb){if(_0x471aeb){return _0x471aeb[_0x8aa2('0x28')]()[_0x8aa2('0x27')](function(){_0x18a598[_0x8aa2('0x1d')](0xcc)[_0x8aa2('0x29')]();});}};}function handleEntityNotFound(_0x1a0ba1,_0x11393a){return function(_0x1da76f){if(!_0x1da76f){_0x1a0ba1[_0x8aa2('0x2a')](0x194);}return _0x1da76f;};}function handleError(_0x10f8d3,_0x4d99e6){_0x4d99e6=_0x4d99e6||0x1f4;return function(_0x1eb6d3){logger[_0x8aa2('0x2b')](_0x1eb6d3[_0x8aa2('0x2c')]);if(_0x1eb6d3['name']){delete _0x1eb6d3[_0x8aa2('0x2d')];}_0x10f8d3['status'](_0x4d99e6)[_0x8aa2('0x2e')](_0x1eb6d3);};}exports['sendUserNotification']=function(_0x4b61de,_0x3a343a,_0x20a9bb){if(!_0x4b61de[_0x8aa2('0x2f')][_0x8aa2('0x30')](_0x8aa2('0x31'))&&!_0x4b61de[_0x8aa2('0x2f')][_0x8aa2('0x30')](_0x8aa2('0x32'))){throw new db[(_0x8aa2('0x33'))][(_0x8aa2('0x34'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x4b61de[_0x8aa2('0x2f')][_0x8aa2('0x30')](_0x8aa2('0x32'))&&!_0x4b61de[_0x8aa2('0x2f')][_0x8aa2('0x30')](_0x8aa2('0x35'))){throw new db[(_0x8aa2('0x33'))][(_0x8aa2('0x34'))](_0x8aa2('0x36'));}if(!_0x4b61de[_0x8aa2('0x2f')][_0x8aa2('0x30')](_0x8aa2('0x37'))){throw new db[(_0x8aa2('0x33'))][(_0x8aa2('0x34'))](_0x8aa2('0x38'));}else{try{var _0x4cd426=JSON[_0x8aa2('0x39')](_0x4b61de['body']['recipients']);}catch(_0x5eb4eb){logger[_0x8aa2('0x2b')](_0x5eb4eb);throw new db[(_0x8aa2('0x33'))]['ValidationError'](_0x8aa2('0x3a'));}var _0x27b4e4=['chatqueue',_0x8aa2('0x3b'),_0x8aa2('0x3c'),'openchannelqueue',_0x8aa2('0x3d'),_0x8aa2('0x3e'),'whatsappqueue',_0x8aa2('0x3f'),_0x8aa2('0x40')];if(_[_0x8aa2('0x41')](_0x4cd426,function(_0x117b5a){return!_[_0x8aa2('0x42')](_0x27b4e4,_0x117b5a[_0x8aa2('0x43')][_0x8aa2('0x44')]());})){throw new db['Sequelize'][(_0x8aa2('0x34'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0xc5d7ae={};_0xc5d7ae['senderName']=_0x4b61de['body'][_0x8aa2('0x30')]('senderName')?_0x4b61de[_0x8aa2('0x2f')][_0x8aa2('0x45')]:_0x4b61de['user'][_0x8aa2('0x46')];_0xc5d7ae['recipientsDescription']=_[_0x8aa2('0x47')](_0x4b61de[_0x8aa2('0x2f')]['recipientsDescription'])?null:_0x4b61de['body'][_0x8aa2('0x48')];_0xc5d7ae[_0x8aa2('0x49')]=_0x4b61de[_0x8aa2('0x2f')][_0x8aa2('0x49')]||![];_0xc5d7ae['SenderId']=_0x4b61de['user']['id'];return getContent(_0x4b61de['body'])[_0x8aa2('0x27')](function(_0x4e7c0e){_0xc5d7ae[_0x8aa2('0x2f')]=_0x4e7c0e;return getRecipients(_0x4cd426);})[_0x8aa2('0x27')](function(_0x40c6cc){_0xc5d7ae[_0x8aa2('0x4a')]=_['sortBy'](_0x40c6cc)['join'](',');return db[_0x8aa2('0x4b')][_0x8aa2('0x4c')](function(_0x1ec323){return db['UserNotification'][_0x8aa2('0x4d')](_0xc5d7ae,{'raw':!![],'transaction':_0x1ec323})[_0x8aa2('0x27')](function(_0x7683f4){var _0x31bde8={'sender':_0xc5d7ae[_0x8aa2('0x45')],'description':_0xc5d7ae['recipientsDescription'],'content':_0xc5d7ae[_0x8aa2('0x2f')],'beep':_0xc5d7ae['beep']};_0x40c6cc[_0x8aa2('0x4e')](function(_0x2f889d){_0x31bde8[_0x8aa2('0x4f')]=_0x2f889d;socket['emit'](_0x8aa2('0x50'),_0x31bde8);});return _0x7683f4;});});})['then'](respondWithResult(_0x3a343a,0xc9))[_0x8aa2('0x51')](handleError(_0x3a343a,null));};function getContent(_0x16f459){return new BPromise(function(_0xfda89b,_0x5ef300){if(_0x16f459[_0x8aa2('0x31')]){_0xfda89b(_0x16f459['text']);return;}return db[_0x8aa2('0x52')]['findOne']({'attributes':[_0x8aa2('0x53')],'where':{'id':_0x16f459[_0x8aa2('0x32')]},'raw':!![]})[_0x8aa2('0x27')](function(_0xbe4822){if(!_0xbe4822)throw new db[(_0x8aa2('0x33'))]['ValidationError']('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x4f8dc3=Mustache[_0x8aa2('0x54')](_0xbe4822[_0x8aa2('0x53')],_0x16f459[_0x8aa2('0x35')]);_0xfda89b(_0x4f8dc3);})[_0x8aa2('0x51')](function(_0x7eead){_0x5ef300(_0x7eead);});});}function getRecipients(_0x5afeff){return new BPromise(function(_0x30a21c,_0x1877b5){var _0x31e8c3=[];var _0x2b441a=[];_0x5afeff[_0x8aa2('0x4e')](function(_0x925c79){var _0x3a216e=_[_0x8aa2('0x55')](_0x925c79[_0x8aa2('0x43')][_0x8aa2('0x44')]());if(_0x3a216e==='User'){_0x31e8c3=_[_0x8aa2('0x56')](_0x31e8c3,_0x925c79[_0x8aa2('0x57')]);}else{if(_[_0x8aa2('0x42')](_0x3a216e,'queue'))_0x3a216e=_0x3a216e[_0x8aa2('0x58')](_0x8aa2('0x59'),_0x8aa2('0x5a'));_0x925c79[_0x8aa2('0x57')]['forEach'](function(_0x340e8a){_0x2b441a[_0x8aa2('0x5b')](getAgents(_0x3a216e,_0x340e8a));});}});return BPromise[_0x8aa2('0x5c')](_0x2b441a)[_0x8aa2('0x27')](function(_0x505666){_0x31e8c3=_['union'](_0x31e8c3,_[_0x8aa2('0x5d')](_0x505666));_0x30a21c(_0x31e8c3);})['catch'](function(_0x3561f1){_0x1877b5(_0x3561f1);});});}function getAgents(_0x5255ab,_0x5d6b22){return new BPromise(function(_0x4ea674,_0x51cfa1){return db[_0x5255ab][_0x8aa2('0x5e')]({'where':{'id':_0x5d6b22}})[_0x8aa2('0x27')](function(_0x7dfb9d){return _0x7dfb9d['getAgents']({'attributes':['id'],'raw':!![]})[_0x8aa2('0x27')](function(_0x61c2c1){var _0xae74d2=_['map'](_0x61c2c1,'id');_0x4ea674(_0xae74d2);});})[_0x8aa2('0x51')](function(_0x148eaf){_0x51cfa1(_0x148eaf);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index ceee490..055f99a 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 _0x670d=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','UserNotification'];(function(_0x4f35f4,_0x51a8c3){var _0x2e9a70=function(_0x110aca){while(--_0x110aca){_0x4f35f4['push'](_0x4f35f4['shift']());}};_0x2e9a70(++_0x51a8c3);}(_0x670d,0x15d));var _0xd670=function(_0x3b0f89,_0x5c1e5a){_0x3b0f89=_0x3b0f89-0x0;var _0x3b6de5=_0x670d[_0x3b0f89];return _0x3b6de5;};'use strict';var EventEmitter=require(_0xd670('0x0'));var UserNotification=require('../../mysqldb')['db'][_0xd670('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xd670('0x2')](0x0);var events={'afterCreate':_0xd670('0x3'),'afterUpdate':_0xd670('0x4'),'afterDestroy':_0xd670('0x5')};function emitEvent(_0x1140e7){return function(_0x45ffcc,_0xf4285a,_0x46b78e){UserNotificationEvents['emit'](_0x1140e7+':'+_0x45ffcc['id'],_0x45ffcc);UserNotificationEvents[_0xd670('0x6')](_0x1140e7,_0x45ffcc);_0x46b78e(null);};}for(var e in events){if(events[_0xd670('0x7')](e)){var event=events[e];UserNotification[_0xd670('0x8')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0x7228=['emit','hook','exports','events','../../mysqldb','UserNotification','setMaxListeners','update','remove'];(function(_0x5c77ed,_0x5501f1){var _0x17ee63=function(_0x359521){while(--_0x359521){_0x5c77ed['push'](_0x5c77ed['shift']());}};_0x17ee63(++_0x5501f1);}(_0x7228,0x111));var _0x8722=function(_0x5b1543,_0x91392c){_0x5b1543=_0x5b1543-0x0;var _0x4473a3=_0x7228[_0x5b1543];return _0x4473a3;};'use strict';var EventEmitter=require(_0x8722('0x0'));var UserNotification=require(_0x8722('0x1'))['db'][_0x8722('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x8722('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8722('0x4'),'afterDestroy':_0x8722('0x5')};function emitEvent(_0x153387){return function(_0x57530f,_0x47e117,_0x55eec0){UserNotificationEvents[_0x8722('0x6')](_0x153387+':'+_0x57530f['id'],_0x57530f);UserNotificationEvents[_0x8722('0x6')](_0x153387,_0x57530f);_0x55eec0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x8722('0x7')](e,emitEvent(event));}}module[_0x8722('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 594f77a..29c25e7 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 _0x01f5=['./userNotification.attributes','exports','define','UserNotification','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x175bd2,_0x5dd709){var _0x14819e=function(_0x499059){while(--_0x499059){_0x175bd2['push'](_0x175bd2['shift']());}};_0x14819e(++_0x5dd709);}(_0x01f5,0x131));var _0x501f=function(_0x12bc4d,_0x70b2bd){_0x12bc4d=_0x12bc4d-0x0;var _0x5ed1a3=_0x01f5[_0x12bc4d];return _0x5ed1a3;};'use strict';var _=require(_0x501f('0x0'));var util=require(_0x501f('0x1'));var logger=require('../../config/logger')(_0x501f('0x2'));var moment=require(_0x501f('0x3'));var BPromise=require('bluebird');var rp=require(_0x501f('0x4'));var fs=require('fs');var path=require(_0x501f('0x5'));var rimraf=require(_0x501f('0x6'));var config=require('../../config/environment');var attributes=require(_0x501f('0x7'));module[_0x501f('0x8')]=function(_0x12574c,_0x3a9ce1){return _0x12574c[_0x501f('0x9')](_0x501f('0xa'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x501f('0xb'),'collate':_0x501f('0xc')});}; \ No newline at end of file +var _0xbee5=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','lodash','util'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xbee5,0x1ed));var _0x5bee=function(_0x1ef69b,_0x2dd5d6){_0x1ef69b=_0x1ef69b-0x0;var _0xee3810=_0xbee5[_0x1ef69b];return _0xee3810;};'use strict';var _=require(_0x5bee('0x0'));var util=require(_0x5bee('0x1'));var logger=require(_0x5bee('0x2'))(_0x5bee('0x3'));var moment=require(_0x5bee('0x4'));var BPromise=require(_0x5bee('0x5'));var rp=require(_0x5bee('0x6'));var fs=require('fs');var path=require(_0x5bee('0x7'));var rimraf=require(_0x5bee('0x8'));var config=require(_0x5bee('0x9'));var attributes=require(_0x5bee('0xa'));module[_0x5bee('0xb')]=function(_0x5d96e6,_0x398b87){return _0x5d96e6[_0x5bee('0xc')](_0x5bee('0xd'),attributes,{'tableName':_0x5bee('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index d4a7727..1b3f25d 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 _0x0218=['util','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','info','UserNotification,\x20%s,\x20%s','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch'];(function(_0x225b4e,_0x179ee4){var _0x24237a=function(_0x4ac970){while(--_0x4ac970){_0x225b4e['push'](_0x225b4e['shift']());}};_0x24237a(++_0x179ee4);}(_0x0218,0x186));var _0x8021=function(_0x208aad,_0x29a73f){_0x208aad=_0x208aad-0x0;var _0xe30095=_0x0218[_0x208aad];return _0xe30095;};'use strict';var _=require('lodash');var util=require(_0x8021('0x0'));var moment=require(_0x8021('0x1'));var BPromise=require(_0x8021('0x2'));var rs=require(_0x8021('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8021('0x4'))(_0x8021('0x5'));var config=require('../../config/environment');var jayson=require(_0x8021('0x6'));var client=jayson[_0x8021('0x7')][_0x8021('0x8')]({'port':0x232a});config[_0x8021('0x9')]=_[_0x8021('0xa')](config[_0x8021('0x9')],{'host':_0x8021('0xb'),'port':0x18eb});var socket=require(_0x8021('0xc'))(new Redis(config[_0x8021('0x9')]));require(_0x8021('0xd'))[_0x8021('0xe')](socket);function respondWithRpcPromise(_0x3c3383,_0x599a8b,_0x3beb34){return new BPromise(function(_0x22dd33,_0x514627){return client[_0x8021('0xf')](_0x3c3383,_0x3beb34)['then'](function(_0x3353b5){logger[_0x8021('0x10')](_0x8021('0x11'),_0x599a8b,'request\x20sent');logger['debug'](_0x8021('0x12'),_0x599a8b,_0x8021('0x13'),JSON[_0x8021('0x14')](_0x3353b5));if(_0x3353b5['error']){if(_0x3353b5['error'][_0x8021('0x15')]===0x1f4){logger[_0x8021('0x16')]('UserNotification,\x20%s,\x20%s',_0x599a8b,_0x3353b5['error'][_0x8021('0x17')]);return _0x514627(_0x3353b5[_0x8021('0x16')][_0x8021('0x17')]);}logger[_0x8021('0x16')]('UserNotification,\x20%s,\x20%s',_0x599a8b,_0x3353b5[_0x8021('0x16')][_0x8021('0x17')]);return _0x22dd33(_0x3353b5[_0x8021('0x16')]['message']);}else{logger[_0x8021('0x10')]('UserNotification,\x20%s,\x20%s',_0x599a8b,_0x8021('0x13'));_0x22dd33(_0x3353b5[_0x8021('0x18')][_0x8021('0x17')]);}})[_0x8021('0x19')](function(_0x36a0d6){logger[_0x8021('0x16')]('UserNotification,\x20%s,\x20%s',_0x599a8b,_0x36a0d6);_0x514627(_0x36a0d6);});});} \ No newline at end of file +var _0x4772=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','./userNotification.socket','register','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','code','UserNotification,\x20%s,\x20%s'];(function(_0x17dd3a,_0x1bbcf3){var _0x5f4b46=function(_0x20cfb6){while(--_0x20cfb6){_0x17dd3a['push'](_0x17dd3a['shift']());}};_0x5f4b46(++_0x1bbcf3);}(_0x4772,0xb2));var _0x2477=function(_0x160556,_0x585f54){_0x160556=_0x160556-0x0;var _0x30b857=_0x4772[_0x160556];return _0x30b857;};'use strict';var _=require(_0x2477('0x0'));var util=require(_0x2477('0x1'));var moment=require(_0x2477('0x2'));var BPromise=require(_0x2477('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2477('0x4'));var db=require(_0x2477('0x5'))['db'];var utils=require(_0x2477('0x6'));var logger=require(_0x2477('0x7'))('rpc');var config=require(_0x2477('0x8'));var jayson=require(_0x2477('0x9'));var client=jayson[_0x2477('0xa')][_0x2477('0xb')]({'port':0x232a});config[_0x2477('0xc')]=_['defaults'](config[_0x2477('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2477('0xc')]));require(_0x2477('0xd'))[_0x2477('0xe')](socket);function respondWithRpcPromise(_0x184624,_0x33654b,_0x1ada23){return new BPromise(function(_0x5eb7ab,_0x393db9){return client['request'](_0x184624,_0x1ada23)['then'](function(_0x4e7fda){logger[_0x2477('0xf')]('UserNotification,\x20%s,\x20%s',_0x33654b,_0x2477('0x10'));logger[_0x2477('0x11')](_0x2477('0x12'),_0x33654b,_0x2477('0x10'),JSON['stringify'](_0x4e7fda));if(_0x4e7fda[_0x2477('0x13')]){if(_0x4e7fda[_0x2477('0x13')][_0x2477('0x14')]===0x1f4){logger[_0x2477('0x13')](_0x2477('0x15'),_0x33654b,_0x4e7fda[_0x2477('0x13')][_0x2477('0x16')]);return _0x393db9(_0x4e7fda['error'][_0x2477('0x16')]);}logger[_0x2477('0x13')](_0x2477('0x15'),_0x33654b,_0x4e7fda[_0x2477('0x13')][_0x2477('0x16')]);return _0x5eb7ab(_0x4e7fda[_0x2477('0x13')][_0x2477('0x16')]);}else{logger[_0x2477('0xf')]('UserNotification,\x20%s,\x20%s',_0x33654b,_0x2477('0x10'));_0x5eb7ab(_0x4e7fda[_0x2477('0x17')][_0x2477('0x16')]);}})[_0x2477('0x18')](function(_0x2879af){logger[_0x2477('0x13')](_0x2477('0x15'),_0x33654b,_0x2879af);_0x393db9(_0x2879af);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 008107e..eab0ce5 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 _0x702e=['length','./userNotification.events','save','update','emit','removeListener','register'];(function(_0x34099c,_0x2c9a04){var _0x50e4ec=function(_0x1d5e19){while(--_0x1d5e19){_0x34099c['push'](_0x34099c['shift']());}};_0x50e4ec(++_0x2c9a04);}(_0x702e,0x1c1));var _0xe702=function(_0x58218b,_0x28ffaf){_0x58218b=_0x58218b-0x0;var _0x52c0cc=_0x702e[_0x58218b];return _0x52c0cc;};'use strict';var UserNotificationEvents=require(_0xe702('0x0'));var events=[_0xe702('0x1'),'remove',_0xe702('0x2')];function createListener(_0x446745,_0x4fa407){return function(_0x4e82cc){_0x4fa407[_0xe702('0x3')](_0x446745,_0x4e82cc);};}function removeListener(_0x951e4,_0x23712a){return function(){UserNotificationEvents[_0xe702('0x4')](_0x951e4,_0x23712a);};}exports[_0xe702('0x5')]=function(_0x52668d){for(var _0x4ebb4b=0x0,_0x4a9494=events[_0xe702('0x6')];_0x4ebb4b<_0x4a9494;_0x4ebb4b++){var _0xbb9a0d=events[_0x4ebb4b];var _0x2c521f=createListener('userNotification:'+_0xbb9a0d,_0x52668d);UserNotificationEvents['on'](_0xbb9a0d,_0x2c521f);}}; \ No newline at end of file +var _0x16a5=['remove','removeListener','register','length','./userNotification.events'];(function(_0x4650d3,_0x570d9d){var _0x181463=function(_0x4f566b){while(--_0x4f566b){_0x4650d3['push'](_0x4650d3['shift']());}};_0x181463(++_0x570d9d);}(_0x16a5,0x1a8));var _0x516a=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x16a5[_0x1b828b];return _0x98da1a;};'use strict';var UserNotificationEvents=require(_0x516a('0x0'));var events=['save',_0x516a('0x1'),'update'];function createListener(_0x4b1223,_0x38ba18){return function(_0x39596f){_0x38ba18['emit'](_0x4b1223,_0x39596f);};}function removeListener(_0x4abec7,_0x3e0db7){return function(){UserNotificationEvents[_0x516a('0x2')](_0x4abec7,_0x3e0db7);};}exports[_0x516a('0x3')]=function(_0x5a3704){for(var _0x1a6779=0x0,_0x9e2feb=events[_0x516a('0x4')];_0x1a6779<_0x9e2feb;_0x1a6779++){var _0x2c41da=events[_0x1a6779];var _0x589cc1=createListener('userNotification:'+_0x2c41da,_0x5a3704);UserNotificationEvents['on'](_0x2c41da,_0x589cc1);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 4b16448..6fabd65 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x27b001,_0x299ce6){var _0x4ad9af=function(_0x33a9de){while(--_0x33a9de){_0x27b001['push'](_0x27b001['shift']());}};_0x4ad9af(++_0x299ce6);}(_0xedd9,0xfc));var _0x9edd=function(_0x272cee,_0x153b02){_0x272cee=_0x272cee-0x0;var _0x31c95c=_0xedd9[_0x272cee];return _0x31c95c;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1c76d5,_0x18420c){var _0x505e84=function(_0x161047){while(--_0x161047){_0x1c76d5['push'](_0x1c76d5['shift']());}};_0x505e84(++_0x18420c);}(_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 e5e5d9d..7ba60cb 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 _0xe780=['exports','INTEGER'];(function(_0x4e4827,_0x4c1947){var _0x58d622=function(_0x5a6ab6){while(--_0x5a6ab6){_0x4e4827['push'](_0x4e4827['shift']());}};_0x58d622(++_0x4c1947);}(_0xe780,0x90));var _0x0e78=function(_0x239dd9,_0x2f2526){_0x239dd9=_0x239dd9-0x0;var _0x39fcb1=_0xe780[_0x239dd9];return _0x39fcb1;};'use strict';var Sequelize=require('sequelize');module[_0x0e78('0x0')]={'penalty':{'type':Sequelize[_0x0e78('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5523=['INTEGER','sequelize','exports'];(function(_0x48fd4f,_0x4d071e){var _0x479dd3=function(_0x556fb3){while(--_0x556fb3){_0x48fd4f['push'](_0x48fd4f['shift']());}};_0x479dd3(++_0x4d071e);}(_0x5523,0x14e));var _0x3552=function(_0x2f1f58,_0x480fa8){_0x2f1f58=_0x2f1f58-0x0;var _0x2603e8=_0x5523[_0x2f1f58];return _0x2603e8;};'use strict';var Sequelize=require(_0x3552('0x0'));module[_0x3552('0x1')]={'penalty':{'type':Sequelize[_0x3552('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index e7a18e8..eaa30d9 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 _0x41e5=['UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','path','rimraf','./userOpenchannelQueue.attributes','exports','define'];(function(_0x4471b3,_0x511a9f){var _0x386593=function(_0x1057e2){while(--_0x1057e2){_0x4471b3['push'](_0x4471b3['shift']());}};_0x386593(++_0x511a9f);}(_0x41e5,0x176));var _0x541e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41e5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x541e('0x0'));var util=require(_0x541e('0x1'));var logger=require(_0x541e('0x2'))(_0x541e('0x3'));var moment=require(_0x541e('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x541e('0x5'));var rimraf=require(_0x541e('0x6'));var config=require('../../config/environment');var attributes=require(_0x541e('0x7'));module[_0x541e('0x8')]=function(_0x36830a,_0xb51d96){return _0x36830a[_0x541e('0x9')](_0x541e('0xa'),attributes,{'tableName':_0x541e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c66=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x6c66,0x90));var _0x66c6=function(_0x4dbe0f,_0x2de185){_0x4dbe0f=_0x4dbe0f-0x0;var _0x3869b2=_0x6c66[_0x4dbe0f];return _0x3869b2;};'use strict';var _=require(_0x66c6('0x0'));var util=require('util');var logger=require(_0x66c6('0x1'))(_0x66c6('0x2'));var moment=require(_0x66c6('0x3'));var BPromise=require(_0x66c6('0x4'));var rp=require(_0x66c6('0x5'));var fs=require('fs');var path=require(_0x66c6('0x6'));var rimraf=require('rimraf');var config=require(_0x66c6('0x7'));var attributes=require(_0x66c6('0x8'));module[_0x66c6('0x9')]=function(_0x4075be,_0xc076e4){return _0x4075be[_0x66c6('0xa')]('UserOpenchannelQueue',attributes,{'tableName':_0x66c6('0xb'),'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 c76c487..f852d9f 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 _0x5e45=['code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1f7115,_0x573c94){var _0x41ca8d=function(_0x47105d){while(--_0x47105d){_0x1f7115['push'](_0x1f7115['shift']());}};_0x41ca8d(++_0x573c94);}(_0x5e45,0x16c));var _0x55e4=function(_0x52ad65,_0x33d94d){_0x52ad65=_0x52ad65-0x0;var _0x10f111=_0x5e45[_0x52ad65];return _0x10f111;};'use strict';var _=require(_0x55e4('0x0'));var util=require('util');var moment=require(_0x55e4('0x1'));var BPromise=require(_0x55e4('0x2'));var rs=require(_0x55e4('0x3'));var fs=require('fs');var Redis=require(_0x55e4('0x4'));var db=require(_0x55e4('0x5'))['db'];var utils=require(_0x55e4('0x6'));var logger=require('../../config/logger')(_0x55e4('0x7'));var config=require('../../config/environment');var jayson=require(_0x55e4('0x8'));var client=jayson[_0x55e4('0x9')][_0x55e4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1eba0b,_0x30dc70,_0x3db6b2){return new BPromise(function(_0x37033c,_0x2344ea){return client[_0x55e4('0xb')](_0x1eba0b,_0x3db6b2)[_0x55e4('0xc')](function(_0x4da947){logger[_0x55e4('0xd')](_0x55e4('0xe'),_0x30dc70,_0x55e4('0xf'));logger[_0x55e4('0x10')](_0x55e4('0x11'),_0x30dc70,_0x55e4('0xf'),JSON[_0x55e4('0x12')](_0x4da947));if(_0x4da947[_0x55e4('0x13')]){if(_0x4da947['error'][_0x55e4('0x14')]===0x1f4){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x30dc70,_0x4da947[_0x55e4('0x13')][_0x55e4('0x15')]);return _0x2344ea(_0x4da947[_0x55e4('0x13')][_0x55e4('0x15')]);}logger[_0x55e4('0x13')](_0x55e4('0xe'),_0x30dc70,_0x4da947[_0x55e4('0x13')]['message']);return _0x37033c(_0x4da947['error'][_0x55e4('0x15')]);}else{logger['info'](_0x55e4('0xe'),_0x30dc70,_0x55e4('0xf'));_0x37033c(_0x4da947[_0x55e4('0x16')]['message']);}})[_0x55e4('0x17')](function(_0x290063){logger[_0x55e4('0x13')](_0x55e4('0xe'),_0x30dc70,_0x290063);_0x2344ea(_0x290063);});});} \ No newline at end of file +var _0x4454=['request','then','info','debug','request\x20sent','stringify','error','message','UserOpenchannelQueue,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x52c856,_0x47fd69){var _0x41f172=function(_0x7bec89){while(--_0x7bec89){_0x52c856['push'](_0x52c856['shift']());}};_0x41f172(++_0x47fd69);}(_0x4454,0x1eb));var _0x4445=function(_0x39cf48,_0x2e246b){_0x39cf48=_0x39cf48-0x0;var _0x515a6a=_0x4454[_0x39cf48];return _0x515a6a;};'use strict';var _=require(_0x4445('0x0'));var util=require(_0x4445('0x1'));var moment=require(_0x4445('0x2'));var BPromise=require(_0x4445('0x3'));var rs=require(_0x4445('0x4'));var fs=require('fs');var Redis=require(_0x4445('0x5'));var db=require(_0x4445('0x6'))['db'];var utils=require(_0x4445('0x7'));var logger=require(_0x4445('0x8'))(_0x4445('0x9'));var config=require(_0x4445('0xa'));var jayson=require(_0x4445('0xb'));var client=jayson['client'][_0x4445('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x276de6,_0x318a56,_0x181146){return new BPromise(function(_0x22b37b,_0x421607){return client[_0x4445('0xd')](_0x276de6,_0x181146)[_0x4445('0xe')](function(_0x121d60){logger[_0x4445('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x318a56,'request\x20sent');logger[_0x4445('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x318a56,_0x4445('0x11'),JSON[_0x4445('0x12')](_0x121d60));if(_0x121d60[_0x4445('0x13')]){if(_0x121d60[_0x4445('0x13')]['code']===0x1f4){logger[_0x4445('0x13')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x318a56,_0x121d60['error'][_0x4445('0x14')]);return _0x421607(_0x121d60[_0x4445('0x13')][_0x4445('0x14')]);}logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x318a56,_0x121d60[_0x4445('0x13')][_0x4445('0x14')]);return _0x22b37b(_0x121d60[_0x4445('0x13')][_0x4445('0x14')]);}else{logger[_0x4445('0xf')](_0x4445('0x15'),_0x318a56,_0x4445('0x11'));_0x22b37b(_0x121d60[_0x4445('0x16')][_0x4445('0x14')]);}})[_0x4445('0x17')](function(_0x8513ed){logger[_0x4445('0x13')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x318a56,_0x8513ed);_0x421607(_0x8513ed);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 3ad17fb..24c45f7 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 _0x6f36=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','getSections','getResources','post','create','clone','addSections','addResources','put','update','delete','destroy','removeSections','/:id/resources','removeResources','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x2dd04d,_0x1feb11){var _0x543ca7=function(_0x5c66c9){while(--_0x5c66c9){_0x2dd04d['push'](_0x2dd04d['shift']());}};_0x543ca7(++_0x1feb11);}(_0x6f36,0x102));var _0x66f3=function(_0x27d57a,_0x1f1c02){_0x27d57a=_0x27d57a-0x0;var _0x4e99a5=_0x6f36[_0x27d57a];return _0x4e99a5;};'use strict';var multer=require(_0x66f3('0x0'));var util=require(_0x66f3('0x1'));var path=require(_0x66f3('0x2'));var timeout=require(_0x66f3('0x3'));var express=require(_0x66f3('0x4'));var router=express['Router']();var fs_extra=require(_0x66f3('0x5'));var auth=require(_0x66f3('0x6'));var interaction=require(_0x66f3('0x7'));var config=require(_0x66f3('0x8'));var controller=require(_0x66f3('0x9'));router[_0x66f3('0xa')]('/',auth[_0x66f3('0xb')](),controller[_0x66f3('0xc')]);router['get'](_0x66f3('0xd'),auth[_0x66f3('0xb')](),controller[_0x66f3('0xe')]);router[_0x66f3('0xa')](_0x66f3('0xf'),auth['isAuthenticated'](),controller[_0x66f3('0x10')]);router['get'](_0x66f3('0x11'),auth[_0x66f3('0xb')](),controller[_0x66f3('0x12')]);router[_0x66f3('0xa')]('/:id/resources',auth[_0x66f3('0xb')](),controller[_0x66f3('0x13')]);router[_0x66f3('0x14')]('/',auth[_0x66f3('0xb')](),controller[_0x66f3('0x15')]);router[_0x66f3('0x14')]('/:id/clone',auth['isAuthenticated'](),controller[_0x66f3('0x16')]);router['post'](_0x66f3('0x11'),auth[_0x66f3('0xb')](),controller[_0x66f3('0x17')]);router['post']('/:id/resources',auth[_0x66f3('0xb')](),controller[_0x66f3('0x18')]);router[_0x66f3('0x19')](_0x66f3('0xf'),auth[_0x66f3('0xb')](),controller[_0x66f3('0x1a')]);router[_0x66f3('0x1b')](_0x66f3('0xf'),auth[_0x66f3('0xb')](),controller[_0x66f3('0x1c')]);router[_0x66f3('0x1b')](_0x66f3('0x11'),auth[_0x66f3('0xb')](),controller[_0x66f3('0x1d')]);router['delete'](_0x66f3('0x1e'),auth[_0x66f3('0xb')](),controller[_0x66f3('0x1f')]);module[_0x66f3('0x20')]=router; \ No newline at end of file +var _0xd4cc=['/:id','show','/:id/sections','getSections','getResources','post','create','clone','addSections','/:id/resources','addResources','put','update','delete','destroy','removeSections','removeResources','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x6e72cf,_0x54820c){var _0x658a24=function(_0x572d82){while(--_0x572d82){_0x6e72cf['push'](_0x6e72cf['shift']());}};_0x658a24(++_0x54820c);}(_0xd4cc,0xb7));var _0xcd4c=function(_0x4807de,_0x32f8d2){_0x4807de=_0x4807de-0x0;var _0xa7d7f9=_0xd4cc[_0x4807de];return _0xa7d7f9;};'use strict';var multer=require(_0xcd4c('0x0'));var util=require(_0xcd4c('0x1'));var path=require(_0xcd4c('0x2'));var timeout=require(_0xcd4c('0x3'));var express=require(_0xcd4c('0x4'));var router=express[_0xcd4c('0x5')]();var fs_extra=require(_0xcd4c('0x6'));var auth=require(_0xcd4c('0x7'));var interaction=require(_0xcd4c('0x8'));var config=require(_0xcd4c('0x9'));var controller=require('./userProfile.controller');router[_0xcd4c('0xa')]('/',auth[_0xcd4c('0xb')](),controller[_0xcd4c('0xc')]);router['get'](_0xcd4c('0xd'),auth[_0xcd4c('0xb')](),controller[_0xcd4c('0xe')]);router[_0xcd4c('0xa')](_0xcd4c('0xf'),auth[_0xcd4c('0xb')](),controller[_0xcd4c('0x10')]);router[_0xcd4c('0xa')](_0xcd4c('0x11'),auth[_0xcd4c('0xb')](),controller[_0xcd4c('0x12')]);router['get']('/:id/resources',auth[_0xcd4c('0xb')](),controller[_0xcd4c('0x13')]);router[_0xcd4c('0x14')]('/',auth[_0xcd4c('0xb')](),controller[_0xcd4c('0x15')]);router[_0xcd4c('0x14')]('/:id/clone',auth[_0xcd4c('0xb')](),controller[_0xcd4c('0x16')]);router[_0xcd4c('0x14')]('/:id/sections',auth[_0xcd4c('0xb')](),controller[_0xcd4c('0x17')]);router[_0xcd4c('0x14')](_0xcd4c('0x18'),auth[_0xcd4c('0xb')](),controller[_0xcd4c('0x19')]);router[_0xcd4c('0x1a')](_0xcd4c('0xf'),auth[_0xcd4c('0xb')](),controller[_0xcd4c('0x1b')]);router[_0xcd4c('0x1c')]('/:id',auth[_0xcd4c('0xb')](),controller[_0xcd4c('0x1d')]);router['delete'](_0xcd4c('0x11'),auth['isAuthenticated'](),controller[_0xcd4c('0x1e')]);router[_0xcd4c('0x1c')](_0xcd4c('0x18'),auth['isAuthenticated'](),controller[_0xcd4c('0x1f')]);module[_0xcd4c('0x20')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index cb3abcb..35d95d1 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 _0x3eca=['BOOLEAN','sequelize','name','STRING','join','getDataValue','crudPermissions','split'];(function(_0x24579a,_0x59612d){var _0x59dff7=function(_0x47c50f){while(--_0x47c50f){_0x24579a['push'](_0x24579a['shift']());}};_0x59dff7(++_0x59612d);}(_0x3eca,0xb9));var _0xa3ec=function(_0x2002b3,_0x11e91c){_0x2002b3=_0x2002b3-0x0;var _0x2756f0=_0x3eca[_0x2002b3];return _0x2756f0;};'use strict';var Sequelize=require(_0xa3ec('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa3ec('0x1')},'crudPermissions':{'type':Sequelize[_0xa3ec('0x2')],'set':function(_0x4fb30f){this['setDataValue']('crudPermissions',_0x4fb30f?_0x4fb30f[_0xa3ec('0x3')](''):[]);},'get':function(){return this[_0xa3ec('0x4')](_0xa3ec('0x5'))?this[_0xa3ec('0x4')]('crudPermissions')[_0xa3ec('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xa3ec('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xa3ec('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xa3ec('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xa3ec('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xa3ec('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xa3ec('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0708=['exports','STRING','setDataValue','join','getDataValue','crudPermissions','BOOLEAN','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0708,0xff));var _0x8070=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x0708[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require(_0x8070('0x0'));module[_0x8070('0x1')]={'name':{'type':Sequelize[_0x8070('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x8070('0x2')],'set':function(_0x268040){this[_0x8070('0x3')]('crudPermissions',_0x268040?_0x268040[_0x8070('0x4')](''):[]);},'get':function(){return this[_0x8070('0x5')](_0x8070('0x6'))?this[_0x8070('0x5')](_0x8070('0x6'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x8070('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x8070('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x8070('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x8070('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x8070('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x8070('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x8070('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 5b2f4fb..303edf4 100644 --- a/server/api/userProfile/userProfile.controller.js +++ b/server/api/userProfile/userProfile.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8af6=['forEach','resourceId','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','save','update','then','destroy','name','map','UserProfile','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','length','find','create','body','clone','keys','createdAt','updatedAt','crudPermissions','omit','sequelize','transaction','get','UserProfileSection','autoAssociation','Resources','UserProfileResource','describe','addSections','sectionId','push','removeSections','ids','enabled','includes','isEmpty','subsections','findOne','Dashboard'];(function(_0x5c15b8,_0x3ac219){var _0x160211=function(_0x49b7d5){while(--_0x49b7d5){_0x5c15b8['push'](_0x5c15b8['shift']());}};_0x160211(++_0x3ac219);}(_0x8af6,0x76));var _0x68af=function(_0x32b336,_0x37ab35){_0x32b336=_0x32b336-0x0;var _0x51035e=_0x8af6[_0x32b336];return _0x51035e;};'use strict';var emlformat=require(_0x68af('0x0'));var rimraf=require(_0x68af('0x1'));var zipdir=require(_0x68af('0x2'));var jsonpatch=require(_0x68af('0x3'));var rp=require(_0x68af('0x4'));var moment=require(_0x68af('0x5'));var BPromise=require(_0x68af('0x6'));var Mustache=require(_0x68af('0x7'));var util=require(_0x68af('0x8'));var path=require(_0x68af('0x9'));var sox=require('sox');var csv=require(_0x68af('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x68af('0xb'));var _=require(_0x68af('0xc'));var squel=require(_0x68af('0xd'));var crypto=require(_0x68af('0xe'));var jsforce=require(_0x68af('0xf'));var deskjs=require(_0x68af('0x10'));var toCsv=require(_0x68af('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x68af('0x11'));var authService=require(_0x68af('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x68af('0x13'));var hardwareService=require(_0x68af('0x14'));var logger=require(_0x68af('0x15'))(_0x68af('0x16'));var utils=require(_0x68af('0x17'));var config=require(_0x68af('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x68af('0x19')]=_['defaults'](config['redis'],{'host':_0x68af('0x1a'),'port':0x18eb});var socket=require(_0x68af('0x1b'))(new Redis(config[_0x68af('0x19')]));require('./userProfile.socket')[_0x68af('0x1c')](socket);function respondWithStatusCode(_0x50f1ea,_0x3a6d18){_0x3a6d18=_0x3a6d18||0xcc;return function(_0x3c37db){if(_0x3c37db){return _0x50f1ea[_0x68af('0x1d')](_0x3a6d18);}return _0x50f1ea[_0x68af('0x1e')](_0x3a6d18)[_0x68af('0x1f')]();};}function respondWithResult(_0x58764e,_0x43c1d9){_0x43c1d9=_0x43c1d9||0xc8;return function(_0xcdf590){if(_0xcdf590){return _0x58764e[_0x68af('0x1e')](_0x43c1d9)[_0x68af('0x20')](_0xcdf590);}};}function respondWithFilteredResult(_0x59d7f3,_0x5357b1){return function(_0x3aa998){if(_0x3aa998){var _0x29ddbf=typeof _0x5357b1['offset']===_0x68af('0x21')&&typeof _0x5357b1[_0x68af('0x22')]===_0x68af('0x21');var _0x1a82f0=_0x3aa998['count'];var _0x2ed0a6=_0x29ddbf?0x0:_0x5357b1[_0x68af('0x23')];var _0x5ab38b=_0x29ddbf?_0x3aa998['count']:_0x5357b1[_0x68af('0x23')]+_0x5357b1[_0x68af('0x22')];var _0x14b930;if(_0x5ab38b>=_0x1a82f0){_0x5ab38b=_0x1a82f0;_0x14b930=0xc8;}else{_0x14b930=0xce;}_0x59d7f3[_0x68af('0x1e')](_0x14b930);return _0x59d7f3[_0x68af('0x24')](_0x68af('0x25'),_0x2ed0a6+'-'+_0x5ab38b+'/'+_0x1a82f0)['json'](_0x3aa998);}return null;};}function patchUpdates(_0x25a210){return function(_0x3c71ef){try{jsonpatch['apply'](_0x3c71ef,_0x25a210,!![]);}catch(_0x3ebd57){return BPromise['reject'](_0x3ebd57);}return _0x3c71ef[_0x68af('0x26')]();};}function saveUpdates(_0x1f0d0e,_0xa489c3){return function(_0x16e07a){if(_0x16e07a){return _0x16e07a[_0x68af('0x27')](_0x1f0d0e)[_0x68af('0x28')](function(_0x5851b9){return _0x5851b9;});}return null;};}function removeEntity(_0x514ebc,_0x29f003){return function(_0x6c175e){if(_0x6c175e){return _0x6c175e[_0x68af('0x29')]()[_0x68af('0x28')](function(){_0x514ebc[_0x68af('0x1e')](0xcc)[_0x68af('0x1f')]();});}};}function handleEntityNotFound(_0x1839f9,_0x2729fd){return function(_0x5417e9){if(!_0x5417e9){_0x1839f9[_0x68af('0x1d')](0x194);}return _0x5417e9;};}function handleError(_0x1c6011,_0xec7c01){_0xec7c01=_0xec7c01||0x1f4;return function(_0x3d1303){logger['error'](_0x3d1303['stack']);if(_0x3d1303[_0x68af('0x2a')]){delete _0x3d1303[_0x68af('0x2a')];}_0x1c6011[_0x68af('0x1e')](_0xec7c01)['send'](_0x3d1303);};}exports['index']=function(_0x3c3268,_0x135dc1){var _0x5c0adb={},_0x718b39={},_0x2d5aac={'count':0x0,'rows':[]};var _0x21b677=_[_0x68af('0x2b')](db[_0x68af('0x2c')][_0x68af('0x2d')],function(_0x18120e){return{'name':_0x18120e['fieldName'],'type':_0x18120e[_0x68af('0x2e')][_0x68af('0x2f')]};});_0x718b39[_0x68af('0x30')]=_['map'](_0x21b677,_0x68af('0x2a'));_0x718b39[_0x68af('0x31')]=_['keys'](_0x3c3268[_0x68af('0x31')]);_0x718b39[_0x68af('0x32')]=_['intersection'](_0x718b39[_0x68af('0x30')],_0x718b39['query']);_0x5c0adb['attributes']=_[_0x68af('0x33')](_0x718b39[_0x68af('0x30')],qs[_0x68af('0x34')](_0x3c3268[_0x68af('0x31')][_0x68af('0x34')]));_0x5c0adb[_0x68af('0x35')]=_0x5c0adb['attributes']['length']?_0x5c0adb['attributes']:_0x718b39[_0x68af('0x30')];if(!_0x3c3268[_0x68af('0x31')]['hasOwnProperty'](_0x68af('0x36'))){_0x5c0adb[_0x68af('0x22')]=qs[_0x68af('0x22')](_0x3c3268['query'][_0x68af('0x22')]);_0x5c0adb[_0x68af('0x23')]=qs[_0x68af('0x23')](_0x3c3268[_0x68af('0x31')][_0x68af('0x23')]);}_0x5c0adb['order']=qs[_0x68af('0x37')](_0x3c3268[_0x68af('0x31')][_0x68af('0x37')]);_0x5c0adb[_0x68af('0x38')]=qs[_0x68af('0x32')](_[_0x68af('0x39')](_0x3c3268[_0x68af('0x31')],_0x718b39[_0x68af('0x32')]),_0x21b677);if(_0x3c3268[_0x68af('0x31')][_0x68af('0x3a')]){_0x5c0adb['where']=_[_0x68af('0x3b')](_0x5c0adb[_0x68af('0x38')],{'$or':_['map'](_0x21b677,function(_0x3ba003){if(_0x3ba003[_0x68af('0x2e')]!==_0x68af('0x3c')){var _0x47292c={};_0x47292c[_0x3ba003[_0x68af('0x2a')]]={'$like':'%'+_0x3c3268['query']['filter']+'%'};return _0x47292c;}})});}_0x5c0adb=_['merge']({},_0x5c0adb,_0x3c3268[_0x68af('0x3d')]);var _0x139900={'where':_0x5c0adb['where']};return db[_0x68af('0x2c')][_0x68af('0x3e')](_0x139900)[_0x68af('0x28')](function(_0x3bb630){_0x2d5aac['count']=_0x3bb630;if(_0x3c3268[_0x68af('0x31')][_0x68af('0x3f')]){_0x5c0adb[_0x68af('0x40')]=[{'all':!![]}];}return db[_0x68af('0x2c')][_0x68af('0x41')](_0x5c0adb);})[_0x68af('0x28')](function(_0x3b0953){_0x2d5aac[_0x68af('0x42')]=_0x3b0953;return _0x2d5aac;})[_0x68af('0x28')](respondWithFilteredResult(_0x135dc1,_0x5c0adb))[_0x68af('0x43')](handleError(_0x135dc1,null));};exports['show']=function(_0x52adab,_0x395cce){var _0x105243={'raw':![],'where':{'id':_0x52adab[_0x68af('0x44')]['id']}},_0x1a0b10={};_0x1a0b10[_0x68af('0x30')]=_['keys'](db[_0x68af('0x2c')][_0x68af('0x2d')]);_0x1a0b10[_0x68af('0x31')]=_['keys'](_0x52adab[_0x68af('0x31')]);_0x1a0b10[_0x68af('0x32')]=_[_0x68af('0x33')](_0x1a0b10[_0x68af('0x30')],_0x1a0b10[_0x68af('0x31')]);_0x105243[_0x68af('0x35')]=_[_0x68af('0x33')](_0x1a0b10['model'],qs[_0x68af('0x34')](_0x52adab[_0x68af('0x31')][_0x68af('0x34')]));_0x105243[_0x68af('0x35')]=_0x105243['attributes'][_0x68af('0x45')]?_0x105243[_0x68af('0x35')]:_0x1a0b10['model'];if(_0x52adab[_0x68af('0x31')]['includeAll']){_0x105243[_0x68af('0x40')]=[{'all':!![]}];}_0x105243=_['merge']({},_0x105243,_0x52adab[_0x68af('0x3d')]);return db[_0x68af('0x2c')][_0x68af('0x46')](_0x105243)[_0x68af('0x28')](handleEntityNotFound(_0x395cce,null))[_0x68af('0x28')](respondWithResult(_0x395cce,null))[_0x68af('0x43')](handleError(_0x395cce,null));};exports[_0x68af('0x47')]=function(_0x3b43a6,_0x3544d5){return db[_0x68af('0x2c')][_0x68af('0x47')](_0x3b43a6[_0x68af('0x48')],{})['then'](respondWithResult(_0x3544d5,0xc9))[_0x68af('0x43')](handleError(_0x3544d5,null));};exports[_0x68af('0x49')]=function(_0x4d44cd,_0x2bce28){var _0x472868={'where':{'id':_0x4d44cd['params']['id']}},_0x46a1f0={};_0x46a1f0[_0x68af('0x30')]=_[_0x68af('0x4a')](db[_0x68af('0x2c')][_0x68af('0x2d')]);_0x472868[_0x68af('0x35')]=_['intersection'](_0x46a1f0[_0x68af('0x30')],qs[_0x68af('0x34')](_0x4d44cd[_0x68af('0x31')][_0x68af('0x34')]));_0x472868[_0x68af('0x35')]=_0x472868[_0x68af('0x35')][_0x68af('0x45')]?_0x472868[_0x68af('0x35')]:_0x46a1f0[_0x68af('0x30')];if(_0x4d44cd[_0x68af('0x31')]['includeAll']){_0x472868[_0x68af('0x40')]=[{'all':!![]}];}_0x472868=_[_0x68af('0x3b')]({},_0x472868,_0x4d44cd[_0x68af('0x3d')]);return db[_0x68af('0x2c')][_0x68af('0x46')](_0x472868)[_0x68af('0x28')](handleEntityNotFound(_0x2bce28,null))['then'](function(_0x5ca2ae){if(_0x5ca2ae){var _0x433d50=_0x5ca2ae['get']({'plain':!![]});_0x433d50=qs['omit'](_0x433d50,['id',_0x68af('0x4b'),_0x68af('0x4c'),_0x68af('0x4d')]);_0x4d44cd[_0x68af('0x48')]=_[_0x68af('0x4e')](_0x4d44cd[_0x68af('0x48')],['id',_0x68af('0x4b'),'updatedAt']);return db[_0x68af('0x4f')][_0x68af('0x50')](function(_0x255e1c){return db[_0x68af('0x2c')][_0x68af('0x47')](_[_0x68af('0x3b')](_0x433d50,_0x4d44cd[_0x68af('0x48')]),{'include':_0x4d44cd[_0x68af('0x31')][_0x68af('0x3f')]?[{'all':!![]}]:undefined,'transaction':_0x255e1c})['then'](function(_0x367685){var _0x2706a4=_0x367685[_0x68af('0x51')]({'plain':!![]});return db[_0x68af('0x52')][_0x68af('0x41')]({'where':{'userProfileId':_0x4d44cd[_0x68af('0x44')]['id']},'raw':!![]})['then'](function(_0x1f2ba6){if(_0x1f2ba6){return BPromise['each'](_0x1f2ba6,function(_0x2fea5f){return new BPromise(function(_0x4ee21b,_0x5e6aca){if(_0x2fea5f['autoAssociation']===null||_0x2fea5f[_0x68af('0x53')]===0x1)_0x4ee21b(null);return db['UserProfileResource'][_0x68af('0x41')]({'where':{'sectionId':_0x2fea5f['id']},'raw':!![]})[_0x68af('0x28')](function(_0x39388f){var _0x137d3e=_[_0x68af('0x2b')](_0x39388f,function(_0x162961){return qs[_0x68af('0x4e')](_0x162961,['id','createdAt',_0x68af('0x4c'),'sectionId']);});_0x4ee21b(_0x137d3e);})[_0x68af('0x43')](function(_0x37170a){_0x5e6aca(_0x37170a);});})[_0x68af('0x28')](function(_0x588453){var _0x3d57ca=qs[_0x68af('0x4e')](_0x2fea5f,['id',_0x68af('0x4b'),_0x68af('0x4c')]);_0x3d57ca['userProfileId']=_0x2706a4['id'];if(_0x588453)_0x3d57ca[_0x68af('0x54')]=_0x588453;return _0x3d57ca;})['then'](function(_0x20d912){return db['UserProfileSection'][_0x68af('0x47')](_0x20d912,{'include':[{'model':db[_0x68af('0x55')],'as':_0x68af('0x54')}],'raw':!![],'transaction':_0x255e1c});});})['then'](function(){return _0x2706a4;});}});});});}})[_0x68af('0x28')](respondWithResult(_0x2bce28,0xc9))[_0x68af('0x43')](handleError(_0x2bce28,null));};exports[_0x68af('0x27')]=function(_0x36b9ae,_0x55c62a){if(_0x36b9ae[_0x68af('0x48')]['id']){delete _0x36b9ae['body']['id'];}return db[_0x68af('0x2c')]['find']({'where':{'id':_0x36b9ae['params']['id']}})[_0x68af('0x28')](handleEntityNotFound(_0x55c62a,null))['then'](saveUpdates(_0x36b9ae[_0x68af('0x48')],null))['then'](respondWithResult(_0x55c62a,null))[_0x68af('0x43')](handleError(_0x55c62a,null));};exports[_0x68af('0x29')]=function(_0x4d3587,_0x21260a){return db[_0x68af('0x2c')]['find']({'where':{'id':_0x4d3587[_0x68af('0x44')]['id']}})[_0x68af('0x28')](handleEntityNotFound(_0x21260a,null))[_0x68af('0x28')](removeEntity(_0x21260a,null))[_0x68af('0x43')](handleError(_0x21260a,null));};exports[_0x68af('0x56')]=function(_0x5bb1e8,_0x2f7a3a){return db[_0x68af('0x2c')][_0x68af('0x56')]()[_0x68af('0x28')](respondWithResult(_0x2f7a3a,null))[_0x68af('0x43')](handleError(_0x2f7a3a,null));};exports[_0x68af('0x57')]=function(_0x125d2a,_0x183349){var _0x2d814a=_0x125d2a['body'];return db[_0x68af('0x2c')]['find']({'where':{'id':_0x125d2a[_0x68af('0x44')]['id']}})[_0x68af('0x28')](handleEntityNotFound(_0x183349,null))[_0x68af('0x28')](function(_0x4b23e6){if(_0x4b23e6){return db[_0x68af('0x4f')][_0x68af('0x50')](function(_0x4e1f0e){return db[_0x68af('0x52')][_0x68af('0x29')]({'where':{'userProfileId':_0x125d2a[_0x68af('0x44')]['id'],'sectionId':_[_0x68af('0x2b')](_0x2d814a,function(_0x5dbf33){return _0x5dbf33[_0x68af('0x58')];})},'transaction':_0x4e1f0e})[_0x68af('0x28')](function(){var _0x1acb3e=_[_0x68af('0x2b')](_0x2d814a,function(_0x51b055){_0x51b055['userProfileId']=_0x125d2a[_0x68af('0x44')]['id'];return _0x51b055;});var _0x44418f=[];return BPromise['each'](_0x1acb3e,function(_0x351d52){return db[_0x68af('0x52')][_0x68af('0x47')](_0x351d52,{'include':[{'model':db[_0x68af('0x55')],'as':_0x68af('0x54')}],'raw':!![],'transaction':_0x4e1f0e})['then'](function(_0x22cd4c){_0x44418f[_0x68af('0x59')](_0x22cd4c[_0x68af('0x51')]({'plain':!![]}));});})['then'](function(){return _0x44418f;});});});}})[_0x68af('0x28')](function(_0x290f64){return _0x290f64;})['then'](respondWithResult(_0x183349,null))['catch'](handleError(_0x183349,null));};exports[_0x68af('0x5a')]=function(_0x3e837d,_0x2e61f9){var _0x324205;return db['UserProfile'][_0x68af('0x46')]({'where':{'id':_0x3e837d['params']['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0x2e61f9,null))[_0x68af('0x28')](function(_0x56cadf){if(_0x56cadf){_0x324205=_0x56cadf;return db['UserProfileSection'][_0x68af('0x29')]({'where':{'userProfileId':_0x3e837d[_0x68af('0x44')]['id'],'sectionId':_0x3e837d[_0x68af('0x31')][_0x68af('0x5b')]}});}})[_0x68af('0x28')](function(){return _0x324205;})[_0x68af('0x28')](respondWithStatusCode(_0x2e61f9,null))[_0x68af('0x43')](handleError(_0x2e61f9,null));};exports['getSections']=function(_0x36d27e,_0x2643a1){var _0x2f6a9c=[];var _0x4cd9b3=[];return db[_0x68af('0x52')]['findAll']({'where':{'userProfileId':_0x36d27e[_0x68af('0x44')]['id']},'raw':!![]})[_0x68af('0x28')](function(_0x10521b){_0x2f6a9c=_[_0x68af('0x3a')](_0x10521b,function(_0x270392){return _0x270392[_0x68af('0x5c')]===0x1||_[_0x68af('0x5d')]([0x3eb,0x709],_0x270392[_0x68af('0x58')]);});if(!_[_0x68af('0x5e')](_0x2f6a9c)){return _[_0x68af('0x2b')](_0x2f6a9c,function(_0x3e8660){return _0x3e8660[_0x68af('0x58')];});}else{return;}})[_0x68af('0x28')](function(_0x576e9d){if(_0x576e9d)_0x4cd9b3=_0x576e9d;if(_[_0x68af('0x5d')](_0x4cd9b3,0x64)){var _0x3b1fec=_['find'](_0x2f6a9c,{'sectionId':0x64});return hasDefaultDashboard(_0x3b1fec)[_0x68af('0x28')](function(_0x20b73b){return _[_0x68af('0x2b')](_0x2f6a9c,function(_0x469711){if(_0x469711[_0x68af('0x58')]===0x64){_0x469711[_0x68af('0x5f')]=_0x20b73b;}return _0x469711;});});}else{return;}})['then'](function(_0x43dc7b){if(_0x43dc7b)_0x2f6a9c=_0x43dc7b;if(_[_0x68af('0x5d')](_0x4cd9b3,0x3eb)){var _0x387f2d=_['find'](_0x2f6a9c,{'sectionId':0x3eb});return getCustomDashboards(_0x387f2d)['then'](function(_0x1bebe1){return _[_0x68af('0x2b')](_0x2f6a9c,function(_0x126ece){if(_0x387f2d['enabled']){if(_0x126ece[_0x68af('0x58')]===0x3eb){_0x126ece[_0x68af('0x5f')]=_0x1bebe1;}}else{if(_0x126ece[_0x68af('0x58')]===0x64){_0x126ece[_0x68af('0x5f')]=_0x1bebe1;}}return _0x126ece;});});}else{return;}})['then'](function(_0x2eea52){if(_0x2eea52)_0x2f6a9c=_0x2eea52;if(_[_0x68af('0x5d')](_0x4cd9b3,0x709)){var _0x2bbd03=_[_0x68af('0x46')](_0x2f6a9c,{'sectionId':0x709});return getPlugins(_0x2bbd03)[_0x68af('0x28')](function(_0x4d2fca){if(_0x2bbd03[_0x68af('0x5c')]){return _[_0x68af('0x2b')](_0x2f6a9c,function(_0x3c6c97){if(_0x3c6c97['sectionId']===0x709){_0x3c6c97[_0x68af('0x5f')]=_0x4d2fca;}return _0x3c6c97;});}else{var _0x226d1f={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4d2fca};var _0x216506=_[_0x68af('0x2b')](_0x2f6a9c);_0x216506[_0x68af('0x59')](_0x226d1f);return _0x216506;}});}else{return;}})[_0x68af('0x28')](function(_0x58901d){if(_0x58901d)_0x2f6a9c=_0x58901d;return _[_0x68af('0x3a')](_0x2f6a9c,[_0x68af('0x5c'),0x1]);})[_0x68af('0x28')](respondWithResult(_0x2643a1,null))['catch'](handleError(_0x2643a1,null));};function hasDefaultDashboard(_0x56404f){var _0x470804=[0x65];return new BPromise(function(_0x42b58d,_0x1ce09a){try{if(_0x56404f[_0x68af('0x53')]){_0x42b58d(_0x470804);}else{return db['UserProfileResource'][_0x68af('0x60')]({'where':{'sectionId':_0x56404f['id']},'raw':!![]})[_0x68af('0x28')](function(_0x4a2797){_0x4a2797?_0x42b58d(_0x470804):_0x42b58d();});}}catch(_0x584796){_0x1ce09a(_0x584796);}});}function getCustomDashboards(_0x3a348c){var _0x1f77c1=[];return new BPromise(function(_0x5dc173,_0x220fe8){try{if(_0x3a348c[_0x68af('0x53')]){return db[_0x68af('0x61')][_0x68af('0x41')]({'raw':!![]})['then'](function(_0x12a8c2){_0x12a8c2[_0x68af('0x62')](function(_0x53cad0){_0x1f77c1['push'](_0x53cad0['id']+0x1869f);});_0x5dc173(_0x1f77c1);});}else{return db[_0x68af('0x55')][_0x68af('0x41')]({'where':{'sectionId':_0x3a348c['id']},'raw':!![]})['then'](function(_0x3f97ad){_0x3f97ad['forEach'](function(_0x2dcaaa){_0x1f77c1['push'](_0x2dcaaa['resourceId']+0x1869f);});_0x5dc173(_0x1f77c1);});}}catch(_0x5babfa){_0x220fe8(_0x5babfa);}});}function getPlugins(_0x8c5d55){var _0x31b589=[];return new BPromise(function(_0x3c3313,_0x3749f2){try{if(_0x8c5d55[_0x68af('0x53')]){return db['Plugin'][_0x68af('0x41')]({'raw':!![]})[_0x68af('0x28')](function(_0x47948b){_0x47948b[_0x68af('0x62')](function(_0x160a65){_0x31b589['push'](_0x160a65['id']+0x15b38);});_0x3c3313(_0x31b589);});}else{return db[_0x68af('0x55')][_0x68af('0x41')]({'where':{'sectionId':_0x8c5d55['id']},'raw':!![]})[_0x68af('0x28')](function(_0xc9e13a){_0xc9e13a['forEach'](function(_0x31ebb5){_0x31b589[_0x68af('0x59')](_0x31ebb5[_0x68af('0x63')]+0x15b38);});_0x3c3313(_0x31b589);});}}catch(_0x4b0616){_0x3749f2(_0x4b0616);}});}exports[_0x68af('0x64')]=function(_0x3d8421,_0x258677){return db[_0x68af('0x2c')][_0x68af('0x46')]({'where':{'id':_0x3d8421[_0x68af('0x44')]['id']}})[_0x68af('0x28')](handleEntityNotFound(_0x258677,null))['then'](function(_0xadc4e2){if(_0xadc4e2){return db['sequelize'][_0x68af('0x50')](function(_0x48f249){return db[_0x68af('0x52')][_0x68af('0x41')]({'where':{'userProfileId':_0x3d8421[_0x68af('0x44')]['id']},'attributes':['id'],'raw':!![]})[_0x68af('0x28')](function(_0x414566){if(_0x414566){return db[_0x68af('0x52')][_0x68af('0x29')]({'where':{'userProfileId':_0x3d8421[_0x68af('0x44')]['id'],'id':_[_0x68af('0x2b')](_0x414566,function(_0x1339c0){return _0x1339c0['id'];})},'transaction':_0x48f249});}})['then'](function(_0x3afa1e){var _0x5580a3=_[_0x68af('0x2b')](_0x3d8421[_0x68af('0x48')],function(_0x39451d){_0x39451d['userProfileId']=_0x3d8421[_0x68af('0x44')]['id'];return _0x39451d;});return db['UserProfileSection']['bulkCreate'](_0x5580a3,{'raw':!![],'transaction':_0x48f249});})[_0x68af('0x28')](function(_0x2357c8){var _0x1e7a6a=_['filter'](_[_0x68af('0x2b')](_0x2357c8,function(_0x544979){return _0x544979[_0x68af('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x1e7a6a){return db[_0x68af('0x52')][_0x68af('0x41')]({'where':{'userProfileId':_0x3d8421[_0x68af('0x44')]['id'],'sectionId':_[_0x68af('0x2b')](_0x1e7a6a,function(_0x1138bd){return _0x1138bd['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0x68af('0x28')](function(_0x3dbea6){var _0x3a68d8=_[_0x68af('0x2b')](_0x3d8421[_0x68af('0x48')],function(_0x1a845f){_0x1a845f['userProfileId']=_0x3d8421['params']['id'];return _0x1a845f;});return db[_0x68af('0x55')][_0x68af('0x65')](_0x3a68d8,{'raw':!![],'transaction':_0x48f249});});}})[_0x68af('0x43')](handleError(_0x258677,null));});}})[_0x68af('0x28')](function(_0x4e18ec){var _0x4b1f2c=_[_0x68af('0x2b')](_0x4e18ec,function(_0xe7205d){return _0xe7205d[_0x68af('0x51')]({'plain':!![]});});})[_0x68af('0x28')](respondWithResult(_0x258677,null))[_0x68af('0x43')](handleError(_0x258677,null));};exports['removeResources']=function(_0x3a72a0,_0x1714a9,_0x148a17){return db['UserProfile'][_0x68af('0x46')]({'where':{'id':_0x3a72a0['params']['id']}})[_0x68af('0x28')](handleEntityNotFound(_0x1714a9,null))[_0x68af('0x28')](function(_0xaa0fd8){if(_0xaa0fd8){return _0xaa0fd8[_0x68af('0x66')](_0x3a72a0['query'][_0x68af('0x5b')]);}})[_0x68af('0x28')](respondWithStatusCode(_0x1714a9,null))[_0x68af('0x43')](handleError(_0x1714a9,null));};exports[_0x68af('0x67')]=function(_0xc2cfe7,_0x1f2fe8){var _0xd51acf={};if(!_0xc2cfe7['query'][_0x68af('0x68')])throw new Error(_0x68af('0x69'));if(!_0xc2cfe7['query'][_0x68af('0x6a')](_0x68af('0x36'))){_0xd51acf[_0x68af('0x22')]=qs['limit'](_0xc2cfe7[_0x68af('0x31')][_0x68af('0x22')]);_0xd51acf[_0x68af('0x23')]=qs[_0x68af('0x23')](_0xc2cfe7[_0x68af('0x31')][_0x68af('0x23')]);}return db['UserProfile']['find']({'where':{'id':_0xc2cfe7[_0x68af('0x44')]['id']}})[_0x68af('0x28')](function(_0x52d79e){if(!_0x52d79e)throw new Error(_0x68af('0x6b')+_0xc2cfe7[_0x68af('0x44')]['id']);return db['UserProfile'][_0x68af('0x67')](_0xc2cfe7);})['then'](respondWithFilteredResult(_0x1f2fe8,_0xd51acf))[_0x68af('0x43')](handleError(_0x1f2fe8,null));}; \ No newline at end of file +var _0x25e7=['Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','end','error','name','send','map','UserProfile','rawAttributes','fieldName','type','key','keys','filters','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','show','options','find','catch','create','body','clone','params','omit','createdAt','updatedAt','sequelize','transaction','get','UserProfileSection','autoAssociation','UserProfileResource','userProfileId','Resources','update','describe','addSections','each','push','removeSections','ids','getSections','enabled','sectionId','includes','subsections'];(function(_0x3250ff,_0x58f743){var _0x37586b=function(_0x49fe75){while(--_0x49fe75){_0x3250ff['push'](_0x3250ff['shift']());}};_0x37586b(++_0x58f743);}(_0x25e7,0x1d6));var _0x725e=function(_0x7ec937,_0xbe3b08){_0x7ec937=_0x7ec937-0x0;var _0x150040=_0x25e7[_0x7ec937];return _0x150040;};'use strict';var emlformat=require(_0x725e('0x0'));var rimraf=require(_0x725e('0x1'));var zipdir=require(_0x725e('0x2'));var jsonpatch=require(_0x725e('0x3'));var rp=require(_0x725e('0x4'));var moment=require(_0x725e('0x5'));var BPromise=require(_0x725e('0x6'));var Mustache=require(_0x725e('0x7'));var util=require(_0x725e('0x8'));var path=require(_0x725e('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x725e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x725e('0xb'));var crypto=require(_0x725e('0xc'));var jsforce=require(_0x725e('0xd'));var deskjs=require(_0x725e('0xe'));var toCsv=require(_0x725e('0xf'));var querystring=require(_0x725e('0x10'));var Papa=require(_0x725e('0x11'));var Redis=require(_0x725e('0x12'));var authService=require(_0x725e('0x13'));var qs=require(_0x725e('0x14'));var as=require(_0x725e('0x15'));var hardwareService=require(_0x725e('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x725e('0x17'));var config=require(_0x725e('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x725e('0x19')]=_[_0x725e('0x1a')](config['redis'],{'host':_0x725e('0x1b'),'port':0x18eb});var socket=require(_0x725e('0x1c'))(new Redis(config[_0x725e('0x19')]));require('./userProfile.socket')[_0x725e('0x1d')](socket);function respondWithStatusCode(_0x221e02,_0x44e652){_0x44e652=_0x44e652||0xcc;return function(_0x2e78d2){if(_0x2e78d2){return _0x221e02[_0x725e('0x1e')](_0x44e652);}return _0x221e02[_0x725e('0x1f')](_0x44e652)['end']();};}function respondWithResult(_0x156b99,_0x268312){_0x268312=_0x268312||0xc8;return function(_0x297bb7){if(_0x297bb7){return _0x156b99['status'](_0x268312)[_0x725e('0x20')](_0x297bb7);}};}function respondWithFilteredResult(_0x125fef,_0x2dda5c){return function(_0x397e33){if(_0x397e33){var _0x268438=typeof _0x2dda5c[_0x725e('0x21')]==='undefined'&&typeof _0x2dda5c[_0x725e('0x22')]===_0x725e('0x23');var _0x1b8879=_0x397e33[_0x725e('0x24')];var _0x1a9ea6=_0x268438?0x0:_0x2dda5c[_0x725e('0x21')];var _0x540802=_0x268438?_0x397e33[_0x725e('0x24')]:_0x2dda5c[_0x725e('0x21')]+_0x2dda5c[_0x725e('0x22')];var _0x40c21b;if(_0x540802>=_0x1b8879){_0x540802=_0x1b8879;_0x40c21b=0xc8;}else{_0x40c21b=0xce;}_0x125fef[_0x725e('0x1f')](_0x40c21b);return _0x125fef[_0x725e('0x25')](_0x725e('0x26'),_0x1a9ea6+'-'+_0x540802+'/'+_0x1b8879)[_0x725e('0x20')](_0x397e33);}return null;};}function patchUpdates(_0x7d0792){return function(_0x5c33c1){try{jsonpatch[_0x725e('0x27')](_0x5c33c1,_0x7d0792,!![]);}catch(_0x36cbab){return BPromise[_0x725e('0x28')](_0x36cbab);}return _0x5c33c1[_0x725e('0x29')]();};}function saveUpdates(_0x5a8191,_0xffe474){return function(_0x5268c8){if(_0x5268c8){return _0x5268c8['update'](_0x5a8191)['then'](function(_0x2aad7b){return _0x2aad7b;});}return null;};}function removeEntity(_0x1cbaae,_0x2d3c55){return function(_0x590aff){if(_0x590aff){return _0x590aff[_0x725e('0x2a')]()[_0x725e('0x2b')](function(){_0x1cbaae['status'](0xcc)[_0x725e('0x2c')]();});}};}function handleEntityNotFound(_0x339a58,_0x4b0d0c){return function(_0x378ace){if(!_0x378ace){_0x339a58['sendStatus'](0x194);}return _0x378ace;};}function handleError(_0x561656,_0x34b71c){_0x34b71c=_0x34b71c||0x1f4;return function(_0x5b8dec){logger[_0x725e('0x2d')](_0x5b8dec['stack']);if(_0x5b8dec['name']){delete _0x5b8dec[_0x725e('0x2e')];}_0x561656[_0x725e('0x1f')](_0x34b71c)[_0x725e('0x2f')](_0x5b8dec);};}exports['index']=function(_0x2e0534,_0x5b03d9){var _0x85d29c={},_0x1ce9c8={},_0x39932f={'count':0x0,'rows':[]};var _0x28951f=_[_0x725e('0x30')](db[_0x725e('0x31')][_0x725e('0x32')],function(_0x100c63){return{'name':_0x100c63[_0x725e('0x33')],'type':_0x100c63[_0x725e('0x34')][_0x725e('0x35')]};});_0x1ce9c8['model']=_[_0x725e('0x30')](_0x28951f,_0x725e('0x2e'));_0x1ce9c8['query']=_[_0x725e('0x36')](_0x2e0534['query']);_0x1ce9c8[_0x725e('0x37')]=_['intersection'](_0x1ce9c8[_0x725e('0x38')],_0x1ce9c8[_0x725e('0x39')]);_0x85d29c[_0x725e('0x3a')]=_[_0x725e('0x3b')](_0x1ce9c8[_0x725e('0x38')],qs[_0x725e('0x3c')](_0x2e0534['query']['fields']));_0x85d29c[_0x725e('0x3a')]=_0x85d29c[_0x725e('0x3a')][_0x725e('0x3d')]?_0x85d29c['attributes']:_0x1ce9c8[_0x725e('0x38')];if(!_0x2e0534['query'][_0x725e('0x3e')](_0x725e('0x3f'))){_0x85d29c[_0x725e('0x22')]=qs[_0x725e('0x22')](_0x2e0534['query']['limit']);_0x85d29c[_0x725e('0x21')]=qs[_0x725e('0x21')](_0x2e0534[_0x725e('0x39')]['offset']);}_0x85d29c[_0x725e('0x40')]=qs[_0x725e('0x41')](_0x2e0534[_0x725e('0x39')]['sort']);_0x85d29c[_0x725e('0x42')]=qs['filters'](_[_0x725e('0x43')](_0x2e0534[_0x725e('0x39')],_0x1ce9c8[_0x725e('0x37')]),_0x28951f);if(_0x2e0534[_0x725e('0x39')][_0x725e('0x44')]){_0x85d29c['where']=_['merge'](_0x85d29c[_0x725e('0x42')],{'$or':_[_0x725e('0x30')](_0x28951f,function(_0x41c1ed){if(_0x41c1ed['type']!==_0x725e('0x45')){var _0x5be83e={};_0x5be83e[_0x41c1ed[_0x725e('0x2e')]]={'$like':'%'+_0x2e0534[_0x725e('0x39')][_0x725e('0x44')]+'%'};return _0x5be83e;}})});}_0x85d29c=_[_0x725e('0x46')]({},_0x85d29c,_0x2e0534['options']);var _0x448ebc={'where':_0x85d29c[_0x725e('0x42')]};return db[_0x725e('0x31')][_0x725e('0x24')](_0x448ebc)[_0x725e('0x2b')](function(_0x19ed0a){_0x39932f[_0x725e('0x24')]=_0x19ed0a;if(_0x2e0534['query'][_0x725e('0x47')]){_0x85d29c[_0x725e('0x48')]=[{'all':!![]}];}return db['UserProfile'][_0x725e('0x49')](_0x85d29c);})[_0x725e('0x2b')](function(_0x5e719e){_0x39932f['rows']=_0x5e719e;return _0x39932f;})['then'](respondWithFilteredResult(_0x5b03d9,_0x85d29c))['catch'](handleError(_0x5b03d9,null));};exports[_0x725e('0x4a')]=function(_0x9c8c57,_0x89a516){var _0x59f6d0={'raw':![],'where':{'id':_0x9c8c57['params']['id']}},_0x1eee42={};_0x1eee42['model']=_[_0x725e('0x36')](db[_0x725e('0x31')][_0x725e('0x32')]);_0x1eee42[_0x725e('0x39')]=_[_0x725e('0x36')](_0x9c8c57[_0x725e('0x39')]);_0x1eee42['filters']=_[_0x725e('0x3b')](_0x1eee42['model'],_0x1eee42[_0x725e('0x39')]);_0x59f6d0[_0x725e('0x3a')]=_['intersection'](_0x1eee42[_0x725e('0x38')],qs['fields'](_0x9c8c57[_0x725e('0x39')][_0x725e('0x3c')]));_0x59f6d0['attributes']=_0x59f6d0['attributes'][_0x725e('0x3d')]?_0x59f6d0['attributes']:_0x1eee42[_0x725e('0x38')];if(_0x9c8c57['query']['includeAll']){_0x59f6d0['include']=[{'all':!![]}];}_0x59f6d0=_[_0x725e('0x46')]({},_0x59f6d0,_0x9c8c57[_0x725e('0x4b')]);return db['UserProfile'][_0x725e('0x4c')](_0x59f6d0)[_0x725e('0x2b')](handleEntityNotFound(_0x89a516,null))['then'](respondWithResult(_0x89a516,null))[_0x725e('0x4d')](handleError(_0x89a516,null));};exports[_0x725e('0x4e')]=function(_0x4d5415,_0x19f524){return db[_0x725e('0x31')][_0x725e('0x4e')](_0x4d5415[_0x725e('0x4f')],{})[_0x725e('0x2b')](respondWithResult(_0x19f524,0xc9))[_0x725e('0x4d')](handleError(_0x19f524,null));};exports[_0x725e('0x50')]=function(_0x34edcd,_0x14753a){var _0x3d28a5={'where':{'id':_0x34edcd[_0x725e('0x51')]['id']}},_0x4b92ba={};_0x4b92ba['model']=_[_0x725e('0x36')](db[_0x725e('0x31')][_0x725e('0x32')]);_0x3d28a5[_0x725e('0x3a')]=_[_0x725e('0x3b')](_0x4b92ba[_0x725e('0x38')],qs[_0x725e('0x3c')](_0x34edcd[_0x725e('0x39')][_0x725e('0x3c')]));_0x3d28a5[_0x725e('0x3a')]=_0x3d28a5[_0x725e('0x3a')][_0x725e('0x3d')]?_0x3d28a5[_0x725e('0x3a')]:_0x4b92ba[_0x725e('0x38')];if(_0x34edcd[_0x725e('0x39')][_0x725e('0x47')]){_0x3d28a5[_0x725e('0x48')]=[{'all':!![]}];}_0x3d28a5=_[_0x725e('0x46')]({},_0x3d28a5,_0x34edcd['options']);return db[_0x725e('0x31')]['find'](_0x3d28a5)[_0x725e('0x2b')](handleEntityNotFound(_0x14753a,null))[_0x725e('0x2b')](function(_0x56438d){if(_0x56438d){var _0x118bf9=_0x56438d['get']({'plain':!![]});_0x118bf9=qs[_0x725e('0x52')](_0x118bf9,['id',_0x725e('0x53'),_0x725e('0x54'),'crudPermissions']);_0x34edcd[_0x725e('0x4f')]=_[_0x725e('0x52')](_0x34edcd[_0x725e('0x4f')],['id',_0x725e('0x53'),_0x725e('0x54')]);return db[_0x725e('0x55')][_0x725e('0x56')](function(_0x2dce43){return db['UserProfile'][_0x725e('0x4e')](_[_0x725e('0x46')](_0x118bf9,_0x34edcd['body']),{'include':_0x34edcd['query'][_0x725e('0x47')]?[{'all':!![]}]:undefined,'transaction':_0x2dce43})[_0x725e('0x2b')](function(_0x49a692){var _0x4918b2=_0x49a692[_0x725e('0x57')]({'plain':!![]});return db[_0x725e('0x58')][_0x725e('0x49')]({'where':{'userProfileId':_0x34edcd[_0x725e('0x51')]['id']},'raw':!![]})[_0x725e('0x2b')](function(_0x1e7e92){if(_0x1e7e92){return BPromise['each'](_0x1e7e92,function(_0x18fb12){return new BPromise(function(_0x4498fb,_0x5c5a3f){if(_0x18fb12[_0x725e('0x59')]===null||_0x18fb12[_0x725e('0x59')]===0x1)_0x4498fb(null);return db[_0x725e('0x5a')][_0x725e('0x49')]({'where':{'sectionId':_0x18fb12['id']},'raw':!![]})[_0x725e('0x2b')](function(_0x586ef5){var _0x459a71=_[_0x725e('0x30')](_0x586ef5,function(_0x435314){return qs[_0x725e('0x52')](_0x435314,['id',_0x725e('0x53'),_0x725e('0x54'),'sectionId']);});_0x4498fb(_0x459a71);})[_0x725e('0x4d')](function(_0x5f46f0){_0x5c5a3f(_0x5f46f0);});})['then'](function(_0x37fbf3){var _0x55ad92=qs['omit'](_0x18fb12,['id',_0x725e('0x53'),_0x725e('0x54')]);_0x55ad92[_0x725e('0x5b')]=_0x4918b2['id'];if(_0x37fbf3)_0x55ad92[_0x725e('0x5c')]=_0x37fbf3;return _0x55ad92;})[_0x725e('0x2b')](function(_0x2b748c){return db[_0x725e('0x58')]['create'](_0x2b748c,{'include':[{'model':db[_0x725e('0x5a')],'as':_0x725e('0x5c')}],'raw':!![],'transaction':_0x2dce43});});})[_0x725e('0x2b')](function(){return _0x4918b2;});}});});});}})['then'](respondWithResult(_0x14753a,0xc9))['catch'](handleError(_0x14753a,null));};exports[_0x725e('0x5d')]=function(_0x163080,_0x449f1f){if(_0x163080[_0x725e('0x4f')]['id']){delete _0x163080[_0x725e('0x4f')]['id'];}return db[_0x725e('0x31')][_0x725e('0x4c')]({'where':{'id':_0x163080['params']['id']}})[_0x725e('0x2b')](handleEntityNotFound(_0x449f1f,null))['then'](saveUpdates(_0x163080[_0x725e('0x4f')],null))['then'](respondWithResult(_0x449f1f,null))[_0x725e('0x4d')](handleError(_0x449f1f,null));};exports[_0x725e('0x2a')]=function(_0xb9f9b7,_0x4d7b14){return db[_0x725e('0x31')][_0x725e('0x4c')]({'where':{'id':_0xb9f9b7[_0x725e('0x51')]['id']}})[_0x725e('0x2b')](handleEntityNotFound(_0x4d7b14,null))[_0x725e('0x2b')](removeEntity(_0x4d7b14,null))[_0x725e('0x4d')](handleError(_0x4d7b14,null));};exports[_0x725e('0x5e')]=function(_0x162166,_0x3026d9){return db['UserProfile'][_0x725e('0x5e')]()[_0x725e('0x2b')](respondWithResult(_0x3026d9,null))['catch'](handleError(_0x3026d9,null));};exports[_0x725e('0x5f')]=function(_0x1a12c1,_0x1d2e49){var _0x36d9c7=_0x1a12c1[_0x725e('0x4f')];return db[_0x725e('0x31')][_0x725e('0x4c')]({'where':{'id':_0x1a12c1['params']['id']}})['then'](handleEntityNotFound(_0x1d2e49,null))['then'](function(_0x2d13df){if(_0x2d13df){return db[_0x725e('0x55')][_0x725e('0x56')](function(_0x57a324){return db[_0x725e('0x58')][_0x725e('0x2a')]({'where':{'userProfileId':_0x1a12c1['params']['id'],'sectionId':_['map'](_0x36d9c7,function(_0xd456e4){return _0xd456e4['sectionId'];})},'transaction':_0x57a324})[_0x725e('0x2b')](function(){var _0x21d6da=_['map'](_0x36d9c7,function(_0x3669e5){_0x3669e5[_0x725e('0x5b')]=_0x1a12c1[_0x725e('0x51')]['id'];return _0x3669e5;});var _0x47c965=[];return BPromise[_0x725e('0x60')](_0x21d6da,function(_0xf1d65){return db[_0x725e('0x58')]['create'](_0xf1d65,{'include':[{'model':db[_0x725e('0x5a')],'as':_0x725e('0x5c')}],'raw':!![],'transaction':_0x57a324})[_0x725e('0x2b')](function(_0x75897c){_0x47c965[_0x725e('0x61')](_0x75897c['get']({'plain':!![]}));});})['then'](function(){return _0x47c965;});});});}})[_0x725e('0x2b')](function(_0x3f28ed){return _0x3f28ed;})[_0x725e('0x2b')](respondWithResult(_0x1d2e49,null))['catch'](handleError(_0x1d2e49,null));};exports[_0x725e('0x62')]=function(_0x3625d3,_0x4d0809){var _0x28bb11;return db[_0x725e('0x31')][_0x725e('0x4c')]({'where':{'id':_0x3625d3[_0x725e('0x51')]['id']},'attributes':['id',_0x725e('0x2e')]})['then'](handleEntityNotFound(_0x4d0809,null))[_0x725e('0x2b')](function(_0x543e18){if(_0x543e18){_0x28bb11=_0x543e18;return db[_0x725e('0x58')][_0x725e('0x2a')]({'where':{'userProfileId':_0x3625d3[_0x725e('0x51')]['id'],'sectionId':_0x3625d3[_0x725e('0x39')][_0x725e('0x63')]}});}})[_0x725e('0x2b')](function(){return _0x28bb11;})[_0x725e('0x2b')](respondWithStatusCode(_0x4d0809,null))[_0x725e('0x4d')](handleError(_0x4d0809,null));};exports[_0x725e('0x64')]=function(_0x4f95f6,_0x46e467){var _0x1a89d1=[];var _0x2e35a9=[];return db[_0x725e('0x58')]['findAll']({'where':{'userProfileId':_0x4f95f6[_0x725e('0x51')]['id']},'raw':!![]})[_0x725e('0x2b')](function(_0x43ae58){_0x1a89d1=_[_0x725e('0x44')](_0x43ae58,function(_0x5482ab){return _0x5482ab[_0x725e('0x65')]===0x1||_['includes']([0x3eb,0x709],_0x5482ab[_0x725e('0x66')]);});if(!_['isEmpty'](_0x1a89d1)){return _['map'](_0x1a89d1,function(_0x3176f2){return _0x3176f2['sectionId'];});}else{return;}})[_0x725e('0x2b')](function(_0x4ed673){if(_0x4ed673)_0x2e35a9=_0x4ed673;if(_[_0x725e('0x67')](_0x2e35a9,0x64)){var _0x103cb7=_[_0x725e('0x4c')](_0x1a89d1,{'sectionId':0x64});return hasDefaultDashboard(_0x103cb7)['then'](function(_0x134822){return _[_0x725e('0x30')](_0x1a89d1,function(_0x56ccd1){if(_0x56ccd1[_0x725e('0x66')]===0x64){_0x56ccd1['subsections']=_0x134822;}return _0x56ccd1;});});}else{return;}})[_0x725e('0x2b')](function(_0x1f6078){if(_0x1f6078)_0x1a89d1=_0x1f6078;if(_['includes'](_0x2e35a9,0x3eb)){var _0x227f2d=_[_0x725e('0x4c')](_0x1a89d1,{'sectionId':0x3eb});return getCustomDashboards(_0x227f2d)[_0x725e('0x2b')](function(_0x106345){return _[_0x725e('0x30')](_0x1a89d1,function(_0x35f227){if(_0x227f2d[_0x725e('0x65')]){if(_0x35f227[_0x725e('0x66')]===0x3eb){_0x35f227[_0x725e('0x68')]=_0x106345;}}else{if(_0x35f227[_0x725e('0x66')]===0x64){_0x35f227[_0x725e('0x68')]=_0x106345;}}return _0x35f227;});});}else{return;}})[_0x725e('0x2b')](function(_0x105d31){if(_0x105d31)_0x1a89d1=_0x105d31;if(_[_0x725e('0x67')](_0x2e35a9,0x709)){var _0x19d2b4=_[_0x725e('0x4c')](_0x1a89d1,{'sectionId':0x709});return getPlugins(_0x19d2b4)[_0x725e('0x2b')](function(_0x489ccf){if(_0x19d2b4[_0x725e('0x65')]){return _[_0x725e('0x30')](_0x1a89d1,function(_0x2b8545){if(_0x2b8545[_0x725e('0x66')]===0x709){_0x2b8545[_0x725e('0x68')]=_0x489ccf;}return _0x2b8545;});}else{var _0x666dd4={'sectionId':0x76c,'enabled':0x1,'subsections':_0x489ccf};var _0xb42896=_[_0x725e('0x30')](_0x1a89d1);_0xb42896['push'](_0x666dd4);return _0xb42896;}});}else{return;}})['then'](function(_0x1689aa){if(_0x1689aa)_0x1a89d1=_0x1689aa;return _[_0x725e('0x44')](_0x1a89d1,[_0x725e('0x65'),0x1]);})['then'](respondWithResult(_0x46e467,null))['catch'](handleError(_0x46e467,null));};function hasDefaultDashboard(_0x36d24b){var _0x3b9459=[0x65];return new BPromise(function(_0x3bb261,_0x7bed14){try{if(_0x36d24b[_0x725e('0x59')]){_0x3bb261(_0x3b9459);}else{return db[_0x725e('0x5a')]['findOne']({'where':{'sectionId':_0x36d24b['id']},'raw':!![]})[_0x725e('0x2b')](function(_0x1a444d){_0x1a444d?_0x3bb261(_0x3b9459):_0x3bb261();});}}catch(_0x3573f2){_0x7bed14(_0x3573f2);}});}function getCustomDashboards(_0x56de7a){var _0xce526e=[];return new BPromise(function(_0x3c1a92,_0x585ab1){try{if(_0x56de7a[_0x725e('0x59')]){return db[_0x725e('0x69')][_0x725e('0x49')]({'raw':!![]})[_0x725e('0x2b')](function(_0x131c87){_0x131c87[_0x725e('0x6a')](function(_0x4a7eb7){_0xce526e['push'](_0x4a7eb7['id']+0x1869f);});_0x3c1a92(_0xce526e);});}else{return db[_0x725e('0x5a')][_0x725e('0x49')]({'where':{'sectionId':_0x56de7a['id']},'raw':!![]})[_0x725e('0x2b')](function(_0x174810){_0x174810[_0x725e('0x6a')](function(_0x5b41fe){_0xce526e[_0x725e('0x61')](_0x5b41fe[_0x725e('0x6b')]+0x1869f);});_0x3c1a92(_0xce526e);});}}catch(_0x6e24d0){_0x585ab1(_0x6e24d0);}});}function getPlugins(_0x4d767d){var _0x550ebb=[];return new BPromise(function(_0x43942a,_0x1b0be6){try{if(_0x4d767d[_0x725e('0x59')]){return db['Plugin'][_0x725e('0x49')]({'raw':!![]})[_0x725e('0x2b')](function(_0x791410){_0x791410[_0x725e('0x6a')](function(_0xbacdac){_0x550ebb[_0x725e('0x61')](_0xbacdac['id']+0x15b38);});_0x43942a(_0x550ebb);});}else{return db[_0x725e('0x5a')][_0x725e('0x49')]({'where':{'sectionId':_0x4d767d['id']},'raw':!![]})['then'](function(_0x260206){_0x260206['forEach'](function(_0x2510f2){_0x550ebb['push'](_0x2510f2[_0x725e('0x6b')]+0x15b38);});_0x43942a(_0x550ebb);});}}catch(_0x2e02a3){_0x1b0be6(_0x2e02a3);}});}exports[_0x725e('0x6c')]=function(_0x4fc3ef,_0x50bb3e){return db[_0x725e('0x31')][_0x725e('0x4c')]({'where':{'id':_0x4fc3ef['params']['id']}})[_0x725e('0x2b')](handleEntityNotFound(_0x50bb3e,null))[_0x725e('0x2b')](function(_0x3c39c9){if(_0x3c39c9){return db[_0x725e('0x55')][_0x725e('0x56')](function(_0x5b62fb){return db[_0x725e('0x58')][_0x725e('0x49')]({'where':{'userProfileId':_0x4fc3ef['params']['id']},'attributes':['id'],'raw':!![]})[_0x725e('0x2b')](function(_0x37ff9d){if(_0x37ff9d){return db[_0x725e('0x58')][_0x725e('0x2a')]({'where':{'userProfileId':_0x4fc3ef[_0x725e('0x51')]['id'],'id':_[_0x725e('0x30')](_0x37ff9d,function(_0x9e21df){return _0x9e21df['id'];})},'transaction':_0x5b62fb});}})['then'](function(_0x1743cc){var _0x51f731=_[_0x725e('0x30')](_0x4fc3ef[_0x725e('0x4f')],function(_0xf088dc){_0xf088dc[_0x725e('0x5b')]=_0x4fc3ef[_0x725e('0x51')]['id'];return _0xf088dc;});return db[_0x725e('0x58')]['bulkCreate'](_0x51f731,{'raw':!![],'transaction':_0x5b62fb});})['then'](function(_0x1d2a42){var _0xd2eb30=_[_0x725e('0x44')](_[_0x725e('0x30')](_0x1d2a42,function(_0x43dfa9){return _0x43dfa9[_0x725e('0x57')]({'plain':!![]});}),{'includeAll':![]});if(_0xd2eb30){return db[_0x725e('0x58')][_0x725e('0x49')]({'where':{'userProfileId':_0x4fc3ef[_0x725e('0x51')]['id'],'sectionId':_[_0x725e('0x30')](_0xd2eb30,function(_0xf9836e){return _0xf9836e[_0x725e('0x66')];})},'attributes':['id',_0x725e('0x66')],'raw':!![]})['then'](function(_0x1b2f91){var _0x5877e9=_[_0x725e('0x30')](_0x4fc3ef[_0x725e('0x4f')],function(_0x4f20b9){_0x4f20b9[_0x725e('0x5b')]=_0x4fc3ef['params']['id'];return _0x4f20b9;});return db[_0x725e('0x5a')][_0x725e('0x6d')](_0x5877e9,{'raw':!![],'transaction':_0x5b62fb});});}})['catch'](handleError(_0x50bb3e,null));});}})['then'](function(_0x1038d4){var _0x573be1=_[_0x725e('0x30')](_0x1038d4,function(_0x5c2c1e){return _0x5c2c1e[_0x725e('0x57')]({'plain':!![]});});})[_0x725e('0x2b')](respondWithResult(_0x50bb3e,null))['catch'](handleError(_0x50bb3e,null));};exports[_0x725e('0x6e')]=function(_0x1a7f45,_0x3eb866,_0x471a1a){return db[_0x725e('0x31')][_0x725e('0x4c')]({'where':{'id':_0x1a7f45[_0x725e('0x51')]['id']}})['then'](handleEntityNotFound(_0x3eb866,null))[_0x725e('0x2b')](function(_0x56d7d0){if(_0x56d7d0){return _0x56d7d0[_0x725e('0x6e')](_0x1a7f45[_0x725e('0x39')]['ids']);}})['then'](respondWithStatusCode(_0x3eb866,null))['catch'](handleError(_0x3eb866,null));};exports[_0x725e('0x6f')]=function(_0x5b3b7c,_0x5c566f){var _0x22cacc={};if(!_0x5b3b7c[_0x725e('0x39')][_0x725e('0x70')])throw new Error(_0x725e('0x71'));if(!_0x5b3b7c['query'][_0x725e('0x3e')](_0x725e('0x3f'))){_0x22cacc[_0x725e('0x22')]=qs['limit'](_0x5b3b7c[_0x725e('0x39')]['limit']);_0x22cacc[_0x725e('0x21')]=qs[_0x725e('0x21')](_0x5b3b7c[_0x725e('0x39')][_0x725e('0x21')]);}return db[_0x725e('0x31')][_0x725e('0x4c')]({'where':{'id':_0x5b3b7c[_0x725e('0x51')]['id']}})['then'](function(_0x530ac5){if(!_0x530ac5)throw new Error(_0x725e('0x72')+_0x5b3b7c[_0x725e('0x51')]['id']);return db[_0x725e('0x31')][_0x725e('0x6f')](_0x5b3b7c);})['then'](respondWithFilteredResult(_0x5c566f,_0x22cacc))[_0x725e('0x4d')](handleError(_0x5c566f,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 0a2bfbe..e0a76ba 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 _0xb7f0=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile','setMaxListeners'];(function(_0x3e8f3b,_0x33c90d){var _0x577742=function(_0x358477){while(--_0x358477){_0x3e8f3b['push'](_0x3e8f3b['shift']());}};_0x577742(++_0x33c90d);}(_0xb7f0,0x1eb));var _0x0b7f=function(_0x264ca3,_0x65b645){_0x264ca3=_0x264ca3-0x0;var _0x156d1e=_0xb7f0[_0x264ca3];return _0x156d1e;};'use strict';var EventEmitter=require(_0x0b7f('0x0'));var UserProfile=require(_0x0b7f('0x1'))['db'][_0x0b7f('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x0b7f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0b7f('0x4')};function emitEvent(_0xa1285e){return function(_0x228377,_0x188ea8,_0x34e188){UserProfileEvents[_0x0b7f('0x5')](_0xa1285e+':'+_0x228377['id'],_0x228377);UserProfileEvents[_0x0b7f('0x5')](_0xa1285e,_0x228377);_0x34e188(null);};}for(var e in events){if(events[_0x0b7f('0x6')](e)){var event=events[e];UserProfile[_0x0b7f('0x7')](e,emitEvent(event));}}module[_0x0b7f('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x4bd3=['events','UserProfile','setMaxListeners','emit','hook','exports'];(function(_0x1b2212,_0x2fc10e){var _0xab3ac7=function(_0x91b4a2){while(--_0x91b4a2){_0x1b2212['push'](_0x1b2212['shift']());}};_0xab3ac7(++_0x2fc10e);}(_0x4bd3,0x174));var _0x34bd=function(_0x2ce633,_0x12e3c9){_0x2ce633=_0x2ce633-0x0;var _0x487d9d=_0x4bd3[_0x2ce633];return _0x487d9d;};'use strict';var EventEmitter=require(_0x34bd('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x34bd('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x34bd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x22b921){return function(_0x44854a,_0x1fc8eb,_0x5846f3){UserProfileEvents[_0x34bd('0x3')](_0x22b921+':'+_0x44854a['id'],_0x44854a);UserProfileEvents[_0x34bd('0x3')](_0x22b921,_0x44854a);_0x5846f3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x34bd('0x4')](e,emitEvent(event));}}module[_0x34bd('0x5')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 7ba3a67..4750459 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 _0xed1c=['UserProfile','user_profiles','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','find','params','ignore','union','autoAssociation','all','keys','filters','intersection','attributes','nolimit','limit','offset','where','pick','key','VIRTUAL','foreignKey','merge','options','includeAll','include','forEach','reportType','default','DefaultReports','custom','rows','count','CmContact','Tags','color','ThroughTags','tag','openTabs','true','chat','dataValues','sms','mail','openchannel','whatsapp','lodash','./userProfile.attributes','models','filter','field','value','findAll','then','associatedResources','catch','model','map','name','resolve','AnalyticExtractedReport','resourceId','type','toLowerCase','SquareProject','odbc','childModel','SquareOdbc','squarerecordings','parentSections','SquareProjects','projectName','projects','JscriptyProject','Lists','ListId','lists','companies','CmCompany','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','outboundroutes','VoiceExtension','contexts','VoiceContext','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoicePrefix','ivrcampaigns','Campaign','mailqueues','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','users','agents','admin','user','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','Dashboard','pauses','Pause','scheduler','Schedule','sounds','Sound','Tag','templates','Template','triggers','Trigger','Variable','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','ui.UserId\x20=\x20?','query','OpenTabs','define'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xed1c,0xe4));var _0xced1=function(_0x44241f,_0x404b5a){_0x44241f=_0x44241f-0x0;var _0xd60e65=_0xed1c[_0x44241f];return _0xd60e65;};'use strict';var _=require(_0xced1('0x0'));var attributes=require(_0xced1('0x1'));var qs=require('../../components/parsers/qs');var squel=require('squel');module['exports']=function(_0x4c3102){var _0x424db6=_0x4c3102[_0xced1('0x2')];function _0x79202e(_0x47a45c,_0x1e23a9){return new Promise(function(_0x445160,_0x466657){if(!_0x1e23a9)return _0x445160(null);var _0x37b22b=_0x1e23a9['filter']?{[_0x1e23a9[_0xced1('0x3')][_0xced1('0x4')]]:_0x1e23a9[_0xced1('0x3')][_0xced1('0x5')]}:undefined;return _0x424db6[_0x47a45c][_0xced1('0x6')]({'where':_0x37b22b,'raw':!![]})[_0xced1('0x7')](function(_0x325dd2){_0x1e23a9[_0xced1('0x8')]=_['map'](_0x325dd2,'id');_0x445160(_0x1e23a9);})[_0xced1('0x9')](function(_0x59c820){_0x466657(_0x59c820);});});}function _0x3464f3(_0x15e99f,_0x1edaaa){return new Promise(function(_0x18c028,_0x15f678){var _0x44b05c=_0x15e99f[_0xced1('0x3')]?{[_0x15e99f['filter'][_0xced1('0x4')]]:_0x15e99f[_0xced1('0x3')][_0xced1('0x5')]}:undefined;return _0x424db6[_0x15e99f[_0xced1('0xa')]]['findAll']({'where':_0x44b05c,'raw':!![]})[_0xced1('0x7')](function(_0x31a32c){_0x1edaaa['associatedResources']=_[_0xced1('0xb')](_0x31a32c,function(_0x26f81){return _0x26f81[_0xced1('0xc')];});_0x18c028(_0x1edaaa);})[_0xced1('0x9')](function(_0x47baec){_0x15f678(_0x47baec);});});}function _0x5560af(_0x3eb3ac,_0x4178d8,_0x236473){if(!_0x4178d8)return Promise[_0xced1('0xd')](null);return new Promise(function(_0x3e53bd,_0x292997){return _0x424db6['UserProfileResource']['findAll']({'where':{'sectionId':_0x4178d8['id']},'raw':!![]})[_0xced1('0x7')](function(_0x111fb0){if(_0x3eb3ac[_0xced1('0x4')]&&_0x3eb3ac['field']!=='id'){_0x4178d8[_0xced1('0x8')]=_[_0xced1('0xb')](_0x111fb0,function(_0x3e51e4){return _0x3e51e4[_0x3eb3ac['field']];});}else{if(_0x236473===_0xced1('0xe')){_0x4178d8[_0xced1('0x8')]=_[_0xced1('0xb')](_0x111fb0,function(_0x4819fd){return{'id':_0x4819fd[_0xced1('0xf')],'type':_0x4819fd[_0xced1('0x10')]};});}else{_0x4178d8[_0xced1('0x8')]=_['map'](_0x111fb0,function(_0x4dab56){return _0x4dab56[_0xced1('0xf')];});}}_0x3e53bd(_0x4178d8);})[_0xced1('0x9')](function(_0x2a6248){_0x292997(_0x2a6248);});});}function _0x20dcb4(_0x210d7e,_0x49c8b9){var _0x14f47e={'parentSections':[]};switch(_0x210d7e[_0xced1('0x11')]()){case'squareprojects':_0x14f47e['childModel']=_0xced1('0x12');break;case _0xced1('0x13'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x15');break;case _0xced1('0x16'):_0x14f47e[_0xced1('0x14')]='SquareRecording';_0x14f47e[_0xced1('0x17')]=[{'name':_0xced1('0x18'),'field':_0xced1('0xc'),'foreignKey':_0xced1('0x19')}];break;case _0xced1('0x1a'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x1b');break;case'contacts':_0x14f47e[_0xced1('0x14')]='CmContact';_0x14f47e[_0xced1('0x17')]=[{'name':_0xced1('0x1c'),'field':'id','foreignKey':_0xced1('0x1d')}];break;case _0xced1('0x1e'):_0x14f47e['childModel']='CmList';break;case _0xced1('0x1f'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x20');break;case'globalcustomfields':_0x14f47e['childModel']='CmCustomField';break;case _0xced1('0x21'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x22');break;case _0xced1('0x23'):_0x14f47e['childModel']=_0xced1('0x24');break;case _0xced1('0x25'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x26');break;case _0xced1('0x27'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x28');break;case'inboundroutes':case'internalroutes':case _0xced1('0x29'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x2a');break;case _0xced1('0x2b'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x2c');break;case'voicemails':_0x14f47e['childModel']='VoiceMail';break;case'voicerecordings':_0x14f47e[_0xced1('0x14')]=_0xced1('0x2d');_0x14f47e[_0xced1('0x17')]=[{'name':_0xced1('0x2e'),'field':_0xced1('0xc'),'foreignKey':_0xced1('0x2f'),'model':_0xced1('0x30'),'filter':{'field':_0xced1('0x31'),'value':[_0xced1('0x32')]}},{'name':_0xced1('0x33'),'field':_0xced1('0xc'),'foreignKey':_0xced1('0x2f'),'model':_0xced1('0x30'),'filter':{'field':'role','value':[_0xced1('0x34')]}},{'name':_0xced1('0x35'),'field':_0xced1('0xc'),'foreignKey':_0xced1('0x36'),'model':_0xced1('0x37'),'filter':{'field':_0xced1('0x10'),'value':['inbound']}},{'name':_0xced1('0x38'),'field':_0xced1('0xc'),'foreignKey':_0xced1('0x36'),'model':_0xced1('0x37'),'filter':{'field':_0xced1('0x10'),'value':[_0xced1('0x39')]}}];break;case _0xced1('0x3a'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x3b');break;case _0xced1('0x3c'):_0x14f47e[_0xced1('0x14')]='VoiceChanSpy';break;case'voiceprefixes':_0x14f47e[_0xced1('0x14')]=_0xced1('0x3d');break;case _0xced1('0x3e'):_0x14f47e['childModel']=_0xced1('0x3f');break;case _0xced1('0x40'):_0x14f47e[_0xced1('0x14')]='MailQueue';break;case _0xced1('0x41'):_0x14f47e[_0xced1('0x14')]='MailAccount';break;case _0xced1('0x42'):_0x14f47e['childModel']=_0xced1('0x43');break;case _0xced1('0x44'):_0x14f47e['childModel']=_0xced1('0x45');break;case _0xced1('0x46'):_0x14f47e[_0xced1('0x14')]='OpenchannelAccount';break;case _0xced1('0x47'):_0x14f47e[_0xced1('0x14')]='SmsQueue';break;case _0xced1('0x48'):_0x14f47e['childModel']='SmsAccount';break;case _0xced1('0x49'):_0x14f47e['childModel']=_0xced1('0x4a');break;case _0xced1('0x4b'):_0x14f47e[_0xced1('0x14')]='WhatsappAccount';break;case _0xced1('0x4c'):_0x14f47e['childModel']=_0xced1('0x4d');break;case _0xced1('0x4e'):case _0xced1('0x4f'):_0x14f47e[_0xced1('0x14')]='VoiceQueue';if(_0x49c8b9){_0x14f47e[_0xced1('0x17')]=[{'name':_0xced1('0x35')},{'name':'QueueCampaigns'}];}break;case _0xced1('0x50'):case _0xced1('0x51'):case'telephones':_0x14f47e[_0xced1('0x14')]=_0xced1('0x30');if(_0x49c8b9){_0x14f47e[_0xced1('0x17')]=[{'name':'Users','filter':{'field':_0xced1('0x31'),'value':[_0xced1('0x52'),_0xced1('0x53')]},'ignore':!![]},{'name':_0xced1('0x2e')},{'name':_0xced1('0x33')}];}break;case'zendeskaccounts':_0x14f47e[_0xced1('0x14')]='ZendeskAccount';break;case _0xced1('0x54'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x55');break;case _0xced1('0x56'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x57');break;case'sugarcrmaccounts':_0x14f47e[_0xced1('0x14')]=_0xced1('0x58');break;case'deskaccounts':_0x14f47e[_0xced1('0x14')]='DeskAccount';break;case'zohoaccounts':_0x14f47e[_0xced1('0x14')]=_0xced1('0x59');break;case _0xced1('0x5a'):_0x14f47e[_0xced1('0x14')]='User';break;case _0xced1('0x5b'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x5c');break;case'dispositions':_0x14f47e['childModel']=_0xced1('0x5d');break;case _0xced1('0x5e'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x5f');break;case'intervals':_0x14f47e['childModel']='Interval';break;case _0xced1('0x60'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x61');break;case _0xced1('0x62'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x63');break;case _0xced1('0x64'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x65');break;case'tags':_0x14f47e[_0xced1('0x14')]=_0xced1('0x66');break;case _0xced1('0x67'):_0x14f47e['childModel']=_0xced1('0x68');break;case _0xced1('0x69'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x6a');break;case'trunks':_0x14f47e[_0xced1('0x14')]='Trunk';break;case'variables':_0x14f47e[_0xced1('0x14')]=_0xced1('0x6b');break;case'plugins':_0x14f47e['childModel']='Plugin';break;case _0xced1('0x6c'):_0x14f47e['childModel']=_0xced1('0xe');_0x14f47e[_0xced1('0x17')]=[{'name':_0xced1('0x6d'),'field':'id','foreignKey':_0xced1('0x6e')}];break;case _0xced1('0x6f'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x70');break;}return _0x14f47e;}function _0x849056(_0x4d5a58,_0x4f17fb){var _0x4832d2=_0x4d5a58[_0xced1('0x71')](0x0)[_0xced1('0x72')]()+_0x4d5a58[_0xced1('0x73')](0x1);var _0x5b40ea={'type':_0x424db6[_0xced1('0x74')][_0xced1('0x75')][_0xced1('0x76')],'raw':!![]};return new Promise(function(_0x4365da,_0x5950d2){var _0x458f36=squel[_0xced1('0x77')]()[_0xced1('0x4')](_0xced1('0x78')+_0x4832d2+_0xced1('0x79'),'id')[_0xced1('0x4')](_0xced1('0x7a'))[_0xced1('0x7b')]('user_has_'+_0x4d5a58+'_interactions','ui')['where'](_0xced1('0x7c'),_0x4f17fb['id']);return _0x424db6['sequelize'][_0xced1('0x7d')](_0x458f36['toString'](),_0x5b40ea)['then'](function(_0x37bec5){_0x4f17fb[_0x4832d2+_0xced1('0x7e')]=_0x37bec5;_0x4365da(_0x37bec5);})[_0xced1('0x9')](function(_0x2bdcea){_0x5950d2(_0x2bdcea);});});}return _0x4c3102[_0xced1('0x7f')](_0xced1('0x80'),attributes,{'tableName':_0xced1('0x81'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x164ca1){var _0x395b52={'raw':![],'where':{}};var _0x2f22aa={};var _0x1d850b={'count':0x0,'rows':[]};var _0x57b644=_0x164ca1[_0xced1('0x7d')][_0xced1('0x82')];var _0x4956a4=_0x164ca1[_0xced1('0x7d')][_0xced1('0x83')]||![];var _0x55c21d=_0x20dcb4(_0x57b644,_0x4956a4);if(!_0x55c21d[_0xced1('0x14')])throw new Error(_0xced1('0x84')+_0x57b644+'\x27');var _0x2dd0d6=[{'name':_0x57b644}];if(!_[_0xced1('0x85')](_0x55c21d[_0xced1('0x17')]))_0x2dd0d6=_0x55c21d['parentSections'];var _0x59806a=[];for(var _0x487094=0x0;_0x487094<_0x2dd0d6[_0xced1('0x86')];_0x487094++){_0x59806a[_0xced1('0x87')](_0x424db6['UserProfileSection'][_0xced1('0x88')]({'where':{'userProfileId':_0x164ca1[_0xced1('0x89')]['id'],'name':_0x2dd0d6[_0x487094][_0xced1('0xc')]},'raw':!![]}));}return Promise['all'](_0x59806a)[_0xced1('0x7')](function(_0x384efc){var _0x4ed12c=_[_0xced1('0x3')](_0x384efc,function(_0x47e33d){return _0x47e33d?_0x47e33d:undefined;});var _0x1e77e8=_[_0xced1('0x3')](_0x2dd0d6,[_0xced1('0x8a'),!![]]);var _0x2b54e2=_[_0xced1('0x85')](_0x4ed12c)&&_[_0xced1('0x85')](_0x1e77e8)?null:_[_0xced1('0x8b')](_0x1e77e8,_0x4ed12c);if(!_0x2b54e2)return null;var _0x49e802=[];for(var _0x395fe0=0x0;_0x395fe0<_0x2b54e2[_0xced1('0x86')];_0x395fe0++){var _0x154808=_['find'](_0x2dd0d6,function(_0x5c2567){return _0x2b54e2[_0x395fe0]?_0x5c2567[_0xced1('0xc')]===_0x2b54e2[_0x395fe0][_0xced1('0xc')]:null;});if(_0x154808){if(_0x2b54e2[_0x395fe0]['ignore']){_0x49e802[_0xced1('0x87')](_0x79202e(_0x55c21d[_0xced1('0x14')],_0x2b54e2[_0x395fe0]));}else{if(!_0x2b54e2[_0x395fe0][_0xced1('0x8c')]){_0x49e802['push'](_0x5560af(_0x154808,_0x2b54e2[_0x395fe0],_0x55c21d['childModel']));}else{if(_0x154808[_0xced1('0xa')]){_0x49e802[_0xced1('0x87')](_0x3464f3(_0x154808,_0x2b54e2[_0x395fe0]));}}}}}return Promise[_0xced1('0x8d')](_0x49e802);})[_0xced1('0x7')](function(_0x95c83b){var _0x224b8f=_0x95c83b;var _0x5b6acb=null;if(_0x224b8f){_0x5b6acb=_0x224b8f[_0xced1('0x86')]===0x1?_0x224b8f[0x0]:null;}if(!_0x5b6acb&&!_0x224b8f)return _0x1d850b;var _0x4fa327=_0x424db6[_0x55c21d['childModel']]['rawAttributes'];_0x2f22aa['model']=_[_0xced1('0x8e')](_0x4fa327);_0x2f22aa[_0xced1('0x7d')]=_['keys'](_0x164ca1['query']);_0x2f22aa[_0xced1('0x8f')]=_[_0xced1('0x90')](_0x2f22aa['model'],_0x2f22aa['query']);_0x395b52[_0xced1('0x91')]=_[_0xced1('0x90')](_0x2f22aa['model'],qs['fields'](_0x164ca1['query']['fields']));_0x395b52[_0xced1('0x91')]=_0x395b52[_0xced1('0x91')][_0xced1('0x86')]?_0x395b52[_0xced1('0x91')]:_0x2f22aa[_0xced1('0xa')];if(!_0x164ca1[_0xced1('0x7d')]['hasOwnProperty'](_0xced1('0x92'))){_0x395b52[_0xced1('0x93')]=qs[_0xced1('0x93')](_0x164ca1[_0xced1('0x7d')][_0xced1('0x93')]);_0x395b52[_0xced1('0x94')]=qs[_0xced1('0x94')](_0x164ca1[_0xced1('0x7d')][_0xced1('0x94')]);}_0x395b52['order']=qs['sort'](_0x164ca1[_0xced1('0x7d')]['sort']);_0x395b52[_0xced1('0x95')]=qs['filters'](_[_0xced1('0x96')](_0x164ca1[_0xced1('0x7d')],_0x2f22aa[_0xced1('0x8f')]));if(_0x164ca1[_0xced1('0x7d')][_0xced1('0x3')]){_0x395b52[_0xced1('0x95')]=_['merge'](_0x395b52[_0xced1('0x95')],{'$or':_[_0xced1('0xb')](_0x4fa327,function(_0x4104ad){if(_0x4104ad[_0xced1('0x10')][_0xced1('0x97')]!==_0xced1('0x98')){var _0x4fc259={};_0x4fc259[_0x4104ad['field']]={'$like':'%'+_0x164ca1[_0xced1('0x7d')][_0xced1('0x3')]+'%'};return _0x4fc259;}})});}var _0x40eed6=[];var _0x173e9a=null;var _0x37fa95={};if(_0x5b6acb){_0x173e9a=_['find'](_0x2dd0d6,[_0xced1('0xc'),_0x5b6acb[_0xced1('0xc')]]);if(_0x173e9a[_0xced1('0x4')]){_0x37fa95={};if(_0x55c21d[_0xced1('0x14')]==='AnalyticExtractedReport'){_0x37fa95[_0x173e9a[_0xced1('0x99')]]=_[_0xced1('0xb')](_0x5b6acb['associatedResources'],'id');}else{_0x37fa95[_0x173e9a[_0xced1('0x99')]]=_0x5b6acb['associatedResources'];}_0x40eed6[_0xced1('0x87')](_0x37fa95);}else{_0x395b52[_0xced1('0x95')]['id']=_0x5b6acb[_0xced1('0x8')];}}else{for(var _0x19f15d=0x0;_0x19f15d<_0x224b8f[_0xced1('0x86')];_0x19f15d++){_0x173e9a=_[_0xced1('0x88')](_0x2dd0d6,[_0xced1('0xc'),_0x224b8f[_0x19f15d][_0xced1('0xc')]]);if(_0x173e9a[_0xced1('0x4')]){_0x37fa95={};_0x37fa95[_0x173e9a[_0xced1('0x99')]]=_0x224b8f[_0x19f15d]['associatedResources'];_0x40eed6[_0xced1('0x87')](_0x37fa95);}else{if(!_0x395b52[_0xced1('0x95')]['id'])_0x395b52[_0xced1('0x95')]['id']=[];_0x224b8f[_0x19f15d][_0xced1('0x8')]['forEach'](function(_0x35ff8d){_0x395b52[_0xced1('0x95')]['id'][_0xced1('0x87')](_0x35ff8d);});}}}if(!_[_0xced1('0x85')](_0x40eed6)){_0x395b52['where']=_[_0xced1('0x9a')](_0x395b52[_0xced1('0x95')],{'$and':{'$or':_0x40eed6}});}_0x395b52=_[_0xced1('0x9a')]({},_0x395b52,_0x164ca1[_0xced1('0x9b')]);if(_0x5b6acb&&!_0x5b6acb[_0xced1('0x8c')]&&_0x55c21d['childModel']===_0xced1('0xe')){if(_0x164ca1['query'][_0xced1('0x9c')]){_0x395b52[_0xced1('0x9d')]=[{'all':!![]}];}return _0x424db6[_0x55c21d[_0xced1('0x14')]]['findAll'](_0x395b52)[_0xced1('0x7')](function(_0x328079){var _0x5eca32=[];_0x328079[_0xced1('0x9e')](function(_0x4eaf08){var _0xc4a5c8;switch(_0x4eaf08[_0xced1('0x9f')]){case _0xced1('0xa0'):_0xc4a5c8=_['find'](_0x5b6acb['associatedResources'],function(_0x1b6c00){return _0x1b6c00['id']===_0x4eaf08[_0xced1('0x6e')]&&_0x1b6c00[_0xced1('0x10')]===_0xced1('0xa1');});break;case _0xced1('0xa2'):_0xc4a5c8=_['find'](_0x5b6acb['associatedResources'],function(_0x30a9a1){return _0x30a9a1['id']===_0x4eaf08[_0xced1('0x6e')]&&_0x30a9a1[_0xced1('0x10')]==='CustomReports';});break;}if(_0xc4a5c8)_0x5eca32[_0xced1('0x87')](_0x4eaf08);});_0x1d850b['count']=_0x5eca32['length'];_0x1d850b[_0xced1('0xa3')]=_0x5eca32;return _0x1d850b;});}else{return _0x424db6[_0x55c21d['childModel']][_0xced1('0xa4')]({'where':_0x395b52['where']})[_0xced1('0x7')](function(_0x19120f){_0x1d850b[_0xced1('0xa4')]=_0x19120f;if(_0x164ca1[_0xced1('0x7d')][_0xced1('0x9c')]){if(_0x55c21d[_0xced1('0x14')]===_0xced1('0xa5')){_0x395b52['include']=[{'model':_0x424db6['Tag'],'as':_0xced1('0xa6'),'attributes':['id',_0xced1('0xc'),_0xced1('0xa7')],'required':_0x164ca1[_0xced1('0x7d')]['tag']?!![]:![]},{'model':_0x424db6['Tag'],'as':_0xced1('0xa8'),'attributes':['id','name',_0xced1('0xa7')],'through':_0x164ca1[_0xced1('0x7d')][_0xced1('0xa9')]?{'attributes':[],'where':{'TagId':_0x164ca1['query'][_0xced1('0xa9')]||undefined}}:{},'required':_0x164ca1[_0xced1('0x7d')]['tag']?!![]:![]}];}else{_0x395b52[_0xced1('0x9d')]=[{'all':!![]}];}}return _0x424db6[_0x55c21d[_0xced1('0x14')]][_0xced1('0x6')](_0x395b52);})['then'](function(_0x2f4f7a){_0x1d850b[_0xced1('0xa3')]=_0x2f4f7a;if(_0x57b644===_0xced1('0x2e')&&_0x164ca1[_0xced1('0x7d')][_0xced1('0xaa')]===_0xced1('0xab')){var _0x53fca5=[];for(var _0x5126d2=0x0;_0x5126d2<_0x1d850b[_0xced1('0xa3')][_0xced1('0x86')];_0x5126d2++){_0x53fca5[_0xced1('0x87')](_0x849056(_0xced1('0xac'),_0x1d850b[_0xced1('0xa3')][_0x5126d2][_0xced1('0xad')]));_0x53fca5[_0xced1('0x87')](_0x849056(_0xced1('0xae'),_0x1d850b[_0xced1('0xa3')][_0x5126d2][_0xced1('0xad')]));_0x53fca5[_0xced1('0x87')](_0x849056('fax',_0x1d850b['rows'][_0x5126d2][_0xced1('0xad')]));_0x53fca5[_0xced1('0x87')](_0x849056(_0xced1('0xaf'),_0x1d850b[_0xced1('0xa3')][_0x5126d2][_0xced1('0xad')]));_0x53fca5[_0xced1('0x87')](_0x849056(_0xced1('0xb0'),_0x1d850b[_0xced1('0xa3')][_0x5126d2][_0xced1('0xad')]));_0x53fca5[_0xced1('0x87')](_0x849056(_0xced1('0xb1'),_0x1d850b[_0xced1('0xa3')][_0x5126d2][_0xced1('0xad')]));}return Promise[_0xced1('0x8d')](_0x53fca5)[_0xced1('0x7')](function(){return _0x1d850b;});}return _0x1d850b;});}});}}});}; \ No newline at end of file +var _0x71ab=['whatsappaccounts','teams','Team','voicequeues','users','agents','telephones','Users','admin','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','dispositions','Disposition','customdashboards','intervals','Interval','pauses','scheduler','Sound','Tag','templates','Template','Trigger','trunks','Trunk','variables','Variable','plugins','extractedreports','AnalyticExtractedReport','reportId','metrics','AnalyticMetric','toUpperCase','slice','Sequelize','QueryTypes','ui.','ui.createdAt','from','user_has_','where','ui.UserId\x20=\x20?','query','toString','OpenTabs','define','user_profiles','section','mergeResources','isEmpty','length','find','params','all','union','autoAssociation','push','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','merge','key','forEach','options','include','DefaultReports','CustomReports','count','rows','includeAll','color','ThroughTags','tag','openTabs','true','chat','dataValues','sms','mail','openchannel','whatsapp','./userProfile.attributes','squel','models','filter','field','value','findAll','then','associatedResources','catch','model','map','name','UserProfileResource','type','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','globalcustomfields','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceRecording','Agents','membername','User','agent','role','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','WhatsappQueue'];(function(_0x150751,_0x562593){var _0x328e04=function(_0x27d030){while(--_0x27d030){_0x150751['push'](_0x150751['shift']());}};_0x328e04(++_0x562593);}(_0x71ab,0x64));var _0xb71a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x71ab[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var attributes=require(_0xb71a('0x0'));var qs=require('../../components/parsers/qs');var squel=require(_0xb71a('0x1'));module['exports']=function(_0x3e985a){var _0x3f0529=_0x3e985a[_0xb71a('0x2')];function _0x4094b2(_0x37ce74,_0x3c6438){return new Promise(function(_0x2192e8,_0x38d931){if(!_0x3c6438)return _0x2192e8(null);var _0x22c072=_0x3c6438[_0xb71a('0x3')]?{[_0x3c6438[_0xb71a('0x3')][_0xb71a('0x4')]]:_0x3c6438[_0xb71a('0x3')][_0xb71a('0x5')]}:undefined;return _0x3f0529[_0x37ce74][_0xb71a('0x6')]({'where':_0x22c072,'raw':!![]})[_0xb71a('0x7')](function(_0x378c96){_0x3c6438[_0xb71a('0x8')]=_['map'](_0x378c96,'id');_0x2192e8(_0x3c6438);})[_0xb71a('0x9')](function(_0x58956d){_0x38d931(_0x58956d);});});}function _0x3d7bd7(_0x343d2f,_0x24f5fd){return new Promise(function(_0x591311,_0x3909b4){var _0x4c167a=_0x343d2f[_0xb71a('0x3')]?{[_0x343d2f['filter']['field']]:_0x343d2f[_0xb71a('0x3')][_0xb71a('0x5')]}:undefined;return _0x3f0529[_0x343d2f[_0xb71a('0xa')]][_0xb71a('0x6')]({'where':_0x4c167a,'raw':!![]})['then'](function(_0x47ee48){_0x24f5fd['associatedResources']=_[_0xb71a('0xb')](_0x47ee48,function(_0xc189cd){return _0xc189cd[_0xb71a('0xc')];});_0x591311(_0x24f5fd);})[_0xb71a('0x9')](function(_0x3cd0f0){_0x3909b4(_0x3cd0f0);});});}function _0x1e9363(_0x31def2,_0x2ec64a,_0x7710a8){if(!_0x2ec64a)return Promise['resolve'](null);return new Promise(function(_0x1ca65e,_0x2d6369){return _0x3f0529[_0xb71a('0xd')][_0xb71a('0x6')]({'where':{'sectionId':_0x2ec64a['id']},'raw':!![]})[_0xb71a('0x7')](function(_0xf83e73){if(_0x31def2[_0xb71a('0x4')]&&_0x31def2[_0xb71a('0x4')]!=='id'){_0x2ec64a[_0xb71a('0x8')]=_[_0xb71a('0xb')](_0xf83e73,function(_0x16394a){return _0x16394a[_0x31def2['field']];});}else{if(_0x7710a8==='AnalyticExtractedReport'){_0x2ec64a[_0xb71a('0x8')]=_[_0xb71a('0xb')](_0xf83e73,function(_0x4a4f4e){return{'id':_0x4a4f4e['resourceId'],'type':_0x4a4f4e[_0xb71a('0xe')]};});}else{_0x2ec64a['associatedResources']=_[_0xb71a('0xb')](_0xf83e73,function(_0x4227c7){return _0x4227c7[_0xb71a('0xf')];});}}_0x1ca65e(_0x2ec64a);})[_0xb71a('0x9')](function(_0x38a728){_0x2d6369(_0x38a728);});});}function _0x14b2a1(_0x2f4fac,_0x14aac7){var _0x5f3f19={'parentSections':[]};switch(_0x2f4fac[_0xb71a('0x10')]()){case _0xb71a('0x11'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x13');break;case _0xb71a('0x14'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x15');break;case _0xb71a('0x16'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x17');_0x5f3f19[_0xb71a('0x18')]=[{'name':_0xb71a('0x19'),'field':_0xb71a('0xc'),'foreignKey':'projectName'}];break;case _0xb71a('0x1a'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x1b');break;case _0xb71a('0x1c'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x1d');_0x5f3f19[_0xb71a('0x18')]=[{'name':_0xb71a('0x1e'),'field':'id','foreignKey':_0xb71a('0x1f')}];break;case _0xb71a('0x20'):_0x5f3f19[_0xb71a('0x12')]='CmList';break;case'companies':_0x5f3f19[_0xb71a('0x12')]='CmCompany';break;case _0xb71a('0x21'):_0x5f3f19[_0xb71a('0x12')]='CmCustomField';break;case _0xb71a('0x22'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x23');break;case _0xb71a('0x24'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x25');break;case'faxqueues':_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x26');break;case _0xb71a('0x27'):_0x5f3f19[_0xb71a('0x12')]='FaxAccount';break;case _0xb71a('0x28'):case _0xb71a('0x29'):case _0xb71a('0x2a'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x2b');break;case _0xb71a('0x2c'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x2d');break;case _0xb71a('0x2e'):_0x5f3f19[_0xb71a('0x12')]='VoiceMail';break;case'voicerecordings':_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x2f');_0x5f3f19[_0xb71a('0x18')]=[{'name':_0xb71a('0x30'),'field':_0xb71a('0xc'),'foreignKey':_0xb71a('0x31'),'model':_0xb71a('0x32'),'filter':{'field':'role','value':[_0xb71a('0x33')]}},{'name':'Telephones','field':_0xb71a('0xc'),'foreignKey':_0xb71a('0x31'),'model':_0xb71a('0x32'),'filter':{'field':_0xb71a('0x34'),'value':['telephone']}},{'name':_0xb71a('0x35'),'field':_0xb71a('0xc'),'foreignKey':_0xb71a('0x36'),'model':_0xb71a('0x37'),'filter':{'field':_0xb71a('0xe'),'value':[_0xb71a('0x38')]}},{'name':_0xb71a('0x39'),'field':_0xb71a('0xc'),'foreignKey':_0xb71a('0x36'),'model':'VoiceQueue','filter':{'field':_0xb71a('0xe'),'value':['outbound']}}];break;case _0xb71a('0x3a'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x3b');break;case _0xb71a('0x3c'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x3d');break;case'voiceprefixes':_0x5f3f19['childModel']='VoicePrefix';break;case _0xb71a('0x3e'):_0x5f3f19['childModel']=_0xb71a('0x3f');break;case _0xb71a('0x40'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x41');break;case _0xb71a('0x42'):_0x5f3f19[_0xb71a('0x12')]='MailAccount';break;case _0xb71a('0x43'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x44');break;case _0xb71a('0x45'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x46');break;case'openchannelaccounts':_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x47');break;case _0xb71a('0x48'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x49');break;case _0xb71a('0x4a'):_0x5f3f19[_0xb71a('0x12')]='SmsAccount';break;case'whatsappqueues':_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x4b');break;case _0xb71a('0x4c'):_0x5f3f19[_0xb71a('0x12')]='WhatsappAccount';break;case _0xb71a('0x4d'):_0x5f3f19['childModel']=_0xb71a('0x4e');break;case _0xb71a('0x4f'):case'queuecampaigns':_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x37');if(_0x14aac7){_0x5f3f19[_0xb71a('0x18')]=[{'name':_0xb71a('0x35')},{'name':'QueueCampaigns'}];}break;case _0xb71a('0x50'):case _0xb71a('0x51'):case _0xb71a('0x52'):_0x5f3f19['childModel']=_0xb71a('0x32');if(_0x14aac7){_0x5f3f19[_0xb71a('0x18')]=[{'name':_0xb71a('0x53'),'filter':{'field':'role','value':[_0xb71a('0x54'),_0xb71a('0x55')]},'ignore':!![]},{'name':_0xb71a('0x30')},{'name':_0xb71a('0x56')}];}break;case _0xb71a('0x57'):_0x5f3f19['childModel']=_0xb71a('0x58');break;case _0xb71a('0x59'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x5a');break;case'freshdeskaccounts':_0x5f3f19['childModel']=_0xb71a('0x5b');break;case _0xb71a('0x5c'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x5d');break;case _0xb71a('0x5e'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x5f');break;case _0xb71a('0x60'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x61');break;case'vtigeraccounts':_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x32');break;case'cannedanswers':_0x5f3f19[_0xb71a('0x12')]='CannedAnswer';break;case _0xb71a('0x62'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x63');break;case _0xb71a('0x64'):_0x5f3f19[_0xb71a('0x12')]='Dashboard';break;case _0xb71a('0x65'):_0x5f3f19['childModel']=_0xb71a('0x66');break;case _0xb71a('0x67'):_0x5f3f19['childModel']='Pause';break;case _0xb71a('0x68'):_0x5f3f19[_0xb71a('0x12')]='Schedule';break;case'sounds':_0x5f3f19['childModel']=_0xb71a('0x69');break;case'tags':_0x5f3f19['childModel']=_0xb71a('0x6a');break;case _0xb71a('0x6b'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x6c');break;case'triggers':_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x6d');break;case _0xb71a('0x6e'):_0x5f3f19['childModel']=_0xb71a('0x6f');break;case _0xb71a('0x70'):_0x5f3f19['childModel']=_0xb71a('0x71');break;case _0xb71a('0x72'):_0x5f3f19[_0xb71a('0x12')]='Plugin';break;case _0xb71a('0x73'):_0x5f3f19['childModel']=_0xb71a('0x74');_0x5f3f19[_0xb71a('0x18')]=[{'name':'Reports','field':'id','foreignKey':_0xb71a('0x75')}];break;case _0xb71a('0x76'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x77');break;}return _0x5f3f19;}function _0x41a1fc(_0x3b6762,_0x3dfd97){var _0x535ab6=_0x3b6762['charAt'](0x0)[_0xb71a('0x78')]()+_0x3b6762[_0xb71a('0x79')](0x1);var _0x2cf6a3={'type':_0x3f0529[_0xb71a('0x7a')][_0xb71a('0x7b')]['SELECT'],'raw':!![]};return new Promise(function(_0x5a45df,_0x6ceada){var _0xc931ab=squel['select']()[_0xb71a('0x4')](_0xb71a('0x7c')+_0x535ab6+'InteractionId','id')[_0xb71a('0x4')](_0xb71a('0x7d'))[_0xb71a('0x7e')](_0xb71a('0x7f')+_0x3b6762+'_interactions','ui')[_0xb71a('0x80')](_0xb71a('0x81'),_0x3dfd97['id']);return _0x3f0529['sequelize'][_0xb71a('0x82')](_0xc931ab[_0xb71a('0x83')](),_0x2cf6a3)[_0xb71a('0x7')](function(_0x2881a3){_0x3dfd97[_0x535ab6+_0xb71a('0x84')]=_0x2881a3;_0x5a45df(_0x2881a3);})[_0xb71a('0x9')](function(_0x288862){_0x6ceada(_0x288862);});});}return _0x3e985a[_0xb71a('0x85')]('UserProfile',attributes,{'tableName':_0xb71a('0x86'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3a5431){var _0x526065={'raw':![],'where':{}};var _0x41fe0c={};var _0x2dbaa2={'count':0x0,'rows':[]};var _0x52fac6=_0x3a5431[_0xb71a('0x82')][_0xb71a('0x87')];var _0x10b715=_0x3a5431[_0xb71a('0x82')][_0xb71a('0x88')]||![];var _0x1c4160=_0x14b2a1(_0x52fac6,_0x10b715);if(!_0x1c4160['childModel'])throw new Error('Invalid\x20section\x20\x27'+_0x52fac6+'\x27');var _0x248c74=[{'name':_0x52fac6}];if(!_[_0xb71a('0x89')](_0x1c4160[_0xb71a('0x18')]))_0x248c74=_0x1c4160['parentSections'];var _0xe93fd=[];for(var _0x5e58f7=0x0;_0x5e58f7<_0x248c74[_0xb71a('0x8a')];_0x5e58f7++){_0xe93fd['push'](_0x3f0529['UserProfileSection'][_0xb71a('0x8b')]({'where':{'userProfileId':_0x3a5431[_0xb71a('0x8c')]['id'],'name':_0x248c74[_0x5e58f7][_0xb71a('0xc')]},'raw':!![]}));}return Promise[_0xb71a('0x8d')](_0xe93fd)[_0xb71a('0x7')](function(_0x4eca80){var _0x2b758b=_['filter'](_0x4eca80,function(_0x1adf18){return _0x1adf18?_0x1adf18:undefined;});var _0x312e46=_[_0xb71a('0x3')](_0x248c74,['ignore',!![]]);var _0x4d9dc8=_[_0xb71a('0x89')](_0x2b758b)&&_[_0xb71a('0x89')](_0x312e46)?null:_[_0xb71a('0x8e')](_0x312e46,_0x2b758b);if(!_0x4d9dc8)return null;var _0x3e2c72=[];for(var _0x9eff28=0x0;_0x9eff28<_0x4d9dc8['length'];_0x9eff28++){var _0x210fa0=_[_0xb71a('0x8b')](_0x248c74,function(_0x1063ab){return _0x4d9dc8[_0x9eff28]?_0x1063ab[_0xb71a('0xc')]===_0x4d9dc8[_0x9eff28][_0xb71a('0xc')]:null;});if(_0x210fa0){if(_0x4d9dc8[_0x9eff28]['ignore']){_0x3e2c72['push'](_0x4094b2(_0x1c4160[_0xb71a('0x12')],_0x4d9dc8[_0x9eff28]));}else{if(!_0x4d9dc8[_0x9eff28][_0xb71a('0x8f')]){_0x3e2c72[_0xb71a('0x90')](_0x1e9363(_0x210fa0,_0x4d9dc8[_0x9eff28],_0x1c4160[_0xb71a('0x12')]));}else{if(_0x210fa0[_0xb71a('0xa')]){_0x3e2c72[_0xb71a('0x90')](_0x3d7bd7(_0x210fa0,_0x4d9dc8[_0x9eff28]));}}}}}return Promise[_0xb71a('0x8d')](_0x3e2c72);})['then'](function(_0x45f4b2){var _0x27c15e=_0x45f4b2;var _0x55d263=null;if(_0x27c15e){_0x55d263=_0x27c15e[_0xb71a('0x8a')]===0x1?_0x27c15e[0x0]:null;}if(!_0x55d263&&!_0x27c15e)return _0x2dbaa2;var _0x20dc19=_0x3f0529[_0x1c4160[_0xb71a('0x12')]]['rawAttributes'];_0x41fe0c[_0xb71a('0xa')]=_[_0xb71a('0x91')](_0x20dc19);_0x41fe0c[_0xb71a('0x82')]=_['keys'](_0x3a5431[_0xb71a('0x82')]);_0x41fe0c[_0xb71a('0x92')]=_[_0xb71a('0x93')](_0x41fe0c[_0xb71a('0xa')],_0x41fe0c[_0xb71a('0x82')]);_0x526065[_0xb71a('0x94')]=_[_0xb71a('0x93')](_0x41fe0c[_0xb71a('0xa')],qs['fields'](_0x3a5431[_0xb71a('0x82')][_0xb71a('0x95')]));_0x526065[_0xb71a('0x94')]=_0x526065[_0xb71a('0x94')][_0xb71a('0x8a')]?_0x526065[_0xb71a('0x94')]:_0x41fe0c[_0xb71a('0xa')];if(!_0x3a5431['query'][_0xb71a('0x96')]('nolimit')){_0x526065[_0xb71a('0x97')]=qs[_0xb71a('0x97')](_0x3a5431['query'][_0xb71a('0x97')]);_0x526065['offset']=qs[_0xb71a('0x98')](_0x3a5431['query'][_0xb71a('0x98')]);}_0x526065[_0xb71a('0x99')]=qs[_0xb71a('0x9a')](_0x3a5431[_0xb71a('0x82')]['sort']);_0x526065[_0xb71a('0x80')]=qs[_0xb71a('0x92')](_['pick'](_0x3a5431[_0xb71a('0x82')],_0x41fe0c['filters']));if(_0x3a5431['query']['filter']){_0x526065['where']=_[_0xb71a('0x9b')](_0x526065[_0xb71a('0x80')],{'$or':_[_0xb71a('0xb')](_0x20dc19,function(_0x5554e8){if(_0x5554e8[_0xb71a('0xe')][_0xb71a('0x9c')]!=='VIRTUAL'){var _0x299349={};_0x299349[_0x5554e8[_0xb71a('0x4')]]={'$like':'%'+_0x3a5431[_0xb71a('0x82')][_0xb71a('0x3')]+'%'};return _0x299349;}})});}var _0x3209d3=[];var _0x16fbc1=null;var _0x537d00={};if(_0x55d263){_0x16fbc1=_[_0xb71a('0x8b')](_0x248c74,[_0xb71a('0xc'),_0x55d263[_0xb71a('0xc')]]);if(_0x16fbc1[_0xb71a('0x4')]){_0x537d00={};if(_0x1c4160[_0xb71a('0x12')]===_0xb71a('0x74')){_0x537d00[_0x16fbc1['foreignKey']]=_[_0xb71a('0xb')](_0x55d263[_0xb71a('0x8')],'id');}else{_0x537d00[_0x16fbc1['foreignKey']]=_0x55d263[_0xb71a('0x8')];}_0x3209d3[_0xb71a('0x90')](_0x537d00);}else{_0x526065[_0xb71a('0x80')]['id']=_0x55d263['associatedResources'];}}else{for(var _0x3ab7f5=0x0;_0x3ab7f5<_0x27c15e[_0xb71a('0x8a')];_0x3ab7f5++){_0x16fbc1=_[_0xb71a('0x8b')](_0x248c74,['name',_0x27c15e[_0x3ab7f5][_0xb71a('0xc')]]);if(_0x16fbc1[_0xb71a('0x4')]){_0x537d00={};_0x537d00[_0x16fbc1['foreignKey']]=_0x27c15e[_0x3ab7f5][_0xb71a('0x8')];_0x3209d3[_0xb71a('0x90')](_0x537d00);}else{if(!_0x526065[_0xb71a('0x80')]['id'])_0x526065[_0xb71a('0x80')]['id']=[];_0x27c15e[_0x3ab7f5]['associatedResources'][_0xb71a('0x9d')](function(_0x20cb10){_0x526065[_0xb71a('0x80')]['id'][_0xb71a('0x90')](_0x20cb10);});}}}if(!_['isEmpty'](_0x3209d3)){_0x526065[_0xb71a('0x80')]=_[_0xb71a('0x9b')](_0x526065['where'],{'$and':{'$or':_0x3209d3}});}_0x526065=_[_0xb71a('0x9b')]({},_0x526065,_0x3a5431[_0xb71a('0x9e')]);if(_0x55d263&&!_0x55d263['autoAssociation']&&_0x1c4160[_0xb71a('0x12')]===_0xb71a('0x74')){if(_0x3a5431[_0xb71a('0x82')]['includeAll']){_0x526065[_0xb71a('0x9f')]=[{'all':!![]}];}return _0x3f0529[_0x1c4160[_0xb71a('0x12')]][_0xb71a('0x6')](_0x526065)[_0xb71a('0x7')](function(_0x397e34){var _0xc552ac=[];_0x397e34[_0xb71a('0x9d')](function(_0x2e087e){var _0x19d364;switch(_0x2e087e['reportType']){case'default':_0x19d364=_[_0xb71a('0x8b')](_0x55d263[_0xb71a('0x8')],function(_0x4158ff){return _0x4158ff['id']===_0x2e087e[_0xb71a('0x75')]&&_0x4158ff[_0xb71a('0xe')]===_0xb71a('0xa0');});break;case'custom':_0x19d364=_[_0xb71a('0x8b')](_0x55d263['associatedResources'],function(_0x123323){return _0x123323['id']===_0x2e087e['reportId']&&_0x123323[_0xb71a('0xe')]===_0xb71a('0xa1');});break;}if(_0x19d364)_0xc552ac['push'](_0x2e087e);});_0x2dbaa2[_0xb71a('0xa2')]=_0xc552ac[_0xb71a('0x8a')];_0x2dbaa2[_0xb71a('0xa3')]=_0xc552ac;return _0x2dbaa2;});}else{return _0x3f0529[_0x1c4160[_0xb71a('0x12')]][_0xb71a('0xa2')]({'where':_0x526065['where']})[_0xb71a('0x7')](function(_0x3807e6){_0x2dbaa2['count']=_0x3807e6;if(_0x3a5431[_0xb71a('0x82')][_0xb71a('0xa4')]){if(_0x1c4160['childModel']===_0xb71a('0x1d')){_0x526065[_0xb71a('0x9f')]=[{'model':_0x3f0529[_0xb71a('0x6a')],'as':'Tags','attributes':['id',_0xb71a('0xc'),_0xb71a('0xa5')],'required':_0x3a5431[_0xb71a('0x82')]['tag']?!![]:![]},{'model':_0x3f0529[_0xb71a('0x6a')],'as':_0xb71a('0xa6'),'attributes':['id',_0xb71a('0xc'),_0xb71a('0xa5')],'through':_0x3a5431[_0xb71a('0x82')]['tag']?{'attributes':[],'where':{'TagId':_0x3a5431[_0xb71a('0x82')]['tag']||undefined}}:{},'required':_0x3a5431[_0xb71a('0x82')][_0xb71a('0xa7')]?!![]:![]}];}else{_0x526065[_0xb71a('0x9f')]=[{'all':!![]}];}}return _0x3f0529[_0x1c4160['childModel']]['findAll'](_0x526065);})[_0xb71a('0x7')](function(_0x13d2e0){_0x2dbaa2[_0xb71a('0xa3')]=_0x13d2e0;if(_0x52fac6===_0xb71a('0x30')&&_0x3a5431[_0xb71a('0x82')][_0xb71a('0xa8')]===_0xb71a('0xa9')){var _0x442ec0=[];for(var _0x24efc1=0x0;_0x24efc1<_0x2dbaa2[_0xb71a('0xa3')][_0xb71a('0x8a')];_0x24efc1++){_0x442ec0[_0xb71a('0x90')](_0x41a1fc(_0xb71a('0xaa'),_0x2dbaa2[_0xb71a('0xa3')][_0x24efc1][_0xb71a('0xab')]));_0x442ec0['push'](_0x41a1fc(_0xb71a('0xac'),_0x2dbaa2[_0xb71a('0xa3')][_0x24efc1][_0xb71a('0xab')]));_0x442ec0['push'](_0x41a1fc('fax',_0x2dbaa2['rows'][_0x24efc1][_0xb71a('0xab')]));_0x442ec0['push'](_0x41a1fc(_0xb71a('0xad'),_0x2dbaa2[_0xb71a('0xa3')][_0x24efc1]['dataValues']));_0x442ec0['push'](_0x41a1fc(_0xb71a('0xae'),_0x2dbaa2[_0xb71a('0xa3')][_0x24efc1][_0xb71a('0xab')]));_0x442ec0[_0xb71a('0x90')](_0x41a1fc(_0xb71a('0xaf'),_0x2dbaa2[_0xb71a('0xa3')][_0x24efc1][_0xb71a('0xab')]));}return Promise[_0xb71a('0x8d')](_0x442ec0)[_0xb71a('0x7')](function(){return _0x2dbaa2;});}return _0x2dbaa2;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 0679204..7bf6c98 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 _0xe062=['client','localhost','socket.io-emitter','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4cb450,_0x30ddd0){var _0x15b1e7=function(_0x475224){while(--_0x475224){_0x4cb450['push'](_0x4cb450['shift']());}};_0x15b1e7(++_0x30ddd0);}(_0xe062,0x1b8));var _0x2e06=function(_0x4cbfc4,_0x29e96d){_0x4cbfc4=_0x4cbfc4-0x0;var _0x3e7889=_0xe062[_0x4cbfc4];return _0x3e7889;};'use strict';var _=require(_0x2e06('0x0'));var util=require(_0x2e06('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2e06('0x2'));var fs=require('fs');var Redis=require(_0x2e06('0x3'));var db=require(_0x2e06('0x4'))['db'];var utils=require(_0x2e06('0x5'));var logger=require(_0x2e06('0x6'))(_0x2e06('0x7'));var config=require(_0x2e06('0x8'));var jayson=require(_0x2e06('0x9'));var client=jayson[_0x2e06('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x2e06('0xb'),'port':0x18eb});var socket=require(_0x2e06('0xc'))(new Redis(config['redis']));require('./userProfile.socket')[_0x2e06('0xd')](socket);function respondWithRpcPromise(_0x28433e,_0x6be39d,_0x29a813){return new BPromise(function(_0x18552c,_0x450369){return client[_0x2e06('0xe')](_0x28433e,_0x29a813)[_0x2e06('0xf')](function(_0x396810){logger[_0x2e06('0x10')](_0x2e06('0x11'),_0x6be39d,_0x2e06('0x12'));logger['debug'](_0x2e06('0x13'),_0x6be39d,_0x2e06('0x12'),JSON['stringify'](_0x396810));if(_0x396810['error']){if(_0x396810[_0x2e06('0x14')][_0x2e06('0x15')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x6be39d,_0x396810[_0x2e06('0x14')]['message']);return _0x450369(_0x396810['error'][_0x2e06('0x16')]);}logger[_0x2e06('0x14')]('UserProfile,\x20%s,\x20%s',_0x6be39d,_0x396810[_0x2e06('0x14')]['message']);return _0x18552c(_0x396810[_0x2e06('0x14')]['message']);}else{logger[_0x2e06('0x10')](_0x2e06('0x11'),_0x6be39d,_0x2e06('0x12'));_0x18552c(_0x396810[_0x2e06('0x17')][_0x2e06('0x16')]);}})[_0x2e06('0x18')](function(_0x3773fa){logger['error'](_0x2e06('0x11'),_0x6be39d,_0x3773fa);_0x450369(_0x3773fa);});});} \ No newline at end of file +var _0xd301=['defaults','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x5ef905,_0x564b87){var _0x367808=function(_0x14f487){while(--_0x14f487){_0x5ef905['push'](_0x5ef905['shift']());}};_0x367808(++_0x564b87);}(_0xd301,0x145));var _0x1d30=function(_0x35e388,_0x18d3f9){_0x35e388=_0x35e388-0x0;var _0x28f976=_0xd301[_0x35e388];return _0x28f976;};'use strict';var _=require(_0x1d30('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1d30('0x1'));var fs=require('fs');var Redis=require(_0x1d30('0x2'));var db=require(_0x1d30('0x3'))['db'];var utils=require(_0x1d30('0x4'));var logger=require(_0x1d30('0x5'))(_0x1d30('0x6'));var config=require(_0x1d30('0x7'));var jayson=require(_0x1d30('0x8'));var client=jayson[_0x1d30('0x9')]['http']({'port':0x232a});config[_0x1d30('0xa')]=_[_0x1d30('0xb')](config[_0x1d30('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x1d30('0xc'))(new Redis(config[_0x1d30('0xa')]));require(_0x1d30('0xd'))[_0x1d30('0xe')](socket);function respondWithRpcPromise(_0x2a526e,_0xbad263,_0x2bcc44){return new BPromise(function(_0x5ced3a,_0x3b65ed){return client[_0x1d30('0xf')](_0x2a526e,_0x2bcc44)[_0x1d30('0x10')](function(_0x521497){logger[_0x1d30('0x11')](_0x1d30('0x12'),_0xbad263,_0x1d30('0x13'));logger[_0x1d30('0x14')](_0x1d30('0x15'),_0xbad263,_0x1d30('0x13'),JSON[_0x1d30('0x16')](_0x521497));if(_0x521497[_0x1d30('0x17')]){if(_0x521497[_0x1d30('0x17')][_0x1d30('0x18')]===0x1f4){logger[_0x1d30('0x17')](_0x1d30('0x12'),_0xbad263,_0x521497[_0x1d30('0x17')][_0x1d30('0x19')]);return _0x3b65ed(_0x521497[_0x1d30('0x17')]['message']);}logger[_0x1d30('0x17')](_0x1d30('0x12'),_0xbad263,_0x521497[_0x1d30('0x17')][_0x1d30('0x19')]);return _0x5ced3a(_0x521497[_0x1d30('0x17')]['message']);}else{logger['info'](_0x1d30('0x12'),_0xbad263,_0x1d30('0x13'));_0x5ced3a(_0x521497[_0x1d30('0x1a')][_0x1d30('0x19')]);}})[_0x1d30('0x1b')](function(_0x458b97){logger[_0x1d30('0x17')](_0x1d30('0x12'),_0xbad263,_0x458b97);_0x3b65ed(_0x458b97);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index b6cddc6..cfa31d0 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 _0x017d=['emit','removeListener','userProfile:','./userProfile.events','save','remove','update'];(function(_0x2a7399,_0x53f430){var _0x4931f3=function(_0x52b6ac){while(--_0x52b6ac){_0x2a7399['push'](_0x2a7399['shift']());}};_0x4931f3(++_0x53f430);}(_0x017d,0x17d));var _0xd017=function(_0xa79df4,_0x1b420e){_0xa79df4=_0xa79df4-0x0;var _0x1c666f=_0x017d[_0xa79df4];return _0x1c666f;};'use strict';var UserProfileEvents=require(_0xd017('0x0'));var events=[_0xd017('0x1'),_0xd017('0x2'),_0xd017('0x3')];function createListener(_0x25c26d,_0x1553ef){return function(_0x40d61c){_0x1553ef[_0xd017('0x4')](_0x25c26d,_0x40d61c);};}function removeListener(_0x267e19,_0x4433b1){return function(){UserProfileEvents[_0xd017('0x5')](_0x267e19,_0x4433b1);};}exports['register']=function(_0x42e738){for(var _0x28f063=0x0,_0x2a1863=events['length'];_0x28f063<_0x2a1863;_0x28f063++){var _0x5dee8d=events[_0x28f063];var _0xccb366=createListener(_0xd017('0x6')+_0x5dee8d,_0x42e738);UserProfileEvents['on'](_0x5dee8d,_0xccb366);}}; \ No newline at end of file +var _0xc6de=['emit','removeListener','register','length','userProfile:','save','update'];(function(_0x554e27,_0x2bbacd){var _0x4e1659=function(_0x2861b6){while(--_0x2861b6){_0x554e27['push'](_0x554e27['shift']());}};_0x4e1659(++_0x2bbacd);}(_0xc6de,0x7c));var _0xec6d=function(_0x585133,_0x2412a1){_0x585133=_0x585133-0x0;var _0x18254a=_0xc6de[_0x585133];return _0x18254a;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xec6d('0x0'),'remove',_0xec6d('0x1')];function createListener(_0x345119,_0x46d50){return function(_0xe95524){_0x46d50[_0xec6d('0x2')](_0x345119,_0xe95524);};}function removeListener(_0xc34227,_0x53342f){return function(){UserProfileEvents[_0xec6d('0x3')](_0xc34227,_0x53342f);};}exports[_0xec6d('0x4')]=function(_0x313ed9){for(var _0xa1acc2=0x0,_0x4e2a5e=events[_0xec6d('0x5')];_0xa1acc2<_0x4e2a5e;_0xa1acc2++){var _0x195ec3=events[_0xa1acc2];var _0x58a404=createListener(_0xec6d('0x6')+_0x195ec3,_0x313ed9);UserProfileEvents['on'](_0x195ec3,_0x58a404);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index f2ab3af..78ecae8 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 _0x2f7f=['util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','delete','destroy','exports','multer'];(function(_0x295188,_0x109ec7){var _0x51d6a4=function(_0x15beeb){while(--_0x15beeb){_0x295188['push'](_0x295188['shift']());}};_0x51d6a4(++_0x109ec7);}(_0x2f7f,0x83));var _0xf2f7=function(_0x77d310,_0x2b2fe7){_0x77d310=_0x77d310-0x0;var _0x2cdce4=_0x2f7f[_0x77d310];return _0x2cdce4;};'use strict';var multer=require(_0xf2f7('0x0'));var util=require(_0xf2f7('0x1'));var path=require(_0xf2f7('0x2'));var timeout=require('connect-timeout');var express=require(_0xf2f7('0x3'));var router=express[_0xf2f7('0x4')]();var fs_extra=require(_0xf2f7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf2f7('0x6'));var config=require(_0xf2f7('0x7'));var controller=require(_0xf2f7('0x8'));router[_0xf2f7('0x9')]('/',auth[_0xf2f7('0xa')](),controller[_0xf2f7('0xb')]);router[_0xf2f7('0x9')](_0xf2f7('0xc'),auth['isAuthenticated'](),controller[_0xf2f7('0xd')]);router[_0xf2f7('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xf2f7('0xe')]);router[_0xf2f7('0xf')]('/',auth['isAuthenticated'](),controller[_0xf2f7('0x10')]);router[_0xf2f7('0x11')](_0xf2f7('0x12'),auth[_0xf2f7('0xa')](),controller['update']);router[_0xf2f7('0x13')](_0xf2f7('0x12'),auth[_0xf2f7('0xa')](),controller[_0xf2f7('0x14')]);module[_0xf2f7('0x15')]=router; \ No newline at end of file +var _0x736f=['/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated'];(function(_0x3b3855,_0x98d6ee){var _0x5e4364=function(_0x11eae7){while(--_0x11eae7){_0x3b3855['push'](_0x3b3855['shift']());}};_0x5e4364(++_0x98d6ee);}(_0x736f,0x185));var _0xf736=function(_0x2e8874,_0x13cd6c){_0x2e8874=_0x2e8874-0x0;var _0x4ca0cb=_0x736f[_0x2e8874];return _0x4ca0cb;};'use strict';var multer=require('multer');var util=require(_0xf736('0x0'));var path=require(_0xf736('0x1'));var timeout=require(_0xf736('0x2'));var express=require(_0xf736('0x3'));var router=express['Router']();var fs_extra=require(_0xf736('0x4'));var auth=require(_0xf736('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf736('0x6'));var controller=require(_0xf736('0x7'));router[_0xf736('0x8')]('/',auth[_0xf736('0x9')](),controller['index']);router[_0xf736('0x8')](_0xf736('0xa'),auth['isAuthenticated'](),controller[_0xf736('0xb')]);router[_0xf736('0x8')](_0xf736('0xc'),auth['isAuthenticated'](),controller[_0xf736('0xd')]);router[_0xf736('0xe')]('/',auth[_0xf736('0x9')](),controller[_0xf736('0xf')]);router[_0xf736('0x10')](_0xf736('0xc'),auth[_0xf736('0x9')](),controller[_0xf736('0x11')]);router[_0xf736('0x12')](_0xf736('0xc'),auth[_0xf736('0x9')](),controller[_0xf736('0x13')]);module[_0xf736('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 3676017..ae589e1 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 _0xf51a=['exports','STRING'];(function(_0x2d4421,_0x15a84f){var _0x2d3b01=function(_0xb9e94c){while(--_0xb9e94c){_0x2d4421['push'](_0x2d4421['shift']());}};_0x2d3b01(++_0x15a84f);}(_0xf51a,0xfa));var _0xaf51=function(_0x4daf35,_0x28480c){_0x4daf35=_0x4daf35-0x0;var _0x54a0a7=_0xf51a[_0x4daf35];return _0x54a0a7;};'use strict';var Sequelize=require('sequelize');module[_0xaf51('0x0')]={'name':{'type':Sequelize[_0xaf51('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xaf51('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x7097=['STRING','sequelize','INTEGER'];(function(_0x52888c,_0x35ea4f){var _0xe07c0e=function(_0x5a7538){while(--_0x5a7538){_0x52888c['push'](_0x52888c['shift']());}};_0xe07c0e(++_0x35ea4f);}(_0x7097,0x14e));var _0x7709=function(_0x4be876,_0xd390b0){_0x4be876=_0x4be876-0x0;var _0x34dda2=_0x7097[_0x4be876];return _0x34dda2;};'use strict';var Sequelize=require(_0x7709('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x7709('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x7709('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index a395572..7e00293 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 _0xe3da=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','order','sort','where','pick','map','VIRTUAL','filter','merge','options','count','include','findAll','rows','catch','show','params','length','includeAll','find','create','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x39f864,_0x26139a){var _0x5db44e=function(_0x3b3ba8){while(--_0x3b3ba8){_0x39f864['push'](_0x39f864['shift']());}};_0x5db44e(++_0x26139a);}(_0xe3da,0x1cd));var _0xae3d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe3da[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xae3d('0x0'));var rimraf=require(_0xae3d('0x1'));var zipdir=require(_0xae3d('0x2'));var jsonpatch=require(_0xae3d('0x3'));var rp=require(_0xae3d('0x4'));var moment=require(_0xae3d('0x5'));var BPromise=require(_0xae3d('0x6'));var Mustache=require(_0xae3d('0x7'));var util=require(_0xae3d('0x8'));var path=require(_0xae3d('0x9'));var sox=require(_0xae3d('0xa'));var csv=require(_0xae3d('0xb'));var ejs=require(_0xae3d('0xc'));var fs=require('fs');var fs_extra=require(_0xae3d('0xd'));var _=require(_0xae3d('0xe'));var squel=require(_0xae3d('0xf'));var crypto=require('crypto');var jsforce=require(_0xae3d('0x10'));var deskjs=require(_0xae3d('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae3d('0x12'));var Redis=require(_0xae3d('0x13'));var authService=require(_0xae3d('0x14'));var qs=require(_0xae3d('0x15'));var as=require(_0xae3d('0x16'));var hardwareService=require(_0xae3d('0x17'));var logger=require('../../config/logger')(_0xae3d('0x18'));var utils=require('../../config/utils');var config=require(_0xae3d('0x19'));var licenseUtil=require(_0xae3d('0x1a'));var db=require(_0xae3d('0x1b'))['db'];function respondWithStatusCode(_0x172f7a,_0x48aa74){_0x48aa74=_0x48aa74||0xcc;return function(_0xfb7869){if(_0xfb7869){return _0x172f7a[_0xae3d('0x1c')](_0x48aa74);}return _0x172f7a[_0xae3d('0x1d')](_0x48aa74)[_0xae3d('0x1e')]();};}function respondWithResult(_0x2afdd3,_0x430659){_0x430659=_0x430659||0xc8;return function(_0x31498d){if(_0x31498d){return _0x2afdd3['status'](_0x430659)[_0xae3d('0x1f')](_0x31498d);}};}function respondWithFilteredResult(_0x42f4b4,_0x46295b){return function(_0x230afb){if(_0x230afb){var _0x192c13=typeof _0x46295b[_0xae3d('0x20')]==='undefined'&&typeof _0x46295b[_0xae3d('0x21')]===_0xae3d('0x22');var _0x2e31f1=_0x230afb['count'];var _0x3f8cf9=_0x192c13?0x0:_0x46295b[_0xae3d('0x20')];var _0x558e42=_0x192c13?_0x230afb['count']:_0x46295b[_0xae3d('0x20')]+_0x46295b[_0xae3d('0x21')];var _0x19c44d;if(_0x558e42>=_0x2e31f1){_0x558e42=_0x2e31f1;_0x19c44d=0xc8;}else{_0x19c44d=0xce;}_0x42f4b4[_0xae3d('0x1d')](_0x19c44d);return _0x42f4b4[_0xae3d('0x23')]('Content-Range',_0x3f8cf9+'-'+_0x558e42+'/'+_0x2e31f1)[_0xae3d('0x1f')](_0x230afb);}return null;};}function patchUpdates(_0x48f00e){return function(_0x4a09c2){try{jsonpatch[_0xae3d('0x24')](_0x4a09c2,_0x48f00e,!![]);}catch(_0x1415e8){return BPromise[_0xae3d('0x25')](_0x1415e8);}return _0x4a09c2[_0xae3d('0x26')]();};}function saveUpdates(_0x3e7afc,_0x26c419){return function(_0x155099){if(_0x155099){return _0x155099[_0xae3d('0x27')](_0x3e7afc)[_0xae3d('0x28')](function(_0x300be8){return _0x300be8;});}return null;};}function removeEntity(_0x9bf34a,_0x37f5ff){return function(_0x1b2acb){if(_0x1b2acb){return _0x1b2acb[_0xae3d('0x29')]()[_0xae3d('0x28')](function(){_0x9bf34a[_0xae3d('0x1d')](0xcc)[_0xae3d('0x1e')]();});}};}function handleEntityNotFound(_0x2131e9,_0x1b1217){return function(_0x5d45db){if(!_0x5d45db){_0x2131e9[_0xae3d('0x1c')](0x194);}return _0x5d45db;};}function handleError(_0x185e71,_0xb5940){_0xb5940=_0xb5940||0x1f4;return function(_0x52df0f){logger[_0xae3d('0x2a')](_0x52df0f[_0xae3d('0x2b')]);if(_0x52df0f[_0xae3d('0x2c')]){delete _0x52df0f['name'];}_0x185e71['status'](_0xb5940)[_0xae3d('0x2d')](_0x52df0f);};}exports[_0xae3d('0x2e')]=function(_0x3a5840,_0x3114f9){var _0xb69ec9={},_0x561371={},_0x1d1483={'count':0x0,'rows':[]};var _0x3a2434=_['map'](db[_0xae3d('0x2f')][_0xae3d('0x30')],function(_0x2cf750){return{'name':_0x2cf750[_0xae3d('0x31')],'type':_0x2cf750[_0xae3d('0x32')][_0xae3d('0x33')]};});_0x561371['model']=_['map'](_0x3a2434,'name');_0x561371[_0xae3d('0x34')]=_[_0xae3d('0x35')](_0x3a5840[_0xae3d('0x34')]);_0x561371[_0xae3d('0x36')]=_['intersection'](_0x561371[_0xae3d('0x37')],_0x561371[_0xae3d('0x34')]);_0xb69ec9[_0xae3d('0x38')]=_[_0xae3d('0x39')](_0x561371[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0x3a5840[_0xae3d('0x34')]['fields']));_0xb69ec9[_0xae3d('0x38')]=_0xb69ec9['attributes']['length']?_0xb69ec9[_0xae3d('0x38')]:_0x561371['model'];if(!_0x3a5840[_0xae3d('0x34')]['hasOwnProperty']('nolimit')){_0xb69ec9[_0xae3d('0x21')]=qs[_0xae3d('0x21')](_0x3a5840[_0xae3d('0x34')]['limit']);_0xb69ec9[_0xae3d('0x20')]=qs['offset'](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x20')]);}_0xb69ec9[_0xae3d('0x3b')]=qs[_0xae3d('0x3c')](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x3c')]);_0xb69ec9[_0xae3d('0x3d')]=qs[_0xae3d('0x36')](_[_0xae3d('0x3e')](_0x3a5840[_0xae3d('0x34')],_0x561371[_0xae3d('0x36')]),_0x3a2434);if(_0x3a5840['query']['filter']){_0xb69ec9[_0xae3d('0x3d')]=_['merge'](_0xb69ec9[_0xae3d('0x3d')],{'$or':_[_0xae3d('0x3f')](_0x3a2434,function(_0x1db3c1){if(_0x1db3c1[_0xae3d('0x32')]!==_0xae3d('0x40')){var _0x35db44={};_0x35db44[_0x1db3c1[_0xae3d('0x2c')]]={'$like':'%'+_0x3a5840[_0xae3d('0x34')][_0xae3d('0x41')]+'%'};return _0x35db44;}})});}_0xb69ec9=_[_0xae3d('0x42')]({},_0xb69ec9,_0x3a5840[_0xae3d('0x43')]);var _0x549db8={'where':_0xb69ec9[_0xae3d('0x3d')]};return db[_0xae3d('0x2f')][_0xae3d('0x44')](_0x549db8)['then'](function(_0x4df102){_0x1d1483[_0xae3d('0x44')]=_0x4df102;if(_0x3a5840[_0xae3d('0x34')]['includeAll']){_0xb69ec9[_0xae3d('0x45')]=[{'all':!![]}];}return db[_0xae3d('0x2f')][_0xae3d('0x46')](_0xb69ec9);})[_0xae3d('0x28')](function(_0x436a04){_0x1d1483[_0xae3d('0x47')]=_0x436a04;return _0x1d1483;})['then'](respondWithFilteredResult(_0x3114f9,_0xb69ec9))[_0xae3d('0x48')](handleError(_0x3114f9,null));};exports[_0xae3d('0x49')]=function(_0xce7f34,_0x938811){var _0x1fef90={'raw':![],'where':{'id':_0xce7f34[_0xae3d('0x4a')]['id']}},_0x515220={};_0x515220['model']=_[_0xae3d('0x35')](db[_0xae3d('0x2f')][_0xae3d('0x30')]);_0x515220[_0xae3d('0x34')]=_['keys'](_0xce7f34['query']);_0x515220['filters']=_[_0xae3d('0x39')](_0x515220[_0xae3d('0x37')],_0x515220['query']);_0x1fef90['attributes']=_['intersection'](_0x515220[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0xce7f34[_0xae3d('0x34')][_0xae3d('0x3a')]));_0x1fef90[_0xae3d('0x38')]=_0x1fef90[_0xae3d('0x38')][_0xae3d('0x4b')]?_0x1fef90['attributes']:_0x515220['model'];if(_0xce7f34['query'][_0xae3d('0x4c')]){_0x1fef90['include']=[{'all':!![]}];}_0x1fef90=_[_0xae3d('0x42')]({},_0x1fef90,_0xce7f34[_0xae3d('0x43')]);return db[_0xae3d('0x2f')][_0xae3d('0x4d')](_0x1fef90)[_0xae3d('0x28')](handleEntityNotFound(_0x938811,null))[_0xae3d('0x28')](respondWithResult(_0x938811,null))[_0xae3d('0x48')](handleError(_0x938811,null));};exports[_0xae3d('0x4e')]=function(_0x38f92d,_0x4ed0f9){return db[_0xae3d('0x2f')]['create'](_0x38f92d['body'],{})['then'](respondWithResult(_0x4ed0f9,0xc9))[_0xae3d('0x48')](handleError(_0x4ed0f9,null));};exports[_0xae3d('0x27')]=function(_0x39f213,_0x6fa6c){if(_0x39f213['body']['id']){delete _0x39f213['body']['id'];}return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x39f213[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x6fa6c,null))['then'](saveUpdates(_0x39f213[_0xae3d('0x4f')],null))[_0xae3d('0x28')](respondWithResult(_0x6fa6c,null))[_0xae3d('0x48')](handleError(_0x6fa6c,null));};exports[_0xae3d('0x29')]=function(_0x2a6a24,_0x38ccf1){return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x2a6a24[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x38ccf1,null))[_0xae3d('0x28')](removeEntity(_0x38ccf1,null))[_0xae3d('0x48')](handleError(_0x38ccf1,null));};exports['describe']=function(_0x4f4694,_0x4c6dab){return db[_0xae3d('0x2f')][_0xae3d('0x50')]()['then'](respondWithResult(_0x4c6dab,null))[_0xae3d('0x48')](handleError(_0x4c6dab,null));}; \ No newline at end of file +var _0x687b=['options','include','findAll','rows','show','length','includeAll','merge','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x687b,0x14a));var _0xb687=function(_0x2db025,_0x1cf6de){_0x2db025=_0x2db025-0x0;var _0x47afbe=_0x687b[_0x2db025];return _0x47afbe;};'use strict';var emlformat=require(_0xb687('0x0'));var rimraf=require(_0xb687('0x1'));var zipdir=require(_0xb687('0x2'));var jsonpatch=require(_0xb687('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb687('0x4'));var Mustache=require(_0xb687('0x5'));var util=require(_0xb687('0x6'));var path=require(_0xb687('0x7'));var sox=require(_0xb687('0x8'));var csv=require(_0xb687('0x9'));var ejs=require(_0xb687('0xa'));var fs=require('fs');var fs_extra=require(_0xb687('0xb'));var _=require(_0xb687('0xc'));var squel=require(_0xb687('0xd'));var crypto=require('crypto');var jsforce=require(_0xb687('0xe'));var deskjs=require(_0xb687('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb687('0x10'));var Papa=require(_0xb687('0x11'));var Redis=require(_0xb687('0x12'));var authService=require(_0xb687('0x13'));var qs=require(_0xb687('0x14'));var as=require(_0xb687('0x15'));var hardwareService=require(_0xb687('0x16'));var logger=require(_0xb687('0x17'))(_0xb687('0x18'));var utils=require('../../config/utils');var config=require(_0xb687('0x19'));var licenseUtil=require(_0xb687('0x1a'));var db=require(_0xb687('0x1b'))['db'];function respondWithStatusCode(_0x12a0be,_0x4f9c19){_0x4f9c19=_0x4f9c19||0xcc;return function(_0x4c97ed){if(_0x4c97ed){return _0x12a0be[_0xb687('0x1c')](_0x4f9c19);}return _0x12a0be[_0xb687('0x1d')](_0x4f9c19)['end']();};}function respondWithResult(_0x108fd0,_0x2f1ac0){_0x2f1ac0=_0x2f1ac0||0xc8;return function(_0x1f1f35){if(_0x1f1f35){return _0x108fd0[_0xb687('0x1d')](_0x2f1ac0)[_0xb687('0x1e')](_0x1f1f35);}};}function respondWithFilteredResult(_0x3ab914,_0x30622f){return function(_0x141375){if(_0x141375){var _0x263085=typeof _0x30622f[_0xb687('0x1f')]===_0xb687('0x20')&&typeof _0x30622f[_0xb687('0x21')]==='undefined';var _0x214b06=_0x141375[_0xb687('0x22')];var _0x30d370=_0x263085?0x0:_0x30622f['offset'];var _0x48958d=_0x263085?_0x141375[_0xb687('0x22')]:_0x30622f[_0xb687('0x1f')]+_0x30622f[_0xb687('0x21')];var _0x4b593b;if(_0x48958d>=_0x214b06){_0x48958d=_0x214b06;_0x4b593b=0xc8;}else{_0x4b593b=0xce;}_0x3ab914[_0xb687('0x1d')](_0x4b593b);return _0x3ab914['set'](_0xb687('0x23'),_0x30d370+'-'+_0x48958d+'/'+_0x214b06)[_0xb687('0x1e')](_0x141375);}return null;};}function patchUpdates(_0x170dc0){return function(_0x44bd0b){try{jsonpatch['apply'](_0x44bd0b,_0x170dc0,!![]);}catch(_0x3a73d5){return BPromise['reject'](_0x3a73d5);}return _0x44bd0b[_0xb687('0x24')]();};}function saveUpdates(_0x90e892,_0x274241){return function(_0x546fde){if(_0x546fde){return _0x546fde[_0xb687('0x25')](_0x90e892)[_0xb687('0x26')](function(_0xa95e91){return _0xa95e91;});}return null;};}function removeEntity(_0x16cdcb,_0xbf6c58){return function(_0x38866c){if(_0x38866c){return _0x38866c[_0xb687('0x27')]()[_0xb687('0x26')](function(){_0x16cdcb['status'](0xcc)[_0xb687('0x28')]();});}};}function handleEntityNotFound(_0x129347,_0x1c1585){return function(_0x1a0261){if(!_0x1a0261){_0x129347[_0xb687('0x1c')](0x194);}return _0x1a0261;};}function handleError(_0x4136c9,_0x17ff2b){_0x17ff2b=_0x17ff2b||0x1f4;return function(_0x3cb2f2){logger[_0xb687('0x29')](_0x3cb2f2[_0xb687('0x2a')]);if(_0x3cb2f2['name']){delete _0x3cb2f2[_0xb687('0x2b')];}_0x4136c9[_0xb687('0x1d')](_0x17ff2b)[_0xb687('0x2c')](_0x3cb2f2);};}exports[_0xb687('0x2d')]=function(_0x2e5c8d,_0x173c58){var _0x4e9a06={},_0x28b69a={},_0x5143af={'count':0x0,'rows':[]};var _0x360429=_[_0xb687('0x2e')](db[_0xb687('0x2f')][_0xb687('0x30')],function(_0x1ad3ef){return{'name':_0x1ad3ef[_0xb687('0x31')],'type':_0x1ad3ef[_0xb687('0x32')]['key']};});_0x28b69a[_0xb687('0x33')]=_[_0xb687('0x2e')](_0x360429,_0xb687('0x2b'));_0x28b69a[_0xb687('0x34')]=_[_0xb687('0x35')](_0x2e5c8d[_0xb687('0x34')]);_0x28b69a[_0xb687('0x36')]=_[_0xb687('0x37')](_0x28b69a[_0xb687('0x33')],_0x28b69a[_0xb687('0x34')]);_0x4e9a06[_0xb687('0x38')]=_['intersection'](_0x28b69a['model'],qs[_0xb687('0x39')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x39')]));_0x4e9a06[_0xb687('0x38')]=_0x4e9a06['attributes']['length']?_0x4e9a06[_0xb687('0x38')]:_0x28b69a[_0xb687('0x33')];if(!_0x2e5c8d['query'][_0xb687('0x3a')](_0xb687('0x3b'))){_0x4e9a06['limit']=qs[_0xb687('0x21')](_0x2e5c8d['query'][_0xb687('0x21')]);_0x4e9a06[_0xb687('0x1f')]=qs[_0xb687('0x1f')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x1f')]);}_0x4e9a06[_0xb687('0x3c')]=qs['sort'](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3d')]);_0x4e9a06[_0xb687('0x3e')]=qs[_0xb687('0x36')](_['pick'](_0x2e5c8d[_0xb687('0x34')],_0x28b69a[_0xb687('0x36')]),_0x360429);if(_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3f')]){_0x4e9a06[_0xb687('0x3e')]=_['merge'](_0x4e9a06[_0xb687('0x3e')],{'$or':_[_0xb687('0x2e')](_0x360429,function(_0x24c013){if(_0x24c013[_0xb687('0x32')]!==_0xb687('0x40')){var _0x29cf09={};_0x29cf09[_0x24c013['name']]={'$like':'%'+_0x2e5c8d['query'][_0xb687('0x3f')]+'%'};return _0x29cf09;}})});}_0x4e9a06=_['merge']({},_0x4e9a06,_0x2e5c8d[_0xb687('0x41')]);var _0x2f4550={'where':_0x4e9a06['where']};return db[_0xb687('0x2f')][_0xb687('0x22')](_0x2f4550)['then'](function(_0x394b56){_0x5143af[_0xb687('0x22')]=_0x394b56;if(_0x2e5c8d[_0xb687('0x34')]['includeAll']){_0x4e9a06[_0xb687('0x42')]=[{'all':!![]}];}return db[_0xb687('0x2f')][_0xb687('0x43')](_0x4e9a06);})[_0xb687('0x26')](function(_0x140388){_0x5143af[_0xb687('0x44')]=_0x140388;return _0x5143af;})[_0xb687('0x26')](respondWithFilteredResult(_0x173c58,_0x4e9a06))['catch'](handleError(_0x173c58,null));};exports[_0xb687('0x45')]=function(_0x4cf6ad,_0x50fdb7){var _0xa3a9e0={'raw':![],'where':{'id':_0x4cf6ad['params']['id']}},_0x430364={};_0x430364[_0xb687('0x33')]=_['keys'](db[_0xb687('0x2f')][_0xb687('0x30')]);_0x430364['query']=_[_0xb687('0x35')](_0x4cf6ad[_0xb687('0x34')]);_0x430364['filters']=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],_0x430364[_0xb687('0x34')]);_0xa3a9e0[_0xb687('0x38')]=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],qs[_0xb687('0x39')](_0x4cf6ad[_0xb687('0x34')][_0xb687('0x39')]));_0xa3a9e0[_0xb687('0x38')]=_0xa3a9e0[_0xb687('0x38')][_0xb687('0x46')]?_0xa3a9e0['attributes']:_0x430364[_0xb687('0x33')];if(_0x4cf6ad['query'][_0xb687('0x47')]){_0xa3a9e0[_0xb687('0x42')]=[{'all':!![]}];}_0xa3a9e0=_[_0xb687('0x48')]({},_0xa3a9e0,_0x4cf6ad[_0xb687('0x41')]);return db[_0xb687('0x2f')][_0xb687('0x49')](_0xa3a9e0)['then'](handleEntityNotFound(_0x50fdb7,null))['then'](respondWithResult(_0x50fdb7,null))[_0xb687('0x4a')](handleError(_0x50fdb7,null));};exports[_0xb687('0x4b')]=function(_0x40558a,_0x4f3069){return db['UserProfileResource'][_0xb687('0x4b')](_0x40558a[_0xb687('0x4c')],{})[_0xb687('0x26')](respondWithResult(_0x4f3069,0xc9))[_0xb687('0x4a')](handleError(_0x4f3069,null));};exports['update']=function(_0x33a0b0,_0xfc4c5f){if(_0x33a0b0[_0xb687('0x4c')]['id']){delete _0x33a0b0[_0xb687('0x4c')]['id'];}return db['UserProfileResource']['find']({'where':{'id':_0x33a0b0[_0xb687('0x4d')]['id']}})[_0xb687('0x26')](handleEntityNotFound(_0xfc4c5f,null))[_0xb687('0x26')](saveUpdates(_0x33a0b0['body'],null))['then'](respondWithResult(_0xfc4c5f,null))[_0xb687('0x4a')](handleError(_0xfc4c5f,null));};exports[_0xb687('0x27')]=function(_0xd5bdb7,_0x22e618){return db[_0xb687('0x2f')][_0xb687('0x49')]({'where':{'id':_0xd5bdb7[_0xb687('0x4d')]['id']}})[_0xb687('0x26')](handleEntityNotFound(_0x22e618,null))['then'](removeEntity(_0x22e618,null))[_0xb687('0x4a')](handleError(_0x22e618,null));};exports[_0xb687('0x4e')]=function(_0x2342f6,_0x4f5784){return db['UserProfileResource']['describe']()['then'](respondWithResult(_0x4f5784,null))[_0xb687('0x4a')](handleError(_0x4f5784,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 2ff7b2d..5f8c3dd 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 _0x2c48=['exports','define','UserProfileResource','compositeIndex','resourceId','sectionId','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes'];(function(_0xdedef0,_0x16668c){var _0x248498=function(_0x37e96f){while(--_0x37e96f){_0xdedef0['push'](_0xdedef0['shift']());}};_0x248498(++_0x16668c);}(_0x2c48,0x1b8));var _0x82c4=function(_0x473738,_0x15ea31){_0x473738=_0x473738-0x0;var _0x1df4ae=_0x2c48[_0x473738];return _0x1df4ae;};'use strict';var _=require('lodash');var util=require(_0x82c4('0x0'));var logger=require('../../config/logger')(_0x82c4('0x1'));var moment=require('moment');var BPromise=require(_0x82c4('0x2'));var rp=require(_0x82c4('0x3'));var fs=require('fs');var path=require(_0x82c4('0x4'));var rimraf=require(_0x82c4('0x5'));var config=require(_0x82c4('0x6'));var attributes=require(_0x82c4('0x7'));module[_0x82c4('0x8')]=function(_0x5919eb,_0x53f15c){return _0x5919eb[_0x82c4('0x9')](_0x82c4('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x82c4('0xb'),'fields':[_0x82c4('0xc'),_0x82c4('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4550=['moment','bluebird','rimraf','./userProfileResource.attributes','exports','define','user_profile_has_resources','resourceId','util','../../config/logger'];(function(_0x103f25,_0x3d98ee){var _0x21dd37=function(_0x9051c1){while(--_0x9051c1){_0x103f25['push'](_0x103f25['shift']());}};_0x21dd37(++_0x3d98ee);}(_0x4550,0x166));var _0x0455=function(_0x30e375,_0x7c2f9){_0x30e375=_0x30e375-0x0;var _0x11fc93=_0x4550[_0x30e375];return _0x11fc93;};'use strict';var _=require('lodash');var util=require(_0x0455('0x0'));var logger=require(_0x0455('0x1'))('api');var moment=require(_0x0455('0x2'));var BPromise=require(_0x0455('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0455('0x4'));var config=require('../../config/environment');var attributes=require(_0x0455('0x5'));module[_0x0455('0x6')]=function(_0x1dec18,_0xfa7ac2){return _0x1dec18[_0x0455('0x7')]('UserProfileResource',attributes,{'tableName':_0x0455('0x8'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x0455('0x9'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index d2bf0a7..6a14d65 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 _0x58c6=['debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent'];(function(_0x59e73c,_0x599dc9){var _0xce736e=function(_0x59967f){while(--_0x59967f){_0x59e73c['push'](_0x59e73c['shift']());}};_0xce736e(++_0x599dc9);}(_0x58c6,0x75));var _0x658c=function(_0x3f0577,_0x13d404){_0x3f0577=_0x3f0577-0x0;var _0x3c70dc=_0x58c6[_0x3f0577];return _0x3c70dc;};'use strict';var _=require(_0x658c('0x0'));var util=require(_0x658c('0x1'));var moment=require('moment');var BPromise=require(_0x658c('0x2'));var rs=require(_0x658c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x658c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x658c('0x5'))(_0x658c('0x6'));var config=require(_0x658c('0x7'));var jayson=require(_0x658c('0x8'));var client=jayson[_0x658c('0x9')][_0x658c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29c174,_0x563463,_0x49e376){return new BPromise(function(_0x5a1062,_0x54bca1){return client[_0x658c('0xb')](_0x29c174,_0x49e376)[_0x658c('0xc')](function(_0x3e1ee7){logger['info'](_0x658c('0xd'),_0x563463,_0x658c('0xe'));logger[_0x658c('0xf')](_0x658c('0x10'),_0x563463,'request\x20sent',JSON['stringify'](_0x3e1ee7));if(_0x3e1ee7[_0x658c('0x11')]){if(_0x3e1ee7[_0x658c('0x11')][_0x658c('0x12')]===0x1f4){logger['error'](_0x658c('0xd'),_0x563463,_0x3e1ee7[_0x658c('0x11')]['message']);return _0x54bca1(_0x3e1ee7[_0x658c('0x11')][_0x658c('0x13')]);}logger[_0x658c('0x11')](_0x658c('0xd'),_0x563463,_0x3e1ee7[_0x658c('0x11')]['message']);return _0x5a1062(_0x3e1ee7[_0x658c('0x11')][_0x658c('0x13')]);}else{logger[_0x658c('0x14')]('UserProfileResource,\x20%s,\x20%s',_0x563463,_0x658c('0xe'));_0x5a1062(_0x3e1ee7[_0x658c('0x15')]['message']);}})['catch'](function(_0xafb239){logger[_0x658c('0x11')](_0x658c('0xd'),_0x563463,_0xafb239);_0x54bca1(_0xafb239);});});} \ No newline at end of file +var _0x1945=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','UserProfileResource,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','lodash'];(function(_0x4139ec,_0x3274b1){var _0x33a0ee=function(_0x3321d8){while(--_0x3321d8){_0x4139ec['push'](_0x4139ec['shift']());}};_0x33a0ee(++_0x3274b1);}(_0x1945,0xfc));var _0x5194=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x1945[_0x433a86];return _0x23000c;};'use strict';var _=require(_0x5194('0x0'));var util=require(_0x5194('0x1'));var moment=require(_0x5194('0x2'));var BPromise=require(_0x5194('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5194('0x4'));var db=require(_0x5194('0x5'))['db'];var utils=require(_0x5194('0x6'));var logger=require(_0x5194('0x7'))(_0x5194('0x8'));var config=require(_0x5194('0x9'));var jayson=require(_0x5194('0xa'));var client=jayson[_0x5194('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13f0c0,_0x4a6fd5,_0x26ecaf){return new BPromise(function(_0x550c61,_0x27cd91){return client[_0x5194('0xc')](_0x13f0c0,_0x26ecaf)[_0x5194('0xd')](function(_0x272a74){logger['info'](_0x5194('0xe'),_0x4a6fd5,'request\x20sent');logger[_0x5194('0xf')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x4a6fd5,_0x5194('0x10'),JSON[_0x5194('0x11')](_0x272a74));if(_0x272a74[_0x5194('0x12')]){if(_0x272a74[_0x5194('0x12')]['code']===0x1f4){logger[_0x5194('0x12')](_0x5194('0xe'),_0x4a6fd5,_0x272a74['error'][_0x5194('0x13')]);return _0x27cd91(_0x272a74[_0x5194('0x12')][_0x5194('0x13')]);}logger[_0x5194('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x4a6fd5,_0x272a74['error']['message']);return _0x550c61(_0x272a74[_0x5194('0x12')][_0x5194('0x13')]);}else{logger[_0x5194('0x14')]('UserProfileResource,\x20%s,\x20%s',_0x4a6fd5,_0x5194('0x10'));_0x550c61(_0x272a74[_0x5194('0x15')][_0x5194('0x13')]);}})[_0x5194('0x16')](function(_0x44b0d2){logger[_0x5194('0x12')](_0x5194('0xe'),_0x4a6fd5,_0x44b0d2);_0x27cd91(_0x44b0d2);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index b62b349..49828c2 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 _0x194a=['/describe','describe','show','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated'];(function(_0x366772,_0x388c35){var _0x408105=function(_0x393873){while(--_0x393873){_0x366772['push'](_0x366772['shift']());}};_0x408105(++_0x388c35);}(_0x194a,0x135));var _0xa194=function(_0x4ab3fb,_0x776775){_0x4ab3fb=_0x4ab3fb-0x0;var _0x34fe1e=_0x194a[_0x4ab3fb];return _0x34fe1e;};'use strict';var multer=require('multer');var util=require(_0xa194('0x0'));var path=require(_0xa194('0x1'));var timeout=require(_0xa194('0x2'));var express=require(_0xa194('0x3'));var router=express[_0xa194('0x4')]();var fs_extra=require(_0xa194('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa194('0x6'));var config=require(_0xa194('0x7'));var controller=require(_0xa194('0x8'));router[_0xa194('0x9')]('/',auth[_0xa194('0xa')](),controller['index']);router[_0xa194('0x9')](_0xa194('0xb'),auth[_0xa194('0xa')](),controller[_0xa194('0xc')]);router[_0xa194('0x9')]('/:id',auth[_0xa194('0xa')](),controller[_0xa194('0xd')]);router['post']('/',auth[_0xa194('0xa')](),controller['create']);router[_0xa194('0xe')](_0xa194('0xf'),auth[_0xa194('0xa')](),controller[_0xa194('0x10')]);router[_0xa194('0x11')](_0xa194('0xf'),auth['isAuthenticated'](),controller[_0xa194('0x12')]);module[_0xa194('0x13')]=router; \ No newline at end of file +var _0x4cc0=['delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated','index','/describe','get','/:id','show','create','put'];(function(_0x345189,_0x281dd1){var _0x26231c=function(_0x15e644){while(--_0x15e644){_0x345189['push'](_0x345189['shift']());}};_0x26231c(++_0x281dd1);}(_0x4cc0,0x156));var _0x04cc=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x4cc0[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require(_0x04cc('0x0'));var path=require(_0x04cc('0x1'));var timeout=require(_0x04cc('0x2'));var express=require(_0x04cc('0x3'));var router=express[_0x04cc('0x4')]();var fs_extra=require(_0x04cc('0x5'));var auth=require(_0x04cc('0x6'));var interaction=require(_0x04cc('0x7'));var config=require(_0x04cc('0x8'));var controller=require(_0x04cc('0x9'));router['get']('/',auth[_0x04cc('0xa')](),controller[_0x04cc('0xb')]);router['get'](_0x04cc('0xc'),auth[_0x04cc('0xa')](),controller['describe']);router[_0x04cc('0xd')](_0x04cc('0xe'),auth[_0x04cc('0xa')](),controller[_0x04cc('0xf')]);router['post']('/',auth[_0x04cc('0xa')](),controller[_0x04cc('0x10')]);router[_0x04cc('0x11')](_0x04cc('0xe'),auth[_0x04cc('0xa')](),controller['update']);router[_0x04cc('0x12')](_0x04cc('0xe'),auth['isAuthenticated'](),controller[_0x04cc('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index ade0cea..9855b3d 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 _0x351d=['sequelize','STRING','INTEGER','BOOLEAN','setDataValue','join','getDataValue','crudPermissions','split'];(function(_0x391620,_0x5ae5a){var _0x3e3f9b=function(_0x56d4b4){while(--_0x56d4b4){_0x391620['push'](_0x391620['shift']());}};_0x3e3f9b(++_0x5ae5a);}(_0x351d,0x90));var _0xd351=function(_0x3712a2,_0x57e2b8){_0x3712a2=_0x3712a2-0x0;var _0x2418e8=_0x351d[_0x3712a2];return _0x2418e8;};'use strict';var Sequelize=require(_0xd351('0x0'));module['exports']={'name':{'type':Sequelize[_0xd351('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xd351('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xd351('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xd351('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x41d16d){this[_0xd351('0x4')]('crudPermissions',_0x41d16d?_0x41d16d[_0xd351('0x5')](''):[]);},'get':function(){return this[_0xd351('0x6')](_0xd351('0x7'))?this['getDataValue'](_0xd351('0x7'))[_0xd351('0x8')](''):[];}}}; \ No newline at end of file +var _0x351d=['sequelize','STRING','INTEGER','BOOLEAN','setDataValue','join','getDataValue','crudPermissions','split'];(function(_0x3dc8b9,_0xe3d669){var _0x27918f=function(_0x4fa863){while(--_0x4fa863){_0x3dc8b9['push'](_0x3dc8b9['shift']());}};_0x27918f(++_0xe3d669);}(_0x351d,0x90));var _0xd351=function(_0x3433b5,_0x2bce89){_0x3433b5=_0x3433b5-0x0;var _0x37ad5f=_0x351d[_0x3433b5];return _0x37ad5f;};'use strict';var Sequelize=require(_0xd351('0x0'));module['exports']={'name':{'type':Sequelize[_0xd351('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xd351('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xd351('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xd351('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x41d16d){this[_0xd351('0x4')]('crudPermissions',_0x41d16d?_0x41d16d[_0xd351('0x5')](''):[]);},'get':function(){return this[_0xd351('0x6')](_0xd351('0x7'))?this['getDataValue'](_0xd351('0x7'))[_0xd351('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 464279c..18dfaf5 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 _0xe4d0=['create','update','body','find','params','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/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','UserProfileSection','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','include','catch'];(function(_0x4e79a1,_0x2f0595){var _0x41c3e2=function(_0x40e2f9){while(--_0x40e2f9){_0x4e79a1['push'](_0x4e79a1['shift']());}};_0x41c3e2(++_0x2f0595);}(_0xe4d0,0x145));var _0x0e4d=function(_0x2a6754,_0x277259){_0x2a6754=_0x2a6754-0x0;var _0x17feda=_0xe4d0[_0x2a6754];return _0x17feda;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0e4d('0x0'));var zipdir=require(_0x0e4d('0x1'));var jsonpatch=require(_0x0e4d('0x2'));var rp=require(_0x0e4d('0x3'));var moment=require(_0x0e4d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0e4d('0x5'));var util=require(_0x0e4d('0x6'));var path=require(_0x0e4d('0x7'));var sox=require(_0x0e4d('0x8'));var csv=require(_0x0e4d('0x9'));var ejs=require(_0x0e4d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e4d('0xb'));var squel=require(_0x0e4d('0xc'));var crypto=require(_0x0e4d('0xd'));var jsforce=require(_0x0e4d('0xe'));var deskjs=require(_0x0e4d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0e4d('0x10'));var Papa=require('papaparse');var Redis=require(_0x0e4d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0e4d('0x12'));var as=require(_0x0e4d('0x13'));var hardwareService=require(_0x0e4d('0x14'));var logger=require(_0x0e4d('0x15'))(_0x0e4d('0x16'));var utils=require(_0x0e4d('0x17'));var config=require(_0x0e4d('0x18'));var licenseUtil=require(_0x0e4d('0x19'));var db=require(_0x0e4d('0x1a'))['db'];function respondWithStatusCode(_0x106369,_0x92ce0d){_0x92ce0d=_0x92ce0d||0xcc;return function(_0x2c0071){if(_0x2c0071){return _0x106369[_0x0e4d('0x1b')](_0x92ce0d);}return _0x106369['status'](_0x92ce0d)[_0x0e4d('0x1c')]();};}function respondWithResult(_0x1b879d,_0x22ef99){_0x22ef99=_0x22ef99||0xc8;return function(_0x599f0d){if(_0x599f0d){return _0x1b879d[_0x0e4d('0x1d')](_0x22ef99)[_0x0e4d('0x1e')](_0x599f0d);}};}function respondWithFilteredResult(_0x4ff0e0,_0x2051a8){return function(_0x321c81){if(_0x321c81){var _0x5dccb0=typeof _0x2051a8[_0x0e4d('0x1f')]==='undefined'&&typeof _0x2051a8['limit']===_0x0e4d('0x20');var _0x4fa38b=_0x321c81[_0x0e4d('0x21')];var _0x519547=_0x5dccb0?0x0:_0x2051a8[_0x0e4d('0x1f')];var _0x5e94c2=_0x5dccb0?_0x321c81[_0x0e4d('0x21')]:_0x2051a8['offset']+_0x2051a8[_0x0e4d('0x22')];var _0x2f0901;if(_0x5e94c2>=_0x4fa38b){_0x5e94c2=_0x4fa38b;_0x2f0901=0xc8;}else{_0x2f0901=0xce;}_0x4ff0e0[_0x0e4d('0x1d')](_0x2f0901);return _0x4ff0e0[_0x0e4d('0x23')](_0x0e4d('0x24'),_0x519547+'-'+_0x5e94c2+'/'+_0x4fa38b)['json'](_0x321c81);}return null;};}function patchUpdates(_0xe6903e){return function(_0x3b383a){try{jsonpatch[_0x0e4d('0x25')](_0x3b383a,_0xe6903e,!![]);}catch(_0x23760e){return BPromise[_0x0e4d('0x26')](_0x23760e);}return _0x3b383a[_0x0e4d('0x27')]();};}function saveUpdates(_0x5ea62c,_0x1c41d2){return function(_0x2418a5){if(_0x2418a5){return _0x2418a5['update'](_0x5ea62c)[_0x0e4d('0x28')](function(_0x204e9d){return _0x204e9d;});}return null;};}function removeEntity(_0x2e8bb9,_0x1c70cf){return function(_0x287c94){if(_0x287c94){return _0x287c94[_0x0e4d('0x29')]()[_0x0e4d('0x28')](function(){_0x2e8bb9[_0x0e4d('0x1d')](0xcc)[_0x0e4d('0x1c')]();});}};}function handleEntityNotFound(_0x2155b3,_0xae62af){return function(_0x50f625){if(!_0x50f625){_0x2155b3[_0x0e4d('0x1b')](0x194);}return _0x50f625;};}function handleError(_0xee3955,_0x21b942){_0x21b942=_0x21b942||0x1f4;return function(_0x282b9d){logger[_0x0e4d('0x2a')](_0x282b9d[_0x0e4d('0x2b')]);if(_0x282b9d['name']){delete _0x282b9d[_0x0e4d('0x2c')];}_0xee3955[_0x0e4d('0x1d')](_0x21b942)['send'](_0x282b9d);};}exports[_0x0e4d('0x2d')]=function(_0x495602,_0x521f7e){var _0x4dcb49={},_0x38f2f1={},_0x3eb3ec={'count':0x0,'rows':[]};var _0x5f4ea2=_['map'](db[_0x0e4d('0x2e')][_0x0e4d('0x2f')],function(_0x5b1d4f){return{'name':_0x5b1d4f[_0x0e4d('0x30')],'type':_0x5b1d4f[_0x0e4d('0x31')][_0x0e4d('0x32')]};});_0x38f2f1['model']=_[_0x0e4d('0x33')](_0x5f4ea2,_0x0e4d('0x2c'));_0x38f2f1[_0x0e4d('0x34')]=_[_0x0e4d('0x35')](_0x495602[_0x0e4d('0x34')]);_0x38f2f1[_0x0e4d('0x36')]=_['intersection'](_0x38f2f1[_0x0e4d('0x37')],_0x38f2f1[_0x0e4d('0x34')]);_0x4dcb49[_0x0e4d('0x38')]=_[_0x0e4d('0x39')](_0x38f2f1['model'],qs[_0x0e4d('0x3a')](_0x495602[_0x0e4d('0x34')][_0x0e4d('0x3a')]));_0x4dcb49[_0x0e4d('0x38')]=_0x4dcb49[_0x0e4d('0x38')][_0x0e4d('0x3b')]?_0x4dcb49[_0x0e4d('0x38')]:_0x38f2f1[_0x0e4d('0x37')];if(!_0x495602['query'][_0x0e4d('0x3c')](_0x0e4d('0x3d'))){_0x4dcb49['limit']=qs['limit'](_0x495602['query'][_0x0e4d('0x22')]);_0x4dcb49[_0x0e4d('0x1f')]=qs['offset'](_0x495602[_0x0e4d('0x34')][_0x0e4d('0x1f')]);}_0x4dcb49[_0x0e4d('0x3e')]=qs[_0x0e4d('0x3f')](_0x495602[_0x0e4d('0x34')]['sort']);_0x4dcb49[_0x0e4d('0x40')]=qs[_0x0e4d('0x36')](_[_0x0e4d('0x41')](_0x495602[_0x0e4d('0x34')],_0x38f2f1[_0x0e4d('0x36')]),_0x5f4ea2);if(_0x495602['query']['filter']){_0x4dcb49[_0x0e4d('0x40')]=_['merge'](_0x4dcb49[_0x0e4d('0x40')],{'$or':_[_0x0e4d('0x33')](_0x5f4ea2,function(_0x177d81){if(_0x177d81[_0x0e4d('0x31')]!==_0x0e4d('0x42')){var _0x20679e={};_0x20679e[_0x177d81[_0x0e4d('0x2c')]]={'$like':'%'+_0x495602[_0x0e4d('0x34')][_0x0e4d('0x43')]+'%'};return _0x20679e;}})});}_0x4dcb49=_[_0x0e4d('0x44')]({},_0x4dcb49,_0x495602[_0x0e4d('0x45')]);var _0x5e8912={'where':_0x4dcb49[_0x0e4d('0x40')]};return db[_0x0e4d('0x2e')][_0x0e4d('0x21')](_0x5e8912)['then'](function(_0x65684c){_0x3eb3ec[_0x0e4d('0x21')]=_0x65684c;if(_0x495602[_0x0e4d('0x34')][_0x0e4d('0x46')]){_0x4dcb49['include']=[{'all':!![]}];}return db['UserProfileSection'][_0x0e4d('0x47')](_0x4dcb49);})[_0x0e4d('0x28')](function(_0x178674){_0x3eb3ec[_0x0e4d('0x48')]=_0x178674;return _0x3eb3ec;})[_0x0e4d('0x28')](respondWithFilteredResult(_0x521f7e,_0x4dcb49))['catch'](handleError(_0x521f7e,null));};exports['show']=function(_0x595e6a,_0x15d156){var _0xa0f053={'raw':![],'where':{'id':_0x595e6a['params']['id']}},_0x198715={};_0x198715['model']=_[_0x0e4d('0x35')](db[_0x0e4d('0x2e')][_0x0e4d('0x2f')]);_0x198715[_0x0e4d('0x34')]=_[_0x0e4d('0x35')](_0x595e6a[_0x0e4d('0x34')]);_0x198715['filters']=_[_0x0e4d('0x39')](_0x198715['model'],_0x198715[_0x0e4d('0x34')]);_0xa0f053[_0x0e4d('0x38')]=_['intersection'](_0x198715['model'],qs[_0x0e4d('0x3a')](_0x595e6a[_0x0e4d('0x34')][_0x0e4d('0x3a')]));_0xa0f053[_0x0e4d('0x38')]=_0xa0f053[_0x0e4d('0x38')][_0x0e4d('0x3b')]?_0xa0f053[_0x0e4d('0x38')]:_0x198715[_0x0e4d('0x37')];if(_0x595e6a[_0x0e4d('0x34')][_0x0e4d('0x46')]){_0xa0f053[_0x0e4d('0x49')]=[{'all':!![]}];}_0xa0f053=_[_0x0e4d('0x44')]({},_0xa0f053,_0x595e6a[_0x0e4d('0x45')]);return db['UserProfileSection']['find'](_0xa0f053)['then'](handleEntityNotFound(_0x15d156,null))[_0x0e4d('0x28')](respondWithResult(_0x15d156,null))[_0x0e4d('0x4a')](handleError(_0x15d156,null));};exports['create']=function(_0x56186f,_0x28a9bd){return db[_0x0e4d('0x2e')][_0x0e4d('0x4b')](_0x56186f['body'],{})['then'](respondWithResult(_0x28a9bd,0xc9))[_0x0e4d('0x4a')](handleError(_0x28a9bd,null));};exports[_0x0e4d('0x4c')]=function(_0x4242ab,_0xa8decf){if(_0x4242ab['body']['id']){delete _0x4242ab[_0x0e4d('0x4d')]['id'];}return db[_0x0e4d('0x2e')][_0x0e4d('0x4e')]({'where':{'id':_0x4242ab[_0x0e4d('0x4f')]['id']}})['then'](handleEntityNotFound(_0xa8decf,null))[_0x0e4d('0x28')](saveUpdates(_0x4242ab[_0x0e4d('0x4d')],null))['then'](respondWithResult(_0xa8decf,null))['catch'](handleError(_0xa8decf,null));};exports[_0x0e4d('0x29')]=function(_0x50686e,_0x16226f){return db[_0x0e4d('0x2e')][_0x0e4d('0x4e')]({'where':{'id':_0x50686e[_0x0e4d('0x4f')]['id']}})[_0x0e4d('0x28')](handleEntityNotFound(_0x16226f,null))[_0x0e4d('0x28')](removeEntity(_0x16226f,null))[_0x0e4d('0x4a')](handleError(_0x16226f,null));};exports['describe']=function(_0x445a35,_0x439a98){return db[_0x0e4d('0x2e')]['describe']()['then'](respondWithResult(_0x439a98,null))[_0x0e4d('0x4a')](handleError(_0x439a98,null));}; \ No newline at end of file +var _0x07ed=['status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','UserProfileSection','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','create','body','params','find','describe','rimraf','zip-dir','request-promise','bluebird','path','sox','to-csv','fs-extra','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus'];(function(_0x422385,_0x874493){var _0x4340ac=function(_0x178509){while(--_0x178509){_0x422385['push'](_0x422385['shift']());}};_0x4340ac(++_0x874493);}(_0x07ed,0x78));var _0xd07e=function(_0x1096e7,_0x5c9642){_0x1096e7=_0x1096e7-0x0;var _0x3ffe74=_0x07ed[_0x1096e7];return _0x3ffe74;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd07e('0x0'));var zipdir=require(_0xd07e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd07e('0x2'));var moment=require('moment');var BPromise=require(_0xd07e('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd07e('0x4'));var sox=require(_0xd07e('0x5'));var csv=require(_0xd07e('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd07e('0x7'));var _=require(_0xd07e('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd07e('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xd07e('0x6'));var querystring=require(_0xd07e('0xa'));var Papa=require(_0xd07e('0xb'));var Redis=require('ioredis');var authService=require(_0xd07e('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xd07e('0xd'));var hardwareService=require(_0xd07e('0xe'));var logger=require(_0xd07e('0xf'))(_0xd07e('0x10'));var utils=require('../../config/utils');var config=require(_0xd07e('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xd07e('0x12'))['db'];function respondWithStatusCode(_0x1de16e,_0x4e7730){_0x4e7730=_0x4e7730||0xcc;return function(_0x3de672){if(_0x3de672){return _0x1de16e[_0xd07e('0x13')](_0x4e7730);}return _0x1de16e[_0xd07e('0x14')](_0x4e7730)[_0xd07e('0x15')]();};}function respondWithResult(_0x12c1e6,_0x4497c5){_0x4497c5=_0x4497c5||0xc8;return function(_0x4e8814){if(_0x4e8814){return _0x12c1e6[_0xd07e('0x14')](_0x4497c5)['json'](_0x4e8814);}};}function respondWithFilteredResult(_0x4bcd6d,_0x393ac1){return function(_0x1500b7){if(_0x1500b7){var _0xebc9=typeof _0x393ac1[_0xd07e('0x16')]===_0xd07e('0x17')&&typeof _0x393ac1[_0xd07e('0x18')]===_0xd07e('0x17');var _0x41cf29=_0x1500b7['count'];var _0x1aca4a=_0xebc9?0x0:_0x393ac1['offset'];var _0x39a147=_0xebc9?_0x1500b7[_0xd07e('0x19')]:_0x393ac1['offset']+_0x393ac1['limit'];var _0x4db941;if(_0x39a147>=_0x41cf29){_0x39a147=_0x41cf29;_0x4db941=0xc8;}else{_0x4db941=0xce;}_0x4bcd6d[_0xd07e('0x14')](_0x4db941);return _0x4bcd6d[_0xd07e('0x1a')](_0xd07e('0x1b'),_0x1aca4a+'-'+_0x39a147+'/'+_0x41cf29)[_0xd07e('0x1c')](_0x1500b7);}return null;};}function patchUpdates(_0x3c52ce){return function(_0x8c2299){try{jsonpatch['apply'](_0x8c2299,_0x3c52ce,!![]);}catch(_0x1fd3a0){return BPromise[_0xd07e('0x1d')](_0x1fd3a0);}return _0x8c2299[_0xd07e('0x1e')]();};}function saveUpdates(_0x4912f2,_0x1a1ce2){return function(_0x33cb32){if(_0x33cb32){return _0x33cb32[_0xd07e('0x1f')](_0x4912f2)[_0xd07e('0x20')](function(_0xaa379c){return _0xaa379c;});}return null;};}function removeEntity(_0x23bcf5,_0x785b1e){return function(_0x1f0ee6){if(_0x1f0ee6){return _0x1f0ee6[_0xd07e('0x21')]()[_0xd07e('0x20')](function(){_0x23bcf5[_0xd07e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bb328,_0x2f24de){return function(_0x776f39){if(!_0x776f39){_0x1bb328['sendStatus'](0x194);}return _0x776f39;};}function handleError(_0x4101c6,_0x47d073){_0x47d073=_0x47d073||0x1f4;return function(_0x5d333b){logger[_0xd07e('0x22')](_0x5d333b[_0xd07e('0x23')]);if(_0x5d333b[_0xd07e('0x24')]){delete _0x5d333b[_0xd07e('0x24')];}_0x4101c6[_0xd07e('0x14')](_0x47d073)[_0xd07e('0x25')](_0x5d333b);};}exports[_0xd07e('0x26')]=function(_0xfcfe93,_0x1669ba){var _0x5f90d9={},_0x3ec8cc={},_0x385e76={'count':0x0,'rows':[]};var _0x4eba2c=_[_0xd07e('0x27')](db[_0xd07e('0x28')][_0xd07e('0x29')],function(_0x19777c){return{'name':_0x19777c['fieldName'],'type':_0x19777c[_0xd07e('0x2a')][_0xd07e('0x2b')]};});_0x3ec8cc[_0xd07e('0x2c')]=_[_0xd07e('0x27')](_0x4eba2c,_0xd07e('0x24'));_0x3ec8cc['query']=_[_0xd07e('0x2d')](_0xfcfe93[_0xd07e('0x2e')]);_0x3ec8cc['filters']=_[_0xd07e('0x2f')](_0x3ec8cc[_0xd07e('0x2c')],_0x3ec8cc[_0xd07e('0x2e')]);_0x5f90d9[_0xd07e('0x30')]=_['intersection'](_0x3ec8cc[_0xd07e('0x2c')],qs['fields'](_0xfcfe93[_0xd07e('0x2e')][_0xd07e('0x31')]));_0x5f90d9['attributes']=_0x5f90d9[_0xd07e('0x30')][_0xd07e('0x32')]?_0x5f90d9[_0xd07e('0x30')]:_0x3ec8cc['model'];if(!_0xfcfe93[_0xd07e('0x2e')]['hasOwnProperty'](_0xd07e('0x33'))){_0x5f90d9['limit']=qs[_0xd07e('0x18')](_0xfcfe93['query'][_0xd07e('0x18')]);_0x5f90d9[_0xd07e('0x16')]=qs[_0xd07e('0x16')](_0xfcfe93['query'][_0xd07e('0x16')]);}_0x5f90d9['order']=qs['sort'](_0xfcfe93[_0xd07e('0x2e')]['sort']);_0x5f90d9[_0xd07e('0x34')]=qs[_0xd07e('0x35')](_[_0xd07e('0x36')](_0xfcfe93['query'],_0x3ec8cc[_0xd07e('0x35')]),_0x4eba2c);if(_0xfcfe93[_0xd07e('0x2e')]['filter']){_0x5f90d9[_0xd07e('0x34')]=_[_0xd07e('0x37')](_0x5f90d9[_0xd07e('0x34')],{'$or':_[_0xd07e('0x27')](_0x4eba2c,function(_0x3a598b){if(_0x3a598b[_0xd07e('0x2a')]!==_0xd07e('0x38')){var _0x4a9971={};_0x4a9971[_0x3a598b['name']]={'$like':'%'+_0xfcfe93[_0xd07e('0x2e')][_0xd07e('0x39')]+'%'};return _0x4a9971;}})});}_0x5f90d9=_['merge']({},_0x5f90d9,_0xfcfe93[_0xd07e('0x3a')]);var _0x199ee3={'where':_0x5f90d9[_0xd07e('0x34')]};return db[_0xd07e('0x28')][_0xd07e('0x19')](_0x199ee3)['then'](function(_0x5b29e6){_0x385e76['count']=_0x5b29e6;if(_0xfcfe93['query'][_0xd07e('0x3b')]){_0x5f90d9[_0xd07e('0x3c')]=[{'all':!![]}];}return db[_0xd07e('0x28')][_0xd07e('0x3d')](_0x5f90d9);})[_0xd07e('0x20')](function(_0x299bbc){_0x385e76[_0xd07e('0x3e')]=_0x299bbc;return _0x385e76;})[_0xd07e('0x20')](respondWithFilteredResult(_0x1669ba,_0x5f90d9))[_0xd07e('0x3f')](handleError(_0x1669ba,null));};exports[_0xd07e('0x40')]=function(_0x55db76,_0x59712d){var _0x25839c={'raw':![],'where':{'id':_0x55db76['params']['id']}},_0x14b1ab={};_0x14b1ab['model']=_[_0xd07e('0x2d')](db[_0xd07e('0x28')][_0xd07e('0x29')]);_0x14b1ab[_0xd07e('0x2e')]=_['keys'](_0x55db76[_0xd07e('0x2e')]);_0x14b1ab['filters']=_[_0xd07e('0x2f')](_0x14b1ab[_0xd07e('0x2c')],_0x14b1ab[_0xd07e('0x2e')]);_0x25839c[_0xd07e('0x30')]=_[_0xd07e('0x2f')](_0x14b1ab['model'],qs[_0xd07e('0x31')](_0x55db76[_0xd07e('0x2e')]['fields']));_0x25839c[_0xd07e('0x30')]=_0x25839c[_0xd07e('0x30')][_0xd07e('0x32')]?_0x25839c[_0xd07e('0x30')]:_0x14b1ab[_0xd07e('0x2c')];if(_0x55db76[_0xd07e('0x2e')][_0xd07e('0x3b')]){_0x25839c[_0xd07e('0x3c')]=[{'all':!![]}];}_0x25839c=_[_0xd07e('0x37')]({},_0x25839c,_0x55db76[_0xd07e('0x3a')]);return db[_0xd07e('0x28')]['find'](_0x25839c)[_0xd07e('0x20')](handleEntityNotFound(_0x59712d,null))['then'](respondWithResult(_0x59712d,null))[_0xd07e('0x3f')](handleError(_0x59712d,null));};exports['create']=function(_0xbc9e7,_0x6f0e3){return db[_0xd07e('0x28')][_0xd07e('0x41')](_0xbc9e7[_0xd07e('0x42')],{})[_0xd07e('0x20')](respondWithResult(_0x6f0e3,0xc9))[_0xd07e('0x3f')](handleError(_0x6f0e3,null));};exports[_0xd07e('0x1f')]=function(_0x1db518,_0x45f53d){if(_0x1db518[_0xd07e('0x42')]['id']){delete _0x1db518['body']['id'];}return db[_0xd07e('0x28')]['find']({'where':{'id':_0x1db518[_0xd07e('0x43')]['id']}})['then'](handleEntityNotFound(_0x45f53d,null))['then'](saveUpdates(_0x1db518[_0xd07e('0x42')],null))[_0xd07e('0x20')](respondWithResult(_0x45f53d,null))[_0xd07e('0x3f')](handleError(_0x45f53d,null));};exports['destroy']=function(_0x1b4d27,_0x43d549){return db[_0xd07e('0x28')][_0xd07e('0x44')]({'where':{'id':_0x1b4d27[_0xd07e('0x43')]['id']}})[_0xd07e('0x20')](handleEntityNotFound(_0x43d549,null))[_0xd07e('0x20')](removeEntity(_0x43d549,null))['catch'](handleError(_0x43d549,null));};exports[_0xd07e('0x45')]=function(_0x41deff,_0x51725c){return db[_0xd07e('0x28')][_0xd07e('0x45')]()[_0xd07e('0x20')](respondWithResult(_0x51725c,null))[_0xd07e('0x3f')](handleError(_0x51725c,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 1fd06f3..e3c1a87 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 _0x4cf1=['path','rimraf','../../config/environment','exports','define','compositeIndex','sectionId','userProfileId','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2e7c86,_0x6688d8){var _0x30e446=function(_0x18c775){while(--_0x18c775){_0x2e7c86['push'](_0x2e7c86['shift']());}};_0x30e446(++_0x6688d8);}(_0x4cf1,0x13c));var _0x14cf=function(_0x271060,_0x3f86b1){_0x271060=_0x271060-0x0;var _0x40540b=_0x4cf1[_0x271060];return _0x40540b;};'use strict';var _=require('lodash');var util=require(_0x14cf('0x0'));var logger=require(_0x14cf('0x1'))(_0x14cf('0x2'));var moment=require(_0x14cf('0x3'));var BPromise=require(_0x14cf('0x4'));var rp=require(_0x14cf('0x5'));var fs=require('fs');var path=require(_0x14cf('0x6'));var rimraf=require(_0x14cf('0x7'));var config=require(_0x14cf('0x8'));var attributes=require('./userProfileSection.attributes');module[_0x14cf('0x9')]=function(_0x12f300,_0x2bcbfe){return _0x12f300[_0x14cf('0xa')]('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x14cf('0xb'),'fields':[_0x14cf('0xc'),_0x14cf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x27a6=['exports','define','user_profile_has_sections','sectionId','userProfileId','util','moment','request-promise','../../config/environment','./userProfileSection.attributes'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x27a6,0x9b));var _0x627a=function(_0x21a2b3,_0x5d6564){_0x21a2b3=_0x21a2b3-0x0;var _0x4651a7=_0x27a6[_0x21a2b3];return _0x4651a7;};'use strict';var _=require('lodash');var util=require(_0x627a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x627a('0x1'));var BPromise=require('bluebird');var rp=require(_0x627a('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x627a('0x3'));var attributes=require(_0x627a('0x4'));module[_0x627a('0x5')]=function(_0x9d22dc,_0x2d91c5){return _0x9d22dc[_0x627a('0x6')]('UserProfileSection',attributes,{'tableName':_0x627a('0x7'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x627a('0x8'),_0x627a('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 330d6c3..6f723c2 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 _0x2755=['jayson/promise','client','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2755,0x19a));var _0x5275=function(_0x42efa7,_0x2d5d92){_0x42efa7=_0x42efa7-0x0;var _0x5d1b50=_0x2755[_0x42efa7];return _0x5d1b50;};'use strict';var _=require(_0x5275('0x0'));var util=require('util');var moment=require(_0x5275('0x1'));var BPromise=require(_0x5275('0x2'));var rs=require(_0x5275('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5275('0x4'))['db'];var utils=require(_0x5275('0x5'));var logger=require('../../config/logger')(_0x5275('0x6'));var config=require(_0x5275('0x7'));var jayson=require(_0x5275('0x8'));var client=jayson[_0x5275('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x589615,_0x4b5a0e,_0x207a00){return new BPromise(function(_0x3618da,_0xeea7d8){return client[_0x5275('0xa')](_0x589615,_0x207a00)[_0x5275('0xb')](function(_0x4e9987){logger[_0x5275('0xc')](_0x5275('0xd'),_0x4b5a0e,_0x5275('0xe'));logger[_0x5275('0xf')](_0x5275('0x10'),_0x4b5a0e,_0x5275('0xe'),JSON[_0x5275('0x11')](_0x4e9987));if(_0x4e9987[_0x5275('0x12')]){if(_0x4e9987[_0x5275('0x12')]['code']===0x1f4){logger[_0x5275('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x4b5a0e,_0x4e9987[_0x5275('0x12')][_0x5275('0x13')]);return _0xeea7d8(_0x4e9987[_0x5275('0x12')]['message']);}logger[_0x5275('0x12')](_0x5275('0xd'),_0x4b5a0e,_0x4e9987[_0x5275('0x12')]['message']);return _0x3618da(_0x4e9987['error'][_0x5275('0x13')]);}else{logger['info'](_0x5275('0xd'),_0x4b5a0e,'request\x20sent');_0x3618da(_0x4e9987[_0x5275('0x14')][_0x5275('0x13')]);}})[_0x5275('0x15')](function(_0x53f3a6){logger[_0x5275('0x12')](_0x5275('0xd'),_0x4b5a0e,_0x53f3a6);_0xeea7d8(_0x53f3a6);});});} \ No newline at end of file +var _0x0d92=['code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x0d92,0x1d1));var _0x20d9=function(_0x2cf609,_0xf0cf8b){_0x2cf609=_0x2cf609-0x0;var _0x54ce3d=_0x0d92[_0x2cf609];return _0x54ce3d;};'use strict';var _=require(_0x20d9('0x0'));var util=require(_0x20d9('0x1'));var moment=require(_0x20d9('0x2'));var BPromise=require(_0x20d9('0x3'));var rs=require(_0x20d9('0x4'));var fs=require('fs');var Redis=require(_0x20d9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x20d9('0x6'));var logger=require(_0x20d9('0x7'))(_0x20d9('0x8'));var config=require('../../config/environment');var jayson=require(_0x20d9('0x9'));var client=jayson[_0x20d9('0xa')][_0x20d9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5eb0f2,_0x76ccf1,_0x37b705){return new BPromise(function(_0x4286da,_0x31b933){return client['request'](_0x5eb0f2,_0x37b705)[_0x20d9('0xc')](function(_0x4e6711){logger[_0x20d9('0xd')](_0x20d9('0xe'),_0x76ccf1,'request\x20sent');logger[_0x20d9('0xf')](_0x20d9('0x10'),_0x76ccf1,_0x20d9('0x11'),JSON['stringify'](_0x4e6711));if(_0x4e6711[_0x20d9('0x12')]){if(_0x4e6711['error'][_0x20d9('0x13')]===0x1f4){logger[_0x20d9('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x76ccf1,_0x4e6711[_0x20d9('0x12')]['message']);return _0x31b933(_0x4e6711[_0x20d9('0x12')][_0x20d9('0x14')]);}logger[_0x20d9('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x76ccf1,_0x4e6711['error'][_0x20d9('0x14')]);return _0x4286da(_0x4e6711['error'][_0x20d9('0x14')]);}else{logger[_0x20d9('0xd')](_0x20d9('0xe'),_0x76ccf1,'request\x20sent');_0x4286da(_0x4e6711[_0x20d9('0x15')][_0x20d9('0x14')]);}})['catch'](function(_0x545942){logger[_0x20d9('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x76ccf1,_0x545942);_0x31b933(_0x545942);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index a56990d..34823a1 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x10e9e2,_0x21a4a8){var _0xc12c3=function(_0x2cc7e3){while(--_0x2cc7e3){_0x10e9e2['push'](_0x10e9e2['shift']());}};_0xc12c3(++_0x21a4a8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x276d01,_0x13cbe8){var _0xbf68e2=function(_0x4b30b4){while(--_0x4b30b4){_0x276d01['push'](_0x276d01['shift']());}};_0xbf68e2(++_0x13cbe8);}(_0xe706,0xa3));var _0x6e70=function(_0x592416,_0x2c75e9){_0x592416=_0x592416-0x0;var _0x3005fa=_0xe706[_0x592416];return _0x3005fa;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 6385486..01866fd 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 _0xff74=['sequelize','exports','INTEGER'];(function(_0xbf1cb4,_0x542455){var _0x15bc4d=function(_0x670798){while(--_0x670798){_0xbf1cb4['push'](_0xbf1cb4['shift']());}};_0x15bc4d(++_0x542455);}(_0xff74,0x12c));var _0x4ff7=function(_0x42d0ed,_0x91a115){_0x42d0ed=_0x42d0ed-0x0;var _0x3f63f6=_0xff74[_0x42d0ed];return _0x3f63f6;};'use strict';var Sequelize=require(_0x4ff7('0x0'));module[_0x4ff7('0x1')]={'penalty':{'type':Sequelize[_0x4ff7('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0d4d=['sequelize','exports','INTEGER'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x0d4d,0x132));var _0xd0d4=function(_0x32f271,_0xb3356c){_0x32f271=_0x32f271-0x0;var _0x4a505b=_0x0d4d[_0x32f271];return _0x4a505b;};'use strict';var Sequelize=require(_0xd0d4('0x0'));module[_0xd0d4('0x1')]={'penalty':{'type':Sequelize[_0xd0d4('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 074ee36..65b4f44 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 _0x583c=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','./userSmsQueue.attributes','define','UserSmsQueue','lodash'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x583c,0x12b));var _0xc583=function(_0x593564,_0x43583f){_0x593564=_0x593564-0x0;var _0x211a89=_0x583c[_0x593564];return _0x211a89;};'use strict';var _=require(_0xc583('0x0'));var util=require(_0xc583('0x1'));var logger=require(_0xc583('0x2'))(_0xc583('0x3'));var moment=require('moment');var BPromise=require(_0xc583('0x4'));var rp=require(_0xc583('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc583('0x6'));var attributes=require(_0xc583('0x7'));module['exports']=function(_0xd3a750,_0x365ed6){return _0xd3a750[_0xc583('0x8')](_0xc583('0x9'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e0e=['../../config/environment','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x1b42ab,_0x2c2124){var _0x167d7f=function(_0x1cc123){while(--_0x1cc123){_0x1b42ab['push'](_0x1b42ab['shift']());}};_0x167d7f(++_0x2c2124);}(_0x5e0e,0x89));var _0xe5e0=function(_0x36856f,_0x98b59e){_0x36856f=_0x36856f-0x0;var _0x43ac52=_0x5e0e[_0x36856f];return _0x43ac52;};'use strict';var _=require(_0xe5e0('0x0'));var util=require(_0xe5e0('0x1'));var logger=require('../../config/logger')(_0xe5e0('0x2'));var moment=require(_0xe5e0('0x3'));var BPromise=require(_0xe5e0('0x4'));var rp=require(_0xe5e0('0x5'));var fs=require('fs');var path=require(_0xe5e0('0x6'));var rimraf=require('rimraf');var config=require(_0xe5e0('0x7'));var attributes=require('./userSmsQueue.attributes');module[_0xe5e0('0x8')]=function(_0x3e564e,_0x2ff9ac){return _0x3e564e[_0xe5e0('0x9')](_0xe5e0('0xa'),attributes,{'tableName':_0xe5e0('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 78ad902..f666622 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 _0x1f4a=['then','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request'];(function(_0x845505,_0x19e5f3){var _0x2513b9=function(_0x10e7af){while(--_0x10e7af){_0x845505['push'](_0x845505['shift']());}};_0x2513b9(++_0x19e5f3);}(_0x1f4a,0x181));var _0xa1f4=function(_0x21a134,_0x2e6cbe){_0x21a134=_0x21a134-0x0;var _0x3cd451=_0x1f4a[_0x21a134];return _0x3cd451;};'use strict';var _=require('lodash');var util=require(_0xa1f4('0x0'));var moment=require('moment');var BPromise=require(_0xa1f4('0x1'));var rs=require(_0xa1f4('0x2'));var fs=require('fs');var Redis=require(_0xa1f4('0x3'));var db=require(_0xa1f4('0x4'))['db'];var utils=require(_0xa1f4('0x5'));var logger=require(_0xa1f4('0x6'))(_0xa1f4('0x7'));var config=require('../../config/environment');var jayson=require(_0xa1f4('0x8'));var client=jayson['client'][_0xa1f4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51a195,_0x64f4ef,_0x5af077){return new BPromise(function(_0x10f2c1,_0x1362e4){return client[_0xa1f4('0xa')](_0x51a195,_0x5af077)[_0xa1f4('0xb')](function(_0x4a593e){logger['info'](_0xa1f4('0xc'),_0x64f4ef,'request\x20sent');logger[_0xa1f4('0xd')](_0xa1f4('0xe'),_0x64f4ef,'request\x20sent',JSON[_0xa1f4('0xf')](_0x4a593e));if(_0x4a593e[_0xa1f4('0x10')]){if(_0x4a593e['error'][_0xa1f4('0x11')]===0x1f4){logger[_0xa1f4('0x10')](_0xa1f4('0xc'),_0x64f4ef,_0x4a593e[_0xa1f4('0x10')]['message']);return _0x1362e4(_0x4a593e[_0xa1f4('0x10')]['message']);}logger[_0xa1f4('0x10')](_0xa1f4('0xc'),_0x64f4ef,_0x4a593e['error'][_0xa1f4('0x12')]);return _0x10f2c1(_0x4a593e[_0xa1f4('0x10')][_0xa1f4('0x12')]);}else{logger[_0xa1f4('0x13')](_0xa1f4('0xc'),_0x64f4ef,'request\x20sent');_0x10f2c1(_0x4a593e[_0xa1f4('0x14')][_0xa1f4('0x12')]);}})[_0xa1f4('0x15')](function(_0x520d92){logger[_0xa1f4('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x64f4ef,_0x520d92);_0x1362e4(_0x520d92);});});} \ No newline at end of file +var _0x6ffd=['UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','info','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','then','request\x20sent','debug'];(function(_0x289893,_0x396041){var _0x153687=function(_0x522ff8){while(--_0x522ff8){_0x289893['push'](_0x289893['shift']());}};_0x153687(++_0x396041);}(_0x6ffd,0xd8));var _0xd6ff=function(_0x3354af,_0x1f459d){_0x3354af=_0x3354af-0x0;var _0x2f5af1=_0x6ffd[_0x3354af];return _0x2f5af1;};'use strict';var _=require('lodash');var util=require(_0xd6ff('0x0'));var moment=require('moment');var BPromise=require(_0xd6ff('0x1'));var rs=require(_0xd6ff('0x2'));var fs=require('fs');var Redis=require(_0xd6ff('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd6ff('0x4'));var logger=require(_0xd6ff('0x5'))(_0xd6ff('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd6ff('0x7')][_0xd6ff('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51d8d5,_0x20c3fd,_0x25fb27){return new BPromise(function(_0x4e2e83,_0x49e0b3){return client['request'](_0x51d8d5,_0x25fb27)[_0xd6ff('0x9')](function(_0x4162de){logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x20c3fd,_0xd6ff('0xa'));logger[_0xd6ff('0xb')](_0xd6ff('0xc'),_0x20c3fd,_0xd6ff('0xa'),JSON[_0xd6ff('0xd')](_0x4162de));if(_0x4162de['error']){if(_0x4162de[_0xd6ff('0xe')][_0xd6ff('0xf')]===0x1f4){logger[_0xd6ff('0xe')](_0xd6ff('0x10'),_0x20c3fd,_0x4162de['error']['message']);return _0x49e0b3(_0x4162de[_0xd6ff('0xe')]['message']);}logger[_0xd6ff('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x20c3fd,_0x4162de[_0xd6ff('0xe')][_0xd6ff('0x11')]);return _0x4e2e83(_0x4162de['error'][_0xd6ff('0x11')]);}else{logger[_0xd6ff('0x12')](_0xd6ff('0x10'),_0x20c3fd,'request\x20sent');_0x4e2e83(_0x4162de['result'][_0xd6ff('0x11')]);}})['catch'](function(_0x2fe9bb){logger[_0xd6ff('0xe')](_0xd6ff('0x10'),_0x20c3fd,_0x2fe9bb);_0x49e0b3(_0x2fe9bb);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 27ddcb2..9d7a774 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 _0x4e49=['INTEGER','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4e49,0x10f));var _0x94e4=function(_0x40a5e8,_0x21b743){_0x40a5e8=_0x40a5e8-0x0;var _0x3d9295=_0x4e49[_0x40a5e8];return _0x3d9295;};'use strict';var Sequelize=require(_0x94e4('0x0'));module[_0x94e4('0x1')]={'UserId':{'type':Sequelize[_0x94e4('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xeab5=['exports','INTEGER','sequelize'];(function(_0xa9eaa0,_0x4ba2b4){var _0x30897a=function(_0x2caa01){while(--_0x2caa01){_0xa9eaa0['push'](_0xa9eaa0['shift']());}};_0x30897a(++_0x4ba2b4);}(_0xeab5,0xbc));var _0x5eab=function(_0x2f8769,_0x3620a3){_0x2f8769=_0x2f8769-0x0;var _0x4d54cd=_0xeab5[_0x2f8769];return _0x4d54cd;};'use strict';var Sequelize=require(_0x5eab('0x0'));module[_0x5eab('0x1')]={'UserId':{'type':Sequelize[_0x5eab('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x5eab('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 4fd9c32..7b87226 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(_0x3ed801,_0x190579){var _0x10bffc=function(_0x4a1632){while(--_0x4a1632){_0x3ed801['push'](_0x3ed801['shift']());}};_0x10bffc(++_0x190579);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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(_0x20a1f6,_0x11cc55){var _0x4f8cea=function(_0x30e0da){while(--_0x30e0da){_0x20a1f6['push'](_0x20a1f6['shift']());}};_0x4f8cea(++_0x11cc55);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 9942553..b34afe6 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4da3aa,_0x45e833){var _0x515ec3=function(_0x462867){while(--_0x462867){_0x4da3aa['push'](_0x4da3aa['shift']());}};_0x515ec3(++_0x45e833);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4c4037,_0x15054b){_0x4c4037=_0x4c4037-0x0;var _0x357862=_0xcb91[_0x4c4037];return _0x357862;};'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(_0x5bd633,_0x3451d6){var _0x5a027b=function(_0x5018d7){while(--_0x5018d7){_0x5bd633['push'](_0x5bd633['shift']());}};_0x5a027b(++_0x3451d6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xcb91[_0x4d613c];return _0x301fe3;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 0123e40..815f613 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 _0xff92=['exports','sequelize'];(function(_0x2d7116,_0x37bee1){var _0x522d5a=function(_0x34cba3){while(--_0x34cba3){_0x2d7116['push'](_0x2d7116['shift']());}};_0x522d5a(++_0x37bee1);}(_0xff92,0x67));var _0x2ff9=function(_0x470029,_0x717f29){_0x470029=_0x470029-0x0;var _0x31d517=_0xff92[_0x470029];return _0x31d517;};'use strict';var Sequelize=require(_0x2ff9('0x0'));module[_0x2ff9('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xfcfc=['INTEGER','exports'];(function(_0x5d353a,_0x1fe50e){var _0x3fc046=function(_0x12cd58){while(--_0x12cd58){_0x5d353a['push'](_0x5d353a['shift']());}};_0x3fc046(++_0x1fe50e);}(_0xfcfc,0xf9));var _0xcfcf=function(_0x450f9e,_0x20fa03){_0x450f9e=_0x450f9e-0x0;var _0x16ba4d=_0xfcfc[_0x450f9e];return _0x16ba4d;};'use strict';var Sequelize=require('sequelize');module[_0xcfcf('0x0')]={'penalty':{'type':Sequelize[_0xcfcf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 3b4e6fe..8c3d69c 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 _0xf68f=['path','rimraf','../../config/environment','user_has_voice_queues','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5519a9,_0x1c5147){var _0x32f2cc=function(_0x52ed58){while(--_0x52ed58){_0x5519a9['push'](_0x5519a9['shift']());}};_0x32f2cc(++_0x1c5147);}(_0xf68f,0x130));var _0xff68=function(_0x4554ff,_0x32759d){_0x4554ff=_0x4554ff-0x0;var _0x39da6b=_0xf68f[_0x4554ff];return _0x39da6b;};'use strict';var _=require(_0xff68('0x0'));var util=require('util');var logger=require(_0xff68('0x1'))(_0xff68('0x2'));var moment=require(_0xff68('0x3'));var BPromise=require(_0xff68('0x4'));var rp=require(_0xff68('0x5'));var fs=require('fs');var path=require(_0xff68('0x6'));var rimraf=require(_0xff68('0x7'));var config=require(_0xff68('0x8'));var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0x488578,_0x4b563b){return _0x488578['define']('UserVoiceQueue',attributes,{'tableName':_0xff68('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e78=['UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x24f326,_0x616a7){var _0x488e2d=function(_0x293d9a){while(--_0x293d9a){_0x24f326['push'](_0x24f326['shift']());}};_0x488e2d(++_0x616a7);}(_0x3e78,0xc5));var _0x83e7=function(_0x1d39f6,_0x146f4a){_0x1d39f6=_0x1d39f6-0x0;var _0x3dbd7a=_0x3e78[_0x1d39f6];return _0x3dbd7a;};'use strict';var _=require(_0x83e7('0x0'));var util=require(_0x83e7('0x1'));var logger=require(_0x83e7('0x2'))(_0x83e7('0x3'));var moment=require(_0x83e7('0x4'));var BPromise=require(_0x83e7('0x5'));var rp=require(_0x83e7('0x6'));var fs=require('fs');var path=require(_0x83e7('0x7'));var rimraf=require(_0x83e7('0x8'));var config=require(_0x83e7('0x9'));var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0x17440c,_0x20fcf0){return _0x17440c[_0x83e7('0xa')](_0x83e7('0xb'),attributes,{'tableName':_0x83e7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index e6d972d..da3a771 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 _0x8228=['jayson/promise','client','http','request','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x3cad30,_0xdfc5c7){var _0x5f12ed=function(_0x2c4d41){while(--_0x2c4d41){_0x3cad30['push'](_0x3cad30['shift']());}};_0x5f12ed(++_0xdfc5c7);}(_0x8228,0xae));var _0x8822=function(_0x4d9e91,_0x1336d5){_0x4d9e91=_0x4d9e91-0x0;var _0x363f98=_0x8228[_0x4d9e91];return _0x363f98;};'use strict';var _=require(_0x8822('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8822('0x1'));var fs=require('fs');var Redis=require(_0x8822('0x2'));var db=require(_0x8822('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8822('0x4'))('rpc');var config=require(_0x8822('0x5'));var jayson=require(_0x8822('0x6'));var client=jayson[_0x8822('0x7')][_0x8822('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x15734e,_0x2b6812,_0x3fcb14){return new BPromise(function(_0x4ac6d3,_0x45d596){return client[_0x8822('0x9')](_0x15734e,_0x3fcb14)['then'](function(_0x50682e){logger['info'](_0x8822('0xa'),_0x2b6812,_0x8822('0xb'));logger[_0x8822('0xc')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x2b6812,_0x8822('0xb'),JSON[_0x8822('0xd')](_0x50682e));if(_0x50682e[_0x8822('0xe')]){if(_0x50682e[_0x8822('0xe')][_0x8822('0xf')]===0x1f4){logger[_0x8822('0xe')](_0x8822('0xa'),_0x2b6812,_0x50682e[_0x8822('0xe')][_0x8822('0x10')]);return _0x45d596(_0x50682e[_0x8822('0xe')][_0x8822('0x10')]);}logger[_0x8822('0xe')](_0x8822('0xa'),_0x2b6812,_0x50682e[_0x8822('0xe')][_0x8822('0x10')]);return _0x4ac6d3(_0x50682e[_0x8822('0xe')][_0x8822('0x10')]);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x2b6812,_0x8822('0xb'));_0x4ac6d3(_0x50682e[_0x8822('0x11')][_0x8822('0x10')]);}})['catch'](function(_0xadf7a2){logger[_0x8822('0xe')](_0x8822('0xa'),_0x2b6812,_0xadf7a2);_0x45d596(_0xadf7a2);});});} \ No newline at end of file +var _0xa518=['moment','bluebird','../../config/environment','jayson/promise','client','http','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash'];(function(_0x37f14d,_0x30aa61){var _0x57efd8=function(_0x162b8d){while(--_0x162b8d){_0x37f14d['push'](_0x37f14d['shift']());}};_0x57efd8(++_0x30aa61);}(_0xa518,0x14f));var _0x8a51=function(_0x834bb6,_0x1c5e35){_0x834bb6=_0x834bb6-0x0;var _0xa35d00=_0xa518[_0x834bb6];return _0xa35d00;};'use strict';var _=require(_0x8a51('0x0'));var util=require('util');var moment=require(_0x8a51('0x1'));var BPromise=require(_0x8a51('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x8a51('0x3'));var jayson=require(_0x8a51('0x4'));var client=jayson[_0x8a51('0x5')][_0x8a51('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4fef33,_0x332504,_0x4a4dee){return new BPromise(function(_0x5f3db6,_0x178114){return client['request'](_0x4fef33,_0x4a4dee)['then'](function(_0x5d7321){logger[_0x8a51('0x7')](_0x8a51('0x8'),_0x332504,'request\x20sent');logger[_0x8a51('0x9')](_0x8a51('0xa'),_0x332504,_0x8a51('0xb'),JSON['stringify'](_0x5d7321));if(_0x5d7321[_0x8a51('0xc')]){if(_0x5d7321['error'][_0x8a51('0xd')]===0x1f4){logger[_0x8a51('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x332504,_0x5d7321['error'][_0x8a51('0xe')]);return _0x178114(_0x5d7321[_0x8a51('0xc')][_0x8a51('0xe')]);}logger[_0x8a51('0xc')](_0x8a51('0x8'),_0x332504,_0x5d7321[_0x8a51('0xc')][_0x8a51('0xe')]);return _0x5f3db6(_0x5d7321[_0x8a51('0xc')][_0x8a51('0xe')]);}else{logger[_0x8a51('0x7')](_0x8a51('0x8'),_0x332504,_0x8a51('0xb'));_0x5f3db6(_0x5d7321['result'][_0x8a51('0xe')]);}})[_0x8a51('0xf')](function(_0x2fb76d){logger['error'](_0x8a51('0x8'),_0x332504,_0x2fb76d);_0x178114(_0x2fb76d);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index ec41263..d48067a 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x34d6cb,_0x1ae55c){var _0x4372cb=function(_0x1a073a){while(--_0x1a073a){_0x34d6cb['push'](_0x34d6cb['shift']());}};_0x4372cb(++_0x1ae55c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x219372,_0x75051){var _0x37467a=function(_0xc9086f){while(--_0xc9086f){_0x219372['push'](_0x219372['shift']());}};_0x37467a(++_0x75051);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1a595a,_0x263824){_0x1a595a=_0x1a595a-0x0;var _0x33f008=_0xcb91[_0x1a595a];return _0x33f008;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 72c1271..378bd8e 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 _0xc522=['queue_interface','sequelize','exports','INTEGER','STRING','Required\x20by\x20Asterisk'];(function(_0x193e28,_0x3dac1d){var _0x20ef59=function(_0x48047e){while(--_0x48047e){_0x193e28['push'](_0x193e28['shift']());}};_0x20ef59(++_0x3dac1d);}(_0xc522,0xa3));var _0x2c52=function(_0x3dff4d,_0x48e7bb){_0x3dff4d=_0x3dff4d-0x0;var _0x51e2ff=_0xc522[_0x3dff4d];return _0x51e2ff;};'use strict';var Sequelize=require(_0x2c52('0x0'));module[_0x2c52('0x1')]={'uniqueid':{'type':Sequelize[_0x2c52('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x2c52('0x3')],'allowNull':![],'comment':_0x2c52('0x4')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x2c52('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x2c52('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x2c52('0x3')],'allowNull':![],'unique':_0x2c52('0x5'),'comment':_0x2c52('0x4')},'penalty':{'type':Sequelize[_0x2c52('0x2')](0xb),'defaultValue':0x0,'comment':_0x2c52('0x4')},'paused':{'type':Sequelize[_0x2c52('0x2')](0xb),'defaultValue':0x0,'comment':_0x2c52('0x4')}}; \ No newline at end of file +var _0x30e9=['queue_interface','sequelize','exports','INTEGER','STRING','Required\x20by\x20Asterisk'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x30e9,0x121));var _0x930e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x30e9[_0x3b5250];return _0xc844a1;};'use strict';var Sequelize=require(_0x930e('0x0'));module[_0x930e('0x1')]={'uniqueid':{'type':Sequelize[_0x930e('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x930e('0x3')],'allowNull':![],'comment':_0x930e('0x4')},'UserId':{'type':Sequelize[_0x930e('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x930e('0x3')],'allowNull':![],'unique':_0x930e('0x5'),'comment':_0x930e('0x4')},'VoiceQueueId':{'type':Sequelize[_0x930e('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x930e('0x3')],'allowNull':![],'unique':_0x930e('0x5'),'comment':_0x930e('0x4')},'penalty':{'type':Sequelize[_0x930e('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x930e('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 675fc51..8e9043b 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 _0x02db=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x02db,0x11e));var _0xb02d=function(_0x6154ce,_0x4b77f8){_0x6154ce=_0x6154ce-0x0;var _0x80b098=_0x02db[_0x6154ce];return _0x80b098;};'use strict';var EventEmitter=require(_0xb02d('0x0'));var UserVoiceQueueRt=require(_0xb02d('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xb02d('0x2')](0x0);var events={'afterCreate':_0xb02d('0x3'),'afterUpdate':_0xb02d('0x4'),'afterDestroy':_0xb02d('0x5')};function emitEvent(_0xdbefe2){return function(_0x4220f2,_0x89ed38,_0x3e7a66){UserVoiceQueueRtEvents[_0xb02d('0x6')](_0xdbefe2+':'+_0x4220f2['id'],_0x4220f2);UserVoiceQueueRtEvents[_0xb02d('0x6')](_0xdbefe2,_0x4220f2);_0x3e7a66(null);};}for(var e in events){if(events[_0xb02d('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xb02d('0x8')](e,emitEvent(event));}}module[_0xb02d('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xf027=['setMaxListeners','save','emit','hasOwnProperty','exports','../../mysqldb','UserVoiceQueueRt'];(function(_0x5cbfe2,_0x2fc7d2){var _0x5d8b31=function(_0x515713){while(--_0x515713){_0x5cbfe2['push'](_0x5cbfe2['shift']());}};_0x5d8b31(++_0x2fc7d2);}(_0xf027,0x163));var _0x7f02=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf027[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x7f02('0x0'))['db'][_0x7f02('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x7f02('0x2')](0x0);var events={'afterCreate':_0x7f02('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x459fd5){return function(_0x3252d0,_0x1b2758,_0x49535d){UserVoiceQueueRtEvents['emit'](_0x459fd5+':'+_0x3252d0['id'],_0x3252d0);UserVoiceQueueRtEvents[_0x7f02('0x4')](_0x459fd5,_0x3252d0);_0x49535d(null);};}for(var e in events){if(events[_0x7f02('0x5')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x7f02('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index da634d7..1bbe880 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 _0xd9ca=['bluebird','request-promise','path','rimraf','exports','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment'];(function(_0x176646,_0x5adeea){var _0x2e2b90=function(_0x50e1aa){while(--_0x50e1aa){_0x176646['push'](_0x176646['shift']());}};_0x2e2b90(++_0x5adeea);}(_0xd9ca,0x8b));var _0xad9c=function(_0x597d25,_0x7b52af){_0x597d25=_0x597d25-0x0;var _0xfa0c0d=_0xd9ca[_0x597d25];return _0xfa0c0d;};'use strict';var _=require(_0xad9c('0x0'));var util=require(_0xad9c('0x1'));var logger=require(_0xad9c('0x2'))(_0xad9c('0x3'));var moment=require(_0xad9c('0x4'));var BPromise=require(_0xad9c('0x5'));var rp=require(_0xad9c('0x6'));var fs=require('fs');var path=require(_0xad9c('0x7'));var rimraf=require(_0xad9c('0x8'));var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module[_0xad9c('0x9')]=function(_0x494119,_0x1378da){return _0x494119['define'](_0xad9c('0xa'),attributes,{'tableName':_0xad9c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f50=['bluebird','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','user_has_voice_queues_rt','lodash','util','../../config/logger','moment'];(function(_0x44ea19,_0x2a139c){var _0xfeb3d1=function(_0x54fb9e){while(--_0x54fb9e){_0x44ea19['push'](_0x44ea19['shift']());}};_0xfeb3d1(++_0x2a139c);}(_0x1f50,0x14c));var _0x01f5=function(_0x6eefc1,_0x5371cf){_0x6eefc1=_0x6eefc1-0x0;var _0x3be24a=_0x1f50[_0x6eefc1];return _0x3be24a;};'use strict';var _=require(_0x01f5('0x0'));var util=require(_0x01f5('0x1'));var logger=require(_0x01f5('0x2'))('api');var moment=require(_0x01f5('0x3'));var BPromise=require(_0x01f5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x01f5('0x5'));var rimraf=require(_0x01f5('0x6'));var config=require(_0x01f5('0x7'));var attributes=require(_0x01f5('0x8'));module[_0x01f5('0x9')]=function(_0x2ca8b5,_0x2f8602){return _0x2ca8b5[_0x01f5('0xa')]('UserVoiceQueueRt',attributes,{'tableName':_0x01f5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 941ddd7..1149142 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 _0xb351=['sequelize','outboundQueuePauses','GetVoiceQueueRtPauses','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','UserVoiceQueueRt','options','raw','where'];(function(_0x2606a9,_0x2eeca8){var _0x1698ea=function(_0x49a9f8){while(--_0x49a9f8){_0x2606a9['push'](_0x2606a9['shift']());}};_0x1698ea(++_0x2eeca8);}(_0xb351,0x147));var _0x1b35=function(_0x3f187b,_0x1333f9){_0x3f187b=_0x3f187b-0x0;var _0x2ba71f=_0xb351[_0x3f187b];return _0x2ba71f;};'use strict';var _=require('lodash');var util=require(_0x1b35('0x0'));var moment=require(_0x1b35('0x1'));var BPromise=require('bluebird');var rs=require(_0x1b35('0x2'));var fs=require('fs');var Redis=require(_0x1b35('0x3'));var db=require(_0x1b35('0x4'))['db'];var utils=require(_0x1b35('0x5'));var logger=require(_0x1b35('0x6'))(_0x1b35('0x7'));var config=require(_0x1b35('0x8'));var jayson=require(_0x1b35('0x9'));var client=jayson[_0x1b35('0xa')][_0x1b35('0xb')]({'port':0x232a});config['redis']=_[_0x1b35('0xc')](config[_0x1b35('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x1b35('0xe'))(new Redis(config[_0x1b35('0xd')]));require(_0x1b35('0xf'))[_0x1b35('0x10')](socket);function respondWithRpcPromise(_0x1403a1,_0x59f143,_0x51e9a9){return new BPromise(function(_0x4c3372,_0x247b03){return client[_0x1b35('0x11')](_0x1403a1,_0x51e9a9)[_0x1b35('0x12')](function(_0x51aa4f){logger[_0x1b35('0x13')](_0x1b35('0x14'),_0x59f143,_0x1b35('0x15'));logger[_0x1b35('0x16')](_0x1b35('0x17'),_0x59f143,'request\x20sent',JSON['stringify'](_0x51aa4f));if(_0x51aa4f['error']){if(_0x51aa4f['error'][_0x1b35('0x18')]===0x1f4){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x59f143,_0x51aa4f[_0x1b35('0x19')][_0x1b35('0x1a')]);return _0x247b03(_0x51aa4f[_0x1b35('0x19')][_0x1b35('0x1a')]);}logger[_0x1b35('0x19')](_0x1b35('0x14'),_0x59f143,_0x51aa4f['error'][_0x1b35('0x1a')]);return _0x4c3372(_0x51aa4f[_0x1b35('0x19')]['message']);}else{logger[_0x1b35('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x59f143,_0x1b35('0x15'));_0x4c3372(_0x51aa4f[_0x1b35('0x1b')]['message']);}})[_0x1b35('0x1c')](function(_0x44a0d0){logger[_0x1b35('0x19')](_0x1b35('0x14'),_0x59f143,_0x44a0d0);_0x247b03(_0x44a0d0);});});}exports['GetVoiceQueueRtPauses']=function(_0x545afa){var _0x1013d4=this;return new Promise(function(_0x4dfe38,_0x586e39){return db[_0x1b35('0x1d')]['findAll']({'raw':_0x545afa[_0x1b35('0x1e')]?_0x545afa[_0x1b35('0x1e')][_0x1b35('0x1f')]===undefined?!![]:![]:!![],'where':_0x545afa[_0x1b35('0x1e')]?_0x545afa[_0x1b35('0x1e')][_0x1b35('0x20')]||null:null,'attributes':[[db[_0x1b35('0x21')]['fn']('COUNT',db[_0x1b35('0x21')]['fn']('IF',db[_0x1b35('0x21')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0x1b35('0x22')]]})[_0x1b35('0x12')](function(_0x4da911){logger[_0x1b35('0x13')](_0x1b35('0x23'),_0x545afa);logger['debug'](_0x1b35('0x23'),_0x545afa,JSON['stringify'](_0x4da911));_0x4dfe38(_0x4da911);})['catch'](function(_0x4afe94){logger[_0x1b35('0x19')]('GetVoiceQueueRtPauses',_0x4afe94[_0x1b35('0x1a')],_0x545afa);_0x586e39(_0x1013d4['error'](0x1f4,_0x4afe94['message']));});});}; \ No newline at end of file +var _0xd934=['result','GetVoiceQueueRtPauses','findAll','options','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./userVoiceQueueRt.socket','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x596c35,_0x38f6e5){var _0x4d08af=function(_0x1bb2dd){while(--_0x1bb2dd){_0x596c35['push'](_0x596c35['shift']());}};_0x4d08af(++_0x38f6e5);}(_0xd934,0x1af));var _0x4d93=function(_0x244423,_0x4effba){_0x244423=_0x244423-0x0;var _0x30feec=_0xd934[_0x244423];return _0x30feec;};'use strict';var _=require(_0x4d93('0x0'));var util=require(_0x4d93('0x1'));var moment=require(_0x4d93('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d93('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4d93('0x4'));var logger=require(_0x4d93('0x5'))(_0x4d93('0x6'));var config=require(_0x4d93('0x7'));var jayson=require(_0x4d93('0x8'));var client=jayson[_0x4d93('0x9')][_0x4d93('0xa')]({'port':0x232a});config[_0x4d93('0xb')]=_['defaults'](config[_0x4d93('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x4d93('0xc'))(new Redis(config[_0x4d93('0xb')]));require(_0x4d93('0xd'))['register'](socket);function respondWithRpcPromise(_0x1fc864,_0x5472df,_0x27f640){return new BPromise(function(_0x4cae85,_0x48dd8d){return client[_0x4d93('0xe')](_0x1fc864,_0x27f640)[_0x4d93('0xf')](function(_0x443e64){logger['info'](_0x4d93('0x10'),_0x5472df,_0x4d93('0x11'));logger['debug'](_0x4d93('0x12'),_0x5472df,_0x4d93('0x11'),JSON[_0x4d93('0x13')](_0x443e64));if(_0x443e64[_0x4d93('0x14')]){if(_0x443e64[_0x4d93('0x14')][_0x4d93('0x15')]===0x1f4){logger[_0x4d93('0x14')](_0x4d93('0x10'),_0x5472df,_0x443e64['error']['message']);return _0x48dd8d(_0x443e64['error'][_0x4d93('0x16')]);}logger[_0x4d93('0x14')](_0x4d93('0x10'),_0x5472df,_0x443e64[_0x4d93('0x14')][_0x4d93('0x16')]);return _0x4cae85(_0x443e64[_0x4d93('0x14')][_0x4d93('0x16')]);}else{logger[_0x4d93('0x17')](_0x4d93('0x10'),_0x5472df,_0x4d93('0x11'));_0x4cae85(_0x443e64[_0x4d93('0x18')][_0x4d93('0x16')]);}})['catch'](function(_0x327708){logger['error'](_0x4d93('0x10'),_0x5472df,_0x327708);_0x48dd8d(_0x327708);});});}exports[_0x4d93('0x19')]=function(_0x5833a9){var _0x4f9a6b=this;return new Promise(function(_0x26af98,_0x518114){return db['UserVoiceQueueRt'][_0x4d93('0x1a')]({'raw':_0x5833a9[_0x4d93('0x1b')]?_0x5833a9[_0x4d93('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5833a9['options']?_0x5833a9['options'][_0x4d93('0x1c')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x4d93('0x1d')]['fn']('IF',db['sequelize'][_0x4d93('0x1e')](_0x4d93('0x1f')))),_0x4d93('0x20')]]})[_0x4d93('0xf')](function(_0x45498c){logger['info'](_0x4d93('0x19'),_0x5833a9);logger[_0x4d93('0x21')](_0x4d93('0x19'),_0x5833a9,JSON[_0x4d93('0x13')](_0x45498c));_0x26af98(_0x45498c);})[_0x4d93('0x22')](function(_0xb11e1c){logger[_0x4d93('0x14')](_0x4d93('0x19'),_0xb11e1c[_0x4d93('0x16')],_0x5833a9);_0x518114(_0x4f9a6b[_0x4d93('0x14')](0x1f4,_0xb11e1c[_0x4d93('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 6acda5b..ae14425 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 _0xa13d=['emit','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','remove','update'];(function(_0x5ecad8,_0x58f50d){var _0x34d992=function(_0x5833a8){while(--_0x5833a8){_0x5ecad8['push'](_0x5ecad8['shift']());}};_0x34d992(++_0x58f50d);}(_0xa13d,0x154));var _0xda13=function(_0x2b45c2,_0x288111){_0x2b45c2=_0x2b45c2-0x0;var _0x9cb440=_0xa13d[_0x2b45c2];return _0x9cb440;};'use strict';var UserVoiceQueueRtEvents=require(_0xda13('0x0'));var events=['save',_0xda13('0x1'),_0xda13('0x2')];function createListener(_0x558451,_0x3549a5){return function(_0x52c2c5){_0x3549a5[_0xda13('0x3')](_0x558451,_0x52c2c5);};}function removeListener(_0x208aa8,_0x56837b){return function(){UserVoiceQueueRtEvents['removeListener'](_0x208aa8,_0x56837b);};}exports[_0xda13('0x4')]=function(_0x3d5a0e){for(var _0x4df317=0x0,_0x48cd5f=events[_0xda13('0x5')];_0x4df317<_0x48cd5f;_0x4df317++){var _0x2584c5=events[_0x4df317];var _0x51fa1b=createListener(_0xda13('0x6')+_0x2584c5,_0x3d5a0e);UserVoiceQueueRtEvents['on'](_0x2584c5,_0x51fa1b);}}; \ No newline at end of file +var _0xc7a3=['remove','update','register','length','save'];(function(_0x47f0a2,_0x40a5fa){var _0x4a7796=function(_0x31c084){while(--_0x31c084){_0x47f0a2['push'](_0x47f0a2['shift']());}};_0x4a7796(++_0x40a5fa);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x1824f0,_0x450d1c){_0x1824f0=_0x1824f0-0x0;var _0x22df10=_0xc7a3[_0x1824f0];return _0x22df10;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x3c7a('0x0'),_0x3c7a('0x1'),_0x3c7a('0x2')];function createListener(_0x12f959,_0x283aed){return function(_0x2d6d97){_0x283aed['emit'](_0x12f959,_0x2d6d97);};}function removeListener(_0x44fd47,_0x3e1c47){return function(){UserVoiceQueueRtEvents['removeListener'](_0x44fd47,_0x3e1c47);};}exports[_0x3c7a('0x3')]=function(_0x2051ce){for(var _0x2736c1=0x0,_0x48e820=events[_0x3c7a('0x4')];_0x2736c1<_0x48e820;_0x2736c1++){var _0x4f0608=events[_0x2736c1];var _0x20d36c=createListener('userVoiceQueueRt:'+_0x4f0608,_0x2051ce);UserVoiceQueueRtEvents['on'](_0x4f0608,_0x20d36c);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 4709f06..33e6445 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2ff980,_0x1fb53f){var _0x40b81b=function(_0x2d6d5f){while(--_0x2d6d5f){_0x2ff980['push'](_0x2ff980['shift']());}};_0x40b81b(++_0x1fb53f);}(_0x70e0,0x17b));var _0x070e=function(_0x3c0c0b,_0x291f51){_0x3c0c0b=_0x3c0c0b-0x0;var _0x581a24=_0x70e0[_0x3c0c0b];return _0x581a24;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x29a40a,_0x234214){var _0x6182e9=function(_0x569d5d){while(--_0x569d5d){_0x29a40a['push'](_0x29a40a['shift']());}};_0x6182e9(++_0x234214);}(_0x9c44,0x178));var _0x49c4=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x9c44[_0x3d42d8];return _0x27fc41;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 1ea7691..4703c2d 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 _0x8ab6=['exports','INTEGER','sequelize'];(function(_0x4fdb79,_0x12c116){var _0x3ec15b=function(_0x50c82e){while(--_0x50c82e){_0x4fdb79['push'](_0x4fdb79['shift']());}};_0x3ec15b(++_0x12c116);}(_0x8ab6,0x8c));var _0x68ab=function(_0x253171,_0x400cb3){_0x253171=_0x253171-0x0;var _0x18f986=_0x8ab6[_0x253171];return _0x18f986;};'use strict';var Sequelize=require(_0x68ab('0x0'));module[_0x68ab('0x1')]={'penalty':{'type':Sequelize[_0x68ab('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xed4d=['sequelize','exports','INTEGER'];(function(_0x53ee62,_0x3d0cc3){var _0x263cd2=function(_0x2beb86){while(--_0x2beb86){_0x53ee62['push'](_0x53ee62['shift']());}};_0x263cd2(++_0x3d0cc3);}(_0xed4d,0x1d7));var _0xded4=function(_0x44e32c,_0x5d3739){_0x44e32c=_0x44e32c-0x0;var _0x26439a=_0xed4d[_0x44e32c];return _0x26439a;};'use strict';var Sequelize=require(_0xded4('0x0'));module[_0xded4('0x1')]={'penalty':{'type':Sequelize[_0xded4('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index bafe98e..62c5d5c 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 _0x82eb=['define','UserWhatsappQueue','user_has_whatsapp_queues','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x3fffe8,_0x235db8){var _0x54c53f=function(_0x5cca17){while(--_0x5cca17){_0x3fffe8['push'](_0x3fffe8['shift']());}};_0x54c53f(++_0x235db8);}(_0x82eb,0x19d));var _0xb82e=function(_0x2e017a,_0x3e6d1f){_0x2e017a=_0x2e017a-0x0;var _0x5c0656=_0x82eb[_0x2e017a];return _0x5c0656;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb82e('0x0'))('api');var moment=require(_0xb82e('0x1'));var BPromise=require(_0xb82e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb82e('0x3'));var rimraf=require(_0xb82e('0x4'));var config=require(_0xb82e('0x5'));var attributes=require('./userWhatsappQueue.attributes');module[_0xb82e('0x6')]=function(_0x4137fb,_0x5065ff){return _0x4137fb[_0xb82e('0x7')](_0xb82e('0x8'),attributes,{'tableName':_0xb82e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfbaa=['UserWhatsappQueue','util','../../config/logger','api','moment','path','rimraf','./userWhatsappQueue.attributes','exports','define'];(function(_0x2ea107,_0x321d46){var _0x4df250=function(_0x22cdea){while(--_0x22cdea){_0x2ea107['push'](_0x2ea107['shift']());}};_0x4df250(++_0x321d46);}(_0xfbaa,0xf1));var _0xafba=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0xfbaa[_0x432fca];return _0x3adba4;};'use strict';var _=require('lodash');var util=require(_0xafba('0x0'));var logger=require(_0xafba('0x1'))(_0xafba('0x2'));var moment=require(_0xafba('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xafba('0x4'));var rimraf=require(_0xafba('0x5'));var config=require('../../config/environment');var attributes=require(_0xafba('0x6'));module[_0xafba('0x7')]=function(_0x131e4c,_0x40344f){return _0x131e4c[_0xafba('0x8')](_0xafba('0x9'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 7a22832..1a8fec3 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 _0x57d9=['result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x230b69,_0x132ce5){var _0x3cf857=function(_0x32cd5c){while(--_0x32cd5c){_0x230b69['push'](_0x230b69['shift']());}};_0x3cf857(++_0x132ce5);}(_0x57d9,0x15b));var _0x957d=function(_0x37594c,_0x250938){_0x37594c=_0x37594c-0x0;var _0xc6c829=_0x57d9[_0x37594c];return _0xc6c829;};'use strict';var _=require('lodash');var util=require(_0x957d('0x0'));var moment=require(_0x957d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x957d('0x2'))['db'];var utils=require(_0x957d('0x3'));var logger=require(_0x957d('0x4'))(_0x957d('0x5'));var config=require(_0x957d('0x6'));var jayson=require(_0x957d('0x7'));var client=jayson[_0x957d('0x8')][_0x957d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb17481,_0x1d618e,_0x4af0cb){return new BPromise(function(_0x5328bb,_0x396ce9){return client[_0x957d('0xa')](_0xb17481,_0x4af0cb)[_0x957d('0xb')](function(_0x3d4d7b){logger[_0x957d('0xc')](_0x957d('0xd'),_0x1d618e,_0x957d('0xe'));logger[_0x957d('0xf')](_0x957d('0x10'),_0x1d618e,'request\x20sent',JSON[_0x957d('0x11')](_0x3d4d7b));if(_0x3d4d7b['error']){if(_0x3d4d7b[_0x957d('0x12')][_0x957d('0x13')]===0x1f4){logger[_0x957d('0x12')](_0x957d('0xd'),_0x1d618e,_0x3d4d7b[_0x957d('0x12')][_0x957d('0x14')]);return _0x396ce9(_0x3d4d7b[_0x957d('0x12')][_0x957d('0x14')]);}logger[_0x957d('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x1d618e,_0x3d4d7b[_0x957d('0x12')][_0x957d('0x14')]);return _0x5328bb(_0x3d4d7b['error'][_0x957d('0x14')]);}else{logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x1d618e,_0x957d('0xe'));_0x5328bb(_0x3d4d7b[_0x957d('0x15')][_0x957d('0x14')]);}})[_0x957d('0x16')](function(_0x32d92d){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x1d618e,_0x32d92d);_0x396ce9(_0x32d92d);});});} \ No newline at end of file +var _0x998c=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserWhatsappQueue,\x20%s,\x20%s','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','lodash','moment'];(function(_0xd620,_0x490bfb){var _0x3a9334=function(_0x35b55d){while(--_0x35b55d){_0xd620['push'](_0xd620['shift']());}};_0x3a9334(++_0x490bfb);}(_0x998c,0x148));var _0xc998=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0x998c[_0x581af1];return _0x54c22e;};'use strict';var _=require(_0xc998('0x0'));var util=require('util');var moment=require(_0xc998('0x1'));var BPromise=require('bluebird');var rs=require(_0xc998('0x2'));var fs=require('fs');var Redis=require(_0xc998('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc998('0x4'));var logger=require(_0xc998('0x5'))(_0xc998('0x6'));var config=require(_0xc998('0x7'));var jayson=require(_0xc998('0x8'));var client=jayson[_0xc998('0x9')][_0xc998('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52d643,_0x267def,_0x594d87){return new BPromise(function(_0x3f4961,_0x1c879f){return client[_0xc998('0xb')](_0x52d643,_0x594d87)[_0xc998('0xc')](function(_0x2ed731){logger['info'](_0xc998('0xd'),_0x267def,'request\x20sent');logger[_0xc998('0xe')](_0xc998('0xf'),_0x267def,_0xc998('0x10'),JSON[_0xc998('0x11')](_0x2ed731));if(_0x2ed731[_0xc998('0x12')]){if(_0x2ed731[_0xc998('0x12')]['code']===0x1f4){logger[_0xc998('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x267def,_0x2ed731[_0xc998('0x12')][_0xc998('0x13')]);return _0x1c879f(_0x2ed731['error'][_0xc998('0x13')]);}logger['error'](_0xc998('0xd'),_0x267def,_0x2ed731[_0xc998('0x12')][_0xc998('0x13')]);return _0x3f4961(_0x2ed731[_0xc998('0x12')][_0xc998('0x13')]);}else{logger[_0xc998('0x14')]('UserWhatsappQueue,\x20%s,\x20%s',_0x267def,_0xc998('0x10'));_0x3f4961(_0x2ed731['result']['message']);}})[_0xc998('0x15')](function(_0x290e7e){logger[_0xc998('0x12')](_0xc998('0xd'),_0x267def,_0x290e7e);_0x1c879f(_0x290e7e);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 7908740..f0ecd42 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 _0xf430=['index','get','show','post','create','/:id','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./variable.controller','isAuthenticated'];(function(_0x36b400,_0x277ec5){var _0x4d47bf=function(_0x55372b){while(--_0x55372b){_0x36b400['push'](_0x36b400['shift']());}};_0x4d47bf(++_0x277ec5);}(_0xf430,0x1e4));var _0x0f43=function(_0x136619,_0x31c9b2){_0x136619=_0x136619-0x0;var _0x38c4a5=_0xf430[_0x136619];return _0x38c4a5;};'use strict';var multer=require(_0x0f43('0x0'));var util=require(_0x0f43('0x1'));var path=require(_0x0f43('0x2'));var timeout=require('connect-timeout');var express=require(_0x0f43('0x3'));var router=express[_0x0f43('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0f43('0x5'));var config=require(_0x0f43('0x6'));var controller=require(_0x0f43('0x7'));router['get']('/',auth[_0x0f43('0x8')](),controller[_0x0f43('0x9')]);router[_0x0f43('0xa')]('/:id',auth[_0x0f43('0x8')](),controller[_0x0f43('0xb')]);router[_0x0f43('0xc')]('/',auth['isAuthenticated'](),controller[_0x0f43('0xd')]);router['put'](_0x0f43('0xe'),auth[_0x0f43('0x8')](),controller['update']);router['delete'](_0x0f43('0xe'),auth[_0x0f43('0x8')](),controller[_0x0f43('0xf')]);module[_0x0f43('0x10')]=router; \ No newline at end of file +var _0x032e=['show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id'];(function(_0xe8b20d,_0x573be3){var _0x251dab=function(_0x3c95dc){while(--_0x3c95dc){_0xe8b20d['push'](_0xe8b20d['shift']());}};_0x251dab(++_0x573be3);}(_0x032e,0x124));var _0xe032=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x032e[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0xe032('0x0'));var util=require('util');var path=require(_0xe032('0x1'));var timeout=require(_0xe032('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe032('0x3'));var auth=require(_0xe032('0x4'));var interaction=require(_0xe032('0x5'));var config=require(_0xe032('0x6'));var controller=require(_0xe032('0x7'));router[_0xe032('0x8')]('/',auth[_0xe032('0x9')](),controller[_0xe032('0xa')]);router[_0xe032('0x8')](_0xe032('0xb'),auth[_0xe032('0x9')](),controller[_0xe032('0xc')]);router[_0xe032('0xd')]('/',auth[_0xe032('0x9')](),controller[_0xe032('0xe')]);router[_0xe032('0xf')](_0xe032('0xb'),auth[_0xe032('0x9')](),controller['update']);router[_0xe032('0x10')](_0xe032('0xb'),auth[_0xe032('0x9')](),controller[_0xe032('0x11')]);module[_0xe032('0x12')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 648a169..9d8c5ab 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 _0x489a=['name','STRING','sequelize','exports'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x489a,0x66));var _0xa489=function(_0x170f9d,_0xba5fad){_0x170f9d=_0x170f9d-0x0;var _0x44d5f5=_0x489a[_0x170f9d];return _0x44d5f5;};'use strict';var Sequelize=require(_0xa489('0x0'));module[_0xa489('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa489('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa489('0x3')]}}; \ No newline at end of file +var _0x6882=['sequelize','exports','STRING'];(function(_0x1f1209,_0x4e09cd){var _0x5b3885=function(_0x596450){while(--_0x596450){_0x1f1209['push'](_0x1f1209['shift']());}};_0x5b3885(++_0x4e09cd);}(_0x6882,0x84));var _0x2688=function(_0x45df7e,_0x33f7e9){_0x45df7e=_0x45df7e-0x0;var _0x531f52=_0x6882[_0x45df7e];return _0x531f52;};'use strict';var Sequelize=require(_0x2688('0x0'));module[_0x2688('0x1')]={'name':{'type':Sequelize[_0x2688('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index a4605a3..89c1b58 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 _0xee5c=['findAll','catch','show','params','include','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','get','Variables','UserProfileResource','sendStatus','error','name','send','Variable','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','type','options','includeAll'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xee5c,0x141));var _0xcee5=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xee5c[_0x55f8b4];return _0x2475f9;};'use strict';var emlformat=require(_0xcee5('0x0'));var rimraf=require(_0xcee5('0x1'));var zipdir=require(_0xcee5('0x2'));var jsonpatch=require(_0xcee5('0x3'));var rp=require(_0xcee5('0x4'));var moment=require(_0xcee5('0x5'));var BPromise=require(_0xcee5('0x6'));var Mustache=require('mustache');var util=require(_0xcee5('0x7'));var path=require(_0xcee5('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcee5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xcee5('0xa'));var jsforce=require(_0xcee5('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcee5('0xc'));var Papa=require(_0xcee5('0xd'));var Redis=require(_0xcee5('0xe'));var authService=require(_0xcee5('0xf'));var qs=require(_0xcee5('0x10'));var as=require(_0xcee5('0x11'));var hardwareService=require(_0xcee5('0x12'));var logger=require(_0xcee5('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xcee5('0x14'));var licenseUtil=require(_0xcee5('0x15'));var db=require(_0xcee5('0x16'))['db'];function respondWithStatusCode(_0x23bb19,_0x228e6a){_0x228e6a=_0x228e6a||0xcc;return function(_0x5c3dde){if(_0x5c3dde){return _0x23bb19['sendStatus'](_0x228e6a);}return _0x23bb19['status'](_0x228e6a)[_0xcee5('0x17')]();};}function respondWithResult(_0x33e16f,_0x1d4301){_0x1d4301=_0x1d4301||0xc8;return function(_0x56d84b){if(_0x56d84b){return _0x33e16f[_0xcee5('0x18')](_0x1d4301)[_0xcee5('0x19')](_0x56d84b);}};}function respondWithFilteredResult(_0x276209,_0x3735be){return function(_0x4475a3){if(_0x4475a3){var _0x33377f=typeof _0x3735be[_0xcee5('0x1a')]===_0xcee5('0x1b')&&typeof _0x3735be[_0xcee5('0x1c')]===_0xcee5('0x1b');var _0xb091f7=_0x4475a3[_0xcee5('0x1d')];var _0x57ebe6=_0x33377f?0x0:_0x3735be[_0xcee5('0x1a')];var _0x24a9bf=_0x33377f?_0x4475a3['count']:_0x3735be[_0xcee5('0x1a')]+_0x3735be['limit'];var _0x3906b5;if(_0x24a9bf>=_0xb091f7){_0x24a9bf=_0xb091f7;_0x3906b5=0xc8;}else{_0x3906b5=0xce;}_0x276209[_0xcee5('0x18')](_0x3906b5);return _0x276209[_0xcee5('0x1e')](_0xcee5('0x1f'),_0x57ebe6+'-'+_0x24a9bf+'/'+_0xb091f7)[_0xcee5('0x19')](_0x4475a3);}return null;};}function patchUpdates(_0x503988){return function(_0x24f40d){try{jsonpatch[_0xcee5('0x20')](_0x24f40d,_0x503988,!![]);}catch(_0x4f32fb){return BPromise[_0xcee5('0x21')](_0x4f32fb);}return _0x24f40d[_0xcee5('0x22')]();};}function saveUpdates(_0x498ce3,_0x273fef){return function(_0x15609a){if(_0x15609a){return _0x15609a['update'](_0x498ce3)[_0xcee5('0x23')](function(_0x319bbc){return _0x319bbc;});}return null;};}function removeEntity(_0x13f670,_0x35ce9b){return function(_0x21d858){if(_0x21d858){return _0x21d858['destroy']()[_0xcee5('0x23')](function(){var _0x196b98=_0x21d858[_0xcee5('0x24')]({'plain':!![]});var _0x1ad3c8=_0xcee5('0x25');return db[_0xcee5('0x26')]['destroy']({'where':{'type':_0x1ad3c8,'resourceId':_0x196b98['id']}})[_0xcee5('0x23')](function(){return _0x21d858;});})['then'](function(){_0x13f670['status'](0xcc)[_0xcee5('0x17')]();});}};}function handleEntityNotFound(_0x1e0a45,_0x81041d){return function(_0x2b747c){if(!_0x2b747c){_0x1e0a45[_0xcee5('0x27')](0x194);}return _0x2b747c;};}function handleError(_0x1101bf,_0x20ddc4){_0x20ddc4=_0x20ddc4||0x1f4;return function(_0xacf0b0){logger[_0xcee5('0x28')](_0xacf0b0['stack']);if(_0xacf0b0[_0xcee5('0x29')]){delete _0xacf0b0[_0xcee5('0x29')];}_0x1101bf[_0xcee5('0x18')](_0x20ddc4)[_0xcee5('0x2a')](_0xacf0b0);};}exports['index']=function(_0x282983,_0x10cc1f){var _0x408b4a={},_0x44fbf1={},_0x26f5b5={'count':0x0,'rows':[]};var _0x2b789f=_['map'](db[_0xcee5('0x2b')][_0xcee5('0x2c')],function(_0x28762e){return{'name':_0x28762e['fieldName'],'type':_0x28762e['type'][_0xcee5('0x2d')]};});_0x44fbf1[_0xcee5('0x2e')]=_['map'](_0x2b789f,_0xcee5('0x29'));_0x44fbf1[_0xcee5('0x2f')]=_[_0xcee5('0x30')](_0x282983[_0xcee5('0x2f')]);_0x44fbf1[_0xcee5('0x31')]=_[_0xcee5('0x32')](_0x44fbf1[_0xcee5('0x2e')],_0x44fbf1[_0xcee5('0x2f')]);_0x408b4a[_0xcee5('0x33')]=_[_0xcee5('0x32')](_0x44fbf1['model'],qs['fields'](_0x282983['query'][_0xcee5('0x34')]));_0x408b4a[_0xcee5('0x33')]=_0x408b4a[_0xcee5('0x33')]['length']?_0x408b4a[_0xcee5('0x33')]:_0x44fbf1[_0xcee5('0x2e')];if(!_0x282983['query'][_0xcee5('0x35')](_0xcee5('0x36'))){_0x408b4a[_0xcee5('0x1c')]=qs[_0xcee5('0x1c')](_0x282983[_0xcee5('0x2f')]['limit']);_0x408b4a[_0xcee5('0x1a')]=qs[_0xcee5('0x1a')](_0x282983[_0xcee5('0x2f')][_0xcee5('0x1a')]);}_0x408b4a[_0xcee5('0x37')]=qs[_0xcee5('0x38')](_0x282983['query'][_0xcee5('0x38')]);_0x408b4a[_0xcee5('0x39')]=qs[_0xcee5('0x31')](_[_0xcee5('0x3a')](_0x282983['query'],_0x44fbf1[_0xcee5('0x31')]),_0x2b789f);if(_0x282983[_0xcee5('0x2f')][_0xcee5('0x3b')]){_0x408b4a['where']=_['merge'](_0x408b4a['where'],{'$or':_[_0xcee5('0x3c')](_0x2b789f,function(_0x43d556){if(_0x43d556[_0xcee5('0x3d')]!=='VIRTUAL'){var _0x2986ca={};_0x2986ca[_0x43d556[_0xcee5('0x29')]]={'$like':'%'+_0x282983[_0xcee5('0x2f')][_0xcee5('0x3b')]+'%'};return _0x2986ca;}})});}_0x408b4a=_['merge']({},_0x408b4a,_0x282983[_0xcee5('0x3e')]);var _0x11af0e={'where':_0x408b4a[_0xcee5('0x39')]};return db[_0xcee5('0x2b')][_0xcee5('0x1d')](_0x11af0e)[_0xcee5('0x23')](function(_0x3b414d){_0x26f5b5[_0xcee5('0x1d')]=_0x3b414d;if(_0x282983['query'][_0xcee5('0x3f')]){_0x408b4a['include']=[{'all':!![]}];}return db[_0xcee5('0x2b')][_0xcee5('0x40')](_0x408b4a);})[_0xcee5('0x23')](function(_0x3e4089){_0x26f5b5['rows']=_0x3e4089;return _0x26f5b5;})[_0xcee5('0x23')](respondWithFilteredResult(_0x10cc1f,_0x408b4a))[_0xcee5('0x41')](handleError(_0x10cc1f,null));};exports[_0xcee5('0x42')]=function(_0x1a7259,_0x2e52f9){var _0x768e48={'raw':!![],'where':{'id':_0x1a7259[_0xcee5('0x43')]['id']}},_0x5c86bf={};_0x5c86bf[_0xcee5('0x2e')]=_['keys'](db[_0xcee5('0x2b')]['rawAttributes']);_0x5c86bf['query']=_[_0xcee5('0x30')](_0x1a7259['query']);_0x5c86bf[_0xcee5('0x31')]=_[_0xcee5('0x32')](_0x5c86bf[_0xcee5('0x2e')],_0x5c86bf[_0xcee5('0x2f')]);_0x768e48[_0xcee5('0x33')]=_[_0xcee5('0x32')](_0x5c86bf[_0xcee5('0x2e')],qs['fields'](_0x1a7259[_0xcee5('0x2f')][_0xcee5('0x34')]));_0x768e48[_0xcee5('0x33')]=_0x768e48[_0xcee5('0x33')]['length']?_0x768e48[_0xcee5('0x33')]:_0x5c86bf[_0xcee5('0x2e')];if(_0x1a7259[_0xcee5('0x2f')][_0xcee5('0x3f')]){_0x768e48[_0xcee5('0x44')]=[{'all':!![]}];}_0x768e48=_[_0xcee5('0x45')]({},_0x768e48,_0x1a7259[_0xcee5('0x3e')]);return db[_0xcee5('0x2b')][_0xcee5('0x46')](_0x768e48)[_0xcee5('0x23')](handleEntityNotFound(_0x2e52f9,null))[_0xcee5('0x23')](respondWithResult(_0x2e52f9,null))[_0xcee5('0x41')](handleError(_0x2e52f9,null));};exports['create']=function(_0x180ac5,_0xd4afd2){return db[_0xcee5('0x2b')][_0xcee5('0x47')](_0x180ac5[_0xcee5('0x48')],{})[_0xcee5('0x23')](function(_0x40e13b){var _0x523410=_0x180ac5['user'][_0xcee5('0x24')]({'plain':!![]});if(!_0x523410)throw new Error(_0xcee5('0x49'));if(_0x523410['role']==='user'){var _0x5c3d10=_0x40e13b[_0xcee5('0x24')]({'plain':!![]});var _0x461001=_0xcee5('0x25');return db[_0xcee5('0x4a')][_0xcee5('0x46')]({'where':{'name':_0x461001,'userProfileId':_0x523410[_0xcee5('0x4b')]},'raw':!![]})[_0xcee5('0x23')](function(_0x5e125d){if(_0x5e125d&&_0x5e125d['autoAssociation']===0x0){return db[_0xcee5('0x26')][_0xcee5('0x47')]({'name':_0x5c3d10[_0xcee5('0x29')],'resourceId':_0x5c3d10['id'],'type':_0x5e125d['name'],'sectionId':_0x5e125d['id']},{})[_0xcee5('0x23')](function(){return _0x40e13b;});}else{return _0x40e13b;}})[_0xcee5('0x41')](function(_0x2a9ed5){logger[_0xcee5('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a9ed5);throw _0x2a9ed5;});}return _0x40e13b;})[_0xcee5('0x23')](respondWithResult(_0xd4afd2,0xc9))[_0xcee5('0x41')](handleError(_0xd4afd2,null));};exports['update']=function(_0x4039dc,_0x4500c2){if(_0x4039dc[_0xcee5('0x48')]['id']){delete _0x4039dc[_0xcee5('0x48')]['id'];}return db[_0xcee5('0x2b')]['find']({'where':{'id':_0x4039dc['params']['id']}})[_0xcee5('0x23')](handleEntityNotFound(_0x4500c2,null))['then'](saveUpdates(_0x4039dc['body'],null))['then'](respondWithResult(_0x4500c2,null))[_0xcee5('0x41')](handleError(_0x4500c2,null));};exports[_0xcee5('0x4c')]=function(_0x35264a,_0x50dd3a){return db['Variable']['find']({'where':{'id':_0x35264a[_0xcee5('0x43')]['id']}})[_0xcee5('0x23')](handleEntityNotFound(_0x50dd3a,null))[_0xcee5('0x23')](removeEntity(_0x50dd3a,null))[_0xcee5('0x41')](handleError(_0x50dd3a,null));}; \ No newline at end of file +var _0x3b3d=['sort','pick','filter','where','merge','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','zip-dir','request-promise','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','Content-Range','apply','reject','update','then','destroy','get','Variables','sendStatus','name','send','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','limit','order'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x3b3d,0x193));var _0xd3b3=function(_0x5380cd,_0x1ea634){_0x5380cd=_0x5380cd-0x0;var _0x25dd61=_0x3b3d[_0x5380cd];return _0x25dd61;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd3b3('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd3b3('0x1'));var moment=require('moment');var BPromise=require(_0xd3b3('0x2'));var Mustache=require('mustache');var util=require(_0xd3b3('0x3'));var path=require(_0xd3b3('0x4'));var sox=require('sox');var csv=require(_0xd3b3('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd3b3('0x6'));var _=require(_0xd3b3('0x7'));var squel=require(_0xd3b3('0x8'));var crypto=require(_0xd3b3('0x9'));var jsforce=require(_0xd3b3('0xa'));var deskjs=require(_0xd3b3('0xb'));var toCsv=require(_0xd3b3('0x5'));var querystring=require(_0xd3b3('0xc'));var Papa=require(_0xd3b3('0xd'));var Redis=require(_0xd3b3('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd3b3('0xf'));var logger=require(_0xd3b3('0x10'))(_0xd3b3('0x11'));var utils=require('../../config/utils');var config=require(_0xd3b3('0x12'));var licenseUtil=require(_0xd3b3('0x13'));var db=require(_0xd3b3('0x14'))['db'];function respondWithStatusCode(_0x128846,_0x505792){_0x505792=_0x505792||0xcc;return function(_0x46e921){if(_0x46e921){return _0x128846['sendStatus'](_0x505792);}return _0x128846[_0xd3b3('0x15')](_0x505792)[_0xd3b3('0x16')]();};}function respondWithResult(_0x3e4f82,_0x3686a2){_0x3686a2=_0x3686a2||0xc8;return function(_0x13f97f){if(_0x13f97f){return _0x3e4f82[_0xd3b3('0x15')](_0x3686a2)[_0xd3b3('0x17')](_0x13f97f);}};}function respondWithFilteredResult(_0xfde1f5,_0xf64513){return function(_0x2d421e){if(_0x2d421e){var _0x209d8b=typeof _0xf64513[_0xd3b3('0x18')]===_0xd3b3('0x19')&&typeof _0xf64513['limit']===_0xd3b3('0x19');var _0x1a6ba2=_0x2d421e['count'];var _0x5aa13b=_0x209d8b?0x0:_0xf64513[_0xd3b3('0x18')];var _0x483a98=_0x209d8b?_0x2d421e['count']:_0xf64513[_0xd3b3('0x18')]+_0xf64513['limit'];var _0x907c04;if(_0x483a98>=_0x1a6ba2){_0x483a98=_0x1a6ba2;_0x907c04=0xc8;}else{_0x907c04=0xce;}_0xfde1f5[_0xd3b3('0x15')](_0x907c04);return _0xfde1f5['set'](_0xd3b3('0x1a'),_0x5aa13b+'-'+_0x483a98+'/'+_0x1a6ba2)[_0xd3b3('0x17')](_0x2d421e);}return null;};}function patchUpdates(_0x514c6c){return function(_0x1ec153){try{jsonpatch[_0xd3b3('0x1b')](_0x1ec153,_0x514c6c,!![]);}catch(_0x4d4f27){return BPromise[_0xd3b3('0x1c')](_0x4d4f27);}return _0x1ec153['save']();};}function saveUpdates(_0x4792b7,_0x55a949){return function(_0x339467){if(_0x339467){return _0x339467[_0xd3b3('0x1d')](_0x4792b7)[_0xd3b3('0x1e')](function(_0x284569){return _0x284569;});}return null;};}function removeEntity(_0x3d3303,_0x40a855){return function(_0x49ab13){if(_0x49ab13){return _0x49ab13[_0xd3b3('0x1f')]()[_0xd3b3('0x1e')](function(){var _0x1831ca=_0x49ab13[_0xd3b3('0x20')]({'plain':!![]});var _0x4dbd7d=_0xd3b3('0x21');return db['UserProfileResource']['destroy']({'where':{'type':_0x4dbd7d,'resourceId':_0x1831ca['id']}})[_0xd3b3('0x1e')](function(){return _0x49ab13;});})['then'](function(){_0x3d3303['status'](0xcc)[_0xd3b3('0x16')]();});}};}function handleEntityNotFound(_0xfa7b39,_0x10c8dc){return function(_0x1bae5a){if(!_0x1bae5a){_0xfa7b39[_0xd3b3('0x22')](0x194);}return _0x1bae5a;};}function handleError(_0x121d1b,_0x22c306){_0x22c306=_0x22c306||0x1f4;return function(_0xe333f3){logger['error'](_0xe333f3['stack']);if(_0xe333f3['name']){delete _0xe333f3[_0xd3b3('0x23')];}_0x121d1b['status'](_0x22c306)[_0xd3b3('0x24')](_0xe333f3);};}exports['index']=function(_0x3bcbb9,_0x1c8fa1){var _0x5b86e8={},_0x33bb8e={},_0x1495fc={'count':0x0,'rows':[]};var _0x2d9deb=_[_0xd3b3('0x25')](db[_0xd3b3('0x26')][_0xd3b3('0x27')],function(_0x4ae116){return{'name':_0x4ae116[_0xd3b3('0x28')],'type':_0x4ae116[_0xd3b3('0x29')][_0xd3b3('0x2a')]};});_0x33bb8e[_0xd3b3('0x2b')]=_[_0xd3b3('0x25')](_0x2d9deb,_0xd3b3('0x23'));_0x33bb8e[_0xd3b3('0x2c')]=_[_0xd3b3('0x2d')](_0x3bcbb9[_0xd3b3('0x2c')]);_0x33bb8e[_0xd3b3('0x2e')]=_[_0xd3b3('0x2f')](_0x33bb8e[_0xd3b3('0x2b')],_0x33bb8e[_0xd3b3('0x2c')]);_0x5b86e8['attributes']=_[_0xd3b3('0x2f')](_0x33bb8e[_0xd3b3('0x2b')],qs[_0xd3b3('0x30')](_0x3bcbb9[_0xd3b3('0x2c')][_0xd3b3('0x30')]));_0x5b86e8[_0xd3b3('0x31')]=_0x5b86e8[_0xd3b3('0x31')][_0xd3b3('0x32')]?_0x5b86e8['attributes']:_0x33bb8e['model'];if(!_0x3bcbb9[_0xd3b3('0x2c')]['hasOwnProperty']('nolimit')){_0x5b86e8[_0xd3b3('0x33')]=qs[_0xd3b3('0x33')](_0x3bcbb9[_0xd3b3('0x2c')][_0xd3b3('0x33')]);_0x5b86e8['offset']=qs[_0xd3b3('0x18')](_0x3bcbb9[_0xd3b3('0x2c')]['offset']);}_0x5b86e8[_0xd3b3('0x34')]=qs[_0xd3b3('0x35')](_0x3bcbb9[_0xd3b3('0x2c')][_0xd3b3('0x35')]);_0x5b86e8['where']=qs['filters'](_[_0xd3b3('0x36')](_0x3bcbb9[_0xd3b3('0x2c')],_0x33bb8e['filters']),_0x2d9deb);if(_0x3bcbb9[_0xd3b3('0x2c')][_0xd3b3('0x37')]){_0x5b86e8[_0xd3b3('0x38')]=_[_0xd3b3('0x39')](_0x5b86e8['where'],{'$or':_[_0xd3b3('0x25')](_0x2d9deb,function(_0x413bb1){if(_0x413bb1[_0xd3b3('0x29')]!=='VIRTUAL'){var _0x432f1b={};_0x432f1b[_0x413bb1[_0xd3b3('0x23')]]={'$like':'%'+_0x3bcbb9[_0xd3b3('0x2c')]['filter']+'%'};return _0x432f1b;}})});}_0x5b86e8=_[_0xd3b3('0x39')]({},_0x5b86e8,_0x3bcbb9[_0xd3b3('0x3a')]);var _0x664d0a={'where':_0x5b86e8[_0xd3b3('0x38')]};return db['Variable'][_0xd3b3('0x3b')](_0x664d0a)[_0xd3b3('0x1e')](function(_0x4e1cb0){_0x1495fc[_0xd3b3('0x3b')]=_0x4e1cb0;if(_0x3bcbb9['query'][_0xd3b3('0x3c')]){_0x5b86e8[_0xd3b3('0x3d')]=[{'all':!![]}];}return db[_0xd3b3('0x26')][_0xd3b3('0x3e')](_0x5b86e8);})[_0xd3b3('0x1e')](function(_0x6f345d){_0x1495fc[_0xd3b3('0x3f')]=_0x6f345d;return _0x1495fc;})[_0xd3b3('0x1e')](respondWithFilteredResult(_0x1c8fa1,_0x5b86e8))[_0xd3b3('0x40')](handleError(_0x1c8fa1,null));};exports[_0xd3b3('0x41')]=function(_0x2e0d3f,_0x251222){var _0x512a21={'raw':!![],'where':{'id':_0x2e0d3f['params']['id']}},_0x35a64b={};_0x35a64b['model']=_[_0xd3b3('0x2d')](db[_0xd3b3('0x26')][_0xd3b3('0x27')]);_0x35a64b[_0xd3b3('0x2c')]=_[_0xd3b3('0x2d')](_0x2e0d3f['query']);_0x35a64b[_0xd3b3('0x2e')]=_[_0xd3b3('0x2f')](_0x35a64b[_0xd3b3('0x2b')],_0x35a64b[_0xd3b3('0x2c')]);_0x512a21[_0xd3b3('0x31')]=_['intersection'](_0x35a64b[_0xd3b3('0x2b')],qs[_0xd3b3('0x30')](_0x2e0d3f[_0xd3b3('0x2c')][_0xd3b3('0x30')]));_0x512a21[_0xd3b3('0x31')]=_0x512a21[_0xd3b3('0x31')][_0xd3b3('0x32')]?_0x512a21['attributes']:_0x35a64b[_0xd3b3('0x2b')];if(_0x2e0d3f[_0xd3b3('0x2c')][_0xd3b3('0x3c')]){_0x512a21[_0xd3b3('0x3d')]=[{'all':!![]}];}_0x512a21=_[_0xd3b3('0x39')]({},_0x512a21,_0x2e0d3f[_0xd3b3('0x3a')]);return db[_0xd3b3('0x26')][_0xd3b3('0x42')](_0x512a21)[_0xd3b3('0x1e')](handleEntityNotFound(_0x251222,null))[_0xd3b3('0x1e')](respondWithResult(_0x251222,null))[_0xd3b3('0x40')](handleError(_0x251222,null));};exports[_0xd3b3('0x43')]=function(_0x45d7cb,_0x2cbfc0){return db[_0xd3b3('0x26')]['create'](_0x45d7cb[_0xd3b3('0x44')],{})[_0xd3b3('0x1e')](function(_0x5567cc){var _0x406df2=_0x45d7cb[_0xd3b3('0x45')][_0xd3b3('0x20')]({'plain':!![]});if(!_0x406df2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x406df2[_0xd3b3('0x46')]===_0xd3b3('0x45')){var _0x47f841=_0x5567cc[_0xd3b3('0x20')]({'plain':!![]});var _0x150169=_0xd3b3('0x21');return db[_0xd3b3('0x47')][_0xd3b3('0x42')]({'where':{'name':_0x150169,'userProfileId':_0x406df2['userProfileId']},'raw':!![]})[_0xd3b3('0x1e')](function(_0x2ef65f){if(_0x2ef65f&&_0x2ef65f[_0xd3b3('0x48')]===0x0){return db[_0xd3b3('0x49')]['create']({'name':_0x47f841[_0xd3b3('0x23')],'resourceId':_0x47f841['id'],'type':_0x2ef65f[_0xd3b3('0x23')],'sectionId':_0x2ef65f['id']},{})[_0xd3b3('0x1e')](function(){return _0x5567cc;});}else{return _0x5567cc;}})[_0xd3b3('0x40')](function(_0x15d4a5){logger['error'](_0xd3b3('0x4a'),_0x15d4a5);throw _0x15d4a5;});}return _0x5567cc;})[_0xd3b3('0x1e')](respondWithResult(_0x2cbfc0,0xc9))[_0xd3b3('0x40')](handleError(_0x2cbfc0,null));};exports[_0xd3b3('0x1d')]=function(_0x2cb101,_0xc184df){if(_0x2cb101['body']['id']){delete _0x2cb101[_0xd3b3('0x44')]['id'];}return db[_0xd3b3('0x26')][_0xd3b3('0x42')]({'where':{'id':_0x2cb101[_0xd3b3('0x4b')]['id']}})[_0xd3b3('0x1e')](handleEntityNotFound(_0xc184df,null))[_0xd3b3('0x1e')](saveUpdates(_0x2cb101[_0xd3b3('0x44')],null))[_0xd3b3('0x1e')](respondWithResult(_0xc184df,null))['catch'](handleError(_0xc184df,null));};exports['destroy']=function(_0x149d23,_0x4c9b70){return db[_0xd3b3('0x26')]['find']({'where':{'id':_0x149d23[_0xd3b3('0x4b')]['id']}})[_0xd3b3('0x1e')](handleEntityNotFound(_0x4c9b70,null))['then'](removeEntity(_0x4c9b70,null))[_0xd3b3('0x40')](handleError(_0x4c9b70,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index e0317bc..81a020f 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 _0x75cc=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','lodash','util','api'];(function(_0x12d2d8,_0x120c41){var _0x3ea062=function(_0x51ee2a){while(--_0x51ee2a){_0x12d2d8['push'](_0x12d2d8['shift']());}};_0x3ea062(++_0x120c41);}(_0x75cc,0x142));var _0xc75c=function(_0x25e59d,_0x395d17){_0x25e59d=_0x25e59d-0x0;var _0x39d1f8=_0x75cc[_0x25e59d];return _0x39d1f8;};'use strict';var _=require(_0xc75c('0x0'));var util=require(_0xc75c('0x1'));var logger=require('../../config/logger')(_0xc75c('0x2'));var moment=require(_0xc75c('0x3'));var BPromise=require(_0xc75c('0x4'));var rp=require(_0xc75c('0x5'));var fs=require('fs');var path=require(_0xc75c('0x6'));var rimraf=require(_0xc75c('0x7'));var config=require(_0xc75c('0x8'));var attributes=require(_0xc75c('0x9'));module[_0xc75c('0xa')]=function(_0xc0c07e,_0x160d5e){return _0xc0c07e[_0xc75c('0xb')](_0xc75c('0xc'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf953=['../../config/environment','define','Variable','tools_variables','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x4f6e9f,_0x2b58ca){var _0x4a32c9=function(_0x1848ec){while(--_0x1848ec){_0x4f6e9f['push'](_0x4f6e9f['shift']());}};_0x4a32c9(++_0x2b58ca);}(_0xf953,0x93));var _0x3f95=function(_0x24817a,_0x1feb0e){_0x24817a=_0x24817a-0x0;var _0x351959=_0xf953[_0x24817a];return _0x351959;};'use strict';var _=require(_0x3f95('0x0'));var util=require(_0x3f95('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3f95('0x2'));var BPromise=require(_0x3f95('0x3'));var rp=require(_0x3f95('0x4'));var fs=require('fs');var path=require(_0x3f95('0x5'));var rimraf=require(_0x3f95('0x6'));var config=require(_0x3f95('0x7'));var attributes=require('./variable.attributes');module['exports']=function(_0x581ff2,_0x115b0f){return _0x581ff2[_0x3f95('0x8')](_0x3f95('0x9'),attributes,{'tableName':_0x3f95('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 87b3279..48c4029 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fbe=['stringify','error','code','message','result','catch','Variable','find','options','where','attributes','include','map','model','info','ShowVariable','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x554598,_0x6800a2){var _0x45e778=function(_0x2df20c){while(--_0x2df20c){_0x554598['push'](_0x554598['shift']());}};_0x45e778(++_0x6800a2);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0xe05ae6,_0x2b82a7){_0xe05ae6=_0xe05ae6-0x0;var _0x4f3030=_0x7fbe[_0xe05ae6];return _0x4f3030;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});}exports['ShowVariable']=function(_0x293a47){var _0x546463=this;return new Promise(function(_0x1e77fd,_0x4708f7){return db[_0xe7fb('0x18')][_0xe7fb('0x19')]({'raw':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x293a47[_0xe7fb('0x1a')]?_0x293a47['options'][_0xe7fb('0x1b')]||null:null,'attributes':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1c')]||null:null,'include':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1d')]?_[_0xe7fb('0x1e')](_0x293a47['options'][_0xe7fb('0x1d')],function(_0x469ead){return{'model':db[_0x469ead['model']],'as':_0x469ead['as'],'attributes':_0x469ead['attributes'],'include':_0x469ead['include']?_[_0xe7fb('0x1e')](_0x469ead['include'],function(_0x49b219){return{'model':db[_0x49b219[_0xe7fb('0x1f')]],'as':_0x49b219['as'],'attributes':_0x49b219[_0xe7fb('0x1c')],'include':_0x49b219[_0xe7fb('0x1d')]?_['map'](_0x49b219[_0xe7fb('0x1d')],function(_0x2b69c4){return{'model':db[_0x2b69c4[_0xe7fb('0x1f')]],'as':_0x2b69c4['as'],'attributes':_0x2b69c4[_0xe7fb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe7fb('0xd')](function(_0x16237a){logger[_0xe7fb('0x20')]('ShowVariable',_0x293a47);logger['debug'](_0xe7fb('0x21'),_0x293a47,JSON[_0xe7fb('0x12')](_0x16237a));_0x1e77fd(_0x16237a);})[_0xe7fb('0x17')](function(_0x4fd290){logger[_0xe7fb('0x13')](_0xe7fb('0x21'),_0x4fd290[_0xe7fb('0x15')],_0x293a47);_0x4708f7(_0x546463[_0xe7fb('0x13')](0x1f4,_0x4fd290[_0xe7fb('0x15')]));});});}; \ No newline at end of file +var _0x7217=['where','attributes','map','include','model','ShowVariable','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Variable','find','options','raw'];(function(_0x1ca4b2,_0x1b8ae2){var _0x144a12=function(_0x492753){while(--_0x492753){_0x1ca4b2['push'](_0x1ca4b2['shift']());}};_0x144a12(++_0x1b8ae2);}(_0x7217,0x19e));var _0x7721=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x7217[_0x36dfbd];return _0x4ecad9;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Variable,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Variable,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['ShowVariable']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowVariable',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 817a801..6d5e519 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 _0x7707=['/fetch','isAuthenticated','canUpdate','reset','/pull','pull','restart','/migrations','exports','express','Router','./version.controller','get'];(function(_0x51aa71,_0xc902d6){var _0x2a4426=function(_0x32c3bc){while(--_0x32c3bc){_0x51aa71['push'](_0x51aa71['shift']());}};_0x2a4426(++_0xc902d6);}(_0x7707,0x1dd));var _0x7770=function(_0x5142a9,_0xe1bb99){_0x5142a9=_0x5142a9-0x0;var _0x3139c8=_0x7707[_0x5142a9];return _0x3139c8;};'use strict';var express=require(_0x7770('0x0'));var router=express[_0x7770('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x7770('0x2'));router[_0x7770('0x3')]('/',controller['index']);router[_0x7770('0x3')](_0x7770('0x4'),auth[_0x7770('0x5')](),auth['canUpdate'](),controller['fetch']);router[_0x7770('0x3')]('/reset',auth[_0x7770('0x5')](),auth[_0x7770('0x6')](),controller[_0x7770('0x7')]);router[_0x7770('0x3')](_0x7770('0x8'),auth[_0x7770('0x5')](),auth[_0x7770('0x6')](),controller[_0x7770('0x9')]);router[_0x7770('0x3')]('/restart',auth[_0x7770('0x5')](),controller[_0x7770('0xa')]);router[_0x7770('0x3')](_0x7770('0xb'),controller['migrations']);module[_0x7770('0xc')]=router; \ No newline at end of file +var _0x788f=['./version.controller','get','isAuthenticated','canUpdate','/reset','reset','/pull','pull','/restart','restart','/migrations','migrations','express','../../components/auth/service'];(function(_0x4a85bc,_0x4b391c){var _0x3a87ee=function(_0x2c2d45){while(--_0x2c2d45){_0x4a85bc['push'](_0x4a85bc['shift']());}};_0x3a87ee(++_0x4b391c);}(_0x788f,0x1da));var _0xf788=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x788f[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xf788('0x0'));var router=express['Router']();var auth=require(_0xf788('0x1'));var controller=require(_0xf788('0x2'));router[_0xf788('0x3')]('/',controller['index']);router[_0xf788('0x3')]('/fetch',auth[_0xf788('0x4')](),auth[_0xf788('0x5')](),controller['fetch']);router[_0xf788('0x3')](_0xf788('0x6'),auth[_0xf788('0x4')](),auth[_0xf788('0x5')](),controller[_0xf788('0x7')]);router['get'](_0xf788('0x8'),auth[_0xf788('0x4')](),auth['canUpdate'](),controller[_0xf788('0x9')]);router[_0xf788('0x3')](_0xf788('0xa'),auth[_0xf788('0x4')](),controller[_0xf788('0xb')]);router[_0xf788('0x3')](_0xf788('0xc'),controller[_0xf788('0xd')]);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 b8fe502..4a58e05 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 _0x945b=['motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','server','length','replace','push','sort','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','catch','UniqueConstraintError','umzug','path','lodash','pkginfo','version','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','root','exports','query','latest','fetch','tags','status','json','origin','master','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'];(function(_0x653f35,_0x5476fd){var _0x506f37=function(_0x4a6a21){while(--_0x4a6a21){_0x653f35['push'](_0x653f35['shift']());}};_0x506f37(++_0x5476fd);}(_0x945b,0x123));var _0xb945=function(_0x40c039,_0x1d02b1){_0x40c039=_0x40c039-0x0;var _0x26254b=_0x945b[_0x40c039];return _0x26254b;};'use strict';var Umzug=require(_0xb945('0x0'));var path=require(_0xb945('0x1'));var fs=require('fs');var _=require(_0xb945('0x2'));var pkginfo=require(_0xb945('0x3'))(module,_0xb945('0x4'));var compareVersions=require('compare-versions');var exec=require(_0xb945('0x5'))[_0xb945('0x6')];var db=require(_0xb945('0x7'))['db'];var config=require(_0xb945('0x8'));var pm2=require(_0xb945('0x9'));var logger=require(_0xb945('0xa'))(_0xb945('0xb'));var git=require('simple-git')(config[_0xb945('0xc')]);exports['index']=function(_0x1919d3,_0x3c689f){var _0x1362b2={'current':module[_0xb945('0xd')]['version'],'phonebar':0x2};if(_0x1919d3[_0xb945('0xe')]&&_0x1919d3['query'][_0xb945('0xf')]){return git[_0xb945('0x10')]()[_0xb945('0x11')](function(_0x1cd4bb,_0x4d53f9){_0x1362b2[_0xb945('0xf')]=(_0x1cd4bb?module[_0xb945('0xd')]['version']:_0x4d53f9[_0xb945('0xf')])||'2.0.0';return _0x3c689f[_0xb945('0x12')](0xc8)[_0xb945('0x13')](_0x1362b2);});}else{return _0x3c689f['status'](0xc8)[_0xb945('0x13')](_0x1362b2);}};exports[_0xb945('0x10')]=function(_0xb0d640,_0x2a3b43){return git[_0xb945('0x10')]([_0xb945('0x14'),_0xb945('0x15')],function(_0x1642fd){if(_0x1642fd){logger[_0xb945('0x16')](_0x1642fd);return _0x2a3b43[_0xb945('0x12')](0x1f4)[_0xb945('0x13')](_0x1642fd);}logger[_0xb945('0x17')](_0xb945('0x18'));return _0x2a3b43[_0xb945('0x12')](0xc8)[_0xb945('0x13')]({'output':_0xb945('0x19')});});};exports[_0xb945('0x1a')]=function(_0x1d707d,_0x1cd2e5){return git[_0xb945('0x1a')]([_0xb945('0x1b'),_0xb945('0x1c')],function(_0x562ea1){if(_0x562ea1){logger['error'](_0x562ea1);return _0x1cd2e5['status'](0x1f4)[_0xb945('0x13')](_0x562ea1);}logger[_0xb945('0x17')](_0xb945('0x1d'));return _0x1cd2e5[_0xb945('0x12')](0xc8)[_0xb945('0x13')]({'output':_0xb945('0x1e')});});};exports['pull']=function(_0x2faed2,_0x433536){exec(_0xb945('0x1f'),function(_0x5c7d16,_0x333510,_0x254bfb){logger[_0xb945('0x17')](_0x333510);logger['info'](_0x254bfb);if(_0x5c7d16){logger[_0xb945('0x16')](_0x5c7d16);return _0x433536[_0xb945('0x12')](0x1f4)[_0xb945('0x13')](_0x5c7d16);}return _0x433536[_0xb945('0x12')](0xc8)[_0xb945('0x13')]({'output':_0x333510});});};exports['restart']=function(_0x1a3dfc,_0x303fdf){return pm2[_0xb945('0x20')](_0xb945('0x21'))[_0xb945('0x22')](function(_0x4a732f){logger[_0xb945('0x17')]('pm2\x20restart\x20motion\x20%s',_0x4a732f);return _0x303fdf['status'](0xc8)[_0xb945('0x13')]({'output':_0xb945('0x23')});})['catch'](function(_0x7e2666){logger[_0xb945('0x16')](_0x7e2666);return _0x303fdf[_0xb945('0x12')](0x1f4)[_0xb945('0x13')](_0x7e2666);});};exports[_0xb945('0x24')]=function(_0x4bf53e,_0x4ccad8){var _0x550d79=fs['readdirSync'](path['join'](config[_0xb945('0xc')],_0xb945('0x25'),_0xb945('0x24')));var _0x5a9df8=[];for(var _0x4ec1ee=0x0;_0x4ec1ee<_0x550d79[_0xb945('0x26')];_0x4ec1ee++){var _0x410ee5=_0x550d79[_0x4ec1ee][_0xb945('0x27')]('.js','');if(compareVersions(module[_0xb945('0xd')][_0xb945('0x4')],_0x410ee5)===-0x1){_0x5a9df8[_0xb945('0x28')](_0x410ee5);}}if(_0x5a9df8['length']){var _0x6dc898=_0x5a9df8[_0xb945('0x29')](compareVersions);var _0x6ab927=new Umzug({'storage':_0xb945('0x2a'),'storageOptions':{'model':db[_0xb945('0x2b')],'modelName':_0xb945('0x2b'),'columnName':_0xb945('0x4')},'migrations':{'params':[db[_0xb945('0x2a')][_0xb945('0x2c')](),db[_0xb945('0x2a')]['constructor'],function(){throw new Error(_0xb945('0x2d'));}],'path':path[_0xb945('0x2e')](config['root'],_0xb945('0x25'),'migrations'),'pattern':/\.js$/}});_0x6ab927['up']({'migrations':_[_0xb945('0x2f')](_0x6dc898,function(_0x4b9e61){return _0x4b9e61+_0xb945('0x30');})})[_0xb945('0x22')](function(){return _0x4ccad8[_0xb945('0x12')](0xc8)[_0xb945('0x13')]({'output':_0xb945('0x31')+module['exports'][_0xb945('0x4')]+_0xb945('0x32')+_[_0xb945('0x33')](_0x6dc898),'migrations':_[_0xb945('0x2e')](_0x6dc898)});})[_0xb945('0x34')](function(_0x6e0649){if(_0x6e0649 instanceof db[_0xb945('0x2a')][_0xb945('0x35')]){return _0x4ccad8['status'](0xc8)[_0xb945('0x13')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x4ccad8[_0xb945('0x12')](0x1f4)[_0xb945('0x13')](_0x6e0649);}});}else{return _0x4ccad8[_0xb945('0x12')](0xc8)[_0xb945('0x13')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x8b49=['index','exports','query','latest','2.0.0','status','json','fetch','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','join','replace','.js','push','sort','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.','server','map','Database\x20migrated\x20successfully\x20from\x20version\x20','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../config/pm2','../../config/logger','update','root'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8b49,0x99));var _0x98b4=function(_0x36f5b7,_0x1514ca){_0x36f5b7=_0x36f5b7-0x0;var _0x495dfb=_0x8b49[_0x36f5b7];return _0x495dfb;};'use strict';var Umzug=require(_0x98b4('0x0'));var path=require(_0x98b4('0x1'));var fs=require('fs');var _=require(_0x98b4('0x2'));var pkginfo=require(_0x98b4('0x3'))(module,_0x98b4('0x4'));var compareVersions=require(_0x98b4('0x5'));var exec=require(_0x98b4('0x6'))[_0x98b4('0x7')];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require(_0x98b4('0x8'));var logger=require(_0x98b4('0x9'))(_0x98b4('0xa'));var git=require('simple-git')(config[_0x98b4('0xb')]);exports[_0x98b4('0xc')]=function(_0x435e16,_0x112027){var _0x54436e={'current':module[_0x98b4('0xd')][_0x98b4('0x4')],'phonebar':0x2};if(_0x435e16[_0x98b4('0xe')]&&_0x435e16['query']['latest']){return git['fetch']()['tags'](function(_0x2b84a1,_0x3d6dd1){_0x54436e[_0x98b4('0xf')]=(_0x2b84a1?module['exports'][_0x98b4('0x4')]:_0x3d6dd1[_0x98b4('0xf')])||_0x98b4('0x10');return _0x112027[_0x98b4('0x11')](0xc8)[_0x98b4('0x12')](_0x54436e);});}else{return _0x112027[_0x98b4('0x11')](0xc8)[_0x98b4('0x12')](_0x54436e);}};exports[_0x98b4('0x13')]=function(_0x9da8fd,_0x3819e5){return git['fetch']([_0x98b4('0x14'),_0x98b4('0x15')],function(_0x286220){if(_0x286220){logger[_0x98b4('0x16')](_0x286220);return _0x3819e5[_0x98b4('0x11')](0x1f4)[_0x98b4('0x12')](_0x286220);}logger[_0x98b4('0x17')](_0x98b4('0x18'));return _0x3819e5['status'](0xc8)[_0x98b4('0x12')]({'output':_0x98b4('0x19')});});};exports[_0x98b4('0x1a')]=function(_0x15f12c,_0x4aa0e6){return git[_0x98b4('0x1a')](['--hard',_0x98b4('0x1b')],function(_0x1d9c0a){if(_0x1d9c0a){logger[_0x98b4('0x16')](_0x1d9c0a);return _0x4aa0e6[_0x98b4('0x11')](0x1f4)[_0x98b4('0x12')](_0x1d9c0a);}logger[_0x98b4('0x17')](_0x98b4('0x1c'));return _0x4aa0e6['status'](0xc8)[_0x98b4('0x12')]({'output':_0x98b4('0x1d')});});};exports[_0x98b4('0x1e')]=function(_0x5d8b0d,_0x200472){exec('npm\x20install\x20--production',function(_0x80ecc7,_0x4e6480,_0x288483){logger[_0x98b4('0x17')](_0x4e6480);logger[_0x98b4('0x17')](_0x288483);if(_0x80ecc7){logger[_0x98b4('0x16')](_0x80ecc7);return _0x200472['status'](0x1f4)[_0x98b4('0x12')](_0x80ecc7);}return _0x200472[_0x98b4('0x11')](0xc8)[_0x98b4('0x12')]({'output':_0x4e6480});});};exports[_0x98b4('0x1f')]=function(_0x1448e7,_0xc5402a){return pm2['restart'](_0x98b4('0x20'))[_0x98b4('0x21')](function(_0x3c9f4e){logger['info'](_0x98b4('0x22'),_0x3c9f4e);return _0xc5402a[_0x98b4('0x11')](0xc8)[_0x98b4('0x12')]({'output':_0x98b4('0x23')});})['catch'](function(_0x3462b8){logger[_0x98b4('0x16')](_0x3462b8);return _0xc5402a['status'](0x1f4)[_0x98b4('0x12')](_0x3462b8);});};exports[_0x98b4('0x24')]=function(_0x447911,_0x5a785d){var _0x8da2c3=fs[_0x98b4('0x25')](path[_0x98b4('0x26')](config[_0x98b4('0xb')],'server','migrations'));var _0x1b8242=[];for(var _0x2c110c=0x0;_0x2c110c<_0x8da2c3['length'];_0x2c110c++){var _0x1566a3=_0x8da2c3[_0x2c110c][_0x98b4('0x27')](_0x98b4('0x28'),'');if(compareVersions(module[_0x98b4('0xd')][_0x98b4('0x4')],_0x1566a3)===-0x1){_0x1b8242[_0x98b4('0x29')](_0x1566a3);}}if(_0x1b8242['length']){var _0x5b0665=_0x1b8242[_0x98b4('0x2a')](compareVersions);var _0x4e53ed=new Umzug({'storage':_0x98b4('0x2b'),'storageOptions':{'model':db[_0x98b4('0x2c')],'modelName':_0x98b4('0x2c'),'columnName':'version'},'migrations':{'params':[db[_0x98b4('0x2b')][_0x98b4('0x2d')](),db[_0x98b4('0x2b')][_0x98b4('0x2e')],function(){throw new Error(_0x98b4('0x2f'));}],'path':path['join'](config[_0x98b4('0xb')],_0x98b4('0x30'),'migrations'),'pattern':/\.js$/}});_0x4e53ed['up']({'migrations':_[_0x98b4('0x31')](_0x5b0665,function(_0x1ca756){return _0x1ca756+_0x98b4('0x28');})})['then'](function(){return _0x5a785d[_0x98b4('0x11')](0xc8)[_0x98b4('0x12')]({'output':_0x98b4('0x32')+module[_0x98b4('0xd')][_0x98b4('0x4')]+'\x20to\x20'+_[_0x98b4('0x33')](_0x5b0665),'migrations':_['join'](_0x5b0665)});})[_0x98b4('0x34')](function(_0x373705){if(_0x373705 instanceof db[_0x98b4('0x2b')][_0x98b4('0x35')]){return _0x5a785d[_0x98b4('0x11')](0xc8)[_0x98b4('0x12')]({'output':_0x98b4('0x36')});}else{return _0x5a785d[_0x98b4('0x11')](0x1f4)[_0x98b4('0x12')](_0x373705);}});}else{return _0x5a785d[_0x98b4('0x11')](0xc8)[_0x98b4('0x12')]({'output':_0x98b4('0x36')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 6ef15fb..72c7c17 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 _0x1890=['/:id','show','post','create','put','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','isAuthenticated','index','get','/describe'];(function(_0x47fb4b,_0xb02631){var _0x3c5187=function(_0x40edd4){while(--_0x40edd4){_0x47fb4b['push'](_0x47fb4b['shift']());}};_0x3c5187(++_0xb02631);}(_0x1890,0x1e2));var _0x0189=function(_0x21e41d,_0x24f03f){_0x21e41d=_0x21e41d-0x0;var _0x406b0c=_0x1890[_0x21e41d];return _0x406b0c;};'use strict';var multer=require(_0x0189('0x0'));var util=require('util');var path=require(_0x0189('0x1'));var timeout=require(_0x0189('0x2'));var express=require(_0x0189('0x3'));var router=express['Router']();var fs_extra=require(_0x0189('0x4'));var auth=require(_0x0189('0x5'));var interaction=require(_0x0189('0x6'));var config=require('../../config/environment');var controller=require(_0x0189('0x7'));router['get']('/',auth[_0x0189('0x8')](),controller[_0x0189('0x9')]);router[_0x0189('0xa')](_0x0189('0xb'),auth[_0x0189('0x8')](),controller['describe']);router['get'](_0x0189('0xc'),auth[_0x0189('0x8')](),controller[_0x0189('0xd')]);router[_0x0189('0xe')]('/',auth[_0x0189('0x8')](),controller[_0x0189('0xf')]);router[_0x0189('0x10')](_0x0189('0xc'),auth[_0x0189('0x8')](),controller['update']);router[_0x0189('0x11')](_0x0189('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x0189('0x12')]=router; \ No newline at end of file +var _0x7154=['index','get','/describe','describe','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','isAuthenticated'];(function(_0x6ce17e,_0x45b397){var _0xd0b507=function(_0x4e77d6){while(--_0x4e77d6){_0x6ce17e['push'](_0x6ce17e['shift']());}};_0xd0b507(++_0x45b397);}(_0x7154,0x102));var _0x4715=function(_0x4c1ec2,_0x4f42b7){_0x4c1ec2=_0x4c1ec2-0x0;var _0x3f6f1c=_0x7154[_0x4c1ec2];return _0x3f6f1c;};'use strict';var multer=require(_0x4715('0x0'));var util=require(_0x4715('0x1'));var path=require(_0x4715('0x2'));var timeout=require(_0x4715('0x3'));var express=require(_0x4715('0x4'));var router=express['Router']();var fs_extra=require(_0x4715('0x5'));var auth=require(_0x4715('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router['get']('/',auth[_0x4715('0x7')](),controller[_0x4715('0x8')]);router[_0x4715('0x9')](_0x4715('0xa'),auth[_0x4715('0x7')](),controller[_0x4715('0xb')]);router['get']('/:id',auth[_0x4715('0x7')](),controller['show']);router[_0x4715('0xc')]('/',auth[_0x4715('0x7')](),controller[_0x4715('0xd')]);router[_0x4715('0xe')](_0x4715('0xf'),auth[_0x4715('0x7')](),controller[_0x4715('0x10')]);router[_0x4715('0x11')](_0x4715('0xf'),auth[_0x4715('0x7')](),controller[_0x4715('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 2b9935b..dbad4a0 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 _0xd4f4=['exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xd4f4,0x8b));var _0x4d4f=function(_0xe342b4,_0x11bb80){_0xe342b4=_0xe342b4-0x0;var _0x172a5f=_0xd4f4[_0xe342b4];return _0x172a5f;};'use strict';var Sequelize=require(_0x4d4f('0x0'));module[_0x4d4f('0x1')]={'type':{'type':Sequelize[_0x4d4f('0x2')]},'uniqueid':{'type':Sequelize[_0x4d4f('0x2')]},'calleridnum':{'type':Sequelize[_0x4d4f('0x2')]},'calleridname':{'type':Sequelize[_0x4d4f('0x2')]},'queue':{'type':Sequelize[_0x4d4f('0x2')]},'interface':{'type':Sequelize[_0x4d4f('0x2')]},'membername':{'type':Sequelize[_0x4d4f('0x2')]},'agentcalledAt':{'type':Sequelize[_0x4d4f('0x3')]},'agentconnectAt':{'type':Sequelize[_0x4d4f('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x4d4f('0x4')]},'agentcomplete':{'type':Sequelize[_0x4d4f('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x4d4f('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x4d4f('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x4d4f('0x4')]},'agentacw':{'type':Sequelize[_0x4d4f('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4d4f('0x4')]},'reason':{'type':Sequelize[_0x4d4f('0x2')]},'lastevent':{'type':Sequelize[_0x4d4f('0x2')]},'channel':{'type':Sequelize[_0x4d4f('0x2')]},'channelstate':{'type':Sequelize[_0x4d4f('0x4')]},'channelstatedesc':{'type':Sequelize[_0x4d4f('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4d4f('0x2')]},'connectedlinename':{'type':Sequelize[_0x4d4f('0x2')]},'language':{'type':Sequelize[_0x4d4f('0x2')]},'accountcode':{'type':Sequelize[_0x4d4f('0x2')]},'context':{'type':Sequelize[_0x4d4f('0x2')]},'exten':{'type':Sequelize[_0x4d4f('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x4d4f('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4d4f('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x4d4f('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x4d4f('0x2')]},'destlanguage':{'type':Sequelize[_0x4d4f('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x4d4f('0x2')]},'destexten':{'type':Sequelize[_0x4d4f('0x2')]},'destpriority':{'type':Sequelize[_0x4d4f('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x4d4f('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x4d4f('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4d4f('0x2')],'comment':_0x4d4f('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x4d4f('0x2')]},'agententerreason':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9fc=['INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x5c3a7,_0x888c30){var _0x5d5f17=function(_0x1c4a57){while(--_0x1c4a57){_0x5c3a7['push'](_0x5c3a7['shift']());}};_0x5d5f17(++_0x888c30);}(_0xa9fc,0x19f));var _0xca9f=function(_0xa79977,_0x4f7f12){_0xa79977=_0xa79977-0x0;var _0x109f10=_0xa9fc[_0xa79977];return _0x109f10;};'use strict';var Sequelize=require(_0xca9f('0x0'));module[_0xca9f('0x1')]={'type':{'type':Sequelize[_0xca9f('0x2')]},'uniqueid':{'type':Sequelize[_0xca9f('0x2')]},'calleridnum':{'type':Sequelize[_0xca9f('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xca9f('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xca9f('0x2')]},'agentcalledAt':{'type':Sequelize[_0xca9f('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0xca9f('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xca9f('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xca9f('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xca9f('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xca9f('0x5')]},'agentacw':{'type':Sequelize[_0xca9f('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xca9f('0x5')]},'reason':{'type':Sequelize[_0xca9f('0x2')]},'lastevent':{'type':Sequelize[_0xca9f('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xca9f('0x5')]},'channelstatedesc':{'type':Sequelize[_0xca9f('0x2')]},'connectedlinenum':{'type':Sequelize[_0xca9f('0x2')]},'connectedlinename':{'type':Sequelize[_0xca9f('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xca9f('0x2')]},'context':{'type':Sequelize[_0xca9f('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xca9f('0x2')]},'destchannel':{'type':Sequelize[_0xca9f('0x2')]},'destchannelstate':{'type':Sequelize[_0xca9f('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0xca9f('0x2')]},'destcalleridnum':{'type':Sequelize[_0xca9f('0x2')]},'destcalleridname':{'type':Sequelize[_0xca9f('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xca9f('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xca9f('0x2')]},'destlanguage':{'type':Sequelize[_0xca9f('0x2')]},'destaccountcode':{'type':Sequelize[_0xca9f('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xca9f('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0xca9f('0x2')]},'transfer':{'type':Sequelize[_0xca9f('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xca9f('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xca9f('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index de8483a..e1ff37e 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(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_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(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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 5564f02..67403c1 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 _0xeb5d=['../../config/logger','api','moment','path','rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','util'];(function(_0x4b657e,_0x379f1e){var _0x5032=function(_0x200e6a){while(--_0x200e6a){_0x4b657e['push'](_0x4b657e['shift']());}};_0x5032(++_0x379f1e);}(_0xeb5d,0x16b));var _0xdeb5=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xeb5d[_0x27af45];return _0x18df21;};'use strict';var _=require('lodash');var util=require(_0xdeb5('0x0'));var logger=require(_0xdeb5('0x1'))(_0xdeb5('0x2'));var moment=require(_0xdeb5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdeb5('0x4'));var rimraf=require(_0xdeb5('0x5'));var config=require('../../config/environment');var attributes=require(_0xdeb5('0x6'));module[_0xdeb5('0x7')]=function(_0x164ecb,_0x33af72){return _0x164ecb[_0xdeb5('0x8')](_0xdeb5('0x9'),attributes,{'tableName':_0xdeb5('0xa'),'paranoid':![],'indexes':[{'fields':[_0xdeb5('0xb'),_0xdeb5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5183=['../../config/logger','bluebird','request-promise','path','rimraf','exports','uniqueid','destuniqueid','lodash','util'];(function(_0x16dbcd,_0x274516){var _0x34706e=function(_0x43433d){while(--_0x43433d){_0x16dbcd['push'](_0x16dbcd['shift']());}};_0x34706e(++_0x274516);}(_0x5183,0x13e));var _0x3518=function(_0x4f59bc,_0xcc7830){_0x4f59bc=_0x4f59bc-0x0;var _0x1a9e71=_0x5183[_0x4f59bc];return _0x1a9e71;};'use strict';var _=require(_0x3518('0x0'));var util=require(_0x3518('0x1'));var logger=require(_0x3518('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3518('0x3'));var rp=require(_0x3518('0x4'));var fs=require('fs');var path=require(_0x3518('0x5'));var rimraf=require(_0x3518('0x6'));var config=require('../../config/environment');var attributes=require('./voiceAgentReport.attributes');module[_0x3518('0x7')]=function(_0x1031a9,_0x2c019c){return _0x1031a9['define']('VoiceAgentReport',attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x3518('0x8'),_0x3518('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 7a29aa8..97a5f78 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 _0xf645=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','VoiceAgentReport','create','body','options','raw','then','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','attributes','lodash','moment'];(function(_0x319bd6,_0x17d8cf){var _0x4a01fb=function(_0x1e7fd8){while(--_0x1e7fd8){_0x319bd6['push'](_0x319bd6['shift']());}};_0x4a01fb(++_0x17d8cf);}(_0xf645,0xfe));var _0x5f64=function(_0x2c17c7,_0x171f6a){_0x2c17c7=_0x2c17c7-0x0;var _0x2c0cda=_0xf645[_0x2c17c7];return _0x2c0cda;};'use strict';var _=require(_0x5f64('0x0'));var util=require('util');var moment=require(_0x5f64('0x1'));var BPromise=require(_0x5f64('0x2'));var rs=require(_0x5f64('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5f64('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5f64('0x5'))(_0x5f64('0x6'));var config=require(_0x5f64('0x7'));var jayson=require(_0x5f64('0x8'));var client=jayson[_0x5f64('0x9')][_0x5f64('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d0bbf,_0x1adb61,_0x382bf2){return new BPromise(function(_0x1a0d67,_0x1171af){return client[_0x5f64('0xb')](_0x5d0bbf,_0x382bf2)['then'](function(_0x2cde85){logger[_0x5f64('0xc')](_0x5f64('0xd'),_0x1adb61,'request\x20sent');logger[_0x5f64('0xe')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x1adb61,_0x5f64('0xf'),JSON[_0x5f64('0x10')](_0x2cde85));if(_0x2cde85[_0x5f64('0x11')]){if(_0x2cde85['error'][_0x5f64('0x12')]===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x1adb61,_0x2cde85[_0x5f64('0x11')][_0x5f64('0x13')]);return _0x1171af(_0x2cde85[_0x5f64('0x11')][_0x5f64('0x13')]);}logger[_0x5f64('0x11')](_0x5f64('0xd'),_0x1adb61,_0x2cde85[_0x5f64('0x11')][_0x5f64('0x13')]);return _0x1a0d67(_0x2cde85['error'][_0x5f64('0x13')]);}else{logger[_0x5f64('0xc')](_0x5f64('0xd'),_0x1adb61,_0x5f64('0xf'));_0x1a0d67(_0x2cde85[_0x5f64('0x14')]['message']);}})[_0x5f64('0x15')](function(_0x130fdc){logger[_0x5f64('0x11')](_0x5f64('0xd'),_0x1adb61,_0x130fdc);_0x1171af(_0x130fdc);});});}exports['CreateVoiceAgentReport']=function(_0x41b530){var _0x7589e6=this;return new Promise(function(_0x3f9c28,_0x3e79d0){return db[_0x5f64('0x16')][_0x5f64('0x17')](_0x41b530[_0x5f64('0x18')],{'raw':_0x41b530[_0x5f64('0x19')]?_0x41b530['options'][_0x5f64('0x1a')]===undefined?!![]:![]:!![]})[_0x5f64('0x1b')](function(_0x14bb75){logger[_0x5f64('0xc')](_0x5f64('0x1c'),_0x41b530);logger[_0x5f64('0xe')](_0x5f64('0x1c'),_0x41b530,JSON[_0x5f64('0x10')](_0x14bb75));_0x3f9c28(_0x14bb75);})[_0x5f64('0x15')](function(_0x1a6de8){logger[_0x5f64('0x11')](_0x5f64('0x1c'),_0x1a6de8[_0x5f64('0x13')],_0x41b530);_0x3e79d0(_0x7589e6[_0x5f64('0x11')](0x1f4,_0x1a6de8[_0x5f64('0x13')]));});});};exports[_0x5f64('0x1d')]=function(_0x28ca15){var _0x2d7788=this;return new Promise(function(_0x2d32ad,_0x58808d){return db['VoiceAgentReport'][_0x5f64('0x1e')](_0x28ca15[_0x5f64('0x18')],{'raw':_0x28ca15[_0x5f64('0x19')]?_0x28ca15['options'][_0x5f64('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28ca15[_0x5f64('0x19')]?_0x28ca15['options']['where']||null:null,'attributes':_0x28ca15['options']?_0x28ca15['options'][_0x5f64('0x1f')]||null:null,'limit':_0x28ca15[_0x5f64('0x19')]?_0x28ca15['options']['limit']||null:null})[_0x5f64('0x1b')](function(_0x216b09){logger['info'](_0x5f64('0x1d'),_0x28ca15);logger[_0x5f64('0xe')](_0x5f64('0x1d'),_0x28ca15,JSON[_0x5f64('0x10')](_0x216b09));_0x2d32ad(_0x216b09);})['catch'](function(_0x8e23d9){logger[_0x5f64('0x11')]('UpdateVoiceAgentReport',_0x8e23d9[_0x5f64('0x13')],_0x28ca15);_0x58808d(_0x2d7788[_0x5f64('0x11')](0x1f4,_0x8e23d9[_0x5f64('0x13')]));});});}; \ No newline at end of file +var _0x62c5=['VoiceAgentReport','body','options','raw','catch','UpdateVoiceAgentReport','update','where','attributes','then','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceAgentReport,\x20%s,\x20%s','message','result','CreateVoiceAgentReport'];(function(_0x41604d,_0x539ee4){var _0x1b79fc=function(_0x172176){while(--_0x172176){_0x41604d['push'](_0x41604d['shift']());}};_0x1b79fc(++_0x539ee4);}(_0x62c5,0x172));var _0x562c=function(_0x11a796,_0x11a8f2){_0x11a796=_0x11a796-0x0;var _0x5a1439=_0x62c5[_0x11a796];return _0x5a1439;};'use strict';var _=require('lodash');var util=require(_0x562c('0x0'));var moment=require(_0x562c('0x1'));var BPromise=require(_0x562c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x562c('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x562c('0x4'))(_0x562c('0x5'));var config=require(_0x562c('0x6'));var jayson=require(_0x562c('0x7'));var client=jayson[_0x562c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37b872,_0x4d8836,_0x543387){return new BPromise(function(_0x4aa55e,_0x2257dd){return client[_0x562c('0x9')](_0x37b872,_0x543387)['then'](function(_0x3cfe10){logger[_0x562c('0xa')]('VoiceAgentReport,\x20%s,\x20%s',_0x4d8836,_0x562c('0xb'));logger[_0x562c('0xc')](_0x562c('0xd'),_0x4d8836,'request\x20sent',JSON[_0x562c('0xe')](_0x3cfe10));if(_0x3cfe10[_0x562c('0xf')]){if(_0x3cfe10['error']['code']===0x1f4){logger[_0x562c('0xf')](_0x562c('0x10'),_0x4d8836,_0x3cfe10['error'][_0x562c('0x11')]);return _0x2257dd(_0x3cfe10[_0x562c('0xf')][_0x562c('0x11')]);}logger[_0x562c('0xf')](_0x562c('0x10'),_0x4d8836,_0x3cfe10[_0x562c('0xf')][_0x562c('0x11')]);return _0x4aa55e(_0x3cfe10[_0x562c('0xf')]['message']);}else{logger[_0x562c('0xa')](_0x562c('0x10'),_0x4d8836,_0x562c('0xb'));_0x4aa55e(_0x3cfe10[_0x562c('0x12')][_0x562c('0x11')]);}})['catch'](function(_0x413ffa){logger[_0x562c('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x4d8836,_0x413ffa);_0x2257dd(_0x413ffa);});});}exports[_0x562c('0x13')]=function(_0x5e0973){var _0x4eebf1=this;return new Promise(function(_0x4048fa,_0x4d5007){return db[_0x562c('0x14')]['create'](_0x5e0973[_0x562c('0x15')],{'raw':_0x5e0973[_0x562c('0x16')]?_0x5e0973['options'][_0x562c('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x22484e){logger['info'](_0x562c('0x13'),_0x5e0973);logger[_0x562c('0xc')](_0x562c('0x13'),_0x5e0973,JSON['stringify'](_0x22484e));_0x4048fa(_0x22484e);})[_0x562c('0x18')](function(_0x306173){logger['error'](_0x562c('0x13'),_0x306173['message'],_0x5e0973);_0x4d5007(_0x4eebf1[_0x562c('0xf')](0x1f4,_0x306173[_0x562c('0x11')]));});});};exports[_0x562c('0x19')]=function(_0x1758da){var _0x3ebf11=this;return new Promise(function(_0x3d2d15,_0x186480){return db[_0x562c('0x14')][_0x562c('0x1a')](_0x1758da[_0x562c('0x15')],{'raw':_0x1758da[_0x562c('0x16')]?_0x1758da[_0x562c('0x16')][_0x562c('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1758da[_0x562c('0x16')]?_0x1758da[_0x562c('0x16')][_0x562c('0x1b')]||null:null,'attributes':_0x1758da[_0x562c('0x16')]?_0x1758da[_0x562c('0x16')][_0x562c('0x1c')]||null:null,'limit':_0x1758da['options']?_0x1758da['options']['limit']||null:null})[_0x562c('0x1d')](function(_0x4d115e){logger[_0x562c('0xa')]('UpdateVoiceAgentReport',_0x1758da);logger[_0x562c('0xc')]('UpdateVoiceAgentReport',_0x1758da,JSON[_0x562c('0xe')](_0x4d115e));_0x3d2d15(_0x4d115e);})['catch'](function(_0x23cc99){logger[_0x562c('0xf')](_0x562c('0x19'),_0x23cc99[_0x562c('0x11')],_0x1758da);_0x186480(_0x3ebf11['error'](0x1f4,_0x23cc99['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 1a6c93e..d88fb47 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 _0xca9e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','update','exports','multer','util','path','connect-timeout','express'];(function(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0xca9e,0x136));var _0xeca9=function(_0x5e5c44,_0x595e3b){_0x5e5c44=_0x5e5c44-0x0;var _0x38ad1f=_0xca9e[_0x5e5c44];return _0x38ad1f;};'use strict';var multer=require(_0xeca9('0x0'));var util=require(_0xeca9('0x1'));var path=require(_0xeca9('0x2'));var timeout=require(_0xeca9('0x3'));var express=require(_0xeca9('0x4'));var router=express[_0xeca9('0x5')]();var fs_extra=require(_0xeca9('0x6'));var auth=require(_0xeca9('0x7'));var interaction=require(_0xeca9('0x8'));var config=require(_0xeca9('0x9'));var controller=require(_0xeca9('0xa'));router[_0xeca9('0xb')]('/',auth[_0xeca9('0xc')](),controller[_0xeca9('0xd')]);router['get'](_0xeca9('0xe'),auth[_0xeca9('0xc')](),controller['describe']);router['get'](_0xeca9('0xf'),auth[_0xeca9('0xc')](),controller[_0xeca9('0x10')]);router['post']('/',auth[_0xeca9('0xc')](),controller[_0xeca9('0x11')]);router[_0xeca9('0x12')](_0xeca9('0xf'),auth[_0xeca9('0xc')](),controller[_0xeca9('0x13')]);router['delete'](_0xeca9('0xf'),auth[_0xeca9('0xc')](),controller['destroy']);module[_0xeca9('0x14')]=router; \ No newline at end of file +var _0xb4c7=['post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','isAuthenticated','index','get','describe','/:id','show'];(function(_0x5552e8,_0xf980e3){var _0x15a8e0=function(_0x500171){while(--_0x500171){_0x5552e8['push'](_0x5552e8['shift']());}};_0x15a8e0(++_0xf980e3);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x5636ce,_0x4a8211){_0x5636ce=_0x5636ce-0x0;var _0x49deda=_0xb4c7[_0x5636ce];return _0x49deda;};'use strict';var multer=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var path=require(_0x7b4c('0x2'));var timeout=require(_0x7b4c('0x3'));var express=require(_0x7b4c('0x4'));var router=express['Router']();var fs_extra=require(_0x7b4c('0x5'));var auth=require(_0x7b4c('0x6'));var interaction=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var controller=require(_0x7b4c('0x9'));router['get']('/',auth[_0x7b4c('0xa')](),controller[_0x7b4c('0xb')]);router[_0x7b4c('0xc')]('/describe',auth[_0x7b4c('0xa')](),controller[_0x7b4c('0xd')]);router['get'](_0x7b4c('0xe'),auth[_0x7b4c('0xa')](),controller[_0x7b4c('0xf')]);router[_0x7b4c('0x10')]('/',auth[_0x7b4c('0xa')](),controller[_0x7b4c('0x11')]);router[_0x7b4c('0x12')](_0x7b4c('0xe'),auth[_0x7b4c('0xa')](),controller[_0x7b4c('0x13')]);router['delete']('/:id',auth[_0x7b4c('0xa')](),controller[_0x7b4c('0x14')]);module[_0x7b4c('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index a217f19..cbe213f 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 _0xc7da=['DATE','INTEGER','sequelize','exports','STRING','inbound','internal','inbound-fax','outbound-fax','TEXT'];(function(_0x2b2a02,_0x581f53){var _0x1b4b08=function(_0x134472){while(--_0x134472){_0x2b2a02['push'](_0x2b2a02['shift']());}};_0x1b4b08(++_0x581f53);}(_0xc7da,0xf2));var _0xac7d=function(_0x38a95e,_0x526fd8){_0x38a95e=_0x38a95e-0x0;var _0x5e4d7a=_0xc7da[_0x38a95e];return _0x5e4d7a;};'use strict';var Sequelize=require(_0xac7d('0x0'));module[_0xac7d('0x1')]={'uniqueid':{'type':Sequelize[_0xac7d('0x2')]},'type':{'type':Sequelize['ENUM'](_0xac7d('0x3'),_0xac7d('0x4'),'outbound',_0xac7d('0x5'),_0xac7d('0x6'),'dialer')},'tag':{'type':Sequelize[_0xac7d('0x2')]},'accountcode':{'type':Sequelize[_0xac7d('0x2')]},'source':{'type':Sequelize[_0xac7d('0x2')]},'destination':{'type':Sequelize[_0xac7d('0x2')]},'destinationcontext':{'type':Sequelize[_0xac7d('0x2')]},'callerid':{'type':Sequelize[_0xac7d('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0xac7d('0x2')]},'lastapplication':{'type':Sequelize[_0xac7d('0x2')]},'lastdata':{'type':Sequelize[_0xac7d('0x7')]},'starttime':{'type':Sequelize[_0xac7d('0x8')]},'systemanswertime':{'type':Sequelize[_0xac7d('0x8')]},'answertime':{'type':Sequelize[_0xac7d('0x8')]},'endtime':{'type':Sequelize[_0xac7d('0x8')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xac7d('0x9')]},'mohtime':{'type':Sequelize[_0xac7d('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xac7d('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xac7d('0x2')]},'userDisposition':{'type':Sequelize[_0xac7d('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xac7d('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xac7d('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xac7d('0x2')]},'routeid':{'type':Sequelize[_0xac7d('0x9')]},'sipcallid':{'type':Sequelize[_0xac7d('0x2')]}}; \ No newline at end of file +var _0x0be2=['ENUM','inbound','internal','outbound','outbound-fax','DATE','INTEGER','STRING'];(function(_0x35dc22,_0x1a4b64){var _0x56d8e6=function(_0x3a1210){while(--_0x3a1210){_0x35dc22['push'](_0x35dc22['shift']());}};_0x56d8e6(++_0x1a4b64);}(_0x0be2,0x8f));var _0x20be=function(_0x119705,_0xba9427){_0x119705=_0x119705-0x0;var _0x2affc2=_0x0be2[_0x119705];return _0x2affc2;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x20be('0x0')]},'type':{'type':Sequelize[_0x20be('0x1')](_0x20be('0x2'),_0x20be('0x3'),_0x20be('0x4'),'inbound-fax',_0x20be('0x5'),'dialer')},'tag':{'type':Sequelize[_0x20be('0x0')]},'accountcode':{'type':Sequelize[_0x20be('0x0')]},'source':{'type':Sequelize[_0x20be('0x0')]},'destination':{'type':Sequelize[_0x20be('0x0')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x20be('0x0')]},'channel':{'type':Sequelize[_0x20be('0x0')]},'destinationchannel':{'type':Sequelize[_0x20be('0x0')]},'lastapplication':{'type':Sequelize[_0x20be('0x0')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x20be('0x6')]},'systemanswertime':{'type':Sequelize[_0x20be('0x6')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x20be('0x6')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x20be('0x7')]},'mohtime':{'type':Sequelize[_0x20be('0x7')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x20be('0x0')]},'amaflags':{'type':Sequelize[_0x20be('0x0')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x20be('0x0')]},'userThirdDisposition':{'type':Sequelize[_0x20be('0x0')]},'note':{'type':Sequelize[_0x20be('0x0')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x20be('0x7')]},'sipcallid':{'type':Sequelize[_0x20be('0x0')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index b36db59..6899126 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 _0xdb28=['options','includeAll','fullname','User','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','VoiceCallReport','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge'];(function(_0x4cca08,_0x210a3a){var _0x364a19=function(_0x394fc1){while(--_0x394fc1){_0x4cca08['push'](_0x4cca08['shift']());}};_0x364a19(++_0x210a3a);}(_0xdb28,0x106));var _0x8db2=function(_0xdd539e,_0x5f5aca){_0xdd539e=_0xdd539e-0x0;var _0x5e268e=_0xdb28[_0xdd539e];return _0x5e268e;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'attributes':['id',_0x8db2('0x28'),_0x8db2('0x40'),'alias'],'model':db['User'],'as':_0x8db2('0x41')}];}return db['VoiceCallReport'][_0x8db2('0x42')](_0x21bae5);})[_0x8db2('0x24')](function(_0x313130){_0x3124d5[_0x8db2('0x43')]=_0x313130;return _0x3124d5;})[_0x8db2('0x24')](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x44')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x45')]=function(_0x5c97ef,_0x2f86b1){var _0x3d44de={'raw':!![],'where':{'id':_0x5c97ef[_0x8db2('0x46')]['id']}},_0x40c69e={};_0x40c69e['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x47')]);_0x40c69e[_0x8db2('0x30')]=_['keys'](_0x5c97ef[_0x8db2('0x30')]);_0x40c69e['filters']=_[_0x8db2('0x48')](_0x40c69e[_0x8db2('0x32')],_0x40c69e[_0x8db2('0x30')]);_0x3d44de['attributes']=_['intersection'](_0x40c69e[_0x8db2('0x32')],qs['fields'](_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x33')]));_0x3d44de[_0x8db2('0x34')]=_0x3d44de[_0x8db2('0x34')][_0x8db2('0x35')]?_0x3d44de[_0x8db2('0x34')]:_0x40c69e[_0x8db2('0x32')];if(_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x3d44de[_0x8db2('0x49')]=[{'all':!![]}];}_0x3d44de=_[_0x8db2('0x3d')]({},_0x3d44de,_0x5c97ef[_0x8db2('0x3e')]);return db['VoiceCallReport'][_0x8db2('0x4a')](_0x3d44de)[_0x8db2('0x24')](handleEntityNotFound(_0x2f86b1,null))[_0x8db2('0x24')](respondWithResult(_0x2f86b1,null))[_0x8db2('0x44')](handleError(_0x2f86b1,null));};exports['create']=function(_0x4ffd9d,_0x11c224){return db[_0x8db2('0x2b')][_0x8db2('0x4b')](_0x4ffd9d['body'],{})['then'](respondWithResult(_0x11c224,0xc9))['catch'](handleError(_0x11c224,null));};exports[_0x8db2('0x4c')]=function(_0x368c37,_0x55c7dd){return db[_0x8db2('0x2b')][_0x8db2('0x4a')]({'where':{'id':_0x368c37[_0x8db2('0x46')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x55c7dd,null))['then'](removeEntity(_0x55c7dd,null))['catch'](handleError(_0x55c7dd,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x2b')][_0x8db2('0x4d')]()[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x44')](handleError(_0x2908e4,null));};exports[_0x8db2('0x23')]=function(_0x4187d6,_0x426ae0){if(_0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')]){delete _0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')];}return db[_0x8db2('0x2b')]['find']({'where':{'uniqueid':_0x4187d6[_0x8db2('0x46')]['id'],'UserId':{'$or':[null,_0x4187d6[_0x8db2('0x50')]['id']]}}})['then'](handleEntityNotFound(_0x426ae0,null))[_0x8db2('0x24')](saveUpdates(_0x4187d6[_0x8db2('0x4e')],null))[_0x8db2('0x24')](respondWithResult(_0x426ae0,null))['catch'](handleError(_0x426ae0,null));}; \ No newline at end of file +var _0x0b0e=['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','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0x58005f,_0x2c5f78){var _0x2de968=function(_0x48076c){while(--_0x48076c){_0x58005f['push'](_0x58005f['shift']());}};_0x2de968(++_0x2c5f78);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3e079f,_0x189e15){_0x3e079f=_0x3e079f-0x0;var _0x296a34=_0x0b0e[_0x3e079f];return _0x296a34;};'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['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 1f5d83c..d3645dd 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 _0xacdd=['api','moment','bluebird','request-promise','path','../../config/environment','./voiceCallReport.attributes','exports','define','report_call','uniqueid','lodash','../../config/logger'];(function(_0x46515e,_0x37e24b){var _0x50090b=function(_0x42c732){while(--_0x42c732){_0x46515e['push'](_0x46515e['shift']());}};_0x50090b(++_0x37e24b);}(_0xacdd,0xc1));var _0xdacd=function(_0x31c479,_0x303887){_0x31c479=_0x31c479-0x0;var _0x3562b2=_0xacdd[_0x31c479];return _0x3562b2;};'use strict';var _=require(_0xdacd('0x0'));var util=require('util');var logger=require(_0xdacd('0x1'))(_0xdacd('0x2'));var moment=require(_0xdacd('0x3'));var BPromise=require(_0xdacd('0x4'));var rp=require(_0xdacd('0x5'));var fs=require('fs');var path=require(_0xdacd('0x6'));var rimraf=require('rimraf');var config=require(_0xdacd('0x7'));var attributes=require(_0xdacd('0x8'));module[_0xdacd('0x9')]=function(_0x19ec8f,_0x52e21b){return _0x19ec8f[_0xdacd('0xa')]('VoiceCallReport',attributes,{'tableName':_0xdacd('0xb'),'paranoid':![],'indexes':[{'fields':[_0xdacd('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x60c7=['../../config/environment','./voiceCallReport.attributes','exports','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x61f93d,_0x2aa758){var _0x459087=function(_0x4f24e9){while(--_0x4f24e9){_0x61f93d['push'](_0x61f93d['shift']());}};_0x459087(++_0x2aa758);}(_0x60c7,0x19e));var _0x760c=function(_0x5be23c,_0x34031c){_0x5be23c=_0x5be23c-0x0;var _0x2e9888=_0x60c7[_0x5be23c];return _0x2e9888;};'use strict';var _=require(_0x760c('0x0'));var util=require('util');var logger=require(_0x760c('0x1'))(_0x760c('0x2'));var moment=require('moment');var BPromise=require(_0x760c('0x3'));var rp=require(_0x760c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x760c('0x5'));var config=require(_0x760c('0x6'));var attributes=require(_0x760c('0x7'));module[_0x760c('0x8')]=function(_0x5d0b3c,_0x48c74f){return _0x5d0b3c['define']('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x760c('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index ade7d08..dfc59ff 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 _0x20d8=['GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x20d8,0xbe));var _0x820d=function(_0x1cf3b3,_0x1d5d50){_0x1cf3b3=_0x1cf3b3-0x0;var _0x2daba7=_0x20d8[_0x1cf3b3];return _0x2daba7;};'use strict';var _=require('lodash');var util=require(_0x820d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x820d('0x1'));var fs=require('fs');var Redis=require(_0x820d('0x2'));var db=require(_0x820d('0x3'))['db'];var utils=require(_0x820d('0x4'));var logger=require(_0x820d('0x5'))('rpc');var config=require(_0x820d('0x6'));var jayson=require(_0x820d('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3b7f1e,_0x24632d,_0x1d0990){return new BPromise(function(_0x23ec72,_0x4d3b1c){return client[_0x820d('0x8')](_0x3b7f1e,_0x1d0990)[_0x820d('0x9')](function(_0x31d836){logger[_0x820d('0xa')](_0x820d('0xb'),_0x24632d,_0x820d('0xc'));logger[_0x820d('0xd')](_0x820d('0xe'),_0x24632d,'request\x20sent',JSON['stringify'](_0x31d836));if(_0x31d836['error']){if(_0x31d836[_0x820d('0xf')][_0x820d('0x10')]===0x1f4){logger[_0x820d('0xf')](_0x820d('0xb'),_0x24632d,_0x31d836[_0x820d('0xf')][_0x820d('0x11')]);return _0x4d3b1c(_0x31d836[_0x820d('0xf')][_0x820d('0x11')]);}logger[_0x820d('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x24632d,_0x31d836[_0x820d('0xf')][_0x820d('0x11')]);return _0x23ec72(_0x31d836[_0x820d('0xf')][_0x820d('0x11')]);}else{logger[_0x820d('0xa')]('VoiceCallReport,\x20%s,\x20%s',_0x24632d,_0x820d('0xc'));_0x23ec72(_0x31d836[_0x820d('0x12')][_0x820d('0x11')]);}})[_0x820d('0x13')](function(_0x237983){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x24632d,_0x237983);_0x4d3b1c(_0x237983);});});}exports[_0x820d('0x14')]=function(_0x283d98){var _0x22d3dd=this;return new Promise(function(_0x40d220,_0x2c50dc){return db[_0x820d('0x15')][_0x820d('0x16')]({'raw':_0x283d98[_0x820d('0x17')]?_0x283d98[_0x820d('0x17')][_0x820d('0x18')]===undefined?!![]:![]:!![],'where':_0x283d98[_0x820d('0x17')]?_0x283d98[_0x820d('0x17')][_0x820d('0x19')]||null:null,'attributes':_0x283d98[_0x820d('0x17')]?_0x283d98[_0x820d('0x17')][_0x820d('0x1a')]||null:null,'limit':_0x283d98[_0x820d('0x17')]?_0x283d98[_0x820d('0x17')][_0x820d('0x1b')]||null:null,'include':_0x283d98[_0x820d('0x17')]?_0x283d98[_0x820d('0x17')][_0x820d('0x1c')]?_[_0x820d('0x1d')](_0x283d98[_0x820d('0x17')]['include'],function(_0x15ea83){return{'model':db[_0x15ea83[_0x820d('0x1e')]],'as':_0x15ea83['as'],'attributes':_0x15ea83[_0x820d('0x1a')],'include':_0x15ea83[_0x820d('0x1c')]?_['map'](_0x15ea83['include'],function(_0x5c7195){return{'model':db[_0x5c7195[_0x820d('0x1e')]],'as':_0x5c7195['as'],'attributes':_0x5c7195[_0x820d('0x1a')],'include':_0x5c7195[_0x820d('0x1c')]?_['map'](_0x5c7195[_0x820d('0x1c')],function(_0xc6399c){return{'model':db[_0xc6399c['model']],'as':_0xc6399c['as'],'attributes':_0xc6399c['attributes']};}):[]};}):[]};}):[]:[]})[_0x820d('0x9')](function(_0x415d72){logger[_0x820d('0xa')](_0x820d('0x14'),_0x283d98);logger[_0x820d('0xd')](_0x820d('0x14'),_0x283d98,JSON['stringify'](_0x415d72));_0x40d220(_0x415d72);})[_0x820d('0x13')](function(_0x4c901a){logger[_0x820d('0xf')](_0x820d('0x14'),_0x4c901a['message'],_0x283d98);_0x2c50dc(_0x22d3dd[_0x820d('0xf')](0x1f4,_0x4c901a['message']));});});};exports[_0x820d('0x1f')]=function(_0xf2cf97){var _0x30a418=this;return new Promise(function(_0x9c8a7b,_0x27ec46){return db[_0x820d('0x15')][_0x820d('0x20')](_0xf2cf97[_0x820d('0x21')],{'raw':_0xf2cf97['options']?_0xf2cf97[_0x820d('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x820d('0x9')](function(_0x54140c){logger[_0x820d('0xa')]('CreateVoiceCallReport',_0xf2cf97);logger[_0x820d('0xd')](_0x820d('0x1f'),_0xf2cf97,JSON['stringify'](_0x54140c));_0x9c8a7b(_0x54140c);})[_0x820d('0x13')](function(_0x4b84e3){logger[_0x820d('0xf')](_0x820d('0x1f'),_0x4b84e3[_0x820d('0x11')],_0xf2cf97);_0x27ec46(_0x30a418[_0x820d('0xf')](0x1f4,_0x4b84e3[_0x820d('0x11')]));});});};exports[_0x820d('0x22')]=function(_0x45b154){var _0x13188d=this;return new Promise(function(_0x5c852f,_0x3c4794){return db[_0x820d('0x15')]['update'](_0x45b154['body'],{'raw':_0x45b154['options']?_0x45b154['options'][_0x820d('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45b154[_0x820d('0x17')]?_0x45b154[_0x820d('0x17')][_0x820d('0x19')]||null:null,'attributes':_0x45b154['options']?_0x45b154[_0x820d('0x17')][_0x820d('0x1a')]||null:null,'limit':_0x45b154['options']?_0x45b154['options'][_0x820d('0x1b')]||null:null})[_0x820d('0x9')](function(_0x44dc94){logger[_0x820d('0xa')](_0x820d('0x22'),_0x45b154);logger[_0x820d('0xd')](_0x820d('0x22'),_0x45b154,JSON['stringify'](_0x44dc94));_0x5c852f(_0x44dc94);})[_0x820d('0x13')](function(_0x2bfd73){logger[_0x820d('0xf')]('UpdateVoiceCallReport',_0x2bfd73[_0x820d('0x11')],_0x45b154);_0x3c4794(_0x13188d['error'](0x1f4,_0x2bfd73[_0x820d('0x11')]));});});}; \ No newline at end of file +var _0x9168=['raw','where','limit','include','model','attributes','map','GetVoiceCallReport','CreateVoiceCallReport','debug','UpdateVoiceCallReport','update','body','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','VoiceCallReport,\x20%s,\x20%s','message','result','catch','VoiceCallReport','findAll','options'];(function(_0x3029d3,_0x564330){var _0x1147bd=function(_0x39fe37){while(--_0x39fe37){_0x3029d3['push'](_0x3029d3['shift']());}};_0x1147bd(++_0x564330);}(_0x9168,0x175));var _0x8916=function(_0x25a175,_0x542d04){_0x25a175=_0x25a175-0x0;var _0x3e9708=_0x9168[_0x25a175];return _0x3e9708;};'use strict';var _=require(_0x8916('0x0'));var util=require('util');var moment=require(_0x8916('0x1'));var BPromise=require(_0x8916('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8916('0x3'));var logger=require(_0x8916('0x4'))(_0x8916('0x5'));var config=require(_0x8916('0x6'));var jayson=require(_0x8916('0x7'));var client=jayson[_0x8916('0x8')][_0x8916('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8779b4,_0xdfa4cd,_0x2ae9d4){return new BPromise(function(_0x27f5a3,_0x213d9c){return client[_0x8916('0xa')](_0x8779b4,_0x2ae9d4)[_0x8916('0xb')](function(_0x10f3bb){logger[_0x8916('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0xdfa4cd,_0x8916('0xd'));logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0xdfa4cd,'request\x20sent',JSON[_0x8916('0xe')](_0x10f3bb));if(_0x10f3bb[_0x8916('0xf')]){if(_0x10f3bb[_0x8916('0xf')]['code']===0x1f4){logger[_0x8916('0xf')](_0x8916('0x10'),_0xdfa4cd,_0x10f3bb[_0x8916('0xf')][_0x8916('0x11')]);return _0x213d9c(_0x10f3bb[_0x8916('0xf')][_0x8916('0x11')]);}logger['error'](_0x8916('0x10'),_0xdfa4cd,_0x10f3bb[_0x8916('0xf')][_0x8916('0x11')]);return _0x27f5a3(_0x10f3bb['error'][_0x8916('0x11')]);}else{logger[_0x8916('0xc')](_0x8916('0x10'),_0xdfa4cd,_0x8916('0xd'));_0x27f5a3(_0x10f3bb[_0x8916('0x12')][_0x8916('0x11')]);}})[_0x8916('0x13')](function(_0x46dbb8){logger['error'](_0x8916('0x10'),_0xdfa4cd,_0x46dbb8);_0x213d9c(_0x46dbb8);});});}exports['GetVoiceCallReport']=function(_0x43dd05){var _0x3cf7cf=this;return new Promise(function(_0x34d0b0,_0x975596){return db[_0x8916('0x14')][_0x8916('0x15')]({'raw':_0x43dd05[_0x8916('0x16')]?_0x43dd05['options'][_0x8916('0x17')]===undefined?!![]:![]:!![],'where':_0x43dd05[_0x8916('0x16')]?_0x43dd05[_0x8916('0x16')][_0x8916('0x18')]||null:null,'attributes':_0x43dd05[_0x8916('0x16')]?_0x43dd05[_0x8916('0x16')]['attributes']||null:null,'limit':_0x43dd05['options']?_0x43dd05[_0x8916('0x16')][_0x8916('0x19')]||null:null,'include':_0x43dd05['options']?_0x43dd05['options'][_0x8916('0x1a')]?_['map'](_0x43dd05[_0x8916('0x16')]['include'],function(_0x181c8a){return{'model':db[_0x181c8a[_0x8916('0x1b')]],'as':_0x181c8a['as'],'attributes':_0x181c8a[_0x8916('0x1c')],'include':_0x181c8a[_0x8916('0x1a')]?_[_0x8916('0x1d')](_0x181c8a['include'],function(_0x3a2109){return{'model':db[_0x3a2109[_0x8916('0x1b')]],'as':_0x3a2109['as'],'attributes':_0x3a2109[_0x8916('0x1c')],'include':_0x3a2109[_0x8916('0x1a')]?_['map'](_0x3a2109[_0x8916('0x1a')],function(_0x244f88){return{'model':db[_0x244f88[_0x8916('0x1b')]],'as':_0x244f88['as'],'attributes':_0x244f88[_0x8916('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8916('0xb')](function(_0x355185){logger[_0x8916('0xc')](_0x8916('0x1e'),_0x43dd05);logger['debug'](_0x8916('0x1e'),_0x43dd05,JSON[_0x8916('0xe')](_0x355185));_0x34d0b0(_0x355185);})[_0x8916('0x13')](function(_0x2fada9){logger[_0x8916('0xf')](_0x8916('0x1e'),_0x2fada9[_0x8916('0x11')],_0x43dd05);_0x975596(_0x3cf7cf[_0x8916('0xf')](0x1f4,_0x2fada9['message']));});});};exports[_0x8916('0x1f')]=function(_0x7966e7){var _0x4357c3=this;return new Promise(function(_0x3627db,_0xead053){return db[_0x8916('0x14')]['create'](_0x7966e7['body'],{'raw':_0x7966e7[_0x8916('0x16')]?_0x7966e7[_0x8916('0x16')][_0x8916('0x17')]===undefined?!![]:![]:!![]})[_0x8916('0xb')](function(_0xfefaae){logger[_0x8916('0xc')](_0x8916('0x1f'),_0x7966e7);logger[_0x8916('0x20')](_0x8916('0x1f'),_0x7966e7,JSON[_0x8916('0xe')](_0xfefaae));_0x3627db(_0xfefaae);})['catch'](function(_0xe87350){logger['error'](_0x8916('0x1f'),_0xe87350[_0x8916('0x11')],_0x7966e7);_0xead053(_0x4357c3[_0x8916('0xf')](0x1f4,_0xe87350[_0x8916('0x11')]));});});};exports[_0x8916('0x21')]=function(_0xf7f1c9){var _0x18f73f=this;return new Promise(function(_0x536752,_0xc70ca7){return db[_0x8916('0x14')][_0x8916('0x22')](_0xf7f1c9[_0x8916('0x23')],{'raw':_0xf7f1c9['options']?_0xf7f1c9[_0x8916('0x16')][_0x8916('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf7f1c9[_0x8916('0x16')]?_0xf7f1c9['options'][_0x8916('0x18')]||null:null,'attributes':_0xf7f1c9[_0x8916('0x16')]?_0xf7f1c9['options']['attributes']||null:null,'limit':_0xf7f1c9['options']?_0xf7f1c9[_0x8916('0x16')][_0x8916('0x19')]||null:null})[_0x8916('0xb')](function(_0x13c3c7){logger['info'](_0x8916('0x21'),_0xf7f1c9);logger[_0x8916('0x20')](_0x8916('0x21'),_0xf7f1c9,JSON[_0x8916('0xe')](_0x13c3c7));_0x536752(_0x13c3c7);})[_0x8916('0x13')](function(_0xb1ee20){logger['error'](_0x8916('0x21'),_0xb1ee20[_0x8916('0x11')],_0xf7f1c9);_0xc70ca7(_0x18f73f['error'](0x1f4,_0xb1ee20[_0x8916('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index b0bf728..d9e4fc8 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 _0x299e=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','./voiceChanSpy.controller'];(function(_0x15449d,_0x537b1d){var _0x55cf8c=function(_0x4fc014){while(--_0x4fc014){_0x15449d['push'](_0x15449d['shift']());}};_0x55cf8c(++_0x537b1d);}(_0x299e,0x1e7));var _0xe299=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x299e[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require(_0xe299('0x0'));var path=require(_0xe299('0x1'));var timeout=require(_0xe299('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe299('0x3'));var auth=require(_0xe299('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe299('0x5'));router['get']('/',auth[_0xe299('0x6')](),controller[_0xe299('0x7')]);router['get'](_0xe299('0x8'),auth[_0xe299('0x6')](),controller[_0xe299('0x9')]);router[_0xe299('0xa')]('/',auth[_0xe299('0x6')](),controller[_0xe299('0xb')]);router[_0xe299('0xc')](_0xe299('0x8'),auth[_0xe299('0x6')](),controller[_0xe299('0xd')]);router[_0xe299('0xe')](_0xe299('0x8'),auth['isAuthenticated'](),controller[_0xe299('0xf')]);module[_0xe299('0x10')]=router; \ No newline at end of file +var _0xa8ee=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','index','/:id','isAuthenticated','show','create','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x26d27e,_0x4372da){var _0xd4acce=function(_0x2847a0){while(--_0x2847a0){_0x26d27e['push'](_0x26d27e['shift']());}};_0xd4acce(++_0x4372da);}(_0xa8ee,0x18c));var _0xea8e=function(_0x286e4d,_0x3634a9){_0x286e4d=_0x286e4d-0x0;var _0x22f784=_0xa8ee[_0x286e4d];return _0x22f784;};'use strict';var multer=require(_0xea8e('0x0'));var util=require('util');var path=require(_0xea8e('0x1'));var timeout=require(_0xea8e('0x2'));var express=require('express');var router=express[_0xea8e('0x3')]();var fs_extra=require(_0xea8e('0x4'));var auth=require(_0xea8e('0x5'));var interaction=require(_0xea8e('0x6'));var config=require(_0xea8e('0x7'));var controller=require(_0xea8e('0x8'));router[_0xea8e('0x9')]('/',auth['isAuthenticated'](),controller[_0xea8e('0xa')]);router[_0xea8e('0x9')](_0xea8e('0xb'),auth[_0xea8e('0xc')](),controller[_0xea8e('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xea8e('0xe')]);router['put'](_0xea8e('0xb'),auth[_0xea8e('0xc')](),controller[_0xea8e('0xf')]);router[_0xea8e('0x10')](_0xea8e('0xb'),auth[_0xea8e('0xc')](),controller[_0xea8e('0x11')]);module[_0xea8e('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 733f799..a003b22 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 _0xb78c=['name','setDataValue','join','getDataValue','options','split','BOOLEAN','exports','STRING'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xb78c,0x1c0));var _0xcb78=function(_0x38616d,_0x22fbe5){_0x38616d=_0x38616d-0x0;var _0x505626=_0xb78c[_0x38616d];return _0x505626;};'use strict';var Sequelize=require('sequelize');module[_0xcb78('0x0')]={'name':{'type':Sequelize[_0xcb78('0x1')]},'prefix':{'type':Sequelize[_0xcb78('0x1')],'unique':_0xcb78('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0xcb78('0x1')],'set':function(_0x1eaf46){this[_0xcb78('0x3')]('options',_0x1eaf46?_0x1eaf46[_0xcb78('0x4')](''):[]);},'get':function(){return this[_0xcb78('0x5')](_0xcb78('0x6'))?this[_0xcb78('0x5')](_0xcb78('0x6'))[_0xcb78('0x7')](''):[];}},'auth':{'type':Sequelize[_0xcb78('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xcb78('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xcb78('0x1')]},'description':{'type':Sequelize[_0xcb78('0x1')]}}; \ No newline at end of file +var _0xdafa=['setDataValue','options','join','getDataValue','split','BOOLEAN','exports','STRING','name'];(function(_0x393438,_0x4883a6){var _0x2a0986=function(_0x15a93b){while(--_0x15a93b){_0x393438['push'](_0x393438['shift']());}};_0x2a0986(++_0x4883a6);}(_0xdafa,0x189));var _0xadaf=function(_0x1f3736,_0x410d19){_0x1f3736=_0x1f3736-0x0;var _0x1f92e8=_0xdafa[_0x1f3736];return _0x1f92e8;};'use strict';var Sequelize=require('sequelize');module[_0xadaf('0x0')]={'name':{'type':Sequelize[_0xadaf('0x1')]},'prefix':{'type':Sequelize[_0xadaf('0x1')],'unique':_0xadaf('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x41ed50){this[_0xadaf('0x3')](_0xadaf('0x4'),_0x41ed50?_0x41ed50[_0xadaf('0x5')](''):[]);},'get':function(){return this[_0xadaf('0x6')](_0xadaf('0x4'))?this[_0xadaf('0x6')](_0xadaf('0x4'))[_0xadaf('0x7')](''):[];}},'auth':{'type':Sequelize[_0xadaf('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xadaf('0x1')]},'record':{'type':Sequelize[_0xadaf('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xadaf('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 72c3a45..a767fcd 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 _0x5ab4=['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','end','status','json','offset','limit','count','set','apply','reject','save','then','get','UserProfileResource','error','send','index','VoiceChanSpy','rawAttributes','fieldName','type','key','query','filters','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','findAll','rows','show','keys','intersection','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChanSpies','UserProfileSection','userProfileId','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto'];(function(_0x36918b,_0x1704cb){var _0x17a97f=function(_0xff39ec){while(--_0xff39ec){_0x36918b['push'](_0x36918b['shift']());}};_0x17a97f(++_0x1704cb);}(_0x5ab4,0x9f));var _0x45ab=function(_0x949b88,_0xb83c3b){_0x949b88=_0x949b88-0x0;var _0x1c8f4d=_0x5ab4[_0x949b88];return _0x1c8f4d;};'use strict';var emlformat=require(_0x45ab('0x0'));var rimraf=require(_0x45ab('0x1'));var zipdir=require(_0x45ab('0x2'));var jsonpatch=require(_0x45ab('0x3'));var rp=require(_0x45ab('0x4'));var moment=require('moment');var BPromise=require(_0x45ab('0x5'));var Mustache=require(_0x45ab('0x6'));var util=require(_0x45ab('0x7'));var path=require(_0x45ab('0x8'));var sox=require(_0x45ab('0x9'));var csv=require(_0x45ab('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x45ab('0xb'));var _=require(_0x45ab('0xc'));var squel=require(_0x45ab('0xd'));var crypto=require(_0x45ab('0xe'));var jsforce=require(_0x45ab('0xf'));var deskjs=require(_0x45ab('0x10'));var toCsv=require(_0x45ab('0xa'));var querystring=require(_0x45ab('0x11'));var Papa=require(_0x45ab('0x12'));var Redis=require(_0x45ab('0x13'));var authService=require(_0x45ab('0x14'));var qs=require(_0x45ab('0x15'));var as=require(_0x45ab('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x45ab('0x17'))(_0x45ab('0x18'));var utils=require(_0x45ab('0x19'));var config=require(_0x45ab('0x1a'));var licenseUtil=require(_0x45ab('0x1b'));var db=require(_0x45ab('0x1c'))['db'];function respondWithStatusCode(_0x1f509a,_0x46bbc4){_0x46bbc4=_0x46bbc4||0xcc;return function(_0x288913){if(_0x288913){return _0x1f509a['sendStatus'](_0x46bbc4);}return _0x1f509a['status'](_0x46bbc4)[_0x45ab('0x1d')]();};}function respondWithResult(_0x3402ca,_0x224165){_0x224165=_0x224165||0xc8;return function(_0x2b26d3){if(_0x2b26d3){return _0x3402ca[_0x45ab('0x1e')](_0x224165)[_0x45ab('0x1f')](_0x2b26d3);}};}function respondWithFilteredResult(_0x1e6325,_0xdc85c5){return function(_0x4bc375){if(_0x4bc375){var _0x40611f=typeof _0xdc85c5[_0x45ab('0x20')]==='undefined'&&typeof _0xdc85c5[_0x45ab('0x21')]==='undefined';var _0x4b5e24=_0x4bc375[_0x45ab('0x22')];var _0x46ef46=_0x40611f?0x0:_0xdc85c5[_0x45ab('0x20')];var _0xac7ce0=_0x40611f?_0x4bc375[_0x45ab('0x22')]:_0xdc85c5['offset']+_0xdc85c5[_0x45ab('0x21')];var _0x1478d6;if(_0xac7ce0>=_0x4b5e24){_0xac7ce0=_0x4b5e24;_0x1478d6=0xc8;}else{_0x1478d6=0xce;}_0x1e6325[_0x45ab('0x1e')](_0x1478d6);return _0x1e6325[_0x45ab('0x23')]('Content-Range',_0x46ef46+'-'+_0xac7ce0+'/'+_0x4b5e24)[_0x45ab('0x1f')](_0x4bc375);}return null;};}function patchUpdates(_0x54fdab){return function(_0x43d561){try{jsonpatch[_0x45ab('0x24')](_0x43d561,_0x54fdab,!![]);}catch(_0x2515ce){return BPromise[_0x45ab('0x25')](_0x2515ce);}return _0x43d561[_0x45ab('0x26')]();};}function saveUpdates(_0x5b9933,_0x16549e){return function(_0x1b3017){if(_0x1b3017){return _0x1b3017['update'](_0x5b9933)[_0x45ab('0x27')](function(_0x192fda){return _0x192fda;});}return null;};}function removeEntity(_0x74856a,_0x5b4859){return function(_0x229ead){if(_0x229ead){return _0x229ead['destroy']()['then'](function(){var _0x4d5fac=_0x229ead[_0x45ab('0x28')]({'plain':!![]});var _0x5d6aca='ChanSpies';return db[_0x45ab('0x29')]['destroy']({'where':{'type':_0x5d6aca,'resourceId':_0x4d5fac['id']}})[_0x45ab('0x27')](function(){return _0x229ead;});})[_0x45ab('0x27')](function(){_0x74856a[_0x45ab('0x1e')](0xcc)[_0x45ab('0x1d')]();});}};}function handleEntityNotFound(_0xe401db,_0x457514){return function(_0x5027e8){if(!_0x5027e8){_0xe401db['sendStatus'](0x194);}return _0x5027e8;};}function handleError(_0x1e96ad,_0x2c70cd){_0x2c70cd=_0x2c70cd||0x1f4;return function(_0x2bd621){logger[_0x45ab('0x2a')](_0x2bd621['stack']);if(_0x2bd621['name']){delete _0x2bd621['name'];}_0x1e96ad[_0x45ab('0x1e')](_0x2c70cd)[_0x45ab('0x2b')](_0x2bd621);};}exports[_0x45ab('0x2c')]=function(_0x2fcb43,_0x3994cf){var _0x4487e6={},_0x15e627={},_0x2eeb85={'count':0x0,'rows':[]};var _0xb7a809=_['map'](db[_0x45ab('0x2d')][_0x45ab('0x2e')],function(_0x5af73a){return{'name':_0x5af73a[_0x45ab('0x2f')],'type':_0x5af73a[_0x45ab('0x30')][_0x45ab('0x31')]};});_0x15e627['model']=_['map'](_0xb7a809,'name');_0x15e627[_0x45ab('0x32')]=_['keys'](_0x2fcb43[_0x45ab('0x32')]);_0x15e627[_0x45ab('0x33')]=_['intersection'](_0x15e627[_0x45ab('0x34')],_0x15e627[_0x45ab('0x32')]);_0x4487e6[_0x45ab('0x35')]=_['intersection'](_0x15e627[_0x45ab('0x34')],qs[_0x45ab('0x36')](_0x2fcb43[_0x45ab('0x32')][_0x45ab('0x36')]));_0x4487e6[_0x45ab('0x35')]=_0x4487e6['attributes'][_0x45ab('0x37')]?_0x4487e6[_0x45ab('0x35')]:_0x15e627['model'];if(!_0x2fcb43[_0x45ab('0x32')]['hasOwnProperty'](_0x45ab('0x38'))){_0x4487e6[_0x45ab('0x21')]=qs[_0x45ab('0x21')](_0x2fcb43[_0x45ab('0x32')]['limit']);_0x4487e6[_0x45ab('0x20')]=qs['offset'](_0x2fcb43['query'][_0x45ab('0x20')]);}_0x4487e6[_0x45ab('0x39')]=qs[_0x45ab('0x3a')](_0x2fcb43[_0x45ab('0x32')][_0x45ab('0x3a')]);_0x4487e6[_0x45ab('0x3b')]=qs['filters'](_[_0x45ab('0x3c')](_0x2fcb43[_0x45ab('0x32')],_0x15e627[_0x45ab('0x33')]),_0xb7a809);if(_0x2fcb43[_0x45ab('0x32')][_0x45ab('0x3d')]){_0x4487e6[_0x45ab('0x3b')]=_['merge'](_0x4487e6[_0x45ab('0x3b')],{'$or':_[_0x45ab('0x3e')](_0xb7a809,function(_0x365f70){if(_0x365f70['type']!==_0x45ab('0x3f')){var _0x19dd97={};_0x19dd97[_0x365f70['name']]={'$like':'%'+_0x2fcb43[_0x45ab('0x32')][_0x45ab('0x3d')]+'%'};return _0x19dd97;}})});}_0x4487e6=_[_0x45ab('0x40')]({},_0x4487e6,_0x2fcb43[_0x45ab('0x41')]);var _0x42b490={'where':_0x4487e6[_0x45ab('0x3b')]};return db[_0x45ab('0x2d')][_0x45ab('0x22')](_0x42b490)['then'](function(_0x41ac22){_0x2eeb85[_0x45ab('0x22')]=_0x41ac22;if(_0x2fcb43[_0x45ab('0x32')][_0x45ab('0x42')]){_0x4487e6['include']=[{'all':!![]}];}return db[_0x45ab('0x2d')][_0x45ab('0x43')](_0x4487e6);})['then'](function(_0x434d75){_0x2eeb85[_0x45ab('0x44')]=_0x434d75;return _0x2eeb85;})[_0x45ab('0x27')](respondWithFilteredResult(_0x3994cf,_0x4487e6))['catch'](handleError(_0x3994cf,null));};exports[_0x45ab('0x45')]=function(_0x4f4c0d,_0x353ff5){var _0x2a871e={'raw':![],'where':{'id':_0x4f4c0d['params']['id']}},_0xbbcfd1={};_0xbbcfd1['model']=_[_0x45ab('0x46')](db['VoiceChanSpy'][_0x45ab('0x2e')]);_0xbbcfd1[_0x45ab('0x32')]=_[_0x45ab('0x46')](_0x4f4c0d['query']);_0xbbcfd1[_0x45ab('0x33')]=_[_0x45ab('0x47')](_0xbbcfd1[_0x45ab('0x34')],_0xbbcfd1[_0x45ab('0x32')]);_0x2a871e[_0x45ab('0x35')]=_[_0x45ab('0x47')](_0xbbcfd1[_0x45ab('0x34')],qs['fields'](_0x4f4c0d[_0x45ab('0x32')]['fields']));_0x2a871e[_0x45ab('0x35')]=_0x2a871e[_0x45ab('0x35')][_0x45ab('0x37')]?_0x2a871e[_0x45ab('0x35')]:_0xbbcfd1[_0x45ab('0x34')];if(_0x4f4c0d[_0x45ab('0x32')][_0x45ab('0x42')]){_0x2a871e['include']=[{'all':!![]}];}_0x2a871e=_[_0x45ab('0x40')]({},_0x2a871e,_0x4f4c0d['options']);return db['VoiceChanSpy'][_0x45ab('0x48')](_0x2a871e)['then'](handleEntityNotFound(_0x353ff5,null))[_0x45ab('0x27')](respondWithResult(_0x353ff5,null))[_0x45ab('0x49')](handleError(_0x353ff5,null));};exports['create']=function(_0x126a43,_0xc77f26){return db[_0x45ab('0x2d')][_0x45ab('0x4a')](_0x126a43[_0x45ab('0x4b')],{})[_0x45ab('0x27')](function(_0x24c17c){var _0x58c80a=_0x126a43['user'][_0x45ab('0x28')]({'plain':!![]});if(!_0x58c80a)throw new Error(_0x45ab('0x4c'));if(_0x58c80a[_0x45ab('0x4d')]===_0x45ab('0x4e')){var _0x41fbaf=_0x24c17c[_0x45ab('0x28')]({'plain':!![]});var _0xf13632=_0x45ab('0x4f');return db[_0x45ab('0x50')][_0x45ab('0x48')]({'where':{'name':_0xf13632,'userProfileId':_0x58c80a[_0x45ab('0x51')]},'raw':!![]})[_0x45ab('0x27')](function(_0x4de175){if(_0x4de175&&_0x4de175['autoAssociation']===0x0){return db[_0x45ab('0x29')]['create']({'name':_0x41fbaf[_0x45ab('0x52')],'resourceId':_0x41fbaf['id'],'type':_0x4de175[_0x45ab('0x52')],'sectionId':_0x4de175['id']},{})['then'](function(){return _0x24c17c;});}else{return _0x24c17c;}})['catch'](function(_0x26f423){logger[_0x45ab('0x2a')](_0x45ab('0x53'),_0x26f423);throw _0x26f423;});}return _0x24c17c;})[_0x45ab('0x27')](respondWithResult(_0xc77f26,0xc9))[_0x45ab('0x49')](handleError(_0xc77f26,null));};exports[_0x45ab('0x54')]=function(_0x2f31cc,_0x2ee47c){if(_0x2f31cc[_0x45ab('0x4b')]['id']){delete _0x2f31cc['body']['id'];}return db[_0x45ab('0x2d')][_0x45ab('0x48')]({'where':{'id':_0x2f31cc[_0x45ab('0x55')]['id']}})['then'](handleEntityNotFound(_0x2ee47c,null))[_0x45ab('0x27')](saveUpdates(_0x2f31cc[_0x45ab('0x4b')],null))[_0x45ab('0x27')](respondWithResult(_0x2ee47c,null))['catch'](handleError(_0x2ee47c,null));};exports[_0x45ab('0x56')]=function(_0x20974d,_0x50051a){return db[_0x45ab('0x2d')][_0x45ab('0x48')]({'where':{'id':_0x20974d[_0x45ab('0x55')]['id']}})[_0x45ab('0x27')](handleEntityNotFound(_0x50051a,null))[_0x45ab('0x27')](removeEntity(_0x50051a,null))[_0x45ab('0x49')](handleError(_0x50051a,null));}; \ No newline at end of file +var _0x22dd=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit','offset','set','Content-Range','reject','save','update','then','ChanSpies','UserProfileResource','destroy','end','stack','name','send','map','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','VIRTUAL','merge','options','VoiceChanSpy','count','includeAll','findAll','rows','catch','params','include','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x1ba359,_0x3e140f){var _0x5f2b12=function(_0x52afbb){while(--_0x52afbb){_0x1ba359['push'](_0x1ba359['shift']());}};_0x5f2b12(++_0x3e140f);}(_0x22dd,0xe4));var _0xd22d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x22dd[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd22d('0x0'));var rimraf=require(_0xd22d('0x1'));var zipdir=require(_0xd22d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd22d('0x3'));var BPromise=require(_0xd22d('0x4'));var Mustache=require(_0xd22d('0x5'));var util=require(_0xd22d('0x6'));var path=require(_0xd22d('0x7'));var sox=require(_0xd22d('0x8'));var csv=require(_0xd22d('0x9'));var ejs=require(_0xd22d('0xa'));var fs=require('fs');var fs_extra=require(_0xd22d('0xb'));var _=require(_0xd22d('0xc'));var squel=require('squel');var crypto=require(_0xd22d('0xd'));var jsforce=require(_0xd22d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd22d('0x9'));var querystring=require('querystring');var Papa=require(_0xd22d('0xf'));var Redis=require('ioredis');var authService=require(_0xd22d('0x10'));var qs=require(_0xd22d('0x11'));var as=require(_0xd22d('0x12'));var hardwareService=require(_0xd22d('0x13'));var logger=require(_0xd22d('0x14'))(_0xd22d('0x15'));var utils=require(_0xd22d('0x16'));var config=require(_0xd22d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd22d('0x18'))['db'];function respondWithStatusCode(_0x46f164,_0x51a8ea){_0x51a8ea=_0x51a8ea||0xcc;return function(_0x38978b){if(_0x38978b){return _0x46f164[_0xd22d('0x19')](_0x51a8ea);}return _0x46f164['status'](_0x51a8ea)['end']();};}function respondWithResult(_0x5994fe,_0x156546){_0x156546=_0x156546||0xc8;return function(_0x5dc338){if(_0x5dc338){return _0x5994fe[_0xd22d('0x1a')](_0x156546)['json'](_0x5dc338);}};}function respondWithFilteredResult(_0x78d93e,_0x5b91bd){return function(_0x5027d){if(_0x5027d){var _0x377e75=typeof _0x5b91bd['offset']===_0xd22d('0x1b')&&typeof _0x5b91bd[_0xd22d('0x1c')]===_0xd22d('0x1b');var _0x11c410=_0x5027d['count'];var _0x5c516a=_0x377e75?0x0:_0x5b91bd[_0xd22d('0x1d')];var _0x5a0a0b=_0x377e75?_0x5027d['count']:_0x5b91bd['offset']+_0x5b91bd[_0xd22d('0x1c')];var _0x46f8b6;if(_0x5a0a0b>=_0x11c410){_0x5a0a0b=_0x11c410;_0x46f8b6=0xc8;}else{_0x46f8b6=0xce;}_0x78d93e[_0xd22d('0x1a')](_0x46f8b6);return _0x78d93e[_0xd22d('0x1e')](_0xd22d('0x1f'),_0x5c516a+'-'+_0x5a0a0b+'/'+_0x11c410)['json'](_0x5027d);}return null;};}function patchUpdates(_0x2bfc84){return function(_0x4e18f5){try{jsonpatch['apply'](_0x4e18f5,_0x2bfc84,!![]);}catch(_0x478c1f){return BPromise[_0xd22d('0x20')](_0x478c1f);}return _0x4e18f5[_0xd22d('0x21')]();};}function saveUpdates(_0x1ecab6,_0x420836){return function(_0x1be46f){if(_0x1be46f){return _0x1be46f[_0xd22d('0x22')](_0x1ecab6)[_0xd22d('0x23')](function(_0x52039a){return _0x52039a;});}return null;};}function removeEntity(_0x3b07b3,_0x8340e5){return function(_0x55bce9){if(_0x55bce9){return _0x55bce9['destroy']()[_0xd22d('0x23')](function(){var _0x5a2e1a=_0x55bce9['get']({'plain':!![]});var _0x2b0959=_0xd22d('0x24');return db[_0xd22d('0x25')][_0xd22d('0x26')]({'where':{'type':_0x2b0959,'resourceId':_0x5a2e1a['id']}})[_0xd22d('0x23')](function(){return _0x55bce9;});})[_0xd22d('0x23')](function(){_0x3b07b3[_0xd22d('0x1a')](0xcc)[_0xd22d('0x27')]();});}};}function handleEntityNotFound(_0x2f88a4,_0x53833a){return function(_0x198df9){if(!_0x198df9){_0x2f88a4[_0xd22d('0x19')](0x194);}return _0x198df9;};}function handleError(_0x51313a,_0x8f0d76){_0x8f0d76=_0x8f0d76||0x1f4;return function(_0x5f00f9){logger['error'](_0x5f00f9[_0xd22d('0x28')]);if(_0x5f00f9[_0xd22d('0x29')]){delete _0x5f00f9[_0xd22d('0x29')];}_0x51313a[_0xd22d('0x1a')](_0x8f0d76)[_0xd22d('0x2a')](_0x5f00f9);};}exports['index']=function(_0x39028b,_0x5b47f9){var _0x2424ce={},_0x89a93a={},_0x4b0635={'count':0x0,'rows':[]};var _0x905a7c=_[_0xd22d('0x2b')](db['VoiceChanSpy'][_0xd22d('0x2c')],function(_0x305f06){return{'name':_0x305f06['fieldName'],'type':_0x305f06[_0xd22d('0x2d')]['key']};});_0x89a93a[_0xd22d('0x2e')]=_[_0xd22d('0x2b')](_0x905a7c,'name');_0x89a93a[_0xd22d('0x2f')]=_[_0xd22d('0x30')](_0x39028b[_0xd22d('0x2f')]);_0x89a93a['filters']=_[_0xd22d('0x31')](_0x89a93a['model'],_0x89a93a['query']);_0x2424ce[_0xd22d('0x32')]=_['intersection'](_0x89a93a[_0xd22d('0x2e')],qs['fields'](_0x39028b[_0xd22d('0x2f')][_0xd22d('0x33')]));_0x2424ce['attributes']=_0x2424ce['attributes'][_0xd22d('0x34')]?_0x2424ce[_0xd22d('0x32')]:_0x89a93a[_0xd22d('0x2e')];if(!_0x39028b[_0xd22d('0x2f')][_0xd22d('0x35')](_0xd22d('0x36'))){_0x2424ce[_0xd22d('0x1c')]=qs['limit'](_0x39028b['query'][_0xd22d('0x1c')]);_0x2424ce[_0xd22d('0x1d')]=qs['offset'](_0x39028b[_0xd22d('0x2f')][_0xd22d('0x1d')]);}_0x2424ce['order']=qs['sort'](_0x39028b['query'][_0xd22d('0x37')]);_0x2424ce[_0xd22d('0x38')]=qs[_0xd22d('0x39')](_['pick'](_0x39028b[_0xd22d('0x2f')],_0x89a93a['filters']),_0x905a7c);if(_0x39028b['query'][_0xd22d('0x3a')]){_0x2424ce[_0xd22d('0x38')]=_['merge'](_0x2424ce[_0xd22d('0x38')],{'$or':_[_0xd22d('0x2b')](_0x905a7c,function(_0x31b3bb){if(_0x31b3bb['type']!==_0xd22d('0x3b')){var _0x448645={};_0x448645[_0x31b3bb[_0xd22d('0x29')]]={'$like':'%'+_0x39028b[_0xd22d('0x2f')][_0xd22d('0x3a')]+'%'};return _0x448645;}})});}_0x2424ce=_[_0xd22d('0x3c')]({},_0x2424ce,_0x39028b[_0xd22d('0x3d')]);var _0x2e8a91={'where':_0x2424ce['where']};return db[_0xd22d('0x3e')][_0xd22d('0x3f')](_0x2e8a91)[_0xd22d('0x23')](function(_0x1c5007){_0x4b0635['count']=_0x1c5007;if(_0x39028b[_0xd22d('0x2f')][_0xd22d('0x40')]){_0x2424ce['include']=[{'all':!![]}];}return db[_0xd22d('0x3e')][_0xd22d('0x41')](_0x2424ce);})[_0xd22d('0x23')](function(_0x9ecd41){_0x4b0635[_0xd22d('0x42')]=_0x9ecd41;return _0x4b0635;})[_0xd22d('0x23')](respondWithFilteredResult(_0x5b47f9,_0x2424ce))[_0xd22d('0x43')](handleError(_0x5b47f9,null));};exports['show']=function(_0x2eab4c,_0x5824b4){var _0xa8d59e={'raw':![],'where':{'id':_0x2eab4c[_0xd22d('0x44')]['id']}},_0x15a72b={};_0x15a72b[_0xd22d('0x2e')]=_['keys'](db[_0xd22d('0x3e')][_0xd22d('0x2c')]);_0x15a72b['query']=_[_0xd22d('0x30')](_0x2eab4c[_0xd22d('0x2f')]);_0x15a72b[_0xd22d('0x39')]=_['intersection'](_0x15a72b[_0xd22d('0x2e')],_0x15a72b[_0xd22d('0x2f')]);_0xa8d59e[_0xd22d('0x32')]=_[_0xd22d('0x31')](_0x15a72b[_0xd22d('0x2e')],qs['fields'](_0x2eab4c[_0xd22d('0x2f')][_0xd22d('0x33')]));_0xa8d59e[_0xd22d('0x32')]=_0xa8d59e[_0xd22d('0x32')][_0xd22d('0x34')]?_0xa8d59e[_0xd22d('0x32')]:_0x15a72b[_0xd22d('0x2e')];if(_0x2eab4c['query'][_0xd22d('0x40')]){_0xa8d59e[_0xd22d('0x45')]=[{'all':!![]}];}_0xa8d59e=_[_0xd22d('0x3c')]({},_0xa8d59e,_0x2eab4c[_0xd22d('0x3d')]);return db[_0xd22d('0x3e')]['find'](_0xa8d59e)[_0xd22d('0x23')](handleEntityNotFound(_0x5824b4,null))[_0xd22d('0x23')](respondWithResult(_0x5824b4,null))[_0xd22d('0x43')](handleError(_0x5824b4,null));};exports[_0xd22d('0x46')]=function(_0x1ac8e9,_0x1330c1){return db[_0xd22d('0x3e')]['create'](_0x1ac8e9['body'],{})['then'](function(_0x473adc){var _0x1077c1=_0x1ac8e9['user'][_0xd22d('0x47')]({'plain':!![]});if(!_0x1077c1)throw new Error(_0xd22d('0x48'));if(_0x1077c1[_0xd22d('0x49')]===_0xd22d('0x4a')){var _0x125b86=_0x473adc[_0xd22d('0x47')]({'plain':!![]});var _0x56cc5b=_0xd22d('0x24');return db['UserProfileSection'][_0xd22d('0x4b')]({'where':{'name':_0x56cc5b,'userProfileId':_0x1077c1[_0xd22d('0x4c')]},'raw':!![]})[_0xd22d('0x23')](function(_0x5d1244){if(_0x5d1244&&_0x5d1244[_0xd22d('0x4d')]===0x0){return db[_0xd22d('0x25')]['create']({'name':_0x125b86['name'],'resourceId':_0x125b86['id'],'type':_0x5d1244[_0xd22d('0x29')],'sectionId':_0x5d1244['id']},{})[_0xd22d('0x23')](function(){return _0x473adc;});}else{return _0x473adc;}})[_0xd22d('0x43')](function(_0x577870){logger[_0xd22d('0x4e')](_0xd22d('0x4f'),_0x577870);throw _0x577870;});}return _0x473adc;})[_0xd22d('0x23')](respondWithResult(_0x1330c1,0xc9))[_0xd22d('0x43')](handleError(_0x1330c1,null));};exports[_0xd22d('0x22')]=function(_0x2f49f9,_0x22a431){if(_0x2f49f9[_0xd22d('0x50')]['id']){delete _0x2f49f9[_0xd22d('0x50')]['id'];}return db[_0xd22d('0x3e')]['find']({'where':{'id':_0x2f49f9[_0xd22d('0x44')]['id']}})[_0xd22d('0x23')](handleEntityNotFound(_0x22a431,null))[_0xd22d('0x23')](saveUpdates(_0x2f49f9[_0xd22d('0x50')],null))[_0xd22d('0x23')](respondWithResult(_0x22a431,null))['catch'](handleError(_0x22a431,null));};exports[_0xd22d('0x26')]=function(_0xae8ed7,_0x112eee){return db[_0xd22d('0x3e')][_0xd22d('0x4b')]({'where':{'id':_0xae8ed7[_0xd22d('0x44')]['id']}})[_0xd22d('0x23')](handleEntityNotFound(_0x112eee,null))['then'](removeEntity(_0x112eee,null))[_0xd22d('0x43')](handleError(_0x112eee,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 7e06b9f..e322439 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 _0x4b8c=['VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','format','%s%s','prefix','system','push','merge','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','name','options','join','StopMixMonitor','internal','User','findAll','agent','then','catch','exports','define','VoiceChanSpy','voice_chanspy','length'];(function(_0x48be93,_0x4dd760){var _0x5d2d9a=function(_0x1ef85d){while(--_0x1ef85d){_0x48be93['push'](_0x48be93['shift']());}};_0x5d2d9a(++_0x4dd760);}(_0x4b8c,0x19a));var _0xc4b8=function(_0x11e00a,_0x220b34){_0x11e00a=_0x11e00a-0x0;var _0x74b738=_0x4b8c[_0x11e00a];return _0x74b738;};'use strict';var _=require(_0xc4b8('0x0'));var util=require(_0xc4b8('0x1'));var BPromise=require(_0xc4b8('0x2'));var attributes=require(_0xc4b8('0x3'));var getUserApplications=function(_0x5b50c8,_0xe227ad,_0x4c9ede){var _0x26191e=0x1;var _0x3b03c9=[];var _0x3ffff5={'context':_0xe227ad[_0xc4b8('0x4')]||'from-sip','exten':util[_0xc4b8('0x5')](_0xc4b8('0x6'),_0x5b50c8[_0xc4b8('0x7')],_0x4c9ede),'type':_0xc4b8('0x8'),'isApp':![],'ChanSpyId':_0x5b50c8['id'],'UserId':_0xe227ad['id']};_0x3b03c9[_0xc4b8('0x9')](_[_0xc4b8('0xa')]({'app':'Set','appdata':util[_0xc4b8('0x5')](_0xc4b8('0xb'),_0xc4b8('0xc')),'priority':_0x26191e++},_0x3ffff5));if(_0x5b50c8[_0xc4b8('0xd')]){_0x3b03c9[_0xc4b8('0x9')](_['merge']({'app':_0xc4b8('0xe'),'appdata':util[_0xc4b8('0x5')](_0xc4b8('0xf'),_0x5b50c8[_0xc4b8('0x10')]),'priority':_0x26191e++},_0x3ffff5));}if(_0x5b50c8[_0xc4b8('0x11')]){_0x3b03c9['push'](_[_0xc4b8('0xa')]({'app':_0xc4b8('0x12'),'appdata':_0x5b50c8['password'],'priority':_0x26191e++},_0x3ffff5));}_0x3b03c9[_0xc4b8('0x9')](_[_0xc4b8('0xa')]({'app':'ChanSpy','appdata':util[_0xc4b8('0x5')]('SIP/%s,%s',_0xe227ad[_0xc4b8('0x13')],_0x5b50c8[_0xc4b8('0x14')]?_0x5b50c8[_0xc4b8('0x14')][_0xc4b8('0x15')](''):''),'priority':_0x26191e++},_0x3ffff5));if(_0x5b50c8[_0xc4b8('0xd')]){_0x3b03c9[_0xc4b8('0x9')](_[_0xc4b8('0xa')]({'app':_0xc4b8('0x16'),'priority':_0x26191e++},_0x3ffff5));}return _0x3b03c9;};var getChanSpyApplications=function(_0x535d16,_0x432644){var _0x17e4bd=[];for(var _0x59ef5b=0x0,_0x58a1e9=0x1;_0x59ef5b<_0x432644['length'];_0x59ef5b++,_0x58a1e9=0x1){_0x17e4bd=_0x17e4bd['concat'](getUserApplications(_0x535d16,_0x432644[_0x59ef5b],_0x432644[_0x59ef5b][_0xc4b8('0x17')]));if(_0x432644[_0x59ef5b][_0xc4b8('0x17')]!=_0x432644[_0x59ef5b][_0xc4b8('0x13')]){_0x17e4bd=_0x17e4bd['concat'](getUserApplications(_0x535d16,_0x432644[_0x59ef5b],_0x432644[_0x59ef5b]['name']));}}return _0x17e4bd;};var getChanSpyPromise=function(_0x4189c6,_0x2eba74){return new BPromise(function(_0x302fb8,_0x1b336c){return _0x4189c6[_0xc4b8('0x18')][_0xc4b8('0x19')]({'attributes':['id',_0xc4b8('0x13'),_0xc4b8('0x17')],'where':{'role':_0xc4b8('0x1a'),'chanspy':!![]},'raw':!![]})[_0xc4b8('0x1b')](function(_0xb0a13e){if(_0xb0a13e){return _0x302fb8(getChanSpyApplications(_0x2eba74,_0xb0a13e));}return _0x302fb8([]);})[_0xc4b8('0x1c')](function(_0x37ad5d){_0x1b336c(_0x37ad5d);});});};module[_0xc4b8('0x1d')]=function(_0x2f67ea,_0x39282b){var _0x511313=_0x2f67ea['models'];return _0x2f67ea[_0xc4b8('0x1e')](_0xc4b8('0x1f'),attributes,{'tableName':_0xc4b8('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x6a0b23,_0x2b455f,_0x2e732f){return getChanSpyPromise(_0x511313,_0x6a0b23)['then'](function(_0x52d6a4){if(_0x52d6a4&&_0x52d6a4[_0xc4b8('0x21')]){return _0x511313[_0xc4b8('0x22')][_0xc4b8('0x23')](_0x52d6a4);}})[_0xc4b8('0x1b')](function(){_0x2e732f();})[_0xc4b8('0x1c')](function(_0x12c792){_0x2e732f(_0x12c792);});},'afterUpdate':function(_0x2259ab,_0x40df9e,_0xbcd5af){return _0x511313['VoiceExtension'][_0xc4b8('0x24')]({'where':{'ChanSpyId':_0x2259ab['id']}})[_0xc4b8('0x1b')](function(){return getChanSpyPromise(_0x511313,_0x2259ab);})[_0xc4b8('0x1b')](function(_0x552aac){if(_0x552aac&&_0x552aac[_0xc4b8('0x21')]){return _0x511313[_0xc4b8('0x22')][_0xc4b8('0x23')](_0x552aac);}})[_0xc4b8('0x1b')](function(){_0xbcd5af();})['catch'](function(_0x184f15){_0xbcd5af(_0x184f15);});},'afterDestroy':function(_0x57f31c,_0x3f05d9,_0x5ed5b5){return _0x511313[_0xc4b8('0x22')]['destroy']({'where':{'ChanSpyId':_0x57f31c['id']}})['then'](function(){_0x5ed5b5();})[_0xc4b8('0x1c')](function(_0x3a0576){_0x5ed5b5(_0x3a0576);});}}});}; \ No newline at end of file +var _0xfd07=['push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','ChanSpy','SIP/%s,%s','name','options','length','concat','internal','User','agent','then','exports','models','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','catch','destroy','lodash','bluebird','./voiceChanSpy.attributes','format','%s%s','prefix','system'];(function(_0x48aa8a,_0x4b0861){var _0x571817=function(_0x345167){while(--_0x345167){_0x48aa8a['push'](_0x48aa8a['shift']());}};_0x571817(++_0x4b0861);}(_0xfd07,0xad));var _0x7fd0=function(_0x1fb4e1,_0x3d4ce6){_0x1fb4e1=_0x1fb4e1-0x0;var _0x22d1b0=_0xfd07[_0x1fb4e1];return _0x22d1b0;};'use strict';var _=require(_0x7fd0('0x0'));var util=require('util');var BPromise=require(_0x7fd0('0x1'));var attributes=require(_0x7fd0('0x2'));var getUserApplications=function(_0x2a5582,_0x5d4266,_0x477f4e){var _0x32d7dd=0x1;var _0xe4f46=[];var _0x31ca86={'context':_0x5d4266['context']||'from-sip','exten':util[_0x7fd0('0x3')](_0x7fd0('0x4'),_0x2a5582[_0x7fd0('0x5')],_0x477f4e),'type':_0x7fd0('0x6'),'isApp':![],'ChanSpyId':_0x2a5582['id'],'UserId':_0x5d4266['id']};_0xe4f46[_0x7fd0('0x7')](_[_0x7fd0('0x8')]({'app':_0x7fd0('0x9'),'appdata':util['format'](_0x7fd0('0xa'),_0x7fd0('0xb')),'priority':_0x32d7dd++},_0x31ca86));if(_0x2a5582[_0x7fd0('0xc')]){_0xe4f46[_0x7fd0('0x7')](_[_0x7fd0('0x8')]({'app':_0x7fd0('0xd'),'appdata':util[_0x7fd0('0x3')](_0x7fd0('0xe'),_0x2a5582[_0x7fd0('0xf')]),'priority':_0x32d7dd++},_0x31ca86));}if(_0x2a5582[_0x7fd0('0x10')]){_0xe4f46[_0x7fd0('0x7')](_[_0x7fd0('0x8')]({'app':_0x7fd0('0x11'),'appdata':_0x2a5582['password'],'priority':_0x32d7dd++},_0x31ca86));}_0xe4f46[_0x7fd0('0x7')](_['merge']({'app':_0x7fd0('0x12'),'appdata':util[_0x7fd0('0x3')](_0x7fd0('0x13'),_0x5d4266[_0x7fd0('0x14')],_0x2a5582[_0x7fd0('0x15')]?_0x2a5582[_0x7fd0('0x15')]['join'](''):''),'priority':_0x32d7dd++},_0x31ca86));if(_0x2a5582['record']){_0xe4f46[_0x7fd0('0x7')](_[_0x7fd0('0x8')]({'app':'StopMixMonitor','priority':_0x32d7dd++},_0x31ca86));}return _0xe4f46;};var getChanSpyApplications=function(_0x597d4f,_0x2193d9){var _0x10c550=[];for(var _0x86e7b=0x0,_0x28e143=0x1;_0x86e7b<_0x2193d9[_0x7fd0('0x16')];_0x86e7b++,_0x28e143=0x1){_0x10c550=_0x10c550[_0x7fd0('0x17')](getUserApplications(_0x597d4f,_0x2193d9[_0x86e7b],_0x2193d9[_0x86e7b][_0x7fd0('0x18')]));if(_0x2193d9[_0x86e7b][_0x7fd0('0x18')]!=_0x2193d9[_0x86e7b][_0x7fd0('0x14')]){_0x10c550=_0x10c550[_0x7fd0('0x17')](getUserApplications(_0x597d4f,_0x2193d9[_0x86e7b],_0x2193d9[_0x86e7b][_0x7fd0('0x14')]));}}return _0x10c550;};var getChanSpyPromise=function(_0x38bd8e,_0x1f3bfd){return new BPromise(function(_0x49aeb1,_0x582d6a){return _0x38bd8e[_0x7fd0('0x19')]['findAll']({'attributes':['id',_0x7fd0('0x14'),'internal'],'where':{'role':_0x7fd0('0x1a'),'chanspy':!![]},'raw':!![]})[_0x7fd0('0x1b')](function(_0x4bcbb7){if(_0x4bcbb7){return _0x49aeb1(getChanSpyApplications(_0x1f3bfd,_0x4bcbb7));}return _0x49aeb1([]);})['catch'](function(_0x1c88f4){_0x582d6a(_0x1c88f4);});});};module[_0x7fd0('0x1c')]=function(_0x30307f,_0x303c82){var _0x3bb196=_0x30307f[_0x7fd0('0x1d')];return _0x30307f['define'](_0x7fd0('0x1e'),attributes,{'tableName':_0x7fd0('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x815ddb,_0x4ba35e,_0x31bac1){return getChanSpyPromise(_0x3bb196,_0x815ddb)[_0x7fd0('0x1b')](function(_0x549f6c){if(_0x549f6c&&_0x549f6c[_0x7fd0('0x16')]){return _0x3bb196[_0x7fd0('0x20')][_0x7fd0('0x21')](_0x549f6c);}})['then'](function(){_0x31bac1();})[_0x7fd0('0x22')](function(_0x2012f8){_0x31bac1(_0x2012f8);});},'afterUpdate':function(_0x47676a,_0x33864d,_0x180ef6){return _0x3bb196[_0x7fd0('0x20')][_0x7fd0('0x23')]({'where':{'ChanSpyId':_0x47676a['id']}})[_0x7fd0('0x1b')](function(){return getChanSpyPromise(_0x3bb196,_0x47676a);})[_0x7fd0('0x1b')](function(_0x1e5885){if(_0x1e5885&&_0x1e5885['length']){return _0x3bb196[_0x7fd0('0x20')]['bulkCreate'](_0x1e5885);}})[_0x7fd0('0x1b')](function(){_0x180ef6();})['catch'](function(_0x58ba93){_0x180ef6(_0x58ba93);});},'afterDestroy':function(_0x5c5ea0,_0x492994,_0x32d415){return _0x3bb196[_0x7fd0('0x20')][_0x7fd0('0x23')]({'where':{'ChanSpyId':_0x5c5ea0['id']}})[_0x7fd0('0x1b')](function(){_0x32d415();})['catch'](function(_0x2ff1c2){_0x32d415(_0x2ff1c2);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 8d97440..139d806 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 _0x3c81=['VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3428ca,_0x5a035c){var _0x4da854=function(_0x528dd7){while(--_0x528dd7){_0x3428ca['push'](_0x3428ca['shift']());}};_0x4da854(++_0x5a035c);}(_0x3c81,0x102));var _0x13c8=function(_0x54ce4a,_0x2de6b9){_0x54ce4a=_0x54ce4a-0x0;var _0x234153=_0x3c81[_0x54ce4a];return _0x234153;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var moment=require('moment');var BPromise=require(_0x13c8('0x2'));var rs=require(_0x13c8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x13c8('0x4'));var config=require(_0x13c8('0x5'));var jayson=require(_0x13c8('0x6'));var client=jayson[_0x13c8('0x7')][_0x13c8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f0bd2,_0x445b69,_0x4f7bcc){return new BPromise(function(_0x17c228,_0x4905c3){return client[_0x13c8('0x9')](_0x3f0bd2,_0x4f7bcc)[_0x13c8('0xa')](function(_0x189ce6){logger[_0x13c8('0xb')](_0x13c8('0xc'),_0x445b69,_0x13c8('0xd'));logger[_0x13c8('0xe')](_0x13c8('0xf'),_0x445b69,_0x13c8('0xd'),JSON[_0x13c8('0x10')](_0x189ce6));if(_0x189ce6[_0x13c8('0x11')]){if(_0x189ce6[_0x13c8('0x11')][_0x13c8('0x12')]===0x1f4){logger[_0x13c8('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x445b69,_0x189ce6[_0x13c8('0x11')][_0x13c8('0x13')]);return _0x4905c3(_0x189ce6[_0x13c8('0x11')][_0x13c8('0x13')]);}logger['error'](_0x13c8('0xc'),_0x445b69,_0x189ce6['error']['message']);return _0x17c228(_0x189ce6['error'][_0x13c8('0x13')]);}else{logger['info'](_0x13c8('0xc'),_0x445b69,_0x13c8('0xd'));_0x17c228(_0x189ce6[_0x13c8('0x14')][_0x13c8('0x13')]);}})['catch'](function(_0x13a9e1){logger[_0x13c8('0x11')](_0x13c8('0xc'),_0x445b69,_0x13a9e1);_0x4905c3(_0x13a9e1);});});} \ No newline at end of file +var _0x867f=['then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x432d38,_0x201399){var _0x39c577=function(_0x436c2a){while(--_0x436c2a){_0x432d38['push'](_0x432d38['shift']());}};_0x39c577(++_0x201399);}(_0x867f,0xe6));var _0xf867=function(_0x3d5db9,_0x2dbe0a){_0x3d5db9=_0x3d5db9-0x0;var _0x3c114c=_0x867f[_0x3d5db9];return _0x3c114c;};'use strict';var _=require(_0xf867('0x0'));var util=require(_0xf867('0x1'));var moment=require(_0xf867('0x2'));var BPromise=require(_0xf867('0x3'));var rs=require(_0xf867('0x4'));var fs=require('fs');var Redis=require(_0xf867('0x5'));var db=require(_0xf867('0x6'))['db'];var utils=require(_0xf867('0x7'));var logger=require(_0xf867('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf867('0x9'));var client=jayson[_0xf867('0xa')][_0xf867('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2841d1,_0x3fe5d1,_0x5c35f9){return new BPromise(function(_0x583f87,_0x26cfba){return client['request'](_0x2841d1,_0x5c35f9)[_0xf867('0xc')](function(_0x2b1c12){logger[_0xf867('0xd')](_0xf867('0xe'),_0x3fe5d1,_0xf867('0xf'));logger[_0xf867('0x10')](_0xf867('0x11'),_0x3fe5d1,_0xf867('0xf'),JSON['stringify'](_0x2b1c12));if(_0x2b1c12[_0xf867('0x12')]){if(_0x2b1c12['error']['code']===0x1f4){logger[_0xf867('0x12')](_0xf867('0xe'),_0x3fe5d1,_0x2b1c12[_0xf867('0x12')]['message']);return _0x26cfba(_0x2b1c12['error'][_0xf867('0x13')]);}logger['error'](_0xf867('0xe'),_0x3fe5d1,_0x2b1c12['error']['message']);return _0x583f87(_0x2b1c12[_0xf867('0x12')][_0xf867('0x13')]);}else{logger[_0xf867('0xd')](_0xf867('0xe'),_0x3fe5d1,_0xf867('0xf'));_0x583f87(_0x2b1c12[_0xf867('0x14')][_0xf867('0x13')]);}})[_0xf867('0x15')](function(_0x33c10b){logger['error'](_0xf867('0xe'),_0x3fe5d1,_0x33c10b);_0x26cfba(_0x33c10b);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 8bac887..c0edb33 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 _0x2798=['./voiceContext.controller','get','isAuthenticated','/:id','show','post','create','put','update','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment'];(function(_0x39e9dd,_0x46cc61){var _0x34896b=function(_0x394afa){while(--_0x394afa){_0x39e9dd['push'](_0x39e9dd['shift']());}};_0x34896b(++_0x46cc61);}(_0x2798,0xaa));var _0x8279=function(_0x60cf00,_0x4bd822){_0x60cf00=_0x60cf00-0x0;var _0x12fb1e=_0x2798[_0x60cf00];return _0x12fb1e;};'use strict';var multer=require(_0x8279('0x0'));var util=require('util');var path=require(_0x8279('0x1'));var timeout=require(_0x8279('0x2'));var express=require('express');var router=express[_0x8279('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8279('0x4'));var config=require(_0x8279('0x5'));var controller=require(_0x8279('0x6'));router[_0x8279('0x7')]('/',auth[_0x8279('0x8')](),controller['index']);router[_0x8279('0x7')](_0x8279('0x9'),auth[_0x8279('0x8')](),controller[_0x8279('0xa')]);router[_0x8279('0xb')]('/',auth['isAuthenticated'](),controller[_0x8279('0xc')]);router[_0x8279('0xd')](_0x8279('0x9'),auth[_0x8279('0x8')](),controller[_0x8279('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x8279('0xf')]=router; \ No newline at end of file +var _0x37c3=['exports','util','path','connect-timeout','Router','fs-extra','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','put','destroy'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x37c3,0x189));var _0x337c=function(_0x22fbd6,_0x23df25){_0x22fbd6=_0x22fbd6-0x0;var _0x46d67a=_0x37c3[_0x22fbd6];return _0x46d67a;};'use strict';var multer=require('multer');var util=require(_0x337c('0x0'));var path=require(_0x337c('0x1'));var timeout=require(_0x337c('0x2'));var express=require('express');var router=express[_0x337c('0x3')]();var fs_extra=require(_0x337c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x337c('0x5'));var controller=require(_0x337c('0x6'));router[_0x337c('0x7')]('/',auth[_0x337c('0x8')](),controller[_0x337c('0x9')]);router[_0x337c('0x7')](_0x337c('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x337c('0x8')](),controller['create']);router[_0x337c('0xb')](_0x337c('0xa'),auth[_0x337c('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x337c('0xc')]);module[_0x337c('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index c7d0e15..fd73059 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 _0xfe26=['sequelize','STRING','name'];(function(_0x327143,_0x158d1a){var _0x530193=function(_0x372702){while(--_0x372702){_0x327143['push'](_0x327143['shift']());}};_0x530193(++_0x158d1a);}(_0xfe26,0x102));var _0x6fe2=function(_0x46e17f,_0x14829a){_0x46e17f=_0x46e17f-0x0;var _0x3d5f9f=_0xfe26[_0x46e17f];return _0x3d5f9f;};'use strict';var Sequelize=require(_0x6fe2('0x0'));module['exports']={'name':{'type':Sequelize[_0x6fe2('0x1')],'unique':_0x6fe2('0x2')},'description':{'type':Sequelize[_0x6fe2('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5161=['exports','STRING','BOOLEAN'];(function(_0x3a31e5,_0x54ea1c){var _0x2dad4e=function(_0x21a037){while(--_0x21a037){_0x3a31e5['push'](_0x3a31e5['shift']());}};_0x2dad4e(++_0x54ea1c);}(_0x5161,0xf0));var _0x1516=function(_0x778308,_0x11788c){_0x778308=_0x778308-0x0;var _0x49b697=_0x5161[_0x778308];return _0x49b697;};'use strict';var Sequelize=require('sequelize');module[_0x1516('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0x1516('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x1516('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 758c1dd..e6c6cd6 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 _0xc0d4=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','apply','reject','save','update','then','Contexts','UserProfileResource','destroy','end','stack','name','index','key','model','map','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','VoiceContext','findAll','rows','params','rawAttributes','find','create','body','join','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get','UserProfileSection','userProfileId','autoAssociation'];(function(_0x1de751,_0x3b3293){var _0x126937=function(_0x396a93){while(--_0x396a93){_0x1de751['push'](_0x1de751['shift']());}};_0x126937(++_0x3b3293);}(_0xc0d4,0x69));var _0x4c0d=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0xc0d4[_0x13ce0c];return _0x4388fb;};'use strict';var emlformat=require(_0x4c0d('0x0'));var rimraf=require(_0x4c0d('0x1'));var zipdir=require(_0x4c0d('0x2'));var jsonpatch=require(_0x4c0d('0x3'));var rp=require(_0x4c0d('0x4'));var moment=require(_0x4c0d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4c0d('0x6'));var util=require(_0x4c0d('0x7'));var path=require(_0x4c0d('0x8'));var sox=require(_0x4c0d('0x9'));var csv=require('to-csv');var ejs=require(_0x4c0d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4c0d('0xb'));var squel=require(_0x4c0d('0xc'));var crypto=require(_0x4c0d('0xd'));var jsforce=require(_0x4c0d('0xe'));var deskjs=require(_0x4c0d('0xf'));var toCsv=require(_0x4c0d('0x10'));var querystring=require(_0x4c0d('0x11'));var Papa=require(_0x4c0d('0x12'));var Redis=require(_0x4c0d('0x13'));var authService=require(_0x4c0d('0x14'));var qs=require(_0x4c0d('0x15'));var as=require(_0x4c0d('0x16'));var hardwareService=require(_0x4c0d('0x17'));var logger=require(_0x4c0d('0x18'))(_0x4c0d('0x19'));var utils=require(_0x4c0d('0x1a'));var config=require(_0x4c0d('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x4c0d('0x1c'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x4c0d('0x1d')][_0x4c0d('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x48a465,_0x3487d4,_0x21ac5f,_0x51504b){return new BPromise(function(_0x40efe1,_0x233041){var _0x4a8969=_0x51504b||client;return _0x4a8969['request'](_0x48a465,_0x21ac5f)['then'](function(_0x5630c7){logger['info'](_0x4c0d('0x1f'),_0x3487d4,_0x4c0d('0x20'));logger[_0x4c0d('0x21')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3487d4,_0x4c0d('0x20'),JSON[_0x4c0d('0x22')](_0x5630c7));if(_0x5630c7['error']){if(_0x5630c7['error']['code']===0x1f4){logger[_0x4c0d('0x23')]('VoiceContext,\x20%s,\x20%s',_0x3487d4,_0x5630c7['error'][_0x4c0d('0x24')]);return _0x233041(_0x5630c7[_0x4c0d('0x23')][_0x4c0d('0x24')]);}logger[_0x4c0d('0x23')](_0x4c0d('0x1f'),_0x3487d4,_0x5630c7[_0x4c0d('0x23')]['message']);return _0x40efe1(_0x5630c7[_0x4c0d('0x23')][_0x4c0d('0x24')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x3487d4,_0x4c0d('0x20'));_0x40efe1(_0x5630c7[_0x4c0d('0x25')][_0x4c0d('0x24')]);}})[_0x4c0d('0x26')](function(_0x32b357){logger[_0x4c0d('0x23')](_0x4c0d('0x1f'),_0x3487d4,_0x32b357);_0x233041(_0x32b357);});});}function respondWithStatusCode(_0x38bdad,_0x477ce8){_0x477ce8=_0x477ce8||0xcc;return function(_0xda5dc3){if(_0xda5dc3){return _0x38bdad[_0x4c0d('0x27')](_0x477ce8);}return _0x38bdad[_0x4c0d('0x28')](_0x477ce8)['end']();};}function respondWithResult(_0x25cd84,_0x571f61){_0x571f61=_0x571f61||0xc8;return function(_0x2d811a){if(_0x2d811a){return _0x25cd84[_0x4c0d('0x28')](_0x571f61)[_0x4c0d('0x29')](_0x2d811a);}};}function respondWithFilteredResult(_0x3fb32a,_0x4e6818){return function(_0x4f6c89){if(_0x4f6c89){var _0x374e3b=typeof _0x4e6818[_0x4c0d('0x2a')]==='undefined'&&typeof _0x4e6818[_0x4c0d('0x2b')]===_0x4c0d('0x2c');var _0x12d457=_0x4f6c89[_0x4c0d('0x2d')];var _0x1b897f=_0x374e3b?0x0:_0x4e6818[_0x4c0d('0x2a')];var _0x34e2ff=_0x374e3b?_0x4f6c89[_0x4c0d('0x2d')]:_0x4e6818[_0x4c0d('0x2a')]+_0x4e6818[_0x4c0d('0x2b')];var _0x361d39;if(_0x34e2ff>=_0x12d457){_0x34e2ff=_0x12d457;_0x361d39=0xc8;}else{_0x361d39=0xce;}_0x3fb32a[_0x4c0d('0x28')](_0x361d39);return _0x3fb32a['set']('Content-Range',_0x1b897f+'-'+_0x34e2ff+'/'+_0x12d457)['json'](_0x4f6c89);}return null;};}function patchUpdates(_0x5cb99a){return function(_0x2d59ed){try{jsonpatch[_0x4c0d('0x2e')](_0x2d59ed,_0x5cb99a,!![]);}catch(_0x442cba){return BPromise[_0x4c0d('0x2f')](_0x442cba);}return _0x2d59ed[_0x4c0d('0x30')]();};}function saveUpdates(_0x4adc0a,_0x4886b5){return function(_0x2ffe85){if(_0x2ffe85){return _0x2ffe85[_0x4c0d('0x31')](_0x4adc0a)[_0x4c0d('0x32')](function(_0x513f8a){return _0x513f8a;});}return null;};}function removeEntity(_0xf3ddeb,_0x4c994f){return function(_0x23b9a7){if(_0x23b9a7){return _0x23b9a7['destroy']()[_0x4c0d('0x32')](function(){var _0x2f5260=_0x23b9a7['get']({'plain':!![]});var _0x3ad1f8=_0x4c0d('0x33');return db[_0x4c0d('0x34')][_0x4c0d('0x35')]({'where':{'type':_0x3ad1f8,'resourceId':_0x2f5260['id']}})['then'](function(){return _0x23b9a7;});})['then'](function(){_0xf3ddeb[_0x4c0d('0x28')](0xcc)[_0x4c0d('0x36')]();});}};}function handleEntityNotFound(_0x2f84b1,_0x4cde32){return function(_0x139fec){if(!_0x139fec){_0x2f84b1[_0x4c0d('0x27')](0x194);}return _0x139fec;};}function handleError(_0x5c29d0,_0x220052){_0x220052=_0x220052||0x1f4;return function(_0x28a0ae){logger['error'](_0x28a0ae[_0x4c0d('0x37')]);if(_0x28a0ae[_0x4c0d('0x38')]){delete _0x28a0ae[_0x4c0d('0x38')];}_0x5c29d0[_0x4c0d('0x28')](_0x220052)['send'](_0x28a0ae);};}exports[_0x4c0d('0x39')]=function(_0x31a29f,_0x20ecd2){var _0x1f85dc={},_0x130197={},_0x5ae80b={'count':0x0,'rows':[]};var _0x1eb5f6=_['map'](db['VoiceContext']['rawAttributes'],function(_0x5e3471){return{'name':_0x5e3471['fieldName'],'type':_0x5e3471['type'][_0x4c0d('0x3a')]};});_0x130197[_0x4c0d('0x3b')]=_[_0x4c0d('0x3c')](_0x1eb5f6,_0x4c0d('0x38'));_0x130197[_0x4c0d('0x3d')]=_[_0x4c0d('0x3e')](_0x31a29f[_0x4c0d('0x3d')]);_0x130197['filters']=_[_0x4c0d('0x3f')](_0x130197[_0x4c0d('0x3b')],_0x130197[_0x4c0d('0x3d')]);_0x1f85dc[_0x4c0d('0x40')]=_[_0x4c0d('0x3f')](_0x130197['model'],qs[_0x4c0d('0x41')](_0x31a29f[_0x4c0d('0x3d')][_0x4c0d('0x41')]));_0x1f85dc[_0x4c0d('0x40')]=_0x1f85dc[_0x4c0d('0x40')][_0x4c0d('0x42')]?_0x1f85dc[_0x4c0d('0x40')]:_0x130197[_0x4c0d('0x3b')];if(!_0x31a29f[_0x4c0d('0x3d')]['hasOwnProperty']('nolimit')){_0x1f85dc[_0x4c0d('0x2b')]=qs[_0x4c0d('0x2b')](_0x31a29f[_0x4c0d('0x3d')][_0x4c0d('0x2b')]);_0x1f85dc[_0x4c0d('0x2a')]=qs[_0x4c0d('0x2a')](_0x31a29f[_0x4c0d('0x3d')][_0x4c0d('0x2a')]);}_0x1f85dc[_0x4c0d('0x43')]=qs[_0x4c0d('0x44')](_0x31a29f[_0x4c0d('0x3d')][_0x4c0d('0x44')]);_0x1f85dc[_0x4c0d('0x45')]=qs[_0x4c0d('0x46')](_[_0x4c0d('0x47')](_0x31a29f[_0x4c0d('0x3d')],_0x130197['filters']),_0x1eb5f6);if(_0x31a29f[_0x4c0d('0x3d')][_0x4c0d('0x48')]){_0x1f85dc[_0x4c0d('0x45')]=_[_0x4c0d('0x49')](_0x1f85dc[_0x4c0d('0x45')],{'$or':_[_0x4c0d('0x3c')](_0x1eb5f6,function(_0xa991c9){if(_0xa991c9[_0x4c0d('0x4a')]!=='VIRTUAL'){var _0x334cbe={};_0x334cbe[_0xa991c9[_0x4c0d('0x38')]]={'$like':'%'+_0x31a29f[_0x4c0d('0x3d')][_0x4c0d('0x48')]+'%'};return _0x334cbe;}})});}_0x1f85dc=_[_0x4c0d('0x49')]({},_0x1f85dc,_0x31a29f[_0x4c0d('0x4b')]);var _0x2387e7={'where':_0x1f85dc['where']};return db['VoiceContext'][_0x4c0d('0x2d')](_0x2387e7)['then'](function(_0x2ef759){_0x5ae80b[_0x4c0d('0x2d')]=_0x2ef759;if(_0x31a29f[_0x4c0d('0x3d')][_0x4c0d('0x4c')]){_0x1f85dc[_0x4c0d('0x4d')]=[{'all':!![]}];}return db[_0x4c0d('0x4e')][_0x4c0d('0x4f')](_0x1f85dc);})[_0x4c0d('0x32')](function(_0x37e00d){_0x5ae80b[_0x4c0d('0x50')]=_0x37e00d;return _0x5ae80b;})[_0x4c0d('0x32')](respondWithFilteredResult(_0x20ecd2,_0x1f85dc))[_0x4c0d('0x26')](handleError(_0x20ecd2,null));};exports['show']=function(_0x121e4e,_0xc51ffa){var _0x568893={'raw':![],'where':{'id':_0x121e4e[_0x4c0d('0x51')]['id']}},_0x3f731f={};_0x3f731f[_0x4c0d('0x3b')]=_[_0x4c0d('0x3e')](db['VoiceContext'][_0x4c0d('0x52')]);_0x3f731f['query']=_[_0x4c0d('0x3e')](_0x121e4e[_0x4c0d('0x3d')]);_0x3f731f[_0x4c0d('0x46')]=_[_0x4c0d('0x3f')](_0x3f731f[_0x4c0d('0x3b')],_0x3f731f[_0x4c0d('0x3d')]);_0x568893[_0x4c0d('0x40')]=_['intersection'](_0x3f731f['model'],qs[_0x4c0d('0x41')](_0x121e4e['query'][_0x4c0d('0x41')]));_0x568893[_0x4c0d('0x40')]=_0x568893['attributes'][_0x4c0d('0x42')]?_0x568893['attributes']:_0x3f731f['model'];if(_0x121e4e['query']['includeAll']){_0x568893[_0x4c0d('0x4d')]=[{'all':!![]}];}_0x568893=_['merge']({},_0x568893,_0x121e4e[_0x4c0d('0x4b')]);return db[_0x4c0d('0x4e')][_0x4c0d('0x53')](_0x568893)[_0x4c0d('0x32')](handleEntityNotFound(_0xc51ffa,null))[_0x4c0d('0x32')](respondWithResult(_0xc51ffa,null))[_0x4c0d('0x26')](handleError(_0xc51ffa,null));};exports[_0x4c0d('0x54')]=function(_0x38d347,_0x94f07,_0x17a3c8){var _0x32fc03;return db[_0x4c0d('0x4e')]['create'](_0x38d347[_0x4c0d('0x55')],{'raw':!![]})['then'](function(_0x29c6ee){_0x32fc03=_0x29c6ee;return db['VoiceContext'][_0x4c0d('0x4f')]({'raw':!![]});})[_0x4c0d('0x32')](function(_0x3733cd){var _0x4fc59b=fs['readFileSync'](path[_0x4c0d('0x56')](config['root'],_0x4c0d('0x57')),_0x4c0d('0x58'));var _0x555a65=ejs[_0x4c0d('0x59')](_0x4fc59b,{'contexts':_0x3733cd||[]});fs[_0x4c0d('0x5a')](_0x4c0d('0x5b'),_0x555a65);})[_0x4c0d('0x32')](function(){return respondWithRpcPromise(_0x4c0d('0x5c'),_0x4c0d('0x54'),{'module':_0x4c0d('0x5d')});})[_0x4c0d('0x32')](function(){var _0x942a1d=_0x38d347[_0x4c0d('0x5e')]['get']({'plain':!![]});if(!_0x942a1d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x942a1d['role']===_0x4c0d('0x5e')){var _0x314364=_0x32fc03[_0x4c0d('0x5f')]({'plain':!![]});return db[_0x4c0d('0x60')][_0x4c0d('0x53')]({'where':{'name':_0x4c0d('0x33'),'userProfileId':_0x942a1d[_0x4c0d('0x61')]},'raw':!![]})[_0x4c0d('0x32')](function(_0x1d38ff){if(_0x1d38ff&&_0x1d38ff[_0x4c0d('0x62')]===0x0){return db[_0x4c0d('0x34')][_0x4c0d('0x54')]({'name':_0x314364['name'],'resourceId':_0x314364['id'],'type':_0x1d38ff[_0x4c0d('0x38')],'sectionId':_0x1d38ff['id']},{})['then'](function(){return _0x32fc03;});}else{return _0x32fc03;}})[_0x4c0d('0x26')](function(_0x4bf3a7){logger[_0x4c0d('0x23')](_0x4c0d('0x63'),_0x4bf3a7);throw _0x4bf3a7;});}return _0x32fc03;})[_0x4c0d('0x32')](respondWithResult(_0x94f07,0xc9))[_0x4c0d('0x26')](handleError(_0x94f07,null));};exports[_0x4c0d('0x31')]=function(_0xc15bdc,_0x33354f,_0xda0984){var _0x461090;return db[_0x4c0d('0x4e')][_0x4c0d('0x53')]({'where':{'id':_0xc15bdc[_0x4c0d('0x51')]['id']}})[_0x4c0d('0x32')](handleEntityNotFound(_0x33354f,null))[_0x4c0d('0x32')](saveUpdates(_0xc15bdc[_0x4c0d('0x55')],null))[_0x4c0d('0x32')](function(_0x14fcef){if(_0x14fcef){_0x461090=_0x14fcef;return db[_0x4c0d('0x4e')][_0x4c0d('0x4f')]({'raw':!![]});}})[_0x4c0d('0x32')](function(_0x535430){var _0x4cd6e7=fs[_0x4c0d('0x64')](path[_0x4c0d('0x56')](config[_0x4c0d('0x65')],_0x4c0d('0x57')),_0x4c0d('0x58'));var _0x2abe09=ejs[_0x4c0d('0x59')](_0x4cd6e7,{'contexts':_0x535430||[]});fs[_0x4c0d('0x5a')](_0x4c0d('0x5b'),_0x2abe09);})[_0x4c0d('0x32')](function(){return respondWithRpcPromise(_0x4c0d('0x5c'),_0x4c0d('0x31'),{'module':_0x4c0d('0x5d')});})[_0x4c0d('0x32')](function(){return _0x461090;})[_0x4c0d('0x32')](respondWithResult(_0x33354f,null))[_0x4c0d('0x26')](handleError(_0x33354f,null));};exports['destroy']=function(_0x1366ef,_0x373aab,_0x1ed0fd){var _0x44585b;return db[_0x4c0d('0x4e')][_0x4c0d('0x53')]({'where':{'id':_0x1366ef[_0x4c0d('0x51')]['id']}})[_0x4c0d('0x32')](handleEntityNotFound(_0x373aab,null))[_0x4c0d('0x32')](removeEntity(_0x373aab,null))[_0x4c0d('0x32')](function(){return db[_0x4c0d('0x4e')]['findAll']({'raw':!![]});})[_0x4c0d('0x32')](function(_0x345313){var _0x4a8d44=fs[_0x4c0d('0x64')](path[_0x4c0d('0x56')](config[_0x4c0d('0x65')],_0x4c0d('0x57')),_0x4c0d('0x58'));var _0x2e5711=ejs[_0x4c0d('0x59')](_0x4a8d44,{'contexts':_0x345313});fs[_0x4c0d('0x5a')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x2e5711);return respondWithRpcPromise(_0x4c0d('0x5c'),_0x4c0d('0x35'),{'module':'chan_sip.so'});})[_0x4c0d('0x26')](handleError(_0x373aab,null));}; \ No newline at end of file +var _0xeb87=['utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','client','http','info','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VoiceContext,\x20%s,\x20%s','result','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','get','Contexts','UserProfileResource','destroy','stack','name','send','map','VoiceContext','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','rows','catch','show','params','length','includeAll','find','create','findAll','readFileSync','join','root','server/files/templates/context.ejs'];(function(_0x49c7bd,_0x1432db){var _0x1ba37d=function(_0x30f525){while(--_0x30f525){_0x49c7bd['push'](_0x49c7bd['shift']());}};_0x1ba37d(++_0x1432db);}(_0xeb87,0xe3));var _0x7eb8=function(_0x5e30e2,_0x594580){_0x5e30e2=_0x5e30e2-0x0;var _0x1549f9=_0xeb87[_0x5e30e2];return _0x1549f9;};'use strict';var emlformat=require(_0x7eb8('0x0'));var rimraf=require(_0x7eb8('0x1'));var zipdir=require(_0x7eb8('0x2'));var jsonpatch=require(_0x7eb8('0x3'));var rp=require(_0x7eb8('0x4'));var moment=require(_0x7eb8('0x5'));var BPromise=require(_0x7eb8('0x6'));var Mustache=require('mustache');var util=require(_0x7eb8('0x7'));var path=require(_0x7eb8('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7eb8('0x9'));var fs=require('fs');var fs_extra=require(_0x7eb8('0xa'));var _=require(_0x7eb8('0xb'));var squel=require(_0x7eb8('0xc'));var crypto=require(_0x7eb8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7eb8('0xe'));var toCsv=require(_0x7eb8('0xf'));var querystring=require(_0x7eb8('0x10'));var Papa=require(_0x7eb8('0x11'));var Redis=require(_0x7eb8('0x12'));var authService=require(_0x7eb8('0x13'));var qs=require(_0x7eb8('0x14'));var as=require(_0x7eb8('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7eb8('0x16'))(_0x7eb8('0x17'));var utils=require(_0x7eb8('0x18'));var config=require(_0x7eb8('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x7eb8('0x1a')][_0x7eb8('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x48ab35,_0x2524ba,_0x1853c3,_0x362b94){return new BPromise(function(_0x489b86,_0x34b264){var _0x5145e4=_0x362b94||client;return _0x5145e4['request'](_0x48ab35,_0x1853c3)['then'](function(_0x33074b){logger[_0x7eb8('0x1c')]('VoiceContext,\x20%s,\x20%s',_0x2524ba,'request\x20sent');logger[_0x7eb8('0x1d')](_0x7eb8('0x1e'),_0x2524ba,_0x7eb8('0x1f'),JSON[_0x7eb8('0x20')](_0x33074b));if(_0x33074b[_0x7eb8('0x21')]){if(_0x33074b[_0x7eb8('0x21')][_0x7eb8('0x22')]===0x1f4){logger[_0x7eb8('0x21')]('VoiceContext,\x20%s,\x20%s',_0x2524ba,_0x33074b[_0x7eb8('0x21')][_0x7eb8('0x23')]);return _0x34b264(_0x33074b[_0x7eb8('0x21')][_0x7eb8('0x23')]);}logger['error'](_0x7eb8('0x24'),_0x2524ba,_0x33074b[_0x7eb8('0x21')][_0x7eb8('0x23')]);return _0x489b86(_0x33074b[_0x7eb8('0x21')][_0x7eb8('0x23')]);}else{logger['info'](_0x7eb8('0x24'),_0x2524ba,_0x7eb8('0x1f'));_0x489b86(_0x33074b[_0x7eb8('0x25')][_0x7eb8('0x23')]);}})['catch'](function(_0x121fbc){logger[_0x7eb8('0x21')]('VoiceContext,\x20%s,\x20%s',_0x2524ba,_0x121fbc);_0x34b264(_0x121fbc);});});}function respondWithStatusCode(_0x4ae27c,_0x184c01){_0x184c01=_0x184c01||0xcc;return function(_0x1fa25e){if(_0x1fa25e){return _0x4ae27c[_0x7eb8('0x26')](_0x184c01);}return _0x4ae27c['status'](_0x184c01)[_0x7eb8('0x27')]();};}function respondWithResult(_0x438b45,_0x557799){_0x557799=_0x557799||0xc8;return function(_0x29b9c4){if(_0x29b9c4){return _0x438b45[_0x7eb8('0x28')](_0x557799)[_0x7eb8('0x29')](_0x29b9c4);}};}function respondWithFilteredResult(_0x3c94e0,_0x1338d2){return function(_0x3406a1){if(_0x3406a1){var _0xd6e468=typeof _0x1338d2[_0x7eb8('0x2a')]==='undefined'&&typeof _0x1338d2[_0x7eb8('0x2b')]===_0x7eb8('0x2c');var _0x5880e5=_0x3406a1[_0x7eb8('0x2d')];var _0x23b961=_0xd6e468?0x0:_0x1338d2[_0x7eb8('0x2a')];var _0x6cd2e6=_0xd6e468?_0x3406a1[_0x7eb8('0x2d')]:_0x1338d2['offset']+_0x1338d2[_0x7eb8('0x2b')];var _0x52d522;if(_0x6cd2e6>=_0x5880e5){_0x6cd2e6=_0x5880e5;_0x52d522=0xc8;}else{_0x52d522=0xce;}_0x3c94e0[_0x7eb8('0x28')](_0x52d522);return _0x3c94e0[_0x7eb8('0x2e')]('Content-Range',_0x23b961+'-'+_0x6cd2e6+'/'+_0x5880e5)[_0x7eb8('0x29')](_0x3406a1);}return null;};}function patchUpdates(_0x201106){return function(_0x929ac7){try{jsonpatch[_0x7eb8('0x2f')](_0x929ac7,_0x201106,!![]);}catch(_0x53f943){return BPromise[_0x7eb8('0x30')](_0x53f943);}return _0x929ac7[_0x7eb8('0x31')]();};}function saveUpdates(_0x567857,_0x3f56d6){return function(_0x13d0d4){if(_0x13d0d4){return _0x13d0d4[_0x7eb8('0x32')](_0x567857)[_0x7eb8('0x33')](function(_0x7198da){return _0x7198da;});}return null;};}function removeEntity(_0x407dc1,_0x2e8a63){return function(_0x4fc930){if(_0x4fc930){return _0x4fc930['destroy']()['then'](function(){var _0x11e799=_0x4fc930[_0x7eb8('0x34')]({'plain':!![]});var _0x542841=_0x7eb8('0x35');return db[_0x7eb8('0x36')][_0x7eb8('0x37')]({'where':{'type':_0x542841,'resourceId':_0x11e799['id']}})[_0x7eb8('0x33')](function(){return _0x4fc930;});})['then'](function(){_0x407dc1[_0x7eb8('0x28')](0xcc)[_0x7eb8('0x27')]();});}};}function handleEntityNotFound(_0x401424,_0x1c3293){return function(_0x3184cc){if(!_0x3184cc){_0x401424['sendStatus'](0x194);}return _0x3184cc;};}function handleError(_0x1b87d7,_0x5bf7ec){_0x5bf7ec=_0x5bf7ec||0x1f4;return function(_0x30c90a){logger[_0x7eb8('0x21')](_0x30c90a[_0x7eb8('0x38')]);if(_0x30c90a[_0x7eb8('0x39')]){delete _0x30c90a[_0x7eb8('0x39')];}_0x1b87d7[_0x7eb8('0x28')](_0x5bf7ec)[_0x7eb8('0x3a')](_0x30c90a);};}exports['index']=function(_0xbe7a3f,_0x37bdb9){var _0x4c92d5={},_0xf80864={},_0x8811fc={'count':0x0,'rows':[]};var _0x4bae8=_[_0x7eb8('0x3b')](db[_0x7eb8('0x3c')][_0x7eb8('0x3d')],function(_0x2161a7){return{'name':_0x2161a7['fieldName'],'type':_0x2161a7['type'][_0x7eb8('0x3e')]};});_0xf80864[_0x7eb8('0x3f')]=_['map'](_0x4bae8,'name');_0xf80864[_0x7eb8('0x40')]=_[_0x7eb8('0x41')](_0xbe7a3f['query']);_0xf80864[_0x7eb8('0x42')]=_[_0x7eb8('0x43')](_0xf80864[_0x7eb8('0x3f')],_0xf80864[_0x7eb8('0x40')]);_0x4c92d5['attributes']=_[_0x7eb8('0x43')](_0xf80864[_0x7eb8('0x3f')],qs['fields'](_0xbe7a3f['query'][_0x7eb8('0x44')]));_0x4c92d5[_0x7eb8('0x45')]=_0x4c92d5[_0x7eb8('0x45')]['length']?_0x4c92d5[_0x7eb8('0x45')]:_0xf80864[_0x7eb8('0x3f')];if(!_0xbe7a3f[_0x7eb8('0x40')][_0x7eb8('0x46')]('nolimit')){_0x4c92d5[_0x7eb8('0x2b')]=qs[_0x7eb8('0x2b')](_0xbe7a3f[_0x7eb8('0x40')]['limit']);_0x4c92d5[_0x7eb8('0x2a')]=qs[_0x7eb8('0x2a')](_0xbe7a3f['query'][_0x7eb8('0x2a')]);}_0x4c92d5[_0x7eb8('0x47')]=qs[_0x7eb8('0x48')](_0xbe7a3f[_0x7eb8('0x40')]['sort']);_0x4c92d5[_0x7eb8('0x49')]=qs[_0x7eb8('0x42')](_[_0x7eb8('0x4a')](_0xbe7a3f[_0x7eb8('0x40')],_0xf80864['filters']),_0x4bae8);if(_0xbe7a3f[_0x7eb8('0x40')][_0x7eb8('0x4b')]){_0x4c92d5[_0x7eb8('0x49')]=_[_0x7eb8('0x4c')](_0x4c92d5[_0x7eb8('0x49')],{'$or':_[_0x7eb8('0x3b')](_0x4bae8,function(_0x483217){if(_0x483217[_0x7eb8('0x4d')]!==_0x7eb8('0x4e')){var _0x501b59={};_0x501b59[_0x483217[_0x7eb8('0x39')]]={'$like':'%'+_0xbe7a3f[_0x7eb8('0x40')][_0x7eb8('0x4b')]+'%'};return _0x501b59;}})});}_0x4c92d5=_[_0x7eb8('0x4c')]({},_0x4c92d5,_0xbe7a3f[_0x7eb8('0x4f')]);var _0x5123b7={'where':_0x4c92d5[_0x7eb8('0x49')]};return db[_0x7eb8('0x3c')]['count'](_0x5123b7)['then'](function(_0x2b0cd3){_0x8811fc[_0x7eb8('0x2d')]=_0x2b0cd3;if(_0xbe7a3f[_0x7eb8('0x40')]['includeAll']){_0x4c92d5[_0x7eb8('0x50')]=[{'all':!![]}];}return db[_0x7eb8('0x3c')]['findAll'](_0x4c92d5);})['then'](function(_0x3657f2){_0x8811fc[_0x7eb8('0x51')]=_0x3657f2;return _0x8811fc;})[_0x7eb8('0x33')](respondWithFilteredResult(_0x37bdb9,_0x4c92d5))[_0x7eb8('0x52')](handleError(_0x37bdb9,null));};exports[_0x7eb8('0x53')]=function(_0x2f57bb,_0x8196f){var _0x26bf61={'raw':![],'where':{'id':_0x2f57bb[_0x7eb8('0x54')]['id']}},_0x10acd5={};_0x10acd5[_0x7eb8('0x3f')]=_[_0x7eb8('0x41')](db[_0x7eb8('0x3c')][_0x7eb8('0x3d')]);_0x10acd5[_0x7eb8('0x40')]=_[_0x7eb8('0x41')](_0x2f57bb[_0x7eb8('0x40')]);_0x10acd5[_0x7eb8('0x42')]=_['intersection'](_0x10acd5['model'],_0x10acd5['query']);_0x26bf61['attributes']=_[_0x7eb8('0x43')](_0x10acd5[_0x7eb8('0x3f')],qs[_0x7eb8('0x44')](_0x2f57bb['query']['fields']));_0x26bf61[_0x7eb8('0x45')]=_0x26bf61['attributes'][_0x7eb8('0x55')]?_0x26bf61[_0x7eb8('0x45')]:_0x10acd5[_0x7eb8('0x3f')];if(_0x2f57bb[_0x7eb8('0x40')][_0x7eb8('0x56')]){_0x26bf61['include']=[{'all':!![]}];}_0x26bf61=_['merge']({},_0x26bf61,_0x2f57bb[_0x7eb8('0x4f')]);return db[_0x7eb8('0x3c')][_0x7eb8('0x57')](_0x26bf61)[_0x7eb8('0x33')](handleEntityNotFound(_0x8196f,null))['then'](respondWithResult(_0x8196f,null))[_0x7eb8('0x52')](handleError(_0x8196f,null));};exports[_0x7eb8('0x58')]=function(_0x2df167,_0x677027,_0x4807ac){var _0xcf64a2;return db[_0x7eb8('0x3c')][_0x7eb8('0x58')](_0x2df167['body'],{'raw':!![]})[_0x7eb8('0x33')](function(_0x2a8614){_0xcf64a2=_0x2a8614;return db[_0x7eb8('0x3c')][_0x7eb8('0x59')]({'raw':!![]});})['then'](function(_0x3bbc6f){var _0x72accd=fs[_0x7eb8('0x5a')](path[_0x7eb8('0x5b')](config[_0x7eb8('0x5c')],_0x7eb8('0x5d')),_0x7eb8('0x5e'));var _0x17f065=ejs[_0x7eb8('0x5f')](_0x72accd,{'contexts':_0x3bbc6f||[]});fs[_0x7eb8('0x60')](_0x7eb8('0x61'),_0x17f065);})[_0x7eb8('0x33')](function(){return respondWithRpcPromise(_0x7eb8('0x62'),'create',{'module':_0x7eb8('0x63')});})[_0x7eb8('0x33')](function(){var _0x12a398=_0x2df167[_0x7eb8('0x64')][_0x7eb8('0x34')]({'plain':!![]});if(!_0x12a398)throw new Error(_0x7eb8('0x65'));if(_0x12a398[_0x7eb8('0x66')]===_0x7eb8('0x64')){var _0x4a98c5=_0xcf64a2[_0x7eb8('0x34')]({'plain':!![]});return db[_0x7eb8('0x67')][_0x7eb8('0x57')]({'where':{'name':_0x7eb8('0x35'),'userProfileId':_0x12a398[_0x7eb8('0x68')]},'raw':!![]})[_0x7eb8('0x33')](function(_0x1a0bdc){if(_0x1a0bdc&&_0x1a0bdc[_0x7eb8('0x69')]===0x0){return db[_0x7eb8('0x36')][_0x7eb8('0x58')]({'name':_0x4a98c5[_0x7eb8('0x39')],'resourceId':_0x4a98c5['id'],'type':_0x1a0bdc[_0x7eb8('0x39')],'sectionId':_0x1a0bdc['id']},{})['then'](function(){return _0xcf64a2;});}else{return _0xcf64a2;}})[_0x7eb8('0x52')](function(_0x2fc733){logger[_0x7eb8('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2fc733);throw _0x2fc733;});}return _0xcf64a2;})[_0x7eb8('0x33')](respondWithResult(_0x677027,0xc9))[_0x7eb8('0x52')](handleError(_0x677027,null));};exports[_0x7eb8('0x32')]=function(_0x4027ab,_0x4bb4b1,_0x4168f3){var _0xfbb95f;return db[_0x7eb8('0x3c')]['find']({'where':{'id':_0x4027ab[_0x7eb8('0x54')]['id']}})[_0x7eb8('0x33')](handleEntityNotFound(_0x4bb4b1,null))[_0x7eb8('0x33')](saveUpdates(_0x4027ab[_0x7eb8('0x6a')],null))[_0x7eb8('0x33')](function(_0x1f267c){if(_0x1f267c){_0xfbb95f=_0x1f267c;return db[_0x7eb8('0x3c')]['findAll']({'raw':!![]});}})[_0x7eb8('0x33')](function(_0x42a5b0){var _0x1e45e5=fs[_0x7eb8('0x5a')](path['join'](config[_0x7eb8('0x5c')],_0x7eb8('0x5d')),'utf8');var _0x35ae6c=ejs[_0x7eb8('0x5f')](_0x1e45e5,{'contexts':_0x42a5b0||[]});fs[_0x7eb8('0x60')](_0x7eb8('0x61'),_0x35ae6c);})[_0x7eb8('0x33')](function(){return respondWithRpcPromise(_0x7eb8('0x62'),_0x7eb8('0x32'),{'module':_0x7eb8('0x63')});})[_0x7eb8('0x33')](function(){return _0xfbb95f;})[_0x7eb8('0x33')](respondWithResult(_0x4bb4b1,null))[_0x7eb8('0x52')](handleError(_0x4bb4b1,null));};exports[_0x7eb8('0x37')]=function(_0x22f8e8,_0x3fe53a,_0x3e654e){var _0x30ef0f;return db[_0x7eb8('0x3c')]['find']({'where':{'id':_0x22f8e8[_0x7eb8('0x54')]['id']}})[_0x7eb8('0x33')](handleEntityNotFound(_0x3fe53a,null))[_0x7eb8('0x33')](removeEntity(_0x3fe53a,null))[_0x7eb8('0x33')](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0x7eb8('0x33')](function(_0x5e0ef5){var _0x276e6a=fs['readFileSync'](path[_0x7eb8('0x5b')](config[_0x7eb8('0x5c')],'server/files/templates/context.ejs'),_0x7eb8('0x5e'));var _0x39d97c=ejs['render'](_0x276e6a,{'contexts':_0x5e0ef5});fs[_0x7eb8('0x60')](_0x7eb8('0x61'),_0x39d97c);return respondWithRpcPromise(_0x7eb8('0x62'),'destroy',{'module':'chan_sip.so'});})[_0x7eb8('0x52')](handleError(_0x3fe53a,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index de3f066..4a6e52d 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 _0x9ea4=['rimraf','../../config/environment','./voiceContext.attributes','exports','VoiceContext','voice_contexts','util','api','moment','request-promise','path'];(function(_0x1dcaa3,_0x4601c6){var _0xf670fc=function(_0x27b6b7){while(--_0x27b6b7){_0x1dcaa3['push'](_0x1dcaa3['shift']());}};_0xf670fc(++_0x4601c6);}(_0x9ea4,0xc1));var _0x49ea=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9ea4[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0x49ea('0x0'));var logger=require('../../config/logger')(_0x49ea('0x1'));var moment=require(_0x49ea('0x2'));var BPromise=require('bluebird');var rp=require(_0x49ea('0x3'));var fs=require('fs');var path=require(_0x49ea('0x4'));var rimraf=require(_0x49ea('0x5'));var config=require(_0x49ea('0x6'));var attributes=require(_0x49ea('0x7'));module[_0x49ea('0x8')]=function(_0x4df95f,_0x23032a){return _0x4df95f['define'](_0x49ea('0x9'),attributes,{'tableName':_0x49ea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa280=['request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','VoiceContext','voice_contexts','util','../../config/logger','bluebird'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa280,0x126));var _0x0a28=function(_0x5c842e,_0x27a58d){_0x5c842e=_0x5c842e-0x0;var _0x52cac8=_0xa280[_0x5c842e];return _0x52cac8;};'use strict';var _=require('lodash');var util=require(_0x0a28('0x0'));var logger=require(_0x0a28('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0a28('0x2'));var rp=require(_0x0a28('0x3'));var fs=require('fs');var path=require(_0x0a28('0x4'));var rimraf=require(_0x0a28('0x5'));var config=require(_0x0a28('0x6'));var attributes=require(_0x0a28('0x7'));module[_0x0a28('0x8')]=function(_0x12faad,_0x1dae54){return _0x12faad['define'](_0x0a28('0x9'),attributes,{'tableName':_0x0a28('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 ee02ee5..783a844 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 _0x2e21=['request','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5b25d0,_0x50ee52){var _0x29dfe6=function(_0x34a53d){while(--_0x34a53d){_0x5b25d0['push'](_0x5b25d0['shift']());}};_0x29dfe6(++_0x50ee52);}(_0x2e21,0xba));var _0x12e2=function(_0x5185bf,_0x2a92a8){_0x5185bf=_0x5185bf-0x0;var _0x4fc5b0=_0x2e21[_0x5185bf];return _0x4fc5b0;};'use strict';var _=require(_0x12e2('0x0'));var util=require(_0x12e2('0x1'));var moment=require(_0x12e2('0x2'));var BPromise=require('bluebird');var rs=require(_0x12e2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x12e2('0x4'))['db'];var utils=require(_0x12e2('0x5'));var logger=require(_0x12e2('0x6'))(_0x12e2('0x7'));var config=require(_0x12e2('0x8'));var jayson=require(_0x12e2('0x9'));var client=jayson[_0x12e2('0xa')][_0x12e2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f52d6,_0x2a7059,_0x321e79){return new BPromise(function(_0x372494,_0x4a53a2){return client[_0x12e2('0xc')](_0x2f52d6,_0x321e79)['then'](function(_0xf7ae46){logger['info'](_0x12e2('0xd'),_0x2a7059,_0x12e2('0xe'));logger[_0x12e2('0xf')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x2a7059,_0x12e2('0xe'),JSON[_0x12e2('0x10')](_0xf7ae46));if(_0xf7ae46['error']){if(_0xf7ae46[_0x12e2('0x11')]['code']===0x1f4){logger[_0x12e2('0x11')]('VoiceContext,\x20%s,\x20%s',_0x2a7059,_0xf7ae46[_0x12e2('0x11')][_0x12e2('0x12')]);return _0x4a53a2(_0xf7ae46[_0x12e2('0x11')][_0x12e2('0x12')]);}logger[_0x12e2('0x11')](_0x12e2('0xd'),_0x2a7059,_0xf7ae46[_0x12e2('0x11')][_0x12e2('0x12')]);return _0x372494(_0xf7ae46[_0x12e2('0x11')]['message']);}else{logger[_0x12e2('0x13')](_0x12e2('0xd'),_0x2a7059,_0x12e2('0xe'));_0x372494(_0xf7ae46[_0x12e2('0x14')][_0x12e2('0x12')]);}})[_0x12e2('0x15')](function(_0x18e557){logger[_0x12e2('0x11')](_0x12e2('0xd'),_0x2a7059,_0x18e557);_0x4a53a2(_0x18e557);});});} \ No newline at end of file +var _0xa478=['http','then','info','request\x20sent','debug','error','code','message','VoiceContext,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0xa478,0x136));var _0x8a47=function(_0x3f3f06,_0x581e5b){_0x3f3f06=_0x3f3f06-0x0;var _0x140feb=_0xa478[_0x3f3f06];return _0x140feb;};'use strict';var _=require(_0x8a47('0x0'));var util=require(_0x8a47('0x1'));var moment=require(_0x8a47('0x2'));var BPromise=require(_0x8a47('0x3'));var rs=require(_0x8a47('0x4'));var fs=require('fs');var Redis=require(_0x8a47('0x5'));var db=require(_0x8a47('0x6'))['db'];var utils=require(_0x8a47('0x7'));var logger=require(_0x8a47('0x8'))(_0x8a47('0x9'));var config=require(_0x8a47('0xa'));var jayson=require(_0x8a47('0xb'));var client=jayson['client'][_0x8a47('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d62a6,_0x3de815,_0x3cb340){return new BPromise(function(_0x56884b,_0x384886){return client['request'](_0x2d62a6,_0x3cb340)[_0x8a47('0xd')](function(_0x369fc9){logger[_0x8a47('0xe')]('VoiceContext,\x20%s,\x20%s',_0x3de815,_0x8a47('0xf'));logger[_0x8a47('0x10')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3de815,_0x8a47('0xf'),JSON['stringify'](_0x369fc9));if(_0x369fc9[_0x8a47('0x11')]){if(_0x369fc9[_0x8a47('0x11')][_0x8a47('0x12')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x3de815,_0x369fc9['error'][_0x8a47('0x13')]);return _0x384886(_0x369fc9[_0x8a47('0x11')]['message']);}logger[_0x8a47('0x11')](_0x8a47('0x14'),_0x3de815,_0x369fc9[_0x8a47('0x11')][_0x8a47('0x13')]);return _0x56884b(_0x369fc9[_0x8a47('0x11')][_0x8a47('0x13')]);}else{logger[_0x8a47('0xe')](_0x8a47('0x14'),_0x3de815,_0x8a47('0xf'));_0x56884b(_0x369fc9[_0x8a47('0x15')][_0x8a47('0x13')]);}})[_0x8a47('0x16')](function(_0x2917d9){logger['error'](_0x8a47('0x14'),_0x3de815,_0x2917d9);_0x384886(_0x2917d9);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 9967483..82054b1 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 _0x46a4=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe'];(function(_0x5b9692,_0x1e4e4c){var _0x4a32f0=function(_0x234655){while(--_0x234655){_0x5b9692['push'](_0x5b9692['shift']());}};_0x4a32f0(++_0x1e4e4c);}(_0x46a4,0x190));var _0x446a=function(_0x2cb98f,_0x111ee0){_0x2cb98f=_0x2cb98f-0x0;var _0xd77c55=_0x46a4[_0x2cb98f];return _0xd77c55;};'use strict';var multer=require(_0x446a('0x0'));var util=require(_0x446a('0x1'));var path=require('path');var timeout=require(_0x446a('0x2'));var express=require(_0x446a('0x3'));var router=express[_0x446a('0x4')]();var fs_extra=require(_0x446a('0x5'));var auth=require(_0x446a('0x6'));var interaction=require(_0x446a('0x7'));var config=require(_0x446a('0x8'));var controller=require('./voiceDialReport.controller');router[_0x446a('0x9')]('/',auth['isAuthenticated'](),controller[_0x446a('0xa')]);router[_0x446a('0x9')](_0x446a('0xb'),auth[_0x446a('0xc')](),controller[_0x446a('0xd')]);router[_0x446a('0x9')](_0x446a('0xe'),auth[_0x446a('0xc')](),controller[_0x446a('0xf')]);router[_0x446a('0x10')]('/',auth[_0x446a('0xc')](),controller[_0x446a('0x11')]);router[_0x446a('0x12')](_0x446a('0xe'),auth[_0x446a('0xc')](),controller[_0x446a('0x13')]);router[_0x446a('0x14')](_0x446a('0xe'),auth[_0x446a('0xc')](),controller[_0x446a('0x15')]);module[_0x446a('0x16')]=router; \ No newline at end of file +var _0xccdc=['./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5e062b,_0x243270){var _0x1828d6=function(_0x2a3e88){while(--_0x2a3e88){_0x5e062b['push'](_0x5e062b['shift']());}};_0x1828d6(++_0x243270);}(_0xccdc,0x1c4));var _0xcccd=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0xccdc[_0xc0a3d3];return _0x3386e8;};'use strict';var multer=require(_0xcccd('0x0'));var util=require(_0xcccd('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcccd('0x2'));var router=express[_0xcccd('0x3')]();var fs_extra=require(_0xcccd('0x4'));var auth=require(_0xcccd('0x5'));var interaction=require(_0xcccd('0x6'));var config=require(_0xcccd('0x7'));var controller=require(_0xcccd('0x8'));router[_0xcccd('0x9')]('/',auth[_0xcccd('0xa')](),controller[_0xcccd('0xb')]);router['get'](_0xcccd('0xc'),auth[_0xcccd('0xa')](),controller[_0xcccd('0xd')]);router[_0xcccd('0x9')](_0xcccd('0xe'),auth[_0xcccd('0xa')](),controller[_0xcccd('0xf')]);router[_0xcccd('0x10')]('/',auth['isAuthenticated'](),controller[_0xcccd('0x11')]);router[_0xcccd('0x12')](_0xcccd('0xe'),auth[_0xcccd('0xa')](),controller[_0xcccd('0x13')]);router[_0xcccd('0x14')](_0xcccd('0xe'),auth[_0xcccd('0xa')](),controller[_0xcccd('0x15')]);module[_0xcccd('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 749b280..eb6cbb2 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 _0xf3cd=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x37ea6e,_0x5f46d9){var _0x534652=function(_0x5bf9c6){while(--_0x5bf9c6){_0x37ea6e['push'](_0x37ea6e['shift']());}};_0x534652(++_0x5f46d9);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x13b7fd,_0x4eaf7f){_0x13b7fd=_0x13b7fd-0x0;var _0x32a74a=_0xf3cd[_0x13b7fd];return _0x32a74a;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'privilege':{'type':Sequelize[_0xdf3c('0x2')]},'channel':{'type':Sequelize[_0xdf3c('0x2')]},'channelstate':{'type':Sequelize[_0xdf3c('0x3')]},'channelstatedesc':{'type':Sequelize[_0xdf3c('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xdf3c('0x2')]},'connectedlinenum':{'type':Sequelize[_0xdf3c('0x2')]},'connectedlinename':{'type':Sequelize[_0xdf3c('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xdf3c('0x2')]},'context':{'type':Sequelize[_0xdf3c('0x2')]},'exten':{'type':Sequelize[_0xdf3c('0x2')]},'priority':{'type':Sequelize[_0xdf3c('0x3')]},'uniqueid':{'type':Sequelize[_0xdf3c('0x2')]},'linkedid':{'type':Sequelize[_0xdf3c('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xdf3c('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xdf3c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xdf3c('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xdf3c('0x2')]},'destaccountcode':{'type':Sequelize[_0xdf3c('0x2')]},'destcontext':{'type':Sequelize[_0xdf3c('0x2')]},'destexten':{'type':Sequelize[_0xdf3c('0x2')]},'destpriority':{'type':Sequelize[_0xdf3c('0x3')]},'destuniqueid':{'type':Sequelize[_0xdf3c('0x2')]},'destlinkedid':{'type':Sequelize[_0xdf3c('0x2')]},'dialstring':{'type':Sequelize[_0xdf3c('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xdf3c('0x4')]},'answertime':{'type':Sequelize[_0xdf3c('0x4')]},'endtime':{'type':Sequelize[_0xdf3c('0x4')]},'lastevent':{'type':Sequelize[_0xdf3c('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xdf3c('0x3')]},'duration':{'type':Sequelize[_0xdf3c('0x3')]},'holdtime':{'type':Sequelize[_0xdf3c('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x228203,_0x30bafa){var _0x570468=function(_0x8285ec){while(--_0x8285ec){_0x228203['push'](_0x228203['shift']());}};_0x570468(++_0x30bafa);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x4d79bc,_0x32c905){_0x4d79bc=_0x4d79bc-0x0;var _0x4b4760=_0xf3cd[_0x4d79bc];return _0x4b4760;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'privilege':{'type':Sequelize[_0xdf3c('0x2')]},'channel':{'type':Sequelize[_0xdf3c('0x2')]},'channelstate':{'type':Sequelize[_0xdf3c('0x3')]},'channelstatedesc':{'type':Sequelize[_0xdf3c('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xdf3c('0x2')]},'connectedlinenum':{'type':Sequelize[_0xdf3c('0x2')]},'connectedlinename':{'type':Sequelize[_0xdf3c('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xdf3c('0x2')]},'context':{'type':Sequelize[_0xdf3c('0x2')]},'exten':{'type':Sequelize[_0xdf3c('0x2')]},'priority':{'type':Sequelize[_0xdf3c('0x3')]},'uniqueid':{'type':Sequelize[_0xdf3c('0x2')]},'linkedid':{'type':Sequelize[_0xdf3c('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xdf3c('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xdf3c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xdf3c('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xdf3c('0x2')]},'destaccountcode':{'type':Sequelize[_0xdf3c('0x2')]},'destcontext':{'type':Sequelize[_0xdf3c('0x2')]},'destexten':{'type':Sequelize[_0xdf3c('0x2')]},'destpriority':{'type':Sequelize[_0xdf3c('0x3')]},'destuniqueid':{'type':Sequelize[_0xdf3c('0x2')]},'destlinkedid':{'type':Sequelize[_0xdf3c('0x2')]},'dialstring':{'type':Sequelize[_0xdf3c('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xdf3c('0x4')]},'answertime':{'type':Sequelize[_0xdf3c('0x4')]},'endtime':{'type':Sequelize[_0xdf3c('0x4')]},'lastevent':{'type':Sequelize[_0xdf3c('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xdf3c('0x3')]},'duration':{'type':Sequelize[_0xdf3c('0x3')]},'holdtime':{'type':Sequelize[_0xdf3c('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 52ffb2b..662f231 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 _0x9c60=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','error','stack','name','send','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9c60,0x164));var _0x09c6=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c60[_0x565c49];return _0x20ca34;};'use strict';var emlformat=require(_0x09c6('0x0'));var rimraf=require(_0x09c6('0x1'));var zipdir=require(_0x09c6('0x2'));var jsonpatch=require(_0x09c6('0x3'));var rp=require(_0x09c6('0x4'));var moment=require(_0x09c6('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x09c6('0x6'));var path=require(_0x09c6('0x7'));var sox=require(_0x09c6('0x8'));var csv=require(_0x09c6('0x9'));var ejs=require(_0x09c6('0xa'));var fs=require('fs');var fs_extra=require(_0x09c6('0xb'));var _=require(_0x09c6('0xc'));var squel=require(_0x09c6('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x09c6('0xe'));var toCsv=require(_0x09c6('0x9'));var querystring=require(_0x09c6('0xf'));var Papa=require(_0x09c6('0x10'));var Redis=require(_0x09c6('0x11'));var authService=require(_0x09c6('0x12'));var qs=require(_0x09c6('0x13'));var as=require(_0x09c6('0x14'));var hardwareService=require(_0x09c6('0x15'));var logger=require(_0x09c6('0x16'))(_0x09c6('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x09c6('0x18'));var db=require(_0x09c6('0x19'))['db'];function respondWithStatusCode(_0x69c292,_0x5adeb9){_0x5adeb9=_0x5adeb9||0xcc;return function(_0x25f31c){if(_0x25f31c){return _0x69c292['sendStatus'](_0x5adeb9);}return _0x69c292[_0x09c6('0x1a')](_0x5adeb9)[_0x09c6('0x1b')]();};}function respondWithResult(_0x3e80a6,_0x12095c){_0x12095c=_0x12095c||0xc8;return function(_0x42a222){if(_0x42a222){return _0x3e80a6[_0x09c6('0x1a')](_0x12095c)[_0x09c6('0x1c')](_0x42a222);}};}function respondWithFilteredResult(_0x5c8959,_0x30fb56){return function(_0x506bbd){if(_0x506bbd){var _0x575124=typeof _0x30fb56[_0x09c6('0x1d')]===_0x09c6('0x1e')&&typeof _0x30fb56['limit']===_0x09c6('0x1e');var _0x272580=_0x506bbd[_0x09c6('0x1f')];var _0x2ad2ff=_0x575124?0x0:_0x30fb56[_0x09c6('0x1d')];var _0x4dd5f2=_0x575124?_0x506bbd[_0x09c6('0x1f')]:_0x30fb56[_0x09c6('0x1d')]+_0x30fb56['limit'];var _0x16c5e7;if(_0x4dd5f2>=_0x272580){_0x4dd5f2=_0x272580;_0x16c5e7=0xc8;}else{_0x16c5e7=0xce;}_0x5c8959[_0x09c6('0x1a')](_0x16c5e7);return _0x5c8959[_0x09c6('0x20')]('Content-Range',_0x2ad2ff+'-'+_0x4dd5f2+'/'+_0x272580)[_0x09c6('0x1c')](_0x506bbd);}return null;};}function patchUpdates(_0x1c1173){return function(_0x532d74){try{jsonpatch[_0x09c6('0x21')](_0x532d74,_0x1c1173,!![]);}catch(_0x346e34){return BPromise[_0x09c6('0x22')](_0x346e34);}return _0x532d74[_0x09c6('0x23')]();};}function saveUpdates(_0x1c5d75,_0x4c2b34){return function(_0x3e8a6b){if(_0x3e8a6b){return _0x3e8a6b[_0x09c6('0x24')](_0x1c5d75)[_0x09c6('0x25')](function(_0x3dc051){return _0x3dc051;});}return null;};}function removeEntity(_0x57f4ae,_0x1e7e3f){return function(_0x3ff04d){if(_0x3ff04d){return _0x3ff04d['destroy']()['then'](function(){_0x57f4ae[_0x09c6('0x1a')](0xcc)[_0x09c6('0x1b')]();});}};}function handleEntityNotFound(_0x4c6040,_0x3563f5){return function(_0x114660){if(!_0x114660){_0x4c6040['sendStatus'](0x194);}return _0x114660;};}function handleError(_0x5793ef,_0x83706d){_0x83706d=_0x83706d||0x1f4;return function(_0x49628d){logger[_0x09c6('0x26')](_0x49628d[_0x09c6('0x27')]);if(_0x49628d[_0x09c6('0x28')]){delete _0x49628d[_0x09c6('0x28')];}_0x5793ef['status'](_0x83706d)[_0x09c6('0x29')](_0x49628d);};}exports['index']=function(_0x477062,_0x182433){var _0x32f079={},_0xe2e13={},_0x428ed7={'count':0x0,'rows':[]};var _0x44383b=_['map'](db[_0x09c6('0x2a')][_0x09c6('0x2b')],function(_0x2712df){return{'name':_0x2712df[_0x09c6('0x2c')],'type':_0x2712df[_0x09c6('0x2d')][_0x09c6('0x2e')]};});_0xe2e13[_0x09c6('0x2f')]=_['map'](_0x44383b,_0x09c6('0x28'));_0xe2e13[_0x09c6('0x30')]=_[_0x09c6('0x31')](_0x477062['query']);_0xe2e13['filters']=_['intersection'](_0xe2e13[_0x09c6('0x2f')],_0xe2e13['query']);_0x32f079[_0x09c6('0x32')]=_[_0x09c6('0x33')](_0xe2e13[_0x09c6('0x2f')],qs[_0x09c6('0x34')](_0x477062[_0x09c6('0x30')][_0x09c6('0x34')]));_0x32f079[_0x09c6('0x32')]=_0x32f079['attributes']['length']?_0x32f079['attributes']:_0xe2e13[_0x09c6('0x2f')];if(!_0x477062['query'][_0x09c6('0x35')](_0x09c6('0x36'))){_0x32f079[_0x09c6('0x37')]=qs[_0x09c6('0x37')](_0x477062[_0x09c6('0x30')]['limit']);_0x32f079[_0x09c6('0x1d')]=qs[_0x09c6('0x1d')](_0x477062[_0x09c6('0x30')][_0x09c6('0x1d')]);}_0x32f079['order']=qs[_0x09c6('0x38')](_0x477062[_0x09c6('0x30')][_0x09c6('0x38')]);_0x32f079[_0x09c6('0x39')]=qs['filters'](_[_0x09c6('0x3a')](_0x477062['query'],_0xe2e13['filters']),_0x44383b);if(_0x477062[_0x09c6('0x30')][_0x09c6('0x3b')]){_0x32f079[_0x09c6('0x39')]=_['merge'](_0x32f079[_0x09c6('0x39')],{'$or':_[_0x09c6('0x3c')](_0x44383b,function(_0x14eb54){if(_0x14eb54['type']!==_0x09c6('0x3d')){var _0x351587={};_0x351587[_0x14eb54[_0x09c6('0x28')]]={'$like':'%'+_0x477062[_0x09c6('0x30')]['filter']+'%'};return _0x351587;}})});}_0x32f079=_['merge']({},_0x32f079,_0x477062[_0x09c6('0x3e')]);var _0x19cccb={'where':_0x32f079[_0x09c6('0x39')]};return db['VoiceDialReport'][_0x09c6('0x1f')](_0x19cccb)[_0x09c6('0x25')](function(_0x3536e6){_0x428ed7[_0x09c6('0x1f')]=_0x3536e6;if(_0x477062[_0x09c6('0x30')][_0x09c6('0x3f')]){_0x32f079[_0x09c6('0x40')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x09c6('0x41')](_0x32f079);})[_0x09c6('0x25')](function(_0x2718d8){_0x428ed7[_0x09c6('0x42')]=_0x2718d8;return _0x428ed7;})[_0x09c6('0x25')](respondWithFilteredResult(_0x182433,_0x32f079))[_0x09c6('0x43')](handleError(_0x182433,null));};exports[_0x09c6('0x44')]=function(_0x398e0f,_0x1b12b3){var _0x4342fe={'raw':!![],'where':{'id':_0x398e0f[_0x09c6('0x45')]['id']}},_0x470d1a={};_0x470d1a[_0x09c6('0x2f')]=_[_0x09c6('0x31')](db[_0x09c6('0x2a')][_0x09c6('0x2b')]);_0x470d1a[_0x09c6('0x30')]=_[_0x09c6('0x31')](_0x398e0f[_0x09c6('0x30')]);_0x470d1a['filters']=_[_0x09c6('0x33')](_0x470d1a[_0x09c6('0x2f')],_0x470d1a['query']);_0x4342fe['attributes']=_[_0x09c6('0x33')](_0x470d1a['model'],qs[_0x09c6('0x34')](_0x398e0f[_0x09c6('0x30')]['fields']));_0x4342fe[_0x09c6('0x32')]=_0x4342fe[_0x09c6('0x32')]['length']?_0x4342fe[_0x09c6('0x32')]:_0x470d1a[_0x09c6('0x2f')];if(_0x398e0f[_0x09c6('0x30')][_0x09c6('0x3f')]){_0x4342fe['include']=[{'all':!![]}];}_0x4342fe=_[_0x09c6('0x46')]({},_0x4342fe,_0x398e0f[_0x09c6('0x3e')]);return db[_0x09c6('0x2a')][_0x09c6('0x47')](_0x4342fe)['then'](handleEntityNotFound(_0x1b12b3,null))['then'](respondWithResult(_0x1b12b3,null))[_0x09c6('0x43')](handleError(_0x1b12b3,null));};exports['create']=function(_0x4b9ed6,_0x34e6cc){return db['VoiceDialReport']['create'](_0x4b9ed6[_0x09c6('0x48')],{})[_0x09c6('0x25')](respondWithResult(_0x34e6cc,0xc9))['catch'](handleError(_0x34e6cc,null));};exports[_0x09c6('0x24')]=function(_0x366937,_0x560237){if(_0x366937[_0x09c6('0x48')]['id']){delete _0x366937[_0x09c6('0x48')]['id'];}return db[_0x09c6('0x2a')]['find']({'where':{'id':_0x366937[_0x09c6('0x45')]['id']}})[_0x09c6('0x25')](handleEntityNotFound(_0x560237,null))[_0x09c6('0x25')](saveUpdates(_0x366937[_0x09c6('0x48')],null))[_0x09c6('0x25')](respondWithResult(_0x560237,null))[_0x09c6('0x43')](handleError(_0x560237,null));};exports[_0x09c6('0x49')]=function(_0x5b4f73,_0x3b9c9c){return db['VoiceDialReport'][_0x09c6('0x47')]({'where':{'id':_0x5b4f73[_0x09c6('0x45')]['id']}})[_0x09c6('0x25')](handleEntityNotFound(_0x3b9c9c,null))[_0x09c6('0x25')](removeEntity(_0x3b9c9c,null))[_0x09c6('0x43')](handleError(_0x3b9c9c,null));};exports[_0x09c6('0x4a')]=function(_0x42f17a,_0x37c2d0){return db[_0x09c6('0x2a')]['describe']()['then'](respondWithResult(_0x37c2d0,null))[_0x09c6('0x43')](handleError(_0x37c2d0,null));}; \ No newline at end of file +var _0x555c=['filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','end','offset','undefined','limit','count','status','set','json','apply','reject','save','update','destroy','sendStatus','send','index','VoiceDialReport','rawAttributes','fieldName','type','model','map','name','query','keys'];(function(_0x12ca5f,_0x223d98){var _0xfc3ae9=function(_0x1928fb){while(--_0x1928fb){_0x12ca5f['push'](_0x12ca5f['shift']());}};_0xfc3ae9(++_0x223d98);}(_0x555c,0xf4));var _0xc555=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x555c[_0xc6be3a];return _0x56a310;};'use strict';var emlformat=require(_0xc555('0x0'));var rimraf=require(_0xc555('0x1'));var zipdir=require(_0xc555('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc555('0x3'));var BPromise=require(_0xc555('0x4'));var Mustache=require(_0xc555('0x5'));var util=require(_0xc555('0x6'));var path=require('path');var sox=require(_0xc555('0x7'));var csv=require(_0xc555('0x8'));var ejs=require(_0xc555('0x9'));var fs=require('fs');var fs_extra=require(_0xc555('0xa'));var _=require(_0xc555('0xb'));var squel=require(_0xc555('0xc'));var crypto=require(_0xc555('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc555('0x8'));var querystring=require(_0xc555('0xe'));var Papa=require(_0xc555('0xf'));var Redis=require(_0xc555('0x10'));var authService=require(_0xc555('0x11'));var qs=require(_0xc555('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc555('0x13'));var logger=require(_0xc555('0x14'))('api');var utils=require(_0xc555('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc555('0x16'))['db'];function respondWithStatusCode(_0x2f083,_0x4ff992){_0x4ff992=_0x4ff992||0xcc;return function(_0x2fcc1a){if(_0x2fcc1a){return _0x2f083['sendStatus'](_0x4ff992);}return _0x2f083['status'](_0x4ff992)[_0xc555('0x17')]();};}function respondWithResult(_0xdecdb5,_0x2c5402){_0x2c5402=_0x2c5402||0xc8;return function(_0x5c9093){if(_0x5c9093){return _0xdecdb5['status'](_0x2c5402)['json'](_0x5c9093);}};}function respondWithFilteredResult(_0x5ef3a6,_0x1b659b){return function(_0x492505){if(_0x492505){var _0x5b6938=typeof _0x1b659b[_0xc555('0x18')]===_0xc555('0x19')&&typeof _0x1b659b[_0xc555('0x1a')]===_0xc555('0x19');var _0xaee2c1=_0x492505['count'];var _0x1bde34=_0x5b6938?0x0:_0x1b659b['offset'];var _0x479412=_0x5b6938?_0x492505[_0xc555('0x1b')]:_0x1b659b['offset']+_0x1b659b[_0xc555('0x1a')];var _0x1c0d08;if(_0x479412>=_0xaee2c1){_0x479412=_0xaee2c1;_0x1c0d08=0xc8;}else{_0x1c0d08=0xce;}_0x5ef3a6[_0xc555('0x1c')](_0x1c0d08);return _0x5ef3a6[_0xc555('0x1d')]('Content-Range',_0x1bde34+'-'+_0x479412+'/'+_0xaee2c1)[_0xc555('0x1e')](_0x492505);}return null;};}function patchUpdates(_0x1a915b){return function(_0x335b15){try{jsonpatch[_0xc555('0x1f')](_0x335b15,_0x1a915b,!![]);}catch(_0x47fb27){return BPromise[_0xc555('0x20')](_0x47fb27);}return _0x335b15[_0xc555('0x21')]();};}function saveUpdates(_0x34cf00,_0x52ce3c){return function(_0x44e612){if(_0x44e612){return _0x44e612[_0xc555('0x22')](_0x34cf00)['then'](function(_0x3d8a44){return _0x3d8a44;});}return null;};}function removeEntity(_0x518916,_0x319d20){return function(_0x2cbc1e){if(_0x2cbc1e){return _0x2cbc1e[_0xc555('0x23')]()['then'](function(){_0x518916[_0xc555('0x1c')](0xcc)[_0xc555('0x17')]();});}};}function handleEntityNotFound(_0x381752,_0x2b5f93){return function(_0x21d22b){if(!_0x21d22b){_0x381752[_0xc555('0x24')](0x194);}return _0x21d22b;};}function handleError(_0x19c4c0,_0x29940f){_0x29940f=_0x29940f||0x1f4;return function(_0x1e634d){logger['error'](_0x1e634d['stack']);if(_0x1e634d['name']){delete _0x1e634d['name'];}_0x19c4c0['status'](_0x29940f)[_0xc555('0x25')](_0x1e634d);};}exports[_0xc555('0x26')]=function(_0x263a51,_0x35961f){var _0x18ad5a={},_0x360fdc={},_0x58dff7={'count':0x0,'rows':[]};var _0x36a43e=_['map'](db[_0xc555('0x27')][_0xc555('0x28')],function(_0x4970da){return{'name':_0x4970da[_0xc555('0x29')],'type':_0x4970da[_0xc555('0x2a')]['key']};});_0x360fdc[_0xc555('0x2b')]=_[_0xc555('0x2c')](_0x36a43e,_0xc555('0x2d'));_0x360fdc[_0xc555('0x2e')]=_[_0xc555('0x2f')](_0x263a51['query']);_0x360fdc[_0xc555('0x30')]=_[_0xc555('0x31')](_0x360fdc[_0xc555('0x2b')],_0x360fdc['query']);_0x18ad5a[_0xc555('0x32')]=_[_0xc555('0x31')](_0x360fdc['model'],qs[_0xc555('0x33')](_0x263a51[_0xc555('0x2e')][_0xc555('0x33')]));_0x18ad5a[_0xc555('0x32')]=_0x18ad5a[_0xc555('0x32')][_0xc555('0x34')]?_0x18ad5a[_0xc555('0x32')]:_0x360fdc[_0xc555('0x2b')];if(!_0x263a51[_0xc555('0x2e')][_0xc555('0x35')]('nolimit')){_0x18ad5a[_0xc555('0x1a')]=qs['limit'](_0x263a51[_0xc555('0x2e')]['limit']);_0x18ad5a['offset']=qs[_0xc555('0x18')](_0x263a51[_0xc555('0x2e')]['offset']);}_0x18ad5a[_0xc555('0x36')]=qs[_0xc555('0x37')](_0x263a51[_0xc555('0x2e')][_0xc555('0x37')]);_0x18ad5a[_0xc555('0x38')]=qs['filters'](_[_0xc555('0x39')](_0x263a51[_0xc555('0x2e')],_0x360fdc['filters']),_0x36a43e);if(_0x263a51[_0xc555('0x2e')][_0xc555('0x3a')]){_0x18ad5a['where']=_[_0xc555('0x3b')](_0x18ad5a[_0xc555('0x38')],{'$or':_[_0xc555('0x2c')](_0x36a43e,function(_0x70861d){if(_0x70861d[_0xc555('0x2a')]!==_0xc555('0x3c')){var _0x1e2ed8={};_0x1e2ed8[_0x70861d[_0xc555('0x2d')]]={'$like':'%'+_0x263a51[_0xc555('0x2e')][_0xc555('0x3a')]+'%'};return _0x1e2ed8;}})});}_0x18ad5a=_[_0xc555('0x3b')]({},_0x18ad5a,_0x263a51[_0xc555('0x3d')]);var _0x3b40fd={'where':_0x18ad5a[_0xc555('0x38')]};return db[_0xc555('0x27')]['count'](_0x3b40fd)[_0xc555('0x3e')](function(_0x4000c5){_0x58dff7['count']=_0x4000c5;if(_0x263a51[_0xc555('0x2e')][_0xc555('0x3f')]){_0x18ad5a[_0xc555('0x40')]=[{'all':!![]}];}return db[_0xc555('0x27')][_0xc555('0x41')](_0x18ad5a);})[_0xc555('0x3e')](function(_0x4e4fda){_0x58dff7[_0xc555('0x42')]=_0x4e4fda;return _0x58dff7;})['then'](respondWithFilteredResult(_0x35961f,_0x18ad5a))[_0xc555('0x43')](handleError(_0x35961f,null));};exports['show']=function(_0x59ed4f,_0x133bb7){var _0x53626a={'raw':!![],'where':{'id':_0x59ed4f[_0xc555('0x44')]['id']}},_0x569304={};_0x569304['model']=_[_0xc555('0x2f')](db['VoiceDialReport']['rawAttributes']);_0x569304[_0xc555('0x2e')]=_[_0xc555('0x2f')](_0x59ed4f[_0xc555('0x2e')]);_0x569304['filters']=_[_0xc555('0x31')](_0x569304['model'],_0x569304[_0xc555('0x2e')]);_0x53626a['attributes']=_[_0xc555('0x31')](_0x569304['model'],qs[_0xc555('0x33')](_0x59ed4f[_0xc555('0x2e')]['fields']));_0x53626a[_0xc555('0x32')]=_0x53626a[_0xc555('0x32')][_0xc555('0x34')]?_0x53626a['attributes']:_0x569304['model'];if(_0x59ed4f[_0xc555('0x2e')][_0xc555('0x3f')]){_0x53626a['include']=[{'all':!![]}];}_0x53626a=_[_0xc555('0x3b')]({},_0x53626a,_0x59ed4f[_0xc555('0x3d')]);return db[_0xc555('0x27')][_0xc555('0x45')](_0x53626a)[_0xc555('0x3e')](handleEntityNotFound(_0x133bb7,null))[_0xc555('0x3e')](respondWithResult(_0x133bb7,null))[_0xc555('0x43')](handleError(_0x133bb7,null));};exports[_0xc555('0x46')]=function(_0x21fea7,_0x509f48){return db[_0xc555('0x27')][_0xc555('0x46')](_0x21fea7[_0xc555('0x47')],{})['then'](respondWithResult(_0x509f48,0xc9))[_0xc555('0x43')](handleError(_0x509f48,null));};exports['update']=function(_0x5ab65d,_0x1b4a6c){if(_0x5ab65d[_0xc555('0x47')]['id']){delete _0x5ab65d[_0xc555('0x47')]['id'];}return db[_0xc555('0x27')]['find']({'where':{'id':_0x5ab65d[_0xc555('0x44')]['id']}})[_0xc555('0x3e')](handleEntityNotFound(_0x1b4a6c,null))[_0xc555('0x3e')](saveUpdates(_0x5ab65d['body'],null))[_0xc555('0x3e')](respondWithResult(_0x1b4a6c,null))[_0xc555('0x43')](handleError(_0x1b4a6c,null));};exports[_0xc555('0x23')]=function(_0xfabeea,_0x357e16){return db[_0xc555('0x27')][_0xc555('0x45')]({'where':{'id':_0xfabeea[_0xc555('0x44')]['id']}})['then'](handleEntityNotFound(_0x357e16,null))[_0xc555('0x3e')](removeEntity(_0x357e16,null))[_0xc555('0x43')](handleError(_0x357e16,null));};exports[_0xc555('0x48')]=function(_0x3053e5,_0x17c28c){return db[_0xc555('0x27')][_0xc555('0x48')]()['then'](respondWithResult(_0x17c28c,null))[_0xc555('0x43')](handleError(_0x17c28c,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index d3f5589..3014ac1 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 _0x1229=['define','VoiceDialReport','report_dial','uniqueid','util','../../config/logger','api','moment','path','../../config/environment','./voiceDialReport.attributes','exports'];(function(_0x44ea9c,_0x24e9dd){var _0x389df9=function(_0x2c83f3){while(--_0x2c83f3){_0x44ea9c['push'](_0x44ea9c['shift']());}};_0x389df9(++_0x24e9dd);}(_0x1229,0xac));var _0x9122=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0x1229[_0x28aea5];return _0x6a55f9;};'use strict';var _=require('lodash');var util=require(_0x9122('0x0'));var logger=require(_0x9122('0x1'))(_0x9122('0x2'));var moment=require(_0x9122('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9122('0x4'));var rimraf=require('rimraf');var config=require(_0x9122('0x5'));var attributes=require(_0x9122('0x6'));module[_0x9122('0x7')]=function(_0x4c3994,_0x165c75){return _0x4c3994[_0x9122('0x8')](_0x9122('0x9'),attributes,{'tableName':_0x9122('0xa'),'paranoid':![],'indexes':[{'fields':[_0x9122('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe0cf=['rimraf','./voiceDialReport.attributes','define','report_dial','uniqueid','lodash','api','moment','request-promise','path'];(function(_0x1fcc12,_0x369246){var _0x5a0fa6=function(_0x5cd5a4){while(--_0x5cd5a4){_0x1fcc12['push'](_0x1fcc12['shift']());}};_0x5a0fa6(++_0x369246);}(_0xe0cf,0x11d));var _0xfe0c=function(_0x283c87,_0x545688){_0x283c87=_0x283c87-0x0;var _0xde4143=_0xe0cf[_0x283c87];return _0xde4143;};'use strict';var _=require(_0xfe0c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfe0c('0x1'));var moment=require(_0xfe0c('0x2'));var BPromise=require('bluebird');var rp=require(_0xfe0c('0x3'));var fs=require('fs');var path=require(_0xfe0c('0x4'));var rimraf=require(_0xfe0c('0x5'));var config=require('../../config/environment');var attributes=require(_0xfe0c('0x6'));module['exports']=function(_0x2339a3,_0x2a33c3){return _0x2339a3[_0xfe0c('0x7')]('VoiceDialReport',attributes,{'tableName':_0xfe0c('0x8'),'paranoid':![],'indexes':[{'fields':[_0xfe0c('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 7a515cb..1f06042 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 _0xe9e7=['VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','body','raw','CreateVoiceDialReport','UpdateVoiceDialReport','VoiceDialReport','options','attributes','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info'];(function(_0x2be80c,_0x53be5b){var _0x4ceb09=function(_0x3df184){while(--_0x3df184){_0x2be80c['push'](_0x2be80c['shift']());}};_0x4ceb09(++_0x53be5b);}(_0xe9e7,0xbf));var _0x7e9e=function(_0x46b20d,_0x5866c0){_0x46b20d=_0x46b20d-0x0;var _0x5e5c5b=_0xe9e7[_0x46b20d];return _0x5e5c5b;};'use strict';var _=require(_0x7e9e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7e9e('0x1'));var rs=require(_0x7e9e('0x2'));var fs=require('fs');var Redis=require(_0x7e9e('0x3'));var db=require(_0x7e9e('0x4'))['db'];var utils=require(_0x7e9e('0x5'));var logger=require(_0x7e9e('0x6'))(_0x7e9e('0x7'));var config=require(_0x7e9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7e9e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e322c,_0x29d0f5,_0x1ee48c){return new BPromise(function(_0x88ce31,_0x5de9d8){return client['request'](_0x5e322c,_0x1ee48c)[_0x7e9e('0xa')](function(_0x13cf17){logger[_0x7e9e('0xb')](_0x7e9e('0xc'),_0x29d0f5,_0x7e9e('0xd'));logger[_0x7e9e('0xe')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x29d0f5,'request\x20sent',JSON[_0x7e9e('0xf')](_0x13cf17));if(_0x13cf17[_0x7e9e('0x10')]){if(_0x13cf17['error'][_0x7e9e('0x11')]===0x1f4){logger[_0x7e9e('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x29d0f5,_0x13cf17[_0x7e9e('0x10')][_0x7e9e('0x12')]);return _0x5de9d8(_0x13cf17['error'][_0x7e9e('0x12')]);}logger[_0x7e9e('0x10')](_0x7e9e('0xc'),_0x29d0f5,_0x13cf17[_0x7e9e('0x10')][_0x7e9e('0x12')]);return _0x88ce31(_0x13cf17[_0x7e9e('0x10')][_0x7e9e('0x12')]);}else{logger[_0x7e9e('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x29d0f5,_0x7e9e('0xd'));_0x88ce31(_0x13cf17[_0x7e9e('0x13')][_0x7e9e('0x12')]);}})[_0x7e9e('0x14')](function(_0x3f14df){logger[_0x7e9e('0x10')](_0x7e9e('0xc'),_0x29d0f5,_0x3f14df);_0x5de9d8(_0x3f14df);});});}exports['CreateVoiceDialReport']=function(_0x285f1f){var _0x4d7bee=this;return new Promise(function(_0x153faf,_0x5ca471){return db['VoiceDialReport']['create'](_0x285f1f[_0x7e9e('0x15')],{'raw':_0x285f1f['options']?_0x285f1f['options'][_0x7e9e('0x16')]===undefined?!![]:![]:!![]})[_0x7e9e('0xa')](function(_0x5d3d54){logger[_0x7e9e('0xb')]('CreateVoiceDialReport',_0x285f1f);logger['debug']('CreateVoiceDialReport',_0x285f1f,JSON['stringify'](_0x5d3d54));_0x153faf(_0x5d3d54);})['catch'](function(_0xc29f28){logger[_0x7e9e('0x10')](_0x7e9e('0x17'),_0xc29f28[_0x7e9e('0x12')],_0x285f1f);_0x5ca471(_0x4d7bee[_0x7e9e('0x10')](0x1f4,_0xc29f28[_0x7e9e('0x12')]));});});};exports[_0x7e9e('0x18')]=function(_0x63ace7){var _0x4bc7ea=this;return new Promise(function(_0x1ca664,_0x12f85f){return db[_0x7e9e('0x19')]['update'](_0x63ace7[_0x7e9e('0x15')],{'raw':_0x63ace7[_0x7e9e('0x1a')]?_0x63ace7[_0x7e9e('0x1a')][_0x7e9e('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x63ace7[_0x7e9e('0x1a')]?_0x63ace7[_0x7e9e('0x1a')]['where']||null:null,'attributes':_0x63ace7[_0x7e9e('0x1a')]?_0x63ace7[_0x7e9e('0x1a')][_0x7e9e('0x1b')]||null:null,'limit':_0x63ace7[_0x7e9e('0x1a')]?_0x63ace7[_0x7e9e('0x1a')][_0x7e9e('0x1c')]||null:null})[_0x7e9e('0xa')](function(_0x26f9e9){logger['info'](_0x7e9e('0x18'),_0x63ace7);logger['debug']('UpdateVoiceDialReport',_0x63ace7,JSON[_0x7e9e('0xf')](_0x26f9e9));_0x1ca664(_0x26f9e9);})[_0x7e9e('0x14')](function(_0x2cae3e){logger[_0x7e9e('0x10')](_0x7e9e('0x18'),_0x2cae3e[_0x7e9e('0x12')],_0x63ace7);_0x12f85f(_0x4bc7ea[_0x7e9e('0x10')](0x1f4,_0x2cae3e['message']));});});}; \ No newline at end of file +var _0xd6aa=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','catch','CreateVoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','update','where','limit','util'];(function(_0x2afb97,_0x1cea64){var _0x4717e2=function(_0x50d4bb){while(--_0x50d4bb){_0x2afb97['push'](_0x2afb97['shift']());}};_0x4717e2(++_0x1cea64);}(_0xd6aa,0x1df));var _0xad6a=function(_0x7685bc,_0x119180){_0x7685bc=_0x7685bc-0x0;var _0x516c8b=_0xd6aa[_0x7685bc];return _0x516c8b;};'use strict';var _=require('lodash');var util=require(_0xad6a('0x0'));var moment=require(_0xad6a('0x1'));var BPromise=require(_0xad6a('0x2'));var rs=require(_0xad6a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xad6a('0x4'));var logger=require(_0xad6a('0x5'))(_0xad6a('0x6'));var config=require(_0xad6a('0x7'));var jayson=require(_0xad6a('0x8'));var client=jayson[_0xad6a('0x9')][_0xad6a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45efaa,_0xfeeb51,_0x56e98a){return new BPromise(function(_0x855f98,_0x5bb4f3){return client['request'](_0x45efaa,_0x56e98a)[_0xad6a('0xb')](function(_0x475c53){logger[_0xad6a('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0xfeeb51,'request\x20sent');logger[_0xad6a('0xd')](_0xad6a('0xe'),_0xfeeb51,_0xad6a('0xf'),JSON[_0xad6a('0x10')](_0x475c53));if(_0x475c53[_0xad6a('0x11')]){if(_0x475c53[_0xad6a('0x11')][_0xad6a('0x12')]===0x1f4){logger[_0xad6a('0x11')](_0xad6a('0x13'),_0xfeeb51,_0x475c53[_0xad6a('0x11')][_0xad6a('0x14')]);return _0x5bb4f3(_0x475c53[_0xad6a('0x11')][_0xad6a('0x14')]);}logger[_0xad6a('0x11')](_0xad6a('0x13'),_0xfeeb51,_0x475c53['error'][_0xad6a('0x14')]);return _0x855f98(_0x475c53[_0xad6a('0x11')][_0xad6a('0x14')]);}else{logger[_0xad6a('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0xfeeb51,'request\x20sent');_0x855f98(_0x475c53[_0xad6a('0x15')][_0xad6a('0x14')]);}})[_0xad6a('0x16')](function(_0x320e0a){logger[_0xad6a('0x11')](_0xad6a('0x13'),_0xfeeb51,_0x320e0a);_0x5bb4f3(_0x320e0a);});});}exports[_0xad6a('0x17')]=function(_0x4c3855){var _0xddff4b=this;return new Promise(function(_0x2a877f,_0x4d6e24){return db['VoiceDialReport'][_0xad6a('0x18')](_0x4c3855[_0xad6a('0x19')],{'raw':_0x4c3855[_0xad6a('0x1a')]?_0x4c3855[_0xad6a('0x1a')][_0xad6a('0x1b')]===undefined?!![]:![]:!![]})[_0xad6a('0xb')](function(_0x5a19c7){logger[_0xad6a('0xc')](_0xad6a('0x17'),_0x4c3855);logger[_0xad6a('0xd')](_0xad6a('0x17'),_0x4c3855,JSON[_0xad6a('0x10')](_0x5a19c7));_0x2a877f(_0x5a19c7);})['catch'](function(_0x26d442){logger['error'](_0xad6a('0x17'),_0x26d442[_0xad6a('0x14')],_0x4c3855);_0x4d6e24(_0xddff4b[_0xad6a('0x11')](0x1f4,_0x26d442[_0xad6a('0x14')]));});});};exports[_0xad6a('0x1c')]=function(_0x5035f3){var _0x4e5fb2=this;return new Promise(function(_0x1719c5,_0x1046e7){return db['VoiceDialReport'][_0xad6a('0x1d')](_0x5035f3['body'],{'raw':_0x5035f3[_0xad6a('0x1a')]?_0x5035f3[_0xad6a('0x1a')][_0xad6a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5035f3[_0xad6a('0x1a')]?_0x5035f3[_0xad6a('0x1a')][_0xad6a('0x1e')]||null:null,'attributes':_0x5035f3[_0xad6a('0x1a')]?_0x5035f3['options']['attributes']||null:null,'limit':_0x5035f3[_0xad6a('0x1a')]?_0x5035f3[_0xad6a('0x1a')][_0xad6a('0x1f')]||null:null})['then'](function(_0x696cea){logger[_0xad6a('0xc')](_0xad6a('0x1c'),_0x5035f3);logger[_0xad6a('0xd')]('UpdateVoiceDialReport',_0x5035f3,JSON['stringify'](_0x696cea));_0x1719c5(_0x696cea);})[_0xad6a('0x16')](function(_0x2020f5){logger['error'](_0xad6a('0x1c'),_0x2020f5[_0xad6a('0x14')],_0x5035f3);_0x1046e7(_0x4e5fb2[_0xad6a('0x11')](0x1f4,_0x2020f5['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 779b148..a2e352b 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 _0xc460=['exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','put','delete','destroy'];(function(_0x1b880d,_0x3fec46){var _0x5e373f=function(_0x46a38d){while(--_0x46a38d){_0x1b880d['push'](_0x1b880d['shift']());}};_0x5e373f(++_0x3fec46);}(_0xc460,0x127));var _0x0c46=function(_0x4ea0ee,_0x26bc56){_0x4ea0ee=_0x4ea0ee-0x0;var _0x4eda79=_0xc460[_0x4ea0ee];return _0x4eda79;};'use strict';var multer=require(_0x0c46('0x0'));var util=require(_0x0c46('0x1'));var path=require(_0x0c46('0x2'));var timeout=require(_0x0c46('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0c46('0x4'));var auth=require(_0x0c46('0x5'));var interaction=require(_0x0c46('0x6'));var config=require('../../config/environment');var controller=require(_0x0c46('0x7'));router[_0x0c46('0x8')]('/',auth[_0x0c46('0x9')](),controller[_0x0c46('0xa')]);router[_0x0c46('0x8')](_0x0c46('0xb'),auth[_0x0c46('0x9')](),controller[_0x0c46('0xc')]);router[_0x0c46('0xd')]('/',auth[_0x0c46('0x9')](),controller[_0x0c46('0xe')]);router[_0x0c46('0xd')](_0x0c46('0xf'),auth[_0x0c46('0x9')](),controller[_0x0c46('0x10')]);router[_0x0c46('0x11')](_0x0c46('0xb'),auth[_0x0c46('0x9')](),controller['update']);router[_0x0c46('0x12')](_0x0c46('0xb'),auth[_0x0c46('0x9')](),controller[_0x0c46('0x13')]);module[_0x0c46('0x14')]=router; \ No newline at end of file +var _0x65a8=['../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','/:id','create','post','addApplications','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x35d7c3,_0x5a71d6){var _0x46041a=function(_0x3ca298){while(--_0x3ca298){_0x35d7c3['push'](_0x35d7c3['shift']());}};_0x46041a(++_0x5a71d6);}(_0x65a8,0x11f));var _0x865a=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x65a8[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x865a('0x0'));var util=require(_0x865a('0x1'));var path=require(_0x865a('0x2'));var timeout=require(_0x865a('0x3'));var express=require(_0x865a('0x4'));var router=express[_0x865a('0x5')]();var fs_extra=require(_0x865a('0x6'));var auth=require(_0x865a('0x7'));var interaction=require(_0x865a('0x8'));var config=require('../../config/environment');var controller=require(_0x865a('0x9'));router[_0x865a('0xa')]('/',auth[_0x865a('0xb')](),controller[_0x865a('0xc')]);router[_0x865a('0xa')](_0x865a('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x865a('0xb')](),controller[_0x865a('0xe')]);router[_0x865a('0xf')]('/:id/applications',auth[_0x865a('0xb')](),controller[_0x865a('0x10')]);router[_0x865a('0x11')](_0x865a('0xd'),auth[_0x865a('0xb')](),controller['update']);router[_0x865a('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x865a('0x13')]);module[_0x865a('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 40bba21..4a5d9aa 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 _0x976a=['sequelize','STRING','compositeIndex','NoOp','outbound','inbound-fax','outbound-fax','any','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x976a,0xb6));var _0xa976=function(_0x5b37f9,_0x311ec1){_0x5b37f9=_0x5b37f9-0x0;var _0x5945e2=_0x976a[_0x5b37f9];return _0x5945e2;};'use strict';var Sequelize=require(_0xa976('0x0'));module['exports']={'context':{'type':Sequelize[_0xa976('0x1')],'allowNull':![],'unique':_0xa976('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xa976('0x1')],'allowNull':![],'unique':_0xa976('0x2')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0xa976('0x2')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xa976('0x1')],'allowNull':![],'defaultValue':_0xa976('0x3')},'appdata':{'type':Sequelize[_0xa976('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM']('inbound',_0xa976('0x4'),'internal',_0xa976('0x5'),_0xa976('0x6'),'system',_0xa976('0x7')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xa976('0x8')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xa976('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0xa976('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0xa976('0x9')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xa976('0x8')]},'recordingFormat':{'type':Sequelize[_0xa976('0x1')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0xa976('0x9')],'defaultValue':!![]},'name':{'type':Sequelize[_0xa976('0xa')],'get':function(_0x1fdef){return this[_0xa976('0xb')](_0xa976('0xc'));}},'alias':{'type':Sequelize[_0xa976('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xfc73=['system','any','*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','internal','inbound-fax','outbound-fax'];(function(_0x533043,_0x144702){var _0x11bfff=function(_0x431cd1){while(--_0x431cd1){_0x533043['push'](_0x533043['shift']());}};_0x11bfff(++_0x144702);}(_0xfc73,0x136));var _0x3fc7=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xfc73[_0x4c12ec];return _0x3ae42c;};'use strict';var Sequelize=require(_0x3fc7('0x0'));module[_0x3fc7('0x1')]={'context':{'type':Sequelize[_0x3fc7('0x2')],'allowNull':![],'unique':_0x3fc7('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x3fc7('0x2')],'allowNull':![],'unique':_0x3fc7('0x3')},'priority':{'type':Sequelize[_0x3fc7('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x3fc7('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x3fc7('0x2')],'allowNull':![],'defaultValue':_0x3fc7('0x4')},'appdata':{'type':Sequelize[_0x3fc7('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x3fc7('0x5')](_0x3fc7('0x6'),'outbound',_0x3fc7('0x7'),_0x3fc7('0x8'),_0x3fc7('0x9'),_0x3fc7('0xa'),_0x3fc7('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0x3fc7('0x2')]},'interval':{'type':Sequelize[_0x3fc7('0x2')],'allowNull':![],'defaultValue':_0x3fc7('0xc')},'IntervalId':{'type':Sequelize[_0x3fc7('0xd')]},'isApp':{'type':Sequelize[_0x3fc7('0xe')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x3fc7('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x3fc7('0xe')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x3fc7('0xd')]},'recordingFormat':{'type':Sequelize[_0x3fc7('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x3fc7('0xf')],'get':function(_0x7345e0){return this['getDataValue']('exten');}},'alias':{'type':Sequelize[_0x3fc7('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 9723cdb..ac8e199 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 _0xb974=['bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','lodash','ioredis','../../config/environment','defaults','redis','localhost','register','sendStatus','status','offset','limit','undefined','count','set','json','destroy','then','get','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','value','find','type','error','stack','name','send','index','map','VoiceExtension','rawAttributes','fieldName','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','options','includeAll','include','findAll','rows','catch','params','create','startsWith','exten','body','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','update','pick','description','recordingFormat','cutdigits','mandatoryDisposition','alias','context','findOne','transaction','VoiceExtensionId','isApp','createRouting','log','LOG\x20~\x20.then\x20~\x20routing'];(function(_0x50fcae,_0x492eeb){var _0x44440f=function(_0x8f2342){while(--_0x8f2342){_0x50fcae['push'](_0x50fcae['shift']());}};_0x44440f(++_0x492eeb);}(_0xb974,0xb3));var _0x4b97=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb974[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x4b97('0x0'));var Redis=require(_0x4b97('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0x4b97('0x2'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x4b97('0x3')](config[_0x4b97('0x4')],{'host':_0x4b97('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4b97('0x4')]));require('./voiceExtension.socket')[_0x4b97('0x6')](socket);function respondWithStatusCode(_0x4b6f00,_0x4068e7){_0x4068e7=_0x4068e7||0xcc;return function(_0x2933cd){if(_0x2933cd){return _0x4b6f00[_0x4b97('0x7')](_0x4068e7);}return _0x4b6f00[_0x4b97('0x8')](_0x4068e7)['end']();};}function respondWithResult(_0x35b3e0,_0xfb45df){_0xfb45df=_0xfb45df||0xc8;return function(_0x4cb1be){if(_0x4cb1be){return _0x35b3e0[_0x4b97('0x8')](_0xfb45df)['json'](_0x4cb1be);}};}function respondWithFilteredResult(_0xe5ccbd,_0x21fec4){return function(_0x5d9973){if(_0x5d9973){var _0x2dc86a=typeof _0x21fec4[_0x4b97('0x9')]==='undefined'&&typeof _0x21fec4[_0x4b97('0xa')]===_0x4b97('0xb');var _0x193a02=_0x5d9973['count'];var _0x56924c=_0x2dc86a?0x0:_0x21fec4[_0x4b97('0x9')];var _0xc89765=_0x2dc86a?_0x5d9973[_0x4b97('0xc')]:_0x21fec4[_0x4b97('0x9')]+_0x21fec4[_0x4b97('0xa')];var _0x6fa36e;if(_0xc89765>=_0x193a02){_0xc89765=_0x193a02;_0x6fa36e=0xc8;}else{_0x6fa36e=0xce;}_0xe5ccbd[_0x4b97('0x8')](_0x6fa36e);return _0xe5ccbd[_0x4b97('0xd')]('Content-Range',_0x56924c+'-'+_0xc89765+'/'+_0x193a02)[_0x4b97('0xe')](_0x5d9973);}return null;};}function removeEntity(_0x63b167){return function(_0x104e78){if(_0x104e78){return _0x104e78[_0x4b97('0xf')]()[_0x4b97('0x10')](function(){var _0x2a2f01=_0x104e78[_0x4b97('0x11')]({'plain':!![]});var _0x29ad6c=[{'name':'InboundRoutes','value':_0x4b97('0x12'),'ignore':![]},{'name':_0x4b97('0x13'),'value':_0x4b97('0x14'),'ignore':![]},{'name':_0x4b97('0x15'),'value':_0x4b97('0x16'),'ignore':![]}];var _0x16a684=_(_0x29ad6c)[_0x4b97('0x17')](_0x4b97('0x18'))['map'](_0x4b97('0x19'))['value']();if(_['includes'](_0x16a684,_0x2a2f01['type'])){return;}var _0x5b094f=_[_0x4b97('0x1a')](_0x29ad6c,[_0x4b97('0x19'),_0x2a2f01[_0x4b97('0x1b')]])['name'];return db['UserProfileResource'][_0x4b97('0xf')]({'where':{'type':_0x5b094f,'resourceId':_0x2a2f01['id']}})[_0x4b97('0x10')](function(){return _0x104e78;});})['then'](function(){_0x63b167['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5039e2){return function(_0x48e8ec){if(!_0x48e8ec){_0x5039e2[_0x4b97('0x7')](0x194);}return _0x48e8ec;};}function handleError(_0x4ad92e,_0x50e9a3){_0x50e9a3=_0x50e9a3||0x1f4;return function(_0x3505d2){logger[_0x4b97('0x1c')](_0x3505d2[_0x4b97('0x1d')]);if(_0x3505d2[_0x4b97('0x1e')]){delete _0x3505d2['name'];}_0x4ad92e['status'](_0x50e9a3)[_0x4b97('0x1f')](_0x3505d2);};}exports[_0x4b97('0x20')]=function(_0x40a928,_0x489c0f){var _0x558214={},_0x18c6c2={},_0x37a69f={'count':0x0,'rows':[]};var _0x476089=_[_0x4b97('0x21')](db[_0x4b97('0x22')][_0x4b97('0x23')],function(_0x3e358e){return{'name':_0x3e358e[_0x4b97('0x24')],'type':_0x3e358e[_0x4b97('0x1b')][_0x4b97('0x25')]};});_0x18c6c2['model']=_[_0x4b97('0x21')](_0x476089,_0x4b97('0x1e'));_0x18c6c2[_0x4b97('0x26')]=_[_0x4b97('0x27')](_0x40a928[_0x4b97('0x26')]);_0x18c6c2[_0x4b97('0x28')]=_['intersection'](_0x18c6c2['model'],_0x18c6c2[_0x4b97('0x26')]);_0x558214[_0x4b97('0x29')]=_[_0x4b97('0x2a')](_0x18c6c2[_0x4b97('0x2b')],qs[_0x4b97('0x2c')](_0x40a928[_0x4b97('0x26')][_0x4b97('0x2c')]));_0x558214[_0x4b97('0x29')]=_0x558214[_0x4b97('0x29')][_0x4b97('0x2d')]?_0x558214[_0x4b97('0x29')]:_0x18c6c2[_0x4b97('0x2b')];if(!_0x40a928[_0x4b97('0x26')][_0x4b97('0x2e')](_0x4b97('0x2f'))){_0x558214[_0x4b97('0xa')]=qs[_0x4b97('0xa')](_0x40a928[_0x4b97('0x26')]['limit']);_0x558214[_0x4b97('0x9')]=qs['offset'](_0x40a928[_0x4b97('0x26')][_0x4b97('0x9')]);}_0x558214[_0x4b97('0x30')]=qs[_0x4b97('0x31')](_0x40a928[_0x4b97('0x26')][_0x4b97('0x31')]);_0x558214[_0x4b97('0x32')]=qs[_0x4b97('0x28')](_['pick'](_0x40a928[_0x4b97('0x26')],_0x18c6c2['filters']),_0x476089);if(_0x40a928[_0x4b97('0x26')][_0x4b97('0x17')]){_0x558214[_0x4b97('0x32')]=_['merge'](_0x558214[_0x4b97('0x32')],{'$or':_[_0x4b97('0x21')](_0x476089,function(_0x3d952b){if(_0x3d952b[_0x4b97('0x1b')]!=='VIRTUAL'){var _0x45fde9={};_0x45fde9[_0x3d952b[_0x4b97('0x1e')]]={'$like':'%'+_0x40a928[_0x4b97('0x26')][_0x4b97('0x17')]+'%'};return _0x45fde9;}})});}_0x558214=_[_0x4b97('0x33')]({},_0x558214,_0x40a928[_0x4b97('0x34')]);var _0x3c15bb={'where':_0x558214['where']};return db['VoiceExtension'][_0x4b97('0xc')](_0x3c15bb)[_0x4b97('0x10')](function(_0x175040){_0x37a69f[_0x4b97('0xc')]=_0x175040;if(_0x40a928['query'][_0x4b97('0x35')]){_0x558214[_0x4b97('0x36')]=[{'all':!![]}];}return db[_0x4b97('0x22')][_0x4b97('0x37')](_0x558214);})['then'](function(_0x221abc){_0x37a69f[_0x4b97('0x38')]=_0x221abc;return _0x37a69f;})[_0x4b97('0x10')](respondWithFilteredResult(_0x489c0f,_0x558214))[_0x4b97('0x39')](handleError(_0x489c0f,null));};exports['show']=function(_0x3fe209,_0x50ec87){var _0x3a40a9={'raw':![],'where':{'id':_0x3fe209[_0x4b97('0x3a')]['id']}},_0x7719ac={};_0x7719ac[_0x4b97('0x2b')]=_[_0x4b97('0x27')](db[_0x4b97('0x22')][_0x4b97('0x23')]);_0x7719ac[_0x4b97('0x26')]=_[_0x4b97('0x27')](_0x3fe209[_0x4b97('0x26')]);_0x7719ac[_0x4b97('0x28')]=_[_0x4b97('0x2a')](_0x7719ac['model'],_0x7719ac[_0x4b97('0x26')]);_0x3a40a9[_0x4b97('0x29')]=_[_0x4b97('0x2a')](_0x7719ac[_0x4b97('0x2b')],qs[_0x4b97('0x2c')](_0x3fe209[_0x4b97('0x26')][_0x4b97('0x2c')]));_0x3a40a9['attributes']=_0x3a40a9['attributes']['length']?_0x3a40a9[_0x4b97('0x29')]:_0x7719ac[_0x4b97('0x2b')];if(_0x3fe209[_0x4b97('0x26')][_0x4b97('0x35')]){_0x3a40a9['include']=[{'all':!![]}];}_0x3a40a9=_[_0x4b97('0x33')]({},_0x3a40a9,_0x3fe209[_0x4b97('0x34')]);return db[_0x4b97('0x22')][_0x4b97('0x1a')](_0x3a40a9)[_0x4b97('0x10')](handleEntityNotFound(_0x50ec87,null))[_0x4b97('0x10')](respondWithResult(_0x50ec87,null))[_0x4b97('0x39')](handleError(_0x50ec87,null));};exports[_0x4b97('0xf')]=function(_0x3960e6,_0x275fd8){return db[_0x4b97('0x22')][_0x4b97('0x1a')]({'where':{'id':_0x3960e6['params']['id']}})[_0x4b97('0x10')](handleEntityNotFound(_0x275fd8,null))[_0x4b97('0x10')](removeEntity(_0x275fd8,null))[_0x4b97('0x39')](handleError(_0x275fd8,null));};exports[_0x4b97('0x3b')]=function(_0x5756a5,_0x195f46){if(_0x5756a5['body']['type']===_0x4b97('0x14')&&!_[_0x4b97('0x3c')](_0x5756a5['body'][_0x4b97('0x3d')],'_')){_0x5756a5[_0x4b97('0x3e')][_0x4b97('0x3d')]='_'[_0x4b97('0x3f')](_0x5756a5[_0x4b97('0x3e')][_0x4b97('0x3d')]);}return db['VoiceExtension'][_0x4b97('0x3b')](_0x5756a5[_0x4b97('0x3e')],{'raw':![]})[_0x4b97('0x10')](function(_0x5e6994){var _0x339803=_0x5756a5[_0x4b97('0x40')][_0x4b97('0x11')]({'plain':!![]});if(!_0x339803)throw new Error(_0x4b97('0x41'));if(_0x339803[_0x4b97('0x42')]===_0x4b97('0x40')){var _0x1e98e7=_0x5e6994[_0x4b97('0x11')]({'plain':!![]});var _0x1621bb=[{'name':'InboundRoutes','value':'inbound'},{'name':_0x4b97('0x13'),'value':_0x4b97('0x14')},{'name':_0x4b97('0x15'),'value':_0x4b97('0x16')}];var _0x5cfd58=_['find'](_0x1621bb,['value',_0x1e98e7[_0x4b97('0x1b')]])[_0x4b97('0x1e')];return db[_0x4b97('0x43')][_0x4b97('0x1a')]({'where':{'name':_0x5cfd58,'userProfileId':_0x339803[_0x4b97('0x44')]},'raw':!![]})[_0x4b97('0x10')](function(_0x4a2fd5){if(_0x4a2fd5&&_0x4a2fd5['autoAssociation']===0x0){return db[_0x4b97('0x45')][_0x4b97('0x3b')]({'name':_0x1e98e7[_0x4b97('0x1e')],'resourceId':_0x1e98e7['id'],'type':_0x4a2fd5[_0x4b97('0x1e')],'sectionId':_0x4a2fd5['id']},{})[_0x4b97('0x10')](function(){return _0x5e6994;});}else{return _0x5e6994;}})[_0x4b97('0x39')](function(_0x2e3344){logger[_0x4b97('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e3344);throw _0x2e3344;});}return _0x5e6994;})[_0x4b97('0x10')](respondWithResult(_0x195f46,0xc9))['catch'](handleError(_0x195f46,null));};exports[_0x4b97('0x46')]=function(_0x5a8de6,_0x569b63){if(_0x5a8de6[_0x4b97('0x3e')]['id']){delete _0x5a8de6[_0x4b97('0x3e')]['id'];}return db['VoiceExtension'][_0x4b97('0x1a')]({'where':{'id':_0x5a8de6[_0x4b97('0x3a')]['id']}})['then'](handleEntityNotFound(_0x569b63,null))['then'](function(_0x524d84){if(_0x524d84){return db[_0x4b97('0x22')][_0x4b97('0x46')](_[_0x4b97('0x47')](_0x5a8de6[_0x4b97('0x3e')],[_0x4b97('0x3d'),'context',_0x4b97('0x48'),_0x4b97('0x49'),_0x4b97('0x4a'),_0x4b97('0x4b'),_0x4b97('0x4c')]),{'where':{'context':_0x524d84[_0x4b97('0x4d')],'exten':_0x524d84[_0x4b97('0x3d')]},'individualHooks':!![]})['then'](function(_0x935585){return _0x935585;});}return null;})[_0x4b97('0x10')](respondWithStatusCode(_0x569b63,null))[_0x4b97('0x39')](handleError(_0x569b63,null));};exports['addApplications']=function(_0x28e28b,_0x54d259){return db['VoiceExtension'][_0x4b97('0x4e')]({'where':{'id':_0x28e28b[_0x4b97('0x3a')]['id']}})[_0x4b97('0x10')](function(_0x345473){if(_0x345473){return db['sequelize'][_0x4b97('0x4f')](function(_0x36c93a){return db[_0x4b97('0x22')]['destroy']({'where':{'VoiceExtensionId':_0x28e28b['params']['id']},'transaction':_0x36c93a})[_0x4b97('0x10')](function(){var _0x49b6e1=_[_0x4b97('0x21')](_0x28e28b['body'],function(_0x5e0280){_0x5e0280[_0x4b97('0x50')]=_0x28e28b[_0x4b97('0x3a')]['id'];_0x5e0280[_0x4b97('0x51')]=!![];return _0x5e0280;});return _0x345473[_0x4b97('0x52')](_0x49b6e1);})[_0x4b97('0x10')](function(_0x2c63df){console[_0x4b97('0x53')](_0x4b97('0x54'),_0x2c63df);return db[_0x4b97('0x22')][_0x4b97('0x55')](_0x2c63df,{'transaction':_0x36c93a});});})[_0x4b97('0x10')](function(){return db[_0x4b97('0x22')][_0x4b97('0x56')]({'where':{'isApp':!![],'VoiceExtensionId':_0x28e28b[_0x4b97('0x3a')]['id']},'order':_0x4b97('0x57')});});}})[_0x4b97('0x10')](respondWithResult(_0x54d259,null))[_0x4b97('0x39')](handleError(_0x54d259,null));}; \ No newline at end of file +var _0x373d=['length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','findAll','catch','show','include','params','create','body','startsWith','exten','concat','role','user','OutboundRoutes','InternalRoutes','internal','UserProfileSection','update','context','description','recordingFormat','cutdigits','alias','findOne','sequelize','transaction','VoiceExtensionId','isApp','createRouting','log','LOG\x20~\x20.then\x20~\x20routing','bulkCreate','cast(priority\x20as\x20unsigned)','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','./voiceExtension.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','destroy','then','get','InboundRoutes','inbound','outbound','filter','ignore','map','value','type','find','name','end','sendStatus','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x373d,0x1e2));var _0xd373=function(_0x38257d,_0x4aa6da){_0x38257d=_0x38257d-0x0;var _0x1175b3=_0x373d[_0x38257d];return _0x1175b3;};'use strict';var _=require(_0xd373('0x0'));var Redis=require('ioredis');var qs=require(_0xd373('0x1'));var logger=require(_0xd373('0x2'))(_0xd373('0x3'));var config=require(_0xd373('0x4'));var db=require('../../mysqldb')['db'];config[_0xd373('0x5')]=_[_0xd373('0x6')](config[_0xd373('0x5')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd373('0x5')]));require(_0xd373('0x7'))[_0xd373('0x8')](socket);function respondWithStatusCode(_0x4008c5,_0x48d977){_0x48d977=_0x48d977||0xcc;return function(_0xe79819){if(_0xe79819){return _0x4008c5['sendStatus'](_0x48d977);}return _0x4008c5['status'](_0x48d977)['end']();};}function respondWithResult(_0x14472a,_0x42b834){_0x42b834=_0x42b834||0xc8;return function(_0x4a67af){if(_0x4a67af){return _0x14472a[_0xd373('0x9')](_0x42b834)[_0xd373('0xa')](_0x4a67af);}};}function respondWithFilteredResult(_0x5c899d,_0x5b9f9b){return function(_0x1c4351){if(_0x1c4351){var _0x4579c4=typeof _0x5b9f9b[_0xd373('0xb')]===_0xd373('0xc')&&typeof _0x5b9f9b['limit']==='undefined';var _0x5ab89c=_0x1c4351[_0xd373('0xd')];var _0x14a0ee=_0x4579c4?0x0:_0x5b9f9b['offset'];var _0x32e0e4=_0x4579c4?_0x1c4351[_0xd373('0xd')]:_0x5b9f9b[_0xd373('0xb')]+_0x5b9f9b[_0xd373('0xe')];var _0x28b2bf;if(_0x32e0e4>=_0x5ab89c){_0x32e0e4=_0x5ab89c;_0x28b2bf=0xc8;}else{_0x28b2bf=0xce;}_0x5c899d[_0xd373('0x9')](_0x28b2bf);return _0x5c899d[_0xd373('0xf')](_0xd373('0x10'),_0x14a0ee+'-'+_0x32e0e4+'/'+_0x5ab89c)[_0xd373('0xa')](_0x1c4351);}return null;};}function removeEntity(_0x2c5854){return function(_0x3a5316){if(_0x3a5316){return _0x3a5316[_0xd373('0x11')]()[_0xd373('0x12')](function(){var _0x4e5768=_0x3a5316[_0xd373('0x13')]({'plain':!![]});var _0x5eab00=[{'name':_0xd373('0x14'),'value':_0xd373('0x15'),'ignore':![]},{'name':'OutboundRoutes','value':_0xd373('0x16'),'ignore':![]},{'name':'InternalRoutes','value':'internal','ignore':![]}];var _0x23fada=_(_0x5eab00)[_0xd373('0x17')](_0xd373('0x18'))[_0xd373('0x19')](_0xd373('0x1a'))[_0xd373('0x1a')]();if(_['includes'](_0x23fada,_0x4e5768[_0xd373('0x1b')])){return;}var _0xd808f8=_[_0xd373('0x1c')](_0x5eab00,[_0xd373('0x1a'),_0x4e5768[_0xd373('0x1b')]])[_0xd373('0x1d')];return db['UserProfileResource'][_0xd373('0x11')]({'where':{'type':_0xd808f8,'resourceId':_0x4e5768['id']}})[_0xd373('0x12')](function(){return _0x3a5316;});})[_0xd373('0x12')](function(){_0x2c5854[_0xd373('0x9')](0xcc)[_0xd373('0x1e')]();});}};}function handleEntityNotFound(_0x238ffd){return function(_0x466a03){if(!_0x466a03){_0x238ffd[_0xd373('0x1f')](0x194);}return _0x466a03;};}function handleError(_0x1ab540,_0x1bf642){_0x1bf642=_0x1bf642||0x1f4;return function(_0x437110){logger[_0xd373('0x20')](_0x437110[_0xd373('0x21')]);if(_0x437110[_0xd373('0x1d')]){delete _0x437110[_0xd373('0x1d')];}_0x1ab540[_0xd373('0x9')](_0x1bf642)[_0xd373('0x22')](_0x437110);};}exports[_0xd373('0x23')]=function(_0x3e657b,_0x470612){var _0x45ee58={},_0x3ad8c={},_0x71c5c={'count':0x0,'rows':[]};var _0x3384a5=_[_0xd373('0x19')](db[_0xd373('0x24')][_0xd373('0x25')],function(_0xbc420b){return{'name':_0xbc420b[_0xd373('0x26')],'type':_0xbc420b[_0xd373('0x1b')]['key']};});_0x3ad8c[_0xd373('0x27')]=_['map'](_0x3384a5,'name');_0x3ad8c[_0xd373('0x28')]=_[_0xd373('0x29')](_0x3e657b[_0xd373('0x28')]);_0x3ad8c[_0xd373('0x2a')]=_[_0xd373('0x2b')](_0x3ad8c['model'],_0x3ad8c[_0xd373('0x28')]);_0x45ee58[_0xd373('0x2c')]=_['intersection'](_0x3ad8c[_0xd373('0x27')],qs[_0xd373('0x2d')](_0x3e657b[_0xd373('0x28')][_0xd373('0x2d')]));_0x45ee58[_0xd373('0x2c')]=_0x45ee58[_0xd373('0x2c')][_0xd373('0x2e')]?_0x45ee58[_0xd373('0x2c')]:_0x3ad8c[_0xd373('0x27')];if(!_0x3e657b['query'][_0xd373('0x2f')](_0xd373('0x30'))){_0x45ee58[_0xd373('0xe')]=qs[_0xd373('0xe')](_0x3e657b[_0xd373('0x28')][_0xd373('0xe')]);_0x45ee58[_0xd373('0xb')]=qs[_0xd373('0xb')](_0x3e657b[_0xd373('0x28')][_0xd373('0xb')]);}_0x45ee58[_0xd373('0x31')]=qs[_0xd373('0x32')](_0x3e657b[_0xd373('0x28')][_0xd373('0x32')]);_0x45ee58[_0xd373('0x33')]=qs['filters'](_[_0xd373('0x34')](_0x3e657b[_0xd373('0x28')],_0x3ad8c[_0xd373('0x2a')]),_0x3384a5);if(_0x3e657b[_0xd373('0x28')]['filter']){_0x45ee58[_0xd373('0x33')]=_[_0xd373('0x35')](_0x45ee58[_0xd373('0x33')],{'$or':_[_0xd373('0x19')](_0x3384a5,function(_0x38d8ec){if(_0x38d8ec[_0xd373('0x1b')]!=='VIRTUAL'){var _0x4a2fc5={};_0x4a2fc5[_0x38d8ec[_0xd373('0x1d')]]={'$like':'%'+_0x3e657b['query'][_0xd373('0x17')]+'%'};return _0x4a2fc5;}})});}_0x45ee58=_[_0xd373('0x35')]({},_0x45ee58,_0x3e657b[_0xd373('0x36')]);var _0x51ba69={'where':_0x45ee58[_0xd373('0x33')]};return db[_0xd373('0x24')][_0xd373('0xd')](_0x51ba69)[_0xd373('0x12')](function(_0x504450){_0x71c5c['count']=_0x504450;if(_0x3e657b['query'][_0xd373('0x37')]){_0x45ee58['include']=[{'all':!![]}];}return db[_0xd373('0x24')][_0xd373('0x38')](_0x45ee58);})['then'](function(_0x4e8734){_0x71c5c['rows']=_0x4e8734;return _0x71c5c;})[_0xd373('0x12')](respondWithFilteredResult(_0x470612,_0x45ee58))[_0xd373('0x39')](handleError(_0x470612,null));};exports[_0xd373('0x3a')]=function(_0x501f8b,_0x5c3b22){var _0xb87e16={'raw':![],'where':{'id':_0x501f8b['params']['id']}},_0x1dfbe2={};_0x1dfbe2[_0xd373('0x27')]=_[_0xd373('0x29')](db[_0xd373('0x24')][_0xd373('0x25')]);_0x1dfbe2[_0xd373('0x28')]=_['keys'](_0x501f8b['query']);_0x1dfbe2[_0xd373('0x2a')]=_[_0xd373('0x2b')](_0x1dfbe2[_0xd373('0x27')],_0x1dfbe2[_0xd373('0x28')]);_0xb87e16['attributes']=_[_0xd373('0x2b')](_0x1dfbe2['model'],qs[_0xd373('0x2d')](_0x501f8b[_0xd373('0x28')][_0xd373('0x2d')]));_0xb87e16[_0xd373('0x2c')]=_0xb87e16[_0xd373('0x2c')]['length']?_0xb87e16[_0xd373('0x2c')]:_0x1dfbe2[_0xd373('0x27')];if(_0x501f8b['query'][_0xd373('0x37')]){_0xb87e16[_0xd373('0x3b')]=[{'all':!![]}];}_0xb87e16=_[_0xd373('0x35')]({},_0xb87e16,_0x501f8b[_0xd373('0x36')]);return db[_0xd373('0x24')][_0xd373('0x1c')](_0xb87e16)[_0xd373('0x12')](handleEntityNotFound(_0x5c3b22,null))[_0xd373('0x12')](respondWithResult(_0x5c3b22,null))[_0xd373('0x39')](handleError(_0x5c3b22,null));};exports[_0xd373('0x11')]=function(_0x5d759f,_0x47a6cc){return db[_0xd373('0x24')]['find']({'where':{'id':_0x5d759f[_0xd373('0x3c')]['id']}})['then'](handleEntityNotFound(_0x47a6cc,null))['then'](removeEntity(_0x47a6cc,null))['catch'](handleError(_0x47a6cc,null));};exports[_0xd373('0x3d')]=function(_0x39d995,_0xc04178){if(_0x39d995[_0xd373('0x3e')][_0xd373('0x1b')]===_0xd373('0x16')&&!_[_0xd373('0x3f')](_0x39d995['body'][_0xd373('0x40')],'_')){_0x39d995['body'][_0xd373('0x40')]='_'[_0xd373('0x41')](_0x39d995['body'][_0xd373('0x40')]);}return db['VoiceExtension'][_0xd373('0x3d')](_0x39d995[_0xd373('0x3e')],{'raw':![]})[_0xd373('0x12')](function(_0x1e97aa){var _0xe22cbd=_0x39d995['user']['get']({'plain':!![]});if(!_0xe22cbd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe22cbd[_0xd373('0x42')]===_0xd373('0x43')){var _0x5b0801=_0x1e97aa[_0xd373('0x13')]({'plain':!![]});var _0x3e6766=[{'name':'InboundRoutes','value':_0xd373('0x15')},{'name':_0xd373('0x44'),'value':_0xd373('0x16')},{'name':_0xd373('0x45'),'value':_0xd373('0x46')}];var _0xa2758=_[_0xd373('0x1c')](_0x3e6766,[_0xd373('0x1a'),_0x5b0801[_0xd373('0x1b')]])[_0xd373('0x1d')];return db[_0xd373('0x47')]['find']({'where':{'name':_0xa2758,'userProfileId':_0xe22cbd['userProfileId']},'raw':!![]})['then'](function(_0x5eed95){if(_0x5eed95&&_0x5eed95['autoAssociation']===0x0){return db['UserProfileResource'][_0xd373('0x3d')]({'name':_0x5b0801[_0xd373('0x1d')],'resourceId':_0x5b0801['id'],'type':_0x5eed95['name'],'sectionId':_0x5eed95['id']},{})['then'](function(){return _0x1e97aa;});}else{return _0x1e97aa;}})['catch'](function(_0x1f52e9){logger[_0xd373('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f52e9);throw _0x1f52e9;});}return _0x1e97aa;})['then'](respondWithResult(_0xc04178,0xc9))[_0xd373('0x39')](handleError(_0xc04178,null));};exports[_0xd373('0x48')]=function(_0x3ed72b,_0x37140f){if(_0x3ed72b[_0xd373('0x3e')]['id']){delete _0x3ed72b['body']['id'];}return db[_0xd373('0x24')][_0xd373('0x1c')]({'where':{'id':_0x3ed72b[_0xd373('0x3c')]['id']}})[_0xd373('0x12')](handleEntityNotFound(_0x37140f,null))[_0xd373('0x12')](function(_0x25eb38){if(_0x25eb38){return db[_0xd373('0x24')][_0xd373('0x48')](_[_0xd373('0x34')](_0x3ed72b[_0xd373('0x3e')],[_0xd373('0x40'),_0xd373('0x49'),_0xd373('0x4a'),_0xd373('0x4b'),_0xd373('0x4c'),'mandatoryDisposition',_0xd373('0x4d')]),{'where':{'context':_0x25eb38[_0xd373('0x49')],'exten':_0x25eb38[_0xd373('0x40')]},'individualHooks':!![]})['then'](function(_0x2bdadf){return _0x2bdadf;});}return null;})['then'](respondWithStatusCode(_0x37140f,null))[_0xd373('0x39')](handleError(_0x37140f,null));};exports['addApplications']=function(_0x209de7,_0x3ae61d){return db[_0xd373('0x24')][_0xd373('0x4e')]({'where':{'id':_0x209de7[_0xd373('0x3c')]['id']}})[_0xd373('0x12')](function(_0xa47b76){if(_0xa47b76){return db[_0xd373('0x4f')][_0xd373('0x50')](function(_0x41bb0b){return db[_0xd373('0x24')][_0xd373('0x11')]({'where':{'VoiceExtensionId':_0x209de7[_0xd373('0x3c')]['id']},'transaction':_0x41bb0b})[_0xd373('0x12')](function(){var _0x2e3266=_[_0xd373('0x19')](_0x209de7[_0xd373('0x3e')],function(_0x35da35){_0x35da35[_0xd373('0x51')]=_0x209de7[_0xd373('0x3c')]['id'];_0x35da35[_0xd373('0x52')]=!![];return _0x35da35;});return _0xa47b76[_0xd373('0x53')](_0x2e3266);})[_0xd373('0x12')](function(_0x5133){console[_0xd373('0x54')](_0xd373('0x55'),_0x5133);return db['VoiceExtension'][_0xd373('0x56')](_0x5133,{'transaction':_0x41bb0b});});})[_0xd373('0x12')](function(){return db[_0xd373('0x24')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x209de7[_0xd373('0x3c')]['id']},'order':_0xd373('0x57')});});}})[_0xd373('0x12')](respondWithResult(_0x3ae61d,null))[_0xd373('0x39')](handleError(_0x3ae61d,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 76ca11f..80aa317 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 _0xded1=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove'];(function(_0x584894,_0x23b9bf){var _0x46a209=function(_0x330acf){while(--_0x330acf){_0x584894['push'](_0x584894['shift']());}};_0x46a209(++_0x23b9bf);}(_0xded1,0xbf));var _0x1ded=function(_0x47cc41,_0x11e552){_0x47cc41=_0x47cc41-0x0;var _0x580c72=_0xded1[_0x47cc41];return _0x580c72;};'use strict';var EventEmitter=require(_0x1ded('0x0'));var VoiceExtension=require(_0x1ded('0x1'))['db'][_0x1ded('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x1ded('0x3')](0x0);var events={'afterCreate':_0x1ded('0x4'),'afterUpdate':_0x1ded('0x5'),'afterDestroy':_0x1ded('0x6')};function emitEvent(_0x3fec7f){return function(_0x59ce95,_0x59514b,_0x4616b2){VoiceExtensionEvents[_0x1ded('0x7')](_0x3fec7f+':'+_0x59ce95['id'],_0x59ce95);VoiceExtensionEvents[_0x1ded('0x7')](_0x3fec7f,_0x59ce95);_0x4616b2(null);};}for(var e in events){if(events[_0x1ded('0x8')](e)){var event=events[e];VoiceExtension[_0x1ded('0x9')](e,emitEvent(event));}}module[_0x1ded('0xa')]=VoiceExtensionEvents; \ No newline at end of file +var _0x79c7=['remove','hook','events','VoiceExtension','save','update'];(function(_0x249dc1,_0x573ede){var _0x3bcb4c=function(_0x35799a){while(--_0x35799a){_0x249dc1['push'](_0x249dc1['shift']());}};_0x3bcb4c(++_0x573ede);}(_0x79c7,0x140));var _0x779c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x79c7[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x779c('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x779c('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x779c('0x2'),'afterUpdate':_0x779c('0x3'),'afterDestroy':_0x779c('0x4')};function emitEvent(_0x1e5ad3){return function(_0x2f47b7,_0x111db5,_0x29b2ac){VoiceExtensionEvents['emit'](_0x1e5ad3+':'+_0x2f47b7['id'],_0x2f47b7);VoiceExtensionEvents['emit'](_0x1e5ad3,_0x2f47b7);_0x29b2ac(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x779c('0x5')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index da1e6b9..91a0d1a 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 _0x4cfd=['CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','length','param','split','phone','prefix','SIP','none','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','then','*,*,*,*','intervals','IntervalId','filter','toLowerCase','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','queue','playback','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','VoiceExtension','voice_extensions','get','lodash','./voiceExtension.attributes','models','type','Set','CDR(type)=','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','cutdigits','${EXTEN:','${EXTEN}'];(function(_0x8819c6,_0x52d431){var _0x81d5dd=function(_0x4df16e){while(--_0x4df16e){_0x8819c6['push'](_0x8819c6['shift']());}};_0x81d5dd(++_0x52d431);}(_0x4cfd,0x170));var _0xd4cf=function(_0x10f6e8,_0x351db6){_0x10f6e8=_0x10f6e8-0x0;var _0x35bb3c=_0x4cfd[_0x10f6e8];return _0x35bb3c;};'use strict';var _=require(_0xd4cf('0x0'));var attributes=require(_0xd4cf('0x1'));module['exports']=function(_0x4072d3){var _0x356001=_0x4072d3[_0xd4cf('0x2')];function _0x407d96(_0x332f55){var _0xe90497=0x2;var _0x4e6f40=[{'type':_0x332f55[_0xd4cf('0x3')],'app':_0xd4cf('0x4'),'appdata':_0xd4cf('0x5')+_0x332f55[_0xd4cf('0x3')],'context':_0x332f55[_0xd4cf('0x6')],'exten':_0x332f55[_0xd4cf('0x7')],'priority':_0xe90497++,'VoiceExtensionId':_0x332f55['id']},{'type':_0x332f55['type'],'app':_0x332f55[_0xd4cf('0x8')]?_0xd4cf('0x4'):_0xd4cf('0x9'),'appdata':_0x332f55[_0xd4cf('0x8')]?_0xd4cf('0xa')+_0x332f55[_0xd4cf('0x8')]:_0xd4cf('0xb'),'context':_0x332f55['context'],'exten':_0x332f55[_0xd4cf('0x7')],'priority':_0xe90497++,'VoiceExtensionId':_0x332f55['id']}];if(_0x332f55[_0xd4cf('0x3')]===_0xd4cf('0xc')){_0x4e6f40[_0xd4cf('0xd')]({'type':_0xd4cf('0xc'),'app':'Set','appdata':'CDR(routeid)='+_0x332f55['id'],'context':_0x332f55[_0xd4cf('0x6')],'exten':_0x332f55[_0xd4cf('0x7')],'priority':_0xe90497++,'VoiceExtensionId':_0x332f55['id']});}_0x4e6f40['push']({'type':_0x332f55[_0xd4cf('0x3')],'app':'Set','appdata':_0xd4cf('0xe'),'context':_0x332f55['context'],'exten':_0x332f55[_0xd4cf('0x7')],'priority':_0xe90497++,'VoiceExtensionId':_0x332f55['id']},{'type':_0x332f55[_0xd4cf('0x3')],'app':'Set','appdata':_0xd4cf('0xf'),'context':_0x332f55[_0xd4cf('0x6')],'exten':_0x332f55[_0xd4cf('0x7')],'priority':_0xe90497++,'VoiceExtensionId':_0x332f55['id']},{'type':_0x332f55[_0xd4cf('0x3')],'app':_0xd4cf('0x4'),'appdata':_0xd4cf('0x10'),'context':_0x332f55['context'],'exten':_0x332f55[_0xd4cf('0x7')],'priority':_0xe90497++,'VoiceExtensionId':_0x332f55['id']});return _0x4e6f40;}function _0x1769e6(_0x2fa4b3){var _0x11b06a=0x2;var _0x8c327a=[{'type':_0xd4cf('0x11'),'app':_0xd4cf('0x4'),'appdata':_0xd4cf('0x12'),'context':_0x2fa4b3[_0xd4cf('0x6')],'exten':_0x2fa4b3[_0xd4cf('0x7')],'priority':_0x11b06a++,'VoiceExtensionId':_0x2fa4b3['id']},{'type':_0xd4cf('0x11'),'app':_0x2fa4b3[_0xd4cf('0x8')]?_0xd4cf('0x4'):_0xd4cf('0x9'),'appdata':_0x2fa4b3[_0xd4cf('0x8')]?_0xd4cf('0xa')+_0x2fa4b3[_0xd4cf('0x8')]:_0xd4cf('0xb'),'context':_0x2fa4b3[_0xd4cf('0x6')],'exten':_0x2fa4b3['exten'],'priority':_0x11b06a++,'VoiceExtensionId':_0x2fa4b3['id']},{'type':_0xd4cf('0x11'),'app':'Set','appdata':'CDR(destination)='+(_0x2fa4b3[_0xd4cf('0x13')]?_0xd4cf('0x14')+_0x2fa4b3[_0xd4cf('0x13')]+'}':_0xd4cf('0x15')),'context':_0x2fa4b3[_0xd4cf('0x6')],'exten':_0x2fa4b3[_0xd4cf('0x7')],'priority':_0x11b06a++,'VoiceExtensionId':_0x2fa4b3['id']},{'type':'outbound','app':_0xd4cf('0x4'),'appdata':'CDR(routeid)='+_0x2fa4b3['id'],'context':_0x2fa4b3[_0xd4cf('0x6')],'exten':_0x2fa4b3[_0xd4cf('0x7')],'priority':_0x11b06a++,'VoiceExtensionId':_0x2fa4b3['id']},{'type':_0xd4cf('0x11'),'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x11b06a+0x2)+'):Goto('+(_0x11b06a+0x1)+')','context':_0x2fa4b3[_0xd4cf('0x6')],'exten':_0x2fa4b3[_0xd4cf('0x7')],'priority':_0x11b06a++,'VoiceExtensionId':_0x2fa4b3['id']},{'type':'outbound','app':'Set','appdata':_0x2fa4b3['cutdigits']?_0xd4cf('0x16')+_0x2fa4b3['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x2fa4b3['context'],'exten':_0x2fa4b3[_0xd4cf('0x7')],'priority':_0x11b06a++,'VoiceExtensionId':_0x2fa4b3['id']},{'type':'outbound','app':_0xd4cf('0x4'),'appdata':_0xd4cf('0xe'),'context':_0x2fa4b3[_0xd4cf('0x6')],'exten':_0x2fa4b3[_0xd4cf('0x7')],'priority':_0x11b06a++,'VoiceExtensionId':_0x2fa4b3['id']},{'type':_0xd4cf('0x11'),'app':_0xd4cf('0x4'),'appdata':_0xd4cf('0xf'),'context':_0x2fa4b3[_0xd4cf('0x6')],'exten':_0x2fa4b3['exten'],'priority':_0x11b06a++,'VoiceExtensionId':_0x2fa4b3['id']},{'type':_0xd4cf('0x11'),'app':_0xd4cf('0x4'),'appdata':_0xd4cf('0x10'),'context':_0x2fa4b3['context'],'exten':_0x2fa4b3['exten'],'priority':_0x11b06a++,'VoiceExtensionId':_0x2fa4b3['id']},{'type':_0xd4cf('0x11'),'app':_0xd4cf('0x4'),'appdata':_0xd4cf('0x17')+_0x2fa4b3['id'],'context':_0x2fa4b3[_0xd4cf('0x6')],'exten':_0x2fa4b3[_0xd4cf('0x7')],'priority':_0x11b06a++,'VoiceExtensionId':_0x2fa4b3['id']}];if(_0x2fa4b3[_0xd4cf('0x18')](_0xd4cf('0x19'))&&_0x2fa4b3[_0xd4cf('0x19')]!=='none'){_0x8c327a[_0xd4cf('0xd')]({'type':_0xd4cf('0x11'),'app':_0xd4cf('0x4'),'appdata':_0xd4cf('0x1a'),'context':_0x2fa4b3[_0xd4cf('0x6')],'exten':_0x2fa4b3[_0xd4cf('0x7')],'priority':_0x11b06a++,'VoiceExtensionId':_0x2fa4b3['id']},{'type':_0xd4cf('0x11'),'app':_0xd4cf('0x4'),'appdata':_0xd4cf('0x1b')+_0x2fa4b3[_0xd4cf('0x19')]||_0xd4cf('0x1c'),'context':_0x2fa4b3[_0xd4cf('0x6')],'exten':_0x2fa4b3[_0xd4cf('0x7')],'priority':_0x11b06a++,'VoiceExtensionId':_0x2fa4b3['id']});}return _0x8c327a;}function _0x4b7399(_0x54a6c2,_0x313a5a){var _0x3a1ea2=[{'name':_0xd4cf('0x1d'),'param':0x0},{'name':_0xd4cf('0x1e'),'param':0x1},{'name':_0xd4cf('0x1f'),'param':0x2},{'name':_0xd4cf('0x20'),'param':0x3}];var _0x3ffc93={};var _0x277106=_0x313a5a['split'](',');var _0x30dcfc=[];for(var _0x2b1a48=0x0;_0x2b1a48<_0x3a1ea2[_0xd4cf('0x21')];_0x2b1a48++){switch(_0x3a1ea2[_0x2b1a48]['name']){case'trunk':_0x3ffc93[_0xd4cf('0x1d')]=_0x277106[_0x3a1ea2[_0x2b1a48][_0xd4cf('0x22')]][_0xd4cf('0x23')]('/')[0x1];_0x3ffc93[_0xd4cf('0x24')]=_0x277106[_0x3a1ea2[_0x2b1a48]['param']][_0xd4cf('0x23')]('/')[0x2];_0x3ffc93[_0xd4cf('0x25')]=_0x3ffc93[_0xd4cf('0x24')]?_0x3ffc93[_0xd4cf('0x24')]['split']('$')[0x0]:undefined;_0x3ffc93['phone']=_0x54a6c2['cutdigits']?(_0x3ffc93[_0xd4cf('0x25')]||'')+_0xd4cf('0x14')+_0x54a6c2[_0xd4cf('0x13')]+'}':(_0x3ffc93[_0xd4cf('0x25')]||'')+_0xd4cf('0x15');_0x30dcfc[_0x3a1ea2[_0x2b1a48][_0xd4cf('0x22')]]=[_0xd4cf('0x26'),_0x3ffc93[_0xd4cf('0x1d')],_0x3ffc93['phone']]['join']('/');break;case'options':_0x3ffc93[_0xd4cf('0x1f')]=_0x277106[_0x3a1ea2[_0x2b1a48]['param']];if(_0x54a6c2[_0xd4cf('0x19')]!==_0xd4cf('0x27')){if(_0x3ffc93[_0xd4cf('0x1f')]['indexOf'](_0xd4cf('0x28'))<0x0){_0x3ffc93[_0xd4cf('0x1f')]+='U(xcally-mixmonitor-context)';}}else{_0x3ffc93[_0xd4cf('0x1f')]=_0x3ffc93['options'][_0xd4cf('0x29')]('U(xcally-mixmonitor-context)','');}_0x30dcfc[_0x3a1ea2[_0x2b1a48][_0xd4cf('0x22')]]=_0x3ffc93[_0xd4cf('0x1f')];break;default:_0x30dcfc[_0x3a1ea2[_0x2b1a48]['param']]=_0x277106[_0x3a1ea2[_0x2b1a48]['param']];}}return _0x30dcfc['join'](',');}function _0x468418(_0x316509,_0x2afc4b,_0x33ebb4){return new Promise(function(_0x430e0e,_0x6d3af9){var _0x5d0cbe=[];if(_[_0xd4cf('0x2a')](_0x2afc4b))return _0x430e0e(_0x5d0cbe);_0x356001[_0xd4cf('0x2b')][_0xd4cf('0x2c')]({'attributes':['id',_0xd4cf('0x2d'),'IntervalId'],'raw':!![]})[_0xd4cf('0x2e')](function(_0x53b3c7){for(var _0x3f63b4=0x0,_0x179c15=0x0;_0x3f63b4<_0x2afc4b['length'];_0x3f63b4++,_0x179c15=0x0){var _0x4be48c=_0x2afc4b[_0x3f63b4];var _0x10d021=[];var _0x37582d=[];delete _0x4be48c['id'];if(_0x4be48c['interval']!==_0xd4cf('0x2f')){_0x4be48c[_0xd4cf('0x30')]=[_0x4be48c[_0xd4cf('0x2d')]];}else{_0x4be48c[_0xd4cf('0x30')]=_0x4be48c[_0xd4cf('0x31')]?_['map'](_[_0xd4cf('0x32')](_0x53b3c7,{'IntervalId':_0x4be48c[_0xd4cf('0x31')]}),_0xd4cf('0x2d')):[];}_0x4be48c[_0xd4cf('0x6')]=_0x316509[_0xd4cf('0x6')];_0x4be48c[_0xd4cf('0x7')]=_0x316509['exten'];if(_0x4be48c[_0xd4cf('0x3')])_0x4be48c[_0xd4cf('0x3')]=_0x4be48c[_0xd4cf('0x3')][_0xd4cf('0x33')]();if(_0x316509[_0xd4cf('0x3')]===_0xd4cf('0x11')){if(_0x4be48c[_0xd4cf('0x18')]('tag')&&_0x4be48c[_0xd4cf('0x34')]&&_0x4be48c[_0xd4cf('0x34')]!=='--'){_0x10d021[_0xd4cf('0xd')]({'type':_0x4be48c[_0xd4cf('0x3')]['toLowerCase'](),'app':_0xd4cf('0x4'),'appdata':_0xd4cf('0x35')+_0x4be48c[_0xd4cf('0x34')],'context':_0x316509[_0xd4cf('0x6')],'exten':_0x316509[_0xd4cf('0x7')],'priority':_0x4be48c[_0xd4cf('0x30')][_0xd4cf('0x21')]+_0x33ebb4+_0x179c15++,'VoiceExtensionId':_0x316509['id']});}_0x10d021['push']({'type':_0x4be48c['type']['toLowerCase'](),'app':_0xd4cf('0x36'),'appdata':_0xd4cf('0x37')+(_0x4be48c[_0xd4cf('0x38')]?_0xd4cf('0x39')+_0x4be48c[_0xd4cf('0x38')]+')':'NoOp(No\x20number\x20available)'),'context':_0x316509['context'],'exten':_0x316509[_0xd4cf('0x7')],'priority':_0x4be48c['intervals'][_0xd4cf('0x21')]+_0x33ebb4+_0x179c15++,'VoiceExtensionId':_0x316509['id']});}else{if(_0x4be48c[_0xd4cf('0x18')]('answer')){if([_0xd4cf('0x3a'),_0xd4cf('0x3b')]['includes'](_0x4be48c['app']['toLowerCase']())&&_0x4be48c['appType']!==_0xd4cf('0x3c')){if(_0x4be48c[_0xd4cf('0x3d')]){_0x10d021['push']({'type':_0x4be48c[_0xd4cf('0x3')]['toLowerCase'](),'app':'ExecIf','appdata':_0xd4cf('0x3e'),'context':_0x316509[_0xd4cf('0x6')],'exten':_0x316509[_0xd4cf('0x7')],'priority':_0x4be48c[_0xd4cf('0x30')][_0xd4cf('0x21')]+_0x33ebb4+_0x179c15++,'VoiceExtensionId':_0x316509['id']});_0x10d021[_0xd4cf('0xd')]({'type':_0x4be48c[_0xd4cf('0x3')][_0xd4cf('0x33')](),'app':_0xd4cf('0x4'),'appdata':_0xd4cf('0x3f'),'context':_0x316509[_0xd4cf('0x6')],'exten':_0x316509[_0xd4cf('0x7')],'priority':_0x4be48c[_0xd4cf('0x30')]['length']+_0x33ebb4+_0x179c15++,'VoiceExtensionId':_0x316509['id']});}else{_0x10d021[_0xd4cf('0xd')]({'type':_0x4be48c[_0xd4cf('0x3')][_0xd4cf('0x33')](),'app':_0xd4cf('0x36'),'appdata':_0xd4cf('0x40'),'context':_0x316509[_0xd4cf('0x6')],'exten':_0x316509['exten'],'priority':_0x4be48c['intervals'][_0xd4cf('0x21')]+_0x33ebb4+_0x179c15++,'VoiceExtensionId':_0x316509['id']});_0x10d021[_0xd4cf('0xd')]({'type':_0x4be48c[_0xd4cf('0x3')][_0xd4cf('0x33')](),'app':_0xd4cf('0x4'),'appdata':_0xd4cf('0x41'),'context':_0x316509[_0xd4cf('0x6')],'exten':_0x316509[_0xd4cf('0x7')],'priority':_0x4be48c[_0xd4cf('0x30')][_0xd4cf('0x21')]+_0x33ebb4+_0x179c15++,'VoiceExtensionId':_0x316509['id']});}}}}for(var _0x671fb9=0x0;_0x671fb9<_0x4be48c[_0xd4cf('0x30')][_0xd4cf('0x21')];_0x671fb9++){var _0x4cbe4f=_0x33ebb4+_0x4be48c[_0xd4cf('0x30')][_0xd4cf('0x21')];var _0x419149=_0x671fb9===_0x4be48c[_0xd4cf('0x30')][_0xd4cf('0x21')]-0x1?_0x33ebb4+_0x10d021[_0xd4cf('0x21')]+_0x37582d[_0xd4cf('0x21')]+0x2:_0x33ebb4+_0x671fb9+0x1;_0x10d021[_0xd4cf('0x42')](_0x671fb9,0x0,{'type':_0x316509[_0xd4cf('0x3')],'app':_0xd4cf('0x43'),'appdata':_0x4be48c[_0xd4cf('0x30')][_0x671fb9]+'?'+_0x316509[_0xd4cf('0x6')]+_0xd4cf('0x44')+_0x4cbe4f+':'+_0x316509['context']+_0xd4cf('0x44')+_0x419149,'exten':_0x316509[_0xd4cf('0x7')],'context':_0x316509[_0xd4cf('0x6')],'priority':_0x33ebb4+_0x671fb9,'VoiceExtensionId':_0x316509['id']});}if(_0x4be48c[_0xd4cf('0x45')]===_0xd4cf('0x46'))_0x4be48c[_0xd4cf('0x47')]=_0x4b7399(_0x316509,_0x4be48c[_0xd4cf('0x47')]);_0x4be48c[_0xd4cf('0x48')]=_0x10d021['length']?_[_0xd4cf('0x49')](_0x10d021)['priority']+0x1:_0x33ebb4;_0x5d0cbe=_[_0xd4cf('0x4a')](_0x5d0cbe,_0x10d021,[_0x4be48c],_0x37582d);_0x33ebb4=_[_0xd4cf('0x49')](_0x5d0cbe)[_0xd4cf('0x48')]+0x1;}return _0x430e0e(_0x5d0cbe);})['catch'](function(_0x4112fc){_0x6d3af9(_0x4112fc);});});}return _0x4072d3['define'](_0xd4cf('0x4b'),attributes,{'tableName':_0xd4cf('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x5353e2){var _0x13acbe=this[_0xd4cf('0x4d')]({'plain':!![]});var _0x39d32d=_0x13acbe[_0xd4cf('0x3')]===_0xd4cf('0x11')?_0x1769e6(_0x13acbe):_0x407d96(_0x13acbe);return _0x468418(_0x13acbe,_0x5353e2,_[_0xd4cf('0x49')](_0x39d32d)[_0xd4cf('0x48')]+0x1)[_0xd4cf('0x2e')](function(_0x514cf2){var _0x2afdd0=_[_0xd4cf('0x4a')](_0x39d32d,_0x514cf2);_0x2afdd0['push']({'type':_0x13acbe[_0xd4cf('0x3')],'app':'Hangup','exten':_0x13acbe[_0xd4cf('0x7')],'context':_0x13acbe[_0xd4cf('0x6')],'priority':_['last'](_0x2afdd0)[_0xd4cf('0x48')]+0x1,'VoiceExtensionId':_0x13acbe['id']});return _0x2afdd0;});}}});}; \ No newline at end of file +var _0x5ad3=['trunk','timeout','options','url','length','name','param','split','phone','prefix','SIP','indexOf','U(xcally-mixmonitor-context)','replace','join','isEmpty','Interval','findAll','IntervalId','then','interval','*,*,*,*','intervals','map','toLowerCase','hasOwnProperty','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','answer','queue','includes','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial','appdata','priority','last','catch','define','VoiceExtension','voice_extensions','get','concat','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','alias','No\x20alias\x20set','inbound','CDR(routeid)=','exten','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','NoOp','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT='];(function(_0x28b7a2,_0x40aa58){var _0x404e08=function(_0x5e2894){while(--_0x5e2894){_0x28b7a2['push'](_0x28b7a2['shift']());}};_0x404e08(++_0x40aa58);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x3ee55a,_0x19aeea){_0x3ee55a=_0x3ee55a-0x0;var _0x581800=_0x5ad3[_0x3ee55a];return _0x581800;};'use strict';var _=require(_0x35ad('0x0'));var attributes=require(_0x35ad('0x1'));module[_0x35ad('0x2')]=function(_0x2a45b7){var _0x5543d1=_0x2a45b7[_0x35ad('0x3')];function _0x373228(_0xc77352){var _0x69a0b3=0x2;var _0x450f55=[{'type':_0xc77352[_0x35ad('0x4')],'app':_0x35ad('0x5'),'appdata':_0x35ad('0x6')+_0xc77352[_0x35ad('0x4')],'context':_0xc77352[_0x35ad('0x7')],'exten':_0xc77352['exten'],'priority':_0x69a0b3++,'VoiceExtensionId':_0xc77352['id']},{'type':_0xc77352[_0x35ad('0x4')],'app':_0xc77352[_0x35ad('0x8')]?_0x35ad('0x5'):'NoOp','appdata':_0xc77352[_0x35ad('0x8')]?'CDR(routeAlias)='+_0xc77352['alias']:_0x35ad('0x9'),'context':_0xc77352[_0x35ad('0x7')],'exten':_0xc77352['exten'],'priority':_0x69a0b3++,'VoiceExtensionId':_0xc77352['id']}];if(_0xc77352[_0x35ad('0x4')]===_0x35ad('0xa')){_0x450f55['push']({'type':'inbound','app':_0x35ad('0x5'),'appdata':_0x35ad('0xb')+_0xc77352['id'],'context':_0xc77352['context'],'exten':_0xc77352[_0x35ad('0xc')],'priority':_0x69a0b3++,'VoiceExtensionId':_0xc77352['id']});}_0x450f55[_0x35ad('0xd')]({'type':_0xc77352['type'],'app':'Set','appdata':_0x35ad('0xe'),'context':_0xc77352[_0x35ad('0x7')],'exten':_0xc77352[_0x35ad('0xc')],'priority':_0x69a0b3++,'VoiceExtensionId':_0xc77352['id']},{'type':_0xc77352['type'],'app':_0x35ad('0x5'),'appdata':_0x35ad('0xf'),'context':_0xc77352['context'],'exten':_0xc77352[_0x35ad('0xc')],'priority':_0x69a0b3++,'VoiceExtensionId':_0xc77352['id']},{'type':_0xc77352['type'],'app':'Set','appdata':_0x35ad('0x10'),'context':_0xc77352[_0x35ad('0x7')],'exten':_0xc77352[_0x35ad('0xc')],'priority':_0x69a0b3++,'VoiceExtensionId':_0xc77352['id']});return _0x450f55;}function _0x56cb8e(_0x2a87bf){var _0x2f3f27=0x2;var _0x233394=[{'type':_0x35ad('0x11'),'app':_0x35ad('0x5'),'appdata':_0x35ad('0x12'),'context':_0x2a87bf['context'],'exten':_0x2a87bf[_0x35ad('0xc')],'priority':_0x2f3f27++,'VoiceExtensionId':_0x2a87bf['id']},{'type':_0x35ad('0x11'),'app':_0x2a87bf['alias']?'Set':_0x35ad('0x13'),'appdata':_0x2a87bf[_0x35ad('0x8')]?'CDR(routeAlias)='+_0x2a87bf[_0x35ad('0x8')]:_0x35ad('0x9'),'context':_0x2a87bf['context'],'exten':_0x2a87bf[_0x35ad('0xc')],'priority':_0x2f3f27++,'VoiceExtensionId':_0x2a87bf['id']},{'type':_0x35ad('0x11'),'app':_0x35ad('0x5'),'appdata':_0x35ad('0x14')+(_0x2a87bf[_0x35ad('0x15')]?_0x35ad('0x16')+_0x2a87bf[_0x35ad('0x15')]+'}':_0x35ad('0x17')),'context':_0x2a87bf[_0x35ad('0x7')],'exten':_0x2a87bf[_0x35ad('0xc')],'priority':_0x2f3f27++,'VoiceExtensionId':_0x2a87bf['id']},{'type':'outbound','app':_0x35ad('0x5'),'appdata':_0x35ad('0xb')+_0x2a87bf['id'],'context':_0x2a87bf['context'],'exten':_0x2a87bf[_0x35ad('0xc')],'priority':_0x2f3f27++,'VoiceExtensionId':_0x2a87bf['id']},{'type':_0x35ad('0x11'),'app':_0x35ad('0x18'),'appdata':_0x35ad('0x19')+(_0x2f3f27+0x2)+_0x35ad('0x1a')+(_0x2f3f27+0x1)+')','context':_0x2a87bf['context'],'exten':_0x2a87bf[_0x35ad('0xc')],'priority':_0x2f3f27++,'VoiceExtensionId':_0x2a87bf['id']},{'type':_0x35ad('0x11'),'app':_0x35ad('0x5'),'appdata':_0x2a87bf[_0x35ad('0x15')]?_0x35ad('0x1b')+_0x2a87bf[_0x35ad('0x15')]+'}':_0x35ad('0x1c'),'context':_0x2a87bf[_0x35ad('0x7')],'exten':_0x2a87bf['exten'],'priority':_0x2f3f27++,'VoiceExtensionId':_0x2a87bf['id']},{'type':_0x35ad('0x11'),'app':_0x35ad('0x5'),'appdata':_0x35ad('0xe'),'context':_0x2a87bf[_0x35ad('0x7')],'exten':_0x2a87bf[_0x35ad('0xc')],'priority':_0x2f3f27++,'VoiceExtensionId':_0x2a87bf['id']},{'type':'outbound','app':'Set','appdata':_0x35ad('0xf'),'context':_0x2a87bf['context'],'exten':_0x2a87bf[_0x35ad('0xc')],'priority':_0x2f3f27++,'VoiceExtensionId':_0x2a87bf['id']},{'type':'outbound','app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x2a87bf['context'],'exten':_0x2a87bf[_0x35ad('0xc')],'priority':_0x2f3f27++,'VoiceExtensionId':_0x2a87bf['id']},{'type':'outbound','app':'Set','appdata':_0x35ad('0x1d')+_0x2a87bf['id'],'context':_0x2a87bf['context'],'exten':_0x2a87bf[_0x35ad('0xc')],'priority':_0x2f3f27++,'VoiceExtensionId':_0x2a87bf['id']}];if(_0x2a87bf['hasOwnProperty'](_0x35ad('0x1e'))&&_0x2a87bf['recordingFormat']!==_0x35ad('0x1f')){_0x233394['push']({'type':_0x35ad('0x11'),'app':_0x35ad('0x5'),'appdata':_0x35ad('0x20'),'context':_0x2a87bf['context'],'exten':_0x2a87bf[_0x35ad('0xc')],'priority':_0x2f3f27++,'VoiceExtensionId':_0x2a87bf['id']},{'type':_0x35ad('0x11'),'app':_0x35ad('0x5'),'appdata':_0x35ad('0x21')+_0x2a87bf[_0x35ad('0x1e')]||'wav','context':_0x2a87bf['context'],'exten':_0x2a87bf[_0x35ad('0xc')],'priority':_0x2f3f27++,'VoiceExtensionId':_0x2a87bf['id']});}return _0x233394;}function _0x1e4c7c(_0x378e2a,_0x1c8a3d){var _0x55e676=[{'name':_0x35ad('0x22'),'param':0x0},{'name':_0x35ad('0x23'),'param':0x1},{'name':_0x35ad('0x24'),'param':0x2},{'name':_0x35ad('0x25'),'param':0x3}];var _0x264135={};var _0x3b7b52=_0x1c8a3d['split'](',');var _0x58250d=[];for(var _0x658444=0x0;_0x658444<_0x55e676[_0x35ad('0x26')];_0x658444++){switch(_0x55e676[_0x658444][_0x35ad('0x27')]){case _0x35ad('0x22'):_0x264135[_0x35ad('0x22')]=_0x3b7b52[_0x55e676[_0x658444][_0x35ad('0x28')]][_0x35ad('0x29')]('/')[0x1];_0x264135[_0x35ad('0x2a')]=_0x3b7b52[_0x55e676[_0x658444][_0x35ad('0x28')]]['split']('/')[0x2];_0x264135[_0x35ad('0x2b')]=_0x264135['phone']?_0x264135[_0x35ad('0x2a')][_0x35ad('0x29')]('$')[0x0]:undefined;_0x264135[_0x35ad('0x2a')]=_0x378e2a[_0x35ad('0x15')]?(_0x264135[_0x35ad('0x2b')]||'')+_0x35ad('0x16')+_0x378e2a[_0x35ad('0x15')]+'}':(_0x264135[_0x35ad('0x2b')]||'')+_0x35ad('0x17');_0x58250d[_0x55e676[_0x658444]['param']]=[_0x35ad('0x2c'),_0x264135[_0x35ad('0x22')],_0x264135[_0x35ad('0x2a')]]['join']('/');break;case _0x35ad('0x24'):_0x264135[_0x35ad('0x24')]=_0x3b7b52[_0x55e676[_0x658444][_0x35ad('0x28')]];if(_0x378e2a[_0x35ad('0x1e')]!==_0x35ad('0x1f')){if(_0x264135[_0x35ad('0x24')][_0x35ad('0x2d')](_0x35ad('0x2e'))<0x0){_0x264135[_0x35ad('0x24')]+=_0x35ad('0x2e');}}else{_0x264135[_0x35ad('0x24')]=_0x264135['options'][_0x35ad('0x2f')]('U(xcally-mixmonitor-context)','');}_0x58250d[_0x55e676[_0x658444][_0x35ad('0x28')]]=_0x264135[_0x35ad('0x24')];break;default:_0x58250d[_0x55e676[_0x658444][_0x35ad('0x28')]]=_0x3b7b52[_0x55e676[_0x658444][_0x35ad('0x28')]];}}return _0x58250d[_0x35ad('0x30')](',');}function _0x26bc9f(_0x165938,_0x24e5e5,_0x1f44ec){return new Promise(function(_0x564407,_0xdf7e22){var _0x253d02=[];if(_[_0x35ad('0x31')](_0x24e5e5))return _0x564407(_0x253d02);_0x5543d1[_0x35ad('0x32')][_0x35ad('0x33')]({'attributes':['id','interval',_0x35ad('0x34')],'raw':!![]})[_0x35ad('0x35')](function(_0x5b78e3){for(var _0x526cff=0x0,_0x143a88=0x0;_0x526cff<_0x24e5e5[_0x35ad('0x26')];_0x526cff++,_0x143a88=0x0){var _0x965100=_0x24e5e5[_0x526cff];var _0x3e4093=[];var _0x57a5f5=[];delete _0x965100['id'];if(_0x965100[_0x35ad('0x36')]!==_0x35ad('0x37')){_0x965100[_0x35ad('0x38')]=[_0x965100[_0x35ad('0x36')]];}else{_0x965100[_0x35ad('0x38')]=_0x965100[_0x35ad('0x34')]?_[_0x35ad('0x39')](_['filter'](_0x5b78e3,{'IntervalId':_0x965100[_0x35ad('0x34')]}),_0x35ad('0x36')):[];}_0x965100[_0x35ad('0x7')]=_0x165938['context'];_0x965100['exten']=_0x165938['exten'];if(_0x965100[_0x35ad('0x4')])_0x965100[_0x35ad('0x4')]=_0x965100[_0x35ad('0x4')][_0x35ad('0x3a')]();if(_0x165938['type']===_0x35ad('0x11')){if(_0x965100[_0x35ad('0x3b')](_0x35ad('0x3c'))&&_0x965100[_0x35ad('0x3c')]&&_0x965100[_0x35ad('0x3c')]!=='--'){_0x3e4093[_0x35ad('0xd')]({'type':_0x965100['type']['toLowerCase'](),'app':_0x35ad('0x5'),'appdata':_0x35ad('0x3d')+_0x965100['tag'],'context':_0x165938['context'],'exten':_0x165938[_0x35ad('0xc')],'priority':_0x965100[_0x35ad('0x38')][_0x35ad('0x26')]+_0x1f44ec+_0x143a88++,'VoiceExtensionId':_0x165938['id']});}_0x3e4093['push']({'type':_0x965100['type'][_0x35ad('0x3a')](),'app':_0x35ad('0x18'),'appdata':_0x35ad('0x3e')+(_0x965100['callerID']?_0x35ad('0x3f')+_0x965100[_0x35ad('0x40')]+')':_0x35ad('0x41')),'context':_0x165938[_0x35ad('0x7')],'exten':_0x165938[_0x35ad('0xc')],'priority':_0x965100[_0x35ad('0x38')]['length']+_0x1f44ec+_0x143a88++,'VoiceExtensionId':_0x165938['id']});}else{if(_0x965100[_0x35ad('0x3b')](_0x35ad('0x42'))){if([_0x35ad('0x43'),'playback'][_0x35ad('0x44')](_0x965100[_0x35ad('0x45')][_0x35ad('0x3a')]())&&_0x965100[_0x35ad('0x46')]!=='custom'){if(_0x965100['answer']){_0x3e4093[_0x35ad('0xd')]({'type':_0x965100[_0x35ad('0x4')][_0x35ad('0x3a')](),'app':_0x35ad('0x18'),'appdata':_0x35ad('0x47'),'context':_0x165938['context'],'exten':_0x165938[_0x35ad('0xc')],'priority':_0x965100[_0x35ad('0x38')][_0x35ad('0x26')]+_0x1f44ec+_0x143a88++,'VoiceExtensionId':_0x165938['id']});_0x3e4093[_0x35ad('0xd')]({'type':_0x965100[_0x35ad('0x4')][_0x35ad('0x3a')](),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x165938[_0x35ad('0x7')],'exten':_0x165938[_0x35ad('0xc')],'priority':_0x965100[_0x35ad('0x38')][_0x35ad('0x26')]+_0x1f44ec+_0x143a88++,'VoiceExtensionId':_0x165938['id']});}else{_0x3e4093[_0x35ad('0xd')]({'type':_0x965100[_0x35ad('0x4')][_0x35ad('0x3a')](),'app':'ExecIf','appdata':_0x35ad('0x48'),'context':_0x165938[_0x35ad('0x7')],'exten':_0x165938[_0x35ad('0xc')],'priority':_0x965100[_0x35ad('0x38')]['length']+_0x1f44ec+_0x143a88++,'VoiceExtensionId':_0x165938['id']});_0x3e4093[_0x35ad('0xd')]({'type':_0x965100[_0x35ad('0x4')]['toLowerCase'](),'app':_0x35ad('0x5'),'appdata':_0x35ad('0x49'),'context':_0x165938[_0x35ad('0x7')],'exten':_0x165938[_0x35ad('0xc')],'priority':_0x965100[_0x35ad('0x38')][_0x35ad('0x26')]+_0x1f44ec+_0x143a88++,'VoiceExtensionId':_0x165938['id']});}}}}for(var _0x40ad55=0x0;_0x40ad55<_0x965100[_0x35ad('0x38')]['length'];_0x40ad55++){var _0x41f5fc=_0x1f44ec+_0x965100[_0x35ad('0x38')][_0x35ad('0x26')];var _0x551b90=_0x40ad55===_0x965100[_0x35ad('0x38')]['length']-0x1?_0x1f44ec+_0x3e4093[_0x35ad('0x26')]+_0x57a5f5[_0x35ad('0x26')]+0x2:_0x1f44ec+_0x40ad55+0x1;_0x3e4093[_0x35ad('0x4a')](_0x40ad55,0x0,{'type':_0x165938[_0x35ad('0x4')],'app':'GotoIfTime','appdata':_0x965100[_0x35ad('0x38')][_0x40ad55]+'?'+_0x165938[_0x35ad('0x7')]+_0x35ad('0x4b')+_0x41f5fc+':'+_0x165938[_0x35ad('0x7')]+_0x35ad('0x4b')+_0x551b90,'exten':_0x165938['exten'],'context':_0x165938[_0x35ad('0x7')],'priority':_0x1f44ec+_0x40ad55,'VoiceExtensionId':_0x165938['id']});}if(_0x965100['appType']===_0x35ad('0x4c'))_0x965100[_0x35ad('0x4d')]=_0x1e4c7c(_0x165938,_0x965100['appdata']);_0x965100[_0x35ad('0x4e')]=_0x3e4093['length']?_[_0x35ad('0x4f')](_0x3e4093)[_0x35ad('0x4e')]+0x1:_0x1f44ec;_0x253d02=_['concat'](_0x253d02,_0x3e4093,[_0x965100],_0x57a5f5);_0x1f44ec=_[_0x35ad('0x4f')](_0x253d02)[_0x35ad('0x4e')]+0x1;}return _0x564407(_0x253d02);})[_0x35ad('0x50')](function(_0x4a9f53){_0xdf7e22(_0x4a9f53);});});}return _0x2a45b7[_0x35ad('0x51')](_0x35ad('0x52'),attributes,{'tableName':_0x35ad('0x53'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x5c2422){var _0x25a347=this[_0x35ad('0x54')]({'plain':!![]});var _0x261823=_0x25a347[_0x35ad('0x4')]===_0x35ad('0x11')?_0x56cb8e(_0x25a347):_0x373228(_0x25a347);return _0x26bc9f(_0x25a347,_0x5c2422,_[_0x35ad('0x4f')](_0x261823)[_0x35ad('0x4e')]+0x1)['then'](function(_0x225b80){var _0x42c85b=_[_0x35ad('0x55')](_0x261823,_0x225b80);_0x42c85b[_0x35ad('0xd')]({'type':_0x25a347[_0x35ad('0x4')],'app':'Hangup','exten':_0x25a347[_0x35ad('0xc')],'context':_0x25a347[_0x35ad('0x7')],'priority':_['last'](_0x42c85b)[_0x35ad('0x4e')]+0x1,'VoiceExtensionId':_0x25a347['id']});return _0x42c85b;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 9dac5d3..34d81db 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 _0x4e83=['VoiceExtension','findAll','options','raw','where','limit','include','map','model','attributes','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','redis','defaults','socket.io-emitter','./voiceExtension.socket','request','then','info','request\x20sent','debug','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','GetVoiceExtension'];(function(_0x979fa0,_0x507187){var _0x442532=function(_0x347477){while(--_0x347477){_0x979fa0['push'](_0x979fa0['shift']());}};_0x442532(++_0x507187);}(_0x4e83,0x1ae));var _0x34e8=function(_0x5cbf3a,_0x31b32b){_0x5cbf3a=_0x5cbf3a-0x0;var _0x360805=_0x4e83[_0x5cbf3a];return _0x360805;};'use strict';var _=require(_0x34e8('0x0'));var util=require('util');var moment=require(_0x34e8('0x1'));var BPromise=require(_0x34e8('0x2'));var rs=require(_0x34e8('0x3'));var fs=require('fs');var Redis=require(_0x34e8('0x4'));var db=require(_0x34e8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x34e8('0x6'));var client=jayson[_0x34e8('0x7')]['http']({'port':0x232a});config[_0x34e8('0x8')]=_[_0x34e8('0x9')](config[_0x34e8('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x34e8('0xa'))(new Redis(config[_0x34e8('0x8')]));require(_0x34e8('0xb'))['register'](socket);function respondWithRpcPromise(_0x8ad56d,_0x1e3038,_0x42bb8d){return new BPromise(function(_0x46fe66,_0x316e99){return client[_0x34e8('0xc')](_0x8ad56d,_0x42bb8d)[_0x34e8('0xd')](function(_0x6827a3){logger[_0x34e8('0xe')]('VoiceExtension,\x20%s,\x20%s',_0x1e3038,_0x34e8('0xf'));logger[_0x34e8('0x10')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x1e3038,_0x34e8('0xf'),JSON[_0x34e8('0x11')](_0x6827a3));if(_0x6827a3[_0x34e8('0x12')]){if(_0x6827a3[_0x34e8('0x12')][_0x34e8('0x13')]===0x1f4){logger[_0x34e8('0x12')](_0x34e8('0x14'),_0x1e3038,_0x6827a3[_0x34e8('0x12')][_0x34e8('0x15')]);return _0x316e99(_0x6827a3['error'][_0x34e8('0x15')]);}logger[_0x34e8('0x12')](_0x34e8('0x14'),_0x1e3038,_0x6827a3[_0x34e8('0x12')][_0x34e8('0x15')]);return _0x46fe66(_0x6827a3['error'][_0x34e8('0x15')]);}else{logger[_0x34e8('0xe')](_0x34e8('0x14'),_0x1e3038,_0x34e8('0xf'));_0x46fe66(_0x6827a3[_0x34e8('0x16')][_0x34e8('0x15')]);}})[_0x34e8('0x17')](function(_0x3eb461){logger[_0x34e8('0x12')](_0x34e8('0x14'),_0x1e3038,_0x3eb461);_0x316e99(_0x3eb461);});});}exports[_0x34e8('0x18')]=function(_0x53b90a){var _0x37fc9e=this;return new Promise(function(_0x368706,_0xe42e15){return db[_0x34e8('0x19')][_0x34e8('0x1a')]({'raw':_0x53b90a[_0x34e8('0x1b')]?_0x53b90a[_0x34e8('0x1b')][_0x34e8('0x1c')]===undefined?!![]:![]:!![],'where':_0x53b90a['options']?_0x53b90a[_0x34e8('0x1b')][_0x34e8('0x1d')]||null:null,'attributes':_0x53b90a['options']?_0x53b90a[_0x34e8('0x1b')]['attributes']||null:null,'limit':_0x53b90a[_0x34e8('0x1b')]?_0x53b90a[_0x34e8('0x1b')][_0x34e8('0x1e')]||null:null,'include':_0x53b90a['options']?_0x53b90a['options'][_0x34e8('0x1f')]?_[_0x34e8('0x20')](_0x53b90a[_0x34e8('0x1b')][_0x34e8('0x1f')],function(_0x2e29fb){return{'model':db[_0x2e29fb[_0x34e8('0x21')]],'as':_0x2e29fb['as'],'attributes':_0x2e29fb[_0x34e8('0x22')],'include':_0x2e29fb['include']?_[_0x34e8('0x20')](_0x2e29fb[_0x34e8('0x1f')],function(_0x46c2a0){return{'model':db[_0x46c2a0[_0x34e8('0x21')]],'as':_0x46c2a0['as'],'attributes':_0x46c2a0[_0x34e8('0x22')],'include':_0x46c2a0[_0x34e8('0x1f')]?_[_0x34e8('0x20')](_0x46c2a0[_0x34e8('0x1f')],function(_0x2b445a){return{'model':db[_0x2b445a[_0x34e8('0x21')]],'as':_0x2b445a['as'],'attributes':_0x2b445a[_0x34e8('0x22')]};}):[]};}):[]};}):[]:[]})[_0x34e8('0xd')](function(_0x1df399){logger[_0x34e8('0xe')](_0x34e8('0x18'),_0x53b90a);logger[_0x34e8('0x10')](_0x34e8('0x18'),_0x53b90a,JSON['stringify'](_0x1df399));_0x368706(_0x1df399);})[_0x34e8('0x17')](function(_0x1a3146){logger['error'](_0x34e8('0x18'),_0x1a3146[_0x34e8('0x15')],_0x53b90a);_0xe42e15(_0x37fc9e[_0x34e8('0x12')](0x1f4,_0x1a3146[_0x34e8('0x15')]));});});}; \ No newline at end of file +var _0x2e65=['code','message','result','catch','GetVoiceExtension','findAll','options','attributes','limit','include','model','map','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x4c4101,_0x45a4ab){var _0x37a7f9=function(_0x35299d){while(--_0x35299d){_0x4c4101['push'](_0x4c4101['shift']());}};_0x37a7f9(++_0x45a4ab);}(_0x2e65,0x193));var _0x52e6=function(_0x4bb581,_0x6f7037){_0x4bb581=_0x4bb581-0x0;var _0x316bf5=_0x2e65[_0x4bb581];return _0x316bf5;};'use strict';var _=require(_0x52e6('0x0'));var util=require(_0x52e6('0x1'));var moment=require(_0x52e6('0x2'));var BPromise=require(_0x52e6('0x3'));var rs=require(_0x52e6('0x4'));var fs=require('fs');var Redis=require(_0x52e6('0x5'));var db=require(_0x52e6('0x6'))['db'];var utils=require(_0x52e6('0x7'));var logger=require('../../config/logger')(_0x52e6('0x8'));var config=require(_0x52e6('0x9'));var jayson=require(_0x52e6('0xa'));var client=jayson[_0x52e6('0xb')][_0x52e6('0xc')]({'port':0x232a});config[_0x52e6('0xd')]=_[_0x52e6('0xe')](config[_0x52e6('0xd')],{'host':_0x52e6('0xf'),'port':0x18eb});var socket=require(_0x52e6('0x10'))(new Redis(config['redis']));require(_0x52e6('0x11'))[_0x52e6('0x12')](socket);function respondWithRpcPromise(_0x556442,_0x330040,_0x543f78){return new BPromise(function(_0x52b3ee,_0x471d57){return client[_0x52e6('0x13')](_0x556442,_0x543f78)[_0x52e6('0x14')](function(_0x465542){logger[_0x52e6('0x15')](_0x52e6('0x16'),_0x330040,'request\x20sent');logger['debug'](_0x52e6('0x17'),_0x330040,_0x52e6('0x18'),JSON['stringify'](_0x465542));if(_0x465542[_0x52e6('0x19')]){if(_0x465542[_0x52e6('0x19')][_0x52e6('0x1a')]===0x1f4){logger[_0x52e6('0x19')](_0x52e6('0x16'),_0x330040,_0x465542[_0x52e6('0x19')][_0x52e6('0x1b')]);return _0x471d57(_0x465542[_0x52e6('0x19')][_0x52e6('0x1b')]);}logger[_0x52e6('0x19')](_0x52e6('0x16'),_0x330040,_0x465542[_0x52e6('0x19')][_0x52e6('0x1b')]);return _0x52b3ee(_0x465542[_0x52e6('0x19')]['message']);}else{logger[_0x52e6('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x330040,'request\x20sent');_0x52b3ee(_0x465542[_0x52e6('0x1c')][_0x52e6('0x1b')]);}})[_0x52e6('0x1d')](function(_0x538568){logger[_0x52e6('0x19')]('VoiceExtension,\x20%s,\x20%s',_0x330040,_0x538568);_0x471d57(_0x538568);});});}exports[_0x52e6('0x1e')]=function(_0x2a07ea){var _0x3cf7f0=this;return new Promise(function(_0x59aaa2,_0xf2df3){return db['VoiceExtension'][_0x52e6('0x1f')]({'raw':_0x2a07ea[_0x52e6('0x20')]?_0x2a07ea[_0x52e6('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x2a07ea[_0x52e6('0x20')]?_0x2a07ea[_0x52e6('0x20')]['where']||null:null,'attributes':_0x2a07ea['options']?_0x2a07ea['options'][_0x52e6('0x21')]||null:null,'limit':_0x2a07ea['options']?_0x2a07ea[_0x52e6('0x20')][_0x52e6('0x22')]||null:null,'include':_0x2a07ea[_0x52e6('0x20')]?_0x2a07ea[_0x52e6('0x20')][_0x52e6('0x23')]?_['map'](_0x2a07ea[_0x52e6('0x20')]['include'],function(_0x1119e5){return{'model':db[_0x1119e5[_0x52e6('0x24')]],'as':_0x1119e5['as'],'attributes':_0x1119e5[_0x52e6('0x21')],'include':_0x1119e5[_0x52e6('0x23')]?_[_0x52e6('0x25')](_0x1119e5[_0x52e6('0x23')],function(_0x408b8e){return{'model':db[_0x408b8e[_0x52e6('0x24')]],'as':_0x408b8e['as'],'attributes':_0x408b8e[_0x52e6('0x21')],'include':_0x408b8e[_0x52e6('0x23')]?_['map'](_0x408b8e[_0x52e6('0x23')],function(_0x255fcd){return{'model':db[_0x255fcd[_0x52e6('0x24')]],'as':_0x255fcd['as'],'attributes':_0x255fcd[_0x52e6('0x21')]};}):[]};}):[]};}):[]:[]})[_0x52e6('0x14')](function(_0xa4817a){logger[_0x52e6('0x15')]('GetVoiceExtension',_0x2a07ea);logger['debug'](_0x52e6('0x1e'),_0x2a07ea,JSON[_0x52e6('0x26')](_0xa4817a));_0x59aaa2(_0xa4817a);})[_0x52e6('0x1d')](function(_0x1e2299){logger[_0x52e6('0x19')]('GetVoiceExtension',_0x1e2299['message'],_0x2a07ea);_0xf2df3(_0x3cf7f0[_0x52e6('0x19')](0x1f4,_0x1e2299[_0x52e6('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index de2fca4..daa65c1 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 _0x7a54=['remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x47bf22,_0x428e2c){var _0x3c9a31=function(_0x27fada){while(--_0x27fada){_0x47bf22['push'](_0x47bf22['shift']());}};_0x3c9a31(++_0x428e2c);}(_0x7a54,0x106));var _0x47a5=function(_0x2fdfda,_0x1d6a0e){_0x2fdfda=_0x2fdfda-0x0;var _0x546bf4=_0x7a54[_0x2fdfda];return _0x546bf4;};'use strict';var VoiceExtensionEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){VoiceExtensionEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);VoiceExtensionEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file +var _0xc4aa=['remove','update','removeListener','register','length','./voiceExtension.events','save'];(function(_0x2a3936,_0x25af36){var _0x42b4b9=function(_0x1c326c){while(--_0x1c326c){_0x2a3936['push'](_0x2a3936['shift']());}};_0x42b4b9(++_0x25af36);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xc4aa[_0x422905];return _0x33dc6c;};'use strict';var VoiceExtensionEvents=require(_0xac4a('0x0'));var events=[_0xac4a('0x1'),_0xac4a('0x2'),_0xac4a('0x3')];function createListener(_0x275161,_0x22469d){return function(_0x58634e){_0x22469d['emit'](_0x275161,_0x58634e);};}function removeListener(_0x47d4f6,_0x2f48ed){return function(){VoiceExtensionEvents[_0xac4a('0x4')](_0x47d4f6,_0x2f48ed);};}exports[_0xac4a('0x5')]=function(_0x215f39){for(var _0x96be2b=0x0,_0x15cd34=events[_0xac4a('0x6')];_0x96be2b<_0x15cd34;_0x96be2b++){var _0x10525b=events[_0x96be2b];var _0x5c6179=createListener('voiceExtension:'+_0x10525b,_0x215f39);VoiceExtensionEvents['on'](_0x10525b,_0x5c6179);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 1e6aaaf..494ddd7 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 _0x90b1=['getMessages','post','create','put','update','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/:id','isAuthenticated','show','/:id/messages'];(function(_0x722103,_0x5732f3){var _0x3e2435=function(_0x44c44a){while(--_0x44c44a){_0x722103['push'](_0x722103['shift']());}};_0x3e2435(++_0x5732f3);}(_0x90b1,0x1bb));var _0x190b=function(_0x7d78f,_0x22d980){_0x7d78f=_0x7d78f-0x0;var _0x1005c3=_0x90b1[_0x7d78f];return _0x1005c3;};'use strict';var multer=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var path=require(_0x190b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x190b('0x3')]();var fs_extra=require(_0x190b('0x4'));var auth=require(_0x190b('0x5'));var interaction=require(_0x190b('0x6'));var config=require('../../config/environment');var controller=require('./voiceMail.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x190b('0x7')]);router[_0x190b('0x8')](_0x190b('0x9'),auth[_0x190b('0xa')](),controller[_0x190b('0xb')]);router[_0x190b('0x8')](_0x190b('0xc'),auth['isAuthenticated'](),controller[_0x190b('0xd')]);router[_0x190b('0xe')]('/',auth[_0x190b('0xa')](),controller[_0x190b('0xf')]);router[_0x190b('0x10')](_0x190b('0x9'),auth[_0x190b('0xa')](),controller[_0x190b('0x11')]);router['delete'](_0x190b('0x9'),auth[_0x190b('0xa')](),controller['destroy']);module[_0x190b('0x12')]=router; \ No newline at end of file +var _0x66fa=['isAuthenticated','index','get','/:id','post','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4aabc1,_0x15e9b0){var _0x302c36=function(_0x5d2280){while(--_0x5d2280){_0x4aabc1['push'](_0x4aabc1['shift']());}};_0x302c36(++_0x15e9b0);}(_0x66fa,0x117));var _0xa66f=function(_0x4c75ee,_0x1887e5){_0x4c75ee=_0x4c75ee-0x0;var _0x3c8449=_0x66fa[_0x4c75ee];return _0x3c8449;};'use strict';var multer=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var path=require('path');var timeout=require(_0xa66f('0x2'));var express=require(_0xa66f('0x3'));var router=express[_0xa66f('0x4')]();var fs_extra=require(_0xa66f('0x5'));var auth=require(_0xa66f('0x6'));var interaction=require(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var controller=require('./voiceMail.controller');router['get']('/',auth[_0xa66f('0x9')](),controller[_0xa66f('0xa')]);router[_0xa66f('0xb')](_0xa66f('0xc'),auth[_0xa66f('0x9')](),controller['show']);router[_0xa66f('0xb')]('/:id/messages',auth[_0xa66f('0x9')](),controller['getMessages']);router[_0xa66f('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa66f('0xc'),auth[_0xa66f('0x9')](),controller['update']);router[_0xa66f('0xe')]('/:id',auth[_0xa66f('0x9')](),controller['destroy']);module[_0xa66f('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 4bb71cc..45911a4 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 _0xe027=['yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','string','trim','central','ENUM'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xe027,0x178));var _0x7e02=function(_0x17cfa0,_0x4a480d){_0x17cfa0=_0x17cfa0-0x0;var _0x5a6e9d=_0xe027[_0x17cfa0];return _0x5a6e9d;};'use strict';var Sequelize=require(_0x7e02('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x7e02('0x1')],'defaultValue':_0x7e02('0x2'),'unique':_0x7e02('0x3')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x7e02('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x7e02('0x1')],'validate':{'isEmail':!![]},'set':function(_0x3247e7){this['setDataValue']('email',typeof _0x3247e7===_0x7e02('0x4')&&_0x3247e7[_0x7e02('0x5')]()?_0x3247e7['trim']():null);}},'pager':{'type':Sequelize[_0x7e02('0x1')]},'tz':{'type':Sequelize[_0x7e02('0x1')],'defaultValue':_0x7e02('0x6')},'attach':{'type':Sequelize[_0x7e02('0x7')](_0x7e02('0x8'),'no'),'defaultValue':_0x7e02('0x8'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x7e02('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x7e02('0x1')]},'callback':{'type':Sequelize[_0x7e02('0x1')]},'review':{'type':Sequelize[_0x7e02('0x7')](_0x7e02('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x7e02('0x7')](_0x7e02('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x7e02('0x7')](_0x7e02('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x7e02('0x7')](_0x7e02('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x7e02('0x7')](_0x7e02('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x7e02('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x7e02('0x7')](_0x7e02('0x8'),'no'),'defaultValue':_0x7e02('0x8'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x7e02('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x7e02('0x7')](_0x7e02('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x7e02('0x7')](_0x7e02('0x8'),'no'),'defaultValue':_0x7e02('0x8'),'allowNull':![]},'stamp':{'type':_0x7e02('0x9')},'emailsubject':{'type':Sequelize[_0x7e02('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x7e02('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x7e02('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x7e02('0xb')],'get':function(){return this[_0x7e02('0xc')](_0x7e02('0xd'))+_0x7e02('0xe')+this[_0x7e02('0xc')](_0x7e02('0xf'));}}}; \ No newline at end of file +var _0x821f=['\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','trim','central','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue'];(function(_0x45226c,_0x18df86){var _0x8d2b7a=function(_0x552f49){while(--_0x552f49){_0x45226c['push'](_0x45226c['shift']());}};_0x8d2b7a(++_0x18df86);}(_0x821f,0xb2));var _0xf821=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x821f[_0x16d10f];return _0x50c823;};'use strict';var Sequelize=require(_0xf821('0x0'));module[_0xf821('0x1')]={'customer_id':{'type':Sequelize[_0xf821('0x2')]},'context':{'type':Sequelize[_0xf821('0x2')],'defaultValue':_0xf821('0x3'),'unique':_0xf821('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xf821('0x4')},'password':{'type':Sequelize[_0xf821('0x2')]},'fullname':{'type':Sequelize[_0xf821('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0xb27fdb){this[_0xf821('0x5')]('email',typeof _0xb27fdb==='string'&&_0xb27fdb['trim']()?_0xb27fdb[_0xf821('0x6')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0xf821('0x2')],'defaultValue':_0xf821('0x7')},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xf821('0x8')](_0xf821('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xf821('0x2')]},'callback':{'type':Sequelize[_0xf821('0x2')]},'review':{'type':Sequelize['ENUM'](_0xf821('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xf821('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xf821('0x8')](_0xf821('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xf821('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xf821('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xf821('0x8')](_0xf821('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0xf821('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xf821('0x8')]('yes','no'),'defaultValue':_0xf821('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xf821('0x8')](_0xf821('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xf821('0x8')](_0xf821('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xf821('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xf821('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xf821('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xf821('0xc')],'get':function(){return this[_0xf821('0xd')]('fullname')+_0xf821('0xe')+this[_0xf821('0xd')](_0xf821('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index ecf03e4..88429af 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 _0xea28=['undefined','limit','count','reject','update','then','get','Voicemails','sendStatus','stack','name','send','index','map','VoiceMail','fieldName','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','intersection','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','UserProfileResource','body','params','destroy','getMessages','VoiceMailMessage','rawAttributes','order','mailbox','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset'];(function(_0x1788c5,_0x183a9d){var _0x41830f=function(_0xddf3aa){while(--_0xddf3aa){_0x1788c5['push'](_0x1788c5['shift']());}};_0x41830f(++_0x183a9d);}(_0xea28,0x13a));var _0x8ea2=function(_0x39e428,_0x38293d){_0x39e428=_0x39e428-0x0;var _0x5a497b=_0xea28[_0x39e428];return _0x5a497b;};'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 hardwareService=require('../../config/license/hardware');var logger=require(_0x8ea2('0x16'))(_0x8ea2('0x17'));var utils=require(_0x8ea2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8ea2('0x19'));var db=require(_0x8ea2('0x1a'))['db'];function respondWithStatusCode(_0x1dfb6e,_0x10aead){_0x10aead=_0x10aead||0xcc;return function(_0xe47c0e){if(_0xe47c0e){return _0x1dfb6e['sendStatus'](_0x10aead);}return _0x1dfb6e[_0x8ea2('0x1b')](_0x10aead)['end']();};}function respondWithResult(_0x4b2192,_0x772bad){_0x772bad=_0x772bad||0xc8;return function(_0x4726a7){if(_0x4726a7){return _0x4b2192[_0x8ea2('0x1b')](_0x772bad)[_0x8ea2('0x1c')](_0x4726a7);}};}function respondWithFilteredResult(_0x393faf,_0xbb9bd1){return function(_0x3cff96){if(_0x3cff96){var _0x11f5e8=typeof _0xbb9bd1[_0x8ea2('0x1d')]===_0x8ea2('0x1e')&&typeof _0xbb9bd1[_0x8ea2('0x1f')]===_0x8ea2('0x1e');var _0x3bc774=_0x3cff96[_0x8ea2('0x20')];var _0x1b64cf=_0x11f5e8?0x0:_0xbb9bd1[_0x8ea2('0x1d')];var _0x467045=_0x11f5e8?_0x3cff96[_0x8ea2('0x20')]:_0xbb9bd1[_0x8ea2('0x1d')]+_0xbb9bd1[_0x8ea2('0x1f')];var _0x134cbe;if(_0x467045>=_0x3bc774){_0x467045=_0x3bc774;_0x134cbe=0xc8;}else{_0x134cbe=0xce;}_0x393faf[_0x8ea2('0x1b')](_0x134cbe);return _0x393faf['set']('Content-Range',_0x1b64cf+'-'+_0x467045+'/'+_0x3bc774)[_0x8ea2('0x1c')](_0x3cff96);}return null;};}function patchUpdates(_0x248c18){return function(_0x29151a){try{jsonpatch['apply'](_0x29151a,_0x248c18,!![]);}catch(_0x46f4fe){return BPromise[_0x8ea2('0x21')](_0x46f4fe);}return _0x29151a['save']();};}function saveUpdates(_0x3d593b,_0x283f00){return function(_0x37229a){if(_0x37229a){return _0x37229a[_0x8ea2('0x22')](_0x3d593b)[_0x8ea2('0x23')](function(_0xe5c943){return _0xe5c943;});}return null;};}function removeEntity(_0x199417,_0x1e4cc9){return function(_0x18ec34){if(_0x18ec34){return _0x18ec34['destroy']()[_0x8ea2('0x23')](function(){var _0x4f48bd=_0x18ec34[_0x8ea2('0x24')]({'plain':!![]});var _0x42bec8=_0x8ea2('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x42bec8,'resourceId':_0x4f48bd['id']}})[_0x8ea2('0x23')](function(){return _0x18ec34;});})['then'](function(){_0x199417[_0x8ea2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3be291,_0x12fa37){return function(_0x21c526){if(!_0x21c526){_0x3be291[_0x8ea2('0x26')](0x194);}return _0x21c526;};}function handleError(_0x4e1b90,_0x5ce1d4){_0x5ce1d4=_0x5ce1d4||0x1f4;return function(_0xacaa6c){logger['error'](_0xacaa6c[_0x8ea2('0x27')]);if(_0xacaa6c[_0x8ea2('0x28')]){delete _0xacaa6c[_0x8ea2('0x28')];}_0x4e1b90[_0x8ea2('0x1b')](_0x5ce1d4)[_0x8ea2('0x29')](_0xacaa6c);};}exports[_0x8ea2('0x2a')]=function(_0x32e225,_0x316707){var _0x19e868={},_0x9c5fac={},_0x56d914={'count':0x0,'rows':[]};var _0x5b7ff9=_[_0x8ea2('0x2b')](db[_0x8ea2('0x2c')]['rawAttributes'],function(_0x4a110f){return{'name':_0x4a110f[_0x8ea2('0x2d')],'type':_0x4a110f['type'][_0x8ea2('0x2e')]};});_0x9c5fac[_0x8ea2('0x2f')]=_['map'](_0x5b7ff9,_0x8ea2('0x28'));_0x9c5fac[_0x8ea2('0x30')]=_[_0x8ea2('0x31')](_0x32e225['query']);_0x9c5fac['filters']=_['intersection'](_0x9c5fac[_0x8ea2('0x2f')],_0x9c5fac[_0x8ea2('0x30')]);_0x19e868[_0x8ea2('0x32')]=_['intersection'](_0x9c5fac[_0x8ea2('0x2f')],qs[_0x8ea2('0x33')](_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x33')]));_0x19e868[_0x8ea2('0x32')]=_0x19e868[_0x8ea2('0x32')][_0x8ea2('0x34')]?_0x19e868[_0x8ea2('0x32')]:_0x9c5fac['model'];if(!_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x35')](_0x8ea2('0x36'))){_0x19e868[_0x8ea2('0x1f')]=qs['limit'](_0x32e225[_0x8ea2('0x30')]['limit']);_0x19e868[_0x8ea2('0x1d')]=qs[_0x8ea2('0x1d')](_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x1d')]);}_0x19e868['order']=qs[_0x8ea2('0x37')](_0x32e225['query']['sort']);_0x19e868[_0x8ea2('0x38')]=qs['filters'](_[_0x8ea2('0x39')](_0x32e225[_0x8ea2('0x30')],_0x9c5fac[_0x8ea2('0x3a')]),_0x5b7ff9);if(_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x3b')]){_0x19e868['where']=_[_0x8ea2('0x3c')](_0x19e868['where'],{'$or':_[_0x8ea2('0x2b')](_0x5b7ff9,function(_0x282f00){if(_0x282f00[_0x8ea2('0x3d')]!==_0x8ea2('0x3e')){var _0x4f9a8c={};_0x4f9a8c[_0x282f00[_0x8ea2('0x28')]]={'$like':'%'+_0x32e225['query'][_0x8ea2('0x3b')]+'%'};return _0x4f9a8c;}})});}_0x19e868=_['merge']({},_0x19e868,_0x32e225[_0x8ea2('0x3f')]);var _0x450e8f={'where':_0x19e868[_0x8ea2('0x38')]};return db[_0x8ea2('0x2c')][_0x8ea2('0x20')](_0x450e8f)[_0x8ea2('0x23')](function(_0x2f4fa8){_0x56d914['count']=_0x2f4fa8;if(_0x32e225['query'][_0x8ea2('0x40')]){_0x19e868['include']=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x19e868);})[_0x8ea2('0x23')](function(_0x5d9ba0){_0x56d914[_0x8ea2('0x41')]=_0x5d9ba0;return _0x56d914;})[_0x8ea2('0x23')](respondWithFilteredResult(_0x316707,_0x19e868))[_0x8ea2('0x42')](handleError(_0x316707,null));};exports[_0x8ea2('0x43')]=function(_0x989d9b,_0x8f700f){var _0x3b2219={'raw':!![],'where':{'id':_0x989d9b['params']['id']}},_0x348b17={};_0x348b17[_0x8ea2('0x2f')]=_[_0x8ea2('0x31')](db[_0x8ea2('0x2c')]['rawAttributes']);_0x348b17[_0x8ea2('0x30')]=_[_0x8ea2('0x31')](_0x989d9b[_0x8ea2('0x30')]);_0x348b17[_0x8ea2('0x3a')]=_[_0x8ea2('0x44')](_0x348b17['model'],_0x348b17[_0x8ea2('0x30')]);_0x3b2219[_0x8ea2('0x32')]=_[_0x8ea2('0x44')](_0x348b17['model'],qs[_0x8ea2('0x33')](_0x989d9b[_0x8ea2('0x30')][_0x8ea2('0x33')]));_0x3b2219[_0x8ea2('0x32')]=_0x3b2219[_0x8ea2('0x32')][_0x8ea2('0x34')]?_0x3b2219[_0x8ea2('0x32')]:_0x348b17[_0x8ea2('0x2f')];if(_0x989d9b[_0x8ea2('0x30')][_0x8ea2('0x40')]){_0x3b2219[_0x8ea2('0x45')]=[{'all':!![]}];}_0x3b2219=_[_0x8ea2('0x3c')]({},_0x3b2219,_0x989d9b[_0x8ea2('0x3f')]);return db[_0x8ea2('0x2c')]['find'](_0x3b2219)[_0x8ea2('0x23')](handleEntityNotFound(_0x8f700f,null))[_0x8ea2('0x23')](respondWithResult(_0x8f700f,null))[_0x8ea2('0x42')](handleError(_0x8f700f,null));};exports[_0x8ea2('0x46')]=function(_0x182a46,_0x1daa25){return db[_0x8ea2('0x2c')][_0x8ea2('0x46')](_0x182a46['body'],{})[_0x8ea2('0x23')](function(_0x37a1cf){var _0x24dddb=_0x182a46['user']['get']({'plain':!![]});if(!_0x24dddb)throw new Error(_0x8ea2('0x47'));if(_0x24dddb[_0x8ea2('0x48')]===_0x8ea2('0x49')){var _0x5e5c37=_0x37a1cf[_0x8ea2('0x24')]({'plain':!![]});var _0x315b5d=_0x8ea2('0x25');return db[_0x8ea2('0x4a')][_0x8ea2('0x4b')]({'where':{'name':_0x315b5d,'userProfileId':_0x24dddb['userProfileId']},'raw':!![]})['then'](function(_0x24a22a){if(_0x24a22a&&_0x24a22a[_0x8ea2('0x4c')]===0x0){return db[_0x8ea2('0x4d')]['create']({'name':_0x5e5c37[_0x8ea2('0x28')],'resourceId':_0x5e5c37['id'],'type':_0x24a22a[_0x8ea2('0x28')],'sectionId':_0x24a22a['id']},{})[_0x8ea2('0x23')](function(){return _0x37a1cf;});}else{return _0x37a1cf;}})['catch'](function(_0x5c6524){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c6524);throw _0x5c6524;});}return _0x37a1cf;})['then'](respondWithResult(_0x1daa25,0xc9))[_0x8ea2('0x42')](handleError(_0x1daa25,null));};exports[_0x8ea2('0x22')]=function(_0x5f56f8,_0x49cf11){if(_0x5f56f8[_0x8ea2('0x4e')]['id']){delete _0x5f56f8[_0x8ea2('0x4e')]['id'];}return db[_0x8ea2('0x2c')]['find']({'where':{'id':_0x5f56f8[_0x8ea2('0x4f')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x49cf11,null))['then'](saveUpdates(_0x5f56f8[_0x8ea2('0x4e')],null))[_0x8ea2('0x23')](respondWithResult(_0x49cf11,null))[_0x8ea2('0x42')](handleError(_0x49cf11,null));};exports[_0x8ea2('0x50')]=function(_0x4728b4,_0x58674d){return db['VoiceMail']['find']({'where':{'id':_0x4728b4[_0x8ea2('0x4f')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x58674d,null))[_0x8ea2('0x23')](removeEntity(_0x58674d,null))[_0x8ea2('0x42')](handleError(_0x58674d,null));};exports[_0x8ea2('0x51')]=function(_0x3836c3,_0x36fda3,_0x5265e7){return db['VoiceMail']['findOne']({'where':{'id':_0x3836c3[_0x8ea2('0x4f')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x36fda3,null))[_0x8ea2('0x23')](function(_0x2bbec0){var _0x57720d;var _0x11824e={},_0x2b8662={};_0x2b8662['model']=_[_0x8ea2('0x31')](db[_0x8ea2('0x52')][_0x8ea2('0x53')]);_0x2b8662[_0x8ea2('0x30')]=_[_0x8ea2('0x31')](_0x3836c3['query']);_0x2b8662['filters']=_['intersection'](_0x2b8662[_0x8ea2('0x2f')],_0x2b8662[_0x8ea2('0x30')]);_0x11824e[_0x8ea2('0x32')]=_[_0x8ea2('0x44')](_0x2b8662[_0x8ea2('0x2f')],qs['fields'](_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x33')]));_0x11824e[_0x8ea2('0x32')]=_0x11824e[_0x8ea2('0x32')]['length']?_0x11824e[_0x8ea2('0x32')]:_0x2b8662['model'];if(!_0x3836c3[_0x8ea2('0x30')]['hasOwnProperty'](_0x8ea2('0x36'))){_0x11824e[_0x8ea2('0x1f')]=qs['limit'](_0x3836c3['query'][_0x8ea2('0x1f')]);_0x11824e['offset']=qs[_0x8ea2('0x1d')](_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x1d')]);}_0x11824e[_0x8ea2('0x54')]=qs['sort'](_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x37')]);_0x11824e[_0x8ea2('0x38')]=qs[_0x8ea2('0x3a')](_[_0x8ea2('0x39')](_0x3836c3[_0x8ea2('0x30')],_0x2b8662[_0x8ea2('0x3a')]));if(_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x3b')]){_0x11824e[_0x8ea2('0x38')]=_[_0x8ea2('0x3c')](_0x11824e[_0x8ea2('0x38')],{'$or':_['map'](_0x11824e[_0x8ea2('0x32')],function(_0x2d130a){var _0x4de6ba={};_0x4de6ba[_0x2d130a]={'$like':'%'+_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x3b')]+'%'};return _0x4de6ba;})});}_0x11824e[_0x8ea2('0x38')]=_[_0x8ea2('0x3c')](_0x11824e[_0x8ea2('0x38')],{'mailboxuser':_0x2bbec0[_0x8ea2('0x55')]});_0x11824e=_[_0x8ea2('0x3c')]({},_0x11824e,_0x3836c3[_0x8ea2('0x3f')]);return db[_0x8ea2('0x52')]['findAndCountAll'](_0x11824e)[_0x8ea2('0x23')](respondWithFilteredResult(_0x36fda3,_0x11824e));})[_0x8ea2('0x42')](handleError(_0x36fda3,null));}; \ No newline at end of file +var _0x84a0=['UserProfileSection','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','save','update','destroy','then','get','Voicemails','error','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','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','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user'];(function(_0x3815c2,_0x1f54e3){var _0x271f88=function(_0x53963c){while(--_0x53963c){_0x3815c2['push'](_0x3815c2['shift']());}};_0x271f88(++_0x1f54e3);}(_0x84a0,0x66));var _0x084a=function(_0x365543,_0x570115){_0x365543=_0x365543-0x0;var _0x9b933c=_0x84a0[_0x365543];return _0x9b933c;};'use strict';var emlformat=require(_0x084a('0x0'));var rimraf=require(_0x084a('0x1'));var zipdir=require(_0x084a('0x2'));var jsonpatch=require(_0x084a('0x3'));var rp=require('request-promise');var moment=require(_0x084a('0x4'));var BPromise=require(_0x084a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x084a('0x6'));var sox=require(_0x084a('0x7'));var csv=require('to-csv');var ejs=require(_0x084a('0x8'));var fs=require('fs');var fs_extra=require(_0x084a('0x9'));var _=require(_0x084a('0xa'));var squel=require(_0x084a('0xb'));var crypto=require(_0x084a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x084a('0xd'));var toCsv=require(_0x084a('0xe'));var querystring=require(_0x084a('0xf'));var Papa=require(_0x084a('0x10'));var Redis=require(_0x084a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x084a('0x12'));var hardwareService=require(_0x084a('0x13'));var logger=require(_0x084a('0x14'))(_0x084a('0x15'));var utils=require(_0x084a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x084a('0x17'))['db'];function respondWithStatusCode(_0x3ca72f,_0xec90a5){_0xec90a5=_0xec90a5||0xcc;return function(_0x9245b1){if(_0x9245b1){return _0x3ca72f[_0x084a('0x18')](_0xec90a5);}return _0x3ca72f[_0x084a('0x19')](_0xec90a5)[_0x084a('0x1a')]();};}function respondWithResult(_0x3a76d1,_0x5aef40){_0x5aef40=_0x5aef40||0xc8;return function(_0x4277c9){if(_0x4277c9){return _0x3a76d1['status'](_0x5aef40)[_0x084a('0x1b')](_0x4277c9);}};}function respondWithFilteredResult(_0x3ccaca,_0x366624){return function(_0x2d35b8){if(_0x2d35b8){var _0xd20527=typeof _0x366624['offset']===_0x084a('0x1c')&&typeof _0x366624['limit']===_0x084a('0x1c');var _0x355b45=_0x2d35b8['count'];var _0xf2c333=_0xd20527?0x0:_0x366624[_0x084a('0x1d')];var _0x4134b9=_0xd20527?_0x2d35b8[_0x084a('0x1e')]:_0x366624[_0x084a('0x1d')]+_0x366624[_0x084a('0x1f')];var _0x447a19;if(_0x4134b9>=_0x355b45){_0x4134b9=_0x355b45;_0x447a19=0xc8;}else{_0x447a19=0xce;}_0x3ccaca[_0x084a('0x19')](_0x447a19);return _0x3ccaca[_0x084a('0x20')](_0x084a('0x21'),_0xf2c333+'-'+_0x4134b9+'/'+_0x355b45)[_0x084a('0x1b')](_0x2d35b8);}return null;};}function patchUpdates(_0x279e25){return function(_0x116328){try{jsonpatch[_0x084a('0x22')](_0x116328,_0x279e25,!![]);}catch(_0xf0dd98){return BPromise['reject'](_0xf0dd98);}return _0x116328[_0x084a('0x23')]();};}function saveUpdates(_0x1ad257,_0x41a90f){return function(_0x2d62bf){if(_0x2d62bf){return _0x2d62bf[_0x084a('0x24')](_0x1ad257)['then'](function(_0x755c24){return _0x755c24;});}return null;};}function removeEntity(_0x288e9e,_0x6346a5){return function(_0x1f2c9f){if(_0x1f2c9f){return _0x1f2c9f[_0x084a('0x25')]()[_0x084a('0x26')](function(){var _0x5be167=_0x1f2c9f[_0x084a('0x27')]({'plain':!![]});var _0x2af138=_0x084a('0x28');return db['UserProfileResource'][_0x084a('0x25')]({'where':{'type':_0x2af138,'resourceId':_0x5be167['id']}})[_0x084a('0x26')](function(){return _0x1f2c9f;});})[_0x084a('0x26')](function(){_0x288e9e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4874fe,_0x52227a){return function(_0x33b88f){if(!_0x33b88f){_0x4874fe['sendStatus'](0x194);}return _0x33b88f;};}function handleError(_0x5bea78,_0x51c9f4){_0x51c9f4=_0x51c9f4||0x1f4;return function(_0x3b8176){logger[_0x084a('0x29')](_0x3b8176[_0x084a('0x2a')]);if(_0x3b8176[_0x084a('0x2b')]){delete _0x3b8176[_0x084a('0x2b')];}_0x5bea78[_0x084a('0x19')](_0x51c9f4)[_0x084a('0x2c')](_0x3b8176);};}exports[_0x084a('0x2d')]=function(_0x5e6ea8,_0x2ed3cd){var _0x3b2b38={},_0x501a16={},_0xe1980b={'count':0x0,'rows':[]};var _0x24bcf5=_[_0x084a('0x2e')](db[_0x084a('0x2f')][_0x084a('0x30')],function(_0x202602){return{'name':_0x202602[_0x084a('0x31')],'type':_0x202602[_0x084a('0x32')][_0x084a('0x33')]};});_0x501a16[_0x084a('0x34')]=_[_0x084a('0x2e')](_0x24bcf5,_0x084a('0x2b'));_0x501a16[_0x084a('0x35')]=_['keys'](_0x5e6ea8['query']);_0x501a16[_0x084a('0x36')]=_[_0x084a('0x37')](_0x501a16[_0x084a('0x34')],_0x501a16[_0x084a('0x35')]);_0x3b2b38[_0x084a('0x38')]=_['intersection'](_0x501a16[_0x084a('0x34')],qs[_0x084a('0x39')](_0x5e6ea8[_0x084a('0x35')]['fields']));_0x3b2b38[_0x084a('0x38')]=_0x3b2b38[_0x084a('0x38')][_0x084a('0x3a')]?_0x3b2b38['attributes']:_0x501a16['model'];if(!_0x5e6ea8['query'][_0x084a('0x3b')](_0x084a('0x3c'))){_0x3b2b38[_0x084a('0x1f')]=qs['limit'](_0x5e6ea8[_0x084a('0x35')][_0x084a('0x1f')]);_0x3b2b38[_0x084a('0x1d')]=qs[_0x084a('0x1d')](_0x5e6ea8[_0x084a('0x35')][_0x084a('0x1d')]);}_0x3b2b38[_0x084a('0x3d')]=qs[_0x084a('0x3e')](_0x5e6ea8[_0x084a('0x35')][_0x084a('0x3e')]);_0x3b2b38[_0x084a('0x3f')]=qs[_0x084a('0x36')](_[_0x084a('0x40')](_0x5e6ea8[_0x084a('0x35')],_0x501a16[_0x084a('0x36')]),_0x24bcf5);if(_0x5e6ea8['query'][_0x084a('0x41')]){_0x3b2b38[_0x084a('0x3f')]=_[_0x084a('0x42')](_0x3b2b38[_0x084a('0x3f')],{'$or':_[_0x084a('0x2e')](_0x24bcf5,function(_0x22862b){if(_0x22862b[_0x084a('0x32')]!==_0x084a('0x43')){var _0x13dc4c={};_0x13dc4c[_0x22862b['name']]={'$like':'%'+_0x5e6ea8[_0x084a('0x35')][_0x084a('0x41')]+'%'};return _0x13dc4c;}})});}_0x3b2b38=_[_0x084a('0x42')]({},_0x3b2b38,_0x5e6ea8[_0x084a('0x44')]);var _0x256008={'where':_0x3b2b38[_0x084a('0x3f')]};return db['VoiceMail'][_0x084a('0x1e')](_0x256008)[_0x084a('0x26')](function(_0x55c5f4){_0xe1980b[_0x084a('0x1e')]=_0x55c5f4;if(_0x5e6ea8[_0x084a('0x35')][_0x084a('0x45')]){_0x3b2b38['include']=[{'all':!![]}];}return db[_0x084a('0x2f')][_0x084a('0x46')](_0x3b2b38);})['then'](function(_0x3e2b92){_0xe1980b[_0x084a('0x47')]=_0x3e2b92;return _0xe1980b;})['then'](respondWithFilteredResult(_0x2ed3cd,_0x3b2b38))['catch'](handleError(_0x2ed3cd,null));};exports[_0x084a('0x48')]=function(_0x17a8d4,_0x3726bd){var _0xec2713={'raw':!![],'where':{'id':_0x17a8d4[_0x084a('0x49')]['id']}},_0x1e2a2d={};_0x1e2a2d[_0x084a('0x34')]=_[_0x084a('0x4a')](db[_0x084a('0x2f')][_0x084a('0x30')]);_0x1e2a2d[_0x084a('0x35')]=_['keys'](_0x17a8d4['query']);_0x1e2a2d[_0x084a('0x36')]=_[_0x084a('0x37')](_0x1e2a2d[_0x084a('0x34')],_0x1e2a2d['query']);_0xec2713[_0x084a('0x38')]=_[_0x084a('0x37')](_0x1e2a2d[_0x084a('0x34')],qs[_0x084a('0x39')](_0x17a8d4[_0x084a('0x35')]['fields']));_0xec2713[_0x084a('0x38')]=_0xec2713['attributes'][_0x084a('0x3a')]?_0xec2713[_0x084a('0x38')]:_0x1e2a2d[_0x084a('0x34')];if(_0x17a8d4['query']['includeAll']){_0xec2713[_0x084a('0x4b')]=[{'all':!![]}];}_0xec2713=_[_0x084a('0x42')]({},_0xec2713,_0x17a8d4['options']);return db[_0x084a('0x2f')][_0x084a('0x4c')](_0xec2713)[_0x084a('0x26')](handleEntityNotFound(_0x3726bd,null))[_0x084a('0x26')](respondWithResult(_0x3726bd,null))['catch'](handleError(_0x3726bd,null));};exports[_0x084a('0x4d')]=function(_0x865368,_0x31677b){return db[_0x084a('0x2f')]['create'](_0x865368[_0x084a('0x4e')],{})[_0x084a('0x26')](function(_0x411fa9){var _0x2d3d01=_0x865368['user']['get']({'plain':!![]});if(!_0x2d3d01)throw new Error(_0x084a('0x4f'));if(_0x2d3d01[_0x084a('0x50')]===_0x084a('0x51')){var _0x264f09=_0x411fa9[_0x084a('0x27')]({'plain':!![]});var _0x3b2df4=_0x084a('0x28');return db[_0x084a('0x52')][_0x084a('0x4c')]({'where':{'name':_0x3b2df4,'userProfileId':_0x2d3d01[_0x084a('0x53')]},'raw':!![]})[_0x084a('0x26')](function(_0x98769c){if(_0x98769c&&_0x98769c['autoAssociation']===0x0){return db[_0x084a('0x54')][_0x084a('0x4d')]({'name':_0x264f09[_0x084a('0x2b')],'resourceId':_0x264f09['id'],'type':_0x98769c[_0x084a('0x2b')],'sectionId':_0x98769c['id']},{})[_0x084a('0x26')](function(){return _0x411fa9;});}else{return _0x411fa9;}})[_0x084a('0x55')](function(_0xa5362){logger['error'](_0x084a('0x56'),_0xa5362);throw _0xa5362;});}return _0x411fa9;})[_0x084a('0x26')](respondWithResult(_0x31677b,0xc9))[_0x084a('0x55')](handleError(_0x31677b,null));};exports['update']=function(_0x54ca1f,_0x424cd1){if(_0x54ca1f['body']['id']){delete _0x54ca1f[_0x084a('0x4e')]['id'];}return db[_0x084a('0x2f')]['find']({'where':{'id':_0x54ca1f[_0x084a('0x49')]['id']}})['then'](handleEntityNotFound(_0x424cd1,null))['then'](saveUpdates(_0x54ca1f[_0x084a('0x4e')],null))[_0x084a('0x26')](respondWithResult(_0x424cd1,null))[_0x084a('0x55')](handleError(_0x424cd1,null));};exports[_0x084a('0x25')]=function(_0x2a8056,_0x57d397){return db[_0x084a('0x2f')]['find']({'where':{'id':_0x2a8056[_0x084a('0x49')]['id']}})[_0x084a('0x26')](handleEntityNotFound(_0x57d397,null))[_0x084a('0x26')](removeEntity(_0x57d397,null))['catch'](handleError(_0x57d397,null));};exports[_0x084a('0x57')]=function(_0x339088,_0x12db87,_0x9246dd){return db['VoiceMail'][_0x084a('0x58')]({'where':{'id':_0x339088['params']['id']}})[_0x084a('0x26')](handleEntityNotFound(_0x12db87,null))[_0x084a('0x26')](function(_0x21a18a){var _0x4cc344;var _0x589e38={},_0xd37003={};_0xd37003[_0x084a('0x34')]=_['keys'](db[_0x084a('0x59')]['rawAttributes']);_0xd37003['query']=_[_0x084a('0x4a')](_0x339088[_0x084a('0x35')]);_0xd37003[_0x084a('0x36')]=_[_0x084a('0x37')](_0xd37003[_0x084a('0x34')],_0xd37003[_0x084a('0x35')]);_0x589e38[_0x084a('0x38')]=_[_0x084a('0x37')](_0xd37003[_0x084a('0x34')],qs['fields'](_0x339088[_0x084a('0x35')][_0x084a('0x39')]));_0x589e38[_0x084a('0x38')]=_0x589e38['attributes'][_0x084a('0x3a')]?_0x589e38[_0x084a('0x38')]:_0xd37003['model'];if(!_0x339088[_0x084a('0x35')]['hasOwnProperty']('nolimit')){_0x589e38[_0x084a('0x1f')]=qs['limit'](_0x339088['query'][_0x084a('0x1f')]);_0x589e38[_0x084a('0x1d')]=qs[_0x084a('0x1d')](_0x339088['query'][_0x084a('0x1d')]);}_0x589e38[_0x084a('0x3d')]=qs[_0x084a('0x3e')](_0x339088[_0x084a('0x35')][_0x084a('0x3e')]);_0x589e38[_0x084a('0x3f')]=qs[_0x084a('0x36')](_['pick'](_0x339088['query'],_0xd37003[_0x084a('0x36')]));if(_0x339088[_0x084a('0x35')]['filter']){_0x589e38[_0x084a('0x3f')]=_[_0x084a('0x42')](_0x589e38[_0x084a('0x3f')],{'$or':_[_0x084a('0x2e')](_0x589e38['attributes'],function(_0x21dd85){var _0x3fa52e={};_0x3fa52e[_0x21dd85]={'$like':'%'+_0x339088[_0x084a('0x35')]['filter']+'%'};return _0x3fa52e;})});}_0x589e38['where']=_[_0x084a('0x42')](_0x589e38[_0x084a('0x3f')],{'mailboxuser':_0x21a18a[_0x084a('0x5a')]});_0x589e38=_[_0x084a('0x42')]({},_0x589e38,_0x339088[_0x084a('0x44')]);return db[_0x084a('0x59')][_0x084a('0x5b')](_0x589e38)['then'](respondWithFilteredResult(_0x12db87,_0x589e38));})[_0x084a('0x55')](handleError(_0x12db87,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 46787d6..df9e5c9 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 _0x31c8=['../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','mailbox_context','mailbox','lodash','util','moment','bluebird','request-promise','rimraf'];(function(_0x815c23,_0x577e3a){var _0x357aa1=function(_0x289b7a){while(--_0x289b7a){_0x815c23['push'](_0x815c23['shift']());}};_0x357aa1(++_0x577e3a);}(_0x31c8,0x89));var _0x831c=function(_0x57d32a,_0x4d051e){_0x57d32a=_0x57d32a-0x0;var _0x2f11a2=_0x31c8[_0x57d32a];return _0x2f11a2;};'use strict';var _=require(_0x831c('0x0'));var util=require(_0x831c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x831c('0x2'));var BPromise=require(_0x831c('0x3'));var rp=require(_0x831c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x831c('0x5'));var config=require(_0x831c('0x6'));var attributes=require(_0x831c('0x7'));module[_0x831c('0x8')]=function(_0xb9915a,_0x534e03){return _0xb9915a[_0x831c('0x9')](_0x831c('0xa'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x831c('0xb'),'fields':[_0x831c('0xc'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9264=['voice_voicemail','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x9264,0xb7));var _0x4926=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9264[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4926('0x0'));var util=require('util');var logger=require(_0x4926('0x1'))(_0x4926('0x2'));var moment=require(_0x4926('0x3'));var BPromise=require(_0x4926('0x4'));var rp=require(_0x4926('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4926('0x6'));var config=require(_0x4926('0x7'));var attributes=require(_0x4926('0x8'));module[_0x4926('0x9')]=function(_0x201e79,_0x4a1278){return _0x201e79[_0x4926('0xa')](_0x4926('0xb'),attributes,{'tableName':_0x4926('0xc'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox','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 ed2db2f..bfa076c 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 _0xdea4=['then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdea4,0x19a));var _0x4dea=function(_0x471344,_0x4b9cdd){_0x471344=_0x471344-0x0;var _0x22a302=_0xdea4[_0x471344];return _0x22a302;};'use strict';var _=require(_0x4dea('0x0'));var util=require(_0x4dea('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4dea('0x2'));var db=require(_0x4dea('0x3'))['db'];var utils=require(_0x4dea('0x4'));var logger=require(_0x4dea('0x5'))('rpc');var config=require(_0x4dea('0x6'));var jayson=require(_0x4dea('0x7'));var client=jayson[_0x4dea('0x8')][_0x4dea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b2017,_0x331781,_0x1e30bf){return new BPromise(function(_0x3e6e70,_0x1dfa02){return client['request'](_0x2b2017,_0x1e30bf)[_0x4dea('0xa')](function(_0xfab72d){logger[_0x4dea('0xb')](_0x4dea('0xc'),_0x331781,_0x4dea('0xd'));logger['debug'](_0x4dea('0xe'),_0x331781,'request\x20sent',JSON[_0x4dea('0xf')](_0xfab72d));if(_0xfab72d['error']){if(_0xfab72d[_0x4dea('0x10')][_0x4dea('0x11')]===0x1f4){logger['error'](_0x4dea('0xc'),_0x331781,_0xfab72d['error'][_0x4dea('0x12')]);return _0x1dfa02(_0xfab72d[_0x4dea('0x10')][_0x4dea('0x12')]);}logger['error'](_0x4dea('0xc'),_0x331781,_0xfab72d[_0x4dea('0x10')][_0x4dea('0x12')]);return _0x3e6e70(_0xfab72d['error']['message']);}else{logger['info'](_0x4dea('0xc'),_0x331781,_0x4dea('0xd'));_0x3e6e70(_0xfab72d[_0x4dea('0x13')][_0x4dea('0x12')]);}})[_0x4dea('0x14')](function(_0x4595a8){logger['error'](_0x4dea('0xc'),_0x331781,_0x4595a8);_0x1dfa02(_0x4595a8);});});} \ No newline at end of file +var _0x7812=['../../config/utils','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','VoiceMail,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7812,0x1dd));var _0x2781=function(_0x452bed,_0x128e55){_0x452bed=_0x452bed-0x0;var _0x4bb2cf=_0x7812[_0x452bed];return _0x4bb2cf;};'use strict';var _=require(_0x2781('0x0'));var util=require(_0x2781('0x1'));var moment=require(_0x2781('0x2'));var BPromise=require(_0x2781('0x3'));var rs=require(_0x2781('0x4'));var fs=require('fs');var Redis=require(_0x2781('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2781('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x2781('0x7'));var jayson=require(_0x2781('0x8'));var client=jayson[_0x2781('0x9')][_0x2781('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1274fa,_0x1b34b4,_0x15f79c){return new BPromise(function(_0x395c6c,_0x22cc1c){return client[_0x2781('0xb')](_0x1274fa,_0x15f79c)[_0x2781('0xc')](function(_0x546961){logger['info']('VoiceMail,\x20%s,\x20%s',_0x1b34b4,_0x2781('0xd'));logger[_0x2781('0xe')](_0x2781('0xf'),_0x1b34b4,_0x2781('0xd'),JSON['stringify'](_0x546961));if(_0x546961[_0x2781('0x10')]){if(_0x546961[_0x2781('0x10')][_0x2781('0x11')]===0x1f4){logger[_0x2781('0x10')](_0x2781('0x12'),_0x1b34b4,_0x546961[_0x2781('0x10')][_0x2781('0x13')]);return _0x22cc1c(_0x546961[_0x2781('0x10')]['message']);}logger[_0x2781('0x10')](_0x2781('0x12'),_0x1b34b4,_0x546961[_0x2781('0x10')][_0x2781('0x13')]);return _0x395c6c(_0x546961[_0x2781('0x10')]['message']);}else{logger[_0x2781('0x14')](_0x2781('0x12'),_0x1b34b4,'request\x20sent');_0x395c6c(_0x546961[_0x2781('0x15')][_0x2781('0x13')]);}})[_0x2781('0x16')](function(_0x249fe4){logger['error'](_0x2781('0x12'),_0x1b34b4,_0x249fe4);_0x22cc1c(_0x249fe4);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 8496697..1d16061 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 _0xceba=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','update','destroy','multer','util','path','express'];(function(_0x205808,_0x2aa319){var _0x472ea4=function(_0x38de51){while(--_0x38de51){_0x205808['push'](_0x205808['shift']());}};_0x472ea4(++_0x2aa319);}(_0xceba,0x8f));var _0xaceb=function(_0x2323c3,_0x12f22e){_0x2323c3=_0x2323c3-0x0;var _0x26d04d=_0xceba[_0x2323c3];return _0x26d04d;};'use strict';var multer=require(_0xaceb('0x0'));var util=require(_0xaceb('0x1'));var path=require(_0xaceb('0x2'));var timeout=require('connect-timeout');var express=require(_0xaceb('0x3'));var router=express[_0xaceb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xaceb('0x5'));var interaction=require(_0xaceb('0x6'));var config=require(_0xaceb('0x7'));var controller=require(_0xaceb('0x8'));router[_0xaceb('0x9')]('/',auth[_0xaceb('0xa')](),controller[_0xaceb('0xb')]);router[_0xaceb('0x9')](_0xaceb('0xc'),auth[_0xaceb('0xa')](),controller[_0xaceb('0xd')]);router['get'](_0xaceb('0xe'),auth[_0xaceb('0xa')](),controller[_0xaceb('0xf')]);router[_0xaceb('0x10')]('/',auth['isAuthenticated'](),controller[_0xaceb('0x11')]);router[_0xaceb('0x12')](_0xaceb('0xc'),auth[_0xaceb('0xa')](),controller[_0xaceb('0x13')]);router['delete']('/:id',auth[_0xaceb('0xa')](),controller[_0xaceb('0x14')]);module['exports']=router; \ No newline at end of file +var _0x8188=['get','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller'];(function(_0x47d10f,_0x1f6d8d){var _0x372306=function(_0x14d359){while(--_0x14d359){_0x47d10f['push'](_0x47d10f['shift']());}};_0x372306(++_0x1f6d8d);}(_0x8188,0xa0));var _0x8818=function(_0xb46225,_0x590ab7){_0xb46225=_0xb46225-0x0;var _0x54053f=_0x8188[_0xb46225];return _0x54053f;};'use strict';var multer=require('multer');var util=require(_0x8818('0x0'));var path=require('path');var timeout=require(_0x8818('0x1'));var express=require(_0x8818('0x2'));var router=express['Router']();var fs_extra=require(_0x8818('0x3'));var auth=require(_0x8818('0x4'));var interaction=require(_0x8818('0x5'));var config=require(_0x8818('0x6'));var controller=require(_0x8818('0x7'));router[_0x8818('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x8818('0x9'),auth[_0x8818('0xa')](),controller[_0x8818('0xb')]);router['get'](_0x8818('0xc'),auth[_0x8818('0xa')](),controller[_0x8818('0xd')]);router[_0x8818('0xe')]('/',auth['isAuthenticated'](),controller[_0x8818('0xf')]);router[_0x8818('0x10')](_0x8818('0x9'),auth[_0x8818('0xa')](),controller[_0x8818('0x11')]);router[_0x8818('0x12')](_0x8818('0x9'),auth[_0x8818('0xa')](),controller[_0x8818('0x13')]);module[_0x8818('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 8e15b8b..35314db 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 _0x35a7=['getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL'];(function(_0x4ed5ca,_0x37d9a9){var _0x3f730f=function(_0x1429a7){while(--_0x1429a7){_0x4ed5ca['push'](_0x4ed5ca['shift']());}};_0x3f730f(++_0x37d9a9);}(_0x35a7,0xe4));var _0x735a=function(_0x4eb662,_0x540e40){_0x4eb662=_0x4eb662-0x0;var _0x2d7889=_0x35a7[_0x4eb662];return _0x2d7889;};'use strict';var Sequelize=require(_0x735a('0x0'));module['exports']={'name':{'type':Sequelize[_0x735a('0x1')],'get':function(_0x4f7d3e){return this[_0x735a('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x735a('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x735a('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x735a('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x735a('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x735a('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x735a('0x5')](_0x735a('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x735a('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x735a('0x4')],'defaultValue':''},'stamp':{'type':_0x735a('0x7'),'defaultValue':Sequelize[_0x735a('0x8')](_0x735a('0x9'))}}; \ No newline at end of file +var _0x843d=['exports','VIRTUAL','getDataValue','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x4f74a5,_0x1fd979){var _0x5be8b2=function(_0x3bb233){while(--_0x3bb233){_0x4f74a5['push'](_0x4f74a5['shift']());}};_0x5be8b2(++_0x1fd979);}(_0x843d,0x10e));var _0xd843=function(_0x24e49d,_0x43728a){_0x24e49d=_0x24e49d-0x0;var _0x340a27=_0x843d[_0x24e49d];return _0x340a27;};'use strict';var Sequelize=require('sequelize');module[_0xd843('0x0')]={'name':{'type':Sequelize[_0xd843('0x1')],'get':function(_0x4a49f7){return this[_0xd843('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xd843('0x3')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xd843('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xd843('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xd843('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xd843('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xd843('0x4')](_0xd843('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xd843('0x6'),'defaultValue':Sequelize[_0xd843('0x7')](_0xd843('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 4593c9f..0ccd2aa 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 _0xcce8=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','index','map','fieldName','type','model','differenceBy','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','VoiceMailMessage','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','recording','msg_id','ValidationError','audio/wav','attachment','Content-Disposition','.wav\x22','send','eml-format','zip-dir','fast-json-patch','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x5a6ee4,_0x2e1727){var _0x5906fa=function(_0x3aacb5){while(--_0x3aacb5){_0x5a6ee4['push'](_0x5a6ee4['shift']());}};_0x5906fa(++_0x2e1727);}(_0xcce8,0x1d7));var _0x8cce=function(_0x502449,_0x24d7a4){_0x502449=_0x502449-0x0;var _0x474d90=_0xcce8[_0x502449];return _0x474d90;};'use strict';var emlformat=require(_0x8cce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8cce('0x1'));var jsonpatch=require(_0x8cce('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8cce('0x3'));var Mustache=require(_0x8cce('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8cce('0x5'));var ejs=require(_0x8cce('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8cce('0x7'));var squel=require(_0x8cce('0x8'));var crypto=require(_0x8cce('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8cce('0xa'));var toCsv=require('to-csv');var querystring=require(_0x8cce('0xb'));var Papa=require(_0x8cce('0xc'));var Redis=require(_0x8cce('0xd'));var authService=require(_0x8cce('0xe'));var qs=require(_0x8cce('0xf'));var as=require(_0x8cce('0x10'));var hardwareService=require(_0x8cce('0x11'));var logger=require(_0x8cce('0x12'))(_0x8cce('0x13'));var utils=require(_0x8cce('0x14'));var config=require(_0x8cce('0x15'));var licenseUtil=require(_0x8cce('0x16'));var db=require(_0x8cce('0x17'))['db'];function respondWithStatusCode(_0xe55ba0,_0x4f980b){_0x4f980b=_0x4f980b||0xcc;return function(_0x1d02b1){if(_0x1d02b1){return _0xe55ba0[_0x8cce('0x18')](_0x4f980b);}return _0xe55ba0[_0x8cce('0x19')](_0x4f980b)[_0x8cce('0x1a')]();};}function respondWithResult(_0x540c30,_0x5e89f1){_0x5e89f1=_0x5e89f1||0xc8;return function(_0x21a24b){if(_0x21a24b){return _0x540c30[_0x8cce('0x19')](_0x5e89f1)[_0x8cce('0x1b')](_0x21a24b);}};}function respondWithFilteredResult(_0x3649cb,_0x21ed86){return function(_0x13bb00){if(_0x13bb00){var _0x3e73fe=typeof _0x21ed86[_0x8cce('0x1c')]===_0x8cce('0x1d')&&typeof _0x21ed86['limit']==='undefined';var _0x322d25=_0x13bb00[_0x8cce('0x1e')];var _0x34e5b2=_0x3e73fe?0x0:_0x21ed86[_0x8cce('0x1c')];var _0x2b0b21=_0x3e73fe?_0x13bb00[_0x8cce('0x1e')]:_0x21ed86[_0x8cce('0x1c')]+_0x21ed86[_0x8cce('0x1f')];var _0x1f608c;if(_0x2b0b21>=_0x322d25){_0x2b0b21=_0x322d25;_0x1f608c=0xc8;}else{_0x1f608c=0xce;}_0x3649cb['status'](_0x1f608c);return _0x3649cb[_0x8cce('0x20')](_0x8cce('0x21'),_0x34e5b2+'-'+_0x2b0b21+'/'+_0x322d25)[_0x8cce('0x1b')](_0x13bb00);}return null;};}function patchUpdates(_0x438c24){return function(_0x1635d5){try{jsonpatch['apply'](_0x1635d5,_0x438c24,!![]);}catch(_0x372bc6){return BPromise[_0x8cce('0x22')](_0x372bc6);}return _0x1635d5['save']();};}function saveUpdates(_0x5b8ada,_0x47417c){return function(_0x595434){if(_0x595434){return _0x595434[_0x8cce('0x23')](_0x5b8ada)[_0x8cce('0x24')](function(_0x86a291){return _0x86a291;});}return null;};}function removeEntity(_0x6c1695,_0xbde3b4){return function(_0x31b185){if(_0x31b185){return _0x31b185[_0x8cce('0x25')]()[_0x8cce('0x24')](function(){_0x6c1695[_0x8cce('0x19')](0xcc)[_0x8cce('0x1a')]();});}};}function handleEntityNotFound(_0xd61702,_0x449387){return function(_0x54988f){if(!_0x54988f){_0xd61702[_0x8cce('0x18')](0x194);}return _0x54988f;};}function handleError(_0x45c4fe,_0x5f125e){_0x5f125e=_0x5f125e||0x1f4;return function(_0x33a093){logger[_0x8cce('0x26')](_0x33a093[_0x8cce('0x27')]);if(_0x33a093[_0x8cce('0x28')]){delete _0x33a093[_0x8cce('0x28')];}_0x45c4fe[_0x8cce('0x19')](_0x5f125e)['send'](_0x33a093);};}exports[_0x8cce('0x29')]=function(_0x43bf24,_0x50c328){var _0x44a6a4={},_0x4f1b4f={},_0xd15ced={'count':0x0,'rows':[]};var _0x3ffce9=_[_0x8cce('0x2a')](db['VoiceMailMessage']['rawAttributes'],function(_0x40c3af){return{'name':_0x40c3af[_0x8cce('0x2b')],'type':_0x40c3af[_0x8cce('0x2c')]['key']};});_0x4f1b4f[_0x8cce('0x2d')]=_[_0x8cce('0x2e')](_[_0x8cce('0x2a')](_0x3ffce9,_0x8cce('0x28')),[_0x8cce('0x28')]);_0x4f1b4f['query']=_[_0x8cce('0x2f')](_0x43bf24[_0x8cce('0x30')]);_0x4f1b4f[_0x8cce('0x31')]=_[_0x8cce('0x32')](_0x4f1b4f['model'],_0x4f1b4f[_0x8cce('0x30')]);_0x44a6a4[_0x8cce('0x33')]=_[_0x8cce('0x32')](_0x4f1b4f[_0x8cce('0x2d')],qs['fields'](_0x43bf24['query'][_0x8cce('0x34')]));_0x44a6a4['attributes']=_0x44a6a4[_0x8cce('0x33')][_0x8cce('0x35')]?_0x44a6a4[_0x8cce('0x33')]:_0x4f1b4f[_0x8cce('0x2d')];if(!_0x43bf24['query'][_0x8cce('0x36')]('nolimit')){_0x44a6a4[_0x8cce('0x1f')]=qs['limit'](_0x43bf24['query'][_0x8cce('0x1f')]);_0x44a6a4[_0x8cce('0x1c')]=qs[_0x8cce('0x1c')](_0x43bf24[_0x8cce('0x30')][_0x8cce('0x1c')]);}_0x44a6a4[_0x8cce('0x37')]=qs['sort'](_0x43bf24['query'][_0x8cce('0x38')]);_0x44a6a4['where']=qs[_0x8cce('0x31')](_[_0x8cce('0x39')](_0x43bf24['query'],_0x4f1b4f['filters']),_0x3ffce9);if(_0x43bf24[_0x8cce('0x30')][_0x8cce('0x3a')]){_0x44a6a4['where']=_[_0x8cce('0x3b')](_0x44a6a4[_0x8cce('0x3c')],{'$or':_[_0x8cce('0x2a')](_0x3ffce9,function(_0x59e8b3){if(_0x59e8b3[_0x8cce('0x2c')]!=='VIRTUAL'){var _0x1bbfc3={};_0x1bbfc3[_0x59e8b3[_0x8cce('0x28')]]={'$like':'%'+_0x43bf24[_0x8cce('0x30')]['filter']+'%'};return _0x1bbfc3;}})});}_0x44a6a4=_[_0x8cce('0x3b')]({},_0x44a6a4,_0x43bf24['options']);var _0x287567={'where':_0x44a6a4['where']};return db[_0x8cce('0x3d')][_0x8cce('0x1e')](_0x287567)['then'](function(_0x360735){_0xd15ced[_0x8cce('0x1e')]=_0x360735;if(_0x43bf24['query'][_0x8cce('0x3e')]){_0x44a6a4[_0x8cce('0x3f')]=[{'all':!![]}];}return db[_0x8cce('0x3d')][_0x8cce('0x40')](_0x44a6a4);})[_0x8cce('0x24')](function(_0x46e01e){_0xd15ced[_0x8cce('0x41')]=_0x46e01e;return _0xd15ced;})[_0x8cce('0x24')](respondWithFilteredResult(_0x50c328,_0x44a6a4))[_0x8cce('0x42')](handleError(_0x50c328,null));};exports[_0x8cce('0x43')]=function(_0x252af6,_0x178dbb){var _0x1a1a26={'raw':!![],'where':{'id':_0x252af6[_0x8cce('0x44')]['id']}},_0x25bddc={};_0x25bddc[_0x8cce('0x2d')]=_[_0x8cce('0x2f')](db[_0x8cce('0x3d')]['rawAttributes']);_0x25bddc[_0x8cce('0x30')]=_[_0x8cce('0x2f')](_0x252af6[_0x8cce('0x30')]);_0x25bddc['filters']=_[_0x8cce('0x32')](_0x25bddc[_0x8cce('0x2d')],_0x25bddc['query']);_0x1a1a26[_0x8cce('0x33')]=_[_0x8cce('0x32')](_0x25bddc[_0x8cce('0x2d')],qs[_0x8cce('0x34')](_0x252af6[_0x8cce('0x30')][_0x8cce('0x34')]));_0x1a1a26[_0x8cce('0x33')]=_0x1a1a26[_0x8cce('0x33')][_0x8cce('0x35')]?_0x1a1a26[_0x8cce('0x33')]:_0x25bddc['model'];if(_0x252af6['query'][_0x8cce('0x3e')]){_0x1a1a26['include']=[{'all':!![]}];}_0x1a1a26=_[_0x8cce('0x3b')]({},_0x1a1a26,_0x252af6[_0x8cce('0x45')]);return db[_0x8cce('0x3d')]['find'](_0x1a1a26)['then'](handleEntityNotFound(_0x178dbb,null))['then'](respondWithResult(_0x178dbb,null))[_0x8cce('0x42')](handleError(_0x178dbb,null));};exports[_0x8cce('0x46')]=function(_0x42099e,_0x574402){return db[_0x8cce('0x3d')][_0x8cce('0x46')](_0x42099e['body'],{})[_0x8cce('0x24')](respondWithResult(_0x574402,0xc9))[_0x8cce('0x42')](handleError(_0x574402,null));};exports[_0x8cce('0x23')]=function(_0x4ced08,_0x324b3f){if(_0x4ced08[_0x8cce('0x47')]['id']){delete _0x4ced08[_0x8cce('0x47')]['id'];}return db['VoiceMailMessage'][_0x8cce('0x48')]({'where':{'id':_0x4ced08[_0x8cce('0x44')]['id']}})[_0x8cce('0x24')](handleEntityNotFound(_0x324b3f,null))['then'](saveUpdates(_0x4ced08[_0x8cce('0x47')],null))['then'](respondWithResult(_0x324b3f,null))['catch'](handleError(_0x324b3f,null));};exports[_0x8cce('0x25')]=function(_0x5625e6,_0x39fcd6){return db[_0x8cce('0x3d')][_0x8cce('0x48')]({'where':{'id':_0x5625e6[_0x8cce('0x44')]['id']}})[_0x8cce('0x24')](handleEntityNotFound(_0x39fcd6,null))[_0x8cce('0x24')](removeEntity(_0x39fcd6,null))[_0x8cce('0x42')](handleError(_0x39fcd6,null));};exports['download']=function(_0x4c353f,_0x31c06a,_0x5524ee){return db['VoiceMailMessage']['find']({'where':{'id':_0x4c353f[_0x8cce('0x44')]['id']},'attributes':['id',_0x8cce('0x49'),_0x8cce('0x4a')]})[_0x8cce('0x24')](handleEntityNotFound(_0x31c06a,null))[_0x8cce('0x24')](function(_0x248b4b){if(_0x248b4b){if(!_0x248b4b['recording']){throw new db['Sequelize'][(_0x8cce('0x4b'))]('VoiceMailMessage\x20not\x20found');}var _0x230f57={'Content-Type':_0x8cce('0x4c'),'Content-Disposition':_0x8cce('0x4d')};if(_0x248b4b[_0x8cce('0x4a')]){_0x230f57[_0x8cce('0x4e')]='attachment;\x20filename=\x22'+_0x248b4b[_0x8cce('0x4a')]+_0x8cce('0x4f');}_0x31c06a[_0x8cce('0x20')](_0x230f57);return _0x31c06a[_0x8cce('0x50')](new Buffer(_0x248b4b[_0x8cce('0x49')]));}})[_0x8cce('0x42')](handleError(_0x31c06a,null));}; \ No newline at end of file +var _0xb7b8=['stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','VIRTUAL','merge','VoiceMailMessage','includeAll','include','findAll','catch','show','keys','rawAttributes','find','body','params','download','recording','msg_id','Sequelize','ValidationError','attachment','Content-Disposition','attachment;\x20filename=\x22','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','status'];(function(_0x8ced45,_0x4a4d7d){var _0x3e47b4=function(_0x59cafa){while(--_0x59cafa){_0x8ced45['push'](_0x8ced45['shift']());}};_0x3e47b4(++_0x4a4d7d);}(_0xb7b8,0x168));var _0x8b7b=function(_0x5f7a7a,_0x7aa0ba){_0x5f7a7a=_0x5f7a7a-0x0;var _0x31269e=_0xb7b8[_0x5f7a7a];return _0x31269e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b7b('0x0'));var zipdir=require(_0x8b7b('0x1'));var jsonpatch=require(_0x8b7b('0x2'));var rp=require(_0x8b7b('0x3'));var moment=require(_0x8b7b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8b7b('0x5'));var util=require('util');var path=require(_0x8b7b('0x6'));var sox=require(_0x8b7b('0x7'));var csv=require(_0x8b7b('0x8'));var ejs=require(_0x8b7b('0x9'));var fs=require('fs');var fs_extra=require(_0x8b7b('0xa'));var _=require(_0x8b7b('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8b7b('0xc'));var toCsv=require(_0x8b7b('0x8'));var querystring=require(_0x8b7b('0xd'));var Papa=require('papaparse');var Redis=require(_0x8b7b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8b7b('0xf'));var as=require(_0x8b7b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8b7b('0x11'))(_0x8b7b('0x12'));var utils=require(_0x8b7b('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x8b7b('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3687c7,_0x3c8f34){_0x3c8f34=_0x3c8f34||0xcc;return function(_0x53ca17){if(_0x53ca17){return _0x3687c7[_0x8b7b('0x15')](_0x3c8f34);}return _0x3687c7['status'](_0x3c8f34)[_0x8b7b('0x16')]();};}function respondWithResult(_0x462b3e,_0x23e7ac){_0x23e7ac=_0x23e7ac||0xc8;return function(_0x32eb15){if(_0x32eb15){return _0x462b3e['status'](_0x23e7ac)['json'](_0x32eb15);}};}function respondWithFilteredResult(_0x3e6bae,_0x3afeb4){return function(_0x57c361){if(_0x57c361){var _0x54d11b=typeof _0x3afeb4['offset']===_0x8b7b('0x17')&&typeof _0x3afeb4['limit']===_0x8b7b('0x17');var _0x1da677=_0x57c361[_0x8b7b('0x18')];var _0x31c280=_0x54d11b?0x0:_0x3afeb4['offset'];var _0x54ed51=_0x54d11b?_0x57c361[_0x8b7b('0x18')]:_0x3afeb4['offset']+_0x3afeb4[_0x8b7b('0x19')];var _0x23e5c0;if(_0x54ed51>=_0x1da677){_0x54ed51=_0x1da677;_0x23e5c0=0xc8;}else{_0x23e5c0=0xce;}_0x3e6bae['status'](_0x23e5c0);return _0x3e6bae[_0x8b7b('0x1a')](_0x8b7b('0x1b'),_0x31c280+'-'+_0x54ed51+'/'+_0x1da677)[_0x8b7b('0x1c')](_0x57c361);}return null;};}function patchUpdates(_0x3d412c){return function(_0x434216){try{jsonpatch[_0x8b7b('0x1d')](_0x434216,_0x3d412c,!![]);}catch(_0x14e1bd){return BPromise[_0x8b7b('0x1e')](_0x14e1bd);}return _0x434216[_0x8b7b('0x1f')]();};}function saveUpdates(_0x542428,_0x209cd7){return function(_0x3ce7f6){if(_0x3ce7f6){return _0x3ce7f6['update'](_0x542428)[_0x8b7b('0x20')](function(_0x5d806d){return _0x5d806d;});}return null;};}function removeEntity(_0x527faa,_0x1fe071){return function(_0x13f8f0){if(_0x13f8f0){return _0x13f8f0[_0x8b7b('0x21')]()[_0x8b7b('0x20')](function(){_0x527faa[_0x8b7b('0x22')](0xcc)[_0x8b7b('0x16')]();});}};}function handleEntityNotFound(_0x45e654,_0x2b016e){return function(_0x5d602a){if(!_0x5d602a){_0x45e654[_0x8b7b('0x15')](0x194);}return _0x5d602a;};}function handleError(_0x3ae185,_0x24113d){_0x24113d=_0x24113d||0x1f4;return function(_0x1ab357){logger['error'](_0x1ab357[_0x8b7b('0x23')]);if(_0x1ab357['name']){delete _0x1ab357[_0x8b7b('0x24')];}_0x3ae185['status'](_0x24113d)[_0x8b7b('0x25')](_0x1ab357);};}exports[_0x8b7b('0x26')]=function(_0x1d2919,_0x3b08f0){var _0x12d62f={},_0x17cd26={},_0x169b32={'count':0x0,'rows':[]};var _0x454960=_[_0x8b7b('0x27')](db['VoiceMailMessage']['rawAttributes'],function(_0x27b955){return{'name':_0x27b955[_0x8b7b('0x28')],'type':_0x27b955[_0x8b7b('0x29')][_0x8b7b('0x2a')]};});_0x17cd26[_0x8b7b('0x2b')]=_['differenceBy'](_[_0x8b7b('0x27')](_0x454960,_0x8b7b('0x24')),[_0x8b7b('0x24')]);_0x17cd26[_0x8b7b('0x2c')]=_['keys'](_0x1d2919[_0x8b7b('0x2c')]);_0x17cd26[_0x8b7b('0x2d')]=_[_0x8b7b('0x2e')](_0x17cd26[_0x8b7b('0x2b')],_0x17cd26[_0x8b7b('0x2c')]);_0x12d62f['attributes']=_[_0x8b7b('0x2e')](_0x17cd26['model'],qs[_0x8b7b('0x2f')](_0x1d2919[_0x8b7b('0x2c')][_0x8b7b('0x2f')]));_0x12d62f[_0x8b7b('0x30')]=_0x12d62f[_0x8b7b('0x30')][_0x8b7b('0x31')]?_0x12d62f[_0x8b7b('0x30')]:_0x17cd26['model'];if(!_0x1d2919['query'][_0x8b7b('0x32')](_0x8b7b('0x33'))){_0x12d62f[_0x8b7b('0x19')]=qs['limit'](_0x1d2919['query'][_0x8b7b('0x19')]);_0x12d62f[_0x8b7b('0x34')]=qs[_0x8b7b('0x34')](_0x1d2919[_0x8b7b('0x2c')][_0x8b7b('0x34')]);}_0x12d62f[_0x8b7b('0x35')]=qs[_0x8b7b('0x36')](_0x1d2919['query']['sort']);_0x12d62f[_0x8b7b('0x37')]=qs[_0x8b7b('0x2d')](_[_0x8b7b('0x38')](_0x1d2919[_0x8b7b('0x2c')],_0x17cd26[_0x8b7b('0x2d')]),_0x454960);if(_0x1d2919[_0x8b7b('0x2c')][_0x8b7b('0x39')]){_0x12d62f[_0x8b7b('0x37')]=_['merge'](_0x12d62f[_0x8b7b('0x37')],{'$or':_['map'](_0x454960,function(_0x4f7a73){if(_0x4f7a73['type']!==_0x8b7b('0x3a')){var _0x1f129d={};_0x1f129d[_0x4f7a73[_0x8b7b('0x24')]]={'$like':'%'+_0x1d2919['query'][_0x8b7b('0x39')]+'%'};return _0x1f129d;}})});}_0x12d62f=_[_0x8b7b('0x3b')]({},_0x12d62f,_0x1d2919['options']);var _0x57c887={'where':_0x12d62f[_0x8b7b('0x37')]};return db[_0x8b7b('0x3c')]['count'](_0x57c887)[_0x8b7b('0x20')](function(_0x2e6391){_0x169b32[_0x8b7b('0x18')]=_0x2e6391;if(_0x1d2919[_0x8b7b('0x2c')][_0x8b7b('0x3d')]){_0x12d62f[_0x8b7b('0x3e')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x8b7b('0x3f')](_0x12d62f);})[_0x8b7b('0x20')](function(_0x3767ef){_0x169b32['rows']=_0x3767ef;return _0x169b32;})[_0x8b7b('0x20')](respondWithFilteredResult(_0x3b08f0,_0x12d62f))[_0x8b7b('0x40')](handleError(_0x3b08f0,null));};exports[_0x8b7b('0x41')]=function(_0x21bfe9,_0x375c14){var _0x47d2ea={'raw':!![],'where':{'id':_0x21bfe9['params']['id']}},_0x1821cc={};_0x1821cc[_0x8b7b('0x2b')]=_[_0x8b7b('0x42')](db[_0x8b7b('0x3c')][_0x8b7b('0x43')]);_0x1821cc['query']=_[_0x8b7b('0x42')](_0x21bfe9['query']);_0x1821cc[_0x8b7b('0x2d')]=_[_0x8b7b('0x2e')](_0x1821cc[_0x8b7b('0x2b')],_0x1821cc[_0x8b7b('0x2c')]);_0x47d2ea['attributes']=_[_0x8b7b('0x2e')](_0x1821cc['model'],qs[_0x8b7b('0x2f')](_0x21bfe9[_0x8b7b('0x2c')][_0x8b7b('0x2f')]));_0x47d2ea[_0x8b7b('0x30')]=_0x47d2ea[_0x8b7b('0x30')][_0x8b7b('0x31')]?_0x47d2ea['attributes']:_0x1821cc[_0x8b7b('0x2b')];if(_0x21bfe9[_0x8b7b('0x2c')][_0x8b7b('0x3d')]){_0x47d2ea['include']=[{'all':!![]}];}_0x47d2ea=_[_0x8b7b('0x3b')]({},_0x47d2ea,_0x21bfe9['options']);return db[_0x8b7b('0x3c')][_0x8b7b('0x44')](_0x47d2ea)['then'](handleEntityNotFound(_0x375c14,null))[_0x8b7b('0x20')](respondWithResult(_0x375c14,null))[_0x8b7b('0x40')](handleError(_0x375c14,null));};exports['create']=function(_0x42abc0,_0x2de7a8){return db['VoiceMailMessage']['create'](_0x42abc0['body'],{})['then'](respondWithResult(_0x2de7a8,0xc9))[_0x8b7b('0x40')](handleError(_0x2de7a8,null));};exports['update']=function(_0x4bf905,_0x37ebdc){if(_0x4bf905[_0x8b7b('0x45')]['id']){delete _0x4bf905[_0x8b7b('0x45')]['id'];}return db['VoiceMailMessage'][_0x8b7b('0x44')]({'where':{'id':_0x4bf905[_0x8b7b('0x46')]['id']}})[_0x8b7b('0x20')](handleEntityNotFound(_0x37ebdc,null))['then'](saveUpdates(_0x4bf905[_0x8b7b('0x45')],null))[_0x8b7b('0x20')](respondWithResult(_0x37ebdc,null))[_0x8b7b('0x40')](handleError(_0x37ebdc,null));};exports[_0x8b7b('0x21')]=function(_0x126597,_0x4995db){return db[_0x8b7b('0x3c')][_0x8b7b('0x44')]({'where':{'id':_0x126597['params']['id']}})[_0x8b7b('0x20')](handleEntityNotFound(_0x4995db,null))[_0x8b7b('0x20')](removeEntity(_0x4995db,null))[_0x8b7b('0x40')](handleError(_0x4995db,null));};exports[_0x8b7b('0x47')]=function(_0x5d310d,_0xd687,_0xde4d62){return db[_0x8b7b('0x3c')][_0x8b7b('0x44')]({'where':{'id':_0x5d310d[_0x8b7b('0x46')]['id']},'attributes':['id',_0x8b7b('0x48'),_0x8b7b('0x49')]})[_0x8b7b('0x20')](handleEntityNotFound(_0xd687,null))[_0x8b7b('0x20')](function(_0x1b07d6){if(_0x1b07d6){if(!_0x1b07d6['recording']){throw new db[(_0x8b7b('0x4a'))][(_0x8b7b('0x4b'))]('VoiceMailMessage\x20not\x20found');}var _0x35c4c5={'Content-Type':'audio/wav','Content-Disposition':_0x8b7b('0x4c')};if(_0x1b07d6[_0x8b7b('0x49')]){_0x35c4c5[_0x8b7b('0x4d')]=_0x8b7b('0x4e')+_0x1b07d6[_0x8b7b('0x49')]+'.wav\x22';}_0xd687[_0x8b7b('0x1a')](_0x35c4c5);return _0xd687['send'](new Buffer(_0x1b07d6[_0x8b7b('0x48')]));}})[_0x8b7b('0x40')](handleError(_0xd687,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 12b4910..66a583a 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 _0xab4b=['define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','moment','bluebird','request-promise','path','rimraf','./voiceMailMessage.attributes','exports'];(function(_0x2a9546,_0x1a0e9c){var _0x400007=function(_0x26d2e0){while(--_0x26d2e0){_0x2a9546['push'](_0x2a9546['shift']());}};_0x400007(++_0x1a0e9c);}(_0xab4b,0x1f2));var _0xbab4=function(_0x27e029,_0x17e305){_0x27e029=_0x27e029-0x0;var _0x29bf95=_0xab4b[_0x27e029];return _0x29bf95;};'use strict';var _=require(_0xbab4('0x0'));var util=require(_0xbab4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbab4('0x2'));var BPromise=require(_0xbab4('0x3'));var rp=require(_0xbab4('0x4'));var fs=require('fs');var path=require(_0xbab4('0x5'));var rimraf=require(_0xbab4('0x6'));var config=require('../../config/environment');var attributes=require(_0xbab4('0x7'));module[_0xbab4('0x8')]=function(_0x4ea595,_0xe8dcd6){return _0x4ea595[_0xbab4('0x9')](_0xbab4('0xa'),attributes,{'tableName':_0xbab4('0xb'),'paranoid':![],'indexes':[{'name':_0xbab4('0xc'),'fields':[_0xbab4('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0xa322=['define','VoiceMailMessage','dir','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa322,0x12c));var _0x2a32=function(_0x556512,_0x39882d){_0x556512=_0x556512-0x0;var _0x33ac71=_0xa322[_0x556512];return _0x33ac71;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2a32('0x0'))(_0x2a32('0x1'));var moment=require(_0x2a32('0x2'));var BPromise=require(_0x2a32('0x3'));var rp=require(_0x2a32('0x4'));var fs=require('fs');var path=require(_0x2a32('0x5'));var rimraf=require('rimraf');var config=require(_0x2a32('0x6'));var attributes=require('./voiceMailMessage.attributes');module[_0x2a32('0x7')]=function(_0x3d820b,_0x212e38){return _0x3d820b[_0x2a32('0x8')](_0x2a32('0x9'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':'dir','fields':[_0x2a32('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 bd516a3..a978643 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 _0xded8=['ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','bluebird'];(function(_0x309049,_0x458436){var _0x546715=function(_0x39198b){while(--_0x39198b){_0x309049['push'](_0x309049['shift']());}};_0x546715(++_0x458436);}(_0xded8,0xbb));var _0x8ded=function(_0x1f12e0,_0x42a248){_0x1f12e0=_0x1f12e0-0x0;var _0x4a1142=_0xded8[_0x1f12e0];return _0x4a1142;};'use strict';var _=require('lodash');var util=require(_0x8ded('0x0'));var moment=require('moment');var BPromise=require(_0x8ded('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8ded('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8ded('0x3'))('rpc');var config=require(_0x8ded('0x4'));var jayson=require(_0x8ded('0x5'));var client=jayson[_0x8ded('0x6')][_0x8ded('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1cd4a3,_0x2104eb,_0x404f70){return new BPromise(function(_0x1b41b7,_0x45255f){return client[_0x8ded('0x8')](_0x1cd4a3,_0x404f70)[_0x8ded('0x9')](function(_0x4a4370){logger['info'](_0x8ded('0xa'),_0x2104eb,'request\x20sent');logger[_0x8ded('0xb')](_0x8ded('0xc'),_0x2104eb,_0x8ded('0xd'),JSON[_0x8ded('0xe')](_0x4a4370));if(_0x4a4370[_0x8ded('0xf')]){if(_0x4a4370[_0x8ded('0xf')][_0x8ded('0x10')]===0x1f4){logger[_0x8ded('0xf')](_0x8ded('0xa'),_0x2104eb,_0x4a4370[_0x8ded('0xf')][_0x8ded('0x11')]);return _0x45255f(_0x4a4370['error'][_0x8ded('0x11')]);}logger['error'](_0x8ded('0xa'),_0x2104eb,_0x4a4370['error'][_0x8ded('0x11')]);return _0x1b41b7(_0x4a4370['error'][_0x8ded('0x11')]);}else{logger[_0x8ded('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x2104eb,_0x8ded('0xd'));_0x1b41b7(_0x4a4370[_0x8ded('0x13')][_0x8ded('0x11')]);}})[_0x8ded('0x14')](function(_0x2f9764){logger[_0x8ded('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x2104eb,_0x2f9764);_0x45255f(_0x2f9764);});});} \ No newline at end of file +var _0xe420=['../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x197621,_0x222841){var _0x3c2752=function(_0x1a5620){while(--_0x1a5620){_0x197621['push'](_0x197621['shift']());}};_0x3c2752(++_0x222841);}(_0xe420,0x19d));var _0x0e42=function(_0x9d74cb,_0x1680fe){_0x9d74cb=_0x9d74cb-0x0;var _0x3d0481=_0xe420[_0x9d74cb];return _0x3d0481;};'use strict';var _=require(_0x0e42('0x0'));var util=require(_0x0e42('0x1'));var moment=require(_0x0e42('0x2'));var BPromise=require(_0x0e42('0x3'));var rs=require(_0x0e42('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0e42('0x5'))['db'];var utils=require(_0x0e42('0x6'));var logger=require(_0x0e42('0x7'))('rpc');var config=require(_0x0e42('0x8'));var jayson=require(_0x0e42('0x9'));var client=jayson[_0x0e42('0xa')][_0x0e42('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34edc5,_0x15847d,_0x31020d){return new BPromise(function(_0x16e855,_0x40a3f0){return client['request'](_0x34edc5,_0x31020d)[_0x0e42('0xc')](function(_0x2fdb88){logger[_0x0e42('0xd')](_0x0e42('0xe'),_0x15847d,'request\x20sent');logger[_0x0e42('0xf')](_0x0e42('0x10'),_0x15847d,'request\x20sent',JSON[_0x0e42('0x11')](_0x2fdb88));if(_0x2fdb88['error']){if(_0x2fdb88['error']['code']===0x1f4){logger[_0x0e42('0x12')](_0x0e42('0xe'),_0x15847d,_0x2fdb88[_0x0e42('0x12')][_0x0e42('0x13')]);return _0x40a3f0(_0x2fdb88[_0x0e42('0x12')][_0x0e42('0x13')]);}logger[_0x0e42('0x12')](_0x0e42('0xe'),_0x15847d,_0x2fdb88['error']['message']);return _0x16e855(_0x2fdb88[_0x0e42('0x12')][_0x0e42('0x13')]);}else{logger[_0x0e42('0xd')](_0x0e42('0xe'),_0x15847d,'request\x20sent');_0x16e855(_0x2fdb88['result'][_0x0e42('0x13')]);}})[_0x0e42('0x14')](function(_0x53bad2){logger[_0x0e42('0x12')](_0x0e42('0xe'),_0x15847d,_0x53bad2);_0x40a3f0(_0x53bad2);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 1f12bb9..cc7505a 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 _0xf8b4=['/:id','isAuthenticated','show','getSounds','create','/:id/sounds','put','delete','destroy','removeSound','exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','index'];(function(_0x25f121,_0x792dff){var _0x17fcf6=function(_0x4ed817){while(--_0x4ed817){_0x25f121['push'](_0x25f121['shift']());}};_0x17fcf6(++_0x792dff);}(_0xf8b4,0x1c3));var _0x4f8b=function(_0x20c6f4,_0x21f383){_0x20c6f4=_0x20c6f4-0x0;var _0x374d4f=_0xf8b4[_0x20c6f4];return _0x374d4f;};'use strict';var multer=require('multer');var util=require(_0x4f8b('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4f8b('0x1'));var router=express['Router']();var fs_extra=require(_0x4f8b('0x2'));var auth=require(_0x4f8b('0x3'));var interaction=require(_0x4f8b('0x4'));var config=require(_0x4f8b('0x5'));var controller=require(_0x4f8b('0x6'));router[_0x4f8b('0x7')]('/',auth['isAuthenticated'](),controller[_0x4f8b('0x8')]);router[_0x4f8b('0x7')](_0x4f8b('0x9'),auth[_0x4f8b('0xa')](),controller[_0x4f8b('0xb')]);router[_0x4f8b('0x7')]('/:id/sounds',auth[_0x4f8b('0xa')](),controller[_0x4f8b('0xc')]);router['post']('/',auth[_0x4f8b('0xa')](),controller[_0x4f8b('0xd')]);router['post'](_0x4f8b('0xe'),auth[_0x4f8b('0xa')](),controller['addSound']);router[_0x4f8b('0xf')](_0x4f8b('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x4f8b('0x10')](_0x4f8b('0x9'),auth['isAuthenticated'](),controller[_0x4f8b('0x11')]);router[_0x4f8b('0x10')]('/:id/sounds/:id2',auth[_0x4f8b('0xa')](),controller[_0x4f8b('0x12')]);module[_0x4f8b('0x13')]=router; \ No newline at end of file +var _0xa72f=['addSound','put','/:id','update','delete','removeSound','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','index','isAuthenticated','show','getSounds','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa72f,0x1bc));var _0xfa72=function(_0x16b992,_0x43d74c){_0x16b992=_0x16b992-0x0;var _0x385c78=_0xa72f[_0x16b992];return _0x385c78;};'use strict';var multer=require(_0xfa72('0x0'));var util=require(_0xfa72('0x1'));var path=require(_0xfa72('0x2'));var timeout=require(_0xfa72('0x3'));var express=require(_0xfa72('0x4'));var router=express[_0xfa72('0x5')]();var fs_extra=require(_0xfa72('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xfa72('0x7'));var config=require(_0xfa72('0x8'));var controller=require(_0xfa72('0x9'));router[_0xfa72('0xa')]('/',auth['isAuthenticated'](),controller[_0xfa72('0xb')]);router[_0xfa72('0xa')]('/:id',auth[_0xfa72('0xc')](),controller[_0xfa72('0xd')]);router[_0xfa72('0xa')]('/:id/sounds',auth[_0xfa72('0xc')](),controller[_0xfa72('0xe')]);router[_0xfa72('0xf')]('/',auth[_0xfa72('0xc')](),controller['create']);router[_0xfa72('0xf')]('/:id/sounds',auth['isAuthenticated'](),controller[_0xfa72('0x10')]);router[_0xfa72('0x11')](_0xfa72('0x12'),auth[_0xfa72('0xc')](),controller[_0xfa72('0x13')]);router[_0xfa72('0x14')](_0xfa72('0x12'),auth[_0xfa72('0xc')](),controller['destroy']);router[_0xfa72('0x14')]('/:id/sounds/:id2',auth[_0xfa72('0xc')](),controller[_0xfa72('0x15')]);module[_0xfa72('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 1ac8d71..790523e 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 _0xb8e4=['BOOLEAN','sequelize','exports','STRING','name','ENUM','files','mp3nb','quietmp3nb','mp3','alpha','TIMESTAMP'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb8e4,0x12d));var _0x4b8e=function(_0x3aaabe,_0x535e71){_0x3aaabe=_0x3aaabe-0x0;var _0x11c947=_0xb8e4[_0x3aaabe];return _0x11c947;};'use strict';var Sequelize=require(_0x4b8e('0x0'));module[_0x4b8e('0x1')]={'name':{'type':Sequelize[_0x4b8e('0x2')],'allowNull':![],'unique':_0x4b8e('0x3')},'mode':{'type':Sequelize[_0x4b8e('0x4')]('custom',_0x4b8e('0x5'),_0x4b8e('0x6'),_0x4b8e('0x7'),'quietmp3',_0x4b8e('0x8')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x4b8e('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x4b8e('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x4b8e('0x2')],'allowNull':!![],'defaultValue':_0x4b8e('0x9')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x4b8e('0xa')},'defaultEntry':{'type':Sequelize[_0x4b8e('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3e59=['ENUM','custom','files','quietmp3nb','quietmp3','mp3','STRING','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','name'];(function(_0x5b8723,_0x171c83){var _0x44d58e=function(_0x5a9f35){while(--_0x5a9f35){_0x5b8723['push'](_0x5b8723['shift']());}};_0x44d58e(++_0x171c83);}(_0x3e59,0x135));var _0x93e5=function(_0x524efa,_0xbe406e){_0x524efa=_0x524efa-0x0;var _0x775cd5=_0x3e59[_0x524efa];return _0x775cd5;};'use strict';var Sequelize=require(_0x93e5('0x0'));module[_0x93e5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x93e5('0x2')},'mode':{'type':Sequelize[_0x93e5('0x3')](_0x93e5('0x4'),_0x93e5('0x5'),'mp3nb',_0x93e5('0x6'),_0x93e5('0x7'),_0x93e5('0x8')),'allowNull':!![],'defaultValue':_0x93e5('0x5')},'directory':{'type':Sequelize[_0x93e5('0x9')],'allowNull':!![]},'application':{'type':Sequelize[_0x93e5('0x9')],'allowNull':!![]},'digit':{'type':Sequelize[_0x93e5('0x9')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x93e5('0xa')},'format':{'type':Sequelize[_0x93e5('0x9')],'allowNull':!![]},'stamp':{'type':_0x93e5('0xb')},'defaultEntry':{'type':Sequelize[_0x93e5('0xc')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 9bff7d3..80e4fd9 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 _0x7500=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','VoiceMusicOnHold','includeAll','include','findAll','rows','catch','show','keys','find','body','params','create','sequelize','files','directory','root','server/files/moh','mode','mkdirSync','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','autoAssociation','transaction','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','createdAt','join','server/files/sounds/converted','format','%s.%s','basename','extname','converted_format','symlinkSync','id2','getSounds','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','then','destroy','MusicOnHolds','UserProfileResource','end','error','stack','name','send','rawAttributes','fieldName','key','model','map','query','filters','intersection','fields','attributes','length'];(function(_0x40316d,_0x430b14){var _0x1e6947=function(_0xd17179){while(--_0xd17179){_0x40316d['push'](_0x40316d['shift']());}};_0x1e6947(++_0x430b14);}(_0x7500,0xaa));var _0x0750=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x7500[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0x0750('0x0'));var rimraf=require(_0x0750('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0750('0x2'));var moment=require(_0x0750('0x3'));var BPromise=require(_0x0750('0x4'));var Mustache=require(_0x0750('0x5'));var util=require(_0x0750('0x6'));var path=require(_0x0750('0x7'));var sox=require('sox');var csv=require(_0x0750('0x8'));var ejs=require(_0x0750('0x9'));var fs=require('fs');var fs_extra=require(_0x0750('0xa'));var _=require('lodash');var squel=require(_0x0750('0xb'));var crypto=require(_0x0750('0xc'));var jsforce=require(_0x0750('0xd'));var deskjs=require(_0x0750('0xe'));var toCsv=require(_0x0750('0x8'));var querystring=require(_0x0750('0xf'));var Papa=require(_0x0750('0x10'));var Redis=require(_0x0750('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0750('0x12'));var as=require(_0x0750('0x13'));var hardwareService=require(_0x0750('0x14'));var logger=require(_0x0750('0x15'))(_0x0750('0x16'));var utils=require(_0x0750('0x17'));var config=require(_0x0750('0x18'));var licenseUtil=require(_0x0750('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc9735f,_0x40de79){_0x40de79=_0x40de79||0xcc;return function(_0x240f41){if(_0x240f41){return _0xc9735f[_0x0750('0x1a')](_0x40de79);}return _0xc9735f['status'](_0x40de79)['end']();};}function respondWithResult(_0xc50a47,_0x527b9b){_0x527b9b=_0x527b9b||0xc8;return function(_0x165fde){if(_0x165fde){return _0xc50a47['status'](_0x527b9b)[_0x0750('0x1b')](_0x165fde);}};}function respondWithFilteredResult(_0x4be56b,_0x493d72){return function(_0x118685){if(_0x118685){var _0x19062d=typeof _0x493d72[_0x0750('0x1c')]==='undefined'&&typeof _0x493d72['limit']===_0x0750('0x1d');var _0x176cfa=_0x118685[_0x0750('0x1e')];var _0x426711=_0x19062d?0x0:_0x493d72[_0x0750('0x1c')];var _0x5c9d37=_0x19062d?_0x118685[_0x0750('0x1e')]:_0x493d72[_0x0750('0x1c')]+_0x493d72[_0x0750('0x1f')];var _0x59e053;if(_0x5c9d37>=_0x176cfa){_0x5c9d37=_0x176cfa;_0x59e053=0xc8;}else{_0x59e053=0xce;}_0x4be56b[_0x0750('0x20')](_0x59e053);return _0x4be56b[_0x0750('0x21')](_0x0750('0x22'),_0x426711+'-'+_0x5c9d37+'/'+_0x176cfa)['json'](_0x118685);}return null;};}function patchUpdates(_0x1f3293){return function(_0x38ee1d){try{jsonpatch[_0x0750('0x23')](_0x38ee1d,_0x1f3293,!![]);}catch(_0x5778ed){return BPromise[_0x0750('0x24')](_0x5778ed);}return _0x38ee1d[_0x0750('0x25')]();};}function saveUpdates(_0x127d33,_0x432064){return function(_0x56db66){if(_0x56db66){return _0x56db66['update'](_0x127d33)[_0x0750('0x26')](function(_0x89be64){return _0x89be64;});}return null;};}function removeEntity(_0x48b221,_0x45ec76){return function(_0x56c12c){if(_0x56c12c){return _0x56c12c[_0x0750('0x27')]()[_0x0750('0x26')](function(){var _0xe0d9b4=_0x56c12c['get']({'plain':!![]});var _0x5106eb=_0x0750('0x28');return db[_0x0750('0x29')]['destroy']({'where':{'type':_0x5106eb,'resourceId':_0xe0d9b4['id']}})[_0x0750('0x26')](function(){return _0x56c12c;});})[_0x0750('0x26')](function(){_0x48b221[_0x0750('0x20')](0xcc)[_0x0750('0x2a')]();});}};}function handleEntityNotFound(_0x59b3d6,_0x27b180){return function(_0x5ce95b){if(!_0x5ce95b){_0x59b3d6['sendStatus'](0x194);}return _0x5ce95b;};}function handleError(_0xabe957,_0x51be6e){_0x51be6e=_0x51be6e||0x1f4;return function(_0x230cca){logger[_0x0750('0x2b')](_0x230cca[_0x0750('0x2c')]);if(_0x230cca[_0x0750('0x2d')]){delete _0x230cca[_0x0750('0x2d')];}_0xabe957['status'](_0x51be6e)[_0x0750('0x2e')](_0x230cca);};}exports['index']=function(_0x3b730d,_0x56d3ac){var _0x3dae08={},_0x443fec={},_0x2fbea3={'count':0x0,'rows':[]};var _0x5ac783=_['map'](db['VoiceMusicOnHold'][_0x0750('0x2f')],function(_0x16b84f){return{'name':_0x16b84f[_0x0750('0x30')],'type':_0x16b84f['type'][_0x0750('0x31')]};});_0x443fec[_0x0750('0x32')]=_[_0x0750('0x33')](_0x5ac783,_0x0750('0x2d'));_0x443fec[_0x0750('0x34')]=_['keys'](_0x3b730d[_0x0750('0x34')]);_0x443fec[_0x0750('0x35')]=_[_0x0750('0x36')](_0x443fec['model'],_0x443fec['query']);_0x3dae08['attributes']=_[_0x0750('0x36')](_0x443fec['model'],qs[_0x0750('0x37')](_0x3b730d[_0x0750('0x34')][_0x0750('0x37')]));_0x3dae08[_0x0750('0x38')]=_0x3dae08['attributes'][_0x0750('0x39')]?_0x3dae08[_0x0750('0x38')]:_0x443fec[_0x0750('0x32')];if(!_0x3b730d['query'][_0x0750('0x3a')](_0x0750('0x3b'))){_0x3dae08['limit']=qs[_0x0750('0x1f')](_0x3b730d[_0x0750('0x34')][_0x0750('0x1f')]);_0x3dae08['offset']=qs['offset'](_0x3b730d[_0x0750('0x34')]['offset']);}_0x3dae08[_0x0750('0x3c')]=qs[_0x0750('0x3d')](_0x3b730d[_0x0750('0x34')][_0x0750('0x3d')]);delete _0x3b730d[_0x0750('0x34')]['sort'];_0x3dae08[_0x0750('0x3e')]=qs['filters'](_[_0x0750('0x3f')](_0x3b730d[_0x0750('0x34')],_0x443fec[_0x0750('0x35')]),_0x5ac783);if(_0x3b730d[_0x0750('0x34')][_0x0750('0x40')]){_0x3dae08[_0x0750('0x3e')]=_[_0x0750('0x41')](_0x3dae08[_0x0750('0x3e')],{'$or':_[_0x0750('0x33')](_0x5ac783,function(_0x291f51){if(_0x291f51[_0x0750('0x42')]!==_0x0750('0x43')){var _0x3ae0e2={};_0x3ae0e2[_0x291f51[_0x0750('0x2d')]]={'$like':'%'+_0x3b730d[_0x0750('0x34')]['filter']+'%'};return _0x3ae0e2;}})});}_0x3dae08=_[_0x0750('0x41')]({},_0x3dae08,_0x3b730d['options']);var _0x46e0ac={'where':_0x3dae08['where']};return db[_0x0750('0x44')][_0x0750('0x1e')](_0x46e0ac)[_0x0750('0x26')](function(_0x29372c){_0x2fbea3[_0x0750('0x1e')]=_0x29372c;if(_0x3b730d['query'][_0x0750('0x45')]){_0x3dae08[_0x0750('0x46')]=[{'all':!![]}];}return db[_0x0750('0x44')][_0x0750('0x47')](_0x3dae08);})['then'](function(_0xccf8ea){_0x2fbea3[_0x0750('0x48')]=_0xccf8ea;return _0x2fbea3;})[_0x0750('0x26')](respondWithFilteredResult(_0x56d3ac,_0x3dae08))[_0x0750('0x49')](handleError(_0x56d3ac,null));};exports[_0x0750('0x4a')]=function(_0x297ee8,_0x48f778){var _0x246218={'raw':![],'where':{'id':_0x297ee8['params']['id']}},_0x49e77f={};_0x49e77f['model']=_[_0x0750('0x4b')](db['VoiceMusicOnHold'][_0x0750('0x2f')]);_0x49e77f[_0x0750('0x34')]=_[_0x0750('0x4b')](_0x297ee8[_0x0750('0x34')]);_0x49e77f[_0x0750('0x35')]=_['intersection'](_0x49e77f[_0x0750('0x32')],_0x49e77f[_0x0750('0x34')]);_0x246218[_0x0750('0x38')]=_[_0x0750('0x36')](_0x49e77f[_0x0750('0x32')],qs['fields'](_0x297ee8['query']['fields']));_0x246218[_0x0750('0x38')]=_0x246218['attributes'][_0x0750('0x39')]?_0x246218[_0x0750('0x38')]:_0x49e77f[_0x0750('0x32')];if(_0x297ee8[_0x0750('0x34')][_0x0750('0x45')]){_0x246218[_0x0750('0x46')]=[{'all':!![]}];}_0x246218=_[_0x0750('0x41')]({},_0x246218,_0x297ee8['options']);return db['VoiceMusicOnHold'][_0x0750('0x4c')](_0x246218)[_0x0750('0x26')](handleEntityNotFound(_0x48f778,null))[_0x0750('0x26')](respondWithResult(_0x48f778,null))['catch'](handleError(_0x48f778,null));};exports['update']=function(_0x1ea5d2,_0x4b9a36){if(_0x1ea5d2[_0x0750('0x4d')]['id']){delete _0x1ea5d2[_0x0750('0x4d')]['id'];}return db['VoiceMusicOnHold'][_0x0750('0x4c')]({'where':{'id':_0x1ea5d2[_0x0750('0x4e')]['id']}})[_0x0750('0x26')](handleEntityNotFound(_0x4b9a36,null))[_0x0750('0x26')](saveUpdates(_0x1ea5d2[_0x0750('0x4d')],null))[_0x0750('0x26')](respondWithResult(_0x4b9a36,null))[_0x0750('0x49')](handleError(_0x4b9a36,null));};exports[_0x0750('0x4f')]=function(_0x5a9599,_0xdea021,_0x48f12c){return db[_0x0750('0x50')]['transaction'](function(_0x1bf88a){if(_0x5a9599[_0x0750('0x4d')]['mode']===_0x0750('0x51')){_0x5a9599[_0x0750('0x4d')][_0x0750('0x52')]=path['join'](config[_0x0750('0x53')],_0x0750('0x54'),_0x5a9599['body'][_0x0750('0x2d')]);}return db['VoiceMusicOnHold'][_0x0750('0x4f')](_0x5a9599[_0x0750('0x4d')],{'transaction':_0x1bf88a})['then'](function(_0x406f47){if(_0x5a9599[_0x0750('0x4d')][_0x0750('0x55')]===_0x0750('0x51')){fs[_0x0750('0x56')](_0x406f47[_0x0750('0x52')],parseInt('0777',0x8));}var _0x3bc32a=_0x5a9599['user']['get']({'plain':!![]});if(!_0x3bc32a)throw new Error(_0x0750('0x57'));if(_0x3bc32a['role']===_0x0750('0x58')){var _0x33949c=_0x406f47[_0x0750('0x59')]({'plain':!![]});return db['UserProfileSection'][_0x0750('0x4c')]({'where':{'name':_0x0750('0x28'),'userProfileId':_0x3bc32a['userProfileId']},'raw':!![]})[_0x0750('0x26')](function(_0x28d406){if(_0x28d406&&_0x28d406[_0x0750('0x5a')]===0x0){return db[_0x0750('0x29')][_0x0750('0x4f')]({'name':_0x33949c[_0x0750('0x2d')],'resourceId':_0x33949c['id'],'type':_0x28d406[_0x0750('0x2d')],'sectionId':_0x28d406['id']},{})[_0x0750('0x26')](function(){return _0x406f47;});}else{return _0x406f47;}})[_0x0750('0x49')](function(_0x551571){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x551571);});}return _0x406f47;});})['then'](respondWithResult(_0xdea021,0xc9))[_0x0750('0x49')](handleError(_0xdea021,null));};exports[_0x0750('0x27')]=function(_0x42a59f,_0x43dd81,_0x3265d6){var _0x42faa0;return db[_0x0750('0x44')]['find']({'where':{'id':_0x42a59f['params']['id']}})[_0x0750('0x26')](function(_0x57c889){if(_0x57c889){return db[_0x0750('0x50')][_0x0750('0x5b')](function(_0x3cd82b){return _0x57c889[_0x0750('0x27')]({'transaction':_0x3cd82b,'raw':!![]})['then'](function(_0x540f57){if(_0x540f57[_0x0750('0x52')]){fs[_0x0750('0x5c')](_0x540f57[_0x0750('0x52')])[_0x0750('0x5d')](function(_0x5b6bb4){fs[_0x0750('0x5e')](path['join'](_0x540f57[_0x0750('0x52')],_0x5b6bb4));});fs[_0x0750('0x5f')](_0x540f57[_0x0750('0x52')]);}return _0x540f57;});})[_0x0750('0x49')](function(_0x432d9a){throw new db[(_0x0750('0x60'))][(_0x0750('0x61'))](_0x432d9a[_0x0750('0x62')]);});}})[_0x0750('0x26')](handleEntityNotFound(_0x43dd81,null))[_0x0750('0x26')](removeEntity(_0x43dd81,null))[_0x0750('0x49')](handleError(_0x43dd81,null));};exports[_0x0750('0x63')]=function(_0x17311c,_0x1acb97,_0xb16916){return db[_0x0750('0x50')][_0x0750('0x5b')](function(_0x4beadb){var _0x3a9eee;return db['VoiceMusicOnHold'][_0x0750('0x4c')]({'where':{'id':_0x17311c[_0x0750('0x4e')]['id']}})[_0x0750('0x26')](function(_0x369e3e){if(_0x369e3e){_0x3a9eee=_0x369e3e;return _0x369e3e[_0x0750('0x63')](_0x17311c['body']['id'],{'transaction':_0x4beadb});}})[_0x0750('0x26')](function(_0x4adc0f){if(_0x4adc0f){return db[_0x0750('0x64')][_0x0750('0x65')]({'where':{'id':_0x17311c[_0x0750('0x4d')]['id']},'attributes':['id','name',_0x0750('0x66'),'converted_format',_0x0750('0x67')],'raw':!![]});}})[_0x0750('0x26')](function(_0x32a1be){if(_0x32a1be){var _0x30a2e3=path[_0x0750('0x68')](config['root'],_0x0750('0x69'),util[_0x0750('0x6a')](_0x0750('0x6b'),path[_0x0750('0x6c')](_0x32a1be[_0x0750('0x66')],path[_0x0750('0x6d')](_0x32a1be['save_name'])),_0x32a1be[_0x0750('0x6e')]));var _0x5d6fb0=path[_0x0750('0x68')](config[_0x0750('0x53')],_0x0750('0x54'),_0x3a9eee[_0x0750('0x2d')],util[_0x0750('0x6a')](_0x0750('0x6b'),_0x32a1be[_0x0750('0x2d')],_0x32a1be['converted_format']));fs[_0x0750('0x6f')](_0x30a2e3,_0x5d6fb0);return _0x32a1be;}})[_0x0750('0x49')](function(_0x3acbbb){throw new db[(_0x0750('0x60'))][(_0x0750('0x61'))](_0x3acbbb[_0x0750('0x62')]);});})['then'](handleEntityNotFound(_0x1acb97,null))['then'](respondWithResult(_0x1acb97,0xc9))[_0x0750('0x49')](handleError(_0x1acb97,null));};exports['removeSound']=function(_0x2d36a0,_0x457224,_0x5e2e87){return db[_0x0750('0x50')][_0x0750('0x5b')](function(_0x2a4b34){var _0x42f48a;return db[_0x0750('0x44')]['findOne']({'where':{'id':_0x2d36a0[_0x0750('0x4e')]['id']}})[_0x0750('0x26')](handleEntityNotFound(_0x457224,null))['then'](function(_0x280063){if(_0x280063){_0x42f48a=_0x280063;return _0x280063['removeSound'](_0x2d36a0[_0x0750('0x4e')][_0x0750('0x70')]);}})['then'](function(_0x2b224c){if(_0x2b224c){return db[_0x0750('0x64')][_0x0750('0x65')]({'where':{'id':_0x2d36a0['params'][_0x0750('0x70')]},'attributes':['id',_0x0750('0x2d'),'save_name',_0x0750('0x6e'),_0x0750('0x67')],'raw':!![]});}})[_0x0750('0x26')](function(_0x319afd){if(_0x319afd){fs[_0x0750('0x5e')](path['join'](_0x42f48a[_0x0750('0x52')],util['format'](_0x0750('0x6b'),_0x319afd[_0x0750('0x2d')],_0x319afd['converted_format'])));return _0x319afd;}})[_0x0750('0x49')](function(_0x1b7467){throw new db['Sequelize']['ValidationError'](_0x1b7467[_0x0750('0x62')]);});})[_0x0750('0x26')](handleEntityNotFound(_0x457224,null))[_0x0750('0x26')](respondWithStatusCode(_0x457224,0xcc))[_0x0750('0x49')](handleError(_0x457224,null));};exports[_0x0750('0x71')]=function(_0x538239,_0x572bf9,_0x3e8b52){var _0x5d753c={};var _0x45a638={};var _0x435326;var _0x5226a1;return db['VoiceMusicOnHold'][_0x0750('0x65')]({'where':{'id':_0x538239[_0x0750('0x4e')]['id']}})[_0x0750('0x26')](handleEntityNotFound(_0x572bf9,null))[_0x0750('0x26')](function(_0x695ea){if(_0x695ea){_0x435326=_0x695ea;_0x45a638[_0x0750('0x32')]=_[_0x0750('0x4b')](db[_0x0750('0x64')]['rawAttributes']);_0x45a638[_0x0750('0x34')]=_[_0x0750('0x4b')](_0x538239[_0x0750('0x34')]);_0x45a638[_0x0750('0x35')]=_[_0x0750('0x36')](_0x45a638[_0x0750('0x32')],_0x45a638[_0x0750('0x34')]);_0x5d753c['attributes']=_[_0x0750('0x36')](_0x45a638[_0x0750('0x32')],qs[_0x0750('0x37')](_0x538239[_0x0750('0x34')][_0x0750('0x37')]));_0x5d753c['attributes']=_0x5d753c[_0x0750('0x38')][_0x0750('0x39')]?_0x5d753c[_0x0750('0x38')]:_0x45a638['model'];_0x5d753c[_0x0750('0x3c')]=qs[_0x0750('0x3d')](_0x538239['query']['sort']);_0x5d753c[_0x0750('0x3e')]=qs['filters'](_['pick'](_0x538239[_0x0750('0x34')],_0x45a638['filters']));if(_0x538239[_0x0750('0x34')][_0x0750('0x40')]){_0x5d753c[_0x0750('0x3e')]=_[_0x0750('0x41')](_0x5d753c['where'],{'$or':_[_0x0750('0x33')](_0x5d753c['attributes'],function(_0x1deb6b){var _0x2c22ed={};_0x2c22ed[_0x1deb6b]={'$like':'%'+_0x538239[_0x0750('0x34')][_0x0750('0x40')]+'%'};return _0x2c22ed;})});}_0x5d753c=_[_0x0750('0x41')]({},_0x5d753c,_0x538239['options']);return _0x435326[_0x0750('0x71')](_0x5d753c);}})['then'](function(_0x25555a){if(_0x25555a){_0x5226a1=_0x25555a[_0x0750('0x39')];if(!_0x538239[_0x0750('0x34')]['hasOwnProperty'](_0x0750('0x3b'))){_0x5d753c[_0x0750('0x1f')]=qs[_0x0750('0x1f')](_0x538239['query'][_0x0750('0x1f')]);_0x5d753c[_0x0750('0x1c')]=qs[_0x0750('0x1c')](_0x538239[_0x0750('0x34')]['offset']);}return _0x435326[_0x0750('0x71')](_0x5d753c);}})[_0x0750('0x26')](function(_0xf89c87){if(_0xf89c87){return _0xf89c87?{'count':_0x5226a1,'rows':_0xf89c87}:null;}})[_0x0750('0x26')](respondWithResult(_0x572bf9,null))[_0x0750('0x49')](handleError(_0x572bf9,null));}; \ No newline at end of file +var _0x919c=['VIRTUAL','includeAll','findAll','rows','show','params','include','options','catch','body','find','create','sequelize','transaction','mode','files','directory','join','root','mkdirSync','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','MusicOnHolds','userProfileId','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','format','basename','%s.%s','removeSound','id2','getSounds','map','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','save','update','destroy','then','get','end','sendStatus','error','stack','name','index','VoiceMusicOnHold','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x5c4444,_0x119726){var _0x20d93d=function(_0x326a33){while(--_0x326a33){_0x5c4444['push'](_0x5c4444['shift']());}};_0x20d93d(++_0x119726);}(_0x919c,0x1ef));var _0xc919=function(_0x59a655,_0x150432){_0x59a655=_0x59a655-0x0;var _0x3bb656=_0x919c[_0x59a655];return _0x3bb656;};'use strict';var emlformat=require(_0xc919('0x0'));var rimraf=require(_0xc919('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc919('0x2'));var rp=require(_0xc919('0x3'));var moment=require(_0xc919('0x4'));var BPromise=require(_0xc919('0x5'));var Mustache=require(_0xc919('0x6'));var util=require('util');var path=require(_0xc919('0x7'));var sox=require(_0xc919('0x8'));var csv=require(_0xc919('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc919('0xa'));var _=require(_0xc919('0xb'));var squel=require('squel');var crypto=require(_0xc919('0xc'));var jsforce=require(_0xc919('0xd'));var deskjs=require(_0xc919('0xe'));var toCsv=require(_0xc919('0x9'));var querystring=require(_0xc919('0xf'));var Papa=require(_0xc919('0x10'));var Redis=require('ioredis');var authService=require(_0xc919('0x11'));var qs=require(_0xc919('0x12'));var as=require(_0xc919('0x13'));var hardwareService=require(_0xc919('0x14'));var logger=require('../../config/logger')(_0xc919('0x15'));var utils=require(_0xc919('0x16'));var config=require(_0xc919('0x17'));var licenseUtil=require(_0xc919('0x18'));var db=require(_0xc919('0x19'))['db'];function respondWithStatusCode(_0x173dd7,_0x1098f6){_0x1098f6=_0x1098f6||0xcc;return function(_0x376a83){if(_0x376a83){return _0x173dd7['sendStatus'](_0x1098f6);}return _0x173dd7[_0xc919('0x1a')](_0x1098f6)['end']();};}function respondWithResult(_0x3edd5c,_0x495606){_0x495606=_0x495606||0xc8;return function(_0x4350e5){if(_0x4350e5){return _0x3edd5c[_0xc919('0x1a')](_0x495606)[_0xc919('0x1b')](_0x4350e5);}};}function respondWithFilteredResult(_0x50076f,_0x8c7efe){return function(_0x796c92){if(_0x796c92){var _0x32b44f=typeof _0x8c7efe[_0xc919('0x1c')]===_0xc919('0x1d')&&typeof _0x8c7efe[_0xc919('0x1e')]===_0xc919('0x1d');var _0x1c33e4=_0x796c92[_0xc919('0x1f')];var _0x49ec9d=_0x32b44f?0x0:_0x8c7efe[_0xc919('0x1c')];var _0x34a65e=_0x32b44f?_0x796c92[_0xc919('0x1f')]:_0x8c7efe[_0xc919('0x1c')]+_0x8c7efe[_0xc919('0x1e')];var _0x59cd05;if(_0x34a65e>=_0x1c33e4){_0x34a65e=_0x1c33e4;_0x59cd05=0xc8;}else{_0x59cd05=0xce;}_0x50076f[_0xc919('0x1a')](_0x59cd05);return _0x50076f[_0xc919('0x20')]('Content-Range',_0x49ec9d+'-'+_0x34a65e+'/'+_0x1c33e4)[_0xc919('0x1b')](_0x796c92);}return null;};}function patchUpdates(_0x3c45ba){return function(_0x2f5d2d){try{jsonpatch['apply'](_0x2f5d2d,_0x3c45ba,!![]);}catch(_0x164c87){return BPromise['reject'](_0x164c87);}return _0x2f5d2d[_0xc919('0x21')]();};}function saveUpdates(_0x11f5f2,_0x262295){return function(_0x5b62f2){if(_0x5b62f2){return _0x5b62f2[_0xc919('0x22')](_0x11f5f2)['then'](function(_0x124ab8){return _0x124ab8;});}return null;};}function removeEntity(_0x1a9115,_0x3f20eb){return function(_0x266a1a){if(_0x266a1a){return _0x266a1a[_0xc919('0x23')]()[_0xc919('0x24')](function(){var _0x4656de=_0x266a1a[_0xc919('0x25')]({'plain':!![]});var _0x2dee2e='MusicOnHolds';return db['UserProfileResource'][_0xc919('0x23')]({'where':{'type':_0x2dee2e,'resourceId':_0x4656de['id']}})[_0xc919('0x24')](function(){return _0x266a1a;});})[_0xc919('0x24')](function(){_0x1a9115['status'](0xcc)[_0xc919('0x26')]();});}};}function handleEntityNotFound(_0x5a6ae7,_0x4bb914){return function(_0xf3724d){if(!_0xf3724d){_0x5a6ae7[_0xc919('0x27')](0x194);}return _0xf3724d;};}function handleError(_0x1163aa,_0x20f0c0){_0x20f0c0=_0x20f0c0||0x1f4;return function(_0x242371){logger[_0xc919('0x28')](_0x242371[_0xc919('0x29')]);if(_0x242371[_0xc919('0x2a')]){delete _0x242371[_0xc919('0x2a')];}_0x1163aa[_0xc919('0x1a')](_0x20f0c0)['send'](_0x242371);};}exports[_0xc919('0x2b')]=function(_0x48426d,_0x3798f4){var _0x53485b={},_0x1f7e58={},_0x16e4bc={'count':0x0,'rows':[]};var _0x57f5d3=_['map'](db[_0xc919('0x2c')][_0xc919('0x2d')],function(_0x38cb09){return{'name':_0x38cb09[_0xc919('0x2e')],'type':_0x38cb09[_0xc919('0x2f')][_0xc919('0x30')]};});_0x1f7e58['model']=_['map'](_0x57f5d3,_0xc919('0x2a'));_0x1f7e58[_0xc919('0x31')]=_[_0xc919('0x32')](_0x48426d[_0xc919('0x31')]);_0x1f7e58[_0xc919('0x33')]=_[_0xc919('0x34')](_0x1f7e58[_0xc919('0x35')],_0x1f7e58[_0xc919('0x31')]);_0x53485b[_0xc919('0x36')]=_['intersection'](_0x1f7e58[_0xc919('0x35')],qs[_0xc919('0x37')](_0x48426d[_0xc919('0x31')][_0xc919('0x37')]));_0x53485b['attributes']=_0x53485b[_0xc919('0x36')][_0xc919('0x38')]?_0x53485b['attributes']:_0x1f7e58[_0xc919('0x35')];if(!_0x48426d[_0xc919('0x31')][_0xc919('0x39')](_0xc919('0x3a'))){_0x53485b[_0xc919('0x1e')]=qs[_0xc919('0x1e')](_0x48426d[_0xc919('0x31')][_0xc919('0x1e')]);_0x53485b[_0xc919('0x1c')]=qs[_0xc919('0x1c')](_0x48426d[_0xc919('0x31')]['offset']);}_0x53485b[_0xc919('0x3b')]=qs[_0xc919('0x3c')](_0x48426d[_0xc919('0x31')][_0xc919('0x3c')]);delete _0x48426d[_0xc919('0x31')][_0xc919('0x3c')];_0x53485b[_0xc919('0x3d')]=qs[_0xc919('0x33')](_[_0xc919('0x3e')](_0x48426d['query'],_0x1f7e58['filters']),_0x57f5d3);if(_0x48426d[_0xc919('0x31')][_0xc919('0x3f')]){_0x53485b[_0xc919('0x3d')]=_[_0xc919('0x40')](_0x53485b[_0xc919('0x3d')],{'$or':_['map'](_0x57f5d3,function(_0x3ce79a){if(_0x3ce79a[_0xc919('0x2f')]!==_0xc919('0x41')){var _0x487079={};_0x487079[_0x3ce79a[_0xc919('0x2a')]]={'$like':'%'+_0x48426d['query'][_0xc919('0x3f')]+'%'};return _0x487079;}})});}_0x53485b=_['merge']({},_0x53485b,_0x48426d['options']);var _0x2faf9c={'where':_0x53485b['where']};return db[_0xc919('0x2c')][_0xc919('0x1f')](_0x2faf9c)[_0xc919('0x24')](function(_0xb49e2e){_0x16e4bc[_0xc919('0x1f')]=_0xb49e2e;if(_0x48426d[_0xc919('0x31')][_0xc919('0x42')]){_0x53485b['include']=[{'all':!![]}];}return db[_0xc919('0x2c')][_0xc919('0x43')](_0x53485b);})['then'](function(_0x5eccca){_0x16e4bc[_0xc919('0x44')]=_0x5eccca;return _0x16e4bc;})['then'](respondWithFilteredResult(_0x3798f4,_0x53485b))['catch'](handleError(_0x3798f4,null));};exports[_0xc919('0x45')]=function(_0x4c79de,_0x9ac88b){var _0x20b8ba={'raw':![],'where':{'id':_0x4c79de[_0xc919('0x46')]['id']}},_0x25ced2={};_0x25ced2['model']=_[_0xc919('0x32')](db[_0xc919('0x2c')][_0xc919('0x2d')]);_0x25ced2[_0xc919('0x31')]=_[_0xc919('0x32')](_0x4c79de[_0xc919('0x31')]);_0x25ced2['filters']=_['intersection'](_0x25ced2[_0xc919('0x35')],_0x25ced2[_0xc919('0x31')]);_0x20b8ba[_0xc919('0x36')]=_[_0xc919('0x34')](_0x25ced2[_0xc919('0x35')],qs[_0xc919('0x37')](_0x4c79de[_0xc919('0x31')][_0xc919('0x37')]));_0x20b8ba[_0xc919('0x36')]=_0x20b8ba['attributes'][_0xc919('0x38')]?_0x20b8ba[_0xc919('0x36')]:_0x25ced2['model'];if(_0x4c79de[_0xc919('0x31')][_0xc919('0x42')]){_0x20b8ba[_0xc919('0x47')]=[{'all':!![]}];}_0x20b8ba=_['merge']({},_0x20b8ba,_0x4c79de[_0xc919('0x48')]);return db[_0xc919('0x2c')]['find'](_0x20b8ba)[_0xc919('0x24')](handleEntityNotFound(_0x9ac88b,null))[_0xc919('0x24')](respondWithResult(_0x9ac88b,null))[_0xc919('0x49')](handleError(_0x9ac88b,null));};exports[_0xc919('0x22')]=function(_0x5df855,_0x3bbd9f){if(_0x5df855['body']['id']){delete _0x5df855[_0xc919('0x4a')]['id'];}return db[_0xc919('0x2c')][_0xc919('0x4b')]({'where':{'id':_0x5df855['params']['id']}})['then'](handleEntityNotFound(_0x3bbd9f,null))[_0xc919('0x24')](saveUpdates(_0x5df855['body'],null))[_0xc919('0x24')](respondWithResult(_0x3bbd9f,null))['catch'](handleError(_0x3bbd9f,null));};exports[_0xc919('0x4c')]=function(_0x64bb6c,_0x71077d,_0xd1e3cb){return db[_0xc919('0x4d')][_0xc919('0x4e')](function(_0x55764a){if(_0x64bb6c[_0xc919('0x4a')][_0xc919('0x4f')]===_0xc919('0x50')){_0x64bb6c[_0xc919('0x4a')][_0xc919('0x51')]=path[_0xc919('0x52')](config[_0xc919('0x53')],'server/files/moh',_0x64bb6c['body'][_0xc919('0x2a')]);}return db['VoiceMusicOnHold'][_0xc919('0x4c')](_0x64bb6c[_0xc919('0x4a')],{'transaction':_0x55764a})[_0xc919('0x24')](function(_0x16f8e2){if(_0x64bb6c[_0xc919('0x4a')][_0xc919('0x4f')]===_0xc919('0x50')){fs[_0xc919('0x54')](_0x16f8e2[_0xc919('0x51')],parseInt(_0xc919('0x55'),0x8));}var _0x112b98=_0x64bb6c['user'][_0xc919('0x25')]({'plain':!![]});if(!_0x112b98)throw new Error(_0xc919('0x56'));if(_0x112b98[_0xc919('0x57')]===_0xc919('0x58')){var _0x2314db=_0x16f8e2['get']({'plain':!![]});return db[_0xc919('0x59')][_0xc919('0x4b')]({'where':{'name':_0xc919('0x5a'),'userProfileId':_0x112b98[_0xc919('0x5b')]},'raw':!![]})[_0xc919('0x24')](function(_0x58d244){if(_0x58d244&&_0x58d244['autoAssociation']===0x0){return db['UserProfileResource'][_0xc919('0x4c')]({'name':_0x2314db[_0xc919('0x2a')],'resourceId':_0x2314db['id'],'type':_0x58d244[_0xc919('0x2a')],'sectionId':_0x58d244['id']},{})[_0xc919('0x24')](function(){return _0x16f8e2;});}else{return _0x16f8e2;}})[_0xc919('0x49')](function(_0x3ad4bc){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ad4bc);});}return _0x16f8e2;});})[_0xc919('0x24')](respondWithResult(_0x71077d,0xc9))['catch'](handleError(_0x71077d,null));};exports[_0xc919('0x23')]=function(_0x3ac721,_0x285436,_0xccb45f){var _0x103332;return db[_0xc919('0x2c')][_0xc919('0x4b')]({'where':{'id':_0x3ac721['params']['id']}})[_0xc919('0x24')](function(_0x515e83){if(_0x515e83){return db[_0xc919('0x4d')][_0xc919('0x4e')](function(_0x415c0a){return _0x515e83[_0xc919('0x23')]({'transaction':_0x415c0a,'raw':!![]})[_0xc919('0x24')](function(_0x44ba1d){if(_0x44ba1d[_0xc919('0x51')]){fs[_0xc919('0x5c')](_0x44ba1d[_0xc919('0x51')])[_0xc919('0x5d')](function(_0x499030){fs[_0xc919('0x5e')](path[_0xc919('0x52')](_0x44ba1d[_0xc919('0x51')],_0x499030));});fs[_0xc919('0x5f')](_0x44ba1d[_0xc919('0x51')]);}return _0x44ba1d;});})[_0xc919('0x49')](function(_0x52c66c){throw new db[(_0xc919('0x60'))][(_0xc919('0x61'))](_0x52c66c[_0xc919('0x62')]);});}})[_0xc919('0x24')](handleEntityNotFound(_0x285436,null))[_0xc919('0x24')](removeEntity(_0x285436,null))['catch'](handleError(_0x285436,null));};exports[_0xc919('0x63')]=function(_0x2f60d2,_0x25da1b,_0x4baedf){return db[_0xc919('0x4d')][_0xc919('0x4e')](function(_0x556f5d){var _0x554205;return db[_0xc919('0x2c')][_0xc919('0x4b')]({'where':{'id':_0x2f60d2[_0xc919('0x46')]['id']}})[_0xc919('0x24')](function(_0x48a9c9){if(_0x48a9c9){_0x554205=_0x48a9c9;return _0x48a9c9[_0xc919('0x63')](_0x2f60d2[_0xc919('0x4a')]['id'],{'transaction':_0x556f5d});}})[_0xc919('0x24')](function(_0x295a08){if(_0x295a08){return db[_0xc919('0x64')][_0xc919('0x65')]({'where':{'id':_0x2f60d2[_0xc919('0x4a')]['id']},'attributes':['id',_0xc919('0x2a'),_0xc919('0x66'),_0xc919('0x67'),_0xc919('0x68')],'raw':!![]});}})[_0xc919('0x24')](function(_0x272706){if(_0x272706){var _0x5dc153=path[_0xc919('0x52')](config[_0xc919('0x53')],'server/files/sounds/converted',util[_0xc919('0x69')]('%s.%s',path[_0xc919('0x6a')](_0x272706[_0xc919('0x66')],path['extname'](_0x272706['save_name'])),_0x272706[_0xc919('0x67')]));var _0x403759=path[_0xc919('0x52')](config[_0xc919('0x53')],'server/files/moh',_0x554205[_0xc919('0x2a')],util['format'](_0xc919('0x6b'),_0x272706['name'],_0x272706[_0xc919('0x67')]));fs['symlinkSync'](_0x5dc153,_0x403759);return _0x272706;}})[_0xc919('0x49')](function(_0x368948){throw new db[(_0xc919('0x60'))][(_0xc919('0x61'))](_0x368948[_0xc919('0x62')]);});})[_0xc919('0x24')](handleEntityNotFound(_0x25da1b,null))[_0xc919('0x24')](respondWithResult(_0x25da1b,0xc9))[_0xc919('0x49')](handleError(_0x25da1b,null));};exports[_0xc919('0x6c')]=function(_0x590460,_0xdc7b3b,_0x13a1bd){return db[_0xc919('0x4d')]['transaction'](function(_0x286e39){var _0x13b4c2;return db[_0xc919('0x2c')]['findOne']({'where':{'id':_0x590460['params']['id']}})[_0xc919('0x24')](handleEntityNotFound(_0xdc7b3b,null))[_0xc919('0x24')](function(_0x4ce2b7){if(_0x4ce2b7){_0x13b4c2=_0x4ce2b7;return _0x4ce2b7['removeSound'](_0x590460['params'][_0xc919('0x6d')]);}})[_0xc919('0x24')](function(_0x2c63fc){if(_0x2c63fc){return db[_0xc919('0x64')][_0xc919('0x65')]({'where':{'id':_0x590460[_0xc919('0x46')][_0xc919('0x6d')]},'attributes':['id',_0xc919('0x2a'),_0xc919('0x66'),'converted_format',_0xc919('0x68')],'raw':!![]});}})[_0xc919('0x24')](function(_0x557d89){if(_0x557d89){fs[_0xc919('0x5e')](path[_0xc919('0x52')](_0x13b4c2[_0xc919('0x51')],util[_0xc919('0x69')]('%s.%s',_0x557d89[_0xc919('0x2a')],_0x557d89[_0xc919('0x67')])));return _0x557d89;}})[_0xc919('0x49')](function(_0x2a5029){throw new db[(_0xc919('0x60'))][(_0xc919('0x61'))](_0x2a5029[_0xc919('0x62')]);});})[_0xc919('0x24')](handleEntityNotFound(_0xdc7b3b,null))[_0xc919('0x24')](respondWithStatusCode(_0xdc7b3b,0xcc))['catch'](handleError(_0xdc7b3b,null));};exports[_0xc919('0x6e')]=function(_0x1bb642,_0x7954ba,_0x1e25ad){var _0x373716={};var _0x3078a3={};var _0x585bbc;var _0x1e8959;return db[_0xc919('0x2c')]['findOne']({'where':{'id':_0x1bb642['params']['id']}})[_0xc919('0x24')](handleEntityNotFound(_0x7954ba,null))[_0xc919('0x24')](function(_0x34b8c6){if(_0x34b8c6){_0x585bbc=_0x34b8c6;_0x3078a3[_0xc919('0x35')]=_['keys'](db[_0xc919('0x64')][_0xc919('0x2d')]);_0x3078a3[_0xc919('0x31')]=_[_0xc919('0x32')](_0x1bb642['query']);_0x3078a3['filters']=_[_0xc919('0x34')](_0x3078a3[_0xc919('0x35')],_0x3078a3[_0xc919('0x31')]);_0x373716[_0xc919('0x36')]=_['intersection'](_0x3078a3['model'],qs[_0xc919('0x37')](_0x1bb642['query']['fields']));_0x373716[_0xc919('0x36')]=_0x373716[_0xc919('0x36')][_0xc919('0x38')]?_0x373716['attributes']:_0x3078a3[_0xc919('0x35')];_0x373716[_0xc919('0x3b')]=qs[_0xc919('0x3c')](_0x1bb642[_0xc919('0x31')][_0xc919('0x3c')]);_0x373716[_0xc919('0x3d')]=qs[_0xc919('0x33')](_['pick'](_0x1bb642[_0xc919('0x31')],_0x3078a3[_0xc919('0x33')]));if(_0x1bb642[_0xc919('0x31')][_0xc919('0x3f')]){_0x373716[_0xc919('0x3d')]=_[_0xc919('0x40')](_0x373716['where'],{'$or':_[_0xc919('0x6f')](_0x373716[_0xc919('0x36')],function(_0x311c73){var _0x2350d3={};_0x2350d3[_0x311c73]={'$like':'%'+_0x1bb642[_0xc919('0x31')]['filter']+'%'};return _0x2350d3;})});}_0x373716=_['merge']({},_0x373716,_0x1bb642[_0xc919('0x48')]);return _0x585bbc[_0xc919('0x6e')](_0x373716);}})[_0xc919('0x24')](function(_0x2cee34){if(_0x2cee34){_0x1e8959=_0x2cee34[_0xc919('0x38')];if(!_0x1bb642[_0xc919('0x31')][_0xc919('0x39')](_0xc919('0x3a'))){_0x373716['limit']=qs['limit'](_0x1bb642[_0xc919('0x31')][_0xc919('0x1e')]);_0x373716[_0xc919('0x1c')]=qs[_0xc919('0x1c')](_0x1bb642[_0xc919('0x31')][_0xc919('0x1c')]);}return _0x585bbc[_0xc919('0x6e')](_0x373716);}})[_0xc919('0x24')](function(_0x59e01e){if(_0x59e01e){return _0x59e01e?{'count':_0x1e8959,'rows':_0x59e01e}:null;}})[_0xc919('0x24')](respondWithResult(_0x7954ba,null))[_0xc919('0x49')](handleError(_0x7954ba,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index fa3101e..c2ff692 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 _0x4e88=['path','../../config/environment','define','VoiceMusicOnHold','voice_musiconhold','util','../../config/logger','moment','bluebird'];(function(_0x4ac79a,_0x46c40b){var _0x29aa11=function(_0x15aadb){while(--_0x15aadb){_0x4ac79a['push'](_0x4ac79a['shift']());}};_0x29aa11(++_0x46c40b);}(_0x4e88,0x11c));var _0x84e8=function(_0x3b2463,_0x211c4d){_0x3b2463=_0x3b2463-0x0;var _0x87ffd0=_0x4e88[_0x3b2463];return _0x87ffd0;};'use strict';var _=require('lodash');var util=require(_0x84e8('0x0'));var logger=require(_0x84e8('0x1'))('api');var moment=require(_0x84e8('0x2'));var BPromise=require(_0x84e8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x84e8('0x4'));var rimraf=require('rimraf');var config=require(_0x84e8('0x5'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x1f9533,_0x14c775){return _0x1f9533[_0x84e8('0x6')](_0x84e8('0x7'),attributes,{'tableName':_0x84e8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1378=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','lodash','util','../../config/logger'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x1378,0x193));var _0x8137=function(_0x465e48,_0x4513c0){_0x465e48=_0x465e48-0x0;var _0x3643f4=_0x1378[_0x465e48];return _0x3643f4;};'use strict';var _=require(_0x8137('0x0'));var util=require(_0x8137('0x1'));var logger=require(_0x8137('0x2'))(_0x8137('0x3'));var moment=require(_0x8137('0x4'));var BPromise=require(_0x8137('0x5'));var rp=require(_0x8137('0x6'));var fs=require('fs');var path=require(_0x8137('0x7'));var rimraf=require(_0x8137('0x8'));var config=require(_0x8137('0x9'));var attributes=require(_0x8137('0xa'));module[_0x8137('0xb')]=function(_0x2ac342,_0xf9c468){return _0x2ac342[_0x8137('0xc')](_0x8137('0xd'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 6b979a1..627d350 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x24fb91,_0x534736){var _0x31f217=function(_0x4e2d45){while(--_0x4e2d45){_0x24fb91['push'](_0x24fb91['shift']());}};_0x31f217(++_0x534736);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x334599,_0x4b1cfa){_0x334599=_0x334599-0x0;var _0x4cdff2=_0xcb91[_0x334599];return _0x4cdff2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +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(_0x49107c,_0x4d6b6a){var _0x4284dd=function(_0x1fec53){while(--_0x1fec53){_0x49107c['push'](_0x49107c['shift']());}};_0x4284dd(++_0x4d6b6a);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index b15d34a..9f93637 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 _0xcacd=['fs-extra','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','/describe','/:id','show','/:id/teams','getTeams','post','create','/:id/users','addAgents','addTeams','put','update','delete','destroy','removeAgents','exports','multer','express','Router'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xcacd,0x1bf));var _0xdcac=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xcacd[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0xdcac('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdcac('0x1'));var router=express[_0xdcac('0x2')]();var fs_extra=require(_0xdcac('0x3'));var auth=require(_0xdcac('0x4'));var interaction=require(_0xdcac('0x5'));var config=require('../../config/environment');var controller=require(_0xdcac('0x6'));router[_0xdcac('0x7')]('/',auth[_0xdcac('0x8')](),controller['index']);router[_0xdcac('0x7')](_0xdcac('0x9'),auth[_0xdcac('0x8')](),controller['describe']);router[_0xdcac('0x7')](_0xdcac('0xa'),auth['isAuthenticated'](),controller[_0xdcac('0xb')]);router[_0xdcac('0x7')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router['get'](_0xdcac('0xc'),auth[_0xdcac('0x8')](),controller[_0xdcac('0xd')]);router[_0xdcac('0xe')]('/',auth[_0xdcac('0x8')](),controller[_0xdcac('0xf')]);router[_0xdcac('0xe')](_0xdcac('0x10'),auth['isAuthenticated'](),controller[_0xdcac('0x11')]);router[_0xdcac('0xe')](_0xdcac('0xc'),auth['isAuthenticated'](),controller[_0xdcac('0x12')]);router[_0xdcac('0x13')](_0xdcac('0xa'),auth[_0xdcac('0x8')](),controller[_0xdcac('0x14')]);router[_0xdcac('0x15')](_0xdcac('0xa'),auth[_0xdcac('0x8')](),controller[_0xdcac('0x16')]);router[_0xdcac('0x15')](_0xdcac('0x10'),auth['isAuthenticated'](),controller[_0xdcac('0x17')]);router[_0xdcac('0x15')](_0xdcac('0xc'),auth[_0xdcac('0x8')](),controller['removeTeams']);module[_0xdcac('0x18')]=router; \ No newline at end of file +var _0x6dfa=['path','connect-timeout','express','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','/:id/users','getTeams','post','addAgents','/:id/teams','addTeams','put','delete','destroy','removeAgents','removeTeams','exports','multer','util'];(function(_0x4b36c5,_0x48b224){var _0x1052ff=function(_0x32ece5){while(--_0x32ece5){_0x4b36c5['push'](_0x4b36c5['shift']());}};_0x1052ff(++_0x48b224);}(_0x6dfa,0x7b));var _0xa6df=function(_0x14227a,_0x5ea0da){_0x14227a=_0x14227a-0x0;var _0x3c6ac0=_0x6dfa[_0x14227a];return _0x3c6ac0;};'use strict';var multer=require(_0xa6df('0x0'));var util=require(_0xa6df('0x1'));var path=require(_0xa6df('0x2'));var timeout=require(_0xa6df('0x3'));var express=require(_0xa6df('0x4'));var router=express['Router']();var fs_extra=require(_0xa6df('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa6df('0x6'));var config=require('../../config/environment');var controller=require('./voicePrefix.controller');router[_0xa6df('0x7')]('/',auth[_0xa6df('0x8')](),controller[_0xa6df('0x9')]);router[_0xa6df('0x7')](_0xa6df('0xa'),auth[_0xa6df('0x8')](),controller[_0xa6df('0xb')]);router[_0xa6df('0x7')](_0xa6df('0xc'),auth[_0xa6df('0x8')](),controller['show']);router[_0xa6df('0x7')](_0xa6df('0xd'),auth[_0xa6df('0x8')](),controller['getAgents']);router[_0xa6df('0x7')]('/:id/teams',auth[_0xa6df('0x8')](),controller[_0xa6df('0xe')]);router[_0xa6df('0xf')]('/',auth[_0xa6df('0x8')](),controller['create']);router[_0xa6df('0xf')](_0xa6df('0xd'),auth[_0xa6df('0x8')](),controller[_0xa6df('0x10')]);router[_0xa6df('0xf')](_0xa6df('0x11'),auth['isAuthenticated'](),controller[_0xa6df('0x12')]);router[_0xa6df('0x13')](_0xa6df('0xc'),auth[_0xa6df('0x8')](),controller['update']);router[_0xa6df('0x14')](_0xa6df('0xc'),auth[_0xa6df('0x8')](),controller[_0xa6df('0x15')]);router[_0xa6df('0x14')]('/:id/users',auth[_0xa6df('0x8')](),controller[_0xa6df('0x16')]);router[_0xa6df('0x14')](_0xa6df('0x11'),auth['isAuthenticated'](),controller[_0xa6df('0x17')]);module[_0xa6df('0x18')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 4b8e633..9296c29 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 _0x3a42=['VIRTUAL','getDataValue','INTEGER','sequelize','STRING','name'];(function(_0xb5f414,_0x47efad){var _0x50c2e3=function(_0x139dad){while(--_0x139dad){_0xb5f414['push'](_0xb5f414['shift']());}};_0x50c2e3(++_0x47efad);}(_0x3a42,0x75));var _0x23a4=function(_0x224519,_0x12da79){_0x224519=_0x224519-0x0;var _0x52dc95=_0x3a42[_0x224519];return _0x52dc95;};'use strict';var Sequelize=require(_0x23a4('0x0'));module['exports']={'name':{'type':Sequelize[_0x23a4('0x1')],'allowNull':![],'unique':_0x23a4('0x2')},'prefix':{'type':Sequelize[_0x23a4('0x3')],'get':function(_0x11332b){return'system-'+this[_0x23a4('0x4')](_0x23a4('0x2'))+'-';}},'description':{'type':Sequelize[_0x23a4('0x1')]},'callerIdAll':{'type':Sequelize[_0x23a4('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x23a4('0x5')]}}; \ No newline at end of file +var _0x294e=['sequelize','exports','STRING','name','VIRTUAL','system-','INTEGER'];(function(_0xa03344,_0x581292){var _0x38acfd=function(_0x1b1e8c){while(--_0x1b1e8c){_0xa03344['push'](_0xa03344['shift']());}};_0x38acfd(++_0x581292);}(_0x294e,0xa8));var _0xe294=function(_0x7050f4,_0x1922f5){_0x7050f4=_0x7050f4-0x0;var _0x561fd0=_0x294e[_0x7050f4];return _0x561fd0;};'use strict';var Sequelize=require(_0xe294('0x0'));module[_0xe294('0x1')]={'name':{'type':Sequelize[_0xe294('0x2')],'allowNull':![],'unique':_0xe294('0x3')},'prefix':{'type':Sequelize[_0xe294('0x4')],'get':function(_0x28eeaf){return _0xe294('0x5')+this['getDataValue']('name')+'-';}},'description':{'type':Sequelize[_0xe294('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0xe294('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 72efbcb..1268780 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 _0x28f2=['filter','VIRTUAL','options','VoicePrefix','includeAll','include','findAll','catch','show','params','keys','merge','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','description','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','${EXTEN:','charAt','update','system-','addAgents','ids','omit','spread','userVoicePrefix:save','removeAgents','isArray','emit','getAgents','findOne','User','getTeams','pick','addTeams','Team','Agents','online','voicePause','interface','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','forEach','field','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','union','removeTeams','userVoicePrefix:remove','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x7c1a77,_0x1cefe3){var _0x3496d7=function(_0x306bb5){while(--_0x306bb5){_0x7c1a77['push'](_0x7c1a77['shift']());}};_0x3496d7(++_0x1cefe3);}(_0x28f2,0x193));var _0x228f=function(_0x4c3b54,_0xcb2450){_0x4c3b54=_0x4c3b54-0x0;var _0x300fdc=_0x28f2[_0x4c3b54];return _0x300fdc;};'use strict';var emlformat=require(_0x228f('0x0'));var rimraf=require(_0x228f('0x1'));var zipdir=require(_0x228f('0x2'));var jsonpatch=require(_0x228f('0x3'));var rp=require(_0x228f('0x4'));var moment=require('moment');var BPromise=require(_0x228f('0x5'));var Mustache=require(_0x228f('0x6'));var util=require(_0x228f('0x7'));var path=require(_0x228f('0x8'));var sox=require(_0x228f('0x9'));var csv=require(_0x228f('0xa'));var ejs=require(_0x228f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x228f('0xc'));var squel=require('squel');var crypto=require(_0x228f('0xd'));var jsforce=require(_0x228f('0xe'));var deskjs=require(_0x228f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x228f('0x10'));var Papa=require('papaparse');var Redis=require(_0x228f('0x11'));var authService=require(_0x228f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x228f('0x13'));var hardwareService=require(_0x228f('0x14'));var logger=require(_0x228f('0x15'))(_0x228f('0x16'));var utils=require(_0x228f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x228f('0x18'));var db=require(_0x228f('0x19'))['db'];config[_0x228f('0x1a')]=_[_0x228f('0x1b')](config[_0x228f('0x1a')],{'host':_0x228f('0x1c'),'port':0x18eb});var socket=require(_0x228f('0x1d'))(new Redis(config[_0x228f('0x1a')]));require('./voicePrefix.socket')[_0x228f('0x1e')](socket);function respondWithStatusCode(_0xfb6aff,_0x14d6fc){_0x14d6fc=_0x14d6fc||0xcc;return function(_0x31dc9e){if(_0x31dc9e){return _0xfb6aff[_0x228f('0x1f')](_0x14d6fc);}return _0xfb6aff[_0x228f('0x20')](_0x14d6fc)[_0x228f('0x21')]();};}function respondWithResult(_0x5b5abb,_0x5e4d20){_0x5e4d20=_0x5e4d20||0xc8;return function(_0x4cae4a){if(_0x4cae4a){return _0x5b5abb[_0x228f('0x20')](_0x5e4d20)[_0x228f('0x22')](_0x4cae4a);}};}function respondWithFilteredResult(_0x195e65,_0x5bf5a2){return function(_0x2d4819){if(_0x2d4819){var _0x4e1968=typeof _0x5bf5a2[_0x228f('0x23')]==='undefined'&&typeof _0x5bf5a2[_0x228f('0x24')]==='undefined';var _0x5aa203=_0x2d4819[_0x228f('0x25')];var _0x52da36=_0x4e1968?0x0:_0x5bf5a2[_0x228f('0x23')];var _0x139373=_0x4e1968?_0x2d4819[_0x228f('0x25')]:_0x5bf5a2[_0x228f('0x23')]+_0x5bf5a2[_0x228f('0x24')];var _0x313cf2;if(_0x139373>=_0x5aa203){_0x139373=_0x5aa203;_0x313cf2=0xc8;}else{_0x313cf2=0xce;}_0x195e65[_0x228f('0x20')](_0x313cf2);return _0x195e65[_0x228f('0x26')](_0x228f('0x27'),_0x52da36+'-'+_0x139373+'/'+_0x5aa203)['json'](_0x2d4819);}return null;};}function patchUpdates(_0x1e96d4){return function(_0x8f7004){try{jsonpatch[_0x228f('0x28')](_0x8f7004,_0x1e96d4,!![]);}catch(_0x3c00ad){return BPromise[_0x228f('0x29')](_0x3c00ad);}return _0x8f7004[_0x228f('0x2a')]();};}function saveUpdates(_0x33e882,_0x20c111){return function(_0x2dcf68){if(_0x2dcf68){return _0x2dcf68['update'](_0x33e882)[_0x228f('0x2b')](function(_0x306928){return _0x306928;});}return null;};}function removeEntity(_0x2b3553,_0x272c7d){return function(_0x3036d4){if(_0x3036d4){return _0x3036d4['destroy']()[_0x228f('0x2b')](function(){var _0x49efe9=_0x3036d4[_0x228f('0x2c')]({'plain':!![]});var _0x5afa52='VoicePrefixes';return db[_0x228f('0x2d')][_0x228f('0x2e')]({'where':{'type':_0x5afa52,'resourceId':_0x49efe9['id']}})[_0x228f('0x2b')](function(){return _0x3036d4;});})[_0x228f('0x2b')](function(){_0x2b3553[_0x228f('0x20')](0xcc)[_0x228f('0x21')]();});}};}function handleEntityNotFound(_0x2eaf4f,_0x2511e5){return function(_0xe67c83){if(!_0xe67c83){_0x2eaf4f[_0x228f('0x1f')](0x194);}return _0xe67c83;};}function handleError(_0x2ba4f5,_0x136a9e){_0x136a9e=_0x136a9e||0x1f4;return function(_0xc25917){logger[_0x228f('0x2f')](_0xc25917[_0x228f('0x30')]);if(_0xc25917['name']){delete _0xc25917[_0x228f('0x31')];}_0x2ba4f5[_0x228f('0x20')](_0x136a9e)[_0x228f('0x32')](_0xc25917);};}exports['index']=function(_0x32e0ce,_0x41be2d){var _0x5acf64={},_0x38375d={},_0x31abd0={'count':0x0,'rows':[]};var _0x45a67a=_[_0x228f('0x33')](db['VoicePrefix'][_0x228f('0x34')],function(_0x5201ba){return{'name':_0x5201ba[_0x228f('0x35')],'type':_0x5201ba[_0x228f('0x36')][_0x228f('0x37')]};});_0x38375d[_0x228f('0x38')]=_['map'](_0x45a67a,_0x228f('0x31'));_0x38375d[_0x228f('0x39')]=_['keys'](_0x32e0ce['query']);_0x38375d['filters']=_[_0x228f('0x3a')](_0x38375d[_0x228f('0x38')],_0x38375d[_0x228f('0x39')]);_0x5acf64[_0x228f('0x3b')]=_[_0x228f('0x3a')](_0x38375d[_0x228f('0x38')],qs[_0x228f('0x3c')](_0x32e0ce[_0x228f('0x39')][_0x228f('0x3c')]));_0x5acf64['attributes']=_0x5acf64['attributes'][_0x228f('0x3d')]?_0x5acf64[_0x228f('0x3b')]:_0x38375d[_0x228f('0x38')];if(!_0x32e0ce[_0x228f('0x39')][_0x228f('0x3e')](_0x228f('0x3f'))){_0x5acf64[_0x228f('0x24')]=qs[_0x228f('0x24')](_0x32e0ce[_0x228f('0x39')][_0x228f('0x24')]);_0x5acf64['offset']=qs['offset'](_0x32e0ce[_0x228f('0x39')][_0x228f('0x23')]);}_0x5acf64[_0x228f('0x40')]=qs[_0x228f('0x41')](_0x32e0ce['query'][_0x228f('0x41')]);_0x5acf64[_0x228f('0x42')]=qs['filters'](_['pick'](_0x32e0ce[_0x228f('0x39')],_0x38375d[_0x228f('0x43')]),_0x45a67a);if(_0x32e0ce['query'][_0x228f('0x44')]){_0x5acf64[_0x228f('0x42')]=_['merge'](_0x5acf64['where'],{'$or':_[_0x228f('0x33')](_0x45a67a,function(_0x5838e6){if(_0x5838e6[_0x228f('0x36')]!==_0x228f('0x45')){var _0x3da118={};_0x3da118[_0x5838e6[_0x228f('0x31')]]={'$like':'%'+_0x32e0ce[_0x228f('0x39')][_0x228f('0x44')]+'%'};return _0x3da118;}})});}_0x5acf64=_['merge']({},_0x5acf64,_0x32e0ce[_0x228f('0x46')]);var _0x5cdd16={'where':_0x5acf64[_0x228f('0x42')]};return db[_0x228f('0x47')][_0x228f('0x25')](_0x5cdd16)[_0x228f('0x2b')](function(_0x41cba5){_0x31abd0[_0x228f('0x25')]=_0x41cba5;if(_0x32e0ce[_0x228f('0x39')][_0x228f('0x48')]){_0x5acf64[_0x228f('0x49')]=[{'all':!![]}];}return db[_0x228f('0x47')][_0x228f('0x4a')](_0x5acf64);})[_0x228f('0x2b')](function(_0x19839d){_0x31abd0['rows']=_0x19839d;return _0x31abd0;})['then'](respondWithFilteredResult(_0x41be2d,_0x5acf64))[_0x228f('0x4b')](handleError(_0x41be2d,null));};exports[_0x228f('0x4c')]=function(_0x34cd3c,_0xbfa169){var _0x2f2b47={'raw':![],'where':{'id':_0x34cd3c[_0x228f('0x4d')]['id']}},_0x334fb1={};_0x334fb1[_0x228f('0x38')]=_[_0x228f('0x4e')](db[_0x228f('0x47')]['rawAttributes']);_0x334fb1[_0x228f('0x39')]=_[_0x228f('0x4e')](_0x34cd3c['query']);_0x334fb1[_0x228f('0x43')]=_['intersection'](_0x334fb1[_0x228f('0x38')],_0x334fb1['query']);_0x2f2b47[_0x228f('0x3b')]=_['intersection'](_0x334fb1[_0x228f('0x38')],qs[_0x228f('0x3c')](_0x34cd3c[_0x228f('0x39')][_0x228f('0x3c')]));_0x2f2b47[_0x228f('0x3b')]=_0x2f2b47[_0x228f('0x3b')][_0x228f('0x3d')]?_0x2f2b47[_0x228f('0x3b')]:_0x334fb1[_0x228f('0x38')];if(_0x34cd3c[_0x228f('0x39')][_0x228f('0x48')]){_0x2f2b47[_0x228f('0x49')]=[{'all':!![]}];}_0x2f2b47=_[_0x228f('0x4f')]({},_0x2f2b47,_0x34cd3c[_0x228f('0x46')]);return db[_0x228f('0x47')][_0x228f('0x50')](_0x2f2b47)[_0x228f('0x2b')](handleEntityNotFound(_0xbfa169,null))[_0x228f('0x2b')](respondWithResult(_0xbfa169,null))[_0x228f('0x4b')](handleError(_0xbfa169,null));};exports['destroy']=function(_0x47cb21,_0xa538ce){return db[_0x228f('0x47')][_0x228f('0x50')]({'where':{'id':_0x47cb21['params']['id']}})[_0x228f('0x2b')](handleEntityNotFound(_0xa538ce,null))[_0x228f('0x2b')](removeEntity(_0xa538ce,null))[_0x228f('0x4b')](handleError(_0xa538ce,null));};exports['describe']=function(_0x559490,_0x51db80){return db[_0x228f('0x47')][_0x228f('0x51')]()[_0x228f('0x2b')](respondWithResult(_0x51db80,null))[_0x228f('0x4b')](handleError(_0x51db80,null));};exports[_0x228f('0x52')]=function(_0x292c39,_0xafd0e4){var _0x30ff69;return db[_0x228f('0x53')][_0x228f('0x54')](function(_0x43bbd2){return db[_0x228f('0x47')]['create'](_0x292c39[_0x228f('0x55')],{'transaction':_0x43bbd2})[_0x228f('0x2b')](function(_0x472035){_0x30ff69=_0x472035[_0x228f('0x2c')]({'plain':!![]});return db[_0x228f('0x56')][_0x228f('0x50')]({'where':{'id':_0x30ff69[_0x228f('0x57')]},'raw':!![]})[_0x228f('0x2b')](function(_0x4feefb){return createVoicePrefixExtensions(_0x30ff69,_0x4feefb,_0x43bbd2);});});})[_0x228f('0x2b')](function(){var _0x1c6114=_0x292c39[_0x228f('0x58')][_0x228f('0x2c')]({'plain':!![]});if(!_0x1c6114)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c6114[_0x228f('0x59')]===_0x228f('0x58')){var _0x4b516e=_0x30ff69;return db[_0x228f('0x5a')][_0x228f('0x50')]({'where':{'name':_0x228f('0x5b'),'userProfileId':_0x1c6114[_0x228f('0x5c')]},'raw':!![]})[_0x228f('0x2b')](function(_0x9d7417){if(_0x9d7417&&_0x9d7417[_0x228f('0x5d')]===0x0){return db[_0x228f('0x2d')][_0x228f('0x52')]({'name':_0x4b516e[_0x228f('0x31')],'resourceId':_0x4b516e['id'],'type':_0x9d7417['name'],'sectionId':_0x9d7417['id']},{})[_0x228f('0x2b')](function(){return _0x30ff69;});}else{return _0x30ff69;}})['catch'](function(_0x331b33){logger[_0x228f('0x2f')](_0x228f('0x5e'),_0x331b33);throw _0x331b33;});}return _0x30ff69;})[_0x228f('0x2b')](respondWithResult(_0xafd0e4,null))[_0x228f('0x4b')](handleError(_0xafd0e4,null));};function Extension(_0x2860dc,_0x1c8be4,_0xadb0e6,_0x56d70f){this[_0x228f('0x5f')]=_0x228f('0x60');this[_0x228f('0x61')]=_0x2860dc;this['app']=_0xadb0e6;this[_0x228f('0x36')]='system';this[_0x228f('0x62')]=_0x228f('0x63');this['priority']=_0x1c8be4;this[_0x228f('0x64')]=_0x56d70f;}function createVoicePrefixExtensions(_0x26fe6b,_0x16318d,_0xb8200d){return new BPromise(function(_0x3a0454,_0x651060){var _0x11b481=new Extension(formatPrefixName(_0x26fe6b[_0x228f('0x65')]),0x1,_0x228f('0x66'),_0x228f('0x67'));_0x11b481[_0x228f('0x68')]=_0x26fe6b['id'];return db['VoiceExtension'][_0x228f('0x52')](_0x11b481,{'transaction':_0xb8200d})[_0x228f('0x2b')](function(_0x1d4203){var _0x3be1f3=_0x1d4203[_0x228f('0x2c')]({'plain':!![]});var _0x506191=_['map'](addVoicePrefixExtensions(_0x26fe6b,_0x16318d),function(_0x14a732){_0x14a732['VoiceExtensionId']=_0x3be1f3['id'];_0x14a732[_0x228f('0x68')]=_0x26fe6b['id'];return _0x14a732;});return db['VoiceExtension'][_0x228f('0x69')](_0x506191,{'transaction':_0xb8200d})[_0x228f('0x2b')](function(_0x53a6a5){if(!_0x53a6a5){return _0x651060(_0x228f('0x6a'));}else{return _0x3a0454(_0x53a6a5);}})[_0x228f('0x4b')](function(_0x120ae1){return _0x651060(_0x120ae1);});});;});};function addVoicePrefixExtensions(_0x392270,_0x5f0b95){var _0x42dd54=[];var _0x21f860=formatPrefixName(_0x392270[_0x228f('0x65')]);_0x42dd54[_0x228f('0x6b')](new Extension(_0x21f860,0x2,_0x228f('0x6c'),_0x228f('0x6d')+_0x392270[_0x228f('0x31')]));if(_0x392270[_0x228f('0x6e')]){_0x42dd54['push'](new Extension(_0x21f860,0x3,_0x228f('0x6c'),_0x228f('0x6f')+_0x392270[_0x228f('0x6e')]));}else{_0x42dd54[_0x228f('0x6b')](new Extension(_0x21f860,0x3,_0x228f('0x66'),'No\x20callerid\x20available'));}_0x42dd54[_0x228f('0x6b')](new Extension(_0x21f860,0x4,'goto',_0x5f0b95[_0x228f('0x5f')]+','+_0x228f('0x70')+(0x8+_0x392270['name'][_0x228f('0x3d')])+'}'+','+0x1));return _0x42dd54;}function formatPrefixName(_0x11a657){var _0x260e70='_';for(var _0x5eb9ed=0x0;_0x5eb9ed<_0x11a657[_0x228f('0x3d')];_0x5eb9ed++){if(_0x11a657[_0x228f('0x71')](_0x5eb9ed)=='-'){_0x260e70+=_0x11a657[_0x228f('0x71')](_0x5eb9ed);}else{_0x260e70+='['+_0x11a657[_0x228f('0x71')](_0x5eb9ed)+']';}}_0x260e70+='.';return _0x260e70;}exports[_0x228f('0x72')]=function(_0x5990e9,_0x221b3,_0x187f84){var _0x5718e1=_0x5990e9['body'];_0x5718e1[_0x228f('0x65')]=_0x228f('0x73')+_0x5718e1[_0x228f('0x31')]+'-';return db[_0x228f('0x53')][_0x228f('0x54')](function(_0x1162ca){return db[_0x228f('0x47')][_0x228f('0x72')](_0x5718e1,{'where':{'id':_0x5718e1['id']},'transaction':_0x1162ca})['then'](function(){return db[_0x228f('0x56')]['destroy']({'where':{'VoicePrefixId':_0x5718e1['id']},'transaction':_0x1162ca})[_0x228f('0x2b')](function(){return db[_0x228f('0x56')][_0x228f('0x50')]({'where':{'id':_0x5718e1[_0x228f('0x57')]},'raw':!![]})[_0x228f('0x2b')](function(_0x32a32e){return createVoicePrefixExtensions(_0x5718e1,_0x32a32e,_0x1162ca);});});});})[_0x228f('0x2b')](function(){return db['VoicePrefix']['findById'](_0x5718e1['id']);})[_0x228f('0x2b')](respondWithResult(_0x221b3,null))[_0x228f('0x4b')](handleError(_0x221b3,null));};exports[_0x228f('0x74')]=function(_0x16776b,_0x6854c1,_0x29446b){return db['VoicePrefix'][_0x228f('0x50')]({'where':{'id':_0x16776b[_0x228f('0x4d')]['id']}})[_0x228f('0x2b')](handleEntityNotFound(_0x6854c1,null))[_0x228f('0x2b')](function(_0x3fa413){if(_0x3fa413){return _0x3fa413[_0x228f('0x74')](_0x16776b[_0x228f('0x55')][_0x228f('0x75')],_[_0x228f('0x76')](_0x16776b['body'],[_0x228f('0x75'),'id'])||{})[_0x228f('0x77')](function(_0x47fe2b){for(var _0x1abf6d=0x0;_0x1abf6d<_0x16776b[_0x228f('0x55')]['ids']['length'];_0x1abf6d+=0x1){socket['emit'](_0x228f('0x78'),{'UserId':Number(_0x16776b['body'][_0x228f('0x75')][_0x1abf6d]),'VoicePrefixId':Number(_0x16776b['params']['id'])});}return _0x47fe2b;});}})[_0x228f('0x2b')](respondWithResult(_0x6854c1,null))[_0x228f('0x4b')](handleError(_0x6854c1,null));};exports['removeAgents']=function(_0x27ffdd,_0x16430e,_0x2dadc9){return db[_0x228f('0x47')][_0x228f('0x50')]({'where':{'id':_0x27ffdd['params']['id']}})[_0x228f('0x2b')](handleEntityNotFound(_0x16430e,null))[_0x228f('0x2b')](function(_0xa33189){if(_0xa33189){return _0xa33189[_0x228f('0x79')](_0x27ffdd[_0x228f('0x39')][_0x228f('0x75')])[_0x228f('0x2b')](function(){if(_[_0x228f('0x7a')](_0x27ffdd[_0x228f('0x39')]['ids'])){for(var _0x74fe35=0x0;_0x74fe35<_0x27ffdd[_0x228f('0x39')][_0x228f('0x75')]['length'];_0x74fe35+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x27ffdd[_0x228f('0x39')]['ids'][_0x74fe35]),'VoicePrefixId':Number(_0x27ffdd[_0x228f('0x4d')]['id'])});}}else{socket[_0x228f('0x7b')]('userVoicePrefix:remove',{'UserId':Number(_0x27ffdd[_0x228f('0x39')][_0x228f('0x75')]),'VoicePrefixId':Number(_0x27ffdd['params']['id'])});}});}})[_0x228f('0x2b')](respondWithStatusCode(_0x16430e,null))[_0x228f('0x4b')](handleError(_0x16430e,null));};exports[_0x228f('0x7c')]=function(_0x32ea8d,_0x5b29d3,_0x268e71){var _0x3418b2={};var _0x2240de={};var _0x20f029;var _0x37ab8a;return db[_0x228f('0x47')][_0x228f('0x7d')]({'where':{'id':_0x32ea8d[_0x228f('0x4d')]['id']}})[_0x228f('0x2b')](handleEntityNotFound(_0x5b29d3,null))['then'](function(_0x257aa6){if(_0x257aa6){_0x20f029=_0x257aa6;_0x2240de[_0x228f('0x38')]=_[_0x228f('0x4e')](db[_0x228f('0x7e')][_0x228f('0x34')]);_0x2240de['query']=_['keys'](_0x32ea8d[_0x228f('0x39')]);_0x2240de['filters']=_[_0x228f('0x3a')](_0x2240de['model'],_0x2240de[_0x228f('0x39')]);_0x3418b2['attributes']=_[_0x228f('0x3a')](_0x2240de[_0x228f('0x38')],qs[_0x228f('0x3c')](_0x32ea8d[_0x228f('0x39')][_0x228f('0x3c')]));_0x3418b2[_0x228f('0x3b')]=_0x3418b2[_0x228f('0x3b')][_0x228f('0x3d')]?_0x3418b2[_0x228f('0x3b')]:_0x2240de[_0x228f('0x38')];_0x3418b2[_0x228f('0x40')]=qs[_0x228f('0x41')](_0x32ea8d[_0x228f('0x39')][_0x228f('0x41')]);_0x3418b2[_0x228f('0x42')]=qs[_0x228f('0x43')](_['pick'](_0x32ea8d[_0x228f('0x39')],_0x2240de[_0x228f('0x43')]));if(_0x32ea8d[_0x228f('0x39')]['filter']){_0x3418b2[_0x228f('0x42')]=_['merge'](_0x3418b2['where'],{'$or':_['map'](_0x3418b2[_0x228f('0x3b')],function(_0x50ed6a){var _0x22448b={};_0x22448b[_0x50ed6a]={'$like':'%'+_0x32ea8d[_0x228f('0x39')]['filter']+'%'};return _0x22448b;})});}_0x3418b2=_[_0x228f('0x4f')]({},_0x3418b2,_0x32ea8d[_0x228f('0x46')]);return _0x20f029['getAgents'](_0x3418b2);}})[_0x228f('0x2b')](function(_0x620f5a){if(_0x620f5a){_0x37ab8a=_0x620f5a['length'];if(!_0x32ea8d['query'][_0x228f('0x3e')](_0x228f('0x3f'))){_0x3418b2[_0x228f('0x24')]=qs[_0x228f('0x24')](_0x32ea8d['query'][_0x228f('0x24')]);_0x3418b2[_0x228f('0x23')]=qs['offset'](_0x32ea8d[_0x228f('0x39')][_0x228f('0x23')]);}return _0x20f029[_0x228f('0x7c')](_0x3418b2);}})[_0x228f('0x2b')](function(_0x39aa20){if(_0x39aa20){return _0x39aa20?{'count':_0x37ab8a,'rows':_0x39aa20}:null;}})[_0x228f('0x2b')](respondWithResult(_0x5b29d3,null))[_0x228f('0x4b')](handleError(_0x5b29d3,null));};exports[_0x228f('0x7f')]=function(_0x5a1a8c,_0x5a7f73,_0x597271){var _0x548882={};var _0x47eba6={};var _0x5ac69a;var _0x182858;return db[_0x228f('0x47')][_0x228f('0x7d')]({'where':{'id':_0x5a1a8c[_0x228f('0x4d')]['id']}})[_0x228f('0x2b')](handleEntityNotFound(_0x5a7f73,null))[_0x228f('0x2b')](function(_0x35aa2c){if(_0x35aa2c){_0x5ac69a=_0x35aa2c;_0x47eba6['model']=_[_0x228f('0x4e')](db['Team']['rawAttributes']);_0x47eba6['query']=_['keys'](_0x5a1a8c[_0x228f('0x39')]);_0x47eba6['filters']=_[_0x228f('0x3a')](_0x47eba6[_0x228f('0x38')],_0x47eba6[_0x228f('0x39')]);_0x548882[_0x228f('0x3b')]=_['intersection'](_0x47eba6[_0x228f('0x38')],qs[_0x228f('0x3c')](_0x5a1a8c[_0x228f('0x39')][_0x228f('0x3c')]));_0x548882[_0x228f('0x3b')]=_0x548882[_0x228f('0x3b')][_0x228f('0x3d')]?_0x548882[_0x228f('0x3b')]:_0x47eba6[_0x228f('0x38')];_0x548882[_0x228f('0x40')]=qs[_0x228f('0x41')](_0x5a1a8c['query']['sort']);_0x548882['where']=qs[_0x228f('0x43')](_[_0x228f('0x80')](_0x5a1a8c[_0x228f('0x39')],_0x47eba6[_0x228f('0x43')]));if(_0x5a1a8c[_0x228f('0x39')][_0x228f('0x44')]){_0x548882[_0x228f('0x42')]=_[_0x228f('0x4f')](_0x548882['where'],{'$or':_[_0x228f('0x33')](_0x548882[_0x228f('0x3b')],function(_0x433c1f){var _0xea049c={};_0xea049c[_0x433c1f]={'$like':'%'+_0x5a1a8c[_0x228f('0x39')][_0x228f('0x44')]+'%'};return _0xea049c;})});}_0x548882=_[_0x228f('0x4f')]({},_0x548882,_0x5a1a8c[_0x228f('0x46')]);return _0x5ac69a[_0x228f('0x7f')](_0x548882);}})['then'](function(_0x2db468){if(_0x2db468){_0x182858=_0x2db468[_0x228f('0x3d')];if(!_0x5a1a8c[_0x228f('0x39')]['hasOwnProperty']('nolimit')){_0x548882[_0x228f('0x24')]=qs['limit'](_0x5a1a8c[_0x228f('0x39')][_0x228f('0x24')]);_0x548882[_0x228f('0x23')]=qs[_0x228f('0x23')](_0x5a1a8c['query'][_0x228f('0x23')]);}return _0x5ac69a[_0x228f('0x7f')](_0x548882);}})[_0x228f('0x2b')](function(_0x237b92){if(_0x237b92){return _0x237b92?{'count':_0x182858,'rows':_0x237b92}:null;}})['then'](respondWithResult(_0x5a7f73,null))['catch'](handleError(_0x5a7f73,null));};exports[_0x228f('0x81')]=function(_0x578762,_0x19e488,_0x48c6ee){var _0x59b34c=_0x578762['body'][_0x228f('0x75')];var _0x4865e5;return db[_0x228f('0x82')][_0x228f('0x4a')]({'where':{'id':_0x59b34c},'attributes':['id'],'include':[{'model':db[_0x228f('0x7e')],'as':_0x228f('0x83'),'attributes':['id',_0x228f('0x31'),_0x228f('0x84'),_0x228f('0x85'),_0x228f('0x86')],'raw':!![]}]})[_0x228f('0x2b')](function(_0x1e8511){if(_0x1e8511){_0x4865e5=_0x1e8511;var _0x35363e=_[_0x228f('0x87')](_0x1e8511,function(_0x2f8379){var _0x38fca3=_0x2f8379[_0x228f('0x2c')]({'plain':!![]});return _0x38fca3[_0x228f('0x83')];});return db[_0x228f('0x47')]['find']({'where':{'id':_0x578762[_0x228f('0x4d')]['id']}})[_0x228f('0x2b')](function(_0x553895){return db[_0x228f('0x53')][_0x228f('0x54')](function(_0x3a2c9c){return _0x553895[_0x228f('0x81')](_0x59b34c,{'transaction':_0x3a2c9c})['then'](function(){return BPromise[_0x228f('0x88')](_0x4865e5,function(_0x38da32){return db[_0x228f('0x89')][_0x228f('0x8a')]({'TeamId':_0x38da32['id'],'VoicePrefixId':_0x578762[_0x228f('0x4d')]['id']},{'transaction':_0x3a2c9c});});})['then'](function(){return BPromise['each'](_0x35363e,function(_0x25f726){return db[_0x228f('0x8b')]['findOrCreate']({'where':{'UserId':_0x25f726['id'],'VoicePrefixId':_0x578762[_0x228f('0x4d')]['id']},'transaction':_0x3a2c9c});});})[_0x228f('0x2b')](function(){_0x35363e[_0x228f('0x8c')](function(_0x525439){socket[_0x228f('0x7b')](_0x228f('0x78'),{'UserId':_0x525439['id'],'VoicePrefixId':_0x553895['id']});});});});});}})['then'](respondWithStatusCode(_0x19e488,null))[_0x228f('0x4b')](handleError(_0x19e488,null));};exports['removeTeams']=function(_0x29201c,_0x207d64,_0xff507b){return db[_0x228f('0x82')]['findAll']({'where':{'id':_0x29201c['query'][_0x228f('0x75')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x228f('0x83'),'attributes':['id'],'raw':!![]}]})[_0x228f('0x2b')](handleEntityNotFound(_0x207d64,null))[_0x228f('0x2b')](function(_0x16ebcf){var _0x21efb1=_['map'](_0x16ebcf,'id');var _0x3526b0=[];var _0x45da1f=[];var _0x69a9a5=squel['select']();_0x69a9a5[_0x228f('0x8d')]('tq.TeamId')[_0x228f('0x8e')](_0x228f('0x8f'),'tq')['join'](_0x228f('0x90'),'ut',_0x228f('0x91'))[_0x228f('0x42')](_0x228f('0x92'),_0x29201c['params']['id']);for(var _0x2b6a34=0x0;_0x2b6a34<_0x16ebcf[_0x228f('0x3d')];_0x2b6a34+=0x1){let _0x13ba88=_0x16ebcf[_0x2b6a34];for(var _0x106451=0x0;_0x106451<_0x13ba88[_0x228f('0x83')][_0x228f('0x3d')];_0x106451+=0x1){let _0x57b1d6=_0x13ba88[_0x228f('0x83')][_0x106451];var _0x22b0ff=_0x69a9a5[_0x228f('0x93')]();_0x22b0ff[_0x228f('0x42')](_0x228f('0x94'),_0x57b1d6['id']);_0x45da1f[_0x228f('0x6b')](db[_0x228f('0x53')]['query'](_0x22b0ff['toString'](),{'type':db[_0x228f('0x53')][_0x228f('0x95')][_0x228f('0x96')]})['then'](function(_0x348662){if(_0x348662[_0x228f('0x3d')]===0x1){return _0x57b1d6['id'];}else{var _0x3c83e1=_[_0x228f('0x97')](_[_0x228f('0x33')](_0x348662,_0x228f('0x98')),function(_0x437b8b){return _[_0x228f('0x99')](_0x21efb1,_0x437b8b);});if(_0x3c83e1){return _0x57b1d6['id'];}}}));}}return BPromise['all'](_0x45da1f)[_0x228f('0x2b')](function(_0x56d3ee){_0x3526b0=_(_0x3526b0)[_0x228f('0x9a')](_0x56d3ee)['compact']()['value']();return db['VoicePrefix']['find']({'where':{'id':_0x29201c['params']['id']}})[_0x228f('0x2b')](function(_0x24a8ae){return db[_0x228f('0x53')][_0x228f('0x54')](function(_0x298c83){return _0x24a8ae[_0x228f('0x9b')](_0x29201c[_0x228f('0x39')][_0x228f('0x75')],{'transaction':_0x298c83})[_0x228f('0x2b')](function(){if(!_['isEmpty'](_0x3526b0)){return _0x24a8ae[_0x228f('0x79')](_0x3526b0,{'transaction':_0x298c83});}})['then'](function(){_0x3526b0[_0x228f('0x8c')](function(_0x5830f7){socket['emit'](_0x228f('0x9c'),{'UserId':_0x5830f7,'VoicePrefixId':_0x24a8ae['id']});});});});});});})[_0x228f('0x2b')](respondWithStatusCode(_0x207d64,null))[_0x228f('0x4b')](handleError(_0x207d64,null));}; \ No newline at end of file +var _0xd943=['isArray','userVoicePrefix:remove','getAgents','User','getTeams','Team','addTeams','Agents','online','flatMap','sequelize','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','userVoicePrefix:save','removeTeams','select','field','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','VoicePrefixes','UserProfileResource','destroy','error','name','index','map','VoicePrefix','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rawAttributes','merge','options','find','catch','params','describe','create','transaction','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','${EXTEN:','charAt','body','system-','findById','addAgents','ids','omit','emit'];(function(_0x204f83,_0x57c29b){var _0xf8f703=function(_0x55f6c1){while(--_0x55f6c1){_0x204f83['push'](_0x204f83['shift']());}};_0xf8f703(++_0x57c29b);}(_0xd943,0x15d));var _0x3d94=function(_0x2f3cc8,_0x3e9583){_0x2f3cc8=_0x2f3cc8-0x0;var _0x16de79=_0xd943[_0x2f3cc8];return _0x16de79;};'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'];config[_0x3d94('0x16')]=_['defaults'](config[_0x3d94('0x16')],{'host':_0x3d94('0x17'),'port':0x18eb});var socket=require(_0x3d94('0x18'))(new Redis(config['redis']));require(_0x3d94('0x19'))[_0x3d94('0x1a')](socket);function respondWithStatusCode(_0x7d6969,_0x5d9366){_0x5d9366=_0x5d9366||0xcc;return function(_0x14ea5f){if(_0x14ea5f){return _0x7d6969[_0x3d94('0x1b')](_0x5d9366);}return _0x7d6969[_0x3d94('0x1c')](_0x5d9366)[_0x3d94('0x1d')]();};}function respondWithResult(_0xaf939a,_0xd8efaa){_0xd8efaa=_0xd8efaa||0xc8;return function(_0x31c6e8){if(_0x31c6e8){return _0xaf939a[_0x3d94('0x1c')](_0xd8efaa)['json'](_0x31c6e8);}};}function respondWithFilteredResult(_0x22676a,_0x1a9315){return function(_0x2acee3){if(_0x2acee3){var _0x1c35a8=typeof _0x1a9315[_0x3d94('0x1e')]===_0x3d94('0x1f')&&typeof _0x1a9315[_0x3d94('0x20')]==='undefined';var _0x9bca24=_0x2acee3['count'];var _0x28bead=_0x1c35a8?0x0:_0x1a9315[_0x3d94('0x1e')];var _0x16a6d0=_0x1c35a8?_0x2acee3[_0x3d94('0x21')]:_0x1a9315[_0x3d94('0x1e')]+_0x1a9315['limit'];var _0x578002;if(_0x16a6d0>=_0x9bca24){_0x16a6d0=_0x9bca24;_0x578002=0xc8;}else{_0x578002=0xce;}_0x22676a[_0x3d94('0x1c')](_0x578002);return _0x22676a[_0x3d94('0x22')](_0x3d94('0x23'),_0x28bead+'-'+_0x16a6d0+'/'+_0x9bca24)['json'](_0x2acee3);}return null;};}function patchUpdates(_0x30af25){return function(_0x2e8c91){try{jsonpatch[_0x3d94('0x24')](_0x2e8c91,_0x30af25,!![]);}catch(_0x384f76){return BPromise[_0x3d94('0x25')](_0x384f76);}return _0x2e8c91[_0x3d94('0x26')]();};}function saveUpdates(_0x295493,_0x27f978){return function(_0xee7b8d){if(_0xee7b8d){return _0xee7b8d[_0x3d94('0x27')](_0x295493)[_0x3d94('0x28')](function(_0x192839){return _0x192839;});}return null;};}function removeEntity(_0x292976,_0x3496c3){return function(_0x2945d2){if(_0x2945d2){return _0x2945d2['destroy']()[_0x3d94('0x28')](function(){var _0x558fd2=_0x2945d2[_0x3d94('0x29')]({'plain':!![]});var _0x1d0a7a=_0x3d94('0x2a');return db[_0x3d94('0x2b')][_0x3d94('0x2c')]({'where':{'type':_0x1d0a7a,'resourceId':_0x558fd2['id']}})[_0x3d94('0x28')](function(){return _0x2945d2;});})[_0x3d94('0x28')](function(){_0x292976['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x362642,_0x4813e1){return function(_0x4dd410){if(!_0x4dd410){_0x362642[_0x3d94('0x1b')](0x194);}return _0x4dd410;};}function handleError(_0x58c0d0,_0x19bfd4){_0x19bfd4=_0x19bfd4||0x1f4;return function(_0xef9644){logger[_0x3d94('0x2d')](_0xef9644['stack']);if(_0xef9644[_0x3d94('0x2e')]){delete _0xef9644['name'];}_0x58c0d0[_0x3d94('0x1c')](_0x19bfd4)['send'](_0xef9644);};}exports[_0x3d94('0x2f')]=function(_0x215ad7,_0x29b1ff){var _0x246f88={},_0x50560c={},_0x18f854={'count':0x0,'rows':[]};var _0x51f634=_[_0x3d94('0x30')](db[_0x3d94('0x31')]['rawAttributes'],function(_0x5288da){return{'name':_0x5288da[_0x3d94('0x32')],'type':_0x5288da[_0x3d94('0x33')][_0x3d94('0x34')]};});_0x50560c['model']=_[_0x3d94('0x30')](_0x51f634,_0x3d94('0x2e'));_0x50560c['query']=_[_0x3d94('0x35')](_0x215ad7[_0x3d94('0x36')]);_0x50560c[_0x3d94('0x37')]=_[_0x3d94('0x38')](_0x50560c[_0x3d94('0x39')],_0x50560c['query']);_0x246f88[_0x3d94('0x3a')]=_[_0x3d94('0x38')](_0x50560c[_0x3d94('0x39')],qs[_0x3d94('0x3b')](_0x215ad7[_0x3d94('0x36')][_0x3d94('0x3b')]));_0x246f88['attributes']=_0x246f88['attributes'][_0x3d94('0x3c')]?_0x246f88[_0x3d94('0x3a')]:_0x50560c[_0x3d94('0x39')];if(!_0x215ad7[_0x3d94('0x36')][_0x3d94('0x3d')](_0x3d94('0x3e'))){_0x246f88[_0x3d94('0x20')]=qs[_0x3d94('0x20')](_0x215ad7[_0x3d94('0x36')][_0x3d94('0x20')]);_0x246f88['offset']=qs[_0x3d94('0x1e')](_0x215ad7[_0x3d94('0x36')][_0x3d94('0x1e')]);}_0x246f88[_0x3d94('0x3f')]=qs['sort'](_0x215ad7[_0x3d94('0x36')][_0x3d94('0x40')]);_0x246f88[_0x3d94('0x41')]=qs[_0x3d94('0x37')](_[_0x3d94('0x42')](_0x215ad7['query'],_0x50560c[_0x3d94('0x37')]),_0x51f634);if(_0x215ad7[_0x3d94('0x36')][_0x3d94('0x43')]){_0x246f88['where']=_['merge'](_0x246f88['where'],{'$or':_['map'](_0x51f634,function(_0x3b3550){if(_0x3b3550[_0x3d94('0x33')]!==_0x3d94('0x44')){var _0x146ccb={};_0x146ccb[_0x3b3550[_0x3d94('0x2e')]]={'$like':'%'+_0x215ad7[_0x3d94('0x36')][_0x3d94('0x43')]+'%'};return _0x146ccb;}})});}_0x246f88=_['merge']({},_0x246f88,_0x215ad7['options']);var _0x118fda={'where':_0x246f88[_0x3d94('0x41')]};return db['VoicePrefix'][_0x3d94('0x21')](_0x118fda)['then'](function(_0x1361fb){_0x18f854[_0x3d94('0x21')]=_0x1361fb;if(_0x215ad7[_0x3d94('0x36')][_0x3d94('0x45')]){_0x246f88[_0x3d94('0x46')]=[{'all':!![]}];}return db['VoicePrefix'][_0x3d94('0x47')](_0x246f88);})[_0x3d94('0x28')](function(_0x18a70c){_0x18f854['rows']=_0x18a70c;return _0x18f854;})[_0x3d94('0x28')](respondWithFilteredResult(_0x29b1ff,_0x246f88))['catch'](handleError(_0x29b1ff,null));};exports['show']=function(_0x3f4b32,_0x402132){var _0x6190cc={'raw':![],'where':{'id':_0x3f4b32['params']['id']}},_0xfeae3a={};_0xfeae3a[_0x3d94('0x39')]=_['keys'](db[_0x3d94('0x31')][_0x3d94('0x48')]);_0xfeae3a[_0x3d94('0x36')]=_[_0x3d94('0x35')](_0x3f4b32[_0x3d94('0x36')]);_0xfeae3a[_0x3d94('0x37')]=_[_0x3d94('0x38')](_0xfeae3a['model'],_0xfeae3a[_0x3d94('0x36')]);_0x6190cc[_0x3d94('0x3a')]=_['intersection'](_0xfeae3a['model'],qs[_0x3d94('0x3b')](_0x3f4b32[_0x3d94('0x36')]['fields']));_0x6190cc[_0x3d94('0x3a')]=_0x6190cc[_0x3d94('0x3a')][_0x3d94('0x3c')]?_0x6190cc[_0x3d94('0x3a')]:_0xfeae3a[_0x3d94('0x39')];if(_0x3f4b32[_0x3d94('0x36')][_0x3d94('0x45')]){_0x6190cc[_0x3d94('0x46')]=[{'all':!![]}];}_0x6190cc=_[_0x3d94('0x49')]({},_0x6190cc,_0x3f4b32[_0x3d94('0x4a')]);return db[_0x3d94('0x31')][_0x3d94('0x4b')](_0x6190cc)[_0x3d94('0x28')](handleEntityNotFound(_0x402132,null))[_0x3d94('0x28')](respondWithResult(_0x402132,null))[_0x3d94('0x4c')](handleError(_0x402132,null));};exports['destroy']=function(_0x44df82,_0x22e2b8){return db[_0x3d94('0x31')][_0x3d94('0x4b')]({'where':{'id':_0x44df82[_0x3d94('0x4d')]['id']}})[_0x3d94('0x28')](handleEntityNotFound(_0x22e2b8,null))[_0x3d94('0x28')](removeEntity(_0x22e2b8,null))[_0x3d94('0x4c')](handleError(_0x22e2b8,null));};exports[_0x3d94('0x4e')]=function(_0x5465a5,_0x88ec05){return db['VoicePrefix'][_0x3d94('0x4e')]()[_0x3d94('0x28')](respondWithResult(_0x88ec05,null))['catch'](handleError(_0x88ec05,null));};exports[_0x3d94('0x4f')]=function(_0x49f544,_0x567751){var _0x335247;return db['sequelize'][_0x3d94('0x50')](function(_0x132e0b){return db['VoicePrefix'][_0x3d94('0x4f')](_0x49f544['body'],{'transaction':_0x132e0b})['then'](function(_0x1a91d9){_0x335247=_0x1a91d9[_0x3d94('0x29')]({'plain':!![]});return db[_0x3d94('0x51')][_0x3d94('0x4b')]({'where':{'id':_0x335247[_0x3d94('0x52')]},'raw':!![]})[_0x3d94('0x28')](function(_0x137052){return createVoicePrefixExtensions(_0x335247,_0x137052,_0x132e0b);});});})[_0x3d94('0x28')](function(){var _0xae892=_0x49f544['user'][_0x3d94('0x29')]({'plain':!![]});if(!_0xae892)throw new Error(_0x3d94('0x53'));if(_0xae892[_0x3d94('0x54')]===_0x3d94('0x55')){var _0xe7d1dc=_0x335247;return db[_0x3d94('0x56')][_0x3d94('0x4b')]({'where':{'name':_0x3d94('0x2a'),'userProfileId':_0xae892[_0x3d94('0x57')]},'raw':!![]})[_0x3d94('0x28')](function(_0x1fd806){if(_0x1fd806&&_0x1fd806['autoAssociation']===0x0){return db[_0x3d94('0x2b')]['create']({'name':_0xe7d1dc[_0x3d94('0x2e')],'resourceId':_0xe7d1dc['id'],'type':_0x1fd806[_0x3d94('0x2e')],'sectionId':_0x1fd806['id']},{})[_0x3d94('0x28')](function(){return _0x335247;});}else{return _0x335247;}})[_0x3d94('0x4c')](function(_0x3a837b){logger[_0x3d94('0x2d')](_0x3d94('0x58'),_0x3a837b);throw _0x3a837b;});}return _0x335247;})[_0x3d94('0x28')](respondWithResult(_0x567751,null))[_0x3d94('0x4c')](handleError(_0x567751,null));};function Extension(_0x5da38c,_0x519ada,_0x46bff3,_0x4bd97c){this[_0x3d94('0x59')]=_0x3d94('0x5a');this['exten']=_0x5da38c;this[_0x3d94('0x5b')]=_0x46bff3;this[_0x3d94('0x33')]=_0x3d94('0x5c');this[_0x3d94('0x5d')]=_0x3d94('0x5e');this[_0x3d94('0x5f')]=_0x519ada;this[_0x3d94('0x60')]=_0x4bd97c;}function createVoicePrefixExtensions(_0x4b023e,_0x22dbf9,_0x351ea6){return new BPromise(function(_0x368581,_0x4b23b5){var _0x2d8b49=new Extension(formatPrefixName(_0x4b023e[_0x3d94('0x61')]),0x1,_0x3d94('0x62'),_0x3d94('0x63'));_0x2d8b49['VoicePrefixId']=_0x4b023e['id'];return db['VoiceExtension'][_0x3d94('0x4f')](_0x2d8b49,{'transaction':_0x351ea6})[_0x3d94('0x28')](function(_0x4190ef){var _0x3eaecc=_0x4190ef['get']({'plain':!![]});var _0x1c12da=_[_0x3d94('0x30')](addVoicePrefixExtensions(_0x4b023e,_0x22dbf9),function(_0x49bfb0){_0x49bfb0[_0x3d94('0x52')]=_0x3eaecc['id'];_0x49bfb0[_0x3d94('0x64')]=_0x4b023e['id'];return _0x49bfb0;});return db[_0x3d94('0x51')]['bulkCreate'](_0x1c12da,{'transaction':_0x351ea6})[_0x3d94('0x28')](function(_0x227372){if(!_0x227372){return _0x4b23b5(_0x3d94('0x65'));}else{return _0x368581(_0x227372);}})['catch'](function(_0x11eeaa){return _0x4b23b5(_0x11eeaa);});});;});};function addVoicePrefixExtensions(_0x68c033,_0x5c7aac){var _0x4d291e=[];var _0x4e1932=formatPrefixName(_0x68c033[_0x3d94('0x61')]);_0x4d291e[_0x3d94('0x66')](new Extension(_0x4e1932,0x2,_0x3d94('0x67'),_0x3d94('0x68')+_0x68c033[_0x3d94('0x2e')]));if(_0x68c033['callerIdAll']){_0x4d291e[_0x3d94('0x66')](new Extension(_0x4e1932,0x3,_0x3d94('0x67'),_0x3d94('0x69')+_0x68c033[_0x3d94('0x6a')]));}else{_0x4d291e[_0x3d94('0x66')](new Extension(_0x4e1932,0x3,_0x3d94('0x62'),'No\x20callerid\x20available'));}_0x4d291e[_0x3d94('0x66')](new Extension(_0x4e1932,0x4,'goto',_0x5c7aac[_0x3d94('0x59')]+','+_0x3d94('0x6b')+(0x8+_0x68c033[_0x3d94('0x2e')][_0x3d94('0x3c')])+'}'+','+0x1));return _0x4d291e;}function formatPrefixName(_0x128fdc){var _0x350ad3='_';for(var _0x48b108=0x0;_0x48b108<_0x128fdc['length'];_0x48b108++){if(_0x128fdc[_0x3d94('0x6c')](_0x48b108)=='-'){_0x350ad3+=_0x128fdc['charAt'](_0x48b108);}else{_0x350ad3+='['+_0x128fdc['charAt'](_0x48b108)+']';}}_0x350ad3+='.';return _0x350ad3;}exports['update']=function(_0x3c7dc4,_0x262a6a,_0x222963){var _0x396146=_0x3c7dc4[_0x3d94('0x6d')];_0x396146[_0x3d94('0x61')]=_0x3d94('0x6e')+_0x396146[_0x3d94('0x2e')]+'-';return db['sequelize'][_0x3d94('0x50')](function(_0x5e55a4){return db[_0x3d94('0x31')][_0x3d94('0x27')](_0x396146,{'where':{'id':_0x396146['id']},'transaction':_0x5e55a4})[_0x3d94('0x28')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x396146['id']},'transaction':_0x5e55a4})['then'](function(){return db[_0x3d94('0x51')][_0x3d94('0x4b')]({'where':{'id':_0x396146[_0x3d94('0x52')]},'raw':!![]})[_0x3d94('0x28')](function(_0x2382df){return createVoicePrefixExtensions(_0x396146,_0x2382df,_0x5e55a4);});});});})['then'](function(){return db['VoicePrefix'][_0x3d94('0x6f')](_0x396146['id']);})[_0x3d94('0x28')](respondWithResult(_0x262a6a,null))[_0x3d94('0x4c')](handleError(_0x262a6a,null));};exports['addAgents']=function(_0x46a9af,_0x53d471,_0x255d56){return db[_0x3d94('0x31')][_0x3d94('0x4b')]({'where':{'id':_0x46a9af[_0x3d94('0x4d')]['id']}})[_0x3d94('0x28')](handleEntityNotFound(_0x53d471,null))[_0x3d94('0x28')](function(_0x234bce){if(_0x234bce){return _0x234bce[_0x3d94('0x70')](_0x46a9af[_0x3d94('0x6d')][_0x3d94('0x71')],_[_0x3d94('0x72')](_0x46a9af[_0x3d94('0x6d')],[_0x3d94('0x71'),'id'])||{})['spread'](function(_0x2a6df3){for(var _0x2819e2=0x0;_0x2819e2<_0x46a9af[_0x3d94('0x6d')][_0x3d94('0x71')]['length'];_0x2819e2+=0x1){socket[_0x3d94('0x73')]('userVoicePrefix:save',{'UserId':Number(_0x46a9af['body'][_0x3d94('0x71')][_0x2819e2]),'VoicePrefixId':Number(_0x46a9af['params']['id'])});}return _0x2a6df3;});}})[_0x3d94('0x28')](respondWithResult(_0x53d471,null))[_0x3d94('0x4c')](handleError(_0x53d471,null));};exports['removeAgents']=function(_0x4558ff,_0x4acb44,_0x3b612f){return db[_0x3d94('0x31')]['find']({'where':{'id':_0x4558ff['params']['id']}})['then'](handleEntityNotFound(_0x4acb44,null))[_0x3d94('0x28')](function(_0x5b2dd6){if(_0x5b2dd6){return _0x5b2dd6['removeAgents'](_0x4558ff[_0x3d94('0x36')][_0x3d94('0x71')])[_0x3d94('0x28')](function(){if(_[_0x3d94('0x74')](_0x4558ff['query'][_0x3d94('0x71')])){for(var _0x3fc0e7=0x0;_0x3fc0e7<_0x4558ff[_0x3d94('0x36')][_0x3d94('0x71')][_0x3d94('0x3c')];_0x3fc0e7+=0x1){socket[_0x3d94('0x73')]('userVoicePrefix:remove',{'UserId':Number(_0x4558ff[_0x3d94('0x36')][_0x3d94('0x71')][_0x3fc0e7]),'VoicePrefixId':Number(_0x4558ff[_0x3d94('0x4d')]['id'])});}}else{socket[_0x3d94('0x73')](_0x3d94('0x75'),{'UserId':Number(_0x4558ff[_0x3d94('0x36')][_0x3d94('0x71')]),'VoicePrefixId':Number(_0x4558ff[_0x3d94('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x4acb44,null))['catch'](handleError(_0x4acb44,null));};exports[_0x3d94('0x76')]=function(_0x23b1a6,_0x970b44,_0x561e65){var _0x43a00e={};var _0xa193a1={};var _0x43192c;var _0xdb96c0;return db[_0x3d94('0x31')]['findOne']({'where':{'id':_0x23b1a6['params']['id']}})[_0x3d94('0x28')](handleEntityNotFound(_0x970b44,null))[_0x3d94('0x28')](function(_0x274a82){if(_0x274a82){_0x43192c=_0x274a82;_0xa193a1[_0x3d94('0x39')]=_[_0x3d94('0x35')](db[_0x3d94('0x77')][_0x3d94('0x48')]);_0xa193a1[_0x3d94('0x36')]=_[_0x3d94('0x35')](_0x23b1a6[_0x3d94('0x36')]);_0xa193a1[_0x3d94('0x37')]=_[_0x3d94('0x38')](_0xa193a1[_0x3d94('0x39')],_0xa193a1['query']);_0x43a00e[_0x3d94('0x3a')]=_[_0x3d94('0x38')](_0xa193a1['model'],qs['fields'](_0x23b1a6[_0x3d94('0x36')][_0x3d94('0x3b')]));_0x43a00e[_0x3d94('0x3a')]=_0x43a00e[_0x3d94('0x3a')]['length']?_0x43a00e['attributes']:_0xa193a1[_0x3d94('0x39')];_0x43a00e[_0x3d94('0x3f')]=qs[_0x3d94('0x40')](_0x23b1a6[_0x3d94('0x36')][_0x3d94('0x40')]);_0x43a00e['where']=qs[_0x3d94('0x37')](_['pick'](_0x23b1a6[_0x3d94('0x36')],_0xa193a1[_0x3d94('0x37')]));if(_0x23b1a6[_0x3d94('0x36')]['filter']){_0x43a00e[_0x3d94('0x41')]=_[_0x3d94('0x49')](_0x43a00e['where'],{'$or':_[_0x3d94('0x30')](_0x43a00e['attributes'],function(_0x3c62ec){var _0x401772={};_0x401772[_0x3c62ec]={'$like':'%'+_0x23b1a6[_0x3d94('0x36')]['filter']+'%'};return _0x401772;})});}_0x43a00e=_[_0x3d94('0x49')]({},_0x43a00e,_0x23b1a6[_0x3d94('0x4a')]);return _0x43192c[_0x3d94('0x76')](_0x43a00e);}})['then'](function(_0x3e091a){if(_0x3e091a){_0xdb96c0=_0x3e091a[_0x3d94('0x3c')];if(!_0x23b1a6[_0x3d94('0x36')][_0x3d94('0x3d')](_0x3d94('0x3e'))){_0x43a00e[_0x3d94('0x20')]=qs[_0x3d94('0x20')](_0x23b1a6[_0x3d94('0x36')]['limit']);_0x43a00e[_0x3d94('0x1e')]=qs[_0x3d94('0x1e')](_0x23b1a6[_0x3d94('0x36')][_0x3d94('0x1e')]);}return _0x43192c[_0x3d94('0x76')](_0x43a00e);}})[_0x3d94('0x28')](function(_0x5716fd){if(_0x5716fd){return _0x5716fd?{'count':_0xdb96c0,'rows':_0x5716fd}:null;}})[_0x3d94('0x28')](respondWithResult(_0x970b44,null))[_0x3d94('0x4c')](handleError(_0x970b44,null));};exports[_0x3d94('0x78')]=function(_0x59b62b,_0x3fc2f2,_0x4c6c49){var _0xe85875={};var _0x3ed74f={};var _0x490d77;var _0x73b09c;return db[_0x3d94('0x31')]['findOne']({'where':{'id':_0x59b62b['params']['id']}})[_0x3d94('0x28')](handleEntityNotFound(_0x3fc2f2,null))[_0x3d94('0x28')](function(_0x48a22f){if(_0x48a22f){_0x490d77=_0x48a22f;_0x3ed74f['model']=_['keys'](db[_0x3d94('0x79')][_0x3d94('0x48')]);_0x3ed74f[_0x3d94('0x36')]=_[_0x3d94('0x35')](_0x59b62b[_0x3d94('0x36')]);_0x3ed74f['filters']=_[_0x3d94('0x38')](_0x3ed74f[_0x3d94('0x39')],_0x3ed74f[_0x3d94('0x36')]);_0xe85875['attributes']=_[_0x3d94('0x38')](_0x3ed74f['model'],qs[_0x3d94('0x3b')](_0x59b62b[_0x3d94('0x36')][_0x3d94('0x3b')]));_0xe85875[_0x3d94('0x3a')]=_0xe85875[_0x3d94('0x3a')]['length']?_0xe85875['attributes']:_0x3ed74f[_0x3d94('0x39')];_0xe85875[_0x3d94('0x3f')]=qs['sort'](_0x59b62b[_0x3d94('0x36')]['sort']);_0xe85875[_0x3d94('0x41')]=qs[_0x3d94('0x37')](_[_0x3d94('0x42')](_0x59b62b['query'],_0x3ed74f[_0x3d94('0x37')]));if(_0x59b62b['query'][_0x3d94('0x43')]){_0xe85875[_0x3d94('0x41')]=_[_0x3d94('0x49')](_0xe85875[_0x3d94('0x41')],{'$or':_['map'](_0xe85875['attributes'],function(_0x11ff83){var _0x26e454={};_0x26e454[_0x11ff83]={'$like':'%'+_0x59b62b[_0x3d94('0x36')][_0x3d94('0x43')]+'%'};return _0x26e454;})});}_0xe85875=_['merge']({},_0xe85875,_0x59b62b[_0x3d94('0x4a')]);return _0x490d77['getTeams'](_0xe85875);}})['then'](function(_0x543b1a){if(_0x543b1a){_0x73b09c=_0x543b1a[_0x3d94('0x3c')];if(!_0x59b62b[_0x3d94('0x36')][_0x3d94('0x3d')](_0x3d94('0x3e'))){_0xe85875[_0x3d94('0x20')]=qs[_0x3d94('0x20')](_0x59b62b[_0x3d94('0x36')][_0x3d94('0x20')]);_0xe85875[_0x3d94('0x1e')]=qs[_0x3d94('0x1e')](_0x59b62b[_0x3d94('0x36')][_0x3d94('0x1e')]);}return _0x490d77[_0x3d94('0x78')](_0xe85875);}})[_0x3d94('0x28')](function(_0x140ad1){if(_0x140ad1){return _0x140ad1?{'count':_0x73b09c,'rows':_0x140ad1}:null;}})['then'](respondWithResult(_0x3fc2f2,null))['catch'](handleError(_0x3fc2f2,null));};exports[_0x3d94('0x7a')]=function(_0x3ff668,_0x1837c9,_0x41251d){var _0x876bcc=_0x3ff668[_0x3d94('0x6d')][_0x3d94('0x71')];var _0x47ab6a;return db[_0x3d94('0x79')][_0x3d94('0x47')]({'where':{'id':_0x876bcc},'attributes':['id'],'include':[{'model':db[_0x3d94('0x77')],'as':_0x3d94('0x7b'),'attributes':['id',_0x3d94('0x2e'),_0x3d94('0x7c'),'voicePause','interface'],'raw':!![]}]})[_0x3d94('0x28')](function(_0x50e8ba){if(_0x50e8ba){_0x47ab6a=_0x50e8ba;var _0x248fbe=_[_0x3d94('0x7d')](_0x50e8ba,function(_0x350751){var _0x16853d=_0x350751[_0x3d94('0x29')]({'plain':!![]});return _0x16853d[_0x3d94('0x7b')];});return db[_0x3d94('0x31')][_0x3d94('0x4b')]({'where':{'id':_0x3ff668['params']['id']}})[_0x3d94('0x28')](function(_0x2c8a2f){return db[_0x3d94('0x7e')][_0x3d94('0x50')](function(_0x22e7ff){return _0x2c8a2f[_0x3d94('0x7a')](_0x876bcc,{'transaction':_0x22e7ff})[_0x3d94('0x28')](function(){return BPromise[_0x3d94('0x7f')](_0x47ab6a,function(_0x1c7315){return db[_0x3d94('0x80')][_0x3d94('0x81')]({'TeamId':_0x1c7315['id'],'VoicePrefixId':_0x3ff668[_0x3d94('0x4d')]['id']},{'transaction':_0x22e7ff});});})[_0x3d94('0x28')](function(){return BPromise[_0x3d94('0x7f')](_0x248fbe,function(_0x2d02db){return db[_0x3d94('0x82')][_0x3d94('0x83')]({'where':{'UserId':_0x2d02db['id'],'VoicePrefixId':_0x3ff668[_0x3d94('0x4d')]['id']},'transaction':_0x22e7ff});});})[_0x3d94('0x28')](function(){_0x248fbe[_0x3d94('0x84')](function(_0xb55889){socket['emit'](_0x3d94('0x85'),{'UserId':_0xb55889['id'],'VoicePrefixId':_0x2c8a2f['id']});});});});});}})[_0x3d94('0x28')](respondWithStatusCode(_0x1837c9,null))[_0x3d94('0x4c')](handleError(_0x1837c9,null));};exports[_0x3d94('0x86')]=function(_0x434b19,_0x185592,_0x594800){return db[_0x3d94('0x79')][_0x3d94('0x47')]({'where':{'id':_0x434b19[_0x3d94('0x36')][_0x3d94('0x71')]},'attributes':['id'],'include':[{'model':db[_0x3d94('0x77')],'as':_0x3d94('0x7b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x185592,null))[_0x3d94('0x28')](function(_0x4ff1a0){var _0x577fd0=_['map'](_0x4ff1a0,'id');var _0x4a1faa=[];var _0x3e1139=[];var _0x77b79d=squel[_0x3d94('0x87')]();_0x77b79d[_0x3d94('0x88')](_0x3d94('0x89'))['from'](_0x3d94('0x8a'),'tq')[_0x3d94('0x8b')](_0x3d94('0x8c'),'ut',_0x3d94('0x8d'))[_0x3d94('0x41')](_0x3d94('0x8e'),_0x434b19['params']['id']);for(var _0x167d4c=0x0;_0x167d4c<_0x4ff1a0['length'];_0x167d4c+=0x1){let _0x219757=_0x4ff1a0[_0x167d4c];for(var _0xb970e1=0x0;_0xb970e1<_0x219757[_0x3d94('0x7b')][_0x3d94('0x3c')];_0xb970e1+=0x1){let _0x5df8b4=_0x219757[_0x3d94('0x7b')][_0xb970e1];var _0x2e409b=_0x77b79d[_0x3d94('0x8f')]();_0x2e409b[_0x3d94('0x41')]('ut.UserId\x20=\x20?',_0x5df8b4['id']);_0x3e1139['push'](db[_0x3d94('0x7e')][_0x3d94('0x36')](_0x2e409b[_0x3d94('0x90')](),{'type':db['sequelize'][_0x3d94('0x91')]['SELECT']})['then'](function(_0x560fdf){if(_0x560fdf[_0x3d94('0x3c')]===0x1){return _0x5df8b4['id'];}else{var _0x4ae177=_[_0x3d94('0x92')](_[_0x3d94('0x30')](_0x560fdf,_0x3d94('0x93')),function(_0x5ed8e8){return _[_0x3d94('0x94')](_0x577fd0,_0x5ed8e8);});if(_0x4ae177){return _0x5df8b4['id'];}}}));}}return BPromise[_0x3d94('0x95')](_0x3e1139)['then'](function(_0x551002){_0x4a1faa=_(_0x4a1faa)[_0x3d94('0x96')](_0x551002)[_0x3d94('0x97')]()[_0x3d94('0x98')]();return db[_0x3d94('0x31')][_0x3d94('0x4b')]({'where':{'id':_0x434b19[_0x3d94('0x4d')]['id']}})['then'](function(_0x54651a){return db['sequelize']['transaction'](function(_0x3c736a){return _0x54651a[_0x3d94('0x86')](_0x434b19[_0x3d94('0x36')][_0x3d94('0x71')],{'transaction':_0x3c736a})[_0x3d94('0x28')](function(){if(!_[_0x3d94('0x99')](_0x4a1faa)){return _0x54651a[_0x3d94('0x9a')](_0x4a1faa,{'transaction':_0x3c736a});}})[_0x3d94('0x28')](function(){_0x4a1faa[_0x3d94('0x84')](function(_0x414b82){socket[_0x3d94('0x73')]('userVoicePrefix:remove',{'UserId':_0x414b82,'VoicePrefixId':_0x54651a['id']});});});});});});})[_0x3d94('0x28')](respondWithStatusCode(_0x185592,null))['catch'](handleError(_0x185592,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 503cc93..2b77ead 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 _0x346d=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save','remove'];(function(_0x5df61d,_0x44ad6d){var _0x4f0aba=function(_0x24c244){while(--_0x24c244){_0x5df61d['push'](_0x5df61d['shift']());}};_0x4f0aba(++_0x44ad6d);}(_0x346d,0x19e));var _0xd346=function(_0x386b08,_0x5d49da){_0x386b08=_0x386b08-0x0;var _0x4b38ef=_0x346d[_0x386b08];return _0x4b38ef;};'use strict';var EventEmitter=require(_0xd346('0x0'));var VoicePrefix=require(_0xd346('0x1'))['db'][_0xd346('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xd346('0x3')](0x0);var events={'afterCreate':_0xd346('0x4'),'afterUpdate':'update','afterDestroy':_0xd346('0x5')};function emitEvent(_0xdc3630){return function(_0x14d67f,_0x324251,_0x350909){VoicePrefixEvents[_0xd346('0x6')](_0xdc3630+':'+_0x14d67f['id'],_0x14d67f);VoicePrefixEvents[_0xd346('0x6')](_0xdc3630,_0x14d67f);_0x350909(null);};}for(var e in events){if(events[_0xd346('0x7')](e)){var event=events[e];VoicePrefix[_0xd346('0x8')](e,emitEvent(event));}}module[_0xd346('0x9')]=VoicePrefixEvents; \ No newline at end of file +var _0x8cf7=['hasOwnProperty','hook','../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit'];(function(_0x19c25a,_0x19c81d){var _0x492bb5=function(_0x27f613){while(--_0x27f613){_0x19c25a['push'](_0x19c25a['shift']());}};_0x492bb5(++_0x19c81d);}(_0x8cf7,0x1b2));var _0x78cf=function(_0x21a923,_0x74d386){_0x21a923=_0x21a923-0x0;var _0x27d0b8=_0x8cf7[_0x21a923];return _0x27d0b8;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x78cf('0x0'))['db'][_0x78cf('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x78cf('0x2')](0x0);var events={'afterCreate':_0x78cf('0x3'),'afterUpdate':_0x78cf('0x4'),'afterDestroy':_0x78cf('0x5')};function emitEvent(_0x40713f){return function(_0x56282d,_0x42c316,_0x15e192){VoicePrefixEvents['emit'](_0x40713f+':'+_0x56282d['id'],_0x56282d);VoicePrefixEvents[_0x78cf('0x6')](_0x40713f,_0x56282d);_0x15e192(null);};}for(var e in events){if(events[_0x78cf('0x7')](e)){var event=events[e];VoicePrefix[_0x78cf('0x8')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index e29b146..7ced746 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 _0x0fa3=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes'];(function(_0x2b11de,_0x26af66){var _0x4050e4=function(_0x212823){while(--_0x212823){_0x2b11de['push'](_0x2b11de['shift']());}};_0x4050e4(++_0x26af66);}(_0x0fa3,0xa5));var _0x30fa=function(_0x338f73,_0x1945c8){_0x338f73=_0x338f73-0x0;var _0x163fdf=_0x0fa3[_0x338f73];return _0x163fdf;};'use strict';var _=require(_0x30fa('0x0'));var util=require(_0x30fa('0x1'));var logger=require(_0x30fa('0x2'))(_0x30fa('0x3'));var moment=require(_0x30fa('0x4'));var BPromise=require(_0x30fa('0x5'));var rp=require(_0x30fa('0x6'));var fs=require('fs');var path=require(_0x30fa('0x7'));var rimraf=require(_0x30fa('0x8'));var config=require(_0x30fa('0x9'));var attributes=require(_0x30fa('0xa'));module[_0x30fa('0xb')]=function(_0xe34e39,_0x2f02aa){return _0xe34e39[_0x30fa('0xc')](_0x30fa('0xd'),attributes,{'tableName':_0x30fa('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x04c4=['moment','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api'];(function(_0x40dd56,_0x726ca5){var _0x4f850f=function(_0x5f899e){while(--_0x5f899e){_0x40dd56['push'](_0x40dd56['shift']());}};_0x4f850f(++_0x726ca5);}(_0x04c4,0x71));var _0x404c=function(_0x27031e,_0x1eb8cd){_0x27031e=_0x27031e-0x0;var _0xfd46b3=_0x04c4[_0x27031e];return _0xfd46b3;};'use strict';var _=require(_0x404c('0x0'));var util=require(_0x404c('0x1'));var logger=require(_0x404c('0x2'))(_0x404c('0x3'));var moment=require(_0x404c('0x4'));var BPromise=require('bluebird');var rp=require(_0x404c('0x5'));var fs=require('fs');var path=require(_0x404c('0x6'));var rimraf=require(_0x404c('0x7'));var config=require(_0x404c('0x8'));var attributes=require(_0x404c('0x9'));module['exports']=function(_0x2cdba2,_0x40b94a){return _0x2cdba2[_0x404c('0xa')](_0x404c('0xb'),attributes,{'tableName':_0x404c('0xc'),'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 05bd82c..9a5e16d 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 _0x6931=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0x6931,0x1a9));var _0x1693=function(_0x510ba4,_0x3115e3){_0x510ba4=_0x510ba4-0x0;var _0x46f37c=_0x6931[_0x510ba4];return _0x46f37c;};'use strict';var _=require(_0x1693('0x0'));var util=require(_0x1693('0x1'));var moment=require(_0x1693('0x2'));var BPromise=require(_0x1693('0x3'));var rs=require(_0x1693('0x4'));var fs=require('fs');var Redis=require(_0x1693('0x5'));var db=require(_0x1693('0x6'))['db'];var utils=require(_0x1693('0x7'));var logger=require('../../config/logger')(_0x1693('0x8'));var config=require(_0x1693('0x9'));var jayson=require(_0x1693('0xa'));var client=jayson[_0x1693('0xb')][_0x1693('0xc')]({'port':0x232a});config['redis']=_[_0x1693('0xd')](config[_0x1693('0xe')],{'host':_0x1693('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1693('0xe')]));require(_0x1693('0x10'))[_0x1693('0x11')](socket);function respondWithRpcPromise(_0x141ea9,_0x2af3d1,_0x181184){return new BPromise(function(_0x26ba4b,_0x3807dd){return client[_0x1693('0x12')](_0x141ea9,_0x181184)[_0x1693('0x13')](function(_0x1ba755){logger['info'](_0x1693('0x14'),_0x2af3d1,_0x1693('0x15'));logger[_0x1693('0x16')](_0x1693('0x17'),_0x2af3d1,_0x1693('0x15'),JSON[_0x1693('0x18')](_0x1ba755));if(_0x1ba755[_0x1693('0x19')]){if(_0x1ba755['error'][_0x1693('0x1a')]===0x1f4){logger['error'](_0x1693('0x14'),_0x2af3d1,_0x1ba755['error'][_0x1693('0x1b')]);return _0x3807dd(_0x1ba755[_0x1693('0x19')]['message']);}logger['error'](_0x1693('0x14'),_0x2af3d1,_0x1ba755['error']['message']);return _0x26ba4b(_0x1ba755['error'][_0x1693('0x1b')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x2af3d1,_0x1693('0x15'));_0x26ba4b(_0x1ba755[_0x1693('0x1c')][_0x1693('0x1b')]);}})[_0x1693('0x1d')](function(_0x28edfe){logger[_0x1693('0x19')]('VoicePrefix,\x20%s,\x20%s',_0x2af3d1,_0x28edfe);_0x3807dd(_0x28edfe);});});} \ No newline at end of file +var _0xb1ad=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x28115f,_0x46c682){var _0x493e82=function(_0xcfbdf6){while(--_0xcfbdf6){_0x28115f['push'](_0x28115f['shift']());}};_0x493e82(++_0x46c682);}(_0xb1ad,0x184));var _0xdb1a=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0xb1ad[_0x55abd9];return _0x3e5669;};'use strict';var _=require(_0xdb1a('0x0'));var util=require(_0xdb1a('0x1'));var moment=require(_0xdb1a('0x2'));var BPromise=require(_0xdb1a('0x3'));var rs=require(_0xdb1a('0x4'));var fs=require('fs');var Redis=require(_0xdb1a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdb1a('0x6'));var logger=require(_0xdb1a('0x7'))(_0xdb1a('0x8'));var config=require(_0xdb1a('0x9'));var jayson=require(_0xdb1a('0xa'));var client=jayson[_0xdb1a('0xb')][_0xdb1a('0xc')]({'port':0x232a});config[_0xdb1a('0xd')]=_[_0xdb1a('0xe')](config[_0xdb1a('0xd')],{'host':_0xdb1a('0xf'),'port':0x18eb});var socket=require(_0xdb1a('0x10'))(new Redis(config[_0xdb1a('0xd')]));require(_0xdb1a('0x11'))[_0xdb1a('0x12')](socket);function respondWithRpcPromise(_0x5f0ae1,_0x25dbbc,_0x11b5ae){return new BPromise(function(_0x5a36cf,_0x5e3bcd){return client['request'](_0x5f0ae1,_0x11b5ae)[_0xdb1a('0x13')](function(_0x412750){logger[_0xdb1a('0x14')](_0xdb1a('0x15'),_0x25dbbc,_0xdb1a('0x16'));logger[_0xdb1a('0x17')](_0xdb1a('0x18'),_0x25dbbc,_0xdb1a('0x16'),JSON[_0xdb1a('0x19')](_0x412750));if(_0x412750[_0xdb1a('0x1a')]){if(_0x412750[_0xdb1a('0x1a')][_0xdb1a('0x1b')]===0x1f4){logger[_0xdb1a('0x1a')]('VoicePrefix,\x20%s,\x20%s',_0x25dbbc,_0x412750[_0xdb1a('0x1a')][_0xdb1a('0x1c')]);return _0x5e3bcd(_0x412750[_0xdb1a('0x1a')]['message']);}logger[_0xdb1a('0x1a')]('VoicePrefix,\x20%s,\x20%s',_0x25dbbc,_0x412750[_0xdb1a('0x1a')][_0xdb1a('0x1c')]);return _0x5a36cf(_0x412750[_0xdb1a('0x1a')]['message']);}else{logger[_0xdb1a('0x14')](_0xdb1a('0x15'),_0x25dbbc,_0xdb1a('0x16'));_0x5a36cf(_0x412750['result'][_0xdb1a('0x1c')]);}})[_0xdb1a('0x1d')](function(_0x192d45){logger[_0xdb1a('0x1a')](_0xdb1a('0x15'),_0x25dbbc,_0x192d45);_0x5e3bcd(_0x192d45);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 7b8029b..35dc5fd 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 _0xc125=['register','save','update','emit','removeListener'];(function(_0x2d5e9c,_0x47623d){var _0x475b9a=function(_0x243682){while(--_0x243682){_0x2d5e9c['push'](_0x2d5e9c['shift']());}};_0x475b9a(++_0x47623d);}(_0xc125,0x150));var _0x5c12=function(_0x14cc30,_0xd574b){_0x14cc30=_0x14cc30-0x0;var _0x3ad39c=_0xc125[_0x14cc30];return _0x3ad39c;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x5c12('0x0'),'remove',_0x5c12('0x1')];function createListener(_0x44b9de,_0x2b4f53){return function(_0x2423dc){_0x2b4f53[_0x5c12('0x2')](_0x44b9de,_0x2423dc);};}function removeListener(_0x46f293,_0x31bd53){return function(){VoicePrefixEvents[_0x5c12('0x3')](_0x46f293,_0x31bd53);};}exports[_0x5c12('0x4')]=function(_0x3f1c8b){for(var _0x1a1608=0x0,_0x11ace0=events['length'];_0x1a1608<_0x11ace0;_0x1a1608++){var _0x1d0635=events[_0x1a1608];var _0x4465e3=createListener('voicePrefix:'+_0x1d0635,_0x3f1c8b);VoicePrefixEvents['on'](_0x1d0635,_0x4465e3);}}; \ No newline at end of file +var _0x9cff=['save','remove','update','emit','removeListener','register','length','voicePrefix:'];(function(_0x2c333d,_0x589ac8){var _0x5da993=function(_0x489acd){while(--_0x489acd){_0x2c333d['push'](_0x2c333d['shift']());}};_0x5da993(++_0x589ac8);}(_0x9cff,0x1b0));var _0xf9cf=function(_0x415590,_0x3404cb){_0x415590=_0x415590-0x0;var _0x1203bd=_0x9cff[_0x415590];return _0x1203bd;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xf9cf('0x0'),_0xf9cf('0x1'),_0xf9cf('0x2')];function createListener(_0x55364a,_0x197da2){return function(_0x142fc6){_0x197da2[_0xf9cf('0x3')](_0x55364a,_0x142fc6);};}function removeListener(_0x5060e0,_0x2da91){return function(){VoicePrefixEvents[_0xf9cf('0x4')](_0x5060e0,_0x2da91);};}exports[_0xf9cf('0x5')]=function(_0x183113){for(var _0xcacbdc=0x0,_0x27e2b1=events[_0xf9cf('0x6')];_0xcacbdc<_0x27e2b1;_0xcacbdc++){var _0x19d7f9=events[_0xcacbdc];var _0x1c29f6=createListener(_0xf9cf('0x7')+_0x19d7f9,_0x183113);VoicePrefixEvents['on'](_0x19d7f9,_0x1c29f6);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 210d700..c682fb8 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 _0xd02e=['addAgents','addBlackLists','put','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','getAgents','/:id/members','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','clone','/:id/users'];(function(_0x4a120c,_0x30b07b){var _0x25bd6e=function(_0x3d566c){while(--_0x3d566c){_0x4a120c['push'](_0x4a120c['shift']());}};_0x25bd6e(++_0x30b07b);}(_0xd02e,0xd1));var _0xed02=function(_0x394be7,_0x249850){_0x394be7=_0x394be7-0x0;var _0x4e9e86=_0xd02e[_0x394be7];return _0x4e9e86;};'use strict';var multer=require(_0xed02('0x0'));var util=require(_0xed02('0x1'));var path=require(_0xed02('0x2'));var timeout=require(_0xed02('0x3'));var express=require(_0xed02('0x4'));var router=express[_0xed02('0x5')]();var fs_extra=require(_0xed02('0x6'));var auth=require(_0xed02('0x7'));var interaction=require(_0xed02('0x8'));var config=require(_0xed02('0x9'));var controller=require('./voiceQueue.controller');router['get']('/',auth[_0xed02('0xa')](),controller['index']);router[_0xed02('0xb')](_0xed02('0xc'),auth[_0xed02('0xa')](),controller[_0xed02('0xd')]);router[_0xed02('0xb')]('/:id/hoppers',auth[_0xed02('0xa')](),controller['getHoppers']);router['get']('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0xed02('0xe')]);router[_0xed02('0xb')](_0xed02('0xf'),auth['isAuthenticated'](),controller[_0xed02('0x10')]);router['get'](_0xed02('0x11'),auth[_0xed02('0xa')](),controller[_0xed02('0x12')]);router[_0xed02('0xb')](_0xed02('0x13'),auth[_0xed02('0xa')](),controller[_0xed02('0x14')]);router[_0xed02('0xb')]('/:id/users',auth[_0xed02('0xa')](),controller[_0xed02('0x15')]);router[_0xed02('0xb')](_0xed02('0x16'),auth[_0xed02('0xa')](),controller['getMembers']);router['get'](_0xed02('0x17'),auth['isAuthenticated'](),controller[_0xed02('0x18')]);router[_0xed02('0xb')](_0xed02('0x19'),auth[_0xed02('0xa')](),controller['getBlackLists']);router[_0xed02('0x1a')]('/',auth[_0xed02('0xa')](),controller[_0xed02('0x1b')]);router[_0xed02('0x1a')](_0xed02('0x1c'),auth['isAuthenticated'](),controller[_0xed02('0x1d')]);router[_0xed02('0x1a')](_0xed02('0x13'),auth[_0xed02('0xa')](),controller['addTeams']);router['post'](_0xed02('0x1e'),auth[_0xed02('0xa')](),controller[_0xed02('0x1f')]);router['post']('/:id/lists',auth[_0xed02('0xa')](),controller['addLists']);router['post'](_0xed02('0x19'),auth[_0xed02('0xa')](),controller[_0xed02('0x20')]);router[_0xed02('0x21')](_0xed02('0xc'),auth[_0xed02('0xa')](),controller[_0xed02('0x22')]);router[_0xed02('0x23')](_0xed02('0xc'),auth[_0xed02('0xa')](),controller['destroy']);router['delete'](_0xed02('0x13'),auth['isAuthenticated'](),controller[_0xed02('0x24')]);router[_0xed02('0x23')](_0xed02('0x1e'),auth[_0xed02('0xa')](),controller[_0xed02('0x25')]);router[_0xed02('0x23')](_0xed02('0x17'),auth[_0xed02('0xa')](),controller[_0xed02('0x26')]);router['delete'](_0xed02('0x19'),auth[_0xed02('0xa')](),controller[_0xed02('0x27')]);module['exports']=router; \ No newline at end of file +var _0xe941=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','getAgents','/:id/members','/:id/lists','/:id/blacklists','post','/:id/clone','clone','addTeams','/:id/users','addAgents','addBlackLists','update','destroy','delete','removeTeams','removeAgents','removeBlackLists'];(function(_0x151667,_0x373331){var _0x4cbaff=function(_0x116293){while(--_0x116293){_0x151667['push'](_0x151667['shift']());}};_0x4cbaff(++_0x373331);}(_0xe941,0xa9));var _0x1e94=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xe941[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0x1e94('0x0'));var util=require(_0x1e94('0x1'));var path=require(_0x1e94('0x2'));var timeout=require(_0x1e94('0x3'));var express=require(_0x1e94('0x4'));var router=express[_0x1e94('0x5')]();var fs_extra=require(_0x1e94('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1e94('0x7'));var config=require(_0x1e94('0x8'));var controller=require(_0x1e94('0x9'));router[_0x1e94('0xa')]('/',auth[_0x1e94('0xb')](),controller[_0x1e94('0xc')]);router[_0x1e94('0xa')](_0x1e94('0xd'),auth[_0x1e94('0xb')](),controller[_0x1e94('0xe')]);router['get'](_0x1e94('0xf'),auth[_0x1e94('0xb')](),controller[_0x1e94('0x10')]);router['get'](_0x1e94('0x11'),auth[_0x1e94('0xb')](),controller[_0x1e94('0x12')]);router[_0x1e94('0xa')]('/:id/hopper_finals',auth[_0x1e94('0xb')](),controller[_0x1e94('0x13')]);router[_0x1e94('0xa')](_0x1e94('0x14'),auth['isAuthenticated'](),controller[_0x1e94('0x15')]);router[_0x1e94('0xa')](_0x1e94('0x16'),auth['isAuthenticated'](),controller[_0x1e94('0x17')]);router[_0x1e94('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0x1e94('0x18')]);router[_0x1e94('0xa')](_0x1e94('0x19'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0x1e94('0x1a'),auth[_0x1e94('0xb')](),controller['getLists']);router[_0x1e94('0xa')](_0x1e94('0x1b'),auth[_0x1e94('0xb')](),controller['getBlackLists']);router[_0x1e94('0x1c')]('/',auth[_0x1e94('0xb')](),controller['create']);router['post'](_0x1e94('0x1d'),auth[_0x1e94('0xb')](),controller[_0x1e94('0x1e')]);router[_0x1e94('0x1c')](_0x1e94('0x16'),auth[_0x1e94('0xb')](),controller[_0x1e94('0x1f')]);router[_0x1e94('0x1c')](_0x1e94('0x20'),auth['isAuthenticated'](),controller[_0x1e94('0x21')]);router['post'](_0x1e94('0x1a'),auth[_0x1e94('0xb')](),controller['addLists']);router[_0x1e94('0x1c')](_0x1e94('0x1b'),auth[_0x1e94('0xb')](),controller[_0x1e94('0x22')]);router['put'](_0x1e94('0xd'),auth['isAuthenticated'](),controller[_0x1e94('0x23')]);router['delete'](_0x1e94('0xd'),auth['isAuthenticated'](),controller[_0x1e94('0x24')]);router[_0x1e94('0x25')](_0x1e94('0x16'),auth[_0x1e94('0xb')](),controller[_0x1e94('0x26')]);router[_0x1e94('0x25')](_0x1e94('0x20'),auth[_0x1e94('0xb')](),controller[_0x1e94('0x27')]);router['delete'](_0x1e94('0x1a'),auth['isAuthenticated'](),controller['removeLists']);router['delete'](_0x1e94('0x1b'),auth[_0x1e94('0xb')](),controller[_0x1e94('0x28')]);module[_0x1e94('0x29')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index a45f84a..4d62edc 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 _0x88ff=['#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#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)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','ringall','leastrecent','fewestcalls','random','rrmemory','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','booked','progressive','predictive','INTEGER','yes','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','power','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence'];(function(_0x1016d0,_0xe93f77){var _0x398fad=function(_0x40e01d){while(--_0x40e01d){_0x1016d0['push'](_0x1016d0['shift']());}};_0x398fad(++_0xe93f77);}(_0x88ff,0x196));var _0xf88f=function(_0x3c5a7c,_0x892e91){_0x3c5a7c=_0x3c5a7c-0x0;var _0x4d1219=_0x88ff[_0x3c5a7c];return _0x4d1219;};'use strict';var Sequelize=require(_0xf88f('0x0'));module[_0xf88f('0x1')]={'name':{'type':Sequelize[_0xf88f('0x2')],'allowNull':![],'unique':_0xf88f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xf88f('0x4')](_0xf88f('0x5'),'outbound'),'allowNull':![],'defaultValue':_0xf88f('0x5')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':'default'},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0xf88f('0x4')]('rr',_0xf88f('0x6'),_0xf88f('0x7'),_0xf88f('0x8'),_0xf88f('0x9'),_0xf88f('0xa'),'linear','wrandom',_0xf88f('0xb')),'allowNull':![],'defaultValue':'ringall','set':function(_0x1e52b0){this[_0xf88f('0xc')](_0xf88f('0xd'),_0x1e52b0?_0x1e52b0:'rrmemory');},'get':function(){var _0x5d5b08=this[_0xf88f('0xe')](_0xf88f('0xf'));var _0x56ae80=this[_0xf88f('0xe')](_0xf88f('0x10'));var _0x12dfcc=this[_0xf88f('0xe')](_0xf88f('0xd'));if(_0x5d5b08===_0xf88f('0x5')){return _0x12dfcc;}if(_0x56ae80===_0xf88f('0x11')&&_0x12dfcc===_0xf88f('0xa')||_0x56ae80==='booked'&&_0x12dfcc==='roundrobin'){return _0x12dfcc;}if(_0x56ae80===_0xf88f('0x12')||_0x56ae80===_0xf88f('0x13')||_0x56ae80==='power'){return _0x12dfcc;}return null;}},'servicelevel':{'type':Sequelize[_0xf88f('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xf88f('0x14')](0xb)},'timeout':{'type':Sequelize[_0xf88f('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xf88f('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xf88f('0x2')]},'weight':{'type':Sequelize[_0xf88f('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xf88f('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xf88f('0x4')]('yes','no'),'defaultValue':_0xf88f('0x15')},'autopause':{'type':Sequelize[_0xf88f('0x4')](_0xf88f('0x15'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xf88f('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0xf88f('0x4')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xf88f('0x4')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xf88f('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0xf88f('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xf88f('0x4')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xf88f('0x4')](_0xf88f('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xf88f('0x4')](_0xf88f('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xf88f('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xf88f('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xf88f('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xf88f('0x4')](_0xf88f('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xf88f('0x4')](_0xf88f('0x15'),'no'),'defaultValue':_0xf88f('0x15')},'announce_holdtime':{'type':Sequelize[_0xf88f('0x4')](_0xf88f('0x15'),'no',_0xf88f('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xf88f('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0xf88f('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0xf88f('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xf88f('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xf88f('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xf88f('0x2')]},'queue_youarenext':{'type':Sequelize[_0xf88f('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xf88f('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xf88f('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xf88f('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xf88f('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xf88f('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xf88f('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xf88f('0x2')]},'queue_quantity1':{'type':Sequelize[_0xf88f('0x2')]},'queue_quantity2':{'type':Sequelize[_0xf88f('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0xf88f('0x2')]},'periodic_announce':{'type':Sequelize[_0xf88f('0x17')],'set':function(_0x346a98){this['setDataValue'](_0xf88f('0x18'),_0x346a98?_0x346a98[_0xf88f('0x19')](','):[]);},'get':function(){return this[_0xf88f('0xe')](_0xf88f('0x18'))?this[_0xf88f('0xe')](_0xf88f('0x18'))[_0xf88f('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0xf88f('0x2')],'defaultValue':'yes','set':function(_0x3d4ea3){this[_0xf88f('0xc')](_0xf88f('0x1b'),_0x3d4ea3?_0x3d4ea3[_0xf88f('0x19')](','):undefined);},'get':function(){return this[_0xf88f('0xe')]('joinempty')?this[_0xf88f('0xe')](_0xf88f('0x1b'))[_0xf88f('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xf88f('0x2')],'defaultValue':'no','set':function(_0x115332){this[_0xf88f('0xc')](_0xf88f('0x1c'),_0x115332?_0x115332['join'](','):undefined);},'get':function(){return this[_0xf88f('0xe')]('leavewhenempty')?this[_0xf88f('0xe')](_0xf88f('0x1c'))[_0xf88f('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xf88f('0x4')](_0xf88f('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xf88f('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0xf88f('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xf88f('0x2')]},'description':{'type':Sequelize[_0xf88f('0x2')]},'acw':{'type':Sequelize[_0xf88f('0x1d')],'defaultValue':0x0,'set':function(_0x2b741d){this[_0xf88f('0xc')]('acw',_0x2b741d);if(_0x2b741d){if(this['getDataValue'](_0xf88f('0x1e'))<0x2){this[_0xf88f('0xc')](_0xf88f('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xf88f('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xf88f('0x1d')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0xf88f('0x4')]('preview',_0xf88f('0x12'),_0xf88f('0x1f'),_0xf88f('0x13'),_0xf88f('0x11')),'defaultValue':_0xf88f('0x12'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0xf88f('0x14')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xf88f('0x20')},'dialLimitQueue':{'type':Sequelize[_0xf88f('0x14')](0x4)[_0xf88f('0x21')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xf88f('0x22')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xf88f('0x21')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xf88f('0x23')},'dialPredictiveOptimization':{'type':Sequelize['ENUM']('agentBusyFactor',_0xf88f('0x24')),'defaultValue':_0xf88f('0x24'),'comment':_0xf88f('0x25')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xf88f('0x26')](0x2)[_0xf88f('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xf88f('0x27')},'dialPredictiveInterval':{'type':Sequelize[_0xf88f('0x14')](0x3)[_0xf88f('0x21')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xf88f('0x28')},'dialOriginateCallerIdName':{'type':Sequelize[_0xf88f('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xf88f('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xf88f('0x14')](0x3)[_0xf88f('0x21')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0xf88f('0x2')],'defaultValue':_0xf88f('0x29'),'comment':_0xf88f('0x2a')},'dialQueueTimeout':{'type':Sequelize[_0xf88f('0x14')](0x3)[_0xf88f('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf88f('0x2b')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0xf88f('0x2c')},'dialCongestionMaxRetry':{'type':Sequelize[_0xf88f('0x14')](0x3)[_0xf88f('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xf88f('0x14')](0x5)[_0xf88f('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf88f('0x2d')},'dialBusyMaxRetry':{'type':Sequelize[_0xf88f('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf88f('0x2e')},'dialBusyRetryFrequency':{'type':Sequelize[_0xf88f('0x14')](0x5)[_0xf88f('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xf88f('0x14')](0x3)[_0xf88f('0x21')],'defaultValue':0x3,'comment':_0xf88f('0x2f')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xf88f('0x14')](0x5)[_0xf88f('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xf88f('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xf88f('0x2')],'defaultValue':_0xf88f('0x30')},'dialPrefix':{'type':Sequelize[_0xf88f('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always',_0xf88f('0x31'),_0xf88f('0x32')),'defaultValue':_0xf88f('0x33')},'dialAMDActive':{'type':Sequelize[_0xf88f('0x1d')],'defaultValue':0x0,'comment':_0xf88f('0x34')},'dialAMDInitialSilence':{'type':Sequelize[_0xf88f('0x14')](0x9)[_0xf88f('0x21')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xf88f('0x35')},'dialAMDGreeting':{'type':Sequelize[_0xf88f('0x14')](0x9)[_0xf88f('0x21')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xf88f('0x36')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xf88f('0x14')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xf88f('0x37')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xf88f('0x21')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf88f('0x38')},'dialAMDMinWordLength':{'type':Sequelize[_0xf88f('0x14')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xf88f('0x39')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xf88f('0x14')](0x9)[_0xf88f('0x21')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xf88f('0x3a')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xf88f('0x21')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xf88f('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xf88f('0x21')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf88f('0x3c')},'dialRecallMeTimeout':{'type':Sequelize[_0xf88f('0x14')](0x5)[_0xf88f('0x21')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xf88f('0x3d')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xf88f('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize[_0xf88f('0x4')]('DESC',_0xf88f('0x3f')),'defaultValue':_0xf88f('0x40')},'dialQueueProject2':{'type':Sequelize[_0xf88f('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0xf88f('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xf88f('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xf88f('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf88f('0x41')},'dialCutDigit':{'type':Sequelize[_0xf88f('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xf88f('0x14')](0x3)[_0xf88f('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf88f('0x42')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xf88f('0x14')](0x5)[_0xf88f('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf88f('0x43')},'dialDropMaxRetry':{'type':Sequelize[_0xf88f('0x14')](0x3)[_0xf88f('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf88f('0x44')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf88f('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf88f('0x45')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xf88f('0x14')](0x3)[_0xf88f('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xf88f('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf88f('0x46')},'dialMachineMaxRetry':{'type':Sequelize[_0xf88f('0x14')](0x3)[_0xf88f('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf88f('0x47')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf88f('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xf88f('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf88f('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xf88f('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf88f('0x49')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf88f('0x14')],'allowNull':!![],'comment':_0xf88f('0x4a')},'mandatoryDisposition':{'type':Sequelize[_0xf88f('0x1d')],'defaultValue':![],'comment':_0xf88f('0x4b'),'set':function(_0x54ca85){if(!_0x54ca85)this[_0xf88f('0xc')]('mandatoryDispositionPauseId',null);this[_0xf88f('0xc')](_0xf88f('0x4c'),_0x54ca85);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xf88f('0x14')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xf88f('0x14')](0x3)[_0xf88f('0x21')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0x4677=['Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\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','mandatoryDisposition','sequelize','STRING','name','ENUM','outbound','inbound','default','ringall','leastrecent','fewestcalls','linear','wrandom','strategy','getDataValue','type','dialMethod','rrmemory','booked','roundrobin','progressive','power','INTEGER','yes','all','once','setDataValue','periodic_announce','split','joinempty','join','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','predictive','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','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)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'];(function(_0x233e1f,_0x179c9f){var _0x2d7b25=function(_0x15d1d6){while(--_0x15d1d6){_0x233e1f['push'](_0x233e1f['shift']());}};_0x2d7b25(++_0x179c9f);}(_0x4677,0x155));var _0x7467=function(_0x333038,_0x254ca7){_0x333038=_0x333038-0x0;var _0x55fbab=_0x4677[_0x333038];return _0x55fbab;};'use strict';var Sequelize=require(_0x7467('0x0'));module['exports']={'name':{'type':Sequelize[_0x7467('0x1')],'allowNull':![],'unique':_0x7467('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7467('0x3')]('inbound',_0x7467('0x4')),'allowNull':![],'defaultValue':_0x7467('0x5')},'musiconhold':{'type':Sequelize[_0x7467('0x1')],'defaultValue':_0x7467('0x6')},'announce':{'type':Sequelize[_0x7467('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x7467('0x3')]('rr',_0x7467('0x7'),_0x7467('0x8'),_0x7467('0x9'),'random','rrmemory',_0x7467('0xa'),_0x7467('0xb'),'rrordered'),'allowNull':![],'defaultValue':_0x7467('0x7'),'set':function(_0x4365e6){this['setDataValue'](_0x7467('0xc'),_0x4365e6?_0x4365e6:'rrmemory');},'get':function(){var _0x334abf=this[_0x7467('0xd')](_0x7467('0xe'));var _0x4d06f7=this[_0x7467('0xd')](_0x7467('0xf'));var _0x221ad5=this[_0x7467('0xd')]('strategy');if(_0x334abf===_0x7467('0x5')){return _0x221ad5;}if(_0x4d06f7==='booked'&&_0x221ad5===_0x7467('0x10')||_0x4d06f7===_0x7467('0x11')&&_0x221ad5===_0x7467('0x12')){return _0x221ad5;}if(_0x4d06f7===_0x7467('0x13')||_0x4d06f7==='predictive'||_0x4d06f7===_0x7467('0x14')){return _0x221ad5;}return null;}},'servicelevel':{'type':Sequelize[_0x7467('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x7467('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x7467('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x7467('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x7467('0x1')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x7467('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x7467('0x3')](_0x7467('0x16'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x7467('0x3')]('yes','no',_0x7467('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x7467('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0x7467('0x3')](_0x7467('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x7467('0x3')](_0x7467('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x7467('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x7467('0x3')](_0x7467('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x7467('0x3')](_0x7467('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x7467('0x3')](_0x7467('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x7467('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x7467('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x7467('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x7467('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x7467('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x7467('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x7467('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x7467('0x16'),'no'),'defaultValue':_0x7467('0x16')},'announce_holdtime':{'type':Sequelize[_0x7467('0x3')](_0x7467('0x16'),'no',_0x7467('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x7467('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x7467('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0x7467('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x7467('0x1')]},'queue_youarenext':{'type':Sequelize[_0x7467('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x7467('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x7467('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x7467('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x7467('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x7467('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x7467('0x1')]},'queue_quantity1':{'type':Sequelize[_0x7467('0x1')]},'queue_quantity2':{'type':Sequelize[_0x7467('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x7467('0x1')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x5706e5){this[_0x7467('0x19')](_0x7467('0x1a'),_0x5706e5?_0x5706e5['join'](','):[]);},'get':function(){return this[_0x7467('0xd')](_0x7467('0x1a'))?this[_0x7467('0xd')](_0x7467('0x1a'))[_0x7467('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0x7467('0x1')],'defaultValue':'yes','set':function(_0x23a0e6){this[_0x7467('0x19')](_0x7467('0x1c'),_0x23a0e6?_0x23a0e6['join'](','):undefined);},'get':function(){return this[_0x7467('0xd')](_0x7467('0x1c'))?this[_0x7467('0xd')](_0x7467('0x1c'))[_0x7467('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x7467('0x1')],'defaultValue':'no','set':function(_0x3b36dc){this[_0x7467('0x19')]('leavewhenempty',_0x3b36dc?_0x3b36dc[_0x7467('0x1d')](','):undefined);},'get':function(){return this[_0x7467('0xd')](_0x7467('0x1e'))?this[_0x7467('0xd')](_0x7467('0x1e'))[_0x7467('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x7467('0x3')](_0x7467('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x7467('0x3')](_0x7467('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x7467('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x7467('0x3')](_0x7467('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x7467('0x1')]},'description':{'type':Sequelize[_0x7467('0x1')]},'acw':{'type':Sequelize[_0x7467('0x1f')],'defaultValue':0x0,'set':function(_0x369c9f){this[_0x7467('0x19')](_0x7467('0x20'),_0x369c9f);if(_0x369c9f){if(this['getDataValue'](_0x7467('0x21'))<0x2){this['setDataValue'](_0x7467('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x7467('0x1f')],'defaultValue':0x0,'comment':_0x7467('0x22')},'dialMethod':{'type':Sequelize['ENUM']('preview',_0x7467('0x13'),_0x7467('0x14'),_0x7467('0x23'),_0x7467('0x11')),'defaultValue':_0x7467('0x13'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x7467('0x15')](0x4)[_0x7467('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x7467('0x25')},'dialLimitQueue':{'type':Sequelize[_0x7467('0x15')](0x4)[_0x7467('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x7467('0x26')},'dialPowerLevel':{'type':Sequelize[_0x7467('0x27')](0x2)[_0x7467('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x7467('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0x7467('0x3')](_0x7467('0x29'),'dropRate'),'defaultValue':_0x7467('0x2a'),'comment':_0x7467('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x7467('0x27')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x7467('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0x7467('0x15')](0x3)[_0x7467('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x7467('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x7467('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7467('0x2e')},'dialQueueOptions':{'type':Sequelize[_0x7467('0x1')],'defaultValue':'tTxX','comment':_0x7467('0x2f')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7467('0x30')},'dialQueueProject':{'type':Sequelize[_0x7467('0x1')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x7467('0x15')](0x3)[_0x7467('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7467('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x7467('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7467('0x32')},'dialBusyMaxRetry':{'type':Sequelize[_0x7467('0x15')](0x3)[_0x7467('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7467('0x33')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7467('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7467('0x34')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x7467('0x15')](0x3)[_0x7467('0x24')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7467('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7467('0x35')},'dialGlobalMaxRetry':{'type':Sequelize[_0x7467('0x15')](0x3)[_0x7467('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x7467('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x7467('0x1')],'defaultValue':_0x7467('0x36')},'dialPrefix':{'type':Sequelize[_0x7467('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x7467('0x3')]('always','never',_0x7467('0x37')),'defaultValue':_0x7467('0x38')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x7467('0x39')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x7467('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x7467('0x15')](0x9)[_0x7467('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x7467('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x7467('0x15')](0x9)[_0x7467('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x7467('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7467('0x3c')},'dialAMDMinWordLength':{'type':Sequelize[_0x7467('0x15')](0x9)[_0x7467('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x7467('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x7467('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x7467('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x7467('0x15')](0x9)[_0x7467('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x7467('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x7467('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x7467('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x7467('0x40')},'dialRecallInQueue':{'type':Sequelize[_0x7467('0x1f')],'defaultValue':0x0,'comment':_0x7467('0x41')},'dialOrderByScheduledAt':{'type':Sequelize[_0x7467('0x3')](_0x7467('0x42'),_0x7467('0x43')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x7467('0x1')],'comment':_0x7467('0x44')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x7467('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x7467('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x7467('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x7467('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7467('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7467('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x7467('0x15')](0x5)[_0x7467('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7467('0x46')},'dialDropMaxRetry':{'type':Sequelize[_0x7467('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7467('0x47')},'dialDropRetryFrequency':{'type':Sequelize[_0x7467('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7467('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x7467('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7467('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7467('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7467('0x4a')},'dialMachineMaxRetry':{'type':Sequelize[_0x7467('0x15')](0x3)[_0x7467('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7467('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize[_0x7467('0x15')](0x5)[_0x7467('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7467('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x7467('0x15')](0x3)[_0x7467('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7467('0x4d')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x7467('0x15')](0x5)[_0x7467('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7467('0x4e')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x7467('0x4f')},'mandatoryDisposition':{'type':Sequelize[_0x7467('0x1f')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x6c492f){if(!_0x6c492f)this[_0x7467('0x19')](_0x7467('0x50'),null);this[_0x7467('0x19')](_0x7467('0x51'),_0x6c492f);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x7467('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x7467('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 9c7f648..9c0199a 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 _0x1819=['pick','merge','VIRTUAL','options','include','VoiceQueue','findAll','rows','catch','show','length','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','clone','params','omit','updatedAt','createdAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','VoiceQueueId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','online','voicePause','interface','flatMap','Agents','forEach','penalty','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','emit','removeTeams','ids','select','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','push','sequelize','SELECT','every','TeamId','all','compact','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','isEmpty','SIP/%s','removeAgents','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','field','NOW()','toString','cm_contacts','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','scheduledAt','removeLists','getBlackLists','addBlackLists','deletedAt\x20IS\x20NULL','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','value','includes','type','find','name','UserProfileResource','sendStatus','error','stack','send','map','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x1890ae,_0x33ad7f){var _0x20e537=function(_0x478fec){while(--_0x478fec){_0x1890ae['push'](_0x1890ae['shift']());}};_0x20e537(++_0x33ad7f);}(_0x1819,0x12a));var _0x9181=function(_0x3b87f4,_0x112243){_0x3b87f4=_0x3b87f4-0x0;var _0x63d16e=_0x1819[_0x3b87f4];return _0x63d16e;};'use strict';var emlformat=require(_0x9181('0x0'));var rimraf=require(_0x9181('0x1'));var zipdir=require(_0x9181('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9181('0x3'));var moment=require(_0x9181('0x4'));var BPromise=require(_0x9181('0x5'));var Mustache=require(_0x9181('0x6'));var util=require(_0x9181('0x7'));var path=require(_0x9181('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9181('0x9'));var fs=require('fs');var fs_extra=require(_0x9181('0xa'));var _=require(_0x9181('0xb'));var squel=require(_0x9181('0xc'));var crypto=require('crypto');var jsforce=require(_0x9181('0xd'));var deskjs=require(_0x9181('0xe'));var toCsv=require(_0x9181('0xf'));var querystring=require(_0x9181('0x10'));var Papa=require(_0x9181('0x11'));var Redis=require('ioredis');var authService=require(_0x9181('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9181('0x13'));var logger=require('../../config/logger')(_0x9181('0x14'));var utils=require(_0x9181('0x15'));var config=require(_0x9181('0x16'));var licenseUtil=require(_0x9181('0x17'));var db=require(_0x9181('0x18'))['db'];config[_0x9181('0x19')]=_['defaults'](config[_0x9181('0x19')],{'host':_0x9181('0x1a'),'port':0x18eb});var socket=require(_0x9181('0x1b'))(new Redis(config[_0x9181('0x19')]));require('./voiceQueue.socket')[_0x9181('0x1c')](socket);function respondWithStatusCode(_0xa6946,_0x558c8d){_0x558c8d=_0x558c8d||0xcc;return function(_0x4a560e){if(_0x4a560e){return _0xa6946['sendStatus'](_0x558c8d);}return _0xa6946[_0x9181('0x1d')](_0x558c8d)[_0x9181('0x1e')]();};}function respondWithResult(_0x1190ee,_0x319095){_0x319095=_0x319095||0xc8;return function(_0x407130){if(_0x407130){return _0x1190ee[_0x9181('0x1d')](_0x319095)[_0x9181('0x1f')](_0x407130);}};}function respondWithFilteredResult(_0xa2fe87,_0x209dbb){return function(_0x54e2ee){if(_0x54e2ee){var _0x13ae36=typeof _0x209dbb[_0x9181('0x20')]==='undefined'&&typeof _0x209dbb[_0x9181('0x21')]===_0x9181('0x22');var _0x1daba8=_0x54e2ee['count'];var _0x1b9810=_0x13ae36?0x0:_0x209dbb['offset'];var _0x38fcc1=_0x13ae36?_0x54e2ee[_0x9181('0x23')]:_0x209dbb[_0x9181('0x20')]+_0x209dbb[_0x9181('0x21')];var _0x336fb9;if(_0x38fcc1>=_0x1daba8){_0x38fcc1=_0x1daba8;_0x336fb9=0xc8;}else{_0x336fb9=0xce;}_0xa2fe87[_0x9181('0x1d')](_0x336fb9);return _0xa2fe87[_0x9181('0x24')](_0x9181('0x25'),_0x1b9810+'-'+_0x38fcc1+'/'+_0x1daba8)[_0x9181('0x1f')](_0x54e2ee);}return null;};}function patchUpdates(_0x3d323d){return function(_0x256f67){try{jsonpatch[_0x9181('0x26')](_0x256f67,_0x3d323d,!![]);}catch(_0xa440c7){return BPromise['reject'](_0xa440c7);}return _0x256f67[_0x9181('0x27')]();};}function saveUpdates(_0x41df9b,_0x1dd5e6){return function(_0x13662b){if(_0x13662b){return _0x13662b[_0x9181('0x28')](_0x41df9b)[_0x9181('0x29')](function(_0x29b600){return _0x29b600;});}return null;};}function removeEntity(_0x12e13a,_0x2e13d7){return function(_0x11b33b){if(_0x11b33b){return _0x11b33b[_0x9181('0x2a')]()[_0x9181('0x29')](function(){var _0xea1f2c=_0x11b33b[_0x9181('0x2b')]({'plain':!![]});var _0x45e252=[{'name':_0x9181('0x2c'),'value':_0x9181('0x2d'),'ignore':![]},{'name':_0x9181('0x2e'),'value':_0x9181('0x2f'),'ignore':![]}];var _0x5444e3=_(_0x45e252)[_0x9181('0x30')](_0x9181('0x31'))['map'](_0x9181('0x32'))['value']();if(_[_0x9181('0x33')](_0x5444e3,_0xea1f2c[_0x9181('0x34')])){return;}var _0x140ee2=_[_0x9181('0x35')](_0x45e252,[_0x9181('0x32'),_0xea1f2c[_0x9181('0x34')]])[_0x9181('0x36')];return db[_0x9181('0x37')]['destroy']({'where':{'type':_0x140ee2,'resourceId':_0xea1f2c['id']}})[_0x9181('0x29')](function(){return _0x11b33b;});})[_0x9181('0x29')](function(){_0x12e13a[_0x9181('0x1d')](0xcc)[_0x9181('0x1e')]();});}};}function handleEntityNotFound(_0x3569b5,_0x325da3){return function(_0x17d979){if(!_0x17d979){_0x3569b5[_0x9181('0x38')](0x194);}return _0x17d979;};}function handleError(_0x523189,_0x88b404){_0x88b404=_0x88b404||0x1f4;return function(_0x55aac8){logger[_0x9181('0x39')](_0x55aac8[_0x9181('0x3a')]);if(_0x55aac8['name']){delete _0x55aac8[_0x9181('0x36')];}_0x523189['status'](_0x88b404)[_0x9181('0x3b')](_0x55aac8);};}exports['index']=function(_0x34d81d,_0x3cb28f){var _0x4a5faa={},_0x2d6d28={},_0x1e935e={'count':0x0,'rows':[]};var _0x50e8e2=_[_0x9181('0x3c')](db['VoiceQueue'][_0x9181('0x3d')],function(_0xe06cc0){return{'name':_0xe06cc0[_0x9181('0x3e')],'type':_0xe06cc0[_0x9181('0x34')][_0x9181('0x3f')]};});_0x2d6d28[_0x9181('0x40')]=_['map'](_0x50e8e2,_0x9181('0x36'));_0x2d6d28['query']=_[_0x9181('0x41')](_0x34d81d['query']);_0x2d6d28[_0x9181('0x42')]=_[_0x9181('0x43')](_0x2d6d28[_0x9181('0x40')],_0x2d6d28[_0x9181('0x44')]);_0x4a5faa[_0x9181('0x45')]=_['intersection'](_0x2d6d28[_0x9181('0x40')],qs[_0x9181('0x46')](_0x34d81d[_0x9181('0x44')][_0x9181('0x46')]));_0x4a5faa['attributes']=_0x4a5faa['attributes']['length']?_0x4a5faa[_0x9181('0x45')]:_0x2d6d28[_0x9181('0x40')];if(!_0x34d81d[_0x9181('0x44')][_0x9181('0x47')](_0x9181('0x48'))){_0x4a5faa[_0x9181('0x21')]=qs['limit'](_0x34d81d[_0x9181('0x44')][_0x9181('0x21')]);_0x4a5faa['offset']=qs[_0x9181('0x20')](_0x34d81d[_0x9181('0x44')][_0x9181('0x20')]);}_0x4a5faa[_0x9181('0x49')]=qs[_0x9181('0x4a')](_0x34d81d['query'][_0x9181('0x4a')]);_0x4a5faa[_0x9181('0x4b')]=qs[_0x9181('0x42')](_[_0x9181('0x4c')](_0x34d81d[_0x9181('0x44')],_0x2d6d28[_0x9181('0x42')]),_0x50e8e2);if(_0x34d81d['query'][_0x9181('0x30')]){_0x4a5faa[_0x9181('0x4b')]=_[_0x9181('0x4d')](_0x4a5faa[_0x9181('0x4b')],{'$or':_[_0x9181('0x3c')](_0x50e8e2,function(_0x4ecca2){if(_0x4ecca2[_0x9181('0x34')]!==_0x9181('0x4e')){var _0xd03675={};_0xd03675[_0x4ecca2[_0x9181('0x36')]]={'$like':'%'+_0x34d81d['query']['filter']+'%'};return _0xd03675;}})});}_0x4a5faa=_['merge']({},_0x4a5faa,_0x34d81d[_0x9181('0x4f')]);var _0x32c4f5={'where':_0x4a5faa[_0x9181('0x4b')]};return db['VoiceQueue'][_0x9181('0x23')](_0x32c4f5)[_0x9181('0x29')](function(_0xbbfe4e){_0x1e935e[_0x9181('0x23')]=_0xbbfe4e;if(_0x34d81d[_0x9181('0x44')]['includeAll']){_0x4a5faa[_0x9181('0x50')]=[{'all':!![]}];}return db[_0x9181('0x51')][_0x9181('0x52')](_0x4a5faa);})['then'](function(_0x11e144){_0x1e935e[_0x9181('0x53')]=_0x11e144;return _0x1e935e;})[_0x9181('0x29')](respondWithFilteredResult(_0x3cb28f,_0x4a5faa))[_0x9181('0x54')](handleError(_0x3cb28f,null));};exports[_0x9181('0x55')]=function(_0x243f9b,_0x3980af){var _0x573d7f={'raw':![],'where':{'id':_0x243f9b['params']['id']}},_0x4f2cf3={};_0x4f2cf3[_0x9181('0x40')]=_[_0x9181('0x41')](db[_0x9181('0x51')][_0x9181('0x3d')]);_0x4f2cf3[_0x9181('0x44')]=_[_0x9181('0x41')](_0x243f9b[_0x9181('0x44')]);_0x4f2cf3[_0x9181('0x42')]=_[_0x9181('0x43')](_0x4f2cf3[_0x9181('0x40')],_0x4f2cf3[_0x9181('0x44')]);_0x573d7f[_0x9181('0x45')]=_[_0x9181('0x43')](_0x4f2cf3[_0x9181('0x40')],qs[_0x9181('0x46')](_0x243f9b[_0x9181('0x44')]['fields']));_0x573d7f[_0x9181('0x45')]=_0x573d7f[_0x9181('0x45')][_0x9181('0x56')]?_0x573d7f[_0x9181('0x45')]:_0x4f2cf3[_0x9181('0x40')];if(_0x243f9b['query'][_0x9181('0x57')]){_0x573d7f[_0x9181('0x50')]=[{'all':!![]}];}_0x573d7f=_[_0x9181('0x4d')]({},_0x573d7f,_0x243f9b[_0x9181('0x4f')]);return db[_0x9181('0x51')]['find'](_0x573d7f)[_0x9181('0x29')](handleEntityNotFound(_0x3980af,null))[_0x9181('0x29')](respondWithResult(_0x3980af,null))[_0x9181('0x54')](handleError(_0x3980af,null));};exports[_0x9181('0x58')]=function(_0x3ca8d3,_0x4bc537){return db[_0x9181('0x51')][_0x9181('0x58')](_0x3ca8d3[_0x9181('0x59')],{})[_0x9181('0x29')](function(_0x368c16){var _0x1a2a41=_0x3ca8d3['user'][_0x9181('0x2b')]({'plain':!![]});if(!_0x1a2a41)throw new Error(_0x9181('0x5a'));if(_0x1a2a41[_0x9181('0x5b')]===_0x9181('0x5c')){var _0x2f3a06=_0x368c16[_0x9181('0x2b')]({'plain':!![]});var _0x3331ae=[{'name':'VoiceQueues','value':_0x9181('0x2d')},{'name':_0x9181('0x2e'),'value':_0x9181('0x2f')}];var _0x4a13e4=_['find'](_0x3331ae,['value',_0x2f3a06[_0x9181('0x34')]])['name'];return db[_0x9181('0x5d')][_0x9181('0x35')]({'where':{'name':_0x4a13e4,'userProfileId':_0x1a2a41['userProfileId']},'raw':!![]})['then'](function(_0x541024){if(_0x541024&&_0x541024[_0x9181('0x5e')]===0x0){return db[_0x9181('0x37')][_0x9181('0x58')]({'name':_0x2f3a06[_0x9181('0x36')],'resourceId':_0x2f3a06['id'],'type':_0x541024[_0x9181('0x36')],'sectionId':_0x541024['id']},{})[_0x9181('0x29')](function(){return _0x368c16;});}else{return _0x368c16;}})['catch'](function(_0x470a5e){logger[_0x9181('0x39')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x470a5e);throw _0x470a5e;});}return _0x368c16;})[_0x9181('0x29')](respondWithResult(_0x4bc537,0xc9))['catch'](handleError(_0x4bc537,null));};exports[_0x9181('0x5f')]=function(_0x5002c6,_0x1b2efb){var _0x53ffe1={'where':{'id':_0x5002c6[_0x9181('0x60')]['id']}},_0x3553dd={};_0x3553dd['model']=_['keys'](db[_0x9181('0x51')][_0x9181('0x3d')]);_0x53ffe1['attributes']=_[_0x9181('0x43')](_0x3553dd[_0x9181('0x40')],qs[_0x9181('0x46')](_0x5002c6['query'][_0x9181('0x46')]));_0x53ffe1['attributes']=_0x53ffe1[_0x9181('0x45')]['length']?_0x53ffe1[_0x9181('0x45')]:_0x3553dd['model'];if(_0x5002c6[_0x9181('0x44')][_0x9181('0x57')]){_0x53ffe1['include']=[{'all':!![]}];}_0x53ffe1=_[_0x9181('0x4d')]({},_0x53ffe1,_0x5002c6[_0x9181('0x4f')]);return db[_0x9181('0x51')]['find'](_0x53ffe1)[_0x9181('0x29')](handleEntityNotFound(_0x1b2efb,null))[_0x9181('0x29')](function(_0x3300be){if(_0x3300be){var _0x2ba9f0=_0x3300be[_0x9181('0x2b')]({'plain':!![]});_0x2ba9f0=qs[_0x9181('0x61')](_0x2ba9f0,['id','createdAt',_0x9181('0x62')]);_0x5002c6['body']=_['omit'](_0x5002c6[_0x9181('0x59')],['id',_0x9181('0x63'),_0x9181('0x62')]);return db['VoiceQueue']['create'](_['merge'](_0x2ba9f0,_0x5002c6[_0x9181('0x59')]),{'include':_0x5002c6['query'][_0x9181('0x57')]?[{'all':!![]}]:undefined})[_0x9181('0x29')](function(_0x39fe82){var _0x1c8ceb=_0x5002c6[_0x9181('0x5c')]['get']({'plain':!![]});if(!_0x1c8ceb)throw new Error(_0x9181('0x5a'));if(_0x1c8ceb[_0x9181('0x5b')]==='user'){var _0x4bc536=_0x39fe82['get']({'plain':!![]});var _0x521363=[{'name':_0x9181('0x2c'),'value':'inbound'},{'name':_0x9181('0x2e'),'value':_0x9181('0x2f')}];var _0x480b47=_['find'](_0x521363,[_0x9181('0x32'),_0x4bc536[_0x9181('0x34')]])[_0x9181('0x36')];return db['UserProfileSection'][_0x9181('0x35')]({'where':{'name':_0x480b47,'userProfileId':_0x1c8ceb[_0x9181('0x64')]},'raw':!![]})['then'](function(_0x5baac4){if(_0x5baac4&&_0x5baac4['autoAssociation']===0x0){return db['UserProfileResource'][_0x9181('0x58')]({'name':_0x4bc536['name'],'resourceId':_0x4bc536['id'],'type':_0x5baac4[_0x9181('0x36')],'sectionId':_0x5baac4['id']},{})[_0x9181('0x29')](function(){return _0x39fe82;});}else{return _0x39fe82;}})[_0x9181('0x54')](function(_0x648101){logger[_0x9181('0x39')](_0x9181('0x65'),_0x648101);throw _0x648101;});}return _0x39fe82;});}})[_0x9181('0x29')](respondWithResult(_0x1b2efb,0xc9))['catch'](handleError(_0x1b2efb,null));};exports[_0x9181('0x28')]=function(_0x449c93,_0x5ddfe3){if(_0x449c93['body']['id']){delete _0x449c93[_0x9181('0x59')]['id'];}return db[_0x9181('0x51')][_0x9181('0x35')]({'where':{'id':_0x449c93[_0x9181('0x60')]['id']}})['then'](handleEntityNotFound(_0x5ddfe3,null))[_0x9181('0x29')](saveUpdates(_0x449c93[_0x9181('0x59')],null))[_0x9181('0x29')](respondWithResult(_0x5ddfe3,null))[_0x9181('0x54')](handleError(_0x5ddfe3,null));};exports[_0x9181('0x2a')]=function(_0x5d2081,_0x33efb6){return db['VoiceQueue'][_0x9181('0x35')]({'where':{'id':_0x5d2081[_0x9181('0x60')]['id']}})[_0x9181('0x29')](handleEntityNotFound(_0x33efb6,null))['then'](removeEntity(_0x33efb6,null))['catch'](handleError(_0x33efb6,null));};exports[_0x9181('0x66')]=function(_0x40973a,_0x15c8a8,_0x2afec1){var _0x134d9a={'raw':![],'where':{}};var _0x56b805={};var _0x27f644={'count':0x0,'rows':[]};return db[_0x9181('0x51')][_0x9181('0x67')]({'where':{'id':_0x40973a[_0x9181('0x60')]['id']}})[_0x9181('0x29')](handleEntityNotFound(_0x15c8a8,null))['then'](function(_0x5d1e82){if(_0x5d1e82){_0x56b805['model']=_[_0x9181('0x41')](db[_0x9181('0x68')]['rawAttributes']);_0x56b805[_0x9181('0x44')]=_['keys'](_0x40973a[_0x9181('0x44')]);_0x56b805[_0x9181('0x42')]=_[_0x9181('0x43')](_0x56b805[_0x9181('0x40')],_0x56b805[_0x9181('0x44')]);_0x134d9a[_0x9181('0x45')]=_['intersection'](_0x56b805[_0x9181('0x40')],qs['fields'](_0x40973a[_0x9181('0x44')][_0x9181('0x46')]));_0x134d9a['attributes']=_0x134d9a[_0x9181('0x45')]['length']?_0x134d9a[_0x9181('0x45')]:_0x56b805[_0x9181('0x40')];if(!_0x40973a[_0x9181('0x44')][_0x9181('0x47')](_0x9181('0x48'))){_0x134d9a[_0x9181('0x21')]=qs['limit'](_0x40973a[_0x9181('0x44')]['limit']);_0x134d9a[_0x9181('0x20')]=qs[_0x9181('0x20')](_0x40973a[_0x9181('0x44')][_0x9181('0x20')]);}_0x134d9a[_0x9181('0x49')]=qs[_0x9181('0x4a')](_0x40973a['query'][_0x9181('0x4a')]);_0x134d9a[_0x9181('0x4b')]=qs[_0x9181('0x42')](_['pick'](_0x40973a[_0x9181('0x44')],_0x56b805[_0x9181('0x42')]));_0x134d9a[_0x9181('0x4b')][_0x9181('0x69')]=_0x5d1e82['id'];if(_0x40973a[_0x9181('0x44')][_0x9181('0x30')]){_0x134d9a[_0x9181('0x4b')]=_['merge'](_0x134d9a[_0x9181('0x4b')],{'$or':_[_0x9181('0x3c')](_0x134d9a['attributes'],function(_0x1d4603){var _0xa38033={};_0xa38033[_0x1d4603]={'$like':'%'+_0x40973a[_0x9181('0x44')][_0x9181('0x30')]+'%'};return _0xa38033;})});}_0x134d9a=_[_0x9181('0x4d')]({},_0x134d9a,_0x40973a[_0x9181('0x4f')]);return db[_0x9181('0x68')][_0x9181('0x23')]({'where':_0x134d9a[_0x9181('0x4b')]})[_0x9181('0x29')](function(_0x5ad92a){_0x27f644[_0x9181('0x23')]=_0x5ad92a;if(_0x40973a[_0x9181('0x44')]['includeAll']){_0x134d9a[_0x9181('0x50')]=[{'all':!![]}];}return db[_0x9181('0x68')]['findAll'](_0x134d9a);})['then'](function(_0x40c1d2){_0x27f644[_0x9181('0x53')]=_0x40c1d2;return _0x27f644;});}})['then'](respondWithFilteredResult(_0x15c8a8,_0x134d9a))[_0x9181('0x54')](handleError(_0x15c8a8,null));};exports['getHopperHistories']=function(_0x3f2a16,_0x1529b2,_0x1ec3fc){var _0x45eef8={'raw':!![],'where':{}};var _0x5fa0f1={};var _0x59b7be={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x9181('0x67')]({'where':{'id':_0x3f2a16[_0x9181('0x60')]['id']}})[_0x9181('0x29')](handleEntityNotFound(_0x1529b2,null))[_0x9181('0x29')](function(_0x404fb3){if(_0x404fb3){_0x5fa0f1[_0x9181('0x40')]=_[_0x9181('0x41')](db[_0x9181('0x6a')]['rawAttributes']);_0x5fa0f1[_0x9181('0x44')]=_[_0x9181('0x41')](_0x3f2a16['query']);_0x5fa0f1[_0x9181('0x42')]=_['intersection'](_0x5fa0f1[_0x9181('0x40')],_0x5fa0f1['query']);_0x45eef8[_0x9181('0x45')]=_[_0x9181('0x43')](_0x5fa0f1[_0x9181('0x40')],qs[_0x9181('0x46')](_0x3f2a16[_0x9181('0x44')]['fields']));_0x45eef8[_0x9181('0x45')]=_0x45eef8['attributes'][_0x9181('0x56')]?_0x45eef8['attributes']:_0x5fa0f1[_0x9181('0x40')];if(!_0x3f2a16[_0x9181('0x44')]['hasOwnProperty'](_0x9181('0x48'))){_0x45eef8[_0x9181('0x21')]=qs[_0x9181('0x21')](_0x3f2a16[_0x9181('0x44')][_0x9181('0x21')]);_0x45eef8[_0x9181('0x20')]=qs[_0x9181('0x20')](_0x3f2a16[_0x9181('0x44')][_0x9181('0x20')]);}_0x45eef8[_0x9181('0x49')]=qs[_0x9181('0x4a')](_0x3f2a16['query']['sort']);_0x45eef8['where']=qs[_0x9181('0x42')](_[_0x9181('0x4c')](_0x3f2a16['query'],_0x5fa0f1[_0x9181('0x42')]));_0x45eef8['where'][_0x9181('0x69')]=_0x404fb3['id'];if(_0x3f2a16[_0x9181('0x44')][_0x9181('0x30')]){_0x45eef8['where']=_[_0x9181('0x4d')](_0x45eef8[_0x9181('0x4b')],{'$or':_['map'](_0x45eef8['attributes'],function(_0x3fca46){var _0x4d18e5={};_0x4d18e5[_0x3fca46]={'$like':'%'+_0x3f2a16['query'][_0x9181('0x30')]+'%'};return _0x4d18e5;})});}_0x45eef8=_['merge']({},_0x45eef8,_0x3f2a16[_0x9181('0x4f')]);return db[_0x9181('0x6a')]['count']({'where':_0x45eef8[_0x9181('0x4b')]})['then'](function(_0x34ac2a){_0x59b7be[_0x9181('0x23')]=_0x34ac2a;if(_0x3f2a16[_0x9181('0x44')][_0x9181('0x57')]){_0x45eef8[_0x9181('0x50')]=[{'all':!![]}];}return db[_0x9181('0x6a')][_0x9181('0x52')](_0x45eef8);})['then'](function(_0x5dda96){_0x59b7be['rows']=_0x5dda96;return _0x59b7be;});}})[_0x9181('0x29')](respondWithFilteredResult(_0x1529b2,_0x45eef8))[_0x9181('0x54')](handleError(_0x1529b2,null));};exports[_0x9181('0x6b')]=function(_0x261ec7,_0x1eab75,_0x1a7fbe){var _0x4e66a8={'raw':!![],'where':{}};var _0x5e58f0={};var _0x388944={'count':0x0,'rows':[]};return db[_0x9181('0x51')][_0x9181('0x67')]({'where':{'id':_0x261ec7[_0x9181('0x60')]['id']}})[_0x9181('0x29')](handleEntityNotFound(_0x1eab75,null))[_0x9181('0x29')](function(_0x197371){if(_0x197371){_0x5e58f0['model']=_[_0x9181('0x41')](db[_0x9181('0x6c')][_0x9181('0x3d')]);_0x5e58f0['query']=_[_0x9181('0x41')](_0x261ec7[_0x9181('0x44')]);_0x5e58f0['filters']=_[_0x9181('0x43')](_0x5e58f0[_0x9181('0x40')],_0x5e58f0[_0x9181('0x44')]);_0x4e66a8['attributes']=_[_0x9181('0x43')](_0x5e58f0[_0x9181('0x40')],qs[_0x9181('0x46')](_0x261ec7['query'][_0x9181('0x46')]));_0x4e66a8[_0x9181('0x45')]=_0x4e66a8[_0x9181('0x45')][_0x9181('0x56')]?_0x4e66a8[_0x9181('0x45')]:_0x5e58f0[_0x9181('0x40')];if(!_0x261ec7['query'][_0x9181('0x47')](_0x9181('0x48'))){_0x4e66a8['limit']=qs[_0x9181('0x21')](_0x261ec7[_0x9181('0x44')][_0x9181('0x21')]);_0x4e66a8['offset']=qs[_0x9181('0x20')](_0x261ec7[_0x9181('0x44')][_0x9181('0x20')]);}_0x4e66a8[_0x9181('0x49')]=qs[_0x9181('0x4a')](_0x261ec7[_0x9181('0x44')][_0x9181('0x4a')]);_0x4e66a8[_0x9181('0x4b')]=qs['filters'](_[_0x9181('0x4c')](_0x261ec7['query'],_0x5e58f0[_0x9181('0x42')]));_0x4e66a8[_0x9181('0x4b')]['VoiceQueueId']=_0x197371['id'];if(_0x261ec7[_0x9181('0x44')]['filter']){_0x4e66a8[_0x9181('0x4b')]=_['merge'](_0x4e66a8[_0x9181('0x4b')],{'$or':_['map'](_0x4e66a8['attributes'],function(_0x55a99c){var _0x48f09c={};_0x48f09c[_0x55a99c]={'$like':'%'+_0x261ec7['query']['filter']+'%'};return _0x48f09c;})});}_0x4e66a8=_['merge']({},_0x4e66a8,_0x261ec7[_0x9181('0x4f')]);return db[_0x9181('0x6c')][_0x9181('0x23')]({'where':_0x4e66a8[_0x9181('0x4b')]})[_0x9181('0x29')](function(_0xcd95a4){_0x388944['count']=_0xcd95a4;if(_0x261ec7[_0x9181('0x44')][_0x9181('0x57')]){_0x4e66a8[_0x9181('0x50')]=[{'all':!![]}];}return db[_0x9181('0x6c')][_0x9181('0x52')](_0x4e66a8);})['then'](function(_0x573e12){_0x388944['rows']=_0x573e12;return _0x388944;});}})[_0x9181('0x29')](respondWithFilteredResult(_0x1eab75,_0x4e66a8))[_0x9181('0x54')](handleError(_0x1eab75,null));};exports[_0x9181('0x6d')]=function(_0x32e01c,_0x14e261,_0x24c79b){var _0x1cec71={'raw':!![],'where':{}};var _0x3f000e={};var _0x37e804={'count':0x0,'rows':[]};return db[_0x9181('0x51')][_0x9181('0x67')]({'where':{'id':_0x32e01c[_0x9181('0x60')]['id']}})[_0x9181('0x29')](handleEntityNotFound(_0x14e261,null))[_0x9181('0x29')](function(_0xfea322){if(_0xfea322){_0x3f000e[_0x9181('0x40')]=_[_0x9181('0x41')](db[_0x9181('0x6e')][_0x9181('0x3d')]);_0x3f000e['query']=_[_0x9181('0x41')](_0x32e01c['query']);_0x3f000e['filters']=_[_0x9181('0x43')](_0x3f000e['model'],_0x3f000e['query']);_0x1cec71[_0x9181('0x45')]=_[_0x9181('0x43')](_0x3f000e[_0x9181('0x40')],qs[_0x9181('0x46')](_0x32e01c[_0x9181('0x44')]['fields']));_0x1cec71[_0x9181('0x45')]=_0x1cec71['attributes'][_0x9181('0x56')]?_0x1cec71[_0x9181('0x45')]:_0x3f000e[_0x9181('0x40')];if(!_0x32e01c[_0x9181('0x44')][_0x9181('0x47')](_0x9181('0x48'))){_0x1cec71['limit']=qs[_0x9181('0x21')](_0x32e01c[_0x9181('0x44')][_0x9181('0x21')]);_0x1cec71['offset']=qs[_0x9181('0x20')](_0x32e01c['query'][_0x9181('0x20')]);}_0x1cec71[_0x9181('0x49')]=qs[_0x9181('0x4a')](_0x32e01c[_0x9181('0x44')]['sort']);_0x1cec71['where']=qs[_0x9181('0x42')](_[_0x9181('0x4c')](_0x32e01c[_0x9181('0x44')],_0x3f000e[_0x9181('0x42')]));_0x1cec71[_0x9181('0x4b')][_0x9181('0x69')]=_0xfea322['id'];if(_0x32e01c['query'][_0x9181('0x30')]){_0x1cec71[_0x9181('0x4b')]=_[_0x9181('0x4d')](_0x1cec71[_0x9181('0x4b')],{'$or':_[_0x9181('0x3c')](_0x1cec71[_0x9181('0x45')],function(_0x3e9351){var _0x45b152={};_0x45b152[_0x3e9351]={'$like':'%'+_0x32e01c[_0x9181('0x44')][_0x9181('0x30')]+'%'};return _0x45b152;})});}_0x1cec71=_[_0x9181('0x4d')]({},_0x1cec71,_0x32e01c[_0x9181('0x4f')]);return db[_0x9181('0x6e')]['count']({'where':_0x1cec71['where']})[_0x9181('0x29')](function(_0x55bfe3){_0x37e804[_0x9181('0x23')]=_0x55bfe3;if(_0x32e01c[_0x9181('0x44')][_0x9181('0x57')]){_0x1cec71[_0x9181('0x50')]=[{'all':!![]}];}return db[_0x9181('0x6e')][_0x9181('0x52')](_0x1cec71);})[_0x9181('0x29')](function(_0x1f0f08){_0x37e804['rows']=_0x1f0f08;return _0x37e804;});}})[_0x9181('0x29')](respondWithFilteredResult(_0x14e261,_0x1cec71))[_0x9181('0x54')](handleError(_0x14e261,null));};exports[_0x9181('0x6f')]=function(_0x275046,_0x512162,_0x27f9d0){var _0x25c181={};var _0x42df8a={};var _0x4c0d11;var _0x15cb36;return db[_0x9181('0x51')][_0x9181('0x67')]({'where':{'id':_0x275046[_0x9181('0x60')]['id']}})['then'](handleEntityNotFound(_0x512162,null))['then'](function(_0x88b881){if(_0x88b881){_0x4c0d11=_0x88b881;_0x42df8a['model']=_[_0x9181('0x41')](db[_0x9181('0x70')][_0x9181('0x3d')]);_0x42df8a[_0x9181('0x44')]=_[_0x9181('0x41')](_0x275046[_0x9181('0x44')]);_0x42df8a[_0x9181('0x42')]=_[_0x9181('0x43')](_0x42df8a['model'],_0x42df8a[_0x9181('0x44')]);_0x25c181[_0x9181('0x45')]=_[_0x9181('0x43')](_0x42df8a['model'],qs[_0x9181('0x46')](_0x275046[_0x9181('0x44')][_0x9181('0x46')]));_0x25c181['attributes']=_0x25c181[_0x9181('0x45')]['length']?_0x25c181[_0x9181('0x45')]:_0x42df8a[_0x9181('0x40')];_0x25c181['order']=qs[_0x9181('0x4a')](_0x275046[_0x9181('0x44')][_0x9181('0x4a')]);_0x25c181[_0x9181('0x4b')]=qs[_0x9181('0x42')](_['pick'](_0x275046[_0x9181('0x44')],_0x42df8a[_0x9181('0x42')]));if(_0x275046['query'][_0x9181('0x30')]){_0x25c181[_0x9181('0x4b')]=_['merge'](_0x25c181[_0x9181('0x4b')],{'$or':_[_0x9181('0x3c')](_0x25c181[_0x9181('0x45')],function(_0x1e6f60){var _0x157af3={};_0x157af3[_0x1e6f60]={'$like':'%'+_0x275046[_0x9181('0x44')][_0x9181('0x30')]+'%'};return _0x157af3;})});}_0x25c181=_[_0x9181('0x4d')]({},_0x25c181,_0x275046['options']);return _0x4c0d11[_0x9181('0x6f')](_0x25c181);}})[_0x9181('0x29')](function(_0x34b228){if(_0x34b228){_0x15cb36=_0x34b228[_0x9181('0x56')];if(!_0x275046['query'][_0x9181('0x47')](_0x9181('0x48'))){_0x25c181[_0x9181('0x21')]=qs[_0x9181('0x21')](_0x275046[_0x9181('0x44')][_0x9181('0x21')]);_0x25c181[_0x9181('0x20')]=qs[_0x9181('0x20')](_0x275046[_0x9181('0x44')][_0x9181('0x20')]);}return _0x4c0d11['getTeams'](_0x25c181);}})['then'](function(_0x22c06d){if(_0x22c06d){return _0x22c06d?{'count':_0x15cb36,'rows':_0x22c06d}:null;}})[_0x9181('0x29')](respondWithResult(_0x512162,null))[_0x9181('0x54')](handleError(_0x512162,null));};exports[_0x9181('0x71')]=function(_0x5aef47,_0x1d0e8b,_0x35535e){var _0x12a5d4=_0x5aef47[_0x9181('0x59')][_0x9181('0x72')];var _0x24b6f4=_[_0x9181('0x3c')](_0x12a5d4,'id');return db[_0x9181('0x70')][_0x9181('0x52')]({'where':{'id':_0x24b6f4},'attributes':['id'],'include':[{'model':db[_0x9181('0x73')],'as':'Agents','attributes':['id',_0x9181('0x36'),_0x9181('0x74'),_0x9181('0x75'),_0x9181('0x76')],'raw':!![]}]})[_0x9181('0x29')](function(_0x3415e7){if(_0x3415e7){var _0x50e21a=_[_0x9181('0x77')](_0x3415e7,function(_0xfe4088){var _0xc921b0=_0xfe4088[_0x9181('0x2b')]({'plain':!![]});_0xc921b0[_0x9181('0x78')][_0x9181('0x79')](function(_0x5862af){_0x5862af[_0x9181('0x7a')]=_[_0x9181('0x35')](_0x12a5d4,{'id':_0xc921b0['id']})[_0x9181('0x7a')];});return _0xc921b0['Agents'];});return db['VoiceQueue'][_0x9181('0x35')]({'where':{'id':_0x5aef47[_0x9181('0x60')]['id']}})[_0x9181('0x29')](function(_0x41673c){return db['sequelize'][_0x9181('0x7b')](function(_0x3328dd){return _0x41673c[_0x9181('0x71')](_0x24b6f4,{'transaction':_0x3328dd})[_0x9181('0x29')](function(){return BPromise[_0x9181('0x7c')](_0x12a5d4,function(_0x587c89){return db[_0x9181('0x7d')][_0x9181('0x7e')]({'TeamId':_0x587c89['id'],'VoiceQueueId':_0x5aef47[_0x9181('0x60')]['id'],'penalty':_0x587c89[_0x9181('0x7a')]},{'transaction':_0x3328dd});});})[_0x9181('0x29')](function(){return BPromise[_0x9181('0x7c')](_0x50e21a,function(_0xae090e){return db[_0x9181('0x7f')][_0x9181('0x80')]({'where':{'UserId':_0xae090e['id'],'VoiceQueueId':_0x5aef47[_0x9181('0x60')]['id']},'defaults':{'penalty':_0xae090e[_0x9181('0x7a')]},'transaction':_0x3328dd});});})[_0x9181('0x29')](function(){return BPromise[_0x9181('0x7c')](_['filter'](_0x50e21a,{'online':!![]}),function(_0x534668){return db[_0x9181('0x81')][_0x9181('0x7e')]({'membername':_0x534668['name'],'UserId':_0x534668['id'],'queue_name':_0x41673c[_0x9181('0x36')],'VoiceQueueId':_0x41673c['id'],'interface':_[_0x9181('0x82')](_0x534668[_0x9181('0x76')])?util[_0x9181('0x83')]('SIP/%s',_0x534668[_0x9181('0x36')]):_0x534668['interface'],'paused':_0x534668[_0x9181('0x75')]||![],'penalty':_0x534668[_0x9181('0x7a')]},{'transaction':_0x3328dd});});})[_0x9181('0x29')](function(){_0x50e21a[_0x9181('0x79')](function(_0x2eb367){socket[_0x9181('0x84')]('userVoiceQueue:save',{'UserId':_0x2eb367['id'],'VoiceQueueId':_0x41673c['id']});});});});});}})[_0x9181('0x29')](respondWithStatusCode(_0x1d0e8b,null))[_0x9181('0x54')](handleError(_0x1d0e8b,null));};exports[_0x9181('0x85')]=function(_0x54b5fb,_0x3afdea,_0x307094){return db[_0x9181('0x70')][_0x9181('0x52')]({'where':{'id':_0x54b5fb['query'][_0x9181('0x86')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9181('0x78'),'attributes':['id'],'raw':!![]}]})[_0x9181('0x29')](handleEntityNotFound(_0x3afdea,null))[_0x9181('0x29')](function(_0x2699c2){var _0x58f36d=_['map'](_0x2699c2,'id');var _0x46ba55=[];var _0x298eae=[];var _0xb2c160=squel[_0x9181('0x87')]();_0xb2c160['field'](_0x9181('0x88'))[_0x9181('0x89')]('team_has_voice_queues','tq')[_0x9181('0x8a')]('user_has_teams','ut',_0x9181('0x8b'))[_0x9181('0x4b')](_0x9181('0x8c'),_0x54b5fb[_0x9181('0x60')]['id']);for(var _0x119996=0x0;_0x119996<_0x2699c2[_0x9181('0x56')];_0x119996+=0x1){let _0x35e4dd=_0x2699c2[_0x119996];for(var _0x2f1d17=0x0;_0x2f1d17<_0x35e4dd['Agents'][_0x9181('0x56')];_0x2f1d17+=0x1){let _0x71240f=_0x35e4dd['Agents'][_0x2f1d17];var _0x318ea0=_0xb2c160[_0x9181('0x5f')]();_0x318ea0[_0x9181('0x4b')]('ut.UserId\x20=\x20?',_0x71240f['id']);_0x298eae[_0x9181('0x8d')](db[_0x9181('0x8e')][_0x9181('0x44')](_0x318ea0['toString'](),{'type':db[_0x9181('0x8e')]['QueryTypes'][_0x9181('0x8f')]})[_0x9181('0x29')](function(_0x53e5fa){if(_0x53e5fa[_0x9181('0x56')]===0x1){return _0x71240f['id'];}else{var _0x27115f=_[_0x9181('0x90')](_[_0x9181('0x3c')](_0x53e5fa,_0x9181('0x91')),function(_0xeea115){return _['includes'](_0x58f36d,_0xeea115);});if(_0x27115f){return _0x71240f['id'];}}}));}}return BPromise[_0x9181('0x92')](_0x298eae)['then'](function(_0x2e7bf0){_0x46ba55=_(_0x46ba55)['union'](_0x2e7bf0)[_0x9181('0x93')]()[_0x9181('0x32')]();return db[_0x9181('0x51')]['find']({'where':{'id':_0x54b5fb[_0x9181('0x60')]['id']}})[_0x9181('0x29')](function(_0x46c02e){return db['sequelize'][_0x9181('0x7b')](function(_0x314e09){return _0x46c02e[_0x9181('0x85')](_0x54b5fb[_0x9181('0x44')][_0x9181('0x86')],{'transaction':_0x314e09})[_0x9181('0x29')](function(){if(!_['isEmpty'](_0x46ba55)){return _0x46c02e['removeAgents'](_0x46ba55,{'transaction':_0x314e09})[_0x9181('0x29')](function(){return db[_0x9181('0x81')][_0x9181('0x2a')]({'where':{'VoiceQueueId':_0x54b5fb['params']['id'],'UserId':_0x46ba55},'transaction':_0x314e09});});}})['then'](function(){_0x46ba55[_0x9181('0x79')](function(_0x258452){socket['emit'](_0x9181('0x94'),{'UserId':_0x258452,'VoiceQueueId':_0x46c02e['id']});});});});});});})[_0x9181('0x29')](respondWithStatusCode(_0x3afdea,null))[_0x9181('0x54')](handleError(_0x3afdea,null));};exports[_0x9181('0x95')]=function(_0x133812,_0x2f1300,_0x5c9c0f){var _0x4c3afc,_0x1f5a80;return db['VoiceQueue'][_0x9181('0x35')]({'where':{'id':_0x133812[_0x9181('0x60')]['id']}})['then'](handleEntityNotFound(_0x2f1300,null))[_0x9181('0x29')](function(_0x2d426b){if(_0x2d426b){_0x1f5a80=_0x2d426b;return _0x2d426b[_0x9181('0x95')](_0x133812[_0x9181('0x59')][_0x9181('0x86')],_[_0x9181('0x61')](_0x133812[_0x9181('0x59')],[_0x9181('0x86'),'id'])||{})[_0x9181('0x96')](function(_0x2c8275){for(var _0xff521b=0x0;_0xff521b<_0x133812[_0x9181('0x59')]['ids']['length'];_0xff521b+=0x1){socket[_0x9181('0x84')](_0x9181('0x97'),{'UserId':Number(_0x133812[_0x9181('0x59')]['ids'][_0xff521b]),'VoiceQueueId':Number(_0x133812['params']['id'])});}return _0x2c8275;});}})['then'](function(_0x18cac3){_0x4c3afc=_0x18cac3||[];if(_0x1f5a80){return db['User']['findAll']({'where':{'id':_0x133812[_0x9181('0x59')][_0x9181('0x86')]},'attributes':['id','name',_0x9181('0x74'),_0x9181('0x75'),_0x9181('0x76')],'raw':!![]});}})[_0x9181('0x29')](function(_0x187396){if(!_[_0x9181('0x98')](_0x187396)){var _0x1f0b65=[];for(var _0x57ecec=0x0;_0x57ecec<_0x187396['length'];_0x57ecec++){if(_0x187396[_0x57ecec][_0x9181('0x74')]){_0x1f0b65[_0x9181('0x8d')](db[_0x9181('0x81')]['upsert']({'membername':_0x187396[_0x57ecec]['name'],'UserId':_0x187396[_0x57ecec]['id'],'queue_name':_0x1f5a80[_0x9181('0x36')],'VoiceQueueId':_0x1f5a80['id'],'interface':_[_0x9181('0x82')](_0x187396[_0x57ecec][_0x9181('0x76')])?util[_0x9181('0x83')](_0x9181('0x99'),_0x187396[_0x57ecec][_0x9181('0x36')]):_0x187396[_0x57ecec][_0x9181('0x76')],'paused':_0x187396[_0x57ecec][_0x9181('0x75')]||![],'penalty':_0x133812['body']['penalty']||0x0}));}}return BPromise[_0x9181('0x92')](_0x1f0b65);}})['then'](function(){return _0x4c3afc;})[_0x9181('0x29')](respondWithResult(_0x2f1300,null))['catch'](handleError(_0x2f1300,null));};exports[_0x9181('0x9a')]=function(_0xe21875,_0x24264f,_0x3f771a){return db['VoiceQueue']['find']({'where':{'id':_0xe21875[_0x9181('0x60')]['id']}})['then'](handleEntityNotFound(_0x24264f,null))[_0x9181('0x29')](function(_0x10a3c8){if(_0x10a3c8){return _0x10a3c8[_0x9181('0x9a')](_0xe21875[_0x9181('0x44')][_0x9181('0x86')])['then'](function(){if(_[_0x9181('0x9b')](_0xe21875['query']['ids'])){for(var _0x11b3e1=0x0;_0x11b3e1<_0xe21875[_0x9181('0x44')][_0x9181('0x86')][_0x9181('0x56')];_0x11b3e1+=0x1){socket[_0x9181('0x84')](_0x9181('0x94'),{'UserId':Number(_0xe21875[_0x9181('0x44')][_0x9181('0x86')][_0x11b3e1]),'VoiceQueueId':Number(_0xe21875[_0x9181('0x60')]['id'])});}}else{socket[_0x9181('0x84')](_0x9181('0x94'),{'UserId':Number(_0xe21875[_0x9181('0x44')][_0x9181('0x86')]),'VoiceQueueId':Number(_0xe21875[_0x9181('0x60')]['id'])});}});}})[_0x9181('0x29')](function(_0x2750a4){return db[_0x9181('0x81')][_0x9181('0x2a')]({'where':{'VoiceQueueId':_0xe21875[_0x9181('0x60')]['id'],'UserId':_0xe21875['query'][_0x9181('0x86')]}})[_0x9181('0x29')](function(){return _0x2750a4;});})['then'](respondWithStatusCode(_0x24264f,null))['catch'](handleError(_0x24264f,null));};exports[_0x9181('0x9c')]=function(_0x4a3c14,_0xbad506,_0x38df72){var _0x5146e2={};var _0x7e11a5={};var _0x1c2359;var _0xf966ce;return db[_0x9181('0x51')][_0x9181('0x67')]({'where':{'id':_0x4a3c14['params']['id']}})[_0x9181('0x29')](handleEntityNotFound(_0xbad506,null))[_0x9181('0x29')](function(_0x90d815){if(_0x90d815){_0x1c2359=_0x90d815;_0x7e11a5[_0x9181('0x40')]=_[_0x9181('0x41')](db['User'][_0x9181('0x3d')]);_0x7e11a5['query']=_[_0x9181('0x41')](_0x4a3c14['query']);_0x7e11a5['filters']=_['intersection'](_0x7e11a5[_0x9181('0x40')],_0x7e11a5[_0x9181('0x44')]);_0x5146e2[_0x9181('0x45')]=_[_0x9181('0x43')](_0x7e11a5['model'],qs[_0x9181('0x46')](_0x4a3c14[_0x9181('0x44')]['fields']));_0x5146e2[_0x9181('0x45')]=_0x5146e2['attributes']['length']?_0x5146e2[_0x9181('0x45')]:_0x7e11a5[_0x9181('0x40')];_0x5146e2['order']=qs['sort'](_0x4a3c14[_0x9181('0x44')]['sort']);_0x5146e2[_0x9181('0x4b')]=qs[_0x9181('0x42')](_[_0x9181('0x4c')](_0x4a3c14[_0x9181('0x44')],_0x7e11a5['filters']));if(_0x4a3c14[_0x9181('0x44')][_0x9181('0x30')]){_0x5146e2[_0x9181('0x4b')]=_[_0x9181('0x4d')](_0x5146e2[_0x9181('0x4b')],{'$or':_[_0x9181('0x3c')](_0x5146e2[_0x9181('0x45')],function(_0x4b74d2){var _0x3b97d6={};_0x3b97d6[_0x4b74d2]={'$like':'%'+_0x4a3c14[_0x9181('0x44')][_0x9181('0x30')]+'%'};return _0x3b97d6;})});}_0x5146e2=_[_0x9181('0x4d')]({},_0x5146e2,_0x4a3c14[_0x9181('0x4f')]);return _0x1c2359[_0x9181('0x9c')](_0x5146e2);}})['then'](function(_0x59a43c){if(_0x59a43c){_0xf966ce=_0x59a43c[_0x9181('0x56')];if(!_0x4a3c14[_0x9181('0x44')][_0x9181('0x47')](_0x9181('0x48'))){_0x5146e2[_0x9181('0x21')]=qs[_0x9181('0x21')](_0x4a3c14[_0x9181('0x44')]['limit']);_0x5146e2['offset']=qs[_0x9181('0x20')](_0x4a3c14[_0x9181('0x44')][_0x9181('0x20')]);}return _0x1c2359['getAgents'](_0x5146e2);}})[_0x9181('0x29')](function(_0x2d6a84){if(_0x2d6a84){return _0x2d6a84?{'count':_0xf966ce,'rows':_0x2d6a84}:null;}})[_0x9181('0x29')](respondWithResult(_0xbad506,null))[_0x9181('0x54')](handleError(_0xbad506,null));};exports[_0x9181('0x9d')]=function(_0x5bffe5,_0x3ae2a1,_0x304b4a){var _0x4a8bed={};var _0x2856a4={};var _0x18e6db;var _0x36738b;return db['VoiceQueue'][_0x9181('0x67')]({'where':{'id':_0x5bffe5['params']['id']}})[_0x9181('0x29')](handleEntityNotFound(_0x3ae2a1,null))[_0x9181('0x29')](function(_0x38bd21){if(_0x38bd21){_0x18e6db=_0x38bd21;_0x2856a4['model']=_[_0x9181('0x41')](db['UserVoiceQueueRt']['rawAttributes']);_0x2856a4[_0x9181('0x44')]=_[_0x9181('0x41')](_0x5bffe5['query']);_0x2856a4[_0x9181('0x42')]=_[_0x9181('0x43')](_0x2856a4[_0x9181('0x40')],_0x2856a4[_0x9181('0x44')]);_0x4a8bed[_0x9181('0x45')]=_[_0x9181('0x43')](_0x2856a4[_0x9181('0x40')],qs[_0x9181('0x46')](_0x5bffe5[_0x9181('0x44')][_0x9181('0x46')]));_0x4a8bed[_0x9181('0x45')]=_0x4a8bed[_0x9181('0x45')]['length']?_0x4a8bed['attributes']:_0x2856a4[_0x9181('0x40')];_0x4a8bed[_0x9181('0x49')]=qs['sort'](_0x5bffe5[_0x9181('0x44')][_0x9181('0x4a')]);_0x4a8bed[_0x9181('0x4b')]=qs['filters'](_['pick'](_0x5bffe5['query'],_0x2856a4[_0x9181('0x42')]));if(_0x5bffe5[_0x9181('0x44')][_0x9181('0x30')]){_0x4a8bed['where']=_[_0x9181('0x4d')](_0x4a8bed['where'],{'$or':_[_0x9181('0x3c')](_0x4a8bed['attributes'],function(_0x2c0bef){var _0x1a9936={};_0x1a9936[_0x2c0bef]={'$like':'%'+_0x5bffe5[_0x9181('0x44')][_0x9181('0x30')]+'%'};return _0x1a9936;})});}_0x4a8bed=_['merge']({},_0x4a8bed,_0x5bffe5[_0x9181('0x4f')]);return _0x18e6db['getMembers'](_0x4a8bed);}})[_0x9181('0x29')](function(_0x304f19){if(_0x304f19){_0x36738b=_0x304f19[_0x9181('0x56')];if(!_0x5bffe5['query'][_0x9181('0x47')]('nolimit')){_0x4a8bed[_0x9181('0x21')]=qs['limit'](_0x5bffe5[_0x9181('0x44')]['limit']);_0x4a8bed[_0x9181('0x20')]=qs[_0x9181('0x20')](_0x5bffe5[_0x9181('0x44')]['offset']);}return _0x18e6db[_0x9181('0x9d')](_0x4a8bed);}})[_0x9181('0x29')](function(_0x3153ae){return _0x3153ae?{'count':_0x36738b,'rows':_0x3153ae}:null;})[_0x9181('0x29')](respondWithResult(_0x3ae2a1,null))['catch'](handleError(_0x3ae2a1,null));};exports[_0x9181('0x9e')]=function(_0x25bd8c,_0x8edb26,_0x432e62){var _0x5b7c6={};var _0x1df7e9={};var _0x29d929;var _0x311844;return db['VoiceQueue'][_0x9181('0x67')]({'where':{'id':_0x25bd8c[_0x9181('0x60')]['id']}})[_0x9181('0x29')](handleEntityNotFound(_0x8edb26,null))[_0x9181('0x29')](function(_0x438b61){if(_0x438b61){_0x29d929=_0x438b61;_0x1df7e9[_0x9181('0x40')]=_[_0x9181('0x41')](db[_0x9181('0x9f')][_0x9181('0x3d')]);_0x1df7e9[_0x9181('0x44')]=_[_0x9181('0x41')](_0x25bd8c[_0x9181('0x44')]);_0x1df7e9[_0x9181('0x42')]=_[_0x9181('0x43')](_0x1df7e9['model'],_0x1df7e9[_0x9181('0x44')]);_0x5b7c6['attributes']=_[_0x9181('0x43')](_0x1df7e9[_0x9181('0x40')],qs['fields'](_0x25bd8c[_0x9181('0x44')]['fields']));_0x5b7c6[_0x9181('0x45')]=_0x5b7c6[_0x9181('0x45')][_0x9181('0x56')]?_0x5b7c6[_0x9181('0x45')]:_0x1df7e9[_0x9181('0x40')];_0x5b7c6[_0x9181('0x49')]=qs[_0x9181('0x4a')](_0x25bd8c[_0x9181('0x44')]['sort']);_0x5b7c6[_0x9181('0x4b')]=qs[_0x9181('0x42')](_['pick'](_0x25bd8c[_0x9181('0x44')],_0x1df7e9[_0x9181('0x42')]));if(_0x25bd8c[_0x9181('0x44')][_0x9181('0x30')]){_0x5b7c6['where']=_[_0x9181('0x4d')](_0x5b7c6['where'],{'$or':_['map'](_0x5b7c6['attributes'],function(_0x147ef6){var _0x13801b={};_0x13801b[_0x147ef6]={'$like':'%'+_0x25bd8c[_0x9181('0x44')][_0x9181('0x30')]+'%'};return _0x13801b;})});}_0x5b7c6=_[_0x9181('0x4d')]({},_0x5b7c6,_0x25bd8c[_0x9181('0x4f')]);return _0x29d929[_0x9181('0x9e')](_0x5b7c6);}})[_0x9181('0x29')](function(_0x142d0a){if(_0x142d0a){_0x311844=_0x142d0a[_0x9181('0x56')];if(!_0x25bd8c['query'][_0x9181('0x47')](_0x9181('0x48'))){_0x5b7c6['limit']=qs['limit'](_0x25bd8c[_0x9181('0x44')][_0x9181('0x21')]);_0x5b7c6[_0x9181('0x20')]=qs['offset'](_0x25bd8c[_0x9181('0x44')][_0x9181('0x20')]);}return _0x29d929['getLists'](_0x5b7c6);}})[_0x9181('0x29')](function(_0x35ea85){if(_0x35ea85){return _0x35ea85?{'count':_0x311844,'rows':_0x35ea85}:null;}})['then'](respondWithResult(_0x8edb26,null))['catch'](handleError(_0x8edb26,null));};exports[_0x9181('0xa0')]=function(_0x3cccdc,_0x4b6689,_0x2405a5){var _0x3d3819,_0x312f5c;return db[_0x9181('0x51')][_0x9181('0x35')]({'where':{'id':_0x3cccdc[_0x9181('0x60')]['id']}})['then'](handleEntityNotFound(_0x4b6689,null))['then'](function(_0x3d345c){if(_0x3d345c){_0x312f5c=_0x3d345c;return _0x3d345c[_0x9181('0xa0')](_0x3cccdc[_0x9181('0x59')][_0x9181('0x86')],_['omit'](_0x3cccdc['body'],[_0x9181('0x86'),'id'])||{});}return null;})['spread'](function(_0x4599ef){var _0x275cfb;_0x3d3819=_0x4599ef||[];var _0x1ab424=[];if(_0x4599ef){for(var _0x3ea6db=0x0;_0x3ea6db<_0x4599ef[_0x9181('0x56')];_0x3ea6db+=0x1){var _0x2028f5=_0x4599ef[_0x3ea6db]['get']({'plain':!![]});_0x312f5c[_0x9181('0xa1')]=_0x3cccdc['body']['dialCheckDuplicateType']?_0x3cccdc[_0x9181('0x59')][_0x9181('0xa1')]:_0x312f5c[_0x9181('0xa1')];switch(_0x312f5c[_0x9181('0xa1')]){case _0x9181('0xa2'):_0x275cfb=squel[_0x9181('0xa3')]()[_0x9181('0xa4')](_0x9181('0xa5'))[_0x9181('0xa6')]([_0x9181('0xa7'),'scheduledAt',_0x9181('0xa8'),_0x9181('0xa9'),_0x9181('0x69'),_0x9181('0x63'),_0x9181('0x62')],squel[_0x9181('0x87')]()[_0x9181('0xaa')](_0x9181('0xa7'),'phone')[_0x9181('0xaa')](_0x9181('0xab'),'scheduledAt')[_0x9181('0xaa')]('id','ContactId')[_0x9181('0xaa')](_0x2028f5['CmListId'][_0x9181('0xac')](),'ListId')[_0x9181('0xaa')](_0x3cccdc[_0x9181('0x60')]['id'][_0x9181('0xac')](),_0x9181('0x69'))[_0x9181('0xaa')](_0x9181('0xab'),_0x9181('0x63'))[_0x9181('0xaa')](_0x9181('0xab'),_0x9181('0x62'))[_0x9181('0x89')](_0x9181('0xad'))[_0x9181('0x4b')]('deletedAt\x20IS\x20NULL')[_0x9181('0x4b')](_0x9181('0xae'),_0x2028f5[_0x9181('0xaf')][_0x9181('0xac')]())[_0x9181('0x4b')](_0x9181('0xb0'))['where'](_0x9181('0xb1'),squel['select']()[_0x9181('0xaa')](_0x9181('0xb2'))['from'](_0x9181('0xb3'))[_0x9181('0x4b')](_0x9181('0x8c'),_0x3cccdc[_0x9181('0x60')]['id'][_0x9181('0xac')]()))[_0x9181('0x4b')](_0x9181('0xb1'),squel[_0x9181('0x87')]()[_0x9181('0xaa')](_0x9181('0xb4'))[_0x9181('0x89')](_0x9181('0xa5'))[_0x9181('0x4b')](_0x9181('0x8c'),_0x3cccdc[_0x9181('0x60')]['id'][_0x9181('0xac')]())))[_0x9181('0xac')]();break;case'onlyIfOpen':_0x275cfb=squel[_0x9181('0xa3')]()[_0x9181('0xa4')]('cm_hopper')[_0x9181('0xa6')](['phone',_0x9181('0xb5'),_0x9181('0xa8'),_0x9181('0xa9'),_0x9181('0x69'),_0x9181('0x63'),'updatedAt'],squel[_0x9181('0x87')]()[_0x9181('0xaa')]('phone','phone')['field'](_0x9181('0xab'),'scheduledAt')[_0x9181('0xaa')]('id',_0x9181('0xa8'))['field'](_0x2028f5[_0x9181('0xaf')][_0x9181('0xac')](),_0x9181('0xa9'))[_0x9181('0xaa')](_0x3cccdc[_0x9181('0x60')]['id']['toString'](),_0x9181('0x69'))[_0x9181('0xaa')](_0x9181('0xab'),_0x9181('0x63'))[_0x9181('0xaa')](_0x9181('0xab'),_0x9181('0x62'))[_0x9181('0x89')](_0x9181('0xad'))[_0x9181('0x4b')]('deletedAt\x20IS\x20NULL')[_0x9181('0x4b')](_0x9181('0xae'),_0x2028f5['CmListId'][_0x9181('0xac')]())[_0x9181('0x4b')](_0x9181('0xb0'))['where'](_0x9181('0xb1'),squel[_0x9181('0x87')]()['field'](_0x9181('0xb4'))[_0x9181('0x89')](_0x9181('0xa5'))[_0x9181('0x4b')](_0x9181('0x8c'),_0x3cccdc[_0x9181('0x60')]['id'][_0x9181('0xac')]())))['toString']();break;default:_0x275cfb=squel[_0x9181('0xa3')]()[_0x9181('0xa4')](_0x9181('0xa5'))[_0x9181('0xa6')]([_0x9181('0xa7'),'scheduledAt',_0x9181('0xa8'),_0x9181('0xa9'),_0x9181('0x69'),_0x9181('0x63'),_0x9181('0x62')],squel[_0x9181('0x87')]()['field'](_0x9181('0xa7'),_0x9181('0xa7'))[_0x9181('0xaa')](_0x9181('0xab'),_0x9181('0xb5'))[_0x9181('0xaa')]('id',_0x9181('0xa8'))[_0x9181('0xaa')](_0x2028f5[_0x9181('0xaf')][_0x9181('0xac')](),_0x9181('0xa9'))[_0x9181('0xaa')](_0x3cccdc[_0x9181('0x60')]['id'][_0x9181('0xac')](),_0x9181('0x69'))[_0x9181('0xaa')]('NOW()',_0x9181('0x63'))['field'](_0x9181('0xab'),_0x9181('0x62'))[_0x9181('0x89')](_0x9181('0xad'))[_0x9181('0x4b')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x2028f5[_0x9181('0xaf')][_0x9181('0xac')]())['where'](_0x9181('0xb0')))[_0x9181('0xac')]();}_0x1ab424[_0x9181('0x8d')](db['sequelize'][_0x9181('0x44')](_0x275cfb));}return BPromise[_0x9181('0x92')](_0x1ab424);}})[_0x9181('0x29')](function(){return _0x3d3819;})[_0x9181('0x29')](respondWithResult(_0x4b6689,null))[_0x9181('0x54')](handleError(_0x4b6689,null));};exports['removeLists']=function(_0x210025,_0x41dda4,_0x530eaf){return db[_0x9181('0x51')][_0x9181('0x35')]({'where':{'id':_0x210025[_0x9181('0x60')]['id']}})[_0x9181('0x29')](handleEntityNotFound(_0x41dda4,null))[_0x9181('0x29')](function(_0x16e53c){if(_0x16e53c){return _0x16e53c[_0x9181('0xb6')](_0x210025['query'][_0x9181('0x86')]);}})[_0x9181('0x29')](function(_0x5c2d39){if(_0x5c2d39){return db[_0x9181('0x68')]['destroy']({'where':{'ListId':_0x210025['query'][_0x9181('0x86')],'VoiceQueueId':_0x210025[_0x9181('0x60')]['id']}})['then'](function(){return _0x5c2d39;});}})[_0x9181('0x29')](respondWithStatusCode(_0x41dda4,null))[_0x9181('0x54')](handleError(_0x41dda4,null));};exports[_0x9181('0xb7')]=function(_0x3dcac5,_0xe40122,_0x97f0e9){var _0x1f7e69={};var _0x4949bc={};var _0x4bd0ff;var _0x418c66;return db[_0x9181('0x51')]['findOne']({'where':{'id':_0x3dcac5['params']['id']}})[_0x9181('0x29')](handleEntityNotFound(_0xe40122,null))['then'](function(_0x32fb4b){if(_0x32fb4b){_0x4bd0ff=_0x32fb4b;_0x4949bc['model']=_[_0x9181('0x41')](db[_0x9181('0x9f')][_0x9181('0x3d')]);_0x4949bc[_0x9181('0x44')]=_[_0x9181('0x41')](_0x3dcac5[_0x9181('0x44')]);_0x4949bc[_0x9181('0x42')]=_[_0x9181('0x43')](_0x4949bc[_0x9181('0x40')],_0x4949bc[_0x9181('0x44')]);_0x1f7e69[_0x9181('0x45')]=_['intersection'](_0x4949bc[_0x9181('0x40')],qs[_0x9181('0x46')](_0x3dcac5[_0x9181('0x44')][_0x9181('0x46')]));_0x1f7e69[_0x9181('0x45')]=_0x1f7e69['attributes'][_0x9181('0x56')]?_0x1f7e69[_0x9181('0x45')]:_0x4949bc[_0x9181('0x40')];_0x1f7e69[_0x9181('0x49')]=qs[_0x9181('0x4a')](_0x3dcac5[_0x9181('0x44')][_0x9181('0x4a')]);_0x1f7e69[_0x9181('0x4b')]=qs[_0x9181('0x42')](_[_0x9181('0x4c')](_0x3dcac5['query'],_0x4949bc[_0x9181('0x42')]));if(_0x3dcac5['query'][_0x9181('0x30')]){_0x1f7e69[_0x9181('0x4b')]=_[_0x9181('0x4d')](_0x1f7e69[_0x9181('0x4b')],{'$or':_[_0x9181('0x3c')](_0x1f7e69['attributes'],function(_0x17ba38){var _0x22bb5b={};_0x22bb5b[_0x17ba38]={'$like':'%'+_0x3dcac5[_0x9181('0x44')][_0x9181('0x30')]+'%'};return _0x22bb5b;})});}_0x1f7e69=_['merge']({},_0x1f7e69,_0x3dcac5[_0x9181('0x4f')]);return _0x4bd0ff[_0x9181('0xb7')](_0x1f7e69);}})[_0x9181('0x29')](function(_0x4b73f7){if(_0x4b73f7){_0x418c66=_0x4b73f7[_0x9181('0x56')];if(!_0x3dcac5[_0x9181('0x44')]['hasOwnProperty'](_0x9181('0x48'))){_0x1f7e69[_0x9181('0x21')]=qs[_0x9181('0x21')](_0x3dcac5[_0x9181('0x44')][_0x9181('0x21')]);_0x1f7e69[_0x9181('0x20')]=qs[_0x9181('0x20')](_0x3dcac5[_0x9181('0x44')][_0x9181('0x20')]);}return _0x4bd0ff['getBlackLists'](_0x1f7e69);}})['then'](function(_0xb0da39){if(_0xb0da39){return _0xb0da39?{'count':_0x418c66,'rows':_0xb0da39}:null;}})['then'](respondWithResult(_0xe40122,null))[_0x9181('0x54')](handleError(_0xe40122,null));};exports[_0x9181('0xb8')]=function(_0x52f563,_0x5b02ab,_0x35e7ce){var _0x1e985b,_0x19f599;return db[_0x9181('0x51')]['find']({'where':{'id':_0x52f563[_0x9181('0x60')]['id']}})[_0x9181('0x29')](handleEntityNotFound(_0x5b02ab,null))[_0x9181('0x29')](function(_0x2f16da){if(_0x2f16da){_0x19f599=_0x2f16da;return _0x2f16da['addBlackLists'](_0x52f563['body'][_0x9181('0x86')],_[_0x9181('0x61')](_0x52f563['body'],[_0x9181('0x86'),'id'])||{});}return null;})[_0x9181('0x96')](function(_0x3c988c){var _0x2c2446;_0x1e985b=_0x3c988c||[];var _0x3ad131=[];if(_0x3c988c){for(var _0x643a9d=0x0;_0x643a9d<_0x3c988c[_0x9181('0x56')];_0x643a9d+=0x1){var _0x204553=_0x3c988c[_0x643a9d]['get']({'plain':!![]});_0x2c2446=squel[_0x9181('0xa3')]()['into']('cm_hopper_black')[_0x9181('0xa6')](['phone',_0x9181('0xa8'),'ListId',_0x9181('0x69'),_0x9181('0x63'),'updatedAt'],squel[_0x9181('0x87')]()[_0x9181('0xaa')](_0x9181('0xa7'),_0x9181('0xa7'))[_0x9181('0xaa')]('id',_0x9181('0xa8'))['field'](_0x204553[_0x9181('0xaf')][_0x9181('0xac')](),_0x9181('0xa9'))[_0x9181('0xaa')](_0x52f563[_0x9181('0x60')]['id'][_0x9181('0xac')](),_0x9181('0x69'))[_0x9181('0xaa')]('NOW()',_0x9181('0x63'))[_0x9181('0xaa')](_0x9181('0xab'),_0x9181('0x62'))[_0x9181('0x89')]('cm_contacts')[_0x9181('0x4b')](_0x9181('0xb9'))[_0x9181('0x4b')](_0x9181('0xae'),_0x204553[_0x9181('0xaf')][_0x9181('0xac')]())[_0x9181('0x4b')](_0x9181('0xb0')))[_0x9181('0xac')]();_0x3ad131[_0x9181('0x8d')](db[_0x9181('0x8e')]['query'](_0x2c2446));}return BPromise[_0x9181('0x92')](_0x3ad131);}})[_0x9181('0x29')](function(){return _0x1e985b;})[_0x9181('0x29')](respondWithResult(_0x5b02ab,null))['catch'](handleError(_0x5b02ab,null));};exports[_0x9181('0xba')]=function(_0xe2e408,_0x230bd3,_0x215b2a){return db[_0x9181('0x51')]['find']({'where':{'id':_0xe2e408[_0x9181('0x60')]['id']}})[_0x9181('0x29')](handleEntityNotFound(_0x230bd3,null))[_0x9181('0x29')](function(_0x478f9e){if(_0x478f9e){return _0x478f9e[_0x9181('0xba')](_0xe2e408['query'][_0x9181('0x86')]);}})[_0x9181('0x29')](function(_0x26834b){if(_0x26834b){return db['CmHopperBlack'][_0x9181('0x2a')]({'where':{'ListId':_0xe2e408[_0x9181('0x44')][_0x9181('0x86')],'VoiceQueueId':_0xe2e408[_0x9181('0x60')]['id']}})[_0x9181('0x29')](function(){return _0x26834b;});}})['then'](respondWithStatusCode(_0x230bd3,null))[_0x9181('0x54')](handleError(_0x230bd3,null));}; \ No newline at end of file +var _0x52ef=['send','index','map','VoiceQueue','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','include','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','omit','createdAt','updatedAt','VoiceQueues','outbound','userProfileId','getHoppers','VoiceQueueId','CmHopper','rows','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','User','Agents','voicePause','interface','flatMap','penalty','transaction','each','UserVoiceQueue','UserVoiceQueueRt','upsert','isNil','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','push','sequelize','QueryTypes','SELECT','every','TeamId','all','compact','isEmpty','removeAgents','addAgents','spread','online','format','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','cm_hopper','scheduledAt','ContactId','ListId','phone','CmListId','toString','NOW()','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','into','fromQuery','cm_contacts','removeLists','addBlackLists','removeBlackLists','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','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','get','inbound','QueueCampaigns','value','includes','type','find','UserProfileResource','destroy','error','stack','name'];(function(_0x3986aa,_0x2223ef){var _0x5c7d7f=function(_0x1aa23f){while(--_0x1aa23f){_0x3986aa['push'](_0x3986aa['shift']());}};_0x5c7d7f(++_0x2223ef);}(_0x52ef,0x80));var _0xf52e=function(_0x447f6d,_0x36fc29){_0x447f6d=_0x447f6d-0x0;var _0x56a9b8=_0x52ef[_0x447f6d];return _0x56a9b8;};'use strict';var emlformat=require(_0xf52e('0x0'));var rimraf=require(_0xf52e('0x1'));var zipdir=require(_0xf52e('0x2'));var jsonpatch=require(_0xf52e('0x3'));var rp=require(_0xf52e('0x4'));var moment=require('moment');var BPromise=require(_0xf52e('0x5'));var Mustache=require(_0xf52e('0x6'));var util=require(_0xf52e('0x7'));var path=require(_0xf52e('0x8'));var sox=require(_0xf52e('0x9'));var csv=require('to-csv');var ejs=require(_0xf52e('0xa'));var fs=require('fs');var fs_extra=require(_0xf52e('0xb'));var _=require(_0xf52e('0xc'));var squel=require(_0xf52e('0xd'));var crypto=require(_0xf52e('0xe'));var jsforce=require(_0xf52e('0xf'));var deskjs=require(_0xf52e('0x10'));var toCsv=require(_0xf52e('0x11'));var querystring=require(_0xf52e('0x12'));var Papa=require(_0xf52e('0x13'));var Redis=require('ioredis');var authService=require(_0xf52e('0x14'));var qs=require(_0xf52e('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf52e('0x16'));var logger=require('../../config/logger')(_0xf52e('0x17'));var utils=require(_0xf52e('0x18'));var config=require(_0xf52e('0x19'));var licenseUtil=require(_0xf52e('0x1a'));var db=require(_0xf52e('0x1b'))['db'];config['redis']=_['defaults'](config[_0xf52e('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xf52e('0x1d'))(new Redis(config[_0xf52e('0x1c')]));require(_0xf52e('0x1e'))[_0xf52e('0x1f')](socket);function respondWithStatusCode(_0x3de0df,_0x21a048){_0x21a048=_0x21a048||0xcc;return function(_0x3a7589){if(_0x3a7589){return _0x3de0df[_0xf52e('0x20')](_0x21a048);}return _0x3de0df[_0xf52e('0x21')](_0x21a048)[_0xf52e('0x22')]();};}function respondWithResult(_0x45b26e,_0x3098f2){_0x3098f2=_0x3098f2||0xc8;return function(_0x431d93){if(_0x431d93){return _0x45b26e[_0xf52e('0x21')](_0x3098f2)[_0xf52e('0x23')](_0x431d93);}};}function respondWithFilteredResult(_0x1ebd1f,_0x3ecb30){return function(_0xecb0f6){if(_0xecb0f6){var _0x2f10bc=typeof _0x3ecb30[_0xf52e('0x24')]==='undefined'&&typeof _0x3ecb30[_0xf52e('0x25')]===_0xf52e('0x26');var _0x2a5539=_0xecb0f6[_0xf52e('0x27')];var _0x4a8d98=_0x2f10bc?0x0:_0x3ecb30[_0xf52e('0x24')];var _0x1422e4=_0x2f10bc?_0xecb0f6[_0xf52e('0x27')]:_0x3ecb30[_0xf52e('0x24')]+_0x3ecb30[_0xf52e('0x25')];var _0x5718cd;if(_0x1422e4>=_0x2a5539){_0x1422e4=_0x2a5539;_0x5718cd=0xc8;}else{_0x5718cd=0xce;}_0x1ebd1f[_0xf52e('0x21')](_0x5718cd);return _0x1ebd1f['set'](_0xf52e('0x28'),_0x4a8d98+'-'+_0x1422e4+'/'+_0x2a5539)[_0xf52e('0x23')](_0xecb0f6);}return null;};}function patchUpdates(_0x3d6d1b){return function(_0x5af325){try{jsonpatch[_0xf52e('0x29')](_0x5af325,_0x3d6d1b,!![]);}catch(_0x3e7bc5){return BPromise[_0xf52e('0x2a')](_0x3e7bc5);}return _0x5af325[_0xf52e('0x2b')]();};}function saveUpdates(_0x3ab7bc,_0x288aee){return function(_0x3997cd){if(_0x3997cd){return _0x3997cd[_0xf52e('0x2c')](_0x3ab7bc)[_0xf52e('0x2d')](function(_0x5a839e){return _0x5a839e;});}return null;};}function removeEntity(_0x53c570,_0x1da5e4){return function(_0x1428c0){if(_0x1428c0){return _0x1428c0['destroy']()[_0xf52e('0x2d')](function(){var _0x406df0=_0x1428c0[_0xf52e('0x2e')]({'plain':!![]});var _0x5df542=[{'name':'VoiceQueues','value':_0xf52e('0x2f'),'ignore':![]},{'name':_0xf52e('0x30'),'value':'outbound','ignore':![]}];var _0x2618b9=_(_0x5df542)['filter']('ignore')['map'](_0xf52e('0x31'))['value']();if(_[_0xf52e('0x32')](_0x2618b9,_0x406df0[_0xf52e('0x33')])){return;}var _0x5565c7=_[_0xf52e('0x34')](_0x5df542,[_0xf52e('0x31'),_0x406df0[_0xf52e('0x33')]])['name'];return db[_0xf52e('0x35')][_0xf52e('0x36')]({'where':{'type':_0x5565c7,'resourceId':_0x406df0['id']}})[_0xf52e('0x2d')](function(){return _0x1428c0;});})['then'](function(){_0x53c570[_0xf52e('0x21')](0xcc)[_0xf52e('0x22')]();});}};}function handleEntityNotFound(_0x4a6bb4,_0x3eef22){return function(_0x1a04b8){if(!_0x1a04b8){_0x4a6bb4['sendStatus'](0x194);}return _0x1a04b8;};}function handleError(_0x202994,_0x2aec78){_0x2aec78=_0x2aec78||0x1f4;return function(_0x3e88ed){logger[_0xf52e('0x37')](_0x3e88ed[_0xf52e('0x38')]);if(_0x3e88ed[_0xf52e('0x39')]){delete _0x3e88ed[_0xf52e('0x39')];}_0x202994[_0xf52e('0x21')](_0x2aec78)[_0xf52e('0x3a')](_0x3e88ed);};}exports[_0xf52e('0x3b')]=function(_0x2e40a9,_0x33bb0e){var _0xe8e769={},_0x1625ff={},_0x52b11a={'count':0x0,'rows':[]};var _0x49594b=_[_0xf52e('0x3c')](db[_0xf52e('0x3d')][_0xf52e('0x3e')],function(_0x3443fb){return{'name':_0x3443fb[_0xf52e('0x3f')],'type':_0x3443fb['type']['key']};});_0x1625ff[_0xf52e('0x40')]=_[_0xf52e('0x3c')](_0x49594b,_0xf52e('0x39'));_0x1625ff['query']=_[_0xf52e('0x41')](_0x2e40a9[_0xf52e('0x42')]);_0x1625ff[_0xf52e('0x43')]=_[_0xf52e('0x44')](_0x1625ff['model'],_0x1625ff[_0xf52e('0x42')]);_0xe8e769[_0xf52e('0x45')]=_[_0xf52e('0x44')](_0x1625ff[_0xf52e('0x40')],qs[_0xf52e('0x46')](_0x2e40a9['query']['fields']));_0xe8e769[_0xf52e('0x45')]=_0xe8e769[_0xf52e('0x45')][_0xf52e('0x47')]?_0xe8e769[_0xf52e('0x45')]:_0x1625ff['model'];if(!_0x2e40a9[_0xf52e('0x42')][_0xf52e('0x48')](_0xf52e('0x49'))){_0xe8e769[_0xf52e('0x25')]=qs[_0xf52e('0x25')](_0x2e40a9[_0xf52e('0x42')][_0xf52e('0x25')]);_0xe8e769[_0xf52e('0x24')]=qs[_0xf52e('0x24')](_0x2e40a9[_0xf52e('0x42')][_0xf52e('0x24')]);}_0xe8e769[_0xf52e('0x4a')]=qs[_0xf52e('0x4b')](_0x2e40a9[_0xf52e('0x42')]['sort']);_0xe8e769[_0xf52e('0x4c')]=qs[_0xf52e('0x43')](_[_0xf52e('0x4d')](_0x2e40a9['query'],_0x1625ff[_0xf52e('0x43')]),_0x49594b);if(_0x2e40a9['query'][_0xf52e('0x4e')]){_0xe8e769[_0xf52e('0x4c')]=_[_0xf52e('0x4f')](_0xe8e769['where'],{'$or':_[_0xf52e('0x3c')](_0x49594b,function(_0xaee4fd){if(_0xaee4fd['type']!==_0xf52e('0x50')){var _0x2336eb={};_0x2336eb[_0xaee4fd[_0xf52e('0x39')]]={'$like':'%'+_0x2e40a9[_0xf52e('0x42')][_0xf52e('0x4e')]+'%'};return _0x2336eb;}})});}_0xe8e769=_[_0xf52e('0x4f')]({},_0xe8e769,_0x2e40a9[_0xf52e('0x51')]);var _0x1df319={'where':_0xe8e769[_0xf52e('0x4c')]};return db[_0xf52e('0x3d')]['count'](_0x1df319)[_0xf52e('0x2d')](function(_0x426c8c){_0x52b11a['count']=_0x426c8c;if(_0x2e40a9[_0xf52e('0x42')][_0xf52e('0x52')]){_0xe8e769['include']=[{'all':!![]}];}return db[_0xf52e('0x3d')][_0xf52e('0x53')](_0xe8e769);})['then'](function(_0x361dfb){_0x52b11a['rows']=_0x361dfb;return _0x52b11a;})[_0xf52e('0x2d')](respondWithFilteredResult(_0x33bb0e,_0xe8e769))[_0xf52e('0x54')](handleError(_0x33bb0e,null));};exports[_0xf52e('0x55')]=function(_0x29b09a,_0xb2c406){var _0x4983fe={'raw':![],'where':{'id':_0x29b09a['params']['id']}},_0x467ca9={};_0x467ca9[_0xf52e('0x40')]=_[_0xf52e('0x41')](db[_0xf52e('0x3d')][_0xf52e('0x3e')]);_0x467ca9['query']=_[_0xf52e('0x41')](_0x29b09a['query']);_0x467ca9[_0xf52e('0x43')]=_[_0xf52e('0x44')](_0x467ca9[_0xf52e('0x40')],_0x467ca9[_0xf52e('0x42')]);_0x4983fe[_0xf52e('0x45')]=_[_0xf52e('0x44')](_0x467ca9[_0xf52e('0x40')],qs['fields'](_0x29b09a[_0xf52e('0x42')][_0xf52e('0x46')]));_0x4983fe[_0xf52e('0x45')]=_0x4983fe['attributes'][_0xf52e('0x47')]?_0x4983fe[_0xf52e('0x45')]:_0x467ca9['model'];if(_0x29b09a['query'][_0xf52e('0x52')]){_0x4983fe[_0xf52e('0x56')]=[{'all':!![]}];}_0x4983fe=_[_0xf52e('0x4f')]({},_0x4983fe,_0x29b09a['options']);return db['VoiceQueue'][_0xf52e('0x34')](_0x4983fe)['then'](handleEntityNotFound(_0xb2c406,null))[_0xf52e('0x2d')](respondWithResult(_0xb2c406,null))[_0xf52e('0x54')](handleError(_0xb2c406,null));};exports['create']=function(_0x13a5bf,_0x20d711){return db[_0xf52e('0x3d')]['create'](_0x13a5bf[_0xf52e('0x57')],{})[_0xf52e('0x2d')](function(_0x4fbb63){var _0x53cbc0=_0x13a5bf[_0xf52e('0x58')][_0xf52e('0x2e')]({'plain':!![]});if(!_0x53cbc0)throw new Error(_0xf52e('0x59'));if(_0x53cbc0[_0xf52e('0x5a')]===_0xf52e('0x58')){var _0x52c69b=_0x4fbb63[_0xf52e('0x2e')]({'plain':!![]});var _0x4a26a9=[{'name':'VoiceQueues','value':_0xf52e('0x2f')},{'name':_0xf52e('0x30'),'value':'outbound'}];var _0x30a78c=_[_0xf52e('0x34')](_0x4a26a9,['value',_0x52c69b[_0xf52e('0x33')]])['name'];return db[_0xf52e('0x5b')][_0xf52e('0x34')]({'where':{'name':_0x30a78c,'userProfileId':_0x53cbc0['userProfileId']},'raw':!![]})[_0xf52e('0x2d')](function(_0x40e7bc){if(_0x40e7bc&&_0x40e7bc[_0xf52e('0x5c')]===0x0){return db[_0xf52e('0x35')][_0xf52e('0x5d')]({'name':_0x52c69b[_0xf52e('0x39')],'resourceId':_0x52c69b['id'],'type':_0x40e7bc[_0xf52e('0x39')],'sectionId':_0x40e7bc['id']},{})['then'](function(){return _0x4fbb63;});}else{return _0x4fbb63;}})['catch'](function(_0x39a30d){logger['error'](_0xf52e('0x5e'),_0x39a30d);throw _0x39a30d;});}return _0x4fbb63;})['then'](respondWithResult(_0x20d711,0xc9))['catch'](handleError(_0x20d711,null));};exports['clone']=function(_0x24df7b,_0x32b456){var _0xbb09ae={'where':{'id':_0x24df7b[_0xf52e('0x5f')]['id']}},_0x35e341={};_0x35e341[_0xf52e('0x40')]=_[_0xf52e('0x41')](db[_0xf52e('0x3d')][_0xf52e('0x3e')]);_0xbb09ae[_0xf52e('0x45')]=_['intersection'](_0x35e341[_0xf52e('0x40')],qs[_0xf52e('0x46')](_0x24df7b[_0xf52e('0x42')][_0xf52e('0x46')]));_0xbb09ae[_0xf52e('0x45')]=_0xbb09ae[_0xf52e('0x45')]['length']?_0xbb09ae[_0xf52e('0x45')]:_0x35e341['model'];if(_0x24df7b[_0xf52e('0x42')]['includeAll']){_0xbb09ae[_0xf52e('0x56')]=[{'all':!![]}];}_0xbb09ae=_['merge']({},_0xbb09ae,_0x24df7b[_0xf52e('0x51')]);return db[_0xf52e('0x3d')][_0xf52e('0x34')](_0xbb09ae)[_0xf52e('0x2d')](handleEntityNotFound(_0x32b456,null))['then'](function(_0x2f5912){if(_0x2f5912){var _0x112f45=_0x2f5912[_0xf52e('0x2e')]({'plain':!![]});_0x112f45=qs[_0xf52e('0x60')](_0x112f45,['id',_0xf52e('0x61'),_0xf52e('0x62')]);_0x24df7b[_0xf52e('0x57')]=_[_0xf52e('0x60')](_0x24df7b[_0xf52e('0x57')],['id',_0xf52e('0x61'),'updatedAt']);return db[_0xf52e('0x3d')][_0xf52e('0x5d')](_[_0xf52e('0x4f')](_0x112f45,_0x24df7b[_0xf52e('0x57')]),{'include':_0x24df7b[_0xf52e('0x42')][_0xf52e('0x52')]?[{'all':!![]}]:undefined})[_0xf52e('0x2d')](function(_0x11a4c9){var _0x554d55=_0x24df7b['user'][_0xf52e('0x2e')]({'plain':!![]});if(!_0x554d55)throw new Error(_0xf52e('0x59'));if(_0x554d55['role']===_0xf52e('0x58')){var _0x1ca555=_0x11a4c9['get']({'plain':!![]});var _0x1a6fc0=[{'name':_0xf52e('0x63'),'value':_0xf52e('0x2f')},{'name':'QueueCampaigns','value':_0xf52e('0x64')}];var _0x2eff82=_[_0xf52e('0x34')](_0x1a6fc0,[_0xf52e('0x31'),_0x1ca555[_0xf52e('0x33')]])[_0xf52e('0x39')];return db[_0xf52e('0x5b')][_0xf52e('0x34')]({'where':{'name':_0x2eff82,'userProfileId':_0x554d55[_0xf52e('0x65')]},'raw':!![]})[_0xf52e('0x2d')](function(_0x1c26f5){if(_0x1c26f5&&_0x1c26f5[_0xf52e('0x5c')]===0x0){return db[_0xf52e('0x35')][_0xf52e('0x5d')]({'name':_0x1ca555[_0xf52e('0x39')],'resourceId':_0x1ca555['id'],'type':_0x1c26f5[_0xf52e('0x39')],'sectionId':_0x1c26f5['id']},{})['then'](function(){return _0x11a4c9;});}else{return _0x11a4c9;}})[_0xf52e('0x54')](function(_0x7e3d0d){logger[_0xf52e('0x37')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x7e3d0d);throw _0x7e3d0d;});}return _0x11a4c9;});}})[_0xf52e('0x2d')](respondWithResult(_0x32b456,0xc9))[_0xf52e('0x54')](handleError(_0x32b456,null));};exports['update']=function(_0x1ed17d,_0x11e00b){if(_0x1ed17d[_0xf52e('0x57')]['id']){delete _0x1ed17d['body']['id'];}return db[_0xf52e('0x3d')][_0xf52e('0x34')]({'where':{'id':_0x1ed17d[_0xf52e('0x5f')]['id']}})[_0xf52e('0x2d')](handleEntityNotFound(_0x11e00b,null))[_0xf52e('0x2d')](saveUpdates(_0x1ed17d[_0xf52e('0x57')],null))['then'](respondWithResult(_0x11e00b,null))[_0xf52e('0x54')](handleError(_0x11e00b,null));};exports[_0xf52e('0x36')]=function(_0x4acd75,_0x40f780){return db[_0xf52e('0x3d')]['find']({'where':{'id':_0x4acd75[_0xf52e('0x5f')]['id']}})[_0xf52e('0x2d')](handleEntityNotFound(_0x40f780,null))[_0xf52e('0x2d')](removeEntity(_0x40f780,null))['catch'](handleError(_0x40f780,null));};exports[_0xf52e('0x66')]=function(_0x3cb4c8,_0x40177e,_0x2e0c01){var _0x31cd58={'raw':![],'where':{}};var _0x1df880={};var _0x59de0d={'count':0x0,'rows':[]};return db[_0xf52e('0x3d')]['findOne']({'where':{'id':_0x3cb4c8[_0xf52e('0x5f')]['id']}})['then'](handleEntityNotFound(_0x40177e,null))[_0xf52e('0x2d')](function(_0x406b44){if(_0x406b44){_0x1df880[_0xf52e('0x40')]=_[_0xf52e('0x41')](db['CmHopper'][_0xf52e('0x3e')]);_0x1df880['query']=_[_0xf52e('0x41')](_0x3cb4c8[_0xf52e('0x42')]);_0x1df880[_0xf52e('0x43')]=_[_0xf52e('0x44')](_0x1df880[_0xf52e('0x40')],_0x1df880[_0xf52e('0x42')]);_0x31cd58[_0xf52e('0x45')]=_['intersection'](_0x1df880['model'],qs[_0xf52e('0x46')](_0x3cb4c8[_0xf52e('0x42')][_0xf52e('0x46')]));_0x31cd58[_0xf52e('0x45')]=_0x31cd58[_0xf52e('0x45')][_0xf52e('0x47')]?_0x31cd58[_0xf52e('0x45')]:_0x1df880[_0xf52e('0x40')];if(!_0x3cb4c8[_0xf52e('0x42')][_0xf52e('0x48')](_0xf52e('0x49'))){_0x31cd58[_0xf52e('0x25')]=qs[_0xf52e('0x25')](_0x3cb4c8[_0xf52e('0x42')][_0xf52e('0x25')]);_0x31cd58[_0xf52e('0x24')]=qs[_0xf52e('0x24')](_0x3cb4c8['query'][_0xf52e('0x24')]);}_0x31cd58[_0xf52e('0x4a')]=qs[_0xf52e('0x4b')](_0x3cb4c8[_0xf52e('0x42')]['sort']);_0x31cd58[_0xf52e('0x4c')]=qs[_0xf52e('0x43')](_[_0xf52e('0x4d')](_0x3cb4c8['query'],_0x1df880[_0xf52e('0x43')]));_0x31cd58[_0xf52e('0x4c')][_0xf52e('0x67')]=_0x406b44['id'];if(_0x3cb4c8[_0xf52e('0x42')]['filter']){_0x31cd58[_0xf52e('0x4c')]=_['merge'](_0x31cd58[_0xf52e('0x4c')],{'$or':_[_0xf52e('0x3c')](_0x31cd58['attributes'],function(_0x4ed5e6){var _0x5441c2={};_0x5441c2[_0x4ed5e6]={'$like':'%'+_0x3cb4c8[_0xf52e('0x42')][_0xf52e('0x4e')]+'%'};return _0x5441c2;})});}_0x31cd58=_[_0xf52e('0x4f')]({},_0x31cd58,_0x3cb4c8[_0xf52e('0x51')]);return db[_0xf52e('0x68')][_0xf52e('0x27')]({'where':_0x31cd58[_0xf52e('0x4c')]})[_0xf52e('0x2d')](function(_0x3c5363){_0x59de0d['count']=_0x3c5363;if(_0x3cb4c8['query'][_0xf52e('0x52')]){_0x31cd58['include']=[{'all':!![]}];}return db[_0xf52e('0x68')][_0xf52e('0x53')](_0x31cd58);})[_0xf52e('0x2d')](function(_0x2bb1ee){_0x59de0d[_0xf52e('0x69')]=_0x2bb1ee;return _0x59de0d;});}})[_0xf52e('0x2d')](respondWithFilteredResult(_0x40177e,_0x31cd58))[_0xf52e('0x54')](handleError(_0x40177e,null));};exports[_0xf52e('0x6a')]=function(_0xa82fe4,_0x16e74f,_0x115177){var _0x55965d={'raw':!![],'where':{}};var _0x476b43={};var _0x54d08f={'count':0x0,'rows':[]};return db[_0xf52e('0x3d')][_0xf52e('0x6b')]({'where':{'id':_0xa82fe4['params']['id']}})[_0xf52e('0x2d')](handleEntityNotFound(_0x16e74f,null))['then'](function(_0x388ea8){if(_0x388ea8){_0x476b43['model']=_[_0xf52e('0x41')](db['CmHopperHistory'][_0xf52e('0x3e')]);_0x476b43[_0xf52e('0x42')]=_[_0xf52e('0x41')](_0xa82fe4[_0xf52e('0x42')]);_0x476b43[_0xf52e('0x43')]=_[_0xf52e('0x44')](_0x476b43['model'],_0x476b43[_0xf52e('0x42')]);_0x55965d[_0xf52e('0x45')]=_[_0xf52e('0x44')](_0x476b43['model'],qs['fields'](_0xa82fe4[_0xf52e('0x42')][_0xf52e('0x46')]));_0x55965d[_0xf52e('0x45')]=_0x55965d['attributes'][_0xf52e('0x47')]?_0x55965d[_0xf52e('0x45')]:_0x476b43['model'];if(!_0xa82fe4['query'][_0xf52e('0x48')](_0xf52e('0x49'))){_0x55965d[_0xf52e('0x25')]=qs[_0xf52e('0x25')](_0xa82fe4[_0xf52e('0x42')][_0xf52e('0x25')]);_0x55965d[_0xf52e('0x24')]=qs[_0xf52e('0x24')](_0xa82fe4[_0xf52e('0x42')][_0xf52e('0x24')]);}_0x55965d[_0xf52e('0x4a')]=qs[_0xf52e('0x4b')](_0xa82fe4[_0xf52e('0x42')][_0xf52e('0x4b')]);_0x55965d[_0xf52e('0x4c')]=qs[_0xf52e('0x43')](_['pick'](_0xa82fe4['query'],_0x476b43[_0xf52e('0x43')]));_0x55965d[_0xf52e('0x4c')][_0xf52e('0x67')]=_0x388ea8['id'];if(_0xa82fe4[_0xf52e('0x42')][_0xf52e('0x4e')]){_0x55965d[_0xf52e('0x4c')]=_[_0xf52e('0x4f')](_0x55965d[_0xf52e('0x4c')],{'$or':_['map'](_0x55965d[_0xf52e('0x45')],function(_0x501e03){var _0x21654a={};_0x21654a[_0x501e03]={'$like':'%'+_0xa82fe4[_0xf52e('0x42')][_0xf52e('0x4e')]+'%'};return _0x21654a;})});}_0x55965d=_[_0xf52e('0x4f')]({},_0x55965d,_0xa82fe4[_0xf52e('0x51')]);return db[_0xf52e('0x6c')][_0xf52e('0x27')]({'where':_0x55965d[_0xf52e('0x4c')]})[_0xf52e('0x2d')](function(_0x2c4ff1){_0x54d08f[_0xf52e('0x27')]=_0x2c4ff1;if(_0xa82fe4[_0xf52e('0x42')]['includeAll']){_0x55965d[_0xf52e('0x56')]=[{'all':!![]}];}return db[_0xf52e('0x6c')]['findAll'](_0x55965d);})['then'](function(_0x5bcdf6){_0x54d08f[_0xf52e('0x69')]=_0x5bcdf6;return _0x54d08f;});}})['then'](respondWithFilteredResult(_0x16e74f,_0x55965d))[_0xf52e('0x54')](handleError(_0x16e74f,null));};exports[_0xf52e('0x6d')]=function(_0x1b5b44,_0x1513fc,_0x10b7ca){var _0x1eaafe={'raw':!![],'where':{}};var _0x19f121={};var _0x139d0e={'count':0x0,'rows':[]};return db[_0xf52e('0x3d')][_0xf52e('0x6b')]({'where':{'id':_0x1b5b44[_0xf52e('0x5f')]['id']}})[_0xf52e('0x2d')](handleEntityNotFound(_0x1513fc,null))['then'](function(_0x14b704){if(_0x14b704){_0x19f121['model']=_[_0xf52e('0x41')](db[_0xf52e('0x6e')]['rawAttributes']);_0x19f121[_0xf52e('0x42')]=_['keys'](_0x1b5b44[_0xf52e('0x42')]);_0x19f121[_0xf52e('0x43')]=_['intersection'](_0x19f121[_0xf52e('0x40')],_0x19f121[_0xf52e('0x42')]);_0x1eaafe[_0xf52e('0x45')]=_[_0xf52e('0x44')](_0x19f121['model'],qs['fields'](_0x1b5b44[_0xf52e('0x42')][_0xf52e('0x46')]));_0x1eaafe[_0xf52e('0x45')]=_0x1eaafe[_0xf52e('0x45')][_0xf52e('0x47')]?_0x1eaafe[_0xf52e('0x45')]:_0x19f121['model'];if(!_0x1b5b44[_0xf52e('0x42')][_0xf52e('0x48')](_0xf52e('0x49'))){_0x1eaafe[_0xf52e('0x25')]=qs[_0xf52e('0x25')](_0x1b5b44[_0xf52e('0x42')]['limit']);_0x1eaafe[_0xf52e('0x24')]=qs['offset'](_0x1b5b44[_0xf52e('0x42')][_0xf52e('0x24')]);}_0x1eaafe[_0xf52e('0x4a')]=qs[_0xf52e('0x4b')](_0x1b5b44[_0xf52e('0x42')]['sort']);_0x1eaafe[_0xf52e('0x4c')]=qs[_0xf52e('0x43')](_[_0xf52e('0x4d')](_0x1b5b44[_0xf52e('0x42')],_0x19f121['filters']));_0x1eaafe['where']['VoiceQueueId']=_0x14b704['id'];if(_0x1b5b44[_0xf52e('0x42')][_0xf52e('0x4e')]){_0x1eaafe[_0xf52e('0x4c')]=_['merge'](_0x1eaafe[_0xf52e('0x4c')],{'$or':_[_0xf52e('0x3c')](_0x1eaafe[_0xf52e('0x45')],function(_0x4f9002){var _0x586cf2={};_0x586cf2[_0x4f9002]={'$like':'%'+_0x1b5b44['query'][_0xf52e('0x4e')]+'%'};return _0x586cf2;})});}_0x1eaafe=_[_0xf52e('0x4f')]({},_0x1eaafe,_0x1b5b44['options']);return db['CmHopperFinal']['count']({'where':_0x1eaafe[_0xf52e('0x4c')]})[_0xf52e('0x2d')](function(_0x260714){_0x139d0e[_0xf52e('0x27')]=_0x260714;if(_0x1b5b44[_0xf52e('0x42')][_0xf52e('0x52')]){_0x1eaafe['include']=[{'all':!![]}];}return db[_0xf52e('0x6e')]['findAll'](_0x1eaafe);})[_0xf52e('0x2d')](function(_0x327655){_0x139d0e[_0xf52e('0x69')]=_0x327655;return _0x139d0e;});}})[_0xf52e('0x2d')](respondWithFilteredResult(_0x1513fc,_0x1eaafe))['catch'](handleError(_0x1513fc,null));};exports[_0xf52e('0x6f')]=function(_0xe40319,_0x160446,_0x2e4b7e){var _0x227b77={'raw':!![],'where':{}};var _0x4b2ff9={};var _0x2d9391={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0xe40319['params']['id']}})[_0xf52e('0x2d')](handleEntityNotFound(_0x160446,null))[_0xf52e('0x2d')](function(_0x3cacb6){if(_0x3cacb6){_0x4b2ff9['model']=_['keys'](db[_0xf52e('0x70')][_0xf52e('0x3e')]);_0x4b2ff9[_0xf52e('0x42')]=_[_0xf52e('0x41')](_0xe40319[_0xf52e('0x42')]);_0x4b2ff9['filters']=_[_0xf52e('0x44')](_0x4b2ff9[_0xf52e('0x40')],_0x4b2ff9['query']);_0x227b77[_0xf52e('0x45')]=_[_0xf52e('0x44')](_0x4b2ff9[_0xf52e('0x40')],qs['fields'](_0xe40319[_0xf52e('0x42')]['fields']));_0x227b77[_0xf52e('0x45')]=_0x227b77[_0xf52e('0x45')][_0xf52e('0x47')]?_0x227b77[_0xf52e('0x45')]:_0x4b2ff9[_0xf52e('0x40')];if(!_0xe40319[_0xf52e('0x42')][_0xf52e('0x48')](_0xf52e('0x49'))){_0x227b77[_0xf52e('0x25')]=qs[_0xf52e('0x25')](_0xe40319[_0xf52e('0x42')][_0xf52e('0x25')]);_0x227b77[_0xf52e('0x24')]=qs['offset'](_0xe40319['query']['offset']);}_0x227b77[_0xf52e('0x4a')]=qs[_0xf52e('0x4b')](_0xe40319[_0xf52e('0x42')][_0xf52e('0x4b')]);_0x227b77[_0xf52e('0x4c')]=qs[_0xf52e('0x43')](_[_0xf52e('0x4d')](_0xe40319[_0xf52e('0x42')],_0x4b2ff9['filters']));_0x227b77[_0xf52e('0x4c')][_0xf52e('0x67')]=_0x3cacb6['id'];if(_0xe40319[_0xf52e('0x42')][_0xf52e('0x4e')]){_0x227b77['where']=_[_0xf52e('0x4f')](_0x227b77[_0xf52e('0x4c')],{'$or':_['map'](_0x227b77[_0xf52e('0x45')],function(_0x589ec8){var _0x4d5deb={};_0x4d5deb[_0x589ec8]={'$like':'%'+_0xe40319['query'][_0xf52e('0x4e')]+'%'};return _0x4d5deb;})});}_0x227b77=_[_0xf52e('0x4f')]({},_0x227b77,_0xe40319[_0xf52e('0x51')]);return db[_0xf52e('0x70')]['count']({'where':_0x227b77[_0xf52e('0x4c')]})[_0xf52e('0x2d')](function(_0x16aa2c){_0x2d9391[_0xf52e('0x27')]=_0x16aa2c;if(_0xe40319[_0xf52e('0x42')][_0xf52e('0x52')]){_0x227b77[_0xf52e('0x56')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x227b77);})[_0xf52e('0x2d')](function(_0x715829){_0x2d9391[_0xf52e('0x69')]=_0x715829;return _0x2d9391;});}})[_0xf52e('0x2d')](respondWithFilteredResult(_0x160446,_0x227b77))[_0xf52e('0x54')](handleError(_0x160446,null));};exports['getTeams']=function(_0xb9ce4f,_0x14f9b5,_0x5da000){var _0x227c11={};var _0xb4138e={};var _0x3eba29;var _0x36124c;return db[_0xf52e('0x3d')]['findOne']({'where':{'id':_0xb9ce4f[_0xf52e('0x5f')]['id']}})[_0xf52e('0x2d')](handleEntityNotFound(_0x14f9b5,null))[_0xf52e('0x2d')](function(_0x3819bd){if(_0x3819bd){_0x3eba29=_0x3819bd;_0xb4138e[_0xf52e('0x40')]=_[_0xf52e('0x41')](db[_0xf52e('0x71')]['rawAttributes']);_0xb4138e[_0xf52e('0x42')]=_[_0xf52e('0x41')](_0xb9ce4f[_0xf52e('0x42')]);_0xb4138e[_0xf52e('0x43')]=_[_0xf52e('0x44')](_0xb4138e['model'],_0xb4138e[_0xf52e('0x42')]);_0x227c11[_0xf52e('0x45')]=_[_0xf52e('0x44')](_0xb4138e[_0xf52e('0x40')],qs[_0xf52e('0x46')](_0xb9ce4f[_0xf52e('0x42')]['fields']));_0x227c11[_0xf52e('0x45')]=_0x227c11['attributes'][_0xf52e('0x47')]?_0x227c11[_0xf52e('0x45')]:_0xb4138e['model'];_0x227c11[_0xf52e('0x4a')]=qs[_0xf52e('0x4b')](_0xb9ce4f['query'][_0xf52e('0x4b')]);_0x227c11[_0xf52e('0x4c')]=qs['filters'](_[_0xf52e('0x4d')](_0xb9ce4f[_0xf52e('0x42')],_0xb4138e['filters']));if(_0xb9ce4f[_0xf52e('0x42')]['filter']){_0x227c11[_0xf52e('0x4c')]=_[_0xf52e('0x4f')](_0x227c11[_0xf52e('0x4c')],{'$or':_[_0xf52e('0x3c')](_0x227c11[_0xf52e('0x45')],function(_0x70128e){var _0x59a47e={};_0x59a47e[_0x70128e]={'$like':'%'+_0xb9ce4f[_0xf52e('0x42')][_0xf52e('0x4e')]+'%'};return _0x59a47e;})});}_0x227c11=_['merge']({},_0x227c11,_0xb9ce4f[_0xf52e('0x51')]);return _0x3eba29[_0xf52e('0x72')](_0x227c11);}})['then'](function(_0x24a5a6){if(_0x24a5a6){_0x36124c=_0x24a5a6[_0xf52e('0x47')];if(!_0xb9ce4f[_0xf52e('0x42')][_0xf52e('0x48')](_0xf52e('0x49'))){_0x227c11[_0xf52e('0x25')]=qs[_0xf52e('0x25')](_0xb9ce4f[_0xf52e('0x42')][_0xf52e('0x25')]);_0x227c11['offset']=qs['offset'](_0xb9ce4f[_0xf52e('0x42')][_0xf52e('0x24')]);}return _0x3eba29[_0xf52e('0x72')](_0x227c11);}})[_0xf52e('0x2d')](function(_0x2e6851){if(_0x2e6851){return _0x2e6851?{'count':_0x36124c,'rows':_0x2e6851}:null;}})['then'](respondWithResult(_0x14f9b5,null))[_0xf52e('0x54')](handleError(_0x14f9b5,null));};exports[_0xf52e('0x73')]=function(_0x1ce2d5,_0x2e3163,_0x3dbeef){var _0x5a19bd=_0x1ce2d5[_0xf52e('0x57')]['teams'];var _0x2b8bb6=_[_0xf52e('0x3c')](_0x5a19bd,'id');return db[_0xf52e('0x71')][_0xf52e('0x53')]({'where':{'id':_0x2b8bb6},'attributes':['id'],'include':[{'model':db[_0xf52e('0x74')],'as':_0xf52e('0x75'),'attributes':['id',_0xf52e('0x39'),'online',_0xf52e('0x76'),_0xf52e('0x77')],'raw':!![]}]})[_0xf52e('0x2d')](function(_0x5eeb4c){if(_0x5eeb4c){var _0x3430c9=_[_0xf52e('0x78')](_0x5eeb4c,function(_0x42a51a){var _0x1ac848=_0x42a51a[_0xf52e('0x2e')]({'plain':!![]});_0x1ac848[_0xf52e('0x75')]['forEach'](function(_0x542caf){_0x542caf[_0xf52e('0x79')]=_[_0xf52e('0x34')](_0x5a19bd,{'id':_0x1ac848['id']})[_0xf52e('0x79')];});return _0x1ac848[_0xf52e('0x75')];});return db[_0xf52e('0x3d')][_0xf52e('0x34')]({'where':{'id':_0x1ce2d5[_0xf52e('0x5f')]['id']}})['then'](function(_0x31a6cc){return db['sequelize'][_0xf52e('0x7a')](function(_0x16ecee){return _0x31a6cc['addTeams'](_0x2b8bb6,{'transaction':_0x16ecee})[_0xf52e('0x2d')](function(){return BPromise[_0xf52e('0x7b')](_0x5a19bd,function(_0x44554b){return db['TeamVoiceQueue']['upsert']({'TeamId':_0x44554b['id'],'VoiceQueueId':_0x1ce2d5[_0xf52e('0x5f')]['id'],'penalty':_0x44554b['penalty']},{'transaction':_0x16ecee});});})['then'](function(){return BPromise[_0xf52e('0x7b')](_0x3430c9,function(_0x5bedb3){return db[_0xf52e('0x7c')]['findOrCreate']({'where':{'UserId':_0x5bedb3['id'],'VoiceQueueId':_0x1ce2d5[_0xf52e('0x5f')]['id']},'defaults':{'penalty':_0x5bedb3['penalty']},'transaction':_0x16ecee});});})['then'](function(){return BPromise[_0xf52e('0x7b')](_[_0xf52e('0x4e')](_0x3430c9,{'online':!![]}),function(_0x55d12){return db[_0xf52e('0x7d')][_0xf52e('0x7e')]({'membername':_0x55d12[_0xf52e('0x39')],'UserId':_0x55d12['id'],'queue_name':_0x31a6cc[_0xf52e('0x39')],'VoiceQueueId':_0x31a6cc['id'],'interface':_[_0xf52e('0x7f')](_0x55d12[_0xf52e('0x77')])?util['format'](_0xf52e('0x80'),_0x55d12['name']):_0x55d12[_0xf52e('0x77')],'paused':_0x55d12[_0xf52e('0x76')]||![],'penalty':_0x55d12[_0xf52e('0x79')]},{'transaction':_0x16ecee});});})[_0xf52e('0x2d')](function(){_0x3430c9[_0xf52e('0x81')](function(_0x3d13d4){socket[_0xf52e('0x82')](_0xf52e('0x83'),{'UserId':_0x3d13d4['id'],'VoiceQueueId':_0x31a6cc['id']});});});});});}})[_0xf52e('0x2d')](respondWithStatusCode(_0x2e3163,null))[_0xf52e('0x54')](handleError(_0x2e3163,null));};exports[_0xf52e('0x84')]=function(_0x580942,_0x3aa70f,_0xb075cb){return db['Team'][_0xf52e('0x53')]({'where':{'id':_0x580942[_0xf52e('0x42')][_0xf52e('0x85')]},'attributes':['id'],'include':[{'model':db[_0xf52e('0x74')],'as':_0xf52e('0x75'),'attributes':['id'],'raw':!![]}]})[_0xf52e('0x2d')](handleEntityNotFound(_0x3aa70f,null))[_0xf52e('0x2d')](function(_0x3ff0ff){var _0x449345=_[_0xf52e('0x3c')](_0x3ff0ff,'id');var _0xb25e8=[];var _0x2715ec=[];var _0x164ba0=squel[_0xf52e('0x86')]();_0x164ba0[_0xf52e('0x87')](_0xf52e('0x88'))['from']('team_has_voice_queues','tq')[_0xf52e('0x89')](_0xf52e('0x8a'),'ut',_0xf52e('0x8b'))[_0xf52e('0x4c')](_0xf52e('0x8c'),_0x580942[_0xf52e('0x5f')]['id']);for(var _0x354a48=0x0;_0x354a48<_0x3ff0ff['length'];_0x354a48+=0x1){let _0x518dd7=_0x3ff0ff[_0x354a48];for(var _0x3b8094=0x0;_0x3b8094<_0x518dd7[_0xf52e('0x75')][_0xf52e('0x47')];_0x3b8094+=0x1){let _0x15a849=_0x518dd7['Agents'][_0x3b8094];var _0x27a45f=_0x164ba0[_0xf52e('0x8d')]();_0x27a45f[_0xf52e('0x4c')]('ut.UserId\x20=\x20?',_0x15a849['id']);_0x2715ec[_0xf52e('0x8e')](db[_0xf52e('0x8f')][_0xf52e('0x42')](_0x27a45f['toString'](),{'type':db[_0xf52e('0x8f')][_0xf52e('0x90')][_0xf52e('0x91')]})['then'](function(_0x383f06){if(_0x383f06[_0xf52e('0x47')]===0x1){return _0x15a849['id'];}else{var _0x2f445f=_[_0xf52e('0x92')](_[_0xf52e('0x3c')](_0x383f06,_0xf52e('0x93')),function(_0x275b50){return _[_0xf52e('0x32')](_0x449345,_0x275b50);});if(_0x2f445f){return _0x15a849['id'];}}}));}}return BPromise[_0xf52e('0x94')](_0x2715ec)['then'](function(_0x554d49){_0xb25e8=_(_0xb25e8)['union'](_0x554d49)[_0xf52e('0x95')]()['value']();return db[_0xf52e('0x3d')][_0xf52e('0x34')]({'where':{'id':_0x580942[_0xf52e('0x5f')]['id']}})[_0xf52e('0x2d')](function(_0x13e1bb){return db['sequelize'][_0xf52e('0x7a')](function(_0x30deb4){return _0x13e1bb[_0xf52e('0x84')](_0x580942[_0xf52e('0x42')][_0xf52e('0x85')],{'transaction':_0x30deb4})[_0xf52e('0x2d')](function(){if(!_[_0xf52e('0x96')](_0xb25e8)){return _0x13e1bb[_0xf52e('0x97')](_0xb25e8,{'transaction':_0x30deb4})[_0xf52e('0x2d')](function(){return db[_0xf52e('0x7d')][_0xf52e('0x36')]({'where':{'VoiceQueueId':_0x580942[_0xf52e('0x5f')]['id'],'UserId':_0xb25e8},'transaction':_0x30deb4});});}})[_0xf52e('0x2d')](function(){_0xb25e8[_0xf52e('0x81')](function(_0x5a63cc){socket[_0xf52e('0x82')]('userVoiceQueue:remove',{'UserId':_0x5a63cc,'VoiceQueueId':_0x13e1bb['id']});});});});});});})['then'](respondWithStatusCode(_0x3aa70f,null))[_0xf52e('0x54')](handleError(_0x3aa70f,null));};exports[_0xf52e('0x98')]=function(_0x1b7cac,_0x37291c,_0x24cef4){var _0x14db4e,_0x20c341;return db['VoiceQueue'][_0xf52e('0x34')]({'where':{'id':_0x1b7cac[_0xf52e('0x5f')]['id']}})[_0xf52e('0x2d')](handleEntityNotFound(_0x37291c,null))[_0xf52e('0x2d')](function(_0x21ab24){if(_0x21ab24){_0x20c341=_0x21ab24;return _0x21ab24[_0xf52e('0x98')](_0x1b7cac[_0xf52e('0x57')][_0xf52e('0x85')],_[_0xf52e('0x60')](_0x1b7cac['body'],[_0xf52e('0x85'),'id'])||{})[_0xf52e('0x99')](function(_0x4a7eae){for(var _0x31b0c4=0x0;_0x31b0c4<_0x1b7cac[_0xf52e('0x57')][_0xf52e('0x85')]['length'];_0x31b0c4+=0x1){socket[_0xf52e('0x82')]('userVoiceQueue:save',{'UserId':Number(_0x1b7cac[_0xf52e('0x57')][_0xf52e('0x85')][_0x31b0c4]),'VoiceQueueId':Number(_0x1b7cac['params']['id'])});}return _0x4a7eae;});}})[_0xf52e('0x2d')](function(_0x2e9d88){_0x14db4e=_0x2e9d88||[];if(_0x20c341){return db[_0xf52e('0x74')][_0xf52e('0x53')]({'where':{'id':_0x1b7cac[_0xf52e('0x57')]['ids']},'attributes':['id',_0xf52e('0x39'),_0xf52e('0x9a'),'voicePause',_0xf52e('0x77')],'raw':!![]});}})[_0xf52e('0x2d')](function(_0x4ca8c6){if(!_['isEmpty'](_0x4ca8c6)){var _0x23c40f=[];for(var _0x3affa9=0x0;_0x3affa9<_0x4ca8c6[_0xf52e('0x47')];_0x3affa9++){if(_0x4ca8c6[_0x3affa9][_0xf52e('0x9a')]){_0x23c40f[_0xf52e('0x8e')](db[_0xf52e('0x7d')]['upsert']({'membername':_0x4ca8c6[_0x3affa9][_0xf52e('0x39')],'UserId':_0x4ca8c6[_0x3affa9]['id'],'queue_name':_0x20c341[_0xf52e('0x39')],'VoiceQueueId':_0x20c341['id'],'interface':_[_0xf52e('0x7f')](_0x4ca8c6[_0x3affa9]['interface'])?util[_0xf52e('0x9b')](_0xf52e('0x80'),_0x4ca8c6[_0x3affa9][_0xf52e('0x39')]):_0x4ca8c6[_0x3affa9][_0xf52e('0x77')],'paused':_0x4ca8c6[_0x3affa9][_0xf52e('0x76')]||![],'penalty':_0x1b7cac[_0xf52e('0x57')][_0xf52e('0x79')]||0x0}));}}return BPromise[_0xf52e('0x94')](_0x23c40f);}})['then'](function(){return _0x14db4e;})[_0xf52e('0x2d')](respondWithResult(_0x37291c,null))[_0xf52e('0x54')](handleError(_0x37291c,null));};exports[_0xf52e('0x97')]=function(_0x24a64a,_0x3fd0d7,_0x2b89f0){return db['VoiceQueue'][_0xf52e('0x34')]({'where':{'id':_0x24a64a[_0xf52e('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3fd0d7,null))[_0xf52e('0x2d')](function(_0x44caec){if(_0x44caec){return _0x44caec[_0xf52e('0x97')](_0x24a64a[_0xf52e('0x42')]['ids'])['then'](function(){if(_[_0xf52e('0x9c')](_0x24a64a[_0xf52e('0x42')][_0xf52e('0x85')])){for(var _0x760e64=0x0;_0x760e64<_0x24a64a['query'][_0xf52e('0x85')][_0xf52e('0x47')];_0x760e64+=0x1){socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x24a64a[_0xf52e('0x42')]['ids'][_0x760e64]),'VoiceQueueId':Number(_0x24a64a[_0xf52e('0x5f')]['id'])});}}else{socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x24a64a['query'][_0xf52e('0x85')]),'VoiceQueueId':Number(_0x24a64a[_0xf52e('0x5f')]['id'])});}});}})[_0xf52e('0x2d')](function(_0x460b05){return db[_0xf52e('0x7d')][_0xf52e('0x36')]({'where':{'VoiceQueueId':_0x24a64a[_0xf52e('0x5f')]['id'],'UserId':_0x24a64a[_0xf52e('0x42')][_0xf52e('0x85')]}})[_0xf52e('0x2d')](function(){return _0x460b05;});})[_0xf52e('0x2d')](respondWithStatusCode(_0x3fd0d7,null))[_0xf52e('0x54')](handleError(_0x3fd0d7,null));};exports[_0xf52e('0x9d')]=function(_0xc3a99f,_0x4e3d85,_0x1c58a1){var _0x7fe8d8={};var _0x542209={};var _0x2c6dc0;var _0x410b0e;return db[_0xf52e('0x3d')]['findOne']({'where':{'id':_0xc3a99f['params']['id']}})[_0xf52e('0x2d')](handleEntityNotFound(_0x4e3d85,null))[_0xf52e('0x2d')](function(_0x67008f){if(_0x67008f){_0x2c6dc0=_0x67008f;_0x542209[_0xf52e('0x40')]=_[_0xf52e('0x41')](db[_0xf52e('0x74')][_0xf52e('0x3e')]);_0x542209[_0xf52e('0x42')]=_[_0xf52e('0x41')](_0xc3a99f[_0xf52e('0x42')]);_0x542209[_0xf52e('0x43')]=_['intersection'](_0x542209['model'],_0x542209[_0xf52e('0x42')]);_0x7fe8d8[_0xf52e('0x45')]=_['intersection'](_0x542209['model'],qs[_0xf52e('0x46')](_0xc3a99f[_0xf52e('0x42')][_0xf52e('0x46')]));_0x7fe8d8[_0xf52e('0x45')]=_0x7fe8d8[_0xf52e('0x45')][_0xf52e('0x47')]?_0x7fe8d8[_0xf52e('0x45')]:_0x542209[_0xf52e('0x40')];_0x7fe8d8[_0xf52e('0x4a')]=qs[_0xf52e('0x4b')](_0xc3a99f[_0xf52e('0x42')]['sort']);_0x7fe8d8[_0xf52e('0x4c')]=qs[_0xf52e('0x43')](_[_0xf52e('0x4d')](_0xc3a99f[_0xf52e('0x42')],_0x542209[_0xf52e('0x43')]));if(_0xc3a99f[_0xf52e('0x42')][_0xf52e('0x4e')]){_0x7fe8d8[_0xf52e('0x4c')]=_[_0xf52e('0x4f')](_0x7fe8d8[_0xf52e('0x4c')],{'$or':_['map'](_0x7fe8d8[_0xf52e('0x45')],function(_0x21fedc){var _0x2fb63d={};_0x2fb63d[_0x21fedc]={'$like':'%'+_0xc3a99f[_0xf52e('0x42')][_0xf52e('0x4e')]+'%'};return _0x2fb63d;})});}_0x7fe8d8=_[_0xf52e('0x4f')]({},_0x7fe8d8,_0xc3a99f[_0xf52e('0x51')]);return _0x2c6dc0['getAgents'](_0x7fe8d8);}})['then'](function(_0xcb68e8){if(_0xcb68e8){_0x410b0e=_0xcb68e8[_0xf52e('0x47')];if(!_0xc3a99f[_0xf52e('0x42')][_0xf52e('0x48')](_0xf52e('0x49'))){_0x7fe8d8['limit']=qs['limit'](_0xc3a99f['query']['limit']);_0x7fe8d8['offset']=qs[_0xf52e('0x24')](_0xc3a99f['query'][_0xf52e('0x24')]);}return _0x2c6dc0[_0xf52e('0x9d')](_0x7fe8d8);}})['then'](function(_0x58aecf){if(_0x58aecf){return _0x58aecf?{'count':_0x410b0e,'rows':_0x58aecf}:null;}})[_0xf52e('0x2d')](respondWithResult(_0x4e3d85,null))[_0xf52e('0x54')](handleError(_0x4e3d85,null));};exports[_0xf52e('0x9e')]=function(_0x19dbac,_0x53d0dd,_0x17f20b){var _0x4ba0bd={};var _0x2cc602={};var _0x5e499e;var _0x2edd72;return db[_0xf52e('0x3d')]['findOne']({'where':{'id':_0x19dbac[_0xf52e('0x5f')]['id']}})[_0xf52e('0x2d')](handleEntityNotFound(_0x53d0dd,null))['then'](function(_0x54141c){if(_0x54141c){_0x5e499e=_0x54141c;_0x2cc602[_0xf52e('0x40')]=_[_0xf52e('0x41')](db['UserVoiceQueueRt']['rawAttributes']);_0x2cc602['query']=_[_0xf52e('0x41')](_0x19dbac['query']);_0x2cc602[_0xf52e('0x43')]=_[_0xf52e('0x44')](_0x2cc602[_0xf52e('0x40')],_0x2cc602['query']);_0x4ba0bd[_0xf52e('0x45')]=_[_0xf52e('0x44')](_0x2cc602[_0xf52e('0x40')],qs[_0xf52e('0x46')](_0x19dbac['query'][_0xf52e('0x46')]));_0x4ba0bd['attributes']=_0x4ba0bd[_0xf52e('0x45')][_0xf52e('0x47')]?_0x4ba0bd[_0xf52e('0x45')]:_0x2cc602[_0xf52e('0x40')];_0x4ba0bd[_0xf52e('0x4a')]=qs[_0xf52e('0x4b')](_0x19dbac['query']['sort']);_0x4ba0bd['where']=qs['filters'](_[_0xf52e('0x4d')](_0x19dbac[_0xf52e('0x42')],_0x2cc602[_0xf52e('0x43')]));if(_0x19dbac[_0xf52e('0x42')][_0xf52e('0x4e')]){_0x4ba0bd[_0xf52e('0x4c')]=_[_0xf52e('0x4f')](_0x4ba0bd[_0xf52e('0x4c')],{'$or':_[_0xf52e('0x3c')](_0x4ba0bd[_0xf52e('0x45')],function(_0x504be2){var _0x16f5e5={};_0x16f5e5[_0x504be2]={'$like':'%'+_0x19dbac[_0xf52e('0x42')][_0xf52e('0x4e')]+'%'};return _0x16f5e5;})});}_0x4ba0bd=_[_0xf52e('0x4f')]({},_0x4ba0bd,_0x19dbac[_0xf52e('0x51')]);return _0x5e499e[_0xf52e('0x9e')](_0x4ba0bd);}})[_0xf52e('0x2d')](function(_0x2a66bc){if(_0x2a66bc){_0x2edd72=_0x2a66bc[_0xf52e('0x47')];if(!_0x19dbac[_0xf52e('0x42')][_0xf52e('0x48')](_0xf52e('0x49'))){_0x4ba0bd[_0xf52e('0x25')]=qs[_0xf52e('0x25')](_0x19dbac['query'][_0xf52e('0x25')]);_0x4ba0bd['offset']=qs[_0xf52e('0x24')](_0x19dbac[_0xf52e('0x42')][_0xf52e('0x24')]);}return _0x5e499e[_0xf52e('0x9e')](_0x4ba0bd);}})['then'](function(_0x49d03c){return _0x49d03c?{'count':_0x2edd72,'rows':_0x49d03c}:null;})[_0xf52e('0x2d')](respondWithResult(_0x53d0dd,null))['catch'](handleError(_0x53d0dd,null));};exports[_0xf52e('0x9f')]=function(_0x211f30,_0x40fc7e,_0x1cc21c){var _0x5110a7={};var _0x569a85={};var _0x32d82e;var _0x35f60c;return db['VoiceQueue'][_0xf52e('0x6b')]({'where':{'id':_0x211f30[_0xf52e('0x5f')]['id']}})['then'](handleEntityNotFound(_0x40fc7e,null))[_0xf52e('0x2d')](function(_0x2efd08){if(_0x2efd08){_0x32d82e=_0x2efd08;_0x569a85[_0xf52e('0x40')]=_[_0xf52e('0x41')](db[_0xf52e('0xa0')][_0xf52e('0x3e')]);_0x569a85['query']=_[_0xf52e('0x41')](_0x211f30[_0xf52e('0x42')]);_0x569a85[_0xf52e('0x43')]=_['intersection'](_0x569a85['model'],_0x569a85[_0xf52e('0x42')]);_0x5110a7['attributes']=_['intersection'](_0x569a85['model'],qs['fields'](_0x211f30[_0xf52e('0x42')][_0xf52e('0x46')]));_0x5110a7[_0xf52e('0x45')]=_0x5110a7[_0xf52e('0x45')][_0xf52e('0x47')]?_0x5110a7['attributes']:_0x569a85[_0xf52e('0x40')];_0x5110a7[_0xf52e('0x4a')]=qs[_0xf52e('0x4b')](_0x211f30[_0xf52e('0x42')][_0xf52e('0x4b')]);_0x5110a7['where']=qs[_0xf52e('0x43')](_[_0xf52e('0x4d')](_0x211f30[_0xf52e('0x42')],_0x569a85['filters']));if(_0x211f30[_0xf52e('0x42')][_0xf52e('0x4e')]){_0x5110a7['where']=_[_0xf52e('0x4f')](_0x5110a7[_0xf52e('0x4c')],{'$or':_[_0xf52e('0x3c')](_0x5110a7[_0xf52e('0x45')],function(_0x1eaa5f){var _0x412143={};_0x412143[_0x1eaa5f]={'$like':'%'+_0x211f30['query'][_0xf52e('0x4e')]+'%'};return _0x412143;})});}_0x5110a7=_['merge']({},_0x5110a7,_0x211f30[_0xf52e('0x51')]);return _0x32d82e['getLists'](_0x5110a7);}})['then'](function(_0x528e20){if(_0x528e20){_0x35f60c=_0x528e20[_0xf52e('0x47')];if(!_0x211f30[_0xf52e('0x42')][_0xf52e('0x48')](_0xf52e('0x49'))){_0x5110a7[_0xf52e('0x25')]=qs[_0xf52e('0x25')](_0x211f30[_0xf52e('0x42')][_0xf52e('0x25')]);_0x5110a7['offset']=qs[_0xf52e('0x24')](_0x211f30['query'][_0xf52e('0x24')]);}return _0x32d82e[_0xf52e('0x9f')](_0x5110a7);}})['then'](function(_0x1e66f8){if(_0x1e66f8){return _0x1e66f8?{'count':_0x35f60c,'rows':_0x1e66f8}:null;}})[_0xf52e('0x2d')](respondWithResult(_0x40fc7e,null))[_0xf52e('0x54')](handleError(_0x40fc7e,null));};exports[_0xf52e('0xa1')]=function(_0x4486b4,_0x387929,_0xf23643){var _0x52ea95,_0x18aa9d;return db[_0xf52e('0x3d')]['find']({'where':{'id':_0x4486b4[_0xf52e('0x5f')]['id']}})[_0xf52e('0x2d')](handleEntityNotFound(_0x387929,null))[_0xf52e('0x2d')](function(_0x452819){if(_0x452819){_0x18aa9d=_0x452819;return _0x452819[_0xf52e('0xa1')](_0x4486b4[_0xf52e('0x57')][_0xf52e('0x85')],_[_0xf52e('0x60')](_0x4486b4[_0xf52e('0x57')],[_0xf52e('0x85'),'id'])||{});}return null;})[_0xf52e('0x99')](function(_0x345b72){var _0x33294e;_0x52ea95=_0x345b72||[];var _0x1b9f52=[];if(_0x345b72){for(var _0x5e60df=0x0;_0x5e60df<_0x345b72['length'];_0x5e60df+=0x1){var _0x3598d2=_0x345b72[_0x5e60df][_0xf52e('0x2e')]({'plain':!![]});_0x18aa9d[_0xf52e('0xa2')]=_0x4486b4['body'][_0xf52e('0xa2')]?_0x4486b4[_0xf52e('0x57')][_0xf52e('0xa2')]:_0x18aa9d['dialCheckDuplicateType'];switch(_0x18aa9d[_0xf52e('0xa2')]){case _0xf52e('0xa3'):_0x33294e=squel['insert']()['into'](_0xf52e('0xa4'))['fromQuery'](['phone',_0xf52e('0xa5'),_0xf52e('0xa6'),_0xf52e('0xa7'),'VoiceQueueId',_0xf52e('0x61'),_0xf52e('0x62')],squel['select']()[_0xf52e('0x87')](_0xf52e('0xa8'),_0xf52e('0xa8'))[_0xf52e('0x87')]('NOW()',_0xf52e('0xa5'))['field']('id',_0xf52e('0xa6'))['field'](_0x3598d2[_0xf52e('0xa9')][_0xf52e('0xaa')](),_0xf52e('0xa7'))[_0xf52e('0x87')](_0x4486b4[_0xf52e('0x5f')]['id'][_0xf52e('0xaa')](),_0xf52e('0x67'))[_0xf52e('0x87')](_0xf52e('0xab'),'createdAt')[_0xf52e('0x87')](_0xf52e('0xab'),_0xf52e('0x62'))[_0xf52e('0xac')]('cm_contacts')['where'](_0xf52e('0xad'))[_0xf52e('0x4c')](_0xf52e('0xae'),_0x3598d2[_0xf52e('0xa9')]['toString']())[_0xf52e('0x4c')](_0xf52e('0xaf'))[_0xf52e('0x4c')]('phone\x20NOT\x20IN\x20(?)',squel[_0xf52e('0x86')]()['field'](_0xf52e('0xb0'))[_0xf52e('0xac')]('cm_hopper_final')['where']('VoiceQueueId\x20=\x20?',_0x4486b4[_0xf52e('0x5f')]['id'][_0xf52e('0xaa')]()))[_0xf52e('0x4c')]('phone\x20NOT\x20IN\x20(?)',squel[_0xf52e('0x86')]()[_0xf52e('0x87')](_0xf52e('0xb1'))[_0xf52e('0xac')]('cm_hopper')[_0xf52e('0x4c')](_0xf52e('0x8c'),_0x4486b4[_0xf52e('0x5f')]['id'][_0xf52e('0xaa')]())))['toString']();break;case _0xf52e('0xb2'):_0x33294e=squel[_0xf52e('0xb3')]()[_0xf52e('0xb4')]('cm_hopper')[_0xf52e('0xb5')]([_0xf52e('0xa8'),'scheduledAt',_0xf52e('0xa6'),_0xf52e('0xa7'),'VoiceQueueId',_0xf52e('0x61'),_0xf52e('0x62')],squel[_0xf52e('0x86')]()[_0xf52e('0x87')](_0xf52e('0xa8'),_0xf52e('0xa8'))[_0xf52e('0x87')](_0xf52e('0xab'),_0xf52e('0xa5'))[_0xf52e('0x87')]('id',_0xf52e('0xa6'))[_0xf52e('0x87')](_0x3598d2[_0xf52e('0xa9')][_0xf52e('0xaa')](),_0xf52e('0xa7'))[_0xf52e('0x87')](_0x4486b4[_0xf52e('0x5f')]['id'][_0xf52e('0xaa')](),_0xf52e('0x67'))[_0xf52e('0x87')]('NOW()','createdAt')[_0xf52e('0x87')](_0xf52e('0xab'),_0xf52e('0x62'))['from'](_0xf52e('0xb6'))[_0xf52e('0x4c')](_0xf52e('0xad'))[_0xf52e('0x4c')]('ListId\x20=\x20?',_0x3598d2[_0xf52e('0xa9')][_0xf52e('0xaa')]())[_0xf52e('0x4c')]('phone\x20IS\x20NOT\x20NULL')[_0xf52e('0x4c')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xf52e('0x87')](_0xf52e('0xb1'))[_0xf52e('0xac')](_0xf52e('0xa4'))[_0xf52e('0x4c')](_0xf52e('0x8c'),_0x4486b4[_0xf52e('0x5f')]['id']['toString']())))[_0xf52e('0xaa')]();break;default:_0x33294e=squel[_0xf52e('0xb3')]()['into'](_0xf52e('0xa4'))[_0xf52e('0xb5')]([_0xf52e('0xa8'),_0xf52e('0xa5'),_0xf52e('0xa6'),_0xf52e('0xa7'),'VoiceQueueId','createdAt','updatedAt'],squel[_0xf52e('0x86')]()[_0xf52e('0x87')](_0xf52e('0xa8'),'phone')[_0xf52e('0x87')](_0xf52e('0xab'),_0xf52e('0xa5'))[_0xf52e('0x87')]('id','ContactId')[_0xf52e('0x87')](_0x3598d2[_0xf52e('0xa9')][_0xf52e('0xaa')](),_0xf52e('0xa7'))[_0xf52e('0x87')](_0x4486b4['params']['id']['toString'](),'VoiceQueueId')[_0xf52e('0x87')](_0xf52e('0xab'),_0xf52e('0x61'))[_0xf52e('0x87')](_0xf52e('0xab'),'updatedAt')[_0xf52e('0xac')](_0xf52e('0xb6'))[_0xf52e('0x4c')](_0xf52e('0xad'))['where'](_0xf52e('0xae'),_0x3598d2[_0xf52e('0xa9')]['toString']())[_0xf52e('0x4c')](_0xf52e('0xaf')))[_0xf52e('0xaa')]();}_0x1b9f52[_0xf52e('0x8e')](db[_0xf52e('0x8f')]['query'](_0x33294e));}return BPromise[_0xf52e('0x94')](_0x1b9f52);}})[_0xf52e('0x2d')](function(){return _0x52ea95;})[_0xf52e('0x2d')](respondWithResult(_0x387929,null))[_0xf52e('0x54')](handleError(_0x387929,null));};exports['removeLists']=function(_0x59fe26,_0x5a4386,_0x27cebb){return db[_0xf52e('0x3d')][_0xf52e('0x34')]({'where':{'id':_0x59fe26[_0xf52e('0x5f')]['id']}})[_0xf52e('0x2d')](handleEntityNotFound(_0x5a4386,null))[_0xf52e('0x2d')](function(_0x1730c9){if(_0x1730c9){return _0x1730c9[_0xf52e('0xb7')](_0x59fe26['query'][_0xf52e('0x85')]);}})[_0xf52e('0x2d')](function(_0x583262){if(_0x583262){return db[_0xf52e('0x68')]['destroy']({'where':{'ListId':_0x59fe26['query'][_0xf52e('0x85')],'VoiceQueueId':_0x59fe26['params']['id']}})['then'](function(){return _0x583262;});}})[_0xf52e('0x2d')](respondWithStatusCode(_0x5a4386,null))[_0xf52e('0x54')](handleError(_0x5a4386,null));};exports['getBlackLists']=function(_0x369a9d,_0x1c96e5,_0x631272){var _0x3356ac={};var _0x46ea97={};var _0x49567b;var _0x193bfc;return db[_0xf52e('0x3d')][_0xf52e('0x6b')]({'where':{'id':_0x369a9d['params']['id']}})[_0xf52e('0x2d')](handleEntityNotFound(_0x1c96e5,null))[_0xf52e('0x2d')](function(_0x582201){if(_0x582201){_0x49567b=_0x582201;_0x46ea97[_0xf52e('0x40')]=_[_0xf52e('0x41')](db[_0xf52e('0xa0')][_0xf52e('0x3e')]);_0x46ea97[_0xf52e('0x42')]=_[_0xf52e('0x41')](_0x369a9d[_0xf52e('0x42')]);_0x46ea97[_0xf52e('0x43')]=_[_0xf52e('0x44')](_0x46ea97['model'],_0x46ea97[_0xf52e('0x42')]);_0x3356ac['attributes']=_[_0xf52e('0x44')](_0x46ea97['model'],qs[_0xf52e('0x46')](_0x369a9d[_0xf52e('0x42')][_0xf52e('0x46')]));_0x3356ac['attributes']=_0x3356ac[_0xf52e('0x45')]['length']?_0x3356ac['attributes']:_0x46ea97['model'];_0x3356ac[_0xf52e('0x4a')]=qs['sort'](_0x369a9d[_0xf52e('0x42')]['sort']);_0x3356ac[_0xf52e('0x4c')]=qs[_0xf52e('0x43')](_[_0xf52e('0x4d')](_0x369a9d[_0xf52e('0x42')],_0x46ea97[_0xf52e('0x43')]));if(_0x369a9d[_0xf52e('0x42')][_0xf52e('0x4e')]){_0x3356ac['where']=_['merge'](_0x3356ac[_0xf52e('0x4c')],{'$or':_[_0xf52e('0x3c')](_0x3356ac[_0xf52e('0x45')],function(_0x137e9f){var _0x20c8ca={};_0x20c8ca[_0x137e9f]={'$like':'%'+_0x369a9d[_0xf52e('0x42')][_0xf52e('0x4e')]+'%'};return _0x20c8ca;})});}_0x3356ac=_[_0xf52e('0x4f')]({},_0x3356ac,_0x369a9d['options']);return _0x49567b['getBlackLists'](_0x3356ac);}})['then'](function(_0x2f359a){if(_0x2f359a){_0x193bfc=_0x2f359a[_0xf52e('0x47')];if(!_0x369a9d[_0xf52e('0x42')]['hasOwnProperty'](_0xf52e('0x49'))){_0x3356ac[_0xf52e('0x25')]=qs[_0xf52e('0x25')](_0x369a9d[_0xf52e('0x42')][_0xf52e('0x25')]);_0x3356ac[_0xf52e('0x24')]=qs['offset'](_0x369a9d[_0xf52e('0x42')][_0xf52e('0x24')]);}return _0x49567b['getBlackLists'](_0x3356ac);}})[_0xf52e('0x2d')](function(_0xd5a47c){if(_0xd5a47c){return _0xd5a47c?{'count':_0x193bfc,'rows':_0xd5a47c}:null;}})[_0xf52e('0x2d')](respondWithResult(_0x1c96e5,null))[_0xf52e('0x54')](handleError(_0x1c96e5,null));};exports[_0xf52e('0xb8')]=function(_0xdaaa82,_0x23715c,_0x54d51d){var _0x3e650f,_0x73055f;return db[_0xf52e('0x3d')][_0xf52e('0x34')]({'where':{'id':_0xdaaa82['params']['id']}})[_0xf52e('0x2d')](handleEntityNotFound(_0x23715c,null))['then'](function(_0x1c0f16){if(_0x1c0f16){_0x73055f=_0x1c0f16;return _0x1c0f16[_0xf52e('0xb8')](_0xdaaa82['body'][_0xf52e('0x85')],_['omit'](_0xdaaa82[_0xf52e('0x57')],[_0xf52e('0x85'),'id'])||{});}return null;})[_0xf52e('0x99')](function(_0x6b0fdd){var _0x2e8d94;_0x3e650f=_0x6b0fdd||[];var _0x57bcb0=[];if(_0x6b0fdd){for(var _0x14e19e=0x0;_0x14e19e<_0x6b0fdd[_0xf52e('0x47')];_0x14e19e+=0x1){var _0x487865=_0x6b0fdd[_0x14e19e][_0xf52e('0x2e')]({'plain':!![]});_0x2e8d94=squel['insert']()['into']('cm_hopper_black')[_0xf52e('0xb5')]([_0xf52e('0xa8'),'ContactId',_0xf52e('0xa7'),_0xf52e('0x67'),'createdAt',_0xf52e('0x62')],squel['select']()[_0xf52e('0x87')](_0xf52e('0xa8'),_0xf52e('0xa8'))['field']('id',_0xf52e('0xa6'))[_0xf52e('0x87')](_0x487865['CmListId'][_0xf52e('0xaa')](),'ListId')[_0xf52e('0x87')](_0xdaaa82[_0xf52e('0x5f')]['id'][_0xf52e('0xaa')](),_0xf52e('0x67'))['field'](_0xf52e('0xab'),'createdAt')[_0xf52e('0x87')](_0xf52e('0xab'),_0xf52e('0x62'))[_0xf52e('0xac')]('cm_contacts')[_0xf52e('0x4c')]('deletedAt\x20IS\x20NULL')[_0xf52e('0x4c')](_0xf52e('0xae'),_0x487865['CmListId'][_0xf52e('0xaa')]())['where'](_0xf52e('0xaf')))['toString']();_0x57bcb0[_0xf52e('0x8e')](db[_0xf52e('0x8f')][_0xf52e('0x42')](_0x2e8d94));}return BPromise[_0xf52e('0x94')](_0x57bcb0);}})[_0xf52e('0x2d')](function(){return _0x3e650f;})[_0xf52e('0x2d')](respondWithResult(_0x23715c,null))[_0xf52e('0x54')](handleError(_0x23715c,null));};exports[_0xf52e('0xb9')]=function(_0x4b6763,_0xdfd9dd,_0x2ad098){return db[_0xf52e('0x3d')][_0xf52e('0x34')]({'where':{'id':_0x4b6763[_0xf52e('0x5f')]['id']}})[_0xf52e('0x2d')](handleEntityNotFound(_0xdfd9dd,null))[_0xf52e('0x2d')](function(_0x5bbb55){if(_0x5bbb55){return _0x5bbb55[_0xf52e('0xb9')](_0x4b6763[_0xf52e('0x42')][_0xf52e('0x85')]);}})[_0xf52e('0x2d')](function(_0x2b2092){if(_0x2b2092){return db[_0xf52e('0x70')][_0xf52e('0x36')]({'where':{'ListId':_0x4b6763[_0xf52e('0x42')][_0xf52e('0x85')],'VoiceQueueId':_0x4b6763[_0xf52e('0x5f')]['id']}})['then'](function(){return _0x2b2092;});}})[_0xf52e('0x2d')](respondWithStatusCode(_0xdfd9dd,null))[_0xf52e('0x54')](handleError(_0xdfd9dd,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index f2a62ce..04c5451 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 _0xf799=['update','hasOwnProperty','hook','events','../../mysqldb','VoiceQueue','save'];(function(_0x20b439,_0x5aae74){var _0x122b8f=function(_0x337e82){while(--_0x337e82){_0x20b439['push'](_0x20b439['shift']());}};_0x122b8f(++_0x5aae74);}(_0xf799,0x114));var _0x9f79=function(_0x416cdc,_0x213b87){_0x416cdc=_0x416cdc-0x0;var _0x1931ce=_0xf799[_0x416cdc];return _0x1931ce;};'use strict';var EventEmitter=require(_0x9f79('0x0'));var VoiceQueue=require(_0x9f79('0x1'))['db'][_0x9f79('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9f79('0x3'),'afterUpdate':_0x9f79('0x4'),'afterDestroy':'remove'};function emitEvent(_0x777eff){return function(_0x1efeeb,_0x49a6b0,_0x2f86e){VoiceQueueEvents['emit'](_0x777eff+':'+_0x1efeeb['id'],_0x1efeeb);VoiceQueueEvents['emit'](_0x777eff,_0x1efeeb);_0x2f86e(null);};}for(var e in events){if(events[_0x9f79('0x5')](e)){var event=events[e];VoiceQueue[_0x9f79('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x0335=['events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3b87f4,_0x112243){var _0x63d16e=function(_0x3e7323){while(--_0x3e7323){_0x3b87f4['push'](_0x3b87f4['shift']());}};_0x63d16e(++_0x112243);}(_0x0335,0x160));var _0x5033=function(_0x20c260,_0x19a98e){_0x20c260=_0x20c260-0x0;var _0x6e0a59=_0x0335[_0x20c260];return _0x6e0a59;};'use strict';var EventEmitter=require(_0x5033('0x0'));var VoiceQueue=require(_0x5033('0x1'))['db'][_0x5033('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x5033('0x3')](0x0);var events={'afterCreate':_0x5033('0x4'),'afterUpdate':_0x5033('0x5'),'afterDestroy':_0x5033('0x6')};function emitEvent(_0x1f6c56){return function(_0x567f66,_0x35b68f,_0x2fde11){VoiceQueueEvents[_0x5033('0x7')](_0x1f6c56+':'+_0x567f66['id'],_0x567f66);VoiceQueueEvents[_0x5033('0x7')](_0x1f6c56,_0x567f66);_0x2fde11(null);};}for(var e in events){if(events[_0x5033('0x8')](e)){var event=events[e];VoiceQueue[_0x5033('0x9')](e,emitEvent(event));}}module[_0x5033('0xa')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 1f2cb32..3aaa759 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x3d7f22,_0x5e9762){var _0x5da24b=function(_0x3ddeab){while(--_0x3ddeab){_0x3d7f22['push'](_0x3d7f22['shift']());}};_0x5da24b(++_0x5e9762);}(_0xedd9,0xfc));var _0x9edd=function(_0x384610,_0x116dfe){_0x384610=_0x384610-0x0;var _0x63f5d5=_0xedd9[_0x384610];return _0x63f5d5;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x3df3eb,_0x293751){var _0x5e1e5c=function(_0x2f6f0f){while(--_0x2f6f0f){_0x3df3eb['push'](_0x3df3eb['shift']());}};_0x5e1e5c(++_0x293751);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 7e115a4..9d8dd62 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 _0x744a=['info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VoiceQueue','findAll','options','where','attributes','limit','include','map','model','GetVoiceQueue','ShowVoiceQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then'];(function(_0xa1f7cb,_0x24d50a){var _0x449364=function(_0x4a65e9){while(--_0x4a65e9){_0xa1f7cb['push'](_0xa1f7cb['shift']());}};_0x449364(++_0x24d50a);}(_0x744a,0x186));var _0xa744=function(_0x286724,_0x5c7829){_0x286724=_0x286724-0x0;var _0x55651=_0x744a[_0x286724];return _0x55651;};'use strict';var _=require(_0xa744('0x0'));var util=require(_0xa744('0x1'));var moment=require(_0xa744('0x2'));var BPromise=require('bluebird');var rs=require(_0xa744('0x3'));var fs=require('fs');var Redis=require(_0xa744('0x4'));var db=require(_0xa744('0x5'))['db'];var utils=require(_0xa744('0x6'));var logger=require('../../config/logger')(_0xa744('0x7'));var config=require(_0xa744('0x8'));var jayson=require(_0xa744('0x9'));var client=jayson[_0xa744('0xa')][_0xa744('0xb')]({'port':0x232a});config[_0xa744('0xc')]=_[_0xa744('0xd')](config[_0xa744('0xc')],{'host':_0xa744('0xe'),'port':0x18eb});var socket=require(_0xa744('0xf'))(new Redis(config[_0xa744('0xc')]));require(_0xa744('0x10'))[_0xa744('0x11')](socket);function respondWithRpcPromise(_0x396d37,_0x18a1d1,_0x5002ea){return new BPromise(function(_0xeb3340,_0x37e4e6){return client[_0xa744('0x12')](_0x396d37,_0x5002ea)[_0xa744('0x13')](function(_0x390eb9){logger[_0xa744('0x14')](_0xa744('0x15'),_0x18a1d1,_0xa744('0x16'));logger[_0xa744('0x17')](_0xa744('0x18'),_0x18a1d1,'request\x20sent',JSON[_0xa744('0x19')](_0x390eb9));if(_0x390eb9[_0xa744('0x1a')]){if(_0x390eb9['error'][_0xa744('0x1b')]===0x1f4){logger[_0xa744('0x1a')](_0xa744('0x15'),_0x18a1d1,_0x390eb9['error'][_0xa744('0x1c')]);return _0x37e4e6(_0x390eb9['error'][_0xa744('0x1c')]);}logger[_0xa744('0x1a')](_0xa744('0x15'),_0x18a1d1,_0x390eb9['error']['message']);return _0xeb3340(_0x390eb9[_0xa744('0x1a')][_0xa744('0x1c')]);}else{logger[_0xa744('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x18a1d1,'request\x20sent');_0xeb3340(_0x390eb9['result']['message']);}})[_0xa744('0x1d')](function(_0x47d3ec){logger['error'](_0xa744('0x15'),_0x18a1d1,_0x47d3ec);_0x37e4e6(_0x47d3ec);});});}exports['GetVoiceQueue']=function(_0x5d9b15){var _0x18080b=this;return new Promise(function(_0x158357,_0x5a914e){return db[_0xa744('0x1e')][_0xa744('0x1f')]({'raw':_0x5d9b15['options']?_0x5d9b15[_0xa744('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x5d9b15[_0xa744('0x20')]?_0x5d9b15[_0xa744('0x20')][_0xa744('0x21')]||null:null,'attributes':_0x5d9b15[_0xa744('0x20')]?_0x5d9b15[_0xa744('0x20')][_0xa744('0x22')]||null:null,'limit':_0x5d9b15[_0xa744('0x20')]?_0x5d9b15[_0xa744('0x20')][_0xa744('0x23')]||null:null,'include':_0x5d9b15[_0xa744('0x20')]?_0x5d9b15[_0xa744('0x20')][_0xa744('0x24')]?_[_0xa744('0x25')](_0x5d9b15['options'][_0xa744('0x24')],function(_0x342484){return{'model':db[_0x342484[_0xa744('0x26')]],'as':_0x342484['as'],'attributes':_0x342484[_0xa744('0x22')],'include':_0x342484[_0xa744('0x24')]?_[_0xa744('0x25')](_0x342484[_0xa744('0x24')],function(_0x252de0){return{'model':db[_0x252de0[_0xa744('0x26')]],'as':_0x252de0['as'],'attributes':_0x252de0[_0xa744('0x22')],'include':_0x252de0['include']?_[_0xa744('0x25')](_0x252de0[_0xa744('0x24')],function(_0x3569b6){return{'model':db[_0x3569b6[_0xa744('0x26')]],'as':_0x3569b6['as'],'attributes':_0x3569b6['attributes']};}):[]};}):[]};}):[]:[]})[_0xa744('0x13')](function(_0x24bb0a){logger[_0xa744('0x14')](_0xa744('0x27'),_0x5d9b15);logger[_0xa744('0x17')](_0xa744('0x27'),_0x5d9b15,JSON[_0xa744('0x19')](_0x24bb0a));_0x158357(_0x24bb0a);})['catch'](function(_0x15ce9f){logger['error'](_0xa744('0x27'),_0x15ce9f['message'],_0x5d9b15);_0x5a914e(_0x18080b[_0xa744('0x1a')](0x1f4,_0x15ce9f[_0xa744('0x1c')]));});});};exports[_0xa744('0x28')]=function(_0x581431){var _0x46be05=this;return new Promise(function(_0x1ea07d,_0x198e58){return db['VoiceQueue']['find']({'raw':_0x581431[_0xa744('0x20')]?_0x581431[_0xa744('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x581431[_0xa744('0x20')]?_0x581431[_0xa744('0x20')][_0xa744('0x21')]||null:null,'attributes':_0x581431[_0xa744('0x20')]?_0x581431[_0xa744('0x20')]['attributes']||null:null,'include':_0x581431[_0xa744('0x20')]?_0x581431['options'][_0xa744('0x24')]?_[_0xa744('0x25')](_0x581431[_0xa744('0x20')][_0xa744('0x24')],function(_0x306ecb){return{'model':db[_0x306ecb[_0xa744('0x26')]],'as':_0x306ecb['as'],'attributes':_0x306ecb[_0xa744('0x22')],'include':_0x306ecb[_0xa744('0x24')]?_[_0xa744('0x25')](_0x306ecb['include'],function(_0xa9de18){return{'model':db[_0xa9de18['model']],'as':_0xa9de18['as'],'attributes':_0xa9de18[_0xa744('0x22')],'include':_0xa9de18['include']?_[_0xa744('0x25')](_0xa9de18['include'],function(_0x4fca8b){return{'model':db[_0x4fca8b[_0xa744('0x26')]],'as':_0x4fca8b['as'],'attributes':_0x4fca8b[_0xa744('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x58655e){logger[_0xa744('0x14')](_0xa744('0x28'),_0x581431);logger[_0xa744('0x17')](_0xa744('0x28'),_0x581431,JSON[_0xa744('0x19')](_0x58655e));_0x1ea07d(_0x58655e);})[_0xa744('0x1d')](function(_0x536b25){logger[_0xa744('0x1a')](_0xa744('0x28'),_0x536b25[_0xa744('0x1c')],_0x581431);_0x198e58(_0x46be05[_0xa744('0x1a')](0x1f4,_0x536b25[_0xa744('0x1c')]));});});}; \ No newline at end of file +var _0x004a=['result','catch','VoiceQueue','options','raw','where','attributes','limit','map','include','model','GetVoiceQueue','debug','ShowVoiceQueue','find','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x1fa841,_0x37a70c){var _0x384b67=function(_0x248c40){while(--_0x248c40){_0x1fa841['push'](_0x1fa841['shift']());}};_0x384b67(++_0x37a70c);}(_0x004a,0x136));var _0xa004=function(_0x4bcd46,_0x241b49){_0x4bcd46=_0x4bcd46-0x0;var _0x44347d=_0x004a[_0x4bcd46];return _0x44347d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa004('0x0'));var BPromise=require(_0xa004('0x1'));var rs=require(_0xa004('0x2'));var fs=require('fs');var Redis=require(_0xa004('0x3'));var db=require(_0xa004('0x4'))['db'];var utils=require(_0xa004('0x5'));var logger=require(_0xa004('0x6'))(_0xa004('0x7'));var config=require(_0xa004('0x8'));var jayson=require(_0xa004('0x9'));var client=jayson[_0xa004('0xa')][_0xa004('0xb')]({'port':0x232a});config[_0xa004('0xc')]=_['defaults'](config[_0xa004('0xc')],{'host':_0xa004('0xd'),'port':0x18eb});var socket=require(_0xa004('0xe'))(new Redis(config[_0xa004('0xc')]));require(_0xa004('0xf'))[_0xa004('0x10')](socket);function respondWithRpcPromise(_0x1021fa,_0x23a7a9,_0x7d8fec){return new BPromise(function(_0x4b6e0e,_0x366959){return client[_0xa004('0x11')](_0x1021fa,_0x7d8fec)[_0xa004('0x12')](function(_0x1215f3){logger[_0xa004('0x13')](_0xa004('0x14'),_0x23a7a9,_0xa004('0x15'));logger['debug'](_0xa004('0x16'),_0x23a7a9,_0xa004('0x15'),JSON['stringify'](_0x1215f3));if(_0x1215f3[_0xa004('0x17')]){if(_0x1215f3[_0xa004('0x17')][_0xa004('0x18')]===0x1f4){logger['error'](_0xa004('0x14'),_0x23a7a9,_0x1215f3[_0xa004('0x17')][_0xa004('0x19')]);return _0x366959(_0x1215f3[_0xa004('0x17')][_0xa004('0x19')]);}logger[_0xa004('0x17')](_0xa004('0x14'),_0x23a7a9,_0x1215f3[_0xa004('0x17')][_0xa004('0x19')]);return _0x4b6e0e(_0x1215f3[_0xa004('0x17')][_0xa004('0x19')]);}else{logger[_0xa004('0x13')](_0xa004('0x14'),_0x23a7a9,_0xa004('0x15'));_0x4b6e0e(_0x1215f3[_0xa004('0x1a')][_0xa004('0x19')]);}})[_0xa004('0x1b')](function(_0x95cb27){logger[_0xa004('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x23a7a9,_0x95cb27);_0x366959(_0x95cb27);});});}exports['GetVoiceQueue']=function(_0x35b858){var _0x5203d3=this;return new Promise(function(_0x575ec6,_0x5355e4){return db[_0xa004('0x1c')]['findAll']({'raw':_0x35b858[_0xa004('0x1d')]?_0x35b858[_0xa004('0x1d')][_0xa004('0x1e')]===undefined?!![]:![]:!![],'where':_0x35b858[_0xa004('0x1d')]?_0x35b858[_0xa004('0x1d')][_0xa004('0x1f')]||null:null,'attributes':_0x35b858[_0xa004('0x1d')]?_0x35b858[_0xa004('0x1d')][_0xa004('0x20')]||null:null,'limit':_0x35b858[_0xa004('0x1d')]?_0x35b858[_0xa004('0x1d')][_0xa004('0x21')]||null:null,'include':_0x35b858[_0xa004('0x1d')]?_0x35b858[_0xa004('0x1d')]['include']?_[_0xa004('0x22')](_0x35b858['options'][_0xa004('0x23')],function(_0x51ada8){return{'model':db[_0x51ada8['model']],'as':_0x51ada8['as'],'attributes':_0x51ada8[_0xa004('0x20')],'include':_0x51ada8[_0xa004('0x23')]?_[_0xa004('0x22')](_0x51ada8[_0xa004('0x23')],function(_0x4b413a){return{'model':db[_0x4b413a['model']],'as':_0x4b413a['as'],'attributes':_0x4b413a['attributes'],'include':_0x4b413a[_0xa004('0x23')]?_[_0xa004('0x22')](_0x4b413a[_0xa004('0x23')],function(_0x517a7f){return{'model':db[_0x517a7f[_0xa004('0x24')]],'as':_0x517a7f['as'],'attributes':_0x517a7f[_0xa004('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa004('0x12')](function(_0x550ad4){logger[_0xa004('0x13')](_0xa004('0x25'),_0x35b858);logger[_0xa004('0x26')](_0xa004('0x25'),_0x35b858,JSON['stringify'](_0x550ad4));_0x575ec6(_0x550ad4);})[_0xa004('0x1b')](function(_0x584cd8){logger[_0xa004('0x17')]('GetVoiceQueue',_0x584cd8[_0xa004('0x19')],_0x35b858);_0x5355e4(_0x5203d3[_0xa004('0x17')](0x1f4,_0x584cd8[_0xa004('0x19')]));});});};exports[_0xa004('0x27')]=function(_0x436d3f){var _0x1493ae=this;return new Promise(function(_0x1f93dc,_0x175d9d){return db[_0xa004('0x1c')][_0xa004('0x28')]({'raw':_0x436d3f[_0xa004('0x1d')]?_0x436d3f['options']['raw']===undefined?!![]:![]:!![],'where':_0x436d3f[_0xa004('0x1d')]?_0x436d3f[_0xa004('0x1d')][_0xa004('0x1f')]||null:null,'attributes':_0x436d3f[_0xa004('0x1d')]?_0x436d3f['options'][_0xa004('0x20')]||null:null,'include':_0x436d3f[_0xa004('0x1d')]?_0x436d3f[_0xa004('0x1d')][_0xa004('0x23')]?_['map'](_0x436d3f['options'][_0xa004('0x23')],function(_0xea3034){return{'model':db[_0xea3034[_0xa004('0x24')]],'as':_0xea3034['as'],'attributes':_0xea3034[_0xa004('0x20')],'include':_0xea3034['include']?_[_0xa004('0x22')](_0xea3034[_0xa004('0x23')],function(_0x38bfad){return{'model':db[_0x38bfad[_0xa004('0x24')]],'as':_0x38bfad['as'],'attributes':_0x38bfad['attributes'],'include':_0x38bfad[_0xa004('0x23')]?_['map'](_0x38bfad[_0xa004('0x23')],function(_0xffb615){return{'model':db[_0xffb615['model']],'as':_0xffb615['as'],'attributes':_0xffb615[_0xa004('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa004('0x12')](function(_0x31b71d){logger[_0xa004('0x13')](_0xa004('0x27'),_0x436d3f);logger[_0xa004('0x26')](_0xa004('0x27'),_0x436d3f,JSON[_0xa004('0x29')](_0x31b71d));_0x1f93dc(_0x31b71d);})[_0xa004('0x1b')](function(_0x5a4dca){logger[_0xa004('0x17')](_0xa004('0x27'),_0x5a4dca[_0xa004('0x19')],_0x436d3f);_0x175d9d(_0x1493ae['error'](0x1f4,_0x5a4dca[_0xa004('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 2d48644..3a233d8 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 _0x3b00=['length','voiceQueue:','./voiceQueue.events','save','removeListener','register'];(function(_0x110be2,_0x303bd4){var _0x2c31c1=function(_0xf7ec84){while(--_0xf7ec84){_0x110be2['push'](_0x110be2['shift']());}};_0x2c31c1(++_0x303bd4);}(_0x3b00,0x134));var _0x03b0=function(_0x5e9b2d,_0x40933e){_0x5e9b2d=_0x5e9b2d-0x0;var _0xb2a3c9=_0x3b00[_0x5e9b2d];return _0xb2a3c9;};'use strict';var VoiceQueueEvents=require(_0x03b0('0x0'));var events=[_0x03b0('0x1'),'remove','update'];function createListener(_0x1c6c9a,_0x14121d){return function(_0x2ded99){_0x14121d['emit'](_0x1c6c9a,_0x2ded99);};}function removeListener(_0x3148cd,_0x4f1721){return function(){VoiceQueueEvents[_0x03b0('0x2')](_0x3148cd,_0x4f1721);};}exports[_0x03b0('0x3')]=function(_0x42a6f7){for(var _0x54c9ef=0x0,_0x1b1a36=events[_0x03b0('0x4')];_0x54c9ef<_0x1b1a36;_0x54c9ef++){var _0x30cb02=events[_0x54c9ef];var _0x2690e4=createListener(_0x03b0('0x5')+_0x30cb02,_0x42a6f7);VoiceQueueEvents['on'](_0x30cb02,_0x2690e4);}}; \ No newline at end of file +var _0x75ef=['length','voiceQueue:','./voiceQueue.events','remove','update','removeListener','register'];(function(_0x1e75bf,_0x47b6c4){var _0x3b820d=function(_0x1b2626){while(--_0x1b2626){_0x1e75bf['push'](_0x1e75bf['shift']());}};_0x3b820d(++_0x47b6c4);}(_0x75ef,0x10c));var _0xf75e=function(_0x5ea7a1,_0x5c7873){_0x5ea7a1=_0x5ea7a1-0x0;var _0x18cb17=_0x75ef[_0x5ea7a1];return _0x18cb17;};'use strict';var VoiceQueueEvents=require(_0xf75e('0x0'));var events=['save',_0xf75e('0x1'),_0xf75e('0x2')];function createListener(_0x6f741e,_0x4f7ede){return function(_0x14e7f1){_0x4f7ede['emit'](_0x6f741e,_0x14e7f1);};}function removeListener(_0x28ce2d,_0x442bf8){return function(){VoiceQueueEvents[_0xf75e('0x3')](_0x28ce2d,_0x442bf8);};}exports[_0xf75e('0x4')]=function(_0x1a34b9){for(var _0x27f518=0x0,_0x13ba3a=events[_0xf75e('0x5')];_0x27f518<_0x13ba3a;_0x27f518++){var _0x28a369=events[_0x27f518];var _0x3bb7b0=createListener(_0xf75e('0x6')+_0x28a369,_0x1a34b9);VoiceQueueEvents['on'](_0x28a369,_0x3bb7b0);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index dc1be5c..2852803 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 _0xfe62=['/index','/:id','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x174a1d,_0x580ab8){var _0x269f8b=function(_0x266260){while(--_0x266260){_0x174a1d['push'](_0x174a1d['shift']());}};_0x269f8b(++_0x580ab8);}(_0xfe62,0x197));var _0x2fe6=function(_0x273f16,_0x5f3019){_0x273f16=_0x273f16-0x0;var _0x422e82=_0xfe62[_0x273f16];return _0x422e82;};'use strict';var multer=require(_0x2fe6('0x0'));var util=require(_0x2fe6('0x1'));var path=require(_0x2fe6('0x2'));var timeout=require(_0x2fe6('0x3'));var express=require(_0x2fe6('0x4'));var router=express[_0x2fe6('0x5')]();var fs_extra=require(_0x2fe6('0x6'));var auth=require(_0x2fe6('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2fe6('0x8'));router[_0x2fe6('0x9')]('/',auth[_0x2fe6('0xa')](),controller[_0x2fe6('0xb')]);router[_0x2fe6('0x9')](_0x2fe6('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x2fe6('0x9')](_0x2fe6('0xd'),auth[_0x2fe6('0xa')](),controller['getVoiceQueuesReport']);router[_0x2fe6('0x9')](_0x2fe6('0xe'),auth['isAuthenticated'](),controller[_0x2fe6('0xf')]);router[_0x2fe6('0x10')]('/',auth[_0x2fe6('0xa')](),controller['create']);router[_0x2fe6('0x11')](_0x2fe6('0xe'),auth[_0x2fe6('0xa')](),controller[_0x2fe6('0x12')]);router['delete']('/:id',auth[_0x2fe6('0xa')](),controller[_0x2fe6('0x13')]);module[_0x2fe6('0x14')]=router; \ No newline at end of file +var _0xbe83=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','get','describe','show','post','put','/:id','update','destroy'];(function(_0x264747,_0x513a4d){var _0x4bb9c2=function(_0x5c0181){while(--_0x5c0181){_0x264747['push'](_0x264747['shift']());}};_0x4bb9c2(++_0x513a4d);}(_0xbe83,0x1a5));var _0x3be8=function(_0x4c7ec8,_0x9843bd){_0x4c7ec8=_0x4c7ec8-0x0;var _0x5d724a=_0xbe83[_0x4c7ec8];return _0x5d724a;};'use strict';var multer=require(_0x3be8('0x0'));var util=require(_0x3be8('0x1'));var path=require('path');var timeout=require(_0x3be8('0x2'));var express=require(_0x3be8('0x3'));var router=express[_0x3be8('0x4')]();var fs_extra=require(_0x3be8('0x5'));var auth=require(_0x3be8('0x6'));var interaction=require(_0x3be8('0x7'));var config=require(_0x3be8('0x8'));var controller=require(_0x3be8('0x9'));router['get']('/',auth[_0x3be8('0xa')](),controller[_0x3be8('0xb')]);router[_0x3be8('0xc')]('/describe',auth[_0x3be8('0xa')](),controller[_0x3be8('0xd')]);router[_0x3be8('0xc')]('/index',auth[_0x3be8('0xa')](),controller['getVoiceQueuesReport']);router[_0x3be8('0xc')]('/:id',auth[_0x3be8('0xa')](),controller[_0x3be8('0xe')]);router[_0x3be8('0xf')]('/',auth[_0x3be8('0xa')](),controller['create']);router[_0x3be8('0x10')](_0x3be8('0x11'),auth[_0x3be8('0xa')](),controller[_0x3be8('0x12')]);router['delete'](_0x3be8('0x11'),auth[_0x3be8('0xa')](),controller[_0x3be8('0x13')]);module[_0x3be8('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 3618dcd..6f95c4c 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 _0xa136=['setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','seconds','queuecallerleaveAt'];(function(_0x13e30c,_0x41251a){var _0x4447a9=function(_0x168834){while(--_0x168834){_0x13e30c['push'](_0x13e30c['shift']());}};_0x4447a9(++_0x41251a);}(_0xa136,0x176));var _0x6a13=function(_0xa0be1c,_0x152d5d){_0xa0be1c=_0xa0be1c-0x0;var _0x546eec=_0xa136[_0xa0be1c];return _0x546eec;};'use strict';var Sequelize=require(_0x6a13('0x0'));var moment=require('moment');module[_0x6a13('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x6a13('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6a13('0x2')]},'queue':{'type':Sequelize[_0x6a13('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x6a13('0x3')],'set':function(_0x41bfda){var _0xa0807c=moment(_0x41bfda);var _0x3b73e3=moment(this[_0x6a13('0x4')](_0x6a13('0x5')))[_0x6a13('0x6')](_0x6a13('0x7'));var _0x459bbe=_0xa0807c['diff'](_0x3b73e3,_0x6a13('0x8'));this['setDataValue'](_0x6a13('0x9'),_0x41bfda);this[_0x6a13('0xa')](_0x6a13('0xb'),_0x459bbe||null);}},'position':{'type':Sequelize[_0x6a13('0xc')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x6a13('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x6a13('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x6a13('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x6a13('0x2')],'comment':_0x6a13('0xe')},'originalposition':{'type':Sequelize[_0x6a13('0xc')]},'channel':{'type':Sequelize[_0x6a13('0x2')]},'connectedlinenum':{'type':Sequelize[_0x6a13('0x2')]},'connectedlinename':{'type':Sequelize[_0x6a13('0x2')]},'accountcode':{'type':Sequelize[_0x6a13('0x2')]},'context':{'type':Sequelize[_0x6a13('0x2')]},'exten':{'type':Sequelize[_0x6a13('0x2')]},'priority':{'type':Sequelize[_0x6a13('0x2')]},'holdtime':{'type':Sequelize[_0x6a13('0xc')]},'mohtime':{'type':Sequelize[_0x6a13('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6a13('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x6a13('0x2')],'comment':_0x6a13('0xf')},'transferexten':{'type':Sequelize[_0x6a13('0x2')]},'transferuniqueid':{'type':Sequelize[_0x6a13('0x2')]},'disposition':{'type':Sequelize[_0x6a13('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6a13('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x6a13('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4b2e=['queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','DATE','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','format','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue'];(function(_0x1abbe4,_0x24a174){var _0x51eaf4=function(_0x38af82){while(--_0x38af82){_0x1abbe4['push'](_0x1abbe4['shift']());}};_0x51eaf4(++_0x24a174);}(_0x4b2e,0x9d));var _0xe4b2=function(_0x470554,_0x31017a){_0x470554=_0x470554-0x0;var _0x4cfc1e=_0x4b2e[_0x470554];return _0x4cfc1e;};'use strict';var Sequelize=require(_0xe4b2('0x0'));var moment=require(_0xe4b2('0x1'));module[_0xe4b2('0x2')]={'type':{'type':Sequelize[_0xe4b2('0x3')]},'uniqueid':{'type':Sequelize[_0xe4b2('0x3')]},'calleridnum':{'type':Sequelize[_0xe4b2('0x3')]},'calleridname':{'type':Sequelize[_0xe4b2('0x3')]},'queue':{'type':Sequelize[_0xe4b2('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x3e5d99){var _0x184cf1=moment(_0x3e5d99);var _0x2316ed=moment(this['getDataValue']('queuecallerjoinAt'))[_0xe4b2('0x4')](_0xe4b2('0x5'));var _0x40ff3a=_0x184cf1['diff'](_0x2316ed,_0xe4b2('0x6'));this[_0xe4b2('0x7')](_0xe4b2('0x8'),_0x3e5d99);this[_0xe4b2('0x7')](_0xe4b2('0x9'),_0x40ff3a||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0xe4b2('0xa')]},'queuecallerabandon':{'type':Sequelize[_0xe4b2('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xe4b2('0xc')]},'queuecallercomplete':{'type':Sequelize[_0xe4b2('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xe4b2('0xc')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xe4b2('0xc')]},'queuecallerexitreason':{'type':Sequelize[_0xe4b2('0x3')],'comment':_0xe4b2('0xd')},'originalposition':{'type':Sequelize[_0xe4b2('0xa')]},'channel':{'type':Sequelize[_0xe4b2('0x3')]},'connectedlinenum':{'type':Sequelize[_0xe4b2('0x3')]},'connectedlinename':{'type':Sequelize[_0xe4b2('0x3')]},'accountcode':{'type':Sequelize[_0xe4b2('0x3')]},'context':{'type':Sequelize[_0xe4b2('0x3')]},'exten':{'type':Sequelize[_0xe4b2('0x3')]},'priority':{'type':Sequelize[_0xe4b2('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xe4b2('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xe4b2('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xe4b2('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xe4b2('0xe')},'transferexten':{'type':Sequelize[_0xe4b2('0x3')]},'transferuniqueid':{'type':Sequelize[_0xe4b2('0x3')]},'disposition':{'type':Sequelize[_0xe4b2('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0xe4b2('0xa')],'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 a744e15..648c5a5 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 _0x7dec=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','map','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','VoiceQueueReport','includeAll','include','findAll','catch','show','params','find','create','body','describe','filter','rows','getVoiceQueuesReport','eml-format'];(function(_0xe1bef,_0x547214){var _0x5717a8=function(_0x32243a){while(--_0x32243a){_0xe1bef['push'](_0xe1bef['shift']());}};_0x5717a8(++_0x547214);}(_0x7dec,0x1ad));var _0xc7de=function(_0x3bef2c,_0x5a86fd){_0x3bef2c=_0x3bef2c-0x0;var _0x331503=_0x7dec[_0x3bef2c];return _0x331503;};'use strict';var emlformat=require(_0xc7de('0x0'));var rimraf=require(_0xc7de('0x1'));var zipdir=require(_0xc7de('0x2'));var jsonpatch=require(_0xc7de('0x3'));var rp=require(_0xc7de('0x4'));var moment=require(_0xc7de('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc7de('0x6'));var util=require('util');var path=require(_0xc7de('0x7'));var sox=require('sox');var csv=require(_0xc7de('0x8'));var ejs=require(_0xc7de('0x9'));var fs=require('fs');var fs_extra=require(_0xc7de('0xa'));var _=require(_0xc7de('0xb'));var squel=require(_0xc7de('0xc'));var crypto=require(_0xc7de('0xd'));var jsforce=require(_0xc7de('0xe'));var deskjs=require(_0xc7de('0xf'));var toCsv=require(_0xc7de('0x8'));var querystring=require('querystring');var Papa=require(_0xc7de('0x10'));var Redis=require(_0xc7de('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc7de('0x12'));var as=require(_0xc7de('0x13'));var hardwareService=require(_0xc7de('0x14'));var logger=require(_0xc7de('0x15'))(_0xc7de('0x16'));var utils=require(_0xc7de('0x17'));var config=require(_0xc7de('0x18'));var licenseUtil=require(_0xc7de('0x19'));var db=require(_0xc7de('0x1a'))['db'];config['redis']=_[_0xc7de('0x1b')](config[_0xc7de('0x1c')],{'host':_0xc7de('0x1d'),'port':0x18eb});var socket=require(_0xc7de('0x1e'))(new Redis(config[_0xc7de('0x1c')]));require('./voiceQueueReport.socket')[_0xc7de('0x1f')](socket);function respondWithStatusCode(_0x3b944,_0x5c2a33){_0x5c2a33=_0x5c2a33||0xcc;return function(_0x5396b9){if(_0x5396b9){return _0x3b944[_0xc7de('0x20')](_0x5c2a33);}return _0x3b944['status'](_0x5c2a33)[_0xc7de('0x21')]();};}function respondWithResult(_0x4f53fa,_0x4604f7){_0x4604f7=_0x4604f7||0xc8;return function(_0x22be3f){if(_0x22be3f){return _0x4f53fa[_0xc7de('0x22')](_0x4604f7)[_0xc7de('0x23')](_0x22be3f);}};}function respondWithFilteredResult(_0x48e0cd,_0x101dc6){return function(_0x528bcf){if(_0x528bcf){var _0x41bb56=typeof _0x101dc6[_0xc7de('0x24')]===_0xc7de('0x25')&&typeof _0x101dc6['limit']===_0xc7de('0x25');var _0x13947f=_0x528bcf[_0xc7de('0x26')];var _0x28d4cd=_0x41bb56?0x0:_0x101dc6[_0xc7de('0x24')];var _0x3187d7=_0x41bb56?_0x528bcf[_0xc7de('0x26')]:_0x101dc6[_0xc7de('0x24')]+_0x101dc6[_0xc7de('0x27')];var _0x4b872;if(_0x3187d7>=_0x13947f){_0x3187d7=_0x13947f;_0x4b872=0xc8;}else{_0x4b872=0xce;}_0x48e0cd[_0xc7de('0x22')](_0x4b872);return _0x48e0cd[_0xc7de('0x28')](_0xc7de('0x29'),_0x28d4cd+'-'+_0x3187d7+'/'+_0x13947f)[_0xc7de('0x23')](_0x528bcf);}return null;};}function patchUpdates(_0x5c9f6e){return function(_0x24c447){try{jsonpatch[_0xc7de('0x2a')](_0x24c447,_0x5c9f6e,!![]);}catch(_0x575748){return BPromise['reject'](_0x575748);}return _0x24c447[_0xc7de('0x2b')]();};}function saveUpdates(_0x1f0c56,_0x300b91){return function(_0x2d31d1){if(_0x2d31d1){return _0x2d31d1[_0xc7de('0x2c')](_0x1f0c56)['then'](function(_0x5be01c){return _0x5be01c;});}return null;};}function removeEntity(_0x1fde80,_0x166d53){return function(_0x11c5f5){if(_0x11c5f5){return _0x11c5f5[_0xc7de('0x2d')]()[_0xc7de('0x2e')](function(){_0x1fde80['status'](0xcc)[_0xc7de('0x21')]();});}};}function handleEntityNotFound(_0x42d680,_0x1ac7bb){return function(_0x3f0562){if(!_0x3f0562){_0x42d680[_0xc7de('0x20')](0x194);}return _0x3f0562;};}function handleError(_0x1dc85c,_0x12e25e){_0x12e25e=_0x12e25e||0x1f4;return function(_0x3aad44){logger[_0xc7de('0x2f')](_0x3aad44[_0xc7de('0x30')]);if(_0x3aad44[_0xc7de('0x31')]){delete _0x3aad44[_0xc7de('0x31')];}_0x1dc85c[_0xc7de('0x22')](_0x12e25e)['send'](_0x3aad44);};}exports['index']=function(_0x5e26b2,_0x5edf51){var _0x1cf2bb={},_0x7576b1={},_0x594d70={'count':0x0,'rows':[]};var _0x1bb025=_[_0xc7de('0x32')](db['VoiceQueueReport'][_0xc7de('0x33')],function(_0x12a16e){return{'name':_0x12a16e[_0xc7de('0x34')],'type':_0x12a16e['type'][_0xc7de('0x35')]};});_0x7576b1['model']=_[_0xc7de('0x32')](_0x1bb025,_0xc7de('0x31'));_0x7576b1[_0xc7de('0x36')]=_[_0xc7de('0x37')](_0x5e26b2[_0xc7de('0x36')]);_0x7576b1[_0xc7de('0x38')]=_['intersection'](_0x7576b1[_0xc7de('0x39')],_0x7576b1['query']);_0x1cf2bb[_0xc7de('0x3a')]=_[_0xc7de('0x3b')](_0x7576b1[_0xc7de('0x39')],qs[_0xc7de('0x3c')](_0x5e26b2[_0xc7de('0x36')][_0xc7de('0x3c')]));_0x1cf2bb[_0xc7de('0x3a')]=_0x1cf2bb[_0xc7de('0x3a')][_0xc7de('0x3d')]?_0x1cf2bb[_0xc7de('0x3a')]:_0x7576b1[_0xc7de('0x39')];if(!_0x5e26b2[_0xc7de('0x36')][_0xc7de('0x3e')](_0xc7de('0x3f'))){_0x1cf2bb['limit']=qs[_0xc7de('0x27')](_0x5e26b2[_0xc7de('0x36')][_0xc7de('0x27')]);_0x1cf2bb[_0xc7de('0x24')]=qs[_0xc7de('0x24')](_0x5e26b2['query'][_0xc7de('0x24')]);}_0x1cf2bb[_0xc7de('0x40')]=qs[_0xc7de('0x41')](_0x5e26b2[_0xc7de('0x36')][_0xc7de('0x41')]);_0x1cf2bb[_0xc7de('0x42')]=qs['filters'](_[_0xc7de('0x43')](_0x5e26b2[_0xc7de('0x36')],_0x7576b1['filters']),_0x1bb025);if(_0x5e26b2['query']['filter']){_0x1cf2bb[_0xc7de('0x42')]=_[_0xc7de('0x44')](_0x1cf2bb['where'],{'$or':_['map'](_0x1bb025,function(_0x4971bb){if(_0x4971bb[_0xc7de('0x45')]!==_0xc7de('0x46')){var _0x1ace80={};_0x1ace80[_0x4971bb['name']]={'$like':'%'+_0x5e26b2[_0xc7de('0x36')]['filter']+'%'};return _0x1ace80;}})});}_0x1cf2bb=_[_0xc7de('0x44')]({},_0x1cf2bb,_0x5e26b2[_0xc7de('0x47')]);var _0x59561e={'where':_0x1cf2bb[_0xc7de('0x42')]};return db[_0xc7de('0x48')][_0xc7de('0x26')](_0x59561e)[_0xc7de('0x2e')](function(_0x5798fb){_0x594d70[_0xc7de('0x26')]=_0x5798fb;if(_0x5e26b2[_0xc7de('0x36')][_0xc7de('0x49')]){_0x1cf2bb[_0xc7de('0x4a')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xc7de('0x4b')](_0x1cf2bb);})[_0xc7de('0x2e')](function(_0x5f09ec){_0x594d70['rows']=_0x5f09ec;return _0x594d70;})[_0xc7de('0x2e')](respondWithFilteredResult(_0x5edf51,_0x1cf2bb))[_0xc7de('0x4c')](handleError(_0x5edf51,null));};exports[_0xc7de('0x4d')]=function(_0x1b1ce9,_0x1d42b5){var _0x9908aa={'raw':![],'where':{'id':_0x1b1ce9[_0xc7de('0x4e')]['id']}},_0x125878={};_0x125878[_0xc7de('0x39')]=_['keys'](db['VoiceQueueReport'][_0xc7de('0x33')]);_0x125878[_0xc7de('0x36')]=_[_0xc7de('0x37')](_0x1b1ce9[_0xc7de('0x36')]);_0x125878['filters']=_[_0xc7de('0x3b')](_0x125878[_0xc7de('0x39')],_0x125878['query']);_0x9908aa[_0xc7de('0x3a')]=_[_0xc7de('0x3b')](_0x125878[_0xc7de('0x39')],qs[_0xc7de('0x3c')](_0x1b1ce9[_0xc7de('0x36')][_0xc7de('0x3c')]));_0x9908aa[_0xc7de('0x3a')]=_0x9908aa['attributes'][_0xc7de('0x3d')]?_0x9908aa[_0xc7de('0x3a')]:_0x125878['model'];if(_0x1b1ce9[_0xc7de('0x36')][_0xc7de('0x49')]){_0x9908aa['include']=[{'all':!![]}];}_0x9908aa=_[_0xc7de('0x44')]({},_0x9908aa,_0x1b1ce9[_0xc7de('0x47')]);return db[_0xc7de('0x48')][_0xc7de('0x4f')](_0x9908aa)[_0xc7de('0x2e')](handleEntityNotFound(_0x1d42b5,null))[_0xc7de('0x2e')](respondWithResult(_0x1d42b5,null))[_0xc7de('0x4c')](handleError(_0x1d42b5,null));};exports['create']=function(_0x28dba0,_0xe97e39){return db[_0xc7de('0x48')][_0xc7de('0x50')](_0x28dba0[_0xc7de('0x51')],{})['then'](respondWithResult(_0xe97e39,0xc9))[_0xc7de('0x4c')](handleError(_0xe97e39,null));};exports['update']=function(_0x343c19,_0x27bf6e){if(_0x343c19[_0xc7de('0x51')]['id']){delete _0x343c19[_0xc7de('0x51')]['id'];}return db[_0xc7de('0x48')][_0xc7de('0x4f')]({'where':{'id':_0x343c19[_0xc7de('0x4e')]['id']}})[_0xc7de('0x2e')](handleEntityNotFound(_0x27bf6e,null))[_0xc7de('0x2e')](saveUpdates(_0x343c19[_0xc7de('0x51')],null))[_0xc7de('0x2e')](respondWithResult(_0x27bf6e,null))['catch'](handleError(_0x27bf6e,null));};exports[_0xc7de('0x2d')]=function(_0x2dd299,_0xacbfaa){return db['VoiceQueueReport'][_0xc7de('0x4f')]({'where':{'id':_0x2dd299['params']['id']}})[_0xc7de('0x2e')](handleEntityNotFound(_0xacbfaa,null))['then'](removeEntity(_0xacbfaa,null))[_0xc7de('0x4c')](handleError(_0xacbfaa,null));};exports[_0xc7de('0x52')]=function(_0x552e2c,_0x368c0d){return db[_0xc7de('0x48')]['describe']()[_0xc7de('0x2e')](respondWithResult(_0x368c0d,null))[_0xc7de('0x4c')](handleError(_0x368c0d,null));};exports['getVoiceQueuesReport']=function(_0x550f3a,_0x32813b){var _0x3b1141={},_0x3f7170={},_0x29d0a5={'count':0x0,'rows':[]};_0x3f7170[_0xc7de('0x39')]=_[_0xc7de('0x37')](db[_0xc7de('0x48')]['rawAttributes']);_0x3f7170[_0xc7de('0x36')]=_[_0xc7de('0x37')](_0x550f3a[_0xc7de('0x36')]);_0x3f7170[_0xc7de('0x38')]=_[_0xc7de('0x3b')](_0x3f7170[_0xc7de('0x39')],_0x3f7170['query']);_0x3b1141[_0xc7de('0x3a')]=_[_0xc7de('0x3b')](_0x3f7170[_0xc7de('0x39')],qs[_0xc7de('0x3c')](_0x550f3a[_0xc7de('0x36')][_0xc7de('0x3c')]));_0x3b1141[_0xc7de('0x3a')]=_0x3b1141[_0xc7de('0x3a')]['length']?_0x3b1141['attributes']:_0x3f7170[_0xc7de('0x39')];if(!_0x550f3a['query'][_0xc7de('0x3e')](_0xc7de('0x3f'))){_0x3b1141[_0xc7de('0x27')]=qs[_0xc7de('0x27')](_0x550f3a[_0xc7de('0x36')][_0xc7de('0x27')]);_0x3b1141[_0xc7de('0x24')]=qs[_0xc7de('0x24')](_0x550f3a[_0xc7de('0x36')][_0xc7de('0x24')]);}_0x3b1141[_0xc7de('0x40')]=qs['sort'](_0x550f3a[_0xc7de('0x36')][_0xc7de('0x41')]);_0x3b1141['where']=qs[_0xc7de('0x38')](_[_0xc7de('0x43')](_0x550f3a[_0xc7de('0x36')],_0x3f7170[_0xc7de('0x38')]));if(_0x550f3a[_0xc7de('0x36')][_0xc7de('0x53')]){_0x3b1141[_0xc7de('0x42')]=_[_0xc7de('0x44')](_0x3b1141[_0xc7de('0x42')],{'$or':_['map'](_0x3b1141[_0xc7de('0x3a')],function(_0x45879c){var _0x5f287f={};_0x5f287f[_0x45879c]={'$like':'%'+_0x550f3a['query'][_0xc7de('0x53')]+'%'};return _0x5f287f;})});}_0x3b1141=_[_0xc7de('0x44')]({},_0x3b1141,_0x550f3a[_0xc7de('0x47')]);var _0x1f0386={'where':_0x3b1141[_0xc7de('0x42')]};return db[_0xc7de('0x48')][_0xc7de('0x26')](_0x1f0386)[_0xc7de('0x2e')](function(_0xad2bcd){_0x29d0a5[_0xc7de('0x26')]=_0xad2bcd;if(_0x550f3a[_0xc7de('0x36')]['includeAll']){_0x3b1141[_0xc7de('0x4a')]=[{'all':!![]}];}return db[_0xc7de('0x48')]['findAll'](_0x3b1141);})[_0xc7de('0x2e')](function(_0x36843d){_0x29d0a5[_0xc7de('0x54')]=_0x36843d;return _0x29d0a5;})[_0xc7de('0x2e')](respondWithFilteredResult(_0x32813b,_0x3b1141,'getVoiceQueuesReport'))[_0xc7de('0x4c')](handleError(_0x32813b,null,_0xc7de('0x55')));}; \ No newline at end of file +var _0x4c68=['hasOwnProperty','nolimit','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./voiceQueueReport.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','save','then','destroy','error','stack','name','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','params','includeAll','include','find','catch','create','body','update','describe','getVoiceQueuesReport'];(function(_0x156869,_0x1a70e8){var _0x3b7c72=function(_0x2b45c4){while(--_0x2b45c4){_0x156869['push'](_0x156869['shift']());}};_0x3b7c72(++_0x1a70e8);}(_0x4c68,0xa6));var _0x84c6=function(_0x2d3c60,_0x4df458){_0x2d3c60=_0x2d3c60-0x0;var _0x560041=_0x4c68[_0x2d3c60];return _0x560041;};'use strict';var emlformat=require(_0x84c6('0x0'));var rimraf=require(_0x84c6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x84c6('0x2'));var BPromise=require(_0x84c6('0x3'));var Mustache=require('mustache');var util=require(_0x84c6('0x4'));var path=require(_0x84c6('0x5'));var sox=require(_0x84c6('0x6'));var csv=require(_0x84c6('0x7'));var ejs=require(_0x84c6('0x8'));var fs=require('fs');var fs_extra=require(_0x84c6('0x9'));var _=require(_0x84c6('0xa'));var squel=require(_0x84c6('0xb'));var crypto=require(_0x84c6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x84c6('0xd'));var toCsv=require('to-csv');var querystring=require(_0x84c6('0xe'));var Papa=require(_0x84c6('0xf'));var Redis=require('ioredis');var authService=require(_0x84c6('0x10'));var qs=require(_0x84c6('0x11'));var as=require(_0x84c6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x84c6('0x13'))(_0x84c6('0x14'));var utils=require(_0x84c6('0x15'));var config=require(_0x84c6('0x16'));var licenseUtil=require(_0x84c6('0x17'));var db=require(_0x84c6('0x18'))['db'];config[_0x84c6('0x19')]=_['defaults'](config[_0x84c6('0x19')],{'host':_0x84c6('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x84c6('0x1b'))[_0x84c6('0x1c')](socket);function respondWithStatusCode(_0x44eb1f,_0x105acb){_0x105acb=_0x105acb||0xcc;return function(_0x1c6177){if(_0x1c6177){return _0x44eb1f[_0x84c6('0x1d')](_0x105acb);}return _0x44eb1f['status'](_0x105acb)[_0x84c6('0x1e')]();};}function respondWithResult(_0x48965d,_0x1af824){_0x1af824=_0x1af824||0xc8;return function(_0x1b37d2){if(_0x1b37d2){return _0x48965d[_0x84c6('0x1f')](_0x1af824)[_0x84c6('0x20')](_0x1b37d2);}};}function respondWithFilteredResult(_0x46c1ce,_0x1498eb){return function(_0x53f3d9){if(_0x53f3d9){var _0x2921ca=typeof _0x1498eb['offset']===_0x84c6('0x21')&&typeof _0x1498eb[_0x84c6('0x22')]===_0x84c6('0x21');var _0x2f6dc7=_0x53f3d9[_0x84c6('0x23')];var _0x1e86de=_0x2921ca?0x0:_0x1498eb[_0x84c6('0x24')];var _0x272317=_0x2921ca?_0x53f3d9[_0x84c6('0x23')]:_0x1498eb['offset']+_0x1498eb[_0x84c6('0x22')];var _0x288436;if(_0x272317>=_0x2f6dc7){_0x272317=_0x2f6dc7;_0x288436=0xc8;}else{_0x288436=0xce;}_0x46c1ce[_0x84c6('0x1f')](_0x288436);return _0x46c1ce[_0x84c6('0x25')]('Content-Range',_0x1e86de+'-'+_0x272317+'/'+_0x2f6dc7)[_0x84c6('0x20')](_0x53f3d9);}return null;};}function patchUpdates(_0x33383d){return function(_0x370939){try{jsonpatch[_0x84c6('0x26')](_0x370939,_0x33383d,!![]);}catch(_0xbe38f8){return BPromise['reject'](_0xbe38f8);}return _0x370939[_0x84c6('0x27')]();};}function saveUpdates(_0x1114cb,_0x3f955c){return function(_0x597caf){if(_0x597caf){return _0x597caf['update'](_0x1114cb)[_0x84c6('0x28')](function(_0x431457){return _0x431457;});}return null;};}function removeEntity(_0x2ac745,_0x44ccb3){return function(_0x5b98e3){if(_0x5b98e3){return _0x5b98e3[_0x84c6('0x29')]()['then'](function(){_0x2ac745[_0x84c6('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c93ed,_0xcbfe27){return function(_0x4f9f88){if(!_0x4f9f88){_0x4c93ed[_0x84c6('0x1d')](0x194);}return _0x4f9f88;};}function handleError(_0x5bea1d,_0x538bb6){_0x538bb6=_0x538bb6||0x1f4;return function(_0x529c44){logger[_0x84c6('0x2a')](_0x529c44[_0x84c6('0x2b')]);if(_0x529c44[_0x84c6('0x2c')]){delete _0x529c44[_0x84c6('0x2c')];}_0x5bea1d[_0x84c6('0x1f')](_0x538bb6)['send'](_0x529c44);};}exports[_0x84c6('0x2d')]=function(_0x4041bb,_0x5bac8f){var _0x203a24={},_0x5ddc4e={},_0x1c50d4={'count':0x0,'rows':[]};var _0xc01b3e=_[_0x84c6('0x2e')](db[_0x84c6('0x2f')][_0x84c6('0x30')],function(_0x494cd0){return{'name':_0x494cd0[_0x84c6('0x31')],'type':_0x494cd0[_0x84c6('0x32')][_0x84c6('0x33')]};});_0x5ddc4e[_0x84c6('0x34')]=_[_0x84c6('0x2e')](_0xc01b3e,'name');_0x5ddc4e['query']=_[_0x84c6('0x35')](_0x4041bb[_0x84c6('0x36')]);_0x5ddc4e[_0x84c6('0x37')]=_[_0x84c6('0x38')](_0x5ddc4e[_0x84c6('0x34')],_0x5ddc4e[_0x84c6('0x36')]);_0x203a24[_0x84c6('0x39')]=_[_0x84c6('0x38')](_0x5ddc4e[_0x84c6('0x34')],qs[_0x84c6('0x3a')](_0x4041bb[_0x84c6('0x36')][_0x84c6('0x3a')]));_0x203a24[_0x84c6('0x39')]=_0x203a24['attributes'][_0x84c6('0x3b')]?_0x203a24[_0x84c6('0x39')]:_0x5ddc4e[_0x84c6('0x34')];if(!_0x4041bb[_0x84c6('0x36')]['hasOwnProperty']('nolimit')){_0x203a24[_0x84c6('0x22')]=qs[_0x84c6('0x22')](_0x4041bb['query'][_0x84c6('0x22')]);_0x203a24[_0x84c6('0x24')]=qs[_0x84c6('0x24')](_0x4041bb[_0x84c6('0x36')][_0x84c6('0x24')]);}_0x203a24[_0x84c6('0x3c')]=qs[_0x84c6('0x3d')](_0x4041bb[_0x84c6('0x36')][_0x84c6('0x3d')]);_0x203a24[_0x84c6('0x3e')]=qs['filters'](_[_0x84c6('0x3f')](_0x4041bb[_0x84c6('0x36')],_0x5ddc4e['filters']),_0xc01b3e);if(_0x4041bb[_0x84c6('0x36')][_0x84c6('0x40')]){_0x203a24[_0x84c6('0x3e')]=_['merge'](_0x203a24[_0x84c6('0x3e')],{'$or':_['map'](_0xc01b3e,function(_0x531255){if(_0x531255[_0x84c6('0x32')]!==_0x84c6('0x41')){var _0x2cfc27={};_0x2cfc27[_0x531255[_0x84c6('0x2c')]]={'$like':'%'+_0x4041bb[_0x84c6('0x36')][_0x84c6('0x40')]+'%'};return _0x2cfc27;}})});}_0x203a24=_[_0x84c6('0x42')]({},_0x203a24,_0x4041bb[_0x84c6('0x43')]);var _0x4c4b66={'where':_0x203a24[_0x84c6('0x3e')]};return db[_0x84c6('0x2f')][_0x84c6('0x23')](_0x4c4b66)['then'](function(_0xb03113){_0x1c50d4[_0x84c6('0x23')]=_0xb03113;if(_0x4041bb[_0x84c6('0x36')]['includeAll']){_0x203a24['include']=[{'all':!![]}];}return db[_0x84c6('0x2f')][_0x84c6('0x44')](_0x203a24);})[_0x84c6('0x28')](function(_0x20d6e9){_0x1c50d4[_0x84c6('0x45')]=_0x20d6e9;return _0x1c50d4;})[_0x84c6('0x28')](respondWithFilteredResult(_0x5bac8f,_0x203a24))['catch'](handleError(_0x5bac8f,null));};exports['show']=function(_0x38756d,_0x482a92){var _0x165b98={'raw':![],'where':{'id':_0x38756d[_0x84c6('0x46')]['id']}},_0xadab66={};_0xadab66[_0x84c6('0x34')]=_['keys'](db[_0x84c6('0x2f')][_0x84c6('0x30')]);_0xadab66[_0x84c6('0x36')]=_[_0x84c6('0x35')](_0x38756d['query']);_0xadab66['filters']=_['intersection'](_0xadab66[_0x84c6('0x34')],_0xadab66[_0x84c6('0x36')]);_0x165b98['attributes']=_['intersection'](_0xadab66[_0x84c6('0x34')],qs['fields'](_0x38756d[_0x84c6('0x36')][_0x84c6('0x3a')]));_0x165b98[_0x84c6('0x39')]=_0x165b98[_0x84c6('0x39')][_0x84c6('0x3b')]?_0x165b98['attributes']:_0xadab66['model'];if(_0x38756d['query'][_0x84c6('0x47')]){_0x165b98[_0x84c6('0x48')]=[{'all':!![]}];}_0x165b98=_[_0x84c6('0x42')]({},_0x165b98,_0x38756d['options']);return db[_0x84c6('0x2f')][_0x84c6('0x49')](_0x165b98)[_0x84c6('0x28')](handleEntityNotFound(_0x482a92,null))[_0x84c6('0x28')](respondWithResult(_0x482a92,null))[_0x84c6('0x4a')](handleError(_0x482a92,null));};exports[_0x84c6('0x4b')]=function(_0x1f9cee,_0x211c10){return db['VoiceQueueReport'][_0x84c6('0x4b')](_0x1f9cee[_0x84c6('0x4c')],{})[_0x84c6('0x28')](respondWithResult(_0x211c10,0xc9))['catch'](handleError(_0x211c10,null));};exports[_0x84c6('0x4d')]=function(_0x50da41,_0x410ded){if(_0x50da41[_0x84c6('0x4c')]['id']){delete _0x50da41[_0x84c6('0x4c')]['id'];}return db[_0x84c6('0x2f')]['find']({'where':{'id':_0x50da41[_0x84c6('0x46')]['id']}})[_0x84c6('0x28')](handleEntityNotFound(_0x410ded,null))['then'](saveUpdates(_0x50da41['body'],null))[_0x84c6('0x28')](respondWithResult(_0x410ded,null))['catch'](handleError(_0x410ded,null));};exports[_0x84c6('0x29')]=function(_0x29dbe2,_0x5e54c3){return db['VoiceQueueReport'][_0x84c6('0x49')]({'where':{'id':_0x29dbe2[_0x84c6('0x46')]['id']}})[_0x84c6('0x28')](handleEntityNotFound(_0x5e54c3,null))[_0x84c6('0x28')](removeEntity(_0x5e54c3,null))[_0x84c6('0x4a')](handleError(_0x5e54c3,null));};exports[_0x84c6('0x4e')]=function(_0x379145,_0x479e22){return db[_0x84c6('0x2f')][_0x84c6('0x4e')]()[_0x84c6('0x28')](respondWithResult(_0x479e22,null))[_0x84c6('0x4a')](handleError(_0x479e22,null));};exports[_0x84c6('0x4f')]=function(_0x1080a0,_0x2f8b51){var _0x3ac0c3={},_0x5c691e={},_0x528c81={'count':0x0,'rows':[]};_0x5c691e[_0x84c6('0x34')]=_[_0x84c6('0x35')](db[_0x84c6('0x2f')][_0x84c6('0x30')]);_0x5c691e[_0x84c6('0x36')]=_[_0x84c6('0x35')](_0x1080a0['query']);_0x5c691e[_0x84c6('0x37')]=_['intersection'](_0x5c691e['model'],_0x5c691e['query']);_0x3ac0c3[_0x84c6('0x39')]=_[_0x84c6('0x38')](_0x5c691e['model'],qs[_0x84c6('0x3a')](_0x1080a0[_0x84c6('0x36')][_0x84c6('0x3a')]));_0x3ac0c3[_0x84c6('0x39')]=_0x3ac0c3[_0x84c6('0x39')][_0x84c6('0x3b')]?_0x3ac0c3[_0x84c6('0x39')]:_0x5c691e[_0x84c6('0x34')];if(!_0x1080a0[_0x84c6('0x36')][_0x84c6('0x50')](_0x84c6('0x51'))){_0x3ac0c3['limit']=qs['limit'](_0x1080a0[_0x84c6('0x36')][_0x84c6('0x22')]);_0x3ac0c3[_0x84c6('0x24')]=qs[_0x84c6('0x24')](_0x1080a0[_0x84c6('0x36')]['offset']);}_0x3ac0c3[_0x84c6('0x3c')]=qs['sort'](_0x1080a0[_0x84c6('0x36')][_0x84c6('0x3d')]);_0x3ac0c3[_0x84c6('0x3e')]=qs['filters'](_[_0x84c6('0x3f')](_0x1080a0['query'],_0x5c691e[_0x84c6('0x37')]));if(_0x1080a0[_0x84c6('0x36')]['filter']){_0x3ac0c3[_0x84c6('0x3e')]=_[_0x84c6('0x42')](_0x3ac0c3[_0x84c6('0x3e')],{'$or':_['map'](_0x3ac0c3[_0x84c6('0x39')],function(_0x16a51a){var _0x9de95b={};_0x9de95b[_0x16a51a]={'$like':'%'+_0x1080a0['query'][_0x84c6('0x40')]+'%'};return _0x9de95b;})});}_0x3ac0c3=_[_0x84c6('0x42')]({},_0x3ac0c3,_0x1080a0[_0x84c6('0x43')]);var _0x40ad7f={'where':_0x3ac0c3['where']};return db[_0x84c6('0x2f')][_0x84c6('0x23')](_0x40ad7f)[_0x84c6('0x28')](function(_0x58dced){_0x528c81['count']=_0x58dced;if(_0x1080a0[_0x84c6('0x36')][_0x84c6('0x47')]){_0x3ac0c3['include']=[{'all':!![]}];}return db[_0x84c6('0x2f')]['findAll'](_0x3ac0c3);})['then'](function(_0x4d97dd){_0x528c81[_0x84c6('0x45')]=_0x4d97dd;return _0x528c81;})[_0x84c6('0x28')](respondWithFilteredResult(_0x2f8b51,_0x3ac0c3,_0x84c6('0x4f')))[_0x84c6('0x4a')](handleError(_0x2f8b51,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 066f1da..c304086 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 _0x7d49=['update','remove','hasOwnProperty','events','../../mysqldb','VoiceQueueReport','setMaxListeners'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x7d49,0x18b));var _0x97d4=function(_0x3ae707,_0x1c502f){_0x3ae707=_0x3ae707-0x0;var _0xa148bb=_0x7d49[_0x3ae707];return _0xa148bb;};'use strict';var EventEmitter=require(_0x97d4('0x0'));var VoiceQueueReport=require(_0x97d4('0x1'))['db'][_0x97d4('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x97d4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x97d4('0x4'),'afterDestroy':_0x97d4('0x5')};function emitEvent(_0x20963a){return function(_0x5c695b,_0x231ebe,_0x55db15){VoiceQueueReportEvents['emit'](_0x20963a+':'+_0x5c695b['id'],_0x5c695b);VoiceQueueReportEvents['emit'](_0x20963a,_0x5c695b);_0x55db15(null);};}for(var e in events){if(events[_0x97d4('0x6')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x350c=['VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x350c,0xda));var _0xc350=function(_0x2595f1,_0x280165){_0x2595f1=_0x2595f1-0x0;var _0x1016c5=_0x350c[_0x2595f1];return _0x1016c5;};'use strict';var EventEmitter=require(_0xc350('0x0'));var VoiceQueueReport=require(_0xc350('0x1'))['db'][_0xc350('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xc350('0x3')](0x0);var events={'afterCreate':_0xc350('0x4'),'afterUpdate':_0xc350('0x5'),'afterDestroy':_0xc350('0x6')};function emitEvent(_0x4c4bde){return function(_0x51a33b,_0x56bbe8,_0x292e6f){VoiceQueueReportEvents['emit'](_0x4c4bde+':'+_0x51a33b['id'],_0x51a33b);VoiceQueueReportEvents[_0xc350('0x7')](_0x4c4bde,_0x51a33b);_0x292e6f(null);};}for(var e in events){if(events[_0xc350('0x8')](e)){var event=events[e];VoiceQueueReport[_0xc350('0x9')](e,emitEvent(event));}}module[_0xc350('0xa')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 2cd1a67..583d782 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 _0x28bf=['./voiceQueueReport.attributes','exports','define','moment','request-promise','rimraf','../../config/environment'];(function(_0x260200,_0x2ad688){var _0x19391f=function(_0x592306){while(--_0x592306){_0x260200['push'](_0x260200['shift']());}};_0x19391f(++_0x2ad688);}(_0x28bf,0xe3));var _0xf28b=function(_0xb64a6,_0x12f08c){_0xb64a6=_0xb64a6-0x0;var _0x28abcd=_0x28bf[_0xb64a6];return _0x28abcd;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf28b('0x0'));var BPromise=require('bluebird');var rp=require(_0xf28b('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf28b('0x2'));var config=require(_0xf28b('0x3'));var attributes=require(_0xf28b('0x4'));module[_0xf28b('0x5')]=function(_0x1e3a2c,_0x43a216){return _0x1e3a2c[_0xf28b('0x6')]('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5b7b=['api','moment','request-promise','path','rimraf','../../config/environment','define','VoiceQueueReport','report_queue','uniqueid','util','../../config/logger'];(function(_0x272361,_0x59a12f){var _0x1ed300=function(_0x529047){while(--_0x529047){_0x272361['push'](_0x272361['shift']());}};_0x1ed300(++_0x59a12f);}(_0x5b7b,0x1a2));var _0xb5b7=function(_0x5a2285,_0x3212d1){_0x5a2285=_0x5a2285-0x0;var _0x48f6ed=_0x5b7b[_0x5a2285];return _0x48f6ed;};'use strict';var _=require('lodash');var util=require(_0xb5b7('0x0'));var logger=require(_0xb5b7('0x1'))(_0xb5b7('0x2'));var moment=require(_0xb5b7('0x3'));var BPromise=require('bluebird');var rp=require(_0xb5b7('0x4'));var fs=require('fs');var path=require(_0xb5b7('0x5'));var rimraf=require(_0xb5b7('0x6'));var config=require(_0xb5b7('0x7'));var attributes=require('./voiceQueueReport.attributes');module['exports']=function(_0x491690,_0x7afcb3){return _0x491690[_0xb5b7('0x8')](_0xb5b7('0x9'),attributes,{'tableName':_0xb5b7('0xa'),'paranoid':![],'indexes':[{'fields':[_0xb5b7('0xb')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 5d39e03..96ce5dd 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 _0x1a70=['map','model','CreateVoiceQueueReport','create','body','update','raw','UpdateVoiceQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','limit','include'];(function(_0x238c37,_0x1f30ac){var _0x17848b=function(_0x2619dd){while(--_0x2619dd){_0x238c37['push'](_0x238c37['shift']());}};_0x17848b(++_0x1f30ac);}(_0x1a70,0x194));var _0x01a7=function(_0x46c974,_0x2908c5){_0x46c974=_0x46c974-0x0;var _0x2b91dc=_0x1a70[_0x46c974];return _0x2b91dc;};'use strict';var _=require('lodash');var util=require(_0x01a7('0x0'));var moment=require(_0x01a7('0x1'));var BPromise=require(_0x01a7('0x2'));var rs=require(_0x01a7('0x3'));var fs=require('fs');var Redis=require(_0x01a7('0x4'));var db=require(_0x01a7('0x5'))['db'];var utils=require(_0x01a7('0x6'));var logger=require(_0x01a7('0x7'))('rpc');var config=require(_0x01a7('0x8'));var jayson=require(_0x01a7('0x9'));var client=jayson[_0x01a7('0xa')][_0x01a7('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x01a7('0xc')],{'host':_0x01a7('0xd'),'port':0x18eb});var socket=require(_0x01a7('0xe'))(new Redis(config[_0x01a7('0xc')]));require('./voiceQueueReport.socket')[_0x01a7('0xf')](socket);function respondWithRpcPromise(_0xc6c326,_0x22fc5c,_0x370ab2){return new BPromise(function(_0x273c02,_0x5d85ee){return client[_0x01a7('0x10')](_0xc6c326,_0x370ab2)[_0x01a7('0x11')](function(_0x352dbd){logger['info'](_0x01a7('0x12'),_0x22fc5c,_0x01a7('0x13'));logger[_0x01a7('0x14')](_0x01a7('0x15'),_0x22fc5c,_0x01a7('0x13'),JSON[_0x01a7('0x16')](_0x352dbd));if(_0x352dbd[_0x01a7('0x17')]){if(_0x352dbd[_0x01a7('0x17')][_0x01a7('0x18')]===0x1f4){logger['error'](_0x01a7('0x12'),_0x22fc5c,_0x352dbd[_0x01a7('0x17')][_0x01a7('0x19')]);return _0x5d85ee(_0x352dbd['error'][_0x01a7('0x19')]);}logger[_0x01a7('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x22fc5c,_0x352dbd['error'][_0x01a7('0x19')]);return _0x273c02(_0x352dbd['error'][_0x01a7('0x19')]);}else{logger[_0x01a7('0x1a')](_0x01a7('0x12'),_0x22fc5c,_0x01a7('0x13'));_0x273c02(_0x352dbd['result'][_0x01a7('0x19')]);}})[_0x01a7('0x1b')](function(_0x158c82){logger[_0x01a7('0x17')](_0x01a7('0x12'),_0x22fc5c,_0x158c82);_0x5d85ee(_0x158c82);});});}exports[_0x01a7('0x1c')]=function(_0x259bdd){var _0xe11204=this;return new Promise(function(_0x5d83c2,_0x506ed3){return db[_0x01a7('0x1d')][_0x01a7('0x1e')]({'raw':_0x259bdd[_0x01a7('0x1f')]?_0x259bdd['options']['raw']===undefined?!![]:![]:!![],'where':_0x259bdd[_0x01a7('0x1f')]?_0x259bdd[_0x01a7('0x1f')][_0x01a7('0x20')]||null:null,'attributes':_0x259bdd['options']?_0x259bdd[_0x01a7('0x1f')][_0x01a7('0x21')]||null:null,'limit':_0x259bdd[_0x01a7('0x1f')]?_0x259bdd[_0x01a7('0x1f')][_0x01a7('0x22')]||null:null,'include':_0x259bdd[_0x01a7('0x1f')]?_0x259bdd['options'][_0x01a7('0x23')]?_[_0x01a7('0x24')](_0x259bdd[_0x01a7('0x1f')]['include'],function(_0x1a7621){return{'model':db[_0x1a7621[_0x01a7('0x25')]],'as':_0x1a7621['as'],'attributes':_0x1a7621[_0x01a7('0x21')],'include':_0x1a7621[_0x01a7('0x23')]?_[_0x01a7('0x24')](_0x1a7621[_0x01a7('0x23')],function(_0x3af10e){return{'model':db[_0x3af10e[_0x01a7('0x25')]],'as':_0x3af10e['as'],'attributes':_0x3af10e['attributes'],'include':_0x3af10e[_0x01a7('0x23')]?_[_0x01a7('0x24')](_0x3af10e[_0x01a7('0x23')],function(_0x49d9a4){return{'model':db[_0x49d9a4[_0x01a7('0x25')]],'as':_0x49d9a4['as'],'attributes':_0x49d9a4[_0x01a7('0x21')]};}):[]};}):[]};}):[]:[]})[_0x01a7('0x11')](function(_0x2a7155){logger[_0x01a7('0x1a')]('GetVoiceQueueReport',_0x259bdd);logger[_0x01a7('0x14')](_0x01a7('0x1c'),_0x259bdd,JSON[_0x01a7('0x16')](_0x2a7155));_0x5d83c2(_0x2a7155);})['catch'](function(_0x379419){logger[_0x01a7('0x17')](_0x01a7('0x1c'),_0x379419[_0x01a7('0x19')],_0x259bdd);_0x506ed3(_0xe11204[_0x01a7('0x17')](0x1f4,_0x379419[_0x01a7('0x19')]));});});};exports[_0x01a7('0x26')]=function(_0x12d709){var _0x3c5681=this;return new Promise(function(_0x1223da,_0x1beca3){return db['VoiceQueueReport'][_0x01a7('0x27')](_0x12d709[_0x01a7('0x28')],{'raw':_0x12d709[_0x01a7('0x1f')]?_0x12d709['options']['raw']===undefined?!![]:![]:!![]})[_0x01a7('0x11')](function(_0x264d3c){logger[_0x01a7('0x1a')](_0x01a7('0x26'),_0x12d709);logger[_0x01a7('0x14')](_0x01a7('0x26'),_0x12d709,JSON[_0x01a7('0x16')](_0x264d3c));_0x1223da(_0x264d3c);})[_0x01a7('0x1b')](function(_0x156749){logger[_0x01a7('0x17')]('CreateVoiceQueueReport',_0x156749[_0x01a7('0x19')],_0x12d709);_0x1beca3(_0x3c5681['error'](0x1f4,_0x156749['message']));});});};exports['UpdateVoiceQueueReport']=function(_0x597e99){var _0x44d8c8=this;return new Promise(function(_0x5cc013,_0x28d85c){return db[_0x01a7('0x1d')][_0x01a7('0x29')](_0x597e99[_0x01a7('0x28')],{'raw':_0x597e99[_0x01a7('0x1f')]?_0x597e99[_0x01a7('0x1f')][_0x01a7('0x2a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x597e99['options']?_0x597e99['options'][_0x01a7('0x20')]||null:null,'attributes':_0x597e99[_0x01a7('0x1f')]?_0x597e99[_0x01a7('0x1f')]['attributes']||null:null,'limit':_0x597e99[_0x01a7('0x1f')]?_0x597e99[_0x01a7('0x1f')]['limit']||null:null})[_0x01a7('0x11')](function(_0x2671c5){logger['info']('UpdateVoiceQueueReport',_0x597e99);logger['debug'](_0x01a7('0x2b'),_0x597e99,JSON[_0x01a7('0x16')](_0x2671c5));_0x5cc013(_0x2671c5);})['catch'](function(_0x22b13a){logger[_0x01a7('0x17')](_0x01a7('0x2b'),_0x22b13a[_0x01a7('0x19')],_0x597e99);_0x28d85c(_0x44d8c8[_0x01a7('0x17')](0x1f4,_0x22b13a[_0x01a7('0x19')]));});});}; \ No newline at end of file +var _0x8fe3=['localhost','socket.io-emitter','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceQueueReport','CreateVoiceQueueReport','VoiceQueueReport','create','body','UpdateVoiceQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults'];(function(_0x5a242a,_0x24de17){var _0x282e3e=function(_0x18fe66){while(--_0x18fe66){_0x5a242a['push'](_0x5a242a['shift']());}};_0x282e3e(++_0x24de17);}(_0x8fe3,0x113));var _0x38fe=function(_0x177630,_0x39b3a2){_0x177630=_0x177630-0x0;var _0xd0fe2d=_0x8fe3[_0x177630];return _0xd0fe2d;};'use strict';var _=require(_0x38fe('0x0'));var util=require('util');var moment=require(_0x38fe('0x1'));var BPromise=require(_0x38fe('0x2'));var rs=require(_0x38fe('0x3'));var fs=require('fs');var Redis=require(_0x38fe('0x4'));var db=require(_0x38fe('0x5'))['db'];var utils=require(_0x38fe('0x6'));var logger=require(_0x38fe('0x7'))('rpc');var config=require(_0x38fe('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x38fe('0x9')]['http']({'port':0x232a});config[_0x38fe('0xa')]=_[_0x38fe('0xb')](config[_0x38fe('0xa')],{'host':_0x38fe('0xc'),'port':0x18eb});var socket=require(_0x38fe('0xd'))(new Redis(config[_0x38fe('0xa')]));require('./voiceQueueReport.socket')[_0x38fe('0xe')](socket);function respondWithRpcPromise(_0x43335b,_0x434e94,_0x471e2a){return new BPromise(function(_0x4f2518,_0x1f4c8e){return client[_0x38fe('0xf')](_0x43335b,_0x471e2a)[_0x38fe('0x10')](function(_0x25c993){logger[_0x38fe('0x11')](_0x38fe('0x12'),_0x434e94,_0x38fe('0x13'));logger[_0x38fe('0x14')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x434e94,'request\x20sent',JSON[_0x38fe('0x15')](_0x25c993));if(_0x25c993[_0x38fe('0x16')]){if(_0x25c993['error'][_0x38fe('0x17')]===0x1f4){logger[_0x38fe('0x16')](_0x38fe('0x12'),_0x434e94,_0x25c993[_0x38fe('0x16')][_0x38fe('0x18')]);return _0x1f4c8e(_0x25c993[_0x38fe('0x16')][_0x38fe('0x18')]);}logger['error'](_0x38fe('0x12'),_0x434e94,_0x25c993[_0x38fe('0x16')][_0x38fe('0x18')]);return _0x4f2518(_0x25c993[_0x38fe('0x16')][_0x38fe('0x18')]);}else{logger[_0x38fe('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x434e94,_0x38fe('0x13'));_0x4f2518(_0x25c993['result'][_0x38fe('0x18')]);}})[_0x38fe('0x19')](function(_0x1a2c5e){logger[_0x38fe('0x16')](_0x38fe('0x12'),_0x434e94,_0x1a2c5e);_0x1f4c8e(_0x1a2c5e);});});}exports['GetVoiceQueueReport']=function(_0x14c079){var _0x5aea8a=this;return new Promise(function(_0x57eaaf,_0x1587c0){return db['VoiceQueueReport'][_0x38fe('0x1a')]({'raw':_0x14c079['options']?_0x14c079[_0x38fe('0x1b')][_0x38fe('0x1c')]===undefined?!![]:![]:!![],'where':_0x14c079['options']?_0x14c079['options'][_0x38fe('0x1d')]||null:null,'attributes':_0x14c079['options']?_0x14c079['options'][_0x38fe('0x1e')]||null:null,'limit':_0x14c079['options']?_0x14c079[_0x38fe('0x1b')][_0x38fe('0x1f')]||null:null,'include':_0x14c079['options']?_0x14c079[_0x38fe('0x1b')][_0x38fe('0x20')]?_[_0x38fe('0x21')](_0x14c079[_0x38fe('0x1b')]['include'],function(_0x4e8a9a){return{'model':db[_0x4e8a9a[_0x38fe('0x22')]],'as':_0x4e8a9a['as'],'attributes':_0x4e8a9a['attributes'],'include':_0x4e8a9a[_0x38fe('0x20')]?_[_0x38fe('0x21')](_0x4e8a9a[_0x38fe('0x20')],function(_0x519722){return{'model':db[_0x519722[_0x38fe('0x22')]],'as':_0x519722['as'],'attributes':_0x519722[_0x38fe('0x1e')],'include':_0x519722['include']?_[_0x38fe('0x21')](_0x519722['include'],function(_0x3e0108){return{'model':db[_0x3e0108[_0x38fe('0x22')]],'as':_0x3e0108['as'],'attributes':_0x3e0108[_0x38fe('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x38fe('0x10')](function(_0x54a9bb){logger[_0x38fe('0x11')]('GetVoiceQueueReport',_0x14c079);logger[_0x38fe('0x14')]('GetVoiceQueueReport',_0x14c079,JSON[_0x38fe('0x15')](_0x54a9bb));_0x57eaaf(_0x54a9bb);})[_0x38fe('0x19')](function(_0x51877f){logger[_0x38fe('0x16')](_0x38fe('0x23'),_0x51877f['message'],_0x14c079);_0x1587c0(_0x5aea8a['error'](0x1f4,_0x51877f[_0x38fe('0x18')]));});});};exports[_0x38fe('0x24')]=function(_0x40460d){var _0x3fe4ac=this;return new Promise(function(_0x2b0aea,_0x35d073){return db[_0x38fe('0x25')][_0x38fe('0x26')](_0x40460d[_0x38fe('0x27')],{'raw':_0x40460d['options']?_0x40460d[_0x38fe('0x1b')][_0x38fe('0x1c')]===undefined?!![]:![]:!![]})[_0x38fe('0x10')](function(_0x251b74){logger['info'](_0x38fe('0x24'),_0x40460d);logger['debug']('CreateVoiceQueueReport',_0x40460d,JSON[_0x38fe('0x15')](_0x251b74));_0x2b0aea(_0x251b74);})['catch'](function(_0x11012a){logger[_0x38fe('0x16')](_0x38fe('0x24'),_0x11012a['message'],_0x40460d);_0x35d073(_0x3fe4ac[_0x38fe('0x16')](0x1f4,_0x11012a['message']));});});};exports[_0x38fe('0x28')]=function(_0x3275ec){var _0x2be5b3=this;return new Promise(function(_0x1d4880,_0x2d4819){return db['VoiceQueueReport']['update'](_0x3275ec[_0x38fe('0x27')],{'raw':_0x3275ec[_0x38fe('0x1b')]?_0x3275ec['options'][_0x38fe('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3275ec['options']?_0x3275ec[_0x38fe('0x1b')][_0x38fe('0x1d')]||null:null,'attributes':_0x3275ec[_0x38fe('0x1b')]?_0x3275ec['options'][_0x38fe('0x1e')]||null:null,'limit':_0x3275ec[_0x38fe('0x1b')]?_0x3275ec['options'][_0x38fe('0x1f')]||null:null})['then'](function(_0xdd9c5f){logger['info']('UpdateVoiceQueueReport',_0x3275ec);logger[_0x38fe('0x14')](_0x38fe('0x28'),_0x3275ec,JSON[_0x38fe('0x15')](_0xdd9c5f));_0x1d4880(_0xdd9c5f);})[_0x38fe('0x19')](function(_0x31f8fb){logger[_0x38fe('0x16')](_0x38fe('0x28'),_0x31f8fb['message'],_0x3275ec);_0x2d4819(_0x2be5b3[_0x38fe('0x16')](0x1f4,_0x31f8fb[_0x38fe('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 24162f5..036f174 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 _0x5144=['register','length','save','remove','update','emit','removeListener'];(function(_0x168fad,_0x58d7ff){var _0x2b312f=function(_0x1f124d){while(--_0x1f124d){_0x168fad['push'](_0x168fad['shift']());}};_0x2b312f(++_0x58d7ff);}(_0x5144,0xe2));var _0x4514=function(_0x4d4c5e,_0x20c6d7){_0x4d4c5e=_0x4d4c5e-0x0;var _0x39d475=_0x5144[_0x4d4c5e];return _0x39d475;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x4514('0x0'),_0x4514('0x1'),_0x4514('0x2')];function createListener(_0x2fc838,_0x288608){return function(_0x56397c){_0x288608[_0x4514('0x3')](_0x2fc838,_0x56397c);};}function removeListener(_0x58803f,_0x4058b9){return function(){VoiceQueueReportEvents[_0x4514('0x4')](_0x58803f,_0x4058b9);};}exports[_0x4514('0x5')]=function(_0x58dcc2){for(var _0xa9e360=0x0,_0xde1113=events[_0x4514('0x6')];_0xa9e360<_0xde1113;_0xa9e360++){var _0x273e20=events[_0xa9e360];var _0x397596=createListener('voiceQueueReport:'+_0x273e20,_0x58dcc2);VoiceQueueReportEvents['on'](_0x273e20,_0x397596);}}; \ No newline at end of file +var _0x2e63=['emit','removeListener','register','length','voiceQueueReport:','save','remove','update'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x2e63,0x14d));var _0x32e6=function(_0x124fbe,_0x5a9dfe){_0x124fbe=_0x124fbe-0x0;var _0x4700d5=_0x2e63[_0x124fbe];return _0x4700d5;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x32e6('0x0'),_0x32e6('0x1'),_0x32e6('0x2')];function createListener(_0x1722f1,_0x13267d){return function(_0x477974){_0x13267d[_0x32e6('0x3')](_0x1722f1,_0x477974);};}function removeListener(_0x48714b,_0x1866ff){return function(){VoiceQueueReportEvents[_0x32e6('0x4')](_0x48714b,_0x1866ff);};}exports[_0x32e6('0x5')]=function(_0x287cc4){for(var _0x14c862=0x0,_0x43d291=events[_0x32e6('0x6')];_0x14c862<_0x43d291;_0x14c862++){var _0x29db44=events[_0x14c862];var _0x358c96=createListener(_0x32e6('0x7')+_0x29db44,_0x287cc4);VoiceQueueReportEvents['on'](_0x29db44,_0x358c96);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 3c14669..788025b 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 _0xb745=['delete','/:id','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','get','show','create','put','update'];(function(_0x49397f,_0x39853a){var _0x2232c3=function(_0x28e477){while(--_0x28e477){_0x49397f['push'](_0x49397f['shift']());}};_0x2232c3(++_0x39853a);}(_0xb745,0xe0));var _0x5b74=function(_0x103ff9,_0x576a4d){_0x103ff9=_0x103ff9-0x0;var _0x40693e=_0xb745[_0x103ff9];return _0x40693e;};'use strict';var multer=require(_0x5b74('0x0'));var util=require(_0x5b74('0x1'));var path=require(_0x5b74('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5b74('0x3')]();var fs_extra=require(_0x5b74('0x4'));var auth=require(_0x5b74('0x5'));var interaction=require(_0x5b74('0x6'));var config=require(_0x5b74('0x7'));var controller=require(_0x5b74('0x8'));router['get']('/',auth[_0x5b74('0x9')](),controller[_0x5b74('0xa')]);router[_0x5b74('0xb')]('/:id',auth[_0x5b74('0x9')](),controller[_0x5b74('0xc')]);router['post']('/',auth[_0x5b74('0x9')](),controller[_0x5b74('0xd')]);router[_0x5b74('0xe')]('/:id',auth[_0x5b74('0x9')](),controller[_0x5b74('0xf')]);router[_0x5b74('0x10')](_0x5b74('0x11'),auth[_0x5b74('0x9')](),controller[_0x5b74('0x12')]);module[_0x5b74('0x13')]=router; \ No newline at end of file +var _0xd239=['create','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','post'];(function(_0x286caa,_0x1db89b){var _0x5daaae=function(_0x3441ee){while(--_0x3441ee){_0x286caa['push'](_0x286caa['shift']());}};_0x5daaae(++_0x1db89b);}(_0xd239,0x92));var _0x9d23=function(_0x46848e,_0xe1b792){_0x46848e=_0x46848e-0x0;var _0x3fcfcb=_0xd239[_0x46848e];return _0x3fcfcb;};'use strict';var multer=require(_0x9d23('0x0'));var util=require(_0x9d23('0x1'));var path=require(_0x9d23('0x2'));var timeout=require(_0x9d23('0x3'));var express=require(_0x9d23('0x4'));var router=express[_0x9d23('0x5')]();var fs_extra=require(_0x9d23('0x6'));var auth=require(_0x9d23('0x7'));var interaction=require(_0x9d23('0x8'));var config=require(_0x9d23('0x9'));var controller=require(_0x9d23('0xa'));router[_0x9d23('0xb')]('/',auth[_0x9d23('0xc')](),controller['index']);router[_0x9d23('0xb')]('/:id',auth[_0x9d23('0xc')](),controller['show']);router[_0x9d23('0xd')]('/',auth[_0x9d23('0xc')](),controller[_0x9d23('0xe')]);router[_0x9d23('0xf')]('/:id',auth[_0x9d23('0xc')](),controller[_0x9d23('0x10')]);router[_0x9d23('0x11')](_0x9d23('0x12'),auth['isAuthenticated'](),controller[_0x9d23('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 6042530..804fabd 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 _0x3c02=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports'];(function(_0x271371,_0x5d8c5d){var _0x3c9e22=function(_0x2068bc){while(--_0x2068bc){_0x271371['push'](_0x271371['shift']());}};_0x3c9e22(++_0x5d8c5d);}(_0x3c02,0x146));var _0x23c0=function(_0xdbc676,_0xe702f9){_0xdbc676=_0xdbc676-0x0;var _0x5ec3cf=_0x3c02[_0xdbc676];return _0x5ec3cf;};'use strict';var Sequelize=require(_0x23c0('0x0'));var moment=require(_0x23c0('0x1'));module[_0x23c0('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x23c0('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x23c0('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x23c0('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x23c0('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x23c0('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x23c0('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x23c0('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x23c0('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x23c0('0x4')],'allowNull':![],'defaultValue':moment()[_0x23c0('0x5')](_0x23c0('0x6'))}}; \ No newline at end of file +var _0x7c1a=['STRING','DATE','format','sequelize','moment','exports'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x7c1a,0x159));var _0xa7c1=function(_0x1913fe,_0x39e6b4){_0x1913fe=_0x1913fe-0x0;var _0x23866d=_0x7c1a[_0x1913fe];return _0x23866d;};'use strict';var Sequelize=require(_0xa7c1('0x0'));var moment=require(_0xa7c1('0x1'));module[_0xa7c1('0x2')]={'time':{'type':Sequelize[_0xa7c1('0x3')]},'callid':{'type':Sequelize[_0xa7c1('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xa7c1('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xa7c1('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xa7c1('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xa7c1('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xa7c1('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xa7c1('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xa7c1('0x4')],'allowNull':![],'defaultValue':moment()[_0xa7c1('0x5')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index e2f77fd..e083c05 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 _0xf5a8=['VIRTUAL','includeAll','include','findAll','rows','params','options','find','create','catch','update','body','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge'];(function(_0x2adf40,_0x446dab){var _0x4f536a=function(_0x47ba0a){while(--_0x47ba0a){_0x2adf40['push'](_0x2adf40['shift']());}};_0x4f536a(++_0x446dab);}(_0xf5a8,0x134));var _0x8f5a=function(_0x1a97cb,_0x3e174c){_0x1a97cb=_0x1a97cb-0x0;var _0x4ab190=_0xf5a8[_0x1a97cb];return _0x4ab190;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8f5a('0x0'));var zipdir=require(_0x8f5a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8f5a('0x2'));var BPromise=require(_0x8f5a('0x3'));var Mustache=require(_0x8f5a('0x4'));var util=require(_0x8f5a('0x5'));var path=require(_0x8f5a('0x6'));var sox=require(_0x8f5a('0x7'));var csv=require(_0x8f5a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8f5a('0x9'));var _=require(_0x8f5a('0xa'));var squel=require('squel');var crypto=require(_0x8f5a('0xb'));var jsforce=require(_0x8f5a('0xc'));var deskjs=require(_0x8f5a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8f5a('0xe'));var Papa=require(_0x8f5a('0xf'));var Redis=require(_0x8f5a('0x10'));var authService=require(_0x8f5a('0x11'));var qs=require(_0x8f5a('0x12'));var as=require(_0x8f5a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8f5a('0x14'));var utils=require(_0x8f5a('0x15'));var config=require(_0x8f5a('0x16'));var licenseUtil=require(_0x8f5a('0x17'));var db=require(_0x8f5a('0x18'))['db'];function respondWithStatusCode(_0x1ef7ca,_0xcd0010){_0xcd0010=_0xcd0010||0xcc;return function(_0x598445){if(_0x598445){return _0x1ef7ca[_0x8f5a('0x19')](_0xcd0010);}return _0x1ef7ca[_0x8f5a('0x1a')](_0xcd0010)[_0x8f5a('0x1b')]();};}function respondWithResult(_0x1005a9,_0x2d0615){_0x2d0615=_0x2d0615||0xc8;return function(_0x1053e0){if(_0x1053e0){return _0x1005a9[_0x8f5a('0x1a')](_0x2d0615)[_0x8f5a('0x1c')](_0x1053e0);}};}function respondWithFilteredResult(_0x11b621,_0x32670b){return function(_0x4e91ee){if(_0x4e91ee){var _0x4a19f0=typeof _0x32670b[_0x8f5a('0x1d')]===_0x8f5a('0x1e')&&typeof _0x32670b['limit']===_0x8f5a('0x1e');var _0x59804d=_0x4e91ee['count'];var _0xec25=_0x4a19f0?0x0:_0x32670b[_0x8f5a('0x1d')];var _0x103c34=_0x4a19f0?_0x4e91ee[_0x8f5a('0x1f')]:_0x32670b[_0x8f5a('0x1d')]+_0x32670b[_0x8f5a('0x20')];var _0x328614;if(_0x103c34>=_0x59804d){_0x103c34=_0x59804d;_0x328614=0xc8;}else{_0x328614=0xce;}_0x11b621[_0x8f5a('0x1a')](_0x328614);return _0x11b621[_0x8f5a('0x21')](_0x8f5a('0x22'),_0xec25+'-'+_0x103c34+'/'+_0x59804d)[_0x8f5a('0x1c')](_0x4e91ee);}return null;};}function patchUpdates(_0x3ad0ac){return function(_0x4c2dce){try{jsonpatch[_0x8f5a('0x23')](_0x4c2dce,_0x3ad0ac,!![]);}catch(_0x16410b){return BPromise[_0x8f5a('0x24')](_0x16410b);}return _0x4c2dce['save']();};}function saveUpdates(_0xfdef04,_0x5ae809){return function(_0x39b2e0){if(_0x39b2e0){return _0x39b2e0['update'](_0xfdef04)[_0x8f5a('0x25')](function(_0x2d678b){return _0x2d678b;});}return null;};}function removeEntity(_0x2da483,_0x46d242){return function(_0x5d4418){if(_0x5d4418){return _0x5d4418[_0x8f5a('0x26')]()['then'](function(){_0x2da483[_0x8f5a('0x1a')](0xcc)[_0x8f5a('0x1b')]();});}};}function handleEntityNotFound(_0x47e38d,_0x4be082){return function(_0x14db9e){if(!_0x14db9e){_0x47e38d[_0x8f5a('0x19')](0x194);}return _0x14db9e;};}function handleError(_0x24db94,_0x7e38f9){_0x7e38f9=_0x7e38f9||0x1f4;return function(_0x11901){logger[_0x8f5a('0x27')](_0x11901[_0x8f5a('0x28')]);if(_0x11901[_0x8f5a('0x29')]){delete _0x11901[_0x8f5a('0x29')];}_0x24db94[_0x8f5a('0x1a')](_0x7e38f9)['send'](_0x11901);};}exports[_0x8f5a('0x2a')]=function(_0x958bd5,_0x2d192c){var _0x4623fe={},_0x1f3d30={},_0xd43d83={'count':0x0,'rows':[]};var _0x126d6f=_[_0x8f5a('0x2b')](db[_0x8f5a('0x2c')][_0x8f5a('0x2d')],function(_0x3c076f){return{'name':_0x3c076f[_0x8f5a('0x2e')],'type':_0x3c076f[_0x8f5a('0x2f')]['key']};});_0x1f3d30[_0x8f5a('0x30')]=_[_0x8f5a('0x2b')](_0x126d6f,'name');_0x1f3d30[_0x8f5a('0x31')]=_[_0x8f5a('0x32')](_0x958bd5[_0x8f5a('0x31')]);_0x1f3d30[_0x8f5a('0x33')]=_['intersection'](_0x1f3d30[_0x8f5a('0x30')],_0x1f3d30[_0x8f5a('0x31')]);_0x4623fe[_0x8f5a('0x34')]=_[_0x8f5a('0x35')](_0x1f3d30[_0x8f5a('0x30')],qs[_0x8f5a('0x36')](_0x958bd5[_0x8f5a('0x31')][_0x8f5a('0x36')]));_0x4623fe[_0x8f5a('0x34')]=_0x4623fe[_0x8f5a('0x34')]['length']?_0x4623fe['attributes']:_0x1f3d30[_0x8f5a('0x30')];if(!_0x958bd5[_0x8f5a('0x31')][_0x8f5a('0x37')](_0x8f5a('0x38'))){_0x4623fe[_0x8f5a('0x20')]=qs['limit'](_0x958bd5[_0x8f5a('0x31')][_0x8f5a('0x20')]);_0x4623fe[_0x8f5a('0x1d')]=qs[_0x8f5a('0x1d')](_0x958bd5[_0x8f5a('0x31')][_0x8f5a('0x1d')]);}_0x4623fe['order']=qs[_0x8f5a('0x39')](_0x958bd5['query'][_0x8f5a('0x39')]);_0x4623fe[_0x8f5a('0x3a')]=qs[_0x8f5a('0x33')](_[_0x8f5a('0x3b')](_0x958bd5['query'],_0x1f3d30[_0x8f5a('0x33')]),_0x126d6f);if(_0x958bd5['query'][_0x8f5a('0x3c')]){_0x4623fe[_0x8f5a('0x3a')]=_[_0x8f5a('0x3d')](_0x4623fe['where'],{'$or':_[_0x8f5a('0x2b')](_0x126d6f,function(_0x1be421){if(_0x1be421[_0x8f5a('0x2f')]!==_0x8f5a('0x3e')){var _0xc8875a={};_0xc8875a[_0x1be421[_0x8f5a('0x29')]]={'$like':'%'+_0x958bd5[_0x8f5a('0x31')][_0x8f5a('0x3c')]+'%'};return _0xc8875a;}})});}_0x4623fe=_[_0x8f5a('0x3d')]({},_0x4623fe,_0x958bd5['options']);var _0x169406={'where':_0x4623fe[_0x8f5a('0x3a')]};return db[_0x8f5a('0x2c')][_0x8f5a('0x1f')](_0x169406)['then'](function(_0x5d690f){_0xd43d83[_0x8f5a('0x1f')]=_0x5d690f;if(_0x958bd5[_0x8f5a('0x31')][_0x8f5a('0x3f')]){_0x4623fe[_0x8f5a('0x40')]=[{'all':!![]}];}return db[_0x8f5a('0x2c')][_0x8f5a('0x41')](_0x4623fe);})['then'](function(_0x552c71){_0xd43d83[_0x8f5a('0x42')]=_0x552c71;return _0xd43d83;})[_0x8f5a('0x25')](respondWithFilteredResult(_0x2d192c,_0x4623fe))['catch'](handleError(_0x2d192c,null));};exports['show']=function(_0x1f9795,_0x10d4f3){var _0x225f94={'raw':!![],'where':{'id':_0x1f9795[_0x8f5a('0x43')]['id']}},_0x1bea50={};_0x1bea50[_0x8f5a('0x30')]=_[_0x8f5a('0x32')](db[_0x8f5a('0x2c')][_0x8f5a('0x2d')]);_0x1bea50[_0x8f5a('0x31')]=_[_0x8f5a('0x32')](_0x1f9795[_0x8f5a('0x31')]);_0x1bea50[_0x8f5a('0x33')]=_[_0x8f5a('0x35')](_0x1bea50['model'],_0x1bea50['query']);_0x225f94['attributes']=_[_0x8f5a('0x35')](_0x1bea50['model'],qs[_0x8f5a('0x36')](_0x1f9795['query'][_0x8f5a('0x36')]));_0x225f94['attributes']=_0x225f94[_0x8f5a('0x34')]['length']?_0x225f94[_0x8f5a('0x34')]:_0x1bea50[_0x8f5a('0x30')];if(_0x1f9795['query'][_0x8f5a('0x3f')]){_0x225f94[_0x8f5a('0x40')]=[{'all':!![]}];}_0x225f94=_[_0x8f5a('0x3d')]({},_0x225f94,_0x1f9795[_0x8f5a('0x44')]);return db[_0x8f5a('0x2c')][_0x8f5a('0x45')](_0x225f94)[_0x8f5a('0x25')](handleEntityNotFound(_0x10d4f3,null))['then'](respondWithResult(_0x10d4f3,null))['catch'](handleError(_0x10d4f3,null));};exports[_0x8f5a('0x46')]=function(_0x2c0eaa,_0x527c1a){return db[_0x8f5a('0x2c')][_0x8f5a('0x46')](_0x2c0eaa['body'],{})['then'](respondWithResult(_0x527c1a,0xc9))[_0x8f5a('0x47')](handleError(_0x527c1a,null));};exports[_0x8f5a('0x48')]=function(_0x1327be,_0x298d39){if(_0x1327be[_0x8f5a('0x49')]['id']){delete _0x1327be[_0x8f5a('0x49')]['id'];}return db[_0x8f5a('0x2c')]['find']({'where':{'id':_0x1327be[_0x8f5a('0x43')]['id']}})[_0x8f5a('0x25')](handleEntityNotFound(_0x298d39,null))[_0x8f5a('0x25')](saveUpdates(_0x1327be['body'],null))[_0x8f5a('0x25')](respondWithResult(_0x298d39,null))['catch'](handleError(_0x298d39,null));};exports[_0x8f5a('0x26')]=function(_0x10c69b,_0x2e2505){return db[_0x8f5a('0x2c')][_0x8f5a('0x45')]({'where':{'id':_0x10c69b['params']['id']}})[_0x8f5a('0x25')](handleEntityNotFound(_0x2e2505,null))['then'](removeEntity(_0x2e2505,null))['catch'](handleError(_0x2e2505,null));}; \ No newline at end of file +var _0x0b96=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','offset','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','key','model','query','keys','filters','intersection'];(function(_0x2af47e,_0x1d2a86){var _0x5bca26=function(_0x4ba3db){while(--_0x4ba3db){_0x2af47e['push'](_0x2af47e['shift']());}};_0x5bca26(++_0x1d2a86);}(_0x0b96,0x64));var _0x60b9=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x0b96[_0x2261ce];return _0x524640;};'use strict';var emlformat=require(_0x60b9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x60b9('0x1'));var jsonpatch=require(_0x60b9('0x2'));var rp=require(_0x60b9('0x3'));var moment=require(_0x60b9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x60b9('0x5'));var util=require(_0x60b9('0x6'));var path=require(_0x60b9('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x60b9('0x8'));var _=require(_0x60b9('0x9'));var squel=require(_0x60b9('0xa'));var crypto=require('crypto');var jsforce=require(_0x60b9('0xb'));var deskjs=require(_0x60b9('0xc'));var toCsv=require(_0x60b9('0xd'));var querystring=require('querystring');var Papa=require(_0x60b9('0xe'));var Redis=require(_0x60b9('0xf'));var authService=require(_0x60b9('0x10'));var qs=require(_0x60b9('0x11'));var as=require(_0x60b9('0x12'));var hardwareService=require(_0x60b9('0x13'));var logger=require(_0x60b9('0x14'))('api');var utils=require(_0x60b9('0x15'));var config=require(_0x60b9('0x16'));var licenseUtil=require(_0x60b9('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51f55e,_0x3102a5){_0x3102a5=_0x3102a5||0xcc;return function(_0x1b22eb){if(_0x1b22eb){return _0x51f55e['sendStatus'](_0x3102a5);}return _0x51f55e[_0x60b9('0x18')](_0x3102a5)['end']();};}function respondWithResult(_0x4c43e4,_0x2cb0b4){_0x2cb0b4=_0x2cb0b4||0xc8;return function(_0x21a6f3){if(_0x21a6f3){return _0x4c43e4[_0x60b9('0x18')](_0x2cb0b4)['json'](_0x21a6f3);}};}function respondWithFilteredResult(_0x260ee2,_0x30cfbe){return function(_0x3857c8){if(_0x3857c8){var _0x8895e=typeof _0x30cfbe[_0x60b9('0x19')]==='undefined'&&typeof _0x30cfbe[_0x60b9('0x1a')]==='undefined';var _0x2a5066=_0x3857c8[_0x60b9('0x1b')];var _0x572c33=_0x8895e?0x0:_0x30cfbe['offset'];var _0x4a2bef=_0x8895e?_0x3857c8[_0x60b9('0x1b')]:_0x30cfbe[_0x60b9('0x19')]+_0x30cfbe[_0x60b9('0x1a')];var _0x410b9b;if(_0x4a2bef>=_0x2a5066){_0x4a2bef=_0x2a5066;_0x410b9b=0xc8;}else{_0x410b9b=0xce;}_0x260ee2[_0x60b9('0x18')](_0x410b9b);return _0x260ee2[_0x60b9('0x1c')](_0x60b9('0x1d'),_0x572c33+'-'+_0x4a2bef+'/'+_0x2a5066)[_0x60b9('0x1e')](_0x3857c8);}return null;};}function patchUpdates(_0x4ca0f6){return function(_0x5d74be){try{jsonpatch[_0x60b9('0x1f')](_0x5d74be,_0x4ca0f6,!![]);}catch(_0x524d84){return BPromise[_0x60b9('0x20')](_0x524d84);}return _0x5d74be[_0x60b9('0x21')]();};}function saveUpdates(_0x131fe4,_0x580bc1){return function(_0x1f2bda){if(_0x1f2bda){return _0x1f2bda[_0x60b9('0x22')](_0x131fe4)['then'](function(_0x2103b8){return _0x2103b8;});}return null;};}function removeEntity(_0x5ddcb8,_0xfe46ee){return function(_0x4846da){if(_0x4846da){return _0x4846da[_0x60b9('0x23')]()[_0x60b9('0x24')](function(){_0x5ddcb8[_0x60b9('0x18')](0xcc)[_0x60b9('0x25')]();});}};}function handleEntityNotFound(_0x2ae1e6,_0x4c1aed){return function(_0x29d0e1){if(!_0x29d0e1){_0x2ae1e6[_0x60b9('0x26')](0x194);}return _0x29d0e1;};}function handleError(_0x407e7f,_0x3c2c70){_0x3c2c70=_0x3c2c70||0x1f4;return function(_0x592e91){logger[_0x60b9('0x27')](_0x592e91[_0x60b9('0x28')]);if(_0x592e91[_0x60b9('0x29')]){delete _0x592e91[_0x60b9('0x29')];}_0x407e7f[_0x60b9('0x18')](_0x3c2c70)[_0x60b9('0x2a')](_0x592e91);};}exports[_0x60b9('0x2b')]=function(_0x41d3a5,_0x3080b3){var _0x4270a1={},_0x5caee2={},_0x35e3ce={'count':0x0,'rows':[]};var _0xa0d8c6=_[_0x60b9('0x2c')](db[_0x60b9('0x2d')][_0x60b9('0x2e')],function(_0x4bb7aa){return{'name':_0x4bb7aa[_0x60b9('0x2f')],'type':_0x4bb7aa['type'][_0x60b9('0x30')]};});_0x5caee2[_0x60b9('0x31')]=_[_0x60b9('0x2c')](_0xa0d8c6,'name');_0x5caee2[_0x60b9('0x32')]=_[_0x60b9('0x33')](_0x41d3a5[_0x60b9('0x32')]);_0x5caee2[_0x60b9('0x34')]=_[_0x60b9('0x35')](_0x5caee2[_0x60b9('0x31')],_0x5caee2[_0x60b9('0x32')]);_0x4270a1['attributes']=_[_0x60b9('0x35')](_0x5caee2['model'],qs[_0x60b9('0x36')](_0x41d3a5['query'][_0x60b9('0x36')]));_0x4270a1[_0x60b9('0x37')]=_0x4270a1[_0x60b9('0x37')][_0x60b9('0x38')]?_0x4270a1[_0x60b9('0x37')]:_0x5caee2[_0x60b9('0x31')];if(!_0x41d3a5[_0x60b9('0x32')][_0x60b9('0x39')](_0x60b9('0x3a'))){_0x4270a1[_0x60b9('0x1a')]=qs['limit'](_0x41d3a5[_0x60b9('0x32')][_0x60b9('0x1a')]);_0x4270a1[_0x60b9('0x19')]=qs[_0x60b9('0x19')](_0x41d3a5['query']['offset']);}_0x4270a1[_0x60b9('0x3b')]=qs[_0x60b9('0x3c')](_0x41d3a5['query']['sort']);_0x4270a1[_0x60b9('0x3d')]=qs[_0x60b9('0x34')](_[_0x60b9('0x3e')](_0x41d3a5[_0x60b9('0x32')],_0x5caee2[_0x60b9('0x34')]),_0xa0d8c6);if(_0x41d3a5[_0x60b9('0x32')]['filter']){_0x4270a1[_0x60b9('0x3d')]=_[_0x60b9('0x3f')](_0x4270a1['where'],{'$or':_[_0x60b9('0x2c')](_0xa0d8c6,function(_0x53887c){if(_0x53887c[_0x60b9('0x40')]!=='VIRTUAL'){var _0x2a423f={};_0x2a423f[_0x53887c[_0x60b9('0x29')]]={'$like':'%'+_0x41d3a5[_0x60b9('0x32')][_0x60b9('0x41')]+'%'};return _0x2a423f;}})});}_0x4270a1=_[_0x60b9('0x3f')]({},_0x4270a1,_0x41d3a5[_0x60b9('0x42')]);var _0x76f269={'where':_0x4270a1[_0x60b9('0x3d')]};return db[_0x60b9('0x2d')][_0x60b9('0x1b')](_0x76f269)[_0x60b9('0x24')](function(_0x33c043){_0x35e3ce[_0x60b9('0x1b')]=_0x33c043;if(_0x41d3a5[_0x60b9('0x32')][_0x60b9('0x43')]){_0x4270a1[_0x60b9('0x44')]=[{'all':!![]}];}return db[_0x60b9('0x2d')][_0x60b9('0x45')](_0x4270a1);})[_0x60b9('0x24')](function(_0x1130a9){_0x35e3ce[_0x60b9('0x46')]=_0x1130a9;return _0x35e3ce;})[_0x60b9('0x24')](respondWithFilteredResult(_0x3080b3,_0x4270a1))[_0x60b9('0x47')](handleError(_0x3080b3,null));};exports[_0x60b9('0x48')]=function(_0x306f79,_0x4df314){var _0x59d97c={'raw':!![],'where':{'id':_0x306f79[_0x60b9('0x49')]['id']}},_0x5f5bf0={};_0x5f5bf0['model']=_[_0x60b9('0x33')](db['VoiceQueuesLog']['rawAttributes']);_0x5f5bf0[_0x60b9('0x32')]=_[_0x60b9('0x33')](_0x306f79['query']);_0x5f5bf0[_0x60b9('0x34')]=_[_0x60b9('0x35')](_0x5f5bf0['model'],_0x5f5bf0[_0x60b9('0x32')]);_0x59d97c[_0x60b9('0x37')]=_['intersection'](_0x5f5bf0[_0x60b9('0x31')],qs['fields'](_0x306f79['query'][_0x60b9('0x36')]));_0x59d97c['attributes']=_0x59d97c[_0x60b9('0x37')][_0x60b9('0x38')]?_0x59d97c[_0x60b9('0x37')]:_0x5f5bf0[_0x60b9('0x31')];if(_0x306f79[_0x60b9('0x32')][_0x60b9('0x43')]){_0x59d97c[_0x60b9('0x44')]=[{'all':!![]}];}_0x59d97c=_[_0x60b9('0x3f')]({},_0x59d97c,_0x306f79[_0x60b9('0x42')]);return db[_0x60b9('0x2d')][_0x60b9('0x4a')](_0x59d97c)[_0x60b9('0x24')](handleEntityNotFound(_0x4df314,null))[_0x60b9('0x24')](respondWithResult(_0x4df314,null))[_0x60b9('0x47')](handleError(_0x4df314,null));};exports[_0x60b9('0x4b')]=function(_0x151f42,_0x342d4f){return db[_0x60b9('0x2d')][_0x60b9('0x4b')](_0x151f42['body'],{})[_0x60b9('0x24')](respondWithResult(_0x342d4f,0xc9))[_0x60b9('0x47')](handleError(_0x342d4f,null));};exports[_0x60b9('0x22')]=function(_0x7472e5,_0x450207){if(_0x7472e5[_0x60b9('0x4c')]['id']){delete _0x7472e5[_0x60b9('0x4c')]['id'];}return db[_0x60b9('0x2d')][_0x60b9('0x4a')]({'where':{'id':_0x7472e5['params']['id']}})['then'](handleEntityNotFound(_0x450207,null))[_0x60b9('0x24')](saveUpdates(_0x7472e5[_0x60b9('0x4c')],null))['then'](respondWithResult(_0x450207,null))[_0x60b9('0x47')](handleError(_0x450207,null));};exports[_0x60b9('0x23')]=function(_0x5b79c7,_0x2fb5b4){return db[_0x60b9('0x2d')][_0x60b9('0x4a')]({'where':{'id':_0x5b79c7[_0x60b9('0x49')]['id']}})['then'](handleEntityNotFound(_0x2fb5b4,null))[_0x60b9('0x24')](removeEntity(_0x2fb5b4,null))[_0x60b9('0x47')](handleError(_0x2fb5b4,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 310f69c..d2dd34c 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 _0xe5f7=['../../config/logger','api','request-promise','path','rimraf','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','lodash','util'];(function(_0x274319,_0x3fc0e0){var _0x435969=function(_0x202344){while(--_0x202344){_0x274319['push'](_0x274319['shift']());}};_0x435969(++_0x3fc0e0);}(_0xe5f7,0x178));var _0x7e5f=function(_0x51ef3d,_0x1bf411){_0x51ef3d=_0x51ef3d-0x0;var _0x5d0084=_0xe5f7[_0x51ef3d];return _0x5d0084;};'use strict';var _=require(_0x7e5f('0x0'));var util=require(_0x7e5f('0x1'));var logger=require(_0x7e5f('0x2'))(_0x7e5f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7e5f('0x4'));var fs=require('fs');var path=require(_0x7e5f('0x5'));var rimraf=require(_0x7e5f('0x6'));var config=require('../../config/environment');var attributes=require(_0x7e5f('0x7'));module[_0x7e5f('0x8')]=function(_0x5ba513,_0x1a6abb){return _0x5ba513[_0x7e5f('0x9')](_0x7e5f('0xa'),attributes,{'tableName':_0x7e5f('0xb'),'paranoid':![],'indexes':[{'name':_0x7e5f('0xc'),'fields':[_0x7e5f('0xd'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0xed20=['bluebird','rimraf','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','api','moment'];(function(_0x3ceb54,_0x5bddfd){var _0x26d8a6=function(_0x32e484){while(--_0x32e484){_0x3ceb54['push'](_0x3ceb54['shift']());}};_0x26d8a6(++_0x5bddfd);}(_0xed20,0x1b9));var _0x0ed2=function(_0x2c24f5,_0x162c50){_0x2c24f5=_0x2c24f5-0x0;var _0x5c513a=_0xed20[_0x2c24f5];return _0x5c513a;};'use strict';var _=require(_0x0ed2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0ed2('0x1'));var moment=require(_0x0ed2('0x2'));var BPromise=require(_0x0ed2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0ed2('0x4'));var config=require('../../config/environment');var attributes=require('./voiceQueuesLog.attributes');module[_0x0ed2('0x5')]=function(_0x21f74a,_0x5ee21e){return _0x21f74a[_0x0ed2('0x6')](_0x0ed2('0x7'),attributes,{'tableName':_0x0ed2('0x8'),'paranoid':![],'indexes':[{'name':_0x0ed2('0x9'),'fields':[_0x0ed2('0xa'),_0x0ed2('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index fbd538e..115185e 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 _0x5c7c=['code','VoiceQueuesLog,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','error'];(function(_0x5d325c,_0x38ef8c){var _0x29c9ea=function(_0x322a5d){while(--_0x322a5d){_0x5d325c['push'](_0x5d325c['shift']());}};_0x29c9ea(++_0x38ef8c);}(_0x5c7c,0xe2));var _0xc5c7=function(_0x5ab3b4,_0x5ede5d){_0x5ab3b4=_0x5ab3b4-0x0;var _0x1a7c0c=_0x5c7c[_0x5ab3b4];return _0x1a7c0c;};'use strict';var _=require(_0xc5c7('0x0'));var util=require('util');var moment=require(_0xc5c7('0x1'));var BPromise=require(_0xc5c7('0x2'));var rs=require(_0xc5c7('0x3'));var fs=require('fs');var Redis=require(_0xc5c7('0x4'));var db=require(_0xc5c7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc5c7('0x6'))(_0xc5c7('0x7'));var config=require(_0xc5c7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc5c7('0x9')][_0xc5c7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d70c1,_0x18ba87,_0x1c0e31){return new BPromise(function(_0x1ab3f7,_0xb722db){return client[_0xc5c7('0xb')](_0x3d70c1,_0x1c0e31)[_0xc5c7('0xc')](function(_0x335360){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x18ba87,_0xc5c7('0xd'));logger[_0xc5c7('0xe')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x18ba87,'request\x20sent',JSON['stringify'](_0x335360));if(_0x335360[_0xc5c7('0xf')]){if(_0x335360[_0xc5c7('0xf')][_0xc5c7('0x10')]===0x1f4){logger[_0xc5c7('0xf')](_0xc5c7('0x11'),_0x18ba87,_0x335360[_0xc5c7('0xf')][_0xc5c7('0x12')]);return _0xb722db(_0x335360[_0xc5c7('0xf')]['message']);}logger[_0xc5c7('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x18ba87,_0x335360[_0xc5c7('0xf')][_0xc5c7('0x12')]);return _0x1ab3f7(_0x335360[_0xc5c7('0xf')][_0xc5c7('0x12')]);}else{logger[_0xc5c7('0x13')](_0xc5c7('0x11'),_0x18ba87,_0xc5c7('0xd'));_0x1ab3f7(_0x335360[_0xc5c7('0x14')]['message']);}})[_0xc5c7('0x15')](function(_0x16826b){logger[_0xc5c7('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x18ba87,_0x16826b);_0xb722db(_0x16826b);});});} \ No newline at end of file +var _0xca07=['stringify','error','code','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xca07,0xb1));var _0x7ca0=function(_0x40b7fc,_0x51c685){_0x40b7fc=_0x40b7fc-0x0;var _0xe7387a=_0xca07[_0x40b7fc];return _0xe7387a;};'use strict';var _=require('lodash');var util=require(_0x7ca0('0x0'));var moment=require('moment');var BPromise=require(_0x7ca0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ca0('0x2'));var db=require(_0x7ca0('0x3'))['db'];var utils=require(_0x7ca0('0x4'));var logger=require('../../config/logger')(_0x7ca0('0x5'));var config=require(_0x7ca0('0x6'));var jayson=require(_0x7ca0('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x51a2ba,_0x3c29ad,_0x3934cd){return new BPromise(function(_0x530ce7,_0x2e7f4b){return client['request'](_0x51a2ba,_0x3934cd)[_0x7ca0('0x8')](function(_0x5d7f49){logger['info'](_0x7ca0('0x9'),_0x3c29ad,'request\x20sent');logger[_0x7ca0('0xa')](_0x7ca0('0xb'),_0x3c29ad,_0x7ca0('0xc'),JSON[_0x7ca0('0xd')](_0x5d7f49));if(_0x5d7f49[_0x7ca0('0xe')]){if(_0x5d7f49['error'][_0x7ca0('0xf')]===0x1f4){logger[_0x7ca0('0xe')](_0x7ca0('0x9'),_0x3c29ad,_0x5d7f49[_0x7ca0('0xe')][_0x7ca0('0x10')]);return _0x2e7f4b(_0x5d7f49['error'][_0x7ca0('0x10')]);}logger[_0x7ca0('0xe')](_0x7ca0('0x9'),_0x3c29ad,_0x5d7f49[_0x7ca0('0xe')][_0x7ca0('0x10')]);return _0x530ce7(_0x5d7f49[_0x7ca0('0xe')][_0x7ca0('0x10')]);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x3c29ad,'request\x20sent');_0x530ce7(_0x5d7f49[_0x7ca0('0x11')][_0x7ca0('0x10')]);}})[_0x7ca0('0x12')](function(_0x1cbd1d){logger[_0x7ca0('0xe')](_0x7ca0('0x9'),_0x3c29ad,_0x1cbd1d);_0x2e7f4b(_0x1cbd1d);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 122b055..6636d04 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 _0x30d4=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceRecording.controller','index','get','/describe','isAuthenticated','/:id','/:id/download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','update','delete','destroy','exports','multer','path'];(function(_0x1423db,_0x175e32){var _0x3e4c85=function(_0x4e62fe){while(--_0x4e62fe){_0x1423db['push'](_0x1423db['shift']());}};_0x3e4c85(++_0x175e32);}(_0x30d4,0x143));var _0x430d=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x30d4[_0x9cd4c3];return _0x4c9025;};'use strict';var multer=require(_0x430d('0x0'));var util=require('util');var path=require(_0x430d('0x1'));var timeout=require(_0x430d('0x2'));var express=require(_0x430d('0x3'));var router=express['Router']();var fs_extra=require(_0x430d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x430d('0x5'));var config=require(_0x430d('0x6'));var controller=require(_0x430d('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x430d('0x8')]);router[_0x430d('0x9')](_0x430d('0xa'),auth[_0x430d('0xb')](),controller['describe']);router[_0x430d('0x9')](_0x430d('0xc'),auth[_0x430d('0xb')](),controller['show']);router[_0x430d('0x9')](_0x430d('0xd'),auth[_0x430d('0xb')](),controller['download']);router[_0x430d('0x9')](_0x430d('0xe'),controller[_0x430d('0xf')]);router[_0x430d('0x9')](_0x430d('0x10'),auth[_0x430d('0xb')](),controller[_0x430d('0x11')]);router['post']('/',auth[_0x430d('0xb')](),controller['create']);router[_0x430d('0x12')](_0x430d('0x10'),auth[_0x430d('0xb')](),controller[_0x430d('0x13')]);router[_0x430d('0x14')](_0x430d('0xc'),auth['isAuthenticated'](),controller[_0x430d('0x15')]);router[_0x430d('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x430d('0x17')]);module[_0x430d('0x18')]=router; \ No newline at end of file +var _0xf640=['describe','/:id','show','/:id/downloads','downloads','downloadTranscribe','create','post','runTranscribe','put','update','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf640,0xd5));var _0x0f64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf640[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x0f64('0x0'));var path=require(_0x0f64('0x1'));var timeout=require(_0x0f64('0x2'));var express=require('express');var router=express[_0x0f64('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0f64('0x4'));var interaction=require(_0x0f64('0x5'));var config=require(_0x0f64('0x6'));var controller=require(_0x0f64('0x7'));router[_0x0f64('0x8')]('/',auth[_0x0f64('0x9')](),controller[_0x0f64('0xa')]);router['get'](_0x0f64('0xb'),auth[_0x0f64('0x9')](),controller[_0x0f64('0xc')]);router['get'](_0x0f64('0xd'),auth[_0x0f64('0x9')](),controller[_0x0f64('0xe')]);router[_0x0f64('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x0f64('0x8')](_0x0f64('0xf'),controller[_0x0f64('0x10')]);router['get']('/:id/transcribe',auth['isAuthenticated'](),controller[_0x0f64('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0f64('0x12')]);router[_0x0f64('0x13')]('/:id/transcribe',auth[_0x0f64('0x9')](),controller[_0x0f64('0x14')]);router[_0x0f64('0x15')](_0x0f64('0xd'),auth[_0x0f64('0x9')](),controller[_0x0f64('0x16')]);router[_0x0f64('0x17')](_0x0f64('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x0f64('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index d31ece0..8f429bf 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(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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 905326e..a909a2a 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 _0xf18a=['writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','model','differenceBy','format','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','VIRTUAL','options','includeAll','catch','show','params','include','merge','find','create','body','describe','download','../../components/encryptor','uniqueid','value','existsSync','decryptFile','secrets','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','downloads','sequelize','col','token','$and','push','%s.cypher','recording','ValidationError','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribe','transcribeAccountId','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes'];(function(_0x181080,_0x544018){var _0x3ae061=function(_0x20f568){while(--_0x20f568){_0x181080['push'](_0x181080['shift']());}};_0x3ae061(++_0x544018);}(_0xf18a,0xa1));var _0xaf18=function(_0x1e5cde,_0x262b61){_0x1e5cde=_0x1e5cde-0x0;var _0x5178e3=_0xf18a[_0x1e5cde];return _0x5178e3;};'use strict';var emlformat=require(_0xaf18('0x0'));var rimraf=require(_0xaf18('0x1'));var zipdir=require(_0xaf18('0x2'));var jsonpatch=require(_0xaf18('0x3'));var rp=require(_0xaf18('0x4'));var moment=require(_0xaf18('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaf18('0x6'));var path=require(_0xaf18('0x7'));var sox=require(_0xaf18('0x8'));var csv=require(_0xaf18('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaf18('0xa'));var _=require(_0xaf18('0xb'));var squel=require(_0xaf18('0xc'));var crypto=require(_0xaf18('0xd'));var jsforce=require(_0xaf18('0xe'));var deskjs=require(_0xaf18('0xf'));var toCsv=require(_0xaf18('0x9'));var querystring=require(_0xaf18('0x10'));var Papa=require('papaparse');var AWS=require(_0xaf18('0x11'));var uuidv4=require(_0xaf18('0x12'));var Redis=require(_0xaf18('0x13'));var authService=require(_0xaf18('0x14'));var qs=require(_0xaf18('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf18('0x16'))(_0xaf18('0x17'));var utils=require(_0xaf18('0x18'));var config=require(_0xaf18('0x19'));var licenseUtil=require(_0xaf18('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20c044,_0x2633b0){_0x2633b0=_0x2633b0||0xcc;return function(_0x15b6ac){if(_0x15b6ac){return _0x20c044['sendStatus'](_0x2633b0);}return _0x20c044[_0xaf18('0x1b')](_0x2633b0)['end']();};}function respondWithResult(_0x378aa9,_0x57adbb){_0x57adbb=_0x57adbb||0xc8;return function(_0x35f484){if(_0x35f484){return _0x378aa9[_0xaf18('0x1b')](_0x57adbb)[_0xaf18('0x1c')](_0x35f484);}};}function respondWithFilteredResult(_0x18f21f,_0x37d5d1){return function(_0x9edf2b){if(_0x9edf2b){var _0x5ab883=typeof _0x37d5d1[_0xaf18('0x1d')]===_0xaf18('0x1e')&&typeof _0x37d5d1['limit']==='undefined';var _0x4d676a=_0x9edf2b[_0xaf18('0x1f')];var _0x85247=_0x5ab883?0x0:_0x37d5d1[_0xaf18('0x1d')];var _0x2715dc=_0x5ab883?_0x9edf2b[_0xaf18('0x1f')]:_0x37d5d1[_0xaf18('0x1d')]+_0x37d5d1[_0xaf18('0x20')];var _0x130f03;if(_0x2715dc>=_0x4d676a){_0x2715dc=_0x4d676a;_0x130f03=0xc8;}else{_0x130f03=0xce;}_0x18f21f[_0xaf18('0x1b')](_0x130f03);return _0x18f21f[_0xaf18('0x21')](_0xaf18('0x22'),_0x85247+'-'+_0x2715dc+'/'+_0x4d676a)[_0xaf18('0x1c')](_0x9edf2b);}return null;};}function patchUpdates(_0x26c74b){return function(_0x175c6d){try{jsonpatch[_0xaf18('0x23')](_0x175c6d,_0x26c74b,!![]);}catch(_0x49f09e){return BPromise[_0xaf18('0x24')](_0x49f09e);}return _0x175c6d['save']();};}function saveUpdates(_0x4fd094,_0x409eb2){return function(_0x1c6430){if(_0x1c6430){return _0x1c6430[_0xaf18('0x25')](_0x4fd094)[_0xaf18('0x26')](function(_0x5e9ee4){return _0x5e9ee4;});}return null;};}function removeEntity(_0x3e1415,_0x1b0b3c){return function(_0x35c3f1){if(_0x35c3f1){return _0x35c3f1[_0xaf18('0x27')]()[_0xaf18('0x26')](function(){_0x3e1415[_0xaf18('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x146080,_0x30c3c2){return function(_0x5b25f2){if(!_0x5b25f2){_0x146080[_0xaf18('0x28')](0x194);}return _0x5b25f2;};}function handleError(_0x235e5a,_0x373da1){_0x373da1=_0x373da1||0x1f4;return function(_0x3002c2){logger[_0xaf18('0x29')](_0x3002c2['stack']);if(_0x3002c2[_0xaf18('0x2a')]){delete _0x3002c2[_0xaf18('0x2a')];}_0x235e5a[_0xaf18('0x1b')](_0x373da1)[_0xaf18('0x2b')](_0x3002c2);};}exports[_0xaf18('0x2c')]=function(_0x3fbaab,_0xfc1470){var _0x159386={},_0x306008={},_0x3cdfd7={'count':0x0,'rows':[]};var _0x5ced8c=_[_0xaf18('0x2d')](db[_0xaf18('0x2e')][_0xaf18('0x2f')],function(_0x2e953f){return{'name':_0x2e953f[_0xaf18('0x30')],'type':_0x2e953f[_0xaf18('0x31')]['key']};});_0x306008[_0xaf18('0x32')]=_[_0xaf18('0x33')](_[_0xaf18('0x2d')](_0x5ced8c,_0xaf18('0x2a')),[_0xaf18('0x34')]);_0x306008[_0xaf18('0x35')]=_[_0xaf18('0x36')](_0x3fbaab[_0xaf18('0x35')]);_0x306008['filters']=_[_0xaf18('0x37')](_0x306008[_0xaf18('0x32')],_0x306008[_0xaf18('0x35')]);_0x159386[_0xaf18('0x38')]=_[_0xaf18('0x37')](_0x306008[_0xaf18('0x32')],qs[_0xaf18('0x39')](_0x3fbaab['query'][_0xaf18('0x39')]));_0x159386[_0xaf18('0x38')]=_0x159386[_0xaf18('0x38')][_0xaf18('0x3a')]?_0x159386['attributes']:_0x306008[_0xaf18('0x32')];if(!_0x3fbaab[_0xaf18('0x35')]['hasOwnProperty'](_0xaf18('0x3b'))){_0x159386['limit']=qs['limit'](_0x3fbaab[_0xaf18('0x35')][_0xaf18('0x20')]);_0x159386[_0xaf18('0x1d')]=qs[_0xaf18('0x1d')](_0x3fbaab[_0xaf18('0x35')]['offset']);}_0x159386[_0xaf18('0x3c')]=qs[_0xaf18('0x3d')](_0x3fbaab[_0xaf18('0x35')][_0xaf18('0x3d')]);_0x159386[_0xaf18('0x3e')]=qs[_0xaf18('0x3f')](_[_0xaf18('0x40')](_0x3fbaab[_0xaf18('0x35')],_0x306008[_0xaf18('0x3f')]),_0x5ced8c);if(_0x3fbaab['query']['filter']){_0x159386[_0xaf18('0x3e')]=_['merge'](_0x159386['where'],{'$or':_[_0xaf18('0x2d')](_0x5ced8c,function(_0x19c3c3){if(_0x19c3c3['type']!==_0xaf18('0x41')){var _0x592f9b={};_0x592f9b[_0x19c3c3[_0xaf18('0x2a')]]={'$like':'%'+_0x3fbaab[_0xaf18('0x35')]['filter']+'%'};return _0x592f9b;}})});}_0x159386=_['merge']({},_0x159386,_0x3fbaab[_0xaf18('0x42')]);var _0x53c1cd={'where':_0x159386[_0xaf18('0x3e')]};return db[_0xaf18('0x2e')]['count'](_0x53c1cd)['then'](function(_0x41796d){_0x3cdfd7[_0xaf18('0x1f')]=_0x41796d;if(_0x3fbaab[_0xaf18('0x35')][_0xaf18('0x43')]){_0x159386['include']=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x159386);})[_0xaf18('0x26')](function(_0x1cce40){_0x3cdfd7['rows']=_0x1cce40;return _0x3cdfd7;})[_0xaf18('0x26')](respondWithFilteredResult(_0xfc1470,_0x159386))[_0xaf18('0x44')](handleError(_0xfc1470,null));};exports[_0xaf18('0x45')]=function(_0x5c51f9,_0x222a01){var _0x49ab8c={'raw':![],'where':{'id':_0x5c51f9[_0xaf18('0x46')]['id']}},_0x3d0015={};_0x3d0015[_0xaf18('0x32')]=_[_0xaf18('0x36')](db[_0xaf18('0x2e')]['rawAttributes']);_0x3d0015[_0xaf18('0x35')]=_[_0xaf18('0x36')](_0x5c51f9[_0xaf18('0x35')]);_0x3d0015['filters']=_[_0xaf18('0x37')](_0x3d0015['model'],_0x3d0015['query']);_0x49ab8c[_0xaf18('0x38')]=_[_0xaf18('0x37')](_0x3d0015[_0xaf18('0x32')],qs[_0xaf18('0x39')](_0x5c51f9['query']['fields']));_0x49ab8c[_0xaf18('0x38')]=_0x49ab8c['attributes']['length']?_0x49ab8c['attributes']:_0x3d0015[_0xaf18('0x32')];if(_0x5c51f9[_0xaf18('0x35')][_0xaf18('0x43')]){_0x49ab8c[_0xaf18('0x47')]=[{'all':!![]}];}_0x49ab8c=_[_0xaf18('0x48')]({},_0x49ab8c,_0x5c51f9[_0xaf18('0x42')]);return db[_0xaf18('0x2e')][_0xaf18('0x49')](_0x49ab8c)[_0xaf18('0x26')](handleEntityNotFound(_0x222a01,null))[_0xaf18('0x26')](respondWithResult(_0x222a01,null))[_0xaf18('0x44')](handleError(_0x222a01,null));};exports[_0xaf18('0x4a')]=function(_0x534568,_0x4a3221){return db[_0xaf18('0x2e')][_0xaf18('0x4a')](_0x534568[_0xaf18('0x4b')],{})[_0xaf18('0x26')](respondWithResult(_0x4a3221,0xc9))[_0xaf18('0x44')](handleError(_0x4a3221,null));};exports[_0xaf18('0x25')]=function(_0x539e45,_0x3ae6ff){if(_0x539e45['body']['id']){delete _0x539e45['body']['id'];}return db['VoiceRecording'][_0xaf18('0x49')]({'where':{'id':_0x539e45['params']['id']}})[_0xaf18('0x26')](handleEntityNotFound(_0x3ae6ff,null))['then'](saveUpdates(_0x539e45[_0xaf18('0x4b')],null))['then'](respondWithResult(_0x3ae6ff,null))['catch'](handleError(_0x3ae6ff,null));};exports[_0xaf18('0x4c')]=function(_0x281dc1,_0x7c29f3){return db['VoiceRecording'][_0xaf18('0x4c')]()[_0xaf18('0x26')](respondWithResult(_0x7c29f3,null))['catch'](handleError(_0x7c29f3,null));};exports[_0xaf18('0x4d')]=function(_0x1ca931,_0x55d8a3,_0x30835e){var _0x1d4a02=require(_0xaf18('0x4e'));var _0x59ed96=![];var _0x3107c1={};if(_0x1ca931['query'][_0xaf18('0x31')]&&_0x1ca931[_0xaf18('0x35')][_0xaf18('0x31')]===_0xaf18('0x4f')){_0x3107c1[_0xaf18('0x4f')]=_0x1ca931[_0xaf18('0x46')]['id'];}else{_0x3107c1['id']=_0x1ca931[_0xaf18('0x46')]['id'];}return db[_0xaf18('0x2e')][_0xaf18('0x49')]({'where':_0x3107c1,'attributes':['id',_0xaf18('0x50')],'raw':!![]})[_0xaf18('0x26')](handleEntityNotFound(_0x55d8a3,null))[_0xaf18('0x26')](function(_0x3a7379){if(_0x3a7379){var _0x4dc272=_0x3a7379[_0xaf18('0x50')];var _0x3bacb3=util[_0xaf18('0x34')]('%s.cypher',_0x4dc272);if(fs[_0xaf18('0x51')](_0x3bacb3)){_0x59ed96=!![];return _0x1d4a02[_0xaf18('0x52')](_0x3bacb3,_0x4dc272,config[_0xaf18('0x53')]['recording'])['then'](function(){return _0x3a7379;});}return _0x3a7379;}})[_0xaf18('0x26')](function(_0x1835ed){if(_0x1835ed){var _0x73550=_0x1835ed['value'];if(!fs[_0xaf18('0x51')](_0x73550)){throw new db[(_0xaf18('0x54'))]['ValidationError'](_0xaf18('0x55'));}if(_0x1835ed[_0xaf18('0x56')]){return _0x55d8a3[_0xaf18('0x4d')](_0x73550,_0x1835ed[_0xaf18('0x56')]+path[_0xaf18('0x57')](_0x73550),function(){if(_0x59ed96){fs['unlink'](_0x73550);}});}else{return _0x55d8a3[_0xaf18('0x4d')](_0x73550,function(_0x462058){if(_0x59ed96){fs[_0xaf18('0x58')](_0x73550);}});}}})['catch'](function(_0x4fb863){if(_0x4fb863['message']==='VoiceRecording\x20not\x20found'){_0x55d8a3[_0xaf18('0x1b')](0x194)[_0xaf18('0x2b')](_0xaf18('0x59'));}else{return handleError(_0x55d8a3,null);}});};exports[_0xaf18('0x5a')]=function(_0x2bc1d1,_0xa40f,_0x5a2b88){var _0x560706=require(_0xaf18('0x4e'));var _0xe6f9a=![];var _0x2d2125={'$and':[db['sequelize']['where'](db[_0xaf18('0x5b')]['fn']('MD5',db[_0xaf18('0x5b')][_0xaf18('0x5c')](_0xaf18('0x4f'))),_0x2bc1d1['query'][_0xaf18('0x5d')])]};if(_0x2bc1d1[_0xaf18('0x35')]['type']&&_0x2bc1d1[_0xaf18('0x35')][_0xaf18('0x31')]===_0xaf18('0x4f')){_0x2d2125[_0xaf18('0x5e')][_0xaf18('0x5f')]({'uniqueid':_0x2bc1d1[_0xaf18('0x46')]['id']});}else{_0x2d2125[_0xaf18('0x5e')][_0xaf18('0x5f')]({'id':_0x2bc1d1[_0xaf18('0x46')]['id']});}return db[_0xaf18('0x2e')][_0xaf18('0x49')]({'where':_0x2d2125,'attributes':['id',_0xaf18('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0xa40f,null))['then'](function(_0x3b0695){if(_0x3b0695){var _0x54c73d=util[_0xaf18('0x34')](_0xaf18('0x60'),_0x3b0695['value']);if(fs[_0xaf18('0x51')](_0x54c73d)){_0xe6f9a=!![];return _0x560706[_0xaf18('0x52')](_0x54c73d,_0x3b0695['value'],config[_0xaf18('0x53')][_0xaf18('0x61')])[_0xaf18('0x26')](function(){return _0x3b0695;});}return _0x3b0695;}})['then'](function(_0x46d190){if(_0x46d190){if(!fs['existsSync'](_0x46d190['value'])){throw new db['Sequelize'][(_0xaf18('0x62'))]('VoiceRecording\x20not\x20found');}if(_0x46d190[_0xaf18('0x56')]){return _0xa40f['download'](_0x46d190['value'],_0x46d190[_0xaf18('0x56')]+path[_0xaf18('0x57')](_0x46d190[_0xaf18('0x50')]),function(){if(_0xe6f9a){fs[_0xaf18('0x58')](_0x46d190[_0xaf18('0x50')]);}});}else{return _0xa40f[_0xaf18('0x4d')](_0x46d190[_0xaf18('0x50')],function(_0x4998af){if(_0xe6f9a){fs[_0xaf18('0x58')](_0x46d190[_0xaf18('0x50')]);}});}}})['catch'](handleError(_0xa40f,null));};exports['destroy']=function(_0x5ddc30,_0x3a9e17){return db[_0xaf18('0x2e')][_0xaf18('0x49')]({'where':{'id':_0x5ddc30[_0xaf18('0x46')]['id']}})[_0xaf18('0x26')](function(_0xfbfca7){if(_[_0xaf18('0x63')](_0xfbfca7)){throw new ReferenceError(_0xaf18('0x64'));}return _0xfbfca7;})[_0xaf18('0x26')](function(_0x2242e7){var _0xdc698f=_0x2242e7[_0xaf18('0x50')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0xdc698f);if(!_[_0xaf18('0x63')](_0x2242e7[_0xaf18('0x50')])&&fs[_0xaf18('0x51')](_0xdc698f)){logger[_0xaf18('0x65')](_0xaf18('0x66')+_0xdc698f+_0xaf18('0x67'));fs[_0xaf18('0x68')](_0xdc698f);}_0xdc698f=_0xdc698f+_0xaf18('0x69');if(!_['isNil'](_0x2242e7[_0xaf18('0x50')])&&fs[_0xaf18('0x51')](_0xdc698f)){logger[_0xaf18('0x65')](_0xaf18('0x66')+_0xdc698f+_0xaf18('0x67'));fs[_0xaf18('0x68')](_0xdc698f);}return _0x2242e7;})[_0xaf18('0x26')](function(_0x538205){if(!_0x538205)throw new InternalError();return _0x538205[_0xaf18('0x27')]();})[_0xaf18('0x26')](function(){_0x3a9e17['status'](0xcc)['end']();})[_0xaf18('0x44')](handleError(_0x3a9e17,null));};function getBucketslist(_0x517c38,_0x41245d,_0x591a5b){return new Promise(function(_0x3ec9e2,_0x2dda00){var _0x57c04a=new AWS['S3']({'accessKeyId':_0x41245d,'secretAccessKey':_0x517c38,'region':_0x591a5b});_0x57c04a[_0xaf18('0x6a')]({},function(_0x16fc2a,_0x3ed39a){if(_0x16fc2a){return _0x2dda00(_0x16fc2a);}else{return _0x3ec9e2(_0x3ed39a);}});});}function createBucket(_0x3011ab,_0x4fc3e0,_0x588595,_0x44641b){return new Promise(function(_0x1972cc,_0x2c857f){var _0xf74c8c=new AWS['S3']({'accessKeyId':_0x4fc3e0,'secretAccessKey':_0x3011ab,'region':_0x588595});_0xf74c8c[_0xaf18('0x6b')]({'Bucket':_0x44641b},function(_0xf78c8d,_0x3131ad){if(_0xf78c8d){return _0x2c857f(_0xf78c8d);}else{return _0x1972cc(_0x3131ad);}});});}function uploadFile(_0x19b075,_0x341994,_0x150972,_0x388fb3,_0x57646d,_0x492761){return new Promise(function(_0x50de7b,_0x4bddde){var _0x3df05e=new AWS['S3']({'accessKeyId':_0x341994,'secretAccessKey':_0x19b075,'region':_0x150972});_0x3df05e[_0xaf18('0x6c')]({'Bucket':_0x388fb3,'Key':_0x57646d,'Body':_0x492761},function(_0x442117,_0x29bd8c){if(_0x442117){return _0x4bddde(_0x442117);}else{return _0x50de7b(_0x29bd8c);}});});}function startTranscribe(_0x3fdaaf,_0x517644,_0xcf21d7,_0x205030,_0xa4b8e5,_0x1308c3){return new Promise(function(_0x1b9f20,_0x49d88b){var _0x450a8c=new AWS[(_0xaf18('0x6d'))]({'accessKeyId':_0x517644,'secretAccessKey':_0x3fdaaf,'region':_0xcf21d7});_0x450a8c[_0xaf18('0x6e')]({'TranscriptionJobName':_0x205030,'LanguageCode':_0xa4b8e5,'Media':{'MediaFileUri':_0x1308c3}},function(_0x3e5a94,_0x4facf9){if(_0x3e5a94){return _0x49d88b(_0x3e5a94);}else{return _0x1b9f20(_0x4facf9);}});});}function transcribe(_0x308196,_0x377a6f,_0x5ab9b7,_0x33c795,_0x40033b,_0x3f54d7,_0x3cfe63){return new Promise(function(_0x127b79,_0x4a9235){var _0x3548fb={};logger[_0xaf18('0x65')](util[_0xaf18('0x34')](_0xaf18('0x6f'),_0x308196,_0x40033b));return uploadFile(_0x377a6f,_0x5ab9b7,_0x33c795,_0x40033b,path[_0xaf18('0x70')](_0x3f54d7),fs[_0xaf18('0x71')](_0x3f54d7))[_0xaf18('0x26')](function(_0x52e384){logger[_0xaf18('0x65')](util[_0xaf18('0x34')](_0xaf18('0x72'),_0x308196,_0x40033b,_0x52e384[_0xaf18('0x73')]));_0x3548fb['bucket']=_0x52e384[_0xaf18('0x74')];_0x3548fb['location']=_0x52e384[_0xaf18('0x73')];logger[_0xaf18('0x65')](util['format'](_0xaf18('0x75'),_0x308196));return startTranscribe(_0x377a6f,_0x5ab9b7,_0x33c795,uuidv4(),_0x3cfe63,_0x52e384[_0xaf18('0x73')]);})[_0xaf18('0x26')](function(_0x46bdb4){logger['info'](util[_0xaf18('0x34')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x308196,_0x46bdb4[_0xaf18('0x76')][_0xaf18('0x77')]));_0x3548fb[_0xaf18('0x78')]=_0x46bdb4[_0xaf18('0x76')]['TranscriptionJobName'];_0x3548fb[_0xaf18('0x79')]=_0x46bdb4[_0xaf18('0x76')][_0xaf18('0x7a')];return _0x127b79(_0x3548fb);})[_0xaf18('0x44')](function(_0x3647d0){return _0x4a9235(_0x3647d0);});});}exports[_0xaf18('0x7b')]=function(_0x44e57e,_0x2273c8,_0x13cb46){var _0x39d587;var _0x56f564;var _0x1f8d60;var _0x3a54e0=require('../../components/encryptor');return db[_0xaf18('0x2e')][_0xaf18('0x7c')]({'where':{'id':_0x44e57e[_0xaf18('0x46')]['id']}})[_0xaf18('0x26')](function(_0x448007){if(_0x448007){var _0x52ed4d=util[_0xaf18('0x34')]('%s.cypher',_0x448007[_0xaf18('0x50')]);if(fs[_0xaf18('0x51')](_0x52ed4d)){cypher=!![];return _0x3a54e0['decryptFile'](_0x52ed4d,_0x448007['value'],config['secrets']['recording'])[_0xaf18('0x26')](function(){return _0x448007;});}return _0x448007;}})[_0xaf18('0x26')](function(_0x5d9e17){if(!_0x5d9e17){throw new db[(_0xaf18('0x54'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x56f564=_0x5d9e17;return db[_0xaf18('0x7d')]['findOne']({'where':{'id':0x1}});})[_0xaf18('0x26')](handleEntityNotFound(_0x2273c8,null))[_0xaf18('0x26')](function(_0x1c3cad){if(_0x1c3cad){_0x39d587=_0x1c3cad;if(!_0x39d587[_0xaf18('0x7e')]||!_0x39d587[_0xaf18('0x7f')]||!_0x39d587['transcribeRegion']||!_0x39d587[_0xaf18('0x80')]||!_0x39d587['bucket']){throw new db[(_0xaf18('0x54'))]['ValidationError'](_0xaf18('0x81'));}if(_0x44e57e[_0xaf18('0x4b')][_0xaf18('0x82')]&&(!_0x39d587[_0xaf18('0x83')]||!_0x39d587[_0xaf18('0x84')]||!_0x39d587[_0xaf18('0x85')]||!_0x39d587[_0xaf18('0x80')]||!_0x39d587[_0xaf18('0x86')])){throw new db[(_0xaf18('0x54'))][(_0xaf18('0x62'))](_0xaf18('0x87'));}return db[_0xaf18('0x88')][_0xaf18('0x7c')]({'where':{'id':_0x39d587[_0xaf18('0x7f')]}});}})[_0xaf18('0x26')](function(_0x2c8aa2){if(!_0x2c8aa2){throw new db['Sequelize'][(_0xaf18('0x62'))](_0xaf18('0x89'));}if(!_0x2c8aa2[_0xaf18('0x8a')]||!_0x2c8aa2[_0xaf18('0x8b')]){throw new db['Sequelize'][(_0xaf18('0x62'))](_0xaf18('0x8c'));}_0x1f8d60=_0x2c8aa2;return getBucketslist(_0x1f8d60[_0xaf18('0x8a')],_0x1f8d60[_0xaf18('0x8b')],_0x39d587['transcribeRegion']);})[_0xaf18('0x26')](function(_0x33bd81){if(_0x33bd81&&_0x33bd81[_0xaf18('0x8d')]){var _0x50eaef=_[_0xaf18('0x49')](_0x33bd81[_0xaf18('0x8d')],function(_0xa836c4){return _0xa836c4['Name']===_0x39d587[_0xaf18('0x86')];});if(!_0x50eaef){logger[_0xaf18('0x65')](util[_0xaf18('0x34')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x44e57e[_0xaf18('0x46')]['id'],_0x39d587[_0xaf18('0x86')]));return createBucket(_0x1f8d60[_0xaf18('0x8a')],_0x1f8d60[_0xaf18('0x8b')],_0x39d587[_0xaf18('0x8e')],_0x39d587[_0xaf18('0x86')]);}logger[_0xaf18('0x65')](util[_0xaf18('0x34')](_0xaf18('0x8f'),_0x44e57e['params']['id'],_0x39d587['bucket']));return;}})[_0xaf18('0x26')](function(_0x28bac8){if(_0x56f564[_0xaf18('0x79')]===_0xaf18('0x90')){return transcribe(_0x44e57e[_0xaf18('0x46')]['id'],_0x1f8d60[_0xaf18('0x8a')],_0x1f8d60[_0xaf18('0x8b')],_0x39d587['transcribeRegion'],_0x39d587[_0xaf18('0x86')],_0x56f564['value'],_0x39d587['language']);}else{logger[_0xaf18('0x65')](util['format'](_0xaf18('0x91'),_0x44e57e[_0xaf18('0x46')]['id']));return{'transcribeStatus':_0xaf18('0x92')};}})[_0xaf18('0x26')](function(_0x53a54c){if(_0x53a54c){_0x53a54c[_0xaf18('0x93')]=_0x44e57e[_0xaf18('0x4b')]['runSentiment'];return _0x56f564[_0xaf18('0x94')](_0x53a54c);}})[_0xaf18('0x26')](respondWithResult(_0x2273c8,null))['catch'](handleError(_0x2273c8,null));};function writeFile(_0x3a9c3b,_0x2a8656){return new Promise(function(_0xa29189,_0x1df2d9){fs[_0xaf18('0x95')](_0x2a8656,_0x3a9c3b,function(_0xbc126c,_0x15e57a){if(_0xbc126c){return _0x1df2d9(_0xbc126c);}else{return _0xa29189(_0x15e57a);}});});}exports[_0xaf18('0x96')]=function(_0x5ad914,_0x1c06d2,_0x20c4f5){return db[_0xaf18('0x2e')][_0xaf18('0x7c')]({'where':{'id':_0x5ad914['params']['id']}})[_0xaf18('0x26')](handleEntityNotFound(_0x1c06d2))[_0xaf18('0x26')](function(_0x23df67){if(_0x23df67&&_0x23df67[_0xaf18('0x97')]){var _0x236d5a=_0x23df67[_0xaf18('0x97')];var _0x451985=config[_0xaf18('0x98')]+_0xaf18('0x99')+_0x23df67['id']+_0xaf18('0x9a');if(fs['existsSync'](_0x451985)){return _0x451985;}return writeFile(_0x236d5a,_0x451985)['then'](function(){return _0x451985;});}else{throw new db[(_0xaf18('0x54'))][(_0xaf18('0x62'))]('Transcript\x20not\x20available');}})['then'](function(_0x112e10){return _0x1c06d2[_0xaf18('0x4d')](_0x112e10);})[_0xaf18('0x44')](handleError(_0x1c06d2));}; \ No newline at end of file +var _0xd901=['find','create','body','update','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','$and','push','download','isNil','Entity\x20not\x20found','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','language','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','querystring','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','VoiceRecording','rawAttributes','fieldName','model','differenceBy','map','format','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','type','VIRTUAL','merge','include','findAll','rows','catch','show','params','includeAll','options'];(function(_0x1c6f47,_0x1fda02){var _0x47c018=function(_0x5b14b1){while(--_0x5b14b1){_0x1c6f47['push'](_0x1c6f47['shift']());}};_0x47c018(++_0x1fda02);}(_0xd901,0xeb));var _0x1d90=function(_0x168e24,_0x347c8a){_0x168e24=_0x168e24-0x0;var _0x2f90de=_0xd901[_0x168e24];return _0x2f90de;};'use strict';var emlformat=require(_0x1d90('0x0'));var rimraf=require(_0x1d90('0x1'));var zipdir=require(_0x1d90('0x2'));var jsonpatch=require(_0x1d90('0x3'));var rp=require(_0x1d90('0x4'));var moment=require(_0x1d90('0x5'));var BPromise=require(_0x1d90('0x6'));var Mustache=require(_0x1d90('0x7'));var util=require(_0x1d90('0x8'));var path=require(_0x1d90('0x9'));var sox=require(_0x1d90('0xa'));var csv=require(_0x1d90('0xb'));var ejs=require(_0x1d90('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1d90('0xd'));var squel=require(_0x1d90('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1d90('0xb'));var querystring=require(_0x1d90('0xf'));var Papa=require('papaparse');var AWS=require(_0x1d90('0x10'));var uuidv4=require(_0x1d90('0x11'));var Redis=require('ioredis');var authService=require(_0x1d90('0x12'));var qs=require(_0x1d90('0x13'));var as=require(_0x1d90('0x14'));var hardwareService=require(_0x1d90('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x1d90('0x16'));var config=require(_0x1d90('0x17'));var licenseUtil=require(_0x1d90('0x18'));var db=require(_0x1d90('0x19'))['db'];function respondWithStatusCode(_0x474b0d,_0x211413){_0x211413=_0x211413||0xcc;return function(_0x1d47c9){if(_0x1d47c9){return _0x474b0d[_0x1d90('0x1a')](_0x211413);}return _0x474b0d[_0x1d90('0x1b')](_0x211413)[_0x1d90('0x1c')]();};}function respondWithResult(_0x22d9f2,_0x366597){_0x366597=_0x366597||0xc8;return function(_0x219fb2){if(_0x219fb2){return _0x22d9f2[_0x1d90('0x1b')](_0x366597)[_0x1d90('0x1d')](_0x219fb2);}};}function respondWithFilteredResult(_0x43809f,_0xfeae31){return function(_0x15137d){if(_0x15137d){var _0x1d650d=typeof _0xfeae31['offset']===_0x1d90('0x1e')&&typeof _0xfeae31['limit']==='undefined';var _0x419ffa=_0x15137d[_0x1d90('0x1f')];var _0x17d822=_0x1d650d?0x0:_0xfeae31[_0x1d90('0x20')];var _0x3f3e0e=_0x1d650d?_0x15137d[_0x1d90('0x1f')]:_0xfeae31[_0x1d90('0x20')]+_0xfeae31['limit'];var _0x5af165;if(_0x3f3e0e>=_0x419ffa){_0x3f3e0e=_0x419ffa;_0x5af165=0xc8;}else{_0x5af165=0xce;}_0x43809f['status'](_0x5af165);return _0x43809f['set'](_0x1d90('0x21'),_0x17d822+'-'+_0x3f3e0e+'/'+_0x419ffa)[_0x1d90('0x1d')](_0x15137d);}return null;};}function patchUpdates(_0x2c64f5){return function(_0x1d2e22){try{jsonpatch[_0x1d90('0x22')](_0x1d2e22,_0x2c64f5,!![]);}catch(_0x798080){return BPromise[_0x1d90('0x23')](_0x798080);}return _0x1d2e22[_0x1d90('0x24')]();};}function saveUpdates(_0x48773a,_0x16e52c){return function(_0x76da38){if(_0x76da38){return _0x76da38['update'](_0x48773a)[_0x1d90('0x25')](function(_0x2d1d18){return _0x2d1d18;});}return null;};}function removeEntity(_0x340167,_0x558750){return function(_0x412b6b){if(_0x412b6b){return _0x412b6b[_0x1d90('0x26')]()['then'](function(){_0x340167[_0x1d90('0x1b')](0xcc)[_0x1d90('0x1c')]();});}};}function handleEntityNotFound(_0xce3b46,_0x316118){return function(_0x364579){if(!_0x364579){_0xce3b46['sendStatus'](0x194);}return _0x364579;};}function handleError(_0x40d630,_0x4bc58d){_0x4bc58d=_0x4bc58d||0x1f4;return function(_0x4d5d2c){logger[_0x1d90('0x27')](_0x4d5d2c[_0x1d90('0x28')]);if(_0x4d5d2c['name']){delete _0x4d5d2c[_0x1d90('0x29')];}_0x40d630['status'](_0x4bc58d)[_0x1d90('0x2a')](_0x4d5d2c);};}exports[_0x1d90('0x2b')]=function(_0x9b0ac5,_0x253f23){var _0x5d4bcb={},_0x5732ae={},_0x3bc9b9={'count':0x0,'rows':[]};var _0x186e5e=_['map'](db[_0x1d90('0x2c')][_0x1d90('0x2d')],function(_0x14aaf6){return{'name':_0x14aaf6[_0x1d90('0x2e')],'type':_0x14aaf6['type']['key']};});_0x5732ae[_0x1d90('0x2f')]=_[_0x1d90('0x30')](_[_0x1d90('0x31')](_0x186e5e,_0x1d90('0x29')),[_0x1d90('0x32')]);_0x5732ae[_0x1d90('0x33')]=_[_0x1d90('0x34')](_0x9b0ac5['query']);_0x5732ae[_0x1d90('0x35')]=_['intersection'](_0x5732ae[_0x1d90('0x2f')],_0x5732ae[_0x1d90('0x33')]);_0x5d4bcb[_0x1d90('0x36')]=_[_0x1d90('0x37')](_0x5732ae[_0x1d90('0x2f')],qs['fields'](_0x9b0ac5[_0x1d90('0x33')]['fields']));_0x5d4bcb[_0x1d90('0x36')]=_0x5d4bcb[_0x1d90('0x36')][_0x1d90('0x38')]?_0x5d4bcb['attributes']:_0x5732ae['model'];if(!_0x9b0ac5[_0x1d90('0x33')][_0x1d90('0x39')](_0x1d90('0x3a'))){_0x5d4bcb['limit']=qs[_0x1d90('0x3b')](_0x9b0ac5[_0x1d90('0x33')]['limit']);_0x5d4bcb[_0x1d90('0x20')]=qs[_0x1d90('0x20')](_0x9b0ac5[_0x1d90('0x33')][_0x1d90('0x20')]);}_0x5d4bcb['order']=qs[_0x1d90('0x3c')](_0x9b0ac5[_0x1d90('0x33')]['sort']);_0x5d4bcb[_0x1d90('0x3d')]=qs['filters'](_[_0x1d90('0x3e')](_0x9b0ac5['query'],_0x5732ae[_0x1d90('0x35')]),_0x186e5e);if(_0x9b0ac5[_0x1d90('0x33')][_0x1d90('0x3f')]){_0x5d4bcb[_0x1d90('0x3d')]=_['merge'](_0x5d4bcb['where'],{'$or':_[_0x1d90('0x31')](_0x186e5e,function(_0x37325f){if(_0x37325f[_0x1d90('0x40')]!==_0x1d90('0x41')){var _0xc3491c={};_0xc3491c[_0x37325f[_0x1d90('0x29')]]={'$like':'%'+_0x9b0ac5[_0x1d90('0x33')][_0x1d90('0x3f')]+'%'};return _0xc3491c;}})});}_0x5d4bcb=_[_0x1d90('0x42')]({},_0x5d4bcb,_0x9b0ac5['options']);var _0x7beebd={'where':_0x5d4bcb[_0x1d90('0x3d')]};return db[_0x1d90('0x2c')][_0x1d90('0x1f')](_0x7beebd)[_0x1d90('0x25')](function(_0x1f795e){_0x3bc9b9[_0x1d90('0x1f')]=_0x1f795e;if(_0x9b0ac5[_0x1d90('0x33')]['includeAll']){_0x5d4bcb[_0x1d90('0x43')]=[{'all':!![]}];}return db[_0x1d90('0x2c')][_0x1d90('0x44')](_0x5d4bcb);})['then'](function(_0x31b9b5){_0x3bc9b9[_0x1d90('0x45')]=_0x31b9b5;return _0x3bc9b9;})[_0x1d90('0x25')](respondWithFilteredResult(_0x253f23,_0x5d4bcb))[_0x1d90('0x46')](handleError(_0x253f23,null));};exports[_0x1d90('0x47')]=function(_0x17d476,_0x4fa846){var _0x58ce37={'raw':![],'where':{'id':_0x17d476[_0x1d90('0x48')]['id']}},_0x911b6b={};_0x911b6b[_0x1d90('0x2f')]=_[_0x1d90('0x34')](db['VoiceRecording'][_0x1d90('0x2d')]);_0x911b6b[_0x1d90('0x33')]=_['keys'](_0x17d476[_0x1d90('0x33')]);_0x911b6b[_0x1d90('0x35')]=_[_0x1d90('0x37')](_0x911b6b['model'],_0x911b6b['query']);_0x58ce37[_0x1d90('0x36')]=_[_0x1d90('0x37')](_0x911b6b[_0x1d90('0x2f')],qs['fields'](_0x17d476[_0x1d90('0x33')]['fields']));_0x58ce37['attributes']=_0x58ce37['attributes'][_0x1d90('0x38')]?_0x58ce37['attributes']:_0x911b6b[_0x1d90('0x2f')];if(_0x17d476[_0x1d90('0x33')][_0x1d90('0x49')]){_0x58ce37[_0x1d90('0x43')]=[{'all':!![]}];}_0x58ce37=_['merge']({},_0x58ce37,_0x17d476[_0x1d90('0x4a')]);return db[_0x1d90('0x2c')][_0x1d90('0x4b')](_0x58ce37)[_0x1d90('0x25')](handleEntityNotFound(_0x4fa846,null))[_0x1d90('0x25')](respondWithResult(_0x4fa846,null))[_0x1d90('0x46')](handleError(_0x4fa846,null));};exports[_0x1d90('0x4c')]=function(_0x56831a,_0x354f9d){return db[_0x1d90('0x2c')]['create'](_0x56831a[_0x1d90('0x4d')],{})[_0x1d90('0x25')](respondWithResult(_0x354f9d,0xc9))[_0x1d90('0x46')](handleError(_0x354f9d,null));};exports[_0x1d90('0x4e')]=function(_0x1393a1,_0x5526d0){if(_0x1393a1[_0x1d90('0x4d')]['id']){delete _0x1393a1['body']['id'];}return db[_0x1d90('0x2c')]['find']({'where':{'id':_0x1393a1[_0x1d90('0x48')]['id']}})['then'](handleEntityNotFound(_0x5526d0,null))[_0x1d90('0x25')](saveUpdates(_0x1393a1[_0x1d90('0x4d')],null))[_0x1d90('0x25')](respondWithResult(_0x5526d0,null))[_0x1d90('0x46')](handleError(_0x5526d0,null));};exports['describe']=function(_0x1e9c0d,_0x3347f6){return db['VoiceRecording']['describe']()[_0x1d90('0x25')](respondWithResult(_0x3347f6,null))[_0x1d90('0x46')](handleError(_0x3347f6,null));};exports['download']=function(_0x18bdb7,_0x70876,_0x113f57){var _0x2b7e80=require(_0x1d90('0x4f'));var _0x459e1e=![];var _0x299d0c={};if(_0x18bdb7[_0x1d90('0x33')]['type']&&_0x18bdb7[_0x1d90('0x33')][_0x1d90('0x40')]==='uniqueid'){_0x299d0c[_0x1d90('0x50')]=_0x18bdb7['params']['id'];}else{_0x299d0c['id']=_0x18bdb7[_0x1d90('0x48')]['id'];}return db['VoiceRecording'][_0x1d90('0x4b')]({'where':_0x299d0c,'attributes':['id',_0x1d90('0x51')],'raw':!![]})[_0x1d90('0x25')](handleEntityNotFound(_0x70876,null))[_0x1d90('0x25')](function(_0x1a68ff){if(_0x1a68ff){var _0x4a8ada=_0x1a68ff[_0x1d90('0x51')];var _0xaccc9f=util[_0x1d90('0x32')](_0x1d90('0x52'),_0x4a8ada);if(fs[_0x1d90('0x53')](_0xaccc9f)){_0x459e1e=!![];return _0x2b7e80[_0x1d90('0x54')](_0xaccc9f,_0x4a8ada,config[_0x1d90('0x55')][_0x1d90('0x56')])[_0x1d90('0x25')](function(){return _0x1a68ff;});}return _0x1a68ff;}})['then'](function(_0x2762f1){if(_0x2762f1){var _0x1f4972=_0x2762f1['value'];if(!fs['existsSync'](_0x1f4972)){throw new db[(_0x1d90('0x57'))][(_0x1d90('0x58'))](_0x1d90('0x59'));}if(_0x2762f1[_0x1d90('0x5a')]){return _0x70876['download'](_0x1f4972,_0x2762f1[_0x1d90('0x5a')]+path[_0x1d90('0x5b')](_0x1f4972),function(){if(_0x459e1e){fs[_0x1d90('0x5c')](_0x1f4972);}});}else{return _0x70876['download'](_0x1f4972,function(_0x33d9f2){if(_0x459e1e){fs[_0x1d90('0x5c')](_0x1f4972);}});}}})[_0x1d90('0x46')](function(_0x211cc1){if(_0x211cc1[_0x1d90('0x5d')]===_0x1d90('0x59')){_0x70876['status'](0x194)[_0x1d90('0x2a')](_0x1d90('0x5e'));}else{return handleError(_0x70876,null);}});};exports[_0x1d90('0x5f')]=function(_0x35d239,_0x4248bd,_0x2bf499){var _0x364f7b=require('../../components/encryptor');var _0x4c18d1=![];var _0x3cc6db={'$and':[db[_0x1d90('0x60')]['where'](db[_0x1d90('0x60')]['fn'](_0x1d90('0x61'),db[_0x1d90('0x60')][_0x1d90('0x62')]('uniqueid')),_0x35d239[_0x1d90('0x33')]['token'])]};if(_0x35d239[_0x1d90('0x33')][_0x1d90('0x40')]&&_0x35d239['query'][_0x1d90('0x40')]==='uniqueid'){_0x3cc6db[_0x1d90('0x63')][_0x1d90('0x64')]({'uniqueid':_0x35d239[_0x1d90('0x48')]['id']});}else{_0x3cc6db[_0x1d90('0x63')][_0x1d90('0x64')]({'id':_0x35d239[_0x1d90('0x48')]['id']});}return db[_0x1d90('0x2c')]['find']({'where':_0x3cc6db,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x4248bd,null))[_0x1d90('0x25')](function(_0xa2efb){if(_0xa2efb){var _0x58c2e6=util['format'](_0x1d90('0x52'),_0xa2efb['value']);if(fs[_0x1d90('0x53')](_0x58c2e6)){_0x4c18d1=!![];return _0x364f7b[_0x1d90('0x54')](_0x58c2e6,_0xa2efb[_0x1d90('0x51')],config[_0x1d90('0x55')][_0x1d90('0x56')])['then'](function(){return _0xa2efb;});}return _0xa2efb;}})[_0x1d90('0x25')](function(_0xa2e644){if(_0xa2e644){if(!fs[_0x1d90('0x53')](_0xa2e644[_0x1d90('0x51')])){throw new db['Sequelize'][(_0x1d90('0x58'))](_0x1d90('0x59'));}if(_0xa2e644[_0x1d90('0x5a')]){return _0x4248bd[_0x1d90('0x65')](_0xa2e644[_0x1d90('0x51')],_0xa2e644[_0x1d90('0x5a')]+path[_0x1d90('0x5b')](_0xa2e644[_0x1d90('0x51')]),function(){if(_0x4c18d1){fs['unlink'](_0xa2e644[_0x1d90('0x51')]);}});}else{return _0x4248bd[_0x1d90('0x65')](_0xa2e644['value'],function(_0x5adb0c){if(_0x4c18d1){fs['unlink'](_0xa2e644[_0x1d90('0x51')]);}});}}})['catch'](handleError(_0x4248bd,null));};exports[_0x1d90('0x26')]=function(_0x2cb1b6,_0x1da1de){return db[_0x1d90('0x2c')]['find']({'where':{'id':_0x2cb1b6[_0x1d90('0x48')]['id']}})[_0x1d90('0x25')](function(_0x9ffb2b){if(_[_0x1d90('0x66')](_0x9ffb2b)){throw new ReferenceError(_0x1d90('0x67'));}return _0x9ffb2b;})[_0x1d90('0x25')](function(_0x507c55){var _0x1bc592=_0x507c55[_0x1d90('0x51')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x1bc592);if(!_[_0x1d90('0x66')](_0x507c55[_0x1d90('0x51')])&&fs[_0x1d90('0x53')](_0x1bc592)){logger[_0x1d90('0x68')](_0x1d90('0x69')+_0x1bc592+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x1d90('0x6a')](_0x1bc592);}_0x1bc592=_0x1bc592+_0x1d90('0x6b');if(!_[_0x1d90('0x66')](_0x507c55[_0x1d90('0x51')])&&fs[_0x1d90('0x53')](_0x1bc592)){logger[_0x1d90('0x68')](_0x1d90('0x69')+_0x1bc592+_0x1d90('0x6c'));fs[_0x1d90('0x6a')](_0x1bc592);}return _0x507c55;})[_0x1d90('0x25')](function(_0x4e31c7){if(!_0x4e31c7)throw new InternalError();return _0x4e31c7['destroy']();})['then'](function(){_0x1da1de[_0x1d90('0x1b')](0xcc)[_0x1d90('0x1c')]();})[_0x1d90('0x46')](handleError(_0x1da1de,null));};function getBucketslist(_0x44f061,_0x564a1b,_0x249e60){return new Promise(function(_0xca8291,_0x282a98){var _0x3b853a=new AWS['S3']({'accessKeyId':_0x564a1b,'secretAccessKey':_0x44f061,'region':_0x249e60});_0x3b853a[_0x1d90('0x6d')]({},function(_0x15d9c7,_0x3117d8){if(_0x15d9c7){return _0x282a98(_0x15d9c7);}else{return _0xca8291(_0x3117d8);}});});}function createBucket(_0x3ebf29,_0x1f6235,_0x15399a,_0x2b5ba2){return new Promise(function(_0x64c81f,_0x45cad8){var _0x4ba3ea=new AWS['S3']({'accessKeyId':_0x1f6235,'secretAccessKey':_0x3ebf29,'region':_0x15399a});_0x4ba3ea['createBucket']({'Bucket':_0x2b5ba2},function(_0x16fb8f,_0xafbf07){if(_0x16fb8f){return _0x45cad8(_0x16fb8f);}else{return _0x64c81f(_0xafbf07);}});});}function uploadFile(_0x5c70e6,_0x318909,_0x153dd9,_0x457c96,_0x4291a6,_0x11784a){return new Promise(function(_0x535550,_0x5419cf){var _0x3d7c4b=new AWS['S3']({'accessKeyId':_0x318909,'secretAccessKey':_0x5c70e6,'region':_0x153dd9});_0x3d7c4b[_0x1d90('0x6e')]({'Bucket':_0x457c96,'Key':_0x4291a6,'Body':_0x11784a},function(_0x12cb56,_0x43c562){if(_0x12cb56){return _0x5419cf(_0x12cb56);}else{return _0x535550(_0x43c562);}});});}function startTranscribe(_0x3540e0,_0x57592f,_0x5b05bf,_0x46fc3b,_0x4aeeb0,_0x524790){return new Promise(function(_0x5dafb6,_0x3ba4f8){var _0x3867ef=new AWS[(_0x1d90('0x6f'))]({'accessKeyId':_0x57592f,'secretAccessKey':_0x3540e0,'region':_0x5b05bf});_0x3867ef[_0x1d90('0x70')]({'TranscriptionJobName':_0x46fc3b,'LanguageCode':_0x4aeeb0,'Media':{'MediaFileUri':_0x524790}},function(_0x9eb21a,_0x1ee378){if(_0x9eb21a){return _0x3ba4f8(_0x9eb21a);}else{return _0x5dafb6(_0x1ee378);}});});}function transcribe(_0x529a4d,_0x28c0f7,_0x5b10e7,_0x5b94ed,_0x2acadc,_0x1719d8,_0x4b8cb3){return new Promise(function(_0x4ce2b9,_0x1d6e9e){var _0x195ef3={};logger[_0x1d90('0x68')](util[_0x1d90('0x32')](_0x1d90('0x71'),_0x529a4d,_0x2acadc));return uploadFile(_0x28c0f7,_0x5b10e7,_0x5b94ed,_0x2acadc,path[_0x1d90('0x72')](_0x1719d8),fs['readFileSync'](_0x1719d8))['then'](function(_0x53b4c0){logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x529a4d,_0x2acadc,_0x53b4c0[_0x1d90('0x73')]));_0x195ef3['bucket']=_0x53b4c0[_0x1d90('0x74')];_0x195ef3[_0x1d90('0x75')]=_0x53b4c0[_0x1d90('0x73')];logger[_0x1d90('0x68')](util[_0x1d90('0x32')](_0x1d90('0x76'),_0x529a4d));return startTranscribe(_0x28c0f7,_0x5b10e7,_0x5b94ed,uuidv4(),_0x4b8cb3,_0x53b4c0[_0x1d90('0x73')]);})[_0x1d90('0x25')](function(_0x4650f3){logger['info'](util[_0x1d90('0x32')](_0x1d90('0x77'),_0x529a4d,_0x4650f3[_0x1d90('0x78')][_0x1d90('0x79')]));_0x195ef3[_0x1d90('0x7a')]=_0x4650f3[_0x1d90('0x78')][_0x1d90('0x79')];_0x195ef3[_0x1d90('0x7b')]=_0x4650f3[_0x1d90('0x78')]['TranscriptionJobStatus'];return _0x4ce2b9(_0x195ef3);})[_0x1d90('0x46')](function(_0x218a56){return _0x1d6e9e(_0x218a56);});});}exports['runTranscribe']=function(_0x31b16c,_0x5ebbe3,_0x1686a5){var _0x48242a;var _0x524c98;var _0x455152;var _0xbb1191=require('../../components/encryptor');return db[_0x1d90('0x2c')][_0x1d90('0x7c')]({'where':{'id':_0x31b16c[_0x1d90('0x48')]['id']}})[_0x1d90('0x25')](function(_0x5c3799){if(_0x5c3799){var _0x5a5569=util[_0x1d90('0x32')](_0x1d90('0x52'),_0x5c3799[_0x1d90('0x51')]);if(fs[_0x1d90('0x53')](_0x5a5569)){cypher=!![];return _0xbb1191[_0x1d90('0x54')](_0x5a5569,_0x5c3799[_0x1d90('0x51')],config[_0x1d90('0x55')][_0x1d90('0x56')])[_0x1d90('0x25')](function(){return _0x5c3799;});}return _0x5c3799;}})['then'](function(_0x23fa47){if(!_0x23fa47){throw new db[(_0x1d90('0x57'))][(_0x1d90('0x58'))](_0x1d90('0x7d'));}_0x524c98=_0x23fa47;return db[_0x1d90('0x7e')][_0x1d90('0x7c')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x5ebbe3,null))[_0x1d90('0x25')](function(_0x394436){if(_0x394436){_0x48242a=_0x394436;if(!_0x48242a['transcribe']||!_0x48242a[_0x1d90('0x7f')]||!_0x48242a[_0x1d90('0x80')]||!_0x48242a[_0x1d90('0x81')]||!_0x48242a[_0x1d90('0x82')]){throw new db[(_0x1d90('0x57'))][(_0x1d90('0x58'))](_0x1d90('0x83'));}if(_0x31b16c[_0x1d90('0x4d')][_0x1d90('0x84')]&&(!_0x48242a[_0x1d90('0x85')]||!_0x48242a[_0x1d90('0x86')]||!_0x48242a[_0x1d90('0x87')]||!_0x48242a[_0x1d90('0x81')]||!_0x48242a[_0x1d90('0x82')])){throw new db[(_0x1d90('0x57'))][(_0x1d90('0x58'))](_0x1d90('0x88'));}return db[_0x1d90('0x89')]['findOne']({'where':{'id':_0x48242a[_0x1d90('0x7f')]}});}})[_0x1d90('0x25')](function(_0x4560e2){if(!_0x4560e2){throw new db['Sequelize'][(_0x1d90('0x58'))](_0x1d90('0x8a'));}if(!_0x4560e2[_0x1d90('0x8b')]||!_0x4560e2[_0x1d90('0x8c')]){throw new db['Sequelize'][(_0x1d90('0x58'))](_0x1d90('0x8d'));}_0x455152=_0x4560e2;return getBucketslist(_0x455152[_0x1d90('0x8b')],_0x455152['data2'],_0x48242a[_0x1d90('0x80')]);})[_0x1d90('0x25')](function(_0x14e0d9){if(_0x14e0d9&&_0x14e0d9[_0x1d90('0x8e')]){var _0x2ce723=_[_0x1d90('0x4b')](_0x14e0d9[_0x1d90('0x8e')],function(_0x54628b){return _0x54628b[_0x1d90('0x8f')]===_0x48242a['bucket'];});if(!_0x2ce723){logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x31b16c['params']['id'],_0x48242a[_0x1d90('0x82')]));return createBucket(_0x455152[_0x1d90('0x8b')],_0x455152[_0x1d90('0x8c')],_0x48242a[_0x1d90('0x80')],_0x48242a[_0x1d90('0x82')]);}logger[_0x1d90('0x68')](util[_0x1d90('0x32')](_0x1d90('0x90'),_0x31b16c[_0x1d90('0x48')]['id'],_0x48242a[_0x1d90('0x82')]));return;}})[_0x1d90('0x25')](function(_0x3449e8){if(_0x524c98[_0x1d90('0x7b')]===_0x1d90('0x91')){return transcribe(_0x31b16c[_0x1d90('0x48')]['id'],_0x455152[_0x1d90('0x8b')],_0x455152[_0x1d90('0x8c')],_0x48242a[_0x1d90('0x80')],_0x48242a[_0x1d90('0x82')],_0x524c98[_0x1d90('0x51')],_0x48242a[_0x1d90('0x81')]);}else{logger[_0x1d90('0x68')](util['format'](_0x1d90('0x92'),_0x31b16c['params']['id']));return{'transcribeStatus':_0x1d90('0x93')};}})[_0x1d90('0x25')](function(_0xb8ef78){if(_0xb8ef78){_0xb8ef78[_0x1d90('0x94')]=_0x31b16c[_0x1d90('0x4d')][_0x1d90('0x84')];return _0x524c98[_0x1d90('0x95')](_0xb8ef78);}})['then'](respondWithResult(_0x5ebbe3,null))['catch'](handleError(_0x5ebbe3,null));};function writeFile(_0x4c1163,_0xb1a27f){return new Promise(function(_0xa14e49,_0x2b5bf5){fs[_0x1d90('0x96')](_0xb1a27f,_0x4c1163,function(_0x576a9a,_0x403e0b){if(_0x576a9a){return _0x2b5bf5(_0x576a9a);}else{return _0xa14e49(_0x403e0b);}});});}exports[_0x1d90('0x97')]=function(_0x156752,_0x247e5c,_0xeaed9e){return db[_0x1d90('0x2c')][_0x1d90('0x7c')]({'where':{'id':_0x156752['params']['id']}})['then'](handleEntityNotFound(_0x247e5c))[_0x1d90('0x25')](function(_0xf74a21){if(_0xf74a21&&_0xf74a21[_0x1d90('0x98')]){var _0x52ec2e=_0xf74a21[_0x1d90('0x98')];var _0x44b2a8=config[_0x1d90('0x99')]+'/server/files/transcribes/transcribe_'+_0xf74a21['id']+'.txt';if(fs[_0x1d90('0x53')](_0x44b2a8)){return _0x44b2a8;}return writeFile(_0x52ec2e,_0x44b2a8)[_0x1d90('0x25')](function(){return _0x44b2a8;});}else{throw new db[(_0x1d90('0x57'))]['ValidationError'](_0x1d90('0x9a'));}})[_0x1d90('0x25')](function(_0x57ebef){return _0x247e5c[_0x1d90('0x65')](_0x57ebef);})[_0x1d90('0x46')](handleError(_0x247e5c));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 64bd729..19ca798 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 _0x65ec=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','define','voice_recordings','uniqueid'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x65ec,0x16c));var _0xc65e=function(_0x17cd23,_0x2a4b1a){_0x17cd23=_0x17cd23-0x0;var _0x204df4=_0x65ec[_0x17cd23];return _0x204df4;};'use strict';var _=require(_0xc65e('0x0'));var util=require(_0xc65e('0x1'));var logger=require(_0xc65e('0x2'))('api');var moment=require(_0xc65e('0x3'));var BPromise=require('bluebird');var rp=require(_0xc65e('0x4'));var fs=require('fs');var path=require(_0xc65e('0x5'));var rimraf=require(_0xc65e('0x6'));var config=require(_0xc65e('0x7'));var attributes=require(_0xc65e('0x8'));module[_0xc65e('0x9')]=function(_0x1e8206,_0x1bade7){return _0x1e8206[_0xc65e('0xa')]('VoiceRecording',attributes,{'tableName':_0xc65e('0xb'),'paranoid':![],'indexes':[{'name':_0xc65e('0xc'),'fields':[_0xc65e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1328=['util','api','moment','bluebird','request-promise','path','rimraf','./voiceRecording.attributes','voice_recordings','uniqueid','lodash'];(function(_0xf570fd,_0x594831){var _0x590560=function(_0x3b08a5){while(--_0x3b08a5){_0xf570fd['push'](_0xf570fd['shift']());}};_0x590560(++_0x594831);}(_0x1328,0x11d));var _0x8132=function(_0x3da832,_0x2133f1){_0x3da832=_0x3da832-0x0;var _0xe602f2=_0x1328[_0x3da832];return _0xe602f2;};'use strict';var _=require(_0x8132('0x0'));var util=require(_0x8132('0x1'));var logger=require('../../config/logger')(_0x8132('0x2'));var moment=require(_0x8132('0x3'));var BPromise=require(_0x8132('0x4'));var rp=require(_0x8132('0x5'));var fs=require('fs');var path=require(_0x8132('0x6'));var rimraf=require(_0x8132('0x7'));var config=require('../../config/environment');var attributes=require(_0x8132('0x8'));module['exports']=function(_0x5e24c3,_0x252528){return _0x5e24c3['define']('VoiceRecording',attributes,{'tableName':_0x8132('0x9'),'paranoid':![],'indexes':[{'name':_0x8132('0xa'),'fields':[_0x8132('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index e6f6f98..9e8091d 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 _0xe5af=['util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','raw','options','where','limit','debug','../../components/encryptor','Setting','create','existsSync','%s.cypher','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xe5af,0x9c));var _0xfe5a=function(_0x3f7929,_0x5db3e1){_0x3f7929=_0x3f7929-0x0;var _0x4df0e5=_0xe5af[_0x3f7929];return _0x4df0e5;};'use strict';var _=require('lodash');var util=require(_0xfe5a('0x0'));var moment=require(_0xfe5a('0x1'));var BPromise=require('bluebird');var rs=require(_0xfe5a('0x2'));var fs=require('fs');var Redis=require(_0xfe5a('0x3'));var db=require(_0xfe5a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe5a('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfe5a('0x6'));var client=jayson[_0xfe5a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5eea2e,_0x356c69,_0x106492){return new BPromise(function(_0xfb4357,_0x3e683c){return client['request'](_0x5eea2e,_0x106492)[_0xfe5a('0x8')](function(_0x5a48ff){logger['info'](_0xfe5a('0x9'),_0x356c69,_0xfe5a('0xa'));logger['debug'](_0xfe5a('0xb'),_0x356c69,_0xfe5a('0xa'),JSON[_0xfe5a('0xc')](_0x5a48ff));if(_0x5a48ff[_0xfe5a('0xd')]){if(_0x5a48ff[_0xfe5a('0xd')]['code']===0x1f4){logger[_0xfe5a('0xd')](_0xfe5a('0x9'),_0x356c69,_0x5a48ff[_0xfe5a('0xd')][_0xfe5a('0xe')]);return _0x3e683c(_0x5a48ff[_0xfe5a('0xd')]['message']);}logger[_0xfe5a('0xd')](_0xfe5a('0x9'),_0x356c69,_0x5a48ff[_0xfe5a('0xd')][_0xfe5a('0xe')]);return _0xfb4357(_0x5a48ff[_0xfe5a('0xd')][_0xfe5a('0xe')]);}else{logger[_0xfe5a('0xf')](_0xfe5a('0x9'),_0x356c69,_0xfe5a('0xa'));_0xfb4357(_0x5a48ff[_0xfe5a('0x10')][_0xfe5a('0xe')]);}})[_0xfe5a('0x11')](function(_0x22afa7){logger[_0xfe5a('0xd')](_0xfe5a('0x9'),_0x356c69,_0x22afa7);_0x3e683c(_0x22afa7);});});}exports[_0xfe5a('0x12')]=function(_0x5bf597){var _0x20620b=this;return new Promise(function(_0x456707,_0x54d5fb){return db[_0xfe5a('0x13')][_0xfe5a('0x14')](_0x5bf597[_0xfe5a('0x15')],{'raw':_0x5bf597['options']?_0x5bf597['options'][_0xfe5a('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5bf597[_0xfe5a('0x17')]?_0x5bf597[_0xfe5a('0x17')][_0xfe5a('0x18')]||null:null,'attributes':_0x5bf597[_0xfe5a('0x17')]?_0x5bf597[_0xfe5a('0x17')]['attributes']||null:null,'limit':_0x5bf597[_0xfe5a('0x17')]?_0x5bf597['options'][_0xfe5a('0x19')]||null:null})[_0xfe5a('0x8')](function(_0x1fbde5){logger['info']('UpdateVoiceRecording',_0x5bf597);logger[_0xfe5a('0x1a')](_0xfe5a('0x12'),_0x5bf597,JSON['stringify'](_0x1fbde5));_0x456707(_0x1fbde5);})[_0xfe5a('0x11')](function(_0x26f744){logger['error'](_0xfe5a('0x12'),_0x26f744[_0xfe5a('0xe')],_0x5bf597);_0x54d5fb(_0x20620b[_0xfe5a('0xd')](0x1f4,_0x26f744[_0xfe5a('0xe')]));});});};exports['CreateVoiceRecording']=function(_0x42136e){var _0x2f5d04=this;return new Promise(function(_0x24481f,_0x1cd531){var _0x36bf20=require(_0xfe5a('0x1b'));var _0xdbf1e0;return db[_0xfe5a('0x1c')]['findOne']({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0xfe5a('0x8')](function(_0x485f9d){_0xdbf1e0=_0x485f9d;return db[_0xfe5a('0x13')][_0xfe5a('0x1d')](_0x42136e[_0xfe5a('0x15')]);})['then'](function(_0x48a061){if(_0xdbf1e0['callRecordingEncryption']&&fs[_0xfe5a('0x1e')](_0x48a061['value'])){var _0x51d1f4=util['format'](_0xfe5a('0x1f'),_0x48a061[_0xfe5a('0x20')]);return _0x36bf20[_0xfe5a('0x21')](_0x48a061[_0xfe5a('0x20')],_0x51d1f4,config[_0xfe5a('0x22')][_0xfe5a('0x23')])[_0xfe5a('0x8')](function(){fs[_0xfe5a('0x24')](_0x48a061[_0xfe5a('0x20')]);logger[_0xfe5a('0xf')](_0xfe5a('0x25'));return _0x48a061;});}return _0x48a061;})['then'](function(_0x1f0c86){logger[_0xfe5a('0xf')]('CreateVoiceRecording',_0x42136e);logger[_0xfe5a('0x1a')](_0xfe5a('0x26'),_0x42136e,JSON[_0xfe5a('0xc')](_0x1f0c86));_0x24481f(_0x1f0c86);})[_0xfe5a('0x11')](function(_0xe5a992){logger['error']('CreateVoiceRecording',_0xe5a992[_0xfe5a('0xe')],_0x42136e);_0x1cd531(_0x2f5d04['error'](0x1f4,_0xe5a992[_0xfe5a('0xe')]));});});}; \ No newline at end of file +var _0xbbbc=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','request\x20sent','error','message','result','catch','UpdateVoiceRecording','update','body','options','raw','where','limit','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','VoiceRecording','create','existsSync','value','format','%s.cypher','secrets','CreateVoiceRecording\x20file\x20encrypted','stringify'];(function(_0x1fc2ce,_0x2eeaf9){var _0x4eae69=function(_0xb3de9c){while(--_0xb3de9c){_0x1fc2ce['push'](_0x1fc2ce['shift']());}};_0x4eae69(++_0x2eeaf9);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x44c892,_0x1dbcb5){_0x44c892=_0x44c892-0x0;var _0x349aaf=_0xbbbc[_0x44c892];return _0x349aaf;};'use strict';var _=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var moment=require(_0xcbbb('0x2'));var BPromise=require(_0xcbbb('0x3'));var rs=require(_0xcbbb('0x4'));var fs=require('fs');var Redis=require(_0xcbbb('0x5'));var db=require(_0xcbbb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbbb('0x7'))(_0xcbbb('0x8'));var config=require(_0xcbbb('0x9'));var jayson=require(_0xcbbb('0xa'));var client=jayson[_0xcbbb('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x388197,_0x1796b4,_0x32ec9c){return new BPromise(function(_0x6f4fd8,_0x356249){return client[_0xcbbb('0xc')](_0x388197,_0x32ec9c)[_0xcbbb('0xd')](function(_0x4ec90a){logger[_0xcbbb('0xe')]('VoiceRecording,\x20%s,\x20%s',_0x1796b4,'request\x20sent');logger[_0xcbbb('0xf')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'),JSON['stringify'](_0x4ec90a));if(_0x4ec90a[_0xcbbb('0x11')]){if(_0x4ec90a[_0xcbbb('0x11')]['code']===0x1f4){logger[_0xcbbb('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')]['message']);return _0x356249(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}logger[_0xcbbb('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);return _0x6f4fd8(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}else{logger['info']('VoiceRecording,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'));_0x6f4fd8(_0x4ec90a[_0xcbbb('0x13')][_0xcbbb('0x12')]);}})[_0xcbbb('0x14')](function(_0x5e25ca){logger[_0xcbbb('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x1796b4,_0x5e25ca);_0x356249(_0x5e25ca);});});}exports[_0xcbbb('0x15')]=function(_0x3436af){var _0x3572bb=this;return new Promise(function(_0x5052df,_0x57c5e9){return db['VoiceRecording'][_0xcbbb('0x16')](_0x3436af[_0xcbbb('0x17')],{'raw':_0x3436af[_0xcbbb('0x18')]?_0x3436af[_0xcbbb('0x18')][_0xcbbb('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3436af[_0xcbbb('0x18')]?_0x3436af[_0xcbbb('0x18')][_0xcbbb('0x1a')]||null:null,'attributes':_0x3436af[_0xcbbb('0x18')]?_0x3436af[_0xcbbb('0x18')]['attributes']||null:null,'limit':_0x3436af[_0xcbbb('0x18')]?_0x3436af[_0xcbbb('0x18')][_0xcbbb('0x1b')]||null:null})[_0xcbbb('0xd')](function(_0x258d1f){logger[_0xcbbb('0xe')](_0xcbbb('0x15'),_0x3436af);logger[_0xcbbb('0xf')](_0xcbbb('0x15'),_0x3436af,JSON['stringify'](_0x258d1f));_0x5052df(_0x258d1f);})[_0xcbbb('0x14')](function(_0x4490c1){logger['error'](_0xcbbb('0x15'),_0x4490c1['message'],_0x3436af);_0x57c5e9(_0x3572bb['error'](0x1f4,_0x4490c1[_0xcbbb('0x12')]));});});};exports[_0xcbbb('0x1c')]=function(_0x548440){var _0x59c422=this;return new Promise(function(_0x5499a1,_0x4439ea){var _0x55e1d8=require('../../components/encryptor');var _0x21e3b1;return db[_0xcbbb('0x1d')][_0xcbbb('0x1e')]({'attributes':['id',_0xcbbb('0x1f')],'where':{'id':0x1},'raw':!![]})[_0xcbbb('0xd')](function(_0x39ba8b){_0x21e3b1=_0x39ba8b;return db[_0xcbbb('0x20')][_0xcbbb('0x21')](_0x548440[_0xcbbb('0x17')]);})[_0xcbbb('0xd')](function(_0x1c2ac9){if(_0x21e3b1[_0xcbbb('0x1f')]&&fs[_0xcbbb('0x22')](_0x1c2ac9[_0xcbbb('0x23')])){var _0x2a9639=util[_0xcbbb('0x24')](_0xcbbb('0x25'),_0x1c2ac9[_0xcbbb('0x23')]);return _0x55e1d8['encryptFile'](_0x1c2ac9[_0xcbbb('0x23')],_0x2a9639,config[_0xcbbb('0x26')]['recording'])[_0xcbbb('0xd')](function(){fs['unlink'](_0x1c2ac9[_0xcbbb('0x23')]);logger[_0xcbbb('0xe')](_0xcbbb('0x27'));return _0x1c2ac9;});}return _0x1c2ac9;})['then'](function(_0x38ee99){logger[_0xcbbb('0xe')](_0xcbbb('0x1c'),_0x548440);logger[_0xcbbb('0xf')](_0xcbbb('0x1c'),_0x548440,JSON[_0xcbbb('0x28')](_0x38ee99));_0x5499a1(_0x38ee99);})[_0xcbbb('0x14')](function(_0x1ac1a2){logger[_0xcbbb('0x11')](_0xcbbb('0x1c'),_0x1ac1a2['message'],_0x548440);_0x4439ea(_0x59c422['error'](0x1f4,_0x1ac1a2['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index a98fb18..e648434 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 _0x509c=['../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x3a1ea5,_0x349f01){var _0xfac9b2=function(_0xd5310c){while(--_0xd5310c){_0x3a1ea5['push'](_0x3a1ea5['shift']());}};_0xfac9b2(++_0x349f01);}(_0x509c,0x16f));var _0xc509=function(_0x18f9e1,_0x2763b3){_0x18f9e1=_0x18f9e1-0x0;var _0x61a32d=_0x509c[_0x18f9e1];return _0x61a32d;};'use strict';var multer=require(_0xc509('0x0'));var util=require(_0xc509('0x1'));var path=require(_0xc509('0x2'));var timeout=require(_0xc509('0x3'));var express=require(_0xc509('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc509('0x5'));var interaction=require(_0xc509('0x6'));var config=require(_0xc509('0x7'));var controller=require(_0xc509('0x8'));router[_0xc509('0x9')]('/',auth[_0xc509('0xa')](),controller['index']);router['get'](_0xc509('0xb'),auth[_0xc509('0xa')](),controller[_0xc509('0xc')]);router[_0xc509('0x9')](_0xc509('0xd'),auth[_0xc509('0xa')](),controller[_0xc509('0xe')]);router[_0xc509('0xf')]('/',auth[_0xc509('0xa')](),controller[_0xc509('0x10')]);router[_0xc509('0x11')](_0xc509('0xd'),auth[_0xc509('0xa')](),controller[_0xc509('0x12')]);router[_0xc509('0x13')](_0xc509('0xd'),auth[_0xc509('0xa')](),controller[_0xc509('0x14')]);module[_0xc509('0x15')]=router; \ No newline at end of file +var _0x638d=['delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','post','update'];(function(_0x3c2c2b,_0x34ff09){var _0x5bb2dc=function(_0x2c7852){while(--_0x2c7852){_0x3c2c2b['push'](_0x3c2c2b['shift']());}};_0x5bb2dc(++_0x34ff09);}(_0x638d,0x1b2));var _0xd638=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x638d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd638('0x0'));var util=require(_0xd638('0x1'));var path=require(_0xd638('0x2'));var timeout=require('connect-timeout');var express=require(_0xd638('0x3'));var router=express[_0xd638('0x4')]();var fs_extra=require(_0xd638('0x5'));var auth=require(_0xd638('0x6'));var interaction=require(_0xd638('0x7'));var config=require(_0xd638('0x8'));var controller=require('./voiceTransferReport.controller');router[_0xd638('0x9')]('/',auth[_0xd638('0xa')](),controller['index']);router[_0xd638('0x9')]('/describe',auth[_0xd638('0xa')](),controller[_0xd638('0xb')]);router[_0xd638('0x9')](_0xd638('0xc'),auth[_0xd638('0xa')](),controller[_0xd638('0xd')]);router[_0xd638('0xe')]('/',auth[_0xd638('0xa')](),controller['create']);router['put'](_0xd638('0xc'),auth[_0xd638('0xa')](),controller[_0xd638('0xf')]);router[_0xd638('0x10')](_0xd638('0xc'),auth[_0xd638('0xa')](),controller['destroy']);module[_0xd638('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 248c15d..ff4affb 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 _0x578c=['ENUM','blind','STRING','Yes','exports'];(function(_0x3bcaec,_0x2c4e2c){var _0x1b068c=function(_0x36046a){while(--_0x36046a){_0x3bcaec['push'](_0x3bcaec['shift']());}};_0x1b068c(++_0x2c4e2c);}(_0x578c,0x17b));var _0xc578=function(_0x4baa55,_0x250d3c){_0x4baa55=_0x4baa55-0x0;var _0x1cfc4c=_0x578c[_0x4baa55];return _0x1cfc4c;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xc578('0x0')]={'type':{'type':Sequelize[_0xc578('0x1')](_0xc578('0x2'),'attended')},'result':{'type':Sequelize[_0xc578('0x3')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0xc578('0x3')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0xc578('0x3')]},'transferercontext':{'type':Sequelize[_0xc578('0x3')]},'transfererexten':{'type':Sequelize[_0xc578('0x3')]},'transfererlinkedid':{'type':Sequelize[_0xc578('0x3')]},'transfereechannel':{'type':Sequelize[_0xc578('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0xc578('0x3')]},'transfereecalleridname':{'type':Sequelize[_0xc578('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xc578('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0xc578('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0xc578('0x3')]},'transfereecontext':{'type':Sequelize[_0xc578('0x3')]},'transfereeexten':{'type':Sequelize[_0xc578('0x3')]},'transfereelinkedid':{'type':Sequelize[_0xc578('0x3')]},'isexternal':{'type':Sequelize['ENUM'](_0xc578('0x4'),'No')},'context':{'type':Sequelize[_0xc578('0x3')]},'extension':{'type':Sequelize[_0xc578('0x3')]}}; \ No newline at end of file +var _0x3477=['moment','exports','ENUM','blind','STRING','Yes','sequelize'];(function(_0xb1b616,_0x3b9023){var _0x1259b0=function(_0xb2e638){while(--_0xb2e638){_0xb1b616['push'](_0xb1b616['shift']());}};_0x1259b0(++_0x3b9023);}(_0x3477,0x156));var _0x7347=function(_0x5ee6c4,_0x3dee66){_0x5ee6c4=_0x5ee6c4-0x0;var _0x4739fe=_0x3477[_0x5ee6c4];return _0x4739fe;};'use strict';var Sequelize=require(_0x7347('0x0'));var moment=require(_0x7347('0x1'));module[_0x7347('0x2')]={'type':{'type':Sequelize[_0x7347('0x3')](_0x7347('0x4'),'attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x7347('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x7347('0x5')]},'transferercalleridname':{'type':Sequelize[_0x7347('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x7347('0x5')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x7347('0x5')]},'transferercontext':{'type':Sequelize[_0x7347('0x5')]},'transfererexten':{'type':Sequelize[_0x7347('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x7347('0x5')]},'transfereechannel':{'type':Sequelize[_0x7347('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x7347('0x5')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x7347('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x7347('0x5')]},'transfereecontext':{'type':Sequelize[_0x7347('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x7347('0x5')]},'isexternal':{'type':Sequelize[_0x7347('0x3')](_0x7347('0x6'),'No')},'context':{'type':Sequelize[_0x7347('0x5')]},'extension':{'type':Sequelize[_0x7347('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 619b18d..75c6e37 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 _0x16f1=['find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','set','reject','destroy','then','end','sendStatus','error','name','send','map','VoiceTransferReport','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','rawAttributes','include'];(function(_0xc7348b,_0x145880){var _0x307cec=function(_0x4f1554){while(--_0x4f1554){_0xc7348b['push'](_0xc7348b['shift']());}};_0x307cec(++_0x145880);}(_0x16f1,0x99));var _0x116f=function(_0x34dccd,_0x45a1b1){_0x34dccd=_0x34dccd-0x0;var _0x5aea54=_0x16f1[_0x34dccd];return _0x5aea54;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x116f('0x0'));var zipdir=require(_0x116f('0x1'));var jsonpatch=require(_0x116f('0x2'));var rp=require(_0x116f('0x3'));var moment=require('moment');var BPromise=require(_0x116f('0x4'));var Mustache=require(_0x116f('0x5'));var util=require(_0x116f('0x6'));var path=require(_0x116f('0x7'));var sox=require('sox');var csv=require(_0x116f('0x8'));var ejs=require(_0x116f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x116f('0xa'));var squel=require(_0x116f('0xb'));var crypto=require(_0x116f('0xc'));var jsforce=require(_0x116f('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x116f('0xe'));var Papa=require(_0x116f('0xf'));var Redis=require('ioredis');var authService=require(_0x116f('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x116f('0x11'));var logger=require(_0x116f('0x12'))(_0x116f('0x13'));var utils=require(_0x116f('0x14'));var config=require(_0x116f('0x15'));var licenseUtil=require(_0x116f('0x16'));var db=require(_0x116f('0x17'))['db'];function respondWithStatusCode(_0x788594,_0x41a595){_0x41a595=_0x41a595||0xcc;return function(_0x5d77fe){if(_0x5d77fe){return _0x788594['sendStatus'](_0x41a595);}return _0x788594[_0x116f('0x18')](_0x41a595)['end']();};}function respondWithResult(_0x3ac0bd,_0x3308e4){_0x3308e4=_0x3308e4||0xc8;return function(_0x2d9dc8){if(_0x2d9dc8){return _0x3ac0bd[_0x116f('0x18')](_0x3308e4)[_0x116f('0x19')](_0x2d9dc8);}};}function respondWithFilteredResult(_0x5b7481,_0x2175d9){return function(_0x193bc8){if(_0x193bc8){var _0x55d01a=typeof _0x2175d9[_0x116f('0x1a')]===_0x116f('0x1b')&&typeof _0x2175d9[_0x116f('0x1c')]==='undefined';var _0x4bd20f=_0x193bc8['count'];var _0x50f3f0=_0x55d01a?0x0:_0x2175d9['offset'];var _0x2e1973=_0x55d01a?_0x193bc8['count']:_0x2175d9[_0x116f('0x1a')]+_0x2175d9[_0x116f('0x1c')];var _0x5e6949;if(_0x2e1973>=_0x4bd20f){_0x2e1973=_0x4bd20f;_0x5e6949=0xc8;}else{_0x5e6949=0xce;}_0x5b7481[_0x116f('0x18')](_0x5e6949);return _0x5b7481[_0x116f('0x1d')]('Content-Range',_0x50f3f0+'-'+_0x2e1973+'/'+_0x4bd20f)[_0x116f('0x19')](_0x193bc8);}return null;};}function patchUpdates(_0x23355a){return function(_0x391f4e){try{jsonpatch['apply'](_0x391f4e,_0x23355a,!![]);}catch(_0x1aad03){return BPromise[_0x116f('0x1e')](_0x1aad03);}return _0x391f4e['save']();};}function saveUpdates(_0x1da8b2,_0x13a5ed){return function(_0x1d8830){if(_0x1d8830){return _0x1d8830['update'](_0x1da8b2)['then'](function(_0x46a2a4){return _0x46a2a4;});}return null;};}function removeEntity(_0x1f660,_0x4d607c){return function(_0x545c72){if(_0x545c72){return _0x545c72[_0x116f('0x1f')]()[_0x116f('0x20')](function(){_0x1f660[_0x116f('0x18')](0xcc)[_0x116f('0x21')]();});}};}function handleEntityNotFound(_0x514db5,_0x587acd){return function(_0x179307){if(!_0x179307){_0x514db5[_0x116f('0x22')](0x194);}return _0x179307;};}function handleError(_0x382dc3,_0x29536f){_0x29536f=_0x29536f||0x1f4;return function(_0x531f6f){logger[_0x116f('0x23')](_0x531f6f['stack']);if(_0x531f6f['name']){delete _0x531f6f[_0x116f('0x24')];}_0x382dc3['status'](_0x29536f)[_0x116f('0x25')](_0x531f6f);};}exports['index']=function(_0x480056,_0x52d983){var _0x3ba033={},_0x58992d={},_0x3d97a6={'count':0x0,'rows':[]};var _0x3b1bc7=_[_0x116f('0x26')](db[_0x116f('0x27')]['rawAttributes'],function(_0x36345d){return{'name':_0x36345d[_0x116f('0x28')],'type':_0x36345d['type'][_0x116f('0x29')]};});_0x58992d[_0x116f('0x2a')]=_[_0x116f('0x26')](_0x3b1bc7,_0x116f('0x24'));_0x58992d[_0x116f('0x2b')]=_[_0x116f('0x2c')](_0x480056['query']);_0x58992d['filters']=_['intersection'](_0x58992d['model'],_0x58992d[_0x116f('0x2b')]);_0x3ba033[_0x116f('0x2d')]=_[_0x116f('0x2e')](_0x58992d['model'],qs[_0x116f('0x2f')](_0x480056['query']['fields']));_0x3ba033['attributes']=_0x3ba033[_0x116f('0x2d')][_0x116f('0x30')]?_0x3ba033[_0x116f('0x2d')]:_0x58992d[_0x116f('0x2a')];if(!_0x480056[_0x116f('0x2b')][_0x116f('0x31')](_0x116f('0x32'))){_0x3ba033['limit']=qs[_0x116f('0x1c')](_0x480056[_0x116f('0x2b')][_0x116f('0x1c')]);_0x3ba033[_0x116f('0x1a')]=qs['offset'](_0x480056[_0x116f('0x2b')]['offset']);}_0x3ba033[_0x116f('0x33')]=qs[_0x116f('0x34')](_0x480056[_0x116f('0x2b')][_0x116f('0x34')]);_0x3ba033[_0x116f('0x35')]=qs[_0x116f('0x36')](_[_0x116f('0x37')](_0x480056[_0x116f('0x2b')],_0x58992d[_0x116f('0x36')]),_0x3b1bc7);if(_0x480056[_0x116f('0x2b')][_0x116f('0x38')]){_0x3ba033[_0x116f('0x35')]=_[_0x116f('0x39')](_0x3ba033[_0x116f('0x35')],{'$or':_[_0x116f('0x26')](_0x3b1bc7,function(_0x12e1c2){if(_0x12e1c2['type']!==_0x116f('0x3a')){var _0x231717={};_0x231717[_0x12e1c2[_0x116f('0x24')]]={'$like':'%'+_0x480056['query'][_0x116f('0x38')]+'%'};return _0x231717;}})});}_0x3ba033=_['merge']({},_0x3ba033,_0x480056[_0x116f('0x3b')]);var _0x9fca77={'where':_0x3ba033['where']};return db[_0x116f('0x27')]['count'](_0x9fca77)[_0x116f('0x20')](function(_0x4fba97){_0x3d97a6[_0x116f('0x3c')]=_0x4fba97;if(_0x480056[_0x116f('0x2b')][_0x116f('0x3d')]){_0x3ba033['include']=[{'all':!![]}];}return db['VoiceTransferReport'][_0x116f('0x3e')](_0x3ba033);})[_0x116f('0x20')](function(_0xeded0a){_0x3d97a6[_0x116f('0x3f')]=_0xeded0a;return _0x3d97a6;})[_0x116f('0x20')](respondWithFilteredResult(_0x52d983,_0x3ba033))[_0x116f('0x40')](handleError(_0x52d983,null));};exports[_0x116f('0x41')]=function(_0x49f875,_0xe7ff52){var _0x24e2c3={'raw':!![],'where':{'id':_0x49f875[_0x116f('0x42')]['id']}},_0x3ad6a8={};_0x3ad6a8['model']=_[_0x116f('0x2c')](db[_0x116f('0x27')][_0x116f('0x43')]);_0x3ad6a8[_0x116f('0x2b')]=_[_0x116f('0x2c')](_0x49f875[_0x116f('0x2b')]);_0x3ad6a8['filters']=_[_0x116f('0x2e')](_0x3ad6a8[_0x116f('0x2a')],_0x3ad6a8['query']);_0x24e2c3[_0x116f('0x2d')]=_['intersection'](_0x3ad6a8['model'],qs[_0x116f('0x2f')](_0x49f875[_0x116f('0x2b')][_0x116f('0x2f')]));_0x24e2c3[_0x116f('0x2d')]=_0x24e2c3[_0x116f('0x2d')][_0x116f('0x30')]?_0x24e2c3['attributes']:_0x3ad6a8[_0x116f('0x2a')];if(_0x49f875[_0x116f('0x2b')]['includeAll']){_0x24e2c3[_0x116f('0x44')]=[{'all':!![]}];}_0x24e2c3=_[_0x116f('0x39')]({},_0x24e2c3,_0x49f875[_0x116f('0x3b')]);return db[_0x116f('0x27')][_0x116f('0x45')](_0x24e2c3)[_0x116f('0x20')](handleEntityNotFound(_0xe7ff52,null))['then'](respondWithResult(_0xe7ff52,null))[_0x116f('0x40')](handleError(_0xe7ff52,null));};exports[_0x116f('0x46')]=function(_0x4aa888,_0x2f2227){return db[_0x116f('0x27')][_0x116f('0x46')](_0x4aa888[_0x116f('0x47')],{})['then'](respondWithResult(_0x2f2227,0xc9))[_0x116f('0x40')](handleError(_0x2f2227,null));};exports[_0x116f('0x48')]=function(_0x17b961,_0x2b26a9){if(_0x17b961['body']['id']){delete _0x17b961[_0x116f('0x47')]['id'];}return db[_0x116f('0x27')]['find']({'where':{'id':_0x17b961[_0x116f('0x42')]['id']}})[_0x116f('0x20')](handleEntityNotFound(_0x2b26a9,null))[_0x116f('0x20')](saveUpdates(_0x17b961[_0x116f('0x47')],null))[_0x116f('0x20')](respondWithResult(_0x2b26a9,null))['catch'](handleError(_0x2b26a9,null));};exports[_0x116f('0x1f')]=function(_0x33d95f,_0x954d7c){return db[_0x116f('0x27')]['find']({'where':{'id':_0x33d95f[_0x116f('0x42')]['id']}})[_0x116f('0x20')](handleEntityNotFound(_0x954d7c,null))[_0x116f('0x20')](removeEntity(_0x954d7c,null))['catch'](handleError(_0x954d7c,null));};exports[_0x116f('0x49')]=function(_0x500347,_0x1bed9a){return db[_0x116f('0x27')][_0x116f('0x49')]()[_0x116f('0x20')](respondWithResult(_0x1bed9a,null))['catch'](handleError(_0x1bed9a,null));}; \ No newline at end of file +var _0xc844=['create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','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','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','end','error','name','send','index','map','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','keys','VoiceTransferReport','length','options','find'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc844,0x134));var _0x4c84=function(_0x4414b2,_0x3eb028){_0x4414b2=_0x4414b2-0x0;var _0x450bc3=_0xc844[_0x4414b2];return _0x450bc3;};'use strict';var emlformat=require(_0x4c84('0x0'));var rimraf=require(_0x4c84('0x1'));var zipdir=require(_0x4c84('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c84('0x3'));var moment=require('moment');var BPromise=require(_0x4c84('0x4'));var Mustache=require(_0x4c84('0x5'));var util=require(_0x4c84('0x6'));var path=require(_0x4c84('0x7'));var sox=require(_0x4c84('0x8'));var csv=require(_0x4c84('0x9'));var ejs=require(_0x4c84('0xa'));var fs=require('fs');var fs_extra=require(_0x4c84('0xb'));var _=require(_0x4c84('0xc'));var squel=require('squel');var crypto=require(_0x4c84('0xd'));var jsforce=require(_0x4c84('0xe'));var deskjs=require(_0x4c84('0xf'));var toCsv=require(_0x4c84('0x9'));var querystring=require(_0x4c84('0x10'));var Papa=require(_0x4c84('0x11'));var Redis=require('ioredis');var authService=require(_0x4c84('0x12'));var qs=require(_0x4c84('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4c84('0x14'));var logger=require('../../config/logger')(_0x4c84('0x15'));var utils=require(_0x4c84('0x16'));var config=require(_0x4c84('0x17'));var licenseUtil=require(_0x4c84('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d9113,_0x3bb905){_0x3bb905=_0x3bb905||0xcc;return function(_0x4d4170){if(_0x4d4170){return _0x3d9113[_0x4c84('0x19')](_0x3bb905);}return _0x3d9113[_0x4c84('0x1a')](_0x3bb905)['end']();};}function respondWithResult(_0x52b851,_0x29b2f1){_0x29b2f1=_0x29b2f1||0xc8;return function(_0x1d94b2){if(_0x1d94b2){return _0x52b851[_0x4c84('0x1a')](_0x29b2f1)[_0x4c84('0x1b')](_0x1d94b2);}};}function respondWithFilteredResult(_0x5dd2aa,_0x319344){return function(_0x4f442a){if(_0x4f442a){var _0x5d6622=typeof _0x319344[_0x4c84('0x1c')]===_0x4c84('0x1d')&&typeof _0x319344[_0x4c84('0x1e')]==='undefined';var _0x3fd7f8=_0x4f442a[_0x4c84('0x1f')];var _0x569b8c=_0x5d6622?0x0:_0x319344['offset'];var _0xd740fd=_0x5d6622?_0x4f442a['count']:_0x319344[_0x4c84('0x1c')]+_0x319344[_0x4c84('0x1e')];var _0x37d3d6;if(_0xd740fd>=_0x3fd7f8){_0xd740fd=_0x3fd7f8;_0x37d3d6=0xc8;}else{_0x37d3d6=0xce;}_0x5dd2aa['status'](_0x37d3d6);return _0x5dd2aa['set'](_0x4c84('0x20'),_0x569b8c+'-'+_0xd740fd+'/'+_0x3fd7f8)['json'](_0x4f442a);}return null;};}function patchUpdates(_0x5c79ba){return function(_0x5ed657){try{jsonpatch[_0x4c84('0x21')](_0x5ed657,_0x5c79ba,!![]);}catch(_0x118222){return BPromise[_0x4c84('0x22')](_0x118222);}return _0x5ed657['save']();};}function saveUpdates(_0x2749e4,_0x3ed6be){return function(_0x2e6add){if(_0x2e6add){return _0x2e6add[_0x4c84('0x23')](_0x2749e4)[_0x4c84('0x24')](function(_0x4e61d9){return _0x4e61d9;});}return null;};}function removeEntity(_0x4cc3ac,_0x95d43d){return function(_0x207c6e){if(_0x207c6e){return _0x207c6e[_0x4c84('0x25')]()[_0x4c84('0x24')](function(){_0x4cc3ac[_0x4c84('0x1a')](0xcc)[_0x4c84('0x26')]();});}};}function handleEntityNotFound(_0x5cae3d,_0x4b1e9e){return function(_0x2b04e4){if(!_0x2b04e4){_0x5cae3d['sendStatus'](0x194);}return _0x2b04e4;};}function handleError(_0x583bcf,_0x1eccd7){_0x1eccd7=_0x1eccd7||0x1f4;return function(_0x33b290){logger[_0x4c84('0x27')](_0x33b290['stack']);if(_0x33b290[_0x4c84('0x28')]){delete _0x33b290[_0x4c84('0x28')];}_0x583bcf[_0x4c84('0x1a')](_0x1eccd7)[_0x4c84('0x29')](_0x33b290);};}exports[_0x4c84('0x2a')]=function(_0xb39743,_0x3bd676){var _0x39eb18={},_0x6860f5={},_0x77771d={'count':0x0,'rows':[]};var _0x2bbd06=_[_0x4c84('0x2b')](db['VoiceTransferReport'][_0x4c84('0x2c')],function(_0x2f1933){return{'name':_0x2f1933[_0x4c84('0x2d')],'type':_0x2f1933[_0x4c84('0x2e')]['key']};});_0x6860f5['model']=_[_0x4c84('0x2b')](_0x2bbd06,'name');_0x6860f5[_0x4c84('0x2f')]=_['keys'](_0xb39743[_0x4c84('0x2f')]);_0x6860f5[_0x4c84('0x30')]=_[_0x4c84('0x31')](_0x6860f5[_0x4c84('0x32')],_0x6860f5[_0x4c84('0x2f')]);_0x39eb18['attributes']=_[_0x4c84('0x31')](_0x6860f5[_0x4c84('0x32')],qs[_0x4c84('0x33')](_0xb39743[_0x4c84('0x2f')]['fields']));_0x39eb18[_0x4c84('0x34')]=_0x39eb18['attributes']['length']?_0x39eb18['attributes']:_0x6860f5[_0x4c84('0x32')];if(!_0xb39743[_0x4c84('0x2f')][_0x4c84('0x35')](_0x4c84('0x36'))){_0x39eb18[_0x4c84('0x1e')]=qs[_0x4c84('0x1e')](_0xb39743[_0x4c84('0x2f')]['limit']);_0x39eb18['offset']=qs[_0x4c84('0x1c')](_0xb39743[_0x4c84('0x2f')]['offset']);}_0x39eb18[_0x4c84('0x37')]=qs[_0x4c84('0x38')](_0xb39743[_0x4c84('0x2f')][_0x4c84('0x38')]);_0x39eb18[_0x4c84('0x39')]=qs['filters'](_[_0x4c84('0x3a')](_0xb39743['query'],_0x6860f5[_0x4c84('0x30')]),_0x2bbd06);if(_0xb39743[_0x4c84('0x2f')][_0x4c84('0x3b')]){_0x39eb18[_0x4c84('0x39')]=_[_0x4c84('0x3c')](_0x39eb18[_0x4c84('0x39')],{'$or':_[_0x4c84('0x2b')](_0x2bbd06,function(_0x3e7022){if(_0x3e7022[_0x4c84('0x2e')]!==_0x4c84('0x3d')){var _0x3a9f1d={};_0x3a9f1d[_0x3e7022['name']]={'$like':'%'+_0xb39743[_0x4c84('0x2f')]['filter']+'%'};return _0x3a9f1d;}})});}_0x39eb18=_[_0x4c84('0x3c')]({},_0x39eb18,_0xb39743['options']);var _0x49b44a={'where':_0x39eb18[_0x4c84('0x39')]};return db['VoiceTransferReport'][_0x4c84('0x1f')](_0x49b44a)[_0x4c84('0x24')](function(_0x13268f){_0x77771d['count']=_0x13268f;if(_0xb39743['query'][_0x4c84('0x3e')]){_0x39eb18[_0x4c84('0x3f')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x4c84('0x40')](_0x39eb18);})[_0x4c84('0x24')](function(_0x1b8e33){_0x77771d[_0x4c84('0x41')]=_0x1b8e33;return _0x77771d;})[_0x4c84('0x24')](respondWithFilteredResult(_0x3bd676,_0x39eb18))[_0x4c84('0x42')](handleError(_0x3bd676,null));};exports['show']=function(_0x9bce43,_0x494b51){var _0x48ca4e={'raw':!![],'where':{'id':_0x9bce43['params']['id']}},_0xa8c0d3={};_0xa8c0d3['model']=_[_0x4c84('0x43')](db[_0x4c84('0x44')]['rawAttributes']);_0xa8c0d3[_0x4c84('0x2f')]=_[_0x4c84('0x43')](_0x9bce43[_0x4c84('0x2f')]);_0xa8c0d3[_0x4c84('0x30')]=_[_0x4c84('0x31')](_0xa8c0d3[_0x4c84('0x32')],_0xa8c0d3[_0x4c84('0x2f')]);_0x48ca4e[_0x4c84('0x34')]=_[_0x4c84('0x31')](_0xa8c0d3[_0x4c84('0x32')],qs[_0x4c84('0x33')](_0x9bce43['query'][_0x4c84('0x33')]));_0x48ca4e[_0x4c84('0x34')]=_0x48ca4e['attributes'][_0x4c84('0x45')]?_0x48ca4e['attributes']:_0xa8c0d3[_0x4c84('0x32')];if(_0x9bce43[_0x4c84('0x2f')]['includeAll']){_0x48ca4e[_0x4c84('0x3f')]=[{'all':!![]}];}_0x48ca4e=_[_0x4c84('0x3c')]({},_0x48ca4e,_0x9bce43[_0x4c84('0x46')]);return db[_0x4c84('0x44')][_0x4c84('0x47')](_0x48ca4e)[_0x4c84('0x24')](handleEntityNotFound(_0x494b51,null))[_0x4c84('0x24')](respondWithResult(_0x494b51,null))[_0x4c84('0x42')](handleError(_0x494b51,null));};exports[_0x4c84('0x48')]=function(_0x113117,_0x1d87b5){return db[_0x4c84('0x44')][_0x4c84('0x48')](_0x113117['body'],{})[_0x4c84('0x24')](respondWithResult(_0x1d87b5,0xc9))['catch'](handleError(_0x1d87b5,null));};exports[_0x4c84('0x23')]=function(_0x435c5a,_0x3f696d){if(_0x435c5a[_0x4c84('0x49')]['id']){delete _0x435c5a['body']['id'];}return db[_0x4c84('0x44')][_0x4c84('0x47')]({'where':{'id':_0x435c5a[_0x4c84('0x4a')]['id']}})[_0x4c84('0x24')](handleEntityNotFound(_0x3f696d,null))[_0x4c84('0x24')](saveUpdates(_0x435c5a[_0x4c84('0x49')],null))[_0x4c84('0x24')](respondWithResult(_0x3f696d,null))[_0x4c84('0x42')](handleError(_0x3f696d,null));};exports['destroy']=function(_0xf0aaa3,_0x5c1cff){return db[_0x4c84('0x44')][_0x4c84('0x47')]({'where':{'id':_0xf0aaa3[_0x4c84('0x4a')]['id']}})[_0x4c84('0x24')](handleEntityNotFound(_0x5c1cff,null))[_0x4c84('0x24')](removeEntity(_0x5c1cff,null))['catch'](handleError(_0x5c1cff,null));};exports['describe']=function(_0x40e0e7,_0x45a4cf){return db[_0x4c84('0x44')][_0x4c84('0x4b')]()[_0x4c84('0x24')](respondWithResult(_0x45a4cf,null))[_0x4c84('0x42')](handleError(_0x45a4cf,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 993a912..521787e 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 _0xf36a=['rimraf','../../config/environment','exports','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x5afec5,_0x1198b5){var _0x23f5e3=function(_0x41f8f6){while(--_0x41f8f6){_0x5afec5['push'](_0x5afec5['shift']());}};_0x23f5e3(++_0x1198b5);}(_0xf36a,0x1d7));var _0xaf36=function(_0x294799,_0x57f889){_0x294799=_0x294799-0x0;var _0x2e6f56=_0xf36a[_0x294799];return _0x2e6f56;};'use strict';var _=require(_0xaf36('0x0'));var util=require(_0xaf36('0x1'));var logger=require(_0xaf36('0x2'))('api');var moment=require(_0xaf36('0x3'));var BPromise=require(_0xaf36('0x4'));var rp=require(_0xaf36('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf36('0x6'));var config=require(_0xaf36('0x7'));var attributes=require('./voiceTransferReport.attributes');module[_0xaf36('0x8')]=function(_0x1fbb24,_0x15e965){return _0x1fbb24['define']('VoiceTransferReport',attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf753=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf753,0xcc));var _0x3f75=function(_0x1fc1f9,_0x454fb2){_0x1fc1f9=_0x1fc1f9-0x0;var _0x4987ca=_0xf753[_0x1fc1f9];return _0x4987ca;};'use strict';var _=require(_0x3f75('0x0'));var util=require(_0x3f75('0x1'));var logger=require(_0x3f75('0x2'))(_0x3f75('0x3'));var moment=require('moment');var BPromise=require(_0x3f75('0x4'));var rp=require(_0x3f75('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3f75('0x6'));var config=require('../../config/environment');var attributes=require(_0x3f75('0x7'));module[_0x3f75('0x8')]=function(_0x20c0ab,_0x5e9429){return _0x20c0ab[_0x3f75('0x9')](_0x3f75('0xa'),attributes,{'tableName':_0x3f75('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 9c5a377..aa5ca73 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 _0x0655=['../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','debug','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','request\x20sent','result','catch','VoiceTransferReport','create','body','options','raw','CreateVoiceTransferReport','util','moment','bluebird','randomstring','ioredis'];(function(_0x30a75f,_0x1ebfe7){var _0x64a76f=function(_0x370e30){while(--_0x370e30){_0x30a75f['push'](_0x30a75f['shift']());}};_0x64a76f(++_0x1ebfe7);}(_0x0655,0x183));var _0x5065=function(_0x30121e,_0x240c86){_0x30121e=_0x30121e-0x0;var _0x4ba328=_0x0655[_0x30121e];return _0x4ba328;};'use strict';var _=require('lodash');var util=require(_0x5065('0x0'));var moment=require(_0x5065('0x1'));var BPromise=require(_0x5065('0x2'));var rs=require(_0x5065('0x3'));var fs=require('fs');var Redis=require(_0x5065('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5065('0x5'));var logger=require(_0x5065('0x6'))('rpc');var config=require(_0x5065('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5065('0x8')][_0x5065('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46f521,_0x5384af,_0x2ab2d2){return new BPromise(function(_0x3de4a3,_0x5221ed){return client[_0x5065('0xa')](_0x46f521,_0x2ab2d2)[_0x5065('0xb')](function(_0xdd99eb){logger[_0x5065('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x5384af,'request\x20sent');logger[_0x5065('0xd')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x5384af,'request\x20sent',JSON[_0x5065('0xe')](_0xdd99eb));if(_0xdd99eb['error']){if(_0xdd99eb[_0x5065('0xf')][_0x5065('0x10')]===0x1f4){logger[_0x5065('0xf')](_0x5065('0x11'),_0x5384af,_0xdd99eb['error'][_0x5065('0x12')]);return _0x5221ed(_0xdd99eb['error'][_0x5065('0x12')]);}logger[_0x5065('0xf')](_0x5065('0x11'),_0x5384af,_0xdd99eb['error'][_0x5065('0x12')]);return _0x3de4a3(_0xdd99eb['error'][_0x5065('0x12')]);}else{logger[_0x5065('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x5384af,_0x5065('0x13'));_0x3de4a3(_0xdd99eb[_0x5065('0x14')][_0x5065('0x12')]);}})[_0x5065('0x15')](function(_0x33c127){logger[_0x5065('0xf')](_0x5065('0x11'),_0x5384af,_0x33c127);_0x5221ed(_0x33c127);});});}exports['CreateVoiceTransferReport']=function(_0x4821d8){var _0x992412=this;return new Promise(function(_0x3da42e,_0x2658c6){return db[_0x5065('0x16')][_0x5065('0x17')](_0x4821d8[_0x5065('0x18')],{'raw':_0x4821d8[_0x5065('0x19')]?_0x4821d8[_0x5065('0x19')][_0x5065('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x2643ee){logger[_0x5065('0xc')]('CreateVoiceTransferReport',_0x4821d8);logger[_0x5065('0xd')]('CreateVoiceTransferReport',_0x4821d8,JSON[_0x5065('0xe')](_0x2643ee));_0x3da42e(_0x2643ee);})[_0x5065('0x15')](function(_0x1d1df0){logger[_0x5065('0xf')](_0x5065('0x1b'),_0x1d1df0[_0x5065('0x12')],_0x4821d8);_0x2658c6(_0x992412[_0x5065('0xf')](0x1f4,_0x1d1df0[_0x5065('0x12')]));});});}; \ No newline at end of file +var _0xcc5a=['error','message','result','catch','CreateVoiceTransferReport','body','options','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3f01cd,_0x5501ce){var _0x4b5e26=function(_0x5954c6){while(--_0x5954c6){_0x3f01cd['push'](_0x3f01cd['shift']());}};_0x4b5e26(++_0x5501ce);}(_0xcc5a,0x1d0));var _0xacc5=function(_0x3f55de,_0x3ae98f){_0x3f55de=_0x3f55de-0x0;var _0x2698de=_0xcc5a[_0x3f55de];return _0x2698de;};'use strict';var _=require('lodash');var util=require(_0xacc5('0x0'));var moment=require(_0xacc5('0x1'));var BPromise=require('bluebird');var rs=require(_0xacc5('0x2'));var fs=require('fs');var Redis=require(_0xacc5('0x3'));var db=require(_0xacc5('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xacc5('0x5'));var jayson=require(_0xacc5('0x6'));var client=jayson[_0xacc5('0x7')][_0xacc5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d7ef2,_0x255601,_0x23db4d){return new BPromise(function(_0x5bd6a9,_0x2ef127){return client[_0xacc5('0x9')](_0x5d7ef2,_0x23db4d)['then'](function(_0x447da7){logger[_0xacc5('0xa')](_0xacc5('0xb'),_0x255601,'request\x20sent');logger[_0xacc5('0xc')](_0xacc5('0xd'),_0x255601,_0xacc5('0xe'),JSON[_0xacc5('0xf')](_0x447da7));if(_0x447da7[_0xacc5('0x10')]){if(_0x447da7[_0xacc5('0x10')]['code']===0x1f4){logger[_0xacc5('0x10')](_0xacc5('0xb'),_0x255601,_0x447da7['error'][_0xacc5('0x11')]);return _0x2ef127(_0x447da7[_0xacc5('0x10')][_0xacc5('0x11')]);}logger[_0xacc5('0x10')](_0xacc5('0xb'),_0x255601,_0x447da7[_0xacc5('0x10')][_0xacc5('0x11')]);return _0x5bd6a9(_0x447da7['error'][_0xacc5('0x11')]);}else{logger[_0xacc5('0xa')](_0xacc5('0xb'),_0x255601,'request\x20sent');_0x5bd6a9(_0x447da7[_0xacc5('0x12')][_0xacc5('0x11')]);}})[_0xacc5('0x13')](function(_0x46784b){logger[_0xacc5('0x10')](_0xacc5('0xb'),_0x255601,_0x46784b);_0x2ef127(_0x46784b);});});}exports[_0xacc5('0x14')]=function(_0x234780){var _0x170c17=this;return new Promise(function(_0x1099d0,_0x3fee7f){return db['VoiceTransferReport']['create'](_0x234780[_0xacc5('0x15')],{'raw':_0x234780[_0xacc5('0x16')]?_0x234780[_0xacc5('0x16')][_0xacc5('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0xc6c683){logger['info']('CreateVoiceTransferReport',_0x234780);logger[_0xacc5('0xc')](_0xacc5('0x14'),_0x234780,JSON[_0xacc5('0xf')](_0xc6c683));_0x1099d0(_0xc6c683);})[_0xacc5('0x13')](function(_0x26508f){logger[_0xacc5('0x10')](_0xacc5('0x14'),_0x26508f[_0xacc5('0x11')],_0x234780);_0x3fee7f(_0x170c17[_0xacc5('0x10')](0x1f4,_0x26508f[_0xacc5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 16f67c9..f02c5d9 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 _0x742f=['express','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','canUpdate','hangup','/answer','answer','/hold','hold','/unhold','calls','/transfer'];(function(_0x5506e3,_0x86f20d){var _0x571955=function(_0x5099b2){while(--_0x5099b2){_0x5506e3['push'](_0x5506e3['shift']());}};_0x571955(++_0x86f20d);}(_0x742f,0xe0));var _0xf742=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x742f[_0xc4001c];return _0x49f7bc;};'use strict';var express=require(_0xf742('0x0'));var router=express[_0xf742('0x1')]();var auth=require(_0xf742('0x2'));var controller=require(_0xf742('0x3'));router[_0xf742('0x4')](_0xf742('0x5'),auth[_0xf742('0x6')](),auth[_0xf742('0x7')](),controller['originate']);router[_0xf742('0x4')]('/hangup',auth[_0xf742('0x6')](),auth[_0xf742('0x7')](),controller[_0xf742('0x8')]);router[_0xf742('0x4')](_0xf742('0x9'),auth[_0xf742('0x6')](),auth['canUpdate'](),controller[_0xf742('0xa')]);router[_0xf742('0x4')](_0xf742('0xb'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xf742('0xc')]);router[_0xf742('0x4')](_0xf742('0xd'),auth['isAuthenticated'](),auth[_0xf742('0x7')](),controller['unhold']);router[_0xf742('0x4')]('/calls',auth[_0xf742('0x6')](),auth[_0xf742('0x7')](),controller[_0xf742('0xe')]);router['post'](_0xf742('0xf'),auth[_0xf742('0x6')](),auth[_0xf742('0x7')](),controller['transfer']);module['exports']=router; \ No newline at end of file +var _0x9790=['/originate','isAuthenticated','canUpdate','/hangup','hangup','/answer','/hold','hold','/unhold','unhold','/calls','/transfer','transfer','Router','../../components/auth/service','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9790,0x1dd));var _0x0979=function(_0x156102,_0x43debe){_0x156102=_0x156102-0x0;var _0x12fc76=_0x9790[_0x156102];return _0x12fc76;};'use strict';var express=require('express');var router=express[_0x0979('0x0')]();var auth=require(_0x0979('0x1'));var controller=require('./webbar.controller');router[_0x0979('0x2')](_0x0979('0x3'),auth[_0x0979('0x4')](),auth[_0x0979('0x5')](),controller['originate']);router[_0x0979('0x2')](_0x0979('0x6'),auth[_0x0979('0x4')](),auth[_0x0979('0x5')](),controller[_0x0979('0x7')]);router[_0x0979('0x2')](_0x0979('0x8'),auth[_0x0979('0x4')](),auth[_0x0979('0x5')](),controller['answer']);router['post'](_0x0979('0x9'),auth[_0x0979('0x4')](),auth[_0x0979('0x5')](),controller[_0x0979('0xa')]);router[_0x0979('0x2')](_0x0979('0xb'),auth[_0x0979('0x4')](),auth['canUpdate'](),controller[_0x0979('0xc')]);router[_0x0979('0x2')](_0x0979('0xd'),auth[_0x0979('0x4')](),auth[_0x0979('0x5')](),controller['calls']);router[_0x0979('0x2')](_0x0979('0xe'),auth['isAuthenticated'](),auth[_0x0979('0x5')](),controller[_0x0979('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 6e5f60f..f2b6de9 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 _0x34e5=['string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','stack','name','status','send','NotFound','request','then','error','code','message','catch','User','findOne','VoiceChannels','all','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','json','body','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','hangup','hangup\x20fired:','webbar:hangup','answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','calls','filter','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','lodash','../../config/environment','util','bluebird','jayson/promise','client','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','validate','number','callNumber\x20is\x20required'];(function(_0x5861d9,_0xb9a131){var _0x13cae0=function(_0x3d79a6){while(--_0x3d79a6){_0x5861d9['push'](_0x5861d9['shift']());}};_0x13cae0(++_0xb9a131);}(_0x34e5,0x172));var _0x534e=function(_0x1f994c,_0x26cec8){_0x1f994c=_0x1f994c-0x0;var _0x201382=_0x34e5[_0x1f994c];return _0x201382;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x534e('0x0'));var db=require('../../mysqldb')['db'];var config=require(_0x534e('0x1'));var util=require(_0x534e('0x2'));var BPromise=require(_0x534e('0x3'));var jayson=require(_0x534e('0x4'));var amiClient=jayson[_0x534e('0x5')]['http']({'port':0x232a});var logger=require(_0x534e('0x6'))(_0x534e('0x7'));var Redis=require(_0x534e('0x8'));config[_0x534e('0x9')]=_[_0x534e('0xa')](config[_0x534e('0x9')],{'host':_0x534e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x534e('0x9')]));var Schema=require(_0x534e('0xc'));var originateValidation=new Schema({'userId':{'type':_0x534e('0xd'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0x534e('0xe')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x534e('0xf')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x534e('0x10')]},'sessionId':{'type':_0x534e('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x534e('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x534e('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x534e('0xd'),'required':[!![],_0x534e('0x10')]},'sessionId':{'type':_0x534e('0xf'),'required':[!![],_0x534e('0x11')]},'transferNumber':{'type':'string','required':[!![],_0x534e('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x534e('0xd'),'required':[!![],_0x534e('0x10')]},'sessionId':{'type':_0x534e('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x534e('0xd'),'required':[!![],_0x534e('0x10')]},'sessionId':{'type':_0x534e('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x534e('0xd'),'required':[!![],_0x534e('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x534e('0x10')]}});function emit(_0x3940c3,_0x5bdae2,_0x4eca13){logger[_0x534e('0x13')](_0x3940c3,_0x5bdae2,JSON[_0x534e('0x14')](_0x4eca13));io['to'](_0x3940c3)[_0x534e('0x15')](_0x5bdae2,_0x4eca13);}function handleError(_0x16ad40){return function(_0x22bc92){console[_0x534e('0x16')](_0x534e('0x17'),_0x22bc92,_0x22bc92 instanceof RangeError);logger['error'](_0x22bc92[_0x534e('0x18')]);if(_0x22bc92 instanceof RangeError){if(_0x22bc92[_0x534e('0x19')]){delete _0x22bc92[_0x534e('0x19')];}_0x16ad40[_0x534e('0x1a')](0x194)[_0x534e('0x1b')](_0x22bc92);}else{if(_0x22bc92['name']){delete _0x22bc92[_0x534e('0x19')];}_0x16ad40[_0x534e('0x1a')](0x1f4)[_0x534e('0x1b')](_0x22bc92);}};}function checkError(){return function(_0x325005){if(!_0x325005){throw new RangeError(_0x534e('0x1c'));}return _0x325005;};}function respondWithRpcPromise(_0xb558fd,_0x1182c3){return new BPromise(function(_0x85188b,_0x21f2e1){var _0x5e086a=amiClient;return _0x5e086a[_0x534e('0x1d')](_0xb558fd,_0x1182c3)[_0x534e('0x1e')](function(_0x39466c){if(_0x39466c[_0x534e('0x1f')]){if(_0x39466c[_0x534e('0x1f')][_0x534e('0x20')]===0x1f4){return _0x21f2e1(_0x39466c[_0x534e('0x1f')][_0x534e('0x21')]);}return _0x85188b(_0x39466c['error'][_0x534e('0x21')]);}else{_0x85188b(_0x39466c['result']);}})[_0x534e('0x22')](function(_0x106b7a){_0x21f2e1(_0x106b7a);});});}function getAgent(_0x3ea5bd){return db[_0x534e('0x23')][_0x534e('0x24')]({'where':{'id':_0x3ea5bd,'role':'agent'}})[_0x534e('0x1e')](checkError());}function getAgentCheckSession(_0x443f85,_0x4f3d30){return new BPromise(function(_0x4bd073,_0x3abacf){var _0x534783=respondWithRpcPromise(_0x534e('0x25'));var _0x3c5c11=getAgent(_0x443f85);Promise[_0x534e('0x26')]([_0x534783,_0x3c5c11])[_0x534e('0x1e')](function(_0x15be5c){var _0x42119b=_0x15be5c[0x0];var _0x5253b5=_0x15be5c[0x1];var _0x53dd97=_['filter'](_0x42119b[_0x534e('0x27')],function(_0x15bdc1){return _0x15bdc1[_0x534e('0x28')]==_0x5253b5['id']&&_0x15bdc1[_0x534e('0x29')]==_0x4f3d30;});if(_0x53dd97[_0x534e('0x2a')]==0x1){_0x4bd073(_0x5253b5);}else{_0x3abacf(new RangeError(_0x534e('0x2b')+_0x4f3d30+_0x534e('0x2c')));}});});}exports[_0x534e('0x2d')]=function(_0x533d62,_0x312744){logger[_0x534e('0x13')](_0x534e('0x2e'),_0x533d62['body']);var _0x170ff6=originateValidation[_0x534e('0xc')](_0x533d62['body']);if(_0x170ff6[_0x534e('0x2a')]>0x0){return _0x312744['status'](0x190)[_0x534e('0x2f')](_0x170ff6);}var _0x41eebe=_0x533d62[_0x534e('0x30')][_0x534e('0x31')];var _0x508b94=_0x533d62[_0x534e('0x30')][_0x534e('0x32')];var _0x4a850f=_0x533d62['body'][_0x534e('0x33')];var _0x17baab=_0x533d62[_0x534e('0x30')][_0x534e('0x34')];return getAgent(_0x41eebe)['then'](function(_0x348573){logger['info'](_0x534e('0x35'),_0x348573['name']);emit(util[_0x534e('0x36')](_0x534e('0x37'),_0x348573['name']),_0x534e('0x38'),{'callNumber':_0x508b94,'callerId':_0x4a850f,'callbackUrl':_0x17baab});return _0x312744['status'](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x312744));};exports[_0x534e('0x39')]=function(_0x4de87f,_0x49f188){logger[_0x534e('0x13')](_0x534e('0x3a'),_0x4de87f[_0x534e('0x30')]);var _0x5718fa=hangupValidation[_0x534e('0xc')](_0x4de87f[_0x534e('0x30')]);if(_0x5718fa['length']>0x0){return _0x49f188[_0x534e('0x1a')](0x190)['json'](_0x5718fa);}var _0x6cc5e8=_0x4de87f[_0x534e('0x30')]['userId'];var _0x7df9da=_0x4de87f['body'][_0x534e('0x29')];return getAgent(_0x6cc5e8)[_0x534e('0x1e')](function(_0x1f483c){logger[_0x534e('0x13')]('entityFound:',_0x1f483c['name']);emit(util[_0x534e('0x36')]('user:%s',_0x1f483c[_0x534e('0x19')]),_0x534e('0x3b'),{'sessionId':_0x7df9da});return _0x49f188[_0x534e('0x1a')](0xc8)[_0x534e('0x2f')]({'error':![],'message':'hangup\x20executed!'});})[_0x534e('0x22')](handleError(_0x49f188));};exports[_0x534e('0x3c')]=function(_0x376114,_0x52d53f){logger[_0x534e('0x13')]('answer\x20fired:',_0x376114[_0x534e('0x30')]);var _0x24c9c2=answerValidation[_0x534e('0xc')](_0x376114['body']);if(_0x24c9c2[_0x534e('0x2a')]>0x0){return _0x52d53f[_0x534e('0x1a')](0x190)[_0x534e('0x2f')](_0x24c9c2);}var _0x436b0f=_0x376114[_0x534e('0x30')][_0x534e('0x31')];var _0x197ce2=_0x376114['body'][_0x534e('0x29')];return getAgent(_0x436b0f)['then'](function(_0x5adac3){logger[_0x534e('0x13')](_0x534e('0x35'),_0x5adac3[_0x534e('0x19')]);emit(util[_0x534e('0x36')](_0x534e('0x37'),_0x5adac3[_0x534e('0x19')]),'webbar:answer',{'sessionId':_0x197ce2});return _0x52d53f[_0x534e('0x1a')](0xc8)[_0x534e('0x2f')]({'error':![],'message':_0x534e('0x3d')});})['catch'](handleError(_0x52d53f));};exports[_0x534e('0x3e')]=function(_0x4c655b,_0x2057d0){logger[_0x534e('0x13')](_0x534e('0x3f'),_0x4c655b[_0x534e('0x30')]);var _0x2c0ca5=holdValidation[_0x534e('0xc')](_0x4c655b['body']);if(_0x2c0ca5[_0x534e('0x2a')]>0x0){return _0x2057d0['status'](0x190)['json'](_0x2c0ca5);}var _0x298e11=_0x4c655b[_0x534e('0x30')][_0x534e('0x31')];var _0x1a0118=_0x4c655b[_0x534e('0x30')][_0x534e('0x29')];return getAgent(_0x298e11)[_0x534e('0x1e')](function(_0x376c83){logger[_0x534e('0x13')]('entityFound:',_0x376c83[_0x534e('0x19')]);emit(util[_0x534e('0x36')](_0x534e('0x37'),_0x376c83[_0x534e('0x19')]),'webbar:hold',{'sessionId':_0x1a0118});return _0x2057d0[_0x534e('0x1a')](0xc8)[_0x534e('0x2f')]({'error':![],'message':_0x534e('0x40')});})[_0x534e('0x22')](handleError(_0x2057d0));};exports[_0x534e('0x41')]=function(_0x176147,_0xc625df){logger[_0x534e('0x13')](_0x534e('0x42'),_0x176147[_0x534e('0x30')]);var _0x1d9782=unholdValidation[_0x534e('0xc')](_0x176147['body']);if(_0x1d9782[_0x534e('0x2a')]>0x0){return _0xc625df[_0x534e('0x1a')](0x190)['json'](_0x1d9782);}var _0x328ef6=_0x176147[_0x534e('0x30')][_0x534e('0x31')];var _0x4ef39f=_0x176147['body'][_0x534e('0x29')];return getAgent(_0x328ef6)[_0x534e('0x1e')](function(_0x45224a){logger[_0x534e('0x13')](_0x534e('0x35'),_0x45224a[_0x534e('0x19')]);emit(util[_0x534e('0x36')](_0x534e('0x37'),_0x45224a[_0x534e('0x19')]),'webbar:unhold',{'sessionId':_0x4ef39f});return _0xc625df['status'](0xc8)[_0x534e('0x2f')]({'error':![],'message':'unhold\x20executed!'});})[_0x534e('0x22')](handleError(_0xc625df));};exports[_0x534e('0x43')]=function(_0x13af68,_0x23da96){logger[_0x534e('0x13')]('calls\x20fired:',_0x23da96[_0x534e('0x30')]);var _0x2de255=callsValidation['validate'](_0x13af68['body']);if(_0x2de255[_0x534e('0x2a')]>0x0){return _0x23da96['status'](0x190)['json'](_0x2de255);}var _0x10ea1c=_0x13af68[_0x534e('0x30')][_0x534e('0x31')];var _0x482a1f=respondWithRpcPromise(_0x534e('0x25'));var _0x2dbff9=getAgent(_0x10ea1c);return Promise['all']([_0x482a1f,_0x2dbff9])['then'](function(_0x467f37){var _0x617fde=_0x467f37[0x0];var _0x5c01fd=_0x467f37[0x1];var _0x47d39e=_[_0x534e('0x44')](_0x617fde['rows'],function(_0x5a2649){return _0x5a2649['UserId']==_0x5c01fd['id'];});return _0x23da96[_0x534e('0x1a')](0xc8)[_0x534e('0x2f')]({'count':_0x47d39e[_0x534e('0x2a')],'rows':_0x47d39e});})[_0x534e('0x22')](handleError(_0x23da96));};exports[_0x534e('0x45')]=function(_0x3db45a,_0xe0b1bd){logger[_0x534e('0x13')](_0x534e('0x46'),_0x3db45a[_0x534e('0x30')]);var _0x57a530=conferenceValidation[_0x534e('0xc')](_0x3db45a[_0x534e('0x30')]);if(_0x57a530[_0x534e('0x2a')]>0x0){return _0xe0b1bd[_0x534e('0x1a')](0x190)[_0x534e('0x2f')](_0x57a530);}var _0x5c9004=_0x3db45a[_0x534e('0x30')]['userId'];return getAgent(_0x5c9004)[_0x534e('0x1e')](function(_0x9b6c1e){logger[_0x534e('0x13')](_0x534e('0x35'),_0x9b6c1e['name']);emit(util[_0x534e('0x36')]('user:%s',_0x9b6c1e[_0x534e('0x19')]),_0x534e('0x47'));return _0xe0b1bd[_0x534e('0x1a')](0xc8)[_0x534e('0x2f')]({'error':![],'message':_0x534e('0x48')});})[_0x534e('0x22')](handleError(_0xe0b1bd));};exports[_0x534e('0x49')]=function(_0x35a0c6,_0x5775e7){logger['info'](_0x534e('0x4a'),_0x35a0c6[_0x534e('0x30')]);var _0x21a6f6=transferValidation['validate'](_0x35a0c6[_0x534e('0x30')]);if(_0x21a6f6[_0x534e('0x2a')]>0x0){return _0x5775e7[_0x534e('0x1a')](0x190)[_0x534e('0x2f')](_0x21a6f6);}var _0x29c1d4=_0x35a0c6['body'][_0x534e('0x31')];var _0x17cfe0=_0x35a0c6[_0x534e('0x30')]['sessionId'];var _0x5e38fa=_0x35a0c6[_0x534e('0x30')][_0x534e('0x4b')];return getAgent(_0x29c1d4)['then'](function(_0x411b3c){logger[_0x534e('0x13')](_0x534e('0x35'),_0x411b3c['name']);emit(util['format'](_0x534e('0x37'),_0x411b3c[_0x534e('0x19')]),_0x534e('0x4c'),{'sessionId':_0x17cfe0,'transferNumber':_0x5e38fa});return _0x5775e7[_0x534e('0x1a')](0xc8)[_0x534e('0x2f')]({'error':![],'message':'transfer\x20executed!'});})[_0x534e('0x22')](handleError(_0x5775e7));}; \ No newline at end of file +var _0x80df=['../../config/logger','webbarapi','ioredis','redis','defaults','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId\x20','originate','originate\x20fired:','body','length','json','userId','callNumber','callerId','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','sessionId','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','transferNumber','webbar:transfer','path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','http'];(function(_0x4c8ca0,_0x5458b6){var _0x1addaa=function(_0x22b1e1){while(--_0x22b1e1){_0x4c8ca0['push'](_0x4c8ca0['shift']());}};_0x1addaa(++_0x5458b6);}(_0x80df,0x17e));var _0xf80d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x80df[_0x20a584];return _0x4b41a8;};'use strict';var path=require(_0xf80d('0x0'));var fs=require('fs');var _=require(_0xf80d('0x1'));var db=require(_0xf80d('0x2'))['db'];var config=require(_0xf80d('0x3'));var util=require('util');var BPromise=require(_0xf80d('0x4'));var jayson=require(_0xf80d('0x5'));var amiClient=jayson[_0xf80d('0x6')][_0xf80d('0x7')]({'port':0x232a});var logger=require(_0xf80d('0x8'))(_0xf80d('0x9'));var Redis=require(_0xf80d('0xa'));config[_0xf80d('0xb')]=_[_0xf80d('0xc')](config[_0xf80d('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0xf80d('0xd'))(new Redis(config[_0xf80d('0xb')]));var Schema=require(_0xf80d('0xe'));var originateValidation=new Schema({'userId':{'type':_0xf80d('0xf'),'required':[!![],_0xf80d('0x10')]},'callNumber':{'type':_0xf80d('0x11'),'required':[!![],_0xf80d('0x12')]},'callerId':{'type':_0xf80d('0x11')},'callbackUrl':{'type':_0xf80d('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0xf80d('0xf'),'required':[!![],_0xf80d('0x10')]},'sessionId':{'type':_0xf80d('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xf80d('0xf'),'required':[!![],_0xf80d('0x10')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf80d('0x10')]},'sessionId':{'type':_0xf80d('0x11'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xf80d('0x11'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xf80d('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xf80d('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf80d('0x10')]},'sessionId':{'type':_0xf80d('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xf80d('0xf'),'required':[!![],_0xf80d('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0xf80d('0xf'),'required':[!![],_0xf80d('0x10')]}});function emit(_0x482043,_0x27f3a2,_0x3db0e7){logger[_0xf80d('0x13')](_0x482043,_0x27f3a2,JSON[_0xf80d('0x14')](_0x3db0e7));io['to'](_0x482043)[_0xf80d('0x15')](_0x27f3a2,_0x3db0e7);}function handleError(_0x3f5d02){return function(_0x1d104a){console[_0xf80d('0x16')](_0xf80d('0x17'),_0x1d104a,_0x1d104a instanceof RangeError);logger[_0xf80d('0x18')](_0x1d104a[_0xf80d('0x19')]);if(_0x1d104a instanceof RangeError){if(_0x1d104a[_0xf80d('0x1a')]){delete _0x1d104a['name'];}_0x3f5d02[_0xf80d('0x1b')](0x194)[_0xf80d('0x1c')](_0x1d104a);}else{if(_0x1d104a['name']){delete _0x1d104a[_0xf80d('0x1a')];}_0x3f5d02['status'](0x1f4)[_0xf80d('0x1c')](_0x1d104a);}};}function checkError(){return function(_0x2ac5ad){if(!_0x2ac5ad){throw new RangeError(_0xf80d('0x1d'));}return _0x2ac5ad;};}function respondWithRpcPromise(_0x120e13,_0x3bc82f){return new BPromise(function(_0x25d031,_0x446153){var _0x269859=amiClient;return _0x269859[_0xf80d('0x1e')](_0x120e13,_0x3bc82f)[_0xf80d('0x1f')](function(_0x33d58c){if(_0x33d58c[_0xf80d('0x18')]){if(_0x33d58c['error'][_0xf80d('0x20')]===0x1f4){return _0x446153(_0x33d58c[_0xf80d('0x18')]['message']);}return _0x25d031(_0x33d58c[_0xf80d('0x18')][_0xf80d('0x21')]);}else{_0x25d031(_0x33d58c[_0xf80d('0x22')]);}})[_0xf80d('0x23')](function(_0x4986ad){_0x446153(_0x4986ad);});});}function getAgent(_0x79142a){return db[_0xf80d('0x24')][_0xf80d('0x25')]({'where':{'id':_0x79142a,'role':_0xf80d('0x26')}})[_0xf80d('0x1f')](checkError());}function getAgentCheckSession(_0xde054a,_0x2fc429){return new BPromise(function(_0x68f2c6,_0x162fb4){var _0x4d2579=respondWithRpcPromise(_0xf80d('0x27'));var _0x1603a4=getAgent(_0xde054a);Promise[_0xf80d('0x28')]([_0x4d2579,_0x1603a4])[_0xf80d('0x1f')](function(_0x3ce924){var _0x5eab42=_0x3ce924[0x0];var _0x401cfb=_0x3ce924[0x1];var _0x5a6615=_[_0xf80d('0x29')](_0x5eab42[_0xf80d('0x2a')],function(_0x214bff){return _0x214bff[_0xf80d('0x2b')]==_0x401cfb['id']&&_0x214bff['sessionId']==_0x2fc429;});if(_0x5a6615['length']==0x1){_0x68f2c6(_0x401cfb);}else{_0x162fb4(new RangeError(_0xf80d('0x2c')+_0x2fc429+'\x20not\x20found!'));}});});}exports[_0xf80d('0x2d')]=function(_0x1cc1b0,_0x45f76a){logger['info'](_0xf80d('0x2e'),_0x1cc1b0[_0xf80d('0x2f')]);var _0x5b7070=originateValidation[_0xf80d('0xe')](_0x1cc1b0[_0xf80d('0x2f')]);if(_0x5b7070[_0xf80d('0x30')]>0x0){return _0x45f76a['status'](0x190)[_0xf80d('0x31')](_0x5b7070);}var _0x9f700b=_0x1cc1b0[_0xf80d('0x2f')][_0xf80d('0x32')];var _0x20e598=_0x1cc1b0['body'][_0xf80d('0x33')];var _0x5eb7bb=_0x1cc1b0[_0xf80d('0x2f')][_0xf80d('0x34')];var _0xd5ebb4=_0x1cc1b0[_0xf80d('0x2f')]['callbackUrl'];return getAgent(_0x9f700b)[_0xf80d('0x1f')](function(_0x35a7a0){logger[_0xf80d('0x13')](_0xf80d('0x35'),_0x35a7a0['name']);emit(util[_0xf80d('0x36')](_0xf80d('0x37'),_0x35a7a0[_0xf80d('0x1a')]),_0xf80d('0x38'),{'callNumber':_0x20e598,'callerId':_0x5eb7bb,'callbackUrl':_0xd5ebb4});return _0x45f76a[_0xf80d('0x1b')](0xc8)[_0xf80d('0x31')]({'error':![],'message':_0xf80d('0x39')});})[_0xf80d('0x23')](handleError(_0x45f76a));};exports['hangup']=function(_0x23dd5e,_0xa0280a){logger[_0xf80d('0x13')]('hangup\x20fired:',_0x23dd5e[_0xf80d('0x2f')]);var _0x47cd14=hangupValidation[_0xf80d('0xe')](_0x23dd5e[_0xf80d('0x2f')]);if(_0x47cd14[_0xf80d('0x30')]>0x0){return _0xa0280a[_0xf80d('0x1b')](0x190)['json'](_0x47cd14);}var _0x5f4e30=_0x23dd5e['body'][_0xf80d('0x32')];var _0x3f8e2f=_0x23dd5e[_0xf80d('0x2f')][_0xf80d('0x3a')];return getAgent(_0x5f4e30)[_0xf80d('0x1f')](function(_0x100dc7){logger['info'](_0xf80d('0x35'),_0x100dc7[_0xf80d('0x1a')]);emit(util[_0xf80d('0x36')]('user:%s',_0x100dc7[_0xf80d('0x1a')]),'webbar:hangup',{'sessionId':_0x3f8e2f});return _0xa0280a[_0xf80d('0x1b')](0xc8)[_0xf80d('0x31')]({'error':![],'message':_0xf80d('0x3b')});})[_0xf80d('0x23')](handleError(_0xa0280a));};exports[_0xf80d('0x3c')]=function(_0x2421ee,_0x2d2a2b){logger[_0xf80d('0x13')](_0xf80d('0x3d'),_0x2421ee[_0xf80d('0x2f')]);var _0x1fcbad=answerValidation[_0xf80d('0xe')](_0x2421ee[_0xf80d('0x2f')]);if(_0x1fcbad[_0xf80d('0x30')]>0x0){return _0x2d2a2b[_0xf80d('0x1b')](0x190)[_0xf80d('0x31')](_0x1fcbad);}var _0x43474d=_0x2421ee[_0xf80d('0x2f')][_0xf80d('0x32')];var _0x24c1e4=_0x2421ee[_0xf80d('0x2f')][_0xf80d('0x3a')];return getAgent(_0x43474d)[_0xf80d('0x1f')](function(_0xe201f8){logger[_0xf80d('0x13')]('entityFound:',_0xe201f8[_0xf80d('0x1a')]);emit(util[_0xf80d('0x36')](_0xf80d('0x37'),_0xe201f8[_0xf80d('0x1a')]),_0xf80d('0x3e'),{'sessionId':_0x24c1e4});return _0x2d2a2b['status'](0xc8)[_0xf80d('0x31')]({'error':![],'message':_0xf80d('0x3f')});})[_0xf80d('0x23')](handleError(_0x2d2a2b));};exports[_0xf80d('0x40')]=function(_0x1a5b95,_0x406cba){logger[_0xf80d('0x13')](_0xf80d('0x41'),_0x1a5b95[_0xf80d('0x2f')]);var _0x2a070f=holdValidation[_0xf80d('0xe')](_0x1a5b95[_0xf80d('0x2f')]);if(_0x2a070f[_0xf80d('0x30')]>0x0){return _0x406cba[_0xf80d('0x1b')](0x190)[_0xf80d('0x31')](_0x2a070f);}var _0x10d5b5=_0x1a5b95[_0xf80d('0x2f')]['userId'];var _0x468024=_0x1a5b95[_0xf80d('0x2f')][_0xf80d('0x3a')];return getAgent(_0x10d5b5)['then'](function(_0x3e5cf6){logger[_0xf80d('0x13')]('entityFound:',_0x3e5cf6['name']);emit(util[_0xf80d('0x36')]('user:%s',_0x3e5cf6[_0xf80d('0x1a')]),_0xf80d('0x42'),{'sessionId':_0x468024});return _0x406cba[_0xf80d('0x1b')](0xc8)[_0xf80d('0x31')]({'error':![],'message':_0xf80d('0x43')});})[_0xf80d('0x23')](handleError(_0x406cba));};exports[_0xf80d('0x44')]=function(_0x114132,_0x115d1f){logger[_0xf80d('0x13')](_0xf80d('0x45'),_0x114132[_0xf80d('0x2f')]);var _0x59259e=unholdValidation[_0xf80d('0xe')](_0x114132[_0xf80d('0x2f')]);if(_0x59259e[_0xf80d('0x30')]>0x0){return _0x115d1f['status'](0x190)[_0xf80d('0x31')](_0x59259e);}var _0x393c15=_0x114132['body'][_0xf80d('0x32')];var _0x20582a=_0x114132['body'][_0xf80d('0x3a')];return getAgent(_0x393c15)[_0xf80d('0x1f')](function(_0x2c6362){logger[_0xf80d('0x13')]('entityFound:',_0x2c6362[_0xf80d('0x1a')]);emit(util[_0xf80d('0x36')](_0xf80d('0x37'),_0x2c6362['name']),_0xf80d('0x46'),{'sessionId':_0x20582a});return _0x115d1f[_0xf80d('0x1b')](0xc8)[_0xf80d('0x31')]({'error':![],'message':_0xf80d('0x47')});})[_0xf80d('0x23')](handleError(_0x115d1f));};exports[_0xf80d('0x48')]=function(_0x3e5ddc,_0x31ecdc){logger[_0xf80d('0x13')](_0xf80d('0x49'),_0x31ecdc['body']);var _0x112342=callsValidation[_0xf80d('0xe')](_0x3e5ddc[_0xf80d('0x2f')]);if(_0x112342[_0xf80d('0x30')]>0x0){return _0x31ecdc['status'](0x190)['json'](_0x112342);}var _0x2e2273=_0x3e5ddc[_0xf80d('0x2f')]['userId'];var _0x43e4b8=respondWithRpcPromise(_0xf80d('0x27'));var _0x444d3b=getAgent(_0x2e2273);return Promise[_0xf80d('0x28')]([_0x43e4b8,_0x444d3b])['then'](function(_0x3ae779){var _0x583fa8=_0x3ae779[0x0];var _0x4339f8=_0x3ae779[0x1];var _0x540214=_[_0xf80d('0x29')](_0x583fa8['rows'],function(_0x4edbdc){return _0x4edbdc[_0xf80d('0x2b')]==_0x4339f8['id'];});return _0x31ecdc[_0xf80d('0x1b')](0xc8)['json']({'count':_0x540214['length'],'rows':_0x540214});})[_0xf80d('0x23')](handleError(_0x31ecdc));};exports[_0xf80d('0x4a')]=function(_0x394cbe,_0x2ee28c){logger[_0xf80d('0x13')](_0xf80d('0x4b'),_0x394cbe[_0xf80d('0x2f')]);var _0xd65617=conferenceValidation['validate'](_0x394cbe[_0xf80d('0x2f')]);if(_0xd65617[_0xf80d('0x30')]>0x0){return _0x2ee28c[_0xf80d('0x1b')](0x190)['json'](_0xd65617);}var _0x1c4380=_0x394cbe[_0xf80d('0x2f')]['userId'];return getAgent(_0x1c4380)[_0xf80d('0x1f')](function(_0x38d607){logger[_0xf80d('0x13')]('entityFound:',_0x38d607[_0xf80d('0x1a')]);emit(util[_0xf80d('0x36')](_0xf80d('0x37'),_0x38d607['name']),'webbar:conference');return _0x2ee28c[_0xf80d('0x1b')](0xc8)[_0xf80d('0x31')]({'error':![],'message':'conference\x20executed!'});})[_0xf80d('0x23')](handleError(_0x2ee28c));};exports['transfer']=function(_0x14fb82,_0x3cb9ef){logger[_0xf80d('0x13')]('transfer\x20fired:',_0x14fb82[_0xf80d('0x2f')]);var _0x422daa=transferValidation[_0xf80d('0xe')](_0x14fb82[_0xf80d('0x2f')]);if(_0x422daa[_0xf80d('0x30')]>0x0){return _0x3cb9ef[_0xf80d('0x1b')](0x190)[_0xf80d('0x31')](_0x422daa);}var _0x13bd9d=_0x14fb82[_0xf80d('0x2f')][_0xf80d('0x32')];var _0x3bd5dd=_0x14fb82[_0xf80d('0x2f')]['sessionId'];var _0x12f3a5=_0x14fb82[_0xf80d('0x2f')][_0xf80d('0x4c')];return getAgent(_0x13bd9d)['then'](function(_0x346616){logger[_0xf80d('0x13')]('entityFound:',_0x346616['name']);emit(util[_0xf80d('0x36')](_0xf80d('0x37'),_0x346616['name']),_0xf80d('0x4d'),{'sessionId':_0x3bd5dd,'transferNumber':_0x12f3a5});return _0x3cb9ef[_0xf80d('0x1b')](0xc8)[_0xf80d('0x31')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x3cb9ef));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 4671550..3558f93 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 _0x2ef3=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','post','addDisposition','addAnswer','/:id/notify','/:id/send','send','put','update','delete','removeAnswers'];(function(_0x8d244d,_0x49c04a){var _0x30fcd2=function(_0x167302){while(--_0x167302){_0x8d244d['push'](_0x8d244d['shift']());}};_0x30fcd2(++_0x49c04a);}(_0x2ef3,0xba));var _0x32ef=function(_0x4d899c,_0x5b6dc3){_0x4d899c=_0x4d899c-0x0;var _0x46a3d1=_0x2ef3[_0x4d899c];return _0x46a3d1;};'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['getDispositions']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['get'](_0x32ef('0x12'),auth['isAuthenticated'](),controller[_0x32ef('0x13')]);router['get'](_0x32ef('0x14'),auth[_0x32ef('0xb')](),controller['getApplications']);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x15')](_0x32ef('0xf'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x16')]);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x32ef('0x17')]);router[_0x32ef('0x15')](_0x32ef('0x12'),auth['isAuthenticated'](),controller['addAgents']);router[_0x32ef('0x15')](_0x32ef('0x14'),auth[_0x32ef('0xb')](),controller['addApplications']);router[_0x32ef('0x15')](_0x32ef('0x18'),controller['notify']);router[_0x32ef('0x15')](_0x32ef('0x19'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x1a')]);router[_0x32ef('0x1b')](_0x32ef('0xd'),auth['isAuthenticated'](),controller[_0x32ef('0x1c')]);router['delete'](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller['destroy']);router[_0x32ef('0x1d')](_0x32ef('0xf'),auth[_0x32ef('0xb')](),controller['removeDispositions']);router['delete'](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x1e')]);router['delete']('/:id/users',auth[_0x32ef('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xe2fe=['removeAgents','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','getAgents','/:id/applications','getApplications','post','addDisposition','/:id/canned_answers','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','notify','send','put','destroy','delete','removeDispositions','removeAnswers'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./whatsappAccount.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0x7')](_0xee2f('0xc'),auth['isAuthenticated'](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0xee2f('0x8')](),controller['getAnswers']);router['get']('/:id/users',auth[_0xee2f('0x8')](),controller[_0xee2f('0xd')]);router[_0xee2f('0x7')](_0xee2f('0xe'),auth[_0xee2f('0x8')](),controller[_0xee2f('0xf')]);router['post']('/',auth[_0xee2f('0x8')](),controller['create']);router[_0xee2f('0x10')](_0xee2f('0xc'),auth['isAuthenticated'](),controller[_0xee2f('0x11')]);router[_0xee2f('0x10')](_0xee2f('0x12'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x13')]);router['post'](_0xee2f('0x14'),auth['isAuthenticated'](),controller[_0xee2f('0x15')]);router[_0xee2f('0x10')]('/:id/applications',auth['isAuthenticated'](),controller[_0xee2f('0x16')]);router['post'](_0xee2f('0x17'),controller[_0xee2f('0x18')]);router[_0xee2f('0x10')]('/:id/send',auth[_0xee2f('0x8')](),controller[_0xee2f('0x19')]);router[_0xee2f('0x1a')](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['update']);router['delete'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1b')]);router[_0xee2f('0x1c')](_0xee2f('0xc'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1d')]);router['delete'](_0xee2f('0x12'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1e')]);router[_0xee2f('0x1c')](_0xee2f('0x14'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1f')]);module[_0xee2f('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 6202062..f82997b 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 _0xc235=['mandatoryDisposition','exports','STRING','name','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId'];(function(_0x2a112c,_0x205870){var _0x5b28fb=function(_0x5e9ff4){while(--_0x5e9ff4){_0x2a112c['push'](_0x2a112c['shift']());}};_0x5b28fb(++_0x205870);}(_0xc235,0xe1));var _0x5c23=function(_0x11f0e1,_0x520662){_0x11f0e1=_0x11f0e1-0x0;var _0x383b23=_0xc235[_0x11f0e1];return _0x383b23;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x5c23('0x0')]={'name':{'type':Sequelize[_0x5c23('0x1')],'unique':_0x5c23('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x5c23('0x1')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x5c23('0x1')],'defaultValue':function(){return rs[_0x5c23('0x3')]();}},'phone':{'type':Sequelize[_0x5c23('0x1')]},'type':{'type':Sequelize[_0x5c23('0x4')](_0x5c23('0x5'))},'accountSid':{'type':Sequelize[_0x5c23('0x1')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x5c23('0x6')],'defaultValue':function(){return _0x5c23('0x7');}},'notificationSound':{'type':Sequelize[_0x5c23('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x5c23('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5c23('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5c23('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5c23('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5c23('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5c23('0x9')],'comment':_0x5c23('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x5c23('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x210f04){if(!_0x210f04){this[_0x5c23('0xb')](_0x5c23('0xc'),null);}this[_0x5c23('0xb')](_0x5c23('0xd'),_0x210f04);}},'description':{'type':Sequelize[_0x5c23('0x1')]}}; \ No newline at end of file +var _0xfd4c=['twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','name','STRING','generate','ENUM'];(function(_0x284506,_0x191316){var _0x1e9ee5=function(_0xe7eaa){while(--_0xe7eaa){_0x284506['push'](_0x284506['shift']());}};_0x1e9ee5(++_0x191316);}(_0xfd4c,0x1ad));var _0xcfd4=function(_0x5e20a2,_0x107d30){_0x5e20a2=_0x5e20a2-0x0;var _0x1b7fd7=_0xfd4c[_0x5e20a2];return _0x1b7fd7;};'use strict';var Sequelize=require(_0xcfd4('0x0'));var rs=require(_0xcfd4('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xcfd4('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xcfd4('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xcfd4('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xcfd4('0x3')],'defaultValue':function(){return rs[_0xcfd4('0x4')]();}},'phone':{'type':Sequelize[_0xcfd4('0x3')]},'type':{'type':Sequelize[_0xcfd4('0x5')](_0xcfd4('0x6'))},'accountSid':{'type':Sequelize[_0xcfd4('0x3')]},'authToken':{'type':Sequelize[_0xcfd4('0x3')]},'notificationTemplate':{'type':Sequelize[_0xcfd4('0x7')],'defaultValue':function(){return _0xcfd4('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcfd4('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xcfd4('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcfd4('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcfd4('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcfd4('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcfd4('0x9')],'comment':_0xcfd4('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3e0a53){if(!_0x3e0a53){this[_0xcfd4('0xc')](_0xcfd4('0xd'),null);}this[_0xcfd4('0xc')](_0xcfd4('0xe'),_0x3e0a53);}},'description':{'type':Sequelize[_0xcfd4('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 44d6b32..9f85a46 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 _0xe8a1=['out','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','then','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','info','sendStatus','end','status','json','offset','undefined','count','set','reject','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','WhatsappAccountId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','whatsapp','Applications','account','applications','asc','CmContact','Sequelize','ValidationError','updatedAt','CompanyId','ListId','mobile','twilio','from','whatsapp:','Body','messageId','MessageSid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','close','unmanaged','WhatsappMessage','AttachmentId','UserId','unshift','*,*,*,*','startRouting','Start','receiveMessage','Content-Type','text/xml','\x0a','List'];(function(_0x2a702f,_0x377aa7){var _0x52106f=function(_0x45726f){while(--_0x45726f){_0x2a702f['push'](_0x2a702f['shift']());}};_0x52106f(++_0x377aa7);}(_0xe8a1,0x163));var _0x1e8a=function(_0x4b957a,_0x2392b1){_0x4b957a=_0x4b957a-0x0;var _0x19f75f=_0xe8a1[_0x4b957a];return _0x19f75f;};'use strict';var emlformat=require(_0x1e8a('0x0'));var rimraf=require(_0x1e8a('0x1'));var zipdir=require(_0x1e8a('0x2'));var jsonpatch=require(_0x1e8a('0x3'));var rp=require(_0x1e8a('0x4'));var moment=require(_0x1e8a('0x5'));var BPromise=require(_0x1e8a('0x6'));var Mustache=require('mustache');var util=require(_0x1e8a('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x1e8a('0x8'));var ejs=require(_0x1e8a('0x9'));var fs=require('fs');var fs_extra=require(_0x1e8a('0xa'));var _=require(_0x1e8a('0xb'));var squel=require(_0x1e8a('0xc'));var crypto=require(_0x1e8a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1e8a('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e8a('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1e8a('0x10'));var as=require(_0x1e8a('0x11'));var hardwareService=require(_0x1e8a('0x12'));var logger=require(_0x1e8a('0x13'))(_0x1e8a('0x14'));var utils=require(_0x1e8a('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1e8a('0x16'))['db'];config[_0x1e8a('0x17')]=_[_0x1e8a('0x18')](config['redis'],{'host':_0x1e8a('0x19'),'port':0x18eb});var socket=require(_0x1e8a('0x1a'))(new Redis(config['redis']));require(_0x1e8a('0x1b'))[_0x1e8a('0x1c')](socket);var jayson=require(_0x1e8a('0x1d'));var client=jayson['client'][_0x1e8a('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x576bec,_0x5bcfbd,_0x3e7f52,_0x1508c5){return new BPromise(function(_0x1f0090,_0x3f2c6f){var _0x203356=_0x1508c5||client;return _0x203356['request'](_0x576bec,_0x3e7f52)[_0x1e8a('0x1f')](function(_0x4e9350){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x5bcfbd,_0x1e8a('0x20'));logger[_0x1e8a('0x21')](_0x1e8a('0x22'),_0x5bcfbd,_0x1e8a('0x20'),JSON[_0x1e8a('0x23')](_0x4e9350));if(_0x4e9350[_0x1e8a('0x24')]){if(_0x4e9350[_0x1e8a('0x24')]['code']===0x1f4){logger[_0x1e8a('0x24')](_0x1e8a('0x25'),_0x5bcfbd,_0x4e9350[_0x1e8a('0x24')][_0x1e8a('0x26')]);return _0x3f2c6f(_0x4e9350[_0x1e8a('0x24')][_0x1e8a('0x26')]);}logger[_0x1e8a('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x5bcfbd,_0x4e9350[_0x1e8a('0x24')][_0x1e8a('0x26')]);return _0x1f0090(_0x4e9350[_0x1e8a('0x24')][_0x1e8a('0x26')]);}else{logger[_0x1e8a('0x27')](_0x1e8a('0x25'),_0x5bcfbd,_0x1e8a('0x20'));_0x1f0090(_0x4e9350['result'][_0x1e8a('0x26')]);}})['catch'](function(_0x4198ec){logger['error'](_0x1e8a('0x25'),_0x5bcfbd,_0x4198ec);_0x3f2c6f(_0x4198ec);});});}function respondWithStatusCode(_0x26988b,_0x429452){_0x429452=_0x429452||0xcc;return function(_0x3e4ab3){if(_0x3e4ab3){return _0x26988b[_0x1e8a('0x28')](_0x429452);}return _0x26988b['status'](_0x429452)[_0x1e8a('0x29')]();};}function respondWithResult(_0x318ddc,_0x148ccc){_0x148ccc=_0x148ccc||0xc8;return function(_0x1f1e3b){if(_0x1f1e3b){return _0x318ddc[_0x1e8a('0x2a')](_0x148ccc)[_0x1e8a('0x2b')](_0x1f1e3b);}};}function respondWithFilteredResult(_0x5d6e3f,_0x116718){return function(_0x5e75c1){if(_0x5e75c1){var _0x23774f=typeof _0x116718[_0x1e8a('0x2c')]===_0x1e8a('0x2d')&&typeof _0x116718['limit']===_0x1e8a('0x2d');var _0xa27e64=_0x5e75c1['count'];var _0x54a11e=_0x23774f?0x0:_0x116718[_0x1e8a('0x2c')];var _0x3bd9a7=_0x23774f?_0x5e75c1[_0x1e8a('0x2e')]:_0x116718[_0x1e8a('0x2c')]+_0x116718['limit'];var _0x3c983e;if(_0x3bd9a7>=_0xa27e64){_0x3bd9a7=_0xa27e64;_0x3c983e=0xc8;}else{_0x3c983e=0xce;}_0x5d6e3f[_0x1e8a('0x2a')](_0x3c983e);return _0x5d6e3f[_0x1e8a('0x2f')]('Content-Range',_0x54a11e+'-'+_0x3bd9a7+'/'+_0xa27e64)['json'](_0x5e75c1);}return null;};}function patchUpdates(_0x477eff){return function(_0x68441e){try{jsonpatch['apply'](_0x68441e,_0x477eff,!![]);}catch(_0x442d61){return BPromise[_0x1e8a('0x30')](_0x442d61);}return _0x68441e['save']();};}function saveUpdates(_0x429a4e,_0x46152b){return function(_0x56af07){if(_0x56af07){return _0x56af07['update'](_0x429a4e)[_0x1e8a('0x1f')](function(_0x3daa1d){return _0x3daa1d;});}return null;};}function removeEntity(_0x365ea7,_0x2224af){return function(_0x683148){if(_0x683148){return _0x683148[_0x1e8a('0x31')]()[_0x1e8a('0x1f')](function(){var _0x3468e5=_0x683148[_0x1e8a('0x32')]({'plain':!![]});var _0x1216bd=_0x1e8a('0x33');return db[_0x1e8a('0x34')][_0x1e8a('0x31')]({'where':{'type':_0x1216bd,'resourceId':_0x3468e5['id']}})['then'](function(){return _0x683148;});})['then'](function(){_0x365ea7['status'](0xcc)[_0x1e8a('0x29')]();});}};}function handleEntityNotFound(_0x469109,_0x369e48){return function(_0x3f9099){if(!_0x3f9099){_0x469109[_0x1e8a('0x28')](0x194);}return _0x3f9099;};}function handleError(_0x50212f,_0x3b76c7){_0x3b76c7=_0x3b76c7||0x1f4;return function(_0x378807){logger[_0x1e8a('0x24')](_0x378807[_0x1e8a('0x35')]);if(_0x378807['name']){delete _0x378807[_0x1e8a('0x36')];}_0x50212f[_0x1e8a('0x2a')](_0x3b76c7)[_0x1e8a('0x37')](_0x378807);};}exports['index']=function(_0x2dcaaf,_0x3d61ae){var _0x5c5d90={'include':[{'model':db[_0x1e8a('0x38')],'as':_0x1e8a('0x39')}]},_0x8c48ee={},_0x16a41b={'count':0x0,'rows':[]};var _0x5e299a=_[_0x1e8a('0x3a')](db[_0x1e8a('0x3b')][_0x1e8a('0x3c')],function(_0x5af2f6){return{'name':_0x5af2f6['fieldName'],'type':_0x5af2f6[_0x1e8a('0x3d')][_0x1e8a('0x3e')]};});_0x8c48ee['model']=_[_0x1e8a('0x3a')](_0x5e299a,_0x1e8a('0x36'));_0x8c48ee['query']=_['keys'](_0x2dcaaf[_0x1e8a('0x3f')]);_0x8c48ee[_0x1e8a('0x40')]=_[_0x1e8a('0x41')](_0x8c48ee[_0x1e8a('0x42')],_0x8c48ee[_0x1e8a('0x3f')]);_0x5c5d90[_0x1e8a('0x43')]=_[_0x1e8a('0x41')](_0x8c48ee[_0x1e8a('0x42')],qs['fields'](_0x2dcaaf[_0x1e8a('0x3f')][_0x1e8a('0x44')]));_0x5c5d90[_0x1e8a('0x43')]=_0x5c5d90[_0x1e8a('0x43')][_0x1e8a('0x45')]?_0x5c5d90[_0x1e8a('0x43')]:_0x8c48ee['model'];if(!_0x2dcaaf[_0x1e8a('0x3f')][_0x1e8a('0x46')](_0x1e8a('0x47'))){_0x5c5d90[_0x1e8a('0x48')]=qs[_0x1e8a('0x48')](_0x2dcaaf[_0x1e8a('0x3f')][_0x1e8a('0x48')]);_0x5c5d90[_0x1e8a('0x2c')]=qs[_0x1e8a('0x2c')](_0x2dcaaf[_0x1e8a('0x3f')]['offset']);}_0x5c5d90[_0x1e8a('0x49')]=qs[_0x1e8a('0x4a')](_0x2dcaaf[_0x1e8a('0x3f')][_0x1e8a('0x4a')]);_0x5c5d90[_0x1e8a('0x4b')]=qs[_0x1e8a('0x40')](_[_0x1e8a('0x4c')](_0x2dcaaf[_0x1e8a('0x3f')],_0x8c48ee['filters']),_0x5e299a);if(_0x2dcaaf['query'][_0x1e8a('0x4d')]){_0x5c5d90[_0x1e8a('0x4b')]=_[_0x1e8a('0x4e')](_0x5c5d90[_0x1e8a('0x4b')],{'$or':_['map'](_0x5e299a,function(_0x44a67c){if(_0x44a67c[_0x1e8a('0x3d')]!==_0x1e8a('0x4f')){var _0x42c113={};_0x42c113[_0x44a67c[_0x1e8a('0x36')]]={'$like':'%'+_0x2dcaaf[_0x1e8a('0x3f')][_0x1e8a('0x4d')]+'%'};return _0x42c113;}})});}_0x5c5d90=_[_0x1e8a('0x4e')]({},_0x5c5d90,_0x2dcaaf[_0x1e8a('0x50')]);var _0x10acef={'where':_0x5c5d90[_0x1e8a('0x4b')]};return db[_0x1e8a('0x3b')]['count'](_0x10acef)[_0x1e8a('0x1f')](function(_0x3b9b45){_0x16a41b[_0x1e8a('0x2e')]=_0x3b9b45;if(_0x2dcaaf[_0x1e8a('0x3f')][_0x1e8a('0x51')]){_0x5c5d90[_0x1e8a('0x52')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x1e8a('0x53')](_0x5c5d90);})[_0x1e8a('0x1f')](function(_0x24ef7e){_0x16a41b['rows']=_0x24ef7e;return _0x16a41b;})[_0x1e8a('0x1f')](respondWithFilteredResult(_0x3d61ae,_0x5c5d90))['catch'](handleError(_0x3d61ae,null));};exports[_0x1e8a('0x54')]=function(_0x48d894,_0x2e0eb4){var _0xe3c749={'raw':![],'where':{'id':_0x48d894[_0x1e8a('0x55')]['id']},'include':[{'model':db[_0x1e8a('0x38')],'as':'mandatoryDispositionPause'}]},_0x1c67eb={};_0x1c67eb[_0x1e8a('0x42')]=_['keys'](db[_0x1e8a('0x3b')]['rawAttributes']);_0x1c67eb['query']=_[_0x1e8a('0x56')](_0x48d894[_0x1e8a('0x3f')]);_0x1c67eb[_0x1e8a('0x40')]=_[_0x1e8a('0x41')](_0x1c67eb[_0x1e8a('0x42')],_0x1c67eb[_0x1e8a('0x3f')]);_0xe3c749[_0x1e8a('0x43')]=_[_0x1e8a('0x41')](_0x1c67eb['model'],qs[_0x1e8a('0x44')](_0x48d894[_0x1e8a('0x3f')][_0x1e8a('0x44')]));_0xe3c749[_0x1e8a('0x43')]=_0xe3c749[_0x1e8a('0x43')][_0x1e8a('0x45')]?_0xe3c749[_0x1e8a('0x43')]:_0x1c67eb['model'];if(_0x48d894['query']['includeAll']){_0xe3c749[_0x1e8a('0x52')]=[{'all':!![]}];}_0xe3c749=_[_0x1e8a('0x4e')]({},_0xe3c749,_0x48d894[_0x1e8a('0x50')]);return db['WhatsappAccount']['find'](_0xe3c749)['then'](handleEntityNotFound(_0x2e0eb4,null))['then'](respondWithResult(_0x2e0eb4,null))['catch'](handleError(_0x2e0eb4,null));};exports[_0x1e8a('0x57')]=function(_0x775b8c,_0x33bc71){return db[_0x1e8a('0x3b')][_0x1e8a('0x57')](_0x775b8c[_0x1e8a('0x58')],{})[_0x1e8a('0x1f')](function(_0x5454b5){var _0xcf7210=_0x775b8c[_0x1e8a('0x59')][_0x1e8a('0x32')]({'plain':!![]});if(!_0xcf7210)throw new Error(_0x1e8a('0x5a'));if(_0xcf7210[_0x1e8a('0x5b')]===_0x1e8a('0x59')){var _0x1344dd=_0x5454b5[_0x1e8a('0x32')]({'plain':!![]});var _0xa6809f=_0x1e8a('0x33');return db[_0x1e8a('0x5c')][_0x1e8a('0x5d')]({'where':{'name':_0xa6809f,'userProfileId':_0xcf7210[_0x1e8a('0x5e')]},'raw':!![]})[_0x1e8a('0x1f')](function(_0x1ef3b4){if(_0x1ef3b4&&_0x1ef3b4[_0x1e8a('0x5f')]===0x0){return db[_0x1e8a('0x34')][_0x1e8a('0x57')]({'name':_0x1344dd[_0x1e8a('0x36')],'resourceId':_0x1344dd['id'],'type':_0x1ef3b4[_0x1e8a('0x36')],'sectionId':_0x1ef3b4['id']},{})[_0x1e8a('0x1f')](function(){return _0x5454b5;});}else{return _0x5454b5;}})[_0x1e8a('0x60')](function(_0x29f028){logger[_0x1e8a('0x24')](_0x1e8a('0x61'),_0x29f028);throw _0x29f028;});}return _0x5454b5;})[_0x1e8a('0x1f')](respondWithResult(_0x33bc71,0xc9))[_0x1e8a('0x60')](handleError(_0x33bc71,null));};exports['update']=function(_0x526be8,_0x2b15b3){if(_0x526be8['body']['id']){delete _0x526be8[_0x1e8a('0x58')]['id'];}return db[_0x1e8a('0x3b')][_0x1e8a('0x5d')]({'where':{'id':_0x526be8[_0x1e8a('0x55')]['id']},'include':[{'model':db[_0x1e8a('0x38')],'as':'mandatoryDispositionPause'}]})[_0x1e8a('0x1f')](handleEntityNotFound(_0x2b15b3,null))[_0x1e8a('0x1f')](saveUpdates(_0x526be8[_0x1e8a('0x58')],null))[_0x1e8a('0x1f')](respondWithResult(_0x2b15b3,null))[_0x1e8a('0x60')](handleError(_0x2b15b3,null));};exports[_0x1e8a('0x31')]=function(_0x399be8,_0x5ad627){return db[_0x1e8a('0x3b')][_0x1e8a('0x5d')]({'where':{'id':_0x399be8[_0x1e8a('0x55')]['id']}})[_0x1e8a('0x1f')](handleEntityNotFound(_0x5ad627,null))['then'](removeEntity(_0x5ad627,null))[_0x1e8a('0x60')](handleError(_0x5ad627,null));};exports[_0x1e8a('0x62')]=function(_0x31be90,_0x407cd4){return db[_0x1e8a('0x3b')][_0x1e8a('0x62')]()['then'](respondWithResult(_0x407cd4,null))[_0x1e8a('0x60')](handleError(_0x407cd4,null));};exports['addDisposition']=function(_0x1fa7a9,_0x4d0212,_0x5874c0){if(_0x1fa7a9[_0x1e8a('0x58')]['id']){delete _0x1fa7a9[_0x1e8a('0x58')]['id'];}return db[_0x1e8a('0x3b')][_0x1e8a('0x5d')]({'where':{'id':_0x1fa7a9[_0x1e8a('0x55')]['id']}})[_0x1e8a('0x1f')](handleEntityNotFound(_0x4d0212,null))[_0x1e8a('0x1f')](function(_0xa99a3a){if(_0xa99a3a){_0x1fa7a9[_0x1e8a('0x58')][_0x1e8a('0x63')]=_0xa99a3a['id'];return db[_0x1e8a('0x64')]['create'](_0x1fa7a9[_0x1e8a('0x58')]);}})[_0x1e8a('0x1f')](respondWithResult(_0x4d0212,null))[_0x1e8a('0x60')](handleError(_0x4d0212,null));};exports[_0x1e8a('0x65')]=function(_0x505459,_0x250b45,_0x3ad266){var _0x4d9b10={'raw':![],'where':{}};var _0x17da20={};var _0x65af7e={'count':0x0,'rows':[]};return db[_0x1e8a('0x3b')][_0x1e8a('0x66')]({'where':{'id':_0x505459[_0x1e8a('0x55')]['id']}})[_0x1e8a('0x1f')](handleEntityNotFound(_0x250b45,null))[_0x1e8a('0x1f')](function(_0x37cf46){if(_0x37cf46){_0x17da20[_0x1e8a('0x42')]=_['keys'](db[_0x1e8a('0x64')][_0x1e8a('0x3c')]);_0x17da20[_0x1e8a('0x3f')]=_[_0x1e8a('0x56')](_0x505459[_0x1e8a('0x3f')]);_0x17da20['filters']=_[_0x1e8a('0x41')](_0x17da20[_0x1e8a('0x42')],_0x17da20[_0x1e8a('0x3f')]);_0x4d9b10[_0x1e8a('0x43')]=_[_0x1e8a('0x41')](_0x17da20['model'],qs[_0x1e8a('0x44')](_0x505459[_0x1e8a('0x3f')][_0x1e8a('0x44')]));_0x4d9b10[_0x1e8a('0x43')]=_0x4d9b10['attributes'][_0x1e8a('0x45')]?_0x4d9b10[_0x1e8a('0x43')]:_0x17da20[_0x1e8a('0x42')];if(!_0x505459[_0x1e8a('0x3f')][_0x1e8a('0x46')](_0x1e8a('0x47'))){_0x4d9b10['limit']=qs[_0x1e8a('0x48')](_0x505459[_0x1e8a('0x3f')][_0x1e8a('0x48')]);_0x4d9b10[_0x1e8a('0x2c')]=qs['offset'](_0x505459[_0x1e8a('0x3f')]['offset']);}_0x4d9b10[_0x1e8a('0x49')]=qs[_0x1e8a('0x4a')](_0x505459[_0x1e8a('0x3f')][_0x1e8a('0x4a')]);_0x4d9b10[_0x1e8a('0x4b')]=qs['filters'](_[_0x1e8a('0x4c')](_0x505459[_0x1e8a('0x3f')],_0x17da20['filters']));_0x4d9b10[_0x1e8a('0x4b')][_0x1e8a('0x63')]=_0x37cf46['id'];if(_0x505459['query'][_0x1e8a('0x4d')]){_0x4d9b10[_0x1e8a('0x4b')]=_[_0x1e8a('0x4e')](_0x4d9b10[_0x1e8a('0x4b')],{'$or':_['map'](_0x4d9b10[_0x1e8a('0x43')],function(_0x595fb0){var _0x366706={};_0x366706[_0x595fb0]={'$like':'%'+_0x505459[_0x1e8a('0x3f')][_0x1e8a('0x4d')]+'%'};return _0x366706;})});}_0x4d9b10=_[_0x1e8a('0x4e')]({},_0x4d9b10,_0x505459['options']);return db[_0x1e8a('0x64')]['count']({'where':_0x4d9b10['where']})[_0x1e8a('0x1f')](function(_0x5d44b8){_0x65af7e[_0x1e8a('0x2e')]=_0x5d44b8;if(_0x505459[_0x1e8a('0x3f')]['includeAll']){_0x4d9b10[_0x1e8a('0x52')]=[{'all':!![]}];}return db[_0x1e8a('0x64')][_0x1e8a('0x53')](_0x4d9b10);})['then'](function(_0x597086){_0x65af7e[_0x1e8a('0x67')]=_0x597086;return _0x65af7e;});}})[_0x1e8a('0x1f')](respondWithFilteredResult(_0x250b45,_0x4d9b10))[_0x1e8a('0x60')](handleError(_0x250b45,null));};exports[_0x1e8a('0x68')]=function(_0x2f97a2,_0x2e14b1,_0x1da90a){return db[_0x1e8a('0x3b')][_0x1e8a('0x5d')]({'where':{'id':_0x2f97a2['params']['id']}})[_0x1e8a('0x1f')](handleEntityNotFound(_0x2e14b1,null))[_0x1e8a('0x1f')](function(_0x1e2b9b){if(_0x1e2b9b){return _0x1e2b9b[_0x1e8a('0x68')](_0x2f97a2[_0x1e8a('0x3f')][_0x1e8a('0x69')]);}})[_0x1e8a('0x1f')](respondWithStatusCode(_0x2e14b1,null))[_0x1e8a('0x60')](handleError(_0x2e14b1,null));};exports[_0x1e8a('0x6a')]=function(_0x437946,_0x10d423,_0x576e74){if(_0x437946['body']['id']){delete _0x437946['body']['id'];}return db['WhatsappAccount'][_0x1e8a('0x5d')]({'where':{'id':_0x437946[_0x1e8a('0x55')]['id']}})[_0x1e8a('0x1f')](handleEntityNotFound(_0x10d423,null))[_0x1e8a('0x1f')](function(_0x2583ba){if(_0x2583ba){_0x437946[_0x1e8a('0x58')][_0x1e8a('0x63')]=_0x2583ba['id'];return db[_0x1e8a('0x6b')][_0x1e8a('0x57')](_0x437946[_0x1e8a('0x58')]);}})['then'](respondWithResult(_0x10d423,null))[_0x1e8a('0x60')](handleError(_0x10d423,null));};exports[_0x1e8a('0x6c')]=function(_0x39765c,_0x8f752f,_0x5e5d66){var _0x1fcd10={'raw':![],'where':{}};var _0x2daa18={};var _0x3ac158={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x1e8a('0x66')]({'where':{'id':_0x39765c['params']['id']}})['then'](handleEntityNotFound(_0x8f752f,null))['then'](function(_0x1c2c20){if(_0x1c2c20){_0x2daa18[_0x1e8a('0x42')]=_['keys'](db[_0x1e8a('0x6b')][_0x1e8a('0x3c')]);_0x2daa18['query']=_[_0x1e8a('0x56')](_0x39765c[_0x1e8a('0x3f')]);_0x2daa18['filters']=_['intersection'](_0x2daa18[_0x1e8a('0x42')],_0x2daa18[_0x1e8a('0x3f')]);_0x1fcd10[_0x1e8a('0x43')]=_[_0x1e8a('0x41')](_0x2daa18[_0x1e8a('0x42')],qs[_0x1e8a('0x44')](_0x39765c[_0x1e8a('0x3f')][_0x1e8a('0x44')]));_0x1fcd10[_0x1e8a('0x43')]=_0x1fcd10[_0x1e8a('0x43')][_0x1e8a('0x45')]?_0x1fcd10[_0x1e8a('0x43')]:_0x2daa18['model'];if(!_0x39765c[_0x1e8a('0x3f')][_0x1e8a('0x46')](_0x1e8a('0x47'))){_0x1fcd10[_0x1e8a('0x48')]=qs[_0x1e8a('0x48')](_0x39765c[_0x1e8a('0x3f')][_0x1e8a('0x48')]);_0x1fcd10[_0x1e8a('0x2c')]=qs[_0x1e8a('0x2c')](_0x39765c['query'][_0x1e8a('0x2c')]);}_0x1fcd10['order']=qs[_0x1e8a('0x4a')](_0x39765c[_0x1e8a('0x3f')]['sort']);_0x1fcd10[_0x1e8a('0x4b')]=qs[_0x1e8a('0x40')](_[_0x1e8a('0x4c')](_0x39765c['query'],_0x2daa18[_0x1e8a('0x40')]));_0x1fcd10[_0x1e8a('0x4b')][_0x1e8a('0x63')]=_0x1c2c20['id'];if(_0x39765c[_0x1e8a('0x3f')][_0x1e8a('0x4d')]){_0x1fcd10[_0x1e8a('0x4b')]=_[_0x1e8a('0x4e')](_0x1fcd10[_0x1e8a('0x4b')],{'$or':_[_0x1e8a('0x3a')](_0x1fcd10[_0x1e8a('0x43')],function(_0x4c7731){var _0x5a4fc6={};_0x5a4fc6[_0x4c7731]={'$like':'%'+_0x39765c[_0x1e8a('0x3f')][_0x1e8a('0x4d')]+'%'};return _0x5a4fc6;})});}_0x1fcd10=_[_0x1e8a('0x4e')]({},_0x1fcd10,_0x39765c[_0x1e8a('0x50')]);return db[_0x1e8a('0x6b')][_0x1e8a('0x2e')]({'where':_0x1fcd10['where']})[_0x1e8a('0x1f')](function(_0x470475){_0x3ac158['count']=_0x470475;if(_0x39765c[_0x1e8a('0x3f')][_0x1e8a('0x51')]){_0x1fcd10[_0x1e8a('0x52')]=[{'all':!![]}];}return db[_0x1e8a('0x6b')][_0x1e8a('0x53')](_0x1fcd10);})['then'](function(_0x43889f){_0x3ac158['rows']=_0x43889f;return _0x3ac158;});}})[_0x1e8a('0x1f')](respondWithFilteredResult(_0x8f752f,_0x1fcd10))[_0x1e8a('0x60')](handleError(_0x8f752f,null));};exports['removeAnswers']=function(_0x3f379a,_0x23221e,_0x39bc50){return db[_0x1e8a('0x3b')][_0x1e8a('0x5d')]({'where':{'id':_0x3f379a[_0x1e8a('0x55')]['id']}})[_0x1e8a('0x1f')](handleEntityNotFound(_0x23221e,null))[_0x1e8a('0x1f')](function(_0x4da035){if(_0x4da035){return _0x4da035[_0x1e8a('0x6d')](_0x3f379a[_0x1e8a('0x3f')][_0x1e8a('0x69')]);}})[_0x1e8a('0x1f')](respondWithStatusCode(_0x23221e,null))[_0x1e8a('0x60')](handleError(_0x23221e,null));};exports[_0x1e8a('0x6e')]=function(_0x3debcb,_0x268fb5,_0x1fa561){return db['WhatsappAccount'][_0x1e8a('0x5d')]({'where':{'id':_0x3debcb[_0x1e8a('0x55')]['id']}})['then'](handleEntityNotFound(_0x268fb5,null))[_0x1e8a('0x1f')](function(_0x41aab6){if(_0x41aab6){return _0x41aab6['addAgents'](_0x3debcb[_0x1e8a('0x58')][_0x1e8a('0x69')],_[_0x1e8a('0x6f')](_0x3debcb[_0x1e8a('0x58')],[_0x1e8a('0x69'),'id'])||{})[_0x1e8a('0x70')](function(_0x521e0b){for(var _0x15ba49=0x0;_0x15ba49<_0x3debcb[_0x1e8a('0x58')]['ids']['length'];_0x15ba49+=0x1){socket[_0x1e8a('0x71')](_0x1e8a('0x72'),{'UserId':Number(_0x3debcb[_0x1e8a('0x58')][_0x1e8a('0x69')][_0x15ba49]),'WhatsappAccountId':Number(_0x3debcb['params']['id'])});}return _0x521e0b;});}})[_0x1e8a('0x1f')](respondWithResult(_0x268fb5,null))[_0x1e8a('0x60')](handleError(_0x268fb5,null));};exports[_0x1e8a('0x73')]=function(_0x310707,_0x283f36,_0x1fa988){return db[_0x1e8a('0x3b')][_0x1e8a('0x5d')]({'where':{'id':_0x310707[_0x1e8a('0x55')]['id']}})['then'](handleEntityNotFound(_0x283f36,null))[_0x1e8a('0x1f')](function(_0xd8c9c1){if(_0xd8c9c1){return _0xd8c9c1[_0x1e8a('0x73')](_0x310707[_0x1e8a('0x3f')]['ids'])[_0x1e8a('0x1f')](function(){if(_[_0x1e8a('0x74')](_0x310707['query'][_0x1e8a('0x69')])){for(var _0x179b4c=0x0;_0x179b4c<_0x310707[_0x1e8a('0x3f')]['ids'][_0x1e8a('0x45')];_0x179b4c+=0x1){socket[_0x1e8a('0x71')](_0x1e8a('0x75'),{'UserId':Number(_0x310707[_0x1e8a('0x3f')][_0x1e8a('0x69')][_0x179b4c]),'WhatsappAccountId':Number(_0x310707[_0x1e8a('0x55')]['id'])});}}else{socket[_0x1e8a('0x71')](_0x1e8a('0x75'),{'UserId':Number(_0x310707[_0x1e8a('0x3f')][_0x1e8a('0x69')]),'WhatsappAccountId':Number(_0x310707['params']['id'])});}});}})[_0x1e8a('0x1f')](respondWithStatusCode(_0x283f36,null))[_0x1e8a('0x60')](handleError(_0x283f36,null));};exports[_0x1e8a('0x76')]=function(_0x1259bc,_0x56de42,_0xd7e2b1){var _0x518c5a={};var _0x35682b={};var _0x1cba9d;var _0x22a345;return db[_0x1e8a('0x3b')]['findOne']({'where':{'id':_0x1259bc[_0x1e8a('0x55')]['id']}})[_0x1e8a('0x1f')](handleEntityNotFound(_0x56de42,null))['then'](function(_0x8ce8a0){if(_0x8ce8a0){_0x1cba9d=_0x8ce8a0;_0x35682b[_0x1e8a('0x42')]=_[_0x1e8a('0x56')](db[_0x1e8a('0x77')][_0x1e8a('0x3c')]);_0x35682b['query']=_[_0x1e8a('0x56')](_0x1259bc[_0x1e8a('0x3f')]);_0x35682b[_0x1e8a('0x40')]=_['intersection'](_0x35682b[_0x1e8a('0x42')],_0x35682b['query']);_0x518c5a['attributes']=_[_0x1e8a('0x41')](_0x35682b[_0x1e8a('0x42')],qs[_0x1e8a('0x44')](_0x1259bc[_0x1e8a('0x3f')][_0x1e8a('0x44')]));_0x518c5a[_0x1e8a('0x43')]=_0x518c5a['attributes'][_0x1e8a('0x45')]?_0x518c5a[_0x1e8a('0x43')]:_0x35682b[_0x1e8a('0x42')];_0x518c5a[_0x1e8a('0x49')]=qs['sort'](_0x1259bc[_0x1e8a('0x3f')][_0x1e8a('0x4a')]);_0x518c5a['where']=qs['filters'](_[_0x1e8a('0x4c')](_0x1259bc[_0x1e8a('0x3f')],_0x35682b[_0x1e8a('0x40')]));if(_0x1259bc[_0x1e8a('0x3f')][_0x1e8a('0x4d')]){_0x518c5a[_0x1e8a('0x4b')]=_[_0x1e8a('0x4e')](_0x518c5a[_0x1e8a('0x4b')],{'$or':_[_0x1e8a('0x3a')](_0x518c5a[_0x1e8a('0x43')],function(_0x15dcd){var _0x2e3711={};_0x2e3711[_0x15dcd]={'$like':'%'+_0x1259bc['query']['filter']+'%'};return _0x2e3711;})});}_0x518c5a=_[_0x1e8a('0x4e')]({},_0x518c5a,_0x1259bc[_0x1e8a('0x50')]);return _0x1cba9d[_0x1e8a('0x76')](_0x518c5a);}})[_0x1e8a('0x1f')](function(_0x4fb29b){if(_0x4fb29b){_0x22a345=_0x4fb29b[_0x1e8a('0x45')];if(!_0x1259bc[_0x1e8a('0x3f')][_0x1e8a('0x46')](_0x1e8a('0x47'))){_0x518c5a['limit']=qs[_0x1e8a('0x48')](_0x1259bc[_0x1e8a('0x3f')][_0x1e8a('0x48')]);_0x518c5a[_0x1e8a('0x2c')]=qs[_0x1e8a('0x2c')](_0x1259bc['query'][_0x1e8a('0x2c')]);}return _0x1cba9d['getAgents'](_0x518c5a);}})[_0x1e8a('0x1f')](function(_0x3d79d6){if(_0x3d79d6){return _0x3d79d6?{'count':_0x22a345,'rows':_0x3d79d6}:null;}})[_0x1e8a('0x1f')](respondWithResult(_0x56de42,null))[_0x1e8a('0x60')](handleError(_0x56de42,null));};exports[_0x1e8a('0x78')]=function(_0x19b453,_0x246cd5,_0x1ce178){return db['WhatsappAccount'][_0x1e8a('0x66')]({'where':{'id':_0x19b453['params']['id']}})[_0x1e8a('0x1f')](handleEntityNotFound(_0x246cd5,null))[_0x1e8a('0x1f')](function(_0x4499a1){if(_0x4499a1){return db['sequelize'][_0x1e8a('0x79')](function(_0x2f9e1e){return db[_0x1e8a('0x7a')][_0x1e8a('0x31')]({'where':{'WhatsappAccountId':_0x19b453[_0x1e8a('0x55')]['id']},'transaction':_0x2f9e1e})['then'](function(_0x1aaaac){var _0x2c733a=_[_0x1e8a('0x3a')](_0x19b453[_0x1e8a('0x58')],function(_0xb7cb90){_0xb7cb90[_0x1e8a('0x63')]=_0x19b453[_0x1e8a('0x55')]['id'];return _0xb7cb90;});return db[_0x1e8a('0x7a')][_0x1e8a('0x7b')](_0x2c733a,{'transaction':_0x2f9e1e});});})[_0x1e8a('0x1f')](function(){return db[_0x1e8a('0x7a')][_0x1e8a('0x7c')]({'where':{'WhatsappAccountId':_0x19b453[_0x1e8a('0x55')]['id']},'order':_0x1e8a('0x7d')});});}})[_0x1e8a('0x1f')](respondWithResult(_0x246cd5,null))[_0x1e8a('0x60')](handleError(_0x246cd5,null));};exports['getApplications']=function(_0x25a891,_0x3492ad,_0x3c4af5){var _0xdfa814={};var _0x1bbe57={};var _0x208994;var _0x31e234;return db[_0x1e8a('0x3b')][_0x1e8a('0x66')]({'where':{'id':_0x25a891[_0x1e8a('0x55')]['id']}})[_0x1e8a('0x1f')](handleEntityNotFound(_0x3492ad,null))['then'](function(_0x24b03b){if(_0x24b03b){_0x208994=_0x24b03b;_0x1bbe57[_0x1e8a('0x42')]=_[_0x1e8a('0x56')](db['WhatsappApplication'][_0x1e8a('0x3c')]);_0x1bbe57[_0x1e8a('0x3f')]=_['keys'](_0x25a891[_0x1e8a('0x3f')]);_0x1bbe57['filters']=_[_0x1e8a('0x41')](_0x1bbe57[_0x1e8a('0x42')],_0x1bbe57[_0x1e8a('0x3f')]);_0xdfa814['attributes']=_[_0x1e8a('0x41')](_0x1bbe57[_0x1e8a('0x42')],qs[_0x1e8a('0x44')](_0x25a891[_0x1e8a('0x3f')][_0x1e8a('0x44')]));_0xdfa814[_0x1e8a('0x43')]=_0xdfa814[_0x1e8a('0x43')][_0x1e8a('0x45')]?_0xdfa814[_0x1e8a('0x43')]:_0x1bbe57[_0x1e8a('0x42')];_0xdfa814['order']=qs[_0x1e8a('0x4a')](_0x25a891['query'][_0x1e8a('0x4a')]);_0xdfa814[_0x1e8a('0x4b')]=qs[_0x1e8a('0x40')](_['pick'](_0x25a891[_0x1e8a('0x3f')],_0x1bbe57[_0x1e8a('0x40')]));if(_0x25a891['query'][_0x1e8a('0x4d')]){_0xdfa814[_0x1e8a('0x4b')]=_[_0x1e8a('0x4e')](_0xdfa814['where'],{'$or':_[_0x1e8a('0x3a')](_0xdfa814[_0x1e8a('0x43')],function(_0x32a80c){var _0x5a3321={};_0x5a3321[_0x32a80c]={'$like':'%'+_0x25a891[_0x1e8a('0x3f')][_0x1e8a('0x4d')]+'%'};return _0x5a3321;})});}_0xdfa814=_[_0x1e8a('0x4e')]({},_0xdfa814,_0x25a891[_0x1e8a('0x50')]);return _0x208994['getApplications'](_0xdfa814);}})[_0x1e8a('0x1f')](function(_0x481e0d){if(_0x481e0d){_0x31e234=_0x481e0d[_0x1e8a('0x45')];if(!_0x25a891[_0x1e8a('0x3f')][_0x1e8a('0x46')](_0x1e8a('0x47'))){_0xdfa814[_0x1e8a('0x48')]=qs[_0x1e8a('0x48')](_0x25a891['query'][_0x1e8a('0x48')]);_0xdfa814['offset']=qs['offset'](_0x25a891['query']['offset']);}return _0x208994[_0x1e8a('0x7e')](_0xdfa814);}})[_0x1e8a('0x1f')](function(_0x2beefb){if(_0x2beefb){return _0x2beefb?{'count':_0x31e234,'rows':_0x2beefb}:null;}})['then'](respondWithResult(_0x3492ad,null))[_0x1e8a('0x60')](handleError(_0x3492ad,null));};exports['notify']=function(_0x5f1579,_0x35ee86,_0x49aa6e){var _0x58a8b4={'channel':_0x1e8a('0x7f')};var _0x58b71b=[];var _0x1b53fa=[];var _0x1b7a90={};return db[_0x1e8a('0x3b')][_0x1e8a('0x5d')]({'where':{'id':_0x5f1579[_0x1e8a('0x55')]['id']},'include':[{'model':db[_0x1e8a('0x7a')],'as':_0x1e8a('0x80')}]})[_0x1e8a('0x1f')](handleEntityNotFound(_0x35ee86,null))[_0x1e8a('0x1f')](function(_0x5b55b1){_0x58a8b4[_0x1e8a('0x81')]=_0x5b55b1;_0x58a8b4[_0x1e8a('0x82')]=_['orderBy'](_0x5b55b1['Applications'],[_0x1e8a('0x7d')],[_0x1e8a('0x83')]);if(_0x58a8b4[_0x1e8a('0x81')][_0x1e8a('0x80')]){delete _0x58a8b4[_0x1e8a('0x81')]['Applications'];}return db[_0x1e8a('0x84')][_0x1e8a('0x62')]();})[_0x1e8a('0x1f')](function(_0x15a2d6){if(!_0x15a2d6){throw new db[(_0x1e8a('0x85'))][(_0x1e8a('0x86'))]('no\x20available\x20attributes');}_0x58b71b=_['difference'](_[_0x1e8a('0x56')](_0x15a2d6),['createdAt','updatedAt']);_0x1b53fa=_['difference'](_['keys'](_0x15a2d6),['createdAt',_0x1e8a('0x87'),_0x1e8a('0x88'),_0x1e8a('0x89')]);_0x58a8b4['body']={'mapKey':_0x1e8a('0x8a')};if(_0x58a8b4[_0x1e8a('0x81')][_0x1e8a('0x3d')]&&_0x58a8b4[_0x1e8a('0x81')][_0x1e8a('0x3d')]===_0x1e8a('0x8b')){_0x58a8b4['body'][_0x1e8a('0x8c')]=_0x5f1579[_0x1e8a('0x58')]['From']['replace'](_0x1e8a('0x8d'),'');_0x58a8b4['body'][_0x1e8a('0x58')]=_0x5f1579['body'][_0x1e8a('0x8e')];_0x58a8b4[_0x1e8a('0x58')][_0x1e8a('0x8f')]=_0x5f1579[_0x1e8a('0x58')][_0x1e8a('0x90')];}if(_0x58a8b4[_0x1e8a('0x58')]['id']){delete _0x58a8b4[_0x1e8a('0x58')]['id'];}if(_[_0x1e8a('0x91')](_0x58a8b4[_0x1e8a('0x58')]['from'])){throw new db[(_0x1e8a('0x85'))][(_0x1e8a('0x86'))](_0x1e8a('0x92'));}if(_[_0x1e8a('0x91')](_0x58a8b4[_0x1e8a('0x58')][_0x1e8a('0x58')])||_0x58a8b4[_0x1e8a('0x58')][_0x1e8a('0x58')]===''){throw new db[(_0x1e8a('0x85'))][(_0x1e8a('0x86'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1e8a('0x91')](_0x58a8b4[_0x1e8a('0x58')][_0x1e8a('0x93')])){throw new db[(_0x1e8a('0x85'))]['ValidationError'](_0x1e8a('0x94')+_0x1b53fa);}if(!_[_0x1e8a('0x95')](_0x1b53fa,_0x58a8b4['body'][_0x1e8a('0x93')])){throw new db[(_0x1e8a('0x85'))][(_0x1e8a('0x86'))](_0x1e8a('0x96')+_0x1b53fa);}_0x1b7a90[_0x58a8b4[_0x1e8a('0x58')][_0x1e8a('0x93')]]=_0x58a8b4[_0x1e8a('0x58')][_0x1e8a('0x8c')];return db[_0x1e8a('0x97')][_0x1e8a('0x5d')]({'where':{'id':_0x58a8b4['account']['ListId']},'include':[{'model':db[_0x1e8a('0x84')],'as':_0x1e8a('0x98'),'where':_0x1b7a90,'limit':0x1,'order':[[_0x1e8a('0x87'),_0x1e8a('0x99')]]}]});})[_0x1e8a('0x1f')](handleEntityNotFound(_0x35ee86,null))[_0x1e8a('0x1f')](function(_0x3262b5){if(_0x3262b5){_0x58a8b4[_0x1e8a('0x9a')]=_[_0x1e8a('0x6f')](_0x3262b5,[_0x1e8a('0x98')]);if(_0x3262b5[_0x1e8a('0x98')][_0x1e8a('0x45')]){return _0x3262b5[_0x1e8a('0x98')][0x0];}var _0x3b9e59=_[_0x1e8a('0x18')](_0x58a8b4[_0x1e8a('0x58')],{'firstName':_0x58a8b4[_0x1e8a('0x58')]['from'],'ListId':_0x3262b5['id']});_0x3b9e59[_0x58a8b4[_0x1e8a('0x58')][_0x1e8a('0x93')]]=_0x58a8b4['body'][_0x1e8a('0x8c')];return db[_0x1e8a('0x84')]['create'](_0x3b9e59,{'fields':_0x58b71b,'raw':!![]});}})['then'](handleEntityNotFound(_0x35ee86,null))[_0x1e8a('0x1f')](function(_0x2706ed){if(_0x2706ed){_0x58a8b4[_0x1e8a('0x9b')]=_0x2706ed;var _0x24ba83={'ContactId':_0x2706ed['id'],'phone':_0x58a8b4[_0x1e8a('0x58')][_0x1e8a('0x8c')],'WhatsappAccountId':_0x5f1579[_0x1e8a('0x55')]['id']};var _0x400c8e={'ContactId':_0x2706ed['id'],'WhatsappAccountId':_0x5f1579[_0x1e8a('0x55')]['id'],'closed':![]};return db[_0x1e8a('0x9c')][_0x1e8a('0x5d')]({'where':_0x400c8e})['then'](function(_0x26177c){if(_0x26177c){return[_0x26177c,![]];}return db[_0x1e8a('0x9c')][_0x1e8a('0x57')](_0x24ba83)[_0x1e8a('0x1f')](function(_0x344ce0){return[_0x344ce0,!![]];});});}})[_0x1e8a('0x70')](function(_0x47d05b,_0x2059a4){_0x58a8b4[_0x1e8a('0x9d')]=_0x47d05b['get']({'plain':!![]});_0x58a8b4[_0x1e8a('0x9d')][_0x1e8a('0x9e')]=![];if(_0x2059a4){if(_0x58a8b4[_0x1e8a('0x81')]['autoclose']){_0x58a8b4[_0x1e8a('0x82')]['push']({'id':0x0,'priority':_0x58a8b4[_0x1e8a('0x82')][_0x1e8a('0x45')]+0x1,'app':_0x1e8a('0x9f'),'appdata':_0x1e8a('0xa0'),'interval':'*,*,*,*'});}_0x58a8b4[_0x1e8a('0x9d')]['created']=!![];}return db[_0x1e8a('0xa1')][_0x1e8a('0x57')]({'phone':_0x58a8b4['body'][_0x1e8a('0x8c')],'messageId':_0x58a8b4['body'][_0x1e8a('0x8f')],'body':_0x58a8b4[_0x1e8a('0x58')][_0x1e8a('0x58')],'WhatsappAccountId':_0x5f1579['params']['id'],'WhatsappInteractionId':_0x47d05b['id'],'direction':'in','ContactId':_0x47d05b['ContactId'],'AttachmentId':_0x58a8b4[_0x1e8a('0x58')][_0x1e8a('0xa2')]});})[_0x1e8a('0x1f')](function(_0x470433){_0x58a8b4[_0x1e8a('0x26')]=_0x470433;if(_0x58a8b4[_0x1e8a('0x9d')][_0x1e8a('0xa3')]){return db[_0x1e8a('0x77')][_0x1e8a('0x5d')]({'attributes':['id',_0x1e8a('0x36')],'where':{'id':_0x58a8b4[_0x1e8a('0x9d')][_0x1e8a('0xa3')]}})[_0x1e8a('0x1f')](function(_0x184911){if(_0x184911){_0x58a8b4[_0x1e8a('0x82')][_0x1e8a('0xa4')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x184911[_0x1e8a('0x36')]+','+(_0x58a8b4[_0x1e8a('0x81')]['waitForTheAssignedAgent']||0xa),'interval':_0x1e8a('0xa5')});}return respondWithRpcPromise('Start',_0x1e8a('0xa6'),_0x58a8b4);});}return respondWithRpcPromise(_0x1e8a('0xa7'),_0x1e8a('0xa6'),_0x58a8b4);})[_0x1e8a('0x1f')](function(_0xc5e650){if(_0xc5e650){var _0x3245e9=0xc8;var _0x872411=_0x1e8a('0xa8');logger[_0x1e8a('0x27')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x872411,_0x3245e9,'entity\x20found');logger[_0x1e8a('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x872411,_0x3245e9,'entity\x20found',JSON[_0x1e8a('0x23')](_0xc5e650));if(_0x58a8b4[_0x1e8a('0x81')][_0x1e8a('0x3d')]===_0x1e8a('0x8b')){return _0x35ee86[_0x1e8a('0x2a')](_0x3245e9)[_0x1e8a('0x2f')](_0x1e8a('0xa9'),_0x1e8a('0xaa'))['send'](_0x1e8a('0xab'));}else{return _0x35ee86[_0x1e8a('0x2a')](_0x3245e9)[_0x1e8a('0x2b')](_0xc5e650);}}})[_0x1e8a('0x60')](handleError(_0x35ee86,null));};exports['send']=function(_0x441bd2,_0x76a6f1,_0x18c254){var _0x5526df,_0x3b218b,_0x57e37a;if(_[_0x1e8a('0x91')](_0x441bd2[_0x1e8a('0x58')][_0x1e8a('0x58')])||_0x441bd2[_0x1e8a('0x58')][_0x1e8a('0x58')]===''){throw new db[(_0x1e8a('0x85'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1e8a('0x91')](_0x441bd2[_0x1e8a('0x58')]['to'])){throw new db[(_0x1e8a('0x85'))][(_0x1e8a('0x86'))]('to\x20is\x20mandatory');}_0x5526df=_0x441bd2[_0x1e8a('0x58')]['to'];return db[_0x1e8a('0x3b')][_0x1e8a('0x5d')]({'where':{'id':_0x441bd2['params']['id']},'include':[{'model':db[_0x1e8a('0x97')],'as':'List','include':[{'model':db[_0x1e8a('0x84')],'as':_0x1e8a('0x98'),'where':{'mobile':_0x5526df},'limit':0x1,'order':[[_0x1e8a('0x87'),_0x1e8a('0x99')]]}]}]})[_0x1e8a('0x1f')](handleEntityNotFound(_0x76a6f1,null))[_0x1e8a('0x1f')](function(_0x5ace41){if(_0x5ace41&&_0x5ace41[_0x1e8a('0xac')]){_0x3b218b=_0x5ace41[_0x1e8a('0x32')]({'plain':!![]});if(_0x3b218b['List']&&_0x3b218b[_0x1e8a('0xac')]['Contacts'][_0x1e8a('0x45')]){return _0x3b218b['List'][_0x1e8a('0x98')][0x0];}return db[_0x1e8a('0x84')][_0x1e8a('0x57')](_[_0x1e8a('0x18')](_0x441bd2[_0x1e8a('0x58')],{'firstName':_0x5526df,'mobile':_0x5526df,'phone':_0x5526df,'ListId':_0x3b218b[_0x1e8a('0x89')]}));}})[_0x1e8a('0x1f')](handleEntityNotFound(_0x76a6f1,null))[_0x1e8a('0x1f')](function(_0x3b3d73){if(_0x3b3d73){_0x57e37a=_0x3b3d73;return db[_0x1e8a('0x9c')][_0x1e8a('0x5d')]({'where':{'ContactId':_0x57e37a['id'],'closed':![],'WhatsappAccountId':_0x3b218b['id']}})[_0x1e8a('0x1f')](function(_0x8df857){if(_0x8df857){return[_0x8df857,![]];}return db[_0x1e8a('0x9c')]['create']({'UserId':_0x441bd2[_0x1e8a('0x59')]['id'],'ContactId':_0x57e37a['id'],'WhatsappAccountId':_0x3b218b['id'],'phone':_0x5526df,'firstMsgDirection':_0x1e8a('0xad'),'Messages':[_[_0x1e8a('0x4e')](_0x441bd2[_0x1e8a('0x58')],{'read':![],'body':_0x441bd2[_0x1e8a('0x58')]['body'],'phone':_0x5526df,'WhatsappAccountId':_0x3b218b['id'],'UserId':_0x441bd2[_0x1e8a('0x59')]['id'],'ContactId':_0x57e37a['id']})]},{'include':[{'model':db[_0x1e8a('0xa1')],'as':'Messages'}]})[_0x1e8a('0x1f')](function(_0xf56448){return[_0xf56448,!![]];});});}})[_0x1e8a('0x70')](function(_0x1e047c,_0x3f68af){if(_0x3f68af){return _0x1e047c;}return db[_0x1e8a('0xa1')][_0x1e8a('0x57')](_['merge'](_0x441bd2[_0x1e8a('0x58')],{'read':![],'body':_0x441bd2[_0x1e8a('0x58')][_0x1e8a('0x58')],'phone':_0x5526df,'WhatsappAccountId':_0x3b218b['id'],'WhatsappInteractionId':_0x1e047c['id'],'UserId':_0x441bd2[_0x1e8a('0x59')]['id'],'ContactId':_0x57e37a['id']}))[_0x1e8a('0x1f')](function(_0xd4b342){_0x1e047c[_0x1e8a('0xae')][_0x1e8a('0xaf')]=[];_0x1e047c[_0x1e8a('0xae')][_0x1e8a('0xaf')]['push'](_0xd4b342[_0x1e8a('0xae')]);return _0x1e047c;});})['then'](respondWithResult(_0x76a6f1,null))[_0x1e8a('0x60')](handleError(_0x76a6f1,null));}; \ No newline at end of file +var _0x9b65=['name','send','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','sort','where','filter','type','VIRTUAL','merge','options','include','findAll','rows','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','WhatsappAccountId','Disposition','getDispositions','findOne','hasOwnProperty','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','nolimit','order','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','findAndCountAll','priority','getApplications','account','applications','orderBy','Applications','asc','CmContact','Sequelize','ValidationError','difference','updatedAt','createdAt','CompanyId','ListId','mobile','twilio','from','From','whatsapp:','Body','messageId','MessageSid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','get','WhatsappMessage','Messages','dataValues','push','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','WhatsappAccounts','stack'];(function(_0x554292,_0x82948a){var _0x3dd555=function(_0xab7590){while(--_0xab7590){_0x554292['push'](_0x554292['shift']());}};_0x3dd555(++_0x82948a);}(_0x9b65,0x139));var _0x59b6=function(_0x5b1551,_0x4ad506){_0x5b1551=_0x5b1551-0x0;var _0x266298=_0x9b65[_0x5b1551];return _0x266298;};'use strict';var emlformat=require(_0x59b6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x59b6('0x1'));var jsonpatch=require(_0x59b6('0x2'));var rp=require(_0x59b6('0x3'));var moment=require('moment');var BPromise=require(_0x59b6('0x4'));var Mustache=require(_0x59b6('0x5'));var util=require('util');var path=require(_0x59b6('0x6'));var sox=require(_0x59b6('0x7'));var csv=require(_0x59b6('0x8'));var ejs=require(_0x59b6('0x9'));var fs=require('fs');var fs_extra=require(_0x59b6('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x59b6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x59b6('0xc'));var toCsv=require(_0x59b6('0x8'));var querystring=require(_0x59b6('0xd'));var Papa=require('papaparse');var Redis=require(_0x59b6('0xe'));var authService=require(_0x59b6('0xf'));var qs=require(_0x59b6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x59b6('0x11'));var logger=require('../../config/logger')(_0x59b6('0x12'));var utils=require(_0x59b6('0x13'));var config=require(_0x59b6('0x14'));var licenseUtil=require(_0x59b6('0x15'));var db=require('../../mysqldb')['db'];config[_0x59b6('0x16')]=_[_0x59b6('0x17')](config[_0x59b6('0x16')],{'host':_0x59b6('0x18'),'port':0x18eb});var socket=require(_0x59b6('0x19'))(new Redis(config[_0x59b6('0x16')]));require(_0x59b6('0x1a'))[_0x59b6('0x1b')](socket);var jayson=require(_0x59b6('0x1c'));var client=jayson[_0x59b6('0x1d')]['http']({'port':0x232c});function respondWithRpcPromise(_0x1dea46,_0x52cda6,_0x511ba4,_0x15b4f7){return new BPromise(function(_0x4d1fa2,_0x11fa40){var _0x199bbf=_0x15b4f7||client;return _0x199bbf['request'](_0x1dea46,_0x511ba4)['then'](function(_0x85e097){logger[_0x59b6('0x1e')](_0x59b6('0x1f'),_0x52cda6,_0x59b6('0x20'));logger[_0x59b6('0x21')](_0x59b6('0x22'),_0x52cda6,'request\x20sent',JSON[_0x59b6('0x23')](_0x85e097));if(_0x85e097[_0x59b6('0x24')]){if(_0x85e097['error'][_0x59b6('0x25')]===0x1f4){logger[_0x59b6('0x24')](_0x59b6('0x1f'),_0x52cda6,_0x85e097[_0x59b6('0x24')][_0x59b6('0x26')]);return _0x11fa40(_0x85e097[_0x59b6('0x24')][_0x59b6('0x26')]);}logger[_0x59b6('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x52cda6,_0x85e097[_0x59b6('0x24')][_0x59b6('0x26')]);return _0x4d1fa2(_0x85e097[_0x59b6('0x24')][_0x59b6('0x26')]);}else{logger[_0x59b6('0x1e')]('WhatsappAccount,\x20%s,\x20%s',_0x52cda6,_0x59b6('0x20'));_0x4d1fa2(_0x85e097[_0x59b6('0x27')][_0x59b6('0x26')]);}})[_0x59b6('0x28')](function(_0xa24246){logger[_0x59b6('0x24')](_0x59b6('0x1f'),_0x52cda6,_0xa24246);_0x11fa40(_0xa24246);});});}function respondWithStatusCode(_0x168a07,_0x192e03){_0x192e03=_0x192e03||0xcc;return function(_0x3fdb28){if(_0x3fdb28){return _0x168a07[_0x59b6('0x29')](_0x192e03);}return _0x168a07[_0x59b6('0x2a')](_0x192e03)[_0x59b6('0x2b')]();};}function respondWithResult(_0x848064,_0x1f5e9c){_0x1f5e9c=_0x1f5e9c||0xc8;return function(_0xf457e2){if(_0xf457e2){return _0x848064[_0x59b6('0x2a')](_0x1f5e9c)[_0x59b6('0x2c')](_0xf457e2);}};}function respondWithFilteredResult(_0x5e3688,_0x3b624d){return function(_0x59beda){if(_0x59beda){var _0x59771b=typeof _0x3b624d[_0x59b6('0x2d')]===_0x59b6('0x2e')&&typeof _0x3b624d[_0x59b6('0x2f')]===_0x59b6('0x2e');var _0x487d16=_0x59beda['count'];var _0x501239=_0x59771b?0x0:_0x3b624d[_0x59b6('0x2d')];var _0x5b7ea9=_0x59771b?_0x59beda[_0x59b6('0x30')]:_0x3b624d['offset']+_0x3b624d[_0x59b6('0x2f')];var _0x51f5d5;if(_0x5b7ea9>=_0x487d16){_0x5b7ea9=_0x487d16;_0x51f5d5=0xc8;}else{_0x51f5d5=0xce;}_0x5e3688[_0x59b6('0x2a')](_0x51f5d5);return _0x5e3688[_0x59b6('0x31')]('Content-Range',_0x501239+'-'+_0x5b7ea9+'/'+_0x487d16)[_0x59b6('0x2c')](_0x59beda);}return null;};}function patchUpdates(_0x4f851b){return function(_0x518b1a){try{jsonpatch[_0x59b6('0x32')](_0x518b1a,_0x4f851b,!![]);}catch(_0x5ea5d4){return BPromise[_0x59b6('0x33')](_0x5ea5d4);}return _0x518b1a['save']();};}function saveUpdates(_0x5851a1,_0x50dccd){return function(_0x1fa490){if(_0x1fa490){return _0x1fa490[_0x59b6('0x34')](_0x5851a1)[_0x59b6('0x35')](function(_0x1c5521){return _0x1c5521;});}return null;};}function removeEntity(_0x2ac078,_0x544be2){return function(_0x4fd617){if(_0x4fd617){return _0x4fd617[_0x59b6('0x36')]()[_0x59b6('0x35')](function(){var _0x46a4f2=_0x4fd617['get']({'plain':!![]});var _0x31b5c2=_0x59b6('0x37');return db['UserProfileResource']['destroy']({'where':{'type':_0x31b5c2,'resourceId':_0x46a4f2['id']}})[_0x59b6('0x35')](function(){return _0x4fd617;});})[_0x59b6('0x35')](function(){_0x2ac078[_0x59b6('0x2a')](0xcc)[_0x59b6('0x2b')]();});}};}function handleEntityNotFound(_0x2b53a3,_0x3e026e){return function(_0x3ca5b2){if(!_0x3ca5b2){_0x2b53a3[_0x59b6('0x29')](0x194);}return _0x3ca5b2;};}function handleError(_0x22cc66,_0x26b3fc){_0x26b3fc=_0x26b3fc||0x1f4;return function(_0x59a68a){logger[_0x59b6('0x24')](_0x59a68a[_0x59b6('0x38')]);if(_0x59a68a[_0x59b6('0x39')]){delete _0x59a68a[_0x59b6('0x39')];}_0x22cc66[_0x59b6('0x2a')](_0x26b3fc)[_0x59b6('0x3a')](_0x59a68a);};}exports['index']=function(_0x75a27d,_0xfc196c){var _0x5cac68={'include':[{'model':db[_0x59b6('0x3b')],'as':_0x59b6('0x3c')}]},_0x573783={},_0x22e330={'count':0x0,'rows':[]};var _0x3121aa=_[_0x59b6('0x3d')](db[_0x59b6('0x3e')][_0x59b6('0x3f')],function(_0x551283){return{'name':_0x551283[_0x59b6('0x40')],'type':_0x551283['type'][_0x59b6('0x41')]};});_0x573783[_0x59b6('0x42')]=_[_0x59b6('0x3d')](_0x3121aa,_0x59b6('0x39'));_0x573783['query']=_[_0x59b6('0x43')](_0x75a27d[_0x59b6('0x44')]);_0x573783[_0x59b6('0x45')]=_[_0x59b6('0x46')](_0x573783[_0x59b6('0x42')],_0x573783[_0x59b6('0x44')]);_0x5cac68[_0x59b6('0x47')]=_[_0x59b6('0x46')](_0x573783[_0x59b6('0x42')],qs[_0x59b6('0x48')](_0x75a27d[_0x59b6('0x44')]['fields']));_0x5cac68['attributes']=_0x5cac68[_0x59b6('0x47')][_0x59b6('0x49')]?_0x5cac68['attributes']:_0x573783[_0x59b6('0x42')];if(!_0x75a27d[_0x59b6('0x44')]['hasOwnProperty']('nolimit')){_0x5cac68[_0x59b6('0x2f')]=qs['limit'](_0x75a27d[_0x59b6('0x44')][_0x59b6('0x2f')]);_0x5cac68['offset']=qs['offset'](_0x75a27d['query'][_0x59b6('0x2d')]);}_0x5cac68['order']=qs[_0x59b6('0x4a')](_0x75a27d[_0x59b6('0x44')][_0x59b6('0x4a')]);_0x5cac68[_0x59b6('0x4b')]=qs['filters'](_['pick'](_0x75a27d[_0x59b6('0x44')],_0x573783[_0x59b6('0x45')]),_0x3121aa);if(_0x75a27d[_0x59b6('0x44')][_0x59b6('0x4c')]){_0x5cac68['where']=_['merge'](_0x5cac68[_0x59b6('0x4b')],{'$or':_[_0x59b6('0x3d')](_0x3121aa,function(_0x5e0927){if(_0x5e0927[_0x59b6('0x4d')]!==_0x59b6('0x4e')){var _0x218a50={};_0x218a50[_0x5e0927[_0x59b6('0x39')]]={'$like':'%'+_0x75a27d[_0x59b6('0x44')][_0x59b6('0x4c')]+'%'};return _0x218a50;}})});}_0x5cac68=_[_0x59b6('0x4f')]({},_0x5cac68,_0x75a27d[_0x59b6('0x50')]);var _0x4b6f44={'where':_0x5cac68[_0x59b6('0x4b')]};return db[_0x59b6('0x3e')][_0x59b6('0x30')](_0x4b6f44)[_0x59b6('0x35')](function(_0x5b6115){_0x22e330[_0x59b6('0x30')]=_0x5b6115;if(_0x75a27d[_0x59b6('0x44')]['includeAll']){_0x5cac68[_0x59b6('0x51')]=[{'all':!![]}];}return db[_0x59b6('0x3e')][_0x59b6('0x52')](_0x5cac68);})[_0x59b6('0x35')](function(_0x411f4d){_0x22e330[_0x59b6('0x53')]=_0x411f4d;return _0x22e330;})[_0x59b6('0x35')](respondWithFilteredResult(_0xfc196c,_0x5cac68))[_0x59b6('0x28')](handleError(_0xfc196c,null));};exports['show']=function(_0x231710,_0x221a99){var _0x291129={'raw':![],'where':{'id':_0x231710[_0x59b6('0x54')]['id']},'include':[{'model':db[_0x59b6('0x3b')],'as':_0x59b6('0x3c')}]},_0xe6fa37={};_0xe6fa37[_0x59b6('0x42')]=_[_0x59b6('0x43')](db[_0x59b6('0x3e')]['rawAttributes']);_0xe6fa37[_0x59b6('0x44')]=_[_0x59b6('0x43')](_0x231710[_0x59b6('0x44')]);_0xe6fa37[_0x59b6('0x45')]=_[_0x59b6('0x46')](_0xe6fa37[_0x59b6('0x42')],_0xe6fa37[_0x59b6('0x44')]);_0x291129[_0x59b6('0x47')]=_[_0x59b6('0x46')](_0xe6fa37[_0x59b6('0x42')],qs[_0x59b6('0x48')](_0x231710[_0x59b6('0x44')]['fields']));_0x291129[_0x59b6('0x47')]=_0x291129[_0x59b6('0x47')][_0x59b6('0x49')]?_0x291129[_0x59b6('0x47')]:_0xe6fa37[_0x59b6('0x42')];if(_0x231710[_0x59b6('0x44')][_0x59b6('0x55')]){_0x291129['include']=[{'all':!![]}];}_0x291129=_[_0x59b6('0x4f')]({},_0x291129,_0x231710['options']);return db[_0x59b6('0x3e')][_0x59b6('0x56')](_0x291129)['then'](handleEntityNotFound(_0x221a99,null))[_0x59b6('0x35')](respondWithResult(_0x221a99,null))[_0x59b6('0x28')](handleError(_0x221a99,null));};exports[_0x59b6('0x57')]=function(_0x818bfc,_0x4fdfb1){return db[_0x59b6('0x3e')]['create'](_0x818bfc['body'],{})[_0x59b6('0x35')](function(_0x10062){var _0x3518b4=_0x818bfc[_0x59b6('0x58')]['get']({'plain':!![]});if(!_0x3518b4)throw new Error(_0x59b6('0x59'));if(_0x3518b4['role']==='user'){var _0x233104=_0x10062['get']({'plain':!![]});var _0x6abbc0=_0x59b6('0x37');return db[_0x59b6('0x5a')][_0x59b6('0x56')]({'where':{'name':_0x6abbc0,'userProfileId':_0x3518b4[_0x59b6('0x5b')]},'raw':!![]})['then'](function(_0x108d2a){if(_0x108d2a&&_0x108d2a[_0x59b6('0x5c')]===0x0){return db['UserProfileResource']['create']({'name':_0x233104['name'],'resourceId':_0x233104['id'],'type':_0x108d2a[_0x59b6('0x39')],'sectionId':_0x108d2a['id']},{})['then'](function(){return _0x10062;});}else{return _0x10062;}})['catch'](function(_0xe7c67c){logger['error'](_0x59b6('0x5d'),_0xe7c67c);throw _0xe7c67c;});}return _0x10062;})['then'](respondWithResult(_0x4fdfb1,0xc9))[_0x59b6('0x28')](handleError(_0x4fdfb1,null));};exports[_0x59b6('0x34')]=function(_0x30df49,_0x25c4df){if(_0x30df49[_0x59b6('0x5e')]['id']){delete _0x30df49[_0x59b6('0x5e')]['id'];}return db[_0x59b6('0x3e')][_0x59b6('0x56')]({'where':{'id':_0x30df49[_0x59b6('0x54')]['id']},'include':[{'model':db[_0x59b6('0x3b')],'as':_0x59b6('0x3c')}]})[_0x59b6('0x35')](handleEntityNotFound(_0x25c4df,null))['then'](saveUpdates(_0x30df49[_0x59b6('0x5e')],null))[_0x59b6('0x35')](respondWithResult(_0x25c4df,null))[_0x59b6('0x28')](handleError(_0x25c4df,null));};exports[_0x59b6('0x36')]=function(_0x12e378,_0xfd9969){return db[_0x59b6('0x3e')][_0x59b6('0x56')]({'where':{'id':_0x12e378[_0x59b6('0x54')]['id']}})['then'](handleEntityNotFound(_0xfd9969,null))['then'](removeEntity(_0xfd9969,null))[_0x59b6('0x28')](handleError(_0xfd9969,null));};exports[_0x59b6('0x5f')]=function(_0x55ad0e,_0x126345){return db[_0x59b6('0x3e')][_0x59b6('0x5f')]()[_0x59b6('0x35')](respondWithResult(_0x126345,null))[_0x59b6('0x28')](handleError(_0x126345,null));};exports['addDisposition']=function(_0x5dbd2b,_0x535d44,_0x5a5d91){if(_0x5dbd2b[_0x59b6('0x5e')]['id']){delete _0x5dbd2b[_0x59b6('0x5e')]['id'];}return db[_0x59b6('0x3e')][_0x59b6('0x56')]({'where':{'id':_0x5dbd2b[_0x59b6('0x54')]['id']}})[_0x59b6('0x35')](handleEntityNotFound(_0x535d44,null))[_0x59b6('0x35')](function(_0x4ec958){if(_0x4ec958){_0x5dbd2b[_0x59b6('0x5e')][_0x59b6('0x60')]=_0x4ec958['id'];return db[_0x59b6('0x61')][_0x59b6('0x57')](_0x5dbd2b[_0x59b6('0x5e')]);}})['then'](respondWithResult(_0x535d44,null))[_0x59b6('0x28')](handleError(_0x535d44,null));};exports[_0x59b6('0x62')]=function(_0xc907cf,_0x392dfb,_0xc3540d){var _0x12de1f={'raw':![],'where':{}};var _0x2a94e4={};var _0xe098f9={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x59b6('0x63')]({'where':{'id':_0xc907cf[_0x59b6('0x54')]['id']}})[_0x59b6('0x35')](handleEntityNotFound(_0x392dfb,null))[_0x59b6('0x35')](function(_0x39426f){if(_0x39426f){_0x2a94e4[_0x59b6('0x42')]=_[_0x59b6('0x43')](db[_0x59b6('0x61')][_0x59b6('0x3f')]);_0x2a94e4[_0x59b6('0x44')]=_[_0x59b6('0x43')](_0xc907cf[_0x59b6('0x44')]);_0x2a94e4[_0x59b6('0x45')]=_[_0x59b6('0x46')](_0x2a94e4[_0x59b6('0x42')],_0x2a94e4[_0x59b6('0x44')]);_0x12de1f[_0x59b6('0x47')]=_['intersection'](_0x2a94e4[_0x59b6('0x42')],qs[_0x59b6('0x48')](_0xc907cf[_0x59b6('0x44')]['fields']));_0x12de1f['attributes']=_0x12de1f[_0x59b6('0x47')][_0x59b6('0x49')]?_0x12de1f[_0x59b6('0x47')]:_0x2a94e4[_0x59b6('0x42')];if(!_0xc907cf[_0x59b6('0x44')][_0x59b6('0x64')]('nolimit')){_0x12de1f[_0x59b6('0x2f')]=qs[_0x59b6('0x2f')](_0xc907cf[_0x59b6('0x44')][_0x59b6('0x2f')]);_0x12de1f['offset']=qs['offset'](_0xc907cf[_0x59b6('0x44')]['offset']);}_0x12de1f['order']=qs[_0x59b6('0x4a')](_0xc907cf['query'][_0x59b6('0x4a')]);_0x12de1f[_0x59b6('0x4b')]=qs[_0x59b6('0x45')](_[_0x59b6('0x65')](_0xc907cf[_0x59b6('0x44')],_0x2a94e4[_0x59b6('0x45')]));_0x12de1f[_0x59b6('0x4b')]['WhatsappAccountId']=_0x39426f['id'];if(_0xc907cf[_0x59b6('0x44')]['filter']){_0x12de1f[_0x59b6('0x4b')]=_[_0x59b6('0x4f')](_0x12de1f[_0x59b6('0x4b')],{'$or':_[_0x59b6('0x3d')](_0x12de1f[_0x59b6('0x47')],function(_0x408464){var _0x129245={};_0x129245[_0x408464]={'$like':'%'+_0xc907cf['query'][_0x59b6('0x4c')]+'%'};return _0x129245;})});}_0x12de1f=_[_0x59b6('0x4f')]({},_0x12de1f,_0xc907cf['options']);return db['Disposition']['count']({'where':_0x12de1f[_0x59b6('0x4b')]})['then'](function(_0x52eb49){_0xe098f9[_0x59b6('0x30')]=_0x52eb49;if(_0xc907cf['query'][_0x59b6('0x55')]){_0x12de1f[_0x59b6('0x51')]=[{'all':!![]}];}return db['Disposition'][_0x59b6('0x52')](_0x12de1f);})[_0x59b6('0x35')](function(_0x296628){_0xe098f9[_0x59b6('0x53')]=_0x296628;return _0xe098f9;});}})[_0x59b6('0x35')](respondWithFilteredResult(_0x392dfb,_0x12de1f))[_0x59b6('0x28')](handleError(_0x392dfb,null));};exports[_0x59b6('0x66')]=function(_0x7eac1c,_0x18ed7b,_0x2ba2ab){return db[_0x59b6('0x3e')][_0x59b6('0x56')]({'where':{'id':_0x7eac1c[_0x59b6('0x54')]['id']}})[_0x59b6('0x35')](handleEntityNotFound(_0x18ed7b,null))[_0x59b6('0x35')](function(_0x1be9e4){if(_0x1be9e4){return _0x1be9e4[_0x59b6('0x66')](_0x7eac1c[_0x59b6('0x44')][_0x59b6('0x67')]);}})['then'](respondWithStatusCode(_0x18ed7b,null))[_0x59b6('0x28')](handleError(_0x18ed7b,null));};exports[_0x59b6('0x68')]=function(_0x2210fc,_0x35c7de,_0x829b48){if(_0x2210fc[_0x59b6('0x5e')]['id']){delete _0x2210fc[_0x59b6('0x5e')]['id'];}return db[_0x59b6('0x3e')][_0x59b6('0x56')]({'where':{'id':_0x2210fc[_0x59b6('0x54')]['id']}})[_0x59b6('0x35')](handleEntityNotFound(_0x35c7de,null))['then'](function(_0x526a12){if(_0x526a12){_0x2210fc[_0x59b6('0x5e')]['WhatsappAccountId']=_0x526a12['id'];return db[_0x59b6('0x69')][_0x59b6('0x57')](_0x2210fc['body']);}})[_0x59b6('0x35')](respondWithResult(_0x35c7de,null))[_0x59b6('0x28')](handleError(_0x35c7de,null));};exports[_0x59b6('0x6a')]=function(_0x2d5f0f,_0x1a4520,_0x171f21){var _0x5b6301={'raw':![],'where':{}};var _0x27370b={};var _0x5ead39={'count':0x0,'rows':[]};return db[_0x59b6('0x3e')]['findOne']({'where':{'id':_0x2d5f0f['params']['id']}})[_0x59b6('0x35')](handleEntityNotFound(_0x1a4520,null))[_0x59b6('0x35')](function(_0x2657cc){if(_0x2657cc){_0x27370b['model']=_[_0x59b6('0x43')](db['CannedAnswer']['rawAttributes']);_0x27370b[_0x59b6('0x44')]=_[_0x59b6('0x43')](_0x2d5f0f[_0x59b6('0x44')]);_0x27370b[_0x59b6('0x45')]=_['intersection'](_0x27370b[_0x59b6('0x42')],_0x27370b['query']);_0x5b6301[_0x59b6('0x47')]=_[_0x59b6('0x46')](_0x27370b[_0x59b6('0x42')],qs[_0x59b6('0x48')](_0x2d5f0f[_0x59b6('0x44')]['fields']));_0x5b6301[_0x59b6('0x47')]=_0x5b6301[_0x59b6('0x47')][_0x59b6('0x49')]?_0x5b6301[_0x59b6('0x47')]:_0x27370b[_0x59b6('0x42')];if(!_0x2d5f0f[_0x59b6('0x44')][_0x59b6('0x64')](_0x59b6('0x6b'))){_0x5b6301[_0x59b6('0x2f')]=qs['limit'](_0x2d5f0f[_0x59b6('0x44')][_0x59b6('0x2f')]);_0x5b6301[_0x59b6('0x2d')]=qs[_0x59b6('0x2d')](_0x2d5f0f['query'][_0x59b6('0x2d')]);}_0x5b6301[_0x59b6('0x6c')]=qs[_0x59b6('0x4a')](_0x2d5f0f[_0x59b6('0x44')]['sort']);_0x5b6301['where']=qs[_0x59b6('0x45')](_['pick'](_0x2d5f0f[_0x59b6('0x44')],_0x27370b[_0x59b6('0x45')]));_0x5b6301[_0x59b6('0x4b')]['WhatsappAccountId']=_0x2657cc['id'];if(_0x2d5f0f[_0x59b6('0x44')][_0x59b6('0x4c')]){_0x5b6301[_0x59b6('0x4b')]=_['merge'](_0x5b6301[_0x59b6('0x4b')],{'$or':_['map'](_0x5b6301[_0x59b6('0x47')],function(_0x49875d){var _0x67fd62={};_0x67fd62[_0x49875d]={'$like':'%'+_0x2d5f0f[_0x59b6('0x44')][_0x59b6('0x4c')]+'%'};return _0x67fd62;})});}_0x5b6301=_[_0x59b6('0x4f')]({},_0x5b6301,_0x2d5f0f[_0x59b6('0x50')]);return db[_0x59b6('0x69')]['count']({'where':_0x5b6301[_0x59b6('0x4b')]})['then'](function(_0x597bc2){_0x5ead39[_0x59b6('0x30')]=_0x597bc2;if(_0x2d5f0f['query'][_0x59b6('0x55')]){_0x5b6301[_0x59b6('0x51')]=[{'all':!![]}];}return db[_0x59b6('0x69')]['findAll'](_0x5b6301);})[_0x59b6('0x35')](function(_0x446453){_0x5ead39[_0x59b6('0x53')]=_0x446453;return _0x5ead39;});}})[_0x59b6('0x35')](respondWithFilteredResult(_0x1a4520,_0x5b6301))['catch'](handleError(_0x1a4520,null));};exports[_0x59b6('0x6d')]=function(_0x3923d5,_0x682230,_0x539e93){return db['WhatsappAccount'][_0x59b6('0x56')]({'where':{'id':_0x3923d5[_0x59b6('0x54')]['id']}})['then'](handleEntityNotFound(_0x682230,null))[_0x59b6('0x35')](function(_0x135fd5){if(_0x135fd5){return _0x135fd5[_0x59b6('0x6d')](_0x3923d5[_0x59b6('0x44')][_0x59b6('0x67')]);}})[_0x59b6('0x35')](respondWithStatusCode(_0x682230,null))[_0x59b6('0x28')](handleError(_0x682230,null));};exports[_0x59b6('0x6e')]=function(_0x3fe34e,_0x2fb6a5,_0x343f40){return db['WhatsappAccount'][_0x59b6('0x56')]({'where':{'id':_0x3fe34e[_0x59b6('0x54')]['id']}})[_0x59b6('0x35')](handleEntityNotFound(_0x2fb6a5,null))['then'](function(_0x1f0269){if(_0x1f0269){return _0x1f0269[_0x59b6('0x6e')](_0x3fe34e[_0x59b6('0x5e')][_0x59b6('0x67')],_[_0x59b6('0x6f')](_0x3fe34e[_0x59b6('0x5e')],[_0x59b6('0x67'),'id'])||{})[_0x59b6('0x70')](function(_0x2a8f8f){for(var _0x3e3e9f=0x0;_0x3e3e9f<_0x3fe34e['body'][_0x59b6('0x67')][_0x59b6('0x49')];_0x3e3e9f+=0x1){socket[_0x59b6('0x71')](_0x59b6('0x72'),{'UserId':Number(_0x3fe34e['body'][_0x59b6('0x67')][_0x3e3e9f]),'WhatsappAccountId':Number(_0x3fe34e[_0x59b6('0x54')]['id'])});}return _0x2a8f8f;});}})[_0x59b6('0x35')](respondWithResult(_0x2fb6a5,null))[_0x59b6('0x28')](handleError(_0x2fb6a5,null));};exports['removeAgents']=function(_0x27bcd6,_0x5cb3ad,_0x11d759){return db[_0x59b6('0x3e')][_0x59b6('0x56')]({'where':{'id':_0x27bcd6['params']['id']}})[_0x59b6('0x35')](handleEntityNotFound(_0x5cb3ad,null))['then'](function(_0x1e187e){if(_0x1e187e){return _0x1e187e[_0x59b6('0x73')](_0x27bcd6['query'][_0x59b6('0x67')])[_0x59b6('0x35')](function(){if(_['isArray'](_0x27bcd6[_0x59b6('0x44')][_0x59b6('0x67')])){for(var _0x2dc864=0x0;_0x2dc864<_0x27bcd6[_0x59b6('0x44')][_0x59b6('0x67')][_0x59b6('0x49')];_0x2dc864+=0x1){socket[_0x59b6('0x71')](_0x59b6('0x74'),{'UserId':Number(_0x27bcd6[_0x59b6('0x44')][_0x59b6('0x67')][_0x2dc864]),'WhatsappAccountId':Number(_0x27bcd6['params']['id'])});}}else{socket[_0x59b6('0x71')](_0x59b6('0x74'),{'UserId':Number(_0x27bcd6['query'][_0x59b6('0x67')]),'WhatsappAccountId':Number(_0x27bcd6[_0x59b6('0x54')]['id'])});}});}})[_0x59b6('0x35')](respondWithStatusCode(_0x5cb3ad,null))[_0x59b6('0x28')](handleError(_0x5cb3ad,null));};exports[_0x59b6('0x75')]=function(_0x612519,_0x24fc45,_0x222e94){var _0x308cfd={};var _0x2ebd48={};var _0x33b28a;var _0x157659;return db[_0x59b6('0x3e')]['findOne']({'where':{'id':_0x612519[_0x59b6('0x54')]['id']}})['then'](handleEntityNotFound(_0x24fc45,null))[_0x59b6('0x35')](function(_0x1126b2){if(_0x1126b2){_0x33b28a=_0x1126b2;_0x2ebd48['model']=_[_0x59b6('0x43')](db[_0x59b6('0x76')][_0x59b6('0x3f')]);_0x2ebd48['query']=_[_0x59b6('0x43')](_0x612519[_0x59b6('0x44')]);_0x2ebd48['filters']=_[_0x59b6('0x46')](_0x2ebd48[_0x59b6('0x42')],_0x2ebd48[_0x59b6('0x44')]);_0x308cfd[_0x59b6('0x47')]=_[_0x59b6('0x46')](_0x2ebd48[_0x59b6('0x42')],qs[_0x59b6('0x48')](_0x612519[_0x59b6('0x44')][_0x59b6('0x48')]));_0x308cfd['attributes']=_0x308cfd[_0x59b6('0x47')][_0x59b6('0x49')]?_0x308cfd[_0x59b6('0x47')]:_0x2ebd48[_0x59b6('0x42')];_0x308cfd[_0x59b6('0x6c')]=qs[_0x59b6('0x4a')](_0x612519[_0x59b6('0x44')][_0x59b6('0x4a')]);_0x308cfd[_0x59b6('0x4b')]=qs['filters'](_[_0x59b6('0x65')](_0x612519[_0x59b6('0x44')],_0x2ebd48[_0x59b6('0x45')]));if(_0x612519['query']['filter']){_0x308cfd[_0x59b6('0x4b')]=_[_0x59b6('0x4f')](_0x308cfd['where'],{'$or':_['map'](_0x308cfd[_0x59b6('0x47')],function(_0x40fd9a){var _0x2da043={};_0x2da043[_0x40fd9a]={'$like':'%'+_0x612519[_0x59b6('0x44')][_0x59b6('0x4c')]+'%'};return _0x2da043;})});}_0x308cfd=_['merge']({},_0x308cfd,_0x612519[_0x59b6('0x50')]);return _0x33b28a[_0x59b6('0x75')](_0x308cfd);}})[_0x59b6('0x35')](function(_0x1f73fa){if(_0x1f73fa){_0x157659=_0x1f73fa[_0x59b6('0x49')];if(!_0x612519[_0x59b6('0x44')]['hasOwnProperty'](_0x59b6('0x6b'))){_0x308cfd[_0x59b6('0x2f')]=qs['limit'](_0x612519[_0x59b6('0x44')][_0x59b6('0x2f')]);_0x308cfd[_0x59b6('0x2d')]=qs[_0x59b6('0x2d')](_0x612519[_0x59b6('0x44')][_0x59b6('0x2d')]);}return _0x33b28a['getAgents'](_0x308cfd);}})['then'](function(_0xcec15e){if(_0xcec15e){return _0xcec15e?{'count':_0x157659,'rows':_0xcec15e}:null;}})[_0x59b6('0x35')](respondWithResult(_0x24fc45,null))['catch'](handleError(_0x24fc45,null));};exports[_0x59b6('0x77')]=function(_0x1ac701,_0x5ce54c,_0xa7bcec){return db[_0x59b6('0x3e')]['findOne']({'where':{'id':_0x1ac701[_0x59b6('0x54')]['id']}})['then'](handleEntityNotFound(_0x5ce54c,null))[_0x59b6('0x35')](function(_0x3977f8){if(_0x3977f8){return db[_0x59b6('0x78')][_0x59b6('0x79')](function(_0x1624eb){return db[_0x59b6('0x7a')]['destroy']({'where':{'WhatsappAccountId':_0x1ac701[_0x59b6('0x54')]['id']},'transaction':_0x1624eb})[_0x59b6('0x35')](function(_0x5a58ff){var _0x2621e3=_[_0x59b6('0x3d')](_0x1ac701[_0x59b6('0x5e')],function(_0x27e7aa){_0x27e7aa['WhatsappAccountId']=_0x1ac701[_0x59b6('0x54')]['id'];return _0x27e7aa;});return db['WhatsappApplication']['bulkCreate'](_0x2621e3,{'transaction':_0x1624eb});});})[_0x59b6('0x35')](function(){return db[_0x59b6('0x7a')][_0x59b6('0x7b')]({'where':{'WhatsappAccountId':_0x1ac701[_0x59b6('0x54')]['id']},'order':_0x59b6('0x7c')});});}})['then'](respondWithResult(_0x5ce54c,null))['catch'](handleError(_0x5ce54c,null));};exports[_0x59b6('0x7d')]=function(_0x5c38e9,_0x16854c,_0x416411){var _0x29261b={};var _0x40c86c={};var _0x1c6e99;var _0x281945;return db[_0x59b6('0x3e')][_0x59b6('0x63')]({'where':{'id':_0x5c38e9['params']['id']}})[_0x59b6('0x35')](handleEntityNotFound(_0x16854c,null))[_0x59b6('0x35')](function(_0x276add){if(_0x276add){_0x1c6e99=_0x276add;_0x40c86c['model']=_[_0x59b6('0x43')](db['WhatsappApplication'][_0x59b6('0x3f')]);_0x40c86c[_0x59b6('0x44')]=_[_0x59b6('0x43')](_0x5c38e9['query']);_0x40c86c[_0x59b6('0x45')]=_[_0x59b6('0x46')](_0x40c86c['model'],_0x40c86c[_0x59b6('0x44')]);_0x29261b[_0x59b6('0x47')]=_[_0x59b6('0x46')](_0x40c86c[_0x59b6('0x42')],qs[_0x59b6('0x48')](_0x5c38e9[_0x59b6('0x44')][_0x59b6('0x48')]));_0x29261b[_0x59b6('0x47')]=_0x29261b[_0x59b6('0x47')][_0x59b6('0x49')]?_0x29261b[_0x59b6('0x47')]:_0x40c86c[_0x59b6('0x42')];_0x29261b[_0x59b6('0x6c')]=qs[_0x59b6('0x4a')](_0x5c38e9[_0x59b6('0x44')][_0x59b6('0x4a')]);_0x29261b[_0x59b6('0x4b')]=qs[_0x59b6('0x45')](_[_0x59b6('0x65')](_0x5c38e9[_0x59b6('0x44')],_0x40c86c[_0x59b6('0x45')]));if(_0x5c38e9['query'][_0x59b6('0x4c')]){_0x29261b[_0x59b6('0x4b')]=_[_0x59b6('0x4f')](_0x29261b[_0x59b6('0x4b')],{'$or':_['map'](_0x29261b[_0x59b6('0x47')],function(_0xf24c01){var _0x387a83={};_0x387a83[_0xf24c01]={'$like':'%'+_0x5c38e9[_0x59b6('0x44')]['filter']+'%'};return _0x387a83;})});}_0x29261b=_[_0x59b6('0x4f')]({},_0x29261b,_0x5c38e9[_0x59b6('0x50')]);return _0x1c6e99['getApplications'](_0x29261b);}})[_0x59b6('0x35')](function(_0x570ba3){if(_0x570ba3){_0x281945=_0x570ba3[_0x59b6('0x49')];if(!_0x5c38e9[_0x59b6('0x44')][_0x59b6('0x64')]('nolimit')){_0x29261b['limit']=qs['limit'](_0x5c38e9[_0x59b6('0x44')][_0x59b6('0x2f')]);_0x29261b[_0x59b6('0x2d')]=qs[_0x59b6('0x2d')](_0x5c38e9['query'][_0x59b6('0x2d')]);}return _0x1c6e99[_0x59b6('0x7d')](_0x29261b);}})[_0x59b6('0x35')](function(_0x4f3db0){if(_0x4f3db0){return _0x4f3db0?{'count':_0x281945,'rows':_0x4f3db0}:null;}})[_0x59b6('0x35')](respondWithResult(_0x16854c,null))[_0x59b6('0x28')](handleError(_0x16854c,null));};exports['notify']=function(_0x573cbf,_0x5b9cb3,_0xf7cbef){var _0x4dd4be={'channel':'whatsapp'};var _0x3df921=[];var _0x83cac8=[];var _0x3fa904={};return db[_0x59b6('0x3e')][_0x59b6('0x56')]({'where':{'id':_0x573cbf[_0x59b6('0x54')]['id']},'include':[{'model':db[_0x59b6('0x7a')],'as':'Applications'}]})[_0x59b6('0x35')](handleEntityNotFound(_0x5b9cb3,null))[_0x59b6('0x35')](function(_0x49b060){_0x4dd4be[_0x59b6('0x7e')]=_0x49b060;_0x4dd4be[_0x59b6('0x7f')]=_[_0x59b6('0x80')](_0x49b060[_0x59b6('0x81')],['priority'],[_0x59b6('0x82')]);if(_0x4dd4be['account'][_0x59b6('0x81')]){delete _0x4dd4be['account'][_0x59b6('0x81')];}return db[_0x59b6('0x83')][_0x59b6('0x5f')]();})['then'](function(_0x4d23e0){if(!_0x4d23e0){throw new db[(_0x59b6('0x84'))][(_0x59b6('0x85'))]('no\x20available\x20attributes');}_0x3df921=_[_0x59b6('0x86')](_[_0x59b6('0x43')](_0x4d23e0),['createdAt',_0x59b6('0x87')]);_0x83cac8=_[_0x59b6('0x86')](_[_0x59b6('0x43')](_0x4d23e0),[_0x59b6('0x88'),_0x59b6('0x87'),_0x59b6('0x89'),_0x59b6('0x8a')]);_0x4dd4be[_0x59b6('0x5e')]={'mapKey':_0x59b6('0x8b')};if(_0x4dd4be[_0x59b6('0x7e')][_0x59b6('0x4d')]&&_0x4dd4be[_0x59b6('0x7e')]['type']===_0x59b6('0x8c')){_0x4dd4be[_0x59b6('0x5e')][_0x59b6('0x8d')]=_0x573cbf['body'][_0x59b6('0x8e')]['replace'](_0x59b6('0x8f'),'');_0x4dd4be['body'][_0x59b6('0x5e')]=_0x573cbf[_0x59b6('0x5e')][_0x59b6('0x90')];_0x4dd4be[_0x59b6('0x5e')][_0x59b6('0x91')]=_0x573cbf['body'][_0x59b6('0x92')];}if(_0x4dd4be[_0x59b6('0x5e')]['id']){delete _0x4dd4be[_0x59b6('0x5e')]['id'];}if(_[_0x59b6('0x93')](_0x4dd4be['body'][_0x59b6('0x8d')])){throw new db[(_0x59b6('0x84'))][(_0x59b6('0x85'))](_0x59b6('0x94'));}if(_['isNil'](_0x4dd4be['body'][_0x59b6('0x5e')])||_0x4dd4be[_0x59b6('0x5e')]['body']===''){throw new db['Sequelize'][(_0x59b6('0x85'))](_0x59b6('0x95'));}if(_[_0x59b6('0x93')](_0x4dd4be[_0x59b6('0x5e')]['mapKey'])){throw new db[(_0x59b6('0x84'))]['ValidationError'](_0x59b6('0x96')+_0x83cac8);}if(!_[_0x59b6('0x97')](_0x83cac8,_0x4dd4be[_0x59b6('0x5e')][_0x59b6('0x98')])){throw new db[(_0x59b6('0x84'))][(_0x59b6('0x85'))](_0x59b6('0x99')+_0x83cac8);}_0x3fa904[_0x4dd4be['body']['mapKey']]=_0x4dd4be[_0x59b6('0x5e')]['from'];return db[_0x59b6('0x9a')]['find']({'where':{'id':_0x4dd4be[_0x59b6('0x7e')][_0x59b6('0x8a')]},'include':[{'model':db[_0x59b6('0x83')],'as':_0x59b6('0x9b'),'where':_0x3fa904,'limit':0x1,'order':[[_0x59b6('0x87'),_0x59b6('0x9c')]]}]});})[_0x59b6('0x35')](handleEntityNotFound(_0x5b9cb3,null))[_0x59b6('0x35')](function(_0x5204db){if(_0x5204db){_0x4dd4be[_0x59b6('0x9d')]=_['omit'](_0x5204db,[_0x59b6('0x9b')]);if(_0x5204db['Contacts'][_0x59b6('0x49')]){return _0x5204db[_0x59b6('0x9b')][0x0];}var _0x3810c5=_[_0x59b6('0x17')](_0x4dd4be['body'],{'firstName':_0x4dd4be[_0x59b6('0x5e')][_0x59b6('0x8d')],'ListId':_0x5204db['id']});_0x3810c5[_0x4dd4be[_0x59b6('0x5e')][_0x59b6('0x98')]]=_0x4dd4be[_0x59b6('0x5e')][_0x59b6('0x8d')];return db[_0x59b6('0x83')][_0x59b6('0x57')](_0x3810c5,{'fields':_0x3df921,'raw':!![]});}})[_0x59b6('0x35')](handleEntityNotFound(_0x5b9cb3,null))[_0x59b6('0x35')](function(_0x4631c7){if(_0x4631c7){_0x4dd4be[_0x59b6('0x9e')]=_0x4631c7;var _0xc52a63={'ContactId':_0x4631c7['id'],'phone':_0x4dd4be[_0x59b6('0x5e')][_0x59b6('0x8d')],'WhatsappAccountId':_0x573cbf['params']['id']};var _0x5eaf13={'ContactId':_0x4631c7['id'],'WhatsappAccountId':_0x573cbf[_0x59b6('0x54')]['id'],'closed':![]};return db[_0x59b6('0x9f')][_0x59b6('0x56')]({'where':_0x5eaf13})[_0x59b6('0x35')](function(_0x2f03b0){if(_0x2f03b0){return[_0x2f03b0,![]];}return db[_0x59b6('0x9f')]['create'](_0xc52a63)[_0x59b6('0x35')](function(_0x3c2f8c){return[_0x3c2f8c,!![]];});});}})[_0x59b6('0x70')](function(_0x265b7b,_0x117612){_0x4dd4be['interaction']=_0x265b7b['get']({'plain':!![]});_0x4dd4be[_0x59b6('0xa0')][_0x59b6('0xa1')]=![];if(_0x117612){if(_0x4dd4be[_0x59b6('0x7e')][_0x59b6('0xa2')]){_0x4dd4be[_0x59b6('0x7f')]['push']({'id':0x0,'priority':_0x4dd4be[_0x59b6('0x7f')][_0x59b6('0x49')]+0x1,'app':_0x59b6('0xa3'),'appdata':_0x59b6('0xa4'),'interval':_0x59b6('0xa5')});}_0x4dd4be[_0x59b6('0xa0')][_0x59b6('0xa1')]=!![];}return db['WhatsappMessage'][_0x59b6('0x57')]({'phone':_0x4dd4be[_0x59b6('0x5e')][_0x59b6('0x8d')],'messageId':_0x4dd4be[_0x59b6('0x5e')][_0x59b6('0x91')],'body':_0x4dd4be[_0x59b6('0x5e')][_0x59b6('0x5e')],'WhatsappAccountId':_0x573cbf[_0x59b6('0x54')]['id'],'WhatsappInteractionId':_0x265b7b['id'],'direction':'in','ContactId':_0x265b7b[_0x59b6('0xa6')],'AttachmentId':_0x4dd4be[_0x59b6('0x5e')][_0x59b6('0xa7')]});})[_0x59b6('0x35')](function(_0x3e3c01){_0x4dd4be[_0x59b6('0x26')]=_0x3e3c01;if(_0x4dd4be[_0x59b6('0xa0')]['UserId']){return db[_0x59b6('0x76')]['find']({'attributes':['id',_0x59b6('0x39')],'where':{'id':_0x4dd4be[_0x59b6('0xa0')][_0x59b6('0xa8')]}})[_0x59b6('0x35')](function(_0x52efa8){if(_0x52efa8){_0x4dd4be['applications'][_0x59b6('0xa9')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x52efa8['name']+','+(_0x4dd4be[_0x59b6('0x7e')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x59b6('0xaa'),_0x59b6('0xab'),_0x4dd4be);});}return respondWithRpcPromise('Start',_0x59b6('0xab'),_0x4dd4be);})[_0x59b6('0x35')](function(_0x394069){if(_0x394069){var _0xa1039=0xc8;var _0x51f76d=_0x59b6('0xac');logger[_0x59b6('0x1e')](_0x59b6('0x22'),_0x51f76d,_0xa1039,_0x59b6('0xad'));logger[_0x59b6('0x21')](_0x59b6('0xae'),_0x51f76d,_0xa1039,_0x59b6('0xad'),JSON[_0x59b6('0x23')](_0x394069));if(_0x4dd4be[_0x59b6('0x7e')][_0x59b6('0x4d')]===_0x59b6('0x8c')){return _0x5b9cb3[_0x59b6('0x2a')](_0xa1039)['set'](_0x59b6('0xaf'),_0x59b6('0xb0'))[_0x59b6('0x3a')](_0x59b6('0xb1'));}else{return _0x5b9cb3['status'](_0xa1039)[_0x59b6('0x2c')](_0x394069);}}})[_0x59b6('0x28')](handleError(_0x5b9cb3,null));};exports[_0x59b6('0x3a')]=function(_0x2c47fe,_0x34914a,_0x5052e9){var _0x3962ad,_0x555b83,_0x47f3ab;if(_['isNil'](_0x2c47fe[_0x59b6('0x5e')][_0x59b6('0x5e')])||_0x2c47fe[_0x59b6('0x5e')][_0x59b6('0x5e')]===''){throw new db[(_0x59b6('0x84'))][(_0x59b6('0x85'))](_0x59b6('0x95'));}if(_['isNil'](_0x2c47fe[_0x59b6('0x5e')]['to'])){throw new db[(_0x59b6('0x84'))][(_0x59b6('0x85'))](_0x59b6('0xb2'));}_0x3962ad=_0x2c47fe[_0x59b6('0x5e')]['to'];return db[_0x59b6('0x3e')][_0x59b6('0x56')]({'where':{'id':_0x2c47fe[_0x59b6('0x54')]['id']},'include':[{'model':db['CmList'],'as':_0x59b6('0xb3'),'include':[{'model':db[_0x59b6('0x83')],'as':_0x59b6('0x9b'),'where':{'mobile':_0x3962ad},'limit':0x1,'order':[[_0x59b6('0x87'),_0x59b6('0x9c')]]}]}]})['then'](handleEntityNotFound(_0x34914a,null))[_0x59b6('0x35')](function(_0x53ed10){if(_0x53ed10&&_0x53ed10[_0x59b6('0xb3')]){_0x555b83=_0x53ed10[_0x59b6('0xb4')]({'plain':!![]});if(_0x555b83['List']&&_0x555b83[_0x59b6('0xb3')][_0x59b6('0x9b')]['length']){return _0x555b83[_0x59b6('0xb3')]['Contacts'][0x0];}return db[_0x59b6('0x83')]['create'](_[_0x59b6('0x17')](_0x2c47fe['body'],{'firstName':_0x3962ad,'mobile':_0x3962ad,'phone':_0x3962ad,'ListId':_0x555b83['ListId']}));}})[_0x59b6('0x35')](handleEntityNotFound(_0x34914a,null))['then'](function(_0x349c50){if(_0x349c50){_0x47f3ab=_0x349c50;return db[_0x59b6('0x9f')][_0x59b6('0x56')]({'where':{'ContactId':_0x47f3ab['id'],'closed':![],'WhatsappAccountId':_0x555b83['id']}})['then'](function(_0x53e83e){if(_0x53e83e){return[_0x53e83e,![]];}return db[_0x59b6('0x9f')]['create']({'UserId':_0x2c47fe[_0x59b6('0x58')]['id'],'ContactId':_0x47f3ab['id'],'WhatsappAccountId':_0x555b83['id'],'phone':_0x3962ad,'firstMsgDirection':'out','Messages':[_[_0x59b6('0x4f')](_0x2c47fe[_0x59b6('0x5e')],{'read':![],'body':_0x2c47fe[_0x59b6('0x5e')][_0x59b6('0x5e')],'phone':_0x3962ad,'WhatsappAccountId':_0x555b83['id'],'UserId':_0x2c47fe[_0x59b6('0x58')]['id'],'ContactId':_0x47f3ab['id']})]},{'include':[{'model':db[_0x59b6('0xb5')],'as':_0x59b6('0xb6')}]})[_0x59b6('0x35')](function(_0xcd6fad){return[_0xcd6fad,!![]];});});}})[_0x59b6('0x70')](function(_0x26d622,_0x52d85c){if(_0x52d85c){return _0x26d622;}return db[_0x59b6('0xb5')]['create'](_['merge'](_0x2c47fe[_0x59b6('0x5e')],{'read':![],'body':_0x2c47fe['body']['body'],'phone':_0x3962ad,'WhatsappAccountId':_0x555b83['id'],'WhatsappInteractionId':_0x26d622['id'],'UserId':_0x2c47fe[_0x59b6('0x58')]['id'],'ContactId':_0x47f3ab['id']}))[_0x59b6('0x35')](function(_0x29f5d6){_0x26d622[_0x59b6('0xb7')][_0x59b6('0xb6')]=[];_0x26d622[_0x59b6('0xb7')]['Messages'][_0x59b6('0xb8')](_0x29f5d6[_0x59b6('0xb7')]);return _0x26d622;});})[_0x59b6('0x35')](respondWithResult(_0x34914a,null))[_0x59b6('0x28')](handleError(_0x34914a,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index f1aa9b3..4e88631 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 _0xe09c=['hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xe09c,0x146));var _0xce09=function(_0x3a1af0,_0x8c74f8){_0x3a1af0=_0x3a1af0-0x0;var _0x109590=_0xe09c[_0x3a1af0];return _0x109590;};'use strict';var EventEmitter=require(_0xce09('0x0'));var WhatsappAccount=require(_0xce09('0x1'))['db'][_0xce09('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xce09('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xce09('0x4')};function emitEvent(_0x51dae8){return function(_0x4f7eba,_0x383cba,_0x1b0b1a){WhatsappAccountEvents[_0xce09('0x5')](_0x51dae8+':'+_0x4f7eba['id'],_0x4f7eba);WhatsappAccountEvents[_0xce09('0x5')](_0x51dae8,_0x4f7eba);_0x1b0b1a(null);};}for(var e in events){if(events[_0xce09('0x6')](e)){var event=events[e];WhatsappAccount[_0xce09('0x7')](e,emitEvent(event));}}module[_0xce09('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0xd398=['remove','emit','hasOwnProperty','hook','exports','events','WhatsappAccount','save'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xd398,0xd5));var _0x8d39=function(_0x549027,_0x59c065){_0x549027=_0x549027-0x0;var _0x18491f=_0xd398[_0x549027];return _0x18491f;};'use strict';var EventEmitter=require(_0x8d39('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0x8d39('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8d39('0x2'),'afterUpdate':'update','afterDestroy':_0x8d39('0x3')};function emitEvent(_0x4cd8d9){return function(_0x44132c,_0x3c0241,_0x38f519){WhatsappAccountEvents[_0x8d39('0x4')](_0x4cd8d9+':'+_0x44132c['id'],_0x44132c);WhatsappAccountEvents[_0x8d39('0x4')](_0x4cd8d9,_0x44132c);_0x38f519(null);};}for(var e in events){if(events[_0x8d39('0x5')](e)){var event=events[e];WhatsappAccount[_0x8d39('0x6')](e,emitEvent(event));}}module[_0x8d39('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 26aed5e..941383b 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 _0xcc17=['bluebird','../../config/environment','exports','WhatsappAccount','whatsapp_accounts','util','../../config/logger','api','moment'];(function(_0x4eb358,_0x9cecc9){var _0x5eaa2e=function(_0x5743a7){while(--_0x5743a7){_0x4eb358['push'](_0x4eb358['shift']());}};_0x5eaa2e(++_0x9cecc9);}(_0xcc17,0x7a));var _0x7cc1=function(_0x285800,_0x26765e){_0x285800=_0x285800-0x0;var _0x4b809e=_0xcc17[_0x285800];return _0x4b809e;};'use strict';var _=require('lodash');var util=require(_0x7cc1('0x0'));var logger=require(_0x7cc1('0x1'))(_0x7cc1('0x2'));var moment=require(_0x7cc1('0x3'));var BPromise=require(_0x7cc1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7cc1('0x5'));var attributes=require('./whatsappAccount.attributes');module[_0x7cc1('0x6')]=function(_0x5f0858,_0x396f36){return _0x5f0858['define'](_0x7cc1('0x7'),attributes,{'tableName':_0x7cc1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69cf=['./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment','path','../../config/environment'];(function(_0x552b85,_0x24fac8){var _0x45cdb0=function(_0x4ce7b8){while(--_0x4ce7b8){_0x552b85['push'](_0x552b85['shift']());}};_0x45cdb0(++_0x24fac8);}(_0x69cf,0xf5));var _0xf69c=function(_0x4cb8e7,_0x2e1d22){_0x4cb8e7=_0x4cb8e7-0x0;var _0x3d0188=_0x69cf[_0x4cb8e7];return _0x3d0188;};'use strict';var _=require(_0xf69c('0x0'));var util=require(_0xf69c('0x1'));var logger=require(_0xf69c('0x2'))(_0xf69c('0x3'));var moment=require(_0xf69c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf69c('0x5'));var rimraf=require('rimraf');var config=require(_0xf69c('0x6'));var attributes=require(_0xf69c('0x7'));module[_0xf69c('0x8')]=function(_0x1eac42,_0x482420){return _0x1eac42[_0xf69c('0x9')](_0xf69c('0xa'),attributes,{'tableName':_0xf69c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index ac7d2a6..d6a2d47 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 _0xb9f4=['find','options','raw','where','attributes','include','map','model','ShowWhatsappAccount','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1730fe,_0x3f40ee){var _0x1d0a14=function(_0x5ef6fc){while(--_0x5ef6fc){_0x1730fe['push'](_0x1730fe['shift']());}};_0x1d0a14(++_0x3f40ee);}(_0xb9f4,0xdc));var _0x4b9f=function(_0x325db9,_0x20e189){_0x325db9=_0x325db9-0x0;var _0x70b5b2=_0xb9f4[_0x325db9];return _0x70b5b2;};'use strict';var _=require(_0x4b9f('0x0'));var util=require(_0x4b9f('0x1'));var moment=require(_0x4b9f('0x2'));var BPromise=require('bluebird');var rs=require(_0x4b9f('0x3'));var fs=require('fs');var Redis=require(_0x4b9f('0x4'));var db=require(_0x4b9f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4b9f('0x6'));var config=require(_0x4b9f('0x7'));var jayson=require(_0x4b9f('0x8'));var client=jayson[_0x4b9f('0x9')][_0x4b9f('0xa')]({'port':0x232a});config[_0x4b9f('0xb')]=_[_0x4b9f('0xc')](config[_0x4b9f('0xb')],{'host':_0x4b9f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4b9f('0xb')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x49ba85,_0x44eb21,_0x3c756a){return new BPromise(function(_0x15799e,_0x4ead80){return client[_0x4b9f('0xe')](_0x49ba85,_0x3c756a)[_0x4b9f('0xf')](function(_0x1a18ad){logger[_0x4b9f('0x10')](_0x4b9f('0x11'),_0x44eb21,_0x4b9f('0x12'));logger[_0x4b9f('0x13')](_0x4b9f('0x14'),_0x44eb21,_0x4b9f('0x12'),JSON[_0x4b9f('0x15')](_0x1a18ad));if(_0x1a18ad[_0x4b9f('0x16')]){if(_0x1a18ad['error'][_0x4b9f('0x17')]===0x1f4){logger[_0x4b9f('0x16')](_0x4b9f('0x11'),_0x44eb21,_0x1a18ad['error'][_0x4b9f('0x18')]);return _0x4ead80(_0x1a18ad['error'][_0x4b9f('0x18')]);}logger[_0x4b9f('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x44eb21,_0x1a18ad['error'][_0x4b9f('0x18')]);return _0x15799e(_0x1a18ad[_0x4b9f('0x16')][_0x4b9f('0x18')]);}else{logger['info'](_0x4b9f('0x11'),_0x44eb21,_0x4b9f('0x12'));_0x15799e(_0x1a18ad['result'][_0x4b9f('0x18')]);}})['catch'](function(_0x11495f){logger[_0x4b9f('0x16')](_0x4b9f('0x11'),_0x44eb21,_0x11495f);_0x4ead80(_0x11495f);});});}exports['ShowWhatsappAccount']=function(_0x2001fa){var _0x1725b4=this;return new Promise(function(_0x392e4b,_0x4495a9){return db['WhatsappAccount'][_0x4b9f('0x19')]({'raw':_0x2001fa['options']?_0x2001fa[_0x4b9f('0x1a')][_0x4b9f('0x1b')]===undefined?!![]:![]:!![],'where':_0x2001fa[_0x4b9f('0x1a')]?_0x2001fa['options'][_0x4b9f('0x1c')]||null:null,'attributes':_0x2001fa[_0x4b9f('0x1a')]?_0x2001fa[_0x4b9f('0x1a')][_0x4b9f('0x1d')]||null:null,'include':_0x2001fa['options']?_0x2001fa[_0x4b9f('0x1a')][_0x4b9f('0x1e')]?_[_0x4b9f('0x1f')](_0x2001fa[_0x4b9f('0x1a')][_0x4b9f('0x1e')],function(_0x5650fc){return{'model':db[_0x5650fc[_0x4b9f('0x20')]],'as':_0x5650fc['as'],'attributes':_0x5650fc[_0x4b9f('0x1d')],'include':_0x5650fc[_0x4b9f('0x1e')]?_['map'](_0x5650fc[_0x4b9f('0x1e')],function(_0x150802){return{'model':db[_0x150802[_0x4b9f('0x20')]],'as':_0x150802['as'],'attributes':_0x150802['attributes'],'include':_0x150802[_0x4b9f('0x1e')]?_['map'](_0x150802[_0x4b9f('0x1e')],function(_0x3eee9a){return{'model':db[_0x3eee9a[_0x4b9f('0x20')]],'as':_0x3eee9a['as'],'attributes':_0x3eee9a[_0x4b9f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4b9f('0xf')](function(_0xa59c9c){logger[_0x4b9f('0x10')](_0x4b9f('0x21'),_0x2001fa);logger[_0x4b9f('0x13')]('ShowWhatsappAccount',_0x2001fa,JSON['stringify'](_0xa59c9c));_0x392e4b(_0xa59c9c);})[_0x4b9f('0x22')](function(_0x28fe24){logger[_0x4b9f('0x16')](_0x4b9f('0x21'),_0x28fe24[_0x4b9f('0x18')],_0x2001fa);_0x4495a9(_0x1725b4['error'](0x1f4,_0x28fe24[_0x4b9f('0x18')]));});});}; \ No newline at end of file +var _0xed0b=['catch','lodash','moment','bluebird','randomstring','../../config/logger','../../config/environment','http','redis','defaults','localhost','./whatsappAccount.socket','register','request','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowWhatsappAccount','WhatsappAccount','find','raw','options','where','attributes','include','model','map','then','info'];(function(_0x35181c,_0x82694a){var _0xe14bf9=function(_0x2be9b7){while(--_0x2be9b7){_0x35181c['push'](_0x35181c['shift']());}};_0xe14bf9(++_0x82694a);}(_0xed0b,0x15f));var _0xbed0=function(_0x1b1e76,_0x31695b){_0x1b1e76=_0x1b1e76-0x0;var _0x3d743a=_0xed0b[_0x1b1e76];return _0x3d743a;};'use strict';var _=require(_0xbed0('0x0'));var util=require('util');var moment=require(_0xbed0('0x1'));var BPromise=require(_0xbed0('0x2'));var rs=require(_0xbed0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbed0('0x4'))('rpc');var config=require(_0xbed0('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbed0('0x6')]({'port':0x232a});config[_0xbed0('0x7')]=_[_0xbed0('0x8')](config[_0xbed0('0x7')],{'host':_0xbed0('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbed0('0x7')]));require(_0xbed0('0xa'))[_0xbed0('0xb')](socket);function respondWithRpcPromise(_0x1d7f7d,_0x337485,_0x499b7c){return new BPromise(function(_0x1ce67a,_0x205cdd){return client[_0xbed0('0xc')](_0x1d7f7d,_0x499b7c)['then'](function(_0x3bb9f9){logger['info'](_0xbed0('0xd'),_0x337485,_0xbed0('0xe'));logger[_0xbed0('0xf')](_0xbed0('0x10'),_0x337485,_0xbed0('0xe'),JSON[_0xbed0('0x11')](_0x3bb9f9));if(_0x3bb9f9['error']){if(_0x3bb9f9[_0xbed0('0x12')][_0xbed0('0x13')]===0x1f4){logger['error'](_0xbed0('0xd'),_0x337485,_0x3bb9f9[_0xbed0('0x12')][_0xbed0('0x14')]);return _0x205cdd(_0x3bb9f9['error']['message']);}logger[_0xbed0('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x337485,_0x3bb9f9['error']['message']);return _0x1ce67a(_0x3bb9f9[_0xbed0('0x12')][_0xbed0('0x14')]);}else{logger['info'](_0xbed0('0xd'),_0x337485,'request\x20sent');_0x1ce67a(_0x3bb9f9[_0xbed0('0x15')][_0xbed0('0x14')]);}})['catch'](function(_0x26b852){logger['error'](_0xbed0('0xd'),_0x337485,_0x26b852);_0x205cdd(_0x26b852);});});}exports[_0xbed0('0x16')]=function(_0x37d396){var _0x1b4a83=this;return new Promise(function(_0x2751a1,_0x39a4fa){return db[_0xbed0('0x17')][_0xbed0('0x18')]({'raw':_0x37d396['options']?_0x37d396['options'][_0xbed0('0x19')]===undefined?!![]:![]:!![],'where':_0x37d396[_0xbed0('0x1a')]?_0x37d396['options'][_0xbed0('0x1b')]||null:null,'attributes':_0x37d396['options']?_0x37d396[_0xbed0('0x1a')][_0xbed0('0x1c')]||null:null,'include':_0x37d396[_0xbed0('0x1a')]?_0x37d396['options'][_0xbed0('0x1d')]?_['map'](_0x37d396[_0xbed0('0x1a')][_0xbed0('0x1d')],function(_0x5f04ba){return{'model':db[_0x5f04ba[_0xbed0('0x1e')]],'as':_0x5f04ba['as'],'attributes':_0x5f04ba[_0xbed0('0x1c')],'include':_0x5f04ba[_0xbed0('0x1d')]?_[_0xbed0('0x1f')](_0x5f04ba[_0xbed0('0x1d')],function(_0x57fc19){return{'model':db[_0x57fc19[_0xbed0('0x1e')]],'as':_0x57fc19['as'],'attributes':_0x57fc19[_0xbed0('0x1c')],'include':_0x57fc19['include']?_[_0xbed0('0x1f')](_0x57fc19[_0xbed0('0x1d')],function(_0x2da5e9){return{'model':db[_0x2da5e9['model']],'as':_0x2da5e9['as'],'attributes':_0x2da5e9[_0xbed0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbed0('0x20')](function(_0x32c372){logger[_0xbed0('0x21')](_0xbed0('0x16'),_0x37d396);logger[_0xbed0('0xf')](_0xbed0('0x16'),_0x37d396,JSON[_0xbed0('0x11')](_0x32c372));_0x2751a1(_0x32c372);})[_0xbed0('0x22')](function(_0x5ee3a6){logger[_0xbed0('0x12')](_0xbed0('0x16'),_0x5ee3a6[_0xbed0('0x14')],_0x37d396);_0x39a4fa(_0x1b4a83['error'](0x1f4,_0x5ee3a6['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 121417e..32b495d 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 _0x83fc=['update','emit','removeListener','register','whatsappAccount:','remove'];(function(_0x230949,_0x790da6){var _0x54a3dd=function(_0x510d0d){while(--_0x510d0d){_0x230949['push'](_0x230949['shift']());}};_0x54a3dd(++_0x790da6);}(_0x83fc,0x1c7));var _0xc83f=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x83fc[_0x15c421];return _0x5e5ed5;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=['save',_0xc83f('0x0'),_0xc83f('0x1')];function createListener(_0x810cb,_0x1074d6){return function(_0xb39e26){_0x1074d6[_0xc83f('0x2')](_0x810cb,_0xb39e26);};}function removeListener(_0x240534,_0x4864f4){return function(){WhatsappAccountEvents[_0xc83f('0x3')](_0x240534,_0x4864f4);};}exports[_0xc83f('0x4')]=function(_0xe324de){for(var _0x2f63e3=0x0,_0x207cc0=events['length'];_0x2f63e3<_0x207cc0;_0x2f63e3++){var _0x420511=events[_0x2f63e3];var _0x110c81=createListener(_0xc83f('0x5')+_0x420511,_0xe324de);WhatsappAccountEvents['on'](_0x420511,_0x110c81);}}; \ No newline at end of file +var _0xcb22=['emit','removeListener','length','whatsappAccount:','./whatsappAccount.events','save','update'];(function(_0x8efae1,_0x30dfec){var _0x4a1265=function(_0x58f4b3){while(--_0x58f4b3){_0x8efae1['push'](_0x8efae1['shift']());}};_0x4a1265(++_0x30dfec);}(_0xcb22,0x1e7));var _0x2cb2=function(_0x26c968,_0x2d0c2d){_0x26c968=_0x26c968-0x0;var _0x2edb6a=_0xcb22[_0x26c968];return _0x2edb6a;};'use strict';var WhatsappAccountEvents=require(_0x2cb2('0x0'));var events=[_0x2cb2('0x1'),'remove',_0x2cb2('0x2')];function createListener(_0x43b695,_0x191ca0){return function(_0x2115f2){_0x191ca0[_0x2cb2('0x3')](_0x43b695,_0x2115f2);};}function removeListener(_0x337502,_0x163a88){return function(){WhatsappAccountEvents[_0x2cb2('0x4')](_0x337502,_0x163a88);};}exports['register']=function(_0x29f37f){for(var _0x50190c=0x0,_0x352258=events[_0x2cb2('0x5')];_0x50190c<_0x352258;_0x50190c++){var _0x479f50=events[_0x50190c];var _0xad5faa=createListener(_0x2cb2('0x6')+_0x479f50,_0x29f37f);WhatsappAccountEvents['on'](_0x479f50,_0xad5faa);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index e20043e..2b0b9c5 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 _0x40c1=['put','delete','destroy','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x59162a,_0x10e547){var _0x35e50d=function(_0x578425){while(--_0x578425){_0x59162a['push'](_0x59162a['shift']());}};_0x35e50d(++_0x10e547);}(_0x40c1,0x135));var _0x140c=function(_0x186ac5,_0x3f1ec9){_0x186ac5=_0x186ac5-0x0;var _0x55b797=_0x40c1[_0x186ac5];return _0x55b797;};'use strict';var multer=require(_0x140c('0x0'));var util=require(_0x140c('0x1'));var path=require(_0x140c('0x2'));var timeout=require('connect-timeout');var express=require(_0x140c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x140c('0x4'));var interaction=require(_0x140c('0x5'));var config=require('../../config/environment');var controller=require(_0x140c('0x6'));router[_0x140c('0x7')]('/',auth[_0x140c('0x8')](),controller[_0x140c('0x9')]);router[_0x140c('0x7')](_0x140c('0xa'),auth[_0x140c('0x8')](),controller[_0x140c('0xb')]);router[_0x140c('0xc')]('/',auth[_0x140c('0x8')](),controller[_0x140c('0xd')]);router[_0x140c('0xe')]('/:id',auth[_0x140c('0x8')](),controller['update']);router[_0x140c('0xf')](_0x140c('0xa'),auth[_0x140c('0x8')](),controller[_0x140c('0x10')]);module['exports']=router; \ No newline at end of file +var _0x2b81=['create','put','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','get','/:id','isAuthenticated','show','post'];(function(_0x5e0092,_0x4ad55b){var _0x367956=function(_0x157e6b){while(--_0x157e6b){_0x5e0092['push'](_0x5e0092['shift']());}};_0x367956(++_0x4ad55b);}(_0x2b81,0x125));var _0x12b8=function(_0xcd0ede,_0xd16617){_0xcd0ede=_0xcd0ede-0x0;var _0x421a1=_0x2b81[_0xcd0ede];return _0x421a1;};'use strict';var multer=require(_0x12b8('0x0'));var util=require(_0x12b8('0x1'));var path=require(_0x12b8('0x2'));var timeout=require(_0x12b8('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x12b8('0x4'));var auth=require(_0x12b8('0x5'));var interaction=require(_0x12b8('0x6'));var config=require('../../config/environment');var controller=require(_0x12b8('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x12b8('0x8')](_0x12b8('0x9'),auth[_0x12b8('0xa')](),controller[_0x12b8('0xb')]);router[_0x12b8('0xc')]('/',auth['isAuthenticated'](),controller[_0x12b8('0xd')]);router[_0x12b8('0xe')](_0x12b8('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x12b8('0xf')]('/:id',auth[_0x12b8('0xa')](),controller[_0x12b8('0x10')]);module[_0x12b8('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 9c21c87..a04c0b4 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 _0xc7a2=['STRING','*,*,*,*','sequelize','noop'];(function(_0x3b4270,_0x14d84c){var _0x5e46ed=function(_0x1180bf){while(--_0x1180bf){_0x3b4270['push'](_0x3b4270['shift']());}};_0x5e46ed(++_0x14d84c);}(_0xc7a2,0x7a));var _0x2c7a=function(_0x29c9eb,_0x3d680b){_0x29c9eb=_0x29c9eb-0x0;var _0x438352=_0xc7a2[_0x29c9eb];return _0x438352;};'use strict';var Sequelize=require(_0x2c7a('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2c7a('0x1')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2c7a('0x2')],'defaultValue':_0x2c7a('0x3')}}; \ No newline at end of file +var _0x856a=['noop','TEXT','sequelize','exports','INTEGER','STRING'];(function(_0x2b1759,_0x48f22c){var _0x471edb=function(_0x295fd5){while(--_0x295fd5){_0x2b1759['push'](_0x2b1759['shift']());}};_0x471edb(++_0x48f22c);}(_0x856a,0x182));var _0xa856=function(_0x21be1c,_0x197f48){_0x21be1c=_0x21be1c-0x0;var _0x142bf7=_0x856a[_0x21be1c];return _0x142bf7;};'use strict';var Sequelize=require(_0xa856('0x0'));module[_0xa856('0x1')]={'priority':{'type':Sequelize[_0xa856('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa856('0x3')],'allowNull':![],'defaultValue':_0xa856('0x4')},'appdata':{'type':Sequelize[_0xa856('0x5')]()},'description':{'type':Sequelize[_0xa856('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 5bc539a..8ac57c3 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 _0xfe39=['find','create','body','eml-format','rimraf','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params'];(function(_0x55d70e,_0x3b9b5f){var _0x195850=function(_0x548cfc){while(--_0x548cfc){_0x55d70e['push'](_0x55d70e['shift']());}};_0x195850(++_0x3b9b5f);}(_0xfe39,0x1b3));var _0x9fe3=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xfe39[_0x88cd7b];return _0x56fcc8;};'use strict';var emlformat=require(_0x9fe3('0x0'));var rimraf=require(_0x9fe3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9fe3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9fe3('0x3'));var Mustache=require(_0x9fe3('0x4'));var util=require('util');var path=require('path');var sox=require(_0x9fe3('0x5'));var csv=require(_0x9fe3('0x6'));var ejs=require(_0x9fe3('0x7'));var fs=require('fs');var fs_extra=require(_0x9fe3('0x8'));var _=require(_0x9fe3('0x9'));var squel=require(_0x9fe3('0xa'));var crypto=require(_0x9fe3('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9fe3('0xc'));var toCsv=require(_0x9fe3('0x6'));var querystring=require(_0x9fe3('0xd'));var Papa=require(_0x9fe3('0xe'));var Redis=require(_0x9fe3('0xf'));var authService=require(_0x9fe3('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9fe3('0x11'));var logger=require(_0x9fe3('0x12'))('api');var utils=require(_0x9fe3('0x13'));var config=require(_0x9fe3('0x14'));var licenseUtil=require(_0x9fe3('0x15'));var db=require(_0x9fe3('0x16'))['db'];function respondWithStatusCode(_0x51d1cb,_0x37bfef){_0x37bfef=_0x37bfef||0xcc;return function(_0x155013){if(_0x155013){return _0x51d1cb[_0x9fe3('0x17')](_0x37bfef);}return _0x51d1cb[_0x9fe3('0x18')](_0x37bfef)['end']();};}function respondWithResult(_0x4e4dcc,_0x329032){_0x329032=_0x329032||0xc8;return function(_0x31bbf3){if(_0x31bbf3){return _0x4e4dcc[_0x9fe3('0x18')](_0x329032)[_0x9fe3('0x19')](_0x31bbf3);}};}function respondWithFilteredResult(_0x1b2057,_0x5f5b58){return function(_0x5f0067){if(_0x5f0067){var _0x207eef=typeof _0x5f5b58[_0x9fe3('0x1a')]===_0x9fe3('0x1b')&&typeof _0x5f5b58[_0x9fe3('0x1c')]==='undefined';var _0xd7141a=_0x5f0067[_0x9fe3('0x1d')];var _0x15fcaa=_0x207eef?0x0:_0x5f5b58['offset'];var _0x35bbaf=_0x207eef?_0x5f0067[_0x9fe3('0x1d')]:_0x5f5b58['offset']+_0x5f5b58[_0x9fe3('0x1c')];var _0x4f272c;if(_0x35bbaf>=_0xd7141a){_0x35bbaf=_0xd7141a;_0x4f272c=0xc8;}else{_0x4f272c=0xce;}_0x1b2057[_0x9fe3('0x18')](_0x4f272c);return _0x1b2057['set'](_0x9fe3('0x1e'),_0x15fcaa+'-'+_0x35bbaf+'/'+_0xd7141a)[_0x9fe3('0x19')](_0x5f0067);}return null;};}function patchUpdates(_0x302d5c){return function(_0x5b53f3){try{jsonpatch['apply'](_0x5b53f3,_0x302d5c,!![]);}catch(_0x113f23){return BPromise[_0x9fe3('0x1f')](_0x113f23);}return _0x5b53f3['save']();};}function saveUpdates(_0x328989,_0x2e9ae5){return function(_0x587e43){if(_0x587e43){return _0x587e43[_0x9fe3('0x20')](_0x328989)[_0x9fe3('0x21')](function(_0x5b6719){return _0x5b6719;});}return null;};}function removeEntity(_0x3ec2e7,_0x2fb7a9){return function(_0x3fd88e){if(_0x3fd88e){return _0x3fd88e[_0x9fe3('0x22')]()[_0x9fe3('0x21')](function(){_0x3ec2e7[_0x9fe3('0x18')](0xcc)[_0x9fe3('0x23')]();});}};}function handleEntityNotFound(_0x4c1a30,_0x1763c0){return function(_0x1304ff){if(!_0x1304ff){_0x4c1a30[_0x9fe3('0x17')](0x194);}return _0x1304ff;};}function handleError(_0x3b29dd,_0x47f38b){_0x47f38b=_0x47f38b||0x1f4;return function(_0x1a4a43){logger[_0x9fe3('0x24')](_0x1a4a43[_0x9fe3('0x25')]);if(_0x1a4a43['name']){delete _0x1a4a43[_0x9fe3('0x26')];}_0x3b29dd[_0x9fe3('0x18')](_0x47f38b)[_0x9fe3('0x27')](_0x1a4a43);};}exports[_0x9fe3('0x28')]=function(_0x1d2da7,_0x17f01f){var _0x59eb15={},_0xa4d56e={},_0x369fde={'count':0x0,'rows':[]};var _0x31d8fb=_[_0x9fe3('0x29')](db[_0x9fe3('0x2a')][_0x9fe3('0x2b')],function(_0x5a9af3){return{'name':_0x5a9af3[_0x9fe3('0x2c')],'type':_0x5a9af3[_0x9fe3('0x2d')]['key']};});_0xa4d56e[_0x9fe3('0x2e')]=_[_0x9fe3('0x29')](_0x31d8fb,_0x9fe3('0x26'));_0xa4d56e[_0x9fe3('0x2f')]=_[_0x9fe3('0x30')](_0x1d2da7[_0x9fe3('0x2f')]);_0xa4d56e['filters']=_[_0x9fe3('0x31')](_0xa4d56e[_0x9fe3('0x2e')],_0xa4d56e[_0x9fe3('0x2f')]);_0x59eb15['attributes']=_['intersection'](_0xa4d56e['model'],qs[_0x9fe3('0x32')](_0x1d2da7['query'][_0x9fe3('0x32')]));_0x59eb15[_0x9fe3('0x33')]=_0x59eb15[_0x9fe3('0x33')][_0x9fe3('0x34')]?_0x59eb15[_0x9fe3('0x33')]:_0xa4d56e[_0x9fe3('0x2e')];if(!_0x1d2da7[_0x9fe3('0x2f')][_0x9fe3('0x35')](_0x9fe3('0x36'))){_0x59eb15['limit']=qs[_0x9fe3('0x1c')](_0x1d2da7['query']['limit']);_0x59eb15[_0x9fe3('0x1a')]=qs[_0x9fe3('0x1a')](_0x1d2da7[_0x9fe3('0x2f')][_0x9fe3('0x1a')]);}_0x59eb15['order']=qs[_0x9fe3('0x37')](_0x1d2da7[_0x9fe3('0x2f')][_0x9fe3('0x37')]);_0x59eb15['where']=qs[_0x9fe3('0x38')](_[_0x9fe3('0x39')](_0x1d2da7[_0x9fe3('0x2f')],_0xa4d56e[_0x9fe3('0x38')]),_0x31d8fb);if(_0x1d2da7['query'][_0x9fe3('0x3a')]){_0x59eb15[_0x9fe3('0x3b')]=_['merge'](_0x59eb15['where'],{'$or':_[_0x9fe3('0x29')](_0x31d8fb,function(_0x5a09e8){if(_0x5a09e8[_0x9fe3('0x2d')]!==_0x9fe3('0x3c')){var _0x294073={};_0x294073[_0x5a09e8[_0x9fe3('0x26')]]={'$like':'%'+_0x1d2da7[_0x9fe3('0x2f')][_0x9fe3('0x3a')]+'%'};return _0x294073;}})});}_0x59eb15=_[_0x9fe3('0x3d')]({},_0x59eb15,_0x1d2da7[_0x9fe3('0x3e')]);var _0x5932b5={'where':_0x59eb15[_0x9fe3('0x3b')]};return db[_0x9fe3('0x2a')][_0x9fe3('0x1d')](_0x5932b5)[_0x9fe3('0x21')](function(_0x24f7bf){_0x369fde[_0x9fe3('0x1d')]=_0x24f7bf;if(_0x1d2da7[_0x9fe3('0x2f')][_0x9fe3('0x3f')]){_0x59eb15[_0x9fe3('0x40')]=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x59eb15);})['then'](function(_0x4d96b8){_0x369fde[_0x9fe3('0x41')]=_0x4d96b8;return _0x369fde;})[_0x9fe3('0x21')](respondWithFilteredResult(_0x17f01f,_0x59eb15))[_0x9fe3('0x42')](handleError(_0x17f01f,null));};exports[_0x9fe3('0x43')]=function(_0x1e5c52,_0x5126b6){var _0x1868a2={'raw':!![],'where':{'id':_0x1e5c52[_0x9fe3('0x44')]['id']}},_0x157bf5={};_0x157bf5['model']=_[_0x9fe3('0x30')](db[_0x9fe3('0x2a')][_0x9fe3('0x2b')]);_0x157bf5['query']=_['keys'](_0x1e5c52['query']);_0x157bf5[_0x9fe3('0x38')]=_['intersection'](_0x157bf5[_0x9fe3('0x2e')],_0x157bf5[_0x9fe3('0x2f')]);_0x1868a2['attributes']=_['intersection'](_0x157bf5['model'],qs['fields'](_0x1e5c52[_0x9fe3('0x2f')][_0x9fe3('0x32')]));_0x1868a2[_0x9fe3('0x33')]=_0x1868a2[_0x9fe3('0x33')][_0x9fe3('0x34')]?_0x1868a2[_0x9fe3('0x33')]:_0x157bf5[_0x9fe3('0x2e')];if(_0x1e5c52[_0x9fe3('0x2f')]['includeAll']){_0x1868a2['include']=[{'all':!![]}];}_0x1868a2=_['merge']({},_0x1868a2,_0x1e5c52[_0x9fe3('0x3e')]);return db['WhatsappApplication'][_0x9fe3('0x45')](_0x1868a2)[_0x9fe3('0x21')](handleEntityNotFound(_0x5126b6,null))[_0x9fe3('0x21')](respondWithResult(_0x5126b6,null))[_0x9fe3('0x42')](handleError(_0x5126b6,null));};exports[_0x9fe3('0x46')]=function(_0x501504,_0x105373){return db[_0x9fe3('0x2a')][_0x9fe3('0x46')](_0x501504[_0x9fe3('0x47')],{})[_0x9fe3('0x21')](respondWithResult(_0x105373,0xc9))[_0x9fe3('0x42')](handleError(_0x105373,null));};exports['update']=function(_0x5dc31e,_0x480aa5){if(_0x5dc31e[_0x9fe3('0x47')]['id']){delete _0x5dc31e['body']['id'];}return db[_0x9fe3('0x2a')][_0x9fe3('0x45')]({'where':{'id':_0x5dc31e[_0x9fe3('0x44')]['id']}})[_0x9fe3('0x21')](handleEntityNotFound(_0x480aa5,null))[_0x9fe3('0x21')](saveUpdates(_0x5dc31e[_0x9fe3('0x47')],null))['then'](respondWithResult(_0x480aa5,null))[_0x9fe3('0x42')](handleError(_0x480aa5,null));};exports['destroy']=function(_0xe25bdb,_0x435e75){return db['WhatsappApplication'][_0x9fe3('0x45')]({'where':{'id':_0xe25bdb['params']['id']}})[_0x9fe3('0x21')](handleEntityNotFound(_0x435e75,null))[_0x9fe3('0x21')](removeEntity(_0x435e75,null))[_0x9fe3('0x42')](handleError(_0x435e75,null));}; \ No newline at end of file +var _0xe0dc=['apply','update','then','error','stack','name','index','map','WhatsappApplication','rawAttributes','fieldName','model','query','keys','intersection','attributes','nolimit','sort','where','filters','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x4697ad,_0x44c008){var _0x5ee2e4=function(_0x52be06){while(--_0x52be06){_0x4697ad['push'](_0x4697ad['shift']());}};_0x5ee2e4(++_0x44c008);}(_0xe0dc,0x190));var _0xce0d=function(_0x5ee300,_0x59f054){_0x5ee300=_0x5ee300-0x0;var _0x15717b=_0xe0dc[_0x5ee300];return _0x15717b;};'use strict';var emlformat=require(_0xce0d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xce0d('0x1'));var jsonpatch=require(_0xce0d('0x2'));var rp=require('request-promise');var moment=require(_0xce0d('0x3'));var BPromise=require(_0xce0d('0x4'));var Mustache=require(_0xce0d('0x5'));var util=require(_0xce0d('0x6'));var path=require('path');var sox=require(_0xce0d('0x7'));var csv=require('to-csv');var ejs=require(_0xce0d('0x8'));var fs=require('fs');var fs_extra=require(_0xce0d('0x9'));var _=require(_0xce0d('0xa'));var squel=require(_0xce0d('0xb'));var crypto=require(_0xce0d('0xc'));var jsforce=require(_0xce0d('0xd'));var deskjs=require(_0xce0d('0xe'));var toCsv=require(_0xce0d('0xf'));var querystring=require(_0xce0d('0x10'));var Papa=require(_0xce0d('0x11'));var Redis=require(_0xce0d('0x12'));var authService=require(_0xce0d('0x13'));var qs=require(_0xce0d('0x14'));var as=require(_0xce0d('0x15'));var hardwareService=require(_0xce0d('0x16'));var logger=require(_0xce0d('0x17'))(_0xce0d('0x18'));var utils=require(_0xce0d('0x19'));var config=require(_0xce0d('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xce0d('0x1b'))['db'];function respondWithStatusCode(_0x419b8a,_0x2a802c){_0x2a802c=_0x2a802c||0xcc;return function(_0x29a87c){if(_0x29a87c){return _0x419b8a[_0xce0d('0x1c')](_0x2a802c);}return _0x419b8a[_0xce0d('0x1d')](_0x2a802c)[_0xce0d('0x1e')]();};}function respondWithResult(_0x178400,_0x18a96e){_0x18a96e=_0x18a96e||0xc8;return function(_0xfba354){if(_0xfba354){return _0x178400[_0xce0d('0x1d')](_0x18a96e)[_0xce0d('0x1f')](_0xfba354);}};}function respondWithFilteredResult(_0x2a2f69,_0x3bedc2){return function(_0xef9e5f){if(_0xef9e5f){var _0x176c81=typeof _0x3bedc2[_0xce0d('0x20')]===_0xce0d('0x21')&&typeof _0x3bedc2[_0xce0d('0x22')]===_0xce0d('0x21');var _0x2044df=_0xef9e5f[_0xce0d('0x23')];var _0x1dc8aa=_0x176c81?0x0:_0x3bedc2[_0xce0d('0x20')];var _0x3378f2=_0x176c81?_0xef9e5f[_0xce0d('0x23')]:_0x3bedc2[_0xce0d('0x20')]+_0x3bedc2[_0xce0d('0x22')];var _0x37aae8;if(_0x3378f2>=_0x2044df){_0x3378f2=_0x2044df;_0x37aae8=0xc8;}else{_0x37aae8=0xce;}_0x2a2f69[_0xce0d('0x1d')](_0x37aae8);return _0x2a2f69[_0xce0d('0x24')](_0xce0d('0x25'),_0x1dc8aa+'-'+_0x3378f2+'/'+_0x2044df)[_0xce0d('0x1f')](_0xef9e5f);}return null;};}function patchUpdates(_0x1fb46d){return function(_0x8388e3){try{jsonpatch[_0xce0d('0x26')](_0x8388e3,_0x1fb46d,!![]);}catch(_0x16788f){return BPromise['reject'](_0x16788f);}return _0x8388e3['save']();};}function saveUpdates(_0xa0277a,_0x4da3f6){return function(_0x2727c2){if(_0x2727c2){return _0x2727c2[_0xce0d('0x27')](_0xa0277a)[_0xce0d('0x28')](function(_0x58d7c5){return _0x58d7c5;});}return null;};}function removeEntity(_0x1ff817,_0x542d3d){return function(_0x298f3e){if(_0x298f3e){return _0x298f3e['destroy']()[_0xce0d('0x28')](function(){_0x1ff817[_0xce0d('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x516609,_0x31300f){return function(_0x201167){if(!_0x201167){_0x516609[_0xce0d('0x1c')](0x194);}return _0x201167;};}function handleError(_0x41b228,_0xdab05c){_0xdab05c=_0xdab05c||0x1f4;return function(_0x4cbaf4){logger[_0xce0d('0x29')](_0x4cbaf4[_0xce0d('0x2a')]);if(_0x4cbaf4[_0xce0d('0x2b')]){delete _0x4cbaf4['name'];}_0x41b228[_0xce0d('0x1d')](_0xdab05c)['send'](_0x4cbaf4);};}exports[_0xce0d('0x2c')]=function(_0x1eb234,_0x328842){var _0x435fd2={},_0x1a7f8c={},_0x3c4ec8={'count':0x0,'rows':[]};var _0x2c9c1b=_[_0xce0d('0x2d')](db[_0xce0d('0x2e')][_0xce0d('0x2f')],function(_0x4171cb){return{'name':_0x4171cb[_0xce0d('0x30')],'type':_0x4171cb['type']['key']};});_0x1a7f8c[_0xce0d('0x31')]=_[_0xce0d('0x2d')](_0x2c9c1b,_0xce0d('0x2b'));_0x1a7f8c[_0xce0d('0x32')]=_[_0xce0d('0x33')](_0x1eb234['query']);_0x1a7f8c['filters']=_[_0xce0d('0x34')](_0x1a7f8c[_0xce0d('0x31')],_0x1a7f8c['query']);_0x435fd2['attributes']=_['intersection'](_0x1a7f8c[_0xce0d('0x31')],qs['fields'](_0x1eb234['query']['fields']));_0x435fd2[_0xce0d('0x35')]=_0x435fd2['attributes']['length']?_0x435fd2['attributes']:_0x1a7f8c['model'];if(!_0x1eb234['query']['hasOwnProperty'](_0xce0d('0x36'))){_0x435fd2[_0xce0d('0x22')]=qs[_0xce0d('0x22')](_0x1eb234[_0xce0d('0x32')][_0xce0d('0x22')]);_0x435fd2[_0xce0d('0x20')]=qs[_0xce0d('0x20')](_0x1eb234[_0xce0d('0x32')][_0xce0d('0x20')]);}_0x435fd2['order']=qs[_0xce0d('0x37')](_0x1eb234[_0xce0d('0x32')]['sort']);_0x435fd2[_0xce0d('0x38')]=qs[_0xce0d('0x39')](_['pick'](_0x1eb234['query'],_0x1a7f8c[_0xce0d('0x39')]),_0x2c9c1b);if(_0x1eb234[_0xce0d('0x32')][_0xce0d('0x3a')]){_0x435fd2[_0xce0d('0x38')]=_[_0xce0d('0x3b')](_0x435fd2['where'],{'$or':_['map'](_0x2c9c1b,function(_0x27d599){if(_0x27d599[_0xce0d('0x3c')]!=='VIRTUAL'){var _0x4d4297={};_0x4d4297[_0x27d599[_0xce0d('0x2b')]]={'$like':'%'+_0x1eb234[_0xce0d('0x32')][_0xce0d('0x3a')]+'%'};return _0x4d4297;}})});}_0x435fd2=_[_0xce0d('0x3b')]({},_0x435fd2,_0x1eb234[_0xce0d('0x3d')]);var _0x1cfa6c={'where':_0x435fd2['where']};return db[_0xce0d('0x2e')][_0xce0d('0x23')](_0x1cfa6c)[_0xce0d('0x28')](function(_0x18a56f){_0x3c4ec8[_0xce0d('0x23')]=_0x18a56f;if(_0x1eb234[_0xce0d('0x32')][_0xce0d('0x3e')]){_0x435fd2[_0xce0d('0x3f')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xce0d('0x40')](_0x435fd2);})['then'](function(_0x6352f9){_0x3c4ec8[_0xce0d('0x41')]=_0x6352f9;return _0x3c4ec8;})[_0xce0d('0x28')](respondWithFilteredResult(_0x328842,_0x435fd2))[_0xce0d('0x42')](handleError(_0x328842,null));};exports[_0xce0d('0x43')]=function(_0x4abd42,_0x118d68){var _0x1d19ed={'raw':!![],'where':{'id':_0x4abd42[_0xce0d('0x44')]['id']}},_0x5457d8={};_0x5457d8['model']=_[_0xce0d('0x33')](db[_0xce0d('0x2e')][_0xce0d('0x2f')]);_0x5457d8['query']=_[_0xce0d('0x33')](_0x4abd42[_0xce0d('0x32')]);_0x5457d8['filters']=_['intersection'](_0x5457d8[_0xce0d('0x31')],_0x5457d8[_0xce0d('0x32')]);_0x1d19ed[_0xce0d('0x35')]=_[_0xce0d('0x34')](_0x5457d8[_0xce0d('0x31')],qs['fields'](_0x4abd42['query']['fields']));_0x1d19ed[_0xce0d('0x35')]=_0x1d19ed[_0xce0d('0x35')][_0xce0d('0x45')]?_0x1d19ed[_0xce0d('0x35')]:_0x5457d8[_0xce0d('0x31')];if(_0x4abd42[_0xce0d('0x32')][_0xce0d('0x3e')]){_0x1d19ed['include']=[{'all':!![]}];}_0x1d19ed=_['merge']({},_0x1d19ed,_0x4abd42[_0xce0d('0x3d')]);return db[_0xce0d('0x2e')][_0xce0d('0x46')](_0x1d19ed)[_0xce0d('0x28')](handleEntityNotFound(_0x118d68,null))[_0xce0d('0x28')](respondWithResult(_0x118d68,null))[_0xce0d('0x42')](handleError(_0x118d68,null));};exports[_0xce0d('0x47')]=function(_0x47daa0,_0x362827){return db['WhatsappApplication']['create'](_0x47daa0[_0xce0d('0x48')],{})[_0xce0d('0x28')](respondWithResult(_0x362827,0xc9))[_0xce0d('0x42')](handleError(_0x362827,null));};exports['update']=function(_0x641547,_0x36f502){if(_0x641547['body']['id']){delete _0x641547[_0xce0d('0x48')]['id'];}return db[_0xce0d('0x2e')][_0xce0d('0x46')]({'where':{'id':_0x641547[_0xce0d('0x44')]['id']}})[_0xce0d('0x28')](handleEntityNotFound(_0x36f502,null))[_0xce0d('0x28')](saveUpdates(_0x641547[_0xce0d('0x48')],null))[_0xce0d('0x28')](respondWithResult(_0x36f502,null))[_0xce0d('0x42')](handleError(_0x36f502,null));};exports['destroy']=function(_0x327487,_0x4438e3){return db[_0xce0d('0x2e')][_0xce0d('0x46')]({'where':{'id':_0x327487['params']['id']}})[_0xce0d('0x28')](handleEntityNotFound(_0x4438e3,null))[_0xce0d('0x28')](removeEntity(_0x4438e3,null))['catch'](handleError(_0x4438e3,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 76a357c..9380778 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 _0x5455=['define','WhatsappApplication','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','./whatsappApplication.attributes','exports'];(function(_0x2a4a45,_0x4b05ba){var _0x322cd8=function(_0xba8b35){while(--_0xba8b35){_0x2a4a45['push'](_0x2a4a45['shift']());}};_0x322cd8(++_0x4b05ba);}(_0x5455,0x197));var _0x5545=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5455[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0x5545('0x0'));var logger=require(_0x5545('0x1'))(_0x5545('0x2'));var moment=require(_0x5545('0x3'));var BPromise=require(_0x5545('0x4'));var rp=require(_0x5545('0x5'));var fs=require('fs');var path=require(_0x5545('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5545('0x7'));module[_0x5545('0x8')]=function(_0x5c22f1,_0x5a6ac7){return _0x5c22f1[_0x5545('0x9')](_0x5545('0xa'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5545('0xb'),'collate':_0x5545('0xc')});}; \ No newline at end of file +var _0xc5ba=['./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x20fe4c,_0x244345){var _0x3294bb=function(_0x53a199){while(--_0x53a199){_0x20fe4c['push'](_0x20fe4c['shift']());}};_0x3294bb(++_0x244345);}(_0xc5ba,0xb9));var _0xac5b=function(_0x33d581,_0x2da6d0){_0x33d581=_0x33d581-0x0;var _0x3320da=_0xc5ba[_0x33d581];return _0x3320da;};'use strict';var _=require(_0xac5b('0x0'));var util=require(_0xac5b('0x1'));var logger=require(_0xac5b('0x2'))(_0xac5b('0x3'));var moment=require(_0xac5b('0x4'));var BPromise=require(_0xac5b('0x5'));var rp=require(_0xac5b('0x6'));var fs=require('fs');var path=require(_0xac5b('0x7'));var rimraf=require(_0xac5b('0x8'));var config=require(_0xac5b('0x9'));var attributes=require(_0xac5b('0xa'));module[_0xac5b('0xb')]=function(_0x23cf2f,_0x17fcf3){return _0x23cf2f[_0xac5b('0xc')](_0xac5b('0xd'),attributes,{'tableName':_0xac5b('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','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 fa59337..a85e33f 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 _0x2d17=['WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2fc1f6,_0x51543e){var _0x7a3346=function(_0x589b08){while(--_0x589b08){_0x2fc1f6['push'](_0x2fc1f6['shift']());}};_0x7a3346(++_0x51543e);}(_0x2d17,0x17e));var _0x72d1=function(_0x27fef7,_0xa9162f){_0x27fef7=_0x27fef7-0x0;var _0x3a1084=_0x2d17[_0x27fef7];return _0x3a1084;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var moment=require('moment');var BPromise=require(_0x72d1('0x2'));var rs=require(_0x72d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72d1('0x4'))['db'];var utils=require(_0x72d1('0x5'));var logger=require('../../config/logger')(_0x72d1('0x6'));var config=require('../../config/environment');var jayson=require(_0x72d1('0x7'));var client=jayson['client'][_0x72d1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x239d1f,_0x5b40a9,_0x477264){return new BPromise(function(_0x422f5a,_0x19e248){return client['request'](_0x239d1f,_0x477264)[_0x72d1('0x9')](function(_0x288362){logger[_0x72d1('0xa')]('WhatsappApplication,\x20%s,\x20%s',_0x5b40a9,_0x72d1('0xb'));logger[_0x72d1('0xc')](_0x72d1('0xd'),_0x5b40a9,_0x72d1('0xb'),JSON[_0x72d1('0xe')](_0x288362));if(_0x288362[_0x72d1('0xf')]){if(_0x288362[_0x72d1('0xf')][_0x72d1('0x10')]===0x1f4){logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x288362['error'][_0x72d1('0x12')]);return _0x19e248(_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);}logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);return _0x422f5a(_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);}else{logger[_0x72d1('0xa')](_0x72d1('0x11'),_0x5b40a9,_0x72d1('0xb'));_0x422f5a(_0x288362[_0x72d1('0x13')]['message']);}})[_0x72d1('0x14')](function(_0x5262b0){logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x5262b0);_0x19e248(_0x5262b0);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4301f0,_0x771fde){var _0x541569=function(_0x11eee7){while(--_0x11eee7){_0x4301f0['push'](_0x4301f0['shift']());}};_0x541569(++_0x771fde);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 175a6e8..9bc3a4e 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 _0x25fa=['update','delete','whatsappinteraction:destroy','removeTags','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update'];(function(_0x3763d7,_0x105b20){var _0x9694e4=function(_0x2ed882){while(--_0x2ed882){_0x3763d7['push'](_0x3763d7['shift']());}};_0x9694e4(++_0x105b20);}(_0x25fa,0x109));var _0xa25f=function(_0x47ced9,_0x1bc596){_0x47ced9=_0x47ced9-0x0;var _0x3b9dc8=_0x25fa[_0x47ced9];return _0x3b9dc8;};'use strict';var multer=require(_0xa25f('0x0'));var util=require('util');var path=require(_0xa25f('0x1'));var timeout=require(_0xa25f('0x2'));var express=require('express');var router=express[_0xa25f('0x3')]();var fs_extra=require(_0xa25f('0x4'));var auth=require(_0xa25f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa25f('0x6'));router['get']('/',auth[_0xa25f('0x7')](),controller[_0xa25f('0x8')]);router[_0xa25f('0x9')](_0xa25f('0xa'),auth[_0xa25f('0x7')](),controller[_0xa25f('0xb')]);router[_0xa25f('0x9')](_0xa25f('0xc'),auth[_0xa25f('0x7')](),controller['show']);router[_0xa25f('0x9')](_0xa25f('0xd'),auth['isAuthenticated'](),controller[_0xa25f('0xe')]);router[_0xa25f('0x9')](_0xa25f('0xf'),auth[_0xa25f('0x7')](),controller['download']);router[_0xa25f('0x10')]('/',auth[_0xa25f('0x7')](),controller['create']);router[_0xa25f('0x10')](_0xa25f('0xd'),auth['isAuthenticated'](),controller[_0xa25f('0x11')]);router[_0xa25f('0x10')](_0xa25f('0x12'),auth[_0xa25f('0x7')](),interaction[_0xa25f('0x13')](_0xa25f('0x14'),_0xa25f('0x15')),controller[_0xa25f('0x16')]);router[_0xa25f('0x17')](_0xa25f('0xc'),auth[_0xa25f('0x7')](),interaction[_0xa25f('0x13')]('whatsapp',_0xa25f('0x18')),controller[_0xa25f('0x19')]);router[_0xa25f('0x1a')](_0xa25f('0xc'),auth[_0xa25f('0x7')](),interaction[_0xa25f('0x13')]('whatsapp',_0xa25f('0x1b')),controller['destroy']);router[_0xa25f('0x1a')]('/:id/tags',auth['isAuthenticated'](),controller[_0xa25f('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xc1c6=['/describe','isAuthenticated','describe','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','/:id','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x21e3b2,_0x3aed86){var _0xd587d=function(_0x174345){while(--_0x174345){_0x21e3b2['push'](_0x21e3b2['shift']());}};_0xd587d(++_0x3aed86);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x1a645f,_0x126ca8){_0x1a645f=_0x1a645f-0x0;var _0x1056bc=_0xc1c6[_0x1a645f];return _0x1056bc;};'use strict';var multer=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var path=require(_0x6c1c('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c1c('0x3'));var router=express['Router']();var fs_extra=require(_0x6c1c('0x4'));var auth=require(_0x6c1c('0x5'));var interaction=require(_0x6c1c('0x6'));var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0x6c1c('0x7')]('/',auth['isAuthenticated'](),controller[_0x6c1c('0x8')]);router['get'](_0x6c1c('0x9'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xb')]);router[_0x6c1c('0x7')]('/:id',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xc')]);router['get'](_0x6c1c('0xd'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xe')]);router[_0x6c1c('0x7')]('/:id/download',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xf')]);router[_0x6c1c('0x10')]('/',auth['isAuthenticated'](),controller[_0x6c1c('0x11')]);router[_0x6c1c('0x10')](_0x6c1c('0xd'),auth['isAuthenticated'](),controller[_0x6c1c('0x12')]);router['post'](_0x6c1c('0x13'),auth[_0x6c1c('0xa')](),interaction[_0x6c1c('0x14')](_0x6c1c('0x15'),_0x6c1c('0x16')),controller[_0x6c1c('0x17')]);router[_0x6c1c('0x18')](_0x6c1c('0x19'),auth[_0x6c1c('0xa')](),interaction['tracked'](_0x6c1c('0x15'),_0x6c1c('0x1a')),controller['update']);router[_0x6c1c('0x1b')](_0x6c1c('0x19'),auth['isAuthenticated'](),interaction[_0x6c1c('0x14')]('whatsapp',_0x6c1c('0x1c')),controller[_0x6c1c('0x1d')]);router['delete'](_0x6c1c('0x13'),auth['isAuthenticated'](),controller[_0x6c1c('0x1e')]);module[_0x6c1c('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index d064849..a5c63bf 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 _0xc1fc=['moment','exports','DATE','STRING','ENUM','out','BOOLEAN'];(function(_0x1317a0,_0x146f49){var _0xdacc6d=function(_0x229042){while(--_0x229042){_0x1317a0['push'](_0x1317a0['shift']());}};_0xdacc6d(++_0x146f49);}(_0xc1fc,0x93));var _0xcc1f=function(_0x3e4613,_0x53121f){_0x3e4613=_0x3e4613-0x0;var _0x26be5a=_0xc1fc[_0x3e4613];return _0x26be5a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xcc1f('0x0'));module[_0xcc1f('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcc1f('0x2')]},'disposition':{'type':Sequelize[_0xcc1f('0x3')]},'secondDisposition':{'type':Sequelize[_0xcc1f('0x3')]},'thirdDisposition':{'type':Sequelize[_0xcc1f('0x3')]},'note':{'type':Sequelize[_0xcc1f('0x3')]},'phone':{'type':Sequelize[_0xcc1f('0x3')]},'read1stAt':{'type':Sequelize[_0xcc1f('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xcc1f('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xcc1f('0x4')]('in',_0xcc1f('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xcc1f('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0xb7b6=['STRING','ENUM','out','sequelize','moment','DATE'];(function(_0x10edae,_0x24ffd0){var _0x4a73c1=function(_0x57ad25){while(--_0x57ad25){_0x10edae['push'](_0x10edae['shift']());}};_0x4a73c1(++_0x24ffd0);}(_0xb7b6,0x15f));var _0x6b7b=function(_0x4a99e2,_0x24aa4e){_0x4a99e2=_0x4a99e2-0x0;var _0x3897c5=_0xb7b6[_0x4a99e2];return _0x3897c5;};'use strict';var Sequelize=require(_0x6b7b('0x0'));var moment=require(_0x6b7b('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6b7b('0x2')]},'disposition':{'type':Sequelize[_0x6b7b('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6b7b('0x3')]},'note':{'type':Sequelize[_0x6b7b('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x6b7b('0x4')]('in',_0x6b7b('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6b7b('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x6b7b('0x4')]('in',_0x6b7b('0x5')),'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 8e88d95..663a3b5 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 _0xe233=['tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','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','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','agent','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','push','all','rows','show','includeAll','include','merge','options','create','params','describe','addMessage','WhatsappMessage','ids','findOne','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','omit','spread','color','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','format','CmContact','firstName','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Account','Owner','Whatsapp','N.A.','createdAt','closed','closedAt','disposition','existsSync','pipe','createWriteStream','basename','out','System','Contact','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','sendStatus','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','status','end','error','name','Users','map','fullname','TagIds','Tags','split','forEach','catch','index','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','select','field','tools_tags','u.id','u.fullname','user_has_whatsapp_interactions','left_join','from','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','concat','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe233,0x15b));var _0x3e23=function(_0x84827d,_0x4f5722){_0x84827d=_0x84827d-0x0;var _0x289cf9=_0xe233[_0x84827d];return _0x289cf9;};'use strict';var emlformat=require(_0x3e23('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3e23('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3e23('0x2'));var Mustache=require(_0x3e23('0x3'));var util=require(_0x3e23('0x4'));var path=require(_0x3e23('0x5'));var sox=require(_0x3e23('0x6'));var csv=require('to-csv');var ejs=require(_0x3e23('0x7'));var fs=require('fs');var fs_extra=require(_0x3e23('0x8'));var _=require(_0x3e23('0x9'));var squel=require(_0x3e23('0xa'));var crypto=require(_0x3e23('0xb'));var jsforce=require(_0x3e23('0xc'));var deskjs=require(_0x3e23('0xd'));var toCsv=require(_0x3e23('0xe'));var querystring=require(_0x3e23('0xf'));var Papa=require(_0x3e23('0x10'));var Redis=require(_0x3e23('0x11'));var authService=require(_0x3e23('0x12'));var qs=require(_0x3e23('0x13'));var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require(_0x3e23('0x14'));var logger=require(_0x3e23('0x15'))(_0x3e23('0x16'));var utils=require(_0x3e23('0x17'));var config=require(_0x3e23('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x3e23('0x19')](config[_0x3e23('0x1a')],{'host':_0x3e23('0x1b'),'port':0x18eb});var socket=require(_0x3e23('0x1c'))(new Redis(config[_0x3e23('0x1a')]));require(_0x3e23('0x1d'))['register'](socket);function respondWithStatusCode(_0x4dd333,_0x49162b){_0x49162b=_0x49162b||0xcc;return function(_0x5e7559){if(_0x5e7559){return _0x4dd333[_0x3e23('0x1e')](_0x49162b);}return _0x4dd333['status'](_0x49162b)['end']();};}function respondWithResult(_0x443436,_0xe893a){_0xe893a=_0xe893a||0xc8;return function(_0x420516){if(_0x420516){return _0x443436['status'](_0xe893a)[_0x3e23('0x1f')](_0x420516);}};}function respondWithFilteredResult(_0x496e97,_0x492f88){return function(_0x55790a){if(_0x55790a){var _0x13fe4f=typeof _0x492f88[_0x3e23('0x20')]===_0x3e23('0x21')&&typeof _0x492f88[_0x3e23('0x22')]===_0x3e23('0x21');var _0x4efdac=_0x55790a[_0x3e23('0x23')];var _0x1113a3=_0x13fe4f?0x0:_0x492f88[_0x3e23('0x20')];var _0x30faeb=_0x13fe4f?_0x55790a[_0x3e23('0x23')]:_0x492f88['offset']+_0x492f88[_0x3e23('0x22')];var _0x104d96;if(_0x30faeb>=_0x4efdac){_0x30faeb=_0x4efdac;_0x104d96=0xc8;}else{_0x104d96=0xce;}_0x496e97['status'](_0x104d96);return _0x496e97[_0x3e23('0x24')](_0x3e23('0x25'),_0x1113a3+'-'+_0x30faeb+'/'+_0x4efdac)[_0x3e23('0x1f')](_0x55790a);}return null;};}function patchUpdates(_0x27bffa){return function(_0x20c16f){try{jsonpatch['apply'](_0x20c16f,_0x27bffa,!![]);}catch(_0x511169){return BPromise[_0x3e23('0x26')](_0x511169);}return _0x20c16f[_0x3e23('0x27')]();};}function saveUpdates(_0x5a0735,_0x1a4a20){return function(_0xac447a){if(_0xac447a){return _0xac447a[_0x3e23('0x28')](_0x5a0735)[_0x3e23('0x29')](function(_0x56ba42){return _0x56ba42;});}return null;};}function removeEntity(_0xd36333,_0x5c9a95){return function(_0x12a1ea){if(_0x12a1ea){return _0x12a1ea[_0x3e23('0x2a')]()['then'](function(){_0xd36333[_0x3e23('0x2b')](0xcc)[_0x3e23('0x2c')]();});}};}function handleEntityNotFound(_0x38428f,_0x1b1e73){return function(_0x1c5007){if(!_0x1c5007){_0x38428f['sendStatus'](0x194);}return _0x1c5007;};}function handleError(_0x2848d2,_0x8b7a75){_0x8b7a75=_0x8b7a75||0x1f4;return function(_0x1e61a9){logger[_0x3e23('0x2d')](_0x1e61a9['stack']);if(_0x1e61a9[_0x3e23('0x2e')]){delete _0x1e61a9[_0x3e23('0x2e')];}_0x2848d2[_0x3e23('0x2b')](_0x8b7a75)['send'](_0x1e61a9);};}function getInteractionUsers(_0xb8d05b,_0x437fc8){return new BPromise(function(_0x131b70,_0x327985){try{if(_0x437fc8[_0xb8d05b['id']]){_0xb8d05b[_0x3e23('0x2f')]=_[_0x3e23('0x30')](_0x437fc8[_0xb8d05b['id']],function(_0x552f5e){return{'id':_0x552f5e['id'],'fullname':_0x552f5e[_0x3e23('0x31')]};});}}catch(_0x429546){_0x327985(_0x429546);}_0x131b70(_0xb8d05b);});}function getInteractionTags(_0x26107f,_0x1cb602){return new BPromise(function(_0x57977b,_0x75bfb){try{if(_0x26107f[_0x3e23('0x32')]){_0x26107f[_0x3e23('0x33')]=[];_0x26107f['TagIds'][_0x3e23('0x34')](',')[_0x3e23('0x35')](function(_0x9a8cf2){_0x26107f['Tags']['push'](_0x1cb602[_0x9a8cf2]);});}delete _0x26107f[_0x3e23('0x32')];}catch(_0x3e46d2){_0x75bfb(_0x3e46d2);}_0x57977b(_0x26107f);});}function updateWhatsappInteraction(_0x1e5f5d,_0x294f46,_0x37827a){return new BPromise(function(_0x2d8f34,_0x2e307d){return getInteractionUsers(_0x1e5f5d,_0x37827a)[_0x3e23('0x29')](function(_0x1d94c9){return getInteractionTags(_0x1d94c9,_0x294f46);})['then'](function(_0x2418ee){_0x2d8f34(_0x2418ee);})[_0x3e23('0x36')](function(_0x382abb){_0x2e307d(_0x382abb);});});}exports[_0x3e23('0x37')]=function(_0x41eb94,_0x408352){var _0x378303={},_0x449fff={},_0x3fbabb={'count':0x0,'rows':[]};var _0x382dbb=_[_0x3e23('0x30')](db[_0x3e23('0x38')][_0x3e23('0x39')],function(_0x24c9f5){return{'name':_0x24c9f5[_0x3e23('0x3a')],'type':_0x24c9f5[_0x3e23('0x3b')][_0x3e23('0x3c')]};});_0x449fff[_0x3e23('0x3d')]=_[_0x3e23('0x30')](_0x382dbb,_0x3e23('0x2e'));_0x449fff[_0x3e23('0x3e')]=_['keys'](_0x41eb94[_0x3e23('0x3e')]);_0x449fff[_0x3e23('0x3f')]=_[_0x3e23('0x40')](_0x449fff[_0x3e23('0x3d')],_0x449fff[_0x3e23('0x3e')]);_0x378303[_0x3e23('0x41')]=_[_0x3e23('0x40')](_0x449fff[_0x3e23('0x3d')],qs[_0x3e23('0x42')](_0x41eb94[_0x3e23('0x3e')][_0x3e23('0x42')]));_0x378303[_0x3e23('0x41')]=_0x378303[_0x3e23('0x41')][_0x3e23('0x43')]?_0x378303[_0x3e23('0x41')]:_0x449fff[_0x3e23('0x3d')];if(!_0x41eb94['query'][_0x3e23('0x44')](_0x3e23('0x45'))){_0x378303[_0x3e23('0x22')]=qs[_0x3e23('0x22')](_0x41eb94[_0x3e23('0x3e')][_0x3e23('0x22')]);_0x378303['offset']=qs[_0x3e23('0x20')](_0x41eb94['query'][_0x3e23('0x20')]);}_0x378303[_0x3e23('0x46')]=qs[_0x3e23('0x47')](_0x41eb94[_0x3e23('0x3e')]['sort']);_0x378303['where']=qs[_0x3e23('0x3f')](_[_0x3e23('0x48')](_0x41eb94[_0x3e23('0x3e')],_0x449fff[_0x3e23('0x3f')]),_0x382dbb);var _0x2d4c2f=[];var _0x56c6f0=squel[_0x3e23('0x49')]()[_0x3e23('0x4a')]('id')[_0x3e23('0x4a')]('name')[_0x3e23('0x4a')]('color')['from'](_0x3e23('0x4b'));var _0xfd51e8=squel[_0x3e23('0x49')]()[_0x3e23('0x4a')](_0x3e23('0x4c'))[_0x3e23('0x4a')](_0x3e23('0x4d'))['field']('ui.WhatsappInteractionId')['from'](_0x3e23('0x4e'),'ui')[_0x3e23('0x4f')]('users','u','u.id\x20=\x20ui.UserId');var _0x3b8a22=squel[_0x3e23('0x49')]()[_0x3e23('0x50')]('whatsapp_interactions','i')['left_join'](_0x3e23('0x51'),'c',_0x3e23('0x52'))[_0x3e23('0x4f')](_0x3e23('0x53'),'o','o.id\x20=\x20i.UserId')[_0x3e23('0x4f')](_0x3e23('0x54'),'a',_0x3e23('0x55'))[_0x3e23('0x4f')]('whatsapp_messages','me',_0x3e23('0x56'))[_0x3e23('0x4f')](_0x3e23('0x57'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x3e23('0x4f')](_0x3e23('0x4b'),'t',_0x3e23('0x58'));var _0x159ca2=squel[_0x3e23('0x59')]();var _0x2195b5=[];var _0x10dba2=squel[_0x3e23('0x59')]();var _0x1e6c86;if(_0x41eb94['query'][_0x3e23('0x5a')]){_0x1e6c86=as[_0x3e23('0x5b')](_0x41eb94[_0x3e23('0x3e')][_0x3e23('0x5a')]);var _0x26aa9d=_0x1e6c86[_0x3e23('0x5c')];for(var _0x51688e=0x0;_0x51688e<_0x1e6c86['conditions']['length'];_0x51688e++){var _0x108993=_0x1e6c86[_0x3e23('0x5d')][_0x51688e];var _0x13c468='i';var _0x3384d6=_[_0x3e23('0x5e')](_0x382dbb,[_0x3e23('0x2e'),_0x108993[_0x3e23('0x4a')]]);if(!_0x3384d6){switch(_0x108993[_0x3e23('0x4a')]){case _0x3e23('0x5f'):if(_0x108993[_0x3e23('0x60')]==0x1){_0x3b8a22[_0x3e23('0x61')]('`'+_0x108993['field']+_0x3e23('0x62'));}else{_0x3b8a22['having']('`'+_0x108993[_0x3e23('0x4a')]+_0x3e23('0x63'));}break;case'Contact':if(_0x108993['operator']===_0x3e23('0x64')){if(_0x108993[_0x3e23('0x60')]['split']('\x20')['length']>0x1){_0x159ca2[_0x26aa9d]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3e23('0x65')](_0x108993['value']),null);}else{var _0x4a6efd='%'+_0x108993['value']+'%';_0x159ca2[_0x26aa9d](_0x3e23('0x66'),_0x4a6efd,_0x4a6efd,_0x4a6efd);}}else{_0x3384d6=_['find'](_0x382dbb,['name','ContactId']);_0x108993[_0x3e23('0x4a')]=_0x3e23('0x67');_0xecc18d=as[_0x3e23('0x68')](_0x13c468,_0x3384d6['type'],_0x108993);_0x159ca2[_0x26aa9d](_0xecc18d[_0x3e23('0x69')],_0xecc18d['value'][_0x3e23('0x6a')],_0xecc18d[_0x3e23('0x60')][_0x3e23('0x2c')]);}break;case'Tag':var _0x12e17a=_0x108993['value'][_0x3e23('0x34')](',')['map'](function(_0x3ae366){return Number(_0x3ae366);});_0x12e17a[_0x3e23('0x35')](function(_0x42ab22){_0x10dba2['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x42ab22+',%');});_0x2195b5=_[_0x3e23('0x6b')](_0x2195b5,_0x12e17a);break;case _0x3e23('0x6c'):if(_0x108993[_0x3e23('0x6d')]===_0x3e23('0x64')){_0x159ca2[_0x26aa9d](_0x3e23('0x6e'),'%'+_0x108993[_0x3e23('0x60')]+'%',null);}else{_0x3384d6=_[_0x3e23('0x5e')](_0x382dbb,[_0x3e23('0x2e'),'UserId']);_0x108993[_0x3e23('0x4a')]=_0x3e23('0x6f');_0xecc18d=as['buildExpression'](_0x13c468,_0x3384d6['type'],_0x108993);_0x159ca2[_0x26aa9d](_0xecc18d[_0x3e23('0x69')],_0xecc18d[_0x3e23('0x60')][_0x3e23('0x6a')],_0xecc18d[_0x3e23('0x60')][_0x3e23('0x2c')]);}break;case _0x3e23('0x70'):_0xecc18d=as[_0x3e23('0x68')]('me',null,_0x108993);_0x159ca2[_0x26aa9d](_0xecc18d['text'],_0xecc18d[_0x3e23('0x60')][_0x3e23('0x6a')],_0xecc18d[_0x3e23('0x60')]['end']);break;}}else{var _0xecc18d=as['buildExpression'](_0x13c468,_0x3384d6[_0x3e23('0x3b')],_0x108993);_0x159ca2[_0x26aa9d](_0xecc18d['text'],_0xecc18d['value'][_0x3e23('0x6a')],_0xecc18d[_0x3e23('0x60')][_0x3e23('0x2c')]);}}}else{var _0x5cc960=_(_0x41eb94[_0x3e23('0x3e')])[_0x3e23('0x71')]()[_0x3e23('0x30')](function(_0x3c8897){return _[_0x3e23('0x72')](_0x382dbb,[_0x3e23('0x2e'),_0x3c8897])?_0x3c8897:undefined;})['compact']()[_0x3e23('0x60')]();if(!_['isEmpty'](_0x5cc960)){_0x5cc960[_0x3e23('0x35')](function(_0x51535e){if(_0x51535e===_0x3e23('0x73')){_0x3b8a22[_0x3e23('0x74')](_0x3e23('0x75'),[][_0x3e23('0x76')](_0x41eb94[_0x3e23('0x3e')][_0x51535e]));}else if(_0x51535e==='createdAt'){var _0x348378=JSON['parse'](_0x41eb94[_0x3e23('0x3e')][_0x51535e])[_0x3e23('0x77')];var _0x582c91=JSON[_0x3e23('0x78')](_0x41eb94[_0x3e23('0x3e')][_0x51535e])[_0x3e23('0x79')];_0x3b8a22[_0x3e23('0x74')](_0x3e23('0x7a'),_0x348378,_0x582c91);}else{if(_0x41eb94['query'][_0x51535e]===_0x3e23('0x7b')){_0x3b8a22['where']('i.'+_0x51535e+'\x20IS\x20NULL');}else{_0x3b8a22[_0x3e23('0x74')]('i.'+_0x51535e+_0x3e23('0x7c'),_0x41eb94[_0x3e23('0x3e')][_0x51535e]);}}});}if(_0x41eb94[_0x3e23('0x3e')]['read']){if(_0x41eb94[_0x3e23('0x3e')][_0x3e23('0x7d')]==0x1){_0x3b8a22['having'](_0x3e23('0x7e'));}else{_0x3b8a22['having']('`unreadMessages`\x20>\x200');}}if(_0x41eb94[_0x3e23('0x3e')][_0x3e23('0x7f')]){_0x2195b5=_[_0x3e23('0x80')](_0x41eb94[_0x3e23('0x3e')][_0x3e23('0x7f')])?_0x41eb94[_0x3e23('0x3e')][_0x3e23('0x7f')]:new Array(_0x41eb94[_0x3e23('0x3e')]['tag']);_0x2195b5[_0x3e23('0x35')](function(_0x94e884){_0x10dba2['or'](_0x3e23('0x81'),'%,'+_0x94e884+',%');});}if(_0x41eb94[_0x3e23('0x3e')][_0x3e23('0x82')]){var _0x5c4269=_0x41eb94[_0x3e23('0x3e')][_0x3e23('0x82')][_0x3e23('0x83')]('\x5c','\x5c\x5c')[_0x3e23('0x83')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x5c4269)){_0x159ca2['or']('i.id\x20LIKE\x20?',_0x5c4269+'%')['or'](_0x3e23('0x84'),_0x5c4269+'%');}else{_0x159ca2['or'](_0x3e23('0x85'),qs[_0x3e23('0x65')](_0x5c4269))['or'](_0x3e23('0x86'),_0x5c4269+'%');}}}_0x3b8a22[_0x3e23('0x74')](_0x159ca2);_0x3b8a22['group'](_0x3e23('0x87'));var _0x1df20d={'type':db[_0x3e23('0x88')]['QueryTypes']['SELECT'],'raw':!![]};var _0x44b87b=_0x3b8a22['clone']();_0x44b87b[_0x3e23('0x4a')]('i.id');_0x44b87b[_0x3e23('0x4a')](_0x3e23('0x89'),_0x3e23('0x5f'));if(_0x378303['order']){_0x378303[_0x3e23('0x46')][_0x3e23('0x35')](function(_0x13f50c){var _0x3bbdd3=_0x13f50c[0x0]===_0x3e23('0x8a')?_0x13f50c[0x0]:'i.'+_0x13f50c[0x0];_0x3b8a22['order'](_0x3bbdd3,_0x13f50c[0x1]===_0x3e23('0x8b')?![]:!![]);});}if(!_[_0x3e23('0x8c')](_0x2195b5)){_0x3b8a22[_0x3e23('0x61')](_0x10dba2);_0x44b87b[_0x3e23('0x74')](_0x3e23('0x8d'),_0x2195b5);}BPromise[_0x3e23('0x8e')]()[_0x3e23('0x29')](function(){if(!_0x1e6c86){if(_0x41eb94[_0x3e23('0x3e')]['WhatsappAccountId'])return;_0x44b87b[_0x3e23('0x74')](_0x3e23('0x8f'));_0x3b8a22[_0x3e23('0x74')](_0x3e23('0x8f'));return;}if(_0x41eb94['user']['role']!==_0x3e23('0x90'))return;return _0x41eb94[_0x3e23('0x91')][_0x3e23('0x92')]({'attributes':['id'],'raw':!![]})['then'](function(_0x339a8c){if(_['isEmpty'](_0x339a8c)){_0x44b87b[_0x3e23('0x74')](_0x3e23('0x93'));_0x3b8a22['where'](_0x3e23('0x93'));}else{_0x44b87b[_0x3e23('0x74')](_0x3e23('0x75'),_['map'](_0x339a8c,'id'));_0x3b8a22[_0x3e23('0x74')](_0x3e23('0x75'),_[_0x3e23('0x30')](_0x339a8c,'id'));}});})[_0x3e23('0x29')](function(){if(_0x41eb94[_0x3e23('0x91')][_0x3e23('0x94')]===_0x3e23('0x90')&&!_0x1e6c86&&!_0x41eb94[_0x3e23('0x3e')][_0x3e23('0x73')])return[];return db[_0x3e23('0x95')][_0x3e23('0x3e')](_0x44b87b[_0x3e23('0x96')](),_0x1df20d);})[_0x3e23('0x29')](function(_0x2dcb98){_0x3fbabb['count']=_0x2dcb98[_0x3e23('0x43')];if(_0x3fbabb[_0x3e23('0x23')]===0x0)return[];return db[_0x3e23('0x95')][_0x3e23('0x3e')](_0x56c6f0[_0x3e23('0x96')](),_0x1df20d)[_0x3e23('0x29')](function(_0x124c6f){_0x2d4c2f=_[_0x3e23('0x97')](_0x124c6f,'id');_0x1df20d=_['merge'](_0x1df20d,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x41eb94['query']['fields']){_0x378303[_0x3e23('0x41')]['forEach'](function(_0x54241e){_0x3b8a22[_0x3e23('0x4a')]('i.'+_0x54241e);});}else{_0x3b8a22[_0x3e23('0x4a')](_0x3e23('0x89'),_0x3e23('0x5f'));_0x3b8a22[_0x3e23('0x4a')](_0x3e23('0x98'),_0x3e23('0x99'));_0x3b8a22['field'](_0x3e23('0x9a'),_0x3e23('0x9b'));_0x3b8a22['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','contactName');_0x3b8a22[_0x3e23('0x4a')]('i.*');_0x3b8a22[_0x3e23('0x4a')](_0x3e23('0x9c'),_0x3e23('0x9d'));_0x3b8a22[_0x3e23('0x4a')](_0x3e23('0x9e'),'Contact.lastName');_0x3b8a22[_0x3e23('0x4a')](_0x3e23('0x9f'),'Contact.email');_0x3b8a22['field'](_0x3e23('0xa0'),_0x3e23('0xa1'));_0x3b8a22['field'](_0x3e23('0xa2'),_0x3e23('0xa3'));_0x3b8a22['field'](_0x3e23('0xa4'),_0x3e23('0xa5'));_0x3b8a22[_0x3e23('0x4a')](_0x3e23('0xa6'),_0x3e23('0xa7'));_0x3b8a22[_0x3e23('0x4a')](_0x3e23('0xa8'),_0x3e23('0xa9'));_0x3b8a22[_0x3e23('0x4a')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x3e23('0x32'));}if(_0x378303[_0x3e23('0x22')])_0x3b8a22[_0x3e23('0x22')](_0x378303['limit']);if(_0x378303['offset'])_0x3b8a22[_0x3e23('0x20')](_0x378303[_0x3e23('0x20')]);return db[_0x3e23('0x95')][_0x3e23('0x3e')](_0x3b8a22[_0x3e23('0x96')](),_0x1df20d);})[_0x3e23('0x29')](function(_0x93c7a4){if(_0x93c7a4[_0x3e23('0x43')]>0x0)_0xfd51e8[_0x3e23('0x74')](_0x3e23('0xaa'),_['map'](_0x93c7a4,'id'));return db[_0x3e23('0x95')][_0x3e23('0x3e')](_0xfd51e8['toString'](),_0x1df20d)[_0x3e23('0x29')](function(_0x902761){var _0x19d448=_[_0x3e23('0xab')](_0x902761,_0x3e23('0xac'));var _0x5b3adc=[];_0x93c7a4[_0x3e23('0x35')](function(_0x4d1325){_0x5b3adc[_0x3e23('0xad')](updateWhatsappInteraction(_0x4d1325,_0x2d4c2f,_0x19d448));});return BPromise[_0x3e23('0xae')](_0x5b3adc);});});})['then'](function(_0x1d6eb0){_0x3fbabb[_0x3e23('0xaf')]=_0x1d6eb0;return _0x3fbabb;})[_0x3e23('0x29')](respondWithFilteredResult(_0x408352,_0x378303))[_0x3e23('0x36')](handleError(_0x408352,null));};exports[_0x3e23('0xb0')]=function(_0x543390,_0x3765c7){var _0x8df177={'raw':![],'where':{'id':_0x543390['params']['id']}},_0x35eba0={};_0x35eba0[_0x3e23('0x3d')]=_[_0x3e23('0x71')](db[_0x3e23('0x38')]['rawAttributes']);_0x35eba0[_0x3e23('0x3e')]=_['keys'](_0x543390[_0x3e23('0x3e')]);_0x35eba0['filters']=_[_0x3e23('0x40')](_0x35eba0['model'],_0x35eba0[_0x3e23('0x3e')]);_0x8df177[_0x3e23('0x41')]=_[_0x3e23('0x40')](_0x35eba0[_0x3e23('0x3d')],qs[_0x3e23('0x42')](_0x543390[_0x3e23('0x3e')][_0x3e23('0x42')]));_0x8df177[_0x3e23('0x41')]=_0x8df177[_0x3e23('0x41')][_0x3e23('0x43')]?_0x8df177['attributes']:_0x35eba0['model'];if(_0x543390[_0x3e23('0x3e')][_0x3e23('0xb1')]){_0x8df177[_0x3e23('0xb2')]=[{'all':!![]}];}_0x8df177=_[_0x3e23('0xb3')]({},_0x8df177,_0x543390[_0x3e23('0xb4')]);return db[_0x3e23('0x38')][_0x3e23('0x5e')](_0x8df177)[_0x3e23('0x29')](handleEntityNotFound(_0x3765c7,null))[_0x3e23('0x29')](respondWithResult(_0x3765c7,null))[_0x3e23('0x36')](handleError(_0x3765c7,null));};exports[_0x3e23('0xb5')]=function(_0x2645c9,_0x4c67b4){return db[_0x3e23('0x38')][_0x3e23('0xb5')](_0x2645c9['body'],{})['then'](respondWithResult(_0x4c67b4,0xc9))[_0x3e23('0x36')](handleError(_0x4c67b4,null));};exports[_0x3e23('0x28')]=function(_0x5e4363,_0x42e235){if(_0x5e4363['body']['id']){delete _0x5e4363[_0x3e23('0x70')]['id'];}return db[_0x3e23('0x38')][_0x3e23('0x5e')]({'where':{'id':_0x5e4363[_0x3e23('0xb6')]['id']}})[_0x3e23('0x29')](handleEntityNotFound(_0x42e235,null))[_0x3e23('0x29')](saveUpdates(_0x5e4363[_0x3e23('0x70')],null))[_0x3e23('0x29')](respondWithResult(_0x42e235,null))[_0x3e23('0x36')](handleError(_0x42e235,null));};exports[_0x3e23('0x2a')]=function(_0x2a9f97,_0x591945){return db[_0x3e23('0x38')][_0x3e23('0x5e')]({'where':{'id':_0x2a9f97['params']['id']}})[_0x3e23('0x29')](handleEntityNotFound(_0x591945,null))['then'](removeEntity(_0x591945,null))[_0x3e23('0x36')](handleError(_0x591945,null));};exports[_0x3e23('0xb7')]=function(_0x373cac,_0xfb75b){return db[_0x3e23('0x38')][_0x3e23('0xb7')]()[_0x3e23('0x29')](respondWithResult(_0xfb75b,null))[_0x3e23('0x36')](handleError(_0xfb75b,null));};exports[_0x3e23('0xb8')]=function(_0x3329d6,_0x2223f7,_0x5a22e7){return db[_0x3e23('0xb9')]['find']({'where':{'id':_0x3329d6[_0x3e23('0xb6')]['id']}})[_0x3e23('0x29')](handleEntityNotFound(_0x2223f7,null))[_0x3e23('0x29')](function(_0x25cb08){if(_0x25cb08){return _0x25cb08[_0x3e23('0xb8')](_0x3329d6[_0x3e23('0x70')]['ids'],_['omit'](_0x3329d6[_0x3e23('0x70')],[_0x3e23('0xba'),'id'])||{});}})['then'](respondWithResult(_0x2223f7,null))[_0x3e23('0x36')](handleError(_0x2223f7,null));};exports['getMessages']=function(_0x183730,_0x56212a,_0x52c5fd){var _0x245b3c={'raw':![],'where':{}};var _0x1e847a={};var _0x66e68f={'count':0x0,'rows':[]};return db[_0x3e23('0x38')][_0x3e23('0xbb')]({'where':{'id':_0x183730[_0x3e23('0xb6')]['id']}})[_0x3e23('0x29')](handleEntityNotFound(_0x56212a,null))[_0x3e23('0x29')](function(_0x4037d3){if(_0x4037d3){_0x1e847a[_0x3e23('0x3d')]=_[_0x3e23('0x71')](db[_0x3e23('0xb9')]['rawAttributes']);_0x1e847a[_0x3e23('0x3e')]=_[_0x3e23('0x71')](_0x183730['query']);_0x1e847a[_0x3e23('0x3f')]=_['intersection'](_0x1e847a[_0x3e23('0x3d')],_0x1e847a[_0x3e23('0x3e')]);_0x245b3c[_0x3e23('0x41')]=_[_0x3e23('0x40')](_0x1e847a['model'],qs[_0x3e23('0x42')](_0x183730[_0x3e23('0x3e')][_0x3e23('0x42')]));_0x245b3c[_0x3e23('0x41')]=_0x245b3c[_0x3e23('0x41')][_0x3e23('0x43')]?_0x245b3c[_0x3e23('0x41')]:_0x1e847a[_0x3e23('0x3d')];if(!_0x183730[_0x3e23('0x3e')][_0x3e23('0x44')]('nolimit')){_0x245b3c[_0x3e23('0x22')]=qs[_0x3e23('0x22')](_0x183730['query'][_0x3e23('0x22')]);_0x245b3c[_0x3e23('0x20')]=qs[_0x3e23('0x20')](_0x183730[_0x3e23('0x3e')][_0x3e23('0x20')]);}_0x245b3c['order']=qs['sort'](_0x183730[_0x3e23('0x3e')][_0x3e23('0x47')]);_0x245b3c[_0x3e23('0x74')]=qs[_0x3e23('0x3f')](_[_0x3e23('0x48')](_0x183730[_0x3e23('0x3e')],_0x1e847a['filters']));_0x245b3c[_0x3e23('0x74')][_0x3e23('0xac')]=_0x4037d3['id'];if(_0x183730[_0x3e23('0x3e')][_0x3e23('0x82')]){_0x245b3c[_0x3e23('0x74')]=_[_0x3e23('0xb3')](_0x245b3c[_0x3e23('0x74')],{'$or':_['map'](_0x245b3c['attributes'],function(_0x36f4b3){var _0x3d0142={};_0x3d0142[_0x36f4b3]={'$like':'%'+_0x183730['query'][_0x3e23('0x82')]+'%'};return _0x3d0142;})});}if(_0x183730[_0x3e23('0x3e')]['$gte']){var _0x4fc372=_0x183730[_0x3e23('0x3e')][_0x3e23('0x77')][_0x3e23('0x34')](',');var _0x496285={};_0x496285[_0x4fc372[0x0]]={'$gte':moment(_0x4fc372[0x1])['format'](_0x3e23('0xbc'))};_0x245b3c[_0x3e23('0x74')]=_[_0x3e23('0xb3')](_0x245b3c[_0x3e23('0x74')],_0x496285);}_0x245b3c=_[_0x3e23('0xb3')]({},_0x245b3c,_0x183730[_0x3e23('0xb4')]);return db[_0x3e23('0xb9')][_0x3e23('0x23')]({'where':_0x245b3c[_0x3e23('0x74')]})[_0x3e23('0x29')](function(_0x18e05a){_0x66e68f[_0x3e23('0x23')]=_0x18e05a;if(_0x183730[_0x3e23('0x3e')][_0x3e23('0xb1')]){_0x245b3c['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0x3e23('0xbd')](_0x245b3c);})['then'](function(_0x39bbc1){_0x66e68f['rows']=_0x39bbc1;return _0x66e68f;});}})['then'](respondWithFilteredResult(_0x56212a,_0x245b3c))['catch'](handleError(_0x56212a,null));};exports['addTags']=function(_0x3dbe29,_0x1c5e2b,_0x9d0810){return db['WhatsappInteraction'][_0x3e23('0x5e')]({'where':{'id':_0x3dbe29['params']['id']}})[_0x3e23('0x29')](handleEntityNotFound(_0x1c5e2b,null))[_0x3e23('0x29')](function(_0x1fc63e){if(_0x1fc63e){return _0x1fc63e[_0x3e23('0xbe')](_0x3dbe29[_0x3e23('0x70')][_0x3e23('0xba')],_[_0x3e23('0xbf')](_0x3dbe29['body'],[_0x3e23('0xba'),'id'])||{})[_0x3e23('0xc0')](function(){return db['Tag'][_0x3e23('0xbd')]({'attributes':['id',_0x3e23('0x2e'),_0x3e23('0xc1')],'where':{'id':_0x3dbe29[_0x3e23('0x70')][_0x3e23('0xba')]}});})['then'](function(_0x3782f0){socket['emit'](_0x3e23('0xc2'),{'id':Number(_0x3dbe29[_0x3e23('0xb6')]['id']),'tags':_0x3782f0||[]});return{'id':Number(_0x3dbe29[_0x3e23('0xb6')]['id']),'tags':_0x3782f0||[]};});}})[_0x3e23('0x29')](respondWithResult(_0x1c5e2b,null))['catch'](handleError(_0x1c5e2b,null));};exports[_0x3e23('0xc3')]=function(_0x2f902c,_0x4d2019,_0x447c04){return db[_0x3e23('0x38')][_0x3e23('0x5e')]({'where':{'id':_0x2f902c[_0x3e23('0xb6')]['id']}})['then'](handleEntityNotFound(_0x4d2019,null))[_0x3e23('0x29')](function(_0x4476fa){if(_0x4476fa){return _0x4476fa['removeTags'](_0x2f902c[_0x3e23('0x3e')]['ids']);}})[_0x3e23('0x29')](respondWithStatusCode(_0x4d2019,null))[_0x3e23('0x36')](handleError(_0x4d2019,null));};exports[_0x3e23('0xc4')]=function(_0x3d0d23,_0x3872c9){var _0x1227ef=moment()[_0x3e23('0xc5')]()[_0x3e23('0x96')]();var _0xc26f1c=path[_0x3e23('0xc6')](config[_0x3e23('0xc7')],_0x3e23('0xc8'),_0x3e23('0xc9'),_0x3e23('0xca'));var _0x1c9776=path[_0x3e23('0xc6')](config[_0x3e23('0xc7')],'server','files',_0x3e23('0xcb'));var _0x11d2d3=path['join'](_0xc26f1c,_0x1227ef);var _0x2365eb=util[_0x3e23('0xcc')]('transcript-%d-%s.zip',_0x3d0d23[_0x3e23('0xb6')]['id'],_0x1227ef);var _0x2a9878=path[_0x3e23('0xc6')](_0xc26f1c,_0x2365eb);var _0x5979c3=[];_0x5979c3[_0x3e23('0xad')]({'model':db[_0x3e23('0x6c')],'as':_0x3e23('0x6c'),'attributes':['id',_0x3e23('0x31')],'raw':!![]});_0x5979c3[_0x3e23('0xad')]({'model':db[_0x3e23('0xcd')],'as':'Contact','attributes':['id',_0x3e23('0xce'),_0x3e23('0xcf')],'raw':!![]});if(_0x3d0d23['query'][_0x3e23('0xcb')]){_0x5979c3[_0x3e23('0xad')]({'model':db[_0x3e23('0xd0')],'as':_0x3e23('0xd0'),'raw':!![]});}var _0x36833d=[{'model':db[_0x3e23('0xb9')],'as':_0x3e23('0xd1'),'attributes':['id',_0x3e23('0x70'),'createdAt',_0x3e23('0xd2'),_0x3e23('0xd3'),_0x3e23('0x7d')],'include':_0x5979c3}];_0x36833d['push']({'model':db[_0x3e23('0xd4')],'as':_0x3e23('0xd5'),'attributes':['id',_0x3e23('0x2e')]});_0x36833d[_0x3e23('0xad')]({'model':db[_0x3e23('0x6c')],'as':_0x3e23('0xd6'),'attributes':['id',_0x3e23('0x31')]});return db[_0x3e23('0x38')][_0x3e23('0x5e')]({'where':{'id':_0x3d0d23[_0x3e23('0xb6')]['id']},'include':_0x36833d})[_0x3e23('0x29')](handleEntityNotFound(_0x3872c9,null))[_0x3e23('0x29')](function(_0x24d450){if(_0x24d450){var _0x545860=_0x24d450['get']({'plain':!![]});fs['mkdirSync'](_0x11d2d3);var _0x148ee6={'channel':_0x3e23('0xd7'),'account':_0x545860['Account'][_0x3e23('0x2e')],'agent':_0x545860['Owner']?_0x545860['Owner'][_0x3e23('0x31')]:_0x3e23('0xd8'),'createdAt':moment(_0x545860[_0x3e23('0xd9')])['format'](_0x3e23('0xbc'))[_0x3e23('0x96')](),'closedAt':_0x545860[_0x3e23('0xda')]?moment(_0x545860[_0x3e23('0xdb')])['format'](_0x3e23('0xbc'))[_0x3e23('0x96')]():'','disposition':_0x545860[_0x3e23('0xdc')],'messages':_(_0x545860[_0x3e23('0xd1')])['filter']({'secret':![]})[_0x3e23('0x30')](function(_0xbafb62){if(_0xbafb62[_0x3e23('0xd0')]){var _0x15ddaf=path[_0x3e23('0xc6')](_0x1c9776,_0xbafb62['Attachment']['basename']);if(fs[_0x3e23('0xdd')](_0x15ddaf)){fs['createReadStream'](_0x15ddaf)[_0x3e23('0xde')](fs[_0x3e23('0xdf')](path[_0x3e23('0xc6')](_0x11d2d3,_0xbafb62[_0x3e23('0xd0')][_0x3e23('0xe0')])));}}return{'date':moment(_0xbafb62['createdAt'])[_0x3e23('0xcc')](_0x3e23('0xbc'))[_0x3e23('0x96')](),'sender':_0xbafb62[_0x3e23('0xd2')]===_0x3e23('0xe1')?_0xbafb62[_0x3e23('0x6c')]?_0xbafb62[_0x3e23('0x6c')][_0x3e23('0x31')]:_0x3e23('0xe2'):_0xbafb62[_0x3e23('0xe3')][_0x3e23('0xce')]+(_0xbafb62[_0x3e23('0xe3')][_0x3e23('0xcf')]?'\x20'+_0xbafb62['Contact']['lastName']:''),'body':_0xbafb62[_0x3e23('0xd0')]?_0xbafb62['Attachment']['basename']:_0xbafb62[_0x3e23('0x70')],'direction':_0xbafb62[_0x3e23('0xd2')]===_0x3e23('0xe1')?'A':'C','secret':_0xbafb62[_0x3e23('0xd3')],'read':_0xbafb62[_0x3e23('0x7d')],'attachment':_0xbafb62[_0x3e23('0xd0')]};})[_0x3e23('0x60')]()};return ejs[_0x3e23('0xe4')](path[_0x3e23('0xc6')](config[_0x3e23('0xc7')],_0x3e23('0xc8'),_0x3e23('0xe5'),_0x3e23('0xe6')),{'interaction':_0x148ee6})['then'](function(_0x57b02e){var _0x1c07a8=path[_0x3e23('0xc6')](_0x11d2d3,_0x3e23('0xe7')+_0x545860['id']+'-'+_0x1227ef+_0x3e23('0xe8'));var _0x17eef1={'path':_0x1c07a8,'channel':_0x3e23('0xd7'),'interactionId':_0x545860['id']};return pdf[_0x3e23('0xe9')](_0x57b02e,_0x17eef1);})[_0x3e23('0x29')](function(){return new BPromise(function(_0x167798,_0x2825fe){zipdir(_0x11d2d3,{'saveTo':_0x2a9878},function(_0xf2e333,_0x22a1c8){if(_0xf2e333)return _0x2825fe(_0xf2e333);return _0x167798(_0x22a1c8);});})['then'](function(){return new BPromise(function(_0x28c55e,_0x3cb683){rimraf(_0x11d2d3,function(_0x36b7e8){if(_0x36b7e8)_0x3cb683(_0x36b7e8);return _0x28c55e();});});})['then'](function(){return _0x3872c9[_0x3e23('0xc4')](_0x2a9878,_0x2365eb,function(_0x361160){if(_0x361160){console[_0x3e23('0xea')](_0x3e23('0xeb'),_0x361160);}else{fs[_0x3e23('0xec')](_0x2a9878);}});});});}else{return _0x3872c9['sendStatus'](0xc8);}})[_0x3e23('0x36')](handleError(_0x3872c9,null));}; \ No newline at end of file +var _0xa7dc=['Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','params','WhatsappInteraction','includeAll','include','merge','options','create','describe','addMessage','ids','omit','getMessages','findOne','WhatsappMessage','format','findAll','rows','setTags','color','emit','removeTags','join','root','server','files','attachments','transcript-%d-%s.zip','fullname','Contact','firstName','lastName','Attachment','Messages','WhatsappAccount','Account','Whatsapp','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','existsSync','createReadStream','pipe','System','basename','direction','secret','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./whatsappInteraction.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','reject','save','then','destroy','stack','name','send','Users','map','TagIds','Tags','push','catch','index','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','field','from','select','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','tools_tags','expr','search','sqlOperator','conditions','find','`\x20=\x200','having','`\x20>\x200','operator','$substring','value','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','text','start','Tag','forEach','User','UserId','buildExpression','body','some','compact','isEmpty','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','null','\x20=\x20?','read','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','getFullTextValue','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','WhatsappAccountId','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','agent','user','i.WhatsappAccountId\x20IS\x20NULL','toString','sequelize','fields','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax'];(function(_0x1d56f0,_0x2f8ed7){var _0x546402=function(_0x2af1ad){while(--_0x2af1ad){_0x1d56f0['push'](_0x1d56f0['shift']());}};_0x546402(++_0x2f8ed7);}(_0xa7dc,0x11d));var _0xca7d=function(_0x51756f,_0x57dcf6){_0x51756f=_0x51756f-0x0;var _0x484f8e=_0xa7dc[_0x51756f];return _0x484f8e;};'use strict';var emlformat=require(_0xca7d('0x0'));var rimraf=require(_0xca7d('0x1'));var zipdir=require(_0xca7d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xca7d('0x3'));var moment=require('moment');var BPromise=require(_0xca7d('0x4'));var Mustache=require(_0xca7d('0x5'));var util=require(_0xca7d('0x6'));var path=require(_0xca7d('0x7'));var sox=require(_0xca7d('0x8'));var csv=require(_0xca7d('0x9'));var ejs=require(_0xca7d('0xa'));var fs=require('fs');var fs_extra=require(_0xca7d('0xb'));var _=require('lodash');var squel=require(_0xca7d('0xc'));var crypto=require(_0xca7d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xca7d('0xe'));var toCsv=require(_0xca7d('0x9'));var querystring=require(_0xca7d('0xf'));var Papa=require('papaparse');var Redis=require(_0xca7d('0x10'));var authService=require(_0xca7d('0x11'));var qs=require(_0xca7d('0x12'));var as=require(_0xca7d('0x13'));var pdf=require(_0xca7d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xca7d('0x15'))('api');var utils=require(_0xca7d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xca7d('0x17'));var db=require(_0xca7d('0x18'))['db'];config[_0xca7d('0x19')]=_[_0xca7d('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xca7d('0x19')]));require(_0xca7d('0x1b'))[_0xca7d('0x1c')](socket);function respondWithStatusCode(_0x39caec,_0x43992f){_0x43992f=_0x43992f||0xcc;return function(_0x1fc20b){if(_0x1fc20b){return _0x39caec[_0xca7d('0x1d')](_0x43992f);}return _0x39caec[_0xca7d('0x1e')](_0x43992f)[_0xca7d('0x1f')]();};}function respondWithResult(_0x1a6cb7,_0x2f6e8a){_0x2f6e8a=_0x2f6e8a||0xc8;return function(_0x245c7c){if(_0x245c7c){return _0x1a6cb7['status'](_0x2f6e8a)['json'](_0x245c7c);}};}function respondWithFilteredResult(_0x26e7f6,_0x61cc1e){return function(_0x134e51){if(_0x134e51){var _0x46eac1=typeof _0x61cc1e[_0xca7d('0x20')]==='undefined'&&typeof _0x61cc1e['limit']===_0xca7d('0x21');var _0x4cb0d8=_0x134e51[_0xca7d('0x22')];var _0x6a89a8=_0x46eac1?0x0:_0x61cc1e['offset'];var _0x3e3e8d=_0x46eac1?_0x134e51['count']:_0x61cc1e['offset']+_0x61cc1e[_0xca7d('0x23')];var _0x38a488;if(_0x3e3e8d>=_0x4cb0d8){_0x3e3e8d=_0x4cb0d8;_0x38a488=0xc8;}else{_0x38a488=0xce;}_0x26e7f6[_0xca7d('0x1e')](_0x38a488);return _0x26e7f6[_0xca7d('0x24')]('Content-Range',_0x6a89a8+'-'+_0x3e3e8d+'/'+_0x4cb0d8)[_0xca7d('0x25')](_0x134e51);}return null;};}function patchUpdates(_0x1cca8a){return function(_0x1b2606){try{jsonpatch[_0xca7d('0x26')](_0x1b2606,_0x1cca8a,!![]);}catch(_0x79fc7d){return BPromise[_0xca7d('0x27')](_0x79fc7d);}return _0x1b2606[_0xca7d('0x28')]();};}function saveUpdates(_0x44e415,_0x56be0b){return function(_0x1c9a38){if(_0x1c9a38){return _0x1c9a38['update'](_0x44e415)[_0xca7d('0x29')](function(_0x41938b){return _0x41938b;});}return null;};}function removeEntity(_0x3b5bbb,_0x59449f){return function(_0x24cc8d){if(_0x24cc8d){return _0x24cc8d[_0xca7d('0x2a')]()[_0xca7d('0x29')](function(){_0x3b5bbb[_0xca7d('0x1e')](0xcc)[_0xca7d('0x1f')]();});}};}function handleEntityNotFound(_0x254235,_0x572423){return function(_0x445fad){if(!_0x445fad){_0x254235[_0xca7d('0x1d')](0x194);}return _0x445fad;};}function handleError(_0x5975d0,_0x3a1082){_0x3a1082=_0x3a1082||0x1f4;return function(_0x5df354){logger['error'](_0x5df354[_0xca7d('0x2b')]);if(_0x5df354['name']){delete _0x5df354[_0xca7d('0x2c')];}_0x5975d0[_0xca7d('0x1e')](_0x3a1082)[_0xca7d('0x2d')](_0x5df354);};}function getInteractionUsers(_0x3071e5,_0x337f3f){return new BPromise(function(_0x527920,_0x496f57){try{if(_0x337f3f[_0x3071e5['id']]){_0x3071e5[_0xca7d('0x2e')]=_[_0xca7d('0x2f')](_0x337f3f[_0x3071e5['id']],function(_0x28eeff){return{'id':_0x28eeff['id'],'fullname':_0x28eeff['fullname']};});}}catch(_0x324eaf){_0x496f57(_0x324eaf);}_0x527920(_0x3071e5);});}function getInteractionTags(_0x3d9356,_0x4487bd){return new BPromise(function(_0x401948,_0xa10f51){try{if(_0x3d9356[_0xca7d('0x30')]){_0x3d9356[_0xca7d('0x31')]=[];_0x3d9356[_0xca7d('0x30')]['split'](',')['forEach'](function(_0x7d9558){_0x3d9356[_0xca7d('0x31')][_0xca7d('0x32')](_0x4487bd[_0x7d9558]);});}delete _0x3d9356[_0xca7d('0x30')];}catch(_0x488fcb){_0xa10f51(_0x488fcb);}_0x401948(_0x3d9356);});}function updateWhatsappInteraction(_0x4924db,_0x38f3a0,_0x5acb63){return new BPromise(function(_0x509f3a,_0x5b6695){return getInteractionUsers(_0x4924db,_0x5acb63)[_0xca7d('0x29')](function(_0x4b8d27){return getInteractionTags(_0x4b8d27,_0x38f3a0);})[_0xca7d('0x29')](function(_0x1eb686){_0x509f3a(_0x1eb686);})[_0xca7d('0x33')](function(_0x545767){_0x5b6695(_0x545767);});});}exports[_0xca7d('0x34')]=function(_0x2d67cc,_0x3dc00f){var _0x5e3e9d={},_0x3da961={},_0x3950c3={'count':0x0,'rows':[]};var _0x5037da=_[_0xca7d('0x2f')](db['WhatsappInteraction'][_0xca7d('0x35')],function(_0x4a86d1){return{'name':_0x4a86d1['fieldName'],'type':_0x4a86d1[_0xca7d('0x36')][_0xca7d('0x37')]};});_0x3da961[_0xca7d('0x38')]=_['map'](_0x5037da,_0xca7d('0x2c'));_0x3da961[_0xca7d('0x39')]=_[_0xca7d('0x3a')](_0x2d67cc[_0xca7d('0x39')]);_0x3da961[_0xca7d('0x3b')]=_[_0xca7d('0x3c')](_0x3da961[_0xca7d('0x38')],_0x3da961['query']);_0x5e3e9d['attributes']=_['intersection'](_0x3da961[_0xca7d('0x38')],qs['fields'](_0x2d67cc[_0xca7d('0x39')]['fields']));_0x5e3e9d[_0xca7d('0x3d')]=_0x5e3e9d['attributes'][_0xca7d('0x3e')]?_0x5e3e9d['attributes']:_0x3da961[_0xca7d('0x38')];if(!_0x2d67cc[_0xca7d('0x39')][_0xca7d('0x3f')](_0xca7d('0x40'))){_0x5e3e9d['limit']=qs['limit'](_0x2d67cc[_0xca7d('0x39')]['limit']);_0x5e3e9d[_0xca7d('0x20')]=qs[_0xca7d('0x20')](_0x2d67cc[_0xca7d('0x39')][_0xca7d('0x20')]);}_0x5e3e9d[_0xca7d('0x41')]=qs[_0xca7d('0x42')](_0x2d67cc[_0xca7d('0x39')]['sort']);_0x5e3e9d[_0xca7d('0x43')]=qs['filters'](_[_0xca7d('0x44')](_0x2d67cc['query'],_0x3da961[_0xca7d('0x3b')]),_0x5037da);var _0x50cf85=[];var _0x3a6594=squel['select']()['field']('id')[_0xca7d('0x45')]('name')[_0xca7d('0x45')]('color')[_0xca7d('0x46')]('tools_tags');var _0x492145=squel[_0xca7d('0x47')]()[_0xca7d('0x45')]('u.id')['field'](_0xca7d('0x48'))[_0xca7d('0x45')]('ui.WhatsappInteractionId')['from']('user_has_whatsapp_interactions','ui')[_0xca7d('0x49')](_0xca7d('0x4a'),'u',_0xca7d('0x4b'));var _0x448478=squel['select']()[_0xca7d('0x46')](_0xca7d('0x4c'),'i')[_0xca7d('0x49')]('cm_contacts','c',_0xca7d('0x4d'))[_0xca7d('0x49')](_0xca7d('0x4a'),'o',_0xca7d('0x4e'))[_0xca7d('0x49')](_0xca7d('0x4f'),'a',_0xca7d('0x50'))[_0xca7d('0x49')](_0xca7d('0x51'),'me',_0xca7d('0x52'))[_0xca7d('0x49')]('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0xca7d('0x49')](_0xca7d('0x53'),'t','t.id\x20=\x20it.TagId');var _0x37b628=squel[_0xca7d('0x54')]();var _0x59a041=[];var _0x2de836=squel[_0xca7d('0x54')]();var _0x4fe7f8;if(_0x2d67cc[_0xca7d('0x39')]['search']){_0x4fe7f8=as['parseSearch'](_0x2d67cc[_0xca7d('0x39')][_0xca7d('0x55')]);var _0x492bd2=_0x4fe7f8[_0xca7d('0x56')];for(var _0x48b5b4=0x0;_0x48b5b4<_0x4fe7f8['conditions'][_0xca7d('0x3e')];_0x48b5b4++){var _0x985ad9=_0x4fe7f8[_0xca7d('0x57')][_0x48b5b4];var _0x61b4b5='i';var _0x17e9f9=_[_0xca7d('0x58')](_0x5037da,[_0xca7d('0x2c'),_0x985ad9[_0xca7d('0x45')]]);if(!_0x17e9f9){switch(_0x985ad9[_0xca7d('0x45')]){case'unreadMessages':if(_0x985ad9['value']==0x1){_0x448478['having']('`'+_0x985ad9['field']+_0xca7d('0x59'));}else{_0x448478[_0xca7d('0x5a')]('`'+_0x985ad9[_0xca7d('0x45')]+_0xca7d('0x5b'));}break;case'Contact':if(_0x985ad9[_0xca7d('0x5c')]===_0xca7d('0x5d')){if(_0x985ad9[_0xca7d('0x5e')][_0xca7d('0x5f')]('\x20')[_0xca7d('0x3e')]>0x1){_0x37b628[_0x492bd2](_0xca7d('0x60'),qs['getFullTextValue'](_0x985ad9[_0xca7d('0x5e')]),null);}else{var _0x55e672='%'+_0x985ad9['value']+'%';_0x37b628[_0x492bd2](_0xca7d('0x61'),_0x55e672,_0x55e672,_0x55e672);}}else{_0x17e9f9=_[_0xca7d('0x58')](_0x5037da,['name','ContactId']);_0x985ad9[_0xca7d('0x45')]=_0xca7d('0x62');_0x811de1=as['buildExpression'](_0x61b4b5,_0x17e9f9[_0xca7d('0x36')],_0x985ad9);_0x37b628[_0x492bd2](_0x811de1[_0xca7d('0x63')],_0x811de1[_0xca7d('0x5e')][_0xca7d('0x64')],_0x811de1[_0xca7d('0x5e')]['end']);}break;case _0xca7d('0x65'):var _0x511329=_0x985ad9['value'][_0xca7d('0x5f')](',')['map'](function(_0x52a671){return Number(_0x52a671);});_0x511329[_0xca7d('0x66')](function(_0x504a7c){_0x2de836['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x504a7c+',%');});_0x59a041=_['union'](_0x59a041,_0x511329);break;case _0xca7d('0x67'):if(_0x985ad9['operator']===_0xca7d('0x5d')){_0x37b628[_0x492bd2]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x985ad9['value']+'%',null);}else{_0x17e9f9=_[_0xca7d('0x58')](_0x5037da,['name',_0xca7d('0x68')]);_0x985ad9[_0xca7d('0x45')]='UserId';_0x811de1=as[_0xca7d('0x69')](_0x61b4b5,_0x17e9f9[_0xca7d('0x36')],_0x985ad9);_0x37b628[_0x492bd2](_0x811de1[_0xca7d('0x63')],_0x811de1[_0xca7d('0x5e')][_0xca7d('0x64')],_0x811de1[_0xca7d('0x5e')][_0xca7d('0x1f')]);}break;case _0xca7d('0x6a'):_0x811de1=as[_0xca7d('0x69')]('me',null,_0x985ad9);_0x37b628[_0x492bd2](_0x811de1[_0xca7d('0x63')],_0x811de1[_0xca7d('0x5e')]['start'],_0x811de1[_0xca7d('0x5e')][_0xca7d('0x1f')]);break;}}else{var _0x811de1=as['buildExpression'](_0x61b4b5,_0x17e9f9[_0xca7d('0x36')],_0x985ad9);_0x37b628[_0x492bd2](_0x811de1[_0xca7d('0x63')],_0x811de1['value'][_0xca7d('0x64')],_0x811de1[_0xca7d('0x5e')]['end']);}}}else{var _0x3d3ac4=_(_0x2d67cc[_0xca7d('0x39')])[_0xca7d('0x3a')]()['map'](function(_0xc59fcd){return _[_0xca7d('0x6b')](_0x5037da,[_0xca7d('0x2c'),_0xc59fcd])?_0xc59fcd:undefined;})[_0xca7d('0x6c')]()[_0xca7d('0x5e')]();if(!_[_0xca7d('0x6d')](_0x3d3ac4)){_0x3d3ac4[_0xca7d('0x66')](function(_0x57619a){if(_0x57619a==='WhatsappAccountId'){_0x448478[_0xca7d('0x43')](_0xca7d('0x6e'),[][_0xca7d('0x6f')](_0x2d67cc[_0xca7d('0x39')][_0x57619a]));}else if(_0x57619a===_0xca7d('0x70')){var _0xdff939=JSON['parse'](_0x2d67cc['query'][_0x57619a])[_0xca7d('0x71')];var _0xa7aa9=JSON[_0xca7d('0x72')](_0x2d67cc['query'][_0x57619a])[_0xca7d('0x73')];_0x448478['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xdff939,_0xa7aa9);}else{if(_0x2d67cc[_0xca7d('0x39')][_0x57619a]===_0xca7d('0x74')){_0x448478['where']('i.'+_0x57619a+'\x20IS\x20NULL');}else{_0x448478['where']('i.'+_0x57619a+_0xca7d('0x75'),_0x2d67cc[_0xca7d('0x39')][_0x57619a]);}}});}if(_0x2d67cc[_0xca7d('0x39')][_0xca7d('0x76')]){if(_0x2d67cc[_0xca7d('0x39')][_0xca7d('0x76')]==0x1){_0x448478[_0xca7d('0x5a')]('`unreadMessages`\x20=\x200');}else{_0x448478['having']('`unreadMessages`\x20>\x200');}}if(_0x2d67cc['query']['tag']){_0x59a041=_[_0xca7d('0x77')](_0x2d67cc[_0xca7d('0x39')]['tag'])?_0x2d67cc['query'][_0xca7d('0x78')]:new Array(_0x2d67cc[_0xca7d('0x39')]['tag']);_0x59a041[_0xca7d('0x66')](function(_0x54499a){_0x2de836['or'](_0xca7d('0x79'),'%,'+_0x54499a+',%');});}if(_0x2d67cc['query'][_0xca7d('0x7a')]){var _0x370645=_0x2d67cc[_0xca7d('0x39')]['filter']['replace']('\x5c','\x5c\x5c')[_0xca7d('0x7b')](/'/g,'\x27\x27');if(qs[_0xca7d('0x7c')](_0x370645)){_0x37b628['or'](_0xca7d('0x7d'),_0x370645+'%')['or'](_0xca7d('0x7e'),_0x370645+'%');}else{_0x37b628['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xca7d('0x7f')](_0x370645))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x370645+'%');}}}_0x448478['where'](_0x37b628);_0x448478['group']('i.id');var _0x5e484f={'type':db['Sequelize'][_0xca7d('0x80')]['SELECT'],'raw':!![]};var _0x283178=_0x448478[_0xca7d('0x81')]();_0x283178[_0xca7d('0x45')](_0xca7d('0x82'));_0x283178[_0xca7d('0x45')](_0xca7d('0x83'),_0xca7d('0x84'));if(_0x5e3e9d['order']){_0x5e3e9d['order'][_0xca7d('0x66')](function(_0x746125){var _0x1db859=_0x746125[0x0]===_0xca7d('0x85')?_0x746125[0x0]:'i.'+_0x746125[0x0];_0x448478[_0xca7d('0x41')](_0x1db859,_0x746125[0x1]===_0xca7d('0x86')?![]:!![]);});}if(!_[_0xca7d('0x6d')](_0x59a041)){_0x448478[_0xca7d('0x5a')](_0x2de836);_0x283178['where'](_0xca7d('0x87'),_0x59a041);}BPromise[_0xca7d('0x88')]()[_0xca7d('0x29')](function(){if(!_0x4fe7f8){if(_0x2d67cc[_0xca7d('0x39')][_0xca7d('0x89')])return;_0x283178['where'](_0xca7d('0x8a'));_0x448478[_0xca7d('0x43')](_0xca7d('0x8a'));return;}if(_0x2d67cc['user'][_0xca7d('0x8b')]!==_0xca7d('0x8c'))return;return _0x2d67cc[_0xca7d('0x8d')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0xca7d('0x29')](function(_0x142700){if(_[_0xca7d('0x6d')](_0x142700)){_0x283178['where'](_0xca7d('0x8e'));_0x448478[_0xca7d('0x43')](_0xca7d('0x8e'));}else{_0x283178[_0xca7d('0x43')](_0xca7d('0x6e'),_['map'](_0x142700,'id'));_0x448478[_0xca7d('0x43')](_0xca7d('0x6e'),_[_0xca7d('0x2f')](_0x142700,'id'));}});})[_0xca7d('0x29')](function(){if(_0x2d67cc['user'][_0xca7d('0x8b')]==='agent'&&!_0x4fe7f8&&!_0x2d67cc[_0xca7d('0x39')][_0xca7d('0x89')])return[];return db['sequelize'][_0xca7d('0x39')](_0x283178[_0xca7d('0x8f')](),_0x5e484f);})[_0xca7d('0x29')](function(_0x73c9aa){_0x3950c3[_0xca7d('0x22')]=_0x73c9aa[_0xca7d('0x3e')];if(_0x3950c3['count']===0x0)return[];return db[_0xca7d('0x90')][_0xca7d('0x39')](_0x3a6594['toString'](),_0x5e484f)[_0xca7d('0x29')](function(_0x5106f0){_0x50cf85=_['keyBy'](_0x5106f0,'id');_0x5e484f=_['merge'](_0x5e484f,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2d67cc[_0xca7d('0x39')][_0xca7d('0x91')]){_0x5e3e9d['attributes']['forEach'](function(_0x5ed25c){_0x448478['field']('i.'+_0x5ed25c);});}else{_0x448478[_0xca7d('0x45')](_0xca7d('0x83'),_0xca7d('0x84'));_0x448478[_0xca7d('0x45')](_0xca7d('0x92'),_0xca7d('0x93'));_0x448478[_0xca7d('0x45')](_0xca7d('0x94'),_0xca7d('0x95'));_0x448478[_0xca7d('0x45')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x448478['field']('i.*');_0x448478[_0xca7d('0x45')](_0xca7d('0x96'),_0xca7d('0x97'));_0x448478[_0xca7d('0x45')](_0xca7d('0x98'),_0xca7d('0x99'));_0x448478[_0xca7d('0x45')]('c.email',_0xca7d('0x9a'));_0x448478['field'](_0xca7d('0x9b'),_0xca7d('0x9c'));_0x448478[_0xca7d('0x45')](_0xca7d('0x9d'),_0xca7d('0x9e'));_0x448478[_0xca7d('0x45')](_0xca7d('0x9f'),_0xca7d('0xa0'));_0x448478[_0xca7d('0x45')]('o.fullname',_0xca7d('0xa1'));_0x448478[_0xca7d('0x45')](_0xca7d('0xa2'),'Owner.internal');_0x448478[_0xca7d('0x45')](_0xca7d('0xa3'),'TagIds');}if(_0x5e3e9d[_0xca7d('0x23')])_0x448478[_0xca7d('0x23')](_0x5e3e9d[_0xca7d('0x23')]);if(_0x5e3e9d['offset'])_0x448478['offset'](_0x5e3e9d[_0xca7d('0x20')]);return db[_0xca7d('0x90')]['query'](_0x448478[_0xca7d('0x8f')](),_0x5e484f);})[_0xca7d('0x29')](function(_0x1804ed){if(_0x1804ed[_0xca7d('0x3e')]>0x0)_0x492145[_0xca7d('0x43')](_0xca7d('0xa4'),_[_0xca7d('0x2f')](_0x1804ed,'id'));return db[_0xca7d('0x90')][_0xca7d('0x39')](_0x492145['toString'](),_0x5e484f)[_0xca7d('0x29')](function(_0x2b2090){var _0x146491=_[_0xca7d('0xa5')](_0x2b2090,_0xca7d('0xa6'));var _0x21f53e=[];_0x1804ed[_0xca7d('0x66')](function(_0x5bca17){_0x21f53e[_0xca7d('0x32')](updateWhatsappInteraction(_0x5bca17,_0x50cf85,_0x146491));});return BPromise[_0xca7d('0xa7')](_0x21f53e);});});})['then'](function(_0x2c4912){_0x3950c3['rows']=_0x2c4912;return _0x3950c3;})['then'](respondWithFilteredResult(_0x3dc00f,_0x5e3e9d))[_0xca7d('0x33')](handleError(_0x3dc00f,null));};exports['show']=function(_0x1698aa,_0x3f135b){var _0x572d71={'raw':![],'where':{'id':_0x1698aa[_0xca7d('0xa8')]['id']}},_0xa879f5={};_0xa879f5[_0xca7d('0x38')]=_[_0xca7d('0x3a')](db[_0xca7d('0xa9')]['rawAttributes']);_0xa879f5['query']=_['keys'](_0x1698aa[_0xca7d('0x39')]);_0xa879f5['filters']=_[_0xca7d('0x3c')](_0xa879f5[_0xca7d('0x38')],_0xa879f5[_0xca7d('0x39')]);_0x572d71['attributes']=_[_0xca7d('0x3c')](_0xa879f5[_0xca7d('0x38')],qs[_0xca7d('0x91')](_0x1698aa[_0xca7d('0x39')]['fields']));_0x572d71['attributes']=_0x572d71[_0xca7d('0x3d')][_0xca7d('0x3e')]?_0x572d71[_0xca7d('0x3d')]:_0xa879f5[_0xca7d('0x38')];if(_0x1698aa['query'][_0xca7d('0xaa')]){_0x572d71[_0xca7d('0xab')]=[{'all':!![]}];}_0x572d71=_[_0xca7d('0xac')]({},_0x572d71,_0x1698aa[_0xca7d('0xad')]);return db[_0xca7d('0xa9')]['find'](_0x572d71)[_0xca7d('0x29')](handleEntityNotFound(_0x3f135b,null))['then'](respondWithResult(_0x3f135b,null))['catch'](handleError(_0x3f135b,null));};exports['create']=function(_0x113f29,_0x1f4b9c){return db[_0xca7d('0xa9')][_0xca7d('0xae')](_0x113f29[_0xca7d('0x6a')],{})['then'](respondWithResult(_0x1f4b9c,0xc9))[_0xca7d('0x33')](handleError(_0x1f4b9c,null));};exports['update']=function(_0x13a7aa,_0x37b5aa){if(_0x13a7aa[_0xca7d('0x6a')]['id']){delete _0x13a7aa['body']['id'];}return db[_0xca7d('0xa9')][_0xca7d('0x58')]({'where':{'id':_0x13a7aa['params']['id']}})[_0xca7d('0x29')](handleEntityNotFound(_0x37b5aa,null))['then'](saveUpdates(_0x13a7aa[_0xca7d('0x6a')],null))[_0xca7d('0x29')](respondWithResult(_0x37b5aa,null))['catch'](handleError(_0x37b5aa,null));};exports[_0xca7d('0x2a')]=function(_0x3dda60,_0xf0dd1c){return db[_0xca7d('0xa9')][_0xca7d('0x58')]({'where':{'id':_0x3dda60[_0xca7d('0xa8')]['id']}})[_0xca7d('0x29')](handleEntityNotFound(_0xf0dd1c,null))[_0xca7d('0x29')](removeEntity(_0xf0dd1c,null))[_0xca7d('0x33')](handleError(_0xf0dd1c,null));};exports['describe']=function(_0x2b280e,_0x41c5be){return db[_0xca7d('0xa9')][_0xca7d('0xaf')]()[_0xca7d('0x29')](respondWithResult(_0x41c5be,null))[_0xca7d('0x33')](handleError(_0x41c5be,null));};exports[_0xca7d('0xb0')]=function(_0x59b2ef,_0x468633,_0x14f994){return db['WhatsappMessage']['find']({'where':{'id':_0x59b2ef['params']['id']}})['then'](handleEntityNotFound(_0x468633,null))[_0xca7d('0x29')](function(_0x44ecab){if(_0x44ecab){return _0x44ecab[_0xca7d('0xb0')](_0x59b2ef['body'][_0xca7d('0xb1')],_[_0xca7d('0xb2')](_0x59b2ef[_0xca7d('0x6a')],[_0xca7d('0xb1'),'id'])||{});}})['then'](respondWithResult(_0x468633,null))[_0xca7d('0x33')](handleError(_0x468633,null));};exports[_0xca7d('0xb3')]=function(_0x81ece0,_0x50b3ec,_0x57a7f5){var _0x1c0cb6={'raw':![],'where':{}};var _0x160316={};var _0x18bca6={'count':0x0,'rows':[]};return db[_0xca7d('0xa9')][_0xca7d('0xb4')]({'where':{'id':_0x81ece0[_0xca7d('0xa8')]['id']}})[_0xca7d('0x29')](handleEntityNotFound(_0x50b3ec,null))[_0xca7d('0x29')](function(_0x2305f9){if(_0x2305f9){_0x160316[_0xca7d('0x38')]=_[_0xca7d('0x3a')](db[_0xca7d('0xb5')][_0xca7d('0x35')]);_0x160316[_0xca7d('0x39')]=_[_0xca7d('0x3a')](_0x81ece0[_0xca7d('0x39')]);_0x160316[_0xca7d('0x3b')]=_['intersection'](_0x160316[_0xca7d('0x38')],_0x160316[_0xca7d('0x39')]);_0x1c0cb6[_0xca7d('0x3d')]=_[_0xca7d('0x3c')](_0x160316[_0xca7d('0x38')],qs[_0xca7d('0x91')](_0x81ece0[_0xca7d('0x39')][_0xca7d('0x91')]));_0x1c0cb6[_0xca7d('0x3d')]=_0x1c0cb6[_0xca7d('0x3d')][_0xca7d('0x3e')]?_0x1c0cb6['attributes']:_0x160316['model'];if(!_0x81ece0[_0xca7d('0x39')][_0xca7d('0x3f')](_0xca7d('0x40'))){_0x1c0cb6[_0xca7d('0x23')]=qs['limit'](_0x81ece0[_0xca7d('0x39')][_0xca7d('0x23')]);_0x1c0cb6[_0xca7d('0x20')]=qs['offset'](_0x81ece0['query'][_0xca7d('0x20')]);}_0x1c0cb6[_0xca7d('0x41')]=qs[_0xca7d('0x42')](_0x81ece0[_0xca7d('0x39')][_0xca7d('0x42')]);_0x1c0cb6[_0xca7d('0x43')]=qs[_0xca7d('0x3b')](_[_0xca7d('0x44')](_0x81ece0['query'],_0x160316['filters']));_0x1c0cb6[_0xca7d('0x43')]['WhatsappInteractionId']=_0x2305f9['id'];if(_0x81ece0[_0xca7d('0x39')][_0xca7d('0x7a')]){_0x1c0cb6[_0xca7d('0x43')]=_[_0xca7d('0xac')](_0x1c0cb6['where'],{'$or':_[_0xca7d('0x2f')](_0x1c0cb6[_0xca7d('0x3d')],function(_0x418caf){var _0x18b5f6={};_0x18b5f6[_0x418caf]={'$like':'%'+_0x81ece0[_0xca7d('0x39')][_0xca7d('0x7a')]+'%'};return _0x18b5f6;})});}if(_0x81ece0[_0xca7d('0x39')][_0xca7d('0x71')]){var _0x4f7948=_0x81ece0['query'][_0xca7d('0x71')][_0xca7d('0x5f')](',');var _0x4ab954={};_0x4ab954[_0x4f7948[0x0]]={'$gte':moment(_0x4f7948[0x1])[_0xca7d('0xb6')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1c0cb6[_0xca7d('0x43')]=_[_0xca7d('0xac')](_0x1c0cb6[_0xca7d('0x43')],_0x4ab954);}_0x1c0cb6=_[_0xca7d('0xac')]({},_0x1c0cb6,_0x81ece0['options']);return db[_0xca7d('0xb5')][_0xca7d('0x22')]({'where':_0x1c0cb6['where']})['then'](function(_0x12c8b1){_0x18bca6[_0xca7d('0x22')]=_0x12c8b1;if(_0x81ece0[_0xca7d('0x39')][_0xca7d('0xaa')]){_0x1c0cb6[_0xca7d('0xab')]=[{'all':!![]}];}return db[_0xca7d('0xb5')][_0xca7d('0xb7')](_0x1c0cb6);})[_0xca7d('0x29')](function(_0x3f077d){_0x18bca6[_0xca7d('0xb8')]=_0x3f077d;return _0x18bca6;});}})[_0xca7d('0x29')](respondWithFilteredResult(_0x50b3ec,_0x1c0cb6))[_0xca7d('0x33')](handleError(_0x50b3ec,null));};exports['addTags']=function(_0x193575,_0x1bcfb0,_0x341098){return db[_0xca7d('0xa9')][_0xca7d('0x58')]({'where':{'id':_0x193575[_0xca7d('0xa8')]['id']}})[_0xca7d('0x29')](handleEntityNotFound(_0x1bcfb0,null))['then'](function(_0x5169a6){if(_0x5169a6){return _0x5169a6[_0xca7d('0xb9')](_0x193575[_0xca7d('0x6a')][_0xca7d('0xb1')],_[_0xca7d('0xb2')](_0x193575[_0xca7d('0x6a')],['ids','id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0xca7d('0x2c'),_0xca7d('0xba')],'where':{'id':_0x193575[_0xca7d('0x6a')][_0xca7d('0xb1')]}});})['then'](function(_0x29a84b){socket[_0xca7d('0xbb')]('whatsappInteractionTags:save',{'id':Number(_0x193575[_0xca7d('0xa8')]['id']),'tags':_0x29a84b||[]});return{'id':Number(_0x193575['params']['id']),'tags':_0x29a84b||[]};});}})[_0xca7d('0x29')](respondWithResult(_0x1bcfb0,null))[_0xca7d('0x33')](handleError(_0x1bcfb0,null));};exports['removeTags']=function(_0x25aee4,_0x7e2aa1,_0x594814){return db[_0xca7d('0xa9')][_0xca7d('0x58')]({'where':{'id':_0x25aee4['params']['id']}})[_0xca7d('0x29')](handleEntityNotFound(_0x7e2aa1,null))[_0xca7d('0x29')](function(_0x251408){if(_0x251408){return _0x251408[_0xca7d('0xbc')](_0x25aee4['query'][_0xca7d('0xb1')]);}})[_0xca7d('0x29')](respondWithStatusCode(_0x7e2aa1,null))[_0xca7d('0x33')](handleError(_0x7e2aa1,null));};exports['download']=function(_0x2114d3,_0xdf03fd){var _0x1a1201=moment()['unix']()[_0xca7d('0x8f')]();var _0x43cd7d=path[_0xca7d('0xbd')](config[_0xca7d('0xbe')],_0xca7d('0xbf'),_0xca7d('0xc0'),'tmp');var _0xb26503=path[_0xca7d('0xbd')](config[_0xca7d('0xbe')],'server','files',_0xca7d('0xc1'));var _0x29852c=path['join'](_0x43cd7d,_0x1a1201);var _0x287a6e=util[_0xca7d('0xb6')](_0xca7d('0xc2'),_0x2114d3['params']['id'],_0x1a1201);var _0x32177c=path[_0xca7d('0xbd')](_0x43cd7d,_0x287a6e);var _0x3b8982=[];_0x3b8982['push']({'model':db[_0xca7d('0x67')],'as':_0xca7d('0x67'),'attributes':['id',_0xca7d('0xc3')],'raw':!![]});_0x3b8982[_0xca7d('0x32')]({'model':db['CmContact'],'as':_0xca7d('0xc4'),'attributes':['id',_0xca7d('0xc5'),_0xca7d('0xc6')],'raw':!![]});if(_0x2114d3[_0xca7d('0x39')][_0xca7d('0xc1')]){_0x3b8982[_0xca7d('0x32')]({'model':db[_0xca7d('0xc7')],'as':_0xca7d('0xc7'),'raw':!![]});}var _0x5ce7b8=[{'model':db[_0xca7d('0xb5')],'as':_0xca7d('0xc8'),'attributes':['id',_0xca7d('0x6a'),_0xca7d('0x70'),'direction','secret',_0xca7d('0x76')],'include':_0x3b8982}];_0x5ce7b8[_0xca7d('0x32')]({'model':db[_0xca7d('0xc9')],'as':_0xca7d('0xca'),'attributes':['id',_0xca7d('0x2c')]});_0x5ce7b8[_0xca7d('0x32')]({'model':db[_0xca7d('0x67')],'as':'Owner','attributes':['id',_0xca7d('0xc3')]});return db[_0xca7d('0xa9')][_0xca7d('0x58')]({'where':{'id':_0x2114d3[_0xca7d('0xa8')]['id']},'include':_0x5ce7b8})[_0xca7d('0x29')](handleEntityNotFound(_0xdf03fd,null))[_0xca7d('0x29')](function(_0x44207e){if(_0x44207e){var _0x4cad3a=_0x44207e['get']({'plain':!![]});fs['mkdirSync'](_0x29852c);var _0x49eedd={'channel':_0xca7d('0xcb'),'account':_0x4cad3a[_0xca7d('0xca')]['name'],'agent':_0x4cad3a[_0xca7d('0xcc')]?_0x4cad3a['Owner'][_0xca7d('0xc3')]:_0xca7d('0xcd'),'createdAt':moment(_0x4cad3a[_0xca7d('0x70')])['format'](_0xca7d('0xce'))[_0xca7d('0x8f')](),'closedAt':_0x4cad3a['closed']?moment(_0x4cad3a[_0xca7d('0xcf')])[_0xca7d('0xb6')](_0xca7d('0xce'))[_0xca7d('0x8f')]():'','disposition':_0x4cad3a[_0xca7d('0xd0')],'messages':_(_0x4cad3a[_0xca7d('0xc8')])[_0xca7d('0x7a')]({'secret':![]})[_0xca7d('0x2f')](function(_0x338716){if(_0x338716[_0xca7d('0xc7')]){var _0x524e72=path['join'](_0xb26503,_0x338716[_0xca7d('0xc7')]['basename']);if(fs[_0xca7d('0xd1')](_0x524e72)){fs[_0xca7d('0xd2')](_0x524e72)[_0xca7d('0xd3')](fs['createWriteStream'](path[_0xca7d('0xbd')](_0x29852c,_0x338716[_0xca7d('0xc7')]['basename'])));}}return{'date':moment(_0x338716[_0xca7d('0x70')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xca7d('0x8f')](),'sender':_0x338716['direction']==='out'?_0x338716[_0xca7d('0x67')]?_0x338716[_0xca7d('0x67')][_0xca7d('0xc3')]:_0xca7d('0xd4'):_0x338716[_0xca7d('0xc4')][_0xca7d('0xc5')]+(_0x338716[_0xca7d('0xc4')]['lastName']?'\x20'+_0x338716['Contact'][_0xca7d('0xc6')]:''),'body':_0x338716[_0xca7d('0xc7')]?_0x338716['Attachment'][_0xca7d('0xd5')]:_0x338716[_0xca7d('0x6a')],'direction':_0x338716[_0xca7d('0xd6')]==='out'?'A':'C','secret':_0x338716[_0xca7d('0xd7')],'read':_0x338716[_0xca7d('0x76')],'attachment':_0x338716[_0xca7d('0xc7')]};})[_0xca7d('0x5e')]()};return ejs['renderFile'](path[_0xca7d('0xbd')](config[_0xca7d('0xbe')],'server','views',_0xca7d('0xd8')),{'interaction':_0x49eedd})['then'](function(_0x34be6c){var _0x320ed0=path[_0xca7d('0xbd')](_0x29852c,_0xca7d('0xd9')+_0x4cad3a['id']+'-'+_0x1a1201+_0xca7d('0xda'));var _0x252adc={'path':_0x320ed0,'channel':_0xca7d('0xcb'),'interactionId':_0x4cad3a['id']};return pdf[_0xca7d('0xdb')](_0x34be6c,_0x252adc);})['then'](function(){return new BPromise(function(_0x15cc61,_0x5d0730){zipdir(_0x29852c,{'saveTo':_0x32177c},function(_0x3ce185,_0x39b63a){if(_0x3ce185)return _0x5d0730(_0x3ce185);return _0x15cc61(_0x39b63a);});})[_0xca7d('0x29')](function(){return new BPromise(function(_0x51a7c2,_0x4eb397){rimraf(_0x29852c,function(_0x35451a){if(_0x35451a)_0x4eb397(_0x35451a);return _0x51a7c2();});});})[_0xca7d('0x29')](function(){return _0xdf03fd[_0xca7d('0xdc')](_0x32177c,_0x287a6e,function(_0x357d35){if(_0x357d35){console['log'](_0xca7d('0xdd'),_0x357d35);}else{fs[_0xca7d('0xde')](_0x32177c);}});});});}else{return _0xdf03fd['sendStatus'](0xc8);}})[_0xca7d('0x33')](handleError(_0xdf03fd,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 19d2cc3..a641677 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 _0x402f=['then','map','findAll','setDataValue','unreadMessages','length','emit','events','WhatsappInteraction','setMaxListeners','save','update','getUsers'];(function(_0x5b6786,_0x1636cc){var _0x5c409c=function(_0x279db6){while(--_0x279db6){_0x5b6786['push'](_0x5b6786['shift']());}};_0x5c409c(++_0x1636cc);}(_0x402f,0x6f));var _0xf402=function(_0x458a6e,_0xc6a2ec){_0x458a6e=_0x458a6e-0x0;var _0x3ad477=_0x402f[_0x458a6e];return _0x3ad477;};'use strict';var EventEmitter=require(_0xf402('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xf402('0x1')];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xf402('0x2')](0x0);var events={'afterCreate':_0xf402('0x3'),'afterUpdate':_0xf402('0x4'),'afterDestroy':'remove'};function emitEvent(_0x246c5f){return function(_0x48771a,_0x20c2cc,_0x270766){_0x48771a[_0xf402('0x5')]({'attributes':['id'],'raw':!![]})[_0xf402('0x6')](function(_0xa1b27d){_0x48771a['setDataValue']('Users',_0xa1b27d[_0xf402('0x7')](function(_0x154bd3){return{'id':_0x154bd3['id']};}));return WhatsappMessage[_0xf402('0x8')]({'where':{'WhatsappInteractionId':_0x48771a['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf402('0x6')](function(_0x18c918){_0x48771a[_0xf402('0x9')](_0xf402('0xa'),_0x18c918[_0xf402('0xb')]);WhatsappInteractionEvents['emit'](_0x246c5f+':'+_0x48771a['id'],_0x48771a);WhatsappInteractionEvents[_0xf402('0xc')](_0x246c5f,_0x48771a);_0x270766(null);})['catch'](_0x270766(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0xfb3f=['map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','save','remove','getUsers','then','Users'];(function(_0x4903b3,_0x201867){var _0x551d4f=function(_0x1a6730){while(--_0x1a6730){_0x4903b3['push'](_0x4903b3['shift']());}};_0x551d4f(++_0x201867);}(_0xfb3f,0xd9));var _0xffb3=function(_0x195c77,_0x54c2b0){_0x195c77=_0x195c77-0x0;var _0x27db51=_0xfb3f[_0x195c77];return _0x27db51;};'use strict';var EventEmitter=require(_0xffb3('0x0'));var WhatsappInteraction=require(_0xffb3('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xffb3('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xffb3('0x2'),'afterUpdate':'update','afterDestroy':_0xffb3('0x3')};function emitEvent(_0x4f28c4){return function(_0xaecfd9,_0x15cb2c,_0x30d7f7){_0xaecfd9[_0xffb3('0x4')]({'attributes':['id'],'raw':!![]})[_0xffb3('0x5')](function(_0x146133){_0xaecfd9['setDataValue'](_0xffb3('0x6'),_0x146133[_0xffb3('0x7')](function(_0x39014a){return{'id':_0x39014a['id']};}));return WhatsappMessage[_0xffb3('0x8')]({'where':{'WhatsappInteractionId':_0xaecfd9['id'],'direction':'in','read':![]},'raw':!![]});})[_0xffb3('0x5')](function(_0x47bca5){_0xaecfd9[_0xffb3('0x9')](_0xffb3('0xa'),_0x47bca5[_0xffb3('0xb')]);WhatsappInteractionEvents[_0xffb3('0xc')](_0x4f28c4+':'+_0xaecfd9['id'],_0xaecfd9);WhatsappInteractionEvents[_0xffb3('0xc')](_0x4f28c4,_0xaecfd9);_0x30d7f7(null);})[_0xffb3('0xd')](_0x30d7f7(null));};}for(var e in events){if(events[_0xffb3('0xe')](e)){var event=events[e];WhatsappInteraction[_0xffb3('0xf')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index e58df7a..be236de 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 _0x920c=['util','../../config/logger','api','request-promise','rimraf','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x920c,0x152));var _0xc920=function(_0x5b8499,_0x131622){_0x5b8499=_0x5b8499-0x0;var _0x50aa33=_0x920c[_0x5b8499];return _0x50aa33;};'use strict';var _=require('lodash');var util=require(_0xc920('0x0'));var logger=require(_0xc920('0x1'))(_0xc920('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc920('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc920('0x4'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module[_0xc920('0x5')]=function(_0x4fca9f,_0x352142){return _0x4fca9f[_0xc920('0x6')](_0xc920('0x7'),attributes,{'tableName':_0xc920('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x495446,_0xd43c87,_0x46b09d){if(_0x495446[_0xc920('0x9')](_0xc920('0xa'))){_0x495446['closedAt']=moment()[_0xc920('0xb')](_0xc920('0xc'));}_0x46b09d(null,_0x495446);}}});}; \ No newline at end of file +var _0x9c13=['path','rimraf','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2e17e7,_0x2ebb08){var _0x46e92c=function(_0x1dcc45){while(--_0x1dcc45){_0x2e17e7['push'](_0x2e17e7['shift']());}};_0x46e92c(++_0x2ebb08);}(_0x9c13,0xf6));var _0x39c1=function(_0x1895b7,_0x21fbc7){_0x1895b7=_0x1895b7-0x0;var _0x1aecdc=_0x9c13[_0x1895b7];return _0x1aecdc;};'use strict';var _=require('lodash');var util=require(_0x39c1('0x0'));var logger=require(_0x39c1('0x1'))(_0x39c1('0x2'));var moment=require(_0x39c1('0x3'));var BPromise=require(_0x39c1('0x4'));var rp=require(_0x39c1('0x5'));var fs=require('fs');var path=require(_0x39c1('0x6'));var rimraf=require(_0x39c1('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0x5e85b1,_0x480a36){return _0x5e85b1[_0x39c1('0x8')](_0x39c1('0x9'),attributes,{'tableName':_0x39c1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x803a41,_0x3c3d1c,_0x379f37){if(_0x803a41[_0x39c1('0xb')](_0x39c1('0xc'))){_0x803a41[_0x39c1('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x379f37(null,_0x803a41);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index e88a10c..97fa740 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 _0xbd21=['code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','then','find','addTags','ids','spread','AddTags','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbd21,0x8d));var _0x1bd2=function(_0x23bcf4,_0x17c810){_0x23bcf4=_0x23bcf4-0x0;var _0x1e2938=_0xbd21[_0x23bcf4];return _0x1e2938;};'use strict';var _=require('lodash');var util=require(_0x1bd2('0x0'));var moment=require(_0x1bd2('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1bd2('0x2'))['db'];var utils=require(_0x1bd2('0x3'));var logger=require(_0x1bd2('0x4'))(_0x1bd2('0x5'));var config=require(_0x1bd2('0x6'));var jayson=require(_0x1bd2('0x7'));var client=jayson[_0x1bd2('0x8')][_0x1bd2('0x9')]({'port':0x232a});config[_0x1bd2('0xa')]=_[_0x1bd2('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1bd2('0xc'))(new Redis(config[_0x1bd2('0xa')]));require(_0x1bd2('0xd'))[_0x1bd2('0xe')](socket);function respondWithRpcPromise(_0x1bae44,_0x4f2a55,_0x27d6f9){return new BPromise(function(_0x59003e,_0x114e36){return client[_0x1bd2('0xf')](_0x1bae44,_0x27d6f9)['then'](function(_0x474d5){logger[_0x1bd2('0x10')](_0x1bd2('0x11'),_0x4f2a55,_0x1bd2('0x12'));logger[_0x1bd2('0x13')](_0x1bd2('0x14'),_0x4f2a55,'request\x20sent',JSON[_0x1bd2('0x15')](_0x474d5));if(_0x474d5['error']){if(_0x474d5[_0x1bd2('0x16')][_0x1bd2('0x17')]===0x1f4){logger[_0x1bd2('0x16')](_0x1bd2('0x11'),_0x4f2a55,_0x474d5[_0x1bd2('0x16')][_0x1bd2('0x18')]);return _0x114e36(_0x474d5[_0x1bd2('0x16')][_0x1bd2('0x18')]);}logger[_0x1bd2('0x16')](_0x1bd2('0x11'),_0x4f2a55,_0x474d5[_0x1bd2('0x16')]['message']);return _0x59003e(_0x474d5['error'][_0x1bd2('0x18')]);}else{logger[_0x1bd2('0x10')](_0x1bd2('0x11'),_0x4f2a55,_0x1bd2('0x12'));_0x59003e(_0x474d5[_0x1bd2('0x19')]['message']);}})[_0x1bd2('0x1a')](function(_0x1710ab){logger[_0x1bd2('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x4f2a55,_0x1710ab);_0x114e36(_0x1710ab);});});}exports[_0x1bd2('0x1b')]=function(_0x24d60a){var _0xf3db8f=this;return new Promise(function(_0x257ac2,_0x3bc469){return db[_0x1bd2('0x1c')][_0x1bd2('0x1d')](_0x24d60a[_0x1bd2('0x1e')],{'raw':_0x24d60a[_0x1bd2('0x1f')]?_0x24d60a[_0x1bd2('0x1f')][_0x1bd2('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24d60a[_0x1bd2('0x1f')]?_0x24d60a['options'][_0x1bd2('0x21')]||null:null,'attributes':_0x24d60a[_0x1bd2('0x1f')]?_0x24d60a[_0x1bd2('0x1f')][_0x1bd2('0x22')]||null:null,'limit':_0x24d60a['options']?_0x24d60a[_0x1bd2('0x1f')]['limit']||null:null})[_0x1bd2('0x23')](function(_0x53d117){logger[_0x1bd2('0x10')](_0x1bd2('0x1b'),_0x24d60a);logger[_0x1bd2('0x13')](_0x1bd2('0x1b'),_0x24d60a,JSON[_0x1bd2('0x15')](_0x53d117));_0x257ac2(_0x53d117);})[_0x1bd2('0x1a')](function(_0x439a68){logger['error'](_0x1bd2('0x1b'),_0x439a68[_0x1bd2('0x18')],_0x24d60a);_0x3bc469(_0xf3db8f[_0x1bd2('0x16')](0x1f4,_0x439a68[_0x1bd2('0x18')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x5d215a){return new Promise(function(_0x385049,_0xe3b0a0){return db[_0x1bd2('0x1c')][_0x1bd2('0x24')]({'where':_0x5d215a['options']?_0x5d215a[_0x1bd2('0x1f')][_0x1bd2('0x21')]||null:null})[_0x1bd2('0x23')](function(_0x4224c7){if(_0x4224c7){return _0x4224c7[_0x1bd2('0x25')](_0x5d215a[_0x1bd2('0x1e')][_0x1bd2('0x26')],_['omit'](_0x5d215a[_0x1bd2('0x1e')],['ids','id'])||{});}})[_0x1bd2('0x27')](function(_0x20d49b){logger['info'](_0x1bd2('0x28'),_0x5d215a);logger[_0x1bd2('0x13')](_0x1bd2('0x28'),_0x5d215a,JSON[_0x1bd2('0x15')](_0x20d49b));_0x385049(_0x20d49b);})[_0x1bd2('0x1a')](function(_0x1b472c){logger[_0x1bd2('0x16')](_0x1bd2('0x28'),_0x1b472c[_0x1bd2('0x18')],_0x5d215a);_0xe3b0a0(_this[_0x1bd2('0x16')](0x1f4,_0x1b472c[_0x1bd2('0x18')]));});});}; \ No newline at end of file +var _0x292f=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then','info','request\x20sent','debug','stringify','error','message','WhatsappInteraction,\x20%s,\x20%s','UpdateWhatsappInteraction','WhatsappInteraction','update','options','where','find','addTags','body','ids','omit','spread','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x112488,_0x3624ac){var _0x503e38=function(_0x9e9e8e){while(--_0x9e9e8e){_0x112488['push'](_0x112488['shift']());}};_0x503e38(++_0x3624ac);}(_0x292f,0xe8));var _0xf292=function(_0x2c3255,_0x4e00ae){_0x2c3255=_0x2c3255-0x0;var _0x282aba=_0x292f[_0x2c3255];return _0x282aba;};'use strict';var _=require(_0xf292('0x0'));var util=require(_0xf292('0x1'));var moment=require(_0xf292('0x2'));var BPromise=require(_0xf292('0x3'));var rs=require(_0xf292('0x4'));var fs=require('fs');var Redis=require(_0xf292('0x5'));var db=require(_0xf292('0x6'))['db'];var utils=require(_0xf292('0x7'));var logger=require(_0xf292('0x8'))(_0xf292('0x9'));var config=require(_0xf292('0xa'));var jayson=require(_0xf292('0xb'));var client=jayson[_0xf292('0xc')][_0xf292('0xd')]({'port':0x232a});config[_0xf292('0xe')]=_[_0xf292('0xf')](config[_0xf292('0xe')],{'host':_0xf292('0x10'),'port':0x18eb});var socket=require(_0xf292('0x11'))(new Redis(config[_0xf292('0xe')]));require(_0xf292('0x12'))[_0xf292('0x13')](socket);function respondWithRpcPromise(_0x474c9d,_0x37578c,_0x367523){return new BPromise(function(_0x289613,_0x3dec3e){return client['request'](_0x474c9d,_0x367523)[_0xf292('0x14')](function(_0x5d8bb3){logger[_0xf292('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x37578c,_0xf292('0x16'));logger[_0xf292('0x17')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x37578c,_0xf292('0x16'),JSON[_0xf292('0x18')](_0x5d8bb3));if(_0x5d8bb3['error']){if(_0x5d8bb3['error']['code']===0x1f4){logger[_0xf292('0x19')]('WhatsappInteraction,\x20%s,\x20%s',_0x37578c,_0x5d8bb3[_0xf292('0x19')][_0xf292('0x1a')]);return _0x3dec3e(_0x5d8bb3[_0xf292('0x19')][_0xf292('0x1a')]);}logger[_0xf292('0x19')]('WhatsappInteraction,\x20%s,\x20%s',_0x37578c,_0x5d8bb3[_0xf292('0x19')][_0xf292('0x1a')]);return _0x289613(_0x5d8bb3[_0xf292('0x19')][_0xf292('0x1a')]);}else{logger[_0xf292('0x15')](_0xf292('0x1b'),_0x37578c,'request\x20sent');_0x289613(_0x5d8bb3['result']['message']);}})['catch'](function(_0x497a5c){logger[_0xf292('0x19')]('WhatsappInteraction,\x20%s,\x20%s',_0x37578c,_0x497a5c);_0x3dec3e(_0x497a5c);});});}exports[_0xf292('0x1c')]=function(_0x1b1d8b){var _0x3a43f5=this;return new Promise(function(_0x9bd2fd,_0x69232a){return db[_0xf292('0x1d')][_0xf292('0x1e')](_0x1b1d8b['body'],{'raw':_0x1b1d8b['options']?_0x1b1d8b[_0xf292('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b1d8b[_0xf292('0x1f')]?_0x1b1d8b['options'][_0xf292('0x20')]||null:null,'attributes':_0x1b1d8b[_0xf292('0x1f')]?_0x1b1d8b[_0xf292('0x1f')]['attributes']||null:null,'limit':_0x1b1d8b[_0xf292('0x1f')]?_0x1b1d8b[_0xf292('0x1f')]['limit']||null:null})[_0xf292('0x14')](function(_0xcc741c){logger[_0xf292('0x15')](_0xf292('0x1c'),_0x1b1d8b);logger['debug'](_0xf292('0x1c'),_0x1b1d8b,JSON['stringify'](_0xcc741c));_0x9bd2fd(_0xcc741c);})['catch'](function(_0x291a9f){logger['error'](_0xf292('0x1c'),_0x291a9f[_0xf292('0x1a')],_0x1b1d8b);_0x69232a(_0x3a43f5[_0xf292('0x19')](0x1f4,_0x291a9f[_0xf292('0x1a')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x457484){return new Promise(function(_0x54579f,_0x16cde6){return db[_0xf292('0x1d')][_0xf292('0x21')]({'where':_0x457484[_0xf292('0x1f')]?_0x457484[_0xf292('0x1f')][_0xf292('0x20')]||null:null})['then'](function(_0x46c076){if(_0x46c076){return _0x46c076[_0xf292('0x22')](_0x457484[_0xf292('0x23')][_0xf292('0x24')],_[_0xf292('0x25')](_0x457484[_0xf292('0x23')],[_0xf292('0x24'),'id'])||{});}})[_0xf292('0x26')](function(_0x4407e7){logger[_0xf292('0x15')]('AddTags',_0x457484);logger[_0xf292('0x17')]('AddTags',_0x457484,JSON['stringify'](_0x4407e7));_0x54579f(_0x4407e7);})[_0xf292('0x27')](function(_0x394055){logger[_0xf292('0x19')]('AddTags',_0x394055[_0xf292('0x1a')],_0x457484);_0x16cde6(_this[_0xf292('0x19')](0x1f4,_0x394055[_0xf292('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index f89aa79..3864781 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 _0xf619=['emit','register','length','whatsappInteraction:','./whatsappInteraction.events','remove','update'];(function(_0xc52550,_0x53feb1){var _0x30605b=function(_0x2fcdf8){while(--_0x2fcdf8){_0xc52550['push'](_0xc52550['shift']());}};_0x30605b(++_0x53feb1);}(_0xf619,0xe4));var _0x9f61=function(_0x126761,_0x485246){_0x126761=_0x126761-0x0;var _0xb77d80=_0xf619[_0x126761];return _0xb77d80;};'use strict';var WhatsappInteractionEvents=require(_0x9f61('0x0'));var events=['save',_0x9f61('0x1'),_0x9f61('0x2')];function createListener(_0x216e81,_0x33d91f){return function(_0x4016a9){_0x33d91f[_0x9f61('0x3')](_0x216e81,_0x4016a9);};}function removeListener(_0x4d9854,_0x5dc9b2){return function(){WhatsappInteractionEvents['removeListener'](_0x4d9854,_0x5dc9b2);};}exports[_0x9f61('0x4')]=function(_0x6a543f){for(var _0x26197c=0x0,_0x5df222=events[_0x9f61('0x5')];_0x26197c<_0x5df222;_0x26197c++){var _0xd4d324=events[_0x26197c];var _0x44e6f=createListener(_0x9f61('0x6')+_0xd4d324,_0x6a543f);WhatsappInteractionEvents['on'](_0xd4d324,_0x44e6f);}}; \ No newline at end of file +var _0x8dfa=['whatsappInteraction:','./whatsappInteraction.events','remove','update','emit','removeListener','register'];(function(_0x45c981,_0x2ad2d4){var _0x4f62c8=function(_0x55209b){while(--_0x55209b){_0x45c981['push'](_0x45c981['shift']());}};_0x4f62c8(++_0x2ad2d4);}(_0x8dfa,0x135));var _0xa8df=function(_0x276468,_0x29685a){_0x276468=_0x276468-0x0;var _0x36dc3a=_0x8dfa[_0x276468];return _0x36dc3a;};'use strict';var WhatsappInteractionEvents=require(_0xa8df('0x0'));var events=['save',_0xa8df('0x1'),_0xa8df('0x2')];function createListener(_0x52d9e3,_0x23b66d){return function(_0x5d973c){_0x23b66d[_0xa8df('0x3')](_0x52d9e3,_0x5d973c);};}function removeListener(_0x57e182,_0x4ced05){return function(){WhatsappInteractionEvents[_0xa8df('0x4')](_0x57e182,_0x4ced05);};}exports[_0xa8df('0x5')]=function(_0x2d0b14){for(var _0xd1f47a=0x0,_0x9a4508=events['length'];_0xd1f47a<_0x9a4508;_0xd1f47a++){var _0x5d52a4=events[_0xd1f47a];var _0x3020bf=createListener(_0xa8df('0x6')+_0x5d52a4,_0x2d0b14);WhatsappInteractionEvents['on'](_0x5d52a4,_0x3020bf);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 5c27736..efc2b70 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 _0x2c9e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','tracked','whatsapp','create','post','/:id/status','put','update','/:id/accept','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x5eb868,_0x3edfb0){var _0x278458=function(_0x266273){while(--_0x266273){_0x5eb868['push'](_0x5eb868['shift']());}};_0x278458(++_0x3edfb0);}(_0x2c9e,0x12f));var _0xe2c9=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2c9e[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xe2c9('0x0'));var util=require(_0xe2c9('0x1'));var path=require(_0xe2c9('0x2'));var timeout=require(_0xe2c9('0x3'));var express=require(_0xe2c9('0x4'));var router=express[_0xe2c9('0x5')]();var fs_extra=require(_0xe2c9('0x6'));var auth=require(_0xe2c9('0x7'));var interaction=require(_0xe2c9('0x8'));var config=require(_0xe2c9('0x9'));var controller=require('./whatsappMessage.controller');router[_0xe2c9('0xa')]('/',auth[_0xe2c9('0xb')](),controller[_0xe2c9('0xc')]);router[_0xe2c9('0xa')](_0xe2c9('0xd'),auth[_0xe2c9('0xb')](),controller[_0xe2c9('0xe')]);router['get'](_0xe2c9('0xf'),auth[_0xe2c9('0xb')](),controller[_0xe2c9('0x10')]);router['post']('/',auth[_0xe2c9('0xb')](),interaction[_0xe2c9('0x11')](_0xe2c9('0x12'),'whatsappmessage:create'),controller[_0xe2c9('0x13')]);router[_0xe2c9('0x14')](_0xe2c9('0x15'),controller['status']);router[_0xe2c9('0x16')](_0xe2c9('0xf'),auth[_0xe2c9('0xb')](),controller[_0xe2c9('0x17')]);router[_0xe2c9('0x16')](_0xe2c9('0x18'),auth[_0xe2c9('0xb')](),controller['accept']);router[_0xe2c9('0x16')]('/:id/reject',auth[_0xe2c9('0xb')](),controller['reject']);router[_0xe2c9('0x19')]('/:id',auth[_0xe2c9('0xb')](),controller[_0xe2c9('0x1a')]);module[_0xe2c9('0x1b')]=router; \ No newline at end of file +var _0x5a7d=['tracked','whatsapp','create','/:id/status','/:id','update','put','/:id/accept','accept','/:id/reject','reject','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','index','/describe','isAuthenticated','show','post'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x5a7d,0x1cc));var _0xd5a7=function(_0x4271eb,_0x31d891){_0x4271eb=_0x4271eb-0x0;var _0x1ed1ea=_0x5a7d[_0x4271eb];return _0x1ed1ea;};'use strict';var multer=require(_0xd5a7('0x0'));var util=require(_0xd5a7('0x1'));var path=require(_0xd5a7('0x2'));var timeout=require('connect-timeout');var express=require(_0xd5a7('0x3'));var router=express[_0xd5a7('0x4')]();var fs_extra=require(_0xd5a7('0x5'));var auth=require(_0xd5a7('0x6'));var interaction=require(_0xd5a7('0x7'));var config=require(_0xd5a7('0x8'));var controller=require(_0xd5a7('0x9'));router[_0xd5a7('0xa')]('/',auth['isAuthenticated'](),controller[_0xd5a7('0xb')]);router[_0xd5a7('0xa')](_0xd5a7('0xc'),auth[_0xd5a7('0xd')](),controller['describe']);router[_0xd5a7('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xd5a7('0xe')]);router[_0xd5a7('0xf')]('/',auth[_0xd5a7('0xd')](),interaction[_0xd5a7('0x10')](_0xd5a7('0x11'),'whatsappmessage:create'),controller[_0xd5a7('0x12')]);router['post'](_0xd5a7('0x13'),controller['status']);router['put'](_0xd5a7('0x14'),auth['isAuthenticated'](),controller[_0xd5a7('0x15')]);router[_0xd5a7('0x16')](_0xd5a7('0x17'),auth[_0xd5a7('0xd')](),controller[_0xd5a7('0x18')]);router[_0xd5a7('0x16')](_0xd5a7('0x19'),auth[_0xd5a7('0xd')](),controller[_0xd5a7('0x1a')]);router['delete'](_0xd5a7('0x14'),auth[_0xd5a7('0xd')](),controller['destroy']);module[_0xd5a7('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index b286209..acd096a 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 _0xa5fd=['sequelize','TEXT','medium','BOOLEAN','out','STRING'];(function(_0x22e257,_0x54db13){var _0x5a8775=function(_0x313830){while(--_0x313830){_0x22e257['push'](_0x22e257['shift']());}};_0x5a8775(++_0x54db13);}(_0xa5fd,0x90));var _0xda5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5fd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xda5f('0x0'));module['exports']={'body':{'type':Sequelize[_0xda5f('0x1')](_0xda5f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xda5f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xda5f('0x4')),'defaultValue':_0xda5f('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xda5f('0x5')](0xbe)},'phone':{'type':Sequelize[_0xda5f('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xda5f('0x5')]},'providerResponse':{'type':Sequelize[_0xda5f('0x1')]}}; \ No newline at end of file +var _0xe970=['BOOLEAN','out','STRING','exports','TEXT','medium'];(function(_0x3d62e8,_0x4d13a9){var _0x37c701=function(_0x1cd4e3){while(--_0x1cd4e3){_0x3d62e8['push'](_0x3d62e8['shift']());}};_0x37c701(++_0x4d13a9);}(_0xe970,0xc9));var _0x0e97=function(_0x3edfbb,_0x20558d){_0x3edfbb=_0x3edfbb-0x0;var _0x19d7bd=_0xe970[_0x3edfbb];return _0x19d7bd;};'use strict';var Sequelize=require('sequelize');module[_0x0e97('0x0')]={'body':{'type':Sequelize[_0x0e97('0x1')](_0x0e97('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0e97('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x0e97('0x4')),'defaultValue':_0x0e97('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x0e97('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x0e97('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x0e97('0x5')]},'providerResponse':{'type':Sequelize[_0x0e97('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index d9140c2..816c2b1 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 _0xaea0=['send','WhatsappMessage','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','../../config/logger','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','whatsapp-interactions','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','jayson/promise','client','http','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','sendStatus','status','json','undefined','limit','offset','count','set','apply','reject','save','update','destroy','end','stack','name'];(function(_0x1e8c12,_0x5a31e7){var _0x289917=function(_0x486f72){while(--_0x486f72){_0x1e8c12['push'](_0x1e8c12['shift']());}};_0x289917(++_0x5a31e7);}(_0xaea0,0x165));var _0x0aea=function(_0x316c42,_0x3391f0){_0x316c42=_0x316c42-0x0;var _0x2b38f7=_0xaea0[_0x316c42];return _0x2b38f7;};'use strict';var emlformat=require(_0x0aea('0x0'));var rimraf=require(_0x0aea('0x1'));var zipdir=require(_0x0aea('0x2'));var jsonpatch=require(_0x0aea('0x3'));var rp=require(_0x0aea('0x4'));var moment=require('moment');var BPromise=require(_0x0aea('0x5'));var Mustache=require(_0x0aea('0x6'));var util=require(_0x0aea('0x7'));var path=require('path');var sox=require(_0x0aea('0x8'));var csv=require('to-csv');var ejs=require(_0x0aea('0x9'));var fs=require('fs');var fs_extra=require(_0x0aea('0xa'));var _=require(_0x0aea('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0aea('0xc'));var querystring=require(_0x0aea('0xd'));var Papa=require(_0x0aea('0xe'));var Redis=require(_0x0aea('0xf'));var authService=require(_0x0aea('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0aea('0x11'));var hardwareService=require(_0x0aea('0x12'));var logger=require('../../config/logger')(_0x0aea('0x13'));var utils=require(_0x0aea('0x14'));var config=require(_0x0aea('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0aea('0x16'))['db'];config['redis']=_['defaults'](config[_0x0aea('0x17')],{'host':_0x0aea('0x18'),'port':0x18eb});var socket=require(_0x0aea('0x19'))(new Redis(config[_0x0aea('0x17')]));require('./whatsappMessage.socket')['register'](socket);var jayson=require(_0x0aea('0x1a'));var client=jayson[_0x0aea('0x1b')][_0x0aea('0x1c')]({'port':0x232c});var client9002=jayson[_0x0aea('0x1b')][_0x0aea('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x75cac3,_0x51372e,_0x2a4c82,_0x2bc986){return new BPromise(function(_0x1684bc,_0x5412b1){var _0x2e3915=_0x2bc986||client;return _0x2e3915['request'](_0x75cac3,_0x2a4c82)[_0x0aea('0x1d')](function(_0x590e01){logger[_0x0aea('0x1e')](_0x0aea('0x1f'),_0x51372e,'request\x20sent');logger[_0x0aea('0x20')](_0x0aea('0x21'),_0x51372e,_0x0aea('0x22'),JSON['stringify'](_0x590e01));if(_0x590e01[_0x0aea('0x23')]){if(_0x590e01[_0x0aea('0x23')]['code']===0x1f4){logger[_0x0aea('0x23')](_0x0aea('0x1f'),_0x51372e,_0x590e01[_0x0aea('0x23')]['message']);return _0x5412b1(_0x590e01[_0x0aea('0x23')][_0x0aea('0x24')]);}logger['error'](_0x0aea('0x1f'),_0x51372e,_0x590e01[_0x0aea('0x23')][_0x0aea('0x24')]);return _0x1684bc(_0x590e01[_0x0aea('0x23')]['message']);}else{logger[_0x0aea('0x1e')](_0x0aea('0x1f'),_0x51372e,'request\x20sent');_0x1684bc(_0x590e01[_0x0aea('0x25')][_0x0aea('0x24')]);}})['catch'](function(_0x4c2902){logger[_0x0aea('0x23')](_0x0aea('0x1f'),_0x51372e,_0x4c2902);_0x5412b1(_0x4c2902);});});}function respondWithStatusCode(_0x3dae13,_0x2a0b6a){_0x2a0b6a=_0x2a0b6a||0xcc;return function(_0x46cece){if(_0x46cece){return _0x3dae13[_0x0aea('0x26')](_0x2a0b6a);}return _0x3dae13[_0x0aea('0x27')](_0x2a0b6a)['end']();};}function respondWithResult(_0x4e181f,_0x282019){_0x282019=_0x282019||0xc8;return function(_0x34b252){if(_0x34b252){return _0x4e181f['status'](_0x282019)[_0x0aea('0x28')](_0x34b252);}};}function respondWithFilteredResult(_0x2597e8,_0x55ec88){return function(_0x155467){if(_0x155467){var _0x55ef2f=typeof _0x55ec88['offset']===_0x0aea('0x29')&&typeof _0x55ec88[_0x0aea('0x2a')]===_0x0aea('0x29');var _0x5590a1=_0x155467['count'];var _0x52d611=_0x55ef2f?0x0:_0x55ec88[_0x0aea('0x2b')];var _0x899e36=_0x55ef2f?_0x155467[_0x0aea('0x2c')]:_0x55ec88[_0x0aea('0x2b')]+_0x55ec88[_0x0aea('0x2a')];var _0x25fd40;if(_0x899e36>=_0x5590a1){_0x899e36=_0x5590a1;_0x25fd40=0xc8;}else{_0x25fd40=0xce;}_0x2597e8[_0x0aea('0x27')](_0x25fd40);return _0x2597e8[_0x0aea('0x2d')]('Content-Range',_0x52d611+'-'+_0x899e36+'/'+_0x5590a1)['json'](_0x155467);}return null;};}function patchUpdates(_0x435153){return function(_0x234101){try{jsonpatch[_0x0aea('0x2e')](_0x234101,_0x435153,!![]);}catch(_0x3f5286){return BPromise[_0x0aea('0x2f')](_0x3f5286);}return _0x234101[_0x0aea('0x30')]();};}function saveUpdates(_0x47c4f6,_0x5139e0){return function(_0x3e0544){if(_0x3e0544){return _0x3e0544[_0x0aea('0x31')](_0x47c4f6)['then'](function(_0x156d30){return _0x156d30;});}return null;};}function removeEntity(_0x576cc9,_0x590238){return function(_0x3ebc3f){if(_0x3ebc3f){return _0x3ebc3f[_0x0aea('0x32')]()[_0x0aea('0x1d')](function(){_0x576cc9[_0x0aea('0x27')](0xcc)[_0x0aea('0x33')]();});}};}function handleEntityNotFound(_0x5df7e7,_0x501cee){return function(_0x2c95bc){if(!_0x2c95bc){_0x5df7e7[_0x0aea('0x26')](0x194);}return _0x2c95bc;};}function handleError(_0x40006a,_0x18c367){_0x18c367=_0x18c367||0x1f4;return function(_0x3d6b93){logger['error'](_0x3d6b93[_0x0aea('0x34')]);if(_0x3d6b93[_0x0aea('0x35')]){delete _0x3d6b93['name'];}_0x40006a[_0x0aea('0x27')](_0x18c367)[_0x0aea('0x36')](_0x3d6b93);};}exports['index']=function(_0xb1dfdc,_0x159d37){var _0x451f3a={},_0x3d0951={},_0x1b3520={'count':0x0,'rows':[]};var _0x43cb6a=_['map'](db[_0x0aea('0x37')][_0x0aea('0x38')],function(_0x72d5ce){return{'name':_0x72d5ce[_0x0aea('0x39')],'type':_0x72d5ce[_0x0aea('0x3a')][_0x0aea('0x3b')]};});_0x3d0951[_0x0aea('0x3c')]=_[_0x0aea('0x3d')](_0x43cb6a,_0x0aea('0x35'));_0x3d0951['query']=_[_0x0aea('0x3e')](_0xb1dfdc[_0x0aea('0x3f')]);_0x3d0951[_0x0aea('0x40')]=_[_0x0aea('0x41')](_0x3d0951['model'],_0x3d0951['query']);_0x451f3a[_0x0aea('0x42')]=_[_0x0aea('0x41')](_0x3d0951[_0x0aea('0x3c')],qs[_0x0aea('0x43')](_0xb1dfdc['query']['fields']));_0x451f3a[_0x0aea('0x42')]=_0x451f3a[_0x0aea('0x42')][_0x0aea('0x44')]?_0x451f3a[_0x0aea('0x42')]:_0x3d0951['model'];if(!_0xb1dfdc[_0x0aea('0x3f')][_0x0aea('0x45')](_0x0aea('0x46'))){_0x451f3a['limit']=qs['limit'](_0xb1dfdc[_0x0aea('0x3f')][_0x0aea('0x2a')]);_0x451f3a[_0x0aea('0x2b')]=qs[_0x0aea('0x2b')](_0xb1dfdc['query'][_0x0aea('0x2b')]);}_0x451f3a['order']=qs['sort'](_0xb1dfdc[_0x0aea('0x3f')]['sort']);_0x451f3a['where']=qs['filters'](_[_0x0aea('0x47')](_0xb1dfdc['query'],_0x3d0951['filters']),_0x43cb6a);if(_0xb1dfdc['query'][_0x0aea('0x48')]){_0x451f3a[_0x0aea('0x49')]=_[_0x0aea('0x4a')](_0x451f3a[_0x0aea('0x49')],{'$or':_['map'](_0x43cb6a,function(_0x400471){if(_0x400471[_0x0aea('0x3a')]!==_0x0aea('0x4b')){var _0x633a2f={};_0x633a2f[_0x400471[_0x0aea('0x35')]]={'$like':'%'+_0xb1dfdc['query'][_0x0aea('0x48')]+'%'};return _0x633a2f;}})});}_0x451f3a=_[_0x0aea('0x4a')]({},_0x451f3a,_0xb1dfdc[_0x0aea('0x4c')]);var _0x22954b={'where':_0x451f3a[_0x0aea('0x49')]};return db[_0x0aea('0x37')]['count'](_0x22954b)['then'](function(_0x504b85){_0x1b3520[_0x0aea('0x2c')]=_0x504b85;if(_0xb1dfdc['query'][_0x0aea('0x4d')]){_0x451f3a[_0x0aea('0x4e')]=[{'all':!![]}];}return db[_0x0aea('0x37')][_0x0aea('0x4f')](_0x451f3a);})[_0x0aea('0x1d')](function(_0x3b2e72){_0x1b3520[_0x0aea('0x50')]=_0x3b2e72;return _0x1b3520;})[_0x0aea('0x1d')](respondWithFilteredResult(_0x159d37,_0x451f3a))['catch'](handleError(_0x159d37,null));};exports[_0x0aea('0x51')]=function(_0x4cbeb3,_0x3cf957){var _0x3aa5c7={'raw':!![],'where':{'id':_0x4cbeb3[_0x0aea('0x52')]['id']}},_0x2b20ee={};_0x2b20ee['model']=_[_0x0aea('0x3e')](db[_0x0aea('0x37')]['rawAttributes']);_0x2b20ee[_0x0aea('0x3f')]=_['keys'](_0x4cbeb3['query']);_0x2b20ee[_0x0aea('0x40')]=_[_0x0aea('0x41')](_0x2b20ee[_0x0aea('0x3c')],_0x2b20ee['query']);_0x3aa5c7[_0x0aea('0x42')]=_[_0x0aea('0x41')](_0x2b20ee['model'],qs[_0x0aea('0x43')](_0x4cbeb3['query']['fields']));_0x3aa5c7[_0x0aea('0x42')]=_0x3aa5c7[_0x0aea('0x42')][_0x0aea('0x44')]?_0x3aa5c7[_0x0aea('0x42')]:_0x2b20ee['model'];if(_0x4cbeb3['query']['includeAll']){_0x3aa5c7[_0x0aea('0x4e')]=[{'all':!![]}];}_0x3aa5c7=_[_0x0aea('0x4a')]({},_0x3aa5c7,_0x4cbeb3[_0x0aea('0x4c')]);return db[_0x0aea('0x37')][_0x0aea('0x53')](_0x3aa5c7)[_0x0aea('0x1d')](handleEntityNotFound(_0x3cf957,null))[_0x0aea('0x1d')](respondWithResult(_0x3cf957,null))[_0x0aea('0x54')](handleError(_0x3cf957,null));};exports['create']=function(_0x1a25ef,_0x1f9a37){return db['WhatsappMessage'][_0x0aea('0x55')](_0x1a25ef[_0x0aea('0x56')],{})[_0x0aea('0x1d')](respondWithResult(_0x1f9a37,0xc9))[_0x0aea('0x54')](handleError(_0x1f9a37,null));};exports['update']=function(_0x1d41de,_0x1fb1f7){if(_0x1d41de[_0x0aea('0x56')]['id']){delete _0x1d41de[_0x0aea('0x56')]['id'];}return db[_0x0aea('0x37')][_0x0aea('0x53')]({'where':{'id':_0x1d41de[_0x0aea('0x52')]['id']}})[_0x0aea('0x1d')](handleEntityNotFound(_0x1fb1f7,null))['then'](saveUpdates(_0x1d41de[_0x0aea('0x56')],null))[_0x0aea('0x1d')](respondWithResult(_0x1fb1f7,null))[_0x0aea('0x54')](handleError(_0x1fb1f7,null));};exports[_0x0aea('0x32')]=function(_0x243208,_0x5ee51c){return db[_0x0aea('0x37')][_0x0aea('0x53')]({'where':{'id':_0x243208[_0x0aea('0x52')]['id']}})['then'](handleEntityNotFound(_0x5ee51c,null))[_0x0aea('0x1d')](removeEntity(_0x5ee51c,null))['catch'](handleError(_0x5ee51c,null));};exports[_0x0aea('0x57')]=function(_0x579ecc,_0x52f1d1){return db[_0x0aea('0x37')][_0x0aea('0x57')]()[_0x0aea('0x1d')](respondWithResult(_0x52f1d1,null))['catch'](handleError(_0x52f1d1,null));};var interaction_log=require(_0x0aea('0x58'))('whatsapp-interactions');exports['accept']=function(_0x36edfb,_0x1344d3,_0x410102){var _0x5e9249={'agent':{},'channel':_0x0aea('0x59')};if(_0x36edfb[_0x0aea('0x56')]['id']){delete _0x36edfb[_0x0aea('0x56')]['id'];}_0x36edfb['body'][_0x0aea('0x5a')]=!![];_0x36edfb[_0x0aea('0x56')]['readAt']=moment()[_0x0aea('0x5b')](_0x0aea('0x5c'));_0x36edfb[_0x0aea('0x56')][_0x0aea('0x5d')]=_0x36edfb['body'][_0x0aea('0x5d')]||_0x36edfb[_0x0aea('0x5e')]['id'];_0x5e9249[_0x0aea('0x5f')]['id']=_0x36edfb[_0x0aea('0x56')]['UserId'];return db['WhatsappMessage']['find']({'where':{'id':_0x36edfb[_0x0aea('0x52')]['id'],'UserId':null}})[_0x0aea('0x1d')](handleEntityNotFound(_0x1344d3,null))[_0x0aea('0x1d')](saveUpdates(_0x36edfb[_0x0aea('0x56')],null))[_0x0aea('0x1d')](function(_0x53ebe2){if(_0x53ebe2){_0x5e9249[_0x0aea('0x24')]=_0x53ebe2[_0x0aea('0x60')]({'plain':!![]});return db[_0x0aea('0x61')][_0x0aea('0x53')]({'where':{'id':_0x53ebe2[_0x0aea('0x62')]}});}return null;})[_0x0aea('0x1d')](handleEntityNotFound(_0x1344d3,null))[_0x0aea('0x1d')](function(_0x5b7c0b){if(_0x5b7c0b){return _0x5b7c0b['update']({'UserId':_0x36edfb['body'][_0x0aea('0x5d')],'read1stAt':_['isNil'](_0x5b7c0b['read1stAt'])?moment()[_0x0aea('0x5b')](_0x0aea('0x5c')):undefined});}return null;})[_0x0aea('0x1d')](function(_0x3be821){if(_0x3be821){_0x5e9249[_0x0aea('0x63')]=_0x3be821[_0x0aea('0x60')]({'plain':!![]});interaction_log[_0x0aea('0x1e')](_0x0aea('0x64'),_0x36edfb[_0x0aea('0x5e')]['id'],_0x36edfb[_0x0aea('0x5e')][_0x0aea('0x35')],_0x36edfb['user'][_0x0aea('0x65')],_0x5e9249['interaction']['id'],_0x36edfb[_0x0aea('0x56')]?JSON[_0x0aea('0x66')](_0x36edfb['body']):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x5e9249);}return null;})[_0x0aea('0x1d')](function(_0x28dd83){var _0x536bd0='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x28dd83['message'][_0x0aea('0x67')];return db[_0x0aea('0x68')][_0x0aea('0x3f')](_0x536bd0,{'type':db[_0x0aea('0x69')]['QueryTypes'][_0x0aea('0x6a')],'raw':!![]})[_0x0aea('0x1d')](function(_0x23f8d2){return _0x23f8d2;});})[_0x0aea('0x1d')](function(_0x48976b){if(_0x48976b){_0x5e9249[_0x0aea('0x24')][_0x0aea('0x6b')]=_0x48976b[0x0];if(!_0x36edfb[_0x0aea('0x56')]['UserId'])return;return db[_0x0aea('0x6c')][_0x0aea('0x53')]({'where':{'id':_0x36edfb[_0x0aea('0x56')][_0x0aea('0x5d')],'role':_0x0aea('0x5f')},'attributes':['id',_0x0aea('0x35'),_0x0aea('0x6d'),_0x0aea('0x6e'),_0x0aea('0x6f')],'raw':!![]});}return null;})[_0x0aea('0x1d')](function(_0x161d34){if(!_0x161d34)return null;_0x5e9249[_0x0aea('0x24')][_0x0aea('0x5f')]=_0x161d34;return _0x5e9249;})[_0x0aea('0x1d')](function(_0x1ac7e3){if(_0x1ac7e3){if(_0x36edfb[_0x0aea('0x56')][_0x0aea('0x70')]){_0x5e9249[_0x0aea('0x24')][_0x0aea('0x71')]=util[_0x0aea('0x5b')](_0x0aea('0x72'),_0x36edfb[_0x0aea('0x5e')][_0x0aea('0x35')]);_0x5e9249[_0x0aea('0x24')]['channel']=_0x5e9249[_0x0aea('0x73')];_0x5e9249[_0x0aea('0x24')][_0x0aea('0x74')]=_0x5e9249[_0x0aea('0x73')];_0x5e9249[_0x0aea('0x24')][_0x0aea('0x75')]=_0x0aea('0x76');return respondWithRpcPromise('EventManager',_0x0aea('0x77'),{'event':_0x0aea('0x78'),'message':_0x5e9249[_0x0aea('0x24')]},client9002)['then'](function(){return _0x5e9249;});}return _0x5e9249;}return null;})[_0x0aea('0x1d')](respondWithResult(_0x1344d3,null))['catch'](handleError(_0x1344d3,null));};var interaction_log=require(_0x0aea('0x58'))(_0x0aea('0x79'));exports[_0x0aea('0x2f')]=function(_0x3348ae,_0x92cadf,_0x4234d3){var _0x627a92={'agent':{},'channel':_0x0aea('0x59')};if(_0x3348ae[_0x0aea('0x56')]['id']){delete _0x3348ae[_0x0aea('0x56')]['id'];}_0x3348ae[_0x0aea('0x56')][_0x0aea('0x5d')]=_0x3348ae[_0x0aea('0x56')][_0x0aea('0x5d')]||_0x3348ae['user']['id'];_0x627a92[_0x0aea('0x5f')]['id']=_0x3348ae['body'][_0x0aea('0x5d')];return db[_0x0aea('0x37')][_0x0aea('0x53')]({'where':{'id':_0x3348ae['params']['id'],'UserId':null}})[_0x0aea('0x1d')](handleEntityNotFound(_0x92cadf,null))['then'](function(_0x4e92dd){if(_0x4e92dd){_0x627a92[_0x0aea('0x24')]=_0x4e92dd[_0x0aea('0x60')]({'plain':!![]});return db[_0x0aea('0x61')][_0x0aea('0x53')]({'where':{'id':_0x4e92dd[_0x0aea('0x62')]}});}return null;})[_0x0aea('0x1d')](handleEntityNotFound(_0x92cadf,null))['then'](function(_0x2cd01e){if(_0x2cd01e){_0x627a92[_0x0aea('0x63')]=_0x2cd01e['get']({'plain':!![]});interaction_log['info'](_0x0aea('0x7a'),_0x3348ae[_0x0aea('0x5e')]['id'],_0x3348ae['user'][_0x0aea('0x35')],_0x3348ae['user']['role'],_0x627a92[_0x0aea('0x63')]['id'],_0x3348ae[_0x0aea('0x56')]?JSON[_0x0aea('0x66')](_0x3348ae[_0x0aea('0x56')]):'null');return respondWithRpcPromise(_0x0aea('0x7b'),_0x0aea('0x7c'),_0x627a92);}return null;})[_0x0aea('0x1d')](function(_0x364075){var _0x3bdaca=_0x0aea('0x7d')+_0x364075['message']['ContactId'];return db[_0x0aea('0x68')][_0x0aea('0x3f')](_0x3bdaca,{'type':db['Sequelize'][_0x0aea('0x7e')][_0x0aea('0x6a')],'raw':!![]})[_0x0aea('0x1d')](function(_0x129a95){return _0x129a95;});})['then'](function(_0x5a2e83){if(_0x5a2e83){_0x627a92[_0x0aea('0x24')][_0x0aea('0x6b')]=_0x5a2e83[0x0];if(!_0x3348ae[_0x0aea('0x56')]['UserId'])return;return db[_0x0aea('0x6c')][_0x0aea('0x53')]({'where':{'id':_0x3348ae[_0x0aea('0x56')][_0x0aea('0x5d')],'role':_0x0aea('0x5f')},'attributes':['id','name','fullname',_0x0aea('0x6e'),_0x0aea('0x6f')],'raw':!![]});}return null;})['then'](function(_0x16dca2){if(!_0x16dca2)return null;_0x627a92[_0x0aea('0x24')][_0x0aea('0x5f')]=_0x16dca2;return _0x627a92;})['then'](function(_0x3cd3d1){if(_0x3cd3d1){_0x3cd3d1[_0x0aea('0x24')]['interface']=util['format'](_0x0aea('0x72'),_0x3348ae[_0x0aea('0x5e')]['name']);_0x3cd3d1[_0x0aea('0x24')][_0x0aea('0x73')]=_0x627a92['channel'];_0x3cd3d1[_0x0aea('0x24')][_0x0aea('0x74')]=_0x627a92[_0x0aea('0x73')];_0x3cd3d1[_0x0aea('0x24')][_0x0aea('0x75')]=_0x0aea('0x2f');respondWithRpcPromise(_0x0aea('0x77'),'EventManager',{'event':_0x0aea('0x7f'),'message':_0x3cd3d1[_0x0aea('0x24')]},client9002);return _0x627a92;}return null;})[_0x0aea('0x1d')](respondWithResult(_0x92cadf,null))[_0x0aea('0x54')](handleError(_0x92cadf,null));};exports[_0x0aea('0x27')]=function(_0x152c61,_0x533e83,_0x1b38c3){if(_0x152c61[_0x0aea('0x56')]['id']){delete _0x152c61[_0x0aea('0x56')]['id'];}var _0x375e0c;return db['WhatsappMessage'][_0x0aea('0x53')]({'where':{'id':_0x152c61['params']['id']}})['then'](handleEntityNotFound(_0x533e83,null))[_0x0aea('0x1d')](function(_0x2668e5){if(_0x2668e5){_0x375e0c=_0x2668e5;return db[_0x0aea('0x80')][_0x0aea('0x53')]({'where':{'id':_0x2668e5[_0x0aea('0x81')]}});}})[_0x0aea('0x1d')](handleEntityNotFound(_0x533e83,null))['then'](function(_0xf39723){if(_0xf39723){logger['debug'](_0x0aea('0x82'),'status',_0x0aea('0x83'),_0xf39723[_0x0aea('0x3a')],util[_0x0aea('0x84')](_0x152c61['body'],{'showHidden':![],'depth':null}));switch(_0xf39723[_0x0aea('0x3a')]){case _0x0aea('0x85'):if(_0x152c61['body']['MessageSid']&&_0x152c61[_0x0aea('0x56')][_0x0aea('0x86')]===_0x375e0c[_0x0aea('0x87')]&&_0x152c61[_0x0aea('0x56')]['MessageStatus']&&_0x152c61[_0x0aea('0x56')]['MessageStatus']===_0x0aea('0x5a')){return _0x375e0c[_0x0aea('0x31')]({'read':!![]});}else{logger['error'](_0x0aea('0x88'),_0x0aea('0x27'),_0x0aea('0x85'),util['inspect'](_0x152c61['body'],{'showHidden':![],'depth':null}));}break;}return _0x375e0c;}})[_0x0aea('0x1d')](respondWithResult(_0x533e83,null))[_0x0aea('0x54')](handleError(_0x533e83,null));}; \ No newline at end of file +var _0xe827=['options','includeAll','findAll','rows','show','params','include','find','create','body','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteraction','WhatsappInteractionId','update','isNil','read1stAt','role','interaction','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','fullname','email','agent','manual','interface','channel','event','EventManager','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','QueryTypes','User','SIP/%s','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','client','http','request','then','info','request\x20sent','error','code','WhatsappMessage,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','destroy','stack','name','send','index','map','WhatsappMessage','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xe827,0x1dd));var _0x7e82=function(_0x52e3da,_0x5352b2){_0x52e3da=_0x52e3da-0x0;var _0x3fa7f0=_0xe827[_0x52e3da];return _0x3fa7f0;};'use strict';var emlformat=require(_0x7e82('0x0'));var rimraf=require(_0x7e82('0x1'));var zipdir=require(_0x7e82('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7e82('0x3'));var moment=require(_0x7e82('0x4'));var BPromise=require(_0x7e82('0x5'));var Mustache=require(_0x7e82('0x6'));var util=require(_0x7e82('0x7'));var path=require(_0x7e82('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7e82('0x9'));var fs=require('fs');var fs_extra=require(_0x7e82('0xa'));var _=require(_0x7e82('0xb'));var squel=require(_0x7e82('0xc'));var crypto=require('crypto');var jsforce=require(_0x7e82('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7e82('0xe'));var querystring=require(_0x7e82('0xf'));var Papa=require(_0x7e82('0x10'));var Redis=require('ioredis');var authService=require(_0x7e82('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7e82('0x12'));var hardwareService=require(_0x7e82('0x13'));var logger=require(_0x7e82('0x14'))(_0x7e82('0x15'));var utils=require(_0x7e82('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7e82('0x17'));var db=require(_0x7e82('0x18'))['db'];config['redis']=_['defaults'](config[_0x7e82('0x19')],{'host':_0x7e82('0x1a'),'port':0x18eb});var socket=require(_0x7e82('0x1b'))(new Redis(config[_0x7e82('0x19')]));require(_0x7e82('0x1c'))[_0x7e82('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7e82('0x1e')][_0x7e82('0x1f')]({'port':0x232c});var client9002=jayson[_0x7e82('0x1e')][_0x7e82('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5f56f9,_0x85305c,_0x6e70c2,_0x5d6b65){return new BPromise(function(_0x261189,_0x40391d){var _0x702b70=_0x5d6b65||client;return _0x702b70[_0x7e82('0x20')](_0x5f56f9,_0x6e70c2)[_0x7e82('0x21')](function(_0x153967){logger[_0x7e82('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x85305c,_0x7e82('0x23'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x85305c,'request\x20sent',JSON['stringify'](_0x153967));if(_0x153967[_0x7e82('0x24')]){if(_0x153967[_0x7e82('0x24')][_0x7e82('0x25')]===0x1f4){logger[_0x7e82('0x24')](_0x7e82('0x26'),_0x85305c,_0x153967['error'][_0x7e82('0x27')]);return _0x40391d(_0x153967['error'][_0x7e82('0x27')]);}logger[_0x7e82('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x85305c,_0x153967['error'][_0x7e82('0x27')]);return _0x261189(_0x153967[_0x7e82('0x24')]['message']);}else{logger['info'](_0x7e82('0x26'),_0x85305c,_0x7e82('0x23'));_0x261189(_0x153967['result'][_0x7e82('0x27')]);}})[_0x7e82('0x28')](function(_0x3c5feb){logger['error'](_0x7e82('0x26'),_0x85305c,_0x3c5feb);_0x40391d(_0x3c5feb);});});}function respondWithStatusCode(_0x43d249,_0x2a0319){_0x2a0319=_0x2a0319||0xcc;return function(_0x5e891f){if(_0x5e891f){return _0x43d249[_0x7e82('0x29')](_0x2a0319);}return _0x43d249[_0x7e82('0x2a')](_0x2a0319)[_0x7e82('0x2b')]();};}function respondWithResult(_0x697b,_0x50c766){_0x50c766=_0x50c766||0xc8;return function(_0x42979d){if(_0x42979d){return _0x697b[_0x7e82('0x2a')](_0x50c766)[_0x7e82('0x2c')](_0x42979d);}};}function respondWithFilteredResult(_0x57cb48,_0x43fde5){return function(_0x58622d){if(_0x58622d){var _0x3d9f67=typeof _0x43fde5['offset']==='undefined'&&typeof _0x43fde5[_0x7e82('0x2d')]===_0x7e82('0x2e');var _0x470e55=_0x58622d[_0x7e82('0x2f')];var _0x3ba9d=_0x3d9f67?0x0:_0x43fde5['offset'];var _0x148684=_0x3d9f67?_0x58622d[_0x7e82('0x2f')]:_0x43fde5[_0x7e82('0x30')]+_0x43fde5[_0x7e82('0x2d')];var _0x429355;if(_0x148684>=_0x470e55){_0x148684=_0x470e55;_0x429355=0xc8;}else{_0x429355=0xce;}_0x57cb48['status'](_0x429355);return _0x57cb48[_0x7e82('0x31')](_0x7e82('0x32'),_0x3ba9d+'-'+_0x148684+'/'+_0x470e55)[_0x7e82('0x2c')](_0x58622d);}return null;};}function patchUpdates(_0x522300){return function(_0x1d78c3){try{jsonpatch['apply'](_0x1d78c3,_0x522300,!![]);}catch(_0x296e4b){return BPromise[_0x7e82('0x33')](_0x296e4b);}return _0x1d78c3[_0x7e82('0x34')]();};}function saveUpdates(_0x4aa111,_0x48ca2f){return function(_0x2d34ee){if(_0x2d34ee){return _0x2d34ee['update'](_0x4aa111)[_0x7e82('0x21')](function(_0x43284d){return _0x43284d;});}return null;};}function removeEntity(_0x5d72d4,_0x443d12){return function(_0x228a4c){if(_0x228a4c){return _0x228a4c[_0x7e82('0x35')]()[_0x7e82('0x21')](function(){_0x5d72d4[_0x7e82('0x2a')](0xcc)[_0x7e82('0x2b')]();});}};}function handleEntityNotFound(_0x2f784b,_0x208d89){return function(_0x351082){if(!_0x351082){_0x2f784b[_0x7e82('0x29')](0x194);}return _0x351082;};}function handleError(_0x58a2ce,_0x1a5554){_0x1a5554=_0x1a5554||0x1f4;return function(_0x589e28){logger[_0x7e82('0x24')](_0x589e28[_0x7e82('0x36')]);if(_0x589e28[_0x7e82('0x37')]){delete _0x589e28[_0x7e82('0x37')];}_0x58a2ce[_0x7e82('0x2a')](_0x1a5554)[_0x7e82('0x38')](_0x589e28);};}exports[_0x7e82('0x39')]=function(_0x213f77,_0x1ef24c){var _0x3b3977={},_0x21a1fd={},_0x3cef51={'count':0x0,'rows':[]};var _0x474b0e=_[_0x7e82('0x3a')](db[_0x7e82('0x3b')]['rawAttributes'],function(_0x1c97df){return{'name':_0x1c97df['fieldName'],'type':_0x1c97df['type'][_0x7e82('0x3c')]};});_0x21a1fd[_0x7e82('0x3d')]=_['map'](_0x474b0e,_0x7e82('0x37'));_0x21a1fd[_0x7e82('0x3e')]=_[_0x7e82('0x3f')](_0x213f77[_0x7e82('0x3e')]);_0x21a1fd[_0x7e82('0x40')]=_[_0x7e82('0x41')](_0x21a1fd[_0x7e82('0x3d')],_0x21a1fd[_0x7e82('0x3e')]);_0x3b3977[_0x7e82('0x42')]=_[_0x7e82('0x41')](_0x21a1fd['model'],qs['fields'](_0x213f77[_0x7e82('0x3e')][_0x7e82('0x43')]));_0x3b3977[_0x7e82('0x42')]=_0x3b3977['attributes'][_0x7e82('0x44')]?_0x3b3977[_0x7e82('0x42')]:_0x21a1fd[_0x7e82('0x3d')];if(!_0x213f77[_0x7e82('0x3e')][_0x7e82('0x45')](_0x7e82('0x46'))){_0x3b3977[_0x7e82('0x2d')]=qs[_0x7e82('0x2d')](_0x213f77[_0x7e82('0x3e')][_0x7e82('0x2d')]);_0x3b3977['offset']=qs[_0x7e82('0x30')](_0x213f77[_0x7e82('0x3e')]['offset']);}_0x3b3977[_0x7e82('0x47')]=qs[_0x7e82('0x48')](_0x213f77['query'][_0x7e82('0x48')]);_0x3b3977[_0x7e82('0x49')]=qs[_0x7e82('0x40')](_[_0x7e82('0x4a')](_0x213f77[_0x7e82('0x3e')],_0x21a1fd[_0x7e82('0x40')]),_0x474b0e);if(_0x213f77[_0x7e82('0x3e')][_0x7e82('0x4b')]){_0x3b3977[_0x7e82('0x49')]=_[_0x7e82('0x4c')](_0x3b3977['where'],{'$or':_['map'](_0x474b0e,function(_0xedafae){if(_0xedafae[_0x7e82('0x4d')]!==_0x7e82('0x4e')){var _0x53e496={};_0x53e496[_0xedafae[_0x7e82('0x37')]]={'$like':'%'+_0x213f77[_0x7e82('0x3e')]['filter']+'%'};return _0x53e496;}})});}_0x3b3977=_[_0x7e82('0x4c')]({},_0x3b3977,_0x213f77[_0x7e82('0x4f')]);var _0x26e914={'where':_0x3b3977[_0x7e82('0x49')]};return db['WhatsappMessage'][_0x7e82('0x2f')](_0x26e914)[_0x7e82('0x21')](function(_0x63d0fa){_0x3cef51[_0x7e82('0x2f')]=_0x63d0fa;if(_0x213f77[_0x7e82('0x3e')][_0x7e82('0x50')]){_0x3b3977['include']=[{'all':!![]}];}return db[_0x7e82('0x3b')][_0x7e82('0x51')](_0x3b3977);})[_0x7e82('0x21')](function(_0x44b01e){_0x3cef51[_0x7e82('0x52')]=_0x44b01e;return _0x3cef51;})['then'](respondWithFilteredResult(_0x1ef24c,_0x3b3977))[_0x7e82('0x28')](handleError(_0x1ef24c,null));};exports[_0x7e82('0x53')]=function(_0x45695d,_0x2ef2e4){var _0x3f02be={'raw':!![],'where':{'id':_0x45695d[_0x7e82('0x54')]['id']}},_0x4c5acc={};_0x4c5acc['model']=_[_0x7e82('0x3f')](db['WhatsappMessage']['rawAttributes']);_0x4c5acc['query']=_[_0x7e82('0x3f')](_0x45695d[_0x7e82('0x3e')]);_0x4c5acc[_0x7e82('0x40')]=_['intersection'](_0x4c5acc['model'],_0x4c5acc['query']);_0x3f02be[_0x7e82('0x42')]=_[_0x7e82('0x41')](_0x4c5acc[_0x7e82('0x3d')],qs[_0x7e82('0x43')](_0x45695d[_0x7e82('0x3e')][_0x7e82('0x43')]));_0x3f02be[_0x7e82('0x42')]=_0x3f02be[_0x7e82('0x42')][_0x7e82('0x44')]?_0x3f02be['attributes']:_0x4c5acc[_0x7e82('0x3d')];if(_0x45695d[_0x7e82('0x3e')]['includeAll']){_0x3f02be[_0x7e82('0x55')]=[{'all':!![]}];}_0x3f02be=_['merge']({},_0x3f02be,_0x45695d[_0x7e82('0x4f')]);return db[_0x7e82('0x3b')][_0x7e82('0x56')](_0x3f02be)[_0x7e82('0x21')](handleEntityNotFound(_0x2ef2e4,null))[_0x7e82('0x21')](respondWithResult(_0x2ef2e4,null))['catch'](handleError(_0x2ef2e4,null));};exports[_0x7e82('0x57')]=function(_0x3cf8fd,_0x4ef5a7){return db[_0x7e82('0x3b')][_0x7e82('0x57')](_0x3cf8fd[_0x7e82('0x58')],{})[_0x7e82('0x21')](respondWithResult(_0x4ef5a7,0xc9))[_0x7e82('0x28')](handleError(_0x4ef5a7,null));};exports['update']=function(_0x22b8d5,_0x35da02){if(_0x22b8d5[_0x7e82('0x58')]['id']){delete _0x22b8d5[_0x7e82('0x58')]['id'];}return db[_0x7e82('0x3b')][_0x7e82('0x56')]({'where':{'id':_0x22b8d5[_0x7e82('0x54')]['id']}})[_0x7e82('0x21')](handleEntityNotFound(_0x35da02,null))[_0x7e82('0x21')](saveUpdates(_0x22b8d5[_0x7e82('0x58')],null))[_0x7e82('0x21')](respondWithResult(_0x35da02,null))[_0x7e82('0x28')](handleError(_0x35da02,null));};exports['destroy']=function(_0x81e28,_0x3cfbb2){return db[_0x7e82('0x3b')][_0x7e82('0x56')]({'where':{'id':_0x81e28['params']['id']}})[_0x7e82('0x21')](handleEntityNotFound(_0x3cfbb2,null))[_0x7e82('0x21')](removeEntity(_0x3cfbb2,null))[_0x7e82('0x28')](handleError(_0x3cfbb2,null));};exports[_0x7e82('0x59')]=function(_0x3f8602,_0x3cd1fe){return db[_0x7e82('0x3b')][_0x7e82('0x59')]()['then'](respondWithResult(_0x3cd1fe,null))[_0x7e82('0x28')](handleError(_0x3cd1fe,null));};var interaction_log=require(_0x7e82('0x14'))(_0x7e82('0x5a'));exports[_0x7e82('0x5b')]=function(_0x178bef,_0x4c8752,_0x32f8bd){var _0x2533c1={'agent':{},'channel':_0x7e82('0x5c')};if(_0x178bef[_0x7e82('0x58')]['id']){delete _0x178bef[_0x7e82('0x58')]['id'];}_0x178bef[_0x7e82('0x58')][_0x7e82('0x5d')]=!![];_0x178bef[_0x7e82('0x58')][_0x7e82('0x5e')]=moment()[_0x7e82('0x5f')](_0x7e82('0x60'));_0x178bef['body'][_0x7e82('0x61')]=_0x178bef[_0x7e82('0x58')][_0x7e82('0x61')]||_0x178bef[_0x7e82('0x62')]['id'];_0x2533c1['agent']['id']=_0x178bef['body'][_0x7e82('0x61')];return db['WhatsappMessage'][_0x7e82('0x56')]({'where':{'id':_0x178bef[_0x7e82('0x54')]['id'],'UserId':null}})[_0x7e82('0x21')](handleEntityNotFound(_0x4c8752,null))[_0x7e82('0x21')](saveUpdates(_0x178bef['body'],null))[_0x7e82('0x21')](function(_0x13b93a){if(_0x13b93a){_0x2533c1[_0x7e82('0x27')]=_0x13b93a[_0x7e82('0x63')]({'plain':!![]});return db[_0x7e82('0x64')][_0x7e82('0x56')]({'where':{'id':_0x13b93a[_0x7e82('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x4c8752,null))[_0x7e82('0x21')](function(_0x57c952){if(_0x57c952){return _0x57c952[_0x7e82('0x66')]({'UserId':_0x178bef['body'][_0x7e82('0x61')],'read1stAt':_[_0x7e82('0x67')](_0x57c952[_0x7e82('0x68')])?moment()['format'](_0x7e82('0x60')):undefined});}return null;})[_0x7e82('0x21')](function(_0x2f74fc){if(_0x2f74fc){_0x2533c1['interaction']=_0x2f74fc['get']({'plain':!![]});interaction_log[_0x7e82('0x22')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x178bef[_0x7e82('0x62')]['id'],_0x178bef[_0x7e82('0x62')]['name'],_0x178bef[_0x7e82('0x62')][_0x7e82('0x69')],_0x2533c1[_0x7e82('0x6a')]['id'],_0x178bef[_0x7e82('0x58')]?JSON[_0x7e82('0x6b')](_0x178bef[_0x7e82('0x58')]):_0x7e82('0x6c'));return respondWithRpcPromise(_0x7e82('0x6d'),'acceptMessage',_0x2533c1);}return null;})['then'](function(_0x20dff5){var _0x1e0761=_0x7e82('0x6e')+_0x20dff5['message']['ContactId'];return db[_0x7e82('0x6f')][_0x7e82('0x3e')](_0x1e0761,{'type':db[_0x7e82('0x70')]['QueryTypes'][_0x7e82('0x71')],'raw':!![]})[_0x7e82('0x21')](function(_0x296fde){return _0x296fde;});})['then'](function(_0x48ac46){if(_0x48ac46){_0x2533c1['message'][_0x7e82('0x72')]=_0x48ac46[0x0];if(!_0x178bef['body'][_0x7e82('0x61')])return;return db['User']['find']({'where':{'id':_0x178bef[_0x7e82('0x58')][_0x7e82('0x61')],'role':'agent'},'attributes':['id',_0x7e82('0x37'),_0x7e82('0x73'),_0x7e82('0x74'),'internal'],'raw':!![]});}return null;})[_0x7e82('0x21')](function(_0x560692){if(!_0x560692)return null;_0x2533c1[_0x7e82('0x27')][_0x7e82('0x75')]=_0x560692;return _0x2533c1;})['then'](function(_0x356592){if(_0x356592){if(_0x178bef[_0x7e82('0x58')][_0x7e82('0x76')]){_0x2533c1[_0x7e82('0x27')][_0x7e82('0x77')]=util[_0x7e82('0x5f')]('SIP/%s',_0x178bef[_0x7e82('0x62')][_0x7e82('0x37')]);_0x2533c1[_0x7e82('0x27')][_0x7e82('0x78')]=_0x2533c1[_0x7e82('0x78')];_0x2533c1[_0x7e82('0x27')]['motionChannel']=_0x2533c1[_0x7e82('0x78')];_0x2533c1[_0x7e82('0x27')][_0x7e82('0x79')]=_0x7e82('0x5b');return respondWithRpcPromise(_0x7e82('0x7a'),_0x7e82('0x7a'),{'event':'acceptmessage','message':_0x2533c1[_0x7e82('0x27')]},client9002)[_0x7e82('0x21')](function(){return _0x2533c1;});}return _0x2533c1;}return null;})[_0x7e82('0x21')](respondWithResult(_0x4c8752,null))[_0x7e82('0x28')](handleError(_0x4c8752,null));};var interaction_log=require(_0x7e82('0x14'))(_0x7e82('0x5a'));exports[_0x7e82('0x33')]=function(_0x4500fb,_0x466bac,_0x5eae11){var _0x1c3839={'agent':{},'channel':'whatsapp'};if(_0x4500fb[_0x7e82('0x58')]['id']){delete _0x4500fb[_0x7e82('0x58')]['id'];}_0x4500fb[_0x7e82('0x58')][_0x7e82('0x61')]=_0x4500fb[_0x7e82('0x58')][_0x7e82('0x61')]||_0x4500fb[_0x7e82('0x62')]['id'];_0x1c3839[_0x7e82('0x75')]['id']=_0x4500fb[_0x7e82('0x58')][_0x7e82('0x61')];return db['WhatsappMessage']['find']({'where':{'id':_0x4500fb[_0x7e82('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x466bac,null))[_0x7e82('0x21')](function(_0x38155c){if(_0x38155c){_0x1c3839[_0x7e82('0x27')]=_0x38155c['get']({'plain':!![]});return db[_0x7e82('0x64')][_0x7e82('0x56')]({'where':{'id':_0x38155c[_0x7e82('0x65')]}});}return null;})[_0x7e82('0x21')](handleEntityNotFound(_0x466bac,null))[_0x7e82('0x21')](function(_0x346cef){if(_0x346cef){_0x1c3839['interaction']=_0x346cef[_0x7e82('0x63')]({'plain':!![]});interaction_log[_0x7e82('0x22')](_0x7e82('0x7b'),_0x4500fb[_0x7e82('0x62')]['id'],_0x4500fb[_0x7e82('0x62')][_0x7e82('0x37')],_0x4500fb[_0x7e82('0x62')][_0x7e82('0x69')],_0x1c3839[_0x7e82('0x6a')]['id'],_0x4500fb[_0x7e82('0x58')]?JSON['stringify'](_0x4500fb['body']):'null');return respondWithRpcPromise(_0x7e82('0x7c'),'rejectMessage',_0x1c3839);}return null;})[_0x7e82('0x21')](function(_0x4b4566){var _0x353136=_0x7e82('0x6e')+_0x4b4566[_0x7e82('0x27')]['ContactId'];return db[_0x7e82('0x6f')][_0x7e82('0x3e')](_0x353136,{'type':db[_0x7e82('0x70')][_0x7e82('0x7d')][_0x7e82('0x71')],'raw':!![]})[_0x7e82('0x21')](function(_0x2281ab){return _0x2281ab;});})['then'](function(_0x51f86d){if(_0x51f86d){_0x1c3839[_0x7e82('0x27')][_0x7e82('0x72')]=_0x51f86d[0x0];if(!_0x4500fb[_0x7e82('0x58')][_0x7e82('0x61')])return;return db[_0x7e82('0x7e')][_0x7e82('0x56')]({'where':{'id':_0x4500fb[_0x7e82('0x58')][_0x7e82('0x61')],'role':_0x7e82('0x75')},'attributes':['id',_0x7e82('0x37'),_0x7e82('0x73'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x52ef47){if(!_0x52ef47)return null;_0x1c3839[_0x7e82('0x27')]['agent']=_0x52ef47;return _0x1c3839;})['then'](function(_0x4fa33c){if(_0x4fa33c){_0x4fa33c[_0x7e82('0x27')][_0x7e82('0x77')]=util[_0x7e82('0x5f')](_0x7e82('0x7f'),_0x4500fb['user']['name']);_0x4fa33c[_0x7e82('0x27')][_0x7e82('0x78')]=_0x1c3839[_0x7e82('0x78')];_0x4fa33c['message']['motionChannel']=_0x1c3839[_0x7e82('0x78')];_0x4fa33c[_0x7e82('0x27')][_0x7e82('0x79')]='reject';respondWithRpcPromise('EventManager',_0x7e82('0x7a'),{'event':_0x7e82('0x80'),'message':_0x4fa33c[_0x7e82('0x27')]},client9002);return _0x1c3839;}return null;})['then'](respondWithResult(_0x466bac,null))[_0x7e82('0x28')](handleError(_0x466bac,null));};exports['status']=function(_0x475ba3,_0x430046,_0xd7f05d){if(_0x475ba3[_0x7e82('0x58')]['id']){delete _0x475ba3[_0x7e82('0x58')]['id'];}var _0xbfea93;return db[_0x7e82('0x3b')]['find']({'where':{'id':_0x475ba3[_0x7e82('0x54')]['id']}})[_0x7e82('0x21')](handleEntityNotFound(_0x430046,null))[_0x7e82('0x21')](function(_0x12f459){if(_0x12f459){_0xbfea93=_0x12f459;return db[_0x7e82('0x81')][_0x7e82('0x56')]({'where':{'id':_0x12f459[_0x7e82('0x82')]}});}})[_0x7e82('0x21')](handleEntityNotFound(_0x430046,null))[_0x7e82('0x21')](function(_0x34c325){if(_0x34c325){logger[_0x7e82('0x83')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x7e82('0x2a'),_0x7e82('0x84'),_0x34c325[_0x7e82('0x4d')],util[_0x7e82('0x85')](_0x475ba3[_0x7e82('0x58')],{'showHidden':![],'depth':null}));switch(_0x34c325[_0x7e82('0x4d')]){case'twilio':if(_0x475ba3[_0x7e82('0x58')][_0x7e82('0x86')]&&_0x475ba3['body'][_0x7e82('0x86')]===_0xbfea93[_0x7e82('0x87')]&&_0x475ba3[_0x7e82('0x58')]['MessageStatus']&&_0x475ba3['body'][_0x7e82('0x88')]==='read'){return _0xbfea93[_0x7e82('0x66')]({'read':!![]});}else{logger[_0x7e82('0x24')](_0x7e82('0x89'),_0x7e82('0x2a'),_0x7e82('0x8a'),util[_0x7e82('0x85')](_0x475ba3[_0x7e82('0x58')],{'showHidden':![],'depth':null}));}break;}return _0xbfea93;}})[_0x7e82('0x21')](respondWithResult(_0x430046,null))[_0x7e82('0x28')](handleError(_0x430046,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 13a43d7..49cb735 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 _0x55ea=['WhatsappMessage','save','update','remove','exports','events','../../mysqldb'];(function(_0x204b04,_0x19f527){var _0x22a79b=function(_0x4b9464){while(--_0x4b9464){_0x204b04['push'](_0x204b04['shift']());}};_0x22a79b(++_0x19f527);}(_0x55ea,0xc9));var _0xa55e=function(_0x1bba1e,_0x28a649){_0x1bba1e=_0x1bba1e-0x0;var _0x32ece7=_0x55ea[_0x1bba1e];return _0x32ece7;};'use strict';var EventEmitter=require(_0xa55e('0x0'));var WhatsappMessage=require(_0xa55e('0x1'))['db'][_0xa55e('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa55e('0x3'),'afterUpdate':_0xa55e('0x4'),'afterDestroy':_0xa55e('0x5')};function emitEvent(_0x1325cc){return function(_0x95af3d,_0x54f178,_0x2d1040){WhatsappMessageEvents['emit'](_0x1325cc+':'+_0x95af3d['id'],_0x95af3d);WhatsappMessageEvents['emit'](_0x1325cc,_0x95af3d);_0x2d1040(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xa55e('0x6')]=WhatsappMessageEvents; \ No newline at end of file +var _0xefda=['save','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0x3eece3,_0x3d8a5e){var _0x33e06d=function(_0x1bf384){while(--_0x1bf384){_0x3eece3['push'](_0x3eece3['shift']());}};_0x33e06d(++_0x3d8a5e);}(_0xefda,0x96));var _0xaefd=function(_0x578ad6,_0x1888a9){_0x578ad6=_0x578ad6-0x0;var _0x58fab4=_0xefda[_0x578ad6];return _0x58fab4;};'use strict';var EventEmitter=require(_0xaefd('0x0'));var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xaefd('0x1')](0x0);var events={'afterCreate':_0xaefd('0x2'),'afterUpdate':'update','afterDestroy':_0xaefd('0x3')};function emitEvent(_0x1c65db){return function(_0x2ade44,_0x22df24,_0x1ef6b4){WhatsappMessageEvents[_0xaefd('0x4')](_0x1c65db+':'+_0x2ade44['id'],_0x2ade44);WhatsappMessageEvents['emit'](_0x1c65db,_0x2ade44);_0x1ef6b4(null);};}for(var e in events){if(events[_0xaefd('0x5')](e)){var event=events[e];WhatsappMessage[_0xaefd('0x6')](e,emitEvent(event));}}module[_0xaefd('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 d681262..3df7899 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 _0x53d1=['/api/whatsapp/messages/','/status?token=','token','sid','inspect','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','finally','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','WhatsappAccount','find','WhatsappAccountId','type','twilio','phone','messages','body'];(function(_0x35974c,_0x1421f1){var _0x3f3fce=function(_0x6f425c){while(--_0x6f425c){_0x35974c['push'](_0x35974c['shift']());}};_0x3f3fce(++_0x1421f1);}(_0x53d1,0xc6));var _0x153d=function(_0x50a3ea,_0x232e76){_0x50a3ea=_0x50a3ea-0x0;var _0x1b2169=_0x53d1[_0x50a3ea];return _0x1b2169;};'use strict';var _=require(_0x153d('0x0'));var util=require(_0x153d('0x1'));var logger=require(_0x153d('0x2'))(_0x153d('0x3'));var moment=require(_0x153d('0x4'));var BPromise=require('bluebird');var rp=require(_0x153d('0x5'));var fs=require('fs');var path=require(_0x153d('0x6'));var rimraf=require(_0x153d('0x7'));var config=require(_0x153d('0x8'));var attributes=require('./whatsappMessage.attributes');module[_0x153d('0x9')]=function(_0x5056d1,_0xd02876){return _0x5056d1[_0x153d('0xa')](_0x153d('0xb'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x153d('0xc'),'fields':[_0x153d('0xc')]},{'name':_0x153d('0xd'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b3f44,_0x2bc714,_0x2c487b){var _0x413db3=_0x5056d1[_0x153d('0xe')];var _0x583e4d=_0x4b3f44[_0x153d('0xf')]({'plain':!![]});if(_0x583e4d[_0x153d('0x10')][_0x153d('0x11')]()==='in'||_0x583e4d[_0x153d('0x10')][_0x153d('0x11')]()===_0x153d('0x12')&&!_0x583e4d[_0x153d('0x13')]&&!_[_0x153d('0x14')](_0x583e4d[_0x153d('0x15')])){_0x413db3[_0x153d('0x16')][_0x153d('0x17')]({'where':{'id':_0x583e4d[_0x153d('0x18')]}})[_0x153d('0x19')](function(_0xaa1754){if(_0xaa1754){_0xaa1754[_0x153d('0x1a')]({'lastMsgAt':_0x583e4d[_0x153d('0x1b')],'lastMsgDirection':_0x583e4d[_0x153d('0x10')][_0x153d('0x11')]()});}})[_0x153d('0x1c')](function(_0x4a0efa){console['error'](_0x4a0efa);});}if(_0x583e4d[_0x153d('0x10')]===_0x153d('0x12')&&!_0x583e4d[_0x153d('0x13')]){var _0x2839df;_0x413db3[_0x153d('0x1d')][_0x153d('0x1e')]({'where':{'id':_0x583e4d[_0x153d('0x1f')]},'raw':!![]})['then'](function(_0xec9658){_0x2839df=_0xec9658;if(_0x2839df&&_0x2839df[_0x153d('0x20')]){switch(_0x2839df['type']){case _0x153d('0x21'):var _0x317133=require(_0x153d('0x21'));if(_0x2839df['accountSid']&&_0x2839df['authToken']&&_0x2839df[_0x153d('0x22')]){var _0x1344e4=new _0x317133(_0x2839df['accountSid'],_0x2839df['authToken']);_0x1344e4[_0x153d('0x23')]['create']({'body':_0x583e4d[_0x153d('0x24')],'to':'whatsapp:'+_0x583e4d['phone'],'from':'whatsapp:'+_0x2839df[_0x153d('0x22')],'statusCallback':_0x2839df['remote']+_0x153d('0x25')+_0x583e4d['id']+_0x153d('0x26')+_0x2839df[_0x153d('0x27')]})[_0x153d('0x19')](function(_0x51f295){if(_0x51f295[_0x153d('0x28')]){return _0x4b3f44['update']({'messageId':_0x51f295['sid']});}})['catch'](function(_0x5f97b8){logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x153d('0x21'),util[_0x153d('0x29')](_0x5f97b8,{'showHidden':![],'depth':null}));});}else{logger[_0x153d('0x2a')](_0x153d('0x2b'),_0x153d('0x2c'),_0x153d('0x21'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0x153d('0x2d')](function(){_0x2c487b();});}else{_0x2c487b();}}},'charset':_0x153d('0x2e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3455=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','phone','authToken','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x403960,_0x5c9a66){var _0x1663ae=function(_0x57542c){while(--_0x57542c){_0x403960['push'](_0x403960['shift']());}};_0x1663ae(++_0x5c9a66);}(_0x3455,0x13c));var _0x5345=function(_0x45508e,_0x59708d){_0x45508e=_0x45508e-0x0;var _0xeea413=_0x3455[_0x45508e];return _0xeea413;};'use strict';var _=require(_0x5345('0x0'));var util=require(_0x5345('0x1'));var logger=require(_0x5345('0x2'))(_0x5345('0x3'));var moment=require(_0x5345('0x4'));var BPromise=require(_0x5345('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5345('0x6'));var rimraf=require(_0x5345('0x7'));var config=require(_0x5345('0x8'));var attributes=require(_0x5345('0x9'));module[_0x5345('0xa')]=function(_0x958330,_0x52fec3){return _0x958330[_0x5345('0xb')]('WhatsappMessage',attributes,{'tableName':_0x5345('0xc'),'paranoid':![],'indexes':[{'name':_0x5345('0xd'),'fields':[_0x5345('0xd')]},{'name':'fti_whatsapp_messages','fields':[_0x5345('0xe')],'type':_0x5345('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5c3a03,_0xb68ee6,_0xfb1765){var _0x4efe62=_0x958330[_0x5345('0x10')];var _0xb336f=_0x5c3a03[_0x5345('0x11')]({'plain':!![]});if(_0xb336f[_0x5345('0x12')][_0x5345('0x13')]()==='in'||_0xb336f['direction'][_0x5345('0x13')]()===_0x5345('0x14')&&!_0xb336f[_0x5345('0x15')]&&!_[_0x5345('0x16')](_0xb336f[_0x5345('0x17')])){_0x4efe62[_0x5345('0x18')][_0x5345('0x19')]({'where':{'id':_0xb336f[_0x5345('0x1a')]}})[_0x5345('0x1b')](function(_0x4738fb){if(_0x4738fb){_0x4738fb[_0x5345('0x1c')]({'lastMsgAt':_0xb336f[_0x5345('0x1d')],'lastMsgDirection':_0xb336f[_0x5345('0x12')][_0x5345('0x13')]()});}})['catch'](function(_0x9abeb2){console[_0x5345('0x1e')](_0x9abeb2);});}if(_0xb336f[_0x5345('0x12')]===_0x5345('0x14')&&!_0xb336f[_0x5345('0x15')]){var _0x134218;_0x4efe62[_0x5345('0x1f')][_0x5345('0x20')]({'where':{'id':_0xb336f[_0x5345('0x21')]},'raw':!![]})[_0x5345('0x1b')](function(_0x2c0c22){_0x134218=_0x2c0c22;if(_0x134218&&_0x134218[_0x5345('0x22')]){switch(_0x134218[_0x5345('0x22')]){case'twilio':var _0x1f2c1d=require(_0x5345('0x23'));if(_0x134218[_0x5345('0x24')]&&_0x134218['authToken']&&_0x134218[_0x5345('0x25')]){var _0x3c2182=new _0x1f2c1d(_0x134218['accountSid'],_0x134218[_0x5345('0x26')]);_0x3c2182['messages'][_0x5345('0x27')]({'body':_0xb336f[_0x5345('0xe')],'to':_0x5345('0x28')+_0xb336f[_0x5345('0x25')],'from':_0x5345('0x28')+_0x134218[_0x5345('0x25')],'statusCallback':_0x134218[_0x5345('0x29')]+_0x5345('0x2a')+_0xb336f['id']+_0x5345('0x2b')+_0x134218['token']})['then'](function(_0x22c851){if(_0x22c851[_0x5345('0x2c')]){return _0x5c3a03[_0x5345('0x1c')]({'messageId':_0x22c851[_0x5345('0x2c')]});}})[_0x5345('0x2d')](function(_0x2950b9){logger['error'](_0x5345('0x2e'),'afterCreate',_0x5345('0x23'),util[_0x5345('0x2f')](_0x2950b9,{'showHidden':![],'depth':null}));});}else{logger[_0x5345('0x1e')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x5345('0x30'),_0x5345('0x23'),_0x5345('0x31'));}break;}}})[_0x5345('0x32')](function(){_0xfb1765();});}else{_0xfb1765();}}},'charset':_0x5345('0x33'),'collate':_0x5345('0x34')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index f893d20..509fef3 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 _0x1f90=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./whatsappMessage.socket','request','then','info','debug','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','CreateWhatsappMessage','WhatsappMessage','create','body','options','catch','lodash','util','bluebird','randomstring'];(function(_0x5f234b,_0x5b2a7f){var _0x348bf8=function(_0x32b0ab){while(--_0x32b0ab){_0x5f234b['push'](_0x5f234b['shift']());}};_0x348bf8(++_0x5b2a7f);}(_0x1f90,0x1be));var _0x01f9=function(_0xeb80c9,_0x3fe888){_0xeb80c9=_0xeb80c9-0x0;var _0x259c37=_0x1f90[_0xeb80c9];return _0x259c37;};'use strict';var _=require(_0x01f9('0x0'));var util=require(_0x01f9('0x1'));var moment=require('moment');var BPromise=require(_0x01f9('0x2'));var rs=require(_0x01f9('0x3'));var fs=require('fs');var Redis=require(_0x01f9('0x4'));var db=require(_0x01f9('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x01f9('0x6'));var config=require(_0x01f9('0x7'));var jayson=require(_0x01f9('0x8'));var client=jayson[_0x01f9('0x9')][_0x01f9('0xa')]({'port':0x232a});config['redis']=_[_0x01f9('0xb')](config[_0x01f9('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x01f9('0xd'))(new Redis(config['redis']));require(_0x01f9('0xe'))['register'](socket);function respondWithRpcPromise(_0x4a53da,_0x4746b1,_0x14b38c){return new BPromise(function(_0xd9499c,_0x51e163){return client[_0x01f9('0xf')](_0x4a53da,_0x14b38c)[_0x01f9('0x10')](function(_0x41e226){logger[_0x01f9('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x4746b1,'request\x20sent');logger[_0x01f9('0x12')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4746b1,'request\x20sent',JSON[_0x01f9('0x13')](_0x41e226));if(_0x41e226[_0x01f9('0x14')]){if(_0x41e226[_0x01f9('0x14')][_0x01f9('0x15')]===0x1f4){logger[_0x01f9('0x14')](_0x01f9('0x16'),_0x4746b1,_0x41e226['error'][_0x01f9('0x17')]);return _0x51e163(_0x41e226['error'][_0x01f9('0x17')]);}logger[_0x01f9('0x14')](_0x01f9('0x16'),_0x4746b1,_0x41e226[_0x01f9('0x14')][_0x01f9('0x17')]);return _0xd9499c(_0x41e226[_0x01f9('0x14')][_0x01f9('0x17')]);}else{logger[_0x01f9('0x11')](_0x01f9('0x16'),_0x4746b1,'request\x20sent');_0xd9499c(_0x41e226['result'][_0x01f9('0x17')]);}})['catch'](function(_0x4da88c){logger[_0x01f9('0x14')](_0x01f9('0x16'),_0x4746b1,_0x4da88c);_0x51e163(_0x4da88c);});});}exports[_0x01f9('0x18')]=function(_0x28683d){var _0x49dab8=this;return new Promise(function(_0x50b063,_0x2f4bc3){return db[_0x01f9('0x19')][_0x01f9('0x1a')](_0x28683d[_0x01f9('0x1b')],{'raw':_0x28683d[_0x01f9('0x1c')]?_0x28683d['options']['raw']===undefined?!![]:![]:!![]})[_0x01f9('0x10')](function(_0x2f9ac6){logger[_0x01f9('0x11')](_0x01f9('0x18'),_0x28683d);logger[_0x01f9('0x12')](_0x01f9('0x18'),_0x28683d,JSON[_0x01f9('0x13')](_0x2f9ac6));_0x50b063(_0x2f9ac6);})[_0x01f9('0x1d')](function(_0x434f3a){logger[_0x01f9('0x14')]('CreateWhatsappMessage',_0x434f3a[_0x01f9('0x17')],_0x28683d);_0x2f4bc3(_0x49dab8['error'](0x1f4,_0x434f3a[_0x01f9('0x17')]));});});}; \ No newline at end of file +var _0x8c46=['code','message','catch','CreateWhatsappMessage','create','options','raw','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error'];(function(_0x4f9a4a,_0x434273){var _0x1c90dc=function(_0xade278){while(--_0xade278){_0x4f9a4a['push'](_0x4f9a4a['shift']());}};_0x1c90dc(++_0x434273);}(_0x8c46,0xd2));var _0x68c4=function(_0x4f2f20,_0xc027f9){_0x4f2f20=_0x4f2f20-0x0;var _0x3ce7b5=_0x8c46[_0x4f2f20];return _0x3ce7b5;};'use strict';var _=require('lodash');var util=require(_0x68c4('0x0'));var moment=require('moment');var BPromise=require(_0x68c4('0x1'));var rs=require(_0x68c4('0x2'));var fs=require('fs');var Redis=require(_0x68c4('0x3'));var db=require(_0x68c4('0x4'))['db'];var utils=require(_0x68c4('0x5'));var logger=require(_0x68c4('0x6'))(_0x68c4('0x7'));var config=require('../../config/environment');var jayson=require(_0x68c4('0x8'));var client=jayson[_0x68c4('0x9')][_0x68c4('0xa')]({'port':0x232a});config[_0x68c4('0xb')]=_[_0x68c4('0xc')](config[_0x68c4('0xb')],{'host':_0x68c4('0xd'),'port':0x18eb});var socket=require(_0x68c4('0xe'))(new Redis(config[_0x68c4('0xb')]));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x4fc79c,_0x268962,_0x3ac500){return new BPromise(function(_0xf0138,_0x1e12e1){return client[_0x68c4('0xf')](_0x4fc79c,_0x3ac500)['then'](function(_0x704c84){logger[_0x68c4('0x10')](_0x68c4('0x11'),_0x268962,_0x68c4('0x12'));logger[_0x68c4('0x13')](_0x68c4('0x14'),_0x268962,_0x68c4('0x12'),JSON['stringify'](_0x704c84));if(_0x704c84[_0x68c4('0x15')]){if(_0x704c84['error'][_0x68c4('0x16')]===0x1f4){logger[_0x68c4('0x15')](_0x68c4('0x11'),_0x268962,_0x704c84['error'][_0x68c4('0x17')]);return _0x1e12e1(_0x704c84[_0x68c4('0x15')][_0x68c4('0x17')]);}logger[_0x68c4('0x15')](_0x68c4('0x11'),_0x268962,_0x704c84[_0x68c4('0x15')][_0x68c4('0x17')]);return _0xf0138(_0x704c84[_0x68c4('0x15')][_0x68c4('0x17')]);}else{logger[_0x68c4('0x10')]('WhatsappMessage,\x20%s,\x20%s',_0x268962,'request\x20sent');_0xf0138(_0x704c84['result'][_0x68c4('0x17')]);}})[_0x68c4('0x18')](function(_0xf91bd3){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x268962,_0xf91bd3);_0x1e12e1(_0xf91bd3);});});}exports[_0x68c4('0x19')]=function(_0x3772e5){var _0x5b12d0=this;return new Promise(function(_0x278de6,_0x370db6){return db['WhatsappMessage'][_0x68c4('0x1a')](_0x3772e5['body'],{'raw':_0x3772e5['options']?_0x3772e5[_0x68c4('0x1b')][_0x68c4('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x23784d){logger[_0x68c4('0x10')](_0x68c4('0x19'),_0x3772e5);logger['debug'](_0x68c4('0x19'),_0x3772e5,JSON['stringify'](_0x23784d));_0x278de6(_0x23784d);})[_0x68c4('0x18')](function(_0x1d3d7e){logger[_0x68c4('0x15')](_0x68c4('0x19'),_0x1d3d7e['message'],_0x3772e5);_0x370db6(_0x5b12d0['error'](0x1f4,_0x1d3d7e['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 96691c5..4aa5610 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 _0x27f5=['register','length','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit'];(function(_0x230471,_0x10441f){var _0x5dd908=function(_0x2bbc28){while(--_0x2bbc28){_0x230471['push'](_0x230471['shift']());}};_0x5dd908(++_0x10441f);}(_0x27f5,0xbb));var _0x527f=function(_0x2c4260,_0x19882c){_0x2c4260=_0x2c4260-0x0;var _0x13972e=_0x27f5[_0x2c4260];return _0x13972e;};'use strict';var WhatsappMessageEvents=require(_0x527f('0x0'));var events=[_0x527f('0x1'),_0x527f('0x2'),_0x527f('0x3')];function createListener(_0x54f272,_0x310860){return function(_0x22b970){_0x310860[_0x527f('0x4')](_0x54f272,_0x22b970);};}function removeListener(_0x251198,_0x2a3240){return function(){WhatsappMessageEvents['removeListener'](_0x251198,_0x2a3240);};}exports[_0x527f('0x5')]=function(_0x4f01ed){for(var _0x4cea9f=0x0,_0x53a27c=events[_0x527f('0x6')];_0x4cea9f<_0x53a27c;_0x4cea9f++){var _0x35bf26=events[_0x4cea9f];var _0x4c02dc=createListener(_0x527f('0x7')+_0x35bf26,_0x4f01ed);WhatsappMessageEvents['on'](_0x35bf26,_0x4c02dc);}}; \ No newline at end of file +var _0x9dbd=['update','removeListener','register','length','./whatsappMessage.events','save','remove'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x9dbd,0x19a));var _0xd9db=function(_0x3f54a,_0x47c346){_0x3f54a=_0x3f54a-0x0;var _0x4b674b=_0x9dbd[_0x3f54a];return _0x4b674b;};'use strict';var WhatsappMessageEvents=require(_0xd9db('0x0'));var events=[_0xd9db('0x1'),_0xd9db('0x2'),_0xd9db('0x3')];function createListener(_0x10566a,_0x5bcf89){return function(_0x4ce3c1){_0x5bcf89['emit'](_0x10566a,_0x4ce3c1);};}function removeListener(_0x40c086,_0x565ca6){return function(){WhatsappMessageEvents[_0xd9db('0x4')](_0x40c086,_0x565ca6);};}exports[_0xd9db('0x5')]=function(_0x269536){for(var _0x16d1bc=0x0,_0x1a4091=events[_0xd9db('0x6')];_0x16d1bc<_0x1a4091;_0x16d1bc++){var _0xf764cf=events[_0x16d1bc];var _0x142715=createListener('whatsappMessage:'+_0xf764cf,_0x269536);WhatsappMessageEvents['on'](_0xf764cf,_0x142715);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 6a81dd2..00e12e2 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 _0xa4de=['getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete','/:id','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','/describe','isAuthenticated','describe','show','getMembers','/:id/teams'];(function(_0x24c7fe,_0x28aad9){var _0x3ee6bf=function(_0x71c27b){while(--_0x71c27b){_0x24c7fe['push'](_0x24c7fe['shift']());}};_0x3ee6bf(++_0x28aad9);}(_0xa4de,0x107));var _0xea4d=function(_0xe7dfc2,_0x59ef08){_0xe7dfc2=_0xe7dfc2-0x0;var _0x17aa52=_0xa4de[_0xe7dfc2];return _0x17aa52;};'use strict';var multer=require(_0xea4d('0x0'));var util=require(_0xea4d('0x1'));var path=require('path');var timeout=require(_0xea4d('0x2'));var express=require(_0xea4d('0x3'));var router=express[_0xea4d('0x4')]();var fs_extra=require(_0xea4d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xea4d('0x6'));var config=require(_0xea4d('0x7'));var controller=require(_0xea4d('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xea4d('0x9')](_0xea4d('0xa'),auth[_0xea4d('0xb')](),controller[_0xea4d('0xc')]);router[_0xea4d('0x9')]('/:id',auth[_0xea4d('0xb')](),controller[_0xea4d('0xd')]);router[_0xea4d('0x9')]('/:id/members',auth[_0xea4d('0xb')](),controller[_0xea4d('0xe')]);router['get'](_0xea4d('0xf'),auth[_0xea4d('0xb')](),controller[_0xea4d('0x10')]);router[_0xea4d('0x9')]('/:id/users',auth[_0xea4d('0xb')](),controller[_0xea4d('0x11')]);router[_0xea4d('0x12')]('/',auth['isAuthenticated'](),controller[_0xea4d('0x13')]);router[_0xea4d('0x12')](_0xea4d('0xf'),auth[_0xea4d('0xb')](),controller[_0xea4d('0x14')]);router[_0xea4d('0x12')](_0xea4d('0x15'),auth['isAuthenticated'](),controller[_0xea4d('0x16')]);router[_0xea4d('0x17')]('/:id',auth[_0xea4d('0xb')](),controller[_0xea4d('0x18')]);router[_0xea4d('0x19')](_0xea4d('0x1a'),auth[_0xea4d('0xb')](),controller[_0xea4d('0x1b')]);router['delete'](_0xea4d('0xf'),auth[_0xea4d('0xb')](),controller[_0xea4d('0x1c')]);router['delete']('/:id/users',auth[_0xea4d('0xb')](),controller[_0xea4d('0x1d')]);module[_0xea4d('0x1e')]=router; \ No newline at end of file +var _0xd662=['getTeams','/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','/:id','getMembers','/:id/teams'];(function(_0x113f2b,_0x42336e){var _0x42402a=function(_0x41b00c){while(--_0x41b00c){_0x113f2b['push'](_0x113f2b['shift']());}};_0x42402a(++_0x42336e);}(_0xd662,0x85));var _0x2d66=function(_0x2f6c38,_0x4b067a){_0x2f6c38=_0x2f6c38-0x0;var _0x66279f=_0xd662[_0x2f6c38];return _0x66279f;};'use strict';var multer=require(_0x2d66('0x0'));var util=require(_0x2d66('0x1'));var path=require(_0x2d66('0x2'));var timeout=require(_0x2d66('0x3'));var express=require('express');var router=express[_0x2d66('0x4')]();var fs_extra=require(_0x2d66('0x5'));var auth=require(_0x2d66('0x6'));var interaction=require(_0x2d66('0x7'));var config=require(_0x2d66('0x8'));var controller=require(_0x2d66('0x9'));router[_0x2d66('0xa')]('/',auth[_0x2d66('0xb')](),controller[_0x2d66('0xc')]);router['get'](_0x2d66('0xd'),auth[_0x2d66('0xb')](),controller['describe']);router[_0x2d66('0xa')](_0x2d66('0xe'),auth[_0x2d66('0xb')](),controller['show']);router['get']('/:id/members',auth[_0x2d66('0xb')](),controller[_0x2d66('0xf')]);router[_0x2d66('0xa')](_0x2d66('0x10'),auth[_0x2d66('0xb')](),controller[_0x2d66('0x11')]);router[_0x2d66('0xa')](_0x2d66('0x12'),auth['isAuthenticated'](),controller[_0x2d66('0x13')]);router[_0x2d66('0x14')]('/',auth[_0x2d66('0xb')](),controller[_0x2d66('0x15')]);router[_0x2d66('0x14')](_0x2d66('0x10'),auth[_0x2d66('0xb')](),controller['addTeams']);router['post'](_0x2d66('0x12'),auth[_0x2d66('0xb')](),controller[_0x2d66('0x16')]);router[_0x2d66('0x17')](_0x2d66('0xe'),auth[_0x2d66('0xb')](),controller[_0x2d66('0x18')]);router[_0x2d66('0x19')](_0x2d66('0xe'),auth[_0x2d66('0xb')](),controller[_0x2d66('0x1a')]);router['delete'](_0x2d66('0x10'),auth[_0x2d66('0xb')](),controller[_0x2d66('0x1b')]);router['delete'](_0x2d66('0x12'),auth[_0x2d66('0xb')](),controller[_0x2d66('0x1c')]);module[_0x2d66('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 3faee21..6471a5a 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 _0x7217=['roundrobin','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x213144,_0x184a2e){var _0x24b3e2=function(_0x3e8b68){while(--_0x3e8b68){_0x213144['push'](_0x213144['shift']());}};_0x24b3e2(++_0x184a2e);}(_0x7217,0xa9));var _0x7721=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0x7217[_0x9aada2];return _0x196dff;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7721('0x0')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x7721('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7721('0x2')](_0x7721('0x3'),_0x7721('0x4'),_0x7721('0x5'))},'description':{'type':Sequelize[_0x7721('0x0')]}}; \ No newline at end of file +var _0x8e44=['roundrobin','sequelize','exports','STRING','ENUM','rrmemory','beepall'];(function(_0x6b133d,_0x51a041){var _0x392fc0=function(_0x1cc446){while(--_0x1cc446){_0x6b133d['push'](_0x6b133d['shift']());}};_0x392fc0(++_0x51a041);}(_0x8e44,0x1ac));var _0x48e4=function(_0x384f48,_0x5c72ff){_0x384f48=_0x384f48-0x0;var _0x57609a=_0x8e44[_0x384f48];return _0x57609a;};'use strict';var Sequelize=require(_0x48e4('0x0'));module[_0x48e4('0x1')]={'name':{'type':Sequelize[_0x48e4('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x48e4('0x3')](_0x48e4('0x4'),_0x48e4('0x5'),_0x48e4('0x6'))},'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 f41eef0..51f3aae 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 _0x2f1d=['send','index','map','WhatsappQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','show','catch','create','body','user','get','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','order','WhatsappQueueId','User','findAndCountAll','UserId','whatsappPause','updatedAt','rows','format','%s/%s','SIP','createdAt','getTeams','Team','pick','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','findOrCreate','emit','userWhatsappQueue:save','select','field','tq.TeamId','from','team_has_whatsapp_queues','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','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','socket.io-emitter','./whatsappQueue.socket','register','status','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','WhatsappQueues','UserProfileResource','end','sendStatus','error','stack','name'];(function(_0x20d304,_0x1ec407){var _0x186a62=function(_0x186d9d){while(--_0x186d9d){_0x20d304['push'](_0x20d304['shift']());}};_0x186a62(++_0x1ec407);}(_0x2f1d,0x187));var _0xd2f1=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x2f1d[_0x15c421];return _0x5e5ed5;};'use strict';var emlformat=require(_0xd2f1('0x0'));var rimraf=require(_0xd2f1('0x1'));var zipdir=require(_0xd2f1('0x2'));var jsonpatch=require(_0xd2f1('0x3'));var rp=require(_0xd2f1('0x4'));var moment=require('moment');var BPromise=require(_0xd2f1('0x5'));var Mustache=require(_0xd2f1('0x6'));var util=require(_0xd2f1('0x7'));var path=require(_0xd2f1('0x8'));var sox=require(_0xd2f1('0x9'));var csv=require('to-csv');var ejs=require(_0xd2f1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd2f1('0xb'));var squel=require(_0xd2f1('0xc'));var crypto=require(_0xd2f1('0xd'));var jsforce=require(_0xd2f1('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd2f1('0xf'));var Papa=require(_0xd2f1('0x10'));var Redis=require(_0xd2f1('0x11'));var authService=require(_0xd2f1('0x12'));var qs=require(_0xd2f1('0x13'));var as=require(_0xd2f1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd2f1('0x15'))(_0xd2f1('0x16'));var utils=require(_0xd2f1('0x17'));var config=require(_0xd2f1('0x18'));var licenseUtil=require(_0xd2f1('0x19'));var db=require(_0xd2f1('0x1a'))['db'];config[_0xd2f1('0x1b')]=_['defaults'](config[_0xd2f1('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xd2f1('0x1c'))(new Redis(config['redis']));require(_0xd2f1('0x1d'))[_0xd2f1('0x1e')](socket);function respondWithStatusCode(_0x140bec,_0x32728f){_0x32728f=_0x32728f||0xcc;return function(_0x9b0d6e){if(_0x9b0d6e){return _0x140bec['sendStatus'](_0x32728f);}return _0x140bec[_0xd2f1('0x1f')](_0x32728f)['end']();};}function respondWithResult(_0x54b97c,_0x137aef){_0x137aef=_0x137aef||0xc8;return function(_0x579011){if(_0x579011){return _0x54b97c[_0xd2f1('0x1f')](_0x137aef)['json'](_0x579011);}};}function respondWithFilteredResult(_0x3d45b0,_0x534f7d){return function(_0x88cd27){if(_0x88cd27){var _0x5a1cf0=typeof _0x534f7d[_0xd2f1('0x20')]===_0xd2f1('0x21')&&typeof _0x534f7d['limit']===_0xd2f1('0x21');var _0x333846=_0x88cd27[_0xd2f1('0x22')];var _0x337a89=_0x5a1cf0?0x0:_0x534f7d[_0xd2f1('0x20')];var _0xa38a08=_0x5a1cf0?_0x88cd27[_0xd2f1('0x22')]:_0x534f7d[_0xd2f1('0x20')]+_0x534f7d[_0xd2f1('0x23')];var _0x43b342;if(_0xa38a08>=_0x333846){_0xa38a08=_0x333846;_0x43b342=0xc8;}else{_0x43b342=0xce;}_0x3d45b0[_0xd2f1('0x1f')](_0x43b342);return _0x3d45b0['set'](_0xd2f1('0x24'),_0x337a89+'-'+_0xa38a08+'/'+_0x333846)['json'](_0x88cd27);}return null;};}function patchUpdates(_0x512a6d){return function(_0x2ac64f){try{jsonpatch[_0xd2f1('0x25')](_0x2ac64f,_0x512a6d,!![]);}catch(_0x5c996c){return BPromise[_0xd2f1('0x26')](_0x5c996c);}return _0x2ac64f[_0xd2f1('0x27')]();};}function saveUpdates(_0x196493,_0x1be0dd){return function(_0x2c954f){if(_0x2c954f){return _0x2c954f[_0xd2f1('0x28')](_0x196493)[_0xd2f1('0x29')](function(_0xb4a4c){return _0xb4a4c;});}return null;};}function removeEntity(_0x1cf7ac,_0x6e4ef5){return function(_0x5d6b6c){if(_0x5d6b6c){return _0x5d6b6c[_0xd2f1('0x2a')]()[_0xd2f1('0x29')](function(){var _0x5efa1d=_0x5d6b6c['get']({'plain':!![]});var _0x2c855a=_0xd2f1('0x2b');return db[_0xd2f1('0x2c')][_0xd2f1('0x2a')]({'where':{'type':_0x2c855a,'resourceId':_0x5efa1d['id']}})[_0xd2f1('0x29')](function(){return _0x5d6b6c;});})[_0xd2f1('0x29')](function(){_0x1cf7ac['status'](0xcc)[_0xd2f1('0x2d')]();});}};}function handleEntityNotFound(_0x3b874a,_0x31645a){return function(_0x277c3d){if(!_0x277c3d){_0x3b874a[_0xd2f1('0x2e')](0x194);}return _0x277c3d;};}function handleError(_0x2cd0ce,_0x2ff8b4){_0x2ff8b4=_0x2ff8b4||0x1f4;return function(_0x55668c){logger[_0xd2f1('0x2f')](_0x55668c[_0xd2f1('0x30')]);if(_0x55668c[_0xd2f1('0x31')]){delete _0x55668c[_0xd2f1('0x31')];}_0x2cd0ce[_0xd2f1('0x1f')](_0x2ff8b4)[_0xd2f1('0x32')](_0x55668c);};}exports[_0xd2f1('0x33')]=function(_0xea9fb3,_0x34677d){var _0x2d941a={},_0x142d2c={},_0x30b315={'count':0x0,'rows':[]};var _0x89b5dc=_[_0xd2f1('0x34')](db[_0xd2f1('0x35')][_0xd2f1('0x36')],function(_0x446596){return{'name':_0x446596[_0xd2f1('0x37')],'type':_0x446596['type'][_0xd2f1('0x38')]};});_0x142d2c[_0xd2f1('0x39')]=_[_0xd2f1('0x34')](_0x89b5dc,_0xd2f1('0x31'));_0x142d2c[_0xd2f1('0x3a')]=_[_0xd2f1('0x3b')](_0xea9fb3['query']);_0x142d2c[_0xd2f1('0x3c')]=_[_0xd2f1('0x3d')](_0x142d2c[_0xd2f1('0x39')],_0x142d2c[_0xd2f1('0x3a')]);_0x2d941a[_0xd2f1('0x3e')]=_['intersection'](_0x142d2c[_0xd2f1('0x39')],qs['fields'](_0xea9fb3[_0xd2f1('0x3a')][_0xd2f1('0x3f')]));_0x2d941a['attributes']=_0x2d941a[_0xd2f1('0x3e')][_0xd2f1('0x40')]?_0x2d941a[_0xd2f1('0x3e')]:_0x142d2c[_0xd2f1('0x39')];if(!_0xea9fb3[_0xd2f1('0x3a')]['hasOwnProperty'](_0xd2f1('0x41'))){_0x2d941a['limit']=qs[_0xd2f1('0x23')](_0xea9fb3['query'][_0xd2f1('0x23')]);_0x2d941a[_0xd2f1('0x20')]=qs[_0xd2f1('0x20')](_0xea9fb3[_0xd2f1('0x3a')]['offset']);}_0x2d941a['order']=qs[_0xd2f1('0x42')](_0xea9fb3[_0xd2f1('0x3a')][_0xd2f1('0x42')]);_0x2d941a[_0xd2f1('0x43')]=qs[_0xd2f1('0x3c')](_['pick'](_0xea9fb3[_0xd2f1('0x3a')],_0x142d2c[_0xd2f1('0x3c')]),_0x89b5dc);if(_0xea9fb3['query'][_0xd2f1('0x44')]){_0x2d941a['where']=_['merge'](_0x2d941a['where'],{'$or':_[_0xd2f1('0x34')](_0x89b5dc,function(_0x2df942){if(_0x2df942[_0xd2f1('0x45')]!==_0xd2f1('0x46')){var _0x2271e2={};_0x2271e2[_0x2df942['name']]={'$like':'%'+_0xea9fb3[_0xd2f1('0x3a')][_0xd2f1('0x44')]+'%'};return _0x2271e2;}})});}_0x2d941a=_[_0xd2f1('0x47')]({},_0x2d941a,_0xea9fb3[_0xd2f1('0x48')]);var _0x1875e3={'where':_0x2d941a[_0xd2f1('0x43')]};return db['WhatsappQueue'][_0xd2f1('0x22')](_0x1875e3)[_0xd2f1('0x29')](function(_0x443898){_0x30b315[_0xd2f1('0x22')]=_0x443898;if(_0xea9fb3['query'][_0xd2f1('0x49')]){_0x2d941a[_0xd2f1('0x4a')]=[{'all':!![]}];}return db['WhatsappQueue'][_0xd2f1('0x4b')](_0x2d941a);})[_0xd2f1('0x29')](function(_0x4f0dbe){_0x30b315['rows']=_0x4f0dbe;return _0x30b315;})[_0xd2f1('0x29')](respondWithFilteredResult(_0x34677d,_0x2d941a))['catch'](handleError(_0x34677d,null));};exports[_0xd2f1('0x4c')]=function(_0x3e074f,_0xbe3707){var _0x281a7c={'raw':!![],'where':{'id':_0x3e074f['params']['id']}},_0x41be18={};_0x41be18['model']=_[_0xd2f1('0x3b')](db[_0xd2f1('0x35')][_0xd2f1('0x36')]);_0x41be18[_0xd2f1('0x3a')]=_['keys'](_0x3e074f[_0xd2f1('0x3a')]);_0x41be18[_0xd2f1('0x3c')]=_[_0xd2f1('0x3d')](_0x41be18[_0xd2f1('0x39')],_0x41be18[_0xd2f1('0x3a')]);_0x281a7c[_0xd2f1('0x3e')]=_[_0xd2f1('0x3d')](_0x41be18[_0xd2f1('0x39')],qs[_0xd2f1('0x3f')](_0x3e074f[_0xd2f1('0x3a')][_0xd2f1('0x3f')]));_0x281a7c[_0xd2f1('0x3e')]=_0x281a7c[_0xd2f1('0x3e')][_0xd2f1('0x40')]?_0x281a7c[_0xd2f1('0x3e')]:_0x41be18['model'];if(_0x3e074f[_0xd2f1('0x3a')][_0xd2f1('0x49')]){_0x281a7c['include']=[{'all':!![]}];}_0x281a7c=_[_0xd2f1('0x47')]({},_0x281a7c,_0x3e074f[_0xd2f1('0x48')]);return db['WhatsappQueue']['find'](_0x281a7c)[_0xd2f1('0x29')](handleEntityNotFound(_0xbe3707,null))[_0xd2f1('0x29')](respondWithResult(_0xbe3707,null))[_0xd2f1('0x4d')](handleError(_0xbe3707,null));};exports[_0xd2f1('0x4e')]=function(_0x5a61c8,_0x57f503){return db['WhatsappQueue']['create'](_0x5a61c8[_0xd2f1('0x4f')],{})[_0xd2f1('0x29')](function(_0x5b41d3){var _0x34543d=_0x5a61c8[_0xd2f1('0x50')][_0xd2f1('0x51')]({'plain':!![]});if(!_0x34543d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x34543d[_0xd2f1('0x52')]===_0xd2f1('0x50')){var _0x19df7c=_0x5b41d3[_0xd2f1('0x51')]({'plain':!![]});var _0x3db3d6=_0xd2f1('0x2b');return db[_0xd2f1('0x53')]['find']({'where':{'name':_0x3db3d6,'userProfileId':_0x34543d['userProfileId']},'raw':!![]})['then'](function(_0x16220e){if(_0x16220e&&_0x16220e[_0xd2f1('0x54')]===0x0){return db[_0xd2f1('0x2c')][_0xd2f1('0x4e')]({'name':_0x19df7c[_0xd2f1('0x31')],'resourceId':_0x19df7c['id'],'type':_0x16220e[_0xd2f1('0x31')],'sectionId':_0x16220e['id']},{})[_0xd2f1('0x29')](function(){return _0x5b41d3;});}else{return _0x5b41d3;}})[_0xd2f1('0x4d')](function(_0x409e0e){logger['error'](_0xd2f1('0x55'),_0x409e0e);throw _0x409e0e;});}return _0x5b41d3;})[_0xd2f1('0x29')](respondWithResult(_0x57f503,0xc9))['catch'](handleError(_0x57f503,null));};exports[_0xd2f1('0x28')]=function(_0x27bbd4,_0x1009ef){if(_0x27bbd4[_0xd2f1('0x4f')]['id']){delete _0x27bbd4[_0xd2f1('0x4f')]['id'];}return db[_0xd2f1('0x35')][_0xd2f1('0x56')]({'where':{'id':_0x27bbd4[_0xd2f1('0x57')]['id']}})[_0xd2f1('0x29')](handleEntityNotFound(_0x1009ef,null))[_0xd2f1('0x29')](saveUpdates(_0x27bbd4[_0xd2f1('0x4f')],null))[_0xd2f1('0x29')](respondWithResult(_0x1009ef,null))[_0xd2f1('0x4d')](handleError(_0x1009ef,null));};exports[_0xd2f1('0x2a')]=function(_0x2e7de8,_0x44c417){return db[_0xd2f1('0x35')]['find']({'where':{'id':_0x2e7de8['params']['id']}})[_0xd2f1('0x29')](handleEntityNotFound(_0x44c417,null))['then'](removeEntity(_0x44c417,null))['catch'](handleError(_0x44c417,null));};exports[_0xd2f1('0x58')]=function(_0x4e2ce7,_0x40fb9c){return db[_0xd2f1('0x35')][_0xd2f1('0x58')]()[_0xd2f1('0x29')](respondWithResult(_0x40fb9c,null))[_0xd2f1('0x4d')](handleError(_0x40fb9c,null));};exports[_0xd2f1('0x59')]=function(_0x3c5c09,_0x1dcbcc,_0x2f18d3){var _0x5eccf2={'raw':!![],'where':{}},_0x3c4c89={},_0x5f4f07;return db['WhatsappQueue'][_0xd2f1('0x5a')]({'where':{'id':_0x3c5c09[_0xd2f1('0x57')]['id']}})[_0xd2f1('0x29')](handleEntityNotFound(_0x1dcbcc,null))[_0xd2f1('0x29')](function(_0x3d8a2c){if(_0x3d8a2c){_0x5f4f07=_0x3d8a2c[_0xd2f1('0x51')]({'plain':!![]});_0x3c4c89[_0xd2f1('0x39')]=_[_0xd2f1('0x3b')](db[_0xd2f1('0x5b')]['rawAttributes']);_0x3c4c89[_0xd2f1('0x3a')]=_['keys'](_0x3c5c09[_0xd2f1('0x3a')]);_0x3c4c89[_0xd2f1('0x3c')]=_[_0xd2f1('0x3d')](_0x3c4c89[_0xd2f1('0x39')],_0x3c4c89['query']);_0x5eccf2[_0xd2f1('0x3e')]=_[_0xd2f1('0x3d')](_0x3c4c89[_0xd2f1('0x39')],qs[_0xd2f1('0x3f')](_0x3c5c09[_0xd2f1('0x3a')]['fields']));_0x5eccf2[_0xd2f1('0x3e')]=_0x5eccf2[_0xd2f1('0x3e')]['length']?_0x5eccf2['attributes']:_0x3c4c89[_0xd2f1('0x39')];if(!_0x3c5c09[_0xd2f1('0x3a')][_0xd2f1('0x5c')]('nolimit')){_0x5eccf2[_0xd2f1('0x23')]=qs[_0xd2f1('0x23')](_0x3c5c09['query'][_0xd2f1('0x23')]);_0x5eccf2[_0xd2f1('0x20')]=qs[_0xd2f1('0x20')](_0x3c5c09[_0xd2f1('0x3a')][_0xd2f1('0x20')]);}_0x5eccf2[_0xd2f1('0x5d')]=qs['sort'](_0x3c5c09['query']['sort']);_0x5eccf2['where']=qs['filters'](_['pick'](_0x3c5c09[_0xd2f1('0x3a')],_0x3c4c89[_0xd2f1('0x3c')]));_0x5eccf2[_0xd2f1('0x43')][_0xd2f1('0x5e')]=_0x3d8a2c['id'];if(_0x3c5c09[_0xd2f1('0x3a')][_0xd2f1('0x44')]){_0x5eccf2['where']=_[_0xd2f1('0x47')](_0x5eccf2[_0xd2f1('0x43')],{'$or':_[_0xd2f1('0x34')](_0x5eccf2[_0xd2f1('0x3e')],function(_0x2a2e00){var _0x1f7e84={};_0x1f7e84[_0x2a2e00]={'$like':'%'+_0x3c5c09[_0xd2f1('0x3a')][_0xd2f1('0x44')]+'%'};return _0x1f7e84;})});}_0x5eccf2=_[_0xd2f1('0x47')]({},_0x5eccf2,_0x3c5c09[_0xd2f1('0x48')]);return db[_0xd2f1('0x5b')][_0xd2f1('0x4b')](_0x5eccf2);}})['then'](function(_0x5755ca){if(_0x5755ca){return db[_0xd2f1('0x5f')][_0xd2f1('0x60')]({'where':{'id':_[_0xd2f1('0x34')](_0x5755ca,_0xd2f1('0x61')),'role':'agent'},'attributes':['id',_0xd2f1('0x31'),_0xd2f1('0x62'),_0xd2f1('0x63'),'createdAt']});}})[_0xd2f1('0x29')](function(_0x1300fb){if(_0x1300fb){return{'count':_0x1300fb[_0xd2f1('0x22')],'rows':_[_0xd2f1('0x34')](_0x1300fb[_0xd2f1('0x64')],function(_0x255d8e){return{'membername':_0x255d8e[_0xd2f1('0x31')],'UserId':_0x255d8e['id'],'queue_name':_0x5f4f07[_0xd2f1('0x31')],'WhatsappQueueId':_0x5f4f07['id'],'interface':util[_0xd2f1('0x65')](_0xd2f1('0x66'),_0xd2f1('0x67'),_0x255d8e[_0xd2f1('0x31')]),'penalty':0x0,'paused':_0x255d8e['whatsappPause'],'createdAt':_0x255d8e[_0xd2f1('0x68')],'updatedAt':_0x255d8e[_0xd2f1('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd2f1('0x29')](respondWithFilteredResult(_0x1dcbcc,_0x5eccf2))[_0xd2f1('0x4d')](handleError(_0x1dcbcc,null));};exports[_0xd2f1('0x69')]=function(_0x28788f,_0x2ee4dd,_0x174419){var _0x34f417={};var _0x5f12db={};var _0x2e11f1;var _0x3c5b1a;return db[_0xd2f1('0x35')][_0xd2f1('0x5a')]({'where':{'id':_0x28788f[_0xd2f1('0x57')]['id']}})[_0xd2f1('0x29')](handleEntityNotFound(_0x2ee4dd,null))[_0xd2f1('0x29')](function(_0x47a631){if(_0x47a631){_0x2e11f1=_0x47a631;_0x5f12db[_0xd2f1('0x39')]=_[_0xd2f1('0x3b')](db[_0xd2f1('0x6a')]['rawAttributes']);_0x5f12db[_0xd2f1('0x3a')]=_[_0xd2f1('0x3b')](_0x28788f[_0xd2f1('0x3a')]);_0x5f12db['filters']=_['intersection'](_0x5f12db[_0xd2f1('0x39')],_0x5f12db[_0xd2f1('0x3a')]);_0x34f417[_0xd2f1('0x3e')]=_[_0xd2f1('0x3d')](_0x5f12db['model'],qs[_0xd2f1('0x3f')](_0x28788f[_0xd2f1('0x3a')][_0xd2f1('0x3f')]));_0x34f417[_0xd2f1('0x3e')]=_0x34f417[_0xd2f1('0x3e')][_0xd2f1('0x40')]?_0x34f417['attributes']:_0x5f12db[_0xd2f1('0x39')];_0x34f417[_0xd2f1('0x5d')]=qs[_0xd2f1('0x42')](_0x28788f[_0xd2f1('0x3a')]['sort']);_0x34f417[_0xd2f1('0x43')]=qs[_0xd2f1('0x3c')](_[_0xd2f1('0x6b')](_0x28788f['query'],_0x5f12db[_0xd2f1('0x3c')]));if(_0x28788f[_0xd2f1('0x3a')][_0xd2f1('0x44')]){_0x34f417[_0xd2f1('0x43')]=_['merge'](_0x34f417['where'],{'$or':_[_0xd2f1('0x34')](_0x34f417[_0xd2f1('0x3e')],function(_0x14d85a){var _0x7c5400={};_0x7c5400[_0x14d85a]={'$like':'%'+_0x28788f['query'][_0xd2f1('0x44')]+'%'};return _0x7c5400;})});}_0x34f417=_[_0xd2f1('0x47')]({},_0x34f417,_0x28788f['options']);return _0x2e11f1[_0xd2f1('0x69')](_0x34f417);}})[_0xd2f1('0x29')](function(_0x3569eb){if(_0x3569eb){_0x3c5b1a=_0x3569eb[_0xd2f1('0x40')];if(!_0x28788f[_0xd2f1('0x3a')][_0xd2f1('0x5c')]('nolimit')){_0x34f417[_0xd2f1('0x23')]=qs[_0xd2f1('0x23')](_0x28788f[_0xd2f1('0x3a')][_0xd2f1('0x23')]);_0x34f417[_0xd2f1('0x20')]=qs['offset'](_0x28788f['query']['offset']);}return _0x2e11f1[_0xd2f1('0x69')](_0x34f417);}})['then'](function(_0x39edf9){if(_0x39edf9){return _0x39edf9?{'count':_0x3c5b1a,'rows':_0x39edf9}:null;}})[_0xd2f1('0x29')](respondWithResult(_0x2ee4dd,null))[_0xd2f1('0x4d')](handleError(_0x2ee4dd,null));};exports[_0xd2f1('0x6c')]=function(_0x1e2e79,_0xb7bde1,_0x14f2ba){var _0x2939ec=_0x1e2e79[_0xd2f1('0x4f')][_0xd2f1('0x6d')];return db['Team'][_0xd2f1('0x4b')]({'where':{'id':_0x2939ec},'attributes':['id'],'include':[{'model':db[_0xd2f1('0x5f')],'as':'Agents','attributes':['id',_0xd2f1('0x31'),_0xd2f1('0x6e'),_0xd2f1('0x6f'),_0xd2f1('0x70')],'raw':!![]}]})[_0xd2f1('0x29')](function(_0x373e23){if(_0x373e23){var _0x112a0b=_[_0xd2f1('0x71')](_0x373e23,function(_0x4ce742){var _0x3f2b71=_0x4ce742[_0xd2f1('0x51')]({'plain':!![]});return _0x3f2b71[_0xd2f1('0x72')];});return db['WhatsappQueue'][_0xd2f1('0x56')]({'where':{'id':_0x1e2e79['params']['id']}})[_0xd2f1('0x29')](function(_0x4d9d70){return db[_0xd2f1('0x73')][_0xd2f1('0x74')](function(_0x1aae11){return _0x4d9d70[_0xd2f1('0x6c')](_0x2939ec,{'transaction':_0x1aae11})[_0xd2f1('0x29')](function(){return BPromise['each'](_0x112a0b,function(_0xb559fd){return db[_0xd2f1('0x5b')][_0xd2f1('0x75')]({'where':{'UserId':_0xb559fd['id'],'WhatsappQueueId':_0x1e2e79['params']['id']},'transaction':_0x1aae11});});})['then'](function(){_0x112a0b['forEach'](function(_0x5c8edb){socket[_0xd2f1('0x76')](_0xd2f1('0x77'),{'UserId':_0x5c8edb['id'],'WhatsappQueueId':_0x4d9d70['id']});});});});});}})['then'](respondWithStatusCode(_0xb7bde1,null))[_0xd2f1('0x4d')](handleError(_0xb7bde1,null));};exports['removeTeams']=function(_0x5c4fe7,_0x1e4678,_0x186d5b){return db['Team'][_0xd2f1('0x4b')]({'where':{'id':_0x5c4fe7[_0xd2f1('0x3a')][_0xd2f1('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xd2f1('0x5f')],'as':_0xd2f1('0x72'),'attributes':['id'],'raw':!![]}]})[_0xd2f1('0x29')](handleEntityNotFound(_0x1e4678,null))[_0xd2f1('0x29')](function(_0x377b69){var _0x21e586=_[_0xd2f1('0x34')](_0x377b69,'id');var _0x493f0a=[];var _0x378046=[];var _0x346012=squel[_0xd2f1('0x78')]();_0x346012[_0xd2f1('0x79')](_0xd2f1('0x7a'))[_0xd2f1('0x7b')](_0xd2f1('0x7c'),'tq')['join']('user_has_teams','ut',_0xd2f1('0x7d'))['where'](_0xd2f1('0x7e'),_0x5c4fe7[_0xd2f1('0x57')]['id']);for(var _0x4bdc41=0x0;_0x4bdc41<_0x377b69['length'];_0x4bdc41+=0x1){let _0x3c50ea=_0x377b69[_0x4bdc41];for(var _0xcf4a20=0x0;_0xcf4a20<_0x3c50ea[_0xd2f1('0x72')][_0xd2f1('0x40')];_0xcf4a20+=0x1){let _0x1c32c3=_0x3c50ea[_0xd2f1('0x72')][_0xcf4a20];var _0x376993=_0x346012['clone']();_0x376993['where'](_0xd2f1('0x7f'),_0x1c32c3['id']);_0x378046[_0xd2f1('0x80')](db['sequelize'][_0xd2f1('0x3a')](_0x376993[_0xd2f1('0x81')](),{'type':db[_0xd2f1('0x73')][_0xd2f1('0x82')][_0xd2f1('0x83')]})[_0xd2f1('0x29')](function(_0x53d123){if(_0x53d123[_0xd2f1('0x40')]===0x1){return _0x1c32c3['id'];}else{var _0x51ea2d=_[_0xd2f1('0x84')](_[_0xd2f1('0x34')](_0x53d123,_0xd2f1('0x85')),function(_0x38bef6){return _[_0xd2f1('0x86')](_0x21e586,_0x38bef6);});if(_0x51ea2d){return _0x1c32c3['id'];}}}));}}return BPromise[_0xd2f1('0x87')](_0x378046)[_0xd2f1('0x29')](function(_0x24ba2d){_0x493f0a=_(_0x493f0a)[_0xd2f1('0x88')](_0x24ba2d)[_0xd2f1('0x89')]()['value']();return db[_0xd2f1('0x35')][_0xd2f1('0x56')]({'where':{'id':_0x5c4fe7[_0xd2f1('0x57')]['id']}})[_0xd2f1('0x29')](function(_0xaf6140){return db[_0xd2f1('0x73')][_0xd2f1('0x74')](function(_0x31181a){return _0xaf6140['removeTeams'](_0x5c4fe7[_0xd2f1('0x3a')][_0xd2f1('0x6d')],{'transaction':_0x31181a})[_0xd2f1('0x29')](function(){if(!_[_0xd2f1('0x8a')](_0x493f0a)){return _0xaf6140[_0xd2f1('0x8b')](_0x493f0a,{'transaction':_0x31181a});}})['then'](function(){_0x493f0a[_0xd2f1('0x8c')](function(_0x2861ba){socket[_0xd2f1('0x76')](_0xd2f1('0x8d'),{'UserId':_0x2861ba,'WhatsappQueueId':_0xaf6140['id']});});});});});});})[_0xd2f1('0x29')](respondWithStatusCode(_0x1e4678,null))[_0xd2f1('0x4d')](handleError(_0x1e4678,null));};exports[_0xd2f1('0x8e')]=function(_0x2aa3fc,_0x116cb0,_0x1ceaa9){return db[_0xd2f1('0x35')][_0xd2f1('0x56')]({'where':{'id':_0x2aa3fc[_0xd2f1('0x57')]['id']}})['then'](handleEntityNotFound(_0x116cb0,null))[_0xd2f1('0x29')](function(_0x48ada2){if(_0x48ada2){return _0x48ada2[_0xd2f1('0x8e')](_0x2aa3fc[_0xd2f1('0x4f')][_0xd2f1('0x6d')],_[_0xd2f1('0x8f')](_0x2aa3fc[_0xd2f1('0x4f')],[_0xd2f1('0x6d'),'id'])||{})[_0xd2f1('0x90')](function(_0x1424d2){for(var _0x445831=0x0;_0x445831<_0x2aa3fc[_0xd2f1('0x4f')][_0xd2f1('0x6d')]['length'];_0x445831+=0x1){socket['emit'](_0xd2f1('0x77'),{'UserId':Number(_0x2aa3fc[_0xd2f1('0x4f')][_0xd2f1('0x6d')][_0x445831]),'WhatsappQueueId':Number(_0x2aa3fc[_0xd2f1('0x57')]['id'])});}return _0x1424d2;});}})[_0xd2f1('0x29')](respondWithResult(_0x116cb0,null))[_0xd2f1('0x4d')](handleError(_0x116cb0,null));};exports[_0xd2f1('0x8b')]=function(_0x333334,_0x5e5ad6,_0x353cfe){return db[_0xd2f1('0x35')]['find']({'where':{'id':_0x333334[_0xd2f1('0x57')]['id']}})['then'](handleEntityNotFound(_0x5e5ad6,null))[_0xd2f1('0x29')](function(_0x3924b4){if(_0x3924b4){return _0x3924b4[_0xd2f1('0x8b')](_0x333334[_0xd2f1('0x3a')]['ids'])[_0xd2f1('0x29')](function(){if(_[_0xd2f1('0x91')](_0x333334['query'][_0xd2f1('0x6d')])){for(var _0xc8e771=0x0;_0xc8e771<_0x333334[_0xd2f1('0x3a')][_0xd2f1('0x6d')][_0xd2f1('0x40')];_0xc8e771+=0x1){socket[_0xd2f1('0x76')]('userWhatsappQueue:remove',{'UserId':Number(_0x333334['query'][_0xd2f1('0x6d')][_0xc8e771]),'WhatsappQueueId':Number(_0x333334[_0xd2f1('0x57')]['id'])});}}else{socket['emit'](_0xd2f1('0x8d'),{'UserId':Number(_0x333334[_0xd2f1('0x3a')][_0xd2f1('0x6d')]),'WhatsappQueueId':Number(_0x333334[_0xd2f1('0x57')]['id'])});}});}})[_0xd2f1('0x29')](respondWithStatusCode(_0x5e5ad6,null))[_0xd2f1('0x4d')](handleError(_0x5e5ad6,null));};exports[_0xd2f1('0x92')]=function(_0x1dbe60,_0x16c75e,_0x1488cb){var _0x5a87ba={};var _0x15a2f4={};var _0x33117c;var _0x58e195;return db[_0xd2f1('0x35')][_0xd2f1('0x5a')]({'where':{'id':_0x1dbe60['params']['id']}})[_0xd2f1('0x29')](handleEntityNotFound(_0x16c75e,null))[_0xd2f1('0x29')](function(_0x2b3927){if(_0x2b3927){_0x33117c=_0x2b3927;_0x15a2f4[_0xd2f1('0x39')]=_['keys'](db[_0xd2f1('0x5f')][_0xd2f1('0x36')]);_0x15a2f4['query']=_[_0xd2f1('0x3b')](_0x1dbe60['query']);_0x15a2f4['filters']=_[_0xd2f1('0x3d')](_0x15a2f4[_0xd2f1('0x39')],_0x15a2f4[_0xd2f1('0x3a')]);_0x5a87ba[_0xd2f1('0x3e')]=_['intersection'](_0x15a2f4[_0xd2f1('0x39')],qs['fields'](_0x1dbe60[_0xd2f1('0x3a')][_0xd2f1('0x3f')]));_0x5a87ba[_0xd2f1('0x3e')]=_0x5a87ba[_0xd2f1('0x3e')]['length']?_0x5a87ba[_0xd2f1('0x3e')]:_0x15a2f4[_0xd2f1('0x39')];_0x5a87ba[_0xd2f1('0x5d')]=qs[_0xd2f1('0x42')](_0x1dbe60['query'][_0xd2f1('0x42')]);_0x5a87ba[_0xd2f1('0x43')]=qs[_0xd2f1('0x3c')](_[_0xd2f1('0x6b')](_0x1dbe60[_0xd2f1('0x3a')],_0x15a2f4['filters']));if(_0x1dbe60[_0xd2f1('0x3a')]['filter']){_0x5a87ba[_0xd2f1('0x43')]=_['merge'](_0x5a87ba[_0xd2f1('0x43')],{'$or':_[_0xd2f1('0x34')](_0x5a87ba[_0xd2f1('0x3e')],function(_0x5b20f9){var _0x1819e7={};_0x1819e7[_0x5b20f9]={'$like':'%'+_0x1dbe60[_0xd2f1('0x3a')][_0xd2f1('0x44')]+'%'};return _0x1819e7;})});}_0x5a87ba=_[_0xd2f1('0x47')]({},_0x5a87ba,_0x1dbe60[_0xd2f1('0x48')]);return _0x33117c[_0xd2f1('0x92')](_0x5a87ba);}})['then'](function(_0xcdf8c9){if(_0xcdf8c9){_0x58e195=_0xcdf8c9[_0xd2f1('0x40')];if(!_0x1dbe60[_0xd2f1('0x3a')][_0xd2f1('0x5c')](_0xd2f1('0x41'))){_0x5a87ba[_0xd2f1('0x23')]=qs[_0xd2f1('0x23')](_0x1dbe60['query'][_0xd2f1('0x23')]);_0x5a87ba[_0xd2f1('0x20')]=qs[_0xd2f1('0x20')](_0x1dbe60['query'][_0xd2f1('0x20')]);}return _0x33117c[_0xd2f1('0x92')](_0x5a87ba);}})[_0xd2f1('0x29')](function(_0x213768){if(_0x213768){return _0x213768?{'count':_0x58e195,'rows':_0x213768}:null;}})['then'](respondWithResult(_0x16c75e,null))[_0xd2f1('0x4d')](handleError(_0x16c75e,null));}; \ No newline at end of file +var _0x8001=['includes','all','union','compact','value','removeTeams','isEmpty','emit','userWhatsappQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','WhatsappQueues','UserProfileResource','stack','name','send','map','WhatsappQueue','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','describe','getMembers','findOne','UserWhatsappQueue','sort','WhatsappQueueId','User','UserId','agent','updatedAt','format','%s/%s','whatsappPause','createdAt','getTeams','Team','hasOwnProperty','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','userWhatsappQueue:save','select','field','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x8001,0x137));var _0x1800=function(_0x20ec6c,_0x3add31){_0x20ec6c=_0x20ec6c-0x0;var _0x2b1fa9=_0x8001[_0x20ec6c];return _0x2b1fa9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1800('0x0'));var zipdir=require(_0x1800('0x1'));var jsonpatch=require(_0x1800('0x2'));var rp=require(_0x1800('0x3'));var moment=require('moment');var BPromise=require(_0x1800('0x4'));var Mustache=require(_0x1800('0x5'));var util=require(_0x1800('0x6'));var path=require('path');var sox=require(_0x1800('0x7'));var csv=require('to-csv');var ejs=require(_0x1800('0x8'));var fs=require('fs');var fs_extra=require(_0x1800('0x9'));var _=require(_0x1800('0xa'));var squel=require(_0x1800('0xb'));var crypto=require(_0x1800('0xc'));var jsforce=require(_0x1800('0xd'));var deskjs=require(_0x1800('0xe'));var toCsv=require(_0x1800('0xf'));var querystring=require(_0x1800('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1800('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1800('0x12'));var logger=require(_0x1800('0x13'))(_0x1800('0x14'));var utils=require(_0x1800('0x15'));var config=require(_0x1800('0x16'));var licenseUtil=require(_0x1800('0x17'));var db=require(_0x1800('0x18'))['db'];config['redis']=_[_0x1800('0x19')](config[_0x1800('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x1800('0x1b'))(new Redis(config[_0x1800('0x1a')]));require(_0x1800('0x1c'))[_0x1800('0x1d')](socket);function respondWithStatusCode(_0x3e67d4,_0x3239f5){_0x3239f5=_0x3239f5||0xcc;return function(_0x5030bd){if(_0x5030bd){return _0x3e67d4[_0x1800('0x1e')](_0x3239f5);}return _0x3e67d4[_0x1800('0x1f')](_0x3239f5)[_0x1800('0x20')]();};}function respondWithResult(_0x4d7622,_0x614b25){_0x614b25=_0x614b25||0xc8;return function(_0x2d5eb4){if(_0x2d5eb4){return _0x4d7622[_0x1800('0x1f')](_0x614b25)['json'](_0x2d5eb4);}};}function respondWithFilteredResult(_0x1c102d,_0x3fa1f8){return function(_0x138f12){if(_0x138f12){var _0x19879b=typeof _0x3fa1f8[_0x1800('0x21')]===_0x1800('0x22')&&typeof _0x3fa1f8['limit']===_0x1800('0x22');var _0x21e715=_0x138f12['count'];var _0x107f8b=_0x19879b?0x0:_0x3fa1f8[_0x1800('0x21')];var _0x7f30b=_0x19879b?_0x138f12[_0x1800('0x23')]:_0x3fa1f8[_0x1800('0x21')]+_0x3fa1f8[_0x1800('0x24')];var _0x5ba888;if(_0x7f30b>=_0x21e715){_0x7f30b=_0x21e715;_0x5ba888=0xc8;}else{_0x5ba888=0xce;}_0x1c102d[_0x1800('0x1f')](_0x5ba888);return _0x1c102d[_0x1800('0x25')](_0x1800('0x26'),_0x107f8b+'-'+_0x7f30b+'/'+_0x21e715)[_0x1800('0x27')](_0x138f12);}return null;};}function patchUpdates(_0x25a393){return function(_0x4f8295){try{jsonpatch[_0x1800('0x28')](_0x4f8295,_0x25a393,!![]);}catch(_0x5af136){return BPromise[_0x1800('0x29')](_0x5af136);}return _0x4f8295[_0x1800('0x2a')]();};}function saveUpdates(_0x21f3e2,_0x5126b6){return function(_0x478053){if(_0x478053){return _0x478053['update'](_0x21f3e2)[_0x1800('0x2b')](function(_0x11dbc9){return _0x11dbc9;});}return null;};}function removeEntity(_0x410867,_0x36172c){return function(_0x8095b8){if(_0x8095b8){return _0x8095b8[_0x1800('0x2c')]()[_0x1800('0x2b')](function(){var _0x34bf0f=_0x8095b8[_0x1800('0x2d')]({'plain':!![]});var _0x170015=_0x1800('0x2e');return db[_0x1800('0x2f')]['destroy']({'where':{'type':_0x170015,'resourceId':_0x34bf0f['id']}})['then'](function(){return _0x8095b8;});})[_0x1800('0x2b')](function(){_0x410867[_0x1800('0x1f')](0xcc)[_0x1800('0x20')]();});}};}function handleEntityNotFound(_0x220021,_0x481b02){return function(_0x3c8558){if(!_0x3c8558){_0x220021[_0x1800('0x1e')](0x194);}return _0x3c8558;};}function handleError(_0x44e9df,_0x1c1e41){_0x1c1e41=_0x1c1e41||0x1f4;return function(_0x240a7c){logger['error'](_0x240a7c[_0x1800('0x30')]);if(_0x240a7c[_0x1800('0x31')]){delete _0x240a7c['name'];}_0x44e9df[_0x1800('0x1f')](_0x1c1e41)[_0x1800('0x32')](_0x240a7c);};}exports['index']=function(_0x530de1,_0x4e0380){var _0x51dbd0={},_0x31b2e7={},_0x192105={'count':0x0,'rows':[]};var _0x1c11b3=_[_0x1800('0x33')](db[_0x1800('0x34')]['rawAttributes'],function(_0x51c7f9){return{'name':_0x51c7f9[_0x1800('0x35')],'type':_0x51c7f9[_0x1800('0x36')][_0x1800('0x37')]};});_0x31b2e7[_0x1800('0x38')]=_['map'](_0x1c11b3,'name');_0x31b2e7[_0x1800('0x39')]=_[_0x1800('0x3a')](_0x530de1[_0x1800('0x39')]);_0x31b2e7[_0x1800('0x3b')]=_[_0x1800('0x3c')](_0x31b2e7[_0x1800('0x38')],_0x31b2e7['query']);_0x51dbd0['attributes']=_['intersection'](_0x31b2e7[_0x1800('0x38')],qs[_0x1800('0x3d')](_0x530de1[_0x1800('0x39')][_0x1800('0x3d')]));_0x51dbd0[_0x1800('0x3e')]=_0x51dbd0[_0x1800('0x3e')][_0x1800('0x3f')]?_0x51dbd0['attributes']:_0x31b2e7[_0x1800('0x38')];if(!_0x530de1['query']['hasOwnProperty'](_0x1800('0x40'))){_0x51dbd0[_0x1800('0x24')]=qs[_0x1800('0x24')](_0x530de1[_0x1800('0x39')][_0x1800('0x24')]);_0x51dbd0[_0x1800('0x21')]=qs[_0x1800('0x21')](_0x530de1[_0x1800('0x39')]['offset']);}_0x51dbd0[_0x1800('0x41')]=qs['sort'](_0x530de1['query']['sort']);_0x51dbd0[_0x1800('0x42')]=qs['filters'](_[_0x1800('0x43')](_0x530de1['query'],_0x31b2e7[_0x1800('0x3b')]),_0x1c11b3);if(_0x530de1['query'][_0x1800('0x44')]){_0x51dbd0['where']=_[_0x1800('0x45')](_0x51dbd0[_0x1800('0x42')],{'$or':_['map'](_0x1c11b3,function(_0x30974c){if(_0x30974c[_0x1800('0x36')]!=='VIRTUAL'){var _0x1fdeac={};_0x1fdeac[_0x30974c[_0x1800('0x31')]]={'$like':'%'+_0x530de1[_0x1800('0x39')][_0x1800('0x44')]+'%'};return _0x1fdeac;}})});}_0x51dbd0=_['merge']({},_0x51dbd0,_0x530de1[_0x1800('0x46')]);var _0x31c8a6={'where':_0x51dbd0[_0x1800('0x42')]};return db[_0x1800('0x34')][_0x1800('0x23')](_0x31c8a6)[_0x1800('0x2b')](function(_0x22abbb){_0x192105[_0x1800('0x23')]=_0x22abbb;if(_0x530de1[_0x1800('0x39')][_0x1800('0x47')]){_0x51dbd0[_0x1800('0x48')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x1800('0x49')](_0x51dbd0);})[_0x1800('0x2b')](function(_0x1be120){_0x192105[_0x1800('0x4a')]=_0x1be120;return _0x192105;})['then'](respondWithFilteredResult(_0x4e0380,_0x51dbd0))['catch'](handleError(_0x4e0380,null));};exports[_0x1800('0x4b')]=function(_0x20fcc7,_0x1e0287){var _0x4003d6={'raw':!![],'where':{'id':_0x20fcc7['params']['id']}},_0x42908d={};_0x42908d['model']=_[_0x1800('0x3a')](db[_0x1800('0x34')][_0x1800('0x4c')]);_0x42908d[_0x1800('0x39')]=_[_0x1800('0x3a')](_0x20fcc7[_0x1800('0x39')]);_0x42908d[_0x1800('0x3b')]=_['intersection'](_0x42908d[_0x1800('0x38')],_0x42908d['query']);_0x4003d6[_0x1800('0x3e')]=_['intersection'](_0x42908d[_0x1800('0x38')],qs['fields'](_0x20fcc7[_0x1800('0x39')][_0x1800('0x3d')]));_0x4003d6['attributes']=_0x4003d6[_0x1800('0x3e')]['length']?_0x4003d6[_0x1800('0x3e')]:_0x42908d[_0x1800('0x38')];if(_0x20fcc7[_0x1800('0x39')][_0x1800('0x47')]){_0x4003d6[_0x1800('0x48')]=[{'all':!![]}];}_0x4003d6=_[_0x1800('0x45')]({},_0x4003d6,_0x20fcc7[_0x1800('0x46')]);return db[_0x1800('0x34')][_0x1800('0x4d')](_0x4003d6)[_0x1800('0x2b')](handleEntityNotFound(_0x1e0287,null))[_0x1800('0x2b')](respondWithResult(_0x1e0287,null))['catch'](handleError(_0x1e0287,null));};exports['create']=function(_0x2b36a9,_0x12159f){return db[_0x1800('0x34')][_0x1800('0x4e')](_0x2b36a9['body'],{})['then'](function(_0x3b8402){var _0x53b311=_0x2b36a9[_0x1800('0x4f')]['get']({'plain':!![]});if(!_0x53b311)throw new Error(_0x1800('0x50'));if(_0x53b311[_0x1800('0x51')]==='user'){var _0x6b1275=_0x3b8402[_0x1800('0x2d')]({'plain':!![]});var _0x5deb61=_0x1800('0x2e');return db[_0x1800('0x52')][_0x1800('0x4d')]({'where':{'name':_0x5deb61,'userProfileId':_0x53b311[_0x1800('0x53')]},'raw':!![]})[_0x1800('0x2b')](function(_0x2f013c){if(_0x2f013c&&_0x2f013c[_0x1800('0x54')]===0x0){return db['UserProfileResource'][_0x1800('0x4e')]({'name':_0x6b1275[_0x1800('0x31')],'resourceId':_0x6b1275['id'],'type':_0x2f013c[_0x1800('0x31')],'sectionId':_0x2f013c['id']},{})[_0x1800('0x2b')](function(){return _0x3b8402;});}else{return _0x3b8402;}})[_0x1800('0x55')](function(_0x290d4c){logger[_0x1800('0x56')](_0x1800('0x57'),_0x290d4c);throw _0x290d4c;});}return _0x3b8402;})['then'](respondWithResult(_0x12159f,0xc9))['catch'](handleError(_0x12159f,null));};exports[_0x1800('0x58')]=function(_0x13cc21,_0x2fbc62){if(_0x13cc21[_0x1800('0x59')]['id']){delete _0x13cc21[_0x1800('0x59')]['id'];}return db['WhatsappQueue'][_0x1800('0x4d')]({'where':{'id':_0x13cc21['params']['id']}})[_0x1800('0x2b')](handleEntityNotFound(_0x2fbc62,null))[_0x1800('0x2b')](saveUpdates(_0x13cc21['body'],null))[_0x1800('0x2b')](respondWithResult(_0x2fbc62,null))[_0x1800('0x55')](handleError(_0x2fbc62,null));};exports[_0x1800('0x2c')]=function(_0x1cd169,_0x1bbad9){return db[_0x1800('0x34')][_0x1800('0x4d')]({'where':{'id':_0x1cd169[_0x1800('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1bbad9,null))[_0x1800('0x2b')](removeEntity(_0x1bbad9,null))[_0x1800('0x55')](handleError(_0x1bbad9,null));};exports[_0x1800('0x5b')]=function(_0x326c4d,_0x1b6171){return db['WhatsappQueue']['describe']()[_0x1800('0x2b')](respondWithResult(_0x1b6171,null))[_0x1800('0x55')](handleError(_0x1b6171,null));};exports[_0x1800('0x5c')]=function(_0x426c85,_0x333fec,_0x360ae6){var _0x502f14={'raw':!![],'where':{}},_0x51357b={},_0x5da2fd;return db['WhatsappQueue'][_0x1800('0x5d')]({'where':{'id':_0x426c85['params']['id']}})[_0x1800('0x2b')](handleEntityNotFound(_0x333fec,null))[_0x1800('0x2b')](function(_0xc382e){if(_0xc382e){_0x5da2fd=_0xc382e[_0x1800('0x2d')]({'plain':!![]});_0x51357b['model']=_[_0x1800('0x3a')](db[_0x1800('0x5e')][_0x1800('0x4c')]);_0x51357b['query']=_[_0x1800('0x3a')](_0x426c85['query']);_0x51357b[_0x1800('0x3b')]=_[_0x1800('0x3c')](_0x51357b[_0x1800('0x38')],_0x51357b[_0x1800('0x39')]);_0x502f14[_0x1800('0x3e')]=_['intersection'](_0x51357b[_0x1800('0x38')],qs[_0x1800('0x3d')](_0x426c85[_0x1800('0x39')]['fields']));_0x502f14[_0x1800('0x3e')]=_0x502f14['attributes'][_0x1800('0x3f')]?_0x502f14['attributes']:_0x51357b['model'];if(!_0x426c85['query']['hasOwnProperty'](_0x1800('0x40'))){_0x502f14[_0x1800('0x24')]=qs[_0x1800('0x24')](_0x426c85[_0x1800('0x39')]['limit']);_0x502f14[_0x1800('0x21')]=qs[_0x1800('0x21')](_0x426c85['query'][_0x1800('0x21')]);}_0x502f14[_0x1800('0x41')]=qs[_0x1800('0x5f')](_0x426c85[_0x1800('0x39')][_0x1800('0x5f')]);_0x502f14[_0x1800('0x42')]=qs[_0x1800('0x3b')](_['pick'](_0x426c85[_0x1800('0x39')],_0x51357b['filters']));_0x502f14[_0x1800('0x42')][_0x1800('0x60')]=_0xc382e['id'];if(_0x426c85[_0x1800('0x39')][_0x1800('0x44')]){_0x502f14[_0x1800('0x42')]=_['merge'](_0x502f14['where'],{'$or':_['map'](_0x502f14[_0x1800('0x3e')],function(_0x42f9b1){var _0x2240a2={};_0x2240a2[_0x42f9b1]={'$like':'%'+_0x426c85['query'][_0x1800('0x44')]+'%'};return _0x2240a2;})});}_0x502f14=_[_0x1800('0x45')]({},_0x502f14,_0x426c85[_0x1800('0x46')]);return db['UserWhatsappQueue'][_0x1800('0x49')](_0x502f14);}})[_0x1800('0x2b')](function(_0x5ac519){if(_0x5ac519){return db[_0x1800('0x61')]['findAndCountAll']({'where':{'id':_['map'](_0x5ac519,_0x1800('0x62')),'role':_0x1800('0x63')},'attributes':['id',_0x1800('0x31'),'whatsappPause',_0x1800('0x64'),'createdAt']});}})[_0x1800('0x2b')](function(_0x72882c){if(_0x72882c){return{'count':_0x72882c[_0x1800('0x23')],'rows':_[_0x1800('0x33')](_0x72882c['rows'],function(_0x26f791){return{'membername':_0x26f791[_0x1800('0x31')],'UserId':_0x26f791['id'],'queue_name':_0x5da2fd[_0x1800('0x31')],'WhatsappQueueId':_0x5da2fd['id'],'interface':util[_0x1800('0x65')](_0x1800('0x66'),'SIP',_0x26f791[_0x1800('0x31')]),'penalty':0x0,'paused':_0x26f791[_0x1800('0x67')],'createdAt':_0x26f791[_0x1800('0x68')],'updatedAt':_0x26f791['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x1800('0x2b')](respondWithFilteredResult(_0x333fec,_0x502f14))['catch'](handleError(_0x333fec,null));};exports[_0x1800('0x69')]=function(_0x15b61f,_0x93ed15,_0x33812b){var _0x590d2={};var _0x4b8400={};var _0x2bcd87;var _0xc2c162;return db[_0x1800('0x34')][_0x1800('0x5d')]({'where':{'id':_0x15b61f['params']['id']}})[_0x1800('0x2b')](handleEntityNotFound(_0x93ed15,null))['then'](function(_0x476c02){if(_0x476c02){_0x2bcd87=_0x476c02;_0x4b8400[_0x1800('0x38')]=_[_0x1800('0x3a')](db[_0x1800('0x6a')][_0x1800('0x4c')]);_0x4b8400[_0x1800('0x39')]=_['keys'](_0x15b61f[_0x1800('0x39')]);_0x4b8400[_0x1800('0x3b')]=_[_0x1800('0x3c')](_0x4b8400[_0x1800('0x38')],_0x4b8400[_0x1800('0x39')]);_0x590d2[_0x1800('0x3e')]=_[_0x1800('0x3c')](_0x4b8400['model'],qs['fields'](_0x15b61f['query'][_0x1800('0x3d')]));_0x590d2[_0x1800('0x3e')]=_0x590d2['attributes']['length']?_0x590d2[_0x1800('0x3e')]:_0x4b8400['model'];_0x590d2[_0x1800('0x41')]=qs[_0x1800('0x5f')](_0x15b61f[_0x1800('0x39')]['sort']);_0x590d2[_0x1800('0x42')]=qs['filters'](_['pick'](_0x15b61f[_0x1800('0x39')],_0x4b8400['filters']));if(_0x15b61f[_0x1800('0x39')][_0x1800('0x44')]){_0x590d2[_0x1800('0x42')]=_[_0x1800('0x45')](_0x590d2[_0x1800('0x42')],{'$or':_['map'](_0x590d2[_0x1800('0x3e')],function(_0x4781b4){var _0x330073={};_0x330073[_0x4781b4]={'$like':'%'+_0x15b61f[_0x1800('0x39')][_0x1800('0x44')]+'%'};return _0x330073;})});}_0x590d2=_[_0x1800('0x45')]({},_0x590d2,_0x15b61f[_0x1800('0x46')]);return _0x2bcd87[_0x1800('0x69')](_0x590d2);}})['then'](function(_0x1cf35b){if(_0x1cf35b){_0xc2c162=_0x1cf35b[_0x1800('0x3f')];if(!_0x15b61f[_0x1800('0x39')][_0x1800('0x6b')](_0x1800('0x40'))){_0x590d2[_0x1800('0x24')]=qs[_0x1800('0x24')](_0x15b61f['query'][_0x1800('0x24')]);_0x590d2[_0x1800('0x21')]=qs[_0x1800('0x21')](_0x15b61f[_0x1800('0x39')][_0x1800('0x21')]);}return _0x2bcd87['getTeams'](_0x590d2);}})['then'](function(_0x36905a){if(_0x36905a){return _0x36905a?{'count':_0xc2c162,'rows':_0x36905a}:null;}})[_0x1800('0x2b')](respondWithResult(_0x93ed15,null))[_0x1800('0x55')](handleError(_0x93ed15,null));};exports[_0x1800('0x6c')]=function(_0x489ef3,_0x22bd9c,_0x22cf06){var _0x20e2b4=_0x489ef3[_0x1800('0x59')][_0x1800('0x6d')];return db[_0x1800('0x6a')]['findAll']({'where':{'id':_0x20e2b4},'attributes':['id'],'include':[{'model':db[_0x1800('0x61')],'as':_0x1800('0x6e'),'attributes':['id',_0x1800('0x31'),_0x1800('0x6f'),_0x1800('0x70'),'interface'],'raw':!![]}]})[_0x1800('0x2b')](function(_0x142bab){if(_0x142bab){var _0x2a3737=_[_0x1800('0x71')](_0x142bab,function(_0x25a491){var _0x51452b=_0x25a491[_0x1800('0x2d')]({'plain':!![]});return _0x51452b[_0x1800('0x6e')];});return db[_0x1800('0x34')][_0x1800('0x4d')]({'where':{'id':_0x489ef3[_0x1800('0x5a')]['id']}})[_0x1800('0x2b')](function(_0x232675){return db[_0x1800('0x72')][_0x1800('0x73')](function(_0x318bd8){return _0x232675[_0x1800('0x6c')](_0x20e2b4,{'transaction':_0x318bd8})[_0x1800('0x2b')](function(){return BPromise[_0x1800('0x74')](_0x2a3737,function(_0xb6a1d0){return db[_0x1800('0x5e')][_0x1800('0x75')]({'where':{'UserId':_0xb6a1d0['id'],'WhatsappQueueId':_0x489ef3[_0x1800('0x5a')]['id']},'transaction':_0x318bd8});});})[_0x1800('0x2b')](function(){_0x2a3737[_0x1800('0x76')](function(_0x1bd686){socket['emit'](_0x1800('0x77'),{'UserId':_0x1bd686['id'],'WhatsappQueueId':_0x232675['id']});});});});});}})['then'](respondWithStatusCode(_0x22bd9c,null))[_0x1800('0x55')](handleError(_0x22bd9c,null));};exports['removeTeams']=function(_0x218767,_0x3a8b83,_0x265c1f){return db[_0x1800('0x6a')]['findAll']({'where':{'id':_0x218767[_0x1800('0x39')][_0x1800('0x6d')]},'attributes':['id'],'include':[{'model':db[_0x1800('0x61')],'as':_0x1800('0x6e'),'attributes':['id'],'raw':!![]}]})[_0x1800('0x2b')](handleEntityNotFound(_0x3a8b83,null))[_0x1800('0x2b')](function(_0x51fd28){var _0x4c1d77=_[_0x1800('0x33')](_0x51fd28,'id');var _0x2b2185=[];var _0x20fe75=[];var _0x2cc212=squel[_0x1800('0x78')]();_0x2cc212[_0x1800('0x79')]('tq.TeamId')[_0x1800('0x7a')](_0x1800('0x7b'),'tq')['join'](_0x1800('0x7c'),'ut',_0x1800('0x7d'))[_0x1800('0x42')](_0x1800('0x7e'),_0x218767['params']['id']);for(var _0x3c2632=0x0;_0x3c2632<_0x51fd28['length'];_0x3c2632+=0x1){let _0x176df1=_0x51fd28[_0x3c2632];for(var _0x128c31=0x0;_0x128c31<_0x176df1['Agents']['length'];_0x128c31+=0x1){let _0x3fccf3=_0x176df1[_0x1800('0x6e')][_0x128c31];var _0xd5e15b=_0x2cc212[_0x1800('0x7f')]();_0xd5e15b[_0x1800('0x42')](_0x1800('0x80'),_0x3fccf3['id']);_0x20fe75['push'](db['sequelize'][_0x1800('0x39')](_0xd5e15b['toString'](),{'type':db[_0x1800('0x72')][_0x1800('0x81')][_0x1800('0x82')]})[_0x1800('0x2b')](function(_0x4c0238){if(_0x4c0238['length']===0x1){return _0x3fccf3['id'];}else{var _0x297346=_[_0x1800('0x83')](_[_0x1800('0x33')](_0x4c0238,_0x1800('0x84')),function(_0x490ee5){return _[_0x1800('0x85')](_0x4c1d77,_0x490ee5);});if(_0x297346){return _0x3fccf3['id'];}}}));}}return BPromise[_0x1800('0x86')](_0x20fe75)['then'](function(_0x26c842){_0x2b2185=_(_0x2b2185)[_0x1800('0x87')](_0x26c842)[_0x1800('0x88')]()[_0x1800('0x89')]();return db[_0x1800('0x34')][_0x1800('0x4d')]({'where':{'id':_0x218767[_0x1800('0x5a')]['id']}})[_0x1800('0x2b')](function(_0xdd87d9){return db[_0x1800('0x72')][_0x1800('0x73')](function(_0x321bcf){return _0xdd87d9[_0x1800('0x8a')](_0x218767[_0x1800('0x39')][_0x1800('0x6d')],{'transaction':_0x321bcf})['then'](function(){if(!_[_0x1800('0x8b')](_0x2b2185)){return _0xdd87d9['removeAgents'](_0x2b2185,{'transaction':_0x321bcf});}})[_0x1800('0x2b')](function(){_0x2b2185['forEach'](function(_0x3ecf1d){socket[_0x1800('0x8c')](_0x1800('0x8d'),{'UserId':_0x3ecf1d,'WhatsappQueueId':_0xdd87d9['id']});});});});});});})[_0x1800('0x2b')](respondWithStatusCode(_0x3a8b83,null))[_0x1800('0x55')](handleError(_0x3a8b83,null));};exports['addAgents']=function(_0x18e274,_0xe824b3,_0x363edc){return db[_0x1800('0x34')][_0x1800('0x4d')]({'where':{'id':_0x18e274[_0x1800('0x5a')]['id']}})['then'](handleEntityNotFound(_0xe824b3,null))[_0x1800('0x2b')](function(_0x4268df){if(_0x4268df){return _0x4268df[_0x1800('0x8e')](_0x18e274[_0x1800('0x59')][_0x1800('0x6d')],_[_0x1800('0x8f')](_0x18e274[_0x1800('0x59')],[_0x1800('0x6d'),'id'])||{})[_0x1800('0x90')](function(_0x204145){for(var _0x21e643=0x0;_0x21e643<_0x18e274[_0x1800('0x59')][_0x1800('0x6d')][_0x1800('0x3f')];_0x21e643+=0x1){socket[_0x1800('0x8c')](_0x1800('0x77'),{'UserId':Number(_0x18e274[_0x1800('0x59')][_0x1800('0x6d')][_0x21e643]),'WhatsappQueueId':Number(_0x18e274[_0x1800('0x5a')]['id'])});}return _0x204145;});}})[_0x1800('0x2b')](respondWithResult(_0xe824b3,null))[_0x1800('0x55')](handleError(_0xe824b3,null));};exports['removeAgents']=function(_0x114ef9,_0x36290e,_0x3a937e){return db[_0x1800('0x34')]['find']({'where':{'id':_0x114ef9[_0x1800('0x5a')]['id']}})['then'](handleEntityNotFound(_0x36290e,null))[_0x1800('0x2b')](function(_0x599c7c){if(_0x599c7c){return _0x599c7c[_0x1800('0x91')](_0x114ef9['query'][_0x1800('0x6d')])[_0x1800('0x2b')](function(){if(_[_0x1800('0x92')](_0x114ef9['query'][_0x1800('0x6d')])){for(var _0x1fb1fc=0x0;_0x1fb1fc<_0x114ef9[_0x1800('0x39')][_0x1800('0x6d')][_0x1800('0x3f')];_0x1fb1fc+=0x1){socket[_0x1800('0x8c')](_0x1800('0x8d'),{'UserId':Number(_0x114ef9[_0x1800('0x39')][_0x1800('0x6d')][_0x1fb1fc]),'WhatsappQueueId':Number(_0x114ef9[_0x1800('0x5a')]['id'])});}}else{socket[_0x1800('0x8c')](_0x1800('0x8d'),{'UserId':Number(_0x114ef9[_0x1800('0x39')][_0x1800('0x6d')]),'WhatsappQueueId':Number(_0x114ef9['params']['id'])});}});}})['then'](respondWithStatusCode(_0x36290e,null))['catch'](handleError(_0x36290e,null));};exports['getAgents']=function(_0x553462,_0x23b0b6,_0x5ac6ec){var _0x189786={};var _0x30aabf={};var _0x43161b;var _0xf4c22b;return db[_0x1800('0x34')][_0x1800('0x5d')]({'where':{'id':_0x553462[_0x1800('0x5a')]['id']}})[_0x1800('0x2b')](handleEntityNotFound(_0x23b0b6,null))[_0x1800('0x2b')](function(_0x106c91){if(_0x106c91){_0x43161b=_0x106c91;_0x30aabf['model']=_['keys'](db[_0x1800('0x61')][_0x1800('0x4c')]);_0x30aabf[_0x1800('0x39')]=_[_0x1800('0x3a')](_0x553462[_0x1800('0x39')]);_0x30aabf['filters']=_[_0x1800('0x3c')](_0x30aabf[_0x1800('0x38')],_0x30aabf[_0x1800('0x39')]);_0x189786[_0x1800('0x3e')]=_[_0x1800('0x3c')](_0x30aabf[_0x1800('0x38')],qs['fields'](_0x553462[_0x1800('0x39')][_0x1800('0x3d')]));_0x189786[_0x1800('0x3e')]=_0x189786[_0x1800('0x3e')][_0x1800('0x3f')]?_0x189786[_0x1800('0x3e')]:_0x30aabf[_0x1800('0x38')];_0x189786[_0x1800('0x41')]=qs[_0x1800('0x5f')](_0x553462[_0x1800('0x39')][_0x1800('0x5f')]);_0x189786[_0x1800('0x42')]=qs[_0x1800('0x3b')](_[_0x1800('0x43')](_0x553462[_0x1800('0x39')],_0x30aabf[_0x1800('0x3b')]));if(_0x553462[_0x1800('0x39')][_0x1800('0x44')]){_0x189786[_0x1800('0x42')]=_[_0x1800('0x45')](_0x189786[_0x1800('0x42')],{'$or':_[_0x1800('0x33')](_0x189786[_0x1800('0x3e')],function(_0x28843d){var _0x474337={};_0x474337[_0x28843d]={'$like':'%'+_0x553462[_0x1800('0x39')][_0x1800('0x44')]+'%'};return _0x474337;})});}_0x189786=_[_0x1800('0x45')]({},_0x189786,_0x553462[_0x1800('0x46')]);return _0x43161b[_0x1800('0x93')](_0x189786);}})[_0x1800('0x2b')](function(_0x8b8c8b){if(_0x8b8c8b){_0xf4c22b=_0x8b8c8b[_0x1800('0x3f')];if(!_0x553462[_0x1800('0x39')][_0x1800('0x6b')](_0x1800('0x40'))){_0x189786[_0x1800('0x24')]=qs[_0x1800('0x24')](_0x553462[_0x1800('0x39')][_0x1800('0x24')]);_0x189786['offset']=qs[_0x1800('0x21')](_0x553462['query'][_0x1800('0x21')]);}return _0x43161b['getAgents'](_0x189786);}})[_0x1800('0x2b')](function(_0x16ddab){if(_0x16ddab){return _0x16ddab?{'count':_0xf4c22b,'rows':_0x16ddab}:null;}})['then'](respondWithResult(_0x23b0b6,null))[_0x1800('0x55')](handleError(_0x23b0b6,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index f197beb..8c16f1d 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 _0x83d7=['save','update','remove','emit','hook','events','../../mysqldb','WhatsappQueue','setMaxListeners'];(function(_0x8e9597,_0x2aa555){var _0x3be06a=function(_0x7a8e7a){while(--_0x7a8e7a){_0x8e9597['push'](_0x8e9597['shift']());}};_0x3be06a(++_0x2aa555);}(_0x83d7,0x1e2));var _0x783d=function(_0x5b34c0,_0x3ad403){_0x5b34c0=_0x5b34c0-0x0;var _0x242bd3=_0x83d7[_0x5b34c0];return _0x242bd3;};'use strict';var EventEmitter=require(_0x783d('0x0'));var WhatsappQueue=require(_0x783d('0x1'))['db'][_0x783d('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x783d('0x3')](0x0);var events={'afterCreate':_0x783d('0x4'),'afterUpdate':_0x783d('0x5'),'afterDestroy':_0x783d('0x6')};function emitEvent(_0x3b1ffb){return function(_0xd4577d,_0xab8ada,_0xbfc59d){WhatsappQueueEvents['emit'](_0x3b1ffb+':'+_0xd4577d['id'],_0xd4577d);WhatsappQueueEvents[_0x783d('0x7')](_0x3b1ffb,_0xd4577d);_0xbfc59d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x783d('0x8')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x8813=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update'];(function(_0xfb65aa,_0x1651a6){var _0x2aee31=function(_0x492245){while(--_0x492245){_0xfb65aa['push'](_0xfb65aa['shift']());}};_0x2aee31(++_0x1651a6);}(_0x8813,0xdd));var _0x3881=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8813[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x3881('0x0'));var WhatsappQueue=require(_0x3881('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3881('0x2'),'afterUpdate':_0x3881('0x3'),'afterDestroy':_0x3881('0x4')};function emitEvent(_0x22a1fc){return function(_0x172b64,_0x3f4306,_0x5dd824){WhatsappQueueEvents['emit'](_0x22a1fc+':'+_0x172b64['id'],_0x172b64);WhatsappQueueEvents[_0x3881('0x5')](_0x22a1fc,_0x172b64);_0x5dd824(null);};}for(var e in events){if(events[_0x3881('0x6')](e)){var event=events[e];WhatsappQueue[_0x3881('0x7')](e,emitEvent(event));}}module[_0x3881('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 20cb2bf..dc1d55a 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 _0x78f9=['WhatsappQueue','whatsapp_queues','lodash','../../config/logger','api','bluebird','path','../../config/environment','./whatsappQueue.attributes','exports','define'];(function(_0x595a77,_0x51bbe3){var _0x55ee58=function(_0x334087){while(--_0x334087){_0x595a77['push'](_0x595a77['shift']());}};_0x55ee58(++_0x51bbe3);}(_0x78f9,0x70));var _0x978f=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x78f9[_0x5b78e8];return _0xf2c321;};'use strict';var _=require(_0x978f('0x0'));var util=require('util');var logger=require(_0x978f('0x1'))(_0x978f('0x2'));var moment=require('moment');var BPromise=require(_0x978f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x978f('0x4'));var rimraf=require('rimraf');var config=require(_0x978f('0x5'));var attributes=require(_0x978f('0x6'));module[_0x978f('0x7')]=function(_0x11cd16,_0x2f4e54){return _0x11cd16[_0x978f('0x8')](_0x978f('0x9'),attributes,{'tableName':_0x978f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x86c8=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue'];(function(_0x3a95e9,_0x8e50a){var _0xeffc9d=function(_0x5718fe){while(--_0x5718fe){_0x3a95e9['push'](_0x3a95e9['shift']());}};_0xeffc9d(++_0x8e50a);}(_0x86c8,0x144));var _0x886c=function(_0x1a8518,_0x4fde78){_0x1a8518=_0x1a8518-0x0;var _0x1ac19c=_0x86c8[_0x1a8518];return _0x1ac19c;};'use strict';var _=require('lodash');var util=require(_0x886c('0x0'));var logger=require(_0x886c('0x1'))(_0x886c('0x2'));var moment=require(_0x886c('0x3'));var BPromise=require(_0x886c('0x4'));var rp=require(_0x886c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x886c('0x6'));var config=require(_0x886c('0x7'));var attributes=require(_0x886c('0x8'));module[_0x886c('0x9')]=function(_0x363aff,_0x29d35c){return _0x363aff[_0x886c('0xa')](_0x886c('0xb'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index a3cdbe5..b5cc061 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 _0x2a4d=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowWhatsappQueue','find','lodash','util','moment'];(function(_0x67a151,_0x3201de){var _0x47b5a8=function(_0x2bf317){while(--_0x2bf317){_0x67a151['push'](_0x67a151['shift']());}};_0x47b5a8(++_0x3201de);}(_0x2a4d,0x1d6));var _0xd2a4=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x2a4d[_0x51020b];return _0x371e47;};'use strict';var _=require(_0xd2a4('0x0'));var util=require(_0xd2a4('0x1'));var moment=require(_0xd2a4('0x2'));var BPromise=require(_0xd2a4('0x3'));var rs=require(_0xd2a4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd2a4('0x5'))['db'];var utils=require(_0xd2a4('0x6'));var logger=require(_0xd2a4('0x7'))(_0xd2a4('0x8'));var config=require(_0xd2a4('0x9'));var jayson=require(_0xd2a4('0xa'));var client=jayson[_0xd2a4('0xb')][_0xd2a4('0xc')]({'port':0x232a});config[_0xd2a4('0xd')]=_[_0xd2a4('0xe')](config[_0xd2a4('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xd2a4('0xf'))(new Redis(config['redis']));require(_0xd2a4('0x10'))[_0xd2a4('0x11')](socket);function respondWithRpcPromise(_0x43d8ef,_0x3f178e,_0x5b0f98){return new BPromise(function(_0xc92589,_0x326835){return client[_0xd2a4('0x12')](_0x43d8ef,_0x5b0f98)[_0xd2a4('0x13')](function(_0x8ec172){logger[_0xd2a4('0x14')](_0xd2a4('0x15'),_0x3f178e,_0xd2a4('0x16'));logger[_0xd2a4('0x17')](_0xd2a4('0x18'),_0x3f178e,_0xd2a4('0x16'),JSON[_0xd2a4('0x19')](_0x8ec172));if(_0x8ec172[_0xd2a4('0x1a')]){if(_0x8ec172[_0xd2a4('0x1a')]['code']===0x1f4){logger[_0xd2a4('0x1a')](_0xd2a4('0x15'),_0x3f178e,_0x8ec172[_0xd2a4('0x1a')][_0xd2a4('0x1b')]);return _0x326835(_0x8ec172['error'][_0xd2a4('0x1b')]);}logger['error'](_0xd2a4('0x15'),_0x3f178e,_0x8ec172[_0xd2a4('0x1a')]['message']);return _0xc92589(_0x8ec172[_0xd2a4('0x1a')][_0xd2a4('0x1b')]);}else{logger[_0xd2a4('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x3f178e,_0xd2a4('0x16'));_0xc92589(_0x8ec172[_0xd2a4('0x1c')]['message']);}})[_0xd2a4('0x1d')](function(_0x1c285b){logger['error'](_0xd2a4('0x15'),_0x3f178e,_0x1c285b);_0x326835(_0x1c285b);});});}exports[_0xd2a4('0x1e')]=function(_0x32a587){var _0x38611f=this;return new Promise(function(_0x888286,_0x15ca88){return db[_0xd2a4('0x1f')][_0xd2a4('0x20')]({'raw':_0x32a587[_0xd2a4('0x21')]?_0x32a587[_0xd2a4('0x21')][_0xd2a4('0x22')]===undefined?!![]:![]:!![],'where':_0x32a587[_0xd2a4('0x21')]?_0x32a587[_0xd2a4('0x21')][_0xd2a4('0x23')]||null:null,'attributes':_0x32a587[_0xd2a4('0x21')]?_0x32a587['options'][_0xd2a4('0x24')]||null:null,'limit':_0x32a587[_0xd2a4('0x21')]?_0x32a587['options'][_0xd2a4('0x25')]||null:null,'include':_0x32a587[_0xd2a4('0x21')]?_0x32a587[_0xd2a4('0x21')][_0xd2a4('0x26')]?_[_0xd2a4('0x27')](_0x32a587[_0xd2a4('0x21')][_0xd2a4('0x26')],function(_0x16e01b){return{'model':db[_0x16e01b[_0xd2a4('0x28')]],'as':_0x16e01b['as'],'attributes':_0x16e01b[_0xd2a4('0x24')],'include':_0x16e01b[_0xd2a4('0x26')]?_[_0xd2a4('0x27')](_0x16e01b[_0xd2a4('0x26')],function(_0x4de195){return{'model':db[_0x4de195[_0xd2a4('0x28')]],'as':_0x4de195['as'],'attributes':_0x4de195[_0xd2a4('0x24')],'include':_0x4de195[_0xd2a4('0x26')]?_[_0xd2a4('0x27')](_0x4de195['include'],function(_0x2d7fbf){return{'model':db[_0x2d7fbf[_0xd2a4('0x28')]],'as':_0x2d7fbf['as'],'attributes':_0x2d7fbf[_0xd2a4('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f44f5){logger[_0xd2a4('0x14')](_0xd2a4('0x1e'),_0x32a587);logger[_0xd2a4('0x17')]('GetWhatsappQueue',_0x32a587,JSON[_0xd2a4('0x19')](_0x3f44f5));_0x888286(_0x3f44f5);})[_0xd2a4('0x1d')](function(_0xbc22fc){logger['error'](_0xd2a4('0x1e'),_0xbc22fc[_0xd2a4('0x1b')],_0x32a587);_0x15ca88(_0x38611f[_0xd2a4('0x1a')](0x1f4,_0xbc22fc[_0xd2a4('0x1b')]));});});};exports[_0xd2a4('0x29')]=function(_0x4b38c0){var _0x4d2073=this;return new Promise(function(_0x1a78fd,_0x43a35a){return db[_0xd2a4('0x1f')][_0xd2a4('0x2a')]({'raw':_0x4b38c0[_0xd2a4('0x21')]?_0x4b38c0[_0xd2a4('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x4b38c0[_0xd2a4('0x21')]?_0x4b38c0[_0xd2a4('0x21')][_0xd2a4('0x23')]||null:null,'attributes':_0x4b38c0[_0xd2a4('0x21')]?_0x4b38c0[_0xd2a4('0x21')][_0xd2a4('0x24')]||null:null,'include':_0x4b38c0['options']?_0x4b38c0[_0xd2a4('0x21')][_0xd2a4('0x26')]?_[_0xd2a4('0x27')](_0x4b38c0['options'][_0xd2a4('0x26')],function(_0x1a075a){return{'model':db[_0x1a075a[_0xd2a4('0x28')]],'as':_0x1a075a['as'],'attributes':_0x1a075a[_0xd2a4('0x24')],'include':_0x1a075a[_0xd2a4('0x26')]?_[_0xd2a4('0x27')](_0x1a075a[_0xd2a4('0x26')],function(_0x3f7e5d){return{'model':db[_0x3f7e5d[_0xd2a4('0x28')]],'as':_0x3f7e5d['as'],'attributes':_0x3f7e5d[_0xd2a4('0x24')],'include':_0x3f7e5d[_0xd2a4('0x26')]?_[_0xd2a4('0x27')](_0x3f7e5d[_0xd2a4('0x26')],function(_0xe06191){return{'model':db[_0xe06191[_0xd2a4('0x28')]],'as':_0xe06191['as'],'attributes':_0xe06191[_0xd2a4('0x24')]};}):[]};}):[]};}):[]:[]})[_0xd2a4('0x13')](function(_0x1f3989){logger[_0xd2a4('0x14')](_0xd2a4('0x29'),_0x4b38c0);logger[_0xd2a4('0x17')]('ShowWhatsappQueue',_0x4b38c0,JSON['stringify'](_0x1f3989));_0x1a78fd(_0x1f3989);})[_0xd2a4('0x1d')](function(_0x18d38b){logger[_0xd2a4('0x1a')](_0xd2a4('0x29'),_0x18d38b['message'],_0x4b38c0);_0x43a35a(_0x4d2073[_0xd2a4('0x1a')](0x1f4,_0x18d38b[_0xd2a4('0x1b')]));});});}; \ No newline at end of file +var _0x4f60=['limit','include','map','model','attributes','GetWhatsappQueue','ShowWhatsappQueue','find','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','WhatsappQueue','findAll','options','where'];(function(_0x5b023e,_0x18eb7a){var _0x31628f=function(_0x5ccde1){while(--_0x5ccde1){_0x5b023e['push'](_0x5b023e['shift']());}};_0x31628f(++_0x18eb7a);}(_0x4f60,0x17a));var _0x04f6=function(_0x42548d,_0x432fc2){_0x42548d=_0x42548d-0x0;var _0x792e46=_0x4f60[_0x42548d];return _0x792e46;};'use strict';var _=require(_0x04f6('0x0'));var util=require('util');var moment=require(_0x04f6('0x1'));var BPromise=require(_0x04f6('0x2'));var rs=require(_0x04f6('0x3'));var fs=require('fs');var Redis=require(_0x04f6('0x4'));var db=require(_0x04f6('0x5'))['db'];var utils=require(_0x04f6('0x6'));var logger=require('../../config/logger')(_0x04f6('0x7'));var config=require(_0x04f6('0x8'));var jayson=require(_0x04f6('0x9'));var client=jayson[_0x04f6('0xa')][_0x04f6('0xb')]({'port':0x232a});config[_0x04f6('0xc')]=_[_0x04f6('0xd')](config['redis'],{'host':_0x04f6('0xe'),'port':0x18eb});var socket=require(_0x04f6('0xf'))(new Redis(config[_0x04f6('0xc')]));require(_0x04f6('0x10'))[_0x04f6('0x11')](socket);function respondWithRpcPromise(_0x2dfee3,_0x1123f9,_0x10290f){return new BPromise(function(_0x538c7c,_0x28ce0a){return client['request'](_0x2dfee3,_0x10290f)['then'](function(_0xf0bb7b){logger[_0x04f6('0x12')](_0x04f6('0x13'),_0x1123f9,_0x04f6('0x14'));logger[_0x04f6('0x15')](_0x04f6('0x16'),_0x1123f9,_0x04f6('0x14'),JSON[_0x04f6('0x17')](_0xf0bb7b));if(_0xf0bb7b['error']){if(_0xf0bb7b['error'][_0x04f6('0x18')]===0x1f4){logger[_0x04f6('0x19')](_0x04f6('0x13'),_0x1123f9,_0xf0bb7b['error'][_0x04f6('0x1a')]);return _0x28ce0a(_0xf0bb7b[_0x04f6('0x19')][_0x04f6('0x1a')]);}logger['error'](_0x04f6('0x13'),_0x1123f9,_0xf0bb7b[_0x04f6('0x19')]['message']);return _0x538c7c(_0xf0bb7b[_0x04f6('0x19')][_0x04f6('0x1a')]);}else{logger[_0x04f6('0x12')](_0x04f6('0x13'),_0x1123f9,'request\x20sent');_0x538c7c(_0xf0bb7b['result'][_0x04f6('0x1a')]);}})[_0x04f6('0x1b')](function(_0xc264c9){logger[_0x04f6('0x19')](_0x04f6('0x13'),_0x1123f9,_0xc264c9);_0x28ce0a(_0xc264c9);});});}exports['GetWhatsappQueue']=function(_0x55821d){var _0x381f0e=this;return new Promise(function(_0x3df790,_0x2afb57){return db[_0x04f6('0x1c')][_0x04f6('0x1d')]({'raw':_0x55821d[_0x04f6('0x1e')]?_0x55821d[_0x04f6('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x55821d[_0x04f6('0x1e')]?_0x55821d['options'][_0x04f6('0x1f')]||null:null,'attributes':_0x55821d[_0x04f6('0x1e')]?_0x55821d['options']['attributes']||null:null,'limit':_0x55821d['options']?_0x55821d['options'][_0x04f6('0x20')]||null:null,'include':_0x55821d[_0x04f6('0x1e')]?_0x55821d['options'][_0x04f6('0x21')]?_['map'](_0x55821d[_0x04f6('0x1e')][_0x04f6('0x21')],function(_0x35128c){return{'model':db[_0x35128c['model']],'as':_0x35128c['as'],'attributes':_0x35128c['attributes'],'include':_0x35128c[_0x04f6('0x21')]?_[_0x04f6('0x22')](_0x35128c[_0x04f6('0x21')],function(_0x417c2e){return{'model':db[_0x417c2e['model']],'as':_0x417c2e['as'],'attributes':_0x417c2e['attributes'],'include':_0x417c2e[_0x04f6('0x21')]?_[_0x04f6('0x22')](_0x417c2e['include'],function(_0xd4eeb2){return{'model':db[_0xd4eeb2[_0x04f6('0x23')]],'as':_0xd4eeb2['as'],'attributes':_0xd4eeb2[_0x04f6('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c8771){logger[_0x04f6('0x12')]('GetWhatsappQueue',_0x55821d);logger[_0x04f6('0x15')](_0x04f6('0x25'),_0x55821d,JSON['stringify'](_0x1c8771));_0x3df790(_0x1c8771);})[_0x04f6('0x1b')](function(_0x8bc45a){logger[_0x04f6('0x19')](_0x04f6('0x25'),_0x8bc45a[_0x04f6('0x1a')],_0x55821d);_0x2afb57(_0x381f0e[_0x04f6('0x19')](0x1f4,_0x8bc45a['message']));});});};exports[_0x04f6('0x26')]=function(_0x50194d){var _0x2db86e=this;return new Promise(function(_0x671cca,_0x18a68b){return db['WhatsappQueue'][_0x04f6('0x27')]({'raw':_0x50194d[_0x04f6('0x1e')]?_0x50194d[_0x04f6('0x1e')][_0x04f6('0x28')]===undefined?!![]:![]:!![],'where':_0x50194d[_0x04f6('0x1e')]?_0x50194d[_0x04f6('0x1e')][_0x04f6('0x1f')]||null:null,'attributes':_0x50194d['options']?_0x50194d[_0x04f6('0x1e')]['attributes']||null:null,'include':_0x50194d[_0x04f6('0x1e')]?_0x50194d[_0x04f6('0x1e')][_0x04f6('0x21')]?_[_0x04f6('0x22')](_0x50194d['options'][_0x04f6('0x21')],function(_0x58b44a){return{'model':db[_0x58b44a[_0x04f6('0x23')]],'as':_0x58b44a['as'],'attributes':_0x58b44a[_0x04f6('0x24')],'include':_0x58b44a['include']?_[_0x04f6('0x22')](_0x58b44a['include'],function(_0x161a43){return{'model':db[_0x161a43['model']],'as':_0x161a43['as'],'attributes':_0x161a43[_0x04f6('0x24')],'include':_0x161a43[_0x04f6('0x21')]?_[_0x04f6('0x22')](_0x161a43['include'],function(_0x4549ce){return{'model':db[_0x4549ce[_0x04f6('0x23')]],'as':_0x4549ce['as'],'attributes':_0x4549ce[_0x04f6('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ea33f){logger[_0x04f6('0x12')](_0x04f6('0x26'),_0x50194d);logger['debug'](_0x04f6('0x26'),_0x50194d,JSON[_0x04f6('0x17')](_0x3ea33f));_0x671cca(_0x3ea33f);})[_0x04f6('0x1b')](function(_0x502188){logger['error'](_0x04f6('0x26'),_0x502188['message'],_0x50194d);_0x18a68b(_0x2db86e['error'](0x1f4,_0x502188[_0x04f6('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 4e8d245..5da6001 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 _0x5374=['length','whatsappQueue:','./whatsappQueue.events','save','remove','update','removeListener','register'];(function(_0x16105f,_0x5b2cef){var _0x249e9e=function(_0x5ea34f){while(--_0x5ea34f){_0x16105f['push'](_0x16105f['shift']());}};_0x249e9e(++_0x5b2cef);}(_0x5374,0x192));var _0x4537=function(_0x5c6022,_0x2108e6){_0x5c6022=_0x5c6022-0x0;var _0x4a729c=_0x5374[_0x5c6022];return _0x4a729c;};'use strict';var WhatsappQueueEvents=require(_0x4537('0x0'));var events=[_0x4537('0x1'),_0x4537('0x2'),_0x4537('0x3')];function createListener(_0x4bf836,_0x2d3145){return function(_0x270a2f){_0x2d3145['emit'](_0x4bf836,_0x270a2f);};}function removeListener(_0x5d8e46,_0x3551e4){return function(){WhatsappQueueEvents[_0x4537('0x4')](_0x5d8e46,_0x3551e4);};}exports[_0x4537('0x5')]=function(_0x4be027){for(var _0x52cf43=0x0,_0x1f9488=events[_0x4537('0x6')];_0x52cf43<_0x1f9488;_0x52cf43++){var _0x214dca=events[_0x52cf43];var _0x1ab37a=createListener(_0x4537('0x7')+_0x214dca,_0x4be027);WhatsappQueueEvents['on'](_0x214dca,_0x1ab37a);}}; \ No newline at end of file +var _0xfb9a=['register','length','./whatsappQueue.events','save','remove','update','emit','removeListener'];(function(_0x5b26b8,_0x1d1f47){var _0x36ddbc=function(_0x3884cd){while(--_0x3884cd){_0x5b26b8['push'](_0x5b26b8['shift']());}};_0x36ddbc(++_0x1d1f47);}(_0xfb9a,0x112));var _0xafb9=function(_0x5967c4,_0x525d96){_0x5967c4=_0x5967c4-0x0;var _0x4b8ba5=_0xfb9a[_0x5967c4];return _0x4b8ba5;};'use strict';var WhatsappQueueEvents=require(_0xafb9('0x0'));var events=[_0xafb9('0x1'),_0xafb9('0x2'),_0xafb9('0x3')];function createListener(_0x17e520,_0xda6f62){return function(_0x553f02){_0xda6f62[_0xafb9('0x4')](_0x17e520,_0x553f02);};}function removeListener(_0x180400,_0x15f43f){return function(){WhatsappQueueEvents[_0xafb9('0x5')](_0x180400,_0x15f43f);};}exports[_0xafb9('0x6')]=function(_0x161585){for(var _0xa03b31=0x0,_0x531f73=events[_0xafb9('0x7')];_0xa03b31<_0x531f73;_0xa03b31++){var _0x5ec8b2=events[_0xa03b31];var _0x300087=createListener('whatsappQueue:'+_0x5ec8b2,_0x161585);WhatsappQueueEvents['on'](_0x5ec8b2,_0x300087);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 8ac19e0..694a146 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 _0x089f=['/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','index','describe'];(function(_0x51073a,_0x2c6891){var _0x16949a=function(_0x57de8c){while(--_0x57de8c){_0x51073a['push'](_0x51073a['shift']());}};_0x16949a(++_0x2c6891);}(_0x089f,0x86));var _0xf089=function(_0x4617f4,_0xdd90f){_0x4617f4=_0x4617f4-0x0;var _0x3ec7ba=_0x089f[_0x4617f4];return _0x3ec7ba;};'use strict';var multer=require(_0xf089('0x0'));var util=require(_0xf089('0x1'));var path=require(_0xf089('0x2'));var timeout=require(_0xf089('0x3'));var express=require('express');var router=express[_0xf089('0x4')]();var fs_extra=require(_0xf089('0x5'));var auth=require(_0xf089('0x6'));var interaction=require(_0xf089('0x7'));var config=require('../../config/environment');var controller=require(_0xf089('0x8'));router[_0xf089('0x9')]('/',auth[_0xf089('0xa')](),controller[_0xf089('0xb')]);router['get']('/describe',auth[_0xf089('0xa')](),controller[_0xf089('0xc')]);router[_0xf089('0x9')](_0xf089('0xd'),auth[_0xf089('0xa')](),controller[_0xf089('0xe')]);router['post']('/',auth[_0xf089('0xa')](),controller[_0xf089('0xf')]);router[_0xf089('0x10')]('/:id',auth[_0xf089('0xa')](),controller[_0xf089('0x11')]);router[_0xf089('0x12')]('/:id',auth[_0xf089('0xa')](),controller[_0xf089('0x13')]);module[_0xf089('0x14')]=router; \ No newline at end of file +var _0xaad2=['describe','/:id','show','post','put','delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x56eec5,_0x5e3c24){var _0x26c031=function(_0x21938e){while(--_0x21938e){_0x56eec5['push'](_0x56eec5['shift']());}};_0x26c031(++_0x5e3c24);}(_0xaad2,0x183));var _0x2aad=function(_0x305b20,_0x5e57e9){_0x305b20=_0x305b20-0x0;var _0x26d64a=_0xaad2[_0x305b20];return _0x26d64a;};'use strict';var multer=require('multer');var util=require(_0x2aad('0x0'));var path=require(_0x2aad('0x1'));var timeout=require(_0x2aad('0x2'));var express=require(_0x2aad('0x3'));var router=express['Router']();var fs_extra=require(_0x2aad('0x4'));var auth=require(_0x2aad('0x5'));var interaction=require(_0x2aad('0x6'));var config=require(_0x2aad('0x7'));var controller=require(_0x2aad('0x8'));router[_0x2aad('0x9')]('/',auth[_0x2aad('0xa')](),controller[_0x2aad('0xb')]);router['get'](_0x2aad('0xc'),auth[_0x2aad('0xa')](),controller[_0x2aad('0xd')]);router[_0x2aad('0x9')](_0x2aad('0xe'),auth[_0x2aad('0xa')](),controller[_0x2aad('0xf')]);router[_0x2aad('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2aad('0x11')](_0x2aad('0xe'),auth[_0x2aad('0xa')](),controller['update']);router[_0x2aad('0x12')](_0x2aad('0xe'),auth['isAuthenticated'](),controller[_0x2aad('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 5486da9..423b6a3 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(_0x207cd5,_0x42638d){var _0x3451f6=function(_0x3f62bf){while(--_0x3f62bf){_0x207cd5['push'](_0x207cd5['shift']());}};_0x3451f6(++_0x42638d);}(_0x7a54,0x106));var _0x47a5=function(_0x278a37,_0x3cbff8){_0x278a37=_0x278a37-0x0;var _0x14fde4=_0x7a54[_0x278a37];return _0x14fde4;};'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(_0x332cbf,_0x427666){var _0x454035=function(_0x4ad564){while(--_0x4ad564){_0x332cbf['push'](_0x332cbf['shift']());}};_0x454035(++_0x427666);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 49f796f..0788596 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 _0xeb74=['papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','merge','where','VIRTUAL','filter','options','WhatsappQueueReport','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring'];(function(_0x76ab71,_0x3a8692){var _0x2cc491=function(_0x366563){while(--_0x366563){_0x76ab71['push'](_0x76ab71['shift']());}};_0x2cc491(++_0x3a8692);}(_0xeb74,0xe3));var _0x4eb7=function(_0xeb294,_0x109de3){_0xeb294=_0xeb294-0x0;var _0x1dcf1d=_0xeb74[_0xeb294];return _0x1dcf1d;};'use strict';var emlformat=require(_0x4eb7('0x0'));var rimraf=require(_0x4eb7('0x1'));var zipdir=require(_0x4eb7('0x2'));var jsonpatch=require(_0x4eb7('0x3'));var rp=require(_0x4eb7('0x4'));var moment=require(_0x4eb7('0x5'));var BPromise=require(_0x4eb7('0x6'));var Mustache=require('mustache');var util=require(_0x4eb7('0x7'));var path=require(_0x4eb7('0x8'));var sox=require(_0x4eb7('0x9'));var csv=require(_0x4eb7('0xa'));var ejs=require(_0x4eb7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4eb7('0xc'));var squel=require('squel');var crypto=require(_0x4eb7('0xd'));var jsforce=require(_0x4eb7('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4eb7('0xf'));var Papa=require(_0x4eb7('0x10'));var Redis=require('ioredis');var authService=require(_0x4eb7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4eb7('0x12'));var hardwareService=require(_0x4eb7('0x13'));var logger=require(_0x4eb7('0x14'))('api');var utils=require(_0x4eb7('0x15'));var config=require(_0x4eb7('0x16'));var licenseUtil=require(_0x4eb7('0x17'));var db=require(_0x4eb7('0x18'))['db'];function respondWithStatusCode(_0x35fa89,_0x4194e1){_0x4194e1=_0x4194e1||0xcc;return function(_0x3c9f45){if(_0x3c9f45){return _0x35fa89['sendStatus'](_0x4194e1);}return _0x35fa89['status'](_0x4194e1)['end']();};}function respondWithResult(_0x17fb81,_0x51f09d){_0x51f09d=_0x51f09d||0xc8;return function(_0x84c68b){if(_0x84c68b){return _0x17fb81[_0x4eb7('0x19')](_0x51f09d)[_0x4eb7('0x1a')](_0x84c68b);}};}function respondWithFilteredResult(_0x1c4a97,_0x5d6d5){return function(_0x21433d){if(_0x21433d){var _0x11674f=typeof _0x5d6d5[_0x4eb7('0x1b')]===_0x4eb7('0x1c')&&typeof _0x5d6d5[_0x4eb7('0x1d')]==='undefined';var _0xb86bc9=_0x21433d[_0x4eb7('0x1e')];var _0x3b6d41=_0x11674f?0x0:_0x5d6d5[_0x4eb7('0x1b')];var _0x302e16=_0x11674f?_0x21433d[_0x4eb7('0x1e')]:_0x5d6d5[_0x4eb7('0x1b')]+_0x5d6d5[_0x4eb7('0x1d')];var _0x5f4780;if(_0x302e16>=_0xb86bc9){_0x302e16=_0xb86bc9;_0x5f4780=0xc8;}else{_0x5f4780=0xce;}_0x1c4a97[_0x4eb7('0x19')](_0x5f4780);return _0x1c4a97[_0x4eb7('0x1f')](_0x4eb7('0x20'),_0x3b6d41+'-'+_0x302e16+'/'+_0xb86bc9)[_0x4eb7('0x1a')](_0x21433d);}return null;};}function patchUpdates(_0x32f0f5){return function(_0x2efd67){try{jsonpatch[_0x4eb7('0x21')](_0x2efd67,_0x32f0f5,!![]);}catch(_0x4ddbe4){return BPromise[_0x4eb7('0x22')](_0x4ddbe4);}return _0x2efd67[_0x4eb7('0x23')]();};}function saveUpdates(_0x4783b1,_0x164515){return function(_0x14a7be){if(_0x14a7be){return _0x14a7be[_0x4eb7('0x24')](_0x4783b1)[_0x4eb7('0x25')](function(_0x2df1b1){return _0x2df1b1;});}return null;};}function removeEntity(_0x1a2b8b,_0x13e871){return function(_0x4de2d9){if(_0x4de2d9){return _0x4de2d9[_0x4eb7('0x26')]()[_0x4eb7('0x25')](function(){_0x1a2b8b[_0x4eb7('0x19')](0xcc)[_0x4eb7('0x27')]();});}};}function handleEntityNotFound(_0x3e0da2,_0x25eb74){return function(_0x365060){if(!_0x365060){_0x3e0da2[_0x4eb7('0x28')](0x194);}return _0x365060;};}function handleError(_0x80b804,_0x248759){_0x248759=_0x248759||0x1f4;return function(_0xf83c11){logger[_0x4eb7('0x29')](_0xf83c11[_0x4eb7('0x2a')]);if(_0xf83c11[_0x4eb7('0x2b')]){delete _0xf83c11[_0x4eb7('0x2b')];}_0x80b804[_0x4eb7('0x19')](_0x248759)[_0x4eb7('0x2c')](_0xf83c11);};}exports[_0x4eb7('0x2d')]=function(_0x33a2c1,_0x28fda8){var _0x114c68={},_0x17030a={},_0x3ed224={'count':0x0,'rows':[]};var _0x50209d=_[_0x4eb7('0x2e')](db['WhatsappQueueReport'][_0x4eb7('0x2f')],function(_0x13f71a){return{'name':_0x13f71a[_0x4eb7('0x30')],'type':_0x13f71a[_0x4eb7('0x31')][_0x4eb7('0x32')]};});_0x17030a[_0x4eb7('0x33')]=_[_0x4eb7('0x2e')](_0x50209d,_0x4eb7('0x2b'));_0x17030a[_0x4eb7('0x34')]=_['keys'](_0x33a2c1[_0x4eb7('0x34')]);_0x17030a['filters']=_[_0x4eb7('0x35')](_0x17030a[_0x4eb7('0x33')],_0x17030a['query']);_0x114c68['attributes']=_[_0x4eb7('0x35')](_0x17030a[_0x4eb7('0x33')],qs[_0x4eb7('0x36')](_0x33a2c1[_0x4eb7('0x34')]['fields']));_0x114c68[_0x4eb7('0x37')]=_0x114c68[_0x4eb7('0x37')][_0x4eb7('0x38')]?_0x114c68[_0x4eb7('0x37')]:_0x17030a[_0x4eb7('0x33')];if(!_0x33a2c1['query'][_0x4eb7('0x39')](_0x4eb7('0x3a'))){_0x114c68[_0x4eb7('0x1d')]=qs['limit'](_0x33a2c1[_0x4eb7('0x34')][_0x4eb7('0x1d')]);_0x114c68[_0x4eb7('0x1b')]=qs['offset'](_0x33a2c1[_0x4eb7('0x34')]['offset']);}_0x114c68[_0x4eb7('0x3b')]=qs[_0x4eb7('0x3c')](_0x33a2c1[_0x4eb7('0x34')][_0x4eb7('0x3c')]);_0x114c68['where']=qs[_0x4eb7('0x3d')](_[_0x4eb7('0x3e')](_0x33a2c1[_0x4eb7('0x34')],_0x17030a[_0x4eb7('0x3d')]),_0x50209d);if(_0x33a2c1['query']['filter']){_0x114c68['where']=_[_0x4eb7('0x3f')](_0x114c68[_0x4eb7('0x40')],{'$or':_[_0x4eb7('0x2e')](_0x50209d,function(_0x20ac7b){if(_0x20ac7b[_0x4eb7('0x31')]!==_0x4eb7('0x41')){var _0x1038c1={};_0x1038c1[_0x20ac7b[_0x4eb7('0x2b')]]={'$like':'%'+_0x33a2c1[_0x4eb7('0x34')][_0x4eb7('0x42')]+'%'};return _0x1038c1;}})});}_0x114c68=_['merge']({},_0x114c68,_0x33a2c1[_0x4eb7('0x43')]);var _0x38218f={'where':_0x114c68[_0x4eb7('0x40')]};return db[_0x4eb7('0x44')][_0x4eb7('0x1e')](_0x38218f)[_0x4eb7('0x25')](function(_0x704d4d){_0x3ed224[_0x4eb7('0x1e')]=_0x704d4d;if(_0x33a2c1[_0x4eb7('0x34')][_0x4eb7('0x45')]){_0x114c68[_0x4eb7('0x46')]=[{'all':!![]}];}return db[_0x4eb7('0x44')][_0x4eb7('0x47')](_0x114c68);})[_0x4eb7('0x25')](function(_0x38af1f){_0x3ed224[_0x4eb7('0x48')]=_0x38af1f;return _0x3ed224;})[_0x4eb7('0x25')](respondWithFilteredResult(_0x28fda8,_0x114c68))[_0x4eb7('0x49')](handleError(_0x28fda8,null));};exports[_0x4eb7('0x4a')]=function(_0x79aec5,_0x5eff9e){var _0x2fd5c2={'raw':!![],'where':{'id':_0x79aec5[_0x4eb7('0x4b')]['id']}},_0x2df542={};_0x2df542[_0x4eb7('0x33')]=_[_0x4eb7('0x4c')](db[_0x4eb7('0x44')][_0x4eb7('0x2f')]);_0x2df542[_0x4eb7('0x34')]=_[_0x4eb7('0x4c')](_0x79aec5['query']);_0x2df542[_0x4eb7('0x3d')]=_['intersection'](_0x2df542[_0x4eb7('0x33')],_0x2df542[_0x4eb7('0x34')]);_0x2fd5c2[_0x4eb7('0x37')]=_['intersection'](_0x2df542[_0x4eb7('0x33')],qs[_0x4eb7('0x36')](_0x79aec5[_0x4eb7('0x34')][_0x4eb7('0x36')]));_0x2fd5c2['attributes']=_0x2fd5c2[_0x4eb7('0x37')]['length']?_0x2fd5c2[_0x4eb7('0x37')]:_0x2df542[_0x4eb7('0x33')];if(_0x79aec5[_0x4eb7('0x34')][_0x4eb7('0x45')]){_0x2fd5c2[_0x4eb7('0x46')]=[{'all':!![]}];}_0x2fd5c2=_['merge']({},_0x2fd5c2,_0x79aec5['options']);return db[_0x4eb7('0x44')][_0x4eb7('0x4d')](_0x2fd5c2)[_0x4eb7('0x25')](handleEntityNotFound(_0x5eff9e,null))[_0x4eb7('0x25')](respondWithResult(_0x5eff9e,null))[_0x4eb7('0x49')](handleError(_0x5eff9e,null));};exports['create']=function(_0x6086,_0x104284){return db['WhatsappQueueReport'][_0x4eb7('0x4e')](_0x6086[_0x4eb7('0x4f')],{})['then'](respondWithResult(_0x104284,0xc9))[_0x4eb7('0x49')](handleError(_0x104284,null));};exports[_0x4eb7('0x24')]=function(_0x3c8049,_0x5774d5){if(_0x3c8049[_0x4eb7('0x4f')]['id']){delete _0x3c8049['body']['id'];}return db['WhatsappQueueReport'][_0x4eb7('0x4d')]({'where':{'id':_0x3c8049[_0x4eb7('0x4b')]['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x5774d5,null))[_0x4eb7('0x25')](saveUpdates(_0x3c8049[_0x4eb7('0x4f')],null))[_0x4eb7('0x25')](respondWithResult(_0x5774d5,null))[_0x4eb7('0x49')](handleError(_0x5774d5,null));};exports[_0x4eb7('0x26')]=function(_0x2913c5,_0x23c0d5){return db[_0x4eb7('0x44')][_0x4eb7('0x4d')]({'where':{'id':_0x2913c5[_0x4eb7('0x4b')]['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x23c0d5,null))[_0x4eb7('0x25')](removeEntity(_0x23c0d5,null))[_0x4eb7('0x49')](handleError(_0x23c0d5,null));};exports[_0x4eb7('0x50')]=function(_0x1580ba,_0x1411c9){return db[_0x4eb7('0x44')]['describe']()[_0x4eb7('0x25')](respondWithResult(_0x1411c9,null))['catch'](handleError(_0x1411c9,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(_0x4ae20d,_0x39cca8){var _0x30f78e=function(_0x2bb0ea){while(--_0x2bb0ea){_0x4ae20d['push'](_0x4ae20d['shift']());}};_0x30f78e(++_0x39cca8);}(_0xa902,0x8d));var _0x2a90=function(_0x5f19cb,_0x2900a7){_0x5f19cb=_0x5f19cb-0x0;var _0x45fb73=_0xa902[_0x5f19cb];return _0x45fb73;};'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 7cdb438..914fb17 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 _0xaf0a=['../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x1f52e4,_0x59d42e){var _0x321101=function(_0x31269b){while(--_0x31269b){_0x1f52e4['push'](_0x1f52e4['shift']());}};_0x321101(++_0x59d42e);}(_0xaf0a,0x1b3));var _0xaaf0=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0xaf0a[_0x58e469];return _0x4c01c5;};'use strict';var _=require('lodash');var util=require(_0xaaf0('0x0'));var logger=require(_0xaaf0('0x1'))(_0xaaf0('0x2'));var moment=require('moment');var BPromise=require(_0xaaf0('0x3'));var rp=require(_0xaaf0('0x4'));var fs=require('fs');var path=require(_0xaaf0('0x5'));var rimraf=require(_0xaaf0('0x6'));var config=require(_0xaaf0('0x7'));var attributes=require(_0xaaf0('0x8'));module[_0xaaf0('0x9')]=function(_0x54fa87,_0x3390a9){return _0x54fa87[_0xaaf0('0xa')](_0xaaf0('0xb'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xaaf0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9728=['../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x50ed7b,_0x1ff57a){var _0x3de524=function(_0x2cd23a){while(--_0x2cd23a){_0x50ed7b['push'](_0x50ed7b['shift']());}};_0x3de524(++_0x1ff57a);}(_0x9728,0x1cd));var _0x8972=function(_0x494076,_0x8ec2a5){_0x494076=_0x494076-0x0;var _0x3f2c4b=_0x9728[_0x494076];return _0x3f2c4b;};'use strict';var _=require(_0x8972('0x0'));var util=require(_0x8972('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8972('0x2'));var BPromise=require(_0x8972('0x3'));var rp=require(_0x8972('0x4'));var fs=require('fs');var path=require(_0x8972('0x5'));var rimraf=require(_0x8972('0x6'));var config=require(_0x8972('0x7'));var attributes=require(_0x8972('0x8'));module[_0x8972('0x9')]=function(_0x4362e2,_0x23c3cb){return _0x4362e2[_0x8972('0xa')]('WhatsappQueueReport',attributes,{'tableName':_0x8972('0xb'),'paranoid':![],'indexes':[{'name':_0x8972('0xc'),'fields':[_0x8972('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index f2ac6c4..df8d4c1 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 _0x50a0=['http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','UpdateWhatsappQueueReport','update','raw','where','attributes','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x239ddb,_0x5e79b8){var _0x4559f5=function(_0x1001b9){while(--_0x1001b9){_0x239ddb['push'](_0x239ddb['shift']());}};_0x4559f5(++_0x5e79b8);}(_0x50a0,0x80));var _0x050a=function(_0x228b50,_0x5e99e0){_0x228b50=_0x228b50-0x0;var _0xfb2870=_0x50a0[_0x228b50];return _0xfb2870;};'use strict';var _=require(_0x050a('0x0'));var util=require(_0x050a('0x1'));var moment=require(_0x050a('0x2'));var BPromise=require('bluebird');var rs=require(_0x050a('0x3'));var fs=require('fs');var Redis=require(_0x050a('0x4'));var db=require(_0x050a('0x5'))['db'];var utils=require(_0x050a('0x6'));var logger=require(_0x050a('0x7'))(_0x050a('0x8'));var config=require(_0x050a('0x9'));var jayson=require(_0x050a('0xa'));var client=jayson[_0x050a('0xb')][_0x050a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3bc19f,_0x31a75d,_0xb192e2){return new BPromise(function(_0x4fdb67,_0x29f38e){return client[_0x050a('0xd')](_0x3bc19f,_0xb192e2)[_0x050a('0xe')](function(_0x1b3df2){logger[_0x050a('0xf')](_0x050a('0x10'),_0x31a75d,'request\x20sent');logger[_0x050a('0x11')](_0x050a('0x12'),_0x31a75d,'request\x20sent',JSON[_0x050a('0x13')](_0x1b3df2));if(_0x1b3df2[_0x050a('0x14')]){if(_0x1b3df2['error']['code']===0x1f4){logger[_0x050a('0x14')](_0x050a('0x10'),_0x31a75d,_0x1b3df2[_0x050a('0x14')][_0x050a('0x15')]);return _0x29f38e(_0x1b3df2['error'][_0x050a('0x15')]);}logger[_0x050a('0x14')](_0x050a('0x10'),_0x31a75d,_0x1b3df2[_0x050a('0x14')]['message']);return _0x4fdb67(_0x1b3df2['error'][_0x050a('0x15')]);}else{logger['info'](_0x050a('0x10'),_0x31a75d,_0x050a('0x16'));_0x4fdb67(_0x1b3df2[_0x050a('0x17')][_0x050a('0x15')]);}})[_0x050a('0x18')](function(_0xaa1385){logger[_0x050a('0x14')](_0x050a('0x10'),_0x31a75d,_0xaa1385);_0x29f38e(_0xaa1385);});});}exports[_0x050a('0x19')]=function(_0x21fe10){var _0x43624c=this;return new Promise(function(_0x10a2ce,_0x23129f){return db[_0x050a('0x1a')][_0x050a('0x1b')](_0x21fe10[_0x050a('0x1c')],{'raw':_0x21fe10[_0x050a('0x1d')]?_0x21fe10[_0x050a('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x050a('0xe')](function(_0xbf8163){logger[_0x050a('0xf')]('CreateWhatsappQueueReport',_0x21fe10);logger[_0x050a('0x11')](_0x050a('0x19'),_0x21fe10,JSON[_0x050a('0x13')](_0xbf8163));_0x10a2ce(_0xbf8163);})[_0x050a('0x18')](function(_0x15a6e8){logger[_0x050a('0x14')](_0x050a('0x19'),_0x15a6e8['message'],_0x21fe10);_0x23129f(_0x43624c[_0x050a('0x14')](0x1f4,_0x15a6e8[_0x050a('0x15')]));});});};exports[_0x050a('0x1e')]=function(_0x497b86){var _0x12c525=this;return new Promise(function(_0x1833c6,_0xf379c){return db['WhatsappQueueReport'][_0x050a('0x1f')](_0x497b86[_0x050a('0x1c')],{'raw':_0x497b86[_0x050a('0x1d')]?_0x497b86[_0x050a('0x1d')][_0x050a('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x497b86['options']?_0x497b86['options'][_0x050a('0x21')]||null:null,'attributes':_0x497b86[_0x050a('0x1d')]?_0x497b86[_0x050a('0x1d')][_0x050a('0x22')]||null:null,'limit':_0x497b86[_0x050a('0x1d')]?_0x497b86['options']['limit']||null:null})[_0x050a('0xe')](function(_0x4960b0){logger[_0x050a('0xf')](_0x050a('0x1e'),_0x497b86);logger['debug']('UpdateWhatsappQueueReport',_0x497b86,JSON[_0x050a('0x13')](_0x4960b0));_0x1833c6(_0x4960b0);})[_0x050a('0x18')](function(_0x52de67){logger[_0x050a('0x14')](_0x050a('0x1e'),_0x52de67[_0x050a('0x15')],_0x497b86);_0xf379c(_0x12c525[_0x050a('0x14')](0x1f4,_0x52de67['message']));});});}; \ No newline at end of file +var _0xa5c6=['CreateWhatsappQueueReport','body','options','raw','debug','UpdateWhatsappQueueReport','WhatsappQueueReport','where','limit','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x4629ee,_0x5802d8){var _0x47fb5b=function(_0xf899cd){while(--_0xf899cd){_0x4629ee['push'](_0x4629ee['shift']());}};_0x47fb5b(++_0x5802d8);}(_0xa5c6,0xf9));var _0x6a5c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa5c6[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6a5c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6a5c('0x1'));var rs=require(_0x6a5c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6a5c('0x3'));var logger=require(_0x6a5c('0x4'))(_0x6a5c('0x5'));var config=require(_0x6a5c('0x6'));var jayson=require(_0x6a5c('0x7'));var client=jayson[_0x6a5c('0x8')][_0x6a5c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9b038,_0x15ae61,_0x5ec600){return new BPromise(function(_0x14c6ba,_0x45a62d){return client[_0x6a5c('0xa')](_0x9b038,_0x5ec600)[_0x6a5c('0xb')](function(_0x29b6fd){logger[_0x6a5c('0xc')](_0x6a5c('0xd'),_0x15ae61,_0x6a5c('0xe'));logger['debug'](_0x6a5c('0xf'),_0x15ae61,_0x6a5c('0xe'),JSON[_0x6a5c('0x10')](_0x29b6fd));if(_0x29b6fd[_0x6a5c('0x11')]){if(_0x29b6fd[_0x6a5c('0x11')]['code']===0x1f4){logger['error'](_0x6a5c('0xd'),_0x15ae61,_0x29b6fd[_0x6a5c('0x11')][_0x6a5c('0x12')]);return _0x45a62d(_0x29b6fd[_0x6a5c('0x11')][_0x6a5c('0x12')]);}logger[_0x6a5c('0x11')](_0x6a5c('0xd'),_0x15ae61,_0x29b6fd[_0x6a5c('0x11')][_0x6a5c('0x12')]);return _0x14c6ba(_0x29b6fd[_0x6a5c('0x11')]['message']);}else{logger[_0x6a5c('0xc')](_0x6a5c('0xd'),_0x15ae61,_0x6a5c('0xe'));_0x14c6ba(_0x29b6fd[_0x6a5c('0x13')]['message']);}})[_0x6a5c('0x14')](function(_0x514b1f){logger[_0x6a5c('0x11')](_0x6a5c('0xd'),_0x15ae61,_0x514b1f);_0x45a62d(_0x514b1f);});});}exports[_0x6a5c('0x15')]=function(_0x1a00a6){var _0x458566=this;return new Promise(function(_0x256771,_0x71fa91){return db['WhatsappQueueReport']['create'](_0x1a00a6[_0x6a5c('0x16')],{'raw':_0x1a00a6[_0x6a5c('0x17')]?_0x1a00a6[_0x6a5c('0x17')][_0x6a5c('0x18')]===undefined?!![]:![]:!![]})[_0x6a5c('0xb')](function(_0xfe15d3){logger['info']('CreateWhatsappQueueReport',_0x1a00a6);logger[_0x6a5c('0x19')](_0x6a5c('0x15'),_0x1a00a6,JSON[_0x6a5c('0x10')](_0xfe15d3));_0x256771(_0xfe15d3);})['catch'](function(_0x79ed77){logger[_0x6a5c('0x11')]('CreateWhatsappQueueReport',_0x79ed77[_0x6a5c('0x12')],_0x1a00a6);_0x71fa91(_0x458566[_0x6a5c('0x11')](0x1f4,_0x79ed77[_0x6a5c('0x12')]));});});};exports[_0x6a5c('0x1a')]=function(_0x28b0f2){var _0x393de8=this;return new Promise(function(_0x520414,_0x4de4c6){return db[_0x6a5c('0x1b')]['update'](_0x28b0f2['body'],{'raw':_0x28b0f2[_0x6a5c('0x17')]?_0x28b0f2[_0x6a5c('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28b0f2[_0x6a5c('0x17')]?_0x28b0f2[_0x6a5c('0x17')][_0x6a5c('0x1c')]||null:null,'attributes':_0x28b0f2[_0x6a5c('0x17')]?_0x28b0f2[_0x6a5c('0x17')]['attributes']||null:null,'limit':_0x28b0f2[_0x6a5c('0x17')]?_0x28b0f2['options'][_0x6a5c('0x1d')]||null:null})[_0x6a5c('0xb')](function(_0x23eb96){logger[_0x6a5c('0xc')]('UpdateWhatsappQueueReport',_0x28b0f2);logger[_0x6a5c('0x19')]('UpdateWhatsappQueueReport',_0x28b0f2,JSON['stringify'](_0x23eb96));_0x520414(_0x23eb96);})[_0x6a5c('0x14')](function(_0x2ef22b){logger['error']('UpdateWhatsappQueueReport',_0x2ef22b[_0x6a5c('0x12')],_0x28b0f2);_0x4de4c6(_0x393de8['error'](0x1f4,_0x2ef22b[_0x6a5c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 9228c34..2126edd 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 _0x1f68=['describe','/:id','show','create','put','update','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','./whatsappTransferReport.controller','get','isAuthenticated','/describe'];(function(_0x5541d4,_0x59dd80){var _0x389afa=function(_0x577fcc){while(--_0x577fcc){_0x5541d4['push'](_0x5541d4['shift']());}};_0x389afa(++_0x59dd80);}(_0x1f68,0x195));var _0x81f6=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x1f68[_0x5317b5];return _0x3b7ce2;};'use strict';var multer=require(_0x81f6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x81f6('0x1'));var router=express[_0x81f6('0x2')]();var fs_extra=require(_0x81f6('0x3'));var auth=require(_0x81f6('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x81f6('0x5'));router[_0x81f6('0x6')]('/',auth[_0x81f6('0x7')](),controller['index']);router[_0x81f6('0x6')](_0x81f6('0x8'),auth[_0x81f6('0x7')](),controller[_0x81f6('0x9')]);router[_0x81f6('0x6')](_0x81f6('0xa'),auth[_0x81f6('0x7')](),controller[_0x81f6('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x81f6('0xc')]);router[_0x81f6('0xd')](_0x81f6('0xa'),auth['isAuthenticated'](),controller[_0x81f6('0xe')]);router[_0x81f6('0xf')]('/:id',auth[_0x81f6('0x7')](),controller[_0x81f6('0x10')]);module[_0x81f6('0x11')]=router; \ No newline at end of file +var _0x953f=['../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x23e884,_0x1b91d5){var _0x3ec432=function(_0x41cc82){while(--_0x41cc82){_0x23e884['push'](_0x23e884['shift']());}};_0x3ec432(++_0x1b91d5);}(_0x953f,0xa2));var _0xf953=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x953f[_0x5c2e3e];return _0x53f64a;};'use strict';var multer=require('multer');var util=require(_0xf953('0x0'));var path=require(_0xf953('0x1'));var timeout=require(_0xf953('0x2'));var express=require(_0xf953('0x3'));var router=express[_0xf953('0x4')]();var fs_extra=require(_0xf953('0x5'));var auth=require(_0xf953('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf953('0x7'));var controller=require(_0xf953('0x8'));router[_0xf953('0x9')]('/',auth[_0xf953('0xa')](),controller[_0xf953('0xb')]);router[_0xf953('0x9')](_0xf953('0xc'),auth[_0xf953('0xa')](),controller[_0xf953('0xd')]);router[_0xf953('0x9')](_0xf953('0xe'),auth[_0xf953('0xa')](),controller[_0xf953('0xf')]);router[_0xf953('0x10')]('/',auth[_0xf953('0xa')](),controller['create']);router[_0xf953('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf953('0x12')](_0xf953('0xe'),auth[_0xf953('0xa')](),controller[_0xf953('0x13')]);module[_0xf953('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 366f6c6..25a99c3 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 _0xf3aa=['agent','sequelize','exports','STRING','ENUM'];(function(_0x35212e,_0x3931a5){var _0x5d0792=function(_0x31c762){while(--_0x31c762){_0x35212e['push'](_0x35212e['shift']());}};_0x5d0792(++_0x3931a5);}(_0xf3aa,0xf1));var _0xaf3a=function(_0xc6b104,_0x1d805a){_0xc6b104=_0xc6b104-0x0;var _0x1c6fce=_0xf3aa[_0xc6b104];return _0x1c6fce;};'use strict';var Sequelize=require(_0xaf3a('0x0'));module[_0xaf3a('0x1')]={'uniqueid':{'type':Sequelize[_0xaf3a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xaf3a('0x3')]('account',_0xaf3a('0x4'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x3c66=['account','agent','queue','DATE','ENUM'];(function(_0x272221,_0x596d1d){var _0x1a00cd=function(_0x11d3cc){while(--_0x11d3cc){_0x272221['push'](_0x272221['shift']());}};_0x1a00cd(++_0x596d1d);}(_0x3c66,0x8b));var _0x63c6=function(_0x2db8a1,_0x24a1bc){_0x2db8a1=_0x2db8a1-0x0;var _0x5ba362=_0x3c66[_0x2db8a1];return _0x5ba362;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x63c6('0x0')](_0x63c6('0x1'),_0x63c6('0x2'),_0x63c6('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x63c6('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 3b2eaa0..934f3c7 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 _0x50bf=['request-promise','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','type','key','query','keys','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','rimraf','fast-json-patch'];(function(_0xb73530,_0x31eba1){var _0x160eec=function(_0x3dfe0e){while(--_0x3dfe0e){_0xb73530['push'](_0xb73530['shift']());}};_0x160eec(++_0x31eba1);}(_0x50bf,0x106));var _0xf50b=function(_0x35f08f,_0x3b56f1){_0x35f08f=_0x35f08f-0x0;var _0x8e8ccb=_0x50bf[_0x35f08f];return _0x8e8ccb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf50b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf50b('0x1'));var rp=require(_0xf50b('0x2'));var moment=require('moment');var BPromise=require(_0xf50b('0x3'));var Mustache=require(_0xf50b('0x4'));var util=require('util');var path=require(_0xf50b('0x5'));var sox=require('sox');var csv=require(_0xf50b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf50b('0x7'));var _=require(_0xf50b('0x8'));var squel=require(_0xf50b('0x9'));var crypto=require('crypto');var jsforce=require(_0xf50b('0xa'));var deskjs=require(_0xf50b('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf50b('0xc'));var qs=require(_0xf50b('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf50b('0xe'));var logger=require('../../config/logger')(_0xf50b('0xf'));var utils=require(_0xf50b('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xf50b('0x11'));var db=require(_0xf50b('0x12'))['db'];function respondWithStatusCode(_0x5cb80c,_0x27800c){_0x27800c=_0x27800c||0xcc;return function(_0x420701){if(_0x420701){return _0x5cb80c[_0xf50b('0x13')](_0x27800c);}return _0x5cb80c[_0xf50b('0x14')](_0x27800c)['end']();};}function respondWithResult(_0x3a1c56,_0x110158){_0x110158=_0x110158||0xc8;return function(_0x405f94){if(_0x405f94){return _0x3a1c56[_0xf50b('0x14')](_0x110158)['json'](_0x405f94);}};}function respondWithFilteredResult(_0x543f7b,_0x69fbcc){return function(_0x4c041d){if(_0x4c041d){var _0x19460c=typeof _0x69fbcc[_0xf50b('0x15')]===_0xf50b('0x16')&&typeof _0x69fbcc[_0xf50b('0x17')]==='undefined';var _0x47950c=_0x4c041d[_0xf50b('0x18')];var _0x4fbf00=_0x19460c?0x0:_0x69fbcc['offset'];var _0x43ad41=_0x19460c?_0x4c041d[_0xf50b('0x18')]:_0x69fbcc[_0xf50b('0x15')]+_0x69fbcc[_0xf50b('0x17')];var _0x4b2b94;if(_0x43ad41>=_0x47950c){_0x43ad41=_0x47950c;_0x4b2b94=0xc8;}else{_0x4b2b94=0xce;}_0x543f7b['status'](_0x4b2b94);return _0x543f7b[_0xf50b('0x19')]('Content-Range',_0x4fbf00+'-'+_0x43ad41+'/'+_0x47950c)[_0xf50b('0x1a')](_0x4c041d);}return null;};}function patchUpdates(_0x442c89){return function(_0x3b439a){try{jsonpatch[_0xf50b('0x1b')](_0x3b439a,_0x442c89,!![]);}catch(_0x26912b){return BPromise[_0xf50b('0x1c')](_0x26912b);}return _0x3b439a[_0xf50b('0x1d')]();};}function saveUpdates(_0x445f57,_0xf15c47){return function(_0x5121fd){if(_0x5121fd){return _0x5121fd[_0xf50b('0x1e')](_0x445f57)[_0xf50b('0x1f')](function(_0x24a4aa){return _0x24a4aa;});}return null;};}function removeEntity(_0x1cefd3,_0x1572c9){return function(_0x3a0df9){if(_0x3a0df9){return _0x3a0df9['destroy']()[_0xf50b('0x1f')](function(){_0x1cefd3[_0xf50b('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x531399,_0x37ff8b){return function(_0x50f773){if(!_0x50f773){_0x531399[_0xf50b('0x13')](0x194);}return _0x50f773;};}function handleError(_0x4a6eda,_0x1d12ed){_0x1d12ed=_0x1d12ed||0x1f4;return function(_0x10bfeb){logger['error'](_0x10bfeb[_0xf50b('0x20')]);if(_0x10bfeb[_0xf50b('0x21')]){delete _0x10bfeb[_0xf50b('0x21')];}_0x4a6eda[_0xf50b('0x14')](_0x1d12ed)[_0xf50b('0x22')](_0x10bfeb);};}exports[_0xf50b('0x23')]=function(_0xf2dfac,_0x2997b9){var _0x5e4c29={},_0x49ed08={},_0x162304={'count':0x0,'rows':[]};var _0x5a1e92=_[_0xf50b('0x24')](db[_0xf50b('0x25')][_0xf50b('0x26')],function(_0x25fbdd){return{'name':_0x25fbdd['fieldName'],'type':_0x25fbdd[_0xf50b('0x27')][_0xf50b('0x28')]};});_0x49ed08['model']=_[_0xf50b('0x24')](_0x5a1e92,_0xf50b('0x21'));_0x49ed08[_0xf50b('0x29')]=_[_0xf50b('0x2a')](_0xf2dfac[_0xf50b('0x29')]);_0x49ed08['filters']=_['intersection'](_0x49ed08[_0xf50b('0x2b')],_0x49ed08[_0xf50b('0x29')]);_0x5e4c29[_0xf50b('0x2c')]=_[_0xf50b('0x2d')](_0x49ed08['model'],qs[_0xf50b('0x2e')](_0xf2dfac[_0xf50b('0x29')][_0xf50b('0x2e')]));_0x5e4c29[_0xf50b('0x2c')]=_0x5e4c29[_0xf50b('0x2c')]['length']?_0x5e4c29[_0xf50b('0x2c')]:_0x49ed08[_0xf50b('0x2b')];if(!_0xf2dfac[_0xf50b('0x29')][_0xf50b('0x2f')](_0xf50b('0x30'))){_0x5e4c29['limit']=qs[_0xf50b('0x17')](_0xf2dfac[_0xf50b('0x29')]['limit']);_0x5e4c29[_0xf50b('0x15')]=qs[_0xf50b('0x15')](_0xf2dfac[_0xf50b('0x29')][_0xf50b('0x15')]);}_0x5e4c29['order']=qs[_0xf50b('0x31')](_0xf2dfac[_0xf50b('0x29')][_0xf50b('0x31')]);_0x5e4c29[_0xf50b('0x32')]=qs[_0xf50b('0x33')](_['pick'](_0xf2dfac[_0xf50b('0x29')],_0x49ed08[_0xf50b('0x33')]),_0x5a1e92);if(_0xf2dfac['query'][_0xf50b('0x34')]){_0x5e4c29[_0xf50b('0x32')]=_[_0xf50b('0x35')](_0x5e4c29[_0xf50b('0x32')],{'$or':_[_0xf50b('0x24')](_0x5a1e92,function(_0x372d71){if(_0x372d71[_0xf50b('0x27')]!=='VIRTUAL'){var _0x5ca8cb={};_0x5ca8cb[_0x372d71[_0xf50b('0x21')]]={'$like':'%'+_0xf2dfac[_0xf50b('0x29')]['filter']+'%'};return _0x5ca8cb;}})});}_0x5e4c29=_['merge']({},_0x5e4c29,_0xf2dfac[_0xf50b('0x36')]);var _0x4ff1fa={'where':_0x5e4c29[_0xf50b('0x32')]};return db[_0xf50b('0x25')][_0xf50b('0x18')](_0x4ff1fa)[_0xf50b('0x1f')](function(_0x5864bd){_0x162304['count']=_0x5864bd;if(_0xf2dfac[_0xf50b('0x29')][_0xf50b('0x37')]){_0x5e4c29[_0xf50b('0x38')]=[{'all':!![]}];}return db[_0xf50b('0x25')][_0xf50b('0x39')](_0x5e4c29);})['then'](function(_0x54add5){_0x162304[_0xf50b('0x3a')]=_0x54add5;return _0x162304;})[_0xf50b('0x1f')](respondWithFilteredResult(_0x2997b9,_0x5e4c29))[_0xf50b('0x3b')](handleError(_0x2997b9,null));};exports[_0xf50b('0x3c')]=function(_0x309cd2,_0x32bcb8){var _0x4df85={'raw':!![],'where':{'id':_0x309cd2[_0xf50b('0x3d')]['id']}},_0x53b055={};_0x53b055[_0xf50b('0x2b')]=_[_0xf50b('0x2a')](db['WhatsappTransferReport'][_0xf50b('0x26')]);_0x53b055[_0xf50b('0x29')]=_[_0xf50b('0x2a')](_0x309cd2['query']);_0x53b055[_0xf50b('0x33')]=_[_0xf50b('0x2d')](_0x53b055[_0xf50b('0x2b')],_0x53b055['query']);_0x4df85[_0xf50b('0x2c')]=_['intersection'](_0x53b055[_0xf50b('0x2b')],qs['fields'](_0x309cd2[_0xf50b('0x29')][_0xf50b('0x2e')]));_0x4df85[_0xf50b('0x2c')]=_0x4df85[_0xf50b('0x2c')]['length']?_0x4df85['attributes']:_0x53b055[_0xf50b('0x2b')];if(_0x309cd2[_0xf50b('0x29')][_0xf50b('0x37')]){_0x4df85[_0xf50b('0x38')]=[{'all':!![]}];}_0x4df85=_[_0xf50b('0x35')]({},_0x4df85,_0x309cd2[_0xf50b('0x36')]);return db[_0xf50b('0x25')][_0xf50b('0x3e')](_0x4df85)[_0xf50b('0x1f')](handleEntityNotFound(_0x32bcb8,null))[_0xf50b('0x1f')](respondWithResult(_0x32bcb8,null))[_0xf50b('0x3b')](handleError(_0x32bcb8,null));};exports['create']=function(_0x494126,_0x8944b6){return db[_0xf50b('0x25')][_0xf50b('0x3f')](_0x494126['body'],{})['then'](respondWithResult(_0x8944b6,0xc9))['catch'](handleError(_0x8944b6,null));};exports['update']=function(_0x1d5498,_0x47b010){if(_0x1d5498[_0xf50b('0x40')]['id']){delete _0x1d5498[_0xf50b('0x40')]['id'];}return db[_0xf50b('0x25')]['find']({'where':{'id':_0x1d5498[_0xf50b('0x3d')]['id']}})[_0xf50b('0x1f')](handleEntityNotFound(_0x47b010,null))[_0xf50b('0x1f')](saveUpdates(_0x1d5498[_0xf50b('0x40')],null))[_0xf50b('0x1f')](respondWithResult(_0x47b010,null))[_0xf50b('0x3b')](handleError(_0x47b010,null));};exports['destroy']=function(_0x336db8,_0x4dcb1e){return db[_0xf50b('0x25')][_0xf50b('0x3e')]({'where':{'id':_0x336db8['params']['id']}})[_0xf50b('0x1f')](handleEntityNotFound(_0x4dcb1e,null))['then'](removeEntity(_0x4dcb1e,null))[_0xf50b('0x3b')](handleError(_0x4dcb1e,null));};exports['describe']=function(_0x4672be,_0x57de5e){return db[_0xf50b('0x25')][_0xf50b('0x41')]()[_0xf50b('0x1f')](respondWithResult(_0x57de5e,null))[_0xf50b('0x3b')](handleError(_0x57de5e,null));}; \ No newline at end of file +var _0x2300=['rows','params','keys','includeAll','options','find','create','body','catch','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','filter','where','merge','type','VIRTUAL','include','WhatsappTransferReport','findAll'];(function(_0x230277,_0x43bc6d){var _0x4de347=function(_0x1b766c){while(--_0x1b766c){_0x230277['push'](_0x230277['shift']());}};_0x4de347(++_0x43bc6d);}(_0x2300,0x181));var _0x0230=function(_0x466fb3,_0x57f44c){_0x466fb3=_0x466fb3-0x0;var _0x2236a3=_0x2300[_0x466fb3];return _0x2236a3;};'use strict';var emlformat=require(_0x0230('0x0'));var rimraf=require(_0x0230('0x1'));var zipdir=require(_0x0230('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0230('0x3'));var moment=require(_0x0230('0x4'));var BPromise=require(_0x0230('0x5'));var Mustache=require('mustache');var util=require(_0x0230('0x6'));var path=require(_0x0230('0x7'));var sox=require('sox');var csv=require(_0x0230('0x8'));var ejs=require(_0x0230('0x9'));var fs=require('fs');var fs_extra=require(_0x0230('0xa'));var _=require(_0x0230('0xb'));var squel=require(_0x0230('0xc'));var crypto=require(_0x0230('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0230('0xe'));var toCsv=require(_0x0230('0x8'));var querystring=require(_0x0230('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0230('0x10'));var qs=require(_0x0230('0x11'));var as=require(_0x0230('0x12'));var hardwareService=require(_0x0230('0x13'));var logger=require(_0x0230('0x14'))(_0x0230('0x15'));var utils=require(_0x0230('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0230('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10f58a,_0x3dd27e){_0x3dd27e=_0x3dd27e||0xcc;return function(_0x5ae655){if(_0x5ae655){return _0x10f58a[_0x0230('0x18')](_0x3dd27e);}return _0x10f58a[_0x0230('0x19')](_0x3dd27e)[_0x0230('0x1a')]();};}function respondWithResult(_0x51de7b,_0x47b98e){_0x47b98e=_0x47b98e||0xc8;return function(_0xfa88bf){if(_0xfa88bf){return _0x51de7b['status'](_0x47b98e)[_0x0230('0x1b')](_0xfa88bf);}};}function respondWithFilteredResult(_0x3a4ac2,_0x16d852){return function(_0x1412ef){if(_0x1412ef){var _0x598b0b=typeof _0x16d852['offset']==='undefined'&&typeof _0x16d852[_0x0230('0x1c')]===_0x0230('0x1d');var _0x4df2db=_0x1412ef[_0x0230('0x1e')];var _0x11f992=_0x598b0b?0x0:_0x16d852[_0x0230('0x1f')];var _0x5afaf1=_0x598b0b?_0x1412ef['count']:_0x16d852['offset']+_0x16d852['limit'];var _0x56171d;if(_0x5afaf1>=_0x4df2db){_0x5afaf1=_0x4df2db;_0x56171d=0xc8;}else{_0x56171d=0xce;}_0x3a4ac2[_0x0230('0x19')](_0x56171d);return _0x3a4ac2[_0x0230('0x20')](_0x0230('0x21'),_0x11f992+'-'+_0x5afaf1+'/'+_0x4df2db)[_0x0230('0x1b')](_0x1412ef);}return null;};}function patchUpdates(_0x49c8ed){return function(_0x34fa7f){try{jsonpatch[_0x0230('0x22')](_0x34fa7f,_0x49c8ed,!![]);}catch(_0x1fd2a5){return BPromise[_0x0230('0x23')](_0x1fd2a5);}return _0x34fa7f[_0x0230('0x24')]();};}function saveUpdates(_0x2aa6a2,_0x591599){return function(_0x412bc4){if(_0x412bc4){return _0x412bc4[_0x0230('0x25')](_0x2aa6a2)[_0x0230('0x26')](function(_0x2eb371){return _0x2eb371;});}return null;};}function removeEntity(_0x2585f1,_0x396e1e){return function(_0x4f897a){if(_0x4f897a){return _0x4f897a[_0x0230('0x27')]()[_0x0230('0x26')](function(){_0x2585f1[_0x0230('0x19')](0xcc)[_0x0230('0x1a')]();});}};}function handleEntityNotFound(_0x42a929,_0x2fcac8){return function(_0x21cdbd){if(!_0x21cdbd){_0x42a929[_0x0230('0x18')](0x194);}return _0x21cdbd;};}function handleError(_0x56745b,_0x1651a8){_0x1651a8=_0x1651a8||0x1f4;return function(_0x186598){logger['error'](_0x186598[_0x0230('0x28')]);if(_0x186598[_0x0230('0x29')]){delete _0x186598['name'];}_0x56745b['status'](_0x1651a8)[_0x0230('0x2a')](_0x186598);};}exports[_0x0230('0x2b')]=function(_0x369b23,_0x4c9908){var _0x1fd1a2={},_0x2840ef={},_0x36b924={'count':0x0,'rows':[]};var _0x1af3fa=_[_0x0230('0x2c')](db['WhatsappTransferReport'][_0x0230('0x2d')],function(_0x65891b){return{'name':_0x65891b['fieldName'],'type':_0x65891b['type'][_0x0230('0x2e')]};});_0x2840ef['model']=_['map'](_0x1af3fa,'name');_0x2840ef['query']=_['keys'](_0x369b23[_0x0230('0x2f')]);_0x2840ef[_0x0230('0x30')]=_[_0x0230('0x31')](_0x2840ef['model'],_0x2840ef[_0x0230('0x2f')]);_0x1fd1a2[_0x0230('0x32')]=_[_0x0230('0x31')](_0x2840ef[_0x0230('0x33')],qs[_0x0230('0x34')](_0x369b23[_0x0230('0x2f')][_0x0230('0x34')]));_0x1fd1a2[_0x0230('0x32')]=_0x1fd1a2[_0x0230('0x32')][_0x0230('0x35')]?_0x1fd1a2[_0x0230('0x32')]:_0x2840ef[_0x0230('0x33')];if(!_0x369b23[_0x0230('0x2f')][_0x0230('0x36')](_0x0230('0x37'))){_0x1fd1a2[_0x0230('0x1c')]=qs['limit'](_0x369b23['query']['limit']);_0x1fd1a2[_0x0230('0x1f')]=qs[_0x0230('0x1f')](_0x369b23[_0x0230('0x2f')]['offset']);}_0x1fd1a2[_0x0230('0x38')]=qs['sort'](_0x369b23[_0x0230('0x2f')]['sort']);_0x1fd1a2['where']=qs[_0x0230('0x30')](_['pick'](_0x369b23[_0x0230('0x2f')],_0x2840ef[_0x0230('0x30')]),_0x1af3fa);if(_0x369b23['query'][_0x0230('0x39')]){_0x1fd1a2[_0x0230('0x3a')]=_[_0x0230('0x3b')](_0x1fd1a2[_0x0230('0x3a')],{'$or':_[_0x0230('0x2c')](_0x1af3fa,function(_0x5b8007){if(_0x5b8007[_0x0230('0x3c')]!==_0x0230('0x3d')){var _0x154d9e={};_0x154d9e[_0x5b8007[_0x0230('0x29')]]={'$like':'%'+_0x369b23['query'][_0x0230('0x39')]+'%'};return _0x154d9e;}})});}_0x1fd1a2=_[_0x0230('0x3b')]({},_0x1fd1a2,_0x369b23['options']);var _0x297c8d={'where':_0x1fd1a2['where']};return db['WhatsappTransferReport'][_0x0230('0x1e')](_0x297c8d)['then'](function(_0x2c9d4b){_0x36b924[_0x0230('0x1e')]=_0x2c9d4b;if(_0x369b23[_0x0230('0x2f')]['includeAll']){_0x1fd1a2[_0x0230('0x3e')]=[{'all':!![]}];}return db[_0x0230('0x3f')][_0x0230('0x40')](_0x1fd1a2);})['then'](function(_0x31980f){_0x36b924[_0x0230('0x41')]=_0x31980f;return _0x36b924;})[_0x0230('0x26')](respondWithFilteredResult(_0x4c9908,_0x1fd1a2))['catch'](handleError(_0x4c9908,null));};exports['show']=function(_0x258bac,_0x537866){var _0x476f30={'raw':!![],'where':{'id':_0x258bac[_0x0230('0x42')]['id']}},_0x5f343e={};_0x5f343e[_0x0230('0x33')]=_[_0x0230('0x43')](db[_0x0230('0x3f')][_0x0230('0x2d')]);_0x5f343e[_0x0230('0x2f')]=_[_0x0230('0x43')](_0x258bac[_0x0230('0x2f')]);_0x5f343e[_0x0230('0x30')]=_[_0x0230('0x31')](_0x5f343e['model'],_0x5f343e[_0x0230('0x2f')]);_0x476f30[_0x0230('0x32')]=_['intersection'](_0x5f343e[_0x0230('0x33')],qs[_0x0230('0x34')](_0x258bac[_0x0230('0x2f')]['fields']));_0x476f30[_0x0230('0x32')]=_0x476f30['attributes']['length']?_0x476f30[_0x0230('0x32')]:_0x5f343e[_0x0230('0x33')];if(_0x258bac[_0x0230('0x2f')][_0x0230('0x44')]){_0x476f30[_0x0230('0x3e')]=[{'all':!![]}];}_0x476f30=_[_0x0230('0x3b')]({},_0x476f30,_0x258bac[_0x0230('0x45')]);return db[_0x0230('0x3f')][_0x0230('0x46')](_0x476f30)['then'](handleEntityNotFound(_0x537866,null))[_0x0230('0x26')](respondWithResult(_0x537866,null))['catch'](handleError(_0x537866,null));};exports[_0x0230('0x47')]=function(_0x188efb,_0x4a85bf){return db[_0x0230('0x3f')]['create'](_0x188efb[_0x0230('0x48')],{})[_0x0230('0x26')](respondWithResult(_0x4a85bf,0xc9))[_0x0230('0x49')](handleError(_0x4a85bf,null));};exports[_0x0230('0x25')]=function(_0x5527c9,_0xbe24ac){if(_0x5527c9[_0x0230('0x48')]['id']){delete _0x5527c9[_0x0230('0x48')]['id'];}return db['WhatsappTransferReport'][_0x0230('0x46')]({'where':{'id':_0x5527c9[_0x0230('0x42')]['id']}})[_0x0230('0x26')](handleEntityNotFound(_0xbe24ac,null))['then'](saveUpdates(_0x5527c9['body'],null))['then'](respondWithResult(_0xbe24ac,null))[_0x0230('0x49')](handleError(_0xbe24ac,null));};exports[_0x0230('0x27')]=function(_0x1b7244,_0x182151){return db['WhatsappTransferReport'][_0x0230('0x46')]({'where':{'id':_0x1b7244['params']['id']}})[_0x0230('0x26')](handleEntityNotFound(_0x182151,null))[_0x0230('0x26')](removeEntity(_0x182151,null))['catch'](handleError(_0x182151,null));};exports['describe']=function(_0x84cb98,_0x21c9c5){return db['WhatsappTransferReport'][_0x0230('0x4a')]()[_0x0230('0x26')](respondWithResult(_0x21c9c5,null))[_0x0230('0x49')](handleError(_0x21c9c5,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 2ce3ace..e190155 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 _0x9805=['request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','moment'];(function(_0x588787,_0x4f103b){var _0x3bf7c6=function(_0x551a50){while(--_0x551a50){_0x588787['push'](_0x588787['shift']());}};_0x3bf7c6(++_0x4f103b);}(_0x9805,0xd5));var _0x5980=function(_0x3626ad,_0xae31a9){_0x3626ad=_0x3626ad-0x0;var _0x2d9b1c=_0x9805[_0x3626ad];return _0x2d9b1c;};'use strict';var _=require(_0x5980('0x0'));var util=require(_0x5980('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5980('0x2'));var BPromise=require('bluebird');var rp=require(_0x5980('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5980('0x4'));var config=require(_0x5980('0x5'));var attributes=require(_0x5980('0x6'));module[_0x5980('0x7')]=function(_0x5f0d6a,_0x3d0e26){return _0x5f0d6a[_0x5980('0x8')](_0x5980('0x9'),attributes,{'tableName':_0x5980('0xa'),'paranoid':![],'indexes':[{'name':_0x5980('0xb'),'fields':[_0x5980('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0b93=['bluebird','path','rimraf','./whatsappTransferReport.attributes','exports','define','uniqueid','util','../../config/logger','moment'];(function(_0x43d79c,_0x531a55){var _0x4866b0=function(_0x847a){while(--_0x847a){_0x43d79c['push'](_0x43d79c['shift']());}};_0x4866b0(++_0x531a55);}(_0x0b93,0xcf));var _0x30b9=function(_0x5f40e2,_0x191e3b){_0x5f40e2=_0x5f40e2-0x0;var _0x2fd0eb=_0x0b93[_0x5f40e2];return _0x2fd0eb;};'use strict';var _=require('lodash');var util=require(_0x30b9('0x0'));var logger=require(_0x30b9('0x1'))('api');var moment=require(_0x30b9('0x2'));var BPromise=require(_0x30b9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x30b9('0x4'));var rimraf=require(_0x30b9('0x5'));var config=require('../../config/environment');var attributes=require(_0x30b9('0x6'));module[_0x30b9('0x7')]=function(_0x1f5487,_0x4a5710){return _0x1f5487[_0x30b9('0x8')]('WhatsappTransferReport',attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x30b9('0x9'),'fields':[_0x30b9('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index f1965fb..4b5724e 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 _0x832c=['WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x41006f,_0x2e8d07){var _0x500cb4=function(_0x407769){while(--_0x407769){_0x41006f['push'](_0x41006f['shift']());}};_0x500cb4(++_0x2e8d07);}(_0x832c,0xd9));var _0xc832=function(_0x1fb9d7,_0x423a06){_0x1fb9d7=_0x1fb9d7-0x0;var _0x3e9641=_0x832c[_0x1fb9d7];return _0x3e9641;};'use strict';var _=require(_0xc832('0x0'));var util=require('util');var moment=require(_0xc832('0x1'));var BPromise=require(_0xc832('0x2'));var rs=require(_0xc832('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc832('0x4'));var logger=require(_0xc832('0x5'))(_0xc832('0x6'));var config=require(_0xc832('0x7'));var jayson=require(_0xc832('0x8'));var client=jayson[_0xc832('0x9')][_0xc832('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50db9e,_0x331a96,_0x4b1f1a){return new BPromise(function(_0x50bf84,_0x5cea5f){return client[_0xc832('0xb')](_0x50db9e,_0x4b1f1a)[_0xc832('0xc')](function(_0x520584){logger['info'](_0xc832('0xd'),_0x331a96,'request\x20sent');logger[_0xc832('0xe')](_0xc832('0xf'),_0x331a96,_0xc832('0x10'),JSON[_0xc832('0x11')](_0x520584));if(_0x520584[_0xc832('0x12')]){if(_0x520584[_0xc832('0x12')][_0xc832('0x13')]===0x1f4){logger[_0xc832('0x12')](_0xc832('0xd'),_0x331a96,_0x520584[_0xc832('0x12')][_0xc832('0x14')]);return _0x5cea5f(_0x520584[_0xc832('0x12')][_0xc832('0x14')]);}logger[_0xc832('0x12')](_0xc832('0xd'),_0x331a96,_0x520584[_0xc832('0x12')][_0xc832('0x14')]);return _0x50bf84(_0x520584[_0xc832('0x12')][_0xc832('0x14')]);}else{logger[_0xc832('0x15')](_0xc832('0xd'),_0x331a96,_0xc832('0x10'));_0x50bf84(_0x520584['result'][_0xc832('0x14')]);}})[_0xc832('0x16')](function(_0xc2699d){logger[_0xc832('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x331a96,_0xc2699d);_0x5cea5f(_0xc2699d);});});} \ No newline at end of file +var _0x69be=['client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3b0a92,_0x5bab73){var _0x4286da=function(_0x492e32){while(--_0x492e32){_0x3b0a92['push'](_0x3b0a92['shift']());}};_0x4286da(++_0x5bab73);}(_0x69be,0x171));var _0xe69b=function(_0x317a30,_0x57cb93){_0x317a30=_0x317a30-0x0;var _0x31cbde=_0x69be[_0x317a30];return _0x31cbde;};'use strict';var _=require(_0xe69b('0x0'));var util=require(_0xe69b('0x1'));var moment=require('moment');var BPromise=require(_0xe69b('0x2'));var rs=require(_0xe69b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe69b('0x4'))['db'];var utils=require(_0xe69b('0x5'));var logger=require(_0xe69b('0x6'))(_0xe69b('0x7'));var config=require('../../config/environment');var jayson=require(_0xe69b('0x8'));var client=jayson[_0xe69b('0x9')][_0xe69b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ddbe0,_0x28e80c,_0x551f5c){return new BPromise(function(_0x2dadab,_0x40b5aa){return client[_0xe69b('0xb')](_0x1ddbe0,_0x551f5c)[_0xe69b('0xc')](function(_0x5adb9c){logger[_0xe69b('0xd')](_0xe69b('0xe'),_0x28e80c,_0xe69b('0xf'));logger[_0xe69b('0x10')](_0xe69b('0x11'),_0x28e80c,_0xe69b('0xf'),JSON['stringify'](_0x5adb9c));if(_0x5adb9c[_0xe69b('0x12')]){if(_0x5adb9c[_0xe69b('0x12')]['code']===0x1f4){logger[_0xe69b('0x12')](_0xe69b('0xe'),_0x28e80c,_0x5adb9c['error'][_0xe69b('0x13')]);return _0x40b5aa(_0x5adb9c[_0xe69b('0x12')][_0xe69b('0x13')]);}logger[_0xe69b('0x12')](_0xe69b('0xe'),_0x28e80c,_0x5adb9c[_0xe69b('0x12')][_0xe69b('0x13')]);return _0x2dadab(_0x5adb9c[_0xe69b('0x12')][_0xe69b('0x13')]);}else{logger[_0xe69b('0xd')](_0xe69b('0xe'),_0x28e80c,_0xe69b('0xf'));_0x2dadab(_0x5adb9c['result'][_0xe69b('0x13')]);}})[_0xe69b('0x14')](function(_0x550923){logger[_0xe69b('0x12')](_0xe69b('0xe'),_0x28e80c,_0x550923);_0x40b5aa(_0x550923);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 3b97b6e..cd493e7 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x94d1=['./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','info','start','then','Online\x20apps:','filter','online','join','Offline\x20apps:','map','status','None','seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc'];(function(_0xffc39b,_0x1f1007){var _0x2d9eb3=function(_0x367947){while(--_0x367947){_0xffc39b['push'](_0xffc39b['shift']());}};_0x2d9eb3(++_0x1f1007);}(_0x94d1,0x7d));var _0x194d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x94d1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x194d('0x0'));var mysqldb=require(_0x194d('0x1'));var rpc=require(_0x194d('0x2'));var config=require(_0x194d('0x3'));var logger=require(_0x194d('0x4'))(_0x194d('0x5'));var pm2=require(_0x194d('0x6'));var pm2Config=require(_0x194d('0x7'));var schedule=require(_0x194d('0x8'));var chat=require(_0x194d('0x9'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x194d('0xa'));function main(){return mysqldb['db'][_0x194d('0xb')][_0x194d('0xc')]()['then'](function(){return rpc['listen']();})['then'](function(_0x397568){logger[_0x194d('0xd')](_0x397568);return chat[_0x194d('0xe')]();})[_0x194d('0xf')](function(){return whatsapp[_0x194d('0xe')]();})['then'](function(){return schedule[_0x194d('0xe')]();})[_0x194d('0xf')](function(){return transcribe['start']();})['then'](function(_0x5aa360){logger[_0x194d('0xd')](_0x5aa360);return pm2['start'](pm2Config);})[_0x194d('0xf')](function(_0x45f5d3){logger['info'](_0x194d('0x10'),_['map'](_[_0x194d('0x11')](_0x45f5d3,{'status':_0x194d('0x12')}),'name')[_0x194d('0x13')]());logger[_0x194d('0xd')](_0x194d('0x14'),_[_0x194d('0x15')](_[_0x194d('0x11')](_0x45f5d3,function(_0x23dc0c){return _0x23dc0c[_0x194d('0x16')]!=='online';}),'name')['join']()||_0x194d('0x17'));config[_0x194d('0x18')]&&require(_0x194d('0x19'))[_0x194d('0x1a')]();require(_0x194d('0x1b'))['default']();})[_0x194d('0x1c')](function(_0x7f15d7){logger[_0x194d('0x1d')](_0x194d('0x1e'),_0x7f15d7);process[_0x194d('0x1f')](0x1);});}main(); \ No newline at end of file +var _0x4701=['error','lodash','./rpc','./config/logger','app','./config/schedule','./config/schedule/whatsapp','sequelize','sync','then','listen','info','start','Online\x20apps:','map','online','name','join','status','None','seedDB','./config/seedDB','default','./config/license','catch'];(function(_0x36f0cf,_0x3aaecf){var _0x21b2fb=function(_0x4bfa89){while(--_0x4bfa89){_0x36f0cf['push'](_0x36f0cf['shift']());}};_0x21b2fb(++_0x3aaecf);}(_0x4701,0x7e));var _0x1470=function(_0x213af9,_0x3e0484){_0x213af9=_0x213af9-0x0;var _0x1bcafe=_0x4701[_0x213af9];return _0x1bcafe;};'use strict';var _=require(_0x1470('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0x1470('0x1'));var config=require('./config/environment');var logger=require(_0x1470('0x2'))(_0x1470('0x3'));var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require(_0x1470('0x4'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x1470('0x5'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0x1470('0x6')][_0x1470('0x7')]()[_0x1470('0x8')](function(){return rpc[_0x1470('0x9')]();})[_0x1470('0x8')](function(_0x9353e0){logger[_0x1470('0xa')](_0x9353e0);return chat[_0x1470('0xb')]();})[_0x1470('0x8')](function(){return whatsapp[_0x1470('0xb')]();})[_0x1470('0x8')](function(){return schedule[_0x1470('0xb')]();})[_0x1470('0x8')](function(){return transcribe[_0x1470('0xb')]();})['then'](function(_0x390f27){logger[_0x1470('0xa')](_0x390f27);return pm2[_0x1470('0xb')](pm2Config);})[_0x1470('0x8')](function(_0x46a840){logger[_0x1470('0xa')](_0x1470('0xc'),_[_0x1470('0xd')](_['filter'](_0x46a840,{'status':_0x1470('0xe')}),_0x1470('0xf'))[_0x1470('0x10')]());logger['info']('Offline\x20apps:',_['map'](_['filter'](_0x46a840,function(_0x1f1c51){return _0x1f1c51[_0x1470('0x11')]!==_0x1470('0xe');}),_0x1470('0xf'))[_0x1470('0x10')]()||_0x1470('0x12'));config[_0x1470('0x13')]&&require(_0x1470('0x14'))[_0x1470('0x15')]();require(_0x1470('0x16'))['default']();})[_0x1470('0x17')](function(_0x1a845a){logger[_0x1470('0x18')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x1a845a);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 7ce2651..312ef40 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 _0x99e1=['The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','encryptString','sign','secret','payload','options','verify','toString','hex','now','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','bluebird','util','moment','secrets','session','fullname','internal','email','userpic','permissions','md5secret','mailPause','smsPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','isChatInteractionAuthorized','isAuthenticated','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','Unmanaged.','Forbidden.','catch','use','headers','authorization','startsWith','Basic','User','find','name','authenticate','json','Wrong\x20credentials.','user','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','sub','Setting','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','send','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','query','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','decryptString','split','toLowerCase'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x99e1,0x105));var _0x199e=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x99e1[_0x4e9628];return _0x27bc8c;};'use strict';var db=require(_0x199e('0x0'))['db'];var config=require(_0x199e('0x1'));var hardwareConf=require(_0x199e('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0x199e('0x3'));var _=require(_0x199e('0x4'));var jwt=require(_0x199e('0x5'));var expressJwt=require(_0x199e('0x6'));var compose=require(_0x199e('0x7'));var basicAuth=require('basic-auth');var crypto=require('crypto');var BPromise=require(_0x199e('0x8'));var util=require(_0x199e('0x9'));var moment=require(_0x199e('0xa'));var validateJwt=expressJwt({'secret':config[_0x199e('0xb')][_0x199e('0xc')]});var userAttributes=['id','role',_0x199e('0xd'),'name',_0x199e('0xe'),_0x199e('0xf'),_0x199e('0x10'),_0x199e('0x11'),_0x199e('0x12'),'voicePause','chatPause',_0x199e('0x13'),'faxPause',_0x199e('0x14'),'openchannelPause',_0x199e('0x15'),_0x199e('0x16'),_0x199e('0x17'),_0x199e('0x18'),_0x199e('0x19'),'allowmessenger','passwordResetAt',_0x199e('0x1a'),_0x199e('0x1b'),_0x199e('0x1c'),'phoneBarDnd',_0x199e('0x1d'),'phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires',_0x199e('0x1e'),_0x199e('0x1f'),_0x199e('0x20'),_0x199e('0x21'),_0x199e('0x22'),_0x199e('0x23'),_0x199e('0x24'),_0x199e('0x25'),_0x199e('0x26'),_0x199e('0x27'),_0x199e('0x28'),'downloadAttachments'];exports[_0x199e('0x29')]=function(){return this[_0x199e('0x2a')](!![])['use'](function(_0x15f93a,_0x9ecb95,_0x3c7fe5){if(_0x15f93a['user']){_0x3c7fe5();}else{return db[_0x199e('0x2b')][_0x199e('0x2c')]({'where':{'id':_0x15f93a[_0x199e('0x2d')]['id']},'attributes':['id',_0x199e('0x2e'),_0x199e('0x2f')],'raw':!![]})[_0x199e('0x30')](function(_0x228c36){if(_0x228c36&&_0x228c36[_0x199e('0x2e')]){return _0x9ecb95[_0x199e('0x31')](_0x228c36['disposition']==='unmanaged'?0x195:0x193)['json']({'message':_0x228c36[_0x199e('0x2f')]===_0x199e('0x32')?_0x199e('0x33'):_0x199e('0x34')});}else{_0x3c7fe5();}})[_0x199e('0x35')](function(_0x2f8b8f){_0x3c7fe5(_0x2f8b8f);});}});};exports[_0x199e('0x2a')]=function isAuthenticated(_0x1425b9){return compose()[_0x199e('0x36')](function(_0x4da151,_0xcf7367,_0x11f6ce){var _0xe50968;if(_0x4da151[_0x199e('0x37')][_0x199e('0x38')]){if(_[_0x199e('0x39')](_0x4da151[_0x199e('0x37')]['authorization'],_0x199e('0x3a'))){var _0x5b02c1=basicAuth(_0x4da151);db[_0x199e('0x3b')][_0x199e('0x3c')]({'where':{'name':_0x5b02c1[_0x199e('0x3d')]}})[_0x199e('0x30')](function(_0x35a28c){if(!_0x35a28c||!_0x35a28c[_0x199e('0x3e')](_0x5b02c1['pass'])){return _0xcf7367[_0x199e('0x31')](0x191)[_0x199e('0x3f')]({'message':_0x199e('0x40')});}_0x4da151[_0x199e('0x41')]={'id':_0x35a28c['id']};_0x11f6ce();})['catch'](function(_0x143f2f){_0x11f6ce(_0x143f2f);});}else if(_[_0x199e('0x39')](_0x4da151[_0x199e('0x37')][_0x199e('0x38')],_0x199e('0x42'))){validateJwt(_0x4da151,_0xcf7367,_0x11f6ce);}else{if(_0x1425b9){_0x11f6ce();}else{return _0xcf7367[_0x199e('0x31')](0x193)[_0x199e('0x3f')]({'message':_0x199e('0x43')});}}}else if(_0x4da151['query'][_0x199e('0x44')]){try{var _0x46a3d0={'audience':hardwareConf[_0x199e('0x45')](),'issuer':hardwareConf[_0x199e('0x45')]()};verifyJwt(_0x4da151['query'][_0x199e('0x44')],_0x46a3d0)[_0x199e('0x30')](function(_0x56279c){return db['User'][_0x199e('0x3c')]({'where':{'id':_0x56279c[_0x199e('0x46')]}})[_0x199e('0x30')](function(_0x2e1370){_0xe50968=_0x2e1370;return db[_0x199e('0x47')][_0x199e('0x2c')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x199e('0x48')],'raw':!![]});})[_0x199e('0x30')](function(_0x38b412){if(!_0xe50968||!_[_0x199e('0x49')](_0xe50968['apiKeyNonce'],_0x56279c[_0x199e('0x4a')])){return _0xcf7367[_0x199e('0x31')](0x191)[_0x199e('0x3f')]({'message':_0x199e('0x4b')});}if(_0xe50968[_0x199e('0x4c')]){return _0xcf7367['status'](0x191)[_0x199e('0x3f')]({'message':_0x199e('0x4d')});}if(_0xe50968[_0x199e('0x4e')]){if(_0x38b412[_0x199e('0x48')]>0x0){if(moment(_0xe50968[_0x199e('0x4f')])[_0x199e('0x50')](_0x38b412[_0x199e('0x48')],_0x199e('0x51'))>moment()){return _0xcf7367[_0x199e('0x31')](0x191)[_0x199e('0x3f')]({'message':_0x199e('0x4d')});}}else{return _0xcf7367[_0x199e('0x31')](0x191)[_0x199e('0x3f')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x4da151[_0x199e('0x41')]={'id':_0xe50968['id']};_0x11f6ce();});})[_0x199e('0x35')](function(){return _0xcf7367[_0x199e('0x31')](0x191)[_0x199e('0x3f')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x5b1ce0){_0x11f6ce(_0x5b1ce0);}}else if(_0x1425b9){_0x11f6ce();}else{return _0xcf7367[_0x199e('0x31')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})[_0x199e('0x36')](function(_0x5c1d17,_0x5eb7b1,_0x230ead){if(_0x5c1d17[_0x199e('0x41')]){db['User'][_0x199e('0x3c')]({'where':{'id':_0x5c1d17[_0x199e('0x41')]['id']},'attributes':userAttributes})['then'](function(_0x299c5f){if(!_0x299c5f){return _0x5eb7b1[_0x199e('0x31')](0x194)[_0x199e('0x3f')]({'message':_0x199e('0x52')});}_0x5c1d17['user']=_0x299c5f;_0x230ead();})[_0x199e('0x35')](function(_0x253101){_0x230ead(_0x253101);});}else if(_0x1425b9){_0x230ead();}else{return _0x5eb7b1[_0x199e('0x31')](0x194)['json']({'message':_0x199e('0x53')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x199e('0x36')](function(_0x47f96b,_0x3ef33a,_0x9ed8fa){return licenseUtil['getLicense']()[_0x199e('0x30')](function(_0x22f95c){if(_0x22f95c[_0x199e('0x54')]){_0x9ed8fa();}else{return _0x3ef33a[_0x199e('0x31')](0x193)['json']({'message':_0x199e('0x55')});}})[_0x199e('0x35')](function(_0x3c762d){_0x9ed8fa(_0x3c762d);});});};exports[_0x199e('0x56')]=function(_0x54d293,_0x539a92,_0x82953d){_0x54d293[_0x199e('0x56')]=!![];return _0x82953d();};exports[_0x199e('0x57')]=function signToken(_0x49ea67){return signJwt(_0x49ea67);};exports[_0x199e('0x58')]=function(_0x30e891,_0x542f47){if(!_0x30e891[_0x199e('0x41')]){return _0x542f47[_0x199e('0x31')](0x194)[_0x199e('0x3f')]({'message':_0x199e('0x59')});}var _0x507c63={'payload':{'id':_0x30e891[_0x199e('0x41')]['id'],'role':_0x30e891[_0x199e('0x41')][_0x199e('0x5a')]},'options':{'expiresIn':0x15180}};return signJwt(_0x507c63)[_0x199e('0x30')](function(_0x13d9b0){_0x542f47[_0x199e('0x5b')](_0x199e('0x5c'),_0x13d9b0);_0x542f47[_0x199e('0x5d')]('/dashboards/general');})[_0x199e('0x35')](function(_0x5b6283){return _0x542f47['status'](0x1f4)[_0x199e('0x5e')](_0x5b6283);});};exports['retrieveApiKey']=function(_0x5cdc95){if(_[_0x199e('0x5f')](_0x5cdc95[_0x199e('0x60')])||_[_0x199e('0x5f')](_0x5cdc95[_0x199e('0x61')])){return null;}else{return createJwt(_0x5cdc95);}};exports[_0x199e('0x62')]=function(_0x883c04){_0x883c04[_0x199e('0x60')]=generateNonce();_0x883c04[_0x199e('0x61')]=generateIssuedAt();return createJwt(_0x883c04);};exports[_0x199e('0x63')]=function(_0x3799a1,_0x46b712){var _0x25e2b3=_0x3799a1[_0x199e('0x64')][_0x199e('0x44')];if(_0x25e2b3){var _0x10fa17={'nonce':_0x46b712[_0x199e('0x60')],'iat':_0x46b712[_0x199e('0x61')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x199e('0x45')]()};return verifyJwt(_0x25e2b3,_0x10fa17)[_0x199e('0x30')](function(){return generateApiKey(_0x46b712);});}else{throw{'message':_0x199e('0x65')};}};exports[_0x199e('0x66')]=function(_0x569d5a){var _0x397b33=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x397b33['test'](_0x569d5a))throw new db[(_0x199e('0x67'))][(_0x199e('0x68'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports['validatePasswordHistory']=function(_0x4f693e,_0x1c54f9,_0x455887){var _0x20a4b4=encryptor[_0x199e('0x69')](_0x1c54f9)[_0x199e('0x6a')](',');for(var _0x1e95c3=0x0;_0x1e95c3<_0x455887;_0x1e95c3++){if(!_0x20a4b4[_0x1e95c3])break;if(_0x4f693e[_0x199e('0x6b')]()===_0x20a4b4[_0x1e95c3][_0x199e('0x6b')]()){var _0x3bb58=util['format'](_0x199e('0x6c'),_0x455887);if(_0x455887===0x1){_0x3bb58=_0x199e('0x6d');}throw new db['Sequelize'][(_0x199e('0x68'))](_0x3bb58);}}return;};exports[_0x199e('0x6e')]=function(_0x122f52,_0x2b3c52){var _0x588a12=_0x2b3c52?encryptor[_0x199e('0x69')](_0x2b3c52)[_0x199e('0x6a')](','):[];if(_0x588a12[_0x199e('0x6f')]===0x5){_0x588a12[_0x199e('0x70')](-0x1,0x1);}_0x588a12[_0x199e('0x71')](_0x122f52);return encryptor[_0x199e('0x72')](_0x588a12['join'](','));};function signJwt(_0x2880cc){var _0x4abc78=BPromise['promisify'](jwt[_0x199e('0x73')],{'context':jwt});var _0x17801f=_0x2880cc[_0x199e('0x74')]||config[_0x199e('0xb')]['session'];return new BPromise(function(_0x1c0f9a,_0x26015c){_0x4abc78(_0x2880cc[_0x199e('0x75')],_0x17801f,_0x2880cc[_0x199e('0x76')])[_0x199e('0x30')](function(_0x159d0e){_0x1c0f9a(_0x159d0e);})[_0x199e('0x35')](function(_0x5b46c4){_0x26015c(_0x5b46c4);});});}function verifyJwt(_0x3789c9,_0x21c32f,_0x18d8d3){var _0x5e9536=BPromise['promisify'](jwt[_0x199e('0x77')],{'context':jwt});var _0x32ba36=_0x18d8d3||config[_0x199e('0xb')][_0x199e('0xc')];return new BPromise(function(_0x2d17e1,_0x14e4bf){_0x5e9536(_0x3789c9,_0x32ba36,_0x21c32f)['then'](function(_0x4dff28){_0x2d17e1(_0x4dff28);})[_0x199e('0x35')](function(_0x2e217a){_0x14e4bf(_0x2e217a);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x199e('0x78')](_0x199e('0x79'));}function generateIssuedAt(){return Math['floor'](Date[_0x199e('0x7a')]()/0x3e8)['toString']();}function createJwt(_0x4a1756){var _0x32742f={'payload':{'iat':_0x4a1756[_0x199e('0x61')],'nonce':_0x4a1756['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x4a1756['id'][_0x199e('0x78')](),'issuer':hardwareConf[_0x199e('0x45')](),'audience':hardwareConf[_0x199e('0x45')]()}};return signJwt(_0x32742f)[_0x199e('0x30')](function(_0x355638){return{'iat':_0x4a1756['apiKeyIat'],'nonce':_0x4a1756['apiKeyNonce'],'token':_0x355638};});} \ No newline at end of file +var _0x052b=['toString','hex','floor','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto','secrets','session','role','fullname','name','userpic','md5secret','voicePause','chatPause','mailPause','smsPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','hotdesk','interface','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','closed','then','status','disposition','unmanaged','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','User','find','authenticate','json','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','canUpdate','getLicense','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','splice','unshift','encryptString','join','promisify','payload','verify'];(function(_0x2dd3b2,_0x266c26){var _0x556c06=function(_0x221e64){while(--_0x221e64){_0x2dd3b2['push'](_0x2dd3b2['shift']());}};_0x556c06(++_0x266c26);}(_0x052b,0x1df));var _0xb052=function(_0x5aa931,_0x4b57f7){_0x5aa931=_0x5aa931-0x0;var _0x2fb46b=_0x052b[_0x5aa931];return _0x2fb46b;};'use strict';var db=require(_0xb052('0x0'))['db'];var config=require(_0xb052('0x1'));var hardwareConf=require(_0xb052('0x2'));var licenseUtil=require(_0xb052('0x3'));var encryptor=require(_0xb052('0x4'));var _=require(_0xb052('0x5'));var jwt=require(_0xb052('0x6'));var expressJwt=require('express-jwt');var compose=require(_0xb052('0x7'));var basicAuth=require(_0xb052('0x8'));var crypto=require(_0xb052('0x9'));var BPromise=require('bluebird');var util=require('util');var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0xb052('0xa')][_0xb052('0xb')]});var userAttributes=['id',_0xb052('0xc'),_0xb052('0xd'),_0xb052('0xe'),'internal','email',_0xb052('0xf'),'permissions',_0xb052('0x10'),_0xb052('0x11'),_0xb052('0x12'),_0xb052('0x13'),'faxPause',_0xb052('0x14'),'openchannelPause',_0xb052('0x15'),_0xb052('0x16'),_0xb052('0x17'),_0xb052('0x18'),_0xb052('0x19'),_0xb052('0x1a'),'passwordResetAt','alias',_0xb052('0x1b'),'phoneBarAutoAnswerDelay',_0xb052('0x1c'),_0xb052('0x1d'),_0xb052('0x1e'),_0xb052('0x1f'),_0xb052('0x20'),'phoneBarPrefixRequired',_0xb052('0x21'),'phoneBarRemoteControlPort',_0xb052('0x22'),_0xb052('0x23'),'userProfileId',_0xb052('0x24'),'settingsEnabled',_0xb052('0x25'),_0xb052('0x26'),_0xb052('0x27'),'downloadAttachments'];exports[_0xb052('0x28')]=function(){return this[_0xb052('0x29')](!![])[_0xb052('0x2a')](function(_0x4cd03a,_0xf7d721,_0x3f10f0){if(_0x4cd03a[_0xb052('0x2b')]){_0x3f10f0();}else{return db[_0xb052('0x2c')][_0xb052('0x2d')]({'where':{'id':_0x4cd03a['params']['id']},'attributes':['id',_0xb052('0x2e'),'disposition'],'raw':!![]})[_0xb052('0x2f')](function(_0x3d10ce){if(_0x3d10ce&&_0x3d10ce['closed']){return _0xf7d721[_0xb052('0x30')](_0x3d10ce[_0xb052('0x31')]===_0xb052('0x32')?0x195:0x193)['json']({'message':_0x3d10ce[_0xb052('0x31')]===_0xb052('0x32')?_0xb052('0x33'):_0xb052('0x34')});}else{_0x3f10f0();}})[_0xb052('0x35')](function(_0x1fc2fd){_0x3f10f0(_0x1fc2fd);});}});};exports[_0xb052('0x29')]=function isAuthenticated(_0x44cc62){return compose()[_0xb052('0x2a')](function(_0x3fe7ba,_0x412931,_0xb31b56){var _0x25d81f;if(_0x3fe7ba[_0xb052('0x36')][_0xb052('0x37')]){if(_[_0xb052('0x38')](_0x3fe7ba['headers'][_0xb052('0x37')],_0xb052('0x39'))){var _0x489fbb=basicAuth(_0x3fe7ba);db[_0xb052('0x3a')][_0xb052('0x3b')]({'where':{'name':_0x489fbb[_0xb052('0xe')]}})[_0xb052('0x2f')](function(_0x561540){if(!_0x561540||!_0x561540[_0xb052('0x3c')](_0x489fbb['pass'])){return _0x412931[_0xb052('0x30')](0x191)[_0xb052('0x3d')]({'message':_0xb052('0x3e')});}_0x3fe7ba[_0xb052('0x2b')]={'id':_0x561540['id']};_0xb31b56();})[_0xb052('0x35')](function(_0x1d7a9e){_0xb31b56(_0x1d7a9e);});}else if(_[_0xb052('0x38')](_0x3fe7ba[_0xb052('0x36')][_0xb052('0x37')],_0xb052('0x3f'))){validateJwt(_0x3fe7ba,_0x412931,_0xb31b56);}else{if(_0x44cc62){_0xb31b56();}else{return _0x412931['status'](0x193)[_0xb052('0x3d')]({'message':_0xb052('0x40')});}}}else if(_0x3fe7ba[_0xb052('0x41')][_0xb052('0x42')]){try{var _0x2d410b={'audience':hardwareConf[_0xb052('0x43')](),'issuer':hardwareConf[_0xb052('0x43')]()};verifyJwt(_0x3fe7ba[_0xb052('0x41')][_0xb052('0x42')],_0x2d410b)[_0xb052('0x2f')](function(_0x3cb00a){return db[_0xb052('0x3a')][_0xb052('0x3b')]({'where':{'id':_0x3cb00a[_0xb052('0x44')]}})['then'](function(_0x3240ff){_0x25d81f=_0x3240ff;return db[_0xb052('0x45')][_0xb052('0x2d')]({'where':{'id':0x1},'attributes':[_0xb052('0x46'),_0xb052('0x47')],'raw':!![]});})[_0xb052('0x2f')](function(_0x5532bd){if(!_0x25d81f||!_[_0xb052('0x48')](_0x25d81f[_0xb052('0x49')],_0x3cb00a['nonce'])){return _0x412931[_0xb052('0x30')](0x191)['json']({'message':_0xb052('0x4a')});}if(_0x25d81f['disabled']){return _0x412931['status'](0x191)['json']({'message':_0xb052('0x4b')});}if(_0x25d81f[_0xb052('0x4c')]){if(_0x5532bd[_0xb052('0x47')]>0x0){if(moment(_0x25d81f[_0xb052('0x4d')])[_0xb052('0x4e')](_0x5532bd['blockDuration'],_0xb052('0x4f'))>moment()){return _0x412931['status'](0x191)['json']({'message':_0xb052('0x4b')});}}else{return _0x412931[_0xb052('0x30')](0x191)[_0xb052('0x3d')]({'message':_0xb052('0x4b')});}}_0x3fe7ba[_0xb052('0x2b')]={'id':_0x25d81f['id']};_0xb31b56();});})[_0xb052('0x35')](function(){return _0x412931[_0xb052('0x30')](0x191)[_0xb052('0x3d')]({'message':_0xb052('0x4b')});});}catch(_0x586a11){_0xb31b56(_0x586a11);}}else if(_0x44cc62){_0xb31b56();}else{return _0x412931[_0xb052('0x30')](0x193)[_0xb052('0x3d')]({'message':_0xb052('0x40')});}})['use'](function(_0x83da8f,_0x44c43c,_0x2f9e4f){if(_0x83da8f[_0xb052('0x2b')]){db[_0xb052('0x3a')][_0xb052('0x3b')]({'where':{'id':_0x83da8f[_0xb052('0x2b')]['id']},'attributes':userAttributes})[_0xb052('0x2f')](function(_0x333db1){if(!_0x333db1){return _0x44c43c[_0xb052('0x30')](0x194)['json']({'message':_0xb052('0x50')});}_0x83da8f['user']=_0x333db1;_0x2f9e4f();})[_0xb052('0x35')](function(_0x16ec82){_0x2f9e4f(_0x16ec82);});}else if(_0x44cc62){_0x2f9e4f();}else{return _0x44c43c[_0xb052('0x30')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xb052('0x51')]=function canUpdate(){return compose()[_0xb052('0x2a')](function(_0x92c544,_0x2ad016,_0x5e55e5){return licenseUtil[_0xb052('0x52')]()[_0xb052('0x2f')](function(_0x271557){if(_0x271557['update']){_0x5e55e5();}else{return _0x2ad016[_0xb052('0x30')](0x193)['json']({'message':_0xb052('0x53')});}})[_0xb052('0x35')](function(_0xaacda0){_0x5e55e5(_0xaacda0);});});};exports[_0xb052('0x54')]=function(_0x273efe,_0x2e5097,_0x196533){_0x273efe['isMiddleware']=!![];return _0x196533();};exports[_0xb052('0x55')]=function signToken(_0x52b051){return signJwt(_0x52b051);};exports[_0xb052('0x56')]=function(_0x1e1aed,_0x1ae99a){if(!_0x1e1aed[_0xb052('0x2b')]){return _0x1ae99a[_0xb052('0x30')](0x194)[_0xb052('0x3d')]({'message':_0xb052('0x57')});}var _0x33ceab={'payload':{'id':_0x1e1aed['user']['id'],'role':_0x1e1aed['user'][_0xb052('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x33ceab)[_0xb052('0x2f')](function(_0xaf8dd6){_0x1ae99a[_0xb052('0x58')](_0xb052('0x59'),_0xaf8dd6);_0x1ae99a[_0xb052('0x5a')](_0xb052('0x5b'));})[_0xb052('0x35')](function(_0x47ac65){return _0x1ae99a[_0xb052('0x30')](0x1f4)[_0xb052('0x5c')](_0x47ac65);});};exports[_0xb052('0x5d')]=function(_0x2b0213){if(_[_0xb052('0x5e')](_0x2b0213[_0xb052('0x49')])||_[_0xb052('0x5e')](_0x2b0213[_0xb052('0x5f')])){return null;}else{return createJwt(_0x2b0213);}};exports['generateApiKey']=function(_0x1c44c1){_0x1c44c1[_0xb052('0x49')]=generateNonce();_0x1c44c1[_0xb052('0x5f')]=generateIssuedAt();return createJwt(_0x1c44c1);};exports[_0xb052('0x60')]=function(_0x1f53f0,_0x3e21f8){var _0x299128=_0x1f53f0[_0xb052('0x41')]['apikey'];if(_0x299128){var _0x1354c9={'nonce':_0x3e21f8[_0xb052('0x49')],'iat':_0x3e21f8[_0xb052('0x5f')],'audience':hardwareConf[_0xb052('0x43')](),'issuer':hardwareConf[_0xb052('0x43')]()};return verifyJwt(_0x299128,_0x1354c9)['then'](function(){return generateApiKey(_0x3e21f8);});}else{throw{'message':_0xb052('0x61')};}};exports[_0xb052('0x62')]=function(_0x4b04a4){var _0x48f58e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x48f58e['test'](_0x4b04a4))throw new db[(_0xb052('0x63'))][(_0xb052('0x64'))](_0xb052('0x65'));return;};exports[_0xb052('0x66')]=function(_0x46d73d,_0x5320c8,_0x5ac9cf){var _0x214db8=encryptor[_0xb052('0x67')](_0x5320c8)[_0xb052('0x68')](',');for(var _0x4cd575=0x0;_0x4cd575<_0x5ac9cf;_0x4cd575++){if(!_0x214db8[_0x4cd575])break;if(_0x46d73d['toLowerCase']()===_0x214db8[_0x4cd575][_0xb052('0x69')]()){var _0x59bfdb=util[_0xb052('0x6a')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x5ac9cf);if(_0x5ac9cf===0x1){_0x59bfdb=_0xb052('0x6b');}throw new db[(_0xb052('0x63'))][(_0xb052('0x64'))](_0x59bfdb);}}return;};exports[_0xb052('0x6c')]=function(_0x2f9c8d,_0x27d999){var _0x4e6fc6=_0x27d999?encryptor[_0xb052('0x67')](_0x27d999)['split'](','):[];if(_0x4e6fc6['length']===0x5){_0x4e6fc6[_0xb052('0x6d')](-0x1,0x1);}_0x4e6fc6[_0xb052('0x6e')](_0x2f9c8d);return encryptor[_0xb052('0x6f')](_0x4e6fc6[_0xb052('0x70')](','));};function signJwt(_0x12f8bb){var _0x365350=BPromise[_0xb052('0x71')](jwt['sign'],{'context':jwt});var _0x4df2be=_0x12f8bb['secret']||config[_0xb052('0xa')]['session'];return new BPromise(function(_0x26c20f,_0x25372c){_0x365350(_0x12f8bb[_0xb052('0x72')],_0x4df2be,_0x12f8bb['options'])[_0xb052('0x2f')](function(_0x11feab){_0x26c20f(_0x11feab);})[_0xb052('0x35')](function(_0xa3cc54){_0x25372c(_0xa3cc54);});});}function verifyJwt(_0x4219c8,_0x24a365,_0x2ed2b5){var _0x254eb7=BPromise[_0xb052('0x71')](jwt[_0xb052('0x73')],{'context':jwt});var _0x212773=_0x2ed2b5||config[_0xb052('0xa')][_0xb052('0xb')];return new BPromise(function(_0x47452e,_0x1c0e59){_0x254eb7(_0x4219c8,_0x212773,_0x24a365)[_0xb052('0x2f')](function(_0x25bf08){_0x47452e(_0x25bf08);})['catch'](function(_0x2d41bb){_0x1c0e59(_0x2d41bb);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xb052('0x74')](_0xb052('0x75'));}function generateIssuedAt(){return Math[_0xb052('0x76')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x3e595f){var _0x11e219={'payload':{'iat':_0x3e595f[_0xb052('0x5f')],'nonce':_0x3e595f[_0xb052('0x49')]},'options':{'algorithm':'HS512','subject':_0x3e595f['id']['toString'](),'issuer':hardwareConf[_0xb052('0x43')](),'audience':hardwareConf[_0xb052('0x43')]()}};return signJwt(_0x11e219)[_0xb052('0x2f')](function(_0x4439c3){return{'iat':_0x3e595f['apiKeyIat'],'nonce':_0x3e595f[_0xb052('0x49')],'token':_0x4439c3};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index b73845b..f6233b4 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 _0xfbb4=['error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','hasOwnProperty','encryptFile','createReadStream','createCipher','update','binary','write','end','final','unlink','createWriteStream','createDecipher','data','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/logger','app','secrets','aes-256-ctr','aes192','encrypt','algorithm','join'];(function(_0x3d3b05,_0x334c57){var _0x2c6ca3=function(_0x3fd1cc){while(--_0x3fd1cc){_0x3d3b05['push'](_0x3d3b05['shift']());}};_0x2c6ca3(++_0x334c57);}(_0xfbb4,0x16b));var _0x4fbb=function(_0x58486a,_0x12fbd7){_0x58486a=_0x58486a-0x0;var _0x426bf0=_0xfbb4[_0x58486a];return _0x426bf0;};'use strict';var crypto=require(_0x4fbb('0x0'));var fs=require('fs');var BPromise=require(_0x4fbb('0x1'));var _=require(_0x4fbb('0x2'));var config=require('../../config/environment');var logger=require(_0x4fbb('0x3'))(_0x4fbb('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x4fbb('0x5')]['session'],'algorithm':_0x4fbb('0x6')};const fileOptions={'algorithm':_0x4fbb('0x7')};if(config[_0x4fbb('0x8')]&&config[_0x4fbb('0x8')][_0x4fbb('0x9')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x4fbb('0x9')]);if(isSupported){fileOptions[_0x4fbb('0x9')]=config[_0x4fbb('0x8')][_0x4fbb('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x4fbb('0xa')](',\x20');logger[_0x4fbb('0xb')](config[_0x4fbb('0x8')][_0x4fbb('0x9')],_0x4fbb('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x3099d0){return AES_SUPPORTED_RX[_0x4fbb('0xd')](_0x3099d0);}function getSupportedCiphers(){return crypto[_0x4fbb('0xe')]()[_0x4fbb('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x14f8c5){return getSupportedCiphers()['indexOf'](_0x14f8c5)>-0x1;}function combineOptions(_0x40182d){var _0x587f5b={};for(var _0x499259 in fileOptions){if(fileOptions[_0x4fbb('0x10')](_0x499259)){_0x587f5b[_0x499259]=fileOptions[_0x499259];}}if(_0x40182d){for(var _0x49d1df in _0x40182d){if(_0x40182d[_0x4fbb('0x10')](_0x49d1df)){_0x587f5b[_0x49d1df]=_0x40182d[_0x49d1df];}}}return _0x587f5b;}exports[_0x4fbb('0x11')]=function(_0x5a52b1,_0x594cef,_0x1be85a,_0x2fdb30){return new BPromise(function(_0x49a8a0,_0x511b43){_0x2fdb30=combineOptions(_0x2fdb30);var _0x97e874=new Buffer(_0x1be85a);var _0x59eb8d=fs[_0x4fbb('0x12')](_0x5a52b1);var _0x594f1f=fs['createWriteStream'](_0x594cef);var _0xca2f89=crypto[_0x4fbb('0x13')](_0x2fdb30[_0x4fbb('0x9')],_0x97e874);_0x59eb8d['on']('data',function(_0x2e593d){var _0x4a4bd7=new Buffer(_0xca2f89[_0x4fbb('0x14')](_0x2e593d),_0x4fbb('0x15'));_0x594f1f[_0x4fbb('0x16')](_0x4a4bd7);});_0x59eb8d['on'](_0x4fbb('0x17'),function(){try{var _0x15ddd8=new Buffer(_0xca2f89[_0x4fbb('0x18')]('binary'),_0x4fbb('0x15'));_0x594f1f[_0x4fbb('0x16')](_0x15ddd8);_0x594f1f[_0x4fbb('0x17')]();_0x594f1f['on']('close',function(){return _0x49a8a0(_0x594cef);});}catch(_0x119c22){fs[_0x4fbb('0x19')](_0x594cef);return _0x511b43(_0x119c22);}});});};exports['decryptFile']=function(_0x51c198,_0xc79982,_0x5abe51,_0x2a4098){return new BPromise(function(_0x3aec8f,_0xd2770b){_0x2a4098=combineOptions(_0x2a4098);var _0x40e0c1=new Buffer(_0x5abe51);var _0x14429e=fs['createReadStream'](_0x51c198);var _0x3abfe6=fs[_0x4fbb('0x1a')](_0xc79982);var _0x804c43=crypto[_0x4fbb('0x1b')](_0x2a4098[_0x4fbb('0x9')],_0x40e0c1);_0x14429e['on'](_0x4fbb('0x1c'),function(_0x57ddfb){var _0x585241=new Buffer(_0x804c43[_0x4fbb('0x14')](_0x57ddfb),_0x4fbb('0x15'));_0x3abfe6[_0x4fbb('0x16')](_0x585241);});_0x14429e['on'](_0x4fbb('0x17'),function(){try{var _0x4125cd=new Buffer(_0x804c43[_0x4fbb('0x18')]('binary'),_0x4fbb('0x15'));_0x3abfe6[_0x4fbb('0x16')](_0x4125cd);_0x3abfe6[_0x4fbb('0x17')]();_0x3abfe6['on']('close',function(){return _0x3aec8f(_0xc79982);});}catch(_0x399f08){fs[_0x4fbb('0x19')](_0xc79982);return _0xd2770b(_0x399f08);}});});};exports[_0x4fbb('0x1d')]=function(_0x34ba05,_0xe9b066,_0x39bd11){var _0x424a48=_0x39bd11||stringOptions[_0x4fbb('0x9')];var _0x2f3fc7=_0xe9b066||stringOptions[_0x4fbb('0x1e')];var _0x3a17fa=crypto[_0x4fbb('0x13')](_0x424a48,_0x2f3fc7);var _0x29d976=_0x3a17fa[_0x4fbb('0x14')](_0x34ba05,_0x4fbb('0x1f'),_0x4fbb('0x20'));_0x29d976+=_0x3a17fa[_0x4fbb('0x18')](_0x4fbb('0x20'));return _0x29d976;};exports[_0x4fbb('0x21')]=function(_0x4f5508,_0x11e03d,_0x4277da){var _0x3184f1=_0x4277da||stringOptions[_0x4fbb('0x9')];var _0x5b95e9=_0x11e03d||stringOptions['secret'];var _0x2a4fc1=crypto['createDecipher'](_0x3184f1,_0x5b95e9);var _0x3d548e=_0x2a4fc1[_0x4fbb('0x14')](_0x4f5508,'base64',_0x4fbb('0x1f'));_0x3d548e+=_0x2a4fc1[_0x4fbb('0x18')](_0x4fbb('0x1f'));return _0x3d548e;}; \ No newline at end of file +var _0xad96=['update','base64','decryptString','utf8','crypto','bluebird','../../config/environment','../../config/logger','app','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','createReadStream','createWriteStream','createCipher','data','binary','write','final','end','close','unlink','decryptFile','createDecipher','secret'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0xad96,0x1e0));var _0x6ad9=function(_0x455e82,_0x522f6f){_0x455e82=_0x455e82-0x0;var _0x2d0520=_0xad96[_0x455e82];return _0x2d0520;};'use strict';var crypto=require(_0x6ad9('0x0'));var fs=require('fs');var BPromise=require(_0x6ad9('0x1'));var _=require('lodash');var config=require(_0x6ad9('0x2'));var logger=require(_0x6ad9('0x3'))(_0x6ad9('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x6ad9('0x5')],'algorithm':_0x6ad9('0x6')};const fileOptions={'algorithm':_0x6ad9('0x7')};if(config[_0x6ad9('0x8')]&&config[_0x6ad9('0x8')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0x6ad9('0x8')][_0x6ad9('0x9')]);if(isSupported){fileOptions[_0x6ad9('0x9')]=config[_0x6ad9('0x8')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x6ad9('0xa')](',\x20');logger[_0x6ad9('0xb')](config[_0x6ad9('0x8')][_0x6ad9('0x9')],_0x6ad9('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x8f31ec){return AES_SUPPORTED_RX[_0x6ad9('0xd')](_0x8f31ec);}function getSupportedCiphers(){return crypto[_0x6ad9('0xe')]()[_0x6ad9('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0xd416c6){return getSupportedCiphers()[_0x6ad9('0x10')](_0xd416c6)>-0x1;}function combineOptions(_0x5a076f){var _0x319505={};for(var _0x5b740b in fileOptions){if(fileOptions['hasOwnProperty'](_0x5b740b)){_0x319505[_0x5b740b]=fileOptions[_0x5b740b];}}if(_0x5a076f){for(var _0x174ed1 in _0x5a076f){if(_0x5a076f['hasOwnProperty'](_0x174ed1)){_0x319505[_0x174ed1]=_0x5a076f[_0x174ed1];}}}return _0x319505;}exports['encryptFile']=function(_0xb00f22,_0x530915,_0x2746bc,_0x595e6e){return new BPromise(function(_0x7941ae,_0x105210){_0x595e6e=combineOptions(_0x595e6e);var _0x196615=new Buffer(_0x2746bc);var _0x5f37c2=fs[_0x6ad9('0x11')](_0xb00f22);var _0x534d5d=fs[_0x6ad9('0x12')](_0x530915);var _0xd5afd8=crypto[_0x6ad9('0x13')](_0x595e6e[_0x6ad9('0x9')],_0x196615);_0x5f37c2['on'](_0x6ad9('0x14'),function(_0xb60c53){var _0x3bb1ac=new Buffer(_0xd5afd8['update'](_0xb60c53),_0x6ad9('0x15'));_0x534d5d[_0x6ad9('0x16')](_0x3bb1ac);});_0x5f37c2['on']('end',function(){try{var _0x1c70cd=new Buffer(_0xd5afd8[_0x6ad9('0x17')](_0x6ad9('0x15')),_0x6ad9('0x15'));_0x534d5d[_0x6ad9('0x16')](_0x1c70cd);_0x534d5d[_0x6ad9('0x18')]();_0x534d5d['on'](_0x6ad9('0x19'),function(){return _0x7941ae(_0x530915);});}catch(_0x433cab){fs[_0x6ad9('0x1a')](_0x530915);return _0x105210(_0x433cab);}});});};exports[_0x6ad9('0x1b')]=function(_0x55c8ba,_0x3ba46f,_0xb7bb8,_0x2f6c74){return new BPromise(function(_0x149db0,_0x2e2322){_0x2f6c74=combineOptions(_0x2f6c74);var _0x2baf90=new Buffer(_0xb7bb8);var _0x18a940=fs[_0x6ad9('0x11')](_0x55c8ba);var _0x149b31=fs['createWriteStream'](_0x3ba46f);var _0x25f09c=crypto[_0x6ad9('0x1c')](_0x2f6c74[_0x6ad9('0x9')],_0x2baf90);_0x18a940['on'](_0x6ad9('0x14'),function(_0xeee155){var _0x2227ae=new Buffer(_0x25f09c['update'](_0xeee155),_0x6ad9('0x15'));_0x149b31[_0x6ad9('0x16')](_0x2227ae);});_0x18a940['on']('end',function(){try{var _0x18bf31=new Buffer(_0x25f09c[_0x6ad9('0x17')]('binary'),'binary');_0x149b31['write'](_0x18bf31);_0x149b31[_0x6ad9('0x18')]();_0x149b31['on']('close',function(){return _0x149db0(_0x3ba46f);});}catch(_0x14646a){fs[_0x6ad9('0x1a')](_0x3ba46f);return _0x2e2322(_0x14646a);}});});};exports['encryptString']=function(_0x1afbae,_0xaa5070,_0xbeedb9){var _0x1c724c=_0xbeedb9||stringOptions['algorithm'];var _0x4c98d1=_0xaa5070||stringOptions[_0x6ad9('0x1d')];var _0x265b38=crypto[_0x6ad9('0x13')](_0x1c724c,_0x4c98d1);var _0x50e8bc=_0x265b38[_0x6ad9('0x1e')](_0x1afbae,'utf8',_0x6ad9('0x1f'));_0x50e8bc+=_0x265b38['final'](_0x6ad9('0x1f'));return _0x50e8bc;};exports[_0x6ad9('0x20')]=function(_0x1d428f,_0x32ed82,_0x4b8e8c){var _0x4c86a1=_0x4b8e8c||stringOptions[_0x6ad9('0x9')];var _0x1f1b7e=_0x32ed82||stringOptions[_0x6ad9('0x1d')];var _0xc02794=crypto[_0x6ad9('0x1c')](_0x4c86a1,_0x1f1b7e);var _0x392e7b=_0xc02794[_0x6ad9('0x1e')](_0x1d428f,_0x6ad9('0x1f'),_0x6ad9('0x21'));_0x392e7b+=_0xc02794['final'](_0x6ad9('0x21'));return _0x392e7b;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index f3fa808..095ea27 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 _0xd9de=['catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','to-csv','zip-dir','rimraf','dbH','../../config/logger','analytics','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','splitSizeCsv','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','then','Empty','split','range','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','length','join','mkdirSync','each','%s%d.%s','csv','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','%s.%s'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xd9de,0x126));var _0xed9d=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xd9de[_0x3bf83f];return _0x22c4a9;};'use strict';var util=require(_0xed9d('0x0'));var path=require(_0xed9d('0x1'));var _=require('lodash');var csv=require(_0xed9d('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xed9d('0x3'));var rimraf=require(_0xed9d('0x4'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xed9d('0x5')];var logger=require(_0xed9d('0x6'))(_0xed9d('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xed9d('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xed9d('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1ed079,_0x695b9a){var _0x16410b={'status':_0x1ed079};var _0x3c7865={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x695b9a){_0x16410b[_0xed9d('0x9')]=_0x695b9a;}return db['AnalyticExtractedReport'][_0xed9d('0xa')](_0x16410b,_0x3c7865);}function main(){var _0x5b6439=0x1388;var _0x4dd6d5;logger[_0xed9d('0xb')](util[_0xed9d('0xc')](_0xed9d('0xd'),EXTRACTED_REPORT_ID,_0xed9d('0xe')));return db[_0xed9d('0xf')][_0xed9d('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xed9d('0x11')]})['then'](function(_0x14b0c6){if(_0x14b0c6){_0x4dd6d5=_0x14b0c6;_0x5b6439=_0x4dd6d5[_0xed9d('0x11')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0xed9d('0x12')](util[_0xed9d('0xc')](_0xed9d('0x13'),QUERY),{'type':dbH[_0xed9d('0x14')][_0xed9d('0x15')][_0xed9d('0x16')]});})[_0xed9d('0x17')](function(_0x5051e2){if(!_0x5051e2[0x0]['num']){return analyticExtractedReport(_0xed9d('0x18'));}var _0x4f68d6=[];var _0x35ac06=0x0;if(_0x4dd6d5[_0xed9d('0x19')]){if(_0x5051e2&&_0x5051e2['length']){var _0x5d8be2=_[_0xed9d('0x1a')](_0x5051e2[0x0][_0xed9d('0x1b')]/_0x5b6439);var _0x51122c=Number['isInteger'](_0x5051e2[0x0][_0xed9d('0x1b')]/_0x5b6439)?_0x5051e2[0x0][_0xed9d('0x1b')]%_0x5b6439:0x0;_0x5d8be2['forEach'](function(_0x49405f){if(_0x49405f>0x0){_0x35ac06+=_0x5b6439;}_0x4f68d6[_0xed9d('0x1c')](dbH[_0xed9d('0x14')]['query'](util[_0xed9d('0xc')](_0xed9d('0x1d'),QUERY,_0x5b6439,_0x35ac06),{'type':dbH['sequelize']['QueryTypes'][_0xed9d('0x16')]}));});if(_0x51122c>0x0){_0x35ac06+=_0x5b6439;_0x4f68d6[_0xed9d('0x1c')](dbH[_0xed9d('0x14')][_0xed9d('0x12')](util['format'](_0xed9d('0x1d'),QUERY,_0x51122c,_0x35ac06),{'type':dbH[_0xed9d('0x14')][_0xed9d('0x15')][_0xed9d('0x16')]}));}}}else{_0x4f68d6['push'](dbH[_0xed9d('0x14')][_0xed9d('0x12')](QUERY,{'type':dbH[_0xed9d('0x14')][_0xed9d('0x15')]['SELECT']}));}var _0xb285dd=path['dirname'](PATH);var _0x1cdc8a=path[_0xed9d('0x1e')](PATH,_0xed9d('0x1f'));var _0x4eec32=_0x4dd6d5[_0xed9d('0x19')]&&_0x4f68d6[_0xed9d('0x20')]>0x1;var _0x5b25ac=[];if(!fs['existsSync'](path[_0xed9d('0x21')](_0xb285dd,_0x1cdc8a))&&_0x4eec32){fs[_0xed9d('0x22')](path['join'](_0xb285dd,_0x1cdc8a));}return BPromise[_0xed9d('0x23')](_0x4f68d6,function(_0x221454){_0x5b25ac[_0xed9d('0x1c')](_0x221454);})[_0xed9d('0x17')](function(){for(var _0x1b9d22=0x0;_0x1b9d22<_0x5b25ac[_0xed9d('0x20')];_0x1b9d22+=0x1){var _0x491420;var _0x324937=_0x5b25ac[_0x1b9d22];if(_0x4eec32){_0x491420=path[_0xed9d('0x21')](_0xb285dd,_0x1cdc8a,util[_0xed9d('0xc')](_0xed9d('0x24'),_0x1cdc8a,_0x1b9d22,_0xed9d('0x25')));}else{_0x491420=path[_0xed9d('0x21')](_0xb285dd,util['format']('%s.%s',_0x1cdc8a,'csv'));}fs['writeFileSync'](_0x491420,csv(_0x324937));}})[_0xed9d('0x17')](function(){if(_0x4eec32){return new Promise(function(_0x2e433d){zipdir(path[_0xed9d('0x21')](_0xb285dd,_0x1cdc8a),{'saveTo':path['join'](_0xb285dd,util[_0xed9d('0xc')]('%s.%s',_0x1cdc8a,_0xed9d('0x26')))},function(_0x4d6fdb,_0x412748){rimraf(path[_0xed9d('0x21')](_0xb285dd,_0x1cdc8a),function(){});_0x2e433d('zip\x20finished');});});}})[_0xed9d('0x17')](function(){logger['info'](util[_0xed9d('0xc')](_0xed9d('0x27'),EXTRACTED_REPORT_ID,_0xed9d('0xe')));return analyticExtractedReport(_0xed9d('0x28'),_0x4eec32?util[_0xed9d('0xc')](_0xed9d('0x29'),_0x1cdc8a,_0x4eec32?_0xed9d('0x26'):'csv'):null);});})[_0xed9d('0x2a')](function(_0x59c9b6){logger['info'](util['format'](_0xed9d('0x2b'),EXTRACTED_REPORT_ID,_0xed9d('0xe')),util[_0xed9d('0x2c')](_0x59c9b6,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xed9d('0x2d'));})[_0xed9d('0x2e')](function(){process[_0xed9d('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xb698=['update','info','format','Setting','split','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','length','range','forEach','push','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','existsSync','join','mkdirSync','each','%s.%s','csv','writeFileSync','zip\x20finished','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','util','to-csv','bluebird','rimraf','../../mysqldb','dbH','argv','AnalyticExtractedReport'];(function(_0x2da993,_0x86b86d){var _0x2bf6bb=function(_0x282890){while(--_0x282890){_0x2da993['push'](_0x2da993['shift']());}};_0x2bf6bb(++_0x86b86d);}(_0xb698,0xfa));var _0x8b69=function(_0x36944c,_0x4bcb5d){_0x36944c=_0x36944c-0x0;var _0x3825e9=_0xb698[_0x36944c];return _0x3825e9;};'use strict';var util=require(_0x8b69('0x0'));var path=require('path');var _=require('lodash');var csv=require(_0x8b69('0x1'));var fs=require('fs');var BPromise=require(_0x8b69('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0x8b69('0x3'));var db=require('../../mysqldb')['db'];var dbH=require(_0x8b69('0x4'))[_0x8b69('0x5')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x8b69('0x6')][0x2]);var QUERY=process[_0x8b69('0x6')][0x3];var PATH=process[_0x8b69('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x165e73,_0x22fe5e){var _0x35ccef={'status':_0x165e73};var _0x4f0234={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x22fe5e){_0x35ccef['savename']=_0x22fe5e;}return db[_0x8b69('0x7')][_0x8b69('0x8')](_0x35ccef,_0x4f0234);}function main(){var _0x591d79=0x1388;var _0x3525d0;logger[_0x8b69('0x9')](util[_0x8b69('0xa')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db[_0x8b69('0xb')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8b69('0xc'),_0x8b69('0xd')]})[_0x8b69('0xe')](function(_0x3660a9){if(_0x3660a9){_0x3525d0=_0x3660a9;_0x591d79=_0x3525d0[_0x8b69('0xd')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0x8b69('0xf')](util[_0x8b69('0xa')](_0x8b69('0x10'),QUERY),{'type':dbH['sequelize'][_0x8b69('0x11')]['SELECT']});})[_0x8b69('0xe')](function(_0x6b0187){if(!_0x6b0187[0x0][_0x8b69('0x12')]){return analyticExtractedReport(_0x8b69('0x13'));}var _0x5a47db=[];var _0x12418d=0x0;if(_0x3525d0[_0x8b69('0xc')]){if(_0x6b0187&&_0x6b0187[_0x8b69('0x14')]){var _0x414e0d=_[_0x8b69('0x15')](_0x6b0187[0x0][_0x8b69('0x12')]/_0x591d79);var _0x5ed4fa=Number['isInteger'](_0x6b0187[0x0][_0x8b69('0x12')]/_0x591d79)?_0x6b0187[0x0][_0x8b69('0x12')]%_0x591d79:0x0;_0x414e0d[_0x8b69('0x16')](function(_0xe49c93){if(_0xe49c93>0x0){_0x12418d+=_0x591d79;}_0x5a47db[_0x8b69('0x17')](dbH[_0x8b69('0x18')][_0x8b69('0xf')](util[_0x8b69('0xa')](_0x8b69('0x19'),QUERY,_0x591d79,_0x12418d),{'type':dbH[_0x8b69('0x18')][_0x8b69('0x11')][_0x8b69('0x1a')]}));});if(_0x5ed4fa>0x0){_0x12418d+=_0x591d79;_0x5a47db[_0x8b69('0x17')](dbH[_0x8b69('0x18')]['query'](util[_0x8b69('0xa')](_0x8b69('0x19'),QUERY,_0x5ed4fa,_0x12418d),{'type':dbH[_0x8b69('0x18')][_0x8b69('0x11')][_0x8b69('0x1a')]}));}}}else{_0x5a47db[_0x8b69('0x17')](dbH[_0x8b69('0x18')][_0x8b69('0xf')](QUERY,{'type':dbH[_0x8b69('0x18')][_0x8b69('0x11')][_0x8b69('0x1a')]}));}var _0x6364a=path[_0x8b69('0x1b')](PATH);var _0x3dd541=path[_0x8b69('0x1c')](PATH,'.csv');var _0x385afa=_0x3525d0[_0x8b69('0xc')]&&_0x5a47db[_0x8b69('0x14')]>0x1;var _0x47b803=[];if(!fs[_0x8b69('0x1d')](path[_0x8b69('0x1e')](_0x6364a,_0x3dd541))&&_0x385afa){fs[_0x8b69('0x1f')](path[_0x8b69('0x1e')](_0x6364a,_0x3dd541));}return BPromise[_0x8b69('0x20')](_0x5a47db,function(_0x296eee){_0x47b803[_0x8b69('0x17')](_0x296eee);})[_0x8b69('0xe')](function(){for(var _0x23b0d2=0x0;_0x23b0d2<_0x47b803[_0x8b69('0x14')];_0x23b0d2+=0x1){var _0x10b84c;var _0x2a3b1e=_0x47b803[_0x23b0d2];if(_0x385afa){_0x10b84c=path['join'](_0x6364a,_0x3dd541,util[_0x8b69('0xa')]('%s%d.%s',_0x3dd541,_0x23b0d2,'csv'));}else{_0x10b84c=path[_0x8b69('0x1e')](_0x6364a,util[_0x8b69('0xa')](_0x8b69('0x21'),_0x3dd541,_0x8b69('0x22')));}fs[_0x8b69('0x23')](_0x10b84c,csv(_0x2a3b1e));}})[_0x8b69('0xe')](function(){if(_0x385afa){return new Promise(function(_0x2cd7c1){zipdir(path[_0x8b69('0x1e')](_0x6364a,_0x3dd541),{'saveTo':path[_0x8b69('0x1e')](_0x6364a,util['format'](_0x8b69('0x21'),_0x3dd541,'zip'))},function(_0x5876b9,_0x272c88){rimraf(path[_0x8b69('0x1e')](_0x6364a,_0x3dd541),function(){});_0x2cd7c1(_0x8b69('0x24'));});});}})[_0x8b69('0xe')](function(){logger['info'](util[_0x8b69('0xa')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x8b69('0x25'),_0x385afa?util['format'](_0x8b69('0x21'),_0x3dd541,_0x385afa?_0x8b69('0x26'):_0x8b69('0x22')):null);});})[_0x8b69('0x27')](function(_0x1c1590){logger['info'](util['format'](_0x8b69('0x28'),EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x1c1590,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8b69('0x29'));})[_0x8b69('0x2a')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index bd8e0a1..8740e78 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 _0xac5f=['/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','finish','error','end','lodash','path','moment','html-to-pdfmake','zip-dir','jsdom','window','bluebird','../../mysqldb','dbH','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','map','pick','value','fill','auto','body','push','concat','chunk','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','length','header','pageBreak','margin','landscape','toString','footer','Arial','right','Empty','find','split','splitSizePdf','then','num','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','mkdirSync','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','info','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','exit','/fonts/arial-bold.ttf'];(function(_0x518ccc,_0x283328){var _0x1b4e2e=function(_0x3c0a70){while(--_0x3c0a70){_0x518ccc['push'](_0x518ccc['shift']());}};_0x1b4e2e(++_0x283328);}(_0xac5f,0x103));var _0xfac5=function(_0xcc2acb,_0x33f0dd){_0xcc2acb=_0xcc2acb-0x0;var _0x1908d0=_0xac5f[_0xcc2acb];return _0x1908d0;};'use strict';var _=require(_0xfac5('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xfac5('0x1'));var moment=require(_0xfac5('0x2'));var htmlToPdfmake=require(_0xfac5('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xfac5('0x4'));var rimraf=require('rimraf');var JSDOM=require(_0xfac5('0x5'))['JSDOM'];var window=new JSDOM('')[_0xfac5('0x6')];var BPromise=require(_0xfac5('0x7'));var db=require(_0xfac5('0x8'))['db'];var dbH=require(_0xfac5('0x8'))[_0xfac5('0x9')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xfac5('0xa')][0x2]);var QUERY=process[_0xfac5('0xa')][0x3];var PATH=process[_0xfac5('0xa')][0x4];var NAME=process[_0xfac5('0xa')][0x5];var FORMAT=_0xfac5('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x220ed9,_0x250d9e){var _0xbbc6={'status':_0x220ed9};var _0x2d6f2c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x250d9e){_0xbbc6['savename']=_0x250d9e;}return db[_0xfac5('0xc')][_0xfac5('0xd')](_0xbbc6,_0x2d6f2c);}function getHeaders(_0x162045){return _[_0xfac5('0xe')](_0x162045,function(_0x3dd7d9){return{'text':_0x3dd7d9,'style':'tableHeader'};});}function getRows(_0x278dd2,_0x4f5db7){return _[_0xfac5('0xe')](_0x4f5db7,function(_0x215393){return _(_0x215393)[_0xfac5('0xf')](_0x278dd2)[_0xfac5('0xe')](function(_0x13c23d){return _0x13c23d?_['toString'](_0x13c23d):'';})[_0xfac5('0x10')]();});}function createTable(_0x24808f,_0x27b8ce){var _0x3c2ff8={'widths':_[_0xfac5('0x11')](Array(_0x24808f['length']),0x91),'heights':function(_0x59066c){return _0x59066c===0x0?_0xfac5('0x12'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x2400d3=getHeaders(_0x24808f);_0x3c2ff8[_0xfac5('0x13')][_0xfac5('0x14')](_0x2400d3);var _0xfbe5d7=getRows(_0x24808f,_0x27b8ce);_0x3c2ff8[_0xfac5('0x13')]=_0x3c2ff8[_0xfac5('0x13')][_0xfac5('0x15')](_0xfbe5d7);return _0x3c2ff8;}function createTables(_0x2d367c){var _0x1931ea=[];var _0x5372e7=_[_0xfac5('0x16')](Object['keys'](_0x2d367c[0x0]),0x5);_0x5372e7[_0xfac5('0x17')](function(_0x5e63fd){_0x1931ea[_0xfac5('0x14')](createTable(_0x5e63fd,_0x2d367c));});return _0x1931ea;}function getPDFDocDefinition(_0x5cd074){var _0x30fd4e=util[_0xfac5('0x18')](_0xfac5('0x19'),NAME,EXTRACTED_REPORT[_0xfac5('0x1a')],moment(EXTRACTED_REPORT[_0xfac5('0x1b')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0xfac5('0x1c')])['format'](FORMAT));var _0x2f851a=[];for(var _0x2ae15b=0x0;_0x2ae15b<_0x5cd074[_0xfac5('0x1d')];_0x2ae15b++){var _0x48b8ce=[];if(_0x2ae15b===0x0){_0x48b8ce['push']({'text':_0x30fd4e,'style':_0xfac5('0x1e')});}var _0x4064a0={'table':_0x5cd074[_0x2ae15b]};if(_0x2ae15b>0x0){_0x4064a0[_0xfac5('0x1f')]='before';_0x4064a0[_0xfac5('0x20')]=[0x0,0x46,0x0,0x0];}_0x48b8ce[_0xfac5('0x14')](_0x4064a0);_0x2f851a[_0xfac5('0x14')](_0x48b8ce);}return{'pageSize':'A4','pageOrientation':_0xfac5('0x21'),'content':_0x2f851a,'footer':function(_0x25dcab,_0x227e85){return{'text':_0x25dcab[_0xfac5('0x22')]()+'\x20/\x20'+_0x227e85,'style':_0xfac5('0x23')};},'defaultStyle':{'font':_0xfac5('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0xfac5('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x38af93){var _0x3e2bdf=0x1388;var _0x791ce3;if(!_0x38af93[0x0]['num']){return analyticExtractedReport(_0xfac5('0x26'));}return db['Setting'][_0xfac5('0x27')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xfac5('0x28'),_0xfac5('0x29')]})['then'](function(_0x12ed67){if(_0x12ed67){_0x791ce3=_0x12ed67;_0x3e2bdf=_0x791ce3[_0xfac5('0x29')]||0x3e8;}})[_0xfac5('0x2a')](function(){var _0x3df310=[];var _0x4b2859=0x0;if(_0x791ce3[_0xfac5('0x28')]){if(_0x38af93&&_0x38af93['length']){var _0x2a2a5e=_['range'](_0x38af93[0x0]['num']/_0x3e2bdf);var _0x5c2722=Number['isInteger'](_0x38af93[0x0][_0xfac5('0x2b')]/_0x3e2bdf)?_0x38af93[0x0][_0xfac5('0x2b')]%_0x3e2bdf:0x0;_0x2a2a5e['forEach'](function(_0x5901b7){if(_0x5901b7>0x0){_0x4b2859+=_0x3e2bdf;}_0x3df310['push'](dbH['sequelize'][_0xfac5('0x2c')](util['format'](_0xfac5('0x2d'),QUERY,_0x3e2bdf,_0x4b2859),{'type':dbH[_0xfac5('0x2e')][_0xfac5('0x2f')]['SELECT']}));});if(_0x5c2722>0x0){_0x4b2859+=_0x3e2bdf;_0x3df310['push'](dbH[_0xfac5('0x2e')]['query'](util[_0xfac5('0x18')](_0xfac5('0x2d'),QUERY,_0x5c2722,_0x4b2859),{'type':dbH[_0xfac5('0x2e')][_0xfac5('0x2f')][_0xfac5('0x30')]}));}}}else{_0x3df310[_0xfac5('0x14')](dbH['sequelize'][_0xfac5('0x2c')](QUERY,{'type':dbH['sequelize'][_0xfac5('0x2f')][_0xfac5('0x30')]}));}var _0x157c3d=path[_0xfac5('0x31')](PATH);var _0x3d1863=path[_0xfac5('0x32')](PATH,_0xfac5('0x33'));var _0x1dd13b=_0x791ce3[_0xfac5('0x28')]&&_0x3df310['length']>0x1;var _0x5cc48c=[];if(!fs[_0xfac5('0x34')](path[_0xfac5('0x35')](_0x157c3d,_0x3d1863))&&_0x1dd13b){fs[_0xfac5('0x36')](path[_0xfac5('0x35')](_0x157c3d,_0x3d1863));}return BPromise['each'](_0x3df310,function(_0x2b78b6){_0x5cc48c[_0xfac5('0x14')](_0x2b78b6);})[_0xfac5('0x2a')](function(){var _0x5f16fa=[];for(var _0x4cf5da=0x0;_0x4cf5da<_0x5cc48c[_0xfac5('0x1d')];_0x4cf5da+=0x1){var _0x1705f1=_0x5cc48c[_0x4cf5da];var _0x3e7f8c=createTables(_[_0xfac5('0x37')](_0x1705f1));var _0x1234c6;var _0x298854=getPDFDocDefinition(_0x3e7f8c);var _0x4e7869=getPDFPrinter();var _0x15b6d1=_0x4e7869[_0xfac5('0x38')](_0x298854);if(_0x1dd13b){_0x1234c6=path[_0xfac5('0x35')](_0x157c3d,_0x3d1863,util[_0xfac5('0x18')](_0xfac5('0x39'),_0x3d1863,_0x4cf5da,_0xfac5('0x3a')));}else{_0x1234c6=path[_0xfac5('0x35')](_0x157c3d,util[_0xfac5('0x18')](_0xfac5('0x3b'),_0x3d1863,_0xfac5('0x3a')));}_0x5f16fa[_0xfac5('0x14')](writePDFDocument(_0x15b6d1,_0x1234c6));}return Promise[_0xfac5('0x3c')](_0x5f16fa);})['then'](function(){if(_0x1dd13b){return new Promise(function(_0x3e3b7b){zipdir(path[_0xfac5('0x35')](_0x157c3d,_0x3d1863),{'saveTo':path['join'](_0x157c3d,util[_0xfac5('0x18')](_0xfac5('0x3b'),_0x3d1863,_0xfac5('0x3d')))},function(){rimraf(path['join'](_0x157c3d,_0x3d1863),function(){});_0x3e3b7b('zip\x20finished');});});}})[_0xfac5('0x2a')](function(){if(!_0x1dd13b)return;rimraf(path[_0xfac5('0x35')](_0x157c3d,_0x3d1863),function(){});})['then'](function(){logger[_0xfac5('0x3e')](util[_0xfac5('0x18')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xfac5('0x3f')));return analyticExtractedReport(_0xfac5('0x40'),_0x1dd13b?util[_0xfac5('0x18')](_0xfac5('0x3b'),_0x3d1863,_0x1dd13b?_0xfac5('0x3d'):_0xfac5('0x3a')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xfac5('0x3e')](util[_0xfac5('0x18')](_0xfac5('0x41'),EXTRACTED_REPORT_ID,_0xfac5('0x3f')));return db[_0xfac5('0xc')][_0xfac5('0x42')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xfac5('0x2a')](function(_0x3ff916){EXTRACTED_REPORT=_0x3ff916;return dbH[_0xfac5('0x2e')][_0xfac5('0x2c')](util[_0xfac5('0x18')](_0xfac5('0x43'),QUERY),{'type':dbH[_0xfac5('0x2e')][_0xfac5('0x2f')]['SELECT']});})[_0xfac5('0x2a')](extractReport)[_0xfac5('0x44')](function(_0xef2483){logger[_0xfac5('0x3e')](util[_0xfac5('0x18')](_0xfac5('0x45'),EXTRACTED_REPORT_ID,'PDF'),util['inspect'](_0xef2483,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xfac5('0x46')](function(){process[_0xfac5('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x19356a=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0xfac5('0x48'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0xfac5('0x49')}});return _0x19356a;}function getPDFDocDefinitionFromHTML(_0x437970,_0x54842d){var _0x421ffe=util[_0xfac5('0x18')](_0xfac5('0x4a'),_0x54842d[_0xfac5('0x4b')],_0x54842d[_0xfac5('0x4c')]);var _0x19411d=moment()[_0xfac5('0x18')](_0xfac5('0x4d'))[_0xfac5('0x22')]();var _0x4f18c8=htmlToPdfmake(_0x437970,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4f18c8],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xfac5('0x4e')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':'header'}];},'footer':function(_0x44bc75,_0x4e5035){return[{'text':util[_0xfac5('0x18')](_0xfac5('0x4f'),_0x421ffe,_0x44bc75,_0x4e5035,_0x19411d),'style':_0xfac5('0x23')}];}};}function writePDFDocument(_0x1110d4,_0x302582){return new Promise(function(_0x3359a9,_0x4ef578){var _0x98ca8f=_0x1110d4['pipe'](fs['createWriteStream'](_0x302582));_0x98ca8f['on'](_0xfac5('0x50'),function(){_0x3359a9(_0xfac5('0x50'));});_0x98ca8f['on'](_0xfac5('0x51'),function(_0x59f135){_0x4ef578(_0x59f135);});_0x1110d4[_0xfac5('0x52')]();});}exports['createPdfFromHTML']=function(_0x4fdfc3,_0x36ef10){var _0x424888=getPDFPrinter();var _0x14e576=getPDFDocDefinitionFromHTML(_0x4fdfc3,_0x36ef10);var _0x368ff3=_0x424888[_0xfac5('0x38')](_0x14e576);return writePDFDocument(_0x368ff3,_0x36ef10[_0xfac5('0x1')])[_0xfac5('0x44')](function(_0x261731){throw _0x261731;});}; \ No newline at end of file +var _0x496f=['push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','pageBreak','before','margin','toString','footer','Arial','black','right','Empty','Setting','find','split','then','splitSizePdf','num','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','join','each','createPdfKitDocument','%s%d.%s','all','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','%s.%s','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','inspect','finally','exit','/fonts/arial-bold-italic.ttf','%s\x20#%d','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','finish','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','value','fill','length','body'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x496f,0x1ea));var _0xf496=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x496f[_0x2b7764];return _0x848dcb;};'use strict';var _=require(_0xf496('0x0'));var fs=require('fs');var util=require(_0xf496('0x1'));var path=require(_0xf496('0x2'));var moment=require(_0xf496('0x3'));var htmlToPdfmake=require(_0xf496('0x4'));var PdfPrinter=require(_0xf496('0x5'));var zipdir=require(_0xf496('0x6'));var rimraf=require('rimraf');var JSDOM=require(_0xf496('0x7'))[_0xf496('0x8')];var window=new JSDOM('')['window'];var BPromise=require(_0xf496('0x9'));var db=require(_0xf496('0xa'))['db'];var dbH=require(_0xf496('0xa'))[_0xf496('0xb')];var logger=require(_0xf496('0xc'))(_0xf496('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0xf496('0xe')][0x2]);var QUERY=process[_0xf496('0xe')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xf496('0xe')][0x5];var FORMAT=_0xf496('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x38e39d,_0xae273){var _0x50819a={'status':_0x38e39d};var _0x427dbd={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xae273){_0x50819a[_0xf496('0x10')]=_0xae273;}return db[_0xf496('0x11')][_0xf496('0x12')](_0x50819a,_0x427dbd);}function getHeaders(_0x30a5c8){return _[_0xf496('0x13')](_0x30a5c8,function(_0x41a9f3){return{'text':_0x41a9f3,'style':_0xf496('0x14')};});}function getRows(_0x9e594f,_0x2e5da8){return _[_0xf496('0x13')](_0x2e5da8,function(_0x90abf7){return _(_0x90abf7)[_0xf496('0x15')](_0x9e594f)[_0xf496('0x13')](function(_0x3285cd){return _0x3285cd?_['toString'](_0x3285cd):'';})[_0xf496('0x16')]();});}function createTable(_0xb3bb00,_0x48c4a0){var _0x10c7e8={'widths':_[_0xf496('0x17')](Array(_0xb3bb00[_0xf496('0x18')]),0x91),'heights':function(_0x46e05e){return _0x46e05e===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x25fcc9=getHeaders(_0xb3bb00);_0x10c7e8[_0xf496('0x19')][_0xf496('0x1a')](_0x25fcc9);var _0x430401=getRows(_0xb3bb00,_0x48c4a0);_0x10c7e8[_0xf496('0x19')]=_0x10c7e8[_0xf496('0x19')][_0xf496('0x1b')](_0x430401);return _0x10c7e8;}function createTables(_0x1a7440){var _0x496751=[];var _0x554c35=_[_0xf496('0x1c')](Object[_0xf496('0x1d')](_0x1a7440[0x0]),0x5);_0x554c35[_0xf496('0x1e')](function(_0x7b70ff){_0x496751[_0xf496('0x1a')](createTable(_0x7b70ff,_0x1a7440));});return _0x496751;}function getPDFDocDefinition(_0x5605bc){var _0x476ecf=util[_0xf496('0x1f')](_0xf496('0x20'),NAME,EXTRACTED_REPORT[_0xf496('0x21')],moment(EXTRACTED_REPORT[_0xf496('0x22')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0xf496('0x23')])[_0xf496('0x1f')](FORMAT));var _0x18040a=[];for(var _0x2a2217=0x0;_0x2a2217<_0x5605bc['length'];_0x2a2217++){var _0x4b3f07=[];if(_0x2a2217===0x0){_0x4b3f07['push']({'text':_0x476ecf,'style':_0xf496('0x24')});}var _0x274bf3={'table':_0x5605bc[_0x2a2217]};if(_0x2a2217>0x0){_0x274bf3[_0xf496('0x25')]=_0xf496('0x26');_0x274bf3[_0xf496('0x27')]=[0x0,0x46,0x0,0x0];}_0x4b3f07[_0xf496('0x1a')](_0x274bf3);_0x18040a['push'](_0x4b3f07);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x18040a,'footer':function(_0x278820,_0x48f213){return{'text':_0x278820[_0xf496('0x28')]()+'\x20/\x20'+_0x48f213,'style':_0xf496('0x29')};},'defaultStyle':{'font':_0xf496('0x2a')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xf496('0x2b')},'footer':{'alignment':_0xf496('0x2c'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x2faa0c){var _0x283957=0x1388;var _0xde3070;if(!_0x2faa0c[0x0]['num']){return analyticExtractedReport(_0xf496('0x2d'));}return db[_0xf496('0x2e')][_0xf496('0x2f')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf496('0x30'),'splitSizePdf']})[_0xf496('0x31')](function(_0x17e865){if(_0x17e865){_0xde3070=_0x17e865;_0x283957=_0xde3070[_0xf496('0x32')]||0x3e8;}})[_0xf496('0x31')](function(){var _0x43fe4f=[];var _0xd92fc9=0x0;if(_0xde3070['split']){if(_0x2faa0c&&_0x2faa0c['length']){var _0x3ad4dc=_['range'](_0x2faa0c[0x0][_0xf496('0x33')]/_0x283957);var _0x1ff9be=Number[_0xf496('0x34')](_0x2faa0c[0x0][_0xf496('0x33')]/_0x283957)?_0x2faa0c[0x0][_0xf496('0x33')]%_0x283957:0x0;_0x3ad4dc[_0xf496('0x1e')](function(_0x147c3a){if(_0x147c3a>0x0){_0xd92fc9+=_0x283957;}_0x43fe4f[_0xf496('0x1a')](dbH[_0xf496('0x35')][_0xf496('0x36')](util['format'](_0xf496('0x37'),QUERY,_0x283957,_0xd92fc9),{'type':dbH[_0xf496('0x35')][_0xf496('0x38')]['SELECT']}));});if(_0x1ff9be>0x0){_0xd92fc9+=_0x283957;_0x43fe4f[_0xf496('0x1a')](dbH['sequelize'][_0xf496('0x36')](util[_0xf496('0x1f')](_0xf496('0x37'),QUERY,_0x1ff9be,_0xd92fc9),{'type':dbH[_0xf496('0x35')][_0xf496('0x38')]['SELECT']}));}}}else{_0x43fe4f[_0xf496('0x1a')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0xf496('0x35')]['QueryTypes'][_0xf496('0x39')]}));}var _0x51d8fe=path[_0xf496('0x3a')](PATH);var _0x473831=path[_0xf496('0x3b')](PATH,_0xf496('0x3c'));var _0x246666=_0xde3070[_0xf496('0x30')]&&_0x43fe4f[_0xf496('0x18')]>0x1;var _0x47e172=[];if(!fs['existsSync'](path[_0xf496('0x3d')](_0x51d8fe,_0x473831))&&_0x246666){fs['mkdirSync'](path[_0xf496('0x3d')](_0x51d8fe,_0x473831));}return BPromise[_0xf496('0x3e')](_0x43fe4f,function(_0x292169){_0x47e172[_0xf496('0x1a')](_0x292169);})[_0xf496('0x31')](function(){var _0xf27af7=[];for(var _0x463e55=0x0;_0x463e55<_0x47e172[_0xf496('0x18')];_0x463e55+=0x1){var _0x1a1557=_0x47e172[_0x463e55];var _0x478eec=createTables(_['flatten'](_0x1a1557));var _0x2f3fc5;var _0x3042e1=getPDFDocDefinition(_0x478eec);var _0x1ae8f4=getPDFPrinter();var _0x110e00=_0x1ae8f4[_0xf496('0x3f')](_0x3042e1);if(_0x246666){_0x2f3fc5=path[_0xf496('0x3d')](_0x51d8fe,_0x473831,util[_0xf496('0x1f')](_0xf496('0x40'),_0x473831,_0x463e55,'pdf'));}else{_0x2f3fc5=path[_0xf496('0x3d')](_0x51d8fe,util[_0xf496('0x1f')]('%s.%s',_0x473831,'pdf'));}_0xf27af7['push'](writePDFDocument(_0x110e00,_0x2f3fc5));}return Promise[_0xf496('0x41')](_0xf27af7);})[_0xf496('0x31')](function(){if(_0x246666){return new Promise(function(_0xdbd942){zipdir(path[_0xf496('0x3d')](_0x51d8fe,_0x473831),{'saveTo':path[_0xf496('0x3d')](_0x51d8fe,util[_0xf496('0x1f')]('%s.%s',_0x473831,_0xf496('0x42')))},function(){rimraf(path[_0xf496('0x3d')](_0x51d8fe,_0x473831),function(){});_0xdbd942('zip\x20finished');});});}})[_0xf496('0x31')](function(){if(!_0x246666)return;rimraf(path[_0xf496('0x3d')](_0x51d8fe,_0x473831),function(){});})[_0xf496('0x31')](function(){logger[_0xf496('0x43')](util[_0xf496('0x1f')](_0xf496('0x44'),EXTRACTED_REPORT_ID,_0xf496('0x45')));return analyticExtractedReport(_0xf496('0x46'),_0x246666?util[_0xf496('0x1f')](_0xf496('0x47'),_0x473831,_0x246666?_0xf496('0x42'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xf496('0x43')](util[_0xf496('0x1f')](_0xf496('0x48'),EXTRACTED_REPORT_ID,_0xf496('0x45')));return db[_0xf496('0x11')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0xf496('0x31')](function(_0x32ba4c){EXTRACTED_REPORT=_0x32ba4c;return dbH['sequelize'][_0xf496('0x36')](util['format'](_0xf496('0x49'),QUERY),{'type':dbH[_0xf496('0x35')]['QueryTypes'][_0xf496('0x39')]});})[_0xf496('0x31')](extractReport)[_0xf496('0x4a')](function(_0x35e048){logger[_0xf496('0x43')](util[_0xf496('0x1f')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xf496('0x45')),util[_0xf496('0x4b')](_0x35e048,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xf496('0x4c')](function(){process[_0xf496('0x4d')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x492f18=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0xf496('0x4e')}});return _0x492f18;}function getPDFDocDefinitionFromHTML(_0xf8e123,_0x4b42c0){var _0x397f18=util[_0xf496('0x1f')](_0xf496('0x4f'),_0x4b42c0['channel'],_0x4b42c0['interactionId']);var _0x4a6de6=moment()[_0xf496('0x1f')]('YYYY-MM-DD')[_0xf496('0x28')]();var _0x3dd1d9=htmlToPdfmake(_0xf8e123,{'window':window,'tableAutoSize':!![]});return{'content':[_0x3dd1d9],'defaultStyle':{'font':_0xf496('0x2a')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xf496('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xf496('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xf496('0x50')}},'header':function(){return[{'text':_0xf496('0x51'),'style':_0xf496('0x24')}];},'footer':function(_0x23c97d,_0x1ec9b9){return[{'text':util[_0xf496('0x1f')](_0xf496('0x52'),_0x397f18,_0x23c97d,_0x1ec9b9,_0x4a6de6),'style':_0xf496('0x29')}];}};}function writePDFDocument(_0x4b79e3,_0x160ec2){return new Promise(function(_0x2ae529,_0x162729){var _0x4a480c=_0x4b79e3['pipe'](fs['createWriteStream'](_0x160ec2));_0x4a480c['on'](_0xf496('0x53'),function(){_0x2ae529(_0xf496('0x53'));});_0x4a480c['on']('error',function(_0x1a90b1){_0x162729(_0x1a90b1);});_0x4b79e3[_0xf496('0x54')]();});}exports[_0xf496('0x55')]=function(_0xcc0143,_0x17c3ca){var _0x5ae59b=getPDFPrinter();var _0xb8d852=getPDFDocDefinitionFromHTML(_0xcc0143,_0x17c3ca);var _0x24b6ad=_0x5ae59b[_0xf496('0x3f')](_0xb8d852);return writePDFDocument(_0x24b6ad,_0x17c3ca[_0xf496('0x2')])[_0xf496('0x4a')](function(_0x4645d4){throw _0x4645d4;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 6e4fd93..2c37d24 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 _0x3d2b=['format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','splitSizeXlsx','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','then','num','Empty','split','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','.xlsx','length','existsSync','mkdirSync','join','each','%s%d.%s','xlsx','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','%s.%s','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','exit','util','path','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info'];(function(_0x59e13f,_0x541f21){var _0xf7c360=function(_0x170c75){while(--_0x170c75){_0x59e13f['push'](_0x59e13f['shift']());}};_0xf7c360(++_0x541f21);}(_0x3d2b,0x129));var _0xb3d2=function(_0x12c425,_0x587f49){_0x12c425=_0x12c425-0x0;var _0x4bf48e=_0x3d2b[_0x12c425];return _0x4bf48e;};'use strict';var util=require(_0xb3d2('0x0'));var path=require(_0xb3d2('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0xb3d2('0x2'));var BPromise=require(_0xb3d2('0x3'));var zipdir=require(_0xb3d2('0x4'));var rimraf=require(_0xb3d2('0x5'));var db=require(_0xb3d2('0x6'))['db'];var dbH=require(_0xb3d2('0x6'))[_0xb3d2('0x7')];var logger=require(_0xb3d2('0x8'))(_0xb3d2('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xb3d2('0xa')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x262480,_0x2c4a9d){var _0xf17c80={'status':_0x262480};var _0x3d81d7={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2c4a9d){_0xf17c80[_0xb3d2('0xb')]=_0x2c4a9d;}return db[_0xb3d2('0xc')][_0xb3d2('0xd')](_0xf17c80,_0x3d81d7);}function main(){var _0x196cca=0x1388;var _0xa7c0dd;logger[_0xb3d2('0xe')](util[_0xb3d2('0xf')](_0xb3d2('0x10'),EXTRACTED_REPORT_ID,_0xb3d2('0x11')));return db[_0xb3d2('0x12')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xb3d2('0x13')]})['then'](function(_0x45a743){if(_0x45a743){_0xa7c0dd=_0x45a743;_0x196cca=_0xa7c0dd[_0xb3d2('0x13')]||0x1388;}})['then'](function(){return dbH[_0xb3d2('0x14')][_0xb3d2('0x15')](util[_0xb3d2('0xf')](_0xb3d2('0x16'),QUERY),{'type':dbH[_0xb3d2('0x14')]['QueryTypes']['SELECT']});})[_0xb3d2('0x17')](function(_0x45fea4){if(!_0x45fea4[0x0][_0xb3d2('0x18')]){return analyticExtractedReport(_0xb3d2('0x19'));}var _0x1d319d=[];var _0x5ae0bb=0x0;if(_0xa7c0dd[_0xb3d2('0x1a')]){if(_0x45fea4&&_0x45fea4['length']){var _0x1a5bce=_[_0xb3d2('0x1b')](_0x45fea4[0x0][_0xb3d2('0x18')]/_0x196cca);var _0xecc189=Number[_0xb3d2('0x1c')](_0x45fea4[0x0]['num']/_0x196cca)?_0x45fea4[0x0][_0xb3d2('0x18')]%_0x196cca:0x0;_0x1a5bce[_0xb3d2('0x1d')](function(_0x23397e){if(_0x23397e>0x0){_0x5ae0bb+=_0x196cca;}_0x1d319d[_0xb3d2('0x1e')](dbH[_0xb3d2('0x14')][_0xb3d2('0x15')](util[_0xb3d2('0xf')](_0xb3d2('0x1f'),QUERY,_0x196cca,_0x5ae0bb),{'type':dbH['sequelize']['QueryTypes'][_0xb3d2('0x20')]}));});if(_0xecc189>0x0){_0x5ae0bb+=_0x196cca;_0x1d319d['push'](dbH['sequelize'][_0xb3d2('0x15')](util[_0xb3d2('0xf')](_0xb3d2('0x1f'),QUERY,_0xecc189,_0x5ae0bb),{'type':dbH['sequelize'][_0xb3d2('0x21')][_0xb3d2('0x20')]}));}}}else{_0x1d319d[_0xb3d2('0x1e')](dbH[_0xb3d2('0x14')][_0xb3d2('0x15')](QUERY,{'type':dbH[_0xb3d2('0x14')][_0xb3d2('0x21')]['SELECT']}));}var _0x59add7=path['dirname'](PATH);var _0xc45741=path['basename'](PATH,_0xb3d2('0x22'));var _0x4b362c=_0xa7c0dd['split']&&_0x1d319d[_0xb3d2('0x23')]>0x1;var _0x1348ae=[];if(!fs[_0xb3d2('0x24')](path['join'](_0x59add7,_0xc45741))&&_0x4b362c){fs[_0xb3d2('0x25')](path[_0xb3d2('0x26')](_0x59add7,_0xc45741));}return BPromise[_0xb3d2('0x27')](_0x1d319d,function(_0x46dbd0){_0x1348ae['push'](_0x46dbd0);})['then'](function(){for(var _0x2d49cc=0x0;_0x2d49cc<_0x1348ae[_0xb3d2('0x23')];_0x2d49cc+=0x1){var _0x3eff51;var _0x1a69b7=_0x1348ae[_0x2d49cc];if(_0x4b362c){_0x3eff51=path[_0xb3d2('0x26')](_0x59add7,_0xc45741,util[_0xb3d2('0xf')](_0xb3d2('0x28'),_0xc45741,_0x2d49cc,'xlsx'));}else{_0x3eff51=path['join'](_0x59add7,util['format']('%s.%s',_0xc45741,_0xb3d2('0x29')));}fs[_0xb3d2('0x2a')](_0x3eff51,json2xls(_0x1a69b7),'binary');}})['then'](function(){if(_0x4b362c){return new Promise(function(_0x16eba2){zipdir(path['join'](_0x59add7,_0xc45741),{'saveTo':path[_0xb3d2('0x26')](_0x59add7,util[_0xb3d2('0xf')]('%s.%s',_0xc45741,_0xb3d2('0x2b')))},function(_0xb197d7,_0x4ba961){rimraf(path[_0xb3d2('0x26')](_0x59add7,_0xc45741),function(){});_0x16eba2(_0xb3d2('0x2c'));});});}})[_0xb3d2('0x17')](function(){logger[_0xb3d2('0xe')](util[_0xb3d2('0xf')](_0xb3d2('0x2d'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xb3d2('0x2e'),_0x4b362c?util[_0xb3d2('0xf')](_0xb3d2('0x2f'),_0xc45741,_0x4b362c?_0xb3d2('0x2b'):_0xb3d2('0x29')):null);});})[_0xb3d2('0x30')](function(_0x4ae110){logger[_0xb3d2('0xe')](util[_0xb3d2('0xf')](_0xb3d2('0x31'),EXTRACTED_REPORT_ID,_0xb3d2('0x11')),util['inspect'](_0x4ae110,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xb3d2('0x32')](function(){process[_0xb3d2('0x33')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x65c6=['binary','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','catch','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','length','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','basename','join','mkdirSync','each','%s%d.%s','%s.%s','xlsx','writeFileSync'];(function(_0x42bb6d,_0x412255){var _0x1db89b=function(_0x5da43a){while(--_0x5da43a){_0x42bb6d['push'](_0x42bb6d['shift']());}};_0x1db89b(++_0x412255);}(_0x65c6,0x1a7));var _0x665c=function(_0x340b30,_0xe6b711){_0x340b30=_0x340b30-0x0;var _0x19d8c2=_0x65c6[_0x340b30];return _0x19d8c2;};'use strict';var util=require('util');var path=require(_0x665c('0x0'));var _=require(_0x665c('0x1'));var fs=require('fs');var json2xls=require(_0x665c('0x2'));var BPromise=require(_0x665c('0x3'));var zipdir=require(_0x665c('0x4'));var rimraf=require(_0x665c('0x5'));var db=require(_0x665c('0x6'))['db'];var dbH=require(_0x665c('0x6'))[_0x665c('0x7')];var logger=require('../../config/logger')(_0x665c('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x665c('0x9')][0x2]);var QUERY=process[_0x665c('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x49042a,_0x3735a6){var _0x370969={'status':_0x49042a};var _0x1adbbb={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3735a6){_0x370969['savename']=_0x3735a6;}return db[_0x665c('0xa')][_0x665c('0xb')](_0x370969,_0x1adbbb);}function main(){var _0x3a4713=0x1388;var _0x54153b;logger['info'](util[_0x665c('0xc')](_0x665c('0xd'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x665c('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x665c('0xf'),_0x665c('0x10')]})['then'](function(_0x587ee8){if(_0x587ee8){_0x54153b=_0x587ee8;_0x3a4713=_0x54153b[_0x665c('0x10')]||0x1388;}})[_0x665c('0x11')](function(){return dbH[_0x665c('0x12')][_0x665c('0x13')](util[_0x665c('0xc')](_0x665c('0x14'),QUERY),{'type':dbH[_0x665c('0x12')][_0x665c('0x15')]['SELECT']});})[_0x665c('0x11')](function(_0x59c520){if(!_0x59c520[0x0][_0x665c('0x16')]){return analyticExtractedReport(_0x665c('0x17'));}var _0x58b452=[];var _0x312f3b=0x0;if(_0x54153b[_0x665c('0xf')]){if(_0x59c520&&_0x59c520[_0x665c('0x18')]){var _0x2df882=_['range'](_0x59c520[0x0][_0x665c('0x16')]/_0x3a4713);var _0x331809=Number[_0x665c('0x19')](_0x59c520[0x0][_0x665c('0x16')]/_0x3a4713)?_0x59c520[0x0][_0x665c('0x16')]%_0x3a4713:0x0;_0x2df882['forEach'](function(_0x5254a7){if(_0x5254a7>0x0){_0x312f3b+=_0x3a4713;}_0x58b452[_0x665c('0x1a')](dbH[_0x665c('0x12')][_0x665c('0x13')](util['format'](_0x665c('0x1b'),QUERY,_0x3a4713,_0x312f3b),{'type':dbH[_0x665c('0x12')][_0x665c('0x15')][_0x665c('0x1c')]}));});if(_0x331809>0x0){_0x312f3b+=_0x3a4713;_0x58b452[_0x665c('0x1a')](dbH[_0x665c('0x12')][_0x665c('0x13')](util[_0x665c('0xc')](_0x665c('0x1b'),QUERY,_0x331809,_0x312f3b),{'type':dbH[_0x665c('0x12')][_0x665c('0x15')]['SELECT']}));}}}else{_0x58b452[_0x665c('0x1a')](dbH['sequelize'][_0x665c('0x13')](QUERY,{'type':dbH[_0x665c('0x12')][_0x665c('0x15')][_0x665c('0x1c')]}));}var _0x1697ab=path['dirname'](PATH);var _0x3abd6f=path[_0x665c('0x1d')](PATH,'.xlsx');var _0x3fc598=_0x54153b[_0x665c('0xf')]&&_0x58b452[_0x665c('0x18')]>0x1;var _0x42b806=[];if(!fs['existsSync'](path[_0x665c('0x1e')](_0x1697ab,_0x3abd6f))&&_0x3fc598){fs[_0x665c('0x1f')](path[_0x665c('0x1e')](_0x1697ab,_0x3abd6f));}return BPromise[_0x665c('0x20')](_0x58b452,function(_0x3222f5){_0x42b806[_0x665c('0x1a')](_0x3222f5);})[_0x665c('0x11')](function(){for(var _0x21beb9=0x0;_0x21beb9<_0x42b806[_0x665c('0x18')];_0x21beb9+=0x1){var _0x782d96;var _0x3fe350=_0x42b806[_0x21beb9];if(_0x3fc598){_0x782d96=path[_0x665c('0x1e')](_0x1697ab,_0x3abd6f,util[_0x665c('0xc')](_0x665c('0x21'),_0x3abd6f,_0x21beb9,'xlsx'));}else{_0x782d96=path[_0x665c('0x1e')](_0x1697ab,util[_0x665c('0xc')](_0x665c('0x22'),_0x3abd6f,_0x665c('0x23')));}fs[_0x665c('0x24')](_0x782d96,json2xls(_0x3fe350),_0x665c('0x25'));}})[_0x665c('0x11')](function(){if(_0x3fc598){return new Promise(function(_0xcaca3d){zipdir(path[_0x665c('0x1e')](_0x1697ab,_0x3abd6f),{'saveTo':path[_0x665c('0x1e')](_0x1697ab,util['format']('%s.%s',_0x3abd6f,'zip'))},function(_0x334c0e,_0xb643bb){rimraf(path[_0x665c('0x1e')](_0x1697ab,_0x3abd6f),function(){});_0xcaca3d('zip\x20finished');});});}})[_0x665c('0x11')](function(){logger['info'](util[_0x665c('0xc')](_0x665c('0x26'),EXTRACTED_REPORT_ID,_0x665c('0x27')));return analyticExtractedReport(_0x665c('0x28'),_0x3fc598?util[_0x665c('0xc')](_0x665c('0x22'),_0x3abd6f,_0x3fc598?'zip':_0x665c('0x23')):null);});})[_0x665c('0x29')](function(_0x96434a){logger[_0x665c('0x2a')](util[_0x665c('0xc')](_0x665c('0x2b'),EXTRACTED_REPORT_ID,_0x665c('0x27')),util[_0x665c('0x2c')](_0x96434a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x665c('0x2d'));})['finally'](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 58f48c1..3cd0c8b 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 _0xbdc1=['MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','interval','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','error','util','models','Interval','findAll','then','VoiceExtension','IntervalId','uniq','map','filter','groupBy','exten','queue','hasOwnProperty','extensions','extension','find','push','type','Set','CDR(type)=%s','context','VoiceExtensionId','inbound','CDR(routeid)=','priority','outbound','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0'];(function(_0x561195,_0x1f9dec){var _0x5c87c3=function(_0x32ee97){while(--_0x32ee97){_0x561195['push'](_0x561195['shift']());}};_0x5c87c3(++_0x1f9dec);}(_0xbdc1,0x163));var _0x1bdc=function(_0x512afa,_0x175a91){_0x512afa=_0x512afa-0x0;var _0x4d413c=_0xbdc1[_0x512afa];return _0x4d413c;};'use strict';var _=require('lodash');var util=require(_0x1bdc('0x0'));function rewrite(_0x1af9d8,_0x38d7a3){var _0x5a21bd=this;return _0x1af9d8[_0x1bdc('0x1')][_0x1bdc('0x2')][_0x1bdc('0x3')]({'raw':!![]})[_0x1bdc('0x4')](function(_0x3e7bf6){_0x5a21bd['intervals']=_0x3e7bf6;return _0x1af9d8[_0x1bdc('0x1')][_0x1bdc('0x5')]['findAll']({'where':{'IntervalId':_0x38d7a3[_0x1bdc('0x6')]},'raw':!![]});})[_0x1bdc('0x4')](function(_0x2273eb){return _0x1af9d8[_0x1bdc('0x1')]['VoiceExtension']['findAll']({'where':{'exten':{'$in':_[_0x1bdc('0x7')](_[_0x1bdc('0x8')](_0x2273eb,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x2e0f71){var _0x2fbe6f=_[_0x1bdc('0x9')](_0x2e0f71,{'priority':'1'});var _0x5dd656=_[_0x1bdc('0x9')](_0x2e0f71,{'isApp':0x1});var _0x1b0368=_[_0x1bdc('0xa')](_0x5dd656,_0x1bdc('0xb'));var _0x1305b1=[_0x1bdc('0xc'),'playback'];var _0x5360cc=[];var _0x44a267=[];for(var _0x5d57b2 in _0x1b0368){if(_0x1b0368[_0x1bdc('0xd')](_0x5d57b2)){_0x5a21bd['priority']=0x2;_0x5a21bd[_0x1bdc('0xe')]=[];_0x5a21bd[_0x1bdc('0xf')]=_[_0x1bdc('0x10')](_0x2fbe6f,{'exten':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0xb')]});_0x5a21bd[_0x1bdc('0xe')][_0x1bdc('0x11')]({'type':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x12')],'app':_0x1bdc('0x13'),'appdata':util['format'](_0x1bdc('0x14'),_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x12')]),'context':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x15')],'exten':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0xb')],'priority':_0x5a21bd['priority']++,'VoiceExtensionId':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x16')]});if(_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x12')]===_0x1bdc('0x17')){_0x5a21bd[_0x1bdc('0xe')]['push']({'type':_0x1b0368[_0x5d57b2][0x0]['type'],'app':_0x1bdc('0x13'),'appdata':_0x1bdc('0x18')+_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x16')],'context':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x15')],'exten':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0xb')],'priority':_0x5a21bd[_0x1bdc('0x19')]++,'VoiceExtensionId':_0x1b0368[_0x5d57b2][0x0]['VoiceExtensionId']});}else if(_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x12')]===_0x1bdc('0x1a')){if(_0x5a21bd['extension']){_0x5a21bd[_0x1bdc('0xe')]['push']({'type':_0x1b0368[_0x5d57b2][0x0]['type'],'app':_0x1bdc('0x13'),'appdata':_0x1bdc('0x1b')+(_0x5a21bd['extension'][_0x1bdc('0x1c')]?_0x1bdc('0x1d')+_0x5a21bd[_0x1bdc('0xf')]['cutdigits']+'}':'${EXTEN}'),'context':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x15')],'exten':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0xb')],'priority':_0x5a21bd[_0x1bdc('0x19')]++,'VoiceExtensionId':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x16')]});}_0x5a21bd[_0x1bdc('0xe')][_0x1bdc('0x11')]({'type':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x12')],'app':_0x1bdc('0x13'),'appdata':_0x1bdc('0x18')+_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x16')],'context':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x15')],'exten':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0xb')],'priority':_0x5a21bd[_0x1bdc('0x19')]++,'VoiceExtensionId':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x16')]});var _0x4ec129=_0x5a21bd['priority']++;_0x5a21bd[_0x1bdc('0xe')][_0x1bdc('0x11')]({'type':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x12')],'app':_0x1bdc('0x1e'),'appdata':_0x1bdc('0x1f')+(_0x4ec129+0x2)+_0x1bdc('0x20')+(_0x4ec129+0x1)+')','context':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x15')],'exten':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0xb')],'priority':_0x4ec129,'VoiceExtensionId':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x16')]});if(_0x5a21bd[_0x1bdc('0xf')]){_0x5a21bd[_0x1bdc('0xe')]['push']({'type':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x12')],'app':_0x1bdc('0x13'),'appdata':_0x5a21bd[_0x1bdc('0xf')]['cutdigits']?_0x1bdc('0x21')+_0x5a21bd[_0x1bdc('0xf')][_0x1bdc('0x1c')]+'}':'CDR(prefix)=noprefix','context':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x15')],'exten':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0xb')],'priority':_0x5a21bd['priority']++,'VoiceExtensionId':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x16')]});}_0x5a21bd[_0x1bdc('0xe')][_0x1bdc('0x11')]({'type':_0x1b0368[_0x5d57b2][0x0]['type'],'app':_0x1bdc('0x13'),'appdata':_0x1bdc('0x22')+_0x1b0368[_0x5d57b2][0x0]['VoiceExtensionId'],'context':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x15')],'exten':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0xb')],'priority':_0x5a21bd[_0x1bdc('0x19')]++,'VoiceExtensionId':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x16')]});if(_0x5a21bd[_0x1bdc('0xf')]&&_0x5a21bd['extension'][_0x1bdc('0xd')]('recordingFormat')&&_0x5a21bd[_0x1bdc('0xf')][_0x1bdc('0x23')]!==_0x1bdc('0x24')){_0x5a21bd[_0x1bdc('0xe')]['push']({'type':_0x1b0368[_0x5d57b2][0x0]['type'],'app':_0x1bdc('0x13'),'appdata':_0x1bdc('0x25'),'context':_0x1b0368[_0x5d57b2][0x0]['context'],'exten':_0x1b0368[_0x5d57b2][0x0]['exten'],'priority':_0x5a21bd['priority']++,'VoiceExtensionId':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x16')]});_0x5a21bd[_0x1bdc('0xe')]['push']({'type':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x12')],'app':'Set','appdata':_0x1bdc('0x26')+_0x5a21bd['extension'][_0x1bdc('0x23')]||_0x1bdc('0x27'),'context':_0x1b0368[_0x5d57b2][0x0]['context'],'exten':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0xb')],'priority':_0x5a21bd[_0x1bdc('0x19')]++,'VoiceExtensionId':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x16')]});}}_0x5a21bd[_0x1bdc('0xe')][_0x1bdc('0x11')]({'type':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x12')],'app':_0x1bdc('0x13'),'appdata':_0x1bdc('0x28'),'context':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x15')],'exten':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0xb')],'priority':_0x5a21bd[_0x1bdc('0x19')]++,'VoiceExtensionId':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x16')]});_0x5a21bd[_0x1bdc('0xe')][_0x1bdc('0x11')]({'type':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x12')],'app':_0x1bdc('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x15')],'exten':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0xb')],'priority':_0x5a21bd['priority']++,'VoiceExtensionId':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x16')]});_0x5a21bd['extensions']['push']({'type':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x12')],'app':'Set','appdata':_0x1bdc('0x29'),'context':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x15')],'exten':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0xb')],'priority':_0x5a21bd[_0x1bdc('0x19')]++,'VoiceExtensionId':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x16')]});for(var _0x59ddc9=0x0,_0x5aa109=0x0;_0x59ddc9<_0x1b0368[_0x5d57b2][_0x1bdc('0x2a')];_0x59ddc9+=0x1,_0x5aa109=0x0){var _0xf64556=_0x1b0368[_0x5d57b2][_0x59ddc9];if(_0xf64556['type']){_0xf64556[_0x1bdc('0x12')]=_0xf64556['type'][_0x1bdc('0x2b')]();}var _0x2c9e2b=[];var _0x1b82a1=[];delete _0xf64556['id'];delete _0xf64556[_0x1bdc('0x2c')];delete _0xf64556['updatedAt'];var _0x4fb629=_0xf64556['interval']!=='*,*,*,*'?[_0xf64556[_0x1bdc('0x2d')]]:_0xf64556[_0x1bdc('0x6')]?_[_0x1bdc('0x8')](_[_0x1bdc('0x9')](_0x5a21bd['intervals'],{'IntervalId':_0xf64556[_0x1bdc('0x6')]}),_0x1bdc('0x2d')):[];if(_0xf64556[_0x1bdc('0xd')]('tag')){if(_0xf64556[_0x1bdc('0x2e')]&&_0xf64556['tag']!=='--'){_0x2c9e2b[_0x1bdc('0x11')]({'type':_0xf64556[_0x1bdc('0x12')],'app':'Set','appdata':'CDR(tag)='+_0xf64556[_0x1bdc('0x2e')],'context':_0xf64556[_0x1bdc('0x15')],'exten':_0xf64556[_0x1bdc('0xb')],'priority':_0x4fb629[_0x1bdc('0x2a')]+_0x5a21bd[_0x1bdc('0x19')]+_0x5aa109++,'VoiceExtensionId':_0xf64556[_0x1bdc('0x16')]});}}if(_0xf64556['type']===_0x1bdc('0x1a')&&_0xf64556[_0x1bdc('0xd')](_0x1bdc('0x2f'))){if(_0xf64556[_0x1bdc('0x2f')]){_0x2c9e2b['push']({'type':_0xf64556[_0x1bdc('0x12')],'app':'ExecIf','appdata':_0x1bdc('0x30')+_0xf64556[_0x1bdc('0x2f')]+')','context':_0xf64556['context'],'exten':_0xf64556[_0x1bdc('0xb')],'priority':_0x4fb629[_0x1bdc('0x2a')]+_0x5a21bd[_0x1bdc('0x19')]+_0x5aa109++,'VoiceExtensionId':_0xf64556['VoiceExtensionId']});}else{_0x2c9e2b[_0x1bdc('0x11')]({'type':_0xf64556['type'],'app':_0x1bdc('0x1e'),'appdata':_0x1bdc('0x31'),'context':_0xf64556[_0x1bdc('0x15')],'exten':_0xf64556['exten'],'priority':_0x4fb629[_0x1bdc('0x2a')]+_0x5a21bd[_0x1bdc('0x19')]+_0x5aa109++,'VoiceExtensionId':_0xf64556['VoiceExtensionId']});}}if(_0xf64556[_0x1bdc('0xd')](_0x1bdc('0x32'))){if(_0x1305b1[_0x1bdc('0x33')](_0xf64556['app'][_0x1bdc('0x2b')]())>=0x0&&_0xf64556[_0x1bdc('0x34')]!=='custom'){if(_0xf64556[_0x1bdc('0x32')]){_0x2c9e2b[_0x1bdc('0x11')]({'type':_0xf64556[_0x1bdc('0x12')],'app':_0x1bdc('0x1e'),'appdata':_0x1bdc('0x35'),'context':_0xf64556['context'],'exten':_0xf64556[_0x1bdc('0xb')],'priority':_0x4fb629['length']+_0x5a21bd[_0x1bdc('0x19')]+_0x5aa109++,'VoiceExtensionId':_0xf64556[_0x1bdc('0x16')]});_0x2c9e2b[_0x1bdc('0x11')]({'type':_0xf64556[_0x1bdc('0x12')],'app':_0x1bdc('0x13'),'appdata':_0x1bdc('0x36'),'context':_0xf64556[_0x1bdc('0x15')],'exten':_0xf64556[_0x1bdc('0xb')],'priority':_0x4fb629['length']+_0x5a21bd[_0x1bdc('0x19')]+_0x5aa109++,'VoiceExtensionId':_0xf64556[_0x1bdc('0x16')]});}else{_0x2c9e2b[_0x1bdc('0x11')]({'type':_0xf64556[_0x1bdc('0x12')],'app':_0x1bdc('0x1e'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0xf64556[_0x1bdc('0x15')],'exten':_0xf64556['exten'],'priority':_0x4fb629[_0x1bdc('0x2a')]+_0x5a21bd[_0x1bdc('0x19')]+_0x5aa109++,'VoiceExtensionId':_0xf64556[_0x1bdc('0x16')]});_0x2c9e2b[_0x1bdc('0x11')]({'type':_0xf64556[_0x1bdc('0x12')],'app':_0x1bdc('0x13'),'appdata':_0x1bdc('0x37'),'context':_0xf64556[_0x1bdc('0x15')],'exten':_0xf64556['exten'],'priority':_0x4fb629[_0x1bdc('0x2a')]+_0x5a21bd[_0x1bdc('0x19')]+_0x5aa109++,'VoiceExtensionId':_0xf64556[_0x1bdc('0x16')]});}}}for(var _0x471ce2=0x0;_0x471ce2<_0x4fb629['length'];_0x471ce2+=0x1){var _0x226709=_0x5a21bd[_0x1bdc('0x19')]+_0x4fb629['length'];var _0xf501f4=_0x471ce2===_0x4fb629[_0x1bdc('0x2a')]-0x1?_0x5a21bd['priority']+_0x2c9e2b[_0x1bdc('0x2a')]+_0x1b82a1['length']+0x2:_0x5a21bd['priority']+_0x471ce2+0x1;_0x2c9e2b[_0x1bdc('0x38')](_0x471ce2,0x0,{'type':_0xf64556[_0x1bdc('0x12')],'app':'GotoIfTime','appdata':_0x4fb629[_0x471ce2]+'?'+_0xf64556[_0x1bdc('0x15')]+_0x1bdc('0x39')+_0x226709+':'+_0xf64556[_0x1bdc('0x15')]+_0x1bdc('0x39')+_0xf501f4,'exten':_0xf64556[_0x1bdc('0xb')],'context':_0xf64556[_0x1bdc('0x15')],'priority':_0x5a21bd[_0x1bdc('0x19')]+_0x471ce2,'VoiceExtensionId':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x16')]});}_0xf64556['priority']=_0x2c9e2b[_0x1bdc('0x2a')]?_[_0x1bdc('0x3a')](_0x2c9e2b)[_0x1bdc('0x19')]+0x1:_0x5a21bd[_0x1bdc('0x19')];_0x5a21bd['priority']=(_0x1b82a1[_0x1bdc('0x2a')]?_[_0x1bdc('0x3a')](_0x1b82a1)[_0x1bdc('0x19')]:_0xf64556[_0x1bdc('0x19')])+0x1;_0x5a21bd[_0x1bdc('0xe')]=_[_0x1bdc('0x3b')](_0x5a21bd[_0x1bdc('0xe')],_0x2c9e2b,[_0xf64556],_0x1b82a1);}_0x5a21bd[_0x1bdc('0xe')]['push']({'type':_0x1b0368[_0x5d57b2][0x0]['type'],'app':_0x1bdc('0x3c'),'exten':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0xb')],'context':_0x1b0368[_0x5d57b2][0x0]['context'],'priority':_0x5a21bd[_0x1bdc('0x19')],'VoiceExtensionId':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x16')]});_0x5360cc['push'](_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x16')]);_0x44a267=_[_0x1bdc('0x3b')](_0x44a267,_0x5a21bd[_0x1bdc('0xe')]);}}return _0x1af9d8[_0x1bdc('0x3d')](function(_0x315fed){return _0x1af9d8['models']['VoiceExtension'][_0x1bdc('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x5360cc}},'transaction':_0x315fed})[_0x1bdc('0x4')](function(_0x174c54){return _0x1af9d8[_0x1bdc('0x1')][_0x1bdc('0x5')][_0x1bdc('0x3f')](_[_0x1bdc('0x40')](_0x44a267,'priority'),{'transaction':_0x315fed});});});})['catch'](function(_0x4891f7){console[_0x1bdc('0x41')](_0x4891f7);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0xba6b=['CDR(routeid)=','VoiceExtensionId','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','interval','*,*,*,*','IntervalId','map','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','destroy','bulkCreate','sortBy','catch','rewrite','lodash','util','findAll','intervals','models','VoiceExtension','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','then','filter','groupBy','playback','hasOwnProperty','priority','extensions','extension','find','push','type','Set','format','CDR(type)=%s','context'];(function(_0x18b5e8,_0x51e875){var _0x25baed=function(_0x3fcdf9){while(--_0x3fcdf9){_0x18b5e8['push'](_0x18b5e8['shift']());}};_0x25baed(++_0x51e875);}(_0xba6b,0x74));var _0xbba6=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xba6b[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xbba6('0x0'));var util=require(_0xbba6('0x1'));function rewrite(_0x575bb5,_0x4449b4){var _0x15b73c=this;return _0x575bb5['models']['Interval'][_0xbba6('0x2')]({'raw':!![]})['then'](function(_0x1a3a1c){_0x15b73c[_0xbba6('0x3')]=_0x1a3a1c;return _0x575bb5[_0xbba6('0x4')][_0xbba6('0x5')][_0xbba6('0x2')]({'where':{'IntervalId':_0x4449b4['IntervalId']},'raw':!![]});})['then'](function(_0x298fc1){return _0x575bb5[_0xbba6('0x4')][_0xbba6('0x5')][_0xbba6('0x2')]({'where':{'exten':{'$in':_[_0xbba6('0x6')](_['map'](_0x298fc1,_0xbba6('0x7')))}},'order':[{'raw':_0xbba6('0x8')}],'raw':!![]});})[_0xbba6('0x9')](function(_0x2b76f5){var _0x5ad9a5=_[_0xbba6('0xa')](_0x2b76f5,{'priority':'1'});var _0x590880=_[_0xbba6('0xa')](_0x2b76f5,{'isApp':0x1});var _0x43be4f=_[_0xbba6('0xb')](_0x590880,_0xbba6('0x7'));var _0x619be4=['queue',_0xbba6('0xc')];var _0x2779ab=[];var _0x36064c=[];for(var _0x38146c in _0x43be4f){if(_0x43be4f[_0xbba6('0xd')](_0x38146c)){_0x15b73c[_0xbba6('0xe')]=0x2;_0x15b73c[_0xbba6('0xf')]=[];_0x15b73c[_0xbba6('0x10')]=_[_0xbba6('0x11')](_0x5ad9a5,{'exten':_0x43be4f[_0x38146c][0x0]['exten']});_0x15b73c[_0xbba6('0xf')][_0xbba6('0x12')]({'type':_0x43be4f[_0x38146c][0x0][_0xbba6('0x13')],'app':_0xbba6('0x14'),'appdata':util[_0xbba6('0x15')](_0xbba6('0x16'),_0x43be4f[_0x38146c][0x0][_0xbba6('0x13')]),'context':_0x43be4f[_0x38146c][0x0][_0xbba6('0x17')],'exten':_0x43be4f[_0x38146c][0x0][_0xbba6('0x7')],'priority':_0x15b73c['priority']++,'VoiceExtensionId':_0x43be4f[_0x38146c][0x0]['VoiceExtensionId']});if(_0x43be4f[_0x38146c][0x0][_0xbba6('0x13')]==='inbound'){_0x15b73c[_0xbba6('0xf')][_0xbba6('0x12')]({'type':_0x43be4f[_0x38146c][0x0][_0xbba6('0x13')],'app':'Set','appdata':_0xbba6('0x18')+_0x43be4f[_0x38146c][0x0]['VoiceExtensionId'],'context':_0x43be4f[_0x38146c][0x0][_0xbba6('0x17')],'exten':_0x43be4f[_0x38146c][0x0][_0xbba6('0x7')],'priority':_0x15b73c[_0xbba6('0xe')]++,'VoiceExtensionId':_0x43be4f[_0x38146c][0x0][_0xbba6('0x19')]});}else if(_0x43be4f[_0x38146c][0x0][_0xbba6('0x13')]==='outbound'){if(_0x15b73c['extension']){_0x15b73c[_0xbba6('0xf')][_0xbba6('0x12')]({'type':_0x43be4f[_0x38146c][0x0][_0xbba6('0x13')],'app':_0xbba6('0x14'),'appdata':_0xbba6('0x1a')+(_0x15b73c[_0xbba6('0x10')][_0xbba6('0x1b')]?_0xbba6('0x1c')+_0x15b73c[_0xbba6('0x10')][_0xbba6('0x1b')]+'}':'${EXTEN}'),'context':_0x43be4f[_0x38146c][0x0][_0xbba6('0x17')],'exten':_0x43be4f[_0x38146c][0x0]['exten'],'priority':_0x15b73c[_0xbba6('0xe')]++,'VoiceExtensionId':_0x43be4f[_0x38146c][0x0][_0xbba6('0x19')]});}_0x15b73c[_0xbba6('0xf')]['push']({'type':_0x43be4f[_0x38146c][0x0][_0xbba6('0x13')],'app':_0xbba6('0x14'),'appdata':_0xbba6('0x18')+_0x43be4f[_0x38146c][0x0][_0xbba6('0x19')],'context':_0x43be4f[_0x38146c][0x0][_0xbba6('0x17')],'exten':_0x43be4f[_0x38146c][0x0][_0xbba6('0x7')],'priority':_0x15b73c[_0xbba6('0xe')]++,'VoiceExtensionId':_0x43be4f[_0x38146c][0x0][_0xbba6('0x19')]});var _0x2b479b=_0x15b73c[_0xbba6('0xe')]++;_0x15b73c[_0xbba6('0xf')]['push']({'type':_0x43be4f[_0x38146c][0x0]['type'],'app':_0xbba6('0x1d'),'appdata':_0xbba6('0x1e')+(_0x2b479b+0x2)+'):Goto('+(_0x2b479b+0x1)+')','context':_0x43be4f[_0x38146c][0x0][_0xbba6('0x17')],'exten':_0x43be4f[_0x38146c][0x0][_0xbba6('0x7')],'priority':_0x2b479b,'VoiceExtensionId':_0x43be4f[_0x38146c][0x0][_0xbba6('0x19')]});if(_0x15b73c['extension']){_0x15b73c[_0xbba6('0xf')]['push']({'type':_0x43be4f[_0x38146c][0x0][_0xbba6('0x13')],'app':_0xbba6('0x14'),'appdata':_0x15b73c[_0xbba6('0x10')]['cutdigits']?_0xbba6('0x1f')+_0x15b73c['extension']['cutdigits']+'}':_0xbba6('0x20'),'context':_0x43be4f[_0x38146c][0x0]['context'],'exten':_0x43be4f[_0x38146c][0x0][_0xbba6('0x7')],'priority':_0x15b73c[_0xbba6('0xe')]++,'VoiceExtensionId':_0x43be4f[_0x38146c][0x0][_0xbba6('0x19')]});}_0x15b73c[_0xbba6('0xf')]['push']({'type':_0x43be4f[_0x38146c][0x0][_0xbba6('0x13')],'app':_0xbba6('0x14'),'appdata':_0xbba6('0x21')+_0x43be4f[_0x38146c][0x0][_0xbba6('0x19')],'context':_0x43be4f[_0x38146c][0x0]['context'],'exten':_0x43be4f[_0x38146c][0x0]['exten'],'priority':_0x15b73c['priority']++,'VoiceExtensionId':_0x43be4f[_0x38146c][0x0][_0xbba6('0x19')]});if(_0x15b73c[_0xbba6('0x10')]&&_0x15b73c[_0xbba6('0x10')]['hasOwnProperty'](_0xbba6('0x22'))&&_0x15b73c[_0xbba6('0x10')][_0xbba6('0x22')]!==_0xbba6('0x23')){_0x15b73c['extensions'][_0xbba6('0x12')]({'type':_0x43be4f[_0x38146c][0x0][_0xbba6('0x13')],'app':_0xbba6('0x14'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x43be4f[_0x38146c][0x0][_0xbba6('0x17')],'exten':_0x43be4f[_0x38146c][0x0]['exten'],'priority':_0x15b73c[_0xbba6('0xe')]++,'VoiceExtensionId':_0x43be4f[_0x38146c][0x0][_0xbba6('0x19')]});_0x15b73c[_0xbba6('0xf')]['push']({'type':_0x43be4f[_0x38146c][0x0][_0xbba6('0x13')],'app':_0xbba6('0x14'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x15b73c[_0xbba6('0x10')][_0xbba6('0x22')]||'wav','context':_0x43be4f[_0x38146c][0x0][_0xbba6('0x17')],'exten':_0x43be4f[_0x38146c][0x0][_0xbba6('0x7')],'priority':_0x15b73c['priority']++,'VoiceExtensionId':_0x43be4f[_0x38146c][0x0][_0xbba6('0x19')]});}}_0x15b73c['extensions']['push']({'type':_0x43be4f[_0x38146c][0x0]['type'],'app':_0xbba6('0x14'),'appdata':_0xbba6('0x24'),'context':_0x43be4f[_0x38146c][0x0][_0xbba6('0x17')],'exten':_0x43be4f[_0x38146c][0x0][_0xbba6('0x7')],'priority':_0x15b73c[_0xbba6('0xe')]++,'VoiceExtensionId':_0x43be4f[_0x38146c][0x0]['VoiceExtensionId']});_0x15b73c['extensions']['push']({'type':_0x43be4f[_0x38146c][0x0][_0xbba6('0x13')],'app':_0xbba6('0x14'),'appdata':_0xbba6('0x25'),'context':_0x43be4f[_0x38146c][0x0]['context'],'exten':_0x43be4f[_0x38146c][0x0][_0xbba6('0x7')],'priority':_0x15b73c['priority']++,'VoiceExtensionId':_0x43be4f[_0x38146c][0x0][_0xbba6('0x19')]});_0x15b73c[_0xbba6('0xf')]['push']({'type':_0x43be4f[_0x38146c][0x0]['type'],'app':_0xbba6('0x14'),'appdata':_0xbba6('0x26'),'context':_0x43be4f[_0x38146c][0x0][_0xbba6('0x17')],'exten':_0x43be4f[_0x38146c][0x0]['exten'],'priority':_0x15b73c[_0xbba6('0xe')]++,'VoiceExtensionId':_0x43be4f[_0x38146c][0x0]['VoiceExtensionId']});for(var _0x16d7a7=0x0,_0xac7d4a=0x0;_0x16d7a7<_0x43be4f[_0x38146c][_0xbba6('0x27')];_0x16d7a7+=0x1,_0xac7d4a=0x0){var _0x2a9fcc=_0x43be4f[_0x38146c][_0x16d7a7];if(_0x2a9fcc[_0xbba6('0x13')]){_0x2a9fcc[_0xbba6('0x13')]=_0x2a9fcc[_0xbba6('0x13')][_0xbba6('0x28')]();}var _0x14c72b=[];var _0x2c8708=[];delete _0x2a9fcc['id'];delete _0x2a9fcc[_0xbba6('0x29')];delete _0x2a9fcc['updatedAt'];var _0x4a91af=_0x2a9fcc[_0xbba6('0x2a')]!==_0xbba6('0x2b')?[_0x2a9fcc['interval']]:_0x2a9fcc[_0xbba6('0x2c')]?_[_0xbba6('0x2d')](_[_0xbba6('0xa')](_0x15b73c['intervals'],{'IntervalId':_0x2a9fcc[_0xbba6('0x2c')]}),_0xbba6('0x2a')):[];if(_0x2a9fcc[_0xbba6('0xd')](_0xbba6('0x2e'))){if(_0x2a9fcc[_0xbba6('0x2e')]&&_0x2a9fcc[_0xbba6('0x2e')]!=='--'){_0x14c72b[_0xbba6('0x12')]({'type':_0x2a9fcc['type'],'app':'Set','appdata':_0xbba6('0x2f')+_0x2a9fcc[_0xbba6('0x2e')],'context':_0x2a9fcc[_0xbba6('0x17')],'exten':_0x2a9fcc[_0xbba6('0x7')],'priority':_0x4a91af[_0xbba6('0x27')]+_0x15b73c['priority']+_0xac7d4a++,'VoiceExtensionId':_0x2a9fcc[_0xbba6('0x19')]});}}if(_0x2a9fcc[_0xbba6('0x13')]===_0xbba6('0x30')&&_0x2a9fcc['hasOwnProperty'](_0xbba6('0x31'))){if(_0x2a9fcc['callerID']){_0x14c72b[_0xbba6('0x12')]({'type':_0x2a9fcc[_0xbba6('0x13')],'app':_0xbba6('0x1d'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x2a9fcc[_0xbba6('0x31')]+')','context':_0x2a9fcc[_0xbba6('0x17')],'exten':_0x2a9fcc[_0xbba6('0x7')],'priority':_0x4a91af[_0xbba6('0x27')]+_0x15b73c['priority']+_0xac7d4a++,'VoiceExtensionId':_0x2a9fcc[_0xbba6('0x19')]});}else{_0x14c72b[_0xbba6('0x12')]({'type':_0x2a9fcc[_0xbba6('0x13')],'app':_0xbba6('0x1d'),'appdata':_0xbba6('0x32'),'context':_0x2a9fcc['context'],'exten':_0x2a9fcc[_0xbba6('0x7')],'priority':_0x4a91af['length']+_0x15b73c[_0xbba6('0xe')]+_0xac7d4a++,'VoiceExtensionId':_0x2a9fcc[_0xbba6('0x19')]});}}if(_0x2a9fcc[_0xbba6('0xd')]('answer')){if(_0x619be4[_0xbba6('0x33')](_0x2a9fcc[_0xbba6('0x34')][_0xbba6('0x28')]())>=0x0&&_0x2a9fcc[_0xbba6('0x35')]!==_0xbba6('0x36')){if(_0x2a9fcc[_0xbba6('0x37')]){_0x14c72b[_0xbba6('0x12')]({'type':_0x2a9fcc['type'],'app':_0xbba6('0x1d'),'appdata':_0xbba6('0x38'),'context':_0x2a9fcc[_0xbba6('0x17')],'exten':_0x2a9fcc[_0xbba6('0x7')],'priority':_0x4a91af[_0xbba6('0x27')]+_0x15b73c[_0xbba6('0xe')]+_0xac7d4a++,'VoiceExtensionId':_0x2a9fcc[_0xbba6('0x19')]});_0x14c72b[_0xbba6('0x12')]({'type':_0x2a9fcc[_0xbba6('0x13')],'app':_0xbba6('0x14'),'appdata':_0xbba6('0x39'),'context':_0x2a9fcc[_0xbba6('0x17')],'exten':_0x2a9fcc[_0xbba6('0x7')],'priority':_0x4a91af[_0xbba6('0x27')]+_0x15b73c[_0xbba6('0xe')]+_0xac7d4a++,'VoiceExtensionId':_0x2a9fcc[_0xbba6('0x19')]});}else{_0x14c72b[_0xbba6('0x12')]({'type':_0x2a9fcc[_0xbba6('0x13')],'app':_0xbba6('0x1d'),'appdata':_0xbba6('0x3a'),'context':_0x2a9fcc[_0xbba6('0x17')],'exten':_0x2a9fcc[_0xbba6('0x7')],'priority':_0x4a91af['length']+_0x15b73c[_0xbba6('0xe')]+_0xac7d4a++,'VoiceExtensionId':_0x2a9fcc[_0xbba6('0x19')]});_0x14c72b[_0xbba6('0x12')]({'type':_0x2a9fcc['type'],'app':_0xbba6('0x14'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x2a9fcc[_0xbba6('0x17')],'exten':_0x2a9fcc[_0xbba6('0x7')],'priority':_0x4a91af['length']+_0x15b73c[_0xbba6('0xe')]+_0xac7d4a++,'VoiceExtensionId':_0x2a9fcc['VoiceExtensionId']});}}}for(var _0x4f5e71=0x0;_0x4f5e71<_0x4a91af['length'];_0x4f5e71+=0x1){var _0x26c0a9=_0x15b73c[_0xbba6('0xe')]+_0x4a91af['length'];var _0x35c47e=_0x4f5e71===_0x4a91af[_0xbba6('0x27')]-0x1?_0x15b73c[_0xbba6('0xe')]+_0x14c72b[_0xbba6('0x27')]+_0x2c8708[_0xbba6('0x27')]+0x2:_0x15b73c['priority']+_0x4f5e71+0x1;_0x14c72b[_0xbba6('0x3b')](_0x4f5e71,0x0,{'type':_0x2a9fcc['type'],'app':_0xbba6('0x3c'),'appdata':_0x4a91af[_0x4f5e71]+'?'+_0x2a9fcc[_0xbba6('0x17')]+_0xbba6('0x3d')+_0x26c0a9+':'+_0x2a9fcc[_0xbba6('0x17')]+_0xbba6('0x3d')+_0x35c47e,'exten':_0x2a9fcc[_0xbba6('0x7')],'context':_0x2a9fcc[_0xbba6('0x17')],'priority':_0x15b73c['priority']+_0x4f5e71,'VoiceExtensionId':_0x43be4f[_0x38146c][0x0]['VoiceExtensionId']});}_0x2a9fcc[_0xbba6('0xe')]=_0x14c72b[_0xbba6('0x27')]?_[_0xbba6('0x3e')](_0x14c72b)[_0xbba6('0xe')]+0x1:_0x15b73c['priority'];_0x15b73c[_0xbba6('0xe')]=(_0x2c8708[_0xbba6('0x27')]?_[_0xbba6('0x3e')](_0x2c8708)[_0xbba6('0xe')]:_0x2a9fcc[_0xbba6('0xe')])+0x1;_0x15b73c[_0xbba6('0xf')]=_['concat'](_0x15b73c[_0xbba6('0xf')],_0x14c72b,[_0x2a9fcc],_0x2c8708);}_0x15b73c[_0xbba6('0xf')][_0xbba6('0x12')]({'type':_0x43be4f[_0x38146c][0x0][_0xbba6('0x13')],'app':_0xbba6('0x3f'),'exten':_0x43be4f[_0x38146c][0x0][_0xbba6('0x7')],'context':_0x43be4f[_0x38146c][0x0][_0xbba6('0x17')],'priority':_0x15b73c['priority'],'VoiceExtensionId':_0x43be4f[_0x38146c][0x0][_0xbba6('0x19')]});_0x2779ab[_0xbba6('0x12')](_0x43be4f[_0x38146c][0x0]['VoiceExtensionId']);_0x36064c=_[_0xbba6('0x40')](_0x36064c,_0x15b73c[_0xbba6('0xf')]);}}return _0x575bb5['transaction'](function(_0x5202e2){return _0x575bb5[_0xbba6('0x4')][_0xbba6('0x5')][_0xbba6('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x2779ab}},'transaction':_0x5202e2})[_0xbba6('0x9')](function(_0x2e7b0b){return _0x575bb5[_0xbba6('0x4')][_0xbba6('0x5')][_0xbba6('0x42')](_[_0xbba6('0x43')](_0x36064c,_0xbba6('0xe')),{'transaction':_0x5202e2});});});})[_0xbba6('0x44')](function(_0x42f8c3){console['error'](_0x42f8c3);});}exports[_0xbba6('0x45')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index f8d124d..458b1ab 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 _0xf55d=['into','cm_hopper','scheduledAt','ContactId','select','NOW()','field','toString','createdAt','updatedAt','from','cm_contacts','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','fromQuery','id\x20IN\x20?','str','calleridnum','cm_hopper_final','deletedAt\x20IS\x20NULL','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','push','sequelize','query','VoiceQueueId','onlyIfOpen','BlackLists','all','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','CSV\x20import\x20process\x20stopped!','split','parse','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','papaparse','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','register','undefined','Missing\x20filepath\x20parameter!','argv','null','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','errors','length','map','join','hasOwnProperty','data','firstName','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','duplicate','CmContact','create','keys','then','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','inspect','insert'];(function(_0x3c126c,_0x22f353){var _0x3b89e4=function(_0x1472c0){while(--_0x1472c0){_0x3c126c['push'](_0x3c126c['shift']());}};_0x3b89e4(++_0x22f353);}(_0xf55d,0xa7));var _0xdf55=function(_0x5607c5,_0x30a032){_0x5607c5=_0x5607c5-0x0;var _0x3eb0cf=_0xf55d[_0x5607c5];return _0x3eb0cf;};'use strict';var BPromise=require(_0xdf55('0x0'));var util=require('util');var _=require(_0xdf55('0x1'));var fs=require('fs');var squel=require(_0xdf55('0x2'));var Papa=require(_0xdf55('0x3'));var Redis=require('ioredis');var db=require(_0xdf55('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0xdf55('0x5'))(_0xdf55('0x6'));config[_0xdf55('0x7')]=_[_0xdf55('0x8')](config[_0xdf55('0x7')],{'host':_0xdf55('0x9'),'port':0x18eb});var socket=require(_0xdf55('0xa'))(new Redis(config['redis']));require('../../../api/cmContact/cmContact.socket')[_0xdf55('0xb')](socket);try{if(!process['argv'][0x2]||process['argv'][0x2]===_0xdf55('0xc')||process['argv'][0x2]==='null'){throw new Error(_0xdf55('0xd'));}var FILEPATH=process[_0xdf55('0xe')][0x2];if(!process['argv'][0x3]||process['argv'][0x3]==='undefined'||process[_0xdf55('0xe')][0x3]===_0xdf55('0xf')||!process[_0xdf55('0xe')][0x4]||process[_0xdf55('0xe')][0x4]===_0xdf55('0xc')||process[_0xdf55('0xe')][0x4]===_0xdf55('0xf')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_['zipObject'](process[_0xdf55('0xe')][0x3]['split'](','),process[_0xdf55('0xe')][0x4]['split'](','));if(!process[_0xdf55('0xe')][0x5]||process[_0xdf55('0xe')][0x5]==='undefined'||process[_0xdf55('0xe')][0x5]===_0xdf55('0xf')){throw new Error(_0xdf55('0x10'));}var LISTID=process[_0xdf55('0xe')][0x5];var COMPANYID=process['argv'][0x6]&&process['argv'][0x6]!==_0xdf55('0xc')&&process[_0xdf55('0xe')][0x6]!==_0xdf55('0xf')?process[_0xdf55('0xe')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0xdf55('0xe')][0x7]!==_0xdf55('0xc')&&process[_0xdf55('0xe')][0x7]!==_0xdf55('0xf')?process[_0xdf55('0xe')][0x7]:null;if(!process[_0xdf55('0xe')][0x8]||process[_0xdf55('0xe')][0x8]===_0xdf55('0xc')||process[_0xdf55('0xe')][0x8]===_0xdf55('0xf')){throw new Error(_0xdf55('0x11'));}var SOCKET_TIMESTAMP=process[_0xdf55('0xe')][0x8];}catch(_0x17a4ae){logger[_0xdf55('0x12')](_0x17a4ae);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(_0x13ffbc,_0x4a179f,_0x274edf,_0x1372d5){var _0x23869d={'message':_0x4a179f};_0x23869d[_0x13ffbc]=!![];if(_0x274edf){_0x23869d[_0xdf55('0x13')]=_0x274edf;}if(_0x1372d5){_0x23869d[_0xdf55('0x14')]=_0x1372d5;}return _0x23869d;}function isEmail(_0x24f176){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))*$/[_0xdf55('0x15')](_0x24f176);}function checkRow(_0x234775,_0x5069fb,_0x40493d){return new BPromise(function(_0x12e393,_0x4b4a37){if(_[_0xdf55('0x16')](_0x234775)){return _0x4b4a37(handleCheckRowError(_0xdf55('0x12'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x40493d));}if(_0x234775[_0xdf55('0x17')]&&_0x234775[_0xdf55('0x17')][_0xdf55('0x18')]){var _0xf32bdd=_[_0xdf55('0x19')](_0x234775[_0xdf55('0x17')],'message')[_0xdf55('0x1a')](';');return _0x4b4a37(handleCheckRowError(_0xdf55('0x12'),_0xf32bdd,null,_0x40493d));}var _0x4f3615={};for(var _0x19f135 in FIELDS){if(FIELDS[_0xdf55('0x1b')](_0x19f135)&&FIELDS[_0x19f135]){_0x4f3615[_0x19f135]=_0x234775['data'][0x0][FIELDS[_0x19f135]]||_0x234775[_0xdf55('0x1c')][0x0]['\ufeff'+FIELDS[_0x19f135]];}}if(!_0x4f3615[_0xdf55('0x1d')]){return _0x4b4a37(handleCheckRowError('error','firstName\x20not\x20specified!',null,_0x40493d));}if(!_0x4f3615[_0xdf55('0x1e')]){return _0x4b4a37(handleCheckRowError(_0xdf55('0x12'),_0xdf55('0x1f'),null,_0x40493d));}if(_0x4f3615[_0xdf55('0x20')]){var _0x47f635=moment(_0x4f3615['birthDate'],_0xdf55('0x21'));if(!_0x47f635[_0xdf55('0x22')]()){return _0x4b4a37(handleCheckRowError(_0xdf55('0x12'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x40493d));}}if(_0x4f3615['email']){if(!isEmail(_0x4f3615['email'])){return _0x4b4a37(handleCheckRowError('error',_0xdf55('0x23'),null,_0x40493d));}}_0x4f3615[_0xdf55('0x24')]=LISTID;_0x4f3615[_0xdf55('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x5069fb){var _0x1419a0={};for(var _0x1efb0a=0x0,_0x5adbb1=DUPLICATES[_0xdf55('0x18')];_0x1efb0a<_0x5adbb1;_0x1efb0a+=0x1){_0x1419a0[DUPLICATES[_0x1efb0a]]=_0x4f3615[DUPLICATES[_0x1efb0a]];}var _0x15f729=_['find'](_0x5069fb,_0x1419a0);if(_0x15f729){return _0x4b4a37(handleCheckRowError(_0xdf55('0x26'),'Duplicate\x20Contact',_0x15f729,_0x40493d));}}return db[_0xdf55('0x27')][_0xdf55('0x28')](_0x4f3615,{'raw':!![],'hooks':![],'fields':_[_0xdf55('0x29')](_0x4f3615)})[_0xdf55('0x2a')](function(_0x27aa0d){if(DUPLICATES&&DUPLICATES[_0xdf55('0x18')]&&_0x5069fb){_0x5069fb['push'](_['pick'](_0x4f3615,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x27aa0d['id'];return _0x12e393();})[_0xdf55('0x2b')](function(_0x29cb71){return _0x4b4a37(handleCheckRowError(_0xdf55('0x12'),_0xdf55('0x2c')+(_0x29cb71[_0xdf55('0x2d')]||JSON[_0xdf55('0x2e')](_0x29cb71)),null,_0x40493d));});});}function checkHopper(){function _0x7f8fa(){return function(_0xbbf31){logger[_0xdf55('0x12')](_0xdf55('0x2f'),_0xdf55('0x30'),util[_0xdf55('0x31')](_0xbbf31,{'showHidden':![],'depth':null}));};}var _0x4a3674=function(_0x5cd064,_0x3869d1){var _0xbcdb4d=squel[_0xdf55('0x32')]()[_0xdf55('0x33')](_0xdf55('0x34'))['fromQuery']([_0xdf55('0x1e'),_0xdf55('0x35'),_0xdf55('0x36'),_0xdf55('0x24'),_0x3869d1,'createdAt','updatedAt'],squel[_0xdf55('0x37')]()['field'](_0xdf55('0x1e'),'phone')['field'](_0xdf55('0x38'),_0xdf55('0x35'))[_0xdf55('0x39')]('id','ContactId')[_0xdf55('0x39')](LISTID[_0xdf55('0x3a')](),_0xdf55('0x24'))[_0xdf55('0x39')](_0x5cd064['id']['toString'](),_0x3869d1)[_0xdf55('0x39')](_0xdf55('0x38'),_0xdf55('0x3b'))[_0xdf55('0x39')](_0xdf55('0x38'),_0xdf55('0x3c'))[_0xdf55('0x3d')](_0xdf55('0x3e'))['where']('deletedAt\x20IS\x20NULL')[_0xdf55('0x3f')](_0xdf55('0x40'),LISTID[_0xdf55('0x3a')]())['where'](_0xdf55('0x41'))['where'](_0xdf55('0x42'),squel[_0xdf55('0x37')]()[_0xdf55('0x39')](_0xdf55('0x1e'))['from']('cm_hopper')['where'](_0x3869d1+_0xdf55('0x43'),_0x5cd064['id'][_0xdf55('0x3a')]())))[_0xdf55('0x3a')]();return _0xbcdb4d;};var _0x1ec09a=function(_0x370193,_0x19d90c){var _0x5e39a2=squel[_0xdf55('0x32')]()[_0xdf55('0x33')](_0xdf55('0x34'))[_0xdf55('0x44')]([_0xdf55('0x1e'),'scheduledAt',_0xdf55('0x36'),'ListId',_0x19d90c,_0xdf55('0x3b'),'updatedAt'],squel[_0xdf55('0x37')]()['field']('phone',_0xdf55('0x1e'))[_0xdf55('0x39')]('NOW()',_0xdf55('0x35'))[_0xdf55('0x39')]('id',_0xdf55('0x36'))[_0xdf55('0x39')](LISTID[_0xdf55('0x3a')](),_0xdf55('0x24'))[_0xdf55('0x39')](_0x370193['id'][_0xdf55('0x3a')](),_0x19d90c)[_0xdf55('0x39')](_0xdf55('0x38'),_0xdf55('0x3b'))['field'](_0xdf55('0x38'),_0xdf55('0x3c'))[_0xdf55('0x3d')](_0xdf55('0x3e'))['where']('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID[_0xdf55('0x3a')]())['where'](_0xdf55('0x45'),squel[_0xdf55('0x46')](hopperContacts))[_0xdf55('0x3f')](_0xdf55('0x41'))['where'](_0xdf55('0x42'),squel[_0xdf55('0x37')]()[_0xdf55('0x39')](_0xdf55('0x47'))[_0xdf55('0x3d')](_0xdf55('0x48'))[_0xdf55('0x3f')](_0x19d90c+_0xdf55('0x43'),_0x370193['id']['toString']()))[_0xdf55('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel[_0xdf55('0x37')]()['field'](_0xdf55('0x1e'))[_0xdf55('0x3d')](_0xdf55('0x34'))[_0xdf55('0x3f')](_0x19d90c+_0xdf55('0x43'),_0x370193['id']['toString']())))[_0xdf55('0x3a')]();return _0x5e39a2;};function _0x4c1704(_0x4234c5,_0x2f90d9){var _0x4e5f20=squel[_0xdf55('0x32')]()[_0xdf55('0x33')](_0xdf55('0x34'))[_0xdf55('0x44')]([_0xdf55('0x1e'),_0xdf55('0x35'),_0xdf55('0x36'),_0xdf55('0x24'),_0x2f90d9,_0xdf55('0x3b'),_0xdf55('0x3c')],squel[_0xdf55('0x37')]()[_0xdf55('0x39')]('phone','phone')[_0xdf55('0x39')](_0xdf55('0x38'),_0xdf55('0x35'))[_0xdf55('0x39')]('id',_0xdf55('0x36'))['field'](LISTID[_0xdf55('0x3a')](),'ListId')[_0xdf55('0x39')](_0x4234c5['id'][_0xdf55('0x3a')](),_0x2f90d9)[_0xdf55('0x39')](_0xdf55('0x38'),_0xdf55('0x3b'))['field']('NOW()',_0xdf55('0x3c'))[_0xdf55('0x3d')](_0xdf55('0x3e'))[_0xdf55('0x3f')](_0xdf55('0x49'))['where'](_0xdf55('0x40'),LISTID[_0xdf55('0x3a')]())['where']('id\x20IN\x20?',squel['str'](hopperContacts))[_0xdf55('0x3f')]('phone\x20IS\x20NOT\x20NULL'))[_0xdf55('0x3a')]();return _0x4e5f20;}function _0x401e8c(_0x48ff2b,_0x5bce0d){var _0x463794=squel[_0xdf55('0x32')]()['into'](_0xdf55('0x4a'))[_0xdf55('0x44')]([_0xdf55('0x1e'),_0xdf55('0x36'),_0xdf55('0x24'),_0x5bce0d,_0xdf55('0x3b'),_0xdf55('0x3c')],squel[_0xdf55('0x37')]()[_0xdf55('0x39')]('phone','phone')[_0xdf55('0x39')]('id',_0xdf55('0x36'))['field'](LISTID[_0xdf55('0x3a')](),_0xdf55('0x24'))[_0xdf55('0x39')](_0x48ff2b['id']['toString'](),_0x5bce0d)[_0xdf55('0x39')](_0xdf55('0x38'),'createdAt')[_0xdf55('0x39')](_0xdf55('0x38'),_0xdf55('0x3c'))[_0xdf55('0x3d')]('cm_contacts')[_0xdf55('0x3f')](_0xdf55('0x49'))['where'](_0xdf55('0x40'),LISTID[_0xdf55('0x3a')]())[_0xdf55('0x3f')]('id\x20IN\x20?',squel[_0xdf55('0x46')](hopperContacts))[_0xdf55('0x3f')](_0xdf55('0x41')))[_0xdf55('0x3a')]();return _0x463794;}return db[_0xdf55('0x4b')][_0xdf55('0x4c')]({'where':{'type':_0xdf55('0x4d')},'attributes':['id',_0xdf55('0x4e')],'include':[{'model':db[_0xdf55('0x4f')],'as':_0xdf55('0x50'),'where':{'id':LISTID}}]})[_0xdf55('0x2a')](function(_0x49d1b2){var _0x4e713b=[];if(_0x49d1b2){var _0x3de3e3;for(var _0x870789=0x0,_0x44cf63;_0x870789<_0x49d1b2[_0xdf55('0x18')];_0x870789+=0x1){_0x44cf63=_0x49d1b2[_0x870789][_0xdf55('0x51')]({'plain':!![]});switch(_0x44cf63[_0xdf55('0x4e')]){case _0xdf55('0x52'):_0x4e713b[_0xdf55('0x53')](db[_0xdf55('0x54')][_0xdf55('0x55')](_0x1ec09a(_0x44cf63,_0xdf55('0x56')))[_0xdf55('0x2a')](function(){})[_0xdf55('0x2b')](_0x7f8fa()));break;case _0xdf55('0x57'):_0x4e713b[_0xdf55('0x53')](db['sequelize']['query'](_0x4a3674(_0x44cf63,_0xdf55('0x56')))[_0xdf55('0x2a')](function(){})[_0xdf55('0x2b')](_0x7f8fa()));break;default:_0x4e713b[_0xdf55('0x53')](db[_0xdf55('0x54')][_0xdf55('0x55')](_0x4c1704(_0x44cf63,_0xdf55('0x56')))[_0xdf55('0x2a')](function(){})[_0xdf55('0x2b')](_0x7f8fa()));}}}return _0x4e713b;})['all']()[_0xdf55('0x2a')](function(){return db[_0xdf55('0x4b')][_0xdf55('0x4c')]({'where':{'type':_0xdf55('0x4d')},'attributes':['id'],'include':[{'model':db[_0xdf55('0x4f')],'as':_0xdf55('0x58'),'where':{'id':LISTID}}]})[_0xdf55('0x2a')](function(_0x57bdc2){var _0x2f0ccc=[];if(_0x57bdc2){var _0x439e7e;for(var _0x3dbfc3=0x0,_0x3e9d8e;_0x3dbfc3<_0x57bdc2[_0xdf55('0x18')];_0x3dbfc3+=0x1){_0x3e9d8e=_0x57bdc2[_0x3dbfc3]['get']({'plain':!![]});_0x2f0ccc['push'](db['sequelize'][_0xdf55('0x55')](_0x401e8c(_0x3e9d8e,'VoiceQueueId'))[_0xdf55('0x2a')](function(){})[_0xdf55('0x2b')](_0x7f8fa()));}}return _0x2f0ccc;})[_0xdf55('0x59')]();})[_0xdf55('0x2a')](function(){return db[_0xdf55('0x5a')][_0xdf55('0x4c')]({'attributes':['id',_0xdf55('0x4e')],'include':[{'model':db[_0xdf55('0x4f')],'as':'Lists','where':{'id':LISTID}}]})[_0xdf55('0x2a')](function(_0x146a20){var _0x4d3730=[];if(_0x146a20){for(var _0x5ad104=0x0,_0x507ea9;_0x5ad104<_0x146a20[_0xdf55('0x18')];_0x5ad104+=0x1){_0x507ea9=_0x146a20[_0x5ad104][_0xdf55('0x51')]({'plain':!![]});switch(_0x507ea9[_0xdf55('0x4e')]){case _0xdf55('0x52'):_0x4d3730[_0xdf55('0x53')](db['sequelize'][_0xdf55('0x55')](_0x1ec09a(_0x507ea9,_0xdf55('0x5b')))[_0xdf55('0x2a')](function(){})['catch'](_0x7f8fa()));break;case _0xdf55('0x57'):_0x4d3730[_0xdf55('0x53')](db[_0xdf55('0x54')][_0xdf55('0x55')](_0x4a3674(_0x507ea9,'CampaignId'))[_0xdf55('0x2a')](function(){})[_0xdf55('0x2b')](_0x7f8fa()));break;default:_0x4d3730[_0xdf55('0x53')](db[_0xdf55('0x54')][_0xdf55('0x55')](_0x4c1704(_0x507ea9,'CampaignId'))[_0xdf55('0x2a')](function(){})[_0xdf55('0x2b')](_0x7f8fa()));}}}return _0x4d3730;})[_0xdf55('0x59')]();})[_0xdf55('0x2a')](function(){return db[_0xdf55('0x5a')][_0xdf55('0x4c')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xdf55('0x58'),'where':{'id':LISTID}}]})[_0xdf55('0x2a')](function(_0x29c7b5){var _0x455281=[];if(_0x29c7b5){for(var _0x126fb0=0x0,_0x2a7b35;_0x126fb0<_0x29c7b5[_0xdf55('0x18')];_0x126fb0+=0x1){_0x2a7b35=_0x29c7b5[_0x126fb0]['get']({'plain':!![]});_0x455281['push'](db['sequelize']['query'](_0x401e8c(_0x2a7b35,_0xdf55('0x5b')))[_0xdf55('0x2a')](function(){})[_0xdf55('0x2b')](_0x7f8fa()));}}return _0x455281;})['all']();})[_0xdf55('0x2b')](function(_0x2f640d){logger['error'](_0xdf55('0x5c'),_0xdf55('0x5d'),_0x2f640d[_0xdf55('0x2d')]);});}var processPromises=function(_0x231150){return BPromise[_0xdf55('0x59')](promises)[_0xdf55('0x2a')](function(_0x49b7e8){})[_0xdf55('0x2b')](function(_0x3c5a64){logger[_0xdf55('0x12')]('Error\x20processing\x20rows\x20block:',JSON[_0xdf55('0x2e')](_0x3c5a64));})[_0xdf55('0x5e')](function(){socket[_0xdf55('0x5f')](_0xdf55('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x231150){return _0x231150[_0xdf55('0x61')]();}});};var endCsv=function(){return BPromise[_0xdf55('0x62')]()[_0xdf55('0x2a')](function(){if(hopperContacts){return checkHopper();}})[_0xdf55('0x2a')](function(){socket[_0xdf55('0x5f')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xdf55('0x63')](FILEPATH);}catch(_0x3a7146){logger['error'](_0xdf55('0x64'),JSON['stringify'](_0x3a7146));}finally{process['exit'](0x0);}});};process['on'](_0xdf55('0x65'),function(){logger[_0xdf55('0x66')](_0xdf55('0x67'));endCsv();});function main(){return BPromise[_0xdf55('0x62')]()[_0xdf55('0x2a')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xdf55('0x68')](',');return db['CmContact'][_0xdf55('0x4c')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xdf55('0x2a')](function(_0x596d67){var _0x2c0942=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xdf55('0x69')](_0x2c0942,{'header':!![],'skipEmptyLines':!![],'step':function(_0x23adf9,_0x25482e){total+=0x1;var _0x428af6=total;promises[_0xdf55('0x53')](checkRow(_0x23adf9,_0x596d67,_0x428af6)[_0xdf55('0x2a')](function(){success+=0x1;})['catch'](function(_0x16a6d7){if(_0x16a6d7[_0xdf55('0x12')]){errors+=0x1;delete _0x16a6d7['error'];}else if(_0x16a6d7[_0xdf55('0x26')]){duplicates+=0x1;delete _0x16a6d7[_0xdf55('0x26')];}rows[_0xdf55('0x53')](_0x16a6d7);}));if(total%0xc8===0x0){_0x25482e['pause']();return processPromises(_0x25482e);}},'complete':function(){return processPromises()[_0xdf55('0x2a')](function(){logger['info'](_0xdf55('0x6a'));endCsv();});},'error':function(_0x44473a,_0x560509){logger[_0xdf55('0x66')](_0xdf55('0x6b'),JSON[_0xdf55('0x2e')](_0x44473a));endCsv();}});})[_0xdf55('0x2b')](function(_0x295a70){logger[_0xdf55('0x12')](_0xdf55('0x6c'),JSON['stringify'](_0x295a70));});}main(); \ No newline at end of file +var _0xe3a2=['ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','register','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','error','contact','index','test','isNil','errors','length','map','message','data','firstName','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','keys','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','phone','ContactId','updatedAt','select','field','NOW()','createdAt','where','deletedAt\x20IS\x20NULL','toString','phone\x20NOT\x20IN\x20(?)','from','scheduledAt','cm_contacts','ListId\x20=\x20?','id\x20IN\x20?','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','str','cm_hopper_black','VoiceQueue','findAll','dialCheckDuplicateType','Lists','always','push','onlyIfOpen','sequelize','query','VoiceQueueId','all','outbound','CmList','BlackLists','get','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','stringify','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse'];(function(_0x4deacf,_0x1a6518){var _0x375a75=function(_0x2e429f){while(--_0x2e429f){_0x4deacf['push'](_0x4deacf['shift']());}};_0x375a75(++_0x1a6518);}(_0xe3a2,0x1af));var _0x2e3a=function(_0x280d71,_0xe818ec){_0x280d71=_0x280d71-0x0;var _0x4eec09=_0xe3a2[_0x280d71];return _0x4eec09;};'use strict';var BPromise=require(_0x2e3a('0x0'));var util=require(_0x2e3a('0x1'));var _=require(_0x2e3a('0x2'));var fs=require('fs');var squel=require(_0x2e3a('0x3'));var Papa=require(_0x2e3a('0x4'));var Redis=require(_0x2e3a('0x5'));var db=require(_0x2e3a('0x6'))['db'];var config=require(_0x2e3a('0x7'));var logger=require(_0x2e3a('0x8'))(_0x2e3a('0x9'));config[_0x2e3a('0xa')]=_[_0x2e3a('0xb')](config[_0x2e3a('0xa')],{'host':_0x2e3a('0xc'),'port':0x18eb});var socket=require(_0x2e3a('0xd'))(new Redis(config[_0x2e3a('0xa')]));require('../../../api/cmContact/cmContact.socket')[_0x2e3a('0xe')](socket);try{if(!process[_0x2e3a('0xf')][0x2]||process[_0x2e3a('0xf')][0x2]===_0x2e3a('0x10')||process['argv'][0x2]==='null'){throw new Error(_0x2e3a('0x11'));}var FILEPATH=process[_0x2e3a('0xf')][0x2];if(!process['argv'][0x3]||process[_0x2e3a('0xf')][0x3]==='undefined'||process[_0x2e3a('0xf')][0x3]===_0x2e3a('0x12')||!process[_0x2e3a('0xf')][0x4]||process[_0x2e3a('0xf')][0x4]==='undefined'||process['argv'][0x4]===_0x2e3a('0x12')){throw new Error(_0x2e3a('0x13'));}var FIELDS=_[_0x2e3a('0x14')](process[_0x2e3a('0xf')][0x3][_0x2e3a('0x15')](','),process[_0x2e3a('0xf')][0x4]['split'](','));if(!process[_0x2e3a('0xf')][0x5]||process[_0x2e3a('0xf')][0x5]===_0x2e3a('0x10')||process[_0x2e3a('0xf')][0x5]===_0x2e3a('0x12')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x2e3a('0xf')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x2e3a('0xf')][0x6]!==_0x2e3a('0x10')&&process[_0x2e3a('0xf')][0x6]!==_0x2e3a('0x12')?process[_0x2e3a('0xf')][0x6]:null;var DUPLICATES=process[_0x2e3a('0xf')][0x7]&&process['argv'][0x7]!==_0x2e3a('0x10')&&process['argv'][0x7]!==_0x2e3a('0x12')?process[_0x2e3a('0xf')][0x7]:null;if(!process['argv'][0x8]||process[_0x2e3a('0xf')][0x8]==='undefined'||process[_0x2e3a('0xf')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x2e3a('0xf')][0x8];}catch(_0x31f7c0){logger[_0x2e3a('0x16')](_0x31f7c0);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(_0x204ac3,_0x456114,_0x1e8582,_0x3d00b9){var _0x13f91c={'message':_0x456114};_0x13f91c[_0x204ac3]=!![];if(_0x1e8582){_0x13f91c[_0x2e3a('0x17')]=_0x1e8582;}if(_0x3d00b9){_0x13f91c[_0x2e3a('0x18')]=_0x3d00b9;}return _0x13f91c;}function isEmail(_0x56d1c4){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))*$/[_0x2e3a('0x19')](_0x56d1c4);}function checkRow(_0x3f430f,_0x557528,_0x4cd2d5){return new BPromise(function(_0x364b0a,_0x5852a5){if(_[_0x2e3a('0x1a')](_0x3f430f)){return _0x5852a5(handleCheckRowError(_0x2e3a('0x16'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x4cd2d5));}if(_0x3f430f[_0x2e3a('0x1b')]&&_0x3f430f[_0x2e3a('0x1b')][_0x2e3a('0x1c')]){var _0x2b258b=_[_0x2e3a('0x1d')](_0x3f430f[_0x2e3a('0x1b')],_0x2e3a('0x1e'))['join'](';');return _0x5852a5(handleCheckRowError(_0x2e3a('0x16'),_0x2b258b,null,_0x4cd2d5));}var _0x5bbbe7={};for(var _0x17b4c4 in FIELDS){if(FIELDS['hasOwnProperty'](_0x17b4c4)&&FIELDS[_0x17b4c4]){_0x5bbbe7[_0x17b4c4]=_0x3f430f[_0x2e3a('0x1f')][0x0][FIELDS[_0x17b4c4]]||_0x3f430f[_0x2e3a('0x1f')][0x0]['\ufeff'+FIELDS[_0x17b4c4]];}}if(!_0x5bbbe7[_0x2e3a('0x20')]){return _0x5852a5(handleCheckRowError(_0x2e3a('0x16'),'firstName\x20not\x20specified!',null,_0x4cd2d5));}if(!_0x5bbbe7['phone']){return _0x5852a5(handleCheckRowError(_0x2e3a('0x16'),_0x2e3a('0x21'),null,_0x4cd2d5));}if(_0x5bbbe7[_0x2e3a('0x22')]){var _0x208db=moment(_0x5bbbe7['birthDate'],_0x2e3a('0x23'));if(!_0x208db['isValid']()){return _0x5852a5(handleCheckRowError(_0x2e3a('0x16'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x4cd2d5));}}if(_0x5bbbe7['email']){if(!isEmail(_0x5bbbe7[_0x2e3a('0x24')])){return _0x5852a5(handleCheckRowError(_0x2e3a('0x16'),'email\x20format\x20is\x20not\x20valid!',null,_0x4cd2d5));}}_0x5bbbe7[_0x2e3a('0x25')]=LISTID;_0x5bbbe7[_0x2e3a('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x2e3a('0x1c')]&&_0x557528){var _0x456343={};for(var _0x53ed7f=0x0,_0x4ebf40=DUPLICATES[_0x2e3a('0x1c')];_0x53ed7f<_0x4ebf40;_0x53ed7f+=0x1){_0x456343[DUPLICATES[_0x53ed7f]]=_0x5bbbe7[DUPLICATES[_0x53ed7f]];}var _0x12c052=_[_0x2e3a('0x27')](_0x557528,_0x456343);if(_0x12c052){return _0x5852a5(handleCheckRowError(_0x2e3a('0x28'),_0x2e3a('0x29'),_0x12c052,_0x4cd2d5));}}return db[_0x2e3a('0x2a')]['create'](_0x5bbbe7,{'raw':!![],'hooks':![],'fields':_[_0x2e3a('0x2b')](_0x5bbbe7)})[_0x2e3a('0x2c')](function(_0x39f183){if(DUPLICATES&&DUPLICATES['length']&&_0x557528){_0x557528['push'](_[_0x2e3a('0x2d')](_0x5bbbe7,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x39f183['id'];return _0x364b0a();})[_0x2e3a('0x2e')](function(_0x260287){return _0x5852a5(handleCheckRowError(_0x2e3a('0x16'),_0x2e3a('0x2f')+(_0x260287['message']||JSON['stringify'](_0x260287)),null,_0x4cd2d5));});});}function checkHopper(){function _0x4a11fa(){return function(_0x5f44d2){logger[_0x2e3a('0x16')](_0x2e3a('0x30'),_0x2e3a('0x31'),util['inspect'](_0x5f44d2,{'showHidden':![],'depth':null}));};}var _0x52ff6e=function(_0x5012d5,_0x6ed0a0){var _0x2864b2=squel[_0x2e3a('0x32')]()[_0x2e3a('0x33')](_0x2e3a('0x34'))[_0x2e3a('0x35')]([_0x2e3a('0x36'),'scheduledAt',_0x2e3a('0x37'),'ListId',_0x6ed0a0,'createdAt',_0x2e3a('0x38')],squel[_0x2e3a('0x39')]()['field'](_0x2e3a('0x36'),_0x2e3a('0x36'))[_0x2e3a('0x3a')](_0x2e3a('0x3b'),'scheduledAt')[_0x2e3a('0x3a')]('id',_0x2e3a('0x37'))[_0x2e3a('0x3a')](LISTID['toString'](),'ListId')[_0x2e3a('0x3a')](_0x5012d5['id']['toString'](),_0x6ed0a0)[_0x2e3a('0x3a')](_0x2e3a('0x3b'),_0x2e3a('0x3c'))['field']('NOW()',_0x2e3a('0x38'))['from']('cm_contacts')[_0x2e3a('0x3d')](_0x2e3a('0x3e'))['where']('ListId\x20=\x20?',LISTID[_0x2e3a('0x3f')]())[_0x2e3a('0x3d')]('phone\x20IS\x20NOT\x20NULL')[_0x2e3a('0x3d')](_0x2e3a('0x40'),squel[_0x2e3a('0x39')]()[_0x2e3a('0x3a')]('phone')[_0x2e3a('0x41')](_0x2e3a('0x34'))[_0x2e3a('0x3d')](_0x6ed0a0+'\x20=\x20?',_0x5012d5['id']['toString']())))[_0x2e3a('0x3f')]();return _0x2864b2;};var _0x1638f8=function(_0x24db43,_0x39030b){var _0x11dd04=squel[_0x2e3a('0x32')]()[_0x2e3a('0x33')](_0x2e3a('0x34'))['fromQuery']([_0x2e3a('0x36'),_0x2e3a('0x42'),'ContactId',_0x2e3a('0x25'),_0x39030b,'createdAt',_0x2e3a('0x38')],squel[_0x2e3a('0x39')]()[_0x2e3a('0x3a')](_0x2e3a('0x36'),_0x2e3a('0x36'))[_0x2e3a('0x3a')](_0x2e3a('0x3b'),'scheduledAt')['field']('id','ContactId')[_0x2e3a('0x3a')](LISTID[_0x2e3a('0x3f')](),_0x2e3a('0x25'))[_0x2e3a('0x3a')](_0x24db43['id'][_0x2e3a('0x3f')](),_0x39030b)['field'](_0x2e3a('0x3b'),_0x2e3a('0x3c'))['field'](_0x2e3a('0x3b'),'updatedAt')['from'](_0x2e3a('0x43'))[_0x2e3a('0x3d')](_0x2e3a('0x3e'))['where'](_0x2e3a('0x44'),LISTID[_0x2e3a('0x3f')]())[_0x2e3a('0x3d')](_0x2e3a('0x45'),squel['str'](hopperContacts))['where'](_0x2e3a('0x46'))[_0x2e3a('0x3d')](_0x2e3a('0x40'),squel[_0x2e3a('0x39')]()[_0x2e3a('0x3a')]('calleridnum')[_0x2e3a('0x41')](_0x2e3a('0x47'))[_0x2e3a('0x3d')](_0x39030b+'\x20=\x20?',_0x24db43['id']['toString']()))[_0x2e3a('0x3d')](_0x2e3a('0x40'),squel['select']()[_0x2e3a('0x3a')](_0x2e3a('0x36'))['from'](_0x2e3a('0x34'))[_0x2e3a('0x3d')](_0x39030b+'\x20=\x20?',_0x24db43['id'][_0x2e3a('0x3f')]())))[_0x2e3a('0x3f')]();return _0x11dd04;};function _0x269645(_0x5ac19d,_0x350467){var _0x3203aa=squel[_0x2e3a('0x32')]()[_0x2e3a('0x33')](_0x2e3a('0x34'))[_0x2e3a('0x35')](['phone','scheduledAt','ContactId',_0x2e3a('0x25'),_0x350467,_0x2e3a('0x3c'),_0x2e3a('0x38')],squel[_0x2e3a('0x39')]()['field'](_0x2e3a('0x36'),_0x2e3a('0x36'))[_0x2e3a('0x3a')](_0x2e3a('0x3b'),'scheduledAt')[_0x2e3a('0x3a')]('id',_0x2e3a('0x37'))[_0x2e3a('0x3a')](LISTID[_0x2e3a('0x3f')](),_0x2e3a('0x25'))['field'](_0x5ac19d['id']['toString'](),_0x350467)[_0x2e3a('0x3a')](_0x2e3a('0x3b'),_0x2e3a('0x3c'))[_0x2e3a('0x3a')]('NOW()',_0x2e3a('0x38'))[_0x2e3a('0x41')](_0x2e3a('0x43'))['where'](_0x2e3a('0x3e'))[_0x2e3a('0x3d')](_0x2e3a('0x44'),LISTID['toString']())[_0x2e3a('0x3d')]('id\x20IN\x20?',squel[_0x2e3a('0x48')](hopperContacts))[_0x2e3a('0x3d')](_0x2e3a('0x46')))['toString']();return _0x3203aa;}function _0x27e3c6(_0x5079ef,_0x27c970){var _0x4a7897=squel[_0x2e3a('0x32')]()[_0x2e3a('0x33')](_0x2e3a('0x49'))[_0x2e3a('0x35')]([_0x2e3a('0x36'),_0x2e3a('0x37'),_0x2e3a('0x25'),_0x27c970,_0x2e3a('0x3c'),_0x2e3a('0x38')],squel[_0x2e3a('0x39')]()[_0x2e3a('0x3a')](_0x2e3a('0x36'),_0x2e3a('0x36'))[_0x2e3a('0x3a')]('id','ContactId')[_0x2e3a('0x3a')](LISTID[_0x2e3a('0x3f')](),'ListId')[_0x2e3a('0x3a')](_0x5079ef['id'][_0x2e3a('0x3f')](),_0x27c970)[_0x2e3a('0x3a')](_0x2e3a('0x3b'),_0x2e3a('0x3c'))[_0x2e3a('0x3a')](_0x2e3a('0x3b'),_0x2e3a('0x38'))[_0x2e3a('0x41')]('cm_contacts')[_0x2e3a('0x3d')](_0x2e3a('0x3e'))[_0x2e3a('0x3d')]('ListId\x20=\x20?',LISTID[_0x2e3a('0x3f')]())[_0x2e3a('0x3d')](_0x2e3a('0x45'),squel[_0x2e3a('0x48')](hopperContacts))[_0x2e3a('0x3d')](_0x2e3a('0x46')))[_0x2e3a('0x3f')]();return _0x4a7897;}return db[_0x2e3a('0x4a')][_0x2e3a('0x4b')]({'where':{'type':'outbound'},'attributes':['id',_0x2e3a('0x4c')],'include':[{'model':db['CmList'],'as':_0x2e3a('0x4d'),'where':{'id':LISTID}}]})[_0x2e3a('0x2c')](function(_0xe7f0f1){var _0x19a666=[];if(_0xe7f0f1){var _0x2f3be1;for(var _0x22c35d=0x0,_0x95e6f5;_0x22c35d<_0xe7f0f1[_0x2e3a('0x1c')];_0x22c35d+=0x1){_0x95e6f5=_0xe7f0f1[_0x22c35d]['get']({'plain':!![]});switch(_0x95e6f5['dialCheckDuplicateType']){case _0x2e3a('0x4e'):_0x19a666[_0x2e3a('0x4f')](db['sequelize']['query'](_0x1638f8(_0x95e6f5,'VoiceQueueId'))[_0x2e3a('0x2c')](function(){})[_0x2e3a('0x2e')](_0x4a11fa()));break;case _0x2e3a('0x50'):_0x19a666[_0x2e3a('0x4f')](db[_0x2e3a('0x51')][_0x2e3a('0x52')](_0x52ff6e(_0x95e6f5,'VoiceQueueId'))[_0x2e3a('0x2c')](function(){})['catch'](_0x4a11fa()));break;default:_0x19a666['push'](db[_0x2e3a('0x51')][_0x2e3a('0x52')](_0x269645(_0x95e6f5,_0x2e3a('0x53')))['then'](function(){})[_0x2e3a('0x2e')](_0x4a11fa()));}}}return _0x19a666;})[_0x2e3a('0x54')]()['then'](function(){return db[_0x2e3a('0x4a')][_0x2e3a('0x4b')]({'where':{'type':_0x2e3a('0x55')},'attributes':['id'],'include':[{'model':db[_0x2e3a('0x56')],'as':_0x2e3a('0x57'),'where':{'id':LISTID}}]})[_0x2e3a('0x2c')](function(_0x37de9e){var _0x1ca2d0=[];if(_0x37de9e){var _0x33467d;for(var _0x3570a6=0x0,_0x571a5b;_0x3570a6<_0x37de9e[_0x2e3a('0x1c')];_0x3570a6+=0x1){_0x571a5b=_0x37de9e[_0x3570a6][_0x2e3a('0x58')]({'plain':!![]});_0x1ca2d0['push'](db[_0x2e3a('0x51')][_0x2e3a('0x52')](_0x27e3c6(_0x571a5b,'VoiceQueueId'))[_0x2e3a('0x2c')](function(){})[_0x2e3a('0x2e')](_0x4a11fa()));}}return _0x1ca2d0;})[_0x2e3a('0x54')]();})['then'](function(){return db['Campaign'][_0x2e3a('0x4b')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x2e3a('0x56')],'as':_0x2e3a('0x4d'),'where':{'id':LISTID}}]})[_0x2e3a('0x2c')](function(_0x40eb1){var _0x5bce60=[];if(_0x40eb1){for(var _0x25b391=0x0,_0x49eef5;_0x25b391<_0x40eb1[_0x2e3a('0x1c')];_0x25b391+=0x1){_0x49eef5=_0x40eb1[_0x25b391]['get']({'plain':!![]});switch(_0x49eef5['dialCheckDuplicateType']){case _0x2e3a('0x4e'):_0x5bce60[_0x2e3a('0x4f')](db[_0x2e3a('0x51')]['query'](_0x1638f8(_0x49eef5,_0x2e3a('0x59')))[_0x2e3a('0x2c')](function(){})[_0x2e3a('0x2e')](_0x4a11fa()));break;case _0x2e3a('0x50'):_0x5bce60[_0x2e3a('0x4f')](db[_0x2e3a('0x51')][_0x2e3a('0x52')](_0x52ff6e(_0x49eef5,_0x2e3a('0x59')))['then'](function(){})['catch'](_0x4a11fa()));break;default:_0x5bce60['push'](db[_0x2e3a('0x51')][_0x2e3a('0x52')](_0x269645(_0x49eef5,'CampaignId'))[_0x2e3a('0x2c')](function(){})[_0x2e3a('0x2e')](_0x4a11fa()));}}}return _0x5bce60;})[_0x2e3a('0x54')]();})[_0x2e3a('0x2c')](function(){return db['Campaign'][_0x2e3a('0x4b')]({'attributes':['id'],'include':[{'model':db[_0x2e3a('0x56')],'as':_0x2e3a('0x57'),'where':{'id':LISTID}}]})[_0x2e3a('0x2c')](function(_0x2bfdbc){var _0x2b7ae4=[];if(_0x2bfdbc){for(var _0x261820=0x0,_0x256c9d;_0x261820<_0x2bfdbc[_0x2e3a('0x1c')];_0x261820+=0x1){_0x256c9d=_0x2bfdbc[_0x261820][_0x2e3a('0x58')]({'plain':!![]});_0x2b7ae4[_0x2e3a('0x4f')](db[_0x2e3a('0x51')]['query'](_0x27e3c6(_0x256c9d,_0x2e3a('0x59')))[_0x2e3a('0x2c')](function(){})[_0x2e3a('0x2e')](_0x4a11fa()));}}return _0x2b7ae4;})[_0x2e3a('0x54')]();})[_0x2e3a('0x2e')](function(_0x213628){logger['error'](_0x2e3a('0x5a'),_0x2e3a('0x5b'),_0x213628[_0x2e3a('0x1e')]);});}var processPromises=function(_0x447b88){return BPromise[_0x2e3a('0x54')](promises)[_0x2e3a('0x2c')](function(_0x466f52){})['catch'](function(_0xe1fb3f){logger['error'](_0x2e3a('0x5c'),JSON['stringify'](_0xe1fb3f));})['finally'](function(){socket[_0x2e3a('0x5d')](_0x2e3a('0x5e')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x447b88){return _0x447b88[_0x2e3a('0x5f')]();}});};var endCsv=function(){return BPromise[_0x2e3a('0x60')]()[_0x2e3a('0x2c')](function(){if(hopperContacts){return checkHopper();}})[_0x2e3a('0x2c')](function(){socket['emit'](_0x2e3a('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x2e3a('0x61')](FILEPATH);}catch(_0x2b14c8){logger[_0x2e3a('0x16')](_0x2e3a('0x62'),JSON[_0x2e3a('0x63')](_0x2b14c8));}finally{process[_0x2e3a('0x64')](0x0);}});};process['on'](_0x2e3a('0x65'),function(){logger['info'](_0x2e3a('0x66'));endCsv();});function main(){return BPromise['resolve']()[_0x2e3a('0x2c')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x2e3a('0x15')](',');return db[_0x2e3a('0x2a')][_0x2e3a('0x4b')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x2e3a('0x2c')](function(_0x246a81){var _0x3447d8=fs[_0x2e3a('0x67')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x2e3a('0x68')](_0x3447d8,{'header':!![],'skipEmptyLines':!![],'step':function(_0x564987,_0x2a491a){total+=0x1;var _0x4a3999=total;promises[_0x2e3a('0x4f')](checkRow(_0x564987,_0x246a81,_0x4a3999)[_0x2e3a('0x2c')](function(){success+=0x1;})['catch'](function(_0xfbabdb){if(_0xfbabdb[_0x2e3a('0x16')]){errors+=0x1;delete _0xfbabdb[_0x2e3a('0x16')];}else if(_0xfbabdb['duplicate']){duplicates+=0x1;delete _0xfbabdb['duplicate'];}rows['push'](_0xfbabdb);}));if(total%0xc8===0x0){_0x2a491a[_0x2e3a('0x69')]();return processPromises(_0x2a491a);}},'complete':function(){return processPromises()['then'](function(){logger[_0x2e3a('0x6a')](_0x2e3a('0x6b'));endCsv();});},'error':function(_0x4a2604,_0x287ec2){logger[_0x2e3a('0x6a')]('CSV\x20parse\x20error',JSON[_0x2e3a('0x63')](_0x4a2604));endCsv();}});})[_0x2e3a('0x2e')](function(_0x1c28a5){logger[_0x2e3a('0x16')](_0x2e3a('0x6c'),JSON[_0x2e3a('0x63')](_0x1c28a5));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 967bf71..d052c7f 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 _0x908e=['redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','scheduledat','ContactId','ListId','updatedAt','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_hopper_black','createdAt','ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','info','Received\x20SIGINT','error','exit','errors','push','code','message','sequelize','query','spread','catch','stringify','send','start','socket_timestamp','root','server/files/tmp','writeFileSync','createReadStream','data','length','rows','hasOwnProperty','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','includes','agent\x20not\x20exists','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','abort','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','format','isNil','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','campaigns_has_cm_lists','campaigns','campaigns_has_cm_blacklists','CampaignId','each','then','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','binding','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','uncaughtException','path','lodash','bluebird','moment','squel','ioredis','../../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x908e,0x182));var _0xe908=function(_0x1a0e40,_0x132da7){_0x1a0e40=_0x1a0e40-0x0;var _0x1bc002=_0x908e[_0x1a0e40];return _0x1bc002;};'use strict';var fs=require('fs');var path=require(_0xe908('0x0'));var _=require(_0xe908('0x1'));var Papa=require('papaparse');var util=require('util');var BPromise=require(_0xe908('0x2'));var moment=require(_0xe908('0x3'));var squel=require(_0xe908('0x4'));var Redis=require(_0xe908('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0xe908('0x6'));var logger=require('../../../config/logger')('import');config[_0xe908('0x7')]=_[_0xe908('0x8')](config[_0xe908('0x7')],{'host':_0xe908('0x9'),'port':0x18eb});var socket=require(_0xe908('0xa'))(new Redis(config[_0xe908('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format'](_0xe908('0xb'));function isEmail(_0x4794c5){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))*$/[_0xe908('0xc')](_0x4794c5);}function selectNotIn(_0x2992dd,_0x5b8202,_0x4c0846,_0x22c5cc,_0x78a40a){return squel[_0xe908('0xd')]()[_0xe908('0xe')](_0xe908('0xf'))[_0xe908('0x10')](_0x22c5cc)[_0xe908('0x11')](_0x5b8202,null,_0x5b8202+_0xe908('0x12')+_0x22c5cc+'.'+_0x4c0846)['where'](_0x22c5cc+'.'+_0x4c0846+'\x20=\x20'+_0x2992dd+'.'+_0x4c0846)[_0xe908('0x13')](_0x5b8202+'.dialCheckDuplicateType\x20IN\x20('+_0x78a40a[_0xe908('0x11')]()+')');}function insertCmHopper(_0xf24ff1,_0x21029a,_0x15358b,_0x14329e,_0x582894){var _0x214997=[_0xe908('0x14'),_0xe908('0x15'),_0xe908('0x16'),'cm_contacts.ListId',_0x21029a+'.'+_0x14329e,'cm_contacts.createdAt','cm_contacts.updatedAt',_0xe908('0x17'),_0xe908('0x18'),'\x22'+_0x582894+'\x22'];return squel[_0xe908('0x19')]()[_0xe908('0x1a')]('cm_hopper')[_0xe908('0x1b')]([_0xe908('0xf'),_0xe908('0x1c'),_0xe908('0x1d'),_0xe908('0x1e'),_0x14329e,'createdAt',_0xe908('0x1f'),'priority',_0xe908('0x20'),_0xe908('0x21')],squel[_0xe908('0xd')]()[_0xe908('0x22')](_0x214997)[_0xe908('0x10')](_0x21029a)[_0xe908('0x11')](_0xe908('0x23'),null,_0xe908('0x24')+_0x21029a+_0xe908('0x25'))[_0xe908('0x11')](_0x15358b,null,_0x15358b+_0xe908('0x12')+_0x21029a+'.'+_0x14329e)[_0xe908('0x13')](_0x21029a+_0xe908('0x26'),_0xf24ff1)[_0xe908('0x13')](_0xe908('0x27'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x21029a,_0x15358b,_0x14329e,_0xe908('0x28'),[_0xe908('0x29'),_0xe908('0x2a')]))['where'](_0xe908('0x2b'),selectNotIn(_0x21029a,_0x15358b,_0x14329e,_0xe908('0x28'),['\x22always\x22'])))[_0xe908('0x2c')]();}function insertCmHopperBlack(_0x347984,_0x23a325,_0x69f6c0,_0x296b02){var _0x53b512=[_0xe908('0x14'),_0xe908('0x16'),_0xe908('0x2d'),_0x23a325+'.'+_0x296b02,_0xe908('0x2e'),_0xe908('0x2f')];return squel['insert']()[_0xe908('0x1a')](_0xe908('0x30'))[_0xe908('0x1b')]([_0xe908('0xf'),_0xe908('0x1d'),_0xe908('0x1e'),_0x296b02,_0xe908('0x31'),_0xe908('0x1f')],squel['select']()[_0xe908('0x22')](_0x53b512)[_0xe908('0x10')](_0x23a325)[_0xe908('0x11')](_0xe908('0x23'),null,_0xe908('0x24')+_0x23a325+_0xe908('0x25'))[_0xe908('0x11')](_0x69f6c0,null,_0x69f6c0+_0xe908('0x12')+_0x23a325+'.'+_0x296b02)[_0xe908('0x13')](_0x23a325+'.CmListId\x20=\x20?',_0x347984)[_0xe908('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xe908('0x13')](_0xe908('0x2b'),squel['select']()[_0xe908('0xe')]('phone')['from'](_0xe908('0x30'))[_0xe908('0x13')](_0xe908('0x32'),_0x347984)[_0xe908('0x13')](_0x296b02+'\x20=\x20?',_0x23a325+'.'+_0x296b02)))[_0xe908('0x2c')]();}function insertCmContact(_0x4c468d,_0x43904f,_0x484529,_0x12e2e5){var _0x495a99=_[_0xe908('0x33')](_[_0xe908('0x34')](_0x12e2e5),[_0xe908('0x1e'),_0xe908('0x35'),_0xe908('0x31'),_0xe908('0x1f')]);return squel[_0xe908('0x19')]()[_0xe908('0x1a')]('cm_contacts')[_0xe908('0x1b')](_0x495a99,squel[_0xe908('0xd')]()[_0xe908('0x22')](_0x495a99)[_0xe908('0x10')](_0x43904f)[_0xe908('0x13')]('('+_0x484529[_0xe908('0x11')](',')+_0xe908('0x36'),squel[_0xe908('0xd')]()[_0xe908('0x22')](_0x484529)[_0xe908('0x10')](_0xe908('0x23'))[_0xe908('0x13')]('ListId\x20=\x20?',_0x4c468d)[_0xe908('0x13')]('deletedAt\x20IS\x20NULL'))[_0xe908('0x13')](_0xe908('0x37'),squel[_0xe908('0xd')]()[_0xe908('0xe')](_0xe908('0x38'),'min_id')[_0xe908('0x10')](_0x43904f)['group'](_0x484529[_0xe908('0x11')](','))))['toString']();}function handleStop(){logger[_0xe908('0x39')](_0xe908('0x3a'));stopped=!![];}function handleUncaughtException(_0x2633c1){logger[_0xe908('0x3b')](_0x2633c1['message']);process[_0xe908('0x3c')](0x1);}function handleError(_0x2087b5,_0x5be68b){stats[_0xe908('0x3d')][_0xe908('0x3e')]({'name':_0x5be68b[_0xe908('0x3f')],'message':_0x5be68b[_0xe908('0x40')],'row':_0x2087b5});}function handleQuery(_0x484cd4){logger[_0xe908('0x39')](_0x484cd4);return db[_0xe908('0x41')][_0xe908('0x42')](_0x484cd4)[_0xe908('0x43')](function(_0x4821bb){results[_0xe908('0x3e')](_0x4821bb);})[_0xe908('0x44')](function(_0x44410a){logger[_0xe908('0x3b')](_0x44410a[_0xe908('0x40')]);});}function main(_0x12d33e,_0xa4d148,_0x28b853,_0x5a818a){logger[_0xe908('0x39')]('main',_0x12d33e,JSON[_0xe908('0x45')](_0xa4d148));process[_0xe908('0x46')](_0xe908('0x47'));var _0xe33f33=_0xa4d148['binding'];var _0x3fb04b=_0xa4d148[_0xe908('0x48')];var _0x2ab5bc=path[_0xe908('0x11')](config[_0xe908('0x49')],_0xe908('0x4a'),_0x3fb04b+'.csv');var _0x14afb9=_[_0xe908('0x34')](_0xe33f33)['join']();logger[_0xe908('0x39')]('header',_0x14afb9);fs[_0xe908('0x4b')](_0x2ab5bc,_0x14afb9+'\x0a');Papa['parse'](fs[_0xe908('0x4c')](_0x12d33e),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5eda3a,_0x4f0d92){try{for(var _0x4abe38=0x0,_0x1c4e32=[];_0x4abe38<_0x5eda3a[_0xe908('0x4d')][_0xe908('0x4e')];_0x4abe38++){stats[_0xe908('0x4f')]+=0x1;if(_0x5eda3a['errors'][_0x4abe38]){handleError(_0x5eda3a[_0xe908('0x4d')][_0x4abe38],_0x5eda3a[_0xe908('0x3d')][_0x4abe38]);}else{var _0xf939d6=[];for(var _0x481a7f in _0xe33f33){if(_0xe33f33[_0xe908('0x50')](_0x481a7f)){if(_0x5eda3a['data'][_0x4abe38][_0xe33f33[_0x481a7f]]){var _0xcea8e7=_['trim'](_0x5eda3a[_0xe908('0x4d')][_0x4abe38][_0xe33f33[_0x481a7f]][_0xe908('0x51')](/"/g,'\x27'));switch(_0x481a7f){case'scheduledat':var _0x40b944=moment(_0xcea8e7,_0xe908('0xb'),!![]);if(_0x40b944[_0xe908('0x52')]()){_0x1c4e32[_0xe908('0x3e')]('\x22'+_0xcea8e7+'\x22');}else{_0xf939d6['push'](_0xe908('0x53'));}break;case _0xe908('0x54'):var _0x3cae36=parseInt(_0xcea8e7);_0xcea8e7=_[_0xe908('0x55')](_0x3cae36)||_0x3cae36<0x0||_0x3cae36>0x4?_0x5a818a?0x3:0x2:_0x3cae36;_0x1c4e32[_0xe908('0x3e')]('\x22'+_0xcea8e7+'\x22');break;case'UserId':var _0x7b80a2=parseInt(_0xcea8e7);if(_[_0xe908('0x56')](_0x7b80a2)&&_[_0xe908('0x57')](_0x28b853,_0x7b80a2)){_0x1c4e32['push']('\x22'+_0x7b80a2+'\x22');}else{_0xf939d6[_0xe908('0x3e')](_0xe908('0x58'));}break;case'email':if(isEmail(_0xcea8e7)){_0x1c4e32[_0xe908('0x3e')]('\x22'+_0xcea8e7+'\x22');}else{_0xf939d6[_0xe908('0x3e')](_0xe908('0x59'));}break;case'dateOfBirth':var _0x568794=moment(_0xcea8e7,_0xe908('0x5a'),!![]);if(_0x568794['isValid']()){_0x1c4e32['push']('\x22'+_0xcea8e7+'\x22');}else{_0xf939d6[_0xe908('0x3e')](_0xe908('0x5b'));}break;default:_0x1c4e32['push']('\x22'+_0xcea8e7+'\x22');}}else{switch(_0x481a7f){case _0xe908('0x5c'):case _0xe908('0xf'):_0xf939d6[_0xe908('0x3e')](_0x481a7f+_0xe908('0x5d'));break;default:_0x1c4e32[_0xe908('0x3e')]('\x22\x22');}}}}if(_0xf939d6[_0xe908('0x4e')]){handleError(_0x5eda3a[_0xe908('0x4d')][_0x4abe38],{'code':_0xe908('0x5e'),'message':_0xf939d6[_0xe908('0x11')]()});}else{fs[_0xe908('0x5f')](_0x2ab5bc,_0x1c4e32[_0xe908('0x11')]()+'\x0a');}_0x1c4e32=[];}if(!(stats['rows']%0xc8)){socket[_0xe908('0x60')](_0xe908('0x61')+_0x3fb04b,stats);stats[_0xe908('0x3d')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0x4f0d92[_0xe908('0x62')]();}}catch(_0x38075b){handleError(_0x5eda3a[_0xe908('0x4d')][_0x4abe38],{'code':'SystemError','message':_0x38075b[_0xe908('0x40')]});logger[_0xe908('0x3b')]('step',_0x38075b['message']);}},'complete':function(){try{var _0xdd0305=[];var _0x2993b8=_0xe908('0x23');if(_0xa4d148['duplicates']&&_0xa4d148[_0xe908('0x63')][_0xe908('0x4e')]){_0x2993b8=_0xe908('0x64')+_0x3fb04b;_0xdd0305[_0xe908('0x3e')](_0xe908('0x65')+_0x2993b8+_0xe908('0x66'));}var _0x40e0a1=util[_0xe908('0x67')]('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',_0x2ab5bc,_0x2993b8,_0x14afb9,_0xa4d148[_0xe908('0x1e')],_0xa4d148[_0xe908('0x35')]||null,NOW,NOW);if(_[_0xe908('0x68')](_0xe33f33[_0xe908('0x1c')])){_0x40e0a1+=',\x20scheduledAt\x20=\x20NOW()';}_0xdd0305['push'](_0x40e0a1);if(_0xa4d148[_0xe908('0x63')]&&_0xa4d148[_0xe908('0x63')][_0xe908('0x4e')]){_0xdd0305[_0xe908('0x3e')](insertCmContact(_0xa4d148[_0xe908('0x1e')],_0x2993b8,_0xa4d148[_0xe908('0x63')],_0xe33f33));_0xdd0305['push'](_0xe908('0x69')+_0x2993b8+';');}_0xdd0305[_0xe908('0x3e')](insertCmHopper(_0xa4d148[_0xe908('0x1e')],_0xe908('0x6a'),_0xe908('0x6b'),_0xe908('0x6c'),_0x5a818a));_0xdd0305['push'](insertCmHopperBlack(_0xa4d148[_0xe908('0x1e')],'voice_queues_has_cm_blacklists',_0xe908('0x6b'),_0xe908('0x6c')));_0xdd0305[_0xe908('0x3e')](insertCmHopper(_0xa4d148['ListId'],_0xe908('0x6d'),_0xe908('0x6e'),'CampaignId',_0x5a818a));_0xdd0305['push'](insertCmHopperBlack(_0xa4d148[_0xe908('0x1e')],_0xe908('0x6f'),_0xe908('0x6e'),_0xe908('0x70')));BPromise[_0xe908('0x71')](_0xdd0305,handleQuery)[_0xe908('0x72')](function(_0x3c90e7){stats[_0xe908('0x73')]=!![];stats[_0xe908('0x74')]=_0xa4d148['duplicates']&&_0xa4d148['duplicates'][_0xe908('0x4e')]?results[0x2][_0xe908('0x74')]:results[0x0][_0xe908('0x74')];socket[_0xe908('0x60')](_0xe908('0x61')+_0x3fb04b,stats);fs[_0xe908('0x75')](_0x12d33e);fs[_0xe908('0x75')](_0x2ab5bc);process[_0xe908('0x3c')](0x0);})['catch'](function(_0x53325d){logger[_0xe908('0x3b')](_0x53325d[_0xe908('0x40')]);process['exit'](0x1);});}catch(_0xc4ea3c){logger[_0xe908('0x3b')](_0xe908('0x76'),_0xc4ea3c[_0xe908('0x40')]);process[_0xe908('0x3c')](0x1);}},'error':function(_0x521f81,_0x1f8eb5,_0x1f09e0,_0x3a77e1){throw new Error(_0x3a77e1);}});}function validate(){if(process['argv']&&process[_0xe908('0x77')]['length']<0x4){throw new Error(_0xe908('0x78'));}var _0x24fb46=path[_0xe908('0x11')](config['root'],_0xe908('0x4a'),process[_0xe908('0x77')][0x2]);if(!fs[_0xe908('0x79')](_0x24fb46)){throw new Error(_0xe908('0x7a'));}var _0x4c864a={};try{_0x4c864a=JSON['parse'](process[_0xe908('0x77')][0x3]);if(!_0x4c864a['binding']){throw new Error(_0xe908('0x7b'));}if(!_0x4c864a[_0xe908('0x7c')]['phone']){throw new Error(_0xe908('0x7d'));}if(!_0x4c864a[_0xe908('0x7c')][_0xe908('0x5c')]){throw new Error(_0xe908('0x7e'));}var _0x164a4b=0x0;if(_0x4c864a[_0xe908('0x7c')][_0xe908('0x20')]){_0x164a4b=0x1;}if(!_0x4c864a[_0xe908('0x1e')]){throw new Error(_0xe908('0x7f'));}}catch(_0x16f698){throw new Error(_0xe908('0x80'));}var _0x4eca23=[];try{_0x4eca23=_['map'](JSON['parse'](process['argv'][0x4]),'id');}catch(_0x4a5df7){logger[_0xe908('0x39')](_0xe908('0x81'));}main(_0x24fb46,_0x4c864a,_0x4eca23,_0x164a4b);}validate();process['on']('SIGINT',handleStop);process['on'](_0xe908('0x82'),handleUncaughtException); \ No newline at end of file +var _0xcacb=['argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','util','moment','squel','ioredis','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','updatedAt','priority','UserId','recallme','fields','cm_contacts','.CmListId\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','toString','into','cm_hopper_black','fromQuery','ContactId','ListId','createdAt','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.phone\x20NOT\x20IN\x20(?)','field','ListId\x20=\x20?','\x20=\x20?','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','error','message','exit','errors','push','code','sequelize','catch','main','send','start','binding','socket_timestamp','server/files/tmp','.csv','header','writeFileSync','parse','createReadStream','data','length','rows','hasOwnProperty','replace','scheduledat','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_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','CompanyId','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','campaigns_has_cm_blacklists','CampaignId','then','affectedRows','unlink','complete'];(function(_0x14990e,_0xb6b0cc){var _0xa67b6d=function(_0x34671e){while(--_0x34671e){_0x14990e['push'](_0x14990e['shift']());}};_0xa67b6d(++_0xb6b0cc);}(_0xcacb,0x118));var _0xbcac=function(_0x1245c1,_0x4d0f6e){_0x1245c1=_0x1245c1-0x0;var _0x140053=_0xcacb[_0x1245c1];return _0x140053;};'use strict';var fs=require('fs');var path=require(_0xbcac('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require(_0xbcac('0x1'));var BPromise=require('bluebird');var moment=require(_0xbcac('0x2'));var squel=require(_0xbcac('0x3'));var Redis=require(_0xbcac('0x4'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0xbcac('0x5'))(_0xbcac('0x6'));config[_0xbcac('0x7')]=_[_0xbcac('0x8')](config[_0xbcac('0x7')],{'host':_0xbcac('0x9'),'port':0x18eb});var socket=require(_0xbcac('0xa'))(new Redis(config[_0xbcac('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format'](_0xbcac('0xb'));function isEmail(_0x157dd5){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))*$/[_0xbcac('0xc')](_0x157dd5);}function selectNotIn(_0x19d951,_0x2517bd,_0x2be3a9,_0x13e687,_0x2a5372){return squel[_0xbcac('0xd')]()['field'](_0xbcac('0xe'))[_0xbcac('0xf')](_0x13e687)['join'](_0x2517bd,null,_0x2517bd+_0xbcac('0x10')+_0x13e687+'.'+_0x2be3a9)[_0xbcac('0x11')](_0x13e687+'.'+_0x2be3a9+_0xbcac('0x12')+_0x19d951+'.'+_0x2be3a9)[_0xbcac('0x11')](_0x2517bd+_0xbcac('0x13')+_0x2a5372[_0xbcac('0x14')]()+')');}function insertCmHopper(_0x35d544,_0x29e05f,_0x4b63b4,_0x29cd71,_0xe16685){var _0x1faad7=[_0xbcac('0x15'),_0xbcac('0x16'),_0xbcac('0x17'),_0xbcac('0x18'),_0x29e05f+'.'+_0x29cd71,_0xbcac('0x19'),_0xbcac('0x1a'),_0xbcac('0x1b'),_0xbcac('0x1c'),'\x22'+_0xe16685+'\x22'];return squel[_0xbcac('0x1d')]()['into'](_0xbcac('0x1e'))['fromQuery']([_0xbcac('0xe'),'scheduledat','ContactId','ListId',_0x29cd71,'createdAt',_0xbcac('0x1f'),_0xbcac('0x20'),_0xbcac('0x21'),_0xbcac('0x22')],squel['select']()[_0xbcac('0x23')](_0x1faad7)[_0xbcac('0xf')](_0x29e05f)['join'](_0xbcac('0x24'),null,'cm_contacts.ListId\x20=\x20'+_0x29e05f+'.CmListId')['join'](_0x4b63b4,null,_0x4b63b4+_0xbcac('0x10')+_0x29e05f+'.'+_0x29cd71)[_0xbcac('0x11')](_0x29e05f+_0xbcac('0x25'),_0x35d544)[_0xbcac('0x11')]('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x29e05f,_0x4b63b4,_0x29cd71,_0xbcac('0x1e'),[_0xbcac('0x26'),_0xbcac('0x27')]))[_0xbcac('0x11')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x29e05f,_0x4b63b4,_0x29cd71,_0xbcac('0x1e'),['\x22always\x22'])))[_0xbcac('0x28')]();}function insertCmHopperBlack(_0xaa06d9,_0x41e002,_0xa1cb41,_0x272d79){var _0x423ba3=['cm_contacts.phone',_0xbcac('0x17'),_0xbcac('0x18'),_0x41e002+'.'+_0x272d79,_0xbcac('0x19'),_0xbcac('0x1a')];return squel[_0xbcac('0x1d')]()[_0xbcac('0x29')](_0xbcac('0x2a'))[_0xbcac('0x2b')]([_0xbcac('0xe'),_0xbcac('0x2c'),_0xbcac('0x2d'),_0x272d79,_0xbcac('0x2e'),_0xbcac('0x1f')],squel['select']()[_0xbcac('0x23')](_0x423ba3)[_0xbcac('0xf')](_0x41e002)[_0xbcac('0x14')](_0xbcac('0x24'),null,_0xbcac('0x2f')+_0x41e002+_0xbcac('0x30'))[_0xbcac('0x14')](_0xa1cb41,null,_0xa1cb41+'.id\x20=\x20'+_0x41e002+'.'+_0x272d79)['where'](_0x41e002+_0xbcac('0x25'),_0xaa06d9)[_0xbcac('0x11')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xbcac('0x11')](_0xbcac('0x31'),squel[_0xbcac('0xd')]()[_0xbcac('0x32')]('phone')['from'](_0xbcac('0x2a'))[_0xbcac('0x11')](_0xbcac('0x33'),_0xaa06d9)[_0xbcac('0x11')](_0x272d79+_0xbcac('0x34'),_0x41e002+'.'+_0x272d79)))[_0xbcac('0x28')]();}function insertCmContact(_0x59ab93,_0x11ff07,_0x491a45,_0x15d2f2){var _0x104898=_['concat'](_[_0xbcac('0x35')](_0x15d2f2),['ListId','CompanyId','createdAt','updatedAt']);return squel['insert']()[_0xbcac('0x29')](_0xbcac('0x24'))['fromQuery'](_0x104898,squel[_0xbcac('0xd')]()[_0xbcac('0x23')](_0x104898)[_0xbcac('0xf')](_0x11ff07)['where']('('+_0x491a45[_0xbcac('0x14')](',')+_0xbcac('0x36'),squel[_0xbcac('0xd')]()[_0xbcac('0x23')](_0x491a45)[_0xbcac('0xf')](_0xbcac('0x24'))[_0xbcac('0x11')](_0xbcac('0x33'),_0x59ab93)[_0xbcac('0x11')](_0xbcac('0x37')))['where'](_0xbcac('0x38'),squel[_0xbcac('0xd')]()['field'](_0xbcac('0x39'),_0xbcac('0x3a'))[_0xbcac('0xf')](_0x11ff07)[_0xbcac('0x3b')](_0x491a45[_0xbcac('0x14')](','))))[_0xbcac('0x28')]();}function handleStop(){logger[_0xbcac('0x3c')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x519524){logger[_0xbcac('0x3d')](_0x519524[_0xbcac('0x3e')]);process[_0xbcac('0x3f')](0x1);}function handleError(_0x41ce21,_0x184368){stats[_0xbcac('0x40')][_0xbcac('0x41')]({'name':_0x184368[_0xbcac('0x42')],'message':_0x184368[_0xbcac('0x3e')],'row':_0x41ce21});}function handleQuery(_0x1d3db8){logger[_0xbcac('0x3c')](_0x1d3db8);return db[_0xbcac('0x43')]['query'](_0x1d3db8)['spread'](function(_0x1ee049){results['push'](_0x1ee049);})[_0xbcac('0x44')](function(_0x3886e5){logger['error'](_0x3886e5[_0xbcac('0x3e')]);});}function main(_0x46d119,_0x184187,_0x5ba568,_0x3a403f){logger['info'](_0xbcac('0x45'),_0x46d119,JSON['stringify'](_0x184187));process[_0xbcac('0x46')](_0xbcac('0x47'));var _0x81e8bc=_0x184187[_0xbcac('0x48')];var _0x4d5f88=_0x184187[_0xbcac('0x49')];var _0x510ce0=path[_0xbcac('0x14')](config['root'],_0xbcac('0x4a'),_0x4d5f88+_0xbcac('0x4b'));var _0xfb14eb=_[_0xbcac('0x35')](_0x81e8bc)[_0xbcac('0x14')]();logger['info'](_0xbcac('0x4c'),_0xfb14eb);fs[_0xbcac('0x4d')](_0x510ce0,_0xfb14eb+'\x0a');Papa[_0xbcac('0x4e')](fs[_0xbcac('0x4f')](_0x46d119),{'header':!![],'skipEmptyLines':!![],'step':function(_0x18c64d,_0x1acae2){try{for(var _0x4173f6=0x0,_0x300333=[];_0x4173f6<_0x18c64d[_0xbcac('0x50')][_0xbcac('0x51')];_0x4173f6++){stats[_0xbcac('0x52')]+=0x1;if(_0x18c64d['errors'][_0x4173f6]){handleError(_0x18c64d['data'][_0x4173f6],_0x18c64d['errors'][_0x4173f6]);}else{var _0xdfc640=[];for(var _0xcdc605 in _0x81e8bc){if(_0x81e8bc[_0xbcac('0x53')](_0xcdc605)){if(_0x18c64d[_0xbcac('0x50')][_0x4173f6][_0x81e8bc[_0xcdc605]]){var _0x5694df=_['trim'](_0x18c64d[_0xbcac('0x50')][_0x4173f6][_0x81e8bc[_0xcdc605]][_0xbcac('0x54')](/"/g,'\x27'));switch(_0xcdc605){case _0xbcac('0x55'):var _0xf561da=moment(_0x5694df,_0xbcac('0xb'),!![]);if(_0xf561da['isValid']()){_0x300333['push']('\x22'+_0x5694df+'\x22');}else{_0xdfc640[_0xbcac('0x41')](_0xbcac('0x56'));}break;case _0xbcac('0x20'):var _0x86208a=parseInt(_0x5694df);_0x5694df=_[_0xbcac('0x57')](_0x86208a)||_0x86208a<0x0||_0x86208a>0x4?_0x3a403f?0x3:0x2:_0x86208a;_0x300333[_0xbcac('0x41')]('\x22'+_0x5694df+'\x22');break;case _0xbcac('0x21'):var _0x21335b=parseInt(_0x5694df);if(_[_0xbcac('0x58')](_0x21335b)&&_['includes'](_0x5ba568,_0x21335b)){_0x300333[_0xbcac('0x41')]('\x22'+_0x21335b+'\x22');}else{_0xdfc640[_0xbcac('0x41')](_0xbcac('0x59'));}break;case _0xbcac('0x5a'):if(isEmail(_0x5694df)){_0x300333[_0xbcac('0x41')]('\x22'+_0x5694df+'\x22');}else{_0xdfc640[_0xbcac('0x41')](_0xbcac('0x5b'));}break;case _0xbcac('0x5c'):var _0x3f7915=moment(_0x5694df,'YYYY-MM-DD',!![]);if(_0x3f7915[_0xbcac('0x5d')]()){_0x300333['push']('\x22'+_0x5694df+'\x22');}else{_0xdfc640[_0xbcac('0x41')](_0xbcac('0x5e'));}break;default:_0x300333[_0xbcac('0x41')]('\x22'+_0x5694df+'\x22');}}else{switch(_0xcdc605){case _0xbcac('0x5f'):case _0xbcac('0xe'):_0xdfc640[_0xbcac('0x41')](_0xcdc605+'\x20not\x20specified');break;default:_0x300333['push']('\x22\x22');}}}}if(_0xdfc640['length']){handleError(_0x18c64d[_0xbcac('0x50')][_0x4173f6],{'code':_0xbcac('0x60'),'message':_0xdfc640['join']()});}else{fs[_0xbcac('0x61')](_0x510ce0,_0x300333[_0xbcac('0x14')]()+'\x0a');}_0x300333=[];}if(!(stats[_0xbcac('0x52')]%0xc8)){socket[_0xbcac('0x62')](_0xbcac('0x63')+_0x4d5f88,stats);stats[_0xbcac('0x40')]=[];}}if(stopped){logger[_0xbcac('0x3c')](_0xbcac('0x64'));_0x1acae2[_0xbcac('0x65')]();}}catch(_0x167edb){handleError(_0x18c64d[_0xbcac('0x50')][_0x4173f6],{'code':'SystemError','message':_0x167edb[_0xbcac('0x3e')]});logger['error']('step',_0x167edb['message']);}},'complete':function(){try{var _0xf73aca=[];var _0x1290d6=_0xbcac('0x24');if(_0x184187['duplicates']&&_0x184187[_0xbcac('0x66')]['length']){_0x1290d6='cm_contacts_'+_0x4d5f88;_0xf73aca[_0xbcac('0x41')](_0xbcac('0x67')+_0x1290d6+_0xbcac('0x68'));}var _0x2e917c=util[_0xbcac('0x69')](_0xbcac('0x6a'),_0x510ce0,_0x1290d6,_0xfb14eb,_0x184187[_0xbcac('0x2d')],_0x184187[_0xbcac('0x6b')]||null,NOW,NOW);if(_[_0xbcac('0x6c')](_0x81e8bc['scheduledat'])){_0x2e917c+=_0xbcac('0x6d');}_0xf73aca[_0xbcac('0x41')](_0x2e917c);if(_0x184187[_0xbcac('0x66')]&&_0x184187[_0xbcac('0x66')]['length']){_0xf73aca[_0xbcac('0x41')](insertCmContact(_0x184187['ListId'],_0x1290d6,_0x184187[_0xbcac('0x66')],_0x81e8bc));_0xf73aca[_0xbcac('0x41')](_0xbcac('0x6e')+_0x1290d6+';');}_0xf73aca[_0xbcac('0x41')](insertCmHopper(_0x184187[_0xbcac('0x2d')],'voice_queues_has_cm_lists',_0xbcac('0x6f'),_0xbcac('0x70'),_0x3a403f));_0xf73aca[_0xbcac('0x41')](insertCmHopperBlack(_0x184187[_0xbcac('0x2d')],_0xbcac('0x71'),_0xbcac('0x6f'),'VoiceQueueId'));_0xf73aca[_0xbcac('0x41')](insertCmHopper(_0x184187[_0xbcac('0x2d')],_0xbcac('0x72'),_0xbcac('0x73'),'CampaignId',_0x3a403f));_0xf73aca['push'](insertCmHopperBlack(_0x184187[_0xbcac('0x2d')],_0xbcac('0x74'),_0xbcac('0x73'),_0xbcac('0x75')));BPromise['each'](_0xf73aca,handleQuery)[_0xbcac('0x76')](function(_0x5a91cb){stats['finish']=!![];stats[_0xbcac('0x77')]=_0x184187[_0xbcac('0x66')]&&_0x184187[_0xbcac('0x66')]['length']?results[0x2][_0xbcac('0x77')]:results[0x0][_0xbcac('0x77')];socket[_0xbcac('0x62')]('contact:import:'+_0x4d5f88,stats);fs[_0xbcac('0x78')](_0x46d119);fs[_0xbcac('0x78')](_0x510ce0);process[_0xbcac('0x3f')](0x0);})[_0xbcac('0x44')](function(_0x2dce0a){logger[_0xbcac('0x3d')](_0x2dce0a[_0xbcac('0x3e')]);process['exit'](0x1);});}catch(_0x10c71d){logger[_0xbcac('0x3d')](_0xbcac('0x79'),_0x10c71d[_0xbcac('0x3e')]);process['exit'](0x1);}},'error':function(_0x520ca1,_0x378966,_0xc49885,_0x27130e){throw new Error(_0x27130e);}});}function validate(){if(process['argv']&&process[_0xbcac('0x7a')][_0xbcac('0x51')]<0x4){throw new Error(_0xbcac('0x7b'));}var _0x171db1=path['join'](config[_0xbcac('0x7c')],_0xbcac('0x4a'),process[_0xbcac('0x7a')][0x2]);if(!fs[_0xbcac('0x7d')](_0x171db1)){throw new Error(_0xbcac('0x7e'));}var _0x442a03={};try{_0x442a03=JSON[_0xbcac('0x4e')](process['argv'][0x3]);if(!_0x442a03['binding']){throw new Error(_0xbcac('0x7f'));}if(!_0x442a03[_0xbcac('0x48')][_0xbcac('0xe')]){throw new Error(_0xbcac('0x80'));}if(!_0x442a03['binding']['firstName']){throw new Error(_0xbcac('0x81'));}var _0x2f9287=0x0;if(_0x442a03[_0xbcac('0x48')]['UserId']){_0x2f9287=0x1;}if(!_0x442a03[_0xbcac('0x2d')]){throw new Error(_0xbcac('0x82'));}}catch(_0x30deff){throw new Error('body\x20id\x20mandatory');}var _0x386097=[];try{_0x386097=_[_0xbcac('0x83')](JSON[_0xbcac('0x4e')](process[_0xbcac('0x7a')][0x4]),'id');}catch(_0x1cbce0){logger[_0xbcac('0x3c')](_0xbcac('0x84'));}main(_0x171db1,_0x442a03,_0x386097,_0x2f9287);}validate();process['on']('SIGINT',handleStop);process['on'](_0xbcac('0x85'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 165897a..9f0c3e1 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 _0xe407=['Agent\x20Connect','agentconnectAt','Agent\x20Complete','Hold\x20Time','holdtime','Talk\x20Time','Called\x20Number','Member\x20Name','membername','Date','Answer\x20Time','answertime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','[xCALLY\x20Ticket]','toLowerCase','inbound','push','variable','calleridnum','outbound','string','Outbound\x20Call','destcalleridnum','***\x20Call\x20Info\x20***','Caller\x20Number','keyValue','Caller\x20Name','Call\x20To','Queue','queue','UniqueId','uniqueid','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcalledAt'];(function(_0xf3f58c,_0x38b821){var _0x53d7b6=function(_0x51b981){while(--_0x51b981){_0xf3f58c['push'](_0xf3f58c['shift']());}};_0x53d7b6(++_0x38b821);}(_0xe407,0x160));var _0x7e40=function(_0x51ac4b,_0x18e00a){_0x51ac4b=_0x51ac4b-0x0;var _0x387be7=_0xe407[_0x51ac4b];return _0x387be7;};'use strict';exports[_0x7e40('0x0')]=function(_0x3714ae,_0x5d6a34){var _0x4b2958=[{'type':'string','content':_0x7e40('0x1'),'variableName':null}];switch(_0x3714ae[_0x7e40('0x2')]()){case'voice':switch(_0x5d6a34['toLowerCase']()){case _0x7e40('0x3'):_0x4b2958[_0x7e40('0x4')]({'type':_0x7e40('0x5'),'content':'','variableName':'queue'});_0x4b2958['push']({'type':_0x7e40('0x5'),'content':'','variableName':_0x7e40('0x6')});break;case _0x7e40('0x7'):_0x4b2958['push']({'type':_0x7e40('0x8'),'content':_0x7e40('0x9'),'variableName':null});_0x4b2958[_0x7e40('0x4')]({'type':_0x7e40('0x5'),'content':'','variableName':_0x7e40('0xa')});break;}}return _0x4b2958;};exports['getDescriptions']=function(_0x34868a,_0xd12fc0){var _0x5374f0=[];switch(_0x34868a[_0x7e40('0x2')]()){case'voice':switch(_0xd12fc0['toLowerCase']()){case _0x7e40('0x3'):_0x5374f0=[{'type':'string','content':_0x7e40('0xb'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x7e40('0xc'),'keyType':'variable','variableName':_0x7e40('0x6')},{'type':_0x7e40('0xd'),'content':'','key':_0x7e40('0xe'),'keyType':_0x7e40('0x5'),'variableName':'calleridname'},{'type':_0x7e40('0xd'),'content':'','key':_0x7e40('0xf'),'keyType':_0x7e40('0x5'),'variableName':'destexten'},{'type':'keyValue','content':'','key':_0x7e40('0x10'),'keyType':_0x7e40('0x5'),'variableName':_0x7e40('0x11')},{'type':'keyValue','content':'','key':_0x7e40('0x12'),'keyType':_0x7e40('0x5'),'variableName':_0x7e40('0x13')},{'type':'keyValue','content':'','key':'Date','keyType':_0x7e40('0x5'),'variableName':'agentcalledAt'},{'type':_0x7e40('0x8'),'content':_0x7e40('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0x7e40('0xd'),'content':'','key':_0x7e40('0x15'),'keyType':_0x7e40('0x5'),'variableName':_0x7e40('0x16')},{'type':_0x7e40('0xd'),'content':'','key':'Agent\x20Number','keyType':_0x7e40('0x5'),'variableName':_0x7e40('0xa')},{'type':_0x7e40('0x8'),'content':_0x7e40('0x17'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x7e40('0x18'),'keyType':_0x7e40('0x5'),'variableName':_0x7e40('0x19')},{'type':'keyValue','content':'','key':_0x7e40('0x1a'),'keyType':_0x7e40('0x5'),'variableName':_0x7e40('0x1b')},{'type':'keyValue','content':'','key':_0x7e40('0x1c'),'keyType':_0x7e40('0x5'),'variableName':'agentcompleteAt'},{'type':_0x7e40('0xd'),'content':'','key':_0x7e40('0x1d'),'keyType':'variable','variableName':_0x7e40('0x1e')},{'type':_0x7e40('0xd'),'content':'','key':_0x7e40('0x1f'),'keyType':'variable','variableName':'talktime'}];break;case _0x7e40('0x7'):_0x5374f0=[{'type':_0x7e40('0x8'),'content':_0x7e40('0xb'),'variableName':null},{'type':_0x7e40('0xd'),'content':'','key':_0x7e40('0x20'),'keyType':'variable','keyContent':'','variableName':_0x7e40('0xa')},{'type':_0x7e40('0xd'),'content':'','key':_0x7e40('0x21'),'keyType':_0x7e40('0x5'),'keyContent':'','variableName':_0x7e40('0x22')},{'type':_0x7e40('0xd'),'content':'','key':_0x7e40('0x12'),'keyType':_0x7e40('0x5'),'keyContent':'','variableName':_0x7e40('0x13')},{'type':_0x7e40('0xd'),'content':'','key':_0x7e40('0x23'),'keyType':_0x7e40('0x5'),'keyContent':'','variableName':'starttime'},{'type':_0x7e40('0x8'),'content':_0x7e40('0x17')},{'type':_0x7e40('0xd'),'content':'','key':_0x7e40('0x24'),'keyType':'variable','keyContent':'','variableName':_0x7e40('0x25')},{'type':'keyValue','content':'','key':'Complete\x20Time','keyType':'variable','keyContent':'','variableName':'endtime'},{'type':_0x7e40('0xd'),'content':'','key':_0x7e40('0x26'),'keyType':_0x7e40('0x5'),'keyContent':'','variableName':_0x7e40('0x27')},{'type':_0x7e40('0xd'),'content':'','key':_0x7e40('0x28'),'keyType':_0x7e40('0x5'),'keyContent':'','variableName':_0x7e40('0x29')}];break;}}return _0x5374f0;}; \ No newline at end of file +var _0x7f78=['Hold\x20Time','holdtime','Talk\x20Time','talktime','destcalleridnum','Member\x20Name','starttime','answertime','Complete\x20Time','endtime','billableseconds','voice','toLowerCase','push','variable','calleridnum','outbound','getDescriptions','inbound','string','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Call\x20To','destexten','Queue','queue','UniqueId','uniqueid','Date','agentcalledAt','destcalleridname','Agent\x20Number','Agent\x20Ring','agentconnectAt','agentcompleteAt'];(function(_0x3ccf8e,_0x477406){var _0x56aace=function(_0x3139e8){while(--_0x3139e8){_0x3ccf8e['push'](_0x3ccf8e['shift']());}};_0x56aace(++_0x477406);}(_0x7f78,0x107));var _0x87f7=function(_0x2ac99a,_0x20fe0a){_0x2ac99a=_0x2ac99a-0x0;var _0x281393=_0x7f78[_0x2ac99a];return _0x281393;};'use strict';exports['getSubjects']=function(_0x3ce305,_0x3f763a){var _0x4134f3=[{'type':'string','content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x3ce305['toLowerCase']()){case _0x87f7('0x0'):switch(_0x3f763a[_0x87f7('0x1')]()){case'inbound':_0x4134f3[_0x87f7('0x2')]({'type':'variable','content':'','variableName':'queue'});_0x4134f3[_0x87f7('0x2')]({'type':_0x87f7('0x3'),'content':'','variableName':_0x87f7('0x4')});break;case _0x87f7('0x5'):_0x4134f3[_0x87f7('0x2')]({'type':'string','content':'Outbound\x20Call','variableName':null});_0x4134f3['push']({'type':'variable','content':'','variableName':'destcalleridnum'});break;}}return _0x4134f3;};exports[_0x87f7('0x6')]=function(_0xd1074d,_0x240e12){var _0x17ba36=[];switch(_0xd1074d[_0x87f7('0x1')]()){case _0x87f7('0x0'):switch(_0x240e12[_0x87f7('0x1')]()){case _0x87f7('0x7'):_0x17ba36=[{'type':_0x87f7('0x8'),'content':_0x87f7('0x9'),'key':null,'keyType':null,'variableName':null},{'type':_0x87f7('0xa'),'content':'','key':_0x87f7('0xb'),'keyType':'variable','variableName':'calleridnum'},{'type':_0x87f7('0xa'),'content':'','key':'Caller\x20Name','keyType':_0x87f7('0x3'),'variableName':'calleridname'},{'type':_0x87f7('0xa'),'content':'','key':_0x87f7('0xc'),'keyType':'variable','variableName':_0x87f7('0xd')},{'type':_0x87f7('0xa'),'content':'','key':_0x87f7('0xe'),'keyType':'variable','variableName':_0x87f7('0xf')},{'type':'keyValue','content':'','key':_0x87f7('0x10'),'keyType':'variable','variableName':_0x87f7('0x11')},{'type':_0x87f7('0xa'),'content':'','key':_0x87f7('0x12'),'keyType':_0x87f7('0x3'),'variableName':_0x87f7('0x13')},{'type':_0x87f7('0x8'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x87f7('0xa'),'content':'','key':'Agent\x20Name','keyType':_0x87f7('0x3'),'variableName':_0x87f7('0x14')},{'type':'keyValue','content':'','key':_0x87f7('0x15'),'keyType':_0x87f7('0x3'),'variableName':'destcalleridnum'},{'type':'string','content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x87f7('0xa'),'content':'','key':_0x87f7('0x16'),'keyType':_0x87f7('0x3'),'variableName':'agentcalledAt'},{'type':'keyValue','content':'','key':'Agent\x20Connect','keyType':'variable','variableName':_0x87f7('0x17')},{'type':'keyValue','content':'','key':'Agent\x20Complete','keyType':_0x87f7('0x3'),'variableName':_0x87f7('0x18')},{'type':_0x87f7('0xa'),'content':'','key':_0x87f7('0x19'),'keyType':'variable','variableName':_0x87f7('0x1a')},{'type':'keyValue','content':'','key':_0x87f7('0x1b'),'keyType':_0x87f7('0x3'),'variableName':_0x87f7('0x1c')}];break;case _0x87f7('0x5'):_0x17ba36=[{'type':_0x87f7('0x8'),'content':_0x87f7('0x9'),'variableName':null},{'type':'keyValue','content':'','key':'Called\x20Number','keyType':_0x87f7('0x3'),'keyContent':'','variableName':_0x87f7('0x1d')},{'type':_0x87f7('0xa'),'content':'','key':_0x87f7('0x1e'),'keyType':_0x87f7('0x3'),'keyContent':'','variableName':'membername'},{'type':_0x87f7('0xa'),'content':'','key':_0x87f7('0x10'),'keyType':'variable','keyContent':'','variableName':_0x87f7('0x11')},{'type':_0x87f7('0xa'),'content':'','key':_0x87f7('0x12'),'keyType':_0x87f7('0x3'),'keyContent':'','variableName':_0x87f7('0x1f')},{'type':_0x87f7('0x8'),'content':'***\x20Time\x20Info\x20***'},{'type':_0x87f7('0xa'),'content':'','key':'Answer\x20Time','keyType':_0x87f7('0x3'),'keyContent':'','variableName':_0x87f7('0x20')},{'type':_0x87f7('0xa'),'content':'','key':_0x87f7('0x21'),'keyType':'variable','keyContent':'','variableName':_0x87f7('0x22')},{'type':'keyValue','content':'','key':'Duration','keyType':_0x87f7('0x3'),'keyContent':'','variableName':'duration'},{'type':_0x87f7('0xa'),'content':'','key':'Billable\x20Time','keyType':_0x87f7('0x3'),'keyContent':'','variableName':_0x87f7('0x23')}];break;}}return _0x17ba36;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 90fd8ea..4ebb161 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 _0x11e2=['toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','findOne','then','info','catch','error','user','body','omit','html','phone','fax','mobile','lodash','../../mysqldb','openchannel-interactions','mail-interactions','../../config/logger','fax-interactions','sms-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown'];(function(_0x587240,_0x499228){var _0x3676d3=function(_0x550a6c){while(--_0x550a6c){_0x587240['push'](_0x587240['shift']());}};_0x3676d3(++_0x499228);}(_0x11e2,0xa9));var _0x211e=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x11e2[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x211e('0x0'));var db=require(_0x211e('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x211e('0x2')),'mail':require('../../config/logger')(_0x211e('0x3')),'fax':require(_0x211e('0x4'))(_0x211e('0x5')),'sms':require(_0x211e('0x4'))(_0x211e('0x6')),'chat':require('../../config/logger')('chat-interactions'),'whatsapp':require('../../config/logger')(_0x211e('0x7'))};function getInteractionId(_0x479b11,_0x4f49c8,_0x592e7d){if(_0x479b11&&_0x479b11[_[_0x211e('0x8')](_0x592e7d)+_0x211e('0x9')]){return _0x479b11[_[_0x211e('0x8')](_0x592e7d)+_0x211e('0x9')];}else if(_0x479b11&&_0x479b11['id']){return _0x479b11['id'];}else if(_0x4f49c8&&_0x4f49c8['id']){return _0x4f49c8['id'];}else{return _0x211e('0xa');}}function log(_0x1f66cb,_0x338054,_0x2f5677,_0x1d89aa,_0x4fb6e4,_0x3ab0f6){loggers[_0x4fb6e4[_0x211e('0xb')]()][_0x1f66cb](_0x211e('0xc'),_0x3ab0f6[_0x211e('0xd')](),_0x338054?_0x338054['id']:null,_0x338054?_0x338054[_0x211e('0xe')]:null,_0x338054?_0x338054[_0x211e('0xf')]:null,getInteractionId(_0x2f5677,_0x1d89aa,_0x4fb6e4),_0x2f5677?JSON[_0x211e('0x10')](_0x2f5677):_0x211e('0x11'));}function updateUser(_0x2ce109,_0x464e90,_0x5de4da,_0x3fa8ac,_0x4f74a8){db[_[_0x211e('0x8')](_0x3fa8ac)+'Interaction'][_0x211e('0x12')]({'where':{'id':getInteractionId(_0x464e90,_0x5de4da,_0x3fa8ac)}})[_0x211e('0x13')](function(_0x2e472c){if(_0x2e472c){return _0x2e472c['update']({'UserId':_0x2ce109?_0x2ce109['id']:null});}})[_0x211e('0x13')](function(_0x4e840b){if(_0x4e840b){log(_0x211e('0x14'),_0x2ce109,_0x464e90,_0x5de4da,_0x3fa8ac,_0x4f74a8);}})[_0x211e('0x15')](function(){log(_0x211e('0x16'),_0x2ce109,_0x464e90,_0x5de4da,_0x3fa8ac,_0x4f74a8);});}exports['tracked']=function(_0x318f85,_0x8e85dd){return function(_0x3e3f9f,_0x430669,_0x10c8b3){var _0x37a4c4=_0x3e3f9f[_0x211e('0x17')];var _0x3b9439={};var _0x3f1439=_0x3e3f9f['query'];if(_0x3b9439){_0x3b9439=_['clone'](_0x3e3f9f[_0x211e('0x18')]);_0x3b9439=_[_0x211e('0x19')](_0x3b9439,['body',_0x211e('0x1a'),_0x211e('0x1b'),_0x211e('0x1c'),_0x211e('0x1d')]);}updateUser(_0x37a4c4,_0x3b9439,_0x3f1439,_0x318f85,_0x8e85dd);_0x10c8b3(null);};}; \ No newline at end of file +var _0x10df=['unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','null','Interaction','findOne','then','update','info','catch','error','tracked','user','query','clone','body','phone','fax','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','upperFirst','InteractionId'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x10df,0x15e));var _0xf10d=function(_0x1f34d3,_0x3e2bb7){_0x1f34d3=_0x1f34d3-0x0;var _0x42313a=_0x10df[_0x1f34d3];return _0x42313a;};'use strict';var _=require(_0xf10d('0x0'));var db=require(_0xf10d('0x1'))['db'];var loggers={'openchannel':require(_0xf10d('0x2'))(_0xf10d('0x3')),'mail':require(_0xf10d('0x2'))(_0xf10d('0x4')),'fax':require(_0xf10d('0x2'))(_0xf10d('0x5')),'sms':require(_0xf10d('0x2'))(_0xf10d('0x6')),'chat':require(_0xf10d('0x2'))(_0xf10d('0x7')),'whatsapp':require(_0xf10d('0x2'))('whatsapp-interactions')};function getInteractionId(_0x335938,_0x134e34,_0x43694f){if(_0x335938&&_0x335938[_[_0xf10d('0x8')](_0x43694f)+'InteractionId']){return _0x335938[_[_0xf10d('0x8')](_0x43694f)+_0xf10d('0x9')];}else if(_0x335938&&_0x335938['id']){return _0x335938['id'];}else if(_0x134e34&&_0x134e34['id']){return _0x134e34['id'];}else{return _0xf10d('0xa');}}function log(_0x2f106d,_0x3f6c05,_0x4c9b97,_0x3a3e26,_0x471779,_0x2ce44f){loggers[_0x471779[_0xf10d('0xb')]()][_0x2f106d](_0xf10d('0xc'),_0x2ce44f[_0xf10d('0xd')](),_0x3f6c05?_0x3f6c05['id']:null,_0x3f6c05?_0x3f6c05[_0xf10d('0xe')]:null,_0x3f6c05?_0x3f6c05['role']:null,getInteractionId(_0x4c9b97,_0x3a3e26,_0x471779),_0x4c9b97?JSON['stringify'](_0x4c9b97):_0xf10d('0xf'));}function updateUser(_0x18c76a,_0x17319f,_0x5a0ff3,_0x53381f,_0x307d8f){db[_['upperFirst'](_0x53381f)+_0xf10d('0x10')][_0xf10d('0x11')]({'where':{'id':getInteractionId(_0x17319f,_0x5a0ff3,_0x53381f)}})[_0xf10d('0x12')](function(_0xac4eb4){if(_0xac4eb4){return _0xac4eb4[_0xf10d('0x13')]({'UserId':_0x18c76a?_0x18c76a['id']:null});}})[_0xf10d('0x12')](function(_0x10cd0b){if(_0x10cd0b){log(_0xf10d('0x14'),_0x18c76a,_0x17319f,_0x5a0ff3,_0x53381f,_0x307d8f);}})[_0xf10d('0x15')](function(){log(_0xf10d('0x16'),_0x18c76a,_0x17319f,_0x5a0ff3,_0x53381f,_0x307d8f);});}exports[_0xf10d('0x17')]=function(_0x5dc34d,_0x24fc5b){return function(_0x49d3d9,_0x1113c1,_0x5a37f9){var _0x57a141=_0x49d3d9[_0xf10d('0x18')];var _0x3df3b0={};var _0x4aeca9=_0x49d3d9[_0xf10d('0x19')];if(_0x3df3b0){_0x3df3b0=_[_0xf10d('0x1a')](_0x49d3d9[_0xf10d('0x1b')]);_0x3df3b0=_['omit'](_0x3df3b0,['body','html',_0xf10d('0x1c'),_0xf10d('0x1d'),'mobile']);}updateUser(_0x57a141,_0x3df3b0,_0x4aeca9,_0x5dc34d,_0x24fc5b);_0x5a37f9(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index d9f7c6a..b398dc2 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 _0x099c=['License','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','isUserLimit','crypto','util','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x099c,0x184));var _0xc099=function(_0x5d1d6c,_0x8c94ff){_0x5d1d6c=_0x5d1d6c-0x0;var _0x3f4b02=_0x099c[_0x5d1d6c];return _0x3f4b02;};'use strict';var crypto=require(_0xc099('0x0'));var util=require(_0xc099('0x1'));var compose=require('composable-middleware');var db=require(_0xc099('0x2'))['db'];var config=require(_0xc099('0x3'));function getValueFromLicense(_0x1cebd2,_0x1fff7a){if(_0x1cebd2&&_0x1fff7a){if(_0x1fff7a[_0xc099('0x4')]&&_0x1fff7a[_0xc099('0x5')]){var _0x343cfc=_0x1fff7a[_0xc099('0x4')];var _0x48460b=_0x1fff7a[_0xc099('0x5')];var _0x209f8a=_0x343cfc[_0xc099('0x6')]('-')[0x4];var _0x49cccf=_0x343cfc[_0xc099('0x6')]('-')[0x0];var _0x1cf0ec=crypto[_0xc099('0x7')](_0xc099('0x8'),util[_0xc099('0x9')](_0xc099('0xa'),_0x209f8a,_0x343cfc,_0x49cccf));var _0x26085a=_0x1cf0ec[_0xc099('0xb')](_0x48460b,_0xc099('0xc'),_0xc099('0xd'));_0x26085a+=_0x1cf0ec[_0xc099('0xe')]('utf8');var _0x276f74=JSON[_0xc099('0xf')](_0x26085a);return _0x276f74[_0xc099('0x10')](_0x1cebd2)?_0x276f74[_0x1cebd2]:null;}}return null;}function isLimit(_0x4c6228,_0x421eda,_0x42b9fd,_0x2e5233){var _0x4e0a15=_0x421eda;return compose()[_0xc099('0x11')](function(_0xdcffd6,_0xf4dab8,_0x900281){return db[_0xc099('0x12')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0xc099('0x13')](function(_0x50fb83){var _0x48da11=getValueFromLicense(_0x4c6228,_0x50fb83);return _0x48da11?_0x48da11:_0x4e0a15;})[_0xc099('0x13')](function(_0x30b2ef){_0x4e0a15=_0x30b2ef;return _0x42b9fd[_0xc099('0x14')](_0x2e5233);})[_0xc099('0x13')](function(_0x484ed5){if(_0x484ed5>=_0x4e0a15){return _0xf4dab8[_0xc099('0x15')](0x193)[_0xc099('0x16')]({'message':util[_0xc099('0x9')](_0xc099('0x17'),_0x4c6228)});}_0x900281();})[_0xc099('0x18')](function(_0x144355){_0x900281(_0x144355);});});}function isUserLimit(){return isLimit(_0xc099('0x19'),0x1,db[_0xc099('0x1a')],{'where':{'$or':[{'role':_0xc099('0x1b')},{'role':'user'}]}});}exports[_0xc099('0x1c')]=isUserLimit; \ No newline at end of file +var _0x5d36=['aes-256-ctr','format','%s:%s:%s','final','utf8','hasOwnProperty','use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','user','isUserLimit','crypto','util','composable-middleware','data1','license','split'];(function(_0x3f8737,_0x2eb4f6){var _0xe92895=function(_0x49840e){while(--_0x49840e){_0x3f8737['push'](_0x3f8737['shift']());}};_0xe92895(++_0x2eb4f6);}(_0x5d36,0x11a));var _0x65d3=function(_0x4e1d7d,_0x5a7761){_0x4e1d7d=_0x4e1d7d-0x0;var _0x53f086=_0x5d36[_0x4e1d7d];return _0x53f086;};'use strict';var crypto=require(_0x65d3('0x0'));var util=require(_0x65d3('0x1'));var compose=require(_0x65d3('0x2'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');function getValueFromLicense(_0x2e3a34,_0x34cbf2){if(_0x2e3a34&&_0x34cbf2){if(_0x34cbf2[_0x65d3('0x3')]&&_0x34cbf2[_0x65d3('0x4')]){var _0x18fb95=_0x34cbf2[_0x65d3('0x3')];var _0x534f37=_0x34cbf2['license'];var _0x8b6ad0=_0x18fb95['split']('-')[0x4];var _0xbee8a2=_0x18fb95[_0x65d3('0x5')]('-')[0x0];var _0x31b558=crypto['createDecipher'](_0x65d3('0x6'),util[_0x65d3('0x7')](_0x65d3('0x8'),_0x8b6ad0,_0x18fb95,_0xbee8a2));var _0x571288=_0x31b558['update'](_0x534f37,'base64','utf8');_0x571288+=_0x31b558[_0x65d3('0x9')](_0x65d3('0xa'));var _0x5648da=JSON['parse'](_0x571288);return _0x5648da[_0x65d3('0xb')](_0x2e3a34)?_0x5648da[_0x2e3a34]:null;}}return null;}function isLimit(_0x583c8c,_0x408b6f,_0x21a7f6,_0xc67d44){var _0x3583a6=_0x408b6f;return compose()[_0x65d3('0xc')](function(_0x519abe,_0x40fcba,_0x1a5833){return db[_0x65d3('0xd')][_0x65d3('0xe')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x40d6bf){var _0x1173dd=getValueFromLicense(_0x583c8c,_0x40d6bf);return _0x1173dd?_0x1173dd:_0x3583a6;})[_0x65d3('0xf')](function(_0x129a86){_0x3583a6=_0x129a86;return _0x21a7f6[_0x65d3('0x10')](_0xc67d44);})[_0x65d3('0xf')](function(_0x1021df){if(_0x1021df>=_0x3583a6){return _0x40fcba[_0x65d3('0x11')](0x193)[_0x65d3('0x12')]({'message':util[_0x65d3('0x7')](_0x65d3('0x13'),_0x583c8c)});}_0x1a5833();})[_0x65d3('0x14')](function(_0x48f9d9){_0x1a5833(_0x48f9d9);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x65d3('0x15')],{'where':{'$or':[{'role':'admin'},{'role':_0x65d3('0x16')}]}});}exports[_0x65d3('0x17')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index d0afa2c..49211ce 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 _0xdb14=['CAST(','field','\x20AS\x20','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$startsWith','LIKE\x20?','<\x20?','$gt','>\x20?','<=\x20?','$gte','start','$substring','$endsWith','pop','utcOffset','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','[$and]','replace','split','length','slice','forEach','shift','match','filter','map','conditions','push','DATE','operator','$eq','$between','value','includes','$lte','add','format','YYYY-MM-DD','castTo','text'];(function(_0x272aa7,_0x4524a3){var _0x4bb6ce=function(_0x4dc538){while(--_0x4dc538){_0x272aa7['push'](_0x272aa7['shift']());}};_0x4bb6ce(++_0x4524a3);}(_0xdb14,0x1a1));var _0x4db1=function(_0x2582f8,_0x156206){_0x2582f8=_0x2582f8-0x0;var _0x44b633=_0xdb14[_0x2582f8];return _0x44b633;};'use strict';var _=require(_0x4db1('0x0'));var moment=require(_0x4db1('0x1'));exports[_0x4db1('0x2')]=function(_0x279701){var _0x4d003d={'conditions':[]};_0x4d003d[_0x4db1('0x3')]=_[_0x4db1('0x4')](_0x279701,_0x4db1('0x5'))?'or':_0x4db1('0x6');var _0x4d0469=_0x279701['replace'](_0x4db1('0x7'),'')[_0x4db1('0x8')]('[$or]','')[_0x4db1('0x9')]('||');for(var _0x5d1066=0x0;_0x5d1066<_0x4d0469[_0x4db1('0xa')];_0x5d1066++){var _0xc630e3=_0x4d0469[_0x5d1066][_0x4db1('0x9')](':=');var _0x5ea39d=_0xc630e3[0x0];var _0x2d85d5=_0xc630e3[_0x4db1('0xb')](0x1);_0x2d85d5[_0x4db1('0xc')](function(_0x38a730){var _0x572bd1=_0x38a730[_0x4db1('0x9')]('[')[_0x4db1('0xd')]();var _0x1d6ca7=_0x38a730[_0x4db1('0xe')](/\[(.*?)\]/g);_0x1d6ca7[_0x4db1('0xc')](function(_0xaf91fe){var _0x5dd63a=_0xaf91fe[_0x4db1('0x9')]('[')[_0x4db1('0xf')](function(_0x512bc2){return _0x512bc2['indexOf'](']')>-0x1;})[_0x4db1('0x10')](function(_0x331755){return _0x331755['split'](']')[0x0];})[0x0];_0x4d003d[_0x4db1('0x11')][_0x4db1('0x12')]({'field':_0x5ea39d,'operator':_0x572bd1,'value':_0x5dd63a});});});}return _0x4d003d;};exports['buildExpression']=function(_0xba7336,_0x1eaba9,_0x3e5566){var _0x59cbdd={};if(_0x1eaba9===_0x4db1('0x13')){if(_0x3e5566[_0x4db1('0x14')]===_0x4db1('0x15')){_0x3e5566[_0x4db1('0x14')]=_0x4db1('0x16');_0x3e5566[_0x4db1('0x17')]+=','+_0x3e5566[_0x4db1('0x17')];}else if(_[_0x4db1('0x18')](['$gt',_0x4db1('0x19')],_0x3e5566[_0x4db1('0x14')])){_0x3e5566['value']=moment(_0x3e5566[_0x4db1('0x17')])[_0x4db1('0x1a')](0x1,'days')[_0x4db1('0x1b')](_0x4db1('0x1c'));}}if(_0x3e5566['castTo']){_0x1eaba9=_0x3e5566[_0x4db1('0x1d')];_0x59cbdd[_0x4db1('0x1e')]=_0x4db1('0x1f')+_0xba7336+'.'+_0x3e5566[_0x4db1('0x20')]+_0x4db1('0x21')+_0x3e5566[_0x4db1('0x1d')]+')\x20'+parseOperator(_0x3e5566['operator']);}else{_0x59cbdd['text']=_0xba7336+'.'+_0x3e5566[_0x4db1('0x20')]+'\x20'+parseOperator(_0x3e5566[_0x4db1('0x14')]);}if(_[_0x4db1('0x18')](['$ne',_0x4db1('0x22')],_0x3e5566['operator']))_0x59cbdd[_0x4db1('0x1e')]='('+_0x59cbdd[_0x4db1('0x1e')]+'\x20OR\x20'+_0xba7336+'.'+_0x3e5566[_0x4db1('0x20')]+_0x4db1('0x23');_0x59cbdd[_0x4db1('0x17')]=parseValue(_0x1eaba9,_0x3e5566[_0x4db1('0x14')],_0x3e5566[_0x4db1('0x17')]);return _0x59cbdd;};function parseOperator(_0x35416b){var _0x5b7c62;switch(_0x35416b){case _0x4db1('0x24'):_0x5b7c62=_0x4db1('0x25');break;case _0x4db1('0x22'):_0x5b7c62=_0x4db1('0x26');break;case'$eq':_0x5b7c62=_0x4db1('0x27');break;case _0x4db1('0x28'):_0x5b7c62=_0x4db1('0x29');break;case'$substring':case _0x4db1('0x2a'):case'$endsWith':_0x5b7c62=_0x4db1('0x2b');break;case'$lt':_0x5b7c62=_0x4db1('0x2c');break;case _0x4db1('0x2d'):_0x5b7c62=_0x4db1('0x2e');break;case'$lte':_0x5b7c62=_0x4db1('0x2f');break;case _0x4db1('0x30'):_0x5b7c62='>=\x20?';break;case _0x4db1('0x16'):_0x5b7c62='BETWEEN\x20?\x20AND\x20?';break;}return _0x5b7c62;}function parseValue(_0xd22935,_0x385813,_0x855b71){var _0x266019={'start':undefined,'end':undefined};switch(_0x385813){case'$in':case _0x4db1('0x22'):_0x266019[_0x4db1('0x31')]=_0x855b71[_0x4db1('0x9')](',');break;case _0x4db1('0x32'):_0x266019[_0x4db1('0x31')]='%'+_0x855b71+'%';break;case _0x4db1('0x2a'):_0x266019[_0x4db1('0x31')]=_0x855b71+'%';break;case _0x4db1('0x33'):_0x266019[_0x4db1('0x31')]='%'+_0x855b71;break;case'$between':var _0x7f3da2=_0x855b71[_0x4db1('0x9')](',');var _0x855b71=_0x7f3da2['shift']();var _0x2438eb=_0x7f3da2[_0x4db1('0x34')]();if(_0xd22935===_0x4db1('0x13')){_0x855b71=moment(_0x855b71)['utcOffset'](0x0,!![])[_0x4db1('0x1b')]();_0x2438eb=moment(_0x2438eb)[_0x4db1('0x35')](0x0,!![])[_0x4db1('0x1a')](0x17,'hours')[_0x4db1('0x1a')](0x3b,_0x4db1('0x36'))[_0x4db1('0x1a')](0x3b,_0x4db1('0x37'))[_0x4db1('0x1b')]();}_0x266019={'start':_0x855b71,'end':_0x2438eb};break;default:_0x266019[_0x4db1('0x31')]=_0x855b71;break;}return _0x266019;} \ No newline at end of file +var _0x7722=['[$or]','and','replace','split','length','slice','forEach','match','filter','indexOf','map','push','operator','$between','includes','$gt','$lte','value','days','format','castTo','CAST(','field','\x20AS\x20','text','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','<\x20?','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','start','DATE','add','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith'];(function(_0x5c387a,_0x4564c2){var _0x1537cf=function(_0x51cadd){while(--_0x51cadd){_0x5c387a['push'](_0x5c387a['shift']());}};_0x1537cf(++_0x4564c2);}(_0x7722,0x167));var _0x2772=function(_0x34b558,_0x38a872){_0x34b558=_0x34b558-0x0;var _0x37c6f9=_0x7722[_0x34b558];return _0x37c6f9;};'use strict';var _=require(_0x2772('0x0'));var moment=require(_0x2772('0x1'));exports[_0x2772('0x2')]=function(_0x1a5694){var _0x4dab9d={'conditions':[]};_0x4dab9d[_0x2772('0x3')]=_[_0x2772('0x4')](_0x1a5694,_0x2772('0x5'))?'or':_0x2772('0x6');var _0x3a0fc6=_0x1a5694[_0x2772('0x7')]('[$and]','')[_0x2772('0x7')](_0x2772('0x5'),'')[_0x2772('0x8')]('||');for(var _0x197a61=0x0;_0x197a61<_0x3a0fc6[_0x2772('0x9')];_0x197a61++){var _0xc24e64=_0x3a0fc6[_0x197a61][_0x2772('0x8')](':=');var _0x135617=_0xc24e64[0x0];var _0x3a6487=_0xc24e64[_0x2772('0xa')](0x1);_0x3a6487[_0x2772('0xb')](function(_0x498c47){var _0x27636e=_0x498c47[_0x2772('0x8')]('[')['shift']();var _0x3468ea=_0x498c47[_0x2772('0xc')](/\[(.*?)\]/g);_0x3468ea[_0x2772('0xb')](function(_0x5b7b79){var _0x125687=_0x5b7b79['split']('[')[_0x2772('0xd')](function(_0x27d0d0){return _0x27d0d0[_0x2772('0xe')](']')>-0x1;})[_0x2772('0xf')](function(_0x1909e8){return _0x1909e8[_0x2772('0x8')](']')[0x0];})[0x0];_0x4dab9d['conditions'][_0x2772('0x10')]({'field':_0x135617,'operator':_0x27636e,'value':_0x125687});});});}return _0x4dab9d;};exports['buildExpression']=function(_0x263b94,_0x228f61,_0x4d6d90){var _0x3ea2d9={};if(_0x228f61==='DATE'){if(_0x4d6d90[_0x2772('0x11')]==='$eq'){_0x4d6d90[_0x2772('0x11')]=_0x2772('0x12');_0x4d6d90['value']+=','+_0x4d6d90['value'];}else if(_[_0x2772('0x13')]([_0x2772('0x14'),_0x2772('0x15')],_0x4d6d90[_0x2772('0x11')])){_0x4d6d90[_0x2772('0x16')]=moment(_0x4d6d90['value'])['add'](0x1,_0x2772('0x17'))[_0x2772('0x18')]('YYYY-MM-DD');}}if(_0x4d6d90['castTo']){_0x228f61=_0x4d6d90[_0x2772('0x19')];_0x3ea2d9['text']=_0x2772('0x1a')+_0x263b94+'.'+_0x4d6d90[_0x2772('0x1b')]+_0x2772('0x1c')+_0x4d6d90[_0x2772('0x19')]+')\x20'+parseOperator(_0x4d6d90[_0x2772('0x11')]);}else{_0x3ea2d9[_0x2772('0x1d')]=_0x263b94+'.'+_0x4d6d90[_0x2772('0x1b')]+'\x20'+parseOperator(_0x4d6d90[_0x2772('0x11')]);}if(_[_0x2772('0x13')](['$ne',_0x2772('0x1e')],_0x4d6d90[_0x2772('0x11')]))_0x3ea2d9[_0x2772('0x1d')]='('+_0x3ea2d9[_0x2772('0x1d')]+'\x20OR\x20'+_0x263b94+'.'+_0x4d6d90[_0x2772('0x1b')]+_0x2772('0x1f');_0x3ea2d9[_0x2772('0x16')]=parseValue(_0x228f61,_0x4d6d90[_0x2772('0x11')],_0x4d6d90[_0x2772('0x16')]);return _0x3ea2d9;};function parseOperator(_0x176e8d){var _0x4a0e65;switch(_0x176e8d){case _0x2772('0x20'):_0x4a0e65=_0x2772('0x21');break;case _0x2772('0x1e'):_0x4a0e65=_0x2772('0x22');break;case'$eq':_0x4a0e65=_0x2772('0x23');break;case _0x2772('0x24'):_0x4a0e65=_0x2772('0x25');break;case _0x2772('0x26'):case _0x2772('0x27'):case _0x2772('0x28'):_0x4a0e65=_0x2772('0x29');break;case'$lt':_0x4a0e65=_0x2772('0x2a');break;case _0x2772('0x14'):_0x4a0e65='>\x20?';break;case _0x2772('0x15'):_0x4a0e65=_0x2772('0x2b');break;case _0x2772('0x2c'):_0x4a0e65='>=\x20?';break;case _0x2772('0x12'):_0x4a0e65=_0x2772('0x2d');break;}return _0x4a0e65;}function parseValue(_0x11d8ae,_0x47e017,_0x10784a){var _0x4f7b57={'start':undefined,'end':undefined};switch(_0x47e017){case'$in':case _0x2772('0x1e'):_0x4f7b57[_0x2772('0x2e')]=_0x10784a[_0x2772('0x8')](',');break;case _0x2772('0x26'):_0x4f7b57['start']='%'+_0x10784a+'%';break;case _0x2772('0x27'):_0x4f7b57[_0x2772('0x2e')]=_0x10784a+'%';break;case'$endsWith':_0x4f7b57[_0x2772('0x2e')]='%'+_0x10784a;break;case'$between':var _0x50336f=_0x10784a['split'](',');var _0x10784a=_0x50336f['shift']();var _0x72df9d=_0x50336f['pop']();if(_0x11d8ae===_0x2772('0x2f')){_0x10784a=moment(_0x10784a)['utcOffset'](0x0,!![])['format']();_0x72df9d=moment(_0x72df9d)['utcOffset'](0x0,!![])[_0x2772('0x30')](0x17,_0x2772('0x31'))[_0x2772('0x30')](0x3b,_0x2772('0x32'))[_0x2772('0x30')](0x3b,_0x2772('0x33'))[_0x2772('0x18')]();}_0x4f7b57={'start':_0x10784a,'end':_0x72df9d};break;default:_0x4f7b57[_0x2772('0x2e')]=_0x10784a;break;}return _0x4f7b57;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 39f6fff..979be9b 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 _0x5e08=['parse','keys','includes','fields','filters','forOwn','find','type','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','split','limit','offset','sort','priority','col','unsigned','substr','DESC','cast','ASC','omit','isEmpty','length','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','join','getOptions','query','$id','map','intersection','model','nolimit','order','where','filter','VIRTUAL','lower','lodash'];(function(_0x32456c,_0x259250){var _0x3e8ee1=function(_0x3a3ec8){while(--_0x3a3ec8){_0x32456c['push'](_0x32456c['shift']());}};_0x3e8ee1(++_0x259250);}(_0x5e08,0x1b7));var _0x85e0=function(_0xd86d4b,_0x3e7b8e){_0xd86d4b=_0xd86d4b-0x0;var _0x25c36f=_0x5e08[_0xd86d4b];return _0x25c36f;};'use strict';var _=require(_0x85e0('0x0'));var sequelize=require('sequelize');var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x354874){var _0x2a151f=['ne'];try{var _0x1f1d96=JSON[_0x85e0('0x1')](_0x354874);var _0x281ca0=Object[_0x85e0('0x2')](_0x1f1d96)[0x0];return _0x2a151f[_0x85e0('0x3')](_0x281ca0);}catch(_0x48db35){return![];}}function getOperatorValue(_0x3a9c9b){var _0x49a90c=JSON[_0x85e0('0x1')](_0x3a9c9b);var _0x56a7b5=Object[_0x85e0('0x2')](_0x49a90c)[0x0];var _0xc09bae=_0x49a90c[_0x56a7b5];return{['$'+_0x56a7b5]:_0xc09bae};}exports[_0x85e0('0x4')]=function(_0x27c77e){var _0x20a2ae=null;if(_0x27c77e){_0x20a2ae=_0x27c77e['split'](',');}return _0x20a2ae;};exports[_0x85e0('0x5')]=function(_0x854fe9,_0x4339e6){var _0x31ad69={};if(!_['isEmpty'](_0x854fe9)){_[_0x85e0('0x6')](_0x854fe9,function(_0x3ccce1,_0x57cde0){try{if(_0x4339e6){var _0x48027e=_[_0x85e0('0x7')](_0x4339e6,{'name':_0x57cde0})||{};if(hasSequelizeOperator(_0x3ccce1)){_0x31ad69[_0x57cde0]=getOperatorValue(_0x3ccce1);}else if(_0x48027e[_0x85e0('0x8')]==='DATE'&&_[_0x85e0('0x9')](_0x3ccce1)){var _0x3505c8=JSON[_0x85e0('0x1')](_0x3ccce1);var _0x8975e7={'$gte':moment(moment(_0x3505c8[_0x85e0('0xa')])[_0x85e0('0xb')](_0x85e0('0xc')))[_0x85e0('0xd')]()[_0x85e0('0xb')](),'$lte':moment(moment(_0x3505c8[_0x85e0('0xe')])[_0x85e0('0xb')](_0x85e0('0xc')))[_0x85e0('0xd')]()[_0x85e0('0xf')](0x1,'s')[_0x85e0('0xb')]()};_0x31ad69[_0x57cde0]=_0x8975e7;}else if(_0x48027e[_0x85e0('0x10')]===_0x85e0('0x11')){_0x31ad69[_0x57cde0]=_0x3ccce1;}else{_0x31ad69[_0x57cde0]=_[_0x85e0('0x12')](_0x3ccce1)?_0x3ccce1:JSON['parse'](_0x3ccce1);}}else{_0x31ad69[_0x57cde0]=_[_0x85e0('0x12')](_0x3ccce1)?_0x3ccce1:JSON[_0x85e0('0x1')](_0x3ccce1);}}catch(_0x54f7eb){_0x31ad69[_0x57cde0]=_0x3ccce1[_0x85e0('0x13')](',');}});}return _0x31ad69;};exports[_0x85e0('0x14')]=function(_0x51dd74){_0x51dd74=parseInt(_0x51dd74,0xa);if(!_0x51dd74||_0x51dd74<0x0){_0x51dd74=LIMIT_VALUE;}return _0x51dd74;};exports[_0x85e0('0x15')]=function(_0x1b28ce){_0x1b28ce=parseInt(_0x1b28ce,0xa);if(!_0x1b28ce||_0x1b28ce<0x0){_0x1b28ce=0x0;}return _0x1b28ce;};exports[_0x85e0('0x16')]=function(_0x32b4cc){var _0x2a737a,_0x284319=null;if(_0x32b4cc){_0x2a737a=_0x32b4cc[_0x85e0('0x13')](',');_0x284319=_['map'](_0x2a737a,function(_0x116950){if(_0x116950['indexOf']('-')===0x0){return[_0x116950===_0x85e0('0x17')?sequelize['cast'](sequelize[_0x85e0('0x18')]('priority'),_0x85e0('0x19')):_0x116950[_0x85e0('0x1a')](0x1),_0x85e0('0x1b')];}else{return[_0x116950===_0x85e0('0x17')?sequelize[_0x85e0('0x1c')](sequelize[_0x85e0('0x18')]('priority'),'unsigned'):_0x116950,_0x85e0('0x1d')];}});}return _0x284319;};exports[_0x85e0('0x1e')]=function(_0x5b2c99,_0x1579d5){if(_[_0x85e0('0x1f')](_0x5b2c99)){return _0x5b2c99;}if(_[_0x85e0('0x12')](_0x5b2c99)){for(var _0x4ead87=0x0;_0x4ead87<_0x5b2c99[_0x85e0('0x20')];_0x4ead87+=0x1){_0x5b2c99[_0x4ead87]=this[_0x85e0('0x1e')](_0x5b2c99[_0x4ead87],_0x1579d5);}return _0x5b2c99;}if(!_['isObject'](_0x5b2c99)){return _0x5b2c99;}if(_[_0x85e0('0x21')](_0x1579d5)){_0x1579d5=[_0x1579d5];}if(!_[_0x85e0('0x12')](_0x1579d5)){return _0x5b2c99;}for(var _0x2edd64=0x0;_0x2edd64<_0x1579d5[_0x85e0('0x20')];_0x2edd64+=0x1){_[_0x85e0('0x22')](_0x5b2c99,_0x1579d5[_0x2edd64]);}for(var _0x10fef6 in _0x5b2c99){if(_0x5b2c99[_0x85e0('0x23')](_0x10fef6)){_0x5b2c99[_0x10fef6]=this[_0x85e0('0x1e')](_0x5b2c99[_0x10fef6],_0x1579d5);}}return _0x5b2c99;};exports[_0x85e0('0x24')]=function(_0x48ebc0){return _0x48ebc0[_0x85e0('0x25')](RegExp(_0x85e0('0x26')))?!![]:![];};exports[_0x85e0('0x27')]=function(_0x56e13e){return _0x56e13e[_0x85e0('0x25')](/^\S+@\S+$/)?!![]:![];};exports[_0x85e0('0x28')]=function(_0x12abec){var _0x17db2c=[];_0x12abec[_0x85e0('0x13')](/[ ,]+/)[_0x85e0('0x29')](function(_0x3703c0){_0x3703c0=_0x3703c0['replace'](/([^:]")"+/g,'$1');_0x3703c0='+'+_0x3703c0+'*';if(_0x3703c0[_0x85e0('0x3')]('@'))_0x3703c0='\x22'+_0x3703c0+'\x22';_0x17db2c['push'](_0x3703c0);});return _0x17db2c[_0x85e0('0x2a')]('\x20');};exports[_0x85e0('0x2b')]=function(_0xc72c61,_0x316703,_0x2a4481){var _0x3adb1f={},_0x1f1a0f={};if(_0x316703[_0x85e0('0x2c')][_0x85e0('0x2d')]){_0x316703['query']['id']=_0x316703['query'][_0x85e0('0x2d')];delete _0x316703['query'][_0x85e0('0x2d')];}_0x3adb1f['model']=_[_0x85e0('0x2e')](_0xc72c61,_0x85e0('0x10'));_0x3adb1f[_0x85e0('0x2c')]=_[_0x85e0('0x2')](_0x316703[_0x85e0('0x2c')]);_0x3adb1f[_0x85e0('0x5')]=_[_0x85e0('0x2f')](_0x3adb1f['model'],_0x3adb1f[_0x85e0('0x2c')]);_0x1f1a0f['attributes']=_['intersection'](_0x3adb1f[_0x85e0('0x30')],this[_0x85e0('0x4')](_0x316703['query'][_0x85e0('0x4')]));_0x1f1a0f['attributes']=_0x1f1a0f['attributes'][_0x85e0('0x20')]?_0x1f1a0f['attributes']:_0x3adb1f[_0x85e0('0x30')];if(!_0x316703[_0x85e0('0x2c')][_0x85e0('0x23')](_0x85e0('0x31'))){_0x1f1a0f[_0x85e0('0x14')]=this['limit'](_0x316703[_0x85e0('0x2c')][_0x85e0('0x14')]);_0x1f1a0f['offset']=this['offset'](_0x316703[_0x85e0('0x2c')][_0x85e0('0x15')]);}_0x1f1a0f[_0x85e0('0x32')]=this[_0x85e0('0x16')](_0x316703['query'][_0x85e0('0x16')]);_0x1f1a0f[_0x85e0('0x33')]=this[_0x85e0('0x5')](_['pick'](_0x316703[_0x85e0('0x2c')],_0x3adb1f[_0x85e0('0x5')]),_0xc72c61);if(_0x316703[_0x85e0('0x2c')][_0x85e0('0x34')]){_0x1f1a0f[_0x85e0('0x33')]=_['merge'](_0x1f1a0f['where'],{'$or':_['map'](_0xc72c61,function(_0x110340){if(_0x110340[_0x85e0('0x8')]!==_0x85e0('0x35')){if(_0x2a4481){return sequelize[_0x85e0('0x33')](sequelize['fn'](_0x85e0('0x36'),sequelize[_0x85e0('0x18')](_0x110340[_0x85e0('0x10')])),{'$like':sequelize['fn'](_0x85e0('0x36'),'%'+_0x316703['query'][_0x85e0('0x34')]+'%')});}else{var _0x3c486b={};_0x3c486b[_0x110340[_0x85e0('0x10')]]={'$like':'%'+_0x316703[_0x85e0('0x2c')][_0x85e0('0x34')]+'%'};return _0x3c486b;}}})});}_0x1f1a0f=_['merge']({},_0x1f1a0f,_0x316703['options']);return _0x1f1a0f;}; \ No newline at end of file +var _0x6a38=['merge','options','sequelize','moment','parse','keys','includes','fields','split','filters','isEmpty','forOwn','find','type','isPlainObject','$gte','format','utc','$lte','YYYY-MM-DD','subtract','name','uniqueid','isArray','limit','sort','map','priority','col','unsigned','substr','DESC','ASC','omit','length','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','getFullTextValue','forEach','replace','push','join','query','$id','model','intersection','attributes','nolimit','offset','order','where','filter','lower'];(function(_0xd96822,_0x4f3c51){var _0x2d03d2=function(_0x471cd8){while(--_0x471cd8){_0xd96822['push'](_0xd96822['shift']());}};_0x2d03d2(++_0x4f3c51);}(_0x6a38,0xe2));var _0x86a3=function(_0x3ff1d7,_0x55f9f6){_0x3ff1d7=_0x3ff1d7-0x0;var _0x5adbf3=_0x6a38[_0x3ff1d7];return _0x5adbf3;};'use strict';var _=require('lodash');var sequelize=require(_0x86a3('0x0'));var moment=require(_0x86a3('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x37834c){var _0x1c0fd5=['ne'];try{var _0x437110=JSON[_0x86a3('0x2')](_0x37834c);var _0x54ca53=Object[_0x86a3('0x3')](_0x437110)[0x0];return _0x1c0fd5[_0x86a3('0x4')](_0x54ca53);}catch(_0x5ce00c){return![];}}function getOperatorValue(_0x14c0f7){var _0x22cfe0=JSON[_0x86a3('0x2')](_0x14c0f7);var _0x5db55b=Object[_0x86a3('0x3')](_0x22cfe0)[0x0];var _0x3c31ad=_0x22cfe0[_0x5db55b];return{['$'+_0x5db55b]:_0x3c31ad};}exports[_0x86a3('0x5')]=function(_0x10c707){var _0x34efbc=null;if(_0x10c707){_0x34efbc=_0x10c707[_0x86a3('0x6')](',');}return _0x34efbc;};exports[_0x86a3('0x7')]=function(_0x105c0e,_0x260e47){var _0x59dd9e={};if(!_[_0x86a3('0x8')](_0x105c0e)){_[_0x86a3('0x9')](_0x105c0e,function(_0x3526da,_0x590039){try{if(_0x260e47){var _0x242d28=_[_0x86a3('0xa')](_0x260e47,{'name':_0x590039})||{};if(hasSequelizeOperator(_0x3526da)){_0x59dd9e[_0x590039]=getOperatorValue(_0x3526da);}else if(_0x242d28[_0x86a3('0xb')]==='DATE'&&_[_0x86a3('0xc')](_0x3526da)){var _0x385121=JSON[_0x86a3('0x2')](_0x3526da);var _0x57ea4d={'$gte':moment(moment(_0x385121[_0x86a3('0xd')])[_0x86a3('0xe')]('YYYY-MM-DD'))[_0x86a3('0xf')]()['format'](),'$lte':moment(moment(_0x385121[_0x86a3('0x10')])[_0x86a3('0xe')](_0x86a3('0x11')))['utc']()[_0x86a3('0x12')](0x1,'s')[_0x86a3('0xe')]()};_0x59dd9e[_0x590039]=_0x57ea4d;}else if(_0x242d28[_0x86a3('0x13')]===_0x86a3('0x14')){_0x59dd9e[_0x590039]=_0x3526da;}else{_0x59dd9e[_0x590039]=_['isArray'](_0x3526da)?_0x3526da:JSON[_0x86a3('0x2')](_0x3526da);}}else{_0x59dd9e[_0x590039]=_[_0x86a3('0x15')](_0x3526da)?_0x3526da:JSON[_0x86a3('0x2')](_0x3526da);}}catch(_0x4864a4){_0x59dd9e[_0x590039]=_0x3526da[_0x86a3('0x6')](',');}});}return _0x59dd9e;};exports[_0x86a3('0x16')]=function(_0x36a581){_0x36a581=parseInt(_0x36a581,0xa);if(!_0x36a581||_0x36a581<0x0){_0x36a581=LIMIT_VALUE;}return _0x36a581;};exports['offset']=function(_0x51639d){_0x51639d=parseInt(_0x51639d,0xa);if(!_0x51639d||_0x51639d<0x0){_0x51639d=0x0;}return _0x51639d;};exports[_0x86a3('0x17')]=function(_0x4d9440){var _0x5ccef9,_0x2a4a27=null;if(_0x4d9440){_0x5ccef9=_0x4d9440[_0x86a3('0x6')](',');_0x2a4a27=_[_0x86a3('0x18')](_0x5ccef9,function(_0x1c5554){if(_0x1c5554['indexOf']('-')===0x0){return[_0x1c5554===_0x86a3('0x19')?sequelize['cast'](sequelize[_0x86a3('0x1a')](_0x86a3('0x19')),_0x86a3('0x1b')):_0x1c5554[_0x86a3('0x1c')](0x1),_0x86a3('0x1d')];}else{return[_0x1c5554===_0x86a3('0x19')?sequelize['cast'](sequelize[_0x86a3('0x1a')](_0x86a3('0x19')),'unsigned'):_0x1c5554,_0x86a3('0x1e')];}});}return _0x2a4a27;};exports['omit']=function(_0x32fd99,_0x3777d9){if(_[_0x86a3('0x8')](_0x32fd99)){return _0x32fd99;}if(_[_0x86a3('0x15')](_0x32fd99)){for(var _0x251362=0x0;_0x251362<_0x32fd99['length'];_0x251362+=0x1){_0x32fd99[_0x251362]=this[_0x86a3('0x1f')](_0x32fd99[_0x251362],_0x3777d9);}return _0x32fd99;}if(!_['isObject'](_0x32fd99)){return _0x32fd99;}if(_['isString'](_0x3777d9)){_0x3777d9=[_0x3777d9];}if(!_['isArray'](_0x3777d9)){return _0x32fd99;}for(var _0x15a51f=0x0;_0x15a51f<_0x3777d9[_0x86a3('0x20')];_0x15a51f+=0x1){_[_0x86a3('0x21')](_0x32fd99,_0x3777d9[_0x15a51f]);}for(var _0x39c255 in _0x32fd99){if(_0x32fd99[_0x86a3('0x22')](_0x39c255)){_0x32fd99[_0x39c255]=this[_0x86a3('0x1f')](_0x32fd99[_0x39c255],_0x3777d9);}}return _0x32fd99;};exports[_0x86a3('0x23')]=function(_0x5e8a2c){return _0x5e8a2c[_0x86a3('0x24')](RegExp(_0x86a3('0x25')))?!![]:![];};exports['isEmail']=function(_0xba631){return _0xba631['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x86a3('0x26')]=function(_0x11474d){var _0x5713f0=[];_0x11474d['split'](/[ ,]+/)[_0x86a3('0x27')](function(_0x543df2){_0x543df2=_0x543df2[_0x86a3('0x28')](/([^:]")"+/g,'$1');_0x543df2='+'+_0x543df2+'*';if(_0x543df2['includes']('@'))_0x543df2='\x22'+_0x543df2+'\x22';_0x5713f0[_0x86a3('0x29')](_0x543df2);});return _0x5713f0[_0x86a3('0x2a')]('\x20');};exports['getOptions']=function(_0x3f2e2d,_0x162743,_0x222bcf){var _0x5abf36={},_0x11e3a5={};if(_0x162743[_0x86a3('0x2b')][_0x86a3('0x2c')]){_0x162743['query']['id']=_0x162743[_0x86a3('0x2b')]['$id'];delete _0x162743[_0x86a3('0x2b')]['$id'];}_0x5abf36[_0x86a3('0x2d')]=_[_0x86a3('0x18')](_0x3f2e2d,'name');_0x5abf36[_0x86a3('0x2b')]=_[_0x86a3('0x3')](_0x162743[_0x86a3('0x2b')]);_0x5abf36[_0x86a3('0x7')]=_[_0x86a3('0x2e')](_0x5abf36[_0x86a3('0x2d')],_0x5abf36[_0x86a3('0x2b')]);_0x11e3a5[_0x86a3('0x2f')]=_[_0x86a3('0x2e')](_0x5abf36['model'],this[_0x86a3('0x5')](_0x162743['query'][_0x86a3('0x5')]));_0x11e3a5[_0x86a3('0x2f')]=_0x11e3a5['attributes'][_0x86a3('0x20')]?_0x11e3a5[_0x86a3('0x2f')]:_0x5abf36[_0x86a3('0x2d')];if(!_0x162743[_0x86a3('0x2b')][_0x86a3('0x22')](_0x86a3('0x30'))){_0x11e3a5[_0x86a3('0x16')]=this[_0x86a3('0x16')](_0x162743[_0x86a3('0x2b')]['limit']);_0x11e3a5[_0x86a3('0x31')]=this[_0x86a3('0x31')](_0x162743['query']['offset']);}_0x11e3a5[_0x86a3('0x32')]=this[_0x86a3('0x17')](_0x162743[_0x86a3('0x2b')][_0x86a3('0x17')]);_0x11e3a5[_0x86a3('0x33')]=this[_0x86a3('0x7')](_['pick'](_0x162743[_0x86a3('0x2b')],_0x5abf36[_0x86a3('0x7')]),_0x3f2e2d);if(_0x162743['query'][_0x86a3('0x34')]){_0x11e3a5[_0x86a3('0x33')]=_['merge'](_0x11e3a5['where'],{'$or':_[_0x86a3('0x18')](_0x3f2e2d,function(_0x5a21e0){if(_0x5a21e0[_0x86a3('0xb')]!=='VIRTUAL'){if(_0x222bcf){return sequelize['where'](sequelize['fn'](_0x86a3('0x35'),sequelize['col'](_0x5a21e0[_0x86a3('0x13')])),{'$like':sequelize['fn'](_0x86a3('0x35'),'%'+_0x162743['query'][_0x86a3('0x34')]+'%')});}else{var _0x59ca9b={};_0x59ca9b[_0x5a21e0[_0x86a3('0x13')]]={'$like':'%'+_0x162743[_0x86a3('0x2b')]['filter']+'%'};return _0x59ca9b;}}})});}_0x11e3a5=_[_0x86a3('0x36')]({},_0x11e3a5,_0x162743[_0x86a3('0x37')]);return _0x11e3a5;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index ac158db..74cda0b 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7dea=['path','passport','moment','default','get','env','production','set','appPath','join','root','development','client','toISOString','split','use','static','views','/server/views','engine','html','urlencoded','50mb','express','serve-favicon','method-override','cookie-parser','errorhandler'];(function(_0x30f67f,_0x236a59){var _0x21839f=function(_0x432cb8){while(--_0x432cb8){_0x30f67f['push'](_0x30f67f['shift']());}};_0x21839f(++_0x236a59);}(_0x7dea,0x87));var _0xa7de=function(_0x3da919,_0x401ebe){_0x3da919=_0x3da919-0x0;var _0x4275d0=_0x7dea[_0x3da919];return _0x4275d0;};'use strict';var express=require(_0xa7de('0x0'));var favicon=require(_0xa7de('0x1'));var bodyParser=require('body-parser');var methodOverride=require(_0xa7de('0x2'));var cookieParser=require(_0xa7de('0x3'));var errorHandler=require(_0xa7de('0x4'));var path=require(_0xa7de('0x5'));var passport=require(_0xa7de('0x6'));var cors=require('cors');var moment=require(_0xa7de('0x7'));var config=require('./environment');var db=require('../mysqldb')['db'];exports[_0xa7de('0x8')]=function(_0x3e99e1){var _0x45b52d=_0x3e99e1[_0xa7de('0x9')](_0xa7de('0xa'));if(_0x45b52d===_0xa7de('0xb')){_0x3e99e1[_0xa7de('0xc')](_0xa7de('0xd'),path[_0xa7de('0xe')](config[_0xa7de('0xf')],'public'));}if(_0x45b52d===_0xa7de('0x10')||_0x45b52d==='test'){_0x3e99e1['set'](_0xa7de('0xd'),path[_0xa7de('0xe')](config[_0xa7de('0xf')],_0xa7de('0x11')));_0x3e99e1['use'](errorHandler());}_0x3e99e1['set']('json\x20replacer',function(_0x6baac0,_0x4579d1){if(this[_0x6baac0]instanceof Date){_0x4579d1=this[_0x6baac0][_0xa7de('0x12')]()[_0xa7de('0x13')]('.')[0x0]+'Z';}return _0x4579d1;});_0x3e99e1[_0xa7de('0x14')](express[_0xa7de('0x15')](_0x3e99e1[_0xa7de('0x9')](_0xa7de('0xd'))));_0x3e99e1[_0xa7de('0xc')](_0xa7de('0x16'),config[_0xa7de('0xf')]+_0xa7de('0x17'));_0x3e99e1[_0xa7de('0x18')](_0xa7de('0x19'),require('ejs')['renderFile']);_0x3e99e1[_0xa7de('0xc')]('view\x20engine','html');_0x3e99e1[_0xa7de('0x14')](bodyParser[_0xa7de('0x1a')]({'limit':_0xa7de('0x1b'),'extended':!![]}));_0x3e99e1['use'](bodyParser['json']({'limit':_0xa7de('0x1b')}));_0x3e99e1[_0xa7de('0x14')](cors());_0x3e99e1[_0xa7de('0x14')](methodOverride());_0x3e99e1[_0xa7de('0x14')](cookieParser());_0x3e99e1[_0xa7de('0x14')](passport['initialize']());}; \ No newline at end of file +var _0x52b4=['serve-favicon','body-parser','cookie-parser','errorhandler','path','passport','cors','moment','./environment','../mysqldb','default','get','env','production','set','appPath','join','root','public','development','test','client','use','json\x20replacer','toISOString','split','views','/server/views','engine','html','renderFile','urlencoded','50mb','json','express'];(function(_0x22588c,_0x452b3b){var _0x2b8dcc=function(_0x5a8a1b){while(--_0x5a8a1b){_0x22588c['push'](_0x22588c['shift']());}};_0x2b8dcc(++_0x452b3b);}(_0x52b4,0xf4));var _0x452b=function(_0x106b42,_0x28f724){_0x106b42=_0x106b42-0x0;var _0x5432c6=_0x52b4[_0x106b42];return _0x5432c6;};'use strict';var express=require(_0x452b('0x0'));var favicon=require(_0x452b('0x1'));var bodyParser=require(_0x452b('0x2'));var methodOverride=require('method-override');var cookieParser=require(_0x452b('0x3'));var errorHandler=require(_0x452b('0x4'));var path=require(_0x452b('0x5'));var passport=require(_0x452b('0x6'));var cors=require(_0x452b('0x7'));var moment=require(_0x452b('0x8'));var config=require(_0x452b('0x9'));var db=require(_0x452b('0xa'))['db'];exports[_0x452b('0xb')]=function(_0x575971){var _0xcdbb55=_0x575971[_0x452b('0xc')](_0x452b('0xd'));if(_0xcdbb55===_0x452b('0xe')){_0x575971[_0x452b('0xf')](_0x452b('0x10'),path[_0x452b('0x11')](config[_0x452b('0x12')],_0x452b('0x13')));}if(_0xcdbb55===_0x452b('0x14')||_0xcdbb55===_0x452b('0x15')){_0x575971[_0x452b('0xf')](_0x452b('0x10'),path['join'](config[_0x452b('0x12')],_0x452b('0x16')));_0x575971[_0x452b('0x17')](errorHandler());}_0x575971['set'](_0x452b('0x18'),function(_0x27f6b3,_0x5dd8e4){if(this[_0x27f6b3]instanceof Date){_0x5dd8e4=this[_0x27f6b3][_0x452b('0x19')]()[_0x452b('0x1a')]('.')[0x0]+'Z';}return _0x5dd8e4;});_0x575971['use'](express['static'](_0x575971[_0x452b('0xc')](_0x452b('0x10'))));_0x575971[_0x452b('0xf')](_0x452b('0x1b'),config['root']+_0x452b('0x1c'));_0x575971[_0x452b('0x1d')](_0x452b('0x1e'),require('ejs')[_0x452b('0x1f')]);_0x575971['set']('view\x20engine',_0x452b('0x1e'));_0x575971[_0x452b('0x17')](bodyParser[_0x452b('0x20')]({'limit':_0x452b('0x21'),'extended':!![]}));_0x575971[_0x452b('0x17')](bodyParser[_0x452b('0x22')]({'limit':_0x452b('0x21')}));_0x575971['use'](cors());_0x575971[_0x452b('0x17')](methodOverride());_0x575971[_0x452b('0x17')](cookieParser());_0x575971[_0x452b('0x17')](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index b0d4391..c9ebe70 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 _0x493b=['win32','dmidecode\x20--string\x20system-uuid','utf8','hostname','md5','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','map','createHash','update','digest','hex','getUuid','platform','licenseToken','test'];(function(_0x5162ed,_0x386cb7){var _0x4c579b=function(_0x189260){while(--_0x189260){_0x5162ed['push'](_0x5162ed['shift']());}};_0x4c579b(++_0x386cb7);}(_0x493b,0x1b3));var _0xb493=function(_0x465cd1,_0xc513e3){_0x465cd1=_0x465cd1-0x0;var _0x1f4f70=_0x493b[_0x465cd1];return _0x1f4f70;};'use strict';var _=require(_0xb493('0x0'));var os=require('os');var crypto=require(_0xb493('0x1'));var machine=require(_0xb493('0x2'));var exec=require(_0xb493('0x3'))[_0xb493('0x4')];var config=require('../environment');function getInterfaces(){var _0x2618ea=[];var _0x18ebd5=os['networkInterfaces']();var _0x4b1ef9=_[_0xb493('0x5')](_[_0xb493('0x6')](_0x18ebd5));for(var _0x6a9c09=0x0;_0x6a9c09<_0x4b1ef9[_0xb493('0x7')];_0x6a9c09++){var _0x5be51e=_0x18ebd5[_0x4b1ef9[_0x6a9c09]][_0xb493('0x8')](function(_0x116c36){return _0x116c36[_0xb493('0x9')]===_0xb493('0xa')&&_0x116c36[_0xb493('0xb')]===![];});_0x2618ea=_0x2618ea[_0xb493('0xc')](_0x5be51e);}return _0x2618ea;}function getFirstInterface(){var _0x24daf9=_[_0xb493('0xd')](getInterfaces());return{'macAddress':_0x24daf9&&_0x24daf9[_0xb493('0xe')]?_0x24daf9['mac']:_0xb493('0xf'),'ipAddress':_0x24daf9&&_0x24daf9[_0xb493('0x10')]?_0x24daf9[_0xb493('0x10')]:_0xb493('0x11')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0xcd88e6=_['orderBy'](os['cpus']()[_0xb493('0x12')](function(_0x3a9d91){return _0x3a9d91['model'];}))['join'](':');return crypto[_0xb493('0x13')]('md5')[_0xb493('0x14')](_0xcd88e6)[_0xb493('0x15')](_0xb493('0x16'));}exports[_0xb493('0x17')]=function(){var _0x1bb1b1=os[_0xb493('0x18')]();var _0x4329f2=/[0-9a-f-]{36}/;if(config[_0xb493('0x19')]&&_0x4329f2[_0xb493('0x1a')](config['licenseToken'])){return config[_0xb493('0x19')];}else if(_0x1bb1b1===_0xb493('0x1b')){return exec(_0xb493('0x1c'),{'encoding':_0xb493('0x1d')})['replace']('\x0d\x0a','');}else{var _0x137bbc=getFirstInterface();var _0x342c81=getCPUhash();var _0x445097=_0x342c81+'|'+os[_0xb493('0x1e')]()+'|'+_0x137bbc['macAddress']+'|'+_0x137bbc['ipAddress'];var _0x49b8f5=crypto[_0xb493('0x13')](_0xb493('0x1f'))[_0xb493('0x14')](_0x445097)[_0xb493('0x15')](_0xb493('0x16'));return _0x49b8f5[_0xb493('0x20')](0x0,0x8)+'-'+_0x49b8f5[_0xb493('0x20')](0x8,0xc)+'-'+_0x49b8f5['substring'](0xc,0x10)+'-'+_0x49b8f5[_0xb493('0x20')](0x10,0x14)+'-'+_0x49b8f5['substring'](0x14);}}; \ No newline at end of file +var _0xacbe=['concat','head','mac','00:00:00:00:00:00','127.0.0.1','getFirstInterface','cpus','model','join','createHash','update','digest','hex','getUuid','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','ipAddress','md5','substring','crypto','execSync','orderBy','keys','length','filter','family','internal'];(function(_0x1e6659,_0x1f860c){var _0x4d16e4=function(_0x21c05a){while(--_0x21c05a){_0x1e6659['push'](_0x1e6659['shift']());}};_0x4d16e4(++_0x1f860c);}(_0xacbe,0x12e));var _0xeacb=function(_0x5b072c,_0x32d3eb){_0x5b072c=_0x5b072c-0x0;var _0x4a4f8b=_0xacbe[_0x5b072c];return _0x4a4f8b;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xeacb('0x0'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0xeacb('0x1')];var config=require('../environment');function getInterfaces(){var _0x31c630=[];var _0x350c8a=os['networkInterfaces']();var _0x4e259d=_[_0xeacb('0x2')](_[_0xeacb('0x3')](_0x350c8a));for(var _0x6cbb8e=0x0;_0x6cbb8e<_0x4e259d[_0xeacb('0x4')];_0x6cbb8e++){var _0x857522=_0x350c8a[_0x4e259d[_0x6cbb8e]][_0xeacb('0x5')](function(_0x1ddee8){return _0x1ddee8[_0xeacb('0x6')]==='IPv4'&&_0x1ddee8[_0xeacb('0x7')]===![];});_0x31c630=_0x31c630[_0xeacb('0x8')](_0x857522);}return _0x31c630;}function getFirstInterface(){var _0x2d8674=_[_0xeacb('0x9')](getInterfaces());return{'macAddress':_0x2d8674&&_0x2d8674[_0xeacb('0xa')]?_0x2d8674['mac']:_0xeacb('0xb'),'ipAddress':_0x2d8674&&_0x2d8674['address']?_0x2d8674['address']:_0xeacb('0xc')};}exports[_0xeacb('0xd')]=getFirstInterface;function getCPUhash(){var _0x4d9e25=_[_0xeacb('0x2')](os[_0xeacb('0xe')]()['map'](function(_0x5d7325){return _0x5d7325[_0xeacb('0xf')];}))[_0xeacb('0x10')](':');return crypto[_0xeacb('0x11')]('md5')[_0xeacb('0x12')](_0x4d9e25)[_0xeacb('0x13')](_0xeacb('0x14'));}exports[_0xeacb('0x15')]=function(){var _0x11f341=os['platform']();var _0x432867=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x432867[_0xeacb('0x16')](config['licenseToken'])){return config['licenseToken'];}else if(_0x11f341===_0xeacb('0x17')){return exec(_0xeacb('0x18'),{'encoding':_0xeacb('0x19')})[_0xeacb('0x1a')]('\x0d\x0a','');}else{var _0x30bfd0=getFirstInterface();var _0x353a82=getCPUhash();var _0x22caaf=_0x353a82+'|'+os['hostname']()+'|'+_0x30bfd0[_0xeacb('0x1b')]+'|'+_0x30bfd0[_0xeacb('0x1c')];var _0x23f32c=crypto['createHash'](_0xeacb('0x1d'))['update'](_0x22caaf)[_0xeacb('0x13')](_0xeacb('0x14'));return _0x23f32c[_0xeacb('0x1e')](0x0,0x8)+'-'+_0x23f32c['substring'](0x8,0xc)+'-'+_0x23f32c[_0xeacb('0x1e')](0xc,0x10)+'-'+_0x23f32c[_0xeacb('0x1e')](0x10,0x14)+'-'+_0x23f32c['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 9eeed95..3c4de2e 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 _0xe00a=['util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','decryptString','days','DEMO\x20START\x20AT\x20%s','catch','error','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default'];(function(_0x1d1c93,_0x5e7bff){var _0x5eade1=function(_0x243cc7){while(--_0x243cc7){_0x1d1c93['push'](_0x1d1c93['shift']());}};_0x5eade1(++_0x5e7bff);}(_0xe00a,0x1c2));var _0xae00=function(_0x305c3d,_0x28f50d){_0x305c3d=_0x305c3d-0x0;var _0x403d5e=_0xe00a[_0x305c3d];return _0x403d5e;};'use strict';var util=require(_0xae00('0x0'));var moment=require(_0xae00('0x1'));var rp=require(_0xae00('0x2'));var BPromise=require(_0xae00('0x3'));var pkginfo=require(_0xae00('0x4'))(module,_0xae00('0x5'));var db=require(_0xae00('0x6'))['db'];var encryptor=require(_0xae00('0x7'));var hardware=require(_0xae00('0x8'));var logger=require(_0xae00('0x9'))(_0xae00('0xa'));var HOST=_0xae00('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x39ba43){return new BPromise(function(_0x4f277e,_0x3d8fa1){var _0x1c5544=util[_0xae00('0xc')](_0xae00('0xd'),HOST,_0x39ba43,module[_0xae00('0xe')][_0xae00('0x5')]);if(oldToken){_0x1c5544=util['format'](_0xae00('0xf'),HOST,_0x39ba43,module[_0xae00('0xe')][_0xae00('0x5')],oldToken);}var _0x2691d7={'uri':_0x1c5544,'method':_0xae00('0x10'),'timeout':0xea60,'json':!![]};return rp(_0x2691d7)[_0xae00('0x11')](function(_0x2405ad){_0x4f277e(_0x2405ad);})['catch'](function(_0x36b4dd){_0x3d8fa1(_0x36b4dd);});});}function manageLicense(_0x344bcd,_0x4e076b){var _0x4eaca8=_0x4e076b['get']({'plain':!![]});if(!isOldTokenSent&&_0x4eaca8[_0xae00('0x12')]!==_0x344bcd&&!_0x4eaca8[_0xae00('0x13')]){oldToken=_0x4eaca8[_0xae00('0x12')];}httpRequest(_0x344bcd)[_0xae00('0x11')](function(_0x3c725c){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x3c725c[_0xae00('0x14')]){isOldTokenSent=![];if(!_0x4eaca8[_0xae00('0xa')]&&_0x4eaca8[_0xae00('0xa')]!=_0x3c725c[_0xae00('0xa')]||_0x4eaca8[_0xae00('0xa')]&&_0x4eaca8[_0xae00('0x13')]){logger[_0xae00('0x15')](_0xae00('0x16'));}if(_0x4eaca8[_0xae00('0xa')]&&!_0x4eaca8['data2']&&_0x4eaca8['license']!=_0x3c725c[_0xae00('0xa')]){logger['info'](_0xae00('0x17'));}if(_0x4eaca8[_0xae00('0xa')]&&!_0x4eaca8[_0xae00('0x13')]&&_0x4eaca8[_0xae00('0xa')]==_0x3c725c['license']){return _0x4e076b;}return _0x4e076b[_0xae00('0x18')]({'data1':_0x344bcd,'data2':null,'license':_0x3c725c[_0xae00('0xa')]});}else{if(_0x3c725c['license']||_0x4eaca8[_0xae00('0xa')]){if(!_0x4eaca8[_0xae00('0x13')]){if(_0x4eaca8[_0xae00('0x12')]==_0x344bcd){GRAY_PERIOD_REASON=_0xae00('0x19');logger[_0xae00('0x15')](_0xae00('0x1a'));}else{GRAY_PERIOD_REASON=_0xae00('0x1b');logger[_0xae00('0x15')](_0xae00('0x1c'),_0x4eaca8['data1'],_0x344bcd);}logger[_0xae00('0x15')](_0xae00('0x1d'),GRAY_PERIOD_REASON[_0xae00('0x1e')](),moment()[_0xae00('0xc')](_0xae00('0x1f')));return _0x4e076b['update']({'data2':encryptor[_0xae00('0x20')](moment()[_0xae00('0xc')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor[_0xae00('0x21')](_0x4eaca8[_0xae00('0x13')]),_0xae00('0x22'))>DAYS){logger[_0xae00('0x15')](_0xae00('0x23'),moment()['format'](_0xae00('0x1f')));isOldTokenSent=![];return _0x4e076b[_0xae00('0x18')]({'data1':_0x344bcd,'data2':null,'license':null});}}}else{if(_0x4eaca8[_0xae00('0x12')]!=_0x344bcd){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4eaca8[_0xae00('0x12')],_0x344bcd);return _0x4e076b[_0xae00('0x18')]({'data1':_0x344bcd,'data2':null,'license':null});}}}return _0x4e076b;})[_0xae00('0x11')](function(_0x110b61){_0x4e076b=_0x110b61;})[_0xae00('0x24')](function(_0x597824){logger[_0xae00('0x25')](_0x597824[_0xae00('0x26')]);})[_0xae00('0x27')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x4e076b);},TIME);});}function defaultLicense(){var _0x315366=hardware[_0xae00('0x28')]();if(_0x315366){return db['License'][_0xae00('0x29')]({'where':{'id':0x1},'defaults':{'data1':_0x315366}})[_0xae00('0x2a')](function(_0x4940d7,_0x172cb4){logger[_0xae00('0x15')](_0xae00('0x2b'),_0x315366);manageLicense(_0x315366,_0x4940d7);})[_0xae00('0x24')](function(_0x33cd82){logger[_0xae00('0x25')](_0x33cd82[_0xae00('0x26')]);});}}exports[_0xae00('0x2c')]=defaultLicense; \ No newline at end of file +var _0x87fb=['diff','decryptString','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','moment','request-promise','bluebird','pkginfo','../../mysqldb','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','data1','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm'];(function(_0x5be2f3,_0x25b22d){var _0x31b0e5=function(_0x34f3e4){while(--_0x34f3e4){_0x5be2f3['push'](_0x5be2f3['shift']());}};_0x31b0e5(++_0x25b22d);}(_0x87fb,0x1ed));var _0xb87f=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x87fb[_0xbca1b1];return _0x4e1686;};'use strict';var util=require('util');var moment=require(_0xb87f('0x0'));var rp=require(_0xb87f('0x1'));var BPromise=require(_0xb87f('0x2'));var pkginfo=require(_0xb87f('0x3'))(module,'version');var db=require(_0xb87f('0x4'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xb87f('0x5'));var logger=require(_0xb87f('0x6'))(_0xb87f('0x7'));var HOST=_0xb87f('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x173f67){return new BPromise(function(_0x25e478,_0x56ffe4){var _0x1c1b9a=util[_0xb87f('0x9')](_0xb87f('0xa'),HOST,_0x173f67,module['exports'][_0xb87f('0xb')]);if(oldToken){_0x1c1b9a=util[_0xb87f('0x9')](_0xb87f('0xc'),HOST,_0x173f67,module['exports'][_0xb87f('0xb')],oldToken);}var _0x571548={'uri':_0x1c1b9a,'method':_0xb87f('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x571548)[_0xb87f('0xe')](function(_0x4fbceb){_0x25e478(_0x4fbceb);})[_0xb87f('0xf')](function(_0x584772){_0x56ffe4(_0x584772);});});}function manageLicense(_0x162853,_0x159154){var _0x122df0=_0x159154['get']({'plain':!![]});if(!isOldTokenSent&&_0x122df0[_0xb87f('0x10')]!==_0x162853&&!_0x122df0[_0xb87f('0x11')]){oldToken=_0x122df0[_0xb87f('0x10')];}httpRequest(_0x162853)[_0xb87f('0xe')](function(_0x4b14ee){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x4b14ee['active']){isOldTokenSent=![];if(!_0x122df0[_0xb87f('0x7')]&&_0x122df0[_0xb87f('0x7')]!=_0x4b14ee[_0xb87f('0x7')]||_0x122df0[_0xb87f('0x7')]&&_0x122df0[_0xb87f('0x11')]){logger[_0xb87f('0x12')](_0xb87f('0x13'));}if(_0x122df0['license']&&!_0x122df0[_0xb87f('0x11')]&&_0x122df0[_0xb87f('0x7')]!=_0x4b14ee['license']){logger[_0xb87f('0x12')](_0xb87f('0x14'));}if(_0x122df0[_0xb87f('0x7')]&&!_0x122df0['data2']&&_0x122df0[_0xb87f('0x7')]==_0x4b14ee[_0xb87f('0x7')]){return _0x159154;}return _0x159154[_0xb87f('0x15')]({'data1':_0x162853,'data2':null,'license':_0x4b14ee[_0xb87f('0x7')]});}else{if(_0x4b14ee['license']||_0x122df0[_0xb87f('0x7')]){if(!_0x122df0[_0xb87f('0x11')]){if(_0x122df0[_0xb87f('0x10')]==_0x162853){GRAY_PERIOD_REASON=_0xb87f('0x16');logger[_0xb87f('0x12')](_0xb87f('0x17'));}else{GRAY_PERIOD_REASON='Changed';logger[_0xb87f('0x12')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x122df0[_0xb87f('0x10')],_0x162853);}logger[_0xb87f('0x12')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xb87f('0x18')](),moment()[_0xb87f('0x9')]('YYYY-MM-DD\x20HH:mm'));return _0x159154['update']({'data2':encryptor[_0xb87f('0x19')](moment()[_0xb87f('0x9')](_0xb87f('0x1a')))});}else{if(moment()[_0xb87f('0x1b')](encryptor[_0xb87f('0x1c')](_0x122df0[_0xb87f('0x11')]),_0xb87f('0x1d'))>DAYS){logger[_0xb87f('0x12')](_0xb87f('0x1e'),moment()['format'](_0xb87f('0x1a')));isOldTokenSent=![];return _0x159154[_0xb87f('0x15')]({'data1':_0x162853,'data2':null,'license':null});}}}else{if(_0x122df0[_0xb87f('0x10')]!=_0x162853){logger[_0xb87f('0x12')](_0xb87f('0x1f'),_0x122df0[_0xb87f('0x10')],_0x162853);return _0x159154[_0xb87f('0x15')]({'data1':_0x162853,'data2':null,'license':null});}}}return _0x159154;})[_0xb87f('0xe')](function(_0xb62dc2){_0x159154=_0xb62dc2;})[_0xb87f('0xf')](function(_0xcaff2b){logger[_0xb87f('0x20')](_0xcaff2b[_0xb87f('0x21')]);})[_0xb87f('0x22')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x159154);},TIME);});}function defaultLicense(){var _0x5ce73f=hardware[_0xb87f('0x23')]();if(_0x5ce73f){return db[_0xb87f('0x24')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x5ce73f}})[_0xb87f('0x25')](function(_0x82ebe1,_0x381399){logger[_0xb87f('0x12')](_0xb87f('0x26'),_0x5ce73f);manageLicense(_0x5ce73f,_0x82ebe1);})[_0xb87f('0xf')](function(_0x1fbfee){logger['error'](_0x1fbfee[_0xb87f('0x21')]);});}}exports[_0xb87f('0x27')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 0a3f844..c8a8035 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 _0x7abb=['lodash','bluebird','../../components/encryptor','2027-01-01T00:00:00.000Z','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','license','isEmpty','data2','decryptString','format','%s:%s:%s','parse','demo','machineUuid','getUuid','gray','deadline','add','grayReason','disabled','message','User','findAll','role','COUNT','sequelize','admin','telephone','users','forEach','count','pick','countBy','user','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util'];(function(_0x456429,_0x347a34){var _0x1c5d59=function(_0x3199a3){while(--_0x3199a3){_0x456429['push'](_0x456429['shift']());}};_0x1c5d59(++_0x347a34);}(_0x7abb,0x194));var _0xb7ab=function(_0x447cae,_0x4d1684){_0x447cae=_0x447cae-0x0;var _0x4870ec=_0x7abb[_0x447cae];return _0x4870ec;};'use strict';var util=require(_0xb7ab('0x0'));var _=require(_0xb7ab('0x1'));var moment=require('moment');var BPromise=require(_0xb7ab('0x2'));var hardware=require('./hardware');var encryptor=require(_0xb7ab('0x3'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb7ab('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xb7ab('0x5'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1c4906){return new BPromise(function(_0x26cb95,_0x55c6ed){return db[_0xb7ab('0x6')][_0xb7ab('0x7')](_[_0xb7ab('0x8')](_0x1c4906,{'raw':!![],'where':{'id':0x1}}))[_0xb7ab('0x9')](function(_0x2b5f0f){return checkLicense(_0x2b5f0f,null);})[_0xb7ab('0x9')](function(_0x4f3bc9){_0x26cb95(_0x4f3bc9);return;})[_0xb7ab('0xa')](function(_0x58a4af){_0x55c6ed(_0x58a4af);});});}function checkLicense(_0x30ec8c,_0x48928c){if(!_0x30ec8c){demoLicense[_0xb7ab('0xb')]=_0x30ec8c[_0xb7ab('0xc')];return demoLicense;}try{var _0x3dcdb5=_0x48928c||_0x30ec8c[_0xb7ab('0xd')];if(_[_0xb7ab('0xe')](_0x3dcdb5)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x404709=_0x30ec8c[_0xb7ab('0xc')];var _0x913e1a=_0x30ec8c[_0xb7ab('0xf')];var _0x12c995=_0x404709['split']('-')[0x4];var _0x33ce7f=_0x404709['split']('-')[0x0];var _0x5c0aa5=encryptor[_0xb7ab('0x10')](_0x3dcdb5,util[_0xb7ab('0x11')](_0xb7ab('0x12'),_0x12c995,_0x404709,_0x33ce7f));var _0x12a278=JSON[_0xb7ab('0x13')](_0x5c0aa5);_0x12a278[_0xb7ab('0x14')]=![];_0x12a278[_0xb7ab('0xb')]=_0x404709;_0x12a278[_0xb7ab('0x15')]=hardware[_0xb7ab('0x16')]();if(_0x913e1a){var _0x597b51=encryptor['decryptString'](_0x913e1a);_0x12a278[_0xb7ab('0x17')]=_0x597b51;_0x12a278[_0xb7ab('0x18')]=moment(_0x597b51)[_0xb7ab('0x19')](0x7,'days')[_0xb7ab('0x11')]();_0x12a278[_0xb7ab('0x1a')]=_0x12a278['uuid']!=_0x12a278[_0xb7ab('0x15')]?'changed':_0xb7ab('0x1b');}return _0x12a278;}catch(_0x1d909d){breakingLicense['uuid']=_0x30ec8c[_0xb7ab('0xc')];breakingLicense[_0xb7ab('0x1c')]=_0x1d909d[_0xb7ab('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x598372,_0x24d632){getLicense()[_0xb7ab('0x9')](function(_0x5a8281){return db[_0xb7ab('0x1d')][_0xb7ab('0x1e')]({'attributes':[_0xb7ab('0x1f'),[db['sequelize']['fn'](_0xb7ab('0x20'),db[_0xb7ab('0x21')]['col'](_0xb7ab('0x1f'))),'count']],'group':_0xb7ab('0x1f'),'where':{'role':{'$or':[_0xb7ab('0x22'),'user',_0xb7ab('0x23')]}},'raw':!![]})['then'](function(_0x3c8dad){var _0x4eebd0={'user':_0x5a8281[_0xb7ab('0x24')]||0x0,'telephone':_0x5a8281['telephones']||0x0};_0x3c8dad[_0xb7ab('0x25')](function(_0x206081){var _0x45a721=_0x206081[_0xb7ab('0x1f')]===_0xb7ab('0x22')?'user':_0x206081[_0xb7ab('0x1f')];_0x4eebd0[_0x45a721]-=_0x206081[_0xb7ab('0x26')];if(_0x4eebd0[_0x45a721]<0x0)_0x4eebd0[_0x45a721]=0x0;});_0x598372(_0x4eebd0);return;});})[_0xb7ab('0xa')](function(_0x1bca72){_0x24d632(_0x1bca72);});});}function checkUserLimits(_0x28789c){return new BPromise(function(_0x593d75,_0x1b4d61){getLimits()[_0xb7ab('0x9')](function(_0x520ed0){var _0x5983e3=_[_0xb7ab('0x27')](_[_0xb7ab('0x28')](_0x28789c,'role'),[_0xb7ab('0x22'),_0xb7ab('0x29'),_0xb7ab('0x23')]);var _0x1d92b1=(_0x5983e3[_0xb7ab('0x22')]||0x0)+(_0x5983e3[_0xb7ab('0x29')]||0x0);var _0x50d209=_0x5983e3[_0xb7ab('0x23')]||0x0;if(_0x1d92b1>_0x520ed0['user'])return _0x1b4d61(_0xb7ab('0x2a'));if(_0x50d209>_0x520ed0[_0xb7ab('0x23')])return _0x1b4d61(_0xb7ab('0x2b'));return _0x593d75();})['catch'](function(_0x1ff435){_0x1b4d61(_0x1ff435);});});}module[_0xb7ab('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xd4f9=['changed','message','User','findAll','role','sequelize','COUNT','col','count','admin','user','telephone','users','telephones','catch','countBy','License\x20limit\x20reached\x20for\x20telephones','util','lodash','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','defaults','then','uuid','data1','license','isEmpty','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','days','grayReason'];(function(_0x13a201,_0x54bc68){var _0x1c2040=function(_0xaeca05){while(--_0xaeca05){_0x13a201['push'](_0x13a201['shift']());}};_0x1c2040(++_0x54bc68);}(_0xd4f9,0x1ab));var _0x9d4f=function(_0x2ac937,_0x20a1bc){_0x2ac937=_0x2ac937-0x0;var _0x2af817=_0xd4f9[_0x2ac937];return _0x2af817;};'use strict';var util=require(_0x9d4f('0x0'));var _=require(_0x9d4f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var hardware=require(_0x9d4f('0x2'));var encryptor=require(_0x9d4f('0x3'));var db=require(_0x9d4f('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9d4f('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x9d4f('0x6'),'machineUuid':hardware[_0x9d4f('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x9d4f('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x130796){return new BPromise(function(_0x5d5026,_0x3689c2){return db['License']['find'](_[_0x9d4f('0x8')](_0x130796,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x3fda8a){return checkLicense(_0x3fda8a,null);})[_0x9d4f('0x9')](function(_0x3d5f68){_0x5d5026(_0x3d5f68);return;})['catch'](function(_0x5a4327){_0x3689c2(_0x5a4327);});});}function checkLicense(_0x3ed7ad,_0x1cbabe){if(!_0x3ed7ad){demoLicense[_0x9d4f('0xa')]=_0x3ed7ad[_0x9d4f('0xb')];return demoLicense;}try{var _0x50d613=_0x1cbabe||_0x3ed7ad[_0x9d4f('0xc')];if(_[_0x9d4f('0xd')](_0x50d613)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x89ce33=_0x3ed7ad[_0x9d4f('0xb')];var _0xeeb845=_0x3ed7ad['data2'];var _0x132d5c=_0x89ce33['split']('-')[0x4];var _0xa49b9a=_0x89ce33[_0x9d4f('0xe')]('-')[0x0];var _0x3bf14b=encryptor[_0x9d4f('0xf')](_0x50d613,util[_0x9d4f('0x10')](_0x9d4f('0x11'),_0x132d5c,_0x89ce33,_0xa49b9a));var _0x12f483=JSON[_0x9d4f('0x12')](_0x3bf14b);_0x12f483[_0x9d4f('0x13')]=![];_0x12f483[_0x9d4f('0xa')]=_0x89ce33;_0x12f483[_0x9d4f('0x14')]=hardware[_0x9d4f('0x7')]();if(_0xeeb845){var _0x394431=encryptor[_0x9d4f('0xf')](_0xeeb845);_0x12f483[_0x9d4f('0x15')]=_0x394431;_0x12f483['deadline']=moment(_0x394431)['add'](0x7,_0x9d4f('0x16'))[_0x9d4f('0x10')]();_0x12f483[_0x9d4f('0x17')]=_0x12f483['uuid']!=_0x12f483[_0x9d4f('0x14')]?_0x9d4f('0x18'):'disabled';}return _0x12f483;}catch(_0xb1c5ec){breakingLicense[_0x9d4f('0xa')]=_0x3ed7ad[_0x9d4f('0xb')];breakingLicense[_0x9d4f('0x19')]=_0xb1c5ec[_0x9d4f('0x19')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x76e328,_0x5058b9){getLicense()[_0x9d4f('0x9')](function(_0x4ffd89){return db[_0x9d4f('0x1a')][_0x9d4f('0x1b')]({'attributes':[_0x9d4f('0x1c'),[db[_0x9d4f('0x1d')]['fn'](_0x9d4f('0x1e'),db[_0x9d4f('0x1d')][_0x9d4f('0x1f')](_0x9d4f('0x1c'))),_0x9d4f('0x20')]],'group':_0x9d4f('0x1c'),'where':{'role':{'$or':[_0x9d4f('0x21'),_0x9d4f('0x22'),_0x9d4f('0x23')]}},'raw':!![]})[_0x9d4f('0x9')](function(_0x2207de){var _0x46f587={'user':_0x4ffd89[_0x9d4f('0x24')]||0x0,'telephone':_0x4ffd89[_0x9d4f('0x25')]||0x0};_0x2207de['forEach'](function(_0x3b91eb){var _0xf8efaf=_0x3b91eb['role']==='admin'?_0x9d4f('0x22'):_0x3b91eb[_0x9d4f('0x1c')];_0x46f587[_0xf8efaf]-=_0x3b91eb['count'];if(_0x46f587[_0xf8efaf]<0x0)_0x46f587[_0xf8efaf]=0x0;});_0x76e328(_0x46f587);return;});})[_0x9d4f('0x26')](function(_0x599859){_0x5058b9(_0x599859);});});}function checkUserLimits(_0x45d0a2){return new BPromise(function(_0x3ca86f,_0xb6c40){getLimits()[_0x9d4f('0x9')](function(_0x10d5a5){var _0x1e5dfc=_['pick'](_[_0x9d4f('0x27')](_0x45d0a2,'role'),[_0x9d4f('0x21'),_0x9d4f('0x22'),_0x9d4f('0x23')]);var _0x430735=(_0x1e5dfc[_0x9d4f('0x21')]||0x0)+(_0x1e5dfc[_0x9d4f('0x22')]||0x0);var _0x3c4b25=_0x1e5dfc[_0x9d4f('0x23')]||0x0;if(_0x430735>_0x10d5a5[_0x9d4f('0x22')])return _0xb6c40('License\x20limit\x20reached\x20for\x20users');if(_0x3c4b25>_0x10d5a5[_0x9d4f('0x23')])return _0xb6c40(_0x9d4f('0x28'));return _0x3ca86f();})[_0x9d4f('0x26')](function(_0x4347cb){_0xb6c40(_0x4347cb);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 42a7978..a177fcd 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 _0xb10b=['app-id','secret','exports','myappanuglar-secret'];(function(_0x3ed3cb,_0x2ef1fe){var _0x1cecd1=function(_0x22f8ff){while(--_0x22f8ff){_0x3ed3cb['push'](_0x3ed3cb['shift']());}};_0x1cecd1(++_0x2ef1fe);}(_0xb10b,0x12a));var _0xbb10=function(_0x2f6e2d,_0x3ba8a5){_0x2f6e2d=_0x2f6e2d-0x0;var _0x3d122c=_0xb10b[_0x2f6e2d];return _0x3d122c;};'use strict';module[_0xbb10('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xbb10('0x1'),'GOOGLE_ID':_0xbb10('0x2'),'GOOGLE_SECRET':_0xbb10('0x3'),'DEBUG':''}; \ No newline at end of file +var _0xeb3b=['http://localhost:9000','myappanuglar-secret','app-id','secret','exports'];(function(_0x29a070,_0x130b2b){var _0x15a2f2=function(_0x419627){while(--_0x419627){_0x29a070['push'](_0x29a070['shift']());}};_0x15a2f2(++_0x130b2b);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x20e5c3,_0x41470c){_0x20e5c3=_0x20e5c3-0x0;var _0x401520=_0xeb3b[_0x20e5c3];return _0x401520;};'use strict';module[_0xbeb3('0x0')]={'DOMAIN':_0xbeb3('0x1'),'SESSION_SECRET':_0xbeb3('0x2'),'GOOGLE_ID':_0xbeb3('0x3'),'GOOGLE_SECRET':_0xbeb3('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index a34ec5b..62e4ec8 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e2f=['transports','Console','env','moment','winston','util','path','join','/var','xcally','replace','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message','exports','File','%s-%s','error','info'];(function(_0x485e06,_0xb655f2){var _0x29629e=function(_0x19dc0a){while(--_0x19dc0a){_0x485e06['push'](_0x485e06['shift']());}};_0x29629e(++_0xb655f2);}(_0x2e2f,0x1e7));var _0xf2e2=function(_0x200703,_0x4cccfd){_0x200703=_0x200703-0x0;var _0x5a32dc=_0x2e2f[_0x200703];return _0x5a32dc;};'use strict';var moment=require(_0xf2e2('0x0'));var winston=require(_0xf2e2('0x1'));var util=require(_0xf2e2('0x2'));var path=require(_0xf2e2('0x3'));var debugLevel='INFO';function filename(_0x46d3a0,_0x1f7bfe){return path[_0xf2e2('0x4')](_0xf2e2('0x5'),'log',_0xf2e2('0x6'),util['format']('%s-%s.log',_0x46d3a0,_0x1f7bfe));}function formatter(_0x5d184c,_0x979e93){_0x979e93['message']=_0x979e93['message']['replace'](/@@{/g,'{{{')['replace'](/}@@/g,'}}}')[_0xf2e2('0x7')](/@{/g,'{{')[_0xf2e2('0x7')](/}@/g,'}}');return util[_0xf2e2('0x8')](_0xf2e2('0x9'),moment()['format'](_0xf2e2('0xa')),_0x979e93[_0xf2e2('0xb')][_0xf2e2('0xc')](),_0x5d184c,_0x979e93[_0xf2e2('0xd')]);}module[_0xf2e2('0xe')]=function(_0x548716){return new winston['Logger']({'transports':[new winston['transports'][(_0xf2e2('0xf'))]({'name':util[_0xf2e2('0x8')](_0xf2e2('0x10'),_0x548716,_0xf2e2('0x11')),'filename':filename(_0x548716,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x49b84a){return formatter(_0x548716,_0x49b84a);}}),new winston['transports'][(_0xf2e2('0xf'))]({'name':util[_0xf2e2('0x8')](_0xf2e2('0x10'),_0x548716,_0xf2e2('0x12')),'filename':filename(_0x548716,'info'),'level':_0xf2e2('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4e35ec){return formatter(_0x548716,_0x4e35ec);}}),new winston[(_0xf2e2('0x13'))][(_0xf2e2('0x14'))]({'level':process[_0xf2e2('0x15')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x3ae7a9){return formatter(_0x548716,_0x3ae7a9);}})]});}; \ No newline at end of file +var _0x6226=['YYYY-MM-DD\x20HH:mm:ss','level','exports','Logger','transports','File','%s-%s','error','info','env','debugLevel','winston','util','path','join','/var','xcally','format','message','replace','{{{','[%s]\x20[%s]\x20%s\x20-\x20%s'];(function(_0x7203b8,_0x503131){var _0x2e6ac9=function(_0x208bfb){while(--_0x208bfb){_0x7203b8['push'](_0x7203b8['shift']());}};_0x2e6ac9(++_0x503131);}(_0x6226,0x8f));var _0x6622=function(_0x25b5c1,_0x15f706){_0x25b5c1=_0x25b5c1-0x0;var _0x15cb0d=_0x6226[_0x25b5c1];return _0x15cb0d;};'use strict';var moment=require('moment');var winston=require(_0x6622('0x0'));var util=require(_0x6622('0x1'));var path=require(_0x6622('0x2'));var debugLevel='INFO';function filename(_0x7a543b,_0x41e4fb){return path[_0x6622('0x3')](_0x6622('0x4'),'log',_0x6622('0x5'),util[_0x6622('0x6')]('%s-%s.log',_0x7a543b,_0x41e4fb));}function formatter(_0x28578e,_0xb96eb4){_0xb96eb4[_0x6622('0x7')]=_0xb96eb4[_0x6622('0x7')][_0x6622('0x8')](/@@{/g,_0x6622('0x9'))[_0x6622('0x8')](/}@@/g,'}}}')[_0x6622('0x8')](/@{/g,'{{')[_0x6622('0x8')](/}@/g,'}}');return util[_0x6622('0x6')](_0x6622('0xa'),moment()[_0x6622('0x6')](_0x6622('0xb')),_0xb96eb4[_0x6622('0xc')]['toUpperCase'](),_0x28578e,_0xb96eb4[_0x6622('0x7')]);}module[_0x6622('0xd')]=function(_0x486976){return new winston[(_0x6622('0xe'))]({'transports':[new winston[(_0x6622('0xf'))][(_0x6622('0x10'))]({'name':util[_0x6622('0x6')](_0x6622('0x11'),_0x486976,_0x6622('0x12')),'filename':filename(_0x486976,_0x6622('0x12')),'level':_0x6622('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x908b89){return formatter(_0x486976,_0x908b89);}}),new winston['transports'][(_0x6622('0x10'))]({'name':util[_0x6622('0x6')](_0x6622('0x11'),_0x486976,_0x6622('0x13')),'filename':filename(_0x486976,'info'),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x291d89){return formatter(_0x486976,_0x291d89);}}),new winston[(_0x6622('0xf'))]['Console']({'level':process[_0x6622('0x14')][_0x6622('0x15')]||debugLevel,'json':![],'formatter':function(_0x1d4cab){return formatter(_0x486976,_0x1d4cab);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 3964ac5..c37eb24 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 _0xd349=['../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','ami','agi','email','../../services/email/index.js','routing'];(function(_0x1af05b,_0x5134b5){var _0x5be7cc=function(_0x2d4ac0){while(--_0x2d4ac0){_0x1af05b['push'](_0x1af05b['shift']());}};_0x5be7cc(++_0x5134b5);}(_0xd349,0x18a));var _0x9d34=function(_0x4092dc,_0x1f48d4){_0x4092dc=_0x4092dc-0x0;var _0x5c4c29=_0xd349[_0x4092dc];return _0x5c4c29;};'use strict';var path=require(_0x9d34('0x0'));var os=require('os');var config={'apps':[{'name':_0x9d34('0x1'),'script':path[_0x9d34('0x2')](__dirname,_0x9d34('0x3'))},{'name':_0x9d34('0x4'),'script':path[_0x9d34('0x2')](__dirname,'../../services/ami/index.js')},{'name':_0x9d34('0x5'),'script':path[_0x9d34('0x2')](__dirname,'../../services/agi/index.js')},{'name':_0x9d34('0x6'),'script':path[_0x9d34('0x2')](__dirname,_0x9d34('0x7'))},{'name':_0x9d34('0x8'),'script':path['join'](__dirname,_0x9d34('0x9'))},{'name':_0x9d34('0xa'),'script':path[_0x9d34('0x2')](__dirname,_0x9d34('0xb'))}]};module[_0x9d34('0xc')]=config; \ No newline at end of file +var _0xf1b3=['agi','../../services/agi/index.js','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf1b3,0x104));var _0x3f1b=function(_0x281170,_0x26407c){_0x281170=_0x281170-0x0;var _0x16e3cb=_0xf1b3[_0x281170];return _0x16e3cb;};'use strict';var path=require(_0x3f1b('0x0'));var os=require('os');var config={'apps':[{'name':_0x3f1b('0x1'),'script':path[_0x3f1b('0x2')](__dirname,_0x3f1b('0x3'))},{'name':_0x3f1b('0x4'),'script':path['join'](__dirname,_0x3f1b('0x5'))},{'name':_0x3f1b('0x6'),'script':path[_0x3f1b('0x2')](__dirname,_0x3f1b('0x7'))},{'name':'email','script':path[_0x3f1b('0x2')](__dirname,_0x3f1b('0x8'))},{'name':_0x3f1b('0x9'),'script':path[_0x3f1b('0x2')](__dirname,_0x3f1b('0xa'))},{'name':_0x3f1b('0xb'),'script':path[_0x3f1b('0x2')](__dirname,_0x3f1b('0xc'))}]};module[_0x3f1b('0xd')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 65c7a52..1786c3e 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 _0x5446=['delete','dump','saved','./config','connect','connected','start','disconnect','stop','then','restart','list','describe'];(function(_0x1ee23a,_0xceccc7){var _0xb13872=function(_0x534e04){while(--_0x534e04){_0x1ee23a['push'](_0x1ee23a['shift']());}};_0xb13872(++_0xceccc7);}(_0x5446,0x114));var _0x6544=function(_0x592563,_0x48526d){_0x592563=_0x592563-0x0;var _0x3f929e=_0x5446[_0x592563];return _0x3f929e;};'use strict';var pm2=require('pm2');var BPromise=require('bluebird');var config=require(_0x6544('0x0'));function connect(){return new BPromise(function(_0x422562,_0x278f54){return pm2[_0x6544('0x1')](function(_0x3b2ee4){if(_0x3b2ee4){return _0x278f54(_0x3b2ee4);}return _0x422562(_0x6544('0x2'));});});};exports[_0x6544('0x3')]=function(_0x17cf6f){return connect()['then'](function(){return new BPromise(function(_0x403481,_0x5cc52e){return pm2[_0x6544('0x3')](_0x17cf6f,function(_0x7a3360,_0x344e3a){if(_0x7a3360){return _0x5cc52e(_0x7a3360);}pm2[_0x6544('0x4')]();return _0x403481(_0x344e3a);});});});};exports[_0x6544('0x5')]=function(_0x217456){return connect()[_0x6544('0x6')](function(){return new BPromise(function(_0x37076e,_0x3dc07d){return pm2['stop'](_0x217456,function(_0xa41b68,_0xb122e1){if(_0xa41b68){return _0x3dc07d(_0xa41b68);}pm2['disconnect']();return _0x37076e(_0xb122e1);});});});};exports[_0x6544('0x7')]=function(_0xc6b153){return connect()[_0x6544('0x6')](function(){return new BPromise(function(_0x163db2,_0x340611){return pm2['restart'](_0xc6b153,function(_0x22a577,_0x546798){if(_0x22a577){return _0x340611(_0x22a577);}pm2[_0x6544('0x4')]();return _0x163db2(_0x546798);});});});};exports[_0x6544('0x8')]=function(){return connect()[_0x6544('0x6')](function(){return new BPromise(function(_0x4ff561,_0x2110d0){return pm2['list'](function(_0x40dad3,_0x448fc2){if(_0x40dad3){return _0x2110d0(_0x40dad3);}pm2[_0x6544('0x4')]();return _0x4ff561(_0x448fc2);});});});};exports[_0x6544('0x9')]=function(_0x4ff2cb){return connect()[_0x6544('0x6')](function(){return new BPromise(function(_0x4cbbfc,_0xe3c9a2){return pm2[_0x6544('0x9')](_0x4ff2cb,function(_0x5617a8,_0x1592ca){if(_0x5617a8){return _0xe3c9a2(_0x5617a8);}pm2[_0x6544('0x4')]();return _0x4cbbfc(_0x1592ca);});});});};exports[_0x6544('0xa')]=function(_0x3178b9){return connect()['then'](function(){return new BPromise(function(_0x269b07,_0x30151a){return pm2[_0x6544('0xa')](_0x3178b9,function(_0x5daf66,_0x2d45cb){if(_0x5daf66){return _0x30151a(_0x5daf66);}pm2['disconnect']();return _0x269b07(_0x2d45cb);});});});};exports[_0x6544('0xb')]=function(){return connect()[_0x6544('0x6')](function(){return new BPromise(function(_0x443187,_0x1a3335){return pm2[_0x6544('0xb')](function(_0x736407){if(_0x736407){return _0x1a3335(_0x736407);}return _0x443187(_0x6544('0xc'));});});});}; \ No newline at end of file +var _0x14bf=['restart','list','describe','delete','dump','bluebird','./config','connect','connected','start','then','stop','disconnect'];(function(_0x9427a4,_0x221baf){var _0x5732cf=function(_0x4c50a1){while(--_0x4c50a1){_0x9427a4['push'](_0x9427a4['shift']());}};_0x5732cf(++_0x221baf);}(_0x14bf,0xbb));var _0xf14b=function(_0x1fad98,_0x516004){_0x1fad98=_0x1fad98-0x0;var _0x3d3034=_0x14bf[_0x1fad98];return _0x3d3034;};'use strict';var pm2=require('pm2');var BPromise=require(_0xf14b('0x0'));var config=require(_0xf14b('0x1'));function connect(){return new BPromise(function(_0x108af8,_0x2884b8){return pm2[_0xf14b('0x2')](function(_0xb5a0e0){if(_0xb5a0e0){return _0x2884b8(_0xb5a0e0);}return _0x108af8(_0xf14b('0x3'));});});};exports[_0xf14b('0x4')]=function(_0x56c9ad){return connect()[_0xf14b('0x5')](function(){return new BPromise(function(_0x459edb,_0x41d652){return pm2[_0xf14b('0x4')](_0x56c9ad,function(_0x1924f9,_0x59e8b8){if(_0x1924f9){return _0x41d652(_0x1924f9);}pm2['disconnect']();return _0x459edb(_0x59e8b8);});});});};exports['stop']=function(_0x9bc6fa){return connect()[_0xf14b('0x5')](function(){return new BPromise(function(_0x189827,_0x51de3e){return pm2[_0xf14b('0x6')](_0x9bc6fa,function(_0x17ff71,_0x4cb2bf){if(_0x17ff71){return _0x51de3e(_0x17ff71);}pm2[_0xf14b('0x7')]();return _0x189827(_0x4cb2bf);});});});};exports[_0xf14b('0x8')]=function(_0x4aaf35){return connect()[_0xf14b('0x5')](function(){return new BPromise(function(_0x528152,_0x40b26a){return pm2[_0xf14b('0x8')](_0x4aaf35,function(_0x1af62a,_0x1b0777){if(_0x1af62a){return _0x40b26a(_0x1af62a);}pm2[_0xf14b('0x7')]();return _0x528152(_0x1b0777);});});});};exports[_0xf14b('0x9')]=function(){return connect()[_0xf14b('0x5')](function(){return new BPromise(function(_0x1c319a,_0x3675a4){return pm2[_0xf14b('0x9')](function(_0x460b87,_0x18c15b){if(_0x460b87){return _0x3675a4(_0x460b87);}pm2['disconnect']();return _0x1c319a(_0x18c15b);});});});};exports['describe']=function(_0x411420){return connect()[_0xf14b('0x5')](function(){return new BPromise(function(_0x99e74e,_0x520b13){return pm2[_0xf14b('0xa')](_0x411420,function(_0x351c14,_0x1a213f){if(_0x351c14){return _0x520b13(_0x351c14);}pm2['disconnect']();return _0x99e74e(_0x1a213f);});});});};exports[_0xf14b('0xb')]=function(_0x1c5c73){return connect()[_0xf14b('0x5')](function(){return new BPromise(function(_0x3fdfcb,_0xaacdb1){return pm2['delete'](_0x1c5c73,function(_0x738ac9,_0x821da5){if(_0x738ac9){return _0xaacdb1(_0x738ac9);}pm2[_0xf14b('0x7')]();return _0x3fdfcb(_0x821da5);});});});};exports[_0xf14b('0xc')]=function(){return connect()[_0xf14b('0x5')](function(){return new BPromise(function(_0x8ee9b1,_0x14fa67){return pm2[_0xf14b('0xc')](function(_0x2fb247){if(_0x2fb247){return _0x14fa67(_0x2fb247);}return _0x8ee9b1('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 4bd6e63..1ec12a9 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 _0xfc2f=['update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','error','inspect','start','lodash','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','then','chatTimeout','ChatInteraction','findAll','subtract','minutes','length','map','info','join'];(function(_0x266d04,_0x3932cf){var _0x1c2550=function(_0x2fbdbd){while(--_0x2fbdbd){_0x266d04['push'](_0x266d04['shift']());}};_0x1c2550(++_0x3932cf);}(_0xfc2f,0x196));var _0xffc2=function(_0xd3dfdc,_0x3befc9){_0xd3dfdc=_0xd3dfdc-0x0;var _0x6155c0=_0xfc2f[_0xd3dfdc];return _0x6155c0;};'use strict';var _=require(_0xffc2('0x0'));var moment=require('moment');var Redis=require(_0xffc2('0x1'));var util=require(_0xffc2('0x2'));var config=require(_0xffc2('0x3'));var db=require(_0xffc2('0x4'))['db'];var logger=require(_0xffc2('0x5'))(_0xffc2('0x6'));config[_0xffc2('0x7')]=_[_0xffc2('0x8')](config[_0xffc2('0x7')],{'host':_0xffc2('0x9'),'port':0x18eb});var io=require(_0xffc2('0xa'))(new Redis(config[_0xffc2('0x7')]));function closeInteractions(){var _0x4d3f98=0x0;var _0x34b85e=[];return db[_0xffc2('0xb')][_0xffc2('0xc')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xffc2('0xd')](function(_0x2e8ad4){_0x4d3f98=_0x2e8ad4[_0xffc2('0xe')];if(_0x4d3f98){return db[_0xffc2('0xf')][_0xffc2('0x10')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xffc2('0x11')](_0x2e8ad4[_0xffc2('0xe')],_0xffc2('0x12'))}}});}else{return[];}})[_0xffc2('0xd')](function(_0x29c906){if(_0x29c906&&_0x29c906[_0xffc2('0x13')]){_0x34b85e=_[_0xffc2('0x14')](_0x29c906||[],'id');logger[_0xffc2('0x15')]('[CHAT]\x20Interactions\x20to\x20close:',_0x34b85e[_0xffc2('0x16')]());return db[_0xffc2('0xf')][_0xffc2('0x17')]({'closeReason':_0xffc2('0x18'),'disposition':_0xffc2('0x19'),'closed':!![],'closedAt':moment()[_0xffc2('0x1a')](_0xffc2('0x1b'))},{'where':{'id':_0x34b85e}});}})[_0xffc2('0xd')](function(){if(_0x34b85e&&_0x34b85e[_0xffc2('0x13')]){logger['info'](_0xffc2('0x1c'),_0x34b85e[_0xffc2('0x16')]());for(var _0x3fa066=0x0;_0x3fa066<_0x34b85e[_0xffc2('0x13')];_0x3fa066++){io[_0xffc2('0x1d')]('chatInteraction:update',{'id':_0x34b85e[_0x3fa066],'closed':!![]});}}})['catch'](function(_0x4f9808){logger[_0xffc2('0x1e')]('[CHAT]\x20Error\x20closing\x20interactions',_0x4f9808?util[_0xffc2('0x1f')](_0x4f9808,{'showHidden':![],'depth':null}):'');});}exports[_0xffc2('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x6c7e=['join','update','timeout','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','../../config/environment','../logger','schedule','redis','defaults','Setting','find','ChatInteraction','lastMsgAt','subtract','chatTimeout','length','map','info','[CHAT]\x20Interactions\x20to\x20close:'];(function(_0x24e345,_0x2ea2b7){var _0x2664cd=function(_0x6b4471){while(--_0x6b4471){_0x24e345['push'](_0x24e345['shift']());}};_0x2664cd(++_0x2ea2b7);}(_0x6c7e,0x167));var _0xe6c7=function(_0x48f2b7,_0x40f214){_0x48f2b7=_0x48f2b7-0x0;var _0x54506f=_0x6c7e[_0x48f2b7];return _0x54506f;};'use strict';var _=require(_0xe6c7('0x0'));var moment=require(_0xe6c7('0x1'));var Redis=require(_0xe6c7('0x2'));var util=require('util');var config=require(_0xe6c7('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xe6c7('0x4'))(_0xe6c7('0x5'));config[_0xe6c7('0x6')]=_[_0xe6c7('0x7')](config[_0xe6c7('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe6c7('0x6')]));function closeInteractions(){var _0x2d8ecd=0x0;var _0x37d6a5=[];return db[_0xe6c7('0x8')][_0xe6c7('0x9')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x47ec45){_0x2d8ecd=_0x47ec45['chatTimeout'];if(_0x2d8ecd){return db[_0xe6c7('0xa')]['findAll']({'raw':!![],'attributes':['id',_0xe6c7('0xb')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xe6c7('0xc')](_0x47ec45[_0xe6c7('0xd')],'minutes')}}});}else{return[];}})['then'](function(_0x3785d6){if(_0x3785d6&&_0x3785d6[_0xe6c7('0xe')]){_0x37d6a5=_[_0xe6c7('0xf')](_0x3785d6||[],'id');logger[_0xe6c7('0x10')](_0xe6c7('0x11'),_0x37d6a5[_0xe6c7('0x12')]());return db['ChatInteraction'][_0xe6c7('0x13')]({'closeReason':'system','disposition':_0xe6c7('0x14'),'closed':!![],'closedAt':moment()['format'](_0xe6c7('0x15'))},{'where':{'id':_0x37d6a5}});}})['then'](function(){if(_0x37d6a5&&_0x37d6a5['length']){logger['info'](_0xe6c7('0x16'),_0x37d6a5[_0xe6c7('0x12')]());for(var _0x176721=0x0;_0x176721<_0x37d6a5['length'];_0x176721++){io[_0xe6c7('0x17')](_0xe6c7('0x18'),{'id':_0x37d6a5[_0x176721],'closed':!![]});}}})[_0xe6c7('0x19')](function(_0x493d25){logger[_0xe6c7('0x1a')](_0xe6c7('0x1b'),_0x493d25?util['inspect'](_0x493d25,{'showHidden':![],'depth':null}):'');});}exports[_0xe6c7('0x1c')]=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 b57d52e..f070957 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 _0x2b7e=['secure','auth','user','pass','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','zip','existsSync','status','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Sent','message','attachments','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','then','error','error\x20mail','catch','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','MailServerOut','keys','map','toString','keyBy','difference','intersection','length','exists','stop','toRun','index','my\x20id','resolve','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','deleteJob','stop\x20cron','run','path','lodash','moment','cron-job-manager','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','service','Smtp','host','port'];(function(_0x530dcc,_0x4f4750){var _0x43d59c=function(_0x3e059f){while(--_0x3e059f){_0x530dcc['push'](_0x530dcc['shift']());}};_0x43d59c(++_0x4f4750);}(_0x2b7e,0xf4));var _0xe2b7=function(_0x2e3a6f,_0x1dd540){_0x2e3a6f=_0x2e3a6f-0x0;var _0x1fab60=_0x2b7e[_0x2e3a6f];return _0x1fab60;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xe2b7('0x0'));var _=require(_0xe2b7('0x1'));var moment=require(_0xe2b7('0x2'));var CronJobManager=require(_0xe2b7('0x3'));var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xe2b7('0x4'))(_0xe2b7('0x5'));var db=require(_0xe2b7('0x6'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xe2b7('0x7'));var client=jayson['client'][_0xe2b7('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2e972b,_0x640f29){return function(){logger[_0xe2b7('0x9')](_0xe2b7('0xa'),_0x2e972b[_0xe2b7('0xb')]);var _0x5c1b1c=!![];var _0x4c070e={'tls':{'rejectUnauthorized':![]}};if(_0x2e972b[_0xe2b7('0xc')]['Smtp'][_0xe2b7('0xd')]){_0x4c070e[_0xe2b7('0xd')]=_0x2e972b[_0xe2b7('0xc')][_0xe2b7('0xe')][_0xe2b7('0xd')];}else{_0x4c070e[_0xe2b7('0xf')]=_0x2e972b[_0xe2b7('0xc')]['Smtp']['host'];_0x4c070e['port']=_0x2e972b['MailAccount'][_0xe2b7('0xe')][_0xe2b7('0x10')];_0x4c070e[_0xe2b7('0x11')]=_0x2e972b['MailAccount'][_0xe2b7('0xe')]['secure'];}if(_0x2e972b[_0xe2b7('0xc')][_0xe2b7('0xe')]['authentication']){_0x4c070e[_0xe2b7('0x12')]={'user':_0x2e972b[_0xe2b7('0xc')]['Smtp'][_0xe2b7('0x13')],'pass':_0x2e972b['MailAccount'][_0xe2b7('0xe')][_0xe2b7('0x14')]};}var _0x5e2c66={'account':_0x4c070e,'message':{'from':util[_0xe2b7('0x15')](_0xe2b7('0x16'),_0x2e972b['MailAccount'][_0xe2b7('0x17')],_0x2e972b[_0xe2b7('0xc')][_0xe2b7('0xb')]||_0x2e972b[_0xe2b7('0xc')]['Smtp'][_0xe2b7('0x13')]),'to':_0x2e972b[_0xe2b7('0xb')],'cc':_0x2e972b['cc'],'bcc':_0x2e972b[_0xe2b7('0x18')],'subject':util[_0xe2b7('0x15')](_0xe2b7('0x19'),_0x640f29[_0xe2b7('0x17')],_0x2e972b[_0xe2b7('0x1a')],_0x2e972b[_0xe2b7('0x1b')])}};var _0x2ed62f=path[_0xe2b7('0x1c')](__dirname,_0xe2b7('0x1d'));var _0x473d65=_0x640f29[_0xe2b7('0x1e')];var _0x206dea=util[_0xe2b7('0x15')](_0xe2b7('0x1f'),path[_0xe2b7('0x20')](_0x640f29[_0xe2b7('0x1e')],path['extname'](_0x640f29['savename'])),_0xe2b7('0x21'));var _0x5dda40=path['join'](_0x2ed62f,_0x473d65);var _0x3773cb=path[_0xe2b7('0x1c')](_0x2ed62f,_0x206dea);if(fs[_0xe2b7('0x22')](_0x5dda40)){_0x640f29[_0xe2b7('0x23')]='Sent';_0x5e2c66['message']['attachments']=[{'filename':_0x473d65,'path':_0x5dda40}];_0x5e2c66['message']['text']=util[_0xe2b7('0x15')](_0xe2b7('0x24'),JSON[_0xe2b7('0x25')](_0x640f29,null,0x2));}else if(fs[_0xe2b7('0x22')](_0x3773cb)){_0x640f29['status']=_0xe2b7('0x26');_0x5e2c66[_0xe2b7('0x27')][_0xe2b7('0x28')]=[{'filename':_0x206dea,'path':_0x3773cb}];}else{_0x5e2c66['message'][_0xe2b7('0x29')]=_0xe2b7('0x2a');if(!_0x2e972b[_0xe2b7('0x2b')]){_0x5c1b1c=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x5c1b1c){return client[_0xe2b7('0x2c')](_0xe2b7('0x2d'),_0x5e2c66)[_0xe2b7('0x2e')](function(_0x2c79cd){if(_0x2c79cd[_0xe2b7('0x2f')]){return logger['error'](_0xe2b7('0x30'),JSON[_0xe2b7('0x25')](_0x2c79cd));}return logger[_0xe2b7('0x9')]('email\x20sent');})[_0xe2b7('0x31')](function(_0x393cd8){return logger[_0xe2b7('0x2f')](_0xe2b7('0x30'),JSON[_0xe2b7('0x25')](_0x393cd8));});}};}function handleError(){return function(_0x2688b1){return logger[_0xe2b7('0x2f')](JSON[_0xe2b7('0x25')](_0x2688b1));};}function handleResult(_0x355a44){return function(_0x35d102){logger['info']('data',JSON[_0xe2b7('0x25')](_0x35d102));if(_0x355a44[_0xe2b7('0xc')]&&_0x355a44[_0xe2b7('0xc')][_0xe2b7('0xe')]&&!_[_0xe2b7('0x32')](_0x355a44[_0xe2b7('0xb')])){setTimeout(handleSendEmail(_0x355a44,_0x35d102),0x3c*0x3e8);}};}function handleJob(_0x3d68ac){return function(){try{if(_[_0xe2b7('0x32')](_0x3d68ac[_0xe2b7('0x1a')])){return logger[_0xe2b7('0x9')](_0xe2b7('0x33'));}if(_[_0xe2b7('0x32')](_0x3d68ac[_0xe2b7('0x1b')])){return logger[_0xe2b7('0x9')](_0xe2b7('0x34'));}var _0x58ef58={'startDate':moment()[_0xe2b7('0x35')](_0x3d68ac[_0xe2b7('0x1a')],_0x3d68ac[_0xe2b7('0x1b')])['format'](_0xe2b7('0x36')),'endDate':moment()[_0xe2b7('0x15')](_0xe2b7('0x36')),'type':_0xe2b7('0x37'),'output':_0x3d68ac[_0xe2b7('0x38')],'name':_0x3d68ac[_0xe2b7('0x17')]};if(!_[_0xe2b7('0x32')](_0x3d68ac[_0xe2b7('0x39')])){logger['info'](_0xe2b7('0x3a'),_0x3d68ac[_0xe2b7('0x39')]);return analyticDefaultReportController[_0xe2b7('0x3b')]({'id':_0x3d68ac[_0xe2b7('0x39')]},_0x58ef58)[_0xe2b7('0x2e')](handleResult(_0x3d68ac))[_0xe2b7('0x31')](handleError());}if(!_[_0xe2b7('0x32')](_0x3d68ac[_0xe2b7('0x3c')])){logger[_0xe2b7('0x9')](_0xe2b7('0x3d'),_0x3d68ac[_0xe2b7('0x3c')]);return analyticCustomReportController[_0xe2b7('0x3b')]({'id':_0x3d68ac[_0xe2b7('0x3c')]},_0x58ef58)['then'](handleResult(_0x3d68ac))[_0xe2b7('0x31')](handleError());}}catch(_0x59d43e){logger[_0xe2b7('0x2f')](JSON['stringify'](_0x59d43e));}return logger[_0xe2b7('0x9')]('no\x20report\x20id');};}function getJobs(_0x46fad6){var _0x3f67c9={};if(_0x46fad6){_0x3f67c9['id']=_0x46fad6;}return db['Schedule']['findAll']({'where':_0x3f67c9,'include':[{'model':db['MailAccount'],'attributes':['id',_0xe2b7('0x17'),_0xe2b7('0xb')],'include':[{'model':db[_0xe2b7('0x3e')],'as':_0xe2b7('0xe')}]}]})[_0xe2b7('0x2e')](function(_0x2fa0fe){var _0x55b7a9=_[_0xe2b7('0x3f')](manager['jobs']);var _0x31bf16=_[_0xe2b7('0x40')](_0x2fa0fe,function(_0xe7ff29){return _0xe7ff29['id'][_0xe2b7('0x41')]();});var _0x568467=_[_0xe2b7('0x42')](_0x2fa0fe,function(_0x14d0ed){return _0x14d0ed['id'][_0xe2b7('0x41')]();});var _0x513037=_0x46fad6?_0x31bf16:_[_0xe2b7('0x43')](_0x31bf16,_0x55b7a9);var _0x43b3d3=_[_0xe2b7('0x44')](_0x31bf16,_0x55b7a9);var _0x2b60cc=_[_0xe2b7('0x43')](_0x55b7a9,_0x31bf16);var _0x4cee9c;var _0x33046b;for(_0x4cee9c=0x0;_0x4cee9c<_0x2b60cc[_0xe2b7('0x45')]&&!_0x46fad6;_0x4cee9c+=0x1){_0x33046b=_0x2b60cc[_0x4cee9c][_0xe2b7('0x41')]();if(manager[_0xe2b7('0x46')](_0x33046b)){manager[_0xe2b7('0x47')](_0x33046b);manager['deleteJob'](_0x33046b);logger[_0xe2b7('0x9')]('delete\x20cron',_0x33046b);}}logger['info'](_0xe2b7('0x48'),JSON['stringify'](_0x513037));for(_0x4cee9c=0x0;_0x4cee9c<_0x513037[_0xe2b7('0x45')];_0x4cee9c+=0x1){_0x33046b=_0x513037[_0x4cee9c][_0xe2b7('0x41')]();logger[_0xe2b7('0x9')](_0xe2b7('0x49'),_0x33046b);if(_0x46fad6){logger[_0xe2b7('0x9')](_0xe2b7('0x4a'),_0x46fad6);logger[_0xe2b7('0x9')](JSON['stringify'](_0x568467[_0x33046b]));BPromise[_0xe2b7('0x4b')]()[_0xe2b7('0x2e')](handleJob(_0x568467[_0x33046b]));logger[_0xe2b7('0x9')]('run\x20job',_0x568467[_0x33046b][_0xe2b7('0x17')],_0x568467[_0x33046b][_0xe2b7('0x4c')]);}else if(_0x568467[_0x33046b][_0xe2b7('0x4c')]&&_0x568467[_0x33046b][_0xe2b7('0x4d')]&&moment()[_0xe2b7('0x4e')](_0x568467[_0x33046b][_0xe2b7('0x4f')],_0x568467[_0x33046b][_0xe2b7('0x50')])){manager[_0xe2b7('0x51')](_0x33046b,_0x568467[_0x33046b][_0xe2b7('0x4c')],handleJob(_0x568467[_0x33046b]));manager[_0xe2b7('0x52')](_0x33046b);logger['info'](_0xe2b7('0x53'),_0x568467[_0x33046b][_0xe2b7('0x17')],_0x568467[_0x33046b][_0xe2b7('0x4c')]);}else if(manager[_0xe2b7('0x46')](_0x33046b)){manager[_0xe2b7('0x47')](_0x33046b);manager[_0xe2b7('0x54')](_0x33046b);logger[_0xe2b7('0x9')](_0xe2b7('0x55'),_0x568467[_0x33046b][_0xe2b7('0x17')],_0x568467[_0x33046b]['cron']);}}for(_0x4cee9c=0x0,_0x33046b;_0x4cee9c<_0x43b3d3[_0xe2b7('0x45')]&&!_0x46fad6;_0x4cee9c+=0x1){_0x33046b=_0x43b3d3[_0x4cee9c][_0xe2b7('0x41')]();if(manager[_0xe2b7('0x46')](_0x33046b)){if(_0x568467[_0x33046b][_0xe2b7('0x4c')]&&_0x568467[_0x33046b]['active']&&moment()[_0xe2b7('0x4e')](_0x568467[_0x33046b]['startAt'],_0x568467[_0x33046b][_0xe2b7('0x50')])){manager['update'](_0x33046b,_0x568467[_0x33046b]['cron'],handleJob(_0x568467[_0x33046b]));logger[_0xe2b7('0x9')]('update\x20cron',_0x568467[_0x33046b][_0xe2b7('0x17')],_0x568467[_0x33046b][_0xe2b7('0x4c')]);}else{manager[_0xe2b7('0x47')](_0x33046b);manager[_0xe2b7('0x54')](_0x33046b);logger[_0xe2b7('0x9')]('stop\x20cron',_0x568467[_0x33046b]['name'],_0x568467[_0x33046b][_0xe2b7('0x4c')]);}}}})[_0xe2b7('0x31')](function(_0x557132){logger['error'](JSON['stringify'](_0x557132));});}exports[_0xe2b7('0x56')]=function(_0x38719b){return getJobs(_0x38719b);};exports[_0xe2b7('0x52')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x15cf=['subtractUnit','join','savename','%s.%s','extname','zip','status','Sent','attachments','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','existsSync','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','email\x20sent','error\x20mail','stringify','data','isNil','subtractNumber','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','catch','CustomReportId','runReport','no\x20report\x20id','Schedule','findAll','MailServerOut','jobs','map','difference','toString','stop','deleteJob','delete\x20cron','length','index','resolve','cron','isBetween','startAt','start','stop\x20cron','exists','endAt','update','util','path','lodash','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s'];(function(_0x4a3596,_0x2ff011){var _0xaae322=function(_0x20a4be){while(--_0x20a4be){_0x4a3596['push'](_0x4a3596['shift']());}};_0xaae322(++_0x2ff011);}(_0x15cf,0xdf));var _0xf15c=function(_0x284506,_0x191316){_0x284506=_0x284506-0x0;var _0x1e9ee5=_0x15cf[_0x284506];return _0x1e9ee5;};'use strict';var fs=require('fs');var util=require(_0xf15c('0x0'));var path=require(_0xf15c('0x1'));var _=require(_0xf15c('0x2'));var moment=require('moment');var CronJobManager=require(_0xf15c('0x3'));var jayson=require(_0xf15c('0x4'));var BPromise=require(_0xf15c('0x5'));var logger=require(_0xf15c('0x6'))(_0xf15c('0x7'));var db=require(_0xf15c('0x8'))['db'];var analyticCustomReportController=require(_0xf15c('0x9'));var analyticDefaultReportController=require(_0xf15c('0xa'));var client=jayson[_0xf15c('0xb')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5c64cf,_0x20bf13){return function(){logger[_0xf15c('0xc')](_0xf15c('0xd'),_0x5c64cf[_0xf15c('0xe')]);var _0x57c637=!![];var _0x4cdeec={'tls':{'rejectUnauthorized':![]}};if(_0x5c64cf[_0xf15c('0xf')][_0xf15c('0x10')][_0xf15c('0x11')]){_0x4cdeec[_0xf15c('0x11')]=_0x5c64cf[_0xf15c('0xf')][_0xf15c('0x10')][_0xf15c('0x11')];}else{_0x4cdeec[_0xf15c('0x12')]=_0x5c64cf['MailAccount'][_0xf15c('0x10')][_0xf15c('0x12')];_0x4cdeec[_0xf15c('0x13')]=_0x5c64cf[_0xf15c('0xf')][_0xf15c('0x10')][_0xf15c('0x13')];_0x4cdeec[_0xf15c('0x14')]=_0x5c64cf[_0xf15c('0xf')][_0xf15c('0x10')][_0xf15c('0x14')];}if(_0x5c64cf[_0xf15c('0xf')]['Smtp'][_0xf15c('0x15')]){_0x4cdeec[_0xf15c('0x16')]={'user':_0x5c64cf[_0xf15c('0xf')][_0xf15c('0x10')][_0xf15c('0x17')],'pass':_0x5c64cf['MailAccount'][_0xf15c('0x10')]['pass']};}var _0x5f0ad3={'account':_0x4cdeec,'message':{'from':util[_0xf15c('0x18')](_0xf15c('0x19'),_0x5c64cf[_0xf15c('0xf')][_0xf15c('0x1a')],_0x5c64cf[_0xf15c('0xf')][_0xf15c('0xe')]||_0x5c64cf[_0xf15c('0xf')]['Smtp'][_0xf15c('0x17')]),'to':_0x5c64cf['email'],'cc':_0x5c64cf['cc'],'bcc':_0x5c64cf[_0xf15c('0x1b')],'subject':util[_0xf15c('0x18')](_0xf15c('0x1c'),_0x20bf13[_0xf15c('0x1a')],_0x5c64cf['subtractNumber'],_0x5c64cf[_0xf15c('0x1d')])}};var _0x18d31a=path[_0xf15c('0x1e')](__dirname,'../../files/reports');var _0x45e4d7=_0x20bf13[_0xf15c('0x1f')];var _0x5827dc=util['format'](_0xf15c('0x20'),path['basename'](_0x20bf13[_0xf15c('0x1f')],path[_0xf15c('0x21')](_0x20bf13[_0xf15c('0x1f')])),_0xf15c('0x22'));var _0x2c23c9=path[_0xf15c('0x1e')](_0x18d31a,_0x45e4d7);var _0x35f2e0=path['join'](_0x18d31a,_0x5827dc);if(fs['existsSync'](_0x2c23c9)){_0x20bf13[_0xf15c('0x23')]=_0xf15c('0x24');_0x5f0ad3['message'][_0xf15c('0x25')]=[{'filename':_0x45e4d7,'path':_0x2c23c9}];_0x5f0ad3[_0xf15c('0x26')][_0xf15c('0x27')]=util['format'](_0xf15c('0x28'),JSON['stringify'](_0x20bf13,null,0x2));}else if(fs[_0xf15c('0x29')](_0x35f2e0)){_0x20bf13['status']=_0xf15c('0x24');_0x5f0ad3['message'][_0xf15c('0x25')]=[{'filename':_0x5827dc,'path':_0x35f2e0}];}else{_0x5f0ad3[_0xf15c('0x26')][_0xf15c('0x27')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x5c64cf[_0xf15c('0x2a')]){_0x57c637=![];logger[_0xf15c('0xc')](_0xf15c('0x2b'));}}if(_0x57c637){return client[_0xf15c('0x2c')](_0xf15c('0x2d'),_0x5f0ad3)[_0xf15c('0x2e')](function(_0x3475ee){if(_0x3475ee['error']){return logger[_0xf15c('0x2f')]('error\x20mail',JSON['stringify'](_0x3475ee));}return logger['info'](_0xf15c('0x30'));})['catch'](function(_0x396a54){return logger[_0xf15c('0x2f')](_0xf15c('0x31'),JSON[_0xf15c('0x32')](_0x396a54));});}};}function handleError(){return function(_0x3923cb){return logger['error'](JSON[_0xf15c('0x32')](_0x3923cb));};}function handleResult(_0x2c0246){return function(_0x39b5fe){logger[_0xf15c('0xc')](_0xf15c('0x33'),JSON[_0xf15c('0x32')](_0x39b5fe));if(_0x2c0246[_0xf15c('0xf')]&&_0x2c0246[_0xf15c('0xf')][_0xf15c('0x10')]&&!_[_0xf15c('0x34')](_0x2c0246[_0xf15c('0xe')])){setTimeout(handleSendEmail(_0x2c0246,_0x39b5fe),0x3c*0x3e8);}};}function handleJob(_0x498279){return function(){try{if(_[_0xf15c('0x34')](_0x498279[_0xf15c('0x35')])){return logger[_0xf15c('0xc')]('subtractNumber\x20null\x20or\x20undefined');}if(_['isNil'](_0x498279['subtractUnit'])){return logger['info'](_0xf15c('0x36'));}var _0x14fb23={'startDate':moment()['subtract'](_0x498279[_0xf15c('0x35')],_0x498279[_0xf15c('0x1d')])[_0xf15c('0x18')](_0xf15c('0x37')),'endDate':moment()[_0xf15c('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xf15c('0x38'),'output':_0x498279['output'],'name':_0x498279[_0xf15c('0x1a')]};if(!_[_0xf15c('0x34')](_0x498279[_0xf15c('0x39')])){logger['info'](_0xf15c('0x3a'),_0x498279[_0xf15c('0x39')]);return analyticDefaultReportController['runReport']({'id':_0x498279[_0xf15c('0x39')]},_0x14fb23)['then'](handleResult(_0x498279))[_0xf15c('0x3b')](handleError());}if(!_['isNil'](_0x498279[_0xf15c('0x3c')])){logger[_0xf15c('0xc')]('exec\x20custom\x20report\x20id:%s',_0x498279[_0xf15c('0x3c')]);return analyticCustomReportController[_0xf15c('0x3d')]({'id':_0x498279[_0xf15c('0x3c')]},_0x14fb23)[_0xf15c('0x2e')](handleResult(_0x498279))[_0xf15c('0x3b')](handleError());}}catch(_0x2451e3){logger['error'](JSON[_0xf15c('0x32')](_0x2451e3));}return logger[_0xf15c('0xc')](_0xf15c('0x3e'));};}function getJobs(_0x1b4db0){var _0x48401f={};if(_0x1b4db0){_0x48401f['id']=_0x1b4db0;}return db[_0xf15c('0x3f')][_0xf15c('0x40')]({'where':_0x48401f,'include':[{'model':db[_0xf15c('0xf')],'attributes':['id','name','email'],'include':[{'model':db[_0xf15c('0x41')],'as':_0xf15c('0x10')}]}]})[_0xf15c('0x2e')](function(_0x2a9891){var _0x51241a=_['keys'](manager[_0xf15c('0x42')]);var _0xa0009c=_[_0xf15c('0x43')](_0x2a9891,function(_0x28a598){return _0x28a598['id']['toString']();});var _0x57f93e=_['keyBy'](_0x2a9891,function(_0x2dd22b){return _0x2dd22b['id']['toString']();});var _0x2616bd=_0x1b4db0?_0xa0009c:_['difference'](_0xa0009c,_0x51241a);var _0x2f59ca=_['intersection'](_0xa0009c,_0x51241a);var _0x4f5c8b=_[_0xf15c('0x44')](_0x51241a,_0xa0009c);var _0x17af6e;var _0x467a8d;for(_0x17af6e=0x0;_0x17af6e<_0x4f5c8b['length']&&!_0x1b4db0;_0x17af6e+=0x1){_0x467a8d=_0x4f5c8b[_0x17af6e][_0xf15c('0x45')]();if(manager['exists'](_0x467a8d)){manager[_0xf15c('0x46')](_0x467a8d);manager[_0xf15c('0x47')](_0x467a8d);logger['info'](_0xf15c('0x48'),_0x467a8d);}}logger[_0xf15c('0xc')]('toRun',JSON[_0xf15c('0x32')](_0x2616bd));for(_0x17af6e=0x0;_0x17af6e<_0x2616bd[_0xf15c('0x49')];_0x17af6e+=0x1){_0x467a8d=_0x2616bd[_0x17af6e][_0xf15c('0x45')]();logger[_0xf15c('0xc')](_0xf15c('0x4a'),_0x467a8d);if(_0x1b4db0){logger['info']('my\x20id',_0x1b4db0);logger[_0xf15c('0xc')](JSON['stringify'](_0x57f93e[_0x467a8d]));BPromise[_0xf15c('0x4b')]()[_0xf15c('0x2e')](handleJob(_0x57f93e[_0x467a8d]));logger['info']('run\x20job',_0x57f93e[_0x467a8d][_0xf15c('0x1a')],_0x57f93e[_0x467a8d]['cron']);}else if(_0x57f93e[_0x467a8d][_0xf15c('0x4c')]&&_0x57f93e[_0x467a8d]['active']&&moment()[_0xf15c('0x4d')](_0x57f93e[_0x467a8d][_0xf15c('0x4e')],_0x57f93e[_0x467a8d]['endAt'])){manager['add'](_0x467a8d,_0x57f93e[_0x467a8d][_0xf15c('0x4c')],handleJob(_0x57f93e[_0x467a8d]));manager[_0xf15c('0x4f')](_0x467a8d);logger[_0xf15c('0xc')]('add\x20cron',_0x57f93e[_0x467a8d]['name'],_0x57f93e[_0x467a8d][_0xf15c('0x4c')]);}else if(manager['exists'](_0x467a8d)){manager[_0xf15c('0x46')](_0x467a8d);manager[_0xf15c('0x47')](_0x467a8d);logger[_0xf15c('0xc')](_0xf15c('0x50'),_0x57f93e[_0x467a8d][_0xf15c('0x1a')],_0x57f93e[_0x467a8d][_0xf15c('0x4c')]);}}for(_0x17af6e=0x0,_0x467a8d;_0x17af6e<_0x2f59ca[_0xf15c('0x49')]&&!_0x1b4db0;_0x17af6e+=0x1){_0x467a8d=_0x2f59ca[_0x17af6e][_0xf15c('0x45')]();if(manager[_0xf15c('0x51')](_0x467a8d)){if(_0x57f93e[_0x467a8d][_0xf15c('0x4c')]&&_0x57f93e[_0x467a8d]['active']&&moment()['isBetween'](_0x57f93e[_0x467a8d][_0xf15c('0x4e')],_0x57f93e[_0x467a8d][_0xf15c('0x52')])){manager[_0xf15c('0x53')](_0x467a8d,_0x57f93e[_0x467a8d]['cron'],handleJob(_0x57f93e[_0x467a8d]));logger[_0xf15c('0xc')]('update\x20cron',_0x57f93e[_0x467a8d][_0xf15c('0x1a')],_0x57f93e[_0x467a8d][_0xf15c('0x4c')]);}else{manager[_0xf15c('0x46')](_0x467a8d);manager[_0xf15c('0x47')](_0x467a8d);logger[_0xf15c('0xc')](_0xf15c('0x50'),_0x57f93e[_0x467a8d][_0xf15c('0x1a')],_0x57f93e[_0x467a8d][_0xf15c('0x4c')]);}}}})[_0xf15c('0x3b')](function(_0x43f368){logger['error'](JSON[_0xf15c('0x32')](_0x43f368));});}exports['run']=function(_0x2be1c6){return getJobs(_0x2be1c6);};exports[_0xf15c('0x4f')]=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 9f17b14..1196d3b 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 _0x0a6b=['forEach','all','catch','start','lodash','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','Comprehend','detectSentiment','substring','info','format','transcribeName','data1','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','Sequelize','ValidationError','Transcript\x20not\x20available','CloudProvider','findOne','data2','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','resolve','language','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','Mixed','name','SequelizeValidationError','error','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','bucket','Transcribe\x20not\x20configured'];(function(_0x58f991,_0x46b264){var _0x3345db=function(_0x440f46){while(--_0x440f46){_0x58f991['push'](_0x58f991['shift']());}};_0x3345db(++_0x46b264);}(_0x0a6b,0x120));var _0xb0a6=function(_0x12ff13,_0x18398b){_0x12ff13=_0x12ff13-0x0;var _0xc74ebd=_0x0a6b[_0x12ff13];return _0xc74ebd;};var _=require(_0xb0a6('0x0'));var AWS=require('aws-sdk');var rp=require(_0xb0a6('0x1'));var util=require(_0xb0a6('0x2'));var BPromise=require(_0xb0a6('0x3'));var db=require(_0xb0a6('0x4'))['db'];var logger=require(_0xb0a6('0x5'))(_0xb0a6('0x6'));function getTranscriptionJob(_0x39d403,_0xa2c294,_0xbb5821,_0x38079a){return new Promise(function(_0x4b47bc,_0x30b3b7){var _0x504a45=new AWS[(_0xb0a6('0x7'))]({'accessKeyId':_0xa2c294,'secretAccessKey':_0x39d403,'region':_0xbb5821});_0x504a45['getTranscriptionJob']({'TranscriptionJobName':_0x38079a},function(_0x597b68,_0xdaa894){if(_0x597b68){return _0x30b3b7(_0x597b68);}else{return _0x4b47bc(_0xdaa894);}});});}function sentiment(_0x527f2a,_0x26fb4c,_0x423683,_0x549cc4,_0x41e68d){return new Promise(function(_0x30150c,_0x5cd9b3){var _0x1245ab=new AWS[(_0xb0a6('0x8'))]({'accessKeyId':_0x26fb4c,'secretAccessKey':_0x527f2a,'region':_0x423683});_0x1245ab[_0xb0a6('0x9')]({'Text':_0x549cc4,'LanguageCode':_0x41e68d[_0xb0a6('0xa')](0x0,0x2)},function(_0x275fc2,_0x37fdf8){if(_0x275fc2){return _0x5cd9b3(_0x275fc2);}else{return _0x30150c(_0x37fdf8);}});});}function checkTranscribeJob(_0x45e4b4,_0xda8c5f,_0x4b3a7e){var _0x2184f4;return new BPromise(function(_0x4495d6,_0x3db39b){logger[_0xb0a6('0xb')](util[_0xb0a6('0xc')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x45e4b4['id'],_0x45e4b4[_0xb0a6('0xd')]));return getTranscriptionJob(_0x4b3a7e[_0xb0a6('0xe')],_0x4b3a7e['data2'],_0xda8c5f[_0xb0a6('0xf')],_0x45e4b4['transcribeName'])['then'](function(_0x214699){logger[_0xb0a6('0xb')](util[_0xb0a6('0xc')](_0xb0a6('0x10'),_0x45e4b4['id'],_0x45e4b4[_0xb0a6('0xd')],_0x214699[_0xb0a6('0x11')][_0xb0a6('0x12')]));if(!_0x45e4b4[_0xb0a6('0x13')]){switch(_0x214699[_0xb0a6('0x11')][_0xb0a6('0x12')]){case _0xb0a6('0x14'):var _0x57bf27={'transcribeStatus':_0x214699['TranscriptionJob'][_0xb0a6('0x12')],'fileUri':_0x214699[_0xb0a6('0x11')]['Transcript'][_0xb0a6('0x15')]};logger['info'](util[_0xb0a6('0xc')](_0xb0a6('0x16'),_0x45e4b4['id']));return rp({'uri':_0x214699[_0xb0a6('0x11')][_0xb0a6('0x17')]['TranscriptFileUri'],'json':!![]})[_0xb0a6('0x18')](function(_0x5e9765){logger[_0xb0a6('0xb')](util[_0xb0a6('0xc')](_0xb0a6('0x19'),_0x45e4b4['id']));if(_0x5e9765&&_0x5e9765[_0xb0a6('0x1a')]&&_0x5e9765[_0xb0a6('0x1a')][_0xb0a6('0x1b')]&&_0x5e9765['results'][_0xb0a6('0x1b')][_0xb0a6('0x1c')]){_0x57bf27[_0xb0a6('0x13')]='';for(var _0x2e5101=0x0;_0x2e5101<_0x5e9765[_0xb0a6('0x1a')]['transcripts'][_0xb0a6('0x1c')];_0x2e5101++){_0x57bf27[_0xb0a6('0x13')]+=_0x5e9765[_0xb0a6('0x1a')]['transcripts'][_0x2e5101][_0xb0a6('0x1d')]+'';}}return _0x45e4b4[_0xb0a6('0x1e')](_0x57bf27);})['then'](function(){logger[_0xb0a6('0xb')](util[_0xb0a6('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x45e4b4['id']));if(!_0x45e4b4['tempSentiment']){throw new db['Sequelize']['ValidationError'](_0xb0a6('0x1f'));}if(!_0xda8c5f[_0xb0a6('0x20')]||!_0xda8c5f[_0xb0a6('0x21')]||!_0xda8c5f[_0xb0a6('0x22')]||!_0xda8c5f['language']||!_0xda8c5f['bucket']){throw new db[(_0xb0a6('0x23'))][(_0xb0a6('0x24'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x57bf27[_0xb0a6('0x13')]){throw new Error(_0xb0a6('0x25'));}if(_0xda8c5f['sentimentAccountId']===_0x4b3a7e['id']){return _0x4b3a7e;}else{return db[_0xb0a6('0x26')][_0xb0a6('0x27')]({'where':{'id':_settings[_0xb0a6('0x21')]}});}})[_0xb0a6('0x18')](function(_0x5a1427){if(!_0x5a1427){throw new db[(_0xb0a6('0x23'))][(_0xb0a6('0x24'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5a1427['data1']||!_0x5a1427[_0xb0a6('0x28')]){throw new db[(_0xb0a6('0x23'))][(_0xb0a6('0x24'))]('Cloud\x20Provider\x20not\x20configured');}_0x2184f4=_0x5a1427;logger[_0xb0a6('0xb')](util[_0xb0a6('0xc')](_0xb0a6('0x29'),_0x45e4b4['id']));return sentiment(_0x2184f4[_0xb0a6('0xe')],_0x2184f4[_0xb0a6('0x28')],_0xda8c5f['sentimentRegion'],_0x57bf27[_0xb0a6('0x13')],_0xda8c5f['language']);})[_0xb0a6('0x18')](function(_0x5331d4){logger[_0xb0a6('0xb')](util[_0xb0a6('0xc')](_0xb0a6('0x2a'),_0x45e4b4['id']));return _0x45e4b4[_0xb0a6('0x1e')]({'sentiment':_0x5331d4[_0xb0a6('0x2b')],'sPositive':_0x5331d4[_0xb0a6('0x2c')][_0xb0a6('0x2d')],'sNegative':_0x5331d4[_0xb0a6('0x2c')][_0xb0a6('0x2e')],'sMixed':_0x5331d4[_0xb0a6('0x2c')]['Mixed'],'sNeutral':_0x5331d4['SentimentScore'][_0xb0a6('0x2f')]});})['then'](function(){logger[_0xb0a6('0xb')](util[_0xb0a6('0xc')](_0xb0a6('0x30'),_0x45e4b4['id']));_0x4495d6();});case _0xb0a6('0x31'):return _0x45e4b4['update']({'transcribeStatus':_0xb0a6('0x31'),'failureReason':_0x214699[_0xb0a6('0x11')]['FailureReason']})[_0xb0a6('0x18')](function(){logger[_0xb0a6('0xb')](util[_0xb0a6('0xc')](_0xb0a6('0x30'),_0x45e4b4['id']));_0x4495d6();});default:logger['info'](util[_0xb0a6('0xc')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x45e4b4['id']));break;}}else{return BPromise[_0xb0a6('0x32')]()[_0xb0a6('0x18')](function(){if(!_0x45e4b4['tempSentiment']){throw new db[(_0xb0a6('0x23'))]['ValidationError'](_0xb0a6('0x1f'));}if(!_0xda8c5f['sentiment']||!_0xda8c5f[_0xb0a6('0x21')]||!_0xda8c5f[_0xb0a6('0x22')]||!_0xda8c5f[_0xb0a6('0x33')]||!_0xda8c5f['bucket']){throw new db[(_0xb0a6('0x23'))]['ValidationError'](_0xb0a6('0x34'));}if(!_0x45e4b4[_0xb0a6('0x13')]){throw new Error(_0xb0a6('0x25'));}if(_0xda8c5f[_0xb0a6('0x21')]===_0x4b3a7e['id']){return _0x4b3a7e;}else{return db[_0xb0a6('0x26')][_0xb0a6('0x27')]({'where':{'id':_settings[_0xb0a6('0x21')]}});}})['then'](function(_0x167112){if(!_0x167112){throw new db['Sequelize'][(_0xb0a6('0x24'))](_0xb0a6('0x35'));}if(!_0x167112[_0xb0a6('0xe')]||!_0x167112[_0xb0a6('0x28')]){throw new db['Sequelize']['ValidationError'](_0xb0a6('0x36'));}_0x2184f4=_0x167112;logger[_0xb0a6('0xb')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x45e4b4['id']));return sentiment(_0x2184f4[_0xb0a6('0xe')],_0x2184f4[_0xb0a6('0x28')],_0xda8c5f['sentimentRegion'],_0x45e4b4['fileText'],_0xda8c5f[_0xb0a6('0x33')]);})[_0xb0a6('0x18')](function(_0x887e16){logger[_0xb0a6('0xb')](util[_0xb0a6('0xc')](_0xb0a6('0x2a'),_0x45e4b4['id']));return _0x45e4b4[_0xb0a6('0x1e')]({'sentiment':_0x887e16['Sentiment'],'sPositive':_0x887e16[_0xb0a6('0x2c')][_0xb0a6('0x2d')],'sNegative':_0x887e16['SentimentScore'][_0xb0a6('0x2e')],'sMixed':_0x887e16['SentimentScore'][_0xb0a6('0x37')],'sNeutral':_0x887e16[_0xb0a6('0x2c')][_0xb0a6('0x2f')],'transcribeStatus':'COMPLETED'});})['then'](function(){logger[_0xb0a6('0xb')](util[_0xb0a6('0xc')](_0xb0a6('0x30'),_0x45e4b4['id']));_0x4495d6();});}})['catch'](function(_0x408593){if(_0x408593){if(!_0x408593[_0xb0a6('0x38')]||_0x408593['name']!==_0xb0a6('0x39')){logger[_0xb0a6('0x3a')](util[_0xb0a6('0xc')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x45e4b4['id']),util[_0xb0a6('0x3b')](_0x408593,{'showHidden':![],'depth':null}));}}_0x4495d6();});});}function checkTranscribe(){var _0x46c87b;var _0x4b6fc3;var _0x58d1f3;return db[_0xb0a6('0x3c')]['findAll']({'where':{'transcribeStatus':_0xb0a6('0x3d')}})['then'](function(_0x5d902d){if(!_0x5d902d||!_0x5d902d[_0xb0a6('0x1c')]){throw new db[(_0xb0a6('0x23'))][(_0xb0a6('0x24'))](_0xb0a6('0x3e'));}_0x46c87b=_0x5d902d;return db[_0xb0a6('0x3f')][_0xb0a6('0x27')]({'where':{'id':0x1}});})[_0xb0a6('0x18')](function(_0x1f3410){if(!_0x1f3410){throw new db[(_0xb0a6('0x23'))][(_0xb0a6('0x24'))](_0xb0a6('0x40'));}_0x4b6fc3=_0x1f3410;if(!_0x4b6fc3[_0xb0a6('0x6')]||!_0x4b6fc3['transcribeAccountId']||!_0x4b6fc3[_0xb0a6('0xf')]||!_0x4b6fc3[_0xb0a6('0x33')]||!_0x4b6fc3[_0xb0a6('0x41')]){throw new db['Sequelize'][(_0xb0a6('0x24'))](_0xb0a6('0x42'));}return db[_0xb0a6('0x26')][_0xb0a6('0x27')]({'where':{'id':_0x4b6fc3['transcribeAccountId']}});})[_0xb0a6('0x18')](function(_0x537735){if(!_0x537735){throw new db[(_0xb0a6('0x23'))]['ValidationError'](_0xb0a6('0x35'));}if(!_0x537735[_0xb0a6('0xe')]||!_0x537735[_0xb0a6('0x28')]){throw new db[(_0xb0a6('0x23'))][(_0xb0a6('0x24'))](_0xb0a6('0x36'));}_0x58d1f3=_0x537735;var _0x49793c=[];_0x46c87b[_0xb0a6('0x43')](function(_0x53aa22){_0x49793c['push'](checkTranscribeJob(_0x53aa22,_0x4b6fc3,_0x58d1f3));});return BPromise[_0xb0a6('0x44')](_0x49793c);})[_0xb0a6('0x45')](function(_0x2674c6){if(_0x2674c6){if(!_0x2674c6['name']||_0x2674c6[_0xb0a6('0x38')]!=='SequelizeValidationError'){logger[_0xb0a6('0x3a')](util[_0xb0a6('0x3b')](_0x2674c6,{'showHidden':![],'depth':null}));}}});}exports[_0xb0a6('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xcd4d=['Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','Cloud\x20Provider\x20not\x20available','forEach','push','all','start','lodash','aws-sdk','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','substring','info','format','data1','data2','transcribeRegion','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','language','bucket','Sentiment\x20Analysis\x20not\x20configured','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Mixed','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','Transcript\x20not\x20available','Positive','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check'];(function(_0x3bab71,_0x243959){var _0x29f2f9=function(_0x375aca){while(--_0x375aca){_0x3bab71['push'](_0x3bab71['shift']());}};_0x29f2f9(++_0x243959);}(_0xcd4d,0xe4));var _0xdcd4=function(_0x569c8c,_0x3c6aae){_0x569c8c=_0x569c8c-0x0;var _0x20fb5b=_0xcd4d[_0x569c8c];return _0x20fb5b;};var _=require(_0xdcd4('0x0'));var AWS=require(_0xdcd4('0x1'));var rp=require('request-promise');var util=require(_0xdcd4('0x2'));var BPromise=require(_0xdcd4('0x3'));var db=require(_0xdcd4('0x4'))['db'];var logger=require(_0xdcd4('0x5'))(_0xdcd4('0x6'));function getTranscriptionJob(_0x13b4e2,_0x413630,_0xc810e9,_0x10f6dd){return new Promise(function(_0x24d664,_0x1fb75e){var _0x302b60=new AWS[(_0xdcd4('0x7'))]({'accessKeyId':_0x413630,'secretAccessKey':_0x13b4e2,'region':_0xc810e9});_0x302b60[_0xdcd4('0x8')]({'TranscriptionJobName':_0x10f6dd},function(_0x198d6c,_0xc0cf59){if(_0x198d6c){return _0x1fb75e(_0x198d6c);}else{return _0x24d664(_0xc0cf59);}});});}function sentiment(_0x482c4f,_0x3b8480,_0x3cae6d,_0x56f35b,_0x3cbcec){return new Promise(function(_0x961547,_0x47549c){var _0x35e653=new AWS[(_0xdcd4('0x9'))]({'accessKeyId':_0x3b8480,'secretAccessKey':_0x482c4f,'region':_0x3cae6d});_0x35e653['detectSentiment']({'Text':_0x56f35b,'LanguageCode':_0x3cbcec[_0xdcd4('0xa')](0x0,0x2)},function(_0x2e5246,_0x575cc8){if(_0x2e5246){return _0x47549c(_0x2e5246);}else{return _0x961547(_0x575cc8);}});});}function checkTranscribeJob(_0x3291a6,_0x2bf080,_0x553279){var _0x12af2b;return new BPromise(function(_0x4a1181,_0x5235a4){logger[_0xdcd4('0xb')](util[_0xdcd4('0xc')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x3291a6['id'],_0x3291a6['transcribeName']));return getTranscriptionJob(_0x553279[_0xdcd4('0xd')],_0x553279[_0xdcd4('0xe')],_0x2bf080[_0xdcd4('0xf')],_0x3291a6[_0xdcd4('0x10')])[_0xdcd4('0x11')](function(_0x3a1d3a){logger[_0xdcd4('0xb')](util[_0xdcd4('0xc')](_0xdcd4('0x12'),_0x3291a6['id'],_0x3291a6[_0xdcd4('0x10')],_0x3a1d3a[_0xdcd4('0x13')]['TranscriptionJobStatus']));if(!_0x3291a6['fileText']){switch(_0x3a1d3a[_0xdcd4('0x13')][_0xdcd4('0x14')]){case _0xdcd4('0x15'):var _0x2cab1e={'transcribeStatus':_0x3a1d3a[_0xdcd4('0x13')][_0xdcd4('0x14')],'fileUri':_0x3a1d3a[_0xdcd4('0x13')][_0xdcd4('0x16')][_0xdcd4('0x17')]};logger[_0xdcd4('0xb')](util[_0xdcd4('0xc')](_0xdcd4('0x18'),_0x3291a6['id']));return rp({'uri':_0x3a1d3a[_0xdcd4('0x13')][_0xdcd4('0x16')][_0xdcd4('0x17')],'json':!![]})['then'](function(_0x21a330){logger[_0xdcd4('0xb')](util['format'](_0xdcd4('0x19'),_0x3291a6['id']));if(_0x21a330&&_0x21a330[_0xdcd4('0x1a')]&&_0x21a330[_0xdcd4('0x1a')]['transcripts']&&_0x21a330[_0xdcd4('0x1a')][_0xdcd4('0x1b')][_0xdcd4('0x1c')]){_0x2cab1e['fileText']='';for(var _0x44dc04=0x0;_0x44dc04<_0x21a330[_0xdcd4('0x1a')]['transcripts'][_0xdcd4('0x1c')];_0x44dc04++){_0x2cab1e[_0xdcd4('0x1d')]+=_0x21a330[_0xdcd4('0x1a')][_0xdcd4('0x1b')][_0x44dc04][_0xdcd4('0x1e')]+'';}}return _0x3291a6[_0xdcd4('0x1f')](_0x2cab1e);})[_0xdcd4('0x11')](function(){logger[_0xdcd4('0xb')](util['format'](_0xdcd4('0x20'),_0x3291a6['id']));if(!_0x3291a6['tempSentiment']){throw new db[(_0xdcd4('0x21'))][(_0xdcd4('0x22'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x2bf080['sentiment']||!_0x2bf080['sentimentAccountId']||!_0x2bf080['sentimentRegion']||!_0x2bf080[_0xdcd4('0x23')]||!_0x2bf080[_0xdcd4('0x24')]){throw new db[(_0xdcd4('0x21'))]['ValidationError'](_0xdcd4('0x25'));}if(!_0x2cab1e[_0xdcd4('0x1d')]){throw new Error('Transcript\x20not\x20available');}if(_0x2bf080[_0xdcd4('0x26')]===_0x553279['id']){return _0x553279;}else{return db[_0xdcd4('0x27')][_0xdcd4('0x28')]({'where':{'id':_settings[_0xdcd4('0x26')]}});}})[_0xdcd4('0x11')](function(_0x236c20){if(!_0x236c20){throw new db['Sequelize'][(_0xdcd4('0x22'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x236c20[_0xdcd4('0xd')]||!_0x236c20[_0xdcd4('0xe')]){throw new db[(_0xdcd4('0x21'))][(_0xdcd4('0x22'))](_0xdcd4('0x29'));}_0x12af2b=_0x236c20;logger['info'](util['format'](_0xdcd4('0x2a'),_0x3291a6['id']));return sentiment(_0x12af2b[_0xdcd4('0xd')],_0x12af2b[_0xdcd4('0xe')],_0x2bf080['sentimentRegion'],_0x2cab1e[_0xdcd4('0x1d')],_0x2bf080[_0xdcd4('0x23')]);})['then'](function(_0x5aa417){logger[_0xdcd4('0xb')](util[_0xdcd4('0xc')](_0xdcd4('0x2b'),_0x3291a6['id']));return _0x3291a6[_0xdcd4('0x1f')]({'sentiment':_0x5aa417[_0xdcd4('0x2c')],'sPositive':_0x5aa417[_0xdcd4('0x2d')]['Positive'],'sNegative':_0x5aa417[_0xdcd4('0x2d')]['Negative'],'sMixed':_0x5aa417[_0xdcd4('0x2d')][_0xdcd4('0x2e')],'sNeutral':_0x5aa417[_0xdcd4('0x2d')]['Neutral']});})[_0xdcd4('0x11')](function(){logger[_0xdcd4('0xb')](util[_0xdcd4('0xc')](_0xdcd4('0x20'),_0x3291a6['id']));_0x4a1181();});case'FAILED':return _0x3291a6['update']({'transcribeStatus':'FAILED','failureReason':_0x3a1d3a[_0xdcd4('0x13')]['FailureReason']})[_0xdcd4('0x11')](function(){logger[_0xdcd4('0xb')](util[_0xdcd4('0xc')](_0xdcd4('0x20'),_0x3291a6['id']));_0x4a1181();});default:logger[_0xdcd4('0xb')](util[_0xdcd4('0xc')](_0xdcd4('0x2f'),_0x3291a6['id']));break;}}else{return BPromise[_0xdcd4('0x30')]()['then'](function(){if(!_0x3291a6[_0xdcd4('0x31')]){throw new db['Sequelize'][(_0xdcd4('0x22'))](_0xdcd4('0x32'));}if(!_0x2bf080[_0xdcd4('0x33')]||!_0x2bf080['sentimentAccountId']||!_0x2bf080[_0xdcd4('0x34')]||!_0x2bf080[_0xdcd4('0x23')]||!_0x2bf080[_0xdcd4('0x24')]){throw new db[(_0xdcd4('0x21'))][(_0xdcd4('0x22'))](_0xdcd4('0x25'));}if(!_0x3291a6['fileText']){throw new Error(_0xdcd4('0x35'));}if(_0x2bf080[_0xdcd4('0x26')]===_0x553279['id']){return _0x553279;}else{return db['CloudProvider'][_0xdcd4('0x28')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xdcd4('0x11')](function(_0x131ef4){if(!_0x131ef4){throw new db[(_0xdcd4('0x21'))][(_0xdcd4('0x22'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x131ef4[_0xdcd4('0xd')]||!_0x131ef4[_0xdcd4('0xe')]){throw new db['Sequelize'][(_0xdcd4('0x22'))](_0xdcd4('0x29'));}_0x12af2b=_0x131ef4;logger[_0xdcd4('0xb')](util[_0xdcd4('0xc')](_0xdcd4('0x2a'),_0x3291a6['id']));return sentiment(_0x12af2b[_0xdcd4('0xd')],_0x12af2b[_0xdcd4('0xe')],_0x2bf080[_0xdcd4('0x34')],_0x3291a6[_0xdcd4('0x1d')],_0x2bf080[_0xdcd4('0x23')]);})[_0xdcd4('0x11')](function(_0x520625){logger[_0xdcd4('0xb')](util[_0xdcd4('0xc')](_0xdcd4('0x2b'),_0x3291a6['id']));return _0x3291a6[_0xdcd4('0x1f')]({'sentiment':_0x520625[_0xdcd4('0x2c')],'sPositive':_0x520625[_0xdcd4('0x2d')][_0xdcd4('0x36')],'sNegative':_0x520625['SentimentScore']['Negative'],'sMixed':_0x520625[_0xdcd4('0x2d')]['Mixed'],'sNeutral':_0x520625['SentimentScore']['Neutral'],'transcribeStatus':'COMPLETED'});})[_0xdcd4('0x11')](function(){logger[_0xdcd4('0xb')](util['format'](_0xdcd4('0x20'),_0x3291a6['id']));_0x4a1181();});}})[_0xdcd4('0x37')](function(_0x2ef5ba){if(_0x2ef5ba){if(!_0x2ef5ba['name']||_0x2ef5ba[_0xdcd4('0x38')]!==_0xdcd4('0x39')){logger[_0xdcd4('0x3a')](util[_0xdcd4('0xc')](_0xdcd4('0x3b'),_0x3291a6['id']),util[_0xdcd4('0x3c')](_0x2ef5ba,{'showHidden':![],'depth':null}));}}_0x4a1181();});});}function checkTranscribe(){var _0x330ca2;var _0x17b7a7;var _0x942d98;return db[_0xdcd4('0x3d')]['findAll']({'where':{'transcribeStatus':_0xdcd4('0x3e')}})[_0xdcd4('0x11')](function(_0x34f096){if(!_0x34f096||!_0x34f096[_0xdcd4('0x1c')]){throw new db[(_0xdcd4('0x21'))]['ValidationError'](_0xdcd4('0x3f'));}_0x330ca2=_0x34f096;return db[_0xdcd4('0x40')]['findOne']({'where':{'id':0x1}});})['then'](function(_0x5a1695){if(!_0x5a1695){throw new db[(_0xdcd4('0x21'))]['ValidationError'](_0xdcd4('0x41'));}_0x17b7a7=_0x5a1695;if(!_0x17b7a7[_0xdcd4('0x6')]||!_0x17b7a7[_0xdcd4('0x42')]||!_0x17b7a7[_0xdcd4('0xf')]||!_0x17b7a7['language']||!_0x17b7a7[_0xdcd4('0x24')]){throw new db[(_0xdcd4('0x21'))]['ValidationError'](_0xdcd4('0x43'));}return db[_0xdcd4('0x27')][_0xdcd4('0x28')]({'where':{'id':_0x17b7a7[_0xdcd4('0x42')]}});})['then'](function(_0x4ce6bc){if(!_0x4ce6bc){throw new db[(_0xdcd4('0x21'))][(_0xdcd4('0x22'))](_0xdcd4('0x44'));}if(!_0x4ce6bc[_0xdcd4('0xd')]||!_0x4ce6bc[_0xdcd4('0xe')]){throw new db['Sequelize'][(_0xdcd4('0x22'))]('Cloud\x20Provider\x20not\x20configured');}_0x942d98=_0x4ce6bc;var _0x3b133b=[];_0x330ca2[_0xdcd4('0x45')](function(_0x3592b3){_0x3b133b[_0xdcd4('0x46')](checkTranscribeJob(_0x3592b3,_0x17b7a7,_0x942d98));});return BPromise[_0xdcd4('0x47')](_0x3b133b);})['catch'](function(_0x57bad1){if(_0x57bad1){if(!_0x57bad1['name']||_0x57bad1[_0xdcd4('0x38')]!==_0xdcd4('0x39')){logger[_0xdcd4('0x3a')](util[_0xdcd4('0x3c')](_0x57bad1,{'showHidden':![],'depth':null}));}}});}exports[_0xdcd4('0x48')]=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 6a5688c..373c624 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 _0x9d1a=['then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','WhatsappInteraction','lastMsgAt','subtract'];(function(_0x20dd9b,_0x3c0fb8){var _0x2de3b0=function(_0x5673d2){while(--_0x5673d2){_0x20dd9b['push'](_0x20dd9b['shift']());}};_0x2de3b0(++_0x3c0fb8);}(_0x9d1a,0xa7));var _0xa9d1=function(_0x4731b0,_0x384141){_0x4731b0=_0x4731b0-0x0;var _0x4a5525=_0x9d1a[_0x4731b0];return _0x4a5525;};'use strict';var _=require(_0xa9d1('0x0'));var moment=require('moment');var Redis=require(_0xa9d1('0x1'));var util=require(_0xa9d1('0x2'));var config=require(_0xa9d1('0x3'));var db=require(_0xa9d1('0x4'))['db'];var logger=require(_0xa9d1('0x5'))(_0xa9d1('0x6'));config[_0xa9d1('0x7')]=_[_0xa9d1('0x8')](config[_0xa9d1('0x7')],{'host':_0xa9d1('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa9d1('0x7')]));function closeInteractions(){var _0x54f8a2=[];return db[_0xa9d1('0xa')]['findAll']({'raw':!![],'attributes':['id',_0xa9d1('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xa9d1('0xc')](0x18,'hours')}}})[_0xa9d1('0xd')](function(_0x493cfe){if(_0x493cfe&&_0x493cfe[_0xa9d1('0xe')]){_0x54f8a2=_['map'](_0x493cfe||[],'id');logger[_0xa9d1('0xf')](_0xa9d1('0x10'),_0x54f8a2[_0xa9d1('0x11')]());return db[_0xa9d1('0xa')][_0xa9d1('0x12')]({'closeReason':_0xa9d1('0x13'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xa9d1('0x14')](_0xa9d1('0x15'))},{'where':{'id':_0x54f8a2}});}})[_0xa9d1('0xd')](function(){if(_0x54f8a2&&_0x54f8a2[_0xa9d1('0xe')]){logger[_0xa9d1('0xf')](_0xa9d1('0x16'),_0x54f8a2[_0xa9d1('0x11')]());for(var _0x559ac3=0x0;_0x559ac3<_0x54f8a2[_0xa9d1('0xe')];_0x559ac3++){io[_0xa9d1('0x17')](_0xa9d1('0x18'),{'id':_0x54f8a2[_0x559ac3],'closed':!![]});}}})[_0xa9d1('0x19')](function(_0x272cbd){logger[_0xa9d1('0x1a')](_0xa9d1('0x1b'),_0x272cbd?util[_0xa9d1('0x1c')](_0x272cbd,{'showHidden':![],'depth':null}):'');});}exports[_0xa9d1('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x1279=['socket.io-emitter','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','ioredis','util','../../mysqldb','schedule','redis','defaults','localhost'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1279,0x1b9));var _0x9127=function(_0x40b0b8,_0x1a43ff){_0x40b0b8=_0x40b0b8-0x0;var _0x914584=_0x1279[_0x40b0b8];return _0x914584;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0x9127('0x0'));var util=require(_0x9127('0x1'));var config=require('../../config/environment');var db=require(_0x9127('0x2'))['db'];var logger=require('../logger')(_0x9127('0x3'));config[_0x9127('0x4')]=_[_0x9127('0x5')](config[_0x9127('0x4')],{'host':_0x9127('0x6'),'port':0x18eb});var io=require(_0x9127('0x7'))(new Redis(config[_0x9127('0x4')]));function closeInteractions(){var _0x837d13=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x9127('0x8')](0x18,_0x9127('0x9'))}}})[_0x9127('0xa')](function(_0x39f174){if(_0x39f174&&_0x39f174[_0x9127('0xb')]){_0x837d13=_[_0x9127('0xc')](_0x39f174||[],'id');logger[_0x9127('0xd')](_0x9127('0xe'),_0x837d13[_0x9127('0xf')]());return db[_0x9127('0x10')]['update']({'closeReason':_0x9127('0x11'),'disposition':_0x9127('0x12'),'closed':!![],'closedAt':moment()[_0x9127('0x13')](_0x9127('0x14'))},{'where':{'id':_0x837d13}});}})[_0x9127('0xa')](function(){if(_0x837d13&&_0x837d13[_0x9127('0xb')]){logger[_0x9127('0xd')](_0x9127('0x15'),_0x837d13[_0x9127('0xf')]());for(var _0x47dbff=0x0;_0x47dbff<_0x837d13['length'];_0x47dbff++){io[_0x9127('0x16')](_0x9127('0x17'),{'id':_0x837d13[_0x47dbff],'closed':!![]});}}})[_0x9127('0x18')](function(_0x1461db){logger[_0x9127('0x19')](_0x9127('0x1a'),_0x1461db?util[_0x9127('0x1b')](_0x1461db,{'showHidden':![],'depth':null}):'');});}exports['start']=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 c9ac209..018e266 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfebb=['bulkCreate','finished\x20populating','CmHopper','then','log','hopper1','contacts2','hopper2','util','../mysqldb','push','Innocenzo','Biondo','@xcally.com','now','innocenzo.biondo','CmContact','destroy'];(function(_0x297eea,_0x5060be){var _0x1c42d2=function(_0x3afff4){while(--_0x3afff4){_0x297eea['push'](_0x297eea['shift']());}};_0x1c42d2(++_0x5060be);}(_0xfebb,0xbc));var _0xbfeb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfebb[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xbfeb('0x0'));var db=require(_0xbfeb('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xbfeb('0x2')]({'id':i,'firstName':_0xbfeb('0x3')+i,'lastName':_0xbfeb('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xbfeb('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xbfeb('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xbfeb('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xbfeb('0x6')](),'updatedAt':Date[_0xbfeb('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xbfeb('0x2')]({'id':i,'firstName':_0xbfeb('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xbfeb('0x7')+i+_0xbfeb('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xbfeb('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xbfeb('0x6')](),'updatedAt':Date['now']()});}db[_0xbfeb('0x8')][_0xbfeb('0x9')]({'where':{}})['then'](function(){return db[_0xbfeb('0x8')][_0xbfeb('0xa')](contacts);})['then'](function(){console['log'](_0xbfeb('0xb'),'contacts1');return db[_0xbfeb('0xc')][_0xbfeb('0x9')]({'where':{}});})[_0xbfeb('0xd')](function(){return db['CmHopper'][_0xbfeb('0xa')](hopper);})[_0xbfeb('0xd')](function(){console[_0xbfeb('0xe')]('finished\x20populating',_0xbfeb('0xf'));return db[_0xbfeb('0x8')]['bulkCreate'](contacts2);})['then'](function(){console['log'](_0xbfeb('0xb'),_0xbfeb('0x10'));return db['CmHopper']['bulkCreate'](hopper2);})['then'](function(){console[_0xbfeb('0xe')](_0xbfeb('0xb'),_0xbfeb('0x11'));})['catch'](function(_0x2594ee){console[_0xbfeb('0xe')](_0x2594ee);}); \ No newline at end of file +var _0x5af4=['Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','push','CmContact','destroy','then','bulkCreate','finished\x20populating','contacts1','CmHopper','log','hopper1','catch','util'];(function(_0xb86247,_0x25f5de){var _0x18f3a7=function(_0x7c55fb){while(--_0x7c55fb){_0xb86247['push'](_0xb86247['shift']());}};_0x18f3a7(++_0x25f5de);}(_0x5af4,0x1db));var _0x45af=function(_0x4f0ec2,_0x2333e9){_0x4f0ec2=_0x4f0ec2-0x0;var _0x5f2e8a=_0x5af4[_0x4f0ec2];return _0x5f2e8a;};'use strict';var util=require(_0x45af('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x45af('0x1')+i,'lastName':_0x45af('0x2')+i,'phone':0xf879fb460+i,'email':_0x45af('0x3')+i+_0x45af('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x45af('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x45af('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x45af('0x6')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x45af('0x2')+i,'phone':0xf879fb460+i,'email':_0x45af('0x3')+i+_0x45af('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x45af('0x6')]({'id':i,'active':![],'scheduledat':Date[_0x45af('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x45af('0x5')](),'updatedAt':Date['now']()});}db[_0x45af('0x7')][_0x45af('0x8')]({'where':{}})[_0x45af('0x9')](function(){return db['CmContact'][_0x45af('0xa')](contacts);})[_0x45af('0x9')](function(){console['log'](_0x45af('0xb'),_0x45af('0xc'));return db[_0x45af('0xd')][_0x45af('0x8')]({'where':{}});})['then'](function(){return db[_0x45af('0xd')]['bulkCreate'](hopper);})['then'](function(){console[_0x45af('0xe')](_0x45af('0xb'),_0x45af('0xf'));return db[_0x45af('0x7')]['bulkCreate'](contacts2);})['then'](function(){console['log'](_0x45af('0xb'),'contacts2');return db['CmHopper'][_0x45af('0xa')](hopper2);})[_0x45af('0x9')](function(){console[_0x45af('0xe')]('finished\x20populating','hopper2');})[_0x45af('0x10')](function(_0x201e1a){console[_0x45af('0xe')](_0x201e1a);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 03673cc..fc053c3 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x47fc=['agent','format','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','%s%s'];(function(_0x5ecdf4,_0x430c66){var _0x457191=function(_0x579ce0){while(--_0x579ce0){_0x5ecdf4['push'](_0x5ecdf4['shift']());}};_0x457191(++_0x430c66);}(_0x47fc,0x15d));var _0xc47f=function(_0x284145,_0x5a7ef0){_0x284145=_0x284145-0x0;var _0x24c78c=_0x47fc[_0x284145];return _0x24c78c;};'use strict';var util=require(_0xc47f('0x0'));var db=require(_0xc47f('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format'](_0xc47f('0x2'),'agent',i),'fullname':util['format'](_0xc47f('0x2'),_0xc47f('0x3'),i),'email':util[_0xc47f('0x4')](_0xc47f('0x5'),_0xc47f('0x3'),i),'role':_0xc47f('0x3'),'password':_0xc47f('0x6'),'internal':0xfa0+i,'type':_0xc47f('0x7'),'transport':[_0xc47f('0x8'),'ws',_0xc47f('0x9')],'disallow':[_0xc47f('0xa')],'allow':[_0xc47f('0xb')],'defaultuser':util[_0xc47f('0x4')](_0xc47f('0x2'),_0xc47f('0x3'),i),'encryption':_0xc47f('0xc'),'avpf':_0xc47f('0xc'),'force_avp':_0xc47f('0xc'),'icesupport':_0xc47f('0xc'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xc47f('0xd'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0xc47f('0xe'),'callerid':util[_0xc47f('0x4')](_0xc47f('0xf'),util[_0xc47f('0x4')]('%s%s','agent',i),0xfa0+i)});}db[_0xc47f('0x10')][_0xc47f('0x11')](users)[_0xc47f('0x12')](function(){console[_0xc47f('0x13')](_0xc47f('0x14'));})[_0xc47f('0x15')](function(_0x43c3cd){console[_0xc47f('0x13')](_0x43c3cd);}); \ No newline at end of file +var _0x7ec2=['agent','format','%s%s@xcally.com','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','%s%s'];(function(_0x5e7b6c,_0x4916d0){var _0x3afdbd=function(_0x648ee6){while(--_0x648ee6){_0x5e7b6c['push'](_0x5e7b6c['shift']());}};_0x3afdbd(++_0x4916d0);}(_0x7ec2,0x18c));var _0x27ec=function(_0x4dc58b,_0x216379){_0x4dc58b=_0x4dc58b-0x0;var _0x32dde8=_0x7ec2[_0x4dc58b];return _0x32dde8;};'use strict';var util=require(_0x27ec('0x0'));var db=require(_0x27ec('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format'](_0x27ec('0x2'),'agent',i),'fullname':util['format']('%s%s',_0x27ec('0x3'),i),'email':util[_0x27ec('0x4')](_0x27ec('0x5'),_0x27ec('0x3'),i),'role':'agent','password':'password','internal':0xfa0+i,'type':_0x27ec('0x6'),'transport':[_0x27ec('0x7'),'ws',_0x27ec('0x8')],'disallow':[_0x27ec('0x9')],'allow':[_0x27ec('0xa')],'defaultuser':util[_0x27ec('0x4')](_0x27ec('0x2'),'agent',i),'encryption':'yes','avpf':_0x27ec('0xb'),'force_avp':_0x27ec('0xb'),'icesupport':_0x27ec('0xb'),'dtlsenable':_0x27ec('0xb'),'dtlsverify':'no','dtlscertfile':_0x27ec('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x27ec('0xd'),'callerid':util[_0x27ec('0x4')]('\x22%s\x22\x20<%s>',util[_0x27ec('0x4')]('%s%s',_0x27ec('0x3'),i),0xfa0+i)});}db['User'][_0x27ec('0xe')](users)[_0x27ec('0xf')](function(){console[_0x27ec('0x10')](_0x27ec('0x11'));})[_0x27ec('0x12')](function(_0x1999ca){console[_0x27ec('0x10')](_0x1999ca);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index f77eb2d..4119959 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd0bb=['trunk:%s','campaign:%s:%s','leave','map','removeChatInteractions','user_has_chat_interactions:remove','removeFaxInteractions','emit','user_has_fax_interactions:remove','removeSmsInteractions','OpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join','connection','setMaxListeners','address','request','remotePort','SocketIO\x20','nsp','DISCONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','User','role','type','UserProfileSection','findOne','then','autoAssociation','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','where','telephone','Campaign','ivr','format','%s:queue:%s','Agents','length','user:%s','handshake','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','push','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','FaxQueues','agent','getVoiceQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s'];(function(_0x19b5c9,_0x437794){var _0x4243e4=function(_0x9c68e3){while(--_0x9c68e3){_0x19b5c9['push'](_0x19b5c9['shift']());}};_0x4243e4(++_0x437794);}(_0xd0bb,0x1a8));var _0xbd0b=function(_0x1e0d54,_0x46fbec){_0x1e0d54=_0x1e0d54-0x0;var _0x244204=_0xd0bb[_0x1e0d54];return _0x244204;};'use strict';var _=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var BPromise=require(_0xbd0b('0x2'));var db=require(_0xbd0b('0x3'))['db'];var config=require(_0xbd0b('0x4'));var queryQueues={'attributes':['id',_0xbd0b('0x5')],'include':[{'as':'Agents','model':db[_0xbd0b('0x6')],'attributes':['id',_0xbd0b('0x5'),_0xbd0b('0x7')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xbd0b('0x5')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xbd0b('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0xbd0b('0x5')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xbd0b('0x5'),_0xbd0b('0x8')],'where':{'type':'ivr'}};function getAssociatedResources(_0x200ecb,_0x2f14d5,_0x564b5d){return db[_0xbd0b('0x9')][_0xbd0b('0xa')]({'where':{'name':_0x200ecb,'userProfileId':_0x2f14d5},'raw':!![]})[_0xbd0b('0xb')](function(_0x432c48){if(_0x432c48){if(_0x432c48[_0xbd0b('0xc')]){switch(_0x200ecb){case'VoiceQueues':case'ChatQueues':case'FaxQueues':case _0xbd0b('0xd'):case _0xbd0b('0xe'):case _0xbd0b('0xf'):case _0xbd0b('0x10'):return db[_0x564b5d][_0xbd0b('0x11')](queryQueues);case _0xbd0b('0x12'):return db[_0x564b5d][_0xbd0b('0x11')](queryTelephones);case _0xbd0b('0x13'):return db[_0x564b5d][_0xbd0b('0x11')](queryTrunks);case _0xbd0b('0x14'):return db[_0x564b5d]['findAll'](queryCampaigns);}}else{return db[_0xbd0b('0x15')][_0xbd0b('0x11')]({'attributes':['resourceId'],'where':{'sectionId':_0x432c48['id']},'raw':!![]})[_0xbd0b('0xb')](function(_0x40dc51){if(_0x40dc51){var _0x4514ec={'where':{'id':_['map'](_0x40dc51,_0xbd0b('0x16'))},'raw':!![]};switch(_0x564b5d){case _0xbd0b('0x6'):_0x4514ec[_0xbd0b('0x17')][_0xbd0b('0x7')]=_0xbd0b('0x18');break;case _0xbd0b('0x19'):_0x4514ec[_0xbd0b('0x17')][_0xbd0b('0x8')]=_0xbd0b('0x1a');break;}return db[_0x564b5d][_0xbd0b('0x11')](_0x4514ec);}else{return[];}});}}else{return[];}})['then'](function(_0x525d01){return _0x525d01;});}function joinOrLeaveQueues(_0x4e1676,_0xed0bfd,_0x23455f,_0x5ef63e){_0x4e1676[_0xed0bfd](util[_0xbd0b('0x1b')](_0xbd0b('0x1c'),_0x23455f,_0x5ef63e[_0xbd0b('0x5')]));if(_0x5ef63e[_0xbd0b('0x1d')]){for(var _0x3c27d2=0x0;_0x3c27d2<_0x5ef63e[_0xbd0b('0x1d')][_0xbd0b('0x1e')];_0x3c27d2+=0x1){_0x4e1676[_0xed0bfd](util[_0xbd0b('0x1b')](_0xbd0b('0x1f'),_0x5ef63e[_0xbd0b('0x1d')][_0x3c27d2][_0xbd0b('0x5')]));}}}function joinOrLeave(_0x495210,_0x4ef8e1,_0x740e69){var _0x222901;if(_0x495210[_0xbd0b('0x20')]['query']['id']){db[_0xbd0b('0x6')][_0xbd0b('0x21')]({'attributes':['id',_0xbd0b('0x5'),_0xbd0b('0x7'),_0xbd0b('0x22')],'where':{'id':_0x495210[_0xbd0b('0x20')]['query']['id']},'include':[{'model':db[_0xbd0b('0x23')],'as':_0xbd0b('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xbd0b('0x25')],'as':_0xbd0b('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xbd0b('0x27')],'as':_0xbd0b('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xbd0b('0x29')],'as':_0xbd0b('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0xbd0b('0x2b')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xbd0b('0x2c')],'as':_0xbd0b('0x2d'),'attributes':['id'],'raw':!![]}]})[_0xbd0b('0xb')](function(_0x3732e7){if(_0x3732e7){_0x222901=_0x3732e7;_0x495210[_0x4ef8e1](util[_0xbd0b('0x1b')](_0xbd0b('0x1f'),_0x3732e7[_0xbd0b('0x5')]));var _0x8f4e86=[];switch(_0x3732e7['role']){case _0xbd0b('0x2e'):_0x495210[_0x4ef8e1](_0xbd0b('0x2f'));_0x495210[_0x4ef8e1](_0xbd0b('0x30'));if(queryQueues[_0xbd0b('0x31')](_0xbd0b('0x32'))){delete queryQueues[_0xbd0b('0x32')];}_0x8f4e86['push'](db[_0xbd0b('0x33')][_0xbd0b('0x11')](queryQueues));_0x8f4e86['push'](db[_0xbd0b('0x34')]['findAll'](queryQueues));_0x8f4e86['push'](db[_0xbd0b('0x35')][_0xbd0b('0x11')](queryQueues));_0x8f4e86['push'](db[_0xbd0b('0x36')]['findAll'](queryQueues));_0x8f4e86[_0xbd0b('0x37')](db[_0xbd0b('0x38')][_0xbd0b('0x11')](queryQueues));_0x8f4e86[_0xbd0b('0x37')](db[_0xbd0b('0x39')]['findAll'](queryQueues));_0x8f4e86[_0xbd0b('0x37')](db[_0xbd0b('0x3a')][_0xbd0b('0x11')](queryQueues));_0x8f4e86[_0xbd0b('0x37')](db[_0xbd0b('0x6')][_0xbd0b('0x11')](queryTelephones));_0x8f4e86['push'](db[_0xbd0b('0x3b')]['findAll'](queryTrunks));_0x8f4e86[_0xbd0b('0x37')](db['Campaign'][_0xbd0b('0x11')](queryCampaigns));_0x8f4e86['push'](db['User'][_0xbd0b('0x11')](queryAgents));break;case _0xbd0b('0x3c'):_0x495210[_0x4ef8e1]('voice:inbound');_0x495210[_0x4ef8e1](_0xbd0b('0x30'));_0x8f4e86['push'](getAssociatedResources('VoiceQueues',_0x3732e7['userProfileId'],_0xbd0b('0x33')));_0x8f4e86[_0xbd0b('0x37')](getAssociatedResources('ChatQueues',_0x3732e7[_0xbd0b('0x22')],_0xbd0b('0x34')));_0x8f4e86[_0xbd0b('0x37')](getAssociatedResources(_0xbd0b('0x3d'),_0x3732e7['userProfileId'],_0xbd0b('0x35')));_0x8f4e86['push'](getAssociatedResources(_0xbd0b('0xd'),_0x3732e7[_0xbd0b('0x22')],_0xbd0b('0x36')));_0x8f4e86[_0xbd0b('0x37')](getAssociatedResources(_0xbd0b('0xe'),_0x3732e7[_0xbd0b('0x22')],_0xbd0b('0x38')));_0x8f4e86[_0xbd0b('0x37')](getAssociatedResources(_0xbd0b('0xf'),_0x3732e7[_0xbd0b('0x22')],_0xbd0b('0x39')));_0x8f4e86[_0xbd0b('0x37')](getAssociatedResources(_0xbd0b('0x10'),_0x3732e7['userProfileId'],'WhatsappQueue'));_0x8f4e86['push'](getAssociatedResources(_0xbd0b('0x12'),_0x3732e7[_0xbd0b('0x22')],_0xbd0b('0x6')));_0x8f4e86['push'](getAssociatedResources(_0xbd0b('0x13'),_0x3732e7['userProfileId'],_0xbd0b('0x3b')));_0x8f4e86[_0xbd0b('0x37')](getAssociatedResources(_0xbd0b('0x14'),_0x3732e7[_0xbd0b('0x22')],_0xbd0b('0x19')));_0x8f4e86['push'](db['User']['findAll'](queryAgents));break;case _0xbd0b('0x3e'):_0x495210[_0x4ef8e1](_0xbd0b('0x2f'));_0x495210[_0x4ef8e1](_0xbd0b('0x30'));_0x8f4e86[_0xbd0b('0x37')](_0x3732e7[_0xbd0b('0x3f')]({'attributes':['id',_0xbd0b('0x5')]}));_0x8f4e86[_0xbd0b('0x37')](_0x3732e7['getChatQueues']({'attributes':['id',_0xbd0b('0x5')]}));_0x8f4e86['push'](_0x3732e7[_0xbd0b('0x40')]({'attributes':['id',_0xbd0b('0x5')]}));_0x8f4e86['push'](_0x3732e7['getSmsQueues']({'attributes':['id',_0xbd0b('0x5')]}));_0x8f4e86[_0xbd0b('0x37')](_0x3732e7[_0xbd0b('0x41')]({'attributes':['id',_0xbd0b('0x5')]}));_0x8f4e86['push'](_0x3732e7[_0xbd0b('0x42')]({'attributes':['id','name']}));_0x8f4e86[_0xbd0b('0x37')](_0x3732e7[_0xbd0b('0x43')]({'attributes':['id',_0xbd0b('0x5')]}));break;}return BPromise['all'](_0x8f4e86);}})[_0xbd0b('0xb')](function(_0x231673){if(_0x231673&&_0x231673['length']){for(var _0x5dba32=0x0;_0x5dba32<_0x231673[_0xbd0b('0x1e')];_0x5dba32+=0x1){for(var _0x29fb0b=0x0;_0x29fb0b<_0x231673[_0x5dba32][_0xbd0b('0x1e')];_0x29fb0b+=0x1){switch(_0x5dba32){case 0x0:joinOrLeaveQueues(_0x495210,_0x4ef8e1,_0xbd0b('0x44'),_0x231673[_0x5dba32][_0x29fb0b]);break;case 0x1:joinOrLeaveQueues(_0x495210,_0x4ef8e1,_0xbd0b('0x45'),_0x231673[_0x5dba32][_0x29fb0b]);break;case 0x2:joinOrLeaveQueues(_0x495210,_0x4ef8e1,_0xbd0b('0x46'),_0x231673[_0x5dba32][_0x29fb0b]);break;case 0x3:joinOrLeaveQueues(_0x495210,_0x4ef8e1,_0xbd0b('0x47'),_0x231673[_0x5dba32][_0x29fb0b]);break;case 0x4:joinOrLeaveQueues(_0x495210,_0x4ef8e1,_0xbd0b('0x48'),_0x231673[_0x5dba32][_0x29fb0b]);break;case 0x5:joinOrLeaveQueues(_0x495210,_0x4ef8e1,_0xbd0b('0x49'),_0x231673[_0x5dba32][_0x29fb0b]);break;case 0x6:joinOrLeaveQueues(_0x495210,_0x4ef8e1,_0xbd0b('0x4a'),_0x231673[_0x5dba32][_0x29fb0b]);break;case 0x7:if(_0x222901[_0xbd0b('0x7')]!==_0xbd0b('0x3e'))_0x495210[_0x4ef8e1](util[_0xbd0b('0x1b')](_0xbd0b('0x4b'),_0x231673[_0x5dba32][_0x29fb0b]['name']));break;case 0x8:if(_0x222901[_0xbd0b('0x7')]!==_0xbd0b('0x3e'))_0x495210[_0x4ef8e1](util[_0xbd0b('0x1b')](_0xbd0b('0x4c'),_0x231673[_0x5dba32][_0x29fb0b][_0xbd0b('0x5')]));break;case 0x9:if(_0x222901[_0xbd0b('0x7')]!==_0xbd0b('0x3e'))_0x495210[_0x4ef8e1](util[_0xbd0b('0x1b')](_0xbd0b('0x4d'),_0x231673[_0x5dba32][_0x29fb0b][_0xbd0b('0x8')],_0x231673[_0x5dba32][_0x29fb0b][_0xbd0b('0x5')]));break;case 0xa:_0x495210[_0x4ef8e1](util[_0xbd0b('0x1b')]('user:%s',_0x231673[_0x5dba32][_0x29fb0b][_0xbd0b('0x5')]));break;}}}}})[_0xbd0b('0xb')](function(){if(_0x4ef8e1===_0xbd0b('0x4e')){var _0x2a5950=_[_0xbd0b('0x4f')](_0x222901[_0xbd0b('0x24')],'id');return _0x222901[_0xbd0b('0x50')](_0x2a5950)[_0xbd0b('0xb')](function(){for(var _0x2b43f6=0x0;_0x2b43f6<_0x2a5950[_0xbd0b('0x1e')];_0x2b43f6+=0x1){_0x740e69['emit'](_0xbd0b('0x51'),{'ChatInteractionId':Number(_0x2a5950[_0x2b43f6]),'UserId':Number(_0x222901['id'])});}});}})[_0xbd0b('0xb')](function(){if(_0x4ef8e1===_0xbd0b('0x4e')){var _0x32bed1=_[_0xbd0b('0x4f')](_0x222901[_0xbd0b('0x26')],'id');return _0x222901['removeMailInteractions'](_0x32bed1)[_0xbd0b('0xb')](function(){for(var _0x478dd0=0x0;_0x478dd0<_0x32bed1[_0xbd0b('0x1e')];_0x478dd0+=0x1){_0x740e69['emit']('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x32bed1[_0x478dd0]),'UserId':Number(_0x222901['id'])});}});}})[_0xbd0b('0xb')](function(){if(_0x4ef8e1===_0xbd0b('0x4e')){var _0x520587=_[_0xbd0b('0x4f')](_0x222901['FaxInteractions'],'id');return _0x222901[_0xbd0b('0x52')](_0x520587)[_0xbd0b('0xb')](function(){for(var _0x357ac0=0x0;_0x357ac0<_0x520587[_0xbd0b('0x1e')];_0x357ac0+=0x1){_0x740e69[_0xbd0b('0x53')](_0xbd0b('0x54'),{'FaxInteractionId':Number(_0x520587[_0x357ac0]),'UserId':Number(_0x222901['id'])});}});}})[_0xbd0b('0xb')](function(){if(_0x4ef8e1==='leave'){var _0x461f8f=_[_0xbd0b('0x4f')](_0x222901[_0xbd0b('0x2a')],'id');return _0x222901[_0xbd0b('0x55')](_0x461f8f)[_0xbd0b('0xb')](function(){for(var _0x2836ff=0x0;_0x2836ff<_0x461f8f['length'];_0x2836ff+=0x1){_0x740e69[_0xbd0b('0x53')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x461f8f[_0x2836ff]),'UserId':Number(_0x222901['id'])});}});}})[_0xbd0b('0xb')](function(){if(_0x4ef8e1===_0xbd0b('0x4e')){var _0x233c44=_[_0xbd0b('0x4f')](_0x222901[_0xbd0b('0x56')],'id');return _0x222901['removeOpenchannelInteractions'](_0x233c44)['then'](function(){for(var _0x2ffe1f=0x0;_0x2ffe1f<_0x233c44[_0xbd0b('0x1e')];_0x2ffe1f+=0x1){_0x740e69[_0xbd0b('0x53')](_0xbd0b('0x57'),{'OpenchannelInteractionId':Number(_0x233c44[_0x2ffe1f]),'UserId':Number(_0x222901['id'])});}});}})['then'](function(){if(_0x4ef8e1==='leave'){var _0x57540f=_[_0xbd0b('0x4f')](_0x222901[_0xbd0b('0x2d')],'id');return _0x222901[_0xbd0b('0x58')](_0x57540f)[_0xbd0b('0xb')](function(){for(var _0x3e7d6f=0x0;_0x3e7d6f<_0x57540f[_0xbd0b('0x1e')];_0x3e7d6f+=0x1){_0x740e69[_0xbd0b('0x53')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x57540f[_0x3e7d6f]),'UserId':Number(_0x222901['id'])});}});}})[_0xbd0b('0x59')](function(_0x1130af){_0x495210[_0xbd0b('0x5a')](_0x1130af);});}}function onDisconnect(_0x5b717f,_0xe8a91){joinOrLeave(_0x5b717f,_0xbd0b('0x4e'),_0xe8a91);}function onConnect(_0x27ff11){joinOrLeave(_0x27ff11,_0xbd0b('0x5b'));}exports['default']=function(_0x1858d1){_0x1858d1['on'](_0xbd0b('0x5c'),function(_0x45e155){_0x45e155[_0xbd0b('0x5d')](0x0);_0x45e155[_0xbd0b('0x5e')]=_0x45e155[_0xbd0b('0x5f')][_0xbd0b('0x5c')]['remoteAddress']+':'+_0x45e155[_0xbd0b('0x5f')][_0xbd0b('0x5c')][_0xbd0b('0x60')];_0x45e155['connectedAt']=new Date();_0x45e155['log']=function(_0x1bef9c){console[_0xbd0b('0x5a')](_0xbd0b('0x61')+_0x45e155[_0xbd0b('0x62')][_0xbd0b('0x5')]+'['+_0x45e155[_0xbd0b('0x5e')]+']',_0x1bef9c);};_0x45e155['on']('disconnect',function(){onDisconnect(_0x45e155,_0x1858d1);_0x45e155['log'](_0xbd0b('0x63'));});onConnect(_0x45e155);_0x45e155[_0xbd0b('0x5a')]('CONNECTED');});}; \ No newline at end of file +var _0x6144=['ChatQueues','SmsQueue','WhatsappQueues','IvrCampaigns','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','map','removeChatInteractions','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','emit','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','setMaxListeners','address','request','connection','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','lodash','util','bluebird','../mysqldb','name','Agents','User','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','Telephones','findAll','Trunks','UserProfileResource','resourceId','where','role','Campaign','format','%s:queue:%s','length','user:%s','handshake','find','userProfileId','query','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk'];(function(_0xb20413,_0x39efa3){var _0x3228cf=function(_0x2c3704){while(--_0x2c3704){_0xb20413['push'](_0xb20413['shift']());}};_0x3228cf(++_0x39efa3);}(_0x6144,0x99));var _0x4614=function(_0x201bf9,_0x3e985b){_0x201bf9=_0x201bf9-0x0;var _0xe8386d=_0x6144[_0x201bf9];return _0xe8386d;};'use strict';var _=require(_0x4614('0x0'));var util=require(_0x4614('0x1'));var BPromise=require(_0x4614('0x2'));var db=require(_0x4614('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x4614('0x4')],'include':[{'as':_0x4614('0x5'),'model':db[_0x4614('0x6')],'attributes':['id',_0x4614('0x4'),'role'],'raw':!![],'where':{'role':_0x4614('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x4614('0x4')],'where':{'role':_0x4614('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x4614('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x4614('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x4614('0x4'),_0x4614('0x9')],'where':{'type':_0x4614('0xa')}};function getAssociatedResources(_0x13b585,_0x54d480,_0x3c3afa){return db[_0x4614('0xb')][_0x4614('0xc')]({'where':{'name':_0x13b585,'userProfileId':_0x54d480},'raw':!![]})[_0x4614('0xd')](function(_0x270e8d){if(_0x270e8d){if(_0x270e8d[_0x4614('0xe')]){switch(_0x13b585){case _0x4614('0xf'):case'ChatQueues':case _0x4614('0x10'):case _0x4614('0x11'):case _0x4614('0x12'):case _0x4614('0x13'):case'WhatsappQueues':return db[_0x3c3afa]['findAll'](queryQueues);case _0x4614('0x14'):return db[_0x3c3afa][_0x4614('0x15')](queryTelephones);case _0x4614('0x16'):return db[_0x3c3afa]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0x3c3afa]['findAll'](queryCampaigns);}}else{return db[_0x4614('0x17')][_0x4614('0x15')]({'attributes':['resourceId'],'where':{'sectionId':_0x270e8d['id']},'raw':!![]})[_0x4614('0xd')](function(_0x186f89){if(_0x186f89){var _0x237ee6={'where':{'id':_['map'](_0x186f89,_0x4614('0x18'))},'raw':!![]};switch(_0x3c3afa){case _0x4614('0x6'):_0x237ee6[_0x4614('0x19')][_0x4614('0x1a')]=_0x4614('0x8');break;case _0x4614('0x1b'):_0x237ee6['where'][_0x4614('0x9')]=_0x4614('0xa');break;}return db[_0x3c3afa]['findAll'](_0x237ee6);}else{return[];}});}}else{return[];}})[_0x4614('0xd')](function(_0x2ed97c){return _0x2ed97c;});}function joinOrLeaveQueues(_0x27de9,_0x5986d0,_0x52ec09,_0x37b40f){_0x27de9[_0x5986d0](util[_0x4614('0x1c')](_0x4614('0x1d'),_0x52ec09,_0x37b40f['name']));if(_0x37b40f[_0x4614('0x5')]){for(var _0x5c0f26=0x0;_0x5c0f26<_0x37b40f['Agents'][_0x4614('0x1e')];_0x5c0f26+=0x1){_0x27de9[_0x5986d0](util[_0x4614('0x1c')](_0x4614('0x1f'),_0x37b40f['Agents'][_0x5c0f26][_0x4614('0x4')]));}}}function joinOrLeave(_0x3326ee,_0x35038b,_0x5ee455){var _0x341fa5;if(_0x3326ee[_0x4614('0x20')]['query']['id']){db[_0x4614('0x6')][_0x4614('0x21')]({'attributes':['id',_0x4614('0x4'),'role',_0x4614('0x22')],'where':{'id':_0x3326ee['handshake'][_0x4614('0x23')]['id']},'include':[{'model':db[_0x4614('0x24')],'as':_0x4614('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x4614('0x26')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x4614('0x27')],'as':_0x4614('0x28'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x4614('0x29')],'as':_0x4614('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x4614('0x2b')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x4614('0xd')](function(_0xc57a63){if(_0xc57a63){_0x341fa5=_0xc57a63;_0x3326ee[_0x35038b](util[_0x4614('0x1c')](_0x4614('0x1f'),_0xc57a63[_0x4614('0x4')]));var _0x123feb=[];switch(_0xc57a63[_0x4614('0x1a')]){case _0x4614('0x2c'):_0x3326ee[_0x35038b](_0x4614('0x2d'));_0x3326ee[_0x35038b](_0x4614('0x2e'));if(queryQueues[_0x4614('0x2f')]('include')){delete queryQueues[_0x4614('0x30')];}_0x123feb[_0x4614('0x31')](db[_0x4614('0x32')][_0x4614('0x15')](queryQueues));_0x123feb['push'](db[_0x4614('0x33')]['findAll'](queryQueues));_0x123feb[_0x4614('0x31')](db[_0x4614('0x34')][_0x4614('0x15')](queryQueues));_0x123feb[_0x4614('0x31')](db['SmsQueue'][_0x4614('0x15')](queryQueues));_0x123feb[_0x4614('0x31')](db[_0x4614('0x35')]['findAll'](queryQueues));_0x123feb['push'](db[_0x4614('0x36')][_0x4614('0x15')](queryQueues));_0x123feb['push'](db[_0x4614('0x37')]['findAll'](queryQueues));_0x123feb[_0x4614('0x31')](db[_0x4614('0x6')][_0x4614('0x15')](queryTelephones));_0x123feb[_0x4614('0x31')](db[_0x4614('0x38')]['findAll'](queryTrunks));_0x123feb['push'](db[_0x4614('0x1b')]['findAll'](queryCampaigns));_0x123feb['push'](db[_0x4614('0x6')][_0x4614('0x15')](queryAgents));break;case'user':_0x3326ee[_0x35038b](_0x4614('0x2d'));_0x3326ee[_0x35038b](_0x4614('0x2e'));_0x123feb[_0x4614('0x31')](getAssociatedResources(_0x4614('0xf'),_0xc57a63[_0x4614('0x22')],_0x4614('0x32')));_0x123feb[_0x4614('0x31')](getAssociatedResources(_0x4614('0x39'),_0xc57a63[_0x4614('0x22')],_0x4614('0x33')));_0x123feb[_0x4614('0x31')](getAssociatedResources(_0x4614('0x10'),_0xc57a63[_0x4614('0x22')],_0x4614('0x34')));_0x123feb['push'](getAssociatedResources(_0x4614('0x11'),_0xc57a63[_0x4614('0x22')],_0x4614('0x3a')));_0x123feb[_0x4614('0x31')](getAssociatedResources(_0x4614('0x12'),_0xc57a63['userProfileId'],_0x4614('0x35')));_0x123feb['push'](getAssociatedResources(_0x4614('0x13'),_0xc57a63[_0x4614('0x22')],_0x4614('0x36')));_0x123feb[_0x4614('0x31')](getAssociatedResources(_0x4614('0x3b'),_0xc57a63[_0x4614('0x22')],_0x4614('0x37')));_0x123feb['push'](getAssociatedResources(_0x4614('0x14'),_0xc57a63[_0x4614('0x22')],_0x4614('0x6')));_0x123feb['push'](getAssociatedResources(_0x4614('0x16'),_0xc57a63[_0x4614('0x22')],'Trunk'));_0x123feb[_0x4614('0x31')](getAssociatedResources(_0x4614('0x3c'),_0xc57a63[_0x4614('0x22')],'Campaign'));_0x123feb['push'](db[_0x4614('0x6')][_0x4614('0x15')](queryAgents));break;case _0x4614('0x7'):_0x3326ee[_0x35038b](_0x4614('0x2d'));_0x3326ee[_0x35038b](_0x4614('0x2e'));_0x123feb[_0x4614('0x31')](_0xc57a63['getVoiceQueues']({'attributes':['id',_0x4614('0x4')]}));_0x123feb[_0x4614('0x31')](_0xc57a63[_0x4614('0x3d')]({'attributes':['id',_0x4614('0x4')]}));_0x123feb[_0x4614('0x31')](_0xc57a63[_0x4614('0x3e')]({'attributes':['id','name']}));_0x123feb[_0x4614('0x31')](_0xc57a63[_0x4614('0x3f')]({'attributes':['id',_0x4614('0x4')]}));_0x123feb[_0x4614('0x31')](_0xc57a63[_0x4614('0x40')]({'attributes':['id',_0x4614('0x4')]}));_0x123feb[_0x4614('0x31')](_0xc57a63[_0x4614('0x41')]({'attributes':['id',_0x4614('0x4')]}));_0x123feb['push'](_0xc57a63[_0x4614('0x42')]({'attributes':['id','name']}));break;}return BPromise[_0x4614('0x43')](_0x123feb);}})[_0x4614('0xd')](function(_0x3dc3a0){if(_0x3dc3a0&&_0x3dc3a0['length']){for(var _0x54503c=0x0;_0x54503c<_0x3dc3a0[_0x4614('0x1e')];_0x54503c+=0x1){for(var _0x40f724=0x0;_0x40f724<_0x3dc3a0[_0x54503c][_0x4614('0x1e')];_0x40f724+=0x1){switch(_0x54503c){case 0x0:joinOrLeaveQueues(_0x3326ee,_0x35038b,_0x4614('0x44'),_0x3dc3a0[_0x54503c][_0x40f724]);break;case 0x1:joinOrLeaveQueues(_0x3326ee,_0x35038b,'chat',_0x3dc3a0[_0x54503c][_0x40f724]);break;case 0x2:joinOrLeaveQueues(_0x3326ee,_0x35038b,'fax',_0x3dc3a0[_0x54503c][_0x40f724]);break;case 0x3:joinOrLeaveQueues(_0x3326ee,_0x35038b,'sms',_0x3dc3a0[_0x54503c][_0x40f724]);break;case 0x4:joinOrLeaveQueues(_0x3326ee,_0x35038b,_0x4614('0x45'),_0x3dc3a0[_0x54503c][_0x40f724]);break;case 0x5:joinOrLeaveQueues(_0x3326ee,_0x35038b,_0x4614('0x46'),_0x3dc3a0[_0x54503c][_0x40f724]);break;case 0x6:joinOrLeaveQueues(_0x3326ee,_0x35038b,_0x4614('0x47'),_0x3dc3a0[_0x54503c][_0x40f724]);break;case 0x7:if(_0x341fa5[_0x4614('0x1a')]!==_0x4614('0x7'))_0x3326ee[_0x35038b](util[_0x4614('0x1c')](_0x4614('0x48'),_0x3dc3a0[_0x54503c][_0x40f724][_0x4614('0x4')]));break;case 0x8:if(_0x341fa5[_0x4614('0x1a')]!=='agent')_0x3326ee[_0x35038b](util['format'](_0x4614('0x49'),_0x3dc3a0[_0x54503c][_0x40f724][_0x4614('0x4')]));break;case 0x9:if(_0x341fa5['role']!==_0x4614('0x7'))_0x3326ee[_0x35038b](util['format'](_0x4614('0x4a'),_0x3dc3a0[_0x54503c][_0x40f724][_0x4614('0x9')],_0x3dc3a0[_0x54503c][_0x40f724][_0x4614('0x4')]));break;case 0xa:_0x3326ee[_0x35038b](util[_0x4614('0x1c')]('user:%s',_0x3dc3a0[_0x54503c][_0x40f724]['name']));break;}}}}})[_0x4614('0xd')](function(){if(_0x35038b===_0x4614('0x4b')){var _0x4bd81e=_[_0x4614('0x4c')](_0x341fa5[_0x4614('0x25')],'id');return _0x341fa5[_0x4614('0x4d')](_0x4bd81e)[_0x4614('0xd')](function(){for(var _0x2381fb=0x0;_0x2381fb<_0x4bd81e[_0x4614('0x1e')];_0x2381fb+=0x1){_0x5ee455['emit'](_0x4614('0x4e'),{'ChatInteractionId':Number(_0x4bd81e[_0x2381fb]),'UserId':Number(_0x341fa5['id'])});}});}})[_0x4614('0xd')](function(){if(_0x35038b===_0x4614('0x4b')){var _0x286504=_[_0x4614('0x4c')](_0x341fa5[_0x4614('0x4f')],'id');return _0x341fa5[_0x4614('0x50')](_0x286504)[_0x4614('0xd')](function(){for(var _0x13b2c5=0x0;_0x13b2c5<_0x286504[_0x4614('0x1e')];_0x13b2c5+=0x1){_0x5ee455[_0x4614('0x51')](_0x4614('0x52'),{'MailInteractionId':Number(_0x286504[_0x13b2c5]),'UserId':Number(_0x341fa5['id'])});}});}})[_0x4614('0xd')](function(){if(_0x35038b===_0x4614('0x4b')){var _0x3d8ec8=_[_0x4614('0x4c')](_0x341fa5[_0x4614('0x28')],'id');return _0x341fa5[_0x4614('0x53')](_0x3d8ec8)['then'](function(){for(var _0x1dec0f=0x0;_0x1dec0f<_0x3d8ec8[_0x4614('0x1e')];_0x1dec0f+=0x1){_0x5ee455[_0x4614('0x51')](_0x4614('0x54'),{'FaxInteractionId':Number(_0x3d8ec8[_0x1dec0f]),'UserId':Number(_0x341fa5['id'])});}});}})[_0x4614('0xd')](function(){if(_0x35038b===_0x4614('0x4b')){var _0x25ce03=_[_0x4614('0x4c')](_0x341fa5['SmsInteractions'],'id');return _0x341fa5[_0x4614('0x55')](_0x25ce03)[_0x4614('0xd')](function(){for(var _0x5ba455=0x0;_0x5ba455<_0x25ce03[_0x4614('0x1e')];_0x5ba455+=0x1){_0x5ee455[_0x4614('0x51')](_0x4614('0x56'),{'SmsInteractionId':Number(_0x25ce03[_0x5ba455]),'UserId':Number(_0x341fa5['id'])});}});}})['then'](function(){if(_0x35038b===_0x4614('0x4b')){var _0x4e5435=_[_0x4614('0x4c')](_0x341fa5[_0x4614('0x2a')],'id');return _0x341fa5['removeOpenchannelInteractions'](_0x4e5435)[_0x4614('0xd')](function(){for(var _0x17649e=0x0;_0x17649e<_0x4e5435[_0x4614('0x1e')];_0x17649e+=0x1){_0x5ee455[_0x4614('0x51')](_0x4614('0x57'),{'OpenchannelInteractionId':Number(_0x4e5435[_0x17649e]),'UserId':Number(_0x341fa5['id'])});}});}})[_0x4614('0xd')](function(){if(_0x35038b===_0x4614('0x4b')){var _0x44d389=_[_0x4614('0x4c')](_0x341fa5[_0x4614('0x58')],'id');return _0x341fa5[_0x4614('0x59')](_0x44d389)[_0x4614('0xd')](function(){for(var _0x55fd97=0x0;_0x55fd97<_0x44d389[_0x4614('0x1e')];_0x55fd97+=0x1){_0x5ee455[_0x4614('0x51')](_0x4614('0x5a'),{'WhatsappInteractionId':Number(_0x44d389[_0x55fd97]),'UserId':Number(_0x341fa5['id'])});}});}})[_0x4614('0x5b')](function(_0x48a41e){_0x3326ee[_0x4614('0x5c')](_0x48a41e);});}}function onDisconnect(_0x2418e8,_0x527e3a){joinOrLeave(_0x2418e8,_0x4614('0x4b'),_0x527e3a);}function onConnect(_0x218802){joinOrLeave(_0x218802,_0x4614('0x5d'));}exports[_0x4614('0x5e')]=function(_0x7df553){_0x7df553['on']('connection',function(_0x4b9fd8){_0x4b9fd8[_0x4614('0x5f')](0x0);_0x4b9fd8[_0x4614('0x60')]=_0x4b9fd8[_0x4614('0x61')][_0x4614('0x62')][_0x4614('0x63')]+':'+_0x4b9fd8[_0x4614('0x61')]['connection'][_0x4614('0x64')];_0x4b9fd8[_0x4614('0x65')]=new Date();_0x4b9fd8[_0x4614('0x5c')]=function(_0xbcbc12){console[_0x4614('0x5c')](_0x4614('0x66')+_0x4b9fd8[_0x4614('0x67')][_0x4614('0x4')]+'['+_0x4b9fd8['address']+']',_0xbcbc12);};_0x4b9fd8['on'](_0x4614('0x68'),function(){onDisconnect(_0x4b9fd8,_0x7df553);_0x4b9fd8[_0x4614('0x5c')]('DISCONNECTED');});onConnect(_0x4b9fd8);_0x4b9fd8['log']('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 3542b6d..53f1cbc 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 _0x7304=['QueryTypes','SELECT','contact','name','email','internal','interface','format','SIP/%s','agent','incomingmessage','outgoingmessage','get','opened','closed','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','UserId','find','catch','changed','fullname','default','model','hook','callback','toLowerCase','util','jayson/promise','../logger','triggers','lodash','client','http','Chat','ChatInteraction','newinteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','Sms','afterCreate','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','substatus','MailMessage','Openchannel','OpenchannelInteraction','EventManager','then','Trigger,\x20%s','error','code','channel','motionChannel','event','direction','ContactId','sequelize','query','Sequelize'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x7304,0x169));var _0x4730=function(_0x320b8e,_0x1da3fe){_0x320b8e=_0x320b8e-0x0;var _0x55a10a=_0x7304[_0x320b8e];return _0x55a10a;};'use strict';var util=require(_0x4730('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0x4730('0x1'));var logger=require(_0x4730('0x2'))(_0x4730('0x3'));var _=require(_0x4730('0x4'));var client=jayson[_0x4730('0x5')][_0x4730('0x6')]({'port':0x232a});var triggers=[{'channel':_0x4730('0x7'),'model':_0x4730('0x8'),'event':'afterCreate','condition':_0x4730('0x9'),'callback':afterCreate},{'channel':_0x4730('0x7'),'model':_0x4730('0x8'),'event':_0x4730('0xa'),'condition':_0x4730('0xb'),'callback':afterUpdate},{'channel':'Chat','model':_0x4730('0xc'),'event':'afterCreate','condition':_0x4730('0xd'),'callback':afterCreateMessage},{'channel':_0x4730('0xe'),'model':'SmsInteraction','event':'afterCreate','condition':_0x4730('0x9'),'callback':afterCreate},{'channel':_0x4730('0xe'),'model':'SmsInteraction','event':_0x4730('0xa'),'condition':_0x4730('0xb'),'callback':afterUpdate},{'channel':'Sms','model':'SmsMessage','event':_0x4730('0xf'),'condition':_0x4730('0xd'),'callback':afterCreateMessage},{'channel':_0x4730('0x10'),'model':'WhatsappInteraction','event':_0x4730('0xf'),'condition':_0x4730('0x9'),'callback':afterCreate},{'channel':_0x4730('0x10'),'model':_0x4730('0x11'),'event':_0x4730('0xa'),'condition':_0x4730('0xb'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0x4730('0x12'),'event':'afterCreate','condition':_0x4730('0xd'),'callback':afterCreateMessage},{'channel':_0x4730('0x13'),'model':_0x4730('0x14'),'event':_0x4730('0xf'),'condition':_0x4730('0x9'),'callback':afterCreate},{'channel':_0x4730('0x13'),'model':_0x4730('0x14'),'event':_0x4730('0xa'),'condition':_0x4730('0xb'),'callback':afterUpdate},{'channel':_0x4730('0x13'),'model':_0x4730('0x15'),'event':_0x4730('0xf'),'condition':_0x4730('0xd'),'callback':afterCreateMessage},{'channel':_0x4730('0x16'),'model':'MailInteraction','event':_0x4730('0xf'),'condition':_0x4730('0x9'),'callback':afterCreate},{'channel':_0x4730('0x16'),'model':_0x4730('0x17'),'event':_0x4730('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x4730('0x16'),'model':_0x4730('0x17'),'event':_0x4730('0x18'),'condition':'substatus','callback':afterUpdate},{'channel':_0x4730('0x16'),'model':_0x4730('0x19'),'event':_0x4730('0xf'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x4730('0x1a'),'model':_0x4730('0x1b'),'event':_0x4730('0xf'),'condition':_0x4730('0x9'),'callback':afterCreate},{'channel':_0x4730('0x1a'),'model':_0x4730('0x1b'),'event':_0x4730('0xa'),'condition':_0x4730('0xb'),'callback':afterUpdate},{'channel':_0x4730('0x1a'),'model':'OpenchannelMessage','event':_0x4730('0xf'),'condition':_0x4730('0xd'),'callback':afterCreateMessage}];function request(_0x3474eb){return client['request'](_0x4730('0x1c'),_0x3474eb)[_0x4730('0x1d')](function(_0x52ddb4){logger['info'](_0x4730('0x1e'),_0x4730('0x1c'),_0x52ddb4);if(_0x52ddb4[_0x4730('0x1f')]){if(_0x52ddb4[_0x4730('0x1f')][_0x4730('0x20')]===0x1f4){logger[_0x4730('0x1f')](_0x4730('0x1e'),_0x4730('0x1c'),_0x52ddb4['error']);}}})['catch'](function(_0x588ae5){logger[_0x4730('0x1f')](_0x4730('0x1e'),_0x4730('0x1c'),_0x588ae5);});}function afterCreateMessage(_0x867652,_0x594cc3){return function(_0x75bef,_0x53d9cb){_0x75bef=_0x75bef['get']({'plain':!![]});_0x75bef[_0x4730('0x21')]=_0x867652;_0x75bef[_0x4730('0x22')]=_0x867652;_0x75bef[_0x4730('0x23')]=_0x75bef[_0x4730('0x24')];var _0x3e7885='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x75bef[_0x4730('0x25')];return db[_0x4730('0x26')][_0x4730('0x27')](_0x3e7885,{'type':db[_0x4730('0x28')][_0x4730('0x29')][_0x4730('0x2a')],'raw':!![]})['then'](function(_0x2056d3){return _0x2056d3;})[_0x4730('0x1d')](function(_0x3656e8){if(_0x3656e8){_0x75bef[_0x4730('0x2b')]=_0x3656e8[0x0];}if(_0x75bef['UserId']){return db['User']['find']({'where':{'id':_0x75bef['UserId']},'attributes':['id',_0x4730('0x2c'),'fullname',_0x4730('0x2d'),_0x4730('0x2e')],'raw':!![]})['then'](function(_0x27d48d){_0x75bef[_0x4730('0x2f')]=util[_0x4730('0x30')](_0x4730('0x31'),_0x27d48d[_0x4730('0x2c')]);_0x75bef[_0x4730('0x21')]=_0x867652;_0x75bef[_0x4730('0x32')]=_0x27d48d;return request({'event':_0x4730('0x33'),'message':_0x75bef});})['catch'](function(_0xa59073){console[_0x4730('0x1f')](_0xa59073);});}else{return request({'event':_0x4730('0x34'),'message':_0x75bef});}});};}function afterCreate(_0x55b5dd,_0x43f891){return function(_0x381d57,_0x5d286b){_0x381d57=_0x381d57[_0x4730('0x35')]({'plain':!![]});_0x381d57['channel']=_0x55b5dd;_0x381d57[_0x4730('0x22')]=_0x55b5dd;_0x381d57[_0x4730('0x23')]=_0x4730('0x36');var _0x3098c9='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x381d57['ContactId'];return db[_0x4730('0x26')][_0x4730('0x27')](_0x3098c9,{'type':db[_0x4730('0x28')]['QueryTypes'][_0x4730('0x2a')],'raw':!![]})['then'](function(_0x51bfb1){return _0x51bfb1;})[_0x4730('0x1d')](function(_0x50ebc2){if(_0x50ebc2){_0x381d57['contact']=_0x50ebc2[0x0];}return request({'event':_0x43f891,'message':_0x381d57});});};}function afterUpdate(_0x34641b,_0x28da71){return function(_0x22c236,_0x59fd2d){if(_0x22c236['changed'](_0x4730('0x37'))&&_0x22c236[_0x4730('0x37')]){_0x22c236=_0x22c236[_0x4730('0x35')]({'plain':!![]});_0x22c236[_0x4730('0x21')]=_0x34641b;_0x22c236[_0x4730('0x22')]=_0x34641b;_0x22c236['event']='closed';var _0x339bc7=_0x4730('0x38')+_0x22c236['ContactId'];return db[_0x4730('0x26')]['query'](_0x339bc7,{'type':db[_0x4730('0x28')]['QueryTypes'][_0x4730('0x2a')],'raw':!![]})[_0x4730('0x1d')](function(_0x3b0ae9){return _0x3b0ae9;})[_0x4730('0x1d')](function(_0x4ac61c){if(_0x4ac61c){_0x22c236[_0x4730('0x2b')]=_0x4ac61c[0x0];}if(_0x22c236[_0x4730('0x39')]){return db['User'][_0x4730('0x3a')]({'where':{'id':_0x22c236[_0x4730('0x39')]},'attributes':['id',_0x4730('0x2c'),'fullname',_0x4730('0x2d'),_0x4730('0x2e')],'raw':!![]})[_0x4730('0x1d')](function(_0x609887){_0x22c236[_0x4730('0x2f')]=util['format'](_0x4730('0x31'),_0x609887[_0x4730('0x2c')]);_0x22c236[_0x4730('0x32')]=_0x609887;return request({'event':_0x28da71,'message':_0x22c236});})[_0x4730('0x3b')](function(_0x3b4558){console['error'](_0x3b4558);});}else{return request({'event':_0x28da71,'message':_0x22c236});}});}else if(_0x22c236[_0x4730('0x3c')](_0x4730('0x18'))){_0x22c236=_0x22c236[_0x4730('0x35')]({'plain':!![]});_0x22c236['channel']=_0x34641b;_0x22c236['event']=_0x4730('0x18');var _0x339bc7='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x22c236[_0x4730('0x25')];return db['sequelize'][_0x4730('0x27')](_0x339bc7,{'type':db['Sequelize'][_0x4730('0x29')][_0x4730('0x2a')],'raw':!![]})[_0x4730('0x1d')](function(_0x58efd1){return _0x58efd1;})[_0x4730('0x1d')](function(_0x59b8d5){if(_0x59b8d5){_0x22c236[_0x4730('0x2b')]=_0x59b8d5[0x0];}if(_0x22c236[_0x4730('0x39')]){return db['User'][_0x4730('0x3a')]({'where':{'id':_0x22c236['UserId']},'attributes':['id',_0x4730('0x2c'),_0x4730('0x3d'),_0x4730('0x2d'),_0x4730('0x2e')],'raw':!![]})[_0x4730('0x1d')](function(_0x4c4083){_0x22c236[_0x4730('0x2f')]=util[_0x4730('0x30')]('SIP/%s',_0x4c4083[_0x4730('0x2c')]);_0x22c236['agent']=_0x4c4083;return request({'event':_0x28da71,'message':_0x22c236});})[_0x4730('0x3b')](function(_0x4d2d02){console['error'](_0x4d2d02);});}else{return request({'event':_0x28da71,'message':_0x22c236});}});}};}exports[_0x4730('0x3e')]=function(){for(var _0x10eaf6=0x0;_0x10eaf6=_0x79f023[_0x5d14('0x15')]){throw Error(_0x5d14('0x16'));}_0x150a2c(_0x51e104);})[_0x5d14('0x17')](function(_0x4cf961){_0x14d35e(_0x4cf961);});});}; \ No newline at end of file +var _0x6403=['bluebird','../mysqldb','voice','mail','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','updateAttributes','role','agent','User','count','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash'];(function(_0x3c135d,_0x20a503){var _0xbe81d2=function(_0x36efee){while(--_0x36efee){_0x3c135d['push'](_0x3c135d['shift']());}};_0xbe81d2(++_0x20a503);}(_0x6403,0xb5));var _0x3640=function(_0x4c08f4,_0x573532){_0x4c08f4=_0x4c08f4-0x0;var _0x4327e8=_0x6403[_0x4c08f4];return _0x4327e8;};'use strict';var _=require(_0x3640('0x0'));var BPromise=require(_0x3640('0x1'));var db=require(_0x3640('0x2'))['db'];var util=require('./license/util');var channels=[_0x3640('0x3'),_0x3640('0x4'),_0x3640('0x5'),_0x3640('0x6'),_0x3640('0x7'),_0x3640('0x8'),_0x3640('0x9')];exports[_0x3640('0xa')]=function(){return channels;};exports[_0x3640('0xb')]=function(_0x3b20e8){_0x3b20e8=_0x3b20e8[_0x3640('0xc')]();return _[_0x3640('0xd')](channels,_0x3b20e8);};exports[_0x3640('0xe')]=function(_0x445d7c,_0x1eccae,_0xde07e5,_0x3597d0){var _0x9d2df1={'loginAttempts':_0x1eccae,'blocked':_0xde07e5};if(!_[_0x3640('0xf')](_0x3597d0)){_0x9d2df1['blockedAt']=_0x3597d0;}return _0x445d7c[_0x3640('0x10')](_0x9d2df1);};exports['getLicense']=function(_0x20df9a){return new BPromise(function(_0x2b52ea,_0x419740){var _0x2ff350=0x0;if(_0x20df9a[_0x3640('0x11')]!==_0x3640('0x12')){_0x2b52ea(_0x20df9a);}db[_0x3640('0x13')][_0x3640('0x14')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x20df9a['id']}}})[_0x3640('0x15')](function(_0x1b6844){_0x2ff350=_0x1b6844;return util[_0x3640('0x16')]();})[_0x3640('0x15')](function(_0x1d8c39){if(_0x1d8c39&&_0x1d8c39[_0x3640('0x17')]&&_0x2ff350>=_0x1d8c39['agents']){throw Error(_0x3640('0x18'));}_0x2b52ea(_0x20df9a);})[_0x3640('0x19')](function(_0x4de009){_0x419740(_0x4de009);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index a920b1d..c3d861f 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7129=['status','json','send'];(function(_0x5d990c,_0x461743){var _0xad431=function(_0x1ae457){while(--_0x1ae457){_0x5d990c['push'](_0x5d990c['shift']());}};_0xad431(++_0x461743);}(_0x7129,0x99));var _0x9712=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7129[_0xa464c9];return _0x3d73c4;};'use strict';module['exports'][0x194]=function pageNotFound(_0x4333c5,_0x150bb6){var _0x3189f3='404';var _0x120af8=0x194;var _0x2c0e4a={'status':_0x120af8};_0x150bb6['status'](_0x2c0e4a[_0x9712('0x0')]);_0x150bb6['render'](_0x3189f3,{},function(_0x2f9b6d,_0x1b9be0){if(_0x2f9b6d){return _0x150bb6['status'](_0x2c0e4a[_0x9712('0x0')])[_0x9712('0x1')](_0x2c0e4a);}_0x150bb6[_0x9712('0x2')](_0x1b9be0);});}; \ No newline at end of file +var _0xb81f=['exports','status','render'];(function(_0x5baa89,_0x48afd){var _0x2ec9ef=function(_0x5a7003){while(--_0x5a7003){_0x5baa89['push'](_0x5baa89['shift']());}};_0x2ec9ef(++_0x48afd);}(_0xb81f,0xcc));var _0xfb81=function(_0xe0c3af,_0x1b6dbf){_0xe0c3af=_0xe0c3af-0x0;var _0x488ee9=_0xb81f[_0xe0c3af];return _0x488ee9;};'use strict';module[_0xfb81('0x0')][0x194]=function pageNotFound(_0xa8d5d1,_0x50e126){var _0x5cc33f='404';var _0x55ffbe=0x194;var _0x401378={'status':_0x55ffbe};_0x50e126[_0xfb81('0x1')](_0x401378[_0xfb81('0x1')]);_0x50e126[_0xfb81('0x2')](_0x5cc33f,{},function(_0x3c42dd,_0x5486cd){if(_0x3c42dd){return _0x50e126[_0xfb81('0x1')](_0x401378[_0xfb81('0x1')])['json'](_0x401378);}_0x50e126['send'](_0x5486cd);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 47e369a..f9d8986 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x96cc=['../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','Campaign','../api/campaign/campaign.model','Migration','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','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','cascade','UserId','hasMany','Recordings','UserVoiceQueueRt','VoiceExtension','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteraction','SmsInteraction','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','belongsTo','userProfileId','belongsToMany','ChatGroup','chat_group_has_users','Contacts','cm_user_has_contacts','cm_user_has_lists','user_has_teams','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','SpiedAgents','Applications','Sounds','moh_has_sounds','Hoppers','VoiceQueueId','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','Teams','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','uniqueid','AgentReports','Contact','ContactId','MailServerIn','MailAccountId','MailServerOut','hasOne','Imap','Smtp','Dispositions','Answers','Interactions','Template','TemplateId','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','Interaction','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','restrict','List','Items','FaxAccountId','FaxApplication','Exntensions','ListId','TagId','FaxMessage','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ChatWebsite','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','Attachments','team_has_chat_queues','ChatGroupId','Members','CompanyId','cm_contact_has_tags','CampaignId','OwnerId','Automation','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','AnalyticCustomReport','CustomReportId','Mohs','Trigger','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Fields','DefaultReportId','AnalyticMetric','MetricId','SalesforceAccount','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Field','VariableId','SugarcrmAccount','SugarcrmConfiguration','Subject','Description','DeskField','int_desk_configuration_has_tags','ZohoField','ZendeskAccount','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerAccount','Dynamics365Field','ChatQueueReport','FromId','ToId','SessionId','ProjectId','SquareProject','user_has_square_projects','WhatsappQueues','HopperHistories','HopperBlacks','SquareProjectId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToQueue','ToMailAccountId','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','ToAccount','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsAccountId','WhatsappAccountId','WhatsappMessage','WhatsappApplication','WhatsappInteractionId','whatsapp_interaction_has_tags','WhatsappQueueReport','ToWhatsappAccountId','ToQueueId','team_has_whatsapp_queues','../config/environment','lodash','determine','sequelize','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','name','utf8','utf8_general_ci','sequelizeHistory','database','username','options','password','User','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','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','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule'];(function(_0x85087d,_0x5d221f){var _0x38474a=function(_0x4cf251){while(--_0x4cf251){_0x85087d['push'](_0x85087d['shift']());}};_0x38474a(++_0x5d221f);}(_0x96cc,0x16c));var _0xc96c=function(_0x180d16,_0x24813e){_0x180d16=_0x180d16-0x0;var _0x54045e=_0x96cc[_0x180d16];return _0x54045e;};'use strict';var config=require(_0xc96c('0x0'));var Sequelize=require('sequelize');var _=require(_0xc96c('0x1'));var jstz=require('jstz');var timezone=jstz[_0xc96c('0x2')]();config[_0xc96c('0x3')]=_[_0xc96c('0x4')](config[_0xc96c('0x3')],{'database':_0xc96c('0x5'),'username':_0xc96c('0x6'),'password':_0xc96c('0x7'),'options':{'host':_0xc96c('0x8'),'port':0xcea,'dialect':_0xc96c('0x9'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xc96c('0xa')](),'define':{'charset':_0xc96c('0xb'),'collate':_0xc96c('0xc')}}});config[_0xc96c('0xd')]=_[_0xc96c('0x4')](config[_0xc96c('0xd')],{'database':_0xc96c('0x5'),'username':'xcall','password':_0xc96c('0x7'),'options':{'host':_0xc96c('0x8'),'port':0xcea,'dialect':_0xc96c('0x9'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xc96c('0xa')](),'define':{'charset':'utf8','collate':_0xc96c('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0xc96c('0xe')],config[_0xc96c('0x3')][_0xc96c('0xf')],config[_0xc96c('0x3')]['password'],config[_0xc96c('0x3')][_0xc96c('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xc96c('0xd')][_0xc96c('0xe')],config['sequelizeHistory'][_0xc96c('0xf')],config[_0xc96c('0xd')][_0xc96c('0x11')],config[_0xc96c('0xd')][_0xc96c('0x10')])};db[_0xc96c('0x12')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x14'));db[_0xc96c('0x15')]=db[_0xc96c('0x3')]['import']('../api/voiceChanSpy/voiceChanSpy.model');db[_0xc96c('0x16')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x17'));db['VoiceExtension']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x18'));db[_0xc96c('0x19')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x1a'));db[_0xc96c('0x1b')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x1c'));db[_0xc96c('0x1d')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x1e'));db[_0xc96c('0x1f')]=db[_0xc96c('0x3')]['import'](_0xc96c('0x20'));db[_0xc96c('0x21')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x22'));db[_0xc96c('0x23')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x24'));db[_0xc96c('0x25')]=db['sequelize'][_0xc96c('0x13')](_0xc96c('0x26'));db[_0xc96c('0x27')]=db[_0xc96c('0x3')]['import']('../api/voiceDialReport/voiceDialReport.model');db[_0xc96c('0x28')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x29'));db[_0xc96c('0x2a')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x2b'));db[_0xc96c('0x2c')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x2d'));db[_0xc96c('0x2e')]=db[_0xc96c('0x3')]['import'](_0xc96c('0x2f'));db['VoiceTransferReport']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x30'));db['UserVoiceQueueRt']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x31'));db[_0xc96c('0x32')]=db['sequelize']['import'](_0xc96c('0x33'));db[_0xc96c('0x34')]=db[_0xc96c('0x3')]['import'](_0xc96c('0x35'));db[_0xc96c('0x36')]=db[_0xc96c('0x3')][_0xc96c('0x13')]('../api/userMailQueue/userMailQueue.model');db[_0xc96c('0x37')]=db[_0xc96c('0x3')]['import'](_0xc96c('0x38'));db[_0xc96c('0x39')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x3a'));db[_0xc96c('0x3b')]=db['sequelize'][_0xc96c('0x13')](_0xc96c('0x3c'));db[_0xc96c('0x3d')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x3e'));db['MailServerIn']=db['sequelize'][_0xc96c('0x13')](_0xc96c('0x3f'));db['MailServerOut']=db['sequelize'][_0xc96c('0x13')](_0xc96c('0x40'));db[_0xc96c('0x41')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x42'));db[_0xc96c('0x43')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x44'));db[_0xc96c('0x45')]=db['sequelize'][_0xc96c('0x13')](_0xc96c('0x46'));db[_0xc96c('0x47')]=db[_0xc96c('0x3')]['import'](_0xc96c('0x48'));db[_0xc96c('0x49')]=db[_0xc96c('0x3')]['import']('../api/mailMessage/mailMessage.model');db[_0xc96c('0x4a')]=db[_0xc96c('0x3')][_0xc96c('0x13')]('../api/mailApplication/mailApplication.model');db[_0xc96c('0x4b')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x4c'));db[_0xc96c('0x4d')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x4e'));db[_0xc96c('0x4f')]=db['sequelize']['import'](_0xc96c('0x50'));db[_0xc96c('0x51')]=db[_0xc96c('0x3')][_0xc96c('0x13')]('../api/faxAccount/faxAccount.model');db['FaxApplication']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x52'));db[_0xc96c('0x53')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x54'));db['FaxMessage']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x55'));db[_0xc96c('0x56')]=db['sequelize']['import'](_0xc96c('0x57'));db[_0xc96c('0x58')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x59'));db[_0xc96c('0x5a')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x5b'));db[_0xc96c('0x5c')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x5d'));db['SmsInteraction']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x5e'));db[_0xc96c('0x5f')]=db['sequelize'][_0xc96c('0x13')]('../api/smsMessage/smsMessage.model');db[_0xc96c('0x60')]=db[_0xc96c('0x3')]['import'](_0xc96c('0x61'));db[_0xc96c('0x62')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x63'));db[_0xc96c('0x64')]=db['sequelize']['import']('../api/openchannelApplication/openchannelApplication.model');db[_0xc96c('0x65')]=db['sequelize'][_0xc96c('0x13')](_0xc96c('0x66'));db[_0xc96c('0x67')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x68'));db[_0xc96c('0x69')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x6a'));db['ChatWebsite']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x6b'));db[_0xc96c('0x6c')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x6d'));db[_0xc96c('0x6e')]=db['sequelize']['import']('../api/chatApplication/chatApplication.model');db['ChatInteraction']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x6f'));db[_0xc96c('0x70')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x71'));db['ChatOfflineMessage']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x72'));db[_0xc96c('0x73')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x74'));db['ChatGroup']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x75'));db[_0xc96c('0x76')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x77'));db[_0xc96c('0x78')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x79'));db[_0xc96c('0x7a')]=db[_0xc96c('0x3')][_0xc96c('0x13')]('../api/cmContact/cmContact.model');db[_0xc96c('0x7b')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x7c'));db[_0xc96c('0x7d')]=db['sequelize'][_0xc96c('0x13')](_0xc96c('0x7e'));db[_0xc96c('0x7f')]=db[_0xc96c('0x3')]['import'](_0xc96c('0x80'));db[_0xc96c('0x81')]=db['sequelize']['import']('../api/cmHopperHistory/cmHopperHistory.model');db[_0xc96c('0x82')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x83'));db[_0xc96c('0x84')]=db['sequelize']['import'](_0xc96c('0x85'));db[_0xc96c('0x86')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x87'));db['Automation']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x88'));db[_0xc96c('0x89')]=db['sequelize']['import'](_0xc96c('0x8a'));db[_0xc96c('0x8b')]=db['sequelize'][_0xc96c('0x13')]('../api/disposition/disposition.model');db[_0xc96c('0x8c')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x8d'));db[_0xc96c('0x8e')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x8f'));db[_0xc96c('0x90')]=db[_0xc96c('0x3')]['import'](_0xc96c('0x91'));db['Cdr']=db[_0xc96c('0x3')][_0xc96c('0x13')]('../api/cdr/cdr.model');db[_0xc96c('0x92')]=db['sequelize'][_0xc96c('0x13')](_0xc96c('0x93'));db[_0xc96c('0x94')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x95'));db[_0xc96c('0x96')]=db[_0xc96c('0x3')][_0xc96c('0x13')]('../api/sound/sound.model');db[_0xc96c('0x97')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x98'));db['Template']=db[_0xc96c('0x3')][_0xc96c('0x13')]('../api/template/template.model');db['Trigger']=db[_0xc96c('0x3')]['import'](_0xc96c('0x99'));db[_0xc96c('0x9a')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x9b'));db[_0xc96c('0x9c')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x9d'));db['IntegrationReport']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x9e'));db['AnalyticCustomReport']=db['sequelize'][_0xc96c('0x13')](_0xc96c('0x9f'));db[_0xc96c('0xa0')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xa1'));db[_0xc96c('0xa2')]=db['sequelize'][_0xc96c('0x13')](_0xc96c('0xa3'));db['AnalyticMetric']=db[_0xc96c('0x3')]['import'](_0xc96c('0xa4'));db[_0xc96c('0xa5')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xa6'));db[_0xc96c('0xa7')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xa8'));db['SalesforceAccount']=db[_0xc96c('0x3')][_0xc96c('0x13')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0xc96c('0xa9')]=db['sequelize'][_0xc96c('0x13')](_0xc96c('0xaa'));db[_0xc96c('0xab')]=db['sequelize'][_0xc96c('0x13')](_0xc96c('0xac'));db['SugarcrmAccount']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xad'));db['SugarcrmConfiguration']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xae'));db[_0xc96c('0xaf')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xb0'));db[_0xc96c('0xb1')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xb2'));db[_0xc96c('0xb3')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xb4'));db['DeskField']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xb5'));db[_0xc96c('0xb6')]=db[_0xc96c('0x3')]['import'](_0xc96c('0xb7'));db[_0xc96c('0xb8')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xb9'));db['ZohoField']=db['sequelize'][_0xc96c('0x13')](_0xc96c('0xba'));db['ZendeskAccount']=db[_0xc96c('0x3')][_0xc96c('0x13')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0xc96c('0xbb')]=db[_0xc96c('0x3')]['import'](_0xc96c('0xbc'));db[_0xc96c('0xbd')]=db[_0xc96c('0x3')][_0xc96c('0x13')]('../api/intZendeskField/intZendeskField.model');db[_0xc96c('0xbe')]=db[_0xc96c('0x3')]['import']('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0xc96c('0xbf')]=db['sequelize'][_0xc96c('0x13')](_0xc96c('0xc0'));db['FreshdeskField']=db['sequelize'][_0xc96c('0x13')](_0xc96c('0xc1'));db['VtigerAccount']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xc2'));db[_0xc96c('0xc3')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xc4'));db[_0xc96c('0xc5')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xc6'));db[_0xc96c('0xc7')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xc8'));db[_0xc96c('0xc9')]=db['sequelize'][_0xc96c('0x13')](_0xc96c('0xca'));db[_0xc96c('0xcb')]=db[_0xc96c('0x3')]['import'](_0xc96c('0xcc'));db[_0xc96c('0xcd')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xce'));db[_0xc96c('0xcf')]=db['sequelize'][_0xc96c('0x13')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db['Dynamics365Field']=db['sequelize']['import']('../api/intDynamics365Field/intDynamics365Field.model');db[_0xc96c('0xd0')]=db[_0xc96c('0x3')]['import']('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0xc96c('0xd1')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xd2'));db[_0xc96c('0xd3')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xd4'));db[_0xc96c('0x9c')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x9d'));db[_0xc96c('0xd5')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xd6'));db['ChatQueueReport']=db[_0xc96c('0x3')][_0xc96c('0x13')]('../api/chatQueueReport/chatQueueReport.model');db[_0xc96c('0xd7')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xd8'));db[_0xc96c('0xd9')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xda'));db[_0xc96c('0xdb')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xdc'));db[_0xc96c('0xdd')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xde'));db[_0xc96c('0xdf')]=db['sequelize'][_0xc96c('0x13')](_0xc96c('0xe0'));db['SquareReport']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xe1'));db[_0xc96c('0xe2')]=db[_0xc96c('0x3')]['import'](_0xc96c('0xe3'));db[_0xc96c('0xe4')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xe5'));db[_0xc96c('0xe6')]=db[_0xc96c('0x3')]['import'](_0xc96c('0xe7'));db['SquareOdbc']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xe8'));db['SquareProject']=db['sequelize']['import'](_0xc96c('0xe9'));db[_0xc96c('0xea')]=db[_0xc96c('0x3')]['import'](_0xc96c('0xeb'));db[_0xc96c('0xec')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xed'));db[_0xc96c('0xee')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xef'));db[_0xc96c('0xf0')]=db[_0xc96c('0x3')][_0xc96c('0x13')]('../api/license/license.model');db[_0xc96c('0xf1')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xf2'));db[_0xc96c('0xf3')]=db[_0xc96c('0x3')]['import']('../api/migration/migration.model');db[_0xc96c('0xf4')]=db[_0xc96c('0x3')]['import'](_0xc96c('0xf5'));db[_0xc96c('0xf6')]=db['sequelize'][_0xc96c('0x13')](_0xc96c('0xf7'));db[_0xc96c('0xf8')]=db[_0xc96c('0x3')]['import'](_0xc96c('0xf9'));db[_0xc96c('0xfa')]=db[_0xc96c('0x3')]['import'](_0xc96c('0xfb'));db[_0xc96c('0xfc')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xfd'));db[_0xc96c('0xfe')]=db['sequelize'][_0xc96c('0x13')](_0xc96c('0xff'));db['SmsTransferReport']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x100'));db[_0xc96c('0x101')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x102'));db[_0xc96c('0x103')]=db[_0xc96c('0x3')]['import'](_0xc96c('0x104'));db[_0xc96c('0x105')]=db[_0xc96c('0x3')][_0xc96c('0x13')]('../api/userProfile/userProfile.model');db[_0xc96c('0x106')]=db['sequelize']['import'](_0xc96c('0x107'));db[_0xc96c('0x108')]=db[_0xc96c('0x3')]['import'](_0xc96c('0x109'));db[_0xc96c('0x10a')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x10b'));db[_0xc96c('0x10c')]=db['sequelize']['import']('../api/whatsappAccount/whatsappAccount.model');db['WhatsappApplication']=db['sequelize'][_0xc96c('0x13')](_0xc96c('0x10d'));db[_0xc96c('0x10e')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x10f'));db['WhatsappMessage']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x110'));db['WhatsappQueueReport']=db[_0xc96c('0x3')]['import']('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xc96c('0x111')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x112'));db[_0xc96c('0x113')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x114'));db[_0xc96c('0x115')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x116'));db[_0xc96c('0x117')]=db[_0xc96c('0x3')]['import'](_0xc96c('0x118'));db[_0xc96c('0x119')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x11a'));db[_0xc96c('0x11b')]=db[_0xc96c('0x3')][_0xc96c('0x13')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0xc96c('0x12')]['hasOne'](db[_0xc96c('0x21')],{'as':_0xc96c('0x21'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x11d')});db['User'][_0xc96c('0x11e')](db[_0xc96c('0x1d')],{'as':_0xc96c('0x11f'),'foreignKey':_0xc96c('0x11d')});db['User'][_0xc96c('0x11e')](db[_0xc96c('0x120')],{'as':'VoiceQueuesRt','foreignKey':_0xc96c('0x11d')});db[_0xc96c('0x12')][_0xc96c('0x11e')](db[_0xc96c('0x121')],{'as':_0xc96c('0x122'),'onDelete':_0xc96c('0x11c'),'hooks':!![]});db['User']['hasMany'](db[_0xc96c('0x7f')],{'as':_0xc96c('0x123'),'foreignKey':_0xc96c('0x11d')});db['User'][_0xc96c('0x11e')](db[_0xc96c('0x81')],{'as':_0xc96c('0x124'),'foreignKey':'UserId'});db[_0xc96c('0x12')][_0xc96c('0x11e')](db[_0xc96c('0x82')],{'as':_0xc96c('0x82'),'foreignKey':_0xc96c('0x11d')});db[_0xc96c('0x12')]['hasMany'](db[_0xc96c('0x65')],{'as':_0xc96c('0x125'),'foreignKey':_0xc96c('0x11d')});db['User']['hasMany'](db[_0xc96c('0x126')],{'as':'ChatInteractions','foreignKey':_0xc96c('0x11d')});db[_0xc96c('0x12')][_0xc96c('0x11e')](db[_0xc96c('0x127')],{'as':_0xc96c('0x128'),'foreignKey':'UserId'});db['User'][_0xc96c('0x11e')](db['FaxInteraction'],{'as':_0xc96c('0x129'),'foreignKey':_0xc96c('0x11d')});db['User']['hasMany'](db[_0xc96c('0x47')],{'as':_0xc96c('0x12a'),'foreignKey':_0xc96c('0x11d')});db[_0xc96c('0x12')][_0xc96c('0x11e')](db[_0xc96c('0x10e')],{'as':_0xc96c('0x12b'),'foreignKey':'UserId'});db[_0xc96c('0x12')][_0xc96c('0x11e')](db['UserNotification'],{'as':'UserNotifications','foreignKey':'SenderId'});db[_0xc96c('0x12')][_0xc96c('0x12c')](db[_0xc96c('0x105')],{'as':_0xc96c('0x105'),'foreignKey':_0xc96c('0x12d')});db[_0xc96c('0x12')][_0xc96c('0x12e')](db[_0xc96c('0x12f')],{'as':'Groups','through':_0xc96c('0x130')});db[_0xc96c('0x12')][_0xc96c('0x12e')](db['CmContact'],{'as':_0xc96c('0x131'),'through':_0xc96c('0x132')});db[_0xc96c('0x12')][_0xc96c('0x12e')](db[_0xc96c('0x101')],{'as':'Lists','through':_0xc96c('0x133')});db[_0xc96c('0x12')][_0xc96c('0x12e')](db['Team'],{'through':_0xc96c('0x134')});db[_0xc96c('0x12')][_0xc96c('0x12e')](db['MailInteraction'],{'as':_0xc96c('0x12a'),'through':'user_has_mail_interactions'});db['User'][_0xc96c('0x12e')](db['ChatInteraction'],{'as':_0xc96c('0x135'),'through':_0xc96c('0x136')});db['User'][_0xc96c('0x12e')](db[_0xc96c('0x53')],{'as':_0xc96c('0x129'),'through':_0xc96c('0x137')});db[_0xc96c('0x12')]['belongsToMany'](db['SmsInteraction'],{'as':_0xc96c('0x128'),'through':_0xc96c('0x138')});db[_0xc96c('0x12')][_0xc96c('0x12e')](db[_0xc96c('0x65')],{'as':'OpenchannelInteractions','through':_0xc96c('0x139')});db[_0xc96c('0x12')][_0xc96c('0x12e')](db[_0xc96c('0x10e')],{'as':_0xc96c('0x12b'),'through':_0xc96c('0x13a')});db['User'][_0xc96c('0x12e')](db['VoiceQueue'],{'as':_0xc96c('0x13b'),'through':_0xc96c('0x32'),'required':![]});db[_0xc96c('0x12')][_0xc96c('0x12e')](db[_0xc96c('0x103')],{'as':_0xc96c('0x13c'),'through':_0xc96c('0x11b'),'required':![]});db[_0xc96c('0x12')][_0xc96c('0x12e')](db['MailQueue'],{'as':_0xc96c('0x13d'),'through':_0xc96c('0x36'),'required':![]});db[_0xc96c('0x12')]['belongsToMany'](db[_0xc96c('0x73')],{'as':_0xc96c('0x13e'),'through':_0xc96c('0x34'),'required':![],'hooks':!![]});db['User'][_0xc96c('0x12e')](db[_0xc96c('0x56')],{'as':_0xc96c('0x13f'),'through':_0xc96c('0x37'),'required':![]});db[_0xc96c('0x12')]['belongsToMany'](db[_0xc96c('0x60')],{'as':_0xc96c('0x140'),'through':_0xc96c('0x39'),'required':![]});db[_0xc96c('0x12')][_0xc96c('0x12e')](db[_0xc96c('0x69')],{'as':_0xc96c('0x141'),'through':'UserOpenchannelQueue','required':![]});db[_0xc96c('0x12')]['belongsToMany'](db[_0xc96c('0x113')],{'as':'WhatsappQueues','through':_0xc96c('0x3d'),'required':![]});db[_0xc96c('0x12')][_0xc96c('0x12e')](db[_0xc96c('0x101')],{'through':'cm_user_has_lists'});db[_0xc96c('0x12')][_0xc96c('0x12e')](db['ChatWebsite'],{'as':_0xc96c('0x142'),'through':_0xc96c('0x143')});db['User']['belongsToMany'](db['FaxAccount'],{'as':_0xc96c('0x144'),'through':_0xc96c('0x145')});db['User'][_0xc96c('0x12e')](db[_0xc96c('0x41')],{'as':_0xc96c('0x146'),'through':_0xc96c('0x147')});db[_0xc96c('0x12')]['belongsToMany'](db[_0xc96c('0x62')],{'as':_0xc96c('0x148'),'through':'user_has_openchannel_accounts'});db[_0xc96c('0x12')][_0xc96c('0x12e')](db[_0xc96c('0x5a')],{'as':_0xc96c('0x149'),'through':_0xc96c('0x14a')});db[_0xc96c('0x12')][_0xc96c('0x12e')](db[_0xc96c('0x10c')],{'as':_0xc96c('0x14b'),'through':_0xc96c('0x14c')});db[_0xc96c('0x12')][_0xc96c('0x12e')](db['SquareProject'],{'as':_0xc96c('0x14d'),'through':'user_has_square_projects'});db[_0xc96c('0x15')]['hasMany'](db[_0xc96c('0x121')],{'as':_0xc96c('0x14e'),'onDelete':'cascade','foreignKey':'ChanSpyId'});db[_0xc96c('0x16')][_0xc96c('0x11e')](db[_0xc96c('0x121')],{'onDelete':_0xc96c('0x11c')});db[_0xc96c('0x121')][_0xc96c('0x11e')](db[_0xc96c('0x121')],{'as':_0xc96c('0x14f'),'onDelete':_0xc96c('0x11c')});db[_0xc96c('0x19')][_0xc96c('0x12e')](db[_0xc96c('0x96')],{'as':_0xc96c('0x150'),'through':_0xc96c('0x151')});db[_0xc96c('0x1b')][_0xc96c('0x11e')](db[_0xc96c('0x120')],{'as':'Members','foreignKey':'VoiceQueueId'});db[_0xc96c('0x1b')][_0xc96c('0x11e')](db[_0xc96c('0x7b')],{'as':_0xc96c('0x152'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xc96c('0x11e')](db[_0xc96c('0x7f')],{'as':_0xc96c('0x123'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xc96c('0x11e')](db[_0xc96c('0x81')],{'as':'HopperHistories','foreignKey':_0xc96c('0x153')});db[_0xc96c('0x1b')][_0xc96c('0x11e')](db[_0xc96c('0x82')],{'as':_0xc96c('0x82'),'foreignKey':'VoiceQueueId'});db[_0xc96c('0x1b')][_0xc96c('0x11e')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0xc96c('0x153')});db[_0xc96c('0x1b')]['hasMany'](db[_0xc96c('0xdd')],{'as':_0xc96c('0x154'),'foreignKey':'VoiceQueueId'});db[_0xc96c('0x1b')]['belongsTo'](db[_0xc96c('0x2e')],{'as':_0xc96c('0x2e'),'foreignKey':_0xc96c('0x155')});db[_0xc96c('0x1b')][_0xc96c('0x12c')](db['Trunk'],{'as':_0xc96c('0x156'),'foreignKey':_0xc96c('0x157')});db[_0xc96c('0x1b')]['belongsTo'](db['Interval'],{'as':'Interval','foreignKey':_0xc96c('0x158')});db[_0xc96c('0x1b')][_0xc96c('0x12c')](db[_0xc96c('0x90')],{'as':_0xc96c('0x159'),'foreignKey':_0xc96c('0x15a')});db[_0xc96c('0x1b')][_0xc96c('0x12e')](db[_0xc96c('0x101')],{'as':_0xc96c('0x15b'),'through':_0xc96c('0x15c')});db[_0xc96c('0x1b')][_0xc96c('0x12e')](db[_0xc96c('0x12')],{'as':_0xc96c('0x15d'),'through':_0xc96c('0x32')});db['VoiceQueue']['belongsToMany'](db['Team'],{'as':_0xc96c('0x15e'),'through':_0xc96c('0x117')});db[_0xc96c('0x1b')][_0xc96c('0x12e')](db[_0xc96c('0x101')],{'as':'BlackLists','through':_0xc96c('0x15f')});db[_0xc96c('0x1d')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'as':_0xc96c('0x12'),'foreignKey':_0xc96c('0x11d')});db[_0xc96c('0x1f')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'as':_0xc96c('0x12'),'foreignKey':'UserId'});db[_0xc96c('0x21')][_0xc96c('0x11e')](db[_0xc96c('0x23')],{'as':_0xc96c('0x160'),'onDelete':_0xc96c('0x11c'),'foreignKey':'mailboxuser','sourceKey':_0xc96c('0x161')});db[_0xc96c('0x23')][_0xc96c('0x12c')](db[_0xc96c('0x21')],{'foreignKey':_0xc96c('0x162'),'targetKey':_0xc96c('0x161')});db[_0xc96c('0x25')][_0xc96c('0x11e')](db[_0xc96c('0x2a')],{'as':'QueueCalls','foreignKey':_0xc96c('0x163'),'constraints':![]});db['VoiceCallReport']['hasMany'](db[_0xc96c('0x28')],{'as':_0xc96c('0x164'),'foreignKey':_0xc96c('0x163'),'constraints':![]});db[_0xc96c('0x25')]['belongsTo'](db[_0xc96c('0x12')],{'as':_0xc96c('0x12'),'foreignKey':_0xc96c('0x11d')});db[_0xc96c('0x25')][_0xc96c('0x12c')](db[_0xc96c('0x7a')],{'as':_0xc96c('0x165'),'foreignKey':_0xc96c('0x166')});db[_0xc96c('0x167')]['belongsTo'](db[_0xc96c('0x41')],{'as':_0xc96c('0x41'),'foreignKey':_0xc96c('0x168')});db[_0xc96c('0x169')][_0xc96c('0x12c')](db[_0xc96c('0x41')],{'as':'MailAccount','foreignKey':_0xc96c('0x168')});db[_0xc96c('0x41')][_0xc96c('0x16a')](db[_0xc96c('0x167')],{'as':_0xc96c('0x16b'),'onDelete':_0xc96c('0x11c')});db['MailAccount'][_0xc96c('0x16a')](db[_0xc96c('0x169')],{'as':_0xc96c('0x16c'),'onDelete':_0xc96c('0x11c')});db[_0xc96c('0x41')][_0xc96c('0x11e')](db[_0xc96c('0x8b')],{'as':_0xc96c('0x16d'),'foreignKey':_0xc96c('0x168'),'onDelete':_0xc96c('0x11c')});db[_0xc96c('0x41')][_0xc96c('0x11e')](db[_0xc96c('0x89')],{'as':_0xc96c('0x16e'),'foreignKey':_0xc96c('0x168')});db[_0xc96c('0x41')][_0xc96c('0x11e')](db['MailMessage'],{'as':_0xc96c('0x160'),'foreignKey':_0xc96c('0x168')});db['MailAccount'][_0xc96c('0x11e')](db[_0xc96c('0x47')],{'as':_0xc96c('0x16f')});db[_0xc96c('0x41')]['hasMany'](db[_0xc96c('0x4a')],{'as':'Applications'});db[_0xc96c('0x41')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0xc96c('0x41')][_0xc96c('0x12c')](db[_0xc96c('0x170')],{'as':_0xc96c('0x170'),'foreignKey':_0xc96c('0x171')});db[_0xc96c('0x41')]['belongsTo'](db[_0xc96c('0x90')],{'as':_0xc96c('0x159'),'foreignKey':_0xc96c('0x15a')});db['MailAccount'][_0xc96c('0x12e')](db[_0xc96c('0x12')],{'as':_0xc96c('0x15d'),'through':_0xc96c('0x147')});db[_0xc96c('0x43')][_0xc96c('0x12e')](db[_0xc96c('0x12')],{'as':'Agents','through':_0xc96c('0x36')});db[_0xc96c('0x43')][_0xc96c('0x12e')](db[_0xc96c('0xee')],{'through':_0xc96c('0x172'),'as':'Teams'});db['MailInteraction'][_0xc96c('0x11e')](db['MailMessage'],{'as':_0xc96c('0x160'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x173')});db['MailInteraction'][_0xc96c('0x12c')](db[_0xc96c('0x41')],{'as':_0xc96c('0x174'),'foreignKey':'MailAccountId'});db['MailInteraction'][_0xc96c('0x12c')](db[_0xc96c('0x7a')],{'as':'Contact','foreignKey':_0xc96c('0x166')});db[_0xc96c('0x47')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'as':_0xc96c('0x175'),'foreignKey':_0xc96c('0x11d')});db['MailInteraction'][_0xc96c('0x12e')](db[_0xc96c('0x97')],{'through':_0xc96c('0x176'),'as':_0xc96c('0x177')});db[_0xc96c('0x47')][_0xc96c('0x12e')](db[_0xc96c('0x97')],{'through':_0xc96c('0x176'),'as':_0xc96c('0x178')});db[_0xc96c('0x47')][_0xc96c('0x12e')](db[_0xc96c('0x12')],{'as':_0xc96c('0x179'),'through':_0xc96c('0x17a'),'foreignKey':_0xc96c('0x173')});db[_0xc96c('0x49')][_0xc96c('0x11e')](db[_0xc96c('0xf4')],{'as':'Attachments','onDelete':_0xc96c('0x11c')});db[_0xc96c('0x49')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'as':_0xc96c('0x12')});db['MailMessage'][_0xc96c('0x12c')](db[_0xc96c('0x7a')],{'onDelete':'cascade','as':'Contact'});db[_0xc96c('0x49')][_0xc96c('0x12c')](db[_0xc96c('0x47')],{'as':_0xc96c('0x17b'),'foreignKey':_0xc96c('0x173')});db['MailMessage']['belongsTo'](db[_0xc96c('0x41')],{'as':'Account','foreignKey':_0xc96c('0x168')});db[_0xc96c('0x49')][_0xc96c('0x12c')](db['ChatWebsite'],{'as':'ChatWebsite','foreignKey':_0xc96c('0x17c')});db[_0xc96c('0x49')]['belongsTo'](db[_0xc96c('0x17d')],{'as':_0xc96c('0x17d'),'foreignKey':_0xc96c('0x17e')});db[_0xc96c('0x4a')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'onDelete':'restrict'});db[_0xc96c('0x4a')]['belongsTo'](db[_0xc96c('0x43')],{'onDelete':_0xc96c('0x17f')});db[_0xc96c('0x4a')]['belongsTo'](db[_0xc96c('0x41')],{'onDelete':'restrict'});db['MailApplication'][_0xc96c('0x12c')](db[_0xc96c('0x8e')],{'onDelete':'restrict','foreignKey':_0xc96c('0x158')});db[_0xc96c('0x4a')][_0xc96c('0x12c')](db[_0xc96c('0x97')],{'onDelete':_0xc96c('0x17f'),'foreignKey':'TagId'});db[_0xc96c('0x4b')][_0xc96c('0x12c')](db['MailAccount'],{});db[_0xc96c('0x4b')][_0xc96c('0x12c')](db[_0xc96c('0x101')],{'as':_0xc96c('0x180'),'foreignKey':'ListId'});db['MailQueueReport'][_0xc96c('0x12c')](db[_0xc96c('0x7a')],{'as':_0xc96c('0x165'),'foreignKey':'ContactId'});db[_0xc96c('0x4b')][_0xc96c('0x12c')](db[_0xc96c('0x47')],{});db[_0xc96c('0x4b')][_0xc96c('0x12c')](db[_0xc96c('0x49')],{});db[_0xc96c('0x4b')]['belongsTo'](db[_0xc96c('0x12')],{});db[_0xc96c('0x4b')][_0xc96c('0x12c')](db[_0xc96c('0x43')],{});db[_0xc96c('0x4d')][_0xc96c('0x11e')](db['DashboardItem'],{'as':_0xc96c('0x181'),'onDelete':_0xc96c('0x11c')});db[_0xc96c('0x51')]['hasMany'](db[_0xc96c('0x8b')],{'as':_0xc96c('0x16d'),'foreignKey':_0xc96c('0x182'),'onDelete':_0xc96c('0x11c')});db[_0xc96c('0x51')]['hasMany'](db['CannedAnswer'],{'as':_0xc96c('0x16e'),'foreignKey':_0xc96c('0x182')});db[_0xc96c('0x51')][_0xc96c('0x11e')](db['FaxInteraction'],{'as':_0xc96c('0x16f')});db[_0xc96c('0x51')]['hasMany'](db[_0xc96c('0x183')],{'as':_0xc96c('0x14f')});db[_0xc96c('0x51')][_0xc96c('0x11e')](db[_0xc96c('0x121')],{'as':_0xc96c('0x184'),'onDelete':'cascade'});db[_0xc96c('0x51')][_0xc96c('0x11e')](db['FaxMessage'],{'as':_0xc96c('0x160')});db['FaxAccount'][_0xc96c('0x12c')](db[_0xc96c('0x2e')],{'as':'Trunk'});db[_0xc96c('0x51')][_0xc96c('0x12c')](db['CmList'],{'as':_0xc96c('0x180'),'foreignKey':_0xc96c('0x185')});db[_0xc96c('0x51')]['belongsTo'](db[_0xc96c('0x90')],{'as':_0xc96c('0x159'),'foreignKey':_0xc96c('0x15a')});db[_0xc96c('0x51')][_0xc96c('0x12e')](db[_0xc96c('0x12')],{'as':_0xc96c('0x15d'),'through':_0xc96c('0x145')});db[_0xc96c('0x183')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'onDelete':_0xc96c('0x17f')});db[_0xc96c('0x183')][_0xc96c('0x12c')](db['FaxQueue'],{'onDelete':_0xc96c('0x17f')});db['FaxApplication']['belongsTo'](db[_0xc96c('0x51')],{'onDelete':_0xc96c('0x17f')});db[_0xc96c('0x183')][_0xc96c('0x12c')](db[_0xc96c('0x97')],{'onDelete':_0xc96c('0x17f'),'foreignKey':_0xc96c('0x186')});db[_0xc96c('0x53')][_0xc96c('0x11e')](db[_0xc96c('0x187')],{'as':'Messages','onDelete':'cascade','foreignKey':_0xc96c('0x188')});db[_0xc96c('0x53')][_0xc96c('0x12c')](db[_0xc96c('0x51')],{'as':_0xc96c('0x174'),'foreignKey':'FaxAccountId'});db[_0xc96c('0x53')][_0xc96c('0x12c')](db[_0xc96c('0x7a')],{'as':_0xc96c('0x165'),'foreignKey':_0xc96c('0x166')});db[_0xc96c('0x53')]['belongsTo'](db[_0xc96c('0x12')],{'as':_0xc96c('0x175'),'foreignKey':'UserId'});db[_0xc96c('0x53')][_0xc96c('0x12e')](db['Tag'],{'through':_0xc96c('0x189'),'as':'Tags'});db[_0xc96c('0x53')][_0xc96c('0x12e')](db[_0xc96c('0x97')],{'through':_0xc96c('0x189'),'as':_0xc96c('0x178')});db[_0xc96c('0x53')][_0xc96c('0x12e')](db['User'],{'as':'Users','through':_0xc96c('0x137'),'foreignKey':_0xc96c('0x188')});db[_0xc96c('0x187')]['belongsTo'](db[_0xc96c('0x12')],{'onDelete':_0xc96c('0x11c'),'as':_0xc96c('0x12')});db[_0xc96c('0x187')]['belongsTo'](db[_0xc96c('0x53')],{'as':_0xc96c('0x17b'),'foreignKey':'FaxInteractionId'});db[_0xc96c('0x187')][_0xc96c('0x12c')](db[_0xc96c('0x7a')],{'onDelete':_0xc96c('0x11c'),'as':_0xc96c('0x165')});db['FaxMessage']['belongsTo'](db[_0xc96c('0xf4')],{'as':'Attachment','foreignKey':_0xc96c('0x18a')});db['FaxMessage'][_0xc96c('0x12c')](db[_0xc96c('0x51')],{'as':_0xc96c('0x174'),'foreignKey':_0xc96c('0x182')});db[_0xc96c('0x56')][_0xc96c('0x12e')](db['User'],{'as':_0xc96c('0x15d'),'through':_0xc96c('0x37')});db[_0xc96c('0x56')][_0xc96c('0x12e')](db['Team'],{'through':_0xc96c('0x18b'),'as':_0xc96c('0x15e')});db['FaxQueueReport'][_0xc96c('0x12c')](db[_0xc96c('0x51')],{});db['FaxQueueReport'][_0xc96c('0x12c')](db[_0xc96c('0x101')],{'as':'List','foreignKey':_0xc96c('0x185')});db['FaxQueueReport']['belongsTo'](db[_0xc96c('0x7a')],{'as':_0xc96c('0x165'),'foreignKey':_0xc96c('0x166')});db[_0xc96c('0x58')][_0xc96c('0x12c')](db[_0xc96c('0x53')],{});db[_0xc96c('0x58')]['belongsTo'](db[_0xc96c('0x187')],{});db[_0xc96c('0x58')]['belongsTo'](db[_0xc96c('0x12')],{});db['FaxQueueReport'][_0xc96c('0x12c')](db[_0xc96c('0x56')],{});db[_0xc96c('0x5a')][_0xc96c('0x11e')](db['Disposition'],{'as':_0xc96c('0x16d'),'foreignKey':'SmsAccountId','onDelete':'cascade'});db[_0xc96c('0x5a')]['hasMany'](db[_0xc96c('0x89')],{'as':_0xc96c('0x16e'),'foreignKey':_0xc96c('0x18c')});db[_0xc96c('0x5a')][_0xc96c('0x11e')](db[_0xc96c('0x5f')],{'as':_0xc96c('0x160'),'foreignKey':_0xc96c('0x18c')});db[_0xc96c('0x5a')][_0xc96c('0x11e')](db['SmsInteraction'],{'as':'Interactions'});db[_0xc96c('0x5a')][_0xc96c('0x11e')](db[_0xc96c('0x5c')],{'as':'Applications'});db['SmsAccount']['belongsTo'](db[_0xc96c('0x101')],{'as':_0xc96c('0x180'),'foreignKey':_0xc96c('0x185')});db[_0xc96c('0x5a')][_0xc96c('0x12c')](db[_0xc96c('0x90')],{'as':_0xc96c('0x159'),'foreignKey':_0xc96c('0x15a')});db[_0xc96c('0x5a')][_0xc96c('0x12e')](db[_0xc96c('0x12')],{'as':_0xc96c('0x15d'),'through':_0xc96c('0x14a')});db[_0xc96c('0x5c')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'onDelete':_0xc96c('0x17f')});db[_0xc96c('0x5c')][_0xc96c('0x12c')](db[_0xc96c('0x60')],{'onDelete':_0xc96c('0x17f')});db[_0xc96c('0x5c')][_0xc96c('0x12c')](db[_0xc96c('0x5a')],{'onDelete':'restrict'});db[_0xc96c('0x5c')][_0xc96c('0x12c')](db[_0xc96c('0x8e')],{'onDelete':_0xc96c('0x17f'),'foreignKey':'IntervalId'});db[_0xc96c('0x5c')][_0xc96c('0x12c')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xc96c('0x186')});db[_0xc96c('0x127')][_0xc96c('0x11e')](db[_0xc96c('0x5f')],{'as':_0xc96c('0x160'),'onDelete':_0xc96c('0x11c'),'foreignKey':'SmsInteractionId'});db[_0xc96c('0x127')][_0xc96c('0x12c')](db[_0xc96c('0x5a')],{'as':'Account','foreignKey':_0xc96c('0x18c')});db['SmsInteraction'][_0xc96c('0x12c')](db[_0xc96c('0x7a')],{'as':_0xc96c('0x165'),'foreignKey':_0xc96c('0x166')});db['SmsInteraction'][_0xc96c('0x12c')](db['User'],{'as':_0xc96c('0x175'),'foreignKey':'UserId'});db[_0xc96c('0x127')][_0xc96c('0x12e')](db[_0xc96c('0x97')],{'through':'sms_interaction_has_tags','as':_0xc96c('0x177')});db[_0xc96c('0x127')][_0xc96c('0x12e')](db[_0xc96c('0x97')],{'through':_0xc96c('0x18d'),'as':'ThroughTags'});db['SmsInteraction']['belongsToMany'](db[_0xc96c('0x12')],{'as':_0xc96c('0x179'),'through':_0xc96c('0x138'),'foreignKey':_0xc96c('0x18e')});db[_0xc96c('0x5f')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'as':_0xc96c('0x12')});db[_0xc96c('0x5f')][_0xc96c('0x12c')](db['CmContact'],{'onDelete':_0xc96c('0x11c'),'as':'Contact'});db[_0xc96c('0x5f')]['belongsTo'](db[_0xc96c('0x127')],{'onDelete':_0xc96c('0x11c'),'as':_0xc96c('0x17b'),'foreignKey':_0xc96c('0x18e')});db[_0xc96c('0x5f')][_0xc96c('0x12c')](db[_0xc96c('0x5a')],{'as':_0xc96c('0x174'),'foreignKey':_0xc96c('0x18c')});db[_0xc96c('0x60')]['belongsToMany'](db[_0xc96c('0x12')],{'as':_0xc96c('0x15d'),'through':_0xc96c('0x39'),'foreignKey':_0xc96c('0x18f')});db['SmsQueue'][_0xc96c('0x12e')](db[_0xc96c('0xee')],{'through':_0xc96c('0x190'),'as':_0xc96c('0x15e')});db[_0xc96c('0x62')]['hasMany'](db[_0xc96c('0x8b')],{'as':_0xc96c('0x16d'),'foreignKey':'OpenchannelAccountId','onDelete':_0xc96c('0x11c')});db['OpenchannelAccount'][_0xc96c('0x11e')](db[_0xc96c('0x89')],{'as':'Answers','foreignKey':_0xc96c('0x191')});db[_0xc96c('0x62')]['hasMany'](db['OpenchannelInteraction'],{'as':_0xc96c('0x16f'),'foreignKey':'OpenchannelAccountId'});db[_0xc96c('0x62')][_0xc96c('0x11e')](db['OpenchannelMessage'],{'as':_0xc96c('0x160'),'foreignKey':_0xc96c('0x191')});db['OpenchannelAccount'][_0xc96c('0x11e')](db[_0xc96c('0x64')],{'as':_0xc96c('0x14f'),'foreignKey':_0xc96c('0x191')});db['OpenchannelAccount'][_0xc96c('0x12c')](db[_0xc96c('0x101')],{'as':_0xc96c('0x180'),'foreignKey':_0xc96c('0x185')});db[_0xc96c('0x62')][_0xc96c('0x12c')](db[_0xc96c('0x90')],{'as':_0xc96c('0x159'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xc96c('0x62')]['belongsToMany'](db['User'],{'as':_0xc96c('0x15d'),'through':_0xc96c('0x192')});db[_0xc96c('0x64')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'onDelete':_0xc96c('0x17f')});db[_0xc96c('0x64')][_0xc96c('0x12c')](db[_0xc96c('0x69')],{'onDelete':'restrict','foreignKey':_0xc96c('0x193')});db['OpenchannelApplication'][_0xc96c('0x12c')](db[_0xc96c('0x62')],{'onDelete':_0xc96c('0x17f'),'foreignKey':'OpenchannelAccountId'});db[_0xc96c('0x64')][_0xc96c('0x12c')](db[_0xc96c('0x8e')],{'onDelete':_0xc96c('0x17f'),'foreignKey':_0xc96c('0x158')});db[_0xc96c('0x64')]['belongsTo'](db[_0xc96c('0x97')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xc96c('0x65')][_0xc96c('0x11e')](db['OpenchannelMessage'],{'as':_0xc96c('0x160'),'onDelete':_0xc96c('0x11c'),'foreignKey':'OpenchannelInteractionId'});db[_0xc96c('0x65')]['belongsTo'](db['OpenchannelAccount'],{'as':_0xc96c('0x174'),'foreignKey':_0xc96c('0x191')});db[_0xc96c('0x65')][_0xc96c('0x12c')](db[_0xc96c('0x7a')],{'as':_0xc96c('0x165'),'foreignKey':_0xc96c('0x166')});db['OpenchannelInteraction'][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'as':_0xc96c('0x175'),'foreignKey':_0xc96c('0x11d')});db[_0xc96c('0x65')][_0xc96c('0x12e')](db[_0xc96c('0x97')],{'through':_0xc96c('0x194'),'as':'Tags'});db[_0xc96c('0x65')][_0xc96c('0x12e')](db[_0xc96c('0x97')],{'through':'openchannel_interaction_has_tags','as':'ThroughTags'});db[_0xc96c('0x65')][_0xc96c('0x12e')](db['User'],{'as':'Users','through':_0xc96c('0x139'),'foreignKey':_0xc96c('0x195')});db[_0xc96c('0x67')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'onDelete':_0xc96c('0x11c'),'as':_0xc96c('0x12')});db['OpenchannelMessage'][_0xc96c('0x12c')](db[_0xc96c('0x7a')],{'onDelete':_0xc96c('0x11c'),'as':'Contact'});db[_0xc96c('0x67')]['belongsTo'](db[_0xc96c('0x65')],{'onDelete':_0xc96c('0x11c'),'as':'Interaction','foreignKey':_0xc96c('0x195')});db[_0xc96c('0x67')][_0xc96c('0x12c')](db[_0xc96c('0xf4')],{'as':_0xc96c('0xf4'),'foreignKey':_0xc96c('0x18a')});db[_0xc96c('0x67')][_0xc96c('0x12c')](db[_0xc96c('0x62')],{'as':_0xc96c('0x174'),'foreignKey':_0xc96c('0x191')});db[_0xc96c('0x69')]['belongsToMany'](db[_0xc96c('0x12')],{'as':_0xc96c('0x15d'),'through':_0xc96c('0x3b'),'foreignKey':_0xc96c('0x193')});db[_0xc96c('0x69')][_0xc96c('0x12e')](db['Team'],{'through':_0xc96c('0x196'),'as':_0xc96c('0x15e')});db[_0xc96c('0x197')][_0xc96c('0x11e')](db[_0xc96c('0x8b')],{'as':_0xc96c('0x16d'),'foreignKey':_0xc96c('0x17c'),'onDelete':_0xc96c('0x11c')});db['ChatWebsite']['hasMany'](db[_0xc96c('0x89')],{'as':'Answers','foreignKey':_0xc96c('0x17c')});db[_0xc96c('0x197')][_0xc96c('0x11e')](db[_0xc96c('0x76')],{'as':_0xc96c('0x198')});db[_0xc96c('0x197')]['hasMany'](db[_0xc96c('0x126')],{'as':_0xc96c('0x16f')});db[_0xc96c('0x197')]['hasMany'](db[_0xc96c('0x6e')],{'as':_0xc96c('0x14f')});db[_0xc96c('0x197')][_0xc96c('0x11e')](db['ChatMessage'],{'as':_0xc96c('0x160')});db[_0xc96c('0x197')][_0xc96c('0x12c')](db['CmList'],{'as':_0xc96c('0x180'),'foreignKey':_0xc96c('0x185')});db['ChatWebsite'][_0xc96c('0x12c')](db[_0xc96c('0x8e')],{'as':_0xc96c('0x8e'),'foreignKey':'IntervalId'});db['ChatWebsite']['belongsTo'](db['MailAccount'],{'as':'MailAccount','foreignKey':_0xc96c('0x168')});db[_0xc96c('0x197')][_0xc96c('0x12c')](db[_0xc96c('0x90')],{'as':'mandatoryDispositionPause','foreignKey':_0xc96c('0x15a')});db['ChatWebsite'][_0xc96c('0x12e')](db['User'],{'as':_0xc96c('0x15d'),'through':'user_has_chat_websites'});db[_0xc96c('0x6c')][_0xc96c('0x12c')](db['OpenchannelAccount'],{});db[_0xc96c('0x6c')][_0xc96c('0x12c')](db[_0xc96c('0x101')],{'as':'List','foreignKey':_0xc96c('0x185')});db[_0xc96c('0x6c')][_0xc96c('0x12c')](db[_0xc96c('0x7a')],{'as':_0xc96c('0x165'),'foreignKey':'ContactId'});db[_0xc96c('0x6c')][_0xc96c('0x12c')](db['OpenchannelInteraction'],{});db[_0xc96c('0x6c')][_0xc96c('0x12c')](db[_0xc96c('0x67')],{});db[_0xc96c('0x6c')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0xc96c('0x69')],{});db[_0xc96c('0x6e')]['belongsTo'](db[_0xc96c('0x12')],{'as':_0xc96c('0x199'),'foreignKey':_0xc96c('0x11d'),'onDelete':_0xc96c('0x17f')});db[_0xc96c('0x6e')][_0xc96c('0x12c')](db[_0xc96c('0x73')],{'as':_0xc96c('0x19a'),'foreignKey':_0xc96c('0x19b'),'onDelete':_0xc96c('0x17f')});db[_0xc96c('0x6e')][_0xc96c('0x12c')](db['ChatWebsite'],{'as':_0xc96c('0x19c'),'foreignKey':'ChatWebsiteId','onDelete':'restrict'});db[_0xc96c('0x6e')][_0xc96c('0x12c')](db['Tag'],{'onDelete':_0xc96c('0x17f'),'foreignKey':_0xc96c('0x186')});db[_0xc96c('0x126')]['hasMany'](db[_0xc96c('0x70')],{'as':_0xc96c('0x160'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x19d')});db['ChatInteraction'][_0xc96c('0x12c')](db[_0xc96c('0x197')],{'as':_0xc96c('0x174'),'foreignKey':'ChatWebsiteId'});db[_0xc96c('0x126')][_0xc96c('0x12c')](db[_0xc96c('0x7a')],{'as':_0xc96c('0x165'),'foreignKey':_0xc96c('0x166')});db[_0xc96c('0x126')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'as':'Owner','foreignKey':_0xc96c('0x11d')});db[_0xc96c('0x126')][_0xc96c('0x12e')](db['Tag'],{'through':_0xc96c('0x19e'),'as':'Tags'});db[_0xc96c('0x126')]['belongsToMany'](db[_0xc96c('0x97')],{'through':'chat_interaction_has_tags','as':_0xc96c('0x178')});db[_0xc96c('0x126')]['belongsToMany'](db[_0xc96c('0x12')],{'as':_0xc96c('0x179'),'through':_0xc96c('0x136'),'foreignKey':'ChatInteractionId'});db[_0xc96c('0x70')][_0xc96c('0x12c')](db['User'],{'onDelete':_0xc96c('0x11c'),'as':'User'});db['ChatMessage'][_0xc96c('0x12c')](db[_0xc96c('0x7a')],{'onDelete':'cascade','as':_0xc96c('0x165'),'foreignKey':_0xc96c('0x166')});db[_0xc96c('0x70')]['belongsTo'](db[_0xc96c('0x126')],{'onDelete':_0xc96c('0x11c'),'as':_0xc96c('0x17b'),'foreignKey':_0xc96c('0x19d')});db[_0xc96c('0x70')]['belongsTo'](db['Attachment'],{'as':_0xc96c('0xf4'),'foreignKey':'AttachmentId'});db['ChatMessage']['belongsTo'](db[_0xc96c('0x197')],{'as':_0xc96c('0x174'),'foreignKey':_0xc96c('0x17c')});db[_0xc96c('0x17d')]['hasMany'](db[_0xc96c('0xf4')],{'as':_0xc96c('0x19f'),'foreignKey':'ChatOfflineMessageId','onDelete':_0xc96c('0x11c'),'hooks':!![]});db[_0xc96c('0x17d')][_0xc96c('0x12c')](db[_0xc96c('0x7a')],{'onDelete':'cascade','as':'Contact','foreignKey':_0xc96c('0x166')});db[_0xc96c('0x17d')][_0xc96c('0x12c')](db[_0xc96c('0x197')],{'as':_0xc96c('0x174'),'foreignKey':_0xc96c('0x17c')});db[_0xc96c('0x73')][_0xc96c('0x12e')](db['User'],{'as':_0xc96c('0x15d'),'through':'UserChatQueue','hooks':!![]});db[_0xc96c('0x73')][_0xc96c('0x12e')](db['Team'],{'through':_0xc96c('0x1a0'),'as':_0xc96c('0x15e')});db['ChatGroup'][_0xc96c('0x11e')](db[_0xc96c('0xd7')],{'as':_0xc96c('0x160'),'foreignKey':_0xc96c('0x1a1'),'onDelete':_0xc96c('0x11c')});db[_0xc96c('0x12f')][_0xc96c('0x12e')](db[_0xc96c('0x12')],{'as':_0xc96c('0x1a2'),'through':_0xc96c('0x130')});db[_0xc96c('0x76')][_0xc96c('0x12c')](db[_0xc96c('0x197')],{'as':_0xc96c('0x19c'),'foreignKey':_0xc96c('0x17c')});db[_0xc96c('0x78')]['hasMany'](db[_0xc96c('0x7a')],{'as':_0xc96c('0x131'),'foreignKey':'CompanyId'});db['CmContact'][_0xc96c('0x11e')](db[_0xc96c('0x7b')],{'as':_0xc96c('0x152'),'foreignKey':_0xc96c('0x166')});db[_0xc96c('0x7a')]['hasMany'](db[_0xc96c('0x7f')],{'as':_0xc96c('0x123'),'foreignKey':'ContactId'});db['CmContact'][_0xc96c('0x11e')](db[_0xc96c('0x81')],{'as':'HopperHistories','foreignKey':'ContactId'});db[_0xc96c('0x7a')][_0xc96c('0x11e')](db['ReportAgentPreview'],{'as':_0xc96c('0x82'),'foreignKey':_0xc96c('0x166')});db[_0xc96c('0x7a')][_0xc96c('0x11e')](db[_0xc96c('0xdd')],{'as':_0xc96c('0x154'),'foreignKey':_0xc96c('0x166')});db['CmContact'][_0xc96c('0x11e')](db['OpenchannelInteraction'],{'as':_0xc96c('0x125'),'foreignKey':_0xc96c('0x166'),'onDelete':_0xc96c('0x17f')});db[_0xc96c('0x7a')][_0xc96c('0x11e')](db[_0xc96c('0x126')],{'as':_0xc96c('0x135'),'foreignKey':_0xc96c('0x166'),'onDelete':_0xc96c('0x17f')});db[_0xc96c('0x7a')][_0xc96c('0x11e')](db[_0xc96c('0x127')],{'as':_0xc96c('0x128'),'foreignKey':'ContactId','onDelete':'restrict'});db['CmContact'][_0xc96c('0x11e')](db[_0xc96c('0x53')],{'as':_0xc96c('0x129'),'foreignKey':_0xc96c('0x166'),'onDelete':_0xc96c('0x17f')});db[_0xc96c('0x7a')]['hasMany'](db[_0xc96c('0x47')],{'as':_0xc96c('0x12a'),'foreignKey':'ContactId','onDelete':_0xc96c('0x17f')});db[_0xc96c('0x7a')][_0xc96c('0x12c')](db['CmCompany'],{'as':'Company','foreignKey':_0xc96c('0x1a3')});db['CmContact'][_0xc96c('0x12c')](db['CmList'],{'as':_0xc96c('0x180'),'foreignKey':_0xc96c('0x185'),'onDelete':_0xc96c('0x11c')});db[_0xc96c('0x7a')]['belongsToMany'](db[_0xc96c('0x12')],{'as':_0xc96c('0x179'),'through':_0xc96c('0x132')});db[_0xc96c('0x7a')][_0xc96c('0x12e')](db[_0xc96c('0x97')],{'as':'Tags','through':_0xc96c('0x1a4')});db[_0xc96c('0x7a')][_0xc96c('0x12e')](db[_0xc96c('0x97')],{'through':'cm_contact_has_tags','as':_0xc96c('0x178')});db[_0xc96c('0x7b')]['belongsTo'](db[_0xc96c('0x7a')],{'as':_0xc96c('0x165'),'foreignKey':_0xc96c('0x166'),'onDelete':_0xc96c('0x11c')});db[_0xc96c('0x7b')]['belongsTo'](db['CmList'],{'as':_0xc96c('0x180'),'foreignKey':_0xc96c('0x185'),'onDelete':_0xc96c('0x11c')});db[_0xc96c('0x7b')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'as':_0xc96c('0x199'),'foreignKey':'UserId'});db[_0xc96c('0x7b')][_0xc96c('0x12c')](db[_0xc96c('0x1b')],{'as':'Queue','foreignKey':_0xc96c('0x153'),'onDelete':_0xc96c('0x11c')});db[_0xc96c('0x7b')]['belongsTo'](db[_0xc96c('0xf1')],{'as':'Campaign','foreignKey':_0xc96c('0x1a5'),'onDelete':_0xc96c('0x11c')});db[_0xc96c('0x7b')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'as':_0xc96c('0x175'),'foreignKey':_0xc96c('0x1a6')});db[_0xc96c('0x7d')]['belongsTo'](db[_0xc96c('0x7a')],{'as':_0xc96c('0x165'),'foreignKey':_0xc96c('0x166'),'onDelete':_0xc96c('0x11c')});db['CmHopperBlack'][_0xc96c('0x12c')](db['CmList'],{'as':_0xc96c('0x180'),'foreignKey':_0xc96c('0x185'),'onDelete':_0xc96c('0x11c')});db['CmHopperBlack'][_0xc96c('0x12c')](db[_0xc96c('0x1b')],{'as':_0xc96c('0x19a'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0xc96c('0x7d')]['belongsTo'](db[_0xc96c('0xf1')],{'as':_0xc96c('0xf1'),'foreignKey':_0xc96c('0x1a5'),'onDelete':_0xc96c('0x11c')});db[_0xc96c('0x1a7')]['hasMany'](db[_0xc96c('0x8c')],{'as':{'plural':_0xc96c('0x1a8'),'singular':_0xc96c('0x1a9')},'foreignKey':_0xc96c('0x1aa'),'onDelete':_0xc96c('0x11c'),'hooks':!![]});db[_0xc96c('0x1a7')][_0xc96c('0x11e')](db[_0xc96c('0x8c')],{'as':{'plural':_0xc96c('0x1ab'),'singular':_0xc96c('0x1ac')},'foreignKey':_0xc96c('0x1ad'),'onDelete':_0xc96c('0x11c'),'hooks':!![]});db['Automation'][_0xc96c('0x11e')](db['Action'],{'as':_0xc96c('0x1ae'),'foreignKey':_0xc96c('0x1af'),'onDelete':_0xc96c('0x11c'),'hooks':!![]});db[_0xc96c('0x8b')][_0xc96c('0x11e')](db[_0xc96c('0x8b')],{'as':_0xc96c('0x16d'),'foreignKey':'ParentId','onDelete':'cascade'});db[_0xc96c('0x8e')]['hasMany'](db[_0xc96c('0x8e')],{'as':_0xc96c('0x1b0'),'foreignKey':_0xc96c('0x158'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0xc96c('0x8e')][_0xc96c('0x11e')](db[_0xc96c('0x121')],{'as':_0xc96c('0x122'),'foreignKey':_0xc96c('0x158'),'onDelete':_0xc96c('0x17f')});db[_0xc96c('0x8e')][_0xc96c('0x11e')](db['MailApplication'],{'as':_0xc96c('0x1b1'),'foreignKey':_0xc96c('0x158')});db['Interval'][_0xc96c('0x11e')](db['ChatApplication'],{'as':_0xc96c('0x1b2'),'foreignKey':'IntervalId'});db[_0xc96c('0x8e')]['hasMany'](db['FaxApplication'],{'as':_0xc96c('0x1b3'),'foreignKey':_0xc96c('0x158')});db[_0xc96c('0x8e')][_0xc96c('0x11e')](db[_0xc96c('0x5c')],{'as':'SmsApplications','foreignKey':'IntervalId'});db['Schedule']['belongsTo'](db['MailAccount'],{});db[_0xc96c('0x94')][_0xc96c('0x12c')](db[_0xc96c('0xa0')],{'foreignKey':'DefaultReportId'});db['Schedule']['belongsTo'](db[_0xc96c('0x1b4')],{'foreignKey':_0xc96c('0x1b5')});db[_0xc96c('0x96')][_0xc96c('0x12e')](db[_0xc96c('0x19')],{'as':_0xc96c('0x1b6'),'through':_0xc96c('0x151'),'onDelete':_0xc96c('0x17f')});db['Tag'][_0xc96c('0x12e')](db[_0xc96c('0x7a')],{'through':_0xc96c('0x1a4')});db[_0xc96c('0x97')][_0xc96c('0x12e')](db[_0xc96c('0x126')],{'through':_0xc96c('0x19e')});db[_0xc96c('0x97')][_0xc96c('0x12e')](db[_0xc96c('0x47')],{'through':_0xc96c('0x176')});db['Tag'][_0xc96c('0x12e')](db[_0xc96c('0x127')],{'through':_0xc96c('0x18d')});db[_0xc96c('0x97')][_0xc96c('0x12e')](db[_0xc96c('0x53')],{'through':_0xc96c('0x189')});db[_0xc96c('0x97')][_0xc96c('0x12e')](db[_0xc96c('0x65')],{'through':_0xc96c('0x194')});db[_0xc96c('0x97')][_0xc96c('0x12e')](db[_0xc96c('0x10e')],{'through':'whatsapp_interaction_has_tags'});db[_0xc96c('0x1b7')][_0xc96c('0x11e')](db['Condition'],{'as':{'plural':'AllConditions','singular':_0xc96c('0x1b8')},'foreignKey':_0xc96c('0x1b9'),'onDelete':_0xc96c('0x11c'),'hooks':!![]});db[_0xc96c('0x1b7')][_0xc96c('0x11e')](db[_0xc96c('0x8c')],{'as':{'plural':_0xc96c('0x1ba'),'singular':_0xc96c('0x1bb')},'foreignKey':_0xc96c('0x1bc'),'onDelete':_0xc96c('0x11c'),'hooks':!![]});db[_0xc96c('0x1b7')][_0xc96c('0x11e')](db[_0xc96c('0x86')],{'as':_0xc96c('0x1ae'),'foreignKey':'TriggerId','onDelete':_0xc96c('0x11c'),'hooks':!![]});db[_0xc96c('0x1b4')][_0xc96c('0x11e')](db['AnalyticFieldReport'],{'as':_0xc96c('0x1bd'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1b5'),'hooks':!![]});db[_0xc96c('0xa0')][_0xc96c('0x11e')](db['AnalyticFieldReport'],{'as':_0xc96c('0x1bd'),'onDelete':'cascade','foreignKey':_0xc96c('0x1be')});db[_0xc96c('0x1bf')][_0xc96c('0x11e')](db[_0xc96c('0xa5')],{'as':'Fields','onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c0')});db['AnalyticFieldReport'][_0xc96c('0x12c')](db[_0xc96c('0x1bf')],{'foreignKey':_0xc96c('0x1c0')});db[_0xc96c('0x1c1')][_0xc96c('0x11e')](db[_0xc96c('0xa9')],{'as':_0xc96c('0x1c2'),'onDelete':'cascade','foreignKey':_0xc96c('0x1c3')});db[_0xc96c('0xa9')][_0xc96c('0x11e')](db[_0xc96c('0xab')],{'as':_0xc96c('0x1c4'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c5')});db[_0xc96c('0xa9')][_0xc96c('0x11e')](db['SalesforceField'],{'as':_0xc96c('0x1c6'),'onDelete':'cascade','foreignKey':_0xc96c('0x1c7')});db[_0xc96c('0xa9')]['hasMany'](db[_0xc96c('0xab')],{'as':_0xc96c('0x1bd'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c8')});db[_0xc96c('0xa9')][_0xc96c('0x12c')](db['SalesforceAccount'],{'as':_0xc96c('0x174'),'foreignKey':_0xc96c('0x1c3')});db['SalesforceField']['hasMany'](db['SalesforceField'],{'as':'Subject','foreignKey':_0xc96c('0x1c5')});db[_0xc96c('0xab')][_0xc96c('0x11e')](db[_0xc96c('0xab')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xc96c('0xab')][_0xc96c('0x11e')](db[_0xc96c('0xab')],{'as':_0xc96c('0x1c9'),'foreignKey':_0xc96c('0x1c8')});db[_0xc96c('0xab')][_0xc96c('0x12c')](db['Variable'],{'as':'Variable','foreignKey':_0xc96c('0x1ca')});db[_0xc96c('0x1cb')]['hasMany'](db[_0xc96c('0x1cc')],{'as':'Configurations','onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c3')});db[_0xc96c('0x1cc')]['hasMany'](db[_0xc96c('0xaf')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xc96c('0x1c5')});db[_0xc96c('0x1cc')][_0xc96c('0x11e')](db[_0xc96c('0xaf')],{'as':_0xc96c('0x1c6'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c7')});db[_0xc96c('0x1cc')]['hasMany'](db[_0xc96c('0xaf')],{'as':_0xc96c('0x1bd'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c8')});db[_0xc96c('0x1cc')]['belongsTo'](db[_0xc96c('0x1cb')],{'as':_0xc96c('0x174'),'foreignKey':_0xc96c('0x1c3')});db['SugarcrmField'][_0xc96c('0x11e')](db['SugarcrmField'],{'as':_0xc96c('0x1cd'),'foreignKey':'SubjectId'});db[_0xc96c('0xaf')][_0xc96c('0x11e')](db[_0xc96c('0xaf')],{'as':_0xc96c('0x1ce'),'foreignKey':_0xc96c('0x1c7')});db[_0xc96c('0xaf')]['hasMany'](db[_0xc96c('0xaf')],{'as':_0xc96c('0x1c9'),'foreignKey':_0xc96c('0x1c8')});db[_0xc96c('0xaf')][_0xc96c('0x12c')](db[_0xc96c('0x9a')],{'as':_0xc96c('0x9a'),'foreignKey':_0xc96c('0x1ca')});db[_0xc96c('0xb1')][_0xc96c('0x11e')](db[_0xc96c('0xb3')],{'as':_0xc96c('0x1c2'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c3')});db[_0xc96c('0xb3')][_0xc96c('0x11e')](db['DeskField'],{'as':_0xc96c('0x1c4'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c5')});db['DeskConfiguration'][_0xc96c('0x11e')](db[_0xc96c('0x1cf')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xc96c('0x1c7')});db['DeskConfiguration']['hasMany'](db[_0xc96c('0x1cf')],{'as':_0xc96c('0x1bd'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c8')});db[_0xc96c('0xb3')]['belongsTo'](db['DeskAccount'],{'as':_0xc96c('0x174'),'foreignKey':'AccountId'});db[_0xc96c('0xb3')]['belongsToMany'](db['Tag'],{'through':_0xc96c('0x1d0')});db[_0xc96c('0x1cf')][_0xc96c('0x11e')](db[_0xc96c('0x1cf')],{'as':_0xc96c('0x1cd'),'foreignKey':_0xc96c('0x1c5')});db[_0xc96c('0x1cf')][_0xc96c('0x11e')](db[_0xc96c('0x1cf')],{'as':_0xc96c('0x1ce'),'foreignKey':_0xc96c('0x1c7')});db['DeskField']['hasMany'](db[_0xc96c('0x1cf')],{'as':_0xc96c('0x1c9'),'foreignKey':_0xc96c('0x1c8')});db[_0xc96c('0x1cf')][_0xc96c('0x12c')](db[_0xc96c('0x9a')],{'as':_0xc96c('0x9a'),'foreignKey':_0xc96c('0x1ca')});db[_0xc96c('0xb6')][_0xc96c('0x11e')](db[_0xc96c('0xb8')],{'as':_0xc96c('0x1c2'),'onDelete':'cascade','foreignKey':_0xc96c('0x1c3')});db[_0xc96c('0xb8')]['hasMany'](db['ZohoField'],{'as':_0xc96c('0x1c4'),'onDelete':_0xc96c('0x11c'),'foreignKey':'SubjectId'});db[_0xc96c('0xb8')][_0xc96c('0x11e')](db[_0xc96c('0x1d1')],{'as':_0xc96c('0x1c6'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c7')});db[_0xc96c('0xb8')][_0xc96c('0x11e')](db['ZohoField'],{'as':'Fields','onDelete':'cascade','foreignKey':_0xc96c('0x1c8')});db[_0xc96c('0xb8')][_0xc96c('0x12c')](db['ZohoAccount'],{'as':_0xc96c('0x174'),'foreignKey':_0xc96c('0x1c3')});db[_0xc96c('0x1d1')]['hasMany'](db['ZohoField'],{'as':_0xc96c('0x1cd'),'foreignKey':_0xc96c('0x1c5')});db['ZohoField'][_0xc96c('0x11e')](db[_0xc96c('0x1d1')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xc96c('0x1d1')][_0xc96c('0x11e')](db[_0xc96c('0x1d1')],{'as':_0xc96c('0x1c9'),'foreignKey':_0xc96c('0x1c8')});db[_0xc96c('0x1d1')]['belongsTo'](db[_0xc96c('0x9a')],{'as':'Variable','foreignKey':_0xc96c('0x1ca')});db[_0xc96c('0x1d2')][_0xc96c('0x11e')](db[_0xc96c('0xbb')],{'as':_0xc96c('0x1c2'),'onDelete':'cascade','foreignKey':_0xc96c('0x1c3')});db[_0xc96c('0xbb')][_0xc96c('0x11e')](db[_0xc96c('0xbd')],{'as':_0xc96c('0x1c4'),'foreignKey':_0xc96c('0x1c5')});db[_0xc96c('0xbb')][_0xc96c('0x11e')](db['ZendeskField'],{'as':'Descriptions','foreignKey':_0xc96c('0x1c7')});db[_0xc96c('0xbb')][_0xc96c('0x11e')](db[_0xc96c('0xbd')],{'as':'Fields','foreignKey':_0xc96c('0x1c8')});db['ZendeskConfiguration'][_0xc96c('0x12c')](db['ZendeskAccount'],{'as':_0xc96c('0x174'),'foreignKey':'AccountId'});db[_0xc96c('0xbb')][_0xc96c('0x12e')](db['Tag'],{'through':_0xc96c('0x1d3')});db[_0xc96c('0xbd')][_0xc96c('0x11e')](db['ZendeskField'],{'as':_0xc96c('0x1cd'),'foreignKey':_0xc96c('0x1c5')});db[_0xc96c('0xbd')][_0xc96c('0x11e')](db['ZendeskField'],{'as':'Description','foreignKey':_0xc96c('0x1c7')});db[_0xc96c('0xbd')][_0xc96c('0x11e')](db['ZendeskField'],{'as':_0xc96c('0x1c9'),'foreignKey':_0xc96c('0x1c8')});db['ZendeskField']['belongsTo'](db[_0xc96c('0x9a')],{'as':_0xc96c('0x9a'),'foreignKey':_0xc96c('0x1ca')});db[_0xc96c('0xbe')]['hasMany'](db[_0xc96c('0xbf')],{'as':_0xc96c('0x1c2'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c3')});db[_0xc96c('0xbf')][_0xc96c('0x11e')](db[_0xc96c('0x1d4')],{'as':'Subjects','onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c5')});db[_0xc96c('0xbf')][_0xc96c('0x11e')](db[_0xc96c('0x1d4')],{'as':'Descriptions','onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c7')});db[_0xc96c('0xbf')][_0xc96c('0x11e')](db[_0xc96c('0x1d4')],{'as':_0xc96c('0x1bd'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c8')});db[_0xc96c('0xbf')][_0xc96c('0x12c')](db[_0xc96c('0xbe')],{'as':_0xc96c('0x174'),'foreignKey':'AccountId'});db[_0xc96c('0xbf')][_0xc96c('0x12e')](db[_0xc96c('0x97')],{'through':_0xc96c('0x1d5')});db['FreshdeskField'][_0xc96c('0x11e')](db[_0xc96c('0x1d4')],{'as':_0xc96c('0x1cd'),'foreignKey':'SubjectId'});db[_0xc96c('0x1d4')]['hasMany'](db[_0xc96c('0x1d4')],{'as':'Description','foreignKey':_0xc96c('0x1c7')});db[_0xc96c('0x1d4')]['hasMany'](db['FreshdeskField'],{'as':_0xc96c('0x1c9'),'foreignKey':_0xc96c('0x1c8')});db[_0xc96c('0x1d4')]['belongsTo'](db[_0xc96c('0x9a')],{'as':_0xc96c('0x9a'),'foreignKey':_0xc96c('0x1ca')});db['VtigerAccount'][_0xc96c('0x11e')](db[_0xc96c('0xc3')],{'as':_0xc96c('0x1c2'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c3')});db[_0xc96c('0xc3')][_0xc96c('0x11e')](db[_0xc96c('0xc5')],{'as':'Subjects','foreignKey':_0xc96c('0x1c5')});db[_0xc96c('0xc3')]['hasMany'](db[_0xc96c('0xc5')],{'as':_0xc96c('0x1c6'),'foreignKey':'DescriptionId'});db[_0xc96c('0xc3')]['hasMany'](db[_0xc96c('0xc5')],{'as':_0xc96c('0x1bd'),'foreignKey':'FieldId'});db[_0xc96c('0xc3')][_0xc96c('0x12c')](db[_0xc96c('0x1d6')],{'as':_0xc96c('0x174'),'foreignKey':_0xc96c('0x1c3')});db['VtigerField']['hasMany'](db[_0xc96c('0xc5')],{'as':_0xc96c('0x1cd'),'foreignKey':_0xc96c('0x1c5')});db[_0xc96c('0xc5')][_0xc96c('0x11e')](db[_0xc96c('0xc5')],{'as':_0xc96c('0x1ce'),'foreignKey':'DescriptionId'});db[_0xc96c('0xc5')][_0xc96c('0x11e')](db[_0xc96c('0xc5')],{'as':_0xc96c('0x1c9'),'foreignKey':'FieldId'});db['VtigerField']['belongsTo'](db[_0xc96c('0x9a')],{'as':_0xc96c('0x9a'),'foreignKey':_0xc96c('0x1ca')});db[_0xc96c('0xc7')][_0xc96c('0x11e')](db[_0xc96c('0xc9')],{'as':'Configurations','onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c3')});db[_0xc96c('0xc9')][_0xc96c('0x11e')](db[_0xc96c('0xcb')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0xc96c('0xc9')]['hasMany'](db[_0xc96c('0xcb')],{'as':'Descriptions','foreignKey':_0xc96c('0x1c7')});db['ServicenowConfiguration']['hasMany'](db['ServicenowField'],{'as':_0xc96c('0x1bd'),'foreignKey':_0xc96c('0x1c8')});db[_0xc96c('0xc9')][_0xc96c('0x12c')](db[_0xc96c('0xc7')],{'as':_0xc96c('0x174'),'foreignKey':_0xc96c('0x1c3')});db[_0xc96c('0xcb')][_0xc96c('0x11e')](db['ServicenowField'],{'as':_0xc96c('0x1cd'),'foreignKey':_0xc96c('0x1c5')});db[_0xc96c('0xcb')][_0xc96c('0x11e')](db['ServicenowField'],{'as':_0xc96c('0x1ce'),'foreignKey':_0xc96c('0x1c7')});db[_0xc96c('0xcb')][_0xc96c('0x11e')](db[_0xc96c('0xcb')],{'as':_0xc96c('0x1c9'),'foreignKey':'FieldId'});db[_0xc96c('0xcb')][_0xc96c('0x12c')](db[_0xc96c('0x9a')],{'as':_0xc96c('0x9a'),'foreignKey':_0xc96c('0x1ca')});db[_0xc96c('0xcd')][_0xc96c('0x11e')](db[_0xc96c('0xcf')],{'as':_0xc96c('0x1c2'),'onDelete':_0xc96c('0x11c'),'foreignKey':'AccountId'});db[_0xc96c('0xcf')][_0xc96c('0x11e')](db[_0xc96c('0x1d7')],{'as':_0xc96c('0x1c4'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c5')});db[_0xc96c('0xcf')][_0xc96c('0x11e')](db[_0xc96c('0x1d7')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xc96c('0x1c7')});db[_0xc96c('0xcf')]['hasMany'](db[_0xc96c('0x1d7')],{'as':'Fields','onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c8')});db[_0xc96c('0xcf')][_0xc96c('0x12c')](db[_0xc96c('0xcd')],{'as':_0xc96c('0x174'),'foreignKey':'AccountId'});db[_0xc96c('0x1d7')]['hasMany'](db['Dynamics365Field'],{'as':_0xc96c('0x1cd'),'foreignKey':_0xc96c('0x1c5')});db[_0xc96c('0x1d7')]['hasMany'](db[_0xc96c('0x1d7')],{'as':'Description','foreignKey':_0xc96c('0x1c7')});db[_0xc96c('0x1d7')][_0xc96c('0x11e')](db['Dynamics365Field'],{'as':_0xc96c('0x1c9'),'foreignKey':_0xc96c('0x1c8')});db[_0xc96c('0x1d7')]['belongsTo'](db[_0xc96c('0x9a')],{'as':_0xc96c('0x9a'),'foreignKey':_0xc96c('0x1ca')});db[_0xc96c('0xd0')][_0xc96c('0x11e')](db[_0xc96c('0xd1')],{'as':_0xc96c('0x1c2'),'onDelete':_0xc96c('0x11c'),'foreignKey':'AccountId'});db['FreshsalesConfiguration'][_0xc96c('0x11e')](db[_0xc96c('0xd3')],{'as':_0xc96c('0x1c4'),'foreignKey':_0xc96c('0x1c5')});db[_0xc96c('0xd1')]['hasMany'](db['FreshsalesField'],{'as':'Descriptions','foreignKey':_0xc96c('0x1c7')});db[_0xc96c('0xd1')][_0xc96c('0x11e')](db[_0xc96c('0xd3')],{'as':'Fields','foreignKey':_0xc96c('0x1c8')});db['FreshsalesConfiguration']['belongsTo'](db['FreshsalesAccount'],{'as':_0xc96c('0x174'),'foreignKey':_0xc96c('0x1c3')});db[_0xc96c('0xd3')][_0xc96c('0x11e')](db[_0xc96c('0xd3')],{'as':_0xc96c('0x1cd'),'foreignKey':_0xc96c('0x1c5')});db[_0xc96c('0xd3')][_0xc96c('0x11e')](db[_0xc96c('0xd3')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xc96c('0xd3')]['hasMany'](db[_0xc96c('0xd3')],{'as':_0xc96c('0x1c9'),'foreignKey':_0xc96c('0x1c8')});db['FreshsalesField'][_0xc96c('0x12c')](db[_0xc96c('0x9a')],{'as':_0xc96c('0x9a'),'foreignKey':_0xc96c('0x1ca')});db[_0xc96c('0x1d8')]['belongsTo'](db[_0xc96c('0x197')],{});db[_0xc96c('0x1d8')][_0xc96c('0x12c')](db[_0xc96c('0x101')],{'as':_0xc96c('0x180'),'foreignKey':_0xc96c('0x185')});db[_0xc96c('0x1d8')]['belongsTo'](db[_0xc96c('0x7a')],{'as':_0xc96c('0x165'),'foreignKey':_0xc96c('0x166')});db[_0xc96c('0x1d8')]['belongsTo'](db[_0xc96c('0x126')],{});db[_0xc96c('0x1d8')]['belongsTo'](db['ChatMessage'],{});db[_0xc96c('0x1d8')]['belongsTo'](db['User'],{});db[_0xc96c('0x1d8')][_0xc96c('0x12c')](db[_0xc96c('0x73')],{});db[_0xc96c('0xd7')]['belongsTo'](db[_0xc96c('0x12')],{'onDelete':'cascade','foreignKey':_0xc96c('0x1d9')});db[_0xc96c('0xd7')][_0xc96c('0x12c')](db['User'],{'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1da')});db[_0xc96c('0xdd')][_0xc96c('0x11e')](db['JscriptyQuestionReport'],{'foreignKey':_0xc96c('0x1db'),'onDelete':_0xc96c('0x11c')});db[_0xc96c('0xdd')][_0xc96c('0x11e')](db[_0xc96c('0xd9')],{'foreignKey':_0xc96c('0x1db'),'onDelete':'cascade'});db[_0xc96c('0xdf')][_0xc96c('0x12c')](db[_0xc96c('0x5a')],{});db[_0xc96c('0xdf')][_0xc96c('0x12c')](db[_0xc96c('0x101')],{'as':_0xc96c('0x180'),'foreignKey':_0xc96c('0x185')});db['SmsQueueReport'][_0xc96c('0x12c')](db['CmContact'],{'as':_0xc96c('0x165'),'foreignKey':_0xc96c('0x166')});db[_0xc96c('0xdf')]['belongsTo'](db[_0xc96c('0x127')],{});db[_0xc96c('0xdf')][_0xc96c('0x12c')](db[_0xc96c('0x5f')],{});db[_0xc96c('0xdf')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{});db[_0xc96c('0xdf')]['belongsTo'](db['SmsQueue'],{});db[_0xc96c('0xe4')][_0xc96c('0x11e')](db['JscriptySessionReport'],{'foreignKey':_0xc96c('0x1dc')});db[_0xc96c('0xe4')][_0xc96c('0x11e')](db[_0xc96c('0xdb')],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0xc96c('0x11e')](db['JscriptyAnswerReport'],{'foreignKey':_0xc96c('0x1dc')});db[_0xc96c('0x1dd')][_0xc96c('0x12e')](db[_0xc96c('0x12')],{'as':'Users','through':_0xc96c('0x1de')});db[_0xc96c('0xee')]['belongsToMany'](db[_0xc96c('0x12')],{'as':_0xc96c('0x15d'),'through':_0xc96c('0x134')});db['Team'][_0xc96c('0x12e')](db[_0xc96c('0x1b')],{'through':_0xc96c('0x117'),'as':'VoiceQueues'});db[_0xc96c('0xee')][_0xc96c('0x12e')](db[_0xc96c('0x43')],{'through':_0xc96c('0x172'),'as':_0xc96c('0x13d')});db[_0xc96c('0xee')]['belongsToMany'](db[_0xc96c('0x73')],{'through':'team_has_chat_queues','as':_0xc96c('0x13e')});db['Team'][_0xc96c('0x12e')](db[_0xc96c('0x56')],{'through':'team_has_fax_queues','as':_0xc96c('0x13f')});db[_0xc96c('0xee')]['belongsToMany'](db[_0xc96c('0x60')],{'through':_0xc96c('0x190'),'as':_0xc96c('0x140')});db[_0xc96c('0xee')]['belongsToMany'](db['OpenchannelQueue'],{'through':'team_has_openchannel_queues','as':_0xc96c('0x141')});db[_0xc96c('0xee')][_0xc96c('0x12e')](db[_0xc96c('0x113')],{'through':'team_has_whatsapp_queues','as':_0xc96c('0x1df')});db[_0xc96c('0xee')][_0xc96c('0x12e')](db[_0xc96c('0x103')],{'through':_0xc96c('0x119'),'as':_0xc96c('0x13c')});db[_0xc96c('0xf1')][_0xc96c('0x11e')](db[_0xc96c('0x7b')],{'as':'Hoppers','foreignKey':'CampaignId'});db['Campaign'][_0xc96c('0x11e')](db[_0xc96c('0x7f')],{'as':_0xc96c('0x123'),'foreignKey':_0xc96c('0x1a5')});db[_0xc96c('0xf1')][_0xc96c('0x11e')](db['CmHopperHistory'],{'as':_0xc96c('0x1e0'),'foreignKey':'CampaignId'});db[_0xc96c('0xf1')][_0xc96c('0x11e')](db[_0xc96c('0x7d')],{'as':_0xc96c('0x1e1'),'foreignKey':_0xc96c('0x1a5')});db['Campaign'][_0xc96c('0x12c')](db[_0xc96c('0x2e')],{'as':_0xc96c('0x2e'),'foreignKey':_0xc96c('0x155')});db[_0xc96c('0xf1')][_0xc96c('0x12c')](db[_0xc96c('0x2e')],{'as':'TrunkBackup','foreignKey':_0xc96c('0x157')});db[_0xc96c('0xf1')][_0xc96c('0x12c')](db['Interval'],{'as':_0xc96c('0x8e'),'foreignKey':_0xc96c('0x158')});db[_0xc96c('0xf1')][_0xc96c('0x12c')](db[_0xc96c('0x1dd')],{'as':'SquareProject','foreignKey':_0xc96c('0x1e2')});db['Campaign'][_0xc96c('0x12e')](db['CmList'],{'as':'Lists','through':_0xc96c('0x1e3')});db[_0xc96c('0xf1')]['belongsToMany'](db[_0xc96c('0x101')],{'as':_0xc96c('0x1e4'),'through':_0xc96c('0x1e5')});db[_0xc96c('0xf4')][_0xc96c('0x12c')](db[_0xc96c('0x17d')],{'as':_0xc96c('0x17d'),'foreignKey':_0xc96c('0x17e')});db['MailTransferReport']['belongsTo'](db[_0xc96c('0x49')],{});db[_0xc96c('0xf8')][_0xc96c('0x12c')](db[_0xc96c('0x47')],{});db['MailTransferReport'][_0xc96c('0x12c')](db[_0xc96c('0x41')],{'foreignKey':_0xc96c('0x1e6'),'as':_0xc96c('0x1e7')});db[_0xc96c('0xf8')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'foreignKey':'FromUserId','as':_0xc96c('0x1e8')});db[_0xc96c('0xf8')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'foreignKey':_0xc96c('0x1e9'),'as':_0xc96c('0x1ea')});db[_0xc96c('0xf8')][_0xc96c('0x12c')](db[_0xc96c('0x43')],{'foreignKey':'ToMailQueueId','as':_0xc96c('0x1eb')});db[_0xc96c('0xf8')][_0xc96c('0x12c')](db[_0xc96c('0x41')],{'foreignKey':_0xc96c('0x1ec'),'as':'ToAccount'});db[_0xc96c('0xfa')][_0xc96c('0x12c')](db[_0xc96c('0x70')],{});db[_0xc96c('0xfa')][_0xc96c('0x12c')](db[_0xc96c('0x126')],{});db[_0xc96c('0xfa')][_0xc96c('0x12c')](db['ChatWebsite'],{'foreignKey':_0xc96c('0x1ed'),'as':_0xc96c('0x1e7')});db[_0xc96c('0xfa')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'foreignKey':_0xc96c('0x1ee'),'as':_0xc96c('0x1e8')});db[_0xc96c('0xfa')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'foreignKey':_0xc96c('0x1e9'),'as':_0xc96c('0x1ea')});db[_0xc96c('0xfa')][_0xc96c('0x12c')](db[_0xc96c('0x73')],{'foreignKey':_0xc96c('0x1ef'),'as':'ToQueue'});db[_0xc96c('0xfa')][_0xc96c('0x12c')](db[_0xc96c('0x197')],{'foreignKey':_0xc96c('0x1f0'),'as':_0xc96c('0x1f1')});db[_0xc96c('0xfc')][_0xc96c('0x12c')](db['FaxMessage'],{});db[_0xc96c('0xfc')][_0xc96c('0x12c')](db[_0xc96c('0x53')],{});db[_0xc96c('0xfc')]['belongsTo'](db['FaxAccount'],{'foreignKey':'FromFaxAccountId','as':_0xc96c('0x1e7')});db[_0xc96c('0xfc')][_0xc96c('0x12c')](db['User'],{'foreignKey':'FromUserId','as':_0xc96c('0x1e8')});db[_0xc96c('0xfc')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'foreignKey':_0xc96c('0x1e9'),'as':'ToAgent'});db[_0xc96c('0xfc')][_0xc96c('0x12c')](db[_0xc96c('0x56')],{'foreignKey':'ToFaxQueueId','as':'ToQueue'});db[_0xc96c('0xfc')][_0xc96c('0x12c')](db[_0xc96c('0x51')],{'foreignKey':_0xc96c('0x1f2'),'as':_0xc96c('0x1f1')});db['OpenchannelTransferReport'][_0xc96c('0x12c')](db[_0xc96c('0x67')],{});db['OpenchannelTransferReport'][_0xc96c('0x12c')](db[_0xc96c('0x65')],{});db[_0xc96c('0xfe')][_0xc96c('0x12c')](db[_0xc96c('0x62')],{'foreignKey':_0xc96c('0x1f3'),'as':'FromAccount'});db[_0xc96c('0xfe')][_0xc96c('0x12c')](db['User'],{'foreignKey':_0xc96c('0x1ee'),'as':_0xc96c('0x1e8')});db['OpenchannelTransferReport'][_0xc96c('0x12c')](db['User'],{'foreignKey':_0xc96c('0x1e9'),'as':'ToAgent'});db['OpenchannelTransferReport'][_0xc96c('0x12c')](db[_0xc96c('0x69')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0xc96c('0xfe')][_0xc96c('0x12c')](db['OpenchannelAccount'],{'foreignKey':_0xc96c('0x1f4'),'as':_0xc96c('0x1f1')});db['SmsTransferReport']['belongsTo'](db[_0xc96c('0x5f')],{});db[_0xc96c('0x1f5')][_0xc96c('0x12c')](db[_0xc96c('0x127')],{});db[_0xc96c('0x1f5')]['belongsTo'](db[_0xc96c('0x5a')],{'foreignKey':_0xc96c('0x1f6'),'as':'FromAccount'});db[_0xc96c('0x1f5')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'foreignKey':_0xc96c('0x1ee'),'as':_0xc96c('0x1e8')});db['SmsTransferReport']['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':_0xc96c('0x1ea')});db[_0xc96c('0x1f5')][_0xc96c('0x12c')](db[_0xc96c('0x60')],{'foreignKey':'ToSmsQueueId','as':_0xc96c('0x1eb')});db[_0xc96c('0x1f5')][_0xc96c('0x12c')](db[_0xc96c('0x5a')],{'foreignKey':_0xc96c('0x1f7'),'as':_0xc96c('0x1f1')});db['CmList'][_0xc96c('0x11e')](db[_0xc96c('0x8b')],{'as':'Dispositions','foreignKey':_0xc96c('0x185'),'onDelete':_0xc96c('0x11c')});db['CmList'][_0xc96c('0x11e')](db[_0xc96c('0x84')],{'as':'CustomFields','foreignKey':'ListId'});db[_0xc96c('0x101')][_0xc96c('0x11e')](db[_0xc96c('0x7a')],{'as':'Contacts','onDelete':'cascade','foreignKey':_0xc96c('0x185')});db[_0xc96c('0x101')][_0xc96c('0x11e')](db[_0xc96c('0x7f')],{'as':'HopperFinals','foreignKey':'ListId'});db['CmList'][_0xc96c('0x11e')](db[_0xc96c('0x81')],{'as':_0xc96c('0x124'),'foreignKey':'ListId'});db[_0xc96c('0x101')][_0xc96c('0x11e')](db[_0xc96c('0x82')],{'as':'ReportAgentPreview','foreignKey':_0xc96c('0x185')});db['CmList'][_0xc96c('0x12e')](db[_0xc96c('0x1b')],{'as':'Queues','through':_0xc96c('0x15c')});db[_0xc96c('0x101')]['belongsToMany'](db[_0xc96c('0x12')],{'as':_0xc96c('0x15d'),'through':_0xc96c('0x133')});db[_0xc96c('0x103')][_0xc96c('0x11e')](db[_0xc96c('0x121')],{'as':_0xc96c('0x122'),'onDelete':_0xc96c('0x11c')});db[_0xc96c('0x103')]['belongsToMany'](db[_0xc96c('0x12')],{'as':_0xc96c('0x15d'),'through':_0xc96c('0x11b')});db[_0xc96c('0x103')][_0xc96c('0x12e')](db[_0xc96c('0xee')],{'through':_0xc96c('0x119'),'as':_0xc96c('0x15e')});db['UserProfile'][_0xc96c('0x11e')](db[_0xc96c('0x12')],{'as':'Users','foreignKey':_0xc96c('0x12d')});db[_0xc96c('0x105')]['hasMany'](db[_0xc96c('0x106')],{'as':'UserProfileSections','foreignKey':_0xc96c('0x12d'),'onDelete':_0xc96c('0x11c')});db[_0xc96c('0x106')][_0xc96c('0x11e')](db[_0xc96c('0x108')],{'as':'Resources','foreignKey':'sectionId','onDelete':'cascade'});db['WhatsappAccount'][_0xc96c('0x11e')](db[_0xc96c('0x8b')],{'as':_0xc96c('0x16d'),'foreignKey':_0xc96c('0x1f8'),'onDelete':'cascade'});db[_0xc96c('0x10c')]['hasMany'](db[_0xc96c('0x89')],{'as':'Answers','foreignKey':_0xc96c('0x1f8')});db[_0xc96c('0x10c')]['hasMany'](db[_0xc96c('0x1f9')],{'as':_0xc96c('0x160'),'foreignKey':_0xc96c('0x1f8')});db[_0xc96c('0x10c')][_0xc96c('0x11e')](db['WhatsappInteraction'],{'as':_0xc96c('0x16f')});db['WhatsappAccount'][_0xc96c('0x11e')](db[_0xc96c('0x1fa')],{'as':_0xc96c('0x14f')});db[_0xc96c('0x10c')][_0xc96c('0x12c')](db[_0xc96c('0x101')],{'as':'List','foreignKey':_0xc96c('0x185')});db[_0xc96c('0x10c')]['belongsTo'](db[_0xc96c('0x90')],{'as':'mandatoryDispositionPause','foreignKey':_0xc96c('0x15a')});db[_0xc96c('0x10c')][_0xc96c('0x12e')](db['User'],{'as':_0xc96c('0x15d'),'through':_0xc96c('0x14c')});db[_0xc96c('0x1fa')]['belongsTo'](db[_0xc96c('0x12')],{'onDelete':_0xc96c('0x17f')});db[_0xc96c('0x1fa')][_0xc96c('0x12c')](db[_0xc96c('0x113')],{'onDelete':_0xc96c('0x17f')});db[_0xc96c('0x1fa')][_0xc96c('0x12c')](db[_0xc96c('0x10c')],{'onDelete':_0xc96c('0x17f')});db[_0xc96c('0x1fa')]['belongsTo'](db[_0xc96c('0x8e')],{'onDelete':_0xc96c('0x17f'),'foreignKey':_0xc96c('0x158')});db[_0xc96c('0x1fa')]['belongsTo'](db[_0xc96c('0x97')],{'onDelete':_0xc96c('0x17f'),'foreignKey':_0xc96c('0x186')});db[_0xc96c('0x10e')][_0xc96c('0x11e')](db['WhatsappMessage'],{'as':_0xc96c('0x160'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1fb')});db[_0xc96c('0x10e')][_0xc96c('0x12c')](db[_0xc96c('0x10c')],{'as':_0xc96c('0x174'),'foreignKey':_0xc96c('0x1f8')});db[_0xc96c('0x10e')][_0xc96c('0x12c')](db['CmContact'],{'as':_0xc96c('0x165'),'foreignKey':_0xc96c('0x166')});db[_0xc96c('0x10e')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'as':_0xc96c('0x175'),'foreignKey':_0xc96c('0x11d')});db['WhatsappInteraction'][_0xc96c('0x12e')](db['Tag'],{'through':_0xc96c('0x1fc'),'as':'Tags'});db[_0xc96c('0x10e')]['belongsToMany'](db[_0xc96c('0x97')],{'through':_0xc96c('0x1fc'),'as':_0xc96c('0x178')});db[_0xc96c('0x10e')][_0xc96c('0x12e')](db[_0xc96c('0x12')],{'as':_0xc96c('0x179'),'through':_0xc96c('0x13a'),'foreignKey':_0xc96c('0x1fb')});db['WhatsappMessage'][_0xc96c('0x12c')](db['User'],{'as':_0xc96c('0x12')});db[_0xc96c('0x1f9')]['belongsTo'](db[_0xc96c('0x7a')],{'onDelete':_0xc96c('0x11c'),'as':_0xc96c('0x165')});db[_0xc96c('0x1f9')][_0xc96c('0x12c')](db[_0xc96c('0x10e')],{'onDelete':'cascade','as':_0xc96c('0x17b'),'foreignKey':_0xc96c('0x1fb')});db[_0xc96c('0x1f9')]['belongsTo'](db['WhatsappAccount'],{'as':_0xc96c('0x174'),'foreignKey':_0xc96c('0x1f8')});db['WhatsappQueueReport'][_0xc96c('0x12c')](db['WhatsappAccount'],{});db[_0xc96c('0x1fd')]['belongsTo'](db[_0xc96c('0x101')],{'as':'List','foreignKey':'ListId'});db[_0xc96c('0x1fd')][_0xc96c('0x12c')](db['CmContact'],{'as':_0xc96c('0x165'),'foreignKey':_0xc96c('0x166')});db[_0xc96c('0x1fd')]['belongsTo'](db[_0xc96c('0x10e')],{});db[_0xc96c('0x1fd')]['belongsTo'](db[_0xc96c('0x113')],{});db[_0xc96c('0x1fd')][_0xc96c('0x12c')](db[_0xc96c('0x1f9')],{});db['WhatsappQueueReport']['belongsTo'](db[_0xc96c('0x12')],{});db[_0xc96c('0x111')]['belongsTo'](db['WhatsappMessage'],{});db[_0xc96c('0x111')][_0xc96c('0x12c')](db[_0xc96c('0x10e')],{});db['WhatsappTransferReport']['belongsTo'](db[_0xc96c('0x10c')],{'foreignKey':'FromWhatsappAccountId','as':_0xc96c('0x1e7')});db[_0xc96c('0x111')][_0xc96c('0x12c')](db[_0xc96c('0x10c')],{'foreignKey':_0xc96c('0x1fe'),'as':_0xc96c('0x1f1')});db[_0xc96c('0x111')][_0xc96c('0x12c')](db['WhatsappQueue'],{'foreignKey':_0xc96c('0x1ff'),'as':'ToQueue'});db['WhatsappTransferReport']['belongsTo'](db[_0xc96c('0x12')],{'foreignKey':_0xc96c('0x1ee'),'as':'FromAgent'});db[_0xc96c('0x111')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'foreignKey':_0xc96c('0x1e9'),'as':'ToAgent'});db[_0xc96c('0x113')][_0xc96c('0x12e')](db['User'],{'as':_0xc96c('0x15d'),'through':'UserWhatsappQueue','foreignKey':'WhatsappQueueId'});db['WhatsappQueue'][_0xc96c('0x12e')](db[_0xc96c('0xee')],{'through':_0xc96c('0x200'),'as':_0xc96c('0x15e')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xb7e7=['ChatInternalMessage','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','hasOne','UserId','hasMany','VoiceRecording','VoiceQueuesRt','Extensions','cascade','CmHopperHistory','OpenchannelInteractions','ChatInteraction','FaxInteractions','MailInteractions','WhatsappInteractions','userProfileId','belongsToMany','Groups','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueue','VoiceQueues','VoicePrefixes','UserVoicePrefix','MailQueues','ChatQueues','FaxQueue','SmsQueues','OpenchannelQueues','WhatsappQueue','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','belongsTo','TrunkId','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','voice_queues_has_cm_blacklists','mailbox','QueueCalls','uniqueid','VoiceCallReport','AgentReports','ContactId','MailAccountId','Imap','Dispositions','Answers','Messages','Interactions','MailApplication','List','ListId','team_has_mail_queues','Account','Contact','Owner','mail_interaction_has_tags','ThroughTags','Users','MailInteractionId','Attachments','ChatWebsiteId','restrict','TagId','Items','FaxAccount','FaxAccountId','FaxApplication','Exntensions','mandatoryDispositionPause','fax_interaction_has_tags','FaxInteractionId','Interaction','AttachmentId','team_has_fax_queues','SmsAccountId','SmsMessage','SmsApplication','user_has_sms_accounts','Tags','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','OpenchannelQueueReport','Agent','Queue','ChatQueueId','chat_interaction_has_tags','user_has_chat_interactions','ChatInteractionId','ChatOfflineMessageId','ChatQueue','Members','chat_group_has_users','Website','Contacts','CompanyId','CmHopper','HopperFinals','ChatInteractions','Company','cm_contact_has_tags','Campaign','CampaignId','OwnerId','All','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllCondition','AnyConditions','AnyCondition','TriggerAnyId','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','FieldId','Subject','Description','DescriptionId','Field','VariableId','SugarcrmConfiguration','DeskAccount','int_desk_configuration_has_tags','ZendeskField','int_zendesk_configuration_has_tags','VtigerField','ServicenowConfiguration','Dynamics365Account','Dynamics365Field','FromId','ToId','SessionId','JscriptyAnswerReport','ProjectId','user_has_square_projects','team_has_chat_queues','FaxQueues','WhatsappQueues','TrunkBackup','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToAccount','ChatTransferReport','FromChatWebsiteId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','HopperHistory','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','../config/environment','lodash','determine','defaultsDeep','motion2','xcall','xC@LL1234','utf8mb4','name','utf8','sequelizeHistory','127.0.0.1','utf8_general_ci','sequelize','database','username','options','password','User','../api/user/user.model','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../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','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Cdr','../api/cdr/cdr.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model'];(function(_0x582d0b,_0x28f609){var _0x2e93e1=function(_0xb6a81c){while(--_0xb6a81c){_0x582d0b['push'](_0x582d0b['shift']());}};_0x2e93e1(++_0x28f609);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0xb7e7[_0x1ae5ab];return _0x1ce001;};'use strict';var config=require(_0x7b7e('0x0'));var Sequelize=require('sequelize');var _=require(_0x7b7e('0x1'));var jstz=require('jstz');var timezone=jstz[_0x7b7e('0x2')]();config['sequelize']=_[_0x7b7e('0x3')](config['sequelize'],{'database':_0x7b7e('0x4'),'username':_0x7b7e('0x5'),'password':_0x7b7e('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x7b7e('0x7')},'logging':![],'timezone':timezone[_0x7b7e('0x8')](),'define':{'charset':_0x7b7e('0x9'),'collate':'utf8_general_ci'}}});config[_0x7b7e('0xa')]=_[_0x7b7e('0x3')](config[_0x7b7e('0xa')],{'database':_0x7b7e('0x4'),'username':_0x7b7e('0x5'),'password':_0x7b7e('0x6'),'options':{'host':_0x7b7e('0xb'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x7b7e('0x7')},'logging':![],'timezone':timezone[_0x7b7e('0x8')](),'define':{'charset':_0x7b7e('0x9'),'collate':_0x7b7e('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x7b7e('0xd')][_0x7b7e('0xe')],config[_0x7b7e('0xd')][_0x7b7e('0xf')],config[_0x7b7e('0xd')]['password'],config[_0x7b7e('0xd')][_0x7b7e('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x7b7e('0xe')],config['sequelizeHistory']['username'],config[_0x7b7e('0xa')][_0x7b7e('0x11')],config[_0x7b7e('0xa')][_0x7b7e('0x10')])};db[_0x7b7e('0x12')]=db['sequelize']['import'](_0x7b7e('0x13'));db[_0x7b7e('0x14')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x16'));db[_0x7b7e('0x17')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x18'));db[_0x7b7e('0x19')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x1a'));db[_0x7b7e('0x1b')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x1c'));db['VoiceQueue']=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x1d'));db['VoiceRecording']=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x1e'));db[_0x7b7e('0x1f')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x20'));db[_0x7b7e('0x21')]=db['sequelize']['import']('../api/voiceMail/voiceMail.model');db[_0x7b7e('0x22')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')]('../api/voiceMailMessage/voiceMailMessage.model');db['VoiceCallReport']=db['sequelize'][_0x7b7e('0x15')](_0x7b7e('0x23'));db[_0x7b7e('0x24')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')]('../api/voiceDialReport/voiceDialReport.model');db[_0x7b7e('0x25')]=db[_0x7b7e('0xd')]['import']('../api/voiceAgentReport/voiceAgentReport.model');db['VoiceQueueReport']=db[_0x7b7e('0xd')][_0x7b7e('0x15')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x7b7e('0x26')]=db['sequelize'][_0x7b7e('0x15')](_0x7b7e('0x27'));db[_0x7b7e('0x28')]=db['sequelize'][_0x7b7e('0x15')](_0x7b7e('0x29'));db[_0x7b7e('0x2a')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x7b7e('0x2b')]=db['sequelize'][_0x7b7e('0x15')](_0x7b7e('0x2c'));db[_0x7b7e('0x2d')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x2e'));db[_0x7b7e('0x2f')]=db['sequelize']['import'](_0x7b7e('0x30'));db[_0x7b7e('0x31')]=db['sequelize'][_0x7b7e('0x15')](_0x7b7e('0x32'));db[_0x7b7e('0x33')]=db['sequelize'][_0x7b7e('0x15')](_0x7b7e('0x34'));db[_0x7b7e('0x35')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x36'));db[_0x7b7e('0x37')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x38'));db[_0x7b7e('0x39')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x3a'));db[_0x7b7e('0x3b')]=db[_0x7b7e('0xd')]['import'](_0x7b7e('0x3c'));db[_0x7b7e('0x3d')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x3e'));db[_0x7b7e('0x3f')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x40'));db[_0x7b7e('0x41')]=db['sequelize'][_0x7b7e('0x15')](_0x7b7e('0x42'));db[_0x7b7e('0x43')]=db[_0x7b7e('0xd')]['import'](_0x7b7e('0x44'));db[_0x7b7e('0x45')]=db[_0x7b7e('0xd')]['import']('../api/mailInteraction/mailInteraction.model');db[_0x7b7e('0x46')]=db['sequelize'][_0x7b7e('0x15')](_0x7b7e('0x47'));db['MailApplication']=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x48'));db[_0x7b7e('0x49')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x4a'));db[_0x7b7e('0x4b')]=db[_0x7b7e('0xd')]['import']('../api/dashboard/dashboard.model');db[_0x7b7e('0x4c')]=db['sequelize'][_0x7b7e('0x15')]('../api/dashboardItem/dashboardItem.model');db['FaxAccount']=db[_0x7b7e('0xd')]['import'](_0x7b7e('0x4d'));db['FaxApplication']=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x4e'));db[_0x7b7e('0x4f')]=db['sequelize'][_0x7b7e('0x15')](_0x7b7e('0x50'));db[_0x7b7e('0x51')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x52'));db['FaxQueue']=db['sequelize']['import'](_0x7b7e('0x53'));db[_0x7b7e('0x54')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x55'));db[_0x7b7e('0x56')]=db['sequelize'][_0x7b7e('0x15')](_0x7b7e('0x57'));db['SmsApplication']=db['sequelize'][_0x7b7e('0x15')](_0x7b7e('0x58'));db[_0x7b7e('0x59')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x5a'));db['SmsMessage']=db[_0x7b7e('0xd')]['import'](_0x7b7e('0x5b'));db[_0x7b7e('0x5c')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')]('../api/smsQueue/smsQueue.model');db[_0x7b7e('0x5d')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x5e'));db[_0x7b7e('0x5f')]=db['sequelize'][_0x7b7e('0x15')](_0x7b7e('0x60'));db[_0x7b7e('0x61')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x7b7e('0x62')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x63'));db[_0x7b7e('0x64')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')]('../api/openchannelQueue/openchannelQueue.model');db[_0x7b7e('0x65')]=db['sequelize'][_0x7b7e('0x15')](_0x7b7e('0x66'));db['OpenchannelQueueReport']=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x67'));db[_0x7b7e('0x68')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x69'));db['ChatInteraction']=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x6a'));db[_0x7b7e('0x6b')]=db['sequelize']['import']('../api/chatMessage/chatMessage.model');db[_0x7b7e('0x6c')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')]('../api/chatOfflineMessage/chatOfflineMessage.model');db['ChatQueue']=db[_0x7b7e('0xd')][_0x7b7e('0x15')]('../api/chatQueue/chatQueue.model');db[_0x7b7e('0x6d')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')]('../api/chatGroup/chatGroup.model');db[_0x7b7e('0x6e')]=db[_0x7b7e('0xd')]['import'](_0x7b7e('0x6f'));db[_0x7b7e('0x70')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x71'));db[_0x7b7e('0x72')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x73'));db['CmHopper']=db[_0x7b7e('0xd')][_0x7b7e('0x15')]('../api/cmHopper/cmHopper.model');db[_0x7b7e('0x74')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x7b7e('0x75')]=db['sequelize'][_0x7b7e('0x15')](_0x7b7e('0x76'));db['CmHopperHistory']=db[_0x7b7e('0xd')][_0x7b7e('0x15')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x7b7e('0x77')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x78'));db['CmCustomField']=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x79'));db[_0x7b7e('0x7a')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x7b'));db[_0x7b7e('0x7c')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')]('../api/automation/automation.model');db[_0x7b7e('0x7d')]=db['sequelize']['import'](_0x7b7e('0x7e'));db[_0x7b7e('0x7f')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')]('../api/disposition/disposition.model');db[_0x7b7e('0x80')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x81'));db[_0x7b7e('0x82')]=db[_0x7b7e('0xd')]['import'](_0x7b7e('0x83'));db['Pause']=db['sequelize'][_0x7b7e('0x15')]('../api/pause/pause.model');db[_0x7b7e('0x84')]=db['sequelize'][_0x7b7e('0x15')](_0x7b7e('0x85'));db['VoiceQueuesLog']=db[_0x7b7e('0xd')][_0x7b7e('0x15')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x7b7e('0x86')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x87'));db[_0x7b7e('0x88')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x89'));db[_0x7b7e('0x8a')]=db[_0x7b7e('0xd')]['import']('../api/tag/tag.model');db[_0x7b7e('0x8b')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x8c'));db[_0x7b7e('0x8d')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')]('../api/trigger/trigger.model');db[_0x7b7e('0x8e')]=db[_0x7b7e('0xd')]['import'](_0x7b7e('0x8f'));db[_0x7b7e('0x90')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x91'));db[_0x7b7e('0x92')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x93'));db[_0x7b7e('0x94')]=db[_0x7b7e('0xd')]['import'](_0x7b7e('0x95'));db[_0x7b7e('0x96')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x97'));db[_0x7b7e('0x98')]=db[_0x7b7e('0xd')]['import'](_0x7b7e('0x99'));db[_0x7b7e('0x9a')]=db[_0x7b7e('0xd')]['import'](_0x7b7e('0x9b'));db[_0x7b7e('0x9c')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x9d'));db['AnalyticTreeReport']=db['sequelize']['import'](_0x7b7e('0x9e'));db[_0x7b7e('0x9f')]=db[_0x7b7e('0xd')]['import'](_0x7b7e('0xa0'));db[_0x7b7e('0xa1')]=db[_0x7b7e('0xd')]['import'](_0x7b7e('0xa2'));db[_0x7b7e('0xa3')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')]('../api/intSalesforceField/intSalesforceField.model');db[_0x7b7e('0xa4')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0xa5'));db['SugarcrmConfiguration']=db['sequelize'][_0x7b7e('0x15')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x7b7e('0xa6')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0xa7'));db['DeskAccount']=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0xa8'));db[_0x7b7e('0xa9')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0xaa'));db[_0x7b7e('0xab')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0xac'));db[_0x7b7e('0xad')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0xae'));db[_0x7b7e('0xaf')]=db['sequelize'][_0x7b7e('0x15')](_0x7b7e('0xb0'));db[_0x7b7e('0xb1')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0xb2'));db[_0x7b7e('0xb3')]=db['sequelize'][_0x7b7e('0x15')](_0x7b7e('0xb4'));db[_0x7b7e('0xb5')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db['ZendeskField']=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0xb6'));db[_0x7b7e('0xb7')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0xb8'));db[_0x7b7e('0xb9')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x7b7e('0xba')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0xbb'));db[_0x7b7e('0xbc')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x7b7e('0xbd')]=db['sequelize'][_0x7b7e('0x15')](_0x7b7e('0xbe'));db['VtigerField']=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0xbf'));db[_0x7b7e('0xc0')]=db[_0x7b7e('0xd')]['import'](_0x7b7e('0xc1'));db['ServicenowConfiguration']=db['sequelize'][_0x7b7e('0x15')](_0x7b7e('0xc2'));db[_0x7b7e('0xc3')]=db[_0x7b7e('0xd')]['import'](_0x7b7e('0xc4'));db['Dynamics365Account']=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0xc5'));db[_0x7b7e('0xc6')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0xc7'));db['Dynamics365Field']=db[_0x7b7e('0xd')][_0x7b7e('0x15')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x7b7e('0xc8')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0xc9'));db[_0x7b7e('0xca')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0xcb'));db[_0x7b7e('0xcc')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0xcd'));db[_0x7b7e('0x90')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x91'));db[_0x7b7e('0xce')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0xcf'));db[_0x7b7e('0xd0')]=db[_0x7b7e('0xd')]['import'](_0x7b7e('0xd1'));db[_0x7b7e('0xd2')]=db['sequelize'][_0x7b7e('0x15')]('../api/chatInternalMessage/chatInternalMessage.model');db['JscriptyAnswerReport']=db[_0x7b7e('0xd')]['import']('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x7b7e('0xd3')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x7b7e('0xd4')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0xd5'));db[_0x7b7e('0xd6')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0xd7'));db[_0x7b7e('0xd8')]=db['sequelize'][_0x7b7e('0x15')](_0x7b7e('0xd9'));db[_0x7b7e('0xda')]=db['sequelize'][_0x7b7e('0x15')](_0x7b7e('0xdb'));db['JscriptyProject']=db[_0x7b7e('0xd')]['import']('../api/jscriptyProject/jscriptyProject.model');db[_0x7b7e('0xdc')]=db[_0x7b7e('0xd')]['import'](_0x7b7e('0xdd'));db['SquareOdbc']=db['sequelize'][_0x7b7e('0x15')](_0x7b7e('0xde'));db[_0x7b7e('0xdf')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0xe0'));db[_0x7b7e('0xe1')]=db[_0x7b7e('0xd')]['import'](_0x7b7e('0xe2'));db[_0x7b7e('0xe3')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0xe4'));db[_0x7b7e('0xe5')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0xe6'));db[_0x7b7e('0xe7')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')]('../api/license/license.model');db['Campaign']=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0xe8'));db[_0x7b7e('0xe9')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0xea'));db[_0x7b7e('0xeb')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0xec'));db[_0x7b7e('0xed')]=db['sequelize'][_0x7b7e('0x15')]('../api/plugin/plugin.model');db[_0x7b7e('0xee')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')]('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db['sequelize'][_0x7b7e('0x15')](_0x7b7e('0xef'));db[_0x7b7e('0xf0')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0xf1'));db[_0x7b7e('0xf2')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0xf3'));db[_0x7b7e('0xf4')]=db['sequelize'][_0x7b7e('0x15')](_0x7b7e('0xf5'));db[_0x7b7e('0xf6')]=db[_0x7b7e('0xd')]['import'](_0x7b7e('0xf7'));db[_0x7b7e('0xf8')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0xf9'));db[_0x7b7e('0xfa')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0xfb'));db[_0x7b7e('0xfc')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0xfd'));db[_0x7b7e('0xfe')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0xff'));db[_0x7b7e('0x100')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x101'));db[_0x7b7e('0x102')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x103'));db[_0x7b7e('0x104')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')]('../api/whatsappApplication/whatsappApplication.model');db[_0x7b7e('0x105')]=db['sequelize']['import']('../api/whatsappInteraction/whatsappInteraction.model');db[_0x7b7e('0x106')]=db[_0x7b7e('0xd')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x7b7e('0x107')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x7b7e('0x108')]=db['sequelize']['import'](_0x7b7e('0x109'));db['WhatsappQueue']=db['sequelize'][_0x7b7e('0x15')](_0x7b7e('0x10a'));db[_0x7b7e('0x10b')]=db['sequelize']['import'](_0x7b7e('0x10c'));db[_0x7b7e('0x10d')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x10e'));db[_0x7b7e('0x10f')]=db[_0x7b7e('0xd')][_0x7b7e('0x15')](_0x7b7e('0x110'));db['UserVoicePrefix']=db[_0x7b7e('0xd')]['import'](_0x7b7e('0x111'));db[_0x7b7e('0x12')][_0x7b7e('0x112')](db[_0x7b7e('0x21')],{'as':_0x7b7e('0x21'),'onDelete':'cascade','foreignKey':_0x7b7e('0x113')});db[_0x7b7e('0x12')][_0x7b7e('0x114')](db[_0x7b7e('0x115')],{'as':'Recordings','foreignKey':_0x7b7e('0x113')});db[_0x7b7e('0x12')]['hasMany'](db[_0x7b7e('0x2b')],{'as':_0x7b7e('0x116'),'foreignKey':_0x7b7e('0x113')});db[_0x7b7e('0x12')][_0x7b7e('0x114')](db[_0x7b7e('0x19')],{'as':_0x7b7e('0x117'),'onDelete':_0x7b7e('0x118'),'hooks':!![]});db[_0x7b7e('0x12')][_0x7b7e('0x114')](db[_0x7b7e('0x75')],{'as':'HopperFinals','foreignKey':_0x7b7e('0x113')});db[_0x7b7e('0x12')]['hasMany'](db[_0x7b7e('0x119')],{'as':'HopperHistory','foreignKey':_0x7b7e('0x113')});db[_0x7b7e('0x12')][_0x7b7e('0x114')](db['ReportAgentPreview'],{'as':_0x7b7e('0x77'),'foreignKey':_0x7b7e('0x113')});db[_0x7b7e('0x12')][_0x7b7e('0x114')](db[_0x7b7e('0x61')],{'as':_0x7b7e('0x11a'),'foreignKey':_0x7b7e('0x113')});db[_0x7b7e('0x12')][_0x7b7e('0x114')](db[_0x7b7e('0x11b')],{'as':'ChatInteractions','foreignKey':_0x7b7e('0x113')});db[_0x7b7e('0x12')][_0x7b7e('0x114')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x7b7e('0x113')});db['User']['hasMany'](db[_0x7b7e('0x4f')],{'as':_0x7b7e('0x11c'),'foreignKey':_0x7b7e('0x113')});db['User'][_0x7b7e('0x114')](db[_0x7b7e('0x45')],{'as':_0x7b7e('0x11d'),'foreignKey':_0x7b7e('0x113')});db[_0x7b7e('0x12')]['hasMany'](db[_0x7b7e('0x105')],{'as':_0x7b7e('0x11e'),'foreignKey':_0x7b7e('0x113')});db[_0x7b7e('0x12')][_0x7b7e('0x114')](db[_0x7b7e('0x100')],{'as':'UserNotifications','foreignKey':'SenderId'});db[_0x7b7e('0x12')]['belongsTo'](db[_0x7b7e('0xfa')],{'as':_0x7b7e('0xfa'),'foreignKey':_0x7b7e('0x11f')});db[_0x7b7e('0x12')][_0x7b7e('0x120')](db[_0x7b7e('0x6d')],{'as':_0x7b7e('0x121'),'through':'chat_group_has_users'});db['User'][_0x7b7e('0x120')](db[_0x7b7e('0x72')],{'as':'Contacts','through':_0x7b7e('0x122')});db[_0x7b7e('0x12')]['belongsToMany'](db['CmList'],{'as':_0x7b7e('0x123'),'through':_0x7b7e('0x124')});db[_0x7b7e('0x12')]['belongsToMany'](db[_0x7b7e('0xe5')],{'through':_0x7b7e('0x125')});db[_0x7b7e('0x12')][_0x7b7e('0x120')](db[_0x7b7e('0x45')],{'as':_0x7b7e('0x11d'),'through':_0x7b7e('0x126')});db[_0x7b7e('0x12')][_0x7b7e('0x120')](db[_0x7b7e('0x11b')],{'as':'ChatInteractions','through':'user_has_chat_interactions'});db['User'][_0x7b7e('0x120')](db['FaxInteraction'],{'as':_0x7b7e('0x11c'),'through':_0x7b7e('0x127')});db[_0x7b7e('0x12')]['belongsToMany'](db[_0x7b7e('0x59')],{'as':_0x7b7e('0x128'),'through':_0x7b7e('0x129')});db[_0x7b7e('0x12')][_0x7b7e('0x120')](db[_0x7b7e('0x61')],{'as':_0x7b7e('0x11a'),'through':'user_has_openchannel_interactions'});db['User']['belongsToMany'](db[_0x7b7e('0x105')],{'as':_0x7b7e('0x11e'),'through':_0x7b7e('0x12a')});db[_0x7b7e('0x12')][_0x7b7e('0x120')](db[_0x7b7e('0x12b')],{'as':_0x7b7e('0x12c'),'through':_0x7b7e('0x2d'),'required':![]});db[_0x7b7e('0x12')]['belongsToMany'](db[_0x7b7e('0xf8')],{'as':_0x7b7e('0x12d'),'through':_0x7b7e('0x12e'),'required':![]});db['User'][_0x7b7e('0x120')](db['MailQueue'],{'as':_0x7b7e('0x12f'),'through':_0x7b7e('0x31'),'required':![]});db[_0x7b7e('0x12')][_0x7b7e('0x120')](db['ChatQueue'],{'as':_0x7b7e('0x130'),'through':_0x7b7e('0x2f'),'required':![],'hooks':!![]});db[_0x7b7e('0x12')][_0x7b7e('0x120')](db[_0x7b7e('0x131')],{'as':'FaxQueues','through':_0x7b7e('0x33'),'required':![]});db[_0x7b7e('0x12')][_0x7b7e('0x120')](db[_0x7b7e('0x5c')],{'as':_0x7b7e('0x132'),'through':_0x7b7e('0x35'),'required':![]});db[_0x7b7e('0x12')][_0x7b7e('0x120')](db['OpenchannelQueue'],{'as':_0x7b7e('0x133'),'through':_0x7b7e('0x37'),'required':![]});db[_0x7b7e('0x12')][_0x7b7e('0x120')](db[_0x7b7e('0x134')],{'as':'WhatsappQueues','through':_0x7b7e('0x39'),'required':![]});db[_0x7b7e('0x12')][_0x7b7e('0x120')](db[_0x7b7e('0xf6')],{'through':_0x7b7e('0x124')});db[_0x7b7e('0x12')][_0x7b7e('0x120')](db[_0x7b7e('0x65')],{'as':_0x7b7e('0x135'),'through':_0x7b7e('0x136')});db['User'][_0x7b7e('0x120')](db['FaxAccount'],{'as':_0x7b7e('0x137'),'through':_0x7b7e('0x138')});db[_0x7b7e('0x12')][_0x7b7e('0x120')](db[_0x7b7e('0x3f')],{'as':_0x7b7e('0x139'),'through':_0x7b7e('0x13a')});db[_0x7b7e('0x12')][_0x7b7e('0x120')](db[_0x7b7e('0x5d')],{'as':_0x7b7e('0x13b'),'through':_0x7b7e('0x13c')});db[_0x7b7e('0x12')]['belongsToMany'](db['SmsAccount'],{'as':_0x7b7e('0x13d'),'through':'user_has_sms_accounts'});db[_0x7b7e('0x12')][_0x7b7e('0x120')](db[_0x7b7e('0x102')],{'as':_0x7b7e('0x13e'),'through':_0x7b7e('0x13f')});db['User'][_0x7b7e('0x120')](db['SquareProject'],{'as':'SquareProjects','through':'user_has_square_projects'});db[_0x7b7e('0x14')][_0x7b7e('0x114')](db[_0x7b7e('0x19')],{'as':_0x7b7e('0x140'),'onDelete':_0x7b7e('0x118'),'foreignKey':_0x7b7e('0x141')});db[_0x7b7e('0x17')]['hasMany'](db[_0x7b7e('0x19')],{'onDelete':_0x7b7e('0x118')});db[_0x7b7e('0x19')][_0x7b7e('0x114')](db[_0x7b7e('0x19')],{'as':_0x7b7e('0x142'),'onDelete':_0x7b7e('0x118')});db[_0x7b7e('0x1b')][_0x7b7e('0x120')](db[_0x7b7e('0x88')],{'as':_0x7b7e('0x143'),'through':_0x7b7e('0x144')});db[_0x7b7e('0x12b')][_0x7b7e('0x114')](db['UserVoiceQueueRt'],{'as':'Members','foreignKey':_0x7b7e('0x145')});db[_0x7b7e('0x12b')][_0x7b7e('0x114')](db['CmHopper'],{'as':_0x7b7e('0x146'),'foreignKey':_0x7b7e('0x145')});db[_0x7b7e('0x12b')][_0x7b7e('0x114')](db[_0x7b7e('0x75')],{'as':'HopperFinals','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x7b7e('0x114')](db[_0x7b7e('0x119')],{'as':_0x7b7e('0x147'),'foreignKey':_0x7b7e('0x145')});db[_0x7b7e('0x12b')]['hasMany'](db[_0x7b7e('0x77')],{'as':'ReportAgentPreview','foreignKey':_0x7b7e('0x145')});db['VoiceQueue']['hasMany'](db['CmHopperBlack'],{'as':_0x7b7e('0x148'),'foreignKey':_0x7b7e('0x145')});db['VoiceQueue'][_0x7b7e('0x114')](db[_0x7b7e('0xd4')],{'as':_0x7b7e('0x149'),'foreignKey':_0x7b7e('0x145')});db['VoiceQueue'][_0x7b7e('0x14a')](db[_0x7b7e('0x28')],{'as':'Trunk','foreignKey':_0x7b7e('0x14b')});db[_0x7b7e('0x12b')][_0x7b7e('0x14a')](db[_0x7b7e('0x28')],{'as':'TrunkBackup','foreignKey':_0x7b7e('0x14c')});db[_0x7b7e('0x12b')]['belongsTo'](db[_0x7b7e('0x82')],{'as':_0x7b7e('0x82'),'foreignKey':_0x7b7e('0x14d')});db[_0x7b7e('0x12b')][_0x7b7e('0x14a')](db[_0x7b7e('0x14e')],{'as':'mandatoryDispositionPause','foreignKey':_0x7b7e('0x14f')});db['VoiceQueue'][_0x7b7e('0x120')](db['CmList'],{'as':_0x7b7e('0x123'),'through':_0x7b7e('0x150')});db['VoiceQueue']['belongsToMany'](db['User'],{'as':_0x7b7e('0x151'),'through':_0x7b7e('0x2d')});db[_0x7b7e('0x12b')][_0x7b7e('0x120')](db[_0x7b7e('0xe5')],{'as':_0x7b7e('0x152'),'through':'TeamVoiceQueue'});db[_0x7b7e('0x12b')][_0x7b7e('0x120')](db[_0x7b7e('0xf6')],{'as':'BlackLists','through':_0x7b7e('0x153')});db[_0x7b7e('0x115')][_0x7b7e('0x14a')](db[_0x7b7e('0x12')],{'as':_0x7b7e('0x12'),'foreignKey':_0x7b7e('0x113')});db[_0x7b7e('0x1f')][_0x7b7e('0x14a')](db[_0x7b7e('0x12')],{'as':_0x7b7e('0x12'),'foreignKey':_0x7b7e('0x113')});db[_0x7b7e('0x21')]['hasMany'](db[_0x7b7e('0x22')],{'as':'Messages','onDelete':_0x7b7e('0x118'),'foreignKey':'mailboxuser','sourceKey':_0x7b7e('0x154')});db[_0x7b7e('0x22')]['belongsTo'](db[_0x7b7e('0x21')],{'foreignKey':'mailboxuser','targetKey':_0x7b7e('0x154')});db['VoiceCallReport'][_0x7b7e('0x114')](db['VoiceQueueReport'],{'as':_0x7b7e('0x155'),'foreignKey':_0x7b7e('0x156'),'constraints':![]});db[_0x7b7e('0x157')][_0x7b7e('0x114')](db[_0x7b7e('0x25')],{'as':_0x7b7e('0x158'),'foreignKey':_0x7b7e('0x156'),'constraints':![]});db[_0x7b7e('0x157')][_0x7b7e('0x14a')](db[_0x7b7e('0x12')],{'as':_0x7b7e('0x12'),'foreignKey':'UserId'});db['VoiceCallReport']['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x7b7e('0x159')});db[_0x7b7e('0x3b')][_0x7b7e('0x14a')](db[_0x7b7e('0x3f')],{'as':_0x7b7e('0x3f'),'foreignKey':'MailAccountId'});db['MailServerOut'][_0x7b7e('0x14a')](db['MailAccount'],{'as':_0x7b7e('0x3f'),'foreignKey':_0x7b7e('0x15a')});db[_0x7b7e('0x3f')][_0x7b7e('0x112')](db[_0x7b7e('0x3b')],{'as':_0x7b7e('0x15b'),'onDelete':_0x7b7e('0x118')});db[_0x7b7e('0x3f')]['hasOne'](db[_0x7b7e('0x3d')],{'as':'Smtp','onDelete':'cascade'});db[_0x7b7e('0x3f')][_0x7b7e('0x114')](db[_0x7b7e('0x7f')],{'as':_0x7b7e('0x15c'),'foreignKey':_0x7b7e('0x15a'),'onDelete':_0x7b7e('0x118')});db[_0x7b7e('0x3f')][_0x7b7e('0x114')](db[_0x7b7e('0x7d')],{'as':_0x7b7e('0x15d'),'foreignKey':_0x7b7e('0x15a')});db[_0x7b7e('0x3f')][_0x7b7e('0x114')](db['MailMessage'],{'as':_0x7b7e('0x15e'),'foreignKey':_0x7b7e('0x15a')});db[_0x7b7e('0x3f')][_0x7b7e('0x114')](db[_0x7b7e('0x45')],{'as':_0x7b7e('0x15f')});db[_0x7b7e('0x3f')][_0x7b7e('0x114')](db[_0x7b7e('0x160')],{'as':'Applications'});db[_0x7b7e('0x3f')][_0x7b7e('0x14a')](db[_0x7b7e('0xf6')],{'as':_0x7b7e('0x161'),'foreignKey':_0x7b7e('0x162')});db['MailAccount'][_0x7b7e('0x14a')](db[_0x7b7e('0x8b')],{'as':_0x7b7e('0x8b'),'foreignKey':'TemplateId'});db[_0x7b7e('0x3f')][_0x7b7e('0x14a')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x7b7e('0x14f')});db[_0x7b7e('0x3f')]['belongsToMany'](db[_0x7b7e('0x12')],{'as':_0x7b7e('0x151'),'through':_0x7b7e('0x13a')});db[_0x7b7e('0x41')][_0x7b7e('0x120')](db['User'],{'as':'Agents','through':_0x7b7e('0x31')});db['MailQueue'][_0x7b7e('0x120')](db['Team'],{'through':_0x7b7e('0x163'),'as':'Teams'});db[_0x7b7e('0x45')]['hasMany'](db['MailMessage'],{'as':_0x7b7e('0x15e'),'onDelete':'cascade','foreignKey':'MailInteractionId'});db[_0x7b7e('0x45')][_0x7b7e('0x14a')](db['MailAccount'],{'as':_0x7b7e('0x164'),'foreignKey':_0x7b7e('0x15a')});db[_0x7b7e('0x45')][_0x7b7e('0x14a')](db[_0x7b7e('0x72')],{'as':_0x7b7e('0x165'),'foreignKey':_0x7b7e('0x159')});db[_0x7b7e('0x45')]['belongsTo'](db['User'],{'as':_0x7b7e('0x166'),'foreignKey':_0x7b7e('0x113')});db[_0x7b7e('0x45')][_0x7b7e('0x120')](db[_0x7b7e('0x8a')],{'through':_0x7b7e('0x167'),'as':'Tags'});db[_0x7b7e('0x45')][_0x7b7e('0x120')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0x7b7e('0x168')});db['MailInteraction'][_0x7b7e('0x120')](db[_0x7b7e('0x12')],{'as':_0x7b7e('0x169'),'through':_0x7b7e('0x126'),'foreignKey':_0x7b7e('0x16a')});db['MailMessage'][_0x7b7e('0x114')](db['Attachment'],{'as':_0x7b7e('0x16b'),'onDelete':_0x7b7e('0x118')});db[_0x7b7e('0x46')]['belongsTo'](db[_0x7b7e('0x12')],{'as':_0x7b7e('0x12')});db['MailMessage'][_0x7b7e('0x14a')](db[_0x7b7e('0x72')],{'onDelete':'cascade','as':_0x7b7e('0x165')});db[_0x7b7e('0x46')][_0x7b7e('0x14a')](db[_0x7b7e('0x45')],{'as':'Interaction','foreignKey':_0x7b7e('0x16a')});db['MailMessage'][_0x7b7e('0x14a')](db['MailAccount'],{'as':_0x7b7e('0x164'),'foreignKey':'MailAccountId'});db[_0x7b7e('0x46')][_0x7b7e('0x14a')](db[_0x7b7e('0x65')],{'as':_0x7b7e('0x65'),'foreignKey':_0x7b7e('0x16c')});db['MailMessage'][_0x7b7e('0x14a')](db[_0x7b7e('0x6c')],{'as':_0x7b7e('0x6c'),'foreignKey':'ChatOfflineMessageId'});db['MailApplication'][_0x7b7e('0x14a')](db[_0x7b7e('0x12')],{'onDelete':_0x7b7e('0x16d')});db[_0x7b7e('0x160')]['belongsTo'](db[_0x7b7e('0x41')],{'onDelete':_0x7b7e('0x16d')});db[_0x7b7e('0x160')]['belongsTo'](db[_0x7b7e('0x3f')],{'onDelete':_0x7b7e('0x16d')});db[_0x7b7e('0x160')]['belongsTo'](db[_0x7b7e('0x82')],{'onDelete':_0x7b7e('0x16d'),'foreignKey':_0x7b7e('0x14d')});db[_0x7b7e('0x160')][_0x7b7e('0x14a')](db['Tag'],{'onDelete':_0x7b7e('0x16d'),'foreignKey':_0x7b7e('0x16e')});db['MailQueueReport']['belongsTo'](db[_0x7b7e('0x3f')],{});db[_0x7b7e('0x49')][_0x7b7e('0x14a')](db[_0x7b7e('0xf6')],{'as':_0x7b7e('0x161'),'foreignKey':_0x7b7e('0x162')});db[_0x7b7e('0x49')][_0x7b7e('0x14a')](db[_0x7b7e('0x72')],{'as':'Contact','foreignKey':_0x7b7e('0x159')});db['MailQueueReport'][_0x7b7e('0x14a')](db['MailInteraction'],{});db[_0x7b7e('0x49')]['belongsTo'](db[_0x7b7e('0x46')],{});db['MailQueueReport'][_0x7b7e('0x14a')](db[_0x7b7e('0x12')],{});db['MailQueueReport'][_0x7b7e('0x14a')](db[_0x7b7e('0x41')],{});db[_0x7b7e('0x4b')][_0x7b7e('0x114')](db['DashboardItem'],{'as':_0x7b7e('0x16f'),'onDelete':_0x7b7e('0x118')});db[_0x7b7e('0x170')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x7b7e('0x171'),'onDelete':'cascade'});db[_0x7b7e('0x170')][_0x7b7e('0x114')](db[_0x7b7e('0x7d')],{'as':_0x7b7e('0x15d'),'foreignKey':'FaxAccountId'});db['FaxAccount'][_0x7b7e('0x114')](db['FaxInteraction'],{'as':_0x7b7e('0x15f')});db['FaxAccount'][_0x7b7e('0x114')](db[_0x7b7e('0x172')],{'as':_0x7b7e('0x142')});db['FaxAccount'][_0x7b7e('0x114')](db[_0x7b7e('0x19')],{'as':_0x7b7e('0x173'),'onDelete':'cascade'});db[_0x7b7e('0x170')]['hasMany'](db[_0x7b7e('0x51')],{'as':'Messages'});db['FaxAccount'][_0x7b7e('0x14a')](db[_0x7b7e('0x28')],{'as':_0x7b7e('0x28')});db[_0x7b7e('0x170')][_0x7b7e('0x14a')](db['CmList'],{'as':_0x7b7e('0x161'),'foreignKey':'ListId'});db[_0x7b7e('0x170')][_0x7b7e('0x14a')](db[_0x7b7e('0x14e')],{'as':_0x7b7e('0x174'),'foreignKey':_0x7b7e('0x14f')});db[_0x7b7e('0x170')][_0x7b7e('0x120')](db[_0x7b7e('0x12')],{'as':_0x7b7e('0x151'),'through':_0x7b7e('0x138')});db[_0x7b7e('0x172')][_0x7b7e('0x14a')](db[_0x7b7e('0x12')],{'onDelete':_0x7b7e('0x16d')});db[_0x7b7e('0x172')][_0x7b7e('0x14a')](db[_0x7b7e('0x131')],{'onDelete':_0x7b7e('0x16d')});db[_0x7b7e('0x172')][_0x7b7e('0x14a')](db['FaxAccount'],{'onDelete':_0x7b7e('0x16d')});db['FaxApplication'][_0x7b7e('0x14a')](db[_0x7b7e('0x8a')],{'onDelete':_0x7b7e('0x16d'),'foreignKey':'TagId'});db[_0x7b7e('0x4f')]['hasMany'](db[_0x7b7e('0x51')],{'as':'Messages','onDelete':_0x7b7e('0x118'),'foreignKey':'FaxInteractionId'});db['FaxInteraction'][_0x7b7e('0x14a')](db['FaxAccount'],{'as':_0x7b7e('0x164'),'foreignKey':_0x7b7e('0x171')});db[_0x7b7e('0x4f')]['belongsTo'](db[_0x7b7e('0x72')],{'as':_0x7b7e('0x165'),'foreignKey':_0x7b7e('0x159')});db[_0x7b7e('0x4f')][_0x7b7e('0x14a')](db[_0x7b7e('0x12')],{'as':_0x7b7e('0x166'),'foreignKey':_0x7b7e('0x113')});db['FaxInteraction'][_0x7b7e('0x120')](db['Tag'],{'through':_0x7b7e('0x175'),'as':'Tags'});db['FaxInteraction']['belongsToMany'](db[_0x7b7e('0x8a')],{'through':_0x7b7e('0x175'),'as':_0x7b7e('0x168')});db[_0x7b7e('0x4f')][_0x7b7e('0x120')](db['User'],{'as':'Users','through':_0x7b7e('0x127'),'foreignKey':_0x7b7e('0x176')});db[_0x7b7e('0x51')][_0x7b7e('0x14a')](db[_0x7b7e('0x12')],{'onDelete':_0x7b7e('0x118'),'as':_0x7b7e('0x12')});db['FaxMessage']['belongsTo'](db[_0x7b7e('0x4f')],{'as':_0x7b7e('0x177'),'foreignKey':'FaxInteractionId'});db[_0x7b7e('0x51')][_0x7b7e('0x14a')](db[_0x7b7e('0x72')],{'onDelete':_0x7b7e('0x118'),'as':_0x7b7e('0x165')});db[_0x7b7e('0x51')]['belongsTo'](db[_0x7b7e('0xeb')],{'as':'Attachment','foreignKey':_0x7b7e('0x178')});db[_0x7b7e('0x51')][_0x7b7e('0x14a')](db['FaxAccount'],{'as':_0x7b7e('0x164'),'foreignKey':_0x7b7e('0x171')});db[_0x7b7e('0x131')][_0x7b7e('0x120')](db['User'],{'as':_0x7b7e('0x151'),'through':_0x7b7e('0x33')});db[_0x7b7e('0x131')][_0x7b7e('0x120')](db['Team'],{'through':_0x7b7e('0x179'),'as':_0x7b7e('0x152')});db[_0x7b7e('0x54')][_0x7b7e('0x14a')](db['FaxAccount'],{});db[_0x7b7e('0x54')]['belongsTo'](db[_0x7b7e('0xf6')],{'as':_0x7b7e('0x161'),'foreignKey':_0x7b7e('0x162')});db['FaxQueueReport']['belongsTo'](db[_0x7b7e('0x72')],{'as':_0x7b7e('0x165'),'foreignKey':_0x7b7e('0x159')});db[_0x7b7e('0x54')][_0x7b7e('0x14a')](db[_0x7b7e('0x4f')],{});db[_0x7b7e('0x54')][_0x7b7e('0x14a')](db[_0x7b7e('0x51')],{});db[_0x7b7e('0x54')][_0x7b7e('0x14a')](db[_0x7b7e('0x12')],{});db[_0x7b7e('0x54')][_0x7b7e('0x14a')](db[_0x7b7e('0x131')],{});db[_0x7b7e('0x56')]['hasMany'](db[_0x7b7e('0x7f')],{'as':'Dispositions','foreignKey':_0x7b7e('0x17a'),'onDelete':_0x7b7e('0x118')});db[_0x7b7e('0x56')][_0x7b7e('0x114')](db['CannedAnswer'],{'as':_0x7b7e('0x15d'),'foreignKey':_0x7b7e('0x17a')});db[_0x7b7e('0x56')][_0x7b7e('0x114')](db[_0x7b7e('0x17b')],{'as':_0x7b7e('0x15e'),'foreignKey':_0x7b7e('0x17a')});db[_0x7b7e('0x56')][_0x7b7e('0x114')](db[_0x7b7e('0x59')],{'as':_0x7b7e('0x15f')});db[_0x7b7e('0x56')][_0x7b7e('0x114')](db[_0x7b7e('0x17c')],{'as':'Applications'});db[_0x7b7e('0x56')][_0x7b7e('0x14a')](db[_0x7b7e('0xf6')],{'as':'List','foreignKey':_0x7b7e('0x162')});db[_0x7b7e('0x56')]['belongsTo'](db[_0x7b7e('0x14e')],{'as':_0x7b7e('0x174'),'foreignKey':_0x7b7e('0x14f')});db[_0x7b7e('0x56')][_0x7b7e('0x120')](db['User'],{'as':_0x7b7e('0x151'),'through':_0x7b7e('0x17d')});db[_0x7b7e('0x17c')][_0x7b7e('0x14a')](db[_0x7b7e('0x12')],{'onDelete':_0x7b7e('0x16d')});db[_0x7b7e('0x17c')][_0x7b7e('0x14a')](db[_0x7b7e('0x5c')],{'onDelete':_0x7b7e('0x16d')});db[_0x7b7e('0x17c')][_0x7b7e('0x14a')](db[_0x7b7e('0x56')],{'onDelete':_0x7b7e('0x16d')});db[_0x7b7e('0x17c')][_0x7b7e('0x14a')](db[_0x7b7e('0x82')],{'onDelete':'restrict','foreignKey':_0x7b7e('0x14d')});db[_0x7b7e('0x17c')][_0x7b7e('0x14a')](db[_0x7b7e('0x8a')],{'onDelete':_0x7b7e('0x16d'),'foreignKey':_0x7b7e('0x16e')});db[_0x7b7e('0x59')][_0x7b7e('0x114')](db[_0x7b7e('0x17b')],{'as':_0x7b7e('0x15e'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db['SmsInteraction']['belongsTo'](db[_0x7b7e('0x56')],{'as':_0x7b7e('0x164'),'foreignKey':_0x7b7e('0x17a')});db[_0x7b7e('0x59')][_0x7b7e('0x14a')](db['CmContact'],{'as':_0x7b7e('0x165'),'foreignKey':_0x7b7e('0x159')});db['SmsInteraction'][_0x7b7e('0x14a')](db['User'],{'as':_0x7b7e('0x166'),'foreignKey':_0x7b7e('0x113')});db[_0x7b7e('0x59')]['belongsToMany'](db[_0x7b7e('0x8a')],{'through':'sms_interaction_has_tags','as':_0x7b7e('0x17e')});db[_0x7b7e('0x59')][_0x7b7e('0x120')](db[_0x7b7e('0x8a')],{'through':_0x7b7e('0x17f'),'as':_0x7b7e('0x168')});db[_0x7b7e('0x59')]['belongsToMany'](db[_0x7b7e('0x12')],{'as':'Users','through':_0x7b7e('0x129'),'foreignKey':_0x7b7e('0x180')});db[_0x7b7e('0x17b')][_0x7b7e('0x14a')](db[_0x7b7e('0x12')],{'as':'User'});db[_0x7b7e('0x17b')][_0x7b7e('0x14a')](db[_0x7b7e('0x72')],{'onDelete':'cascade','as':_0x7b7e('0x165')});db[_0x7b7e('0x17b')]['belongsTo'](db[_0x7b7e('0x59')],{'onDelete':_0x7b7e('0x118'),'as':_0x7b7e('0x177'),'foreignKey':'SmsInteractionId'});db[_0x7b7e('0x17b')][_0x7b7e('0x14a')](db[_0x7b7e('0x56')],{'as':_0x7b7e('0x164'),'foreignKey':_0x7b7e('0x17a')});db['SmsQueue']['belongsToMany'](db[_0x7b7e('0x12')],{'as':_0x7b7e('0x151'),'through':'UserSmsQueue','foreignKey':_0x7b7e('0x181')});db[_0x7b7e('0x5c')][_0x7b7e('0x120')](db[_0x7b7e('0xe5')],{'through':_0x7b7e('0x182'),'as':'Teams'});db[_0x7b7e('0x5d')][_0x7b7e('0x114')](db[_0x7b7e('0x7f')],{'as':_0x7b7e('0x15c'),'foreignKey':_0x7b7e('0x183'),'onDelete':_0x7b7e('0x118')});db[_0x7b7e('0x5d')][_0x7b7e('0x114')](db[_0x7b7e('0x7d')],{'as':'Answers','foreignKey':_0x7b7e('0x183')});db[_0x7b7e('0x5d')][_0x7b7e('0x114')](db['OpenchannelInteraction'],{'as':_0x7b7e('0x15f'),'foreignKey':_0x7b7e('0x183')});db[_0x7b7e('0x5d')][_0x7b7e('0x114')](db[_0x7b7e('0x62')],{'as':_0x7b7e('0x15e'),'foreignKey':'OpenchannelAccountId'});db[_0x7b7e('0x5d')][_0x7b7e('0x114')](db['OpenchannelApplication'],{'as':_0x7b7e('0x142'),'foreignKey':_0x7b7e('0x183')});db[_0x7b7e('0x5d')][_0x7b7e('0x14a')](db[_0x7b7e('0xf6')],{'as':_0x7b7e('0x161'),'foreignKey':_0x7b7e('0x162')});db[_0x7b7e('0x5d')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x7b7e('0x14f')});db['OpenchannelAccount'][_0x7b7e('0x120')](db[_0x7b7e('0x12')],{'as':_0x7b7e('0x151'),'through':_0x7b7e('0x13c')});db[_0x7b7e('0x5f')][_0x7b7e('0x14a')](db['User'],{'onDelete':_0x7b7e('0x16d')});db[_0x7b7e('0x5f')][_0x7b7e('0x14a')](db[_0x7b7e('0x64')],{'onDelete':_0x7b7e('0x16d'),'foreignKey':_0x7b7e('0x184')});db[_0x7b7e('0x5f')][_0x7b7e('0x14a')](db[_0x7b7e('0x5d')],{'onDelete':'restrict','foreignKey':'OpenchannelAccountId'});db[_0x7b7e('0x5f')]['belongsTo'](db['Interval'],{'onDelete':_0x7b7e('0x16d'),'foreignKey':_0x7b7e('0x14d')});db[_0x7b7e('0x5f')][_0x7b7e('0x14a')](db[_0x7b7e('0x8a')],{'onDelete':_0x7b7e('0x16d'),'foreignKey':'TagId'});db[_0x7b7e('0x61')][_0x7b7e('0x114')](db[_0x7b7e('0x62')],{'as':_0x7b7e('0x15e'),'onDelete':_0x7b7e('0x118'),'foreignKey':_0x7b7e('0x185')});db['OpenchannelInteraction']['belongsTo'](db[_0x7b7e('0x5d')],{'as':_0x7b7e('0x164'),'foreignKey':_0x7b7e('0x183')});db[_0x7b7e('0x61')]['belongsTo'](db['CmContact'],{'as':_0x7b7e('0x165'),'foreignKey':'ContactId'});db['OpenchannelInteraction']['belongsTo'](db[_0x7b7e('0x12')],{'as':_0x7b7e('0x166'),'foreignKey':'UserId'});db[_0x7b7e('0x61')][_0x7b7e('0x120')](db[_0x7b7e('0x8a')],{'through':_0x7b7e('0x186'),'as':_0x7b7e('0x17e')});db[_0x7b7e('0x61')][_0x7b7e('0x120')](db[_0x7b7e('0x8a')],{'through':_0x7b7e('0x186'),'as':'ThroughTags'});db['OpenchannelInteraction'][_0x7b7e('0x120')](db['User'],{'as':_0x7b7e('0x169'),'through':_0x7b7e('0x187'),'foreignKey':_0x7b7e('0x185')});db['OpenchannelMessage'][_0x7b7e('0x14a')](db[_0x7b7e('0x12')],{'onDelete':'cascade','as':_0x7b7e('0x12')});db[_0x7b7e('0x62')]['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':_0x7b7e('0x165')});db[_0x7b7e('0x62')][_0x7b7e('0x14a')](db[_0x7b7e('0x61')],{'onDelete':_0x7b7e('0x118'),'as':'Interaction','foreignKey':_0x7b7e('0x185')});db[_0x7b7e('0x62')][_0x7b7e('0x14a')](db[_0x7b7e('0xeb')],{'as':'Attachment','foreignKey':_0x7b7e('0x178')});db[_0x7b7e('0x62')][_0x7b7e('0x14a')](db[_0x7b7e('0x5d')],{'as':_0x7b7e('0x164'),'foreignKey':_0x7b7e('0x183')});db[_0x7b7e('0x64')][_0x7b7e('0x120')](db[_0x7b7e('0x12')],{'as':_0x7b7e('0x151'),'through':_0x7b7e('0x37'),'foreignKey':_0x7b7e('0x184')});db[_0x7b7e('0x64')][_0x7b7e('0x120')](db[_0x7b7e('0xe5')],{'through':_0x7b7e('0x188'),'as':_0x7b7e('0x152')});db[_0x7b7e('0x65')][_0x7b7e('0x114')](db[_0x7b7e('0x7f')],{'as':_0x7b7e('0x15c'),'foreignKey':'ChatWebsiteId','onDelete':_0x7b7e('0x118')});db[_0x7b7e('0x65')]['hasMany'](db[_0x7b7e('0x7d')],{'as':_0x7b7e('0x15d'),'foreignKey':_0x7b7e('0x16c')});db[_0x7b7e('0x65')][_0x7b7e('0x114')](db[_0x7b7e('0x6e')],{'as':'ProactiveActions'});db[_0x7b7e('0x65')]['hasMany'](db[_0x7b7e('0x11b')],{'as':_0x7b7e('0x15f')});db['ChatWebsite']['hasMany'](db[_0x7b7e('0x68')],{'as':'Applications'});db['ChatWebsite']['hasMany'](db[_0x7b7e('0x6b')],{'as':_0x7b7e('0x15e')});db[_0x7b7e('0x65')][_0x7b7e('0x14a')](db[_0x7b7e('0xf6')],{'as':_0x7b7e('0x161'),'foreignKey':_0x7b7e('0x162')});db[_0x7b7e('0x65')][_0x7b7e('0x14a')](db[_0x7b7e('0x82')],{'as':_0x7b7e('0x82'),'foreignKey':_0x7b7e('0x14d')});db[_0x7b7e('0x65')]['belongsTo'](db[_0x7b7e('0x3f')],{'as':_0x7b7e('0x3f'),'foreignKey':_0x7b7e('0x15a')});db[_0x7b7e('0x65')][_0x7b7e('0x14a')](db[_0x7b7e('0x14e')],{'as':_0x7b7e('0x174'),'foreignKey':_0x7b7e('0x14f')});db[_0x7b7e('0x65')][_0x7b7e('0x120')](db[_0x7b7e('0x12')],{'as':_0x7b7e('0x151'),'through':_0x7b7e('0x136')});db['OpenchannelQueueReport']['belongsTo'](db[_0x7b7e('0x5d')],{});db['OpenchannelQueueReport'][_0x7b7e('0x14a')](db[_0x7b7e('0xf6')],{'as':'List','foreignKey':_0x7b7e('0x162')});db[_0x7b7e('0x189')][_0x7b7e('0x14a')](db[_0x7b7e('0x72')],{'as':_0x7b7e('0x165'),'foreignKey':_0x7b7e('0x159')});db[_0x7b7e('0x189')][_0x7b7e('0x14a')](db[_0x7b7e('0x61')],{});db[_0x7b7e('0x189')]['belongsTo'](db[_0x7b7e('0x62')],{});db[_0x7b7e('0x189')][_0x7b7e('0x14a')](db[_0x7b7e('0x12')],{});db[_0x7b7e('0x189')][_0x7b7e('0x14a')](db[_0x7b7e('0x64')],{});db[_0x7b7e('0x68')][_0x7b7e('0x14a')](db[_0x7b7e('0x12')],{'as':_0x7b7e('0x18a'),'foreignKey':_0x7b7e('0x113'),'onDelete':_0x7b7e('0x16d')});db[_0x7b7e('0x68')]['belongsTo'](db['ChatQueue'],{'as':_0x7b7e('0x18b'),'foreignKey':_0x7b7e('0x18c'),'onDelete':_0x7b7e('0x16d')});db['ChatApplication'][_0x7b7e('0x14a')](db[_0x7b7e('0x65')],{'as':'Website','foreignKey':_0x7b7e('0x16c'),'onDelete':_0x7b7e('0x16d')});db[_0x7b7e('0x68')][_0x7b7e('0x14a')](db[_0x7b7e('0x8a')],{'onDelete':'restrict','foreignKey':_0x7b7e('0x16e')});db[_0x7b7e('0x11b')][_0x7b7e('0x114')](db[_0x7b7e('0x6b')],{'as':'Messages','onDelete':_0x7b7e('0x118'),'foreignKey':'ChatInteractionId'});db[_0x7b7e('0x11b')][_0x7b7e('0x14a')](db[_0x7b7e('0x65')],{'as':_0x7b7e('0x164'),'foreignKey':_0x7b7e('0x16c')});db['ChatInteraction'][_0x7b7e('0x14a')](db[_0x7b7e('0x72')],{'as':'Contact','foreignKey':_0x7b7e('0x159')});db[_0x7b7e('0x11b')][_0x7b7e('0x14a')](db['User'],{'as':_0x7b7e('0x166'),'foreignKey':_0x7b7e('0x113')});db['ChatInteraction'][_0x7b7e('0x120')](db[_0x7b7e('0x8a')],{'through':'chat_interaction_has_tags','as':_0x7b7e('0x17e')});db[_0x7b7e('0x11b')]['belongsToMany'](db[_0x7b7e('0x8a')],{'through':_0x7b7e('0x18d'),'as':_0x7b7e('0x168')});db[_0x7b7e('0x11b')][_0x7b7e('0x120')](db[_0x7b7e('0x12')],{'as':_0x7b7e('0x169'),'through':_0x7b7e('0x18e'),'foreignKey':_0x7b7e('0x18f')});db[_0x7b7e('0x6b')][_0x7b7e('0x14a')](db['User'],{'onDelete':_0x7b7e('0x118'),'as':'User'});db[_0x7b7e('0x6b')][_0x7b7e('0x14a')](db[_0x7b7e('0x72')],{'onDelete':_0x7b7e('0x118'),'as':_0x7b7e('0x165'),'foreignKey':_0x7b7e('0x159')});db['ChatMessage'][_0x7b7e('0x14a')](db[_0x7b7e('0x11b')],{'onDelete':_0x7b7e('0x118'),'as':_0x7b7e('0x177'),'foreignKey':_0x7b7e('0x18f')});db['ChatMessage'][_0x7b7e('0x14a')](db['Attachment'],{'as':_0x7b7e('0xeb'),'foreignKey':'AttachmentId'});db[_0x7b7e('0x6b')][_0x7b7e('0x14a')](db[_0x7b7e('0x65')],{'as':'Account','foreignKey':_0x7b7e('0x16c')});db[_0x7b7e('0x6c')][_0x7b7e('0x114')](db[_0x7b7e('0xeb')],{'as':_0x7b7e('0x16b'),'foreignKey':_0x7b7e('0x190'),'onDelete':_0x7b7e('0x118'),'hooks':!![]});db[_0x7b7e('0x6c')]['belongsTo'](db[_0x7b7e('0x72')],{'onDelete':_0x7b7e('0x118'),'as':_0x7b7e('0x165'),'foreignKey':_0x7b7e('0x159')});db[_0x7b7e('0x6c')][_0x7b7e('0x14a')](db['ChatWebsite'],{'as':'Account','foreignKey':_0x7b7e('0x16c')});db[_0x7b7e('0x191')]['belongsToMany'](db[_0x7b7e('0x12')],{'as':_0x7b7e('0x151'),'through':'UserChatQueue','hooks':!![]});db[_0x7b7e('0x191')][_0x7b7e('0x120')](db[_0x7b7e('0xe5')],{'through':'team_has_chat_queues','as':_0x7b7e('0x152')});db[_0x7b7e('0x6d')][_0x7b7e('0x114')](db[_0x7b7e('0xd2')],{'as':_0x7b7e('0x15e'),'foreignKey':'ChatGroupId','onDelete':_0x7b7e('0x118')});db[_0x7b7e('0x6d')][_0x7b7e('0x120')](db[_0x7b7e('0x12')],{'as':_0x7b7e('0x192'),'through':_0x7b7e('0x193')});db[_0x7b7e('0x6e')][_0x7b7e('0x14a')](db['ChatWebsite'],{'as':_0x7b7e('0x194'),'foreignKey':_0x7b7e('0x16c')});db[_0x7b7e('0x70')][_0x7b7e('0x114')](db[_0x7b7e('0x72')],{'as':_0x7b7e('0x195'),'foreignKey':_0x7b7e('0x196')});db[_0x7b7e('0x72')][_0x7b7e('0x114')](db[_0x7b7e('0x197')],{'as':'Hoppers','foreignKey':'ContactId'});db[_0x7b7e('0x72')][_0x7b7e('0x114')](db[_0x7b7e('0x75')],{'as':_0x7b7e('0x198'),'foreignKey':_0x7b7e('0x159')});db[_0x7b7e('0x72')][_0x7b7e('0x114')](db[_0x7b7e('0x119')],{'as':_0x7b7e('0x147'),'foreignKey':_0x7b7e('0x159')});db[_0x7b7e('0x72')][_0x7b7e('0x114')](db[_0x7b7e('0x77')],{'as':'ReportAgentPreview','foreignKey':_0x7b7e('0x159')});db[_0x7b7e('0x72')][_0x7b7e('0x114')](db[_0x7b7e('0xd4')],{'as':'JscriptySessions','foreignKey':_0x7b7e('0x159')});db[_0x7b7e('0x72')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x7b7e('0x11a'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0x7b7e('0x72')][_0x7b7e('0x114')](db[_0x7b7e('0x11b')],{'as':_0x7b7e('0x199'),'foreignKey':_0x7b7e('0x159'),'onDelete':'restrict'});db[_0x7b7e('0x72')][_0x7b7e('0x114')](db[_0x7b7e('0x59')],{'as':_0x7b7e('0x128'),'foreignKey':_0x7b7e('0x159'),'onDelete':_0x7b7e('0x16d')});db['CmContact'][_0x7b7e('0x114')](db[_0x7b7e('0x4f')],{'as':_0x7b7e('0x11c'),'foreignKey':_0x7b7e('0x159'),'onDelete':_0x7b7e('0x16d')});db[_0x7b7e('0x72')][_0x7b7e('0x114')](db[_0x7b7e('0x45')],{'as':_0x7b7e('0x11d'),'foreignKey':_0x7b7e('0x159'),'onDelete':_0x7b7e('0x16d')});db['CmContact']['belongsTo'](db[_0x7b7e('0x70')],{'as':_0x7b7e('0x19a'),'foreignKey':'CompanyId'});db['CmContact'][_0x7b7e('0x14a')](db[_0x7b7e('0xf6')],{'as':_0x7b7e('0x161'),'foreignKey':_0x7b7e('0x162'),'onDelete':_0x7b7e('0x118')});db['CmContact']['belongsToMany'](db['User'],{'as':_0x7b7e('0x169'),'through':_0x7b7e('0x122')});db['CmContact'][_0x7b7e('0x120')](db['Tag'],{'as':'Tags','through':_0x7b7e('0x19b')});db['CmContact']['belongsToMany'](db[_0x7b7e('0x8a')],{'through':_0x7b7e('0x19b'),'as':_0x7b7e('0x168')});db['CmHopper'][_0x7b7e('0x14a')](db['CmContact'],{'as':'Contact','foreignKey':_0x7b7e('0x159'),'onDelete':'cascade'});db[_0x7b7e('0x197')]['belongsTo'](db[_0x7b7e('0xf6')],{'as':_0x7b7e('0x161'),'foreignKey':_0x7b7e('0x162'),'onDelete':'cascade'});db[_0x7b7e('0x197')][_0x7b7e('0x14a')](db['User'],{'as':_0x7b7e('0x18a'),'foreignKey':_0x7b7e('0x113')});db[_0x7b7e('0x197')]['belongsTo'](db[_0x7b7e('0x12b')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x7b7e('0x197')][_0x7b7e('0x14a')](db[_0x7b7e('0x19c')],{'as':_0x7b7e('0x19c'),'foreignKey':_0x7b7e('0x19d'),'onDelete':_0x7b7e('0x118')});db[_0x7b7e('0x197')][_0x7b7e('0x14a')](db[_0x7b7e('0x12')],{'as':_0x7b7e('0x166'),'foreignKey':_0x7b7e('0x19e')});db[_0x7b7e('0x74')]['belongsTo'](db[_0x7b7e('0x72')],{'as':_0x7b7e('0x165'),'foreignKey':_0x7b7e('0x159'),'onDelete':'cascade'});db['CmHopperBlack'][_0x7b7e('0x14a')](db[_0x7b7e('0xf6')],{'as':_0x7b7e('0x161'),'foreignKey':_0x7b7e('0x162'),'onDelete':_0x7b7e('0x118')});db[_0x7b7e('0x74')][_0x7b7e('0x14a')](db[_0x7b7e('0x12b')],{'as':_0x7b7e('0x18b'),'foreignKey':_0x7b7e('0x145'),'onDelete':'cascade'});db[_0x7b7e('0x74')][_0x7b7e('0x14a')](db[_0x7b7e('0x19c')],{'as':'Campaign','foreignKey':_0x7b7e('0x19d'),'onDelete':'cascade'});db[_0x7b7e('0x7c')]['hasMany'](db[_0x7b7e('0x80')],{'as':{'plural':_0x7b7e('0x19f'),'singular':'OneAll'},'foreignKey':_0x7b7e('0x1a0'),'onDelete':_0x7b7e('0x118'),'hooks':!![]});db[_0x7b7e('0x7c')][_0x7b7e('0x114')](db['Condition'],{'as':{'plural':_0x7b7e('0x1a1'),'singular':_0x7b7e('0x1a2')},'foreignKey':_0x7b7e('0x1a3'),'onDelete':'cascade','hooks':!![]});db[_0x7b7e('0x7c')][_0x7b7e('0x114')](db['Action'],{'as':_0x7b7e('0x1a4'),'foreignKey':_0x7b7e('0x1a5'),'onDelete':_0x7b7e('0x118'),'hooks':!![]});db[_0x7b7e('0x7f')]['hasMany'](db['Disposition'],{'as':_0x7b7e('0x15c'),'foreignKey':_0x7b7e('0x1a6'),'onDelete':_0x7b7e('0x118')});db['Interval'][_0x7b7e('0x114')](db[_0x7b7e('0x82')],{'as':_0x7b7e('0x1a7'),'foreignKey':'IntervalId','onDelete':'cascade','hooks':!![],'required':![]});db[_0x7b7e('0x82')][_0x7b7e('0x114')](db['VoiceExtension'],{'as':'Extensions','foreignKey':'IntervalId','onDelete':'restrict'});db['Interval'][_0x7b7e('0x114')](db[_0x7b7e('0x160')],{'as':_0x7b7e('0x1a8'),'foreignKey':_0x7b7e('0x14d')});db[_0x7b7e('0x82')][_0x7b7e('0x114')](db[_0x7b7e('0x68')],{'as':_0x7b7e('0x1a9'),'foreignKey':_0x7b7e('0x14d')});db['Interval'][_0x7b7e('0x114')](db[_0x7b7e('0x172')],{'as':_0x7b7e('0x1aa'),'foreignKey':_0x7b7e('0x14d')});db[_0x7b7e('0x82')][_0x7b7e('0x114')](db[_0x7b7e('0x17c')],{'as':_0x7b7e('0x1ab'),'foreignKey':_0x7b7e('0x14d')});db[_0x7b7e('0x86')][_0x7b7e('0x14a')](db['MailAccount'],{});db[_0x7b7e('0x86')][_0x7b7e('0x14a')](db[_0x7b7e('0x96')],{'foreignKey':_0x7b7e('0x1ac')});db[_0x7b7e('0x86')][_0x7b7e('0x14a')](db[_0x7b7e('0x94')],{'foreignKey':_0x7b7e('0x1ad')});db['Sound'][_0x7b7e('0x120')](db[_0x7b7e('0x1b')],{'as':_0x7b7e('0x1ae'),'through':'moh_has_sounds','onDelete':_0x7b7e('0x16d')});db[_0x7b7e('0x8a')][_0x7b7e('0x120')](db[_0x7b7e('0x72')],{'through':_0x7b7e('0x19b')});db[_0x7b7e('0x8a')]['belongsToMany'](db['ChatInteraction'],{'through':_0x7b7e('0x18d')});db[_0x7b7e('0x8a')][_0x7b7e('0x120')](db[_0x7b7e('0x45')],{'through':_0x7b7e('0x167')});db[_0x7b7e('0x8a')][_0x7b7e('0x120')](db[_0x7b7e('0x59')],{'through':'sms_interaction_has_tags'});db[_0x7b7e('0x8a')][_0x7b7e('0x120')](db['FaxInteraction'],{'through':_0x7b7e('0x175')});db[_0x7b7e('0x8a')][_0x7b7e('0x120')](db[_0x7b7e('0x61')],{'through':_0x7b7e('0x186')});db[_0x7b7e('0x8a')][_0x7b7e('0x120')](db['WhatsappInteraction'],{'through':_0x7b7e('0x1af')});db['Trigger'][_0x7b7e('0x114')](db['Condition'],{'as':{'plural':'AllConditions','singular':_0x7b7e('0x1b0')},'foreignKey':'TriggerAllId','onDelete':_0x7b7e('0x118'),'hooks':!![]});db[_0x7b7e('0x8d')]['hasMany'](db['Condition'],{'as':{'plural':_0x7b7e('0x1b1'),'singular':_0x7b7e('0x1b2')},'foreignKey':_0x7b7e('0x1b3'),'onDelete':'cascade','hooks':!![]});db['Trigger'][_0x7b7e('0x114')](db[_0x7b7e('0x7a')],{'as':_0x7b7e('0x1a4'),'foreignKey':'TriggerId','onDelete':'cascade','hooks':!![]});db[_0x7b7e('0x94')]['hasMany'](db[_0x7b7e('0x9c')],{'as':'Fields','onDelete':_0x7b7e('0x118'),'foreignKey':_0x7b7e('0x1ad'),'hooks':!![]});db[_0x7b7e('0x96')][_0x7b7e('0x114')](db[_0x7b7e('0x9c')],{'as':_0x7b7e('0x1b4'),'onDelete':_0x7b7e('0x118'),'foreignKey':_0x7b7e('0x1ac')});db[_0x7b7e('0x9a')][_0x7b7e('0x114')](db[_0x7b7e('0x9c')],{'as':_0x7b7e('0x1b4'),'onDelete':_0x7b7e('0x118'),'foreignKey':_0x7b7e('0x1b5')});db[_0x7b7e('0x9c')][_0x7b7e('0x14a')](db['AnalyticMetric'],{'foreignKey':_0x7b7e('0x1b5')});db[_0x7b7e('0x9f')][_0x7b7e('0x114')](db[_0x7b7e('0xa1')],{'as':_0x7b7e('0x1b6'),'onDelete':_0x7b7e('0x118'),'foreignKey':_0x7b7e('0x1b7')});db['SalesforceConfiguration'][_0x7b7e('0x114')](db[_0x7b7e('0xa3')],{'as':_0x7b7e('0x1b8'),'onDelete':_0x7b7e('0x118'),'foreignKey':_0x7b7e('0x1b9')});db[_0x7b7e('0xa1')][_0x7b7e('0x114')](db['SalesforceField'],{'as':_0x7b7e('0x1ba'),'onDelete':_0x7b7e('0x118'),'foreignKey':'DescriptionId'});db[_0x7b7e('0xa1')]['hasMany'](db['SalesforceField'],{'as':'Fields','onDelete':'cascade','foreignKey':_0x7b7e('0x1bb')});db[_0x7b7e('0xa1')][_0x7b7e('0x14a')](db[_0x7b7e('0x9f')],{'as':_0x7b7e('0x164'),'foreignKey':_0x7b7e('0x1b7')});db[_0x7b7e('0xa3')]['hasMany'](db[_0x7b7e('0xa3')],{'as':_0x7b7e('0x1bc'),'foreignKey':_0x7b7e('0x1b9')});db[_0x7b7e('0xa3')][_0x7b7e('0x114')](db[_0x7b7e('0xa3')],{'as':_0x7b7e('0x1bd'),'foreignKey':_0x7b7e('0x1be')});db[_0x7b7e('0xa3')][_0x7b7e('0x114')](db['SalesforceField'],{'as':_0x7b7e('0x1bf'),'foreignKey':_0x7b7e('0x1bb')});db[_0x7b7e('0xa3')][_0x7b7e('0x14a')](db[_0x7b7e('0x8e')],{'as':_0x7b7e('0x8e'),'foreignKey':_0x7b7e('0x1c0')});db[_0x7b7e('0xa4')][_0x7b7e('0x114')](db[_0x7b7e('0x1c1')],{'as':_0x7b7e('0x1b6'),'onDelete':_0x7b7e('0x118'),'foreignKey':_0x7b7e('0x1b7')});db[_0x7b7e('0x1c1')][_0x7b7e('0x114')](db[_0x7b7e('0xa6')],{'as':_0x7b7e('0x1b8'),'onDelete':_0x7b7e('0x118'),'foreignKey':'SubjectId'});db['SugarcrmConfiguration'][_0x7b7e('0x114')](db[_0x7b7e('0xa6')],{'as':_0x7b7e('0x1ba'),'onDelete':_0x7b7e('0x118'),'foreignKey':'DescriptionId'});db[_0x7b7e('0x1c1')]['hasMany'](db[_0x7b7e('0xa6')],{'as':_0x7b7e('0x1b4'),'onDelete':'cascade','foreignKey':_0x7b7e('0x1bb')});db[_0x7b7e('0x1c1')][_0x7b7e('0x14a')](db[_0x7b7e('0xa4')],{'as':_0x7b7e('0x164'),'foreignKey':_0x7b7e('0x1b7')});db[_0x7b7e('0xa6')][_0x7b7e('0x114')](db[_0x7b7e('0xa6')],{'as':_0x7b7e('0x1bc'),'foreignKey':_0x7b7e('0x1b9')});db[_0x7b7e('0xa6')][_0x7b7e('0x114')](db[_0x7b7e('0xa6')],{'as':_0x7b7e('0x1bd'),'foreignKey':'DescriptionId'});db[_0x7b7e('0xa6')][_0x7b7e('0x114')](db[_0x7b7e('0xa6')],{'as':_0x7b7e('0x1bf'),'foreignKey':_0x7b7e('0x1bb')});db[_0x7b7e('0xa6')][_0x7b7e('0x14a')](db[_0x7b7e('0x8e')],{'as':_0x7b7e('0x8e'),'foreignKey':_0x7b7e('0x1c0')});db[_0x7b7e('0x1c2')]['hasMany'](db[_0x7b7e('0xa9')],{'as':_0x7b7e('0x1b6'),'onDelete':_0x7b7e('0x118'),'foreignKey':_0x7b7e('0x1b7')});db[_0x7b7e('0xa9')][_0x7b7e('0x114')](db[_0x7b7e('0xab')],{'as':_0x7b7e('0x1b8'),'onDelete':_0x7b7e('0x118'),'foreignKey':'SubjectId'});db[_0x7b7e('0xa9')][_0x7b7e('0x114')](db['DeskField'],{'as':_0x7b7e('0x1ba'),'onDelete':'cascade','foreignKey':_0x7b7e('0x1be')});db['DeskConfiguration'][_0x7b7e('0x114')](db[_0x7b7e('0xab')],{'as':_0x7b7e('0x1b4'),'onDelete':_0x7b7e('0x118'),'foreignKey':_0x7b7e('0x1bb')});db[_0x7b7e('0xa9')]['belongsTo'](db[_0x7b7e('0x1c2')],{'as':'Account','foreignKey':_0x7b7e('0x1b7')});db[_0x7b7e('0xa9')][_0x7b7e('0x120')](db[_0x7b7e('0x8a')],{'through':_0x7b7e('0x1c3')});db[_0x7b7e('0xab')][_0x7b7e('0x114')](db[_0x7b7e('0xab')],{'as':_0x7b7e('0x1bc'),'foreignKey':_0x7b7e('0x1b9')});db[_0x7b7e('0xab')][_0x7b7e('0x114')](db[_0x7b7e('0xab')],{'as':'Description','foreignKey':'DescriptionId'});db['DeskField']['hasMany'](db[_0x7b7e('0xab')],{'as':'Field','foreignKey':_0x7b7e('0x1bb')});db[_0x7b7e('0xab')][_0x7b7e('0x14a')](db[_0x7b7e('0x8e')],{'as':_0x7b7e('0x8e'),'foreignKey':_0x7b7e('0x1c0')});db[_0x7b7e('0xad')]['hasMany'](db[_0x7b7e('0xaf')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x7b7e('0x1b7')});db[_0x7b7e('0xaf')][_0x7b7e('0x114')](db[_0x7b7e('0xb1')],{'as':'Subjects','onDelete':_0x7b7e('0x118'),'foreignKey':_0x7b7e('0x1b9')});db[_0x7b7e('0xaf')][_0x7b7e('0x114')](db[_0x7b7e('0xb1')],{'as':_0x7b7e('0x1ba'),'onDelete':_0x7b7e('0x118'),'foreignKey':_0x7b7e('0x1be')});db['ZohoConfiguration'][_0x7b7e('0x114')](db[_0x7b7e('0xb1')],{'as':_0x7b7e('0x1b4'),'onDelete':_0x7b7e('0x118'),'foreignKey':_0x7b7e('0x1bb')});db['ZohoConfiguration'][_0x7b7e('0x14a')](db['ZohoAccount'],{'as':_0x7b7e('0x164'),'foreignKey':_0x7b7e('0x1b7')});db['ZohoField'][_0x7b7e('0x114')](db[_0x7b7e('0xb1')],{'as':_0x7b7e('0x1bc'),'foreignKey':_0x7b7e('0x1b9')});db[_0x7b7e('0xb1')][_0x7b7e('0x114')](db[_0x7b7e('0xb1')],{'as':_0x7b7e('0x1bd'),'foreignKey':_0x7b7e('0x1be')});db[_0x7b7e('0xb1')][_0x7b7e('0x114')](db[_0x7b7e('0xb1')],{'as':_0x7b7e('0x1bf'),'foreignKey':'FieldId'});db[_0x7b7e('0xb1')][_0x7b7e('0x14a')](db[_0x7b7e('0x8e')],{'as':_0x7b7e('0x8e'),'foreignKey':'VariableId'});db[_0x7b7e('0xb3')]['hasMany'](db[_0x7b7e('0xb5')],{'as':_0x7b7e('0x1b6'),'onDelete':'cascade','foreignKey':_0x7b7e('0x1b7')});db[_0x7b7e('0xb5')]['hasMany'](db[_0x7b7e('0x1c4')],{'as':_0x7b7e('0x1b8'),'foreignKey':_0x7b7e('0x1b9')});db[_0x7b7e('0xb5')][_0x7b7e('0x114')](db[_0x7b7e('0x1c4')],{'as':_0x7b7e('0x1ba'),'foreignKey':_0x7b7e('0x1be')});db['ZendeskConfiguration'][_0x7b7e('0x114')](db[_0x7b7e('0x1c4')],{'as':_0x7b7e('0x1b4'),'foreignKey':'FieldId'});db[_0x7b7e('0xb5')][_0x7b7e('0x14a')](db[_0x7b7e('0xb3')],{'as':_0x7b7e('0x164'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x7b7e('0x120')](db[_0x7b7e('0x8a')],{'through':_0x7b7e('0x1c5')});db[_0x7b7e('0x1c4')]['hasMany'](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x7b7e('0x1c4')][_0x7b7e('0x114')](db['ZendeskField'],{'as':'Description','foreignKey':_0x7b7e('0x1be')});db[_0x7b7e('0x1c4')][_0x7b7e('0x114')](db[_0x7b7e('0x1c4')],{'as':_0x7b7e('0x1bf'),'foreignKey':_0x7b7e('0x1bb')});db[_0x7b7e('0x1c4')]['belongsTo'](db[_0x7b7e('0x8e')],{'as':_0x7b7e('0x8e'),'foreignKey':'VariableId'});db[_0x7b7e('0xb7')][_0x7b7e('0x114')](db[_0x7b7e('0xb9')],{'as':_0x7b7e('0x1b6'),'onDelete':'cascade','foreignKey':_0x7b7e('0x1b7')});db[_0x7b7e('0xb9')][_0x7b7e('0x114')](db[_0x7b7e('0xba')],{'as':_0x7b7e('0x1b8'),'onDelete':_0x7b7e('0x118'),'foreignKey':_0x7b7e('0x1b9')});db[_0x7b7e('0xb9')][_0x7b7e('0x114')](db[_0x7b7e('0xba')],{'as':_0x7b7e('0x1ba'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['FreshdeskConfiguration']['hasMany'](db[_0x7b7e('0xba')],{'as':_0x7b7e('0x1b4'),'onDelete':_0x7b7e('0x118'),'foreignKey':_0x7b7e('0x1bb')});db[_0x7b7e('0xb9')][_0x7b7e('0x14a')](db[_0x7b7e('0xb7')],{'as':_0x7b7e('0x164'),'foreignKey':_0x7b7e('0x1b7')});db[_0x7b7e('0xb9')][_0x7b7e('0x120')](db[_0x7b7e('0x8a')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x7b7e('0xba')][_0x7b7e('0x114')](db[_0x7b7e('0xba')],{'as':_0x7b7e('0x1bc'),'foreignKey':'SubjectId'});db[_0x7b7e('0xba')]['hasMany'](db[_0x7b7e('0xba')],{'as':_0x7b7e('0x1bd'),'foreignKey':_0x7b7e('0x1be')});db[_0x7b7e('0xba')][_0x7b7e('0x114')](db['FreshdeskField'],{'as':'Field','foreignKey':_0x7b7e('0x1bb')});db[_0x7b7e('0xba')][_0x7b7e('0x14a')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x7b7e('0xbc')][_0x7b7e('0x114')](db[_0x7b7e('0xbd')],{'as':_0x7b7e('0x1b6'),'onDelete':_0x7b7e('0x118'),'foreignKey':_0x7b7e('0x1b7')});db['VtigerConfiguration'][_0x7b7e('0x114')](db[_0x7b7e('0x1c6')],{'as':_0x7b7e('0x1b8'),'foreignKey':_0x7b7e('0x1b9')});db[_0x7b7e('0xbd')][_0x7b7e('0x114')](db[_0x7b7e('0x1c6')],{'as':_0x7b7e('0x1ba'),'foreignKey':_0x7b7e('0x1be')});db[_0x7b7e('0xbd')]['hasMany'](db['VtigerField'],{'as':'Fields','foreignKey':_0x7b7e('0x1bb')});db[_0x7b7e('0xbd')]['belongsTo'](db[_0x7b7e('0xbc')],{'as':_0x7b7e('0x164'),'foreignKey':_0x7b7e('0x1b7')});db['VtigerField'][_0x7b7e('0x114')](db[_0x7b7e('0x1c6')],{'as':'Subject','foreignKey':_0x7b7e('0x1b9')});db['VtigerField'][_0x7b7e('0x114')](db[_0x7b7e('0x1c6')],{'as':_0x7b7e('0x1bd'),'foreignKey':_0x7b7e('0x1be')});db[_0x7b7e('0x1c6')][_0x7b7e('0x114')](db[_0x7b7e('0x1c6')],{'as':_0x7b7e('0x1bf'),'foreignKey':'FieldId'});db['VtigerField'][_0x7b7e('0x14a')](db['Variable'],{'as':_0x7b7e('0x8e'),'foreignKey':_0x7b7e('0x1c0')});db['ServicenowAccount'][_0x7b7e('0x114')](db[_0x7b7e('0x1c7')],{'as':_0x7b7e('0x1b6'),'onDelete':'cascade','foreignKey':_0x7b7e('0x1b7')});db[_0x7b7e('0x1c7')][_0x7b7e('0x114')](db['ServicenowField'],{'as':_0x7b7e('0x1b8'),'foreignKey':_0x7b7e('0x1b9')});db['ServicenowConfiguration'][_0x7b7e('0x114')](db[_0x7b7e('0xc3')],{'as':_0x7b7e('0x1ba'),'foreignKey':_0x7b7e('0x1be')});db[_0x7b7e('0x1c7')][_0x7b7e('0x114')](db['ServicenowField'],{'as':_0x7b7e('0x1b4'),'foreignKey':_0x7b7e('0x1bb')});db[_0x7b7e('0x1c7')][_0x7b7e('0x14a')](db[_0x7b7e('0xc0')],{'as':_0x7b7e('0x164'),'foreignKey':'AccountId'});db['ServicenowField']['hasMany'](db[_0x7b7e('0xc3')],{'as':'Subject','foreignKey':_0x7b7e('0x1b9')});db['ServicenowField'][_0x7b7e('0x114')](db[_0x7b7e('0xc3')],{'as':_0x7b7e('0x1bd'),'foreignKey':_0x7b7e('0x1be')});db[_0x7b7e('0xc3')]['hasMany'](db[_0x7b7e('0xc3')],{'as':'Field','foreignKey':_0x7b7e('0x1bb')});db['ServicenowField'][_0x7b7e('0x14a')](db[_0x7b7e('0x8e')],{'as':'Variable','foreignKey':_0x7b7e('0x1c0')});db[_0x7b7e('0x1c8')][_0x7b7e('0x114')](db['Dynamics365Configuration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x7b7e('0x1b7')});db[_0x7b7e('0xc6')][_0x7b7e('0x114')](db['Dynamics365Field'],{'as':'Subjects','onDelete':_0x7b7e('0x118'),'foreignKey':'SubjectId'});db[_0x7b7e('0xc6')][_0x7b7e('0x114')](db['Dynamics365Field'],{'as':_0x7b7e('0x1ba'),'onDelete':'cascade','foreignKey':_0x7b7e('0x1be')});db['Dynamics365Configuration']['hasMany'](db['Dynamics365Field'],{'as':_0x7b7e('0x1b4'),'onDelete':'cascade','foreignKey':_0x7b7e('0x1bb')});db['Dynamics365Configuration'][_0x7b7e('0x14a')](db[_0x7b7e('0x1c8')],{'as':_0x7b7e('0x164'),'foreignKey':_0x7b7e('0x1b7')});db['Dynamics365Field'][_0x7b7e('0x114')](db['Dynamics365Field'],{'as':'Subject','foreignKey':_0x7b7e('0x1b9')});db[_0x7b7e('0x1c9')][_0x7b7e('0x114')](db[_0x7b7e('0x1c9')],{'as':_0x7b7e('0x1bd'),'foreignKey':_0x7b7e('0x1be')});db['Dynamics365Field'][_0x7b7e('0x114')](db['Dynamics365Field'],{'as':'Field','foreignKey':_0x7b7e('0x1bb')});db[_0x7b7e('0x1c9')][_0x7b7e('0x14a')](db[_0x7b7e('0x8e')],{'as':_0x7b7e('0x8e'),'foreignKey':'VariableId'});db[_0x7b7e('0xc8')]['hasMany'](db[_0x7b7e('0xca')],{'as':_0x7b7e('0x1b6'),'onDelete':_0x7b7e('0x118'),'foreignKey':_0x7b7e('0x1b7')});db['FreshsalesConfiguration'][_0x7b7e('0x114')](db[_0x7b7e('0xcc')],{'as':'Subjects','foreignKey':_0x7b7e('0x1b9')});db[_0x7b7e('0xca')][_0x7b7e('0x114')](db[_0x7b7e('0xcc')],{'as':_0x7b7e('0x1ba'),'foreignKey':_0x7b7e('0x1be')});db[_0x7b7e('0xca')][_0x7b7e('0x114')](db['FreshsalesField'],{'as':_0x7b7e('0x1b4'),'foreignKey':'FieldId'});db[_0x7b7e('0xca')][_0x7b7e('0x14a')](db[_0x7b7e('0xc8')],{'as':_0x7b7e('0x164'),'foreignKey':_0x7b7e('0x1b7')});db[_0x7b7e('0xcc')]['hasMany'](db[_0x7b7e('0xcc')],{'as':'Subject','foreignKey':_0x7b7e('0x1b9')});db['FreshsalesField'][_0x7b7e('0x114')](db[_0x7b7e('0xcc')],{'as':'Description','foreignKey':_0x7b7e('0x1be')});db[_0x7b7e('0xcc')]['hasMany'](db[_0x7b7e('0xcc')],{'as':_0x7b7e('0x1bf'),'foreignKey':_0x7b7e('0x1bb')});db[_0x7b7e('0xcc')][_0x7b7e('0x14a')](db[_0x7b7e('0x8e')],{'as':_0x7b7e('0x8e'),'foreignKey':_0x7b7e('0x1c0')});db['ChatQueueReport'][_0x7b7e('0x14a')](db[_0x7b7e('0x65')],{});db[_0x7b7e('0xd0')]['belongsTo'](db[_0x7b7e('0xf6')],{'as':'List','foreignKey':_0x7b7e('0x162')});db[_0x7b7e('0xd0')][_0x7b7e('0x14a')](db[_0x7b7e('0x72')],{'as':'Contact','foreignKey':_0x7b7e('0x159')});db[_0x7b7e('0xd0')][_0x7b7e('0x14a')](db[_0x7b7e('0x11b')],{});db[_0x7b7e('0xd0')][_0x7b7e('0x14a')](db[_0x7b7e('0x6b')],{});db[_0x7b7e('0xd0')][_0x7b7e('0x14a')](db[_0x7b7e('0x12')],{});db[_0x7b7e('0xd0')]['belongsTo'](db['ChatQueue'],{});db[_0x7b7e('0xd2')][_0x7b7e('0x14a')](db[_0x7b7e('0x12')],{'onDelete':_0x7b7e('0x118'),'foreignKey':_0x7b7e('0x1ca')});db[_0x7b7e('0xd2')][_0x7b7e('0x14a')](db[_0x7b7e('0x12')],{'onDelete':_0x7b7e('0x118'),'foreignKey':_0x7b7e('0x1cb')});db[_0x7b7e('0xd4')][_0x7b7e('0x114')](db[_0x7b7e('0xd3')],{'foreignKey':_0x7b7e('0x1cc'),'onDelete':_0x7b7e('0x118')});db[_0x7b7e('0xd4')][_0x7b7e('0x114')](db[_0x7b7e('0x1cd')],{'foreignKey':_0x7b7e('0x1cc'),'onDelete':'cascade'});db[_0x7b7e('0xd6')][_0x7b7e('0x14a')](db[_0x7b7e('0x56')],{});db[_0x7b7e('0xd6')]['belongsTo'](db['CmList'],{'as':_0x7b7e('0x161'),'foreignKey':_0x7b7e('0x162')});db[_0x7b7e('0xd6')]['belongsTo'](db[_0x7b7e('0x72')],{'as':_0x7b7e('0x165'),'foreignKey':_0x7b7e('0x159')});db['SmsQueueReport'][_0x7b7e('0x14a')](db[_0x7b7e('0x59')],{});db[_0x7b7e('0xd6')]['belongsTo'](db[_0x7b7e('0x17b')],{});db[_0x7b7e('0xd6')][_0x7b7e('0x14a')](db[_0x7b7e('0x12')],{});db[_0x7b7e('0xd6')][_0x7b7e('0x14a')](db[_0x7b7e('0x5c')],{});db['JscriptyProject'][_0x7b7e('0x114')](db[_0x7b7e('0xd4')],{'foreignKey':_0x7b7e('0x1ce')});db['JscriptyProject']['hasMany'](db[_0x7b7e('0xd3')],{'foreignKey':_0x7b7e('0x1ce')});db['JscriptyProject'][_0x7b7e('0x114')](db['JscriptyAnswerReport'],{'foreignKey':_0x7b7e('0x1ce')});db[_0x7b7e('0xdf')][_0x7b7e('0x120')](db['User'],{'as':_0x7b7e('0x169'),'through':_0x7b7e('0x1cf')});db['Team'][_0x7b7e('0x120')](db[_0x7b7e('0x12')],{'as':_0x7b7e('0x151'),'through':_0x7b7e('0x125')});db[_0x7b7e('0xe5')]['belongsToMany'](db[_0x7b7e('0x12b')],{'through':_0x7b7e('0x10d'),'as':'VoiceQueues'});db[_0x7b7e('0xe5')][_0x7b7e('0x120')](db['MailQueue'],{'through':_0x7b7e('0x163'),'as':_0x7b7e('0x12f')});db[_0x7b7e('0xe5')][_0x7b7e('0x120')](db[_0x7b7e('0x191')],{'through':_0x7b7e('0x1d0'),'as':_0x7b7e('0x130')});db[_0x7b7e('0xe5')]['belongsToMany'](db[_0x7b7e('0x131')],{'through':'team_has_fax_queues','as':_0x7b7e('0x1d1')});db['Team'][_0x7b7e('0x120')](db[_0x7b7e('0x5c')],{'through':_0x7b7e('0x182'),'as':_0x7b7e('0x132')});db['Team']['belongsToMany'](db['OpenchannelQueue'],{'through':_0x7b7e('0x188'),'as':_0x7b7e('0x133')});db[_0x7b7e('0xe5')][_0x7b7e('0x120')](db[_0x7b7e('0x134')],{'through':'team_has_whatsapp_queues','as':_0x7b7e('0x1d2')});db[_0x7b7e('0xe5')][_0x7b7e('0x120')](db[_0x7b7e('0xf8')],{'through':'TeamVoicePrefix','as':_0x7b7e('0x12d')});db[_0x7b7e('0x19c')][_0x7b7e('0x114')](db[_0x7b7e('0x197')],{'as':'Hoppers','foreignKey':'CampaignId'});db[_0x7b7e('0x19c')][_0x7b7e('0x114')](db['CmHopperFinal'],{'as':_0x7b7e('0x198'),'foreignKey':'CampaignId'});db[_0x7b7e('0x19c')]['hasMany'](db['CmHopperHistory'],{'as':_0x7b7e('0x147'),'foreignKey':_0x7b7e('0x19d')});db[_0x7b7e('0x19c')][_0x7b7e('0x114')](db[_0x7b7e('0x74')],{'as':_0x7b7e('0x148'),'foreignKey':_0x7b7e('0x19d')});db[_0x7b7e('0x19c')][_0x7b7e('0x14a')](db['Trunk'],{'as':_0x7b7e('0x28'),'foreignKey':'TrunkId'});db[_0x7b7e('0x19c')][_0x7b7e('0x14a')](db[_0x7b7e('0x28')],{'as':_0x7b7e('0x1d3'),'foreignKey':_0x7b7e('0x14c')});db[_0x7b7e('0x19c')][_0x7b7e('0x14a')](db['Interval'],{'as':_0x7b7e('0x82'),'foreignKey':'IntervalId'});db[_0x7b7e('0x19c')][_0x7b7e('0x14a')](db[_0x7b7e('0xdf')],{'as':_0x7b7e('0xdf'),'foreignKey':_0x7b7e('0x1d4')});db[_0x7b7e('0x19c')]['belongsToMany'](db[_0x7b7e('0xf6')],{'as':_0x7b7e('0x123'),'through':'campaigns_has_cm_lists'});db[_0x7b7e('0x19c')]['belongsToMany'](db[_0x7b7e('0xf6')],{'as':'BlackLists','through':_0x7b7e('0x1d5')});db[_0x7b7e('0xeb')][_0x7b7e('0x14a')](db[_0x7b7e('0x6c')],{'as':_0x7b7e('0x6c'),'foreignKey':_0x7b7e('0x190')});db[_0x7b7e('0xee')]['belongsTo'](db[_0x7b7e('0x46')],{});db[_0x7b7e('0xee')][_0x7b7e('0x14a')](db['MailInteraction'],{});db[_0x7b7e('0xee')][_0x7b7e('0x14a')](db[_0x7b7e('0x3f')],{'foreignKey':_0x7b7e('0x1d6'),'as':_0x7b7e('0x1d7')});db[_0x7b7e('0xee')]['belongsTo'](db[_0x7b7e('0x12')],{'foreignKey':_0x7b7e('0x1d8'),'as':_0x7b7e('0x1d9')});db['MailTransferReport'][_0x7b7e('0x14a')](db['User'],{'foreignKey':_0x7b7e('0x1da'),'as':_0x7b7e('0x1db')});db[_0x7b7e('0xee')][_0x7b7e('0x14a')](db[_0x7b7e('0x41')],{'foreignKey':_0x7b7e('0x1dc'),'as':_0x7b7e('0x1dd')});db[_0x7b7e('0xee')]['belongsTo'](db[_0x7b7e('0x3f')],{'foreignKey':'ToMailAccountId','as':_0x7b7e('0x1de')});db[_0x7b7e('0x1df')][_0x7b7e('0x14a')](db[_0x7b7e('0x6b')],{});db['ChatTransferReport'][_0x7b7e('0x14a')](db['ChatInteraction'],{});db['ChatTransferReport'][_0x7b7e('0x14a')](db[_0x7b7e('0x65')],{'foreignKey':_0x7b7e('0x1e0'),'as':_0x7b7e('0x1d7')});db['ChatTransferReport'][_0x7b7e('0x14a')](db['User'],{'foreignKey':_0x7b7e('0x1d8'),'as':_0x7b7e('0x1d9')});db[_0x7b7e('0x1df')][_0x7b7e('0x14a')](db[_0x7b7e('0x12')],{'foreignKey':_0x7b7e('0x1da'),'as':_0x7b7e('0x1db')});db[_0x7b7e('0x1df')][_0x7b7e('0x14a')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':_0x7b7e('0x1dd')});db[_0x7b7e('0x1df')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x7b7e('0x1e1'),'as':_0x7b7e('0x1de')});db[_0x7b7e('0xf0')][_0x7b7e('0x14a')](db['FaxMessage'],{});db[_0x7b7e('0xf0')][_0x7b7e('0x14a')](db[_0x7b7e('0x4f')],{});db[_0x7b7e('0xf0')][_0x7b7e('0x14a')](db[_0x7b7e('0x170')],{'foreignKey':_0x7b7e('0x1e2'),'as':_0x7b7e('0x1d7')});db[_0x7b7e('0xf0')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x7b7e('0xf0')]['belongsTo'](db[_0x7b7e('0x12')],{'foreignKey':_0x7b7e('0x1da'),'as':_0x7b7e('0x1db')});db[_0x7b7e('0xf0')]['belongsTo'](db[_0x7b7e('0x131')],{'foreignKey':_0x7b7e('0x1e3'),'as':_0x7b7e('0x1dd')});db[_0x7b7e('0xf0')][_0x7b7e('0x14a')](db['FaxAccount'],{'foreignKey':_0x7b7e('0x1e4'),'as':_0x7b7e('0x1de')});db['OpenchannelTransferReport'][_0x7b7e('0x14a')](db[_0x7b7e('0x62')],{});db['OpenchannelTransferReport'][_0x7b7e('0x14a')](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport'][_0x7b7e('0x14a')](db[_0x7b7e('0x5d')],{'foreignKey':_0x7b7e('0x1e5'),'as':_0x7b7e('0x1d7')});db['OpenchannelTransferReport'][_0x7b7e('0x14a')](db[_0x7b7e('0x12')],{'foreignKey':_0x7b7e('0x1d8'),'as':'FromAgent'});db[_0x7b7e('0xf2')][_0x7b7e('0x14a')](db['User'],{'foreignKey':'ToUserId','as':_0x7b7e('0x1db')});db[_0x7b7e('0xf2')]['belongsTo'](db[_0x7b7e('0x64')],{'foreignKey':_0x7b7e('0x1e6'),'as':'ToQueue'});db[_0x7b7e('0xf2')][_0x7b7e('0x14a')](db['OpenchannelAccount'],{'foreignKey':'ToOpenchannelAccountId','as':_0x7b7e('0x1de')});db[_0x7b7e('0xf4')][_0x7b7e('0x14a')](db[_0x7b7e('0x17b')],{});db[_0x7b7e('0xf4')][_0x7b7e('0x14a')](db[_0x7b7e('0x59')],{});db[_0x7b7e('0xf4')][_0x7b7e('0x14a')](db['SmsAccount'],{'foreignKey':_0x7b7e('0x1e7'),'as':_0x7b7e('0x1d7')});db[_0x7b7e('0xf4')][_0x7b7e('0x14a')](db[_0x7b7e('0x12')],{'foreignKey':_0x7b7e('0x1d8'),'as':_0x7b7e('0x1d9')});db[_0x7b7e('0xf4')][_0x7b7e('0x14a')](db[_0x7b7e('0x12')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x7b7e('0xf4')][_0x7b7e('0x14a')](db[_0x7b7e('0x5c')],{'foreignKey':_0x7b7e('0x1e8'),'as':_0x7b7e('0x1dd')});db[_0x7b7e('0xf4')][_0x7b7e('0x14a')](db[_0x7b7e('0x56')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db[_0x7b7e('0xf6')][_0x7b7e('0x114')](db['Disposition'],{'as':_0x7b7e('0x15c'),'foreignKey':_0x7b7e('0x162'),'onDelete':_0x7b7e('0x118')});db[_0x7b7e('0xf6')][_0x7b7e('0x114')](db['CmCustomField'],{'as':'CustomFields','foreignKey':_0x7b7e('0x162')});db[_0x7b7e('0xf6')][_0x7b7e('0x114')](db[_0x7b7e('0x72')],{'as':_0x7b7e('0x195'),'onDelete':_0x7b7e('0x118'),'foreignKey':_0x7b7e('0x162')});db[_0x7b7e('0xf6')][_0x7b7e('0x114')](db[_0x7b7e('0x75')],{'as':'HopperFinals','foreignKey':_0x7b7e('0x162')});db[_0x7b7e('0xf6')][_0x7b7e('0x114')](db[_0x7b7e('0x119')],{'as':_0x7b7e('0x1e9'),'foreignKey':_0x7b7e('0x162')});db['CmList'][_0x7b7e('0x114')](db['ReportAgentPreview'],{'as':_0x7b7e('0x77'),'foreignKey':_0x7b7e('0x162')});db[_0x7b7e('0xf6')][_0x7b7e('0x120')](db['VoiceQueue'],{'as':'Queues','through':_0x7b7e('0x150')});db['CmList'][_0x7b7e('0x120')](db['User'],{'as':_0x7b7e('0x151'),'through':_0x7b7e('0x124')});db[_0x7b7e('0xf8')][_0x7b7e('0x114')](db[_0x7b7e('0x19')],{'as':_0x7b7e('0x117'),'onDelete':_0x7b7e('0x118')});db[_0x7b7e('0xf8')][_0x7b7e('0x120')](db[_0x7b7e('0x12')],{'as':'Agents','through':'UserVoicePrefix'});db['VoicePrefix'][_0x7b7e('0x120')](db['Team'],{'through':_0x7b7e('0x10f'),'as':_0x7b7e('0x152')});db['UserProfile'][_0x7b7e('0x114')](db[_0x7b7e('0x12')],{'as':_0x7b7e('0x169'),'foreignKey':_0x7b7e('0x11f')});db[_0x7b7e('0xfa')]['hasMany'](db['UserProfileSection'],{'as':_0x7b7e('0x1ea'),'foreignKey':_0x7b7e('0x11f'),'onDelete':_0x7b7e('0x118')});db[_0x7b7e('0xfc')][_0x7b7e('0x114')](db[_0x7b7e('0xfe')],{'as':_0x7b7e('0x1eb'),'foreignKey':_0x7b7e('0x1ec'),'onDelete':_0x7b7e('0x118')});db[_0x7b7e('0x102')]['hasMany'](db[_0x7b7e('0x7f')],{'as':_0x7b7e('0x15c'),'foreignKey':_0x7b7e('0x1ed'),'onDelete':_0x7b7e('0x118')});db['WhatsappAccount'][_0x7b7e('0x114')](db[_0x7b7e('0x7d')],{'as':_0x7b7e('0x15d'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0x7b7e('0x114')](db[_0x7b7e('0x106')],{'as':'Messages','foreignKey':_0x7b7e('0x1ed')});db[_0x7b7e('0x102')]['hasMany'](db[_0x7b7e('0x105')],{'as':'Interactions'});db[_0x7b7e('0x102')][_0x7b7e('0x114')](db[_0x7b7e('0x104')],{'as':_0x7b7e('0x142')});db[_0x7b7e('0x102')][_0x7b7e('0x14a')](db[_0x7b7e('0xf6')],{'as':_0x7b7e('0x161'),'foreignKey':_0x7b7e('0x162')});db[_0x7b7e('0x102')][_0x7b7e('0x14a')](db[_0x7b7e('0x14e')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x7b7e('0x102')][_0x7b7e('0x120')](db[_0x7b7e('0x12')],{'as':'Agents','through':_0x7b7e('0x13f')});db[_0x7b7e('0x104')]['belongsTo'](db[_0x7b7e('0x12')],{'onDelete':_0x7b7e('0x16d')});db[_0x7b7e('0x104')][_0x7b7e('0x14a')](db[_0x7b7e('0x134')],{'onDelete':_0x7b7e('0x16d')});db['WhatsappApplication'][_0x7b7e('0x14a')](db[_0x7b7e('0x102')],{'onDelete':'restrict'});db[_0x7b7e('0x104')][_0x7b7e('0x14a')](db[_0x7b7e('0x82')],{'onDelete':'restrict','foreignKey':_0x7b7e('0x14d')});db[_0x7b7e('0x104')][_0x7b7e('0x14a')](db[_0x7b7e('0x8a')],{'onDelete':_0x7b7e('0x16d'),'foreignKey':'TagId'});db[_0x7b7e('0x105')][_0x7b7e('0x114')](db[_0x7b7e('0x106')],{'as':_0x7b7e('0x15e'),'onDelete':_0x7b7e('0x118'),'foreignKey':'WhatsappInteractionId'});db[_0x7b7e('0x105')][_0x7b7e('0x14a')](db[_0x7b7e('0x102')],{'as':'Account','foreignKey':_0x7b7e('0x1ed')});db[_0x7b7e('0x105')][_0x7b7e('0x14a')](db['CmContact'],{'as':_0x7b7e('0x165'),'foreignKey':_0x7b7e('0x159')});db[_0x7b7e('0x105')][_0x7b7e('0x14a')](db['User'],{'as':_0x7b7e('0x166'),'foreignKey':'UserId'});db[_0x7b7e('0x105')]['belongsToMany'](db[_0x7b7e('0x8a')],{'through':_0x7b7e('0x1af'),'as':_0x7b7e('0x17e')});db[_0x7b7e('0x105')][_0x7b7e('0x120')](db[_0x7b7e('0x8a')],{'through':'whatsapp_interaction_has_tags','as':_0x7b7e('0x168')});db[_0x7b7e('0x105')][_0x7b7e('0x120')](db[_0x7b7e('0x12')],{'as':_0x7b7e('0x169'),'through':_0x7b7e('0x12a'),'foreignKey':'WhatsappInteractionId'});db[_0x7b7e('0x106')][_0x7b7e('0x14a')](db[_0x7b7e('0x12')],{'as':_0x7b7e('0x12')});db['WhatsappMessage'][_0x7b7e('0x14a')](db[_0x7b7e('0x72')],{'onDelete':'cascade','as':'Contact'});db[_0x7b7e('0x106')]['belongsTo'](db['WhatsappInteraction'],{'onDelete':_0x7b7e('0x118'),'as':_0x7b7e('0x177'),'foreignKey':_0x7b7e('0x1ee')});db[_0x7b7e('0x106')][_0x7b7e('0x14a')](db[_0x7b7e('0x102')],{'as':_0x7b7e('0x164'),'foreignKey':'WhatsappAccountId'});db['WhatsappQueueReport'][_0x7b7e('0x14a')](db[_0x7b7e('0x102')],{});db[_0x7b7e('0x107')]['belongsTo'](db[_0x7b7e('0xf6')],{'as':_0x7b7e('0x161'),'foreignKey':_0x7b7e('0x162')});db[_0x7b7e('0x107')][_0x7b7e('0x14a')](db[_0x7b7e('0x72')],{'as':_0x7b7e('0x165'),'foreignKey':_0x7b7e('0x159')});db['WhatsappQueueReport']['belongsTo'](db['WhatsappInteraction'],{});db[_0x7b7e('0x107')][_0x7b7e('0x14a')](db[_0x7b7e('0x134')],{});db[_0x7b7e('0x107')][_0x7b7e('0x14a')](db[_0x7b7e('0x106')],{});db[_0x7b7e('0x107')]['belongsTo'](db[_0x7b7e('0x12')],{});db[_0x7b7e('0x108')][_0x7b7e('0x14a')](db['WhatsappMessage'],{});db['WhatsappTransferReport']['belongsTo'](db[_0x7b7e('0x105')],{});db['WhatsappTransferReport'][_0x7b7e('0x14a')](db[_0x7b7e('0x102')],{'foreignKey':_0x7b7e('0x1ef'),'as':_0x7b7e('0x1d7')});db[_0x7b7e('0x108')][_0x7b7e('0x14a')](db[_0x7b7e('0x102')],{'foreignKey':_0x7b7e('0x1f0'),'as':'ToAccount'});db[_0x7b7e('0x108')][_0x7b7e('0x14a')](db['WhatsappQueue'],{'foreignKey':_0x7b7e('0x1f1'),'as':_0x7b7e('0x1dd')});db['WhatsappTransferReport']['belongsTo'](db[_0x7b7e('0x12')],{'foreignKey':_0x7b7e('0x1d8'),'as':_0x7b7e('0x1d9')});db[_0x7b7e('0x108')][_0x7b7e('0x14a')](db['User'],{'foreignKey':_0x7b7e('0x1da'),'as':_0x7b7e('0x1db')});db[_0x7b7e('0x134')][_0x7b7e('0x120')](db['User'],{'as':_0x7b7e('0x151'),'through':_0x7b7e('0x39'),'foreignKey':_0x7b7e('0x1f2')});db[_0x7b7e('0x134')][_0x7b7e('0x120')](db[_0x7b7e('0xe5')],{'through':'team_has_whatsapp_queues','as':'Teams'});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 3ea9841..b84fed7 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfbad=['/api/voice/chanspy','./api/voiceChanSpy','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/screenRecording','./api/voiceMailMessage','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceConfiguration','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','/api/networks','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/auth/local','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/version','./api/system','/api/pm2','./api/webbar','static','join','/apidoc','root','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','/index.html','username','password','newPassword','apiKey','firstName','lastName','phone','mobile','fax','email','clientId','clientSecret','code','accessKey','tenantId','token','channelSecret','accessTokenSecret','authToken','consumerSecret','membername','calleridnum','exten','privateKey','secretaccesskey','key','pass','dsn','secret','oldPassword','isPlainObject','isString','replace','@@{','}@@','includes','path','express','util','./config/environment','./config/logger','api','default','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','user','name','role','inspect','logger','%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)','url','agent_name','test','/api/users','./api/user'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xfbad,0x115));var _0xdfba=function(_0x13588c,_0x289580){_0x13588c=_0x13588c-0x0;var _0x53a0d0=_0xfbad[_0x13588c];return _0x53a0d0;};'use strict';var _=require('lodash');var path=require(_0xdfba('0x0'));var express=require(_0xdfba('0x1'));var ewinston=require('express-winston');var util=require(_0xdfba('0x2'));var errors=require('./errors');var config=require(_0xdfba('0x3'));var logger=require(_0xdfba('0x4'))(_0xdfba('0x5'));var authLogger=require(_0xdfba('0x4'))('auth');exports[_0xdfba('0x6')]=function(_0x297ce6){_0x297ce6[_0xdfba('0x7')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x46e83e,_0x993b4c){var _0x45dca2=_0xdfba('0x8');if(!_[_0xdfba('0x9')](_0x46e83e[_0xdfba('0xa')])){_0x45dca2+='\x20body=%s';var _0x571f47=_0x46e83e[_0xdfba('0xa')];maskSensitiveData(_0x571f47);}return util[_0xdfba('0xb')](_0x45dca2,_0x46e83e[_0xdfba('0xc')],_0x46e83e[_0xdfba('0xd')][_0xdfba('0xe')]?_0x46e83e[_0xdfba('0xd')][_0xdfba('0xe')]:_0x46e83e[_0xdfba('0xf')][_0xdfba('0x10')]||_0x46e83e['ip'],_0x46e83e['url'],_0x993b4c[_0xdfba('0x11')],_0x993b4c[_0xdfba('0x12')],_0x46e83e[_0xdfba('0x13')]?_0x46e83e['user']['id']:null,_0x46e83e[_0xdfba('0x13')]?_0x46e83e[_0xdfba('0x13')][_0xdfba('0x14')]:null,_0x46e83e[_0xdfba('0x13')]?_0x46e83e[_0xdfba('0x13')][_0xdfba('0x15')]:null,_0x571f47?util[_0xdfba('0x16')](_0x571f47,![],null):'');}}));_0x297ce6[_0xdfba('0x7')](ewinston[_0xdfba('0x17')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x54a3f8,_0x225728){var _0x52f131=_0xdfba('0x18');if(_0x54a3f8[_0xdfba('0xa')]&&_0x54a3f8[_0xdfba('0xa')][_0xdfba('0x19')]&&_0x54a3f8['body'][_0xdfba('0x1a')]){_0x52f131=_0xdfba('0x1b');}return util['format'](_0x52f131,_0x54a3f8[_0xdfba('0xc')],_0x54a3f8[_0xdfba('0xd')][_0xdfba('0xe')]?_0x54a3f8[_0xdfba('0xd')][_0xdfba('0xe')]:_0x54a3f8[_0xdfba('0xf')]['remoteAddress']||_0x54a3f8['ip'],_0x54a3f8[_0xdfba('0x1c')],_0x225728[_0xdfba('0x11')],_0x225728['responseTime'],_0x54a3f8['user']?_0x54a3f8[_0xdfba('0x13')]['id']:null,_0x54a3f8['user']?_0x54a3f8['user']['name']:null,_0x54a3f8['user']?_0x54a3f8[_0xdfba('0x13')][_0xdfba('0x15')]:null,_0x54a3f8[_0xdfba('0xa')]&&_0x54a3f8[_0xdfba('0xa')]['device']?_0x54a3f8[_0xdfba('0xa')][_0xdfba('0x19')]:'other',_0x54a3f8[_0xdfba('0xa')]&&_0x54a3f8[_0xdfba('0xa')]['agent_id']?_0x54a3f8[_0xdfba('0xa')][_0xdfba('0x1a')]:'',_0x54a3f8[_0xdfba('0xa')]&&_0x54a3f8[_0xdfba('0xa')][_0xdfba('0x1d')]?_0x54a3f8[_0xdfba('0xa')][_0xdfba('0x1d')]:'');},'ignoreRoute':function(_0x2d5b0a){var _0x2b1572=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2b1572[_0xdfba('0x1e')](_0x2d5b0a[_0xdfba('0x1c')]);}}));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x1f'),require(_0xdfba('0x20')));_0x297ce6['use'](_0xdfba('0x21'),require(_0xdfba('0x22')));_0x297ce6[_0xdfba('0x7')]('/api/voice/contexts',require('./api/voiceContext'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x23'),require('./api/voiceExtension'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x24'),require(_0xdfba('0x25')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x26'),require('./api/voiceQueue'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x27'),require('./api/voiceRecording'));_0x297ce6[_0xdfba('0x7')]('/api/screen/recordings',require(_0xdfba('0x28')));_0x297ce6['use']('/api/voice/mails',require('./api/voiceMail'));_0x297ce6[_0xdfba('0x7')]('/api/voice/mails/messages',require(_0xdfba('0x29')));_0x297ce6[_0xdfba('0x7')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x2a'),require(_0xdfba('0x2b')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x2c'),require(_0xdfba('0x2d')));_0x297ce6[_0xdfba('0x7')]('/api/voice/queues/reports',require(_0xdfba('0x2e')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x2f'),require('./api/memberReport'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x30'),require('./api/trunk'));_0x297ce6[_0xdfba('0x7')]('/api/voice/transfers/reports',require(_0xdfba('0x31')));_0x297ce6['use']('/api/mail/out_servers',require(_0xdfba('0x32')));_0x297ce6['use'](_0xdfba('0x33'),require(_0xdfba('0x34')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x35'),require(_0xdfba('0x36')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x37'),require(_0xdfba('0x38')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x39'),require(_0xdfba('0x3a')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x3b'),require(_0xdfba('0x3c')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x3d'),require(_0xdfba('0x3e')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x3f'),require('./api/mailQueueReport'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x40'),require('./api/dashboard'));_0x297ce6[_0xdfba('0x7')]('/api/dashboards/items',require(_0xdfba('0x41')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x42'),require('./api/faxAccount'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x43'),require(_0xdfba('0x44')));_0x297ce6['use'](_0xdfba('0x45'),require(_0xdfba('0x46')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x47'),require(_0xdfba('0x48')));_0x297ce6['use'](_0xdfba('0x49'),require(_0xdfba('0x4a')));_0x297ce6['use']('/api/fax/reports/queue',require(_0xdfba('0x4b')));_0x297ce6[_0xdfba('0x7')]('/api/sms/accounts',require('./api/smsAccount'));_0x297ce6['use'](_0xdfba('0x4c'),require(_0xdfba('0x4d')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x4e'),require('./api/smsInteraction'));_0x297ce6['use'](_0xdfba('0x4f'),require(_0xdfba('0x50')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x51'),require('./api/smsQueue'));_0x297ce6[_0xdfba('0x7')]('/api/openchannel/accounts',require(_0xdfba('0x52')));_0x297ce6['use'](_0xdfba('0x53'),require(_0xdfba('0x54')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x55'),require(_0xdfba('0x56')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x57'),require('./api/openchannelMessage'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x58'),require(_0xdfba('0x59')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x5a'),require(_0xdfba('0x5b')));_0x297ce6[_0xdfba('0x7')]('/api/openchannel/reports/queue',require(_0xdfba('0x5c')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x5d'),require(_0xdfba('0x5e')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x5f'),require(_0xdfba('0x60')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x61'),require('./api/chatMessage'));_0x297ce6['use'](_0xdfba('0x62'),require(_0xdfba('0x63')));_0x297ce6[_0xdfba('0x7')]('/api/chat/queues',require(_0xdfba('0x64')));_0x297ce6['use'](_0xdfba('0x65'),require('./api/chatGroup'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x66'),require(_0xdfba('0x67')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x68'),require(_0xdfba('0x69')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x6a'),require(_0xdfba('0x6b')));_0x297ce6['use']('/api/cm/hopper',require(_0xdfba('0x6c')));_0x297ce6['use'](_0xdfba('0x6d'),require(_0xdfba('0x6e')));_0x297ce6['use'](_0xdfba('0x6f'),require(_0xdfba('0x70')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x71'),require('./api/cmHopperHistory'));_0x297ce6[_0xdfba('0x7')]('/api/cm/custom_fields',require(_0xdfba('0x72')));_0x297ce6['use']('/api/actions',require(_0xdfba('0x73')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x74'),require(_0xdfba('0x75')));_0x297ce6['use'](_0xdfba('0x76'),require(_0xdfba('0x77')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x78'),require(_0xdfba('0x79')));_0x297ce6[_0xdfba('0x7')]('/api/conditions',require(_0xdfba('0x7a')));_0x297ce6['use']('/api/intervals',require('./api/interval'));_0x297ce6['use'](_0xdfba('0x7b'),require(_0xdfba('0x7c')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x7d'),require(_0xdfba('0x7e')));_0x297ce6['use'](_0xdfba('0x7f'),require(_0xdfba('0x80')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x81'),require(_0xdfba('0x82')));_0x297ce6['use'](_0xdfba('0x83'),require(_0xdfba('0x84')));_0x297ce6['use'](_0xdfba('0x85'),require(_0xdfba('0x86')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x87'),require('./api/template'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x88'),require(_0xdfba('0x89')));_0x297ce6['use']('/api/variables',require(_0xdfba('0x8a')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x8b'),require(_0xdfba('0x8c')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x8d'),require(_0xdfba('0x8e')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x8f'),require(_0xdfba('0x90')));_0x297ce6[_0xdfba('0x7')]('/api/analytics/default_reports',require(_0xdfba('0x91')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x92'),require(_0xdfba('0x93')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x94'),require(_0xdfba('0x95')));_0x297ce6['use'](_0xdfba('0x96'),require('./api/analyticFieldReport'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x97'),require('./api/analyticTreeReport'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x98'),require('./api/intSalesforceAccount'));_0x297ce6[_0xdfba('0x7')]('/api/integrations/salesforce/configurations',require(_0xdfba('0x99')));_0x297ce6[_0xdfba('0x7')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x9a'),require(_0xdfba('0x9b')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x9c'),require('./api/intSugarcrmConfiguration'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x9d'),require(_0xdfba('0x9e')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x9f'),require('./api/intDeskAccount'));_0x297ce6[_0xdfba('0x7')]('/api/integrations/desk/configurations',require(_0xdfba('0xa0')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xa1'),require(_0xdfba('0xa2')));_0x297ce6[_0xdfba('0x7')]('/api/integrations/zoho/accounts',require(_0xdfba('0xa3')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xa4'),require('./api/intZohoConfiguration'));_0x297ce6['use'](_0xdfba('0xa5'),require('./api/intZohoField'));_0x297ce6['use'](_0xdfba('0xa6'),require(_0xdfba('0xa7')));_0x297ce6['use']('/api/integrations/zendesk/configurations',require(_0xdfba('0xa8')));_0x297ce6[_0xdfba('0x7')]('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0x297ce6[_0xdfba('0x7')]('/api/integrations/freshdesk/accounts',require(_0xdfba('0xa9')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xaa'),require('./api/intFreshdeskConfiguration'));_0x297ce6['use']('/api/integrations/freshdesk/fields',require(_0xdfba('0xab')));_0x297ce6['use'](_0xdfba('0xac'),require(_0xdfba('0xad')));_0x297ce6['use'](_0xdfba('0xae'),require('./api/intVtigerConfiguration'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xaf'),require(_0xdfba('0xb0')));_0x297ce6[_0xdfba('0x7')]('/api/integrations/servicenow/accounts',require(_0xdfba('0xb1')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xb2'),require(_0xdfba('0xb3')));_0x297ce6['use'](_0xdfba('0xb4'),require(_0xdfba('0xb5')));_0x297ce6['use'](_0xdfba('0xb6'),require(_0xdfba('0xb7')));_0x297ce6['use'](_0xdfba('0xb8'),require(_0xdfba('0xb9')));_0x297ce6['use']('/api/integrations/dynamics365/fields',require(_0xdfba('0xba')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xbb'),require(_0xdfba('0xbc')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xbd'),require('./api/intFreshsalesConfiguration'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xbe'),require('./api/intFreshsalesField'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xbf'),require('./api/network'));_0x297ce6[_0xdfba('0x7')]('/api/chat/reports/queue',require('./api/chatQueueReport'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xc0'),require(_0xdfba('0xc1')));_0x297ce6[_0xdfba('0x7')]('/api/jscripty/answers/reports',require(_0xdfba('0xc2')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xc3'),require(_0xdfba('0xc4')));_0x297ce6[_0xdfba('0x7')]('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0x297ce6['use'](_0xdfba('0xc5'),require(_0xdfba('0xc6')));_0x297ce6['use'](_0xdfba('0xc7'),require(_0xdfba('0xc8')));_0x297ce6[_0xdfba('0x7')]('/api/square/details/reports',require('./api/squareReportDetail'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xc9'),require('./api/jscriptyProject'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xca'),require(_0xdfba('0xcb')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xcc'),require(_0xdfba('0xcd')));_0x297ce6['use'](_0xdfba('0xce'),require(_0xdfba('0xcf')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xd0'),require(_0xdfba('0xd1')));_0x297ce6[_0xdfba('0x7')]('/api/square/messages',require(_0xdfba('0xd2')));_0x297ce6[_0xdfba('0x7')]('/api/teams',require(_0xdfba('0xd3')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xd4'),require(_0xdfba('0xd5')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xd6'),require('./api/campaign'));_0x297ce6[_0xdfba('0x7')]('/api/migrations',require(_0xdfba('0xd7')));_0x297ce6['use'](_0xdfba('0xd8'),require(_0xdfba('0xd9')));_0x297ce6['use'](_0xdfba('0xda'),require(_0xdfba('0xdb')));_0x297ce6[_0xdfba('0x7')]('/api/mail/reports/transfer',require(_0xdfba('0xdc')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xdd'),require(_0xdfba('0xde')));_0x297ce6[_0xdfba('0x7')]('/api/fax/reports/transfer',require('./api/faxTransferReport'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xdf'),require(_0xdfba('0xe0')));_0x297ce6[_0xdfba('0x7')]('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x297ce6[_0xdfba('0x7')]('/api/cm/lists',require(_0xdfba('0xe1')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xe2'),require(_0xdfba('0xe3')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xe4'),require(_0xdfba('0xe5')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xe6'),require(_0xdfba('0xe7')));_0x297ce6['use'](_0xdfba('0xe8'),require('./api/userProfileResource'));_0x297ce6[_0xdfba('0x7')]('/api/userNotifications',require('./api/userNotification'));_0x297ce6['use'](_0xdfba('0xe9'),require(_0xdfba('0xea')));_0x297ce6['use'](_0xdfba('0xeb'),require(_0xdfba('0xec')));_0x297ce6[_0xdfba('0x7')]('/api/whatsapp/interactions',require(_0xdfba('0xed')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xee'),require(_0xdfba('0xef')));_0x297ce6[_0xdfba('0x7')]('/api/whatsapp/reports/queue',require(_0xdfba('0xf0')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xf1'),require(_0xdfba('0xf2')));_0x297ce6[_0xdfba('0x7')]('/api/whatsapp/queues',require(_0xdfba('0xf3')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xf4'),require(_0xdfba('0xf5')));_0x297ce6['use'](_0xdfba('0xf6'),require(_0xdfba('0xf7')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xf8'),require('./api/authLocal'));_0x297ce6['use'](_0xdfba('0xf9'),require(_0xdfba('0xfa')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xfb'),require(_0xdfba('0xfc')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xfd'),require('./api/rpc'));_0x297ce6['use']('/api/version',require(_0xdfba('0xfe')));_0x297ce6[_0xdfba('0x7')]('/api/system',require(_0xdfba('0xff')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x100'),require('./api/pm2'));_0x297ce6[_0xdfba('0x7')]('/api/webbar',require(_0xdfba('0x101')));_0x297ce6[_0xdfba('0x7')]('/apidoc',express[_0xdfba('0x102')](path[_0xdfba('0x103')](config['root'],_0xdfba('0x104'))));_0x297ce6[_0xdfba('0x7')]('/www',express[_0xdfba('0x102')](path[_0xdfba('0x103')](config[_0xdfba('0x105')],'/www')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x106'),express['static'](path[_0xdfba('0x103')](config['root'],_0xdfba('0x106'))));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x107'),express[_0xdfba('0x102')](path[_0xdfba('0x103')](config['root'],_0xdfba('0x108'),_0xdfba('0x109'))));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x10a'),express[_0xdfba('0x102')](path[_0xdfba('0x103')](config[_0xdfba('0x105')],_0xdfba('0x10b'))));_0x297ce6[_0xdfba('0x10c')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xdfba('0x10d')](errors[0x194]);_0x297ce6['route']('/*')['get'](function(_0x7d3b2f,_0x39c34a){_0x39c34a[_0xdfba('0x10e')](path[_0xdfba('0x10f')](_0x297ce6[_0xdfba('0x10d')](_0xdfba('0x110'))+_0xdfba('0x111')));});};var sensitiveFields=[_0xdfba('0x112'),_0xdfba('0x113'),_0xdfba('0x114'),_0xdfba('0x115'),_0xdfba('0x116'),_0xdfba('0x117'),'street',_0xdfba('0x118'),_0xdfba('0x119'),_0xdfba('0x11a'),_0xdfba('0x11b'),_0xdfba('0x11c'),_0xdfba('0x11d'),'securityToken',_0xdfba('0x11e'),_0xdfba('0x11f'),_0xdfba('0x120'),_0xdfba('0x121'),_0xdfba('0x122'),'accessToken',_0xdfba('0x123'),_0xdfba('0x124'),'consumerKey',_0xdfba('0x125'),_0xdfba('0x126'),'calleridname',_0xdfba('0x127'),_0xdfba('0x128'),'vidaooApiKey','clientEmail',_0xdfba('0x129'),'accesskeyid',_0xdfba('0x12a'),_0xdfba('0x12b'),_0xdfba('0x13'),_0xdfba('0x12c'),'accountSid','localstationid',_0xdfba('0x12d'),_0xdfba('0x12e'),'registry',_0xdfba('0x12f')];function maskSensitiveData(_0x1f98bc){var _0x43115c=/(?!^)[\s\S](?!$)/g;if(!_[_0xdfba('0x130')](_0x1f98bc))return;for(var _0x548a03 in _0x1f98bc){if(_['isArray'](_0x1f98bc[_0x548a03])){for(var _0x242904=0x0;_0x242904<_0x1f98bc[_0x548a03]['length'];_0x242904++){maskSensitiveData(_0x1f98bc[_0x548a03][_0x242904]);}}else if(_[_0xdfba('0x130')](_0x1f98bc[_0x548a03])){maskSensitiveData(_0x1f98bc[_0x548a03]);}else if(_[_0xdfba('0x131')](_0x1f98bc[_0x548a03])){_0x1f98bc[_0x548a03]=_0x1f98bc[_0x548a03][_0xdfba('0x132')](/{{{/g,_0xdfba('0x133'))['replace'](/}}}/g,_0xdfba('0x134'))[_0xdfba('0x132')](/{{/g,'@{')[_0xdfba('0x132')](/}}/g,'}@');if(_[_0xdfba('0x135')](sensitiveFields,_0x548a03)){_0x1f98bc[_0x548a03]=_0x1f98bc[_0x548a03]['replace'](_0x43115c,'*');}}}} \ No newline at end of file +var _0xdafb=['./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','./api/template','/api/triggers','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/auth/local','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','/api/version','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','/www','root','/demo','3.0.0','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','/index.html','username','password','newPassword','apiKey','firstName','lastName','street','fax','email','clientId','clientSecret','securityToken','accessKey','tenantId','token','accessToken','authToken','consumerKey','consumerSecret','calleridname','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','key','pass','localstationid','dsn','secret','registry','isPlainObject','isArray','length','isString','replace','@@{','includes','lodash','express','./errors','./config/environment','api','./config/logger','auth','default','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','method','headers','x-forwarded-for','connection','statusCode','responseTime','user','role','inspect','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','remoteAddress','url','name','other','agent_name','use','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/action'];(function(_0x596386,_0x4e2ca2){var _0x62bc0d=function(_0x412ce2){while(--_0x412ce2){_0x596386['push'](_0x596386['shift']());}};_0x62bc0d(++_0x4e2ca2);}(_0xdafb,0xd1));var _0xbdaf=function(_0x51e91f,_0x4cf0c9){_0x51e91f=_0x51e91f-0x0;var _0x5a40ba=_0xdafb[_0x51e91f];return _0x5a40ba;};'use strict';var _=require(_0xbdaf('0x0'));var path=require('path');var express=require(_0xbdaf('0x1'));var ewinston=require('express-winston');var util=require('util');var errors=require(_0xbdaf('0x2'));var config=require(_0xbdaf('0x3'));var logger=require('./config/logger')(_0xbdaf('0x4'));var authLogger=require(_0xbdaf('0x5'))(_0xbdaf('0x6'));exports[_0xbdaf('0x7')]=function(_0x1a536f){_0x1a536f['use'](ewinston[_0xbdaf('0x8')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x220b3c,_0x3acec4){var _0x525490=_0xbdaf('0x9');if(!_[_0xbdaf('0xa')](_0x220b3c[_0xbdaf('0xb')])){_0x525490+=_0xbdaf('0xc');var _0x3eb207=_0x220b3c[_0xbdaf('0xb')];maskSensitiveData(_0x3eb207);}return util['format'](_0x525490,_0x220b3c[_0xbdaf('0xd')],_0x220b3c[_0xbdaf('0xe')][_0xbdaf('0xf')]?_0x220b3c['headers']['x-forwarded-for']:_0x220b3c[_0xbdaf('0x10')]['remoteAddress']||_0x220b3c['ip'],_0x220b3c['url'],_0x3acec4[_0xbdaf('0x11')],_0x3acec4[_0xbdaf('0x12')],_0x220b3c['user']?_0x220b3c[_0xbdaf('0x13')]['id']:null,_0x220b3c[_0xbdaf('0x13')]?_0x220b3c[_0xbdaf('0x13')]['name']:null,_0x220b3c[_0xbdaf('0x13')]?_0x220b3c[_0xbdaf('0x13')][_0xbdaf('0x14')]:null,_0x3eb207?util[_0xbdaf('0x15')](_0x3eb207,![],null):'');}}));_0x1a536f['use'](ewinston[_0xbdaf('0x8')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x4509b5,_0x1dc0dc){var _0x3c4b87='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x4509b5[_0xbdaf('0xb')]&&_0x4509b5[_0xbdaf('0xb')]['device']&&_0x4509b5['body'][_0xbdaf('0x16')]){_0x3c4b87=_0xbdaf('0x17');}return util[_0xbdaf('0x18')](_0x3c4b87,_0x4509b5[_0xbdaf('0xd')],_0x4509b5[_0xbdaf('0xe')][_0xbdaf('0xf')]?_0x4509b5['headers'][_0xbdaf('0xf')]:_0x4509b5[_0xbdaf('0x10')][_0xbdaf('0x19')]||_0x4509b5['ip'],_0x4509b5[_0xbdaf('0x1a')],_0x1dc0dc['statusCode'],_0x1dc0dc[_0xbdaf('0x12')],_0x4509b5[_0xbdaf('0x13')]?_0x4509b5[_0xbdaf('0x13')]['id']:null,_0x4509b5[_0xbdaf('0x13')]?_0x4509b5[_0xbdaf('0x13')][_0xbdaf('0x1b')]:null,_0x4509b5['user']?_0x4509b5[_0xbdaf('0x13')][_0xbdaf('0x14')]:null,_0x4509b5[_0xbdaf('0xb')]&&_0x4509b5[_0xbdaf('0xb')]['device']?_0x4509b5[_0xbdaf('0xb')]['device']:_0xbdaf('0x1c'),_0x4509b5['body']&&_0x4509b5[_0xbdaf('0xb')]['agent_id']?_0x4509b5['body'][_0xbdaf('0x16')]:'',_0x4509b5[_0xbdaf('0xb')]&&_0x4509b5['body']['agent_name']?_0x4509b5[_0xbdaf('0xb')][_0xbdaf('0x1d')]:'');},'ignoreRoute':function(_0x21f305){var _0x48d8b4=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x48d8b4['test'](_0x21f305[_0xbdaf('0x1a')]);}}));_0x1a536f[_0xbdaf('0x1e')]('/api/users',require(_0xbdaf('0x1f')));_0x1a536f['use'](_0xbdaf('0x20'),require(_0xbdaf('0x21')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x22'),require(_0xbdaf('0x23')));_0x1a536f[_0xbdaf('0x1e')]('/api/voice/extensions',require('./api/voiceExtension'));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x24'),require(_0xbdaf('0x25')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x26'),require(_0xbdaf('0x27')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x28'),require(_0xbdaf('0x29')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x2a'),require('./api/screenRecording'));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x2b'),require(_0xbdaf('0x2c')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x2d'),require('./api/voiceMailMessage'));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x2e'),require(_0xbdaf('0x2f')));_0x1a536f[_0xbdaf('0x1e')]('/api/voice/dials/reports',require('./api/voiceDialReport'));_0x1a536f[_0xbdaf('0x1e')]('/api/voice/agents/reports',require(_0xbdaf('0x30')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x31'),require(_0xbdaf('0x32')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x33'),require(_0xbdaf('0x34')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x35'),require(_0xbdaf('0x36')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x37'),require(_0xbdaf('0x38')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x39'),require('./api/mailServerOut'));_0x1a536f['use'](_0xbdaf('0x3a'),require(_0xbdaf('0x3b')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x3c'),require(_0xbdaf('0x3d')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x3e'),require(_0xbdaf('0x3f')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x40'),require(_0xbdaf('0x41')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x42'),require(_0xbdaf('0x43')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x44'),require(_0xbdaf('0x45')));_0x1a536f['use'](_0xbdaf('0x46'),require(_0xbdaf('0x47')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x48'),require(_0xbdaf('0x49')));_0x1a536f['use'](_0xbdaf('0x4a'),require('./api/dashboardItem'));_0x1a536f[_0xbdaf('0x1e')]('/api/fax/accounts',require('./api/faxAccount'));_0x1a536f[_0xbdaf('0x1e')]('/api/fax/applications',require(_0xbdaf('0x4b')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x4c'),require('./api/faxInteraction'));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x4d'),require(_0xbdaf('0x4e')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x4f'),require(_0xbdaf('0x50')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x51'),require(_0xbdaf('0x52')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x53'),require(_0xbdaf('0x54')));_0x1a536f[_0xbdaf('0x1e')]('/api/sms/applications',require(_0xbdaf('0x55')));_0x1a536f['use'](_0xbdaf('0x56'),require(_0xbdaf('0x57')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x58'),require('./api/smsMessage'));_0x1a536f['use']('/api/sms/queues',require(_0xbdaf('0x59')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x5a'),require('./api/openchannelAccount'));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x5b'),require(_0xbdaf('0x5c')));_0x1a536f[_0xbdaf('0x1e')]('/api/openchannel/interactions',require(_0xbdaf('0x5d')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x5e'),require('./api/openchannelMessage'));_0x1a536f[_0xbdaf('0x1e')]('/api/openchannel/queues',require(_0xbdaf('0x5f')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x60'),require(_0xbdaf('0x61')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x62'),require('./api/openchannelQueueReport'));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x63'),require(_0xbdaf('0x64')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x65'),require(_0xbdaf('0x66')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x67'),require('./api/chatMessage'));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x68'),require(_0xbdaf('0x69')));_0x1a536f[_0xbdaf('0x1e')]('/api/chat/queues',require(_0xbdaf('0x6a')));_0x1a536f[_0xbdaf('0x1e')]('/api/chat/groups',require(_0xbdaf('0x6b')));_0x1a536f['use'](_0xbdaf('0x6c'),require(_0xbdaf('0x6d')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x6e'),require('./api/cmCompany'));_0x1a536f['use'](_0xbdaf('0x6f'),require(_0xbdaf('0x70')));_0x1a536f[_0xbdaf('0x1e')]('/api/cm/hopper',require('./api/cmHopper'));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x71'),require(_0xbdaf('0x72')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x73'),require(_0xbdaf('0x74')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x75'),require(_0xbdaf('0x76')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x77'),require('./api/cmCustomField'));_0x1a536f['use'](_0xbdaf('0x78'),require(_0xbdaf('0x79')));_0x1a536f[_0xbdaf('0x1e')]('/api/automations',require(_0xbdaf('0x7a')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x7b'),require(_0xbdaf('0x7c')));_0x1a536f['use'](_0xbdaf('0x7d'),require(_0xbdaf('0x7e')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x7f'),require(_0xbdaf('0x80')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x81'),require(_0xbdaf('0x82')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x83'),require('./api/pause'));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x84'),require(_0xbdaf('0x85')));_0x1a536f['use'](_0xbdaf('0x86'),require(_0xbdaf('0x87')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x88'),require(_0xbdaf('0x89')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x8a'),require(_0xbdaf('0x8b')));_0x1a536f['use'](_0xbdaf('0x8c'),require(_0xbdaf('0x8d')));_0x1a536f[_0xbdaf('0x1e')]('/api/templates',require(_0xbdaf('0x8e')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x8f'),require('./api/trigger'));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x90'),require(_0xbdaf('0x91')));_0x1a536f[_0xbdaf('0x1e')]('/api/integrations',require(_0xbdaf('0x92')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x93'),require('./api/integrationReport'));_0x1a536f[_0xbdaf('0x1e')]('/api/analytics/custom_reports',require(_0xbdaf('0x94')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x95'),require(_0xbdaf('0x96')));_0x1a536f[_0xbdaf('0x1e')]('/api/analytics/extracted_reports',require(_0xbdaf('0x97')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x98'),require(_0xbdaf('0x99')));_0x1a536f[_0xbdaf('0x1e')]('/api/analytics/field_reports',require(_0xbdaf('0x9a')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x9b'),require(_0xbdaf('0x9c')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x9d'),require('./api/intSalesforceAccount'));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x9e'),require('./api/intSalesforceConfiguration'));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x9f'),require('./api/intSalesforceField'));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xa0'),require(_0xbdaf('0xa1')));_0x1a536f['use'](_0xbdaf('0xa2'),require('./api/intSugarcrmConfiguration'));_0x1a536f['use']('/api/integrations/sugarcrm/fields',require(_0xbdaf('0xa3')));_0x1a536f['use'](_0xbdaf('0xa4'),require(_0xbdaf('0xa5')));_0x1a536f[_0xbdaf('0x1e')]('/api/integrations/desk/configurations',require(_0xbdaf('0xa6')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xa7'),require(_0xbdaf('0xa8')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xa9'),require(_0xbdaf('0xaa')));_0x1a536f['use'](_0xbdaf('0xab'),require(_0xbdaf('0xac')));_0x1a536f['use'](_0xbdaf('0xad'),require(_0xbdaf('0xae')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xaf'),require('./api/intZendeskAccount'));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xb0'),require('./api/intZendeskConfiguration'));_0x1a536f['use'](_0xbdaf('0xb1'),require(_0xbdaf('0xb2')));_0x1a536f['use']('/api/integrations/freshdesk/accounts',require(_0xbdaf('0xb3')));_0x1a536f['use'](_0xbdaf('0xb4'),require(_0xbdaf('0xb5')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xb6'),require('./api/intFreshdeskField'));_0x1a536f[_0xbdaf('0x1e')]('/api/integrations/vtiger/accounts',require(_0xbdaf('0xb7')));_0x1a536f[_0xbdaf('0x1e')]('/api/integrations/vtiger/configurations',require(_0xbdaf('0xb8')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xb9'),require(_0xbdaf('0xba')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xbb'),require(_0xbdaf('0xbc')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xbd'),require(_0xbdaf('0xbe')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xbf'),require(_0xbdaf('0xc0')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xc1'),require(_0xbdaf('0xc2')));_0x1a536f['use'](_0xbdaf('0xc3'),require('./api/intDynamics365Configuration'));_0x1a536f[_0xbdaf('0x1e')]('/api/integrations/dynamics365/fields',require('./api/intDynamics365Field'));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xc4'),require('./api/intFreshsalesAccount'));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xc5'),require('./api/intFreshsalesConfiguration'));_0x1a536f['use']('/api/integrations/freshsales/fields',require(_0xbdaf('0xc6')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xc7'),require(_0xbdaf('0xc8')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xc9'),require(_0xbdaf('0xca')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xcb'),require(_0xbdaf('0xcc')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xcd'),require('./api/jscriptyAnswerReport'));_0x1a536f[_0xbdaf('0x1e')]('/api/jscripty/questions/reports',require(_0xbdaf('0xce')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xcf'),require(_0xbdaf('0xd0')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xd1'),require(_0xbdaf('0xd2')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xd3'),require(_0xbdaf('0xd4')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xd5'),require(_0xbdaf('0xd6')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xd7'),require(_0xbdaf('0xd8')));_0x1a536f['use'](_0xbdaf('0xd9'),require(_0xbdaf('0xda')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xdb'),require(_0xbdaf('0xdc')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xdd'),require(_0xbdaf('0xde')));_0x1a536f['use'](_0xbdaf('0xdf'),require(_0xbdaf('0xe0')));_0x1a536f['use'](_0xbdaf('0xe1'),require(_0xbdaf('0xe2')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xe3'),require(_0xbdaf('0xe4')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xe5'),require('./api/license'));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xe6'),require(_0xbdaf('0xe7')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xe8'),require(_0xbdaf('0xe9')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xea'),require(_0xbdaf('0xeb')));_0x1a536f[_0xbdaf('0x1e')]('/api/plugins',require(_0xbdaf('0xec')));_0x1a536f[_0xbdaf('0x1e')]('/api/mail/reports/transfer',require(_0xbdaf('0xed')));_0x1a536f['use'](_0xbdaf('0xee'),require(_0xbdaf('0xef')));_0x1a536f[_0xbdaf('0x1e')]('/api/fax/reports/transfer',require(_0xbdaf('0xf0')));_0x1a536f['use'](_0xbdaf('0xf1'),require(_0xbdaf('0xf2')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xf3'),require(_0xbdaf('0xf4')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xf5'),require('./api/cmList'));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xf6'),require(_0xbdaf('0xf7')));_0x1a536f['use'](_0xbdaf('0xf8'),require(_0xbdaf('0xf9')));_0x1a536f['use']('/api/userProfile/sections',require(_0xbdaf('0xfa')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xfb'),require(_0xbdaf('0xfc')));_0x1a536f[_0xbdaf('0x1e')]('/api/userNotifications',require('./api/userNotification'));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0xfd'),require(_0xbdaf('0xfe')));_0x1a536f[_0xbdaf('0x1e')]('/api/whatsapp/applications',require(_0xbdaf('0xff')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x100'),require('./api/whatsappInteraction'));_0x1a536f['use'](_0xbdaf('0x101'),require(_0xbdaf('0x102')));_0x1a536f[_0xbdaf('0x1e')]('/api/whatsapp/reports/queue',require(_0xbdaf('0x103')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x104'),require(_0xbdaf('0x105')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x106'),require(_0xbdaf('0x107')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x108'),require(_0xbdaf('0x109')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x10a'),require(_0xbdaf('0x10b')));_0x1a536f['use'](_0xbdaf('0x10c'),require('./api/authLocal'));_0x1a536f['use'](_0xbdaf('0x10d'),require(_0xbdaf('0x10e')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x10f'),require(_0xbdaf('0x110')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x111'),require('./api/rpc'));_0x1a536f['use'](_0xbdaf('0x112'),require('./api/version'));_0x1a536f[_0xbdaf('0x1e')]('/api/system',require(_0xbdaf('0x113')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x114'),require(_0xbdaf('0x115')));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x116'),require(_0xbdaf('0x117')));_0x1a536f['use'](_0xbdaf('0x118'),express[_0xbdaf('0x119')](path[_0xbdaf('0x11a')](config['root'],_0xbdaf('0x118'))));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x11b'),express[_0xbdaf('0x119')](path[_0xbdaf('0x11a')](config[_0xbdaf('0x11c')],_0xbdaf('0x11b'))));_0x1a536f[_0xbdaf('0x1e')](_0xbdaf('0x11d'),express[_0xbdaf('0x119')](path[_0xbdaf('0x11a')](config[_0xbdaf('0x11c')],_0xbdaf('0x11d'))));_0x1a536f[_0xbdaf('0x1e')]('/snippet',express[_0xbdaf('0x119')](path[_0xbdaf('0x11a')](config[_0xbdaf('0x11c')],'snippet',_0xbdaf('0x11e'))));_0x1a536f['use'](_0xbdaf('0x11f'),express['static'](path[_0xbdaf('0x11a')](config['root'],'/server/files/plugins')));_0x1a536f[_0xbdaf('0x120')](_0xbdaf('0x121'))[_0xbdaf('0x122')](errors[0x194]);_0x1a536f[_0xbdaf('0x120')]('/*')['get'](function(_0x2dcdab,_0x25ef8c){_0x25ef8c[_0xbdaf('0x123')](path['resolve'](_0x1a536f[_0xbdaf('0x122')]('appPath')+_0xbdaf('0x124')));});};var sensitiveFields=[_0xbdaf('0x125'),_0xbdaf('0x126'),_0xbdaf('0x127'),_0xbdaf('0x128'),_0xbdaf('0x129'),_0xbdaf('0x12a'),_0xbdaf('0x12b'),'phone','mobile',_0xbdaf('0x12c'),_0xbdaf('0x12d'),_0xbdaf('0x12e'),_0xbdaf('0x12f'),_0xbdaf('0x130'),'code',_0xbdaf('0x131'),_0xbdaf('0x132'),_0xbdaf('0x133'),'channelSecret',_0xbdaf('0x134'),'accessTokenSecret',_0xbdaf('0x135'),_0xbdaf('0x136'),_0xbdaf('0x137'),'membername',_0xbdaf('0x138'),'calleridnum',_0xbdaf('0x139'),_0xbdaf('0x13a'),_0xbdaf('0x13b'),_0xbdaf('0x13c'),_0xbdaf('0x13d'),'secretaccesskey',_0xbdaf('0x13e'),_0xbdaf('0x13'),_0xbdaf('0x13f'),'accountSid',_0xbdaf('0x140'),_0xbdaf('0x141'),_0xbdaf('0x142'),_0xbdaf('0x143'),'oldPassword'];function maskSensitiveData(_0x5431bb){var _0x430a15=/(?!^)[\s\S](?!$)/g;if(!_[_0xbdaf('0x144')](_0x5431bb))return;for(var _0x137c6c in _0x5431bb){if(_[_0xbdaf('0x145')](_0x5431bb[_0x137c6c])){for(var _0x2c75e0=0x0;_0x2c75e0<_0x5431bb[_0x137c6c][_0xbdaf('0x146')];_0x2c75e0++){maskSensitiveData(_0x5431bb[_0x137c6c][_0x2c75e0]);}}else if(_[_0xbdaf('0x144')](_0x5431bb[_0x137c6c])){maskSensitiveData(_0x5431bb[_0x137c6c]);}else if(_[_0xbdaf('0x147')](_0x5431bb[_0x137c6c])){_0x5431bb[_0x137c6c]=_0x5431bb[_0x137c6c][_0xbdaf('0x148')](/{{{/g,_0xbdaf('0x149'))[_0xbdaf('0x148')](/}}}/g,'}@@')[_0xbdaf('0x148')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0xbdaf('0x14a')](sensitiveFields,_0x137c6c)){_0x5431bb[_0x137c6c]=_0x5431bb[_0x137c6c][_0xbdaf('0x148')](_0x430a15,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index da09628..657613d 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x09f9=['../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.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/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.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','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','bluebird','lodash','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc'];(function(_0x5823a7,_0x3cc2d7){var _0x4f1d86=function(_0x26ff02){while(--_0x26ff02){_0x5823a7['push'](_0x5823a7['shift']());}};_0x4f1d86(++_0x3cc2d7);}(_0x09f9,0x1f2));var _0x909f=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x09f9[_0x24259d];return _0x5a701;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x909f('0x0'));var _=require(_0x909f('0x1'));var config=require('../config/environment');exports[_0x909f('0x2')]=function(){return new BPromise(function(_0x1a7e93,_0x115aa5){var _0xf316b4={};_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x4')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x5')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require('../api/voiceQueue/voiceQueue.rpc'));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x6')));_0xf316b4=_['merge'](_0xf316b4,require('../api/voiceCallReport/voiceCallReport.rpc'));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x7')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x8')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x9')));_0xf316b4=_['merge'](_0xf316b4,require(_0x909f('0xa')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0xb')));_0xf316b4=_['merge'](_0xf316b4,require(_0x909f('0xc')));_0xf316b4=_['merge'](_0xf316b4,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require('../api/mailServerIn/mailServerIn.rpc'));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0xd')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0xe')));_0xf316b4=_['merge'](_0xf316b4,require(_0x909f('0xf')));_0xf316b4=_['merge'](_0xf316b4,require(_0x909f('0x10')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x11')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require('../api/mailQueueReport/mailQueueReport.rpc'));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x12')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x13')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x14')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x15')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x16')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x17')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x18')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x19')));_0xf316b4=_['merge'](_0xf316b4,require(_0x909f('0x1a')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x1b')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x1c')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x1d')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x1e')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x1f')));_0xf316b4=_['merge'](_0xf316b4,require(_0x909f('0x20')));_0xf316b4=_['merge'](_0xf316b4,require(_0x909f('0x21')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x22')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x23')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x24')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x25')));_0xf316b4=_['merge'](_0xf316b4,require(_0x909f('0x26')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x27')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x28')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require('../api/interval/interval.rpc'));_0xf316b4=_['merge'](_0xf316b4,require(_0x909f('0x29')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x2a')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require('../api/template/template.rpc'));_0xf316b4=_['merge'](_0xf316b4,require('../api/trigger/trigger.rpc'));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x2b')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x2c')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x2d')));_0xf316b4=_['merge'](_0xf316b4,require(_0x909f('0x2e')));_0xf316b4=_['merge'](_0xf316b4,require(_0x909f('0x2f')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x30')));_0xf316b4=_['merge'](_0xf316b4,require(_0x909f('0x31')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x32')));_0xf316b4=_['merge'](_0xf316b4,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x33')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x34')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x35')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require('../api/squareReport/squareReport.rpc'));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require('../api/squareReportDetail/squareReportDetail.rpc'));_0xf316b4=_['merge'](_0xf316b4,require('../api/setting/setting.rpc'));_0xf316b4=_['merge'](_0xf316b4,require('../api/squareOdbc/squareOdbc.rpc'));_0xf316b4=_['merge'](_0xf316b4,require(_0x909f('0x36')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x37')));_0xf316b4=_['merge'](_0xf316b4,require('../api/squareMessage/squareMessage.rpc'));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x38')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require('../api/attachment/attachment.rpc'));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x39')));_0xf316b4=_['merge'](_0xf316b4,require(_0x909f('0x3a')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x3b')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x3c')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x3d')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x3e')));var _0x193e95=jayson[_0x909f('0x3f')](_0xf316b4)[_0x909f('0x40')]();var _0xf591b9=config[_0x909f('0x41')]['port']||config[_0x909f('0x42')]+0x1;var _0x33cce7=config[_0x909f('0x41')]['ip']||_0x909f('0x43');_0x193e95['on'](_0x909f('0x44'),function(_0x3c610a){return _0x115aa5(_0x3c610a);});_0x193e95[_0x909f('0x2')](_0xf591b9,_0x33cce7,function(){console['log'](_0x909f('0x45'),_0x33cce7,_0xf591b9);require(_0x909f('0x46'))['default']();return _0x1a7e93(_0x909f('0x47')+_0x33cce7+':'+_0xf591b9);});});}; \ No newline at end of file +var _0x0f39=['../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','port','rpc','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.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/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x0f39,0x17f));var _0x90f3=function(_0x1838e6,_0x52ee23){_0x1838e6=_0x1838e6-0x0;var _0x2a7624=_0x0f39[_0x1838e6];return _0x2a7624;};'use strict';var jayson=require(_0x90f3('0x0'));var BPromise=require(_0x90f3('0x1'));var _=require(_0x90f3('0x2'));var config=require(_0x90f3('0x3'));exports[_0x90f3('0x4')]=function(){return new BPromise(function(_0x379c40,_0x41558d){var _0x56443d={};_0x56443d=_[_0x90f3('0x5')](_0x56443d,require('../api/user/user.rpc'));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x6')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x7')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x8')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x9')));_0x56443d=_['merge'](_0x56443d,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0xa')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require('../api/memberReport/memberReport.rpc'));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0xb')));_0x56443d=_['merge'](_0x56443d,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0xc')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0xd')));_0x56443d=_['merge'](_0x56443d,require(_0x90f3('0xe')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0xf')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require('../api/mailInteraction/mailInteraction.rpc'));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x10')));_0x56443d=_['merge'](_0x56443d,require(_0x90f3('0x11')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require('../api/faxAccount/faxAccount.rpc'));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x12')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x13')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x14')));_0x56443d=_['merge'](_0x56443d,require(_0x90f3('0x15')));_0x56443d=_['merge'](_0x56443d,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x16')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x17')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x18')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x19')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x1a')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x1b')));_0x56443d=_['merge'](_0x56443d,require(_0x90f3('0x1c')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x1d')));_0x56443d=_['merge'](_0x56443d,require(_0x90f3('0x1e')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x1f')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x20')));_0x56443d=_['merge'](_0x56443d,require(_0x90f3('0x21')));_0x56443d=_['merge'](_0x56443d,require('../api/cmContact/cmContact.rpc'));_0x56443d=_['merge'](_0x56443d,require(_0x90f3('0x22')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x23')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x24')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x56443d=_['merge'](_0x56443d,require(_0x90f3('0x25')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x26')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x27')));_0x56443d=_['merge'](_0x56443d,require(_0x90f3('0x28')));_0x56443d=_['merge'](_0x56443d,require(_0x90f3('0x29')));_0x56443d=_['merge'](_0x56443d,require(_0x90f3('0x2a')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x2b')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x2c')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x2d')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x2e')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x2f')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x30')));_0x56443d=_['merge'](_0x56443d,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x31')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x32')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x33')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x34')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x35')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require('../api/squareReport/squareReport.rpc'));_0x56443d=_['merge'](_0x56443d,require(_0x90f3('0x36')));_0x56443d=_['merge'](_0x56443d,require('../api/setting/setting.rpc'));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x37')));_0x56443d=_['merge'](_0x56443d,require(_0x90f3('0x38')));_0x56443d=_['merge'](_0x56443d,require(_0x90f3('0x39')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x3a')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x3b')));_0x56443d=_['merge'](_0x56443d,require('../api/attachment/attachment.rpc'));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x3c')));_0x56443d=_['merge'](_0x56443d,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x3d')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x3e')));_0x56443d=_['merge'](_0x56443d,require(_0x90f3('0x3f')));_0x56443d=_[_0x90f3('0x5')](_0x56443d,require(_0x90f3('0x40')));var _0x17e1bb=jayson['server'](_0x56443d)[_0x90f3('0x41')]();var _0x8d9085=config['rpc'][_0x90f3('0x42')]||config['port']+0x1;var _0x416c85=config[_0x90f3('0x43')]['ip']||_0x90f3('0x44');_0x17e1bb['on'](_0x90f3('0x45'),function(_0x24fdc0){return _0x41558d(_0x24fdc0);});_0x17e1bb[_0x90f3('0x4')](_0x8d9085,_0x416c85,function(){console[_0x90f3('0x46')](_0x90f3('0x47'),_0x416c85,_0x8d9085);require(_0x90f3('0x48'))[_0x90f3('0x49')]();return _0x379c40('RPC\x20listening\x20on\x20'+_0x416c85+':'+_0x8d9085);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index f3dca50..580d749 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 _0xb657=['recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','label','exports','util','lodash','events','EventEmitter','./error','call','utf8','setTimeout','setEncoding','emit','line','toLowerCase','hangup','substring','520\x20End\x20of\x20proper','no\x20code','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','command','function','write','inherits','prototype','sendRequest','sync','ANSWER','getData','beep','format','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setContext','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22'];(function(_0x4f8f3b,_0x43281b){var _0x4c250c=function(_0x19a7ff){while(--_0x19a7ff){_0x4f8f3b['push'](_0x4f8f3b['shift']());}};_0x4c250c(++_0x43281b);}(_0xb657,0x150));var _0x7b65=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0xb657[_0x1573ea];return _0x51c0e2;};'use strict';var util=require(_0x7b65('0x0'));var _=require(_0x7b65('0x1'));var EventEmitter=require(_0x7b65('0x2'))[_0x7b65('0x3')];var AGIReply=require('./reply');var AGIError=require(_0x7b65('0x4'));function AGIChannel(_0x11b3d4){var _0x1489f0=this,_0x1ba76f=new AGIReply(),_0x1f5805=![],_0x3616d1={};EventEmitter[_0x7b65('0x5')](_0x1489f0);_0x11b3d4['setEncoding'](_0x7b65('0x6'));_0x11b3d4[_0x7b65('0x7')](0x8*0x3c*0x3c*0x3e8);_0x1ba76f[_0x7b65('0x8')](_0x7b65('0x6'));_0x1ba76f['on']('headers',function(_0x1e3457){for(var _0x26eb78 in _0x1e3457){_0x1489f0[_0x26eb78]=_0x1e3457[_0x26eb78];}_0x1489f0[_0x7b65('0x9')]('ready');});_0x1ba76f['on'](_0x7b65('0xa'),function(_0x414202){if(_0x414202[_0x7b65('0xb')]()==_0x7b65('0xc')){_0x1489f0[_0x7b65('0x9')]('hangup');return;}if(_0x414202[_0x7b65('0xd')](0x0,0xb)=='520-Invalid'){_0x1f5805=!![];}if(_0x1f5805){_0x3616d1['rx']+=_0x414202+'\x0a';if(_0x414202['search'](_0x7b65('0xe'))!=-0x1){_0x1f5805=![];}}else{_0x3616d1['rx']=_0x414202;}if(_0x1f5805){return;}if(typeof _0x3616d1['cb']=='function'){var _0x454263=_0x3616d1['rx'][_0x7b65('0xd')](0x0,0x3),_0x356103=null,_0x3c86a4=null;_0x454263=parseInt(_0x454263);if(isNaN(_0x454263)){_0x3616d1['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x7b65('0xf')});return;}if(_0x454263!=0xc8){_0x3616d1['cb'](null,{'code':_0x454263,'result':-0x1,'extra':'KO'});return;}_0x356103=_0x3616d1['rx']['substring'](0x4)['replace']('result=','');if(_0x356103[_0x7b65('0x10')]('\x20')!=-0x1){_0x356103=_0x356103['substr'](0x0,_0x356103['indexOf']('\x20'));}if(_[_0x7b65('0x11')](_0x356103,'-1')){_0x356103=parseInt(_0x356103);}_0x3c86a4=_0x3616d1['rx'][_0x7b65('0x12')]('\x20');if(_0x3c86a4[_0x7b65('0x13')]==0x3){_0x3c86a4=_0x3c86a4[0x2][_0x7b65('0xd')](0x1,_0x3c86a4[0x2][_0x7b65('0x13')]-0x1);}else if(_0x3c86a4[_0x7b65('0x13')]>0x3){var _0x39d1a3=/\((.+)\)/;var _0x9a878e=_0x3616d1['rx'][_0x7b65('0x14')](_0x39d1a3);if(_0x9a878e){_0x3c86a4=_0x9a878e[0x1];}else{_0x3c86a4=null;}}else{_0x3c86a4=null;}_0x3616d1['cb'](null,{'code':_0x454263,'result':_0x356103,'extra':_0x3c86a4});}});_0x11b3d4['on'](_0x7b65('0x15'),function(_0x3e7a97){_0x1489f0[_0x7b65('0x9')]('error',new AGIError(_0x7b65('0x16'),_0x3e7a97[_0x7b65('0x17')]));});_0x11b3d4['on'](_0x7b65('0x18'),function(){_0x1489f0[_0x7b65('0x9')]('close',new AGIError(_0x7b65('0x19')));});_0x11b3d4['on'](_0x7b65('0x1a'),function(){_0x1489f0[_0x7b65('0x9')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x11b3d4[_0x7b65('0x1b')]();});_0x11b3d4[_0x7b65('0x1c')](_0x1ba76f);this[_0x7b65('0x1d')]=function(_0x4353cb,_0x28add0){var _0x4353cb=_0x4353cb||'',_0x28add0=typeof _0x28add0==_0x7b65('0x1e')?_0x28add0:new Function();_0x3616d1={'tx':_0x4353cb,'rx':'','cb':_0x28add0};_0x11b3d4[_0x7b65('0x1f')](_0x4353cb+'\x0a');},this[_0x7b65('0x18')]=function(){_0x11b3d4[_0x7b65('0x1b')]();};}util[_0x7b65('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x7b65('0x21')][_0x7b65('0x22')]=function(_0x1789db){return this[_0x7b65('0x1d')][_0x7b65('0x23')](this,_0x1789db);};AGIChannel[_0x7b65('0x21')]['answer']=function(){return this[_0x7b65('0x22')](_0x7b65('0x24'));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x25')]=function(_0x48b6eb,_0x5a6cf6,_0x184e76){_0x48b6eb=_0x48b6eb===undefined?_0x7b65('0x26'):_0x48b6eb;_0x5a6cf6=_0x5a6cf6===undefined?'5':_0x5a6cf6;_0x184e76=_0x184e76===undefined?'1':_0x184e76;return this[_0x7b65('0x22')](util[_0x7b65('0x27')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x48b6eb,_0x5a6cf6*0x3e8,_0x184e76));};AGIChannel['prototype'][_0x7b65('0x28')]=function(_0x4a6408){_0x4a6408=_0x4a6408||_0x7b65('0x29');return this['sendRequest'](util[_0x7b65('0x27')](_0x7b65('0x2a'),_0x4a6408));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x2b')]=function(_0x3ebfce,_0x216c88){if(_[_0x7b65('0x2c')](_0x216c88)){return this[_0x7b65('0x22')](util[_0x7b65('0x27')](_0x7b65('0x2d'),_0x3ebfce,_0x216c88[_0x7b65('0x2e')](',')));}return this[_0x7b65('0x22')](util[_0x7b65('0x27')](_0x7b65('0x2d'),_0x3ebfce,_0x216c88));};AGIChannel[_0x7b65('0x21')]['setContext']=function(_0x49e3eb){return this[_0x7b65('0x22')](util['format']('SET\x20CONTEXT\x20%s',_0x49e3eb));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x2f')]=function(_0x3be95){return this['sendRequest'](util[_0x7b65('0x27')](_0x7b65('0x30'),_0x3be95));};AGIChannel['prototype'][_0x7b65('0x31')]=function(_0x339bf9){return this[_0x7b65('0x22')](util['format'](_0x7b65('0x32'),_0x339bf9));};AGIChannel[_0x7b65('0x21')][_0x7b65('0xc')]=function(){return this[_0x7b65('0x22')](_0x7b65('0x33'));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x34')]=function(_0x23e9b7,_0x467f29){var _0x136e27=_[_0x7b65('0x35')](_0x467f29)||_[_0x7b65('0x36')](_0x467f29)?_0x467f29[_0x7b65('0x37')]():_0x467f29;return this[_0x7b65('0x22')](util[_0x7b65('0x27')](_0x7b65('0x38'),_0x23e9b7,_0x136e27?_0x136e27[_0x7b65('0x37')]()[_0x7b65('0x39')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x3a')]=function(_0x39c97d,_0x27267d){return this['sendRequest'](util['format'](_0x7b65('0x3b'),_0x39c97d,_0x27267d));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x3c')]=function(_0x35afc0,_0x167062){return this[_0x7b65('0x22')](util['format'](_0x7b65('0x3d'),_0x35afc0,_0x167062));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x3e')]=function(_0xf87fde,_0xe31bc6){return this['sendRequest'](util[_0x7b65('0x27')](_0x7b65('0x3f'),_0xf87fde,_0xe31bc6));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x40')]=function(_0xabc38b,_0x47f719,_0x4e0e9b){_0x47f719=_0x47f719||this['extension'];_0x4e0e9b=_0x4e0e9b||0x1;this[_0x7b65('0x41')](_0xabc38b);this[_0x7b65('0x2f')](_0x47f719);this['setPriority'](_0x4e0e9b);return this[_0x7b65('0x28')](util[_0x7b65('0x27')](_0x7b65('0x42'),_0xabc38b,_0x47f719,_0x4e0e9b));};AGIChannel['prototype'][_0x7b65('0x43')]=function(_0x39e729){return this[_0x7b65('0x22')](util[_0x7b65('0x27')](_0x7b65('0x44'),_0x39e729));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x45')]=function(_0x2afd32,_0x54b55a,_0x564a56,_0x20b175,_0x19aa39,_0x482d2c){_0x54b55a=_0x54b55a||_0x7b65('0x46');_0x564a56=_0x564a56||'';_0x20b175=_0x20b175===undefined?-0x1:_0x20b175==='-1'?-0x1:_0x20b175*0x3e8;_0x19aa39=_0x19aa39===undefined?'':'s='+_0x19aa39;_0x482d2c=_0x482d2c?_0x7b65('0x47'):'';return this[_0x7b65('0x22')](util[_0x7b65('0x27')](_0x7b65('0x48'),_0x2afd32,_0x54b55a,_0x564a56,_0x20b175,_0x482d2c,_0x19aa39));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x49')]=function(_0x5a25b8,_0x15d3a1){_0x15d3a1=_0x15d3a1||'';return this[_0x7b65('0x22')](util[_0x7b65('0x27')](_0x7b65('0x4a'),_0x5a25b8,_0x15d3a1));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x4b')]=function(_0x27684a){return this[_0x7b65('0x2b')](_0x7b65('0x4c'),_0x27684a);};AGIChannel['prototype'][_0x7b65('0x4d')]=function(_0x13211f){return this[_0x7b65('0x2b')](_0x7b65('0x4e'),_0x13211f);};AGIChannel['prototype'][_0x7b65('0x15')]=function(_0x13adcd,_0x23bf51){this['noop'](util[_0x7b65('0x27')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x13adcd['id'],_0x13adcd[_0x7b65('0x4f')],_0x23bf51));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x7b65('0x50')]=AGIChannel; \ No newline at end of file +var _0xbd22=['HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','noop','GET\x20VARIABLE\x20\x22%s\x22','recordFile','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','exec','AGI','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','ready','line','toLowerCase','hangup','emit','substring','search','520\x20End\x20of\x20proper','no\x20code','replace','result=','indexOf','substr','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','function','write','inherits','sendRequest','command','sync','prototype','answer','getData','beep','format','VERBOSE\x20\x22%s\x22','isArray','join','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s'];(function(_0x1498dd,_0x3155dd){var _0x46b1a7=function(_0x2bfa78){while(--_0x2bfa78){_0x1498dd['push'](_0x1498dd['shift']());}};_0x46b1a7(++_0x3155dd);}(_0xbd22,0xf7));var _0x2bd2=function(_0x196199,_0x3f32ff){_0x196199=_0x196199-0x0;var _0xa0748a=_0xbd22[_0x196199];return _0xa0748a;};'use strict';var util=require(_0x2bd2('0x0'));var _=require(_0x2bd2('0x1'));var EventEmitter=require(_0x2bd2('0x2'))[_0x2bd2('0x3')];var AGIReply=require(_0x2bd2('0x4'));var AGIError=require(_0x2bd2('0x5'));function AGIChannel(_0x3ac745){var _0x60431=this,_0x42708f=new AGIReply(),_0x3e16b8=![],_0x5f427b={};EventEmitter[_0x2bd2('0x6')](_0x60431);_0x3ac745[_0x2bd2('0x7')](_0x2bd2('0x8'));_0x3ac745['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x42708f[_0x2bd2('0x7')]('utf8');_0x42708f['on']('headers',function(_0x36f3b0){for(var _0x1fb5aa in _0x36f3b0){_0x60431[_0x1fb5aa]=_0x36f3b0[_0x1fb5aa];}_0x60431['emit'](_0x2bd2('0x9'));});_0x42708f['on'](_0x2bd2('0xa'),function(_0x206f25){if(_0x206f25[_0x2bd2('0xb')]()==_0x2bd2('0xc')){_0x60431[_0x2bd2('0xd')]('hangup');return;}if(_0x206f25[_0x2bd2('0xe')](0x0,0xb)=='520-Invalid'){_0x3e16b8=!![];}if(_0x3e16b8){_0x5f427b['rx']+=_0x206f25+'\x0a';if(_0x206f25[_0x2bd2('0xf')](_0x2bd2('0x10'))!=-0x1){_0x3e16b8=![];}}else{_0x5f427b['rx']=_0x206f25;}if(_0x3e16b8){return;}if(typeof _0x5f427b['cb']=='function'){var _0x5e96e0=_0x5f427b['rx'][_0x2bd2('0xe')](0x0,0x3),_0x4bea19=null,_0x2e22b5=null;_0x5e96e0=parseInt(_0x5e96e0);if(isNaN(_0x5e96e0)){_0x5f427b['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x2bd2('0x11')});return;}if(_0x5e96e0!=0xc8){_0x5f427b['cb'](null,{'code':_0x5e96e0,'result':-0x1,'extra':'KO'});return;}_0x4bea19=_0x5f427b['rx'][_0x2bd2('0xe')](0x4)[_0x2bd2('0x12')](_0x2bd2('0x13'),'');if(_0x4bea19[_0x2bd2('0x14')]('\x20')!=-0x1){_0x4bea19=_0x4bea19[_0x2bd2('0x15')](0x0,_0x4bea19[_0x2bd2('0x14')]('\x20'));}if(_[_0x2bd2('0x16')](_0x4bea19,'-1')){_0x4bea19=parseInt(_0x4bea19);}_0x2e22b5=_0x5f427b['rx']['split']('\x20');if(_0x2e22b5[_0x2bd2('0x17')]==0x3){_0x2e22b5=_0x2e22b5[0x2][_0x2bd2('0xe')](0x1,_0x2e22b5[0x2][_0x2bd2('0x17')]-0x1);}else if(_0x2e22b5[_0x2bd2('0x17')]>0x3){var _0x5003a8=/\((.+)\)/;var _0x1a13b1=_0x5f427b['rx'][_0x2bd2('0x18')](_0x5003a8);if(_0x1a13b1){_0x2e22b5=_0x1a13b1[0x1];}else{_0x2e22b5=null;}}else{_0x2e22b5=null;}_0x5f427b['cb'](null,{'code':_0x5e96e0,'result':_0x4bea19,'extra':_0x2e22b5});}});_0x3ac745['on']('error',function(_0x53cf90){_0x60431[_0x2bd2('0xd')](_0x2bd2('0x19'),new AGIError(_0x2bd2('0x1a'),_0x53cf90[_0x2bd2('0x1b')]));});_0x3ac745['on']('close',function(){_0x60431[_0x2bd2('0xd')](_0x2bd2('0x1c'),new AGIError(_0x2bd2('0x1d')));});_0x3ac745['on'](_0x2bd2('0x1e'),function(){_0x60431[_0x2bd2('0xd')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x3ac745[_0x2bd2('0x1f')]();});_0x3ac745['pipe'](_0x42708f);this['command']=function(_0x59249a,_0x305bb2){var _0x59249a=_0x59249a||'',_0x305bb2=typeof _0x305bb2==_0x2bd2('0x20')?_0x305bb2:new Function();_0x5f427b={'tx':_0x59249a,'rx':'','cb':_0x305bb2};_0x3ac745[_0x2bd2('0x21')](_0x59249a+'\x0a');},this[_0x2bd2('0x1c')]=function(){_0x3ac745[_0x2bd2('0x1f')]();};}util[_0x2bd2('0x22')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x2bd2('0x23')]=function(_0x4fae63){return this[_0x2bd2('0x24')][_0x2bd2('0x25')](this,_0x4fae63);};AGIChannel[_0x2bd2('0x26')][_0x2bd2('0x27')]=function(){return this[_0x2bd2('0x23')]('ANSWER');};AGIChannel[_0x2bd2('0x26')][_0x2bd2('0x28')]=function(_0x314b96,_0x206088,_0x26ef93){_0x314b96=_0x314b96===undefined?_0x2bd2('0x29'):_0x314b96;_0x206088=_0x206088===undefined?'5':_0x206088;_0x26ef93=_0x26ef93===undefined?'1':_0x26ef93;return this[_0x2bd2('0x23')](util[_0x2bd2('0x2a')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x314b96,_0x206088*0x3e8,_0x26ef93));};AGIChannel[_0x2bd2('0x26')]['noop']=function(_0x4b534b){_0x4b534b=_0x4b534b||'NO\x20MESSAGE';return this[_0x2bd2('0x23')](util[_0x2bd2('0x2a')](_0x2bd2('0x2b'),_0x4b534b));};AGIChannel[_0x2bd2('0x26')]['exec']=function(_0x137f93,_0xd2ed4a){if(_[_0x2bd2('0x2c')](_0xd2ed4a)){return this[_0x2bd2('0x23')](util['format']('EXEC\x20%s\x20%s',_0x137f93,_0xd2ed4a[_0x2bd2('0x2d')](',')));}return this[_0x2bd2('0x23')](util[_0x2bd2('0x2a')](_0x2bd2('0x2e'),_0x137f93,_0xd2ed4a));};AGIChannel[_0x2bd2('0x26')][_0x2bd2('0x2f')]=function(_0x3bb8f3){return this['sendRequest'](util[_0x2bd2('0x2a')](_0x2bd2('0x30'),_0x3bb8f3));};AGIChannel['prototype'][_0x2bd2('0x31')]=function(_0x45b82a){return this[_0x2bd2('0x23')](util[_0x2bd2('0x2a')](_0x2bd2('0x32'),_0x45b82a));};AGIChannel['prototype'][_0x2bd2('0x33')]=function(_0x9f206d){return this[_0x2bd2('0x23')](util[_0x2bd2('0x2a')](_0x2bd2('0x34'),_0x9f206d));};AGIChannel[_0x2bd2('0x26')][_0x2bd2('0xc')]=function(){return this[_0x2bd2('0x23')](_0x2bd2('0x35'));};AGIChannel['prototype']['setVariable']=function(_0x8d0aa0,_0x3f7f18){var _0x141bca=_[_0x2bd2('0x36')](_0x3f7f18)||_[_0x2bd2('0x37')](_0x3f7f18)?_0x3f7f18[_0x2bd2('0x38')]():_0x3f7f18;return this[_0x2bd2('0x23')](util[_0x2bd2('0x2a')](_0x2bd2('0x39'),_0x8d0aa0,_0x141bca?_0x141bca[_0x2bd2('0x38')]()[_0x2bd2('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x2bd2('0x26')]['sayNumber']=function(_0x4d0a18,_0x1e81c2){return this[_0x2bd2('0x23')](util['format'](_0x2bd2('0x3a'),_0x4d0a18,_0x1e81c2));};AGIChannel[_0x2bd2('0x26')][_0x2bd2('0x3b')]=function(_0x194681,_0x4acf75){return this[_0x2bd2('0x23')](util[_0x2bd2('0x2a')](_0x2bd2('0x3c'),_0x194681,_0x4acf75));};AGIChannel[_0x2bd2('0x26')]['sayPhonetic']=function(_0x4bd5ce,_0x35c6a1){return this[_0x2bd2('0x23')](util['format'](_0x2bd2('0x3d'),_0x4bd5ce,_0x35c6a1));};AGIChannel['prototype'][_0x2bd2('0x3e')]=function(_0x20f20e,_0x1dd672,_0x372d2d){_0x1dd672=_0x1dd672||this['extension'];_0x372d2d=_0x372d2d||0x1;this[_0x2bd2('0x2f')](_0x20f20e);this[_0x2bd2('0x31')](_0x1dd672);this[_0x2bd2('0x33')](_0x372d2d);return this[_0x2bd2('0x3f')](util[_0x2bd2('0x2a')]('GOTO\x20%s\x20%s\x20%s',_0x20f20e,_0x1dd672,_0x372d2d));};AGIChannel['prototype']['getVariable']=function(_0x9caa97){return this['sendRequest'](util[_0x2bd2('0x2a')](_0x2bd2('0x40'),_0x9caa97));};AGIChannel[_0x2bd2('0x26')][_0x2bd2('0x41')]=function(_0x583306,_0x4f915b,_0x35a06d,_0x5ec27,_0x9e24e8,_0x4e78ae){_0x4f915b=_0x4f915b||'wav';_0x35a06d=_0x35a06d||'';_0x5ec27=_0x5ec27===undefined?-0x1:_0x5ec27==='-1'?-0x1:_0x5ec27*0x3e8;_0x9e24e8=_0x9e24e8===undefined?'':'s='+_0x9e24e8;_0x4e78ae=_0x4e78ae?'BEEP':'';return this['sendRequest'](util['format'](_0x2bd2('0x42'),_0x583306,_0x4f915b,_0x35a06d,_0x5ec27,_0x4e78ae,_0x9e24e8));};AGIChannel[_0x2bd2('0x26')][_0x2bd2('0x43')]=function(_0x15b94d,_0x4ff96e){_0x4ff96e=_0x4ff96e||'';return this[_0x2bd2('0x23')](util[_0x2bd2('0x2a')](_0x2bd2('0x44'),_0x15b94d,_0x4ff96e));};AGIChannel['prototype']['agi']=function(_0x11e6dc){return this[_0x2bd2('0x45')](_0x2bd2('0x46'),_0x11e6dc);};AGIChannel[_0x2bd2('0x26')][_0x2bd2('0x47')]=function(_0xf3472a){return this[_0x2bd2('0x45')]('WAIT',_0xf3472a);};AGIChannel[_0x2bd2('0x26')][_0x2bd2('0x19')]=function(_0x138358,_0x8b0d82){this[_0x2bd2('0x3f')](util['format'](_0x2bd2('0x48'),_0x138358['id'],_0x138358[_0x2bd2('0x49')],_0x8b0d82));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x2bd2('0x4a')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 5b8be3b..df41b98 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 _0x7be7=['push','format','apply','message','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','Socket\x20error.\x20Code:\x20%s.','Missing\x20\x27ivr.agi_network_script\x27.'];(function(_0x3d53c7,_0x2ea53c){var _0x51d6d8=function(_0x137919){while(--_0x137919){_0x3d53c7['push'](_0x3d53c7['shift']());}};_0x51d6d8(++_0x2ea53c);}(_0x7be7,0xdd));var _0x77be=function(_0x46de8b,_0x5a7a6b){_0x46de8b=_0x46de8b-0x0;var _0x3a0190=_0x7be7[_0x46de8b];return _0x3a0190;};'use strict';var util=require(_0x77be('0x0'));var error={'E_AGI_UNDEFINED':_0x77be('0x1'),'E_AGI_ARGUMENT_PORT':_0x77be('0x2'),'E_AGI_SERVER_ERROR':_0x77be('0x3'),'E_AGI_SERVER_CLOSE':_0x77be('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x77be('0x5'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x77be('0x6'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x57bd76){var _0x57bd76=_0x57bd76||null,_0x3903e1=_0x3903e1||[],_0x2ee153=0x1,_0x262389='';if(!error[_0x57bd76]){_0x57bd76='E_AGI_UNDEFINED';}_0x3903e1[_0x77be('0x7')](error[_0x57bd76]);while(arguments[_0x2ee153]){_0x3903e1[_0x77be('0x7')](arguments[_0x2ee153]);_0x2ee153++;}_0x262389=util[_0x77be('0x8')][_0x77be('0x9')](util,_0x3903e1);this[_0x77be('0xa')]=_0x262389;this[_0x77be('0xb')]=_0x57bd76;}module['exports']=AGIError; \ No newline at end of file +var _0x6aaa=['message','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply'];(function(_0x1c1bac,_0x39b48f){var _0x552eaa=function(_0x2b781b){while(--_0x2b781b){_0x1c1bac['push'](_0x1c1bac['shift']());}};_0x552eaa(++_0x39b48f);}(_0x6aaa,0xed));var _0xa6aa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6aaa[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xa6aa('0x0'),'E_AGI_ARGUMENT_PORT':_0xa6aa('0x1'),'E_AGI_SERVER_ERROR':_0xa6aa('0x2'),'E_AGI_SERVER_CLOSE':_0xa6aa('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xa6aa('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xa6aa('0x5'),'E_AGI_SOCKET_ERROR':_0xa6aa('0x6'),'E_AGI_SOCKET_CLOSE':_0xa6aa('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xa6aa('0x8'),'E_AGI_COMMAND_EMPTY':_0xa6aa('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0xa6aa('0xa')};function AGIError(_0x3865e7){var _0x3865e7=_0x3865e7||null,_0xc2a5e8=_0xc2a5e8||[],_0x3e6287=0x1,_0x15efaf='';if(!error[_0x3865e7]){_0x3865e7=_0xa6aa('0xb');}_0xc2a5e8[_0xa6aa('0xc')](error[_0x3865e7]);while(arguments[_0x3e6287]){_0xc2a5e8['push'](arguments[_0x3e6287]);_0x3e6287++;}_0x15efaf=util[_0xa6aa('0xd')][_0xa6aa('0xe')](util,_0xc2a5e8);this[_0xa6aa('0xf')]=_0x15efaf;this[_0xa6aa('0x10')]=_0x3865e7;}module[_0xa6aa('0x11')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index d0ecf58..e151da6 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 _0x0e02=['lodash','../../../config/logger','agi','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','push','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','no\x20edge/s\x20available','length','condition','split','vswitch','target','default','agicommand','menu','invalid','default\x20on\x20switch\x20not\x20found','includes','exports'];(function(_0x4a2322,_0x2dcaa5){var _0x8610da=function(_0x2123b1){while(--_0x2123b1){_0x4a2322['push'](_0x4a2322['shift']());}};_0x8610da(++_0x2dcaa5);}(_0x0e02,0x96));var _0x20e0=function(_0x422e40,_0x199629){_0x422e40=_0x422e40-0x0;var _0x399e9b=_0x0e02[_0x422e40];return _0x399e9b;};'use strict';var _=require(_0x20e0('0x0'));var logger=require(_0x20e0('0x1'))(_0x20e0('0x2'));var verticesWithRetry=['menu',_0x20e0('0x3'),_0x20e0('0x4')];var Graph=function(){this[_0x20e0('0x5')]={};this[_0x20e0('0x6')]={};this[_0x20e0('0x7')]=0x0;};Graph['prototype']['addVertex']=function(_0x46e218){this['vertices'][_0x46e218['id']]=_0x46e218;this['edges'][_0x46e218['id']]=[];};Graph[_0x20e0('0x8')]['addEdge']=function(_0x15b1d3,_0xe872f,_0x425510){this['edges'][_0x15b1d3][_0x20e0('0x9')]({'target':_0xe872f,'condition':_0x425510});this[_0x20e0('0x7')]+=0x1;};Graph[_0x20e0('0x8')][_0x20e0('0xa')]=function(){return _[_0x20e0('0xa')](this[_0x20e0('0x5')]);};Graph[_0x20e0('0x8')][_0x20e0('0xb')]=function(){return this[_0x20e0('0x7')];};Graph[_0x20e0('0x8')][_0x20e0('0xc')]=function(_0x5967a2){return this[_0x20e0('0x5')][_0x5967a2];};Graph[_0x20e0('0x8')][_0x20e0('0xd')]=function(_0x3497b2,_0x342682){if(!this[_0x20e0('0x5')][_0x3497b2]){return logger[_0x20e0('0xe')](_0x20e0('0xf'));}var _0x1d86a2=_0x342682(this[_0x20e0('0x5')][_0x3497b2]);if(!_0x1d86a2){return logger[_0x20e0('0xe')](_0x20e0('0x10'));}if(this[_0x20e0('0x6')][_0x3497b2]['length']===0x0){return logger[_0x20e0('0xe')](_0x20e0('0x11'));}for(var _0x3f9418=0x0,_0x346068=[],_0x43c5a4=![];_0x3f9418\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','start','stringify','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','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','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','connection','xml2json','util','moment','../../config/environment','../../config/logger','../../config/license/util','./rpc','./graph','./vertices','agi','defaults','127.0.0.1','nextTick','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','name','message','[%s]\x20%s','[ERROR]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','evtHangup','toJson','mxGraphModel','root','agicommand','retry','maxRetry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','source','target'];(function(_0x5d89cf,_0xfd052d){var _0x5a4ef1=function(_0x17fecf){while(--_0x17fecf){_0x5d89cf['push'](_0x5d89cf['shift']());}};_0x5a4ef1(++_0xfd052d);}(_0x41d9,0x148));var _0x941d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41d9[_0x3dd15e];return _0x231fd0;};'use strict';var parser=require(_0x941d('0x0'));var _=require('lodash');var syncho=require('syncho');var util=require(_0x941d('0x1'));var moment=require(_0x941d('0x2'));var config=require(_0x941d('0x3'));var logger=require(_0x941d('0x4'))('agi');var utilLicense=require(_0x941d('0x5'));var rpc=require(_0x941d('0x6'));var mailRpc=require('./mailRpc');var Graph=require(_0x941d('0x7'));var Vertices=require(_0x941d('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x941d('0x9')]=_[_0x941d('0xa')](config[_0x941d('0x9')],{'ip':_0x941d('0xb'),'port':0x11dd});function connectionHandler(_0x4bb82b){process[_0x941d('0xc')](function(){syncho(function(){try{setChannelVariables(_0x4bb82b);agiHandler(_0x4bb82b);}catch(_0x144211){logger[_0x941d('0xd')](_0x144211['stack']);}});});}function listeningHandler(){console[_0x941d('0xe')](_0x941d('0xf'),config[_0x941d('0x9')]['port']);logger[_0x941d('0x10')](util[_0x941d('0x11')](_0x941d('0x12'),config[_0x941d('0x9')]['ip'],config[_0x941d('0x9')][_0x941d('0x13')]));}function errorHandler(_0x30b079){if(_0x30b079&&_0x30b079[_0x941d('0x14')]&&_0x30b079[_0x941d('0x15')]){logger[_0x941d('0xd')](util[_0x941d('0x11')](_0x941d('0x16'),_0x30b079['name'],_0x30b079[_0x941d('0x15')]));}else{logger[_0x941d('0xd')](util[_0x941d('0x11')](_0x941d('0x17'),_0x30b079[_0x941d('0x18')]));}}function closeHandler(){logger[_0x941d('0x10')](util[_0x941d('0x11')](_0x941d('0x19'),this[_0x941d('0x1a')],this[_0x941d('0x1b')],this['callerid'],this[_0x941d('0x1c')],this['uniqueid']));try{createSquareReport(this);}catch(_0x43a0b3){logger[_0x941d('0xd')](_0x43a0b3[_0x941d('0x18')]);}}function timeoutHandler(){logger[_0x941d('0x10')](util[_0x941d('0x11')](_0x941d('0x1d'),this['arg_1'],this[_0x941d('0x1b')],this[_0x941d('0x1e')],this[_0x941d('0x1c')],this['uniqueid']));}function hangupHandler(){logger[_0x941d('0x10')](util[_0x941d('0x11')](_0x941d('0x1f'),this[_0x941d('0x1a')],this[_0x941d('0x1b')],this[_0x941d('0x1e')],this[_0x941d('0x1c')],this[_0x941d('0x20')]));this[_0x941d('0x21')]=!![];}function getRoot(_0x497989){return parser[_0x941d('0x22')](_0x497989,{'object':!![]})[_0x941d('0x23')][_0x941d('0x24')];}function addVertex(_0xc3f65e,_0x467639,_0x24deb7){_0x467639[_0x941d('0x25')]=_0x24deb7;if(_0x467639['hasOwnProperty'](_0x941d('0x26'))){_0x467639[_0x941d('0x27')]=parseInt(_0x467639[_0x941d('0x26')],0xa);}_0xc3f65e[_0x941d('0x28')](_[_0x941d('0x29')](_0x467639,_0x941d('0x2a')));}function initGraph(_0x12443f,_0x2de0a5){var _0x4dd2a5=new Graph();for(var _0x13a93a in _0x12443f){if(_0x12443f[_0x941d('0x2b')](_0x13a93a)){if(_[_0x941d('0x2c')](_0x12443f[_0x13a93a])){for(var _0x25fd47=0x0;_0x25fd47<_0x12443f[_0x13a93a][_0x941d('0x2d')];_0x25fd47+=0x1){addVertex(_0x4dd2a5,_0x12443f[_0x13a93a][_0x25fd47],_0x13a93a);}}else{addVertex(_0x4dd2a5,_0x12443f[_0x13a93a],_0x13a93a);}}}for(var _0x47f430=0x0;_0x47f430<_0x2de0a5['length'];_0x47f430+=0x1){if(_0x2de0a5[_0x47f430][_0x941d('0x2e')]&&_0x2de0a5[_0x47f430][_0x941d('0x2f')]){_0x4dd2a5[_0x941d('0x30')](_0x2de0a5[_0x47f430][_0x941d('0x2e')],_0x2de0a5[_0x47f430]['target'],_0x2de0a5[_0x47f430][_0x941d('0x31')]);}}return _0x4dd2a5;}function getSquareProject(_0x3c4df5,_0x253435){rpc[_0x941d('0x32')](_0x3c4df5)['then'](function(_0x24080f){_0x253435(null,_0x24080f);})[_0x941d('0x33')](function(_0x35bbdf){_0x253435(null,_0x35bbdf);});}function createSquareReport(_0x29d116,_0x383821){rpc[_0x941d('0x34')](_0x29d116)[_0x941d('0x35')](function(_0x254631){if(_0x383821){_0x383821(null,_0x254631);}})[_0x941d('0x33')](function(_0x599d54){if(_0x383821){_0x383821(null,_0x599d54);}});}function setChannelVariables(_0x2dff0d){for(var _0x39ce54 in _0x2dff0d){if(_0x2dff0d[_0x941d('0x2b')](_0x39ce54)){if(_0x39ce54[_0x941d('0x36')](_0x941d('0x37'))===0x0){_0x2dff0d[_0x39ce54[_0x941d('0x38')](0x4)]=_0x2dff0d[_0x39ce54];delete _0x2dff0d[_0x39ce54];}}}}function getLogFromObject(_0x3bedf7){return util[_0x941d('0x39')](_0x3bedf7,{'showHidden':![],'depth':null});}function agiHandler(_0x1c5314){var _0x3ad6e4,_0x36a751,_0x575545,_0x5ab340,_0x522ee5;logger[_0x941d('0x3a')]('variables',JSON['stringify'](_0x1c5314,null,0x2));logger['info'](util['format'](_0x941d('0x3b'),_0x1c5314[_0x941d('0x1a')],_0x1c5314[_0x941d('0x1b')],_0x1c5314[_0x941d('0x1e')],_0x1c5314[_0x941d('0x1c')],_0x1c5314[_0x941d('0x20')]));_0x1c5314['on'](_0x941d('0xd'),errorHandler);_0x1c5314['on'](_0x941d('0x3c'),closeHandler);_0x1c5314['on'](_0x941d('0x3d'),timeoutHandler);_0x1c5314[_0x941d('0x21')]=![];_0x1c5314['on'](_0x941d('0x3e'),hangupHandler);var _0x1bf4cf=getSquareProject[_0x941d('0x3f')](null,_0x1c5314['arg_1']);if(_0x1bf4cf){if(_0x1bf4cf[_0x941d('0x40')]){_0x3ad6e4=getRoot(_0x1bf4cf[_0x941d('0x40')]);if(_0x3ad6e4&&_0x3ad6e4[_0x941d('0x41')]){logger[_0x941d('0x3a')](_0x941d('0x24'),JSON[_0x941d('0x42')](_0x3ad6e4,null,0x2));_0x1c5314[_0x941d('0x43')]=moment()['format'](_0x941d('0x44'));_0x36a751=initGraph(_[_0x941d('0x29')](_0x3ad6e4,_0x941d('0x2a')),_0x3ad6e4[_0x941d('0x2a')]);_0x575545=new Vertices(_0x1c5314,rpc,mailRpc);logger[_0x941d('0x10')](util[_0x941d('0x11')](_0x941d('0x45'),_0x1c5314[_0x941d('0x1a')],_0x1c5314['calleridname'],_0x1c5314['callerid'],_0x1c5314[_0x941d('0x1c')],_0x1c5314['uniqueid']));_0x36a751[_0x941d('0x46')](_0x3ad6e4[_0x941d('0x41')]['id'],function(_0x3d550a){try{_0x3d550a=_0x575545['clear'](_0x3d550a);logger[_0x941d('0x3a')](_0x941d('0x47'),JSON[_0x941d('0x42')](_0x3d550a,null,0x2));if(_0x3d550a[_0x941d('0x25')]==='gotoc'){logger['info'](_0x941d('0x48'));_0x1c5314['context']=_0x3d550a[_0x941d('0x49')]||_0x1c5314['context'];_0x1c5314[_0x941d('0x4a')]=_0x3d550a['extension'];_0x1c5314[_0x941d('0x4b')]=_0x3d550a[_0x941d('0x4b')]?_0x3d550a[_0x941d('0x4b')]-0x1:0x1;return null;}else if(_0x3d550a&&_0x575545[_0x3d550a[_0x941d('0x25')]]){_0x522ee5=_0x575545[_0x3d550a[_0x941d('0x25')]](_0x3d550a);logger[_0x941d('0x10')](_0x941d('0x4c'),JSON[_0x941d('0x42')](_0x522ee5,null,0x2));if(_0x522ee5&&_0x522ee5[_0x941d('0x4d')]===AGI_CODE_SUCCESS&&_0x522ee5['result']!==AGI_RESULT_ERROR&&!_0x1c5314[_0x941d('0x21')]){logger[_0x941d('0x3a')](_0x941d('0x4c'),getLogFromObject(_0x522ee5));return _[_0x941d('0x4e')](_0x522ee5[_0x941d('0x4f')])?null:_0x522ee5[_0x941d('0x4f')][_0x941d('0x50')]();}else{logger[_0x941d('0xd')](_0x941d('0x4c'),getLogFromObject(_0x522ee5));return null;}}else{logger[_0x941d('0xd')]('agicommand\x20not\x20found');return null;}}catch(_0x31bf20){logger[_0x941d('0xd')](_0x31bf20[_0x941d('0x18')]);return null;}});if(_0x3ad6e4[_0x941d('0x51')]){logger['info'](util[_0x941d('0x11')](_0x941d('0x52'),_0x1c5314[_0x941d('0x1a')],_0x1c5314[_0x941d('0x1b')],_0x1c5314[_0x941d('0x1e')],_0x1c5314[_0x941d('0x1c')],_0x1c5314['uniqueid']));_0x36a751['traverseBFS'](_0x3ad6e4[_0x941d('0x51')]['id'],function(_0x5deec5){try{_0x5deec5=_0x575545['clear'](_0x5deec5);logger['debug'](_0x941d('0x47'),JSON['stringify'](_0x5deec5,null,0x2));if(_0x5deec5&&_0x575545[_0x5deec5[_0x941d('0x25')]]){_0x522ee5=_0x575545[_0x5deec5['agicommand']](_0x5deec5);if(_0x522ee5){logger[_0x941d('0x3a')](_0x941d('0x4c'),getLogFromObject(_0x522ee5));return _[_0x941d('0x4e')](_0x522ee5[_0x941d('0x4f')])?null:_0x522ee5[_0x941d('0x4f')][_0x941d('0x50')]();}else{logger[_0x941d('0xd')]('response',getLogFromObject(_0x522ee5));return null;}}else{logger[_0x941d('0xd')]('agicommand\x20not\x20found');return null;}}catch(_0x3e3308){logger[_0x941d('0xd')](_0x3e3308[_0x941d('0x18')]);return null;}});}logger[_0x941d('0x10')](util[_0x941d('0x11')](_0x941d('0x53'),_0x1c5314[_0x941d('0x1a')],_0x1c5314[_0x941d('0x1b')],_0x1c5314['callerid'],_0x1c5314[_0x941d('0x1c')],_0x1c5314['uniqueid']));logger[_0x941d('0x10')](util[_0x941d('0x11')](_0x941d('0x54'),_0x1c5314[_0x941d('0x49')],_0x1c5314['extension'],parseInt(_0x1c5314[_0x941d('0x4b')],0xa)+0x1));_0x1c5314[_0x941d('0x55')](_0x1c5314[_0x941d('0x49')],_0x1c5314['extension'],parseInt(_0x1c5314[_0x941d('0x4b')],0xa)+0x1);_0x1c5314['close']();}}else{logger[_0x941d('0xd')](util[_0x941d('0x11')](_0x941d('0x56'),_0x1c5314['arg_1']));_0x1c5314[_0x941d('0x55')](_0x1c5314['context'],_0x1c5314[_0x941d('0x4a')],parseInt(_0x1c5314['priority'],0xa)+0x1);_0x1c5314['close']();}}else{logger[_0x941d('0xd')](util['format'](_0x941d('0x57'),_0x1c5314[_0x941d('0x1a')]));_0x1c5314[_0x941d('0x55')](_0x1c5314[_0x941d('0x49')],_0x1c5314[_0x941d('0x4a')],parseInt(_0x1c5314['priority'],0xa)+0x1);_0x1c5314['close']();}}function main(){var _0x27f702;return utilLicense[_0x941d('0x58')]()[_0x941d('0x35')](function(_0x502f1d){if(_0x502f1d){if(_0x502f1d['voice']){if(_0x502f1d['callysquare']&&_0x502f1d[_0x941d('0x59')]>0x0){logger[_0x941d('0x10')](util[_0x941d('0x11')](_0x941d('0x5a'),_0x502f1d[_0x941d('0x59')]));_0x27f702=_0x502f1d[_0x941d('0x59')];}else{logger[_0x941d('0x10')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x941d('0x10')](_0x941d('0x5b'));_0x27f702=-0x1;}}})[_0x941d('0x33')](function(_0x1c1eaa){logger[_0x941d('0xd')](_0x941d('0x5c'),_0x1c1eaa['stack']);})[_0x941d('0x51')](function(){var _0x5a5fa9=require('./server')(config[_0x941d('0x9')][_0x941d('0x13')],config[_0x941d('0x9')]['ip'],_0x27f702);_0x5a5fa9['on'](_0x941d('0xd'),errorHandler);_0x5a5fa9['on']('listening',listeningHandler);_0x5a5fa9['on'](_0x941d('0x5d'),connectionHandler);_0x5a5fa9['on'](_0x941d('0x3c'),closeHandler);});}main(); \ No newline at end of file +var _0x6980=['moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','127.0.0.1','nextTick','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','name','message','error','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','stack','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','evtHangup','toJson','mxGraphModel','root','agicommand','retry','maxRetry','addVertex','isArray','length','source','target','addEdge','value','getSquareProject','catch','then','hasOwnProperty','indexOf','agi_','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','sync','production','start','joinAt','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','isUndefined','result','toString','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','finally','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','continueAt','close','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','syncho','util'];(function(_0x17f37b,_0x34f1bc){var _0x2c7da1=function(_0x47cd5e){while(--_0x47cd5e){_0x17f37b['push'](_0x17f37b['shift']());}};_0x2c7da1(++_0x34f1bc);}(_0x6980,0xb2));var _0x0698=function(_0x4aa4e6,_0x278c45){_0x4aa4e6=_0x4aa4e6-0x0;var _0x322588=_0x6980[_0x4aa4e6];return _0x322588;};'use strict';var parser=require('xml2json');var _=require('lodash');var syncho=require(_0x0698('0x0'));var util=require(_0x0698('0x1'));var moment=require(_0x0698('0x2'));var config=require(_0x0698('0x3'));var logger=require(_0x0698('0x4'))(_0x0698('0x5'));var utilLicense=require(_0x0698('0x6'));var rpc=require(_0x0698('0x7'));var mailRpc=require(_0x0698('0x8'));var Graph=require(_0x0698('0x9'));var Vertices=require(_0x0698('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x0698('0x5')]=_['defaults'](config[_0x0698('0x5')],{'ip':_0x0698('0xb'),'port':0x11dd});function connectionHandler(_0x529b73){process[_0x0698('0xc')](function(){syncho(function(){try{setChannelVariables(_0x529b73);agiHandler(_0x529b73);}catch(_0x14b69a){logger['error'](_0x14b69a['stack']);}});});}function listeningHandler(){console[_0x0698('0xd')](_0x0698('0xe'),config[_0x0698('0x5')][_0x0698('0xf')]);logger[_0x0698('0x10')](util[_0x0698('0x11')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x0698('0x5')]['ip'],config['agi'][_0x0698('0xf')]));}function errorHandler(_0x2367a1){if(_0x2367a1&&_0x2367a1[_0x0698('0x12')]&&_0x2367a1['message']){logger['error'](util[_0x0698('0x11')]('[%s]\x20%s',_0x2367a1[_0x0698('0x12')],_0x2367a1[_0x0698('0x13')]));}else{logger[_0x0698('0x14')](util[_0x0698('0x11')](_0x0698('0x15'),_0x2367a1['stack']));}}function closeHandler(){logger['info'](util[_0x0698('0x11')](_0x0698('0x16'),this[_0x0698('0x17')],this['calleridname'],this[_0x0698('0x18')],this[_0x0698('0x19')],this[_0x0698('0x1a')]));try{createSquareReport(this);}catch(_0x28c78a){logger['error'](_0x28c78a[_0x0698('0x1b')]);}}function timeoutHandler(){logger[_0x0698('0x10')](util[_0x0698('0x11')](_0x0698('0x1c'),this['arg_1'],this[_0x0698('0x1d')],this[_0x0698('0x18')],this[_0x0698('0x19')],this[_0x0698('0x1a')]));}function hangupHandler(){logger[_0x0698('0x10')](util[_0x0698('0x11')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x0698('0x17')],this[_0x0698('0x1d')],this['callerid'],this['dnid'],this[_0x0698('0x1a')]));this[_0x0698('0x1e')]=!![];}function getRoot(_0x5a52b7){return parser[_0x0698('0x1f')](_0x5a52b7,{'object':!![]})[_0x0698('0x20')][_0x0698('0x21')];}function addVertex(_0x2a2a3f,_0x579fc7,_0x1f8576){_0x579fc7[_0x0698('0x22')]=_0x1f8576;if(_0x579fc7['hasOwnProperty'](_0x0698('0x23'))){_0x579fc7[_0x0698('0x24')]=parseInt(_0x579fc7[_0x0698('0x23')],0xa);}_0x2a2a3f[_0x0698('0x25')](_['omit'](_0x579fc7,'mxCell'));}function initGraph(_0x44c12e,_0x2fa2bb){var _0x5132fc=new Graph();for(var _0x1ce404 in _0x44c12e){if(_0x44c12e['hasOwnProperty'](_0x1ce404)){if(_[_0x0698('0x26')](_0x44c12e[_0x1ce404])){for(var _0x1ee410=0x0;_0x1ee410<_0x44c12e[_0x1ce404][_0x0698('0x27')];_0x1ee410+=0x1){addVertex(_0x5132fc,_0x44c12e[_0x1ce404][_0x1ee410],_0x1ce404);}}else{addVertex(_0x5132fc,_0x44c12e[_0x1ce404],_0x1ce404);}}}for(var _0x25b186=0x0;_0x25b186<_0x2fa2bb[_0x0698('0x27')];_0x25b186+=0x1){if(_0x2fa2bb[_0x25b186][_0x0698('0x28')]&&_0x2fa2bb[_0x25b186][_0x0698('0x29')]){_0x5132fc[_0x0698('0x2a')](_0x2fa2bb[_0x25b186]['source'],_0x2fa2bb[_0x25b186][_0x0698('0x29')],_0x2fa2bb[_0x25b186][_0x0698('0x2b')]);}}return _0x5132fc;}function getSquareProject(_0xfb7a8b,_0x5df82c){rpc[_0x0698('0x2c')](_0xfb7a8b)['then'](function(_0x94cdb7){_0x5df82c(null,_0x94cdb7);})[_0x0698('0x2d')](function(_0x6a1529){_0x5df82c(null,_0x6a1529);});}function createSquareReport(_0x270764,_0x258af9){rpc['createSquareReport'](_0x270764)[_0x0698('0x2e')](function(_0x5a7f86){if(_0x258af9){_0x258af9(null,_0x5a7f86);}})[_0x0698('0x2d')](function(_0x2d9207){if(_0x258af9){_0x258af9(null,_0x2d9207);}});}function setChannelVariables(_0x3a5d68){for(var _0x29b2c0 in _0x3a5d68){if(_0x3a5d68[_0x0698('0x2f')](_0x29b2c0)){if(_0x29b2c0[_0x0698('0x30')](_0x0698('0x31'))===0x0){_0x3a5d68[_0x29b2c0['substring'](0x4)]=_0x3a5d68[_0x29b2c0];delete _0x3a5d68[_0x29b2c0];}}}}function getLogFromObject(_0x4064b4){return util[_0x0698('0x32')](_0x4064b4,{'showHidden':![],'depth':null});}function agiHandler(_0x527b02){var _0x19c573,_0x5319bf,_0x1dd30e,_0x449fcc,_0x3802ab;logger[_0x0698('0x33')](_0x0698('0x34'),JSON[_0x0698('0x35')](_0x527b02,null,0x2));logger[_0x0698('0x10')](util[_0x0698('0x11')](_0x0698('0x36'),_0x527b02['arg_1'],_0x527b02[_0x0698('0x1d')],_0x527b02[_0x0698('0x18')],_0x527b02[_0x0698('0x19')],_0x527b02[_0x0698('0x1a')]));_0x527b02['on'](_0x0698('0x14'),errorHandler);_0x527b02['on']('close',closeHandler);_0x527b02['on'](_0x0698('0x37'),timeoutHandler);_0x527b02[_0x0698('0x1e')]=![];_0x527b02['on']('hangup',hangupHandler);var _0x1eaae1=getSquareProject[_0x0698('0x38')](null,_0x527b02[_0x0698('0x17')]);if(_0x1eaae1){if(_0x1eaae1[_0x0698('0x39')]){_0x19c573=getRoot(_0x1eaae1[_0x0698('0x39')]);if(_0x19c573&&_0x19c573[_0x0698('0x3a')]){logger['debug'](_0x0698('0x21'),JSON[_0x0698('0x35')](_0x19c573,null,0x2));_0x527b02[_0x0698('0x3b')]=moment()[_0x0698('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x5319bf=initGraph(_['omit'](_0x19c573,_0x0698('0x3c')),_0x19c573[_0x0698('0x3c')]);_0x1dd30e=new Vertices(_0x527b02,rpc,mailRpc);logger[_0x0698('0x10')](util['format'](_0x0698('0x3d'),_0x527b02['arg_1'],_0x527b02[_0x0698('0x1d')],_0x527b02[_0x0698('0x18')],_0x527b02[_0x0698('0x19')],_0x527b02[_0x0698('0x1a')]));_0x5319bf['traverseBFS'](_0x19c573[_0x0698('0x3a')]['id'],function(_0x13e8ca){try{_0x13e8ca=_0x1dd30e[_0x0698('0x3e')](_0x13e8ca);logger['debug'](_0x0698('0x3f'),JSON[_0x0698('0x35')](_0x13e8ca,null,0x2));if(_0x13e8ca[_0x0698('0x22')]===_0x0698('0x40')){logger[_0x0698('0x10')](_0x0698('0x41'));_0x527b02[_0x0698('0x42')]=_0x13e8ca[_0x0698('0x42')]||_0x527b02[_0x0698('0x42')];_0x527b02[_0x0698('0x43')]=_0x13e8ca['extension'];_0x527b02[_0x0698('0x44')]=_0x13e8ca['priority']?_0x13e8ca[_0x0698('0x44')]-0x1:0x1;return null;}else if(_0x13e8ca&&_0x1dd30e[_0x13e8ca[_0x0698('0x22')]]){_0x3802ab=_0x1dd30e[_0x13e8ca[_0x0698('0x22')]](_0x13e8ca);logger['info'](_0x0698('0x45'),JSON[_0x0698('0x35')](_0x3802ab,null,0x2));if(_0x3802ab&&_0x3802ab[_0x0698('0x46')]===AGI_CODE_SUCCESS&&_0x3802ab['result']!==AGI_RESULT_ERROR&&!_0x527b02['evtHangup']){logger[_0x0698('0x33')](_0x0698('0x45'),getLogFromObject(_0x3802ab));return _[_0x0698('0x47')](_0x3802ab[_0x0698('0x48')])?null:_0x3802ab[_0x0698('0x48')][_0x0698('0x49')]();}else{logger[_0x0698('0x14')](_0x0698('0x45'),getLogFromObject(_0x3802ab));return null;}}else{logger[_0x0698('0x14')]('agicommand\x20not\x20found');return null;}}catch(_0x359757){logger[_0x0698('0x14')](_0x359757[_0x0698('0x1b')]);return null;}});if(_0x19c573['finally']){logger[_0x0698('0x10')](util[_0x0698('0x11')](_0x0698('0x4a'),_0x527b02[_0x0698('0x17')],_0x527b02[_0x0698('0x1d')],_0x527b02['callerid'],_0x527b02[_0x0698('0x19')],_0x527b02[_0x0698('0x1a')]));_0x5319bf[_0x0698('0x4b')](_0x19c573[_0x0698('0x4c')]['id'],function(_0x11a898){try{_0x11a898=_0x1dd30e[_0x0698('0x3e')](_0x11a898);logger['debug'](_0x0698('0x3f'),JSON[_0x0698('0x35')](_0x11a898,null,0x2));if(_0x11a898&&_0x1dd30e[_0x11a898[_0x0698('0x22')]]){_0x3802ab=_0x1dd30e[_0x11a898[_0x0698('0x22')]](_0x11a898);if(_0x3802ab){logger[_0x0698('0x33')](_0x0698('0x45'),getLogFromObject(_0x3802ab));return _[_0x0698('0x47')](_0x3802ab[_0x0698('0x48')])?null:_0x3802ab[_0x0698('0x48')]['toString']();}else{logger[_0x0698('0x14')]('response',getLogFromObject(_0x3802ab));return null;}}else{logger['error'](_0x0698('0x4d'));return null;}}catch(_0x6d9c87){logger[_0x0698('0x14')](_0x6d9c87[_0x0698('0x1b')]);return null;}});}logger[_0x0698('0x10')](util['format'](_0x0698('0x4e'),_0x527b02[_0x0698('0x17')],_0x527b02[_0x0698('0x1d')],_0x527b02[_0x0698('0x18')],_0x527b02[_0x0698('0x19')],_0x527b02[_0x0698('0x1a')]));logger[_0x0698('0x10')](util[_0x0698('0x11')](_0x0698('0x4f'),_0x527b02['context'],_0x527b02[_0x0698('0x43')],parseInt(_0x527b02[_0x0698('0x44')],0xa)+0x1));_0x527b02[_0x0698('0x50')](_0x527b02[_0x0698('0x42')],_0x527b02['extension'],parseInt(_0x527b02[_0x0698('0x44')],0xa)+0x1);_0x527b02[_0x0698('0x51')]();}}else{logger['error'](util[_0x0698('0x11')](_0x0698('0x52'),_0x527b02[_0x0698('0x17')]));_0x527b02['continueAt'](_0x527b02[_0x0698('0x42')],_0x527b02[_0x0698('0x43')],parseInt(_0x527b02[_0x0698('0x44')],0xa)+0x1);_0x527b02['close']();}}else{logger['error'](util[_0x0698('0x11')](_0x0698('0x53'),_0x527b02[_0x0698('0x17')]));_0x527b02[_0x0698('0x50')](_0x527b02[_0x0698('0x42')],_0x527b02[_0x0698('0x43')],parseInt(_0x527b02[_0x0698('0x44')],0xa)+0x1);_0x527b02[_0x0698('0x51')]();}}function main(){var _0x24f81a;return utilLicense[_0x0698('0x54')]()[_0x0698('0x2e')](function(_0x2ca8c6){if(_0x2ca8c6){if(_0x2ca8c6[_0x0698('0x55')]){if(_0x2ca8c6[_0x0698('0x56')]&&_0x2ca8c6[_0x0698('0x56')]>0x0){logger[_0x0698('0x10')](util[_0x0698('0x11')](_0x0698('0x57'),_0x2ca8c6[_0x0698('0x56')]));_0x24f81a=_0x2ca8c6['callysquare'];}else{logger[_0x0698('0x10')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x0698('0x10')](_0x0698('0x58'));_0x24f81a=-0x1;}}})[_0x0698('0x2d')](function(_0xd69858){logger[_0x0698('0x14')]('[LICENSE]',_0xd69858[_0x0698('0x1b')]);})[_0x0698('0x4c')](function(){var _0x435d45=require(_0x0698('0x59'))(config[_0x0698('0x5')][_0x0698('0xf')],config[_0x0698('0x5')]['ip'],_0x24f81a);_0x435d45['on'](_0x0698('0x14'),errorHandler);_0x435d45['on']('listening',listeningHandler);_0x435d45['on']('connection',connectionHandler);_0x435d45['on'](_0x0698('0x51'),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 8716061..4c20239 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 _0x3c90=['bluebird','jayson/promise','http','request','then','error','message','result','sendMailMessage','SendMail'];(function(_0x5ad0d7,_0x2645f8){var _0xd83bd=function(_0x33d3bd){while(--_0x33d3bd){_0x5ad0d7['push'](_0x5ad0d7['shift']());}};_0xd83bd(++_0x2645f8);}(_0x3c90,0x8c));var _0x03c9=function(_0x396b2d,_0x17b644){_0x396b2d=_0x396b2d-0x0;var _0x278f1f=_0x3c90[_0x396b2d];return _0x278f1f;};'use strict';var BPromise=require(_0x03c9('0x0'));var jayson=require(_0x03c9('0x1'));var client=jayson['client'][_0x03c9('0x2')]({'port':0x232b});function request(_0x54296b,_0x1f6458){return new BPromise(function(_0x33e7cf,_0x4cebb6){return client[_0x03c9('0x3')](_0x54296b,_0x1f6458)[_0x03c9('0x4')](function(_0x7e8186){if(_0x7e8186[_0x03c9('0x5')]){return _0x4cebb6(_0x7e8186[_0x03c9('0x5')][_0x03c9('0x6')]);}else{return _0x33e7cf(_0x7e8186[_0x03c9('0x7')]);}})['catch'](function(_0x232fa0){return _0x4cebb6(_0x232fa0);});});}exports[_0x03c9('0x8')]=function(_0x307c41,_0x1a3287){return request(_0x03c9('0x9'),{'account':_0x307c41,'message':_0x1a3287});}; \ No newline at end of file +var _0x7a3a=['jayson/promise','client','then','error','message','result'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x7a3a,0x180));var _0xa7a3=function(_0x45c23a,_0x398db8){_0x45c23a=_0x45c23a-0x0;var _0x148197=_0x7a3a[_0x45c23a];return _0x148197;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xa7a3('0x0'));var client=jayson[_0xa7a3('0x1')]['http']({'port':0x232b});function request(_0x2338d7,_0x10cb8d){return new BPromise(function(_0x4fabb2,_0x3b1e81){return client['request'](_0x2338d7,_0x10cb8d)[_0xa7a3('0x2')](function(_0x2c1972){if(_0x2c1972['error']){return _0x3b1e81(_0x2c1972[_0xa7a3('0x3')][_0xa7a3('0x4')]);}else{return _0x4fabb2(_0x2c1972[_0xa7a3('0x5')]);}})['catch'](function(_0x1e3244){return _0x3b1e81(_0x1e3244);});});}exports['sendMailMessage']=function(_0x35fe00,_0xdea737){return request('SendMail',{'account':_0x35fe00,'message':_0xdea737});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 782cd85..4099081 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 _0x2055=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','trim','slice','length','emit','substring','line'];(function(_0x1e829d,_0x263e13){var _0x527b99=function(_0x42b6d8){while(--_0x42b6d8){_0x1e829d['push'](_0x1e829d['shift']());}};_0x527b99(++_0x263e13);}(_0x2055,0x157));var _0x5205=function(_0x342791,_0x467999){_0x342791=_0x342791-0x0;var _0x44fc33=_0x2055[_0x342791];return _0x44fc33;};'use strict';var util=require(_0x5205('0x0'));var Transform=require(_0x5205('0x1'))[_0x5205('0x2')];function AGIReply(_0x1bc705){Transform[_0x5205('0x3')](this,_0x1bc705);this[_0x5205('0x4')]='';this[_0x5205('0x5')]=![];}util[_0x5205('0x6')](AGIReply,Transform);AGIReply[_0x5205('0x7')][_0x5205('0x8')]=function(_0x1cebe8,_0x1b71f1,_0x42e9f2){var _0x28859f='\x0a',_0x2e57bb=['\x0a\x0a',_0x5205('0x9')],_0x2e9159=-0x1,_0x54885e=-0x1,_0x267879='',_0x5d9ada=0x0,_0x4c6321='',_0x47a27d='';this[_0x5205('0x4')]+=_0x1cebe8[_0x5205('0xa')]();_0x4c6321=this[_0x5205('0x4')];if(!this[_0x5205('0x5')]){_0x5d9ada=0x0;while(_0x2e57bb[_0x5d9ada]){while((_0x54885e=_0x4c6321['indexOf'](_0x2e57bb[_0x5d9ada]))!=-0x1){_0x267879=_0x2e57bb[_0x5d9ada];_0x47a27d=_0x4c6321['substring'](0x0,_0x54885e);_0x4c6321=_0x4c6321['substring'](_0x54885e+_0x267879['length']);var _0x2304d5=_0x47a27d['split'](_0x28859f),_0x250a91=0x0,_0x4ea223={},_0xbf02d0='',_0x1c224c='',_0x523df7=-0x1;while(_0x2304d5[_0x250a91]){_0x523df7=_0x2304d5[_0x250a91][_0x5205('0xb')](':');if(_0x523df7!=-0x1){_0xbf02d0=_0x2304d5[_0x250a91]['slice'](0x0,_0x523df7)[_0x5205('0xc')]();_0x1c224c=_0x2304d5[_0x250a91][_0x5205('0xd')](_0x523df7+0x1)[_0x5205('0xc')]();if(_0xbf02d0[_0x5205('0xe')]>0x0){_0x4ea223[_0xbf02d0]=_0x1c224c;}}else{}_0x250a91++;}this[_0x5205('0xf')]('headers',_0x4ea223);this[_0x5205('0x5')]=!![];}_0x5d9ada++;}this['_localBuffer']=_0x4c6321;}else{while((_0x2e9159=_0x4c6321['indexOf'](_0x28859f))!=-0x1){_0x47a27d=_0x4c6321[_0x5205('0x10')](0x0,_0x2e9159);this['emit'](_0x5205('0x11'),_0x47a27d);_0x4c6321=_0x4c6321[_0x5205('0x10')](_0x2e9159+_0x28859f[_0x5205('0xe')]);}this[_0x5205('0x4')]=_0x4c6321;}_0x42e9f2();};module[_0x5205('0x12')]=AGIReply; \ No newline at end of file +var _0xa737=['Transform','call','_localBuffer','inherits','_transform','\x0d\x0a\x0d\x0a','toString','_inBody','indexOf','substring','length','split','slice','trim','emit','headers','exports','util','stream'];(function(_0x52121d,_0x1d1704){var _0x448627=function(_0x495bf0){while(--_0x495bf0){_0x52121d['push'](_0x52121d['shift']());}};_0x448627(++_0x1d1704);}(_0xa737,0x154));var _0x7a73=function(_0x557fd2,_0x2c0a7a){_0x557fd2=_0x557fd2-0x0;var _0x1b54a2=_0xa737[_0x557fd2];return _0x1b54a2;};'use strict';var util=require(_0x7a73('0x0'));var Transform=require(_0x7a73('0x1'))[_0x7a73('0x2')];function AGIReply(_0x20e793){Transform[_0x7a73('0x3')](this,_0x20e793);this[_0x7a73('0x4')]='';this['_inBody']=![];}util[_0x7a73('0x5')](AGIReply,Transform);AGIReply['prototype'][_0x7a73('0x6')]=function(_0x41d75b,_0xcc38d1,_0x2c119f){var _0x242609='\x0a',_0xcffeb9=['\x0a\x0a',_0x7a73('0x7')],_0x5d66f4=-0x1,_0x186e8b=-0x1,_0x5d9bff='',_0x45afe4=0x0,_0x1cac79='',_0x184169='';this['_localBuffer']+=_0x41d75b[_0x7a73('0x8')]();_0x1cac79=this[_0x7a73('0x4')];if(!this[_0x7a73('0x9')]){_0x45afe4=0x0;while(_0xcffeb9[_0x45afe4]){while((_0x186e8b=_0x1cac79[_0x7a73('0xa')](_0xcffeb9[_0x45afe4]))!=-0x1){_0x5d9bff=_0xcffeb9[_0x45afe4];_0x184169=_0x1cac79[_0x7a73('0xb')](0x0,_0x186e8b);_0x1cac79=_0x1cac79[_0x7a73('0xb')](_0x186e8b+_0x5d9bff[_0x7a73('0xc')]);var _0x236f3c=_0x184169[_0x7a73('0xd')](_0x242609),_0x297a8f=0x0,_0x2fe021={},_0x504d06='',_0x1a33ac='',_0x5054f0=-0x1;while(_0x236f3c[_0x297a8f]){_0x5054f0=_0x236f3c[_0x297a8f][_0x7a73('0xa')](':');if(_0x5054f0!=-0x1){_0x504d06=_0x236f3c[_0x297a8f][_0x7a73('0xe')](0x0,_0x5054f0)[_0x7a73('0xf')]();_0x1a33ac=_0x236f3c[_0x297a8f]['slice'](_0x5054f0+0x1)[_0x7a73('0xf')]();if(_0x504d06[_0x7a73('0xc')]>0x0){_0x2fe021[_0x504d06]=_0x1a33ac;}}else{}_0x297a8f++;}this[_0x7a73('0x10')](_0x7a73('0x11'),_0x2fe021);this[_0x7a73('0x9')]=!![];}_0x45afe4++;}this[_0x7a73('0x4')]=_0x1cac79;}else{while((_0x5d66f4=_0x1cac79[_0x7a73('0xa')](_0x242609))!=-0x1){_0x184169=_0x1cac79['substring'](0x0,_0x5d66f4);this[_0x7a73('0x10')]('line',_0x184169);_0x1cac79=_0x1cac79[_0x7a73('0xb')](_0x5d66f4+_0x242609['length']);}this[_0x7a73('0x4')]=_0x1cac79;}_0x2c119f();};module[_0x7a73('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index afdaec0..29e808c 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 _0xa79c=['getMailAccountById','ShowMailAccount','MailServerOut','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','CreateSquareDetailsReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','getPauseById','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','jayson/promise','http','request','then','error','message','result','catch','getSquareProject','ShowSquareProject','production'];(function(_0x2d0f71,_0x4d9c72){var _0x255123=function(_0x39947c){while(--_0x39947c){_0x2d0f71['push'](_0x2d0f71['shift']());}};_0x255123(++_0x4d9c72);}(_0xa79c,0xe5));var _0xca79=function(_0x3f86aa,_0x306778){_0x3f86aa=_0x3f86aa-0x0;var _0x5e60e1=_0xa79c[_0x3f86aa];return _0x5e60e1;};'use strict';var BPromise=require(_0xca79('0x0'));var moment=require(_0xca79('0x1'));var _=require(_0xca79('0x2'));var util=require(_0xca79('0x3'));var jayson=require(_0xca79('0x4'));var client=jayson['client'][_0xca79('0x5')]({'port':0x2329});function request(_0x489881,_0xd1eb85){return new BPromise(function(_0x50e34a,_0x30d94c){return client[_0xca79('0x6')](_0x489881,_0xd1eb85)[_0xca79('0x7')](function(_0xaaa9dd){if(_0xaaa9dd[_0xca79('0x8')]){return _0x30d94c(_0xaaa9dd[_0xca79('0x8')][_0xca79('0x9')]);}else{return _0x50e34a(_0xaaa9dd[_0xca79('0xa')]);}})[_0xca79('0xb')](function(_0x3a88d6){return _0x30d94c(_0x3a88d6);});});}exports[_0xca79('0xc')]=function(_0x46c2a4){return request(_0xca79('0xd'),{'options':{'raw':![],'where':{'name':_0x46c2a4},'attributes':[_0xca79('0xe')]}});};exports[_0xca79('0xf')]=function(_0x2fa1c5){return request(_0xca79('0x10'),{'options':{'raw':![],'where':{'id':_0x2fa1c5},'include':[{'model':_0xca79('0x11'),'as':'Smtp'}],'attributes':['id',_0xca79('0x12'),_0xca79('0x13')]}});};exports[_0xca79('0x14')]=function(_0x4adc75){return request(_0xca79('0xd'),{'options':{'where':{'id':_0x4adc75},'attributes':[_0xca79('0x12')]}});};exports[_0xca79('0x15')]=function(_0x27b6e0){return request(_0xca79('0x16'),{'options':{'where':{'id':_0x27b6e0},'attributes':[_0xca79('0x12')]}});};exports['getVariableById']=function(_0x57148a){return request(_0xca79('0x17'),{'options':{'where':{'id':_0x57148a},'attributes':[_0xca79('0x12')]}});};exports[_0xca79('0x18')]=function(_0xa320ec){return request(_0xca79('0x19'),{'options':{'where':{'id':_0xa320ec},'attributes':[_0xca79('0x1a')]}});};exports[_0xca79('0x1b')]=function(_0x4d1fad){return request(_0xca79('0x1c'),{'options':{'where':{'id':_0x4d1fad},'attributes':['name']}});};exports[_0xca79('0x1d')]=function(_0x140b5d){return request('ShowTrunk',{'options':{'where':{'id':_0x140b5d},'attributes':[_0xca79('0x12')]}});};exports['getSoundById']=function(_0x80304e){return request(_0xca79('0x1e'),{'options':{'where':{'id':_0x80304e},'attributes':[_0xca79('0x1f')]}});};exports[_0xca79('0x20')]=function(_0x51a884){return request(_0xca79('0x21'),{'options':{'raw':![],'where':{'id':_0x51a884},'include':[{'model':_0xca79('0x22'),'as':_0xca79('0x23')}]}});};exports[_0xca79('0x24')]=function(_0x527b41){return request(_0xca79('0x25'),{'options':{'where':{'id':_0x527b41},'attributes':['id',_0xca79('0x12')]}});};exports['createSmsMessage']=function(_0x27c644){return request(_0xca79('0x26'),{'body':_0x27c644});};exports['createSquareDetailsReport']=function(_0x33f632){return request(_0xca79('0x27'),{'body':_0x33f632});};exports['createSquareReport']=function(_0x1daba5){return request('CreateSquareReport',{'body':_['merge'](_0x1daba5,{'project_name':_0x1daba5[_0xca79('0x28')],'prev_project_name':_0x1daba5[_0xca79('0x29')]||'','is_subproject':_0x1daba5[_0xca79('0x29')]?!![]:![],'leaveAt':moment()[_0xca79('0x2a')](_0xca79('0x2b'))})});};exports[_0xca79('0x2c')]=function(_0x1236ea){return request(_0xca79('0x2d'),{'body':_0x1236ea});};exports[_0xca79('0x2e')]=function(_0x241125){return request(_0xca79('0x2f'),{'body':_0x241125});};exports[_0xca79('0x30')]=function(_0x368479){return request(_0xca79('0x31'),{'options':{'raw':![],'where':{'phone':_0x368479[_0xca79('0x32')],'ListId':_0x368479[_0xca79('0x33')]}}})[_0xca79('0x7')](function(_0x4965cb){if(_0x4965cb){return _0x4965cb;}return request('CreateCmContact',{'body':_0x368479});});};exports[_0xca79('0x34')]=function(_0x4f4515){return request('ShowPause',{'options':{'where':{'id':_0x4f4515},'attributes':[_0xca79('0x12')]}});};exports[_0xca79('0x35')]=function(_0x3e0be3,_0x2df351){return request(_0xca79('0x36'),{'body':{'interface':_0x2df351},'options':{'where':_0x3e0be3}});};exports[_0xca79('0x37')]=function(_0x3b6003,_0x5f23dc,_0x1bf5a9){return request(_0xca79('0x38'),{'body':{'type':_0x5f23dc,'uniqueid':_0x1bf5a9},'options':{'where':_0x3b6003}});};exports[_0xca79('0x39')]=function(_0x10c52b){return request(_0xca79('0x3a'),{'body':{},'options':{'where':_0x10c52b}});};exports[_0xca79('0x3b')]=function(_0x17cc4c){return request(_0xca79('0x3c'),{'body':{},'options':{'where':_0x17cc4c}});}; \ No newline at end of file +var _0x15f7=['ShowVoiceQueue','getSquareOdbcById','dsn','ShowUser','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','Interval','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','CreateCmContact','agentLogin','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','lodash','util','jayson/promise','client','http','request','then','error','result','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','name','email','getSquareProjectById','getVoiceQueueById'];(function(_0x20fa2a,_0xd3b39){var _0xb9db68=function(_0x2c1690){while(--_0x2c1690){_0x20fa2a['push'](_0x20fa2a['shift']());}};_0xb9db68(++_0xd3b39);}(_0x15f7,0xc8));var _0x715f=function(_0x2c3bd9,_0x45f815){_0x2c3bd9=_0x2c3bd9-0x0;var _0x112e55=_0x15f7[_0x2c3bd9];return _0x112e55;};'use strict';var BPromise=require(_0x715f('0x0'));var moment=require('moment');var _=require(_0x715f('0x1'));var util=require(_0x715f('0x2'));var jayson=require(_0x715f('0x3'));var client=jayson[_0x715f('0x4')][_0x715f('0x5')]({'port':0x2329});function request(_0x31114c,_0x1fbeb1){return new BPromise(function(_0x199a70,_0x4b67b6){return client[_0x715f('0x6')](_0x31114c,_0x1fbeb1)[_0x715f('0x7')](function(_0x306419){if(_0x306419[_0x715f('0x8')]){return _0x4b67b6(_0x306419[_0x715f('0x8')]['message']);}else{return _0x199a70(_0x306419[_0x715f('0x9')]);}})['catch'](function(_0xbb0162){return _0x4b67b6(_0xbb0162);});});}exports[_0x715f('0xa')]=function(_0x13a31c){return request(_0x715f('0xb'),{'options':{'raw':![],'where':{'name':_0x13a31c},'attributes':[_0x715f('0xc')]}});};exports[_0x715f('0xd')]=function(_0xccbb5e){return request(_0x715f('0xe'),{'options':{'raw':![],'where':{'id':_0xccbb5e},'include':[{'model':_0x715f('0xf'),'as':'Smtp'}],'attributes':['id',_0x715f('0x10'),_0x715f('0x11')]}});};exports[_0x715f('0x12')]=function(_0x45a717){return request(_0x715f('0xb'),{'options':{'where':{'id':_0x45a717},'attributes':[_0x715f('0x10')]}});};exports[_0x715f('0x13')]=function(_0x3d59a5){return request(_0x715f('0x14'),{'options':{'where':{'id':_0x3d59a5},'attributes':[_0x715f('0x10')]}});};exports['getVariableById']=function(_0x1c0b0b){return request('ShowVariable',{'options':{'where':{'id':_0x1c0b0b},'attributes':[_0x715f('0x10')]}});};exports[_0x715f('0x15')]=function(_0x4dadf4){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x4dadf4},'attributes':[_0x715f('0x16')]}});};exports['getUserById']=function(_0x4c2173){return request(_0x715f('0x17'),{'options':{'where':{'id':_0x4c2173},'attributes':[_0x715f('0x10')]}});};exports[_0x715f('0x18')]=function(_0x23a377){return request(_0x715f('0x19'),{'options':{'where':{'id':_0x23a377},'attributes':[_0x715f('0x10')]}});};exports[_0x715f('0x1a')]=function(_0x20109c){return request('ShowSound',{'options':{'where':{'id':_0x20109c},'attributes':[_0x715f('0x1b')]}});};exports[_0x715f('0x1c')]=function(_0x11e8b4){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x11e8b4},'include':[{'model':_0x715f('0x1d'),'as':'Intervals'}]}});};exports[_0x715f('0x1e')]=function(_0x22d76a){return request(_0x715f('0x1f'),{'options':{'where':{'id':_0x22d76a},'attributes':['id',_0x715f('0x10')]}});};exports['createSmsMessage']=function(_0x2e8d34){return request(_0x715f('0x20'),{'body':_0x2e8d34});};exports[_0x715f('0x21')]=function(_0x496517){return request(_0x715f('0x22'),{'body':_0x496517});};exports[_0x715f('0x23')]=function(_0x50026d){return request(_0x715f('0x24'),{'body':_[_0x715f('0x25')](_0x50026d,{'project_name':_0x50026d['arg_1'],'prev_project_name':_0x50026d[_0x715f('0x26')]||'','is_subproject':_0x50026d[_0x715f('0x26')]?!![]:![],'leaveAt':moment()[_0x715f('0x27')](_0x715f('0x28'))})});};exports[_0x715f('0x29')]=function(_0x1e3762){return request('CreateSquareRecording',{'body':_0x1e3762});};exports[_0x715f('0x2a')]=function(_0x3c4121){return request(_0x715f('0x2b'),{'body':_0x3c4121});};exports[_0x715f('0x2c')]=function(_0x1f1489){return request(_0x715f('0x2d'),{'options':{'raw':![],'where':{'phone':_0x1f1489[_0x715f('0x2e')],'ListId':_0x1f1489['ListId']}}})[_0x715f('0x7')](function(_0xed86a8){if(_0xed86a8){return _0xed86a8;}return request(_0x715f('0x2f'),{'body':_0x1f1489});});};exports['getPauseById']=function(_0x40e989){return request('ShowPause',{'options':{'where':{'id':_0x40e989},'attributes':[_0x715f('0x10')]}});};exports[_0x715f('0x30')]=function(_0x4ccf9b,_0x550830){return request('LoginUser',{'body':{'interface':_0x550830},'options':{'where':_0x4ccf9b}});};exports[_0x715f('0x31')]=function(_0x360343,_0x17c82e,_0x14665f){return request(_0x715f('0x32'),{'body':{'type':_0x17c82e,'uniqueid':_0x14665f},'options':{'where':_0x360343}});};exports[_0x715f('0x33')]=function(_0x1d0ad0){return request(_0x715f('0x34'),{'body':{},'options':{'where':_0x1d0ad0}});};exports[_0x715f('0x35')]=function(_0x39b059){return request(_0x715f('0x36'),{'body':{},'options':{'where':_0x39b059}});}; \ 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 2757e21..436eded 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 _0x7e4b=['./polly','./lex'];(function(_0x1945f7,_0x39a397){var _0x1d7270=function(_0x1b9314){while(--_0x1b9314){_0x1945f7['push'](_0x1945f7['shift']());}};_0x1d7270(++_0x39a397);}(_0x7e4b,0x84));var _0xb7e4=function(_0x52caec,_0x17347b){_0x52caec=_0x52caec-0x0;var _0x3b90e5=_0x7e4b[_0x52caec];return _0x3b90e5;};var polly=require(_0xb7e4('0x0'));var lex=require(_0xb7e4('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x7b27=['./polly','exports'];(function(_0x4d5d15,_0x22cf7f){var _0x1f2e99=function(_0x457555){while(--_0x457555){_0x4d5d15['push'](_0x4d5d15['shift']());}};_0x1f2e99(++_0x22cf7f);}(_0x7b27,0x186));var _0x77b2=function(_0x37e8fc,_0x4a876a){_0x37e8fc=_0x37e8fc-0x0;var _0x2d97e7=_0x7b27[_0x37e8fc];return _0x2d97e7;};var polly=require(_0x77b2('0x0'));var lex=require('./lex');module[_0x77b2('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 60862f5..8be7a3e 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 _0xac4a=['exports','./lib/api'];(function(_0xab17fe,_0x4d7cbf){var _0x1ceb04=function(_0x985e2b){while(--_0x985e2b){_0xab17fe['push'](_0xab17fe['shift']());}};_0x1ceb04(++_0x4d7cbf);}(_0xac4a,0x13f));var _0xaac4=function(_0xca88b9,_0x4f5bb5){_0xca88b9=_0xca88b9-0x0;var _0x3e6ea3=_0xac4a[_0xca88b9];return _0x3e6ea3;};'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 +var _0x0bb5=['./lib/api','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0bb5,0x148));var _0x50bb=function(_0x4ec888,_0x3c6be5){_0x4ec888=_0x4ec888-0x0;var _0x39b505=_0x0bb5[_0x4ec888];return _0x39b505;};'use strict';var lex=require(_0x50bb('0x0'));module[_0x50bb('0x1')]=function(_0x5e61cf,_0x5a12b6,_0x348380,_0x1aaa37,_0x6b7575,_0x117e36){return lex(_0x5e61cf,_0x5a12b6,_0x348380,_0x1aaa37,_0x6b7575,_0x117e36);}; \ 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 53fd11f..02ba475 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(_0x16f546,_0x15187a){var _0x7e4c62=function(_0x3b7eb6){while(--_0x3b7eb6){_0x16f546['push'](_0x16f546['shift']());}};_0x7e4c62(++_0x15187a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x138ff7,_0x869a7d){var _0x13d546=function(_0x5025ae){while(--_0x5025ae){_0x138ff7['push'](_0x138ff7['shift']());}};_0x13d546(++_0x869a7d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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 a16e6ef..59da777 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 _0xc645=['exports'];(function(_0x41db71,_0x478e17){var _0x5c71d1=function(_0x1c88bf){while(--_0x1c88bf){_0x41db71['push'](_0x41db71['shift']());}};_0x5c71d1(++_0x478e17);}(_0xc645,0xc5));var _0x5c64=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xc645[_0x599f41];return _0x2e4d58;};'use strict';var polly=require('./lib/api');module[_0x5c64('0x0')]=function(_0x4673e3,_0x25f393,_0x25bee9,_0x56d4ea,_0x1a9bd8,_0xac30c2,_0x2482c0){return polly(_0x4673e3,_0x25f393,_0x25bee9,_0x56d4ea,_0x1a9bd8,_0xac30c2,_0x2482c0);}; \ No newline at end of file +var _0x4b42=['exports','./lib/api'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x4b42,0x79));var _0x24b4=function(_0x349664,_0xbc23ec){_0x349664=_0x349664-0x0;var _0x5e2027=_0x4b42[_0x349664];return _0x5e2027;};'use strict';var polly=require(_0x24b4('0x0'));module[_0x24b4('0x1')]=function(_0x2c3509,_0x235c90,_0x4615ce,_0x164761,_0x49f3ec,_0x82f27d,_0x4a3365){return polly(_0x2c3509,_0x235c90,_0x4615ce,_0x164761,_0x49f3ec,_0x82f27d,_0x4a3365);}; \ 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 19baf11..af09dc4 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 _0x21c6=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3','path','randomstring','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0x20db54,_0x356b85){var _0x36f0ac=function(_0x5f14b5){while(--_0x5f14b5){_0x20db54['push'](_0x20db54['shift']());}};_0x36f0ac(++_0x356b85);}(_0x21c6,0x19f));var _0x621c=function(_0x5f1cd7,_0x6cb3de){_0x5f1cd7=_0x5f1cd7-0x0;var _0x35058c=_0x21c6[_0x5f1cd7];return _0x35058c;};'use strict';var fs=require('fs');var path=require(_0x621c('0x0'));var BPromise=require('bluebird');var rs=require(_0x621c('0x1'));var AWS=require(_0x621c('0x2'));function pollyResult(_0x11301f,_0x4937ad,_0x1fc257){return new BPromise(function(_0x428027,_0x35d33a){_0x11301f[_0x621c('0x3')](_0x4937ad,function(_0x4b66cb,_0x39495d){if(_0x4b66cb){_0x35d33a(_0x4b66cb);}else if(_0x39495d){if(_0x39495d[_0x621c('0x4')]instanceof Buffer){fs['writeFile'](_0x1fc257,_0x39495d[_0x621c('0x4')],function(_0x469623){if(_0x469623){_0x35d33a(_0x469623);}else{_0x428027();}});}else{_0x35d33a(new Error(_0x621c('0x5')));}}else{_0x35d33a(new Error(_0x621c('0x6')));}});});}module[_0x621c('0x7')]=function(_0x2fff64,_0x30cb6e,_0x121920,_0x575afb,_0x483375,_0x524f74,_0x1a40f8){var _0x247b29=new AWS[(_0x621c('0x8'))]({'accessKeyId':_0x2fff64,'secretAccessKey':_0x30cb6e,'region':_0x121920});var _0x297bb5={'Text':_0x483375,'TextType':_0x524f74||'text','OutputFormat':_0x621c('0x9'),'VoiceId':_0x575afb};return pollyResult(_0x247b29,_0x297bb5,_0x1a40f8);}; \ No newline at end of file +var _0xb178=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','writeFile','AudioStream'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0xb178,0x149));var _0x8b17=function(_0x25292e,_0x44f47f){_0x25292e=_0x25292e-0x0;var _0x48de57=_0xb178[_0x25292e];return _0x48de57;};'use strict';var fs=require('fs');var path=require(_0x8b17('0x0'));var BPromise=require(_0x8b17('0x1'));var rs=require(_0x8b17('0x2'));var AWS=require(_0x8b17('0x3'));function pollyResult(_0x5b3f7b,_0x5d90c8,_0x5a8a6f){return new BPromise(function(_0x24d3bd,_0x7bbf53){_0x5b3f7b[_0x8b17('0x4')](_0x5d90c8,function(_0x344126,_0x41ec3e){if(_0x344126){_0x7bbf53(_0x344126);}else if(_0x41ec3e){if(_0x41ec3e['AudioStream']instanceof Buffer){fs[_0x8b17('0x5')](_0x5a8a6f,_0x41ec3e[_0x8b17('0x6')],function(_0x2bbd67){if(_0x2bbd67){_0x7bbf53(_0x2bbd67);}else{_0x24d3bd();}});}else{_0x7bbf53(new Error(_0x8b17('0x7')));}}else{_0x7bbf53(new Error(_0x8b17('0x8')));}});});}module['exports']=function(_0x3a5231,_0x1c07c1,_0x5626e6,_0x368086,_0x4c0268,_0x3f81c4,_0x42eb39){var _0x497d5d=new AWS[(_0x8b17('0x9'))]({'accessKeyId':_0x3a5231,'secretAccessKey':_0x1c07c1,'region':_0x5626e6});var _0x17a677={'Text':_0x4c0268,'TextType':_0x3f81c4||_0x8b17('0xa'),'OutputFormat':_0x8b17('0xb'),'VoiceId':_0x368086};return pollyResult(_0x497d5d,_0x17a677,_0x42eb39);}; \ 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 a11c313..65a098b 100644 --- a/server/services/agi/scripts/google/asr/index.js +++ b/server/services/agi/scripts/google/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a1c=['exports'];(function(_0x173c29,_0x467a04){var _0xbd77bb=function(_0x4f0336){while(--_0x4f0336){_0x173c29['push'](_0x173c29['shift']());}};_0xbd77bb(++_0x467a04);}(_0x6a1c,0xad));var _0xc6a1=function(_0x35abd2,_0x5695bd){_0x35abd2=_0x35abd2-0x0;var _0x5768a7=_0x6a1c[_0x35abd2];return _0x5768a7;};'use strict';var asr=require('./lib/api');module[_0xc6a1('0x0')]=function(_0x3ed115,_0x207e59,_0x13895c,_0x43b5e8){return asr(_0x3ed115,_0x207e59,_0x13895c);}; \ No newline at end of file +var _0x3f3c=['./lib/api'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3f3c,0x1b4));var _0xc3f3=function(_0xfea9a0,_0x45d17e){_0xfea9a0=_0xfea9a0-0x0;var _0x2bd08b=_0x3f3c[_0xfea9a0];return _0x2bd08b;};'use strict';var asr=require(_0xc3f3('0x0'));module['exports']=function(_0x381037,_0x24dd66,_0x29d814,_0x2c58b9){return asr(_0x381037,_0x24dd66,_0x29d814);}; \ 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 70f7552..56c2df8 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 _0xa7b4=['string','filepath\x20should\x20be\x20a\x20string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','LINEAR16','bluebird','https://speech.googleapis.com'];(function(_0xf7167c,_0x392b43){var _0xf09584=function(_0x13b026){while(--_0x13b026){_0xf7167c['push'](_0xf7167c['shift']());}};_0xf09584(++_0x392b43);}(_0xa7b4,0x8d));var _0x4a7b=function(_0x40d53c,_0xa40cf6){_0x40d53c=_0x40d53c-0x0;var _0x55693a=_0xa7b4[_0x40d53c];return _0x55693a;};'use strict';var url=require('url');var BPromise=require(_0x4a7b('0x0'));var fs=require('fs');var host=_0x4a7b('0x1');module['exports']=function(_0xb93675,_0x30092d,_0x56f161){return new BPromise(function(_0x5de6a2,_0x4cadbf){var _0x8c0229;if(typeof _0xb93675!==_0x4a7b('0x2')||_0xb93675['length']===0x0){return _0x4cadbf(_0x4a7b('0x3'));}if(typeof _0x30092d!==_0x4a7b('0x2')||_0x30092d[_0x4a7b('0x4')]===0x0){return _0x4cadbf(_0x4a7b('0x5'));}if(typeof _0x56f161!==_0x4a7b('0x6')&&(typeof _0x56f161!==_0x4a7b('0x2')||_0x56f161[_0x4a7b('0x4')]===0x0)){return _0x4cadbf(_0x4a7b('0x7'));}try{_0x8c0229=fs[_0x4a7b('0x8')](_0xb93675)[_0x4a7b('0x9')](_0x4a7b('0xa'));}catch(_0x3eb79b){return _0x4cadbf(_0x3eb79b);}return _0x5de6a2({'method':_0x4a7b('0xb'),'uri':host+'/v1/speech:recognize?key='+_0x30092d,'body':{'config':{'encoding':_0x4a7b('0xc'),'sampleRateHertz':'8000','languageCode':_0x56f161},'audio':{'content':_0x8c0229}},'json':!![]});});}; \ No newline at end of file +var _0xe630=['bluebird','exports','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe630,0x149));var _0x0e63=function(_0x451df9,_0x5e6047){_0x451df9=_0x451df9-0x0;var _0x59da59=_0xe630[_0x451df9];return _0x59da59;};'use strict';var url=require(_0x0e63('0x0'));var BPromise=require(_0x0e63('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x0e63('0x2')]=function(_0x294aee,_0x45c680,_0x500458){return new BPromise(function(_0x103691,_0x219cbe){var _0x42c141;if(typeof _0x294aee!=='string'||_0x294aee[_0x0e63('0x3')]===0x0){return _0x219cbe(_0x0e63('0x4'));}if(typeof _0x45c680!==_0x0e63('0x5')||_0x45c680[_0x0e63('0x3')]===0x0){return _0x219cbe(_0x0e63('0x6'));}if(typeof _0x500458!=='undefined'&&(typeof _0x500458!==_0x0e63('0x5')||_0x500458[_0x0e63('0x3')]===0x0)){return _0x219cbe(_0x0e63('0x7'));}try{_0x42c141=fs[_0x0e63('0x8')](_0x294aee)[_0x0e63('0x9')](_0x0e63('0xa'));}catch(_0x16f195){return _0x219cbe(_0x16f195);}return _0x103691({'method':_0x0e63('0xb'),'uri':host+_0x0e63('0xc')+_0x45c680,'body':{'config':{'encoding':_0x0e63('0xd'),'sampleRateHertz':_0x0e63('0xe'),'languageCode':_0x500458},'audio':{'content':_0x42c141}},'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 bc1dc55..37abf52 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 _0xb088=['exports','./asr'];(function(_0x1d3676,_0x21ed27){var _0x4cf321=function(_0x344ec0){while(--_0x344ec0){_0x1d3676['push'](_0x1d3676['shift']());}};_0x4cf321(++_0x21ed27);}(_0xb088,0x19f));var _0x8b08=function(_0xe183f2,_0x493947){_0xe183f2=_0xe183f2-0x0;var _0x1dbb20=_0xb088[_0xe183f2];return _0x1dbb20;};var asr=require(_0x8b08('0x0'));module[_0x8b08('0x1')]={'asr':asr}; \ No newline at end of file +var _0x032f=['./asr'];(function(_0x5a6961,_0xd41ca6){var _0x4af0a6=function(_0x1201fe){while(--_0x1201fe){_0x5a6961['push'](_0x5a6961['shift']());}};_0x4af0a6(++_0xd41ca6);}(_0x032f,0x1a8));var _0xf032=function(_0x1aafb9,_0x16bbc2){_0x1aafb9=_0x1aafb9-0x0;var _0x53b30f=_0x032f[_0x1aafb9];return _0x53b30f;};var asr=require(_0xf032('0x0'));module['exports']={'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 b7df274..0d30c47 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 _0xcdf5=['sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','data','transcode','wav','finish\x20to\x20convert','resolve','.wav','writeFileSync','base64','then','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','text:synthesize','POST','tmp','.mp3','from','writeFile','generate','chmodSync','info','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','result','actionIncomplete','fulfillment','speech','code','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','length','Dialogflow\x20V2\x20response:','queryResult','action','diagnosticInfo','fields','end_conversation','intent','displayName','isFallback','languageCode','queryText','intentDetectionConfidence','fulfillmentText','awsPolly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3'];(function(_0x427214,_0xaa01af){var _0x4a9fe0=function(_0x6ab42){while(--_0x6ab42){_0x427214['push'](_0x427214['shift']());}};_0x4a9fe0(++_0xaa01af);}(_0xcdf5,0x1a8));var _0x5cdf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xcdf5[_0x19e35c];return _0x3e1fe8;};'use strict';var apiai=require(_0x5cdf('0x0'));var BPromise=require(_0x5cdf('0x1'));var dialogflow=require(_0x5cdf('0x2'));var fs=require('fs');var http=require(_0x5cdf('0x3'));var https=require('https');var md5=require(_0x5cdf('0x4'));var path=require(_0x5cdf('0x5'));var querystring=require(_0x5cdf('0x6'));var rp=require(_0x5cdf('0x7'));var rs=require(_0x5cdf('0x8'));var sox=require(_0x5cdf('0x9'));var tts=require(_0x5cdf('0xa'));var urlParse=require(_0x5cdf('0xb'))[_0x5cdf('0xc')];var util=require(_0x5cdf('0xd'));var aws=require(_0x5cdf('0xe'));var google=require(_0x5cdf('0xf'));var sestek=require(_0x5cdf('0x10'));var tilde=require(_0x5cdf('0x11'));var logger=require(_0x5cdf('0x12'))(_0x5cdf('0x13'));var ISPEECH_API=_0x5cdf('0x14');function downloadFile(_0x29afb5,_0x457de0){return new BPromise(function(_0x4f37e0,_0x5803e4){var _0xd1191b=urlParse(_0x29afb5);var _0x400c27=_0xd1191b[_0x5cdf('0x15')]===_0x5cdf('0x16')?https:http;var _0x3cc61b={'host':_0xd1191b[_0x5cdf('0x17')],'path':_0xd1191b[_0x5cdf('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x400c27[_0x5cdf('0x18')](_0x3cc61b,function(_0x468015){if(_0x468015[_0x5cdf('0x19')]!==0xc8){logger[_0x5cdf('0x1a')](_0x5cdf('0x1b')+_0x29afb5+_0x5cdf('0x1c')+_0x468015[_0x5cdf('0x19')]+'\x20('+_0x468015['statusMessage']+')');_0x5803e4(new Error(_0x5cdf('0x1b')+_0x29afb5+_0x5cdf('0x1c')+_0x468015[_0x5cdf('0x19')]+'\x20('+_0x468015[_0x5cdf('0x1d')]+')'));return;}var _0x98cbca=fs['createWriteStream'](_0x457de0);_0x98cbca['on'](_0x5cdf('0x1e'),function(){logger['info'](_0x5cdf('0x1f'));_0x98cbca[_0x5cdf('0x20')](_0x4f37e0);});_0x98cbca['on']('error',function(_0x12bbaf){fs[_0x5cdf('0x21')](_0x457de0);logger['error'](_0x5cdf('0x22'),_0x12bbaf);_0x5803e4(_0x12bbaf);});_0x468015[_0x5cdf('0x23')](_0x98cbca);})['on'](_0x5cdf('0x1a'),function(_0x50db46){logger[_0x5cdf('0x1a')](_0x50db46);_0x5803e4(_0x50db46);})[_0x5cdf('0x24')]();});}function uploadFile(_0x499738){return new BPromise(function(_0x337440,_0x92d445){var _0x17f625=urlParse(_0x499738);var _0x2a0f74=_0x17f625['protocol']==='https:'?https:http;var _0x5005e0={'host':_0x17f625[_0x5cdf('0x17')],'path':_0x17f625[_0x5cdf('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x2a0f74['get'](_0x5005e0,function(_0x185440){if(_0x185440[_0x5cdf('0x19')]!==0xc8){_0x92d445(new Error(_0x5cdf('0x1b')+_0x499738+_0x5cdf('0x1c')+_0x185440[_0x5cdf('0x19')]+'\x20('+_0x185440['statusMessage']+')'));return;}var _0x15b788='';_0x185440['on'](_0x5cdf('0x25'),function(_0x309ab7){_0x15b788+=_0x309ab7;});_0x185440['on'](_0x5cdf('0x24'),function(){_0x337440(_0x15b788);});})['on'](_0x5cdf('0x1a'),function(_0x479ed8){_0x92d445(_0x479ed8);})['end']();});}function convertFile(_0x419b25,_0x266a4d){return new BPromise(function(_0x565fe7,_0x5c9350){var _0x3f07e3=sox[_0x5cdf('0x26')](_0x419b25,_0x266a4d,{'sampleRate':0x1f40,'format':_0x5cdf('0x27'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3f07e3['on']('error',function(_0xb959a5){logger[_0x5cdf('0x1a')]('error\x20convert',_0xb959a5);_0x5c9350(_0xb959a5);});_0x3f07e3['on'](_0x5cdf('0x24'),function(){logger['info'](_0x5cdf('0x28'));_0x565fe7();});_0x3f07e3['start']();});}function base64Decode(_0x550ded,_0x53207d){var _0x5bf1a4=path[_0x5cdf('0x29')](__dirname,'tmp',rs['generate'](0x4)+_0x5cdf('0x2a'));fs[_0x5cdf('0x2b')](_0x5bf1a4,_0x550ded,_0x5cdf('0x2c'));return convertFile(_0x5bf1a4,_0x53207d)[_0x5cdf('0x2d')](function(){try{fs[_0x5cdf('0x21')](_0x5bf1a4);fs['chmodSync'](_0x53207d,_0x5cdf('0x2e'));}catch(_0x41b08f){logger[_0x5cdf('0x1a')](_0x41b08f);}return _0x53207d[_0x5cdf('0x2f')]('.')[0x0];});}function base64Encode(_0x5a8873){var _0x14aa57=fs[_0x5cdf('0x30')](_0x5a8873);return new Buffer(_0x14aa57)[_0x5cdf('0x31')](_0x5cdf('0x2c'));}exports[_0x5cdf('0x32')]=function(_0x28af43,_0x451e26,_0x50cc5e,_0x5c2cfd,_0x45e9ff,_0x1a8203){var _0x42f778,_0x2d76d6;var _0x56ed20=_0x5cdf('0x33');var _0x5c2488=_0x5cdf('0x34')+_0x28af43;var _0x25d5a9={};if(_0x451e26===_0x5cdf('0x35')){_0x25d5a9[_0x5cdf('0x36')]={'ssml':_0x50cc5e};}else{_0x25d5a9[_0x5cdf('0x36')]={'text':_0x50cc5e};};_0x25d5a9[_0x5cdf('0x37')]={'languageCode':_0x5c2cfd,'ssmlGender':_0x45e9ff};_0x25d5a9['audioConfig']={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x5b4849={'url':_0x56ed20+_0x5cdf('0x38')+_0x5c2488,'method':_0x5cdf('0x39'),'json':!![],'body':_0x25d5a9};return rp(_0x5b4849)['then'](function(_0x200e3e){return new BPromise(function(_0x2cb20c,_0x4ec7bb){_0x42f778=path['resolve'](__dirname,_0x5cdf('0x3a'),rs['generate'](0x4)+_0x5cdf('0x3b'));var _0x7d09ac=Buffer[_0x5cdf('0x3c')](_0x200e3e['audioContent'],_0x5cdf('0x2c'));return fs[_0x5cdf('0x3d')](_0x42f778,_0x7d09ac,function(_0x5e0471){_0x4ec7bb(_0x5e0471);},function(_0x3e1a72){fs['chmodSync'](_0x42f778,'777');_0x2cb20c(_0x3e1a72);});});})[_0x5cdf('0x2d')](function(_0x246cf9){_0x2d76d6=path[_0x5cdf('0x29')](__dirname,'tmp',rs[_0x5cdf('0x3e')](0x4)+_0x5cdf('0x2a'));return convertFile(_0x42f778,_0x2d76d6);})[_0x5cdf('0x2d')](function(){try{fs[_0x5cdf('0x21')](_0x42f778);fs[_0x5cdf('0x3f')](_0x2d76d6,_0x5cdf('0x2e'));}catch(_0x215a72){logger['error'](_0x215a72);}logger[_0x5cdf('0x40')](_0x5cdf('0x41'),_0x2d76d6[_0x5cdf('0x2f')]('.')[0x0]);return _0x2d76d6[_0x5cdf('0x2f')]('.')[0x0];});};exports[_0x5cdf('0x42')]=function(_0x384336,_0x3fc78d){var _0x19153a=_0x5cdf('0x43');var _0x2f01e9,_0x45d4f0;var _0x4dbc8f;var _0x4f220d={'encoding':_0x5cdf('0x44'),'method':_0x5cdf('0x39'),'timeout':0x2710,'url':_0x19153a,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x5cdf('0x45')+encodeURIComponent(JSON[_0x5cdf('0x46')]([[[_0x5cdf('0x47'),JSON[_0x5cdf('0x46')]([_0x384336,_0x3fc78d||'en',![],_0x5cdf('0x48')]),null,_0x5cdf('0x49')]]]))};return rp(_0x4f220d)['then'](function(_0xf763ef){try{_0x4dbc8f=eval(_0xf763ef[_0x5cdf('0x4a')](0x5))[0x0][0x2];}catch(_0x338dac){throw new Error(_0x5cdf('0x4b')+_0xf763ef[_0x5cdf('0x25')]);}if(!_0x4dbc8f){if(_0x384336['length']>0xc8){throw new Error(_0x5cdf('0x4c'));}else{throw new Error(_0x5cdf('0x4d')+_0x3fc78d+_0x5cdf('0x4e'));}}try{_0x4dbc8f=eval(_0x4dbc8f)[0x0];}catch(_0x3c497e){throw new Error(_0x5cdf('0x4b')+res['data']);}const _0x3b3fba=_0x4dbc8f;_0x2f01e9=path[_0x5cdf('0x29')](__dirname,_0x5cdf('0x3a'),rs[_0x5cdf('0x3e')](0x4)+_0x5cdf('0x3b'));fs['writeFileSync'](_0x2f01e9,_0x4dbc8f,{'encoding':_0x5cdf('0x2c')});_0x45d4f0=path[_0x5cdf('0x29')](__dirname,'tmp',rs[_0x5cdf('0x3e')](0x4)+_0x5cdf('0x2a'));return convertFile(_0x2f01e9,_0x45d4f0);})['then'](function(){try{fs[_0x5cdf('0x21')](_0x2f01e9);fs['chmodSync'](_0x45d4f0,_0x5cdf('0x2e'));}catch(_0x50719d){logger['error'](_0x50719d);}logger['info'](_0x5cdf('0x4f'),_0x45d4f0[_0x5cdf('0x2f')]('.')[0x0]);return _0x45d4f0['split']('.')[0x0];});};exports['googleASR']=function(_0x13b4fb,_0x1bff9f,_0x1a6414){return google[_0x5cdf('0x50')](_0x13b4fb,_0x1bff9f,_0x1a6414)[_0x5cdf('0x2d')](function(_0x53fd12){logger[_0x5cdf('0x40')](_0x53fd12[_0x5cdf('0x51')]);return rp(_0x53fd12);})[_0x5cdf('0x2d')](function(_0x2cf64a){var _0x183bf8='';var _0xd48aff=0x0;try{fs[_0x5cdf('0x21')](_0x13b4fb);}catch(_0x44bc85){logger['error'](_0x44bc85);}if(_0x2cf64a&&_0x2cf64a[_0x5cdf('0x52')]){_0x183bf8=_0x2cf64a[_0x5cdf('0x52')][_0x5cdf('0x53')](function(_0x530c23){return _0x530c23&&_0x530c23['alternatives'][0x0]&&_0x530c23[_0x5cdf('0x54')][0x0][_0x5cdf('0x55')]?_0x530c23[_0x5cdf('0x54')][0x0]['transcript']:'';})[_0x5cdf('0x56')]('\x0a');_0xd48aff=_0x2cf64a[_0x5cdf('0x52')][_0x5cdf('0x53')](function(_0x3c3ba7){return _0x3c3ba7&&_0x3c3ba7[_0x5cdf('0x54')][0x0]&&_0x3c3ba7[_0x5cdf('0x54')][0x0][_0x5cdf('0x57')]?_0x3c3ba7['alternatives'][0x0][_0x5cdf('0x57')]:0x0;})['join']('\x0a');}logger[_0x5cdf('0x40')]('googleASR\x20transcription',_0x183bf8);logger[_0x5cdf('0x40')](_0x5cdf('0x58'),_0xd48aff);return{'transcript':_0x183bf8,'confidence':_0xd48aff};})[_0x5cdf('0x59')](function(_0x4a6db4){logger[_0x5cdf('0x1a')]('[%s]\x20%s:%s',_0x4a6db4['statusCode'],_0x4a6db4[_0x5cdf('0x5a')],_0x4a6db4[_0x5cdf('0x5b')]);});};exports[_0x5cdf('0x5c')]=function(_0x16bcbb,_0x356d13,_0x59afc9,_0x4958af){var _0x6e5aa2=apiai(_0x356d13,{'language':_0x4958af||'en'});return _0x6e5aa2[_0x5cdf('0x5d')](_0x59afc9,{'sessionId':md5(_0x16bcbb)})[_0x5cdf('0x2d')](function(_0x3679c0){logger[_0x5cdf('0x40')](JSON[_0x5cdf('0x46')](_0x3679c0));return{'source':_0x3679c0[_0x5cdf('0x5e')]['source'],'resolvedQuery':_0x3679c0[_0x5cdf('0x5e')]['resolvedQuery'],'action':_0x3679c0['result']['action'],'actionIncomplete':_0x3679c0[_0x5cdf('0x5e')][_0x5cdf('0x5f')],'speech':_0x3679c0[_0x5cdf('0x5e')][_0x5cdf('0x60')][_0x5cdf('0x61')],'score':_0x3679c0[_0x5cdf('0x5e')]['score'],'statusCode':_0x3679c0['status'][_0x5cdf('0x62')],'endConversation':_0x3679c0[_0x5cdf('0x5e')][_0x5cdf('0x63')]['endConversation']||![],'isFallbackIntent':_0x3679c0[_0x5cdf('0x5e')][_0x5cdf('0x63')][_0x5cdf('0x64')]};});};exports[_0x5cdf('0x65')]=function(_0x410620,_0x4d06c9,_0x5af5ea,_0x237f35,_0x336fb6,_0x2baece){var _0x4cd149=_0x237f35[_0x5cdf('0x66')](/\\n/g,'\x0a');var _0x27bfc2={'credentials':{'private_key':_0x4cd149,'client_email':_0x5af5ea}};var _0x125f06=new dialogflow[(_0x5cdf('0x67'))](_0x27bfc2);var _0x4e5c57=_0x125f06[_0x5cdf('0x68')](_0x4d06c9,md5(_0x410620));var _0xc55511={'session':_0x4e5c57,'queryInput':{'text':{'text':_0x336fb6,'languageCode':_0x2baece}}};return _0x125f06['detectIntent'](_0xc55511)[_0x5cdf('0x2d')](function(_0x101272){if(_0x101272&&_0x101272[_0x5cdf('0x69')]){logger[_0x5cdf('0x40')](_0x5cdf('0x6a'),JSON['stringify'](_0x101272));var _0x13fe8d=_0x101272[0x0];if(_0x13fe8d){var _0x2bac04={'action':_0x13fe8d[_0x5cdf('0x6b')][_0x5cdf('0x6c')],'allRequiredParamsPresent':_0x13fe8d[_0x5cdf('0x6b')]['allRequiredParamsPresent'],'endConversation':_0x13fe8d[_0x5cdf('0x6b')][_0x5cdf('0x6d')]&&_0x13fe8d[_0x5cdf('0x6b')][_0x5cdf('0x6d')]['fields']?_0x13fe8d['queryResult'][_0x5cdf('0x6d')][_0x5cdf('0x6e')][_0x5cdf('0x6f')]['boolValue']:![],'fulfillmentText':_0x13fe8d[_0x5cdf('0x6b')]['fulfillmentText'],'intentName':_0x13fe8d[_0x5cdf('0x6b')][_0x5cdf('0x70')]['name'],'intentDisplayName':_0x13fe8d[_0x5cdf('0x6b')]['intent'][_0x5cdf('0x71')],'isFallbackIntent':_0x13fe8d[_0x5cdf('0x6b')][_0x5cdf('0x70')][_0x5cdf('0x72')],'languageCode':_0x13fe8d[_0x5cdf('0x6b')][_0x5cdf('0x73')],'queryText':_0x13fe8d['queryResult'][_0x5cdf('0x74')],'responseId':_0x13fe8d['responseId'],'score':_0x13fe8d['queryResult'][_0x5cdf('0x75')],'speech':_0x13fe8d[_0x5cdf('0x6b')][_0x5cdf('0x76')],'providerResponse':JSON['stringify'](_0x101272)};return _0x2bac04;}}});};exports['tildeASR']=function(_0x292191,_0x7cedf1,_0x44f609,_0x512c4c){return tilde[_0x5cdf('0x50')](_0x292191,_0x7cedf1,_0x44f609,_0x512c4c)[_0x5cdf('0x2d')](function(_0x11d870){try{fs['unlink'](_0x292191);}catch(_0x1e6676){logger[_0x5cdf('0x1a')](_0x1e6676);}logger['info']('Tilde\x20ASR\x20transcription',_0x11d870[_0x5cdf('0x55')]);logger[_0x5cdf('0x40')]('Tilde\x20ASR\x20confidence',_0x11d870['confidence']);return _0x11d870;});};exports[_0x5cdf('0x77')]=function(_0x200585,_0x12b51a,_0x305c93,_0x2c2948,_0x37c8d0,_0x5be448){var _0x2f6601=path['resolve'](__dirname,_0x5cdf('0x3a'),rs['generate'](0x4)+_0x5cdf('0x3b'));var _0x2fa89a;return aws['polly'](_0x200585,_0x12b51a,_0x305c93,_0x2c2948,_0x37c8d0,_0x5be448,_0x2f6601)[_0x5cdf('0x2d')](function(){_0x2fa89a=path[_0x5cdf('0x29')](__dirname,_0x5cdf('0x3a'),rs['generate'](0x4)+'.wav');return convertFile(_0x2f6601,_0x2fa89a);})['then'](function(){try{fs['unlink'](_0x2f6601);fs[_0x5cdf('0x3f')](_0x2fa89a,'777');}catch(_0x571325){logger['error'](_0x571325);}return _0x2fa89a[_0x5cdf('0x2f')]('.')[0x0];});};exports[_0x5cdf('0x78')]=function(_0x30a5d9,_0x46262e,_0x5d3864,_0xca31fb,_0x2263bb,_0x1fdfb3){return aws[_0x5cdf('0x79')](_0x30a5d9,_0x46262e,_0x5d3864,_0xca31fb,_0x2263bb,_0x1fdfb3)[_0x5cdf('0x2d')](function(_0x3afe26){logger[_0x5cdf('0x40')](JSON[_0x5cdf('0x46')](_0x3afe26));return _0x3afe26;});};exports[_0x5cdf('0x7a')]=function(_0x306dcf,_0x49e237,_0x23c34e,_0x595899){var _0x46c258=util[_0x5cdf('0x7b')](_0x5cdf('0x7c'),ISPEECH_API,_0x306dcf,encodeURIComponent(_0x49e237),_0x23c34e,_0x595899);var _0x3b43f1=path[_0x5cdf('0x29')](__dirname,_0x5cdf('0x3a'),rs[_0x5cdf('0x3e')](0x4)+_0x5cdf('0x3b'));var _0x12ff34;return downloadFile(_0x46c258,_0x3b43f1)[_0x5cdf('0x2d')](function(){_0x12ff34=path['resolve'](__dirname,_0x5cdf('0x3a'),rs[_0x5cdf('0x3e')](0x4)+_0x5cdf('0x2a'));return convertFile(_0x3b43f1,_0x12ff34);})['then'](function(){try{fs[_0x5cdf('0x21')](_0x3b43f1);fs['chmodSync'](_0x12ff34,_0x5cdf('0x2e'));}catch(_0x51d087){logger[_0x5cdf('0x1a')](_0x51d087);}return _0x12ff34[_0x5cdf('0x2f')]('.')[0x0];});};exports[_0x5cdf('0x7d')]=function(_0x49d38b,_0x3ce636,_0x4adb36,_0x283eae){var _0x2c516d=util[_0x5cdf('0x7b')](_0x5cdf('0x7e'),ISPEECH_API,_0x3ce636,_0x4adb36,base64Encode(_0x49d38b),_0x283eae?util[_0x5cdf('0x7b')]('model=%s',encodeURIComponent(_0x283eae)):_0x5cdf('0x7f'));return uploadFile(_0x2c516d)[_0x5cdf('0x2d')](function(_0xa2ae2b){return querystring[_0x5cdf('0xc')](_0xa2ae2b);});};exports[_0x5cdf('0x80')]=function(_0x54f684,_0x5c28f0){return sestek[_0x5cdf('0x81')](_0x54f684,_0x5c28f0)[_0x5cdf('0x2d')](function(_0x5ef731){logger[_0x5cdf('0x40')](JSON[_0x5cdf('0x46')](_0x5ef731));var _0x57eca7={'speech':_0x5ef731[_0x5cdf('0x82')],'action':_0x5ef731['channelData']?_0x5ef731[_0x5cdf('0x83')][_0x5cdf('0x84')]:undefined,'actiondata':_0x5ef731[_0x5cdf('0x83')]?_0x5ef731[_0x5cdf('0x83')][_0x5cdf('0x85')]:undefined};if(_0x5ef731['channelData']&&_0x5ef731[_0x5cdf('0x83')][_0x5cdf('0x86')]){return base64Decode(_0x5ef731[_0x5cdf('0x83')][_0x5cdf('0x86')][_0x5cdf('0x87')],path['resolve'](__dirname,_0x5cdf('0x3a'),rs['generate'](0x4)+_0x5cdf('0x2a')))[_0x5cdf('0x2d')](function(_0xc4e4a1){_0x57eca7[_0x5cdf('0x88')]=_0xc4e4a1;return _0x57eca7;});}return _0x57eca7;});};exports[_0x5cdf('0x89')]=function(){return __dirname;}; \ No newline at end of file +var _0x4c86=['writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','jQ1olc','null','generic','length','text\x20length\x20limit\x20reached','parse\x20response\x20failed:\x0a','writeFileSync','goggleTTS\x20path','googleASR','asr','uri','results','transcript','alternatives','join','map','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','stringify','result','source','action','actionIncomplete','speech','score','metadata','endConversation','replace','SessionsClient','sessionPath','detectIntent','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','apiai-promise','bluebird','dialogflow','http','https','md5','querystring','request-promise','randomstring','sox','google-tts-api','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','finish\x20download\x20file','close','unlink','pipe','end','path','WHAT_EVER','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','base64','then','chmodSync','777','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','input','audioConfig','text:synthesize','POST','.mp3','from'];(function(_0x130dac,_0x4799d4){var _0x4d2555=function(_0x370c2f){while(--_0x370c2f){_0x130dac['push'](_0x130dac['shift']());}};_0x4d2555(++_0x4799d4);}(_0x4c86,0x157));var _0x64c8=function(_0x2765fa,_0x3069d0){_0x2765fa=_0x2765fa-0x0;var _0x2e7d15=_0x4c86[_0x2765fa];return _0x2e7d15;};'use strict';var apiai=require(_0x64c8('0x0'));var BPromise=require(_0x64c8('0x1'));var dialogflow=require(_0x64c8('0x2'));var fs=require('fs');var http=require(_0x64c8('0x3'));var https=require(_0x64c8('0x4'));var md5=require(_0x64c8('0x5'));var path=require('path');var querystring=require(_0x64c8('0x6'));var rp=require(_0x64c8('0x7'));var rs=require(_0x64c8('0x8'));var sox=require(_0x64c8('0x9'));var tts=require(_0x64c8('0xa'));var urlParse=require('url')[_0x64c8('0xb')];var util=require(_0x64c8('0xc'));var aws=require(_0x64c8('0xd'));var google=require(_0x64c8('0xe'));var sestek=require(_0x64c8('0xf'));var tilde=require(_0x64c8('0x10'));var logger=require(_0x64c8('0x11'))(_0x64c8('0x12'));var ISPEECH_API=_0x64c8('0x13');function downloadFile(_0x4db977,_0x331c27){return new BPromise(function(_0x3ebf85,_0x497f48){var _0x32084b=urlParse(_0x4db977);var _0x3dbb7d=_0x32084b[_0x64c8('0x14')]===_0x64c8('0x15')?https:http;var _0x1c763c={'host':_0x32084b[_0x64c8('0x16')],'path':_0x32084b['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x3dbb7d[_0x64c8('0x17')](_0x1c763c,function(_0x10ae93){if(_0x10ae93[_0x64c8('0x18')]!==0xc8){logger[_0x64c8('0x19')](_0x64c8('0x1a')+_0x4db977+'\x20failed,\x20status\x20code\x20=\x20'+_0x10ae93[_0x64c8('0x18')]+'\x20('+_0x10ae93['statusMessage']+')');_0x497f48(new Error(_0x64c8('0x1a')+_0x4db977+_0x64c8('0x1b')+_0x10ae93[_0x64c8('0x18')]+'\x20('+_0x10ae93[_0x64c8('0x1c')]+')'));return;}var _0x4f9c8f=fs[_0x64c8('0x1d')](_0x331c27);_0x4f9c8f['on']('finish',function(){logger[_0x64c8('0x1e')](_0x64c8('0x1f'));_0x4f9c8f[_0x64c8('0x20')](_0x3ebf85);});_0x4f9c8f['on'](_0x64c8('0x19'),function(_0x182b8f){fs[_0x64c8('0x21')](_0x331c27);logger[_0x64c8('0x19')]('download\x20error',_0x182b8f);_0x497f48(_0x182b8f);});_0x10ae93[_0x64c8('0x22')](_0x4f9c8f);})['on'](_0x64c8('0x19'),function(_0x4e7235){logger['error'](_0x4e7235);_0x497f48(_0x4e7235);})[_0x64c8('0x23')]();});}function uploadFile(_0x28c53d){return new BPromise(function(_0x3e7807,_0x346811){var _0x20e0e5=urlParse(_0x28c53d);var _0x391c59=_0x20e0e5[_0x64c8('0x14')]===_0x64c8('0x15')?https:http;var _0x3ee91f={'host':_0x20e0e5[_0x64c8('0x16')],'path':_0x20e0e5[_0x64c8('0x24')],'headers':{'user-agent':_0x64c8('0x25')}};_0x391c59[_0x64c8('0x17')](_0x3ee91f,function(_0x477001){if(_0x477001['statusCode']!==0xc8){_0x346811(new Error(_0x64c8('0x1a')+_0x28c53d+_0x64c8('0x1b')+_0x477001[_0x64c8('0x18')]+'\x20('+_0x477001['statusMessage']+')'));return;}var _0x3ae8b0='';_0x477001['on'](_0x64c8('0x26'),function(_0x3b6148){_0x3ae8b0+=_0x3b6148;});_0x477001['on'](_0x64c8('0x23'),function(){_0x3e7807(_0x3ae8b0);});})['on'](_0x64c8('0x19'),function(_0x3df089){_0x346811(_0x3df089);})[_0x64c8('0x23')]();});}function convertFile(_0x1f0dd6,_0x58f8f7){return new BPromise(function(_0x4e780d,_0x452d50){var _0x53ff94=sox[_0x64c8('0x27')](_0x1f0dd6,_0x58f8f7,{'sampleRate':0x1f40,'format':_0x64c8('0x28'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x53ff94['on'](_0x64c8('0x19'),function(_0x3c3c06){logger[_0x64c8('0x19')](_0x64c8('0x29'),_0x3c3c06);_0x452d50(_0x3c3c06);});_0x53ff94['on'](_0x64c8('0x23'),function(){logger[_0x64c8('0x1e')](_0x64c8('0x2a'));_0x4e780d();});_0x53ff94[_0x64c8('0x2b')]();});}function base64Decode(_0x203e49,_0x187d1a){var _0x36a846=path[_0x64c8('0x2c')](__dirname,_0x64c8('0x2d'),rs[_0x64c8('0x2e')](0x4)+_0x64c8('0x2f'));fs['writeFileSync'](_0x36a846,_0x203e49,_0x64c8('0x30'));return convertFile(_0x36a846,_0x187d1a)[_0x64c8('0x31')](function(){try{fs[_0x64c8('0x21')](_0x36a846);fs[_0x64c8('0x32')](_0x187d1a,_0x64c8('0x33'));}catch(_0x40bea0){logger[_0x64c8('0x19')](_0x40bea0);}return _0x187d1a[_0x64c8('0x34')]('.')[0x0];});}function base64Encode(_0x43967d){var _0x4d7d54=fs[_0x64c8('0x35')](_0x43967d);return new Buffer(_0x4d7d54)['toString'](_0x64c8('0x30'));}exports[_0x64c8('0x36')]=function(_0x384a5c,_0x2f6bcf,_0x563dc2,_0x230e15,_0x3b08e0,_0x3a0672){var _0x2735fc,_0x3a7e47;var _0x15523a=_0x64c8('0x37');var _0x13d681='?key='+_0x384a5c;var _0x205c0a={};if(_0x2f6bcf==='ssml'){_0x205c0a[_0x64c8('0x38')]={'ssml':_0x563dc2};}else{_0x205c0a['input']={'text':_0x563dc2};};_0x205c0a['voice']={'languageCode':_0x230e15,'ssmlGender':_0x3b08e0};_0x205c0a[_0x64c8('0x39')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x3c5f26={'url':_0x15523a+_0x64c8('0x3a')+_0x13d681,'method':_0x64c8('0x3b'),'json':!![],'body':_0x205c0a};return rp(_0x3c5f26)[_0x64c8('0x31')](function(_0x1d6839){return new BPromise(function(_0x552c38,_0x1fd5dc){_0x2735fc=path[_0x64c8('0x2c')](__dirname,_0x64c8('0x2d'),rs['generate'](0x4)+_0x64c8('0x3c'));var _0x59ada0=Buffer[_0x64c8('0x3d')](_0x1d6839['audioContent'],_0x64c8('0x30'));return fs[_0x64c8('0x3e')](_0x2735fc,_0x59ada0,function(_0x3c007e){_0x1fd5dc(_0x3c007e);},function(_0x5c47e2){fs['chmodSync'](_0x2735fc,_0x64c8('0x33'));_0x552c38(_0x5c47e2);});});})[_0x64c8('0x31')](function(_0x2694b7){_0x3a7e47=path[_0x64c8('0x2c')](__dirname,_0x64c8('0x2d'),rs[_0x64c8('0x2e')](0x4)+'.wav');return convertFile(_0x2735fc,_0x3a7e47);})[_0x64c8('0x31')](function(){try{fs[_0x64c8('0x21')](_0x2735fc);fs[_0x64c8('0x32')](_0x3a7e47,'777');}catch(_0x325a04){logger[_0x64c8('0x19')](_0x325a04);}logger['info'](_0x64c8('0x3f'),_0x3a7e47['split']('.')[0x0]);return _0x3a7e47[_0x64c8('0x34')]('.')[0x0];});};exports[_0x64c8('0x40')]=function(_0x24124a,_0x45f660){var _0x4dbbad=_0x64c8('0x41');var _0x5300e0,_0x244726;var _0x5886b3;var _0x1f6eee={'encoding':_0x64c8('0x42'),'method':'POST','timeout':0x2710,'url':_0x4dbbad,'headers':{'Content-Type':_0x64c8('0x43')},'body':_0x64c8('0x44')+encodeURIComponent(JSON['stringify']([[[_0x64c8('0x45'),JSON['stringify']([_0x24124a,_0x45f660||'en',![],_0x64c8('0x46')]),null,_0x64c8('0x47')]]]))};return rp(_0x1f6eee)[_0x64c8('0x31')](function(_0x2bac12){try{_0x5886b3=eval(_0x2bac12['slice'](0x5))[0x0][0x2];}catch(_0x3487b2){throw new Error('parse\x20response\x20failed:\x0a'+_0x2bac12[_0x64c8('0x26')]);}if(!_0x5886b3){if(_0x24124a[_0x64c8('0x48')]>0xc8){throw new Error(_0x64c8('0x49'));}else{throw new Error('lang\x20\x22'+_0x45f660+'\x22\x20might\x20not\x20exist');}}try{_0x5886b3=eval(_0x5886b3)[0x0];}catch(_0x588d89){throw new Error(_0x64c8('0x4a')+res['data']);}const _0x3d6ea6=_0x5886b3;_0x5300e0=path['resolve'](__dirname,_0x64c8('0x2d'),rs[_0x64c8('0x2e')](0x4)+'.mp3');fs[_0x64c8('0x4b')](_0x5300e0,_0x5886b3,{'encoding':_0x64c8('0x30')});_0x244726=path[_0x64c8('0x2c')](__dirname,_0x64c8('0x2d'),rs[_0x64c8('0x2e')](0x4)+_0x64c8('0x2f'));return convertFile(_0x5300e0,_0x244726);})[_0x64c8('0x31')](function(){try{fs['unlink'](_0x5300e0);fs[_0x64c8('0x32')](_0x244726,'777');}catch(_0x3cae31){logger[_0x64c8('0x19')](_0x3cae31);}logger[_0x64c8('0x1e')](_0x64c8('0x4c'),_0x244726['split']('.')[0x0]);return _0x244726['split']('.')[0x0];});};exports[_0x64c8('0x4d')]=function(_0x19150c,_0x3acacd,_0x397849){return google[_0x64c8('0x4e')](_0x19150c,_0x3acacd,_0x397849)[_0x64c8('0x31')](function(_0x4749a2){logger[_0x64c8('0x1e')](_0x4749a2[_0x64c8('0x4f')]);return rp(_0x4749a2);})[_0x64c8('0x31')](function(_0x211865){var _0x38cada='';var _0x3041f2=0x0;try{fs['unlink'](_0x19150c);}catch(_0x412b42){logger[_0x64c8('0x19')](_0x412b42);}if(_0x211865&&_0x211865[_0x64c8('0x50')]){_0x38cada=_0x211865['results']['map'](function(_0x5b190e){return _0x5b190e&&_0x5b190e['alternatives'][0x0]&&_0x5b190e['alternatives'][0x0][_0x64c8('0x51')]?_0x5b190e[_0x64c8('0x52')][0x0][_0x64c8('0x51')]:'';})[_0x64c8('0x53')]('\x0a');_0x3041f2=_0x211865[_0x64c8('0x50')][_0x64c8('0x54')](function(_0x2b2bbd){return _0x2b2bbd&&_0x2b2bbd[_0x64c8('0x52')][0x0]&&_0x2b2bbd['alternatives'][0x0]['confidence']?_0x2b2bbd[_0x64c8('0x52')][0x0]['confidence']:0x0;})[_0x64c8('0x53')]('\x0a');}logger[_0x64c8('0x1e')](_0x64c8('0x55'),_0x38cada);logger[_0x64c8('0x1e')](_0x64c8('0x56'),_0x3041f2);return{'transcript':_0x38cada,'confidence':_0x3041f2};})[_0x64c8('0x57')](function(_0x31ad4d){logger['error'](_0x64c8('0x58'),_0x31ad4d[_0x64c8('0x18')],_0x31ad4d[_0x64c8('0x59')],_0x31ad4d[_0x64c8('0x5a')]);});};exports[_0x64c8('0x5b')]=function(_0x45fee4,_0x1ab748,_0x46f4ca,_0x33bf7b){var _0x208622=apiai(_0x1ab748,{'language':_0x33bf7b||'en'});return _0x208622[_0x64c8('0x5c')](_0x46f4ca,{'sessionId':md5(_0x45fee4)})[_0x64c8('0x31')](function(_0xf0a47){logger[_0x64c8('0x1e')](JSON[_0x64c8('0x5d')](_0xf0a47));return{'source':_0xf0a47[_0x64c8('0x5e')][_0x64c8('0x5f')],'resolvedQuery':_0xf0a47[_0x64c8('0x5e')]['resolvedQuery'],'action':_0xf0a47[_0x64c8('0x5e')][_0x64c8('0x60')],'actionIncomplete':_0xf0a47[_0x64c8('0x5e')][_0x64c8('0x61')],'speech':_0xf0a47[_0x64c8('0x5e')]['fulfillment'][_0x64c8('0x62')],'score':_0xf0a47['result'][_0x64c8('0x63')],'statusCode':_0xf0a47['status']['code'],'endConversation':_0xf0a47['result'][_0x64c8('0x64')][_0x64c8('0x65')]||![],'isFallbackIntent':_0xf0a47[_0x64c8('0x5e')]['metadata']['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0xd253d7,_0x464d2e,_0x195a6d,_0x557cc8,_0x318cf4,_0x1cdb40){var _0x24d57d=_0x557cc8[_0x64c8('0x66')](/\\n/g,'\x0a');var _0x375b77={'credentials':{'private_key':_0x24d57d,'client_email':_0x195a6d}};var _0x433c8f=new dialogflow[(_0x64c8('0x67'))](_0x375b77);var _0x2a3611=_0x433c8f[_0x64c8('0x68')](_0x464d2e,md5(_0xd253d7));var _0x279af9={'session':_0x2a3611,'queryInput':{'text':{'text':_0x318cf4,'languageCode':_0x1cdb40}}};return _0x433c8f[_0x64c8('0x69')](_0x279af9)['then'](function(_0x57bc3d){if(_0x57bc3d&&_0x57bc3d['length']){logger[_0x64c8('0x1e')]('Dialogflow\x20V2\x20response:',JSON['stringify'](_0x57bc3d));var _0x5af2cd=_0x57bc3d[0x0];if(_0x5af2cd){var _0x27b369={'action':_0x5af2cd[_0x64c8('0x6a')][_0x64c8('0x60')],'allRequiredParamsPresent':_0x5af2cd['queryResult'][_0x64c8('0x6b')],'endConversation':_0x5af2cd[_0x64c8('0x6a')][_0x64c8('0x6c')]&&_0x5af2cd[_0x64c8('0x6a')][_0x64c8('0x6c')][_0x64c8('0x6d')]?_0x5af2cd['queryResult'][_0x64c8('0x6c')][_0x64c8('0x6d')]['end_conversation'][_0x64c8('0x6e')]:![],'fulfillmentText':_0x5af2cd[_0x64c8('0x6a')][_0x64c8('0x6f')],'intentName':_0x5af2cd[_0x64c8('0x6a')]['intent'][_0x64c8('0x59')],'intentDisplayName':_0x5af2cd['queryResult'][_0x64c8('0x70')][_0x64c8('0x71')],'isFallbackIntent':_0x5af2cd[_0x64c8('0x6a')][_0x64c8('0x70')][_0x64c8('0x72')],'languageCode':_0x5af2cd[_0x64c8('0x6a')][_0x64c8('0x73')],'queryText':_0x5af2cd['queryResult'][_0x64c8('0x74')],'responseId':_0x5af2cd[_0x64c8('0x75')],'score':_0x5af2cd['queryResult'][_0x64c8('0x76')],'speech':_0x5af2cd['queryResult'][_0x64c8('0x6f')],'providerResponse':JSON['stringify'](_0x57bc3d)};return _0x27b369;}}});};exports[_0x64c8('0x77')]=function(_0x209c7b,_0x132fc8,_0x5baca5,_0x3b0ab7){return tilde[_0x64c8('0x4e')](_0x209c7b,_0x132fc8,_0x5baca5,_0x3b0ab7)[_0x64c8('0x31')](function(_0x5412ce){try{fs[_0x64c8('0x21')](_0x209c7b);}catch(_0x251cf1){logger[_0x64c8('0x19')](_0x251cf1);}logger[_0x64c8('0x1e')](_0x64c8('0x78'),_0x5412ce['transcript']);logger[_0x64c8('0x1e')](_0x64c8('0x79'),_0x5412ce['confidence']);return _0x5412ce;});};exports[_0x64c8('0x7a')]=function(_0xb23577,_0x36bfdd,_0x168e8e,_0x33a981,_0x2c7394,_0x2cc11d){var _0x3b7020=path[_0x64c8('0x2c')](__dirname,_0x64c8('0x2d'),rs[_0x64c8('0x2e')](0x4)+_0x64c8('0x3c'));var _0x31b849;return aws[_0x64c8('0x7b')](_0xb23577,_0x36bfdd,_0x168e8e,_0x33a981,_0x2c7394,_0x2cc11d,_0x3b7020)[_0x64c8('0x31')](function(){_0x31b849=path['resolve'](__dirname,_0x64c8('0x2d'),rs[_0x64c8('0x2e')](0x4)+_0x64c8('0x2f'));return convertFile(_0x3b7020,_0x31b849);})[_0x64c8('0x31')](function(){try{fs[_0x64c8('0x21')](_0x3b7020);fs[_0x64c8('0x32')](_0x31b849,_0x64c8('0x33'));}catch(_0x269031){logger['error'](_0x269031);}return _0x31b849[_0x64c8('0x34')]('.')[0x0];});};exports[_0x64c8('0x7c')]=function(_0xb51877,_0x3b18e6,_0x2bf04a,_0x61ca4,_0x46d154,_0xd2b876){return aws['lex'](_0xb51877,_0x3b18e6,_0x2bf04a,_0x61ca4,_0x46d154,_0xd2b876)[_0x64c8('0x31')](function(_0x4386a5){logger[_0x64c8('0x1e')](JSON['stringify'](_0x4386a5));return _0x4386a5;});};exports['ispeechTTS']=function(_0x42f322,_0x53a4f6,_0x4a692a,_0x1d9269){var _0x49f57c=util[_0x64c8('0x7d')](_0x64c8('0x7e'),ISPEECH_API,_0x42f322,encodeURIComponent(_0x53a4f6),_0x4a692a,_0x1d9269);var _0x5c22db=path['resolve'](__dirname,'tmp',rs[_0x64c8('0x2e')](0x4)+_0x64c8('0x3c'));var _0x5dec22;return downloadFile(_0x49f57c,_0x5c22db)[_0x64c8('0x31')](function(){_0x5dec22=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x64c8('0x2f'));return convertFile(_0x5c22db,_0x5dec22);})['then'](function(){try{fs[_0x64c8('0x21')](_0x5c22db);fs['chmodSync'](_0x5dec22,_0x64c8('0x33'));}catch(_0x354d5b){logger['error'](_0x354d5b);}return _0x5dec22[_0x64c8('0x34')]('.')[0x0];});};exports[_0x64c8('0x7f')]=function(_0x5add19,_0x595a2a,_0x2ea1ab,_0xe0d11e){var _0x5e3eaa=util['format'](_0x64c8('0x80'),ISPEECH_API,_0x595a2a,_0x2ea1ab,base64Encode(_0x5add19),_0xe0d11e?util[_0x64c8('0x7d')]('model=%s',encodeURIComponent(_0xe0d11e)):'freeform=3');return uploadFile(_0x5e3eaa)[_0x64c8('0x31')](function(_0x27cc48){return querystring[_0x64c8('0xb')](_0x27cc48);});};exports[_0x64c8('0x81')]=function(_0x1314f9,_0x4f7018){return sestek[_0x64c8('0x82')](_0x1314f9,_0x4f7018)[_0x64c8('0x31')](function(_0x378810){logger[_0x64c8('0x1e')](JSON[_0x64c8('0x5d')](_0x378810));var _0x1a40d7={'speech':_0x378810[_0x64c8('0x83')],'action':_0x378810[_0x64c8('0x84')]?_0x378810[_0x64c8('0x84')][_0x64c8('0x85')]:undefined,'actiondata':_0x378810['channelData']?_0x378810[_0x64c8('0x84')]['CustomActionData']:undefined};if(_0x378810[_0x64c8('0x84')]&&_0x378810[_0x64c8('0x84')][_0x64c8('0x86')]){return base64Decode(_0x378810[_0x64c8('0x84')]['AudioFromTts']['Data'],path[_0x64c8('0x2c')](__dirname,_0x64c8('0x2d'),rs['generate'](0x4)+_0x64c8('0x2f')))[_0x64c8('0x31')](function(_0x5748a1){_0x1a40d7['audiofile']=_0x5748a1;return _0x1a40d7;});}return _0x1a40d7;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 5881902..53d58c1 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 _0x0b88=['./nda'];(function(_0x46ecbb,_0x1ca801){var _0x55eefc=function(_0x5a4476){while(--_0x5a4476){_0x46ecbb['push'](_0x46ecbb['shift']());}};_0x55eefc(++_0x1ca801);}(_0x0b88,0x1c5));var _0x80b8=function(_0x46fe88,_0xcbb5c6){_0x46fe88=_0x46fe88-0x0;var _0x44f398=_0x0b88[_0x46fe88];return _0x44f398;};var nda=require(_0x80b8('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x4578=['exports','./nda'];(function(_0x2ec8c0,_0x14670b){var _0x37f16f=function(_0x7520bb){while(--_0x7520bb){_0x2ec8c0['push'](_0x2ec8c0['shift']());}};_0x37f16f(++_0x14670b);}(_0x4578,0xbb));var _0x8457=function(_0x501e4b,_0x1559e8){_0x501e4b=_0x501e4b-0x0;var _0x3bf64c=_0x4578[_0x501e4b];return _0x3bf64c;};var nda=require(_0x8457('0x0'));module[_0x8457('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 426a7f1..2100f19 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 _0x9354=['url','../../../../../config/logger','exports','resolve','ndauth_url','/token','password','username','then','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','extension','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','CustomActionData','custom_action_data','info','stringify'];(function(_0x51c3b1,_0x40d2b3){var _0x2a7b04=function(_0x25b27e){while(--_0x25b27e){_0x51c3b1['push'](_0x51c3b1['shift']());}};_0x2a7b04(++_0x40d2b3);}(_0x9354,0x96));var _0x4935=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x9354[_0x47aa64];return _0x549c7a;};'use strict';var rp=require('request-promise');var url=require(_0x4935('0x0'));var logger=require(_0x4935('0x1'))('agi');module[_0x4935('0x2')]=function(_0x2a4993,_0x29d1eb){var _0x280bbc={'method':'POST','uri':url[_0x4935('0x3')](_0x29d1eb[_0x4935('0x4')],_0x4935('0x5')),'form':{'grant_type':_0x4935('0x6'),'username':_0x29d1eb[_0x4935('0x7')],'password':_0x29d1eb[_0x4935('0x6')]},'json':!![]};return rp(_0x280bbc)[_0x4935('0x8')](function(_0x2d735e){var _0x10793e={'method':'POST','uri':url[_0x4935('0x3')](_0x29d1eb['ndassistant_url'],_0x4935('0x9')),'body':{'type':_0x29d1eb[_0x4935('0xa')]||_0x4935('0xb'),'channelId':_0x4935('0xc'),'conversation':{'id':_0x2a4993[_0x4935('0xd')]},'from':{'id':_0x2a4993[_0x4935('0xe')],'name':_0x2a4993['calleridname']},'recipient':{'id':_0x2a4993['dnid'],'name':_0x2a4993[_0x4935('0xf')]},'text':_0x29d1eb['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x2d735e[_0x4935('0x10')]},'json':!![]};if(_0x29d1eb[_0x4935('0x11')]){_0x10793e[_0x4935('0x12')][_0x4935('0x13')][_0x4935('0x14')]=_0x29d1eb[_0x4935('0x11')];}if(_0x29d1eb[_0x4935('0x15')]=='1'){_0x10793e[_0x4935('0x12')][_0x4935('0x13')][_0x4935('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x4935('0x17')};}if(_0x29d1eb[_0x4935('0x18')]){_0x10793e[_0x4935('0x12')][_0x4935('0x13')][_0x4935('0x19')]=_0x29d1eb[_0x4935('0x18')];if(_0x29d1eb['custom_action_data']){_0x10793e[_0x4935('0x12')][_0x4935('0x13')][_0x4935('0x1a')]=_0x29d1eb[_0x4935('0x1b')];}}logger[_0x4935('0x1c')](JSON[_0x4935('0x1d')](_0x10793e));return rp(_0x10793e);});}; \ No newline at end of file +var _0x1152=['channelData','AudioOutputSettings','audio/wav','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','resolve','/token','password','POST','ndassistant_url','ndaactivity_type','uniqueid','callerid','calleridname','extension','Bearer\x20','access_token','project','body'];(function(_0x35cc24,_0x299db6){var _0x137359=function(_0x58ca43){while(--_0x58ca43){_0x35cc24['push'](_0x35cc24['shift']());}};_0x137359(++_0x299db6);}(_0x1152,0x182));var _0x2115=function(_0x2e5baf,_0x4b77a1){_0x2e5baf=_0x2e5baf-0x0;var _0x4c0797=_0x1152[_0x2e5baf];return _0x4c0797;};'use strict';var rp=require(_0x2115('0x0'));var url=require(_0x2115('0x1'));var logger=require(_0x2115('0x2'))(_0x2115('0x3'));module[_0x2115('0x4')]=function(_0x31ab3c,_0x31783d){var _0x3b8dfa={'method':'POST','uri':url[_0x2115('0x5')](_0x31783d['ndauth_url'],_0x2115('0x6')),'form':{'grant_type':_0x2115('0x7'),'username':_0x31783d['username'],'password':_0x31783d['password']},'json':!![]};return rp(_0x3b8dfa)['then'](function(_0x5dbb85){var _0x5df6db={'method':_0x2115('0x8'),'uri':url[_0x2115('0x5')](_0x31783d[_0x2115('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x31783d[_0x2115('0xa')]||'message','channelId':'Nda','conversation':{'id':_0x31ab3c[_0x2115('0xb')]},'from':{'id':_0x31ab3c[_0x2115('0xc')],'name':_0x31ab3c[_0x2115('0xd')]},'recipient':{'id':_0x31ab3c['dnid'],'name':_0x31ab3c[_0x2115('0xe')]},'text':_0x31783d['text'],'channelData':{}},'headers':{'Authorization':_0x2115('0xf')+_0x5dbb85[_0x2115('0x10')]},'json':!![]};if(_0x31783d[_0x2115('0x11')]){_0x5df6db[_0x2115('0x12')][_0x2115('0x13')]['ProjectName']=_0x31783d[_0x2115('0x11')];}if(_0x31783d['ndagenerate_audio']=='1'){_0x5df6db[_0x2115('0x12')][_0x2115('0x13')][_0x2115('0x14')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x2115('0x15')};}if(_0x31783d[_0x2115('0x16')]){_0x5df6db[_0x2115('0x12')][_0x2115('0x13')]['CustomAction']=_0x31783d[_0x2115('0x16')];if(_0x31783d[_0x2115('0x17')]){_0x5df6db[_0x2115('0x12')][_0x2115('0x13')][_0x2115('0x18')]=_0x31783d[_0x2115('0x17')];}}logger[_0x2115('0x19')](JSON[_0x2115('0x1a')](_0x5df6db));return rp(_0x5df6db);});}; \ 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 f0656ff..86cbda0 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 _0x2c16=['./lib/api','exports'];(function(_0x4b8582,_0x32b967){var _0x4e538d=function(_0x383c35){while(--_0x383c35){_0x4b8582['push'](_0x4b8582['shift']());}};_0x4e538d(++_0x32b967);}(_0x2c16,0x76));var _0x62c1=function(_0x2fc94b,_0x109c1b){_0x2fc94b=_0x2fc94b-0x0;var _0x394808=_0x2c16[_0x2fc94b];return _0x394808;};'use strict';var asr=require(_0x62c1('0x0'));module[_0x62c1('0x1')]=function(_0x365ef8,_0x2681f8,_0x122a70,_0x3645f6){return asr(_0x365ef8,_0x2681f8,_0x122a70,_0x3645f6);}; \ No newline at end of file +var _0x5432=['./lib/api','exports'];(function(_0x190b37,_0x386197){var _0x4e7eb7=function(_0x31468b){while(--_0x31468b){_0x190b37['push'](_0x190b37['shift']());}};_0x4e7eb7(++_0x386197);}(_0x5432,0xc8));var _0x2543=function(_0x5aebd7,_0x44a787){_0x5aebd7=_0x5aebd7-0x0;var _0x3cd801=_0x5432[_0x5aebd7];return _0x3cd801;};'use strict';var asr=require(_0x2543('0x0'));module[_0x2543('0x1')]=function(_0x38c677,_0x1b66c5,_0xa7b347,_0x436249){return asr(_0x38c677,_0x1b66c5,_0xa7b347,_0x436249);}; \ 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 18d4540..50e8c9e 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 _0x9cc1=['send','stringify','close','EOS','error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','bluebird','lodash','moment','../../../../../../config/logger','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix'];(function(_0x55bc90,_0x22f4d0){var _0x3093c6=function(_0x38732c){while(--_0x38732c){_0x55bc90['push'](_0x55bc90['shift']());}};_0x3093c6(++_0x22f4d0);}(_0x9cc1,0x109));var _0x19cc=function(_0x44a0e9,_0x959f63){_0x44a0e9=_0x44a0e9-0x0;var _0x3b8e8c=_0x9cc1[_0x44a0e9];return _0x3b8e8c;};'use strict';var BPromise=require(_0x19cc('0x0'));var _=require(_0x19cc('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x19cc('0x2'));var crypto=require('crypto');var logger=require(_0x19cc('0x3'))('agi');module[_0x19cc('0x4')]=function(_0x5c3c9d,_0x2b205b,_0x1f6a67,_0x158260){return new BPromise(function(_0x22fbaa,_0x45bd85){logger[_0x19cc('0x5')]('Tilde\x20URI',_0x158260||_0x19cc('0x6'));var _0x1ac095=new WebSocket(_0x158260||_0x19cc('0x6'),{'perMessageDeflate':![]});var _0x4ec220='';var _0x542e9='0';var _0x3cbd31='1';var _0x11b735=_0x19cc('0x7');function _0x5c1ff4(_0x9a9637){var _0x1872e6=crypto[_0x19cc('0x8')](_0x19cc('0x9'));_0x1872e6[_0x19cc('0xa')](_0x9a9637);return _0x1872e6[_0x19cc('0xb')](_0x19cc('0xc'));}function _0x5dd586(){try{logger['info'](_0x19cc('0xd'));var _0x3ba510=moment()[_0x19cc('0xe')]();var _0x251a0a=_0x5c1ff4(_0x3ba510+_0x2b205b+_0x1f6a67);_0x1ac095[_0x19cc('0xf')](JSON[_0x19cc('0x10')]({'appID':_0x2b205b,'timestamp':_0x3ba510,'appKey':_0x251a0a}));var _0xe77263=fs['createReadStream'](_0x5c3c9d);_0xe77263['on']('data',function(_0x224c61){_0x1ac095['send'](_0x224c61);});_0xe77263['on'](_0x19cc('0x11'),function(){_0x1ac095[_0x19cc('0xf')](_0x19cc('0x12'));});}catch(_0x320f2e){logger[_0x19cc('0x13')]('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0x320f2e));_0x1ac095[_0x19cc('0x14')]();}}function _0x1706b5(_0x28df41){try{if(_0x28df41){var _0x18dead=JSON[_0x19cc('0x15')](_0x28df41);switch(_0x18dead[_0x19cc('0x16')]){case 0x0:if(_0x18dead['result']){if(_0x18dead[_0x19cc('0x17')][_0x19cc('0x18')]){logger[_0x19cc('0x5')](_0x19cc('0x19'),JSON['stringify'](_0x18dead[_0x19cc('0x17')]['hypotheses']));_0x4ec220=_0x18dead[_0x19cc('0x17')][_0x19cc('0x1a')][0x0]['transcript'];_0x542e9=_0x18dead['result'][_0x19cc('0x1a')][0x0]['likelihood'];_0x3cbd31='0';_0x11b735=_0x19cc('0x1b');_0x1ac095[_0x19cc('0x14')]();}}break;case 0x1:logger[_0x19cc('0x5')](_0x19cc('0x7'));_0x3cbd31='1';_0x11b735=_0x19cc('0x7');break;case 0x2:logger[_0x19cc('0x5')](_0x19cc('0x1c'));_0x3cbd31='2';_0x11b735=_0x19cc('0x1c');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x3cbd31='9';_0x11b735='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x19cc('0x5')](_0x19cc('0x1d'));_0x3cbd31='10';_0x11b735=_0x19cc('0x1d');break;case 0xb:logger[_0x19cc('0x5')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x3cbd31='11';_0x11b735='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x5a4d92){logger[_0x19cc('0x13')](_0x19cc('0x1e'),JSON[_0x19cc('0x10')](_0x5a4d92));_0x1ac095[_0x19cc('0x14')]();}}function _0x4d52d7(){logger[_0x19cc('0x5')]('Close\x20Tilde\x20ASR\x20socket');_0x22fbaa({'transcript':_0x4ec220,'confidence':_0x542e9,'status':_0x3cbd31,'status_message':_0x11b735});}function _0x5b3cdf(_0x428b0e){logger[_0x19cc('0x13')](_0x19cc('0x1f'));if(!_[_0x19cc('0x20')](_0x428b0e)){logger[_0x19cc('0x13')](_[_0x19cc('0x21')](_0x428b0e)?JSON['stringify'](_0x428b0e):_0x428b0e);}}_0x1ac095['on']('open',_0x5dd586);_0x1ac095['on'](_0x19cc('0x22'),_0x1706b5);_0x1ac095['on'](_0x19cc('0x11'),_0x4d52d7);_0x1ac095['on'](_0x19cc('0x13'),_0x5b3cdf);});}; \ No newline at end of file +var _0xc2b4=['EOS','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','result','final','Tilde\x20ASR\x20hypoteses','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.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','bluebird','lodash','crypto','../../../../../../config/logger','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','hex','Open\x20Tilde\x20ASR\x20socket','send','createReadStream','close'];(function(_0xb948f4,_0x38f5ff){var _0x256057=function(_0x3aa850){while(--_0x3aa850){_0xb948f4['push'](_0xb948f4['shift']());}};_0x256057(++_0x38f5ff);}(_0xc2b4,0x79));var _0x4c2b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc2b4[_0x321bb2];return _0x9c12ed;};'use strict';var BPromise=require(_0x4c2b('0x0'));var _=require(_0x4c2b('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x4c2b('0x2'));var logger=require(_0x4c2b('0x3'))('agi');module[_0x4c2b('0x4')]=function(_0x1b7724,_0x248ef9,_0x2ba2bd,_0x4ee34b){return new BPromise(function(_0x2484a6,_0x493165){logger[_0x4c2b('0x5')]('Tilde\x20URI',_0x4ee34b||_0x4c2b('0x6'));var _0x515ffc=new WebSocket(_0x4ee34b||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x2adcc1='';var _0x5d91a1='0';var _0x3a4b47='1';var _0x31c73d=_0x4c2b('0x7');function _0xe3b5e2(_0x2de531){var _0x4a98b9=crypto[_0x4c2b('0x8')](_0x4c2b('0x9'));_0x4a98b9['update'](_0x2de531);return _0x4a98b9['digest'](_0x4c2b('0xa'));}function _0x176e3f(){try{logger[_0x4c2b('0x5')](_0x4c2b('0xb'));var _0x57f013=moment()['unix']();var _0x3a0fdb=_0xe3b5e2(_0x57f013+_0x248ef9+_0x2ba2bd);_0x515ffc[_0x4c2b('0xc')](JSON['stringify']({'appID':_0x248ef9,'timestamp':_0x57f013,'appKey':_0x3a0fdb}));var _0x192cdd=fs[_0x4c2b('0xd')](_0x1b7724);_0x192cdd['on']('data',function(_0x281995){_0x515ffc[_0x4c2b('0xc')](_0x281995);});_0x192cdd['on'](_0x4c2b('0xe'),function(){_0x515ffc[_0x4c2b('0xc')](_0x4c2b('0xf'));});}catch(_0x1ab59a){logger['error'](_0x4c2b('0x10'),JSON[_0x4c2b('0x11')](_0x1ab59a));_0x515ffc[_0x4c2b('0x12')]();}}function _0xf44210(_0x5936d7){try{if(_0x5936d7){var _0xd7cc18=JSON[_0x4c2b('0x13')](_0x5936d7);switch(_0xd7cc18['status']){case 0x0:if(_0xd7cc18[_0x4c2b('0x14')]){if(_0xd7cc18[_0x4c2b('0x14')][_0x4c2b('0x15')]){logger[_0x4c2b('0x5')](_0x4c2b('0x16'),JSON[_0x4c2b('0x11')](_0xd7cc18[_0x4c2b('0x14')][_0x4c2b('0x17')]));_0x2adcc1=_0xd7cc18[_0x4c2b('0x14')][_0x4c2b('0x17')][0x0][_0x4c2b('0x18')];_0x5d91a1=_0xd7cc18[_0x4c2b('0x14')][_0x4c2b('0x17')][0x0][_0x4c2b('0x19')];_0x3a4b47='0';_0x31c73d='Success.';_0x515ffc[_0x4c2b('0x12')]();}}break;case 0x1:logger[_0x4c2b('0x5')](_0x4c2b('0x7'));_0x3a4b47='1';_0x31c73d='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x4c2b('0x5')](_0x4c2b('0x1a'));_0x3a4b47='2';_0x31c73d=_0x4c2b('0x1a');break;case 0x9:logger[_0x4c2b('0x5')](_0x4c2b('0x1b'));_0x3a4b47='9';_0x31c73d=_0x4c2b('0x1b');break;case 0xa:logger['info']('Authentication\x20failed.');_0x3a4b47='10';_0x31c73d=_0x4c2b('0x1c');break;case 0xb:logger[_0x4c2b('0x5')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x3a4b47='11';_0x31c73d=_0x4c2b('0x1d');}}}catch(_0x4989fb){logger[_0x4c2b('0x1e')](_0x4c2b('0x1f'),JSON[_0x4c2b('0x11')](_0x4989fb));_0x515ffc[_0x4c2b('0x12')]();}}function _0x3edc0b(){logger[_0x4c2b('0x5')](_0x4c2b('0x20'));_0x2484a6({'transcript':_0x2adcc1,'confidence':_0x5d91a1,'status':_0x3a4b47,'status_message':_0x31c73d});}function _0x5e9ead(_0x172b04){logger['error']('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x4c2b('0x21')](_0x172b04)){logger['error'](_['isObject'](_0x172b04)?JSON['stringify'](_0x172b04):_0x172b04);}}_0x515ffc['on']('open',_0x176e3f);_0x515ffc['on']('message',_0xf44210);_0x515ffc['on'](_0x4c2b('0xe'),_0x3edc0b);_0x515ffc['on'](_0x4c2b('0x1e'),_0x5e9ead);});}; \ 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 10cb4be..dba298e 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 asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file +var _0x65b6=['./asr'];(function(_0xe6036b,_0x57ced5){var _0x9dd9e=function(_0x413feb){while(--_0x413feb){_0xe6036b['push'](_0xe6036b['shift']());}};_0x9dd9e(++_0x57ced5);}(_0x65b6,0xf0));var _0x665b=function(_0x2de71f,_0x4d4ea8){_0x2de71f=_0x2de71f-0x0;var _0x5cf424=_0x65b6[_0x2de71f];return _0x5cf424;};var asr=require(_0x665b('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 2ad1e37..70509d3 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 _0xcb37=['ready','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','EventEmitter','./error','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','destroy'];(function(_0x5ed54b,_0x3a2827){var _0x4b58c7=function(_0x19d3b6){while(--_0x19d3b6){_0x5ed54b['push'](_0x5ed54b['shift']());}};_0x4b58c7(++_0x3a2827);}(_0xcb37,0x123));var _0x7cb3=function(_0x40d82d,_0x2199ba){_0x40d82d=_0x40d82d-0x0;var _0x1c27a9=_0xcb37[_0x40d82d];return _0x1c27a9;};'use strict';var util=require(_0x7cb3('0x0'));var net=require(_0x7cb3('0x1'));var EventEmitter=require(_0x7cb3('0x2'))[_0x7cb3('0x3')];var AGIError=require(_0x7cb3('0x4'));var AGIChannel=require('./channel');var AGIServer=function(_0x323c31,_0x444a06,_0x18674e){var _0x28dcde=this,_0x323c31=_0x323c31||0x11dd,_0x444a06=_0x444a06||_0x7cb3('0x5'),_0x5028c7=null,_0x21cbaa=0x0;EventEmitter[_0x7cb3('0x6')](_0x28dcde);function _0x4a36fa(){if(!_0x323c31){_0x28dcde[_0x7cb3('0x7')](_0x7cb3('0x8'),new AGIError(_0x7cb3('0x9')));return![];}_0x5028c7=net[_0x7cb3('0xa')]();_0x5028c7[_0x7cb3('0xb')](_0x323c31,_0x444a06);_0x5028c7['on']('listening',function(){_0x28dcde['emit'](_0x7cb3('0xc'));});_0x5028c7['on'](_0x7cb3('0xd'),function(_0x56c242){_0x5028c7[_0x7cb3('0xe')](function(_0x1c3cff,_0x4d7fa9){if(_0x1c3cff){_0x28dcde[_0x7cb3('0x7')]('error',new AGIError(_0x7cb3('0xf'),_0x1c3cff));}else if(_0x18674e&&_0x18674e<0x0){_0x28dcde['emit']('error',new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x56c242[_0x7cb3('0x10')]();}else if(_0x18674e&&_0x18674e>0x0&&_0x18674e<_0x4d7fa9){_0x21cbaa+=0x1;_0x28dcde[_0x7cb3('0x7')](_0x7cb3('0x8'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x21cbaa));_0x56c242['destroy']();}else{var _0x484e9d=new AGIChannel(_0x56c242);_0x484e9d['on'](_0x7cb3('0x11'),function(){_0x28dcde['emit']('connection',_0x484e9d);});}});});_0x5028c7['on'](_0x7cb3('0x8'),function(_0xdb775a){_0x28dcde[_0x7cb3('0x7')](_0x7cb3('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0xdb775a['code']));});_0x5028c7['on'](_0x7cb3('0x12'),function(){_0x28dcde[_0x7cb3('0x7')](_0x7cb3('0x12'),new AGIError(_0x7cb3('0x13')));});}process['nextTick'](function(){_0x4a36fa();});};util[_0x7cb3('0x14')](AGIServer,EventEmitter);module[_0x7cb3('0x15')]=function(_0x506cc3,_0x36faaa,_0x401214){return new AGIServer(_0x506cc3,_0x36faaa,_0x401214);}; \ No newline at end of file +var _0xa252=['destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','inherits','exports','net','events','./error','./channel','127.0.0.1','call','error','E_AGI_ARGUMENT_PORT','createServer','listen','emit','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED'];(function(_0x234214,_0x23d625){var _0x39104f=function(_0x371e3c){while(--_0x371e3c){_0x234214['push'](_0x234214['shift']());}};_0x39104f(++_0x23d625);}(_0xa252,0xd8));var _0x2a25=function(_0x8c2d75,_0xf37185){_0x8c2d75=_0x8c2d75-0x0;var _0x29f7e7=_0xa252[_0x8c2d75];return _0x29f7e7;};'use strict';var util=require('util');var net=require(_0x2a25('0x0'));var EventEmitter=require(_0x2a25('0x1'))['EventEmitter'];var AGIError=require(_0x2a25('0x2'));var AGIChannel=require(_0x2a25('0x3'));var AGIServer=function(_0x1e8894,_0x417087,_0x5c8d31){var _0x55ef27=this,_0x1e8894=_0x1e8894||0x11dd,_0x417087=_0x417087||_0x2a25('0x4'),_0x9e7249=null,_0x125de0=0x0;EventEmitter[_0x2a25('0x5')](_0x55ef27);function _0x384a41(){if(!_0x1e8894){_0x55ef27['emit'](_0x2a25('0x6'),new AGIError(_0x2a25('0x7')));return![];}_0x9e7249=net[_0x2a25('0x8')]();_0x9e7249[_0x2a25('0x9')](_0x1e8894,_0x417087);_0x9e7249['on']('listening',function(){_0x55ef27[_0x2a25('0xa')]('listening');});_0x9e7249['on'](_0x2a25('0xb'),function(_0x487d2c){_0x9e7249[_0x2a25('0xc')](function(_0x1c8422,_0x6122cb){if(_0x1c8422){_0x55ef27[_0x2a25('0xa')]('error',new AGIError(_0x2a25('0xd'),_0x1c8422));}else if(_0x5c8d31&&_0x5c8d31<0x0){_0x55ef27['emit'](_0x2a25('0x6'),new AGIError(_0x2a25('0xe')));_0x487d2c[_0x2a25('0xf')]();}else if(_0x5c8d31&&_0x5c8d31>0x0&&_0x5c8d31<_0x6122cb){_0x125de0+=0x1;_0x55ef27[_0x2a25('0xa')](_0x2a25('0x6'),new AGIError(_0x2a25('0x10'),_0x125de0));_0x487d2c[_0x2a25('0xf')]();}else{var _0x188f9e=new AGIChannel(_0x487d2c);_0x188f9e['on']('ready',function(){_0x55ef27[_0x2a25('0xa')]('connection',_0x188f9e);});}});});_0x9e7249['on'](_0x2a25('0x6'),function(_0x1bd1f9){_0x55ef27[_0x2a25('0xa')]('error',new AGIError(_0x2a25('0xd'),_0x1bd1f9['code']));});_0x9e7249['on'](_0x2a25('0x11'),function(){_0x55ef27[_0x2a25('0xa')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x2a25('0x12')](function(){_0x384a41();});};util[_0x2a25('0x13')](AGIServer,EventEmitter);module[_0x2a25('0x14')]=function(_0x307675,_0x56aa29,_0x47e7b7){return new AGIServer(_0x307675,_0x56aa29,_0x47e7b7);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 1fa928b..998aa17 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 _0x1f59=['no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','query:\x20%s','no\x20variable\x20found','forEach','%s_ROWS_COUNT','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','no\x20client_email\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','speech','dialogflowV2','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','no\x20trunk\x20selected','trunk_id','no\x20trunk\x20found','trunk_name','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','no\x20appsecret\x20configured','%s/recordings/%s','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','AGENT\x20%s\x20FOUND\x20BY','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','digit','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','macro','gosub','position','QUEUE','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','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','saynumber','number','sayphonetic','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','authentication','auth','pass','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','util','odbc','moment','request-promise','../../config/logger','agi','./scripts','/var/opt/motion2/server/files','rawBody','menu','getdigits','getsecretdigits','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUser','getUserById','getTrunk','getSound','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','IntervalId','interval','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','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','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','file','createSquareMessage','isEmpty','isNil','callback_','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','agentPause','agentUnpause','agent','agentLogout','agentLogin','internal','LOCAL','shellCommand','exec','trim','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','googleTTS','google_tts_language','restAPI','url','method','timeout','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_bot_name','googleASR','google_asr_language','appid','appsecret','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','replaceAllVariables','split','replaceAll','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','result','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','createCmContact','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x1f59,0xef));var _0x91f5=function(_0x484e3e,_0x4ca8f9){_0x484e3e=_0x484e3e-0x0;var _0x3304dd=_0x1f59[_0x484e3e];return _0x3304dd;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x91f5('0x0'));var _=require('lodash');var sh=require('shelljs');var odbc=require(_0x91f5('0x1'))();var rs=require('randomstring');var moment=require(_0x91f5('0x2'));var Mustache=require('mustache');var rp=require(_0x91f5('0x3'));var logger=require(_0x91f5('0x4'))(_0x91f5('0x5'));var config=require('../../config/environment');var scripts=require(_0x91f5('0x6'));var FILES_PATH=_0x91f5('0x7');var recursiveMapAttributes=['rawHeaders',_0x91f5('0x8')];var verticesWithRetry=[_0x91f5('0x9'),_0x91f5('0xa'),_0x91f5('0xb')];var AGIVertices=function(_0x3475f1,_0x58ecab,_0x4f137a){this['channel']=_0x3475f1;this[_0x91f5('0xc')]=_0x58ecab;this[_0x91f5('0xd')]=_0x4f137a;};AGIVertices[_0x91f5('0xe')][_0x91f5('0xf')]=function(_0x72e0d3,_0x262c73){this[_0x91f5('0xc')][_0x91f5('0x10')](_0x72e0d3)[_0x91f5('0x11')](function(_0x53baa0){_0x262c73(null,_0x53baa0?_0x53baa0[_0x91f5('0x12')]:![]);})[_0x91f5('0x13')](function(_0x5a32d6){_0x262c73(_0x5a32d6);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x14')]=function(_0x1d6da9,_0x543810){this[_0x91f5('0xc')][_0x91f5('0x15')](_0x1d6da9)[_0x91f5('0x11')](function(_0x123022){_0x543810(null,_0x123022?_0x123022[_0x91f5('0x12')]:![]);})[_0x91f5('0x13')](function(_0x4bda9f){_0x543810(_0x4bda9f);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x16')]=function(_0x4792f5,_0x2b33ce){this[_0x91f5('0xc')][_0x91f5('0x17')](_0x4792f5)[_0x91f5('0x11')](function(_0x14274f){_0x2b33ce(null,_0x14274f?_0x14274f[_0x91f5('0x12')]:![]);})[_0x91f5('0x13')](function(_0x36a3e9){_0x2b33ce(_0x36a3e9);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x18')]=function(_0x3cfa4b,_0x68a35d){this[_0x91f5('0xc')]['getSquareOdbcById'](_0x3cfa4b)[_0x91f5('0x11')](function(_0x1221a6){_0x68a35d(null,_0x1221a6?_0x1221a6[_0x91f5('0x19')]:![]);})[_0x91f5('0x13')](function(_0x1f8856){_0x68a35d(_0x1f8856);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x1a')]=function(_0x362714,_0x3bc893){this[_0x91f5('0xc')][_0x91f5('0x1b')](_0x362714)[_0x91f5('0x11')](function(_0x901b1c){_0x3bc893(null,_0x901b1c?_0x901b1c[_0x91f5('0x12')]:![]);})['catch'](function(_0x39a75b){_0x3bc893(_0x39a75b);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x1c')]=function(_0x232b9a,_0x3d366b){this['rpc']['getTrunkById'](_0x232b9a)[_0x91f5('0x11')](function(_0x26f78a){_0x3d366b(null,_0x26f78a?_0x26f78a['name']:![]);})[_0x91f5('0x13')](function(_0x47b8be){_0x3d366b(_0x47b8be);});};AGIVertices['prototype'][_0x91f5('0x1d')]=function(_0x18a0ed,_0xaa3061){var _0xe29aec=this;this['rpc']['getSoundById'](_0x18a0ed)[_0x91f5('0x11')](function(_0x44305e){_0xaa3061(null,_0x44305e?_0xe29aec[_0x91f5('0x1e')](_0x44305e[_0x91f5('0x1f')]):![]);})['catch'](function(_0x28f708){_0xaa3061(_0x28f708);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x20')]=function(_0x4280df,_0x5ada78){this['rpc'][_0x91f5('0x21')](_0x4280df)[_0x91f5('0x11')](function(_0x419cbc){_0x5ada78(null,_0x419cbc?_0x419cbc:![]);})[_0x91f5('0x13')](function(_0x29c7cb){_0x5ada78(_0x29c7cb);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x22')]=function(_0x5badea,_0x299fd3,_0x4d566f){this['mailRpc']['sendMailMessage'](_0x5badea,_0x299fd3)[_0x91f5('0x11')](function(){_0x4d566f(null);})['catch'](function(_0x5e3c2a){_0x4d566f(_0x5e3c2a);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x23')]=function(_0x450403,_0x388be7){this[_0x91f5('0xc')]['getIntervalById'](_0x450403)[_0x91f5('0x11')](function(_0x569091){if(_0x569091){if(_0x569091[_0x91f5('0x24')]){_0x388be7(null,[_0x569091[_0x91f5('0x25')]]);}else{_0x388be7(null,_['map'](_0x569091[_0x91f5('0x26')],'interval'));}}else{_0x388be7(null,![]);}})['catch'](function(_0x2b651e){_0x388be7(_0x2b651e);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x1e')]=function(_0x34c31f){return util[_0x91f5('0x27')](_0x91f5('0x28'),FILES_PATH,_0x34c31f);};AGIVertices[_0x91f5('0xe')][_0x91f5('0x29')]=function(_0x4e39e6,_0x2a3ebf,_0x1dc747){odbc[_0x91f5('0x2a')](_0x4e39e6,function(_0x130d26){if(_0x130d26){logger['error'](_0x91f5('0x2b'),_0x130d26);_0x1dc747(_0x130d26);}else{logger[_0x91f5('0x2c')]('ODBC\x20connection\x20successfully');odbc[_0x91f5('0x2d')](_0x2a3ebf,function(_0x49d2ae,_0x5ca0cc){if(_0x49d2ae){logger[_0x91f5('0x2c')](_0x91f5('0x2e'),_0x2a3ebf);_0x1dc747(_0x49d2ae);}else{logger[_0x91f5('0x2c')](_0x91f5('0x2f'),_0x2a3ebf);odbc[_0x91f5('0x30')](function(_0x2e2e60){if(_0x2e2e60){logger[_0x91f5('0x31')](_0x91f5('0x32'),_0x2e2e60);}_0x1dc747(null,_0x5ca0cc);});}});}});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x33')]=function(_0xc62507,_0x3a6c95){this['rpc']['getSmsAccountById'](_0xc62507)['then'](function(_0x206a17){_0x3a6c95(null,_0x206a17?_0x206a17:![]);})['catch'](function(_0x5630ee){_0x3a6c95(_0x5630ee);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x34')]=function(_0x2be105,_0x3f3dad){this[_0x91f5('0xc')][_0x91f5('0x34')](_0x2be105)[_0x91f5('0x11')](function(_0x3f8432){_0x3f3dad(null,_0x3f8432);})[_0x91f5('0x13')](function(_0x49f472){_0x3f3dad(_0x49f472);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x35')]=function(_0x25010e,_0x48870e,_0x27bd38){this['rpc'][_0x91f5('0x35')]({'uniqueid':this[_0x91f5('0x36')][_0x91f5('0x37')],'node':_0x25010e[_0x91f5('0x38')],'application':_0x25010e[_0x91f5('0x39')],'data':_0x48870e||null,'project_name':this[_0x91f5('0x36')][_0x91f5('0x3a')],'callerid':this[_0x91f5('0x36')][_0x91f5('0x3b')]})[_0x91f5('0x11')](function(_0x4258f2){if(_0x27bd38){_0x27bd38(null,_0x4258f2);}})[_0x91f5('0x13')](function(_0x4c866e){if(_0x27bd38){_0x27bd38(_0x4c866e);}});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x3c')]=function(_0x2bddcd,_0x19b6ae,_0xf12cab,_0x33ff79){this[_0x91f5('0xc')]['createSquareRecording']({'uniqueid':this[_0x91f5('0x36')][_0x91f5('0x37')],'callerid':this[_0x91f5('0x36')][_0x91f5('0x3b')],'calleridname':this[_0x91f5('0x36')][_0x91f5('0x3d')],'context':this[_0x91f5('0x36')][_0x91f5('0x3e')],'extension':this[_0x91f5('0x36')][_0x91f5('0x3f')],'priority':this['channel'][_0x91f5('0x40')],'accountcode':this['channel'][_0x91f5('0x41')],'dnid':this[_0x91f5('0x36')]['dnid'],'projectName':this['channel'][_0x91f5('0x3a')],'saveName':_0x19b6ae,'filename':_0x2bddcd[_0x91f5('0x42')]||_0x19b6ae,'savePath':_0xf12cab})[_0x91f5('0x11')](function(_0x2399ee){_0x33ff79(null,_0x2399ee);})[_0x91f5('0x13')](function(_0x52dbc5){_0x33ff79(_0x52dbc5);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x43')]=function(_0x5e3630,_0x6f0619,_0x2dcbf9,_0x360bc1,_0x43b93d){this[_0x91f5('0xc')][_0x91f5('0x43')]({'uniqueid':this[_0x91f5('0x36')]['uniqueid'],'body':_0x5e3630,'direction':_0x6f0619,'providerName':_0x2dcbf9,'providerResponse':_0x360bc1})[_0x91f5('0x11')](function(_0x1a07c4){if(_0x43b93d){_0x43b93d(null,_0x1a07c4);}})['catch'](function(_0x413e98){if(_0x43b93d){_0x43b93d(_0x413e98);}});};AGIVertices[_0x91f5('0xe')]['createCmContact']=function(_0x2c4ee6,_0x579c29){this[_0x91f5('0xc')]['createCmContact']({'firstName':_[_0x91f5('0x44')](_0x2c4ee6[_0x91f5('0x12')])||_[_0x91f5('0x45')](_0x2c4ee6['name'])?_0x91f5('0x46')+Math['random']():_0x2c4ee6[_0x91f5('0x12')],'lastName':_[_0x91f5('0x44')](_0x2c4ee6['lastName'])||_['isNil'](_0x2c4ee6[_0x91f5('0x47')])?null:_0x2c4ee6[_0x91f5('0x47')],'phone':_0x2c4ee6[_0x91f5('0x48')],'ListId':_0x2c4ee6[_0x91f5('0x49')],'scheduledat':_0x2c4ee6[_0x91f5('0x4a')],'callbackUniqueid':this[_0x91f5('0x36')]['uniqueid'],'tags':'callback','description':_0x91f5('0x4b')+_0x2c4ee6[_0x91f5('0x4a')][_0x91f5('0x4c')](),'priority':_0x2c4ee6[_0x91f5('0x4d')]})[_0x91f5('0x11')](function(_0x51b898){_0x579c29(null,_0x51b898);})[_0x91f5('0x13')](function(_0x10cfc4){_0x579c29(_0x10cfc4);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x4e')]=function(_0x1927bf,_0x27b9c5){this[_0x91f5('0xc')]['getPauseById'](_0x1927bf)[_0x91f5('0x11')](function(_0x3fe638){_0x27b9c5(null,_0x3fe638?_0x3fe638['name']:![]);})[_0x91f5('0x13')](function(_0x8f56d3){_0x27b9c5(_0x8f56d3);});};AGIVertices['prototype'][_0x91f5('0x4f')]=function(_0x4aaf67,_0x242db9,_0x51cf36){var _0x30c3de={'role':'agent'};_0x30c3de[_0x4aaf67]=this[_0x91f5('0x36')]['callerid'];this['rpc'][_0x91f5('0x4f')](_0x30c3de,_0x242db9,this[_0x91f5('0x36')][_0x91f5('0x37')])['then'](function(_0x17f4a6){_0x51cf36(null,_[_0x91f5('0x45')](_0x17f4a6)?![]:!![]);})['catch'](function(_0x519f00){logger['error'](_0x519f00);_0x51cf36(null,![]);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x50')]=function(_0x25bc8d,_0x4df62c){var _0x5ce42d={'role':_0x91f5('0x51')};_0x5ce42d[_0x25bc8d]=this[_0x91f5('0x36')][_0x91f5('0x3b')];this[_0x91f5('0xc')][_0x91f5('0x50')](_0x5ce42d)['then'](function(_0x12ed2c){_0x4df62c(null,_[_0x91f5('0x45')](_0x12ed2c)?![]:!![]);})[_0x91f5('0x13')](function(_0x50135c){logger[_0x91f5('0x31')](_0x50135c);_0x4df62c(null,![]);});};AGIVertices[_0x91f5('0xe')]['agentLogout']=function(_0x5add85,_0x4cab56){var _0x1c59e8={'role':_0x91f5('0x51')};_0x1c59e8[_0x5add85]=this[_0x91f5('0x36')][_0x91f5('0x3b')];this['rpc'][_0x91f5('0x52')](_0x1c59e8)[_0x91f5('0x11')](function(_0x55c076){_0x4cab56(null,_[_0x91f5('0x45')](_0x55c076)?![]:!![]);})[_0x91f5('0x13')](function(_0xfdcb48){logger[_0x91f5('0x31')](_0xfdcb48);_0x4cab56(null,![]);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x53')]=function(_0x41d0bf,_0x3aaca5){var _0x160737={'role':_0x91f5('0x51')};_0x160737[_0x41d0bf]=this['channel'][_0x91f5('0x3b')];var _0x45c435=_0x41d0bf!=_0x91f5('0x54')?util[_0x91f5('0x27')]('%s/%s@from-sip/n',_0x91f5('0x55'),this['channel'][_0x91f5('0x3b')]):undefined;this['rpc'][_0x91f5('0x53')](_0x160737,_0x45c435)[_0x91f5('0x11')](function(_0x34b5da){_0x3aaca5(null,_[_0x91f5('0x45')](_0x34b5da)?![]:!![]);})[_0x91f5('0x13')](function(_0x74ed53){logger[_0x91f5('0x31')](_0x74ed53);_0x3aaca5(null,![]);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x56')]=function(_0x479273,_0x50d26a){sh[_0x91f5('0x57')](_[_0x91f5('0x58')](_0x479273),function(_0x5d268b,_0x188865){var _0xd2e224=_0x188865['replace'](/(\r\n|\n|\r)/gm,'');_0x50d26a(null,_0xd2e224);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x59')]=function(_0x53d48e,_0x5249ca){scripts[_0x91f5('0x59')](_0x53d48e['apiKey'],_0x53d48e[_0x91f5('0x5a')]||_0x91f5('0x5b'),_0x53d48e[_0x91f5('0x5b')],_0x53d48e[_0x91f5('0x5c')]||_0x91f5('0x5d'),_0x53d48e[_0x91f5('0x5e')]||_0x91f5('0x5f'),_0x53d48e[_0x91f5('0x60')]||'MP3')[_0x91f5('0x11')](function(_0x5b5b1e){_0x5249ca(null,_0x5b5b1e);})[_0x91f5('0x13')](function(_0x54d792){_0x5249ca(_0x54d792);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x61')]=function(_0x1d511a,_0x19e6e7){scripts[_0x91f5('0x61')](_0x1d511a[_0x91f5('0x5b')],_0x1d511a[_0x91f5('0x62')]||'en',0x1)[_0x91f5('0x11')](function(_0x43df9c){_0x19e6e7(null,_0x43df9c);})[_0x91f5('0x13')](function(_0x28a26e){_0x19e6e7(_0x28a26e);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x63')]=function(_0x35abf8,_0x2e821e){var _0x380b44={'uri':_0x35abf8[_0x91f5('0x64')],'method':_0x35abf8[_0x91f5('0x65')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x35abf8[_0x91f5('0x66')])==='number'&&parseInt(_0x35abf8[_0x91f5('0x66')])>=0x1?parseInt(_0x35abf8['timeout'])*0x3e8:0x5*0x3e8};if(_['includes'](['POST',_0x91f5('0x67')],_0x380b44[_0x91f5('0x65')][_0x91f5('0x68')]())){try{_0x380b44[_0x91f5('0x69')]=_0x35abf8[_0x91f5('0x8')]?JSON[_0x91f5('0x6a')](_0x35abf8[_0x91f5('0x8')]):{};}catch(_0x166715){logger[_0x91f5('0x31')](_0x91f5('0x6b'),_0x166715);}}try{_0x380b44[_0x91f5('0x6c')]=_0x35abf8[_0x91f5('0x6d')]?JSON[_0x91f5('0x6a')](_0x35abf8[_0x91f5('0x6d')]):{};}catch(_0x42ab25){logger[_0x91f5('0x31')](_0x91f5('0x6e'),_0x42ab25);}if(_0x35abf8[_0x91f5('0x6f')]){try{var _0x425d80=require(_0x35abf8[_0x91f5('0x6f')])[_0x91f5('0x70')](this,_0x380b44);_0x380b44[_0x91f5('0x71')]=Mustache[_0x91f5('0x72')](_0x35abf8['url'],_0x425d80,{},['$$','$$']);if(_0x380b44[_0x91f5('0x6c')]){_0x380b44[_0x91f5('0x6c')]=JSON[_0x91f5('0x6a')](Mustache[_0x91f5('0x72')](JSON['stringify'](_0x380b44[_0x91f5('0x6c')]),_0x425d80,{},['$$','$$']));}if(_0x380b44[_0x91f5('0x69')]){_0x380b44[_0x91f5('0x69')]=JSON[_0x91f5('0x6a')](Mustache[_0x91f5('0x72')](JSON[_0x91f5('0x73')](_0x380b44['body']),_0x425d80,{},['$$','$$']));}}catch(_0xa56d75){logger[_0x91f5('0x31')](_0x91f5('0x74'),_0xa56d75);}}rp(_0x380b44)['then'](function(_0x40d6dd){var _0x48389a={'statusCode':_0x40d6dd[_0x91f5('0x75')]||0xc8,'statusMessage':_0x40d6dd[_0x91f5('0x76')]||'OK','headers':_0x40d6dd[_0x91f5('0x6c')]||{},'body':_0x40d6dd[_0x91f5('0x69')]||{}};_0x2e821e(null,_0x48389a);})[_0x91f5('0x13')](function(_0xc35f95){var _0x989ef8={'statusCode':_0xc35f95[_0x91f5('0x75')]||0x1f4,'statusMessage':_0xc35f95[_0x91f5('0x77')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0xc35f95[_0x91f5('0x78')][_0x91f5('0x6c')]||{},'body':_0xc35f95[_0x91f5('0x78')][_0x91f5('0x69')]||{}};_0x2e821e(null,_0x989ef8);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x79')]=function(_0x4e239d,_0x1cf2a4){scripts['googleDialogflow'](this[_0x91f5('0x36')]['uniqueid'],_0x4e239d[_0x91f5('0x7a')],_0x4e239d['text'],_0x4e239d['dialogflow_language']||'en')[_0x91f5('0x11')](function(_0x23e256){_0x1cf2a4(null,_0x23e256);})[_0x91f5('0x13')](function(_0x5bfc47){_0x1cf2a4(_0x5bfc47);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x7b')]=function(_0x4635ef,_0x2e4ab9){scripts[_0x91f5('0x7b')](this[_0x91f5('0x36')]['uniqueid'],_0x4635ef[_0x91f5('0x7c')],_0x4635ef[_0x91f5('0x7d')],_0x4635ef[_0x91f5('0x7e')],_0x4635ef[_0x91f5('0x5b')],_0x4635ef[_0x91f5('0x7f')]||'en')[_0x91f5('0x11')](function(_0x17b3c6){_0x2e4ab9(null,_0x17b3c6);})['catch'](function(_0x2df5af){_0x2e4ab9(_0x2df5af);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x80')]=function(_0x22dddc,_0x11d0f4){scripts[_0x91f5('0x80')](this[_0x91f5('0x36')],_0x22dddc)[_0x91f5('0x11')](function(_0x10f3e3){_0x11d0f4(null,_0x10f3e3);})[_0x91f5('0x13')](function(_0x2686cd){_0x11d0f4(_0x2686cd);});};AGIVertices['prototype'][_0x91f5('0x81')]=function(_0x944f7,_0x45e85b){scripts['ispeechTTS'](_0x944f7[_0x91f5('0x7a')],_0x944f7['text'],_0x944f7[_0x91f5('0x82')]||'en-US',_0x944f7['speed'])[_0x91f5('0x11')](function(_0x3a71f9){_0x45e85b(null,_0x3a71f9);})[_0x91f5('0x13')](function(_0x177ba7){_0x45e85b(_0x177ba7);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x83')]=function(_0x34ad00,_0x5dd512,_0x2d89c8){scripts[_0x91f5('0x83')](_0x5dd512,_0x34ad00[_0x91f5('0x7a')],_0x34ad00['ispeech_asr_language']||_0x91f5('0x5d'),this['isConfigured'](_0x34ad00[_0x91f5('0x84')])?_0x34ad00[_0x91f5('0x84')]:undefined)[_0x91f5('0x11')](function(_0x13af73){_0x2d89c8(null,_0x13af73);})[_0x91f5('0x13')](function(_0x54cc91){_0x2d89c8(_0x54cc91);});};AGIVertices['prototype']['awsPolly']=function(_0x47060c,_0x4fc84a){scripts[_0x91f5('0x85')](_0x47060c[_0x91f5('0x86')],_0x47060c[_0x91f5('0x87')],_0x47060c[_0x91f5('0x88')],_0x47060c[_0x91f5('0x89')]||'Amy',_0x47060c[_0x91f5('0x5b')],_0x47060c[_0x91f5('0x8a')]||'text')[_0x91f5('0x11')](function(_0x3acfd4){_0x4fc84a(null,_0x3acfd4);})[_0x91f5('0x13')](function(_0x1e94af){_0x4fc84a(_0x1e94af);});};AGIVertices['prototype'][_0x91f5('0x8b')]=function(_0x48909c,_0x5d6921){scripts[_0x91f5('0x8b')](this['channel'][_0x91f5('0x37')],_0x48909c[_0x91f5('0x86')],_0x48909c[_0x91f5('0x87')],_0x48909c['aws_lex_region'],_0x48909c[_0x91f5('0x5b')],_0x48909c[_0x91f5('0x8c')])[_0x91f5('0x11')](function(_0x139e8c){_0x5d6921(null,_0x139e8c);})[_0x91f5('0x13')](function(_0x1c0282){_0x5d6921(_0x1c0282);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x8d')]=function(_0x3feaf2,_0x143d44,_0xa2702f){scripts['googleASR'](_0x143d44,_0x3feaf2[_0x91f5('0x7a')],_0x3feaf2[_0x91f5('0x8e')]||'en-US')[_0x91f5('0x11')](function(_0x5be7ed){_0xa2702f(null,_0x5be7ed);})[_0x91f5('0x13')](function(_0x5e4b43){_0xa2702f(_0x5e4b43);});};AGIVertices['prototype']['tildeASR']=function(_0xb7f93f,_0x1ee455,_0x1b1e0f){scripts['tildeASR'](_0x1ee455,_0xb7f93f[_0x91f5('0x8f')],_0xb7f93f[_0x91f5('0x90')],_0xb7f93f[_0x91f5('0x71')])[_0x91f5('0x11')](function(_0x2bf2a8){_0x1b1e0f(null,_0x2bf2a8);})[_0x91f5('0x13')](function(_0x1c5fb5){_0x1b1e0f(_0x1c5fb5);});};AGIVertices['prototype']['clear']=function(_0x1c3bdf){var _0x299f20=_[_0x91f5('0x91')](verticesWithRetry,_0x1c3bdf[_0x91f5('0x39')])?_0x1c3bdf:_[_0x91f5('0x92')](_0x1c3bdf);for(var _0x1bad32 in _0x299f20){if(_0x299f20[_0x91f5('0x93')](_0x1bad32)){if(_0x299f20[_0x1bad32]&&_[_0x91f5('0x94')](_0x299f20[_0x1bad32])){if(_[_0x91f5('0x91')](recursiveMapAttributes,_0x1bad32)){_0x299f20[_0x1bad32]=this[_0x91f5('0x95')](_0x299f20[_0x1bad32]);}else{_0x299f20[_0x1bad32]=this['replaceAllVariables'](_0x299f20[_0x1bad32]);}}}}return _0x299f20;};AGIVertices[_0x91f5('0xe')][_0x91f5('0x96')]=function(_0x3730b4){for(var _0x3128d1 in _0x3730b4){if(_0x3730b4[_0x91f5('0x93')](_0x3128d1)){if(_[_0x91f5('0x97')](_0x3730b4[_0x3128d1])){this[_0x91f5('0x96')](_0x3730b4[_0x3128d1]);}else if(_[_0x91f5('0x98')](_0x3730b4[_0x3128d1])){for(var _0x163be1=0x0;_0x163be1<_0x3730b4[_0x3128d1][_0x91f5('0x99')];_0x163be1++){this[_0x91f5('0x96')](_0x3730b4[_0x3128d1][_0x163be1]);}}else if(_[_0x91f5('0x94')](_0x3730b4[_0x3128d1])){_0x3730b4[_0x3128d1]=this['replaceAllVariables'](_0x3730b4[_0x3128d1]);}}}};AGIVertices['prototype'][_0x91f5('0x9a')]=function(_0x1ff4ad,_0x37587a){for(var _0x3bd20e in _0x1ff4ad){if(_0x1ff4ad['hasOwnProperty'](_0x3bd20e)){if(_['isPlainObject'](_0x1ff4ad[_0x3bd20e])){if(!_[_0x91f5('0x44')](_0x1ff4ad[_0x3bd20e])){this[_0x91f5('0x9a')](_0x1ff4ad[_0x3bd20e],util[_0x91f5('0x27')](_0x91f5('0x9b'),_0x37587a,_0x3bd20e));}}else if(_['isArray'](_0x1ff4ad[_0x3bd20e])){for(var _0x72fe0b=0x0;_0x72fe0b<_0x1ff4ad[_0x3bd20e][_0x91f5('0x99')];_0x72fe0b++){this[_0x91f5('0x9a')](_0x1ff4ad[_0x3bd20e][_0x72fe0b],util[_0x91f5('0x27')](_0x91f5('0x9b'),_0x37587a,_0x3bd20e+'['+_0x72fe0b+']'));}}else{if(!_['isNil'](_0x1ff4ad[_0x3bd20e])){this[_0x91f5('0x36')][_0x91f5('0x9c')](util[_0x91f5('0x27')](_0x91f5('0x9b'),_0x37587a,_0x3bd20e),_0x1ff4ad[_0x3bd20e]);}}}}};AGIVertices[_0x91f5('0xe')][_0x91f5('0x95')]=function(_0x3f563e){try{var _0x4cdec4=JSON[_0x91f5('0x6a')](_0x3f563e);this[_0x91f5('0x96')](_0x4cdec4);return JSON[_0x91f5('0x73')](_0x4cdec4);}catch(_0x3557c5){return this[_0x91f5('0x9d')](_0x3f563e);}};AGIVertices[_0x91f5('0xe')]['replaceAllVariables']=function(_0x4c6f26){var _0x283296=_0x4c6f26[_0x91f5('0x9e')]('{');for(var _0x2f841a=0x1;_0x2f841a<_0x283296[_0x91f5('0x99')];_0x2f841a+=0x1){var _0x3386e5=_0x283296[_0x2f841a][_0x91f5('0x9e')]('}');if(_0x3386e5[_0x91f5('0x99')]>0x1){_0x4c6f26=_0x4c6f26[_0x91f5('0x9f')]('{'+_0x3386e5[0x0]+'}',this[_0x91f5('0x36')]['getVariable'](_0x3386e5[0x0])[_0x91f5('0xa0')]||_0x3386e5[0x0]);}}if(_0x283296[_0x91f5('0x99')]===0x1){return _0x4c6f26['toString']();}return this[_0x91f5('0x9d')](_0x4c6f26);};AGIVertices[_0x91f5('0xe')][_0x91f5('0xa1')]=function(_0xa9f88,_0x216697){var _0x2843f8=this[_0x91f5('0x36')][_0x91f5('0xf')](_0xa9f88);if(_0x2843f8['result']===-0x1){return _0x2843f8;}logger['info'](util[_0x91f5('0x27')](_0x91f5('0xa2'),_0x216697,_0x2843f8[_0x91f5('0xa0')]));return this[_0x91f5('0x36')][_0x91f5('0x9c')](_0x216697,_0x2843f8[_0x91f5('0xa0')]);};AGIVertices['prototype'][_0x91f5('0xa3')]=function(_0x280504){return _0x280504&&_0x280504!=='0'&&_0x280504!=='-1'&&_0x280504!=='';};AGIVertices[_0x91f5('0xe')][_0x91f5('0xa4')]=function(_0x1e8958){this[_0x91f5('0x35')][_0x91f5('0x70')](this,_0x1e8958,'-');_0x1e8958[_0x91f5('0xa5')]=_0x1e8958['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x91f5('0xa6')]=function(_0x5267e0){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0xa7'),_0x5267e0[_0x91f5('0x38')]));if(!this['isConfigured'](_0x5267e0[_0x91f5('0x5b')])){return this[_0x91f5('0x36')][_0x91f5('0xa8')](_0x91f5('0xa9'));}var _0x2b9324='\x22'+_0x5267e0[_0x91f5('0x5b')]+'\x22';if(this[_0x91f5('0xa3')](_0x5267e0[_0x91f5('0x78')])){_0x2b9324+=','+_0x5267e0[_0x91f5('0x78')];}var _0x24b02d=this[_0x91f5('0x36')]['exec'](_0x91f5('0xaa'),_0x2b9324);if(_0x24b02d[_0x91f5('0xab')]===-0x1){return _0x24b02d;}return this[_0x91f5('0x36')]['noop'](util[_0x91f5('0x27')]('Executed\x20command\x20MRCPSynth\x20%s',_0x2b9324));};AGIVertices[_0x91f5('0xe')][_0x91f5('0xac')]=function(_0x42af49){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0xad'),_0x42af49[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x42af49[_0x91f5('0xae')])){return this['channel'][_0x91f5('0xa8')](_0x91f5('0xaf'));}var _0x50e721=_0x42af49[_0x91f5('0xae')];if(this[_0x91f5('0xa3')](_0x42af49[_0x91f5('0x78')])){_0x50e721+=','+_0x42af49['options'];}var _0x34fe69=this[_0x91f5('0x36')][_0x91f5('0x57')](_0x91f5('0xb0'),_0x50e721);if(_0x34fe69['result']===-0x1){return _0x34fe69;}var _0x2b41eb=this[_0x91f5('0xa1')](_0x91f5('0xb1'),_0x91f5('0xb2'));if(_0x2b41eb[_0x91f5('0xab')]===-0x1){return _0x2b41eb;}var _0x287c33=this[_0x91f5('0xa1')](_0x91f5('0xb3'),_0x91f5('0xb4'));if(_0x287c33[_0x91f5('0xab')]===-0x1){return _0x287c33;}var _0x232902=this['getAndSetVariable'](_0x91f5('0xb5'),_0x91f5('0xb6'));if(_0x232902[_0x91f5('0xab')]===-0x1){return _0x232902;}return this[_0x91f5('0x36')]['noop'](util['format'](_0x91f5('0xb7'),_0x50e721));};AGIVertices[_0x91f5('0xe')]['agi']=function(_0x3d04b0){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0xb8'),_0x3d04b0[_0x91f5('0x38')]));return this[_0x91f5('0x36')][_0x91f5('0x5')]([_0x3d04b0[_0x91f5('0xb9')],_0x3d04b0[_0x91f5('0xba')]]);};AGIVertices[_0x91f5('0xe')][_0x91f5('0xbb')]=function(_0x17729b){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0xbc'),_0x17729b[_0x91f5('0x38')]));if(this[_0x91f5('0xa3')](_0x17729b['timeout'])){logger[_0x91f5('0x2c')](util['format']('Wait\x20%s\x20seconds\x20before\x20answer',_0x17729b[_0x91f5('0x66')]));var _0x457e09=this[_0x91f5('0x36')][_0x91f5('0xbd')](_0x17729b[_0x91f5('0x66')]);if(_0x457e09[_0x91f5('0xab')]===-0x1){return _0x457e09;}}return this[_0x91f5('0x36')][_0x91f5('0xbb')]();};AGIVertices['prototype'][_0x91f5('0xbe')]=function(_0x202d03){logger['info'](util[_0x91f5('0x27')](_0x91f5('0xbf'),_0x202d03[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x202d03['list_id'])){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x202d03,_0x91f5('0xc0'));}_0x202d03[_0x91f5('0x4a')]=moment();if(this[_0x91f5('0xa3')](_0x202d03[_0x91f5('0xc1')])){_0x202d03[_0x91f5('0x4a')]=moment()[_0x91f5('0xc2')](_0x202d03[_0x91f5('0xc1')],_0x91f5('0xc3'));}if(!this[_0x91f5('0xa3')](_0x202d03[_0x91f5('0x4d')])){_0x202d03[_0x91f5('0x4d')]=0x2;}this[_0x91f5('0xc4')][_0x91f5('0x70')](this,_0x202d03);return this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0xc5'),_0x202d03[_0x91f5('0x48')],_0x202d03[_0x91f5('0x49')],_0x202d03[_0x91f5('0x4a')]));};AGIVertices['prototype'][_0x91f5('0xc6')]=function(_0x21894a){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0xc7'),_0x21894a[_0x91f5('0x38')]));var _0x4e5956=this[_0x91f5('0x36')][_0x91f5('0x57')](_0x21894a['application'],_0x21894a[_0x91f5('0x78')]);if(_0x4e5956[_0x91f5('0xab')]===-0x1){return _0x4e5956;}return this[_0x91f5('0x36')][_0x91f5('0xa8')](util['format'](_0x91f5('0xc8'),_0x21894a[_0x91f5('0xc9')],_0x21894a['options']));};AGIVertices[_0x91f5('0xe')][_0x91f5('0xca')]=function(_0x4d889b){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0xcb'),_0x4d889b['label']));if(!this[_0x91f5('0xa3')](_0x4d889b['text'])){return this[_0x91f5('0x36')]['noop']('no\x20text\x20configured');}var _0x270c2e='\x22'+_0x4d889b[_0x91f5('0x5b')]+'\x22';if(this[_0x91f5('0xa3')](_0x4d889b[_0x91f5('0x78')])){_0x270c2e+=','+_0x4d889b[_0x91f5('0x78')];}var _0x1db19b=this[_0x91f5('0x36')]['exec']('MRCPSynth',_0x270c2e);if(_0x1db19b['result']===-0x1){return _0x1db19b;}return this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0xcc'),_0x270c2e));};AGIVertices['prototype'][_0x91f5('0xcd')]=function(_0x3f453f){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x3f453f['label']));if(!this[_0x91f5('0xa3')](_0x3f453f[_0x91f5('0x5b')])){return this[_0x91f5('0x36')][_0x91f5('0xa8')](_0x91f5('0xa9'));}var _0x1cf0e7='\x22'+_0x3f453f[_0x91f5('0x5b')]+'\x22';if(this['isConfigured'](_0x3f453f[_0x91f5('0x78')])){_0x1cf0e7+=','+_0x3f453f[_0x91f5('0x78')];}var _0x4c3874=this['channel'][_0x91f5('0x57')](_0x91f5('0xaa'),_0x1cf0e7);if(_0x4c3874[_0x91f5('0xab')]===-0x1){return _0x4c3874;}return this[_0x91f5('0x36')][_0x91f5('0xa8')](util['format'](_0x91f5('0xcc'),_0x1cf0e7));};AGIVertices[_0x91f5('0xe')][_0x91f5('0xce')]=function(_0x464965){logger[_0x91f5('0x2c')](util['format'](_0x91f5('0xcf'),_0x464965[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x464965['grammar'])){return this[_0x91f5('0x36')][_0x91f5('0xa8')]('no\x20grammar\x20configured');}var _0x5c6386=_0x464965[_0x91f5('0xae')];if(this[_0x91f5('0xa3')](_0x464965[_0x91f5('0x78')])){_0x5c6386+=','+_0x464965[_0x91f5('0x78')];}var _0x4c623a=this[_0x91f5('0x36')][_0x91f5('0x57')](_0x91f5('0xb0'),_0x5c6386);if(_0x4c623a['result']===-0x1){return _0x4c623a;}var _0x5a0be1=this[_0x91f5('0xa1')](_0x91f5('0xb1'),_0x91f5('0xd0'));if(_0x5a0be1['result']===-0x1){return _0x5a0be1;}var _0x26706b=this[_0x91f5('0xa1')]('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0x26706b[_0x91f5('0xab')]===-0x1){return _0x26706b;}var _0x38fa9a=this[_0x91f5('0xa1')](_0x91f5('0xb5'),_0x91f5('0xd1'));if(_0x38fa9a[_0x91f5('0xab')]===-0x1){return _0x38fa9a;}return this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0xb7'),_0x5c6386));};AGIVertices[_0x91f5('0xe')][_0x91f5('0xd2')]=function(_0x571a9c){logger['info'](util[_0x91f5('0x27')](_0x91f5('0xd3'),_0x571a9c[_0x91f5('0x38')]));if(!this['isConfigured'](_0x571a9c[_0x91f5('0xae')])){return this['channel'][_0x91f5('0xa8')](_0x91f5('0xaf'));}var _0x166dcd=_0x571a9c[_0x91f5('0xae')];if(this[_0x91f5('0xa3')](_0x571a9c['options'])){_0x166dcd+=','+_0x571a9c['options'];}var _0x4f2edb=this['channel'][_0x91f5('0x57')](_0x91f5('0xb0'),_0x166dcd);if(_0x4f2edb['result']===-0x1){return _0x4f2edb;}var _0x5b9778=this[_0x91f5('0xa1')]('RECOG_CONFIDENCE()',_0x91f5('0xd4'));if(_0x5b9778[_0x91f5('0xab')]===-0x1){return _0x5b9778;}var _0x77ddd2=this['getAndSetVariable']('RECOG_INPUT()',_0x91f5('0xd5'));if(_0x77ddd2[_0x91f5('0xab')]===-0x1){return _0x77ddd2;}var _0x4f9f85=this[_0x91f5('0xa1')](_0x91f5('0xb5'),_0x91f5('0xd6'));if(_0x4f9f85[_0x91f5('0xab')]===-0x1){return _0x4f9f85;}return this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')]('Executed\x20command\x20MRCPRecog\x20%s',_0x166dcd));};AGIVertices['prototype']['database']=function(_0x4a10e5){logger[_0x91f5('0x2c')](util['format'](_0x91f5('0xd7'),_0x4a10e5[_0x91f5('0x38')]));if(!this['isConfigured'](_0x4a10e5[_0x91f5('0xd8')])){return this['channel'][_0x91f5('0x31')](_0x4a10e5,_0x91f5('0xd9'));}var _0x270ed9=this['getSquareOdbc'][_0x91f5('0x70')](this,_0x4a10e5[_0x91f5('0xd8')]);if(!_0x270ed9){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x4a10e5,_0x91f5('0xda'));}if(!this[_0x91f5('0xa3')](_0x4a10e5['query'])){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x4a10e5,_0x91f5('0xdb'));}var _0x2e44e1=_0x4a10e5[_0x91f5('0x2d')][_0x91f5('0xdc')](/(\r\n|\n|\r)/gm,'\x20');this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0xdd'),_0x2e44e1));var _0x192a9d=this[_0x91f5('0x29')][_0x91f5('0x70')](this,_0x270ed9,_0x2e44e1);this[_0x91f5('0x35')][_0x91f5('0x70')](this,_0x4a10e5,_0x2e44e1);if(!this[_0x91f5('0xa3')](_0x4a10e5['variable_id'])){return this['channel'][_0x91f5('0xa8')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x462ac0=this[_0x91f5('0xf')][_0x91f5('0x70')](this,_0x4a10e5['variable_id']);if(!_0x462ac0){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x4a10e5,_0x91f5('0xde'));}var _0x59e9b9=this;_0x192a9d[_0x91f5('0xdf')](function(_0x14046d,_0xdbb33b){Object['keys'](_0x14046d)[_0x91f5('0xdf')](function(_0x3080bc){_0x59e9b9[_0x91f5('0x36')][_0x91f5('0x9c')](util[_0x91f5('0x27')]('%s[%s][%s]',_0x462ac0,_0xdbb33b,_0x3080bc),_0x14046d[_0x3080bc]);});});this['channel'][_0x91f5('0x9c')](util[_0x91f5('0x27')](_0x91f5('0xe0'),_0x462ac0),_0x192a9d['length']);return this[_0x91f5('0x36')][_0x91f5('0xa8')](util['format']('variable\x20%s\x20set',_0x462ac0));};AGIVertices[_0x91f5('0xe')][_0x91f5('0xe1')]=function(_0xabf1b6){logger['debug'](util[_0x91f5('0x27')](_0x91f5('0xe2'),_0xabf1b6[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0xabf1b6[_0x91f5('0xe3')])){return this[_0x91f5('0x36')]['error'](_0xabf1b6,_0x91f5('0xe4'));}var _0x426462=this[_0x91f5('0x1a')][_0x91f5('0x70')](this,_0xabf1b6['sip_id']);if(!_0x426462){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0xabf1b6,_0x91f5('0xe5'));}var _0x24af6a=this[_0x91f5('0x36')]['exec']('DIAL',[util['format'](_0x91f5('0xe6'),_0x426462),_0xabf1b6['timeout'],_0xabf1b6[_0x91f5('0xe7')],_0xabf1b6[_0x91f5('0x64')]]);if(_0x24af6a[_0x91f5('0xab')]===-0x1){return _0x24af6a;}return this[_0x91f5('0x36')]['noop'](util['format'](_0x91f5('0xe8'),_0x91f5('0xe9')));};AGIVertices[_0x91f5('0xe')][_0x91f5('0xea')]=function(_0x5c31c9){logger['info'](util[_0x91f5('0x27')](_0x91f5('0xeb'),_0x5c31c9[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x5c31c9['key'])){return this['channel'][_0x91f5('0xa8')](_0x91f5('0xec'));}if(!this[_0x91f5('0xa3')](_0x5c31c9[_0x91f5('0x5b')])){return this['channel'][_0x91f5('0xa8')](_0x91f5('0xa9'));}this[_0x91f5('0x36')][_0x91f5('0xed')]=!![];this[_0x91f5('0x35')](_0x5c31c9);this['createSquareMessage'](_0x5c31c9[_0x91f5('0x5b')],'in','','');this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0xee'),_0x5c31c9[_0x91f5('0x5b')]));var _0x36be5c=this[_0x91f5('0x79')][_0x91f5('0x70')](this,_0x5c31c9);if(_0x36be5c){for(var _0x1bc5d2 in _0x36be5c){if(_0x36be5c[_0x91f5('0x93')](_0x1bc5d2)){this[_0x91f5('0x36')]['setVariable'](util['format'](_0x91f5('0xef'),_0x1bc5d2[_0x91f5('0x68')]()),_0x36be5c[_0x1bc5d2]);}}this[_0x91f5('0x43')](_0x36be5c['speech'],_0x91f5('0xf0'),_0x91f5('0xea'),'');return this['channel'][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0xf1'),_0x36be5c['speech']));}return this['channel'][_0x91f5('0x31')](_0x5c31c9,_0x91f5('0xf2'));};AGIVertices[_0x91f5('0xe')]['dialogflowV2']=function(_0x2e9ae3){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x2e9ae3[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x2e9ae3[_0x91f5('0x7c')])){return this[_0x91f5('0x36')][_0x91f5('0xa8')]('no\x20project_id\x20configured');}if(!this['isConfigured'](_0x2e9ae3['client_email'])){return this[_0x91f5('0x36')][_0x91f5('0xa8')](_0x91f5('0xf3'));}if(!this[_0x91f5('0xa3')](_0x2e9ae3[_0x91f5('0x7e')])){return this['channel'][_0x91f5('0xa8')](_0x91f5('0xf4'));}if(!this[_0x91f5('0xa3')](_0x2e9ae3[_0x91f5('0x7f')])){return this['channel'][_0x91f5('0xa8')]('no\x20anguage\x20configured');}if(!this[_0x91f5('0xa3')](_0x2e9ae3[_0x91f5('0x5b')])){return this['channel'][_0x91f5('0xa8')](_0x91f5('0xa9'));}this['channel'][_0x91f5('0xed')]=!![];this[_0x91f5('0x35')](_0x2e9ae3);this[_0x91f5('0x43')](_0x2e9ae3['text'],'in','','');this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0xf5'),_0x2e9ae3['text']));var _0x238f30=this[_0x91f5('0x7b')][_0x91f5('0x70')](this,_0x2e9ae3);if(_0x238f30){for(var _0x2954f8 in _0x238f30){if(_0x238f30[_0x91f5('0x93')](_0x2954f8)){if(_0x2954f8!=='providerResponse'){this[_0x91f5('0x36')]['setVariable'](util['format'](_0x91f5('0xef'),_0x2954f8[_0x91f5('0x68')]()),_0x238f30[_0x2954f8]);}}}this['createSquareMessage'](_0x238f30[_0x91f5('0xf6')],_0x91f5('0xf0'),_0x91f5('0xf7'),_0x238f30[_0x91f5('0xf8')]);return this['channel']['noop'](util['format'](_0x91f5('0xf9'),_0x238f30[_0x91f5('0xf6')]));}return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x2e9ae3,_0x91f5('0xfa'));};AGIVertices[_0x91f5('0xe')][_0x91f5('0xfb')]=function(_0x524911){logger['info'](util[_0x91f5('0x27')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x524911[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x524911[_0x91f5('0xfc')])){return this[_0x91f5('0x36')][_0x91f5('0xa8')](_0x91f5('0xfd'));}if(!this['isConfigured'](_0x524911[_0x91f5('0xfe')])){return this['channel'][_0x91f5('0xa8')]('no\x20username\x20configured');}if(!this[_0x91f5('0xa3')](_0x524911['password'])){return this['channel']['noop'](_0x91f5('0xff'));}if(!this['isConfigured'](_0x524911[_0x91f5('0x100')])){return this[_0x91f5('0x36')][_0x91f5('0xa8')]('no\x20text\x20configured');}this['channel'][_0x91f5('0xed')]=!![];this['createSquareDetailsReport'](_0x524911);this[_0x91f5('0x43')](_0x524911[_0x91f5('0x5b')],'in','','');this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x101'),_0x524911[_0x91f5('0x5b')]));var _0x2efcfd=this[_0x91f5('0x80')][_0x91f5('0x70')](this,_0x524911);if(_0x2efcfd){for(var _0x85ff42 in _0x2efcfd){if(_0x2efcfd[_0x91f5('0x93')](_0x85ff42)){this[_0x91f5('0x36')][_0x91f5('0x9c')](util[_0x91f5('0x27')](_0x91f5('0x102'),_0x85ff42[_0x91f5('0x68')]()),_0x2efcfd[_0x85ff42]);}}this['createSquareMessage'](_0x2efcfd[_0x91f5('0xf6')],_0x91f5('0xf0'),_0x91f5('0xfb'),'');if(_0x2efcfd[_0x91f5('0x103')]){this[_0x91f5('0x36')][_0x91f5('0xa8')](util['format'](_0x91f5('0x104'),_0x2efcfd[_0x91f5('0x103')]));var _0x535543=this['channel'][_0x91f5('0x105')](_0x2efcfd[_0x91f5('0x103')]);try{fs[_0x91f5('0x106')](_0x2efcfd[_0x91f5('0x103')]+_0x91f5('0x107'));}catch(_0x175810){logger[_0x91f5('0x31')](_0x175810);}return _0x535543;}else{return this['channel'][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x108'),_0x2efcfd[_0x91f5('0xf6')]));}}return this[_0x91f5('0x36')]['error'](_0x524911,_0x91f5('0x109'));};AGIVertices[_0x91f5('0xe')][_0x91f5('0x10a')]=function(_0x2cae59){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')]('Enter\x20in\x20END\x20(%s)\x20block',_0x2cae59[_0x91f5('0x38')]));return this[_0x91f5('0x36')]['noop'](_0x91f5('0x10a'));};AGIVertices[_0x91f5('0xe')][_0x91f5('0x10b')]=function(_0x305fe6){logger['info'](util[_0x91f5('0x27')](_0x91f5('0x10c'),_0x305fe6['label']));var _0x1df724='';if(_0x305fe6['trunk_id']){if(!this[_0x91f5('0xa3')](_0x305fe6['trunk_id'])){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x305fe6,_0x91f5('0x10d'));}else{var _0x264483=parseInt(_0x305fe6[_0x91f5('0x10e')],0xa);if(isNaN(_0x264483)){_0x1df724=_0x305fe6[_0x91f5('0x10e')];}else{_0x1df724=this['getTrunk']['sync'](this,_0x305fe6[_0x91f5('0x10e')]);if(!_0x1df724){return this['channel'][_0x91f5('0x31')](_0x305fe6,_0x91f5('0x10f'));}}}}else if(_0x305fe6[_0x91f5('0x110')]){_0x1df724=_0x305fe6[_0x91f5('0x110')];}else{return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x305fe6,_0x91f5('0x10d'));}var _0x237288=this[_0x91f5('0x36')][_0x91f5('0x57')](_0x91f5('0xe9'),[util['format']('SIP/%s/%s',_0x1df724,_0x305fe6[_0x91f5('0x48')]),_0x305fe6[_0x91f5('0x66')],_0x305fe6[_0x91f5('0xe7')],_0x305fe6[_0x91f5('0x64')]]);if(_0x237288['result']===-0x1){return _0x237288;}return this['channel'][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0xe8'),'DIAL'));};AGIVertices['prototype'][_0x91f5('0x111')]=function(_0x218f5c){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x218f5c[_0x91f5('0x38')]));return this[_0x91f5('0x36')][_0x91f5('0xa8')](_0x91f5('0x111'));};AGIVertices[_0x91f5('0xe')][_0x91f5('0xa')]=function(_0x283849){logger[_0x91f5('0x2c')](util['format'](_0x91f5('0x112'),_0x283849['label']));if(_0x283849[_0x91f5('0xa5')]===0x0){return this['maxRetry'](_0x283849);}_0x283849[_0x91f5('0xa5')]-=0x1;if(!this[_0x91f5('0xa3')](_0x283849[_0x91f5('0x113')])){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x283849,_0x91f5('0x114'));}var _0x9e0335=this[_0x91f5('0x1d')][_0x91f5('0x70')](this,_0x283849[_0x91f5('0x113')]);if(!_0x9e0335){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x283849,_0x91f5('0x115'));}if(!this['isConfigured'](_0x283849[_0x91f5('0x116')])){return this['channel'][_0x91f5('0x31')](_0x91f5('0x117'));}var _0x592a2e=this[_0x91f5('0x36')][_0x91f5('0x118')](_0x9e0335,_0x283849[_0x91f5('0x119')],_0x283849['maxdigit']);var _0x2d162d=_0x592a2e['result']?_0x592a2e[_0x91f5('0xab')][_0x91f5('0x4c')]():'';logger['info']('test',JSON[_0x91f5('0x73')](_0x592a2e));if(_0x592a2e[_0x91f5('0xab')]===-0x1){this[_0x91f5('0x35')][_0x91f5('0x70')](this,_0x283849,_0x2d162d);return _0x592a2e;}else if(_0x592a2e[_0x91f5('0xa0')]===_0x91f5('0x66')){_0x592a2e[_0x91f5('0xab')]=_0x2d162d[_0x91f5('0x99')]>=parseInt(_0x283849[_0x91f5('0x11a')])?'x':'i';}else{_0x592a2e[_0x91f5('0xab')]=_0x2d162d['length']>=parseInt(_0x283849[_0x91f5('0x11a')])&&_0x2d162d['length']<=parseInt(_0x283849[_0x91f5('0x11b')])?'x':'i';}var _0x41bfa9=this[_0x91f5('0xf')][_0x91f5('0x70')](this,_0x283849['variable_id']);if(!_0x41bfa9){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x283849,'no\x20variable\x20found');}this[_0x91f5('0x36')]['setVariable'](_0x41bfa9,_0x2d162d);if(this['isConfigured'](_0x283849[_0x91f5('0x11c')])){var _0x994ce1=parseInt(_0x283849['hiddendigitsnum'],0xa);var _0x22340b=rs[_0x91f5('0x11d')]({'charset':'*','length':_0x994ce1});var _0x1b7939=_0x2d162d[_0x91f5('0x99')];if(_0x1b7939>0x0){if(_0x1b7939>_0x994ce1){this[_0x91f5('0x35')][_0x91f5('0x70')](this,_0x283849,_0x283849[_0x91f5('0x11e')]===_0x91f5('0x11f')?_0x22340b+_0x2d162d[_0x91f5('0x120')](_0x994ce1):_0x2d162d[_0x91f5('0x120')](0x0,_0x1b7939-_0x994ce1)+_0x22340b);}else{this[_0x91f5('0x35')][_0x91f5('0x70')](this,_0x283849,rs['generate']({'charset':'*','length':_0x1b7939}));}}else{this[_0x91f5('0x35')][_0x91f5('0x70')](this,_0x283849,'');}}else{this[_0x91f5('0x35')][_0x91f5('0x70')](this,_0x283849,_0x2d162d);}return _0x592a2e;};AGIVertices[_0x91f5('0xe')][_0x91f5('0xb')]=function(_0x43f66d){logger['info'](util[_0x91f5('0x27')](_0x91f5('0x121'),_0x43f66d[_0x91f5('0x38')]));return this[_0x91f5('0xa')](_0x43f66d);};AGIVertices[_0x91f5('0xe')][_0x91f5('0x122')]=function(_0x1e4316){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x123'),_0x1e4316[_0x91f5('0x38')]));this[_0x91f5('0x35')][_0x91f5('0x70')](this,_0x1e4316,_0x1e4316[_0x91f5('0x124')]);return this[_0x91f5('0x36')][_0x91f5('0xa8')](util['format'](_0x91f5('0x125'),_0x1e4316[_0x91f5('0x124')]));};AGIVertices['prototype'][_0x91f5('0x126')]=function(_0x55cc75){logger[_0x91f5('0x2c')](util['format'](_0x91f5('0x127'),_0x55cc75[_0x91f5('0x38')]));if(!this['isConfigured'](_0x55cc75[_0x91f5('0x86')])||!this[_0x91f5('0xa3')](_0x55cc75[_0x91f5('0x87')])){return this['channel']['noop'](_0x91f5('0x128'));}if(!this[_0x91f5('0xa3')](_0x55cc75[_0x91f5('0x5b')])){return this[_0x91f5('0x36')][_0x91f5('0xa8')](_0x91f5('0xa9'));}this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x129'),_0x55cc75[_0x91f5('0x5b')]));var _0x44edf7=this[_0x91f5('0x85')][_0x91f5('0x70')](this,_0x55cc75);if(_0x44edf7){this['channel']['noop'](util[_0x91f5('0x27')](_0x91f5('0x12a'),_0x44edf7));var _0x43b793=this['channel'][_0x91f5('0x105')](_0x44edf7);try{fs['unlink'](_0x44edf7+_0x91f5('0x107'));}catch(_0x79753a){logger[_0x91f5('0x31')](_0x79753a);}return _0x43b793;}return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x55cc75,_0x91f5('0x12b'));};AGIVertices[_0x91f5('0xe')][_0x91f5('0x12c')]=function(_0x11665a){logger['info'](util[_0x91f5('0x27')](_0x91f5('0x12d'),_0x11665a[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x11665a[_0x91f5('0x86')])||!this[_0x91f5('0xa3')](_0x11665a['aws_secret_access_key'])){return this[_0x91f5('0x36')][_0x91f5('0xa8')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x11665a[_0x91f5('0x8c')])){return this[_0x91f5('0x36')][_0x91f5('0xa8')]('no\x20bot\x20name\x20configured');}if(!this[_0x91f5('0xa3')](_0x11665a[_0x91f5('0x5b')])){return this[_0x91f5('0x36')]['noop'](_0x91f5('0xa9'));}this[_0x91f5('0x36')][_0x91f5('0xed')]=!![];this['createSquareDetailsReport'](_0x11665a);this[_0x91f5('0x43')](_0x11665a[_0x91f5('0x5b')],'in','','');this['channel'][_0x91f5('0xa8')](util[_0x91f5('0x27')]('Trying\x20Amazon\x20Lex:\x20%s',_0x11665a[_0x91f5('0x5b')]));var _0x1c0b1d=this[_0x91f5('0x8b')][_0x91f5('0x70')](this,_0x11665a);if(_0x1c0b1d){for(var _0x19206c in _0x1c0b1d){if(_0x1c0b1d[_0x91f5('0x93')](_0x19206c)&&_[_0x91f5('0x94')](_0x1c0b1d[_0x19206c])){this[_0x91f5('0x36')]['setVariable'](util[_0x91f5('0x27')]('AWS_LEX_%s',_0x19206c[_0x91f5('0x68')]()),_0x1c0b1d[_0x19206c]);}}if(_[_0x91f5('0x45')](_0x1c0b1d[_0x91f5('0x77')])){return this[_0x91f5('0x36')]['noop'](_0x91f5('0x12e'));}else{this[_0x91f5('0x43')](_0x1c0b1d[_0x91f5('0x77')],_0x91f5('0xf0'),_0x91f5('0x12f'),'');return this['channel'][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x130'),_0x1c0b1d[_0x91f5('0x77')]));}}return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x11665a,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x91f5('0xe')]['googleasr']=function(_0x4e63e9){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x131'),_0x4e63e9[_0x91f5('0x38')],_0x4e63e9[_0x91f5('0x66')]));if(!this[_0x91f5('0xa3')](_0x4e63e9[_0x91f5('0x7a')])){return this['channel'][_0x91f5('0xa8')](_0x91f5('0xec'));}var _0x5c210b=_0x91f5('0x132');var _0x23f85f=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x91f5('0x11d')](0x4));var _0x3024aa=util[_0x91f5('0x27')](_0x91f5('0x9b'),_0x23f85f,_0x5c210b);var _0x24dbae=!![];if(_0x4e63e9[_0x91f5('0x133')]===_0x91f5('0x134')){_0x24dbae=![];}var _0x31a72c=this[_0x91f5('0x36')][_0x91f5('0x135')](_0x23f85f,_0x5c210b,_0x4e63e9[_0x91f5('0x136')],_0x4e63e9[_0x91f5('0x66')],undefined,_0x24dbae);if(_0x31a72c[_0x91f5('0xab')]!==-0x1){this[_0x91f5('0x36')][_0x91f5('0xa8')](util['format'](_0x91f5('0x137'),_0x3024aa));var _0x1d1a89=this[_0x91f5('0x8d')][_0x91f5('0x70')](this,_0x4e63e9,_0x3024aa);if(_0x1d1a89){for(var _0x129155 in _0x1d1a89){if(_0x1d1a89[_0x91f5('0x93')](_0x129155)){this[_0x91f5('0x36')][_0x91f5('0x9c')](util[_0x91f5('0x27')]('GOOGLE_ASR_%s',_0x129155['toUpperCase']()),_0x1d1a89[_0x129155]);}}return this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x138'),JSON[_0x91f5('0x73')](_0x1d1a89)));}}return _0x31a72c;};AGIVertices[_0x91f5('0xe')][_0x91f5('0x139')]=function(_0x189a59){logger['info'](util[_0x91f5('0x27')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x189a59[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x189a59[_0x91f5('0x8f')])){return this[_0x91f5('0x36')]['noop']('no\x20appid\x20configured');}if(!this[_0x91f5('0xa3')](_0x189a59[_0x91f5('0x90')])){return this[_0x91f5('0x36')][_0x91f5('0xa8')](_0x91f5('0x13a'));}var _0xaf649d=_0x91f5('0x132');var _0x38037e=util[_0x91f5('0x27')](_0x91f5('0x13b'),FILES_PATH,rs['generate'](0x4));var _0x235902=util[_0x91f5('0x27')](_0x91f5('0x9b'),_0x38037e,_0xaf649d);var _0x53c4ab=!![];if(_0x189a59[_0x91f5('0x133')]===_0x91f5('0x134')){_0x53c4ab=![];}var _0x12dd88=this['channel'][_0x91f5('0x135')](_0x38037e,_0xaf649d,_0x189a59['intKey'],_0x189a59[_0x91f5('0x66')],undefined,_0x53c4ab);if(_0x12dd88['result']!==-0x1){this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x13c'),_0x235902));var _0x1a3a77=this['tildeASR']['sync'](this,_0x189a59,_0x235902);if(_0x1a3a77){for(var _0x4468d1 in _0x1a3a77){if(_0x1a3a77[_0x91f5('0x93')](_0x4468d1)){this['channel'][_0x91f5('0x9c')](util[_0x91f5('0x27')](_0x91f5('0x13d'),_0x4468d1[_0x91f5('0x68')]()),_0x1a3a77[_0x4468d1]);}}return this['channel'][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x13e'),JSON[_0x91f5('0x73')](_0x1a3a77)));}}return _0x12dd88;};AGIVertices['prototype']['gotoc']=function(_0x3aee6a){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x13f'),_0x3aee6a[_0x91f5('0x38')]));return this['channel'][_0x91f5('0x140')](_0x3aee6a['context'],_0x3aee6a[_0x91f5('0x3f')],_0x3aee6a[_0x91f5('0x40')]);};AGIVertices[_0x91f5('0xe')][_0x91f5('0x141')]=function(_0x1f82c4){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x142'),_0x1f82c4[_0x91f5('0x38')]));if(!this['isConfigured'](_0x1f82c4['condition'])){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x1f82c4,_0x91f5('0x143'));}try{var _0x428efc=eval(_0x1f82c4[_0x91f5('0x144')])?_0x91f5('0x145'):_0x91f5('0x146');this['channel']['noop'](util[_0x91f5('0x27')](_0x91f5('0x147'),_0x1f82c4[_0x91f5('0x144')],_0x428efc));return{'code':0xc8,'result':_0x428efc};}catch(_0x1f8294){return{'code':0xc8,'result':_0x91f5('0x146')};}};AGIVertices[_0x91f5('0xe')][_0x91f5('0x148')]=function(_0x473e2d){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x473e2d[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x473e2d[_0x91f5('0x149')])){return this[_0x91f5('0x36')]['error'](_0x473e2d,_0x91f5('0x14a'));}var _0x397464=this[_0x91f5('0x23')]['sync'](this,_0x473e2d[_0x91f5('0x149')]);if(!_0x397464){return this['channel'][_0x91f5('0x31')](_0x473e2d,_0x91f5('0x14b'));}for(var _0x3119b9=0x0;_0x3119b9<_0x397464['length'];_0x3119b9+=0x1){var _0x29860b=this[_0x91f5('0x36')][_0x91f5('0xf')](util[_0x91f5('0x27')](_0x91f5('0x14c'),_0x397464[_0x3119b9]));if(_0x29860b['result']===-0x1){return _0x29860b;}logger[_0x91f5('0x2c')](util[_0x91f5('0x27')]('IFTIME\x20%s\x20%s',_0x397464[_0x3119b9],_0x29860b[_0x91f5('0xa0')]));if(_0x29860b[_0x91f5('0xa0')]==='true'){logger[_0x91f5('0x2c')](util['format'](_0x91f5('0x14d'),_0x397464[_0x3119b9],_0x91f5('0x145')));this['channel'][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x14d'),_0x397464[_0x3119b9],_0x91f5('0x145')));return{'code':0xc8,'result':'true'};}else{logger['info'](util[_0x91f5('0x27')](_0x91f5('0x14d'),_0x397464[_0x3119b9],_0x91f5('0x146')));this[_0x91f5('0x36')]['noop'](util['format'](_0x91f5('0x14d'),_0x397464[_0x3119b9],_0x91f5('0x146')));}}return{'code':0xc8,'result':_0x91f5('0x146')};};AGIVertices[_0x91f5('0xe')][_0x91f5('0x14e')]=function(_0x2da800){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x2da800[_0x91f5('0x38')]));return this[_0x91f5('0x36')]['hangup']();};AGIVertices['prototype']['ispeechasr']=function(_0x5e97d8){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x14f'),_0x5e97d8[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x5e97d8[_0x91f5('0x7a')])){return this[_0x91f5('0x36')][_0x91f5('0xa8')](_0x91f5('0xec'));}var _0x4fcd87=_0x91f5('0x132');var _0x474127=util[_0x91f5('0x27')]('%s/recordings/%s',FILES_PATH,rs[_0x91f5('0x11d')](0x4));var _0x114dce=util[_0x91f5('0x27')]('%s.%s',_0x474127,_0x4fcd87);var _0x48c964=!![];if(_0x5e97d8[_0x91f5('0x133')]===_0x91f5('0x134')){_0x48c964=![];}var _0x31ae58=this['channel'][_0x91f5('0x135')](_0x474127,_0x4fcd87,_0x5e97d8[_0x91f5('0x136')],_0x5e97d8[_0x91f5('0x66')],undefined,_0x48c964);if(_0x31ae58[_0x91f5('0xab')]!==-0x1){this['channel'][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x150'),_0x114dce));var _0x30696c=this[_0x91f5('0x83')][_0x91f5('0x70')](this,_0x5e97d8,_0x114dce);if(_0x30696c){for(var _0x5c24ba in _0x30696c){if(_0x30696c['hasOwnProperty'](_0x5c24ba)){this[_0x91f5('0x36')][_0x91f5('0x9c')](util[_0x91f5('0x27')]('ISPEECH_ASR_%s',_0x5c24ba[_0x91f5('0x68')]()),_0x30696c[_0x5c24ba]);}}return this[_0x91f5('0x36')][_0x91f5('0xa8')](util['format']('IspeechASR\x20Result\x20%s',JSON[_0x91f5('0x73')](_0x30696c)));}}return _0x31ae58;};AGIVertices[_0x91f5('0xe')][_0x91f5('0x151')]=function(_0x432506){logger['info'](util[_0x91f5('0x27')](_0x91f5('0x152'),_0x432506[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x432506['key'])){return this[_0x91f5('0x36')][_0x91f5('0xa8')]('no\x20key\x20configured');}if(!this[_0x91f5('0xa3')](_0x432506[_0x91f5('0x5b')])){return this[_0x91f5('0x36')][_0x91f5('0xa8')](_0x91f5('0xa9'));}this[_0x91f5('0x36')]['noop'](util[_0x91f5('0x27')]('Trying\x20ispeech\x20TTS\x20%s',_0x432506['text']));var _0x4b3308=this[_0x91f5('0x81')][_0x91f5('0x70')](this,_0x432506);if(_0x4b3308){this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x150'),_0x4b3308));var _0x1dacf6=this['channel'][_0x91f5('0x105')](_0x4b3308,_0x432506[_0x91f5('0x136')]);try{fs[_0x91f5('0x106')](_0x4b3308+_0x91f5('0x107'));}catch(_0x3ae7da){logger[_0x91f5('0x31')](_0x3ae7da);}return _0x1dacf6;}return this[_0x91f5('0x36')]['error'](_0x432506,_0x91f5('0x153'));};AGIVertices[_0x91f5('0xe')][_0x91f5('0x154')]=function(_0x2c27b8){logger['info'](util[_0x91f5('0x27')](_0x91f5('0x155'),_0x2c27b8[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x2c27b8[_0x91f5('0x156')])){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x2c27b8,_0x91f5('0x157'));}logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x158'),this[_0x91f5('0x36')][_0x91f5('0x3b')],_0x2c27b8[_0x91f5('0x156')]));var _0x5d5631=this[_0x91f5('0x53')][_0x91f5('0x70')](this,_0x2c27b8[_0x91f5('0x156')]);if(_0x5d5631){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x91f5('0x36')][_0x91f5('0x3b')],_0x2c27b8[_0x91f5('0x156')]));this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x91f5('0x36')]['callerid'],_0x2c27b8[_0x91f5('0x156')]));return{'code':0xc8,'result':_0x91f5('0x159')};}else{logger['info'](util[_0x91f5('0x27')](_0x91f5('0x15a'),this[_0x91f5('0x36')][_0x91f5('0x3b')],_0x2c27b8[_0x91f5('0x156')]));this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x15a'),this['channel'][_0x91f5('0x3b')],_0x2c27b8[_0x91f5('0x156')]));return{'code':0xc8,'result':_0x91f5('0x15b')};}};AGIVertices[_0x91f5('0xe')][_0x91f5('0x15c')]=function(_0x100cf7){logger[_0x91f5('0x2c')](util['format'](_0x91f5('0x15d'),_0x100cf7[_0x91f5('0x38')]));if(!this['isConfigured'](_0x100cf7[_0x91f5('0x156')])){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x100cf7,_0x91f5('0x157'));}logger[_0x91f5('0x2c')](util['format'](_0x91f5('0x158'),this[_0x91f5('0x36')][_0x91f5('0x3b')],_0x100cf7[_0x91f5('0x156')]));var _0x461753=this[_0x91f5('0x52')][_0x91f5('0x70')](this,_0x100cf7[_0x91f5('0x156')]);if(_0x461753){logger['info'](util['format'](_0x91f5('0x15e'),this[_0x91f5('0x36')][_0x91f5('0x3b')],_0x100cf7[_0x91f5('0x156')]));this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x15e'),this['channel'][_0x91f5('0x3b')],_0x100cf7[_0x91f5('0x156')]));return{'code':0xc8,'result':_0x91f5('0x159')};}else{logger[_0x91f5('0x2c')](util[_0x91f5('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x91f5('0x36')]['callerid'],_0x100cf7[_0x91f5('0x156')]));this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x15a'),this[_0x91f5('0x36')][_0x91f5('0x3b')],_0x100cf7['findBy']));return{'code':0xc8,'result':_0x91f5('0x15b')};}};AGIVertices[_0x91f5('0xe')][_0x91f5('0x15f')]=function(_0x2263f4){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x160'),_0x2263f4[_0x91f5('0x38')]));if(!this['isConfigured'](_0x2263f4[_0x91f5('0x161')])){return this[_0x91f5('0x36')]['error'](_0x2263f4,_0x91f5('0x162'));}this[_0x91f5('0x36')][_0x91f5('0xa8')](util['format'](_0x91f5('0x163'),_0x2263f4[_0x91f5('0x161')]));var _0x5cc35c=eval(_0x2263f4['operation']);if(!this[_0x91f5('0xa3')](_0x2263f4[_0x91f5('0x116')])){return this[_0x91f5('0x36')][_0x91f5('0xa8')](_0x91f5('0x117'));}var _0x4b7fc8=this[_0x91f5('0xf')][_0x91f5('0x70')](this,_0x2263f4[_0x91f5('0x116')]);if(!_0x4b7fc8){return this['channel'][_0x91f5('0x31')](_0x2263f4,_0x91f5('0xde'));}if(_[_0x91f5('0x98')](_0x5cc35c)){var _0x230a34=this;_0x5cc35c[_0x91f5('0xdf')](function(_0xeea696,_0x3a7f3c){_0x230a34[_0x91f5('0x36')][_0x91f5('0x9c')](util[_0x91f5('0x27')](_0x91f5('0x164'),_0x4b7fc8,_0x3a7f3c),_0xeea696);});return this[_0x91f5('0x36')][_0x91f5('0xa8')](util['format']('variable\x20%s[key]\x20set',_0x4b7fc8));}else{return this[_0x91f5('0x36')][_0x91f5('0x9c')](_0x4b7fc8,_0x5cc35c);}};AGIVertices['prototype'][_0x91f5('0x9')]=function(_0x4132b5){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x165'),_0x4132b5[_0x91f5('0x38')]));if(_0x4132b5['retry']===0x0){return this[_0x91f5('0xa4')](_0x4132b5);}_0x4132b5[_0x91f5('0xa5')]-=0x1;if(!this[_0x91f5('0xa3')](_0x4132b5['file_id'])){return this['channel']['error'](_0x4132b5,_0x91f5('0x114'));}var _0x1f4baf=this['getSound']['sync'](this,_0x4132b5[_0x91f5('0x113')]);if(!_0x1f4baf){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x4132b5,_0x91f5('0x115'));}var _0x59f41c=this[_0x91f5('0x36')]['getData'](_0x1f4baf,_0x4132b5[_0x91f5('0x119')],_0x4132b5[_0x91f5('0x166')]);var _0xa61095=_0x59f41c[_0x91f5('0xab')];if(_0x59f41c[_0x91f5('0xab')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x4132b5,'-1');return _0x59f41c;}else if(_0x59f41c['extra']==='timeout'){_0x59f41c[_0x91f5('0xab')]=_0x59f41c[_0x91f5('0xab')][_0x91f5('0x99')]>0x0?_0x59f41c['result']:'t';}else if(_[_0x91f5('0x44')](_0x59f41c[_0x91f5('0xab')])){_0x59f41c[_0x91f5('0xab')]='#';_0xa61095='#';}if(!this[_0x91f5('0xa3')](_0x4132b5[_0x91f5('0x116')])){this[_0x91f5('0x36')][_0x91f5('0xa8')](_0x91f5('0x117'));}else{var _0x2f68c0=this[_0x91f5('0xf')][_0x91f5('0x70')](this,_0x4132b5[_0x91f5('0x116')]);if(!_0x2f68c0){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x4132b5,_0x91f5('0xde'));}this[_0x91f5('0x36')][_0x91f5('0x9c')](_0x2f68c0,_0xa61095);}this[_0x91f5('0x35')][_0x91f5('0x70')](this,_0x4132b5,_0xa61095);return _0x59f41c;};AGIVertices[_0x91f5('0xe')][_0x91f5('0xa8')]=function(_0x59d353){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x59d353[_0x91f5('0x38')]));return this[_0x91f5('0x36')][_0x91f5('0xa8')](_0x59d353['output']||_0x59d353[_0x91f5('0x38')]);};AGIVertices[_0x91f5('0xe')][_0x91f5('0x167')]=function(_0x2b3f66){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x168'),_0x2b3f66[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x2b3f66[_0x91f5('0x156')])){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x2b3f66,_0x91f5('0x157'));}logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x158'),this[_0x91f5('0x36')]['callerid'],_0x2b3f66['findBy']));var _0x33bdd1=this['getPause'][_0x91f5('0x70')](this,_0x2b3f66[_0x91f5('0x169')]);var _0x8d69b1=this['agentPause'][_0x91f5('0x70')](this,_0x2b3f66[_0x91f5('0x156')],_0x33bdd1);if(_0x8d69b1){logger['info'](util['format'](_0x91f5('0x15e'),this[_0x91f5('0x36')]['callerid'],_0x2b3f66[_0x91f5('0x156')]));this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x91f5('0x36')][_0x91f5('0x3b')],_0x2b3f66[_0x91f5('0x156')]));return{'code':0xc8,'result':_0x91f5('0x159')};}else{logger['info'](util[_0x91f5('0x27')](_0x91f5('0x15a'),this['channel'][_0x91f5('0x3b')],_0x2b3f66[_0x91f5('0x156')]));this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x15e'),this[_0x91f5('0x36')][_0x91f5('0x3b')],_0x2b3f66[_0x91f5('0x156')]));return{'code':0xc8,'result':_0x91f5('0x15b')};}};AGIVertices['prototype'][_0x91f5('0x16a')]=function(_0x55422b){logger['info'](util[_0x91f5('0x27')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x55422b[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x55422b[_0x91f5('0x113')])){return this['channel'][_0x91f5('0x31')](_0x55422b,_0x91f5('0x114'));}var _0x3879f9=this[_0x91f5('0x1d')]['sync'](this,_0x55422b['file_id']);if(!_0x3879f9){return this['channel']['error'](_0x55422b,_0x91f5('0x115'));}var _0x4a5e79=this[_0x91f5('0x36')][_0x91f5('0x57')]('PLAYBACK',[_0x3879f9,_0x55422b[_0x91f5('0xe7')]]);if(_0x4a5e79[_0x91f5('0xab')]===-0x1){return _0x4a5e79;}return this[_0x91f5('0x36')]['noop'](util['format'](_0x91f5('0xc8'),_0x91f5('0x16b'),_0x3879f9));};AGIVertices[_0x91f5('0xe')][_0x91f5('0x16c')]=function(_0x2c9888){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x16d'),_0x2c9888[_0x91f5('0x38')]));if(!this['isConfigured'](_0x2c9888[_0x91f5('0x16e')])){return this[_0x91f5('0x36')]['error'](_0x2c9888,_0x91f5('0x16f'));}var _0x441718='';var _0x4e472e=parseInt(_0x2c9888[_0x91f5('0x16e')],0xa);if(isNaN(_0x4e472e)){_0x441718=_0x2c9888[_0x91f5('0x16e')];}else{_0x441718=this[_0x91f5('0x14')][_0x91f5('0x70')](this,_0x2c9888[_0x91f5('0x16e')]);if(!_0x441718){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x2c9888,_0x91f5('0x170'));}}var _0x1d3509='';if(this['isConfigured'](_0x2c9888[_0x91f5('0x113')])){var _0x1a1506=this['getSound'][_0x91f5('0x70')](this,_0x2c9888[_0x91f5('0x113')]);if(_0x1a1506){_0x1d3509=_0x1a1506;}}this[_0x91f5('0x35')][_0x91f5('0x70')](this,_0x2c9888,_0x441718);if(_0x2c9888[_0x91f5('0xe7')]['indexOf']('x')<0x0){_0x2c9888[_0x91f5('0xe7')]+='x';}if(_0x2c9888[_0x91f5('0xe7')][_0x91f5('0x171')]('X')<0x0){_0x2c9888[_0x91f5('0xe7')]+='X';}this[_0x91f5('0x36')]['setVariable'](_0x91f5('0x172'),_0x441718?_0x441718[_0x91f5('0x173')]():'');var _0x48e135=this['channel']['exec']('QUEUE',[_0x441718,_0x2c9888[_0x91f5('0xe7')],_0x2c9888['url'],_0x1d3509,_0x2c9888['timeout'],_0x2c9888[_0x91f5('0x5')],_0x2c9888[_0x91f5('0x174')],_0x2c9888[_0x91f5('0x175')],'',_0x2c9888[_0x91f5('0x176')]]);if(_0x48e135[_0x91f5('0xab')]===-0x1){return _0x48e135;}return this[_0x91f5('0x36')][_0x91f5('0xa8')](util['format'](_0x91f5('0xc8'),_0x91f5('0x177'),_0x441718));};AGIVertices[_0x91f5('0xe')]['record']=function(_0x3552a5){logger['info'](util[_0x91f5('0x27')](_0x91f5('0x178'),_0x3552a5[_0x91f5('0x38')]));var _0x1eea79=_0x3552a5[_0x91f5('0x179')]||_0x91f5('0x132');var _0x5931af=util[_0x91f5('0x27')](_0x91f5('0x17a'),this['channel']['uniqueid'],rs[_0x91f5('0x11d')](0x5));var _0x14cc62=util[_0x91f5('0x27')](_0x91f5('0x17b'),FILES_PATH,_0x5931af,_0x1eea79);var _0x1c846c=util[_0x91f5('0x27')]('%s/recordings/%s',FILES_PATH,_0x5931af);this[_0x91f5('0x3c')][_0x91f5('0x70')](this,_0x3552a5,_0x5931af,_0x14cc62);this[_0x91f5('0x36')][_0x91f5('0x9c')]('RECORDING_SAVENAME',_0x5931af);logger[_0x91f5('0x2c')](_0x91f5('0x17c'),_0x1c846c,_0x1eea79,_0x3552a5[_0x91f5('0x17d')],_0x3552a5[_0x91f5('0x66')]);return this[_0x91f5('0x36')]['recordFile'](_0x1c846c,_0x1eea79,_0x3552a5[_0x91f5('0x17d')],_0x3552a5[_0x91f5('0x66')],undefined,!![]);};AGIVertices[_0x91f5('0xe')][_0x91f5('0x17e')]=function(_0x4cf623){logger[_0x91f5('0x2c')](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x4cf623[_0x91f5('0x38')]));if(!this['isConfigured'](_0x4cf623[_0x91f5('0x64')])){return this['channel'][_0x91f5('0xa8')]('no\x20url\x20configured');}var _0x1312a3=this['restAPI'][_0x91f5('0x70')](this,_0x4cf623);logger[_0x91f5('0x2c')](util[_0x91f5('0x27')]('Response:',util[_0x91f5('0x17f')](_0x1312a3,{'showHidden':![],'depth':null})));if(!this[_0x91f5('0xa3')](_0x4cf623[_0x91f5('0x116')])){return this[_0x91f5('0x36')][_0x91f5('0xa8')](_0x91f5('0x180'));}var _0x1b759f=this[_0x91f5('0xf')][_0x91f5('0x70')](this,_0x4cf623[_0x91f5('0x116')]);if(!_0x1b759f){return this[_0x91f5('0x36')]['error'](_0x4cf623,_0x91f5('0xde'));}this['channel'][_0x91f5('0x9c')](util['format'](_0x91f5('0x181'),_0x1b759f),_0x1312a3[_0x91f5('0x75')]?_0x1312a3[_0x91f5('0x75')]:_0x91f5('0x182'));this[_0x91f5('0x36')][_0x91f5('0x9c')](util['format'](_0x91f5('0x183'),_0x1b759f),_0x1312a3[_0x91f5('0x76')]?_0x1312a3[_0x91f5('0x76')]:'OK');if(_0x1312a3[_0x91f5('0x69')]){try{this[_0x91f5('0x9a')](_0x1312a3['body'],_0x1b759f);}catch(_0x5c3e0e){logger[_0x91f5('0x31')](util[_0x91f5('0x27')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x1b759f));}}return this[_0x91f5('0x36')]['noop'](util[_0x91f5('0x27')](_0x91f5('0x184'),_0x1b759f));};AGIVertices['prototype'][_0x91f5('0x185')]=function(_0x187e57){logger['info'](util[_0x91f5('0x27')](_0x91f5('0x186'),_0x187e57[_0x91f5('0x38')]));return this[_0x91f5('0x36')]['sayDigits'](_0x187e57['digits']['replace'](/\s+/g,''),_0x187e57[_0x91f5('0x17d')]);};AGIVertices[_0x91f5('0xe')][_0x91f5('0x187')]=function(_0x4e8b70){logger[_0x91f5('0x2c')](util['format']('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x4e8b70['label']));return this[_0x91f5('0x36')]['sayNumber'](_0x4e8b70[_0x91f5('0x188')]['replace'](/\s+/g,''),_0x4e8b70[_0x91f5('0x17d')]);};AGIVertices[_0x91f5('0xe')][_0x91f5('0x189')]=function(_0x48914f){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x48914f[_0x91f5('0x38')]));return this[_0x91f5('0x36')][_0x91f5('0x18a')](_0x48914f[_0x91f5('0x5b')],_0x48914f['escape_digits']);};AGIVertices[_0x91f5('0xe')]['sendMail']=function(_0x3dc942){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x18b'),_0x3dc942[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x3dc942[_0x91f5('0x18c')])){return this[_0x91f5('0x36')]['noop']('no\x20mail\x20account\x20configured');}var _0x527ecb=this[_0x91f5('0x20')][_0x91f5('0x70')](this,_0x3dc942['account_id']);if(!_0x527ecb||!_0x527ecb[_0x91f5('0x18d')]){return this['channel'][_0x91f5('0x31')](_0x3dc942,_0x91f5('0x18e'));}var _0x26f23c={'from':util[_0x91f5('0x27')](_0x91f5('0x18f'),_0x527ecb[_0x91f5('0x12')],_0x527ecb[_0x91f5('0x190')]||_0x527ecb[_0x91f5('0x18d')][_0x91f5('0x191')]),'to':_0x3dc942['to']||'','cc':_0x3dc942['cc']||'','bcc':_0x3dc942[_0x91f5('0x192')]||'','subject':_0x3dc942[_0x91f5('0x193')],'html':_0x3dc942[_0x91f5('0x5b')],'text':_0x3dc942[_0x91f5('0x5b')]};var _0x1c2603={'tls':{'rejectUnauthorized':![]}};if(_0x527ecb['Smtp'][_0x91f5('0x194')]){_0x1c2603[_0x91f5('0x194')]=_0x527ecb[_0x91f5('0x18d')][_0x91f5('0x194')];}else{_0x1c2603[_0x91f5('0x195')]=_0x527ecb[_0x91f5('0x18d')][_0x91f5('0x195')];_0x1c2603[_0x91f5('0x196')]=_0x527ecb[_0x91f5('0x18d')][_0x91f5('0x196')];_0x1c2603[_0x91f5('0x197')]=_0x527ecb['Smtp']['secure'];}if(_0x527ecb[_0x91f5('0x18d')][_0x91f5('0x198')]){_0x1c2603[_0x91f5('0x199')]={'user':_0x527ecb['Smtp'][_0x91f5('0x191')],'pass':_0x527ecb['Smtp'][_0x91f5('0x19a')]};}if(this[_0x91f5('0xa3')](_0x3dc942[_0x91f5('0x19b')])){}logger[_0x91f5('0x19c')](_0x91f5('0x19d'),JSON[_0x91f5('0x73')](_0x26f23c));this['createSquareDetailsReport'][_0x91f5('0x70')](this,_0x3dc942,_0x3dc942['account_id']);this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x19e'),_0x527ecb[_0x91f5('0x12')]));this[_0x91f5('0x22')][_0x91f5('0x70')](this,_0x1c2603,_0x26f23c);return this[_0x91f5('0x36')][_0x91f5('0xa8')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x91f5('0xe')][_0x91f5('0x19f')]=function(_0x41ecf0){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x1a0'),_0x41ecf0[_0x91f5('0x38')]));return this[_0x91f5('0x36')][_0x91f5('0xa8')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x91f5('0xe')]['sendSMS']=function(_0x49e27f){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x1a1'),_0x49e27f['label']));if(!this[_0x91f5('0xa3')](_0x49e27f[_0x91f5('0x1a2')])){return this['channel'][_0x91f5('0xa8')](_0x91f5('0x1a3'));}var _0x5ed31f=this[_0x91f5('0x33')][_0x91f5('0x70')](this,_0x49e27f[_0x91f5('0x1a2')]);if(!_0x5ed31f){return this['channel'][_0x91f5('0x31')](_0x49e27f,_0x91f5('0x1a4'));}var _0x124691={'body':_0x49e27f[_0x91f5('0x1a5')],'phone':_0x49e27f['to']||'','SmsAccountId':_0x5ed31f['id']};logger[_0x91f5('0x19c')]('sendSMS\x20message',JSON[_0x91f5('0x73')](_0x124691));this['createSquareDetailsReport'][_0x91f5('0x70')](this,_0x49e27f,_0x49e27f[_0x91f5('0x1a2')]);this[_0x91f5('0x36')]['noop'](util['format']('Trying\x20SendSMS\x20with\x20account\x20%s',_0x5ed31f['name']));this[_0x91f5('0x34')][_0x91f5('0x70')](this,_0x124691);return this[_0x91f5('0x36')][_0x91f5('0xa8')](_0x91f5('0x1a6'));};AGIVertices['prototype'][_0x91f5('0x1a7')]=function(_0x233af0){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x233af0[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x233af0[_0x91f5('0x116')])){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x233af0,_0x91f5('0x1a8'));}var _0x3d29f0=this['getVariable']['sync'](this,_0x233af0[_0x91f5('0x116')]);if(!_0x3d29f0){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x233af0,_0x91f5('0xde'));}return this[_0x91f5('0x36')][_0x91f5('0x9c')](_0x3d29f0,_0x233af0['variable_value']);};AGIVertices[_0x91f5('0xe')][_0x91f5('0x1a9')]=function(_0x53e7ff){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x1aa'),_0x53e7ff[_0x91f5('0x38')]));this[_0x91f5('0x36')]['noop']('START\x20CALLY\x20SQUARE');if(_0x53e7ff[_0x91f5('0xbb')]===_0x91f5('0x1ab')){this['channel']['noop'](_0x91f5('0x1ac'));return this[_0x91f5('0x36')][_0x91f5('0xbb')]();}return this['channel']['noop'](_0x91f5('0x1ad'));};AGIVertices[_0x91f5('0xe')][_0x91f5('0x1ae')]=function(_0x212499){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x212499[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x212499[_0x91f5('0x1af')])){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x212499,_0x91f5('0x1b0'));}var _0x438169=this[_0x91f5('0x16')][_0x91f5('0x70')](this,_0x212499[_0x91f5('0x1af')]);if(!this['isConfigured'](_0x438169)){return this['channel'][_0x91f5('0x31')](_0x212499,util[_0x91f5('0x27')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x212499[_0x91f5('0x1af')]));}if(_0x438169===this[_0x91f5('0x36')][_0x91f5('0x3a')]){return this['channel'][_0x91f5('0x31')](_0x212499,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport']['sync'](this,_0x212499,_0x438169);var _0x11238b=this[_0x91f5('0x36')][_0x91f5('0x57')](_0x91f5('0x1b1'),util[_0x91f5('0x27')](_0x91f5('0x1b2'),config[_0x91f5('0x5')][_0x91f5('0x195')]||_0x91f5('0x1b3'),_0x438169,this['channel'][_0x91f5('0x3a')]));if(_0x11238b[_0x91f5('0xab')]===-0x1){return _0x11238b;}return this['channel'][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0xc8'),_0x91f5('0x1b1'),_0x438169));};AGIVertices[_0x91f5('0xe')][_0x91f5('0x1b4')]=function(_0x21a757){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x1b5'),_0x21a757[_0x91f5('0x38')]));var _0x4c5ef6=this['shellCommand'][_0x91f5('0x70')](this,_0x21a757['command']);this[_0x91f5('0x35')][_0x91f5('0x70')](this,_0x21a757,_0x21a757[_0x91f5('0xb9')]);if(this['isConfigured'](_0x21a757[_0x91f5('0x116')])){var _0xd3ebd=this['getVariable'][_0x91f5('0x70')](this,_0x21a757[_0x91f5('0x116')]);if(_0xd3ebd){this[_0x91f5('0x36')]['setVariable'](_0xd3ebd,_0x4c5ef6);return this['channel'][_0x91f5('0xa8')](util[_0x91f5('0x27')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x21a757[_0x91f5('0xb9')],_0xd3ebd));}}return this[_0x91f5('0x36')]['noop'](util[_0x91f5('0x27')](_0x91f5('0x1b6'),_0x21a757[_0x91f5('0xb9')]));};AGIVertices[_0x91f5('0xe')][_0x91f5('0x1b7')]=function(_0x50db69){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x1b8'),_0x50db69[_0x91f5('0x38')]));_0x50db69[_0x91f5('0x5b')]=_0x50db69[_0x91f5('0x5b')][_0x91f5('0xdc')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x91f5('0xa3')](_0x50db69[_0x91f5('0x1b9')])){return this['channel'][_0x91f5('0xa8')](_0x91f5('0x1ba'));}if(!this[_0x91f5('0xa3')](_0x50db69[_0x91f5('0x5b')])){return this[_0x91f5('0x36')]['noop'](_0x91f5('0xa9'));}this['channel'][_0x91f5('0xa8')](util['format']('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x50db69[_0x91f5('0x5b')]));var _0xadfad3=this[_0x91f5('0x59')][_0x91f5('0x70')](this,_0x50db69);if(_0xadfad3){this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x1bb'),_0xadfad3));var _0xc9e5d2=this['channel'][_0x91f5('0x105')](_0xadfad3);try{fs['unlink'](_0xadfad3+_0x91f5('0x107'));}catch(_0x2a41b6){logger[_0x91f5('0x31')](_0x2a41b6);}return _0xc9e5d2;}return this['channel'][_0x91f5('0x31')](_0x50db69,_0x91f5('0x1bc'));};AGIVertices[_0x91f5('0xe')]['tts']=function(_0x1a832a){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x1bd'),_0x1a832a[_0x91f5('0x38')]));_0x1a832a[_0x91f5('0x5b')]=_0x1a832a['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x91f5('0xa3')](_0x1a832a[_0x91f5('0x5b')])){return this[_0x91f5('0x36')][_0x91f5('0xa8')](_0x91f5('0xa9'));}this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x1be'),_0x1a832a[_0x91f5('0x5b')]));var _0x1477a5=this[_0x91f5('0x61')][_0x91f5('0x70')](this,_0x1a832a);if(_0x1477a5){this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x1bf'),_0x1477a5));var _0x1f2ea7=this[_0x91f5('0x36')][_0x91f5('0x105')](_0x1477a5);try{fs['unlink'](_0x1477a5+_0x91f5('0x107'));}catch(_0x4e70b8){logger[_0x91f5('0x31')](_0x4e70b8);}return _0x1f2ea7;}return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x1a832a,_0x91f5('0x1c0'));};AGIVertices[_0x91f5('0xe')]['unpause']=function(_0xbf873a){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x1c1'),_0xbf873a[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0xbf873a['findBy'])){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0xbf873a,_0x91f5('0x157'));}logger[_0x91f5('0x2c')](util['format'](_0x91f5('0x158'),this[_0x91f5('0x36')][_0x91f5('0x3b')],_0xbf873a[_0x91f5('0x156')]));var _0x209707=this[_0x91f5('0x50')][_0x91f5('0x70')](this,_0xbf873a['findBy']);if(_0x209707){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x91f5('0x36')][_0x91f5('0x3b')],_0xbf873a['findBy']));this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x15e'),this[_0x91f5('0x36')][_0x91f5('0x3b')],_0xbf873a[_0x91f5('0x156')]));return{'code':0xc8,'result':'success'};}else{logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x15a'),this['channel'][_0x91f5('0x3b')],_0xbf873a['findBy']));this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x15a'),this[_0x91f5('0x36')][_0x91f5('0x3b')],_0xbf873a[_0x91f5('0x156')]));return{'code':0xc8,'result':_0x91f5('0x15b')};}};AGIVertices[_0x91f5('0xe')][_0x91f5('0x1c2')]=function(_0xf6d119){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x1c3'),_0xf6d119['label']));var _0x2e4bcd=this[_0x91f5('0x36')][_0x91f5('0x57')](_0x91f5('0x1c4'),[_0xf6d119[_0x91f5('0x1c5')],_0xf6d119[_0x91f5('0x78')]]);if(_0x2e4bcd[_0x91f5('0xab')]===-0x1){return _0x2e4bcd;}return this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0xc8'),_0x91f5('0x1c4'),_0xf6d119[_0x91f5('0x1c5')]));};AGIVertices[_0x91f5('0xe')][_0x91f5('0x1c6')]=function(_0x58a950){logger[_0x91f5('0x2c')](util['format'](_0x91f5('0x1c7'),_0x58a950[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x58a950[_0x91f5('0x116')])){return this['channel'][_0x91f5('0x31')](_0x58a950,_0x91f5('0x1a8'));}var _0xa55d49=this[_0x91f5('0xf')][_0x91f5('0x70')](this,_0x58a950['variable_id']);if(!_0xa55d49){return this['channel']['error'](_0x58a950,_0x91f5('0xde'));}var _0x1bf651=this[_0x91f5('0x36')]['getVariable'](_0xa55d49);return{'code':0xc8,'result':_0x1bf651['extra']?_0x1bf651[_0x91f5('0xa0')]:'-'};};String[_0x91f5('0xe')][_0x91f5('0x9f')]=function(_0x2fc5dc,_0x5d8f5f){return this[_0x91f5('0x9e')](_0x2fc5dc)['join'](_0x5d8f5f);};module[_0x91f5('0x1c8')]=AGIVertices; \ No newline at end of file +var _0xf88a=['project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','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','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','replaceAll','join','path','shelljs','odbc','moment','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getsecretdigits','rpc','mailRpc','prototype','getVariable','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunkById','getSound','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','isNil','phone','scheduledAt','callback','toString','getPauseById','agentPause','agentUnpause','agent','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','replace','googleCloudTTS','google_cloud_tts_text_type','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','text','google_tts_language','restAPI','method','number','timeout','includes','POST','PUT','toUpperCase','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','computedVariables','sync','render','url','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','google_asr_language','tildeASR','appsecret','uri','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','saveRestApiResult','%s.%s','length','setVariable','split','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','retry','maxRetry','mrcpsynth','noop','no\x20text\x20configured','result','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','database','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','speech','out','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','googleDialogflowV2','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','audiofile','streamFile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Executed\x20command\x20%s','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','getData','response','maxdigit','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws_bot_name','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','googleasr','wav','%s/recordings/%s','beep','NOBEEP','intKey','googleASR','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','recordFile','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','interval_id','getIntervals','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20found','PLAYBACK','opts','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Response:','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','subject','service','host','secure','authentication','auth','pass','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','arg_1'];(function(_0x3aff7c,_0xa699e7){var _0x461cc3=function(_0x1494ba){while(--_0x1494ba){_0x3aff7c['push'](_0x3aff7c['shift']());}};_0x461cc3(++_0xa699e7);}(_0xf88a,0x1e8));var _0xaf88=function(_0x4e0d05,_0x1252ef){_0x4e0d05=_0x4e0d05-0x0;var _0x568b50=_0xf88a[_0x4e0d05];return _0x568b50;};'use strict';var fs=require('fs');var path=require(_0xaf88('0x0'));var util=require('util');var _=require('lodash');var sh=require(_0xaf88('0x1'));var odbc=require(_0xaf88('0x2'))();var rs=require('randomstring');var moment=require(_0xaf88('0x3'));var Mustache=require('mustache');var rp=require(_0xaf88('0x4'));var logger=require(_0xaf88('0x5'))(_0xaf88('0x6'));var config=require(_0xaf88('0x7'));var scripts=require(_0xaf88('0x8'));var FILES_PATH=_0xaf88('0x9');var recursiveMapAttributes=[_0xaf88('0xa'),_0xaf88('0xb')];var verticesWithRetry=[_0xaf88('0xc'),'getdigits',_0xaf88('0xd')];var AGIVertices=function(_0x18b6fd,_0x21d251,_0x39953d){this['channel']=_0x18b6fd;this[_0xaf88('0xe')]=_0x21d251;this[_0xaf88('0xf')]=_0x39953d;};AGIVertices[_0xaf88('0x10')][_0xaf88('0x11')]=function(_0x52ee11,_0x3b392c){this[_0xaf88('0xe')]['getVariableById'](_0x52ee11)[_0xaf88('0x12')](function(_0x3050c7){_0x3b392c(null,_0x3050c7?_0x3050c7[_0xaf88('0x13')]:![]);})[_0xaf88('0x14')](function(_0x5793f9){_0x3b392c(_0x5793f9);});};AGIVertices[_0xaf88('0x10')][_0xaf88('0x15')]=function(_0x537ddb,_0x400bc0){this[_0xaf88('0xe')][_0xaf88('0x16')](_0x537ddb)['then'](function(_0x2ad54c){_0x400bc0(null,_0x2ad54c?_0x2ad54c[_0xaf88('0x13')]:![]);})[_0xaf88('0x14')](function(_0x53ea6e){_0x400bc0(_0x53ea6e);});};AGIVertices[_0xaf88('0x10')][_0xaf88('0x17')]=function(_0xdc6a2f,_0x4e456b){this[_0xaf88('0xe')][_0xaf88('0x18')](_0xdc6a2f)[_0xaf88('0x12')](function(_0x46da21){_0x4e456b(null,_0x46da21?_0x46da21[_0xaf88('0x13')]:![]);})[_0xaf88('0x14')](function(_0x21ab5b){_0x4e456b(_0x21ab5b);});};AGIVertices[_0xaf88('0x10')][_0xaf88('0x19')]=function(_0x1424f5,_0x4b690a){this[_0xaf88('0xe')][_0xaf88('0x1a')](_0x1424f5)['then'](function(_0x1521ea){_0x4b690a(null,_0x1521ea?_0x1521ea[_0xaf88('0x1b')]:![]);})[_0xaf88('0x14')](function(_0x18402c){_0x4b690a(_0x18402c);});};AGIVertices[_0xaf88('0x10')][_0xaf88('0x1c')]=function(_0xcfd198,_0x4da524){this[_0xaf88('0xe')]['getUserById'](_0xcfd198)[_0xaf88('0x12')](function(_0x502a42){_0x4da524(null,_0x502a42?_0x502a42[_0xaf88('0x13')]:![]);})[_0xaf88('0x14')](function(_0xb67ef5){_0x4da524(_0xb67ef5);});};AGIVertices[_0xaf88('0x10')]['getTrunk']=function(_0x44d695,_0x2ca0b0){this['rpc'][_0xaf88('0x1d')](_0x44d695)[_0xaf88('0x12')](function(_0x191a9e){_0x2ca0b0(null,_0x191a9e?_0x191a9e[_0xaf88('0x13')]:![]);})[_0xaf88('0x14')](function(_0x5064df){_0x2ca0b0(_0x5064df);});};AGIVertices['prototype'][_0xaf88('0x1e')]=function(_0x5e4a66,_0x14427a){var _0x12a3fb=this;this[_0xaf88('0xe')]['getSoundById'](_0x5e4a66)['then'](function(_0x440257){_0x14427a(null,_0x440257?_0x12a3fb[_0xaf88('0x1f')](_0x440257[_0xaf88('0x20')]):![]);})[_0xaf88('0x14')](function(_0x147573){_0x14427a(_0x147573);});};AGIVertices[_0xaf88('0x10')][_0xaf88('0x21')]=function(_0x573c23,_0x1148b1){this['rpc']['getMailAccountById'](_0x573c23)[_0xaf88('0x12')](function(_0x126437){_0x1148b1(null,_0x126437?_0x126437:![]);})[_0xaf88('0x14')](function(_0x5b564b){_0x1148b1(_0x5b564b);});};AGIVertices[_0xaf88('0x10')][_0xaf88('0x22')]=function(_0xa3c70b,_0x454e98,_0x9ad5bb){this[_0xaf88('0xf')][_0xaf88('0x22')](_0xa3c70b,_0x454e98)[_0xaf88('0x12')](function(){_0x9ad5bb(null);})['catch'](function(_0x3fc439){_0x9ad5bb(_0x3fc439);});};AGIVertices['prototype']['getIntervals']=function(_0x180e8e,_0x345db0){this[_0xaf88('0xe')][_0xaf88('0x23')](_0x180e8e)[_0xaf88('0x12')](function(_0x32d17e){if(_0x32d17e){if(_0x32d17e[_0xaf88('0x24')]){_0x345db0(null,[_0x32d17e[_0xaf88('0x25')]]);}else{_0x345db0(null,_[_0xaf88('0x26')](_0x32d17e[_0xaf88('0x27')],'interval'));}}else{_0x345db0(null,![]);}})['catch'](function(_0x5e7d49){_0x345db0(_0x5e7d49);});};AGIVertices[_0xaf88('0x10')][_0xaf88('0x1f')]=function(_0xb6069b){return util[_0xaf88('0x28')](_0xaf88('0x29'),FILES_PATH,_0xb6069b);};AGIVertices['prototype'][_0xaf88('0x2a')]=function(_0x39c3ce,_0x108296,_0x4b3529){odbc[_0xaf88('0x2b')](_0x39c3ce,function(_0x58c410){if(_0x58c410){logger[_0xaf88('0x2c')](_0xaf88('0x2d'),_0x58c410);_0x4b3529(_0x58c410);}else{logger[_0xaf88('0x2e')](_0xaf88('0x2f'));odbc['query'](_0x108296,function(_0x573197,_0x421f98){if(_0x573197){logger[_0xaf88('0x2e')](_0xaf88('0x30'),_0x108296);_0x4b3529(_0x573197);}else{logger[_0xaf88('0x2e')](_0xaf88('0x31'),_0x108296);odbc['close'](function(_0x523602){if(_0x523602){logger['error'](_0xaf88('0x32'),_0x523602);}_0x4b3529(null,_0x421f98);});}});}});};AGIVertices[_0xaf88('0x10')][_0xaf88('0x33')]=function(_0x11f832,_0x4b3fd7){this[_0xaf88('0xe')]['getSmsAccountById'](_0x11f832)[_0xaf88('0x12')](function(_0x4c63fd){_0x4b3fd7(null,_0x4c63fd?_0x4c63fd:![]);})[_0xaf88('0x14')](function(_0x31fd71){_0x4b3fd7(_0x31fd71);});};AGIVertices[_0xaf88('0x10')][_0xaf88('0x34')]=function(_0x13db88,_0x3c1023){this[_0xaf88('0xe')][_0xaf88('0x34')](_0x13db88)[_0xaf88('0x12')](function(_0x46ed97){_0x3c1023(null,_0x46ed97);})['catch'](function(_0xa3732d){_0x3c1023(_0xa3732d);});};AGIVertices[_0xaf88('0x10')][_0xaf88('0x35')]=function(_0xb8d30e,_0x2189fb,_0x53b943){this[_0xaf88('0xe')][_0xaf88('0x35')]({'uniqueid':this[_0xaf88('0x36')][_0xaf88('0x37')],'node':_0xb8d30e[_0xaf88('0x38')],'application':_0xb8d30e[_0xaf88('0x39')],'data':_0x2189fb||null,'project_name':this[_0xaf88('0x36')]['arg_1'],'callerid':this[_0xaf88('0x36')][_0xaf88('0x3a')]})[_0xaf88('0x12')](function(_0xad2b79){if(_0x53b943){_0x53b943(null,_0xad2b79);}})[_0xaf88('0x14')](function(_0x8d2013){if(_0x53b943){_0x53b943(_0x8d2013);}});};AGIVertices[_0xaf88('0x10')][_0xaf88('0x3b')]=function(_0x395e92,_0x1d511f,_0x3a7c8b,_0x461795){this[_0xaf88('0xe')]['createSquareRecording']({'uniqueid':this[_0xaf88('0x36')][_0xaf88('0x37')],'callerid':this[_0xaf88('0x36')][_0xaf88('0x3a')],'calleridname':this[_0xaf88('0x36')][_0xaf88('0x3c')],'context':this[_0xaf88('0x36')][_0xaf88('0x3d')],'extension':this['channel'][_0xaf88('0x3e')],'priority':this[_0xaf88('0x36')][_0xaf88('0x3f')],'accountcode':this[_0xaf88('0x36')][_0xaf88('0x40')],'dnid':this[_0xaf88('0x36')][_0xaf88('0x41')],'projectName':this[_0xaf88('0x36')]['arg_1'],'saveName':_0x1d511f,'filename':_0x395e92[_0xaf88('0x42')]||_0x1d511f,'savePath':_0x3a7c8b})['then'](function(_0xa475e7){_0x461795(null,_0xa475e7);})[_0xaf88('0x14')](function(_0x51662e){_0x461795(_0x51662e);});};AGIVertices[_0xaf88('0x10')]['createSquareMessage']=function(_0x2e2220,_0x502a79,_0x3418c6,_0x2cb199,_0x1446f2){this[_0xaf88('0xe')][_0xaf88('0x43')]({'uniqueid':this[_0xaf88('0x36')][_0xaf88('0x37')],'body':_0x2e2220,'direction':_0x502a79,'providerName':_0x3418c6,'providerResponse':_0x2cb199})['then'](function(_0x29ad8b){if(_0x1446f2){_0x1446f2(null,_0x29ad8b);}})[_0xaf88('0x14')](function(_0x115258){if(_0x1446f2){_0x1446f2(_0x115258);}});};AGIVertices[_0xaf88('0x10')][_0xaf88('0x44')]=function(_0x470f2a,_0x491240){this['rpc']['createCmContact']({'firstName':_[_0xaf88('0x45')](_0x470f2a['name'])||_['isNil'](_0x470f2a[_0xaf88('0x13')])?_0xaf88('0x46')+Math[_0xaf88('0x47')]():_0x470f2a['name'],'lastName':_[_0xaf88('0x45')](_0x470f2a[_0xaf88('0x48')])||_[_0xaf88('0x49')](_0x470f2a[_0xaf88('0x48')])?null:_0x470f2a[_0xaf88('0x48')],'phone':_0x470f2a[_0xaf88('0x4a')],'ListId':_0x470f2a['list_id'],'scheduledat':_0x470f2a[_0xaf88('0x4b')],'callbackUniqueid':this[_0xaf88('0x36')]['uniqueid'],'tags':_0xaf88('0x4c'),'description':'Callback\x20scheduled\x20at\x20'+_0x470f2a[_0xaf88('0x4b')][_0xaf88('0x4d')](),'priority':_0x470f2a['callback_priority']})[_0xaf88('0x12')](function(_0x46257c){_0x491240(null,_0x46257c);})[_0xaf88('0x14')](function(_0x44d93b){_0x491240(_0x44d93b);});};AGIVertices['prototype']['getPause']=function(_0x3d9d69,_0x325947){this[_0xaf88('0xe')][_0xaf88('0x4e')](_0x3d9d69)['then'](function(_0x45e4d8){_0x325947(null,_0x45e4d8?_0x45e4d8[_0xaf88('0x13')]:![]);})[_0xaf88('0x14')](function(_0x1c97c4){_0x325947(_0x1c97c4);});};AGIVertices[_0xaf88('0x10')][_0xaf88('0x4f')]=function(_0x144515,_0x1b1026,_0x79f7a7){var _0x2994ee={'role':'agent'};_0x2994ee[_0x144515]=this[_0xaf88('0x36')][_0xaf88('0x3a')];this['rpc']['agentPause'](_0x2994ee,_0x1b1026,this[_0xaf88('0x36')][_0xaf88('0x37')])[_0xaf88('0x12')](function(_0x471e9e){_0x79f7a7(null,_[_0xaf88('0x49')](_0x471e9e)?![]:!![]);})['catch'](function(_0xa05b1){logger['error'](_0xa05b1);_0x79f7a7(null,![]);});};AGIVertices[_0xaf88('0x10')][_0xaf88('0x50')]=function(_0x459709,_0x364552){var _0x4a59ac={'role':_0xaf88('0x51')};_0x4a59ac[_0x459709]=this[_0xaf88('0x36')][_0xaf88('0x3a')];this['rpc'][_0xaf88('0x50')](_0x4a59ac)[_0xaf88('0x12')](function(_0x33d6b0){_0x364552(null,_[_0xaf88('0x49')](_0x33d6b0)?![]:!![]);})[_0xaf88('0x14')](function(_0x123704){logger['error'](_0x123704);_0x364552(null,![]);});};AGIVertices[_0xaf88('0x10')][_0xaf88('0x52')]=function(_0x19de34,_0x2293a8){var _0x3ec536={'role':_0xaf88('0x51')};_0x3ec536[_0x19de34]=this[_0xaf88('0x36')][_0xaf88('0x3a')];this[_0xaf88('0xe')][_0xaf88('0x52')](_0x3ec536)[_0xaf88('0x12')](function(_0x2b68ea){_0x2293a8(null,_[_0xaf88('0x49')](_0x2b68ea)?![]:!![]);})[_0xaf88('0x14')](function(_0x2d6c47){logger['error'](_0x2d6c47);_0x2293a8(null,![]);});};AGIVertices[_0xaf88('0x10')][_0xaf88('0x53')]=function(_0x158f4e,_0x402664){var _0x2e2d76={'role':_0xaf88('0x51')};_0x2e2d76[_0x158f4e]=this['channel']['callerid'];var _0x468324=_0x158f4e!=_0xaf88('0x54')?util['format'](_0xaf88('0x55'),_0xaf88('0x56'),this[_0xaf88('0x36')][_0xaf88('0x3a')]):undefined;this[_0xaf88('0xe')][_0xaf88('0x53')](_0x2e2d76,_0x468324)[_0xaf88('0x12')](function(_0x58ea32){_0x402664(null,_[_0xaf88('0x49')](_0x58ea32)?![]:!![]);})[_0xaf88('0x14')](function(_0x42d930){logger[_0xaf88('0x2c')](_0x42d930);_0x402664(null,![]);});};AGIVertices[_0xaf88('0x10')][_0xaf88('0x57')]=function(_0x4b160d,_0x4eedf6){sh[_0xaf88('0x58')](_['trim'](_0x4b160d),function(_0x463157,_0x117379){var _0x138860=_0x117379[_0xaf88('0x59')](/(\r\n|\n|\r)/gm,'');_0x4eedf6(null,_0x138860);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x4d7d75,_0x5388c9){scripts[_0xaf88('0x5a')](_0x4d7d75['apiKey'],_0x4d7d75[_0xaf88('0x5b')]||'text',_0x4d7d75['text'],_0x4d7d75[_0xaf88('0x5c')]||_0xaf88('0x5d'),_0x4d7d75[_0xaf88('0x5e')]||_0xaf88('0x5f'),_0x4d7d75[_0xaf88('0x60')]||_0xaf88('0x61'))[_0xaf88('0x12')](function(_0x145adb){_0x5388c9(null,_0x145adb);})[_0xaf88('0x14')](function(_0xe80542){_0x5388c9(_0xe80542);});};AGIVertices[_0xaf88('0x10')][_0xaf88('0x62')]=function(_0x49718d,_0x29b573){scripts[_0xaf88('0x62')](_0x49718d[_0xaf88('0x63')],_0x49718d[_0xaf88('0x64')]||'en',0x1)['then'](function(_0x442f81){_0x29b573(null,_0x442f81);})[_0xaf88('0x14')](function(_0x3a1795){_0x29b573(_0x3a1795);});};AGIVertices[_0xaf88('0x10')][_0xaf88('0x65')]=function(_0x5b5e16,_0x568c10){var _0x133ae8={'uri':_0x5b5e16['url'],'method':_0x5b5e16[_0xaf88('0x66')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x5b5e16['timeout'])===_0xaf88('0x67')&&parseInt(_0x5b5e16['timeout'])>=0x1?parseInt(_0x5b5e16[_0xaf88('0x68')])*0x3e8:0x5*0x3e8};if(_[_0xaf88('0x69')]([_0xaf88('0x6a'),_0xaf88('0x6b')],_0x133ae8[_0xaf88('0x66')][_0xaf88('0x6c')]())){try{_0x133ae8['body']=_0x5b5e16[_0xaf88('0xb')]?JSON['parse'](_0x5b5e16[_0xaf88('0xb')]):{};}catch(_0x741c7c){logger['error'](_0xaf88('0x6d'),_0x741c7c);}}try{_0x133ae8[_0xaf88('0x6e')]=_0x5b5e16['rawHeaders']?JSON[_0xaf88('0x6f')](_0x5b5e16[_0xaf88('0xa')]):{};}catch(_0x12f38d){logger[_0xaf88('0x2c')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x12f38d);}if(_0x5b5e16['computedVariables']){try{var _0x17ba5b=require(_0x5b5e16[_0xaf88('0x70')])[_0xaf88('0x71')](this,_0x133ae8);_0x133ae8['uri']=Mustache[_0xaf88('0x72')](_0x5b5e16[_0xaf88('0x73')],_0x17ba5b,{},['$$','$$']);if(_0x133ae8[_0xaf88('0x6e')]){_0x133ae8[_0xaf88('0x6e')]=JSON['parse'](Mustache[_0xaf88('0x72')](JSON[_0xaf88('0x74')](_0x133ae8[_0xaf88('0x6e')]),_0x17ba5b,{},['$$','$$']));}if(_0x133ae8[_0xaf88('0x75')]){_0x133ae8[_0xaf88('0x75')]=JSON[_0xaf88('0x6f')](Mustache['render'](JSON[_0xaf88('0x74')](_0x133ae8[_0xaf88('0x75')]),_0x17ba5b,{},['$$','$$']));}}catch(_0x5778d3){logger['error'](_0xaf88('0x76'),_0x5778d3);}}rp(_0x133ae8)[_0xaf88('0x12')](function(_0x36e7df){var _0xf4fc08={'statusCode':_0x36e7df[_0xaf88('0x77')]||0xc8,'statusMessage':_0x36e7df[_0xaf88('0x78')]||'OK','headers':_0x36e7df[_0xaf88('0x6e')]||{},'body':_0x36e7df[_0xaf88('0x75')]||{}};_0x568c10(null,_0xf4fc08);})[_0xaf88('0x14')](function(_0x17124e){var _0x276d08={'statusCode':_0x17124e[_0xaf88('0x77')]||0x1f4,'statusMessage':_0x17124e[_0xaf88('0x79')]||_0xaf88('0x7a'),'headers':_0x17124e[_0xaf88('0x7b')][_0xaf88('0x6e')]||{},'body':_0x17124e[_0xaf88('0x7b')]['body']||{}};_0x568c10(null,_0x276d08);});};AGIVertices['prototype']['googleDialogflow']=function(_0x40d710,_0x32c772){scripts[_0xaf88('0x7c')](this['channel'][_0xaf88('0x37')],_0x40d710[_0xaf88('0x7d')],_0x40d710[_0xaf88('0x63')],_0x40d710[_0xaf88('0x7e')]||'en')['then'](function(_0x5672d7){_0x32c772(null,_0x5672d7);})['catch'](function(_0x4395cc){_0x32c772(_0x4395cc);});};AGIVertices[_0xaf88('0x10')]['googleDialogflowV2']=function(_0x4d7a59,_0x19dabb){scripts['googleDialogflowV2'](this[_0xaf88('0x36')][_0xaf88('0x37')],_0x4d7a59[_0xaf88('0x7f')],_0x4d7a59[_0xaf88('0x80')],_0x4d7a59[_0xaf88('0x81')],_0x4d7a59['text'],_0x4d7a59[_0xaf88('0x82')]||'en')['then'](function(_0x4d4795){_0x19dabb(null,_0x4d4795);})[_0xaf88('0x14')](function(_0x5a55c8){_0x19dabb(_0x5a55c8);});};AGIVertices[_0xaf88('0x10')][_0xaf88('0x83')]=function(_0x4b012d,_0x3c9e9b){scripts[_0xaf88('0x83')](this[_0xaf88('0x36')],_0x4b012d)[_0xaf88('0x12')](function(_0x5e5730){_0x3c9e9b(null,_0x5e5730);})[_0xaf88('0x14')](function(_0x524178){_0x3c9e9b(_0x524178);});};AGIVertices[_0xaf88('0x10')][_0xaf88('0x84')]=function(_0x2c1c7b,_0x4040da){scripts[_0xaf88('0x84')](_0x2c1c7b[_0xaf88('0x7d')],_0x2c1c7b['text'],_0x2c1c7b[_0xaf88('0x85')]||'en-US',_0x2c1c7b[_0xaf88('0x86')])[_0xaf88('0x12')](function(_0x53b8a8){_0x4040da(null,_0x53b8a8);})[_0xaf88('0x14')](function(_0x478cb9){_0x4040da(_0x478cb9);});};AGIVertices[_0xaf88('0x10')][_0xaf88('0x87')]=function(_0x3c6632,_0x3bfa0b,_0x5de2c8){scripts[_0xaf88('0x87')](_0x3bfa0b,_0x3c6632[_0xaf88('0x7d')],_0x3c6632[_0xaf88('0x88')]||_0xaf88('0x5d'),this[_0xaf88('0x89')](_0x3c6632[_0xaf88('0x8a')])?_0x3c6632['model']:undefined)[_0xaf88('0x12')](function(_0x186e00){_0x5de2c8(null,_0x186e00);})[_0xaf88('0x14')](function(_0xa69de){_0x5de2c8(_0xa69de);});};AGIVertices[_0xaf88('0x10')]['awsPolly']=function(_0x128930,_0x16b8ec){scripts[_0xaf88('0x8b')](_0x128930[_0xaf88('0x8c')],_0x128930['aws_secret_access_key'],_0x128930[_0xaf88('0x8d')],_0x128930['aws_polly_voice']||'Amy',_0x128930['text'],_0x128930[_0xaf88('0x8e')]||_0xaf88('0x63'))[_0xaf88('0x12')](function(_0x179bce){_0x16b8ec(null,_0x179bce);})[_0xaf88('0x14')](function(_0x58afc9){_0x16b8ec(_0x58afc9);});};AGIVertices[_0xaf88('0x10')][_0xaf88('0x8f')]=function(_0x27c6f8,_0x17b389){scripts[_0xaf88('0x8f')](this[_0xaf88('0x36')][_0xaf88('0x37')],_0x27c6f8[_0xaf88('0x8c')],_0x27c6f8[_0xaf88('0x90')],_0x27c6f8[_0xaf88('0x91')],_0x27c6f8['text'],_0x27c6f8['aws_bot_name'])['then'](function(_0x26dbeb){_0x17b389(null,_0x26dbeb);})[_0xaf88('0x14')](function(_0x232201){_0x17b389(_0x232201);});};AGIVertices['prototype']['googleASR']=function(_0x391c31,_0x86ad98,_0x57276e){scripts['googleASR'](_0x86ad98,_0x391c31[_0xaf88('0x7d')],_0x391c31[_0xaf88('0x92')]||'en-US')[_0xaf88('0x12')](function(_0xfdeeb4){_0x57276e(null,_0xfdeeb4);})[_0xaf88('0x14')](function(_0x382503){_0x57276e(_0x382503);});};AGIVertices[_0xaf88('0x10')]['tildeASR']=function(_0x3c2c15,_0x3967b4,_0x205909){scripts[_0xaf88('0x93')](_0x3967b4,_0x3c2c15['appid'],_0x3c2c15[_0xaf88('0x94')],_0x3c2c15[_0xaf88('0x95')])[_0xaf88('0x12')](function(_0x41db3e){_0x205909(null,_0x41db3e);})[_0xaf88('0x14')](function(_0xd6ceff){_0x205909(_0xd6ceff);});};AGIVertices[_0xaf88('0x10')][_0xaf88('0x96')]=function(_0x7e83e8){var _0xaa8173=_[_0xaf88('0x69')](verticesWithRetry,_0x7e83e8[_0xaf88('0x39')])?_0x7e83e8:_[_0xaf88('0x97')](_0x7e83e8);for(var _0x5166e2 in _0xaa8173){if(_0xaa8173[_0xaf88('0x98')](_0x5166e2)){if(_0xaa8173[_0x5166e2]&&_[_0xaf88('0x99')](_0xaa8173[_0x5166e2])){if(_[_0xaf88('0x69')](recursiveMapAttributes,_0x5166e2)){_0xaa8173[_0x5166e2]=this[_0xaf88('0x9a')](_0xaa8173[_0x5166e2]);}else{_0xaa8173[_0x5166e2]=this[_0xaf88('0x9b')](_0xaa8173[_0x5166e2]);}}}}return _0xaa8173;};AGIVertices[_0xaf88('0x10')][_0xaf88('0x9c')]=function(_0x5f4a17){for(var _0x5c2617 in _0x5f4a17){if(_0x5f4a17['hasOwnProperty'](_0x5c2617)){if(_[_0xaf88('0x9d')](_0x5f4a17[_0x5c2617])){this[_0xaf88('0x9c')](_0x5f4a17[_0x5c2617]);}else if(_[_0xaf88('0x9e')](_0x5f4a17[_0x5c2617])){for(var _0x4fac2f=0x0;_0x4fac2f<_0x5f4a17[_0x5c2617]['length'];_0x4fac2f++){this[_0xaf88('0x9c')](_0x5f4a17[_0x5c2617][_0x4fac2f]);}}else if(_[_0xaf88('0x99')](_0x5f4a17[_0x5c2617])){_0x5f4a17[_0x5c2617]=this['replaceAllVariables'](_0x5f4a17[_0x5c2617]);}}}};AGIVertices[_0xaf88('0x10')][_0xaf88('0x9f')]=function(_0x1fa1ae,_0x3ce9ff){for(var _0x19b41f in _0x1fa1ae){if(_0x1fa1ae[_0xaf88('0x98')](_0x19b41f)){if(_['isPlainObject'](_0x1fa1ae[_0x19b41f])){if(!_['isEmpty'](_0x1fa1ae[_0x19b41f])){this[_0xaf88('0x9f')](_0x1fa1ae[_0x19b41f],util[_0xaf88('0x28')](_0xaf88('0xa0'),_0x3ce9ff,_0x19b41f));}}else if(_['isArray'](_0x1fa1ae[_0x19b41f])){for(var _0x45f0ce=0x0;_0x45f0ce<_0x1fa1ae[_0x19b41f][_0xaf88('0xa1')];_0x45f0ce++){this[_0xaf88('0x9f')](_0x1fa1ae[_0x19b41f][_0x45f0ce],util[_0xaf88('0x28')]('%s.%s',_0x3ce9ff,_0x19b41f+'['+_0x45f0ce+']'));}}else{if(!_[_0xaf88('0x49')](_0x1fa1ae[_0x19b41f])){this[_0xaf88('0x36')][_0xaf88('0xa2')](util[_0xaf88('0x28')]('%s.%s',_0x3ce9ff,_0x19b41f),_0x1fa1ae[_0x19b41f]);}}}}};AGIVertices['prototype'][_0xaf88('0x9a')]=function(_0x2a8c83){try{var _0x561de0=JSON[_0xaf88('0x6f')](_0x2a8c83);this[_0xaf88('0x9c')](_0x561de0);return JSON[_0xaf88('0x74')](_0x561de0);}catch(_0x1712ba){return this[_0xaf88('0x9b')](_0x2a8c83);}};AGIVertices[_0xaf88('0x10')]['replaceAllVariables']=function(_0x49f099){var _0x5a8cd2=_0x49f099[_0xaf88('0xa3')]('{');for(var _0x67e66a=0x1;_0x67e66a<_0x5a8cd2[_0xaf88('0xa1')];_0x67e66a+=0x1){var _0x17b9b2=_0x5a8cd2[_0x67e66a][_0xaf88('0xa3')]('}');if(_0x17b9b2['length']>0x1){_0x49f099=_0x49f099['replaceAll']('{'+_0x17b9b2[0x0]+'}',this[_0xaf88('0x36')][_0xaf88('0x11')](_0x17b9b2[0x0])[_0xaf88('0xa4')]||_0x17b9b2[0x0]);}}if(_0x5a8cd2[_0xaf88('0xa1')]===0x1){return _0x49f099['toString']();}return this[_0xaf88('0x9b')](_0x49f099);};AGIVertices[_0xaf88('0x10')][_0xaf88('0xa5')]=function(_0x1a5169,_0x2f5c20){var _0x446996=this['channel']['getVariable'](_0x1a5169);if(_0x446996['result']===-0x1){return _0x446996;}logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0xa6'),_0x2f5c20,_0x446996[_0xaf88('0xa4')]));return this[_0xaf88('0x36')][_0xaf88('0xa2')](_0x2f5c20,_0x446996[_0xaf88('0xa4')]);};AGIVertices['prototype'][_0xaf88('0x89')]=function(_0x501048){return _0x501048&&_0x501048!=='0'&&_0x501048!=='-1'&&_0x501048!=='';};AGIVertices[_0xaf88('0x10')]['maxRetry']=function(_0x5d607e){this[_0xaf88('0x35')][_0xaf88('0x71')](this,_0x5d607e,'-');_0x5d607e[_0xaf88('0xa7')]=_0x5d607e[_0xaf88('0xa8')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xaf88('0x10')][_0xaf88('0xa9')]=function(_0x2b1fcd){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x2b1fcd['label']));if(!this[_0xaf88('0x89')](_0x2b1fcd['text'])){return this['channel'][_0xaf88('0xaa')](_0xaf88('0xab'));}var _0x79052f='\x22'+_0x2b1fcd[_0xaf88('0x63')]+'\x22';if(this['isConfigured'](_0x2b1fcd[_0xaf88('0x7b')])){_0x79052f+=','+_0x2b1fcd['options'];}var _0x562bf9=this['channel'][_0xaf88('0x58')]('MRCPSynth',_0x79052f);if(_0x562bf9[_0xaf88('0xac')]===-0x1){return _0x562bf9;}return this[_0xaf88('0x36')][_0xaf88('0xaa')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x79052f));};AGIVertices[_0xaf88('0x10')][_0xaf88('0xad')]=function(_0x53dae4){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0xae'),_0x53dae4['label']));if(!this['isConfigured'](_0x53dae4['grammar'])){return this['channel'][_0xaf88('0xaa')](_0xaf88('0xaf'));}var _0x3c43bb=_0x53dae4[_0xaf88('0xb0')];if(this[_0xaf88('0x89')](_0x53dae4[_0xaf88('0x7b')])){_0x3c43bb+=','+_0x53dae4['options'];}var _0x5d27d9=this[_0xaf88('0x36')][_0xaf88('0x58')](_0xaf88('0xb1'),_0x3c43bb);if(_0x5d27d9['result']===-0x1){return _0x5d27d9;}var _0x4a6366=this[_0xaf88('0xa5')](_0xaf88('0xb2'),'MRCP_RECOG_CONFIDENCE');if(_0x4a6366[_0xaf88('0xac')]===-0x1){return _0x4a6366;}var _0x43853a=this[_0xaf88('0xa5')](_0xaf88('0xb3'),_0xaf88('0xb4'));if(_0x43853a['result']===-0x1){return _0x43853a;}var _0x5a1fa3=this[_0xaf88('0xa5')]('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0x5a1fa3[_0xaf88('0xac')]===-0x1){return _0x5a1fa3;}return this[_0xaf88('0x36')][_0xaf88('0xaa')](util[_0xaf88('0x28')](_0xaf88('0xb5'),_0x3c43bb));};AGIVertices['prototype'][_0xaf88('0x6')]=function(_0x3f5894){logger[_0xaf88('0x2e')](util['format'](_0xaf88('0xb6'),_0x3f5894['label']));return this[_0xaf88('0x36')][_0xaf88('0x6')]([_0x3f5894[_0xaf88('0xb7')],_0x3f5894[_0xaf88('0xb8')]]);};AGIVertices[_0xaf88('0x10')][_0xaf88('0xb9')]=function(_0x2159b2){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0xba'),_0x2159b2[_0xaf88('0x38')]));if(this[_0xaf88('0x89')](_0x2159b2[_0xaf88('0x68')])){logger[_0xaf88('0x2e')](util['format'](_0xaf88('0xbb'),_0x2159b2[_0xaf88('0x68')]));var _0x2d6f5e=this[_0xaf88('0x36')][_0xaf88('0xbc')](_0x2159b2[_0xaf88('0x68')]);if(_0x2d6f5e[_0xaf88('0xac')]===-0x1){return _0x2d6f5e;}}return this[_0xaf88('0x36')]['answer']();};AGIVertices[_0xaf88('0x10')][_0xaf88('0x4c')]=function(_0x488823){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0xbd'),_0x488823[_0xaf88('0x38')]));if(!this[_0xaf88('0x89')](_0x488823['list_id'])){return this[_0xaf88('0x36')][_0xaf88('0x2c')](_0x488823,_0xaf88('0xbe'));}_0x488823['scheduledAt']=moment();if(this[_0xaf88('0x89')](_0x488823[_0xaf88('0xbf')])){_0x488823[_0xaf88('0x4b')]=moment()[_0xaf88('0xc0')](_0x488823['delay'],_0xaf88('0xc1'));}if(!this[_0xaf88('0x89')](_0x488823[_0xaf88('0xc2')])){_0x488823[_0xaf88('0xc2')]=0x2;}this['createCmContact'][_0xaf88('0x71')](this,_0x488823);return this[_0xaf88('0x36')]['noop'](util[_0xaf88('0x28')](_0xaf88('0xc3'),_0x488823[_0xaf88('0x4a')],_0x488823['list_id'],_0x488823[_0xaf88('0x4b')]));};AGIVertices[_0xaf88('0x10')][_0xaf88('0xc4')]=function(_0xa0d7b0){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0xc5'),_0xa0d7b0[_0xaf88('0x38')]));var _0x11a5f9=this[_0xaf88('0x36')]['exec'](_0xa0d7b0[_0xaf88('0xc6')],_0xa0d7b0[_0xaf88('0x7b')]);if(_0x11a5f9[_0xaf88('0xac')]===-0x1){return _0x11a5f9;}return this[_0xaf88('0x36')]['noop'](util[_0xaf88('0x28')](_0xaf88('0xc7'),_0xa0d7b0[_0xaf88('0xc6')],_0xa0d7b0['options']));};AGIVertices[_0xaf88('0x10')][_0xaf88('0xc8')]=function(_0x3e90de){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0xc9'),_0x3e90de[_0xaf88('0x38')]));if(!this['isConfigured'](_0x3e90de[_0xaf88('0x63')])){return this['channel'][_0xaf88('0xaa')](_0xaf88('0xab'));}var _0x302161='\x22'+_0x3e90de['text']+'\x22';if(this[_0xaf88('0x89')](_0x3e90de[_0xaf88('0x7b')])){_0x302161+=','+_0x3e90de['options'];}var _0x5afd0d=this[_0xaf88('0x36')][_0xaf88('0x58')](_0xaf88('0xca'),_0x302161);if(_0x5afd0d[_0xaf88('0xac')]===-0x1){return _0x5afd0d;}return this[_0xaf88('0x36')][_0xaf88('0xaa')](util[_0xaf88('0x28')](_0xaf88('0xcb'),_0x302161));};AGIVertices['prototype'][_0xaf88('0xcc')]=function(_0x3b7e41){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0xcd'),_0x3b7e41['label']));if(!this[_0xaf88('0x89')](_0x3b7e41[_0xaf88('0x63')])){return this[_0xaf88('0x36')]['noop'](_0xaf88('0xab'));}var _0x55ec4c='\x22'+_0x3b7e41[_0xaf88('0x63')]+'\x22';if(this[_0xaf88('0x89')](_0x3b7e41[_0xaf88('0x7b')])){_0x55ec4c+=','+_0x3b7e41[_0xaf88('0x7b')];}var _0x20e0ec=this[_0xaf88('0x36')][_0xaf88('0x58')](_0xaf88('0xca'),_0x55ec4c);if(_0x20e0ec[_0xaf88('0xac')]===-0x1){return _0x20e0ec;}return this['channel'][_0xaf88('0xaa')](util['format'](_0xaf88('0xcb'),_0x55ec4c));};AGIVertices[_0xaf88('0x10')][_0xaf88('0xce')]=function(_0x439154){logger[_0xaf88('0x2e')](util['format'](_0xaf88('0xcf'),_0x439154[_0xaf88('0x38')]));if(!this[_0xaf88('0x89')](_0x439154[_0xaf88('0xb0')])){return this[_0xaf88('0x36')][_0xaf88('0xaa')](_0xaf88('0xaf'));}var _0x1d0c1f=_0x439154[_0xaf88('0xb0')];if(this[_0xaf88('0x89')](_0x439154[_0xaf88('0x7b')])){_0x1d0c1f+=','+_0x439154[_0xaf88('0x7b')];}var _0x343475=this[_0xaf88('0x36')]['exec'](_0xaf88('0xb1'),_0x1d0c1f);if(_0x343475[_0xaf88('0xac')]===-0x1){return _0x343475;}var _0x592243=this['getAndSetVariable'](_0xaf88('0xb2'),'LUMENVOX_ASR_CONFIDENCE');if(_0x592243[_0xaf88('0xac')]===-0x1){return _0x592243;}var _0x518653=this[_0xaf88('0xa5')](_0xaf88('0xb3'),_0xaf88('0xd0'));if(_0x518653['result']===-0x1){return _0x518653;}var _0x4f3469=this['getAndSetVariable'](_0xaf88('0xd1'),_0xaf88('0xd2'));if(_0x4f3469[_0xaf88('0xac')]===-0x1){return _0x4f3469;}return this[_0xaf88('0x36')][_0xaf88('0xaa')](util[_0xaf88('0x28')](_0xaf88('0xb5'),_0x1d0c1f));};AGIVertices['prototype'][_0xaf88('0xd3')]=function(_0x13ccd6){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0xd4'),_0x13ccd6[_0xaf88('0x38')]));if(!this['isConfigured'](_0x13ccd6['grammar'])){return this['channel'][_0xaf88('0xaa')](_0xaf88('0xaf'));}var _0x5124e6=_0x13ccd6[_0xaf88('0xb0')];if(this['isConfigured'](_0x13ccd6[_0xaf88('0x7b')])){_0x5124e6+=','+_0x13ccd6['options'];}var _0xe2c519=this['channel'][_0xaf88('0x58')](_0xaf88('0xb1'),_0x5124e6);if(_0xe2c519[_0xaf88('0xac')]===-0x1){return _0xe2c519;}var _0x17520f=this[_0xaf88('0xa5')](_0xaf88('0xb2'),_0xaf88('0xd5'));if(_0x17520f[_0xaf88('0xac')]===-0x1){return _0x17520f;}var _0x52a62c=this[_0xaf88('0xa5')](_0xaf88('0xb3'),'SESTEK_ASR_TRANSCRIPT');if(_0x52a62c[_0xaf88('0xac')]===-0x1){return _0x52a62c;}var _0x53df58=this[_0xaf88('0xa5')](_0xaf88('0xd1'),'SESTEK_ASR_INSTANCE');if(_0x53df58[_0xaf88('0xac')]===-0x1){return _0x53df58;}return this['channel'][_0xaf88('0xaa')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x5124e6));};AGIVertices[_0xaf88('0x10')][_0xaf88('0xd6')]=function(_0x39f7fe){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x39f7fe['label']));if(!this[_0xaf88('0x89')](_0x39f7fe[_0xaf88('0xd7')])){return this[_0xaf88('0x36')][_0xaf88('0x2c')](_0x39f7fe,_0xaf88('0xd8'));}var _0x5b09b7=this[_0xaf88('0x19')][_0xaf88('0x71')](this,_0x39f7fe[_0xaf88('0xd7')]);if(!_0x5b09b7){return this['channel'][_0xaf88('0x2c')](_0x39f7fe,_0xaf88('0xd9'));}if(!this[_0xaf88('0x89')](_0x39f7fe[_0xaf88('0xda')])){return this[_0xaf88('0x36')][_0xaf88('0x2c')](_0x39f7fe,'no\x20query\x20configured');}var _0x5ab905=_0x39f7fe[_0xaf88('0xda')][_0xaf88('0x59')](/(\r\n|\n|\r)/gm,'\x20');this[_0xaf88('0x36')][_0xaf88('0xaa')](util[_0xaf88('0x28')](_0xaf88('0xdb'),_0x5ab905));var _0x38a0ae=this[_0xaf88('0x2a')][_0xaf88('0x71')](this,_0x5b09b7,_0x5ab905);this['createSquareDetailsReport'][_0xaf88('0x71')](this,_0x39f7fe,_0x5ab905);if(!this[_0xaf88('0x89')](_0x39f7fe['variable_id'])){return this[_0xaf88('0x36')][_0xaf88('0xaa')](_0xaf88('0xdc'));}var _0x47bdcf=this[_0xaf88('0x11')][_0xaf88('0x71')](this,_0x39f7fe[_0xaf88('0xdd')]);if(!_0x47bdcf){return this[_0xaf88('0x36')]['error'](_0x39f7fe,_0xaf88('0xde'));}var _0x206dbb=this;_0x38a0ae[_0xaf88('0xdf')](function(_0x30aad4,_0xc55b64){Object[_0xaf88('0xe0')](_0x30aad4)[_0xaf88('0xdf')](function(_0x34e187){_0x206dbb[_0xaf88('0x36')]['setVariable'](util['format'](_0xaf88('0xe1'),_0x47bdcf,_0xc55b64,_0x34e187),_0x30aad4[_0x34e187]);});});this[_0xaf88('0x36')][_0xaf88('0xa2')](util[_0xaf88('0x28')](_0xaf88('0xe2'),_0x47bdcf),_0x38a0ae[_0xaf88('0xa1')]);return this['channel'][_0xaf88('0xaa')](util['format'](_0xaf88('0xe3'),_0x47bdcf));};AGIVertices['prototype'][_0xaf88('0xe4')]=function(_0x44f94b){logger[_0xaf88('0xe5')](util[_0xaf88('0x28')](_0xaf88('0xe6'),_0x44f94b[_0xaf88('0x38')]));if(!this['isConfigured'](_0x44f94b[_0xaf88('0xe7')])){return this[_0xaf88('0x36')][_0xaf88('0x2c')](_0x44f94b,_0xaf88('0xe8'));}var _0x4aa103=this[_0xaf88('0x1c')]['sync'](this,_0x44f94b[_0xaf88('0xe7')]);if(!_0x4aa103){return this[_0xaf88('0x36')][_0xaf88('0x2c')](_0x44f94b,_0xaf88('0xe9'));}var _0x12b687=this[_0xaf88('0x36')]['exec'](_0xaf88('0xea'),[util[_0xaf88('0x28')](_0xaf88('0xeb'),_0x4aa103),_0x44f94b[_0xaf88('0x68')],_0x44f94b['opts'],_0x44f94b[_0xaf88('0x73')]]);if(_0x12b687[_0xaf88('0xac')]===-0x1){return _0x12b687;}return this['channel'][_0xaf88('0xaa')](util[_0xaf88('0x28')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0xaf88('0x10')][_0xaf88('0xec')]=function(_0x1fe9ef){logger[_0xaf88('0x2e')](util['format'](_0xaf88('0xed'),_0x1fe9ef['label']));if(!this[_0xaf88('0x89')](_0x1fe9ef[_0xaf88('0x7d')])){return this[_0xaf88('0x36')][_0xaf88('0xaa')](_0xaf88('0xee'));}if(!this[_0xaf88('0x89')](_0x1fe9ef[_0xaf88('0x63')])){return this[_0xaf88('0x36')][_0xaf88('0xaa')](_0xaf88('0xab'));}this[_0xaf88('0x36')][_0xaf88('0xef')]=!![];this[_0xaf88('0x35')](_0x1fe9ef);this[_0xaf88('0x43')](_0x1fe9ef['text'],'in','','');this[_0xaf88('0x36')]['noop'](util[_0xaf88('0x28')]('Trying\x20Dialogflow:\x20%s',_0x1fe9ef['text']));var _0x3e9cff=this['googleDialogflow'][_0xaf88('0x71')](this,_0x1fe9ef);if(_0x3e9cff){for(var _0x2c6d3e in _0x3e9cff){if(_0x3e9cff[_0xaf88('0x98')](_0x2c6d3e)){this[_0xaf88('0x36')]['setVariable'](util[_0xaf88('0x28')]('DIALOGFLOW_%s',_0x2c6d3e[_0xaf88('0x6c')]()),_0x3e9cff[_0x2c6d3e]);}}this[_0xaf88('0x43')](_0x3e9cff[_0xaf88('0xf0')],_0xaf88('0xf1'),'dialogflow','');return this[_0xaf88('0x36')]['noop'](util[_0xaf88('0x28')]('Dialogflow\x20Result\x20%s',_0x3e9cff['speech']));}return this[_0xaf88('0x36')]['error'](_0x1fe9ef,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0xaf88('0x10')][_0xaf88('0xf2')]=function(_0x224812){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0xf3'),_0x224812[_0xaf88('0x38')]));if(!this[_0xaf88('0x89')](_0x224812[_0xaf88('0x7f')])){return this[_0xaf88('0x36')][_0xaf88('0xaa')]('no\x20project_id\x20configured');}if(!this[_0xaf88('0x89')](_0x224812[_0xaf88('0x80')])){return this[_0xaf88('0x36')]['noop'](_0xaf88('0xf4'));}if(!this['isConfigured'](_0x224812[_0xaf88('0x81')])){return this[_0xaf88('0x36')][_0xaf88('0xaa')](_0xaf88('0xf5'));}if(!this[_0xaf88('0x89')](_0x224812['dialogflowV2_language'])){return this[_0xaf88('0x36')][_0xaf88('0xaa')](_0xaf88('0xf6'));}if(!this['isConfigured'](_0x224812[_0xaf88('0x63')])){return this[_0xaf88('0x36')]['noop'](_0xaf88('0xab'));}this[_0xaf88('0x36')][_0xaf88('0xef')]=!![];this['createSquareDetailsReport'](_0x224812);this[_0xaf88('0x43')](_0x224812['text'],'in','','');this[_0xaf88('0x36')]['noop'](util[_0xaf88('0x28')](_0xaf88('0xf7'),_0x224812[_0xaf88('0x63')]));var _0x23077d=this[_0xaf88('0xf8')]['sync'](this,_0x224812);if(_0x23077d){for(var _0x227693 in _0x23077d){if(_0x23077d[_0xaf88('0x98')](_0x227693)){if(_0x227693!==_0xaf88('0xf9')){this[_0xaf88('0x36')][_0xaf88('0xa2')](util['format']('DIALOGFLOW_%s',_0x227693[_0xaf88('0x6c')]()),_0x23077d[_0x227693]);}}}this[_0xaf88('0x43')](_0x23077d[_0xaf88('0xf0')],_0xaf88('0xf1'),_0xaf88('0xf2'),_0x23077d[_0xaf88('0xf9')]);return this[_0xaf88('0x36')][_0xaf88('0xaa')](util[_0xaf88('0x28')](_0xaf88('0xfa'),_0x23077d[_0xaf88('0xf0')]));}return this['channel'][_0xaf88('0x2c')](_0x224812,_0xaf88('0xfb'));};AGIVertices['prototype'][_0xaf88('0xfc')]=function(_0x1f93b5){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0xfd'),_0x1f93b5[_0xaf88('0x38')]));if(!this[_0xaf88('0x89')](_0x1f93b5['ndauth_url'])){return this['channel'][_0xaf88('0xaa')](_0xaf88('0xfe'));}if(!this[_0xaf88('0x89')](_0x1f93b5[_0xaf88('0xff')])){return this[_0xaf88('0x36')][_0xaf88('0xaa')](_0xaf88('0x100'));}if(!this[_0xaf88('0x89')](_0x1f93b5['password'])){return this['channel'][_0xaf88('0xaa')](_0xaf88('0x101'));}if(!this['isConfigured'](_0x1f93b5[_0xaf88('0x102')])){return this[_0xaf88('0x36')][_0xaf88('0xaa')](_0xaf88('0xab'));}this['channel']['bot']=!![];this[_0xaf88('0x35')](_0x1f93b5);this[_0xaf88('0x43')](_0x1f93b5[_0xaf88('0x63')],'in','','');this[_0xaf88('0x36')][_0xaf88('0xaa')](util[_0xaf88('0x28')]('Trying\x20SestekNDA:\x20%s',_0x1f93b5[_0xaf88('0x63')]));var _0x217f47=this[_0xaf88('0x83')][_0xaf88('0x71')](this,_0x1f93b5);if(_0x217f47){for(var _0x451406 in _0x217f47){if(_0x217f47[_0xaf88('0x98')](_0x451406)){this[_0xaf88('0x36')]['setVariable'](util[_0xaf88('0x28')]('SESTEK_NDA_%s',_0x451406[_0xaf88('0x6c')]()),_0x217f47[_0x451406]);}}this['createSquareMessage'](_0x217f47[_0xaf88('0xf0')],'out','sesteknda','');if(_0x217f47['audiofile']){this[_0xaf88('0x36')][_0xaf88('0xaa')](util[_0xaf88('0x28')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x217f47[_0xaf88('0x103')]));var _0x5d6afb=this[_0xaf88('0x36')][_0xaf88('0x104')](_0x217f47[_0xaf88('0x103')]);try{fs['unlink'](_0x217f47[_0xaf88('0x103')]+_0xaf88('0x105'));}catch(_0x55b838){logger[_0xaf88('0x2c')](_0x55b838);}return _0x5d6afb;}else{return this[_0xaf88('0x36')][_0xaf88('0xaa')](util['format'](_0xaf88('0x106'),_0x217f47['speech']));}}return this['channel']['error'](_0x1f93b5,_0xaf88('0x107'));};AGIVertices[_0xaf88('0x10')][_0xaf88('0x108')]=function(_0x592bcb){logger['info'](util[_0xaf88('0x28')]('Enter\x20in\x20END\x20(%s)\x20block',_0x592bcb[_0xaf88('0x38')]));return this[_0xaf88('0x36')]['noop'](_0xaf88('0x108'));};AGIVertices[_0xaf88('0x10')][_0xaf88('0x109')]=function(_0x127b55){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0x10a'),_0x127b55[_0xaf88('0x38')]));var _0x5541f1='';if(_0x127b55[_0xaf88('0x10b')]){if(!this['isConfigured'](_0x127b55[_0xaf88('0x10b')])){return this[_0xaf88('0x36')][_0xaf88('0x2c')](_0x127b55,_0xaf88('0x10c'));}else{var _0x437ab3=parseInt(_0x127b55['trunk_id'],0xa);if(isNaN(_0x437ab3)){_0x5541f1=_0x127b55['trunk_id'];}else{_0x5541f1=this[_0xaf88('0x10d')][_0xaf88('0x71')](this,_0x127b55[_0xaf88('0x10b')]);if(!_0x5541f1){return this[_0xaf88('0x36')][_0xaf88('0x2c')](_0x127b55,_0xaf88('0x10e'));}}}}else if(_0x127b55[_0xaf88('0x10f')]){_0x5541f1=_0x127b55[_0xaf88('0x10f')];}else{return this[_0xaf88('0x36')][_0xaf88('0x2c')](_0x127b55,_0xaf88('0x10c'));}var _0x293ad8=this[_0xaf88('0x36')][_0xaf88('0x58')](_0xaf88('0xea'),[util['format'](_0xaf88('0x110'),_0x5541f1,_0x127b55['phone']),_0x127b55[_0xaf88('0x68')],_0x127b55['opts'],_0x127b55['url']]);if(_0x293ad8['result']===-0x1){return _0x293ad8;}return this[_0xaf88('0x36')][_0xaf88('0xaa')](util['format'](_0xaf88('0x111'),_0xaf88('0xea')));};AGIVertices[_0xaf88('0x10')]['finally']=function(_0x42b06f){logger['info'](util['format']('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x42b06f[_0xaf88('0x38')]));return this['channel'][_0xaf88('0xaa')](_0xaf88('0x112'));};AGIVertices[_0xaf88('0x10')][_0xaf88('0x113')]=function(_0x4652fa){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0x114'),_0x4652fa[_0xaf88('0x38')]));if(_0x4652fa['retry']===0x0){return this['maxRetry'](_0x4652fa);}_0x4652fa[_0xaf88('0xa7')]-=0x1;if(!this[_0xaf88('0x89')](_0x4652fa['file_id'])){return this[_0xaf88('0x36')][_0xaf88('0x2c')](_0x4652fa,_0xaf88('0x115'));}var _0x4dda44=this[_0xaf88('0x1e')][_0xaf88('0x71')](this,_0x4652fa[_0xaf88('0x116')]);if(!_0x4dda44){return this[_0xaf88('0x36')][_0xaf88('0x2c')](_0x4652fa,'no\x20file\x20audio\x20found');}if(!this['isConfigured'](_0x4652fa[_0xaf88('0xdd')])){return this['channel']['error'](_0xaf88('0xdc'));}var _0x61efa=this['channel'][_0xaf88('0x117')](_0x4dda44,_0x4652fa[_0xaf88('0x118')],_0x4652fa[_0xaf88('0x119')]);var _0x3cd9c9=_0x61efa['result']?_0x61efa[_0xaf88('0xac')]['toString']():'';logger[_0xaf88('0x2e')]('test',JSON[_0xaf88('0x74')](_0x61efa));if(_0x61efa[_0xaf88('0xac')]===-0x1){this['createSquareDetailsReport'][_0xaf88('0x71')](this,_0x4652fa,_0x3cd9c9);return _0x61efa;}else if(_0x61efa[_0xaf88('0xa4')]===_0xaf88('0x68')){_0x61efa[_0xaf88('0xac')]=_0x3cd9c9[_0xaf88('0xa1')]>=parseInt(_0x4652fa['mindigit'])?'x':'i';}else{_0x61efa[_0xaf88('0xac')]=_0x3cd9c9[_0xaf88('0xa1')]>=parseInt(_0x4652fa[_0xaf88('0x11a')])&&_0x3cd9c9[_0xaf88('0xa1')]<=parseInt(_0x4652fa[_0xaf88('0x119')])?'x':'i';}var _0x29405f=this[_0xaf88('0x11')][_0xaf88('0x71')](this,_0x4652fa[_0xaf88('0xdd')]);if(!_0x29405f){return this['channel'][_0xaf88('0x2c')](_0x4652fa,'no\x20variable\x20found');}this[_0xaf88('0x36')]['setVariable'](_0x29405f,_0x3cd9c9);if(this[_0xaf88('0x89')](_0x4652fa[_0xaf88('0x11b')])){var _0x4e1892=parseInt(_0x4652fa['hiddendigitsnum'],0xa);var _0x4625e6=rs[_0xaf88('0x11c')]({'charset':'*','length':_0x4e1892});var _0x192fa9=_0x3cd9c9[_0xaf88('0xa1')];if(_0x192fa9>0x0){if(_0x192fa9>_0x4e1892){this[_0xaf88('0x35')][_0xaf88('0x71')](this,_0x4652fa,_0x4652fa[_0xaf88('0x11d')]===_0xaf88('0x11e')?_0x4625e6+_0x3cd9c9[_0xaf88('0x11f')](_0x4e1892):_0x3cd9c9[_0xaf88('0x11f')](0x0,_0x192fa9-_0x4e1892)+_0x4625e6);}else{this[_0xaf88('0x35')][_0xaf88('0x71')](this,_0x4652fa,rs[_0xaf88('0x11c')]({'charset':'*','length':_0x192fa9}));}}else{this['createSquareDetailsReport'][_0xaf88('0x71')](this,_0x4652fa,'');}}else{this[_0xaf88('0x35')][_0xaf88('0x71')](this,_0x4652fa,_0x3cd9c9);}return _0x61efa;};AGIVertices['prototype'][_0xaf88('0xd')]=function(_0x31fce7){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0x120'),_0x31fce7['label']));return this[_0xaf88('0x113')](_0x31fce7);};AGIVertices[_0xaf88('0x10')][_0xaf88('0x121')]=function(_0x58ae02){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0x122'),_0x58ae02[_0xaf88('0x38')]));this[_0xaf88('0x35')][_0xaf88('0x71')](this,_0x58ae02,_0x58ae02[_0xaf88('0x123')]);return this[_0xaf88('0x36')][_0xaf88('0xaa')](util[_0xaf88('0x28')]('GOAL\x20%s',_0x58ae02[_0xaf88('0x123')]));};AGIVertices[_0xaf88('0x10')][_0xaf88('0x124')]=function(_0x4b1bc0){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0x125'),_0x4b1bc0[_0xaf88('0x38')]));if(!this[_0xaf88('0x89')](_0x4b1bc0[_0xaf88('0x8c')])||!this[_0xaf88('0x89')](_0x4b1bc0['aws_secret_access_key'])){return this[_0xaf88('0x36')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0xaf88('0x89')](_0x4b1bc0[_0xaf88('0x63')])){return this[_0xaf88('0x36')][_0xaf88('0xaa')]('no\x20text\x20configured');}this[_0xaf88('0x36')][_0xaf88('0xaa')](util['format'](_0xaf88('0x126'),_0x4b1bc0[_0xaf88('0x63')]));var _0x3794ac=this[_0xaf88('0x8b')][_0xaf88('0x71')](this,_0x4b1bc0);if(_0x3794ac){this[_0xaf88('0x36')][_0xaf88('0xaa')](util['format'](_0xaf88('0x127'),_0x3794ac));var _0x47fe36=this[_0xaf88('0x36')][_0xaf88('0x104')](_0x3794ac);try{fs[_0xaf88('0x128')](_0x3794ac+_0xaf88('0x105'));}catch(_0x1f5769){logger[_0xaf88('0x2c')](_0x1f5769);}return _0x47fe36;}return this[_0xaf88('0x36')][_0xaf88('0x2c')](_0x4b1bc0,_0xaf88('0x129'));};AGIVertices[_0xaf88('0x10')][_0xaf88('0x12a')]=function(_0xb9c32c){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0x12b'),_0xb9c32c[_0xaf88('0x38')]));if(!this['isConfigured'](_0xb9c32c['aws_access_key_id'])||!this[_0xaf88('0x89')](_0xb9c32c['aws_secret_access_key'])){return this[_0xaf88('0x36')][_0xaf88('0xaa')](_0xaf88('0x12c'));}if(!this[_0xaf88('0x89')](_0xb9c32c[_0xaf88('0x12d')])){return this[_0xaf88('0x36')][_0xaf88('0xaa')]('no\x20bot\x20name\x20configured');}if(!this['isConfigured'](_0xb9c32c[_0xaf88('0x63')])){return this['channel'][_0xaf88('0xaa')]('no\x20text\x20configured');}this['channel']['bot']=!![];this[_0xaf88('0x35')](_0xb9c32c);this[_0xaf88('0x43')](_0xb9c32c[_0xaf88('0x63')],'in','','');this[_0xaf88('0x36')][_0xaf88('0xaa')](util[_0xaf88('0x28')](_0xaf88('0x12e'),_0xb9c32c[_0xaf88('0x63')]));var _0x3fc0d6=this[_0xaf88('0x8f')][_0xaf88('0x71')](this,_0xb9c32c);if(_0x3fc0d6){for(var _0x440633 in _0x3fc0d6){if(_0x3fc0d6['hasOwnProperty'](_0x440633)&&_[_0xaf88('0x99')](_0x3fc0d6[_0x440633])){this['channel'][_0xaf88('0xa2')](util[_0xaf88('0x28')](_0xaf88('0x12f'),_0x440633[_0xaf88('0x6c')]()),_0x3fc0d6[_0x440633]);}}if(_[_0xaf88('0x49')](_0x3fc0d6[_0xaf88('0x79')])){return this[_0xaf88('0x36')][_0xaf88('0xaa')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0xaf88('0x43')](_0x3fc0d6[_0xaf88('0x79')],_0xaf88('0xf1'),_0xaf88('0x130'),'');return this[_0xaf88('0x36')][_0xaf88('0xaa')](util[_0xaf88('0x28')](_0xaf88('0x131'),_0x3fc0d6[_0xaf88('0x79')]));}}return this[_0xaf88('0x36')]['error'](_0xb9c32c,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0xaf88('0x10')][_0xaf88('0x132')]=function(_0x1116f3){logger['info'](util[_0xaf88('0x28')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x1116f3[_0xaf88('0x38')],_0x1116f3[_0xaf88('0x68')]));if(!this[_0xaf88('0x89')](_0x1116f3[_0xaf88('0x7d')])){return this['channel'][_0xaf88('0xaa')](_0xaf88('0xee'));}var _0x1c3c72=_0xaf88('0x133');var _0x13a19e=util[_0xaf88('0x28')](_0xaf88('0x134'),FILES_PATH,rs[_0xaf88('0x11c')](0x4));var _0x8daf69=util['format'](_0xaf88('0xa0'),_0x13a19e,_0x1c3c72);var _0x771f91=!![];if(_0x1116f3[_0xaf88('0x135')]===_0xaf88('0x136')){_0x771f91=![];}var _0x5a60c7=this[_0xaf88('0x36')]['recordFile'](_0x13a19e,_0x1c3c72,_0x1116f3[_0xaf88('0x137')],_0x1116f3[_0xaf88('0x68')],undefined,_0x771f91);if(_0x5a60c7[_0xaf88('0xac')]!==-0x1){this['channel'][_0xaf88('0xaa')](util['format']('google\x20%s\x20file\x20created',_0x8daf69));var _0x449063=this[_0xaf88('0x138')]['sync'](this,_0x1116f3,_0x8daf69);if(_0x449063){for(var _0xa3c761 in _0x449063){if(_0x449063[_0xaf88('0x98')](_0xa3c761)){this[_0xaf88('0x36')]['setVariable'](util[_0xaf88('0x28')](_0xaf88('0x139'),_0xa3c761[_0xaf88('0x6c')]()),_0x449063[_0xa3c761]);}}return this['channel'][_0xaf88('0xaa')](util['format'](_0xaf88('0x13a'),JSON['stringify'](_0x449063)));}}return _0x5a60c7;};AGIVertices[_0xaf88('0x10')][_0xaf88('0x13b')]=function(_0x29b9ba){logger['info'](util[_0xaf88('0x28')](_0xaf88('0x13c'),_0x29b9ba['label']));if(!this[_0xaf88('0x89')](_0x29b9ba['appid'])){return this['channel'][_0xaf88('0xaa')](_0xaf88('0x13d'));}if(!this[_0xaf88('0x89')](_0x29b9ba[_0xaf88('0x94')])){return this[_0xaf88('0x36')][_0xaf88('0xaa')](_0xaf88('0x13e'));}var _0x13d65a=_0xaf88('0x133');var _0x1c9fb8=util[_0xaf88('0x28')](_0xaf88('0x134'),FILES_PATH,rs[_0xaf88('0x11c')](0x4));var _0x56203c=util[_0xaf88('0x28')](_0xaf88('0xa0'),_0x1c9fb8,_0x13d65a);var _0x778aeb=!![];if(_0x29b9ba[_0xaf88('0x135')]===_0xaf88('0x136')){_0x778aeb=![];}var _0x2b5bd7=this[_0xaf88('0x36')][_0xaf88('0x13f')](_0x1c9fb8,_0x13d65a,_0x29b9ba[_0xaf88('0x137')],_0x29b9ba['timeout'],undefined,_0x778aeb);if(_0x2b5bd7[_0xaf88('0xac')]!==-0x1){this[_0xaf88('0x36')][_0xaf88('0xaa')](util[_0xaf88('0x28')]('tilde\x20%s\x20file\x20created',_0x56203c));var _0x420fee=this[_0xaf88('0x93')]['sync'](this,_0x29b9ba,_0x56203c);if(_0x420fee){for(var _0x4bd4c0 in _0x420fee){if(_0x420fee[_0xaf88('0x98')](_0x4bd4c0)){this[_0xaf88('0x36')][_0xaf88('0xa2')](util['format'](_0xaf88('0x140'),_0x4bd4c0[_0xaf88('0x6c')]()),_0x420fee[_0x4bd4c0]);}}return this['channel']['noop'](util[_0xaf88('0x28')](_0xaf88('0x141'),JSON[_0xaf88('0x74')](_0x420fee)));}}return _0x2b5bd7;};AGIVertices[_0xaf88('0x10')]['gotoc']=function(_0x802d05){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x802d05[_0xaf88('0x38')]));return this[_0xaf88('0x36')]['continueAt'](_0x802d05[_0xaf88('0x3d')],_0x802d05[_0xaf88('0x3e')],_0x802d05[_0xaf88('0x3f')]);};AGIVertices[_0xaf88('0x10')][_0xaf88('0x142')]=function(_0x54459d){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0x143'),_0x54459d[_0xaf88('0x38')]));if(!this[_0xaf88('0x89')](_0x54459d[_0xaf88('0x144')])){return this[_0xaf88('0x36')]['error'](_0x54459d,'no\x20condition\x20configured');}try{var _0x194c18=eval(_0x54459d[_0xaf88('0x144')])?_0xaf88('0x145'):'false';this[_0xaf88('0x36')][_0xaf88('0xaa')](util[_0xaf88('0x28')](_0xaf88('0x146'),_0x54459d[_0xaf88('0x144')],_0x194c18));return{'code':0xc8,'result':_0x194c18};}catch(_0x3cbbc5){return{'code':0xc8,'result':_0xaf88('0x147')};}};AGIVertices[_0xaf88('0x10')][_0xaf88('0x148')]=function(_0xe872ff){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0xe872ff[_0xaf88('0x38')]));if(!this[_0xaf88('0x89')](_0xe872ff[_0xaf88('0x149')])){return this['channel']['error'](_0xe872ff,'no\x20interval\x20configured');}var _0x465e38=this[_0xaf88('0x14a')][_0xaf88('0x71')](this,_0xe872ff[_0xaf88('0x149')]);if(!_0x465e38){return this[_0xaf88('0x36')][_0xaf88('0x2c')](_0xe872ff,_0xaf88('0x14b'));}for(var _0x40bbfc=0x0;_0x40bbfc<_0x465e38[_0xaf88('0xa1')];_0x40bbfc+=0x1){var _0x712062=this[_0xaf88('0x36')][_0xaf88('0x11')](util[_0xaf88('0x28')]('IFTIME(%s?true:false)',_0x465e38[_0x40bbfc]));if(_0x712062['result']===-0x1){return _0x712062;}logger['info'](util[_0xaf88('0x28')](_0xaf88('0x14c'),_0x465e38[_0x40bbfc],_0x712062['extra']));if(_0x712062[_0xaf88('0xa4')]===_0xaf88('0x145')){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0x14c'),_0x465e38[_0x40bbfc],_0xaf88('0x145')));this[_0xaf88('0x36')]['noop'](util[_0xaf88('0x28')](_0xaf88('0x14c'),_0x465e38[_0x40bbfc],'true'));return{'code':0xc8,'result':_0xaf88('0x145')};}else{logger[_0xaf88('0x2e')](util['format'](_0xaf88('0x14c'),_0x465e38[_0x40bbfc],'false'));this[_0xaf88('0x36')][_0xaf88('0xaa')](util[_0xaf88('0x28')](_0xaf88('0x14c'),_0x465e38[_0x40bbfc],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype'][_0xaf88('0x14d')]=function(_0x3ee143){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0x14e'),_0x3ee143[_0xaf88('0x38')]));return this[_0xaf88('0x36')][_0xaf88('0x14d')]();};AGIVertices['prototype'][_0xaf88('0x14f')]=function(_0x108ccd){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0x150'),_0x108ccd[_0xaf88('0x38')]));if(!this['isConfigured'](_0x108ccd['key'])){return this[_0xaf88('0x36')][_0xaf88('0xaa')]('no\x20key\x20configured');}var _0x5ef9ba=_0xaf88('0x133');var _0x46b804=util[_0xaf88('0x28')](_0xaf88('0x134'),FILES_PATH,rs[_0xaf88('0x11c')](0x4));var _0x762686=util[_0xaf88('0x28')]('%s.%s',_0x46b804,_0x5ef9ba);var _0x23ca4d=!![];if(_0x108ccd[_0xaf88('0x135')]===_0xaf88('0x136')){_0x23ca4d=![];}var _0x2dc79e=this[_0xaf88('0x36')][_0xaf88('0x13f')](_0x46b804,_0x5ef9ba,_0x108ccd[_0xaf88('0x137')],_0x108ccd['timeout'],undefined,_0x23ca4d);if(_0x2dc79e[_0xaf88('0xac')]!==-0x1){this[_0xaf88('0x36')][_0xaf88('0xaa')](util[_0xaf88('0x28')](_0xaf88('0x151'),_0x762686));var _0x45068f=this[_0xaf88('0x87')][_0xaf88('0x71')](this,_0x108ccd,_0x762686);if(_0x45068f){for(var _0x4eb17e in _0x45068f){if(_0x45068f['hasOwnProperty'](_0x4eb17e)){this[_0xaf88('0x36')][_0xaf88('0xa2')](util[_0xaf88('0x28')](_0xaf88('0x152'),_0x4eb17e['toUpperCase']()),_0x45068f[_0x4eb17e]);}}return this[_0xaf88('0x36')][_0xaf88('0xaa')](util['format'](_0xaf88('0x153'),JSON[_0xaf88('0x74')](_0x45068f)));}}return _0x2dc79e;};AGIVertices[_0xaf88('0x10')][_0xaf88('0x154')]=function(_0x351d02){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0x155'),_0x351d02['label']));if(!this[_0xaf88('0x89')](_0x351d02[_0xaf88('0x7d')])){return this[_0xaf88('0x36')][_0xaf88('0xaa')](_0xaf88('0xee'));}if(!this[_0xaf88('0x89')](_0x351d02[_0xaf88('0x63')])){return this['channel'][_0xaf88('0xaa')](_0xaf88('0xab'));}this[_0xaf88('0x36')]['noop'](util['format'](_0xaf88('0x156'),_0x351d02['text']));var _0x3e905b=this[_0xaf88('0x84')][_0xaf88('0x71')](this,_0x351d02);if(_0x3e905b){this['channel'][_0xaf88('0xaa')](util[_0xaf88('0x28')]('ispeech\x20%s\x20file\x20created',_0x3e905b));var _0x23d6bf=this['channel']['streamFile'](_0x3e905b,_0x351d02[_0xaf88('0x137')]);try{fs[_0xaf88('0x128')](_0x3e905b+'.wav');}catch(_0x27c3ed){logger[_0xaf88('0x2c')](_0x27c3ed);}return _0x23d6bf;}return this['channel'][_0xaf88('0x2c')](_0x351d02,_0xaf88('0x157'));};AGIVertices[_0xaf88('0x10')]['login']=function(_0x153591){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x153591['label']));if(!this[_0xaf88('0x89')](_0x153591[_0xaf88('0x158')])){return this[_0xaf88('0x36')][_0xaf88('0x2c')](_0x153591,_0xaf88('0x159'));}logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0x15a'),this[_0xaf88('0x36')][_0xaf88('0x3a')],_0x153591[_0xaf88('0x158')]));var _0x2e5fb1=this[_0xaf88('0x53')]['sync'](this,_0x153591[_0xaf88('0x158')]);if(_0x2e5fb1){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0x15b'),this[_0xaf88('0x36')][_0xaf88('0x3a')],_0x153591[_0xaf88('0x158')]));this[_0xaf88('0x36')][_0xaf88('0xaa')](util[_0xaf88('0x28')](_0xaf88('0x15b'),this[_0xaf88('0x36')][_0xaf88('0x3a')],_0x153591[_0xaf88('0x158')]));return{'code':0xc8,'result':_0xaf88('0x15c')};}else{logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0x15d'),this[_0xaf88('0x36')][_0xaf88('0x3a')],_0x153591[_0xaf88('0x158')]));this['channel'][_0xaf88('0xaa')](util[_0xaf88('0x28')](_0xaf88('0x15d'),this['channel'][_0xaf88('0x3a')],_0x153591['findBy']));return{'code':0xc8,'result':_0xaf88('0x15e')};}};AGIVertices[_0xaf88('0x10')][_0xaf88('0x15f')]=function(_0x5bbaaf){logger['info'](util[_0xaf88('0x28')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x5bbaaf['label']));if(!this[_0xaf88('0x89')](_0x5bbaaf['findBy'])){return this['channel'][_0xaf88('0x2c')](_0x5bbaaf,_0xaf88('0x159'));}logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0x15a'),this[_0xaf88('0x36')][_0xaf88('0x3a')],_0x5bbaaf['findBy']));var _0x358689=this['agentLogout'][_0xaf88('0x71')](this,_0x5bbaaf[_0xaf88('0x158')]);if(_0x358689){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xaf88('0x36')][_0xaf88('0x3a')],_0x5bbaaf['findBy']));this[_0xaf88('0x36')][_0xaf88('0xaa')](util[_0xaf88('0x28')](_0xaf88('0x15b'),this['channel'][_0xaf88('0x3a')],_0x5bbaaf[_0xaf88('0x158')]));return{'code':0xc8,'result':'success'};}else{logger[_0xaf88('0x2e')](util[_0xaf88('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xaf88('0x36')]['callerid'],_0x5bbaaf[_0xaf88('0x158')]));this[_0xaf88('0x36')]['noop'](util[_0xaf88('0x28')](_0xaf88('0x15d'),this[_0xaf88('0x36')][_0xaf88('0x3a')],_0x5bbaaf[_0xaf88('0x158')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xaf88('0x10')][_0xaf88('0x160')]=function(_0x562fe2){logger['info'](util[_0xaf88('0x28')](_0xaf88('0x161'),_0x562fe2[_0xaf88('0x38')]));if(!this[_0xaf88('0x89')](_0x562fe2[_0xaf88('0x162')])){return this[_0xaf88('0x36')][_0xaf88('0x2c')](_0x562fe2,_0xaf88('0x163'));}this[_0xaf88('0x36')][_0xaf88('0xaa')](util[_0xaf88('0x28')](_0xaf88('0x164'),_0x562fe2[_0xaf88('0x162')]));var _0x2196a1=eval(_0x562fe2[_0xaf88('0x162')]);if(!this[_0xaf88('0x89')](_0x562fe2[_0xaf88('0xdd')])){return this[_0xaf88('0x36')][_0xaf88('0xaa')](_0xaf88('0xdc'));}var _0xfc4a37=this[_0xaf88('0x11')][_0xaf88('0x71')](this,_0x562fe2[_0xaf88('0xdd')]);if(!_0xfc4a37){return this['channel']['error'](_0x562fe2,_0xaf88('0xde'));}if(_[_0xaf88('0x9e')](_0x2196a1)){var _0x1d1080=this;_0x2196a1[_0xaf88('0xdf')](function(_0x10f944,_0x3f5943){_0x1d1080['channel'][_0xaf88('0xa2')](util['format'](_0xaf88('0x165'),_0xfc4a37,_0x3f5943),_0x10f944);});return this[_0xaf88('0x36')][_0xaf88('0xaa')](util[_0xaf88('0x28')](_0xaf88('0x166'),_0xfc4a37));}else{return this['channel']['setVariable'](_0xfc4a37,_0x2196a1);}};AGIVertices['prototype']['menu']=function(_0x4df07d){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0x167'),_0x4df07d['label']));if(_0x4df07d[_0xaf88('0xa7')]===0x0){return this[_0xaf88('0xa8')](_0x4df07d);}_0x4df07d[_0xaf88('0xa7')]-=0x1;if(!this[_0xaf88('0x89')](_0x4df07d[_0xaf88('0x116')])){return this[_0xaf88('0x36')][_0xaf88('0x2c')](_0x4df07d,_0xaf88('0x115'));}var _0x27d23b=this[_0xaf88('0x1e')]['sync'](this,_0x4df07d[_0xaf88('0x116')]);if(!_0x27d23b){return this[_0xaf88('0x36')][_0xaf88('0x2c')](_0x4df07d,'no\x20file\x20audio\x20found');}var _0x214925=this[_0xaf88('0x36')][_0xaf88('0x117')](_0x27d23b,_0x4df07d[_0xaf88('0x118')],_0x4df07d[_0xaf88('0x168')]);var _0x5a2b1c=_0x214925[_0xaf88('0xac')];if(_0x214925[_0xaf88('0xac')]===-0x1){this[_0xaf88('0x35')][_0xaf88('0x71')](this,_0x4df07d,'-1');return _0x214925;}else if(_0x214925[_0xaf88('0xa4')]===_0xaf88('0x68')){_0x214925['result']=_0x214925[_0xaf88('0xac')][_0xaf88('0xa1')]>0x0?_0x214925[_0xaf88('0xac')]:'t';}else if(_['isEmpty'](_0x214925[_0xaf88('0xac')])){_0x214925[_0xaf88('0xac')]='#';_0x5a2b1c='#';}if(!this['isConfigured'](_0x4df07d[_0xaf88('0xdd')])){this[_0xaf88('0x36')][_0xaf88('0xaa')](_0xaf88('0xdc'));}else{var _0x2fecb2=this[_0xaf88('0x11')][_0xaf88('0x71')](this,_0x4df07d[_0xaf88('0xdd')]);if(!_0x2fecb2){return this[_0xaf88('0x36')]['error'](_0x4df07d,_0xaf88('0xde'));}this[_0xaf88('0x36')]['setVariable'](_0x2fecb2,_0x5a2b1c);}this['createSquareDetailsReport'][_0xaf88('0x71')](this,_0x4df07d,_0x5a2b1c);return _0x214925;};AGIVertices['prototype'][_0xaf88('0xaa')]=function(_0x11ba6f){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0x169'),_0x11ba6f[_0xaf88('0x38')]));return this[_0xaf88('0x36')][_0xaf88('0xaa')](_0x11ba6f['output']||_0x11ba6f[_0xaf88('0x38')]);};AGIVertices[_0xaf88('0x10')][_0xaf88('0x16a')]=function(_0x40d2f7){logger[_0xaf88('0x2e')](util['format'](_0xaf88('0x16b'),_0x40d2f7[_0xaf88('0x38')]));if(!this[_0xaf88('0x89')](_0x40d2f7[_0xaf88('0x158')])){return this[_0xaf88('0x36')][_0xaf88('0x2c')](_0x40d2f7,_0xaf88('0x159'));}logger['info'](util['format'](_0xaf88('0x15a'),this[_0xaf88('0x36')][_0xaf88('0x3a')],_0x40d2f7[_0xaf88('0x158')]));var _0x23aba8=this[_0xaf88('0x16c')][_0xaf88('0x71')](this,_0x40d2f7['pause_id']);var _0x24a6ae=this['agentPause']['sync'](this,_0x40d2f7[_0xaf88('0x158')],_0x23aba8);if(_0x24a6ae){logger[_0xaf88('0x2e')](util['format'](_0xaf88('0x15b'),this['channel'][_0xaf88('0x3a')],_0x40d2f7[_0xaf88('0x158')]));this[_0xaf88('0x36')]['noop'](util[_0xaf88('0x28')](_0xaf88('0x15b'),this[_0xaf88('0x36')][_0xaf88('0x3a')],_0x40d2f7['findBy']));return{'code':0xc8,'result':_0xaf88('0x15c')};}else{logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0x15d'),this[_0xaf88('0x36')][_0xaf88('0x3a')],_0x40d2f7[_0xaf88('0x158')]));this['channel']['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xaf88('0x3a')],_0x40d2f7[_0xaf88('0x158')]));return{'code':0xc8,'result':_0xaf88('0x15e')};}};AGIVertices['prototype']['playback']=function(_0x25a450){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0x16d'),_0x25a450['label']));if(!this['isConfigured'](_0x25a450[_0xaf88('0x116')])){return this[_0xaf88('0x36')][_0xaf88('0x2c')](_0x25a450,_0xaf88('0x115'));}var _0x5dbd51=this['getSound'][_0xaf88('0x71')](this,_0x25a450[_0xaf88('0x116')]);if(!_0x5dbd51){return this['channel']['error'](_0x25a450,_0xaf88('0x16e'));}var _0x258642=this['channel'][_0xaf88('0x58')](_0xaf88('0x16f'),[_0x5dbd51,_0x25a450[_0xaf88('0x170')]]);if(_0x258642[_0xaf88('0xac')]===-0x1){return _0x258642;}return this[_0xaf88('0x36')]['noop'](util['format'](_0xaf88('0xc7'),_0xaf88('0x16f'),_0x5dbd51));};AGIVertices['prototype'][_0xaf88('0x171')]=function(_0x4ec09f){logger['info'](util[_0xaf88('0x28')](_0xaf88('0x172'),_0x4ec09f[_0xaf88('0x38')]));if(!this[_0xaf88('0x89')](_0x4ec09f[_0xaf88('0x173')])){return this['channel'][_0xaf88('0x2c')](_0x4ec09f,'no\x20queue\x20selected');}var _0x43ce0e='';var _0x25fa96=parseInt(_0x4ec09f[_0xaf88('0x173')],0xa);if(isNaN(_0x25fa96)){_0x43ce0e=_0x4ec09f[_0xaf88('0x173')];}else{_0x43ce0e=this[_0xaf88('0x15')][_0xaf88('0x71')](this,_0x4ec09f['queue_id']);if(!_0x43ce0e){return this[_0xaf88('0x36')][_0xaf88('0x2c')](_0x4ec09f,_0xaf88('0x174'));}}var _0x48dbe9='';if(this[_0xaf88('0x89')](_0x4ec09f['file_id'])){var _0x23a241=this[_0xaf88('0x1e')][_0xaf88('0x71')](this,_0x4ec09f['file_id']);if(_0x23a241){_0x48dbe9=_0x23a241;}}this['createSquareDetailsReport'][_0xaf88('0x71')](this,_0x4ec09f,_0x43ce0e);if(_0x4ec09f[_0xaf88('0x170')][_0xaf88('0x175')]('x')<0x0){_0x4ec09f[_0xaf88('0x170')]+='x';}if(_0x4ec09f['opts']['indexOf']('X')<0x0){_0x4ec09f[_0xaf88('0x170')]+='X';}this[_0xaf88('0x36')][_0xaf88('0xa2')](_0xaf88('0x176'),_0x43ce0e?_0x43ce0e[_0xaf88('0x177')]():'');var _0x166637=this[_0xaf88('0x36')][_0xaf88('0x58')](_0xaf88('0x178'),[_0x43ce0e,_0x4ec09f['opts'],_0x4ec09f[_0xaf88('0x73')],_0x48dbe9,_0x4ec09f[_0xaf88('0x68')],_0x4ec09f['agi'],_0x4ec09f[_0xaf88('0x179')],_0x4ec09f[_0xaf88('0x17a')],'',_0x4ec09f[_0xaf88('0x17b')]]);if(_0x166637[_0xaf88('0xac')]===-0x1){return _0x166637;}return this['channel']['noop'](util[_0xaf88('0x28')](_0xaf88('0xc7'),'QUEUE',_0x43ce0e));};AGIVertices[_0xaf88('0x10')][_0xaf88('0x17c')]=function(_0x4b8555){logger[_0xaf88('0x2e')](util['format'](_0xaf88('0x17d'),_0x4b8555[_0xaf88('0x38')]));var _0x50729b=_0x4b8555[_0xaf88('0x17e')]||_0xaf88('0x133');var _0x568f41=util['format'](_0xaf88('0x17f'),this[_0xaf88('0x36')][_0xaf88('0x37')],rs[_0xaf88('0x11c')](0x5));var _0x300be9=util[_0xaf88('0x28')](_0xaf88('0x180'),FILES_PATH,_0x568f41,_0x50729b);var _0x21d7bb=util['format'](_0xaf88('0x134'),FILES_PATH,_0x568f41);this[_0xaf88('0x3b')][_0xaf88('0x71')](this,_0x4b8555,_0x568f41,_0x300be9);this[_0xaf88('0x36')][_0xaf88('0xa2')](_0xaf88('0x181'),_0x568f41);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x21d7bb,_0x50729b,_0x4b8555[_0xaf88('0x182')],_0x4b8555[_0xaf88('0x68')]);return this[_0xaf88('0x36')]['recordFile'](_0x21d7bb,_0x50729b,_0x4b8555[_0xaf88('0x182')],_0x4b8555['timeout'],undefined,!![]);};AGIVertices[_0xaf88('0x10')][_0xaf88('0x183')]=function(_0x2d8aeb){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x2d8aeb[_0xaf88('0x38')]));if(!this[_0xaf88('0x89')](_0x2d8aeb[_0xaf88('0x73')])){return this['channel']['noop']('no\x20url\x20configured');}var _0x13c843=this[_0xaf88('0x65')][_0xaf88('0x71')](this,_0x2d8aeb);logger['info'](util[_0xaf88('0x28')](_0xaf88('0x184'),util['inspect'](_0x13c843,{'showHidden':![],'depth':null})));if(!this[_0xaf88('0x89')](_0x2d8aeb[_0xaf88('0xdd')])){return this[_0xaf88('0x36')][_0xaf88('0xaa')](_0xaf88('0x185'));}var _0x22befc=this[_0xaf88('0x11')][_0xaf88('0x71')](this,_0x2d8aeb[_0xaf88('0xdd')]);if(!_0x22befc){return this[_0xaf88('0x36')][_0xaf88('0x2c')](_0x2d8aeb,_0xaf88('0xde'));}this[_0xaf88('0x36')][_0xaf88('0xa2')](util[_0xaf88('0x28')]('%s_STATUS_CODE',_0x22befc),_0x13c843['statusCode']?_0x13c843[_0xaf88('0x77')]:_0xaf88('0x186'));this[_0xaf88('0x36')][_0xaf88('0xa2')](util['format'](_0xaf88('0x187'),_0x22befc),_0x13c843[_0xaf88('0x78')]?_0x13c843[_0xaf88('0x78')]:'OK');if(_0x13c843[_0xaf88('0x75')]){try{this[_0xaf88('0x9f')](_0x13c843[_0xaf88('0x75')],_0x22befc);}catch(_0x44197d){logger[_0xaf88('0x2c')](util[_0xaf88('0x28')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x22befc));}}return this['channel'][_0xaf88('0xaa')](util[_0xaf88('0x28')]('variable\x20%s\x20set',_0x22befc));};AGIVertices['prototype']['saydigits']=function(_0x2f8bc5){logger['info'](util[_0xaf88('0x28')](_0xaf88('0x188'),_0x2f8bc5[_0xaf88('0x38')]));return this[_0xaf88('0x36')]['sayDigits'](_0x2f8bc5[_0xaf88('0x189')][_0xaf88('0x59')](/\s+/g,''),_0x2f8bc5[_0xaf88('0x182')]);};AGIVertices[_0xaf88('0x10')]['saynumber']=function(_0x242818){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x242818['label']));return this['channel']['sayNumber'](_0x242818[_0xaf88('0x67')][_0xaf88('0x59')](/\s+/g,''),_0x242818['escape_digits']);};AGIVertices[_0xaf88('0x10')]['sayphonetic']=function(_0x4acd37){logger['info'](util['format']('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x4acd37[_0xaf88('0x38')]));return this[_0xaf88('0x36')][_0xaf88('0x18a')](_0x4acd37['text'],_0x4acd37[_0xaf88('0x182')]);};AGIVertices[_0xaf88('0x10')][_0xaf88('0x18b')]=function(_0x51e923){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0x18c'),_0x51e923['label']));if(!this[_0xaf88('0x89')](_0x51e923[_0xaf88('0x18d')])){return this[_0xaf88('0x36')][_0xaf88('0xaa')](_0xaf88('0x18e'));}var _0x15de2b=this['getMailAccount']['sync'](this,_0x51e923[_0xaf88('0x18d')]);if(!_0x15de2b||!_0x15de2b[_0xaf88('0x18f')]){return this[_0xaf88('0x36')][_0xaf88('0x2c')](_0x51e923,_0xaf88('0x190'));}var _0x1e4d48={'from':util[_0xaf88('0x28')](_0xaf88('0x191'),_0x15de2b[_0xaf88('0x13')],_0x15de2b[_0xaf88('0x192')]||_0x15de2b[_0xaf88('0x18f')][_0xaf88('0x193')]),'to':_0x51e923['to']||'','cc':_0x51e923['cc']||'','bcc':_0x51e923['bcc']||'','subject':_0x51e923[_0xaf88('0x194')],'html':_0x51e923['text'],'text':_0x51e923[_0xaf88('0x63')]};var _0x2c54e4={'tls':{'rejectUnauthorized':![]}};if(_0x15de2b['Smtp'][_0xaf88('0x195')]){_0x2c54e4[_0xaf88('0x195')]=_0x15de2b[_0xaf88('0x18f')][_0xaf88('0x195')];}else{_0x2c54e4[_0xaf88('0x196')]=_0x15de2b[_0xaf88('0x18f')][_0xaf88('0x196')];_0x2c54e4['port']=_0x15de2b[_0xaf88('0x18f')]['port'];_0x2c54e4[_0xaf88('0x197')]=_0x15de2b[_0xaf88('0x18f')][_0xaf88('0x197')];}if(_0x15de2b[_0xaf88('0x18f')][_0xaf88('0x198')]){_0x2c54e4[_0xaf88('0x199')]={'user':_0x15de2b[_0xaf88('0x18f')][_0xaf88('0x193')],'pass':_0x15de2b[_0xaf88('0x18f')][_0xaf88('0x19a')]};}if(this[_0xaf88('0x89')](_0x51e923['template_id'])){}logger['debug'](_0xaf88('0x19b'),JSON[_0xaf88('0x74')](_0x1e4d48));this[_0xaf88('0x35')][_0xaf88('0x71')](this,_0x51e923,_0x51e923[_0xaf88('0x18d')]);this[_0xaf88('0x36')]['noop'](util[_0xaf88('0x28')](_0xaf88('0x19c'),_0x15de2b[_0xaf88('0x13')]));this[_0xaf88('0x22')][_0xaf88('0x71')](this,_0x2c54e4,_0x1e4d48);return this[_0xaf88('0x36')][_0xaf88('0xaa')](_0xaf88('0x19d'));};AGIVertices['prototype'][_0xaf88('0x19e')]=function(_0xf234b5){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0x19f'),_0xf234b5[_0xaf88('0x38')]));return this['channel'][_0xaf88('0xaa')](_0xaf88('0x1a0'));};AGIVertices[_0xaf88('0x10')]['sendSMS']=function(_0x16cdd0){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x16cdd0[_0xaf88('0x38')]));if(!this[_0xaf88('0x89')](_0x16cdd0[_0xaf88('0x1a1')])){return this[_0xaf88('0x36')]['noop'](_0xaf88('0x1a2'));}var _0xf0cc5c=this[_0xaf88('0x33')]['sync'](this,_0x16cdd0[_0xaf88('0x1a1')]);if(!_0xf0cc5c){return this['channel']['error'](_0x16cdd0,_0xaf88('0x1a3'));}var _0x3e4372={'body':_0x16cdd0[_0xaf88('0x1a4')],'phone':_0x16cdd0['to']||'','SmsAccountId':_0xf0cc5c['id']};logger[_0xaf88('0xe5')](_0xaf88('0x1a5'),JSON[_0xaf88('0x74')](_0x3e4372));this[_0xaf88('0x35')][_0xaf88('0x71')](this,_0x16cdd0,_0x16cdd0[_0xaf88('0x1a1')]);this[_0xaf88('0x36')][_0xaf88('0xaa')](util[_0xaf88('0x28')](_0xaf88('0x1a6'),_0xf0cc5c[_0xaf88('0x13')]));this['createSmsMessage']['sync'](this,_0x3e4372);return this[_0xaf88('0x36')][_0xaf88('0xaa')](_0xaf88('0x1a7'));};AGIVertices['prototype'][_0xaf88('0x1a8')]=function(_0x10bcb6){logger[_0xaf88('0x2e')](util['format'](_0xaf88('0x1a9'),_0x10bcb6[_0xaf88('0x38')]));if(!this[_0xaf88('0x89')](_0x10bcb6[_0xaf88('0xdd')])){return this[_0xaf88('0x36')][_0xaf88('0x2c')](_0x10bcb6,'no\x20variable\x20selected');}var _0x197678=this[_0xaf88('0x11')][_0xaf88('0x71')](this,_0x10bcb6[_0xaf88('0xdd')]);if(!_0x197678){return this['channel'][_0xaf88('0x2c')](_0x10bcb6,_0xaf88('0xde'));}return this[_0xaf88('0x36')][_0xaf88('0xa2')](_0x197678,_0x10bcb6[_0xaf88('0x1aa')]);};AGIVertices['prototype'][_0xaf88('0x1ab')]=function(_0x190bf6){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')]('Enter\x20in\x20START\x20(%s)\x20block',_0x190bf6[_0xaf88('0x38')]));this['channel'][_0xaf88('0xaa')](_0xaf88('0x1ac'));if(_0x190bf6[_0xaf88('0xb9')]===_0xaf88('0x1ad')){this['channel']['noop'](_0xaf88('0x1ae'));return this['channel'][_0xaf88('0xb9')]();}return this['channel'][_0xaf88('0xaa')](_0xaf88('0x1af'));};AGIVertices[_0xaf88('0x10')][_0xaf88('0x1b0')]=function(_0x5c33dd){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0x1b1'),_0x5c33dd[_0xaf88('0x38')]));if(!this['isConfigured'](_0x5c33dd[_0xaf88('0x1b2')])){return this[_0xaf88('0x36')][_0xaf88('0x2c')](_0x5c33dd,_0xaf88('0x1b3'));}var _0x30be2e=this[_0xaf88('0x17')]['sync'](this,_0x5c33dd['project_id']);if(!this['isConfigured'](_0x30be2e)){return this['channel'][_0xaf88('0x2c')](_0x5c33dd,util['format'](_0xaf88('0x1b4'),_0x5c33dd['project_id']));}if(_0x30be2e===this[_0xaf88('0x36')][_0xaf88('0x1b5')]){return this[_0xaf88('0x36')][_0xaf88('0x2c')](_0x5c33dd,_0xaf88('0x1b6'));}this[_0xaf88('0x35')][_0xaf88('0x71')](this,_0x5c33dd,_0x30be2e);var _0x3284bd=this['channel'][_0xaf88('0x58')](_0xaf88('0x1b7'),util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0xaf88('0x6')][_0xaf88('0x196')]||_0xaf88('0x1b8'),_0x30be2e,this[_0xaf88('0x36')][_0xaf88('0x1b5')]));if(_0x3284bd[_0xaf88('0xac')]===-0x1){return _0x3284bd;}return this[_0xaf88('0x36')][_0xaf88('0xaa')](util['format'](_0xaf88('0xc7'),_0xaf88('0x1b7'),_0x30be2e));};AGIVertices['prototype']['system']=function(_0x5cc524){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0x1b9'),_0x5cc524[_0xaf88('0x38')]));var _0x1b0fa7=this[_0xaf88('0x57')][_0xaf88('0x71')](this,_0x5cc524[_0xaf88('0xb7')]);this[_0xaf88('0x35')][_0xaf88('0x71')](this,_0x5cc524,_0x5cc524[_0xaf88('0xb7')]);if(this[_0xaf88('0x89')](_0x5cc524[_0xaf88('0xdd')])){var _0x4bbf2e=this[_0xaf88('0x11')][_0xaf88('0x71')](this,_0x5cc524['variable_id']);if(_0x4bbf2e){this['channel'][_0xaf88('0xa2')](_0x4bbf2e,_0x1b0fa7);return this['channel'][_0xaf88('0xaa')](util[_0xaf88('0x28')](_0xaf88('0x1ba'),_0x5cc524['command'],_0x4bbf2e));}}return this[_0xaf88('0x36')]['noop'](util['format'](_0xaf88('0x1bb'),_0x5cc524[_0xaf88('0xb7')]));};AGIVertices[_0xaf88('0x10')][_0xaf88('0x1bc')]=function(_0x5933d4){logger['info'](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x5933d4['label']));_0x5933d4[_0xaf88('0x63')]=_0x5933d4[_0xaf88('0x63')][_0xaf88('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xaf88('0x89')](_0x5933d4[_0xaf88('0x1bd')])){return this[_0xaf88('0x36')][_0xaf88('0xaa')](_0xaf88('0x1be'));}if(!this[_0xaf88('0x89')](_0x5933d4['text'])){return this[_0xaf88('0x36')][_0xaf88('0xaa')](_0xaf88('0xab'));}this[_0xaf88('0x36')][_0xaf88('0xaa')](util[_0xaf88('0x28')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x5933d4[_0xaf88('0x63')]));var _0xabc2a4=this[_0xaf88('0x5a')][_0xaf88('0x71')](this,_0x5933d4);if(_0xabc2a4){this[_0xaf88('0x36')][_0xaf88('0xaa')](util[_0xaf88('0x28')](_0xaf88('0x1bf'),_0xabc2a4));var _0x3cfeb1=this[_0xaf88('0x36')][_0xaf88('0x104')](_0xabc2a4);try{fs['unlink'](_0xabc2a4+'.wav');}catch(_0x1a180f){logger[_0xaf88('0x2c')](_0x1a180f);}return _0x3cfeb1;}return this[_0xaf88('0x36')][_0xaf88('0x2c')](_0x5933d4,_0xaf88('0x1c0'));};AGIVertices[_0xaf88('0x10')][_0xaf88('0x1c1')]=function(_0x10c02b){logger['info'](util[_0xaf88('0x28')](_0xaf88('0x1c2'),_0x10c02b[_0xaf88('0x38')]));_0x10c02b[_0xaf88('0x63')]=_0x10c02b['text'][_0xaf88('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xaf88('0x89')](_0x10c02b['text'])){return this[_0xaf88('0x36')][_0xaf88('0xaa')](_0xaf88('0xab'));}this[_0xaf88('0x36')][_0xaf88('0xaa')](util[_0xaf88('0x28')](_0xaf88('0x1c3'),_0x10c02b[_0xaf88('0x63')]));var _0x32764c=this[_0xaf88('0x62')][_0xaf88('0x71')](this,_0x10c02b);if(_0x32764c){this[_0xaf88('0x36')][_0xaf88('0xaa')](util[_0xaf88('0x28')](_0xaf88('0x1c4'),_0x32764c));var _0x50db98=this[_0xaf88('0x36')][_0xaf88('0x104')](_0x32764c);try{fs[_0xaf88('0x128')](_0x32764c+'.wav');}catch(_0x26fb52){logger[_0xaf88('0x2c')](_0x26fb52);}return _0x50db98;}return this['channel'][_0xaf88('0x2c')](_0x10c02b,_0xaf88('0x1c5'));};AGIVertices[_0xaf88('0x10')]['unpause']=function(_0x149bd2){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0x1c6'),_0x149bd2[_0xaf88('0x38')]));if(!this['isConfigured'](_0x149bd2[_0xaf88('0x158')])){return this[_0xaf88('0x36')][_0xaf88('0x2c')](_0x149bd2,_0xaf88('0x159'));}logger[_0xaf88('0x2e')](util[_0xaf88('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xaf88('0x36')]['callerid'],_0x149bd2[_0xaf88('0x158')]));var _0x41759e=this[_0xaf88('0x50')][_0xaf88('0x71')](this,_0x149bd2[_0xaf88('0x158')]);if(_0x41759e){logger['info'](util['format'](_0xaf88('0x15b'),this[_0xaf88('0x36')]['callerid'],_0x149bd2[_0xaf88('0x158')]));this['channel'][_0xaf88('0xaa')](util['format'](_0xaf88('0x15b'),this[_0xaf88('0x36')][_0xaf88('0x3a')],_0x149bd2[_0xaf88('0x158')]));return{'code':0xc8,'result':'success'};}else{logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0x15d'),this[_0xaf88('0x36')][_0xaf88('0x3a')],_0x149bd2[_0xaf88('0x158')]));this[_0xaf88('0x36')][_0xaf88('0xaa')](util[_0xaf88('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xaf88('0x36')][_0xaf88('0x3a')],_0x149bd2[_0xaf88('0x158')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xaf88('0x1c7')]=function(_0x243760){logger['info'](util[_0xaf88('0x28')](_0xaf88('0x1c8'),_0x243760[_0xaf88('0x38')]));var _0x5a662e=this[_0xaf88('0x36')]['exec'](_0xaf88('0x1c9'),[_0x243760[_0xaf88('0x1ca')],_0x243760[_0xaf88('0x7b')]]);if(_0x5a662e[_0xaf88('0xac')]===-0x1){return _0x5a662e;}return this[_0xaf88('0x36')][_0xaf88('0xaa')](util[_0xaf88('0x28')](_0xaf88('0xc7'),'VOICEMAIL',_0x243760[_0xaf88('0x1ca')]));};AGIVertices['prototype']['vswitch']=function(_0x4985a6){logger[_0xaf88('0x2e')](util[_0xaf88('0x28')](_0xaf88('0x1cb'),_0x4985a6[_0xaf88('0x38')]));if(!this[_0xaf88('0x89')](_0x4985a6['variable_id'])){return this['channel'][_0xaf88('0x2c')](_0x4985a6,_0xaf88('0x1cc'));}var _0x4eb77f=this[_0xaf88('0x11')][_0xaf88('0x71')](this,_0x4985a6['variable_id']);if(!_0x4eb77f){return this[_0xaf88('0x36')]['error'](_0x4985a6,_0xaf88('0xde'));}var _0xff2ec3=this[_0xaf88('0x36')][_0xaf88('0x11')](_0x4eb77f);return{'code':0xc8,'result':_0xff2ec3['extra']?_0xff2ec3[_0xaf88('0xa4')]:'-'};};String[_0xaf88('0x10')][_0xaf88('0x1cd')]=function(_0x9ec399,_0x464103){return this[_0xaf88('0xa3')](_0x9ec399)[_0xaf88('0x1ce')](_0x464103);};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 f781b4c..bdfc79b 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 _0x3c3b=['attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','attended','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','error','[ACW][START]\x20%s','message','queue','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','info','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][syncAgentConnect]\x20%s','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','acw','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','hanguprequest','syncHangupRequest','syncHangup','syncAgentRingNoAnswer','bind'];(function(_0x472448,_0x192575){var _0xbe79cb=function(_0x228704){while(--_0x228704){_0x472448['push'](_0x472448['shift']());}};_0xbe79cb(++_0x192575);}(_0x3c3b,0x148));var _0xb3c3=function(_0x27ac81,_0x361c4d){_0x27ac81=_0x27ac81-0x0;var _0x2ae1da=_0x3c3b[_0x27ac81];return _0x2ae1da;};'use strict';var util=require('util');var _=require(_0xb3c3('0x0'));var moment=require(_0xb3c3('0x1'));var ami=require(_0xb3c3('0x2'));var logger=require('../../../config/logger')(_0xb3c3('0x3'));var RpcUser=require(_0xb3c3('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0xfc58d5){this[_0xb3c3('0x5')]=_0xfc58d5['voiceQueues'];this[_0xb3c3('0x6')]=_0xfc58d5[_0xb3c3('0x6')];this[_0xb3c3('0x7')]=_0xfc58d5[_0xb3c3('0x7')];this[_0xb3c3('0x8')]={};ami['on'](_0xb3c3('0x9'),this[_0xb3c3('0xa')]['bind'](this));ami['on'](_0xb3c3('0xb'),this[_0xb3c3('0xc')]['bind'](this));ami['on']('hangup',this[_0xb3c3('0xd')]['bind'](this));ami['on']('agentringnoanswer',this[_0xb3c3('0xe')][_0xb3c3('0xf')](this));ami['on'](_0xb3c3('0x10'),this[_0xb3c3('0x11')][_0xb3c3('0xf')](this));ami['on'](_0xb3c3('0x12'),this[_0xb3c3('0x13')]['bind'](this));ami['on'](_0xb3c3('0x14'),this[_0xb3c3('0x15')][_0xb3c3('0xf')](this));}function getDiff(_0x50e7a2){var _0x5b176c=moment()[_0xb3c3('0x16')](0x0);var _0xe2f2eb=moment(_0x50e7a2)['milliseconds'](0x0);return _0x5b176c[_0xb3c3('0x17')](_0xe2f2eb,_0xb3c3('0x18'));}Acw[_0xb3c3('0x19')][_0xb3c3('0x1a')]=function(_0x77ba6){try{var _0x8a6c6=this;var _0x3e9e42=this['channels'][_0x77ba6][_0xb3c3('0x1b')];var _0x5bc518=this[_0xb3c3('0x8')][_0x77ba6]['queue'];var _0x17ebd7=this[_0xb3c3('0x5')][_0x5bc518];var _0x352efc=![];var _0x3eabd=_0xb3c3('0x1c');if(_0x17ebd7[_0xb3c3('0x1d')]){if(_0x17ebd7['mandatoryDispositionPause']['name']){_0x352efc=!![];_0x3eabd=_0x17ebd7[_0xb3c3('0x1e')][_0xb3c3('0x1f')];}}ami['Action']({'action':_0xb3c3('0x20'),'interface':_0x3e9e42,'paused':!![],'reason':_0x3eabd})[_0xb3c3('0x21')](function(_0x3f0ee4){if(_0x8a6c6['agents'][_0x3e9e42]){return RpcUser[_0xb3c3('0x22')](_0x8a6c6['agents'][_0x3e9e42]['id'])[_0xb3c3('0x21')](function(_0x19a1c9){if(_0x19a1c9&&!_0x19a1c9[_0xb3c3('0x23')]){logger['info']('[%s][START][AGENT:%s][QUEUE:%s]',_0x77ba6,_0x3e9e42,_0x5bc518);var _0x14da10=_0x8a6c6[_0xb3c3('0x8')][_0x77ba6][_0xb3c3('0x24')]&&_0x8a6c6['channels'][_0x77ba6][_0xb3c3('0x25')]?_0x8a6c6[_0xb3c3('0x8')][_0x77ba6][_0xb3c3('0x25')]:_0x77ba6;return RpcUser['savePause'](_0x8a6c6['agents'][_0x3e9e42],_0x3eabd,_0x14da10)[_0xb3c3('0x21')](function(_0x143c3c){if(!_0x352efc){_0x8a6c6[_0xb3c3('0x7')][_0x3e9e42]={};logger['info'](_0xb3c3('0x26'),_0x77ba6,_0x8a6c6[_0xb3c3('0x5')][_0x5bc518][_0xb3c3('0x27')],_0x3e9e42,_0x5bc518);_0x8a6c6[_0xb3c3('0x7')][_0x3e9e42][_0xb3c3('0x28')]=setTimeout(_0x8a6c6[_0xb3c3('0x29')][_0xb3c3('0xf')](_0x8a6c6,_0x3e9e42),_0x8a6c6[_0xb3c3('0x5')][_0x5bc518][_0xb3c3('0x27')]*0x3e8);_0x8a6c6['timers'][_0x3e9e42][_0xb3c3('0x2a')]=moment()[_0xb3c3('0x2b')](_0xb3c3('0x2c'));_0x8a6c6['timers'][_0x3e9e42][_0xb3c3('0x2d')]=_0x77ba6;_0x8a6c6[_0xb3c3('0x7')][_0x3e9e42]['queue']=_0x5bc518;_0x8a6c6['timers'][_0x3e9e42][_0xb3c3('0x2e')]=function(){var _0x395320=getDiff(_0x8a6c6[_0xb3c3('0x7')][_0x3e9e42][_0xb3c3('0x2a')]);clearTimeout(_0x8a6c6[_0xb3c3('0x7')][_0x3e9e42]['timer']);_0x8a6c6[_0xb3c3('0x7')][_0x3e9e42][_0xb3c3('0x28')]=![];RpcVoiceAgentReport[_0xb3c3('0x2f')]({'acwtime':_0x395320},_0x8a6c6[_0xb3c3('0x7')][_0x3e9e42][_0xb3c3('0x2d')],_0x3e9e42)[_0xb3c3('0x21')](function(_0x12fc08){logger['info'](_0xb3c3('0x30'),_0x77ba6,_0x395320,_0x12fc08);})[_0xb3c3('0x31')](function(_0x92735b){logger['error'](_0xb3c3('0x32'),_0x77ba6,_0x92735b);});delete _0x8a6c6[_0xb3c3('0x7')][_0x3e9e42];};}});}else{logger['info'](_0xb3c3('0x33'),_0x77ba6,_0x3e9e42,_0x5bc518);}});}})[_0xb3c3('0x31')](function(_0x5be9d7){logger['error'](_0xb3c3('0x26'),_0x77ba6,_0x8a6c6['voiceQueues'][_0x5bc518][_0xb3c3('0x27')],_0x3e9e42,_0x5bc518);})[_0xb3c3('0x34')](function(){delete _0x8a6c6[_0xb3c3('0x8')][_0x77ba6];});}catch(_0x3fe71e){logger[_0xb3c3('0x35')](_0xb3c3('0x36'),_0x3fe71e[_0xb3c3('0x37')]);}};Acw['prototype'][_0xb3c3('0x29')]=function(_0x40da15){try{var _0x2d221d=this;if(_0x2d221d[_0xb3c3('0x7')][_0x40da15]){_0x2d221d[_0xb3c3('0x7')][_0x40da15][_0xb3c3('0x28')]=![];var _0x41da6a=_0x2d221d[_0xb3c3('0x7')][_0x40da15]['uniqueid'];var _0x2d17fa=_0x2d221d['timers'][_0x40da15][_0xb3c3('0x38')];var _0x4e242d=_0x2d221d[_0xb3c3('0x5')][_0x2d17fa][_0xb3c3('0x27')];logger['info'](_0xb3c3('0x39'),_0x41da6a,_0x40da15);RpcUser[_0xb3c3('0x3a')](this[_0xb3c3('0x6')][_0x40da15]);RpcVoiceAgentReport['update']({'acwtime':_0x4e242d,'agentacw':!![]},_0x41da6a,_0x40da15)[_0xb3c3('0x21')](function(_0x4a3cea){logger[_0xb3c3('0x3b')]('[%s][UPDATE][ACWTIME:%s]',_0x41da6a,_0x4e242d,_0x4a3cea);})['catch'](function(_0xbe37a2){logger[_0xb3c3('0x35')](_0xb3c3('0x32'),_0x41da6a,_0xbe37a2);});}else{logger[_0xb3c3('0x35')](_0xb3c3('0x3c'),_0x40da15);if(_0x2d221d[_0xb3c3('0x7')]){logger[_0xb3c3('0x3b')](_0xb3c3('0x3d'),JSON['stringify'](_0x2d221d['timers']));}}}catch(_0x269231){logger[_0xb3c3('0x35')]('[ACW][STOP]\x20%s',_0x269231[_0xb3c3('0x37')]);}};Acw[_0xb3c3('0x19')][_0xb3c3('0xa')]=function(_0xb66574){try{if(this[_0xb3c3('0x5')][_0xb66574[_0xb3c3('0x38')]]&&(this[_0xb3c3('0x5')][_0xb66574['queue']][_0xb3c3('0x3')]||this[_0xb3c3('0x5')][_0xb66574[_0xb3c3('0x38')]][_0xb3c3('0x1d')])){if(this['agents'][_0xb66574['interface']]){this['channels'][_0xb66574[_0xb3c3('0x2d')]]={'queue':_0xb66574[_0xb3c3('0x38')],'interface':_0xb66574['interface'],'destlinkedid':_0xb66574[_0xb3c3('0x25')]};}}}catch(_0x50d05e){logger[_0xb3c3('0x35')](_0xb3c3('0x3e'),_0x50d05e[_0xb3c3('0x37')]);}};Acw[_0xb3c3('0x19')][_0xb3c3('0x15')]=function(_0x4460dc){try{if(this[_0xb3c3('0x5')][_0x4460dc[_0xb3c3('0x38')]]&&(this[_0xb3c3('0x5')][_0x4460dc[_0xb3c3('0x38')]]['acw']||this[_0xb3c3('0x5')][_0x4460dc['queue']][_0xb3c3('0x1d')])){if(this['agents'][_0x4460dc[_0xb3c3('0x1b')]]){this['channels'][_0x4460dc['uniqueid']]={'queue':_0x4460dc['queue'],'interface':_0x4460dc['interface']};}}}catch(_0x1751e9){logger['error']('[ACW][syncAgentConnectPreview]\x20%s',_0x1751e9[_0xb3c3('0x37')]);}};Acw[_0xb3c3('0x19')][_0xb3c3('0xc')]=function(_0x1de426){try{if(this[_0xb3c3('0x8')][_0x1de426[_0xb3c3('0x2d')]]&&_['isUndefined'](this['channels'][_0x1de426['uniqueid']]['attended'])){logger[_0xb3c3('0x3b')](_0xb3c3('0x3f'),_0x1de426[_0xb3c3('0x2d')]);this[_0xb3c3('0x1a')](_0x1de426[_0xb3c3('0x2d')]);}else if(this[_0xb3c3('0x8')][_0x1de426[_0xb3c3('0x40')]]&&_[_0xb3c3('0x41')](this[_0xb3c3('0x8')][_0x1de426['linkedid']][_0xb3c3('0x24')])){logger[_0xb3c3('0x3b')]('[%s][HANGUP:LINKEDID]',_0x1de426[_0xb3c3('0x40')]);this[_0xb3c3('0x1a')](_0x1de426[_0xb3c3('0x40')]);}}catch(_0x2e3274){logger[_0xb3c3('0x35')](_0xb3c3('0x42'),_0x2e3274[_0xb3c3('0x37')]);}};Acw['prototype'][_0xb3c3('0xd')]=function(_0x4b75e2){try{if(this[_0xb3c3('0x8')][_0x4b75e2[_0xb3c3('0x2d')]]&&this[_0xb3c3('0x8')][_0x4b75e2['uniqueid']][_0xb3c3('0x24')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x4b75e2[_0xb3c3('0x2d')]);this[_0xb3c3('0x1a')](_0x4b75e2[_0xb3c3('0x2d')]);}else if(this['channels'][_0x4b75e2[_0xb3c3('0x40')]]&&this['channels'][_0x4b75e2['linkedid']][_0xb3c3('0x24')]){logger[_0xb3c3('0x3b')](_0xb3c3('0x43'),_0x4b75e2[_0xb3c3('0x40')]);this[_0xb3c3('0x1a')](_0x4b75e2['linkedid']);}}catch(_0x406ba6){logger[_0xb3c3('0x35')](_0xb3c3('0x44'),_0x406ba6[_0xb3c3('0x37')]);}};Acw['prototype'][_0xb3c3('0x11')]=function(_0x2d5cbe){try{if(!_['isNil'](this[_0xb3c3('0x8')][_0x2d5cbe['transfereeuniqueid']])){this[_0xb3c3('0x1a')](_0x2d5cbe[_0xb3c3('0x45')]);if(this['channels'][_0x2d5cbe[_0xb3c3('0x46')]]){this['channels'][_0x2d5cbe['secondtransfereruniqueid']][_0xb3c3('0x24')]=!![];this[_0xb3c3('0x8')][_0x2d5cbe[_0xb3c3('0x47')]]=this[_0xb3c3('0x8')][_0x2d5cbe[_0xb3c3('0x46')]];delete this[_0xb3c3('0x8')][_0x2d5cbe[_0xb3c3('0x46')]];}}else if(!_['isNil'](this['channels'][_0x2d5cbe[_0xb3c3('0x47')]])){this[_0xb3c3('0x1a')](_0x2d5cbe[_0xb3c3('0x47')]);if(this['channels'][_0x2d5cbe[_0xb3c3('0x48')]]){this[_0xb3c3('0x8')][_0x2d5cbe[_0xb3c3('0x48')]][_0xb3c3('0x24')]=!![];this[_0xb3c3('0x8')][_0x2d5cbe[_0xb3c3('0x45')]]=this[_0xb3c3('0x8')][_0x2d5cbe['origtransfereruniqueid']];delete this[_0xb3c3('0x8')][_0x2d5cbe['origtransfereruniqueid']];}}}catch(_0x3c2f4b){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0x3c2f4b[_0xb3c3('0x37')]);}};Acw['prototype'][_0xb3c3('0x13')]=function(_0x27637a){try{if(this[_0xb3c3('0x8')][_0x27637a[_0xb3c3('0x49')]]){logger[_0xb3c3('0x3b')](_0xb3c3('0x4a'),JSON[_0xb3c3('0x4b')](_0x27637a[_0xb3c3('0x49')]));this[_0xb3c3('0x1a')](_0x27637a[_0xb3c3('0x49')]);}else if(this[_0xb3c3('0x8')][_0x27637a[_0xb3c3('0x4c')]]){logger[_0xb3c3('0x3b')](_0xb3c3('0x4d'),JSON['stringify'](_0x27637a[_0xb3c3('0x4c')]));this[_0xb3c3('0x1a')](_0x27637a[_0xb3c3('0x4c')]);}}catch(_0x28e57f){logger[_0xb3c3('0x35')](_0xb3c3('0x4e'),_0x28e57f['message']);}};Acw[_0xb3c3('0x19')][_0xb3c3('0xe')]=function(_0x565dd9){try{if(this['voiceQueues'][_0x565dd9[_0xb3c3('0x38')]]&&this[_0xb3c3('0x5')][_0x565dd9[_0xb3c3('0x38')]][_0xb3c3('0x4f')]===_0xb3c3('0x50')){if(this[_0xb3c3('0x6')][_0x565dd9['interface']]){logger[_0xb3c3('0x3b')](_0xb3c3('0x51'),_0x565dd9[_0xb3c3('0x2d')],_0x565dd9['interface'],_0x565dd9[_0xb3c3('0x38')]);return RpcUser[_0xb3c3('0x52')](this[_0xb3c3('0x6')][_0x565dd9['interface']],_0xb3c3('0x53'),_0x565dd9[_0xb3c3('0x2d')]);}}}catch(_0x4048e0){logger[_0xb3c3('0x35')](_0xb3c3('0x54'),_0x4048e0[_0xb3c3('0x37')]);}};module[_0xb3c3('0x55')]=Acw; \ No newline at end of file +var _0xeba7=['format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','message','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hangup','syncHangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','then','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','acwTimeout','timer','lastPauseAt'];(function(_0x332ef9,_0x387cb2){var _0x64da7d=function(_0x34daa0){while(--_0x34daa0){_0x332ef9['push'](_0x332ef9['shift']());}};_0x64da7d(++_0x387cb2);}(_0xeba7,0x124));var _0x7eba=function(_0x7e80c2,_0x5229b0){_0x7e80c2=_0x7e80c2-0x0;var _0x43e592=_0xeba7[_0x7e80c2];return _0x43e592;};'use strict';var util=require(_0x7eba('0x0'));var _=require(_0x7eba('0x1'));var moment=require('moment');var ami=require(_0x7eba('0x2'));var logger=require(_0x7eba('0x3'))(_0x7eba('0x4'));var RpcUser=require(_0x7eba('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x2ec6e2){this[_0x7eba('0x6')]=_0x2ec6e2[_0x7eba('0x6')];this['agents']=_0x2ec6e2[_0x7eba('0x7')];this[_0x7eba('0x8')]=_0x2ec6e2[_0x7eba('0x8')];this[_0x7eba('0x9')]={};ami['on']('agentconnect',this[_0x7eba('0xa')][_0x7eba('0xb')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0x7eba('0xb')](this));ami['on'](_0x7eba('0xc'),this[_0x7eba('0xd')]['bind'](this));ami['on']('agentringnoanswer',this[_0x7eba('0xe')][_0x7eba('0xb')](this));ami['on'](_0x7eba('0xf'),this[_0x7eba('0x10')][_0x7eba('0xb')](this));ami['on'](_0x7eba('0x11'),this[_0x7eba('0x12')][_0x7eba('0xb')](this));ami['on']('custom:agentConnectPreview',this[_0x7eba('0x13')][_0x7eba('0xb')](this));}function getDiff(_0x119129){var _0x808b0e=moment()['milliseconds'](0x0);var _0x1aecf8=moment(_0x119129)[_0x7eba('0x14')](0x0);return _0x808b0e['diff'](_0x1aecf8,_0x7eba('0x15'));}Acw[_0x7eba('0x16')][_0x7eba('0x17')]=function(_0x2ff8f2){try{var _0x442526=this;var _0xcdabce=this['channels'][_0x2ff8f2][_0x7eba('0x18')];var _0x529144=this[_0x7eba('0x9')][_0x2ff8f2][_0x7eba('0x19')];var _0x3cbf94=this[_0x7eba('0x6')][_0x529144];var _0x396852=![];var _0x572c83=_0x7eba('0x1a');if(_0x3cbf94[_0x7eba('0x1b')]){if(_0x3cbf94[_0x7eba('0x1c')][_0x7eba('0x1d')]){_0x396852=!![];_0x572c83=_0x3cbf94[_0x7eba('0x1c')]['name'];}}ami[_0x7eba('0x1e')]({'action':'QueuePause','interface':_0xcdabce,'paused':!![],'reason':_0x572c83})[_0x7eba('0x1f')](function(_0x2b920e){if(_0x442526[_0x7eba('0x7')][_0xcdabce]){return RpcUser['getAgent'](_0x442526[_0x7eba('0x7')][_0xcdabce]['id'])[_0x7eba('0x1f')](function(_0x17ae2e){if(_0x17ae2e&&!_0x17ae2e['voicePause']){logger[_0x7eba('0x20')](_0x7eba('0x21'),_0x2ff8f2,_0xcdabce,_0x529144);var _0x5e3213=_0x442526[_0x7eba('0x9')][_0x2ff8f2][_0x7eba('0x22')]&&_0x442526[_0x7eba('0x9')][_0x2ff8f2][_0x7eba('0x23')]?_0x442526[_0x7eba('0x9')][_0x2ff8f2][_0x7eba('0x23')]:_0x2ff8f2;return RpcUser[_0x7eba('0x24')](_0x442526[_0x7eba('0x7')][_0xcdabce],_0x572c83,_0x5e3213)[_0x7eba('0x1f')](function(_0x2ddfb3){if(!_0x396852){_0x442526[_0x7eba('0x8')][_0xcdabce]={};logger[_0x7eba('0x20')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2ff8f2,_0x442526[_0x7eba('0x6')][_0x529144][_0x7eba('0x25')],_0xcdabce,_0x529144);_0x442526['timers'][_0xcdabce][_0x7eba('0x26')]=setTimeout(_0x442526['stopAcw'][_0x7eba('0xb')](_0x442526,_0xcdabce),_0x442526[_0x7eba('0x6')][_0x529144]['acwTimeout']*0x3e8);_0x442526[_0x7eba('0x8')][_0xcdabce][_0x7eba('0x27')]=moment()[_0x7eba('0x28')](_0x7eba('0x29'));_0x442526[_0x7eba('0x8')][_0xcdabce][_0x7eba('0x2a')]=_0x2ff8f2;_0x442526[_0x7eba('0x8')][_0xcdabce][_0x7eba('0x19')]=_0x529144;_0x442526[_0x7eba('0x8')][_0xcdabce][_0x7eba('0x2b')]=function(){var _0x30e751=getDiff(_0x442526[_0x7eba('0x8')][_0xcdabce][_0x7eba('0x27')]);clearTimeout(_0x442526['timers'][_0xcdabce][_0x7eba('0x26')]);_0x442526['timers'][_0xcdabce][_0x7eba('0x26')]=![];RpcVoiceAgentReport[_0x7eba('0x2c')]({'acwtime':_0x30e751},_0x442526[_0x7eba('0x8')][_0xcdabce]['uniqueid'],_0xcdabce)['then'](function(_0x49bbc6){logger[_0x7eba('0x20')]('[%s][UPDATE][ACWTIME:%s]',_0x2ff8f2,_0x30e751,_0x49bbc6);})[_0x7eba('0x2d')](function(_0x37fca8){logger[_0x7eba('0x2e')](_0x7eba('0x2f'),_0x2ff8f2,_0x37fca8);});delete _0x442526['timers'][_0xcdabce];};}});}else{logger[_0x7eba('0x20')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x2ff8f2,_0xcdabce,_0x529144);}});}})[_0x7eba('0x2d')](function(_0x957f5){logger[_0x7eba('0x2e')](_0x7eba('0x30'),_0x2ff8f2,_0x442526['voiceQueues'][_0x529144][_0x7eba('0x25')],_0xcdabce,_0x529144);})['finally'](function(){delete _0x442526[_0x7eba('0x9')][_0x2ff8f2];});}catch(_0x711c4c){logger[_0x7eba('0x2e')]('[ACW][START]\x20%s',_0x711c4c['message']);}};Acw[_0x7eba('0x16')]['stopAcw']=function(_0x49d0c5){try{var _0x2db536=this;if(_0x2db536['timers'][_0x49d0c5]){_0x2db536[_0x7eba('0x8')][_0x49d0c5]['timer']=![];var _0x468d6d=_0x2db536['timers'][_0x49d0c5][_0x7eba('0x2a')];var _0x3a833a=_0x2db536['timers'][_0x49d0c5][_0x7eba('0x19')];var _0x1f202c=_0x2db536[_0x7eba('0x6')][_0x3a833a]['acwTimeout'];logger[_0x7eba('0x20')](_0x7eba('0x31'),_0x468d6d,_0x49d0c5);RpcUser[_0x7eba('0x32')](this[_0x7eba('0x7')][_0x49d0c5]);RpcVoiceAgentReport['update']({'acwtime':_0x1f202c,'agentacw':!![]},_0x468d6d,_0x49d0c5)[_0x7eba('0x1f')](function(_0x8cc4b2){logger['info'](_0x7eba('0x33'),_0x468d6d,_0x1f202c,_0x8cc4b2);})[_0x7eba('0x2d')](function(_0x85aae9){logger[_0x7eba('0x2e')]('[%s][UPDATE][ERRORS:%s]',_0x468d6d,_0x85aae9);});}else{logger['error'](_0x7eba('0x34'),_0x49d0c5);if(_0x2db536[_0x7eba('0x8')]){logger[_0x7eba('0x20')](_0x7eba('0x35'),JSON[_0x7eba('0x36')](_0x2db536[_0x7eba('0x8')]));}}}catch(_0xa81342){logger[_0x7eba('0x2e')](_0x7eba('0x37'),_0xa81342['message']);}};Acw[_0x7eba('0x16')][_0x7eba('0xa')]=function(_0x1678f8){try{if(this[_0x7eba('0x6')][_0x1678f8['queue']]&&(this[_0x7eba('0x6')][_0x1678f8[_0x7eba('0x19')]]['acw']||this[_0x7eba('0x6')][_0x1678f8[_0x7eba('0x19')]][_0x7eba('0x1b')])){if(this[_0x7eba('0x7')][_0x1678f8['interface']]){this[_0x7eba('0x9')][_0x1678f8[_0x7eba('0x2a')]]={'queue':_0x1678f8['queue'],'interface':_0x1678f8['interface'],'destlinkedid':_0x1678f8[_0x7eba('0x23')]};}}}catch(_0x550e23){logger[_0x7eba('0x2e')]('[ACW][syncAgentConnect]\x20%s',_0x550e23['message']);}};Acw['prototype'][_0x7eba('0x13')]=function(_0x3f3805){try{if(this[_0x7eba('0x6')][_0x3f3805[_0x7eba('0x19')]]&&(this['voiceQueues'][_0x3f3805['queue']]['acw']||this[_0x7eba('0x6')][_0x3f3805[_0x7eba('0x19')]][_0x7eba('0x1b')])){if(this[_0x7eba('0x7')][_0x3f3805[_0x7eba('0x18')]]){this[_0x7eba('0x9')][_0x3f3805[_0x7eba('0x2a')]]={'queue':_0x3f3805[_0x7eba('0x19')],'interface':_0x3f3805[_0x7eba('0x18')]};}}}catch(_0x4ac004){logger['error'](_0x7eba('0x38'),_0x4ac004[_0x7eba('0x39')]);}};Acw[_0x7eba('0x16')][_0x7eba('0x3a')]=function(_0x28d23c){try{if(this[_0x7eba('0x9')][_0x28d23c['uniqueid']]&&_[_0x7eba('0x3b')](this['channels'][_0x28d23c[_0x7eba('0x2a')]][_0x7eba('0x22')])){logger['info'](_0x7eba('0x3c'),_0x28d23c[_0x7eba('0x2a')]);this['startAcw'](_0x28d23c['uniqueid']);}else if(this[_0x7eba('0x9')][_0x28d23c[_0x7eba('0x3d')]]&&_[_0x7eba('0x3b')](this[_0x7eba('0x9')][_0x28d23c['linkedid']]['attended'])){logger[_0x7eba('0x20')](_0x7eba('0x3e'),_0x28d23c[_0x7eba('0x3d')]);this[_0x7eba('0x17')](_0x28d23c[_0x7eba('0x3d')]);}}catch(_0x44c7bb){logger['error']('[ACW][syncHangupRequest]\x20%s',_0x44c7bb[_0x7eba('0x39')]);}};Acw['prototype'][_0x7eba('0xd')]=function(_0x309138){try{if(this[_0x7eba('0x9')][_0x309138[_0x7eba('0x2a')]]&&this[_0x7eba('0x9')][_0x309138[_0x7eba('0x2a')]][_0x7eba('0x22')]){logger[_0x7eba('0x20')](_0x7eba('0x3f'),_0x309138[_0x7eba('0x2a')]);this[_0x7eba('0x17')](_0x309138['uniqueid']);}else if(this[_0x7eba('0x9')][_0x309138[_0x7eba('0x3d')]]&&this[_0x7eba('0x9')][_0x309138[_0x7eba('0x3d')]][_0x7eba('0x22')]){logger[_0x7eba('0x20')](_0x7eba('0x40'),_0x309138['linkedid']);this[_0x7eba('0x17')](_0x309138[_0x7eba('0x3d')]);}}catch(_0x1fe752){logger[_0x7eba('0x2e')](_0x7eba('0x41'),_0x1fe752['message']);}};Acw[_0x7eba('0x16')][_0x7eba('0x10')]=function(_0x591a4a){try{if(!_[_0x7eba('0x42')](this[_0x7eba('0x9')][_0x591a4a[_0x7eba('0x43')]])){this[_0x7eba('0x17')](_0x591a4a[_0x7eba('0x43')]);if(this[_0x7eba('0x9')][_0x591a4a[_0x7eba('0x44')]]){this['channels'][_0x591a4a['secondtransfereruniqueid']][_0x7eba('0x22')]=!![];this['channels'][_0x591a4a['transfertargetuniqueid']]=this[_0x7eba('0x9')][_0x591a4a[_0x7eba('0x44')]];delete this[_0x7eba('0x9')][_0x591a4a[_0x7eba('0x44')]];}}else if(!_[_0x7eba('0x42')](this[_0x7eba('0x9')][_0x591a4a[_0x7eba('0x45')]])){this['startAcw'](_0x591a4a['transfertargetuniqueid']);if(this[_0x7eba('0x9')][_0x591a4a[_0x7eba('0x46')]]){this['channels'][_0x591a4a[_0x7eba('0x46')]][_0x7eba('0x22')]=!![];this[_0x7eba('0x9')][_0x591a4a[_0x7eba('0x43')]]=this[_0x7eba('0x9')][_0x591a4a[_0x7eba('0x46')]];delete this['channels'][_0x591a4a[_0x7eba('0x46')]];}}}catch(_0x13aac8){logger[_0x7eba('0x2e')](_0x7eba('0x47'),_0x13aac8[_0x7eba('0x39')]);}};Acw[_0x7eba('0x16')][_0x7eba('0x12')]=function(_0x387b07){try{if(this[_0x7eba('0x9')][_0x387b07[_0x7eba('0x48')]]){logger[_0x7eba('0x20')](_0x7eba('0x49'),JSON[_0x7eba('0x36')](_0x387b07[_0x7eba('0x48')]));this[_0x7eba('0x17')](_0x387b07[_0x7eba('0x48')]);}else if(this['channels'][_0x387b07[_0x7eba('0x4a')]]){logger[_0x7eba('0x20')](_0x7eba('0x4b'),JSON[_0x7eba('0x36')](_0x387b07['transfererlinkedid']));this['startAcw'](_0x387b07[_0x7eba('0x4a')]);}}catch(_0x1bf46b){logger[_0x7eba('0x2e')](_0x7eba('0x4c'),_0x1bf46b[_0x7eba('0x39')]);}};Acw[_0x7eba('0x16')][_0x7eba('0xe')]=function(_0x5cd812){try{if(this['voiceQueues'][_0x5cd812[_0x7eba('0x19')]]&&this['voiceQueues'][_0x5cd812['queue']][_0x7eba('0x4d')]===_0x7eba('0x4e')){if(this[_0x7eba('0x7')][_0x5cd812[_0x7eba('0x18')]]){logger[_0x7eba('0x20')](_0x7eba('0x4f'),_0x5cd812['uniqueid'],_0x5cd812[_0x7eba('0x18')],_0x5cd812['queue']);return RpcUser[_0x7eba('0x24')](this[_0x7eba('0x7')][_0x5cd812[_0x7eba('0x18')]],_0x7eba('0x50'),_0x5cd812[_0x7eba('0x2a')]);}}}catch(_0xd5b412){logger[_0x7eba('0x2e')](_0x7eba('0x51'),_0xd5b412[_0x7eba('0x39')]);}};module[_0x7eba('0x52')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 094642f..5033bd7 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 _0x3f41=['shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','log','util','../../config/logger','asterisk','port','password','keepConnected','Action','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close'];(function(_0x4e0026,_0x2b52b6){var _0x3f8ee7=function(_0x31d891){while(--_0x31d891){_0x4e0026['push'](_0x4e0026['shift']());}};_0x3f8ee7(++_0x2b52b6);}(_0x3f41,0x117));var _0x13f4=function(_0x2afbb0,_0x44f16d){_0x2afbb0=_0x2afbb0-0x0;var _0x411ff2=_0x3f41[_0x2afbb0];return _0x411ff2;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var moment=require('moment');var util=require(_0x13f4('0x0'));var _=require('lodash');var logger=require(_0x13f4('0x1'))('ami');var config=require('../../config/environment');var ami=new Manager(config[_0x13f4('0x2')][_0x13f4('0x3')],config[_0x13f4('0x2')]['ip'],config[_0x13f4('0x2')]['username'],config[_0x13f4('0x2')][_0x13f4('0x4')],!![]);ami[_0x13f4('0x5')]();ami[_0x13f4('0x6')]=BPromise['promisify'](ami[_0x13f4('0x7')]);function error(_0x3d9f35){logger['error'](util[_0x13f4('0x8')](_0x13f4('0x9'),config[_0x13f4('0x2')][_0x13f4('0xa')],config[_0x13f4('0x2')]['ip'],config[_0x13f4('0x2')][_0x13f4('0x3')],util[_0x13f4('0xb')](_0x3d9f35,![],null)));}function close(){logger[_0x13f4('0xc')](util[_0x13f4('0x8')](_0x13f4('0xd'),config[_0x13f4('0x2')][_0x13f4('0xa')],config[_0x13f4('0x2')]['ip'],config[_0x13f4('0x2')][_0x13f4('0x3')]));}ami[_0x13f4('0xe')]=function(){return function(){return ami['Action']({'action':_0x13f4('0xf')});};};ami[_0x13f4('0x10')]=function(){return function(){return ami['Action']({'action':_0x13f4('0x11')});};};ami[_0x13f4('0x12')]=function(){return function(){return ami[_0x13f4('0x6')]({'action':'sippeerstatus'});};};ami[_0x13f4('0x13')]=function(){return function(){return ami['Action']({'action':_0x13f4('0x14')});};};ami[_0x13f4('0x15')]=function(){return function(){return ami[_0x13f4('0x6')]({'action':_0x13f4('0x16')});};};function connect(_0x2a01a1){logger[_0x13f4('0x17')](util[_0x13f4('0x8')](_0x13f4('0x18'),config[_0x13f4('0x2')][_0x13f4('0xa')],config[_0x13f4('0x2')]['ip'],config[_0x13f4('0x2')][_0x13f4('0x3')]));ami['once'](_0x13f4('0xc'),error);ami[_0x13f4('0x19')](_0x13f4('0x1a'),close);}ami['on']('connect',connect);ami['on'](_0x13f4('0x1b'),function(_0x4e05ff){logger[_0x13f4('0x17')](util[_0x13f4('0x8')](_0x13f4('0x1c'),config[_0x13f4('0x2')][_0x13f4('0xa')],config[_0x13f4('0x2')]['ip'],config[_0x13f4('0x2')][_0x13f4('0x3')],util[_0x13f4('0xb')](_0x4e05ff,![],null)));});ami['on'](_0x13f4('0x1d'),function(_0x2cde19){logger[_0x13f4('0x17')](util[_0x13f4('0x8')](_0x13f4('0x1e'),config[_0x13f4('0x2')][_0x13f4('0xa')],config[_0x13f4('0x2')]['ip'],config['asterisk'][_0x13f4('0x3')]));return BPromise[_0x13f4('0x1f')]()[_0x13f4('0x20')](ami[_0x13f4('0xe')]())['then'](ami['actionDeviceStateList']())[_0x13f4('0x20')](ami[_0x13f4('0x12')]())['then'](ami['actionQueueSummary']())[_0x13f4('0x20')](ami[_0x13f4('0x15')]())['catch'](function(_0x1c5405){console[_0x13f4('0x21')](_0x1c5405);});});ami[_0x13f4('0x19')](_0x13f4('0xc'),error);ami[_0x13f4('0x19')](_0x13f4('0x1a'),close);module['exports']=ami; \ No newline at end of file +var _0x8231=['bluebird','moment','util','../../config/logger','asterisk','port','username','password','Action','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','format','devicestatelist','actionSipPeerStatus','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','actionQueueSummary','catch','log','exports'];(function(_0x2d75ad,_0x5d8d47){var _0x387c23=function(_0x3494aa){while(--_0x3494aa){_0x2d75ad['push'](_0x2d75ad['shift']());}};_0x387c23(++_0x5d8d47);}(_0x8231,0x1a0));var _0x1823=function(_0xe0077f,_0x1c7c09){_0xe0077f=_0xe0077f-0x0;var _0x11d48a=_0x8231[_0xe0077f];return _0x11d48a;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x1823('0x0'));var moment=require(_0x1823('0x1'));var util=require(_0x1823('0x2'));var _=require('lodash');var logger=require(_0x1823('0x3'))('ami');var config=require('../../config/environment');var ami=new Manager(config[_0x1823('0x4')][_0x1823('0x5')],config[_0x1823('0x4')]['ip'],config[_0x1823('0x4')][_0x1823('0x6')],config[_0x1823('0x4')][_0x1823('0x7')],!![]);ami['keepConnected']();ami[_0x1823('0x8')]=BPromise['promisify'](ami[_0x1823('0x9')]);function error(_0x398221){logger[_0x1823('0xa')](util['format'](_0x1823('0xb'),config['asterisk']['username'],config['asterisk']['ip'],config[_0x1823('0x4')][_0x1823('0x5')],util['inspect'](_0x398221,![],null)));}function close(){logger['error'](util[_0x1823('0xc')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0x1823('0x6')],config['asterisk']['ip'],config[_0x1823('0x4')][_0x1823('0x5')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x1823('0x8')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x1823('0x8')]({'action':_0x1823('0xd')});};};ami[_0x1823('0xe')]=function(){return function(){return ami[_0x1823('0x8')]({'action':'sippeerstatus'});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x1823('0x8')]({'action':'queuesummary'});};};ami[_0x1823('0xf')]=function(){return function(){return ami['Action']({'action':_0x1823('0x10')});};};function connect(_0x5a6859){logger[_0x1823('0x11')](util[_0x1823('0xc')](_0x1823('0x12'),config[_0x1823('0x4')][_0x1823('0x6')],config[_0x1823('0x4')]['ip'],config[_0x1823('0x4')]['port']));ami[_0x1823('0x13')](_0x1823('0xa'),error);ami[_0x1823('0x13')](_0x1823('0x14'),close);}ami['on'](_0x1823('0x15'),connect);ami['on']('shutdown',function(_0x6a33a7){logger['info'](util[_0x1823('0xc')](_0x1823('0x16'),config[_0x1823('0x4')][_0x1823('0x6')],config['asterisk']['ip'],config['asterisk'][_0x1823('0x5')],util[_0x1823('0x17')](_0x6a33a7,![],null)));});ami['on']('fullybooted',function(_0x11c3ec){logger['info'](util[_0x1823('0xc')](_0x1823('0x18'),config[_0x1823('0x4')][_0x1823('0x6')],config[_0x1823('0x4')]['ip'],config['asterisk'][_0x1823('0x5')]));return BPromise[_0x1823('0x19')]()[_0x1823('0x1a')](ami['actionSipShowRegistry']())[_0x1823('0x1a')](ami[_0x1823('0x1b')]())[_0x1823('0x1a')](ami['actionSipPeerStatus']())[_0x1823('0x1a')](ami[_0x1823('0x1c')]())[_0x1823('0x1a')](ami[_0x1823('0xf')]())[_0x1823('0x1d')](function(_0x31e8e6){console[_0x1823('0x1e')](_0x31e8e6);});});ami['once'](_0x1823('0xa'),error);ami[_0x1823('0x13')](_0x1823('0x14'),close);module[_0x1823('0x1f')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 3520778..430ffaa 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 _0xda3f=['then','rpc','memberReport','error','message','result','catch','exports','bluebird','../../config/logger','Request','request'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xda3f,0xec));var _0xfda3=function(_0x346180,_0xc63f21){_0x346180=_0x346180-0x0;var _0x4f75b0=_0xda3f[_0x346180];return _0x4f75b0;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('ami');var client=jayson['client']['http']({'port':0x2329});client[_0xfda3('0x2')]=function(_0x581693,_0x36dc71){return new BPromise(function(_0x22187d,_0x516500){return client[_0xfda3('0x3')](_0x581693,_0x36dc71)[_0xfda3('0x4')](function(_0x47e7e2){logger['debug'](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x36dc71,_0x47e7e2);if(_0x47e7e2[_0xfda3('0x7')]){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')],_0x36dc71);return _0x516500(_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')]);}else{return _0x22187d(_0x47e7e2[_0xfda3('0x9')]);}})[_0xfda3('0xa')](function(_0x4d7841){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x4d7841,_0x36dc71);return _0x516500(_0x4d7841);});});};module[_0xfda3('0xb')]=client; \ No newline at end of file +var _0xcb91=['request','debug','memberReport','error','rpc','message','result','catch','exports','../../config/logger','ami','client','http'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3fe042,_0x1106f7){_0x3fe042=_0x3fe042-0x0;var _0x7d4a1f=_0xcb91[_0x3fe042];return _0x7d4a1f;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var client=jayson[_0x1cb9('0x2')][_0x1cb9('0x3')]({'port':0x2329});client['Request']=function(_0x8c392f,_0x2c17b8){return new BPromise(function(_0x545a34,_0x13d5fd){return client[_0x1cb9('0x4')](_0x8c392f,_0x2c17b8)['then'](function(_0x226b69){logger[_0x1cb9('0x5')]('rpc',_0x1cb9('0x6'),_0x8c392f,_0x2c17b8,_0x226b69);if(_0x226b69[_0x1cb9('0x7')]){logger['error'](_0x1cb9('0x8'),'memberReport',_0x8c392f,_0x226b69['error'][_0x1cb9('0x9')],_0x2c17b8);return _0x13d5fd(_0x226b69[_0x1cb9('0x7')][_0x1cb9('0x9')]);}else{return _0x545a34(_0x226b69[_0x1cb9('0xa')]);}})[_0x1cb9('0xb')](function(_0x50ce71){logger[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x1cb9('0x6'),_0x8c392f,_0x50ce71,_0x2c17b8);return _0x13d5fd(_0x50ce71);});});};module[_0x1cb9('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 83dac4c..d6bf8c6 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 _0x80cb=['callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','format','substring','dialCutDigit','prototype','getQueue','exports','lodash','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x80cb,0x133));var _0xb80c=function(_0x26d018,_0xedb83d){_0x26d018=_0x26d018-0x0;var _0x296c00=_0x80cb[_0x26d018];return _0x296c00;};'use strict';var util=require('util');var _=require(_0xb80c('0x0'));var moment=require('moment');function checkNameSurname(_0x22e14d,_0x5b407e,_0x438724){var _0x563e9c='';if(!_[_0xb80c('0x1')](_0x5b407e)&&'string'===typeof _0x5b407e){_0x563e9c+=_0x5b407e;}if(!_['isNil'](_0x438724)&&_0xb80c('0x2')===typeof _0x438724){_0x563e9c+='\x20'+_0x438724;}if(_0x563e9c!==''){return _0x563e9c;}return _0x22e14d;}function Action(_0x418107,_0x4ba16d,_0x501f0c){this[_0xb80c('0x3')]=_0x418107;this[_0xb80c('0x4')]=_0x501f0c||undefined;this[_0xb80c('0x5')]=checkNameSurname(_0x4ba16d[_0xb80c('0x6')][_0xb80c('0x7')],_0x4ba16d[_0xb80c('0x6')][_0xb80c('0x8')],_0x4ba16d[_0xb80c('0x6')]['lastName']);this[_0xb80c('0x9')]=_0x4ba16d[_0xb80c('0x6')]['phone'];this[_0xb80c('0xa')]=_0x418107['name'];this[_0xb80c('0xb')]=_0x4ba16d[_0xb80c('0xb')]||![];this['type']=_0x418107[_0xb80c('0xc')];this[_0xb80c('0xd')]=_0x418107[_0xb80c('0xd')]||0x3;this[_0xb80c('0xe')]=_0x4ba16d['scheduledat'];this[_0xb80c('0xf')]=_0x4ba16d['countbusyretry'];this[_0xb80c('0x10')]=_0x4ba16d[_0xb80c('0x10')];this[_0xb80c('0x11')]=_0x4ba16d[_0xb80c('0x11')];this['countnosuchnumberretry']=_0x4ba16d['countnosuchnumberretry'];this[_0xb80c('0x12')]=_0x4ba16d[_0xb80c('0x12')];this['countabandonedretry']=_0x4ba16d[_0xb80c('0x13')];this['countmachineretry']=_0x4ba16d[_0xb80c('0x14')];this['countagentrejectretry']=_0x4ba16d['countagentrejectretry'];this[_0xb80c('0x15')]=_0x4ba16d[_0xb80c('0x15')];this[_0xb80c('0x16')]=_0x4ba16d[_0xb80c('0x16')];this[_0xb80c('0x17')]=_0x4ba16d[_0xb80c('0x17')];this[_0xb80c('0x18')]=_0x4ba16d[_0xb80c('0x18')];this[_0xb80c('0x19')]=_0x4ba16d[_0xb80c('0x19')];this[_0xb80c('0x1a')]=_0x4ba16d['id'];this[_0xb80c('0x1b')]=_0x4ba16d[_0xb80c('0x6')][_0xb80c('0x8')]||'';this['starttime']=moment()['format'](_0xb80c('0x1c'));this[_0xb80c('0x1d')]=_0x4ba16d[_0xb80c('0x1d')];this[_0xb80c('0x1e')]=_0x4ba16d['callbackuniqueid'];this[_0xb80c('0x1f')]=_0x4ba16d[_0xb80c('0x1f')];this[_0xb80c('0x20')]=_0x4ba16d[_0xb80c('0x20')];this[_0xb80c('0x21')]='';this[_0xb80c('0x22')]='';}Action['prototype'][_0xb80c('0x23')]=function(){return util[_0xb80c('0x24')]('\x22%s\x22\x20<%s>',this[_0xb80c('0x5')],this['voiceQueue']['dialCutDigit']>0x0?this[_0xb80c('0x9')][_0xb80c('0x25')](this[_0xb80c('0x3')][_0xb80c('0x26')]):this[_0xb80c('0x9')]);};Action[_0xb80c('0x27')][_0xb80c('0x28')]=function(){return this[_0xb80c('0xa')];};module[_0xb80c('0x29')]=Action; \ No newline at end of file +var _0x8e63=['UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','substring','dialCutDigit','getQueue','exports','util','lodash','moment','isNil','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId'];(function(_0x5d7005,_0x41f35a){var _0x31ed20=function(_0x3624f8){while(--_0x3624f8){_0x5d7005['push'](_0x5d7005['shift']());}};_0x31ed20(++_0x41f35a);}(_0x8e63,0x13f));var _0x38e6=function(_0x83a8ae,_0x2a6550){_0x83a8ae=_0x83a8ae-0x0;var _0x158a60=_0x8e63[_0x83a8ae];return _0x158a60;};'use strict';var util=require(_0x38e6('0x0'));var _=require(_0x38e6('0x1'));var moment=require(_0x38e6('0x2'));function checkNameSurname(_0x4c25b1,_0x10270b,_0x3b9d58){var _0x3aa684='';if(!_[_0x38e6('0x3')](_0x10270b)&&'string'===typeof _0x10270b){_0x3aa684+=_0x10270b;}if(!_[_0x38e6('0x3')](_0x3b9d58)&&'string'===typeof _0x3b9d58){_0x3aa684+='\x20'+_0x3b9d58;}if(_0x3aa684!==''){return _0x3aa684;}return _0x4c25b1;}function Action(_0x4fd8a7,_0x11d206,_0x1faf37){this[_0x38e6('0x4')]=_0x4fd8a7;this[_0x38e6('0x5')]=_0x1faf37||undefined;this[_0x38e6('0x6')]=checkNameSurname(_0x11d206[_0x38e6('0x7')][_0x38e6('0x8')],_0x11d206[_0x38e6('0x7')][_0x38e6('0x9')],_0x11d206['Contact'][_0x38e6('0xa')]);this[_0x38e6('0xb')]=_0x11d206[_0x38e6('0x7')]['phone'];this['queue']=_0x4fd8a7[_0x38e6('0x6')];this['active']=_0x11d206[_0x38e6('0xc')]||![];this[_0x38e6('0xd')]=_0x4fd8a7['type'];this[_0x38e6('0xe')]=_0x4fd8a7['dialQueueTimeout']||0x3;this['scheduledat']=_0x11d206[_0x38e6('0xf')];this[_0x38e6('0x10')]=_0x11d206[_0x38e6('0x10')];this[_0x38e6('0x11')]=_0x11d206[_0x38e6('0x11')];this[_0x38e6('0x12')]=_0x11d206[_0x38e6('0x12')];this[_0x38e6('0x13')]=_0x11d206[_0x38e6('0x13')];this['countdropretry']=_0x11d206['countdropretry'];this[_0x38e6('0x14')]=_0x11d206[_0x38e6('0x14')];this['countmachineretry']=_0x11d206[_0x38e6('0x15')];this[_0x38e6('0x16')]=_0x11d206[_0x38e6('0x16')];this[_0x38e6('0x17')]=_0x11d206[_0x38e6('0x17')];this[_0x38e6('0x18')]=_0x11d206[_0x38e6('0x18')];this[_0x38e6('0x19')]=_0x11d206[_0x38e6('0x19')];this[_0x38e6('0x1a')]=_0x11d206[_0x38e6('0x1a')];this['CampaignId']=_0x11d206[_0x38e6('0x1b')];this[_0x38e6('0x1c')]=_0x11d206['id'];this[_0x38e6('0x1d')]=_0x11d206[_0x38e6('0x7')][_0x38e6('0x9')]||'';this[_0x38e6('0x1e')]=moment()[_0x38e6('0x1f')](_0x38e6('0x20'));this[_0x38e6('0x21')]=_0x11d206['callback'];this[_0x38e6('0x22')]=_0x11d206['callbackuniqueid'];this[_0x38e6('0x23')]=_0x11d206[_0x38e6('0x23')];this[_0x38e6('0x24')]=_0x11d206['recallme'];this[_0x38e6('0x25')]='';this['originatecalleridname']='';}Action[_0x38e6('0x26')]['getCaller']=function(){return util[_0x38e6('0x1f')]('\x22%s\x22\x20<%s>',this[_0x38e6('0x6')],this[_0x38e6('0x4')]['dialCutDigit']>0x0?this[_0x38e6('0xb')][_0x38e6('0x27')](this[_0x38e6('0x4')][_0x38e6('0x28')]):this[_0x38e6('0xb')]);};Action[_0x38e6('0x26')][_0x38e6('0x29')]=function(){return this['queue'];};module[_0x38e6('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 46d4de3..23cedb0 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 _0x73ae=['countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum','number','starttime','responsetime','answertime','endtime','format','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry'];(function(_0x3047c6,_0x58d606){var _0x28dd36=function(_0x60a63e){while(--_0x60a63e){_0x3047c6['push'](_0x3047c6['shift']());}};_0x28dd36(++_0x58d606);}(_0x73ae,0x146));var _0xe73a=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x73ae[_0x102e37];return _0x35a07c;};'use strict';var util=require(_0xe73a('0x0'));var _=require(_0xe73a('0x1'));var moment=require(_0xe73a('0x2'));function getSeconds(_0x590074,_0x385458){var _0x11e5bd=moment(_0x590074)[_0xe73a('0x3')](0x0);var _0x3afb2a=moment(_0x385458)['milliseconds'](0x0);return _0x11e5bd[_0xe73a('0x4')](_0x3afb2a,_0xe73a('0x5'));}function AgentComplete(_0x1c9e2a,_0x369a30){this[_0xe73a('0x6')]=0x4;this[_0xe73a('0x7')]='Answer';this[_0xe73a('0x8')]=_0x1c9e2a[_0xe73a('0x8')];this[_0xe73a('0x9')]=_0x1c9e2a['type'];this[_0xe73a('0xa')]=_0x1c9e2a[_0xe73a('0x9')]===_0xe73a('0xb')?_0xe73a('0xc'):_0x1c9e2a[_0xe73a('0x9')];this[_0xe73a('0xd')]=_0x1c9e2a[_0xe73a('0xd')];this[_0xe73a('0xe')]=_0x1c9e2a[_0xe73a('0xe')];this[_0xe73a('0xf')]=_0x1c9e2a['countnoanswerretry'];this['countglobal']=_0x1c9e2a[_0xe73a('0xd')]+_0x1c9e2a[_0xe73a('0xe')]+_0x1c9e2a[_0xe73a('0xf')]+_0x1c9e2a[_0xe73a('0x10')]+_0x1c9e2a[_0xe73a('0x11')]+_0x1c9e2a[_0xe73a('0x12')]+_0x1c9e2a[_0xe73a('0x13')]+_0x1c9e2a[_0xe73a('0x14')];this[_0xe73a('0x10')]=_0x1c9e2a[_0xe73a('0x10')];this[_0xe73a('0x11')]=_0x1c9e2a[_0xe73a('0x11')];this[_0xe73a('0x12')]=_0x1c9e2a[_0xe73a('0x12')];this[_0xe73a('0x13')]=_0x1c9e2a[_0xe73a('0x13')];this['countagentrejectretry']=_0x1c9e2a['countagentrejectretry'];this[_0xe73a('0x15')]=_0x369a30[_0xe73a('0x15')];this['calleridname']=_0x1c9e2a['name'];this[_0xe73a('0x16')]=_0x1c9e2a[_0xe73a('0x17')];this[_0xe73a('0x18')]=_0x1c9e2a['starttime'];this[_0xe73a('0x19')]=_0x1c9e2a[_0xe73a('0x19')];this[_0xe73a('0x1a')]=_0x1c9e2a[_0xe73a('0x1a')];this[_0xe73a('0x1b')]=moment()[_0xe73a('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=getSeconds(_0x1c9e2a[_0xe73a('0x19')],_0x1c9e2a[_0xe73a('0x18')]);this['holdtime']=getSeconds(_0x1c9e2a[_0xe73a('0x1a')],_0x1c9e2a[_0xe73a('0x19')]);this[_0xe73a('0x1d')]=getSeconds(this[_0xe73a('0x1b')],_0x1c9e2a['answertime']);this[_0xe73a('0xc')]=_0x369a30[_0xe73a('0xc')];this['membername']=_0x369a30[_0xe73a('0x1e')];this[_0xe73a('0x1f')]=_0x369a30[_0xe73a('0x1f')];this[_0xe73a('0x20')]=_0x1c9e2a[_0xe73a('0x20')];this[_0xe73a('0x21')]=_0x1c9e2a[_0xe73a('0x21')];this['callbackat']=_0x1c9e2a[_0xe73a('0x22')];this['recallme']=_0x1c9e2a[_0xe73a('0x23')];this[_0xe73a('0x24')]=_0x1c9e2a['ContactId'];this[_0xe73a('0x25')]=_0x1c9e2a[_0xe73a('0x25')];this[_0xe73a('0x26')]=_0x1c9e2a['UserId'];this[_0xe73a('0x27')]=_0x1c9e2a[_0xe73a('0x27')];this['CampaignId']=_0x1c9e2a[_0xe73a('0x28')];this[_0xe73a('0x29')]=_0x1c9e2a[_0xe73a('0x29')]||'';this[_0xe73a('0x2a')]=_0x1c9e2a[_0xe73a('0x2a')]||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0x4398=['format','YYYY-MM-DD\x20HH:mm:ss','ringtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','seconds','state','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname','number','starttime','responsetime','answertime','endtime'];(function(_0x5bbcb2,_0x4e4ea4){var _0x381d4b=function(_0x4c602f){while(--_0x4c602f){_0x5bbcb2['push'](_0x5bbcb2['shift']());}};_0x381d4b(++_0x4e4ea4);}(_0x4398,0x18b));var _0x8439=function(_0x3847a4,_0x32c68b){_0x3847a4=_0x3847a4-0x0;var _0x4e46ca=_0x4398[_0x3847a4];return _0x4e46ca;};'use strict';var util=require('util');var _=require(_0x8439('0x0'));var moment=require(_0x8439('0x1'));function getSeconds(_0x416871,_0x31e99c){var _0x178c69=moment(_0x416871)['milliseconds'](0x0);var _0x557ce9=moment(_0x31e99c)['milliseconds'](0x0);return _0x178c69['diff'](_0x557ce9,_0x8439('0x2'));}function AgentComplete(_0x4c2120,_0xa25a46){this[_0x8439('0x3')]=0x4;this['statedesc']='Answer';this[_0x8439('0x4')]=_0x4c2120[_0x8439('0x4')];this[_0x8439('0x5')]=_0x4c2120[_0x8439('0x5')];this[_0x8439('0x6')]=_0x4c2120[_0x8439('0x5')]===_0x8439('0x7')?_0x8439('0x8'):_0x4c2120[_0x8439('0x5')];this[_0x8439('0x9')]=_0x4c2120['countbusyretry'];this[_0x8439('0xa')]=_0x4c2120[_0x8439('0xa')];this['countnoanswerretry']=_0x4c2120[_0x8439('0xb')];this[_0x8439('0xc')]=_0x4c2120[_0x8439('0x9')]+_0x4c2120[_0x8439('0xa')]+_0x4c2120[_0x8439('0xb')]+_0x4c2120['countnosuchnumberretry']+_0x4c2120[_0x8439('0xd')]+_0x4c2120[_0x8439('0xe')]+_0x4c2120[_0x8439('0xf')]+_0x4c2120['countagentrejectretry'];this[_0x8439('0x10')]=_0x4c2120[_0x8439('0x10')];this[_0x8439('0xd')]=_0x4c2120[_0x8439('0xd')];this['countabandonedretry']=_0x4c2120[_0x8439('0xe')];this[_0x8439('0xf')]=_0x4c2120[_0x8439('0xf')];this[_0x8439('0x11')]=_0x4c2120[_0x8439('0x11')];this[_0x8439('0x12')]=_0xa25a46['uniqueid'];this[_0x8439('0x13')]=_0x4c2120['name'];this['calleridnum']=_0x4c2120[_0x8439('0x14')];this['starttime']=_0x4c2120[_0x8439('0x15')];this[_0x8439('0x16')]=_0x4c2120[_0x8439('0x16')];this[_0x8439('0x17')]=_0x4c2120[_0x8439('0x17')];this[_0x8439('0x18')]=moment()[_0x8439('0x19')](_0x8439('0x1a'));this[_0x8439('0x1b')]=getSeconds(_0x4c2120[_0x8439('0x16')],_0x4c2120['starttime']);this['holdtime']=getSeconds(_0x4c2120['answertime'],_0x4c2120[_0x8439('0x16')]);this['talktime']=getSeconds(this[_0x8439('0x18')],_0x4c2120[_0x8439('0x17')]);this[_0x8439('0x8')]=_0xa25a46[_0x8439('0x8')];this[_0x8439('0x1c')]=_0xa25a46[_0x8439('0x1c')];this[_0x8439('0x1d')]=_0xa25a46['reason'];this[_0x8439('0x1e')]=_0x4c2120[_0x8439('0x1e')];this[_0x8439('0x1f')]=_0x4c2120[_0x8439('0x1f')];this[_0x8439('0x20')]=_0x4c2120[_0x8439('0x20')];this[_0x8439('0x21')]=_0x4c2120[_0x8439('0x21')];this[_0x8439('0x22')]=_0x4c2120[_0x8439('0x22')];this[_0x8439('0x23')]=_0x4c2120[_0x8439('0x23')];this[_0x8439('0x24')]=_0x4c2120[_0x8439('0x24')];this['VoiceQueueId']=_0x4c2120[_0x8439('0x25')];this[_0x8439('0x26')]=_0x4c2120[_0x8439('0x26')];this['originatecalleridnum']=_0x4c2120[_0x8439('0x27')]||'';this[_0x8439('0x28')]=_0x4c2120[_0x8439('0x28')]||'';}module[_0x8439('0x29')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 16d11bd..f31d53a 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 _0x3937=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countglobal','countcongestionretry','countnosuchnumberretry'];(function(_0x91924,_0x581309){var _0x510e26=function(_0x391166){while(--_0x391166){_0x91924['push'](_0x91924['shift']());}};_0x510e26(++_0x581309);}(_0x3937,0xbf));var _0x7393=function(_0x1edaa9,_0x53b191){_0x1edaa9=_0x1edaa9-0x0;var _0x3b67a4=_0x3937[_0x1edaa9];return _0x3b67a4;};'use strict';var util=require(_0x7393('0x0'));var _=require('lodash');var moment=require(_0x7393('0x1'));function getSeconds(_0x182983,_0x49aa96){var _0x45cd02=moment(_0x182983)['milliseconds'](0x0);var _0x224468=moment(_0x49aa96)['milliseconds'](0x0);return _0x45cd02[_0x7393('0x2')](_0x224468,_0x7393('0x3'));}function Final(_0x20011b){this[_0x7393('0x4')]=_0x20011b[_0x7393('0x4')];this[_0x7393('0x5')]=_0x20011b[_0x7393('0x5')];this[_0x7393('0x6')]=_0x20011b[_0x7393('0x6')];this['campaigntype']=_0x20011b['type']===_0x7393('0x7')?_0x7393('0x8'):_0x20011b[_0x7393('0x6')];this['countbusyretry']=_0x20011b[_0x7393('0x9')];this['countcongestionretry']=_0x20011b['countcongestionretry'];this['countnoanswerretry']=_0x20011b['countnoanswerretry'];this[_0x7393('0xa')]=_0x20011b[_0x7393('0x9')]+_0x20011b[_0x7393('0xb')]+_0x20011b['countnoanswerretry']+_0x20011b[_0x7393('0xc')]+_0x20011b[_0x7393('0xd')]+_0x20011b[_0x7393('0xe')]+_0x20011b[_0x7393('0xf')]+_0x20011b[_0x7393('0x10')];this[_0x7393('0xc')]=_0x20011b[_0x7393('0xc')];this[_0x7393('0xd')]=_0x20011b[_0x7393('0xd')];this['countabandonedretry']=_0x20011b['countabandonedretry'];this[_0x7393('0xf')]=_0x20011b['countmachineretry'];this['countagentrejectretry']=_0x20011b['countagentrejectretry'];this[_0x7393('0x8')]=_0x20011b['queue'];this[_0x7393('0x11')]=_0x20011b[_0x7393('0x11')];this['calleridnum']=_0x20011b[_0x7393('0x12')];this['starttime']=_0x20011b['starttime'];this[_0x7393('0x13')]=_0x20011b[_0x7393('0x13')];this[_0x7393('0x14')]=_0x20011b[_0x7393('0x13')];this[_0x7393('0x15')]=_0x20011b[_0x7393('0x15')]||0x0;this[_0x7393('0x16')]=_0x20011b[_0x7393('0x16')]||0x0;this['talktime']=_0x20011b['talktime']||0x0;this[_0x7393('0x17')]=_0x20011b[_0x7393('0x17')];this[_0x7393('0x18')]=_0x20011b[_0x7393('0x18')];this[_0x7393('0x19')]=_0x20011b['callbackat'];this['recallme']=_0x20011b['recallme'];this[_0x7393('0x1a')]=_0x20011b['ContactId'];this['ListId']=_0x20011b[_0x7393('0x1b')];this[_0x7393('0x1c')]=_0x20011b['UserId'];this[_0x7393('0x1d')]=_0x20011b[_0x7393('0x1d')];this[_0x7393('0x1e')]=_0x20011b[_0x7393('0x1e')];this[_0x7393('0x1f')]=_0x20011b[_0x7393('0x1f')]||'';this[_0x7393('0x20')]=_0x20011b[_0x7393('0x20')]||'';}module[_0x7393('0x21')]=Final; \ No newline at end of file +var _0x814b=['calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname'];(function(_0x4ce27e,_0x1bc883){var _0x241155=function(_0x4cae90){while(--_0x4cae90){_0x4ce27e['push'](_0x4ce27e['shift']());}};_0x241155(++_0x1bc883);}(_0x814b,0x1a2));var _0xb814=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x814b[_0x3305de];return _0x3b5a84;};'use strict';var util=require(_0xb814('0x0'));var _=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));function getSeconds(_0x2f4ece,_0xfbb64b){var _0x477725=moment(_0x2f4ece)['milliseconds'](0x0);var _0x38c21a=moment(_0xfbb64b)[_0xb814('0x3')](0x0);return _0x477725[_0xb814('0x4')](_0x38c21a,_0xb814('0x5'));}function Final(_0x44931c){this[_0xb814('0x6')]=_0x44931c['uniqueid'];this[_0xb814('0x7')]=_0x44931c[_0xb814('0x7')];this['type']=_0x44931c[_0xb814('0x8')];this[_0xb814('0x9')]=_0x44931c[_0xb814('0x8')]===_0xb814('0xa')?_0xb814('0xb'):_0x44931c[_0xb814('0x8')];this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]=_0x44931c[_0xb814('0xd')];this[_0xb814('0xe')]=_0x44931c['countnoanswerretry'];this[_0xb814('0xf')]=_0x44931c['countbusyretry']+_0x44931c[_0xb814('0xd')]+_0x44931c[_0xb814('0xe')]+_0x44931c[_0xb814('0x10')]+_0x44931c[_0xb814('0x11')]+_0x44931c[_0xb814('0x12')]+_0x44931c[_0xb814('0x13')]+_0x44931c[_0xb814('0x14')];this[_0xb814('0x10')]=_0x44931c[_0xb814('0x10')];this[_0xb814('0x11')]=_0x44931c[_0xb814('0x11')];this[_0xb814('0x12')]=_0x44931c[_0xb814('0x12')];this[_0xb814('0x13')]=_0x44931c[_0xb814('0x13')];this[_0xb814('0x14')]=_0x44931c[_0xb814('0x14')];this[_0xb814('0xb')]=_0x44931c[_0xb814('0xb')];this[_0xb814('0x15')]=_0x44931c[_0xb814('0x15')];this['calleridnum']=_0x44931c[_0xb814('0x16')];this['starttime']=_0x44931c[_0xb814('0x17')];this[_0xb814('0x18')]=_0x44931c['responsetime'];this['endtime']=_0x44931c['responsetime'];this[_0xb814('0x19')]=_0x44931c['ringtime']||0x0;this['holdtime']=_0x44931c[_0xb814('0x1a')]||0x0;this[_0xb814('0x1b')]=_0x44931c[_0xb814('0x1b')]||0x0;this['callback']=_0x44931c[_0xb814('0x1c')];this['callbackuniqueid']=_0x44931c[_0xb814('0x1d')];this[_0xb814('0x1e')]=_0x44931c[_0xb814('0x1e')];this[_0xb814('0x1f')]=_0x44931c[_0xb814('0x1f')];this[_0xb814('0x20')]=_0x44931c[_0xb814('0x20')];this['ListId']=_0x44931c[_0xb814('0x21')];this['UserId']=_0x44931c[_0xb814('0x22')];this[_0xb814('0x23')]=_0x44931c[_0xb814('0x23')];this[_0xb814('0x24')]=_0x44931c[_0xb814('0x24')];this[_0xb814('0x25')]=_0x44931c[_0xb814('0x25')]||'';this['originatecalleridname']=_0x44931c[_0xb814('0x26')]||'';}module[_0xb814('0x27')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 87ba0a8..c38fdd5 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 _0x5e20=['YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','lodash','moment','milliseconds','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime'];(function(_0x5bdfac,_0x4a76ae){var _0x53a288=function(_0xfb0672){while(--_0xfb0672){_0x5bdfac['push'](_0x5bdfac['shift']());}};_0x53a288(++_0x4a76ae);}(_0x5e20,0xe2));var _0x05e2=function(_0x31c205,_0x1236ca){_0x31c205=_0x31c205-0x0;var _0x5ece7e=_0x5e20[_0x31c205];return _0x5ece7e;};'use strict';var util=require('util');var _=require(_0x05e2('0x0'));var moment=require(_0x05e2('0x1'));function getSeconds(_0x2bd255,_0x4f94cf){var _0x544a04=moment(_0x2bd255)[_0x05e2('0x2')](0x0);var _0x2db8ba=moment(_0x4f94cf)['milliseconds'](0x0);return _0x544a04['diff'](_0x2db8ba,'seconds');}function Hangup(_0x196ebb,_0x3482c8){this[_0x05e2('0x3')]=0x4;this[_0x05e2('0x4')]='Answer';this[_0x05e2('0x5')]=_0x196ebb['scheduledat'];this[_0x05e2('0x6')]=_0x196ebb[_0x05e2('0x6')];this[_0x05e2('0x7')]=_0x196ebb[_0x05e2('0x6')]===_0x05e2('0x8')?_0x05e2('0x9'):_0x196ebb[_0x05e2('0x6')];this[_0x05e2('0xa')]=_0x196ebb[_0x05e2('0xa')];this[_0x05e2('0xb')]=_0x196ebb[_0x05e2('0xb')];this[_0x05e2('0xc')]=_0x196ebb[_0x05e2('0xc')];this[_0x05e2('0xd')]=_0x196ebb[_0x05e2('0xa')]+_0x196ebb[_0x05e2('0xb')]+_0x196ebb[_0x05e2('0xc')]+_0x196ebb[_0x05e2('0xe')]+_0x196ebb[_0x05e2('0xf')]+_0x196ebb['countabandonedretry']+_0x196ebb[_0x05e2('0x10')]+_0x196ebb[_0x05e2('0x11')];this[_0x05e2('0xe')]=_0x196ebb['countnosuchnumberretry'];this['countdropretry']=_0x196ebb[_0x05e2('0xf')];this[_0x05e2('0x12')]=_0x196ebb[_0x05e2('0x12')];this[_0x05e2('0x10')]=_0x196ebb[_0x05e2('0x10')];this[_0x05e2('0x11')]=_0x196ebb[_0x05e2('0x11')];this[_0x05e2('0x13')]=_0x3482c8[_0x05e2('0x13')];this[_0x05e2('0x14')]=_0x196ebb[_0x05e2('0x15')];this[_0x05e2('0x16')]=_0x196ebb['number'];this[_0x05e2('0x17')]=_0x196ebb['starttime'];this[_0x05e2('0x18')]=_0x196ebb['responsetime'];this[_0x05e2('0x19')]=moment()['format'](_0x05e2('0x1a'));this[_0x05e2('0x1b')]=getSeconds(_0x196ebb[_0x05e2('0x18')],_0x196ebb['starttime']);this[_0x05e2('0x1c')]=0x0;this['talktime']=getSeconds(this[_0x05e2('0x19')],_0x196ebb[_0x05e2('0x18')]);this[_0x05e2('0x9')]=_0x196ebb[_0x05e2('0x9')];this[_0x05e2('0x1d')]=_0x05e2('0x1e');this[_0x05e2('0x1f')]=_0x3482c8['cause-txt'];this[_0x05e2('0x20')]=_0x196ebb['callback'];this[_0x05e2('0x21')]=_0x196ebb[_0x05e2('0x21')];this[_0x05e2('0x22')]=_0x196ebb[_0x05e2('0x22')];this[_0x05e2('0x23')]=_0x196ebb[_0x05e2('0x23')];this[_0x05e2('0x24')]=_0x196ebb['ContactId'];this[_0x05e2('0x25')]=_0x196ebb[_0x05e2('0x25')];this[_0x05e2('0x26')]=_0x196ebb[_0x05e2('0x26')];this[_0x05e2('0x27')]=_0x196ebb['VoiceQueueId'];this['CampaignId']=_0x196ebb[_0x05e2('0x28')];}module[_0x05e2('0x29')]=Hangup; \ No newline at end of file +var _0x64e1=['type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','lodash','milliseconds','diff','seconds','state','statedesc','scheduledat'];(function(_0x4af376,_0x22c5c0){var _0x17f4c6=function(_0xa3de50){while(--_0xa3de50){_0x4af376['push'](_0x4af376['shift']());}};_0x17f4c6(++_0x22c5c0);}(_0x64e1,0x151));var _0x164e=function(_0x3c1387,_0x398d79){_0x3c1387=_0x3c1387-0x0;var _0x357f3d=_0x64e1[_0x3c1387];return _0x357f3d;};'use strict';var util=require('util');var _=require(_0x164e('0x0'));var moment=require('moment');function getSeconds(_0x372f32,_0x5727b4){var _0x510eeb=moment(_0x372f32)['milliseconds'](0x0);var _0x2ba4a6=moment(_0x5727b4)[_0x164e('0x1')](0x0);return _0x510eeb[_0x164e('0x2')](_0x2ba4a6,_0x164e('0x3'));}function Hangup(_0x3cfa79,_0x2eabed){this[_0x164e('0x4')]=0x4;this[_0x164e('0x5')]='Answer';this[_0x164e('0x6')]=_0x3cfa79[_0x164e('0x6')];this[_0x164e('0x7')]=_0x3cfa79['type'];this[_0x164e('0x8')]=_0x3cfa79[_0x164e('0x7')]===_0x164e('0x9')?_0x164e('0xa'):_0x3cfa79[_0x164e('0x7')];this[_0x164e('0xb')]=_0x3cfa79[_0x164e('0xb')];this[_0x164e('0xc')]=_0x3cfa79[_0x164e('0xc')];this[_0x164e('0xd')]=_0x3cfa79[_0x164e('0xd')];this[_0x164e('0xe')]=_0x3cfa79['countbusyretry']+_0x3cfa79[_0x164e('0xc')]+_0x3cfa79[_0x164e('0xd')]+_0x3cfa79[_0x164e('0xf')]+_0x3cfa79[_0x164e('0x10')]+_0x3cfa79[_0x164e('0x11')]+_0x3cfa79[_0x164e('0x12')]+_0x3cfa79[_0x164e('0x13')];this[_0x164e('0xf')]=_0x3cfa79[_0x164e('0xf')];this['countdropretry']=_0x3cfa79['countdropretry'];this['countabandonedretry']=_0x3cfa79['countabandonedretry'];this['countmachineretry']=_0x3cfa79['countmachineretry'];this['countagentrejectretry']=_0x3cfa79['countagentrejectretry'];this[_0x164e('0x14')]=_0x2eabed[_0x164e('0x14')];this[_0x164e('0x15')]=_0x3cfa79[_0x164e('0x16')];this['calleridnum']=_0x3cfa79[_0x164e('0x17')];this[_0x164e('0x18')]=_0x3cfa79['starttime'];this[_0x164e('0x19')]=_0x3cfa79[_0x164e('0x19')];this[_0x164e('0x1a')]=moment()[_0x164e('0x1b')](_0x164e('0x1c'));this[_0x164e('0x1d')]=getSeconds(_0x3cfa79['responsetime'],_0x3cfa79[_0x164e('0x18')]);this[_0x164e('0x1e')]=0x0;this[_0x164e('0x1f')]=getSeconds(this[_0x164e('0x1a')],_0x3cfa79[_0x164e('0x19')]);this[_0x164e('0xa')]=_0x3cfa79['queue'];this[_0x164e('0x20')]='IVR';this[_0x164e('0x21')]=_0x2eabed[_0x164e('0x22')];this['callback']=_0x3cfa79[_0x164e('0x23')];this['callbackuniqueid']=_0x3cfa79[_0x164e('0x24')];this[_0x164e('0x25')]=_0x3cfa79[_0x164e('0x25')];this[_0x164e('0x26')]=_0x3cfa79[_0x164e('0x26')];this[_0x164e('0x27')]=_0x3cfa79[_0x164e('0x27')];this[_0x164e('0x28')]=_0x3cfa79[_0x164e('0x28')];this[_0x164e('0x29')]=_0x3cfa79['UserId'];this['VoiceQueueId']=_0x3cfa79['VoiceQueueId'];this[_0x164e('0x2a')]=_0x3cfa79[_0x164e('0x2a')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 5717844..99e31e6 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 _0x1f15=['endtime','ringtime','holdtime','talktime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','starttime','responsetime'];(function(_0x34ca82,_0x45d704){var _0x4711a8=function(_0x3e1448){while(--_0x3e1448){_0x34ca82['push'](_0x34ca82['shift']());}};_0x4711a8(++_0x45d704);}(_0x1f15,0xe6));var _0x51f1=function(_0x392951,_0xa1413e){_0x392951=_0x392951-0x0;var _0x482a16=_0x1f15[_0x392951];return _0x482a16;};'use strict';var util=require(_0x51f1('0x0'));var _=require(_0x51f1('0x1'));var moment=require('moment');function getSeconds(_0x4c3041,_0x501d8f){var _0x5431f8=moment(_0x4c3041)[_0x51f1('0x2')](0x0);var _0x21a799=moment(_0x501d8f)[_0x51f1('0x2')](0x0);return _0x5431f8[_0x51f1('0x3')](_0x21a799,_0x51f1('0x4'));}function History(_0x5e1507){this[_0x51f1('0x5')]=_0x5e1507[_0x51f1('0x5')];this['scheduledat']=_0x5e1507[_0x51f1('0x6')]||undefined;this['type']=_0x5e1507[_0x51f1('0x7')];this[_0x51f1('0x8')]=_0x5e1507[_0x51f1('0x7')]===_0x51f1('0x9')?_0x51f1('0xa'):_0x5e1507['type'];this[_0x51f1('0xb')]=_0x5e1507[_0x51f1('0xb')];this[_0x51f1('0xc')]=_0x5e1507['countcongestionretry'];this['countnoanswerretry']=_0x5e1507[_0x51f1('0xd')];this[_0x51f1('0xe')]=_0x5e1507[_0x51f1('0xb')]+_0x5e1507[_0x51f1('0xc')]+_0x5e1507[_0x51f1('0xd')]+_0x5e1507['countnosuchnumberretry']+_0x5e1507[_0x51f1('0xf')]+_0x5e1507[_0x51f1('0x10')]+_0x5e1507[_0x51f1('0x11')]+_0x5e1507[_0x51f1('0x12')];this[_0x51f1('0x13')]=_0x5e1507[_0x51f1('0x13')];this['countdropretry']=_0x5e1507[_0x51f1('0xf')];this[_0x51f1('0x10')]=_0x5e1507['countabandonedretry'];this[_0x51f1('0x11')]=_0x5e1507[_0x51f1('0x11')];this[_0x51f1('0x12')]=_0x5e1507['countagentrejectretry'];this['queue']=_0x5e1507[_0x51f1('0xa')];this['calleridname']=_0x5e1507['name'];this['calleridnum']=_0x5e1507['number'];this[_0x51f1('0x14')]=_0x5e1507[_0x51f1('0x14')];this['responsetime']=_0x5e1507[_0x51f1('0x15')];this[_0x51f1('0x16')]=_0x5e1507[_0x51f1('0x15')];this[_0x51f1('0x17')]=getSeconds(_0x5e1507['responsetime'],_0x5e1507[_0x51f1('0x14')]);this[_0x51f1('0x18')]=0x0;this[_0x51f1('0x19')]=0x0;this[_0x51f1('0x1a')]=_0x5e1507['callback'];this['callbackuniqueid']=_0x5e1507['callbackuniqueid'];this[_0x51f1('0x1b')]=_0x5e1507[_0x51f1('0x1b')];this[_0x51f1('0x1c')]=_0x5e1507[_0x51f1('0x1c')];this[_0x51f1('0x1d')]=_0x5e1507['ContactId'];this[_0x51f1('0x1e')]=_0x5e1507['ListId'];this[_0x51f1('0x1f')]=_0x5e1507[_0x51f1('0x1f')];this[_0x51f1('0x20')]=_0x5e1507[_0x51f1('0x20')];this[_0x51f1('0x21')]=_0x5e1507[_0x51f1('0x21')];this[_0x51f1('0x22')]=_0x5e1507[_0x51f1('0x22')]||'';this[_0x51f1('0x23')]=_0x5e1507[_0x51f1('0x23')]||'';}module['exports']=History; \ No newline at end of file +var _0xcd4b=['starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','name','calleridnum','number'];(function(_0x8337c6,_0xaaf914){var _0x7ca4d6=function(_0x42c13e){while(--_0x42c13e){_0x8337c6['push'](_0x8337c6['shift']());}};_0x7ca4d6(++_0xaaf914);}(_0xcd4b,0x1a7));var _0xbcd4=function(_0x239ea0,_0x573983){_0x239ea0=_0x239ea0-0x0;var _0x25a3eb=_0xcd4b[_0x239ea0];return _0x25a3eb;};'use strict';var util=require('util');var _=require(_0xbcd4('0x0'));var moment=require(_0xbcd4('0x1'));function getSeconds(_0x509d8c,_0x536144){var _0x28eae4=moment(_0x509d8c)[_0xbcd4('0x2')](0x0);var _0x4f6245=moment(_0x536144)[_0xbcd4('0x2')](0x0);return _0x28eae4['diff'](_0x4f6245,'seconds');}function History(_0x50b3f5){this[_0xbcd4('0x3')]=_0x50b3f5['uniqueid'];this['scheduledat']=_0x50b3f5[_0xbcd4('0x4')]||undefined;this[_0xbcd4('0x5')]=_0x50b3f5['type'];this[_0xbcd4('0x6')]=_0x50b3f5[_0xbcd4('0x5')]===_0xbcd4('0x7')?_0xbcd4('0x8'):_0x50b3f5['type'];this[_0xbcd4('0x9')]=_0x50b3f5[_0xbcd4('0x9')];this['countcongestionretry']=_0x50b3f5['countcongestionretry'];this[_0xbcd4('0xa')]=_0x50b3f5[_0xbcd4('0xa')];this[_0xbcd4('0xb')]=_0x50b3f5[_0xbcd4('0x9')]+_0x50b3f5[_0xbcd4('0xc')]+_0x50b3f5[_0xbcd4('0xa')]+_0x50b3f5[_0xbcd4('0xd')]+_0x50b3f5[_0xbcd4('0xe')]+_0x50b3f5['countabandonedretry']+_0x50b3f5[_0xbcd4('0xf')]+_0x50b3f5[_0xbcd4('0x10')];this[_0xbcd4('0xd')]=_0x50b3f5[_0xbcd4('0xd')];this[_0xbcd4('0xe')]=_0x50b3f5[_0xbcd4('0xe')];this['countabandonedretry']=_0x50b3f5[_0xbcd4('0x11')];this[_0xbcd4('0xf')]=_0x50b3f5[_0xbcd4('0xf')];this['countagentrejectretry']=_0x50b3f5['countagentrejectretry'];this[_0xbcd4('0x8')]=_0x50b3f5[_0xbcd4('0x8')];this['calleridname']=_0x50b3f5[_0xbcd4('0x12')];this[_0xbcd4('0x13')]=_0x50b3f5[_0xbcd4('0x14')];this[_0xbcd4('0x15')]=_0x50b3f5['starttime'];this[_0xbcd4('0x16')]=_0x50b3f5[_0xbcd4('0x16')];this[_0xbcd4('0x17')]=_0x50b3f5['responsetime'];this[_0xbcd4('0x18')]=getSeconds(_0x50b3f5['responsetime'],_0x50b3f5[_0xbcd4('0x15')]);this[_0xbcd4('0x19')]=0x0;this[_0xbcd4('0x1a')]=0x0;this['callback']=_0x50b3f5[_0xbcd4('0x1b')];this[_0xbcd4('0x1c')]=_0x50b3f5[_0xbcd4('0x1c')];this[_0xbcd4('0x1d')]=_0x50b3f5[_0xbcd4('0x1d')];this[_0xbcd4('0x1e')]=_0x50b3f5[_0xbcd4('0x1e')];this['ContactId']=_0x50b3f5[_0xbcd4('0x1f')];this[_0xbcd4('0x20')]=_0x50b3f5[_0xbcd4('0x20')];this['UserId']=_0x50b3f5['UserId'];this[_0xbcd4('0x21')]=_0x50b3f5[_0xbcd4('0x21')];this[_0xbcd4('0x22')]=_0x50b3f5[_0xbcd4('0x22')];this[_0xbcd4('0x23')]=_0x50b3f5[_0xbcd4('0x23')]||'';this['originatecalleridname']=_0x50b3f5[_0xbcd4('0x24')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 917515a..2b0a989 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 _0xac4a=['ContactId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','SIP/%s','reachable','unmonitored','uniqueid','variable','amdstatus','exten','dialAMDActive','value','HANGUP','statedesc','HangupInAMD','membername','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','AMD','countmachineretry','countglobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','reason19\x20machine....','reason\x2019\x20machine....','add','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','ListId','[syncAgentComplete][createHistory][0]','countabandonedretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','[rescheduleContact][Machine]','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','outboundUnknownCallsDay','Unknow','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','countdropretry','dialDropMaxRetry','minutes','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','actionid','strategy','locked','paused','stateinterface','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','[booked][RR][finaly]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','timezones','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','Queue','method\x20not\x20recognized','launchHandleIvr','checkIfTime','dialGlobalInterval','dialTimezone','[syncQueueSummary]','\x5cw{0,','pow','replace','match','actionOriginate','object','Contact','phone','originate','getCaller','NONE','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','createdAt','XMD-','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','callerid','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','dialPrefix','trim','substring','dialCutDigit','SIP/%s/%s%s','from-sip','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','[originate][error]','Error','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countnosuchnumberretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','Success','[moveContactManagedDialer][0]','round','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','handlePredictive','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','dialPredictiveOptimizationPercentage','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','busyFactor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','handleIvr','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[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','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','----\x20Agent\x20Busy\x20Factor\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]','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','redis','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./final','./agentComplete','./queueCallerAbandon','env','XCALLY_IP_AGI','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','message','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','[ifTime][Action]','stringify','milliseconds','diff','seconds','emit','type','outbound','available','loggedIn','sumBillable','sumDuration','sumHoldTime','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','format','voice_queue:save','campaign:ivr:%s','campaign:save','isEmpty','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','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','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20predictive','clearing\x20variable\x20handle\x20predictive','ivr','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','pTalking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','endtime','starttime','[uniqueid]','clearZombieChannels','[actions]','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','resolve','then','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick'];(function(_0xc97200,_0x402a15){var _0x3abfe8=function(_0x45d06b){while(--_0x45d06b){_0xc97200['push'](_0xc97200['shift']());}};_0x3abfe8(++_0x402a15);}(_0xac4a,0x13f));var _0xaac4=function(_0x58aeca,_0x3778a2){_0x58aeca=_0x58aeca-0x0;var _0x221487=_0xac4a[_0x58aeca];return _0x221487;};'use strict';var util=require(_0xaac4('0x0'));var _=require(_0xaac4('0x1'));var BPromise=require(_0xaac4('0x2'));var uuid=require(_0xaac4('0x3'));var moment=require(_0xaac4('0x4'));var rr=require('rr');var md5=require(_0xaac4('0x5'));var Redis=require('ioredis');var ut=require('../preview/util/util');var config=require(_0xaac4('0x6'));var logger=require(_0xaac4('0x7'))(_0xaac4('0x8'));var loggerBooked=require('../../../config/logger')(_0xaac4('0x9'));var loggerPredictive=require('../../../config/logger')(_0xaac4('0xa'));var loggerPredictiveCalls=require('../../../config/logger')(_0xaac4('0xb'));var loggerSyncQueueSummary=require(_0xaac4('0x7'))('syncQueueSummary');var ami=require('../ami');config[_0xaac4('0xc')]=_['defaults'](config[_0xaac4('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xaac4('0xc')]));var cmHopper=require(_0xaac4('0xd'));var cmHopperHistory=require(_0xaac4('0xe'));var cmHopperBlack=require(_0xaac4('0xf'));var voiceQueueRt=require(_0xaac4('0x10'));var Action=require('./action');var History=require('./history');var Final=require(_0xaac4('0x11'));var AgentComplete=require(_0xaac4('0x12'));var QueueCallerAbandon=require(_0xaac4('0x13'));var Hangup=require('./hangup');var ipAgi=process[_0xaac4('0x14')][_0xaac4('0x15')]||'127.0.0.1';var strategy={'rrmemory':_0xaac4('0x16'),'roundrobin':_0xaac4('0x17')};var Sequence=function(){};Sequence[_0xaac4('0x18')][_0xaac4('0x19')]=function(_0x187624){this[_0xaac4('0x1a')]=this[_0xaac4('0x1a')]?this[_0xaac4('0x1a')][_0xaac4('0x1b')](_0x187624):_0x187624();};function Dialer(_0xb8466e,_0x35bc32){this[_0xaac4('0x1c')]=new Sequence();this[_0xaac4('0x1d')]=_0x35bc32;this['voiceQueues']=_0xb8466e[_0xaac4('0x1e')];this['campaigns']=_0xb8466e[_0xaac4('0x1f')];this['agents']=_0xb8466e[_0xaac4('0x20')];this[_0xaac4('0x21')]=_0xb8466e[_0xaac4('0x21')];this[_0xaac4('0x22')]=config[_0xaac4('0x22')]||0x2;this[_0xaac4('0x23')]={};this[_0xaac4('0x24')]={};this[_0xaac4('0x25')]={};this[_0xaac4('0x26')]={};this['optionPredictive']={};this[_0xaac4('0x27')]={};this['startProgressive']={};this[_0xaac4('0x28')]={};this[_0xaac4('0x29')]={};this[_0xaac4('0x2a')]={};ami['on'](_0xaac4('0x2b'),this[_0xaac4('0x2c')][_0xaac4('0x2d')](this));ami['on']('queuecallerabandon',this[_0xaac4('0x2e')][_0xaac4('0x2d')](this));ami['on'](_0xaac4('0x2f'),this[_0xaac4('0x30')][_0xaac4('0x2d')](this));ami['on'](_0xaac4('0x31'),this[_0xaac4('0x32')]['bind'](this));ami['on'](_0xaac4('0x33'),this['syncQueueSummary']['bind'](this));ami['on']('hangup',this['syncHangup'][_0xaac4('0x2d')](this));ami['on'](_0xaac4('0x34'),this[_0xaac4('0x35')][_0xaac4('0x2d')](this));ami['on'](_0xaac4('0x36'),this[_0xaac4('0x37')][_0xaac4('0x2d')](this));ami['on'](_0xaac4('0x38'),this[_0xaac4('0x39')][_0xaac4('0x2d')](this));ami['on']('queuestatuscomplete',this[_0xaac4('0x3a')][_0xaac4('0x2d')](this));this[_0xaac4('0x3b')]();this[_0xaac4('0x3c')]();}function isNotNull(_0x669b34){return _0x669b34!==null&&!_[_0xaac4('0x3d')](_0x669b34);}function checkIsLoggedIn(_0x5e469a,_0xcf6c1){return function(){if(_0xcf6c1<=0x0){_0x5e469a['message']=_0xaac4('0x3e');throw _0x5e469a[_0xaac4('0x3f')]+_0xaac4('0x40');}};}function isActive(_0x2aaa68){return _0x2aaa68;}function checkIsActive(_0x48bf50,_0x5000e1){return function(){if(!isActive(_0x5000e1)){_0x48bf50['message']=_0xaac4('0x41');throw _0x48bf50[_0xaac4('0x3f')]+_0xaac4('0x42');}};}function checkInterval(_0x244e36){return function(){if(!isNotNull(_0x244e36[_0xaac4('0x43')])){_0x244e36[_0xaac4('0x44')]=_0xaac4('0x45');throw _0x244e36[_0xaac4('0x3f')]+_0xaac4('0x46');}if(!isNotNull(_0x244e36[_0xaac4('0x43')][_0xaac4('0x47')])){_0x244e36[_0xaac4('0x44')]=_0xaac4('0x45');throw _0x244e36[_0xaac4('0x3f')]+_0xaac4('0x46');}if(!isNotNull(_['isEmpty'](_0x244e36['Interval'][_0xaac4('0x47')]))){_0x244e36[_0xaac4('0x44')]=_0xaac4('0x45');throw _0x244e36['name']+_0xaac4('0x46');}};}function msgResponse(_0x16fae8,_0x2cbf8d,_0x1bce61){return{'action':_0x16fae8,'response':_0x2cbf8d,'message':_0x1bce61,'stack':_0x1bce61};}function myreject(_0x1ec59d){return function(_0x1e1853){return _0x1ec59d(msgResponse(_0xaac4('0x48'),'Error',JSON[_0xaac4('0x49')](_0x1e1853)));};}function getSeconds(_0x31ec51,_0x1ffa56){var _0x5d64a2=moment(_0x31ec51)[_0xaac4('0x4a')](0x0);var _0x497e7b=moment(_0x1ffa56)['milliseconds'](0x0);return _0x5d64a2[_0xaac4('0x4b')](_0x497e7b,_0xaac4('0x4c'));}function emit(_0x2da28a,_0x591924,_0x5000ed){io['to'](_0x2da28a)[_0xaac4('0x4d')](_0x591924,_0x5000ed);}function emitVoiceQueueSummary(_0x33cc4){if(_0x33cc4[_0xaac4('0x4e')]===_0xaac4('0x4f')){var _0x2b65b1={'id':_0x33cc4['id'],'name':_0x33cc4[_0xaac4('0x3f')],'strategy':_0x33cc4['strategy'],'answered':_0x33cc4['answered'],'available':_0x33cc4[_0xaac4('0x50')],'loggedIn':_0x33cc4[_0xaac4('0x51')],'pTalking':_0x33cc4['pTalking'],'sumBillable':_0x33cc4[_0xaac4('0x52')],'sumDuration':_0x33cc4[_0xaac4('0x53')],'sumHoldTime':_0x33cc4[_0xaac4('0x54')]||0x0,'talking':_0x33cc4['talking'],'total':_0x33cc4[_0xaac4('0x55')],'type':_0x33cc4[_0xaac4('0x4e')],'unmanaged':_0x33cc4[_0xaac4('0x56')],'abandoned':_0x33cc4['abandoned'],'waiting':_0x33cc4[_0xaac4('0x57')],'loggedInDb':_0x33cc4[_0xaac4('0x58')],'dialActive':_0x33cc4[_0xaac4('0x59')],'dialMethod':_0x33cc4[_0xaac4('0x5a')],'dialOriginateCallerIdName':_0x33cc4['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x33cc4[_0xaac4('0x5b')],'dialOriginateTimeout':_0x33cc4['dialOriginateTimeout'],'dialPrefix':_0x33cc4['dialPrefix'],'outboundAnswerAgiCallsDay':_0x33cc4[_0xaac4('0x5c')],'outboundAnswerCallsDay':_0x33cc4[_0xaac4('0x5d')],'outboundBlacklistCallsDay':_0x33cc4[_0xaac4('0x5e')],'outboundBusyCallsDay':_0x33cc4[_0xaac4('0x5f')],'outboundCongestionCallsDay':_0x33cc4[_0xaac4('0x60')],'outboundDropCallsDayACS':_0x33cc4[_0xaac4('0x61')],'outboundDropCallsDayCallersExit':_0x33cc4[_0xaac4('0x62')],'outboundDropCallsDayTimeout':_0x33cc4[_0xaac4('0x63')],'outboundNoAnswerCallsDay':_0x33cc4['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x33cc4[_0xaac4('0x64')],'outboundOriginateFailureCallsDay':_0x33cc4[_0xaac4('0x65')],'outboundReCallsDay':_0x33cc4[_0xaac4('0x66')],'outboundRejectCallsDay':_0x33cc4[_0xaac4('0x67')],'outboundUnknownCallsDay':_0x33cc4['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x33cc4[_0xaac4('0x68')],'predictiveIntervalAvgHoldtime':_0x33cc4[_0xaac4('0x69')],'predictiveIntervalAvgTalktime':_0x33cc4[_0xaac4('0x6a')],'predictiveIntervalDroppedCallsCallersExit':_0x33cc4['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x33cc4[_0xaac4('0x6b')],'predictiveIntervalErlangCalls':_0x33cc4[_0xaac4('0x6c')],'predictiveIntervalErlangCallsDroppedCalls':_0x33cc4[_0xaac4('0x6d')],'predictiveIntervalHitRate':_0x33cc4[_0xaac4('0x6e')],'predictiveIntervalMultiplicativeFactor':_0x33cc4['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x33cc4[_0xaac4('0x6f')],'predictiveIntervalAvailable':_0x33cc4[_0xaac4('0x70')],'predictiveIntervalTotalCalls':_0x33cc4[_0xaac4('0x71')],'message':_0x33cc4['message'],'originated':_0x33cc4[_0xaac4('0x72')],'erlangCalls':_0x33cc4[_0xaac4('0x73')],'erlangCallToSecond':_0x33cc4[_0xaac4('0x74')],'erlangAbandonmentRate':_0x33cc4[_0xaac4('0x75')],'erlangBusyFactor':_0x33cc4[_0xaac4('0x76')],'startPredictive':_0x33cc4[_0xaac4('0x27')],'startProgressive':_0x33cc4[_0xaac4('0x77')]};if(_0x33cc4[_0xaac4('0x78')]){_0x2b65b1[_0xaac4('0x78')]={'id':_0x33cc4['Trunk']['id'],'name':_0x33cc4[_0xaac4('0x78')][_0xaac4('0x3f')],'active':_0x33cc4[_0xaac4('0x78')][_0xaac4('0x79')],'callerid':_0x33cc4[_0xaac4('0x78')]['callerid']};}if(_0x33cc4['Interval']){_0x2b65b1[_0xaac4('0x43')]={'id':_0x33cc4[_0xaac4('0x43')]['id'],'name':_0x33cc4[_0xaac4('0x43')][_0xaac4('0x3f')]};}var _0x5f33ea=md5(JSON[_0xaac4('0x49')](_0x2b65b1));if(_0x33cc4['md5']!==_0x5f33ea){_0x33cc4[_0xaac4('0x5')]=_0x5f33ea;emit(util[_0xaac4('0x7a')]('voice:queue:%s',_0x2b65b1[_0xaac4('0x3f')]),_0xaac4('0x7b'),_0x2b65b1);}}}function emitCampaignSummary(_0x357bc6){if(_0x357bc6['type']==='ivr'){emit(util[_0xaac4('0x7a')](_0xaac4('0x7c'),_0x357bc6[_0xaac4('0x3f')]),_0xaac4('0x7d'),_0x357bc6);}}function checkGetDataPredictive(_0x1877c2){if(isNotNull(_0x1877c2)&&!_[_0xaac4('0x7e')](_0x1877c2)){loggerPredictive['info'](_0xaac4('0x7f'));loggerPredictive[_0xaac4('0x80')](_0xaac4('0x81'),_0x1877c2[_0xaac4('0x71')]);loggerPredictive['info'](_0xaac4('0x82'),_0x1877c2['predictiveIntervalAnsweredCalls']);loggerPredictive[_0xaac4('0x80')](_0xaac4('0x83'),_0x1877c2[_0xaac4('0x6b')]);loggerPredictive[_0xaac4('0x80')](_0xaac4('0x84'),_0x1877c2[_0xaac4('0x85')]);loggerPredictive[_0xaac4('0x80')](_0xaac4('0x86'),_0x1877c2[_0xaac4('0x69')]);loggerPredictive[_0xaac4('0x80')](_0xaac4('0x87'),_0x1877c2[_0xaac4('0x6a')]);loggerPredictive[_0xaac4('0x80')](_0xaac4('0x88'));if(_0x1877c2['predictiveIntervalTotalCalls']>0x0){if(!_[_0xaac4('0x3d')](_0x1877c2[_0xaac4('0x6a')])&&_0x1877c2[_0xaac4('0x6a')]>0x0){return!![];}loggerPredictive[_0xaac4('0x80')](_0xaac4('0x89'));if(!_[_0xaac4('0x3d')](_0x1877c2[_0xaac4('0x69')])&&_0x1877c2[_0xaac4('0x69')]>0x0){return!![];}loggerPredictive['info'](_0xaac4('0x8a'));}else{loggerPredictive['info'](_0xaac4('0x8b'));}}else{loggerPredictive['info'](_0xaac4('0x8c'));}return![];}function mergeDataErlangB(_0x5d56ae){return function(_0x5155a4){loggerPredictive[_0xaac4('0x80')](_0xaac4('0x8d'));loggerPredictive['info'](_0xaac4('0x8e'),_0x5155a4[_0xaac4('0x73')]);loggerPredictive[_0xaac4('0x80')](_0xaac4('0x8f'),_0x5155a4[_0xaac4('0x74')]);loggerPredictive[_0xaac4('0x80')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5155a4[_0xaac4('0x75')]);loggerPredictive['info'](_0xaac4('0x90'),_0x5155a4['erlangBusyFactor']);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5155a4[_0xaac4('0x75')]);loggerPredictive[_0xaac4('0x80')](_0xaac4('0x88'));_[_0xaac4('0x91')](_0x5d56ae,_0x5155a4);};}function getDiff(_0x4c1d3c){var _0x372f96=moment()[_0xaac4('0x4a')](0x0);var _0x471af6=moment(_0x4c1d3c)['milliseconds'](0x0);return _0x372f96[_0xaac4('0x4b')](_0x471af6,_0xaac4('0x4c'));}function ifInterval(_0x2e1503,_0xab8baf){if(_[_0xaac4('0x3d')](_0xab8baf)){return![];}return getDiff(_0xab8baf)<_0x2e1503*0x3c;}function freeVariablesPredictive(_0x431838){if(isNotNull(_0x431838)){if(!_[_0xaac4('0x3d')](_0x431838['startProgressive'])){_0x431838['startProgressive']=undefined;loggerPredictive[_0xaac4('0x80')](_0x431838['name'],'clearing\x20variable\x20start\x20progressive');}if(!_[_0xaac4('0x3d')](_0x431838['startPredictive'])){_0x431838[_0xaac4('0x27')]=undefined;loggerPredictive['info'](_0x431838[_0xaac4('0x3f')],_0xaac4('0x92'));}if(!_['isUndefined'](_0x431838['handlePredictive'])){clearInterval(_0x431838['handlePredictive']);_0x431838['handlePredictive']=undefined;loggerPredictive[_0xaac4('0x80')](_0x431838[_0xaac4('0x3f')],_0xaac4('0x93'));}}}function erlangb(_0x399c74,_0x592b10){if(_0x592b10===0x0){return 0x0;}var _0x1037e0=0x1;for(var _0x354ec9=0x1;_0x354ec9<=_0x592b10;_0x354ec9+=0x1){_0x1037e0=0x1+_0x1037e0*_0x354ec9/_0x399c74;}return 0x1/_0x1037e0;}function isVoiceQueueOutbound(_0x3b0470){return _0x3b0470===_0xaac4('0x4f');}function isNotPreview(_0x3f5f8d){return _0x3f5f8d!==_0xaac4('0x1d');}function isCampaignIvr(_0x3a450d){return _0x3a450d===_0xaac4('0x94');}function getCallerId(_0x1c5d72,_0x40271c,_0x43aeee){if(!_['isUndefined'](_0x43aeee)&&typeof _0x43aeee==='string'&&!_[_0xaac4('0x7e')](_0x43aeee)){if(!_['isUndefined'](_0x40271c)&&typeof _0x40271c==='string'&&!_[_0xaac4('0x7e')](_0x40271c)){return util['format'](_0xaac4('0x95'),_0x40271c,_0x43aeee);}return util[_0xaac4('0x7a')](_0xaac4('0x95'),_0x43aeee,_0x43aeee);}if(!_[_0xaac4('0x3d')](_0x1c5d72)&&typeof _0x1c5d72==='string'&&!_[_0xaac4('0x7e')](_0x1c5d72)){return _0x1c5d72;}return _0xaac4('0x96');}function loggerCatchQueueSummary(_0x987b2e,_0xd5e0e2){return function(_0x300b0e){freeVariablesPredictive(_0xd5e0e2);emitVoiceQueueSummary(_0xd5e0e2);emitCampaignSummary(_0xd5e0e2);loggerSyncQueueSummary[_0xaac4('0x97')](_0x987b2e,util['inspect'](_0x300b0e,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1db7c7,_0x429661){return function(_0x5b5e57){loggerPredictive[_0xaac4('0x97')](_0x429661[_0xaac4('0x3f')],_0x1db7c7);loggerPredictive['error'](_0x5b5e57['stack']);freeVariablesPredictive(_0x429661);};}function loggerCatch(_0x334396){return function(_0x3a2e77){logger[_0xaac4('0x97')](_0x334396,util[_0xaac4('0x98')](_0x3a2e77,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x65dfc2){return _0x65dfc2&&!_[_0xaac4('0x3d')](_0x65dfc2)&&_0x65dfc2[_0xaac4('0x99')]>0x0;}function decremetOriginate(_0x3e589a){if(!_['isUndefined'](_0x3e589a)&&_0x3e589a!==null){if(typeof _0x3e589a[_0xaac4('0x72')]!==_0xaac4('0x9a')){if(_0x3e589a[_0xaac4('0x72')]>0x0){_0x3e589a[_0xaac4('0x72')]-=0x1;}else{logger[_0xaac4('0x97')](_0xaac4('0x9b'));}}}else{logger['error'](_0xaac4('0x9c'));}}function checkContactLowerLimitOriginate(_0x16c480,_0x53059b,_0x5c3c89){if(_0x53059b>_0x5c3c89){for(var _0x5357ad=0x0;_0x5357ad<_0x53059b-_0x5c3c89;_0x5357ad+=0x1){decremetOriginate(_0x16c480);}}}function loggerGetContactDialer(_0x25617a,_0x488b34,_0x5e3bf1){return function(_0x5cc49b){checkContactLowerLimitOriginate(_0x488b34,_0x5e3bf1,0x0);logger['error'](_0x25617a,util['inspect'](_0x5cc49b,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x430a49){return function(_0x46b0d6){if(isNotNull(_0x46b0d6)&&isNotNull(_0x46b0d6[0x0])){if(_0x46b0d6[0x0][_0xaac4('0x9d')]>0x0){_0x430a49[_0xaac4('0x44')]='RESCHEDULED_CONTACTS';logger[_0xaac4('0x80')](_0xaac4('0x9e')+_0x430a49[_0xaac4('0x3f')],_0x46b0d6[0x0][_0xaac4('0x9d')],_0xaac4('0x9f'));}else{_0x430a49[_0xaac4('0x44')]=_0xaac4('0xa0');logger['info'](_0xaac4('0xa1')+_0x430a49['name']);}}};}function notSendMessagesQueue(_0x551e53){if(_0x551e53[_0xaac4('0xa2')]){freeVariablesPredictive(_0x551e53);if(_0x551e53[_0xaac4('0x72')]===0x0&&_0x551e53[_0xaac4('0xa3')]===0x0&&_0x551e53[_0xaac4('0x57')]===0x0&&(_0x551e53[_0xaac4('0xa4')]||0x0)===0x0){_0x551e53[_0xaac4('0xa2')]=![];_0x551e53[_0xaac4('0x50')]=0x0;_0x551e53[_0xaac4('0x44')]=_0xaac4('0x41');loggerSyncQueueSummary[_0xaac4('0x97')](_0xaac4('0xa5'),_0x551e53[_0xaac4('0x3f')],_0xaac4('0xa6'));}else{_0x551e53[_0xaac4('0x44')]=_0xaac4('0xa7');loggerSyncQueueSummary[_0xaac4('0x97')](_0xaac4('0xa5'),_0x551e53[_0xaac4('0x3f')],_0xaac4('0xa8'));}emitVoiceQueueSummary(_0x551e53);}}function notSendMessagesCampaign(_0x3d452f){if(_0x3d452f[_0xaac4('0xa2')]){if(_0x3d452f[_0xaac4('0x72')]===0x0){_0x3d452f[_0xaac4('0xa2')]=![];_0x3d452f[_0xaac4('0x44')]=_0xaac4('0x41');loggerSyncQueueSummary['error'](_0xaac4('0xa9'),_0x3d452f[_0xaac4('0x3f')],_0xaac4('0xa6'));}else{_0x3d452f[_0xaac4('0x44')]=_0xaac4('0xa7');loggerSyncQueueSummary['error'](_0xaac4('0xa9'),_0x3d452f[_0xaac4('0x3f')],_0xaac4('0xa8'));}emitCampaignSummary(_0x3d452f);}}function createObjHistory(_0x2e24c4,_0x270b56,_0x508c4e,_0x30818a,_0x584ad9){_0x2e24c4[_0xaac4('0x44')]=_0x508c4e;var _0x36d642=new Action(_0x2e24c4,_0x270b56);var _0x57e692=new History(_0x36d642);_0x57e692[_0xaac4('0xaa')]=_0x30818a;_0x57e692['statedesc']=_0x584ad9;_0x57e692[_0xaac4('0xab')]=_0x36d642[_0xaac4('0xac')];return _0x57e692;}Dialer['prototype'][_0xaac4('0x3c')]=function(){var _0x3fe616=this;setInterval(function(){_0x3fe616['clearZombieChannels'](_0x3fe616[_0xaac4('0x26')],_0xaac4('0xad'));_0x3fe616[_0xaac4('0xae')](_0x3fe616[_0xaac4('0x24')],_0xaac4('0xaf'));},0x32c8);};Dialer[_0xaac4('0x18')][_0xaac4('0xae')]=function(_0x220f18,_0x3c47af){var _0x518af6=this;for(var _0x18d811 in _0x220f18){if(typeof _0x220f18[_0x18d811]!==_0xaac4('0x9a')){this[_0xaac4('0x1c')]['enqueue'](function(){if(!_[_0xaac4('0xb0')](_0x220f18[_0x18d811])){return ami[_0xaac4('0xb1')]({'action':_0xaac4('0xb2'),'channel':_0x220f18[_0x18d811][_0xaac4('0xb3')]})[_0xaac4('0xb4')](function(_0x3d397a){if(_0x3d397a[_0xaac4('0x44')]===_0xaac4('0xb5')){setTimeout(function(){if(_0x220f18[_0x18d811]&&_0x220f18[_0x18d811][_0xaac4('0x4e')]!==_0xaac4('0x94')){_0x518af6[_0xaac4('0xb6')](_0x518af6[_0xaac4('0x1e')][_0x220f18[_0x18d811][_0xaac4('0xb7')]]);logger[_0xaac4('0x97')](_0xaac4('0xb8'),_0x3c47af,_0x18d811,_0x220f18[_0x18d811][_0xaac4('0xb7')]);delete _0x220f18[_0x18d811];}if(_0x220f18[_0x18d811]&&_0x220f18[_0x18d811]['type']===_0xaac4('0x94')){_0x518af6[_0xaac4('0xb6')](_0x518af6[_0xaac4('0x1f')][_0x220f18[_0x18d811]['queue']]);logger[_0xaac4('0x97')](_0xaac4('0xb9'),_0x3c47af,_0x18d811,_0x220f18[_0x18d811]['queue']);delete _0x220f18[_0x18d811];}},0x2328);}});}});}}};Dialer[_0xaac4('0x18')]['countReScheduled']=function(_0x3ae162){return BPromise[_0xaac4('0xba')]()[_0xaac4('0xbb')](cmHopper[_0xaac4('0xbc')](_0x3ae162))[_0xaac4('0xb4')](loggerCatch(_0xaac4('0xbd')));};Dialer['prototype'][_0xaac4('0xbe')]=function(_0x207c90){return BPromise[_0xaac4('0xba')]()[_0xaac4('0xbb')](cmHopperBlack['checkIsBlackList'](_0x207c90))[_0xaac4('0xb4')](loggerCatch(_0xaac4('0xbf')));};Dialer[_0xaac4('0x18')]['checkIsBlackListIvr']=function(_0xa78f15){return BPromise[_0xaac4('0xba')]()[_0xaac4('0xbb')](cmHopperBlack[_0xaac4('0xc0')](_0xa78f15))[_0xaac4('0xb4')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer['prototype'][_0xaac4('0xc1')]=function(_0x1467f5){return BPromise[_0xaac4('0xba')]()[_0xaac4('0xbb')](cmHopperHistory['avgHandleTime'](_0x1467f5))[_0xaac4('0xb4')](loggerCatch(_0xaac4('0xc2')));};Dialer[_0xaac4('0x18')][_0xaac4('0xc3')]=function(_0x3d220c){return BPromise[_0xaac4('0xba')]()[_0xaac4('0xbb')](cmHopper[_0xaac4('0xc3')](_0x3d220c))[_0xaac4('0xb4')](loggerCatch(_0xaac4('0xc4')));};Dialer[_0xaac4('0x18')][_0xaac4('0xc5')]=function(_0x370219,_0x4dde7f,_0x2ac631){return BPromise[_0xaac4('0xba')]()[_0xaac4('0xbb')](cmHopper[_0xaac4('0xc5')](_0x370219,_0x4dde7f,_0x2ac631))[_0xaac4('0xb4')](loggerCatch(_0xaac4('0xc6')));};Dialer[_0xaac4('0x18')]['getContactDialer']=function(_0x3fe063,_0x3abb63,_0x32ca0b,_0x12df94,_0x87c461){return BPromise[_0xaac4('0xba')]()[_0xaac4('0xbb')](cmHopper[_0xaac4('0xc7')](_0x3fe063,_0x3abb63,_0x32ca0b,_0x12df94))['catch'](function(_0x2968b5){_0x87c461[_0xaac4('0xc8')]-=_0x32ca0b;_0x87c461[_0xaac4('0xc8')]=_0x87c461[_0xaac4('0xc8')]>0x0?_0x87c461[_0xaac4('0xc8')]:0x0;loggerCatch(_0xaac4('0xc9'))(_0x2968b5);});};Dialer[_0xaac4('0x18')][_0xaac4('0xca')]=function(_0x3ecb21,_0x1580f4,_0x5489d8,_0x59e944){return BPromise[_0xaac4('0xba')]()[_0xaac4('0xbb')](cmHopper[_0xaac4('0xca')](_0x3ecb21,_0x1580f4,_0x5489d8))[_0xaac4('0xb4')](function(_0x384a7a){_0x59e944['temp']-=_0x1580f4;_0x59e944[_0xaac4('0xc8')]=_0x59e944[_0xaac4('0xc8')]>0x0?_0x59e944[_0xaac4('0xc8')]:0x0;loggerCatch(_0xaac4('0xcb'))(_0x384a7a);});};Dialer[_0xaac4('0x18')][_0xaac4('0xcc')]=function(_0x71343b){return BPromise[_0xaac4('0xba')]()[_0xaac4('0xbb')](voiceQueueRt[_0xaac4('0xcc')](_0x71343b))[_0xaac4('0xb4')](loggerCatch(_0xaac4('0xcd')));};Dialer[_0xaac4('0x18')][_0xaac4('0xce')]=function(_0x103cb0){return BPromise[_0xaac4('0xba')]()[_0xaac4('0xbb')](cmHopper[_0xaac4('0xce')](_0x103cb0))[_0xaac4('0xb4')](loggerCatch(_0xaac4('0xcf')));};Dialer[_0xaac4('0x18')][_0xaac4('0xd0')]=function(_0x30ca3e){return BPromise[_0xaac4('0xba')]()[_0xaac4('0xbb')](cmHopperHistory[_0xaac4('0xd0')](_0x30ca3e))[_0xaac4('0xb4')](loggerCatch(_0xaac4('0xd1')));};Dialer[_0xaac4('0x18')][_0xaac4('0xb6')]=function(_0x5974fe){if(!_[_0xaac4('0x3d')](_0x5974fe)&&_0x5974fe!==null){if(typeof _0x5974fe[_0xaac4('0x72')]!==_0xaac4('0x9a')){if(_0x5974fe['originated']>0x0){_0x5974fe[_0xaac4('0x72')]-=0x1;}else{logger[_0xaac4('0x97')](_0xaac4('0xd2'));}}}else{logger[_0xaac4('0x97')](_0xaac4('0xd3'));}};Dialer[_0xaac4('0x18')][_0xaac4('0xd4')]=function(_0x3b0af8,_0x5ecd51){var _0x3f9a25=this;return function(_0x3ee211){_0x3f9a25['updateOriginated'](_0x5ecd51);logger[_0xaac4('0x97')](_0x3b0af8,util[_0xaac4('0x98')](_0x3ee211,{'showHidden':![],'depth':null}));};};Dialer[_0xaac4('0x18')][_0xaac4('0xd5')]=function(_0x51cc1b,_0x127278,_0x1a26f9){var _0x425a9b={'state':0x19,'statedesc':_0xaac4('0xd6')};this[_0xaac4('0xb6')](_0x127278);this[_0xaac4('0xd7')](_[_0xaac4('0x91')](_0x425a9b,_[_0xaac4('0xd8')](_0x1a26f9,[_0xaac4('0xd9'),'ListId',_0xaac4('0xda'),_0xaac4('0xdb'),_0xaac4('0xdc')])),_0xaac4('0xdd'),_0xaac4('0xde'));logger[_0xaac4('0x97')](_0x51cc1b);};Dialer[_0xaac4('0x18')][_0xaac4('0xdf')]=function(_0x299b63){return _0x299b63==='Success';};Dialer[_0xaac4('0x18')][_0xaac4('0xe0')]=function(_0x5cffd5){return!_['isUndefined'](_0x5cffd5)&&_0x5cffd5&&!_[_0xaac4('0x3d')](_0x5cffd5[_0xaac4('0x3f')])&&!_[_0xaac4('0x3d')](_0x5cffd5[_0xaac4('0x79')])&&_0x5cffd5[_0xaac4('0x79')]&&(this[_0xaac4('0x21')][util['format'](_0xaac4('0xe1'),_0x5cffd5[_0xaac4('0x3f')])]['status']===_0xaac4('0xe2')||this[_0xaac4('0x21')][util[_0xaac4('0x7a')]('SIP/%s',_0x5cffd5[_0xaac4('0x3f')])][_0xaac4('0xb2')]===_0xaac4('0xe3'));};Dialer[_0xaac4('0x18')]['saveInDb']=function(_0x523e8f,_0x264e7e,_0x2bd4c5){this[_0xaac4('0xd0')](_0x523e8f)[_0xaac4('0xb4')](loggerCatch(_0x264e7e));this[_0xaac4('0xce')](_0x523e8f)[_0xaac4('0xb4')](loggerCatch(_0x2bd4c5));};Dialer[_0xaac4('0x18')][_0xaac4('0x37')]=function(_0x180857){var _0x51bdf7=this[_0xaac4('0x26')][_0x180857[_0xaac4('0xe4')]];var _0x22e9b8;if(!_[_0xaac4('0xb0')](_0x180857)&&!_[_0xaac4('0xb0')](_0x180857[_0xaac4('0xe5')])&&!_[_0xaac4('0xb0')](_0x180857['variable'][_0xaac4('0xe6')])&&_0x180857[_0xaac4('0xe7')]==='xcally-motion-dialer'&&_0x51bdf7){if(_0x51bdf7['type']!=='ivr'&&this[_0xaac4('0x1e')][_0x51bdf7[_0xaac4('0xb7')]][_0xaac4('0xe8')]&&_0x180857[_0xaac4('0xe9')]===_0xaac4('0xea')){delete this[_0xaac4('0x26')][_0x180857[_0xaac4('0xe4')]];this[_0xaac4('0xb6')](this[_0xaac4('0x1e')][_0x51bdf7[_0xaac4('0xb7')]]);this[_0xaac4('0x1e')][_0x51bdf7[_0xaac4('0xb7')]][_0xaac4('0x5d')]+=0x1;this[_0xaac4('0x1e')][_0x51bdf7['queue']][_0xaac4('0x5c')]+=0x1;_0x22e9b8=new Hangup(_0x51bdf7,_0x180857);_0x22e9b8['state']=0x12;_0x22e9b8[_0xaac4('0xeb')]=_0xaac4('0xec');_0x22e9b8[_0xaac4('0xed')]='AMD';ami[_0xaac4('0x4d')](_0xaac4('0xee'),ut[_0xaac4('0xef')](_0x22e9b8,_0xaac4('0xf0')));this['saveInDb'](_0x22e9b8,_0xaac4('0xf1'),_0xaac4('0xf2'));}if(_0x51bdf7[_0xaac4('0x4e')]!==_0xaac4('0x94')&&this[_0xaac4('0x1e')][_0x51bdf7[_0xaac4('0xb7')]]['dialAMDActive']&&_0x180857[_0xaac4('0xe9')]===_0xaac4('0xf3')){var _0xc01bd=this;return new BPromise(function(_0x6d7f55,_0x258214){delete _0xc01bd['uniqueId'][_0x180857['uniqueid']];_0xc01bd['updateOriginated'](_0xc01bd[_0xaac4('0x1e')][_0x51bdf7[_0xaac4('0xb7')]]);_0xc01bd[_0xaac4('0x1e')][_0x51bdf7['queue']][_0xaac4('0x5d')]+=0x1;_0xc01bd['voiceQueues'][_0x51bdf7[_0xaac4('0xb7')]][_0xaac4('0x5c')]+=0x1;var _0x4388d0=_0xc01bd[_0xaac4('0x1e')][_0x51bdf7[_0xaac4('0xb7')]];var _0x56115e=new Hangup(_0x51bdf7,_0x180857);_0x56115e[_0xaac4('0xaa')]=0x13;_0x56115e['statedesc']=_0xaac4('0xf4');_0x56115e[_0xaac4('0xed')]=_0xaac4('0xf5');_0x56115e[_0xaac4('0xf6')]+=0x1;_0x56115e[_0xaac4('0xf7')]+=0x1;_0x56115e[_0xaac4('0xf0')]=!![];ami[_0xaac4('0x4d')]('custom:amd',ut[_0xaac4('0xef')](_0x56115e,_0xaac4('0xf0')));_0xc01bd[_0xaac4('0xd0')](_0x56115e)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x56115e[_0xaac4('0xf8')]+_0x56115e[_0xaac4('0xf9')]+_0x56115e[_0xaac4('0xfa')]+_0x56115e['countnosuchnumberretry']+_0x56115e['countdropretry']+_0x56115e['countabandonedretry']+_0x56115e[_0xaac4('0xf6')]+_0x56115e[_0xaac4('0xfb')]>=_0x4388d0['dialGlobalMaxRetry']){_0xc01bd['stateGlobal'](_0x56115e,_0x6d7f55,_0x258214,_0xaac4('0xfc'));}else{if(_0x56115e[_0xaac4('0xf6')]>=_0x4388d0['dialMachineMaxRetry']){_0xc01bd['createStateFinal'](_0x56115e,_0x6d7f55,_0x258214,_0xaac4('0xfd'));}else{_0xc01bd[_0xaac4('0xc3')]({'active':![],'countmachineretry':_0x56115e['countmachineretry'],'scheduledat':moment()[_0xaac4('0xfe')](_0x4388d0[_0xaac4('0xff')],'minutes')[_0xaac4('0x7a')](_0xaac4('0x100')),'ContactId':_0x56115e[_0xaac4('0xd9')],'ListId':_0x56115e[_0xaac4('0x101')],'VoiceQueueId':_0x56115e[_0xaac4('0xdb')]||undefined,'CampaignId':_0x56115e[_0xaac4('0xdc')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x6d7f55({'reschedule':0x1});}}});}if(_0x51bdf7['type']===_0xaac4('0x94')&&this['campaigns'][_0x51bdf7[_0xaac4('0xb7')]]['dialAMDActive']&&_0x180857[_0xaac4('0xe9')]==='HANGUP'){delete this[_0xaac4('0x26')][_0x180857[_0xaac4('0xe4')]];this['updateOriginated'](this[_0xaac4('0x1f')][_0x51bdf7['queue']]);_0x22e9b8=new Hangup(_0x51bdf7,_0x180857);_0x22e9b8[_0xaac4('0xaa')]=0x12;_0x22e9b8['statedesc']=_0xaac4('0xec');_0x22e9b8[_0xaac4('0xed')]='AMD';ami[_0xaac4('0x4d')](_0xaac4('0xee'),ut[_0xaac4('0xef')](_0x22e9b8,_0xaac4('0xf0')));this['saveInDb'](_0x22e9b8,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0x51bdf7['type']===_0xaac4('0x94')&&this[_0xaac4('0x1f')][_0x51bdf7[_0xaac4('0xb7')]][_0xaac4('0xe8')]&&_0x180857[_0xaac4('0xe9')]===_0xaac4('0xf3')){var _0xc01bd=this;return new BPromise(function(_0x4ef5dc,_0x815df5){delete _0xc01bd['uniqueId'][_0x180857[_0xaac4('0xe4')]];_0xc01bd[_0xaac4('0xb6')](_0xc01bd[_0xaac4('0x1f')][_0x51bdf7[_0xaac4('0xb7')]]);_0xc01bd[_0xaac4('0x1f')][_0x51bdf7[_0xaac4('0xb7')]][_0xaac4('0x5d')]+=0x1;_0xc01bd[_0xaac4('0x1f')][_0x51bdf7[_0xaac4('0xb7')]][_0xaac4('0x5c')]+=0x1;var _0x52c4c9=_0xc01bd[_0xaac4('0x1f')][_0x51bdf7[_0xaac4('0xb7')]];var _0x3f5e36=new Hangup(_0x51bdf7,_0x180857);_0x3f5e36[_0xaac4('0xaa')]=0x13;_0x3f5e36[_0xaac4('0xeb')]=_0xaac4('0xf4');_0x3f5e36[_0xaac4('0xed')]='AMD';_0x3f5e36[_0xaac4('0xf6')]+=0x1;_0x3f5e36[_0xaac4('0xf7')]+=0x1;_0x3f5e36[_0xaac4('0xf0')]=!![];ami[_0xaac4('0x4d')](_0xaac4('0xee'),ut[_0xaac4('0xef')](_0x3f5e36,_0xaac4('0xf0')));_0xc01bd['createHistory'](_0x3f5e36)[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x102')));if(_0x3f5e36[_0xaac4('0xf8')]+_0x3f5e36[_0xaac4('0xf9')]+_0x3f5e36[_0xaac4('0xfa')]+_0x3f5e36['countnosuchnumberretry']+_0x3f5e36['countdropretry']+_0x3f5e36[_0xaac4('0x103')]+_0x3f5e36[_0xaac4('0xf6')]+_0x3f5e36[_0xaac4('0xfb')]>=_0x52c4c9[_0xaac4('0x104')]){_0xc01bd[_0xaac4('0x105')](_0x3f5e36,_0x4ef5dc,_0x815df5,_0xaac4('0xfc'));}else{if(_0x3f5e36[_0xaac4('0xf6')]>=_0x52c4c9[_0xaac4('0x106')]){_0xc01bd[_0xaac4('0x107')](_0x3f5e36,_0x4ef5dc,_0x815df5,_0xaac4('0xfd'));}else{_0xc01bd[_0xaac4('0xc3')]({'active':![],'countmachineretry':_0x3f5e36['countmachineretry'],'scheduledat':moment()[_0xaac4('0xfe')](_0x52c4c9['dialMachineRetryFrequency'],'minutes')[_0xaac4('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3f5e36[_0xaac4('0xd9')],'ListId':_0x3f5e36[_0xaac4('0x101')],'VoiceQueueId':_0x3f5e36['VoiceQueueId']||undefined,'CampaignId':_0x3f5e36['CampaignId']||undefined})[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x108')));_0x4ef5dc({'reschedule':0x1});}}});}}};Dialer[_0xaac4('0x18')][_0xaac4('0x109')]=function(_0x23546e){var _0x437e01=this[_0xaac4('0x26')][_0x23546e['uniqueid']];var _0x347281=this;var _0x4f6875;if(_0x437e01&&_0x437e01[_0xaac4('0x4e')]===_0xaac4('0x94')){delete this[_0xaac4('0x26')][_0x23546e[_0xaac4('0xe4')]];this['updateOriginated'](this[_0xaac4('0x1f')][_0x437e01[_0xaac4('0xb7')]]);this[_0xaac4('0x1f')][_0x437e01[_0xaac4('0xb7')]][_0xaac4('0x10a')]+=0x1;_0x4f6875=new Hangup(_0x437e01,_0x23546e);this[_0xaac4('0xd0')](_0x4f6875)['catch'](loggerCatch(_0xaac4('0x10b')));this[_0xaac4('0xce')](_0x4f6875)[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x10c')));}if(_0x437e01&&_0x437e01['type']!==_0xaac4('0x94')&&isNotNull(this[_0xaac4('0x1e')][_0x437e01[_0xaac4('0xb7')]][_0xaac4('0x10d')])){delete this[_0xaac4('0x26')][_0x23546e[_0xaac4('0xe4')]];this[_0xaac4('0xb6')](this[_0xaac4('0x1e')][_0x437e01[_0xaac4('0xb7')]]);this[_0xaac4('0x1e')][_0x437e01['queue']]['outboundAnswerCallsDay']+=0x1;this[_0xaac4('0x1e')][_0x437e01[_0xaac4('0xb7')]][_0xaac4('0x5c')]+=0x1;_0x4f6875=new Hangup(_0x437e01,_0x23546e);_0x4f6875[_0xaac4('0xaa')]=0x10;_0x4f6875['statedesc']=_0xaac4('0x10e');_0x4f6875['membername']='AGI';this[_0xaac4('0xd0')](_0x4f6875)[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x10b')));this[_0xaac4('0xce')](_0x4f6875)['catch'](loggerCatch(_0xaac4('0x10c')));}if(_0x437e01&&_0x437e01[_0xaac4('0x4e')]!=='ivr'&&!isNotNull(this[_0xaac4('0x1e')][_0x437e01[_0xaac4('0xb7')]][_0xaac4('0x10d')])){delete this[_0xaac4('0x26')][_0x23546e[_0xaac4('0xe4')]];this['updateOriginated'](this['voiceQueues'][_0x437e01['queue']]);this[_0xaac4('0x1e')][_0x437e01[_0xaac4('0xb7')]][_0xaac4('0x10f')]+=0x1;_0x4f6875=new Hangup(_0x437e01,_0x23546e);_0x4f6875[_0xaac4('0xaa')]=0xc;_0x4f6875[_0xaac4('0xeb')]=_0x23546e['cause-txt'];_0x4f6875[_0xaac4('0xed')]=_0xaac4('0x110');this[_0xaac4('0xd0')](_0x4f6875)[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x10b')));this['moveContactManagedDialer'](_0x4f6875)[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x10c')));}};Dialer['prototype']['syncAgentComplete']=function(_0x145a51){var _0x5cbd00=this[_0xaac4('0x26')][_0x145a51['uniqueid']];var _0x4c1541=this;if(this['voiceQueues'][_0x145a51['queue']]){if(_0x5cbd00&&_0x5cbd00[_0xaac4('0x4e')]!==_0xaac4('0x94')){delete this[_0xaac4('0x26')][_0x145a51['uniqueid']];this[_0xaac4('0x1e')][_0x145a51[_0xaac4('0xb7')]][_0xaac4('0x5d')]+=0x1;var _0x4a0d74=new AgentComplete(_0x5cbd00,_0x145a51);if(_0x145a51[_0xaac4('0x111')]==='agent'){_0x4a0d74[_0xaac4('0x112')]=this[_0xaac4('0x1e')][_0x145a51[_0xaac4('0xb7')]][_0xaac4('0x113')]&&this[_0xaac4('0x1e')][_0x145a51[_0xaac4('0xb7')]][_0xaac4('0x114')]?moment()['format'](_0xaac4('0x100')):undefined;}this[_0xaac4('0xd0')](_0x4a0d74)[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x115')));this[_0xaac4('0xce')](_0x4a0d74)[_0xaac4('0xb4')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xaac4('0x18')][_0xaac4('0x2c')]=function(_0x427213){if(this[_0xaac4('0x1e')][_0x427213[_0xaac4('0xb7')]]){if(this['uniqueId'][_0x427213[_0xaac4('0xe4')]]&&this['uniqueId'][_0x427213[_0xaac4('0xe4')]][_0xaac4('0x4e')]!==_0xaac4('0x94')){this[_0xaac4('0xb6')](this[_0xaac4('0x1e')][_0x427213[_0xaac4('0xb7')]]);this[_0xaac4('0x26')][_0x427213[_0xaac4('0xe4')]][_0xaac4('0x116')]=moment()[_0xaac4('0x7a')](_0xaac4('0x100'));}}};Dialer['prototype'][_0xaac4('0x117')]=function(_0x34e0fa){this[_0xaac4('0xd0')](_0x34e0fa)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xaac4('0xce')](_0x34e0fa)[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x118')));};Dialer['prototype'][_0xaac4('0x2e')]=function(_0x12a29f){var _0x31371c=this[_0xaac4('0x26')][_0x12a29f[_0xaac4('0xe4')]];var _0x1f2610=this;if(this[_0xaac4('0x1e')][_0x12a29f[_0xaac4('0xb7')]]){if(_0x31371c&&_0x31371c[_0xaac4('0x4e')]!==_0xaac4('0x94')){delete this[_0xaac4('0x26')][_0x12a29f[_0xaac4('0xe4')]];this[_0xaac4('0xb6')](this[_0xaac4('0x1e')][_0x12a29f[_0xaac4('0xb7')]]);_0x31371c[_0xaac4('0x119')]=moment()[_0xaac4('0x7a')](_0xaac4('0x100'));var _0x45aca0=new QueueCallerAbandon(_0x31371c,_0x12a29f);if(getSeconds(_0x31371c['droptime'],_0x31371c[_0xaac4('0x11a')])>=_0x31371c[_0xaac4('0x11b')]){this['voiceQueues'][_0x12a29f[_0xaac4('0xb7')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xaac4('0x1e')][_0x12a29f['queue']]['outboundDropCallsDayTimeout']+=0x1;this[_0xaac4('0x1e')][_0x12a29f[_0xaac4('0xb7')]][_0xaac4('0x6d')]+=0x1;_0x45aca0[_0xaac4('0xaa')]=0xa;_0x45aca0[_0xaac4('0xeb')]=_0xaac4('0x11c');_0x45aca0[_0xaac4('0x11d')]=_0xaac4('0x11e');_0x45aca0['agiafterat']=this['voiceQueues'][_0x12a29f['queue']][_0xaac4('0x113')]?moment()[_0xaac4('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x45aca0[_0xaac4('0x11f')]+=0x1;_0x45aca0['countglobal']+=0x1;if(_0x45aca0['countdropretry']>=this[_0xaac4('0x1e')][_0x12a29f['queue']][_0xaac4('0x120')]){this[_0xaac4('0x117')](_0x45aca0);}else{this[_0xaac4('0xc3')]({'active':![],'countdropretry':_0x45aca0[_0xaac4('0x11f')],'scheduledat':moment()[_0xaac4('0xfe')](this[_0xaac4('0x1e')][_0x12a29f[_0xaac4('0xb7')]]['dialDropRetryFrequency'],_0xaac4('0x121'))[_0xaac4('0x7a')](_0xaac4('0x100')),'ContactId':_0x31371c[_0xaac4('0xd9')],'ListId':_0x31371c['ListId'],'VoiceQueueId':_0x31371c[_0xaac4('0xdb')]||undefined,'CampaignId':_0x31371c[_0xaac4('0xdc')]||undefined})[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x122')));var _0x35e9d0=new History(_0x45aca0);_0x35e9d0[_0xaac4('0xaa')]=0xa;_0x35e9d0[_0xaac4('0xeb')]=_0xaac4('0x11c');_0x35e9d0['starttime']=moment()[_0xaac4('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');_0x35e9d0[_0xaac4('0xab')]=_0x35e9d0[_0xaac4('0xac')];_0x35e9d0[_0xaac4('0x123')]=_0x45aca0[_0xaac4('0x123')];_0x35e9d0[_0xaac4('0x124')]=_0x45aca0[_0xaac4('0x124')];this[_0xaac4('0xd0')](_0x35e9d0)['catch'](loggerCatch(_0xaac4('0x125')));}}else{this[_0xaac4('0x1e')][_0x12a29f[_0xaac4('0xb7')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xaac4('0x1e')][_0x12a29f['queue']][_0xaac4('0x62')]+=0x1;_0x45aca0[_0xaac4('0xaa')]=0xb;_0x45aca0[_0xaac4('0xeb')]=_0xaac4('0x126');_0x45aca0[_0xaac4('0x11d')]=_0xaac4('0x127');_0x45aca0[_0xaac4('0x103')]+=0x1;_0x45aca0[_0xaac4('0xf7')]+=0x1;if(_0x45aca0[_0xaac4('0x103')]>=this[_0xaac4('0x1e')][_0x12a29f[_0xaac4('0xb7')]][_0xaac4('0x128')]){this[_0xaac4('0x117')](_0x45aca0);}else{this[_0xaac4('0xc3')]({'active':![],'countabandonedretry':_0x45aca0[_0xaac4('0x103')],'scheduledat':moment()[_0xaac4('0xfe')](this['voiceQueues'][_0x12a29f[_0xaac4('0xb7')]][_0xaac4('0x129')],'minutes')[_0xaac4('0x7a')](_0xaac4('0x100')),'ContactId':_0x31371c[_0xaac4('0xd9')],'ListId':_0x31371c['ListId'],'VoiceQueueId':_0x31371c[_0xaac4('0xdb')]||undefined,'CampaignId':_0x31371c[_0xaac4('0xdc')]||undefined})['catch'](loggerCatch(_0xaac4('0x12a')));var _0x35e9d0=new History(_0x45aca0);_0x35e9d0[_0xaac4('0xaa')]=0xb;_0x35e9d0[_0xaac4('0xeb')]=_0xaac4('0x126');_0x35e9d0[_0xaac4('0xac')]=moment()[_0xaac4('0x7a')](_0xaac4('0x100'));_0x35e9d0[_0xaac4('0xab')]=_0x35e9d0[_0xaac4('0xac')];_0x35e9d0['calleridname']=_0x45aca0[_0xaac4('0x123')];_0x35e9d0[_0xaac4('0x124')]=_0x45aca0[_0xaac4('0x124')];this[_0xaac4('0xd0')](_0x35e9d0)[_0xaac4('0xb4')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0xaac4('0x18')][_0xaac4('0x35')]=function(_0x465892){if(this[_0xaac4('0x24')][_0x465892[_0xaac4('0xe4')]]){this[_0xaac4('0x24')][_0x465892[_0xaac4('0xe4')]][_0xaac4('0xb3')]=_0x465892[_0xaac4('0xb3')];}if(this['uniqueId'][_0x465892[_0xaac4('0xe4')]]){this[_0xaac4('0x26')][_0x465892['uniqueid']][_0xaac4('0xb3')]=_0x465892['channel'];}};Dialer[_0xaac4('0x18')][_0xaac4('0x39')]=function(_0xc42483){if(strategy[this[_0xaac4('0x1e')][this[_0xaac4('0x24')][_0xc42483[_0xaac4('0x12b')]][_0xaac4('0xb7')]][_0xaac4('0x12c')]]==='roundrobin'){if(this[_0xaac4('0x24')][_0xc42483[_0xaac4('0x12b')]]&&_[_0xaac4('0xb0')](this[_0xaac4('0x24')][_0xc42483[_0xaac4('0x12b')]][_0xaac4('0x12d')])&&_0xc42483['status']==='1'&&_0xc42483[_0xaac4('0x12e')]==='0'){if(this['agents'][_0xc42483[_0xaac4('0x12f')]]){if(!this['agents'][_0xc42483[_0xaac4('0x12f')]][_0xaac4('0x12d')]){this[_0xaac4('0x20')][_0xc42483[_0xaac4('0x12f')]][_0xaac4('0x12d')]=!![];this[_0xaac4('0x24')][_0xc42483[_0xaac4('0x12b')]][_0xaac4('0x12d')]=!![];this[_0xaac4('0x24')][_0xc42483['actionid']]['stateinterface']=_0xc42483['stateinterface'];}}}}else if((strategy[this[_0xaac4('0x1e')][this[_0xaac4('0x24')][_0xc42483[_0xaac4('0x12b')]][_0xaac4('0xb7')]][_0xaac4('0x12c')]]||_0xaac4('0x16'))===_0xaac4('0x16')){if(this[_0xaac4('0x24')][_0xc42483[_0xaac4('0x12b')]]){if(this[_0xaac4('0x20')][_0xc42483['stateinterface']]){this[_0xaac4('0x24')][_0xc42483[_0xaac4('0x12b')]][_0xaac4('0x12f')]=_0xc42483['stateinterface'];if(_[_0xaac4('0xb0')](this[_0xaac4('0x29')][this['actions'][_0xc42483[_0xaac4('0x12b')]]['queue']])){this[_0xaac4('0x29')][this[_0xaac4('0x24')][_0xc42483[_0xaac4('0x12b')]]['queue']]=[];}this[_0xaac4('0x29')][this[_0xaac4('0x24')][_0xc42483[_0xaac4('0x12b')]][_0xaac4('0xb7')]][_0xaac4('0x130')](_[_0xaac4('0x91')](_[_0xaac4('0xd8')](this['actions'][_0xc42483[_0xaac4('0x12b')]],[_0xaac4('0x131'),'stateinterface']),{'status':_0xc42483[_0xaac4('0xb2')],'paused':_0xc42483[_0xaac4('0x12e')]}));}}}};function unlockQueueStatus(_0x11f6ac,_0x185fce){setTimeout(function(){if(_[_0xaac4('0x3d')](_0x11f6ac[_0xaac4('0x132')])){loggerBooked[_0xaac4('0x97')](_0xaac4('0x133'),_0x185fce);}_0x11f6ac[_0xaac4('0x132')]=!![];loggerBooked['info']('[booked][unlockQueueStatus]',_0x185fce,JSON[_0xaac4('0x49')](_[_0xaac4('0xd8')](_0x11f6ac,[_0xaac4('0x3f'),_0xaac4('0x132')])));},0x1f3);}Dialer[_0xaac4('0x18')][_0xaac4('0x3a')]=function(_0x4e64cf){var _0x328872=this;var _0x46df79=_0x328872[_0xaac4('0x1e')][_0x328872[_0xaac4('0x24')][_0x4e64cf['actionid']][_0xaac4('0xb7')]];if(strategy[this[_0xaac4('0x1e')][this[_0xaac4('0x24')][_0x4e64cf[_0xaac4('0x12b')]][_0xaac4('0xb7')]]['strategy']]===_0xaac4('0x17')){if(this[_0xaac4('0x24')][_0x4e64cf['actionid']]&&this['actions'][_0x4e64cf[_0xaac4('0x12b')]][_0xaac4('0x12f')]){this[_0xaac4('0x1d')][_0xaac4('0x134')](this['actions'][_0x4e64cf['actionid']][_0xaac4('0x131')],this[_0xaac4('0x24')][_0x4e64cf[_0xaac4('0x12b')]][_0xaac4('0x12f')])[_0xaac4('0xb4')](function(_0x1d63e9){logger['error'](_0xaac4('0x135'),util[_0xaac4('0x98')](_0x1d63e9,{'showHidden':![],'depth':null}));})[_0xaac4('0x1b')](function(){_0x328872[_0xaac4('0xb6')](_0x328872['voiceQueues'][_0x328872[_0xaac4('0x24')][_0x4e64cf[_0xaac4('0x12b')]][_0xaac4('0xb7')]]);_0x328872[_0xaac4('0x20')][_0x328872[_0xaac4('0x24')][_0x4e64cf[_0xaac4('0x12b')]][_0xaac4('0x12f')]][_0xaac4('0x12d')]=![];delete _0x328872['actions'][_0x4e64cf['actionid']];unlockQueueStatus(_0x46df79);});}else{this[_0xaac4('0xb6')](this[_0xaac4('0x1e')][this['actions'][_0x4e64cf['actionid']][_0xaac4('0xb7')]]);this[_0xaac4('0xc3')]({'active':![],'ContactId':this[_0xaac4('0x24')][_0x4e64cf[_0xaac4('0x12b')]]['ContactId'],'ListId':this[_0xaac4('0x24')][_0x4e64cf[_0xaac4('0x12b')]][_0xaac4('0x101')],'VoiceQueueId':this['actions'][_0x4e64cf[_0xaac4('0x12b')]][_0xaac4('0xdb')]||undefined,'CampaignId':this[_0xaac4('0x24')][_0x4e64cf[_0xaac4('0x12b')]][_0xaac4('0xdc')]||undefined})[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x136')));delete this['actions'][_0x4e64cf[_0xaac4('0x12b')]];unlockQueueStatus(_0x46df79);}}else if((strategy[this[_0xaac4('0x1e')][this[_0xaac4('0x24')][_0x4e64cf['actionid']][_0xaac4('0xb7')]][_0xaac4('0x12c')]]||'rrmemory')===_0xaac4('0x16')){var _0x3c9b4e;if(this['actions'][_0x4e64cf[_0xaac4('0x12b')]]&&!_[_0xaac4('0x7e')](this[_0xaac4('0x29')][this[_0xaac4('0x24')][_0x4e64cf[_0xaac4('0x12b')]]['queue']])){if(this[_0xaac4('0x2a')][_0x328872[_0xaac4('0x24')][_0x4e64cf[_0xaac4('0x12b')]][_0xaac4('0xb7')]]){this['queueBookedRR'][_0x328872[_0xaac4('0x24')][_0x4e64cf[_0xaac4('0x12b')]][_0xaac4('0xb7')]]=this[_0xaac4('0x2a')][this[_0xaac4('0x24')][_0x4e64cf[_0xaac4('0x12b')]][_0xaac4('0xb7')]]?this['queueBookedRR'][this['actions'][_0x4e64cf['actionid']][_0xaac4('0xb7')]]:this[_0xaac4('0x29')][this[_0xaac4('0x24')][_0x4e64cf['actionid']][_0xaac4('0xb7')]]?this[_0xaac4('0x29')][this[_0xaac4('0x24')][_0x4e64cf['actionid']][_0xaac4('0xb7')]][_0xaac4('0x137')]||0x0:0x0;}this[_0xaac4('0x29')][this['actions'][_0x4e64cf[_0xaac4('0x12b')]][_0xaac4('0xb7')]][_0xaac4('0x137')]=this['queueBookedRR'][this['actions'][_0x4e64cf[_0xaac4('0x12b')]][_0xaac4('0xb7')]];for(var _0x4b6c7e=0x0;_0x4b6c7e=0x0;})[_0xaac4('0xb4')](myreject(_0x3c17b8)));}}else{_0x217e88[_0xaac4('0x130')](ami[_0xaac4('0xb1')]({'action':_0xaac4('0x14d'),'command':util[_0xaac4('0x7a')](_0xaac4('0x14e'),_0x1a56a6,!_[_0xaac4('0x3d')](config[_0xaac4('0x14f')][_0x4c539b])?_0x4c539b:'')})[_0xaac4('0xbb')](function(_0x19a236){return _0x19a236[_0xaac4('0x150')][_0xaac4('0x151')]('true')>=0x0;})['catch'](myreject(_0x3c17b8)));}BPromise[_0xaac4('0x153')](_0x217e88)[_0xaac4('0xbb')](function(_0x376426){var _0x4864b4=_[_0xaac4('0x154')](_0x376426);if(_0x4864b4){return _0x248f3e(_0x4864b4);}else{_0x36e765[_0xaac4('0x44')]=_0x130b82?_0xaac4('0x155'):'INTERVAL_IS_OVERTIME';return _0x3c17b8(msgResponse(_0xaac4('0x156'),_0xaac4('0x146'),_0xaac4('0x157')+_0x130b82+'\x20'+_0x5ad458+_0xaac4('0x158')+util[_0xaac4('0x98')](_0x1a56a6,{'showHidden':![],'depth':null})+_0xaac4('0x159')+_0x4c539b));}})[_0xaac4('0xb4')](function(_0x510881){return _0x3c17b8(msgResponse(_0xaac4('0x144'),_0xaac4('0x146'),JSON[_0xaac4('0x49')](_0x510881)));});});};Dialer['prototype'][_0xaac4('0x15a')]=function(_0x115e1f){var _0x48d670=this;return function(){switch(_0x115e1f[_0xaac4('0x5a')]){case _0xaac4('0x15b'):freeVariablesPredictive(_0x115e1f);_0x48d670[_0xaac4('0x15c')](_0x115e1f,0x1);break;case _0xaac4('0x15d'):freeVariablesPredictive(_0x115e1f);_0x48d670['handlePower'](_0x115e1f,_0x115e1f['dialPowerLevel']);break;case _0xaac4('0xa'):_0x48d670[_0xaac4('0xa')](_0x115e1f);break;case'booked':freeVariablesPredictive(_0x115e1f);_0x48d670[_0xaac4('0x15c')](_0x115e1f,0x1);break;default:freeVariablesPredictive(_0x115e1f);logger[_0xaac4('0x97')](_0xaac4('0x15e'),_0x115e1f[_0xaac4('0x3f')],_0xaac4('0x15f'));}};};Dialer[_0xaac4('0x18')][_0xaac4('0x160')]=function(_0x5f30cf){var _0x425771=this;return function(){_0x425771['handleIvr'](_0x5f30cf);};};Dialer['prototype']['syncQueueSummary']=function(_0x15fa36){var _0x3ebaf2=this;if(isNotPreview(_0x15fa36['dialMethod'])){if(isVoiceQueueOutbound(_0x15fa36[_0xaac4('0x4e')])&&isActive(_0x15fa36[_0xaac4('0x59')])){_0x15fa36[_0xaac4('0xa2')]=!![];BPromise['resolve']()[_0xaac4('0xbb')](checkIsLoggedIn(_0x15fa36,_0x15fa36[_0xaac4('0x51')]))[_0xaac4('0xbb')](checkIsActive(_0x15fa36,_0x15fa36['dialActive']))['then'](checkInterval(_0x15fa36))['then'](_0x3ebaf2[_0xaac4('0x141')](_0x15fa36))[_0xaac4('0xbb')](_0x3ebaf2[_0xaac4('0x161')](_0x15fa36[_0xaac4('0x162')],_0x15fa36[_0xaac4('0x163')],_0x15fa36['name'],_0x15fa36))[_0xaac4('0xbb')](_0x3ebaf2[_0xaac4('0x145')](_0x15fa36['Interval'],_0x15fa36['dialTimezone'],_0x15fa36[_0xaac4('0x3f')],_0x15fa36))[_0xaac4('0xbb')](_0x3ebaf2['checkDialMethod'](_0x15fa36))[_0xaac4('0xb4')](loggerCatchQueueSummary(_0xaac4('0x164'),_0x15fa36));}else{notSendMessagesQueue(_0x15fa36);}}else{freeVariablesPredictive(_0x15fa36);}};Dialer['prototype'][_0xaac4('0x140')]=function(){var _0x33935a=this;var _0x35e92b;for(var _0x18e9e5 in this[_0xaac4('0x1f')]){if(typeof this['campaigns'][_0x18e9e5]!=='undefined'){_0x35e92b=this[_0xaac4('0x1f')][_0x18e9e5];if(isCampaignIvr(_0x35e92b[_0xaac4('0x4e')])&&isActive(_0x35e92b['active'])){_0x35e92b['sendMessageOneNotActive']=!![];BPromise[_0xaac4('0xba')]()[_0xaac4('0xbb')](checkIsActive(_0x35e92b,_0x35e92b['active']))['then'](checkInterval(_0x35e92b))[_0xaac4('0xbb')](_0x33935a[_0xaac4('0x141')](_0x35e92b))[_0xaac4('0xbb')](_0x33935a[_0xaac4('0x161')](_0x35e92b[_0xaac4('0x162')],_0x35e92b[_0xaac4('0x163')],_0x35e92b[_0xaac4('0x3f')],_0x35e92b))[_0xaac4('0xbb')](_0x33935a['checkIfTimeIntervals'](_0x35e92b[_0xaac4('0x43')],_0x35e92b[_0xaac4('0x163')],_0x35e92b['name'],_0x35e92b))['then'](_0x33935a['launchHandleIvr'](_0x35e92b))[_0xaac4('0xb4')](loggerCatchQueueSummary('[syncCampaigns]',_0x35e92b));}else{notSendMessagesCampaign(_0x35e92b);}}}};function getCallerIdRandom(_0x9c5dd,_0xa6b172){var _0x357fe7;var _0x35b3f4;var _0x7b786a;if(_0xa6b172<=0x0){_0xa6b172=0x1;}_0x357fe7=new RegExp(_0xaac4('0x165')+_0xa6b172+'}$');_0x35b3f4=Math[_0xaac4('0x166')](0xa,_0xa6b172-0x1);_0x7b786a=Math[_0xaac4('0x166')](0xa,_0xa6b172)-0x1;return util[_0xaac4('0x7a')]('%s',_[_0xaac4('0x167')](_0x9c5dd,_0x357fe7,_['random'](_0x35b3f4,_0x7b786a)));}function extractCalleridName(_0x4cde3d){var _0x37e797=_0x4cde3d[_0xaac4('0x168')](/"(.*?)"/);return _0x37e797?_0x37e797[0x1]:_0x4cde3d;}function extractCalleridNumber(_0x10b207){var _0x51ff3e=_0x10b207[_0xaac4('0x168')](/<(.*?)>/);return _0x51ff3e?_0x51ff3e[0x1]:_0x10b207;}Dialer['prototype'][_0xaac4('0x169')]=function(_0x18c5ce,_0x4b3508){var _0x5491c6=this;var _0xc39ca5=uuid['v4']();this[_0xaac4('0x24')][_0xc39ca5]=new Action(_0x18c5ce,_0x4b3508,_0xc39ca5);return new BPromise(function(_0x33b5e4,_0x49afc0){if(_['isUndefined'](_0x18c5ce)&&typeof _0x18c5ce!==_0xaac4('0x16a')){return _0x49afc0(msgResponse('originate',_0xaac4('0x146'),'voiceQueue\x20is\x20undefine'));}if(_[_0xaac4('0x3d')](_0x4b3508[_0xaac4('0x16b')][_0xaac4('0x16c')])||_0x4b3508['Contact']['phone']===null){return _0x49afc0(msgResponse(_0xaac4('0x16d'),_0xaac4('0x146'),'contact\x20is\x20undefine'));}var _0x12707c={'XMD-CALLERID':_0x5491c6[_0xaac4('0x24')][_0xc39ca5][_0xaac4('0x16e')](),'XMD-AGI':_0x18c5ce[_0xaac4('0x10d')]?util[_0xaac4('0x7a')]('\x22agi://%s/square,%s\x22',ipAgi,_0x18c5ce[_0xaac4('0x10d')]):_0xaac4('0x16f'),'XMD-AGIAFTER':_0x18c5ce[_0xaac4('0x113')]?util[_0xaac4('0x7a')](_0xaac4('0x170'),ipAgi,_0x18c5ce[_0xaac4('0x113')]):'NONE','XMD-QUEUE':_0x18c5ce[_0xaac4('0x4e')]===_0xaac4('0x4f')?util[_0xaac4('0x7a')](_0xaac4('0x171'),_0x18c5ce[_0xaac4('0x3f')],_0x18c5ce[_0xaac4('0x172')]||'',_0x18c5ce[_0xaac4('0x114')]?'c':'',_0x18c5ce[_0xaac4('0x11b')]||0x3):_0xaac4('0x16f'),'XMD-CONTACTID':_0x4b3508[_0xaac4('0xd9')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x5491c6[_0xaac4('0x24')][_0xc39ca5][_0xaac4('0x16e')](),'XMD-AMD':_0x18c5ce[_0xaac4('0xe8')]?_0xaac4('0x173'):'NONE','XMD-DESTINATION':_0xaac4('0x174')};if(_0x18c5ce[_0xaac4('0xe8')]){_0x12707c[_0xaac4('0x175')]=_0x18c5ce[_0xaac4('0x176')]||0x9c4;_0x12707c[_0xaac4('0x177')]=_0x18c5ce['dialAMDGreeting']||0x5dc;_0x12707c['XMD-AMDAFTERGREETINGSILENCE']=_0x18c5ce[_0xaac4('0x178')]||0x320;_0x12707c['XMD-AMDTOTALANALYSISTIME']=_0x18c5ce[_0xaac4('0x179')]||0x1388;_0x12707c[_0xaac4('0x17a')]=_0x18c5ce['dialAMDMinWordLength']||0x64;_0x12707c[_0xaac4('0x17b')]=_0x18c5ce[_0xaac4('0x17c')]||0x32;_0x12707c[_0xaac4('0x17d')]=_0x18c5ce[_0xaac4('0x17e')]||0x3;_0x12707c[_0xaac4('0x17f')]=_0x18c5ce['dialAMDSilenceThreshold']||0x100;_0x12707c[_0xaac4('0x180')]=_0x18c5ce['dialAMDMaximumWordLength']||0x1388;}if(_0x18c5ce[_0xaac4('0x4e')]===_0xaac4('0x4f')){_0x12707c[_0xaac4('0x181')]=_0x4b3508[_0xaac4('0xdb')];}else{_0x12707c[_0xaac4('0x182')]=_0x4b3508[_0xaac4('0xdc')];}for(var _0x3345cf in _0x4b3508['Contact']){if(typeof _0x4b3508[_0xaac4('0x16b')][_0x3345cf]!=='undefined'){if(isNotNull(_0x4b3508[_0xaac4('0x16b')][_0x3345cf])&&_0x3345cf!=='id'&&_0x3345cf!=='tags'&&_0x3345cf!==_0xaac4('0x183')&&_0x3345cf!=='updatedAt'){_0x12707c[util[_0xaac4('0x7a')]('%s%s',_0xaac4('0x184'),_[_0xaac4('0x185')](_0x3345cf))]=_0x4b3508[_0xaac4('0x16b')][_0x3345cf];}}}var _0x28bde8=_0x5491c6[_0xaac4('0xe0')](_0x18c5ce[_0xaac4('0x78')])?getCallerId(_0x18c5ce['Trunk']['callerid'],_0x18c5ce[_0xaac4('0x186')],_0x18c5ce[_0xaac4('0x187')]>0x0?getCallerIdRandom(_0x18c5ce[_0xaac4('0x5b')],_0x18c5ce['dialRandomLastDigitCallerIdNumber']):_0x18c5ce[_0xaac4('0x5b')]):getCallerId(_[_0xaac4('0xb0')](_0x18c5ce[_0xaac4('0x142')])?_0x18c5ce[_0xaac4('0x78')][_0xaac4('0x188')]:_0x18c5ce['TrunkBackup'][_0xaac4('0x188')],_0x18c5ce['dialOriginateCallerIdName'],_0x18c5ce[_0xaac4('0x187')]>0x0?getCallerIdRandom(_0x18c5ce[_0xaac4('0x5b')],_0x18c5ce[_0xaac4('0x187')]):_0x18c5ce[_0xaac4('0x5b')]);if(_0x28bde8){_0x12707c[_0xaac4('0x189')]=_0x5491c6['actions'][_0xc39ca5]['originatecalleridname']=extractCalleridName(_0x28bde8);_0x12707c[_0xaac4('0x18a')]=_0x5491c6[_0xaac4('0x24')][_0xc39ca5][_0xaac4('0x18b')]=extractCalleridNumber(_0x28bde8);}return ami[_0xaac4('0xb1')]({'actionid':_0xc39ca5,'action':_0xaac4('0x16d'),'channel':_0x5491c6[_0xaac4('0xe0')](_0x18c5ce[_0xaac4('0x78')])?util[_0xaac4('0x7a')]('SIP/%s/%s%s',_0x18c5ce[_0xaac4('0x78')]['name'],isNotNull(_0x18c5ce[_0xaac4('0x18c')])?_0x18c5ce[_0xaac4('0x18c')][_0xaac4('0x18d')]()||'':'',_0x18c5ce['dialCutDigit']>0x0?_0x4b3508[_0xaac4('0x16b')]['phone'][_0xaac4('0x18e')](_0x18c5ce[_0xaac4('0x18f')]):_0x4b3508[_0xaac4('0x16b')][_0xaac4('0x16c')]):util['format'](_0xaac4('0x190'),_[_0xaac4('0xb0')](_0x18c5ce[_0xaac4('0x142')])?_0x18c5ce[_0xaac4('0x78')][_0xaac4('0x3f')]:_0x18c5ce['TrunkBackup'][_0xaac4('0x3f')],isNotNull(_0x18c5ce['dialPrefix'])?_0x18c5ce[_0xaac4('0x18c')][_0xaac4('0x18d')]()||'':'',_0x18c5ce[_0xaac4('0x18f')]>0x0?_0x4b3508[_0xaac4('0x16b')][_0xaac4('0x16c')][_0xaac4('0x18e')](_0x18c5ce['dialCutDigit']):_0x4b3508[_0xaac4('0x16b')][_0xaac4('0x16c')]),'callerid':_0x28bde8,'Exten':_0xaac4('0x174'),'Context':_0xaac4('0x191'),'Priority':'1','variable':_0x12707c,'timeout':(_0x18c5ce[_0xaac4('0x192')]||0x1e)*0x3e8,'async':!![],'channelid':_0xc39ca5})[_0xaac4('0xbb')](function(_0x472eae){return _0x33b5e4(_0x472eae);})[_0xaac4('0xb4')](function(_0x5da8ea){_0x18c5ce['outboundOriginateFailureCallsDay']+=0x1;var _0x1a66b6=new History(_0x5491c6[_0xaac4('0x24')][_0xc39ca5]);logger['error'](util[_0xaac4('0x7a')](_0xaac4('0x193'),JSON[_0xaac4('0x49')](_0x5da8ea)));_0x1a66b6[_0xaac4('0xaa')]=0xe;_0x1a66b6['statedesc']=_0xaac4('0x194');_0x1a66b6[_0xaac4('0xac')]=moment()[_0xaac4('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');_0x1a66b6[_0xaac4('0xab')]=_0x1a66b6[_0xaac4('0xac')];_0x5491c6[_0xaac4('0xd0')](_0x1a66b6)[_0xaac4('0xb4')](loggerCatch('[originate][error]'));_0x5491c6[_0xaac4('0xce')](_0x1a66b6)[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x195')))[_0xaac4('0x1b')](function(){delete _0x5491c6['actions'][_0xc39ca5];return _0x49afc0(msgResponse(_0xaac4('0x16d'),_0xaac4('0x196'),'originate\x20action\x20Error'));});});});};Dialer[_0xaac4('0x18')][_0xaac4('0x30')]=function(_0x9208d1){var _0x2196f5=this[_0xaac4('0x24')][_0x9208d1[_0xaac4('0x12b')]];if(_0x2196f5){delete this[_0xaac4('0x24')][_0x9208d1[_0xaac4('0x12b')]];_0x2196f5[_0xaac4('0x11a')]=moment()[_0xaac4('0x7a')](_0xaac4('0x100'));var _0x352cf2=_0x2196f5['type']===_0xaac4('0x94')?this[_0xaac4('0x1f')][_0x2196f5[_0xaac4('0xb7')]]:this[_0xaac4('0x1e')][_0x2196f5['getQueue']()];if(!this[_0xaac4('0xdf')](_0x9208d1['response'])){this[_0xaac4('0xb6')](_0x352cf2);return this[_0xaac4('0x197')](_0x2196f5,_0x352cf2,_0x9208d1)[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x198')));}this['uniqueId'][_0x9208d1[_0xaac4('0xe4')]]=_0x2196f5;}};Dialer[_0xaac4('0x18')][_0xaac4('0x199')]=function(_0x47cab2,_0x4741cf,_0x57290f){var _0x4a30bb=new History(_0x4741cf);if(_0x4a30bb[_0xaac4('0xf8')]+_0x4a30bb[_0xaac4('0xf9')]+_0x4a30bb[_0xaac4('0xfa')]+_0x4a30bb[_0xaac4('0x19a')]+_0x4a30bb[_0xaac4('0x11f')]+_0x4a30bb['countabandonedretry']+_0x4a30bb[_0xaac4('0xf6')]+_0x4a30bb[_0xaac4('0xfb')]>=_0x57290f[_0xaac4('0x104')]-0x1){return!![];}switch(_0x47cab2){case 0x3:if(_0x4a30bb[_0xaac4('0xfa')]>=_0x57290f[_0xaac4('0x19b')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x4a30bb[_0xaac4('0xfa')]+=0x1,'scheduledat':moment()[_0xaac4('0xfe')](_0x57290f[_0xaac4('0x19c')],_0xaac4('0x121'))[_0xaac4('0x7a')](_0xaac4('0x100')),'ContactId':_0x4a30bb['ContactId'],'ListId':_0x4a30bb[_0xaac4('0x101')],'VoiceQueueId':_0x4a30bb['VoiceQueueId']||undefined,'CampaignId':_0x4a30bb[_0xaac4('0xdc')]||undefined})[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x19d')));break;case 0x5:if(_0x4a30bb[_0xaac4('0xf8')]>=_0x57290f[_0xaac4('0x19e')]-0x1){return!![];}this[_0xaac4('0xc3')]({'active':![],'countbusyretry':_0x4a30bb['countbusyretry']+=0x1,'scheduledat':moment()[_0xaac4('0xfe')](_0x57290f[_0xaac4('0x19f')],'minutes')[_0xaac4('0x7a')](_0xaac4('0x100')),'ContactId':_0x4a30bb[_0xaac4('0xd9')],'ListId':_0x4a30bb['ListId'],'VoiceQueueId':_0x4a30bb[_0xaac4('0xdb')]||undefined,'CampaignId':_0x4a30bb['CampaignId']||undefined})['catch'](loggerCatch(_0xaac4('0x1a0')));break;case 0x8:if(_0x4a30bb[_0xaac4('0xf9')]>=_0x57290f['dialCongestionMaxRetry']-0x1){return!![];}this[_0xaac4('0xc3')]({'active':![],'countcongestionretry':_0x4a30bb[_0xaac4('0xf9')]+=0x1,'scheduledat':moment()[_0xaac4('0xfe')](_0x57290f['dialCongestionRetryFrequency'],_0xaac4('0x121'))[_0xaac4('0x7a')](_0xaac4('0x100')),'ContactId':_0x4a30bb[_0xaac4('0xd9')],'ListId':_0x4a30bb['ListId'],'VoiceQueueId':_0x4a30bb[_0xaac4('0xdb')]||undefined,'CampaignId':_0x4a30bb['CampaignId']||undefined})[_0xaac4('0xb4')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x4a30bb[_0xaac4('0x19a')]>=_0x57290f['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0xaac4('0xc3')]({'active':![],'countnosuchnumberretry':_0x4a30bb[_0xaac4('0x19a')]+=0x1,'scheduledat':moment()[_0xaac4('0xfe')](_0x57290f[_0xaac4('0x1a1')],_0xaac4('0x121'))[_0xaac4('0x7a')](_0xaac4('0x100')),'ContactId':_0x4a30bb[_0xaac4('0xd9')],'ListId':_0x4a30bb[_0xaac4('0x101')],'VoiceQueueId':_0x4a30bb[_0xaac4('0xdb')]||undefined,'CampaignId':_0x4a30bb[_0xaac4('0xdc')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x4a30bb[_0xaac4('0x11f')]>=_0x57290f['dialDropMaxRetry']-0x1){return!![];}this[_0xaac4('0xc3')]({'active':![],'countdropretry':_0x4a30bb['countdropretry']+=0x1,'scheduledat':moment()[_0xaac4('0xfe')](_0x57290f[_0xaac4('0x1a2')],_0xaac4('0x121'))[_0xaac4('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4a30bb[_0xaac4('0xd9')],'ListId':_0x4a30bb[_0xaac4('0x101')],'VoiceQueueId':_0x4a30bb[_0xaac4('0xdb')]||undefined,'CampaignId':_0x4a30bb['CampaignId']||undefined})[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x122')));break;case 0xb:if(_0x4a30bb[_0xaac4('0x103')]>=_0x57290f[_0xaac4('0x128')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x4a30bb[_0xaac4('0x103')]+=0x1,'scheduledat':moment()[_0xaac4('0xfe')](_0x57290f['dialAbandonedRetryFrequency'],_0xaac4('0x121'))['format'](_0xaac4('0x100')),'ContactId':_0x4a30bb[_0xaac4('0xd9')],'ListId':_0x4a30bb[_0xaac4('0x101')],'VoiceQueueId':_0x4a30bb[_0xaac4('0xdb')]||undefined,'CampaignId':_0x4a30bb[_0xaac4('0xdc')]||undefined})[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x12a')));break;case 0x13:if(_0x4a30bb['countmachineretry']>=_0x57290f['dialMachineMaxRetry']-0x1){return!![];}this[_0xaac4('0xc3')]({'active':![],'countmachineretry':_0x4a30bb[_0xaac4('0xf6')]+=0x1,'scheduledat':moment()[_0xaac4('0xfe')](_0x57290f[_0xaac4('0xff')],_0xaac4('0x121'))[_0xaac4('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4a30bb['ContactId'],'ListId':_0x4a30bb[_0xaac4('0x101')],'VoiceQueueId':_0x4a30bb[_0xaac4('0xdb')]||undefined,'CampaignId':_0x4a30bb['CampaignId']||undefined})[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x108')));break;case 0x14:if(_0x4a30bb['countagentrejectretry']>=_0x57290f[_0xaac4('0x1a3')]-0x1){return!![];}this[_0xaac4('0xc3')]({'active':![],'countagentrejectretry':_0x4a30bb[_0xaac4('0xfb')]+=0x1,'scheduledat':moment()[_0xaac4('0xfe')](_0x57290f[_0xaac4('0x1a4')],_0xaac4('0x121'))['format'](_0xaac4('0x100')),'ContactId':_0x4a30bb[_0xaac4('0xd9')],'ListId':_0x4a30bb[_0xaac4('0x101')],'VoiceQueueId':_0x4a30bb[_0xaac4('0xdb')]||undefined,'CampaignId':_0x4a30bb[_0xaac4('0xdc')]||undefined})['catch'](loggerCatch(_0xaac4('0x1a5')));break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0x149e1f,_0x23d336,_0x1f0e45){var _0x173b34=this;var _0x153fec=new History(_0x149e1f);return new BPromise(function(_0x44dcef,_0x5e4cf7){if(_['isUndefined'](_0x23d336)&&typeof _0x23d336!==_0xaac4('0x16a')){return _0x5e4cf7(msgResponse(_0xaac4('0x1a6'),_0xaac4('0x146'),'entity\x20is\x20undefine'));}if(_[_0xaac4('0x3d')](_0x1f0e45)&&typeof _0x1f0e45!==_0xaac4('0x16a')){return _0x5e4cf7(msgResponse(_0xaac4('0x1a6'),_0xaac4('0x146'),_0xaac4('0x1a7')));}switch(_0x1f0e45[_0xaac4('0x111')]){case'0':_0x23d336['outboundNoSuchCallsDay']+=0x1;_0x153fec[_0xaac4('0xaa')]=0x0;_0x153fec['statedesc']='NoSuchNumber';_0x153fec[_0xaac4('0x19a')]+=0x1;_0x153fec[_0xaac4('0xf7')]+=0x1;ami[_0xaac4('0x4d')]('custom:agentnosuchnumber',ut[_0xaac4('0xef')](_0x149e1f,'nosuchnumber'));_0x173b34['createHistory'](_0x153fec)[_0xaac4('0xb4')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x173b34['checkRetriveMax'](0x0,_0x149e1f,_0x23d336)){if(_0x153fec['countnosuchnumberretry']>=_0x23d336['dialNoSuchNumberMaxRetry']){_0x173b34[_0xaac4('0x107')](_0x153fec,_0x44dcef,_0x5e4cf7,_0xaac4('0x1a8'));}else{_0x173b34[_0xaac4('0x105')](_0x153fec,_0x44dcef,_0x5e4cf7,_0xaac4('0x1a8'));}}break;case'3':_0x23d336[_0xaac4('0x1a9')]+=0x1;_0x153fec[_0xaac4('0xaa')]=0x3;_0x153fec[_0xaac4('0xeb')]='NoAnswer';_0x153fec[_0xaac4('0xfa')]+=0x1;_0x153fec['countglobal']+=0x1;ami[_0xaac4('0x4d')](_0xaac4('0x1aa'),ut[_0xaac4('0xef')](_0x149e1f,'noanswer'));_0x173b34[_0xaac4('0xd0')](_0x153fec)['catch'](loggerCatch(_0xaac4('0x1ab')));if(_0x173b34[_0xaac4('0x199')](0x3,_0x149e1f,_0x23d336)){if(_0x153fec[_0xaac4('0xfa')]>=_0x23d336[_0xaac4('0x19b')]){_0x173b34[_0xaac4('0x107')](_0x153fec,_0x44dcef,_0x5e4cf7,_0xaac4('0x1ac'));}else{_0x173b34[_0xaac4('0x105')](_0x153fec,_0x44dcef,_0x5e4cf7,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x23d336['outboundBusyCallsDay']+=0x1;_0x153fec[_0xaac4('0xaa')]=0x5;_0x153fec[_0xaac4('0xeb')]=_0xaac4('0x1ad');_0x153fec[_0xaac4('0xf8')]+=0x1;_0x153fec[_0xaac4('0xf7')]+=0x1;ami[_0xaac4('0x4d')](_0xaac4('0x1ae'),ut['buildObj'](_0x149e1f,'busy'));_0x173b34[_0xaac4('0xd0')](_0x153fec)[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x1af')));if(_0x173b34[_0xaac4('0x199')](0x5,_0x149e1f,_0x23d336)){if(_0x153fec[_0xaac4('0xf8')]>=_0x23d336[_0xaac4('0x19e')]){_0x173b34[_0xaac4('0x107')](_0x153fec,_0x44dcef,_0x5e4cf7,'reason\x205\x20busy');}else{_0x173b34[_0xaac4('0x105')](_0x153fec,_0x44dcef,_0x5e4cf7,'reason\x205\x20busy');}}break;case'8':_0x23d336[_0xaac4('0x60')]+=0x1;_0x153fec[_0xaac4('0xaa')]=0x8;_0x153fec[_0xaac4('0xeb')]=_0xaac4('0x1b0');_0x153fec[_0xaac4('0xf9')]+=0x1;_0x153fec[_0xaac4('0xf7')]+=0x1;ami[_0xaac4('0x4d')](_0xaac4('0x1b1'),ut[_0xaac4('0xef')](_0x149e1f,_0xaac4('0x1b2')));_0x173b34[_0xaac4('0xd0')](_0x153fec)[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x1b3')));if(_0x173b34[_0xaac4('0x199')](0x8,_0x149e1f,_0x23d336)){if(_0x153fec[_0xaac4('0xf9')]>=_0x23d336[_0xaac4('0x1b4')]){_0x173b34[_0xaac4('0x107')](_0x153fec,_0x44dcef,_0x5e4cf7,_0xaac4('0x1b5'));}else{_0x173b34[_0xaac4('0x105')](_0x153fec,_0x44dcef,_0x5e4cf7,_0xaac4('0x1b5'));}}break;case'11':_0x23d336[_0xaac4('0x1b6')]+=0x1;_0x153fec[_0xaac4('0xaa')]=0xb;_0x153fec['statedesc']=_0xaac4('0x126');_0x153fec[_0xaac4('0x103')]+=0x1;_0x153fec['countglobal']+=0x1;_0x173b34[_0xaac4('0xd0')](_0x153fec)['catch'](loggerCatch(_0xaac4('0x1b7')));if(_0x173b34[_0xaac4('0x199')](0xb,_0x149e1f,_0x23d336)){if(_0x153fec[_0xaac4('0x103')]>=_0x23d336['dialAbandonedMaxRetry']){_0x173b34[_0xaac4('0x107')](_0x153fec,_0x44dcef,_0x5e4cf7,_0xaac4('0x1b8'));}else{_0x173b34[_0xaac4('0x105')](_0x153fec,_0x44dcef,_0x5e4cf7,_0xaac4('0x1b8'));}}break;case'20':_0x23d336['outboundRejectCallsDay']+=0x1;_0x153fec[_0xaac4('0xaa')]=0x14;_0x153fec[_0xaac4('0xeb')]=_0xaac4('0x1b9');_0x153fec['countagentrejectretry']+=0x1;_0x153fec['countglobal']+=0x1;ami[_0xaac4('0x4d')](_0xaac4('0x1ba'),ut[_0xaac4('0xef')](_0x149e1f,_0xaac4('0x1bb')));_0x173b34[_0xaac4('0xd0')](_0x153fec)[_0xaac4('0xb4')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x173b34[_0xaac4('0x199')](0x14,_0x149e1f,_0x23d336)){if(_0x153fec['countagentrejectretry']>=_0x23d336['dialAgentRejectMaxRetry']){_0x173b34[_0xaac4('0x107')](_0x153fec,_0x44dcef,_0x5e4cf7,_0xaac4('0x1bc'));}else{_0x173b34[_0xaac4('0x105')](_0x153fec,_0x44dcef,_0x5e4cf7,_0xaac4('0x1bc'));}}break;default:_0x23d336[_0xaac4('0x10f')]+=0x1;_0x153fec[_0xaac4('0xaa')]=0xc;_0x153fec[_0xaac4('0xeb')]=_0x1f0e45[_0xaac4('0x111')];_0x173b34[_0xaac4('0xd0')](_0x153fec)['catch'](loggerCatch(_0xaac4('0x1bd')));if(_0x173b34[_0xaac4('0x199')](_0x1f0e45['reason'],_0x149e1f,_0x23d336)){if(_0x153fec[_0xaac4('0xf8')]+_0x153fec[_0xaac4('0xf9')]+_0x153fec[_0xaac4('0xfa')]+_0x153fec['countnosuchnumberretry']+_0x153fec['countdropretry']+_0x153fec['countabandonedretry']+_0x153fec[_0xaac4('0xf6')]+_0x153fec[_0xaac4('0xfb')]>=_0x23d336[_0xaac4('0x104')]){_0x173b34[_0xaac4('0x105')](_0x153fec,_0x44dcef,_0x5e4cf7,_0x1f0e45[_0xaac4('0x111')]);}else{_0x173b34[_0xaac4('0x107')](_0x153fec,_0x44dcef,_0x5e4cf7,_0x1f0e45[_0xaac4('0x111')]);}}}});};Dialer[_0xaac4('0x18')][_0xaac4('0x105')]=function(_0x50c438,_0x542bcf,_0x299ea0,_0x5f46aa){var _0x1520ad=new Final(_0x50c438);_0x1520ad[_0xaac4('0xaa')]=0xf;_0x1520ad[_0xaac4('0xeb')]=_0xaac4('0x1be');this['createStateFinal'](_0x1520ad,_0x542bcf,_0x299ea0,_0x5f46aa);};Dialer[_0xaac4('0x18')][_0xaac4('0x107')]=function(_0x344851,_0x23dd25,_0x13ee41,_0x103b7c){this['moveContactManagedDialer'](_0x344851)[_0xaac4('0xbb')](function(){return _0x23dd25(msgResponse(_0xaac4('0x1a6'),_0xaac4('0x1bf'),_0x103b7c));})[_0xaac4('0xb4')](function(){return _0x13ee41(msgResponse(_0xaac4('0x1c0'),_0xaac4('0x146'),'contact\x20not\x20moved'));});};Dialer['prototype'][_0xaac4('0xa')]=function(_0x5ba7c4){var _0x4228ce=_0x5ba7c4['dialPredictiveOptimizationPercentage']/0x64;var _0x4b98d1=_0x5ba7c4[_0xaac4('0x63')]/(_0x5ba7c4[_0xaac4('0x63')]+_0x5ba7c4['outboundAnswerCallsDay']);var _0x10d30c=Math[_0xaac4('0x1c1')](_0x5ba7c4[_0xaac4('0x70')]*(_0x5ba7c4['predictiveIntervalMaxThreshold']/0x64));var _0x4fb19a=Math[_0xaac4('0x1c1')](_0x5ba7c4[_0xaac4('0x70')]*(_0x5ba7c4[_0xaac4('0x1c2')]/0x64));var _0x155070=_0x5ba7c4[_0xaac4('0x50')]+_0x5ba7c4[_0xaac4('0xa3')];var _0x5bd3e9=Math[_0xaac4('0x1c3')](_0x5ba7c4[_0xaac4('0x73')]*_0x5ba7c4['erlangAbandonmentRate']*_0x5ba7c4[_0xaac4('0x6e')]*_0x5ba7c4[_0xaac4('0x1c4')]);if(_[_0xaac4('0x3d')](_0x5ba7c4[_0xaac4('0x77')])){if(!_['isUndefined'](_0x5ba7c4[_0xaac4('0x27')])){_0x5ba7c4[_0xaac4('0x27')]=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x5ba7c4['handlePredictive'])){loggerPredictive['error'](_0xaac4('0x1c5'),_0xaac4('0x1c6'));clearInterval(_0x5ba7c4[_0xaac4('0x1c7')]);_0x5ba7c4[_0xaac4('0x1c7')]=undefined;}_0x5ba7c4['startProgressive']=moment()[_0xaac4('0x7a')](_0xaac4('0x100'));loggerPredictive[_0xaac4('0x80')](_0x5ba7c4[_0xaac4('0x3f')],_0xaac4('0x1c8'),_0x5ba7c4['startProgressive']);this[_0xaac4('0x15c')](_0x5ba7c4,0x1);}else if(ifInterval(_0x5ba7c4[_0xaac4('0x1c9')],_0x5ba7c4['startProgressive'])){this['handlePower'](_0x5ba7c4,0x1);loggerPredictiveCalls[_0xaac4('0x80')](_0xaac4('0x1ca'),_0x5ba7c4[_0xaac4('0x77')],_0x5ba7c4[_0xaac4('0x3f')]);_0x5ba7c4[_0xaac4('0x73')]=0x0;_0x5ba7c4['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x4228ce<_0x4b98d1&&_0x5ba7c4['dialPredictiveOptimization']===_0xaac4('0x1cb')){freeVariablesPredictive(_0x5ba7c4);loggerPredictive['info'](_0xaac4('0x1cc'),_0xaac4('0x1cd'),_0x4b98d1,_0xaac4('0x77'),_0x5ba7c4[_0xaac4('0x3f')]);}else if(_0x5bd3e9<_0x5ba7c4['predictiveIntervalErlangCallsDroppedCalls']&&_0x5ba7c4[_0xaac4('0x1ce')]===_0xaac4('0x1cb')){freeVariablesPredictive(_0x5ba7c4);loggerPredictive[_0xaac4('0x80')](_0xaac4('0x1cf'),'Max\x20Drop\x20',_0x5bd3e9,_0xaac4('0x1d0'),_0x5ba7c4[_0xaac4('0x6d')],_0xaac4('0x77'),_0x5ba7c4[_0xaac4('0x3f')]);}else if(!ifInterval(_0x5ba7c4[_0xaac4('0x1c9')],_0x5ba7c4['startProgressive'])&&_[_0xaac4('0x3d')](_0x5ba7c4[_0xaac4('0x27')])&&!_[_0xaac4('0x3d')](_0x5ba7c4[_0xaac4('0x77')])){_0x5ba7c4[_0xaac4('0x27')]=moment()[_0xaac4('0x7a')](_0xaac4('0x100'));loggerPredictive[_0xaac4('0x80')](_0x5ba7c4[_0xaac4('0x3f')],_0xaac4('0x1d1'),_0x5ba7c4[_0xaac4('0x27')]);this[_0xaac4('0xc1')](_0x5ba7c4['dialPredictiveInterval'])[_0xaac4('0xbb')](this[_0xaac4('0x1d2')](_0x5ba7c4))[_0xaac4('0xbb')](mergeDataErlangB(_0x5ba7c4))[_0xaac4('0xbb')](this[_0xaac4('0x1d3')](_0x5ba7c4))['catch'](loggerCatchPredictive(_0xaac4('0x1d4'),_0x5ba7c4));}else if(!ifInterval(_0x5ba7c4[_0xaac4('0x1c9')],_0x5ba7c4[_0xaac4('0x27')])){_0x5ba7c4['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x5ba7c4['startPredictive']=moment()[_0xaac4('0x7a')](_0xaac4('0x100'));loggerPredictive['info'](_0x5ba7c4[_0xaac4('0x3f')],_0xaac4('0x1d5'),_0x5ba7c4['startPredictive']);clearInterval(_0x5ba7c4['handlePredictive']);_0x5ba7c4[_0xaac4('0x1c7')]=undefined;this[_0xaac4('0xc1')](_0x5ba7c4[_0xaac4('0x1c9')])[_0xaac4('0xbb')](this[_0xaac4('0x1d2')](_0x5ba7c4))[_0xaac4('0xbb')](mergeDataErlangB(_0x5ba7c4))[_0xaac4('0xbb')](this['startMethodPredictive'](_0x5ba7c4))[_0xaac4('0xb4')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x5ba7c4));}else if(_0x5ba7c4['predictiveIntervalAvailable']&&_0x155070<_0x5ba7c4[_0xaac4('0x70')]-_0x4fb19a){freeVariablesPredictive(_0x5ba7c4);loggerPredictive['info'](_0x5ba7c4[_0xaac4('0x3f')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x155070,_0xaac4('0x1d6'),_0x5ba7c4[_0xaac4('0x70')],'-',_0x4fb19a,'=',_0x5ba7c4[_0xaac4('0x70')]-_0x4fb19a,')');}else if(_0x5ba7c4[_0xaac4('0x70')]&&_0x155070>_0x5ba7c4[_0xaac4('0x70')]+_0x10d30c){freeVariablesPredictive(_0x5ba7c4);loggerPredictive[_0xaac4('0x80')](_0x5ba7c4['name'],_0xaac4('0x1d7'),_0x155070,_0xaac4('0x1d8'),_0x5ba7c4[_0xaac4('0x70')],'+',_0x10d30c,'=',_0x5ba7c4[_0xaac4('0x70')]+_0x10d30c,')');}};Dialer[_0xaac4('0x18')][_0xaac4('0x1d2')]=function(_0x39a960){var _0x2489cb=this;return function(_0x36bd1b){return new BPromise(function(_0x37fa99,_0x5940ae){_[_0xaac4('0x91')](_0x39a960,_0x36bd1b[0x0]);if(checkGetDataPredictive(_0x36bd1b[0x0])){var _0x12c263=_0x39a960[_0xaac4('0x70')]=_0x39a960[_0xaac4('0xa3')]+_0x39a960[_0xaac4('0x50')];var _0x346f39=_0x39a960[_0xaac4('0x1c9')]*0x3c;var _0x47f1b0=_0x36bd1b[0x0]['predictiveIntervalAvgTalktime']+_0x36bd1b[0x0][_0xaac4('0x69')];var _0x591e0d=(_0x36bd1b[0x0][_0xaac4('0x68')]+_0x36bd1b[0x0][_0xaac4('0x6b')]+_0x36bd1b[0x0][_0xaac4('0x85')])/_0x36bd1b[0x0][_0xaac4('0x71')];_0x39a960[_0xaac4('0x6e')]=_0x591e0d>0x0?_0x591e0d:0x1;switch(_0x39a960['dialPredictiveOptimization']){case _0xaac4('0x1cb'):var _0x1e9e9c=_0x39a960['dialPredictiveOptimizationPercentage']/0x64;return _0x2489cb[_0xaac4('0x1d9')](_0x12c263,_0x346f39,_0x47f1b0,_0x591e0d,_0x1e9e9c)['then'](function(_0x3fb60b){return _0x37fa99(_0x3fb60b);});case _0xaac4('0x1da'):var _0x401ad6=_0x39a960[_0xaac4('0x1db')]/0x64;return _0x2489cb['busyFactor'](_0x12c263,_0x346f39,_0x47f1b0,_0x591e0d,_0x401ad6)[_0xaac4('0xbb')](function(_0x30ca45){return _0x37fa99(_0x30ca45);});default:return _0x5940ae(msgResponse(_0xaac4('0x1dc'),_0xaac4('0x146'),_0xaac4('0x1dd')));}}else{return _0x5940ae(msgResponse(_0xaac4('0x1dc'),'Failure',_0xaac4('0x1de')));}});};};Dialer[_0xaac4('0x18')][_0xaac4('0x1df')]=function(_0x487bc4){var _0x1c65e2=this;return function(_0x50ea1c){return new BPromise(function(_0x12d620,_0x300fb2){_['merge'](_0x487bc4,_0x50ea1c[0x0]);if(checkGetDataPredictive(_0x50ea1c[0x0])){loggerPredictive[_0xaac4('0x80')](JSON[_0xaac4('0x49')](_0x50ea1c[0x0]));if(_0x487bc4[_0xaac4('0x1ce')]===_0xaac4('0x1cb')){return _0x1c65e2[_0xaac4('0xcc')](_0x487bc4['id'])[_0xaac4('0xbb')](function(_0x2fa144){var _0x2bd23c=_0x487bc4[_0xaac4('0x51')]-_0x2fa144[0x0][_0xaac4('0x1e0')];var _0x2e39b3=_0x487bc4[_0xaac4('0x1c9')]*0x3c;var _0x1fe92f=_0x50ea1c[0x0]['predictiveIntervalAvgTalktime']+_0x50ea1c[0x0]['predictiveIntervalAvgHoldtime'];var _0x295ddd=(_0x50ea1c[0x0][_0xaac4('0x68')]+_0x50ea1c[0x0][_0xaac4('0x6b')]+_0x50ea1c[0x0][_0xaac4('0x85')])/_0x50ea1c[0x0][_0xaac4('0x71')];var _0x1ae33e=_0x487bc4[_0xaac4('0x1db')]/0x64;_0x487bc4[_0xaac4('0x6f')]=_0x2fa144[0x0][_0xaac4('0x1e0')]||0x0;_0x487bc4[_0xaac4('0x6e')]=_0x295ddd>0x0?_0x295ddd:0x1;return _0x1c65e2[_0xaac4('0x1d9')](_0x2bd23c,_0x2e39b3,_0x1fe92f,_0x295ddd,_0x1ae33e);})[_0xaac4('0xbb')](function(_0x15ecaa){return _0x12d620(_0x15ecaa);})[_0xaac4('0xb4')](function(_0x5448e8){return _0x300fb2(msgResponse(_0xaac4('0x1e1'),_0xaac4('0x146'),JSON[_0xaac4('0x49')](_0x5448e8)));});}if(_0x487bc4[_0xaac4('0x1ce')]===_0xaac4('0x1da')){return _0x1c65e2[_0xaac4('0xcc')](_0x487bc4['id'])[_0xaac4('0xbb')](function(_0x50bdee){var _0x63602a=_0x487bc4[_0xaac4('0x51')]-_0x50bdee[0x0]['outboundQueuePauses'];var _0x2a413f=_0x487bc4[_0xaac4('0x1c9')]*0x3c;var _0x5f5cdf=_0x50ea1c[0x0]['predictiveIntervalAvgTalktime']+_0x50ea1c[0x0][_0xaac4('0x69')];var _0x463421=(_0x50ea1c[0x0][_0xaac4('0x68')]+_0x50ea1c[0x0][_0xaac4('0x6b')]+_0x50ea1c[0x0][_0xaac4('0x85')])/_0x50ea1c[0x0][_0xaac4('0x71')];var _0x160c10=_0x487bc4[_0xaac4('0x1db')]/0x64;_0x487bc4[_0xaac4('0x6f')]=_0x50bdee[0x0][_0xaac4('0x1e0')]||0x0;_0x487bc4[_0xaac4('0x6e')]=_0x463421>0x0?_0x463421:0x1;return _0x1c65e2[_0xaac4('0x1e2')](_0x63602a,_0x2a413f,_0x5f5cdf,_0x463421,_0x160c10);})[_0xaac4('0xbb')](function(_0x45fab1){return _0x12d620(_0x45fab1);})[_0xaac4('0xb4')](function(_0x4cd630){return _0x300fb2(msgResponse(_0xaac4('0x1e1'),_0xaac4('0x146'),JSON[_0xaac4('0x49')](_0x4cd630)));});}}else{return _0x300fb2(msgResponse(_0xaac4('0x1dc'),_0xaac4('0x146'),'check\x20failure'));}});};};Dialer[_0xaac4('0x18')][_0xaac4('0x1d3')]=function(_0xd3a87b){var _0x27e033=this;return function(){var _0x3b4e8e=0x0;var _0x2b1d23=Math[_0xaac4('0x1c3')](_0xd3a87b[_0xaac4('0x74')]*0x3e8);if(_0x2b1d23>0x0){_0x2b1d23=_0x2b1d23<0x64?0x64:_0x2b1d23;loggerPredictive['info'](_0xd3a87b[_0xaac4('0x3f')],_0xaac4('0x1e3'),_0x2b1d23,'milliseconds');_0xd3a87b['handlePredictive']=setInterval(function(){_0x27e033[_0xaac4('0x1c7')](_0xd3a87b);loggerPredictiveCalls[_0xaac4('0x80')](_0xaac4('0x1e4'),_0x3b4e8e+=0x1);},_0x2b1d23);}else{loggerPredictive[_0xaac4('0x80')](_0xd3a87b[_0xaac4('0x3f')],_0xaac4('0x1e5'));}};};Dialer[_0xaac4('0x18')][_0xaac4('0x1e6')]=function(_0x5bb9db,_0x577fff){var _0xe0ad18=this;return function(_0x1134e8){if(_[_0xaac4('0x7e')](_0x1134e8)){if(_[_0xaac4('0xb0')](_0x577fff[_0xaac4('0xda')])||!_0x577fff[_0xaac4('0x1e7')]){if(_0x5bb9db[_0xaac4('0x5a')]==='booked'){_0x5bb9db[_0xaac4('0x132')]=_[_0xaac4('0x3d')](_0x5bb9db[_0xaac4('0x132')])?!![]:_0x5bb9db[_0xaac4('0x132')];var _0x1eb463=uuid['v4']();_0xe0ad18[_0xaac4('0x24')][_0x1eb463]=new Action(_0x5bb9db,_0x577fff,_0x1eb463);loggerBooked[_0xaac4('0x80')]('[booked][checkContactBlack]',_0x1eb463,'queueStatusComplete:\x20',JSON['stringify'](_0x5bb9db['queueStatusComplete']),_0xaac4('0x1e8'),_0x5bb9db[_0xaac4('0x3f')]);if(_0x5bb9db[_0xaac4('0x132')]){_0x5bb9db['queueStatusComplete']=![];_0xe0ad18[_0xaac4('0x29')][_0xe0ad18['actions'][_0x1eb463][_0xaac4('0xb7')]]=[];ami[_0xaac4('0xb1')]({'actionid':_0x1eb463,'action':_0xaac4('0x1e9'),'queue':_0x5bb9db[_0xaac4('0x3f')]})[_0xaac4('0xb4')](function(){_0xe0ad18[_0xaac4('0xb6')](_0x5bb9db);_0xe0ad18['rescheduleContact']({'active':![],'ContactId':_0xe0ad18['actions'][_0x1eb463]['ContactId'],'ListId':_0xe0ad18[_0xaac4('0x24')][_0x1eb463][_0xaac4('0x101')],'VoiceQueueId':_0xe0ad18[_0xaac4('0x24')][_0x1eb463][_0xaac4('0xdb')]||undefined,'CampaignId':_0xe0ad18[_0xaac4('0x24')][_0x1eb463][_0xaac4('0xdc')]||undefined})[_0xaac4('0xb4')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0xe0ad18[_0xaac4('0x24')][_0x1eb463];});}else{loggerBooked[_0xaac4('0x80')]('[booked][checkContactBlack][else]',JSON[_0xaac4('0x49')](_0x5bb9db[_0xaac4('0x132')]),'Queue:\x20',_0x5bb9db[_0xaac4('0x3f')]);_0xe0ad18[_0xaac4('0xb6')](_0x5bb9db);_0xe0ad18[_0xaac4('0xc3')]({'active':![],'ContactId':_0xe0ad18[_0xaac4('0x24')][_0x1eb463]['ContactId'],'ListId':_0xe0ad18[_0xaac4('0x24')][_0x1eb463][_0xaac4('0x101')],'VoiceQueueId':_0xe0ad18[_0xaac4('0x24')][_0x1eb463][_0xaac4('0xdb')]||undefined,'CampaignId':_0xe0ad18['actions'][_0x1eb463]['CampaignId']||undefined})[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x1ea')));delete _0xe0ad18[_0xaac4('0x24')][_0x1eb463];}}else{return _0xe0ad18[_0xaac4('0x169')](_0x5bb9db,_0x577fff);}}else{if(getDiff(_0x577fff[_0xaac4('0x1eb')])<_0x5bb9db[_0xaac4('0x1ec')]*0x3c){if(_0x577fff[_0xaac4('0x1ed')]&&!_0x577fff[_0xaac4('0x1ed')][_0xaac4('0x1ee')]){_0xe0ad18['preview'][_0xaac4('0x134')](_0x577fff['id'])[_0xaac4('0x1b')](function(){_0xe0ad18['updateOriginated'](_0x5bb9db);});}else{_0xe0ad18[_0xaac4('0xc5')]({'active':![]},_0x577fff['id'],0x1)[_0xaac4('0x1b')](function(){_0xe0ad18[_0xaac4('0xb6')](_0x5bb9db);});}}else{_0x5bb9db['outboundReCallsDay']+=0x1;_0xe0ad18['updateOriginated'](_0x5bb9db);if(_0x5bb9db[_0xaac4('0x1ef')]){_0xe0ad18[_0xaac4('0xc3')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x577fff[_0xaac4('0xd9')],'ListId':_0x577fff[_0xaac4('0x101')],'VoiceQueueId':_0x577fff[_0xaac4('0xdb')]||undefined,'CampaignId':_0x577fff['CampaignId']||undefined})[_0xaac4('0xb4')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0xe0ad18[_0xaac4('0xd0')](createObjHistory(_0x5bb9db,_0x577fff,_0xaac4('0x1f0'),0x17,'RecallInQueue'))[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x1f1')));}else{_0xe0ad18[_0xaac4('0xd7')](createObjHistory(_0x5bb9db,_0x577fff,_0xaac4('0x1f2'),0x16,_0xaac4('0x1f3')),_0xaac4('0x1f4'),_0xaac4('0x1f5'));}}}}else{_0x5bb9db['outboundBlacklistCallsDay']+=0x1;_0xe0ad18[_0xaac4('0xd7')](createObjHistory(_0x5bb9db,_0x577fff,_0xaac4('0x1f6'),0xd,_0xaac4('0x1f7')),_0xaac4('0x1f8'),'[Originate][MoveBlacklist]');throw _0xaac4('0x1f9');}};};Dialer[_0xaac4('0x18')][_0xaac4('0x1fa')]=function(_0x2a189c){var _0x2ea627=this;var _0x1c5967=_0x2a189c['limitCalls']-_0x2a189c[_0xaac4('0x72')]-_0x2a189c[_0xaac4('0xc8')];emitCampaignSummary(_0x2a189c);if(_0x1c5967>0x0){if(_0x1c5967>this[_0xaac4('0x22')]){_0x1c5967=this[_0xaac4('0x22')];}_0x2a189c[_0xaac4('0xc8')]+=_0x1c5967;this[_0xaac4('0xca')](_0x2a189c['id'],_0x1c5967,_0x2a189c[_0xaac4('0x1fb')],_0x2a189c)['then'](function(_0x11ac88){_0x2a189c[_0xaac4('0xc8')]-=_0x1c5967;_0x2a189c[_0xaac4('0xc8')]=_0x2a189c[_0xaac4('0xc8')]>0x0?_0x2a189c[_0xaac4('0xc8')]:0x0;if(!checkContactEmpty(_0x11ac88)){_0x2a189c[_0xaac4('0x44')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xaac4('0x80')](_0xaac4('0x1fc')+_0x2a189c['name']);}else{_0x2a189c[_0xaac4('0x72')]+=_0x11ac88[_0xaac4('0x99')];_0x2a189c['message']=_0xaac4('0x1fd');for(var _0x3299b2=0x0;_0x3299b2<_0x11ac88[_0xaac4('0x99')];_0x3299b2+=0x1){_0x2a189c['ivrTotalCallsDays']+=0x1;if(_[_0xaac4('0xb0')](_0x11ac88[_0x3299b2])||_[_0xaac4('0xb0')](_0x11ac88[_0x3299b2][_0xaac4('0x16b')])||_[_0xaac4('0xb0')](_0x11ac88[_0x3299b2][_0xaac4('0x16b')][_0xaac4('0x16c')])){_0x2ea627[_0xaac4('0xd5')](_0xaac4('0x1fe'),_0x2a189c,_0x11ac88[_0x3299b2]);}else{_0x2ea627['checkIsBlackListIvr'](_['pick'](_0x11ac88[_0x3299b2],[_0xaac4('0xdc'),_0xaac4('0x1ff')]))[_0xaac4('0xbb')](_0x2ea627['checkContactBlack'](_0x2a189c,_0x11ac88[_0x3299b2]))['catch'](_0x2ea627[_0xaac4('0xd4')](_0xaac4('0x200'),_0x2a189c));}}}})[_0xaac4('0xb4')](loggerGetContactDialer(_0xaac4('0x201'),_0x2a189c,_0x1c5967));}};Dialer[_0xaac4('0x18')][_0xaac4('0x15c')]=function(_0x934da0,_0x32a855){var _0x47a82a=this;var _0x30b304=[];var _0x59b4a5=_0x32a855>=0x1?_0x32a855:0x1;if(_0x934da0[_0xaac4('0x5a')]==='booked'){_0x59b4a5=0x1;}var _0x42cc88=Math['floor'](_0x934da0[_0xaac4('0x50')]*_0x59b4a5)-_0x934da0['originated']-_0x934da0[_0xaac4('0xc8')];emitVoiceQueueSummary(_0x934da0);if(_0x934da0[_0xaac4('0x202')]>0x0){var _0xd592d7=_0x934da0[_0xaac4('0x202')]-_0x934da0[_0xaac4('0x72')]-_0x934da0[_0xaac4('0xa3')]-_0x934da0[_0xaac4('0xc8')]-_0x934da0['pTalking'];if(_0x42cc88>_0xd592d7){_0x42cc88=_0xd592d7;}}if(_0x42cc88>0x0){if(_0x934da0[_0xaac4('0x5a')]==='booked'){_0x42cc88=0x1;}if(_0x42cc88>this[_0xaac4('0x22')]){_0x42cc88=this['maxNumberOriginate'];}_0x934da0[_0xaac4('0xc8')]+=_0x42cc88;for(var _0x3057ae in this[_0xaac4('0x20')]){if(typeof this[_0xaac4('0x20')][_0x3057ae]!=='undefined'){if(this[_0xaac4('0x20')][_0x3057ae][_0xaac4('0xaa')]===_0xaac4('0x203')&&this['agents'][_0x3057ae]['status']===_0xaac4('0xe2')){_0x30b304[_0xaac4('0x130')](this[_0xaac4('0x20')][_0x3057ae]['id']);}}}this[_0xaac4('0xc7')](_0x934da0['id'],_0x30b304,_0x42cc88,_0x934da0[_0xaac4('0x1fb')],_0x934da0)[_0xaac4('0xbb')](function(_0x3bceeb){_0x934da0[_0xaac4('0xc8')]-=_0x42cc88;_0x934da0['temp']=_0x934da0[_0xaac4('0xc8')]>0x0?_0x934da0[_0xaac4('0xc8')]:0x0;if(!checkContactEmpty(_0x3bceeb)){_0x47a82a[_0xaac4('0xbc')](_0x934da0)[_0xaac4('0xbb')](sendMessageReschedule(_0x934da0))[_0xaac4('0xb4')](loggerCatch(_0xaac4('0xbd')));}else{_0x934da0[_0xaac4('0x72')]+=_0x3bceeb[_0xaac4('0x99')];_0x934da0[_0xaac4('0x44')]=_0x934da0[_0xaac4('0x5a')]===_0xaac4('0x9')?_0xaac4('0x173'):'RUNNING';for(var _0x1ba72e=0x0;_0x1ba72e<_0x3bceeb[_0xaac4('0x99')];_0x1ba72e+=0x1){if(_['isNil'](_0x3bceeb[_0x1ba72e])||_[_0xaac4('0xb0')](_0x3bceeb[_0x1ba72e][_0xaac4('0x16b')])||_[_0xaac4('0xb0')](_0x3bceeb[_0x1ba72e][_0xaac4('0x16b')][_0xaac4('0x16c')])){_0x47a82a[_0xaac4('0xd5')]('[actionOriginate]\x20',_0x934da0,_0x3bceeb[_0x1ba72e]);}else{_0x47a82a[_0xaac4('0xbe')](_[_0xaac4('0xd8')](_0x3bceeb[_0x1ba72e],[_0xaac4('0xdb'),'Contact.phone']))[_0xaac4('0xbb')](_0x47a82a[_0xaac4('0x1e6')](_0x934da0,_0x3bceeb[_0x1ba72e]))[_0xaac4('0xb4')](_0x47a82a[_0xaac4('0xd4')](_0xaac4('0x1fe'),_0x934da0));}}}})['catch'](loggerGetContactDialer(_0xaac4('0x204'),_0x934da0,_0x42cc88));}};Dialer[_0xaac4('0x18')][_0xaac4('0x1c7')]=function(_0x1e897a){if(_0x1e897a[_0xaac4('0x202')]>0x0){var _0x341acb=_0x1e897a[_0xaac4('0x202')]-_0x1e897a['originated']-_0x1e897a[_0xaac4('0xa3')];if(_0x341acb>0x0){this[_0xaac4('0x205')](_0x1e897a);}else{loggerPredictiveCalls[_0xaac4('0x80')](_0xaac4('0x206'));}}else{this[_0xaac4('0x205')](_0x1e897a);}};Dialer[_0xaac4('0x18')][_0xaac4('0x205')]=function(_0xb25bfc){var _0x236c5a=this;var _0x1834da=[];_0xb25bfc[_0xaac4('0x72')]+=0x1;for(var _0x58f704 in this[_0xaac4('0x20')]){if(typeof this[_0xaac4('0x20')][_0x58f704]!==_0xaac4('0x9a')){if(this[_0xaac4('0x20')][_0x58f704][_0xaac4('0xaa')]===_0xaac4('0x203')&&this[_0xaac4('0x20')][_0x58f704][_0xaac4('0xb2')]==='reachable'){_0x1834da['push'](this[_0xaac4('0x20')][_0x58f704]['id']);}}}this[_0xaac4('0xc7')](_0xb25bfc['id'],_0x1834da,0x1,_0xb25bfc[_0xaac4('0x1fb')],_0xb25bfc)[_0xaac4('0xbb')](function(_0x5bca64){if(!checkContactEmpty(_0x5bca64)){checkContactLowerLimitOriginate(_0xb25bfc,0x1,0x0);_0x236c5a[_0xaac4('0xbc')](_0xb25bfc)[_0xaac4('0xbb')](sendMessageReschedule(_0xb25bfc))[_0xaac4('0xb4')](loggerCatch('[countReScheduled]\x20'));}else{_0xb25bfc[_0xaac4('0x44')]='RUNNING';if(_[_0xaac4('0xb0')](_0x5bca64[0x0])||_[_0xaac4('0xb0')](_0x5bca64[0x0][_0xaac4('0x16b')])||_[_0xaac4('0xb0')](_0x5bca64[0x0]['Contact']['phone'])){_0x236c5a[_0xaac4('0xd5')]('[actionOriginate]\x20',_0xb25bfc,_0x5bca64[0x0]);}else{_0x236c5a[_0xaac4('0xbe')](_['pick'](_0x5bca64[0x0],[_0xaac4('0xdb'),'Contact.phone']))[_0xaac4('0xbb')](_0x236c5a[_0xaac4('0x1e6')](_0xb25bfc,_0x5bca64[0x0]))[_0xaac4('0xb4')](_0x236c5a['loggerHandler'](_0xaac4('0x207'),_0xb25bfc));}}})[_0xaac4('0xb4')](loggerGetContactDialer(_0xaac4('0x208'),_0xb25bfc,0x1));emitVoiceQueueSummary(_0xb25bfc);};Dialer[_0xaac4('0x18')][_0xaac4('0x1d9')]=function(_0x423087,_0x562789,_0x5484c0,_0x218028,_0x5bedce,_0xf45fc1){loggerPredictive[_0xaac4('0x80')](_0xaac4('0x209'));loggerPredictive[_0xaac4('0x80')](_0xaac4('0x20a'),_0x423087);loggerPredictive[_0xaac4('0x80')](_0xaac4('0x20b'),_0x562789);loggerPredictive['info'](_0xaac4('0x20c'),_0x5484c0);loggerPredictive[_0xaac4('0x80')]('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',_0x218028);loggerPredictive[_0xaac4('0x80')](_0xaac4('0x20d'),_0x5bedce);loggerPredictive[_0xaac4('0x80')](_0xaac4('0x88'));return new BPromise(function(_0xe61b98,_0x51fadc){if(_0x423087<=0x0||isNaN(_0x423087)){return _0x51fadc(msgResponse(_0xaac4('0x20e'),_0xaac4('0x196'),_0xaac4('0x20f')+_0x423087));}if(_0x5484c0<=0x0||isNaN(_0x5484c0)){return _0x51fadc(msgResponse(_0xaac4('0x20e'),_0xaac4('0x196'),_0xaac4('0x210')+_0x5484c0));}if(_0x218028<=0x0||isNaN(_0x218028)){return _0x51fadc(msgResponse(_0xaac4('0x20e'),_0xaac4('0x196'),_0xaac4('0x211')+_0x218028));}if(_0x562789<=0x0||isNaN(_0x562789)){return _0x51fadc(msgResponse('[abandonmentRate]',_0xaac4('0x196'),'interval\x20=\x20'+_0x562789));}if(_0x5bedce<=0x0||isNaN(_0x5bedce)){return _0x51fadc(msgResponse(_0xaac4('0x20e'),_0xaac4('0x196'),'Amax\x20=\x20'+_0x5bedce));}_0xf45fc1=_0xf45fc1||0x0;var _0x17027c=0x1/_0x5484c0;var _0xb95c5d=0x0;var _0x47dc6d=0x0;var _0x4649be=0x0;var _0x405b4c=0x0;for(var _0x1112d0=0x0;_0x4649be<_0x5bedce;_0x1112d0+=0x1){_0x47dc6d=_0x1112d0/_0x562789;_0xb95c5d=(_0x218028*_0x47dc6d+_0xf45fc1)/_0x17027c;_0x4649be=erlangb(_0xb95c5d,_0x423087);_0x405b4c=_0xb95c5d/_0x423087*(0x1-erlangb(_0xb95c5d,_0x423087));}return _0xe61b98({'erlangCalls':_0x1112d0,'erlangCallToSecond':_0x562789/_0x1112d0,'erlangAbandonmentRate':_0x4649be,'erlangBusyFactor':_0x405b4c});});};Dialer[_0xaac4('0x18')][_0xaac4('0x1e2')]=function(_0x5504ca,_0x826776,_0x352b8e,_0x516d53,_0x1e2945,_0x2a5e07){loggerPredictive[_0xaac4('0x80')](_0xaac4('0x212'));loggerPredictive['info'](_0xaac4('0x20a'),_0x5504ca);loggerPredictive[_0xaac4('0x80')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x826776);loggerPredictive[_0xaac4('0x80')](_0xaac4('0x20c'),_0x352b8e);loggerPredictive['info'](_0xaac4('0x213'),_0x516d53);loggerPredictive[_0xaac4('0x80')](_0xaac4('0x214'),_0x1e2945);loggerPredictive[_0xaac4('0x80')](_0xaac4('0x88'));return new BPromise(function(_0x43b406,_0x3e2c50){if(_0x5504ca<=0x0||isNaN(_0x5504ca)){return _0x3e2c50(msgResponse(_0xaac4('0x215'),_0xaac4('0x196'),_0xaac4('0x20f')+_0x5504ca));}if(_0x352b8e<=0x0||isNaN(_0x352b8e)){return _0x3e2c50(msgResponse(_0xaac4('0x215'),_0xaac4('0x196'),_0xaac4('0x210')+_0x352b8e));}if(_0x516d53<=0x0||isNaN(_0x516d53)){return _0x3e2c50(msgResponse(_0xaac4('0x215'),_0xaac4('0x196'),'p\x20=\x20'+_0x516d53));}if(_0x826776<=0x0||isNaN(_0x826776)){return _0x3e2c50(msgResponse(_0xaac4('0x215'),_0xaac4('0x196'),'interval\x20=\x20'+_0x826776));}if(_0x1e2945<=0x0||isNaN(_0x1e2945)){return _0x3e2c50(msgResponse(_0xaac4('0x215'),_0xaac4('0x196'),_0xaac4('0x216')+_0x1e2945));}_0x2a5e07=_0x2a5e07||0x0;var _0x7b1340=0x1/_0x352b8e;var _0x585522=0x0;var _0x1644ed=0x0;var _0x541c96=0x0;var _0xb045b9=0x0;for(var _0x408949=0x0;_0xb045b9<_0x1e2945;_0x408949+=0x1){_0x1644ed=_0x408949/_0x826776;_0x585522=(_0x516d53*_0x1644ed+_0x2a5e07)/_0x7b1340;_0x541c96=erlangb(_0x585522,_0x5504ca);_0xb045b9=_0x585522/_0x5504ca*(0x1-erlangb(_0x585522,_0x5504ca));}return _0x43b406({'erlangCalls':_0x408949,'erlangCallToSecond':_0x826776/_0x408949,'erlangAbandonmentRate':_0x541c96,'erlangBusyFactor':_0xb045b9});});};module[_0xaac4('0x217')]=Dialer; \ No newline at end of file +var _0x03bc=['object','voiceQueue\x20is\x20undefine','Contact','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','createdAt','updatedAt','XMD-','toUpper','callerid','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','[rescheduleContact][Abandoned]','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','stateGlobal','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','checkRetriveMax','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','AgentReject','custom:agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','erlangAbandonmentRate','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','averageHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalDroppedCallsCallersExit','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','dialRecallMeTimeout','Agent','[rescheduleContact][dialRecallInQueue]','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','checkContactBlack','[actionOriginateIvr]\x20','dialLimitQueue','reachable','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\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','m\x20=\x20','[abandonmentRate]','p\x20=\x20','Amax\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','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','exports','util','bluebird','uuid','md5','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictiveCalls','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/voiceQueueRt','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','roundrobin','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBookedRR','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','custom:queuesummary','hangup','syncHangup','syncNewExten','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','seconds','emit','type','outbound','strategy','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','Trunk','active','voice_queue:save','format','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\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','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','sendMessageOneNotActive','is\x20not\x20active','is\x20disactive','state','statedesc','starttime','prototype','[actions]','clearZombieChannels','sequence','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','checkIsBlackListIvr','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','notFound','saveInDb','merge','pick','ContactId','ListId','UserId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','unmonitored','moveContactManagedDialer','syncVarSet','uniqueid','amdstatus','exten','dialAMDActive','value','outboundAnswerCallsDay','HangupInAMD','membername','AMD','custom:amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','countglobal','buildObj','amd','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','createStateFinal','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','CampaignId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','Machine','[syncAgentComplete][createHistory][0]','countnosuchnumberretry','reason19\x20machine....','ivrAnswerCallsDay','dialQueueProject','AnswerAGI','outboundUnknownCallsDay','cause-txt','Unknow','syncAgentComplete','reason','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','dropreason','TIMEOUT','dialDropMaxRetry','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','endtime','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','rrmemory','queueBooked','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','_rr','length','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','isArray','command','iftime\x20%s,%s','content','indexOf','true','push','all','some','GLOBAL_INTERVAL_IS_OVERTIME','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','power','handlePower','predictive','booked','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','[syncCampaigns]','\x5cw{0,','pow','replace','match'];(function(_0x37975c,_0x1067f1){var _0x34feda=function(_0x291ecb){while(--_0x291ecb){_0x37975c['push'](_0x37975c['shift']());}};_0x34feda(++_0x1067f1);}(_0x03bc,0xb8));var _0xc03b=function(_0xfc7799,_0x39c31e){_0xfc7799=_0xfc7799-0x0;var _0x5ebecb=_0x03bc[_0xfc7799];return _0x5ebecb;};'use strict';var util=require(_0xc03b('0x0'));var _=require('lodash');var BPromise=require(_0xc03b('0x1'));var uuid=require(_0xc03b('0x2'));var moment=require('moment');var rr=require('rr');var md5=require(_0xc03b('0x3'));var Redis=require('ioredis');var ut=require(_0xc03b('0x4'));var config=require(_0xc03b('0x5'));var logger=require(_0xc03b('0x6'))(_0xc03b('0x7'));var loggerBooked=require(_0xc03b('0x6'))('booked');var loggerPredictive=require(_0xc03b('0x6'))('predictive');var loggerPredictiveCalls=require(_0xc03b('0x6'))(_0xc03b('0x8'));var loggerSyncQueueSummary=require(_0xc03b('0x6'))(_0xc03b('0x9'));var ami=require(_0xc03b('0xa'));config[_0xc03b('0xb')]=_[_0xc03b('0xc')](config[_0xc03b('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0xc03b('0xd'))(new Redis(config['redis']));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xc03b('0xe'));var Action=require('./action');var History=require('./history');var Final=require('./final');var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0xc03b('0xf'));var Hangup=require(_0xc03b('0x10'));var ipAgi=process[_0xc03b('0x11')][_0xc03b('0x12')]||_0xc03b('0x13');var strategy={'rrmemory':'rrmemory','roundrobin':_0xc03b('0x14')};var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x4fd12e){this[_0xc03b('0x15')]=this[_0xc03b('0x15')]?this[_0xc03b('0x15')][_0xc03b('0x16')](_0x4fd12e):_0x4fd12e();};function Dialer(_0x14b4c1,_0x5c9d20){this['sequence']=new Sequence();this[_0xc03b('0x17')]=_0x5c9d20;this[_0xc03b('0x18')]=_0x14b4c1[_0xc03b('0x18')];this[_0xc03b('0x19')]=_0x14b4c1['campaigns'];this[_0xc03b('0x1a')]=_0x14b4c1[_0xc03b('0x1a')];this[_0xc03b('0x1b')]=_0x14b4c1['trunks'];this['maxNumberOriginate']=config[_0xc03b('0x1c')]||0x2;this[_0xc03b('0x1d')]={};this[_0xc03b('0x1e')]={};this[_0xc03b('0x1f')]={};this[_0xc03b('0x20')]={};this[_0xc03b('0x21')]={};this['startPredictive']={};this[_0xc03b('0x22')]={};this[_0xc03b('0x23')]={};this['queueBooked']={};this[_0xc03b('0x24')]={};ami['on'](_0xc03b('0x25'),this[_0xc03b('0x26')]['bind'](this));ami['on'](_0xc03b('0x27'),this[_0xc03b('0x28')][_0xc03b('0x29')](this));ami['on'](_0xc03b('0x2a'),this[_0xc03b('0x2b')][_0xc03b('0x29')](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0xc03b('0x29')](this));ami['on'](_0xc03b('0x2c'),this[_0xc03b('0x9')][_0xc03b('0x29')](this));ami['on'](_0xc03b('0x2d'),this[_0xc03b('0x2e')][_0xc03b('0x29')](this));ami['on']('newexten',this[_0xc03b('0x2f')][_0xc03b('0x29')](this));ami['on']('varset',this['syncVarSet'][_0xc03b('0x29')](this));ami['on']('queuemember',this[_0xc03b('0x30')][_0xc03b('0x29')](this));ami['on'](_0xc03b('0x31'),this[_0xc03b('0x32')][_0xc03b('0x29')](this));this[_0xc03b('0x33')]();this[_0xc03b('0x34')]();}function isNotNull(_0x42cfbb){return _0x42cfbb!==null&&!_[_0xc03b('0x35')](_0x42cfbb);}function checkIsLoggedIn(_0x2b52bd,_0x3a3954){return function(){if(_0x3a3954<=0x0){_0x2b52bd[_0xc03b('0x36')]=_0xc03b('0x37');throw _0x2b52bd[_0xc03b('0x38')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x34ee51){return _0x34ee51;}function checkIsActive(_0xeba9b4,_0x317a40){return function(){if(!isActive(_0x317a40)){_0xeba9b4[_0xc03b('0x36')]=_0xc03b('0x39');throw _0xeba9b4[_0xc03b('0x38')]+_0xc03b('0x3a');}};}function checkInterval(_0x246dd1){return function(){if(!isNotNull(_0x246dd1[_0xc03b('0x3b')])){_0x246dd1[_0xc03b('0x36')]=_0xc03b('0x3c');throw _0x246dd1['name']+_0xc03b('0x3d');}if(!isNotNull(_0x246dd1['Interval'][_0xc03b('0x3e')])){_0x246dd1['message']=_0xc03b('0x3c');throw _0x246dd1['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xc03b('0x3f')](_0x246dd1[_0xc03b('0x3b')][_0xc03b('0x3e')]))){_0x246dd1[_0xc03b('0x36')]=_0xc03b('0x3c');throw _0x246dd1[_0xc03b('0x38')]+_0xc03b('0x3d');}};}function msgResponse(_0x5ffbd7,_0x28b9d2,_0x15a6b8){return{'action':_0x5ffbd7,'response':_0x28b9d2,'message':_0x15a6b8,'stack':_0x15a6b8};}function myreject(_0x3dae07){return function(_0x240d92){return _0x3dae07(msgResponse(_0xc03b('0x40'),_0xc03b('0x41'),JSON[_0xc03b('0x42')](_0x240d92)));};}function getSeconds(_0x45e7a5,_0x31ed82){var _0x367729=moment(_0x45e7a5)['milliseconds'](0x0);var _0x4a61db=moment(_0x31ed82)[_0xc03b('0x43')](0x0);return _0x367729['diff'](_0x4a61db,_0xc03b('0x44'));}function emit(_0x2e311c,_0x15553b,_0x287fe9){io['to'](_0x2e311c)[_0xc03b('0x45')](_0x15553b,_0x287fe9);}function emitVoiceQueueSummary(_0x3c2ee4){if(_0x3c2ee4[_0xc03b('0x46')]===_0xc03b('0x47')){var _0x1f9319={'id':_0x3c2ee4['id'],'name':_0x3c2ee4['name'],'strategy':_0x3c2ee4[_0xc03b('0x48')],'answered':_0x3c2ee4['answered'],'available':_0x3c2ee4[_0xc03b('0x49')],'loggedIn':_0x3c2ee4[_0xc03b('0x4a')],'pTalking':_0x3c2ee4[_0xc03b('0x4b')],'sumBillable':_0x3c2ee4['sumBillable'],'sumDuration':_0x3c2ee4[_0xc03b('0x4c')],'sumHoldTime':_0x3c2ee4[_0xc03b('0x4d')]||0x0,'talking':_0x3c2ee4[_0xc03b('0x4e')],'total':_0x3c2ee4[_0xc03b('0x4f')],'type':_0x3c2ee4[_0xc03b('0x46')],'unmanaged':_0x3c2ee4[_0xc03b('0x50')],'abandoned':_0x3c2ee4[_0xc03b('0x51')],'waiting':_0x3c2ee4[_0xc03b('0x52')],'loggedInDb':_0x3c2ee4['loggedInDb'],'dialActive':_0x3c2ee4[_0xc03b('0x53')],'dialMethod':_0x3c2ee4[_0xc03b('0x54')],'dialOriginateCallerIdName':_0x3c2ee4[_0xc03b('0x55')],'dialOriginateCallerIdNumber':_0x3c2ee4[_0xc03b('0x56')],'dialOriginateTimeout':_0x3c2ee4[_0xc03b('0x57')],'dialPrefix':_0x3c2ee4['dialPrefix'],'outboundAnswerAgiCallsDay':_0x3c2ee4[_0xc03b('0x58')],'outboundAnswerCallsDay':_0x3c2ee4['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x3c2ee4['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x3c2ee4[_0xc03b('0x59')],'outboundCongestionCallsDay':_0x3c2ee4['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x3c2ee4[_0xc03b('0x5a')],'outboundDropCallsDayCallersExit':_0x3c2ee4[_0xc03b('0x5b')],'outboundDropCallsDayTimeout':_0x3c2ee4[_0xc03b('0x5c')],'outboundNoAnswerCallsDay':_0x3c2ee4[_0xc03b('0x5d')],'outboundNoSuchCallsDay':_0x3c2ee4[_0xc03b('0x5e')],'outboundOriginateFailureCallsDay':_0x3c2ee4[_0xc03b('0x5f')],'outboundReCallsDay':_0x3c2ee4[_0xc03b('0x60')],'outboundRejectCallsDay':_0x3c2ee4[_0xc03b('0x61')],'outboundUnknownCallsDay':_0x3c2ee4['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x3c2ee4['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x3c2ee4['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x3c2ee4[_0xc03b('0x62')],'predictiveIntervalDroppedCallsCallersExit':_0x3c2ee4['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x3c2ee4[_0xc03b('0x63')],'predictiveIntervalErlangCalls':_0x3c2ee4[_0xc03b('0x64')],'predictiveIntervalErlangCallsDroppedCalls':_0x3c2ee4[_0xc03b('0x65')],'predictiveIntervalHitRate':_0x3c2ee4[_0xc03b('0x66')],'predictiveIntervalMultiplicativeFactor':_0x3c2ee4[_0xc03b('0x67')],'predictiveIntervalPauses':_0x3c2ee4[_0xc03b('0x68')],'predictiveIntervalAvailable':_0x3c2ee4[_0xc03b('0x69')],'predictiveIntervalTotalCalls':_0x3c2ee4['predictiveIntervalTotalCalls'],'message':_0x3c2ee4[_0xc03b('0x36')],'originated':_0x3c2ee4['originated'],'erlangCalls':_0x3c2ee4[_0xc03b('0x6a')],'erlangCallToSecond':_0x3c2ee4[_0xc03b('0x6b')],'erlangAbandonmentRate':_0x3c2ee4['erlangAbandonmentRate'],'erlangBusyFactor':_0x3c2ee4[_0xc03b('0x6c')],'startPredictive':_0x3c2ee4[_0xc03b('0x6d')],'startProgressive':_0x3c2ee4[_0xc03b('0x22')]};if(_0x3c2ee4['Trunk']){_0x1f9319['Trunk']={'id':_0x3c2ee4['Trunk']['id'],'name':_0x3c2ee4[_0xc03b('0x6e')][_0xc03b('0x38')],'active':_0x3c2ee4[_0xc03b('0x6e')][_0xc03b('0x6f')],'callerid':_0x3c2ee4[_0xc03b('0x6e')]['callerid']};}if(_0x3c2ee4[_0xc03b('0x3b')]){_0x1f9319['Interval']={'id':_0x3c2ee4[_0xc03b('0x3b')]['id'],'name':_0x3c2ee4[_0xc03b('0x3b')][_0xc03b('0x38')]};}var _0x36e2d3=md5(JSON[_0xc03b('0x42')](_0x1f9319));if(_0x3c2ee4[_0xc03b('0x3')]!==_0x36e2d3){_0x3c2ee4['md5']=_0x36e2d3;emit(util['format']('voice:queue:%s',_0x1f9319[_0xc03b('0x38')]),_0xc03b('0x70'),_0x1f9319);}}}function emitCampaignSummary(_0xb95847){if(_0xb95847[_0xc03b('0x46')]==='ivr'){emit(util[_0xc03b('0x71')]('campaign:ivr:%s',_0xb95847['name']),_0xc03b('0x72'),_0xb95847);}}function checkGetDataPredictive(_0xd13089){if(isNotNull(_0xd13089)&&!_['isEmpty'](_0xd13089)){loggerPredictive[_0xc03b('0x73')](_0xc03b('0x74'));loggerPredictive[_0xc03b('0x73')](_0xc03b('0x75'),_0xd13089[_0xc03b('0x76')]);loggerPredictive[_0xc03b('0x73')](_0xc03b('0x77'),_0xd13089[_0xc03b('0x78')]);loggerPredictive[_0xc03b('0x73')](_0xc03b('0x79'),_0xd13089[_0xc03b('0x63')]);loggerPredictive[_0xc03b('0x73')](_0xc03b('0x7a'),_0xd13089['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0xc03b('0x73')](_0xc03b('0x7b'),_0xd13089[_0xc03b('0x7c')]);loggerPredictive[_0xc03b('0x73')](_0xc03b('0x7d'),_0xd13089[_0xc03b('0x62')]);loggerPredictive[_0xc03b('0x73')](_0xc03b('0x7e'));if(_0xd13089[_0xc03b('0x76')]>0x0){if(!_['isUndefined'](_0xd13089[_0xc03b('0x62')])&&_0xd13089['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0xc03b('0x73')](_0xc03b('0x7f'));if(!_[_0xc03b('0x35')](_0xd13089[_0xc03b('0x7c')])&&_0xd13089[_0xc03b('0x7c')]>0x0){return!![];}loggerPredictive[_0xc03b('0x73')](_0xc03b('0x80'));}else{loggerPredictive[_0xc03b('0x73')](_0xc03b('0x81'));}}else{loggerPredictive[_0xc03b('0x73')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x1f12df){return function(_0x4254d3){loggerPredictive[_0xc03b('0x73')]('---------\x20ErlangB\x20---------');loggerPredictive[_0xc03b('0x73')](_0xc03b('0x82'),_0x4254d3['erlangCalls']);loggerPredictive[_0xc03b('0x73')](_0xc03b('0x83'),_0x4254d3['erlangCallToSecond']);loggerPredictive[_0xc03b('0x73')](_0xc03b('0x84'),_0x4254d3['erlangAbandonmentRate']);loggerPredictive['info'](_0xc03b('0x85'),_0x4254d3['erlangBusyFactor']);loggerPredictive[_0xc03b('0x73')](_0xc03b('0x84'),_0x4254d3['erlangAbandonmentRate']);loggerPredictive[_0xc03b('0x73')](_0xc03b('0x7e'));_['merge'](_0x1f12df,_0x4254d3);};}function getDiff(_0x55d4ba){var _0x4ba911=moment()[_0xc03b('0x43')](0x0);var _0x53cf34=moment(_0x55d4ba)[_0xc03b('0x43')](0x0);return _0x4ba911['diff'](_0x53cf34,_0xc03b('0x44'));}function ifInterval(_0x4e8a94,_0x4d0af0){if(_['isUndefined'](_0x4d0af0)){return![];}return getDiff(_0x4d0af0)<_0x4e8a94*0x3c;}function freeVariablesPredictive(_0x3838e3){if(isNotNull(_0x3838e3)){if(!_['isUndefined'](_0x3838e3[_0xc03b('0x22')])){_0x3838e3[_0xc03b('0x22')]=undefined;loggerPredictive[_0xc03b('0x73')](_0x3838e3[_0xc03b('0x38')],'clearing\x20variable\x20start\x20progressive');}if(!_['isUndefined'](_0x3838e3[_0xc03b('0x6d')])){_0x3838e3[_0xc03b('0x6d')]=undefined;loggerPredictive[_0xc03b('0x73')](_0x3838e3[_0xc03b('0x38')],_0xc03b('0x86'));}if(!_[_0xc03b('0x35')](_0x3838e3[_0xc03b('0x87')])){clearInterval(_0x3838e3['handlePredictive']);_0x3838e3[_0xc03b('0x87')]=undefined;loggerPredictive[_0xc03b('0x73')](_0x3838e3[_0xc03b('0x38')],_0xc03b('0x88'));}}}function erlangb(_0x2f7f2d,_0x32c495){if(_0x32c495===0x0){return 0x0;}var _0x27b18d=0x1;for(var _0x4f7791=0x1;_0x4f7791<=_0x32c495;_0x4f7791+=0x1){_0x27b18d=0x1+_0x27b18d*_0x4f7791/_0x2f7f2d;}return 0x1/_0x27b18d;}function isVoiceQueueOutbound(_0x45619e){return _0x45619e===_0xc03b('0x47');}function isNotPreview(_0x18b0d2){return _0x18b0d2!==_0xc03b('0x17');}function isCampaignIvr(_0x11d866){return _0x11d866===_0xc03b('0x89');}function getCallerId(_0x31a285,_0x9704e5,_0x4124af){if(!_['isUndefined'](_0x4124af)&&typeof _0x4124af===_0xc03b('0x8a')&&!_['isEmpty'](_0x4124af)){if(!_[_0xc03b('0x35')](_0x9704e5)&&typeof _0x9704e5===_0xc03b('0x8a')&&!_[_0xc03b('0x3f')](_0x9704e5)){return util[_0xc03b('0x71')](_0xc03b('0x8b'),_0x9704e5,_0x4124af);}return util[_0xc03b('0x71')](_0xc03b('0x8b'),_0x4124af,_0x4124af);}if(!_[_0xc03b('0x35')](_0x31a285)&&typeof _0x31a285==='string'&&!_[_0xc03b('0x3f')](_0x31a285)){return _0x31a285;}return _0xc03b('0x8c');}function loggerCatchQueueSummary(_0x24f0f4,_0x38ae29){return function(_0x6b733c){freeVariablesPredictive(_0x38ae29);emitVoiceQueueSummary(_0x38ae29);emitCampaignSummary(_0x38ae29);loggerSyncQueueSummary[_0xc03b('0x8d')](_0x24f0f4,util[_0xc03b('0x8e')](_0x6b733c,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x2349dd,_0x5e2e38){return function(_0x2fe117){loggerPredictive['error'](_0x5e2e38[_0xc03b('0x38')],_0x2349dd);loggerPredictive[_0xc03b('0x8d')](_0x2fe117[_0xc03b('0x8f')]);freeVariablesPredictive(_0x5e2e38);};}function loggerCatch(_0x1d57f6){return function(_0x2e01ce){logger['error'](_0x1d57f6,util[_0xc03b('0x8e')](_0x2e01ce,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x4fc916){return _0x4fc916&&!_[_0xc03b('0x35')](_0x4fc916)&&_0x4fc916['length']>0x0;}function decremetOriginate(_0x252807){if(!_[_0xc03b('0x35')](_0x252807)&&_0x252807!==null){if(typeof _0x252807[_0xc03b('0x90')]!==_0xc03b('0x91')){if(_0x252807['originated']>0x0){_0x252807[_0xc03b('0x90')]-=0x1;}else{logger[_0xc03b('0x8d')](_0xc03b('0x92'));}}}else{logger[_0xc03b('0x8d')](_0xc03b('0x93'));}}function checkContactLowerLimitOriginate(_0x519476,_0x37b5a8,_0x30bf4e){if(_0x37b5a8>_0x30bf4e){for(var _0x19c9f1=0x0;_0x19c9f1<_0x37b5a8-_0x30bf4e;_0x19c9f1+=0x1){decremetOriginate(_0x519476);}}}function loggerGetContactDialer(_0xf74184,_0x16ba2d,_0xe387fb){return function(_0x9dee02){checkContactLowerLimitOriginate(_0x16ba2d,_0xe387fb,0x0);logger[_0xc03b('0x8d')](_0xf74184,util[_0xc03b('0x8e')](_0x9dee02,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2e51a0){return function(_0x3cf1e1){if(isNotNull(_0x3cf1e1)&&isNotNull(_0x3cf1e1[0x0])){if(_0x3cf1e1[0x0]['contactsRescheduled']>0x0){_0x2e51a0[_0xc03b('0x36')]='RESCHEDULED_CONTACTS';logger[_0xc03b('0x73')](_0xc03b('0x94')+_0x2e51a0[_0xc03b('0x38')],_0x3cf1e1[0x0][_0xc03b('0x95')],_0xc03b('0x96'));}else{_0x2e51a0[_0xc03b('0x36')]=_0xc03b('0x97');logger[_0xc03b('0x73')](_0xc03b('0x98')+_0x2e51a0[_0xc03b('0x38')]);}}};}function notSendMessagesQueue(_0x45b73f){if(_0x45b73f['sendMessageOneNotActive']){freeVariablesPredictive(_0x45b73f);if(_0x45b73f[_0xc03b('0x90')]===0x0&&_0x45b73f[_0xc03b('0x4e')]===0x0&&_0x45b73f[_0xc03b('0x52')]===0x0&&(_0x45b73f['pTalking']||0x0)===0x0){_0x45b73f['sendMessageOneNotActive']=![];_0x45b73f[_0xc03b('0x49')]=0x0;_0x45b73f['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0xc03b('0x8d')](_0xc03b('0x99'),_0x45b73f[_0xc03b('0x38')],'is\x20not\x20active');}else{_0x45b73f[_0xc03b('0x36')]=_0xc03b('0x9a');loggerSyncQueueSummary[_0xc03b('0x8d')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x45b73f[_0xc03b('0x38')],'is\x20disactive');}emitVoiceQueueSummary(_0x45b73f);}}function notSendMessagesCampaign(_0x528d9e){if(_0x528d9e[_0xc03b('0x9b')]){if(_0x528d9e['originated']===0x0){_0x528d9e[_0xc03b('0x9b')]=![];_0x528d9e[_0xc03b('0x36')]='NOT_ACTIVE';loggerSyncQueueSummary[_0xc03b('0x8d')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x528d9e[_0xc03b('0x38')],_0xc03b('0x9c'));}else{_0x528d9e[_0xc03b('0x36')]=_0xc03b('0x9a');loggerSyncQueueSummary[_0xc03b('0x8d')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x528d9e[_0xc03b('0x38')],_0xc03b('0x9d'));}emitCampaignSummary(_0x528d9e);}}function createObjHistory(_0x15d263,_0x352c0c,_0x23e63d,_0x244881,_0x6f7fd9){_0x15d263['message']=_0x23e63d;var _0x4b9d8f=new Action(_0x15d263,_0x352c0c);var _0x46ee99=new History(_0x4b9d8f);_0x46ee99[_0xc03b('0x9e')]=_0x244881;_0x46ee99[_0xc03b('0x9f')]=_0x6f7fd9;_0x46ee99['endtime']=_0x4b9d8f[_0xc03b('0xa0')];return _0x46ee99;}Dialer[_0xc03b('0xa1')][_0xc03b('0x34')]=function(){var _0x39eb9d=this;setInterval(function(){_0x39eb9d['clearZombieChannels'](_0x39eb9d[_0xc03b('0x20')],'[uniqueid]');_0x39eb9d['clearZombieChannels'](_0x39eb9d[_0xc03b('0x1e')],_0xc03b('0xa2'));},0x32c8);};Dialer[_0xc03b('0xa1')][_0xc03b('0xa3')]=function(_0x19b285,_0x1b3692){var _0x18c152=this;for(var _0x450110 in _0x19b285){if(typeof _0x19b285[_0x450110]!==_0xc03b('0x91')){this[_0xc03b('0xa4')]['enqueue'](function(){if(!_[_0xc03b('0xa5')](_0x19b285[_0x450110])){return ami[_0xc03b('0xa6')]({'action':_0xc03b('0xa7'),'channel':_0x19b285[_0x450110][_0xc03b('0xa8')]})[_0xc03b('0xa9')](function(_0x245052){if(_0x245052[_0xc03b('0x36')]===_0xc03b('0xaa')){setTimeout(function(){if(_0x19b285[_0x450110]&&_0x19b285[_0x450110]['type']!=='ivr'){_0x18c152[_0xc03b('0xab')](_0x18c152[_0xc03b('0x18')][_0x19b285[_0x450110][_0xc03b('0xac')]]);logger[_0xc03b('0x8d')]('[Dialer][checkChannel]',_0x1b3692,_0x450110,_0x19b285[_0x450110][_0xc03b('0xac')]);delete _0x19b285[_0x450110];}if(_0x19b285[_0x450110]&&_0x19b285[_0x450110][_0xc03b('0x46')]===_0xc03b('0x89')){_0x18c152['updateOriginated'](_0x18c152[_0xc03b('0x19')][_0x19b285[_0x450110][_0xc03b('0xac')]]);logger[_0xc03b('0x8d')](_0xc03b('0xad'),_0x1b3692,_0x450110,_0x19b285[_0x450110][_0xc03b('0xac')]);delete _0x19b285[_0x450110];}},0x2328);}});}});}}};Dialer[_0xc03b('0xa1')][_0xc03b('0xae')]=function(_0x196129){return BPromise[_0xc03b('0xaf')]()[_0xc03b('0xb0')](cmHopper[_0xc03b('0xae')](_0x196129))[_0xc03b('0xa9')](loggerCatch(_0xc03b('0xb1')));};Dialer[_0xc03b('0xa1')][_0xc03b('0xb2')]=function(_0x49184d){return BPromise[_0xc03b('0xaf')]()['then'](cmHopperBlack[_0xc03b('0xb2')](_0x49184d))[_0xc03b('0xa9')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0xc03b('0xa1')][_0xc03b('0xb3')]=function(_0x3faaa5){return BPromise['resolve']()[_0xc03b('0xb0')](cmHopperBlack[_0xc03b('0xb3')](_0x3faaa5))[_0xc03b('0xa9')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0xc03b('0xa1')]['averageHandleTime']=function(_0x48c6a3){return BPromise[_0xc03b('0xaf')]()[_0xc03b('0xb0')](cmHopperHistory[_0xc03b('0xb4')](_0x48c6a3))['catch'](loggerCatch(_0xc03b('0xb5')));};Dialer[_0xc03b('0xa1')]['rescheduleContact']=function(_0x15ab09){return BPromise['resolve']()[_0xc03b('0xb0')](cmHopper[_0xc03b('0xb6')](_0x15ab09))[_0xc03b('0xa9')](loggerCatch(_0xc03b('0xb7')));};Dialer[_0xc03b('0xa1')][_0xc03b('0xb8')]=function(_0x13ee21,_0x37fd2d,_0x52f1db){return BPromise[_0xc03b('0xaf')]()['then'](cmHopper[_0xc03b('0xb8')](_0x13ee21,_0x37fd2d,_0x52f1db))[_0xc03b('0xa9')](loggerCatch('[unlockContact]\x20'));};Dialer[_0xc03b('0xa1')][_0xc03b('0xb9')]=function(_0x2c81c9,_0x33bee2,_0x346cc9,_0x307eba,_0x5b62d9){return BPromise[_0xc03b('0xaf')]()[_0xc03b('0xb0')](cmHopper['getContactDialer'](_0x2c81c9,_0x33bee2,_0x346cc9,_0x307eba))[_0xc03b('0xa9')](function(_0x29ab96){_0x5b62d9['temp']-=_0x346cc9;_0x5b62d9[_0xc03b('0xba')]=_0x5b62d9[_0xc03b('0xba')]>0x0?_0x5b62d9['temp']:0x0;loggerCatch(_0xc03b('0xbb'))(_0x29ab96);});};Dialer[_0xc03b('0xa1')]['getContactDialerIvr']=function(_0x3d9275,_0x1cf1ee,_0xb6716d,_0x35f685){return BPromise[_0xc03b('0xaf')]()['then'](cmHopper[_0xc03b('0xbc')](_0x3d9275,_0x1cf1ee,_0xb6716d))[_0xc03b('0xa9')](function(_0x4e0e9c){_0x35f685['temp']-=_0x1cf1ee;_0x35f685[_0xc03b('0xba')]=_0x35f685[_0xc03b('0xba')]>0x0?_0x35f685[_0xc03b('0xba')]:0x0;loggerCatch(_0xc03b('0xbd'))(_0x4e0e9c);});};Dialer['prototype'][_0xc03b('0xbe')]=function(_0x550a1b){return BPromise[_0xc03b('0xaf')]()[_0xc03b('0xb0')](voiceQueueRt['getVoiceQueueRtPauses'](_0x550a1b))[_0xc03b('0xa9')](loggerCatch(_0xc03b('0xbf')));};Dialer[_0xc03b('0xa1')]['moveContactManagedDialer']=function(_0x2b35e2){return BPromise[_0xc03b('0xaf')]()['then'](cmHopper['moveContactManagedDialer'](_0x2b35e2))[_0xc03b('0xa9')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer['prototype'][_0xc03b('0xc0')]=function(_0x5a7c91){return BPromise[_0xc03b('0xaf')]()[_0xc03b('0xb0')](cmHopperHistory[_0xc03b('0xc0')](_0x5a7c91))[_0xc03b('0xa9')](loggerCatch(_0xc03b('0xc1')));};Dialer[_0xc03b('0xa1')]['updateOriginated']=function(_0x2c71d1){if(!_[_0xc03b('0x35')](_0x2c71d1)&&_0x2c71d1!==null){if(typeof _0x2c71d1[_0xc03b('0x90')]!==_0xc03b('0x91')){if(_0x2c71d1[_0xc03b('0x90')]>0x0){_0x2c71d1[_0xc03b('0x90')]-=0x1;}else{logger[_0xc03b('0x8d')](_0xc03b('0xc2'));}}}else{logger[_0xc03b('0x8d')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0xc03b('0xa1')][_0xc03b('0xc3')]=function(_0x2e1276,_0x167572){var _0x442a87=this;return function(_0x579ead){_0x442a87[_0xc03b('0xab')](_0x167572);logger[_0xc03b('0x8d')](_0x2e1276,util[_0xc03b('0x8e')](_0x579ead,{'showHidden':![],'depth':null}));};};Dialer[_0xc03b('0xa1')]['emptyContact']=function(_0x4cf5cf,_0x199902,_0x1b1040){var _0x60d172={'state':0x19,'statedesc':_0xc03b('0xc4')};this[_0xc03b('0xab')](_0x199902);this[_0xc03b('0xc5')](_[_0xc03b('0xc6')](_0x60d172,_[_0xc03b('0xc7')](_0x1b1040,[_0xc03b('0xc8'),_0xc03b('0xc9'),_0xc03b('0xca'),_0xc03b('0xcb'),'CampaignId'])),_0xc03b('0xcc'),_0xc03b('0xcd'));logger[_0xc03b('0x8d')](_0x4cf5cf);};Dialer[_0xc03b('0xa1')][_0xc03b('0xce')]=function(_0x3e13aa){return _0x3e13aa===_0xc03b('0xcf');};Dialer['prototype'][_0xc03b('0xd0')]=function(_0x1091c5){return!_[_0xc03b('0x35')](_0x1091c5)&&_0x1091c5&&!_[_0xc03b('0x35')](_0x1091c5['name'])&&!_[_0xc03b('0x35')](_0x1091c5['active'])&&_0x1091c5[_0xc03b('0x6f')]&&(this['trunks'][util[_0xc03b('0x71')](_0xc03b('0xd1'),_0x1091c5[_0xc03b('0x38')])][_0xc03b('0xa7')]==='reachable'||this[_0xc03b('0x1b')][util[_0xc03b('0x71')](_0xc03b('0xd1'),_0x1091c5[_0xc03b('0x38')])][_0xc03b('0xa7')]===_0xc03b('0xd2'));};Dialer[_0xc03b('0xa1')][_0xc03b('0xc5')]=function(_0x1c86cc,_0x5d9185,_0x28ae4c){this[_0xc03b('0xc0')](_0x1c86cc)[_0xc03b('0xa9')](loggerCatch(_0x5d9185));this[_0xc03b('0xd3')](_0x1c86cc)[_0xc03b('0xa9')](loggerCatch(_0x28ae4c));};Dialer[_0xc03b('0xa1')][_0xc03b('0xd4')]=function(_0x1daf59){var _0x1a0c4a=this[_0xc03b('0x20')][_0x1daf59[_0xc03b('0xd5')]];var _0x1dd826;if(!_[_0xc03b('0xa5')](_0x1daf59)&&!_[_0xc03b('0xa5')](_0x1daf59['variable'])&&!_[_0xc03b('0xa5')](_0x1daf59['variable'][_0xc03b('0xd6')])&&_0x1daf59[_0xc03b('0xd7')]==='xcally-motion-dialer'&&_0x1a0c4a){if(_0x1a0c4a[_0xc03b('0x46')]!==_0xc03b('0x89')&&this['voiceQueues'][_0x1a0c4a[_0xc03b('0xac')]][_0xc03b('0xd8')]&&_0x1daf59[_0xc03b('0xd9')]==='HANGUP'){delete this[_0xc03b('0x20')][_0x1daf59[_0xc03b('0xd5')]];this[_0xc03b('0xab')](this[_0xc03b('0x18')][_0x1a0c4a[_0xc03b('0xac')]]);this['voiceQueues'][_0x1a0c4a['queue']][_0xc03b('0xda')]+=0x1;this[_0xc03b('0x18')][_0x1a0c4a[_0xc03b('0xac')]][_0xc03b('0x58')]+=0x1;_0x1dd826=new Hangup(_0x1a0c4a,_0x1daf59);_0x1dd826['state']=0x12;_0x1dd826['statedesc']=_0xc03b('0xdb');_0x1dd826[_0xc03b('0xdc')]=_0xc03b('0xdd');ami[_0xc03b('0x45')](_0xc03b('0xde'),ut['buildObj'](_0x1dd826,'amd'));this[_0xc03b('0xc5')](_0x1dd826,_0xc03b('0xdf'),_0xc03b('0xe0'));}if(_0x1a0c4a['type']!==_0xc03b('0x89')&&this[_0xc03b('0x18')][_0x1a0c4a[_0xc03b('0xac')]][_0xc03b('0xd8')]&&_0x1daf59[_0xc03b('0xd9')]==='MACHINE'){var _0x6c5046=this;return new BPromise(function(_0x428e0e,_0x1ba13e){delete _0x6c5046[_0xc03b('0x20')][_0x1daf59[_0xc03b('0xd5')]];_0x6c5046[_0xc03b('0xab')](_0x6c5046[_0xc03b('0x18')][_0x1a0c4a['queue']]);_0x6c5046[_0xc03b('0x18')][_0x1a0c4a[_0xc03b('0xac')]][_0xc03b('0xda')]+=0x1;_0x6c5046[_0xc03b('0x18')][_0x1a0c4a[_0xc03b('0xac')]][_0xc03b('0x58')]+=0x1;var _0x3539bb=_0x6c5046[_0xc03b('0x18')][_0x1a0c4a[_0xc03b('0xac')]];var _0x29fea2=new Hangup(_0x1a0c4a,_0x1daf59);_0x29fea2[_0xc03b('0x9e')]=0x13;_0x29fea2[_0xc03b('0x9f')]='Machine';_0x29fea2[_0xc03b('0xdc')]=_0xc03b('0xdd');_0x29fea2['countmachineretry']+=0x1;_0x29fea2[_0xc03b('0xe1')]+=0x1;_0x29fea2['amd']=!![];ami['emit'](_0xc03b('0xde'),ut[_0xc03b('0xe2')](_0x29fea2,_0xc03b('0xe3')));_0x6c5046[_0xc03b('0xc0')](_0x29fea2)[_0xc03b('0xa9')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x29fea2[_0xc03b('0xe4')]+_0x29fea2[_0xc03b('0xe5')]+_0x29fea2[_0xc03b('0xe6')]+_0x29fea2['countnosuchnumberretry']+_0x29fea2[_0xc03b('0xe7')]+_0x29fea2[_0xc03b('0xe8')]+_0x29fea2[_0xc03b('0xe9')]+_0x29fea2[_0xc03b('0xea')]>=_0x3539bb[_0xc03b('0xeb')]){_0x6c5046['stateGlobal'](_0x29fea2,_0x428e0e,_0x1ba13e,'reason19\x20machine....');}else{if(_0x29fea2['countmachineretry']>=_0x3539bb['dialMachineMaxRetry']){_0x6c5046[_0xc03b('0xec')](_0x29fea2,_0x428e0e,_0x1ba13e,'reason\x2019\x20machine....');}else{_0x6c5046[_0xc03b('0xb6')]({'active':![],'countmachineretry':_0x29fea2[_0xc03b('0xe9')],'scheduledat':moment()[_0xc03b('0xed')](_0x3539bb[_0xc03b('0xee')],_0xc03b('0xef'))[_0xc03b('0x71')](_0xc03b('0xf0')),'ContactId':_0x29fea2[_0xc03b('0xc8')],'ListId':_0x29fea2[_0xc03b('0xc9')],'VoiceQueueId':_0x29fea2['VoiceQueueId']||undefined,'CampaignId':_0x29fea2[_0xc03b('0xf1')]||undefined})['catch'](loggerCatch(_0xc03b('0xf2')));_0x428e0e({'reschedule':0x1});}}});}if(_0x1a0c4a[_0xc03b('0x46')]===_0xc03b('0x89')&&this[_0xc03b('0x19')][_0x1a0c4a[_0xc03b('0xac')]][_0xc03b('0xd8')]&&_0x1daf59[_0xc03b('0xd9')]==='HANGUP'){delete this[_0xc03b('0x20')][_0x1daf59[_0xc03b('0xd5')]];this['updateOriginated'](this[_0xc03b('0x19')][_0x1a0c4a['queue']]);_0x1dd826=new Hangup(_0x1a0c4a,_0x1daf59);_0x1dd826[_0xc03b('0x9e')]=0x12;_0x1dd826[_0xc03b('0x9f')]=_0xc03b('0xdb');_0x1dd826['membername']='AMD';ami[_0xc03b('0x45')]('custom:amd',ut[_0xc03b('0xe2')](_0x1dd826,'amd'));this['saveInDb'](_0x1dd826,_0xc03b('0xf3'),_0xc03b('0xf4'));}if(_0x1a0c4a['type']===_0xc03b('0x89')&&this[_0xc03b('0x19')][_0x1a0c4a['queue']]['dialAMDActive']&&_0x1daf59['value']===_0xc03b('0xf5')){var _0x6c5046=this;return new BPromise(function(_0x5176d0,_0x232177){delete _0x6c5046[_0xc03b('0x20')][_0x1daf59['uniqueid']];_0x6c5046[_0xc03b('0xab')](_0x6c5046[_0xc03b('0x19')][_0x1a0c4a[_0xc03b('0xac')]]);_0x6c5046[_0xc03b('0x19')][_0x1a0c4a[_0xc03b('0xac')]][_0xc03b('0xda')]+=0x1;_0x6c5046[_0xc03b('0x19')][_0x1a0c4a['queue']][_0xc03b('0x58')]+=0x1;var _0x9c6f10=_0x6c5046[_0xc03b('0x19')][_0x1a0c4a[_0xc03b('0xac')]];var _0xc72d9e=new Hangup(_0x1a0c4a,_0x1daf59);_0xc72d9e[_0xc03b('0x9e')]=0x13;_0xc72d9e[_0xc03b('0x9f')]=_0xc03b('0xf6');_0xc72d9e['membername']='AMD';_0xc72d9e[_0xc03b('0xe9')]+=0x1;_0xc72d9e[_0xc03b('0xe1')]+=0x1;_0xc72d9e[_0xc03b('0xe3')]=!![];ami[_0xc03b('0x45')](_0xc03b('0xde'),ut['buildObj'](_0xc72d9e,_0xc03b('0xe3')));_0x6c5046[_0xc03b('0xc0')](_0xc72d9e)['catch'](loggerCatch(_0xc03b('0xf7')));if(_0xc72d9e[_0xc03b('0xe4')]+_0xc72d9e[_0xc03b('0xe5')]+_0xc72d9e[_0xc03b('0xe6')]+_0xc72d9e[_0xc03b('0xf8')]+_0xc72d9e[_0xc03b('0xe7')]+_0xc72d9e[_0xc03b('0xe8')]+_0xc72d9e[_0xc03b('0xe9')]+_0xc72d9e[_0xc03b('0xea')]>=_0x9c6f10[_0xc03b('0xeb')]){_0x6c5046['stateGlobal'](_0xc72d9e,_0x5176d0,_0x232177,_0xc03b('0xf9'));}else{if(_0xc72d9e[_0xc03b('0xe9')]>=_0x9c6f10['dialMachineMaxRetry']){_0x6c5046[_0xc03b('0xec')](_0xc72d9e,_0x5176d0,_0x232177,'reason\x2019\x20machine....');}else{_0x6c5046[_0xc03b('0xb6')]({'active':![],'countmachineretry':_0xc72d9e[_0xc03b('0xe9')],'scheduledat':moment()[_0xc03b('0xed')](_0x9c6f10[_0xc03b('0xee')],_0xc03b('0xef'))[_0xc03b('0x71')](_0xc03b('0xf0')),'ContactId':_0xc72d9e[_0xc03b('0xc8')],'ListId':_0xc72d9e['ListId'],'VoiceQueueId':_0xc72d9e['VoiceQueueId']||undefined,'CampaignId':_0xc72d9e[_0xc03b('0xf1')]||undefined})[_0xc03b('0xa9')](loggerCatch(_0xc03b('0xf2')));_0x5176d0({'reschedule':0x1});}}});}}};Dialer[_0xc03b('0xa1')]['syncHangup']=function(_0xfafa4b){var _0x439dbe=this[_0xc03b('0x20')][_0xfafa4b[_0xc03b('0xd5')]];var _0x2df5d0=this;var _0x519ef6;if(_0x439dbe&&_0x439dbe[_0xc03b('0x46')]===_0xc03b('0x89')){delete this['uniqueId'][_0xfafa4b[_0xc03b('0xd5')]];this[_0xc03b('0xab')](this['campaigns'][_0x439dbe[_0xc03b('0xac')]]);this[_0xc03b('0x19')][_0x439dbe[_0xc03b('0xac')]][_0xc03b('0xfa')]+=0x1;_0x519ef6=new Hangup(_0x439dbe,_0xfafa4b);this[_0xc03b('0xc0')](_0x519ef6)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xc03b('0xd3')](_0x519ef6)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x439dbe&&_0x439dbe[_0xc03b('0x46')]!==_0xc03b('0x89')&&isNotNull(this[_0xc03b('0x18')][_0x439dbe['queue']][_0xc03b('0xfb')])){delete this[_0xc03b('0x20')][_0xfafa4b['uniqueid']];this[_0xc03b('0xab')](this['voiceQueues'][_0x439dbe[_0xc03b('0xac')]]);this[_0xc03b('0x18')][_0x439dbe['queue']][_0xc03b('0xda')]+=0x1;this[_0xc03b('0x18')][_0x439dbe[_0xc03b('0xac')]]['outboundAnswerAgiCallsDay']+=0x1;_0x519ef6=new Hangup(_0x439dbe,_0xfafa4b);_0x519ef6[_0xc03b('0x9e')]=0x10;_0x519ef6[_0xc03b('0x9f')]=_0xc03b('0xfc');_0x519ef6['membername']='AGI';this[_0xc03b('0xc0')](_0x519ef6)[_0xc03b('0xa9')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xc03b('0xd3')](_0x519ef6)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x439dbe&&_0x439dbe[_0xc03b('0x46')]!=='ivr'&&!isNotNull(this['voiceQueues'][_0x439dbe['queue']][_0xc03b('0xfb')])){delete this['uniqueId'][_0xfafa4b[_0xc03b('0xd5')]];this[_0xc03b('0xab')](this[_0xc03b('0x18')][_0x439dbe[_0xc03b('0xac')]]);this[_0xc03b('0x18')][_0x439dbe['queue']][_0xc03b('0xfd')]+=0x1;_0x519ef6=new Hangup(_0x439dbe,_0xfafa4b);_0x519ef6['state']=0xc;_0x519ef6[_0xc03b('0x9f')]=_0xfafa4b[_0xc03b('0xfe')];_0x519ef6[_0xc03b('0xdc')]=_0xc03b('0xff');this[_0xc03b('0xc0')](_0x519ef6)[_0xc03b('0xa9')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xc03b('0xd3')](_0x519ef6)[_0xc03b('0xa9')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xc03b('0xa1')][_0xc03b('0x100')]=function(_0x56b0a5){var _0x139073=this[_0xc03b('0x20')][_0x56b0a5['uniqueid']];var _0x2a9504=this;if(this['voiceQueues'][_0x56b0a5[_0xc03b('0xac')]]){if(_0x139073&&_0x139073[_0xc03b('0x46')]!==_0xc03b('0x89')){delete this[_0xc03b('0x20')][_0x56b0a5[_0xc03b('0xd5')]];this[_0xc03b('0x18')][_0x56b0a5[_0xc03b('0xac')]][_0xc03b('0xda')]+=0x1;var _0x3295f6=new AgentComplete(_0x139073,_0x56b0a5);if(_0x56b0a5[_0xc03b('0x101')]==='agent'){_0x3295f6[_0xc03b('0x102')]=this[_0xc03b('0x18')][_0x56b0a5[_0xc03b('0xac')]][_0xc03b('0x103')]&&this['voiceQueues'][_0x56b0a5[_0xc03b('0xac')]]['dialAgiAfterHangupAgent']?moment()[_0xc03b('0x71')](_0xc03b('0xf0')):undefined;}this['createHistory'](_0x3295f6)['catch'](loggerCatch(_0xc03b('0x104')));this[_0xc03b('0xd3')](_0x3295f6)['catch'](loggerCatch(_0xc03b('0x105')));}}};Dialer[_0xc03b('0xa1')][_0xc03b('0x26')]=function(_0x39a327){if(this[_0xc03b('0x18')][_0x39a327[_0xc03b('0xac')]]){if(this[_0xc03b('0x20')][_0x39a327[_0xc03b('0xd5')]]&&this[_0xc03b('0x20')][_0x39a327[_0xc03b('0xd5')]][_0xc03b('0x46')]!=='ivr'){this['updateOriginated'](this[_0xc03b('0x18')][_0x39a327['queue']]);this['uniqueId'][_0x39a327[_0xc03b('0xd5')]][_0xc03b('0x106')]=moment()[_0xc03b('0x71')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xc03b('0xa1')][_0xc03b('0x107')]=function(_0x3a48ad){this[_0xc03b('0xc0')](_0x3a48ad)['catch'](loggerCatch(_0xc03b('0x104')));this[_0xc03b('0xd3')](_0x3a48ad)['catch'](loggerCatch(_0xc03b('0x108')));};Dialer[_0xc03b('0xa1')][_0xc03b('0x28')]=function(_0x41c4d6){var _0x37031a=this[_0xc03b('0x20')][_0x41c4d6['uniqueid']];var _0x15725c=this;if(this[_0xc03b('0x18')][_0x41c4d6[_0xc03b('0xac')]]){if(_0x37031a&&_0x37031a['type']!=='ivr'){delete this[_0xc03b('0x20')][_0x41c4d6[_0xc03b('0xd5')]];this['updateOriginated'](this[_0xc03b('0x18')][_0x41c4d6[_0xc03b('0xac')]]);_0x37031a[_0xc03b('0x109')]=moment()[_0xc03b('0x71')](_0xc03b('0xf0'));var _0x5934ad=new QueueCallerAbandon(_0x37031a,_0x41c4d6);if(getSeconds(_0x37031a[_0xc03b('0x109')],_0x37031a[_0xc03b('0x10a')])>=_0x37031a[_0xc03b('0x10b')]){this[_0xc03b('0x18')][_0x41c4d6[_0xc03b('0xac')]][_0xc03b('0x63')]+=0x1;this[_0xc03b('0x18')][_0x41c4d6['queue']][_0xc03b('0x5c')]+=0x1;this['voiceQueues'][_0x41c4d6[_0xc03b('0xac')]][_0xc03b('0x65')]+=0x1;_0x5934ad[_0xc03b('0x9e')]=0xa;_0x5934ad[_0xc03b('0x9f')]='Drop';_0x5934ad[_0xc03b('0x10c')]=_0xc03b('0x10d');_0x5934ad['agiafterat']=this[_0xc03b('0x18')][_0x41c4d6[_0xc03b('0xac')]][_0xc03b('0x103')]?moment()[_0xc03b('0x71')](_0xc03b('0xf0')):undefined;_0x5934ad[_0xc03b('0xe7')]+=0x1;_0x5934ad['countglobal']+=0x1;if(_0x5934ad[_0xc03b('0xe7')]>=this[_0xc03b('0x18')][_0x41c4d6['queue']][_0xc03b('0x10e')]){this[_0xc03b('0x107')](_0x5934ad);}else{this[_0xc03b('0xb6')]({'active':![],'countdropretry':_0x5934ad[_0xc03b('0xe7')],'scheduledat':moment()[_0xc03b('0xed')](this[_0xc03b('0x18')][_0x41c4d6['queue']]['dialDropRetryFrequency'],_0xc03b('0xef'))[_0xc03b('0x71')](_0xc03b('0xf0')),'ContactId':_0x37031a[_0xc03b('0xc8')],'ListId':_0x37031a[_0xc03b('0xc9')],'VoiceQueueId':_0x37031a['VoiceQueueId']||undefined,'CampaignId':_0x37031a[_0xc03b('0xf1')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0x2f7ed0=new History(_0x5934ad);_0x2f7ed0['state']=0xa;_0x2f7ed0['statedesc']=_0xc03b('0x10f');_0x2f7ed0['starttime']=moment()[_0xc03b('0x71')]('YYYY-MM-DD\x20HH:mm:ss');_0x2f7ed0['endtime']=_0x2f7ed0[_0xc03b('0xa0')];_0x2f7ed0[_0xc03b('0x110')]=_0x5934ad[_0xc03b('0x110')];_0x2f7ed0['calleridnum']=_0x5934ad[_0xc03b('0x111')];this['createHistory'](_0x2f7ed0)[_0xc03b('0xa9')](loggerCatch(_0xc03b('0x112')));}}else{this[_0xc03b('0x18')][_0x41c4d6[_0xc03b('0xac')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xc03b('0x18')][_0x41c4d6['queue']][_0xc03b('0x5b')]+=0x1;_0x5934ad[_0xc03b('0x9e')]=0xb;_0x5934ad[_0xc03b('0x9f')]=_0xc03b('0x113');_0x5934ad[_0xc03b('0x10c')]=_0xc03b('0x114');_0x5934ad['countabandonedretry']+=0x1;_0x5934ad['countglobal']+=0x1;if(_0x5934ad[_0xc03b('0xe8')]>=this[_0xc03b('0x18')][_0x41c4d6[_0xc03b('0xac')]][_0xc03b('0x115')]){this[_0xc03b('0x107')](_0x5934ad);}else{this[_0xc03b('0xb6')]({'active':![],'countabandonedretry':_0x5934ad[_0xc03b('0xe8')],'scheduledat':moment()[_0xc03b('0xed')](this[_0xc03b('0x18')][_0x41c4d6[_0xc03b('0xac')]][_0xc03b('0x116')],_0xc03b('0xef'))[_0xc03b('0x71')](_0xc03b('0xf0')),'ContactId':_0x37031a[_0xc03b('0xc8')],'ListId':_0x37031a['ListId'],'VoiceQueueId':_0x37031a[_0xc03b('0xcb')]||undefined,'CampaignId':_0x37031a[_0xc03b('0xf1')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0x2f7ed0=new History(_0x5934ad);_0x2f7ed0[_0xc03b('0x9e')]=0xb;_0x2f7ed0[_0xc03b('0x9f')]=_0xc03b('0x113');_0x2f7ed0[_0xc03b('0xa0')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2f7ed0[_0xc03b('0x117')]=_0x2f7ed0['starttime'];_0x2f7ed0[_0xc03b('0x110')]=_0x5934ad[_0xc03b('0x110')];_0x2f7ed0[_0xc03b('0x111')]=_0x5934ad[_0xc03b('0x111')];this[_0xc03b('0xc0')](_0x2f7ed0)[_0xc03b('0xa9')](loggerCatch(_0xc03b('0x118')));}}}}};Dialer['prototype'][_0xc03b('0x2f')]=function(_0x1ca8be){if(this['actions'][_0x1ca8be['uniqueid']]){this[_0xc03b('0x1e')][_0x1ca8be[_0xc03b('0xd5')]]['channel']=_0x1ca8be[_0xc03b('0xa8')];}if(this[_0xc03b('0x20')][_0x1ca8be[_0xc03b('0xd5')]]){this[_0xc03b('0x20')][_0x1ca8be[_0xc03b('0xd5')]][_0xc03b('0xa8')]=_0x1ca8be[_0xc03b('0xa8')];}};Dialer[_0xc03b('0xa1')]['syncQueueMember']=function(_0x5f09a1){if(strategy[this[_0xc03b('0x18')][this[_0xc03b('0x1e')][_0x5f09a1['actionid']]['queue']][_0xc03b('0x48')]]===_0xc03b('0x14')){if(this['actions'][_0x5f09a1[_0xc03b('0x119')]]&&_[_0xc03b('0xa5')](this[_0xc03b('0x1e')][_0x5f09a1[_0xc03b('0x119')]][_0xc03b('0x11a')])&&_0x5f09a1['status']==='1'&&_0x5f09a1[_0xc03b('0x11b')]==='0'){if(this[_0xc03b('0x1a')][_0x5f09a1[_0xc03b('0x11c')]]){if(!this[_0xc03b('0x1a')][_0x5f09a1[_0xc03b('0x11c')]][_0xc03b('0x11a')]){this['agents'][_0x5f09a1['stateinterface']][_0xc03b('0x11a')]=!![];this['actions'][_0x5f09a1[_0xc03b('0x119')]][_0xc03b('0x11a')]=!![];this[_0xc03b('0x1e')][_0x5f09a1[_0xc03b('0x119')]][_0xc03b('0x11c')]=_0x5f09a1['stateinterface'];}}}}else if((strategy[this[_0xc03b('0x18')][this[_0xc03b('0x1e')][_0x5f09a1['actionid']]['queue']][_0xc03b('0x48')]]||_0xc03b('0x11d'))===_0xc03b('0x11d')){if(this[_0xc03b('0x1e')][_0x5f09a1[_0xc03b('0x119')]]){if(this[_0xc03b('0x1a')][_0x5f09a1['stateinterface']]){this[_0xc03b('0x1e')][_0x5f09a1[_0xc03b('0x119')]][_0xc03b('0x11c')]=_0x5f09a1[_0xc03b('0x11c')];if(_[_0xc03b('0xa5')](this[_0xc03b('0x11e')][this[_0xc03b('0x1e')][_0x5f09a1[_0xc03b('0x119')]][_0xc03b('0xac')]])){this[_0xc03b('0x11e')][this[_0xc03b('0x1e')][_0x5f09a1['actionid']][_0xc03b('0xac')]]=[];}this[_0xc03b('0x11e')][this[_0xc03b('0x1e')][_0x5f09a1[_0xc03b('0x119')]][_0xc03b('0xac')]]['push'](_[_0xc03b('0xc6')](_['pick'](this[_0xc03b('0x1e')][_0x5f09a1[_0xc03b('0x119')]],['idHopper',_0xc03b('0x11c')]),{'status':_0x5f09a1[_0xc03b('0xa7')],'paused':_0x5f09a1[_0xc03b('0x11b')]}));}}}};function unlockQueueStatus(_0x49e19c,_0x12d04b){setTimeout(function(){if(_[_0xc03b('0x35')](_0x49e19c[_0xc03b('0x11f')])){loggerBooked['error'](_0xc03b('0x120'),_0x12d04b);}_0x49e19c['queueStatusComplete']=!![];loggerBooked[_0xc03b('0x73')](_0xc03b('0x121'),_0x12d04b,JSON[_0xc03b('0x42')](_['pick'](_0x49e19c,[_0xc03b('0x38'),_0xc03b('0x11f')])));},0x1f3);}Dialer[_0xc03b('0xa1')][_0xc03b('0x32')]=function(_0x49fddc){var _0x465b4c=this;var _0x484610=_0x465b4c[_0xc03b('0x18')][_0x465b4c[_0xc03b('0x1e')][_0x49fddc[_0xc03b('0x119')]][_0xc03b('0xac')]];if(strategy[this[_0xc03b('0x18')][this[_0xc03b('0x1e')][_0x49fddc[_0xc03b('0x119')]][_0xc03b('0xac')]][_0xc03b('0x48')]]===_0xc03b('0x14')){if(this[_0xc03b('0x1e')][_0x49fddc[_0xc03b('0x119')]]&&this['actions'][_0x49fddc['actionid']][_0xc03b('0x11c')]){this[_0xc03b('0x17')][_0xc03b('0x122')](this['actions'][_0x49fddc['actionid']][_0xc03b('0x123')],this[_0xc03b('0x1e')][_0x49fddc[_0xc03b('0x119')]][_0xc03b('0x11c')])[_0xc03b('0xa9')](function(_0x2a9df6){logger[_0xc03b('0x8d')](_0xc03b('0x124'),util[_0xc03b('0x8e')](_0x2a9df6,{'showHidden':![],'depth':null}));})[_0xc03b('0x16')](function(){_0x465b4c[_0xc03b('0xab')](_0x465b4c['voiceQueues'][_0x465b4c[_0xc03b('0x1e')][_0x49fddc[_0xc03b('0x119')]][_0xc03b('0xac')]]);_0x465b4c[_0xc03b('0x1a')][_0x465b4c[_0xc03b('0x1e')][_0x49fddc[_0xc03b('0x119')]][_0xc03b('0x11c')]][_0xc03b('0x11a')]=![];delete _0x465b4c[_0xc03b('0x1e')][_0x49fddc[_0xc03b('0x119')]];unlockQueueStatus(_0x484610);});}else{this[_0xc03b('0xab')](this['voiceQueues'][this[_0xc03b('0x1e')][_0x49fddc[_0xc03b('0x119')]][_0xc03b('0xac')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0xc03b('0x1e')][_0x49fddc['actionid']][_0xc03b('0xc8')],'ListId':this[_0xc03b('0x1e')][_0x49fddc[_0xc03b('0x119')]]['ListId'],'VoiceQueueId':this['actions'][_0x49fddc[_0xc03b('0x119')]][_0xc03b('0xcb')]||undefined,'CampaignId':this[_0xc03b('0x1e')][_0x49fddc[_0xc03b('0x119')]][_0xc03b('0xf1')]||undefined})[_0xc03b('0xa9')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x49fddc[_0xc03b('0x119')]];unlockQueueStatus(_0x484610);}}else if((strategy[this[_0xc03b('0x18')][this[_0xc03b('0x1e')][_0x49fddc[_0xc03b('0x119')]][_0xc03b('0xac')]]['strategy']]||_0xc03b('0x11d'))===_0xc03b('0x11d')){var _0x2afeec;if(this['actions'][_0x49fddc[_0xc03b('0x119')]]&&!_[_0xc03b('0x3f')](this[_0xc03b('0x11e')][this[_0xc03b('0x1e')][_0x49fddc[_0xc03b('0x119')]]['queue']])){if(this['queueBookedRR'][_0x465b4c[_0xc03b('0x1e')][_0x49fddc[_0xc03b('0x119')]][_0xc03b('0xac')]]){this['queueBookedRR'][_0x465b4c[_0xc03b('0x1e')][_0x49fddc[_0xc03b('0x119')]][_0xc03b('0xac')]]=this[_0xc03b('0x24')][this[_0xc03b('0x1e')][_0x49fddc['actionid']][_0xc03b('0xac')]]?this[_0xc03b('0x24')][this['actions'][_0x49fddc[_0xc03b('0x119')]][_0xc03b('0xac')]]:this[_0xc03b('0x11e')][this[_0xc03b('0x1e')][_0x49fddc[_0xc03b('0x119')]]['queue']]?this[_0xc03b('0x11e')][this[_0xc03b('0x1e')][_0x49fddc[_0xc03b('0x119')]][_0xc03b('0xac')]][_0xc03b('0x125')]||0x0:0x0;}this[_0xc03b('0x11e')][this['actions'][_0x49fddc[_0xc03b('0x119')]][_0xc03b('0xac')]][_0xc03b('0x125')]=this[_0xc03b('0x24')][this[_0xc03b('0x1e')][_0x49fddc[_0xc03b('0x119')]][_0xc03b('0xac')]];for(var _0x19b289=0x0;_0x19b289=0x0;})[_0xc03b('0xa9')](myreject(_0x2d698f)));}}else{_0x14f518[_0xc03b('0x140')](ami['Action']({'action':'command','command':util[_0xc03b('0x71')]('iftime\x20%s,%s',_0x274e21,!_[_0xc03b('0x35')](config['timezones'][_0x3f2afd])?_0x3f2afd:'')})['then'](function(_0x43e565){return _0x43e565['content']['indexOf']('true')>=0x0;})['catch'](myreject(_0x2d698f)));}BPromise[_0xc03b('0x141')](_0x14f518)[_0xc03b('0xb0')](function(_0x229f8a){var _0x4db907=_[_0xc03b('0x142')](_0x229f8a);if(_0x4db907){return _0x7b2005(_0x4db907);}else{_0x42b3fe[_0xc03b('0x36')]=_0x1c2a0f?_0xc03b('0x143'):'INTERVAL_IS_OVERTIME';return _0x2d698f(msgResponse('[ifTime][promiseAll]',_0xc03b('0x136'),'Global:\x20'+_0x1c2a0f+'\x20'+_0x2bc9b7+_0xc03b('0x144')+util['inspect'](_0x274e21,{'showHidden':![],'depth':null})+_0xc03b('0x145')+_0x3f2afd));}})[_0xc03b('0xa9')](function(_0x340bc0){return _0x2d698f(msgResponse(_0xc03b('0x132'),'Failure',JSON['stringify'](_0x340bc0)));});});};Dialer[_0xc03b('0xa1')][_0xc03b('0x146')]=function(_0x150a82){var _0x25aae5=this;return function(){switch(_0x150a82[_0xc03b('0x54')]){case _0xc03b('0x147'):freeVariablesPredictive(_0x150a82);_0x25aae5['handlePower'](_0x150a82,0x1);break;case _0xc03b('0x148'):freeVariablesPredictive(_0x150a82);_0x25aae5[_0xc03b('0x149')](_0x150a82,_0x150a82['dialPowerLevel']);break;case _0xc03b('0x14a'):_0x25aae5[_0xc03b('0x14a')](_0x150a82);break;case _0xc03b('0x14b'):freeVariablesPredictive(_0x150a82);_0x25aae5[_0xc03b('0x149')](_0x150a82,0x1);break;default:freeVariablesPredictive(_0x150a82);logger[_0xc03b('0x8d')](_0xc03b('0x14c'),_0x150a82['name'],_0xc03b('0x14d'));}};};Dialer[_0xc03b('0xa1')][_0xc03b('0x14e')]=function(_0x91f258){var _0x594495=this;return function(){_0x594495[_0xc03b('0x14f')](_0x91f258);};};Dialer[_0xc03b('0xa1')][_0xc03b('0x9')]=function(_0x1ac659){var _0x35b505=this;if(isNotPreview(_0x1ac659[_0xc03b('0x54')])){if(isVoiceQueueOutbound(_0x1ac659[_0xc03b('0x46')])&&isActive(_0x1ac659[_0xc03b('0x53')])){_0x1ac659['sendMessageOneNotActive']=!![];BPromise[_0xc03b('0xaf')]()[_0xc03b('0xb0')](checkIsLoggedIn(_0x1ac659,_0x1ac659['loggedIn']))[_0xc03b('0xb0')](checkIsActive(_0x1ac659,_0x1ac659['dialActive']))[_0xc03b('0xb0')](checkInterval(_0x1ac659))[_0xc03b('0xb0')](_0x35b505[_0xc03b('0x12e')](_0x1ac659))['then'](_0x35b505['checkIfTime'](_0x1ac659[_0xc03b('0x150')],_0x1ac659[_0xc03b('0x151')],_0x1ac659[_0xc03b('0x38')],_0x1ac659))[_0xc03b('0xb0')](_0x35b505[_0xc03b('0x133')](_0x1ac659[_0xc03b('0x3b')],_0x1ac659[_0xc03b('0x151')],_0x1ac659[_0xc03b('0x38')],_0x1ac659))[_0xc03b('0xb0')](_0x35b505[_0xc03b('0x146')](_0x1ac659))[_0xc03b('0xa9')](loggerCatchQueueSummary('[syncQueueSummary]',_0x1ac659));}else{notSendMessagesQueue(_0x1ac659);}}else{freeVariablesPredictive(_0x1ac659);}};Dialer[_0xc03b('0xa1')]['syncCampaigns']=function(){var _0x575031=this;var _0x4ac9c2;for(var _0x4795e0 in this[_0xc03b('0x19')]){if(typeof this[_0xc03b('0x19')][_0x4795e0]!==_0xc03b('0x91')){_0x4ac9c2=this[_0xc03b('0x19')][_0x4795e0];if(isCampaignIvr(_0x4ac9c2['type'])&&isActive(_0x4ac9c2[_0xc03b('0x6f')])){_0x4ac9c2[_0xc03b('0x9b')]=!![];BPromise[_0xc03b('0xaf')]()[_0xc03b('0xb0')](checkIsActive(_0x4ac9c2,_0x4ac9c2[_0xc03b('0x6f')]))['then'](checkInterval(_0x4ac9c2))['then'](_0x575031[_0xc03b('0x12e')](_0x4ac9c2))[_0xc03b('0xb0')](_0x575031[_0xc03b('0x131')](_0x4ac9c2[_0xc03b('0x150')],_0x4ac9c2[_0xc03b('0x151')],_0x4ac9c2[_0xc03b('0x38')],_0x4ac9c2))[_0xc03b('0xb0')](_0x575031['checkIfTimeIntervals'](_0x4ac9c2['Interval'],_0x4ac9c2['dialTimezone'],_0x4ac9c2[_0xc03b('0x38')],_0x4ac9c2))[_0xc03b('0xb0')](_0x575031[_0xc03b('0x14e')](_0x4ac9c2))[_0xc03b('0xa9')](loggerCatchQueueSummary(_0xc03b('0x152'),_0x4ac9c2));}else{notSendMessagesCampaign(_0x4ac9c2);}}}};function getCallerIdRandom(_0x3ed46d,_0x3adbe4){var _0x445c75;var _0x5bbf25;var _0x5db445;if(_0x3adbe4<=0x0){_0x3adbe4=0x1;}_0x445c75=new RegExp(_0xc03b('0x153')+_0x3adbe4+'}$');_0x5bbf25=Math['pow'](0xa,_0x3adbe4-0x1);_0x5db445=Math[_0xc03b('0x154')](0xa,_0x3adbe4)-0x1;return util[_0xc03b('0x71')]('%s',_[_0xc03b('0x155')](_0x3ed46d,_0x445c75,_['random'](_0x5bbf25,_0x5db445)));}function extractCalleridName(_0x35aa61){var _0xcdcefe=_0x35aa61[_0xc03b('0x156')](/"(.*?)"/);return _0xcdcefe?_0xcdcefe[0x1]:_0x35aa61;}function extractCalleridNumber(_0x36bf04){var _0x1ed163=_0x36bf04['match'](/<(.*?)>/);return _0x1ed163?_0x1ed163[0x1]:_0x36bf04;}Dialer['prototype']['actionOriginate']=function(_0x1032ee,_0x559872){var _0x55a070=this;var _0x429b22=uuid['v4']();this[_0xc03b('0x1e')][_0x429b22]=new Action(_0x1032ee,_0x559872,_0x429b22);return new BPromise(function(_0x7f1d53,_0x1dd6e2){if(_[_0xc03b('0x35')](_0x1032ee)&&typeof _0x1032ee!==_0xc03b('0x157')){return _0x1dd6e2(msgResponse('originate',_0xc03b('0x136'),_0xc03b('0x158')));}if(_['isUndefined'](_0x559872[_0xc03b('0x159')][_0xc03b('0x15a')])||_0x559872[_0xc03b('0x159')][_0xc03b('0x15a')]===null){return _0x1dd6e2(msgResponse(_0xc03b('0x15b'),'Failure',_0xc03b('0x15c')));}var _0x254c24={'XMD-CALLERID':_0x55a070['actions'][_0x429b22][_0xc03b('0x15d')](),'XMD-AGI':_0x1032ee[_0xc03b('0xfb')]?util['format'](_0xc03b('0x15e'),ipAgi,_0x1032ee[_0xc03b('0xfb')]):_0xc03b('0x15f'),'XMD-AGIAFTER':_0x1032ee[_0xc03b('0x103')]?util[_0xc03b('0x71')](_0xc03b('0x15e'),ipAgi,_0x1032ee[_0xc03b('0x103')]):_0xc03b('0x15f'),'XMD-QUEUE':_0x1032ee[_0xc03b('0x46')]===_0xc03b('0x47')?util[_0xc03b('0x71')](_0xc03b('0x160'),_0x1032ee[_0xc03b('0x38')],_0x1032ee[_0xc03b('0x161')]||'',_0x1032ee[_0xc03b('0x162')]?'c':'',_0x1032ee[_0xc03b('0x10b')]||0x3):'NONE','XMD-CONTACTID':_0x559872['ContactId'],'XMD-CDRTYPE':_0xc03b('0x7'),'CALLERID(all)':_0x55a070[_0xc03b('0x1e')][_0x429b22][_0xc03b('0x15d')](),'XMD-AMD':_0x1032ee['dialAMDActive']?_0xc03b('0x163'):'NONE','XMD-DESTINATION':_0xc03b('0x164')};if(_0x1032ee['dialAMDActive']){_0x254c24[_0xc03b('0x165')]=_0x1032ee[_0xc03b('0x166')]||0x9c4;_0x254c24[_0xc03b('0x167')]=_0x1032ee[_0xc03b('0x168')]||0x5dc;_0x254c24['XMD-AMDAFTERGREETINGSILENCE']=_0x1032ee[_0xc03b('0x169')]||0x320;_0x254c24[_0xc03b('0x16a')]=_0x1032ee[_0xc03b('0x16b')]||0x1388;_0x254c24[_0xc03b('0x16c')]=_0x1032ee[_0xc03b('0x16d')]||0x64;_0x254c24[_0xc03b('0x16e')]=_0x1032ee[_0xc03b('0x16f')]||0x32;_0x254c24[_0xc03b('0x170')]=_0x1032ee[_0xc03b('0x171')]||0x3;_0x254c24[_0xc03b('0x172')]=_0x1032ee[_0xc03b('0x173')]||0x100;_0x254c24[_0xc03b('0x174')]=_0x1032ee['dialAMDMaximumWordLength']||0x1388;}if(_0x1032ee['type']==='outbound'){_0x254c24[_0xc03b('0x175')]=_0x559872[_0xc03b('0xcb')];}else{_0x254c24[_0xc03b('0x176')]=_0x559872[_0xc03b('0xf1')];}for(var _0x313898 in _0x559872[_0xc03b('0x159')]){if(typeof _0x559872[_0xc03b('0x159')][_0x313898]!==_0xc03b('0x91')){if(isNotNull(_0x559872['Contact'][_0x313898])&&_0x313898!=='id'&&_0x313898!=='tags'&&_0x313898!==_0xc03b('0x177')&&_0x313898!==_0xc03b('0x178')){_0x254c24[util['format']('%s%s',_0xc03b('0x179'),_[_0xc03b('0x17a')](_0x313898))]=_0x559872[_0xc03b('0x159')][_0x313898];}}}var _0x369af9=_0x55a070['isTrunkReachable'](_0x1032ee['Trunk'])?getCallerId(_0x1032ee['Trunk'][_0xc03b('0x17b')],_0x1032ee[_0xc03b('0x55')],_0x1032ee[_0xc03b('0x17c')]>0x0?getCallerIdRandom(_0x1032ee[_0xc03b('0x56')],_0x1032ee['dialRandomLastDigitCallerIdNumber']):_0x1032ee[_0xc03b('0x56')]):getCallerId(_['isNil'](_0x1032ee[_0xc03b('0x12f')])?_0x1032ee[_0xc03b('0x6e')]['callerid']:_0x1032ee['TrunkBackup']['callerid'],_0x1032ee[_0xc03b('0x55')],_0x1032ee[_0xc03b('0x17c')]>0x0?getCallerIdRandom(_0x1032ee[_0xc03b('0x56')],_0x1032ee['dialRandomLastDigitCallerIdNumber']):_0x1032ee[_0xc03b('0x56')]);if(_0x369af9){_0x254c24[_0xc03b('0x17d')]=_0x55a070['actions'][_0x429b22][_0xc03b('0x17e')]=extractCalleridName(_0x369af9);_0x254c24[_0xc03b('0x17f')]=_0x55a070[_0xc03b('0x1e')][_0x429b22]['originatecalleridnum']=extractCalleridNumber(_0x369af9);}return ami['Action']({'actionid':_0x429b22,'action':_0xc03b('0x15b'),'channel':_0x55a070['isTrunkReachable'](_0x1032ee['Trunk'])?util['format']('SIP/%s/%s%s',_0x1032ee['Trunk'][_0xc03b('0x38')],isNotNull(_0x1032ee[_0xc03b('0x180')])?_0x1032ee[_0xc03b('0x180')][_0xc03b('0x181')]()||'':'',_0x1032ee[_0xc03b('0x182')]>0x0?_0x559872[_0xc03b('0x159')][_0xc03b('0x15a')][_0xc03b('0x183')](_0x1032ee['dialCutDigit']):_0x559872[_0xc03b('0x159')][_0xc03b('0x15a')]):util[_0xc03b('0x71')](_0xc03b('0x184'),_[_0xc03b('0xa5')](_0x1032ee[_0xc03b('0x12f')])?_0x1032ee[_0xc03b('0x6e')][_0xc03b('0x38')]:_0x1032ee['TrunkBackup'][_0xc03b('0x38')],isNotNull(_0x1032ee[_0xc03b('0x180')])?_0x1032ee['dialPrefix']['trim']()||'':'',_0x1032ee[_0xc03b('0x182')]>0x0?_0x559872[_0xc03b('0x159')]['phone'][_0xc03b('0x183')](_0x1032ee[_0xc03b('0x182')]):_0x559872[_0xc03b('0x159')][_0xc03b('0x15a')]),'callerid':_0x369af9,'Exten':_0xc03b('0x164'),'Context':'from-sip','Priority':'1','variable':_0x254c24,'timeout':(_0x1032ee[_0xc03b('0x57')]||0x1e)*0x3e8,'async':!![],'channelid':_0x429b22})[_0xc03b('0xb0')](function(_0x2e7eef){return _0x7f1d53(_0x2e7eef);})['catch'](function(_0xfb909a){_0x1032ee['outboundOriginateFailureCallsDay']+=0x1;var _0x4e16d9=new History(_0x55a070['actions'][_0x429b22]);logger[_0xc03b('0x8d')](util[_0xc03b('0x71')](_0xc03b('0x185'),JSON['stringify'](_0xfb909a)));_0x4e16d9['state']=0xe;_0x4e16d9[_0xc03b('0x9f')]=_0xc03b('0x186');_0x4e16d9[_0xc03b('0xa0')]=moment()[_0xc03b('0x71')]('YYYY-MM-DD\x20HH:mm:ss');_0x4e16d9['endtime']=_0x4e16d9['starttime'];_0x55a070[_0xc03b('0xc0')](_0x4e16d9)[_0xc03b('0xa9')](loggerCatch(_0xc03b('0x187')));_0x55a070[_0xc03b('0xd3')](_0x4e16d9)[_0xc03b('0xa9')](loggerCatch(_0xc03b('0x187')))[_0xc03b('0x16')](function(){delete _0x55a070[_0xc03b('0x1e')][_0x429b22];return _0x1dd6e2(msgResponse(_0xc03b('0x15b'),_0xc03b('0x41'),_0xc03b('0x188')));});});});};Dialer[_0xc03b('0xa1')][_0xc03b('0x2b')]=function(_0x13f22f){var _0x31fd52=this['actions'][_0x13f22f[_0xc03b('0x119')]];if(_0x31fd52){delete this[_0xc03b('0x1e')][_0x13f22f[_0xc03b('0x119')]];_0x31fd52[_0xc03b('0x10a')]=moment()[_0xc03b('0x71')](_0xc03b('0xf0'));var _0x201237=_0x31fd52['type']===_0xc03b('0x89')?this[_0xc03b('0x19')][_0x31fd52[_0xc03b('0xac')]]:this[_0xc03b('0x18')][_0x31fd52[_0xc03b('0x189')]()];if(!this[_0xc03b('0xce')](_0x13f22f[_0xc03b('0x18a')])){this['updateOriginated'](_0x201237);return this[_0xc03b('0x18b')](_0x31fd52,_0x201237,_0x13f22f)[_0xc03b('0xa9')](loggerCatch('[callProgressDetecting]\x20'));}this['uniqueId'][_0x13f22f[_0xc03b('0xd5')]]=_0x31fd52;}};Dialer[_0xc03b('0xa1')]['checkRetriveMax']=function(_0x55fd25,_0x2ff6ca,_0x3ee77e){var _0x4c17c2=new History(_0x2ff6ca);if(_0x4c17c2[_0xc03b('0xe4')]+_0x4c17c2[_0xc03b('0xe5')]+_0x4c17c2[_0xc03b('0xe6')]+_0x4c17c2[_0xc03b('0xf8')]+_0x4c17c2['countdropretry']+_0x4c17c2[_0xc03b('0xe8')]+_0x4c17c2['countmachineretry']+_0x4c17c2[_0xc03b('0xea')]>=_0x3ee77e[_0xc03b('0xeb')]-0x1){return!![];}switch(_0x55fd25){case 0x3:if(_0x4c17c2[_0xc03b('0xe6')]>=_0x3ee77e['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0xc03b('0xb6')]({'active':![],'countnoanswerretry':_0x4c17c2[_0xc03b('0xe6')]+=0x1,'scheduledat':moment()[_0xc03b('0xed')](_0x3ee77e[_0xc03b('0x18c')],_0xc03b('0xef'))[_0xc03b('0x71')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4c17c2[_0xc03b('0xc8')],'ListId':_0x4c17c2[_0xc03b('0xc9')],'VoiceQueueId':_0x4c17c2['VoiceQueueId']||undefined,'CampaignId':_0x4c17c2['CampaignId']||undefined})[_0xc03b('0xa9')](loggerCatch(_0xc03b('0x18d')));break;case 0x5:if(_0x4c17c2[_0xc03b('0xe4')]>=_0x3ee77e['dialBusyMaxRetry']-0x1){return!![];}this[_0xc03b('0xb6')]({'active':![],'countbusyretry':_0x4c17c2[_0xc03b('0xe4')]+=0x1,'scheduledat':moment()[_0xc03b('0xed')](_0x3ee77e['dialBusyRetryFrequency'],'minutes')[_0xc03b('0x71')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4c17c2[_0xc03b('0xc8')],'ListId':_0x4c17c2[_0xc03b('0xc9')],'VoiceQueueId':_0x4c17c2[_0xc03b('0xcb')]||undefined,'CampaignId':_0x4c17c2['CampaignId']||undefined})[_0xc03b('0xa9')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x4c17c2['countcongestionretry']>=_0x3ee77e[_0xc03b('0x18e')]-0x1){return!![];}this[_0xc03b('0xb6')]({'active':![],'countcongestionretry':_0x4c17c2[_0xc03b('0xe5')]+=0x1,'scheduledat':moment()[_0xc03b('0xed')](_0x3ee77e[_0xc03b('0x18f')],'minutes')[_0xc03b('0x71')](_0xc03b('0xf0')),'ContactId':_0x4c17c2[_0xc03b('0xc8')],'ListId':_0x4c17c2[_0xc03b('0xc9')],'VoiceQueueId':_0x4c17c2[_0xc03b('0xcb')]||undefined,'CampaignId':_0x4c17c2[_0xc03b('0xf1')]||undefined})[_0xc03b('0xa9')](loggerCatch(_0xc03b('0x190')));break;case 0x0:if(_0x4c17c2['countnosuchnumberretry']>=_0x3ee77e[_0xc03b('0x191')]-0x1){return!![];}else{this[_0xc03b('0xb6')]({'active':![],'countnosuchnumberretry':_0x4c17c2[_0xc03b('0xf8')]+=0x1,'scheduledat':moment()[_0xc03b('0xed')](_0x3ee77e[_0xc03b('0x192')],_0xc03b('0xef'))['format'](_0xc03b('0xf0')),'ContactId':_0x4c17c2['ContactId'],'ListId':_0x4c17c2[_0xc03b('0xc9')],'VoiceQueueId':_0x4c17c2[_0xc03b('0xcb')]||undefined,'CampaignId':_0x4c17c2[_0xc03b('0xf1')]||undefined})[_0xc03b('0xa9')](loggerCatch(_0xc03b('0x193')));}break;case 0xa:if(_0x4c17c2[_0xc03b('0xe7')]>=_0x3ee77e[_0xc03b('0x10e')]-0x1){return!![];}this[_0xc03b('0xb6')]({'active':![],'countdropretry':_0x4c17c2['countdropretry']+=0x1,'scheduledat':moment()[_0xc03b('0xed')](_0x3ee77e[_0xc03b('0x194')],_0xc03b('0xef'))[_0xc03b('0x71')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4c17c2[_0xc03b('0xc8')],'ListId':_0x4c17c2[_0xc03b('0xc9')],'VoiceQueueId':_0x4c17c2[_0xc03b('0xcb')]||undefined,'CampaignId':_0x4c17c2[_0xc03b('0xf1')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x4c17c2[_0xc03b('0xe8')]>=_0x3ee77e[_0xc03b('0x115')]-0x1){return!![];}this[_0xc03b('0xb6')]({'active':![],'countabandonedretry':_0x4c17c2[_0xc03b('0xe8')]+=0x1,'scheduledat':moment()[_0xc03b('0xed')](_0x3ee77e['dialAbandonedRetryFrequency'],'minutes')[_0xc03b('0x71')](_0xc03b('0xf0')),'ContactId':_0x4c17c2[_0xc03b('0xc8')],'ListId':_0x4c17c2[_0xc03b('0xc9')],'VoiceQueueId':_0x4c17c2['VoiceQueueId']||undefined,'CampaignId':_0x4c17c2[_0xc03b('0xf1')]||undefined})[_0xc03b('0xa9')](loggerCatch(_0xc03b('0x195')));break;case 0x13:if(_0x4c17c2[_0xc03b('0xe9')]>=_0x3ee77e[_0xc03b('0x196')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x4c17c2[_0xc03b('0xe9')]+=0x1,'scheduledat':moment()['add'](_0x3ee77e[_0xc03b('0xee')],'minutes')[_0xc03b('0x71')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4c17c2[_0xc03b('0xc8')],'ListId':_0x4c17c2[_0xc03b('0xc9')],'VoiceQueueId':_0x4c17c2['VoiceQueueId']||undefined,'CampaignId':_0x4c17c2[_0xc03b('0xf1')]||undefined})['catch'](loggerCatch(_0xc03b('0xf2')));break;case 0x14:if(_0x4c17c2['countagentrejectretry']>=_0x3ee77e[_0xc03b('0x197')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x4c17c2[_0xc03b('0xea')]+=0x1,'scheduledat':moment()['add'](_0x3ee77e[_0xc03b('0x198')],'minutes')[_0xc03b('0x71')](_0xc03b('0xf0')),'ContactId':_0x4c17c2[_0xc03b('0xc8')],'ListId':_0x4c17c2['ListId'],'VoiceQueueId':_0x4c17c2[_0xc03b('0xcb')]||undefined,'CampaignId':_0x4c17c2[_0xc03b('0xf1')]||undefined})[_0xc03b('0xa9')](loggerCatch(_0xc03b('0x199')));break;default:return!![];}};Dialer[_0xc03b('0xa1')][_0xc03b('0x18b')]=function(_0x51e7c7,_0x2ac8e4,_0x360f47){var _0xb559ec=this;var _0x24b19b=new History(_0x51e7c7);return new BPromise(function(_0x5357fa,_0x166a87){if(_['isUndefined'](_0x2ac8e4)&&typeof _0x2ac8e4!=='object'){return _0x166a87(msgResponse(_0xc03b('0x19a'),_0xc03b('0x136'),_0xc03b('0x19b')));}if(_[_0xc03b('0x35')](_0x360f47)&&typeof _0x360f47!==_0xc03b('0x157')){return _0x166a87(msgResponse('[callProgressDetecting]',_0xc03b('0x136'),'evt\x20is\x20undefine'));}switch(_0x360f47[_0xc03b('0x101')]){case'0':_0x2ac8e4[_0xc03b('0x5e')]+=0x1;_0x24b19b[_0xc03b('0x9e')]=0x0;_0x24b19b[_0xc03b('0x9f')]=_0xc03b('0x19c');_0x24b19b[_0xc03b('0xf8')]+=0x1;_0x24b19b[_0xc03b('0xe1')]+=0x1;ami['emit'](_0xc03b('0x19d'),ut[_0xc03b('0xe2')](_0x51e7c7,_0xc03b('0x19e')));_0xb559ec[_0xc03b('0xc0')](_0x24b19b)[_0xc03b('0xa9')](loggerCatch(_0xc03b('0xf7')));if(_0xb559ec['checkRetriveMax'](0x0,_0x51e7c7,_0x2ac8e4)){if(_0x24b19b[_0xc03b('0xf8')]>=_0x2ac8e4[_0xc03b('0x191')]){_0xb559ec[_0xc03b('0xec')](_0x24b19b,_0x5357fa,_0x166a87,_0xc03b('0x19f'));}else{_0xb559ec[_0xc03b('0x1a0')](_0x24b19b,_0x5357fa,_0x166a87,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x2ac8e4[_0xc03b('0x5d')]+=0x1;_0x24b19b['state']=0x3;_0x24b19b[_0xc03b('0x9f')]=_0xc03b('0x1a1');_0x24b19b[_0xc03b('0xe6')]+=0x1;_0x24b19b['countglobal']+=0x1;ami[_0xc03b('0x45')](_0xc03b('0x1a2'),ut[_0xc03b('0xe2')](_0x51e7c7,_0xc03b('0x1a3')));_0xb559ec[_0xc03b('0xc0')](_0x24b19b)[_0xc03b('0xa9')](loggerCatch(_0xc03b('0x1a4')));if(_0xb559ec[_0xc03b('0x1a5')](0x3,_0x51e7c7,_0x2ac8e4)){if(_0x24b19b[_0xc03b('0xe6')]>=_0x2ac8e4[_0xc03b('0x1a6')]){_0xb559ec[_0xc03b('0xec')](_0x24b19b,_0x5357fa,_0x166a87,_0xc03b('0x1a7'));}else{_0xb559ec['stateGlobal'](_0x24b19b,_0x5357fa,_0x166a87,_0xc03b('0x1a7'));}}break;case'5':_0x2ac8e4[_0xc03b('0x59')]+=0x1;_0x24b19b[_0xc03b('0x9e')]=0x5;_0x24b19b[_0xc03b('0x9f')]=_0xc03b('0x1a8');_0x24b19b[_0xc03b('0xe4')]+=0x1;_0x24b19b[_0xc03b('0xe1')]+=0x1;ami[_0xc03b('0x45')](_0xc03b('0x1a9'),ut[_0xc03b('0xe2')](_0x51e7c7,_0xc03b('0x1aa')));_0xb559ec[_0xc03b('0xc0')](_0x24b19b)[_0xc03b('0xa9')](loggerCatch(_0xc03b('0x1ab')));if(_0xb559ec['checkRetriveMax'](0x5,_0x51e7c7,_0x2ac8e4)){if(_0x24b19b['countbusyretry']>=_0x2ac8e4[_0xc03b('0x1ac')]){_0xb559ec[_0xc03b('0xec')](_0x24b19b,_0x5357fa,_0x166a87,_0xc03b('0x1ad'));}else{_0xb559ec[_0xc03b('0x1a0')](_0x24b19b,_0x5357fa,_0x166a87,_0xc03b('0x1ad'));}}break;case'8':_0x2ac8e4['outboundCongestionCallsDay']+=0x1;_0x24b19b[_0xc03b('0x9e')]=0x8;_0x24b19b[_0xc03b('0x9f')]=_0xc03b('0x1ae');_0x24b19b['countcongestionretry']+=0x1;_0x24b19b['countglobal']+=0x1;ami[_0xc03b('0x45')](_0xc03b('0x1af'),ut[_0xc03b('0xe2')](_0x51e7c7,_0xc03b('0x1b0')));_0xb559ec['createHistory'](_0x24b19b)['catch'](loggerCatch(_0xc03b('0x1b1')));if(_0xb559ec['checkRetriveMax'](0x8,_0x51e7c7,_0x2ac8e4)){if(_0x24b19b['countcongestionretry']>=_0x2ac8e4[_0xc03b('0x18e')]){_0xb559ec[_0xc03b('0xec')](_0x24b19b,_0x5357fa,_0x166a87,_0xc03b('0x1b2'));}else{_0xb559ec['stateGlobal'](_0x24b19b,_0x5357fa,_0x166a87,_0xc03b('0x1b2'));}}break;case'11':_0x2ac8e4['outboundAbandonedCallsDay']+=0x1;_0x24b19b['state']=0xb;_0x24b19b[_0xc03b('0x9f')]=_0xc03b('0x113');_0x24b19b[_0xc03b('0xe8')]+=0x1;_0x24b19b[_0xc03b('0xe1')]+=0x1;_0xb559ec[_0xc03b('0xc0')](_0x24b19b)[_0xc03b('0xa9')](loggerCatch(_0xc03b('0x118')));if(_0xb559ec['checkRetriveMax'](0xb,_0x51e7c7,_0x2ac8e4)){if(_0x24b19b[_0xc03b('0xe8')]>=_0x2ac8e4[_0xc03b('0x115')]){_0xb559ec[_0xc03b('0xec')](_0x24b19b,_0x5357fa,_0x166a87,'reason\x2011\x20abandoned');}else{_0xb559ec[_0xc03b('0x1a0')](_0x24b19b,_0x5357fa,_0x166a87,_0xc03b('0x1b3'));}}break;case'20':_0x2ac8e4[_0xc03b('0x61')]+=0x1;_0x24b19b[_0xc03b('0x9e')]=0x14;_0x24b19b['statedesc']=_0xc03b('0x1b4');_0x24b19b[_0xc03b('0xea')]+=0x1;_0x24b19b[_0xc03b('0xe1')]+=0x1;ami[_0xc03b('0x45')](_0xc03b('0x1b5'),ut[_0xc03b('0xe2')](_0x51e7c7,'agentreject'));_0xb559ec['createHistory'](_0x24b19b)[_0xc03b('0xa9')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0xb559ec['checkRetriveMax'](0x14,_0x51e7c7,_0x2ac8e4)){if(_0x24b19b[_0xc03b('0xea')]>=_0x2ac8e4[_0xc03b('0x197')]){_0xb559ec[_0xc03b('0xec')](_0x24b19b,_0x5357fa,_0x166a87,_0xc03b('0x1b6'));}else{_0xb559ec[_0xc03b('0x1a0')](_0x24b19b,_0x5357fa,_0x166a87,_0xc03b('0x1b6'));}}break;default:_0x2ac8e4[_0xc03b('0xfd')]+=0x1;_0x24b19b[_0xc03b('0x9e')]=0xc;_0x24b19b[_0xc03b('0x9f')]=_0x360f47[_0xc03b('0x101')];_0xb559ec['createHistory'](_0x24b19b)[_0xc03b('0xa9')](loggerCatch(_0xc03b('0x1b7')));if(_0xb559ec[_0xc03b('0x1a5')](_0x360f47[_0xc03b('0x101')],_0x51e7c7,_0x2ac8e4)){if(_0x24b19b[_0xc03b('0xe4')]+_0x24b19b['countcongestionretry']+_0x24b19b['countnoanswerretry']+_0x24b19b[_0xc03b('0xf8')]+_0x24b19b[_0xc03b('0xe7')]+_0x24b19b[_0xc03b('0xe8')]+_0x24b19b[_0xc03b('0xe9')]+_0x24b19b[_0xc03b('0xea')]>=_0x2ac8e4['dialGlobalMaxRetry']){_0xb559ec['stateGlobal'](_0x24b19b,_0x5357fa,_0x166a87,_0x360f47[_0xc03b('0x101')]);}else{_0xb559ec[_0xc03b('0xec')](_0x24b19b,_0x5357fa,_0x166a87,_0x360f47[_0xc03b('0x101')]);}}}});};Dialer[_0xc03b('0xa1')][_0xc03b('0x1a0')]=function(_0x1b6d70,_0x3f036f,_0xa762d3,_0x373691){var _0x51f960=new Final(_0x1b6d70);_0x51f960['state']=0xf;_0x51f960[_0xc03b('0x9f')]=_0xc03b('0x1b8');this[_0xc03b('0xec')](_0x51f960,_0x3f036f,_0xa762d3,_0x373691);};Dialer[_0xc03b('0xa1')][_0xc03b('0xec')]=function(_0x3331ab,_0x382789,_0x5ecbfd,_0x747037){this['moveContactManagedDialer'](_0x3331ab)[_0xc03b('0xb0')](function(){return _0x382789(msgResponse(_0xc03b('0x19a'),'Success',_0x747037));})[_0xc03b('0xa9')](function(){return _0x5ecbfd(msgResponse('[moveContactManagedDialer][0]','Failure',_0xc03b('0x1b9')));});};Dialer[_0xc03b('0xa1')][_0xc03b('0x14a')]=function(_0x14ce77){var _0x513836=_0x14ce77[_0xc03b('0x1ba')]/0x64;var _0x33aa75=_0x14ce77[_0xc03b('0x5c')]/(_0x14ce77[_0xc03b('0x5c')]+_0x14ce77[_0xc03b('0xda')]);var _0x51490e=Math[_0xc03b('0x1bb')](_0x14ce77[_0xc03b('0x69')]*(_0x14ce77[_0xc03b('0x1bc')]/0x64));var _0xdb3c1c=Math[_0xc03b('0x1bb')](_0x14ce77[_0xc03b('0x69')]*(_0x14ce77[_0xc03b('0x1bd')]/0x64));var _0x3ce9dc=_0x14ce77['available']+_0x14ce77[_0xc03b('0x4e')];var _0x4d206e=Math[_0xc03b('0x1be')](_0x14ce77[_0xc03b('0x6a')]*_0x14ce77[_0xc03b('0x1bf')]*_0x14ce77['predictiveIntervalHitRate']*_0x14ce77[_0xc03b('0x67')]);if(_[_0xc03b('0x35')](_0x14ce77['startProgressive'])){if(!_[_0xc03b('0x35')](_0x14ce77[_0xc03b('0x6d')])){_0x14ce77[_0xc03b('0x6d')]=undefined;loggerPredictive[_0xc03b('0x8d')]('[startMethodPredictive][StartProgressive]',_0xc03b('0x1c0'));}if(!_[_0xc03b('0x35')](_0x14ce77[_0xc03b('0x87')])){loggerPredictive[_0xc03b('0x8d')](_0xc03b('0x1c1'),_0xc03b('0x1c2'));clearInterval(_0x14ce77['handlePredictive']);_0x14ce77[_0xc03b('0x87')]=undefined;}_0x14ce77[_0xc03b('0x22')]=moment()['format'](_0xc03b('0xf0'));loggerPredictive[_0xc03b('0x73')](_0x14ce77[_0xc03b('0x38')],_0xc03b('0x1c3'),_0x14ce77[_0xc03b('0x22')]);this['handlePower'](_0x14ce77,0x1);}else if(ifInterval(_0x14ce77[_0xc03b('0x1c4')],_0x14ce77[_0xc03b('0x22')])){this[_0xc03b('0x149')](_0x14ce77,0x1);loggerPredictiveCalls[_0xc03b('0x73')]('[startMethodPredictive][StartProgressive][Loop]',_0x14ce77['startProgressive'],_0x14ce77[_0xc03b('0x38')]);_0x14ce77[_0xc03b('0x6a')]=0x0;_0x14ce77[_0xc03b('0x65')]=0x0;}else if(_0x513836<_0x33aa75&&_0x14ce77[_0xc03b('0x1c5')]===_0xc03b('0x1c6')){freeVariablesPredictive(_0x14ce77);loggerPredictive[_0xc03b('0x73')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0xc03b('0x1c7'),_0x33aa75,_0xc03b('0x22'),_0x14ce77[_0xc03b('0x38')]);}else if(_0x4d206e<_0x14ce77[_0xc03b('0x65')]&&_0x14ce77[_0xc03b('0x1c5')]===_0xc03b('0x1c6')){freeVariablesPredictive(_0x14ce77);loggerPredictive[_0xc03b('0x73')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x4d206e,_0xc03b('0x1c8'),_0x14ce77['predictiveIntervalErlangCallsDroppedCalls'],_0xc03b('0x22'),_0x14ce77['name']);}else if(!ifInterval(_0x14ce77[_0xc03b('0x1c4')],_0x14ce77[_0xc03b('0x22')])&&_['isUndefined'](_0x14ce77[_0xc03b('0x6d')])&&!_[_0xc03b('0x35')](_0x14ce77[_0xc03b('0x22')])){_0x14ce77[_0xc03b('0x6d')]=moment()['format'](_0xc03b('0xf0'));loggerPredictive['info'](_0x14ce77[_0xc03b('0x38')],_0xc03b('0x1c9'),_0x14ce77['startPredictive']);this[_0xc03b('0x1ca')](_0x14ce77[_0xc03b('0x1c4')])[_0xc03b('0xb0')](this[_0xc03b('0x1cb')](_0x14ce77))[_0xc03b('0xb0')](mergeDataErlangB(_0x14ce77))[_0xc03b('0xb0')](this[_0xc03b('0x1cc')](_0x14ce77))['catch'](loggerCatchPredictive(_0xc03b('0x1cd'),_0x14ce77));}else if(!ifInterval(_0x14ce77[_0xc03b('0x1c4')],_0x14ce77[_0xc03b('0x6d')])){_0x14ce77[_0xc03b('0x65')]=0x0;_0x14ce77[_0xc03b('0x6d')]=moment()[_0xc03b('0x71')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xc03b('0x73')](_0x14ce77[_0xc03b('0x38')],_0xc03b('0x1ce'),_0x14ce77[_0xc03b('0x6d')]);clearInterval(_0x14ce77[_0xc03b('0x87')]);_0x14ce77[_0xc03b('0x87')]=undefined;this['averageHandleTime'](_0x14ce77[_0xc03b('0x1c4')])['then'](this[_0xc03b('0x1cb')](_0x14ce77))[_0xc03b('0xb0')](mergeDataErlangB(_0x14ce77))[_0xc03b('0xb0')](this[_0xc03b('0x1cc')](_0x14ce77))[_0xc03b('0xa9')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x14ce77));}else if(_0x14ce77['predictiveIntervalAvailable']&&_0x3ce9dc<_0x14ce77[_0xc03b('0x69')]-_0xdb3c1c){freeVariablesPredictive(_0x14ce77);loggerPredictive[_0xc03b('0x73')](_0x14ce77[_0xc03b('0x38')],_0xc03b('0x1cf'),_0x3ce9dc,_0xc03b('0x1d0'),_0x14ce77[_0xc03b('0x69')],'-',_0xdb3c1c,'=',_0x14ce77[_0xc03b('0x69')]-_0xdb3c1c,')');}else if(_0x14ce77['predictiveIntervalAvailable']&&_0x3ce9dc>_0x14ce77[_0xc03b('0x69')]+_0x51490e){freeVariablesPredictive(_0x14ce77);loggerPredictive[_0xc03b('0x73')](_0x14ce77[_0xc03b('0x38')],_0xc03b('0x1cf'),_0x3ce9dc,_0xc03b('0x1d1'),_0x14ce77[_0xc03b('0x69')],'+',_0x51490e,'=',_0x14ce77['predictiveIntervalAvailable']+_0x51490e,')');}};Dialer[_0xc03b('0xa1')][_0xc03b('0x1cb')]=function(_0x38593b){var _0x343d9c=this;return function(_0x1a0226){return new BPromise(function(_0x3c3c9e,_0x52920d){_[_0xc03b('0xc6')](_0x38593b,_0x1a0226[0x0]);if(checkGetDataPredictive(_0x1a0226[0x0])){var _0xb86a8a=_0x38593b[_0xc03b('0x69')]=_0x38593b['talking']+_0x38593b[_0xc03b('0x49')];var _0x1f99aa=_0x38593b[_0xc03b('0x1c4')]*0x3c;var _0x5ce011=_0x1a0226[0x0][_0xc03b('0x62')]+_0x1a0226[0x0][_0xc03b('0x7c')];var _0x322268=(_0x1a0226[0x0][_0xc03b('0x78')]+_0x1a0226[0x0][_0xc03b('0x63')]+_0x1a0226[0x0][_0xc03b('0x1d2')])/_0x1a0226[0x0][_0xc03b('0x76')];_0x38593b[_0xc03b('0x66')]=_0x322268>0x0?_0x322268:0x1;switch(_0x38593b[_0xc03b('0x1c5')]){case _0xc03b('0x1c6'):var _0xd1beba=_0x38593b[_0xc03b('0x1ba')]/0x64;return _0x343d9c['abandonmentRate'](_0xb86a8a,_0x1f99aa,_0x5ce011,_0x322268,_0xd1beba)[_0xc03b('0xb0')](function(_0x43b252){return _0x3c3c9e(_0x43b252);});case _0xc03b('0x1d3'):var _0x2d149b=_0x38593b[_0xc03b('0x1ba')]/0x64;return _0x343d9c[_0xc03b('0x1d4')](_0xb86a8a,_0x1f99aa,_0x5ce011,_0x322268,_0x2d149b)['then'](function(_0x52bd70){return _0x3c3c9e(_0x52bd70);});default:return _0x52920d(msgResponse(_0xc03b('0x1d5'),_0xc03b('0x136'),_0xc03b('0x1d6')));}}else{return _0x52920d(msgResponse(_0xc03b('0x1d5'),_0xc03b('0x136'),_0xc03b('0x1d7')));}});};};Dialer[_0xc03b('0xa1')][_0xc03b('0x1d8')]=function(_0x5212be){var _0x5bee3b=this;return function(_0x11a61c){return new BPromise(function(_0xcd9313,_0x55e407){_[_0xc03b('0xc6')](_0x5212be,_0x11a61c[0x0]);if(checkGetDataPredictive(_0x11a61c[0x0])){loggerPredictive[_0xc03b('0x73')](JSON[_0xc03b('0x42')](_0x11a61c[0x0]));if(_0x5212be[_0xc03b('0x1c5')]===_0xc03b('0x1c6')){return _0x5bee3b[_0xc03b('0xbe')](_0x5212be['id'])[_0xc03b('0xb0')](function(_0x3cc170){var _0x3a95ff=_0x5212be[_0xc03b('0x4a')]-_0x3cc170[0x0]['outboundQueuePauses'];var _0x4d4489=_0x5212be[_0xc03b('0x1c4')]*0x3c;var _0x4f6f06=_0x11a61c[0x0]['predictiveIntervalAvgTalktime']+_0x11a61c[0x0][_0xc03b('0x7c')];var _0x4afc27=(_0x11a61c[0x0][_0xc03b('0x78')]+_0x11a61c[0x0][_0xc03b('0x63')]+_0x11a61c[0x0][_0xc03b('0x1d2')])/_0x11a61c[0x0]['predictiveIntervalTotalCalls'];var _0x30d2d1=_0x5212be[_0xc03b('0x1ba')]/0x64;_0x5212be['predictiveIntervalPauses']=_0x3cc170[0x0][_0xc03b('0x1d9')]||0x0;_0x5212be[_0xc03b('0x66')]=_0x4afc27>0x0?_0x4afc27:0x1;return _0x5bee3b[_0xc03b('0x1da')](_0x3a95ff,_0x4d4489,_0x4f6f06,_0x4afc27,_0x30d2d1);})[_0xc03b('0xb0')](function(_0x5136e6){return _0xcd9313(_0x5136e6);})[_0xc03b('0xa9')](function(_0xf0294c){return _0x55e407(msgResponse(_0xc03b('0x1db'),_0xc03b('0x136'),JSON[_0xc03b('0x42')](_0xf0294c)));});}if(_0x5212be[_0xc03b('0x1c5')]===_0xc03b('0x1d3')){return _0x5bee3b['getVoiceQueueRtPauses'](_0x5212be['id'])['then'](function(_0x2e8d67){var _0x519d20=_0x5212be[_0xc03b('0x4a')]-_0x2e8d67[0x0][_0xc03b('0x1d9')];var _0xf43afc=_0x5212be[_0xc03b('0x1c4')]*0x3c;var _0x179e9e=_0x11a61c[0x0][_0xc03b('0x62')]+_0x11a61c[0x0][_0xc03b('0x7c')];var _0x12f483=(_0x11a61c[0x0][_0xc03b('0x78')]+_0x11a61c[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x11a61c[0x0][_0xc03b('0x1d2')])/_0x11a61c[0x0]['predictiveIntervalTotalCalls'];var _0x7d94df=_0x5212be['dialPredictiveOptimizationPercentage']/0x64;_0x5212be[_0xc03b('0x68')]=_0x2e8d67[0x0][_0xc03b('0x1d9')]||0x0;_0x5212be['predictiveIntervalHitRate']=_0x12f483>0x0?_0x12f483:0x1;return _0x5bee3b[_0xc03b('0x1d4')](_0x519d20,_0xf43afc,_0x179e9e,_0x12f483,_0x7d94df);})[_0xc03b('0xb0')](function(_0x38aad5){return _0xcd9313(_0x38aad5);})['catch'](function(_0x2f59c1){return _0x55e407(msgResponse('[CatchErlangB]',_0xc03b('0x136'),JSON[_0xc03b('0x42')](_0x2f59c1)));});}}else{return _0x55e407(msgResponse('[getDataPredictive]',_0xc03b('0x136'),'check\x20failure'));}});};};Dialer[_0xc03b('0xa1')][_0xc03b('0x1cc')]=function(_0x414d7e){var _0x2902ac=this;return function(){var _0x5c20f0=0x0;var _0x22545b=Math[_0xc03b('0x1be')](_0x414d7e[_0xc03b('0x6b')]*0x3e8);if(_0x22545b>0x0){_0x22545b=_0x22545b<0x64?0x64:_0x22545b;loggerPredictive[_0xc03b('0x73')](_0x414d7e[_0xc03b('0x38')],_0xc03b('0x1dc'),_0x22545b,_0xc03b('0x43'));_0x414d7e[_0xc03b('0x87')]=setInterval(function(){_0x2902ac[_0xc03b('0x87')](_0x414d7e);loggerPredictiveCalls[_0xc03b('0x73')](_0xc03b('0x1dd'),_0x5c20f0+=0x1);},_0x22545b);}else{loggerPredictive['info'](_0x414d7e[_0xc03b('0x38')],_0xc03b('0x1de'));}};};Dialer['prototype']['checkContactBlack']=function(_0x973fc9,_0x55c295){var _0x4c3b5a=this;return function(_0x339e09){if(_['isEmpty'](_0x339e09)){if(_[_0xc03b('0xa5')](_0x55c295['UserId'])||!_0x55c295[_0xc03b('0x1df')]){if(_0x973fc9[_0xc03b('0x54')]==='booked'){_0x973fc9[_0xc03b('0x11f')]=_[_0xc03b('0x35')](_0x973fc9[_0xc03b('0x11f')])?!![]:_0x973fc9[_0xc03b('0x11f')];var _0x15a51a=uuid['v4']();_0x4c3b5a[_0xc03b('0x1e')][_0x15a51a]=new Action(_0x973fc9,_0x55c295,_0x15a51a);loggerBooked[_0xc03b('0x73')](_0xc03b('0x1e0'),_0x15a51a,'queueStatusComplete:\x20',JSON['stringify'](_0x973fc9[_0xc03b('0x11f')]),'Queue:\x20',_0x973fc9['name']);if(_0x973fc9[_0xc03b('0x11f')]){_0x973fc9[_0xc03b('0x11f')]=![];_0x4c3b5a[_0xc03b('0x11e')][_0x4c3b5a['actions'][_0x15a51a]['queue']]=[];ami[_0xc03b('0xa6')]({'actionid':_0x15a51a,'action':'queuestatus','queue':_0x973fc9[_0xc03b('0x38')]})['catch'](function(){_0x4c3b5a[_0xc03b('0xab')](_0x973fc9);_0x4c3b5a['rescheduleContact']({'active':![],'ContactId':_0x4c3b5a['actions'][_0x15a51a]['ContactId'],'ListId':_0x4c3b5a[_0xc03b('0x1e')][_0x15a51a][_0xc03b('0xc9')],'VoiceQueueId':_0x4c3b5a[_0xc03b('0x1e')][_0x15a51a][_0xc03b('0xcb')]||undefined,'CampaignId':_0x4c3b5a[_0xc03b('0x1e')][_0x15a51a][_0xc03b('0xf1')]||undefined})[_0xc03b('0xa9')](loggerCatch(_0xc03b('0x1e1')));delete _0x4c3b5a[_0xc03b('0x1e')][_0x15a51a];});}else{loggerBooked[_0xc03b('0x73')](_0xc03b('0x1e2'),JSON[_0xc03b('0x42')](_0x973fc9[_0xc03b('0x11f')]),_0xc03b('0x1e3'),_0x973fc9[_0xc03b('0x38')]);_0x4c3b5a[_0xc03b('0xab')](_0x973fc9);_0x4c3b5a[_0xc03b('0xb6')]({'active':![],'ContactId':_0x4c3b5a['actions'][_0x15a51a][_0xc03b('0xc8')],'ListId':_0x4c3b5a[_0xc03b('0x1e')][_0x15a51a]['ListId'],'VoiceQueueId':_0x4c3b5a[_0xc03b('0x1e')][_0x15a51a]['VoiceQueueId']||undefined,'CampaignId':_0x4c3b5a[_0xc03b('0x1e')][_0x15a51a][_0xc03b('0xf1')]||undefined})[_0xc03b('0xa9')](loggerCatch(_0xc03b('0x1e1')));delete _0x4c3b5a[_0xc03b('0x1e')][_0x15a51a];}}else{return _0x4c3b5a['actionOriginate'](_0x973fc9,_0x55c295);}}else{if(getDiff(_0x55c295[_0xc03b('0x1e4')])<_0x973fc9[_0xc03b('0x1e5')]*0x3c){if(_0x55c295[_0xc03b('0x1e6')]&&!_0x55c295[_0xc03b('0x1e6')]['voicePause']){_0x4c3b5a[_0xc03b('0x17')]['run'](_0x55c295['id'])[_0xc03b('0x16')](function(){_0x4c3b5a[_0xc03b('0xab')](_0x973fc9);});}else{_0x4c3b5a[_0xc03b('0xb8')]({'active':![]},_0x55c295['id'],0x1)[_0xc03b('0x16')](function(){_0x4c3b5a[_0xc03b('0xab')](_0x973fc9);});}}else{_0x973fc9['outboundReCallsDay']+=0x1;_0x4c3b5a[_0xc03b('0xab')](_0x973fc9);if(_0x973fc9['dialRecallInQueue']){_0x4c3b5a['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x55c295[_0xc03b('0xc8')],'ListId':_0x55c295[_0xc03b('0xc9')],'VoiceQueueId':_0x55c295[_0xc03b('0xcb')]||undefined,'CampaignId':_0x55c295[_0xc03b('0xf1')]||undefined})['catch'](loggerCatch(_0xc03b('0x1e7')));_0x4c3b5a[_0xc03b('0xc0')](createObjHistory(_0x973fc9,_0x55c295,'RECALLINQUEUE',0x17,_0xc03b('0x1e8')))[_0xc03b('0xa9')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x4c3b5a[_0xc03b('0xc5')](createObjHistory(_0x973fc9,_0x55c295,_0xc03b('0x1e9'),0x16,_0xc03b('0x1ea')),'[Originate][HistoryRecallClose][historyCatch]',_0xc03b('0x1eb'));}}}}else{_0x973fc9[_0xc03b('0x1ec')]+=0x1;_0x4c3b5a['saveInDb'](createObjHistory(_0x973fc9,_0x55c295,_0xc03b('0x1ed'),0xd,_0xc03b('0x1ee')),_0xc03b('0x1ef'),'[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer[_0xc03b('0xa1')]['handleIvr']=function(_0x2166f5){var _0xc03116=this;var _0x198723=_0x2166f5[_0xc03b('0x1f0')]-_0x2166f5['originated']-_0x2166f5[_0xc03b('0xba')];emitCampaignSummary(_0x2166f5);if(_0x198723>0x0){if(_0x198723>this[_0xc03b('0x1c')]){_0x198723=this[_0xc03b('0x1c')];}_0x2166f5[_0xc03b('0xba')]+=_0x198723;this[_0xc03b('0xbc')](_0x2166f5['id'],_0x198723,_0x2166f5[_0xc03b('0x1f1')],_0x2166f5)['then'](function(_0x3d49e8){_0x2166f5[_0xc03b('0xba')]-=_0x198723;_0x2166f5['temp']=_0x2166f5[_0xc03b('0xba')]>0x0?_0x2166f5[_0xc03b('0xba')]:0x0;if(!checkContactEmpty(_0x3d49e8)){_0x2166f5[_0xc03b('0x36')]=_0xc03b('0x97');logger[_0xc03b('0x73')](_0xc03b('0x1f2')+_0x2166f5[_0xc03b('0x38')]);}else{_0x2166f5[_0xc03b('0x90')]+=_0x3d49e8[_0xc03b('0x126')];_0x2166f5['message']=_0xc03b('0x1f3');for(var _0x55c411=0x0;_0x55c411<_0x3d49e8[_0xc03b('0x126')];_0x55c411+=0x1){_0x2166f5[_0xc03b('0x1f4')]+=0x1;if(_[_0xc03b('0xa5')](_0x3d49e8[_0x55c411])||_[_0xc03b('0xa5')](_0x3d49e8[_0x55c411]['Contact'])||_[_0xc03b('0xa5')](_0x3d49e8[_0x55c411][_0xc03b('0x159')]['phone'])){_0xc03116[_0xc03b('0x1f5')](_0xc03b('0x1f6'),_0x2166f5,_0x3d49e8[_0x55c411]);}else{_0xc03116['checkIsBlackListIvr'](_[_0xc03b('0xc7')](_0x3d49e8[_0x55c411],[_0xc03b('0xf1'),'Contact.phone']))['then'](_0xc03116[_0xc03b('0x1f7')](_0x2166f5,_0x3d49e8[_0x55c411]))[_0xc03b('0xa9')](_0xc03116[_0xc03b('0xc3')](_0xc03b('0x1f8'),_0x2166f5));}}}})[_0xc03b('0xa9')](loggerGetContactDialer('[getContactCampaign2]',_0x2166f5,_0x198723));}};Dialer[_0xc03b('0xa1')][_0xc03b('0x149')]=function(_0x5e45f5,_0x39360f){var _0x3c356e=this;var _0x538612=[];var _0x29cb7f=_0x39360f>=0x1?_0x39360f:0x1;if(_0x5e45f5['dialMethod']===_0xc03b('0x14b')){_0x29cb7f=0x1;}var _0x114ff4=Math[_0xc03b('0x1be')](_0x5e45f5[_0xc03b('0x49')]*_0x29cb7f)-_0x5e45f5[_0xc03b('0x90')]-_0x5e45f5[_0xc03b('0xba')];emitVoiceQueueSummary(_0x5e45f5);if(_0x5e45f5['dialLimitQueue']>0x0){var _0x11911e=_0x5e45f5[_0xc03b('0x1f9')]-_0x5e45f5[_0xc03b('0x90')]-_0x5e45f5[_0xc03b('0x4e')]-_0x5e45f5[_0xc03b('0xba')]-_0x5e45f5[_0xc03b('0x4b')];if(_0x114ff4>_0x11911e){_0x114ff4=_0x11911e;}}if(_0x114ff4>0x0){if(_0x5e45f5[_0xc03b('0x54')]===_0xc03b('0x14b')){_0x114ff4=0x1;}if(_0x114ff4>this['maxNumberOriginate']){_0x114ff4=this['maxNumberOriginate'];}_0x5e45f5[_0xc03b('0xba')]+=_0x114ff4;for(var _0x17306f in this[_0xc03b('0x1a')]){if(typeof this[_0xc03b('0x1a')][_0x17306f]!==_0xc03b('0x91')){if(this[_0xc03b('0x1a')][_0x17306f][_0xc03b('0x9e')]==='not_inuse'&&this[_0xc03b('0x1a')][_0x17306f]['status']===_0xc03b('0x1fa')){_0x538612['push'](this[_0xc03b('0x1a')][_0x17306f]['id']);}}}this[_0xc03b('0xb9')](_0x5e45f5['id'],_0x538612,_0x114ff4,_0x5e45f5['dialOrderByScheduledAt'],_0x5e45f5)['then'](function(_0x3ff18e){_0x5e45f5[_0xc03b('0xba')]-=_0x114ff4;_0x5e45f5[_0xc03b('0xba')]=_0x5e45f5[_0xc03b('0xba')]>0x0?_0x5e45f5[_0xc03b('0xba')]:0x0;if(!checkContactEmpty(_0x3ff18e)){_0x3c356e[_0xc03b('0xae')](_0x5e45f5)[_0xc03b('0xb0')](sendMessageReschedule(_0x5e45f5))[_0xc03b('0xa9')](loggerCatch('[countReScheduled]\x20'));}else{_0x5e45f5[_0xc03b('0x90')]+=_0x3ff18e[_0xc03b('0x126')];_0x5e45f5['message']=_0x5e45f5[_0xc03b('0x54')]===_0xc03b('0x14b')?'ACTIVE':_0xc03b('0x1f3');for(var _0x121888=0x0;_0x121888<_0x3ff18e[_0xc03b('0x126')];_0x121888+=0x1){if(_['isNil'](_0x3ff18e[_0x121888])||_[_0xc03b('0xa5')](_0x3ff18e[_0x121888][_0xc03b('0x159')])||_[_0xc03b('0xa5')](_0x3ff18e[_0x121888][_0xc03b('0x159')]['phone'])){_0x3c356e[_0xc03b('0x1f5')](_0xc03b('0x1f6'),_0x5e45f5,_0x3ff18e[_0x121888]);}else{_0x3c356e[_0xc03b('0xb2')](_[_0xc03b('0xc7')](_0x3ff18e[_0x121888],[_0xc03b('0xcb'),_0xc03b('0x1fb')]))[_0xc03b('0xb0')](_0x3c356e[_0xc03b('0x1f7')](_0x5e45f5,_0x3ff18e[_0x121888]))[_0xc03b('0xa9')](_0x3c356e[_0xc03b('0xc3')](_0xc03b('0x1f6'),_0x5e45f5));}}}})[_0xc03b('0xa9')](loggerGetContactDialer(_0xc03b('0x1fc'),_0x5e45f5,_0x114ff4));}};Dialer[_0xc03b('0xa1')][_0xc03b('0x87')]=function(_0x44f5a5){if(_0x44f5a5[_0xc03b('0x1f9')]>0x0){var _0x44ac57=_0x44f5a5['dialLimitQueue']-_0x44f5a5[_0xc03b('0x90')]-_0x44f5a5[_0xc03b('0x4e')];if(_0x44ac57>0x0){this[_0xc03b('0x1fd')](_0x44f5a5);}else{loggerPredictiveCalls['info'](_0xc03b('0x1fe'));}}else{this[_0xc03b('0x1fd')](_0x44f5a5);}};Dialer[_0xc03b('0xa1')][_0xc03b('0x1fd')]=function(_0x38154c){var _0x1f0b97=this;var _0x899fdf=[];_0x38154c[_0xc03b('0x90')]+=0x1;for(var _0x152dfe in this[_0xc03b('0x1a')]){if(typeof this[_0xc03b('0x1a')][_0x152dfe]!==_0xc03b('0x91')){if(this[_0xc03b('0x1a')][_0x152dfe][_0xc03b('0x9e')]===_0xc03b('0x1ff')&&this[_0xc03b('0x1a')][_0x152dfe][_0xc03b('0xa7')]===_0xc03b('0x1fa')){_0x899fdf[_0xc03b('0x140')](this[_0xc03b('0x1a')][_0x152dfe]['id']);}}}this['getContactDialer'](_0x38154c['id'],_0x899fdf,0x1,_0x38154c[_0xc03b('0x1f1')],_0x38154c)[_0xc03b('0xb0')](function(_0x436722){if(!checkContactEmpty(_0x436722)){checkContactLowerLimitOriginate(_0x38154c,0x1,0x0);_0x1f0b97[_0xc03b('0xae')](_0x38154c)[_0xc03b('0xb0')](sendMessageReschedule(_0x38154c))[_0xc03b('0xa9')](loggerCatch(_0xc03b('0xb1')));}else{_0x38154c[_0xc03b('0x36')]=_0xc03b('0x1f3');if(_['isNil'](_0x436722[0x0])||_['isNil'](_0x436722[0x0][_0xc03b('0x159')])||_['isNil'](_0x436722[0x0]['Contact'][_0xc03b('0x15a')])){_0x1f0b97[_0xc03b('0x1f5')](_0xc03b('0x1f6'),_0x38154c,_0x436722[0x0]);}else{_0x1f0b97[_0xc03b('0xb2')](_[_0xc03b('0xc7')](_0x436722[0x0],[_0xc03b('0xcb'),_0xc03b('0x1fb')]))[_0xc03b('0xb0')](_0x1f0b97[_0xc03b('0x1f7')](_0x38154c,_0x436722[0x0]))[_0xc03b('0xa9')](_0x1f0b97[_0xc03b('0xc3')](_0xc03b('0x200'),_0x38154c));}}})['catch'](loggerGetContactDialer(_0xc03b('0x201'),_0x38154c,0x1));emitVoiceQueueSummary(_0x38154c);};Dialer[_0xc03b('0xa1')][_0xc03b('0x1da')]=function(_0x44120e,_0x224a35,_0x2501ce,_0x3118ec,_0x518092,_0x29c7bb){loggerPredictive['info'](_0xc03b('0x202'));loggerPredictive[_0xc03b('0x73')]('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',_0x44120e);loggerPredictive[_0xc03b('0x73')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x224a35);loggerPredictive[_0xc03b('0x73')](_0xc03b('0x203'),_0x2501ce);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',_0x3118ec);loggerPredictive[_0xc03b('0x73')](_0xc03b('0x204'),_0x518092);loggerPredictive[_0xc03b('0x73')]('---------------------------');return new BPromise(function(_0x53b723,_0x599a83){if(_0x44120e<=0x0||isNaN(_0x44120e)){return _0x599a83(msgResponse('[abandonmentRate]',_0xc03b('0x41'),_0xc03b('0x205')+_0x44120e));}if(_0x2501ce<=0x0||isNaN(_0x2501ce)){return _0x599a83(msgResponse(_0xc03b('0x206'),_0xc03b('0x41'),'Ts\x20=\x20'+_0x2501ce));}if(_0x3118ec<=0x0||isNaN(_0x3118ec)){return _0x599a83(msgResponse(_0xc03b('0x206'),_0xc03b('0x41'),_0xc03b('0x207')+_0x3118ec));}if(_0x224a35<=0x0||isNaN(_0x224a35)){return _0x599a83(msgResponse(_0xc03b('0x206'),'Error','interval\x20=\x20'+_0x224a35));}if(_0x518092<=0x0||isNaN(_0x518092)){return _0x599a83(msgResponse('[abandonmentRate]',_0xc03b('0x41'),_0xc03b('0x208')+_0x518092));}_0x29c7bb=_0x29c7bb||0x0;var _0xb6984f=0x1/_0x2501ce;var _0x32bfc2=0x0;var _0x251b00=0x0;var _0x56e51b=0x0;var _0x218c24=0x0;for(var _0x282715=0x0;_0x56e51b<_0x518092;_0x282715+=0x1){_0x251b00=_0x282715/_0x224a35;_0x32bfc2=(_0x3118ec*_0x251b00+_0x29c7bb)/_0xb6984f;_0x56e51b=erlangb(_0x32bfc2,_0x44120e);_0x218c24=_0x32bfc2/_0x44120e*(0x1-erlangb(_0x32bfc2,_0x44120e));}return _0x53b723({'erlangCalls':_0x282715,'erlangCallToSecond':_0x224a35/_0x282715,'erlangAbandonmentRate':_0x56e51b,'erlangBusyFactor':_0x218c24});});};Dialer['prototype'][_0xc03b('0x1d4')]=function(_0x5335e0,_0x5c70ef,_0x4927f0,_0x19403b,_0x3be170,_0x151e15){loggerPredictive[_0xc03b('0x73')](_0xc03b('0x209'));loggerPredictive['info'](_0xc03b('0x20a'),_0x5335e0);loggerPredictive[_0xc03b('0x73')](_0xc03b('0x20b'),_0x5c70ef);loggerPredictive[_0xc03b('0x73')]('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',_0x4927f0);loggerPredictive[_0xc03b('0x73')]('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',_0x19403b);loggerPredictive['info']('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3be170);loggerPredictive['info'](_0xc03b('0x7e'));return new BPromise(function(_0x5ef2cc,_0x5db5d2){if(_0x5335e0<=0x0||isNaN(_0x5335e0)){return _0x5db5d2(msgResponse(_0xc03b('0x20c'),_0xc03b('0x41'),_0xc03b('0x205')+_0x5335e0));}if(_0x4927f0<=0x0||isNaN(_0x4927f0)){return _0x5db5d2(msgResponse(_0xc03b('0x20c'),_0xc03b('0x41'),_0xc03b('0x20d')+_0x4927f0));}if(_0x19403b<=0x0||isNaN(_0x19403b)){return _0x5db5d2(msgResponse('[busyFactor]',_0xc03b('0x41'),_0xc03b('0x207')+_0x19403b));}if(_0x5c70ef<=0x0||isNaN(_0x5c70ef)){return _0x5db5d2(msgResponse(_0xc03b('0x20c'),'Error','interval\x20=\x20'+_0x5c70ef));}if(_0x3be170<=0x0||isNaN(_0x3be170)){return _0x5db5d2(msgResponse(_0xc03b('0x20c'),_0xc03b('0x41'),'Umin\x20=\x20'+_0x3be170));}_0x151e15=_0x151e15||0x0;var _0x1d9f8e=0x1/_0x4927f0;var _0x402039=0x0;var _0x282336=0x0;var _0x4e58e0=0x0;var _0x287ec9=0x0;for(var _0x37c9ea=0x0;_0x287ec9<_0x3be170;_0x37c9ea+=0x1){_0x282336=_0x37c9ea/_0x5c70ef;_0x402039=(_0x19403b*_0x282336+_0x151e15)/_0x1d9f8e;_0x4e58e0=erlangb(_0x402039,_0x5335e0);_0x287ec9=_0x402039/_0x5335e0*(0x1-erlangb(_0x402039,_0x5335e0));}return _0x5ef2cc({'erlangCalls':_0x37c9ea,'erlangCallToSecond':_0x5c70ef/_0x37c9ea,'erlangAbandonmentRate':_0x4e58e0,'erlangBusyFactor':_0x287ec9});});};module[_0xc03b('0x20e')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index d4f6e0f..1660d40 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 _0x3383=['lodash','milliseconds','diff','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','ringtime','talktime','membername','connectedlinename','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util'];(function(_0x3242cd,_0x299125){var _0x209c55=function(_0x24e784){while(--_0x24e784){_0x3242cd['push'](_0x3242cd['shift']());}};_0x209c55(++_0x299125);}(_0x3383,0x1cd));var _0x3338=function(_0x244eab,_0x443a51){_0x244eab=_0x244eab-0x0;var _0x329ef6=_0x3383[_0x244eab];return _0x329ef6;};'use strict';var util=require(_0x3338('0x0'));var _=require(_0x3338('0x1'));var moment=require('moment');function getSeconds(_0x96bd5d,_0x46f95c){var _0x25be7b=moment(_0x96bd5d)['milliseconds'](0x0);var _0x3449fe=moment(_0x46f95c)[_0x3338('0x2')](0x0);return _0x25be7b[_0x3338('0x3')](_0x3449fe,'seconds');}function QueueCallerAbandon(_0x45657d,_0x463b1b){this['scheduledat']=_0x45657d[_0x3338('0x4')];this[_0x3338('0x5')]=_0x45657d[_0x3338('0x5')];this[_0x3338('0x6')]=_0x45657d[_0x3338('0x5')]===_0x3338('0x7')?_0x3338('0x8'):_0x45657d[_0x3338('0x5')];this[_0x3338('0x9')]=_0x45657d[_0x3338('0x9')];this[_0x3338('0xa')]=_0x45657d['countcongestionretry'];this[_0x3338('0xb')]=_0x45657d[_0x3338('0xb')];this[_0x3338('0xc')]=_0x45657d['countbusyretry']+_0x45657d['countcongestionretry']+_0x45657d[_0x3338('0xb')]+_0x45657d[_0x3338('0xd')]+_0x45657d[_0x3338('0xe')]+_0x45657d[_0x3338('0xf')]+_0x45657d[_0x3338('0x10')]+_0x45657d['countagentrejectretry'];this[_0x3338('0xd')]=_0x45657d['countnosuchnumberretry'];this[_0x3338('0xe')]=_0x45657d[_0x3338('0xe')];this[_0x3338('0xf')]=_0x45657d[_0x3338('0xf')];this[_0x3338('0x10')]=_0x45657d[_0x3338('0x10')];this[_0x3338('0x11')]=_0x45657d[_0x3338('0x11')];this[_0x3338('0x12')]=_0x463b1b['uniqueid'];this[_0x3338('0x13')]=_0x45657d[_0x3338('0x14')];this[_0x3338('0x15')]=_0x45657d[_0x3338('0x16')];this['starttime']=_0x45657d[_0x3338('0x17')];this[_0x3338('0x18')]=_0x45657d[_0x3338('0x18')];this[_0x3338('0x19')]=_0x45657d[_0x3338('0x19')];this['endtime']=this['droptime'];this[_0x3338('0x1a')]=getSeconds(_0x45657d[_0x3338('0x18')],_0x45657d['starttime']);this['holdtime']=getSeconds(this[_0x3338('0x19')],_0x45657d[_0x3338('0x18')]);this[_0x3338('0x1b')]=0x0;this[_0x3338('0x8')]=_0x463b1b['queue'];this[_0x3338('0x1c')]=_0x463b1b[_0x3338('0x1d')];this[_0x3338('0x1e')]=_0x463b1b[_0x3338('0x1e')];this['callback']=_0x45657d['callback'];this[_0x3338('0x1f')]=_0x45657d[_0x3338('0x1f')];this[_0x3338('0x20')]=_0x45657d['callbackat'];this['recallme']=_0x45657d[_0x3338('0x21')];this[_0x3338('0x22')]=_0x45657d[_0x3338('0x22')];this[_0x3338('0x23')]=_0x45657d[_0x3338('0x23')];this[_0x3338('0x24')]=_0x45657d['UserId'];this[_0x3338('0x25')]=_0x45657d[_0x3338('0x25')];this[_0x3338('0x26')]=_0x45657d[_0x3338('0x26')];this['originatecalleridnum']=_0x45657d[_0x3338('0x27')]||'';this[_0x3338('0x28')]=_0x45657d[_0x3338('0x28')]||'';}module[_0x3338('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0x9311=['starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','diff','scheduledat','type','campaigntype','queue','countnoanswerretry','countglobal','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum'];(function(_0x404d94,_0x44931a){var _0x218432=function(_0x4a65df){while(--_0x4a65df){_0x404d94['push'](_0x404d94['shift']());}};_0x218432(++_0x44931a);}(_0x9311,0x1e4));var _0x1931=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9311[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x1931('0x0'));var _=require(_0x1931('0x1'));var moment=require('moment');function getSeconds(_0x5ba71e,_0x1c255b){var _0x3585a8=moment(_0x5ba71e)['milliseconds'](0x0);var _0x5af6e3=moment(_0x1c255b)['milliseconds'](0x0);return _0x3585a8[_0x1931('0x2')](_0x5af6e3,'seconds');}function QueueCallerAbandon(_0x5aa926,_0x18c89c){this[_0x1931('0x3')]=_0x5aa926['scheduledat'];this[_0x1931('0x4')]=_0x5aa926[_0x1931('0x4')];this[_0x1931('0x5')]=_0x5aa926[_0x1931('0x4')]==='outbound'?_0x1931('0x6'):_0x5aa926[_0x1931('0x4')];this['countbusyretry']=_0x5aa926['countbusyretry'];this['countcongestionretry']=_0x5aa926['countcongestionretry'];this[_0x1931('0x7')]=_0x5aa926[_0x1931('0x7')];this[_0x1931('0x8')]=_0x5aa926[_0x1931('0x9')]+_0x5aa926[_0x1931('0xa')]+_0x5aa926[_0x1931('0x7')]+_0x5aa926[_0x1931('0xb')]+_0x5aa926[_0x1931('0xc')]+_0x5aa926[_0x1931('0xd')]+_0x5aa926[_0x1931('0xe')]+_0x5aa926['countagentrejectretry'];this['countnosuchnumberretry']=_0x5aa926['countnosuchnumberretry'];this[_0x1931('0xc')]=_0x5aa926[_0x1931('0xc')];this['countabandonedretry']=_0x5aa926[_0x1931('0xd')];this[_0x1931('0xe')]=_0x5aa926[_0x1931('0xe')];this[_0x1931('0xf')]=_0x5aa926['countagentrejectretry'];this['uniqueid']=_0x18c89c[_0x1931('0x10')];this[_0x1931('0x11')]=_0x5aa926[_0x1931('0x12')];this[_0x1931('0x13')]=_0x5aa926['number'];this[_0x1931('0x14')]=_0x5aa926['starttime'];this[_0x1931('0x15')]=_0x5aa926['responsetime'];this[_0x1931('0x16')]=_0x5aa926['droptime'];this[_0x1931('0x17')]=this[_0x1931('0x16')];this[_0x1931('0x18')]=getSeconds(_0x5aa926[_0x1931('0x15')],_0x5aa926[_0x1931('0x14')]);this[_0x1931('0x19')]=getSeconds(this['droptime'],_0x5aa926['responsetime']);this[_0x1931('0x1a')]=0x0;this['queue']=_0x18c89c[_0x1931('0x6')];this[_0x1931('0x1b')]=_0x18c89c[_0x1931('0x1c')];this[_0x1931('0x1d')]=_0x18c89c[_0x1931('0x1d')];this[_0x1931('0x1e')]=_0x5aa926[_0x1931('0x1e')];this[_0x1931('0x1f')]=_0x5aa926[_0x1931('0x1f')];this[_0x1931('0x20')]=_0x5aa926[_0x1931('0x20')];this['recallme']=_0x5aa926[_0x1931('0x21')];this[_0x1931('0x22')]=_0x5aa926['ContactId'];this[_0x1931('0x23')]=_0x5aa926['ListId'];this[_0x1931('0x24')]=_0x5aa926[_0x1931('0x24')];this[_0x1931('0x25')]=_0x5aa926[_0x1931('0x25')];this[_0x1931('0x26')]=_0x5aa926[_0x1931('0x26')];this[_0x1931('0x27')]=_0x5aa926['originatecalleridnum']||'';this[_0x1931('0x28')]=_0x5aa926[_0x1931('0x28')]||'';}module[_0x1931('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index a33d165..ecedd51 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(_0xb4eca7,_0x18c07d){var _0x38468e=function(_0x43087b){while(--_0x43087b){_0xb4eca7['push'](_0xb4eca7['shift']());}};_0x38468e(++_0x18c07d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file +var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0xbaba3,_0x2f0270){var _0x5b166d=function(_0x1d1c6e){while(--_0x1d1c6e){_0xbaba3['push'](_0xbaba3['shift']());}};_0x5b166d(++_0x2f0270);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 1ac72fc..33bc0f2 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 _0x79cd=['channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','notify','.pdf','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','merge','response','AttachmentId','update','then','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','finally','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','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','execute','%s/%s.tif','dir','XMF-PATH','Action','variablesAction','ext','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncOriginateResponse','prototype','context','hasOwnProperty','exten','localstationid','channel','name','info','uniqueid','\x20syncNewchannel\x20','syncVarSet','variable','value'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x79cd,0x1ab));var _0xd79c=function(_0xbd236a,_0x274557){_0xbd236a=_0xbd236a-0x0;var _0x19154b=_0x79cd[_0xbd236a];return _0x19154b;};'use strict';var util=require(_0xd79c('0x0'));var _=require(_0xd79c('0x1'));var BPromise=require(_0xd79c('0x2'));var uuid=require(_0xd79c('0x3'));var moment=require(_0xd79c('0x4'));var path=require(_0xd79c('0x5'));var tiff2pdf=require(_0xd79c('0x6'));var gs=require(_0xd79c('0x7'));var logger=require(_0xd79c('0x8'))(_0xd79c('0x9'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require(_0xd79c('0xa'));var ut=require(_0xd79c('0xb'));var Action=require(_0xd79c('0xc'));var faxAccount=require(_0xd79c('0xd'));var attachment=require(_0xd79c('0xe'));var faxMessage=require(_0xd79c('0xf'));function Fax(_0xafdda){this[_0xd79c('0x10')]={};this[_0xd79c('0x11')]=_0xafdda['faxAccounts'];this[_0xd79c('0x12')]=_0xafdda[_0xd79c('0x12')];this[_0xd79c('0x13')]={};ami['on'](_0xd79c('0x14'),this[_0xd79c('0x15')][_0xd79c('0x16')](this));ami['on']('varset',this['syncVarSet'][_0xd79c('0x16')](this));ami['on'](_0xd79c('0x17'),this[_0xd79c('0x18')][_0xd79c('0x16')](this));ami['on'](_0xd79c('0x19'),this[_0xd79c('0x1a')][_0xd79c('0x16')](this));ami['on'](_0xd79c('0x1b'),this[_0xd79c('0x1c')][_0xd79c('0x16')](this));ami['on'](_0xd79c('0x1d'),this[_0xd79c('0x1e')]['bind'](this));ami['on']('hangup',this['syncHangup'][_0xd79c('0x16')](this));ami['on']('originateresponse',this[_0xd79c('0x1f')]['bind'](this));}Fax[_0xd79c('0x20')]['syncNewchannel']=function(_0x27b808){if(_0x27b808[_0xd79c('0x21')]==='from-voip-provider'){for(var _0xab6493 in this[_0xd79c('0x11')]){if(this[_0xd79c('0x11')][_0xd79c('0x22')](_0xab6493)){if(_0x27b808[_0xd79c('0x23')]===this['faxAccounts'][_0xab6493][_0xd79c('0x24')]){this['channels'][_0x27b808['uniqueid']]={};this['channels'][_0x27b808['uniqueid']][_0xd79c('0x25')]=_0x27b808[_0xd79c('0x25')];this[_0xd79c('0x10')][_0x27b808['uniqueid']]['id']=this[_0xd79c('0x11')][_0xab6493]['id'];this['channels'][_0x27b808['uniqueid']][_0xd79c('0x26')]=this['faxAccounts'][_0xab6493][_0xd79c('0x26')];logger[_0xd79c('0x27')](_0x27b808[_0xd79c('0x28')],_0xd79c('0x29'));}}}}if(this[_0xd79c('0x13')][_0x27b808[_0xd79c('0x28')]]){this[_0xd79c('0x10')][_0x27b808[_0xd79c('0x28')]]={};this[_0xd79c('0x10')][_0x27b808['uniqueid']]['channel']=_0x27b808['channel'];logger[_0xd79c('0x27')](_0x27b808[_0xd79c('0x28')],_0xd79c('0x29'));}};Fax[_0xd79c('0x20')][_0xd79c('0x2a')]=function(_0x3a8a5c){if(this[_0xd79c('0x10')][_0x3a8a5c[_0xd79c('0x28')]]){for(var _0x1adfe4 in _0x3a8a5c[_0xd79c('0x2b')]){if(_0x3a8a5c['variable'][_0xd79c('0x22')](_0x1adfe4)){this[_0xd79c('0x10')][_0x3a8a5c['uniqueid']][_0x1adfe4]=_0x3a8a5c[_0xd79c('0x2c')];}}}};Fax['prototype'][_0xd79c('0x18')]=function(_0x4f93ff){if(this[_0xd79c('0x10')][_0x4f93ff[_0xd79c('0x28')]]){this[_0xd79c('0x10')][_0x4f93ff[_0xd79c('0x28')]][_0xd79c('0x2d')]=_0x4f93ff[_0xd79c('0x2d')];this['channels'][_0x4f93ff[_0xd79c('0x28')]][_0xd79c('0x2e')]=_0x4f93ff[_0xd79c('0x2e')];}};Fax['prototype']['syncNewExten']=function(_0x2c6625){if(this[_0xd79c('0x10')][_0x2c6625[_0xd79c('0x28')]]){for(var _0xd258d7 in _0x2c6625[_0xd79c('0x2b')]){if(_0x2c6625['variable']['hasOwnProperty'](_0xd258d7)){this[_0xd79c('0x10')][_0x2c6625[_0xd79c('0x28')]][_0xd258d7]=_0x2c6625[_0xd79c('0x2c')];}}}};Fax['prototype'][_0xd79c('0x1c')]=function(_0x3e1a14){if(this['channels'][_0x3e1a14[_0xd79c('0x28')]]){this['channels'][_0x3e1a14['uniqueid']][_0xd79c('0x2f')]=_0x3e1a14[_0xd79c('0x2f')];this[_0xd79c('0x10')][_0x3e1a14[_0xd79c('0x28')]]['status']=_0x3e1a14[_0xd79c('0x30')];this[_0xd79c('0x10')][_0x3e1a14[_0xd79c('0x28')]][_0xd79c('0x24')]=_0x3e1a14['localstationid'];this[_0xd79c('0x10')][_0x3e1a14[_0xd79c('0x28')]][_0xd79c('0x31')]=_0x3e1a14[_0xd79c('0x31')];logger['info'](_0x3e1a14[_0xd79c('0x28')],_0xd79c('0x32'));}};Fax['prototype']['syncReceiveFax']=function(_0x29aca1){var _0xfe9070=this;if(this['channels'][_0x29aca1[_0xd79c('0x28')]]){var _0x320001=this[_0xd79c('0x10')][_0x29aca1['uniqueid']]['id'];this[_0xd79c('0x10')][_0x29aca1[_0xd79c('0x28')]][_0xd79c('0x33')]=_0x29aca1[_0xd79c('0x33')];this['channels'][_0x29aca1[_0xd79c('0x28')]][_0xd79c('0x34')]=_0x29aca1['pagestransferred'];this['channels'][_0x29aca1[_0xd79c('0x28')]][_0xd79c('0x24')]=_0x29aca1[_0xd79c('0x24')];this[_0xd79c('0x10')][_0x29aca1[_0xd79c('0x28')]][_0xd79c('0x35')]=_0x29aca1[_0xd79c('0x35')];this[_0xd79c('0x10')][_0x29aca1[_0xd79c('0x28')]]['transferrate']=_0x29aca1[_0xd79c('0x36')];this[_0xd79c('0x10')][_0x29aca1[_0xd79c('0x28')]][_0xd79c('0x31')]=_0x29aca1[_0xd79c('0x31')];this[_0xd79c('0x10')][_0x29aca1[_0xd79c('0x28')]]['calleridnum']=_0x29aca1[_0xd79c('0x37')];if(this['channels'][_0x29aca1[_0xd79c('0x28')]][_0xd79c('0x34')]>0x0){tiff2pdf(_0x29aca1[_0xd79c('0x31')],_0xd79c('0x38'),function(_0xa808b6){logger[_0xd79c('0x27')](_0x29aca1[_0xd79c('0x28')],_0xd79c('0x39'),_0xa808b6[_0xd79c('0x3a')]);attachment[_0xd79c('0x3b')]({'name':path[_0xd79c('0x3c')](_0x29aca1[_0xd79c('0x31')])[_0xd79c('0x26')],'basename':path[_0xd79c('0x3c')](_0x29aca1[_0xd79c('0x31')])[_0xd79c('0x26')]+'.pdf','type':_0xd79c('0x3d')})['then'](function(_0x3b44f2){faxAccount[_0xd79c('0x3e')](_0x320001,{'from':_0x29aca1[_0xd79c('0x37')],'mapKey':'fax','body':path[_0xd79c('0x3c')](_0x29aca1[_0xd79c('0x31')])[_0xd79c('0x26')]+_0xd79c('0x3f'),'AttachmentId':_0x3b44f2['id']})[_0xd79c('0x40')](function(_0x9ae253){logger['error'](_0x29aca1[_0xd79c('0x28')],_0xd79c('0x41'),JSON[_0xd79c('0x42')](_0x9ae253));});})['catch'](function(_0x52a636){logger[_0xd79c('0x43')](_0x29aca1['uniqueid'],_0xd79c('0x44'),JSON[_0xd79c('0x42')](_0x52a636));});});}logger[_0xd79c('0x27')](_0x29aca1[_0xd79c('0x28')],_0xd79c('0x44'));}};Fax[_0xd79c('0x20')][_0xd79c('0x1f')]=function(_0x41e6dc){if(this[_0xd79c('0x13')][_0x41e6dc['uniqueid']]){_[_0xd79c('0x45')](this[_0xd79c('0x10')][_0x41e6dc[_0xd79c('0x28')]],_['pick'](_0x41e6dc,[_0xd79c('0x46'),'reason']));}};function updateStatus(_0x397a71){if(_0x397a71[_0xd79c('0x47')]){faxMessage[_0xd79c('0x48')](_0x397a71[_0xd79c('0x47')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xd79c('0x49')](function(_0x2b9829){ut[_0xd79c('0x4a')]('[Fax][Message][Error][Updated]',_0x2b9829);})['catch'](function(_0x13857c){ut[_0xd79c('0x4a')](_0xd79c('0x4b'),_0x13857c);});}else{ut[_0xd79c('0x4a')](_0xd79c('0x4c'));}}Fax[_0xd79c('0x20')][_0xd79c('0x4d')]=function(_0x532de8,_0x1598df,_0x7194a7){var _0x597759=this;var _0x2ec753={};if(_0x1598df){_0x2ec753={'read':_0x1598df};}else{_0x2ec753={'failMessage':_0x7194a7};}if(this[_0xd79c('0x13')][_0x532de8][_0xd79c('0x47')]){faxMessage[_0xd79c('0x48')](this['actions'][_0x532de8][_0xd79c('0x47')],_0x2ec753)[_0xd79c('0x49')](function(_0x467342){ut[_0xd79c('0x4a')]('[Fax][Message][Updated]',_0x467342);})[_0xd79c('0x40')](function(_0x4f7463){ut[_0xd79c('0x4a')]('[Fax][Message][NoUpdate1]',_0x4f7463);})[_0xd79c('0x4e')](function(){delete _0x597759[_0xd79c('0x10')][_0x532de8];delete _0x597759[_0xd79c('0x13')][_0x532de8];});}else{ut[_0xd79c('0x4a')]('[Fax][Message][NoUpdate2]');delete this['channels'][_0x532de8];delete this[_0xd79c('0x13')][_0x532de8];}};Fax['prototype']['syncHangup']=function(_0x50d510){var _0xb61760=this;if(this['channels'][_0x50d510[_0xd79c('0x28')]]){if(this[_0xd79c('0x13')][_0x50d510[_0xd79c('0x28')]]){this['channels'][_0x50d510[_0xd79c('0x28')]]['id']=this[_0xd79c('0x13')][_0x50d510[_0xd79c('0x28')]]['id'];this[_0xd79c('0x10')][_0x50d510[_0xd79c('0x28')]][_0xd79c('0x26')]=this['actions'][_0x50d510['uniqueid']][_0xd79c('0x26')];}logger[_0xd79c('0x27')](_0x50d510[_0xd79c('0x28')],this[_0xd79c('0x13')][_0x50d510[_0xd79c('0x28')]]?'\x20hangup\x20sendFile\x20':_0xd79c('0x4f'),JSON[_0xd79c('0x42')](this[_0xd79c('0x10')][_0x50d510[_0xd79c('0x28')]]));if(this['actions'][_0x50d510[_0xd79c('0x28')]]){if(this[_0xd79c('0x10')][_0x50d510['uniqueid']][_0xd79c('0x50')]>0x0&&this[_0xd79c('0x10')][_0x50d510['uniqueid']][_0xd79c('0x1b')]===_0xd79c('0x51')){this[_0xd79c('0x4d')](_0x50d510[_0xd79c('0x28')],!![]);}else{this[_0xd79c('0x4d')](_0x50d510[_0xd79c('0x28')],![],this[_0xd79c('0x10')][_0x50d510[_0xd79c('0x28')]][_0xd79c('0x52')]?_0xd79c('0x53')+this['channels'][_0x50d510['uniqueid']]['faxstatusstring']:_0xd79c('0x54'));}}}};Fax[_0xd79c('0x20')][_0xd79c('0x55')]=function(_0x22eb5e){var _0x56fd6c=this;return new BPromise(function(_0x1c61b4,_0x58bb16){_0x56fd6c[_0xd79c('0x56')](_0x22eb5e,_0x56fd6c[_0xd79c('0x11')][_0x22eb5e['FaxAccountId']])['then'](function(_0x5d57d0){ut[_0xd79c('0x4a')](_0xd79c('0x57'),_0x5d57d0);_0x1c61b4(ut['message'](_0xd79c('0x58')));})[_0xd79c('0x40')](function(_0x5e405e){ut[_0xd79c('0x4a')](_0xd79c('0x59'),_0x5e405e);updateStatus(_0x22eb5e);_0x58bb16(ut[_0xd79c('0x3a')](_0xd79c('0x5a')));});});};Fax[_0xd79c('0x20')][_0xd79c('0x5b')]=function(_0x45f61a){var _0x5e490c=this;return new BPromise(function(_0x457c0e,_0x505fa1){var _0x3c076a=_0x5e490c[_0xd79c('0x5c')](_0x5e490c[_0xd79c('0x11')][_0x45f61a[_0xd79c('0x5d')]][_0xd79c('0x5e')],_0x45f61a);if(_0x3c076a[_0xd79c('0x5f')]){_0x457c0e(ut[_0xd79c('0x3a')]('Trunk\x20Reachable'));}else{_0x505fa1(ut['message'](_0x3c076a[_0xd79c('0x3a')]));}});};function originate(_0x4bde09,_0xeb6872,_0x1b068d){return new BPromise(function(_0x34c711,_0x400d0b){if(_0x1b068d){var _0x63f31f=util[_0xd79c('0x60')](_0xd79c('0x61'),path[_0xd79c('0x3c')](_0x4bde09[_0xd79c('0x5')])[_0xd79c('0x26')],_0x4bde09[_0xd79c('0x5')]);gs[_0xd79c('0x62')](_0x63f31f)[_0xd79c('0x49')](function(){_0x4bde09['path']=util[_0xd79c('0x60')](_0xd79c('0x63'),path[_0xd79c('0x3c')](_0x4bde09[_0xd79c('0x5')])[_0xd79c('0x64')],path['parse'](_0x4bde09[_0xd79c('0x5')])['name']);_0xeb6872[_0xd79c('0x65')]=_0x4bde09[_0xd79c('0x5')];ut[_0xd79c('0x4a')]('Convert\x20pdf\x20to\x20tif','');ami[_0xd79c('0x66')](ut[_0xd79c('0x67')](_0x4bde09,_0xeb6872))[_0xd79c('0x49')](function(_0x20bd6b){_0x34c711(_0x20bd6b);})[_0xd79c('0x40')](function(_0xe8e48f){_0x400d0b(_0xe8e48f);});})['catch'](function(_0xfebdca){_0x400d0b(_0xfebdca);});}else{ami[_0xd79c('0x66')](ut[_0xd79c('0x67')](_0x4bde09,_0xeb6872))[_0xd79c('0x49')](function(_0x2546ed){_0x34c711(_0x2546ed);})['catch'](function(_0x42a4e4){_0x400d0b(_0x42a4e4);});}});}Fax[_0xd79c('0x20')][_0xd79c('0x56')]=function(_0x3908de,_0x3b4799){var _0x4990c3=this;return new BPromise(function(_0x10de66,_0xe00c71){var _0x2b248b=uuid['v4']();var _0x43767a=ut['addVariables'](_0x3908de,_0x3b4799);_0x4990c3[_0xd79c('0x13')][_0x2b248b]=new Action(_0x2b248b,_0x3b4799,_0x3908de);var _0x96815b=_0x4990c3[_0xd79c('0x13')][_0x2b248b];if(path[_0xd79c('0x3c')](_0x3908de[_0xd79c('0x5')])[_0xd79c('0x68')]===_0xd79c('0x3f')){originate(_0x96815b,_0x43767a,!![])[_0xd79c('0x49')](function(_0x314a90){_0x10de66(_0x314a90);})[_0xd79c('0x40')](function(_0x136ce3){_0xe00c71(_0x136ce3);});}else{originate(_0x96815b,_0x43767a,![])[_0xd79c('0x49')](function(_0x59db4a){_0x10de66(_0x59db4a);})[_0xd79c('0x40')](function(_0x39be82){_0xe00c71(_0x39be82);});}});};Fax[_0xd79c('0x20')]['isTrunkReachable']=function(_0x3809c2){return!_[_0xd79c('0x69')](_0x3809c2)&&!_[_0xd79c('0x69')](_0x3809c2[_0xd79c('0x26')])&&!_[_0xd79c('0x69')](_0x3809c2[_0xd79c('0x6a')])&&_0x3809c2[_0xd79c('0x6a')]&&!_[_0xd79c('0x69')](this[_0xd79c('0x12')][util[_0xd79c('0x60')]('SIP/%s',_0x3809c2[_0xd79c('0x26')])])&&!_[_0xd79c('0x69')](this[_0xd79c('0x12')][util['format']('SIP/%s',_0x3809c2[_0xd79c('0x26')])][_0xd79c('0x30')])&&(this[_0xd79c('0x12')][util[_0xd79c('0x60')](_0xd79c('0x6b'),_0x3809c2[_0xd79c('0x26')])]['status']===_0xd79c('0x6c')||this[_0xd79c('0x12')][util[_0xd79c('0x60')](_0xd79c('0x6b'),_0x3809c2[_0xd79c('0x26')])][_0xd79c('0x30')]===_0xd79c('0x6d'));};Fax[_0xd79c('0x20')][_0xd79c('0x5c')]=function(_0x26cad4,_0x220be1){if(!this[_0xd79c('0x6e')](_0x26cad4)){ut[_0xd79c('0x4a')](_0xd79c('0x6f'),_[_0xd79c('0x69')](_0x26cad4)?'':_0x26cad4[_0xd79c('0x26')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0xd79c('0x69')](_0x220be1['fax'])){ut[_0xd79c('0x4a')](_0xd79c('0x70'),JSON[_0xd79c('0x42')](_0x220be1));return{'isValid':![],'message':_0xd79c('0x71')};}if(_['isNil'](_0x220be1[_0xd79c('0x5')])){ut[_0xd79c('0x4a')](_0xd79c('0x72'),JSON['stringify'](_0x220be1));return{'isValid':![],'message':_0xd79c('0x73')};}return{'isValid':!![],'message':_0xd79c('0x74')};};module[_0xd79c('0x75')]=Fax; \ No newline at end of file +var _0x74cd=['../rpc/attachment','channels','faxAccounts','trunks','actions','newchannel','bind','syncVarSet','syncNewState','newexten','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','syncNewchannel','context','hasOwnProperty','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status','filename','info','resolution','transferrate','calleridnum','pagestransferred','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxpages','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','variablesAction','Action','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','util','bluebird','uuid','path','tiff2pdf','../../../config/logger','fax','./rpcDb','./channel','../rpc/faxAccount'];(function(_0x53a158,_0x497e1a){var _0xcf6a26=function(_0x42027d){while(--_0x42027d){_0x53a158['push'](_0x53a158['shift']());}};_0xcf6a26(++_0x497e1a);}(_0x74cd,0xde));var _0xd74c=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x74cd[_0x4b7b62];return _0x2280df;};'use strict';var util=require(_0xd74c('0x0'));var _=require('lodash');var BPromise=require(_0xd74c('0x1'));var uuid=require(_0xd74c('0x2'));var moment=require('moment');var path=require(_0xd74c('0x3'));var tiff2pdf=require(_0xd74c('0x4'));var gs=require('./util/gs');var logger=require(_0xd74c('0x5'))(_0xd74c('0x6'));var ami=require('../ami');var rpcDb=require(_0xd74c('0x7'));var Channel=require(_0xd74c('0x8'));var ut=require('./util/util');var Action=require('./action');var faxAccount=require(_0xd74c('0x9'));var attachment=require(_0xd74c('0xa'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x5ec840){this[_0xd74c('0xb')]={};this[_0xd74c('0xc')]=_0x5ec840[_0xd74c('0xc')];this[_0xd74c('0xd')]=_0x5ec840[_0xd74c('0xd')];this[_0xd74c('0xe')]={};ami['on'](_0xd74c('0xf'),this['syncNewchannel'][_0xd74c('0x10')](this));ami['on']('varset',this[_0xd74c('0x11')][_0xd74c('0x10')](this));ami['on']('newstate',this[_0xd74c('0x12')][_0xd74c('0x10')](this));ami['on'](_0xd74c('0x13'),this['syncNewExten'][_0xd74c('0x10')](this));ami['on']('faxstatus',this[_0xd74c('0x14')][_0xd74c('0x10')](this));ami['on'](_0xd74c('0x15'),this[_0xd74c('0x16')][_0xd74c('0x10')](this));ami['on'](_0xd74c('0x17'),this[_0xd74c('0x18')][_0xd74c('0x10')](this));ami['on'](_0xd74c('0x19'),this[_0xd74c('0x1a')][_0xd74c('0x10')](this));}Fax[_0xd74c('0x1b')][_0xd74c('0x1c')]=function(_0x54a234){if(_0x54a234[_0xd74c('0x1d')]==='from-voip-provider'){for(var _0x58c117 in this[_0xd74c('0xc')]){if(this[_0xd74c('0xc')][_0xd74c('0x1e')](_0x58c117)){if(_0x54a234[_0xd74c('0x1f')]===this[_0xd74c('0xc')][_0x58c117][_0xd74c('0x20')]){this['channels'][_0x54a234[_0xd74c('0x21')]]={};this[_0xd74c('0xb')][_0x54a234[_0xd74c('0x21')]][_0xd74c('0x22')]=_0x54a234[_0xd74c('0x22')];this[_0xd74c('0xb')][_0x54a234[_0xd74c('0x21')]]['id']=this['faxAccounts'][_0x58c117]['id'];this['channels'][_0x54a234[_0xd74c('0x21')]]['name']=this['faxAccounts'][_0x58c117][_0xd74c('0x23')];logger['info'](_0x54a234[_0xd74c('0x21')],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0x54a234[_0xd74c('0x21')]]){this['channels'][_0x54a234[_0xd74c('0x21')]]={};this['channels'][_0x54a234[_0xd74c('0x21')]][_0xd74c('0x22')]=_0x54a234[_0xd74c('0x22')];logger['info'](_0x54a234[_0xd74c('0x21')],_0xd74c('0x24'));}};Fax['prototype'][_0xd74c('0x11')]=function(_0x488b0c){if(this[_0xd74c('0xb')][_0x488b0c['uniqueid']]){for(var _0x1e3712 in _0x488b0c['variable']){if(_0x488b0c[_0xd74c('0x25')]['hasOwnProperty'](_0x1e3712)){this[_0xd74c('0xb')][_0x488b0c[_0xd74c('0x21')]][_0x1e3712]=_0x488b0c[_0xd74c('0x26')];}}}};Fax[_0xd74c('0x1b')][_0xd74c('0x12')]=function(_0x1a3fbe){if(this[_0xd74c('0xb')][_0x1a3fbe['uniqueid']]){this[_0xd74c('0xb')][_0x1a3fbe[_0xd74c('0x21')]][_0xd74c('0x27')]=_0x1a3fbe[_0xd74c('0x27')];this['channels'][_0x1a3fbe['uniqueid']][_0xd74c('0x28')]=_0x1a3fbe[_0xd74c('0x28')];}};Fax[_0xd74c('0x1b')][_0xd74c('0x29')]=function(_0x1acddc){if(this[_0xd74c('0xb')][_0x1acddc[_0xd74c('0x21')]]){for(var _0x5b36e1 in _0x1acddc[_0xd74c('0x25')]){if(_0x1acddc[_0xd74c('0x25')][_0xd74c('0x1e')](_0x5b36e1)){this[_0xd74c('0xb')][_0x1acddc[_0xd74c('0x21')]][_0x5b36e1]=_0x1acddc[_0xd74c('0x26')];}}}};Fax[_0xd74c('0x1b')][_0xd74c('0x14')]=function(_0x433f45){if(this['channels'][_0x433f45[_0xd74c('0x21')]]){this['channels'][_0x433f45[_0xd74c('0x21')]][_0xd74c('0x2a')]=_0x433f45['operation'];this[_0xd74c('0xb')][_0x433f45[_0xd74c('0x21')]][_0xd74c('0x2b')]=_0x433f45['status'];this['channels'][_0x433f45[_0xd74c('0x21')]][_0xd74c('0x20')]=_0x433f45[_0xd74c('0x20')];this[_0xd74c('0xb')][_0x433f45[_0xd74c('0x21')]]['filename']=_0x433f45[_0xd74c('0x2c')];logger[_0xd74c('0x2d')](_0x433f45[_0xd74c('0x21')],'\x20syncFaxStatus\x20');}};Fax[_0xd74c('0x1b')][_0xd74c('0x16')]=function(_0x3ab8c9){var _0x1cacd5=this;if(this[_0xd74c('0xb')][_0x3ab8c9[_0xd74c('0x21')]]){var _0x35a2ba=this[_0xd74c('0xb')][_0x3ab8c9[_0xd74c('0x21')]]['id'];this[_0xd74c('0xb')][_0x3ab8c9[_0xd74c('0x21')]]['remotestationid']=_0x3ab8c9['remotestationid'];this[_0xd74c('0xb')][_0x3ab8c9[_0xd74c('0x21')]]['pagestransferred']=_0x3ab8c9['pagestransferred'];this['channels'][_0x3ab8c9[_0xd74c('0x21')]][_0xd74c('0x20')]=_0x3ab8c9[_0xd74c('0x20')];this['channels'][_0x3ab8c9[_0xd74c('0x21')]][_0xd74c('0x2e')]=_0x3ab8c9[_0xd74c('0x2e')];this[_0xd74c('0xb')][_0x3ab8c9[_0xd74c('0x21')]][_0xd74c('0x2f')]=_0x3ab8c9['transferrate'];this[_0xd74c('0xb')][_0x3ab8c9[_0xd74c('0x21')]][_0xd74c('0x2c')]=_0x3ab8c9['filename'];this[_0xd74c('0xb')][_0x3ab8c9['uniqueid']][_0xd74c('0x30')]=_0x3ab8c9[_0xd74c('0x30')];if(this[_0xd74c('0xb')][_0x3ab8c9[_0xd74c('0x21')]][_0xd74c('0x31')]>0x0){tiff2pdf(_0x3ab8c9[_0xd74c('0x2c')],_0xd74c('0x32'),function(_0x370176){logger[_0xd74c('0x2d')](_0x3ab8c9[_0xd74c('0x21')],_0xd74c('0x33'),_0x370176[_0xd74c('0x34')]);attachment['create']({'name':path[_0xd74c('0x35')](_0x3ab8c9[_0xd74c('0x2c')])['name'],'basename':path['parse'](_0x3ab8c9[_0xd74c('0x2c')])[_0xd74c('0x23')]+_0xd74c('0x36'),'type':_0xd74c('0x37')})[_0xd74c('0x38')](function(_0x528bf2){faxAccount[_0xd74c('0x39')](_0x35a2ba,{'from':_0x3ab8c9['calleridnum'],'mapKey':_0xd74c('0x6'),'body':path[_0xd74c('0x35')](_0x3ab8c9[_0xd74c('0x2c')])[_0xd74c('0x23')]+_0xd74c('0x36'),'AttachmentId':_0x528bf2['id']})[_0xd74c('0x3a')](function(_0x44209d){logger[_0xd74c('0x3b')](_0x3ab8c9[_0xd74c('0x21')],_0xd74c('0x3c'),JSON[_0xd74c('0x3d')](_0x44209d));});})[_0xd74c('0x3a')](function(_0xf2c732){logger[_0xd74c('0x3b')](_0x3ab8c9[_0xd74c('0x21')],_0xd74c('0x3e'),JSON['stringify'](_0xf2c732));});});}logger[_0xd74c('0x2d')](_0x3ab8c9[_0xd74c('0x21')],_0xd74c('0x3e'));}};Fax[_0xd74c('0x1b')][_0xd74c('0x1a')]=function(_0x203828){if(this['actions'][_0x203828[_0xd74c('0x21')]]){_[_0xd74c('0x3f')](this[_0xd74c('0xb')][_0x203828[_0xd74c('0x21')]],_[_0xd74c('0x40')](_0x203828,[_0xd74c('0x41'),_0xd74c('0x42')]));}};function updateStatus(_0x1ea1c6){if(_0x1ea1c6['AttachmentId']){faxMessage[_0xd74c('0x43')](_0x1ea1c6[_0xd74c('0x44')],{'failMessage':_0xd74c('0x45')})[_0xd74c('0x38')](function(_0x389e7a){ut[_0xd74c('0x46')](_0xd74c('0x47'),_0x389e7a);})[_0xd74c('0x3a')](function(_0x2ede78){ut['logger'](_0xd74c('0x48'),_0x2ede78);});}else{ut[_0xd74c('0x46')](_0xd74c('0x49'));}}Fax[_0xd74c('0x1b')][_0xd74c('0x4a')]=function(_0x4f93aa,_0x804ff,_0xa074a3){var _0x7298ac=this;var _0x3f1fe2={};if(_0x804ff){_0x3f1fe2={'read':_0x804ff};}else{_0x3f1fe2={'failMessage':_0xa074a3};}if(this[_0xd74c('0xe')][_0x4f93aa]['AttachmentId']){faxMessage[_0xd74c('0x43')](this[_0xd74c('0xe')][_0x4f93aa][_0xd74c('0x44')],_0x3f1fe2)[_0xd74c('0x38')](function(_0x892657){ut[_0xd74c('0x46')](_0xd74c('0x4b'),_0x892657);})[_0xd74c('0x3a')](function(_0x257e52){ut[_0xd74c('0x46')](_0xd74c('0x4c'),_0x257e52);})[_0xd74c('0x4d')](function(){delete _0x7298ac[_0xd74c('0xb')][_0x4f93aa];delete _0x7298ac['actions'][_0x4f93aa];});}else{ut['logger'](_0xd74c('0x4e'));delete this['channels'][_0x4f93aa];delete this[_0xd74c('0xe')][_0x4f93aa];}};Fax[_0xd74c('0x1b')][_0xd74c('0x18')]=function(_0x4f80c0){var _0x1c193c=this;if(this[_0xd74c('0xb')][_0x4f80c0[_0xd74c('0x21')]]){if(this[_0xd74c('0xe')][_0x4f80c0[_0xd74c('0x21')]]){this[_0xd74c('0xb')][_0x4f80c0['uniqueid']]['id']=this['actions'][_0x4f80c0[_0xd74c('0x21')]]['id'];this[_0xd74c('0xb')][_0x4f80c0[_0xd74c('0x21')]][_0xd74c('0x23')]=this[_0xd74c('0xe')][_0x4f80c0[_0xd74c('0x21')]][_0xd74c('0x23')];}logger['info'](_0x4f80c0['uniqueid'],this[_0xd74c('0xe')][_0x4f80c0[_0xd74c('0x21')]]?_0xd74c('0x4f'):'\x20hangup\x20faxRiceive\x20',JSON[_0xd74c('0x3d')](this[_0xd74c('0xb')][_0x4f80c0[_0xd74c('0x21')]]));if(this['actions'][_0x4f80c0[_0xd74c('0x21')]]){if(this[_0xd74c('0xb')][_0x4f80c0[_0xd74c('0x21')]][_0xd74c('0x50')]>0x0&&this['channels'][_0x4f80c0[_0xd74c('0x21')]][_0xd74c('0x51')]===_0xd74c('0x52')){this[_0xd74c('0x4a')](_0x4f80c0[_0xd74c('0x21')],!![]);}else{this[_0xd74c('0x4a')](_0x4f80c0['uniqueid'],![],this[_0xd74c('0xb')][_0x4f80c0[_0xd74c('0x21')]][_0xd74c('0x53')]?_0xd74c('0x54')+this['channels'][_0x4f80c0['uniqueid']][_0xd74c('0x53')]:_0xd74c('0x55'));}}}};Fax[_0xd74c('0x1b')][_0xd74c('0x56')]=function(_0x219116){var _0x212210=this;return new BPromise(function(_0x1e742e,_0x56c883){_0x212210[_0xd74c('0x57')](_0x219116,_0x212210[_0xd74c('0xc')][_0x219116[_0xd74c('0x58')]])[_0xd74c('0x38')](function(_0x205e88){ut[_0xd74c('0x46')](_0xd74c('0x59'),_0x205e88);_0x1e742e(ut['message'](_0xd74c('0x5a')));})[_0xd74c('0x3a')](function(_0xc9732f){ut[_0xd74c('0x46')](_0xd74c('0x5b'),_0xc9732f);updateStatus(_0x219116);_0x56c883(ut[_0xd74c('0x34')](_0xd74c('0x5c')));});});};Fax[_0xd74c('0x1b')][_0xd74c('0x5d')]=function(_0x2a7616){var _0x522895=this;return new BPromise(function(_0x2b7775,_0x5f1035){var _0x169eba=_0x522895[_0xd74c('0x5e')](_0x522895['faxAccounts'][_0x2a7616[_0xd74c('0x58')]]['Trunk'],_0x2a7616);if(_0x169eba[_0xd74c('0x5f')]){_0x2b7775(ut['message'](_0xd74c('0x60')));}else{_0x5f1035(ut[_0xd74c('0x34')](_0x169eba[_0xd74c('0x34')]));}});};function originate(_0x42e619,_0x1fb581,_0x172f0a){return new BPromise(function(_0x481e5b,_0x54172e){if(_0x172f0a){var _0x507336=util[_0xd74c('0x61')](_0xd74c('0x62'),path['parse'](_0x42e619[_0xd74c('0x3')])[_0xd74c('0x23')],_0x42e619[_0xd74c('0x3')]);gs[_0xd74c('0x63')](_0x507336)['then'](function(){_0x42e619[_0xd74c('0x3')]=util[_0xd74c('0x61')](_0xd74c('0x64'),path[_0xd74c('0x35')](_0x42e619[_0xd74c('0x3')])[_0xd74c('0x65')],path[_0xd74c('0x35')](_0x42e619[_0xd74c('0x3')])[_0xd74c('0x23')]);_0x1fb581[_0xd74c('0x66')]=_0x42e619['path'];ut[_0xd74c('0x46')]('Convert\x20pdf\x20to\x20tif','');ami['Action'](ut[_0xd74c('0x67')](_0x42e619,_0x1fb581))[_0xd74c('0x38')](function(_0x171cb4){_0x481e5b(_0x171cb4);})['catch'](function(_0x97c1e8){_0x54172e(_0x97c1e8);});})[_0xd74c('0x3a')](function(_0x13c7cf){_0x54172e(_0x13c7cf);});}else{ami[_0xd74c('0x68')](ut[_0xd74c('0x67')](_0x42e619,_0x1fb581))['then'](function(_0x1211df){_0x481e5b(_0x1211df);})[_0xd74c('0x3a')](function(_0x2c92b9){_0x54172e(_0x2c92b9);});}});}Fax[_0xd74c('0x1b')][_0xd74c('0x57')]=function(_0x3baf35,_0x27b8db){var _0x2307b8=this;return new BPromise(function(_0x102492,_0x1766ad){var _0x556d6a=uuid['v4']();var _0x57be28=ut['addVariables'](_0x3baf35,_0x27b8db);_0x2307b8[_0xd74c('0xe')][_0x556d6a]=new Action(_0x556d6a,_0x27b8db,_0x3baf35);var _0x290c7d=_0x2307b8[_0xd74c('0xe')][_0x556d6a];if(path['parse'](_0x3baf35[_0xd74c('0x3')])[_0xd74c('0x69')]===_0xd74c('0x36')){originate(_0x290c7d,_0x57be28,!![])[_0xd74c('0x38')](function(_0x4fdaf8){_0x102492(_0x4fdaf8);})[_0xd74c('0x3a')](function(_0x3f895f){_0x1766ad(_0x3f895f);});}else{originate(_0x290c7d,_0x57be28,![])[_0xd74c('0x38')](function(_0x7e551a){_0x102492(_0x7e551a);})[_0xd74c('0x3a')](function(_0x3c1b7d){_0x1766ad(_0x3c1b7d);});}});};Fax[_0xd74c('0x1b')][_0xd74c('0x6a')]=function(_0x572a56){return!_[_0xd74c('0x6b')](_0x572a56)&&!_[_0xd74c('0x6b')](_0x572a56[_0xd74c('0x23')])&&!_[_0xd74c('0x6b')](_0x572a56['active'])&&_0x572a56[_0xd74c('0x6c')]&&!_[_0xd74c('0x6b')](this[_0xd74c('0xd')][util[_0xd74c('0x61')](_0xd74c('0x6d'),_0x572a56['name'])])&&!_[_0xd74c('0x6b')](this['trunks'][util[_0xd74c('0x61')](_0xd74c('0x6d'),_0x572a56['name'])][_0xd74c('0x2b')])&&(this[_0xd74c('0xd')][util[_0xd74c('0x61')](_0xd74c('0x6d'),_0x572a56['name'])][_0xd74c('0x2b')]===_0xd74c('0x6e')||this[_0xd74c('0xd')][util[_0xd74c('0x61')](_0xd74c('0x6d'),_0x572a56['name'])][_0xd74c('0x2b')]==='unmonitored');};Fax[_0xd74c('0x1b')][_0xd74c('0x5e')]=function(_0x43a91d,_0xd9863){if(!this['isTrunkReachable'](_0x43a91d)){ut[_0xd74c('0x46')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0xd74c('0x6b')](_0x43a91d)?'':_0x43a91d[_0xd74c('0x23')]+_0xd74c('0x6f'));return{'isValid':![],'message':_0xd74c('0x70')};}if(_[_0xd74c('0x6b')](_0xd9863[_0xd74c('0x6')])){ut[_0xd74c('0x46')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xd74c('0x3d')](_0xd9863));return{'isValid':![],'message':_0xd74c('0x71')};}if(_[_0xd74c('0x6b')](_0xd9863[_0xd74c('0x3')])){ut[_0xd74c('0x46')](_0xd74c('0x72'),JSON[_0xd74c('0x3d')](_0xd9863));return{'isValid':![],'message':_0xd74c('0x73')};}return{'isValid':!![],'message':'Is\x20Valid'};};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 4ff228f..defc4b1 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 _0xb9c8=['../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','resolve','then','[Notify]\x20','util','bluebird'];(function(_0x396067,_0x3d9454){var _0x14f19c=function(_0x44e59a){while(--_0x44e59a){_0x396067['push'](_0x396067['shift']());}};_0x14f19c(++_0x3d9454);}(_0xb9c8,0x9a));var _0x8b9c=function(_0x359377,_0x1a63ef){_0x359377=_0x359377-0x0;var _0x8be18a=_0xb9c8[_0x359377];return _0x8be18a;};'use strict';var util=require(_0x8b9c('0x0'));var BPromise=require(_0x8b9c('0x1'));var logger=require(_0x8b9c('0x2'))(_0x8b9c('0x3'));var _=require(_0x8b9c('0x4'));var faxAccount=require(_0x8b9c('0x5'));function loggerCatch(_0x57a844){return function(_0x1cb9d8){logger[_0x8b9c('0x6')](_0x57a844,util[_0x8b9c('0x7')](_0x1cb9d8,{'showHidden':![],'depth':null}));};}exports[_0x8b9c('0x8')]=function(_0x5c4d76,_0x596ae9){return BPromise[_0x8b9c('0x9')]()[_0x8b9c('0xa')](faxAccount[_0x8b9c('0x8')](_0x5c4d76,_0x596ae9))['catch'](loggerCatch(_0x8b9c('0xb')));}; \ No newline at end of file +var _0x8b86=['notify','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','resolve','then'];(function(_0x111ebb,_0x3bdf26){var _0x686016=function(_0x27c8ab){while(--_0x27c8ab){_0x111ebb['push'](_0x111ebb['shift']());}};_0x686016(++_0x3bdf26);}(_0x8b86,0x1d7));var _0x68b8=function(_0x2c6120,_0x1f3e60){_0x2c6120=_0x2c6120-0x0;var _0x5fb114=_0x8b86[_0x2c6120];return _0x5fb114;};'use strict';var util=require(_0x68b8('0x0'));var BPromise=require(_0x68b8('0x1'));var logger=require(_0x68b8('0x2'))(_0x68b8('0x3'));var _=require(_0x68b8('0x4'));var faxAccount=require(_0x68b8('0x5'));function loggerCatch(_0x50a476){return function(_0x592913){logger[_0x68b8('0x6')](_0x50a476,util[_0x68b8('0x7')](_0x592913,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x4408db,_0x1f28f7){return BPromise[_0x68b8('0x8')]()[_0x68b8('0x9')](faxAccount[_0x68b8('0xa')](_0x4408db,_0x1f28f7))[_0x68b8('0xb')](loggerCatch(_0x68b8('0xc')));}; \ 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 96012b4..34ac789 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 _0x97b9=['info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','child_process','exec'];(function(_0x1d50a3,_0x3213ff){var _0x4d8902=function(_0x79d1ba){while(--_0x79d1ba){_0x1d50a3['push'](_0x1d50a3['shift']());}};_0x4d8902(++_0x3213ff);}(_0x97b9,0x86));var _0x997b=function(_0xa5d547,_0x49e8e8){_0xa5d547=_0xa5d547-0x0;var _0x3139b5=_0x97b9[_0xa5d547];return _0x3139b5;};'use strict';var util=require(_0x997b('0x0'));var logger=require(_0x997b('0x1'))(_0x997b('0x2'));var BPromise=require(_0x997b('0x3'));var exec=require(_0x997b('0x4'))[_0x997b('0x5')];exports['execute']=function(_0x1b39c0){return new BPromise(function(_0x30c43d,_0xb60cc1){exec(_0x1b39c0,function(_0x411156,_0x201e16,_0x55fd41){logger[_0x997b('0x6')]('Exec\x20gs',_0x201e16);if(_0x411156){logger['info'](_0x997b('0x7'),_0x997b('0x8'),util[_0x997b('0x9')](_0x411156,{'showHidden':![],'depth':null}),_0x201e16,_0x55fd41);_0xb60cc1(_0x411156);}_0x30c43d(_0x201e16);});});}; \ No newline at end of file +var _0x7922=['bluebird','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax'];(function(_0xb8609e,_0x3d8b3c){var _0x15483a=function(_0x516b3a){while(--_0x516b3a){_0xb8609e['push'](_0xb8609e['shift']());}};_0x15483a(++_0x3d8b3c);}(_0x7922,0x151));var _0x2792=function(_0x486537,_0x8573ad){_0x486537=_0x486537-0x0;var _0x3a672e=_0x7922[_0x486537];return _0x3a672e;};'use strict';var util=require(_0x2792('0x0'));var logger=require(_0x2792('0x1'))(_0x2792('0x2'));var BPromise=require(_0x2792('0x3'));var exec=require('child_process')[_0x2792('0x4')];exports[_0x2792('0x5')]=function(_0x58b2ae){return new BPromise(function(_0x3dc531,_0x1781b8){exec(_0x58b2ae,function(_0x4aec7d,_0x4d1e8f,_0x1bda89){logger[_0x2792('0x6')](_0x2792('0x7'),_0x4d1e8f);if(_0x4aec7d){logger['info']('Exec\x20gs',_0x2792('0x8'),util[_0x2792('0x9')](_0x4aec7d,{'showHidden':![],'depth':null}),_0x4d1e8f,_0x1bda89);_0x1781b8(_0x4aec7d);}_0x3dc531(_0x4d1e8f);});});}; \ 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 aff7dc9..936b524 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 _0x98c0=['\x22%s\x22\x20<%s>','headerinfo','util','lodash','moment','fax','message','logger','info','inspect','addVariables','ecm','minrate','modem','gateway','faxdetect','t38timeout','localstationid','variablesAction','uniqueid','originate','channel','xcally-motion-fax','format'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x98c0,0xc2));var _0x098c=function(_0x526b3c,_0x5f261a){_0x526b3c=_0x526b3c-0x0;var _0x5e09b8=_0x98c0[_0x526b3c];return _0x5e09b8;};'use strict';var util=require(_0x098c('0x0'));var _=require(_0x098c('0x1'));var moment=require(_0x098c('0x2'));var logger=require('../../../../config/logger')(_0x098c('0x3'));exports[_0x098c('0x4')]=function(_0x4d7480){return{'message':_0x4d7480};};exports[_0x098c('0x5')]=function(_0x29e704,_0x1418e2){logger[_0x098c('0x6')](_0x29e704,util[_0x098c('0x7')](_0x1418e2,{'showHidden':![],'depth':null}));};exports[_0x098c('0x8')]=function(_0x556e9e,_0x4055d4){var _0x5360cb={'XMF-ECM':_0x4055d4[_0x098c('0x9')],'XMF-HEADERINFO':_0x4055d4['headerinfo'],'XMF-MINRATE':_0x4055d4[_0x098c('0xa')],'XMF-MAXRATE':_0x4055d4['maxrate'],'XMF-MODEM':util['format']('\x22%s\x22',_0x4055d4[_0x098c('0xb')]),'XMF-GATEWAY':_0x4055d4[_0x098c('0xc')],'XMF-FAXDETECT':_0x4055d4[_0x098c('0xd')],'XMF-T38TIMEOUT':_0x4055d4[_0x098c('0xe')],'XMF-LOCALSTATIONID':_0x4055d4[_0x098c('0xf')],'XMF-PATH':_0x556e9e['path']};return _0x5360cb;};exports[_0x098c('0x10')]=function(_0x30f543,_0x3d32f8){return{'actionid':_0x30f543[_0x098c('0x11')],'action':_0x098c('0x12'),'channel':_0x30f543[_0x098c('0x13')],'Exten':_0x098c('0x14'),'Context':'from-sip','Priority':'1','callerid':util[_0x098c('0x15')](_0x098c('0x16'),_0x30f543[_0x098c('0x17')]?_0x30f543[_0x098c('0x17')]:'',_0x30f543[_0x098c('0xf')]),'variable':_0x3d32f8,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x30f543[_0x098c('0x11')]};}; \ No newline at end of file +var _0xcf5e=['inspect','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','headerinfo','util','lodash','../../../../config/logger','fax','logger','info'];(function(_0x49aba2,_0xbbe935){var _0x1310f7=function(_0x5ea166){while(--_0x5ea166){_0x49aba2['push'](_0x49aba2['shift']());}};_0x1310f7(++_0xbbe935);}(_0xcf5e,0x132));var _0xecf5=function(_0x16acf1,_0x2cd252){_0x16acf1=_0x16acf1-0x0;var _0x3bf1f1=_0xcf5e[_0x16acf1];return _0x3bf1f1;};'use strict';var util=require(_0xecf5('0x0'));var _=require(_0xecf5('0x1'));var moment=require('moment');var logger=require(_0xecf5('0x2'))(_0xecf5('0x3'));exports['message']=function(_0x309621){return{'message':_0x309621};};exports[_0xecf5('0x4')]=function(_0x5c549f,_0x273f88){logger[_0xecf5('0x5')](_0x5c549f,util[_0xecf5('0x6')](_0x273f88,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x3bbb8d,_0x32c19e){var _0x261871={'XMF-ECM':_0x32c19e['ecm'],'XMF-HEADERINFO':_0x32c19e['headerinfo'],'XMF-MINRATE':_0x32c19e[_0xecf5('0x7')],'XMF-MAXRATE':_0x32c19e[_0xecf5('0x8')],'XMF-MODEM':util[_0xecf5('0x9')](_0xecf5('0xa'),_0x32c19e[_0xecf5('0xb')]),'XMF-GATEWAY':_0x32c19e[_0xecf5('0xc')],'XMF-FAXDETECT':_0x32c19e[_0xecf5('0xd')],'XMF-T38TIMEOUT':_0x32c19e[_0xecf5('0xe')],'XMF-LOCALSTATIONID':_0x32c19e[_0xecf5('0xf')],'XMF-PATH':_0x3bbb8d[_0xecf5('0x10')]};return _0x261871;};exports[_0xecf5('0x11')]=function(_0x44a534,_0x3e984b){return{'actionid':_0x44a534[_0xecf5('0x12')],'action':_0xecf5('0x13'),'channel':_0x44a534[_0xecf5('0x14')],'Exten':_0xecf5('0x15'),'Context':'from-sip','Priority':'1','callerid':util['format'](_0xecf5('0x16'),_0x44a534[_0xecf5('0x17')]?_0x44a534[_0xecf5('0x17')]:'',_0x44a534[_0xecf5('0xf')]),'variable':_0x3e984b,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x44a534[_0xecf5('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 2f0345a..d960006 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 _0xd200=['sync','log','bluebird','util','moment','./server','./realtime','./report','./acw','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getFreshdeskAccounts','getDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getDynamics365Accounts','getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','listen'];(function(_0x4464bc,_0x24d9bc){var _0x516215=function(_0x4ed6e5){while(--_0x4ed6e5){_0x4464bc['push'](_0x4464bc['shift']());}};_0x516215(++_0x24d9bc);}(_0xd200,0x8e));var _0x0d20=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xd200[_0x2064e5];return _0x21a233;};'use strict';var BPromise=require(_0x0d20('0x0'));var util=require(_0x0d20('0x1'));var moment=require(_0x0d20('0x2'));var server=require(_0x0d20('0x3'));var Realtime=require(_0x0d20('0x4'));var Report=require(_0x0d20('0x5'));var Acw=require(_0x0d20('0x6'));var Trigger=require(_0x0d20('0x7'));var Dialer=require('./dialer');var Preview=require(_0x0d20('0x8'));var Fax=require(_0x0d20('0x9'));var user=require(_0x0d20('0xa'));var voiceQueue=require(_0x0d20('0xb'));var voiceQueueReport=require(_0x0d20('0xc'));var voiceCallReport=require(_0x0d20('0xd'));var trunk=require(_0x0d20('0xe'));var trigger=require(_0x0d20('0xf'));var template=require(_0x0d20('0x10'));var cmHopperHistory=require(_0x0d20('0x11'));var campaign=require(_0x0d20('0x12'));var voiceExtension=require(_0x0d20('0x13'));var faxAccount=require(_0x0d20('0x14'));var zendesk=require(_0x0d20('0x15'));var salesforce=require(_0x0d20('0x16'));var sugarcrm=require(_0x0d20('0x17'));var freshdesk=require(_0x0d20('0x18'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x0d20('0x19'));var vtiger=require(_0x0d20('0x1a'));var freshsales=require(_0x0d20('0x1b'));var servicenow=require(_0x0d20('0x1c'));var dynamics365=require(_0x0d20('0x1d'));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()[_0x0d20('0x1e')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x0d20('0x1e')](_0x0d20('0x1f'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x0d20('0x20')]()[_0x0d20('0x21')](user[_0x0d20('0x22')]())[_0x0d20('0x21')](realtime[_0x0d20('0x23')]())[_0x0d20('0x21')](user[_0x0d20('0x24')]())[_0x0d20('0x21')](realtime[_0x0d20('0x25')]())[_0x0d20('0x21')](trunk[_0x0d20('0x26')]())[_0x0d20('0x21')](realtime[_0x0d20('0x27')]())['then'](voiceQueue['getVoiceQueues']())[_0x0d20('0x21')](realtime[_0x0d20('0x28')]())[_0x0d20('0x21')](trigger[_0x0d20('0x29')]())[_0x0d20('0x21')](realtime[_0x0d20('0x2a')]())[_0x0d20('0x21')](template[_0x0d20('0x2b')]())['then'](realtime[_0x0d20('0x2c')]())['then'](zendesk['getZendeskAccounts']())[_0x0d20('0x21')](realtime[_0x0d20('0x2d')]())['then'](salesforce[_0x0d20('0x2e')]())[_0x0d20('0x21')](realtime[_0x0d20('0x2f')]())['then'](sugarcrm['getSugarcrmAccounts']())[_0x0d20('0x21')](realtime['initSugarcrmAccounts']())[_0x0d20('0x21')](freshdesk[_0x0d20('0x30')]())[_0x0d20('0x21')](realtime['initFreshdeskAccounts']())[_0x0d20('0x21')](desk[_0x0d20('0x31')]())[_0x0d20('0x21')](realtime['initDeskAccounts']())[_0x0d20('0x21')](zoho[_0x0d20('0x32')]())[_0x0d20('0x21')](realtime['initZohoAccounts']())[_0x0d20('0x21')](vtiger[_0x0d20('0x33')]())[_0x0d20('0x21')](realtime[_0x0d20('0x34')]())[_0x0d20('0x21')](freshsales['getFreshsalesAccounts']())[_0x0d20('0x21')](realtime[_0x0d20('0x35')]())[_0x0d20('0x21')](servicenow['getServicenowAccounts']())[_0x0d20('0x21')](realtime['initServicenowAccounts']())['then'](dynamics365[_0x0d20('0x36')]())['then'](realtime['initDynamics365Accounts']())[_0x0d20('0x21')](campaign['getCampaigns']())[_0x0d20('0x21')](realtime['initCampaigns']())[_0x0d20('0x21')](voiceExtension[_0x0d20('0x37')]())[_0x0d20('0x21')](realtime['initVoiceExtensions']())[_0x0d20('0x21')](faxAccount[_0x0d20('0x38')]())[_0x0d20('0x21')](realtime[_0x0d20('0x39')]())[_0x0d20('0x21')](function(){return realtime;});}function initParams(){return BPromise[_0x0d20('0x20')]()[_0x0d20('0x21')](voiceQueueReport[_0x0d20('0x3a')]())['then'](realtime[_0x0d20('0x3b')]())[_0x0d20('0x21')](cmHopperHistory[_0x0d20('0x3c')]())[_0x0d20('0x21')](realtime[_0x0d20('0x3d')]())['then'](cmHopperHistory[_0x0d20('0x3e')]())[_0x0d20('0x21')](realtime[_0x0d20('0x3f')]())[_0x0d20('0x21')](voiceCallReport[_0x0d20('0x40')]())[_0x0d20('0x21')](realtime[_0x0d20('0x41')]())[_0x0d20('0x21')](function(_0x10c118){})[_0x0d20('0x42')](function(_0x4e519f){console['log'](_0x4e519f);});}function main(){return server[_0x0d20('0x43')](realtime,preview,fax)['then'](function(_0xf300e5){return initRealtime();})[_0x0d20('0x21')](function(){return initParams();})[_0x0d20('0x21')](function(){report[_0x0d20('0x44')]();setInterval(initRealtime,0x1388);})[_0x0d20('0x42')](function(_0xbc17bf){console[_0x0d20('0x45')](_0xbc17bf);});}main(); \ No newline at end of file +var _0xed25=['./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','get','hour','resolve','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','util','moment','./realtime','./acw'];(function(_0x55b460,_0x497077){var _0x3ac537=function(_0xd709b3){while(--_0xd709b3){_0x55b460['push'](_0x55b460['shift']());}};_0x3ac537(++_0x497077);}(_0xed25,0x15a));var _0x5ed2=function(_0xe3d4a2,_0x5dbf95){_0xe3d4a2=_0xe3d4a2-0x0;var _0x131efb=_0xed25[_0xe3d4a2];return _0x131efb;};'use strict';var BPromise=require('bluebird');var util=require(_0x5ed2('0x0'));var moment=require(_0x5ed2('0x1'));var server=require('./server');var Realtime=require(_0x5ed2('0x2'));var Report=require('./report');var Acw=require(_0x5ed2('0x3'));var Trigger=require(_0x5ed2('0x4'));var Dialer=require(_0x5ed2('0x5'));var Preview=require('./preview');var Fax=require(_0x5ed2('0x6'));var user=require(_0x5ed2('0x7'));var voiceQueue=require(_0x5ed2('0x8'));var voiceQueueReport=require(_0x5ed2('0x9'));var voiceCallReport=require(_0x5ed2('0xa'));var trunk=require(_0x5ed2('0xb'));var trigger=require(_0x5ed2('0xc'));var template=require(_0x5ed2('0xd'));var cmHopperHistory=require(_0x5ed2('0xe'));var campaign=require(_0x5ed2('0xf'));var voiceExtension=require(_0x5ed2('0x10'));var faxAccount=require(_0x5ed2('0x11'));var zendesk=require(_0x5ed2('0x12'));var salesforce=require(_0x5ed2('0x13'));var sugarcrm=require(_0x5ed2('0x14'));var freshdesk=require(_0x5ed2('0x15'));var desk=require(_0x5ed2('0x16'));var zoho=require(_0x5ed2('0x17'));var vtiger=require(_0x5ed2('0x18'));var freshsales=require(_0x5ed2('0x19'));var servicenow=require(_0x5ed2('0x1a'));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()[_0x5ed2('0x1b')](_0x5ed2('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x5ed2('0x1b')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x5ed2('0x1d')]()[_0x5ed2('0x1e')](user['getAgents']())['then'](realtime[_0x5ed2('0x1f')]())[_0x5ed2('0x1e')](user[_0x5ed2('0x20')]())[_0x5ed2('0x1e')](realtime[_0x5ed2('0x21')]())[_0x5ed2('0x1e')](trunk[_0x5ed2('0x22')]())[_0x5ed2('0x1e')](realtime[_0x5ed2('0x23')]())[_0x5ed2('0x1e')](voiceQueue[_0x5ed2('0x24')]())[_0x5ed2('0x1e')](realtime['initVoiceQueues']())['then'](trigger['getTriggers']())[_0x5ed2('0x1e')](realtime[_0x5ed2('0x25')]())[_0x5ed2('0x1e')](template[_0x5ed2('0x26')]())[_0x5ed2('0x1e')](realtime[_0x5ed2('0x27')]())[_0x5ed2('0x1e')](zendesk['getZendeskAccounts']())[_0x5ed2('0x1e')](realtime[_0x5ed2('0x28')]())[_0x5ed2('0x1e')](salesforce[_0x5ed2('0x29')]())[_0x5ed2('0x1e')](realtime[_0x5ed2('0x2a')]())['then'](sugarcrm[_0x5ed2('0x2b')]())[_0x5ed2('0x1e')](realtime['initSugarcrmAccounts']())[_0x5ed2('0x1e')](freshdesk[_0x5ed2('0x2c')]())[_0x5ed2('0x1e')](realtime[_0x5ed2('0x2d')]())[_0x5ed2('0x1e')](desk[_0x5ed2('0x2e')]())[_0x5ed2('0x1e')](realtime[_0x5ed2('0x2f')]())['then'](zoho[_0x5ed2('0x30')]())['then'](realtime[_0x5ed2('0x31')]())['then'](vtiger[_0x5ed2('0x32')]())[_0x5ed2('0x1e')](realtime['initVtigerAccounts']())['then'](freshsales[_0x5ed2('0x33')]())['then'](realtime[_0x5ed2('0x34')]())['then'](servicenow[_0x5ed2('0x35')]())['then'](realtime[_0x5ed2('0x36')]())[_0x5ed2('0x1e')](dynamics365['getDynamics365Accounts']())['then'](realtime[_0x5ed2('0x37')]())['then'](campaign[_0x5ed2('0x38')]())[_0x5ed2('0x1e')](realtime['initCampaigns']())[_0x5ed2('0x1e')](voiceExtension[_0x5ed2('0x39')]())[_0x5ed2('0x1e')](realtime[_0x5ed2('0x3a')]())[_0x5ed2('0x1e')](faxAccount[_0x5ed2('0x3b')]())[_0x5ed2('0x1e')](realtime[_0x5ed2('0x3c')]())[_0x5ed2('0x1e')](function(){return realtime;});}function initParams(){return BPromise[_0x5ed2('0x1d')]()['then'](voiceQueueReport['getVoiceQueueReports']())['then'](realtime[_0x5ed2('0x3d')]())[_0x5ed2('0x1e')](cmHopperHistory[_0x5ed2('0x3e')]())['then'](realtime['initVoiceQueueHopperHistory']())[_0x5ed2('0x1e')](cmHopperHistory[_0x5ed2('0x3f')]())[_0x5ed2('0x1e')](realtime[_0x5ed2('0x40')]())[_0x5ed2('0x1e')](voiceCallReport[_0x5ed2('0x41')]())['then'](realtime[_0x5ed2('0x42')]())[_0x5ed2('0x1e')](function(_0x2c4622){})[_0x5ed2('0x43')](function(_0x33c23a){console[_0x5ed2('0x44')](_0x33c23a);});}function main(){return server[_0x5ed2('0x45')](realtime,preview,fax)['then'](function(_0x3896c0){return initRealtime();})[_0x5ed2('0x1e')](function(){return initParams();})[_0x5ed2('0x1e')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x5ed2('0x43')](function(_0x363c15){console[_0x5ed2('0x44')](_0x363c15);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 3d4b970..1d1e196 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(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xedd9,0xfc));var _0x9edd=function(_0x279d3f,_0x55285d){_0x279d3f=_0x279d3f-0x0;var _0xb6b0ed=_0xedd9[_0x279d3f];return _0xb6b0ed;};'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 _0x0713=['idle','inuse','talking','voiceStatusTime','toNumber','format','voiceStatusQueue','stringify','user:%s','emit','user:save','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','onhold','local','prototype','state','toLowerCase','not_inuse'];(function(_0x39dad4,_0x2a5e02){var _0x52862a=function(_0xf1c49f){while(--_0xf1c49f){_0x39dad4['push'](_0x39dad4['shift']());}};_0x52862a(++_0x2a5e02);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var md5=require(_0x3071('0x1'));var Redis=require(_0x3071('0x2'));var config=require(_0x3071('0x3'));config[_0x3071('0x4')]=_['defaults'](config[_0x3071('0x4')],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x4')]));function Agent(_0xabd7b6){this['id']=_0xabd7b6['id']||0x0;this[_0x3071('0x7')]=_0xabd7b6[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0xabd7b6[_0x3071('0x8')]||'';this[_0x3071('0x9')]=_0xabd7b6[_0x3071('0x9')]||'';this[_0x3071('0xa')]=_0xabd7b6[_0x3071('0xa')]||'';this['state']=_0x3071('0xb');this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]=_0x3071('0xb');this[_0x3071('0xe')]='';this['phone']='';this[_0x3071('0xf')]='';this[_0x3071('0x10')]='';this[_0x3071('0x11')]=_0xabd7b6[_0x3071('0x11')]||![];this[_0x3071('0x12')]='unknown';this['voiceStatusTime']=0x0;this[_0x3071('0x13')]='';this['voiceStatusQueue']='';this[_0x3071('0x14')]=![];this[_0x3071('0x15')]=![];this['md5']='';}Agent[_0x3071('0x16')]['updateStatusRealtime']=function(_0x2fc15d){var _0x45c93b;if(_0x2fc15d&&_0x2fc15d[_0x3071('0x17')]){_0x45c93b=_0x2fc15d[_0x3071('0x17')][_0x3071('0x18')]();switch(_0x45c93b){case _0x3071('0x19'):_0x45c93b=_0x3071('0x1a');break;case _0x3071('0x1b'):_0x45c93b=_0x3071('0x1c');break;}}if(_0x45c93b&&this[_0x3071('0x12')]!==_0x45c93b||_0x2fc15d['statePause']){this[_0x3071('0x1d')]=_[_0x3071('0x1e')](moment()[_0x3071('0x1f')]('x'));}if(_0x45c93b){this[_0x3071('0x12')]=_0x45c93b;}var _0x3acf0e={'id':this['id'],'name':this[_0x3071('0x7')],'email':this[_0x3071('0x8')],'accountcode':this[_0x3071('0x9')],'fullname':this['fullname'],'state':this[_0x3071('0x17')],'stateTime':this[_0x3071('0xc')],'status':this[_0x3071('0xd')],'address':this['address'],'online':this[_0x3071('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x3071('0x1d')],'voiceStatusCallerIdNumber':this[_0x3071('0x13')],'voiceStatusQueue':this[_0x3071('0x20')],'interface':this[_0x3071('0x10')],'onhold':this[_0x3071('0x14')]};var _0x34c50e=md5(JSON[_0x3071('0x21')](_0x3acf0e));if(this[_0x3071('0x1')]!==_0x34c50e){this['md5']=_0x34c50e;io['to'](util['format'](_0x3071('0x22'),_0x3acf0e[_0x3071('0x7')]))[_0x3071('0x23')](_0x3071('0x24'),_0x3acf0e);io[_0x3071('0x23')](_0x3071('0x25'),_0x3acf0e);}};module[_0x3071('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 6078111..2d1e34d 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 _0xb37c=['dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry'];(function(_0x34b1fe,_0x1dbd20){var _0x51caa2=function(_0x22f266){while(--_0x22f266){_0x34b1fe['push'](_0x34b1fe['shift']());}};_0x51caa2(++_0x1dbd20);}(_0xb37c,0x175));var _0xcb37=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xb37c[_0x2b4411];return _0x8e41ef;};'use strict';function Campaign(_0x369769){this['id']=_0x369769['id']||0x0;this['name']=_0x369769[_0xcb37('0x0')]||'';this[_0xcb37('0x1')]=_0x369769[_0xcb37('0x1')]||_0xcb37('0x2');this[_0xcb37('0x3')]=0x0;this[_0xcb37('0x4')]=0x0;this[_0xcb37('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0xcb37('0x6')]='';this[_0xcb37('0x7')]=!![];this[_0xcb37('0x8')]=_0x369769[_0xcb37('0x8')];this[_0xcb37('0x9')]=_0x369769[_0xcb37('0x9')];this[_0xcb37('0xa')]=_0x369769[_0xcb37('0xa')]||null;this['dialGlobalInterval']=_0x369769[_0xcb37('0xb')]?_0x369769['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x369769['dialOriginateCallerIdName'];this[_0xcb37('0xc')]=_0x369769[_0xcb37('0xc')];this['dialOriginateTimeout']=_0x369769[_0xcb37('0xd')]||0x1e;this[_0xcb37('0xe')]=_0x369769[_0xcb37('0xe')];this[_0xcb37('0xf')]=_0x369769['dialCongestionRetryFrequency'];this[_0xcb37('0x10')]=_0x369769[_0xcb37('0x10')];this[_0xcb37('0x11')]=_0x369769[_0xcb37('0x11')];this[_0xcb37('0x12')]=_0x369769[_0xcb37('0x12')];this[_0xcb37('0x13')]=_0x369769[_0xcb37('0x13')];this['dialGlobalMaxRetry']=_0x369769[_0xcb37('0x14')];this[_0xcb37('0x15')]=_0x369769['dialNoSuchNumberMaxRetry']||0x3;this[_0xcb37('0x16')]=_0x369769[_0xcb37('0x16')]||0x96;this[_0xcb37('0x17')]=_0x369769[_0xcb37('0x17')]||0x3;this[_0xcb37('0x18')]=_0x369769[_0xcb37('0x18')]||0x96;this[_0xcb37('0x19')]=_0x369769[_0xcb37('0x19')]||0x3;this['dialAbandonedRetryFrequency']=_0x369769[_0xcb37('0x1a')]||0x96;this[_0xcb37('0x1b')]=_0x369769[_0xcb37('0x1b')]||0x3;this[_0xcb37('0x1c')]=_0x369769[_0xcb37('0x1c')]||0x96;this['dialAgentRejectMaxRetry']=_0x369769['dialAgentRejectMaxRetry']||0x3;this[_0xcb37('0x1d')]=_0x369769[_0xcb37('0x1d')]||0x96;this[_0xcb37('0x1e')]=_0x369769['dialOrderByScheduledAt']||_0xcb37('0x1f');this[_0xcb37('0x20')]=_0x369769['dialPrefix']||undefined;this[_0xcb37('0x21')]=_0x369769[_0xcb37('0x21')]||undefined;this[_0xcb37('0x22')]=_0x369769[_0xcb37('0x22')]||undefined;this['TrunkBackup']=_0x369769['TrunkBackup']?_0x369769['TrunkBackup']:undefined;this['Trunk']=_0x369769[_0xcb37('0x23')]?_0x369769['Trunk']:undefined;this[_0xcb37('0x24')]=_0x369769[_0xcb37('0x24')]?_0x369769[_0xcb37('0x24')]:undefined;this[_0xcb37('0x25')]=_0x369769[_0xcb37('0x25')]?_0x369769[_0xcb37('0x25')]:undefined;this[_0xcb37('0x26')]=_0x369769[_0xcb37('0x25')]?_0x369769[_0xcb37('0x25')][_0xcb37('0x0')]:undefined;this[_0xcb37('0x27')]=_0x369769[_0xcb37('0x27')]||![];this['dialAMDInitialSilence']=_0x369769[_0xcb37('0x28')];this['dialAMDGreeting']=_0x369769[_0xcb37('0x29')];this[_0xcb37('0x2a')]=_0x369769[_0xcb37('0x2a')];this[_0xcb37('0x2b')]=_0x369769['dialAMDTotalAnalysisTime'];this[_0xcb37('0x2c')]=_0x369769['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x369769['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x369769[_0xcb37('0x2d')];this[_0xcb37('0x2e')]=_0x369769[_0xcb37('0x2e')];this[_0xcb37('0x2f')]=_0x369769[_0xcb37('0x2f')];}module[_0xcb37('0x30')]=Campaign; \ No newline at end of file +var _0xd7ec=['dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency'];(function(_0x4e3b4d,_0x1cf95b){var _0x451407=function(_0x159d80){while(--_0x159d80){_0x4e3b4d['push'](_0x4e3b4d['shift']());}};_0x451407(++_0x1cf95b);}(_0xd7ec,0xe6));var _0xcd7e=function(_0x51bd70,_0x3aa23a){_0x51bd70=_0x51bd70-0x0;var _0x25b522=_0xd7ec[_0x51bd70];return _0x25b522;};'use strict';function Campaign(_0x2ce8fb){this['id']=_0x2ce8fb['id']||0x0;this[_0xcd7e('0x0')]=_0x2ce8fb[_0xcd7e('0x0')]||'';this[_0xcd7e('0x1')]=_0x2ce8fb[_0xcd7e('0x1')]||_0xcd7e('0x2');this[_0xcd7e('0x3')]=0x0;this[_0xcd7e('0x4')]=0x0;this[_0xcd7e('0x5')]=0x0;this[_0xcd7e('0x6')]=0x0;this[_0xcd7e('0x7')]='';this[_0xcd7e('0x8')]=!![];this['active']=_0x2ce8fb['active'];this[_0xcd7e('0x9')]=_0x2ce8fb[_0xcd7e('0x9')];this[_0xcd7e('0xa')]=_0x2ce8fb[_0xcd7e('0xa')]||null;this['dialGlobalInterval']=_0x2ce8fb[_0xcd7e('0xb')]?_0x2ce8fb[_0xcd7e('0xb')]:null;this['dialOriginateCallerIdName']=_0x2ce8fb[_0xcd7e('0xc')];this[_0xcd7e('0xd')]=_0x2ce8fb[_0xcd7e('0xd')];this['dialOriginateTimeout']=_0x2ce8fb[_0xcd7e('0xe')]||0x1e;this[_0xcd7e('0xf')]=_0x2ce8fb[_0xcd7e('0xf')];this[_0xcd7e('0x10')]=_0x2ce8fb['dialCongestionRetryFrequency'];this[_0xcd7e('0x11')]=_0x2ce8fb[_0xcd7e('0x11')];this[_0xcd7e('0x12')]=_0x2ce8fb[_0xcd7e('0x12')];this[_0xcd7e('0x13')]=_0x2ce8fb[_0xcd7e('0x13')];this[_0xcd7e('0x14')]=_0x2ce8fb[_0xcd7e('0x14')];this[_0xcd7e('0x15')]=_0x2ce8fb[_0xcd7e('0x15')];this[_0xcd7e('0x16')]=_0x2ce8fb['dialNoSuchNumberMaxRetry']||0x3;this[_0xcd7e('0x17')]=_0x2ce8fb['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x2ce8fb[_0xcd7e('0x18')]||0x3;this[_0xcd7e('0x19')]=_0x2ce8fb['dialDropRetryFrequency']||0x96;this[_0xcd7e('0x1a')]=_0x2ce8fb['dialAbandonedMaxRetry']||0x3;this[_0xcd7e('0x1b')]=_0x2ce8fb[_0xcd7e('0x1b')]||0x96;this[_0xcd7e('0x1c')]=_0x2ce8fb[_0xcd7e('0x1c')]||0x3;this[_0xcd7e('0x1d')]=_0x2ce8fb[_0xcd7e('0x1d')]||0x96;this[_0xcd7e('0x1e')]=_0x2ce8fb['dialAgentRejectMaxRetry']||0x3;this[_0xcd7e('0x1f')]=_0x2ce8fb[_0xcd7e('0x1f')]||0x96;this[_0xcd7e('0x20')]=_0x2ce8fb[_0xcd7e('0x20')]||_0xcd7e('0x21');this[_0xcd7e('0x22')]=_0x2ce8fb[_0xcd7e('0x22')]||undefined;this[_0xcd7e('0x23')]=_0x2ce8fb[_0xcd7e('0x23')]||undefined;this[_0xcd7e('0x24')]=_0x2ce8fb[_0xcd7e('0x24')]||undefined;this['TrunkBackup']=_0x2ce8fb['TrunkBackup']?_0x2ce8fb[_0xcd7e('0x25')]:undefined;this['Trunk']=_0x2ce8fb[_0xcd7e('0x26')]?_0x2ce8fb['Trunk']:undefined;this[_0xcd7e('0x27')]=_0x2ce8fb[_0xcd7e('0x27')]?_0x2ce8fb[_0xcd7e('0x27')]:undefined;this['SquareProject']=_0x2ce8fb[_0xcd7e('0x28')]?_0x2ce8fb[_0xcd7e('0x28')]:undefined;this[_0xcd7e('0x29')]=_0x2ce8fb[_0xcd7e('0x28')]?_0x2ce8fb[_0xcd7e('0x28')]['name']:undefined;this[_0xcd7e('0x2a')]=_0x2ce8fb[_0xcd7e('0x2a')]||![];this[_0xcd7e('0x2b')]=_0x2ce8fb['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x2ce8fb[_0xcd7e('0x2c')];this[_0xcd7e('0x2d')]=_0x2ce8fb[_0xcd7e('0x2d')];this['dialAMDTotalAnalysisTime']=_0x2ce8fb[_0xcd7e('0x2e')];this[_0xcd7e('0x2f')]=_0x2ce8fb[_0xcd7e('0x2f')];this[_0xcd7e('0x30')]=_0x2ce8fb[_0xcd7e('0x30')];this[_0xcd7e('0x31')]=_0x2ce8fb[_0xcd7e('0x31')];this[_0xcd7e('0x32')]=_0x2ce8fb[_0xcd7e('0x32')];this[_0xcd7e('0x33')]=_0x2ce8fb['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 3f0bda1..bcf5a00 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 _0x8c7d=['accountcode','context','uniqueid','linkedid','exten','answered','unmanaged','abandoned','lastdata','holdtime','type','tag','disposition','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','exports','starttime','destinationchannel','calleridname','connectedlinenum','connectedlinename'];(function(_0xe4c0d8,_0x37d245){var _0xe26e24=function(_0x1be860){while(--_0x1be860){_0xe4c0d8['push'](_0xe4c0d8['shift']());}};_0xe26e24(++_0x37d245);}(_0x8c7d,0xe1));var _0xd8c7=function(_0x16f524,_0x92e2df){_0x16f524=_0x16f524-0x0;var _0x33b24f=_0x8c7d[_0x16f524];return _0x33b24f;};'use strict';function Channel(){this[_0xd8c7('0x0')]=null;this['channel']='';this[_0xd8c7('0x1')]='';this['calleridnum']=0x0;this[_0xd8c7('0x2')]='';this[_0xd8c7('0x3')]=undefined;this[_0xd8c7('0x4')]=undefined;this[_0xd8c7('0x5')]=0x0;this[_0xd8c7('0x6')]='';this[_0xd8c7('0x7')]=0x0;this[_0xd8c7('0x8')]=0x0;this[_0xd8c7('0x9')]=0x0;this[_0xd8c7('0xa')]=![];this['answertime']=null;this['endtime']=null;this[_0xd8c7('0xb')]=![];this[_0xd8c7('0xc')]=![];this['lastapplication']='';this[_0xd8c7('0xd')]='';this['duration']=0x0;this['billableseconds']=0x0;this[_0xd8c7('0xe')]=0x0;this[_0xd8c7('0xf')]=null;this[_0xd8c7('0x10')]=null;this[_0xd8c7('0x11')]=null;this['monitor']=![];this[_0xd8c7('0x12')]=null;this['queue']=null;this[_0xd8c7('0x13')]=[];this[_0xd8c7('0x14')]=undefined;this[_0xd8c7('0x15')]=undefined;this['transferType']=undefined;this['mohtime']=0x0;}module[_0xd8c7('0x16')]=Channel; \ No newline at end of file +var _0x4991=['connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','type','tag','monitor','monitorFilename','monitors','transfercalleridnum','exports','starttime','destinationchannel','calleridname'];(function(_0x1e9369,_0x3691c3){var _0x4f9a06=function(_0x171066){while(--_0x171066){_0x1e9369['push'](_0x1e9369['shift']());}};_0x4f9a06(++_0x3691c3);}(_0x4991,0xf7));var _0x1499=function(_0x57a1e3,_0x1d748c){_0x57a1e3=_0x57a1e3-0x0;var _0x3ba9b4=_0x4991[_0x57a1e3];return _0x3ba9b4;};'use strict';function Channel(){this[_0x1499('0x0')]=null;this['channel']='';this[_0x1499('0x1')]='';this['calleridnum']=0x0;this[_0x1499('0x2')]='';this[_0x1499('0x3')]=undefined;this[_0x1499('0x4')]=undefined;this[_0x1499('0x5')]=0x0;this[_0x1499('0x6')]='';this[_0x1499('0x7')]=0x0;this[_0x1499('0x8')]=0x0;this[_0x1499('0x9')]=0x0;this['answered']=![];this[_0x1499('0xa')]=null;this[_0x1499('0xb')]=null;this[_0x1499('0xc')]=![];this[_0x1499('0xd')]=![];this[_0x1499('0xe')]='';this[_0x1499('0xf')]='';this[_0x1499('0x10')]=0x0;this[_0x1499('0x11')]=0x0;this['holdtime']=0x0;this[_0x1499('0x12')]=null;this[_0x1499('0x13')]=null;this['disposition']=null;this[_0x1499('0x14')]=![];this[_0x1499('0x15')]=null;this['queue']=null;this[_0x1499('0x16')]=[];this[_0x1499('0x17')]=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this['mohtime']=0x0;}module[_0x1499('0x18')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index b86d35c..946c784 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 _0xae04=['name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xae04,0x1e1));var _0x4ae0=function(_0x56ef0e,_0x5c1b73){_0x56ef0e=_0x56ef0e-0x0;var _0x22e164=_0xae04[_0x56ef0e];return _0x22e164;};'use strict';function DeskAccount(_0x94c1de){this['id']=_0x94c1de['id']||0x0;this[_0x4ae0('0x0')]=_0x94c1de[_0x4ae0('0x0')]||'';this[_0x4ae0('0x1')]=_0x94c1de['username']||'';this[_0x4ae0('0x2')]=_0x94c1de[_0x4ae0('0x2')]||'';this['authType']=_0x94c1de[_0x4ae0('0x3')]||'';this[_0x4ae0('0x4')]=_0x94c1de[_0x4ae0('0x4')]||'';this[_0x4ae0('0x5')]=_0x94c1de[_0x4ae0('0x5')]||'';this[_0x4ae0('0x6')]=_0x94c1de[_0x4ae0('0x6')]||'';this[_0x4ae0('0x7')]=_0x94c1de['token']||'';this[_0x4ae0('0x8')]=_0x94c1de[_0x4ae0('0x8')]||'';this[_0x4ae0('0x9')]=_0x94c1de[_0x4ae0('0x9')]||'';this[_0x4ae0('0xa')]=_0x94c1de[_0x4ae0('0xa')]||'';this[_0x4ae0('0xb')]=_0x94c1de[_0x4ae0('0xb')]||{};}module[_0x4ae0('0xc')]=DeskAccount; \ No newline at end of file +var _0xb1f3=['authType','password','consumerSecret','token','tokenSecret','type','Configurations','exports','name','username','remoteUri'];(function(_0x4d47fd,_0x3e2e94){var _0x1ed5d2=function(_0x33ac6f){while(--_0x33ac6f){_0x4d47fd['push'](_0x4d47fd['shift']());}};_0x1ed5d2(++_0x3e2e94);}(_0xb1f3,0x11b));var _0x3b1f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb1f3[_0x20a584];return _0x4b41a8;};'use strict';function DeskAccount(_0xa32fb){this['id']=_0xa32fb['id']||0x0;this[_0x3b1f('0x0')]=_0xa32fb[_0x3b1f('0x0')]||'';this[_0x3b1f('0x1')]=_0xa32fb[_0x3b1f('0x1')]||'';this[_0x3b1f('0x2')]=_0xa32fb[_0x3b1f('0x2')]||'';this[_0x3b1f('0x3')]=_0xa32fb[_0x3b1f('0x3')]||'';this['password']=_0xa32fb[_0x3b1f('0x4')]||'';this['consumerKey']=_0xa32fb['consumerKey']||'';this[_0x3b1f('0x5')]=_0xa32fb[_0x3b1f('0x5')]||'';this[_0x3b1f('0x6')]=_0xa32fb[_0x3b1f('0x6')]||'';this[_0x3b1f('0x7')]=_0xa32fb[_0x3b1f('0x7')]||'';this[_0x3b1f('0x8')]=_0xa32fb['type']||'';this['serverUrl']=_0xa32fb['serverUrl']||'';this[_0x3b1f('0x9')]=_0xa32fb[_0x3b1f('0x9')]||{};}module[_0x3b1f('0xa')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index ea363cc..9570ec0 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 _0x1339=['serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x1566fa,_0x3c7010){var _0x567569=function(_0x320410){while(--_0x320410){_0x1566fa['push'](_0x1566fa['shift']());}};_0x567569(++_0x3c7010);}(_0x1339,0x1ed));var _0x9133=function(_0x111269,_0x2871be){_0x111269=_0x111269-0x0;var _0x183196=_0x1339[_0x111269];return _0x183196;};'use strict';function Dynamics365Account(_0x421620){this['id']=_0x421620['id']||0x0;this['name']=_0x421620[_0x9133('0x0')]||'';this[_0x9133('0x1')]=_0x421620[_0x9133('0x1')]||'';this[_0x9133('0x2')]=_0x421620[_0x9133('0x2')]||'';this[_0x9133('0x3')]=_0x421620[_0x9133('0x3')]||'';this[_0x9133('0x4')]=_0x421620['tenantId']||'';this[_0x9133('0x5')]=_0x421620[_0x9133('0x5')]||'';this[_0x9133('0x6')]=_0x421620['clientSecret']||{};this[_0x9133('0x7')]=_0x421620[_0x9133('0x7')]||'';this[_0x9133('0x8')]=_0x421620[_0x9133('0x8')]||{};}module[_0x9133('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x3c81=['Configurations','exports','name','username','tenantId','clientId','clientSecret','serverUrl'];(function(_0x40db45,_0x4df6db){var _0x1079d9=function(_0x569270){while(--_0x569270){_0x40db45['push'](_0x40db45['shift']());}};_0x1079d9(++_0x4df6db);}(_0x3c81,0x102));var _0x13c8=function(_0x3bedfd,_0x50a56a){_0x3bedfd=_0x3bedfd-0x0;var _0x45f74f=_0x3c81[_0x3bedfd];return _0x45f74f;};'use strict';function Dynamics365Account(_0x55010d){this['id']=_0x55010d['id']||0x0;this[_0x13c8('0x0')]=_0x55010d['name']||'';this[_0x13c8('0x1')]=_0x55010d[_0x13c8('0x1')]||'';this['password']=_0x55010d['password']||'';this['remoteUri']=_0x55010d['remoteUri']||'';this[_0x13c8('0x2')]=_0x55010d[_0x13c8('0x2')]||'';this[_0x13c8('0x3')]=_0x55010d[_0x13c8('0x3')]||'';this[_0x13c8('0x4')]=_0x55010d[_0x13c8('0x4')]||{};this[_0x13c8('0x5')]=_0x55010d['serverUrl']||'';this[_0x13c8('0x6')]=_0x55010d['Configurations']||{};}module[_0x13c8('0x7')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 4b9b274..c75c9a9 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 _0xa962=['maxrate','modem','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0xa962,0xea));var _0x2a96=function(_0xed6261,_0x1f0ee2){_0xed6261=_0xed6261-0x0;var _0x4de7a5=_0xa962[_0xed6261];return _0x4de7a5;};'use strict';function FaxAccount(_0x49d30b){this['id']=_0x49d30b['id']||0x0;this[_0x2a96('0x0')]=_0x49d30b['name']||'';this[_0x2a96('0x1')]=_0x49d30b[_0x2a96('0x1')];this[_0x2a96('0x2')]=_0x49d30b[_0x2a96('0x2')];this['headerinfo']=_0x49d30b[_0x2a96('0x3')];this[_0x2a96('0x4')]=_0x49d30b[_0x2a96('0x4')];this['minrate']=_0x49d30b[_0x2a96('0x5')]||0x960;this[_0x2a96('0x6')]=_0x49d30b[_0x2a96('0x6')]||0x3840;this[_0x2a96('0x7')]=_0x49d30b[_0x2a96('0x7')]||'v17,v27,v29';this[_0x2a96('0x8')]=_0x49d30b[_0x2a96('0x8')]||'no';this[_0x2a96('0x9')]=_0x49d30b['faxdetect']||'no';this[_0x2a96('0xa')]=_0x49d30b['t38timeout']||0x1388;this[_0x2a96('0xb')]=_0x49d30b['tech']||'SIP';this[_0x2a96('0xc')]=_0x49d30b[_0x2a96('0xc')]?_0x49d30b['Trunk']:undefined;this[_0x2a96('0xd')]=_0x49d30b['ListId'];this[_0x2a96('0xe')]=_0x49d30b['key'];}module[_0x2a96('0xf')]=FaxAccount; \ No newline at end of file +var _0x404c=['gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29'];(function(_0x1aaaee,_0x94a706){var _0x1ee877=function(_0x4e4e89){while(--_0x4e4e89){_0x1aaaee['push'](_0x1aaaee['shift']());}};_0x1ee877(++_0x94a706);}(_0x404c,0x13a));var _0xc404=function(_0x22a952,_0x471749){_0x22a952=_0x22a952-0x0;var _0x1d5bf8=_0x404c[_0x22a952];return _0x1d5bf8;};'use strict';function FaxAccount(_0x5599b0){this['id']=_0x5599b0['id']||0x0;this['name']=_0x5599b0[_0xc404('0x0')]||'';this[_0xc404('0x1')]=_0x5599b0['description'];this[_0xc404('0x2')]=_0x5599b0[_0xc404('0x2')];this[_0xc404('0x3')]=_0x5599b0[_0xc404('0x3')];this['localstationid']=_0x5599b0[_0xc404('0x4')];this['minrate']=_0x5599b0[_0xc404('0x5')]||0x960;this[_0xc404('0x6')]=_0x5599b0[_0xc404('0x6')]||0x3840;this[_0xc404('0x7')]=_0x5599b0['modem']||_0xc404('0x8');this[_0xc404('0x9')]=_0x5599b0[_0xc404('0x9')]||'no';this[_0xc404('0xa')]=_0x5599b0[_0xc404('0xa')]||'no';this[_0xc404('0xb')]=_0x5599b0[_0xc404('0xb')]||0x1388;this[_0xc404('0xc')]=_0x5599b0[_0xc404('0xc')]||_0xc404('0xd');this['Trunk']=_0x5599b0[_0xc404('0xe')]?_0x5599b0['Trunk']:undefined;this[_0xc404('0xf')]=_0x5599b0[_0xc404('0xf')];this[_0xc404('0x10')]=_0x5599b0[_0xc404('0x10')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 9b6c76c..7e6e63c 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 _0xf4ce=['name','username','token','remoteUri','Configurations','exports'];(function(_0xed0ca7,_0x300f49){var _0x32dfd2=function(_0x17df0a){while(--_0x17df0a){_0xed0ca7['push'](_0xed0ca7['shift']());}};_0x32dfd2(++_0x300f49);}(_0xf4ce,0x66));var _0xef4c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf4ce[_0x2dafbe];return _0x58a45a;};'use strict';function FreshdeskAccount(_0x5597e7){this['id']=_0x5597e7['id']||0x0;this['name']=_0x5597e7[_0xef4c('0x0')]||'';this[_0xef4c('0x1')]=_0x5597e7['username']||'';this['apiKey']=_0x5597e7[_0xef4c('0x2')]||'';this[_0xef4c('0x3')]=_0x5597e7[_0xef4c('0x3')]||'';this['serverUrl']=_0x5597e7['serverUrl']||'';this[_0xef4c('0x4')]=_0x5597e7[_0xef4c('0x4')]||{};}module[_0xef4c('0x5')]=FreshdeskAccount; \ No newline at end of file +var _0x56c5=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x56c5,0x118));var _0x556c=function(_0x192ca4,_0x1dc98d){_0x192ca4=_0x192ca4-0x0;var _0x1fa202=_0x56c5[_0x192ca4];return _0x1fa202;};'use strict';function FreshdeskAccount(_0x199803){this['id']=_0x199803['id']||0x0;this[_0x556c('0x0')]=_0x199803['name']||'';this[_0x556c('0x1')]=_0x199803['username']||'';this[_0x556c('0x2')]=_0x199803[_0x556c('0x3')]||'';this[_0x556c('0x4')]=_0x199803[_0x556c('0x4')]||'';this[_0x556c('0x5')]=_0x199803[_0x556c('0x5')]||'';this[_0x556c('0x6')]=_0x199803[_0x556c('0x6')]||{};}module[_0x556c('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 163bb59..d3536ad 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 _0x2975=['apiKey','token','serverUrl','Configurations','exports','name','username'];(function(_0x2326d8,_0x75fba0){var _0x2cd15d=function(_0x26b2c1){while(--_0x26b2c1){_0x2326d8['push'](_0x2326d8['shift']());}};_0x2cd15d(++_0x75fba0);}(_0x2975,0x1c5));var _0x5297=function(_0x28d3fc,_0x88901f){_0x28d3fc=_0x28d3fc-0x0;var _0x1ca6b0=_0x2975[_0x28d3fc];return _0x1ca6b0;};'use strict';function FreshsalesAccount(_0xda2e11){this['id']=_0xda2e11['id']||0x0;this[_0x5297('0x0')]=_0xda2e11[_0x5297('0x0')]||'';this[_0x5297('0x1')]=_0xda2e11[_0x5297('0x1')]||'';this[_0x5297('0x2')]=_0xda2e11[_0x5297('0x3')]||'';this['remoteUri']=_0xda2e11['remoteUri']||'';this['serverUrl']=_0xda2e11[_0x5297('0x4')]||'';this[_0x5297('0x5')]=_0xda2e11[_0x5297('0x5')]||{};}module[_0x5297('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0xb7a8=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0xd0baae,_0x3020f4){var _0x538549=function(_0x57a0e3){while(--_0x57a0e3){_0xd0baae['push'](_0xd0baae['shift']());}};_0x538549(++_0x3020f4);}(_0xb7a8,0xec));var _0x8b7a=function(_0x1e9115,_0x4ff21c){_0x1e9115=_0x1e9115-0x0;var _0x37098c=_0xb7a8[_0x1e9115];return _0x37098c;};'use strict';function FreshsalesAccount(_0x17ec1f){this['id']=_0x17ec1f['id']||0x0;this[_0x8b7a('0x0')]=_0x17ec1f[_0x8b7a('0x0')]||'';this['username']=_0x17ec1f[_0x8b7a('0x1')]||'';this[_0x8b7a('0x2')]=_0x17ec1f[_0x8b7a('0x3')]||'';this['remoteUri']=_0x17ec1f[_0x8b7a('0x4')]||'';this[_0x8b7a('0x5')]=_0x17ec1f[_0x8b7a('0x5')]||'';this[_0x8b7a('0x6')]=_0x17ec1f[_0x8b7a('0x6')]||{};}module[_0x8b7a('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 8dff7ef..eebb095 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 _0x7802=['originalposition','connectedlinename','accountcode','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','type','inbound','uniqueid','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexitAt'];(function(_0xf0de92,_0x239c6d){var _0x5ba079=function(_0x19aa4c){while(--_0x19aa4c){_0xf0de92['push'](_0xf0de92['shift']());}};_0x5ba079(++_0x239c6d);}(_0x7802,0x164));var _0x2780=function(_0x4f51f2,_0x277484){_0x4f51f2=_0x4f51f2-0x0;var _0x1cfdf3=_0x7802[_0x4f51f2];return _0x1cfdf3;};'use strict';function QueueReport(){this[_0x2780('0x0')]=_0x2780('0x1');this[_0x2780('0x2')]='';this[_0x2780('0x3')]='';this['calleridname']='';this[_0x2780('0x4')]='';this[_0x2780('0x5')]=null;this[_0x2780('0x6')]=null;this['position']=0x1;this[_0x2780('0x7')]=0x1;this[_0x2780('0x8')]=![];this[_0x2780('0x9')]=null;this[_0x2780('0xa')]=![];this['queuecallercompleteAt']=null;this['queuecallerexit']=![];this[_0x2780('0xb')]=null;this[_0x2780('0xc')]=0x1;this['channel']='';this['connectedlinenum']='';this[_0x2780('0xd')]='';this[_0x2780('0xe')]='';this['context']='';this['exten']='';this[_0x2780('0xf')]='';this[_0x2780('0x10')]=0x0;this[_0x2780('0x11')]=![];this[_0x2780('0x12')]='';this[_0x2780('0x13')]=_0x2780('0x14');this[_0x2780('0x15')]=0x0;this[_0x2780('0x16')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0xa70c=['queuecallercomplete','queuecallercompleteAt','queuecallerexit','originalposition','channel','accountcode','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','type','inbound','uniqueid','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt'];(function(_0x44e7b6,_0x227953){var _0x325047=function(_0x5ccc8a){while(--_0x5ccc8a){_0x44e7b6['push'](_0x44e7b6['shift']());}};_0x325047(++_0x227953);}(_0xa70c,0xb5));var _0xca70=function(_0x5df943,_0x4f63b9){_0x5df943=_0x5df943-0x0;var _0x4ba651=_0xa70c[_0x5df943];return _0x4ba651;};'use strict';function QueueReport(){this[_0xca70('0x0')]=_0xca70('0x1');this[_0xca70('0x2')]='';this[_0xca70('0x3')]='';this['calleridname']='';this[_0xca70('0x4')]='';this[_0xca70('0x5')]=null;this[_0xca70('0x6')]=null;this[_0xca70('0x7')]=0x1;this[_0xca70('0x8')]=0x1;this[_0xca70('0x9')]=![];this[_0xca70('0xa')]=null;this[_0xca70('0xb')]=![];this[_0xca70('0xc')]=null;this[_0xca70('0xd')]=![];this['queuecallerexitAt']=null;this[_0xca70('0xe')]=0x1;this[_0xca70('0xf')]='';this['connectedlinenum']='';this['connectedlinename']='';this[_0xca70('0x10')]='';this['context']='';this['exten']='';this[_0xca70('0x11')]='';this[_0xca70('0x12')]=0x0;this[_0xca70('0x13')]=![];this[_0xca70('0x14')]='';this[_0xca70('0x15')]=_0xca70('0x16');this[_0xca70('0x17')]=0x0;this['variables']={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index af3e44e..e7ab61e 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 _0x19b6=['securityToken','type','serverUrl','exports','name','username','remoteUri','password','clientId'];(function(_0x35a4a3,_0x282840){var _0x56c301=function(_0x64677c){while(--_0x64677c){_0x35a4a3['push'](_0x35a4a3['shift']());}};_0x56c301(++_0x282840);}(_0x19b6,0xa6));var _0x619b=function(_0x1b76e6,_0x598520){_0x1b76e6=_0x1b76e6-0x0;var _0x333b53=_0x19b6[_0x1b76e6];return _0x333b53;};'use strict';function SalesforceAccount(_0x16e982){this['id']=_0x16e982['id']||0x0;this[_0x619b('0x0')]=_0x16e982[_0x619b('0x0')]||'';this[_0x619b('0x1')]=_0x16e982[_0x619b('0x1')]||'';this[_0x619b('0x2')]=_0x16e982[_0x619b('0x2')]||'';this[_0x619b('0x3')]=_0x16e982[_0x619b('0x3')]||'';this[_0x619b('0x4')]=_0x16e982[_0x619b('0x4')]||'';this['clientSecret']=_0x16e982['clientSecret']||'';this['securityToken']=_0x16e982[_0x619b('0x5')]||'';this[_0x619b('0x6')]=_0x16e982[_0x619b('0x6')]||'integrationTab';this[_0x619b('0x7')]=_0x16e982[_0x619b('0x7')]||'';this['Configurations']=_0x16e982['Configurations']||{};}module[_0x619b('0x8')]=SalesforceAccount; \ No newline at end of file +var _0x48f9=['type','serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x2a716f,_0x1f5cc9){var _0x1e129e=function(_0x2a9e33){while(--_0x2a9e33){_0x2a716f['push'](_0x2a716f['shift']());}};_0x1e129e(++_0x1f5cc9);}(_0x48f9,0x1d9));var _0x948f=function(_0xe8b0ea,_0x2dac2f){_0xe8b0ea=_0xe8b0ea-0x0;var _0x5b2dbf=_0x48f9[_0xe8b0ea];return _0x5b2dbf;};'use strict';function SalesforceAccount(_0x157ee4){this['id']=_0x157ee4['id']||0x0;this[_0x948f('0x0')]=_0x157ee4['name']||'';this[_0x948f('0x1')]=_0x157ee4[_0x948f('0x1')]||'';this[_0x948f('0x2')]=_0x157ee4[_0x948f('0x2')]||'';this[_0x948f('0x3')]=_0x157ee4['password']||'';this[_0x948f('0x4')]=_0x157ee4[_0x948f('0x4')]||'';this[_0x948f('0x5')]=_0x157ee4[_0x948f('0x5')]||'';this[_0x948f('0x6')]=_0x157ee4[_0x948f('0x6')]||'';this[_0x948f('0x7')]=_0x157ee4[_0x948f('0x7')]||'integrationTab';this[_0x948f('0x8')]=_0x157ee4['serverUrl']||'';this[_0x948f('0x9')]=_0x157ee4[_0x948f('0x9')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 2d1e242..95ae6e4 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 _0x25ab=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x2f3226,_0x4ffd12){var _0x4b1f29=function(_0x36cb0d){while(--_0x36cb0d){_0x2f3226['push'](_0x2f3226['shift']());}};_0x4b1f29(++_0x4ffd12);}(_0x25ab,0xe9));var _0xb25a=function(_0x512d07,_0x11dfa0){_0x512d07=_0x512d07-0x0;var _0x12a190=_0x25ab[_0x512d07];return _0x12a190;};'use strict';function ServicenowAccount(_0x30b8ee){this['id']=_0x30b8ee['id']||0x0;this[_0xb25a('0x0')]=_0x30b8ee[_0xb25a('0x0')]||'';this[_0xb25a('0x1')]=_0x30b8ee[_0xb25a('0x1')]||'';this[_0xb25a('0x2')]=_0x30b8ee['password']||'';this[_0xb25a('0x3')]=_0x30b8ee[_0xb25a('0x3')]||'';this[_0xb25a('0x4')]=_0x30b8ee['serverUrl']||'';this[_0xb25a('0x5')]=_0x30b8ee['Configurations']||{};}module[_0xb25a('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xaa19=['username','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xaa19,0x125));var _0x9aa1=function(_0x2bf6f4,_0x4b8743){_0x2bf6f4=_0x2bf6f4-0x0;var _0x351819=_0xaa19[_0x2bf6f4];return _0x351819;};'use strict';function ServicenowAccount(_0x367740){this['id']=_0x367740['id']||0x0;this[_0x9aa1('0x0')]=_0x367740['name']||'';this[_0x9aa1('0x1')]=_0x367740[_0x9aa1('0x1')]||'';this['password']=_0x367740['password']||'';this[_0x9aa1('0x2')]=_0x367740[_0x9aa1('0x2')]||'';this[_0x9aa1('0x3')]=_0x367740[_0x9aa1('0x3')]||'';this[_0x9aa1('0x4')]=_0x367740[_0x9aa1('0x4')]||{};}module[_0x9aa1('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 8563b40..845b245 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 _0xa8a9=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x503306,_0x356f2f){var _0x44a99d=function(_0x1a6ec4){while(--_0x1a6ec4){_0x503306['push'](_0x503306['shift']());}};_0x44a99d(++_0x356f2f);}(_0xa8a9,0x185));var _0x9a8a=function(_0x1abb91,_0x567600){_0x1abb91=_0x1abb91-0x0;var _0x50e563=_0xa8a9[_0x1abb91];return _0x50e563;};'use strict';function SugarcrmAccount(_0x115b57){this['id']=_0x115b57['id']||0x0;this['name']=_0x115b57[_0x9a8a('0x0')]||'';this[_0x9a8a('0x1')]=_0x115b57['username']||'';this[_0x9a8a('0x2')]=_0x115b57[_0x9a8a('0x2')]||'';this['remoteUri']=_0x115b57[_0x9a8a('0x3')]||'';this[_0x9a8a('0x4')]=_0x115b57[_0x9a8a('0x4')]||'';this['Configurations']=_0x115b57[_0x9a8a('0x5')]||{};}module[_0x9a8a('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x0759=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x48f34b,_0x34ef8c){var _0x4201e8=function(_0x50164c){while(--_0x50164c){_0x48f34b['push'](_0x48f34b['shift']());}};_0x4201e8(++_0x34ef8c);}(_0x0759,0x7d));var _0x9075=function(_0x41fac6,_0x1e3ced){_0x41fac6=_0x41fac6-0x0;var _0x3a0318=_0x0759[_0x41fac6];return _0x3a0318;};'use strict';function SugarcrmAccount(_0x2df038){this['id']=_0x2df038['id']||0x0;this[_0x9075('0x0')]=_0x2df038[_0x9075('0x0')]||'';this[_0x9075('0x1')]=_0x2df038[_0x9075('0x1')]||'';this[_0x9075('0x2')]=_0x2df038[_0x9075('0x2')]||'';this['remoteUri']=_0x2df038[_0x9075('0x3')]||'';this['serverUrl']=_0x2df038[_0x9075('0x4')]||'';this[_0x9075('0x5')]=_0x2df038[_0x9075('0x5')]||{};}module[_0x9075('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 0cdcde5..52597a7 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 _0x00d0=['exports','name','accountcode','stateTime','status','address'];(function(_0x430727,_0x362183){var _0x361f1b=function(_0xa3a979){while(--_0xa3a979){_0x430727['push'](_0x430727['shift']());}};_0x361f1b(++_0x362183);}(_0x00d0,0x163));var _0x000d=function(_0x3d5e9e,_0x384c41){_0x3d5e9e=_0x3d5e9e-0x0;var _0x57b336=_0x00d0[_0x3d5e9e];return _0x57b336;};'use strict';function Telephone(_0x44ab67){this['id']=_0x44ab67['id']||0x0;this[_0x000d('0x0')]=_0x44ab67['name']||'';this[_0x000d('0x1')]=_0x44ab67[_0x000d('0x1')]||'';this['state']='unknown';this[_0x000d('0x2')]=0x0;this[_0x000d('0x3')]='unknown';this[_0x000d('0x4')]='';}module[_0x000d('0x5')]=Telephone; \ No newline at end of file +var _0x03f8=['name','accountcode','state','unknown','stateTime','status','address','exports'];(function(_0x58db4e,_0x439d8d){var _0x40139a=function(_0x34cae4){while(--_0x34cae4){_0x58db4e['push'](_0x58db4e['shift']());}};_0x40139a(++_0x439d8d);}(_0x03f8,0x1d0));var _0x803f=function(_0xf9f239,_0x30c0df){_0xf9f239=_0xf9f239-0x0;var _0x536d3d=_0x03f8[_0xf9f239];return _0x536d3d;};'use strict';function Telephone(_0x3e1157){this['id']=_0x3e1157['id']||0x0;this[_0x803f('0x0')]=_0x3e1157['name']||'';this[_0x803f('0x1')]=_0x3e1157['accountcode']||'';this[_0x803f('0x2')]=_0x803f('0x3');this[_0x803f('0x4')]=0x0;this[_0x803f('0x5')]=_0x803f('0x3');this[_0x803f('0x6')]='';}module[_0x803f('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index e5d2b9a..ad4169a 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(_0x4b5172,_0x50e130){var _0x2256dd=function(_0x259467){while(--_0x259467){_0x4b5172['push'](_0x4b5172['shift']());}};_0x2256dd(++_0x50e130);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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(_0xeb4686,_0x4f3c60){var _0x34c69d=function(_0xe18f17){while(--_0xe18f17){_0xeb4686['push'](_0xeb4686['shift']());}};_0x34c69d(++_0x4f3c60);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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 557cc78..c08dc8e 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['exports','name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x446841,_0x13bbc1){var _0x227a52=function(_0x467200){while(--_0x467200){_0x446841['push'](_0x446841['shift']());}};_0x227a52(++_0x13bbc1);}(_0x2032,0xd9));var _0x2203=function(_0x36e866,_0x438f9e){_0x36e866=_0x36e866-0x0;var _0x3c7d21=_0x2032[_0x36e866];return _0x3c7d21;};'use strict';function Trigger(_0x4d6c97){this['id']=_0x4d6c97['id']||0x0;this[_0x2203('0x0')]=_0x4d6c97[_0x2203('0x0')]||'';this[_0x2203('0x1')]=_0x4d6c97['channel']||_0x2203('0x2');this[_0x2203('0x3')]=_0x4d6c97['status']||![];this[_0x2203('0x4')]=_0x4d6c97[_0x2203('0x4')]||[];this[_0x2203('0x5')]=_0x4d6c97[_0x2203('0x5')]||[];this[_0x2203('0x6')]=_0x4d6c97[_0x2203('0x6')]||[];}module[_0x2203('0x7')]=Trigger; \ No newline at end of file +var _0xb10b=['AllConditions','AnyConditions','Actions','exports','name','channel','status'];(function(_0x643c07,_0x5be882){var _0x5ac00f=function(_0x2e52f3){while(--_0x2e52f3){_0x643c07['push'](_0x643c07['shift']());}};_0x5ac00f(++_0x5be882);}(_0xb10b,0x12a));var _0xbb10=function(_0x4c7d8b,_0x572388){_0x4c7d8b=_0x4c7d8b-0x0;var _0x187158=_0xb10b[_0x4c7d8b];return _0x187158;};'use strict';function Trigger(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'voice';this[_0xbb10('0x2')]=_0x13ce8d[_0xbb10('0x2')]||![];this[_0xbb10('0x3')]=_0x13ce8d[_0xbb10('0x3')]||[];this[_0xbb10('0x4')]=_0x13ce8d[_0xbb10('0x4')]||[];this['Actions']=_0x13ce8d[_0xbb10('0x5')]||[];}module[_0xbb10('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 9bbbb89..bd2b5fb 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 _0xb29e=['port','domain','domainport','refresh','address','defaultuser','exports','active','name','state','unknown','registry','split','host'];(function(_0x2135fc,_0xd0f39e){var _0x5affe4=function(_0x322d8c){while(--_0x322d8c){_0x2135fc['push'](_0x2135fc['shift']());}};_0x5affe4(++_0xd0f39e);}(_0xb29e,0x173));var _0xeb29=function(_0x3a887d,_0x439f75){_0x3a887d=_0x3a887d-0x0;var _0x280152=_0xb29e[_0x3a887d];return _0x280152;};'use strict';function Trunk(_0x13ed66){this['id']=_0x13ed66['id']||0x0;this[_0xeb29('0x0')]=_0x13ed66[_0xeb29('0x0')]||![];this[_0xeb29('0x1')]=_0x13ed66[_0xeb29('0x1')]||'';this[_0xeb29('0x2')]=_0xeb29('0x3');this['stateTime']=0x0;this['status']=_0xeb29('0x3');this[_0xeb29('0x4')]=_0x13ed66[_0xeb29('0x4')]&&_0x13ed66[_0xeb29('0x4')]['indexOf'](':')?_0x13ed66[_0xeb29('0x4')][_0xeb29('0x5')](':')[0x0]:'';this[_0xeb29('0x6')]='';this[_0xeb29('0x7')]='';this[_0xeb29('0x8')]='';this[_0xeb29('0x9')]='';this[_0xeb29('0xa')]='';this['stateRegistry']='unknown';this['registrationtime']='';this[_0xeb29('0xb')]='';this[_0xeb29('0xc')]=_0x13ed66[_0xeb29('0xc')]||'';}module[_0xeb29('0xd')]=Trunk; \ No newline at end of file +var _0xf467=['domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','stateTime','status','unknown','registry','indexOf','host','port','domain'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0xf467,0x15d));var _0x7f46=function(_0x2bceba,_0x1a5626){_0x2bceba=_0x2bceba-0x0;var _0xc16d63=_0xf467[_0x2bceba];return _0xc16d63;};'use strict';function Trunk(_0x3d2c7c){this['id']=_0x3d2c7c['id']||0x0;this[_0x7f46('0x0')]=_0x3d2c7c['active']||![];this[_0x7f46('0x1')]=_0x3d2c7c['name']||'';this[_0x7f46('0x2')]='unknown';this[_0x7f46('0x3')]=0x0;this[_0x7f46('0x4')]=_0x7f46('0x5');this[_0x7f46('0x6')]=_0x3d2c7c[_0x7f46('0x6')]&&_0x3d2c7c[_0x7f46('0x6')][_0x7f46('0x7')](':')?_0x3d2c7c['registry']['split'](':')[0x0]:'';this[_0x7f46('0x8')]='';this[_0x7f46('0x9')]='';this[_0x7f46('0xa')]='';this[_0x7f46('0xb')]='';this[_0x7f46('0xc')]='';this[_0x7f46('0xd')]='unknown';this[_0x7f46('0xe')]='';this[_0x7f46('0xf')]='';this[_0x7f46('0x10')]=_0x3d2c7c['defaultuser']||'';}module[_0x7f46('0x11')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index d6eb98a..cd5a5ce 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 _0x4815=['mandatoryDisposition','exports','none'];(function(_0x190214,_0x72ea0f){var _0x117bff=function(_0x5c478a){while(--_0x5c478a){_0x190214['push'](_0x190214['shift']());}};_0x117bff(++_0x72ea0f);}(_0x4815,0x104));var _0x5481=function(_0x4cddb7,_0x380bd6){_0x4cddb7=_0x4cddb7-0x0;var _0xf5cf=_0x4815[_0x4cddb7];return _0xf5cf;};'use strict';function voiceExtension(_0x2e9167){this['id']=_0x2e9167['id']||0x0;this['exten']=_0x2e9167['exten']||'';this['recordingFormat']=_0x2e9167['recordingFormat']||_0x5481('0x0');this['mandatoryDisposition']=_0x2e9167[_0x5481('0x1')]||![];}module[_0x5481('0x2')]=voiceExtension; \ No newline at end of file +var _0x8bfd=['none','mandatoryDisposition','exten','recordingFormat'];(function(_0x13b392,_0x3481f2){var _0x39db24=function(_0xab91e5){while(--_0xab91e5){_0x13b392['push'](_0x13b392['shift']());}};_0x39db24(++_0x3481f2);}(_0x8bfd,0x182));var _0xd8bf=function(_0x566438,_0x3abb6a){_0x566438=_0x566438-0x0;var _0x2d8c26=_0x8bfd[_0x566438];return _0x2d8c26;};'use strict';function voiceExtension(_0x54a783){this['id']=_0x54a783['id']||0x0;this['exten']=_0x54a783[_0xd8bf('0x0')]||'';this[_0xd8bf('0x1')]=_0x54a783[_0xd8bf('0x1')]||_0xd8bf('0x2');this[_0xd8bf('0x3')]=_0x54a783[_0xd8bf('0x3')]||![];}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 64d39f3..5318a07 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 _0xd5fc=['Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','exports','unknown','invalid','unavailable','ringing','ringinuse','onhold','wav','gsm','roundrobin','monitor_format','type','inbound','talking','answered','sumHoldTime','sumBillable','unmanaged','abandoned','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry'];(function(_0x388781,_0x29fca6){var _0x47f362=function(_0x3098b0){while(--_0x3098b0){_0x388781['push'](_0x388781['shift']());}};_0x47f362(++_0x29fca6);}(_0xd5fc,0xae));var _0xcd5f=function(_0x4c9578,_0x1d5c78){_0x4c9578=_0x4c9578-0x0;var _0x4e2730=_0xd5fc[_0x4c9578];return _0x4e2730;};'use strict';var statusDesc=[_0xcd5f('0x0'),'not_inuse','inuse','busy',_0xcd5f('0x1'),_0xcd5f('0x2'),_0xcd5f('0x3'),_0xcd5f('0x4'),_0xcd5f('0x5')];var monitorFormat={'wav':_0xcd5f('0x6'),'wav49':'wav49','gsm':_0xcd5f('0x7')};var strategy={'rrmemory':'rrmemory','roundrobin':_0xcd5f('0x8')};function VoiceQueue(_0x159b3f){this['id']=_0x159b3f['id']||0x0;this['name']=_0x159b3f['name']||'';this['monitor_format']=_0x159b3f[_0xcd5f('0x9')]||'';this['type']=_0x159b3f[_0xcd5f('0xa')]||_0xcd5f('0xb');this['waiting']=0x0;this[_0xcd5f('0xc')]=0x0;this['total']=0x0;this[_0xcd5f('0xd')]=0x0;this['sumDuration']=0x0;this[_0xcd5f('0xe')]=0x0;this[_0xcd5f('0xf')]=0x0;this[_0xcd5f('0x10')]=0x0;this[_0xcd5f('0x11')]=0x0;this['loggedIn']=0x0;this[_0xcd5f('0x12')]=0x0;this[_0xcd5f('0x13')]=_0x159b3f['acw']||![];this[_0xcd5f('0x14')]=_0x159b3f[_0xcd5f('0x14')]||0xa;this[_0xcd5f('0x15')]=_0x159b3f[_0xcd5f('0x15')]||'no';this[_0xcd5f('0x16')]=!![];this['message']='';this[_0xcd5f('0x17')]=0x0;this[_0xcd5f('0x18')]=0x0;this[_0xcd5f('0x19')]=_0x159b3f[_0xcd5f('0x19')]||null;this[_0xcd5f('0x1a')]=_0x159b3f[_0xcd5f('0x1a')]?_0x159b3f[_0xcd5f('0x1a')]:null;this['dialActive']=_0x159b3f[_0xcd5f('0x1b')];this[_0xcd5f('0x1c')]=_0x159b3f[_0xcd5f('0x1c')]||_0xcd5f('0x1d');this['dialLimitChannel']=_0x159b3f[_0xcd5f('0x1e')]||0x0;this['dialLimitQueue']=_0x159b3f[_0xcd5f('0x1f')]||0x0;this[_0xcd5f('0x20')]=_0x159b3f['dialPowerLevel']||0x1;this[_0xcd5f('0x21')]=_0x159b3f[_0xcd5f('0x21')]||'dropRate';this[_0xcd5f('0x22')]=_0x159b3f['dialPredictiveOptimizationPercentage']||0.03;this[_0xcd5f('0x23')]=_0x159b3f['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x159b3f[_0xcd5f('0x24')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x159b3f['dialOriginateCallerIdNumber']||_0xcd5f('0x25');this['dialOriginateTimeout']=_0x159b3f[_0xcd5f('0x26')]||0x1e;this[_0xcd5f('0x27')]=_0x159b3f[_0xcd5f('0x27')]||_0xcd5f('0x28');this[_0xcd5f('0x29')]=_0x159b3f['dialQueueTimeout']||0x3;this[_0xcd5f('0x2a')]=_0x159b3f[_0xcd5f('0x2a')]||undefined;this[_0xcd5f('0x2b')]=_0x159b3f[_0xcd5f('0x2b')]||0x3;this[_0xcd5f('0x2c')]=_0x159b3f[_0xcd5f('0x2c')]||0x96;this[_0xcd5f('0x2d')]=_0x159b3f[_0xcd5f('0x2d')]||0x3;this[_0xcd5f('0x2e')]=_0x159b3f[_0xcd5f('0x2e')]||0x96;this[_0xcd5f('0x2f')]=_0x159b3f[_0xcd5f('0x2f')]||0x3;this[_0xcd5f('0x30')]=_0x159b3f[_0xcd5f('0x30')]||0x96;this[_0xcd5f('0x31')]=_0x159b3f[_0xcd5f('0x31')]||0x3;this[_0xcd5f('0x32')]=_0x159b3f['dialNoSuchNumberRetryFrequency']||0x96;this[_0xcd5f('0x33')]=_0x159b3f[_0xcd5f('0x33')]||0x3;this['dialDropRetryFrequency']=_0x159b3f[_0xcd5f('0x34')]||0x96;this['dialAbandonedMaxRetry']=_0x159b3f[_0xcd5f('0x35')]||0x3;this[_0xcd5f('0x36')]=_0x159b3f[_0xcd5f('0x36')]||0x96;this[_0xcd5f('0x37')]=_0x159b3f[_0xcd5f('0x37')]||0x3;this[_0xcd5f('0x38')]=_0x159b3f['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x159b3f[_0xcd5f('0x39')]||0x3;this[_0xcd5f('0x3a')]=_0x159b3f[_0xcd5f('0x3a')]||0x96;this[_0xcd5f('0x3b')]=_0x159b3f[_0xcd5f('0x3b')]||0x4;this[_0xcd5f('0x3c')]=_0x159b3f[_0xcd5f('0x3c')]?_0x159b3f['Trunk']:undefined;this[_0xcd5f('0x3d')]=_0x159b3f[_0xcd5f('0x3d')]?_0x159b3f[_0xcd5f('0x3d')]:undefined;this[_0xcd5f('0x3e')]=_0x159b3f['dialPrefix']||undefined;this[_0xcd5f('0x3f')]=_0x159b3f[_0xcd5f('0x3f')]?_0x159b3f[_0xcd5f('0x3f')]:undefined;this['dialOrderByScheduledAt']=_0x159b3f[_0xcd5f('0x40')]||_0xcd5f('0x41');this[_0xcd5f('0x42')]=_0x159b3f[_0xcd5f('0x42')]||undefined;this[_0xcd5f('0x43')]=_0x159b3f[_0xcd5f('0x43')]||undefined;this[_0xcd5f('0x44')]=strategy[_0x159b3f[_0xcd5f('0x44')]]||'rrmemory';this['queueStatusComplete']=!![];this[_0xcd5f('0x45')]=_0x159b3f['dialAMDActive']||![];this[_0xcd5f('0x46')]=_0x159b3f[_0xcd5f('0x46')];this[_0xcd5f('0x47')]=_0x159b3f['dialAMDGreeting'];this[_0xcd5f('0x48')]=_0x159b3f[_0xcd5f('0x48')];this[_0xcd5f('0x49')]=_0x159b3f[_0xcd5f('0x49')];this['dialAMDMinWordLength']=_0x159b3f[_0xcd5f('0x4a')];this['dialAMDBetweenWordsSilence']=_0x159b3f[_0xcd5f('0x4b')];this[_0xcd5f('0x4c')]=_0x159b3f[_0xcd5f('0x4c')];this[_0xcd5f('0x4d')]=_0x159b3f[_0xcd5f('0x4d')];this[_0xcd5f('0x4e')]=_0x159b3f['dialAMDMaximumWordLength'];this[_0xcd5f('0x4f')]=0x0;this['pTalking']=0x0;this[_0xcd5f('0x50')]=_0x159b3f[_0xcd5f('0x50')];this[_0xcd5f('0x51')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xcd5f('0x52')]=0x0;this[_0xcd5f('0x53')]=0x0;this[_0xcd5f('0x54')]=0x0;this[_0xcd5f('0x55')]=0x0;this[_0xcd5f('0x56')]=0x0;this[_0xcd5f('0x57')]=0x0;this[_0xcd5f('0x58')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xcd5f('0x59')]=0x0;this[_0xcd5f('0x5a')]=0x0;this[_0xcd5f('0x5b')]=0x0;this['outboundAbandonedDay']=0x0;this['startProgressive']=undefined;this[_0xcd5f('0x5c')]=undefined;this['handlePredictive']=undefined;this[_0xcd5f('0x5d')]=1.05;this[_0xcd5f('0x5e')]=0x0;this[_0xcd5f('0x5f')]=0x0;this[_0xcd5f('0x60')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xcd5f('0x61')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xcd5f('0x62')]=0x0;this[_0xcd5f('0x63')]=0x0;this[_0xcd5f('0x64')]=_0x159b3f['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xcd5f('0x65')]=_0x159b3f[_0xcd5f('0x66')]||0xa;this[_0xcd5f('0x67')]=0x0;this[_0xcd5f('0x68')]=0x0;this[_0xcd5f('0x69')]=0x1;this[_0xcd5f('0x6a')]=0x0;this[_0xcd5f('0x6b')]=0x0;this[_0xcd5f('0x6c')]=0x0;this[_0xcd5f('0x6d')]=0x0;this[_0xcd5f('0x6e')]=_0x159b3f['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x159b3f[_0xcd5f('0x6f')]||![];this[_0xcd5f('0x70')]=_0x159b3f[_0xcd5f('0x70')]||undefined;this[_0xcd5f('0x71')]=_0x159b3f['dialAgiAfterHangupClient']||![];this[_0xcd5f('0x72')]=_0x159b3f['dialAgiAfterHangupAgent']||![];this[_0xcd5f('0x9')]=monitorFormat[_0x159b3f[_0xcd5f('0x9')]]?monitorFormat[_0x159b3f[_0xcd5f('0x9')]]:undefined;this['mandatoryDisposition']=_0x159b3f['mandatoryDisposition']||![];this[_0xcd5f('0x73')]=_0x159b3f[_0xcd5f('0x73')]?_0x159b3f[_0xcd5f('0x73')]:undefined;}module[_0xcd5f('0x74')]=VoiceQueue; \ No newline at end of file +var _0x0215=['dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','answered','sumDuration','sumHoldTime','sumBillable','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout'];(function(_0x3c58da,_0x50e809){var _0x17697e=function(_0x45a222){while(--_0x45a222){_0x3c58da['push'](_0x3c58da['shift']());}};_0x17697e(++_0x50e809);}(_0x0215,0x140));var _0x5021=function(_0x587fb5,_0x59cb3b){_0x587fb5=_0x587fb5-0x0;var _0x551105=_0x0215[_0x587fb5];return _0x551105;};'use strict';var statusDesc=['unknown',_0x5021('0x0'),_0x5021('0x1'),_0x5021('0x2'),_0x5021('0x3'),_0x5021('0x4'),_0x5021('0x5'),_0x5021('0x6'),'onhold'];var monitorFormat={'wav':_0x5021('0x7'),'wav49':_0x5021('0x8'),'gsm':_0x5021('0x9')};var strategy={'rrmemory':_0x5021('0xa'),'roundrobin':_0x5021('0xb')};function VoiceQueue(_0x228581){this['id']=_0x228581['id']||0x0;this[_0x5021('0xc')]=_0x228581['name']||'';this[_0x5021('0xd')]=_0x228581[_0x5021('0xd')]||'';this['type']=_0x228581[_0x5021('0xe')]||_0x5021('0xf');this[_0x5021('0x10')]=0x0;this[_0x5021('0x11')]=0x0;this['total']=0x0;this[_0x5021('0x12')]=0x0;this[_0x5021('0x13')]=0x0;this[_0x5021('0x14')]=0x0;this[_0x5021('0x15')]=0x0;this['unmanaged']=0x0;this[_0x5021('0x16')]=0x0;this[_0x5021('0x17')]=0x0;this[_0x5021('0x18')]=0x0;this['acw']=_0x228581[_0x5021('0x19')]||![];this[_0x5021('0x1a')]=_0x228581[_0x5021('0x1a')]||0xa;this['autopause']=_0x228581[_0x5021('0x1b')]||'no';this[_0x5021('0x1c')]=!![];this[_0x5021('0x1d')]='';this[_0x5021('0x1e')]=0x0;this['temp']=0x0;this[_0x5021('0x1f')]=_0x228581['dialTimezone']||null;this[_0x5021('0x20')]=_0x228581['dialGlobalInterval']?_0x228581[_0x5021('0x20')]:null;this[_0x5021('0x21')]=_0x228581[_0x5021('0x21')];this[_0x5021('0x22')]=_0x228581[_0x5021('0x22')]||_0x5021('0x23');this[_0x5021('0x24')]=_0x228581[_0x5021('0x24')]||0x0;this[_0x5021('0x25')]=_0x228581[_0x5021('0x25')]||0x0;this[_0x5021('0x26')]=_0x228581[_0x5021('0x26')]||0x1;this[_0x5021('0x27')]=_0x228581[_0x5021('0x27')]||_0x5021('0x28');this['dialPredictiveOptimizationPercentage']=_0x228581['dialPredictiveOptimizationPercentage']||0.03;this[_0x5021('0x29')]=_0x228581[_0x5021('0x29')]||0x258;this[_0x5021('0x2a')]=_0x228581[_0x5021('0x2a')]||_0x5021('0x2b');this[_0x5021('0x2c')]=_0x228581[_0x5021('0x2c')]||_0x5021('0x2b');this[_0x5021('0x2d')]=_0x228581[_0x5021('0x2d')]||0x1e;this['dialQueueOptions']=_0x228581[_0x5021('0x2e')]||_0x5021('0x2f');this[_0x5021('0x30')]=_0x228581['dialQueueTimeout']||0x3;this[_0x5021('0x31')]=_0x228581[_0x5021('0x31')]||undefined;this['dialCongestionMaxRetry']=_0x228581[_0x5021('0x32')]||0x3;this[_0x5021('0x33')]=_0x228581[_0x5021('0x33')]||0x96;this[_0x5021('0x34')]=_0x228581[_0x5021('0x34')]||0x3;this[_0x5021('0x35')]=_0x228581[_0x5021('0x35')]||0x96;this[_0x5021('0x36')]=_0x228581[_0x5021('0x36')]||0x3;this['dialNoAnswerRetryFrequency']=_0x228581['dialNoAnswerRetryFrequency']||0x96;this[_0x5021('0x37')]=_0x228581[_0x5021('0x37')]||0x3;this[_0x5021('0x38')]=_0x228581[_0x5021('0x38')]||0x96;this[_0x5021('0x39')]=_0x228581['dialDropMaxRetry']||0x3;this[_0x5021('0x3a')]=_0x228581[_0x5021('0x3a')]||0x96;this['dialAbandonedMaxRetry']=_0x228581['dialAbandonedMaxRetry']||0x3;this[_0x5021('0x3b')]=_0x228581[_0x5021('0x3b')]||0x96;this[_0x5021('0x3c')]=_0x228581[_0x5021('0x3c')]||0x3;this['dialMachineRetryFrequency']=_0x228581[_0x5021('0x3d')]||0x96;this[_0x5021('0x3e')]=_0x228581['dialAgentRejectMaxRetry']||0x3;this[_0x5021('0x3f')]=_0x228581[_0x5021('0x3f')]||0x96;this['dialGlobalMaxRetry']=_0x228581[_0x5021('0x40')]||0x4;this['Trunk']=_0x228581[_0x5021('0x41')]?_0x228581['Trunk']:undefined;this[_0x5021('0x42')]=_0x228581['TrunkBackup']?_0x228581[_0x5021('0x42')]:undefined;this[_0x5021('0x43')]=_0x228581[_0x5021('0x43')]||undefined;this['Interval']=_0x228581[_0x5021('0x44')]?_0x228581[_0x5021('0x44')]:undefined;this['dialOrderByScheduledAt']=_0x228581[_0x5021('0x45')]||_0x5021('0x46');this[_0x5021('0x47')]=_0x228581[_0x5021('0x47')]||undefined;this['dialCutDigit']=_0x228581['dialCutDigit']||undefined;this['strategy']=strategy[_0x228581['strategy']]||_0x5021('0xa');this[_0x5021('0x48')]=!![];this['dialAMDActive']=_0x228581[_0x5021('0x49')]||![];this['dialAMDInitialSilence']=_0x228581[_0x5021('0x4a')];this['dialAMDGreeting']=_0x228581[_0x5021('0x4b')];this[_0x5021('0x4c')]=_0x228581[_0x5021('0x4c')];this[_0x5021('0x4d')]=_0x228581['dialAMDTotalAnalysisTime'];this[_0x5021('0x4e')]=_0x228581[_0x5021('0x4e')];this['dialAMDBetweenWordsSilence']=_0x228581[_0x5021('0x4f')];this[_0x5021('0x50')]=_0x228581[_0x5021('0x50')];this[_0x5021('0x51')]=_0x228581['dialAMDSilenceThreshold'];this[_0x5021('0x52')]=_0x228581[_0x5021('0x52')];this[_0x5021('0x53')]=0x0;this['pTalking']=0x0;this[_0x5021('0x54')]=_0x228581[_0x5021('0x54')];this['outboundAnswerCallsDay']=0x0;this[_0x5021('0x55')]=0x0;this[_0x5021('0x56')]=0x0;this[_0x5021('0x57')]=0x0;this[_0x5021('0x58')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x5021('0x59')]=0x0;this[_0x5021('0x5a')]=0x0;this[_0x5021('0x5b')]=0x0;this[_0x5021('0x5c')]=0x0;this[_0x5021('0x5d')]=0x0;this[_0x5021('0x5e')]=0x0;this[_0x5021('0x5f')]=0x0;this[_0x5021('0x60')]=0x0;this[_0x5021('0x61')]=undefined;this[_0x5021('0x62')]=undefined;this[_0x5021('0x63')]=undefined;this[_0x5021('0x64')]=1.05;this[_0x5021('0x65')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x5021('0x66')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x5021('0x67')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x5021('0x68')]=0x0;this[_0x5021('0x69')]=0x0;this[_0x5021('0x6a')]=_0x228581[_0x5021('0x6b')]||0x14;this[_0x5021('0x6c')]=_0x228581[_0x5021('0x6b')]||0xa;this[_0x5021('0x6d')]=0x0;this[_0x5021('0x6e')]=0x0;this[_0x5021('0x6f')]=0x1;this['erlangCalls']=0x0;this[_0x5021('0x70')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x5021('0x71')]=0x0;this['dialRecallMeTimeout']=_0x228581[_0x5021('0x72')]||0x1e;this[_0x5021('0x73')]=_0x228581['dialRecallInQueue']||![];this[_0x5021('0x74')]=_0x228581['dialQueueProject2']||undefined;this[_0x5021('0x75')]=_0x228581[_0x5021('0x75')]||![];this[_0x5021('0x76')]=_0x228581[_0x5021('0x76')]||![];this[_0x5021('0xd')]=monitorFormat[_0x228581[_0x5021('0xd')]]?monitorFormat[_0x228581[_0x5021('0xd')]]:undefined;this[_0x5021('0x77')]=_0x228581[_0x5021('0x77')]||![];this[_0x5021('0x78')]=_0x228581[_0x5021('0x78')]?_0x228581[_0x5021('0x78')]:undefined;}module[_0x5021('0x79')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 31fd77c..64c1971 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 _0x2a9a=['Configurations','name','username','accessKey','remoteUri','serverUrl'];(function(_0x484fb4,_0x55e308){var _0x33c0e4=function(_0xdf71d6){while(--_0xdf71d6){_0x484fb4['push'](_0x484fb4['shift']());}};_0x33c0e4(++_0x55e308);}(_0x2a9a,0x12d));var _0xa2a9=function(_0x3a781d,_0x2d75b4){_0x3a781d=_0x3a781d-0x0;var _0x51d76d=_0x2a9a[_0x3a781d];return _0x51d76d;};'use strict';function VtigerAccount(_0x33b92e){this['id']=_0x33b92e['id']||0x0;this[_0xa2a9('0x0')]=_0x33b92e[_0xa2a9('0x0')]||'';this[_0xa2a9('0x1')]=_0x33b92e[_0xa2a9('0x1')]||'';this[_0xa2a9('0x2')]=_0x33b92e['accessKey']||'';this[_0xa2a9('0x3')]=_0x33b92e[_0xa2a9('0x3')]||'';this[_0xa2a9('0x4')]=_0x33b92e[_0xa2a9('0x4')]||'';this[_0xa2a9('0x5')]=_0x33b92e[_0xa2a9('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x4a1f=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x5e10e1,_0x122d70){var _0x599d91=function(_0x423604){while(--_0x423604){_0x5e10e1['push'](_0x5e10e1['shift']());}};_0x599d91(++_0x122d70);}(_0x4a1f,0xaa));var _0xf4a1=function(_0x460150,_0x232949){_0x460150=_0x460150-0x0;var _0x340677=_0x4a1f[_0x460150];return _0x340677;};'use strict';function VtigerAccount(_0x4960ee){this['id']=_0x4960ee['id']||0x0;this[_0xf4a1('0x0')]=_0x4960ee[_0xf4a1('0x0')]||'';this[_0xf4a1('0x1')]=_0x4960ee[_0xf4a1('0x1')]||'';this['accessKey']=_0x4960ee[_0xf4a1('0x2')]||'';this['remoteUri']=_0x4960ee[_0xf4a1('0x3')]||'';this[_0xf4a1('0x4')]=_0x4960ee[_0xf4a1('0x4')]||'';this[_0xf4a1('0x5')]=_0x4960ee[_0xf4a1('0x5')]||{};}module[_0xf4a1('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 f40f053..95ea1e6 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 _0x1d43=['authType','type','serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x349bb4,_0x2fab61){var _0x1311c2=function(_0x54fb9a){while(--_0x54fb9a){_0x349bb4['push'](_0x349bb4['shift']());}};_0x1311c2(++_0x2fab61);}(_0x1d43,0x19a));var _0x31d4=function(_0x289b70,_0x1ed00d){_0x289b70=_0x289b70-0x0;var _0x28353b=_0x1d43[_0x289b70];return _0x28353b;};'use strict';function ZendeskAccount(_0x278c06){this['id']=_0x278c06['id']||0x0;this[_0x31d4('0x0')]=_0x278c06[_0x31d4('0x0')]||'';this[_0x31d4('0x1')]=_0x278c06[_0x31d4('0x1')]||'';this[_0x31d4('0x2')]=_0x278c06[_0x31d4('0x2')]||'';this['token']=_0x278c06['token']||'';this[_0x31d4('0x3')]=_0x278c06[_0x31d4('0x3')]||'';this[_0x31d4('0x4')]=_0x278c06[_0x31d4('0x4')]||'';this[_0x31d4('0x5')]=_0x278c06[_0x31d4('0x5')]||'integrationTab';this[_0x31d4('0x6')]=_0x278c06[_0x31d4('0x6')]||'';this[_0x31d4('0x7')]=_0x278c06[_0x31d4('0x7')]||{};}module[_0x31d4('0x8')]=ZendeskAccount; \ No newline at end of file +var _0x985a=['serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x54597e,_0x1f4e85){var _0x3971ff=function(_0x202706){while(--_0x202706){_0x54597e['push'](_0x54597e['shift']());}};_0x3971ff(++_0x1f4e85);}(_0x985a,0x1d1));var _0xa985=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x985a[_0x19e35c];return _0x3e1fe8;};'use strict';function ZendeskAccount(_0x280101){this['id']=_0x280101['id']||0x0;this[_0xa985('0x0')]=_0x280101['name']||'';this[_0xa985('0x1')]=_0x280101[_0xa985('0x1')]||'';this[_0xa985('0x2')]=_0x280101[_0xa985('0x2')]||'';this['token']=_0x280101[_0xa985('0x3')]||'';this[_0xa985('0x4')]=_0x280101[_0xa985('0x4')]||'';this[_0xa985('0x5')]=_0x280101[_0xa985('0x5')]||'';this[_0xa985('0x6')]=_0x280101[_0xa985('0x6')]||_0xa985('0x7');this['serverUrl']=_0x280101[_0xa985('0x8')]||'';this[_0xa985('0x9')]=_0x280101['Configurations']||{};}module[_0xa985('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 6b9af92..71da049 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 _0x2099=['name','description','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports'];(function(_0x455795,_0x280de5){var _0x18d046=function(_0x5e0297){while(--_0x5e0297){_0x455795['push'](_0x455795['shift']());}};_0x18d046(++_0x280de5);}(_0x2099,0x19a));var _0x9209=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x2099[_0x57b54c];return _0x59cc19;};'use strict';function ZohoAccount(_0x54778f){this['id']=_0x54778f['id']||0x0;this[_0x9209('0x0')]=_0x54778f[_0x9209('0x0')]||'';this[_0x9209('0x1')]=_0x54778f['description']||'';this['host']=_0x54778f['host']||'';this[_0x9209('0x2')]=_0x54778f[_0x9209('0x2')]||'';this['clientId']=_0x54778f[_0x9209('0x3')]||'';this[_0x9209('0x4')]=_0x54778f[_0x9209('0x4')]||'';this['serverUrl']=_0x54778f[_0x9209('0x5')]||'';this[_0x9209('0x6')]=_0x54778f['code']||'';this[_0x9209('0x7')]=_0x54778f['refreshToken']||'';this[_0x9209('0x8')]=_0x54778f[_0x9209('0x8')]||{};}module[_0x9209('0x9')]=ZohoAccount; \ No newline at end of file +var _0x2ef1=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone'];(function(_0x3a4f8a,_0x5c8b02){var _0x192ef9=function(_0x2a0f90){while(--_0x2a0f90){_0x3a4f8a['push'](_0x3a4f8a['shift']());}};_0x192ef9(++_0x5c8b02);}(_0x2ef1,0x151));var _0x12ef=function(_0x16efdc,_0x1cfd71){_0x16efdc=_0x16efdc-0x0;var _0x54cad3=_0x2ef1[_0x16efdc];return _0x54cad3;};'use strict';function ZohoAccount(_0xedb0b8){this['id']=_0xedb0b8['id']||0x0;this[_0x12ef('0x0')]=_0xedb0b8[_0x12ef('0x0')]||'';this[_0x12ef('0x1')]=_0xedb0b8['description']||'';this[_0x12ef('0x2')]=_0xedb0b8[_0x12ef('0x2')]||'';this[_0x12ef('0x3')]=_0xedb0b8[_0x12ef('0x3')]||'';this['clientId']=_0xedb0b8[_0x12ef('0x4')]||'';this[_0x12ef('0x5')]=_0xedb0b8[_0x12ef('0x5')]||'';this[_0x12ef('0x6')]=_0xedb0b8[_0x12ef('0x6')]||'';this[_0x12ef('0x7')]=_0xedb0b8[_0x12ef('0x7')]||'';this[_0x12ef('0x8')]=_0xedb0b8['refreshToken']||'';this[_0x12ef('0x9')]=_0xedb0b8['Configurations']||{};}module[_0x12ef('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index b1294f5..ccb5dbb 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 _0x7b1e=['campaigntype','queue','dialAnswer','isNil','Agent','membername','format','SIP/%s','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','calleridname','exports','util','lodash','moment','string','uniqueid','idContact','name','type'];(function(_0x5f3d89,_0x2fa852){var _0x5177be=function(_0x20a956){while(--_0x20a956){_0x5f3d89['push'](_0x5f3d89['shift']());}};_0x5177be(++_0x2fa852);}(_0x7b1e,0x1ba));var _0xe7b1=function(_0x43a37c,_0x25a567){_0x43a37c=_0x43a37c-0x0;var _0x5d1d40=_0x7b1e[_0x43a37c];return _0x5d1d40;};'use strict';var util=require(_0xe7b1('0x0'));var _=require(_0xe7b1('0x1'));var moment=require(_0xe7b1('0x2'));function checkNameSurname(_0x31dce9,_0x3a58f6,_0x52282e){var _0x8c7b72='';if(!_['isNil'](_0x3a58f6)&&_0xe7b1('0x3')===typeof _0x3a58f6){_0x8c7b72+=_0x3a58f6;}if(!_['isNil'](_0x52282e)&&'string'===typeof _0x52282e){_0x8c7b72+='\x20'+_0x52282e;}if(_0x8c7b72!==''){return _0x8c7b72;}return _0x31dce9;}function Action(_0x2fcc3b,_0x5325d7,_0x395106,_0x25af4c,_0x477fe1){this[_0xe7b1('0x4')]=_0x395106||undefined;this[_0xe7b1('0x5')]=_0x2fcc3b['id'];this['queue']=_0x5325d7[_0xe7b1('0x6')];this[_0xe7b1('0x7')]=_0x5325d7[_0xe7b1('0x7')];this[_0xe7b1('0x8')]=_0xe7b1('0x9');this[_0xe7b1('0xa')]=![];this['membername']=_[_0xe7b1('0xb')](_0x2fcc3b[_0xe7b1('0xc')])?undefined:_0x2fcc3b['Agent'][_0xe7b1('0x6')];this['channelAgent']=this[_0xe7b1('0xd')]?util[_0xe7b1('0xe')](_0xe7b1('0xf'),this['membername']):_0x25af4c||undefined;this['calleridname']=checkNameSurname(_0x2fcc3b[_0xe7b1('0x10')][_0xe7b1('0x11')],_0x2fcc3b['Contact'][_0xe7b1('0x12')],_0x2fcc3b[_0xe7b1('0x10')][_0xe7b1('0x13')]);this[_0xe7b1('0x14')]=_0x2fcc3b[_0xe7b1('0x14')]||![];this[_0xe7b1('0x15')]=_0x2fcc3b[_0xe7b1('0x10')][_0xe7b1('0x11')];this[_0xe7b1('0x16')]=_0x2fcc3b[_0xe7b1('0x16')];this['countbusyretry']=_0x2fcc3b[_0xe7b1('0x17')]||0x0;this[_0xe7b1('0x18')]=_0x2fcc3b[_0xe7b1('0x18')]||0x0;this[_0xe7b1('0x19')]=_0x2fcc3b[_0xe7b1('0x19')]||0x0;this[_0xe7b1('0x1a')]=(_0x2fcc3b[_0xe7b1('0x17')]||0x0)+(_0x2fcc3b['countcongestionretry']||0x0)+(_0x2fcc3b[_0xe7b1('0x19')]||0x0)+(_0x2fcc3b[_0xe7b1('0x1b')]||0x0)+(_0x2fcc3b[_0xe7b1('0x1c')]||0x0)+(_0x2fcc3b[_0xe7b1('0x1d')]||0x0)+(_0x2fcc3b['countmachineretry']||0x0)+(_0x2fcc3b[_0xe7b1('0x1e')]||0x0);this[_0xe7b1('0x1b')]=_0x2fcc3b[_0xe7b1('0x1b')]||0x0;this[_0xe7b1('0x1c')]=_0x2fcc3b['countdropretry']||0x0;this[_0xe7b1('0x1d')]=_0x2fcc3b[_0xe7b1('0x1d')]||0x0;this[_0xe7b1('0x1f')]=_0x2fcc3b[_0xe7b1('0x1f')]||0x0;this['countagentrejectretry']=_0x2fcc3b[_0xe7b1('0x1e')]||0x0;this[_0xe7b1('0x20')]=_0x2fcc3b[_0xe7b1('0x20')];this[_0xe7b1('0x21')]=_0x2fcc3b[_0xe7b1('0x21')];this[_0xe7b1('0x22')]=_0x2fcc3b[_0xe7b1('0x22')];this[_0xe7b1('0x23')]=_0x2fcc3b[_0xe7b1('0x23')];this[_0xe7b1('0x24')]=_0x2fcc3b[_0xe7b1('0x24')];this[_0xe7b1('0x25')]=_0x2fcc3b['ListId'];this[_0xe7b1('0x26')]=_[_0xe7b1('0xb')](_0x2fcc3b[_0xe7b1('0xc')])?_0x2fcc3b['UserId']:_0x2fcc3b[_0xe7b1('0xc')]['id'];this[_0xe7b1('0x27')]=_0x2fcc3b[_0xe7b1('0x27')];this['originatecalleridnum']='';this[_0xe7b1('0x28')]='';}Action['prototype'][_0xe7b1('0x29')]=function(){return util[_0xe7b1('0xe')](_0xe7b1('0x2a'),this[_0xe7b1('0x2b')],this['number']);};module[_0xe7b1('0x2c')]=Action; \ No newline at end of file +var _0x29b6=['uniqueid','idContact','name','type','campaigntype','queue','membername','Agent','channelAgent','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','number','util','lodash','isNil','string'];(function(_0x4a784e,_0xdcb503){var _0x87d01d=function(_0x439654){while(--_0x439654){_0x4a784e['push'](_0x4a784e['shift']());}};_0x87d01d(++_0xdcb503);}(_0x29b6,0x130));var _0x629b=function(_0x142894,_0xf2f3d2){_0x142894=_0x142894-0x0;var _0x336ad6=_0x29b6[_0x142894];return _0x336ad6;};'use strict';var util=require(_0x629b('0x0'));var _=require(_0x629b('0x1'));var moment=require('moment');function checkNameSurname(_0xe7ea01,_0xe5fa10,_0x1a21e0){var _0x153487='';if(!_[_0x629b('0x2')](_0xe5fa10)&&_0x629b('0x3')===typeof _0xe5fa10){_0x153487+=_0xe5fa10;}if(!_[_0x629b('0x2')](_0x1a21e0)&&_0x629b('0x3')===typeof _0x1a21e0){_0x153487+='\x20'+_0x1a21e0;}if(_0x153487!==''){return _0x153487;}return _0xe7ea01;}function Action(_0x24d43d,_0x512b1b,_0x44f4ed,_0x3dfc17,_0x43b576){this[_0x629b('0x4')]=_0x44f4ed||undefined;this[_0x629b('0x5')]=_0x24d43d['id'];this['queue']=_0x512b1b[_0x629b('0x6')];this[_0x629b('0x7')]=_0x512b1b[_0x629b('0x7')];this[_0x629b('0x8')]=_0x629b('0x9');this['dialAnswer']=![];this[_0x629b('0xa')]=_[_0x629b('0x2')](_0x24d43d[_0x629b('0xb')])?undefined:_0x24d43d[_0x629b('0xb')][_0x629b('0x6')];this[_0x629b('0xc')]=this[_0x629b('0xa')]?util['format'](_0x629b('0xd'),this['membername']):_0x3dfc17||undefined;this[_0x629b('0xe')]=checkNameSurname(_0x24d43d[_0x629b('0xf')][_0x629b('0x10')],_0x24d43d[_0x629b('0xf')][_0x629b('0x11')],_0x24d43d['Contact'][_0x629b('0x12')]);this['active']=_0x24d43d[_0x629b('0x13')]||![];this[_0x629b('0x14')]=_0x24d43d[_0x629b('0xf')][_0x629b('0x10')];this[_0x629b('0x15')]=_0x24d43d['scheduledat'];this[_0x629b('0x16')]=_0x24d43d[_0x629b('0x16')]||0x0;this[_0x629b('0x17')]=_0x24d43d['countcongestionretry']||0x0;this[_0x629b('0x18')]=_0x24d43d[_0x629b('0x18')]||0x0;this[_0x629b('0x19')]=(_0x24d43d[_0x629b('0x16')]||0x0)+(_0x24d43d[_0x629b('0x17')]||0x0)+(_0x24d43d[_0x629b('0x18')]||0x0)+(_0x24d43d[_0x629b('0x1a')]||0x0)+(_0x24d43d[_0x629b('0x1b')]||0x0)+(_0x24d43d['countabandonedretry']||0x0)+(_0x24d43d[_0x629b('0x1c')]||0x0)+(_0x24d43d['countagentrejectretry']||0x0);this[_0x629b('0x1a')]=_0x24d43d['countnosuchnumberretry']||0x0;this[_0x629b('0x1b')]=_0x24d43d[_0x629b('0x1b')]||0x0;this[_0x629b('0x1d')]=_0x24d43d[_0x629b('0x1d')]||0x0;this[_0x629b('0x1c')]=_0x24d43d[_0x629b('0x1c')]||0x0;this[_0x629b('0x1e')]=_0x24d43d[_0x629b('0x1e')]||0x0;this[_0x629b('0x1f')]=_0x24d43d[_0x629b('0x1f')];this['callbackuniqueid']=_0x24d43d[_0x629b('0x20')];this[_0x629b('0x21')]=_0x24d43d[_0x629b('0x21')];this[_0x629b('0x22')]=_0x24d43d[_0x629b('0x22')];this['ContactId']=_0x24d43d[_0x629b('0x23')];this[_0x629b('0x24')]=_0x24d43d[_0x629b('0x24')];this['UserId']=_['isNil'](_0x24d43d[_0x629b('0xb')])?_0x24d43d['UserId']:_0x24d43d['Agent']['id'];this[_0x629b('0x25')]=_0x24d43d[_0x629b('0x25')];this['originatecalleridnum']='';this[_0x629b('0x26')]='';}Action[_0x629b('0x27')][_0x629b('0x28')]=function(){return util[_0x629b('0x29')](_0x629b('0x2a'),this[_0x629b('0xe')],this[_0x629b('0x2b')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index f0cb1ed..f6030a7 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 _0xdf83=['dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','Interval','stringify','voice_queue:save','info','voice_queue_presence:remove','sendMessageOneNotActive','available','paused','NOT_ACTIVE','IS_DISACTIVED','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','prototype','syncCampaigns','hasOwnProperty','outbound','clearZombieChannels','recallMe','clearZombieChannel','enqueue','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','pick','contactId','ListId','Action','status','channel','catch','[clearZombieChannel]','dialAnswer','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','voicePause','run','logger2','[RecallMe]','disableContact','starttime','format','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','createCustomerFinal','setMessage','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','outboundNoSuchCallsDay','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','createCustomerHistory','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','ANSWER','responsetime','answertime','uniqueid','\x20Queue','custom:agentconnect','buildObj','connect','custom:agentConnectPreview','custom:agentcomplete','complete','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','linkedid','BUSY','outboundBusyCallsDay','countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialBusyMaxRetry','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','countagentrejectretry','AgentReject','custom:agentreject','agentreject','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','countabandonedretry','Abandoned','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','Busy','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent][logCongestion]','updateOriginated','[callProgressDetectingAgent]','checkInBlack','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','custom:agentcalled','called','Calling','Call\x20failed','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Agent','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialCutDigit','substring','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','channelAgent','calleridnum','user:%s','user:agentconnect','accountcode','[originated][increment]','[originateFailure][logOriginateFailure]','actionid','lookAgent','clone','response','idContact','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','variable','keys','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','redis','defaults','localhost','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','bind','hangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','syncAttendedTransfer','loopCampaigns','campaignsPreview','emit','name','strategy','answered','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','type','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout'];(function(_0xa3c15b,_0x29a743){var _0x2ba867=function(_0x6da708){while(--_0x6da708){_0xa3c15b['push'](_0xa3c15b['shift']());}};_0x2ba867(++_0x29a743);}(_0xdf83,0x120));var _0x3df8=function(_0x2a1b33,_0x409f50){_0x2a1b33=_0x2a1b33-0x0;var _0x4c50e7=_0xdf83[_0x2a1b33];return _0x4c50e7;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x3df8('0x0'));var moment=require(_0x3df8('0x1'));var md5=require(_0x3df8('0x2'));var Redis=require(_0x3df8('0x3'));var config=require(_0x3df8('0x4'));var logger=require(_0x3df8('0x5'))(_0x3df8('0x6'));var loggerAction=require(_0x3df8('0x5'))(_0x3df8('0x7'));var ami=require(_0x3df8('0x8'));var rpcDb=require(_0x3df8('0x9'));var Action=require(_0x3df8('0xa'));var ut=require('./util/util');config[_0x3df8('0xb')]=_[_0x3df8('0xc')](config['redis'],{'host':_0x3df8('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x8503e1){this['tail']=this['tail']?this['tail']['finally'](_0x8503e1):_0x8503e1();};function Preview(_0x193560){this[_0x3df8('0xe')]=new Sequence();this['campaignsPreview']=_0x193560[_0x3df8('0xf')];this[_0x3df8('0x10')]=_0x193560[_0x3df8('0x10')];this[_0x3df8('0x11')]={};this[_0x3df8('0x12')]=_0x193560[_0x3df8('0x12')];this[_0x3df8('0x13')]=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0x3df8('0x14')](this));ami['on'](_0x3df8('0x15'),this['syncHangup'][_0x3df8('0x14')](this));ami['on'](_0x3df8('0x16'),this[_0x3df8('0x17')][_0x3df8('0x14')](this));ami['on'](_0x3df8('0x18'),this[_0x3df8('0x19')][_0x3df8('0x14')](this));ami['on'](_0x3df8('0x1a'),this[_0x3df8('0x1b')][_0x3df8('0x14')](this));ami['on'](_0x3df8('0x1c'),this[_0x3df8('0x1d')][_0x3df8('0x14')](this));ami['on']('attendedtransfer',this[_0x3df8('0x1e')][_0x3df8('0x14')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x3df8('0x14')](this));this[_0x3df8('0x1f')](this[_0x3df8('0x20')]);}function emit(_0x345ae0,_0x3f62c2,_0x21de02){io['to'](_0x345ae0)[_0x3df8('0x21')](_0x3f62c2,_0x21de02);}function emitCampaignPreview(_0x17ea65){if(_0x17ea65['type']==='outbound'){var _0x52d8b3={'id':_0x17ea65['id'],'name':_0x17ea65[_0x3df8('0x22')],'strategy':_0x17ea65[_0x3df8('0x23')],'answered':_0x17ea65[_0x3df8('0x24')],'available':_0x17ea65['available'],'loggedIn':_0x17ea65[_0x3df8('0x25')],'pTalking':_0x17ea65[_0x3df8('0x26')],'sumBillable':_0x17ea65[_0x3df8('0x27')],'sumDuration':_0x17ea65['sumDuration'],'sumHoldTime':_0x17ea65[_0x3df8('0x28')]||0x0,'talking':_0x17ea65[_0x3df8('0x29')],'total':_0x17ea65[_0x3df8('0x2a')],'type':_0x17ea65[_0x3df8('0x2b')],'unmanaged':_0x17ea65[_0x3df8('0x2c')],'abandoned':_0x17ea65[_0x3df8('0x2d')],'waiting':_0x17ea65['waiting'],'loggedInDb':_0x17ea65[_0x3df8('0x2e')],'dialActive':_0x17ea65[_0x3df8('0x2f')],'dialMethod':_0x17ea65[_0x3df8('0x30')],'dialOriginateCallerIdName':_0x17ea65[_0x3df8('0x31')],'dialOriginateCallerIdNumber':_0x17ea65['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x17ea65[_0x3df8('0x32')],'dialPrefix':_0x17ea65[_0x3df8('0x33')],'outboundAnswerAgiCallsDay':_0x17ea65[_0x3df8('0x34')],'outboundAnswerCallsDay':_0x17ea65[_0x3df8('0x35')],'outboundBlacklistCallsDay':_0x17ea65['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x17ea65['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x17ea65[_0x3df8('0x36')],'outboundDropCallsDayACS':_0x17ea65[_0x3df8('0x37')],'outboundDropCallsDayCallersExit':_0x17ea65['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x17ea65['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x17ea65[_0x3df8('0x38')],'outboundNoSuchCallsDay':_0x17ea65['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x17ea65['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x17ea65[_0x3df8('0x39')],'outboundRejectCallsDay':_0x17ea65[_0x3df8('0x3a')],'outboundUnknownCallsDay':_0x17ea65[_0x3df8('0x3b')],'outboundAbandonedCallsDay':_0x17ea65['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x17ea65[_0x3df8('0x3c')],'predictiveIntervalAvgHoldtime':_0x17ea65[_0x3df8('0x3d')],'predictiveIntervalAvgTalktime':_0x17ea65[_0x3df8('0x3e')],'predictiveIntervalDroppedCallsCallersExit':_0x17ea65[_0x3df8('0x3f')],'predictiveIntervalDroppedCallsTimeout':_0x17ea65[_0x3df8('0x40')],'predictiveIntervalErlangCalls':_0x17ea65[_0x3df8('0x41')],'predictiveIntervalErlangCallsDroppedCalls':_0x17ea65[_0x3df8('0x42')],'predictiveIntervalHitRate':_0x17ea65[_0x3df8('0x43')],'predictiveIntervalMultiplicativeFactor':_0x17ea65[_0x3df8('0x44')],'predictiveIntervalPauses':_0x17ea65['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x17ea65['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x17ea65[_0x3df8('0x45')],'message':_0x17ea65[_0x3df8('0x46')],'originated':_0x17ea65[_0x3df8('0x47')],'erlangCalls':_0x17ea65[_0x3df8('0x48')],'erlangCallToSecond':_0x17ea65[_0x3df8('0x49')],'erlangAbandonmentRate':_0x17ea65['erlangAbandonmentRate'],'erlangBusyFactor':_0x17ea65[_0x3df8('0x4a')],'startPredictive':_0x17ea65[_0x3df8('0x4b')],'startProgressive':_0x17ea65[_0x3df8('0x4c')]};if(_0x17ea65[_0x3df8('0x4d')]){_0x52d8b3['Trunk']={'id':_0x17ea65['Trunk']['id'],'name':_0x17ea65[_0x3df8('0x4d')][_0x3df8('0x22')],'active':_0x17ea65[_0x3df8('0x4d')]['active'],'callerid':_0x17ea65[_0x3df8('0x4d')]['callerid']};}if(_0x17ea65['Interval']){_0x52d8b3[_0x3df8('0x4e')]={'id':_0x17ea65[_0x3df8('0x4e')]['id'],'name':_0x17ea65[_0x3df8('0x4e')]['name']};}var _0x2ed241=md5(JSON[_0x3df8('0x4f')](_0x52d8b3));if(_0x17ea65['md5']!==_0x2ed241){_0x17ea65[_0x3df8('0x2')]=_0x2ed241;emit(util['format']('voice:queue:%s',_0x52d8b3[_0x3df8('0x22')]),_0x3df8('0x50'),_0x52d8b3);}}}function emitVoiceQueueChannelRemove(_0x139896){logger[_0x3df8('0x51')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x3df8('0x4f')](_0x139896));emit(util['format']('voice:queue:%s',_0x139896[_0x3df8('0x22')]),'voice_queue_channel:remove',_0x139896);io[_0x3df8('0x21')](_0x3df8('0x52'),_0x139896);}function notSendMessagesQueue(_0xa44cc0){if(_0xa44cc0[_0x3df8('0x53')]){if(_0xa44cc0['originated']===0x0&&_0xa44cc0[_0x3df8('0x26')]===0x0){_0xa44cc0[_0x3df8('0x53')]=![];_0xa44cc0[_0x3df8('0x54')]=0x0;_0xa44cc0[_0x3df8('0x55')]=0x0;_0xa44cc0['message']=_0x3df8('0x56');ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0xa44cc0[_0x3df8('0x22')]+'\x20is\x20not\x20active');}else{_0xa44cc0[_0x3df8('0x46')]=_0x3df8('0x57');ut[_0x3df8('0x58')](_0x3df8('0x59'),_0xa44cc0[_0x3df8('0x22')]+_0x3df8('0x5a'));}emitCampaignPreview(_0xa44cc0);}}Preview[_0x3df8('0x5b')][_0x3df8('0x1f')]=function(){var _0x5960b3=this;setInterval(function(){_0x5960b3[_0x3df8('0x5c')]();},0x7cf);};Preview[_0x3df8('0x5b')][_0x3df8('0x5c')]=function(){var _0x4af7da=this[_0x3df8('0x20')];this[_0x3df8('0x13')]+=0x1;for(var _0x30c61b in _0x4af7da){if(_0x4af7da[_0x3df8('0x5d')](_0x30c61b)&&(_0x4af7da[_0x30c61b][_0x3df8('0x30')]===_0x3df8('0x6')||_0x4af7da[_0x30c61b][_0x3df8('0x30')]==='booked')&&_0x4af7da[_0x30c61b][_0x3df8('0x2b')]===_0x3df8('0x5e')){if(this[_0x3df8('0x13')]>0x7){this[_0x3df8('0x13')]=0x0;this[_0x3df8('0x5f')]();}}if(_0x4af7da[_0x3df8('0x5d')](_0x30c61b)&&_0x4af7da[_0x30c61b]['dialMethod']===_0x3df8('0x6')&&_0x4af7da[_0x30c61b][_0x3df8('0x2b')]===_0x3df8('0x5e')){if(_0x4af7da[_0x30c61b][_0x3df8('0x2f')]){this['setMessage'](_0x4af7da[_0x30c61b]);this[_0x3df8('0x60')](_0x4af7da[_0x30c61b]);}else{notSendMessagesQueue(_0x4af7da[_0x30c61b]);}}}};Preview[_0x3df8('0x5b')][_0x3df8('0x61')]=function(_0x187a1b){var _0x19aad5=this;this[_0x3df8('0xe')][_0x3df8('0x62')](function(){if(!_[_0x3df8('0x63')](_0x19aad5[_0x3df8('0x11')][_0x187a1b])){loggerAction[_0x3df8('0x51')](_0x3df8('0x64'),_0x187a1b,_0x3df8('0x65'),_0x19aad5[_0x3df8('0x11')][_0x187a1b][_0x3df8('0x66')],_0x3df8('0x67'),JSON[_0x3df8('0x4f')](_0x19aad5[_0x3df8('0x20')][_0x19aad5[_0x3df8('0x11')][_0x187a1b]['queue']][_0x3df8('0x47')]),_0x3df8('0x68'),JSON['stringify'](_0x19aad5['campaignsPreview'][_0x19aad5[_0x3df8('0x11')][_0x187a1b][_0x3df8('0x66')]]['pTalking']),JSON[_0x3df8('0x4f')](_0x19aad5[_0x3df8('0x11')][_0x187a1b]['dialAnswer']),JSON['stringify'](_[_0x3df8('0x69')](_0x19aad5[_0x3df8('0x11')][_0x187a1b],[_0x3df8('0x6a'),'UserId','VoiceQueueId',_0x3df8('0x6b')])));return ami[_0x3df8('0x6c')]({'action':_0x3df8('0x6d'),'channel':_0x19aad5[_0x3df8('0x11')][_0x187a1b][_0x3df8('0x6e')]})[_0x3df8('0x6f')](function(_0x28f117){if(_0x28f117['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x19aad5[_0x3df8('0x11')][_0x187a1b]){ut['updateOriginated'](_0x19aad5[_0x3df8('0x20')][_0x19aad5[_0x3df8('0x11')][_0x187a1b][_0x3df8('0x66')]],_0x3df8('0x70'));if(_0x19aad5[_0x3df8('0x11')][_0x187a1b][_0x3df8('0x71')]===!![]){ut[_0x3df8('0x72')](_0x19aad5['campaignsPreview'][_0x19aad5[_0x3df8('0x11')][_0x187a1b][_0x3df8('0x66')]],'[clearZombieChannel]');ut['loggerError'](_0x3df8('0x73')+_0x187a1b,_0x19aad5[_0x3df8('0x11')][_0x187a1b][_0x3df8('0x66')]);}ut[_0x3df8('0x74')]('[Dialer][checkChannel][Preview]'+_0x187a1b,_0x19aad5['actions'][_0x187a1b][_0x3df8('0x66')]);delete _0x19aad5['actions'][_0x187a1b];}},0x2328);}});}});};Preview['prototype']['clearZombieChannels']=function(){var _0x315ffc=this;loggerAction[_0x3df8('0x51')]('[action]',_['size'](this['actions']));for(var _0x3af571 in this[_0x3df8('0x11')]){if(_0x315ffc[_0x3df8('0x11')][_0x3df8('0x5d')](_0x3af571)){_0x315ffc['clearZombieChannel'](_0x3af571);}}};Preview['prototype'][_0x3df8('0x60')]=function(_0x5ca768){var _0x297b91=this;rpcDb[_0x3df8('0x75')](_0x5ca768['id'],ut[_0x3df8('0x76')](this[_0x3df8('0x12')]))[_0x3df8('0x77')](function(_0x5dadac){if(!_['isNil'](_0x5dadac)){for(var _0x4a293d=0x0;_0x4a293d<_0x5dadac[_0x3df8('0x78')];_0x4a293d+=0x1){if(ut[_0x3df8('0x79')](_0x5dadac[_0x4a293d][_0x3df8('0x7a')])<_0x5ca768[_0x3df8('0x7b')]*0x3c){if(_0x5dadac[_0x4a293d]['Agent']&&!_0x5dadac[_0x4a293d]['Agent'][_0x3df8('0x7c')]){_0x297b91[_0x3df8('0x7d')](_0x5dadac[_0x4a293d]['id'])[_0x3df8('0x77')](ut[_0x3df8('0x7e')](_0x3df8('0x7f')))[_0x3df8('0x6f')](ut[_0x3df8('0x7e')](_0x3df8('0x7f')));}else{rpcDb[_0x3df8('0x80')](_0x5dadac[_0x4a293d]['id']);}}else{var _0x431309=new Action(_0x5dadac[_0x4a293d],_0x5ca768);_0x431309[_0x3df8('0x81')]=moment()[_0x3df8('0x82')](_0x3df8('0x83'));_0x5ca768[_0x3df8('0x39')]+=0x1;ut[_0x3df8('0x84')](_0x431309,0x17,_0x3df8('0x85'));if(_0x5ca768[_0x3df8('0x86')]){rpcDb[_0x3df8('0x87')](ut[_0x3df8('0x88')](_0x5dadac[_0x4a293d]));rpcDb['createCustomerHistory'](_0x431309,_0x3df8('0x89'));}else{ut['logCustomer'](_0x431309,0x16,'RecallFailedTimeout');rpcDb['createCustomerHistory'](_0x431309,_0x3df8('0x8a'));rpcDb[_0x3df8('0x8b')](_0x431309,_0x3df8('0x8a'));}}}}})['catch'](ut[_0x3df8('0x7e')]('[getContactRecallMe]'));};Preview['prototype'][_0x3df8('0x8c')]=function(_0xeed5af){_0xeed5af['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0xeed5af['loggedIn'])){_0xeed5af[_0x3df8('0x46')]=_0x3df8('0x8d');}else if(!ut[_0x3df8('0x8e')](_0xeed5af['dialActive'])){_0xeed5af[_0x3df8('0x46')]=_0x3df8('0x56');}else if(!this[_0x3df8('0x8f')](_0xeed5af[_0x3df8('0x4d')])){if(!this[_0x3df8('0x8f')](_0xeed5af[_0x3df8('0x90')])){_0xeed5af[_0x3df8('0x46')]=_0x3df8('0x91');}else{_0xeed5af['message']='ACTIVE';}}else{_0xeed5af[_0x3df8('0x46')]=_0x3df8('0x92');}emitCampaignPreview(_0xeed5af);};Preview[_0x3df8('0x5b')]['callProgressDetectingCustomer']=function(_0x3540a3,_0x3f5c6e,_0x8b015a){var _0x485093=this;var _0x3a96b6=this['actions'][_0x3f5c6e];var _0x411521=this[_0x3df8('0x20')][_0x3a96b6[_0x3df8('0x66')]];var _0x21e899;if(_0x411521){switch(_0x8b015a){case'1':_0x411521[_0x3df8('0x93')]+=0x1;_0x3a96b6['countnosuchnumberretry']+=0x1;_0x3a96b6['countglobal']=ut[_0x3df8('0x94')](_0x3a96b6);ut['logCustomer'](_0x3a96b6,0x0,_0x3df8('0x95'));ami[_0x3df8('0x21')](_0x3df8('0x96'),ut['buildObj'](_0x3a96b6,'nosuchnumber'));rpcDb[_0x3df8('0x97')](_0x3a96b6,_0x3df8('0x98'));if(ut[_0x3df8('0x94')](_0x3a96b6)>=_0x411521[_0x3df8('0x99')]){_0x21e899=ut[_0x3df8('0x9a')](_0x3a96b6,0xf,_0x3df8('0x9b'));rpcDb[_0x3df8('0x8b')](_0x21e899,_0x3df8('0x9c'));}else{if(_0x3a96b6[_0x3df8('0x9d')]>=_0x411521[_0x3df8('0x9e')]){rpcDb[_0x3df8('0x8b')](_0x3a96b6,_0x3df8('0x9c'));}else{rpcDb[_0x3df8('0x9f')](ut[_0x3df8('0xa0')](_0x3a96b6,_0x3df8('0x9d'),_0x411521[_0x3df8('0xa1')]),_0x3a96b6[_0x3df8('0xa2')],_0x3a96b6[_0x3df8('0xa3')]);}}delete this[_0x3df8('0x11')][_0x3540a3['linkedid']];break;case _0x3df8('0xa4'):var _0x4d7717=moment()['format'](_0x3df8('0x83'));_0x3a96b6[_0x3df8('0xa5')]=_0x4d7717;_0x3a96b6[_0x3df8('0xa6')]=_0x4d7717;_0x3a96b6[_0x3df8('0x71')]=!![];_0x411521['pTalking']+=0x1;logger[_0x3df8('0x51')]('[syncHangup][talking][increment]',_0x3a96b6[_0x3df8('0xa7')],_0x3df8('0xa8'),_0x411521[_0x3df8('0x22')],_0x3df8('0x68'),_0x411521[_0x3df8('0x26')]);ami[_0x3df8('0x21')](_0x3df8('0xa9'),ut[_0x3df8('0xaa')](_0x3a96b6,_0x3df8('0xab'),this[_0x3df8('0x20')][_0x3a96b6['queue']]));if(_0x411521['acw']){ami['emit'](_0x3df8('0xac'),ut['buildAcw'](_0x3a96b6));}break;case'16':ami[_0x3df8('0x21')](_0x3df8('0xad'),ut[_0x3df8('0xaa')](_0x3a96b6,_0x3df8('0xae'),this[_0x3df8('0x20')][_0x3a96b6[_0x3df8('0x66')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x3a96b6,_0x3df8('0xae')));_0x411521[_0x3df8('0x35')]+=0x1;_0x411521[_0x3df8('0x2a')]+=0x1;_0x411521[_0x3df8('0x24')]+=0x1;ut[_0x3df8('0x72')](_0x411521,_0x3df8('0xaf'));_0x3a96b6[_0x3df8('0xb0')]=ut['totalGlobal'](_0x3a96b6);ut[_0x3df8('0x84')](_0x3a96b6,0x4,_0x3df8('0xb1'));rpcDb['createCustomerHistory'](_0x3a96b6,_0x3df8('0xb2'));rpcDb['createCustomerFinal'](_0x3a96b6,_0x3df8('0xb3'));rpcDb[_0x3df8('0xb4')](_0x3a96b6);_0x411521[_0x3df8('0xb5')]+=_0x3a96b6[_0x3df8('0xb6')];_0x411521[_0x3df8('0x27')]+=_0x3a96b6[_0x3df8('0xb6')];logger[_0x3df8('0x51')](_0x3df8('0xb7'),_0x3a96b6['uniqueid'],_0x3df8('0xa8'),_0x411521[_0x3df8('0x22')],_0x3df8('0x68'),_0x411521[_0x3df8('0x26')]);delete this[_0x3df8('0x11')][_0x3540a3[_0x3df8('0xb8')]];break;case _0x3df8('0xb9'):_0x411521[_0x3df8('0xba')]+=0x1;_0x3a96b6[_0x3df8('0xbb')]+=0x1;_0x3a96b6[_0x3df8('0xb0')]=ut['totalGlobal'](_0x3a96b6);ut[_0x3df8('0x84')](_0x3a96b6,0x5,'Busy');ami['emit'](_0x3df8('0xbc'),ut[_0x3df8('0xaa')](_0x3a96b6,_0x3df8('0xbd')));rpcDb[_0x3df8('0x97')](_0x3a96b6,_0x3df8('0xbe'));if(ut['totalGlobal'](_0x3a96b6)>=_0x411521[_0x3df8('0x99')]){_0x21e899=ut[_0x3df8('0x9a')](_0x3a96b6,0xf,_0x3df8('0x9b'));rpcDb[_0x3df8('0x8b')](_0x21e899,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x3a96b6['countbusyretry']>=_0x411521[_0x3df8('0xbf')]){rpcDb[_0x3df8('0x8b')](_0x3a96b6,_0x3df8('0xbe'));}else{rpcDb[_0x3df8('0x9f')](ut[_0x3df8('0xa0')](_0x3a96b6,_0x3df8('0xbb'),_0x411521['dialBusyRetryFrequency']),_0x3a96b6[_0x3df8('0xa2')],_0x3a96b6[_0x3df8('0xa3')]);}}break;case _0x3df8('0xc0'):_0x411521[_0x3df8('0x38')]+=0x1;_0x3a96b6[_0x3df8('0xc1')]+=0x1;_0x3a96b6[_0x3df8('0xb0')]=ut[_0x3df8('0x94')](_0x3a96b6);ut[_0x3df8('0x84')](_0x3a96b6,0x3,_0x3df8('0xc2'));ami[_0x3df8('0x21')](_0x3df8('0xc3'),ut['buildObj'](_0x3a96b6,_0x3df8('0xc4')));rpcDb[_0x3df8('0x97')](_0x3a96b6,_0x3df8('0xc5'));if(ut[_0x3df8('0x94')](_0x3a96b6)>=_0x411521[_0x3df8('0x99')]){_0x21e899=ut['cloneAction'](_0x3a96b6,0xf,_0x3df8('0x9b'));rpcDb[_0x3df8('0x8b')](_0x21e899,_0x3df8('0xc6'));}else{if(_0x3a96b6[_0x3df8('0xc1')]>=_0x411521[_0x3df8('0xc7')]){rpcDb[_0x3df8('0x8b')](_0x3a96b6,_0x3df8('0xc5'));}else{rpcDb[_0x3df8('0x9f')](ut[_0x3df8('0xa0')](_0x3a96b6,_0x3df8('0xc1'),_0x411521[_0x3df8('0xc8')]),_0x3a96b6[_0x3df8('0xa2')],_0x3a96b6['activeContact']);}}break;case _0x3df8('0xc9'):_0x411521['outboundCongestionCallsDay']+=0x1;_0x3a96b6[_0x3df8('0xca')]+=0x1;_0x3a96b6[_0x3df8('0xb0')]=ut['totalGlobal'](_0x3a96b6);ut['logCustomer'](_0x3a96b6,0x8,_0x3df8('0xcb'));ami[_0x3df8('0x21')](_0x3df8('0xcc'),ut[_0x3df8('0xaa')](_0x3a96b6,_0x3df8('0xcd')));rpcDb[_0x3df8('0x97')](_0x3a96b6,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0x3df8('0x94')](_0x3a96b6)>=_0x411521[_0x3df8('0x99')]){_0x21e899=ut[_0x3df8('0x9a')](_0x3a96b6,0xf,'Global');rpcDb[_0x3df8('0x8b')](_0x21e899,_0x3df8('0xce'));}else{if(_0x3a96b6[_0x3df8('0xca')]>=_0x411521[_0x3df8('0xcf')]){rpcDb['createCustomerFinal'](_0x3a96b6,_0x3df8('0xd0'));}else{rpcDb[_0x3df8('0x9f')](ut[_0x3df8('0xa0')](_0x3a96b6,_0x3df8('0xca'),_0x411521['dialBusyRetryFrequency']),_0x3a96b6[_0x3df8('0xa2')],_0x3a96b6[_0x3df8('0xa3')]);}}break;case'CANCEL':_0x411521[_0x3df8('0x3a')]+=0x1;_0x3a96b6[_0x3df8('0xd1')]+=0x1;_0x3a96b6['countglobal']=ut[_0x3df8('0x94')](_0x3a96b6);ut[_0x3df8('0x84')](_0x3a96b6,0x14,_0x3df8('0xd2'));ami['emit'](_0x3df8('0xd3'),ut[_0x3df8('0xaa')](_0x3a96b6,_0x3df8('0xd4')));rpcDb['createCustomerHistory'](_0x3a96b6,'[syncHangupRequest][logAgentReject]');if(ut[_0x3df8('0x94')](_0x3a96b6)>=_0x411521[_0x3df8('0x99')]){_0x21e899=ut['cloneAction'](_0x3a96b6,0x14,_0x3df8('0xd2'));rpcDb['createCustomerFinal'](_0x21e899,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x3a96b6[_0x3df8('0xd1')]>=_0x411521[_0x3df8('0xd5')]){rpcDb[_0x3df8('0x8b')](_0x3a96b6,_0x3df8('0xd6'));}else{rpcDb[_0x3df8('0x9f')](ut[_0x3df8('0xa0')](_0x3a96b6,_0x3df8('0xd1'),_0x411521[_0x3df8('0xd7')]),_0x3a96b6[_0x3df8('0xa2')],_0x3a96b6[_0x3df8('0xa3')]);}}break;case'ABANDONED':_0x411521['outboundAbandonedCallsDay']+=0x1;_0x3a96b6[_0x3df8('0xd8')]+=0x1;_0x3a96b6[_0x3df8('0xb0')]=ut[_0x3df8('0x94')](_0x3a96b6);ut['logCustomer'](_0x3a96b6,0xb,_0x3df8('0xd9'));rpcDb[_0x3df8('0x97')](_0x3a96b6,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x3df8('0x94')](_0x3a96b6)>=_0x411521[_0x3df8('0x99')]){_0x21e899=ut[_0x3df8('0x9a')](_0x3a96b6,0xf,_0x3df8('0x9b'));rpcDb[_0x3df8('0x8b')](_0x21e899,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x3a96b6['countabandonedetry']>=_0x411521[_0x3df8('0xda')]){rpcDb[_0x3df8('0x8b')](_0x3a96b6,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x3df8('0x9f')](ut['scheduledAt'](_0x3a96b6,_0x3df8('0xd8'),_0x411521[_0x3df8('0xdb')]),_0x3a96b6['unlockAgent'],_0x3a96b6[_0x3df8('0xa3')]);}}break;case'18':_0x411521[_0x3df8('0x3b')]+=0x1;_0x3a96b6[_0x3df8('0xdc')]+=0x1;_0x3a96b6[_0x3df8('0xb0')]=ut[_0x3df8('0x94')](_0x3a96b6);ut['logCustomer'](_0x3a96b6,0x12,_0x3540a3['cause-txt']||_0x3540a3['dialstatus']);ami[_0x3df8('0x21')]('custom:amd',ut['buildObj'](_0x3a96b6,_0x3df8('0xdd')));rpcDb[_0x3df8('0x97')](_0x3a96b6,_0x3df8('0xde'));if(ut['totalGlobal'](_0x3a96b6)>=_0x411521[_0x3df8('0x99')]){_0x21e899=ut[_0x3df8('0x9a')](_0x3a96b6,0xf,'Global');rpcDb[_0x3df8('0x8b')](_0x21e899,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x3df8('0x8b')](_0x3a96b6,_0x3df8('0xde'));}delete this[_0x3df8('0x11')][_0x3540a3[_0x3df8('0xb8')]];break;case'19':_0x411521[_0x3df8('0x3b')]+=0x1;_0x3a96b6[_0x3df8('0xb0')]=ut['totalGlobal'](_0x3a96b6);ut[_0x3df8('0x84')](_0x3a96b6,0x13,_0x3540a3[_0x3df8('0xdf')]||_0x3540a3[_0x3df8('0xe0')]);ami['emit'](_0x3df8('0xe1'),ut[_0x3df8('0xaa')](_0x3a96b6,'amd'));rpcDb[_0x3df8('0x97')](_0x3a96b6,'[callProgressDetectingCustomer][machine]');if(ut[_0x3df8('0x94')](_0x3a96b6)>=_0x411521['dialGlobalMaxRetry']){_0x21e899=ut[_0x3df8('0x9a')](_0x3a96b6,0xf,_0x3df8('0x9b'));rpcDb[_0x3df8('0x8b')](_0x21e899,_0x3df8('0xe2'));}else{rpcDb[_0x3df8('0x8b')](_0x3a96b6,_0x3df8('0xe2'));}delete this[_0x3df8('0x11')][_0x3540a3['linkedid']];break;default:if(_0x3a96b6[_0x3df8('0x71')]){ut[_0x3df8('0x72')](_0x411521,_0x3df8('0xe3'));ut[_0x3df8('0x74')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x411521['name'],_0x3540a3);}_0x411521['outboundUnknownCallsDay']+=0x1;_0x3a96b6['countglobal']=ut[_0x3df8('0x94')](_0x3a96b6);ut[_0x3df8('0x84')](_0x3a96b6,0xc,_0x3540a3[_0x3df8('0xdf')]||_0x3540a3['dialstatus']);rpcDb[_0x3df8('0x97')](_0x3a96b6,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x3df8('0x94')](_0x3a96b6)>=_0x411521['dialGlobalMaxRetry']){_0x21e899=ut[_0x3df8('0x9a')](_0x3a96b6,0xf,_0x3df8('0x9b'));rpcDb[_0x3df8('0x8b')](_0x21e899,_0x3df8('0xe4'));}else{rpcDb['createCustomerFinal'](_0x3a96b6,_0x3df8('0xe4'));}delete this['actions'][_0x3540a3['linkedid']];}if(!(_0x3a96b6[_0x3df8('0x71')]&&_0x8b015a==='16')){ut['updateOriginated'](_0x411521,_0x3df8('0xe5'));logger[_0x3df8('0x51')](_0x3df8('0xe6'),_0x3a96b6[_0x3df8('0xa7')],_0x3df8('0xa8'),_0x411521[_0x3df8('0x22')],_0x3df8('0x67'),_0x411521[_0x3df8('0x47')]);}if(_0x8b015a!==_0x3df8('0xa4')){delete this[_0x3df8('0x11')][_0x3540a3['linkedid']];delete this[_0x3df8('0x11')][_0x3540a3[_0x3df8('0xe7')]];}}};Preview['prototype']['callProgressDetectingAgent']=function(_0x118d9,_0x151fe3,_0x5e96bb){if(_[_0x3df8('0xe8')](_0x151fe3)&&_0x3df8('0xe9')!==typeof _0x151fe3){return;}if(_[_0x3df8('0xe8')](_0x5e96bb)&&_0x3df8('0xe9')!==typeof _0x5e96bb){return;}switch(_0x5e96bb['reason']){case'0':ut[_0x3df8('0xea')](_0x118d9,0x0,_0x3df8('0x95'));rpcDb[_0x3df8('0xeb')](_0x118d9,_0x3df8('0xec'));break;case'3':ut[_0x3df8('0xea')](_0x118d9,0x3,_0x3df8('0xc2'));rpcDb['createAgentHistory'](_0x118d9,_0x3df8('0xed'));break;case'5':ut[_0x3df8('0xea')](_0x118d9,0x5,_0x3df8('0xee'));rpcDb['createAgentHistory'](_0x118d9,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x3df8('0xea')](_0x118d9,0x8,_0x3df8('0xcb'));rpcDb[_0x3df8('0xeb')](_0x118d9,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x3df8('0xea')](_0x118d9,0x16,_0x3df8('0xef'));rpcDb[_0x3df8('0xeb')](_0x118d9,_0x3df8('0xf0'));break;default:ut[_0x3df8('0xea')](_0x118d9,0xc,_0x5e96bb[_0x3df8('0xf1')]);rpcDb['createAgentHistory'](_0x118d9,_0x3df8('0xf2'));}ut[_0x3df8('0xf3')](_0x151fe3,_0x3df8('0xf4'));logger[_0x3df8('0x51')]('[originated][decrement][callProgressDetectingAgent]',_0x118d9[_0x3df8('0xa7')],'\x20Queue',_0x151fe3[_0x3df8('0x22')],_0x3df8('0x67'),_0x151fe3[_0x3df8('0x47')]);delete this[_0x3df8('0x11')][_0x118d9['uniqueid']];};Preview['prototype'][_0x3df8('0xf5')]=function(_0x90ab5b,_0x288f77,_0x5b2092,_0x3fe976,_0x5a7d45){var _0x54bbde=this;return new BPromise(function(_0x4fcd48,_0x1ae866){if(_[_0x3df8('0x63')](_0x288f77)||_[_0x3df8('0x63')](_0x288f77[_0x3df8('0xf6')])||_['isNil'](_0x288f77[_0x3df8('0xf6')][_0x3df8('0xf7')])||_[_0x3df8('0x63')](_0x288f77[_0x3df8('0xf8')])){_0x1ae866(ut['message'](_0x3df8('0xf9'),_0x3fe976,_0x5a7d45));return;}var _0x1e8d09=uuid['v4']();var _0x35b5e0=_0x54bbde[_0x3df8('0x20')][_0x288f77['Queue'][_0x3df8('0x22')]];var _0x1c051b=_0x5b2092?_0x54bbde['agents'][_0x5b2092]['id']:undefined;_0x54bbde[_0x3df8('0x11')][_0x1e8d09]=new Action(_0x288f77,_0x35b5e0,_0x1e8d09,_0x5b2092,_0x1c051b);var _0x4e1ac6=_0x54bbde[_0x3df8('0x11')][_0x1e8d09];_0x4e1ac6[_0x3df8('0xa2')]=_0x3fe976;_0x4e1ac6[_0x3df8('0xa3')]=_0x5a7d45;_0x4e1ac6['lookAgent']=_0x5b2092;if(_[_0x3df8('0xfa')](_0x90ab5b)){_0x54bbde[_0x3df8('0xfb')](_0x4e1ac6,_0x35b5e0,_0x288f77,_0x5b2092)[_0x3df8('0x77')](function(_0x143a12){logger[_0x3df8('0x51')](_0x3df8('0xfc'),'Queue:\x20'+_0x4e1ac6[_0x3df8('0x66')]+_0x3df8('0xfd')+_0x4e1ac6['idContact'],JSON[_0x3df8('0x4f')](_0x143a12));ami[_0x3df8('0x21')](_0x3df8('0xfe'),ut[_0x3df8('0xaa')](_0x4e1ac6,_0x3df8('0xff'),_0x54bbde[_0x3df8('0x20')][_0x4e1ac6[_0x3df8('0x66')]]));_0x4fcd48(ut['message'](_0x3df8('0x100')));})[_0x3df8('0x6f')](function(_0x219737){ut[_0x3df8('0x58')]('[Preview][execCall][failure]',_0x219737);_0x1ae866(ut[_0x3df8('0x46')](_0x3df8('0x101'),_0x3fe976,_0x5a7d45));});}else{_0x35b5e0['outboundBlacklistCallsDay']+=0x1;ut['logBlacklist'](_0x4e1ac6);rpcDb[_0x3df8('0x102')](_0x4e1ac6,_0x3df8('0x103'));delete _0x54bbde[_0x3df8('0x11')][_0x1e8d09];_0x1ae866(ut[_0x3df8('0x46')](_0x3df8('0x104'),_0x3fe976,_0x5a7d45));}});};Preview[_0x3df8('0x5b')][_0x3df8('0x8f')]=function(_0x2ce425){return!_[_0x3df8('0x63')](_0x2ce425)&&!_[_0x3df8('0x63')](_0x2ce425[_0x3df8('0x22')])&&!_['isNil'](_0x2ce425['active'])&&_0x2ce425[_0x3df8('0x105')]&&!_[_0x3df8('0x63')](this[_0x3df8('0x10')][util['format'](_0x3df8('0x106'),_0x2ce425[_0x3df8('0x22')])])&&!_[_0x3df8('0x63')](this[_0x3df8('0x10')][util[_0x3df8('0x82')](_0x3df8('0x106'),_0x2ce425[_0x3df8('0x22')])][_0x3df8('0x6d')])&&(this[_0x3df8('0x10')][util['format'](_0x3df8('0x106'),_0x2ce425[_0x3df8('0x22')])][_0x3df8('0x6d')]===_0x3df8('0x107')||this[_0x3df8('0x10')][util['format']('SIP/%s',_0x2ce425[_0x3df8('0x22')])][_0x3df8('0x6d')]===_0x3df8('0x108'));};Preview[_0x3df8('0x5b')][_0x3df8('0x7d')]=function(_0xc51796,_0x46f1fd){var _0x46cdd4=this;return new BPromise(function(_0x367b54,_0x411364){_0x46cdd4[_0x3df8('0x109')](_0xc51796,_0x46f1fd)['then'](function(_0x4c4149){_0x367b54(_['pick'](_0x4c4149,[_0x3df8('0x46')]));})['catch'](function(_0x579a47){if(_0x579a47['unlock']){rpcDb[_0x3df8('0x10a')](_0xc51796);}if(_0x579a47['active']){rpcDb['disableContact'](_0xc51796);}_0x411364(_[_0x3df8('0x69')](_0x579a47,[_0x3df8('0x46')]));});});};Preview['prototype'][_0x3df8('0x109')]=function(_0x42a49f,_0x1a8fb1){var _0x4bcc96=this;return new BPromise(function(_0xd6e9b7,_0x3fe4e8){var _0x564704,_0xe7f4c0;rpcDb[_0x3df8('0x10b')](_0x42a49f)[_0x3df8('0x77')](function(_0xf82887){if(!_[_0x3df8('0x63')](_0xf82887[0x0])){_0xe7f4c0=_0xf82887[0x0][_0x3df8('0x10c')]?![]:!![];_0x564704=_0xf82887[0x0][_0x3df8('0x10c')]?!![]:![];_0x564704=_0x1a8fb1?!![]:_0x564704;}var _0x3a13c0=_0x4bcc96[_0x3df8('0x10d')](_0xf82887);if(_0x3a13c0[_0x3df8('0x10e')]){rpcDb[_0x3df8('0x10f')](_[_0x3df8('0x69')](_0xf82887[0x0],[_0x3df8('0xf8'),'Contact.phone']))[_0x3df8('0x77')](function(_0x5eb74a){_0x4bcc96[_0x3df8('0xf5')](_0x5eb74a,_0xf82887[0x0],_0x1a8fb1,_0xe7f4c0,_0x564704)[_0x3df8('0x77')](function(_0x17c5d0){_0xd6e9b7(_0x17c5d0);})[_0x3df8('0x6f')](function(_0x496fe1){_0x3fe4e8(_0x496fe1);});})[_0x3df8('0x6f')](function(_0x5cfd41){ut[_0x3df8('0x58')](_0x3df8('0x110'),_0x5cfd41);_0x3fe4e8(ut[_0x3df8('0x46')]('Call\x20unsuccessful',_0xe7f4c0,_0x564704));});}else{_0x3fe4e8(ut[_0x3df8('0x46')](_0x3a13c0[_0x3df8('0x46')],_0xe7f4c0,_0x564704));}})[_0x3df8('0x6f')](function(_0x14ae28){ut[_0x3df8('0x58')](_0x3df8('0x111'),_0x14ae28);_0x3fe4e8(ut[_0x3df8('0x46')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x3df8('0x5b')][_0x3df8('0x10d')]=function(_0x5758a8){if(_[_0x3df8('0x63')](_0x5758a8)||_[_0x3df8('0xfa')](_0x5758a8)||!_[_0x3df8('0x63')](_0x5758a8[0x0][_0x3df8('0x112')])&&_[_0x3df8('0x63')](_0x5758a8[0x0][_0x3df8('0x112')]['name'])){ut[_0x3df8('0x58')](_0x3df8('0x113'),_0x5758a8);return{'isValid':![],'message':_0x3df8('0x114')};}var _0x4d200e=this[_0x3df8('0x20')][_0x5758a8[0x0][_0x3df8('0x65')][_0x3df8('0x22')]];_0x4d200e[_0x3df8('0x46')]=_0x3df8('0x92');if(_['isNil'](_0x4d200e)){ut[_0x3df8('0x58')](_0x3df8('0x115'),_0x4d200e);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this['isTrunkReachable'](_0x4d200e['Trunk'])){ut['logger'](_0x3df8('0x116'),_0x3df8('0x117')+_0x4d200e[_0x3df8('0x22')]+_0x3df8('0x118'));if(!this[_0x3df8('0x8f')](_0x4d200e[_0x3df8('0x90')])){ut[_0x3df8('0x58')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x4d200e[_0x3df8('0x22')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x3df8('0x119')};}}if(!ut[_0x3df8('0x8e')](_0x4d200e[_0x3df8('0x2f')])){ut[_0x3df8('0x58')](_0x3df8('0x11a'),_0x4d200e[_0x3df8('0x22')]+_0x3df8('0x11b'));return{'isValid':![],'message':_0x3df8('0x117')+_0x4d200e[_0x3df8('0x22')]+_0x3df8('0x11b')};}return{'isValid':!![],'message':_0x3df8('0x11c')};};Preview['prototype'][_0x3df8('0xfb')]=function(_0x4d5ef5,_0x291ef1,_0x4bba84,_0x5bfeba){var _0x575ed0=this;return new BPromise(function(_0x31a453,_0x349186){var _0x2cc21e=_0x4d5ef5[_0x3df8('0xa7')];var _0x25fda7=_0x575ed0[_0x3df8('0x8f')](_0x291ef1[_0x3df8('0x4d')])?util[_0x3df8('0x82')](_0x3df8('0x11d'),_0x291ef1[_0x3df8('0x4d')]['name'],_[_0x3df8('0x63')](_0x291ef1[_0x3df8('0x33')])?'':_0x291ef1[_0x3df8('0x33')]['trim']()||'',_0x291ef1[_0x3df8('0x11e')]>0x0?_0x4bba84['Contact']['phone'][_0x3df8('0x11f')](_0x291ef1[_0x3df8('0x11e')]):_0x4bba84['Contact'][_0x3df8('0xf7')]):util[_0x3df8('0x82')](_0x3df8('0x11d'),_[_0x3df8('0x63')](_0x291ef1[_0x3df8('0x90')])?_0x291ef1[_0x3df8('0x4d')][_0x3df8('0x22')]:_0x291ef1[_0x3df8('0x90')][_0x3df8('0x22')],_['isNil'](_0x291ef1[_0x3df8('0x33')])?'':_0x291ef1['dialPrefix']['trim']()||'',_0x291ef1[_0x3df8('0x11e')]>0x0?_0x4bba84[_0x3df8('0xf6')][_0x3df8('0xf7')][_0x3df8('0x11f')](_0x291ef1[_0x3df8('0x11e')]):_0x4bba84[_0x3df8('0xf6')][_0x3df8('0xf7')]);var _0x21084d=_0x575ed0[_0x3df8('0x8f')](_0x291ef1[_0x3df8('0x4d')])?ut['getCallerId'](_0x291ef1[_0x3df8('0x4d')][_0x3df8('0x120')],_0x291ef1[_0x3df8('0x31')],_0x291ef1[_0x3df8('0x121')]>0x0?ut[_0x3df8('0x122')](_0x291ef1[_0x3df8('0x123')],_0x291ef1['dialRandomLastDigitCallerIdNumber']):_0x291ef1[_0x3df8('0x123')]):ut[_0x3df8('0x124')](_['isNil'](_0x291ef1['TrunkBackup'])?_0x291ef1[_0x3df8('0x4d')][_0x3df8('0x120')]:_0x291ef1[_0x3df8('0x90')][_0x3df8('0x120')],_0x291ef1[_0x3df8('0x31')],_0x291ef1[_0x3df8('0x121')]>0x0?ut[_0x3df8('0x122')](_0x291ef1[_0x3df8('0x123')],_0x291ef1[_0x3df8('0x121')]):_0x291ef1[_0x3df8('0x123')]);if(_0x21084d){_0x4d5ef5[_0x3df8('0x125')]=ut[_0x3df8('0x126')](_0x21084d);_0x4d5ef5[_0x3df8('0x127')]=ut[_0x3df8('0x128')](_0x21084d);}var _0x317e85=ut[_0x3df8('0x129')](_0x291ef1,_0x4bba84,_0x25fda7,_0x21084d,_0x2cc21e,_0x4d5ef5);_[_0x3df8('0x12a')](_0x4d5ef5,ut[_0x3df8('0x12b')](_0x317e85));_0x4d5ef5[_0x3df8('0x81')]=moment()['format'](_0x3df8('0x83'));ami[_0x3df8('0x6c')](ut[_0x3df8('0x12c')](_0x4d5ef5,_0x291ef1,_0x317e85,_0x4d5ef5['activeContact'],_0x5bfeba))[_0x3df8('0x77')](function(_0x4b8a50){var _0x540c41=_0x4d5ef5[_0x3df8('0x12d')];if(!_[_0x3df8('0x63')](_0x540c41)){if(!_[_0x3df8('0x63')](_0x575ed0[_0x3df8('0x12')][_0x540c41])){_0x575ed0[_0x3df8('0x12')][_0x540c41]['destconnectedlinenum']=_0x4d5ef5[_0x3df8('0x12e')];emit(util[_0x3df8('0x82')](_0x3df8('0x12f'),_0x575ed0['agents'][_0x540c41][_0x3df8('0x22')]),_0x3df8('0x130'),{'destaccountcode':_0x575ed0[_0x3df8('0x12')][_0x540c41][_0x3df8('0x131')],'destconnectedlinenum':_0x4d5ef5['calleridnum']});}}_0x291ef1[_0x3df8('0x47')]+=0x1;logger[_0x3df8('0x51')](_0x3df8('0x132'),_0x2cc21e,_0x3df8('0xa8'),_0x291ef1[_0x3df8('0x22')],'originated:\x20',_0x291ef1[_0x3df8('0x47')]);_0x31a453(_0x4b8a50);})[_0x3df8('0x6f')](function(_0x11cfe6){ut[_0x3df8('0xea')](_0x4d5ef5,0xe,'OriginateError');rpcDb[_0x3df8('0xeb')](_0x4d5ef5,_0x3df8('0x133'));_0x349186(_0x11cfe6);});});};Preview['prototype']['syncNewExten']=function(_0xdac658){if(this[_0x3df8('0x11')][_0xdac658[_0x3df8('0xb8')]]){this['actions'][_0xdac658[_0x3df8('0xb8')]][_0x3df8('0x6e')]=_0xdac658['channel'];}};Preview['prototype']['syncOriginateResponse']=function(_0x5b13ab){var _0x13c9ce=this;var _0x31158b=this[_0x3df8('0x11')][_0x5b13ab[_0x3df8('0x134')]];if(_0x31158b){if(_0x31158b['lookAgent']&&this[_0x3df8('0x12')][_0x31158b['lookAgent']]){ut['logLookAgent'](_0x31158b,this[_0x3df8('0x12')][_0x31158b[_0x3df8('0x135')]][_0x3df8('0x22')],this[_0x3df8('0x12')][_0x31158b[_0x3df8('0x135')]]['id']);}var _0x62d1dd=_[_0x3df8('0x136')](_0x31158b);_0x62d1dd[_0x3df8('0xa5')]=moment()[_0x3df8('0x82')](_0x3df8('0x83'));var _0x357797=_0x13c9ce[_0x3df8('0x20')][_0x31158b[_0x3df8('0x66')]];if(ut['isFailure'](_0x5b13ab[_0x3df8('0x137')])){if(_0x31158b[_0x3df8('0xa2')]){rpcDb[_0x3df8('0x10a')](_0x31158b['idContact']);}if(_0x31158b[_0x3df8('0xa3')]){rpcDb[_0x3df8('0x80')](_0x31158b[_0x3df8('0x138')]);}ami[_0x3df8('0x21')](_0x3df8('0x139'),ut[_0x3df8('0xaa')](_0x31158b,_0x3df8('0x13a'),this[_0x3df8('0x20')][_0x31158b[_0x3df8('0x66')]]));this[_0x3df8('0x13b')](_0x62d1dd,_0x357797,_0x5b13ab);}else{_0x31158b[_0x3df8('0x81')]=moment()[_0x3df8('0x82')](_0x3df8('0x83'));ut[_0x3df8('0xea')](_0x62d1dd,0x4,_0x3df8('0xb1'));rpcDb['createAgentHistory'](_0x62d1dd,_0x3df8('0x13c'));}}};Preview[_0x3df8('0x5b')][_0x3df8('0x13d')]=function(_0x3605be){var _0x31d1e9=this;var _0x145c16=this['actions'][_0x3605be[_0x3df8('0xb8')]];var _0x1e5eca;if(_0x145c16){_0x1e5eca=this['campaignsPreview'][_0x145c16[_0x3df8('0x66')]];logger[_0x3df8('0x51')](_0x3df8('0x13e'),_0x3605be[_0x3df8('0xb8')],_0x3df8('0xa8'),_0x1e5eca[_0x3df8('0x22')],_0x3df8('0x68'),_0x1e5eca[_0x3df8('0x26')]);}if(this[_0x3df8('0x11')][_0x3605be['linkedid']]&&_0x3605be[_0x3df8('0xb8')]!==_0x3605be[_0x3df8('0xa7')]){if(_0x3605be[_0x3df8('0x13f')]==='16'&&this[_0x3df8('0x11')][_0x3605be[_0x3df8('0xb8')]]['dialAnswer']){this[_0x3df8('0x140')](_0x3605be,_0x3605be[_0x3df8('0xb8')],_0x3605be[_0x3df8('0x13f')]);}else if(this['actions'][_0x3605be[_0x3df8('0xb8')]][_0x3df8('0x71')]){logger[_0x3df8('0x51')](_0x3df8('0x141'),_0x3605be[_0x3df8('0xb8')],_0x3605be[_0x3df8('0x13f')],_0x3df8('0xa8'),_0x1e5eca[_0x3df8('0x22')],'pTalking:\x20',_0x1e5eca['pTalking']);this[_0x3df8('0x140')](_0x3605be,_0x3605be['linkedid'],_0x3605be[_0x3df8('0x13f')]);}}else if(_0x145c16&&_[_0x3df8('0x63')](_0x145c16[_0x3df8('0x142')])&&_0x1e5eca[_0x3df8('0x143')]&&_0x3605be[_0x3df8('0xb8')]===_0x3605be['uniqueid']&&_[_0x3df8('0x63')](_0x3605be[_0x3df8('0xf1')])&&_0x3605be['cause']==='16'&&_0x3605be['channelstate']==='6'&&_[_0x3df8('0xe8')](_0x145c16['transfer'])){if(_0x145c16[_0x3df8('0xa2')]){rpcDb[_0x3df8('0x10a')](_0x145c16[_0x3df8('0x138')]);}if(_0x145c16[_0x3df8('0xa3')]){rpcDb[_0x3df8('0x80')](_0x145c16[_0x3df8('0x138')]);}_0x3605be[_0x3df8('0xf1')]='22';this[_0x3df8('0x13b')](_0x145c16,_0x1e5eca,_0x3605be);}else if(_0x145c16&&_0x145c16[_0x3df8('0x144')]){if(_0x3605be[_0x3df8('0x13f')]==='16'&&this[_0x3df8('0x11')][_0x3605be[_0x3df8('0xb8')]]['dialAnswer']){logger['info'](_0x3df8('0x145'),_0x3605be[_0x3df8('0xb8')],_0x3605be[_0x3df8('0x13f')],_0x3df8('0xa8'),_0x1e5eca[_0x3df8('0x22')],_0x3df8('0x68'),_0x1e5eca[_0x3df8('0x26')]);this[_0x3df8('0x140')](_0x3605be,_0x3605be[_0x3df8('0xb8')],_0x3605be['cause']);}else if(this['actions'][_0x3605be[_0x3df8('0xb8')]][_0x3df8('0x71')]){logger['info'](_0x3df8('0x141'),_0x3605be[_0x3df8('0xb8')],_0x3605be['cause'],'\x20Queue',_0x1e5eca['name'],_0x3df8('0x68'),_0x1e5eca[_0x3df8('0x26')]);this[_0x3df8('0x140')](_0x3605be,_0x3605be[_0x3df8('0xb8')],_0x3605be['cause']);}}};Preview[_0x3df8('0x5b')]['syncDialEnd']=function(_0x2fdd64){if(this[_0x3df8('0x11')][_0x2fdd64[_0x3df8('0xe7')]]&&_0x2fdd64[_0x3df8('0xe7')]!==_0x2fdd64[_0x3df8('0x146')]){this[_0x3df8('0x140')](_0x2fdd64,_0x2fdd64[_0x3df8('0xe7')],_0x2fdd64['dialstatus']);}};Preview[_0x3df8('0x5b')][_0x3df8('0x17')]=function(_0x2d7090){if(this[_0x3df8('0x11')][_0x2d7090[_0x3df8('0xb8')]]&&_0x2d7090[_0x3df8('0xb8')]!==_0x2d7090[_0x3df8('0xa7')]&&!this[_0x3df8('0x11')][_0x2d7090[_0x3df8('0xb8')]][_0x3df8('0x71')]){if(_0x2d7090[_0x3df8('0x13f')]==='1'){this[_0x3df8('0x140')](_0x2d7090,_0x2d7090[_0x3df8('0xb8')],_0x2d7090[_0x3df8('0x13f')]);}}};Preview[_0x3df8('0x5b')][_0x3df8('0x147')]=function(_0x29ee02,_0x83bdd7,_0x40dc67){if(this[_0x3df8('0x11')][_0x29ee02]){if(_[_0x3df8('0x63')](this[_0x3df8('0x11')][_0x29ee02][_0x3df8('0x148')])){this[_0x3df8('0x11')][_0x29ee02][_0x3df8('0x148')]={};}this['actions'][_0x29ee02][_0x3df8('0x148')][_0x83bdd7]=_0x40dc67;}};Preview[_0x3df8('0x5b')]['syncVarSet']=function(_0x5ece10){try{if(!_[_0x3df8('0x63')](_0x5ece10)){if(ut[_0x3df8('0x149')](_['keys'](_0x5ece10[_0x3df8('0x14a')])[0x0])){this['addVariable'](_0x5ece10[_0x3df8('0xa7')],_[_0x3df8('0x14b')](_0x5ece10['variable'])[0x0],_0x5ece10[_0x3df8('0x14c')]);}}}catch(_0x39fde2){logger['error'](_0x3df8('0x14d'),util[_0x3df8('0x14e')](_0x39fde2,{'showHidden':![],'depth':null}));}};Preview[_0x3df8('0x5b')][_0x3df8('0x1e')]=function(_0x23b746){if(_0x23b746){if(this[_0x3df8('0x11')][_0x23b746['transfertargetlinkedid']]){this[_0x3df8('0x11')][_0x23b746[_0x3df8('0x14f')]]['transfer']=!![];}}};Preview[_0x3df8('0x5b')][_0x3df8('0x150')]=function(_0xdd3da6){if(_0xdd3da6){if(this[_0x3df8('0x11')][_0xdd3da6[_0x3df8('0x151')]]){this[_0x3df8('0x11')][_0xdd3da6['transfererlinkedid']][_0x3df8('0x144')]=!![];}}};module[_0x3df8('0x152')]=Preview; \ No newline at end of file +var _0xabdf=['[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoAnswer]','Busy','createAgentHistory','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','Queue','isEmpty','execCall','Queue:\x20','idContact','custom:agentcalled','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20work]','Trunk\x20not\x20work','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','trim','dialCutDigit','substring','getCallerId','callerid','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','addVariables','merge','variablesAction','destconnectedlinenum','calleridnum','user:agentconnect','accountcode','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','actionid','lookAgent','logLookAgent','clone','responsetime','isFailure','response','custom:agentringnoanswer','rejected','YYYY-MM-DD\x20HH:mm:ss','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','statedesc','channelstate','transfer','[syncHangup][talking][transfer]','syncDialEnd','addVariable','variables','filterKey','variable','value','error','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','actionPreview','../ami','./rpcDb','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','newexten','varset','attendedtransfer','syncBlindTransfer','loopCampaigns','type','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','message','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','Trunk','active','Interval','stringify','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','emit','voice_queue_presence:remove','sendMessageOneNotActive','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','syncCampaigns','hasOwnProperty','dialMethod','preview','clearZombieChannels','outbound','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','queue','dialAnswer','pick','contactId','ListId','Action','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','disableContact','starttime','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','countnosuchnumberretry','unlockAgent','activeContact','linkedid','ANSWER','format','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','complete','total','decrementTalkink','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','[syncHangup][talking][decrement]','BUSY','busy','Global','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','rescheduleContact','scheduledAt','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]'];(function(_0x4efdae,_0x1e3060){var _0x368c87=function(_0x9ba1e1){while(--_0x9ba1e1){_0x4efdae['push'](_0x4efdae['shift']());}};_0x368c87(++_0x1e3060);}(_0xabdf,0x1c4));var _0xfabd=function(_0x4b7a56,_0x7813b9){_0x4b7a56=_0x4b7a56-0x0;var _0x3fa0f3=_0xabdf[_0x4b7a56];return _0x3fa0f3;};'use strict';var util=require(_0xfabd('0x0'));var _=require(_0xfabd('0x1'));var BPromise=require(_0xfabd('0x2'));var uuid=require(_0xfabd('0x3'));var moment=require(_0xfabd('0x4'));var md5=require(_0xfabd('0x5'));var Redis=require(_0xfabd('0x6'));var config=require(_0xfabd('0x7'));var logger=require(_0xfabd('0x8'))('preview');var loggerAction=require(_0xfabd('0x8'))(_0xfabd('0x9'));var ami=require(_0xfabd('0xa'));var rpcDb=require(_0xfabd('0xb'));var Action=require('./action');var ut=require(_0xfabd('0xc'));config[_0xfabd('0xd')]=_[_0xfabd('0xe')](config[_0xfabd('0xd')],{'host':_0xfabd('0xf'),'port':0x18eb});var io=require(_0xfabd('0x10'))(new Redis(config[_0xfabd('0xd')]));var Sequence=function(){};Sequence[_0xfabd('0x11')][_0xfabd('0x12')]=function(_0x434aee){this[_0xfabd('0x13')]=this[_0xfabd('0x13')]?this[_0xfabd('0x13')][_0xfabd('0x14')](_0x434aee):_0x434aee();};function Preview(_0x4eb7fc){this[_0xfabd('0x15')]=new Sequence();this[_0xfabd('0x16')]=_0x4eb7fc['voiceQueues'];this[_0xfabd('0x17')]=_0x4eb7fc[_0xfabd('0x17')];this[_0xfabd('0x18')]={};this[_0xfabd('0x19')]=_0x4eb7fc[_0xfabd('0x19')];this[_0xfabd('0x1a')]=0x0;ami['on']('originateresponse',this[_0xfabd('0x1b')][_0xfabd('0x1c')](this));ami['on'](_0xfabd('0x1d'),this[_0xfabd('0x1e')]['bind'](this));ami['on'](_0xfabd('0x1f'),this[_0xfabd('0x20')]['bind'](this));ami['on'](_0xfabd('0x21'),this['syncDialEnd'][_0xfabd('0x1c')](this));ami['on'](_0xfabd('0x22'),this['syncNewExten'][_0xfabd('0x1c')](this));ami['on'](_0xfabd('0x23'),this['syncVarSet']['bind'](this));ami['on'](_0xfabd('0x24'),this['syncAttendedTransfer'][_0xfabd('0x1c')](this));ami['on']('blindtransfer',this[_0xfabd('0x25')]['bind'](this));this[_0xfabd('0x26')](this[_0xfabd('0x16')]);}function emit(_0x40f06c,_0x216ca1,_0x3a7522){io['to'](_0x40f06c)['emit'](_0x216ca1,_0x3a7522);}function emitCampaignPreview(_0x157bf1){if(_0x157bf1[_0xfabd('0x27')]==='outbound'){var _0x1f8053={'id':_0x157bf1['id'],'name':_0x157bf1[_0xfabd('0x28')],'strategy':_0x157bf1[_0xfabd('0x29')],'answered':_0x157bf1[_0xfabd('0x2a')],'available':_0x157bf1[_0xfabd('0x2b')],'loggedIn':_0x157bf1[_0xfabd('0x2c')],'pTalking':_0x157bf1[_0xfabd('0x2d')],'sumBillable':_0x157bf1[_0xfabd('0x2e')],'sumDuration':_0x157bf1[_0xfabd('0x2f')],'sumHoldTime':_0x157bf1[_0xfabd('0x30')]||0x0,'talking':_0x157bf1[_0xfabd('0x31')],'total':_0x157bf1['total'],'type':_0x157bf1['type'],'unmanaged':_0x157bf1['unmanaged'],'abandoned':_0x157bf1[_0xfabd('0x32')],'waiting':_0x157bf1[_0xfabd('0x33')],'loggedInDb':_0x157bf1[_0xfabd('0x34')],'dialActive':_0x157bf1[_0xfabd('0x35')],'dialMethod':_0x157bf1['dialMethod'],'dialOriginateCallerIdName':_0x157bf1[_0xfabd('0x36')],'dialOriginateCallerIdNumber':_0x157bf1['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x157bf1[_0xfabd('0x37')],'dialPrefix':_0x157bf1[_0xfabd('0x38')],'outboundAnswerAgiCallsDay':_0x157bf1[_0xfabd('0x39')],'outboundAnswerCallsDay':_0x157bf1[_0xfabd('0x3a')],'outboundBlacklistCallsDay':_0x157bf1[_0xfabd('0x3b')],'outboundBusyCallsDay':_0x157bf1[_0xfabd('0x3c')],'outboundCongestionCallsDay':_0x157bf1[_0xfabd('0x3d')],'outboundDropCallsDayACS':_0x157bf1['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x157bf1[_0xfabd('0x3e')],'outboundDropCallsDayTimeout':_0x157bf1[_0xfabd('0x3f')],'outboundNoAnswerCallsDay':_0x157bf1[_0xfabd('0x40')],'outboundNoSuchCallsDay':_0x157bf1['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x157bf1[_0xfabd('0x41')],'outboundReCallsDay':_0x157bf1['outboundReCallsDay'],'outboundRejectCallsDay':_0x157bf1['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x157bf1['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x157bf1[_0xfabd('0x42')],'predictiveIntervalAnsweredCalls':_0x157bf1[_0xfabd('0x43')],'predictiveIntervalAvgHoldtime':_0x157bf1[_0xfabd('0x44')],'predictiveIntervalAvgTalktime':_0x157bf1['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x157bf1[_0xfabd('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x157bf1[_0xfabd('0x46')],'predictiveIntervalErlangCalls':_0x157bf1[_0xfabd('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x157bf1[_0xfabd('0x48')],'predictiveIntervalHitRate':_0x157bf1[_0xfabd('0x49')],'predictiveIntervalMultiplicativeFactor':_0x157bf1[_0xfabd('0x4a')],'predictiveIntervalPauses':_0x157bf1['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x157bf1[_0xfabd('0x4b')],'predictiveIntervalTotalCalls':_0x157bf1['predictiveIntervalTotalCalls'],'message':_0x157bf1[_0xfabd('0x4c')],'originated':_0x157bf1[_0xfabd('0x4d')],'erlangCalls':_0x157bf1[_0xfabd('0x4e')],'erlangCallToSecond':_0x157bf1[_0xfabd('0x4f')],'erlangAbandonmentRate':_0x157bf1['erlangAbandonmentRate'],'erlangBusyFactor':_0x157bf1[_0xfabd('0x50')],'startPredictive':_0x157bf1[_0xfabd('0x51')],'startProgressive':_0x157bf1['startProgressive']};if(_0x157bf1[_0xfabd('0x52')]){_0x1f8053[_0xfabd('0x52')]={'id':_0x157bf1['Trunk']['id'],'name':_0x157bf1[_0xfabd('0x52')]['name'],'active':_0x157bf1[_0xfabd('0x52')][_0xfabd('0x53')],'callerid':_0x157bf1[_0xfabd('0x52')]['callerid']};}if(_0x157bf1['Interval']){_0x1f8053[_0xfabd('0x54')]={'id':_0x157bf1[_0xfabd('0x54')]['id'],'name':_0x157bf1['Interval'][_0xfabd('0x28')]};}var _0x46a57c=md5(JSON[_0xfabd('0x55')](_0x1f8053));if(_0x157bf1[_0xfabd('0x5')]!==_0x46a57c){_0x157bf1[_0xfabd('0x5')]=_0x46a57c;emit(util['format'](_0xfabd('0x56'),_0x1f8053[_0xfabd('0x28')]),_0xfabd('0x57'),_0x1f8053);}}}function emitVoiceQueueChannelRemove(_0x27deb5){logger[_0xfabd('0x58')](_0xfabd('0x59'),JSON[_0xfabd('0x55')](_0x27deb5));emit(util['format'](_0xfabd('0x56'),_0x27deb5['name']),'voice_queue_channel:remove',_0x27deb5);io[_0xfabd('0x5a')](_0xfabd('0x5b'),_0x27deb5);}function notSendMessagesQueue(_0x4ffb4c){if(_0x4ffb4c[_0xfabd('0x5c')]){if(_0x4ffb4c[_0xfabd('0x4d')]===0x0&&_0x4ffb4c['pTalking']===0x0){_0x4ffb4c[_0xfabd('0x5c')]=![];_0x4ffb4c['available']=0x0;_0x4ffb4c['paused']=0x0;_0x4ffb4c[_0xfabd('0x4c')]=_0xfabd('0x5d');ut[_0xfabd('0x5e')](_0xfabd('0x5f'),_0x4ffb4c[_0xfabd('0x28')]+_0xfabd('0x60'));}else{_0x4ffb4c['message']=_0xfabd('0x61');ut['logger'](_0xfabd('0x5f'),_0x4ffb4c[_0xfabd('0x28')]+'\x20is\x20disactive');}emitCampaignPreview(_0x4ffb4c);}}Preview[_0xfabd('0x11')][_0xfabd('0x26')]=function(){var _0xa7ef7b=this;setInterval(function(){_0xa7ef7b[_0xfabd('0x62')]();},0x7cf);};Preview['prototype'][_0xfabd('0x62')]=function(){var _0x421b49=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x1b45e5 in _0x421b49){if(_0x421b49[_0xfabd('0x63')](_0x1b45e5)&&(_0x421b49[_0x1b45e5][_0xfabd('0x64')]===_0xfabd('0x65')||_0x421b49[_0x1b45e5][_0xfabd('0x64')]==='booked')&&_0x421b49[_0x1b45e5][_0xfabd('0x27')]==='outbound'){if(this[_0xfabd('0x1a')]>0x7){this[_0xfabd('0x1a')]=0x0;this[_0xfabd('0x66')]();}}if(_0x421b49[_0xfabd('0x63')](_0x1b45e5)&&_0x421b49[_0x1b45e5][_0xfabd('0x64')]===_0xfabd('0x65')&&_0x421b49[_0x1b45e5]['type']===_0xfabd('0x67')){if(_0x421b49[_0x1b45e5][_0xfabd('0x35')]){this[_0xfabd('0x68')](_0x421b49[_0x1b45e5]);this[_0xfabd('0x69')](_0x421b49[_0x1b45e5]);}else{notSendMessagesQueue(_0x421b49[_0x1b45e5]);}}}};Preview[_0xfabd('0x11')][_0xfabd('0x6a')]=function(_0x15fc6e){var _0x49732e=this;this[_0xfabd('0x15')][_0xfabd('0x12')](function(){if(!_[_0xfabd('0x6b')](_0x49732e[_0xfabd('0x18')][_0x15fc6e])){loggerAction['info'](_0xfabd('0x6c'),_0x15fc6e,'Queue',_0x49732e[_0xfabd('0x18')][_0x15fc6e]['queue'],'originated:\x20',JSON['stringify'](_0x49732e['campaignsPreview'][_0x49732e[_0xfabd('0x18')][_0x15fc6e][_0xfabd('0x6d')]]['originated']),'pTalking:\x20',JSON['stringify'](_0x49732e[_0xfabd('0x16')][_0x49732e[_0xfabd('0x18')][_0x15fc6e]['queue']][_0xfabd('0x2d')]),JSON[_0xfabd('0x55')](_0x49732e[_0xfabd('0x18')][_0x15fc6e][_0xfabd('0x6e')]),JSON['stringify'](_[_0xfabd('0x6f')](_0x49732e['actions'][_0x15fc6e],[_0xfabd('0x70'),'UserId','VoiceQueueId',_0xfabd('0x71')])));return ami[_0xfabd('0x72')]({'action':'status','channel':_0x49732e[_0xfabd('0x18')][_0x15fc6e][_0xfabd('0x73')]})[_0xfabd('0x74')](function(_0x4b2c40){if(_0x4b2c40['message']===_0xfabd('0x75')){setTimeout(function(){if(_0x49732e[_0xfabd('0x18')][_0x15fc6e]){ut[_0xfabd('0x76')](_0x49732e[_0xfabd('0x16')][_0x49732e[_0xfabd('0x18')][_0x15fc6e][_0xfabd('0x6d')]],_0xfabd('0x77'));if(_0x49732e[_0xfabd('0x18')][_0x15fc6e][_0xfabd('0x6e')]===!![]){ut['decrementTalkink'](_0x49732e['campaignsPreview'][_0x49732e[_0xfabd('0x18')][_0x15fc6e][_0xfabd('0x6d')]],_0xfabd('0x77'));ut[_0xfabd('0x78')](_0xfabd('0x79')+_0x15fc6e,_0x49732e[_0xfabd('0x18')][_0x15fc6e][_0xfabd('0x6d')]);}ut['loggerError'](_0xfabd('0x7a')+_0x15fc6e,_0x49732e['actions'][_0x15fc6e][_0xfabd('0x6d')]);delete _0x49732e['actions'][_0x15fc6e];}},0x2328);}});}});};Preview[_0xfabd('0x11')]['clearZombieChannels']=function(){var _0x33c607=this;loggerAction['info'](_0xfabd('0x7b'),_['size'](this[_0xfabd('0x18')]));for(var _0x17bfde in this[_0xfabd('0x18')]){if(_0x33c607['actions'][_0xfabd('0x63')](_0x17bfde)){_0x33c607[_0xfabd('0x6a')](_0x17bfde);}}};Preview[_0xfabd('0x11')][_0xfabd('0x69')]=function(_0x255c2a){var _0xf4c44b=this;rpcDb[_0xfabd('0x7c')](_0x255c2a['id'],ut[_0xfabd('0x7d')](this[_0xfabd('0x19')]))[_0xfabd('0x7e')](function(_0x38d367){if(!_['isNil'](_0x38d367)){for(var _0x5bfaa6=0x0;_0x5bfaa6<_0x38d367[_0xfabd('0x7f')];_0x5bfaa6+=0x1){if(ut[_0xfabd('0x80')](_0x38d367[_0x5bfaa6][_0xfabd('0x81')])<_0x255c2a[_0xfabd('0x82')]*0x3c){if(_0x38d367[_0x5bfaa6][_0xfabd('0x83')]&&!_0x38d367[_0x5bfaa6][_0xfabd('0x83')]['voicePause']){_0xf4c44b[_0xfabd('0x84')](_0x38d367[_0x5bfaa6]['id'])[_0xfabd('0x7e')](ut[_0xfabd('0x85')]('[RecallMe]'))['catch'](ut['logger2'](_0xfabd('0x86')));}else{rpcDb[_0xfabd('0x87')](_0x38d367[_0x5bfaa6]['id']);}}else{var _0xd9643f=new Action(_0x38d367[_0x5bfaa6],_0x255c2a);_0xd9643f[_0xfabd('0x88')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x255c2a['outboundReCallsDay']+=0x1;ut[_0xfabd('0x89')](_0xd9643f,0x17,_0xfabd('0x8a'));if(_0x255c2a[_0xfabd('0x8b')]){rpcDb[_0xfabd('0x8c')](ut[_0xfabd('0x8d')](_0x38d367[_0x5bfaa6]));rpcDb[_0xfabd('0x8e')](_0xd9643f,_0xfabd('0x8f'));}else{ut['logCustomer'](_0xd9643f,0x16,_0xfabd('0x90'));rpcDb[_0xfabd('0x8e')](_0xd9643f,_0xfabd('0x91'));rpcDb[_0xfabd('0x92')](_0xd9643f,_0xfabd('0x91'));}}}}})[_0xfabd('0x74')](ut[_0xfabd('0x85')](_0xfabd('0x93')));};Preview[_0xfabd('0x11')][_0xfabd('0x68')]=function(_0x2eacb1){_0x2eacb1[_0xfabd('0x5c')]=!![];if(ut[_0xfabd('0x94')](_0x2eacb1[_0xfabd('0x2c')])){_0x2eacb1[_0xfabd('0x4c')]=_0xfabd('0x95');}else if(!ut[_0xfabd('0x96')](_0x2eacb1[_0xfabd('0x35')])){_0x2eacb1[_0xfabd('0x4c')]=_0xfabd('0x5d');}else if(!this[_0xfabd('0x97')](_0x2eacb1[_0xfabd('0x52')])){if(!this[_0xfabd('0x97')](_0x2eacb1[_0xfabd('0x98')])){_0x2eacb1[_0xfabd('0x4c')]=_0xfabd('0x99');}else{_0x2eacb1[_0xfabd('0x4c')]=_0xfabd('0x9a');}}else{_0x2eacb1[_0xfabd('0x4c')]='ACTIVE';}emitCampaignPreview(_0x2eacb1);};Preview[_0xfabd('0x11')][_0xfabd('0x9b')]=function(_0x22f410,_0x128a02,_0xd95540){var _0x39e218=this;var _0x2175f9=this['actions'][_0x128a02];var _0x1f2159=this[_0xfabd('0x16')][_0x2175f9['queue']];var _0x2b49ee;if(_0x1f2159){switch(_0xd95540){case'1':_0x1f2159['outboundNoSuchCallsDay']+=0x1;_0x2175f9['countnosuchnumberretry']+=0x1;_0x2175f9[_0xfabd('0x9c')]=ut[_0xfabd('0x9d')](_0x2175f9);ut['logCustomer'](_0x2175f9,0x0,_0xfabd('0x9e'));ami[_0xfabd('0x5a')](_0xfabd('0x9f'),ut['buildObj'](_0x2175f9,_0xfabd('0xa0')));rpcDb['createCustomerHistory'](_0x2175f9,_0xfabd('0xa1'));if(ut['totalGlobal'](_0x2175f9)>=_0x1f2159[_0xfabd('0xa2')]){_0x2b49ee=ut[_0xfabd('0xa3')](_0x2175f9,0xf,'Global');rpcDb[_0xfabd('0x92')](_0x2b49ee,_0xfabd('0xa4'));}else{if(_0x2175f9['countnosuchnumberretry']>=_0x1f2159[_0xfabd('0xa5')]){rpcDb['createCustomerFinal'](_0x2175f9,_0xfabd('0xa4'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x2175f9,_0xfabd('0xa6'),_0x1f2159['dialNoSuchNumberRetryFrequency']),_0x2175f9[_0xfabd('0xa7')],_0x2175f9[_0xfabd('0xa8')]);}}delete this[_0xfabd('0x18')][_0x22f410[_0xfabd('0xa9')]];break;case _0xfabd('0xaa'):var _0x35d16e=moment()[_0xfabd('0xab')]('YYYY-MM-DD\x20HH:mm:ss');_0x2175f9['responsetime']=_0x35d16e;_0x2175f9[_0xfabd('0xac')]=_0x35d16e;_0x2175f9[_0xfabd('0x6e')]=!![];_0x1f2159[_0xfabd('0x2d')]+=0x1;logger['info'](_0xfabd('0xad'),_0x2175f9[_0xfabd('0xae')],_0xfabd('0xaf'),_0x1f2159[_0xfabd('0x28')],_0xfabd('0xb0'),_0x1f2159[_0xfabd('0x2d')]);ami[_0xfabd('0x5a')](_0xfabd('0xb1'),ut[_0xfabd('0xb2')](_0x2175f9,_0xfabd('0xb3'),this[_0xfabd('0x16')][_0x2175f9['queue']]));if(_0x1f2159[_0xfabd('0xb4')]){ami[_0xfabd('0x5a')](_0xfabd('0xb5'),ut[_0xfabd('0xb6')](_0x2175f9));}break;case'16':ami[_0xfabd('0x5a')]('custom:agentcomplete',ut[_0xfabd('0xb2')](_0x2175f9,_0xfabd('0xb7'),this['campaignsPreview'][_0x2175f9['queue']]));emitVoiceQueueChannelRemove(ut[_0xfabd('0xb2')](_0x2175f9,'complete'));_0x1f2159[_0xfabd('0x3a')]+=0x1;_0x1f2159[_0xfabd('0xb8')]+=0x1;_0x1f2159['answered']+=0x1;ut[_0xfabd('0xb9')](_0x1f2159,'[16]');_0x2175f9[_0xfabd('0x9c')]=ut[_0xfabd('0x9d')](_0x2175f9);ut[_0xfabd('0x89')](_0x2175f9,0x4,_0xfabd('0xba'));rpcDb[_0xfabd('0x8e')](_0x2175f9,_0xfabd('0xbb'));rpcDb[_0xfabd('0x92')](_0x2175f9,_0xfabd('0xbc'));rpcDb[_0xfabd('0xbd')](_0x2175f9);_0x1f2159[_0xfabd('0x2f')]+=_0x2175f9['talktime'];_0x1f2159[_0xfabd('0x2e')]+=_0x2175f9['talktime'];logger['info'](_0xfabd('0xbe'),_0x2175f9[_0xfabd('0xae')],_0xfabd('0xaf'),_0x1f2159[_0xfabd('0x28')],_0xfabd('0xb0'),_0x1f2159[_0xfabd('0x2d')]);delete this[_0xfabd('0x18')][_0x22f410[_0xfabd('0xa9')]];break;case _0xfabd('0xbf'):_0x1f2159[_0xfabd('0x3c')]+=0x1;_0x2175f9['countbusyretry']+=0x1;_0x2175f9[_0xfabd('0x9c')]=ut['totalGlobal'](_0x2175f9);ut['logCustomer'](_0x2175f9,0x5,'Busy');ami[_0xfabd('0x5a')]('custom:agentbusy',ut[_0xfabd('0xb2')](_0x2175f9,_0xfabd('0xc0')));rpcDb['createCustomerHistory'](_0x2175f9,'[callProgressDetectingCustomer][logBusy]');if(ut[_0xfabd('0x9d')](_0x2175f9)>=_0x1f2159['dialGlobalMaxRetry']){_0x2b49ee=ut[_0xfabd('0xa3')](_0x2175f9,0xf,_0xfabd('0xc1'));rpcDb[_0xfabd('0x92')](_0x2b49ee,_0xfabd('0xc2'));}else{if(_0x2175f9[_0xfabd('0xc3')]>=_0x1f2159[_0xfabd('0xc4')]){rpcDb[_0xfabd('0x92')](_0x2175f9,_0xfabd('0xc5'));}else{rpcDb[_0xfabd('0xc6')](ut[_0xfabd('0xc7')](_0x2175f9,_0xfabd('0xc3'),_0x1f2159[_0xfabd('0xc8')]),_0x2175f9[_0xfabd('0xa7')],_0x2175f9[_0xfabd('0xa8')]);}}break;case _0xfabd('0xc9'):_0x1f2159['outboundNoAnswerCallsDay']+=0x1;_0x2175f9[_0xfabd('0xca')]+=0x1;_0x2175f9[_0xfabd('0x9c')]=ut[_0xfabd('0x9d')](_0x2175f9);ut[_0xfabd('0x89')](_0x2175f9,0x3,_0xfabd('0xcb'));ami[_0xfabd('0x5a')](_0xfabd('0xcc'),ut['buildObj'](_0x2175f9,_0xfabd('0xcd')));rpcDb[_0xfabd('0x8e')](_0x2175f9,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0xfabd('0x9d')](_0x2175f9)>=_0x1f2159[_0xfabd('0xa2')]){_0x2b49ee=ut[_0xfabd('0xa3')](_0x2175f9,0xf,'Global');rpcDb['createCustomerFinal'](_0x2b49ee,_0xfabd('0xce'));}else{if(_0x2175f9[_0xfabd('0xca')]>=_0x1f2159['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x2175f9,_0xfabd('0xcf'));}else{rpcDb[_0xfabd('0xc6')](ut['scheduledAt'](_0x2175f9,_0xfabd('0xca'),_0x1f2159[_0xfabd('0xd0')]),_0x2175f9[_0xfabd('0xa7')],_0x2175f9[_0xfabd('0xa8')]);}}break;case _0xfabd('0xd1'):_0x1f2159[_0xfabd('0x3d')]+=0x1;_0x2175f9[_0xfabd('0xd2')]+=0x1;_0x2175f9['countglobal']=ut[_0xfabd('0x9d')](_0x2175f9);ut['logCustomer'](_0x2175f9,0x8,_0xfabd('0xd3'));ami[_0xfabd('0x5a')]('custom:agentcongestion',ut[_0xfabd('0xb2')](_0x2175f9,_0xfabd('0xd4')));rpcDb[_0xfabd('0x8e')](_0x2175f9,_0xfabd('0xd5'));if(ut['totalGlobal'](_0x2175f9)>=_0x1f2159[_0xfabd('0xa2')]){_0x2b49ee=ut['cloneAction'](_0x2175f9,0xf,_0xfabd('0xc1'));rpcDb['createCustomerFinal'](_0x2b49ee,_0xfabd('0xd6'));}else{if(_0x2175f9[_0xfabd('0xd2')]>=_0x1f2159[_0xfabd('0xd7')]){rpcDb[_0xfabd('0x92')](_0x2175f9,_0xfabd('0xd5'));}else{rpcDb[_0xfabd('0xc6')](ut[_0xfabd('0xc7')](_0x2175f9,_0xfabd('0xd2'),_0x1f2159[_0xfabd('0xc8')]),_0x2175f9[_0xfabd('0xa7')],_0x2175f9[_0xfabd('0xa8')]);}}break;case _0xfabd('0xd8'):_0x1f2159['outboundRejectCallsDay']+=0x1;_0x2175f9[_0xfabd('0xd9')]+=0x1;_0x2175f9[_0xfabd('0x9c')]=ut['totalGlobal'](_0x2175f9);ut[_0xfabd('0x89')](_0x2175f9,0x14,_0xfabd('0xda'));ami[_0xfabd('0x5a')](_0xfabd('0xdb'),ut['buildObj'](_0x2175f9,_0xfabd('0xdc')));rpcDb[_0xfabd('0x8e')](_0x2175f9,_0xfabd('0xdd'));if(ut[_0xfabd('0x9d')](_0x2175f9)>=_0x1f2159[_0xfabd('0xa2')]){_0x2b49ee=ut[_0xfabd('0xa3')](_0x2175f9,0x14,_0xfabd('0xda'));rpcDb[_0xfabd('0x92')](_0x2b49ee,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x2175f9[_0xfabd('0xd9')]>=_0x1f2159[_0xfabd('0xde')]){rpcDb[_0xfabd('0x92')](_0x2175f9,_0xfabd('0xdf'));}else{rpcDb[_0xfabd('0xc6')](ut['scheduledAt'](_0x2175f9,_0xfabd('0xd9'),_0x1f2159['dialAgentRejectRetryFrequency']),_0x2175f9[_0xfabd('0xa7')],_0x2175f9['activeContact']);}}break;case'ABANDONED':_0x1f2159[_0xfabd('0x42')]+=0x1;_0x2175f9[_0xfabd('0xe0')]+=0x1;_0x2175f9[_0xfabd('0x9c')]=ut[_0xfabd('0x9d')](_0x2175f9);ut[_0xfabd('0x89')](_0x2175f9,0xb,'Abandoned');rpcDb[_0xfabd('0x8e')](_0x2175f9,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0xfabd('0x9d')](_0x2175f9)>=_0x1f2159[_0xfabd('0xa2')]){_0x2b49ee=ut[_0xfabd('0xa3')](_0x2175f9,0xf,_0xfabd('0xc1'));rpcDb[_0xfabd('0x92')](_0x2b49ee,_0xfabd('0xe1'));}else{if(_0x2175f9['countabandonedetry']>=_0x1f2159['dialAbandonedMaxRety']){rpcDb['createCustomerFinal'](_0x2175f9,_0xfabd('0xe1'));}else{rpcDb[_0xfabd('0xc6')](ut[_0xfabd('0xc7')](_0x2175f9,_0xfabd('0xe0'),_0x1f2159[_0xfabd('0xe2')]),_0x2175f9['unlockAgent'],_0x2175f9['activeContact']);}}break;case'18':_0x1f2159[_0xfabd('0xe3')]+=0x1;_0x2175f9[_0xfabd('0xe4')]+=0x1;_0x2175f9[_0xfabd('0x9c')]=ut[_0xfabd('0x9d')](_0x2175f9);ut[_0xfabd('0x89')](_0x2175f9,0x12,_0x22f410[_0xfabd('0xe5')]||_0x22f410[_0xfabd('0xe6')]);ami['emit'](_0xfabd('0xe7'),ut[_0xfabd('0xb2')](_0x2175f9,_0xfabd('0xe8')));rpcDb[_0xfabd('0x8e')](_0x2175f9,'[callProgressDetectingCustomer][hangupInAMD]');if(ut[_0xfabd('0x9d')](_0x2175f9)>=_0x1f2159[_0xfabd('0xa2')]){_0x2b49ee=ut[_0xfabd('0xa3')](_0x2175f9,0xf,_0xfabd('0xc1'));rpcDb[_0xfabd('0x92')](_0x2b49ee,_0xfabd('0xe9'));}else{rpcDb[_0xfabd('0x92')](_0x2175f9,_0xfabd('0xe9'));}delete this[_0xfabd('0x18')][_0x22f410[_0xfabd('0xa9')]];break;case'19':_0x1f2159[_0xfabd('0xe3')]+=0x1;_0x2175f9[_0xfabd('0x9c')]=ut[_0xfabd('0x9d')](_0x2175f9);ut[_0xfabd('0x89')](_0x2175f9,0x13,_0x22f410[_0xfabd('0xe5')]||_0x22f410[_0xfabd('0xe6')]);ami[_0xfabd('0x5a')](_0xfabd('0xe7'),ut['buildObj'](_0x2175f9,_0xfabd('0xe8')));rpcDb[_0xfabd('0x8e')](_0x2175f9,'[callProgressDetectingCustomer][machine]');if(ut[_0xfabd('0x9d')](_0x2175f9)>=_0x1f2159['dialGlobalMaxRetry']){_0x2b49ee=ut['cloneAction'](_0x2175f9,0xf,'Global');rpcDb[_0xfabd('0x92')](_0x2b49ee,_0xfabd('0xea'));}else{rpcDb[_0xfabd('0x92')](_0x2175f9,_0xfabd('0xea'));}delete this[_0xfabd('0x18')][_0x22f410[_0xfabd('0xa9')]];break;default:if(_0x2175f9[_0xfabd('0x6e')]){ut['decrementTalkink'](_0x1f2159,_0xfabd('0xeb'));ut[_0xfabd('0x78')](_0xfabd('0xec')+_0x1f2159[_0xfabd('0x28')],_0x22f410);}_0x1f2159['outboundUnknownCallsDay']+=0x1;_0x2175f9[_0xfabd('0x9c')]=ut[_0xfabd('0x9d')](_0x2175f9);ut['logCustomer'](_0x2175f9,0xc,_0x22f410[_0xfabd('0xe5')]||_0x22f410[_0xfabd('0xe6')]);rpcDb[_0xfabd('0x8e')](_0x2175f9,_0xfabd('0xed'));if(ut[_0xfabd('0x9d')](_0x2175f9)>=_0x1f2159[_0xfabd('0xa2')]){_0x2b49ee=ut[_0xfabd('0xa3')](_0x2175f9,0xf,'Global');rpcDb['createCustomerFinal'](_0x2b49ee,_0xfabd('0xee'));}else{rpcDb['createCustomerFinal'](_0x2175f9,_0xfabd('0xee'));}delete this[_0xfabd('0x18')][_0x22f410[_0xfabd('0xa9')]];}if(!(_0x2175f9[_0xfabd('0x6e')]&&_0xd95540==='16')){ut[_0xfabd('0x76')](_0x1f2159,_0xfabd('0xef'));logger[_0xfabd('0x58')](_0xfabd('0xf0'),_0x2175f9['uniqueid'],_0xfabd('0xaf'),_0x1f2159[_0xfabd('0x28')],_0xfabd('0xf1'),_0x1f2159['originated']);}if(_0xd95540!==_0xfabd('0xaa')){delete this['actions'][_0x22f410[_0xfabd('0xa9')]];delete this['actions'][_0x22f410[_0xfabd('0xf2')]];}}};Preview[_0xfabd('0x11')][_0xfabd('0xf3')]=function(_0x105f81,_0x399a26,_0x5dd937){if(_[_0xfabd('0xf4')](_0x399a26)&&_0xfabd('0xf5')!==typeof _0x399a26){return;}if(_['isUndefined'](_0x5dd937)&&'object'!==typeof _0x5dd937){return;}switch(_0x5dd937[_0xfabd('0xf6')]){case'0':ut[_0xfabd('0xf7')](_0x105f81,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x105f81,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut['logAgent'](_0x105f81,0x3,_0xfabd('0xcb'));rpcDb['createAgentHistory'](_0x105f81,_0xfabd('0xf8'));break;case'5':ut[_0xfabd('0xf7')](_0x105f81,0x5,_0xfabd('0xf9'));rpcDb[_0xfabd('0xfa')](_0x105f81,_0xfabd('0xfb'));break;case'8':ut[_0xfabd('0xf7')](_0x105f81,0x8,_0xfabd('0xd3'));rpcDb[_0xfabd('0xfa')](_0x105f81,_0xfabd('0xfc'));break;case'22':ut[_0xfabd('0xf7')](_0x105f81,0x16,_0xfabd('0xfd'));rpcDb[_0xfabd('0xfa')](_0x105f81,_0xfabd('0xfe'));break;default:ut[_0xfabd('0xf7')](_0x105f81,0xc,_0x5dd937['reason']);rpcDb[_0xfabd('0xfa')](_0x105f81,_0xfabd('0xfc'));}ut[_0xfabd('0x76')](_0x399a26,_0xfabd('0xff'));logger['info'](_0xfabd('0x100'),_0x105f81[_0xfabd('0xae')],_0xfabd('0xaf'),_0x399a26[_0xfabd('0x28')],'originated:\x20',_0x399a26[_0xfabd('0x4d')]);delete this['actions'][_0x105f81[_0xfabd('0xae')]];};Preview['prototype'][_0xfabd('0x101')]=function(_0x3023fa,_0x3919a8,_0x34228a,_0x1336d4,_0xa3c5c0){var _0x59a5ef=this;return new BPromise(function(_0x2bd292,_0x22555a){if(_['isNil'](_0x3919a8)||_[_0xfabd('0x6b')](_0x3919a8[_0xfabd('0x102')])||_['isNil'](_0x3919a8['Contact'][_0xfabd('0x103')])||_[_0xfabd('0x6b')](_0x3919a8[_0xfabd('0x104')])){_0x22555a(ut[_0xfabd('0x4c')](_0xfabd('0x105'),_0x1336d4,_0xa3c5c0));return;}var _0x4136a2=uuid['v4']();var _0x2214e6=_0x59a5ef[_0xfabd('0x16')][_0x3919a8[_0xfabd('0x106')][_0xfabd('0x28')]];var _0x5458c1=_0x34228a?_0x59a5ef[_0xfabd('0x19')][_0x34228a]['id']:undefined;_0x59a5ef['actions'][_0x4136a2]=new Action(_0x3919a8,_0x2214e6,_0x4136a2,_0x34228a,_0x5458c1);var _0x50cc28=_0x59a5ef[_0xfabd('0x18')][_0x4136a2];_0x50cc28[_0xfabd('0xa7')]=_0x1336d4;_0x50cc28['activeContact']=_0xa3c5c0;_0x50cc28['lookAgent']=_0x34228a;if(_[_0xfabd('0x107')](_0x3023fa)){_0x59a5ef[_0xfabd('0x108')](_0x50cc28,_0x2214e6,_0x3919a8,_0x34228a)['then'](function(_0x307a30){logger[_0xfabd('0x58')]('[Preview][execCall][success]',_0xfabd('0x109')+_0x50cc28[_0xfabd('0x6d')]+'\x20IdHopper:\x20'+_0x50cc28[_0xfabd('0x10a')],JSON[_0xfabd('0x55')](_0x307a30));ami[_0xfabd('0x5a')](_0xfabd('0x10b'),ut['buildObj'](_0x50cc28,'called',_0x59a5ef['campaignsPreview'][_0x50cc28[_0xfabd('0x6d')]]));_0x2bd292(ut[_0xfabd('0x4c')]('Calling'));})[_0xfabd('0x74')](function(_0x48be16){ut['logger'](_0xfabd('0x10c'),_0x48be16);_0x22555a(ut[_0xfabd('0x4c')](_0xfabd('0x10d'),_0x1336d4,_0xa3c5c0));});}else{_0x2214e6[_0xfabd('0x3b')]+=0x1;ut[_0xfabd('0x10e')](_0x50cc28);rpcDb[_0xfabd('0x10f')](_0x50cc28,'[Blacklist][error]');delete _0x59a5ef[_0xfabd('0x18')][_0x4136a2];_0x22555a(ut['message']('Contact\x20in\x20black\x20List',_0x1336d4,_0xa3c5c0));}});};Preview[_0xfabd('0x11')][_0xfabd('0x97')]=function(_0xdd7c22){return!_[_0xfabd('0x6b')](_0xdd7c22)&&!_[_0xfabd('0x6b')](_0xdd7c22[_0xfabd('0x28')])&&!_[_0xfabd('0x6b')](_0xdd7c22['active'])&&_0xdd7c22[_0xfabd('0x53')]&&!_[_0xfabd('0x6b')](this[_0xfabd('0x17')][util[_0xfabd('0xab')](_0xfabd('0x110'),_0xdd7c22[_0xfabd('0x28')])])&&!_[_0xfabd('0x6b')](this['trunks'][util[_0xfabd('0xab')](_0xfabd('0x110'),_0xdd7c22[_0xfabd('0x28')])][_0xfabd('0x111')])&&(this[_0xfabd('0x17')][util[_0xfabd('0xab')]('SIP/%s',_0xdd7c22[_0xfabd('0x28')])]['status']===_0xfabd('0x112')||this[_0xfabd('0x17')][util[_0xfabd('0xab')](_0xfabd('0x110'),_0xdd7c22['name'])][_0xfabd('0x111')]===_0xfabd('0x113'));};Preview[_0xfabd('0x11')][_0xfabd('0x84')]=function(_0x250e68,_0x129fce){var _0x22254a=this;return new BPromise(function(_0x57e3c2,_0xacb0a3){_0x22254a[_0xfabd('0x114')](_0x250e68,_0x129fce)['then'](function(_0x7774cb){_0x57e3c2(_[_0xfabd('0x6f')](_0x7774cb,[_0xfabd('0x4c')]));})[_0xfabd('0x74')](function(_0x47d3a0){if(_0x47d3a0[_0xfabd('0x115')]){rpcDb[_0xfabd('0x116')](_0x250e68);}if(_0x47d3a0[_0xfabd('0x53')]){rpcDb[_0xfabd('0x87')](_0x250e68);}_0xacb0a3(_[_0xfabd('0x6f')](_0x47d3a0,[_0xfabd('0x4c')]));});});};Preview[_0xfabd('0x11')][_0xfabd('0x114')]=function(_0x5abc7e,_0x41ef8b){var _0x3be377=this;return new BPromise(function(_0x554fb0,_0x3453b6){var _0xd81b17,_0x4700d6;rpcDb[_0xfabd('0x117')](_0x5abc7e)['then'](function(_0x3c9262){if(!_[_0xfabd('0x6b')](_0x3c9262[0x0])){_0x4700d6=_0x3c9262[0x0][_0xfabd('0x118')]?![]:!![];_0xd81b17=_0x3c9262[0x0][_0xfabd('0x118')]?!![]:![];_0xd81b17=_0x41ef8b?!![]:_0xd81b17;}var _0x338468=_0x3be377[_0xfabd('0x119')](_0x3c9262);if(_0x338468[_0xfabd('0x11a')]){rpcDb[_0xfabd('0x11b')](_[_0xfabd('0x6f')](_0x3c9262[0x0],[_0xfabd('0x104'),_0xfabd('0x11c')]))['then'](function(_0x3ef0df){_0x3be377['checkInBlack'](_0x3ef0df,_0x3c9262[0x0],_0x41ef8b,_0x4700d6,_0xd81b17)[_0xfabd('0x7e')](function(_0x588667){_0x554fb0(_0x588667);})[_0xfabd('0x74')](function(_0x58ed7b){_0x3453b6(_0x58ed7b);});})[_0xfabd('0x74')](function(_0x11c99c){ut[_0xfabd('0x5e')]('[Preview][checkIsBlackList]',_0x11c99c);_0x3453b6(ut['message'](_0xfabd('0x11d'),_0x4700d6,_0xd81b17));});}else{_0x3453b6(ut[_0xfabd('0x4c')](_0x338468[_0xfabd('0x4c')],_0x4700d6,_0xd81b17));}})[_0xfabd('0x74')](function(_0x224f11){ut['logger']('[Preview][getContactPreview]',_0x224f11);_0x3453b6(ut[_0xfabd('0x4c')](_0xfabd('0x11d'),![],!![]));});});};Preview[_0xfabd('0x11')][_0xfabd('0x119')]=function(_0x539d76){if(_[_0xfabd('0x6b')](_0x539d76)||_['isEmpty'](_0x539d76)||!_['isNil'](_0x539d76[0x0][_0xfabd('0x83')])&&_[_0xfabd('0x6b')](_0x539d76[0x0][_0xfabd('0x83')][_0xfabd('0x28')])){ut[_0xfabd('0x5e')](_0xfabd('0x11e'),_0x539d76);return{'isValid':![],'message':_0xfabd('0x11f')};}var _0x29bfd6=this['campaignsPreview'][_0x539d76[0x0][_0xfabd('0x106')][_0xfabd('0x28')]];_0x29bfd6[_0xfabd('0x4c')]='ACTIVE';if(_[_0xfabd('0x6b')](_0x29bfd6)){ut['logger'](_0xfabd('0x120'),_0x29bfd6);return{'isValid':![],'message':_0xfabd('0x121')};}if(!this[_0xfabd('0x97')](_0x29bfd6[_0xfabd('0x52')])){ut[_0xfabd('0x5e')]('[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20'+_0x29bfd6[_0xfabd('0x28')]+_0xfabd('0x122'));if(!this[_0xfabd('0x97')](_0x29bfd6[_0xfabd('0x98')])){ut[_0xfabd('0x5e')](_0xfabd('0x123'),_0x29bfd6['name']+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xfabd('0x124')};}}if(!ut[_0xfabd('0x96')](_0x29bfd6[_0xfabd('0x35')])){ut['logger']('[Preview][validateContact][Campaign\x20Active]',_0x29bfd6[_0xfabd('0x28')]+_0xfabd('0x125'));return{'isValid':![],'message':_0xfabd('0x126')+_0x29bfd6[_0xfabd('0x28')]+_0xfabd('0x125')};}return{'isValid':!![],'message':_0xfabd('0x127')};};Preview[_0xfabd('0x11')][_0xfabd('0x108')]=function(_0x2c6f60,_0x2db1d3,_0x509741,_0x162505){var _0x54478f=this;return new BPromise(function(_0x21d581,_0x96ffd1){var _0x46d532=_0x2c6f60['uniqueid'];var _0x503cc2=_0x54478f[_0xfabd('0x97')](_0x2db1d3[_0xfabd('0x52')])?util[_0xfabd('0xab')]('SIP/%s/%s%s',_0x2db1d3[_0xfabd('0x52')][_0xfabd('0x28')],_[_0xfabd('0x6b')](_0x2db1d3[_0xfabd('0x38')])?'':_0x2db1d3['dialPrefix'][_0xfabd('0x128')]()||'',_0x2db1d3[_0xfabd('0x129')]>0x0?_0x509741[_0xfabd('0x102')][_0xfabd('0x103')][_0xfabd('0x12a')](_0x2db1d3[_0xfabd('0x129')]):_0x509741[_0xfabd('0x102')][_0xfabd('0x103')]):util[_0xfabd('0xab')]('SIP/%s/%s%s',_[_0xfabd('0x6b')](_0x2db1d3[_0xfabd('0x98')])?_0x2db1d3[_0xfabd('0x52')][_0xfabd('0x28')]:_0x2db1d3[_0xfabd('0x98')]['name'],_[_0xfabd('0x6b')](_0x2db1d3['dialPrefix'])?'':_0x2db1d3[_0xfabd('0x38')][_0xfabd('0x128')]()||'',_0x2db1d3[_0xfabd('0x129')]>0x0?_0x509741[_0xfabd('0x102')][_0xfabd('0x103')]['substring'](_0x2db1d3[_0xfabd('0x129')]):_0x509741[_0xfabd('0x102')][_0xfabd('0x103')]);var _0x4a9c39=_0x54478f[_0xfabd('0x97')](_0x2db1d3[_0xfabd('0x52')])?ut[_0xfabd('0x12b')](_0x2db1d3[_0xfabd('0x52')][_0xfabd('0x12c')],_0x2db1d3['dialOriginateCallerIdName'],_0x2db1d3['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xfabd('0x12d')](_0x2db1d3[_0xfabd('0x12e')],_0x2db1d3[_0xfabd('0x12f')]):_0x2db1d3[_0xfabd('0x12e')]):ut['getCallerId'](_['isNil'](_0x2db1d3['TrunkBackup'])?_0x2db1d3[_0xfabd('0x52')][_0xfabd('0x12c')]:_0x2db1d3[_0xfabd('0x98')][_0xfabd('0x12c')],_0x2db1d3[_0xfabd('0x36')],_0x2db1d3['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xfabd('0x12d')](_0x2db1d3[_0xfabd('0x12e')],_0x2db1d3[_0xfabd('0x12f')]):_0x2db1d3[_0xfabd('0x12e')]);if(_0x4a9c39){_0x2c6f60[_0xfabd('0x130')]=ut[_0xfabd('0x131')](_0x4a9c39);_0x2c6f60[_0xfabd('0x132')]=ut['extractCalleridNumber'](_0x4a9c39);}var _0x4c76dd=ut[_0xfabd('0x133')](_0x2db1d3,_0x509741,_0x503cc2,_0x4a9c39,_0x46d532,_0x2c6f60);_[_0xfabd('0x134')](_0x2c6f60,ut['toLowerVariables'](_0x4c76dd));_0x2c6f60[_0xfabd('0x88')]=moment()[_0xfabd('0xab')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0xfabd('0x72')](ut[_0xfabd('0x135')](_0x2c6f60,_0x2db1d3,_0x4c76dd,_0x2c6f60['activeContact'],_0x162505))[_0xfabd('0x7e')](function(_0x3bea90){var _0x9970d6=_0x2c6f60['channelAgent'];if(!_[_0xfabd('0x6b')](_0x9970d6)){if(!_[_0xfabd('0x6b')](_0x54478f[_0xfabd('0x19')][_0x9970d6])){_0x54478f['agents'][_0x9970d6][_0xfabd('0x136')]=_0x2c6f60[_0xfabd('0x137')];emit(util[_0xfabd('0xab')]('user:%s',_0x54478f[_0xfabd('0x19')][_0x9970d6][_0xfabd('0x28')]),_0xfabd('0x138'),{'destaccountcode':_0x54478f[_0xfabd('0x19')][_0x9970d6][_0xfabd('0x139')],'destconnectedlinenum':_0x2c6f60[_0xfabd('0x137')]});}}_0x2db1d3[_0xfabd('0x4d')]+=0x1;logger[_0xfabd('0x58')]('[originated][increment]',_0x46d532,_0xfabd('0xaf'),_0x2db1d3['name'],_0xfabd('0xf1'),_0x2db1d3[_0xfabd('0x4d')]);_0x21d581(_0x3bea90);})[_0xfabd('0x74')](function(_0x4dedd0){ut[_0xfabd('0xf7')](_0x2c6f60,0xe,_0xfabd('0x13a'));rpcDb[_0xfabd('0xfa')](_0x2c6f60,_0xfabd('0x13b'));_0x96ffd1(_0x4dedd0);});});};Preview[_0xfabd('0x11')][_0xfabd('0x13c')]=function(_0x379733){if(this[_0xfabd('0x18')][_0x379733[_0xfabd('0xa9')]]){this[_0xfabd('0x18')][_0x379733['linkedid']][_0xfabd('0x73')]=_0x379733[_0xfabd('0x73')];}};Preview[_0xfabd('0x11')][_0xfabd('0x1b')]=function(_0x29f94c){var _0x122289=this;var _0xff9aa8=this[_0xfabd('0x18')][_0x29f94c[_0xfabd('0x13d')]];if(_0xff9aa8){if(_0xff9aa8[_0xfabd('0x13e')]&&this[_0xfabd('0x19')][_0xff9aa8[_0xfabd('0x13e')]]){ut[_0xfabd('0x13f')](_0xff9aa8,this[_0xfabd('0x19')][_0xff9aa8[_0xfabd('0x13e')]][_0xfabd('0x28')],this[_0xfabd('0x19')][_0xff9aa8[_0xfabd('0x13e')]]['id']);}var _0x20536b=_[_0xfabd('0x140')](_0xff9aa8);_0x20536b[_0xfabd('0x141')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0xd48279=_0x122289[_0xfabd('0x16')][_0xff9aa8['queue']];if(ut[_0xfabd('0x142')](_0x29f94c[_0xfabd('0x143')])){if(_0xff9aa8[_0xfabd('0xa7')]){rpcDb['unlockContact'](_0xff9aa8[_0xfabd('0x10a')]);}if(_0xff9aa8[_0xfabd('0xa8')]){rpcDb[_0xfabd('0x87')](_0xff9aa8[_0xfabd('0x10a')]);}ami[_0xfabd('0x5a')](_0xfabd('0x144'),ut['buildObj'](_0xff9aa8,_0xfabd('0x145'),this['campaignsPreview'][_0xff9aa8[_0xfabd('0x6d')]]));this[_0xfabd('0xf3')](_0x20536b,_0xd48279,_0x29f94c);}else{_0xff9aa8['starttime']=moment()['format'](_0xfabd('0x146'));ut[_0xfabd('0xf7')](_0x20536b,0x4,_0xfabd('0xba'));rpcDb[_0xfabd('0xfa')](_0x20536b,_0xfabd('0x147'));}}};Preview[_0xfabd('0x11')][_0xfabd('0x1e')]=function(_0x53569f){var _0x5c258a=this;var _0xe1c5aa=this[_0xfabd('0x18')][_0x53569f[_0xfabd('0xa9')]];var _0x45d3af;if(_0xe1c5aa){_0x45d3af=this['campaignsPreview'][_0xe1c5aa[_0xfabd('0x6d')]];logger['info']('[syncHangup][talking]',_0x53569f[_0xfabd('0xa9')],_0xfabd('0xaf'),_0x45d3af[_0xfabd('0x28')],_0xfabd('0xb0'),_0x45d3af['pTalking']);}if(this[_0xfabd('0x18')][_0x53569f[_0xfabd('0xa9')]]&&_0x53569f[_0xfabd('0xa9')]!==_0x53569f[_0xfabd('0xae')]){if(_0x53569f[_0xfabd('0x148')]==='16'&&this[_0xfabd('0x18')][_0x53569f[_0xfabd('0xa9')]][_0xfabd('0x6e')]){this[_0xfabd('0x9b')](_0x53569f,_0x53569f[_0xfabd('0xa9')],_0x53569f[_0xfabd('0x148')]);}else if(this['actions'][_0x53569f[_0xfabd('0xa9')]][_0xfabd('0x6e')]){logger[_0xfabd('0x58')](_0xfabd('0x149'),_0x53569f[_0xfabd('0xa9')],_0x53569f[_0xfabd('0x148')],_0xfabd('0xaf'),_0x45d3af['name'],_0xfabd('0xb0'),_0x45d3af[_0xfabd('0x2d')]);this[_0xfabd('0x9b')](_0x53569f,_0x53569f[_0xfabd('0xa9')],_0x53569f[_0xfabd('0x148')]);}}else if(_0xe1c5aa&&_[_0xfabd('0x6b')](_0xe1c5aa[_0xfabd('0x14a')])&&_0x45d3af['dialQueueProject']&&_0x53569f[_0xfabd('0xa9')]===_0x53569f[_0xfabd('0xae')]&&_[_0xfabd('0x6b')](_0x53569f[_0xfabd('0xf6')])&&_0x53569f[_0xfabd('0x148')]==='16'&&_0x53569f[_0xfabd('0x14b')]==='6'&&_[_0xfabd('0xf4')](_0xe1c5aa[_0xfabd('0x14c')])){if(_0xe1c5aa['unlockAgent']){rpcDb['unlockContact'](_0xe1c5aa[_0xfabd('0x10a')]);}if(_0xe1c5aa[_0xfabd('0xa8')]){rpcDb['disableContact'](_0xe1c5aa[_0xfabd('0x10a')]);}_0x53569f[_0xfabd('0xf6')]='22';this['callProgressDetectingAgent'](_0xe1c5aa,_0x45d3af,_0x53569f);}else if(_0xe1c5aa&&_0xe1c5aa['transfer']){if(_0x53569f[_0xfabd('0x148')]==='16'&&this[_0xfabd('0x18')][_0x53569f['linkedid']][_0xfabd('0x6e')]){logger[_0xfabd('0x58')](_0xfabd('0x14d'),_0x53569f[_0xfabd('0xa9')],_0x53569f[_0xfabd('0x148')],_0xfabd('0xaf'),_0x45d3af[_0xfabd('0x28')],'pTalking:\x20',_0x45d3af['pTalking']);this[_0xfabd('0x9b')](_0x53569f,_0x53569f[_0xfabd('0xa9')],_0x53569f['cause']);}else if(this[_0xfabd('0x18')][_0x53569f[_0xfabd('0xa9')]][_0xfabd('0x6e')]){logger[_0xfabd('0x58')](_0xfabd('0x149'),_0x53569f['linkedid'],_0x53569f[_0xfabd('0x148')],_0xfabd('0xaf'),_0x45d3af['name'],_0xfabd('0xb0'),_0x45d3af[_0xfabd('0x2d')]);this[_0xfabd('0x9b')](_0x53569f,_0x53569f['linkedid'],_0x53569f['cause']);}}};Preview['prototype'][_0xfabd('0x14e')]=function(_0x44878e){if(this[_0xfabd('0x18')][_0x44878e['destlinkedid']]&&_0x44878e['destlinkedid']!==_0x44878e['destuniqueid']){this['callProgressDetectingCustomer'](_0x44878e,_0x44878e[_0xfabd('0xf2')],_0x44878e['dialstatus']);}};Preview['prototype']['syncHangupRequest']=function(_0x568e2d){if(this[_0xfabd('0x18')][_0x568e2d[_0xfabd('0xa9')]]&&_0x568e2d[_0xfabd('0xa9')]!==_0x568e2d[_0xfabd('0xae')]&&!this[_0xfabd('0x18')][_0x568e2d[_0xfabd('0xa9')]]['dialAnswer']){if(_0x568e2d[_0xfabd('0x148')]==='1'){this[_0xfabd('0x9b')](_0x568e2d,_0x568e2d[_0xfabd('0xa9')],_0x568e2d[_0xfabd('0x148')]);}}};Preview[_0xfabd('0x11')][_0xfabd('0x14f')]=function(_0x4b6de6,_0x513ed4,_0x4e91b6){if(this[_0xfabd('0x18')][_0x4b6de6]){if(_[_0xfabd('0x6b')](this[_0xfabd('0x18')][_0x4b6de6]['variables'])){this[_0xfabd('0x18')][_0x4b6de6][_0xfabd('0x150')]={};}this['actions'][_0x4b6de6][_0xfabd('0x150')][_0x513ed4]=_0x4e91b6;}};Preview[_0xfabd('0x11')]['syncVarSet']=function(_0x255435){try{if(!_['isNil'](_0x255435)){if(ut[_0xfabd('0x151')](_['keys'](_0x255435[_0xfabd('0x152')])[0x0])){this[_0xfabd('0x14f')](_0x255435[_0xfabd('0xae')],_['keys'](_0x255435[_0xfabd('0x152')])[0x0],_0x255435[_0xfabd('0x153')]);}}}catch(_0xbee606){logger[_0xfabd('0x154')]('[syncVarSet][Preview]',util[_0xfabd('0x155')](_0xbee606,{'showHidden':![],'depth':null}));}};Preview[_0xfabd('0x11')][_0xfabd('0x156')]=function(_0x28984f){if(_0x28984f){if(this['actions'][_0x28984f['transfertargetlinkedid']]){this[_0xfabd('0x18')][_0x28984f[_0xfabd('0x157')]][_0xfabd('0x14c')]=!![];}}};Preview[_0xfabd('0x11')][_0xfabd('0x25')]=function(_0x11a303){if(_0x11a303){if(this['actions'][_0x11a303[_0xfabd('0x158')]]){this['actions'][_0x11a303[_0xfabd('0x158')]][_0xfabd('0x14c')]=!![];}}};module[_0xfabd('0x159')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 61e791e..cccee56 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 _0xfa09=['exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','createHistory','[createHistory]\x20','then','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerFinal','rescheduleContact','active','countReScheduled','[countReScheduled]\x20','unlockContact','[activeContact]\x20','crateCustomerReportQueue','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','context'];(function(_0x5466ab,_0x227b13){var _0x40751a=function(_0x477f9e){while(--_0x477f9e){_0x5466ab['push'](_0x5466ab['shift']());}};_0x40751a(++_0x227b13);}(_0xfa09,0x76));var _0x9fa0=function(_0x2e10e7,_0x1fed41){_0x2e10e7=_0x2e10e7-0x0;var _0x4250d8=_0xfa09[_0x2e10e7];return _0x4250d8;};'use strict';var util=require(_0x9fa0('0x0'));var BPromise=require('bluebird');var logger=require(_0x9fa0('0x1'))('preview');var _=require(_0x9fa0('0x2'));var cmHopper=require(_0x9fa0('0x3'));var cmHopperFinal=require(_0x9fa0('0x4'));var cmHopperHistory=require(_0x9fa0('0x5'));var cmHopperBlack=require(_0x9fa0('0x6'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x9fa0('0x7'));var voiceQueueReport=require(_0x9fa0('0x8'));function loggerCatch(_0x61535f){return function(_0x5b19d1){logger[_0x9fa0('0x9')](_0x61535f,util[_0x9fa0('0xa')](_0x5b19d1,{'showHidden':![],'depth':null}));};}function create(_0x5e7615){return BPromise[_0x9fa0('0xb')]()['then'](cmHopperHistory[_0x9fa0('0xc')](_0x5e7615))['catch'](loggerCatch(_0x9fa0('0xd')));}function createAgent(_0x174b76){return BPromise['resolve']()[_0x9fa0('0xe')](agentReportPreview[_0x9fa0('0xc')](_0x174b76))[_0x9fa0('0xf')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x3a3dee){return BPromise[_0x9fa0('0xb')]()[_0x9fa0('0xe')](cmHopper[_0x9fa0('0x10')](_0x3a3dee,!![]))[_0x9fa0('0xf')](loggerCatch(_0x9fa0('0x11')));}exports[_0x9fa0('0x12')]=function(_0x10f432){return BPromise[_0x9fa0('0xb')]()[_0x9fa0('0xe')](cmHopperBlack[_0x9fa0('0x12')](_0x10f432))['catch'](loggerCatch(_0x9fa0('0x13')));};exports[_0x9fa0('0x14')]=function(_0x5c258e){return BPromise['resolve']()[_0x9fa0('0xe')](cmHopper[_0x9fa0('0x14')](_0x5c258e))[_0x9fa0('0xf')](loggerCatch('[getContactPreview]\x20'));};exports[_0x9fa0('0xc')]=function(_0xa54b3d,_0x7c3d09){create(_0xa54b3d)['catch'](loggerCatch(_0x7c3d09));moveContact(_0xa54b3d)['catch'](loggerCatch(_0x7c3d09));};exports[_0x9fa0('0x15')]=function(_0x1e4a0e,_0x30b8cf){createAgent(_0x1e4a0e)[_0x9fa0('0xf')](loggerCatch(_0x30b8cf));};exports['createCustomerHistory']=function(_0xf89f19,_0x498070){create(_0xf89f19)['catch'](loggerCatch(_0x498070));};exports[_0x9fa0('0x16')]=function(_0xae6ea5,_0x148fdf){moveContact(_0xae6ea5)[_0x9fa0('0xf')](loggerCatch(_0x148fdf));};exports[_0x9fa0('0x17')]=function(_0x343997,_0x49ebec,_0x5d45c1){if(_0x49ebec){_0x343997['UserId']=null;}if(_0x5d45c1){_0x343997[_0x9fa0('0x18')]=![];}return BPromise[_0x9fa0('0xb')]()[_0x9fa0('0xe')](cmHopper['rescheduleContact'](_0x343997))[_0x9fa0('0xf')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x9fa0('0x19')]=function(_0x4c93ac){return BPromise[_0x9fa0('0xb')]()[_0x9fa0('0xe')](cmHopper[_0x9fa0('0x19')](_0x4c93ac))[_0x9fa0('0xf')](loggerCatch(_0x9fa0('0x1a')));};exports[_0x9fa0('0x1b')]=function(_0x3090f4){return BPromise[_0x9fa0('0xb')]()[_0x9fa0('0xe')](cmHopper['unlockContact']({'UserId':null},_0x3090f4,0x1))[_0x9fa0('0xf')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x33cb96){return BPromise[_0x9fa0('0xb')]()[_0x9fa0('0xe')](cmHopper[_0x9fa0('0x1b')]({'active':![]},_0x33cb96,0x1))[_0x9fa0('0xf')](loggerCatch(_0x9fa0('0x1c')));};exports[_0x9fa0('0x1d')]=function(_0x3ddfed){var _0x5d7604={};_0x5d7604['type']=_0x3ddfed['type'];_0x5d7604[_0x9fa0('0x1e')]=_0x3ddfed['uniqueid'];_0x5d7604[_0x9fa0('0x1f')]=_0x3ddfed[_0x9fa0('0x1f')];_0x5d7604['calleridname']=_0x3ddfed[_0x9fa0('0x20')];_0x5d7604['queue']=_0x3ddfed[_0x9fa0('0x21')];_0x5d7604[_0x9fa0('0x22')]=_0x3ddfed['answertime'];_0x5d7604[_0x9fa0('0x23')]=_0x3ddfed['answertime'];_0x5d7604[_0x9fa0('0x24')]=0x1;_0x5d7604[_0x9fa0('0x25')]=_0x3ddfed[_0x9fa0('0x26')];_0x5d7604[_0x9fa0('0x27')]=_0x3ddfed['membername'];_0x5d7604[_0x9fa0('0x28')]='from-sip';_0x5d7604[_0x9fa0('0x29')]=_0x9fa0('0x2a');_0x5d7604[_0x9fa0('0x2b')]=0x0;_0x5d7604[_0x9fa0('0x2c')]=0x1;_0x5d7604[_0x9fa0('0x2d')]=_0x3ddfed[_0x9fa0('0x2e')];_0x5d7604[_0x9fa0('0x2f')]=_0x9fa0('0x30');return BPromise[_0x9fa0('0xb')]()[_0x9fa0('0xe')](voiceQueueReport['create'](_0x5d7604))[_0x9fa0('0xf')](loggerCatch(_0x9fa0('0x31')));};exports[_0x9fa0('0x32')]=function(_0x24009c,_0x87e165){return BPromise['resolve']()[_0x9fa0('0xe')](cmHopper[_0x9fa0('0x32')](_0x24009c,_0x87e165))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x9fa0('0x33')]=function(_0x428080){return BPromise[_0x9fa0('0xb')]()[_0x9fa0('0xe')](cmHopper[_0x9fa0('0x17')](_0x428080,!![],!![]))[_0x9fa0('0xf')](loggerCatch(_0x9fa0('0x34')));}; \ No newline at end of file +var _0xa895=['queuecallercomplete','queuecallercompleteAt','connectedlinename','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','COMPLETED','getContactRecallMe','util','bluebird','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','catch','[createHistory]\x20','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','active','countReScheduled','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime'];(function(_0x1f6cb9,_0x4bbdbb){var _0x493b0e=function(_0x1a20cc){while(--_0x1a20cc){_0x1f6cb9['push'](_0x1f6cb9['shift']());}};_0x493b0e(++_0x4bbdbb);}(_0xa895,0x70));var _0x5a89=function(_0x27d2aa,_0x5a595c){_0x27d2aa=_0x27d2aa-0x0;var _0x46c5ab=_0xa895[_0x27d2aa];return _0x46c5ab;};'use strict';var util=require(_0x5a89('0x0'));var BPromise=require(_0x5a89('0x1'));var logger=require('../../../config/logger')('preview');var _=require(_0x5a89('0x2'));var cmHopper=require(_0x5a89('0x3'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x5a89('0x4'));var cmHopperBlack=require(_0x5a89('0x5'));var voiceQueueRt=require(_0x5a89('0x6'));var agentReportPreview=require(_0x5a89('0x7'));var voiceQueueReport=require(_0x5a89('0x8'));function loggerCatch(_0x34146e){return function(_0x4bece0){logger[_0x5a89('0x9')](_0x34146e,util[_0x5a89('0xa')](_0x4bece0,{'showHidden':![],'depth':null}));};}function create(_0x5f401d){return BPromise[_0x5a89('0xb')]()[_0x5a89('0xc')](cmHopperHistory['createHistory'](_0x5f401d))[_0x5a89('0xd')](loggerCatch(_0x5a89('0xe')));}function createAgent(_0x16e8f4){return BPromise[_0x5a89('0xb')]()[_0x5a89('0xc')](agentReportPreview[_0x5a89('0xf')](_0x16e8f4))[_0x5a89('0xd')](loggerCatch(_0x5a89('0xe')));}function moveContact(_0x2b742e){return BPromise['resolve']()[_0x5a89('0xc')](cmHopper[_0x5a89('0x10')](_0x2b742e,!![]))[_0x5a89('0xd')](loggerCatch(_0x5a89('0x11')));}exports[_0x5a89('0x12')]=function(_0x13624a){return BPromise[_0x5a89('0xb')]()[_0x5a89('0xc')](cmHopperBlack[_0x5a89('0x12')](_0x13624a))[_0x5a89('0xd')](loggerCatch(_0x5a89('0x13')));};exports['getContactPreview']=function(_0x31f749){return BPromise[_0x5a89('0xb')]()[_0x5a89('0xc')](cmHopper[_0x5a89('0x14')](_0x31f749))[_0x5a89('0xd')](loggerCatch(_0x5a89('0x15')));};exports[_0x5a89('0xf')]=function(_0x3fe255,_0x5d83a1){create(_0x3fe255)[_0x5a89('0xd')](loggerCatch(_0x5d83a1));moveContact(_0x3fe255)[_0x5a89('0xd')](loggerCatch(_0x5d83a1));};exports[_0x5a89('0x16')]=function(_0x99b8f7,_0x409fb5){createAgent(_0x99b8f7)[_0x5a89('0xd')](loggerCatch(_0x409fb5));};exports[_0x5a89('0x17')]=function(_0x41b95c,_0x8de899){create(_0x41b95c)['catch'](loggerCatch(_0x8de899));};exports[_0x5a89('0x18')]=function(_0x56f6fc,_0x4b0019){moveContact(_0x56f6fc)[_0x5a89('0xd')](loggerCatch(_0x4b0019));};exports[_0x5a89('0x19')]=function(_0x551687,_0x102164,_0x22373b){if(_0x102164){_0x551687['UserId']=null;}if(_0x22373b){_0x551687[_0x5a89('0x1a')]=![];}return BPromise['resolve']()['then'](cmHopper[_0x5a89('0x19')](_0x551687))[_0x5a89('0xd')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x5a89('0x1b')]=function(_0x4c14e5){return BPromise[_0x5a89('0xb')]()[_0x5a89('0xc')](cmHopper[_0x5a89('0x1b')](_0x4c14e5))[_0x5a89('0xd')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x31bff8){return BPromise[_0x5a89('0xb')]()[_0x5a89('0xc')](cmHopper[_0x5a89('0x1c')]({'UserId':null},_0x31bff8,0x1))[_0x5a89('0xd')](loggerCatch(_0x5a89('0x1d')));};exports['disableContact']=function(_0x1bb510){return BPromise[_0x5a89('0xb')]()[_0x5a89('0xc')](cmHopper[_0x5a89('0x1c')]({'active':![]},_0x1bb510,0x1))[_0x5a89('0xd')](loggerCatch(_0x5a89('0x1e')));};exports[_0x5a89('0x1f')]=function(_0x4275d8){var _0x34cfdd={};_0x34cfdd['type']=_0x4275d8[_0x5a89('0x20')];_0x34cfdd[_0x5a89('0x21')]=_0x4275d8[_0x5a89('0x21')];_0x34cfdd[_0x5a89('0x22')]=_0x4275d8['calleridnum'];_0x34cfdd[_0x5a89('0x23')]=_0x4275d8[_0x5a89('0x23')];_0x34cfdd['queue']=_0x4275d8[_0x5a89('0x24')];_0x34cfdd['queuecallerjoinAt']=_0x4275d8[_0x5a89('0x25')];_0x34cfdd['queuecallerleaveAt']=_0x4275d8[_0x5a89('0x25')];_0x34cfdd[_0x5a89('0x26')]=0x1;_0x34cfdd[_0x5a89('0x27')]=_0x4275d8['endtime'];_0x34cfdd[_0x5a89('0x28')]=_0x4275d8['membername'];_0x34cfdd[_0x5a89('0x29')]=_0x5a89('0x2a');_0x34cfdd[_0x5a89('0x2b')]=_0x5a89('0x2c');_0x34cfdd[_0x5a89('0x2d')]=0x0;_0x34cfdd[_0x5a89('0x2e')]=0x1;_0x34cfdd[_0x5a89('0x2f')]=_0x4275d8['membername'];_0x34cfdd['queuecallerexitreason']=_0x5a89('0x30');return BPromise[_0x5a89('0xb')]()['then'](voiceQueueReport['create'](_0x34cfdd))[_0x5a89('0xd')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x5a89('0x31')]=function(_0x43e673,_0x1be2f3){return BPromise['resolve']()[_0x5a89('0xc')](cmHopper[_0x5a89('0x31')](_0x43e673,_0x1be2f3))[_0x5a89('0xd')](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x9e5877){return BPromise[_0x5a89('0xb')]()[_0x5a89('0xc')](cmHopper[_0x5a89('0x19')](_0x9e5877,!![],!![]))[_0x5a89('0xd')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 25e2283..4536636 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 _0x2b3e=['format','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','updatedAt','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','endtime','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','uniqueid','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','cloneAction','clone','Global','active','scheduledat','add','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','reachable','getDiff','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','countcongestionretry','countglobal','callback','callbackuniqueid','callbackat','recallme','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosloss','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','util','lodash','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','inspect','logger','error','logger2','info','getCallerId','isUndefined','isEmpty','string','\x22%s\x22\x20<%s>'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x2b3e,0x19d));var _0xe2b3=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x2b3e[_0x5c351c];return _0x26f3b3;};'use strict';var util=require(_0xe2b3('0x0'));var _=require(_0xe2b3('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')(_0xe2b3('0x2'));var ipAgi=process[_0xe2b3('0x3')][_0xe2b3('0x4')]||_0xe2b3('0x5');function getSeconds(_0x20d17e,_0x37f822){var _0x4e8248=moment(_0x20d17e)['milliseconds'](0x0);var _0x240d35=moment(_0x37f822)[_0xe2b3('0x6')](0x0);return _0x4e8248[_0xe2b3('0x7')](_0x240d35,_0xe2b3('0x8'));}exports['loggerCatch']=function(_0x3fb724){return function(_0x399b17){logger['error'](_0x3fb724,util[_0xe2b3('0x9')](_0x399b17,{'showHidden':![],'depth':null}));};};exports[_0xe2b3('0xa')]=function(_0x3c455d,_0xeef479){logger['info'](_0x3c455d,util[_0xe2b3('0x9')](_0xeef479,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x23eb05,_0x194a0b){logger[_0xe2b3('0xb')](_0x23eb05,util[_0xe2b3('0x9')](_0x194a0b,{'showHidden':![],'depth':null}));};exports[_0xe2b3('0xc')]=function(_0xe59762){return function(_0x211bea){logger[_0xe2b3('0xd')](_0xe59762,util[_0xe2b3('0x9')](_0x211bea,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x556aeb,_0x4a1df7,_0x5a167){return{'message':_0x556aeb,'unlock':_0x4a1df7,'active':_0x5a167};};exports[_0xe2b3('0xe')]=function(_0x30b6af,_0x2b4cf8,_0x4fbf3e){if(!_[_0xe2b3('0xf')](_0x4fbf3e)&&'string'===typeof _0x4fbf3e&&!_[_0xe2b3('0x10')](_0x4fbf3e)){if(!_[_0xe2b3('0xf')](_0x2b4cf8)&&_0xe2b3('0x11')===typeof _0x2b4cf8&&!_['isEmpty'](_0x2b4cf8)){return util['format'](_0xe2b3('0x12'),_0x2b4cf8,_0x4fbf3e);}return util[_0xe2b3('0x13')]('\x22%s\x22\x20<%s>',_0x4fbf3e,_0x4fbf3e);}if(!_[_0xe2b3('0xf')](_0x30b6af)&&_0xe2b3('0x11')===typeof _0x30b6af&&!_['isEmpty'](_0x30b6af)){return _0x30b6af;}return _0xe2b3('0x14');};exports[_0xe2b3('0x15')]=function(_0x293609){if(_[_0xe2b3('0x16')](_0x293609)){return![];}return _0x293609;};exports[_0xe2b3('0x17')]=function(_0x4f8dc2,_0x2be64d,_0x1971c9,_0x3cc1c2,_0x39c3c5,_0x4a8cec){var _0x23ee53={'XMD-QUEUE':_0x2be64d[_0xe2b3('0x18')]?_0x2be64d[_0xe2b3('0x18')][_0xe2b3('0x19')]:'','XMD-CALLERID':_0x3cc1c2,'XMD-CALLERID-PREVIEW':_0x4a8cec?util[_0xe2b3('0x13')]('\x22%s\x22\x20<%s>',_0x4a8cec[_0xe2b3('0x1a')],_0x4a8cec[_0xe2b3('0x1b')]):_0x3cc1c2,'XMD-DIALID':_0x39c3c5,'XMD-CONTACTID':_0x2be64d['ContactId'],'XMD-CDRTYPE':_0xe2b3('0x1c'),'CALLERID(all)':_0x3cc1c2,'XMD-VOICEQUEUEID':_0x2be64d[_0xe2b3('0x1d')],'XMD-DIALCHANNEL':_0x1971c9,'XMD-DIALTIMEOUT':_0x4f8dc2['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xe2b3('0x13')](_0xe2b3('0x1e'),_0x4f8dc2[_0xe2b3('0x1f')]?'g':'',_[_0xe2b3('0x10')](_0x4f8dc2[_0xe2b3('0x20')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x4f8dc2[_0xe2b3('0x21')]||'','XMD-AGI':_0x4f8dc2['dialQueueProject']?util[_0xe2b3('0x13')](_0xe2b3('0x22'),ipAgi,_0x4f8dc2[_0xe2b3('0x23')]):_0xe2b3('0x24'),'XMD-AGIAFTER':_0x4f8dc2[_0xe2b3('0x1f')]?util['format'](_0xe2b3('0x22'),ipAgi,_0x4f8dc2['dialQueueProject2']):_0xe2b3('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x4a8cec?_0x4a8cec['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x4a8cec?_0x4a8cec[_0xe2b3('0x25')]:'','XMD-DESTINATION':_0xe2b3('0x26')};if(!_[_0xe2b3('0x10')](_0x4f8dc2['monitor_format'])){_0x23ee53[util[_0xe2b3('0x13')]('%s',_0xe2b3('0x27'))]=_0x4f8dc2[_0xe2b3('0x20')];_0x23ee53[util[_0xe2b3('0x13')]('%s',_0xe2b3('0x28'))]=_0x39c3c5;}if(_0x2be64d&&_0x2be64d[_0xe2b3('0x29')]){for(var _0x1cd113 in _0x2be64d[_0xe2b3('0x29')]){if(_0x2be64d['Contact'][_0xe2b3('0x2a')](_0x1cd113)){if(!_[_0xe2b3('0x16')](_0x2be64d[_0xe2b3('0x29')][_0x1cd113])&&_0x1cd113!=='id'&&_0x1cd113!=='tags'&&_0x1cd113!==_0xe2b3('0x2b')&&_0x1cd113!==_0xe2b3('0x2c')){_0x23ee53[util[_0xe2b3('0x13')]('%s%s',_0xe2b3('0x2d'),_[_0xe2b3('0x2e')](_0x1cd113))]=_0x2be64d['Contact'][_0x1cd113];}}}}return _0x23ee53;};exports[_0xe2b3('0x2f')]=function(_0x3c38bd){var _0x14e480={};for(var _0x208d45 in _0x3c38bd){if(_0x3c38bd[_0xe2b3('0x2a')](_0x208d45)){_0x14e480[util['format']('%s',_[_0xe2b3('0x30')](_0x208d45))]=_0x3c38bd[_0x208d45];}}return{'variables':_0x14e480};};exports[_0xe2b3('0x31')]=function(_0x1a7dfb,_0x344a78){if(!_['isNil'](_0x1a7dfb)){if(_0x1a7dfb[_0xe2b3('0x2a')](_0xe2b3('0x32'))){if(_0x1a7dfb[_0xe2b3('0x32')]>0x0){_0x1a7dfb[_0xe2b3('0x32')]-=0x1;}else{logger[_0xe2b3('0xb')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x344a78);}}}else{logger[_0xe2b3('0xb')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x344a78);}};exports[_0xe2b3('0x33')]=function(_0x1cff5c){var _0x2a1893=moment()[_0xe2b3('0x13')](_0xe2b3('0x34'));_0x1cff5c[_0xe2b3('0x35')]=0xd;_0x1cff5c[_0xe2b3('0x36')]='Blacklist';_0x1cff5c[_0xe2b3('0x37')]=_0x2a1893;_0x1cff5c[_0xe2b3('0x38')]=_0x2a1893;_0x1cff5c[_0xe2b3('0x39')]=_0x2a1893;};exports['logAgent']=function(_0x48fb83,_0x2126f4,_0xe350e5){var _0x190b86=moment()[_0xe2b3('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x48fb83[_0xe2b3('0x35')]=_0x2126f4;_0x48fb83[_0xe2b3('0x36')]=_0xe350e5;_0x48fb83['responsetime']=_0x190b86;_0x48fb83[_0xe2b3('0x3a')]=getSeconds(_0x48fb83[_0xe2b3('0x38')],_0x48fb83[_0xe2b3('0x37')]);};exports[_0xe2b3('0x3b')]=function(_0x4e72c7,_0x513704,_0x2858e8){_0x4e72c7[_0xe2b3('0x3c')]=_0x513704;_0x4e72c7[_0xe2b3('0x3d')]=_0x2858e8;};exports[_0xe2b3('0x3e')]=function(_0x406e70,_0x3e867b,_0x2ebbae){var _0x3e555d=moment()[_0xe2b3('0x13')](_0xe2b3('0x34'));_0x406e70['state']=_0x3e867b;_0x406e70[_0xe2b3('0x36')]=_0x2ebbae;_0x406e70[_0xe2b3('0x38')]=_0x406e70[_0xe2b3('0x38')]?_0x406e70[_0xe2b3('0x38')]:_0x3e555d;_0x406e70[_0xe2b3('0x39')]=_0x406e70['endtime']?_0x406e70[_0xe2b3('0x39')]:_0x3e555d;_0x406e70[_0xe2b3('0x3a')]=getSeconds(_0x406e70[_0xe2b3('0x38')]||0x0,_0x406e70[_0xe2b3('0x37')]||0x0);_0x406e70[_0xe2b3('0x3f')]=_0x406e70['answertime']?getSeconds(_0x406e70[_0xe2b3('0x39')],_0x406e70[_0xe2b3('0x40')]):0x0;};exports[_0xe2b3('0x41')]=function(_0x62df74){return _0x62df74===_0xe2b3('0x42');};exports[_0xe2b3('0x43')]=function(_0x16ce50,_0x24e093,_0x4fdb0f,_0x433b3d,_0x3e9360){var _0x4fb073=_0x433b3d?'RECALL':_0x16ce50['calleridname'];_0x4fb073=_0x3e9360?'BOOKED':_0x4fb073;return{'actionid':_0x16ce50[_0xe2b3('0x44')],'action':'originate','channel':_0x16ce50[_0xe2b3('0x45')],'callerid':util['format'](_0xe2b3('0x12'),_0x4fb073,_0x16ce50[_0xe2b3('0x1b')]),'Exten':_0xe2b3('0x26'),'Context':_0xe2b3('0x46'),'Priority':'1','variable':_0x4fdb0f,'timeout':(_0x24e093[_0xe2b3('0x47')]||0x1e)*0x3e8,'async':!![],'channelid':_0x16ce50[_0xe2b3('0x44')]};};exports[_0xe2b3('0x48')]=function(_0x24457b){return _0x24457b[_0xe2b3('0x49')]+_0x24457b['countcongestionretry']+_0x24457b[_0xe2b3('0x4a')]+_0x24457b[_0xe2b3('0x4b')]+_0x24457b['countnosuchnumberretry'];};exports[_0xe2b3('0x4c')]=function(_0x3287d5){var _0x298323=_[_0xe2b3('0x4d')](_0x3287d5);_0x298323['state']=0xf;_0x298323['statedesc']=_0xe2b3('0x4e');return _0x298323;};exports['scheduledAt']=function(_0x1cc69d,_0x2a20f2,_0x5050a5){var _0x8bb104={};_0x8bb104[_0x2a20f2]=_0x1cc69d[_0x2a20f2];_0x8bb104[_0xe2b3('0x4f')]=![];_0x8bb104[_0xe2b3('0x50')]=moment()[_0xe2b3('0x51')](_0x5050a5,_0xe2b3('0x52'))[_0xe2b3('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x8bb104['ContactId']=_0x1cc69d[_0xe2b3('0x53')];_0x8bb104[_0xe2b3('0x54')]=_0x1cc69d['ListId'];_0x8bb104['VoiceQueueId']=_0x1cc69d[_0xe2b3('0x1d')]||undefined;return _0x8bb104;};exports[_0xe2b3('0x55')]=function(_0xa964da,_0x16897c){if(!_[_0xe2b3('0x16')](_0xa964da)){if(_0xa964da[_0xe2b3('0x56')]>0x0){_0xa964da[_0xe2b3('0x56')]-=0x1;}else{logger[_0xe2b3('0xb')](_0x16897c,_0xe2b3('0x57'));}}else{logger[_0xe2b3('0xb')](_0x16897c,_0xe2b3('0x58'));}};exports[_0xe2b3('0x59')]=function(_0x163cc1){if(_0x163cc1<=0x0){return!![];}return![];};exports[_0xe2b3('0x5a')]=function(_0x43a61c,_0x39f78a,_0xb5a6de){_0x43a61c[_0xe2b3('0x5b')]=_0x39f78a;_0x43a61c[_0xe2b3('0x19')]=_0x43a61c[_0xe2b3('0x5c')];_0x43a61c[_0xe2b3('0x5d')]=_0x43a61c[_0xe2b3('0x45')];_0x43a61c[_0xe2b3('0x5e')]=_0xe2b3('0x5f');if(_0xb5a6de){_0x43a61c[_0xe2b3('0x60')]=_0xb5a6de[_0xe2b3('0x60')];}return _0x43a61c;};exports[_0xe2b3('0x61')]=function(_0x10bee0){var _0x3c41ad={};_0x3c41ad[_0xe2b3('0x5c')]=_0x10bee0[_0xe2b3('0x5c')];_0x3c41ad[_0xe2b3('0x5d')]=_0x10bee0['channelAgent'];_0x3c41ad[_0xe2b3('0x44')]=_0x10bee0[_0xe2b3('0x44')];return _0x3c41ad;};exports[_0xe2b3('0x62')]=function(_0xe05379){var _0x5d3c1a=[];for(var _0x2f7ab6 in _0xe05379){if(_0xe05379[_0xe2b3('0x2a')](_0x2f7ab6)){if(!_[_0xe2b3('0x16')](_0xe05379[_0x2f7ab6])&&_0xe05379[_0x2f7ab6]['state']===_0xe2b3('0x63')&&_0xe05379[_0x2f7ab6]['status']===_0xe2b3('0x64')){_0x5d3c1a['push'](_0xe05379[_0x2f7ab6]['id']);}}}return _0x5d3c1a;};exports[_0xe2b3('0x65')]=function(_0x5041d9){var _0x503223=moment()[_0xe2b3('0x6')](0x0);var _0x3fb85d=moment(_0x5041d9)[_0xe2b3('0x6')](0x0);return _0x503223[_0xe2b3('0x7')](_0x3fb85d,'seconds');};exports[_0xe2b3('0x66')]=function(_0x55c295){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x55c295[_0xe2b3('0x53')],'ListId':_0x55c295['ListId'],'VoiceQueueId':_0x55c295[_0xe2b3('0x1d')]||undefined,'CampaignId':_0x55c295[_0xe2b3('0x67')]||undefined};};exports[_0xe2b3('0x68')]=function(_0x48736c){if(_0x48736c===_0xe2b3('0x44')||_0x48736c===_0xe2b3('0x69')||_0x48736c===_0xe2b3('0x5c')||_0x48736c===_0xe2b3('0x6a')||_0x48736c===_0xe2b3('0x6b')||_0x48736c===_0xe2b3('0x6c')||_0x48736c===_0xe2b3('0x3c')||_0x48736c==='channelAgent'||_0x48736c==='calleridname'||_0x48736c===_0xe2b3('0x4f')||_0x48736c===_0xe2b3('0x1b')||_0x48736c===_0xe2b3('0x50')||_0x48736c===_0xe2b3('0x49')||_0x48736c===_0xe2b3('0x6d')||_0x48736c===_0xe2b3('0x4a')||_0x48736c===_0xe2b3('0x6e')||_0x48736c===_0xe2b3('0x6f')||_0x48736c===_0xe2b3('0x70')||_0x48736c===_0xe2b3('0x71')||_0x48736c===_0xe2b3('0x72')||_0x48736c===_0xe2b3('0x53')||_0x48736c===_0xe2b3('0x54')||_0x48736c===_0xe2b3('0x3d')||_0x48736c===_0xe2b3('0x1d')||_0x48736c==='sipcallid'||_0x48736c==='xmd-voicequeueid'||_0x48736c===_0xe2b3('0x73')||_0x48736c===_0xe2b3('0x74')||_0x48736c===_0xe2b3('0x75')||_0x48736c===_0xe2b3('0x76')||_0x48736c===_0xe2b3('0x77')||_0x48736c===_0xe2b3('0x78')||_0x48736c===_0xe2b3('0x79')||_0x48736c===_0xe2b3('0x7a')||_0x48736c==='xmd-contactid'||_0x48736c===_0xe2b3('0x7b')||_0x48736c===_0xe2b3('0x7c')||_0x48736c===_0xe2b3('0x7d')||_0x48736c===_0xe2b3('0x7e')||_0x48736c===_0xe2b3('0x7f')||_0x48736c===_0xe2b3('0x80')||_0x48736c===_0xe2b3('0x81')||_0x48736c===_0xe2b3('0x82')||_0x48736c==='rtpaudioqosloss'||_0x48736c===_0xe2b3('0x83')||_0x48736c===_0xe2b3('0x84')||_0x48736c===_0xe2b3('0x85')||_0x48736c===_0xe2b3('0x7f')||_0x48736c==='rtpaudioqosbridged'||_0x48736c==='rtpaudioqosjitter'||_0x48736c===_0xe2b3('0x82')||_0x48736c===_0xe2b3('0x86')||_0x48736c===_0xe2b3('0x83')||_0x48736c==='rtpaudioqosrtt'||_0x48736c===_0xe2b3('0x85')||_0x48736c===_0xe2b3('0x87')||_0x48736c===_0xe2b3('0x88')||_0x48736c===_0xe2b3('0x35')||_0x48736c===_0xe2b3('0x36')){return![];}return!![];};exports[_0xe2b3('0x89')]=function(_0x13505f,_0x2778d3){var _0x1ebce1,_0x1b8607,_0x4661b6;if(_0x2778d3<=0x0){_0x2778d3=0x1;}_0x1ebce1=new RegExp(_0xe2b3('0x8a')+_0x2778d3+'}$');_0x1b8607=Math[_0xe2b3('0x8b')](0xa,_0x2778d3-0x1);_0x4661b6=Math[_0xe2b3('0x8b')](0xa,_0x2778d3)-0x1;return util[_0xe2b3('0x13')]('%s',_[_0xe2b3('0x8c')](_0x13505f,_0x1ebce1,_['random'](_0x1b8607,_0x4661b6)));};exports[_0xe2b3('0x8d')]=function(_0xfd2e37){var _0x2abe69=_0xfd2e37[_0xe2b3('0x8e')](/"(.*?)"/);return _0x2abe69?_0x2abe69[0x1]:_0xfd2e37;};exports[_0xe2b3('0x8f')]=function(_0x2719b2){var _0x44f193=_0x2719b2[_0xe2b3('0x8e')](/<(.*?)>/);return _0x44f193?_0x44f193[0x1]:_0x2719b2;}; \ No newline at end of file +var _0x5604=['isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridname','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','responsetime','logAgent','state','ringtime','starttime','logLookAgent','membername','UserId','endtime','talktime','answertime','Failure','variablesAction','RECALL','BOOKED','originate','channelAgent','xcally-motion-preview','from-sip','timeout','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','active','scheduledat','add','ListId','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','queue','interface','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff','seconds','filterKey','idContact','type','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','random','extractCalleridName','match','util','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','loggerCatch','error','inspect','logger','loggerError','logger2','info','message','getCallerId','string','isEmpty','format','\x22%s\x22\x20<%s>','isUndefined','\x22\x22\x20<>','isActive'];(function(_0x3e18bf,_0x387f5e){var _0x1022e5=function(_0x242ec4){while(--_0x242ec4){_0x3e18bf['push'](_0x3e18bf['shift']());}};_0x1022e5(++_0x387f5e);}(_0x5604,0x10b));var _0x4560=function(_0x3c51d4,_0x36ba53){_0x3c51d4=_0x3c51d4-0x0;var _0x53c45f=_0x5604[_0x3c51d4];return _0x53c45f;};'use strict';var util=require(_0x4560('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0x4560('0x1'))('preview');var ipAgi=process[_0x4560('0x2')][_0x4560('0x3')]||_0x4560('0x4');function getSeconds(_0x28349f,_0x4a93c6){var _0x4fd519=moment(_0x28349f)[_0x4560('0x5')](0x0);var _0x44b013=moment(_0x4a93c6)[_0x4560('0x5')](0x0);return _0x4fd519[_0x4560('0x6')](_0x44b013,'seconds');}exports[_0x4560('0x7')]=function(_0x475b34){return function(_0x4ef63f){logger[_0x4560('0x8')](_0x475b34,util[_0x4560('0x9')](_0x4ef63f,{'showHidden':![],'depth':null}));};};exports[_0x4560('0xa')]=function(_0x1c3fe6,_0x57b785){logger['info'](_0x1c3fe6,util['inspect'](_0x57b785,{'showHidden':![],'depth':null}));};exports[_0x4560('0xb')]=function(_0x239b20,_0x236f55){logger[_0x4560('0x8')](_0x239b20,util[_0x4560('0x9')](_0x236f55,{'showHidden':![],'depth':null}));};exports[_0x4560('0xc')]=function(_0x186e37){return function(_0x216e9c){logger[_0x4560('0xd')](_0x186e37,util['inspect'](_0x216e9c,{'showHidden':![],'depth':null}));};};exports[_0x4560('0xe')]=function(_0x18a422,_0x83ae9b,_0x4e9ddd){return{'message':_0x18a422,'unlock':_0x83ae9b,'active':_0x4e9ddd};};exports[_0x4560('0xf')]=function(_0x141ddd,_0x26b531,_0x207364){if(!_['isUndefined'](_0x207364)&&_0x4560('0x10')===typeof _0x207364&&!_[_0x4560('0x11')](_0x207364)){if(!_['isUndefined'](_0x26b531)&&'string'===typeof _0x26b531&&!_[_0x4560('0x11')](_0x26b531)){return util[_0x4560('0x12')](_0x4560('0x13'),_0x26b531,_0x207364);}return util[_0x4560('0x12')](_0x4560('0x13'),_0x207364,_0x207364);}if(!_[_0x4560('0x14')](_0x141ddd)&&_0x4560('0x10')===typeof _0x141ddd&&!_['isEmpty'](_0x141ddd)){return _0x141ddd;}return _0x4560('0x15');};exports[_0x4560('0x16')]=function(_0x480f84){if(_[_0x4560('0x17')](_0x480f84)){return![];}return _0x480f84;};exports[_0x4560('0x18')]=function(_0x3b522b,_0x17c945,_0x4648b7,_0x3710c6,_0x56bb29,_0x514fa9){var _0x34e331={'XMD-QUEUE':_0x17c945['Queue']?_0x17c945[_0x4560('0x19')][_0x4560('0x1a')]:'','XMD-CALLERID':_0x3710c6,'XMD-CALLERID-PREVIEW':_0x514fa9?util['format'](_0x4560('0x13'),_0x514fa9[_0x4560('0x1b')],_0x514fa9[_0x4560('0x1c')]):_0x3710c6,'XMD-DIALID':_0x56bb29,'XMD-CONTACTID':_0x17c945[_0x4560('0x1d')],'XMD-CDRTYPE':_0x4560('0x1e'),'CALLERID(all)':_0x3710c6,'XMD-VOICEQUEUEID':_0x17c945[_0x4560('0x1f')],'XMD-DIALCHANNEL':_0x4648b7,'XMD-DIALTIMEOUT':_0x3b522b[_0x4560('0x20')]||0x1e,'XMD-DIALOPTIONS':util[_0x4560('0x12')](_0x4560('0x21'),_0x3b522b[_0x4560('0x22')]?'g':'',_[_0x4560('0x11')](_0x3b522b[_0x4560('0x23')])?'':_0x4560('0x24')),'XMD-DIALURL':_0x3b522b[_0x4560('0x25')]||'','XMD-AGI':_0x3b522b[_0x4560('0x26')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x3b522b[_0x4560('0x26')]):_0x4560('0x27'),'XMD-AGIAFTER':_0x3b522b[_0x4560('0x22')]?util[_0x4560('0x12')](_0x4560('0x28'),ipAgi,_0x3b522b[_0x4560('0x22')]):_0x4560('0x27'),'XMD-ORIGINATECALLERIDNUM':_0x514fa9?_0x514fa9['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x514fa9?_0x514fa9[_0x4560('0x29')]:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0x4560('0x11')](_0x3b522b['monitor_format'])){_0x34e331[util[_0x4560('0x12')]('%s',_0x4560('0x2a'))]=_0x3b522b[_0x4560('0x23')];_0x34e331[util[_0x4560('0x12')]('%s',_0x4560('0x2b'))]=_0x56bb29;}if(_0x17c945&&_0x17c945[_0x4560('0x2c')]){for(var _0x48ebfd in _0x17c945[_0x4560('0x2c')]){if(_0x17c945[_0x4560('0x2c')][_0x4560('0x2d')](_0x48ebfd)){if(!_[_0x4560('0x17')](_0x17c945[_0x4560('0x2c')][_0x48ebfd])&&_0x48ebfd!=='id'&&_0x48ebfd!==_0x4560('0x2e')&&_0x48ebfd!==_0x4560('0x2f')&&_0x48ebfd!==_0x4560('0x30')){_0x34e331[util['format'](_0x4560('0x31'),_0x4560('0x32'),_[_0x4560('0x33')](_0x48ebfd))]=_0x17c945[_0x4560('0x2c')][_0x48ebfd];}}}}return _0x34e331;};exports['toLowerVariables']=function(_0x5acefe){var _0x246565={};for(var _0x1ef3eb in _0x5acefe){if(_0x5acefe[_0x4560('0x2d')](_0x1ef3eb)){_0x246565[util['format']('%s',_[_0x4560('0x34')](_0x1ef3eb))]=_0x5acefe[_0x1ef3eb];}}return{'variables':_0x246565};};exports[_0x4560('0x35')]=function(_0x190f93,_0x2cf025){if(!_['isNil'](_0x190f93)){if(_0x190f93[_0x4560('0x2d')](_0x4560('0x36'))){if(_0x190f93['originated']>0x0){_0x190f93[_0x4560('0x36')]-=0x1;}else{logger[_0x4560('0x8')](_0x4560('0x37'),_0x2cf025);}}}else{logger[_0x4560('0x8')](_0x4560('0x38'),_0x2cf025);}};exports['logBlacklist']=function(_0x9b4a69){var _0x27f280=moment()[_0x4560('0x12')](_0x4560('0x39'));_0x9b4a69['state']=0xd;_0x9b4a69[_0x4560('0x3a')]=_0x4560('0x3b');_0x9b4a69['starttime']=_0x27f280;_0x9b4a69[_0x4560('0x3c')]=_0x27f280;_0x9b4a69['endtime']=_0x27f280;};exports[_0x4560('0x3d')]=function(_0x414992,_0x251ecb,_0x4accf1){var _0x20462d=moment()[_0x4560('0x12')](_0x4560('0x39'));_0x414992[_0x4560('0x3e')]=_0x251ecb;_0x414992[_0x4560('0x3a')]=_0x4accf1;_0x414992[_0x4560('0x3c')]=_0x20462d;_0x414992[_0x4560('0x3f')]=getSeconds(_0x414992['responsetime'],_0x414992[_0x4560('0x40')]);};exports[_0x4560('0x41')]=function(_0x47d0a2,_0x383872,_0x32e92a){_0x47d0a2[_0x4560('0x42')]=_0x383872;_0x47d0a2[_0x4560('0x43')]=_0x32e92a;};exports['logCustomer']=function(_0x4843f7,_0x13f3c1,_0x395a85){var _0x4bc16e=moment()[_0x4560('0x12')](_0x4560('0x39'));_0x4843f7['state']=_0x13f3c1;_0x4843f7[_0x4560('0x3a')]=_0x395a85;_0x4843f7[_0x4560('0x3c')]=_0x4843f7[_0x4560('0x3c')]?_0x4843f7[_0x4560('0x3c')]:_0x4bc16e;_0x4843f7[_0x4560('0x44')]=_0x4843f7[_0x4560('0x44')]?_0x4843f7['endtime']:_0x4bc16e;_0x4843f7['ringtime']=getSeconds(_0x4843f7['responsetime']||0x0,_0x4843f7[_0x4560('0x40')]||0x0);_0x4843f7[_0x4560('0x45')]=_0x4843f7['answertime']?getSeconds(_0x4843f7[_0x4560('0x44')],_0x4843f7[_0x4560('0x46')]):0x0;};exports['isFailure']=function(_0x2783f3){return _0x2783f3===_0x4560('0x47');};exports[_0x4560('0x48')]=function(_0x5dbafa,_0x84fc8b,_0xd03188,_0x36420f,_0x576408){var _0x66eb77=_0x36420f?_0x4560('0x49'):_0x5dbafa['calleridname'];_0x66eb77=_0x576408?_0x4560('0x4a'):_0x66eb77;return{'actionid':_0x5dbafa['uniqueid'],'action':_0x4560('0x4b'),'channel':_0x5dbafa[_0x4560('0x4c')],'callerid':util[_0x4560('0x12')](_0x4560('0x13'),_0x66eb77,_0x5dbafa[_0x4560('0x1c')]),'Exten':_0x4560('0x4d'),'Context':_0x4560('0x4e'),'Priority':'1','variable':_0xd03188,'timeout':(_0x84fc8b[_0x4560('0x4f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5dbafa[_0x4560('0x50')]};};exports[_0x4560('0x51')]=function(_0x56810c){return _0x56810c[_0x4560('0x52')]+_0x56810c[_0x4560('0x53')]+_0x56810c[_0x4560('0x54')]+_0x56810c['countagentrejectretry']+_0x56810c[_0x4560('0x55')];};exports[_0x4560('0x56')]=function(_0x4360b7){var _0x32da8d=_[_0x4560('0x57')](_0x4360b7);_0x32da8d[_0x4560('0x3e')]=0xf;_0x32da8d[_0x4560('0x3a')]='Global';return _0x32da8d;};exports['scheduledAt']=function(_0x447715,_0x28403f,_0x7f6139){var _0x48b58c={};_0x48b58c[_0x28403f]=_0x447715[_0x28403f];_0x48b58c[_0x4560('0x58')]=![];_0x48b58c[_0x4560('0x59')]=moment()[_0x4560('0x5a')](_0x7f6139,'minutes')[_0x4560('0x12')](_0x4560('0x39'));_0x48b58c[_0x4560('0x1d')]=_0x447715[_0x4560('0x1d')];_0x48b58c['ListId']=_0x447715[_0x4560('0x5b')];_0x48b58c['VoiceQueueId']=_0x447715[_0x4560('0x1f')]||undefined;return _0x48b58c;};exports['decrementTalkink']=function(_0x2724a9,_0x4909a7){if(!_[_0x4560('0x17')](_0x2724a9)){if(_0x2724a9[_0x4560('0x5c')]>0x0){_0x2724a9[_0x4560('0x5c')]-=0x1;}else{logger[_0x4560('0x8')](_0x4909a7,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x4560('0x8')](_0x4909a7,_0x4560('0x5d'));}};exports[_0x4560('0x5e')]=function(_0x4040e4){if(_0x4040e4<=0x0){return!![];}return![];};exports[_0x4560('0x5f')]=function(_0x382093,_0x50cd75,_0x4ba3f7){_0x382093['lastevent']=_0x50cd75;_0x382093['name']=_0x382093[_0x4560('0x60')];_0x382093[_0x4560('0x61')]=_0x382093[_0x4560('0x4c')];_0x382093['motionChannel']=_0x4560('0x62');if(_0x4ba3f7){_0x382093[_0x4560('0x63')]=_0x4ba3f7[_0x4560('0x63')];}return _0x382093;};exports[_0x4560('0x64')]=function(_0x409f3c){var _0x5e0c5e={};_0x5e0c5e['queue']=_0x409f3c[_0x4560('0x60')];_0x5e0c5e[_0x4560('0x61')]=_0x409f3c[_0x4560('0x4c')];_0x5e0c5e[_0x4560('0x50')]=_0x409f3c[_0x4560('0x50')];return _0x5e0c5e;};exports[_0x4560('0x65')]=function(_0x421edb){var _0x4d25f0=[];for(var _0x1188b2 in _0x421edb){if(_0x421edb['hasOwnProperty'](_0x1188b2)){if(!_['isNil'](_0x421edb[_0x1188b2])&&_0x421edb[_0x1188b2][_0x4560('0x3e')]===_0x4560('0x66')&&_0x421edb[_0x1188b2][_0x4560('0x67')]===_0x4560('0x68')){_0x4d25f0[_0x4560('0x69')](_0x421edb[_0x1188b2]['id']);}}}return _0x4d25f0;};exports[_0x4560('0x6a')]=function(_0x583aeb){var _0x547ec2=moment()['milliseconds'](0x0);var _0x8bf5f8=moment(_0x583aeb)[_0x4560('0x5')](0x0);return _0x547ec2[_0x4560('0x6')](_0x8bf5f8,_0x4560('0x6b'));};exports['createBody']=function(_0x1bcb4b){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1bcb4b['ContactId'],'ListId':_0x1bcb4b['ListId'],'VoiceQueueId':_0x1bcb4b[_0x4560('0x1f')]||undefined,'CampaignId':_0x1bcb4b['CampaignId']||undefined};};exports[_0x4560('0x6c')]=function(_0x4089b2){if(_0x4089b2===_0x4560('0x50')||_0x4089b2===_0x4560('0x6d')||_0x4089b2===_0x4560('0x60')||_0x4089b2===_0x4560('0x6e')||_0x4089b2===_0x4560('0x6f')||_0x4089b2===_0x4560('0x70')||_0x4089b2===_0x4560('0x42')||_0x4089b2===_0x4560('0x4c')||_0x4089b2===_0x4560('0x1b')||_0x4089b2===_0x4560('0x58')||_0x4089b2===_0x4560('0x1c')||_0x4089b2===_0x4560('0x59')||_0x4089b2==='countbusyretry'||_0x4089b2==='countcongestionretry'||_0x4089b2===_0x4560('0x54')||_0x4089b2===_0x4560('0x71')||_0x4089b2===_0x4560('0x72')||_0x4089b2===_0x4560('0x73')||_0x4089b2===_0x4560('0x74')||_0x4089b2===_0x4560('0x75')||_0x4089b2===_0x4560('0x1d')||_0x4089b2===_0x4560('0x5b')||_0x4089b2===_0x4560('0x43')||_0x4089b2==='VoiceQueueId'||_0x4089b2===_0x4560('0x76')||_0x4089b2==='xmd-voicequeueid'||_0x4089b2===_0x4560('0x77')||_0x4089b2==='xmd-phone'||_0x4089b2===_0x4560('0x78')||_0x4089b2===_0x4560('0x79')||_0x4089b2==='xmd-dialtimeout'||_0x4089b2==='xmd-dialoptions'||_0x4089b2===_0x4560('0x7a')||_0x4089b2===_0x4560('0x7b')||_0x4089b2===_0x4560('0x7c')||_0x4089b2===_0x4560('0x7d')||_0x4089b2===_0x4560('0x7e')||_0x4089b2===_0x4560('0x7f')||_0x4089b2===_0x4560('0x80')||_0x4089b2===_0x4560('0x81')||_0x4089b2===_0x4560('0x82')||_0x4089b2===_0x4560('0x83')||_0x4089b2===_0x4560('0x84')||_0x4089b2===_0x4560('0x85')||_0x4089b2===_0x4560('0x86')||_0x4089b2===_0x4560('0x87')||_0x4089b2==='rtpaudioqosrttbridged'||_0x4089b2===_0x4560('0x81')||_0x4089b2===_0x4560('0x82')||_0x4089b2===_0x4560('0x83')||_0x4089b2===_0x4560('0x84')||_0x4089b2==='rtpaudioqosloss'||_0x4089b2===_0x4560('0x86')||_0x4089b2===_0x4560('0x87')||_0x4089b2===_0x4560('0x88')||_0x4089b2===_0x4560('0x89')||_0x4089b2===_0x4560('0x8a')||_0x4089b2===_0x4560('0x3e')||_0x4089b2==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x599d19,_0x5130a6){var _0x5d1055,_0x3d567e,_0xb2b176;if(_0x5130a6<=0x0){_0x5130a6=0x1;}_0x5d1055=new RegExp(_0x4560('0x8b')+_0x5130a6+'}$');_0x3d567e=Math[_0x4560('0x8c')](0xa,_0x5130a6-0x1);_0xb2b176=Math['pow'](0xa,_0x5130a6)-0x1;return util['format']('%s',_[_0x4560('0x8d')](_0x599d19,_0x5d1055,_[_0x4560('0x8e')](_0x3d567e,_0xb2b176)));};exports[_0x4560('0x8f')]=function(_0x442136){var _0x25c00d=_0x442136[_0x4560('0x90')](/"(.*?)"/);return _0x25c00d?_0x25c00d[0x1]:_0x442136;};exports['extractCalleridNumber']=function(_0x22d285){var _0x49765d=_0x22d285['match'](/<(.*?)>/);return _0x49765d?_0x49765d[0x1]:_0x22d285;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 8efb88a..59dfe92 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 _0xa767=['queuepause','reload','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','boolean','queueremove'];(function(_0x40515a,_0x451cfc){var _0x1edc47=function(_0x32f243){while(--_0x32f243){_0x40515a['push'](_0x40515a['shift']());}};_0x1edc47(++_0x451cfc);}(_0xa767,0x9e));var _0x7a76=function(_0x19e7e8,_0x2c265c){_0x19e7e8=_0x19e7e8-0x0;var _0x3103dd=_0xa767[_0x19e7e8];return _0x3103dd;};'use strict';exports[_0x7a76('0x0')]={'queue':{'type':_0x7a76('0x1'),'required':!![]},'interface':{'type':_0x7a76('0x1'),'required':!![]},'membername':{'type':_0x7a76('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x7a76('0x2'),'required':![]}};exports[_0x7a76('0x3')]={'queue':{'type':_0x7a76('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x7a76('0x4')]={'interface':{'type':_0x7a76('0x1'),'required':!![]},'paused':{'type':_0x7a76('0x2')},'reason':{'type':_0x7a76('0x1'),'required':![]}};exports[_0x7a76('0x5')]={'module':{'type':_0x7a76('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x7a76('0x1'),'required':!![]}};exports[_0x7a76('0x6')]={'uniqueid':{'type':_0x7a76('0x1'),'required':!![]},'filename':{'type':_0x7a76('0x1')},'format':{'type':_0x7a76('0x1')},'mixmonitorid':{'type':'string'}};exports[_0x7a76('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x7a76('0x8')]={'uniqueid':{'type':_0x7a76('0x1'),'required':!![]},'exten':{'type':_0x7a76('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0xfb93=['string','number','boolean','queueremove','reload','voicequeuechannel','voicequeuechannelredirect','queueadd'];(function(_0x58235f,_0x5e3186){var _0x461ccc=function(_0x3c4409){while(--_0x3c4409){_0x58235f['push'](_0x58235f['shift']());}};_0x461ccc(++_0x5e3186);}(_0xfb93,0x11f));var _0x3fb9=function(_0x320f65,_0x273ff8){_0x320f65=_0x320f65-0x0;var _0x5c96f2=_0xfb93[_0x320f65];return _0x5c96f2;};'use strict';exports[_0x3fb9('0x0')]={'queue':{'type':_0x3fb9('0x1'),'required':!![]},'interface':{'type':_0x3fb9('0x1'),'required':!![]},'membername':{'type':_0x3fb9('0x1'),'required':!![]},'penalty':{'type':_0x3fb9('0x2'),'required':![]},'paused':{'type':_0x3fb9('0x3'),'required':![]}};exports[_0x3fb9('0x4')]={'queue':{'type':_0x3fb9('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':'string','required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x3fb9('0x1'),'required':![]}};exports[_0x3fb9('0x5')]={'module':{'type':_0x3fb9('0x1'),'required':![]}};exports[_0x3fb9('0x6')]={'uniqueid':{'type':_0x3fb9('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x3fb9('0x1'),'required':!![]},'filename':{'type':_0x3fb9('0x1')},'format':{'type':_0x3fb9('0x1')},'mixmonitorid':{'type':_0x3fb9('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x3fb9('0x1'),'required':!![]}};exports[_0x3fb9('0x7')]={'uniqueid':{'type':_0x3fb9('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x3fb9('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index b0f5f20..5a67676 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 _0xd329=['outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','name','initTelephones','initTrunks','isUndefined','initVoiceQueues','initTriggers','triggers','initTemplates','zendeskAccounts','initFreshdeskAccounts','freshdeskAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','abandoned','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','queuecallercompleteAt','initVoiceCallReports','outbound','duration','disposition','billableseconds','initCampaigns','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','faxAccounts','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/voiceQueue','../model/template','../model/campaign','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','campaigns','templates','voiceExtensions','outboundChannels','settings','salesforceAccounts','sugarcrmAccounts','zohoAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','format','SIP/%s','isNil','interface','total','sumHoldTime','sumDuration','sumBillable','isEmpty','hasOwnProperty','ivrTotalCallsDays','ivrAnswerCallsDay','answered','unmanaged','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay'];(function(_0xb7a913,_0x543b17){var _0x3ae7dc=function(_0xca3f0d){while(--_0xca3f0d){_0xb7a913['push'](_0xb7a913['shift']());}};_0x3ae7dc(++_0x543b17);}(_0xd329,0x106));var _0x9d32=function(_0x34fac7,_0x2df475){_0x34fac7=_0x34fac7-0x0;var _0x2dc371=_0xd329[_0x34fac7];return _0x2dc371;};'use strict';var BPromise=require(_0x9d32('0x0'));var util=require(_0x9d32('0x1'));var _=require(_0x9d32('0x2'));var moment=require(_0x9d32('0x3'));var Agent=require(_0x9d32('0x4'));var Telephone=require(_0x9d32('0x5'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0x9d32('0x6'));var Trigger=require('../model/trigger');var Template=require(_0x9d32('0x7'));var Campaign=require(_0x9d32('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x9d32('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x9d32('0xa'));var SugarcrmAccount=require(_0x9d32('0xb'));var ZohoAccount=require(_0x9d32('0xc'));var DeskAccount=require(_0x9d32('0xd'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0x9d32('0xe'));var Dynamics365Account=require(_0x9d32('0xf'));var FreshsalesAccount=require(_0x9d32('0x10'));var FaxAccount=require(_0x9d32('0x11'));var Realtime=function(){this[_0x9d32('0x12')]={};this[_0x9d32('0x13')]={};this[_0x9d32('0x14')]={};this[_0x9d32('0x15')]={};this['triggers']={};this[_0x9d32('0x16')]={};this[_0x9d32('0x17')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x9d32('0x18')]={};this['channels']={};this['queueChannels']={};this[_0x9d32('0x19')]={};this['timers']={};this[_0x9d32('0x1a')]={};this['zendeskAccounts']={};this[_0x9d32('0x1b')]={};this[_0x9d32('0x1c')]={};this['freshdeskAccounts']={};this[_0x9d32('0x1d')]={};this['deskAccounts']={};this['vtigerAccounts']={};this['servicenowAccounts']={};this[_0x9d32('0x1e')]={};this[_0x9d32('0x1f')]={};this['faxAccounts']={};};function freeIsNotKey(_0x536873,_0x520fe9,_0x15929f){var _0x3bbde3=_['mapKeys'](_0x536873,function(_0x86e733,_0x52290f){return _0x86e733[_0x15929f];});for(var _0x32ab4b in _0x520fe9){if(_0x520fe9['hasOwnProperty'](_0x32ab4b)){if(!_0x3bbde3[_0x32ab4b]){delete _0x520fe9[_0x32ab4b];}}}}function freeIsNotKeySip(_0x483473,_0x12488c){var _0x43190f=_[_0x9d32('0x20')](_0x483473,function(_0xf1269f,_0x413fca){return util[_0x9d32('0x21')](_0x9d32('0x22'),_0xf1269f['name']);});for(var _0x28b719 in _0x12488c){if(_0x12488c['hasOwnProperty'](_0x28b719)){if(!_0x43190f[_0x28b719]){delete _0x12488c[_0x28b719];}}}}function freeIsNotKeyAgent(_0x16a669,_0x55c36f){var _0x8c4b5f=_['mapKeys'](_0x16a669,function(_0x42ecdb,_0x4987a1){var _0x30ff2d=_[_0x9d32('0x23')](_0x42ecdb[_0x9d32('0x24')])?util[_0x9d32('0x21')](_0x9d32('0x22'),_0x42ecdb['name']):_0x42ecdb[_0x9d32('0x24')];return _0x30ff2d;});for(var _0x2deabb in _0x55c36f){if(_0x55c36f['hasOwnProperty'](_0x2deabb)){if(!_0x8c4b5f[_0x2deabb]){delete _0x55c36f[_0x2deabb];}}}}function clearVoiceCallReports(_0x12434e){_0x12434e[_0x9d32('0x25')]=0x0;_0x12434e['answered']=0x0;_0x12434e[_0x9d32('0x26')]=0x0;_0x12434e[_0x9d32('0x27')]=0x0;_0x12434e[_0x9d32('0x28')]=0x0;}function clearCampaigns(_0x21aac8){if(!_[_0x9d32('0x29')](_0x21aac8)){for(var _0x24fbb3 in _0x21aac8){if(_0x21aac8[_0x9d32('0x2a')](_0x24fbb3)){_0x21aac8[_0x24fbb3][_0x9d32('0x2b')]=0x0;_0x21aac8[_0x24fbb3][_0x9d32('0x2c')]=0x0;}}}}function clearVoiceQueues(_0x53ac29){if(!_[_0x9d32('0x29')](_0x53ac29)){for(var _0x18e2a2 in _0x53ac29){if(_0x53ac29[_0x9d32('0x2a')](_0x18e2a2)){_0x53ac29[_0x18e2a2][_0x9d32('0x25')]=0x0;_0x53ac29[_0x18e2a2][_0x9d32('0x2d')]=0x0;_0x53ac29[_0x18e2a2][_0x9d32('0x2e')]=0x0;_0x53ac29[_0x18e2a2]['abandoned']=0x0;_0x53ac29[_0x18e2a2][_0x9d32('0x26')]=0x0;_0x53ac29[_0x18e2a2]['sumDuration']=0x0;_0x53ac29[_0x18e2a2][_0x9d32('0x28')]=0x0;_0x53ac29[_0x18e2a2][_0x9d32('0x2f')]=0x0;_0x53ac29[_0x18e2a2][_0x9d32('0x30')]=0x0;_0x53ac29[_0x18e2a2]['outboundBusyCallsDay']=0x0;_0x53ac29[_0x18e2a2][_0x9d32('0x31')]=0x0;_0x53ac29[_0x18e2a2]['outboundNoSuchCallsDay']=0x0;_0x53ac29[_0x18e2a2][_0x9d32('0x32')]=0x0;_0x53ac29[_0x18e2a2]['outboundDropCallsDayTimeout']=0x0;_0x53ac29[_0x18e2a2][_0x9d32('0x33')]=0x0;_0x53ac29[_0x18e2a2][_0x9d32('0x34')]=0x0;_0x53ac29[_0x18e2a2]['outboundOriginateFailureCallsDay']=0x0;_0x53ac29[_0x18e2a2][_0x9d32('0x35')]=0x0;_0x53ac29[_0x18e2a2][_0x9d32('0x36')]=0x0;_0x53ac29[_0x18e2a2][_0x9d32('0x2f')]=0x0;_0x53ac29[_0x18e2a2]['outboundAnswerCallsDay']=0x0;_0x53ac29[_0x18e2a2][_0x9d32('0x37')]=!![];}}}}Realtime[_0x9d32('0x38')][_0x9d32('0x39')]=function(_0x332528,_0x3b7d65){for(var _0x2e1f77 in _0x3b7d65){if(_0x332528['hasOwnProperty'](_0x2e1f77)){_0x332528[_0x2e1f77]=_0x3b7d65[_0x2e1f77];}}};Realtime[_0x9d32('0x38')][_0x9d32('0x3a')]=function(){var _0x218da0=this;return function(_0x3fea23){if(_0x3fea23){freeIsNotKeyAgent(_0x3fea23,_0x218da0[_0x9d32('0x12')]);for(var _0x2d7b1a=0x0,_0x451535={},_0x5aa0b3={};_0x2d7b1a<_0x3fea23[_0x9d32('0x3b')];_0x2d7b1a+=0x1){_0x451535=_0x3fea23[_0x2d7b1a];var _0x1659e5=_[_0x9d32('0x23')](_0x451535['interface'])?util['format'](_0x9d32('0x22'),_0x451535[_0x9d32('0x3c')]):_0x451535[_0x9d32('0x24')];if(_['isUndefined'](_0x218da0[_0x9d32('0x12')][_0x1659e5])){_0x218da0[_0x9d32('0x12')][_0x1659e5]=new Agent(_0x451535);}else{_0x218da0[_0x9d32('0x39')](_0x218da0[_0x9d32('0x12')][_0x1659e5],_0x451535);}}}return _0x218da0[_0x9d32('0x12')];};};Realtime[_0x9d32('0x38')][_0x9d32('0x3d')]=function(){var _0x47b20d=this;return function(_0x1d27c7){if(_0x1d27c7){freeIsNotKeySip(_0x1d27c7,_0x47b20d[_0x9d32('0x13')]);for(var _0x15ca20=0x0,_0x4c0f08={},_0x20f154={};_0x15ca20<_0x1d27c7[_0x9d32('0x3b')];_0x15ca20+=0x1){_0x4c0f08=_0x1d27c7[_0x15ca20];if(_['isUndefined'](_0x47b20d[_0x9d32('0x13')][util[_0x9d32('0x21')]('SIP/%s',_0x4c0f08[_0x9d32('0x3c')])])){_0x47b20d['telephones'][util[_0x9d32('0x21')](_0x9d32('0x22'),_0x4c0f08['name'])]=new Telephone(_0x4c0f08);}else{_0x47b20d[_0x9d32('0x39')](_0x47b20d[_0x9d32('0x13')][util[_0x9d32('0x21')](_0x9d32('0x22'),_0x4c0f08[_0x9d32('0x3c')])],_0x4c0f08);}}}return _0x47b20d['telephones'];};};Realtime[_0x9d32('0x38')][_0x9d32('0x3e')]=function(){var _0x1d457b=this;return function(_0x234a35){if(_0x234a35){freeIsNotKeySip(_0x234a35,_0x1d457b[_0x9d32('0x14')]);for(var _0x48d9da=0x0,_0x2a9472={},_0x410c23={};_0x48d9da<_0x234a35['length'];_0x48d9da+=0x1){_0x2a9472=_0x234a35[_0x48d9da];if(_[_0x9d32('0x3f')](_0x1d457b[_0x9d32('0x14')][util[_0x9d32('0x21')](_0x9d32('0x22'),_0x2a9472['name'])])){_0x1d457b['trunks'][util[_0x9d32('0x21')](_0x9d32('0x22'),_0x2a9472['name'])]=new Trunk(_0x2a9472);}else{_0x1d457b[_0x9d32('0x39')](_0x1d457b['trunks'][util[_0x9d32('0x21')]('SIP/%s',_0x2a9472[_0x9d32('0x3c')])],_0x2a9472);}}}return _0x1d457b[_0x9d32('0x14')];};};Realtime[_0x9d32('0x38')][_0x9d32('0x40')]=function(){var _0x16a403=this;return function(_0x237f07){if(_0x237f07){freeIsNotKey(_0x237f07,_0x16a403['voiceQueues'],'name');for(var _0x46323a=0x0,_0x1bee34={},_0x2689f1={};_0x46323a<_0x237f07[_0x9d32('0x3b')];_0x46323a+=0x1){_0x1bee34=_0x237f07[_0x46323a];if(_[_0x9d32('0x3f')](_0x16a403[_0x9d32('0x15')][_0x1bee34[_0x9d32('0x3c')]])){_0x16a403['voiceQueues'][_0x1bee34['name']]=new VoiceQueue(_0x1bee34);}else{_0x16a403[_0x9d32('0x39')](_0x16a403[_0x9d32('0x15')][_0x1bee34['name']],_0x1bee34);}}}return _0x16a403['voiceQueues'];};};Realtime[_0x9d32('0x38')][_0x9d32('0x41')]=function(){var _0x1d6ecd=this;return function(_0x9aab61){if(_0x9aab61){freeIsNotKey(_0x9aab61,_0x1d6ecd['triggers'],'id');for(var _0x5f450e=0x0,_0x37748e={},_0x392b2c={};_0x5f450e<_0x9aab61[_0x9d32('0x3b')];_0x5f450e+=0x1){_0x37748e=_0x9aab61[_0x5f450e];if(_['isUndefined'](_0x1d6ecd[_0x9d32('0x42')][_0x37748e['id']])){_0x1d6ecd[_0x9d32('0x42')][_0x37748e['id']]=new Trigger(_0x37748e);}else{_0x1d6ecd[_0x9d32('0x39')](_0x1d6ecd[_0x9d32('0x42')][_0x37748e['id']],_0x37748e);}}}return _0x1d6ecd[_0x9d32('0x42')];};};Realtime[_0x9d32('0x38')][_0x9d32('0x43')]=function(){var _0x21c7d9=this;return function(_0xad1708){if(_0xad1708){freeIsNotKey(_0xad1708,_0x21c7d9[_0x9d32('0x17')],'id');for(var _0x5409cf=0x0,_0x543b16={},_0x464073={};_0x5409cf<_0xad1708[_0x9d32('0x3b')];_0x5409cf+=0x1){_0x543b16=_0xad1708[_0x5409cf];if(_[_0x9d32('0x3f')](_0x21c7d9[_0x9d32('0x17')][_0x543b16['id']])){_0x21c7d9['templates'][_0x543b16['id']]=new Template(_0x543b16);}else{_0x21c7d9[_0x9d32('0x39')](_0x21c7d9[_0x9d32('0x17')][_0x543b16['id']],_0x543b16);}}}return _0x21c7d9[_0x9d32('0x17')];};};Realtime[_0x9d32('0x38')]['initZendeskAccounts']=function(){var _0x10ff7a=this;return function(_0xfcfcef){if(_0xfcfcef){freeIsNotKey(_0xfcfcef,_0x10ff7a[_0x9d32('0x44')],'id');for(var _0x45a1ca=0x0,_0x1efb0c={},_0x1aa843={};_0x45a1ca<_0xfcfcef[_0x9d32('0x3b')];_0x45a1ca+=0x1){_0x1efb0c=_0xfcfcef[_0x45a1ca];if(_[_0x9d32('0x3f')](_0x10ff7a['zendeskAccounts'][_0x1efb0c['id']])){_0x10ff7a[_0x9d32('0x44')][_0x1efb0c['id']]=new ZendeskAccount(_0x1efb0c);}else{_0x10ff7a[_0x9d32('0x39')](_0x10ff7a['zendeskAccounts'][_0x1efb0c['id']],_0x1efb0c);}}}return _0x10ff7a['zendeskAccounts'];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x34d714=this;return function(_0x3dc12e){if(_0x3dc12e){freeIsNotKey(_0x3dc12e,_0x34d714[_0x9d32('0x1b')],'id');for(var _0x30113c=0x0,_0x2c9767={},_0x27a68c={};_0x30113c<_0x3dc12e[_0x9d32('0x3b')];_0x30113c+=0x1){_0x2c9767=_0x3dc12e[_0x30113c];if(_[_0x9d32('0x3f')](_0x34d714[_0x9d32('0x1b')][_0x2c9767['id']])){_0x34d714['salesforceAccounts'][_0x2c9767['id']]=new SalesforceAccount(_0x2c9767);}else{_0x34d714['mergeFromDatabase'](_0x34d714['salesforceAccounts'][_0x2c9767['id']],_0x2c9767);}}}return _0x34d714[_0x9d32('0x1b')];};};Realtime[_0x9d32('0x38')][_0x9d32('0x45')]=function(){var _0x11540b=this;return function(_0x594005){if(_0x594005){freeIsNotKey(_0x594005,_0x11540b[_0x9d32('0x46')],'id');for(var _0x5ecf19=0x0,_0x4a2a38={},_0x52b947={};_0x5ecf19<_0x594005['length'];_0x5ecf19+=0x1){_0x4a2a38=_0x594005[_0x5ecf19];if(_[_0x9d32('0x3f')](_0x11540b[_0x9d32('0x46')][_0x4a2a38['id']])){_0x11540b[_0x9d32('0x46')][_0x4a2a38['id']]=new FreshdeskAccount(_0x4a2a38);}else{_0x11540b[_0x9d32('0x39')](_0x11540b[_0x9d32('0x46')][_0x4a2a38['id']],_0x4a2a38);}}}return _0x11540b[_0x9d32('0x46')];};};Realtime[_0x9d32('0x38')]['initZohoAccounts']=function(){var _0x2d0efe=this;return function(_0x340d85){if(_0x340d85){freeIsNotKey(_0x340d85,_0x2d0efe[_0x9d32('0x1d')],'id');for(var _0x188cd8=0x0,_0x2eaaf5={},_0x5e3d2b={};_0x188cd8<_0x340d85[_0x9d32('0x3b')];_0x188cd8+=0x1){_0x2eaaf5=_0x340d85[_0x188cd8];if(_[_0x9d32('0x3f')](_0x2d0efe['zohoAccounts'][_0x2eaaf5['id']])){_0x2d0efe[_0x9d32('0x1d')][_0x2eaaf5['id']]=new ZohoAccount(_0x2eaaf5);}else{_0x2d0efe['mergeFromDatabase'](_0x2d0efe[_0x9d32('0x1d')][_0x2eaaf5['id']],_0x2eaaf5);}}}return _0x2d0efe[_0x9d32('0x1d')];};};Realtime[_0x9d32('0x38')]['initDeskAccounts']=function(){var _0x443622=this;return function(_0x2fa4b9){if(_0x2fa4b9){freeIsNotKey(_0x2fa4b9,_0x443622[_0x9d32('0x47')],'id');for(var _0x364c38=0x0,_0x5b074a={},_0x3ac8c6={};_0x364c38<_0x2fa4b9[_0x9d32('0x3b')];_0x364c38+=0x1){_0x5b074a=_0x2fa4b9[_0x364c38];if(_['isUndefined'](_0x443622[_0x9d32('0x47')][_0x5b074a['id']])){_0x443622[_0x9d32('0x47')][_0x5b074a['id']]=new DeskAccount(_0x5b074a);}else{_0x443622[_0x9d32('0x39')](_0x443622[_0x9d32('0x47')][_0x5b074a['id']],_0x5b074a);}}}return _0x443622[_0x9d32('0x47')];};};Realtime['prototype'][_0x9d32('0x48')]=function(){var _0x1c0e6b=this;return function(_0x571f00){if(_0x571f00){freeIsNotKey(_0x571f00,_0x1c0e6b['sugarcrmAccounts'],'id');for(var _0x39382e=0x0,_0x372f10={},_0x8118bc={};_0x39382e<_0x571f00[_0x9d32('0x3b')];_0x39382e+=0x1){_0x372f10=_0x571f00[_0x39382e];if(_[_0x9d32('0x3f')](_0x1c0e6b[_0x9d32('0x1c')][_0x372f10['id']])){_0x1c0e6b[_0x9d32('0x1c')][_0x372f10['id']]=new SugarcrmAccount(_0x372f10);}else{_0x1c0e6b[_0x9d32('0x39')](_0x1c0e6b['sugarcrmAccounts'][_0x372f10['id']],_0x372f10);}}}return _0x1c0e6b[_0x9d32('0x1c')];};};Realtime[_0x9d32('0x38')][_0x9d32('0x49')]=function(){var _0x52d218=this;return function(_0x22d7d1){if(_0x22d7d1){freeIsNotKey(_0x22d7d1,_0x52d218['vtigerAccounts'],'id');for(var _0x47e821=0x0,_0x2d67f7={},_0x1ca82f={};_0x47e821<_0x22d7d1['length'];_0x47e821+=0x1){_0x2d67f7=_0x22d7d1[_0x47e821];if(_[_0x9d32('0x3f')](_0x52d218[_0x9d32('0x4a')][_0x2d67f7['id']])){_0x52d218['vtigerAccounts'][_0x2d67f7['id']]=new VtigerAccount(_0x2d67f7);}else{_0x52d218[_0x9d32('0x39')](_0x52d218['vtigerAccounts'][_0x2d67f7['id']],_0x2d67f7);}}}return _0x52d218[_0x9d32('0x4a')];};};Realtime['prototype'][_0x9d32('0x4b')]=function(){var _0x3f968f=this;return function(_0x33f88d){if(_0x33f88d){freeIsNotKey(_0x33f88d,_0x3f968f[_0x9d32('0x4c')],'id');for(var _0x47b41d=0x0,_0x4e1377={},_0x37ce96={};_0x47b41d<_0x33f88d['length'];_0x47b41d+=0x1){_0x4e1377=_0x33f88d[_0x47b41d];if(_[_0x9d32('0x3f')](_0x3f968f[_0x9d32('0x4c')][_0x4e1377['id']])){_0x3f968f[_0x9d32('0x4c')][_0x4e1377['id']]=new ServicenowAccount(_0x4e1377);}else{_0x3f968f['mergeFromDatabase'](_0x3f968f[_0x9d32('0x4c')][_0x4e1377['id']],_0x4e1377);}}}return _0x3f968f[_0x9d32('0x4c')];};};Realtime[_0x9d32('0x38')][_0x9d32('0x4d')]=function(){var _0x830bfb=this;return function(_0x31d021){if(_0x31d021){freeIsNotKey(_0x31d021,_0x830bfb[_0x9d32('0x1e')],'id');for(var _0x25981d=0x0,_0x11b5ae={},_0xf059dd={};_0x25981d<_0x31d021[_0x9d32('0x3b')];_0x25981d+=0x1){_0x11b5ae=_0x31d021[_0x25981d];if(_['isUndefined'](_0x830bfb[_0x9d32('0x1e')][_0x11b5ae['id']])){_0x830bfb['dynamics365Accounts'][_0x11b5ae['id']]=new Dynamics365Account(_0x11b5ae);}else{_0x830bfb[_0x9d32('0x39')](_0x830bfb[_0x9d32('0x1e')][_0x11b5ae['id']],_0x11b5ae);}}}return _0x830bfb[_0x9d32('0x1e')];};};Realtime[_0x9d32('0x38')][_0x9d32('0x4e')]=function(){var _0x5b88c7=this;return function(_0x25d080){if(_0x25d080){freeIsNotKey(_0x25d080,_0x5b88c7['freshsalesAccounts'],'id');for(var _0x288f69=0x0,_0x56a1cf={},_0x11b6ae={};_0x288f69<_0x25d080['length'];_0x288f69+=0x1){_0x56a1cf=_0x25d080[_0x288f69];if(_['isUndefined'](_0x5b88c7[_0x9d32('0x1f')][_0x56a1cf['id']])){_0x5b88c7[_0x9d32('0x1f')][_0x56a1cf['id']]=new FreshsalesAccount(_0x56a1cf);}else{_0x5b88c7[_0x9d32('0x39')](_0x5b88c7[_0x9d32('0x1f')][_0x56a1cf['id']],_0x56a1cf);}}}return _0x5b88c7[_0x9d32('0x1f')];};};Realtime[_0x9d32('0x38')][_0x9d32('0x4f')]=function(){var _0x339fb1=this;return function(_0x42e708){for(var _0x3e7646=0x0;_0x3e7646<_0x42e708[_0x9d32('0x3b')];_0x3e7646+=0x1){_[_0x9d32('0x50')](_0x339fb1[_0x9d32('0x15')][_0x42e708[_0x3e7646][_0x9d32('0x3c')]],_0x42e708[_0x3e7646]);}return _0x339fb1[_0x9d32('0x15')];};};Realtime[_0x9d32('0x38')][_0x9d32('0x51')]=function(){var _0x768faa=this;return function(_0x33a543){clearVoiceQueues(_0x768faa[_0x9d32('0x15')]);if(_0x33a543){_0x33a543=_[_0x9d32('0x52')](_0x33a543,'uniqueid');for(var _0x3bdef2 in _0x33a543){if(_0x33a543['hasOwnProperty'](_0x3bdef2)){var _0x139918={};for(var _0x1b2353=0x0;_0x1b2353<_0x33a543[_0x3bdef2][_0x9d32('0x3b')];_0x1b2353+=0x1){var _0x3c043e=_0x33a543[_0x3bdef2][_0x1b2353][_0x9d32('0x53')];if(_0x768faa[_0x9d32('0x15')][_0x3c043e]){if(_0x33a543[_0x3bdef2][_0x1b2353]['queuecallerexit']){_0x768faa['voiceQueues'][_0x3c043e]['unmanaged']+=0x1;}if(_0x33a543[_0x3bdef2][_0x1b2353][_0x9d32('0x54')]){_0x768faa[_0x9d32('0x15')][_0x3c043e][_0x9d32('0x55')]+=0x1;}_0x768faa[_0x9d32('0x15')][_0x3c043e]['sumHoldTime']+=moment(_0x33a543[_0x3bdef2][_0x1b2353][_0x9d32('0x56')])[_0x9d32('0x57')](moment(_0x33a543[_0x3bdef2][_0x1b2353][_0x9d32('0x58')]),_0x9d32('0x59'))||0x0;if(_0x1b2353===_0x33a543[_0x3bdef2][_0x9d32('0x3b')]-0x1){_0x768faa[_0x9d32('0x15')][_0x3c043e][_0x9d32('0x27')]+=moment(_0x33a543[_0x3bdef2][_0x1b2353]['queuecallercompleteAt']||_0x33a543[_0x3bdef2][_0x1b2353][_0x9d32('0x5a')]||_0x33a543[_0x3bdef2][_0x1b2353][_0x9d32('0x5b')])['diff'](moment(_0x33a543[_0x3bdef2][_0x1b2353][_0x9d32('0x58')]),_0x9d32('0x59'))||0x0;_0x768faa['voiceQueues'][_0x3c043e][_0x9d32('0x25')]+=0x1;if(_0x33a543[_0x3bdef2][_0x1b2353][_0x9d32('0x5c')]){_0x768faa[_0x9d32('0x15')][_0x3c043e][_0x9d32('0x2d')]+=0x1;_0x768faa[_0x9d32('0x15')][_0x3c043e][_0x9d32('0x28')]+=moment(_0x33a543[_0x3bdef2][_0x1b2353][_0x9d32('0x5d')])[_0x9d32('0x57')](moment(_0x33a543[_0x3bdef2][_0x1b2353]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x768faa[_0x9d32('0x15')][_0x3c043e][_0x9d32('0x27')]+=_0x768faa[_0x9d32('0x15')][_0x3c043e][_0x9d32('0x26')]||0x0;}}}}}}return _0x768faa[_0x9d32('0x15')];};};Realtime[_0x9d32('0x38')][_0x9d32('0x5e')]=function(){var _0x344d3c=this;return function(_0x1e9b54){clearVoiceCallReports(_0x344d3c['outbound']);if(_0x1e9b54){for(var _0x3ad676=0x0;_0x3ad676<_0x1e9b54[_0x9d32('0x3b')];_0x3ad676+=0x1){_0x344d3c[_0x9d32('0x5f')][_0x9d32('0x25')]+=0x1;_0x344d3c[_0x9d32('0x5f')]['sumDuration']+=_0x1e9b54[_0x3ad676][_0x9d32('0x60')];if(_0x1e9b54[_0x3ad676][_0x9d32('0x61')]==='ANSWERED'){_0x344d3c['outbound'][_0x9d32('0x2d')]+=0x1;_0x344d3c['outbound']['sumHoldTime']+=_0x1e9b54[_0x3ad676][_0x9d32('0x60')]-_0x1e9b54[_0x3ad676][_0x9d32('0x62')]||0x0;_0x344d3c[_0x9d32('0x5f')][_0x9d32('0x28')]+=_0x1e9b54[_0x3ad676][_0x9d32('0x62')];}}}return _0x344d3c['outbound'];};};Realtime[_0x9d32('0x38')][_0x9d32('0x63')]=function(){var _0x335d44=this;return function(_0x106eac){if(_0x106eac){freeIsNotKey(_0x106eac,_0x335d44['campaigns'],_0x9d32('0x3c'));for(var _0x109a11=0x0,_0x32a806={};_0x109a11<_0x106eac[_0x9d32('0x3b')];_0x109a11+=0x1){_0x32a806=_0x106eac[_0x109a11];if(_['isUndefined'](_0x335d44[_0x9d32('0x16')][_0x32a806['name']])){_0x335d44[_0x9d32('0x16')][_0x32a806['name']]=new Campaign(_0x32a806);}else{_0x335d44[_0x9d32('0x39')](_0x335d44[_0x9d32('0x16')][_0x32a806['name']],_0x32a806);_0x335d44[_0x9d32('0x16')][_0x32a806[_0x9d32('0x3c')]]['dialQueueProject']=_0x32a806[_0x9d32('0x64')]?_0x32a806[_0x9d32('0x64')][_0x9d32('0x3c')]:undefined;}}}return _0x335d44['campaigns'];};};Realtime[_0x9d32('0x38')][_0x9d32('0x65')]=function(){var _0x30e000=this;return function(_0x4cf662){if(_0x4cf662){freeIsNotKey(_0x4cf662,_0x30e000[_0x9d32('0x18')],'id');for(var _0x44390f=0x0,_0x251753={};_0x44390f<_0x4cf662[_0x9d32('0x3b')];_0x44390f+=0x1){_0x251753=_0x4cf662[_0x44390f];if(_[_0x9d32('0x3f')](_0x30e000['voiceExtensions'][_0x251753['id']])){_0x30e000['voiceExtensions'][_0x251753['id']]=new VoiceExtension(_0x251753);}else{_0x30e000['mergeFromDatabase'](_0x30e000[_0x9d32('0x18')][_0x251753['id']],_0x251753);}}}return _0x30e000['voiceExtensions'];};};Realtime[_0x9d32('0x38')][_0x9d32('0x66')]=function(){var _0x13682f=this;return function(_0x56100d){clearCampaigns(_0x13682f[_0x9d32('0x16')]);for(var _0xb303f8=0x0;_0xb303f8<_0x56100d[_0x9d32('0x3b')];_0xb303f8+=0x1){_[_0x9d32('0x50')](_0x13682f[_0x9d32('0x16')][_0x56100d[_0xb303f8][_0x9d32('0x3c')]],_0x56100d[_0xb303f8]);}return _0x13682f[_0x9d32('0x16')];};};Realtime['prototype'][_0x9d32('0x67')]=function(){var _0x40b522=this;return function(_0xd8b7a){if(_0xd8b7a){freeIsNotKey(_0xd8b7a,_0x40b522[_0x9d32('0x68')],'id');for(var _0x5a5ba0=0x0,_0x55ed1a={},_0x28d017={};_0x5a5ba0<_0xd8b7a['length'];_0x5a5ba0+=0x1){_0x55ed1a=_0xd8b7a[_0x5a5ba0];if(_[_0x9d32('0x3f')](_0x40b522['faxAccounts'][_0x55ed1a['id']])){_0x40b522['faxAccounts'][_0x55ed1a['id']]=new FaxAccount(_0x55ed1a);}else{_0x40b522['mergeFromDatabase'](_0x40b522[_0x9d32('0x68')][_0x55ed1a['id']],_0x55ed1a);}}}return _0x40b522[_0x9d32('0x68')];};};module['exports']=Realtime; \ No newline at end of file +var _0xcd61=['servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','isEmpty','total','unmanaged','abandoned','sumBillable','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','agents','length','isUndefined','initTelephones','telephones','initTrunks','initTriggers','zendeskAccounts','initSalesforceAccounts','initZohoAccounts','initDeskAccounts','deskAccounts','initVtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerabandon','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','util','moment','../model/voiceQueue','../model/trigger','../model/template','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/freshsalesAccount','../model/faxAccount','trunks','voiceQueues','triggers','campaigns','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','vtigerAccounts'];(function(_0x345c29,_0x49a22b){var _0x1b5fd0=function(_0x5054e0){while(--_0x5054e0){_0x345c29['push'](_0x345c29['shift']());}};_0x1b5fd0(++_0x49a22b);}(_0xcd61,0xb3));var _0x1cd6=function(_0x19ce42,_0x351525){_0x19ce42=_0x19ce42-0x0;var _0x23184f=_0xcd61[_0x19ce42];return _0x23184f;};'use strict';var BPromise=require('bluebird');var util=require(_0x1cd6('0x0'));var _=require('lodash');var moment=require(_0x1cd6('0x1'));var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require('../model/trunk');var VoiceQueue=require(_0x1cd6('0x2'));var Trigger=require(_0x1cd6('0x3'));var Template=require(_0x1cd6('0x4'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0x1cd6('0x5'));var ZendeskAccount=require(_0x1cd6('0x6'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x1cd6('0x7'));var SugarcrmAccount=require(_0x1cd6('0x8'));var ZohoAccount=require(_0x1cd6('0x9'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x1cd6('0xa'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x1cd6('0xb'));var FaxAccount=require(_0x1cd6('0xc'));var Realtime=function(){this['agents']={};this['telephones']={};this[_0x1cd6('0xd')]={};this[_0x1cd6('0xe')]={};this[_0x1cd6('0xf')]={};this[_0x1cd6('0x10')]={};this[_0x1cd6('0x11')]={};this[_0x1cd6('0x12')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x1cd6('0x13')]={};this[_0x1cd6('0x14')]={};this[_0x1cd6('0x15')]={};this[_0x1cd6('0x16')]={};this[_0x1cd6('0x17')]={};this['zendeskAccounts']={};this[_0x1cd6('0x18')]={};this[_0x1cd6('0x19')]={};this[_0x1cd6('0x1a')]={};this[_0x1cd6('0x1b')]={};this['deskAccounts']={};this[_0x1cd6('0x1c')]={};this[_0x1cd6('0x1d')]={};this[_0x1cd6('0x1e')]={};this['freshsalesAccounts']={};this[_0x1cd6('0x1f')]={};};function freeIsNotKey(_0x5d7cc5,_0x433b77,_0x23658b){var _0x457d00=_[_0x1cd6('0x20')](_0x5d7cc5,function(_0x26413c,_0x4ab044){return _0x26413c[_0x23658b];});for(var _0x5ba69b in _0x433b77){if(_0x433b77[_0x1cd6('0x21')](_0x5ba69b)){if(!_0x457d00[_0x5ba69b]){delete _0x433b77[_0x5ba69b];}}}}function freeIsNotKeySip(_0x8dc22,_0x494f07){var _0x1903e6=_[_0x1cd6('0x20')](_0x8dc22,function(_0x1939f8,_0x59b453){return util[_0x1cd6('0x22')](_0x1cd6('0x23'),_0x1939f8[_0x1cd6('0x24')]);});for(var _0x1d8356 in _0x494f07){if(_0x494f07[_0x1cd6('0x21')](_0x1d8356)){if(!_0x1903e6[_0x1d8356]){delete _0x494f07[_0x1d8356];}}}}function freeIsNotKeyAgent(_0x58f30a,_0x349126){var _0xa7fbf0=_[_0x1cd6('0x20')](_0x58f30a,function(_0x234e40,_0x52d594){var _0x48072d=_[_0x1cd6('0x25')](_0x234e40[_0x1cd6('0x26')])?util[_0x1cd6('0x22')]('SIP/%s',_0x234e40[_0x1cd6('0x24')]):_0x234e40['interface'];return _0x48072d;});for(var _0x464cc0 in _0x349126){if(_0x349126[_0x1cd6('0x21')](_0x464cc0)){if(!_0xa7fbf0[_0x464cc0]){delete _0x349126[_0x464cc0];}}}}function clearVoiceCallReports(_0x52463c){_0x52463c['total']=0x0;_0x52463c[_0x1cd6('0x27')]=0x0;_0x52463c[_0x1cd6('0x28')]=0x0;_0x52463c[_0x1cd6('0x29')]=0x0;_0x52463c['sumBillable']=0x0;}function clearCampaigns(_0x1ed25d){if(!_['isEmpty'](_0x1ed25d)){for(var _0x430d97 in _0x1ed25d){if(_0x1ed25d[_0x1cd6('0x21')](_0x430d97)){_0x1ed25d[_0x430d97][_0x1cd6('0x2a')]=0x0;_0x1ed25d[_0x430d97]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x255d3c){if(!_[_0x1cd6('0x2b')](_0x255d3c)){for(var _0x1016cc in _0x255d3c){if(_0x255d3c[_0x1cd6('0x21')](_0x1016cc)){_0x255d3c[_0x1016cc][_0x1cd6('0x2c')]=0x0;_0x255d3c[_0x1016cc][_0x1cd6('0x27')]=0x0;_0x255d3c[_0x1016cc][_0x1cd6('0x2d')]=0x0;_0x255d3c[_0x1016cc][_0x1cd6('0x2e')]=0x0;_0x255d3c[_0x1016cc]['sumHoldTime']=0x0;_0x255d3c[_0x1016cc]['sumDuration']=0x0;_0x255d3c[_0x1016cc][_0x1cd6('0x2f')]=0x0;_0x255d3c[_0x1016cc]['outboundAnswerAgiCallsDay']=0x0;_0x255d3c[_0x1016cc]['outboundNoAnswerCallsDay']=0x0;_0x255d3c[_0x1016cc]['outboundBusyCallsDay']=0x0;_0x255d3c[_0x1016cc]['outboundCongestionCallsDay']=0x0;_0x255d3c[_0x1016cc][_0x1cd6('0x30')]=0x0;_0x255d3c[_0x1016cc][_0x1cd6('0x31')]=0x0;_0x255d3c[_0x1016cc][_0x1cd6('0x32')]=0x0;_0x255d3c[_0x1016cc][_0x1cd6('0x33')]=0x0;_0x255d3c[_0x1016cc][_0x1cd6('0x34')]=0x0;_0x255d3c[_0x1016cc]['outboundOriginateFailureCallsDay']=0x0;_0x255d3c[_0x1016cc][_0x1cd6('0x35')]=0x0;_0x255d3c[_0x1016cc][_0x1cd6('0x36')]=0x0;_0x255d3c[_0x1016cc]['outboundAnswerAgiCallsDay']=0x0;_0x255d3c[_0x1016cc][_0x1cd6('0x37')]=0x0;_0x255d3c[_0x1016cc][_0x1cd6('0x38')]=!![];}}}}Realtime['prototype'][_0x1cd6('0x39')]=function(_0xb0e65a,_0x3af14a){for(var _0x463f83 in _0x3af14a){if(_0xb0e65a['hasOwnProperty'](_0x463f83)){_0xb0e65a[_0x463f83]=_0x3af14a[_0x463f83];}}};Realtime[_0x1cd6('0x3a')][_0x1cd6('0x3b')]=function(){var _0x4d5158=this;return function(_0x4e5a06){if(_0x4e5a06){freeIsNotKeyAgent(_0x4e5a06,_0x4d5158[_0x1cd6('0x3c')]);for(var _0x1a2502=0x0,_0x52278e={},_0x52c0f4={};_0x1a2502<_0x4e5a06[_0x1cd6('0x3d')];_0x1a2502+=0x1){_0x52278e=_0x4e5a06[_0x1a2502];var _0x99a508=_[_0x1cd6('0x25')](_0x52278e['interface'])?util[_0x1cd6('0x22')](_0x1cd6('0x23'),_0x52278e[_0x1cd6('0x24')]):_0x52278e[_0x1cd6('0x26')];if(_[_0x1cd6('0x3e')](_0x4d5158['agents'][_0x99a508])){_0x4d5158[_0x1cd6('0x3c')][_0x99a508]=new Agent(_0x52278e);}else{_0x4d5158[_0x1cd6('0x39')](_0x4d5158[_0x1cd6('0x3c')][_0x99a508],_0x52278e);}}}return _0x4d5158[_0x1cd6('0x3c')];};};Realtime['prototype'][_0x1cd6('0x3f')]=function(){var _0x219e8d=this;return function(_0x3cb631){if(_0x3cb631){freeIsNotKeySip(_0x3cb631,_0x219e8d[_0x1cd6('0x40')]);for(var _0x59debd=0x0,_0xa02850={},_0x6180a2={};_0x59debd<_0x3cb631[_0x1cd6('0x3d')];_0x59debd+=0x1){_0xa02850=_0x3cb631[_0x59debd];if(_[_0x1cd6('0x3e')](_0x219e8d['telephones'][util[_0x1cd6('0x22')](_0x1cd6('0x23'),_0xa02850[_0x1cd6('0x24')])])){_0x219e8d[_0x1cd6('0x40')][util[_0x1cd6('0x22')]('SIP/%s',_0xa02850[_0x1cd6('0x24')])]=new Telephone(_0xa02850);}else{_0x219e8d[_0x1cd6('0x39')](_0x219e8d[_0x1cd6('0x40')][util['format'](_0x1cd6('0x23'),_0xa02850[_0x1cd6('0x24')])],_0xa02850);}}}return _0x219e8d[_0x1cd6('0x40')];};};Realtime[_0x1cd6('0x3a')][_0x1cd6('0x41')]=function(){var _0xab75e9=this;return function(_0x1ba009){if(_0x1ba009){freeIsNotKeySip(_0x1ba009,_0xab75e9[_0x1cd6('0xd')]);for(var _0x46b0c1=0x0,_0x3f7ea1={},_0x4ea9ac={};_0x46b0c1<_0x1ba009['length'];_0x46b0c1+=0x1){_0x3f7ea1=_0x1ba009[_0x46b0c1];if(_[_0x1cd6('0x3e')](_0xab75e9['trunks'][util[_0x1cd6('0x22')](_0x1cd6('0x23'),_0x3f7ea1[_0x1cd6('0x24')])])){_0xab75e9[_0x1cd6('0xd')][util['format']('SIP/%s',_0x3f7ea1[_0x1cd6('0x24')])]=new Trunk(_0x3f7ea1);}else{_0xab75e9[_0x1cd6('0x39')](_0xab75e9[_0x1cd6('0xd')][util[_0x1cd6('0x22')](_0x1cd6('0x23'),_0x3f7ea1['name'])],_0x3f7ea1);}}}return _0xab75e9[_0x1cd6('0xd')];};};Realtime[_0x1cd6('0x3a')]['initVoiceQueues']=function(){var _0x5c404a=this;return function(_0x3a1ac0){if(_0x3a1ac0){freeIsNotKey(_0x3a1ac0,_0x5c404a[_0x1cd6('0xe')],_0x1cd6('0x24'));for(var _0x10eabc=0x0,_0x173b46={},_0x23b746={};_0x10eabc<_0x3a1ac0[_0x1cd6('0x3d')];_0x10eabc+=0x1){_0x173b46=_0x3a1ac0[_0x10eabc];if(_[_0x1cd6('0x3e')](_0x5c404a['voiceQueues'][_0x173b46[_0x1cd6('0x24')]])){_0x5c404a[_0x1cd6('0xe')][_0x173b46[_0x1cd6('0x24')]]=new VoiceQueue(_0x173b46);}else{_0x5c404a[_0x1cd6('0x39')](_0x5c404a['voiceQueues'][_0x173b46[_0x1cd6('0x24')]],_0x173b46);}}}return _0x5c404a['voiceQueues'];};};Realtime['prototype'][_0x1cd6('0x42')]=function(){var _0x266a88=this;return function(_0x27513a){if(_0x27513a){freeIsNotKey(_0x27513a,_0x266a88['triggers'],'id');for(var _0x218b02=0x0,_0x3eb7d1={},_0x3ef2f6={};_0x218b02<_0x27513a[_0x1cd6('0x3d')];_0x218b02+=0x1){_0x3eb7d1=_0x27513a[_0x218b02];if(_[_0x1cd6('0x3e')](_0x266a88[_0x1cd6('0xf')][_0x3eb7d1['id']])){_0x266a88[_0x1cd6('0xf')][_0x3eb7d1['id']]=new Trigger(_0x3eb7d1);}else{_0x266a88['mergeFromDatabase'](_0x266a88[_0x1cd6('0xf')][_0x3eb7d1['id']],_0x3eb7d1);}}}return _0x266a88[_0x1cd6('0xf')];};};Realtime[_0x1cd6('0x3a')]['initTemplates']=function(){var _0x5a571e=this;return function(_0x2be83f){if(_0x2be83f){freeIsNotKey(_0x2be83f,_0x5a571e[_0x1cd6('0x11')],'id');for(var _0x470cbd=0x0,_0xaa8dd0={},_0x586c2c={};_0x470cbd<_0x2be83f[_0x1cd6('0x3d')];_0x470cbd+=0x1){_0xaa8dd0=_0x2be83f[_0x470cbd];if(_['isUndefined'](_0x5a571e[_0x1cd6('0x11')][_0xaa8dd0['id']])){_0x5a571e[_0x1cd6('0x11')][_0xaa8dd0['id']]=new Template(_0xaa8dd0);}else{_0x5a571e[_0x1cd6('0x39')](_0x5a571e[_0x1cd6('0x11')][_0xaa8dd0['id']],_0xaa8dd0);}}}return _0x5a571e[_0x1cd6('0x11')];};};Realtime['prototype']['initZendeskAccounts']=function(){var _0x295b77=this;return function(_0x5452a1){if(_0x5452a1){freeIsNotKey(_0x5452a1,_0x295b77[_0x1cd6('0x43')],'id');for(var _0x2f839d=0x0,_0x458cd4={},_0x12e1b9={};_0x2f839d<_0x5452a1[_0x1cd6('0x3d')];_0x2f839d+=0x1){_0x458cd4=_0x5452a1[_0x2f839d];if(_[_0x1cd6('0x3e')](_0x295b77[_0x1cd6('0x43')][_0x458cd4['id']])){_0x295b77[_0x1cd6('0x43')][_0x458cd4['id']]=new ZendeskAccount(_0x458cd4);}else{_0x295b77[_0x1cd6('0x39')](_0x295b77[_0x1cd6('0x43')][_0x458cd4['id']],_0x458cd4);}}}return _0x295b77['zendeskAccounts'];};};Realtime[_0x1cd6('0x3a')][_0x1cd6('0x44')]=function(){var _0x3d56a8=this;return function(_0xf4c442){if(_0xf4c442){freeIsNotKey(_0xf4c442,_0x3d56a8['salesforceAccounts'],'id');for(var _0x1dc243=0x0,_0x54bd64={},_0x319dd3={};_0x1dc243<_0xf4c442[_0x1cd6('0x3d')];_0x1dc243+=0x1){_0x54bd64=_0xf4c442[_0x1dc243];if(_[_0x1cd6('0x3e')](_0x3d56a8[_0x1cd6('0x18')][_0x54bd64['id']])){_0x3d56a8[_0x1cd6('0x18')][_0x54bd64['id']]=new SalesforceAccount(_0x54bd64);}else{_0x3d56a8[_0x1cd6('0x39')](_0x3d56a8[_0x1cd6('0x18')][_0x54bd64['id']],_0x54bd64);}}}return _0x3d56a8[_0x1cd6('0x18')];};};Realtime[_0x1cd6('0x3a')]['initFreshdeskAccounts']=function(){var _0x1fda58=this;return function(_0x833c1a){if(_0x833c1a){freeIsNotKey(_0x833c1a,_0x1fda58[_0x1cd6('0x1a')],'id');for(var _0x3d53bc=0x0,_0x16ebea={},_0x5271f6={};_0x3d53bc<_0x833c1a[_0x1cd6('0x3d')];_0x3d53bc+=0x1){_0x16ebea=_0x833c1a[_0x3d53bc];if(_[_0x1cd6('0x3e')](_0x1fda58[_0x1cd6('0x1a')][_0x16ebea['id']])){_0x1fda58['freshdeskAccounts'][_0x16ebea['id']]=new FreshdeskAccount(_0x16ebea);}else{_0x1fda58['mergeFromDatabase'](_0x1fda58[_0x1cd6('0x1a')][_0x16ebea['id']],_0x16ebea);}}}return _0x1fda58[_0x1cd6('0x1a')];};};Realtime['prototype'][_0x1cd6('0x45')]=function(){var _0x1ff5a6=this;return function(_0x4aae62){if(_0x4aae62){freeIsNotKey(_0x4aae62,_0x1ff5a6[_0x1cd6('0x1b')],'id');for(var _0x39b4dd=0x0,_0x177c19={},_0x17afae={};_0x39b4dd<_0x4aae62[_0x1cd6('0x3d')];_0x39b4dd+=0x1){_0x177c19=_0x4aae62[_0x39b4dd];if(_[_0x1cd6('0x3e')](_0x1ff5a6[_0x1cd6('0x1b')][_0x177c19['id']])){_0x1ff5a6[_0x1cd6('0x1b')][_0x177c19['id']]=new ZohoAccount(_0x177c19);}else{_0x1ff5a6[_0x1cd6('0x39')](_0x1ff5a6[_0x1cd6('0x1b')][_0x177c19['id']],_0x177c19);}}}return _0x1ff5a6[_0x1cd6('0x1b')];};};Realtime['prototype'][_0x1cd6('0x46')]=function(){var _0x3511bc=this;return function(_0x3e82bc){if(_0x3e82bc){freeIsNotKey(_0x3e82bc,_0x3511bc[_0x1cd6('0x47')],'id');for(var _0x39c78b=0x0,_0x450c21={},_0xab9b3b={};_0x39c78b<_0x3e82bc[_0x1cd6('0x3d')];_0x39c78b+=0x1){_0x450c21=_0x3e82bc[_0x39c78b];if(_['isUndefined'](_0x3511bc[_0x1cd6('0x47')][_0x450c21['id']])){_0x3511bc[_0x1cd6('0x47')][_0x450c21['id']]=new DeskAccount(_0x450c21);}else{_0x3511bc[_0x1cd6('0x39')](_0x3511bc[_0x1cd6('0x47')][_0x450c21['id']],_0x450c21);}}}return _0x3511bc[_0x1cd6('0x47')];};};Realtime[_0x1cd6('0x3a')]['initSugarcrmAccounts']=function(){var _0xcfa86=this;return function(_0x2ab589){if(_0x2ab589){freeIsNotKey(_0x2ab589,_0xcfa86[_0x1cd6('0x19')],'id');for(var _0x4c82e6=0x0,_0x25ab4b={},_0x3a4752={};_0x4c82e6<_0x2ab589[_0x1cd6('0x3d')];_0x4c82e6+=0x1){_0x25ab4b=_0x2ab589[_0x4c82e6];if(_[_0x1cd6('0x3e')](_0xcfa86[_0x1cd6('0x19')][_0x25ab4b['id']])){_0xcfa86[_0x1cd6('0x19')][_0x25ab4b['id']]=new SugarcrmAccount(_0x25ab4b);}else{_0xcfa86['mergeFromDatabase'](_0xcfa86[_0x1cd6('0x19')][_0x25ab4b['id']],_0x25ab4b);}}}return _0xcfa86[_0x1cd6('0x19')];};};Realtime[_0x1cd6('0x3a')][_0x1cd6('0x48')]=function(){var _0x500e8f=this;return function(_0xaf03e4){if(_0xaf03e4){freeIsNotKey(_0xaf03e4,_0x500e8f[_0x1cd6('0x1c')],'id');for(var _0x34ac88=0x0,_0x42c20b={},_0x1f376={};_0x34ac88<_0xaf03e4[_0x1cd6('0x3d')];_0x34ac88+=0x1){_0x42c20b=_0xaf03e4[_0x34ac88];if(_[_0x1cd6('0x3e')](_0x500e8f[_0x1cd6('0x1c')][_0x42c20b['id']])){_0x500e8f['vtigerAccounts'][_0x42c20b['id']]=new VtigerAccount(_0x42c20b);}else{_0x500e8f['mergeFromDatabase'](_0x500e8f[_0x1cd6('0x1c')][_0x42c20b['id']],_0x42c20b);}}}return _0x500e8f[_0x1cd6('0x1c')];};};Realtime['prototype'][_0x1cd6('0x49')]=function(){var _0x23d3fa=this;return function(_0xed2b75){if(_0xed2b75){freeIsNotKey(_0xed2b75,_0x23d3fa[_0x1cd6('0x1d')],'id');for(var _0x138da7=0x0,_0xc40511={},_0x846e8b={};_0x138da7<_0xed2b75[_0x1cd6('0x3d')];_0x138da7+=0x1){_0xc40511=_0xed2b75[_0x138da7];if(_[_0x1cd6('0x3e')](_0x23d3fa[_0x1cd6('0x1d')][_0xc40511['id']])){_0x23d3fa[_0x1cd6('0x1d')][_0xc40511['id']]=new ServicenowAccount(_0xc40511);}else{_0x23d3fa[_0x1cd6('0x39')](_0x23d3fa[_0x1cd6('0x1d')][_0xc40511['id']],_0xc40511);}}}return _0x23d3fa[_0x1cd6('0x1d')];};};Realtime[_0x1cd6('0x3a')]['initDynamics365Accounts']=function(){var _0x2b8eb6=this;return function(_0xb95528){if(_0xb95528){freeIsNotKey(_0xb95528,_0x2b8eb6[_0x1cd6('0x1e')],'id');for(var _0x37049f=0x0,_0x29dac3={},_0x597826={};_0x37049f<_0xb95528['length'];_0x37049f+=0x1){_0x29dac3=_0xb95528[_0x37049f];if(_[_0x1cd6('0x3e')](_0x2b8eb6[_0x1cd6('0x1e')][_0x29dac3['id']])){_0x2b8eb6['dynamics365Accounts'][_0x29dac3['id']]=new Dynamics365Account(_0x29dac3);}else{_0x2b8eb6['mergeFromDatabase'](_0x2b8eb6[_0x1cd6('0x1e')][_0x29dac3['id']],_0x29dac3);}}}return _0x2b8eb6[_0x1cd6('0x1e')];};};Realtime[_0x1cd6('0x3a')][_0x1cd6('0x4a')]=function(){var _0x27ea38=this;return function(_0x21725b){if(_0x21725b){freeIsNotKey(_0x21725b,_0x27ea38[_0x1cd6('0x4b')],'id');for(var _0x413cad=0x0,_0x45da25={},_0x4e251c={};_0x413cad<_0x21725b[_0x1cd6('0x3d')];_0x413cad+=0x1){_0x45da25=_0x21725b[_0x413cad];if(_[_0x1cd6('0x3e')](_0x27ea38[_0x1cd6('0x4b')][_0x45da25['id']])){_0x27ea38[_0x1cd6('0x4b')][_0x45da25['id']]=new FreshsalesAccount(_0x45da25);}else{_0x27ea38[_0x1cd6('0x39')](_0x27ea38['freshsalesAccounts'][_0x45da25['id']],_0x45da25);}}}return _0x27ea38['freshsalesAccounts'];};};Realtime[_0x1cd6('0x3a')][_0x1cd6('0x4c')]=function(){var _0xcc1a23=this;return function(_0xc3695b){for(var _0x42fd1d=0x0;_0x42fd1d<_0xc3695b[_0x1cd6('0x3d')];_0x42fd1d+=0x1){_[_0x1cd6('0x4d')](_0xcc1a23[_0x1cd6('0xe')][_0xc3695b[_0x42fd1d][_0x1cd6('0x24')]],_0xc3695b[_0x42fd1d]);}return _0xcc1a23[_0x1cd6('0xe')];};};Realtime[_0x1cd6('0x3a')][_0x1cd6('0x4e')]=function(){var _0x557b8d=this;return function(_0x3082a9){clearVoiceQueues(_0x557b8d[_0x1cd6('0xe')]);if(_0x3082a9){_0x3082a9=_[_0x1cd6('0x4f')](_0x3082a9,_0x1cd6('0x50'));for(var _0x390435 in _0x3082a9){if(_0x3082a9[_0x1cd6('0x21')](_0x390435)){var _0x3de161={};for(var _0x2b3193=0x0;_0x2b3193<_0x3082a9[_0x390435][_0x1cd6('0x3d')];_0x2b3193+=0x1){var _0x25520e=_0x3082a9[_0x390435][_0x2b3193][_0x1cd6('0x51')];if(_0x557b8d[_0x1cd6('0xe')][_0x25520e]){if(_0x3082a9[_0x390435][_0x2b3193]['queuecallerexit']){_0x557b8d[_0x1cd6('0xe')][_0x25520e][_0x1cd6('0x2d')]+=0x1;}if(_0x3082a9[_0x390435][_0x2b3193][_0x1cd6('0x52')]){_0x557b8d[_0x1cd6('0xe')][_0x25520e][_0x1cd6('0x2e')]+=0x1;}_0x557b8d['voiceQueues'][_0x25520e][_0x1cd6('0x28')]+=moment(_0x3082a9[_0x390435][_0x2b3193]['queuecallerleaveAt'])[_0x1cd6('0x53')](moment(_0x3082a9[_0x390435][_0x2b3193][_0x1cd6('0x54')]),_0x1cd6('0x55'))||0x0;if(_0x2b3193===_0x3082a9[_0x390435]['length']-0x1){_0x557b8d['voiceQueues'][_0x25520e][_0x1cd6('0x29')]+=moment(_0x3082a9[_0x390435][_0x2b3193][_0x1cd6('0x56')]||_0x3082a9[_0x390435][_0x2b3193][_0x1cd6('0x57')]||_0x3082a9[_0x390435][_0x2b3193][_0x1cd6('0x58')])[_0x1cd6('0x53')](moment(_0x3082a9[_0x390435][_0x2b3193][_0x1cd6('0x54')]),'seconds')||0x0;_0x557b8d[_0x1cd6('0xe')][_0x25520e][_0x1cd6('0x2c')]+=0x1;if(_0x3082a9[_0x390435][_0x2b3193][_0x1cd6('0x59')]){_0x557b8d[_0x1cd6('0xe')][_0x25520e][_0x1cd6('0x27')]+=0x1;_0x557b8d[_0x1cd6('0xe')][_0x25520e][_0x1cd6('0x2f')]+=moment(_0x3082a9[_0x390435][_0x2b3193][_0x1cd6('0x56')])[_0x1cd6('0x53')](moment(_0x3082a9[_0x390435][_0x2b3193][_0x1cd6('0x5a')]),'seconds')||0x0;}}else{_0x557b8d['voiceQueues'][_0x25520e][_0x1cd6('0x29')]+=_0x557b8d[_0x1cd6('0xe')][_0x25520e]['sumHoldTime']||0x0;}}}}}}return _0x557b8d['voiceQueues'];};};Realtime[_0x1cd6('0x3a')][_0x1cd6('0x5b')]=function(){var _0x2acdc2=this;return function(_0x5405ce){clearVoiceCallReports(_0x2acdc2['outbound']);if(_0x5405ce){for(var _0x59d92b=0x0;_0x59d92b<_0x5405ce[_0x1cd6('0x3d')];_0x59d92b+=0x1){_0x2acdc2[_0x1cd6('0x12')][_0x1cd6('0x2c')]+=0x1;_0x2acdc2[_0x1cd6('0x12')][_0x1cd6('0x29')]+=_0x5405ce[_0x59d92b][_0x1cd6('0x5c')];if(_0x5405ce[_0x59d92b][_0x1cd6('0x5d')]===_0x1cd6('0x5e')){_0x2acdc2[_0x1cd6('0x12')][_0x1cd6('0x27')]+=0x1;_0x2acdc2['outbound'][_0x1cd6('0x28')]+=_0x5405ce[_0x59d92b][_0x1cd6('0x5c')]-_0x5405ce[_0x59d92b][_0x1cd6('0x5f')]||0x0;_0x2acdc2[_0x1cd6('0x12')][_0x1cd6('0x2f')]+=_0x5405ce[_0x59d92b]['billableseconds'];}}}return _0x2acdc2[_0x1cd6('0x12')];};};Realtime[_0x1cd6('0x3a')][_0x1cd6('0x60')]=function(){var _0x44e6c7=this;return function(_0x559c7c){if(_0x559c7c){freeIsNotKey(_0x559c7c,_0x44e6c7[_0x1cd6('0x10')],_0x1cd6('0x24'));for(var _0x2fa883=0x0,_0x57aa8b={};_0x2fa883<_0x559c7c[_0x1cd6('0x3d')];_0x2fa883+=0x1){_0x57aa8b=_0x559c7c[_0x2fa883];if(_['isUndefined'](_0x44e6c7[_0x1cd6('0x10')][_0x57aa8b['name']])){_0x44e6c7[_0x1cd6('0x10')][_0x57aa8b[_0x1cd6('0x24')]]=new Campaign(_0x57aa8b);}else{_0x44e6c7[_0x1cd6('0x39')](_0x44e6c7[_0x1cd6('0x10')][_0x57aa8b[_0x1cd6('0x24')]],_0x57aa8b);_0x44e6c7[_0x1cd6('0x10')][_0x57aa8b[_0x1cd6('0x24')]][_0x1cd6('0x61')]=_0x57aa8b[_0x1cd6('0x62')]?_0x57aa8b[_0x1cd6('0x62')][_0x1cd6('0x24')]:undefined;}}}return _0x44e6c7[_0x1cd6('0x10')];};};Realtime[_0x1cd6('0x3a')][_0x1cd6('0x63')]=function(){var _0x2d802f=this;return function(_0x9ef7f){if(_0x9ef7f){freeIsNotKey(_0x9ef7f,_0x2d802f[_0x1cd6('0x64')],'id');for(var _0x2d550b=0x0,_0x43dbe9={};_0x2d550b<_0x9ef7f[_0x1cd6('0x3d')];_0x2d550b+=0x1){_0x43dbe9=_0x9ef7f[_0x2d550b];if(_[_0x1cd6('0x3e')](_0x2d802f[_0x1cd6('0x64')][_0x43dbe9['id']])){_0x2d802f[_0x1cd6('0x64')][_0x43dbe9['id']]=new VoiceExtension(_0x43dbe9);}else{_0x2d802f[_0x1cd6('0x39')](_0x2d802f['voiceExtensions'][_0x43dbe9['id']],_0x43dbe9);}}}return _0x2d802f[_0x1cd6('0x64')];};};Realtime[_0x1cd6('0x3a')][_0x1cd6('0x65')]=function(){var _0x5f5d8f=this;return function(_0x414af1){clearCampaigns(_0x5f5d8f[_0x1cd6('0x10')]);for(var _0x3e2949=0x0;_0x3e2949<_0x414af1['length'];_0x3e2949+=0x1){_['merge'](_0x5f5d8f[_0x1cd6('0x10')][_0x414af1[_0x3e2949][_0x1cd6('0x24')]],_0x414af1[_0x3e2949]);}return _0x5f5d8f['campaigns'];};};Realtime[_0x1cd6('0x3a')][_0x1cd6('0x66')]=function(){var _0x3916ef=this;return function(_0x3e2b08){if(_0x3e2b08){freeIsNotKey(_0x3e2b08,_0x3916ef['faxAccounts'],'id');for(var _0x414c6f=0x0,_0x30ec9d={},_0x2ce4e3={};_0x414c6f<_0x3e2b08[_0x1cd6('0x3d')];_0x414c6f+=0x1){_0x30ec9d=_0x3e2b08[_0x414c6f];if(_['isUndefined'](_0x3916ef[_0x1cd6('0x1f')][_0x30ec9d['id']])){_0x3916ef[_0x1cd6('0x1f')][_0x30ec9d['id']]=new FaxAccount(_0x30ec9d);}else{_0x3916ef[_0x1cd6('0x39')](_0x3916ef[_0x1cd6('0x1f')][_0x30ec9d['id']],_0x30ec9d);}}}return _0x3916ef[_0x1cd6('0x1f')];};};module[_0x1cd6('0x67')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index c5602a4..acf16ac 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 _0x74fd=['blindTransfer','attendedtransfer','findAgent','find','accountcode','name','isNil','format','SIP/%s','assigned','lastAssignedTo','interface','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','destination','exten','type','lastapplication','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','originatecalleridnum','destinationchannel','channel','calleridpreview','calleridnum','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','linkedid','transfereelinkedid','uniqueid','monitor','monitors','length','monitorFilename','filename','createdAt','connectedlinename','connectedlinenum','membername','xcally-motion-dialer','create','voiceAgentReport','isArray','forEach','Local','indexOf','mobile','substring','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x74fd,0x145));var _0xd74f=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x74fd[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xd74f('0x0'));var moment=require(_0xd74f('0x1'));var util=require(_0xd74f('0x2'));var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0xd74f('0x3'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xd74f('0x4'));var RpcMemberReport=require(_0xd74f('0x5'));var RpcVoiceQueueReport=require(_0xd74f('0x6'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0xd74f('0x7'));var VoiceQueueReport=require(_0xd74f('0x8'));var VoiceCallReport=require(_0xd74f('0x9'));var VoiceAgentReport=require(_0xd74f('0xa'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xd74f('0xb'));function Report(_0x2f8c7a){this['realtime']=_0x2f8c7a;this[_0xd74f('0xc')]=_0x2f8c7a[_0xd74f('0xc')];this[_0xd74f('0xd')]=_0x2f8c7a['telephones'];}Report[_0xd74f('0xe')][_0xd74f('0xf')]=function(_0x13d66d){var _0x488720=new VoiceQueueReport(this[_0xd74f('0x10')]);var _0x3bb5e6=new VoiceAgentReport(this[_0xd74f('0x10')]);var _0x3a2aad=new VoiceDialReport(this[_0xd74f('0x10')]);var _0x19b80c=new VoiceCallReport(this[_0xd74f('0x10')]);var _0xbee703=new UserReport(this['realtime']);if(config[_0xd74f('0x11')]&&config[_0xd74f('0x11')][_0xd74f('0x12')]){ami['on'](_0xd74f('0x13'),this[_0xd74f('0x14')][_0xd74f('0x15')](this));ami['on'](_0xd74f('0x16'),this[_0xd74f('0x17')][_0xd74f('0x15')](this));ami['on'](_0xd74f('0x18'),this['voiceAgentReport'][_0xd74f('0x15')](this));ami['on'](_0xd74f('0x19'),this[_0xd74f('0x1a')]['bind'](this));ami['on']('blindtransfer',this[_0xd74f('0x1b')]['bind'](this));ami['on'](_0xd74f('0x1c'),this['attendedTransfer'][_0xd74f('0x15')](this));}};Report[_0xd74f('0xe')][_0xd74f('0x1d')]=function(_0x330219){var _0x24674a;_0x24674a=_[_0xd74f('0x1e')](this['agents'],function(_0x1dada4){return _0x1dada4[_0xd74f('0x1f')]==_0x330219||_0x1dada4[_0xd74f('0x20')]==_0x330219;});if(_[_0xd74f('0x21')](_0x24674a)){var _0x1d105b=_['find'](this[_0xd74f('0xd')],function(_0x1d5fe0){return _0x1d5fe0[_0xd74f('0x1f')]==_0x330219||_0x1d5fe0[_0xd74f('0x20')]==_0x330219;});if(_0x1d105b){_0x24674a=_[_0xd74f('0x1e')](this[_0xd74f('0xc')],function(_0x2ba738){return _0x2ba738['interface']==util[_0xd74f('0x22')](_0xd74f('0x23'),_0x1d105b['name']);});}}return _0x24674a;};Report[_0xd74f('0xe')][_0xd74f('0x14')]=function(_0x22648c){for(var _0x37dbf3=0x0;_0x37dbf3<_0x22648c['length'];_0x37dbf3+=0x1){var _0x47209c=this[_0xd74f('0x1d')](_0x22648c[_0x37dbf3]['connectedlinenum']);if(_0x47209c){_0x22648c[_0x37dbf3][_0xd74f('0x1f')]=_0x47209c[_0xd74f('0x1f')];_0x22648c[_0x37dbf3][_0xd74f('0x24')]=!![];_0x22648c[_0x37dbf3][_0xd74f('0x25')]=_0x47209c[_0xd74f('0x20')];_0x22648c[_0x37dbf3]['interface']=_[_0xd74f('0x21')](_0x47209c[_0xd74f('0x26')])?util[_0xd74f('0x22')]('SIP/%s',_0x47209c['name']):_0x47209c[_0xd74f('0x26')];if(_0x22648c[_0x37dbf3][_0xd74f('0x27')]){_0x22648c[_0x37dbf3][_0xd74f('0x28')]=moment()[_0xd74f('0x22')](_0xd74f('0x29'));}if(_0x22648c[_0x37dbf3][_0xd74f('0x2a')]){_0x22648c[_0x37dbf3][_0xd74f('0x2b')]=moment()['format'](_0xd74f('0x29'));}RpcMemberReport[_0xd74f('0x14')](_0x22648c[_0x37dbf3]);}RpcVoiceQueueReport['create'](_0x22648c[_0x37dbf3]);}};function extractCalleridNumber(_0x19df1b){var _0x9ec6c0=_0x19df1b[_0xd74f('0x2c')](/<(.*?)>/);return _0x9ec6c0?_0x9ec6c0[0x1]:_0x19df1b;}Report[_0xd74f('0xe')][_0xd74f('0x17')]=function(_0x1cc4c5){_0x1cc4c5['destination']=_0x1cc4c5[_0xd74f('0x2d')]||_0x1cc4c5[_0xd74f('0x2e')];if(_0x1cc4c5[_0xd74f('0x2f')]=='dialer'){_0x1cc4c5[_0xd74f('0x30')]='queue';_0x1cc4c5[_0xd74f('0x31')]=_0x1cc4c5['queue'];if(_0x1cc4c5[_0xd74f('0x32')]==_0xd74f('0x33')){_0x1cc4c5['accountcode']='';_0x1cc4c5[_0xd74f('0x2d')]=extractCalleridNumber(_0x1cc4c5[_0xd74f('0x34')]);}else if(_0x1cc4c5[_0xd74f('0x32')]==_0xd74f('0x35')){if(_0x1cc4c5[_0xd74f('0x2d')]==_0xd74f('0x36')){_0x1cc4c5['destination']=extractCalleridNumber(_0x1cc4c5['calleridpreview']);_0x1cc4c5['calleridnum']=_0x1cc4c5[_0xd74f('0x37')];_0x1cc4c5[_0xd74f('0x38')]=[_0x1cc4c5[_0xd74f('0x39')],_0x1cc4c5['channel']=_0x1cc4c5['destinationchannel']][0x0];_0x1cc4c5[_0xd74f('0x34')]=_0x1cc4c5[_0xd74f('0x3a')];}else{_0x1cc4c5[_0xd74f('0x2d')]=_0x1cc4c5['calleridnum'];_0x1cc4c5[_0xd74f('0x3b')]=_0x1cc4c5[_0xd74f('0x37')];if(_0x1cc4c5[_0xd74f('0x3c')]==_0xd74f('0x3d')){_0x1cc4c5[_0xd74f('0x1f')]=_0x1cc4c5['connectedlinenum'];}else{_0x1cc4c5[_0xd74f('0x1f')]='';}}}}else{_0x1cc4c5['callerid']=util[_0xd74f('0x22')](_0xd74f('0x3e'),_0x1cc4c5[_0xd74f('0x3f')],_0x1cc4c5['calleridnum']);}if(RpcVoiceTransferReport['transfers'][_0x1cc4c5[_0xd74f('0x40')]]){var _0x85c2d5=RpcVoiceTransferReport['transfers'][_0x1cc4c5[_0xd74f('0x40')]];_0x85c2d5[_0xd74f('0x41')]=_0x1cc4c5[_0xd74f('0x42')];RpcVoiceTransferReport[_0xd74f('0x1b')](_0x85c2d5);delete RpcVoiceTransferReport['transfers'][_0x1cc4c5[_0xd74f('0x40')]];}RpcVoiceCallReport['create'](_0x1cc4c5);if(_0x1cc4c5[_0xd74f('0x43')]){for(var _0x5f615=0x0;_0x5f615<_0x1cc4c5[_0xd74f('0x44')][_0xd74f('0x45')];_0x5f615+=0x1){_0x1cc4c5[_0xd74f('0x46')]=_0x1cc4c5[_0xd74f('0x44')][_0x5f615][_0xd74f('0x47')];_0x1cc4c5[_0xd74f('0x48')]=_0x1cc4c5[_0xd74f('0x44')][_0x5f615][_0xd74f('0x48')];if(_0x1cc4c5[_0xd74f('0x2e')]==_0xd74f('0x36')){_0x1cc4c5[_0xd74f('0x3b')]=_0x1cc4c5['connectedlinenum'];_0x1cc4c5['calleridname']=_0x1cc4c5[_0xd74f('0x49')];_0x1cc4c5[_0xd74f('0x4a')]=_0x1cc4c5[_0xd74f('0x1f')];_0x1cc4c5[_0xd74f('0x49')]=_0x1cc4c5[_0xd74f('0x4b')];_0x1cc4c5['exten']=_0x1cc4c5[_0xd74f('0x37')];}else if(_0x1cc4c5[_0xd74f('0x2e')]==_0xd74f('0x4c')){_0x1cc4c5['calleridnum']=_0x1cc4c5[_0xd74f('0x2d')];_0x1cc4c5[_0xd74f('0x2e')]=_0x1cc4c5['originatecalleridnum'];}RpcVoiceRecording[_0xd74f('0x4d')](_0x1cc4c5);}}};Report[_0xd74f('0xe')][_0xd74f('0x4e')]=function(_0x474566){if(_[_0xd74f('0x4f')](_0x474566)){_0x474566[_0xd74f('0x50')](function(_0x393432){RpcVoiceAgentReport[_0xd74f('0x4d')](_0x393432);});}else{RpcVoiceAgentReport[_0xd74f('0x4d')](_0x474566);}};Report['prototype']['voiceDialReport']=function(_0x5f3982){RpcVoiceDialReport[_0xd74f('0x4d')](_0x5f3982);var _0xfcb89a;var _0x3f040c;var _0x321004=_0x5f3982[_0xd74f('0x39')];if(_['startsWith'](_0x321004,_0xd74f('0x51'))){_0x3f040c=_0x321004['substring'](_0x321004[_0xd74f('0x52')]('/')+0x1,_0x321004[_0xd74f('0x52')]('@'));_0xfcb89a=_[_0xd74f('0x1e')](this['agents'],function(_0x2147a5){return _0x2147a5[_0xd74f('0x53')]==_0x3f040c||_0x2147a5['phone']==_0x3f040c||_0x2147a5[_0xd74f('0x1f')]==_0x3f040c;});}else{_0x3f040c=_0x321004[_0xd74f('0x54')](_0x321004[_0xd74f('0x52')]('/')+0x1,_0x321004[_0xd74f('0x55')]('-'));_0xfcb89a=this[_0xd74f('0x1d')](_0x3f040c);}if(_0xfcb89a){_0x5f3982[_0xd74f('0x26')]=_[_0xd74f('0x21')](_0xfcb89a[_0xd74f('0x26')])?util[_0xd74f('0x22')]('SIP/%s',_0xfcb89a['name']):_0xfcb89a[_0xd74f('0x26')];_0x5f3982[_0xd74f('0x4b')]=_0xfcb89a[_0xd74f('0x20')];_0x5f3982[_0xd74f('0x1f')]=_0xfcb89a['accountcode'];RpcMemberReport[_0xd74f('0x1a')](_0x5f3982);}};Report['prototype']['blindTransfer']=function(_0x3040c1){RpcVoiceTransferReport['transfers'][_0x3040c1[_0xd74f('0x56')]]=_0x3040c1;};Report[_0xd74f('0xe')]['attendedTransfer']=function(_0x182559){RpcVoiceTransferReport['attendedTransfer'](_0x182559);};module[_0xd74f('0x57')]=Report; \ No newline at end of file +var _0x6415=['calleridnum','destinationchannel','channel','callerid','originatecalleridnum','disposition','ANSWERED','transfers','linkedid','transfereelinkedid','uniqueid','monitor','monitors','monitorFilename','createdAt','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','transfererlinkedid','attendedTransfer','exports','lodash','moment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceDialReport','agents','prototype','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','findAgent','accountcode','name','find','telephones','interface','format','length','connectedlinenum','lastAssignedTo','isNil','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','destination','exten','type','dialer','lastapplication','lastdata','queue','context','from-voip-provider','from-sip','xcally-motion-preview','calleridpreview'];(function(_0x463836,_0x2aa40c){var _0x3b1a1f=function(_0x5eb6a4){while(--_0x5eb6a4){_0x463836['push'](_0x463836['shift']());}};_0x3b1a1f(++_0x2aa40c);}(_0x6415,0x1c6));var _0x5641=function(_0x193981,_0x4cdec1){_0x193981=_0x193981-0x0;var _0xf251af=_0x6415[_0x193981];return _0xf251af;};'use strict';var _=require(_0x5641('0x0'));var moment=require(_0x5641('0x1'));var util=require('util');var config=require('../../../config/environment');var ami=require(_0x5641('0x2'));var RpcVoiceAgentReport=require(_0x5641('0x3'));var RpcVoiceCallReport=require(_0x5641('0x4'));var RpcVoiceDialReport=require(_0x5641('0x5'));var RpcMemberReport=require(_0x5641('0x6'));var RpcVoiceQueueReport=require(_0x5641('0x7'));var RpcVoiceRecording=require(_0x5641('0x8'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x5641('0x9'));var VoiceCallReport=require(_0x5641('0xa'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x5641('0xb'));var UserReport=require('./userReport');function Report(_0x52981e){this['realtime']=_0x52981e;this[_0x5641('0xc')]=_0x52981e['agents'];this['telephones']=_0x52981e['telephones'];}Report[_0x5641('0xd')]['sync']=function(_0x219d4b){var _0x411092=new VoiceQueueReport(this[_0x5641('0xe')]);var _0x1e4cef=new VoiceAgentReport(this[_0x5641('0xe')]);var _0x211160=new VoiceDialReport(this[_0x5641('0xe')]);var _0x4b130c=new VoiceCallReport(this['realtime']);var _0x7eae9b=new UserReport(this[_0x5641('0xe')]);if(config[_0x5641('0xf')]&&config[_0x5641('0xf')][_0x5641('0x10')]){ami['on'](_0x5641('0x11'),this[_0x5641('0x12')]['bind'](this));ami['on'](_0x5641('0x13'),this[_0x5641('0x14')][_0x5641('0x15')](this));ami['on']('custom:voiceAgentReport',this[_0x5641('0x16')][_0x5641('0x15')](this));ami['on'](_0x5641('0x17'),this[_0x5641('0x18')][_0x5641('0x15')](this));ami['on'](_0x5641('0x19'),this[_0x5641('0x1a')][_0x5641('0x15')](this));ami['on']('attendedtransfer',this['attendedTransfer']['bind'](this));}};Report[_0x5641('0xd')][_0x5641('0x1b')]=function(_0x407593){var _0x12ff20;_0x12ff20=_['find'](this[_0x5641('0xc')],function(_0xf25264){return _0xf25264[_0x5641('0x1c')]==_0x407593||_0xf25264[_0x5641('0x1d')]==_0x407593;});if(_['isNil'](_0x12ff20)){var _0x5e02f2=_[_0x5641('0x1e')](this[_0x5641('0x1f')],function(_0x564d9a){return _0x564d9a[_0x5641('0x1c')]==_0x407593||_0x564d9a[_0x5641('0x1d')]==_0x407593;});if(_0x5e02f2){_0x12ff20=_[_0x5641('0x1e')](this[_0x5641('0xc')],function(_0x302457){return _0x302457[_0x5641('0x20')]==util[_0x5641('0x21')]('SIP/%s',_0x5e02f2[_0x5641('0x1d')]);});}}return _0x12ff20;};Report[_0x5641('0xd')]['voiceQueueReport']=function(_0x94e89d){for(var _0x49fa96=0x0;_0x49fa96<_0x94e89d[_0x5641('0x22')];_0x49fa96+=0x1){var _0x199e16=this[_0x5641('0x1b')](_0x94e89d[_0x49fa96][_0x5641('0x23')]);if(_0x199e16){_0x94e89d[_0x49fa96][_0x5641('0x1c')]=_0x199e16['accountcode'];_0x94e89d[_0x49fa96]['assigned']=!![];_0x94e89d[_0x49fa96][_0x5641('0x24')]=_0x199e16[_0x5641('0x1d')];_0x94e89d[_0x49fa96]['interface']=_[_0x5641('0x25')](_0x199e16[_0x5641('0x20')])?util[_0x5641('0x21')](_0x5641('0x26'),_0x199e16[_0x5641('0x1d')]):_0x199e16[_0x5641('0x20')];if(_0x94e89d[_0x49fa96][_0x5641('0x27')]){_0x94e89d[_0x49fa96][_0x5641('0x28')]=moment()[_0x5641('0x21')](_0x5641('0x29'));}if(_0x94e89d[_0x49fa96]['queuecallerexit']){_0x94e89d[_0x49fa96][_0x5641('0x2a')]=moment()['format'](_0x5641('0x29'));}RpcMemberReport[_0x5641('0x12')](_0x94e89d[_0x49fa96]);}RpcVoiceQueueReport[_0x5641('0x2b')](_0x94e89d[_0x49fa96]);}};function extractCalleridNumber(_0x53096e){var _0x22d64e=_0x53096e['match'](/<(.*?)>/);return _0x22d64e?_0x22d64e[0x1]:_0x53096e;}Report[_0x5641('0xd')][_0x5641('0x14')]=function(_0x271fbc){_0x271fbc[_0x5641('0x2c')]=_0x271fbc['destination']||_0x271fbc[_0x5641('0x2d')];if(_0x271fbc[_0x5641('0x2e')]==_0x5641('0x2f')){_0x271fbc[_0x5641('0x30')]='queue';_0x271fbc[_0x5641('0x31')]=_0x271fbc[_0x5641('0x32')];if(_0x271fbc[_0x5641('0x33')]==_0x5641('0x34')){_0x271fbc[_0x5641('0x1c')]='';_0x271fbc['destination']=extractCalleridNumber(_0x271fbc['callerid']);}else if(_0x271fbc['context']==_0x5641('0x35')){if(_0x271fbc[_0x5641('0x2c')]==_0x5641('0x36')){_0x271fbc['destination']=extractCalleridNumber(_0x271fbc[_0x5641('0x37')]);_0x271fbc[_0x5641('0x38')]=_0x271fbc['originatecalleridnum'];_0x271fbc[_0x5641('0x39')]=[_0x271fbc['channel'],_0x271fbc[_0x5641('0x3a')]=_0x271fbc['destinationchannel']][0x0];_0x271fbc[_0x5641('0x3b')]=_0x271fbc[_0x5641('0x37')];}else{_0x271fbc['destination']=_0x271fbc[_0x5641('0x38')];_0x271fbc['calleridnum']=_0x271fbc[_0x5641('0x3c')];if(_0x271fbc[_0x5641('0x3d')]==_0x5641('0x3e')){_0x271fbc[_0x5641('0x1c')]=_0x271fbc[_0x5641('0x23')];}else{_0x271fbc[_0x5641('0x1c')]='';}}}}else{_0x271fbc[_0x5641('0x3b')]=util[_0x5641('0x21')]('\x22%s\x22\x20<%s>',_0x271fbc['calleridname'],_0x271fbc[_0x5641('0x38')]);}if(RpcVoiceTransferReport['transfers'][_0x271fbc['linkedid']]){var _0x1edd61=RpcVoiceTransferReport[_0x5641('0x3f')][_0x271fbc[_0x5641('0x40')]];_0x1edd61[_0x5641('0x41')]=_0x271fbc[_0x5641('0x42')];RpcVoiceTransferReport[_0x5641('0x1a')](_0x1edd61);delete RpcVoiceTransferReport['transfers'][_0x271fbc['linkedid']];}RpcVoiceCallReport['create'](_0x271fbc);if(_0x271fbc[_0x5641('0x43')]){for(var _0x29a60d=0x0;_0x29a60d<_0x271fbc[_0x5641('0x44')][_0x5641('0x22')];_0x29a60d+=0x1){_0x271fbc[_0x5641('0x45')]=_0x271fbc['monitors'][_0x29a60d]['filename'];_0x271fbc[_0x5641('0x46')]=_0x271fbc[_0x5641('0x44')][_0x29a60d]['createdAt'];if(_0x271fbc[_0x5641('0x2d')]=='xcally-motion-preview'){_0x271fbc[_0x5641('0x38')]=_0x271fbc[_0x5641('0x23')];_0x271fbc['calleridname']=_0x271fbc[_0x5641('0x47')];_0x271fbc[_0x5641('0x23')]=_0x271fbc['accountcode'];_0x271fbc[_0x5641('0x47')]=_0x271fbc[_0x5641('0x48')];_0x271fbc['exten']=_0x271fbc[_0x5641('0x3c')];}else if(_0x271fbc['exten']==_0x5641('0x49')){_0x271fbc[_0x5641('0x38')]=_0x271fbc[_0x5641('0x2c')];_0x271fbc['exten']=_0x271fbc['originatecalleridnum'];}RpcVoiceRecording[_0x5641('0x2b')](_0x271fbc);}}};Report['prototype']['voiceAgentReport']=function(_0x431f38){if(_[_0x5641('0x4a')](_0x431f38)){_0x431f38[_0x5641('0x4b')](function(_0x557ce6){RpcVoiceAgentReport[_0x5641('0x2b')](_0x557ce6);});}else{RpcVoiceAgentReport[_0x5641('0x2b')](_0x431f38);}};Report[_0x5641('0xd')][_0x5641('0x18')]=function(_0xef95df){RpcVoiceDialReport[_0x5641('0x2b')](_0xef95df);var _0xe29a55;var _0x2dea86;var _0x28e6ea=_0xef95df[_0x5641('0x3a')];if(_[_0x5641('0x4c')](_0x28e6ea,_0x5641('0x4d'))){_0x2dea86=_0x28e6ea[_0x5641('0x4e')](_0x28e6ea[_0x5641('0x4f')]('/')+0x1,_0x28e6ea[_0x5641('0x4f')]('@'));_0xe29a55=_[_0x5641('0x1e')](this[_0x5641('0xc')],function(_0x45e2cc){return _0x45e2cc[_0x5641('0x50')]==_0x2dea86||_0x45e2cc[_0x5641('0x51')]==_0x2dea86||_0x45e2cc['accountcode']==_0x2dea86;});}else{_0x2dea86=_0x28e6ea[_0x5641('0x4e')](_0x28e6ea[_0x5641('0x4f')]('/')+0x1,_0x28e6ea['lastIndexOf']('-'));_0xe29a55=this[_0x5641('0x1b')](_0x2dea86);}if(_0xe29a55){_0xef95df[_0x5641('0x20')]=_[_0x5641('0x25')](_0xe29a55['interface'])?util[_0x5641('0x21')](_0x5641('0x26'),_0xe29a55['name']):_0xe29a55[_0x5641('0x20')];_0xef95df[_0x5641('0x48')]=_0xe29a55[_0x5641('0x1d')];_0xef95df[_0x5641('0x1c')]=_0xe29a55[_0x5641('0x1c')];RpcMemberReport[_0x5641('0x18')](_0xef95df);}};Report[_0x5641('0xd')][_0x5641('0x1a')]=function(_0x16909e){RpcVoiceTransferReport[_0x5641('0x3f')][_0x16909e[_0x5641('0x52')]]=_0x16909e;};Report[_0x5641('0xd')][_0x5641('0x53')]=function(_0x5b35e1){RpcVoiceTransferReport[_0x5641('0x53')](_0x5b35e1);};module[_0x5641('0x54')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 7e39afa..124a268 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 _0x96a6=['debug','[userReport][registry]','find','stateRegistry','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','name','trunk:save','syncDeviceState','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','agents','device','local','toLowerCase','inuse','toNumber','updateStatusRealtime','stateTime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:%s','startsWith','Local','substring','indexOf','mobile','phone','peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','exports','lodash','moment','ioredis','bluebird','../../../config/environment','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','telephones','registryentry','syncRegistry','bind','devicestatechange','syncPeerStatus','syncRealtimeShow','then','actionSipShowRegistry','catch','resolve','actionDeviceStateList','error','inspect','prototype','isUndefined','emit','isNotNull','info','username','state'];(function(_0x271766,_0x3914ec){var _0x264c21=function(_0x5d599f){while(--_0x5d599f){_0x271766['push'](_0x271766['shift']());}};_0x264c21(++_0x3914ec);}(_0x96a6,0x195));var _0x696a=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x96a6[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x696a('0x0'));var moment=require(_0x696a('0x1'));var util=require('util');var Redis=require(_0x696a('0x2'));var BPromise=require(_0x696a('0x3'));var config=require(_0x696a('0x4'));var logger=require('../../../config/logger')(_0x696a('0x5'));var ami=require(_0x696a('0x6'));config[_0x696a('0x7')]=_[_0x696a('0x8')](config[_0x696a('0x7')],{'host':_0x696a('0x9'),'port':0x18eb});var io=require(_0x696a('0xa'))(new Redis(config[_0x696a('0x7')]));function UserReport(_0x31f7c7){this[_0x696a('0xb')]=_0x31f7c7[_0x696a('0xb')];this['agents']=_0x31f7c7['agents'];this[_0x696a('0xc')]=_0x31f7c7[_0x696a('0xc')];ami['on'](_0x696a('0xd'),this[_0x696a('0xe')][_0x696a('0xf')](this));ami['on']('registry',this['syncRegistry']['bind'](this));ami['on'](_0x696a('0x10'),this['syncDeviceState']['bind'](this));ami['on']('peerstatus',this[_0x696a('0x11')][_0x696a('0xf')](this));return this[_0x696a('0x12')]();}function showSipRegistrations(){Promise['resolve']()[_0x696a('0x13')](ami[_0x696a('0x14')]())[_0x696a('0x15')](function(_0xc233ef){logger['error']('[userReport][sipshowregistry]',util['inspect'](_0xc233ef,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x696a('0x16')]()[_0x696a('0x13')](ami[_0x696a('0x17')]())[_0x696a('0x15')](function(_0x1043d9){logger[_0x696a('0x18')]('[userReport][devicestatelist]',util['inspect'](_0x1043d9,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x696a('0x16')]()[_0x696a('0x13')](ami['actionSipPeerStatus']())['catch'](function(_0x867acc){logger[_0x696a('0x18')]('[userReport][sippeerstatus]',util[_0x696a('0x19')](_0x867acc,{'showHidden':![],'depth':null}));});}UserReport[_0x696a('0x1a')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0x696a('0x16')]()[_0x696a('0x13')](showSipRegistrations())[_0x696a('0x13')](listDeviceStates())[_0x696a('0x13')](showPeersStatus());},0x32c8);};UserReport[_0x696a('0x1a')]['isNotNull']=function(_0x40a5b7){return _0x40a5b7!==null&&!_[_0x696a('0x1b')](_0x40a5b7);};UserReport['prototype']['emit']=function(_0x513aeb,_0x54dd32,_0x5ca6ee){io['to'](_0x513aeb)[_0x696a('0x1c')](_0x54dd32,_0x5ca6ee);};UserReport[_0x696a('0x1a')][_0x696a('0xe')]=function(_0x143e21){try{if(this[_0x696a('0x1d')](_0x143e21)){logger[_0x696a('0x1e')]('[userReport][registry]\x20registry:%s\x20state:%s',_0x143e21[_0x696a('0x1f')],_0x143e21[_0x696a('0x20')]);logger[_0x696a('0x21')](_0x696a('0x22'),util[_0x696a('0x19')](_0x143e21,{'showHidden':![],'depth':null}));var _0x3a744e=_[_0x696a('0x23')](this['trunks'],{'defaultuser':_0x143e21['username']});if(_0x3a744e){_0x143e21[_0x696a('0x24')]=_0x143e21['state'];_['merge'](_0x3a744e,_[_0x696a('0x25')](_0x143e21,[_0x696a('0x26'),_0x696a('0x27'),_0x696a('0x1f'),_0x696a('0x20')]));logger['debug'](_0x696a('0x28'),util['inspect'](_0x3a744e,{'showHidden':![],'depth':null}));this[_0x696a('0x1c')](util[_0x696a('0x29')]('trunk:%s',_0x3a744e[_0x696a('0x2a')]),_0x696a('0x2b'),_0x3a744e);}}}catch(_0x10f59f){logger[_0x696a('0x18')](_0x696a('0x22'),util[_0x696a('0x19')](_0x10f59f,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x696a('0x2c')]=function(_0x506740){try{if(this['isNotNull'](_0x506740)){logger[_0x696a('0x1e')](_0x696a('0x2d'),_0x506740['device'],_0x506740['state']);logger['debug'](_0x696a('0x2e'),util[_0x696a('0x19')](_0x506740,{'showHidden':![],'depth':null}));if(this[_0x696a('0x2f')][_0x506740[_0x696a('0x30')]]){if(!this[_0x696a('0x2f')][_0x506740['device']][_0x696a('0x31')]||_0x506740[_0x696a('0x20')][_0x696a('0x32')]()==_0x696a('0x33')){this[_0x696a('0x2f')][_0x506740['device']][_0x696a('0x31')]=![];if(this['agents'][_0x506740['device']]['state']!==_0x506740[_0x696a('0x20')][_0x696a('0x32')]()){this[_0x696a('0x2f')][_0x506740[_0x696a('0x30')]]['stateTime']=_[_0x696a('0x34')](moment()[_0x696a('0x29')]('x'));}this[_0x696a('0x2f')][_0x506740[_0x696a('0x30')]][_0x696a('0x20')]=_0x506740['state']['toLowerCase']();this[_0x696a('0x2f')][_0x506740[_0x696a('0x30')]][_0x696a('0x35')](_0x506740);}}else if(this[_0x696a('0xc')][_0x506740[_0x696a('0x30')]]){if(this[_0x696a('0xc')][_0x506740[_0x696a('0x30')]][_0x696a('0x20')]!==_0x506740[_0x696a('0x20')][_0x696a('0x32')]()){this[_0x696a('0xc')][_0x506740[_0x696a('0x30')]][_0x696a('0x36')]=_[_0x696a('0x34')](moment()[_0x696a('0x29')]('x'));}this[_0x696a('0xc')][_0x506740['device']][_0x696a('0x20')]=_0x506740['state']['toLowerCase']();logger[_0x696a('0x21')](_0x696a('0x37'),util[_0x696a('0x19')](this[_0x696a('0xc')][_0x506740[_0x696a('0x30')]],{'showHidden':![],'depth':null}));this[_0x696a('0x1c')](util['format'](_0x696a('0x38'),this[_0x696a('0xc')][_0x506740[_0x696a('0x30')]][_0x696a('0x2a')]),'telephone:save',this[_0x696a('0xc')][_0x506740[_0x696a('0x30')]]);}else if(this[_0x696a('0xb')][_0x506740[_0x696a('0x30')]]){if(this[_0x696a('0xb')][_0x506740[_0x696a('0x30')]][_0x696a('0x20')]!==_0x506740['state'][_0x696a('0x32')]()){this[_0x696a('0xb')][_0x506740[_0x696a('0x30')]][_0x696a('0x36')]=_['toNumber'](moment()[_0x696a('0x29')]('x'));}this[_0x696a('0xb')][_0x506740[_0x696a('0x30')]][_0x696a('0x20')]=_0x506740[_0x696a('0x20')][_0x696a('0x32')]();logger[_0x696a('0x21')](_0x696a('0x39'),util[_0x696a('0x19')](this[_0x696a('0xb')][_0x506740[_0x696a('0x30')]],{'showHidden':![],'depth':null}));this[_0x696a('0x1c')](util['format'](_0x696a('0x3a'),this[_0x696a('0xb')][_0x506740[_0x696a('0x30')]][_0x696a('0x2a')]),_0x696a('0x2b'),this[_0x696a('0xb')][_0x506740[_0x696a('0x30')]]);}else if(_[_0x696a('0x3b')](_0x506740[_0x696a('0x30')],_0x696a('0x3c'))){var _0xc678dd=_0x506740['device'];var _0x226b80=_0xc678dd[_0x696a('0x3d')](_0xc678dd[_0x696a('0x3e')]('/')+0x1,_0xc678dd[_0x696a('0x3e')]('@'));var _0x131a3d=_[_0x696a('0x23')](this[_0x696a('0x2f')],function(_0x2f545c){return _0x2f545c[_0x696a('0x3f')]==_0x226b80||_0x2f545c[_0x696a('0x40')]==_0x226b80||_0x2f545c['accountcode']==_0x226b80;});if(_0x131a3d){if(_0x131a3d[_0x696a('0x20')]!==_0x506740[_0x696a('0x20')][_0x696a('0x32')]()){_0x131a3d[_0x696a('0x36')]=_[_0x696a('0x34')](moment()[_0x696a('0x29')]('x'));}_0x131a3d[_0x696a('0x20')]=_0x506740[_0x696a('0x20')][_0x696a('0x32')]();_0x131a3d[_0x696a('0x31')]=!![];_0x131a3d[_0x696a('0x35')](_0x506740);}}}}catch(_0xf58851){logger[_0x696a('0x18')](_0x696a('0x2e'),util[_0x696a('0x19')](_0xf58851,{'showHidden':![],'depth':null}));}};UserReport[_0x696a('0x1a')]['syncPeerStatus']=function(_0x53a650){try{if(this['isNotNull'](_0x53a650)&&this[_0x696a('0x1d')](_0x53a650[_0x696a('0x41')])){logger[_0x696a('0x1e')](_0x696a('0x42'),_0x53a650[_0x696a('0x43')],_0x53a650[_0x696a('0x44')],_0x53a650['peerstatus']);logger['debug'](_0x696a('0x45'),util['inspect'](_0x53a650,{'showHidden':![],'depth':null}));if(this['agents'][_0x53a650[_0x696a('0x43')]]){if(!this[_0x696a('0x2f')][_0x53a650[_0x696a('0x43')]][_0x696a('0x31')]||_0x53a650['peerstatus']['toLowerCase']()==_0x696a('0x46')){this['agents'][_0x53a650[_0x696a('0x43')]]['local']=![];this[_0x696a('0x2f')][_0x53a650[_0x696a('0x43')]][_0x696a('0x47')]=_0x53a650[_0x696a('0x41')][_0x696a('0x32')]();this[_0x696a('0x2f')][_0x53a650['peer']][_0x696a('0x44')]=_0x53a650[_0x696a('0x44')];this[_0x696a('0x2f')][_0x53a650[_0x696a('0x43')]][_0x696a('0x35')](_0x53a650);}}else if(this['telephones'][_0x53a650[_0x696a('0x43')]]){this[_0x696a('0xc')][_0x53a650[_0x696a('0x43')]][_0x696a('0x47')]=_0x53a650[_0x696a('0x41')]['toLowerCase']();this[_0x696a('0xc')][_0x53a650[_0x696a('0x43')]][_0x696a('0x44')]=_0x53a650['address'];logger[_0x696a('0x21')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0x696a('0x19')](this[_0x696a('0xc')][_0x53a650[_0x696a('0x43')]],{'showHidden':![],'depth':null}));this[_0x696a('0x1c')](util[_0x696a('0x29')](_0x696a('0x38'),this[_0x696a('0xc')][_0x53a650[_0x696a('0x43')]]['name']),'telephone:save',this['telephones'][_0x53a650[_0x696a('0x43')]]);}else if(this['trunks'][_0x53a650[_0x696a('0x43')]]){this[_0x696a('0xb')][_0x53a650['peer']][_0x696a('0x47')]=_0x53a650['peerstatus'][_0x696a('0x32')]();this[_0x696a('0xb')][_0x53a650[_0x696a('0x43')]][_0x696a('0x44')]=_0x53a650[_0x696a('0x44')];logger['debug']('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0x696a('0x19')](this[_0x696a('0xb')][_0x53a650[_0x696a('0x43')]],{'showHidden':![],'depth':null}));this[_0x696a('0x1c')](util['format'](_0x696a('0x3a'),this[_0x696a('0xb')][_0x53a650[_0x696a('0x43')]][_0x696a('0x2a')]),_0x696a('0x2b'),this[_0x696a('0xb')][_0x53a650['peer']]);}}}catch(_0x31bea5){logger[_0x696a('0x18')]('[userReport][peerstatus]',util[_0x696a('0x19')](_0x31bea5,{'showHidden':![],'depth':null}));}};module[_0x696a('0x48')]=UserReport; \ No newline at end of file +var _0xf661=['socket.io-emitter','trunks','agents','telephones','syncRegistry','registry','bind','devicestatechange','syncDeviceState','syncPeerStatus','syncRealtimeShow','resolve','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','then','[userReport][sippeerstatus]','prototype','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','find','stateRegistry','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','name','trunk:save','[userReport][registry]','isNotNull','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','device','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','trunk:%s','startsWith','substring','indexOf','mobile','phone','accountcode','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','peerstatus','registered','status','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost'];(function(_0x1824b1,_0x29e0d9){var _0x1d21e8=function(_0x5e7923){while(--_0x5e7923){_0x1824b1['push'](_0x1824b1['shift']());}};_0x1d21e8(++_0x29e0d9);}(_0xf661,0x90));var _0x1f66=function(_0x423f53,_0x49db05){_0x423f53=_0x423f53-0x0;var _0x1c473d=_0xf661[_0x423f53];return _0x1c473d;};'use strict';var _=require(_0x1f66('0x0'));var moment=require(_0x1f66('0x1'));var util=require(_0x1f66('0x2'));var Redis=require(_0x1f66('0x3'));var BPromise=require(_0x1f66('0x4'));var config=require(_0x1f66('0x5'));var logger=require(_0x1f66('0x6'))(_0x1f66('0x7'));var ami=require(_0x1f66('0x8'));config[_0x1f66('0x9')]=_[_0x1f66('0xa')](config[_0x1f66('0x9')],{'host':_0x1f66('0xb'),'port':0x18eb});var io=require(_0x1f66('0xc'))(new Redis(config[_0x1f66('0x9')]));function UserReport(_0x4fa48f){this[_0x1f66('0xd')]=_0x4fa48f[_0x1f66('0xd')];this[_0x1f66('0xe')]=_0x4fa48f[_0x1f66('0xe')];this[_0x1f66('0xf')]=_0x4fa48f['telephones'];ami['on']('registryentry',this[_0x1f66('0x10')]['bind'](this));ami['on'](_0x1f66('0x11'),this[_0x1f66('0x10')][_0x1f66('0x12')](this));ami['on'](_0x1f66('0x13'),this[_0x1f66('0x14')][_0x1f66('0x12')](this));ami['on']('peerstatus',this[_0x1f66('0x15')][_0x1f66('0x12')](this));return this[_0x1f66('0x16')]();}function showSipRegistrations(){Promise[_0x1f66('0x17')]()['then'](ami[_0x1f66('0x18')]())[_0x1f66('0x19')](function(_0x939d85){logger[_0x1f66('0x1a')](_0x1f66('0x1b'),util[_0x1f66('0x1c')](_0x939d85,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x1f66('0x17')]()[_0x1f66('0x1d')](ami['actionDeviceStateList']())['catch'](function(_0x3710c2){logger['error']('[userReport][devicestatelist]',util['inspect'](_0x3710c2,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x1f66('0x17')]()['then'](ami['actionSipPeerStatus']())[_0x1f66('0x19')](function(_0x4c80b6){logger[_0x1f66('0x1a')](_0x1f66('0x1e'),util['inspect'](_0x4c80b6,{'showHidden':![],'depth':null}));});}UserReport[_0x1f66('0x1f')][_0x1f66('0x16')]=function(){setInterval(function(){BPromise[_0x1f66('0x17')]()[_0x1f66('0x1d')](showSipRegistrations())[_0x1f66('0x1d')](listDeviceStates())[_0x1f66('0x1d')](showPeersStatus());},0x32c8);};UserReport[_0x1f66('0x1f')]['isNotNull']=function(_0xbe90d6){return _0xbe90d6!==null&&!_['isUndefined'](_0xbe90d6);};UserReport['prototype'][_0x1f66('0x20')]=function(_0x384f80,_0x8ed5db,_0x1bcc1d){io['to'](_0x384f80)[_0x1f66('0x20')](_0x8ed5db,_0x1bcc1d);};UserReport[_0x1f66('0x1f')]['syncRegistry']=function(_0x426d06){try{if(this['isNotNull'](_0x426d06)){logger[_0x1f66('0x21')](_0x1f66('0x22'),_0x426d06[_0x1f66('0x23')],_0x426d06[_0x1f66('0x24')]);logger[_0x1f66('0x25')]('[userReport][registry]',util['inspect'](_0x426d06,{'showHidden':![],'depth':null}));var _0x1f0869=_[_0x1f66('0x26')](this[_0x1f66('0xd')],{'defaultuser':_0x426d06[_0x1f66('0x23')]});if(_0x1f0869){_0x426d06[_0x1f66('0x27')]=_0x426d06[_0x1f66('0x24')];_[_0x1f66('0x28')](_0x1f0869,_[_0x1f66('0x29')](_0x426d06,[_0x1f66('0x2a'),_0x1f66('0x2b'),'username',_0x1f66('0x24')]));logger[_0x1f66('0x25')](_0x1f66('0x2c'),util[_0x1f66('0x1c')](_0x1f0869,{'showHidden':![],'depth':null}));this[_0x1f66('0x20')](util[_0x1f66('0x2d')]('trunk:%s',_0x1f0869[_0x1f66('0x2e')]),_0x1f66('0x2f'),_0x1f0869);}}}catch(_0x847f8c){logger['error'](_0x1f66('0x30'),util[_0x1f66('0x1c')](_0x847f8c,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x1f66('0x14')]=function(_0x5887c6){try{if(this[_0x1f66('0x31')](_0x5887c6)){logger[_0x1f66('0x21')](_0x1f66('0x32'),_0x5887c6['device'],_0x5887c6['state']);logger[_0x1f66('0x25')](_0x1f66('0x33'),util[_0x1f66('0x1c')](_0x5887c6,{'showHidden':![],'depth':null}));if(this['agents'][_0x5887c6['device']]){if(!this[_0x1f66('0xe')][_0x5887c6[_0x1f66('0x34')]][_0x1f66('0x35')]||_0x5887c6[_0x1f66('0x24')][_0x1f66('0x36')]()==_0x1f66('0x37')){this[_0x1f66('0xe')][_0x5887c6[_0x1f66('0x34')]][_0x1f66('0x35')]=![];if(this[_0x1f66('0xe')][_0x5887c6['device']][_0x1f66('0x24')]!==_0x5887c6[_0x1f66('0x24')]['toLowerCase']()){this[_0x1f66('0xe')][_0x5887c6[_0x1f66('0x34')]][_0x1f66('0x38')]=_[_0x1f66('0x39')](moment()['format']('x'));}this['agents'][_0x5887c6[_0x1f66('0x34')]]['state']=_0x5887c6[_0x1f66('0x24')]['toLowerCase']();this[_0x1f66('0xe')][_0x5887c6['device']][_0x1f66('0x3a')](_0x5887c6);}}else if(this[_0x1f66('0xf')][_0x5887c6[_0x1f66('0x34')]]){if(this['telephones'][_0x5887c6[_0x1f66('0x34')]][_0x1f66('0x24')]!==_0x5887c6[_0x1f66('0x24')][_0x1f66('0x36')]()){this[_0x1f66('0xf')][_0x5887c6[_0x1f66('0x34')]][_0x1f66('0x38')]=_[_0x1f66('0x39')](moment()['format']('x'));}this['telephones'][_0x5887c6[_0x1f66('0x34')]][_0x1f66('0x24')]=_0x5887c6['state'][_0x1f66('0x36')]();logger[_0x1f66('0x25')](_0x1f66('0x3b'),util['inspect'](this[_0x1f66('0xf')][_0x5887c6['device']],{'showHidden':![],'depth':null}));this[_0x1f66('0x20')](util['format'](_0x1f66('0x3c'),this[_0x1f66('0xf')][_0x5887c6['device']][_0x1f66('0x2e')]),_0x1f66('0x3d'),this[_0x1f66('0xf')][_0x5887c6[_0x1f66('0x34')]]);}else if(this[_0x1f66('0xd')][_0x5887c6[_0x1f66('0x34')]]){if(this[_0x1f66('0xd')][_0x5887c6[_0x1f66('0x34')]]['state']!==_0x5887c6[_0x1f66('0x24')]['toLowerCase']()){this['trunks'][_0x5887c6['device']]['stateTime']=_[_0x1f66('0x39')](moment()[_0x1f66('0x2d')]('x'));}this[_0x1f66('0xd')][_0x5887c6['device']][_0x1f66('0x24')]=_0x5887c6[_0x1f66('0x24')]['toLowerCase']();logger[_0x1f66('0x25')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0x1f66('0x1c')](this[_0x1f66('0xd')][_0x5887c6['device']],{'showHidden':![],'depth':null}));this[_0x1f66('0x20')](util['format'](_0x1f66('0x3e'),this['trunks'][_0x5887c6[_0x1f66('0x34')]][_0x1f66('0x2e')]),_0x1f66('0x2f'),this[_0x1f66('0xd')][_0x5887c6['device']]);}else if(_[_0x1f66('0x3f')](_0x5887c6[_0x1f66('0x34')],'Local')){var _0x4c511e=_0x5887c6['device'];var _0x16330b=_0x4c511e[_0x1f66('0x40')](_0x4c511e[_0x1f66('0x41')]('/')+0x1,_0x4c511e[_0x1f66('0x41')]('@'));var _0x37dddc=_[_0x1f66('0x26')](this['agents'],function(_0x2a8a72){return _0x2a8a72[_0x1f66('0x42')]==_0x16330b||_0x2a8a72[_0x1f66('0x43')]==_0x16330b||_0x2a8a72[_0x1f66('0x44')]==_0x16330b;});if(_0x37dddc){if(_0x37dddc[_0x1f66('0x24')]!==_0x5887c6['state'][_0x1f66('0x36')]()){_0x37dddc[_0x1f66('0x38')]=_['toNumber'](moment()[_0x1f66('0x2d')]('x'));}_0x37dddc[_0x1f66('0x24')]=_0x5887c6['state'][_0x1f66('0x36')]();_0x37dddc[_0x1f66('0x35')]=!![];_0x37dddc['updateStatusRealtime'](_0x5887c6);}}}}catch(_0x1cb0aa){logger[_0x1f66('0x1a')](_0x1f66('0x33'),util['inspect'](_0x1cb0aa,{'showHidden':![],'depth':null}));}};UserReport[_0x1f66('0x1f')][_0x1f66('0x15')]=function(_0x40fb57){try{if(this[_0x1f66('0x31')](_0x40fb57)&&this[_0x1f66('0x31')](_0x40fb57['peerstatus'])){logger[_0x1f66('0x21')](_0x1f66('0x45'),_0x40fb57[_0x1f66('0x46')],_0x40fb57[_0x1f66('0x47')],_0x40fb57['peerstatus']);logger[_0x1f66('0x25')](_0x1f66('0x48'),util['inspect'](_0x40fb57,{'showHidden':![],'depth':null}));if(this[_0x1f66('0xe')][_0x40fb57[_0x1f66('0x46')]]){if(!this['agents'][_0x40fb57['peer']][_0x1f66('0x35')]||_0x40fb57[_0x1f66('0x49')][_0x1f66('0x36')]()==_0x1f66('0x4a')){this[_0x1f66('0xe')][_0x40fb57[_0x1f66('0x46')]][_0x1f66('0x35')]=![];this[_0x1f66('0xe')][_0x40fb57[_0x1f66('0x46')]][_0x1f66('0x4b')]=_0x40fb57['peerstatus']['toLowerCase']();this['agents'][_0x40fb57[_0x1f66('0x46')]][_0x1f66('0x47')]=_0x40fb57[_0x1f66('0x47')];this[_0x1f66('0xe')][_0x40fb57[_0x1f66('0x46')]][_0x1f66('0x3a')](_0x40fb57);}}else if(this[_0x1f66('0xf')][_0x40fb57[_0x1f66('0x46')]]){this['telephones'][_0x40fb57[_0x1f66('0x46')]][_0x1f66('0x4b')]=_0x40fb57[_0x1f66('0x49')][_0x1f66('0x36')]();this[_0x1f66('0xf')][_0x40fb57[_0x1f66('0x46')]]['address']=_0x40fb57[_0x1f66('0x47')];logger['debug']('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0x1f66('0x1c')](this[_0x1f66('0xf')][_0x40fb57[_0x1f66('0x46')]],{'showHidden':![],'depth':null}));this[_0x1f66('0x20')](util[_0x1f66('0x2d')](_0x1f66('0x3c'),this['telephones'][_0x40fb57['peer']][_0x1f66('0x2e')]),_0x1f66('0x3d'),this['telephones'][_0x40fb57[_0x1f66('0x46')]]);}else if(this[_0x1f66('0xd')][_0x40fb57[_0x1f66('0x46')]]){this[_0x1f66('0xd')][_0x40fb57[_0x1f66('0x46')]][_0x1f66('0x4b')]=_0x40fb57[_0x1f66('0x49')]['toLowerCase']();this[_0x1f66('0xd')][_0x40fb57[_0x1f66('0x46')]][_0x1f66('0x47')]=_0x40fb57[_0x1f66('0x47')];logger[_0x1f66('0x25')](_0x1f66('0x4c'),util['inspect'](this[_0x1f66('0xd')][_0x40fb57[_0x1f66('0x46')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x1f66('0x2d')]('trunk:%s',this[_0x1f66('0xd')][_0x40fb57[_0x1f66('0x46')]][_0x1f66('0x2e')]),_0x1f66('0x2f'),this['trunks'][_0x40fb57[_0x1f66('0x46')]]);}}}catch(_0x4d6999){logger[_0x1f66('0x1a')](_0x1f66('0x48'),util[_0x1f66('0x1c')](_0x4d6999,{'showHidden':![],'depth':null}));}};module[_0x1f66('0x4d')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index c05a751..ed7b644 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 _0x5f71=['[%s][voiceAgentReport][varset]\x20event:','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','transfereeuniqueid','complete','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','substring','channel','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','lodash','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','variables','bind','agentconnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','syncAgentComplete','varset','hangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','syncAgentCalled','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','format','YYYY-MM-DD\x20HH:mm:ss','queue','type','inbound','merge','omit','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','inspect','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','info','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','routealias','interface','pick','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','agentcomplete','answeredelsewheredestinationuniqueid','answeredelsewheremembername','reason','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','agentringnoanswerAt','lastevent','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','[%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','transfer','agent','talktime','acw','acwTimeout','destconnectedlinenum','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','syncVarSet'];(function(_0x4da17e,_0x24787b){var _0x478b46=function(_0x33e5eb){while(--_0x33e5eb){_0x4da17e['push'](_0x4da17e['shift']());}};_0x478b46(++_0x24787b);}(_0x5f71,0xc9));var _0x15f7=function(_0x20a9df,_0x176db6){_0x20a9df=_0x20a9df-0x0;var _0x55b96c=_0x5f71[_0x20a9df];return _0x55b96c;};'use strict';var _=require(_0x15f7('0x0'));var moment=require('moment');var util=require(_0x15f7('0x1'));var Redis=require('ioredis');var config=require(_0x15f7('0x2'));var logger=require('../../../config/logger')('ami');var ami=require('../ami');config[_0x15f7('0x3')]=_[_0x15f7('0x4')](config['redis'],{'host':_0x15f7('0x5'),'port':0x18eb});var io=require(_0x15f7('0x6'))(new Redis(config[_0x15f7('0x3')]));function VoiceAgentReport(_0x1de7b3){this[_0x15f7('0x7')]={};this[_0x15f7('0x8')]=_0x1de7b3[_0x15f7('0x7')];this[_0x15f7('0x9')]=_0x1de7b3[_0x15f7('0x9')];this[_0x15f7('0xa')]=_0x1de7b3[_0x15f7('0xa')];this[_0x15f7('0xb')]={};ami['on']('agentcalled',this['syncAgentCalled'][_0x15f7('0xc')](this));ami['on'](_0x15f7('0xd'),this['syncAgentConnect'][_0x15f7('0xc')](this));ami['on'](_0x15f7('0xe'),this[_0x15f7('0xf')][_0x15f7('0xc')](this));ami['on'](_0x15f7('0x10'),this[_0x15f7('0x11')][_0x15f7('0xc')](this));ami['on']('agentcomplete',this[_0x15f7('0x12')][_0x15f7('0xc')](this));ami['on'](_0x15f7('0x13'),this['syncVarSet'][_0x15f7('0xc')](this));ami['on'](_0x15f7('0x14'),this['syncHangup'][_0x15f7('0xc')](this));ami['on'](_0x15f7('0x15'),this[_0x15f7('0x16')][_0x15f7('0xc')](this));ami['on'](_0x15f7('0x17'),this[_0x15f7('0x18')][_0x15f7('0xc')](this));ami['on']('attendedtransfer',this[_0x15f7('0x19')][_0x15f7('0xc')](this));ami['on']('blindtransfer',this[_0x15f7('0x1a')][_0x15f7('0xc')](this));}VoiceAgentReport[_0x15f7('0x1b')][_0x15f7('0x1c')]=function(_0x26627b,_0x2bb463,_0x3ced97){io['to'](_0x26627b)['emit'](_0x2bb463,_0x3ced97);};VoiceAgentReport[_0x15f7('0x1b')][_0x15f7('0x1d')]=function(_0x1362e1){return _0x1362e1!==null&&!_[_0x15f7('0x1e')](_0x1362e1);};VoiceAgentReport[_0x15f7('0x1b')][_0x15f7('0x1f')]=function(_0x3bf068){try{if(this['isNotNull'](_0x3bf068)){logger['info'](_0x15f7('0x20'),_0x3bf068[_0x15f7('0x21')],_0x3bf068[_0x15f7('0x22')],_0x3bf068[_0x15f7('0x23')]);logger[_0x15f7('0x24')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0x3bf068[_0x15f7('0x21')],util['inspect'](_0x3bf068,{'showHidden':![],'depth':null}));if(_[_0x15f7('0x1e')](this[_0x15f7('0x7')][_0x3bf068['uniqueid']])){this['channels'][_0x3bf068[_0x15f7('0x21')]]={};}if(_['isUndefined'](this['channels'][_0x3bf068[_0x15f7('0x21')]][_0x3bf068['destuniqueid']])){this[_0x15f7('0x7')][_0x3bf068[_0x15f7('0x21')]][_0x3bf068[_0x15f7('0x23')]]={'agentcalledAt':moment()[_0x15f7('0x25')](_0x15f7('0x26')),'lastevent':'called','mandatoryDisposition':this[_0x15f7('0x9')][_0x3bf068[_0x15f7('0x27')]]?this[_0x15f7('0x9')][_0x3bf068['queue']]['mandatoryDisposition']||![]:![],'type':this['voiceQueues'][_0x3bf068['queue']]?this[_0x15f7('0x9')][_0x3bf068[_0x15f7('0x27')]][_0x15f7('0x28')]||_0x15f7('0x29'):_0x15f7('0x29'),'variables':this[_0x15f7('0xb')][_0x3bf068['uniqueid']],'motionChannel':'voice'};}_[_0x15f7('0x2a')](this[_0x15f7('0x7')][_0x3bf068[_0x15f7('0x21')]][_0x3bf068['destuniqueid']],_[_0x15f7('0x2b')](_0x3bf068,['event',_0x15f7('0x2c')]));logger['debug'](_0x15f7('0x2d'),_0x3bf068[_0x15f7('0x21')],util[_0x15f7('0x2e')](this[_0x15f7('0x7')][_0x3bf068['uniqueid']][_0x3bf068['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x15f7('0x1c')](_0x15f7('0x2f'),this[_0x15f7('0x7')][_0x3bf068[_0x15f7('0x21')]][_0x3bf068[_0x15f7('0x23')]]);logger[_0x15f7('0x24')](_0x15f7('0x30'),_0x3bf068[_0x15f7('0x21')],util[_0x15f7('0x2e')](this[_0x15f7('0x7')][_0x3bf068[_0x15f7('0x21')]][_0x3bf068['destuniqueid']],{'showHidden':![],'depth':null}));this[_0x15f7('0x1c')](util['format'](_0x15f7('0x31'),_0x3bf068[_0x15f7('0x22')]),_0x15f7('0x32'),this[_0x15f7('0x7')][_0x3bf068[_0x15f7('0x21')]][_0x3bf068[_0x15f7('0x23')]]);}}catch(_0x5c7cb9){logger[_0x15f7('0x33')]('[%s][voiceAgentReport][agentcalled]',_0x3bf068[_0x15f7('0x21')],util[_0x15f7('0x2e')](_0x5c7cb9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x15f7('0x1b')][_0x15f7('0x34')]=function(_0x437f11){try{if(this['isNotNull'](_0x437f11)){if(this[_0x15f7('0x7')][_0x437f11['uniqueid']]){logger['debug'](_0x15f7('0x35'),_0x437f11['uniqueid'],util[_0x15f7('0x2e')](_0x437f11,{'showHidden':![],'depth':null}));for(var _0x3a1b7a in this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]]){if(this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x15f7('0x36')](_0x3a1b7a)){if(_0x437f11['destuniqueid']===_0x3a1b7a){logger[_0x15f7('0x37')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x437f11[_0x15f7('0x21')],_0x437f11[_0x15f7('0x22')],_0x437f11['destuniqueid']);this['channels'][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a][_0x15f7('0x38')]=moment()[_0x15f7('0x25')](_0x15f7('0x26'));this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a][_0x15f7('0x39')]=_0x437f11[_0x15f7('0x39')];this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a][_0x15f7('0x3a')]=_0x437f11[_0x15f7('0x3a')];this['channels'][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a][_0x15f7('0x3b')]=_0x437f11['destchannelstate'];this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a]['destchannelstatedesc']=_0x437f11[_0x15f7('0x3c')];this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a]['holdtime']=_0x437f11[_0x15f7('0x3d')];this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a]['lastevent']=_0x15f7('0x3e');if(this['voiceChannels'][this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a][_0x15f7('0x21')]]){var _0x3a3feb=this[_0x15f7('0x8')][this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a][_0x15f7('0x21')]][_0x15f7('0x3f')];this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a][_0x15f7('0x3f')]=_0x3a3feb;_0x437f11['routealias']=_0x3a3feb;}_[_0x15f7('0x2a')](this['agents'][_0x437f11[_0x15f7('0x40')]],_[_0x15f7('0x41')](_0x437f11,['queue','destconnectedlinenum',_0x15f7('0x3f')]));logger[_0x15f7('0x24')](_0x15f7('0x42'),_0x437f11['uniqueid'],util[_0x15f7('0x2e')](this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x437f11[_0x15f7('0x23')]],{'showHidden':![],'depth':null}));ami[_0x15f7('0x1c')](_0x15f7('0x43'),this['channels'][_0x437f11['uniqueid']][_0x437f11[_0x15f7('0x23')]]);logger['debug'](_0x15f7('0x44'),_0x437f11[_0x15f7('0x21')],util['inspect'](this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x437f11[_0x15f7('0x23')]],{'showHidden':![],'depth':null}));this[_0x15f7('0x1c')](util[_0x15f7('0x25')](_0x15f7('0x31'),_0x437f11[_0x15f7('0x22')]),'user:agentconnect',this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x437f11[_0x15f7('0x23')]]);}else if(!this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a][_0x15f7('0xe')]&&!this[_0x15f7('0x7')][_0x437f11['uniqueid']][_0x3a1b7a][_0x15f7('0x45')]){logger[_0x15f7('0x37')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x437f11[_0x15f7('0x21')],this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a]['membername'],_0x3a1b7a);this[_0x15f7('0x7')][_0x437f11['uniqueid']][_0x3a1b7a][_0x15f7('0xe')]=!![];this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a]['agentringnoanswerAt']=moment()[_0x15f7('0x25')](_0x15f7('0x26'));this[_0x15f7('0x7')][_0x437f11['uniqueid']][_0x3a1b7a][_0x15f7('0x46')]=_0x437f11[_0x15f7('0x23')];this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a][_0x15f7('0x47')]=_0x437f11['membername'];this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a]['lastevent']='answered_elsewhere';this['channels'][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a][_0x15f7('0x48')]=_0x15f7('0x49');logger['debug'](_0x15f7('0x4a'),_0x437f11[_0x15f7('0x21')],util['inspect'](this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a],{'showHidden':![],'depth':null}));ami[_0x15f7('0x1c')](_0x15f7('0x4b'),this['channels'][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a]);}}}}}}catch(_0x363f8c){logger[_0x15f7('0x33')](_0x15f7('0x4c'),_0x437f11['uniqueid'],util[_0x15f7('0x2e')](_0x363f8c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x15f7('0x1b')][_0x15f7('0xf')]=function(_0x21d62d){try{if(this['isNotNull'](_0x21d62d)){logger['debug'](_0x15f7('0x4d'),_0x21d62d[_0x15f7('0x21')],util[_0x15f7('0x2e')](_0x21d62d,{'showHidden':![],'depth':null}));if(this['channels'][_0x21d62d['uniqueid']]&&this[_0x15f7('0x7')][_0x21d62d[_0x15f7('0x21')]][_0x21d62d[_0x15f7('0x23')]]){logger[_0x15f7('0x37')](_0x15f7('0x4e'),_0x21d62d[_0x15f7('0x21')],_0x21d62d[_0x15f7('0x22')],_0x21d62d[_0x15f7('0x23')]);this[_0x15f7('0x7')][_0x21d62d['uniqueid']][_0x21d62d['destuniqueid']]['agentringnoanswer']=!![];this[_0x15f7('0x7')][_0x21d62d[_0x15f7('0x21')]][_0x21d62d[_0x15f7('0x23')]][_0x15f7('0x4f')]=moment()[_0x15f7('0x25')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x15f7('0x7')][_0x21d62d[_0x15f7('0x21')]][_0x21d62d[_0x15f7('0x23')]][_0x15f7('0x50')]=_0x15f7('0x51');this[_0x15f7('0x7')][_0x21d62d[_0x15f7('0x21')]][_0x21d62d['destuniqueid']][_0x15f7('0x48')]='rejected';logger[_0x15f7('0x24')](_0x15f7('0x52'),_0x21d62d[_0x15f7('0x21')],util[_0x15f7('0x2e')](this[_0x15f7('0x7')][_0x21d62d[_0x15f7('0x21')]][_0x21d62d[_0x15f7('0x23')]],{'showHidden':![],'depth':null}));ami[_0x15f7('0x1c')]('custom:agentringnoanswer',this[_0x15f7('0x7')][_0x21d62d[_0x15f7('0x21')]][_0x21d62d['destuniqueid']]);}}}catch(_0x1627d5){logger['error'](_0x15f7('0x53'),_0x21d62d[_0x15f7('0x21')],util[_0x15f7('0x2e')](_0x1627d5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x15f7('0x1b')]['syncQueueCallerAbandon']=function(_0x55c79a){try{if(this['isNotNull'](_0x55c79a)){logger[_0x15f7('0x24')](_0x15f7('0x54'),_0x55c79a[_0x15f7('0x21')],util[_0x15f7('0x2e')](_0x55c79a,{'showHidden':![],'depth':null}));if(this[_0x15f7('0x7')][_0x55c79a[_0x15f7('0x21')]]){for(var _0x57383f in this['channels'][_0x55c79a['uniqueid']]){if(this[_0x15f7('0x7')][_0x55c79a[_0x15f7('0x21')]]['hasOwnProperty'](_0x57383f)&&!this[_0x15f7('0x7')][_0x55c79a[_0x15f7('0x21')]][_0x57383f][_0x15f7('0xe')]&&!this[_0x15f7('0x7')][_0x55c79a[_0x15f7('0x21')]][_0x57383f][_0x15f7('0x45')]){logger['info'](_0x15f7('0x55'),_0x55c79a[_0x15f7('0x21')],this['channels'][_0x55c79a[_0x15f7('0x21')]][_0x57383f][_0x15f7('0x22')],_0x57383f);this[_0x15f7('0x7')][_0x55c79a[_0x15f7('0x21')]][_0x57383f]['agentringnoanswer']=!![];this[_0x15f7('0x7')][_0x55c79a[_0x15f7('0x21')]][_0x57383f][_0x15f7('0x4f')]=moment()[_0x15f7('0x25')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x15f7('0x7')][_0x55c79a[_0x15f7('0x21')]][_0x57383f][_0x15f7('0x50')]=_0x15f7('0x56');this[_0x15f7('0x7')][_0x55c79a[_0x15f7('0x21')]][_0x57383f][_0x15f7('0x48')]='abandoned';logger[_0x15f7('0x24')](_0x15f7('0x57'),_0x55c79a[_0x15f7('0x21')],util['inspect'](this[_0x15f7('0x7')][_0x55c79a['uniqueid']][_0x57383f],{'showHidden':![],'depth':null}));ami['emit'](_0x15f7('0x58'),this[_0x15f7('0x7')][_0x55c79a['uniqueid']][_0x57383f]);}}}}}catch(_0x493d88){logger['error'](_0x15f7('0x59'),_0x55c79a[_0x15f7('0x21')],util[_0x15f7('0x2e')](_0x493d88,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x15f7('0x1b')][_0x15f7('0x12')]=function(_0x4e2c26){try{if(this[_0x15f7('0x1d')](_0x4e2c26)){logger['debug'](_0x15f7('0x5a'),_0x4e2c26[_0x15f7('0x21')],util['inspect'](_0x4e2c26,{'showHidden':![],'depth':null}));if(this[_0x15f7('0x7')][_0x4e2c26[_0x15f7('0x21')]]){for(var _0x8c0a2a in this['channels'][_0x4e2c26[_0x15f7('0x21')]]){if(this[_0x15f7('0x7')][_0x4e2c26['uniqueid']]['hasOwnProperty'](_0x8c0a2a)){if(this[_0x15f7('0x7')][_0x4e2c26['uniqueid']][_0x8c0a2a][_0x15f7('0x38')]&&!this[_0x15f7('0x7')][_0x4e2c26[_0x15f7('0x21')]][_0x8c0a2a][_0x15f7('0x45')]){logger[_0x15f7('0x37')](_0x15f7('0x5b'),_0x4e2c26[_0x15f7('0x21')],this[_0x15f7('0x7')][_0x4e2c26[_0x15f7('0x21')]][_0x8c0a2a][_0x15f7('0x22')],_0x8c0a2a);this[_0x15f7('0x7')][_0x4e2c26[_0x15f7('0x21')]][_0x8c0a2a][_0x15f7('0x45')]=!![];this[_0x15f7('0x7')][_0x4e2c26[_0x15f7('0x21')]][_0x8c0a2a][_0x15f7('0x5c')]=moment()[_0x15f7('0x25')](_0x15f7('0x26'));this['channels'][_0x4e2c26[_0x15f7('0x21')]][_0x8c0a2a]['lastevent']='complete';this[_0x15f7('0x7')][_0x4e2c26['uniqueid']][_0x8c0a2a][_0x15f7('0x48')]=_0x4e2c26['reason']==_0x15f7('0x5d')?_0x15f7('0x5e'):_0x4e2c26[_0x15f7('0x48')];this[_0x15f7('0x7')][_0x4e2c26['uniqueid']][_0x8c0a2a][_0x15f7('0x5f')]=_0x4e2c26[_0x15f7('0x5f')];if(this[_0x15f7('0x9')][_0x4e2c26[_0x15f7('0x27')]]&&this[_0x15f7('0x9')][_0x4e2c26[_0x15f7('0x27')]][_0x15f7('0x60')]){this[_0x15f7('0x7')][_0x4e2c26[_0x15f7('0x21')]][_0x8c0a2a]['acwtime']=this[_0x15f7('0x9')][_0x4e2c26['queue']][_0x15f7('0x61')];this['channels'][_0x4e2c26[_0x15f7('0x21')]][_0x8c0a2a]['agentacw']=!![];}this[_0x15f7('0xa')][_0x4e2c26[_0x15f7('0x40')]]=_[_0x15f7('0x2b')](this['agents'][_0x4e2c26['interface']],[_0x15f7('0x27'),_0x15f7('0x62')]);logger[_0x15f7('0x24')](_0x15f7('0x63'),_0x4e2c26[_0x15f7('0x21')],util[_0x15f7('0x2e')](this[_0x15f7('0x7')][_0x4e2c26['uniqueid']][_0x8c0a2a],{'showHidden':![],'depth':null}));ami['emit'](_0x15f7('0x64'),this[_0x15f7('0x7')][_0x4e2c26[_0x15f7('0x21')]][_0x8c0a2a]);logger[_0x15f7('0x24')](_0x15f7('0x65'),_0x4e2c26[_0x15f7('0x21')],util[_0x15f7('0x2e')](this['channels'][_0x4e2c26[_0x15f7('0x21')]][_0x8c0a2a],{'showHidden':![],'depth':null}));this[_0x15f7('0x1c')](util['format']('user:%s',_0x4e2c26['membername']),_0x15f7('0x66'),this[_0x15f7('0x7')][_0x4e2c26[_0x15f7('0x21')]][_0x8c0a2a]);}}}}}}catch(_0x22923b){logger[_0x15f7('0x33')](_0x15f7('0x67'),_0x4e2c26[_0x15f7('0x21')],util[_0x15f7('0x2e')](_0x22923b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x15f7('0x1b')][_0x15f7('0x68')]=function(_0x1c53d7){try{if(this['isNotNull'](_0x1c53d7)){logger[_0x15f7('0x24')](_0x15f7('0x69'),_0x1c53d7[_0x15f7('0x21')],util['inspect'](_0x1c53d7,{'showHidden':![],'depth':null}));this['addVariable'](_0x1c53d7[_0x15f7('0x21')],_[_0x15f7('0x6a')](_0x1c53d7[_0x15f7('0x6b')])[0x0],_0x1c53d7[_0x15f7('0x6c')]);if(this[_0x15f7('0x7')][_0x1c53d7[_0x15f7('0x21')]]){for(var _0x4452e2 in this['channels'][_0x1c53d7[_0x15f7('0x21')]]){if(this['channels'][_0x1c53d7['uniqueid']][_0x15f7('0x36')](_0x4452e2)){logger['info'](_0x15f7('0x6d'),_0x1c53d7[_0x15f7('0x21')],_0x4452e2,_[_0x15f7('0x6a')](_0x1c53d7[_0x15f7('0x6b')])[0x0],_0x1c53d7[_0x15f7('0x6c')]);if(_[_0x15f7('0x1e')](this[_0x15f7('0x7')][_0x1c53d7[_0x15f7('0x21')]][_0x4452e2][_0x15f7('0xb')])){this[_0x15f7('0x7')][_0x1c53d7[_0x15f7('0x21')]][_0x4452e2][_0x15f7('0xb')]={};}this[_0x15f7('0x7')][_0x1c53d7[_0x15f7('0x21')]][_0x4452e2][_0x15f7('0xb')]=this[_0x15f7('0xb')][_0x1c53d7[_0x15f7('0x21')]];}}}}}catch(_0x122351){logger[_0x15f7('0x33')](_0x15f7('0x6e'),_0x1c53d7[_0x15f7('0x21')],util[_0x15f7('0x2e')](_0x122351,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x15f7('0x6f')]=function(_0x516ffd,_0x3c5687,_0x51f027){var _0x5296c4=[_0x15f7('0x70'),_0x15f7('0x71'),_0x15f7('0x72'),'rtpaudioqosjitterbridged',_0x15f7('0x73'),_0x15f7('0x74'),_0x15f7('0x75'),_0x15f7('0x76'),'sipcallid',_0x15f7('0x77'),_0x15f7('0x78'),_0x15f7('0x79'),'membercalls','memberdynamic',_0x15f7('0x7a'),_0x15f7('0x7b'),'membername',_0x15f7('0x7c'),_0x15f7('0x7d')];if(!_[_0x15f7('0x7e')](_0x3c5687)&&!_[_0x15f7('0x7f')](_0x5296c4,_0x3c5687)){if(_[_0x15f7('0x1e')](this[_0x15f7('0xb')][_0x516ffd])){this[_0x15f7('0xb')][_0x516ffd]={};}this['variables'][_0x516ffd][_0x3c5687]=_0x51f027;}};VoiceAgentReport[_0x15f7('0x1b')]['syncHangup']=function(_0x44a885){try{if(this[_0x15f7('0x1d')](_0x44a885)){logger[_0x15f7('0x24')](_0x15f7('0x80'),_0x44a885[_0x15f7('0x21')],util['inspect'](_0x44a885,{'showHidden':![],'depth':null}));if(this[_0x15f7('0x7')][_0x44a885[_0x15f7('0x21')]]){for(var _0x1a3041 in this[_0x15f7('0x7')][_0x44a885[_0x15f7('0x21')]]){if(this[_0x15f7('0x7')][_0x44a885['uniqueid']][_0x15f7('0x36')](_0x1a3041)){if(this[_0x15f7('0x7')][_0x44a885[_0x15f7('0x21')]][_0x1a3041][_0x15f7('0x48')]==_0x15f7('0x5d')&&this[_0x15f7('0x7')][_0x44a885[_0x15f7('0x21')]][_0x1a3041][_0x15f7('0x45')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x44a885[_0x15f7('0x21')],_0x1a3041);this[_0x15f7('0x7')][_0x44a885[_0x15f7('0x21')]][_0x1a3041][_0x15f7('0x5c')]=moment()[_0x15f7('0x25')](_0x15f7('0x26'));}}}logger[_0x15f7('0x24')](_0x15f7('0x81'),_0x44a885[_0x15f7('0x21')],util[_0x15f7('0x2e')](_[_0x15f7('0x82')](this[_0x15f7('0x7')][_0x44a885[_0x15f7('0x21')]]),{'showHidden':![],'depth':null}));ami['emit'](_0x15f7('0x83'),_[_0x15f7('0x82')](this[_0x15f7('0x7')][_0x44a885[_0x15f7('0x21')]]));delete this[_0x15f7('0x7')][_0x44a885[_0x15f7('0x21')]];}if(this[_0x15f7('0xb')][_0x44a885[_0x15f7('0x21')]]){delete this[_0x15f7('0xb')][_0x44a885['uniqueid']];}}}catch(_0x462406){logger['error'](_0x15f7('0x84'),_0x44a885[_0x15f7('0x21')],util['inspect'](_0x462406,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x15f7('0x1b')][_0x15f7('0x19')]=function(_0x173e34){try{if(this['isNotNull'](_0x173e34)){logger[_0x15f7('0x24')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x173e34[_0x15f7('0x21')],util['inspect'](_0x173e34,{'showHidden':![],'depth':null}));if(this['channels'][_0x173e34['transfereeuniqueid']]){for(var _0x841a4c in this[_0x15f7('0x7')][_0x173e34['transfereeuniqueid']]){if(this[_0x15f7('0x7')][_0x173e34[_0x15f7('0x85')]][_0x15f7('0x36')](_0x841a4c)){if(_0x173e34['origtransfereruniqueid']===_0x841a4c){logger[_0x15f7('0x37')]('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x173e34[_0x15f7('0x21')],this[_0x15f7('0x7')][_0x173e34[_0x15f7('0x85')]][_0x841a4c][_0x15f7('0x22')],_0x841a4c);var _0x1ed83a=moment();this[_0x15f7('0x7')][_0x173e34[_0x15f7('0x85')]][_0x841a4c]['agentcomplete']=!![];this['channels'][_0x173e34['transfereeuniqueid']][_0x841a4c][_0x15f7('0x5c')]=moment()[_0x15f7('0x25')](_0x15f7('0x26'));this[_0x15f7('0x7')][_0x173e34['transfereeuniqueid']][_0x841a4c][_0x15f7('0x50')]=_0x15f7('0x86');this['channels'][_0x173e34['transfereeuniqueid']][_0x841a4c][_0x15f7('0x48')]='transfer';this[_0x15f7('0x7')][_0x173e34['transfereeuniqueid']][_0x841a4c][_0x15f7('0x5f')]=_0x1ed83a['diff'](this[_0x15f7('0x7')][_0x173e34[_0x15f7('0x85')]][_0x841a4c][_0x15f7('0x38')],_0x15f7('0x87'));}}}}if(this[_0x15f7('0x7')][_0x173e34[_0x15f7('0x88')]]){var _0x1308bb=this[_0x15f7('0x7')][_0x173e34[_0x15f7('0x88')]];this[_0x15f7('0x7')][_0x173e34[_0x15f7('0x88')]]=this[_0x15f7('0x7')][_0x173e34['transfereeuniqueid']];this[_0x15f7('0x7')][_0x173e34[_0x15f7('0x85')]]=_0x1308bb;}}}catch(_0x18f391){logger['error'](_0x15f7('0x89'),_0x173e34[_0x15f7('0x21')],util[_0x15f7('0x2e')](_0x18f391,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x15f7('0x1b')]['syncBlindTransfer']=function(_0x193708){try{if(this[_0x15f7('0x1d')](_0x193708)){logger[_0x15f7('0x24')](_0x15f7('0x8a'),_0x193708['uniqueid'],util[_0x15f7('0x2e')](_0x193708,{'showHidden':![],'depth':null}));if(this[_0x15f7('0x7')][_0x193708['transfereeuniqueid']]){for(var _0x13040a in this[_0x15f7('0x7')][_0x193708['transfereeuniqueid']]){if(this[_0x15f7('0x7')][_0x193708['transfereeuniqueid']][_0x15f7('0x36')](_0x13040a)){if(_0x193708[_0x15f7('0x8b')]===_0x13040a){logger[_0x15f7('0x37')](_0x15f7('0x8c'),_0x193708['uniqueid'],this[_0x15f7('0x7')][_0x193708[_0x15f7('0x85')]][_0x13040a][_0x15f7('0x22')],_0x13040a);var _0x42dad8=moment();this[_0x15f7('0x7')][_0x193708[_0x15f7('0x85')]][_0x13040a]['agentcomplete']=!![];this[_0x15f7('0x7')][_0x193708[_0x15f7('0x85')]][_0x13040a][_0x15f7('0x5c')]=_0x42dad8;this['channels'][_0x193708[_0x15f7('0x85')]][_0x13040a][_0x15f7('0x50')]=_0x15f7('0x86');this[_0x15f7('0x7')][_0x193708[_0x15f7('0x85')]][_0x13040a]['reason']=_0x15f7('0x5d');this[_0x15f7('0x7')][_0x193708[_0x15f7('0x85')]][_0x13040a][_0x15f7('0x5f')]=_0x42dad8[_0x15f7('0x8d')](this[_0x15f7('0x7')][_0x193708[_0x15f7('0x85')]][_0x13040a][_0x15f7('0x38')],_0x15f7('0x87'));}}}}}}catch(_0x3d4246){logger[_0x15f7('0x33')](_0x15f7('0x8e'),_0x193708[_0x15f7('0x21')],util['inspect'](_0x3d4246,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x15f7('0x1b')][_0x15f7('0x16')]=function(_0x3d29f2){var _0x8c5218='';try{if(this[_0x15f7('0x1d')](_0x3d29f2)){logger[_0x15f7('0x24')](_0x15f7('0x8f'),_0x3d29f2[_0x15f7('0x21')],util[_0x15f7('0x2e')](_0x3d29f2,{'showHidden':![],'depth':null}));if(_0x3d29f2['channel']){_0x8c5218=_0x3d29f2['channel'][_0x15f7('0x90')](0x0,_0x3d29f2[_0x15f7('0x91')][_0x15f7('0x92')]('-'));if(this[_0x15f7('0xa')][_0x8c5218]){logger[_0x15f7('0x37')](_0x15f7('0x93'),_0x3d29f2['uniqueid'],_0x8c5218);this[_0x15f7('0xa')][_0x8c5218][_0x15f7('0x94')]=!![];}}}}catch(_0x56f099){logger[_0x15f7('0x33')](_0x15f7('0x95'),_0x3d29f2[_0x15f7('0x21')],util[_0x15f7('0x2e')](_0x56f099,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x15f7('0x18')]=function(_0x2f89f5){var _0x4c595d='';try{if(this[_0x15f7('0x1d')](_0x2f89f5)){logger['debug'](_0x15f7('0x96'),_0x2f89f5[_0x15f7('0x21')],util[_0x15f7('0x2e')](_0x2f89f5,{'showHidden':![],'depth':null}));if(_0x2f89f5[_0x15f7('0x91')]){_0x4c595d=_0x2f89f5[_0x15f7('0x91')]['substring'](0x0,_0x2f89f5[_0x15f7('0x91')][_0x15f7('0x92')]('-'));if(this['agents'][_0x4c595d]){logger[_0x15f7('0x37')](_0x15f7('0x97'),_0x2f89f5[_0x15f7('0x21')],_0x4c595d);this[_0x15f7('0xa')][_0x4c595d]['onhold']=![];}}}}catch(_0x2f4668){logger['error'](_0x15f7('0x98'),_0x2f89f5['uniqueid'],util['inspect'](_0x2f4668,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0xb209=['memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','transfereeuniqueid','origtransfereruniqueid','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','substring','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','redis','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','voice','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','user:%s','membername','user:called','error','[%s][voiceAgentReport][agentconnect]\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','voiceChannels','routealias','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','answeredelsewheremembername','lastevent','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','syncVarSet','addVariable','keys','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','variable','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberinterface'];(function(_0x59d58d,_0x30d3c8){var _0x41e38a=function(_0x50ab18){while(--_0x50ab18){_0x59d58d['push'](_0x59d58d['shift']());}};_0x41e38a(++_0x30d3c8);}(_0xb209,0x151));var _0x9b20=function(_0x1aa121,_0x50b5d3){_0x1aa121=_0x1aa121-0x0;var _0x644602=_0xb209[_0x1aa121];return _0x644602;};'use strict';var _=require(_0x9b20('0x0'));var moment=require(_0x9b20('0x1'));var util=require(_0x9b20('0x2'));var Redis=require(_0x9b20('0x3'));var config=require(_0x9b20('0x4'));var logger=require(_0x9b20('0x5'))(_0x9b20('0x6'));var ami=require('../ami');config[_0x9b20('0x7')]=_['defaults'](config[_0x9b20('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9b20('0x7')]));function VoiceAgentReport(_0x453031){this[_0x9b20('0x8')]={};this['voiceChannels']=_0x453031[_0x9b20('0x8')];this[_0x9b20('0x9')]=_0x453031[_0x9b20('0x9')];this[_0x9b20('0xa')]=_0x453031['agents'];this[_0x9b20('0xb')]={};ami['on'](_0x9b20('0xc'),this[_0x9b20('0xd')][_0x9b20('0xe')](this));ami['on'](_0x9b20('0xf'),this[_0x9b20('0x10')][_0x9b20('0xe')](this));ami['on'](_0x9b20('0x11'),this[_0x9b20('0x12')][_0x9b20('0xe')](this));ami['on'](_0x9b20('0x13'),this[_0x9b20('0x14')]['bind'](this));ami['on'](_0x9b20('0x15'),this[_0x9b20('0x16')]['bind'](this));ami['on'](_0x9b20('0x17'),this['syncVarSet']['bind'](this));ami['on'](_0x9b20('0x18'),this[_0x9b20('0x19')][_0x9b20('0xe')](this));ami['on'](_0x9b20('0x1a'),this[_0x9b20('0x1b')][_0x9b20('0xe')](this));ami['on'](_0x9b20('0x1c'),this[_0x9b20('0x1d')][_0x9b20('0xe')](this));ami['on'](_0x9b20('0x1e'),this[_0x9b20('0x1f')][_0x9b20('0xe')](this));ami['on'](_0x9b20('0x20'),this[_0x9b20('0x21')]['bind'](this));}VoiceAgentReport[_0x9b20('0x22')][_0x9b20('0x23')]=function(_0x3b2653,_0x2b3819,_0x40e24c){io['to'](_0x3b2653)['emit'](_0x2b3819,_0x40e24c);};VoiceAgentReport[_0x9b20('0x22')][_0x9b20('0x24')]=function(_0x2a42d7){return _0x2a42d7!==null&&!_[_0x9b20('0x25')](_0x2a42d7);};VoiceAgentReport[_0x9b20('0x22')][_0x9b20('0xd')]=function(_0x17e902){try{if(this[_0x9b20('0x24')](_0x17e902)){logger[_0x9b20('0x26')](_0x9b20('0x27'),_0x17e902[_0x9b20('0x28')],_0x17e902['membername'],_0x17e902[_0x9b20('0x29')]);logger[_0x9b20('0x2a')](_0x9b20('0x2b'),_0x17e902[_0x9b20('0x28')],util[_0x9b20('0x2c')](_0x17e902,{'showHidden':![],'depth':null}));if(_[_0x9b20('0x25')](this['channels'][_0x17e902[_0x9b20('0x28')]])){this[_0x9b20('0x8')][_0x17e902[_0x9b20('0x28')]]={};}if(_['isUndefined'](this['channels'][_0x17e902[_0x9b20('0x28')]][_0x17e902[_0x9b20('0x29')]])){this[_0x9b20('0x8')][_0x17e902['uniqueid']][_0x17e902[_0x9b20('0x29')]]={'agentcalledAt':moment()[_0x9b20('0x2d')](_0x9b20('0x2e')),'lastevent':_0x9b20('0x2f'),'mandatoryDisposition':this[_0x9b20('0x9')][_0x17e902[_0x9b20('0x30')]]?this['voiceQueues'][_0x17e902[_0x9b20('0x30')]]['mandatoryDisposition']||![]:![],'type':this[_0x9b20('0x9')][_0x17e902['queue']]?this[_0x9b20('0x9')][_0x17e902[_0x9b20('0x30')]][_0x9b20('0x31')]||'inbound':_0x9b20('0x32'),'variables':this[_0x9b20('0xb')][_0x17e902[_0x9b20('0x28')]],'motionChannel':_0x9b20('0x33')};}_[_0x9b20('0x34')](this[_0x9b20('0x8')][_0x17e902['uniqueid']][_0x17e902[_0x9b20('0x29')]],_[_0x9b20('0x35')](_0x17e902,[_0x9b20('0x36'),_0x9b20('0x37')]));logger['debug'](_0x9b20('0x38'),_0x17e902[_0x9b20('0x28')],util['inspect'](this[_0x9b20('0x8')][_0x17e902[_0x9b20('0x28')]][_0x17e902[_0x9b20('0x29')]],{'showHidden':![],'depth':null}));ami['emit'](_0x9b20('0x39'),this[_0x9b20('0x8')][_0x17e902[_0x9b20('0x28')]][_0x17e902[_0x9b20('0x29')]]);logger[_0x9b20('0x2a')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x17e902[_0x9b20('0x28')],util['inspect'](this[_0x9b20('0x8')][_0x17e902['uniqueid']][_0x17e902['destuniqueid']],{'showHidden':![],'depth':null}));this[_0x9b20('0x23')](util[_0x9b20('0x2d')](_0x9b20('0x3a'),_0x17e902[_0x9b20('0x3b')]),_0x9b20('0x3c'),this[_0x9b20('0x8')][_0x17e902['uniqueid']][_0x17e902[_0x9b20('0x29')]]);}}catch(_0x2cd682){logger[_0x9b20('0x3d')]('[%s][voiceAgentReport][agentcalled]',_0x17e902[_0x9b20('0x28')],util['inspect'](_0x2cd682,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x9b20('0x10')]=function(_0x5a62cf){try{if(this[_0x9b20('0x24')](_0x5a62cf)){if(this['channels'][_0x5a62cf[_0x9b20('0x28')]]){logger[_0x9b20('0x2a')](_0x9b20('0x3e'),_0x5a62cf[_0x9b20('0x28')],util[_0x9b20('0x2c')](_0x5a62cf,{'showHidden':![],'depth':null}));for(var _0x342b5e in this[_0x9b20('0x8')][_0x5a62cf[_0x9b20('0x28')]]){if(this[_0x9b20('0x8')][_0x5a62cf[_0x9b20('0x28')]]['hasOwnProperty'](_0x342b5e)){if(_0x5a62cf[_0x9b20('0x29')]===_0x342b5e){logger['info'](_0x9b20('0x3f'),_0x5a62cf[_0x9b20('0x28')],_0x5a62cf[_0x9b20('0x3b')],_0x5a62cf[_0x9b20('0x29')]);this['channels'][_0x5a62cf[_0x9b20('0x28')]][_0x342b5e][_0x9b20('0x40')]=moment()[_0x9b20('0x2d')](_0x9b20('0x2e'));this[_0x9b20('0x8')][_0x5a62cf[_0x9b20('0x28')]][_0x342b5e][_0x9b20('0x41')]=_0x5a62cf['connectedlinename'];this['channels'][_0x5a62cf[_0x9b20('0x28')]][_0x342b5e][_0x9b20('0x42')]=_0x5a62cf[_0x9b20('0x42')];this[_0x9b20('0x8')][_0x5a62cf[_0x9b20('0x28')]][_0x342b5e][_0x9b20('0x43')]=_0x5a62cf['destchannelstate'];this[_0x9b20('0x8')][_0x5a62cf[_0x9b20('0x28')]][_0x342b5e][_0x9b20('0x44')]=_0x5a62cf[_0x9b20('0x44')];this['channels'][_0x5a62cf[_0x9b20('0x28')]][_0x342b5e][_0x9b20('0x45')]=_0x5a62cf[_0x9b20('0x45')];this['channels'][_0x5a62cf[_0x9b20('0x28')]][_0x342b5e]['lastevent']=_0x9b20('0x46');if(this[_0x9b20('0x47')][this[_0x9b20('0x8')][_0x5a62cf[_0x9b20('0x28')]][_0x342b5e]['uniqueid']]){var _0x46ee03=this[_0x9b20('0x47')][this[_0x9b20('0x8')][_0x5a62cf[_0x9b20('0x28')]][_0x342b5e][_0x9b20('0x28')]][_0x9b20('0x48')];this[_0x9b20('0x8')][_0x5a62cf['uniqueid']][_0x342b5e]['routealias']=_0x46ee03;_0x5a62cf['routealias']=_0x46ee03;}_[_0x9b20('0x34')](this[_0x9b20('0xa')][_0x5a62cf[_0x9b20('0x49')]],_[_0x9b20('0x4a')](_0x5a62cf,[_0x9b20('0x30'),_0x9b20('0x4b'),_0x9b20('0x48')]));logger[_0x9b20('0x2a')](_0x9b20('0x4c'),_0x5a62cf[_0x9b20('0x28')],util[_0x9b20('0x2c')](this[_0x9b20('0x8')][_0x5a62cf['uniqueid']][_0x5a62cf['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x9b20('0x23')](_0x9b20('0x4d'),this['channels'][_0x5a62cf[_0x9b20('0x28')]][_0x5a62cf['destuniqueid']]);logger[_0x9b20('0x2a')](_0x9b20('0x4e'),_0x5a62cf['uniqueid'],util[_0x9b20('0x2c')](this['channels'][_0x5a62cf[_0x9b20('0x28')]][_0x5a62cf[_0x9b20('0x29')]],{'showHidden':![],'depth':null}));this[_0x9b20('0x23')](util[_0x9b20('0x2d')](_0x9b20('0x3a'),_0x5a62cf[_0x9b20('0x3b')]),_0x9b20('0x4f'),this[_0x9b20('0x8')][_0x5a62cf[_0x9b20('0x28')]][_0x5a62cf[_0x9b20('0x29')]]);}else if(!this[_0x9b20('0x8')][_0x5a62cf[_0x9b20('0x28')]][_0x342b5e][_0x9b20('0x11')]&&!this[_0x9b20('0x8')][_0x5a62cf['uniqueid']][_0x342b5e][_0x9b20('0x15')]){logger[_0x9b20('0x26')](_0x9b20('0x50'),_0x5a62cf['uniqueid'],this[_0x9b20('0x8')][_0x5a62cf[_0x9b20('0x28')]][_0x342b5e][_0x9b20('0x3b')],_0x342b5e);this[_0x9b20('0x8')][_0x5a62cf['uniqueid']][_0x342b5e][_0x9b20('0x11')]=!![];this[_0x9b20('0x8')][_0x5a62cf['uniqueid']][_0x342b5e]['agentringnoanswerAt']=moment()[_0x9b20('0x2d')](_0x9b20('0x2e'));this[_0x9b20('0x8')][_0x5a62cf[_0x9b20('0x28')]][_0x342b5e]['answeredelsewheredestinationuniqueid']=_0x5a62cf[_0x9b20('0x29')];this[_0x9b20('0x8')][_0x5a62cf['uniqueid']][_0x342b5e][_0x9b20('0x51')]=_0x5a62cf[_0x9b20('0x3b')];this[_0x9b20('0x8')][_0x5a62cf[_0x9b20('0x28')]][_0x342b5e][_0x9b20('0x52')]=_0x9b20('0x53');this[_0x9b20('0x8')][_0x5a62cf['uniqueid']][_0x342b5e][_0x9b20('0x54')]=_0x9b20('0x53');logger[_0x9b20('0x2a')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x5a62cf[_0x9b20('0x28')],util[_0x9b20('0x2c')](this[_0x9b20('0x8')][_0x5a62cf[_0x9b20('0x28')]][_0x342b5e],{'showHidden':![],'depth':null}));ami['emit']('custom:agentansweredelsewhere',this[_0x9b20('0x8')][_0x5a62cf[_0x9b20('0x28')]][_0x342b5e]);}}}}}}catch(_0x5be0f1){logger[_0x9b20('0x3d')](_0x9b20('0x55'),_0x5a62cf[_0x9b20('0x28')],util['inspect'](_0x5be0f1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9b20('0x22')][_0x9b20('0x12')]=function(_0x55f3f3){try{if(this['isNotNull'](_0x55f3f3)){logger[_0x9b20('0x2a')](_0x9b20('0x56'),_0x55f3f3[_0x9b20('0x28')],util[_0x9b20('0x2c')](_0x55f3f3,{'showHidden':![],'depth':null}));if(this['channels'][_0x55f3f3[_0x9b20('0x28')]]&&this['channels'][_0x55f3f3['uniqueid']][_0x55f3f3[_0x9b20('0x29')]]){logger[_0x9b20('0x26')](_0x9b20('0x57'),_0x55f3f3['uniqueid'],_0x55f3f3[_0x9b20('0x3b')],_0x55f3f3[_0x9b20('0x29')]);this['channels'][_0x55f3f3[_0x9b20('0x28')]][_0x55f3f3[_0x9b20('0x29')]]['agentringnoanswer']=!![];this['channels'][_0x55f3f3['uniqueid']][_0x55f3f3[_0x9b20('0x29')]]['agentringnoanswerAt']=moment()[_0x9b20('0x2d')](_0x9b20('0x2e'));this['channels'][_0x55f3f3[_0x9b20('0x28')]][_0x55f3f3[_0x9b20('0x29')]]['lastevent']=_0x9b20('0x58');this[_0x9b20('0x8')][_0x55f3f3[_0x9b20('0x28')]][_0x55f3f3[_0x9b20('0x29')]]['reason']=_0x9b20('0x58');logger[_0x9b20('0x2a')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x55f3f3[_0x9b20('0x28')],util[_0x9b20('0x2c')](this[_0x9b20('0x8')][_0x55f3f3[_0x9b20('0x28')]][_0x55f3f3[_0x9b20('0x29')]],{'showHidden':![],'depth':null}));ami[_0x9b20('0x23')]('custom:agentringnoanswer',this[_0x9b20('0x8')][_0x55f3f3[_0x9b20('0x28')]][_0x55f3f3[_0x9b20('0x29')]]);}}}catch(_0x5d8053){logger[_0x9b20('0x3d')]('[%s][voiceAgentReport][agentringnoanswer]',_0x55f3f3['uniqueid'],util[_0x9b20('0x2c')](_0x5d8053,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x9b20('0x14')]=function(_0x6f1be4){try{if(this[_0x9b20('0x24')](_0x6f1be4)){logger[_0x9b20('0x2a')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x6f1be4[_0x9b20('0x28')],util[_0x9b20('0x2c')](_0x6f1be4,{'showHidden':![],'depth':null}));if(this[_0x9b20('0x8')][_0x6f1be4[_0x9b20('0x28')]]){for(var _0x23b7c1 in this['channels'][_0x6f1be4[_0x9b20('0x28')]]){if(this['channels'][_0x6f1be4[_0x9b20('0x28')]][_0x9b20('0x59')](_0x23b7c1)&&!this['channels'][_0x6f1be4['uniqueid']][_0x23b7c1]['agentringnoanswer']&&!this[_0x9b20('0x8')][_0x6f1be4[_0x9b20('0x28')]][_0x23b7c1]['agentcomplete']){logger[_0x9b20('0x26')](_0x9b20('0x5a'),_0x6f1be4['uniqueid'],this[_0x9b20('0x8')][_0x6f1be4['uniqueid']][_0x23b7c1]['membername'],_0x23b7c1);this[_0x9b20('0x8')][_0x6f1be4[_0x9b20('0x28')]][_0x23b7c1][_0x9b20('0x11')]=!![];this['channels'][_0x6f1be4[_0x9b20('0x28')]][_0x23b7c1][_0x9b20('0x5b')]=moment()[_0x9b20('0x2d')](_0x9b20('0x2e'));this['channels'][_0x6f1be4[_0x9b20('0x28')]][_0x23b7c1][_0x9b20('0x52')]=_0x9b20('0x5c');this[_0x9b20('0x8')][_0x6f1be4[_0x9b20('0x28')]][_0x23b7c1][_0x9b20('0x54')]=_0x9b20('0x5c');logger[_0x9b20('0x2a')](_0x9b20('0x5d'),_0x6f1be4[_0x9b20('0x28')],util[_0x9b20('0x2c')](this['channels'][_0x6f1be4[_0x9b20('0x28')]][_0x23b7c1],{'showHidden':![],'depth':null}));ami[_0x9b20('0x23')]('custom:agentqueuecallerabandon',this[_0x9b20('0x8')][_0x6f1be4[_0x9b20('0x28')]][_0x23b7c1]);}}}}}catch(_0x1e285c){logger[_0x9b20('0x3d')](_0x9b20('0x5e'),_0x6f1be4[_0x9b20('0x28')],util[_0x9b20('0x2c')](_0x1e285c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9b20('0x22')][_0x9b20('0x16')]=function(_0x500ce0){try{if(this['isNotNull'](_0x500ce0)){logger[_0x9b20('0x2a')](_0x9b20('0x5f'),_0x500ce0[_0x9b20('0x28')],util[_0x9b20('0x2c')](_0x500ce0,{'showHidden':![],'depth':null}));if(this[_0x9b20('0x8')][_0x500ce0['uniqueid']]){for(var _0x5e811b in this[_0x9b20('0x8')][_0x500ce0[_0x9b20('0x28')]]){if(this[_0x9b20('0x8')][_0x500ce0[_0x9b20('0x28')]][_0x9b20('0x59')](_0x5e811b)){if(this[_0x9b20('0x8')][_0x500ce0['uniqueid']][_0x5e811b][_0x9b20('0x40')]&&!this[_0x9b20('0x8')][_0x500ce0[_0x9b20('0x28')]][_0x5e811b][_0x9b20('0x15')]){logger[_0x9b20('0x26')](_0x9b20('0x60'),_0x500ce0[_0x9b20('0x28')],this[_0x9b20('0x8')][_0x500ce0['uniqueid']][_0x5e811b]['membername'],_0x5e811b);this[_0x9b20('0x8')][_0x500ce0[_0x9b20('0x28')]][_0x5e811b][_0x9b20('0x15')]=!![];this['channels'][_0x500ce0['uniqueid']][_0x5e811b][_0x9b20('0x61')]=moment()[_0x9b20('0x2d')](_0x9b20('0x2e'));this[_0x9b20('0x8')][_0x500ce0[_0x9b20('0x28')]][_0x5e811b][_0x9b20('0x52')]=_0x9b20('0x62');this[_0x9b20('0x8')][_0x500ce0[_0x9b20('0x28')]][_0x5e811b][_0x9b20('0x54')]=_0x500ce0[_0x9b20('0x54')]==_0x9b20('0x63')?_0x9b20('0x64'):_0x500ce0[_0x9b20('0x54')];this[_0x9b20('0x8')][_0x500ce0[_0x9b20('0x28')]][_0x5e811b][_0x9b20('0x65')]=_0x500ce0[_0x9b20('0x65')];if(this[_0x9b20('0x9')][_0x500ce0[_0x9b20('0x30')]]&&this[_0x9b20('0x9')][_0x500ce0[_0x9b20('0x30')]][_0x9b20('0x66')]){this[_0x9b20('0x8')][_0x500ce0['uniqueid']][_0x5e811b]['acwtime']=this[_0x9b20('0x9')][_0x500ce0[_0x9b20('0x30')]]['acwTimeout'];this[_0x9b20('0x8')][_0x500ce0[_0x9b20('0x28')]][_0x5e811b][_0x9b20('0x67')]=!![];}this[_0x9b20('0xa')][_0x500ce0['interface']]=_['omit'](this[_0x9b20('0xa')][_0x500ce0[_0x9b20('0x49')]],['queue','destconnectedlinenum']);logger[_0x9b20('0x2a')](_0x9b20('0x68'),_0x500ce0['uniqueid'],util['inspect'](this['channels'][_0x500ce0[_0x9b20('0x28')]][_0x5e811b],{'showHidden':![],'depth':null}));ami[_0x9b20('0x23')]('custom:agentcomplete',this['channels'][_0x500ce0['uniqueid']][_0x5e811b]);logger[_0x9b20('0x2a')](_0x9b20('0x69'),_0x500ce0[_0x9b20('0x28')],util[_0x9b20('0x2c')](this[_0x9b20('0x8')][_0x500ce0[_0x9b20('0x28')]][_0x5e811b],{'showHidden':![],'depth':null}));this[_0x9b20('0x23')](util[_0x9b20('0x2d')](_0x9b20('0x3a'),_0x500ce0[_0x9b20('0x3b')]),_0x9b20('0x6a'),this[_0x9b20('0x8')][_0x500ce0[_0x9b20('0x28')]][_0x5e811b]);}}}}}}catch(_0xba4134){logger[_0x9b20('0x3d')](_0x9b20('0x6b'),_0x500ce0[_0x9b20('0x28')],util['inspect'](_0xba4134,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x9b20('0x6c')]=function(_0x44b7be){try{if(this[_0x9b20('0x24')](_0x44b7be)){logger[_0x9b20('0x2a')]('[%s][voiceAgentReport][varset]\x20event:',_0x44b7be[_0x9b20('0x28')],util[_0x9b20('0x2c')](_0x44b7be,{'showHidden':![],'depth':null}));this[_0x9b20('0x6d')](_0x44b7be[_0x9b20('0x28')],_[_0x9b20('0x6e')](_0x44b7be['variable'])[0x0],_0x44b7be[_0x9b20('0x6f')]);if(this[_0x9b20('0x8')][_0x44b7be[_0x9b20('0x28')]]){for(var _0x5cc1d3 in this[_0x9b20('0x8')][_0x44b7be['uniqueid']]){if(this[_0x9b20('0x8')][_0x44b7be[_0x9b20('0x28')]][_0x9b20('0x59')](_0x5cc1d3)){logger[_0x9b20('0x26')](_0x9b20('0x70'),_0x44b7be[_0x9b20('0x28')],_0x5cc1d3,_[_0x9b20('0x6e')](_0x44b7be[_0x9b20('0x71')])[0x0],_0x44b7be[_0x9b20('0x6f')]);if(_[_0x9b20('0x25')](this[_0x9b20('0x8')][_0x44b7be['uniqueid']][_0x5cc1d3][_0x9b20('0xb')])){this['channels'][_0x44b7be[_0x9b20('0x28')]][_0x5cc1d3][_0x9b20('0xb')]={};}this[_0x9b20('0x8')][_0x44b7be[_0x9b20('0x28')]][_0x5cc1d3][_0x9b20('0xb')]=this[_0x9b20('0xb')][_0x44b7be[_0x9b20('0x28')]];}}}}}catch(_0x125a49){logger[_0x9b20('0x3d')](_0x9b20('0x72'),_0x44b7be[_0x9b20('0x28')],util[_0x9b20('0x2c')](_0x125a49,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9b20('0x22')][_0x9b20('0x6d')]=function(_0x3b2e67,_0x1b8d22,_0x3eff34){var _0x12fdcf=[_0x9b20('0x73'),_0x9b20('0x74'),'rtpaudioqosjitter',_0x9b20('0x75'),_0x9b20('0x76'),_0x9b20('0x77'),_0x9b20('0x78'),_0x9b20('0x79'),_0x9b20('0x7a'),_0x9b20('0x7b'),'bridgepeer',_0x9b20('0x7c'),_0x9b20('0x7d'),_0x9b20('0x7e'),_0x9b20('0x7f'),'memberlastcall',_0x9b20('0x3b'),'memberpenalty',_0x9b20('0x80')];if(!_[_0x9b20('0x81')](_0x1b8d22)&&!_[_0x9b20('0x82')](_0x12fdcf,_0x1b8d22)){if(_['isUndefined'](this[_0x9b20('0xb')][_0x3b2e67])){this[_0x9b20('0xb')][_0x3b2e67]={};}this['variables'][_0x3b2e67][_0x1b8d22]=_0x3eff34;}};VoiceAgentReport['prototype'][_0x9b20('0x19')]=function(_0x317893){try{if(this[_0x9b20('0x24')](_0x317893)){logger[_0x9b20('0x2a')](_0x9b20('0x83'),_0x317893[_0x9b20('0x28')],util[_0x9b20('0x2c')](_0x317893,{'showHidden':![],'depth':null}));if(this[_0x9b20('0x8')][_0x317893[_0x9b20('0x28')]]){for(var _0x322e07 in this[_0x9b20('0x8')][_0x317893[_0x9b20('0x28')]]){if(this['channels'][_0x317893['uniqueid']][_0x9b20('0x59')](_0x322e07)){if(this['channels'][_0x317893[_0x9b20('0x28')]][_0x322e07]['reason']==_0x9b20('0x63')&&this['channels'][_0x317893[_0x9b20('0x28')]][_0x322e07]['agentcomplete']){logger[_0x9b20('0x26')](_0x9b20('0x84'),_0x317893['uniqueid'],_0x322e07);this['channels'][_0x317893[_0x9b20('0x28')]][_0x322e07][_0x9b20('0x61')]=moment()[_0x9b20('0x2d')](_0x9b20('0x2e'));}}}logger['debug'](_0x9b20('0x85'),_0x317893[_0x9b20('0x28')],util[_0x9b20('0x2c')](_[_0x9b20('0x86')](this[_0x9b20('0x8')][_0x317893['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0x9b20('0x23')](_0x9b20('0x87'),_['values'](this['channels'][_0x317893[_0x9b20('0x28')]]));delete this['channels'][_0x317893[_0x9b20('0x28')]];}if(this[_0x9b20('0xb')][_0x317893[_0x9b20('0x28')]]){delete this[_0x9b20('0xb')][_0x317893[_0x9b20('0x28')]];}}}catch(_0x10f588){logger[_0x9b20('0x3d')](_0x9b20('0x88'),_0x317893[_0x9b20('0x28')],util[_0x9b20('0x2c')](_0x10f588,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9b20('0x22')][_0x9b20('0x1f')]=function(_0x284e34){try{if(this[_0x9b20('0x24')](_0x284e34)){logger['debug']('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x284e34[_0x9b20('0x28')],util['inspect'](_0x284e34,{'showHidden':![],'depth':null}));if(this[_0x9b20('0x8')][_0x284e34[_0x9b20('0x89')]]){for(var _0x5e2f97 in this[_0x9b20('0x8')][_0x284e34[_0x9b20('0x89')]]){if(this[_0x9b20('0x8')][_0x284e34[_0x9b20('0x89')]][_0x9b20('0x59')](_0x5e2f97)){if(_0x284e34[_0x9b20('0x8a')]===_0x5e2f97){logger['info']('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x284e34['uniqueid'],this['channels'][_0x284e34['transfereeuniqueid']][_0x5e2f97]['membername'],_0x5e2f97);var _0x907a79=moment();this[_0x9b20('0x8')][_0x284e34[_0x9b20('0x89')]][_0x5e2f97][_0x9b20('0x15')]=!![];this[_0x9b20('0x8')][_0x284e34[_0x9b20('0x89')]][_0x5e2f97]['agentcompleteAt']=moment()['format'](_0x9b20('0x2e'));this[_0x9b20('0x8')][_0x284e34[_0x9b20('0x89')]][_0x5e2f97]['lastevent']=_0x9b20('0x62');this['channels'][_0x284e34[_0x9b20('0x89')]][_0x5e2f97][_0x9b20('0x54')]=_0x9b20('0x63');this[_0x9b20('0x8')][_0x284e34[_0x9b20('0x89')]][_0x5e2f97]['talktime']=_0x907a79['diff'](this[_0x9b20('0x8')][_0x284e34[_0x9b20('0x89')]][_0x5e2f97][_0x9b20('0x40')],_0x9b20('0x8b'));}}}}if(this[_0x9b20('0x8')][_0x284e34[_0x9b20('0x8c')]]){var _0x53f175=this[_0x9b20('0x8')][_0x284e34[_0x9b20('0x8c')]];this['channels'][_0x284e34['secondtransfereruniqueid']]=this['channels'][_0x284e34['transfereeuniqueid']];this[_0x9b20('0x8')][_0x284e34['transfereeuniqueid']]=_0x53f175;}}}catch(_0x2c7ad1){logger[_0x9b20('0x3d')]('[%s][voiceAgentReport][attendedtransfer]',_0x284e34['uniqueid'],util[_0x9b20('0x2c')](_0x2c7ad1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9b20('0x22')][_0x9b20('0x21')]=function(_0x3bb11a){try{if(this[_0x9b20('0x24')](_0x3bb11a)){logger[_0x9b20('0x2a')](_0x9b20('0x8d'),_0x3bb11a[_0x9b20('0x28')],util[_0x9b20('0x2c')](_0x3bb11a,{'showHidden':![],'depth':null}));if(this['channels'][_0x3bb11a[_0x9b20('0x89')]]){for(var _0x10acd2 in this[_0x9b20('0x8')][_0x3bb11a[_0x9b20('0x89')]]){if(this[_0x9b20('0x8')][_0x3bb11a[_0x9b20('0x89')]][_0x9b20('0x59')](_0x10acd2)){if(_0x3bb11a['transfereruniqueid']===_0x10acd2){logger[_0x9b20('0x26')](_0x9b20('0x8e'),_0x3bb11a[_0x9b20('0x28')],this[_0x9b20('0x8')][_0x3bb11a[_0x9b20('0x89')]][_0x10acd2]['membername'],_0x10acd2);var _0x3cc70c=moment();this[_0x9b20('0x8')][_0x3bb11a['transfereeuniqueid']][_0x10acd2][_0x9b20('0x15')]=!![];this['channels'][_0x3bb11a['transfereeuniqueid']][_0x10acd2]['agentcompleteAt']=_0x3cc70c;this[_0x9b20('0x8')][_0x3bb11a[_0x9b20('0x89')]][_0x10acd2][_0x9b20('0x52')]=_0x9b20('0x62');this[_0x9b20('0x8')][_0x3bb11a[_0x9b20('0x89')]][_0x10acd2][_0x9b20('0x54')]='transfer';this[_0x9b20('0x8')][_0x3bb11a['transfereeuniqueid']][_0x10acd2][_0x9b20('0x65')]=_0x3cc70c['diff'](this[_0x9b20('0x8')][_0x3bb11a[_0x9b20('0x89')]][_0x10acd2][_0x9b20('0x40')],_0x9b20('0x8b'));}}}}}}catch(_0x1ed267){logger['error'](_0x9b20('0x8f'),_0x3bb11a[_0x9b20('0x28')],util[_0x9b20('0x2c')](_0x1ed267,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x9b20('0x1b')]=function(_0x37aaca){var _0x284600='';try{if(this[_0x9b20('0x24')](_0x37aaca)){logger['debug'](_0x9b20('0x90'),_0x37aaca[_0x9b20('0x28')],util['inspect'](_0x37aaca,{'showHidden':![],'depth':null}));if(_0x37aaca[_0x9b20('0x91')]){_0x284600=_0x37aaca['channel']['substring'](0x0,_0x37aaca[_0x9b20('0x91')][_0x9b20('0x92')]('-'));if(this[_0x9b20('0xa')][_0x284600]){logger[_0x9b20('0x26')](_0x9b20('0x93'),_0x37aaca[_0x9b20('0x28')],_0x284600);this[_0x9b20('0xa')][_0x284600][_0x9b20('0x94')]=!![];}}}}catch(_0x5b68cb){logger[_0x9b20('0x3d')](_0x9b20('0x95'),_0x37aaca['uniqueid'],util[_0x9b20('0x2c')](_0x5b68cb,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x9b20('0x1d')]=function(_0x318256){var _0x52ca3e='';try{if(this[_0x9b20('0x24')](_0x318256)){logger[_0x9b20('0x2a')](_0x9b20('0x96'),_0x318256[_0x9b20('0x28')],util[_0x9b20('0x2c')](_0x318256,{'showHidden':![],'depth':null}));if(_0x318256[_0x9b20('0x91')]){_0x52ca3e=_0x318256[_0x9b20('0x91')][_0x9b20('0x97')](0x0,_0x318256[_0x9b20('0x91')][_0x9b20('0x92')]('-'));if(this[_0x9b20('0xa')][_0x52ca3e]){logger[_0x9b20('0x26')](_0x9b20('0x98'),_0x318256[_0x9b20('0x28')],_0x52ca3e);this[_0x9b20('0xa')][_0x52ca3e][_0x9b20('0x94')]=![];}}}}catch(_0x5bbc8a){logger['error'](_0x9b20('0x99'),_0x318256[_0x9b20('0x28')],util[_0x9b20('0x2c')](_0x5bbc8a,{'showHidden':![],'depth':null}));}};module[_0x9b20('0x9a')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 5de6075..2e2967a 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 _0x3064=['ATTENDED','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfereecalleridnum','BLIND','transfererchannel','transfereruniqueid','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','exports','bluebird','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','unknown','not_inuse','inuse','busy','invalid','ringing','ringinuse','queue','agi','dial','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','channels','agents','blindTransfers','syncNewExten','bind','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','inspect','prototype','isNotNull','isUndefined','emit','info','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','context','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','user:%s','accountcode','[%s][voiceCallReport][newcallerid]','OutgoingSpoolFailed','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','from-sip','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','name','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','applicationdata','appdata','startsWith','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','subtract','seconds','includes','lastdata','set','cdr(','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','channelstate','answertime','diff','destinationchannel','UserId','membername','routealias','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','monitors','isNil','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','type','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','originatecalleridnum','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','sipcalluniqueid','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','answered','billableseconds','holdtime','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','transferType','isEmpty','getSettings','then','stopRecordingOnTransfer','Action','catch','StopMixMonitor','finally','webbar:stopmonitors','event','BlindTransfer','[%s][voiceCallReport][hangup]','syncAttendedTransfer','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','routeid'];(function(_0x1c5b3f,_0xc7f4af){var _0x38cfa8=function(_0x1fb92a){while(--_0x1fb92a){_0x1c5b3f['push'](_0x1c5b3f['shift']());}};_0x38cfa8(++_0xc7f4af);}(_0x3064,0xd7));var _0x4306=function(_0x3458c2,_0x375f87){_0x3458c2=_0x3458c2-0x0;var _0x3376e8=_0x3064[_0x3458c2];return _0x3376e8;};'use strict';var BPromise=require(_0x4306('0x0'));var _=require(_0x4306('0x1'));var moment=require(_0x4306('0x2'));var util=require(_0x4306('0x3'));var path=require(_0x4306('0x4'));var Redis=require(_0x4306('0x5'));var config=require(_0x4306('0x6'));var logger=require(_0x4306('0x7'))(_0x4306('0x8'));var ami=require(_0x4306('0x9'));var Channel=require(_0x4306('0xa'));var RpcSetting=require(_0x4306('0xb'));var statusDesc=[_0x4306('0xc'),_0x4306('0xd'),_0x4306('0xe'),_0x4306('0xf'),_0x4306('0x10'),'unavailable',_0x4306('0x11'),_0x4306('0x12'),'onhold'];var applications=['set',_0x4306('0x13'),_0x4306('0x14'),_0x4306('0x15'),'playback','voicemail'];var dispositions=['NO\x20ANSWER','FAILED',_0x4306('0x16'),_0x4306('0x17'),_0x4306('0x17'),'NO\x20ANSWER',_0x4306('0x18'),_0x4306('0x19'),_0x4306('0x16'),_0x4306('0x16'),_0x4306('0x16')];var actions={};config[_0x4306('0x1a')]=_['defaults'](config[_0x4306('0x1a')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4306('0x1a')]));function VoiceCallReport(_0x2bc5be){this[_0x4306('0x1b')]=_0x2bc5be['channels'];this[_0x4306('0x1c')]=_0x2bc5be['agents'];this[_0x4306('0x1d')]={};ami['on']('coreshowchannel',this[_0x4306('0x1e')]['bind'](this));ami['on']('newexten',this[_0x4306('0x1e')][_0x4306('0x1f')](this));ami['on']('newchannel',this[_0x4306('0x20')][_0x4306('0x1f')](this));ami['on'](_0x4306('0x21'),this[_0x4306('0x22')][_0x4306('0x1f')](this));ami['on'](_0x4306('0x23'),this[_0x4306('0x24')][_0x4306('0x1f')](this));ami['on'](_0x4306('0x25'),this[_0x4306('0x26')][_0x4306('0x1f')](this));ami['on'](_0x4306('0x27'),this[_0x4306('0x28')]['bind'](this));ami['on'](_0x4306('0x29'),this['syncAttendedTransfer'][_0x4306('0x1f')](this));ami['on'](_0x4306('0x2a'),this[_0x4306('0x2b')][_0x4306('0x1f')](this));ami['on'](_0x4306('0x2c'),this[_0x4306('0x2d')][_0x4306('0x1f')](this));ami['on'](_0x4306('0x2e'),this[_0x4306('0x2f')][_0x4306('0x1f')](this));try{logger['info'](_0x4306('0x30'));ami[_0x4306('0x31')]();}catch(_0x2109c0){logger[_0x4306('0x32')]('[voiceCallReport][coreshowchannels]',util[_0x4306('0x33')](_0x2109c0,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x4306('0x34')][_0x4306('0x35')]=function(_0x5be3f6){return _0x5be3f6!==null&&!_[_0x4306('0x36')](_0x5be3f6);};VoiceCallReport[_0x4306('0x34')]['emit']=function(_0x3ccdde,_0xa35a3,_0x544c4f){io['to'](_0x3ccdde)[_0x4306('0x37')](_0xa35a3,_0x544c4f);};VoiceCallReport[_0x4306('0x34')][_0x4306('0x28')]=function(_0x88ee75){try{if(this[_0x4306('0x35')](_0x88ee75)){logger[_0x4306('0x38')](_0x4306('0x39'),_0x88ee75[_0x4306('0x3a')],_0x88ee75[_0x4306('0x3b')],_0x88ee75[_0x4306('0x3c')]);logger[_0x4306('0x3d')](_0x4306('0x3e'),_0x88ee75[_0x4306('0x3a')],util[_0x4306('0x33')](_0x88ee75,{'showHidden':![],'depth':null}));if(_0x88ee75[_0x4306('0x3a')]===_0x88ee75[_0x4306('0x3f')]){if(!_[_0x4306('0x36')](this['channels'][_0x88ee75[_0x4306('0x3a')]])){_[_0x4306('0x40')](this['channels'][_0x88ee75[_0x4306('0x3a')]],_[_0x4306('0x41')](_0x88ee75,_[_0x4306('0x42')](this['channels'][_0x88ee75[_0x4306('0x3a')]])));}}if(_0x88ee75[_0x4306('0x43')]==='from-sip'){if(this[_0x4306('0x1c')][_0x88ee75[_0x4306('0x44')][_0x4306('0x45')]('-')[0x0]]){if(_0x88ee75[_0x4306('0x46')]==_0x4306('0x47')){this[_0x4306('0x1c')][_0x88ee75['channel'][_0x4306('0x45')]('-')[0x0]][_0x4306('0x48')]=_0x88ee75[_0x4306('0x49')];this[_0x4306('0x37')](util['format'](_0x4306('0x4a'),this['agents'][_0x88ee75[_0x4306('0x44')]['split']('-')[0x0]]['name']),'user:agentconnect',{'destaccountcode':this['agents'][_0x88ee75['channel'][_0x4306('0x45')]('-')[0x0]][_0x4306('0x4b')],'destconnectedlinenum':_0x88ee75[_0x4306('0x49')]});}}}}}catch(_0x17b3de){logger[_0x4306('0x32')](_0x4306('0x4c'),_0x88ee75[_0x4306('0x3a')],util[_0x4306('0x33')](_0x17b3de,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4306('0x34')]['syncNewChannel']=function(_0x2f9c5e){try{if(this[_0x4306('0x35')](_0x2f9c5e)){logger['debug']('[%s][voiceCallReport][newchannel]\x20event:',_0x2f9c5e[_0x4306('0x3a')],util['inspect'](_0x2f9c5e,{'showHidden':![],'depth':null}));if(_0x2f9c5e[_0x4306('0x3a')]===_0x2f9c5e[_0x4306('0x3f')]&&_0x2f9c5e[_0x4306('0x44')]!=_0x4306('0x4d')){if(_['isUndefined'](this[_0x4306('0x1b')][_0x2f9c5e['uniqueid']])){logger['info']('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x2f9c5e[_0x4306('0x3a')],_0x2f9c5e[_0x4306('0x43')],_0x2f9c5e[_0x4306('0x46')]);this[_0x4306('0x1b')][_0x2f9c5e[_0x4306('0x3a')]]=new Channel();this[_0x4306('0x1b')][_0x2f9c5e[_0x4306('0x3a')]]['starttime']=moment()[_0x4306('0x4e')](_0x4306('0x4f'));this[_0x4306('0x1b')][_0x2f9c5e[_0x4306('0x3a')]][_0x4306('0x50')]=dispositions[_[_0x4306('0x51')](_0x2f9c5e['channelstate'])];_[_0x4306('0x40')](this['channels'][_0x2f9c5e[_0x4306('0x3a')]],_[_0x4306('0x41')](_0x2f9c5e,_[_0x4306('0x42')](this[_0x4306('0x1b')][_0x2f9c5e[_0x4306('0x3a')]])));if(_0x2f9c5e[_0x4306('0x43')]===_0x4306('0x52')){if(this['agents'][_0x2f9c5e[_0x4306('0x44')][_0x4306('0x45')]('-')[0x0]]){if(_[_0x4306('0x36')](this[_0x4306('0x1c')][_0x2f9c5e[_0x4306('0x44')][_0x4306('0x45')]('-')[0x0]][_0x4306('0x48')])){this['agents'][_0x2f9c5e['channel'][_0x4306('0x45')]('-')[0x0]][_0x4306('0x48')]=_0x2f9c5e['exten'];logger[_0x4306('0x3d')](_0x4306('0x53'),_0x2f9c5e['uniqueid'],util[_0x4306('0x33')]({'destaccountcode':this[_0x4306('0x1c')][_0x2f9c5e[_0x4306('0x44')][_0x4306('0x45')]('-')[0x0]][_0x4306('0x4b')],'destconnectedlinenum':_0x2f9c5e[_0x4306('0x46')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x4306('0x4e')](_0x4306('0x4a'),this['agents'][_0x2f9c5e[_0x4306('0x44')][_0x4306('0x45')]('-')[0x0]][_0x4306('0x54')]),'user:agentconnect',{'destaccountcode':this[_0x4306('0x1c')][_0x2f9c5e[_0x4306('0x44')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x2f9c5e[_0x4306('0x46')]});}}}}}}}catch(_0x4d2ce3){logger['error'](_0x4306('0x55'),_0x2f9c5e['uniqueid'],util[_0x4306('0x33')](_0x4d2ce3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4306('0x34')][_0x4306('0x1e')]=function(_0x292ab1){try{if(this[_0x4306('0x35')](_0x292ab1)){logger['debug'](_0x4306('0x56'),_0x292ab1[_0x4306('0x3a')],util[_0x4306('0x33')](_0x292ab1,{'showHidden':![],'depth':null}));if(_0x292ab1[_0x4306('0x3a')]===_0x292ab1[_0x4306('0x3f')]&&_0x292ab1[_0x4306('0x46')]!='h'&&_0x292ab1['channel']!=_0x4306('0x4d')){_0x292ab1[_0x4306('0x57')]=_0x292ab1[_0x4306('0x57')]['toLowerCase']();_0x292ab1[_0x4306('0x58')]=_0x292ab1[_0x4306('0x59')]&&_0x292ab1[_0x4306('0x59')][_0x4306('0x5a')]('CDR(routeAlias)')?_0x292ab1[_0x4306('0x59')]:(_0x292ab1['appdata']||_0x292ab1[_0x4306('0x58')])[_0x4306('0x5b')]();logger[_0x4306('0x38')](_0x4306('0x5c'),_0x292ab1[_0x4306('0x3a')],_0x292ab1['application'],_0x292ab1['applicationdata']);if(_[_0x4306('0x36')](this[_0x4306('0x1b')][_0x292ab1['uniqueid']])){this[_0x4306('0x1b')][_0x292ab1[_0x4306('0x3a')]]=new Channel();this[_0x4306('0x1b')][_0x292ab1[_0x4306('0x3a')]][_0x4306('0x5d')]=_0x292ab1[_0x4306('0x5e')]?moment()[_0x4306('0x5f')](moment[_0x4306('0x5e')](_0x292ab1[_0x4306('0x5e')])[_0x4306('0x60')](),_0x4306('0x60'))[_0x4306('0x4e')](_0x4306('0x4f')):moment()[_0x4306('0x4e')](_0x4306('0x4f'));this['channels'][_0x292ab1[_0x4306('0x3a')]][_0x4306('0x50')]=_0x4306('0x17');}_[_0x4306('0x40')](this['channels'][_0x292ab1[_0x4306('0x3a')]],_['pick'](_0x292ab1,_['keys'](this[_0x4306('0x1b')][_0x292ab1[_0x4306('0x3a')]])));if(_[_0x4306('0x61')](applications,_0x292ab1[_0x4306('0x57')])){this[_0x4306('0x1b')][_0x292ab1[_0x4306('0x3a')]]['lastapplication']=_0x292ab1['application'];this[_0x4306('0x1b')][_0x292ab1['uniqueid']][_0x4306('0x62')]=_0x292ab1[_0x4306('0x58')];if(_0x292ab1[_0x4306('0x57')]===_0x4306('0x63')&&_[_0x4306('0x5a')](_0x292ab1['applicationdata'][_0x4306('0x5b')](),_0x4306('0x64'))){var _0x5c1956=_0x292ab1[_0x4306('0x58')]['split']('=');var _0x4b151f=_0x5c1956[0x0]['toLowerCase']()['match'](/cdr\((.*)\)/);if(_0x4b151f){this[_0x4306('0x1b')][_0x292ab1[_0x4306('0x3a')]][_0x4b151f[0x1]]=_0x5c1956[0x1];}}else if(_0x292ab1[_0x4306('0x57')]===_0x4306('0x13')){this['channels'][_0x292ab1['uniqueid']][_0x4306('0x13')]=_0x292ab1[_0x4306('0x58')][_0x4306('0x45')](',')[0x0];}}}}}catch(_0x2d6919){logger['error'](_0x4306('0x65'),_0x292ab1[_0x4306('0x3a')],util[_0x4306('0x33')](_0x2d6919,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4306('0x34')][_0x4306('0x22')]=function(_0x5a8a24){try{if(this['isNotNull'](_0x5a8a24)){logger[_0x4306('0x38')](_0x4306('0x66'),_0x5a8a24[_0x4306('0x3a')],_0x5a8a24['linkedid'],_0x5a8a24[_0x4306('0x3b')],_0x5a8a24[_0x4306('0x3c')]);logger[_0x4306('0x3d')](_0x4306('0x67'),_0x5a8a24[_0x4306('0x3a')],util[_0x4306('0x33')](_0x5a8a24,{'showHidden':![],'depth':null}));if(_0x5a8a24[_0x4306('0x3a')]!==_0x5a8a24['linkedid']){if(this['channels'][_0x5a8a24[_0x4306('0x3f')]]){if(_0x5a8a24[_0x4306('0x68')]==='6'){if(!this['channels'][_0x5a8a24['linkedid']]['answered']){var _0x5bf6e3=moment();this[_0x4306('0x1b')][_0x5a8a24['linkedid']]['answered']=!![];this[_0x4306('0x1b')][_0x5a8a24[_0x4306('0x3f')]][_0x4306('0x69')]=_0x5bf6e3[_0x4306('0x4e')](_0x4306('0x4f'));if(this[_0x4306('0x1b')][_0x5a8a24[_0x4306('0x3f')]][_0x4306('0x5d')]){this[_0x4306('0x1b')][_0x5a8a24[_0x4306('0x3f')]]['holdtime']=_0x5bf6e3[_0x4306('0x6a')](this[_0x4306('0x1b')][_0x5a8a24[_0x4306('0x3f')]][_0x4306('0x5d')],_0x4306('0x60'));}}this['channels'][_0x5a8a24[_0x4306('0x3f')]][_0x4306('0x3f')]=_0x5a8a24[_0x4306('0x3a')];if(_0x5a8a24[_0x4306('0x3c')]!==_0x4306('0x47')){this[_0x4306('0x1b')][_0x5a8a24[_0x4306('0x3f')]][_0x4306('0x49')]=_0x5a8a24[_0x4306('0x3c')];}this[_0x4306('0x1b')][_0x5a8a24[_0x4306('0x3f')]]['connectedlinename']=_0x5a8a24[_0x4306('0x3b')];this['channels'][_0x5a8a24[_0x4306('0x3f')]][_0x4306('0x6b')]=_0x5a8a24[_0x4306('0x44')];this[_0x4306('0x1b')][_0x5a8a24[_0x4306('0x3f')]][_0x4306('0x50')]=dispositions[_[_0x4306('0x51')](_0x5a8a24[_0x4306('0x68')])];if(this[_0x4306('0x1c')][_0x5a8a24[_0x4306('0x44')]['split']('-')[0x0]]){this[_0x4306('0x1b')][_0x5a8a24[_0x4306('0x3f')]][_0x4306('0x6c')]=this[_0x4306('0x1c')][_0x5a8a24['channel'][_0x4306('0x45')]('-')[0x0]]['id'];this['channels'][_0x5a8a24['linkedid']][_0x4306('0x6d')]=this[_0x4306('0x1c')][_0x5a8a24[_0x4306('0x44')][_0x4306('0x45')]('-')[0x0]]['name'];}}}}else{if(this[_0x4306('0x1b')][_0x5a8a24[_0x4306('0x3a')]]){if(_0x5a8a24[_0x4306('0x68')]==='6'){if(this[_0x4306('0x1c')][_0x5a8a24[_0x4306('0x44')]['split']('-')[0x0]]){this[_0x4306('0x1b')][_0x5a8a24['uniqueid']][_0x4306('0x6c')]=this['agents'][_0x5a8a24[_0x4306('0x44')][_0x4306('0x45')]('-')[0x0]]['id'];this['channels'][_0x5a8a24[_0x4306('0x3a')]][_0x4306('0x6d')]=this['agents'][_0x5a8a24[_0x4306('0x44')][_0x4306('0x45')]('-')[0x0]][_0x4306('0x54')];}}}}if(_0x5a8a24[_0x4306('0x68')]==='6'&&_0x5a8a24[_0x4306('0x43')]==='from-sip'){if(this['agents'][_0x5a8a24[_0x4306('0x44')][_0x4306('0x45')]('-')[0x0]]){this[_0x4306('0x1c')][_0x5a8a24[_0x4306('0x44')]['split']('-')[0x0]][_0x4306('0x48')]=_0x5a8a24[_0x4306('0x46')];var _0x35e6ca;if(this['channels'][_0x5a8a24[_0x4306('0x3a')]])_0x35e6ca=this[_0x4306('0x1b')][_0x5a8a24[_0x4306('0x3a')]]['routealias'];else if(this[_0x4306('0x1b')][_0x5a8a24[_0x4306('0x3f')]])_0x35e6ca=this[_0x4306('0x1b')][_0x5a8a24[_0x4306('0x3f')]][_0x4306('0x6e')];logger[_0x4306('0x3d')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x5a8a24[_0x4306('0x3a')],util[_0x4306('0x33')]({'destaccountcode':this[_0x4306('0x1c')][_0x5a8a24[_0x4306('0x44')][_0x4306('0x45')]('-')[0x0]][_0x4306('0x4b')],'destconnectedlinenum':_0x5a8a24[_0x4306('0x46')],'routealias':_0x35e6ca},{'showHidden':![],'depth':null}));this[_0x4306('0x37')](util[_0x4306('0x4e')](_0x4306('0x4a'),this['agents'][_0x5a8a24[_0x4306('0x44')][_0x4306('0x45')]('-')[0x0]][_0x4306('0x54')]),'user:agentconnect',{'destaccountcode':this[_0x4306('0x1c')][_0x5a8a24['channel'][_0x4306('0x45')]('-')[0x0]][_0x4306('0x4b')],'destconnectedlinenum':_0x5a8a24['exten'],'routealias':_0x35e6ca});}}}}catch(_0x53a8f9){logger[_0x4306('0x32')](_0x4306('0x6f'),_0x5a8a24['uniqueid'],util[_0x4306('0x33')](_0x53a8f9,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x4306('0x70')]=function(_0x33f789,_0x508f30){try{if(this[_0x4306('0x1b')][_0x33f789]){logger[_0x4306('0x38')](_0x4306('0x71'),_0x33f789,_0x508f30);this['channels'][_0x33f789][_0x4306('0x72')]=!![];if(_[_0x4306('0x73')](_0x508f30,_0x4306('0x74'))){_0x508f30=_0x508f30[_0x4306('0x75')]('.wav49',_0x4306('0x76'));}this[_0x4306('0x1b')][_0x33f789][_0x4306('0x77')]=_0x508f30;var _0x4cafec=_['find'](this['channels'][_0x33f789][_0x4306('0x78')],{'filename':_0x508f30});if(_[_0x4306('0x79')](_0x4cafec)){this['channels'][_0x33f789][_0x4306('0x78')][_0x4306('0x7a')]({'filename':_0x508f30,'createdAt':moment()['format'](_0x4306('0x4f')),'mixmonitorid':'','status':_0x4306('0x7b')});}}}catch(_0x31a5b5){logger['error'](_0x4306('0x7c'),_0x33f789,util[_0x4306('0x33')](_0x31a5b5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4306('0x34')][_0x4306('0x24')]=function(_0x5948ad){try{if(this['isNotNull'](_0x5948ad)){logger[_0x4306('0x3d')](_0x4306('0x7d'),_0x5948ad[_0x4306('0x3a')],util[_0x4306('0x33')](_0x5948ad,{'showHidden':![],'depth':null}));if(this[_0x4306('0x1b')][_0x5948ad[_0x4306('0x3a')]]&&_0x5948ad[_0x4306('0x44')]!='OutgoingSpoolFailed'){if(this[_0x4306('0x35')](_0x5948ad[_0x4306('0x7e')])){if(this[_0x4306('0x35')](_0x5948ad['variable'][_0x4306('0x7f')])){logger[_0x4306('0x38')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x5948ad[_0x4306('0x3a')],_0x5948ad[_0x4306('0x80')]);this['syncMixMonitorFilename'](_0x5948ad[_0x4306('0x3a')],_0x5948ad[_0x4306('0x80')]);}else if(this[_0x4306('0x35')](_0x5948ad['variable'][_0x4306('0x81')])){logger[_0x4306('0x38')](_0x4306('0x82'),_0x5948ad[_0x4306('0x3a')],_0x5948ad[_0x4306('0x80')]);this[_0x4306('0x1b')][_0x5948ad['uniqueid']][_0x4306('0x3c')]=_0x5948ad[_0x4306('0x80')];}else if(this[_0x4306('0x35')](_0x5948ad[_0x4306('0x7e')][_0x4306('0x83')])){logger['info'](_0x4306('0x84'),_0x5948ad[_0x4306('0x3a')],_0x5948ad[_0x4306('0x80')]);this[_0x4306('0x1b')][_0x5948ad[_0x4306('0x3a')]][_0x4306('0x85')]=_0x5948ad[_0x4306('0x80')];}else if(this['isNotNull'](_0x5948ad[_0x4306('0x7e')][_0x4306('0x86')])){logger[_0x4306('0x38')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x5948ad[_0x4306('0x3a')],_0x5948ad['value']);this[_0x4306('0x1b')][_0x5948ad[_0x4306('0x3a')]][_0x4306('0x87')]=_0x5948ad[_0x4306('0x80')];}else if(this[_0x4306('0x35')](_0x5948ad[_0x4306('0x7e')]['xmd-queue'])){logger[_0x4306('0x38')](_0x4306('0x88'),_0x5948ad[_0x4306('0x3a')],_0x5948ad[_0x4306('0x80')][_0x4306('0x45')](',')[0x0]);this['channels'][_0x5948ad[_0x4306('0x3a')]]['queue']=_0x5948ad[_0x4306('0x80')][_0x4306('0x45')](',')[0x0];}else if(this[_0x4306('0x35')](_0x5948ad[_0x4306('0x7e')][_0x4306('0x89')])){logger[_0x4306('0x38')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x5948ad['uniqueid'],_0x5948ad[_0x4306('0x80')]);this[_0x4306('0x1b')][_0x5948ad['uniqueid']][_0x4306('0x8a')]=_0x5948ad[_0x4306('0x80')];}else if(this['isNotNull'](_0x5948ad['variable']['xmd-destination'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x5948ad['uniqueid'],_0x5948ad[_0x4306('0x80')]);this[_0x4306('0x1b')][_0x5948ad[_0x4306('0x3a')]][_0x4306('0x8b')]=_0x5948ad['value'];}else if(this[_0x4306('0x35')](_0x5948ad[_0x4306('0x7e')][_0x4306('0x8c')])){logger[_0x4306('0x38')](_0x4306('0x8d'),_0x5948ad[_0x4306('0x3a')],_0x5948ad['value']);this['channels'][_0x5948ad['uniqueid']][_0x4306('0x8e')]=_0x5948ad['value'];}else if(this[_0x4306('0x35')](_0x5948ad[_0x4306('0x7e')][_0x4306('0x8f')])){logger['info'](_0x4306('0x90'),_0x5948ad['uniqueid'],_0x5948ad[_0x4306('0x80')]);this[_0x4306('0x1b')][_0x5948ad[_0x4306('0x3a')]][_0x4306('0x13')]=_0x5948ad[_0x4306('0x80')];}else if(this['isNotNull'](_0x5948ad[_0x4306('0x7e')][_0x4306('0x91')])){logger[_0x4306('0x38')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x5948ad['uniqueid'],_0x5948ad[_0x4306('0x80')]);this[_0x4306('0x1b')][_0x5948ad[_0x4306('0x3a')]][_0x4306('0x92')]=_0x5948ad['value'];}}}else if(this[_0x4306('0x35')](_0x5948ad[_0x4306('0x7e')][_0x4306('0x7f')])){if(_0x5948ad[_0x4306('0x80')]){var _0x4c618b=path['parse'](_0x5948ad['value'])[_0x4306('0x54')];logger[_0x4306('0x38')](_0x4306('0x93'),_0x4c618b,_0x5948ad[_0x4306('0x80')]);this[_0x4306('0x70')](_0x4c618b,_0x5948ad[_0x4306('0x80')]);}}else if(this[_0x4306('0x1b')][_0x5948ad['linkedid']]){if(this[_0x4306('0x35')](_0x5948ad[_0x4306('0x7e')])){if(this[_0x4306('0x35')](_0x5948ad[_0x4306('0x7e')][_0x4306('0x91')])){logger[_0x4306('0x38')](_0x4306('0x94'),_0x5948ad[_0x4306('0x3f')],_0x5948ad['value']);this[_0x4306('0x1b')][_0x5948ad['linkedid']][_0x4306('0x95')]=_0x5948ad[_0x4306('0x80')];}}}}}catch(_0x3dd96a){logger[_0x4306('0x32')]('[%s][voiceCallReport][varset]',_0x5948ad['uniqueid'],util[_0x4306('0x33')](_0x3dd96a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4306('0x34')][_0x4306('0x26')]=function(_0x2eecdb){try{if(this[_0x4306('0x35')](_0x2eecdb)){logger[_0x4306('0x3d')](_0x4306('0x96'),_0x2eecdb[_0x4306('0x3a')],util[_0x4306('0x33')](_0x2eecdb,{'showHidden':![],'depth':null}));if(this[_0x4306('0x1b')][_0x2eecdb[_0x4306('0x3a')]]){logger[_0x4306('0x38')](_0x4306('0x97'),_0x2eecdb[_0x4306('0x3a')],_0x2eecdb[_0x4306('0x98')]);var _0x2dfc71=moment();this[_0x4306('0x1b')][_0x2eecdb['uniqueid']]['endtime']=_0x2dfc71[_0x4306('0x4e')](_0x4306('0x4f'));this['channels'][_0x2eecdb[_0x4306('0x3a')]][_0x4306('0x5e')]=_0x2dfc71[_0x4306('0x6a')](this[_0x4306('0x1b')][_0x2eecdb[_0x4306('0x3a')]][_0x4306('0x5d')],_0x4306('0x60'));if(this['channels'][_0x2eecdb['uniqueid']][_0x4306('0x99')]){this['channels'][_0x2eecdb['uniqueid']][_0x4306('0x9a')]=_0x2dfc71[_0x4306('0x6a')](this['channels'][_0x2eecdb[_0x4306('0x3a')]][_0x4306('0x69')],_0x4306('0x60'));this[_0x4306('0x1b')][_0x2eecdb[_0x4306('0x3a')]][_0x4306('0x9b')]=this[_0x4306('0x1b')][_0x2eecdb['uniqueid']][_0x4306('0x5e')]-this[_0x4306('0x1b')][_0x2eecdb[_0x4306('0x3a')]][_0x4306('0x9a')];}if(_0x2eecdb['context']===_0x4306('0x52')){if(this[_0x4306('0x1c')][_0x2eecdb[_0x4306('0x44')][_0x4306('0x45')]('-')[0x0]]){this[_0x4306('0x1c')][_0x2eecdb['channel'][_0x4306('0x45')]('-')[0x0]]=_[_0x4306('0x9c')](this[_0x4306('0x1c')][_0x2eecdb[_0x4306('0x44')][_0x4306('0x45')]('-')[0x0]],['destconnectedlinenum']);logger[_0x4306('0x3d')](_0x4306('0x9d'),_0x2eecdb[_0x4306('0x3a')],util['inspect']({'id':this[_0x4306('0x1c')][_0x2eecdb['channel'][_0x4306('0x45')]('-')[0x0]]['id'],'destaccountcode':this[_0x4306('0x1c')][_0x2eecdb[_0x4306('0x44')]['split']('-')[0x0]][_0x4306('0x4b')]},{'showHidden':![],'depth':null}));this[_0x4306('0x37')](util[_0x4306('0x4e')](_0x4306('0x4a'),this[_0x4306('0x1c')][_0x2eecdb[_0x4306('0x44')][_0x4306('0x45')]('-')[0x0]][_0x4306('0x54')]),_0x4306('0x9e'),{'id':this[_0x4306('0x1c')][_0x2eecdb[_0x4306('0x44')][_0x4306('0x45')]('-')[0x0]]['id'],'destaccountcode':this[_0x4306('0x1c')][_0x2eecdb[_0x4306('0x44')][_0x4306('0x45')]('-')[0x0]][_0x4306('0x4b')]});}}var _0x320d49=this;Promise[_0x4306('0x9f')]()['then'](function(){var _0x33ccc6=_0x320d49[_0x4306('0x1b')][_0x2eecdb[_0x4306('0x3a')]];if(typeof _0x33ccc6[_0x4306('0xa0')]==='undefined')return;if(_[_0x4306('0xa1')](_0x33ccc6[_0x4306('0x78')]))return;return RpcSetting[_0x4306('0xa2')]()[_0x4306('0xa3')](function(_0x1d21c5){if(!_0x1d21c5[_0x4306('0xa4')])return;return Promise[_0x4306('0x9f')]()['then'](function(){return ami[_0x4306('0xa5')]({'action':'StopMixMonitor','channel':_0x33ccc6[_0x4306('0x44')]})[_0x4306('0xa6')](function(){});})[_0x4306('0xa3')](function(){return ami[_0x4306('0xa5')]({'action':_0x4306('0xa7'),'channel':_0x33ccc6[_0x4306('0x6b')]})['catch'](function(){})[_0x4306('0xa8')](function(){var _0x25ae01=_0x320d49[_0x4306('0x1c')][_0x33ccc6[_0x4306('0x6b')][_0x4306('0x45')]('-')[0x0]];if(!_0x25ae01)return;io[_0x4306('0x37')](_0x4306('0xa9'),{'agentId':_0x25ae01['id'],'uniqueid':_0x33ccc6[_0x4306('0x3a')]});});});});})[_0x4306('0xa3')](function(){if(_0x2eecdb[_0x4306('0xaa')]===_0x4306('0xab')){_0x320d49[_0x4306('0x1d')][_0x2eecdb['uniqueid']]=_0x320d49[_0x4306('0x1b')][_0x2eecdb[_0x4306('0x3a')]];}else{if(_0x320d49['channels'][_0x2eecdb[_0x4306('0x3a')]][_0x4306('0x87')]==='outbound'&&_0x320d49[_0x4306('0x1d')][_0x2eecdb[_0x4306('0x3a')]]){_0x320d49[_0x4306('0x1b')][_0x2eecdb['uniqueid']]['uniqueid']=[_0x320d49[_0x4306('0x1b')][_0x2eecdb['uniqueid']]['linkedid'],_0x320d49[_0x4306('0x1b')][_0x2eecdb[_0x4306('0x3a')]]['linkedid']=_0x320d49[_0x4306('0x1b')][_0x2eecdb[_0x4306('0x3a')]][_0x4306('0x3a')]][0x0];delete _0x320d49[_0x4306('0x1d')][_0x2eecdb[_0x4306('0x3a')]];}}logger[_0x4306('0x3d')]('[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:',_0x2eecdb[_0x4306('0x3a')],util['inspect'](_0x320d49[_0x4306('0x1b')][_0x2eecdb[_0x4306('0x3a')]],{'showHidden':![],'depth':null}));ami['emit']('custom:voiceCallReport',_0x320d49[_0x4306('0x1b')][_0x2eecdb[_0x4306('0x3a')]]);delete _0x320d49[_0x4306('0x1b')][_0x2eecdb[_0x4306('0x3a')]];});}}}catch(_0x2a314d){logger[_0x4306('0x32')](_0x4306('0xac'),_0x2eecdb[_0x4306('0x3a')],util[_0x4306('0x33')](_0x2a314d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4306('0x34')][_0x4306('0xad')]=function(_0x4dff5c){try{if(this['isNotNull'](_0x4dff5c)){logger[_0x4306('0x38')](_0x4306('0xae'),_0x4dff5c['uniqueid'],_0x4dff5c[_0x4306('0xaf')],_0x4dff5c[_0x4306('0xb0')]);logger[_0x4306('0x3d')](_0x4306('0xb1'),_0x4dff5c[_0x4306('0x3a')],util[_0x4306('0x33')](_0x4dff5c,{'showHidden':![],'depth':null}));if(this['channels'][_0x4dff5c[_0x4306('0xb2')]]){this[_0x4306('0x1b')][_0x4dff5c[_0x4306('0xb2')]][_0x4306('0xb3')]=_0x4dff5c[_0x4306('0xaf')];this['channels'][_0x4dff5c['transfereeuniqueid']][_0x4306('0xb4')]=_0x4dff5c[_0x4306('0xb0')];if(this['channels'][_0x4dff5c[_0x4306('0xb5')]]){var _0x43a169=this[_0x4306('0x1b')][_0x4dff5c[_0x4306('0xb5')]];this['channels'][_0x4dff5c[_0x4306('0xb5')]]=this['channels'][_0x4dff5c['transfereeuniqueid']];this[_0x4306('0x1b')][_0x4dff5c['transfereeuniqueid']]=_0x43a169;}}else if(this[_0x4306('0x1b')][_0x4dff5c[_0x4306('0xb6')]]){this[_0x4306('0x1b')][_0x4dff5c['transfertargetuniqueid']]['transfercalleridnum']=_0x4dff5c[_0x4306('0xaf')];this[_0x4306('0x1b')][_0x4dff5c[_0x4306('0xb6')]][_0x4306('0xb4')]=_0x4dff5c[_0x4306('0xb0')];if(this[_0x4306('0x1b')][_0x4dff5c[_0x4306('0xb7')]]){var _0x43a169=this['channels'][_0x4dff5c[_0x4306('0xb7')]];this[_0x4306('0x1b')][_0x4dff5c[_0x4306('0xb7')]]=this[_0x4306('0x1b')][_0x4dff5c[_0x4306('0xb6')]];this['channels'][_0x4dff5c[_0x4306('0xb6')]]=_0x43a169;}}if((this['channels'][_0x4dff5c[_0x4306('0xb7')]]||this[_0x4306('0x1b')][_0x4dff5c[_0x4306('0xb8')]])&&this['channels'][_0x4dff5c[_0x4306('0xb5')]]){var _0x34625a=_[_0x4306('0xb9')]([this[_0x4306('0x1b')][_0x4dff5c['origtransfereruniqueid']],this[_0x4306('0x1b')][_0x4dff5c['origtransfererlinkedid']],this[_0x4306('0x1b')][_0x4dff5c[_0x4306('0xb5')]]],function(_0x3503db){return _0x3503db&&_0x3503db[_0x4306('0x87')]==='outbound'&&_0x3503db[_0x4306('0xba')];});if(_0x34625a){if(this[_0x4306('0x1b')][_0x4dff5c['origtransfereruniqueid']])this[_0x4306('0x1b')][_0x4dff5c['origtransfereruniqueid']][_0x4306('0xa0')]=_0x4306('0xbb');if(this['channels'][_0x4dff5c[_0x4306('0xb8')]])this[_0x4306('0x1b')][_0x4dff5c[_0x4306('0xb8')]][_0x4306('0xa0')]=_0x4306('0xbb');this[_0x4306('0x1b')][_0x4dff5c[_0x4306('0xb5')]]['transferType']=_0x4306('0xbb');}}}}catch(_0x1e75d9){logger['error']('[%s][voiceCallReport][attendedtransfer]',_0x4dff5c['uniqueid'],util['inspect'](_0x1e75d9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4306('0x34')][_0x4306('0x2b')]=function(_0x5239ff){try{if(this[_0x4306('0x35')](_0x5239ff)){logger[_0x4306('0x38')]('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x5239ff['uniqueid'],_0x5239ff['transfereecalleridnum'],_0x5239ff[_0x4306('0xbc')]);logger[_0x4306('0x3d')](_0x4306('0xbd'),_0x5239ff[_0x4306('0x3a')],util['inspect'](_0x5239ff,{'showHidden':![],'depth':null}));if(this[_0x4306('0x1b')][_0x5239ff[_0x4306('0xb2')]]){this['channels'][_0x5239ff['transfereeuniqueid']][_0x4306('0xb3')]=_0x5239ff[_0x4306('0xbe')];this[_0x4306('0x1b')][_0x5239ff[_0x4306('0xb2')]][_0x4306('0xb4')]=_0x5239ff[_0x4306('0xbc')];this[_0x4306('0x1b')][_0x5239ff[_0x4306('0xb2')]][_0x4306('0xa0')]=_0x4306('0xbf');this[_0x4306('0x26')]({'event':_0x4306('0xab'),'uniqueid':_0x5239ff['transfereeuniqueid'],'context':_0x5239ff[_0x4306('0x43')],'channel':_0x5239ff[_0x4306('0xc0')]});}else{this[_0x4306('0x1b')][_0x5239ff[_0x4306('0xc1')]][_0x4306('0xa0')]=_0x4306('0xbf');}}}catch(_0x21e8c1){logger[_0x4306('0x32')]('[%s][voiceCallReport][blindtransfer]',_0x5239ff[_0x4306('0x3a')],util[_0x4306('0x33')](_0x21e8c1,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x4306('0x2d')]=function(_0x1f0a3b){try{if(this[_0x4306('0x35')](_0x1f0a3b)){logger[_0x4306('0x3d')]('[%s][voiceCallReport][musiconholdstart]\x20event:',_0x1f0a3b['uniqueid'],util[_0x4306('0x33')](_0x1f0a3b,{'showHidden':![],'depth':null}));if(this[_0x4306('0x1b')][_0x1f0a3b[_0x4306('0x3a')]]){if(!_[_0x4306('0x79')](this[_0x4306('0x1b')][_0x1f0a3b[_0x4306('0x3a')]]['answertime'])){this[_0x4306('0x1b')][_0x1f0a3b[_0x4306('0x3a')]][_0x4306('0xc2')]=moment()[_0x4306('0x4e')](_0x4306('0x4f'));logger['info'](_0x4306('0xc3'),_0x1f0a3b['uniqueid'],this[_0x4306('0x1b')][_0x1f0a3b['uniqueid']][_0x4306('0xc2')]);}}}}catch(_0x5f135f){logger['error'](_0x4306('0xc4'),_0x1f0a3b[_0x4306('0x3a')],util[_0x4306('0x33')](_0x5f135f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x4306('0x2f')]=function(_0x171676){try{if(this['isNotNull'](_0x171676)){logger[_0x4306('0x3d')](_0x4306('0xc5'),_0x171676[_0x4306('0x3a')],util['inspect'](_0x171676,{'showHidden':![],'depth':null}));if(this[_0x4306('0x1b')][_0x171676[_0x4306('0x3a')]]){if(!_[_0x4306('0x79')](this[_0x4306('0x1b')][_0x171676[_0x4306('0x3a')]]['mohstarttime'])){this[_0x4306('0x1b')][_0x171676[_0x4306('0x3a')]][_0x4306('0xc6')]+=moment()[_0x4306('0xc7')](0x0)[_0x4306('0x6a')](this['channels'][_0x171676[_0x4306('0x3a')]][_0x4306('0xc2')],'seconds');logger['info']('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0x171676[_0x4306('0x3a')],this['channels'][_0x171676['uniqueid']][_0x4306('0xc6')]);delete this[_0x4306('0x1b')][_0x171676[_0x4306('0x3a')]][_0x4306('0xc2')];}}}}catch(_0x385680){logger[_0x4306('0x32')]('[%s][voiceCallReport][musiconholdstop]',_0x171676[_0x4306('0x3a')],util['inspect'](_0x385680,{'showHidden':![],'depth':null}));}};module[_0x4306('0xc8')]=VoiceCallReport; \ No newline at end of file +var _0x604a=['Action','catch','StopMixMonitor','finally','event','BlindTransfer','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','some','origtransfererlinkedid','outbound','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfereecalleridnum','BLIND','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','isNil','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','exports','lodash','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','set','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','localhost','channels','agents','blindTransfers','coreshowchannel','bind','newexten','syncNewExten','newchannel','syncNewChannel','newstate','syncNewState','syncVarSet','hangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','info','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','isUndefined','merge','pick','keys','context','channel','exten','xcally-motion-preview','split','destconnectedlinenum','connectedlinenum','format','user:%s','accountcode','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','from-sip','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','name','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','applicationdata','appdata','startsWith','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','includes','lastapplication','lastdata','cdr(','match','queue','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20event:','answered','holdtime','connectedlinename','destinationchannel','membername','UserId','routealias','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','push','rec','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%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-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','parse','syncMixMonitorFilename','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','[%s][voiceCallReport][varset]','syncHangup','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','diff','seconds','billableseconds','answertime','omit','user:agentcomplete','resolve','then','transferType','getSettings','stopRecordingOnTransfer'];(function(_0x4cbf97,_0x58c02d){var _0x2ee505=function(_0x1bd58f){while(--_0x1bd58f){_0x4cbf97['push'](_0x4cbf97['shift']());}};_0x2ee505(++_0x58c02d);}(_0x604a,0xf8));var _0xa604=function(_0x38c770,_0x375f8d){_0x38c770=_0x38c770-0x0;var _0x19b872=_0x604a[_0x38c770];return _0x19b872;};'use strict';var BPromise=require('bluebird');var _=require(_0xa604('0x0'));var moment=require('moment');var util=require(_0xa604('0x1'));var path=require(_0xa604('0x2'));var Redis=require(_0xa604('0x3'));var config=require(_0xa604('0x4'));var logger=require(_0xa604('0x5'))(_0xa604('0x6'));var ami=require(_0xa604('0x7'));var Channel=require(_0xa604('0x8'));var RpcSetting=require(_0xa604('0x9'));var statusDesc=[_0xa604('0xa'),_0xa604('0xb'),_0xa604('0xc'),_0xa604('0xd'),_0xa604('0xe'),_0xa604('0xf'),_0xa604('0x10'),_0xa604('0x11'),'onhold'];var applications=[_0xa604('0x12'),'queue','agi',_0xa604('0x13'),_0xa604('0x14'),_0xa604('0x15')];var dispositions=[_0xa604('0x16'),_0xa604('0x17'),'FAILED',_0xa604('0x16'),_0xa604('0x16'),_0xa604('0x16'),_0xa604('0x18'),_0xa604('0x19'),_0xa604('0x17'),_0xa604('0x17'),_0xa604('0x17')];var actions={};config[_0xa604('0x1a')]=_[_0xa604('0x1b')](config[_0xa604('0x1a')],{'host':_0xa604('0x1c'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa604('0x1a')]));function VoiceCallReport(_0x560250){this['channels']=_0x560250[_0xa604('0x1d')];this[_0xa604('0x1e')]=_0x560250[_0xa604('0x1e')];this[_0xa604('0x1f')]={};ami['on'](_0xa604('0x20'),this['syncNewExten'][_0xa604('0x21')](this));ami['on'](_0xa604('0x22'),this[_0xa604('0x23')][_0xa604('0x21')](this));ami['on'](_0xa604('0x24'),this[_0xa604('0x25')][_0xa604('0x21')](this));ami['on'](_0xa604('0x26'),this[_0xa604('0x27')][_0xa604('0x21')](this));ami['on']('varset',this[_0xa604('0x28')][_0xa604('0x21')](this));ami['on'](_0xa604('0x29'),this['syncHangup'][_0xa604('0x21')](this));ami['on'](_0xa604('0x2a'),this[_0xa604('0x2b')]['bind'](this));ami['on'](_0xa604('0x2c'),this[_0xa604('0x2d')][_0xa604('0x21')](this));ami['on'](_0xa604('0x2e'),this[_0xa604('0x2f')][_0xa604('0x21')](this));ami['on'](_0xa604('0x30'),this['syncMusicOnHoldStart'][_0xa604('0x21')](this));ami['on'](_0xa604('0x31'),this[_0xa604('0x32')][_0xa604('0x21')](this));try{logger[_0xa604('0x33')]('[voiceCallReport][coreshowchannels]\x20started');ami[_0xa604('0x34')]();}catch(_0x4d07e7){logger[_0xa604('0x35')](_0xa604('0x36'),util[_0xa604('0x37')](_0x4d07e7,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xa604('0x38')][_0xa604('0x39')]=function(_0x2a1990){return _0x2a1990!==null&&!_['isUndefined'](_0x2a1990);};VoiceCallReport[_0xa604('0x38')][_0xa604('0x3a')]=function(_0x26c15b,_0x3baf7b,_0x581106){io['to'](_0x26c15b)[_0xa604('0x3a')](_0x3baf7b,_0x581106);};VoiceCallReport[_0xa604('0x38')][_0xa604('0x2b')]=function(_0xcb6665){try{if(this[_0xa604('0x39')](_0xcb6665)){logger['info'](_0xa604('0x3b'),_0xcb6665[_0xa604('0x3c')],_0xcb6665[_0xa604('0x3d')],_0xcb6665[_0xa604('0x3e')]);logger[_0xa604('0x3f')](_0xa604('0x40'),_0xcb6665[_0xa604('0x3c')],util[_0xa604('0x37')](_0xcb6665,{'showHidden':![],'depth':null}));if(_0xcb6665['uniqueid']===_0xcb6665[_0xa604('0x41')]){if(!_[_0xa604('0x42')](this['channels'][_0xcb6665['uniqueid']])){_[_0xa604('0x43')](this['channels'][_0xcb6665[_0xa604('0x3c')]],_[_0xa604('0x44')](_0xcb6665,_[_0xa604('0x45')](this[_0xa604('0x1d')][_0xcb6665[_0xa604('0x3c')]])));}}if(_0xcb6665[_0xa604('0x46')]==='from-sip'){if(this[_0xa604('0x1e')][_0xcb6665[_0xa604('0x47')]['split']('-')[0x0]]){if(_0xcb6665[_0xa604('0x48')]==_0xa604('0x49')){this[_0xa604('0x1e')][_0xcb6665['channel'][_0xa604('0x4a')]('-')[0x0]][_0xa604('0x4b')]=_0xcb6665[_0xa604('0x4c')];this[_0xa604('0x3a')](util[_0xa604('0x4d')](_0xa604('0x4e'),this[_0xa604('0x1e')][_0xcb6665[_0xa604('0x47')][_0xa604('0x4a')]('-')[0x0]]['name']),'user:agentconnect',{'destaccountcode':this['agents'][_0xcb6665[_0xa604('0x47')][_0xa604('0x4a')]('-')[0x0]][_0xa604('0x4f')],'destconnectedlinenum':_0xcb6665[_0xa604('0x4c')]});}}}}}catch(_0x16a5d2){logger['error']('[%s][voiceCallReport][newcallerid]',_0xcb6665['uniqueid'],util[_0xa604('0x37')](_0x16a5d2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa604('0x38')][_0xa604('0x25')]=function(_0x39e5e4){try{if(this[_0xa604('0x39')](_0x39e5e4)){logger['debug'](_0xa604('0x50'),_0x39e5e4[_0xa604('0x3c')],util[_0xa604('0x37')](_0x39e5e4,{'showHidden':![],'depth':null}));if(_0x39e5e4['uniqueid']===_0x39e5e4[_0xa604('0x41')]&&_0x39e5e4[_0xa604('0x47')]!=_0xa604('0x51')){if(_[_0xa604('0x42')](this[_0xa604('0x1d')][_0x39e5e4[_0xa604('0x3c')]])){logger[_0xa604('0x33')](_0xa604('0x52'),_0x39e5e4[_0xa604('0x3c')],_0x39e5e4['context'],_0x39e5e4[_0xa604('0x48')]);this[_0xa604('0x1d')][_0x39e5e4[_0xa604('0x3c')]]=new Channel();this[_0xa604('0x1d')][_0x39e5e4['uniqueid']][_0xa604('0x53')]=moment()[_0xa604('0x4d')](_0xa604('0x54'));this[_0xa604('0x1d')][_0x39e5e4[_0xa604('0x3c')]][_0xa604('0x55')]=dispositions[_[_0xa604('0x56')](_0x39e5e4[_0xa604('0x57')])];_[_0xa604('0x43')](this[_0xa604('0x1d')][_0x39e5e4[_0xa604('0x3c')]],_['pick'](_0x39e5e4,_['keys'](this[_0xa604('0x1d')][_0x39e5e4['uniqueid']])));if(_0x39e5e4[_0xa604('0x46')]===_0xa604('0x58')){if(this['agents'][_0x39e5e4[_0xa604('0x47')]['split']('-')[0x0]]){if(_[_0xa604('0x42')](this[_0xa604('0x1e')][_0x39e5e4['channel']['split']('-')[0x0]]['destconnectedlinenum'])){this[_0xa604('0x1e')][_0x39e5e4['channel']['split']('-')[0x0]][_0xa604('0x4b')]=_0x39e5e4['exten'];logger[_0xa604('0x3f')](_0xa604('0x59'),_0x39e5e4[_0xa604('0x3c')],util[_0xa604('0x37')]({'destaccountcode':this[_0xa604('0x1e')][_0x39e5e4[_0xa604('0x47')][_0xa604('0x4a')]('-')[0x0]][_0xa604('0x4f')],'destconnectedlinenum':_0x39e5e4[_0xa604('0x48')]},{'showHidden':![],'depth':null}));this[_0xa604('0x3a')](util[_0xa604('0x4d')]('user:%s',this[_0xa604('0x1e')][_0x39e5e4[_0xa604('0x47')][_0xa604('0x4a')]('-')[0x0]][_0xa604('0x5a')]),_0xa604('0x5b'),{'destaccountcode':this[_0xa604('0x1e')][_0x39e5e4[_0xa604('0x47')][_0xa604('0x4a')]('-')[0x0]][_0xa604('0x4f')],'destconnectedlinenum':_0x39e5e4[_0xa604('0x48')]});}}}}}}}catch(_0x2d9f6a){logger['error'](_0xa604('0x5c'),_0x39e5e4[_0xa604('0x3c')],util[_0xa604('0x37')](_0x2d9f6a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa604('0x38')][_0xa604('0x23')]=function(_0x10a8ad){try{if(this[_0xa604('0x39')](_0x10a8ad)){logger[_0xa604('0x3f')](_0xa604('0x5d'),_0x10a8ad[_0xa604('0x3c')],util[_0xa604('0x37')](_0x10a8ad,{'showHidden':![],'depth':null}));if(_0x10a8ad[_0xa604('0x3c')]===_0x10a8ad[_0xa604('0x41')]&&_0x10a8ad[_0xa604('0x48')]!='h'&&_0x10a8ad['channel']!=_0xa604('0x51')){_0x10a8ad[_0xa604('0x5e')]=_0x10a8ad[_0xa604('0x5e')]['toLowerCase']();_0x10a8ad[_0xa604('0x5f')]=_0x10a8ad[_0xa604('0x60')]&&_0x10a8ad[_0xa604('0x60')][_0xa604('0x61')]('CDR(routeAlias)')?_0x10a8ad['appdata']:(_0x10a8ad[_0xa604('0x60')]||_0x10a8ad[_0xa604('0x5f')])[_0xa604('0x62')]();logger[_0xa604('0x33')](_0xa604('0x63'),_0x10a8ad[_0xa604('0x3c')],_0x10a8ad['application'],_0x10a8ad['applicationdata']);if(_[_0xa604('0x42')](this['channels'][_0x10a8ad['uniqueid']])){this['channels'][_0x10a8ad[_0xa604('0x3c')]]=new Channel();this['channels'][_0x10a8ad[_0xa604('0x3c')]]['starttime']=_0x10a8ad[_0xa604('0x64')]?moment()[_0xa604('0x65')](moment[_0xa604('0x64')](_0x10a8ad['duration'])['seconds'](),'seconds')[_0xa604('0x4d')](_0xa604('0x54')):moment()['format'](_0xa604('0x54'));this['channels'][_0x10a8ad[_0xa604('0x3c')]][_0xa604('0x55')]=_0xa604('0x16');}_[_0xa604('0x43')](this['channels'][_0x10a8ad['uniqueid']],_[_0xa604('0x44')](_0x10a8ad,_[_0xa604('0x45')](this[_0xa604('0x1d')][_0x10a8ad[_0xa604('0x3c')]])));if(_[_0xa604('0x66')](applications,_0x10a8ad[_0xa604('0x5e')])){this[_0xa604('0x1d')][_0x10a8ad[_0xa604('0x3c')]][_0xa604('0x67')]=_0x10a8ad['application'];this[_0xa604('0x1d')][_0x10a8ad[_0xa604('0x3c')]][_0xa604('0x68')]=_0x10a8ad[_0xa604('0x5f')];if(_0x10a8ad['application']==='set'&&_[_0xa604('0x61')](_0x10a8ad[_0xa604('0x5f')][_0xa604('0x62')](),_0xa604('0x69'))){var _0x100cc7=_0x10a8ad['applicationdata'][_0xa604('0x4a')]('=');var _0x1e3f1a=_0x100cc7[0x0][_0xa604('0x62')]()[_0xa604('0x6a')](/cdr\((.*)\)/);if(_0x1e3f1a){this['channels'][_0x10a8ad[_0xa604('0x3c')]][_0x1e3f1a[0x1]]=_0x100cc7[0x1];}}else if(_0x10a8ad[_0xa604('0x5e')]===_0xa604('0x6b')){this['channels'][_0x10a8ad[_0xa604('0x3c')]][_0xa604('0x6b')]=_0x10a8ad[_0xa604('0x5f')][_0xa604('0x4a')](',')[0x0];}}}}}catch(_0x54d35d){logger[_0xa604('0x35')](_0xa604('0x6c'),_0x10a8ad[_0xa604('0x3c')],util[_0xa604('0x37')](_0x54d35d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa604('0x38')][_0xa604('0x27')]=function(_0x1bfa78){try{if(this[_0xa604('0x39')](_0x1bfa78)){logger[_0xa604('0x33')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x1bfa78[_0xa604('0x3c')],_0x1bfa78[_0xa604('0x41')],_0x1bfa78['calleridname'],_0x1bfa78[_0xa604('0x3e')]);logger[_0xa604('0x3f')](_0xa604('0x6d'),_0x1bfa78['uniqueid'],util[_0xa604('0x37')](_0x1bfa78,{'showHidden':![],'depth':null}));if(_0x1bfa78[_0xa604('0x3c')]!==_0x1bfa78['linkedid']){if(this['channels'][_0x1bfa78[_0xa604('0x41')]]){if(_0x1bfa78['channelstate']==='6'){if(!this[_0xa604('0x1d')][_0x1bfa78[_0xa604('0x41')]]['answered']){var _0xc99ab3=moment();this[_0xa604('0x1d')][_0x1bfa78['linkedid']][_0xa604('0x6e')]=!![];this[_0xa604('0x1d')][_0x1bfa78[_0xa604('0x41')]]['answertime']=_0xc99ab3[_0xa604('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0xa604('0x1d')][_0x1bfa78[_0xa604('0x41')]]['starttime']){this['channels'][_0x1bfa78['linkedid']][_0xa604('0x6f')]=_0xc99ab3['diff'](this[_0xa604('0x1d')][_0x1bfa78[_0xa604('0x41')]][_0xa604('0x53')],'seconds');}}this[_0xa604('0x1d')][_0x1bfa78[_0xa604('0x41')]]['linkedid']=_0x1bfa78[_0xa604('0x3c')];if(_0x1bfa78[_0xa604('0x3e')]!=='xcally-motion-preview'){this[_0xa604('0x1d')][_0x1bfa78[_0xa604('0x41')]]['connectedlinenum']=_0x1bfa78[_0xa604('0x3e')];}this['channels'][_0x1bfa78[_0xa604('0x41')]][_0xa604('0x70')]=_0x1bfa78[_0xa604('0x3d')];this['channels'][_0x1bfa78['linkedid']][_0xa604('0x71')]=_0x1bfa78[_0xa604('0x47')];this['channels'][_0x1bfa78['linkedid']][_0xa604('0x55')]=dispositions[_[_0xa604('0x56')](_0x1bfa78[_0xa604('0x57')])];if(this[_0xa604('0x1e')][_0x1bfa78[_0xa604('0x47')]['split']('-')[0x0]]){this[_0xa604('0x1d')][_0x1bfa78[_0xa604('0x41')]]['UserId']=this[_0xa604('0x1e')][_0x1bfa78[_0xa604('0x47')]['split']('-')[0x0]]['id'];this[_0xa604('0x1d')][_0x1bfa78[_0xa604('0x41')]][_0xa604('0x72')]=this[_0xa604('0x1e')][_0x1bfa78[_0xa604('0x47')][_0xa604('0x4a')]('-')[0x0]][_0xa604('0x5a')];}}}}else{if(this['channels'][_0x1bfa78[_0xa604('0x3c')]]){if(_0x1bfa78[_0xa604('0x57')]==='6'){if(this['agents'][_0x1bfa78[_0xa604('0x47')][_0xa604('0x4a')]('-')[0x0]]){this[_0xa604('0x1d')][_0x1bfa78[_0xa604('0x3c')]][_0xa604('0x73')]=this[_0xa604('0x1e')][_0x1bfa78[_0xa604('0x47')][_0xa604('0x4a')]('-')[0x0]]['id'];this['channels'][_0x1bfa78[_0xa604('0x3c')]][_0xa604('0x72')]=this['agents'][_0x1bfa78[_0xa604('0x47')]['split']('-')[0x0]]['name'];}}}}if(_0x1bfa78[_0xa604('0x57')]==='6'&&_0x1bfa78[_0xa604('0x46')]===_0xa604('0x58')){if(this[_0xa604('0x1e')][_0x1bfa78['channel'][_0xa604('0x4a')]('-')[0x0]]){this[_0xa604('0x1e')][_0x1bfa78['channel']['split']('-')[0x0]]['destconnectedlinenum']=_0x1bfa78[_0xa604('0x48')];var _0xb8d42c;if(this[_0xa604('0x1d')][_0x1bfa78['uniqueid']])_0xb8d42c=this[_0xa604('0x1d')][_0x1bfa78[_0xa604('0x3c')]][_0xa604('0x74')];else if(this[_0xa604('0x1d')][_0x1bfa78[_0xa604('0x41')]])_0xb8d42c=this[_0xa604('0x1d')][_0x1bfa78[_0xa604('0x41')]][_0xa604('0x74')];logger['debug']('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x1bfa78['uniqueid'],util[_0xa604('0x37')]({'destaccountcode':this[_0xa604('0x1e')][_0x1bfa78['channel'][_0xa604('0x4a')]('-')[0x0]][_0xa604('0x4f')],'destconnectedlinenum':_0x1bfa78[_0xa604('0x48')],'routealias':_0xb8d42c},{'showHidden':![],'depth':null}));this['emit'](util[_0xa604('0x4d')]('user:%s',this['agents'][_0x1bfa78[_0xa604('0x47')]['split']('-')[0x0]][_0xa604('0x5a')]),_0xa604('0x5b'),{'destaccountcode':this[_0xa604('0x1e')][_0x1bfa78[_0xa604('0x47')][_0xa604('0x4a')]('-')[0x0]][_0xa604('0x4f')],'destconnectedlinenum':_0x1bfa78[_0xa604('0x48')],'routealias':_0xb8d42c});}}}}catch(_0x57f122){logger[_0xa604('0x35')]('[%s][voiceCallReport][newstate]',_0x1bfa78['uniqueid'],util[_0xa604('0x37')](_0x57f122,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMixMonitorFilename']=function(_0x5568d9,_0x54c6d4){try{if(this[_0xa604('0x1d')][_0x5568d9]){logger[_0xa604('0x33')](_0xa604('0x75'),_0x5568d9,_0x54c6d4);this['channels'][_0x5568d9][_0xa604('0x76')]=!![];if(_[_0xa604('0x77')](_0x54c6d4,_0xa604('0x78'))){_0x54c6d4=_0x54c6d4[_0xa604('0x79')](_0xa604('0x78'),_0xa604('0x7a'));}this[_0xa604('0x1d')][_0x5568d9][_0xa604('0x7b')]=_0x54c6d4;var _0x52b241=_[_0xa604('0x7c')](this[_0xa604('0x1d')][_0x5568d9][_0xa604('0x7d')],{'filename':_0x54c6d4});if(_['isNil'](_0x52b241)){this[_0xa604('0x1d')][_0x5568d9]['monitors'][_0xa604('0x7e')]({'filename':_0x54c6d4,'createdAt':moment()[_0xa604('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0xa604('0x7f')});}}}catch(_0x4094fc){logger[_0xa604('0x35')]('[%s][voiceCallReport][mixMonitorFilename]',_0x5568d9,util[_0xa604('0x37')](_0x4094fc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa604('0x38')][_0xa604('0x28')]=function(_0x522de4){try{if(this['isNotNull'](_0x522de4)){logger[_0xa604('0x3f')]('[%s][voiceCallReport][varset]\x20event:',_0x522de4[_0xa604('0x3c')],util[_0xa604('0x37')](_0x522de4,{'showHidden':![],'depth':null}));if(this['channels'][_0x522de4[_0xa604('0x3c')]]&&_0x522de4[_0xa604('0x47')]!=_0xa604('0x51')){if(this[_0xa604('0x39')](_0x522de4[_0xa604('0x80')])){if(this['isNotNull'](_0x522de4['variable'][_0xa604('0x81')])){logger[_0xa604('0x33')](_0xa604('0x82'),_0x522de4[_0xa604('0x3c')],_0x522de4[_0xa604('0x83')]);this['syncMixMonitorFilename'](_0x522de4[_0xa604('0x3c')],_0x522de4[_0xa604('0x83')]);}else if(this[_0xa604('0x39')](_0x522de4[_0xa604('0x80')][_0xa604('0x84')])){logger['info'](_0xa604('0x85'),_0x522de4['uniqueid'],_0x522de4[_0xa604('0x83')]);this[_0xa604('0x1d')][_0x522de4[_0xa604('0x3c')]][_0xa604('0x3e')]=_0x522de4[_0xa604('0x83')];}else if(this[_0xa604('0x39')](_0x522de4[_0xa604('0x80')][_0xa604('0x86')])){logger[_0xa604('0x33')](_0xa604('0x87'),_0x522de4[_0xa604('0x3c')],_0x522de4[_0xa604('0x83')]);this[_0xa604('0x1d')][_0x522de4[_0xa604('0x3c')]][_0xa604('0x88')]=_0x522de4['value'];}else if(this['isNotNull'](_0x522de4[_0xa604('0x80')][_0xa604('0x89')])){logger[_0xa604('0x33')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x522de4[_0xa604('0x3c')],_0x522de4['value']);this['channels'][_0x522de4[_0xa604('0x3c')]][_0xa604('0x8a')]=_0x522de4[_0xa604('0x83')];}else if(this[_0xa604('0x39')](_0x522de4[_0xa604('0x80')][_0xa604('0x8b')])){logger['info'](_0xa604('0x8c'),_0x522de4['uniqueid'],_0x522de4[_0xa604('0x83')][_0xa604('0x4a')](',')[0x0]);this[_0xa604('0x1d')][_0x522de4['uniqueid']][_0xa604('0x6b')]=_0x522de4[_0xa604('0x83')]['split'](',')[0x0];}else if(this[_0xa604('0x39')](_0x522de4[_0xa604('0x80')][_0xa604('0x8d')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x522de4['uniqueid'],_0x522de4['value']);this[_0xa604('0x1d')][_0x522de4['uniqueid']]['originatecalleridnum']=_0x522de4[_0xa604('0x83')];}else if(this['isNotNull'](_0x522de4['variable']['xmd-destination'])){logger['info'](_0xa604('0x8e'),_0x522de4[_0xa604('0x3c')],_0x522de4[_0xa604('0x83')]);this[_0xa604('0x1d')][_0x522de4[_0xa604('0x3c')]][_0xa604('0x8f')]=_0x522de4[_0xa604('0x83')];}else if(this[_0xa604('0x39')](_0x522de4[_0xa604('0x80')][_0xa604('0x90')])){logger['info'](_0xa604('0x91'),_0x522de4['uniqueid'],_0x522de4[_0xa604('0x83')]);this[_0xa604('0x1d')][_0x522de4[_0xa604('0x3c')]][_0xa604('0x92')]=_0x522de4[_0xa604('0x83')];}else if(this['isNotNull'](_0x522de4[_0xa604('0x80')][_0xa604('0x93')])){logger[_0xa604('0x33')](_0xa604('0x94'),_0x522de4[_0xa604('0x3c')],_0x522de4['value']);this[_0xa604('0x1d')][_0x522de4[_0xa604('0x3c')]][_0xa604('0x6b')]=_0x522de4[_0xa604('0x83')];}else if(this[_0xa604('0x39')](_0x522de4[_0xa604('0x80')]['sipcallid'])){logger[_0xa604('0x33')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x522de4[_0xa604('0x3c')],_0x522de4['value']);this[_0xa604('0x1d')][_0x522de4[_0xa604('0x3c')]]['sipcalluniqueid']=_0x522de4[_0xa604('0x83')];}}}else if(this[_0xa604('0x39')](_0x522de4[_0xa604('0x80')]['mixmonitor_filename'])){if(_0x522de4[_0xa604('0x83')]){var _0x5b63a1=path[_0xa604('0x95')](_0x522de4['value'])['name'];logger['info'](_0xa604('0x82'),_0x5b63a1,_0x522de4[_0xa604('0x83')]);this[_0xa604('0x96')](_0x5b63a1,_0x522de4[_0xa604('0x83')]);}}else if(this[_0xa604('0x1d')][_0x522de4[_0xa604('0x41')]]){if(this['isNotNull'](_0x522de4[_0xa604('0x80')])){if(this['isNotNull'](_0x522de4[_0xa604('0x80')][_0xa604('0x97')])){logger[_0xa604('0x33')](_0xa604('0x98'),_0x522de4[_0xa604('0x41')],_0x522de4[_0xa604('0x83')]);this[_0xa604('0x1d')][_0x522de4[_0xa604('0x41')]]['sipcalllinkedid']=_0x522de4[_0xa604('0x83')];}}}}}catch(_0x3fd547){logger[_0xa604('0x35')](_0xa604('0x99'),_0x522de4[_0xa604('0x3c')],util[_0xa604('0x37')](_0x3fd547,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa604('0x38')][_0xa604('0x9a')]=function(_0x54da09){try{if(this['isNotNull'](_0x54da09)){logger[_0xa604('0x3f')](_0xa604('0x9b'),_0x54da09['uniqueid'],util[_0xa604('0x37')](_0x54da09,{'showHidden':![],'depth':null}));if(this[_0xa604('0x1d')][_0x54da09[_0xa604('0x3c')]]){logger[_0xa604('0x33')](_0xa604('0x9c'),_0x54da09['uniqueid'],_0x54da09['cause-txt']);var _0x4eecd0=moment();this[_0xa604('0x1d')][_0x54da09['uniqueid']]['endtime']=_0x4eecd0[_0xa604('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa604('0x1d')][_0x54da09[_0xa604('0x3c')]]['duration']=_0x4eecd0[_0xa604('0x9d')](this[_0xa604('0x1d')][_0x54da09[_0xa604('0x3c')]][_0xa604('0x53')],_0xa604('0x9e'));if(this[_0xa604('0x1d')][_0x54da09['uniqueid']]['answered']){this[_0xa604('0x1d')][_0x54da09['uniqueid']][_0xa604('0x9f')]=_0x4eecd0[_0xa604('0x9d')](this[_0xa604('0x1d')][_0x54da09['uniqueid']][_0xa604('0xa0')],'seconds');this['channels'][_0x54da09['uniqueid']][_0xa604('0x6f')]=this[_0xa604('0x1d')][_0x54da09[_0xa604('0x3c')]][_0xa604('0x64')]-this[_0xa604('0x1d')][_0x54da09[_0xa604('0x3c')]]['billableseconds'];}if(_0x54da09[_0xa604('0x46')]===_0xa604('0x58')){if(this[_0xa604('0x1e')][_0x54da09[_0xa604('0x47')][_0xa604('0x4a')]('-')[0x0]]){this[_0xa604('0x1e')][_0x54da09['channel'][_0xa604('0x4a')]('-')[0x0]]=_[_0xa604('0xa1')](this[_0xa604('0x1e')][_0x54da09['channel']['split']('-')[0x0]],['destconnectedlinenum']);logger[_0xa604('0x3f')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x54da09[_0xa604('0x3c')],util[_0xa604('0x37')]({'id':this[_0xa604('0x1e')][_0x54da09[_0xa604('0x47')][_0xa604('0x4a')]('-')[0x0]]['id'],'destaccountcode':this[_0xa604('0x1e')][_0x54da09['channel']['split']('-')[0x0]][_0xa604('0x4f')]},{'showHidden':![],'depth':null}));this[_0xa604('0x3a')](util[_0xa604('0x4d')](_0xa604('0x4e'),this[_0xa604('0x1e')][_0x54da09[_0xa604('0x47')][_0xa604('0x4a')]('-')[0x0]][_0xa604('0x5a')]),_0xa604('0xa2'),{'id':this[_0xa604('0x1e')][_0x54da09[_0xa604('0x47')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0xa604('0x1e')][_0x54da09[_0xa604('0x47')][_0xa604('0x4a')]('-')[0x0]][_0xa604('0x4f')]});}}var _0x264b15=this;Promise[_0xa604('0xa3')]()[_0xa604('0xa4')](function(){var _0x30c4ed=_0x264b15[_0xa604('0x1d')][_0x54da09[_0xa604('0x3c')]];if(typeof _0x30c4ed[_0xa604('0xa5')]==='undefined')return;if(_['isEmpty'](_0x30c4ed[_0xa604('0x7d')]))return;return RpcSetting[_0xa604('0xa6')]()['then'](function(_0x3aef66){if(!_0x3aef66[_0xa604('0xa7')])return;return Promise[_0xa604('0xa3')]()[_0xa604('0xa4')](function(){return ami[_0xa604('0xa8')]({'action':'StopMixMonitor','channel':_0x30c4ed[_0xa604('0x47')]})[_0xa604('0xa9')](function(){});})[_0xa604('0xa4')](function(){return ami[_0xa604('0xa8')]({'action':_0xa604('0xaa'),'channel':_0x30c4ed[_0xa604('0x71')]})[_0xa604('0xa9')](function(){})[_0xa604('0xab')](function(){var _0x45ba75=_0x264b15[_0xa604('0x1e')][_0x30c4ed['destinationchannel']['split']('-')[0x0]];if(!_0x45ba75)return;io[_0xa604('0x3a')]('webbar:stopmonitors',{'agentId':_0x45ba75['id'],'uniqueid':_0x30c4ed[_0xa604('0x3c')]});});});});})[_0xa604('0xa4')](function(){if(_0x54da09[_0xa604('0xac')]===_0xa604('0xad')){_0x264b15[_0xa604('0x1f')][_0x54da09['uniqueid']]=_0x264b15[_0xa604('0x1d')][_0x54da09[_0xa604('0x3c')]];}else{if(_0x264b15[_0xa604('0x1d')][_0x54da09[_0xa604('0x3c')]][_0xa604('0x8a')]==='outbound'&&_0x264b15[_0xa604('0x1f')][_0x54da09[_0xa604('0x3c')]]){_0x264b15['channels'][_0x54da09[_0xa604('0x3c')]][_0xa604('0x3c')]=[_0x264b15[_0xa604('0x1d')][_0x54da09[_0xa604('0x3c')]]['linkedid'],_0x264b15[_0xa604('0x1d')][_0x54da09['uniqueid']][_0xa604('0x41')]=_0x264b15[_0xa604('0x1d')][_0x54da09['uniqueid']][_0xa604('0x3c')]][0x0];delete _0x264b15['blindTransfers'][_0x54da09[_0xa604('0x3c')]];}}logger[_0xa604('0x3f')](_0xa604('0xae'),_0x54da09[_0xa604('0x3c')],util[_0xa604('0x37')](_0x264b15['channels'][_0x54da09[_0xa604('0x3c')]],{'showHidden':![],'depth':null}));ami[_0xa604('0x3a')]('custom:voiceCallReport',_0x264b15['channels'][_0x54da09[_0xa604('0x3c')]]);delete _0x264b15[_0xa604('0x1d')][_0x54da09['uniqueid']];});}}}catch(_0x250af3){logger[_0xa604('0x35')]('[%s][voiceCallReport][hangup]',_0x54da09['uniqueid'],util[_0xa604('0x37')](_0x250af3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa604('0x38')]['syncAttendedTransfer']=function(_0x83fbe0){try{if(this[_0xa604('0x39')](_0x83fbe0)){logger[_0xa604('0x33')](_0xa604('0xaf'),_0x83fbe0[_0xa604('0x3c')],_0x83fbe0[_0xa604('0xb0')],_0x83fbe0['transfertargetcalleridnum']);logger['debug'](_0xa604('0xb1'),_0x83fbe0[_0xa604('0x3c')],util['inspect'](_0x83fbe0,{'showHidden':![],'depth':null}));if(this['channels'][_0x83fbe0[_0xa604('0xb2')]]){this['channels'][_0x83fbe0[_0xa604('0xb2')]][_0xa604('0xb3')]=_0x83fbe0[_0xa604('0xb0')];this[_0xa604('0x1d')][_0x83fbe0[_0xa604('0xb2')]]['transferconnectedlinenum']=_0x83fbe0[_0xa604('0xb4')];if(this[_0xa604('0x1d')][_0x83fbe0[_0xa604('0xb5')]]){var _0x777398=this[_0xa604('0x1d')][_0x83fbe0[_0xa604('0xb5')]];this[_0xa604('0x1d')][_0x83fbe0[_0xa604('0xb5')]]=this['channels'][_0x83fbe0['transfereeuniqueid']];this['channels'][_0x83fbe0['transfereeuniqueid']]=_0x777398;}}else if(this[_0xa604('0x1d')][_0x83fbe0[_0xa604('0xb6')]]){this[_0xa604('0x1d')][_0x83fbe0['transfertargetuniqueid']][_0xa604('0xb3')]=_0x83fbe0[_0xa604('0xb0')];this[_0xa604('0x1d')][_0x83fbe0[_0xa604('0xb6')]][_0xa604('0xb7')]=_0x83fbe0['transfertargetcalleridnum'];if(this[_0xa604('0x1d')][_0x83fbe0[_0xa604('0xb8')]]){var _0x777398=this[_0xa604('0x1d')][_0x83fbe0[_0xa604('0xb8')]];this[_0xa604('0x1d')][_0x83fbe0[_0xa604('0xb8')]]=this[_0xa604('0x1d')][_0x83fbe0[_0xa604('0xb6')]];this[_0xa604('0x1d')][_0x83fbe0[_0xa604('0xb6')]]=_0x777398;}}if((this['channels'][_0x83fbe0[_0xa604('0xb8')]]||this['channels'][_0x83fbe0['origtransfererlinkedid']])&&this[_0xa604('0x1d')][_0x83fbe0[_0xa604('0xb5')]]){var _0x545642=_[_0xa604('0xb9')]([this[_0xa604('0x1d')][_0x83fbe0[_0xa604('0xb8')]],this[_0xa604('0x1d')][_0x83fbe0[_0xa604('0xba')]],this[_0xa604('0x1d')][_0x83fbe0[_0xa604('0xb5')]]],function(_0x13ca23){return _0x13ca23&&_0x13ca23[_0xa604('0x8a')]===_0xa604('0xbb')&&_0x13ca23[_0xa604('0xbc')];});if(_0x545642){if(this['channels'][_0x83fbe0[_0xa604('0xb8')]])this['channels'][_0x83fbe0['origtransfereruniqueid']]['transferType']='ATTENDED';if(this['channels'][_0x83fbe0['origtransfererlinkedid']])this[_0xa604('0x1d')][_0x83fbe0[_0xa604('0xba')]][_0xa604('0xa5')]=_0xa604('0xbd');this['channels'][_0x83fbe0[_0xa604('0xb5')]][_0xa604('0xa5')]=_0xa604('0xbd');}}}}catch(_0x3798d7){logger[_0xa604('0x35')](_0xa604('0xbe'),_0x83fbe0['uniqueid'],util['inspect'](_0x3798d7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa604('0x38')][_0xa604('0x2f')]=function(_0xa4ef42){try{if(this['isNotNull'](_0xa4ef42)){logger[_0xa604('0x33')](_0xa604('0xbf'),_0xa4ef42['uniqueid'],_0xa4ef42['transfereecalleridnum'],_0xa4ef42[_0xa604('0xc0')]);logger[_0xa604('0x3f')](_0xa604('0xc1'),_0xa4ef42['uniqueid'],util[_0xa604('0x37')](_0xa4ef42,{'showHidden':![],'depth':null}));if(this[_0xa604('0x1d')][_0xa4ef42[_0xa604('0xb2')]]){this[_0xa604('0x1d')][_0xa4ef42[_0xa604('0xb2')]][_0xa604('0xb3')]=_0xa4ef42[_0xa604('0xc2')];this[_0xa604('0x1d')][_0xa4ef42[_0xa604('0xb2')]][_0xa604('0xb7')]=_0xa4ef42[_0xa604('0xc0')];this[_0xa604('0x1d')][_0xa4ef42[_0xa604('0xb2')]]['transferType']=_0xa604('0xc3');this[_0xa604('0x9a')]({'event':'BlindTransfer','uniqueid':_0xa4ef42[_0xa604('0xb2')],'context':_0xa4ef42['context'],'channel':_0xa4ef42['transfererchannel']});}else{this[_0xa604('0x1d')][_0xa4ef42[_0xa604('0xc4')]][_0xa604('0xa5')]=_0xa604('0xc3');}}}catch(_0x34d7db){logger[_0xa604('0x35')](_0xa604('0xc5'),_0xa4ef42[_0xa604('0x3c')],util[_0xa604('0x37')](_0x34d7db,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xa604('0xc6')]=function(_0x518bca){try{if(this[_0xa604('0x39')](_0x518bca)){logger[_0xa604('0x3f')](_0xa604('0xc7'),_0x518bca['uniqueid'],util[_0xa604('0x37')](_0x518bca,{'showHidden':![],'depth':null}));if(this[_0xa604('0x1d')][_0x518bca[_0xa604('0x3c')]]){if(!_[_0xa604('0xc8')](this['channels'][_0x518bca[_0xa604('0x3c')]][_0xa604('0xa0')])){this[_0xa604('0x1d')][_0x518bca[_0xa604('0x3c')]]['mohstarttime']=moment()[_0xa604('0x4d')](_0xa604('0x54'));logger[_0xa604('0x33')](_0xa604('0xc9'),_0x518bca['uniqueid'],this['channels'][_0x518bca[_0xa604('0x3c')]][_0xa604('0xca')]);}}}}catch(_0x5460aa){logger[_0xa604('0x35')](_0xa604('0xcb'),_0x518bca[_0xa604('0x3c')],util['inspect'](_0x5460aa,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa604('0x38')]['syncMusicOnHoldStop']=function(_0x1aa85a){try{if(this[_0xa604('0x39')](_0x1aa85a)){logger[_0xa604('0x3f')](_0xa604('0xcc'),_0x1aa85a[_0xa604('0x3c')],util[_0xa604('0x37')](_0x1aa85a,{'showHidden':![],'depth':null}));if(this['channels'][_0x1aa85a[_0xa604('0x3c')]]){if(!_[_0xa604('0xc8')](this[_0xa604('0x1d')][_0x1aa85a[_0xa604('0x3c')]][_0xa604('0xca')])){this[_0xa604('0x1d')][_0x1aa85a[_0xa604('0x3c')]][_0xa604('0xcd')]+=moment()['milliseconds'](0x0)[_0xa604('0x9d')](this[_0xa604('0x1d')][_0x1aa85a[_0xa604('0x3c')]]['mohstarttime'],_0xa604('0x9e'));logger[_0xa604('0x33')](_0xa604('0xce'),_0x1aa85a[_0xa604('0x3c')],this[_0xa604('0x1d')][_0x1aa85a[_0xa604('0x3c')]][_0xa604('0xcd')]);delete this[_0xa604('0x1d')][_0x1aa85a[_0xa604('0x3c')]][_0xa604('0xca')];}}}}catch(_0x450483){logger[_0xa604('0x35')]('[%s][voiceCallReport][musiconholdstop]',_0x1aa85a[_0xa604('0x3c')],util['inspect'](_0x450483,{'showHidden':![],'depth':null}));}};module[_0xa604('0xcf')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 735e625..445e9eb 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 _0xcb2c=['includes','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','endtime','duration','diff','starttime','seconds','complete','total','answered','billableseconds','sumHoldTime','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','voice:outbound','voice_outbound:save','stringify','voice_outbound_channel:remove','linkedid','[%s][voiceDialReport][newexten]\x20event:','toLowerCase','set','applicationdata','startsWith','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','application','split','match','[%s][voiceDialReport][newexten]','exports','lodash','moment','util','ioredis','../../../config/environment','ami','../ami','redis','defaults','localhost','channels','outboundChannels','outbound','applications','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','newexten','syncNewExten','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','substring','omit','privilege','info','membername','interface','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','answertime','lastevent','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil'];(function(_0x51ff4b,_0x158964){var _0x24317c=function(_0x395f70){while(--_0x395f70){_0x51ff4b['push'](_0x51ff4b['shift']());}};_0x24317c(++_0x158964);}(_0xcb2c,0x17a));var _0xccb2=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xcb2c[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0xccb2('0x0'));var moment=require(_0xccb2('0x1'));var util=require(_0xccb2('0x2'));var Redis=require(_0xccb2('0x3'));var config=require(_0xccb2('0x4'));var logger=require('../../../config/logger')(_0xccb2('0x5'));var ami=require(_0xccb2('0x6'));config[_0xccb2('0x7')]=_[_0xccb2('0x8')](config[_0xccb2('0x7')],{'host':_0xccb2('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceDialReport(_0x3e078d){this[_0xccb2('0xa')]=_0x3e078d[_0xccb2('0xb')];this[_0xccb2('0xc')]=_0x3e078d[_0xccb2('0xc')];this[_0xccb2('0xd')]={};this[_0xccb2('0xe')]={};ami['on'](_0xccb2('0xf'),this[_0xccb2('0x10')][_0xccb2('0x11')](this));ami['on'](_0xccb2('0x12'),this[_0xccb2('0x13')]['bind'](this));ami['on'](_0xccb2('0x14'),this[_0xccb2('0x15')][_0xccb2('0x11')](this));ami['on'](_0xccb2('0x16'),this[_0xccb2('0x17')]['bind'](this));ami['on'](_0xccb2('0x18'),this[_0xccb2('0x19')]['bind'](this));}VoiceDialReport[_0xccb2('0x1a')][_0xccb2('0x1b')]=function(_0x35868d){return _0x35868d!==null&&!_[_0xccb2('0x1c')](_0x35868d);};VoiceDialReport[_0xccb2('0x1a')][_0xccb2('0x1d')]=function(_0x2b998b,_0x27256c,_0x332da0){io['to'](_0x2b998b)[_0xccb2('0x1d')](_0x27256c,_0x332da0);};VoiceDialReport['prototype'][_0xccb2('0x10')]=function(_0x1a60ea){try{if(this[_0xccb2('0x1b')](_0x1a60ea)){logger['debug'](_0xccb2('0x1e'),_0x1a60ea[_0xccb2('0x1f')],util[_0xccb2('0x20')](_0x1a60ea,{'showHidden':![],'depth':null}));if(this[_0xccb2('0xa')][_0x1a60ea[_0xccb2('0x1f')]]){_[_0xccb2('0x21')](this[_0xccb2('0xa')][_0x1a60ea[_0xccb2('0x1f')]],{'starttime':moment()[_0xccb2('0x22')](_0xccb2('0x23')),'lastevent':_0xccb2('0x24'),'interface':_0x1a60ea[_0xccb2('0x25')]['substring'](0x0,_0x1a60ea[_0xccb2('0x25')][_0xccb2('0x26')]('-')),'membername':_0x1a60ea[_0xccb2('0x25')][_0xccb2('0x27')](_0x1a60ea[_0xccb2('0x25')]['lastIndexOf']('/')+0x1,_0x1a60ea[_0xccb2('0x25')][_0xccb2('0x26')]('-'))},_[_0xccb2('0x28')](_0x1a60ea,['event',_0xccb2('0x29')]));logger[_0xccb2('0x2a')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x1a60ea[_0xccb2('0x1f')],this[_0xccb2('0xa')][_0x1a60ea['uniqueid']][_0xccb2('0x2b')],this[_0xccb2('0xa')][_0x1a60ea[_0xccb2('0x1f')]][_0xccb2('0x2c')]);logger[_0xccb2('0x2d')](_0xccb2('0x2e'),_0x1a60ea[_0xccb2('0x1f')],util[_0xccb2('0x20')](this[_0xccb2('0xa')][_0x1a60ea['uniqueid']],{'showHidden':![],'depth':null}));if(this[_0xccb2('0xd')][_0x1a60ea[_0xccb2('0x1f')]])_['merge'](this['channels'][_0x1a60ea['uniqueid']],this[_0xccb2('0xd')][_0x1a60ea[_0xccb2('0x1f')]]);this[_0xccb2('0x1d')]('voice:outbound',_0xccb2('0x2f'),this[_0xccb2('0xa')][_0x1a60ea['uniqueid']]);logger[_0xccb2('0x2d')](_0xccb2('0x30'),_0x1a60ea['uniqueid'],util['inspect'](this[_0xccb2('0xa')][_0x1a60ea[_0xccb2('0x1f')]],{'showHidden':![],'depth':null}));ami[_0xccb2('0x1d')](_0xccb2('0x31'),this['channels'][_0x1a60ea['uniqueid']]);}}}catch(_0x47203b){logger[_0xccb2('0x32')](_0xccb2('0x33'),_0x1a60ea[_0xccb2('0x1f')],util[_0xccb2('0x20')](_0x47203b,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xccb2('0x1a')][_0xccb2('0x13')]=function(_0x146658){try{if(this[_0xccb2('0x1b')](_0x146658)){logger[_0xccb2('0x2d')](_0xccb2('0x34'),_0x146658[_0xccb2('0x1f')],util['inspect'](_0x146658,{'showHidden':![],'depth':null}));if(this[_0xccb2('0xa')][_0x146658[_0xccb2('0x1f')]]){this[_0xccb2('0xa')][_0x146658[_0xccb2('0x1f')]][_0xccb2('0x35')]=_0x146658[_0xccb2('0x35')];if(_0x146658[_0xccb2('0x35')]===_0xccb2('0x36')){this['channels'][_0x146658[_0xccb2('0x1f')]]['connectedlinenum']=_0x146658[_0xccb2('0x37')];this[_0xccb2('0xa')][_0x146658[_0xccb2('0x1f')]]['connectedlinename']=_0x146658['connectedlinename'];this[_0xccb2('0xa')][_0x146658[_0xccb2('0x1f')]][_0xccb2('0x38')]=moment()[_0xccb2('0x22')](_0xccb2('0x23'));this[_0xccb2('0xa')][_0x146658['uniqueid']][_0xccb2('0x39')]='connect';logger[_0xccb2('0x2a')]('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x146658[_0xccb2('0x1f')],_0x146658[_0xccb2('0x25')][_0xccb2('0x27')](_0x146658[_0xccb2('0x25')][_0xccb2('0x26')]('/')+0x1,_0x146658[_0xccb2('0x25')][_0xccb2('0x26')]('-')));logger[_0xccb2('0x2d')](_0xccb2('0x3a'),_0x146658[_0xccb2('0x1f')],util[_0xccb2('0x20')](this['channels'][_0x146658[_0xccb2('0x1f')]],{'showHidden':![],'depth':null}));ami[_0xccb2('0x1d')]('custom:dialconnect',this[_0xccb2('0xa')][_0x146658['uniqueid']]);}logger[_0xccb2('0x2d')](_0xccb2('0x3b'),_0x146658[_0xccb2('0x1f')],util[_0xccb2('0x20')](this[_0xccb2('0xa')][_0x146658[_0xccb2('0x1f')]],{'showHidden':![],'depth':null}));this[_0xccb2('0x1d')]('voice:outbound',_0xccb2('0x2f'),this[_0xccb2('0xa')][_0x146658[_0xccb2('0x1f')]]);}}}catch(_0x478407){logger[_0xccb2('0x32')](_0xccb2('0x3c'),_0x146658[_0xccb2('0x1f')],util[_0xccb2('0x20')](_0x478407,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xccb2('0x1a')][_0xccb2('0x15')]=function(_0x4244f4){try{if(this[_0xccb2('0x1b')](_0x4244f4)){logger[_0xccb2('0x2d')](_0xccb2('0x3d'),_0x4244f4['uniqueid'],util[_0xccb2('0x20')](_0x4244f4,{'showHidden':![],'depth':null}));this[_0xccb2('0x3e')](_0x4244f4[_0xccb2('0x1f')],_[_0xccb2('0x3f')](_0x4244f4[_0xccb2('0x40')])[0x0],_0x4244f4[_0xccb2('0x41')]);if(this[_0xccb2('0x1b')](_0x4244f4['variable'])&&this[_0xccb2('0x1b')](_0x4244f4[_0xccb2('0x40')][_0xccb2('0x42')])){if(_['isUndefined'](this[_0xccb2('0xa')][_0x4244f4[_0xccb2('0x1f')]])){this[_0xccb2('0xa')][_0x4244f4[_0xccb2('0x1f')]]={'routeId':_0x4244f4[_0xccb2('0x41')],'variables':this[_0xccb2('0xe')][_0x4244f4['uniqueid']],'motionChannel':_0xccb2('0x43')};logger[_0xccb2('0x2a')](_0xccb2('0x44'),_0x4244f4[_0xccb2('0x1f')],_0x4244f4[_0xccb2('0x40')][_0xccb2('0x42')],_[_0xccb2('0x3f')](_0x4244f4[_0xccb2('0x40')])[0x0],_0x4244f4[_0xccb2('0x41')]);logger[_0xccb2('0x2d')](_0xccb2('0x45'),_0x4244f4[_0xccb2('0x1f')],util[_0xccb2('0x20')](this['channels'][_0x4244f4[_0xccb2('0x1f')]],{'showHidden':![],'depth':null}));this[_0xccb2('0x1d')]('voice:outbound',_0xccb2('0x2f'),this[_0xccb2('0xa')][_0x4244f4[_0xccb2('0x1f')]]);}}}}catch(_0x2b3a00){logger[_0xccb2('0x32')](_0xccb2('0x46'),_0x4244f4['uniqueid'],util[_0xccb2('0x20')](_0x2b3a00,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xccb2('0x1a')][_0xccb2('0x3e')]=function(_0x26f6c5,_0x5a3da2,_0x5a0973){var _0x428c5d=[_0xccb2('0x47'),_0xccb2('0x48'),'rtpaudioqosjitter',_0xccb2('0x49'),_0xccb2('0x4a'),'rtpaudioqoslossbridged',_0xccb2('0x4b'),_0xccb2('0x4c'),_0xccb2('0x4d'),_0xccb2('0x4e'),_0xccb2('0x4f'),_0xccb2('0x50'),'membercalls',_0xccb2('0x51'),'memberinterface',_0xccb2('0x52'),'membername',_0xccb2('0x53'),_0xccb2('0x54')];if(!_[_0xccb2('0x55')](_0x5a3da2)&&!_[_0xccb2('0x56')](_0x428c5d,_0x5a3da2)){if(_[_0xccb2('0x1c')](this['variables'][_0x26f6c5])){this['variables'][_0x26f6c5]={};}this[_0xccb2('0xe')][_0x26f6c5][_0x5a3da2]=_0x5a0973;}};VoiceDialReport[_0xccb2('0x1a')][_0xccb2('0x19')]=function(_0x30de5d){try{if(this['isNotNull'](_0x30de5d)){logger[_0xccb2('0x2d')]('[%s][voiceDialReport][hangup]\x20event:',_0x30de5d['uniqueid'],util[_0xccb2('0x20')](_0x30de5d,{'showHidden':![],'depth':null}));if(this[_0xccb2('0xa')][_0x30de5d[_0xccb2('0x1f')]]){logger[_0xccb2('0x2a')](_0xccb2('0x57'),_0x30de5d[_0xccb2('0x1f')],_0x30de5d['cause-txt']);this['channels'][_0x30de5d['uniqueid']][_0xccb2('0x58')]=moment()[_0xccb2('0x22')](_0xccb2('0x23'));this[_0xccb2('0xa')][_0x30de5d[_0xccb2('0x1f')]][_0xccb2('0x59')]=moment(this[_0xccb2('0xa')][_0x30de5d[_0xccb2('0x1f')]][_0xccb2('0x58')])[_0xccb2('0x5a')](this[_0xccb2('0xa')][_0x30de5d['uniqueid']][_0xccb2('0x5b')],_0xccb2('0x5c'));this[_0xccb2('0xa')][_0x30de5d[_0xccb2('0x1f')]]['lastevent']=_0xccb2('0x5d');this[_0xccb2('0xc')][_0xccb2('0x5e')]+=0x1;if(this[_0xccb2('0xa')][_0x30de5d['uniqueid']][_0xccb2('0x38')]){this['outbound'][_0xccb2('0x5f')]+=0x1;this['channels'][_0x30de5d[_0xccb2('0x1f')]]['holdtime']=moment(this[_0xccb2('0xa')][_0x30de5d[_0xccb2('0x1f')]]['answertime'])[_0xccb2('0x5a')](this[_0xccb2('0xa')][_0x30de5d[_0xccb2('0x1f')]]['starttime'],_0xccb2('0x5c'));this[_0xccb2('0xa')][_0x30de5d[_0xccb2('0x1f')]][_0xccb2('0x60')]=moment(this[_0xccb2('0xa')][_0x30de5d['uniqueid']]['endtime'])['diff'](this[_0xccb2('0xa')][_0x30de5d[_0xccb2('0x1f')]]['answertime'],_0xccb2('0x5c'));this['outbound'][_0xccb2('0x61')]+=this[_0xccb2('0xa')][_0x30de5d[_0xccb2('0x1f')]]['holdtime']||0x0;this[_0xccb2('0xc')]['sumBillable']+=this[_0xccb2('0xa')][_0x30de5d['uniqueid']][_0xccb2('0x60')];}this[_0xccb2('0xc')][_0xccb2('0x62')]+=this['channels'][_0x30de5d['uniqueid']][_0xccb2('0x59')];logger[_0xccb2('0x2d')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x30de5d['uniqueid'],util[_0xccb2('0x20')](this[_0xccb2('0xa')][_0x30de5d[_0xccb2('0x1f')]],{'showHidden':![],'depth':null}));ami[_0xccb2('0x1d')]('custom:voiceDialReport',this['channels'][_0x30de5d[_0xccb2('0x1f')]]);logger[_0xccb2('0x2d')](_0xccb2('0x63'),_0x30de5d['uniqueid'],util[_0xccb2('0x20')](this[_0xccb2('0xa')][_0x30de5d[_0xccb2('0x1f')]],{'showHidden':![],'depth':null}));ami[_0xccb2('0x1d')]('custom:dialend',this['channels'][_0x30de5d[_0xccb2('0x1f')]]);logger[_0xccb2('0x2d')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x30de5d[_0xccb2('0x1f')],util['inspect'](this[_0xccb2('0xa')][_0x30de5d['uniqueid']],{'showHidden':![],'depth':null}));this[_0xccb2('0x1d')](_0xccb2('0x64'),_0xccb2('0x65'),this[_0xccb2('0xc')]);logger[_0xccb2('0x2a')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0xccb2('0x66')](this['channels'][_0x30de5d[_0xccb2('0x1f')]]));logger[_0xccb2('0x2d')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x30de5d[_0xccb2('0x1f')],util['inspect'](this['channels'][_0x30de5d[_0xccb2('0x1f')]],{'showHidden':![],'depth':null}));this[_0xccb2('0x1d')]('voice:outbound',_0xccb2('0x67'),this[_0xccb2('0xa')][_0x30de5d['uniqueid']]);delete this[_0xccb2('0xa')][_0x30de5d['uniqueid']];}else if(this[_0xccb2('0xa')][_0x30de5d[_0xccb2('0x68')]]){this['channels'][_0x30de5d[_0xccb2('0x68')]][_0xccb2('0x1f')]=this[_0xccb2('0xa')][_0x30de5d[_0xccb2('0x68')]]['destuniqueid'];}if(this[_0xccb2('0xe')][_0x30de5d[_0xccb2('0x1f')]]){delete this[_0xccb2('0xe')][_0x30de5d[_0xccb2('0x1f')]];}}}catch(_0x316958){logger['error']('[%s][voiceDialReport][hangup]',_0x30de5d[_0xccb2('0x1f')],util[_0xccb2('0x20')](_0x316958,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncNewExten']=function(_0x9a5886){try{if(this[_0xccb2('0x1b')](_0x9a5886)){logger[_0xccb2('0x2d')](_0xccb2('0x69'),_0x9a5886[_0xccb2('0x1f')],util['inspect'](_0x9a5886,{'showHidden':![],'depth':null}));if(_0x9a5886['application'][_0xccb2('0x6a')]()===_0xccb2('0x6b')){_0x9a5886[_0xccb2('0x6c')]=(_0x9a5886['appdata']||_0x9a5886[_0xccb2('0x6c')])[_0xccb2('0x6a')]();if(_[_0xccb2('0x6d')](_0x9a5886[_0xccb2('0x6c')],'cdr(')){if(_[_0xccb2('0x1c')](this['applications'][_0x9a5886[_0xccb2('0x1f')]]))this[_0xccb2('0xd')][_0x9a5886['uniqueid']]={};logger[_0xccb2('0x2a')](_0xccb2('0x6e'),_0x9a5886[_0xccb2('0x1f')],_0x9a5886[_0xccb2('0x6f')],_0x9a5886[_0xccb2('0x6c')]);var _0x4f4ef7=_0x9a5886[_0xccb2('0x6c')][_0xccb2('0x70')]('=');var _0x3978d9=_0x4f4ef7[0x0][_0xccb2('0x71')](/cdr\((.*)\)/);if(_0x3978d9)this[_0xccb2('0xd')][_0x9a5886['uniqueid']][_0x3978d9[0x1]]=_0x4f4ef7[0x1];}}}}catch(_0xc0b542){logger[_0xccb2('0x32')](_0xccb2('0x72'),_0x9a5886[_0xccb2('0x1f')],util['inspect'](_0xc0b542,{'showHidden':![],'depth':null}));}};module[_0xccb2('0x73')]=VoiceDialReport; \ No newline at end of file +var _0xa0c8=['includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','diff','starttime','seconds','answered','billableseconds','sumHoldTime','holdtime','sumBillable','sumDuration','duration','[%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','voice_outbound_channel:remove','linkedid','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','application','set','applicationdata','appdata','startsWith','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','moment','util','ioredis','../../../config/environment','ami','../ami','defaults','localhost','socket.io-emitter','redis','channels','outboundChannels','outbound','applications','variables','bind','varset','syncVarSet','newexten','syncNewExten','hangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','voice:outbound','inspect','custom:dialbegin','[%s][voiceDialReport][dialbegin]','syncDialEnd','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','error','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','variable','value','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','outboundrouteid','keys','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberrealtime','isNil'];(function(_0x21f931,_0x598b2d){var _0x3f083c=function(_0x1c7c49){while(--_0x1c7c49){_0x21f931['push'](_0x21f931['shift']());}};_0x3f083c(++_0x598b2d);}(_0xa0c8,0x184));var _0x8a0c=function(_0x128443,_0x2fe025){_0x128443=_0x128443-0x0;var _0x1a4ce1=_0xa0c8[_0x128443];return _0x1a4ce1;};'use strict';var _=require('lodash');var moment=require(_0x8a0c('0x0'));var util=require(_0x8a0c('0x1'));var Redis=require(_0x8a0c('0x2'));var config=require(_0x8a0c('0x3'));var logger=require('../../../config/logger')(_0x8a0c('0x4'));var ami=require(_0x8a0c('0x5'));config['redis']=_[_0x8a0c('0x6')](config['redis'],{'host':_0x8a0c('0x7'),'port':0x18eb});var io=require(_0x8a0c('0x8'))(new Redis(config[_0x8a0c('0x9')]));function VoiceDialReport(_0xfb13ed){this[_0x8a0c('0xa')]=_0xfb13ed[_0x8a0c('0xb')];this[_0x8a0c('0xc')]=_0xfb13ed['outbound'];this[_0x8a0c('0xd')]={};this[_0x8a0c('0xe')]={};ami['on']('dialbegin',this['syncDialBegin'][_0x8a0c('0xf')](this));ami['on']('dialend',this['syncDialEnd'][_0x8a0c('0xf')](this));ami['on'](_0x8a0c('0x10'),this[_0x8a0c('0x11')][_0x8a0c('0xf')](this));ami['on'](_0x8a0c('0x12'),this[_0x8a0c('0x13')][_0x8a0c('0xf')](this));ami['on'](_0x8a0c('0x14'),this['syncHangup'][_0x8a0c('0xf')](this));}VoiceDialReport[_0x8a0c('0x15')][_0x8a0c('0x16')]=function(_0x2e26ca){return _0x2e26ca!==null&&!_[_0x8a0c('0x17')](_0x2e26ca);};VoiceDialReport[_0x8a0c('0x15')]['emit']=function(_0x303c8d,_0x20ec0b,_0x388c03){io['to'](_0x303c8d)[_0x8a0c('0x18')](_0x20ec0b,_0x388c03);};VoiceDialReport[_0x8a0c('0x15')]['syncDialBegin']=function(_0x2c0fde){try{if(this[_0x8a0c('0x16')](_0x2c0fde)){logger[_0x8a0c('0x19')](_0x8a0c('0x1a'),_0x2c0fde[_0x8a0c('0x1b')],util['inspect'](_0x2c0fde,{'showHidden':![],'depth':null}));if(this['channels'][_0x2c0fde[_0x8a0c('0x1b')]]){_[_0x8a0c('0x1c')](this[_0x8a0c('0xa')][_0x2c0fde[_0x8a0c('0x1b')]],{'starttime':moment()[_0x8a0c('0x1d')](_0x8a0c('0x1e')),'lastevent':_0x8a0c('0x1f'),'interface':_0x2c0fde['channel']['substring'](0x0,_0x2c0fde[_0x8a0c('0x20')]['lastIndexOf']('-')),'membername':_0x2c0fde['channel'][_0x8a0c('0x21')](_0x2c0fde[_0x8a0c('0x20')][_0x8a0c('0x22')]('/')+0x1,_0x2c0fde[_0x8a0c('0x20')]['lastIndexOf']('-'))},_[_0x8a0c('0x23')](_0x2c0fde,[_0x8a0c('0x24'),_0x8a0c('0x25')]));logger[_0x8a0c('0x26')](_0x8a0c('0x27'),_0x2c0fde[_0x8a0c('0x1b')],this['channels'][_0x2c0fde[_0x8a0c('0x1b')]][_0x8a0c('0x28')],this[_0x8a0c('0xa')][_0x2c0fde['uniqueid']][_0x8a0c('0x29')]);logger[_0x8a0c('0x19')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x2c0fde[_0x8a0c('0x1b')],util['inspect'](this[_0x8a0c('0xa')][_0x2c0fde[_0x8a0c('0x1b')]],{'showHidden':![],'depth':null}));if(this['applications'][_0x2c0fde[_0x8a0c('0x1b')]])_[_0x8a0c('0x1c')](this[_0x8a0c('0xa')][_0x2c0fde[_0x8a0c('0x1b')]],this[_0x8a0c('0xd')][_0x2c0fde['uniqueid']]);this['emit'](_0x8a0c('0x2a'),'voice_outbound_channel:save',this[_0x8a0c('0xa')][_0x2c0fde[_0x8a0c('0x1b')]]);logger[_0x8a0c('0x19')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x2c0fde[_0x8a0c('0x1b')],util[_0x8a0c('0x2b')](this[_0x8a0c('0xa')][_0x2c0fde['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x8a0c('0x18')](_0x8a0c('0x2c'),this[_0x8a0c('0xa')][_0x2c0fde[_0x8a0c('0x1b')]]);}}}catch(_0x230d58){logger['error'](_0x8a0c('0x2d'),_0x2c0fde[_0x8a0c('0x1b')],util[_0x8a0c('0x2b')](_0x230d58,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x8a0c('0x2e')]=function(_0x48daa8){try{if(this['isNotNull'](_0x48daa8)){logger[_0x8a0c('0x19')]('[%s][voiceDialReport][dialend]\x20event:',_0x48daa8[_0x8a0c('0x1b')],util[_0x8a0c('0x2b')](_0x48daa8,{'showHidden':![],'depth':null}));if(this['channels'][_0x48daa8[_0x8a0c('0x1b')]]){this['channels'][_0x48daa8[_0x8a0c('0x1b')]][_0x8a0c('0x2f')]=_0x48daa8[_0x8a0c('0x2f')];if(_0x48daa8[_0x8a0c('0x2f')]===_0x8a0c('0x30')){this[_0x8a0c('0xa')][_0x48daa8[_0x8a0c('0x1b')]][_0x8a0c('0x31')]=_0x48daa8[_0x8a0c('0x31')];this[_0x8a0c('0xa')][_0x48daa8[_0x8a0c('0x1b')]][_0x8a0c('0x32')]=_0x48daa8[_0x8a0c('0x32')];this[_0x8a0c('0xa')][_0x48daa8['uniqueid']][_0x8a0c('0x33')]=moment()[_0x8a0c('0x1d')](_0x8a0c('0x1e'));this[_0x8a0c('0xa')][_0x48daa8['uniqueid']][_0x8a0c('0x34')]='connect';logger[_0x8a0c('0x26')]('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x48daa8[_0x8a0c('0x1b')],_0x48daa8[_0x8a0c('0x20')]['substring'](_0x48daa8[_0x8a0c('0x20')][_0x8a0c('0x22')]('/')+0x1,_0x48daa8[_0x8a0c('0x20')][_0x8a0c('0x22')]('-')));logger[_0x8a0c('0x19')](_0x8a0c('0x35'),_0x48daa8[_0x8a0c('0x1b')],util[_0x8a0c('0x2b')](this[_0x8a0c('0xa')][_0x48daa8[_0x8a0c('0x1b')]],{'showHidden':![],'depth':null}));ami[_0x8a0c('0x18')](_0x8a0c('0x36'),this['channels'][_0x48daa8[_0x8a0c('0x1b')]]);}logger[_0x8a0c('0x19')](_0x8a0c('0x37'),_0x48daa8[_0x8a0c('0x1b')],util[_0x8a0c('0x2b')](this[_0x8a0c('0xa')][_0x48daa8[_0x8a0c('0x1b')]],{'showHidden':![],'depth':null}));this[_0x8a0c('0x18')](_0x8a0c('0x2a'),'voice_outbound_channel:save',this[_0x8a0c('0xa')][_0x48daa8[_0x8a0c('0x1b')]]);}}}catch(_0x16a6fc){logger[_0x8a0c('0x38')](_0x8a0c('0x39'),_0x48daa8[_0x8a0c('0x1b')],util[_0x8a0c('0x2b')](_0x16a6fc,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8a0c('0x15')][_0x8a0c('0x11')]=function(_0x589d81){try{if(this[_0x8a0c('0x16')](_0x589d81)){logger[_0x8a0c('0x19')](_0x8a0c('0x3a'),_0x589d81[_0x8a0c('0x1b')],util['inspect'](_0x589d81,{'showHidden':![],'depth':null}));this[_0x8a0c('0x3b')](_0x589d81[_0x8a0c('0x1b')],_['keys'](_0x589d81[_0x8a0c('0x3c')])[0x0],_0x589d81[_0x8a0c('0x3d')]);if(this['isNotNull'](_0x589d81[_0x8a0c('0x3c')])&&this[_0x8a0c('0x16')](_0x589d81['variable']['outboundrouteid'])){if(_['isUndefined'](this['channels'][_0x589d81[_0x8a0c('0x1b')]])){this[_0x8a0c('0xa')][_0x589d81[_0x8a0c('0x1b')]]={'routeId':_0x589d81[_0x8a0c('0x3d')],'variables':this[_0x8a0c('0xe')][_0x589d81[_0x8a0c('0x1b')]],'motionChannel':_0x8a0c('0x3e')};logger[_0x8a0c('0x26')](_0x8a0c('0x3f'),_0x589d81[_0x8a0c('0x1b')],_0x589d81[_0x8a0c('0x3c')][_0x8a0c('0x40')],_[_0x8a0c('0x41')](_0x589d81['variable'])[0x0],_0x589d81[_0x8a0c('0x3d')]);logger['debug'](_0x8a0c('0x42'),_0x589d81['uniqueid'],util['inspect'](this['channels'][_0x589d81['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0x8a0c('0x2a'),_0x8a0c('0x43'),this[_0x8a0c('0xa')][_0x589d81[_0x8a0c('0x1b')]]);}}}}catch(_0x2e9bd9){logger[_0x8a0c('0x38')](_0x8a0c('0x44'),_0x589d81[_0x8a0c('0x1b')],util[_0x8a0c('0x2b')](_0x2e9bd9,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x8a0c('0x3b')]=function(_0x2109d6,_0x49e2ac,_0x57e3ae){var _0x40a43a=[_0x8a0c('0x45'),_0x8a0c('0x46'),_0x8a0c('0x47'),_0x8a0c('0x48'),_0x8a0c('0x49'),_0x8a0c('0x4a'),_0x8a0c('0x4b'),_0x8a0c('0x4c'),_0x8a0c('0x4d'),'sipuri',_0x8a0c('0x4e'),_0x8a0c('0x4f'),_0x8a0c('0x50'),'memberdynamic',_0x8a0c('0x51'),'memberlastcall',_0x8a0c('0x28'),'memberpenalty',_0x8a0c('0x52')];if(!_[_0x8a0c('0x53')](_0x49e2ac)&&!_[_0x8a0c('0x54')](_0x40a43a,_0x49e2ac)){if(_[_0x8a0c('0x17')](this[_0x8a0c('0xe')][_0x2109d6])){this['variables'][_0x2109d6]={};}this['variables'][_0x2109d6][_0x49e2ac]=_0x57e3ae;}};VoiceDialReport[_0x8a0c('0x15')]['syncHangup']=function(_0x504b55){try{if(this['isNotNull'](_0x504b55)){logger['debug'](_0x8a0c('0x55'),_0x504b55[_0x8a0c('0x1b')],util['inspect'](_0x504b55,{'showHidden':![],'depth':null}));if(this[_0x8a0c('0xa')][_0x504b55[_0x8a0c('0x1b')]]){logger[_0x8a0c('0x26')](_0x8a0c('0x56'),_0x504b55[_0x8a0c('0x1b')],_0x504b55[_0x8a0c('0x57')]);this[_0x8a0c('0xa')][_0x504b55[_0x8a0c('0x1b')]][_0x8a0c('0x58')]=moment()[_0x8a0c('0x1d')](_0x8a0c('0x1e'));this['channels'][_0x504b55['uniqueid']]['duration']=moment(this['channels'][_0x504b55['uniqueid']][_0x8a0c('0x58')])[_0x8a0c('0x59')](this[_0x8a0c('0xa')][_0x504b55[_0x8a0c('0x1b')]][_0x8a0c('0x5a')],_0x8a0c('0x5b'));this[_0x8a0c('0xa')][_0x504b55[_0x8a0c('0x1b')]][_0x8a0c('0x34')]='complete';this[_0x8a0c('0xc')]['total']+=0x1;if(this['channels'][_0x504b55['uniqueid']][_0x8a0c('0x33')]){this[_0x8a0c('0xc')][_0x8a0c('0x5c')]+=0x1;this[_0x8a0c('0xa')][_0x504b55[_0x8a0c('0x1b')]]['holdtime']=moment(this[_0x8a0c('0xa')][_0x504b55[_0x8a0c('0x1b')]][_0x8a0c('0x33')])[_0x8a0c('0x59')](this[_0x8a0c('0xa')][_0x504b55[_0x8a0c('0x1b')]][_0x8a0c('0x5a')],_0x8a0c('0x5b'));this[_0x8a0c('0xa')][_0x504b55[_0x8a0c('0x1b')]][_0x8a0c('0x5d')]=moment(this[_0x8a0c('0xa')][_0x504b55[_0x8a0c('0x1b')]]['endtime'])[_0x8a0c('0x59')](this['channels'][_0x504b55[_0x8a0c('0x1b')]][_0x8a0c('0x33')],_0x8a0c('0x5b'));this[_0x8a0c('0xc')][_0x8a0c('0x5e')]+=this['channels'][_0x504b55['uniqueid']][_0x8a0c('0x5f')]||0x0;this[_0x8a0c('0xc')][_0x8a0c('0x60')]+=this[_0x8a0c('0xa')][_0x504b55[_0x8a0c('0x1b')]]['billableseconds'];}this[_0x8a0c('0xc')][_0x8a0c('0x61')]+=this[_0x8a0c('0xa')][_0x504b55[_0x8a0c('0x1b')]][_0x8a0c('0x62')];logger[_0x8a0c('0x19')](_0x8a0c('0x63'),_0x504b55['uniqueid'],util[_0x8a0c('0x2b')](this[_0x8a0c('0xa')][_0x504b55[_0x8a0c('0x1b')]],{'showHidden':![],'depth':null}));ami[_0x8a0c('0x18')](_0x8a0c('0x64'),this['channels'][_0x504b55[_0x8a0c('0x1b')]]);logger[_0x8a0c('0x19')](_0x8a0c('0x65'),_0x504b55[_0x8a0c('0x1b')],util[_0x8a0c('0x2b')](this[_0x8a0c('0xa')][_0x504b55[_0x8a0c('0x1b')]],{'showHidden':![],'depth':null}));ami['emit'](_0x8a0c('0x66'),this[_0x8a0c('0xa')][_0x504b55[_0x8a0c('0x1b')]]);logger[_0x8a0c('0x19')](_0x8a0c('0x67'),_0x504b55['uniqueid'],util[_0x8a0c('0x2b')](this[_0x8a0c('0xa')][_0x504b55[_0x8a0c('0x1b')]],{'showHidden':![],'depth':null}));this['emit'](_0x8a0c('0x2a'),_0x8a0c('0x68'),this[_0x8a0c('0xc')]);logger[_0x8a0c('0x26')](_0x8a0c('0x69'),JSON[_0x8a0c('0x6a')](this['channels'][_0x504b55['uniqueid']]));logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x504b55[_0x8a0c('0x1b')],util[_0x8a0c('0x2b')](this[_0x8a0c('0xa')][_0x504b55[_0x8a0c('0x1b')]],{'showHidden':![],'depth':null}));this[_0x8a0c('0x18')]('voice:outbound',_0x8a0c('0x6b'),this['channels'][_0x504b55['uniqueid']]);delete this[_0x8a0c('0xa')][_0x504b55[_0x8a0c('0x1b')]];}else if(this[_0x8a0c('0xa')][_0x504b55[_0x8a0c('0x6c')]]){this['channels'][_0x504b55[_0x8a0c('0x6c')]][_0x8a0c('0x1b')]=this[_0x8a0c('0xa')][_0x504b55[_0x8a0c('0x6c')]]['destuniqueid'];}if(this[_0x8a0c('0xe')][_0x504b55[_0x8a0c('0x1b')]]){delete this[_0x8a0c('0xe')][_0x504b55[_0x8a0c('0x1b')]];}}}catch(_0x26a0ef){logger[_0x8a0c('0x38')](_0x8a0c('0x6d'),_0x504b55[_0x8a0c('0x1b')],util['inspect'](_0x26a0ef,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8a0c('0x15')][_0x8a0c('0x13')]=function(_0x160031){try{if(this[_0x8a0c('0x16')](_0x160031)){logger[_0x8a0c('0x19')](_0x8a0c('0x6e'),_0x160031['uniqueid'],util[_0x8a0c('0x2b')](_0x160031,{'showHidden':![],'depth':null}));if(_0x160031[_0x8a0c('0x6f')]['toLowerCase']()===_0x8a0c('0x70')){_0x160031[_0x8a0c('0x71')]=(_0x160031[_0x8a0c('0x72')]||_0x160031[_0x8a0c('0x71')])['toLowerCase']();if(_[_0x8a0c('0x73')](_0x160031[_0x8a0c('0x71')],'cdr(')){if(_[_0x8a0c('0x17')](this[_0x8a0c('0xd')][_0x160031[_0x8a0c('0x1b')]]))this[_0x8a0c('0xd')][_0x160031[_0x8a0c('0x1b')]]={};logger[_0x8a0c('0x26')](_0x8a0c('0x74'),_0x160031[_0x8a0c('0x1b')],_0x160031[_0x8a0c('0x6f')],_0x160031[_0x8a0c('0x71')]);var _0x1b6dc8=_0x160031[_0x8a0c('0x71')][_0x8a0c('0x75')]('=');var _0x2d3c8b=_0x1b6dc8[0x0]['match'](/cdr\((.*)\)/);if(_0x2d3c8b)this[_0x8a0c('0xd')][_0x160031[_0x8a0c('0x1b')]][_0x2d3c8b[0x1]]=_0x1b6dc8[0x1];}}}}catch(_0x1994fd){logger[_0x8a0c('0x38')]('[%s][voiceDialReport][newexten]',_0x160031['uniqueid'],util[_0x8a0c('0x2b')](_0x1994fd,{'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 273abe2..056c599 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 _0xffaa=['rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','includes','[%s][voiceQueueReport][hangup]','length','unmanaged','abandoned','diff','answered','milliseconds','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','sumDuration','cause-txt','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','transferexten','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','transfertype','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','syncMusicOnHoldStop','[%s][voiceQueueReport][musiconholdstop]','mohtime','mohstarttime','syncNewExten','application','set','applicationdata','CDR(routeAlias)','appdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceQueueReport][newexten]','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','queueReports','agents','voiceQueues','flagQueueSummary','campaigns','variables','syncQueueSummary','queuesummarycomplete','syncQueueSummaryComplete','bind','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','newexten','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','hasOwnProperty','originated','isEmpty','talking','pTalking','waiting','queueStatusComplete','channels','switch','isNil','Action','status','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','[FullyBooted]\x20clear\x20realtime','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','voice:queue:%s','voice_queue_presence:save','debug',']\x20sending\x20voice_queue_channel:remove\x20event:','format','name','voice_queue_channel:remove','voice_queue_presence:remove','type','inbound','available','sumBillable','sumHoldTime','total','Trunk','active','callerid','Interval','md5','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','clearZombieChannels','queues','[voiceQueueReport][queues]','queuesummary','then','[voiceQueueReport][queuesummary]','isNotNull','queue','[voiceQueueReport][queuesummary]\x20event:','info','[voiceQueueReport][queuesummary]\x20name:%s','toNumber','callers','loggedin','loggedIn','emitVoiceQueueSummary','custom:queuesummary','[voiceQueueReport][queuesummarycomplete]\x20event:','isUndefined','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','routealias','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','pick','keys','[%s][voiceQueueReport][queuecallerjoin]','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','ABANDONED','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][queuecallerleave]','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','lastAssignedTo','membername','queuecallerexit','queuecallerexitAt','reason','transfer','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','channel','toLowerCase','linkedid','add','seconds','FORWARDTRANSFER','FORWARD','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','addVariable','variable','value','CONTINUE','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','queueposition','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','[%s][voiceQueueReport][varset]','rtpaudioqos'];(function(_0x4f3b84,_0x51cb29){var _0x5b9b93=function(_0x21fa74){while(--_0x21fa74){_0x4f3b84['push'](_0x4f3b84['shift']());}};_0x5b9b93(++_0x51cb29);}(_0xffaa,0x130));var _0xaffa=function(_0x33e820,_0x2f0be2){_0x33e820=_0x33e820-0x0;var _0x1e7638=_0xffaa[_0x33e820];return _0x1e7638;};'use strict';var _=require(_0xaffa('0x0'));var moment=require(_0xaffa('0x1'));var util=require(_0xaffa('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0xaffa('0x3'));var logger=require(_0xaffa('0x4'))(_0xaffa('0x5'));var ami=require(_0xaffa('0x6'));var QueueReport=require(_0xaffa('0x7'));config[_0xaffa('0x8')]=_[_0xaffa('0x9')](config[_0xaffa('0x8')],{'host':_0xaffa('0xa'),'port':0x18eb});var io=require(_0xaffa('0xb'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xaffa('0xc')][_0xaffa('0xd')]=function(_0x10be9f){this[_0xaffa('0xe')]=this['tail']?this[_0xaffa('0xe')]['finally'](_0x10be9f):_0x10be9f();};function VoiceQueueReport(_0x1d5f19){this[_0xaffa('0xf')]=new Sequence();this[_0xaffa('0x10')]={};this['agents']=_0x1d5f19[_0xaffa('0x11')];this['channels']=_0x1d5f19['queueChannels'];this['voiceQueues']=_0x1d5f19[_0xaffa('0x12')];this[_0xaffa('0x13')]=!![];this[_0xaffa('0x14')]=_0x1d5f19['campaigns'];this[_0xaffa('0x15')]={};ami['on']('queuesummary',this[_0xaffa('0x16')]['bind'](this));ami['on'](_0xaffa('0x17'),this[_0xaffa('0x18')][_0xaffa('0x19')](this));ami['on'](_0xaffa('0x1a'),this[_0xaffa('0x1b')][_0xaffa('0x19')](this));ami['on'](_0xaffa('0x1c'),this[_0xaffa('0x1d')]['bind'](this));ami['on'](_0xaffa('0x1e'),this[_0xaffa('0x1f')]['bind'](this));ami['on'](_0xaffa('0x20'),this['syncAgentComplete'][_0xaffa('0x19')](this));ami['on'](_0xaffa('0x21'),this[_0xaffa('0x22')][_0xaffa('0x19')](this));ami['on'](_0xaffa('0x23'),this[_0xaffa('0x24')]['bind'](this));ami['on'](_0xaffa('0x25'),this[_0xaffa('0x26')][_0xaffa('0x19')](this));ami['on'](_0xaffa('0x27'),this[_0xaffa('0x28')][_0xaffa('0x19')](this));ami['on'](_0xaffa('0x29'),this['syncNewExten']['bind'](this));ami['on'](_0xaffa('0x2a'),this[_0xaffa('0x2b')][_0xaffa('0x19')](this));ami['on'](_0xaffa('0x2c'),this['syncMusicOnHoldStop']['bind'](this));ami['on'](_0xaffa('0x2d'),this[_0xaffa('0x2e')]['bind'](this));ami['on'](_0xaffa('0x2f'),this[_0xaffa('0x30')][_0xaffa('0x19')](this));this[_0xaffa('0x31')]();this[_0xaffa('0x32')]();}function clearChannels(_0x2f1320){if(!_['isEmpty'](_0x2f1320)){for(var _0x1b18da in _0x2f1320){if(_0x2f1320[_0xaffa('0x33')](_0x1b18da)){delete _0x2f1320[_0x1b18da];}}}}function clearCampaigns(_0x4b7994){if(!_['isEmpty'](_0x4b7994)){for(var _0x3f0d5a in _0x4b7994){if(_0x4b7994[_0xaffa('0x33')](_0x3f0d5a)){_0x4b7994[_0x3f0d5a][_0xaffa('0x34')]=0x0;}}}}function clearVoiceQueues(_0x28b4e2){if(!_[_0xaffa('0x35')](_0x28b4e2)){for(var _0x411448 in _0x28b4e2){if(_0x28b4e2[_0xaffa('0x33')](_0x411448)){_0x28b4e2[_0x411448][_0xaffa('0x34')]=0x0;_0x28b4e2[_0x411448][_0xaffa('0x36')]=0x0;_0x28b4e2[_0x411448][_0xaffa('0x37')]=0x0;_0x28b4e2[_0x411448][_0xaffa('0x38')]=0x0;_0x28b4e2[_0x411448][_0xaffa('0x39')]=!![];}}}}function clearAgentBooked(_0x560dfb){if(!_['isEmpty'](_0x560dfb)){for(var _0x1fd7f7 in _0x560dfb){if(_0x560dfb[_0xaffa('0x33')](_0x1fd7f7)){_0x560dfb[_0x1fd7f7]['unlockRR']=!![];}}}}VoiceQueueReport['prototype']['clearZombieChannels']=function(){var _0x2c0364=this;for(var _0x38a56b in this[_0xaffa('0x3a')]){if(this['channels'][_0xaffa('0x33')](_0x38a56b)&&!this[_0xaffa('0x3a')][_0x38a56b][_0xaffa('0x3b')]){this[_0xaffa('0xf')][_0xaffa('0xd')](function(){if(!_[_0xaffa('0x3c')](_0x2c0364[_0xaffa('0x3a')][_0x38a56b])){return ami[_0xaffa('0x3d')]({'action':_0xaffa('0x3e'),'channel':_0x2c0364[_0xaffa('0x3a')][_0x38a56b]['channel']})[_0xaffa('0x3f')](function(_0x8a6d5c){if(_0x8a6d5c[_0xaffa('0x40')]===_0xaffa('0x41')){setTimeout(function(){if(_0x2c0364[_0xaffa('0x3a')][_0x38a56b]){delete _0x2c0364[_0xaffa('0x3a')][_0x38a56b];logger[_0xaffa('0x42')](_0xaffa('0x43'),_0x38a56b,util['inspect'](_0x8a6d5c,{'showHidden':![],'depth':null}));}if(_0x2c0364['queueReports'][_0x38a56b]){delete _0x2c0364[_0xaffa('0x10')][_0x38a56b];logger['error']('[%s][voiceQueueReport][checkQueueReport]',_0x38a56b,util[_0xaffa('0x44')](_0x8a6d5c,{'showHidden':![],'depth':null}));}if(_0x2c0364[_0xaffa('0x15')][_0x38a56b]){delete _0x2c0364[_0xaffa('0x15')][_0x38a56b];logger[_0xaffa('0x42')]('[%s][voiceQueueReport][checkVariables]',_0x38a56b,util[_0xaffa('0x44')](_0x8a6d5c,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0xaffa('0xc')]['syncFullyBooted']=function(){logger[_0xaffa('0x42')](_0xaffa('0x45'));clearChannels(this['channels']);this['clearQueueReport'](this[_0xaffa('0x10')]);clearAgentBooked(this[_0xaffa('0x11')]);clearVoiceQueues(this[_0xaffa('0x12')]);clearCampaigns(this[_0xaffa('0x14')]);};VoiceQueueReport[_0xaffa('0xc')]['clearQueueReport']=function(_0x5bdef5){var _0x4102ba=this;if(!_[_0xaffa('0x35')](_0x5bdef5)){for(var _0x574722 in _0x5bdef5){if(_0x5bdef5[_0xaffa('0x33')](_0x574722)){_0x4102ba[_0xaffa('0x46')](_0x5bdef5[_0x574722],_0xaffa('0x47'));delete _0x5bdef5[_0x574722];}}}};VoiceQueueReport[_0xaffa('0xc')][_0xaffa('0x48')]=function(_0x54cd4d,_0xe78179,_0x5ed68f){io['to'](_0x54cd4d)[_0xaffa('0x48')](_0xe78179,_0x5ed68f);};VoiceQueueReport[_0xaffa('0xc')][_0xaffa('0x49')]=function(_0x5e0561,_0x5691f2){logger['debug'](_0xaffa('0x4a')+_0x5691f2+_0xaffa('0x4b'),_0x5e0561[_0xaffa('0x4c')],util['inspect'](_0x5e0561,{'showHidden':![],'depth':null}));this[_0xaffa('0x48')](util['format'](_0xaffa('0x4d'),_0x5e0561['name']),'voice_queue_channel:save',_0x5e0561);io[_0xaffa('0x48')](_0xaffa('0x4e'),_0x5e0561);};VoiceQueueReport[_0xaffa('0xc')][_0xaffa('0x46')]=function(_0x2ca7a5,_0x5876bc){logger[_0xaffa('0x4f')](_0xaffa('0x4a')+_0x5876bc+_0xaffa('0x50'),_0x2ca7a5[_0xaffa('0x4c')],util['inspect'](_0x2ca7a5,{'showHidden':![],'depth':null}));this[_0xaffa('0x48')](util[_0xaffa('0x51')](_0xaffa('0x4d'),_0x2ca7a5[_0xaffa('0x52')]),_0xaffa('0x53'),_0x2ca7a5);io[_0xaffa('0x48')](_0xaffa('0x54'),_0x2ca7a5);};VoiceQueueReport[_0xaffa('0xc')]['emitVoiceQueueSummary']=function(_0x3a4c33,_0x4a98c3){if(_0x3a4c33[_0xaffa('0x55')]===_0xaffa('0x56')){var _0x413af4={'id':_0x3a4c33['id'],'name':_0x3a4c33[_0xaffa('0x52')],'strategy':_0x3a4c33['strategy'],'answered':_0x3a4c33['answered'],'available':_0x3a4c33[_0xaffa('0x57')],'loggedIn':_0x3a4c33['loggedIn'],'pTalking':_0x3a4c33[_0xaffa('0x37')],'sumBillable':_0x3a4c33[_0xaffa('0x58')],'sumDuration':_0x3a4c33['sumDuration'],'sumHoldTime':_0x3a4c33[_0xaffa('0x59')]||0x0,'talking':_0x3a4c33[_0xaffa('0x36')],'total':_0x3a4c33[_0xaffa('0x5a')],'type':_0x3a4c33['type'],'unmanaged':_0x3a4c33['unmanaged'],'abandoned':_0x3a4c33['abandoned'],'waiting':_0x3a4c33[_0xaffa('0x38')]};if(_0x3a4c33['Trunk']){_0x413af4[_0xaffa('0x5b')]={'id':_0x3a4c33[_0xaffa('0x5b')]['id'],'name':_0x3a4c33[_0xaffa('0x5b')]['name'],'active':_0x3a4c33[_0xaffa('0x5b')][_0xaffa('0x5c')],'callerid':_0x3a4c33[_0xaffa('0x5b')][_0xaffa('0x5d')]};}if(_0x3a4c33[_0xaffa('0x5e')]){_0x413af4['Interval']={'id':_0x3a4c33[_0xaffa('0x5e')]['id'],'name':_0x3a4c33[_0xaffa('0x5e')]['name']};}var _0x5b2a50=md5(JSON['stringify'](_0x413af4));if(_0x3a4c33[_0xaffa('0x5f')]!==_0x5b2a50){_0x3a4c33[_0xaffa('0x5f')]=_0x5b2a50;logger[_0xaffa('0x4f')](_0xaffa('0x60')+_0x4a98c3+_0xaffa('0x61'),util['inspect'](_0x413af4,{'showHidden':![],'depth':null}));this[_0xaffa('0x48')](util[_0xaffa('0x51')](_0xaffa('0x4d'),_0x413af4[_0xaffa('0x52')]),_0xaffa('0x62'),_0x413af4);}}};VoiceQueueReport[_0xaffa('0xc')]['isNotNull']=function(_0x2a1d62){return _0x2a1d62!==null&&!_['isUndefined'](_0x2a1d62);};VoiceQueueReport[_0xaffa('0xc')][_0xaffa('0x32')]=function(){var _0x4da6ad=this;setInterval(function(){_0x4da6ad[_0xaffa('0x63')]();ami['Action']({'action':_0xaffa('0x64')})[_0xaffa('0x3f')](function(_0x5226c9){logger[_0xaffa('0x42')](_0xaffa('0x65'),util[_0xaffa('0x44')](_0x5226c9,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport['prototype'][_0xaffa('0x31')]=function(){var _0x4db695=this;setInterval(function(){if(_0x4db695['flagQueueSummary']){return ami[_0xaffa('0x3d')]({'action':_0xaffa('0x66')})[_0xaffa('0x67')](function(_0x4af4a8){_0x4db695[_0xaffa('0x13')]=![];})[_0xaffa('0x3f')](function(_0x2af65c){logger[_0xaffa('0x42')](_0xaffa('0x68'),util['inspect'](_0x2af65c,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0xaffa('0xc')][_0xaffa('0x16')]=function(_0x1822e8){try{if(this[_0xaffa('0x69')](_0x1822e8)&&this[_0xaffa('0x69')](_0x1822e8[_0xaffa('0x6a')])){logger[_0xaffa('0x4f')](_0xaffa('0x6b'),util[_0xaffa('0x44')](_0x1822e8,{'showHidden':![],'depth':null}));if(this[_0xaffa('0x12')][_0x1822e8[_0xaffa('0x6a')]]){logger[_0xaffa('0x6c')](_0xaffa('0x6d'),_0x1822e8[_0xaffa('0x6a')]);var _0x5376e6=_['countBy'](this[_0xaffa('0x3a')],_0xaffa('0x6a'))[_0x1822e8[_0xaffa('0x6a')]]||0x0;var _0x3b5588=_0x5376e6-_0x1822e8['callers'];if(this[_0xaffa('0x12')][_0x1822e8[_0xaffa('0x6a')]][_0xaffa('0x38')]!==_[_0xaffa('0x6e')](_0x1822e8[_0xaffa('0x6f')])||this[_0xaffa('0x12')][_0x1822e8[_0xaffa('0x6a')]]['loggedIn']!==_[_0xaffa('0x6e')](_0x1822e8[_0xaffa('0x70')])||this['voiceQueues'][_0x1822e8['queue']][_0xaffa('0x57')]!==_[_0xaffa('0x6e')](_0x1822e8[_0xaffa('0x57')])||this[_0xaffa('0x12')][_0x1822e8['queue']]['talking']!==_0x3b5588){this[_0xaffa('0x12')][_0x1822e8['queue']][_0xaffa('0x38')]=_[_0xaffa('0x6e')](_0x1822e8[_0xaffa('0x6f')]);this[_0xaffa('0x12')][_0x1822e8[_0xaffa('0x6a')]][_0xaffa('0x71')]=_[_0xaffa('0x6e')](_0x1822e8[_0xaffa('0x70')]);this[_0xaffa('0x12')][_0x1822e8[_0xaffa('0x6a')]][_0xaffa('0x57')]=_[_0xaffa('0x6e')](_0x1822e8[_0xaffa('0x57')]);this[_0xaffa('0x12')][_0x1822e8['queue']]['talking']=_0x3b5588>0x0?_0x3b5588:0x0;this[_0xaffa('0x12')][_0x1822e8[_0xaffa('0x6a')]][_0xaffa('0x36')]=this[_0xaffa('0x12')][_0x1822e8['queue']]['talking']>_[_0xaffa('0x6e')](_0x1822e8[_0xaffa('0x70')])?_[_0xaffa('0x6e')](_0x1822e8['loggedin']):this[_0xaffa('0x12')][_0x1822e8[_0xaffa('0x6a')]][_0xaffa('0x36')];this[_0xaffa('0x72')](this['voiceQueues'][_0x1822e8[_0xaffa('0x6a')]],_0xaffa('0x66'));}logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0xaffa('0x44')](this[_0xaffa('0x12')][_0x1822e8[_0xaffa('0x6a')]],{'showHidden':![],'depth':null}));ami[_0xaffa('0x48')](_0xaffa('0x73'),this[_0xaffa('0x12')][_0x1822e8[_0xaffa('0x6a')]]);}}}catch(_0x245b28){logger[_0xaffa('0x42')]('[voiceQueueReport][queuesummary]',util[_0xaffa('0x44')](_0x245b28,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaffa('0xc')][_0xaffa('0x18')]=function(_0x5a028a){logger['debug'](_0xaffa('0x74'),util[_0xaffa('0x44')](_0x5a028a,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport[_0xaffa('0xc')][_0xaffa('0x1b')]=function(_0x46f44d){try{if(this[_0xaffa('0x69')](_0x46f44d)){logger[_0xaffa('0x4f')]('[%s][voiceQueueReport][queuecallerjoin]',_0x46f44d[_0xaffa('0x4c')],util[_0xaffa('0x44')](_0x46f44d,{'showHidden':![],'depth':null}));if(_[_0xaffa('0x75')](this['queueReports'][_0x46f44d['uniqueid']]))this[_0xaffa('0x10')][_0x46f44d['uniqueid']]=[];if(_['isUndefined'](this[_0xaffa('0x3a')][_0x46f44d[_0xaffa('0x4c')]]))this[_0xaffa('0x3a')][_0x46f44d[_0xaffa('0x4c')]]={};var _0x135b41=new QueueReport();_0x135b41[_0xaffa('0x52')]=_0x46f44d[_0xaffa('0x6a')];_0x135b41[_0xaffa('0x55')]=this['voiceQueues'][_0x135b41[_0xaffa('0x52')]]&&this[_0xaffa('0x12')][_0x135b41[_0xaffa('0x52')]]['type']?this[_0xaffa('0x12')][_0x135b41['name']][_0xaffa('0x55')]||_0xaffa('0x56'):_0xaffa('0x56');_0x135b41[_0xaffa('0x6a')]=_0x46f44d[_0xaffa('0x6a')];_0x135b41[_0xaffa('0x76')]=moment()[_0xaffa('0x51')](_0xaffa('0x77'));_0x135b41[_0xaffa('0x78')]=_0x46f44d['position'];_0x135b41['count']=_0x46f44d[_0xaffa('0x79')];_0x135b41[_0xaffa('0x4c')]=_0x46f44d[_0xaffa('0x4c')];_0x135b41[_0xaffa('0x7a')]=this[_0xaffa('0x3a')][_0x46f44d[_0xaffa('0x4c')]]['routealias'];logger[_0xaffa('0x6c')](_0xaffa('0x7b'),_0x135b41[_0xaffa('0x52')],_0x135b41[_0xaffa('0x55')]);_[_0xaffa('0x7c')](_0x135b41,_[_0xaffa('0x7d')](_0x46f44d,_[_0xaffa('0x7e')](_0x135b41)));this[_0xaffa('0x10')][_0x46f44d[_0xaffa('0x4c')]]['push'](_0x135b41);this[_0xaffa('0x3a')][_0x46f44d[_0xaffa('0x4c')]]=_0x135b41;this[_0xaffa('0x49')](_0x135b41,'queuecallerjoin');}}catch(_0x3ea954){logger['error'](_0xaffa('0x7f'),_0x46f44d[_0xaffa('0x4c')],util[_0xaffa('0x44')](_0x3ea954,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0x1c3075){try{if(this[_0xaffa('0x69')](_0x1c3075)){logger[_0xaffa('0x4f')](_0xaffa('0x80'),_0x1c3075[_0xaffa('0x4c')],util[_0xaffa('0x44')](_0x1c3075,{'showHidden':![],'depth':null}));if(this[_0xaffa('0x10')][_0x1c3075['uniqueid']]){var _0x576832=_[_0xaffa('0x81')](this[_0xaffa('0x10')][_0x1c3075[_0xaffa('0x4c')]]);_0x576832[_0xaffa('0x82')]=![];_0x576832[_0xaffa('0x83')]=null;_0x576832[_0xaffa('0x84')]=_0x1c3075[_0xaffa('0x84')];_0x576832[_0xaffa('0x85')]=_0x1c3075[_0xaffa('0x85')];_0x576832[_0xaffa('0x1c')]=!![];_0x576832[_0xaffa('0x86')]=moment()[_0xaffa('0x51')](_0xaffa('0x77'));_0x576832[_0xaffa('0x87')]=_0xaffa('0x88');_0x576832['lastAssignedTo']=null;logger[_0xaffa('0x6c')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x576832[_0xaffa('0x52')],_0x576832[_0xaffa('0x55')]);this[_0xaffa('0x3a')][_0x1c3075['uniqueid']]=_0x576832;this[_0xaffa('0x46')](_0x576832,_0xaffa('0x1c'));}}}catch(_0x26ed78){logger[_0xaffa('0x42')](_0xaffa('0x80'),_0x1c3075[_0xaffa('0x4c')],util['inspect'](_0x26ed78,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaffa('0xc')][_0xaffa('0x1f')]=function(_0x41b7f4){try{if(this['isNotNull'](_0x41b7f4)){logger[_0xaffa('0x4f')]('[%s][voiceQueueReport][queuecallerleave]',_0x41b7f4[_0xaffa('0x4c')],util[_0xaffa('0x44')](_0x41b7f4,{'showHidden':![],'depth':null}));if(this[_0xaffa('0x10')][_0x41b7f4[_0xaffa('0x4c')]]){var _0x1934a9=_[_0xaffa('0x81')](this[_0xaffa('0x10')][_0x41b7f4[_0xaffa('0x4c')]]);_0x1934a9[_0xaffa('0x89')]=moment()[_0xaffa('0x51')](_0xaffa('0x77'));_0x1934a9[_0xaffa('0x8a')]=_0x41b7f4[_0xaffa('0x8a')];_0x1934a9[_0xaffa('0x8b')]=_0x41b7f4[_0xaffa('0x8b')];logger[_0xaffa('0x6c')](_0xaffa('0x8c'),_0x1934a9[_0xaffa('0x52')],_0x1934a9[_0xaffa('0x55')],_0x41b7f4[_0xaffa('0x8a')],_0x41b7f4[_0xaffa('0x8b')]);this[_0xaffa('0x3a')][_0x41b7f4[_0xaffa('0x4c')]]=_0x1934a9;this[_0xaffa('0x49')](_0x1934a9,'queuecallerleave');}}}catch(_0x426826){logger[_0xaffa('0x42')](_0xaffa('0x8d'),_0x41b7f4[_0xaffa('0x4c')],util[_0xaffa('0x44')](_0x426826,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaffa('0xc')][_0xaffa('0x22')]=function(_0x2d401d){try{if(this['isNotNull'](_0x2d401d)){logger[_0xaffa('0x4f')](_0xaffa('0x8e'),_0x2d401d[_0xaffa('0x4c')],util['inspect'](_0x2d401d,{'showHidden':![],'depth':null}));if(this[_0xaffa('0x10')][_0x2d401d[_0xaffa('0x4c')]]){var _0xd98922=_[_0xaffa('0x81')](this[_0xaffa('0x10')][_0x2d401d[_0xaffa('0x4c')]]);_0xd98922['queuecallercomplete']=!![];_0xd98922[_0xaffa('0x87')]=_0xaffa('0x8f');logger[_0xaffa('0x6c')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0xd98922[_0xaffa('0x52')],_0xd98922['type']);}}}catch(_0x330a4b){logger[_0xaffa('0x42')](_0xaffa('0x8e'),_0x2d401d[_0xaffa('0x4c')],util[_0xaffa('0x44')](_0x330a4b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaffa('0xc')]['syncAgentComplete']=function(_0xc63f0e){try{if(this[_0xaffa('0x69')](_0xc63f0e)){logger[_0xaffa('0x4f')](_0xaffa('0x90'),_0xc63f0e[_0xaffa('0x4c')],util['inspect'](_0xc63f0e,{'showHidden':![],'depth':null}));if(this[_0xaffa('0x10')][_0xc63f0e[_0xaffa('0x4c')]]){var _0x2d9db3=_[_0xaffa('0x81')](this[_0xaffa('0x10')][_0xc63f0e[_0xaffa('0x4c')]]);_0x2d9db3[_0xaffa('0x1c')]=![];_0x2d9db3['queuecallerabandonAt']=null;_0x2d9db3['assigned']=!![];_0x2d9db3[_0xaffa('0x91')]=_0xc63f0e[_0xaffa('0x92')];_0x2d9db3[_0xaffa('0x84')]=_0xc63f0e[_0xaffa('0x84')];_0x2d9db3[_0xaffa('0x82')]=!![];_0x2d9db3[_0xaffa('0x93')]=![];_0x2d9db3[_0xaffa('0x94')]=null;if(!_0x2d9db3['transfer']){if(_0xc63f0e[_0xaffa('0x95')]==_0xaffa('0x96')){_0x2d9db3[_0xaffa('0x87')]=_0xaffa('0x97');logger[_0xaffa('0x6c')](_0xaffa('0x98'),_0x2d9db3['name'],_0x2d9db3['type']);}else{if(_[_0xaffa('0x99')](_0xc63f0e[_0xaffa('0x9a')][_0xaffa('0x9b')](),'local/')){if(this['queueReports'][_0xc63f0e[_0xaffa('0x9c')]]){var _0x523c73=_[_0xaffa('0x81')](this[_0xaffa('0x10')][_0xc63f0e[_0xaffa('0x9c')]]);_0x523c73[_0xaffa('0x82')]=![];_0x523c73[_0xaffa('0x93')]=!![];_0x523c73[_0xaffa('0x94')]=moment(_0x2d9db3[_0xaffa('0x76')])[_0xaffa('0x9d')](_0xc63f0e[_0xaffa('0x84')],_0xaffa('0x9e'))[_0xaffa('0x51')](_0xaffa('0x77'));_0x523c73[_0xaffa('0x87')]=_0xaffa('0x9f');_0x523c73['transfer']=!![];_0x523c73['transfertype']=_0xaffa('0xa0');_0x523c73['transferexten']=_0xc63f0e[_0xaffa('0xa1')];_0x523c73[_0xaffa('0xa2')]=_0xc63f0e[_0xaffa('0x4c')];logger[_0xaffa('0x6c')](_0xaffa('0xa3'),_0x523c73['name'],_0x523c73[_0xaffa('0x55')]);var _0x480dd0=this[_0xaffa('0x10')][_0xc63f0e[_0xaffa('0x9c')]];this['queueReports'][_0xc63f0e[_0xaffa('0x9c')]]=this[_0xaffa('0x10')][_0xc63f0e[_0xaffa('0x4c')]];this[_0xaffa('0x10')][_0xc63f0e[_0xaffa('0x4c')]]=_0x480dd0;}}else{_0x2d9db3[_0xaffa('0x87')]=_0xaffa('0xa4')+_0xc63f0e['reason'][_0xaffa('0xa5')]();logger[_0xaffa('0x6c')](_0xaffa('0xa6'),_0x2d9db3['name'],_0x2d9db3[_0xaffa('0x55')],_0x2d9db3[_0xaffa('0x87')]);}}}this[_0xaffa('0x3a')][_0xc63f0e['uniqueid']]=_0x2d9db3;this[_0xaffa('0x46')](_0x2d9db3,_0xaffa('0x20'));}}}catch(_0x15862d){logger['error'](_0xaffa('0x90'),_0xc63f0e[_0xaffa('0x4c')],util['inspect'](_0x15862d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaffa('0xc')][_0xaffa('0x24')]=function(_0xb2b241){try{if(this[_0xaffa('0x69')](_0xb2b241)){logger[_0xaffa('0x4f')]('[%s][voiceQueueReport][varset]',_0xb2b241[_0xaffa('0x4c')],util[_0xaffa('0x44')](_0xb2b241,{'showHidden':![],'depth':null}));this[_0xaffa('0xa7')](_0xb2b241[_0xaffa('0x4c')],_[_0xaffa('0x7e')](_0xb2b241[_0xaffa('0xa8')])[0x0],_0xb2b241[_0xaffa('0xa9')]);if(this['queueReports'][_0xb2b241[_0xaffa('0x4c')]]){var _0x454ffb=_['last'](this[_0xaffa('0x10')][_0xb2b241[_0xaffa('0x4c')]]);if(_0x454ffb){if(this['isNotNull'](_0xb2b241[_0xaffa('0xa8')])&&this[_0xaffa('0x69')](_0xb2b241[_0xaffa('0xa8')]['queuestatus'])){switch(_0xb2b241[_0xaffa('0xa9')]){case _0xaffa('0xaa'):_0x454ffb[_0xaffa('0x93')]=![];_0x454ffb[_0xaffa('0x94')]=null;break;case'TIMEOUT':_0x454ffb[_0xaffa('0xab')]=_0xaffa('0xac');_0x454ffb[_0xaffa('0x93')]=!![];_0x454ffb['queuecallerexitAt']=moment()[_0xaffa('0x51')](_0xaffa('0x77'));_0x454ffb['queuecallerleaveAt']=moment()[_0xaffa('0x51')](_0xaffa('0x77'));logger[_0xaffa('0x4f')](_0xaffa('0xad'),_0xb2b241['uniqueid'],util[_0xaffa('0x44')](_0x454ffb,{'showHidden':![],'depth':null}));ami[_0xaffa('0x48')]('custom:timeout',_0x454ffb);break;default:_0x454ffb[_0xaffa('0x93')]=!![];_0x454ffb[_0xaffa('0x94')]=moment()[_0xaffa('0x51')](_0xaffa('0x77'));_0x454ffb[_0xaffa('0x89')]=moment()['format'](_0xaffa('0x77'));}_0x454ffb[_0xaffa('0x1c')]=![];_0x454ffb['queuecallerabandonAt']=null;_0x454ffb[_0xaffa('0x87')]=_0xb2b241[_0xaffa('0xa9')];this[_0xaffa('0x3a')][_0xb2b241[_0xaffa('0x4c')]]=_0x454ffb;this['emitVoiceQueueChannelRemove'](_0x454ffb,_0xaffa('0x23'));}else if(this[_0xaffa('0x69')](_0xb2b241['variable'])&&this[_0xaffa('0x69')](_0xb2b241['variable'][_0xaffa('0xae')])){if(!_0x454ffb['queuecallerabandon']){_0x454ffb[_0xaffa('0x93')]=!![];_0x454ffb[_0xaffa('0x94')]=moment()[_0xaffa('0x51')](_0xaffa('0x77'));_0x454ffb['queuecallerexitreason']='EXITWITHKEY';_0x454ffb[_0xaffa('0x89')]=moment()['format'](_0xaffa('0x77'));this[_0xaffa('0x3a')][_0xb2b241[_0xaffa('0x4c')]]=_0x454ffb;}}logger[_0xaffa('0x6c')](_0xaffa('0xaf'),_0xb2b241[_0xaffa('0x4c')],_0x454ffb['name'],_0x454ffb[_0xaffa('0x55')],_[_0xaffa('0x7e')](_0xb2b241['variable'])[0x0],_0xb2b241[_0xaffa('0xa9')]);_0x454ffb['variables']=this[_0xaffa('0x15')][_0xb2b241[_0xaffa('0x4c')]];}}}}catch(_0x247c4d){logger['error'](_0xaffa('0xb0'),_0xb2b241['uniqueid'],util[_0xaffa('0x44')](_0x247c4d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaffa('0xc')][_0xaffa('0xa7')]=function(_0x1c6bff,_0x5f512d,_0x2575a4){var _0x37beca=[_0xaffa('0xb1'),_0xaffa('0xb2'),_0xaffa('0xb3'),'rtpaudioqosjitterbridged',_0xaffa('0xb4'),_0xaffa('0xb5'),_0xaffa('0xb6'),'rtpaudioqosrttbridged',_0xaffa('0xb7'),_0xaffa('0xb8'),_0xaffa('0xb9'),_0xaffa('0xba'),_0xaffa('0xbb'),'memberdynamic',_0xaffa('0xbc'),_0xaffa('0xbd'),_0xaffa('0x92'),_0xaffa('0xbe'),'memberrealtime'];if(!_['isNil'](_0x5f512d)&&!_[_0xaffa('0xbf')](_0x37beca,_0x5f512d)){if(_[_0xaffa('0x75')](this[_0xaffa('0x15')][_0x1c6bff])){this['variables'][_0x1c6bff]={};}this[_0xaffa('0x15')][_0x1c6bff][_0x5f512d]=_0x2575a4;}};VoiceQueueReport[_0xaffa('0xc')][_0xaffa('0x26')]=function(_0x60d24){try{if(this[_0xaffa('0x69')](_0x60d24)){logger[_0xaffa('0x4f')](_0xaffa('0xc0'),_0x60d24[_0xaffa('0x4c')],util[_0xaffa('0x44')](_0x60d24,{'showHidden':![],'depth':null}));if(this[_0xaffa('0x10')][_0x60d24[_0xaffa('0x4c')]]){for(var _0xe95914=0x0,_0x489552={};_0xe959140x0?_0xb545af:0x0;this[_0x9e9f('0x11')][_0x50b7f9['queue']][_0x9e9f('0x2f')]=this['voiceQueues'][_0x50b7f9[_0x9e9f('0x64')]][_0x9e9f('0x2f')]>_[_0x9e9f('0x67')](_0x50b7f9[_0x9e9f('0x68')])?_[_0x9e9f('0x67')](_0x50b7f9[_0x9e9f('0x68')]):this[_0x9e9f('0x11')][_0x50b7f9[_0x9e9f('0x64')]]['talking'];this[_0x9e9f('0x6a')](this[_0x9e9f('0x11')][_0x50b7f9[_0x9e9f('0x64')]],_0x9e9f('0x15'));}logger[_0x9e9f('0x47')](_0x9e9f('0x6b'),util[_0x9e9f('0x3e')](this[_0x9e9f('0x11')][_0x50b7f9['queue']],{'showHidden':![],'depth':null}));ami['emit'](_0x9e9f('0x6c'),this['voiceQueues'][_0x50b7f9['queue']]);}}}catch(_0x314e91){logger[_0x9e9f('0x3c')]('[voiceQueueReport][queuesummary]',util['inspect'](_0x314e91,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9e9f('0xa')][_0x9e9f('0x6d')]=function(_0x490cfb){logger[_0x9e9f('0x47')](_0x9e9f('0x6e'),util[_0x9e9f('0x3e')](_0x490cfb,{'showHidden':![],'depth':null}));this[_0x9e9f('0x12')]=!![];};VoiceQueueReport[_0x9e9f('0xa')][_0x9e9f('0x19')]=function(_0x487aea){try{if(this[_0x9e9f('0x6f')](_0x487aea)){logger[_0x9e9f('0x47')](_0x9e9f('0x70'),_0x487aea[_0x9e9f('0x4d')],util['inspect'](_0x487aea,{'showHidden':![],'depth':null}));if(_[_0x9e9f('0x71')](this[_0x9e9f('0x3f')][_0x487aea[_0x9e9f('0x4d')]]))this[_0x9e9f('0x3f')][_0x487aea[_0x9e9f('0x4d')]]=[];if(_[_0x9e9f('0x71')](this[_0x9e9f('0x10')][_0x487aea[_0x9e9f('0x4d')]]))this['channels'][_0x487aea[_0x9e9f('0x4d')]]={};var _0x24e705=new QueueReport();_0x24e705[_0x9e9f('0x4b')]=_0x487aea[_0x9e9f('0x64')];_0x24e705[_0x9e9f('0x56')]=this[_0x9e9f('0x11')][_0x24e705[_0x9e9f('0x4b')]]&&this['voiceQueues'][_0x24e705[_0x9e9f('0x4b')]][_0x9e9f('0x56')]?this[_0x9e9f('0x11')][_0x24e705[_0x9e9f('0x4b')]][_0x9e9f('0x56')]||'inbound':_0x9e9f('0x4f');_0x24e705[_0x9e9f('0x64')]=_0x487aea[_0x9e9f('0x64')];_0x24e705[_0x9e9f('0x72')]=moment()[_0x9e9f('0x49')](_0x9e9f('0x73'));_0x24e705[_0x9e9f('0x74')]=_0x487aea[_0x9e9f('0x74')];_0x24e705[_0x9e9f('0x75')]=_0x487aea[_0x9e9f('0x75')];_0x24e705[_0x9e9f('0x4d')]=_0x487aea[_0x9e9f('0x4d')];_0x24e705[_0x9e9f('0x76')]=this[_0x9e9f('0x10')][_0x487aea[_0x9e9f('0x4d')]][_0x9e9f('0x76')];logger[_0x9e9f('0x77')](_0x9e9f('0x78'),_0x24e705['name'],_0x24e705[_0x9e9f('0x56')]);_[_0x9e9f('0x79')](_0x24e705,_[_0x9e9f('0x7a')](_0x487aea,_[_0x9e9f('0x7b')](_0x24e705)));this[_0x9e9f('0x3f')][_0x487aea[_0x9e9f('0x4d')]][_0x9e9f('0x7c')](_0x24e705);this[_0x9e9f('0x10')][_0x487aea['uniqueid']]=_0x24e705;this['emitVoiceQueueChannelSave'](_0x24e705,_0x9e9f('0x18'));}}catch(_0x1fc592){logger[_0x9e9f('0x3c')](_0x9e9f('0x70'),_0x487aea['uniqueid'],util['inspect'](_0x1fc592,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9e9f('0xa')][_0x9e9f('0x1b')]=function(_0x3976fb){try{if(this['isNotNull'](_0x3976fb)){logger[_0x9e9f('0x47')]('[%s][voiceQueueReport][queuecallerabandon]',_0x3976fb['uniqueid'],util[_0x9e9f('0x3e')](_0x3976fb,{'showHidden':![],'depth':null}));if(this[_0x9e9f('0x3f')][_0x3976fb[_0x9e9f('0x4d')]]){var _0x44f6bb=_[_0x9e9f('0x7d')](this[_0x9e9f('0x3f')][_0x3976fb[_0x9e9f('0x4d')]]);_0x44f6bb[_0x9e9f('0x7e')]=![];_0x44f6bb['queuecallercompleteAt']=null;_0x44f6bb[_0x9e9f('0x7f')]=_0x3976fb[_0x9e9f('0x7f')];_0x44f6bb[_0x9e9f('0x80')]=_0x3976fb['originalposition'];_0x44f6bb[_0x9e9f('0x1a')]=!![];_0x44f6bb[_0x9e9f('0x81')]=moment()['format'](_0x9e9f('0x73'));_0x44f6bb['queuecallerexitreason']=_0x9e9f('0x82');_0x44f6bb[_0x9e9f('0x83')]=null;logger[_0x9e9f('0x77')](_0x9e9f('0x84'),_0x44f6bb['name'],_0x44f6bb[_0x9e9f('0x56')]);this[_0x9e9f('0x10')][_0x3976fb['uniqueid']]=_0x44f6bb;this[_0x9e9f('0x43')](_0x44f6bb,_0x9e9f('0x1a'));}}}catch(_0x3eac91){logger[_0x9e9f('0x3c')](_0x9e9f('0x85'),_0x3976fb[_0x9e9f('0x4d')],util[_0x9e9f('0x3e')](_0x3eac91,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9e9f('0xa')][_0x9e9f('0x86')]=function(_0x4d211a){try{if(this[_0x9e9f('0x6f')](_0x4d211a)){logger[_0x9e9f('0x47')](_0x9e9f('0x87'),_0x4d211a[_0x9e9f('0x4d')],util[_0x9e9f('0x3e')](_0x4d211a,{'showHidden':![],'depth':null}));if(this[_0x9e9f('0x3f')][_0x4d211a[_0x9e9f('0x4d')]]){var _0x38f004=_['last'](this[_0x9e9f('0x3f')][_0x4d211a[_0x9e9f('0x4d')]]);_0x38f004[_0x9e9f('0x88')]=moment()[_0x9e9f('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x38f004[_0x9e9f('0x89')]=_0x4d211a[_0x9e9f('0x89')];_0x38f004[_0x9e9f('0x8a')]=_0x4d211a[_0x9e9f('0x8a')];logger[_0x9e9f('0x77')](_0x9e9f('0x8b'),_0x38f004[_0x9e9f('0x4b')],_0x38f004[_0x9e9f('0x56')],_0x4d211a[_0x9e9f('0x89')],_0x4d211a['connectedlinename']);this['channels'][_0x4d211a[_0x9e9f('0x4d')]]=_0x38f004;this['emitVoiceQueueChannelSave'](_0x38f004,_0x9e9f('0x1c'));}}}catch(_0x4c24bf){logger['error']('[%s][voiceQueueReport][queuecallerleave]',_0x4d211a[_0x9e9f('0x4d')],util[_0x9e9f('0x3e')](_0x4c24bf,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9e9f('0x1e')]=function(_0x47b903){try{if(this[_0x9e9f('0x6f')](_0x47b903)){logger['debug'](_0x9e9f('0x8c'),_0x47b903['uniqueid'],util[_0x9e9f('0x3e')](_0x47b903,{'showHidden':![],'depth':null}));if(this[_0x9e9f('0x3f')][_0x47b903[_0x9e9f('0x4d')]]){var _0xecd93a=_[_0x9e9f('0x7d')](this['queueReports'][_0x47b903[_0x9e9f('0x4d')]]);_0xecd93a['queuecallercomplete']=!![];_0xecd93a[_0x9e9f('0x8d')]=_0x9e9f('0x8e');logger[_0x9e9f('0x77')](_0x9e9f('0x8f'),_0xecd93a[_0x9e9f('0x4b')],_0xecd93a[_0x9e9f('0x56')]);}}}catch(_0x328abe){logger[_0x9e9f('0x3c')](_0x9e9f('0x8c'),_0x47b903[_0x9e9f('0x4d')],util[_0x9e9f('0x3e')](_0x328abe,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9e9f('0xa')][_0x9e9f('0x90')]=function(_0x416b33){try{if(this[_0x9e9f('0x6f')](_0x416b33)){logger[_0x9e9f('0x47')]('[%s][voiceQueueReport][agentcomplete]',_0x416b33[_0x9e9f('0x4d')],util[_0x9e9f('0x3e')](_0x416b33,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x416b33['uniqueid']]){var _0x6b7722=_[_0x9e9f('0x7d')](this[_0x9e9f('0x3f')][_0x416b33[_0x9e9f('0x4d')]]);_0x6b7722[_0x9e9f('0x1a')]=![];_0x6b7722['queuecallerabandonAt']=null;_0x6b7722[_0x9e9f('0x91')]=!![];_0x6b7722['lastAssignedTo']=_0x416b33['membername'];_0x6b7722[_0x9e9f('0x7f')]=_0x416b33[_0x9e9f('0x7f')];_0x6b7722[_0x9e9f('0x7e')]=!![];_0x6b7722[_0x9e9f('0x92')]=![];_0x6b7722['queuecallerexitAt']=null;if(!_0x6b7722['transfer']){if(_0x416b33[_0x9e9f('0x93')]==_0x9e9f('0x94')){_0x6b7722[_0x9e9f('0x8d')]=_0x9e9f('0x95');logger[_0x9e9f('0x77')](_0x9e9f('0x96'),_0x6b7722[_0x9e9f('0x4b')],_0x6b7722[_0x9e9f('0x56')]);}else{if(_[_0x9e9f('0x97')](_0x416b33['channel'][_0x9e9f('0x98')](),'local/')){if(this[_0x9e9f('0x3f')][_0x416b33['linkedid']]){var _0x1933a8=_['last'](this[_0x9e9f('0x3f')][_0x416b33[_0x9e9f('0x99')]]);_0x1933a8[_0x9e9f('0x7e')]=![];_0x1933a8['queuecallerexit']=!![];_0x1933a8[_0x9e9f('0x9a')]=moment(_0x6b7722[_0x9e9f('0x72')])['add'](_0x416b33[_0x9e9f('0x7f')],'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1933a8[_0x9e9f('0x8d')]=_0x9e9f('0x9b');_0x1933a8[_0x9e9f('0x94')]=!![];_0x1933a8[_0x9e9f('0x9c')]=_0x9e9f('0x9d');_0x1933a8[_0x9e9f('0x9e')]=_0x416b33[_0x9e9f('0x9f')];_0x1933a8[_0x9e9f('0xa0')]=_0x416b33['uniqueid'];logger[_0x9e9f('0x77')](_0x9e9f('0xa1'),_0x1933a8[_0x9e9f('0x4b')],_0x1933a8[_0x9e9f('0x56')]);var _0x550d31=this['queueReports'][_0x416b33['linkedid']];this[_0x9e9f('0x3f')][_0x416b33[_0x9e9f('0x99')]]=this[_0x9e9f('0x3f')][_0x416b33[_0x9e9f('0x4d')]];this[_0x9e9f('0x3f')][_0x416b33['uniqueid']]=_0x550d31;}}else{_0x6b7722[_0x9e9f('0x8d')]=_0x9e9f('0xa2')+_0x416b33[_0x9e9f('0x93')][_0x9e9f('0xa3')]();logger['info'](_0x9e9f('0xa4'),_0x6b7722[_0x9e9f('0x4b')],_0x6b7722['type'],_0x6b7722[_0x9e9f('0x8d')]);}}}this['channels'][_0x416b33[_0x9e9f('0x4d')]]=_0x6b7722;this[_0x9e9f('0x43')](_0x6b7722,_0x9e9f('0xa5'));}}}catch(_0x11934d){logger[_0x9e9f('0x3c')]('[%s][voiceQueueReport][agentcomplete]',_0x416b33[_0x9e9f('0x4d')],util[_0x9e9f('0x3e')](_0x11934d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9e9f('0xa')]['syncVarSet']=function(_0x4eeeb7){try{if(this[_0x9e9f('0x6f')](_0x4eeeb7)){logger[_0x9e9f('0x47')](_0x9e9f('0xa6'),_0x4eeeb7[_0x9e9f('0x4d')],util[_0x9e9f('0x3e')](_0x4eeeb7,{'showHidden':![],'depth':null}));this['addVariable'](_0x4eeeb7[_0x9e9f('0x4d')],_[_0x9e9f('0x7b')](_0x4eeeb7[_0x9e9f('0xa7')])[0x0],_0x4eeeb7[_0x9e9f('0xa8')]);if(this['queueReports'][_0x4eeeb7[_0x9e9f('0x4d')]]){var _0x511df4=_[_0x9e9f('0x7d')](this[_0x9e9f('0x3f')][_0x4eeeb7[_0x9e9f('0x4d')]]);if(_0x511df4){if(this[_0x9e9f('0x6f')](_0x4eeeb7[_0x9e9f('0xa7')])&&this[_0x9e9f('0x6f')](_0x4eeeb7[_0x9e9f('0xa7')][_0x9e9f('0xa9')])){switch(_0x4eeeb7['value']){case'CONTINUE':_0x511df4[_0x9e9f('0x92')]=![];_0x511df4[_0x9e9f('0x9a')]=null;break;case _0x9e9f('0xaa'):_0x511df4[_0x9e9f('0xab')]='timeout';_0x511df4['queuecallerexit']=!![];_0x511df4[_0x9e9f('0x9a')]=moment()[_0x9e9f('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x511df4[_0x9e9f('0x88')]=moment()[_0x9e9f('0x49')](_0x9e9f('0x73'));logger[_0x9e9f('0x47')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x4eeeb7[_0x9e9f('0x4d')],util[_0x9e9f('0x3e')](_0x511df4,{'showHidden':![],'depth':null}));ami[_0x9e9f('0x45')](_0x9e9f('0xac'),_0x511df4);break;default:_0x511df4[_0x9e9f('0x92')]=!![];_0x511df4['queuecallerexitAt']=moment()[_0x9e9f('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x511df4[_0x9e9f('0x88')]=moment()[_0x9e9f('0x49')](_0x9e9f('0x73'));}_0x511df4[_0x9e9f('0x1a')]=![];_0x511df4[_0x9e9f('0x81')]=null;_0x511df4[_0x9e9f('0x8d')]=_0x4eeeb7[_0x9e9f('0xa8')];this['channels'][_0x4eeeb7[_0x9e9f('0x4d')]]=_0x511df4;this[_0x9e9f('0x43')](_0x511df4,_0x9e9f('0x1f'));}else if(this[_0x9e9f('0x6f')](_0x4eeeb7[_0x9e9f('0xa7')])&&this['isNotNull'](_0x4eeeb7[_0x9e9f('0xa7')][_0x9e9f('0xad')])){if(!_0x511df4[_0x9e9f('0x1a')]){_0x511df4[_0x9e9f('0x92')]=!![];_0x511df4[_0x9e9f('0x9a')]=moment()[_0x9e9f('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x511df4[_0x9e9f('0x8d')]=_0x9e9f('0xae');_0x511df4[_0x9e9f('0x88')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x9e9f('0x10')][_0x4eeeb7[_0x9e9f('0x4d')]]=_0x511df4;}}logger[_0x9e9f('0x77')](_0x9e9f('0xaf'),_0x4eeeb7['uniqueid'],_0x511df4[_0x9e9f('0x4b')],_0x511df4[_0x9e9f('0x56')],_[_0x9e9f('0x7b')](_0x4eeeb7['variable'])[0x0],_0x4eeeb7['value']);_0x511df4[_0x9e9f('0x14')]=this[_0x9e9f('0x14')][_0x4eeeb7[_0x9e9f('0x4d')]];}}}}catch(_0x452112){logger[_0x9e9f('0x3c')]('[%s][voiceQueueReport][varset]',_0x4eeeb7[_0x9e9f('0x4d')],util[_0x9e9f('0x3e')](_0x452112,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9e9f('0xa')][_0x9e9f('0xb0')]=function(_0x438d8d,_0x6bee54,_0x4a6eac){var _0x446940=['rtpaudioqos',_0x9e9f('0xb1'),_0x9e9f('0xb2'),'rtpaudioqosjitterbridged',_0x9e9f('0xb3'),_0x9e9f('0xb4'),_0x9e9f('0xb5'),_0x9e9f('0xb6'),_0x9e9f('0xb7'),_0x9e9f('0xb8'),_0x9e9f('0xb9'),'bridgepvtcallid',_0x9e9f('0xba'),_0x9e9f('0xbb'),_0x9e9f('0xbc'),_0x9e9f('0xbd'),'membername',_0x9e9f('0xbe'),'memberrealtime'];if(!_[_0x9e9f('0xbf')](_0x6bee54)&&!_[_0x9e9f('0xc0')](_0x446940,_0x6bee54)){if(_[_0x9e9f('0x71')](this['variables'][_0x438d8d])){this[_0x9e9f('0x14')][_0x438d8d]={};}this[_0x9e9f('0x14')][_0x438d8d][_0x6bee54]=_0x4a6eac;}};VoiceQueueReport[_0x9e9f('0xa')][_0x9e9f('0x21')]=function(_0x2e5af8){try{if(this['isNotNull'](_0x2e5af8)){logger[_0x9e9f('0x47')]('[%s][voiceQueueReport][hangup]',_0x2e5af8['uniqueid'],util[_0x9e9f('0x3e')](_0x2e5af8,{'showHidden':![],'depth':null}));if(this[_0x9e9f('0x3f')][_0x2e5af8['uniqueid']]){for(var _0xf2bcff=0x0,_0x58590b={};_0xf2bcff=0x0?moment(_0x187e3c[_0xc030('0x1a')])[_0xc030('0x1b')](_0x187e3c['starttime'],_0xc030('0xb')):null,'data1':_0xc030('0x1c'),'data2':_0x187e3c[_0xc030('0x11')],'data3':_0x187e3c[_0xc030('0xe')],'data4':_0x187e3c['dialstring']||null,'role':_0xc030('0x10'),'internal':_0x187e3c[_0xc030('0x11')]?_[_0xc030('0x12')](_0x187e3c[_0xc030('0x11')]):undefined,'uniqueid':_0x187e3c[_0xc030('0x13')]},'log':_0xc030('0x14')});}; \ No newline at end of file +var _0xa399=['queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','lastAssignedTo','isNil','interface','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','agent','toNumber','accountcode','uniqueid','voiceDialReport','voice','endtime','starttime','outbound','dialstring','moment','lodash','../client'];(function(_0x2e6a2d,_0x1bb404){var _0x283b75=function(_0x49482a){while(--_0x49482a){_0x2e6a2d['push'](_0x2e6a2d['shift']());}};_0x283b75(++_0x1bb404);}(_0xa399,0x1e3));var _0x9a39=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa399[_0x3c2a69];return _0x596bc8;};'use strict';var moment=require(_0x9a39('0x0'));var _=require(_0x9a39('0x1'));var util=require('util');var client=require(_0x9a39('0x2'));exports['voiceQueueReport']=function(_0x5d9561){var _0x3a8c20=_0x5d9561[_0x9a39('0x3')]||_0x5d9561[_0x9a39('0x4')];return client[_0x9a39('0x5')](_0x9a39('0x6'),{'body':{'channel':'voice','membername':_0x5d9561[_0x9a39('0x7')],'interface':_[_0x9a39('0x8')](_0x5d9561[_0x9a39('0x9')])?util['format']('SIP/%s',_0x5d9561['lastAssignedTo']):_0x5d9561[_0x9a39('0x9')],'type':_0x9a39('0xa'),'enterAt':_0x5d9561[_0x9a39('0xb')],'exitAt':_0x3a8c20,'duration':moment(_0x3a8c20)[_0x9a39('0xc')](_0x5d9561[_0x9a39('0xb')],_0x9a39('0xd')),'data1':_0x9a39('0xe'),'data2':_0x5d9561[_0x9a39('0xf')],'data3':_0x5d9561[_0x9a39('0x10')],'data4':null,'data5':_0x5d9561['queue'],'role':_0x9a39('0x11'),'internal':_0x5d9561['accountcode']?_[_0x9a39('0x12')](_0x5d9561[_0x9a39('0x13')]):undefined,'uniqueid':_0x5d9561[_0x9a39('0x14')]},'log':_0x9a39('0x6')});};exports[_0x9a39('0x15')]=function(_0x53f5e8){return client[_0x9a39('0x5')](_0x9a39('0x6'),{'body':{'channel':_0x9a39('0x16'),'membername':_0x53f5e8['membername'],'interface':_0x53f5e8[_0x9a39('0x9')],'type':_0x9a39('0xa'),'enterAt':_0x53f5e8['starttime'],'exitAt':_0x53f5e8[_0x9a39('0x17')],'duration':moment(_0x53f5e8[_0x9a39('0x17')])[_0x9a39('0xc')](_0x53f5e8[_0x9a39('0x18')],'seconds')>=0x0?moment(_0x53f5e8[_0x9a39('0x17')])['diff'](_0x53f5e8[_0x9a39('0x18')],_0x9a39('0xd')):null,'data1':_0x9a39('0x19'),'data2':_0x53f5e8[_0x9a39('0x13')],'data3':_0x53f5e8[_0x9a39('0x10')],'data4':_0x53f5e8[_0x9a39('0x1a')]||null,'role':_0x9a39('0x11'),'internal':_0x53f5e8[_0x9a39('0x13')]?_[_0x9a39('0x12')](_0x53f5e8[_0x9a39('0x13')]):undefined,'uniqueid':_0x53f5e8[_0x9a39('0x14')]},'log':_0x9a39('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 1254e28..dd18b68 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 _0xa477=['../client','getSettings','ShowSetting','stopRecordingOnTransfer','GetSettings'];(function(_0x5c5502,_0x47cf47){var _0x359546=function(_0x5b0561){while(--_0x5b0561){_0x5c5502['push'](_0x5c5502['shift']());}};_0x359546(++_0x47cf47);}(_0xa477,0xe6));var _0x7a47=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xa477[_0x3e5086];return _0xfeb102;};'use strict';var client=require(_0x7a47('0x0'));exports[_0x7a47('0x1')]=function(){return client['Request'](_0x7a47('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x7a47('0x3')]},'log':_0x7a47('0x4')});}; \ No newline at end of file +var _0xb7a0=['../client','getSettings','Request','ShowSetting','GetSettings'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb7a0,0x13b));var _0x0b7a=function(_0x6d135,_0x47c7a6){_0x6d135=_0x6d135-0x0;var _0x536c32=_0xb7a0[_0x6d135];return _0x536c32;};'use strict';var client=require(_0x0b7a('0x0'));exports[_0x0b7a('0x1')]=function(){return client[_0x0b7a('0x2')](_0x0b7a('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer']},'log':_0x0b7a('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index cd61df0..2892b30 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 _0x5b97=['Request','GetTemplate'];(function(_0x596dd3,_0x491fc8){var _0x69e45e=function(_0x3a2e67){while(--_0x3a2e67){_0x596dd3['push'](_0x596dd3['shift']());}};_0x69e45e(++_0x491fc8);}(_0x5b97,0xac));var _0x75b9=function(_0x36c6eb,_0x4fb127){_0x36c6eb=_0x36c6eb-0x0;var _0x30675b=_0x5b97[_0x36c6eb];return _0x30675b;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x1f4ea4){return function(_0x6b1a0){return client[_0x75b9('0x0')](_0x75b9('0x1'),{'options':{'raw':!![],'attributes':['id','name','html']},'log':_0x75b9('0x1')});};}; \ No newline at end of file +var _0x365a=['html','../client','getTemplates','name'];(function(_0x555284,_0x247427){var _0x418106=function(_0x51b94b){while(--_0x51b94b){_0x555284['push'](_0x555284['shift']());}};_0x418106(++_0x247427);}(_0x365a,0x18d));var _0xa365=function(_0x153a8b,_0x33e9e3){_0x153a8b=_0x153a8b-0x0;var _0x41d634=_0x365a[_0x153a8b];return _0x41d634;};'use strict';var client=require(_0xa365('0x0'));exports[_0xa365('0x1')]=function(_0x13bde0){return function(_0x19edc8){return client['Request']('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xa365('0x2'),_0xa365('0x3')]},'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 f45ccf4..6ab72f9 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 _0xf36c=['getTriggers','Request','GetTrigger','channel','AllConditions','field','operator','value','Condition','AnyConditions','Action','Actions','action','data2','data3','data5','data6','data7'];(function(_0x2718c7,_0x5a1636){var _0x59d89c=function(_0x4d4f49){while(--_0x4d4f49){_0x2718c7['push'](_0x2718c7['shift']());}};_0x59d89c(++_0x5a1636);}(_0xf36c,0x90));var _0xcf36=function(_0x2f2210,_0x4e02ed){_0x2f2210=_0x2f2210-0x0;var _0x57aae3=_0xf36c[_0x2f2210];return _0x57aae3;};'use strict';var client=require('../client');exports[_0xcf36('0x0')]=function(_0x23ac24){return function(_0xa895b){return client[_0xcf36('0x1')](_0xcf36('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xcf36('0x3'),'status'],'include':[{'model':'Condition','as':_0xcf36('0x4'),'attributes':['id',_0xcf36('0x5'),_0xcf36('0x6'),_0xcf36('0x7')]},{'model':_0xcf36('0x8'),'as':_0xcf36('0x9'),'attributes':['id',_0xcf36('0x5'),'operator',_0xcf36('0x7')]},{'model':_0xcf36('0xa'),'as':_0xcf36('0xb'),'attributes':['id',_0xcf36('0xc'),'data1',_0xcf36('0xd'),_0xcf36('0xe'),'data4',_0xcf36('0xf'),_0xcf36('0x10'),_0xcf36('0x11')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x222a=['data2','data3','data4','data5','data6','data7','GetTrigger','../client','getTriggers','Request','name','channel','status','AllConditions','field','operator','Condition','AnyConditions','value','Action','action'];(function(_0x97b111,_0x2733e8){var _0x5e478d=function(_0x35473e){while(--_0x35473e){_0x97b111['push'](_0x97b111['shift']());}};_0x5e478d(++_0x2733e8);}(_0x222a,0x157));var _0xa222=function(_0x1a6e3b,_0x13340f){_0x1a6e3b=_0x1a6e3b-0x0;var _0x5c3a74=_0x222a[_0x1a6e3b];return _0x5c3a74;};'use strict';var client=require(_0xa222('0x0'));exports[_0xa222('0x1')]=function(_0x51e33a){return function(_0x5073eb){return client[_0xa222('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xa222('0x3'),_0xa222('0x4'),_0xa222('0x5')],'include':[{'model':'Condition','as':_0xa222('0x6'),'attributes':['id',_0xa222('0x7'),_0xa222('0x8'),'value']},{'model':_0xa222('0x9'),'as':_0xa222('0xa'),'attributes':['id',_0xa222('0x7'),_0xa222('0x8'),_0xa222('0xb')]},{'model':_0xa222('0xc'),'as':'Actions','attributes':['id',_0xa222('0xd'),'data1',_0xa222('0xe'),_0xa222('0xf'),_0xa222('0x10'),_0xa222('0x11'),_0xa222('0x12'),_0xa222('0x13')]}]},'log':_0xa222('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index e714ae8..d5e4100 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 _0xccb9=['registry','defaultuser','../client','Request','GetTrunk'];(function(_0x42fcf1,_0x65ee17){var _0x5af641=function(_0x4f0c44){while(--_0x4f0c44){_0x42fcf1['push'](_0x42fcf1['shift']());}};_0x5af641(++_0x65ee17);}(_0xccb9,0x124));var _0x9ccb=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xccb9[_0x39096d];return _0x13da4f;};'use strict';var client=require(_0x9ccb('0x0'));exports['getTrunks']=function(_0x2f856e){return function(_0x313fa1){return client[_0x9ccb('0x1')](_0x9ccb('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x9ccb('0x3'),_0x9ccb('0x4')]},'log':_0x9ccb('0x2')});};}; \ No newline at end of file +var _0x2d83=['name','registry','../client','getTrunks','Request','GetTrunk'];(function(_0x2a2f51,_0x2c76cf){var _0x53d7c4=function(_0x3309b3){while(--_0x3309b3){_0x2a2f51['push'](_0x2a2f51['shift']());}};_0x53d7c4(++_0x2c76cf);}(_0x2d83,0x1dc));var _0x32d8=function(_0x56838e,_0x7b2eaf){_0x56838e=_0x56838e-0x0;var _0x36c438=_0x2d83[_0x56838e];return _0x36c438;};'use strict';var client=require(_0x32d8('0x0'));exports[_0x32d8('0x1')]=function(_0x198863){return function(_0x179e3d){return client[_0x32d8('0x2')](_0x32d8('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x32d8('0x4'),_0x32d8('0x5'),'defaultuser']},'log':_0x32d8('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index a83f950..e97e2be 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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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 _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x4b388f,_0x923e8a){var _0x5a2671=function(_0x2b5968){while(--_0x2b5968){_0x4b388f['push'](_0x4b388f['shift']());}};_0x5a2671(++_0x923e8a);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index ac81b58..258bb4f 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 _0x9cf2=['CreateVoiceAgentReport','Request','UpdateVoiceAgentReport','../client','create'];(function(_0x2e04ef,_0x31a596){var _0x5722b0=function(_0x386fbd){while(--_0x386fbd){_0x2e04ef['push'](_0x2e04ef['shift']());}};_0x5722b0(++_0x31a596);}(_0x9cf2,0x13e));var _0x29cf=function(_0x367492,_0x1941d8){_0x367492=_0x367492-0x0;var _0x4e7f9d=_0x9cf2[_0x367492];return _0x4e7f9d;};'use strict';var client=require(_0x29cf('0x0'));exports[_0x29cf('0x1')]=function(_0xda381d){return client['Request']('CreateVoiceAgentReport',{'body':_0xda381d,'log':_0x29cf('0x2')});};exports['update']=function(_0x2c1930,_0x5efa2c,_0x321fa8){return client[_0x29cf('0x3')](_0x29cf('0x4'),{'body':_0x2c1930,'options':{'where':{'uniqueid':_0x5efa2c,'interface':_0x321fa8,'agentcomplete':!![]}},'log':_0x29cf('0x4')});}; \ No newline at end of file +var _0xf4eb=['create','Request','CreateVoiceAgentReport','update'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0xf4eb,0x174));var _0xbf4e=function(_0x3717ba,_0xd9971a){_0x3717ba=_0x3717ba-0x0;var _0x21d1d6=_0xf4eb[_0x3717ba];return _0x21d1d6;};'use strict';var client=require('../client');exports[_0xbf4e('0x0')]=function(_0x5c13f4){return client[_0xbf4e('0x1')](_0xbf4e('0x2'),{'body':_0x5c13f4,'log':_0xbf4e('0x2')});};exports[_0xbf4e('0x3')]=function(_0x362abf,_0x9c1c2b,_0x594186){return client[_0xbf4e('0x1')]('UpdateVoiceAgentReport',{'body':_0x362abf,'options':{'where':{'uniqueid':_0x9c1c2b,'interface':_0x594186,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index f0da29b..75bbe72 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 _0x9ee3=['DOCUMENTATION','GetVoiceCallReport','outbound','startOf','YYYY-MM-DD\x20HH:mm:ss','endOf','format','duration','billableseconds','util','lodash','create','Request','CreateVoiceCallReport','merge','calleridnum','callerid'];(function(_0x2e66ac,_0x5c5ea2){var _0x5d0eee=function(_0x4b8a2d){while(--_0x4b8a2d){_0x2e66ac['push'](_0x2e66ac['shift']());}};_0x5d0eee(++_0x5c5ea2);}(_0x9ee3,0x1b2));var _0x39ee=function(_0x6bcc5b,_0x919609){_0x6bcc5b=_0x6bcc5b-0x0;var _0x228519=_0x9ee3[_0x6bcc5b];return _0x228519;};'use strict';var moment=require('moment');var util=require(_0x39ee('0x0'));var _=require(_0x39ee('0x1'));var client=require('../client');exports[_0x39ee('0x2')]=function(_0x3477c4){return client[_0x39ee('0x3')](_0x39ee('0x4'),{'body':_[_0x39ee('0x5')](_0x3477c4,{'source':_0x3477c4[_0x39ee('0x6')],'destinationcontext':_0x3477c4['context'],'callerid':_0x3477c4[_0x39ee('0x7')],'amaflags':_0x39ee('0x8')}),'log':_0x39ee('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x39ee('0x3')](_0x39ee('0x9'),{'options':{'where':{'type':[_0x39ee('0xa')],'createdAt':{'$between':[moment()[_0x39ee('0xb')]('day')['format'](_0x39ee('0xc')),moment()[_0x39ee('0xd')]('day')[_0x39ee('0xe')](_0x39ee('0xc'))]}},'attributes':['type','disposition',_0x39ee('0xf'),_0x39ee('0x10')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x3d43=['disposition','billableseconds','GetVoiceCallReports','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf'];(function(_0x1373ad,_0x4961a1){var _0x556942=function(_0x324ecb){while(--_0x324ecb){_0x1373ad['push'](_0x1373ad['shift']());}};_0x556942(++_0x4961a1);}(_0x3d43,0xff));var _0x33d4=function(_0x4a6cf8,_0x5534ef){_0x4a6cf8=_0x4a6cf8-0x0;var _0x22205e=_0x3d43[_0x4a6cf8];return _0x22205e;};'use strict';var moment=require('moment');var util=require(_0x33d4('0x0'));var _=require(_0x33d4('0x1'));var client=require(_0x33d4('0x2'));exports[_0x33d4('0x3')]=function(_0x6a734e){return client[_0x33d4('0x4')](_0x33d4('0x5'),{'body':_[_0x33d4('0x6')](_0x6a734e,{'source':_0x6a734e[_0x33d4('0x7')],'destinationcontext':_0x6a734e[_0x33d4('0x8')],'callerid':_0x6a734e[_0x33d4('0x9')],'amaflags':_0x33d4('0xa')}),'log':_0x33d4('0x5')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x33d4('0x4')](_0x33d4('0xb'),{'options':{'where':{'type':[_0x33d4('0xc')],'createdAt':{'$between':[moment()[_0x33d4('0xd')](_0x33d4('0xe'))[_0x33d4('0xf')](_0x33d4('0x10')),moment()[_0x33d4('0x11')]('day')[_0x33d4('0xf')](_0x33d4('0x10'))]}},'attributes':['type',_0x33d4('0x12'),'duration',_0x33d4('0x13')]},'log':_0x33d4('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 11b49ba..c45647d 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 _0xee16=['CreateVoiceDialReport','../client','create','Request'];(function(_0x3094fb,_0x30e138){var _0x42fa9b=function(_0x2c5a55){while(--_0x2c5a55){_0x3094fb['push'](_0x3094fb['shift']());}};_0x42fa9b(++_0x30e138);}(_0xee16,0x181));var _0x6ee1=function(_0x4e90e3,_0x570a1d){_0x4e90e3=_0x4e90e3-0x0;var _0x295e5b=_0xee16[_0x4e90e3];return _0x295e5b;};'use strict';var client=require(_0x6ee1('0x0'));exports[_0x6ee1('0x1')]=function(_0x2a58d5){return client[_0x6ee1('0x2')](_0x6ee1('0x3'),{'body':_0x2a58d5,'log':_0x6ee1('0x3')});}; \ No newline at end of file +var _0x39b9=['CreateVoiceDialReport','create','Request'];(function(_0x101f3c,_0x49e9d0){var _0x2276df=function(_0x54a318){while(--_0x54a318){_0x101f3c['push'](_0x101f3c['shift']());}};_0x2276df(++_0x49e9d0);}(_0x39b9,0x1c0));var _0x939b=function(_0x1180d3,_0x7161b5){_0x1180d3=_0x1180d3-0x0;var _0x1500c8=_0x39b9[_0x1180d3];return _0x1500c8;};'use strict';var client=require('../client');exports[_0x939b('0x0')]=function(_0x78f9aa){return client[_0x939b('0x1')](_0x939b('0x2'),{'body':_0x78f9aa,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 84db896..0f3666e 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 _0x6f0d=['getVoiceExtensions','Request','GetVoiceExtension','exten'];(function(_0x2a851f,_0x202189){var _0xcb44ed=function(_0x6d2019){while(--_0x6d2019){_0x2a851f['push'](_0x2a851f['shift']());}};_0xcb44ed(++_0x202189);}(_0x6f0d,0x16c));var _0xd6f0=function(_0xd5c6ea,_0xc4112a){_0xd5c6ea=_0xd5c6ea-0x0;var _0x371dbd=_0x6f0d[_0xd5c6ea];return _0x371dbd;};'use strict';var client=require('../client');exports[_0xd6f0('0x0')]=function(){return function(){return client[_0xd6f0('0x1')](_0xd6f0('0x2'),{'options':{'raw':!![],'attributes':['id',_0xd6f0('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xd6f0('0x0')});};}; \ No newline at end of file +var _0xc831=['Request','GetVoiceExtension','exten','recordingFormat','getVoiceExtensions'];(function(_0x9a825b,_0x35c63e){var _0x4e5706=function(_0x20e4f2){while(--_0x20e4f2){_0x9a825b['push'](_0x9a825b['shift']());}};_0x4e5706(++_0x35c63e);}(_0xc831,0x103));var _0x1c83=function(_0x35df4d,_0x4b31bf){_0x35df4d=_0x35df4d-0x0;var _0x3ad188=_0xc831[_0x35df4d];return _0x3ad188;};'use strict';var client=require('../client');exports[_0x1c83('0x0')]=function(){return function(){return client[_0x1c83('0x1')](_0x1c83('0x2'),{'options':{'raw':!![],'attributes':['id',_0x1c83('0x3'),_0x1c83('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x1c83('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index df561ad..bb2b9e8 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 _0x4d88=['dialRandomLastDigitCallerIdNumber','dialCutDigit','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMinThreshold','Trunk','active','Pause','mandatoryDispositionPause','TrunkBackup','callerid','Interval','interval','../client','getVoiceQueues','Request','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient'];(function(_0x190c9f,_0x1c29e7){var _0x2151b8=function(_0x157e2c){while(--_0x157e2c){_0x190c9f['push'](_0x190c9f['shift']());}};_0x2151b8(++_0x1c29e7);}(_0x4d88,0x8d));var _0x84d8=function(_0x4b77c1,_0x4c8fdc){_0x4b77c1=_0x4b77c1-0x0;var _0x2a54e6=_0x4d88[_0x4b77c1];return _0x2a54e6;};'use strict';var client=require(_0x84d8('0x0'));exports[_0x84d8('0x1')]=function(){return function(){return client[_0x84d8('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x84d8('0x3'),_0x84d8('0x4'),_0x84d8('0x5'),_0x84d8('0x6'),_0x84d8('0x7'),_0x84d8('0x8'),_0x84d8('0x9'),_0x84d8('0xa'),_0x84d8('0xb'),_0x84d8('0xc'),_0x84d8('0xd'),'dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval',_0x84d8('0xe'),_0x84d8('0xf'),_0x84d8('0x10'),_0x84d8('0x11'),_0x84d8('0x12'),'dialQueueProject',_0x84d8('0x13'),_0x84d8('0x14'),'dialBusyMaxRetry',_0x84d8('0x15'),_0x84d8('0x16'),_0x84d8('0x17'),_0x84d8('0x18'),_0x84d8('0x19'),_0x84d8('0x1a'),_0x84d8('0x1b'),_0x84d8('0x1c'),_0x84d8('0x1d'),_0x84d8('0x1e'),'dialAMDGreeting','dialAMDAfterGreetingSilence',_0x84d8('0x1f'),_0x84d8('0x20'),_0x84d8('0x21'),'dialAMDMaximumNumberOfWords',_0x84d8('0x22'),_0x84d8('0x23'),_0x84d8('0x24'),_0x84d8('0x25'),_0x84d8('0x26'),_0x84d8('0x27'),_0x84d8('0x28'),_0x84d8('0x29'),'dialQueueProject2',_0x84d8('0x7'),'strategy',_0x84d8('0x2a'),_0x84d8('0x2b'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency',_0x84d8('0x2c'),_0x84d8('0x2d'),_0x84d8('0x2e'),_0x84d8('0x2f'),_0x84d8('0x30'),_0x84d8('0x31'),_0x84d8('0x32'),_0x84d8('0x33'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold',_0x84d8('0x34')],'include':[{'model':_0x84d8('0x35'),'as':_0x84d8('0x35'),'attributes':['id',_0x84d8('0x3'),'callerid',_0x84d8('0x36')]},{'model':_0x84d8('0x37'),'as':_0x84d8('0x38'),'attributes':['id',_0x84d8('0x3')]},{'model':_0x84d8('0x35'),'as':_0x84d8('0x39'),'attributes':['id',_0x84d8('0x3'),_0x84d8('0x3a'),_0x84d8('0x36')]},{'model':_0x84d8('0x3b'),'as':_0x84d8('0x3b'),'attributes':['id',_0x84d8('0x3')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x84d8('0x3'),_0x84d8('0x3c')]}]}]},'log':_0x84d8('0x1')});};}; \ No newline at end of file +var _0x2caf=['dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency'];(function(_0x560b33,_0x54a69c){var _0x15c35e=function(_0x58d087){while(--_0x58d087){_0x560b33['push'](_0x560b33['shift']());}};_0x15c35e(++_0x54a69c);}(_0x2caf,0x1d3));var _0xf2ca=function(_0x7654b5,_0x412c96){_0x7654b5=_0x7654b5-0x0;var _0x2d7e01=_0x2caf[_0x7654b5];return _0x2d7e01;};'use strict';var client=require(_0xf2ca('0x0'));exports[_0xf2ca('0x1')]=function(){return function(){return client[_0xf2ca('0x2')](_0xf2ca('0x3'),{'options':{'raw':![],'attributes':['id',_0xf2ca('0x4'),_0xf2ca('0x5'),'acwTimeout',_0xf2ca('0x6'),_0xf2ca('0x7'),'type',_0xf2ca('0x8'),_0xf2ca('0x9'),_0xf2ca('0xa'),_0xf2ca('0xb'),_0xf2ca('0xc'),_0xf2ca('0xd'),_0xf2ca('0xe'),_0xf2ca('0xf'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber',_0xf2ca('0x10'),_0xf2ca('0x11'),_0xf2ca('0x12'),_0xf2ca('0x13'),'dialCongestionMaxRetry',_0xf2ca('0x14'),_0xf2ca('0x15'),_0xf2ca('0x16'),_0xf2ca('0x17'),_0xf2ca('0x18'),_0xf2ca('0x19'),'dialTimezone','dialGlobalInterval',_0xf2ca('0x1a'),'dialCheckDuplicateType',_0xf2ca('0x1b'),_0xf2ca('0x1c'),'dialAMDGreeting',_0xf2ca('0x1d'),'dialAMDTotalAnalysisTime',_0xf2ca('0x1e'),'dialAMDBetweenWordsSilence',_0xf2ca('0x1f'),_0xf2ca('0x20'),'dialAMDMaximumWordLength',_0xf2ca('0x21'),_0xf2ca('0x22'),_0xf2ca('0x23'),_0xf2ca('0x24'),_0xf2ca('0x25'),_0xf2ca('0x26'),_0xf2ca('0x27'),_0xf2ca('0x7'),_0xf2ca('0x28'),_0xf2ca('0x29'),_0xf2ca('0x2a'),_0xf2ca('0x2b'),'dialNoSuchNumberRetryFrequency',_0xf2ca('0x2c'),_0xf2ca('0x2d'),_0xf2ca('0x2e'),'dialAbandonedRetryFrequency',_0xf2ca('0x2f'),_0xf2ca('0x30'),_0xf2ca('0x31'),_0xf2ca('0x32'),_0xf2ca('0x33'),_0xf2ca('0x34'),_0xf2ca('0x35')],'include':[{'model':_0xf2ca('0x36'),'as':_0xf2ca('0x36'),'attributes':['id',_0xf2ca('0x4'),_0xf2ca('0x37'),_0xf2ca('0x38')]},{'model':_0xf2ca('0x39'),'as':_0xf2ca('0x3a'),'attributes':['id','name']},{'model':_0xf2ca('0x36'),'as':_0xf2ca('0x3b'),'attributes':['id','name','callerid','active']},{'model':'Interval','as':_0xf2ca('0x3c'),'attributes':['id',_0xf2ca('0x4')],'include':[{'model':_0xf2ca('0x3c'),'as':'Intervals','attributes':['id',_0xf2ca('0x4'),'interval']}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 086f2b9..67e1191 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(_0xca9a67,_0x59ad83){var _0x48621c=function(_0x14852){while(--_0x14852){_0xca9a67['push'](_0xca9a67['shift']());}};_0x48621c(++_0x59ad83);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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(_0x545994,_0x4a84c7){var _0x5cbbc4=function(_0x4acc36){while(--_0x4acc36){_0x545994['push'](_0x545994['shift']());}};_0x5cbbc4(++_0x4a84c7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 b6ecbd5..5b40dcf 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 _0x3fce=['../client','GetVoiceQueueRtPauses'];(function(_0x4de1b3,_0x5bc6a1){var _0x9ba804=function(_0x49cd76){while(--_0x49cd76){_0x4de1b3['push'](_0x4de1b3['shift']());}};_0x9ba804(++_0x5bc6a1);}(_0x3fce,0x1d0));var _0xe3fc=function(_0x209302,_0x5826ac){_0x209302=_0x209302-0x0;var _0x1df8e9=_0x3fce[_0x209302];return _0x1df8e9;};'use strict';var client=require(_0xe3fc('0x0'));exports['getVoiceQueueRtPauses']=function(_0x4e2ef3){return function(){return client['Request'](_0xe3fc('0x1'),{'options':{'where':{'VoiceQueueId':_0x4e2ef3,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x3ab3=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x425309,_0x14f780){var _0x297cc4=function(_0x48e5cb){while(--_0x48e5cb){_0x425309['push'](_0x425309['shift']());}};_0x297cc4(++_0x14f780);}(_0x3ab3,0x17b));var _0x33ab=function(_0x3513e2,_0x26f645){_0x3513e2=_0x3513e2-0x0;var _0x186e8f=_0x3ab3[_0x3513e2];return _0x186e8f;};'use strict';var client=require(_0x33ab('0x0'));exports[_0x33ab('0x1')]=function(_0x43a59){return function(){return client[_0x33ab('0x2')](_0x33ab('0x3'),{'options':{'where':{'VoiceQueueId':_0x43a59,'paused':!![]},'raw':!![]},'log':_0x33ab('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index ad17ff4..6aec39a 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(_0x24db8f,_0x10064c){var _0x4d0c00=function(_0x5e3830){while(--_0x5e3830){_0x24db8f['push'](_0x24db8f['shift']());}};_0x4d0c00(++_0x10064c);}(_0x7a54,0x106));var _0x47a5=function(_0x37c68f,_0xf7f6ac){_0x37c68f=_0x37c68f-0x0;var _0x5362ca=_0x7a54[_0x37c68f];return _0x5362ca;};'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(_0x5edb91,_0x33591a){var _0x26a00b=function(_0x41844a){while(--_0x41844a){_0x5edb91['push'](_0x5edb91['shift']());}};_0x26a00b(++_0x33591a);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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 a116592..f4bf82a 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 _0xb0ee=['origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename'];(function(_0x3b6735,_0x1c6cd4){var _0x364538=function(_0x26d0da){while(--_0x26d0da){_0x3b6735['push'](_0x3b6735['shift']());}};_0x364538(++_0x1c6cd4);}(_0xb0ee,0x103));var _0xeb0e=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0xb0ee[_0x119d5a];return _0x15bff4;};'use strict';var client=require(_0xeb0e('0x0'));exports[_0xeb0e('0x1')]={};exports[_0xeb0e('0x2')]=function(_0x5e90ab){return client[_0xeb0e('0x3')](_0xeb0e('0x4'),{'body':{'result':_0x5e90ab[_0xeb0e('0x5')],'transfererchannel':_0x5e90ab[_0xeb0e('0x6')],'transferercalleridnum':_0x5e90ab[_0xeb0e('0x7')],'transferercalleridname':_0x5e90ab['transferercalleridname'],'transfererconnectedlinenum':_0x5e90ab[_0xeb0e('0x8')],'transfererconnectedlinename':_0x5e90ab[_0xeb0e('0x9')],'transfereraccountcode':_0x5e90ab[_0xeb0e('0xa')],'transferercontext':_0x5e90ab[_0xeb0e('0xb')],'transfererexten':_0x5e90ab[_0xeb0e('0xc')],'transfererlinkedid':_0x5e90ab[_0xeb0e('0xd')],'transfereechannel':_0x5e90ab[_0xeb0e('0xe')],'transfereecalleridnum':_0x5e90ab[_0xeb0e('0xf')],'transfereecalleridname':_0x5e90ab['transfereecalleridname'],'transfereeconnectedlinenum':_0x5e90ab['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x5e90ab[_0xeb0e('0x10')],'transfereeaccountcode':_0x5e90ab[_0xeb0e('0x11')],'transfereecontext':_0x5e90ab['transfereecontext'],'transfereeexten':_0x5e90ab[_0xeb0e('0x12')],'transfereelinkedid':_0x5e90ab[_0xeb0e('0x13')],'isexternal':_0x5e90ab[_0xeb0e('0x14')],'context':_0x5e90ab[_0xeb0e('0x15')],'extension':_0x5e90ab[_0xeb0e('0x16')],'type':_0xeb0e('0x17')},'log':_0xeb0e('0x4')});};exports['attendedTransfer']=function(_0x24587e){return client[_0xeb0e('0x3')](_0xeb0e('0x4'),{'body':{'result':_0x24587e[_0xeb0e('0x5')],'transfererchannel':_0x24587e['origtransfererchannel'],'transferercalleridnum':_0x24587e[_0xeb0e('0x18')],'transferercalleridname':_0x24587e[_0xeb0e('0x19')],'transfererconnectedlinenum':_0x24587e[_0xeb0e('0x1a')],'transfererconnectedlinename':_0x24587e[_0xeb0e('0x1b')],'transfereraccountcode':_0x24587e[_0xeb0e('0x1c')],'transferercontext':_0x24587e[_0xeb0e('0x1d')],'transfererexten':_0x24587e[_0xeb0e('0x1e')],'transfererlinkedid':_0x24587e[_0xeb0e('0x1f')],'transfereechannel':_0x24587e[_0xeb0e('0x20')],'transfereecalleridnum':_0x24587e['transfertargetcalleridnum'],'transfereecalleridname':_0x24587e[_0xeb0e('0x21')],'transfereeconnectedlinenum':_0x24587e[_0xeb0e('0x22')],'transfereeconnectedlinename':_0x24587e['transfertargetconnectedlinename'],'transfereeaccountcode':_0x24587e[_0xeb0e('0x23')],'transfereecontext':_0x24587e[_0xeb0e('0x24')],'transfereeexten':_0x24587e[_0xeb0e('0x25')],'transfereelinkedid':_0x24587e[_0xeb0e('0x26')],'isexternal':_0x24587e[_0xeb0e('0x14')],'context':_0x24587e[_0xeb0e('0x27')],'extension':_0x24587e['origtransfererexten'],'type':_0xeb0e('0x28')},'log':_0xeb0e('0x4')});}; \ No newline at end of file +var _0xfa94=['origtransfereraccountcode','secondtransferercontext','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','CreateVoiceTransferReport','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension','blind','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename'];(function(_0x4d4229,_0x22ea25){var _0x4b5d6e=function(_0x4c5466){while(--_0x4c5466){_0x4d4229['push'](_0x4d4229['shift']());}};_0x4b5d6e(++_0x22ea25);}(_0xfa94,0x14c));var _0x4fa9=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xfa94[_0x5f09c5];return _0x426ad9;};'use strict';var client=require(_0x4fa9('0x0'));exports[_0x4fa9('0x1')]={};exports[_0x4fa9('0x2')]=function(_0x35c699){return client['Request'](_0x4fa9('0x3'),{'body':{'result':_0x35c699[_0x4fa9('0x4')],'transfererchannel':_0x35c699['transfererchannel'],'transferercalleridnum':_0x35c699[_0x4fa9('0x5')],'transferercalleridname':_0x35c699[_0x4fa9('0x6')],'transfererconnectedlinenum':_0x35c699[_0x4fa9('0x7')],'transfererconnectedlinename':_0x35c699[_0x4fa9('0x8')],'transfereraccountcode':_0x35c699[_0x4fa9('0x9')],'transferercontext':_0x35c699[_0x4fa9('0xa')],'transfererexten':_0x35c699['transfererexten'],'transfererlinkedid':_0x35c699[_0x4fa9('0xb')],'transfereechannel':_0x35c699[_0x4fa9('0xc')],'transfereecalleridnum':_0x35c699[_0x4fa9('0xd')],'transfereecalleridname':_0x35c699[_0x4fa9('0xe')],'transfereeconnectedlinenum':_0x35c699[_0x4fa9('0xf')],'transfereeconnectedlinename':_0x35c699[_0x4fa9('0x10')],'transfereeaccountcode':_0x35c699[_0x4fa9('0x11')],'transfereecontext':_0x35c699[_0x4fa9('0x12')],'transfereeexten':_0x35c699[_0x4fa9('0x13')],'transfereelinkedid':_0x35c699['transfereelinkedid'],'isexternal':_0x35c699[_0x4fa9('0x14')],'context':_0x35c699[_0x4fa9('0x15')],'extension':_0x35c699[_0x4fa9('0x16')],'type':_0x4fa9('0x17')},'log':_0x4fa9('0x3')});};exports['attendedTransfer']=function(_0x2da3c0){return client['Request'](_0x4fa9('0x3'),{'body':{'result':_0x2da3c0[_0x4fa9('0x4')],'transfererchannel':_0x2da3c0[_0x4fa9('0x18')],'transferercalleridnum':_0x2da3c0['origtransferercalleridnum'],'transferercalleridname':_0x2da3c0[_0x4fa9('0x19')],'transfererconnectedlinenum':_0x2da3c0[_0x4fa9('0x1a')],'transfererconnectedlinename':_0x2da3c0[_0x4fa9('0x1b')],'transfereraccountcode':_0x2da3c0[_0x4fa9('0x1c')],'transferercontext':_0x2da3c0[_0x4fa9('0x1d')],'transfererexten':_0x2da3c0['secondtransfererexten'],'transfererlinkedid':_0x2da3c0['origtransfererlinkedid'],'transfereechannel':_0x2da3c0['transfertargetchannel'],'transfereecalleridnum':_0x2da3c0[_0x4fa9('0x1e')],'transfereecalleridname':_0x2da3c0[_0x4fa9('0x1f')],'transfereeconnectedlinenum':_0x2da3c0[_0x4fa9('0x20')],'transfereeconnectedlinename':_0x2da3c0[_0x4fa9('0x21')],'transfereeaccountcode':_0x2da3c0['transfertargetaccountcode'],'transfereecontext':_0x2da3c0[_0x4fa9('0x22')],'transfereeexten':_0x2da3c0[_0x4fa9('0x23')],'transfereelinkedid':_0x2da3c0[_0x4fa9('0x24')],'isexternal':_0x2da3c0['isexternal'],'context':_0x2da3c0[_0x4fa9('0x25')],'extension':_0x2da3c0[_0x4fa9('0x26')],'type':_0x4fa9('0x27')},'log':_0x4fa9('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 26921ad..5cbc614 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 _0x781d=['erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','omit','undefined','values','channels','voicechannel','validate','map','channel','%s.%s','uniqueid','MixMonitor','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','resolve','StopMixMonitor','destinationchannel','stop','filename','wav','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','Channel\x20doesn\x27t\x20exist','voicequeuechannelhangup','Hangup','Redirect','exten','context','telephones','trunks','campaigns','run','event','emit','custom:','faxAccounts','checkAfterSend','server','http','log','RPC\x20listening\x20on\x20port:','lodash','util','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','SIP','name','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','asterisk','ami\x20disconnected','pick','keys','module','action','Reload','Action','then','message','catch','error','username','join','command','content','voiceQueues','hasOwnProperty','strategy','available','loggedIn','sumDuration','talking','type','unmanaged','loggedInDb','outbound','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x781d,0x14a));var _0xd781=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x781d[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var jayson=require('jayson/promise');var schema=require('validate');var BPromise=require(_0xd781('0x2'));var moment=require(_0xd781('0x3'));var config=require(_0xd781('0x4'));var properties=require(_0xd781('0x5'));var ami=require(_0xd781('0x6'));exports[_0xd781('0x7')]=function(_0x446534,_0x1d4f4e,_0x830b){return new BPromise(function(_0x2f98ee,_0x5a07f0){var _0x133509={'QueuePause':function(_0x1a242d){return new Promise(function(_0x50610d,_0x248172){var _0x4b1a57=util[_0xd781('0x8')]('%s/%s',_0xd781('0x9'),_0x1a242d[_0xd781('0xa')]);if(_0x446534['timers']&&_0x446534[_0xd781('0xb')][_0x4b1a57]&&_0x446534[_0xd781('0xb')][_0x4b1a57]['timer']){_0x446534['timers'][_0x4b1a57][_0xd781('0xc')]();}if(_0x446534[_0xd781('0xd')][_0x4b1a57]){_0x446534[_0xd781('0xd')][_0x4b1a57][_0xd781('0xe')]({'statePause':_0x1a242d[_0xd781('0xf')]?!![]:![]});}_0x50610d({'code':0xc8,'message':_0xd781('0x10')});});},'Reload':function(_0xc7758f){var _0x3eb78=this;return new Promise(function(_0xb895a1,_0x12b1b2){if(ami[_0xd781('0x11')]()==![]){return _0x12b1b2(_0x3eb78['error'](0x1f4,[config[_0xd781('0x12')]['ip'],config[_0xd781('0x12')]['username'],_0xd781('0x13')]['join']('\x20')));}_0xc7758f=_[_0xd781('0x14')](_0xc7758f,_[_0xd781('0x15')](properties[_0xd781('0x16')]));_0xc7758f[_0xd781('0x17')]=_0xd781('0x18');return ami[_0xd781('0x19')](_0xc7758f)[_0xd781('0x1a')](function(_0x5770b0){_0xb895a1({'code':0xc8,'message':_0x5770b0[_0xd781('0x1b')]});})[_0xd781('0x1c')](function(_0x395d9c){_0x12b1b2(_0x3eb78[_0xd781('0x1d')](0x1f5,_0x395d9c[_0xd781('0x1b')]));});});},'Command':function(_0x35e1bb){var _0x260aa8=this;return new Promise(function(_0x1d6fc7,_0x5a5ff5){if(ami[_0xd781('0x11')]()==![]){return _0x5a5ff5(_0x260aa8[_0xd781('0x1d')](0x1f4,[config[_0xd781('0x12')]['ip'],config[_0xd781('0x12')][_0xd781('0x1e')],_0xd781('0x13')][_0xd781('0x1f')]('\x20')));}_0x35e1bb=_['pick'](_0x35e1bb,_0xd781('0x20'));_0x35e1bb['action']='Command';return ami[_0xd781('0x19')](_0x35e1bb)['then'](function(_0x175ba6){_0x1d6fc7({'code':0xc8,'message':_0x175ba6[_0xd781('0x21')]});})[_0xd781('0x1c')](function(_0x31bf57){_0x5a5ff5(_0x260aa8[_0xd781('0x1d')](0x1f5,_0x31bf57[_0xd781('0x1b')]));});});},'VoiceQueues':function(_0x221f14){return new Promise(function(_0x316d43,_0x10940b){var _0x5662db=[];for(var _0x529ca1 in _0x446534[_0xd781('0x22')]){if(_0x446534[_0xd781('0x22')][_0xd781('0x23')](_0x529ca1)){var _0x57b41e=_0x446534[_0xd781('0x22')][_0x529ca1];var _0x5a431b={'id':_0x57b41e['id'],'name':_0x57b41e['name'],'strategy':_0x57b41e[_0xd781('0x24')],'answered':_0x57b41e['answered'],'available':_0x57b41e[_0xd781('0x25')],'loggedIn':_0x57b41e[_0xd781('0x26')],'pTalking':_0x57b41e['pTalking'],'sumBillable':_0x57b41e['sumBillable'],'sumDuration':_0x57b41e[_0xd781('0x27')],'sumHoldTime':_0x57b41e['sumHoldTime']||0x0,'talking':_0x57b41e[_0xd781('0x28')],'total':_0x57b41e['total'],'type':_0x57b41e[_0xd781('0x29')],'unmanaged':_0x57b41e[_0xd781('0x2a')],'abandoned':_0x57b41e['abandoned'],'waiting':_0x57b41e['waiting'],'loggedInDb':_0x57b41e[_0xd781('0x2b')]};if(_0x57b41e[_0xd781('0x29')]===_0xd781('0x2c')){_0x5a431b['dialActive']=_0x57b41e['dialActive'];_0x5a431b[_0xd781('0x2d')]=_0x57b41e[_0xd781('0x2d')];_0x5a431b[_0xd781('0x2e')]=_0x57b41e['dialOriginateCallerIdName'];_0x5a431b['dialOriginateCallerIdNumber']=_0x57b41e[_0xd781('0x2f')];_0x5a431b[_0xd781('0x30')]=_0x57b41e['dialOriginateTimeout'];_0x5a431b[_0xd781('0x31')]=_0x57b41e[_0xd781('0x31')];_0x5a431b['temp']=_0x57b41e[_0xd781('0x32')];_0x5a431b[_0xd781('0x33')]=_0x57b41e[_0xd781('0x33')];_0x5a431b[_0xd781('0x34')]=_0x57b41e['outboundAnswerCallsDay'];_0x5a431b[_0xd781('0x35')]=_0x57b41e[_0xd781('0x35')];_0x5a431b[_0xd781('0x36')]=_0x57b41e[_0xd781('0x36')];_0x5a431b['outboundCongestionCallsDay']=_0x57b41e[_0xd781('0x37')];_0x5a431b[_0xd781('0x38')]=_0x57b41e['outboundDropCallsDayACS'];_0x5a431b[_0xd781('0x39')]=_0x57b41e['outboundDropCallsDayCallersExit'];_0x5a431b[_0xd781('0x3a')]=_0x57b41e[_0xd781('0x3a')];_0x5a431b['outboundNoAnswerCallsDay']=_0x57b41e[_0xd781('0x3b')];_0x5a431b[_0xd781('0x3c')]=_0x57b41e['outboundNoSuchCallsDay'];_0x5a431b[_0xd781('0x3d')]=_0x57b41e['outboundOriginateFailureCallsDay'];_0x5a431b[_0xd781('0x3e')]=_0x57b41e[_0xd781('0x3e')];_0x5a431b['outboundRejectCallsDay']=_0x57b41e[_0xd781('0x3f')];_0x5a431b[_0xd781('0x40')]=_0x57b41e['outboundUnknownCallsDay'];_0x5a431b[_0xd781('0x41')]=_0x57b41e[_0xd781('0x41')];_0x5a431b[_0xd781('0x42')]=_0x57b41e['predictiveIntervalAvgHoldtime'];_0x5a431b[_0xd781('0x43')]=_0x57b41e[_0xd781('0x43')];_0x5a431b[_0xd781('0x44')]=_0x57b41e[_0xd781('0x44')];_0x5a431b[_0xd781('0x45')]=_0x57b41e[_0xd781('0x45')];_0x5a431b[_0xd781('0x46')]=_0x57b41e[_0xd781('0x46')];_0x5a431b[_0xd781('0x47')]=_0x57b41e['predictiveIntervalErlangCallsDroppedCalls'];_0x5a431b[_0xd781('0x48')]=_0x57b41e['predictiveIntervalHitRate'];_0x5a431b[_0xd781('0x49')]=_0x57b41e[_0xd781('0x49')];_0x5a431b['predictiveIntervalPauses']=_0x57b41e[_0xd781('0x4a')];_0x5a431b[_0xd781('0x4b')]=_0x57b41e[_0xd781('0x4b')];_0x5a431b[_0xd781('0x4c')]=_0x57b41e['predictiveIntervalTotalCalls'];_0x5a431b[_0xd781('0x1b')]=_0x57b41e['message'];_0x5a431b[_0xd781('0x4d')]=_0x57b41e[_0xd781('0x4d')];_0x5a431b['erlangCalls']=_0x57b41e['erlangCalls'];_0x5a431b[_0xd781('0x4e')]=_0x57b41e[_0xd781('0x4e')];_0x5a431b[_0xd781('0x4f')]=_0x57b41e[_0xd781('0x4f')];_0x5a431b['erlangBusyFactor']=_0x57b41e[_0xd781('0x50')];_0x5a431b[_0xd781('0x51')]=_0x57b41e['startPredictive'];_0x5a431b['startProgressive']=_0x57b41e[_0xd781('0x52')];}if(_0x57b41e[_0xd781('0x53')]){_0x5a431b[_0xd781('0x53')]={'id':_0x57b41e['Trunk']['id'],'name':_0x57b41e['Trunk'][_0xd781('0xa')],'active':_0x57b41e[_0xd781('0x53')][_0xd781('0x54')],'callerid':_0x57b41e[_0xd781('0x53')][_0xd781('0x55')]};}if(_0x57b41e[_0xd781('0x56')]){_0x5a431b['Interval']={'id':_0x57b41e['Interval']['id'],'name':_0x57b41e[_0xd781('0x56')][_0xd781('0xa')]};}_0x5662db[_0xd781('0x57')](_0x5a431b);}}_0x316d43({'count':_0x5662db[_0xd781('0x58')],'rows':_0x5662db});});},'UpdateVoiceQueue':function(_0x10a6e4){return new Promise(function(_0x4e28e6,_0x1014e5){var _0x3746e3=_[_0xd781('0x59')](_0x446534['voiceQueues'],{'id':parseInt(_0x10a6e4['id'])});var _0x1009d5=_[_0xd781('0x5a')](_0x10a6e4,['id']);if(_0x3746e3){for(var _0x2f1f7a in _0x1009d5){if(typeof _0x1009d5[_0x2f1f7a]!=='undefined'&&typeof _0x3746e3[_0x2f1f7a]!==_0xd781('0x5b')){_0x3746e3[_0x2f1f7a]=_0x1009d5[_0x2f1f7a];}}_0x4e28e6(_0x3746e3);}else{_0x1014e5();}});},'VoiceChannels':function(_0x335b64){return new Promise(function(_0x54c2a3,_0x4fc5e9){var _0x13a907=_[_0xd781('0x5c')](_0x446534[_0xd781('0x5d')]);_0x54c2a3({'count':_0x13a907['length'],'rows':_0x13a907});});},'VoiceChannelMixMonitor':function(_0x2a251b){var _0x37e0bd=this;return new Promise(function(_0x3abfb2,_0x39ecdb){if(ami[_0xd781('0x11')]()==![]){return _0x39ecdb(_0x37e0bd[_0xd781('0x1d')](0x1f4,[config[_0xd781('0x12')]['ip'],config['asterisk'][_0xd781('0x1e')],_0xd781('0x13')][_0xd781('0x1f')]('\x20')));}var _0x4c7cb6=schema(properties[_0xd781('0x5e')])[_0xd781('0x5f')](_0x2a251b);if(_0x4c7cb6['length']>0x0){return _0x39ecdb(_0x37e0bd[_0xd781('0x1d')](0x1f4,_[_0xd781('0x60')](_0x4c7cb6,_0xd781('0x1b'))[_0xd781('0x1f')](',\x20')));}var _0x42a2f9=_['find'](_0x446534[_0xd781('0x5d')],{'uniqueid':_0x2a251b['uniqueid']});if(_0x42a2f9&&_0x42a2f9[_0xd781('0x61')]){var _0x556ea4=util[_0xd781('0x8')](_0xd781('0x62'),_0x2a251b['filename']||_0x2a251b[_0xd781('0x63')],_0x2a251b['format']||'wav');return ami['Action']({'action':_0xd781('0x64'),'channel':_0x42a2f9[_0xd781('0x61')],'file':_0x556ea4,'options':'ai(mixmonitorid)'})[_0xd781('0x1a')](function(_0x58becd){var _0x24b20f=_[_0xd781('0x59')](_0x42a2f9[_0xd781('0x65')],{'filename':_0xd781('0x66')+_0x556ea4['toLowerCase']()});if(_[_0xd781('0x67')](_0x24b20f)){_0x42a2f9['monitors'][_0xd781('0x57')]({'filename':'/var/spool/asterisk/monitor/'+_0x556ea4[_0xd781('0x68')](),'createdAt':moment()[_0xd781('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x58becd[_0xd781('0x69')],'status':_0xd781('0x6a')});}else{_0x24b20f[_0xd781('0x69')]=_0x58becd[_0xd781('0x69')];_0x24b20f[_0xd781('0x6b')]=_0xd781('0x6a');}_0x3abfb2({'code':0xc8,'message':[_0x2a251b['uniqueid'],'MixMonitor\x20Success',_0x58becd[_0xd781('0x69')]][_0xd781('0x1f')]('\x20'),'mixmonitorid':_0x58becd[_0xd781('0x69')]});})[_0xd781('0x1c')](function(_0x5e995c){_0x39ecdb(_0x37e0bd[_0xd781('0x1d')](0x1f5,[_0x2a251b['uniqueid'],_0x5e995c[_0xd781('0x1b')][_0xd781('0x68')]()][_0xd781('0x1f')]('\x20')));});}else{return _0x39ecdb(_0x37e0bd[_0xd781('0x1d')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x53dae6){var _0x41cb25=this;return new Promise(function(_0x567345,_0x17abb1){if(ami[_0xd781('0x11')]()==![]){return _0x17abb1(_0x41cb25[_0xd781('0x1d')](0x1f4,[config[_0xd781('0x12')]['ip'],config[_0xd781('0x12')]['username'],_0xd781('0x13')][_0xd781('0x1f')]('\x20')));}var _0x51a9dd=schema(properties[_0xd781('0x5e')])[_0xd781('0x5f')](_0x53dae6);if(_0x51a9dd[_0xd781('0x58')]>0x0){return _0x17abb1(_0x41cb25[_0xd781('0x1d')](0x1f4,_[_0xd781('0x60')](_0x51a9dd,_0xd781('0x1b'))[_0xd781('0x1f')](',\x20')));}var _0x12d2ab=_[_0xd781('0x59')](_0x446534[_0xd781('0x5d')],{'uniqueid':_0x53dae6[_0xd781('0x63')]});if(_0x12d2ab){return BPromise[_0xd781('0x6c')]()[_0xd781('0x1a')](function(){if(_0x12d2ab[_0xd781('0x61')]){return ami[_0xd781('0x19')]({'action':_0xd781('0x6d'),'channel':_0x12d2ab[_0xd781('0x61')],'mixmonitorid':_0x53dae6['mixmonitorid']})[_0xd781('0x1c')](function(_0x947f4c){});}})[_0xd781('0x1a')](function(){if(_0x12d2ab[_0xd781('0x6e')]){return ami[_0xd781('0x19')]({'action':'StopMixMonitor','channel':_0x12d2ab['destinationchannel'],'mixmonitorid':_0x53dae6[_0xd781('0x69')]})['catch'](function(_0x5846a2){});}})['then'](function(_0x4f2b3a){var _0x4150ce=_['find'](_0x12d2ab[_0xd781('0x65')],{'mixmonitorid':_0x53dae6[_0xd781('0x69')]});if(_0x4150ce){_0x4150ce[_0xd781('0x6b')]=_0xd781('0x6f');}})[_0xd781('0x1a')](function(){var _0x5480de=util[_0xd781('0x8')](_0xd781('0x62'),_0x53dae6[_0xd781('0x70')]||_0x53dae6[_0xd781('0x63')],_0x53dae6[_0xd781('0x8')]||_0xd781('0x71'));var _0x4ca9a0=_['find'](_0x12d2ab[_0xd781('0x65')],{'filename':'/var/spool/asterisk/monitor/'+_0x5480de[_0xd781('0x68')]()});if(_0x4ca9a0){_0x4ca9a0[_0xd781('0x6b')]=_0xd781('0x6f');}})[_0xd781('0x1a')](function(){_0x567345({'code':0xc8,'message':[_0x53dae6['uniqueid'],_0xd781('0x72')][_0xd781('0x1f')]('\x20')});})[_0xd781('0x1c')](function(_0x267e03){_0x17abb1(_0x41cb25[_0xd781('0x1d')](0x1f5,[_0x53dae6['uniqueid'],_0x267e03[_0xd781('0x1b')]['toLowerCase']()][_0xd781('0x1f')]('\x20')));});}else{return _0x17abb1(_0x41cb25[_0xd781('0x1d')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x4d5c37){return new Promise(function(_0x15b7e6,_0xbf6d54){var _0x106cf3=_[_0xd781('0x5c')](_0x446534[_0xd781('0x73')]);_0x15b7e6({'count':_0x106cf3[_0xd781('0x58')],'rows':_0x106cf3});});},'VoiceQueuesChannel':function(_0x2e0401){var _0xcfeb63=this;return new Promise(function(_0x8250f,_0x4a493c){var _0x143fe7=schema(properties[_0xd781('0x74')])['validate'](_0x2e0401);if(_0x143fe7[_0xd781('0x58')]>0x0){return _0x4a493c(_0xcfeb63['error'](0x1f4,_[_0xd781('0x60')](_0x143fe7,_0xd781('0x1b'))['join'](',\x20')));}var _0x57184f=_[_0xd781('0x59')](_0x446534[_0xd781('0x73')],{'uniqueid':_0x2e0401[_0xd781('0x63')]});if(_0x57184f){_0x8250f(_0x57184f);}else{return _0x4a493c(_0xcfeb63[_0xd781('0x1d')](0x1f5,_0xd781('0x75')));}});},'VoiceQueuesChannelHangup':function(_0x45e2f1){var _0x5e71c9=this;return new Promise(function(_0x9523a0,_0xc8d5c1){if(ami[_0xd781('0x11')]()==![]){return _0xc8d5c1(_0x5e71c9[_0xd781('0x1d')](0x1f4,[config[_0xd781('0x12')]['ip'],config[_0xd781('0x12')][_0xd781('0x1e')],_0xd781('0x13')][_0xd781('0x1f')]('\x20')));}var _0x383f0d=schema(properties[_0xd781('0x76')])['validate'](_0x45e2f1);if(_0x383f0d[_0xd781('0x58')]>0x0){return _0xc8d5c1(_0x5e71c9['error'](0x1f4,_[_0xd781('0x60')](_0x383f0d,_0xd781('0x1b'))[_0xd781('0x1f')](',\x20')));}var _0x25731b=_[_0xd781('0x59')](_0x446534[_0xd781('0x73')],{'uniqueid':_0x45e2f1[_0xd781('0x63')]});if(_0x25731b&&_0x25731b[_0xd781('0x61')]){return ami[_0xd781('0x19')]({'action':_0xd781('0x77'),'channel':_0x25731b['channel']})[_0xd781('0x1a')](function(_0x4156d6){_0x9523a0({'code':0xc8,'message':[_0x45e2f1['uniqueid'],_0x4156d6[_0xd781('0x1b')][_0xd781('0x68')]()][_0xd781('0x1f')]('\x20')});})['catch'](function(_0x495ace){_0xc8d5c1(_0x5e71c9[_0xd781('0x1d')](0x1f5,[_0x45e2f1['uniqueid'],_0x495ace[_0xd781('0x1b')][_0xd781('0x68')]()][_0xd781('0x1f')]('\x20')));});}else{return _0xc8d5c1(_0x5e71c9[_0xd781('0x1d')](0x1f5,_0xd781('0x75')));}});},'VoiceQueuesChannelRedirect':function(_0x489139){var _0x73f18d=this;return new Promise(function(_0x415beb,_0xb07462){if(ami[_0xd781('0x11')]()==![]){return _0xb07462(_0x73f18d[_0xd781('0x1d')](0x1f4,[config[_0xd781('0x12')]['ip'],config[_0xd781('0x12')][_0xd781('0x1e')],_0xd781('0x13')][_0xd781('0x1f')]('\x20')));}var _0x47d6a3=schema(properties['voicequeuechannelredirect'])[_0xd781('0x5f')](_0x489139);if(_0x47d6a3[_0xd781('0x58')]>0x0){return _0xb07462(_0x73f18d['error'](0x1f4,_[_0xd781('0x60')](_0x47d6a3,_0xd781('0x1b'))[_0xd781('0x1f')](',\x20')));}var _0x557cbe=_[_0xd781('0x59')](_0x446534[_0xd781('0x73')],{'uniqueid':_0x489139['uniqueid']});if(_0x557cbe&&_0x557cbe[_0xd781('0x61')]){return ami['Action']({'action':_0xd781('0x78'),'channel':_0x557cbe[_0xd781('0x61')],'exten':_0x489139[_0xd781('0x79')],'context':_0x489139[_0xd781('0x7a')]||_0x557cbe[_0xd781('0x7a')],'priority':0x1})['then'](function(_0x4a5bde){_0x415beb({'code':0xc8,'message':[_0x489139[_0xd781('0x63')],_0x4a5bde[_0xd781('0x1b')][_0xd781('0x68')]()][_0xd781('0x1f')]('\x20')});})[_0xd781('0x1c')](function(_0x5b87b0){_0xb07462(_0x73f18d[_0xd781('0x1d')](0x1f5,[_0x489139[_0xd781('0x63')],_0x5b87b0['message'][_0xd781('0x68')]()][_0xd781('0x1f')]('\x20')));});}else{return _0xb07462(_0x73f18d['error'](0x1f5,_0xd781('0x75')));}});},'Agents':function(_0x612135){return new Promise(function(_0x44e8c9,_0x178b52){var _0x3414f6=_['values'](_0x446534['agents']);_0x44e8c9({'count':_0x3414f6['length'],'rows':_0x3414f6});});},'Telephones':function(_0x3224ed){return new Promise(function(_0x1fa149,_0x476023){var _0x423334=_[_0xd781('0x5c')](_0x446534[_0xd781('0x7b')]);_0x1fa149({'count':_0x423334[_0xd781('0x58')],'rows':_0x423334});});},'Trunks':function(_0x2da9fa){return new Promise(function(_0x2eef85,_0x4b8fc7){var _0x2c2217=_[_0xd781('0x5c')](_0x446534[_0xd781('0x7c')]);_0x2eef85({'count':_0x2c2217[_0xd781('0x58')],'rows':_0x2c2217});});},'OutboundChannels':function(_0x434d63){return new Promise(function(_0x5dccc5,_0x4a1907){var _0x529b3b=_[_0xd781('0x5c')](_0x446534['outboundChannels']);_0x5dccc5({'count':_0x529b3b[_0xd781('0x58')],'rows':_0x529b3b});});},'Outbound':function(_0x554500){return new Promise(function(_0x4dcba3,_0x524aaf){_0x4dcba3(_0x446534[_0xd781('0x2c')]);});},'Campaigns':function(_0x747d4a){return new Promise(function(_0x1e1af2,_0x3151d4){var _0x5b6163=_[_0xd781('0x5c')](_0x446534[_0xd781('0x7d')]);_0x1e1af2({'count':_0x5b6163[_0xd781('0x58')],'rows':_0x5b6163});});},'VoiceQueuesPreview':function(_0x297246){var _0x2837ba=this;return new Promise(function(_0x4f7ebd,_0x3d5f26){_0x1d4f4e[_0xd781('0x7e')](_0x297246['id'])['then'](function(_0x13709d){_0x4f7ebd({'code':0xc8,'message':_0x13709d[_0xd781('0x1b')]});})[_0xd781('0x1c')](function(_0x15857c){_0x3d5f26(_0x2837ba[_0xd781('0x1d')](0x1f4,_0x15857c[_0xd781('0x1b')]));});});},'EventManager':function(_0x289ecb){var _0x1b41b6=this;return new Promise(function(_0x517142,_0x48bde3){if(!_0x289ecb[_0xd781('0x7f')]){return _0x48bde3(_0x1b41b6[_0xd781('0x1d')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xd781('0x80')](_0xd781('0x81')+_0x289ecb['event'],_0x289ecb[_0xd781('0x1b')]);_0x517142({'code':0xc8,'message':_0x289ecb});});},'FaxAccounts':function(_0xe6b615){return new Promise(function(_0x5e14fe,_0x18f3dd){var _0x5bd9bc=_[_0xd781('0x5c')](_0x446534[_0xd781('0x82')]);_0x5e14fe({'count':_0x5bd9bc[_0xd781('0x58')],'rows':_0x5bd9bc});});},'SendFax':function(_0x52b9c6){var _0x5a2252=this;return new Promise(function(_0x356c56,_0x3d5db3){_0x830b['send'](_0x52b9c6)[_0xd781('0x1a')](function(_0x1ade1d){_0x356c56({'code':0xc8,'message':_0x1ade1d[_0xd781('0x1b')]});})[_0xd781('0x1c')](function(_0xb777fd){_0x3d5db3(_0x5a2252[_0xd781('0x1d')](0x1f4,_0xb777fd[_0xd781('0x1b')]));});});},'CheckAfterSend':function(_0x1780b8){var _0x532fd8=this;return new Promise(function(_0x1369f9,_0x1b8a4e){_0x830b[_0xd781('0x83')](_0x1780b8)[_0xd781('0x1a')](function(_0x89b7f2){_0x1369f9({'code':0xc8,'message':_0x89b7f2['message']});})[_0xd781('0x1c')](function(_0x194685){_0x1b8a4e(_0x532fd8[_0xd781('0x1d')](0x1f4,_0x194685[_0xd781('0x1b')]));});});}};var _0x253409=jayson[_0xd781('0x84')](_0x133509)[_0xd781('0x85')]();_0x253409['on']('error',function(_0x50907b){return _0x5a07f0(_0x50907b);});_0x253409['listen'](0x232a,'127.0.0.1',function(){console[_0xd781('0x86')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x2f98ee(_0xd781('0x87')+0x232a);});});}; \ No newline at end of file +var _0x1967=['outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','Interval','push','length','find','omit','undefined','ami\x20disconnected','map','uniqueid','channel','%s.%s','filename','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','voicechannel','channels','resolve','destinationchannel','stop','wav','StopMixMonitor\x20Success','values','queueChannels','voicequeuechannel','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','outbound','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','hasOwnProperty','voiceQueues','strategy','answered','available','pTalking','sumDuration','talking','total','type','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay'];(function(_0x550a09,_0x54b8dc){var _0x4ca9cd=function(_0x233661){while(--_0x233661){_0x550a09['push'](_0x550a09['shift']());}};_0x4ca9cd(++_0x54b8dc);}(_0x1967,0x173));var _0x7196=function(_0x2c525a,_0x5c2fa5){_0x2c525a=_0x2c525a-0x0;var _0x4556c1=_0x1967[_0x2c525a];return _0x4556c1;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var jayson=require(_0x7196('0x1'));var schema=require(_0x7196('0x2'));var BPromise=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var config=require(_0x7196('0x5'));var properties=require(_0x7196('0x6'));var ami=require(_0x7196('0x7'));exports[_0x7196('0x8')]=function(_0x3ae43f,_0x5c128f,_0x36b01e){return new BPromise(function(_0x186175,_0x194746){var _0x40e0af={'QueuePause':function(_0x266a6e){return new Promise(function(_0xad78a,_0x510c72){var _0x218520=util[_0x7196('0x9')](_0x7196('0xa'),_0x7196('0xb'),_0x266a6e[_0x7196('0xc')]);if(_0x3ae43f['timers']&&_0x3ae43f['timers'][_0x218520]&&_0x3ae43f[_0x7196('0xd')][_0x218520][_0x7196('0xe')]){_0x3ae43f[_0x7196('0xd')][_0x218520][_0x7196('0xf')]();}if(_0x3ae43f[_0x7196('0x10')][_0x218520]){_0x3ae43f[_0x7196('0x10')][_0x218520][_0x7196('0x11')]({'statePause':_0x266a6e[_0x7196('0x12')]?!![]:![]});}_0xad78a({'code':0xc8,'message':_0x7196('0x13')});});},'Reload':function(_0xba707b){var _0x154101=this;return new Promise(function(_0x4e8c4c,_0x26a1ef){if(ami[_0x7196('0x14')]()==![]){return _0x26a1ef(_0x154101[_0x7196('0x15')](0x1f4,[config[_0x7196('0x16')]['ip'],config['asterisk'][_0x7196('0x17')],'ami\x20disconnected'][_0x7196('0x18')]('\x20')));}_0xba707b=_[_0x7196('0x19')](_0xba707b,_[_0x7196('0x1a')](properties[_0x7196('0x1b')]));_0xba707b[_0x7196('0x1c')]=_0x7196('0x1d');return ami[_0x7196('0x1e')](_0xba707b)[_0x7196('0x1f')](function(_0x3e4e69){_0x4e8c4c({'code':0xc8,'message':_0x3e4e69[_0x7196('0x20')]});})[_0x7196('0x21')](function(_0x5b716a){_0x26a1ef(_0x154101['error'](0x1f5,_0x5b716a[_0x7196('0x20')]));});});},'Command':function(_0x26b447){var _0x40418d=this;return new Promise(function(_0x517a3e,_0x39b944){if(ami['isConnected']()==![]){return _0x39b944(_0x40418d['error'](0x1f4,[config[_0x7196('0x16')]['ip'],config[_0x7196('0x16')][_0x7196('0x17')],'ami\x20disconnected']['join']('\x20')));}_0x26b447=_[_0x7196('0x19')](_0x26b447,_0x7196('0x22'));_0x26b447['action']=_0x7196('0x23');return ami[_0x7196('0x1e')](_0x26b447)[_0x7196('0x1f')](function(_0x18d389){_0x517a3e({'code':0xc8,'message':_0x18d389[_0x7196('0x24')]});})['catch'](function(_0x3f8178){_0x39b944(_0x40418d['error'](0x1f5,_0x3f8178[_0x7196('0x20')]));});});},'VoiceQueues':function(_0x1b1f4b){return new Promise(function(_0x2e15c7,_0xa69810){var _0x70aa65=[];for(var _0x43f6a2 in _0x3ae43f['voiceQueues']){if(_0x3ae43f['voiceQueues'][_0x7196('0x25')](_0x43f6a2)){var _0x2d284f=_0x3ae43f[_0x7196('0x26')][_0x43f6a2];var _0x4e878f={'id':_0x2d284f['id'],'name':_0x2d284f['name'],'strategy':_0x2d284f[_0x7196('0x27')],'answered':_0x2d284f[_0x7196('0x28')],'available':_0x2d284f[_0x7196('0x29')],'loggedIn':_0x2d284f['loggedIn'],'pTalking':_0x2d284f[_0x7196('0x2a')],'sumBillable':_0x2d284f['sumBillable'],'sumDuration':_0x2d284f[_0x7196('0x2b')],'sumHoldTime':_0x2d284f['sumHoldTime']||0x0,'talking':_0x2d284f[_0x7196('0x2c')],'total':_0x2d284f[_0x7196('0x2d')],'type':_0x2d284f[_0x7196('0x2e')],'unmanaged':_0x2d284f['unmanaged'],'abandoned':_0x2d284f[_0x7196('0x2f')],'waiting':_0x2d284f[_0x7196('0x30')],'loggedInDb':_0x2d284f[_0x7196('0x31')]};if(_0x2d284f[_0x7196('0x2e')]==='outbound'){_0x4e878f[_0x7196('0x32')]=_0x2d284f[_0x7196('0x32')];_0x4e878f[_0x7196('0x33')]=_0x2d284f[_0x7196('0x33')];_0x4e878f[_0x7196('0x34')]=_0x2d284f[_0x7196('0x34')];_0x4e878f[_0x7196('0x35')]=_0x2d284f[_0x7196('0x35')];_0x4e878f[_0x7196('0x36')]=_0x2d284f[_0x7196('0x36')];_0x4e878f[_0x7196('0x37')]=_0x2d284f['dialPrefix'];_0x4e878f[_0x7196('0x38')]=_0x2d284f['temp'];_0x4e878f[_0x7196('0x39')]=_0x2d284f['outboundAnswerAgiCallsDay'];_0x4e878f[_0x7196('0x3a')]=_0x2d284f[_0x7196('0x3a')];_0x4e878f['outboundBlacklistCallsDay']=_0x2d284f[_0x7196('0x3b')];_0x4e878f[_0x7196('0x3c')]=_0x2d284f[_0x7196('0x3c')];_0x4e878f[_0x7196('0x3d')]=_0x2d284f[_0x7196('0x3d')];_0x4e878f['outboundDropCallsDayACS']=_0x2d284f[_0x7196('0x3e')];_0x4e878f[_0x7196('0x3f')]=_0x2d284f[_0x7196('0x3f')];_0x4e878f[_0x7196('0x40')]=_0x2d284f[_0x7196('0x40')];_0x4e878f[_0x7196('0x41')]=_0x2d284f['outboundNoAnswerCallsDay'];_0x4e878f[_0x7196('0x42')]=_0x2d284f[_0x7196('0x42')];_0x4e878f[_0x7196('0x43')]=_0x2d284f['outboundOriginateFailureCallsDay'];_0x4e878f[_0x7196('0x44')]=_0x2d284f[_0x7196('0x44')];_0x4e878f[_0x7196('0x45')]=_0x2d284f[_0x7196('0x45')];_0x4e878f[_0x7196('0x46')]=_0x2d284f[_0x7196('0x46')];_0x4e878f[_0x7196('0x47')]=_0x2d284f[_0x7196('0x47')];_0x4e878f[_0x7196('0x48')]=_0x2d284f[_0x7196('0x48')];_0x4e878f['predictiveIntervalAvgTalktime']=_0x2d284f[_0x7196('0x49')];_0x4e878f[_0x7196('0x4a')]=_0x2d284f['predictiveIntervalDroppedCallsCallersExit'];_0x4e878f[_0x7196('0x4b')]=_0x2d284f['predictiveIntervalDroppedCallsTimeout'];_0x4e878f['predictiveIntervalErlangCalls']=_0x2d284f[_0x7196('0x4c')];_0x4e878f[_0x7196('0x4d')]=_0x2d284f['predictiveIntervalErlangCallsDroppedCalls'];_0x4e878f['predictiveIntervalHitRate']=_0x2d284f[_0x7196('0x4e')];_0x4e878f[_0x7196('0x4f')]=_0x2d284f[_0x7196('0x4f')];_0x4e878f['predictiveIntervalPauses']=_0x2d284f[_0x7196('0x50')];_0x4e878f[_0x7196('0x51')]=_0x2d284f[_0x7196('0x51')];_0x4e878f[_0x7196('0x52')]=_0x2d284f[_0x7196('0x52')];_0x4e878f[_0x7196('0x20')]=_0x2d284f[_0x7196('0x20')];_0x4e878f[_0x7196('0x53')]=_0x2d284f['originated'];_0x4e878f[_0x7196('0x54')]=_0x2d284f[_0x7196('0x54')];_0x4e878f['erlangCallToSecond']=_0x2d284f[_0x7196('0x55')];_0x4e878f[_0x7196('0x56')]=_0x2d284f['erlangAbandonmentRate'];_0x4e878f[_0x7196('0x57')]=_0x2d284f[_0x7196('0x57')];_0x4e878f[_0x7196('0x58')]=_0x2d284f['startPredictive'];_0x4e878f[_0x7196('0x59')]=_0x2d284f[_0x7196('0x59')];}if(_0x2d284f['Trunk']){_0x4e878f[_0x7196('0x5a')]={'id':_0x2d284f[_0x7196('0x5a')]['id'],'name':_0x2d284f['Trunk'][_0x7196('0xc')],'active':_0x2d284f['Trunk']['active'],'callerid':_0x2d284f['Trunk']['callerid']};}if(_0x2d284f['Interval']){_0x4e878f[_0x7196('0x5b')]={'id':_0x2d284f['Interval']['id'],'name':_0x2d284f[_0x7196('0x5b')][_0x7196('0xc')]};}_0x70aa65[_0x7196('0x5c')](_0x4e878f);}}_0x2e15c7({'count':_0x70aa65[_0x7196('0x5d')],'rows':_0x70aa65});});},'UpdateVoiceQueue':function(_0x522fbd){return new Promise(function(_0x3f3171,_0x56ffdd){var _0x12ee76=_[_0x7196('0x5e')](_0x3ae43f[_0x7196('0x26')],{'id':parseInt(_0x522fbd['id'])});var _0x5e34e8=_[_0x7196('0x5f')](_0x522fbd,['id']);if(_0x12ee76){for(var _0x44d8e5 in _0x5e34e8){if(typeof _0x5e34e8[_0x44d8e5]!==_0x7196('0x60')&&typeof _0x12ee76[_0x44d8e5]!=='undefined'){_0x12ee76[_0x44d8e5]=_0x5e34e8[_0x44d8e5];}}_0x3f3171(_0x12ee76);}else{_0x56ffdd();}});},'VoiceChannels':function(_0x4e2aad){return new Promise(function(_0x1faa7b,_0x5a7896){var _0x29c7e8=_['values'](_0x3ae43f['channels']);_0x1faa7b({'count':_0x29c7e8[_0x7196('0x5d')],'rows':_0x29c7e8});});},'VoiceChannelMixMonitor':function(_0x5de6f2){var _0x48f5e7=this;return new Promise(function(_0x516825,_0x2299e2){if(ami['isConnected']()==![]){return _0x2299e2(_0x48f5e7['error'](0x1f4,[config[_0x7196('0x16')]['ip'],config[_0x7196('0x16')][_0x7196('0x17')],_0x7196('0x61')]['join']('\x20')));}var _0x50cc66=schema(properties['voicechannel'])[_0x7196('0x2')](_0x5de6f2);if(_0x50cc66[_0x7196('0x5d')]>0x0){return _0x2299e2(_0x48f5e7['error'](0x1f4,_[_0x7196('0x62')](_0x50cc66,_0x7196('0x20'))[_0x7196('0x18')](',\x20')));}var _0x4fa18f=_[_0x7196('0x5e')](_0x3ae43f['channels'],{'uniqueid':_0x5de6f2[_0x7196('0x63')]});if(_0x4fa18f&&_0x4fa18f[_0x7196('0x64')]){var _0x179815=util[_0x7196('0x9')](_0x7196('0x65'),_0x5de6f2[_0x7196('0x66')]||_0x5de6f2[_0x7196('0x63')],_0x5de6f2[_0x7196('0x9')]||'wav');return ami['Action']({'action':_0x7196('0x67'),'channel':_0x4fa18f[_0x7196('0x64')],'file':_0x179815,'options':_0x7196('0x68')})[_0x7196('0x1f')](function(_0x4ebcd7){var _0x76b189=_[_0x7196('0x5e')](_0x4fa18f[_0x7196('0x69')],{'filename':_0x7196('0x6a')+_0x179815[_0x7196('0x6b')]()});if(_[_0x7196('0x6c')](_0x76b189)){_0x4fa18f[_0x7196('0x69')][_0x7196('0x5c')]({'filename':_0x7196('0x6a')+_0x179815[_0x7196('0x6b')](),'createdAt':moment()[_0x7196('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x4ebcd7[_0x7196('0x6d')],'status':_0x7196('0x6e')});}else{_0x76b189[_0x7196('0x6d')]=_0x4ebcd7['mixmonitorid'];_0x76b189[_0x7196('0x6f')]='rec';}_0x516825({'code':0xc8,'message':[_0x5de6f2[_0x7196('0x63')],_0x7196('0x70'),_0x4ebcd7[_0x7196('0x6d')]][_0x7196('0x18')]('\x20'),'mixmonitorid':_0x4ebcd7[_0x7196('0x6d')]});})['catch'](function(_0x3ece9f){_0x2299e2(_0x48f5e7['error'](0x1f5,[_0x5de6f2['uniqueid'],_0x3ece9f['message'][_0x7196('0x6b')]()][_0x7196('0x18')]('\x20')));});}else{return _0x2299e2(_0x48f5e7[_0x7196('0x15')](0x1f5,_0x7196('0x71')));}});},'VoiceChannelStopMixMonitor':function(_0x105a3f){var _0x41fa94=this;return new Promise(function(_0x2d8b3d,_0x560ddb){if(ami[_0x7196('0x14')]()==![]){return _0x560ddb(_0x41fa94[_0x7196('0x15')](0x1f4,[config[_0x7196('0x16')]['ip'],config[_0x7196('0x16')][_0x7196('0x17')],'ami\x20disconnected']['join']('\x20')));}var _0xa7ecfb=schema(properties[_0x7196('0x72')])[_0x7196('0x2')](_0x105a3f);if(_0xa7ecfb[_0x7196('0x5d')]>0x0){return _0x560ddb(_0x41fa94[_0x7196('0x15')](0x1f4,_[_0x7196('0x62')](_0xa7ecfb,_0x7196('0x20'))[_0x7196('0x18')](',\x20')));}var _0x13e9d0=_[_0x7196('0x5e')](_0x3ae43f[_0x7196('0x73')],{'uniqueid':_0x105a3f['uniqueid']});if(_0x13e9d0){return BPromise[_0x7196('0x74')]()[_0x7196('0x1f')](function(){if(_0x13e9d0[_0x7196('0x64')]){return ami[_0x7196('0x1e')]({'action':'StopMixMonitor','channel':_0x13e9d0[_0x7196('0x64')],'mixmonitorid':_0x105a3f[_0x7196('0x6d')]})[_0x7196('0x21')](function(_0x38d0a0){});}})[_0x7196('0x1f')](function(){if(_0x13e9d0[_0x7196('0x75')]){return ami[_0x7196('0x1e')]({'action':'StopMixMonitor','channel':_0x13e9d0[_0x7196('0x75')],'mixmonitorid':_0x105a3f[_0x7196('0x6d')]})[_0x7196('0x21')](function(_0x3fb671){});}})['then'](function(_0x418a7a){var _0x3809c4=_[_0x7196('0x5e')](_0x13e9d0[_0x7196('0x69')],{'mixmonitorid':_0x105a3f[_0x7196('0x6d')]});if(_0x3809c4){_0x3809c4[_0x7196('0x6f')]=_0x7196('0x76');}})['then'](function(){var _0x56b2eb=util['format'](_0x7196('0x65'),_0x105a3f['filename']||_0x105a3f[_0x7196('0x63')],_0x105a3f[_0x7196('0x9')]||_0x7196('0x77'));var _0x37c7d4=_[_0x7196('0x5e')](_0x13e9d0[_0x7196('0x69')],{'filename':_0x7196('0x6a')+_0x56b2eb[_0x7196('0x6b')]()});if(_0x37c7d4){_0x37c7d4[_0x7196('0x6f')]='stop';}})['then'](function(){_0x2d8b3d({'code':0xc8,'message':[_0x105a3f[_0x7196('0x63')],_0x7196('0x78')][_0x7196('0x18')]('\x20')});})[_0x7196('0x21')](function(_0x30ddb6){_0x560ddb(_0x41fa94[_0x7196('0x15')](0x1f5,[_0x105a3f[_0x7196('0x63')],_0x30ddb6[_0x7196('0x20')]['toLowerCase']()]['join']('\x20')));});}else{return _0x560ddb(_0x41fa94[_0x7196('0x15')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x30d114){return new Promise(function(_0x52f532,_0x18efc7){var _0x2ffe1f=_[_0x7196('0x79')](_0x3ae43f[_0x7196('0x7a')]);_0x52f532({'count':_0x2ffe1f['length'],'rows':_0x2ffe1f});});},'VoiceQueuesChannel':function(_0x5a786a){var _0x33d301=this;return new Promise(function(_0x5328c5,_0x3d2bee){var _0x326f61=schema(properties[_0x7196('0x7b')])[_0x7196('0x2')](_0x5a786a);if(_0x326f61[_0x7196('0x5d')]>0x0){return _0x3d2bee(_0x33d301[_0x7196('0x15')](0x1f4,_['map'](_0x326f61,_0x7196('0x20'))[_0x7196('0x18')](',\x20')));}var _0x41208b=_[_0x7196('0x5e')](_0x3ae43f[_0x7196('0x7a')],{'uniqueid':_0x5a786a[_0x7196('0x63')]});if(_0x41208b){_0x5328c5(_0x41208b);}else{return _0x3d2bee(_0x33d301[_0x7196('0x15')](0x1f5,_0x7196('0x71')));}});},'VoiceQueuesChannelHangup':function(_0x13cbe2){var _0xa20de8=this;return new Promise(function(_0x3d3768,_0x2181f5){if(ami['isConnected']()==![]){return _0x2181f5(_0xa20de8[_0x7196('0x15')](0x1f4,[config[_0x7196('0x16')]['ip'],config['asterisk']['username'],_0x7196('0x61')][_0x7196('0x18')]('\x20')));}var _0x71c062=schema(properties['voicequeuechannelhangup'])[_0x7196('0x2')](_0x13cbe2);if(_0x71c062['length']>0x0){return _0x2181f5(_0xa20de8[_0x7196('0x15')](0x1f4,_[_0x7196('0x62')](_0x71c062,'message')[_0x7196('0x18')](',\x20')));}var _0x59f5ac=_['find'](_0x3ae43f[_0x7196('0x7a')],{'uniqueid':_0x13cbe2[_0x7196('0x63')]});if(_0x59f5ac&&_0x59f5ac[_0x7196('0x64')]){return ami['Action']({'action':_0x7196('0x7c'),'channel':_0x59f5ac['channel']})[_0x7196('0x1f')](function(_0x36b828){_0x3d3768({'code':0xc8,'message':[_0x13cbe2[_0x7196('0x63')],_0x36b828[_0x7196('0x20')][_0x7196('0x6b')]()]['join']('\x20')});})[_0x7196('0x21')](function(_0x13c8c0){_0x2181f5(_0xa20de8[_0x7196('0x15')](0x1f5,[_0x13cbe2[_0x7196('0x63')],_0x13c8c0[_0x7196('0x20')][_0x7196('0x6b')]()][_0x7196('0x18')]('\x20')));});}else{return _0x2181f5(_0xa20de8[_0x7196('0x15')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x2be199){var _0x1919d8=this;return new Promise(function(_0x28a29d,_0x2b899d){if(ami['isConnected']()==![]){return _0x2b899d(_0x1919d8[_0x7196('0x15')](0x1f4,[config[_0x7196('0x16')]['ip'],config['asterisk'][_0x7196('0x17')],'ami\x20disconnected'][_0x7196('0x18')]('\x20')));}var _0x5318c1=schema(properties[_0x7196('0x7d')])[_0x7196('0x2')](_0x2be199);if(_0x5318c1['length']>0x0){return _0x2b899d(_0x1919d8[_0x7196('0x15')](0x1f4,_[_0x7196('0x62')](_0x5318c1,_0x7196('0x20'))['join'](',\x20')));}var _0x548ac9=_[_0x7196('0x5e')](_0x3ae43f['queueChannels'],{'uniqueid':_0x2be199['uniqueid']});if(_0x548ac9&&_0x548ac9[_0x7196('0x64')]){return ami[_0x7196('0x1e')]({'action':_0x7196('0x7e'),'channel':_0x548ac9['channel'],'exten':_0x2be199[_0x7196('0x7f')],'context':_0x2be199[_0x7196('0x80')]||_0x548ac9[_0x7196('0x80')],'priority':0x1})[_0x7196('0x1f')](function(_0x3392d1){_0x28a29d({'code':0xc8,'message':[_0x2be199[_0x7196('0x63')],_0x3392d1[_0x7196('0x20')][_0x7196('0x6b')]()][_0x7196('0x18')]('\x20')});})[_0x7196('0x21')](function(_0x173fe5){_0x2b899d(_0x1919d8['error'](0x1f5,[_0x2be199['uniqueid'],_0x173fe5[_0x7196('0x20')]['toLowerCase']()]['join']('\x20')));});}else{return _0x2b899d(_0x1919d8[_0x7196('0x15')](0x1f5,_0x7196('0x71')));}});},'Agents':function(_0x2f686c){return new Promise(function(_0x3fe7fd,_0x4c9a66){var _0x50f2c4=_[_0x7196('0x79')](_0x3ae43f[_0x7196('0x10')]);_0x3fe7fd({'count':_0x50f2c4[_0x7196('0x5d')],'rows':_0x50f2c4});});},'Telephones':function(_0x247b15){return new Promise(function(_0x4bcaa3,_0x4d8b8e){var _0x4afbee=_['values'](_0x3ae43f[_0x7196('0x81')]);_0x4bcaa3({'count':_0x4afbee[_0x7196('0x5d')],'rows':_0x4afbee});});},'Trunks':function(_0x1e14da){return new Promise(function(_0x494418,_0x400aa5){var _0x40d4c3=_[_0x7196('0x79')](_0x3ae43f[_0x7196('0x82')]);_0x494418({'count':_0x40d4c3[_0x7196('0x5d')],'rows':_0x40d4c3});});},'OutboundChannels':function(_0x3e06c4){return new Promise(function(_0x214ec2,_0x3e729a){var _0x5de550=_[_0x7196('0x79')](_0x3ae43f[_0x7196('0x83')]);_0x214ec2({'count':_0x5de550[_0x7196('0x5d')],'rows':_0x5de550});});},'Outbound':function(_0x408760){return new Promise(function(_0x1a1c82,_0x4faf7b){_0x1a1c82(_0x3ae43f[_0x7196('0x84')]);});},'Campaigns':function(_0x11d823){return new Promise(function(_0x446eb8,_0x5a8c14){var _0x123e8c=_['values'](_0x3ae43f['campaigns']);_0x446eb8({'count':_0x123e8c[_0x7196('0x5d')],'rows':_0x123e8c});});},'VoiceQueuesPreview':function(_0x25d323){var _0x5b85f7=this;return new Promise(function(_0x200721,_0x40eb16){_0x5c128f['run'](_0x25d323['id'])[_0x7196('0x1f')](function(_0xdd5f69){_0x200721({'code':0xc8,'message':_0xdd5f69[_0x7196('0x20')]});})[_0x7196('0x21')](function(_0x441ca1){_0x40eb16(_0x5b85f7[_0x7196('0x15')](0x1f4,_0x441ca1['message']));});});},'EventManager':function(_0x3639be){var _0x460e51=this;return new Promise(function(_0x1ee49a,_0x5b09a1){if(!_0x3639be['event']){return _0x5b09a1(_0x460e51['error'](0x1f4,_0x7196('0x85')));}ami[_0x7196('0x86')](_0x7196('0x87')+_0x3639be['event'],_0x3639be[_0x7196('0x20')]);_0x1ee49a({'code':0xc8,'message':_0x3639be});});},'FaxAccounts':function(_0x503d1f){return new Promise(function(_0x15395f,_0x4e22df){var _0x389b5b=_[_0x7196('0x79')](_0x3ae43f[_0x7196('0x88')]);_0x15395f({'count':_0x389b5b[_0x7196('0x5d')],'rows':_0x389b5b});});},'SendFax':function(_0x37290e){var _0x10b628=this;return new Promise(function(_0x43e7d5,_0x48608b){_0x36b01e[_0x7196('0x89')](_0x37290e)['then'](function(_0x58fd39){_0x43e7d5({'code':0xc8,'message':_0x58fd39['message']});})['catch'](function(_0x4cf635){_0x48608b(_0x10b628[_0x7196('0x15')](0x1f4,_0x4cf635[_0x7196('0x20')]));});});},'CheckAfterSend':function(_0x3fe3f5){var _0x5bab25=this;return new Promise(function(_0x3e7195,_0x49bf7e){_0x36b01e['checkAfterSend'](_0x3fe3f5)['then'](function(_0x42b45d){_0x3e7195({'code':0xc8,'message':_0x42b45d['message']});})[_0x7196('0x21')](function(_0x2fe382){_0x49bf7e(_0x5bab25[_0x7196('0x15')](0x1f4,_0x2fe382[_0x7196('0x20')]));});});}};var _0x1cdb13=jayson[_0x7196('0x8a')](_0x40e0af)[_0x7196('0x8b')]();_0x1cdb13['on'](_0x7196('0x15'),function(_0x49d494){return _0x194746(_0x49d494);});_0x1cdb13[_0x7196('0x8')](0x232a,_0x7196('0x8c'),function(){console[_0x7196('0x8d')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x186175(_0x7196('0x8e')+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 c4704a3..4358343 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 _0xbec5=['fax','scheduledAt','union','resolve','then','getContacts','length','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridnum','destcalleridnum','calleridname','','Unknown','destcalleridname','createContact','[CM][%s][%s]\x20Autocreate\x20disabled','push','user:%s','name','trigger:%s','toLowerCase','merge','lodash','bluebird','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','defaults','redis','localhost','info','[CM][%s][%s]','emit','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','map','routeId','firstName','phone','mobile'];(function(_0x247144,_0x44f6db){var _0x26788f=function(_0x52e744){while(--_0x52e744){_0x247144['push'](_0x247144['shift']());}};_0x26788f(++_0x44f6db);}(_0xbec5,0xe5));var _0x5bec=function(_0x4bc4c8,_0x3139d3){_0x4bc4c8=_0x4bc4c8-0x0;var _0x3bb121=_0xbec5[_0x4bc4c8];return _0x3bb121;};'use strict';var _=require(_0x5bec('0x0'));var BPromise=require(_0x5bec('0x1'));var Redis=require('ioredis');var util=require(_0x5bec('0x2'));var config=require(_0x5bec('0x3'));var logger=require(_0x5bec('0x4'))(_0x5bec('0x5'));var cmContactRpc=require(_0x5bec('0x6'));config['redis']=_[_0x5bec('0x7')](config[_0x5bec('0x8')],{'host':_0x5bec('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5bec('0x8')]));function emit(_0x28a427,_0x38456e,_0x406e65,_0x43d96e,_0x302aae){logger[_0x5bec('0xa')](_0x5bec('0xb'),_0x28a427,_0x38456e['id'],_0x406e65,_0x43d96e,JSON['stringify'](_0x302aae));io['to'](_0x406e65)[_0x5bec('0xc')](_0x43d96e,_0x302aae);}exports['exec']=function(_0x748f75,_0x2a70a7,_0x117162,_0x4a5482){var _0x288d1b,_0x18fa47;var _0x16226b={};var _0x57ffc4=Number(_0x117162[_0x5bec('0xd')]);var _0x1c888f=_0x117162['data2']?Boolean(Number(_0x117162[_0x5bec('0xe')])):![];var _0xaa984d;var _0x35393a=![];if(!_[_0x5bec('0xf')](_0x117162[_0x5bec('0x10')])){if(_0x117162[_0x5bec('0x10')]=='1')_0x35393a=!![];}if(!_0x35393a){if(_0x4a5482[_0x5bec('0x11')]){_0x16226b['id']=_0x4a5482[_0x5bec('0x11')];}}if(!_0x16226b['id']){_0x16226b[_0x5bec('0x12')]=_0x57ffc4;_0xaa984d=_0x117162[_0x5bec('0x13')]&&_0x117162[_0x5bec('0x13')]!=='0'?_0x117162[_0x5bec('0x13')][_0x5bec('0x14')](','):['phone'];_0x16226b['$or']=_[_0x5bec('0x15')](_0xaa984d,function(_0x773740){var _0x31ad9c={};_0x31ad9c[_0x773740]=_0x4a5482[_0x5bec('0x16')]?_0x4a5482['destcalleridnum']:_0x4a5482['calleridnum'];return _0x31ad9c;});}var _0x3cd354=['id',_0x5bec('0x17'),'lastName',_0x5bec('0x18'),_0x5bec('0x19'),_0x5bec('0x1a'),_0x5bec('0x12'),'createdAt',_0x5bec('0x1b'),'updatedAt'];var _0x191c0f=_[_0x5bec('0x1c')](_0x3cd354,_0xaa984d);BPromise[_0x5bec('0x1d')]()[_0x5bec('0x1e')](cmContactRpc[_0x5bec('0x1f')]({'attributes':_0x191c0f,'where':_0x16226b}))['then'](function(_0x232584){_0x18fa47=_0x232584;if(!_['isEmpty'](_0x18fa47)){if(_0x18fa47[_0x5bec('0x20')]===0x1){_0x288d1b=_0x18fa47[0x0];logger[_0x5bec('0xa')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x4a5482[_0x5bec('0x21')],_0x2a70a7['id'],_0x288d1b['id']);}else{logger[_0x5bec('0xa')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x4a5482[_0x5bec('0x21')],_0x2a70a7['id'],_[_0x5bec('0x15')](_0x18fa47,'id')[_0x5bec('0x22')](','));}return;}else{logger[_0x5bec('0xa')](_0x5bec('0x23'),_0x4a5482[_0x5bec('0x21')],_0x2a70a7['id']);var _0x2dc014={'ListId':_0x57ffc4};var _0x4de66a=_0x117162['data4']&&_0x117162['data4']!=='0'?_0x117162[_0x5bec('0x24')]:_0x5bec('0x18');if(_0x1c888f){logger[_0x5bec('0xa')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x4a5482[_0x5bec('0x21')],_0x2a70a7['id']);_0x2dc014[_0x4de66a]=_[_0x5bec('0xf')](_0x4a5482['routeId'])?_0x4a5482[_0x5bec('0x25')]:_0x4a5482[_0x5bec('0x26')];if(_['isNil'](_0x4a5482['routeId'])){_0x2dc014[_0x5bec('0x17')]=_0x4a5482[_0x5bec('0x27')]&&_0x4a5482[_0x5bec('0x27')]!==_0x5bec('0x28')?_0x4a5482[_0x5bec('0x27')]:_0x5bec('0x29');}else{_0x2dc014['firstName']=_0x4a5482[_0x5bec('0x2a')]&&_0x4a5482['destcalleridname']!==_0x5bec('0x28')?_0x4a5482[_0x5bec('0x2a')]:_0x5bec('0x29');}return BPromise[_0x5bec('0x1d')]()['then'](cmContactRpc[_0x5bec('0x2b')](_0x2dc014))[_0x5bec('0x1e')](function(_0xfc7d41){_0x288d1b=_0xfc7d41;_0x18fa47['push'](_0xfc7d41);if(_0x288d1b){logger[_0x5bec('0xa')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x4a5482[_0x5bec('0x21')],_0x2a70a7['id'],_0x288d1b['id']);}return;});}else{logger[_0x5bec('0xa')](_0x5bec('0x2c'),_0x4a5482['uniqueid'],_0x2a70a7['id']);_0x2dc014[_0x4de66a]=_[_0x5bec('0xf')](_0x4a5482[_0x5bec('0x16')])?_0x4a5482['calleridnum']:_0x4a5482[_0x5bec('0x26')];if(_[_0x5bec('0xf')](_0x4a5482[_0x5bec('0x16')])){_0x2dc014[_0x5bec('0x17')]=_0x4a5482[_0x5bec('0x27')]&&_0x4a5482['calleridname']!==_0x5bec('0x28')?_0x4a5482['calleridname']:_0x5bec('0x29');}else{_0x2dc014[_0x5bec('0x17')]=_0x4a5482[_0x5bec('0x2a')]&&_0x4a5482[_0x5bec('0x2a')]!==_0x5bec('0x28')?_0x4a5482[_0x5bec('0x2a')]:'Unknown';}_0x288d1b=_0x2dc014;_0x18fa47[_0x5bec('0x2d')](_0x2dc014);return;}}})[_0x5bec('0x1e')](function(){if(_0x748f75){emit(_0x4a5482[_0x5bec('0x21')],_0x2a70a7,util['format'](_0x5bec('0x2e'),_0x748f75[_0x5bec('0x2f')]),util['format'](_0x5bec('0x30'),_0x117162['action'][_0x5bec('0x31')]()),{'evt':_[_0x5bec('0x32')](_0x4a5482,{'autoCreate':_0x1c888f}),'contact':_0x288d1b===undefined?{}:_0x288d1b,'contacts':_0x18fa47[_0x5bec('0x20')]===0x0?undefined:_0x18fa47});}});}; \ No newline at end of file +var _0x0e85=['data4','[CM][%s][%s]\x20Autocreate\x20enabled','routeId','calleridname','','Unknown','destcalleridname','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','user:%s','name','toLowerCase','merge','lodash','bluebird','util','../../../../config/environment','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data1','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','destcalleridnum','calleridnum','firstName','lastName','mobile','scheduledAt','updatedAt','union','resolve','getContacts','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found'];(function(_0x42bb6d,_0x412255){var _0x1db89b=function(_0x5da43a){while(--_0x5da43a){_0x42bb6d['push'](_0x42bb6d['shift']());}};_0x1db89b(++_0x412255);}(_0x0e85,0x7c));var _0x50e8=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x0e85[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0x50e8('0x0'));var BPromise=require(_0x50e8('0x1'));var Redis=require('ioredis');var util=require(_0x50e8('0x2'));var config=require(_0x50e8('0x3'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require('../../rpc/cmContact');config[_0x50e8('0x4')]=_['defaults'](config[_0x50e8('0x4')],{'host':_0x50e8('0x5'),'port':0x18eb});var io=require(_0x50e8('0x6'))(new Redis(config[_0x50e8('0x4')]));function emit(_0x5e8b01,_0x3ce904,_0x108edc,_0x42665e,_0x988da0){logger[_0x50e8('0x7')](_0x50e8('0x8'),_0x5e8b01,_0x3ce904['id'],_0x108edc,_0x42665e,JSON['stringify'](_0x988da0));io['to'](_0x108edc)[_0x50e8('0x9')](_0x42665e,_0x988da0);}exports[_0x50e8('0xa')]=function(_0x19d1bc,_0x2d4750,_0x154b9e,_0x194a89){var _0x45dc6f,_0x3d25ea;var _0x55ba0a={};var _0x56707f=Number(_0x154b9e[_0x50e8('0xb')]);var _0x24d381=_0x154b9e['data2']?Boolean(Number(_0x154b9e['data2'])):![];var _0x3cb45c;var _0x2abda1=![];if(!_[_0x50e8('0xc')](_0x154b9e[_0x50e8('0xd')])){if(_0x154b9e['data5']=='1')_0x2abda1=!![];}if(!_0x2abda1){if(_0x194a89[_0x50e8('0xe')]){_0x55ba0a['id']=_0x194a89[_0x50e8('0xe')];}}if(!_0x55ba0a['id']){_0x55ba0a[_0x50e8('0xf')]=_0x56707f;_0x3cb45c=_0x154b9e['data3']&&_0x154b9e['data3']!=='0'?_0x154b9e[_0x50e8('0x10')][_0x50e8('0x11')](','):[_0x50e8('0x12')];_0x55ba0a[_0x50e8('0x13')]=_[_0x50e8('0x14')](_0x3cb45c,function(_0x1f0338){var _0x5642bf={};_0x5642bf[_0x1f0338]=_0x194a89['routeId']?_0x194a89[_0x50e8('0x15')]:_0x194a89[_0x50e8('0x16')];return _0x5642bf;});}var _0x40d060=['id',_0x50e8('0x17'),_0x50e8('0x18'),_0x50e8('0x12'),_0x50e8('0x19'),'fax',_0x50e8('0xf'),'createdAt',_0x50e8('0x1a'),_0x50e8('0x1b')];var _0xd263d=_[_0x50e8('0x1c')](_0x40d060,_0x3cb45c);BPromise[_0x50e8('0x1d')]()['then'](cmContactRpc[_0x50e8('0x1e')]({'attributes':_0xd263d,'where':_0x55ba0a}))[_0x50e8('0x1f')](function(_0x58110d){_0x3d25ea=_0x58110d;if(!_[_0x50e8('0x20')](_0x3d25ea)){if(_0x3d25ea[_0x50e8('0x21')]===0x1){_0x45dc6f=_0x3d25ea[0x0];logger['info'](_0x50e8('0x22'),_0x194a89[_0x50e8('0x23')],_0x2d4750['id'],_0x45dc6f['id']);}else{logger['info']('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x194a89['uniqueid'],_0x2d4750['id'],_[_0x50e8('0x14')](_0x3d25ea,'id')[_0x50e8('0x24')](','));}return;}else{logger[_0x50e8('0x7')](_0x50e8('0x25'),_0x194a89[_0x50e8('0x23')],_0x2d4750['id']);var _0x13b6e9={'ListId':_0x56707f};var _0x53d848=_0x154b9e[_0x50e8('0x26')]&&_0x154b9e[_0x50e8('0x26')]!=='0'?_0x154b9e['data4']:_0x50e8('0x12');if(_0x24d381){logger[_0x50e8('0x7')](_0x50e8('0x27'),_0x194a89[_0x50e8('0x23')],_0x2d4750['id']);_0x13b6e9[_0x53d848]=_['isNil'](_0x194a89[_0x50e8('0x28')])?_0x194a89['calleridnum']:_0x194a89[_0x50e8('0x15')];if(_[_0x50e8('0xc')](_0x194a89[_0x50e8('0x28')])){_0x13b6e9['firstName']=_0x194a89[_0x50e8('0x29')]&&_0x194a89[_0x50e8('0x29')]!==_0x50e8('0x2a')?_0x194a89[_0x50e8('0x29')]:_0x50e8('0x2b');}else{_0x13b6e9[_0x50e8('0x17')]=_0x194a89[_0x50e8('0x2c')]&&_0x194a89['destcalleridname']!==_0x50e8('0x2a')?_0x194a89[_0x50e8('0x2c')]:'Unknown';}return BPromise['resolve']()[_0x50e8('0x1f')](cmContactRpc[_0x50e8('0x2d')](_0x13b6e9))[_0x50e8('0x1f')](function(_0x47ace2){_0x45dc6f=_0x47ace2;_0x3d25ea['push'](_0x47ace2);if(_0x45dc6f){logger[_0x50e8('0x7')](_0x50e8('0x2e'),_0x194a89['uniqueid'],_0x2d4750['id'],_0x45dc6f['id']);}return;});}else{logger[_0x50e8('0x7')](_0x50e8('0x2f'),_0x194a89[_0x50e8('0x23')],_0x2d4750['id']);_0x13b6e9[_0x53d848]=_[_0x50e8('0xc')](_0x194a89['routeId'])?_0x194a89[_0x50e8('0x16')]:_0x194a89['destcalleridnum'];if(_[_0x50e8('0xc')](_0x194a89[_0x50e8('0x28')])){_0x13b6e9[_0x50e8('0x17')]=_0x194a89['calleridname']&&_0x194a89[_0x50e8('0x29')]!==_0x50e8('0x2a')?_0x194a89['calleridname']:_0x50e8('0x2b');}else{_0x13b6e9[_0x50e8('0x17')]=_0x194a89[_0x50e8('0x2c')]&&_0x194a89[_0x50e8('0x2c')]!==''?_0x194a89[_0x50e8('0x2c')]:_0x50e8('0x2b');}_0x45dc6f=_0x13b6e9;_0x3d25ea[_0x50e8('0x30')](_0x13b6e9);return;}}})[_0x50e8('0x1f')](function(){if(_0x19d1bc){emit(_0x194a89['uniqueid'],_0x2d4750,util[_0x50e8('0x31')](_0x50e8('0x32'),_0x19d1bc[_0x50e8('0x33')]),util['format']('trigger:%s',_0x154b9e['action'][_0x50e8('0x34')]()),{'evt':_[_0x50e8('0x35')](_0x194a89,{'autoCreate':_0x24d381}),'contact':_0x45dc6f===undefined?{}:_0x45dc6f,'contacts':_0x3d25ea[_0x50e8('0x21')]===0x0?undefined:_0x3d25ea});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 2147db2..199773d 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 _0xe764=['location','uriLocation','800','600','data6','winApplication','winArguments','data3','format','user:%s','name','trigger:%s:%s','jscripty','trigger:%s','action','merge','exec','integration','queue','routeId','urlforward','script','parse','replace','channel','motionChannel','AllConditions','checkConditions','some','field','account','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','agent','membername','lastevent','exports','util','lodash','mustache','ioredis','../../../config/logger','trigger','../ami','redis','defaults','socket.io-emitter','popup','url','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','zohoAccounts','custom:agentcalled','bind','custom:agentconnect','custom:agentringnoanswer','syncCustomEvent','custom:agentnosuchnumber','custom:agentbusy','custom:agentcongestion','custom:amd','custom:timeout','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','voice','checkTriggers','interface','hasOwnProperty','checkTrigger','variables','Actions','length','toLowerCase','contactmanager','motionbar','data1','html','data2','render','template\x20not\x20found','uri','buildUri','isNil','data4'];(function(_0x27c323,_0x419965){var _0xd4946f=function(_0x2ed904){while(--_0x2ed904){_0x27c323['push'](_0x27c323['shift']());}};_0xd4946f(++_0x419965);}(_0xe764,0x9e));var _0x4e76=function(_0x4bacb6,_0x2b299d){_0x4bacb6=_0x4bacb6-0x0;var _0x58c029=_0xe764[_0x4bacb6];return _0x58c029;};'use strict';var util=require(_0x4e76('0x0'));var _=require(_0x4e76('0x1'));var url=require('url');var Mustache=require(_0x4e76('0x2'));var Redis=require(_0x4e76('0x3'));var urlforward=require('./urlforward');var integration=require('./integration');var cmContact=require('./cmContact');var script=require('./script');var config=require('../../../config/environment');var logger=require(_0x4e76('0x4'))(_0x4e76('0x5'));var ami=require(_0x4e76('0x6'));config[_0x4e76('0x7')]=_[_0x4e76('0x8')](config[_0x4e76('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x4e76('0x9'))(new Redis(config[_0x4e76('0x7')]));var operators={'equals':function(_0x5559f3,_0x166235){return _0x5559f3==_0x166235;},'not_equals':function(_0x52e4a5,_0x1e54e0){return _0x52e4a5!=_0x1e54e0;}};var barAndWebActions=[_0x4e76('0xa'),_0x4e76('0xb'),_0x4e76('0xc')];function Trigger(_0x5404c1){this['triggers']=_0x5404c1[_0x4e76('0xd')];this[_0x4e76('0xe')]=_0x5404c1[_0x4e76('0xe')];this[_0x4e76('0xf')]=_0x5404c1['voiceQueues'];this['templates']=_0x5404c1[_0x4e76('0x10')];this['voiceExtensions']=_0x5404c1[_0x4e76('0x11')];this[_0x4e76('0x12')]=_0x5404c1['zendeskAccounts'];this['freshdeskAccounts']=_0x5404c1[_0x4e76('0x13')];this[_0x4e76('0x14')]=_0x5404c1['salesforceAccounts'];this[_0x4e76('0x15')]=_0x5404c1['sugarcrmAccounts'];this['zohoAccounts']=_0x5404c1['zohoAccounts'];this[_0x4e76('0x16')]=_0x5404c1[_0x4e76('0x16')];this[_0x4e76('0x17')]=_0x5404c1[_0x4e76('0x17')];this[_0x4e76('0x18')]=_0x5404c1[_0x4e76('0x18')];this[_0x4e76('0x19')]=_0x5404c1['dynamics365Accounts'];this['freshsalesAccounts']=_0x5404c1[_0x4e76('0x1a')];this[_0x4e76('0x1b')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0x4e76('0x14')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x4e76('0x1c')],'desk':this['deskAccounts'],'vtiger':this[_0x4e76('0x17')],'dynamics365':this[_0x4e76('0x19')],'freshsales':this[_0x4e76('0x1a')],'servicenow':this[_0x4e76('0x18')]};ami['on'](_0x4e76('0x1d'),this['syncCustomEvent'][_0x4e76('0x1e')](this));ami['on'](_0x4e76('0x1f'),this['syncCustomEvent']['bind'](this));ami['on'](_0x4e76('0x20'),this[_0x4e76('0x21')][_0x4e76('0x1e')](this));ami['on']('custom:agentcomplete',this[_0x4e76('0x21')][_0x4e76('0x1e')](this));ami['on'](_0x4e76('0x22'),this[_0x4e76('0x21')]['bind'](this));ami['on']('custom:agentnoanswer',this[_0x4e76('0x21')][_0x4e76('0x1e')](this));ami['on'](_0x4e76('0x23'),this[_0x4e76('0x21')][_0x4e76('0x1e')](this));ami['on'](_0x4e76('0x24'),this[_0x4e76('0x21')][_0x4e76('0x1e')](this));ami['on']('custom:agentreject',this[_0x4e76('0x21')][_0x4e76('0x1e')](this));ami['on'](_0x4e76('0x25'),this['syncCustomEvent'][_0x4e76('0x1e')](this));ami['on']('custom:queuecallerabandon',this['syncCustomEvent']['bind'](this));ami['on'](_0x4e76('0x26'),this[_0x4e76('0x21')][_0x4e76('0x1e')](this));ami['on'](_0x4e76('0x27'),this['syncAgentDial'][_0x4e76('0x1e')](this));ami['on'](_0x4e76('0x28'),this[_0x4e76('0x29')][_0x4e76('0x1e')](this));ami['on'](_0x4e76('0x2a'),this[_0x4e76('0x29')][_0x4e76('0x1e')](this));ami['on'](_0x4e76('0x2b'),this['syncCustomEvent'][_0x4e76('0x1e')](this));ami['on'](_0x4e76('0x2c'),this['syncCustomEvent'][_0x4e76('0x1e')](this));ami['on'](_0x4e76('0x2d'),this[_0x4e76('0x21')][_0x4e76('0x1e')](this));ami['on'](_0x4e76('0x2e'),this[_0x4e76('0x21')]['bind'](this));ami['on'](_0x4e76('0x2f'),this['syncCustomEvent'][_0x4e76('0x1e')](this));ami['on'](_0x4e76('0x30'),this[_0x4e76('0x21')][_0x4e76('0x1e')](this));}Trigger[_0x4e76('0x31')][_0x4e76('0x32')]=function(_0x562157,_0x5b3ea2,_0x430e6c){logger[_0x4e76('0x33')](_0x562157,_0x5b3ea2,JSON['stringify'](_0x430e6c));io['to'](_0x562157)[_0x4e76('0x32')](_0x5b3ea2,_0x430e6c);};Trigger[_0x4e76('0x31')][_0x4e76('0x21')]=function(_0x51d799){var _0x8adeef=_['clone'](_0x51d799);if(typeof _0x8adeef['motionChannel']==='undefined'){_0x8adeef['motionChannel']=_0x4e76('0x34');}this[_0x4e76('0x35')](_0x8adeef);};Trigger[_0x4e76('0x31')]['syncAgentDial']=function(_0x5636a1){if(this[_0x4e76('0xe')][_0x5636a1[_0x4e76('0x36')]]){this[_0x4e76('0x21')](_0x5636a1);}};Trigger['prototype'][_0x4e76('0x35')]=function(_0x58e112){var _0x4c72a1;for(var _0x3d6c28 in this[_0x4e76('0xd')]){if(this[_0x4e76('0xd')][_0x4e76('0x37')](_0x3d6c28)){if(this[_0x4e76('0xd')][_0x3d6c28]['status']){_0x4c72a1=this[_0x4e76('0x38')](this[_0x4e76('0xd')][_0x3d6c28],_0x58e112);if(_0x4c72a1){_['merge'](_0x58e112,_0x58e112[_0x4e76('0x39')]);for(var _0x1b67aa=0x0,_0x2cc051,_0x4df679,_0x508dcc;_0x1b67aa0x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file +var _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(_0x58d7ab,_0x40a874){var _0xb54403=function(_0x504557){while(--_0x504557){_0x58d7ab['push'](_0x58d7ab['shift']());}};_0xb54403(++_0x40a874);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 a689eac..efceca2 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 _0x01be=['recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','bluebird','request-promise','util','./util','ioredis','../../../../config/logger','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','clientId','remoteUri','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','Bearer\x20','value','isNil','email','userEmail','length','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','internalemailaddress','toLowerCase','outbound','4.0','substring','lastIndexOf','enduserId','calleridnum','GET','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','telephone1',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','picklist','customField','indexOf','content','ticketType','incident','POST','incidents','assign','getString','Subjects','Descriptions','/contacts(','/systemusers(','phonecall','phonecalls','callDirection','queue','headers','odata-entityid','ticketId','format','user:%s','emit','trigger:browser:url','serverUrl','stripTrailingSlash','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL'];(function(_0x548f8c,_0x55245a){var _0x9827ac=function(_0x33e1a7){while(--_0x33e1a7){_0x548f8c['push'](_0x548f8c['shift']());}};_0x9827ac(++_0x55245a);}(_0x01be,0x136));var _0xe01b=function(_0x67b0ca,_0x235f9a){_0x67b0ca=_0x67b0ca-0x0;var _0x226329=_0x01be[_0x67b0ca];return _0x226329;};'use strict';var _=require(_0xe01b('0x0'));var BPromise=require(_0xe01b('0x1'));var rp=require(_0xe01b('0x2'));var util=require(_0xe01b('0x3'));var intUtil=require(_0xe01b('0x4'));var md5=require('md5');var Redis=require(_0xe01b('0x5'));var logger=require(_0xe01b('0x6'))('dynamics365');var config=require(_0xe01b('0x7'));config[_0xe01b('0x8')]=_[_0xe01b('0x9')](config[_0xe01b('0x8')],{'host':_0xe01b('0xa'),'port':0x18eb});var io=require(_0xe01b('0xb'))(new Redis(config['redis']));function getAuthToken(_0x31599c,_0x5ab7dc,_0xb847ad){var _0x428adb={'method':'POST','uri':_0x5ab7dc,'form':{'client_id':_0x31599c[_0xe01b('0xc')],'resource':_0x31599c[_0xe01b('0xd')],'username':_0x31599c['username'],'password':_0x31599c['password'],'grant_type':_0xe01b('0xe'),'client_secret':_0x31599c[_0xe01b('0xf')]},'json':!![]};return rp(_0x428adb)[_0xe01b('0x10')](function(_0x54dff2){return _0x54dff2[_0xe01b('0x11')];})[_0xe01b('0x12')](function(_0x34f0fd){logger[_0xe01b('0x13')]('['+[_0xb847ad[_0xe01b('0x14')]()]+_0xe01b('0x15'));return _0x34f0fd[_0xe01b('0x16')];});}function getUser(_0xd43915,_0x3e4b22,_0x49ed01,_0x21294e,_0x415fc2,_0x208f29){return new BPromise(function(_0x56778e,_0x2b17d4){return getAuthToken(_0x3e4b22,_0x21294e,_0x208f29)['then'](function(_0x232d83){var _0x4b6b4a={'method':'GET','uri':_0x415fc2+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0xe01b('0x17')+_0x232d83,'OData-Version':'4.0'},'json':!![]};return rp(_0x4b6b4a);})['then'](function(_0x1ece61){var _0x5536f3=_0x1ece61[_0xe01b('0x18')];var _0x67bf8c=![];var _0x35dca5=null;if(!_[_0xe01b('0x19')](_0x49ed01)){if(intUtil['validateEmail'](_0x49ed01[_0xe01b('0x1a')])){_0xd43915[_0xe01b('0x1b')]=_0x49ed01[_0xe01b('0x1a')];for(_0x35dca5=0x0;_0x35dca5<_0x5536f3[_0xe01b('0x1c')];_0x35dca5++){if(_0x5536f3[_0x35dca5]['internalemailaddress']===_0x49ed01['email']&&!_0x5536f3[_0x35dca5][_0xe01b('0x1d')]){_0x67bf8c=!![];logger[_0xe01b('0x1e')]('['+[_0x208f29[_0xe01b('0x14')]()]+_0xe01b('0x1f')+_0x5536f3[_0x35dca5][_0xe01b('0x20')]+'!');_0xd43915[_0xe01b('0x21')]=_0x5536f3[_0x35dca5][_0xe01b('0x20')];}}}}if(!_0x67bf8c){logger[_0xe01b('0x1e')]('['+[_0x208f29[_0xe01b('0x14')]()]+_0xe01b('0x22'));_0xd43915[_0xe01b('0x1b')]=_0x3e4b22[_0xe01b('0x23')];for(_0x35dca5=0x0;_0x35dca5<_0x5536f3[_0xe01b('0x1c')];_0x35dca5++){if(_0x5536f3[_0x35dca5][_0xe01b('0x24')]===_0x3e4b22[_0xe01b('0x23')]){_0xd43915[_0xe01b('0x21')]=_0x5536f3[_0x35dca5][_0xe01b('0x20')];}}}_0x56778e(_0xd43915);})[_0xe01b('0x12')](function(_0x327b5d){_0x2b17d4(_0x327b5d[_0xe01b('0x16')]);});});}function createEndUser(_0x540acf,_0x46822f,_0x5c83f6,_0x266938,_0x599b5a,_0x52741f){return new BPromise(function(_0x11940c,_0x224d49){return getAuthToken(_0x46822f,_0x5c83f6,_0x52741f)[_0xe01b('0x10')](function(_0x23b586){var _0x460d16=_0x52741f[_0xe01b('0x25')]()===_0xe01b('0x26')?_0x599b5a['destcalleridnum']:_0x599b5a['calleridnum'];var _0x48da7f={'method':'POST','uri':_0x266938+'contacts','body':{'telephone1':_0x460d16,'fullname':_0x460d16,'firstname':_0x460d16,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x540acf[_0xe01b('0x21')]+')'},'headers':{'Authorization':_0xe01b('0x17')+_0x23b586,'OData-Version':_0xe01b('0x27')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x48da7f);})[_0xe01b('0x10')](function(_0x4a8a38){var _0x4ccf01=_0x4a8a38['headers']['odata-entityid'];var _0x59e2f1=_0x4ccf01[_0xe01b('0x28')](_0x4ccf01['lastIndexOf']('(')+0x1,_0x4ccf01[_0xe01b('0x29')](')'));_0x540acf[_0xe01b('0x2a')]=_0x59e2f1;_0x11940c(_0x540acf);})[_0xe01b('0x12')](function(_0x47cce6){_0x224d49(_0x47cce6[_0xe01b('0x16')]);});});}function getEndUser(_0x856f29,_0x19a6b9,_0x3a7823,_0x13d5c4,_0x1aff54,_0x55e481){return new BPromise(function(_0x434046,_0x5a6f2f){var _0x5aa153=_0x55e481[_0xe01b('0x25')]()===_0xe01b('0x26')?_0x1aff54['destcalleridnum']:_0x1aff54[_0xe01b('0x2b')];return getAuthToken(_0x19a6b9,_0x3a7823,_0x55e481)[_0xe01b('0x10')](function(_0x14ea91){var _0x55e11a={'method':_0xe01b('0x2c'),'uri':_0x13d5c4+_0xe01b('0x2d')+_0x5aa153[_0xe01b('0x2e')]('+','%2b')+'\x27','headers':{'Authorization':_0xe01b('0x17')+_0x14ea91,'If-None-Match':null,'OData-Version':_0xe01b('0x27')},'json':!![]};return rp(_0x55e11a);})['then'](function(_0x2fc10e){var _0x45ab0f=null;if(_0x2fc10e){var _0x15217a=_0x2fc10e['value'];var _0xd97023=![];for(_0x45ab0f=0x0;_0x45ab0f<_0x15217a['length'];_0x45ab0f++){if(_0x15217a[_0x45ab0f][_0xe01b('0x2f')]===_0x5aa153){_0xd97023=!![];_0x856f29[_0xe01b('0x2a')]=_0x15217a[_0x45ab0f]['contactid'];}}if(_0xd97023){_0x434046(_0x856f29);}else{return createEndUser(_0x856f29,_0x19a6b9,_0x3a7823,_0x13d5c4,_0x1aff54,_0x55e481)[_0xe01b('0x10')](function(_0x4ed05e){logger[_0xe01b('0x1e')]('['+[_0x55e481['toUpperCase']()]+_0xe01b('0x30'),_0x4ed05e[_0xe01b('0x2a')]);_0x434046(_0x4ed05e);});}}else{return createEndUser(_0x856f29,_0x19a6b9,_0x3a7823,_0x13d5c4,_0x1aff54,_0x55e481)[_0xe01b('0x10')](function(_0x169854){logger[_0xe01b('0x1e')]('['+[_0x55e481[_0xe01b('0x14')]()]+_0xe01b('0x31'),_0x169854[_0xe01b('0x2a')]);_0x434046(_0x169854);});}});});}function getCustomFields(_0x41446c,_0x1b1286,_0x425c2e){var _0x55cb85={};if(_0x41446c[_0xe01b('0x1c')]>0x0){_[_0xe01b('0x32')](_0x41446c,function(_0x5e5151){if(_[_0xe01b('0x33')]([_0xe01b('0x34'),_0xe01b('0x35')],_0x5e5151['type'])&&_0x5e5151['nameField']&&!_0x5e5151[_0xe01b('0x36')]){var _0x12b52b=_0x5e5151['idField'][_0xe01b('0x25')]();var _0x1932ce=_0x12b52b[_0xe01b('0x28')](0x0,_0x12b52b[_0xe01b('0x37')]('_'));var _0x24e5a2=_0x12b52b['substring'](_0x12b52b['indexOf']('_')+0x1);if(_0x1932ce===_0x425c2e){_0x55cb85[_0x24e5a2]=_0x5e5151[_0xe01b('0x38')];}}});}return _0x55cb85;}function getTicket(_0x46c582,_0x1128c9,_0x4d51b1,_0xf992a3,_0x576faa,_0x356111,_0x5df112){return new BPromise(function(_0x4507bf,_0x543aed){var _0x48eab6;return getAuthToken(_0x1128c9,_0x4d51b1,_0x5df112)[_0xe01b('0x10')](function(_0x2eeb02){if(_0x356111[_0xe01b('0x39')]===_0xe01b('0x3a')){_0x48eab6={'method':_0xe01b('0x3b'),'uri':_0xf992a3+_0xe01b('0x3c'),'body':Object[_0xe01b('0x3d')]({},{'title':intUtil[_0xe01b('0x3e')](_0x356111[_0xe01b('0x3f')],_0x576faa,'\x20'),'description':intUtil[_0xe01b('0x3e')](_0x356111[_0xe01b('0x40')],_0x576faa,'\x0a'),'customerid_contact@odata.bind':_0xe01b('0x41')+_0x46c582[_0xe01b('0x2a')]+')','ownerid@odata.bind':_0xe01b('0x42')+_0x46c582[_0xe01b('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x356111['Fields'],_0x576faa,_0x356111[_0xe01b('0x39')])),'headers':{'Authorization':_0xe01b('0x17')+_0x2eeb02,'OData-Version':_0xe01b('0x27')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x356111[_0xe01b('0x39')]===_0xe01b('0x43')){_0x48eab6={'method':_0xe01b('0x3b'),'uri':_0xf992a3+_0xe01b('0x44'),'body':Object[_0xe01b('0x3d')]({},{'subject':intUtil[_0xe01b('0x3e')](_0x356111['Subjects'],_0x576faa,'\x20'),'phonenumber':String(_0x576faa[_0xe01b('0x2b')]),'description':intUtil['getString'](_0x356111['Descriptions'],_0x576faa,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x46c582[_0xe01b('0x2a')]+')','ownerid@odata.bind':_0xe01b('0x42')+_0x46c582[_0xe01b('0x21')]+')','directioncode':_0x46c582[_0xe01b('0x45')]===_0xe01b('0x46')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xe01b('0x42')+_0x46c582[_0xe01b('0x21')]+')','participationtypemask':_0x46c582[_0xe01b('0x45')]===_0xe01b('0x46')?0x2:0x1},{'partyid_contact@odata.bind':_0xe01b('0x41')+_0x46c582[_0xe01b('0x2a')]+')','participationtypemask':_0x46c582[_0xe01b('0x45')]===_0xe01b('0x46')?0x1:0x2}]},getCustomFields(_0x356111['Fields'],_0x576faa,_0x356111['ticketType'])),'headers':{'Authorization':_0xe01b('0x17')+_0x2eeb02,'OData-Version':_0xe01b('0x27')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x48eab6);})[_0xe01b('0x10')](function(_0x5df2be){var _0xa04590=_0x5df2be[_0xe01b('0x47')][_0xe01b('0x48')];var _0x2eb385=_0xa04590[_0xe01b('0x28')](_0xa04590[_0xe01b('0x29')]('(')+0x1,_0xa04590[_0xe01b('0x29')](')'));_0x46c582[_0xe01b('0x49')]=_0x2eb385;_0x4507bf(_0x46c582);})['catch'](function(_0x237bf6){_0x543aed(_0x237bf6['message']);});});}function emit(_0x1897d0,_0x3db203,_0xbdaa58,_0x325387){var _0x330812={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x1897d0,_0xbdaa58,_0x325387)};io['to'](util[_0xe01b('0x4a')](_0xe01b('0x4b'),_0x3db203))[_0xe01b('0x4c')](_0xe01b('0x4d'),_0x330812);}exports['cs']=function(_0x27d349,_0x19212e,_0xd8246e,_0x59d2dc,_0x5aae00,_0x4515e5,_0x2c9d8e,_0x2e7bc2){var _0x1c8196={};_0x4515e5[_0xe01b('0xd')]=intUtil['stripTrailingSlash'](_0x4515e5['remoteUri']);_0x4515e5[_0xe01b('0x4e')]=intUtil[_0xe01b('0x4f')](_0x4515e5['serverUrl']);_0x1c8196['callDirection']=_0x2e7bc2==='queue'||_0x2e7bc2===_0xe01b('0x50')?_0xe01b('0x46'):_0xe01b('0x26');var _0x481c06=util[_0xe01b('0x4a')](_0xe01b('0x51'),_0x4515e5[_0xe01b('0xd')]);var _0x27d88d=util[_0xe01b('0x4a')](_0xe01b('0x52'),_0x4515e5[_0xe01b('0x53')]);var _0x3a2458=util['format'](_0xe01b('0x54'),_0x4515e5[_0xe01b('0x4e')],_0x19212e[_0xe01b('0x55')],md5(_0x19212e[_0xe01b('0x55')]));if(_0x5aae00&&_0x5aae00[_0xe01b('0x56')]){logger['info'](_0xe01b('0x57'),_0xe01b('0x58'));_0x19212e[_0xe01b('0x59')]=_0x3a2458;}else if(_0x2c9d8e&&_0x2c9d8e[_0xe01b('0x5a')]&&_0x2c9d8e[_0xe01b('0x5a')]!=='none'){logger['info'](_0xe01b('0x5b'),'Recording\x20is\x20enabled!');_0x19212e[_0xe01b('0x59')]=_0x3a2458;}else{_0x19212e[_0xe01b('0x59')]='';}return getUser(_0x1c8196,_0x4515e5,_0x59d2dc,_0x27d88d,_0x481c06,_0x2e7bc2)[_0xe01b('0x10')](function(_0x4abb57){logger[_0xe01b('0x1e')]('['+_0x2e7bc2['toUpperCase']()+_0xe01b('0x5c'),_0x4abb57[_0xe01b('0x21')]);logger[_0xe01b('0x1e')]('['+_0x2e7bc2['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0x4abb57[_0xe01b('0x1b')]);return getEndUser(_0x4abb57,_0x4515e5,_0x27d88d,_0x481c06,_0x19212e,_0x2e7bc2);})[_0xe01b('0x10')](function(_0x18aa45){logger['info']('['+_0x2e7bc2[_0xe01b('0x14')]()+_0xe01b('0x5d'),_0x18aa45[_0xe01b('0x2a')]);logger[_0xe01b('0x1e')]('['+_0x2e7bc2[_0xe01b('0x14')]()+_0xe01b('0x5e'),_0x19212e['calleridnum']);return getTicket(_0x18aa45,_0x4515e5,_0x27d88d,_0x481c06,_0x19212e,_0xd8246e,_0x2e7bc2);})[_0xe01b('0x10')](function(_0xedc501){logger['info'](util[_0xe01b('0x4a')]('['+_0x2e7bc2[_0xe01b('0x14')]()+_0xe01b('0x5f'),_0xd8246e[_0xe01b('0x39')],_0xedc501['ticketId']));logger[_0xe01b('0x1e')](util[_0xe01b('0x4a')]('['+_0x2e7bc2[_0xe01b('0x14')]()+_0xe01b('0x60'),_0x2e7bc2));if(_0x2e7bc2!=='unmanaged'){logger[_0xe01b('0x1e')]('['+_0x2e7bc2[_0xe01b('0x14')]()+']',_0xe01b('0x61'));emit(_0x4515e5[_0xe01b('0xd')],_0x59d2dc[_0xe01b('0x62')],_0xd8246e[_0xe01b('0x39')],_0xedc501['ticketId']);}})[_0xe01b('0x12')](function(_0x2c153f){logger[_0xe01b('0x13')]('['+_0x2e7bc2[_0xe01b('0x14')]()+_0xe01b('0x63'),util['inspect'](_0x2c153f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7da6=['format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','error',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','md5','../../../../config/logger','dynamics365','redis','defaults','localhost','socket.io-emitter','POST','remoteUri','username','password','clientSecret','then','access_token','toUpperCase',']\x20Wrong\x20credentials!','message','value','isNil','validateEmail','userEmail','email','length','internalemailaddress','isdisabled','info','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','destcalleridnum','calleridnum','contacts','Bearer\x20','4.0','odata-entityid','substring','lastIndexOf','catch','outbound','GET','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','contactid',']\x20Enduser\x20Created!','enduserId','includes','string','picklist','type','nameField','indexOf','content','ticketType','incidents','assign','Subjects','Descriptions','/contacts(','/systemusers(','phonecalls','getString','callDirection','queue','headers','ticketId'];(function(_0x196fa9,_0x291268){var _0xc8b47=function(_0x94a5f9){while(--_0x94a5f9){_0x196fa9['push'](_0x196fa9['shift']());}};_0xc8b47(++_0x291268);}(_0x7da6,0x127));var _0x67da=function(_0x372129,_0x539547){_0x372129=_0x372129-0x0;var _0x2385b4=_0x7da6[_0x372129];return _0x2385b4;};'use strict';var _=require(_0x67da('0x0'));var BPromise=require('bluebird');var rp=require(_0x67da('0x1'));var util=require('util');var intUtil=require(_0x67da('0x2'));var md5=require(_0x67da('0x3'));var Redis=require('ioredis');var logger=require(_0x67da('0x4'))(_0x67da('0x5'));var config=require('../../../../config/environment');config[_0x67da('0x6')]=_[_0x67da('0x7')](config[_0x67da('0x6')],{'host':_0x67da('0x8'),'port':0x18eb});var io=require(_0x67da('0x9'))(new Redis(config[_0x67da('0x6')]));function getAuthToken(_0x2b97fc,_0x14f672,_0x4ba541){var _0x4273ce={'method':_0x67da('0xa'),'uri':_0x14f672,'form':{'client_id':_0x2b97fc['clientId'],'resource':_0x2b97fc[_0x67da('0xb')],'username':_0x2b97fc[_0x67da('0xc')],'password':_0x2b97fc[_0x67da('0xd')],'grant_type':_0x67da('0xd'),'client_secret':_0x2b97fc[_0x67da('0xe')]},'json':!![]};return rp(_0x4273ce)[_0x67da('0xf')](function(_0x5d4e3c){return _0x5d4e3c[_0x67da('0x10')];})['catch'](function(_0x3210bf){logger['error']('['+[_0x4ba541[_0x67da('0x11')]()]+_0x67da('0x12'));return _0x3210bf[_0x67da('0x13')];});}function getUser(_0xb665b6,_0x5987f7,_0x29cc86,_0x1f5e3f,_0x3062ee,_0xc9a68){return new BPromise(function(_0x1e9095,_0x425fe6){return getAuthToken(_0x5987f7,_0x1f5e3f,_0xc9a68)[_0x67da('0xf')](function(_0x32fa7b){var _0x410864={'method':'GET','uri':_0x3062ee+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x32fa7b,'OData-Version':'4.0'},'json':!![]};return rp(_0x410864);})['then'](function(_0x5e1858){var _0x3590da=_0x5e1858[_0x67da('0x14')];var _0x524133=![];var _0x43d391=null;if(!_[_0x67da('0x15')](_0x29cc86)){if(intUtil[_0x67da('0x16')](_0x29cc86['email'])){_0xb665b6[_0x67da('0x17')]=_0x29cc86[_0x67da('0x18')];for(_0x43d391=0x0;_0x43d391<_0x3590da[_0x67da('0x19')];_0x43d391++){if(_0x3590da[_0x43d391][_0x67da('0x1a')]===_0x29cc86['email']&&!_0x3590da[_0x43d391][_0x67da('0x1b')]){_0x524133=!![];logger[_0x67da('0x1c')]('['+[_0xc9a68[_0x67da('0x11')]()]+']\x20Agent\x20found\x20'+_0x3590da[_0x43d391][_0x67da('0x1d')]+'!');_0xb665b6['userId']=_0x3590da[_0x43d391][_0x67da('0x1d')];}}}}if(!_0x524133){logger[_0x67da('0x1c')]('['+[_0xc9a68[_0x67da('0x11')]()]+_0x67da('0x1e'));_0xb665b6[_0x67da('0x17')]=_0x5987f7[_0x67da('0xc')];for(_0x43d391=0x0;_0x43d391<_0x3590da[_0x67da('0x19')];_0x43d391++){if(_0x3590da[_0x43d391][_0x67da('0x1a')]===_0x5987f7['username']){_0xb665b6[_0x67da('0x1f')]=_0x3590da[_0x43d391][_0x67da('0x1d')];}}}_0x1e9095(_0xb665b6);})['catch'](function(_0x5ce386){_0x425fe6(_0x5ce386['message']);});});}function createEndUser(_0x3017c5,_0x2b86b8,_0x3dbc6f,_0x16b0d8,_0x5d26e7,_0x36d9a3){return new BPromise(function(_0x69d6cd,_0x162a5b){return getAuthToken(_0x2b86b8,_0x3dbc6f,_0x36d9a3)[_0x67da('0xf')](function(_0x30b1f8){var _0x41469d=_0x36d9a3['toLowerCase']()==='outbound'?_0x5d26e7[_0x67da('0x20')]:_0x5d26e7[_0x67da('0x21')];var _0x76c8d3={'method':_0x67da('0xa'),'uri':_0x16b0d8+_0x67da('0x22'),'body':{'telephone1':_0x41469d,'fullname':_0x41469d,'firstname':_0x41469d,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x3017c5['userId']+')'},'headers':{'Authorization':_0x67da('0x23')+_0x30b1f8,'OData-Version':_0x67da('0x24')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x76c8d3);})['then'](function(_0x440936){var _0x13683a=_0x440936['headers'][_0x67da('0x25')];var _0x194686=_0x13683a[_0x67da('0x26')](_0x13683a['lastIndexOf']('(')+0x1,_0x13683a[_0x67da('0x27')](')'));_0x3017c5['enduserId']=_0x194686;_0x69d6cd(_0x3017c5);})[_0x67da('0x28')](function(_0x5beacd){_0x162a5b(_0x5beacd[_0x67da('0x13')]);});});}function getEndUser(_0x3e8fa1,_0x2d7666,_0xdd501f,_0x57e6ea,_0x4af59b,_0x21d356){return new BPromise(function(_0x4d2c61,_0x3ec24f){var _0x67e478=_0x21d356['toLowerCase']()===_0x67da('0x29')?_0x4af59b[_0x67da('0x20')]:_0x4af59b[_0x67da('0x21')];return getAuthToken(_0x2d7666,_0xdd501f,_0x21d356)[_0x67da('0xf')](function(_0x27d8c0){var _0x291d73={'method':_0x67da('0x2a'),'uri':_0x57e6ea+_0x67da('0x2b')+_0x67e478[_0x67da('0x2c')]('+',_0x67da('0x2d'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x27d8c0,'If-None-Match':null,'OData-Version':_0x67da('0x24')},'json':!![]};return rp(_0x291d73);})[_0x67da('0xf')](function(_0x406b89){var _0x3edf31=null;if(_0x406b89){var _0x121579=_0x406b89[_0x67da('0x14')];var _0x43e529=![];for(_0x3edf31=0x0;_0x3edf31<_0x121579['length'];_0x3edf31++){if(_0x121579[_0x3edf31]['telephone1']===_0x67e478){_0x43e529=!![];_0x3e8fa1['enduserId']=_0x121579[_0x3edf31][_0x67da('0x2e')];}}if(_0x43e529){_0x4d2c61(_0x3e8fa1);}else{return createEndUser(_0x3e8fa1,_0x2d7666,_0xdd501f,_0x57e6ea,_0x4af59b,_0x21d356)[_0x67da('0xf')](function(_0x343d5){logger[_0x67da('0x1c')]('['+[_0x21d356[_0x67da('0x11')]()]+']\x20Enduser\x20created!',_0x343d5['enduserId']);_0x4d2c61(_0x343d5);});}}else{return createEndUser(_0x3e8fa1,_0x2d7666,_0xdd501f,_0x57e6ea,_0x4af59b,_0x21d356)[_0x67da('0xf')](function(_0x44bb97){logger[_0x67da('0x1c')]('['+[_0x21d356[_0x67da('0x11')]()]+_0x67da('0x2f'),_0x44bb97[_0x67da('0x30')]);_0x4d2c61(_0x44bb97);});}});});}function getCustomFields(_0x5068aa,_0x48c999,_0x11d093){var _0x1d83af={};if(_0x5068aa[_0x67da('0x19')]>0x0){_['forEach'](_0x5068aa,function(_0x4a2863){if(_[_0x67da('0x31')]([_0x67da('0x32'),_0x67da('0x33')],_0x4a2863[_0x67da('0x34')])&&_0x4a2863[_0x67da('0x35')]&&!_0x4a2863['customField']){var _0x599e5b=_0x4a2863['idField']['toLowerCase']();var _0x2ed0f3=_0x599e5b['substring'](0x0,_0x599e5b[_0x67da('0x36')]('_'));var _0x145378=_0x599e5b['substring'](_0x599e5b['indexOf']('_')+0x1);if(_0x2ed0f3===_0x11d093){_0x1d83af[_0x145378]=_0x4a2863[_0x67da('0x37')];}}});}return _0x1d83af;}function getTicket(_0x354b63,_0x4f3bc6,_0x3610fd,_0x2bfcbb,_0x22e72a,_0x28c811,_0x55d41a){return new BPromise(function(_0xe809aa,_0x183628){var _0x531ec1;return getAuthToken(_0x4f3bc6,_0x3610fd,_0x55d41a)[_0x67da('0xf')](function(_0x253bcf){if(_0x28c811[_0x67da('0x38')]==='incident'){_0x531ec1={'method':_0x67da('0xa'),'uri':_0x2bfcbb+_0x67da('0x39'),'body':Object[_0x67da('0x3a')]({},{'title':intUtil['getString'](_0x28c811[_0x67da('0x3b')],_0x22e72a,'\x20'),'description':intUtil['getString'](_0x28c811[_0x67da('0x3c')],_0x22e72a,'\x0a'),'customerid_contact@odata.bind':_0x67da('0x3d')+_0x354b63[_0x67da('0x30')]+')','ownerid@odata.bind':_0x67da('0x3e')+_0x354b63[_0x67da('0x1f')]+')','caseorigincode':'1'},getCustomFields(_0x28c811['Fields'],_0x22e72a,_0x28c811['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x253bcf,'OData-Version':_0x67da('0x24')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x28c811['ticketType']==='phonecall'){_0x531ec1={'method':_0x67da('0xa'),'uri':_0x2bfcbb+_0x67da('0x3f'),'body':Object[_0x67da('0x3a')]({},{'subject':intUtil[_0x67da('0x40')](_0x28c811['Subjects'],_0x22e72a,'\x20'),'phonenumber':String(_0x22e72a['calleridnum']),'description':intUtil[_0x67da('0x40')](_0x28c811[_0x67da('0x3c')],_0x22e72a,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x354b63[_0x67da('0x30')]+')','ownerid@odata.bind':_0x67da('0x3e')+_0x354b63[_0x67da('0x1f')]+')','directioncode':_0x354b63[_0x67da('0x41')]===_0x67da('0x42')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x67da('0x3e')+_0x354b63[_0x67da('0x1f')]+')','participationtypemask':_0x354b63[_0x67da('0x41')]===_0x67da('0x42')?0x2:0x1},{'partyid_contact@odata.bind':_0x67da('0x3d')+_0x354b63[_0x67da('0x30')]+')','participationtypemask':_0x354b63[_0x67da('0x41')]===_0x67da('0x42')?0x1:0x2}]},getCustomFields(_0x28c811['Fields'],_0x22e72a,_0x28c811[_0x67da('0x38')])),'headers':{'Authorization':_0x67da('0x23')+_0x253bcf,'OData-Version':_0x67da('0x24')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x531ec1);})[_0x67da('0xf')](function(_0x4099ed){var _0x34d6e0=_0x4099ed[_0x67da('0x43')][_0x67da('0x25')];var _0x5f59d2=_0x34d6e0[_0x67da('0x26')](_0x34d6e0[_0x67da('0x27')]('(')+0x1,_0x34d6e0[_0x67da('0x27')](')'));_0x354b63[_0x67da('0x44')]=_0x5f59d2;_0xe809aa(_0x354b63);})[_0x67da('0x28')](function(_0x30991d){_0x183628(_0x30991d[_0x67da('0x13')]);});});}function emit(_0x46f457,_0x36f9b0,_0x399a33,_0x1fba13){var _0x1df7f8={'uri':util[_0x67da('0x45')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x46f457,_0x399a33,_0x1fba13)};io['to'](util[_0x67da('0x45')](_0x67da('0x46'),_0x36f9b0))[_0x67da('0x47')](_0x67da('0x48'),_0x1df7f8);}exports['cs']=function(_0x3e0fa1,_0x377364,_0x17ff33,_0x21323f,_0x265c0d,_0x2dba26,_0x424044,_0x465bbb){var _0x54d1d1={};_0x2dba26[_0x67da('0xb')]=intUtil[_0x67da('0x49')](_0x2dba26['remoteUri']);_0x2dba26[_0x67da('0x4a')]=intUtil[_0x67da('0x49')](_0x2dba26['serverUrl']);_0x54d1d1[_0x67da('0x41')]=_0x465bbb===_0x67da('0x42')||_0x465bbb==='unmanaged'?_0x67da('0x42'):_0x67da('0x29');var _0x35f0b8=util[_0x67da('0x45')](_0x67da('0x4b'),_0x2dba26[_0x67da('0xb')]);var _0x11fa88=util[_0x67da('0x45')](_0x67da('0x4c'),_0x2dba26[_0x67da('0x4d')]);var _0x3e579e=util[_0x67da('0x45')](_0x67da('0x4e'),_0x2dba26['serverUrl'],_0x377364[_0x67da('0x4f')],md5(_0x377364[_0x67da('0x4f')]));if(_0x265c0d&&_0x265c0d[_0x67da('0x50')]){logger[_0x67da('0x1c')]('[QUEUE]',_0x67da('0x51'));_0x377364[_0x67da('0x52')]=_0x3e579e;}else if(_0x424044&&_0x424044[_0x67da('0x53')]&&_0x424044[_0x67da('0x53')]!=='none'){logger[_0x67da('0x1c')]('[OUTBOUND]',_0x67da('0x51'));_0x377364[_0x67da('0x52')]=_0x3e579e;}else{_0x377364[_0x67da('0x52')]='';}return getUser(_0x54d1d1,_0x2dba26,_0x21323f,_0x11fa88,_0x35f0b8,_0x465bbb)[_0x67da('0xf')](function(_0x396657){logger[_0x67da('0x1c')]('['+_0x465bbb['toUpperCase']()+']\x20The\x20User\x20ID\x20is:',_0x396657[_0x67da('0x1f')]);logger[_0x67da('0x1c')]('['+_0x465bbb[_0x67da('0x11')]()+']\x20The\x20User\x20email\x20is:',_0x396657[_0x67da('0x17')]);return getEndUser(_0x396657,_0x2dba26,_0x11fa88,_0x35f0b8,_0x377364,_0x465bbb);})['then'](function(_0x34b81f){logger[_0x67da('0x1c')]('['+_0x465bbb[_0x67da('0x11')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x34b81f[_0x67da('0x30')]);logger[_0x67da('0x1c')]('['+_0x465bbb[_0x67da('0x11')]()+_0x67da('0x54'),_0x377364[_0x67da('0x21')]);return getTicket(_0x34b81f,_0x2dba26,_0x11fa88,_0x35f0b8,_0x377364,_0x17ff33,_0x465bbb);})[_0x67da('0xf')](function(_0x39b99d){logger[_0x67da('0x1c')](util['format']('['+_0x465bbb[_0x67da('0x11')]()+_0x67da('0x55'),_0x17ff33['ticketType'],_0x39b99d[_0x67da('0x44')]));logger[_0x67da('0x1c')](util[_0x67da('0x45')]('['+_0x465bbb[_0x67da('0x11')]()+_0x67da('0x56'),_0x465bbb));if(_0x465bbb!==_0x67da('0x57')){logger[_0x67da('0x1c')]('['+_0x465bbb['toUpperCase']()+']',_0x67da('0x58'));emit(_0x2dba26['remoteUri'],_0x21323f['name'],_0x17ff33[_0x67da('0x38')],_0x39b99d[_0x67da('0x44')]);}})['catch'](function(_0x2c6632){logger[_0x67da('0x59')]('['+_0x465bbb[_0x67da('0x11')]()+_0x67da('0x5a'),util['inspect'](_0x2c6632,{'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 70d4231..56ccf9b 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 _0x5585=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','user:%s','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','destcalleridnum','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','application/json','emit','Creating\x20new\x20ticket...','merge','format','calleridnum','getString','Subjects','Descriptions','
','name','Fields','custom_fields','keyBy','value','%s/api/v2/tickets','info','validateEmail','%s/api/v2/agents','remoteUri','then','length','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','Basic\x20%s','toString','base64','debug','stringify','forEach','includes','type','nameField','customField','content','picklist','idField','variable','variableName','push','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!'];(function(_0x17b0db,_0x165158){var _0x3f26bc=function(_0x50c85d){while(--_0x50c85d){_0x17b0db['push'](_0x17b0db['shift']());}};_0x3f26bc(++_0x165158);}(_0x5585,0xcb));var _0x5558=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5585[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x5558('0x0'));var rp=require(_0x5558('0x1'));var md5=require(_0x5558('0x2'));var util=require(_0x5558('0x3'));var Redis=require('ioredis');var intUtil=require(_0x5558('0x4'));var config=require(_0x5558('0x5'));var logger=require(_0x5558('0x6'))(_0x5558('0x7'));config[_0x5558('0x8')]=_[_0x5558('0x9')](config[_0x5558('0x8')],{'host':_0x5558('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5558('0x8')]));var headers={'Content-Type':_0x5558('0xb'),'Accept':_0x5558('0xb')};function emit(_0x2bd4ab,_0x1516e7,_0x4e5a90){io['to'](_0x2bd4ab)[_0x5558('0xc')](_0x1516e7,_0x4e5a90);}function getTicket(_0x57563e,_0x4601a9,_0x4f472b,_0xc7fc18,_0x22c1fb){logger['info'](_0x5558('0xd'));var _0x982770=_[_0x5558('0xe')]({'responder_id':_0x4601a9['id'],'requester_id':_0x4f472b['id'],'name':util[_0x5558('0xf')]('Caller\x20-\x20%s',_0x22c1fb['calleridname']),'phone':_0x22c1fb[_0x5558('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x5558('0x11')](_0xc7fc18[_0x5558('0x12')],_0x22c1fb,'\x20'),'description':intUtil['getString'](_0xc7fc18[_0x5558('0x13')],_0x22c1fb,_0x5558('0x14')),'tags':getTags(_0xc7fc18['Tags'],_0x5558('0x15'))},getCustomFields(_0xc7fc18[_0x5558('0x16')],_0x22c1fb));_0x982770[_0x5558('0x17')]=_['mapValues'](_[_0x5558('0x18')](_0x982770[_0x5558('0x17')],'id'),_0x5558('0x19'));return request({'uri':util['format'](_0x5558('0x1a'),_0x57563e['remoteUri']),'method':'POST','body':_0x982770})['then'](function(_0x1e8a44){logger[_0x5558('0x1b')]('Ticket\x20created!');return _0x1e8a44;});}function getUser(_0x29ef25,_0x490633){if(intUtil[_0x5558('0x1c')](_0x490633)){return request({'uri':util['format'](_0x5558('0x1d'),_0x29ef25[_0x5558('0x1e')]),'qs':{'email':_0x490633}})[_0x5558('0x1f')](function(_0x2301f0){if(_0x2301f0[_0x5558('0x20')]){logger[_0x5558('0x1b')](_0x5558('0x21'));return _['find'](_0x2301f0,function(_0x46ef6b){return _0x46ef6b[_0x5558('0x22')][_0x5558('0x23')]===_0x490633;});}else{logger[_0x5558('0x1b')](_0x5558('0x24'));return request({'uri':util[_0x5558('0xf')](_0x5558('0x25'),_0x29ef25[_0x5558('0x1e')])})[_0x5558('0x1f')](function(_0x29955b){logger[_0x5558('0x1b')]('Admin\x20account\x20selected.');return _0x29955b;});}});}else{logger[_0x5558('0x1b')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x5558('0xf')]('%s/api/v2/agents/me',_0x29ef25[_0x5558('0x1e')])})[_0x5558('0x1f')](function(_0x2d5924){logger[_0x5558('0x1b')](_0x5558('0x26'));return _0x2d5924;});}}function getEndUser(_0x346fad,_0x272923,_0x35c19a){logger['info'](_0x5558('0x27'),_0x35c19a);return request({'uri':util[_0x5558('0xf')](_0x5558('0x28'),_0x346fad[_0x5558('0x1e')]),'qs':{'phone':_0x35c19a}})[_0x5558('0x1f')](function(_0x31f90e){if(_0x31f90e[_0x5558('0x20')]){logger[_0x5558('0x1b')](_0x5558('0x29'));return _[_0x5558('0x2a')](_0x31f90e,{'phone':_0x35c19a});}else{logger[_0x5558('0x1b')](_0x5558('0x2b'));return request({'uri':util[_0x5558('0xf')](_0x5558('0x28'),_0x346fad[_0x5558('0x1e')]),'method':_0x5558('0x2c'),'body':{'name':_0x272923,'phone':_0x35c19a}})[_0x5558('0x1f')](function(_0x22ba18){logger['info'](_0x5558('0x2d'));return _0x22ba18;});}});}function getAuth(_0x909c5){return util['format'](_0x5558('0x2e'),new Buffer(_0x909c5['apiKey']+':X')[_0x5558('0x2f')](_0x5558('0x30')));}function request(_0x58011b){logger[_0x5558('0x31')]('[HTTP]',JSON[_0x5558('0x32')](_0x58011b));return rp(_['defaults'](_0x58011b,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x5eb1e8,_0x401d99){var _0x5ca9c5=[];if(_0x5eb1e8&&_0x5eb1e8[_0x5558('0x20')]>0x0){_0x5ca9c5=_['map'](_0x5eb1e8,_0x401d99);}return _0x5ca9c5;}function getCustomFields(_0x38ce94,_0x4f4c7f){var _0x14985b=[];var _0x26f9e4={'custom_fields':[]};if(_0x38ce94[_0x5558('0x20')]>0x0){_[_0x5558('0x33')](_0x38ce94,function(_0x1135a4){if(_[_0x5558('0x34')](['string','picklist'],_0x1135a4[_0x5558('0x35')])&&_0x1135a4[_0x5558('0x36')]&&!_0x1135a4[_0x5558('0x37')]){_0x26f9e4[_0x1135a4['nameField']['toLowerCase']()]=_0x1135a4[_0x5558('0x38')][_0x5558('0x2f')]();}else if(_['includes'](['string',_0x5558('0x39')],_0x1135a4[_0x5558('0x35')])&&_0x1135a4[_0x5558('0x3a')]&&_0x1135a4[_0x5558('0x37')]){_0x26f9e4['custom_fields']['push']({'id':_0x1135a4[_0x5558('0x3a')],'value':_0x1135a4[_0x5558('0x38')][_0x5558('0x2f')]()});}else if(_0x1135a4['type']===_0x5558('0x3b')&&_0x1135a4[_0x5558('0x3c')]&&_0x1135a4[_0x5558('0x3a')]&&_0x1135a4[_0x5558('0x37')]){_0x4f4c7f[_0x1135a4[_0x5558('0x3c')]]&&_0x26f9e4['custom_fields'][_0x5558('0x3d')]({'id':_0x1135a4[_0x5558('0x3a')],'value':_0x4f4c7f[_0x1135a4[_0x5558('0x3c')]][_0x5558('0x2f')]()});}else if(_0x1135a4[_0x5558('0x35')]==='customVariable'&&_0x1135a4[_0x5558('0x3e')]&&_0x1135a4[_0x5558('0x3e')][_0x5558('0x15')]&&_0x1135a4['idField']&&_0x1135a4['customField']){_0x4f4c7f[_0x1135a4['Variable']['name']['toLowerCase']()]&&_0x26f9e4[_0x5558('0x17')][_0x5558('0x3d')]({'id':_0x1135a4[_0x5558('0x3a')],'value':_0x4f4c7f[_0x1135a4[_0x5558('0x3e')][_0x5558('0x15')][_0x5558('0x3f')]()][_0x5558('0x2f')]()});}});}return _0x26f9e4;}exports[_0x5558('0x40')]=function(_0x26ad8a,_0x326874,_0x360135,_0x595a89,_0x350bb9,_0x1dac7f){var _0xee03b7,_0x50ec1e;_0x1dac7f[_0x5558('0x1e')]=intUtil[_0x5558('0x41')](_0x1dac7f['remoteUri']);_0x1dac7f[_0x5558('0x42')]=intUtil['stripTrailingSlash'](_0x1dac7f['serverUrl']);if(_0x350bb9&&_0x350bb9[_0x5558('0x43')]){logger['info'](_0x5558('0x44'),_0x5558('0x45'));_0x326874['recordingURL']=util[_0x5558('0xf')](_0x5558('0x46'),_0x1dac7f['serverUrl'],_0x326874['uniqueid'],md5(_0x326874[_0x5558('0x47')]));}else{_0x326874[_0x5558('0x48')]='';}headers[_0x5558('0x49')]=getAuth(_0x1dac7f);return getUser(_0x1dac7f,_0x595a89[_0x5558('0x23')])[_0x5558('0x1f')](function(_0x3e7811){_0xee03b7=_0x3e7811;logger[_0x5558('0x1b')](_0x5558('0x4a'),_0xee03b7['id']);return getEndUser(_0x1dac7f,_0x326874['calleridname'],_0x326874[_0x5558('0x10')]);})[_0x5558('0x1f')](function(_0x40a898){_0x50ec1e=_0x40a898;logger[_0x5558('0x1b')](_0x5558('0x4b'),_0x50ec1e['id']);return getTicket(_0x1dac7f,_0xee03b7,_0x50ec1e,_0x360135,_0x326874);})[_0x5558('0x1f')](function(_0x2bd2b){if(_0x2bd2b&&_0x2bd2b['id']){logger[_0x5558('0x1b')](_0x5558('0x4c'));logger[_0x5558('0x1b')](_0x5558('0x4d'),_0x2bd2b['id']);logger['info'](_0x5558('0x44'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x5558('0x4e'),_0x595a89['name']),'trigger:browser:url',{'uri':util['format'](_0x5558('0x4f'),_0x1dac7f[_0x5558('0x1e')],_0x2bd2b['id'])});}})[_0x5558('0x50')](function(_0x2e9960){logger[_0x5558('0x51')](_0x5558('0x44'),JSON['stringify'](_0x2e9960));});};exports[_0x5558('0x52')]=function(_0x50daa1,_0x55f76c,_0xe88281,_0x4d4ac7,_0x22ee5b,_0x1c660f,_0x5518cf){var _0xd2eeb1,_0xb99477;_0x1c660f[_0x5558('0x1e')]=intUtil[_0x5558('0x41')](_0x1c660f['remoteUri']);_0x1c660f[_0x5558('0x42')]=intUtil['stripTrailingSlash'](_0x1c660f[_0x5558('0x42')]);if(_0x5518cf&&_0x5518cf[_0x5558('0x53')]&&_0x5518cf[_0x5558('0x53')]!=='none'){logger['info']('[OUTBOUND]',_0x5558('0x45'));_0x55f76c[_0x5558('0x48')]=util['format'](_0x5558('0x46'),_0x1c660f[_0x5558('0x42')],_0x55f76c['uniqueid'],md5(_0x55f76c[_0x5558('0x47')]));}headers[_0x5558('0x49')]=getAuth(_0x1c660f);return getUser(_0x1c660f,_0x4d4ac7[_0x5558('0x23')])[_0x5558('0x1f')](function(_0x1b35b6){_0xd2eeb1=_0x1b35b6;logger[_0x5558('0x1b')](_0x5558('0x4a'),_0xd2eeb1['id']);return getEndUser(_0x1c660f,_0x55f76c['destcalleridname'],_0x55f76c[_0x5558('0x54')]);})[_0x5558('0x1f')](function(_0x1965a2){_0xb99477=_0x1965a2;logger['info']('The\x20Enduser\x20ID\x20is:',_0xb99477['id']);return getTicket(_0x1c660f,_0xd2eeb1,_0xb99477,_0xe88281,_0x55f76c);})['then'](function(_0x244f12){if(_0x244f12&&_0x244f12['id']){logger[_0x5558('0x1b')](_0x5558('0x4c'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x244f12['id']);logger[_0x5558('0x1b')](_0x5558('0x55'),_0x5558('0x56'));emit(util[_0x5558('0xf')](_0x5558('0x4e'),_0x4d4ac7[_0x5558('0x15')]),'trigger:browser:url',{'uri':util['format'](_0x5558('0x4f'),_0x1c660f[_0x5558('0x1e')],_0x244f12['id'])});}})['catch'](function(_0x334459){logger['error'](_0x5558('0x55'),JSON[_0x5558('0x32')](_0x334459));});};exports[_0x5558('0x57')]=function(_0x18a457,_0xc82323,_0x9dbd0f,_0x5dc6bf,_0x270233,_0x49a2de){var _0x3ac1d3,_0x49890a;_0x49a2de[_0x5558('0x1e')]=intUtil[_0x5558('0x41')](_0x49a2de[_0x5558('0x1e')]);_0x49a2de['serverUrl']=intUtil[_0x5558('0x41')](_0x49a2de[_0x5558('0x42')]);if(_0x270233&&_0x270233[_0x5558('0x43')]){logger[_0x5558('0x1b')]('['+_0xc82323[_0x5558('0x58')][_0x5558('0x59')]()+']',_0x5558('0x45'));_0xc82323['recordingURL']=util[_0x5558('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x49a2de['serverUrl'],_0xc82323['uniqueid'],md5(_0xc82323['uniqueid']));}else{_0xc82323['recordingURL']='';}headers['Authorization']=getAuth(_0x49a2de);return getUser(_0x49a2de,'')[_0x5558('0x1f')](function(_0x3e3438){_0x3ac1d3=_0x3e3438;logger[_0x5558('0x1b')](_0x5558('0x4a'),_0x3ac1d3['id']);return getEndUser(_0x49a2de,_0xc82323[_0x5558('0x5a')],_0xc82323['calleridnum']);})[_0x5558('0x1f')](function(_0x69f939){_0x49890a=_0x69f939;logger[_0x5558('0x1b')]('The\x20Enduser\x20ID\x20is:',_0x49890a['id']);return getTicket(_0x49a2de,_0x3ac1d3,_0x49890a,_0x9dbd0f,_0xc82323);})[_0x5558('0x1f')](function(_0x4f4f5e){if(_0x4f4f5e){logger['info'](_0x5558('0x4c'));logger[_0x5558('0x1b')](_0x5558('0x4d'),_0x4f4f5e['id']);}})[_0x5558('0x50')](function(_0x55742c){logger[_0x5558('0x51')]('['+_0xc82323[_0x5558('0x58')][_0x5558('0x59')]()+']',JSON[_0x5558('0x32')](_0x55742c));});}; \ No newline at end of file +var _0xd85a=['idField','custom_fields','variable','variableName','push','customVariable','Variable','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','unmanaged','lastevent','toUpperCase','The\x20User\x20ID\x20is:','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Descriptions','
','Tags','name','mapValues','keyBy','value','%s/api/v2/tickets','POST','then','Ticket\x20created!','validateEmail','remoteUri','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','apiKey','base64','[HTTP]','stringify','defaults','GET','map','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','toString','string'];(function(_0x37a7a8,_0xd8471b){var _0x1b79db=function(_0x2f32ad){while(--_0x2f32ad){_0x37a7a8['push'](_0x37a7a8['shift']());}};_0x1b79db(++_0xd8471b);}(_0xd85a,0x13d));var _0xad85=function(_0xda40ac,_0x4e7018){_0xda40ac=_0xda40ac-0x0;var _0xf83097=_0xd85a[_0xda40ac];return _0xf83097;};'use strict';var _=require(_0xad85('0x0'));var rp=require(_0xad85('0x1'));var md5=require(_0xad85('0x2'));var util=require(_0xad85('0x3'));var Redis=require(_0xad85('0x4'));var intUtil=require(_0xad85('0x5'));var config=require(_0xad85('0x6'));var logger=require(_0xad85('0x7'))(_0xad85('0x8'));config['redis']=_['defaults'](config[_0xad85('0x9')],{'host':_0xad85('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xad85('0x9')]));var headers={'Content-Type':_0xad85('0xb'),'Accept':_0xad85('0xb')};function emit(_0x129c4d,_0x3b9060,_0x5c93d4){io['to'](_0x129c4d)[_0xad85('0xc')](_0x3b9060,_0x5c93d4);}function getTicket(_0xbed2b0,_0x115e0d,_0x21fb0f,_0x21c9d0,_0x257e98){logger[_0xad85('0xd')](_0xad85('0xe'));var _0x1f4c12=_[_0xad85('0xf')]({'responder_id':_0x115e0d['id'],'requester_id':_0x21fb0f['id'],'name':util[_0xad85('0x10')](_0xad85('0x11'),_0x257e98[_0xad85('0x12')]),'phone':_0x257e98[_0xad85('0x13')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x21c9d0['Subjects'],_0x257e98,'\x20'),'description':intUtil[_0xad85('0x14')](_0x21c9d0[_0xad85('0x15')],_0x257e98,_0xad85('0x16')),'tags':getTags(_0x21c9d0[_0xad85('0x17')],_0xad85('0x18'))},getCustomFields(_0x21c9d0['Fields'],_0x257e98));_0x1f4c12['custom_fields']=_[_0xad85('0x19')](_[_0xad85('0x1a')](_0x1f4c12['custom_fields'],'id'),_0xad85('0x1b'));return request({'uri':util[_0xad85('0x10')](_0xad85('0x1c'),_0xbed2b0['remoteUri']),'method':_0xad85('0x1d'),'body':_0x1f4c12})[_0xad85('0x1e')](function(_0x18b56d){logger['info'](_0xad85('0x1f'));return _0x18b56d;});}function getUser(_0x2dfdc7,_0x5677ed){if(intUtil[_0xad85('0x20')](_0x5677ed)){return request({'uri':util[_0xad85('0x10')]('%s/api/v2/agents',_0x2dfdc7[_0xad85('0x21')]),'qs':{'email':_0x5677ed}})[_0xad85('0x1e')](function(_0x2a2472){if(_0x2a2472['length']){logger[_0xad85('0xd')](_0xad85('0x22'));return _[_0xad85('0x23')](_0x2a2472,function(_0x2dc267){return _0x2dc267[_0xad85('0x24')]['email']===_0x5677ed;});}else{logger[_0xad85('0xd')](_0xad85('0x25'));return request({'uri':util[_0xad85('0x10')](_0xad85('0x26'),_0x2dfdc7['remoteUri'])})[_0xad85('0x1e')](function(_0x4a51be){logger['info'](_0xad85('0x27'));return _0x4a51be;});}});}else{logger[_0xad85('0xd')](_0xad85('0x28'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x2dfdc7[_0xad85('0x21')])})[_0xad85('0x1e')](function(_0x3a16cf){logger[_0xad85('0xd')](_0xad85('0x27'));return _0x3a16cf;});}}function getEndUser(_0x59b474,_0x574da7,_0x19331f){logger['info'](_0xad85('0x29'),_0x19331f);return request({'uri':util['format'](_0xad85('0x2a'),_0x59b474['remoteUri']),'qs':{'phone':_0x19331f}})[_0xad85('0x1e')](function(_0x4ec484){if(_0x4ec484[_0xad85('0x2b')]){logger[_0xad85('0xd')]('Enduser\x20found!');return _[_0xad85('0x23')](_0x4ec484,{'phone':_0x19331f});}else{logger['info'](_0xad85('0x2c'));return request({'uri':util[_0xad85('0x10')](_0xad85('0x2a'),_0x59b474[_0xad85('0x21')]),'method':_0xad85('0x1d'),'body':{'name':_0x574da7,'phone':_0x19331f}})[_0xad85('0x1e')](function(_0x4bb27a){logger['info']('Enduser\x20created.');return _0x4bb27a;});}});}function getAuth(_0x296cfc){return util[_0xad85('0x10')](_0xad85('0x2d'),new Buffer(_0x296cfc[_0xad85('0x2e')]+':X')['toString'](_0xad85('0x2f')));}function request(_0x106767){logger['debug'](_0xad85('0x30'),JSON[_0xad85('0x31')](_0x106767));return rp(_[_0xad85('0x32')](_0x106767,{'method':_0xad85('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x224839,_0x440ba8){var _0x57af10=[];if(_0x224839&&_0x224839[_0xad85('0x2b')]>0x0){_0x57af10=_[_0xad85('0x34')](_0x224839,_0x440ba8);}return _0x57af10;}function getCustomFields(_0x8f2d4a,_0x57d235){var _0x95ad93=[];var _0x59e53a={'custom_fields':[]};if(_0x8f2d4a[_0xad85('0x2b')]>0x0){_[_0xad85('0x35')](_0x8f2d4a,function(_0x59ceb6){if(_[_0xad85('0x36')](['string',_0xad85('0x37')],_0x59ceb6[_0xad85('0x38')])&&_0x59ceb6[_0xad85('0x39')]&&!_0x59ceb6[_0xad85('0x3a')]){_0x59e53a[_0x59ceb6[_0xad85('0x39')][_0xad85('0x3b')]()]=_0x59ceb6[_0xad85('0x3c')][_0xad85('0x3d')]();}else if(_[_0xad85('0x36')]([_0xad85('0x3e'),_0xad85('0x37')],_0x59ceb6[_0xad85('0x38')])&&_0x59ceb6[_0xad85('0x3f')]&&_0x59ceb6[_0xad85('0x3a')]){_0x59e53a[_0xad85('0x40')]['push']({'id':_0x59ceb6['idField'],'value':_0x59ceb6['content'][_0xad85('0x3d')]()});}else if(_0x59ceb6[_0xad85('0x38')]===_0xad85('0x41')&&_0x59ceb6[_0xad85('0x42')]&&_0x59ceb6[_0xad85('0x3f')]&&_0x59ceb6[_0xad85('0x3a')]){_0x57d235[_0x59ceb6[_0xad85('0x42')]]&&_0x59e53a[_0xad85('0x40')][_0xad85('0x43')]({'id':_0x59ceb6[_0xad85('0x3f')],'value':_0x57d235[_0x59ceb6[_0xad85('0x42')]][_0xad85('0x3d')]()});}else if(_0x59ceb6[_0xad85('0x38')]===_0xad85('0x44')&&_0x59ceb6['Variable']&&_0x59ceb6[_0xad85('0x45')][_0xad85('0x18')]&&_0x59ceb6[_0xad85('0x3f')]&&_0x59ceb6['customField']){_0x57d235[_0x59ceb6['Variable'][_0xad85('0x18')][_0xad85('0x3b')]()]&&_0x59e53a['custom_fields']['push']({'id':_0x59ceb6[_0xad85('0x3f')],'value':_0x57d235[_0x59ceb6[_0xad85('0x45')][_0xad85('0x18')]['toLowerCase']()][_0xad85('0x3d')]()});}});}return _0x59e53a;}exports['queue']=function(_0x7d6e47,_0x24759c,_0x3a3cb2,_0x3bacca,_0x4e7d87,_0xa4c8c7){var _0x1b2527,_0xdbaff6;_0xa4c8c7[_0xad85('0x21')]=intUtil['stripTrailingSlash'](_0xa4c8c7[_0xad85('0x21')]);_0xa4c8c7[_0xad85('0x46')]=intUtil[_0xad85('0x47')](_0xa4c8c7[_0xad85('0x46')]);if(_0x4e7d87&&_0x4e7d87[_0xad85('0x48')]){logger['info'](_0xad85('0x49'),'Recording\x20is\x20enabled!');_0x24759c[_0xad85('0x4a')]=util['format'](_0xad85('0x4b'),_0xa4c8c7[_0xad85('0x46')],_0x24759c[_0xad85('0x4c')],md5(_0x24759c[_0xad85('0x4c')]));}else{_0x24759c['recordingURL']='';}headers[_0xad85('0x4d')]=getAuth(_0xa4c8c7);return getUser(_0xa4c8c7,_0x3bacca[_0xad85('0x4e')])[_0xad85('0x1e')](function(_0x4f6840){_0x1b2527=_0x4f6840;logger[_0xad85('0xd')]('The\x20User\x20ID\x20is:',_0x1b2527['id']);return getEndUser(_0xa4c8c7,_0x24759c[_0xad85('0x12')],_0x24759c[_0xad85('0x13')]);})[_0xad85('0x1e')](function(_0x59459f){_0xdbaff6=_0x59459f;logger['info'](_0xad85('0x4f'),_0xdbaff6['id']);return getTicket(_0xa4c8c7,_0x1b2527,_0xdbaff6,_0x3a3cb2,_0x24759c);})[_0xad85('0x1e')](function(_0x4bb458){if(_0x4bb458&&_0x4bb458['id']){logger['info']('Ticket\x20created!');logger['info'](_0xad85('0x50'),_0x4bb458['id']);logger[_0xad85('0xd')](_0xad85('0x49'),_0xad85('0x51'));emit(util[_0xad85('0x10')](_0xad85('0x52'),_0x3bacca[_0xad85('0x18')]),'trigger:browser:url',{'uri':util[_0xad85('0x10')](_0xad85('0x53'),_0xa4c8c7[_0xad85('0x21')],_0x4bb458['id'])});}})[_0xad85('0x54')](function(_0x4f2f5f){logger[_0xad85('0x55')](_0xad85('0x49'),JSON[_0xad85('0x31')](_0x4f2f5f));});};exports[_0xad85('0x56')]=function(_0x5d0367,_0x181c63,_0x5866d4,_0x299e39,_0x4920b6,_0x33192a,_0x2b3b59){var _0x4bbccc,_0x4e1306;_0x33192a[_0xad85('0x21')]=intUtil[_0xad85('0x47')](_0x33192a[_0xad85('0x21')]);_0x33192a['serverUrl']=intUtil[_0xad85('0x47')](_0x33192a[_0xad85('0x46')]);if(_0x2b3b59&&_0x2b3b59[_0xad85('0x57')]&&_0x2b3b59[_0xad85('0x57')]!=='none'){logger['info'](_0xad85('0x58'),_0xad85('0x59'));_0x181c63[_0xad85('0x4a')]=util[_0xad85('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x33192a[_0xad85('0x46')],_0x181c63[_0xad85('0x4c')],md5(_0x181c63['uniqueid']));}headers[_0xad85('0x4d')]=getAuth(_0x33192a);return getUser(_0x33192a,_0x299e39[_0xad85('0x4e')])[_0xad85('0x1e')](function(_0x5541a0){_0x4bbccc=_0x5541a0;logger['info']('The\x20User\x20ID\x20is:',_0x4bbccc['id']);return getEndUser(_0x33192a,_0x181c63['destcalleridname'],_0x181c63[_0xad85('0x5a')]);})[_0xad85('0x1e')](function(_0x274d42){_0x4e1306=_0x274d42;logger[_0xad85('0xd')]('The\x20Enduser\x20ID\x20is:',_0x4e1306['id']);return getTicket(_0x33192a,_0x4bbccc,_0x4e1306,_0x5866d4,_0x181c63);})['then'](function(_0x2dbd8e){if(_0x2dbd8e&&_0x2dbd8e['id']){logger[_0xad85('0xd')](_0xad85('0x1f'));logger[_0xad85('0xd')]('The\x20Ticket\x20ID\x20is:',_0x2dbd8e['id']);logger[_0xad85('0xd')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xad85('0x10')](_0xad85('0x52'),_0x299e39['name']),'trigger:browser:url',{'uri':util['format']('%s/helpdesk/tickets/%d',_0x33192a['remoteUri'],_0x2dbd8e['id'])});}})['catch'](function(_0x66bf4b){logger['error'](_0xad85('0x58'),JSON[_0xad85('0x31')](_0x66bf4b));});};exports[_0xad85('0x5b')]=function(_0x3fd312,_0x23fea6,_0x5d872d,_0xf5e45d,_0x5344c8,_0x49debd){var _0x435809,_0x2257e0;_0x49debd[_0xad85('0x21')]=intUtil[_0xad85('0x47')](_0x49debd[_0xad85('0x21')]);_0x49debd[_0xad85('0x46')]=intUtil[_0xad85('0x47')](_0x49debd[_0xad85('0x46')]);if(_0x5344c8&&_0x5344c8[_0xad85('0x48')]){logger[_0xad85('0xd')]('['+_0x23fea6[_0xad85('0x5c')][_0xad85('0x5d')]()+']',_0xad85('0x59'));_0x23fea6[_0xad85('0x4a')]=util[_0xad85('0x10')](_0xad85('0x4b'),_0x49debd['serverUrl'],_0x23fea6[_0xad85('0x4c')],md5(_0x23fea6[_0xad85('0x4c')]));}else{_0x23fea6[_0xad85('0x4a')]='';}headers[_0xad85('0x4d')]=getAuth(_0x49debd);return getUser(_0x49debd,'')[_0xad85('0x1e')](function(_0x22b528){_0x435809=_0x22b528;logger[_0xad85('0xd')](_0xad85('0x5e'),_0x435809['id']);return getEndUser(_0x49debd,_0x23fea6[_0xad85('0x12')],_0x23fea6['calleridnum']);})[_0xad85('0x1e')](function(_0x32dfd9){_0x2257e0=_0x32dfd9;logger[_0xad85('0xd')](_0xad85('0x4f'),_0x2257e0['id']);return getTicket(_0x49debd,_0x435809,_0x2257e0,_0x5d872d,_0x23fea6);})[_0xad85('0x1e')](function(_0x42888c){if(_0x42888c){logger['info'](_0xad85('0x1f'));logger[_0xad85('0xd')](_0xad85('0x50'),_0x42888c['id']);}})[_0xad85('0x54')](function(_0x10c0ab){logger['error']('['+_0x23fea6[_0xad85('0x5c')][_0xad85('0x5d')]()+']',JSON[_0xad85('0x31')](_0x10c0ab));});}; \ 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 8690042..c8ba14b 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 _0x9497=['redis','defaults','localhost','GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','users','email','adminEmail','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','message','Getting\x20user\x20list','agentEmail','userEmail','length','userId','error','toUpperCase','/api/lookup?q=','&f=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','work_number','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','/api/tasks','getString','Subjects','Descriptions','add','ticketId','task','Task\x20created:','/contacts/','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','outbound','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','bluebird','./util','../../../../config/environment','../../../../config/logger'];(function(_0x6a9231,_0x1f7cdb){var _0x290f5b=function(_0x1a5ac1){while(--_0x1a5ac1){_0x6a9231['push'](_0x6a9231['shift']());}};_0x290f5b(++_0x1f7cdb);}(_0x9497,0x193));var _0x7949=function(_0x3bdb9a,_0x4d9d2c){_0x3bdb9a=_0x3bdb9a-0x0;var _0x1f8848=_0x9497[_0x3bdb9a];return _0x1f8848;};'use strict';var _=require(_0x7949('0x0'));var rp=require(_0x7949('0x1'));var md5=require('md5');var util=require(_0x7949('0x2'));var moment=require('moment');var Promise=require(_0x7949('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7949('0x4'));var config=require(_0x7949('0x5'));var logger=require(_0x7949('0x6'))('freshsales');config[_0x7949('0x7')]=_[_0x7949('0x8')](config[_0x7949('0x7')],{'host':_0x7949('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7949('0x7')]));function getAdminId(_0x54817e,_0x16797c,_0x4197de,_0x3d9325){return new Promise(function(_0x52ba84,_0x1d9b05){var _0x2014db=![];var _0x17f86b={'method':_0x7949('0xa'),'uri':_0x3d9325+_0x7949('0xb'),'json':!![]};_0x17f86b[_0x7949('0xc')]=_0x4197de;logger['info'](_0x7949('0xd'));return rp(_0x17f86b)[_0x7949('0xe')](function(_0x27d169){if(_0x27d169){var _0x1f8b2d=_0x27d169[_0x7949('0xf')];var _0x1d6de9=null;for(_0x1d6de9=0x0;_0x1d6de9<_0x1f8b2d['length'];_0x1d6de9++){if(_0x1f8b2d[_0x1d6de9][_0x7949('0x10')]===_0x54817e[_0x7949('0x11')]){_0x54817e[_0x7949('0x12')]=_0x1f8b2d[_0x1d6de9]['id'];_0x2014db=!![];}}if(_0x2014db){logger[_0x7949('0x13')](_0x7949('0x14'),_0x54817e[_0x7949('0x12')]);_0x52ba84(_0x54817e);}else{_0x1d9b05({'statusCode':0x194,'message':_0x7949('0x15')});}}else{_0x1d9b05({'statusCode':0x194,'message':_0x7949('0x15')});}})[_0x7949('0x16')](function(_0x5a14bd){logger['error']('['+[_0x16797c['toUpperCase']()]+']',_0x5a14bd[_0x7949('0x17')]);_0x1d9b05(_0x5a14bd);});});}function getUser(_0xb8b586,_0x5ec2eb,_0xf36eae){return function(_0x68f1b9){return new Promise(function(_0x45d730,_0xfb2492){var _0x1da55b={'method':_0x7949('0xa'),'uri':_0xf36eae+_0x7949('0xb'),'json':!![]};_0x1da55b[_0x7949('0xc')]=_0x5ec2eb;logger[_0x7949('0x13')](_0x7949('0x18'));return rp(_0x1da55b)['then'](function(_0x3e8ec7){if(_0x3e8ec7){var _0x2c1dc4=_0x3e8ec7[_0x7949('0xf')];var _0xff795a=![];var _0x15450f=null;if(_0x68f1b9[_0x7949('0x19')]!==null){logger[_0x7949('0x13')]('Getting\x20user\x20with\x20email',_0x68f1b9[_0x7949('0x19')]);_0x68f1b9[_0x7949('0x1a')]=_0x68f1b9[_0x7949('0x19')];for(_0x15450f=0x0;_0x15450f<_0x2c1dc4[_0x7949('0x1b')];_0x15450f++){if(_0x2c1dc4[_0x15450f]['email']===_0x68f1b9['agentEmail']){_0xff795a=!![];_0x68f1b9[_0x7949('0x1c')]=_0x2c1dc4[_0x15450f]['id'];logger['info']('User\x20found:',_0x68f1b9['userId']);}}}if(!_0xff795a){logger[_0x7949('0x13')]('Admin\x20selected');_0x68f1b9['userEmail']=_0x68f1b9[_0x7949('0x11')];_0x68f1b9['userId']=_0x68f1b9[_0x7949('0x12')];_0xff795a=!![];}if(_0xff795a){_0x45d730(_0x68f1b9);}else{_0xfb2492({'statusCode':0x194,'message':_0x7949('0x15')});}}else{_0xfb2492({'statusCode':0x194,'message':_0x7949('0x15')});}})[_0x7949('0x16')](function(_0xe7c6bf){logger[_0x7949('0x1d')]('['+[_0xb8b586[_0x7949('0x1e')]()]+']',_0xe7c6bf[_0x7949('0x17')]);_0xfb2492(_0xe7c6bf);});});};}function searchContact(_0x7fa01,_0x337180,_0x2bd5d2,_0x53a6db){return new Promise(function(_0x138245,_0x556984){var _0x33de5a={'method':_0x7949('0xa'),'headers':_0x337180,'uri':_0x7fa01+_0x7949('0x1f')+_0x53a6db+_0x7949('0x20')+_0x2bd5d2+'&entities=contact','json':!![]};rp(_0x33de5a)['then'](function(_0x118285){var _0x30fcef=_[_0x7949('0x21')](_0x118285[_0x7949('0x22')]['contacts'],[_0x2bd5d2,_0x53a6db]);_0x138245(_0x30fcef);})[_0x7949('0x16')](function(_0x5f11c0){_0x556984(_0x5f11c0);});});}function getEndUser(_0x2b4e41,_0x19db3c,_0x26f533){return function(_0x5eeddd){return new Promise(function(_0x5484a1,_0x2a1b90){logger[_0x7949('0x13')](util[_0x7949('0x23')](_0x7949('0x24'),_0x5eeddd[_0x7949('0x25')]));searchContact(_0x26f533,_0x19db3c,_0x7949('0x26'),_0x5eeddd[_0x7949('0x25')])[_0x7949('0xe')](function(_0x30b984){if(_0x30b984){_0x5eeddd[_0x7949('0x27')]=_0x30b984['id'];logger[_0x7949('0x13')]('Contact\x20found\x20mobile_number:',_0x5eeddd[_0x7949('0x27')]);return _0x5484a1(_0x5eeddd);}searchContact(_0x26f533,_0x19db3c,_0x7949('0x28'),_0x5eeddd[_0x7949('0x25')])[_0x7949('0xe')](function(_0x240d15){if(_0x240d15){_0x5eeddd[_0x7949('0x27')]=_0x240d15['id'];logger[_0x7949('0x13')]('Contact\x20found\x20work_number:',_0x5eeddd[_0x7949('0x27')]);return _0x5484a1(_0x5eeddd);}createEndUser(_0x5eeddd,_0x2b4e41,_0x19db3c,_0x26f533)[_0x7949('0xe')](function(_0x512e33){logger[_0x7949('0x13')]('Contact\x20created:',_0x512e33['endUserId']);return _0x5484a1(_0x512e33);});});})['catch'](function(_0x55f572){_0x2a1b90(_0x55f572);});});};}function createEndUser(_0x232ebb,_0xd20a5f,_0x103ea3,_0x28b8f9){return new Promise(function(_0x4a52f4,_0x2bbb83){var _0x375883=moment();var _0x26721d={'method':_0x7949('0x29'),'uri':_0x28b8f9+_0x7949('0x2a'),'body':{'contact':{'last_name':_0x232ebb[_0x7949('0x25')],'work_number':_0x232ebb[_0x7949('0x25')],'mobile_number':_0x232ebb[_0x7949('0x25')],'owner_id':_0x232ebb[_0x7949('0x1c')],'created_at':_0x375883[_0x7949('0x23')](_0x7949('0x2b'))}},'json':!![]};_0x26721d[_0x7949('0xc')]=_0x103ea3;logger[_0x7949('0x13')](_0x7949('0x2c'));return rp(_0x26721d)[_0x7949('0xe')](function(_0x57ce83){_0x232ebb[_0x7949('0x27')]=_0x57ce83[_0x7949('0x2d')]['id'];_0x4a52f4(_0x232ebb);})[_0x7949('0x16')](function(_0x35af56){logger[_0x7949('0x1d')]('['+[_0xd20a5f['toUpperCase']()]+']',_0x35af56['message']);_0x2bbb83(_0x35af56[_0x7949('0x17')]);});});}function getTicket(_0x2b113e,_0x17450a,_0x5a43c3,_0x49d047,_0x1d7efe){return function(_0xfb1677){logger[_0x7949('0x13')]('Creating\x20new\x20task');return new Promise(function(_0x10ac06,_0x1621c6){var _0x450cd4=moment();var _0x40657c={'method':_0x7949('0x29'),'uri':_0x5a43c3+_0x7949('0x2e'),'body':{'title':intUtil[_0x7949('0x2f')](_0x49d047[_0x7949('0x30')],_0x1d7efe,'\x20'),'description':intUtil['getString'](_0x49d047[_0x7949('0x31')],_0x1d7efe,'\x0a'),'owner_id':_0xfb1677[_0x7949('0x1c')],'creater_id':_0xfb1677[_0x7949('0x12')],'targetable_id':_0xfb1677[_0x7949('0x27')],'targetable_type':'Contact','created_at':_0x450cd4[_0x7949('0x23')](_0x7949('0x2b')),'due_date':_0x450cd4[_0x7949('0x32')](0x1e,'m')['format']('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x40657c[_0x7949('0xc')]=_0x17450a;return rp(_0x40657c)[_0x7949('0xe')](function(_0xb2e48c){_0xfb1677[_0x7949('0x33')]=_0xb2e48c[_0x7949('0x34')]['id'];logger[_0x7949('0x13')](_0x7949('0x35'),_0xfb1677[_0x7949('0x33')]);_0x10ac06(_0xfb1677);})['catch'](function(_0x3c361d){logger[_0x7949('0x1d')]('['+[_0x2b113e[_0x7949('0x1e')]()]+']',_0x3c361d['message']);_0x1621c6(_0x3c361d[_0x7949('0x17')]);});});};}function emit(_0x3c572c,_0x36b878,_0x1598ed){var _0x513784={'uri':_0x3c572c+_0x7949('0x36')+_0x1598ed};io['to'](util[_0x7949('0x23')]('user:%s',_0x36b878))[_0x7949('0x37')](_0x7949('0x38'),_0x513784);}exports['cs']=function(_0x120ea4,_0x4cbc10,_0x3ed47b,_0x22731f,_0x16a43f,_0x4bfecf,_0x40c50e,_0x215c85){var _0x4d2297={};var _0x8c3bf0={'Authorization':_0x7949('0x39')+_0x4bfecf[_0x7949('0x3a')]};_0x4bfecf['remoteUri']=intUtil[_0x7949('0x3b')](_0x4bfecf[_0x7949('0x3c')]);_0x4bfecf[_0x7949('0x3d')]=intUtil[_0x7949('0x3b')](_0x4bfecf[_0x7949('0x3d')]);var _0x42692a=_0x4bfecf['remoteUri'];_0x4d2297[_0x7949('0x11')]=_0x4bfecf[_0x7949('0x3e')];_0x4d2297[_0x7949('0x25')]=_0x215c85[_0x7949('0x3f')]()===_0x7949('0x40')?_0x4cbc10['destcalleridnum']:_0x4cbc10[_0x7949('0x41')];_0x4d2297[_0x7949('0x42')]=_0x215c85===_0x7949('0x43')||_0x215c85===_0x7949('0x44')?_0x7949('0x43'):'outbound';if(_0x22731f){_0x4d2297[_0x7949('0x19')]=_0x22731f[_0x7949('0x10')];}var _0x3abcda=util[_0x7949('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfecf[_0x7949('0x3d')],_0x4cbc10[_0x7949('0x45')],md5(_0x4cbc10[_0x7949('0x45')]));if(_0x16a43f&&_0x16a43f[_0x7949('0x46')]){logger[_0x7949('0x13')](_0x7949('0x47'),'Recording\x20is\x20enabled!');_0x4cbc10[_0x7949('0x48')]=_0x3abcda;}else if(_0x40c50e&&_0x40c50e[_0x7949('0x49')]&&_0x40c50e[_0x7949('0x49')]!==_0x7949('0x4a')){logger[_0x7949('0x13')](_0x7949('0x4b'),_0x7949('0x4c'));_0x4cbc10[_0x7949('0x48')]=_0x3abcda;}else{_0x4cbc10[_0x7949('0x48')]='';}return getAdminId(_0x4d2297,_0x215c85,_0x8c3bf0,_0x42692a)[_0x7949('0xe')](getUser(_0x215c85,_0x8c3bf0,_0x42692a))['then'](getEndUser(_0x215c85,_0x8c3bf0,_0x42692a))[_0x7949('0xe')](getTicket(_0x215c85,_0x8c3bf0,_0x42692a,_0x3ed47b,_0x4cbc10))[_0x7949('0xe')](function(_0x4fb8a4){logger['info'](util[_0x7949('0x23')](_0x7949('0x4d'),_0x4fb8a4[_0x7949('0x33')]));if(_0x215c85!==_0x7949('0x44')){logger[_0x7949('0x13')]('['+[_0x215c85[_0x7949('0x1e')]()]+']',_0x7949('0x4e'));emit(_0x42692a,_0x22731f[_0x7949('0x4f')],_0x4fb8a4[_0x7949('0x27')]);}})[_0x7949('0x16')](function(_0x428f92){logger[_0x7949('0x1d')]('['+[_0x215c85['toUpperCase']()]+_0x7949('0x50'),util[_0x7949('0x51')](_0x428f92,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x826a=['outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','redis','localhost','GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','message','info','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','userEmail','User\x20found:','userId','Admin\x20selected','catch','/api/lookup?q=','&f=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','POST','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','toUpperCase','Creating\x20new\x20task','/api/tasks','getString','Subjects','Contact','add','ticketId','task','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase'];(function(_0x5efeab,_0x29cf8a){var _0x1fad59=function(_0x22d6ed){while(--_0x22d6ed){_0x5efeab['push'](_0x5efeab['shift']());}};_0x1fad59(++_0x29cf8a);}(_0x826a,0x67));var _0xa826=function(_0x107f2b,_0x53a593){_0x107f2b=_0x107f2b-0x0;var _0x57d7dc=_0x826a[_0x107f2b];return _0x57d7dc;};'use strict';var _=require(_0xa826('0x0'));var rp=require('request-promise');var md5=require(_0xa826('0x1'));var util=require(_0xa826('0x2'));var moment=require(_0xa826('0x3'));var Promise=require(_0xa826('0x4'));var Redis=require(_0xa826('0x5'));var intUtil=require(_0xa826('0x6'));var config=require(_0xa826('0x7'));var logger=require(_0xa826('0x8'))(_0xa826('0x9'));config['redis']=_[_0xa826('0xa')](config[_0xa826('0xb')],{'host':_0xa826('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa826('0xb')]));function getAdminId(_0x30348f,_0x4ce415,_0x5229e7,_0x4598ff){return new Promise(function(_0x421d8d,_0x522725){var _0x1ad747=![];var _0x5e6fd8={'method':_0xa826('0xd'),'uri':_0x4598ff+_0xa826('0xe'),'json':!![]};_0x5e6fd8[_0xa826('0xf')]=_0x5229e7;logger['info'](_0xa826('0x10'));return rp(_0x5e6fd8)[_0xa826('0x11')](function(_0x27cd4d){if(_0x27cd4d){var _0x232fe5=_0x27cd4d[_0xa826('0x12')];var _0x49fb14=null;for(_0x49fb14=0x0;_0x49fb14<_0x232fe5[_0xa826('0x13')];_0x49fb14++){if(_0x232fe5[_0x49fb14][_0xa826('0x14')]===_0x30348f[_0xa826('0x15')]){_0x30348f[_0xa826('0x16')]=_0x232fe5[_0x49fb14]['id'];_0x1ad747=!![];}}if(_0x1ad747){logger['info'](_0xa826('0x17'),_0x30348f['adminId']);_0x421d8d(_0x30348f);}else{_0x522725({'statusCode':0x194,'message':_0xa826('0x18')});}}else{_0x522725({'statusCode':0x194,'message':_0xa826('0x18')});}})['catch'](function(_0x4fa9c9){logger[_0xa826('0x19')]('['+[_0x4ce415['toUpperCase']()]+']',_0x4fa9c9[_0xa826('0x1a')]);_0x522725(_0x4fa9c9);});});}function getUser(_0x147207,_0x448be1,_0xda6a22){return function(_0x3486b4){return new Promise(function(_0x3357a7,_0x450cf4){var _0x193346={'method':'GET','uri':_0xda6a22+_0xa826('0xe'),'json':!![]};_0x193346[_0xa826('0xf')]=_0x448be1;logger[_0xa826('0x1b')](_0xa826('0x1c'));return rp(_0x193346)[_0xa826('0x11')](function(_0x286ece){if(_0x286ece){var _0x49001b=_0x286ece['users'];var _0x572f8c=![];var _0x29bae1=null;if(_0x3486b4['agentEmail']!==null){logger[_0xa826('0x1b')](_0xa826('0x1d'),_0x3486b4[_0xa826('0x1e')]);_0x3486b4[_0xa826('0x1f')]=_0x3486b4['agentEmail'];for(_0x29bae1=0x0;_0x29bae1<_0x49001b[_0xa826('0x13')];_0x29bae1++){if(_0x49001b[_0x29bae1]['email']===_0x3486b4['agentEmail']){_0x572f8c=!![];_0x3486b4['userId']=_0x49001b[_0x29bae1]['id'];logger[_0xa826('0x1b')](_0xa826('0x20'),_0x3486b4[_0xa826('0x21')]);}}}if(!_0x572f8c){logger[_0xa826('0x1b')](_0xa826('0x22'));_0x3486b4[_0xa826('0x1f')]=_0x3486b4[_0xa826('0x15')];_0x3486b4['userId']=_0x3486b4['adminId'];_0x572f8c=!![];}if(_0x572f8c){_0x3357a7(_0x3486b4);}else{_0x450cf4({'statusCode':0x194,'message':_0xa826('0x18')});}}else{_0x450cf4({'statusCode':0x194,'message':_0xa826('0x18')});}})[_0xa826('0x23')](function(_0x36748b){logger[_0xa826('0x19')]('['+[_0x147207['toUpperCase']()]+']',_0x36748b[_0xa826('0x1a')]);_0x450cf4(_0x36748b);});});};}function searchContact(_0x15894d,_0x290fa3,_0x2a5165,_0x1ceec9){return new Promise(function(_0x18b76b,_0x292682){var _0x2935c0={'method':_0xa826('0xd'),'headers':_0x290fa3,'uri':_0x15894d+_0xa826('0x24')+_0x1ceec9+_0xa826('0x25')+_0x2a5165+'&entities=contact','json':!![]};rp(_0x2935c0)['then'](function(_0x5f3177){var _0x4f21d1=_[_0xa826('0x26')](_0x5f3177[_0xa826('0x27')][_0xa826('0x27')],[_0x2a5165,_0x1ceec9]);_0x18b76b(_0x4f21d1);})[_0xa826('0x23')](function(_0x560a72){_0x292682(_0x560a72);});});}function getEndUser(_0x38ed7a,_0x3697e9,_0x5abd5d){return function(_0xed589){return new Promise(function(_0x52005d,_0x3cba1b){logger[_0xa826('0x1b')](util[_0xa826('0x28')](_0xa826('0x29'),_0xed589[_0xa826('0x2a')]));searchContact(_0x5abd5d,_0x3697e9,'mobile_number',_0xed589['contactNumber'])[_0xa826('0x11')](function(_0x1e0f7d){if(_0x1e0f7d){_0xed589[_0xa826('0x2b')]=_0x1e0f7d['id'];logger['info'](_0xa826('0x2c'),_0xed589[_0xa826('0x2b')]);return _0x52005d(_0xed589);}searchContact(_0x5abd5d,_0x3697e9,_0xa826('0x2d'),_0xed589[_0xa826('0x2a')])['then'](function(_0x536c6b){if(_0x536c6b){_0xed589[_0xa826('0x2b')]=_0x536c6b['id'];logger[_0xa826('0x1b')](_0xa826('0x2e'),_0xed589[_0xa826('0x2b')]);return _0x52005d(_0xed589);}createEndUser(_0xed589,_0x38ed7a,_0x3697e9,_0x5abd5d)[_0xa826('0x11')](function(_0x17b2bf){logger[_0xa826('0x1b')]('Contact\x20created:',_0x17b2bf[_0xa826('0x2b')]);return _0x52005d(_0x17b2bf);});});})['catch'](function(_0x1deb9e){_0x3cba1b(_0x1deb9e);});});};}function createEndUser(_0x2a854a,_0x173cd3,_0x31c177,_0x1549d5){return new Promise(function(_0x5a0a2d,_0x26ec17){var _0x40642a=moment();var _0x26cf1e={'method':_0xa826('0x2f'),'uri':_0x1549d5+'/api/contacts','body':{'contact':{'last_name':_0x2a854a[_0xa826('0x2a')],'work_number':_0x2a854a[_0xa826('0x2a')],'mobile_number':_0x2a854a[_0xa826('0x2a')],'owner_id':_0x2a854a[_0xa826('0x21')],'created_at':_0x40642a[_0xa826('0x28')](_0xa826('0x30'))}},'json':!![]};_0x26cf1e[_0xa826('0xf')]=_0x31c177;logger['info'](_0xa826('0x31'));return rp(_0x26cf1e)[_0xa826('0x11')](function(_0x3c73f5){_0x2a854a[_0xa826('0x2b')]=_0x3c73f5[_0xa826('0x32')]['id'];_0x5a0a2d(_0x2a854a);})['catch'](function(_0x58ca8f){logger[_0xa826('0x19')]('['+[_0x173cd3[_0xa826('0x33')]()]+']',_0x58ca8f[_0xa826('0x1a')]);_0x26ec17(_0x58ca8f[_0xa826('0x1a')]);});});}function getTicket(_0x463766,_0x514d54,_0x299450,_0x2ffdd6,_0x1294a1){return function(_0x12e107){logger[_0xa826('0x1b')](_0xa826('0x34'));return new Promise(function(_0x8fcea4,_0x32182d){var _0x513460=moment();var _0x1ae560={'method':'POST','uri':_0x299450+_0xa826('0x35'),'body':{'title':intUtil[_0xa826('0x36')](_0x2ffdd6[_0xa826('0x37')],_0x1294a1,'\x20'),'description':intUtil[_0xa826('0x36')](_0x2ffdd6['Descriptions'],_0x1294a1,'\x0a'),'owner_id':_0x12e107[_0xa826('0x21')],'creater_id':_0x12e107[_0xa826('0x16')],'targetable_id':_0x12e107[_0xa826('0x2b')],'targetable_type':_0xa826('0x38'),'created_at':_0x513460[_0xa826('0x28')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x513460[_0xa826('0x39')](0x1e,'m')[_0xa826('0x28')](_0xa826('0x30'))},'json':!![]};_0x1ae560[_0xa826('0xf')]=_0x514d54;return rp(_0x1ae560)[_0xa826('0x11')](function(_0x66415c){_0x12e107[_0xa826('0x3a')]=_0x66415c[_0xa826('0x3b')]['id'];logger[_0xa826('0x1b')]('Task\x20created:',_0x12e107['ticketId']);_0x8fcea4(_0x12e107);})[_0xa826('0x23')](function(_0xa8e9a){logger[_0xa826('0x19')]('['+[_0x463766[_0xa826('0x33')]()]+']',_0xa8e9a[_0xa826('0x1a')]);_0x32182d(_0xa8e9a[_0xa826('0x1a')]);});});};}function emit(_0x5cff2c,_0x5e0761,_0x2711c2){var _0x41843c={'uri':_0x5cff2c+_0xa826('0x3c')+_0x2711c2};io['to'](util[_0xa826('0x28')](_0xa826('0x3d'),_0x5e0761))[_0xa826('0x3e')](_0xa826('0x3f'),_0x41843c);}exports['cs']=function(_0x1ac906,_0x37e07e,_0x196b9f,_0x5ccf5f,_0xa0470f,_0x3e5cca,_0x5bac56,_0x4d563a){var _0x5d8bc9={};var _0x27b72e={'Authorization':_0xa826('0x40')+_0x3e5cca[_0xa826('0x41')]};_0x3e5cca[_0xa826('0x42')]=intUtil[_0xa826('0x43')](_0x3e5cca[_0xa826('0x42')]);_0x3e5cca[_0xa826('0x44')]=intUtil[_0xa826('0x43')](_0x3e5cca[_0xa826('0x44')]);var _0x2f9d87=_0x3e5cca[_0xa826('0x42')];_0x5d8bc9[_0xa826('0x15')]=_0x3e5cca[_0xa826('0x45')];_0x5d8bc9[_0xa826('0x2a')]=_0x4d563a[_0xa826('0x46')]()===_0xa826('0x47')?_0x37e07e[_0xa826('0x48')]:_0x37e07e[_0xa826('0x49')];_0x5d8bc9[_0xa826('0x4a')]=_0x4d563a===_0xa826('0x4b')||_0x4d563a===_0xa826('0x4c')?_0xa826('0x4b'):_0xa826('0x47');if(_0x5ccf5f){_0x5d8bc9['agentEmail']=_0x5ccf5f[_0xa826('0x14')];}var _0x3a8e0b=util[_0xa826('0x28')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3e5cca[_0xa826('0x44')],_0x37e07e[_0xa826('0x4d')],md5(_0x37e07e['uniqueid']));if(_0xa0470f&&_0xa0470f['monitor_format']){logger[_0xa826('0x1b')](_0xa826('0x4e'),_0xa826('0x4f'));_0x37e07e[_0xa826('0x50')]=_0x3a8e0b;}else if(_0x5bac56&&_0x5bac56['recordingFormat']&&_0x5bac56[_0xa826('0x51')]!=='none'){logger[_0xa826('0x1b')]('[OUTBOUND]',_0xa826('0x4f'));_0x37e07e[_0xa826('0x50')]=_0x3a8e0b;}else{_0x37e07e[_0xa826('0x50')]='';}return getAdminId(_0x5d8bc9,_0x4d563a,_0x27b72e,_0x2f9d87)[_0xa826('0x11')](getUser(_0x4d563a,_0x27b72e,_0x2f9d87))['then'](getEndUser(_0x4d563a,_0x27b72e,_0x2f9d87))['then'](getTicket(_0x4d563a,_0x27b72e,_0x2f9d87,_0x196b9f,_0x37e07e))[_0xa826('0x11')](function(_0x361f80){logger[_0xa826('0x1b')](util['format'](_0xa826('0x52'),_0x361f80[_0xa826('0x3a')]));if(_0x4d563a!==_0xa826('0x4c')){logger['info']('['+[_0x4d563a[_0xa826('0x33')]()]+']',_0xa826('0x53'));emit(_0x2f9d87,_0x5ccf5f[_0xa826('0x54')],_0x361f80[_0xa826('0x2b')]);}})['catch'](function(_0x51189c){logger[_0xa826('0x19')]('['+[_0x4d563a[_0xa826('0x33')]()]+_0xa826('0x55'),util[_0xa826('0x56')](_0x51189c,{'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 bb53a24..847bb80 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 _0xfb69=['./freshdesk','./zoho','./desk','./vtiger','./servicenow','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','includes','toLowerCase','data2','find','data3','queue','outbound','log','EVENT\x20UNKNOWN','unmanaged','data1','freshsales','servicenow','dynamics365','unknown\x20integration','../../../../config/logger','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','error','lodash','util','./zendesk','./salesforce','./sugarcrm'];(function(_0x5543b0,_0x22bf63){var _0x41248a=function(_0x263fc9){while(--_0x263fc9){_0x5543b0['push'](_0x5543b0['shift']());}};_0x41248a(++_0x22bf63);}(_0xfb69,0x12b));var _0x9fb6=function(_0x1cca67,_0x4fad50){_0x1cca67=_0x1cca67-0x0;var _0x2152ea=_0xfb69[_0x1cca67];return _0x2152ea;};'use strict';var _=require(_0x9fb6('0x0'));var util=require(_0x9fb6('0x1'));var zendesk=require(_0x9fb6('0x2'));var salesforce=require(_0x9fb6('0x3'));var sugarcrm=require(_0x9fb6('0x4'));var freshdesk=require(_0x9fb6('0x5'));var zoho=require(_0x9fb6('0x6'));var desk=require(_0x9fb6('0x7'));var vtiger=require(_0x9fb6('0x8'));var servicenow=require(_0x9fb6('0x9'));var dynamics365=require('./dynamics365');var freshsales=require(_0x9fb6('0xa'));var integrations=[_0x9fb6('0xb'),_0x9fb6('0xc'),_0x9fb6('0xd'),_0x9fb6('0xe'),_0x9fb6('0xf'),_0x9fb6('0x10'),_0x9fb6('0x11'),'dynamics365','freshsales','servicenow'];exports['exec']=function(_0x1b3ccd,_0x5cdf8,_0x54adec,_0x2c04a1,_0x4093e6,_0x812bfb){if(_0x54adec){if(_[_0x9fb6('0x12')](integrations,_0x1b3ccd['data1'][_0x9fb6('0x13')]())){try{var _0x4f3f16=null;var _0x5c95a9='';var _0x249f3d=_0x54adec[_0x1b3ccd['data1'][_0x9fb6('0x13')]()];if(_0x249f3d){var _0x7d3dd5=_0x249f3d[_0x1b3ccd[_0x9fb6('0x14')]];if(_0x7d3dd5){var _0x2e19ca=_[_0x9fb6('0x15')](_0x7d3dd5['Configurations'],{'id':parseInt(_0x1b3ccd[_0x9fb6('0x16')],0xa)});if(_0x2e19ca){if(_0x2c04a1){if(_0x4093e6&&_0x5cdf8[_0x9fb6('0x17')]){_0x5c95a9='queue';}else if(_0x5cdf8['routeId']){_0x5c95a9=_0x9fb6('0x18');}else{console[_0x9fb6('0x19')](_0x9fb6('0x1a'),_0x5cdf8);}}else{_0x5c95a9=_0x9fb6('0x1b');}switch(_0x1b3ccd[_0x9fb6('0x1c')][_0x9fb6('0x13')]()){case _0x9fb6('0xb'):zendesk[_0x5c95a9](_0x1b3ccd,_0x5cdf8,_0x2e19ca,_0x2c04a1,_0x4093e6,_0x7d3dd5,_0x812bfb);break;case _0x9fb6('0xc'):salesforce[_0x5c95a9](_0x1b3ccd,_0x5cdf8,_0x2e19ca,_0x2c04a1,_0x4093e6,_0x7d3dd5,_0x812bfb);break;case _0x9fb6('0xd'):sugarcrm[_0x5c95a9](_0x1b3ccd,_0x5cdf8,_0x2e19ca,_0x2c04a1,_0x4093e6,_0x7d3dd5,_0x812bfb);break;case'freshdesk':freshdesk[_0x5c95a9](_0x1b3ccd,_0x5cdf8,_0x2e19ca,_0x2c04a1,_0x4093e6,_0x7d3dd5,_0x812bfb);break;case'zoho':zoho[_0x5c95a9](_0x1b3ccd,_0x5cdf8,_0x2e19ca,_0x2c04a1,_0x4093e6,_0x7d3dd5,_0x812bfb);break;case _0x9fb6('0x10'):desk[_0x5c95a9](_0x1b3ccd,_0x5cdf8,_0x2e19ca,_0x2c04a1,_0x4093e6,_0x7d3dd5,_0x812bfb);break;case _0x9fb6('0x11'):vtiger[_0x5c95a9](_0x1b3ccd,_0x5cdf8,_0x2e19ca,_0x2c04a1,_0x4093e6,_0x7d3dd5,_0x812bfb);break;case _0x9fb6('0x1d'):freshsales['cs'](_0x1b3ccd,_0x5cdf8,_0x2e19ca,_0x2c04a1,_0x4093e6,_0x7d3dd5,_0x812bfb,_0x5c95a9);break;case _0x9fb6('0x1e'):servicenow['cs'](_0x1b3ccd,_0x5cdf8,_0x2e19ca,_0x2c04a1,_0x4093e6,_0x7d3dd5,_0x812bfb,_0x5c95a9);break;case _0x9fb6('0x1f'):dynamics365['cs'](_0x1b3ccd,_0x5cdf8,_0x2e19ca,_0x2c04a1,_0x4093e6,_0x7d3dd5,_0x812bfb,_0x5c95a9);break;default:console[_0x9fb6('0x19')](_0x9fb6('0x20'));}}else{_0x4f3f16=require(_0x9fb6('0x21'))(_0x1b3ccd[_0x9fb6('0x1c')][_0x9fb6('0x13')]());_0x4f3f16['error'](_0x9fb6('0x22'),util[_0x9fb6('0x23')]('%s\x20configuration\x20#%s\x20not\x20found',_0x1b3ccd['data1'][_0x9fb6('0x13')](),_0x1b3ccd[_0x9fb6('0x16')]));}}else{_0x4f3f16=require('../../../../config/logger')(_0x1b3ccd['data1'][_0x9fb6('0x13')]());_0x4f3f16['error'](_0x9fb6('0x22'),util['format'](_0x9fb6('0x24'),_0x1b3ccd['data1'][_0x9fb6('0x13')](),_0x1b3ccd['data2']));}}else{}}catch(_0x5e669a){console[_0x9fb6('0x25')](_0x5e669a);}}}}; \ No newline at end of file +var _0x956d=['error','%s\x20account\x20#%s\x20not\x20found','./zendesk','./salesforce','./freshdesk','./desk','./vtiger','./freshsales','salesforce','sugarcrm','freshdesk','zoho','desk','dynamics365','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','log','EVENT\x20UNKNOWN','unmanaged','zendesk','vtiger','freshsales','unknown\x20integration','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3'];(function(_0x2d55f3,_0x4cf5a4){var _0x59ce5d=function(_0x265084){while(--_0x265084){_0x2d55f3['push'](_0x2d55f3['shift']());}};_0x59ce5d(++_0x4cf5a4);}(_0x956d,0x1bc));var _0xd956=function(_0x44245d,_0x567a7c){_0x44245d=_0x44245d-0x0;var _0x421c02=_0x956d[_0x44245d];return _0x421c02;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require(_0xd956('0x0'));var salesforce=require(_0xd956('0x1'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0xd956('0x2'));var zoho=require('./zoho');var desk=require(_0xd956('0x3'));var vtiger=require(_0xd956('0x4'));var servicenow=require('./servicenow');var dynamics365=require('./dynamics365');var freshsales=require(_0xd956('0x5'));var integrations=['zendesk',_0xd956('0x6'),_0xd956('0x7'),_0xd956('0x8'),_0xd956('0x9'),_0xd956('0xa'),'vtiger',_0xd956('0xb'),'freshsales',_0xd956('0xc')];exports[_0xd956('0xd')]=function(_0xe8791b,_0x4f83f6,_0x150749,_0x53741e,_0xde151f,_0x2b5401){if(_0x150749){if(_[_0xd956('0xe')](integrations,_0xe8791b[_0xd956('0xf')][_0xd956('0x10')]())){try{var _0x4aa5cd=null;var _0x301f2e='';var _0x202992=_0x150749[_0xe8791b[_0xd956('0xf')]['toLowerCase']()];if(_0x202992){var _0xa4b0e5=_0x202992[_0xe8791b[_0xd956('0x11')]];if(_0xa4b0e5){var _0x41f046=_[_0xd956('0x12')](_0xa4b0e5[_0xd956('0x13')],{'id':parseInt(_0xe8791b['data3'],0xa)});if(_0x41f046){if(_0x53741e){if(_0xde151f&&_0x4f83f6['queue']){_0x301f2e='queue';}else if(_0x4f83f6['routeId']){_0x301f2e='outbound';}else{console[_0xd956('0x14')](_0xd956('0x15'),_0x4f83f6);}}else{_0x301f2e=_0xd956('0x16');}switch(_0xe8791b[_0xd956('0xf')][_0xd956('0x10')]()){case _0xd956('0x17'):zendesk[_0x301f2e](_0xe8791b,_0x4f83f6,_0x41f046,_0x53741e,_0xde151f,_0xa4b0e5,_0x2b5401);break;case _0xd956('0x6'):salesforce[_0x301f2e](_0xe8791b,_0x4f83f6,_0x41f046,_0x53741e,_0xde151f,_0xa4b0e5,_0x2b5401);break;case _0xd956('0x7'):sugarcrm[_0x301f2e](_0xe8791b,_0x4f83f6,_0x41f046,_0x53741e,_0xde151f,_0xa4b0e5,_0x2b5401);break;case'freshdesk':freshdesk[_0x301f2e](_0xe8791b,_0x4f83f6,_0x41f046,_0x53741e,_0xde151f,_0xa4b0e5,_0x2b5401);break;case _0xd956('0x9'):zoho[_0x301f2e](_0xe8791b,_0x4f83f6,_0x41f046,_0x53741e,_0xde151f,_0xa4b0e5,_0x2b5401);break;case _0xd956('0xa'):desk[_0x301f2e](_0xe8791b,_0x4f83f6,_0x41f046,_0x53741e,_0xde151f,_0xa4b0e5,_0x2b5401);break;case _0xd956('0x18'):vtiger[_0x301f2e](_0xe8791b,_0x4f83f6,_0x41f046,_0x53741e,_0xde151f,_0xa4b0e5,_0x2b5401);break;case _0xd956('0x19'):freshsales['cs'](_0xe8791b,_0x4f83f6,_0x41f046,_0x53741e,_0xde151f,_0xa4b0e5,_0x2b5401,_0x301f2e);break;case _0xd956('0xc'):servicenow['cs'](_0xe8791b,_0x4f83f6,_0x41f046,_0x53741e,_0xde151f,_0xa4b0e5,_0x2b5401,_0x301f2e);break;case _0xd956('0xb'):dynamics365['cs'](_0xe8791b,_0x4f83f6,_0x41f046,_0x53741e,_0xde151f,_0xa4b0e5,_0x2b5401,_0x301f2e);break;default:console[_0xd956('0x14')](_0xd956('0x1a'));}}else{_0x4aa5cd=require(_0xd956('0x1b'))(_0xe8791b[_0xd956('0xf')][_0xd956('0x10')]());_0x4aa5cd['error'](_0xd956('0x1c'),util[_0xd956('0x1d')](_0xd956('0x1e'),_0xe8791b[_0xd956('0xf')][_0xd956('0x10')](),_0xe8791b[_0xd956('0x1f')]));}}else{_0x4aa5cd=require('../../../../config/logger')(_0xe8791b[_0xd956('0xf')][_0xd956('0x10')]());_0x4aa5cd[_0xd956('0x20')](_0xd956('0x1c'),util[_0xd956('0x1d')](_0xd956('0x21'),_0xe8791b[_0xd956('0xf')]['toLowerCase'](),_0xe8791b['data2']));}}else{}}catch(_0x41ee48){console[_0xd956('0x20')](_0x41ee48);}}}}; \ 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 d28a8e2..f112328 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 _0xdbaa=['isNil','sobject','User','find','execute','then','Email','Agent\x20%s\x20found.','resolve','Name','identity','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','length','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','attributes','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','LastName','Caller\x20-\x20%s','Company','No\x20Company','includes','string','toString','variable','idField','variableName','customVariable','Variable','name','concat','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','error','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:browser:url','Salesforce\x20account\x20type\x20not\x20recognized','catch','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','jsforce','./util','salesforce','defaults','socket.io-emitter','redis','emit','Subjects','getString','Descriptions','ticketType','ActivityDate','utc','IsRecurrence','contact','endUserType','lead','WhoId','account','Case','leadId','info','create'];(function(_0x22754d,_0x3ffa6b){var _0x4e2724=function(_0x3e4691){while(--_0x3e4691){_0x22754d['push'](_0x22754d['shift']());}};_0x4e2724(++_0x3ffa6b);}(_0xdbaa,0x156));var _0xadba=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xdbaa[_0x1d24eb];return _0x1dc576;};'use strict';var _=require(_0xadba('0x0'));var rp=require(_0xadba('0x1'));var moment=require(_0xadba('0x2'));var BPromise=require(_0xadba('0x3'));var md5=require('md5');var jsforce=require(_0xadba('0x4'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xadba('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xadba('0x6'));config['redis']=_[_0xadba('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xadba('0x8'))(new Redis(config[_0xadba('0x9')]));function emit(_0x442c9d,_0x97775f,_0x46d546){io['to'](_0x442c9d)[_0xadba('0xa')](_0x97775f,_0x46d546);}function getTicket(_0x32cd87,_0x1368cb,_0x175973,_0x4f9be1,_0x1fb272,_0x3b7c26,_0x4740a2,_0x5ef5b1){var _0x449280=Object['assign']({},{'OwnerId':_0x1368cb['id'],'Subject':intUtil['getString'](_0x4f9be1[_0xadba('0xb')],_0x1fb272,'\x20'),'Description':intUtil[_0xadba('0xc')](_0x4f9be1[_0xadba('0xd')],_0x1fb272,'\x0a')},getCustomFields(_0x3b7c26,_0x1fb272));if(_0x175973){if(_0x4f9be1[_0xadba('0xe')]==='Task'){_0x449280[_0xadba('0xf')]=moment[_0xadba('0x10')]();_0x449280['IsReminderSet']=![];_0x449280[_0xadba('0x11')]=![];if(_0x175973['endUserType']===_0xadba('0x12')||_0x175973[_0xadba('0x13')]===_0xadba('0x14')){_0x449280[_0xadba('0x15')]=_0x175973['id'];}else if(_0x175973[_0xadba('0x13')]===_0xadba('0x16')){_0x449280['WhatId']=_0x175973['id'];}}else if(_0x4f9be1['ticketType']===_0xadba('0x17')){if(_0x175973[_0xadba('0x13')]===_0xadba('0x12')){_0x449280['ContactId']=_0x175973['id'];}else if(_0x175973[_0xadba('0x13')]===_0xadba('0x16')){_0x449280['AccountId']=_0x175973['id'];}else if(_0x175973[_0xadba('0x13')]===_0xadba('0x14')&&_0x4f9be1['leadId']){_0x449280[_0x4f9be1[_0xadba('0x18')]]=_0x175973['id'];}else{logger[_0xadba('0x19')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x4740a2['sobject'](_0x4f9be1[_0xadba('0xe')])[_0xadba('0x1a')](_0x449280);}function getUser(_0x471c77,_0x34cde5,_0x55b8fb){if(!_[_0xadba('0x1b')](_0x34cde5)&&intUtil['validateEmail'](_0x34cde5)){var _0x31c12c={'Email':_0x34cde5};var _0x41b7ef={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x55b8fb[_0xadba('0x1c')](_0xadba('0x1d'))[_0xadba('0x1e')](_0x31c12c,_0x41b7ef)[_0xadba('0x1f')]()[_0xadba('0x20')](function(_0x56bab7){if(_0x56bab7['length']){var _0x1881b6=_[_0xadba('0x1e')](_0x56bab7,function(_0x440f47){return _0x440f47[_0xadba('0x21')]===_0x34cde5;});if(_0x1881b6){logger[_0xadba('0x19')](_0xadba('0x22'),_0x34cde5);return BPromise[_0xadba('0x23')]({'id':_0x1881b6['Id'],'name':_0x1881b6[_0xadba('0x24')]});}}else{logger[_0xadba('0x19')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x34cde5);return _0x55b8fb[_0xadba('0x25')]()['then'](function(_0x52d19a){return BPromise[_0xadba('0x23')]({'id':_0x52d19a[_0xadba('0x26')],'name':_0x52d19a[_0xadba('0x27')]});});}});}else{logger[_0xadba('0x19')](_0xadba('0x28'),_0x34cde5);return _0x55b8fb[_0xadba('0x25')]()[_0xadba('0x20')](function(_0x194f0c){return BPromise[_0xadba('0x23')]({'id':_0x194f0c[_0xadba('0x26')],'name':_0x194f0c[_0xadba('0x27')]});});}}function getEndUser(_0x57e918,_0x9a7b69,_0x3185f1,_0x54ba9b,_0xbfa0e7){var _0x1308c1={'$or':{'Phone':_0x54ba9b}};var _0x32b649={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xadba('0x23')]()[_0xadba('0x20')](function(){logger[_0xadba('0x19')](_0xadba('0x29'),_0x54ba9b,_0x9a7b69[_0xadba('0x2a')]);switch(_0x9a7b69[_0xadba('0x2a')]){case _0xadba('0x2b'):var _0xb75d24=_[_0xadba('0x2c')](_0x1308c1);if(_0x9a7b69[_0xadba('0x2d')]){var _0x3c8856={};_0x3c8856[_0x9a7b69[_0xadba('0x2d')]]=_0x54ba9b;_[_0xadba('0x2e')](_0xb75d24[_0xadba('0x2f')],_0x3c8856);}return _0xbfa0e7[_0xadba('0x1c')](_0xadba('0x30'))[_0xadba('0x1e')](_0xb75d24,_0x32b649)[_0xadba('0x1f')]()[_0xadba('0x20')](function(_0x180021){if(_0x180021&&_0x180021[_0xadba('0x31')]){return _0x180021;}else{var _0x5c105a=_['cloneDeep'](_0x1308c1);if(_0x9a7b69['additionalSearchLead']){var _0x2f66e5={};_0x2f66e5[_0x9a7b69[_0xadba('0x32')]]=_0x54ba9b;_[_0xadba('0x2e')](_0x5c105a['$or'],_0x2f66e5);}return _0xbfa0e7['sobject'](_0xadba('0x33'))[_0xadba('0x1e')](_0x5c105a,_0x32b649);}});case _0xadba('0x34'):var _0x108ad7=_[_0xadba('0x2c')](_0x1308c1);if(_0x9a7b69[_0xadba('0x35')]){var _0x3c8856={};_0x3c8856[_0x9a7b69[_0xadba('0x35')]]=_0x54ba9b;_['merge'](_0x108ad7[_0xadba('0x2f')],_0x3c8856);}return _0xbfa0e7[_0xadba('0x1c')](_0xadba('0x36'))[_0xadba('0x1e')](_0x108ad7,_0x32b649)[_0xadba('0x1f')]()[_0xadba('0x20')](function(_0x1371db){if(_0x1371db&&_0x1371db[_0xadba('0x31')]){return _0x1371db;}else{var _0x29e722=_[_0xadba('0x2c')](_0x1308c1);if(_0x9a7b69[_0xadba('0x2d')]){var _0x25e4bb={};_0x25e4bb[_0x9a7b69['additionalSearchContact']]=_0x54ba9b;_[_0xadba('0x2e')](_0x29e722[_0xadba('0x2f')],_0x25e4bb);}return _0xbfa0e7[_0xadba('0x1c')]('Contact')[_0xadba('0x1e')](_0x29e722,_0x32b649)[_0xadba('0x20')](function(_0x9018a4){if(_0x9018a4&&_0x9018a4[_0xadba('0x31')]){return _0x9018a4;}else{var _0x27d5f2=_[_0xadba('0x2c')](_0x1308c1);if(_0x9a7b69[_0xadba('0x32')]){var _0x2ee3c8={};_0x2ee3c8[_0x9a7b69[_0xadba('0x32')]]=_0x54ba9b;_[_0xadba('0x2e')](_0x27d5f2[_0xadba('0x2f')],_0x2ee3c8);}return _0xbfa0e7[_0xadba('0x1c')]('Lead')[_0xadba('0x1e')](_0x27d5f2,_0x32b649);}});}});case'contact':var _0xb75d24=_[_0xadba('0x2c')](_0x1308c1);if(_0x9a7b69[_0xadba('0x2d')]){var _0x3c8856={};_0x3c8856[_0x9a7b69[_0xadba('0x2d')]]=_0x54ba9b;_[_0xadba('0x2e')](_0xb75d24['$or'],_0x3c8856);}return _0xbfa0e7[_0xadba('0x1c')](_0xadba('0x30'))[_0xadba('0x1e')](_0xb75d24,_0x32b649)[_0xadba('0x1f')]();case _0xadba('0x14'):var _0x58736c=_[_0xadba('0x2c')](_0x1308c1);if(_0x9a7b69[_0xadba('0x32')]){var _0x3c8856={};_0x3c8856[_0x9a7b69[_0xadba('0x32')]]=_0x54ba9b;_[_0xadba('0x2e')](_0x58736c[_0xadba('0x2f')],_0x3c8856);}return _0xbfa0e7[_0xadba('0x1c')](_0xadba('0x33'))[_0xadba('0x1e')](_0x58736c,_0x32b649);case _0xadba('0x16'):var _0x108ad7=_['cloneDeep'](_0x1308c1);if(_0x9a7b69[_0xadba('0x35')]){var _0x3c8856={};_0x3c8856[_0x9a7b69['additionalSearchAccount']]=_0x54ba9b;_['merge'](_0x108ad7[_0xadba('0x2f')],_0x3c8856);}return _0xbfa0e7['sobject']('Account')[_0xadba('0x1e')](_0x108ad7,_0x32b649);default:return null;}})[_0xadba('0x20')](function(_0x1ecea6){if(_0x1ecea6&&_0x1ecea6[_0xadba('0x31')]){var _0x10a231=_[_0xadba('0x37')](_0x1ecea6);if(_0x10a231){return BPromise[_0xadba('0x23')]({'id':_0x10a231['Id'],'name':_0x10a231['Name'],'phone':_0x10a231['Phone'],'endUserType':_0x10a231[_0xadba('0x38')][_0xadba('0x39')][_0xadba('0x3a')]()});}}})[_0xadba('0x20')](function(_0xe2762f){if(_0xe2762f){logger[_0xadba('0x19')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0xe2762f[_0xadba('0x13')],_0x54ba9b);return BPromise['resolve'](_0xe2762f);}else{logger[_0xadba('0x19')](_0xadba('0x3b'),_0x54ba9b);var _0x36affa={'Phone':_0x54ba9b};if(_0x9a7b69[_0xadba('0x3c')]){if(_0x9a7b69[_0xadba('0x3c')]===_0xadba('0x12')){logger[_0xadba('0x19')](_0xadba('0x3d'),_0x54ba9b,_0x9a7b69[_0xadba('0x3c')]);_0x36affa['LastName']=_0x3185f1!==_0xadba('0x3e')?_0x3185f1:util[_0xadba('0x3f')]('Caller\x20-\x20%s',_0x54ba9b);}else if(_0x9a7b69[_0xadba('0x3c')]===_0xadba('0x14')){logger[_0xadba('0x19')](_0xadba('0x3d'),_0x54ba9b,_0x9a7b69[_0xadba('0x3c')]);_0x36affa[_0xadba('0x40')]=_0x3185f1!==_0xadba('0x3e')?_0x3185f1:util[_0xadba('0x3f')](_0xadba('0x41'),_0x54ba9b);_0x36affa[_0xadba('0x42')]=_0xadba('0x43');}else if(_0x9a7b69[_0xadba('0x3c')]===_0xadba('0x16')){logger[_0xadba('0x19')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x54ba9b,_0x9a7b69[_0xadba('0x3c')]);_0x36affa[_0xadba('0x24')]=_0x3185f1!==_0xadba('0x3e')?_0x3185f1:util['format'](_0xadba('0x41'),_0x54ba9b);}else{return null;}}return _0xbfa0e7[_0xadba('0x1c')](_['upperFirst'](_0x9a7b69[_0xadba('0x3c')]))['create'](_0x36affa)[_0xadba('0x20')](function(_0x26d7aa){return BPromise[_0xadba('0x23')]({'id':_0x26d7aa['id'],'endUserType':_0x9a7b69[_0xadba('0x3c')]});});}});}function getCustomFields(_0xc31181,_0x507e5e){var _0x108a54={};if(_0xc31181[_0xadba('0x31')]>0x0){_['forEach'](_0xc31181,function(_0x13f306){if(_[_0xadba('0x44')]([_0xadba('0x45'),'picklist'],_0x13f306[_0xadba('0x39')])&&_0x13f306['idField']){_0x108a54[_0x13f306['idField']]=_0x13f306['content'][_0xadba('0x46')]();}else if(_0x13f306['type']===_0xadba('0x47')&&_0x13f306['variableName']&&_0x13f306[_0xadba('0x48')]){_0x507e5e[_0x13f306[_0xadba('0x49')]]&&(_0x108a54[_0x13f306[_0xadba('0x48')]]=_0x507e5e[_0x13f306[_0xadba('0x49')]][_0xadba('0x46')]());}else if(_0x13f306['type']===_0xadba('0x4a')&&_0x13f306['Variable']&&_0x13f306[_0xadba('0x4b')][_0xadba('0x4c')]&&_0x13f306['idField']){_0x507e5e[_0x13f306[_0xadba('0x4b')][_0xadba('0x4c')][_0xadba('0x3a')]()]&&(_0x108a54[_0x13f306['idField']]=_0x507e5e[_0x13f306[_0xadba('0x4b')][_0xadba('0x4c')][_0xadba('0x3a')]()][_0xadba('0x46')]());}});}return _0x108a54;}function getConnection(_0x44b69f){var _0x2de293=_0x44b69f['password'][_0xadba('0x4d')](_0x44b69f[_0xadba('0x4e')]);var _0x6b4734=new jsforce[(_0xadba('0x4f'))]({'oauth2':{'loginUrl':_0x44b69f['remoteUri']||_0xadba('0x50'),'clientId':_0x44b69f[_0xadba('0x51')],'clientSecret':_0x44b69f[_0xadba('0x52')]}});return _0x6b4734[_0xadba('0x53')](_0x44b69f[_0xadba('0x54')],_0x2de293)[_0xadba('0x20')](function(){logger['info'](_0xadba('0x55'));return _0x6b4734;});}exports[_0xadba('0x56')]=function(_0x2261d2,_0x2568d8,_0x139536,_0x3df117,_0x3eadc4,_0x40fb89){var _0x5c6da0,_0x7c8714,_0x1dbe60,_0x34ea7a;_0x40fb89[_0xadba('0x57')]=intUtil[_0xadba('0x58')](_0x40fb89[_0xadba('0x57')]);_0x40fb89[_0xadba('0x59')]=intUtil[_0xadba('0x58')](_0x40fb89[_0xadba('0x59')]);if(_0x3eadc4&&_0x3eadc4[_0xadba('0x5a')]){logger[_0xadba('0x19')]('[QUEUE]',_0xadba('0x5b'));_0x2568d8[_0xadba('0x5c')]=util[_0xadba('0x3f')](_0xadba('0x5d'),_0x40fb89['serverUrl'],_0x2568d8['uniqueid'],md5(_0x2568d8[_0xadba('0x5e')]));}else{_0x2568d8[_0xadba('0x5c')]='';}return getConnection(_0x40fb89)['then'](function(_0x82745){_0x34ea7a=_0x82745;return getUser(_0x40fb89,_0x3df117['email'],_0x34ea7a);})[_0xadba('0x20')](function(_0x1a59cb){_0x5c6da0=_0x1a59cb;return getEndUser(_0x40fb89,_0x139536,_0x2568d8[_0xadba('0x5f')],_0x2568d8[_0xadba('0x60')],_0x34ea7a);})['then'](function(_0x3a74a3){_0x7c8714=_0x3a74a3;return getTicket(_0x40fb89,_0x5c6da0,_0x7c8714,_0x139536,_0x2568d8,_0x139536[_0xadba('0x61')],_0x34ea7a,'queue');})[_0xadba('0x20')](function(_0x895c9d){_0x1dbe60=_0x895c9d;logger[_0xadba('0x19')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x1dbe60['id']);logger[_0xadba('0x19')](_0xadba('0x62'),_0x1dbe60['id'],_0x3df117[_0xadba('0x4c')],_0x40fb89[_0xadba('0x39')]);switch(_0x40fb89[_0xadba('0x39')]){case _0xadba('0x63'):emit(util['format'](_0xadba('0x64'),_0x3df117[_0xadba('0x4c')]),_0xadba('0x65'),{'recordId':_0x1dbe60['id']});break;case _0xadba('0x66'):emit(util[_0xadba('0x3f')](_0xadba('0x64'),_0x3df117['name']),'trigger:browser:url',{'uri':util[_0xadba('0x3f')]('%s/%s/e',_0x34ea7a[_0xadba('0x67')],_0x1dbe60['id'])});break;default:logger['error'](_0xadba('0x68'));}})['catch'](function(_0x4219ff){logger[_0xadba('0x69')](_0xadba('0x6a'),_0x4219ff);});};exports[_0xadba('0x6b')]=function(_0x2be5ba,_0x114afc,_0x40e088,_0xd04928,_0xc82bb5,_0x14a96a,_0x1e5a82){var _0x2c01d5,_0x51cb8b,_0x5b6fb6,_0x338fbe;_0x14a96a[_0xadba('0x57')]=intUtil[_0xadba('0x58')](_0x14a96a[_0xadba('0x57')]);_0x14a96a[_0xadba('0x59')]=intUtil[_0xadba('0x58')](_0x14a96a[_0xadba('0x59')]);if(_0x1e5a82&&_0x1e5a82[_0xadba('0x6c')]&&_0x1e5a82[_0xadba('0x6c')]!==_0xadba('0x6d')){logger['info'](_0xadba('0x6e'),'Recording\x20is\x20enabled!');_0x114afc['recordingURL']=util['format'](_0xadba('0x5d'),_0x14a96a[_0xadba('0x57')],_0x114afc[_0xadba('0x5e')],md5(_0x114afc[_0xadba('0x5e')]));}return getConnection(_0x14a96a)['then'](function(_0x33b6ef){_0x338fbe=_0x33b6ef;return getUser(_0x14a96a,_0xd04928[_0xadba('0x6f')],_0x338fbe);})[_0xadba('0x20')](function(_0x2d3ca2){_0x2c01d5=_0x2d3ca2;return getEndUser(_0x14a96a,_0x40e088,_0x114afc[_0xadba('0x70')],_0x114afc[_0xadba('0x71')],_0x338fbe);})[_0xadba('0x20')](function(_0x437852){_0x51cb8b=_0x437852;return getTicket(_0x14a96a,_0x2c01d5,_0x51cb8b,_0x40e088,_0x114afc,_0x40e088[_0xadba('0x61')],_0x338fbe,'outbound');})[_0xadba('0x20')](function(_0xa004a7){_0x5b6fb6=_0xa004a7;logger[_0xadba('0x19')](_0xadba('0x72'),_0x5b6fb6['id']);logger[_0xadba('0x19')](_0xadba('0x73'),_0x5b6fb6['id'],_0xd04928[_0xadba('0x4c')],_0x14a96a[_0xadba('0x39')]);switch(_0x14a96a[_0xadba('0x39')]){case _0xadba('0x63'):emit(util[_0xadba('0x3f')]('user:%s',_0xd04928[_0xadba('0x4c')]),_0xadba('0x65'),{'recordId':_0x5b6fb6['id']});break;case _0xadba('0x66'):emit(util['format'](_0xadba('0x64'),_0xd04928['name']),_0xadba('0x74'),{'uri':util['format']('%s/%s/e',_0x338fbe[_0xadba('0x67')],_0x5b6fb6['id'])});break;default:logger[_0xadba('0x69')](_0xadba('0x6e'),_0xadba('0x75'));}})[_0xadba('0x76')](function(_0x4917fe){logger[_0xadba('0x69')](_0xadba('0x6e'),_0x4917fe);});};exports['unmanaged']=function(_0x3485fd,_0x4c0dd1,_0x7e96f9,_0x5ec22a,_0x34834e,_0x1fceda){var _0x42a67b,_0x2d46d8,_0x12de67,_0x305fa6;_0x1fceda[_0xadba('0x57')]=intUtil[_0xadba('0x58')](_0x1fceda[_0xadba('0x57')]);_0x1fceda[_0xadba('0x59')]=intUtil[_0xadba('0x58')](_0x1fceda['remoteUri']);if(_0x34834e&&_0x34834e['monitor_format']){logger[_0xadba('0x19')]('['+_0x4c0dd1[_0xadba('0x77')][_0xadba('0x78')]()+']',_0xadba('0x5b'));_0x4c0dd1[_0xadba('0x5c')]=util[_0xadba('0x3f')](_0xadba('0x5d'),_0x1fceda[_0xadba('0x57')],_0x4c0dd1[_0xadba('0x5e')],md5(_0x4c0dd1[_0xadba('0x5e')]));}else{_0x4c0dd1[_0xadba('0x5c')]='';}return getConnection(_0x1fceda)['then'](function(_0x3973ca){_0x305fa6=_0x3973ca;if(!_[_0xadba('0x1b')](_0x5ec22a)){return getUser(_0x1fceda,_0x5ec22a[_0xadba('0x4c')],_0x305fa6);}else{return getUser(_0x1fceda,null,_0x305fa6);}})['then'](function(_0x51299c){_0x42a67b=_0x51299c;return getEndUser(_0x1fceda,_0x7e96f9,_0x4c0dd1['calleridname'],_0x4c0dd1[_0xadba('0x60')],_0x305fa6);})[_0xadba('0x20')](function(_0x1f4273){_0x2d46d8=_0x1f4273;return getTicket(_0x1fceda,_0x42a67b,_0x2d46d8,_0x7e96f9,_0x4c0dd1,_0x7e96f9[_0xadba('0x61')],_0x305fa6);})['then'](function(_0x84ca8b){_0x12de67=_0x84ca8b;logger[_0xadba('0x19')]('['+_0x4c0dd1['lastevent'][_0xadba('0x78')]()+_0xadba('0x79'),_0x12de67['id']);logger[_0xadba('0x19')]('['+_0x4c0dd1[_0xadba('0x77')][_0xadba('0x78')]()+_0xadba('0x7a'),_0x1fceda[_0xadba('0x39')]);})[_0xadba('0x76')](function(_0x156a98){logger[_0xadba('0x69')]('['+_0x4c0dd1[_0xadba('0x77')][_0xadba('0x78')]()+']',_0x156a98);});}; \ No newline at end of file +var _0x5a69=['[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','md5','jsforce','./util','../../../../config/environment','salesforce','redis','defaults','localhost','socket.io-emitter','Subjects','getString','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','WhatId','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','then','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','length','additionalSearchLead','account_contact_lead','additionalSearchAccount','Account','Lead','account','first','Phone','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','string','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields'];(function(_0x40a8a1,_0x1d8e83){var _0x1028bf=function(_0x89061e){while(--_0x89061e){_0x40a8a1['push'](_0x40a8a1['shift']());}};_0x1028bf(++_0x1d8e83);}(_0x5a69,0x1a0));var _0x95a6=function(_0x46171d,_0x68a49e){_0x46171d=_0x46171d-0x0;var _0x5f047e=_0x5a69[_0x46171d];return _0x5f047e;};'use strict';var _=require(_0x95a6('0x0'));var rp=require('request-promise');var moment=require(_0x95a6('0x1'));var BPromise=require(_0x95a6('0x2'));var md5=require(_0x95a6('0x3'));var jsforce=require(_0x95a6('0x4'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x95a6('0x5'));var config=require(_0x95a6('0x6'));var logger=require('../../../../config/logger')(_0x95a6('0x7'));config[_0x95a6('0x8')]=_[_0x95a6('0x9')](config[_0x95a6('0x8')],{'host':_0x95a6('0xa'),'port':0x18eb});var io=require(_0x95a6('0xb'))(new Redis(config['redis']));function emit(_0x51617d,_0x3928c1,_0x3df0f4){io['to'](_0x51617d)['emit'](_0x3928c1,_0x3df0f4);}function getTicket(_0xacd840,_0x35558e,_0x35ab76,_0x573a26,_0x156f1e,_0x48e8b5,_0x19a858,_0x258dbe){var _0x5eca42=Object['assign']({},{'OwnerId':_0x35558e['id'],'Subject':intUtil['getString'](_0x573a26[_0x95a6('0xc')],_0x156f1e,'\x20'),'Description':intUtil[_0x95a6('0xd')](_0x573a26[_0x95a6('0xe')],_0x156f1e,'\x0a')},getCustomFields(_0x48e8b5,_0x156f1e));if(_0x35ab76){if(_0x573a26[_0x95a6('0xf')]===_0x95a6('0x10')){_0x5eca42[_0x95a6('0x11')]=moment[_0x95a6('0x12')]();_0x5eca42[_0x95a6('0x13')]=![];_0x5eca42[_0x95a6('0x14')]=![];if(_0x35ab76[_0x95a6('0x15')]===_0x95a6('0x16')||_0x35ab76['endUserType']===_0x95a6('0x17')){_0x5eca42[_0x95a6('0x18')]=_0x35ab76['id'];}else if(_0x35ab76[_0x95a6('0x15')]==='account'){_0x5eca42[_0x95a6('0x19')]=_0x35ab76['id'];}}else if(_0x573a26[_0x95a6('0xf')]===_0x95a6('0x1a')){if(_0x35ab76[_0x95a6('0x15')]===_0x95a6('0x16')){_0x5eca42[_0x95a6('0x1b')]=_0x35ab76['id'];}else if(_0x35ab76[_0x95a6('0x15')]==='account'){_0x5eca42[_0x95a6('0x1c')]=_0x35ab76['id'];}else if(_0x35ab76[_0x95a6('0x15')]===_0x95a6('0x17')&&_0x573a26[_0x95a6('0x1d')]){_0x5eca42[_0x573a26[_0x95a6('0x1d')]]=_0x35ab76['id'];}else{logger[_0x95a6('0x1e')](_0x95a6('0x1f'));}}}return _0x19a858[_0x95a6('0x20')](_0x573a26[_0x95a6('0xf')])[_0x95a6('0x21')](_0x5eca42);}function getUser(_0x32d0e7,_0x54d9d8,_0x446d2b){if(!_[_0x95a6('0x22')](_0x54d9d8)&&intUtil[_0x95a6('0x23')](_0x54d9d8)){var _0x11b298={'Email':_0x54d9d8};var _0x3d0ae3={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x446d2b[_0x95a6('0x20')](_0x95a6('0x24'))[_0x95a6('0x25')](_0x11b298,_0x3d0ae3)[_0x95a6('0x26')]()[_0x95a6('0x27')](function(_0x24efd5){if(_0x24efd5['length']){var _0x339f85=_[_0x95a6('0x25')](_0x24efd5,function(_0x773b87){return _0x773b87[_0x95a6('0x28')]===_0x54d9d8;});if(_0x339f85){logger['info']('Agent\x20%s\x20found.',_0x54d9d8);return BPromise[_0x95a6('0x29')]({'id':_0x339f85['Id'],'name':_0x339f85[_0x95a6('0x2a')]});}}else{logger[_0x95a6('0x1e')](_0x95a6('0x2b'),_0x54d9d8);return _0x446d2b[_0x95a6('0x2c')]()['then'](function(_0x5b62cb){return BPromise[_0x95a6('0x29')]({'id':_0x5b62cb['user_id'],'name':_0x5b62cb[_0x95a6('0x2d')]});});}});}else{logger['info'](_0x95a6('0x2b'),_0x54d9d8);return _0x446d2b['identity']()['then'](function(_0x4e5f0e){return BPromise[_0x95a6('0x29')]({'id':_0x4e5f0e[_0x95a6('0x2e')],'name':_0x4e5f0e[_0x95a6('0x2d')]});});}}function getEndUser(_0x510856,_0x505eba,_0x1eed0a,_0x55e1fe,_0x457999){var _0x2bcc7b={'$or':{'Phone':_0x55e1fe}};var _0x53ceec={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x95a6('0x27')](function(){logger[_0x95a6('0x1e')](_0x95a6('0x2f'),_0x55e1fe,_0x505eba['moduleSearch']);switch(_0x505eba[_0x95a6('0x30')]){case _0x95a6('0x31'):var _0xeafb38=_[_0x95a6('0x32')](_0x2bcc7b);if(_0x505eba[_0x95a6('0x33')]){var _0x2f4d85={};_0x2f4d85[_0x505eba[_0x95a6('0x33')]]=_0x55e1fe;_[_0x95a6('0x34')](_0xeafb38[_0x95a6('0x35')],_0x2f4d85);}return _0x457999[_0x95a6('0x20')](_0x95a6('0x36'))['find'](_0xeafb38,_0x53ceec)[_0x95a6('0x26')]()[_0x95a6('0x27')](function(_0x229f21){if(_0x229f21&&_0x229f21[_0x95a6('0x37')]){return _0x229f21;}else{var _0x1d0fa3=_[_0x95a6('0x32')](_0x2bcc7b);if(_0x505eba[_0x95a6('0x38')]){var _0x17e654={};_0x17e654[_0x505eba[_0x95a6('0x38')]]=_0x55e1fe;_[_0x95a6('0x34')](_0x1d0fa3[_0x95a6('0x35')],_0x17e654);}return _0x457999[_0x95a6('0x20')]('Lead')[_0x95a6('0x25')](_0x1d0fa3,_0x53ceec);}});case _0x95a6('0x39'):var _0x12c4fc=_['cloneDeep'](_0x2bcc7b);if(_0x505eba[_0x95a6('0x3a')]){var _0x2f4d85={};_0x2f4d85[_0x505eba[_0x95a6('0x3a')]]=_0x55e1fe;_[_0x95a6('0x34')](_0x12c4fc['$or'],_0x2f4d85);}return _0x457999['sobject'](_0x95a6('0x3b'))[_0x95a6('0x25')](_0x12c4fc,_0x53ceec)[_0x95a6('0x26')]()[_0x95a6('0x27')](function(_0x293b7b){if(_0x293b7b&&_0x293b7b[_0x95a6('0x37')]){return _0x293b7b;}else{var _0x5a98b7=_['cloneDeep'](_0x2bcc7b);if(_0x505eba[_0x95a6('0x33')]){var _0x51edf4={};_0x51edf4[_0x505eba[_0x95a6('0x33')]]=_0x55e1fe;_[_0x95a6('0x34')](_0x5a98b7[_0x95a6('0x35')],_0x51edf4);}return _0x457999['sobject'](_0x95a6('0x36'))[_0x95a6('0x25')](_0x5a98b7,_0x53ceec)[_0x95a6('0x27')](function(_0x55c606){if(_0x55c606&&_0x55c606['length']){return _0x55c606;}else{var _0x1d6ede=_[_0x95a6('0x32')](_0x2bcc7b);if(_0x505eba[_0x95a6('0x38')]){var _0x50702d={};_0x50702d[_0x505eba['additionalSearchLead']]=_0x55e1fe;_[_0x95a6('0x34')](_0x1d6ede['$or'],_0x50702d);}return _0x457999['sobject'](_0x95a6('0x3c'))[_0x95a6('0x25')](_0x1d6ede,_0x53ceec);}});}});case _0x95a6('0x16'):var _0xeafb38=_[_0x95a6('0x32')](_0x2bcc7b);if(_0x505eba[_0x95a6('0x33')]){var _0x2f4d85={};_0x2f4d85[_0x505eba[_0x95a6('0x33')]]=_0x55e1fe;_[_0x95a6('0x34')](_0xeafb38['$or'],_0x2f4d85);}return _0x457999[_0x95a6('0x20')]('Contact')[_0x95a6('0x25')](_0xeafb38,_0x53ceec)[_0x95a6('0x26')]();case _0x95a6('0x17'):var _0x705c8d=_[_0x95a6('0x32')](_0x2bcc7b);if(_0x505eba['additionalSearchLead']){var _0x2f4d85={};_0x2f4d85[_0x505eba[_0x95a6('0x38')]]=_0x55e1fe;_[_0x95a6('0x34')](_0x705c8d[_0x95a6('0x35')],_0x2f4d85);}return _0x457999[_0x95a6('0x20')](_0x95a6('0x3c'))[_0x95a6('0x25')](_0x705c8d,_0x53ceec);case _0x95a6('0x3d'):var _0x12c4fc=_[_0x95a6('0x32')](_0x2bcc7b);if(_0x505eba[_0x95a6('0x3a')]){var _0x2f4d85={};_0x2f4d85[_0x505eba[_0x95a6('0x3a')]]=_0x55e1fe;_[_0x95a6('0x34')](_0x12c4fc[_0x95a6('0x35')],_0x2f4d85);}return _0x457999[_0x95a6('0x20')](_0x95a6('0x3b'))['find'](_0x12c4fc,_0x53ceec);default:return null;}})[_0x95a6('0x27')](function(_0x5aeaa8){if(_0x5aeaa8&&_0x5aeaa8['length']){var _0x158e3b=_[_0x95a6('0x3e')](_0x5aeaa8);if(_0x158e3b){return BPromise['resolve']({'id':_0x158e3b['Id'],'name':_0x158e3b[_0x95a6('0x2a')],'phone':_0x158e3b[_0x95a6('0x3f')],'endUserType':_0x158e3b['attributes'][_0x95a6('0x40')]['toLowerCase']()});}}})[_0x95a6('0x27')](function(_0x406f51){if(_0x406f51){logger[_0x95a6('0x1e')](_0x95a6('0x41'),_0x406f51[_0x95a6('0x15')],_0x55e1fe);return BPromise[_0x95a6('0x29')](_0x406f51);}else{logger['info'](_0x95a6('0x42'),_0x55e1fe);var _0x36ab0e={'Phone':_0x55e1fe};if(_0x505eba[_0x95a6('0x43')]){if(_0x505eba['moduleCreate']==='contact'){logger['info'](_0x95a6('0x44'),_0x55e1fe,_0x505eba[_0x95a6('0x43')]);_0x36ab0e[_0x95a6('0x45')]=_0x1eed0a!==_0x95a6('0x46')?_0x1eed0a:util[_0x95a6('0x47')]('Caller\x20-\x20%s',_0x55e1fe);}else if(_0x505eba[_0x95a6('0x43')]==='lead'){logger[_0x95a6('0x1e')](_0x95a6('0x44'),_0x55e1fe,_0x505eba['moduleCreate']);_0x36ab0e[_0x95a6('0x45')]=_0x1eed0a!==_0x95a6('0x46')?_0x1eed0a:util[_0x95a6('0x47')](_0x95a6('0x48'),_0x55e1fe);_0x36ab0e[_0x95a6('0x49')]=_0x95a6('0x4a');}else if(_0x505eba[_0x95a6('0x43')]==='account'){logger[_0x95a6('0x1e')](_0x95a6('0x44'),_0x55e1fe,_0x505eba[_0x95a6('0x43')]);_0x36ab0e[_0x95a6('0x2a')]=_0x1eed0a!==_0x95a6('0x46')?_0x1eed0a:util['format'](_0x95a6('0x48'),_0x55e1fe);}else{return null;}}return _0x457999[_0x95a6('0x20')](_[_0x95a6('0x4b')](_0x505eba[_0x95a6('0x43')]))[_0x95a6('0x21')](_0x36ab0e)[_0x95a6('0x27')](function(_0x3e426c){return BPromise[_0x95a6('0x29')]({'id':_0x3e426c['id'],'endUserType':_0x505eba[_0x95a6('0x43')]});});}});}function getCustomFields(_0x27b0c6,_0x4621e7){var _0x1237e9={};if(_0x27b0c6[_0x95a6('0x37')]>0x0){_['forEach'](_0x27b0c6,function(_0x42bce0){if(_['includes']([_0x95a6('0x4c'),'picklist'],_0x42bce0['type'])&&_0x42bce0[_0x95a6('0x4d')]){_0x1237e9[_0x42bce0[_0x95a6('0x4d')]]=_0x42bce0[_0x95a6('0x4e')][_0x95a6('0x4f')]();}else if(_0x42bce0['type']==='variable'&&_0x42bce0['variableName']&&_0x42bce0['idField']){_0x4621e7[_0x42bce0[_0x95a6('0x50')]]&&(_0x1237e9[_0x42bce0[_0x95a6('0x4d')]]=_0x4621e7[_0x42bce0[_0x95a6('0x50')]]['toString']());}else if(_0x42bce0[_0x95a6('0x40')]===_0x95a6('0x51')&&_0x42bce0[_0x95a6('0x52')]&&_0x42bce0[_0x95a6('0x52')][_0x95a6('0x53')]&&_0x42bce0[_0x95a6('0x4d')]){_0x4621e7[_0x42bce0['Variable'][_0x95a6('0x53')]['toLowerCase']()]&&(_0x1237e9[_0x42bce0[_0x95a6('0x4d')]]=_0x4621e7[_0x42bce0[_0x95a6('0x52')][_0x95a6('0x53')][_0x95a6('0x54')]()][_0x95a6('0x4f')]());}});}return _0x1237e9;}function getConnection(_0x23808c){var _0xfecfaf=_0x23808c[_0x95a6('0x55')][_0x95a6('0x56')](_0x23808c[_0x95a6('0x57')]);var _0x69df11=new jsforce[(_0x95a6('0x58'))]({'oauth2':{'loginUrl':_0x23808c[_0x95a6('0x59')]||_0x95a6('0x5a'),'clientId':_0x23808c[_0x95a6('0x5b')],'clientSecret':_0x23808c[_0x95a6('0x5c')]}});return _0x69df11[_0x95a6('0x5d')](_0x23808c[_0x95a6('0x5e')],_0xfecfaf)[_0x95a6('0x27')](function(){logger[_0x95a6('0x1e')](_0x95a6('0x5f'));return _0x69df11;});}exports['queue']=function(_0x49cd71,_0x2a4ce7,_0x485dfe,_0x143bb8,_0x44d775,_0x111f7b){var _0x38e7e2,_0x5b25c3,_0x1a9bed,_0xec91a4;_0x111f7b['serverUrl']=intUtil[_0x95a6('0x60')](_0x111f7b[_0x95a6('0x61')]);_0x111f7b[_0x95a6('0x59')]=intUtil[_0x95a6('0x60')](_0x111f7b[_0x95a6('0x59')]);if(_0x44d775&&_0x44d775[_0x95a6('0x62')]){logger[_0x95a6('0x1e')](_0x95a6('0x63'),_0x95a6('0x64'));_0x2a4ce7[_0x95a6('0x65')]=util[_0x95a6('0x47')](_0x95a6('0x66'),_0x111f7b['serverUrl'],_0x2a4ce7[_0x95a6('0x67')],md5(_0x2a4ce7[_0x95a6('0x67')]));}else{_0x2a4ce7[_0x95a6('0x65')]='';}return getConnection(_0x111f7b)[_0x95a6('0x27')](function(_0x5260d4){_0xec91a4=_0x5260d4;return getUser(_0x111f7b,_0x143bb8[_0x95a6('0x68')],_0xec91a4);})[_0x95a6('0x27')](function(_0x4b11ac){_0x38e7e2=_0x4b11ac;return getEndUser(_0x111f7b,_0x485dfe,_0x2a4ce7[_0x95a6('0x69')],_0x2a4ce7[_0x95a6('0x6a')],_0xec91a4);})[_0x95a6('0x27')](function(_0x2000cf){_0x5b25c3=_0x2000cf;return getTicket(_0x111f7b,_0x38e7e2,_0x5b25c3,_0x485dfe,_0x2a4ce7,_0x485dfe[_0x95a6('0x6b')],_0xec91a4,'queue');})[_0x95a6('0x27')](function(_0x294fb5){_0x1a9bed=_0x294fb5;logger[_0x95a6('0x1e')](_0x95a6('0x6c'),_0x1a9bed['id']);logger[_0x95a6('0x1e')](_0x95a6('0x6d'),_0x1a9bed['id'],_0x143bb8[_0x95a6('0x53')],_0x111f7b[_0x95a6('0x40')]);switch(_0x111f7b[_0x95a6('0x40')]){case _0x95a6('0x6e'):emit(util['format']('user:%s',_0x143bb8[_0x95a6('0x53')]),_0x95a6('0x6f'),{'recordId':_0x1a9bed['id']});break;case _0x95a6('0x70'):emit(util[_0x95a6('0x47')](_0x95a6('0x71'),_0x143bb8[_0x95a6('0x53')]),_0x95a6('0x72'),{'uri':util[_0x95a6('0x47')]('%s/%s/e',_0xec91a4['instanceUrl'],_0x1a9bed['id'])});break;default:logger[_0x95a6('0x73')](_0x95a6('0x74'));}})[_0x95a6('0x75')](function(_0x409d2f){logger[_0x95a6('0x73')](_0x95a6('0x63'),_0x409d2f);});};exports['outbound']=function(_0x521d18,_0x383f3f,_0x50ebc2,_0x448b39,_0x49a89c,_0x17455d,_0x25af05){var _0x2d9770,_0x2817da,_0x5ce972,_0x15acdd;_0x17455d['serverUrl']=intUtil[_0x95a6('0x60')](_0x17455d[_0x95a6('0x61')]);_0x17455d[_0x95a6('0x59')]=intUtil[_0x95a6('0x60')](_0x17455d[_0x95a6('0x59')]);if(_0x25af05&&_0x25af05[_0x95a6('0x76')]&&_0x25af05[_0x95a6('0x76')]!=='none'){logger[_0x95a6('0x1e')](_0x95a6('0x77'),_0x95a6('0x64'));_0x383f3f['recordingURL']=util[_0x95a6('0x47')](_0x95a6('0x66'),_0x17455d[_0x95a6('0x61')],_0x383f3f[_0x95a6('0x67')],md5(_0x383f3f[_0x95a6('0x67')]));}return getConnection(_0x17455d)[_0x95a6('0x27')](function(_0x3d0351){_0x15acdd=_0x3d0351;return getUser(_0x17455d,_0x448b39['email'],_0x15acdd);})['then'](function(_0x10af2d){_0x2d9770=_0x10af2d;return getEndUser(_0x17455d,_0x50ebc2,_0x383f3f[_0x95a6('0x78')],_0x383f3f[_0x95a6('0x79')],_0x15acdd);})[_0x95a6('0x27')](function(_0x8ab848){_0x2817da=_0x8ab848;return getTicket(_0x17455d,_0x2d9770,_0x2817da,_0x50ebc2,_0x383f3f,_0x50ebc2['Fields'],_0x15acdd,_0x95a6('0x7a'));})['then'](function(_0x596ade){_0x5ce972=_0x596ade;logger[_0x95a6('0x1e')](_0x95a6('0x7b'),_0x5ce972['id']);logger['info'](_0x95a6('0x7c'),_0x5ce972['id'],_0x448b39[_0x95a6('0x53')],_0x17455d['type']);switch(_0x17455d['type']){case _0x95a6('0x6e'):emit(util['format'](_0x95a6('0x71'),_0x448b39[_0x95a6('0x53')]),_0x95a6('0x6f'),{'recordId':_0x5ce972['id']});break;case _0x95a6('0x70'):emit(util[_0x95a6('0x47')](_0x95a6('0x71'),_0x448b39[_0x95a6('0x53')]),_0x95a6('0x72'),{'uri':util[_0x95a6('0x47')](_0x95a6('0x7d'),_0x15acdd['instanceUrl'],_0x5ce972['id'])});break;default:logger[_0x95a6('0x73')](_0x95a6('0x77'),_0x95a6('0x7e'));}})['catch'](function(_0x18f76e){logger[_0x95a6('0x73')]('[OUTBOUND]',_0x18f76e);});};exports[_0x95a6('0x7f')]=function(_0x2a6a6e,_0x2a34c2,_0x272a1f,_0x5f5693,_0x2a9b4a,_0x1f998a){var _0x33d7bf,_0x3bab30,_0x266445,_0xe115e6;_0x1f998a[_0x95a6('0x61')]=intUtil[_0x95a6('0x60')](_0x1f998a[_0x95a6('0x61')]);_0x1f998a['remoteUri']=intUtil[_0x95a6('0x60')](_0x1f998a[_0x95a6('0x59')]);if(_0x2a9b4a&&_0x2a9b4a[_0x95a6('0x62')]){logger['info']('['+_0x2a34c2[_0x95a6('0x80')]['toUpperCase']()+']',_0x95a6('0x64'));_0x2a34c2[_0x95a6('0x65')]=util[_0x95a6('0x47')](_0x95a6('0x66'),_0x1f998a['serverUrl'],_0x2a34c2[_0x95a6('0x67')],md5(_0x2a34c2['uniqueid']));}else{_0x2a34c2[_0x95a6('0x65')]='';}return getConnection(_0x1f998a)['then'](function(_0x4a3ac4){_0xe115e6=_0x4a3ac4;if(!_['isNil'](_0x5f5693)){return getUser(_0x1f998a,_0x5f5693['name'],_0xe115e6);}else{return getUser(_0x1f998a,null,_0xe115e6);}})[_0x95a6('0x27')](function(_0x491cac){_0x33d7bf=_0x491cac;return getEndUser(_0x1f998a,_0x272a1f,_0x2a34c2[_0x95a6('0x69')],_0x2a34c2[_0x95a6('0x6a')],_0xe115e6);})[_0x95a6('0x27')](function(_0x61035e){_0x3bab30=_0x61035e;return getTicket(_0x1f998a,_0x33d7bf,_0x3bab30,_0x272a1f,_0x2a34c2,_0x272a1f[_0x95a6('0x6b')],_0xe115e6);})[_0x95a6('0x27')](function(_0x1da52b){_0x266445=_0x1da52b;logger['info']('['+_0x2a34c2[_0x95a6('0x80')]['toUpperCase']()+']\x20Ticket\x20%s\x20created.',_0x266445['id']);logger[_0x95a6('0x1e')]('['+_0x2a34c2['lastevent'][_0x95a6('0x81')]()+_0x95a6('0x82'),_0x1f998a[_0x95a6('0x40')]);})['catch'](function(_0x1ff238){logger[_0x95a6('0x73')]('['+_0x2a34c2['lastevent'][_0x95a6('0x81')]()+']',_0x1ff238);});}; \ 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 f02e43c..883f28f 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 _0xe38d=['],\x20getAdminUser\x20crm','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','active','userId','adminId','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','true','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','nameField','toLowerCase','content','toString','type','idField','variable','variableName','customField','customVariable','Variable','name','assign','Subjects','getString','Descriptions','Fields','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','incident','Incident','Incident\x20-\x20','push','all','Tags','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','trigger:browser:url','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','GET','then','result','sys_id','info','toUpperCase'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe38d,0xce));var _0xde38=function(_0x258e37,_0x28c2ec){_0x258e37=_0x258e37-0x0;var _0x41a810=_0xe38d[_0x258e37];return _0x41a810;};'use strict';var _=require(_0xde38('0x0'));var Promise=require(_0xde38('0x1'));var rp=require(_0xde38('0x2'));var util=require(_0xde38('0x3'));var md5=require(_0xde38('0x4'));var Redis=require(_0xde38('0x5'));var intUtil=require(_0xde38('0x6'));var config=require(_0xde38('0x7'));var logger=require(_0xde38('0x8'))(_0xde38('0x9'));config['redis']=_['defaults'](config[_0xde38('0xa')],{'host':_0xde38('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xde38('0xa')]));function getAdminUser(_0x772a3,_0x39e501,_0x12fdde,_0x5c0d3c,_0x3ad25b,_0x157624){return new Promise(function(_0x1c7cd9,_0x36bc2a){var _0x9233d5={'method':_0xde38('0xc'),'uri':_0x5c0d3c+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x3ad25b+'&'+_0x157624,'auth':_0x39e501,'json':!![]};return rp(_0x9233d5)[_0xde38('0xd')](function(_0x383009){if(_0x383009[_0xde38('0xe')]['length']>0x0){_0x12fdde['adminId']=_0x383009[_0xde38('0xe')][0x0][_0xde38('0xf')];}logger[_0xde38('0x10')]('['+[_0x772a3[_0xde38('0x11')]()]+_0xde38('0x12'),_0x12fdde);_0x1c7cd9(_0x12fdde);})['catch'](function(_0x199020){logger[_0xde38('0x13')]('['+[_0x772a3[_0xde38('0x11')]()]+']',_0x199020[_0xde38('0x14')]);_0x36bc2a(_0x199020[_0xde38('0x14')]);});});}function getUser(_0x5c18ac,_0x42ff3a,_0x37e2f9,_0x2ef1ca,_0x3fd972){return function(_0x456343){logger[_0xde38('0x10')]('['+[_0x5c18ac[_0xde38('0x11')]()]+_0xde38('0x15'),_0x456343);return new Promise(function(_0x14b863,_0x4d4e24){if(intUtil[_0xde38('0x16')](_0x456343[_0xde38('0x17')])){var _0x18eac9={'method':_0xde38('0xc'),'uri':_0x37e2f9+_0xde38('0x18')+_0x456343[_0xde38('0x17')]+'&'+_0x2ef1ca+'&'+_0x3fd972,'auth':_0x42ff3a,'json':!![]};logger[_0xde38('0x10')]('['+[_0x5c18ac[_0xde38('0x11')]()]+_0xde38('0x19'),_0x18eac9);return rp(_0x18eac9)[_0xde38('0xd')](function(_0x4c8833){logger[_0xde38('0x10')]('['+[_0x5c18ac['toUpperCase']()]+_0xde38('0x1a'),_0x4c8833);if(_0x4c8833['result'][_0xde38('0x1b')]>0x0&&String(_0x4c8833[_0xde38('0xe')][0x0][_0xde38('0x1c')])==='true'){_0x456343[_0xde38('0x1d')]=_0x4c8833[_0xde38('0xe')][0x0][_0xde38('0xf')];}else{_0x456343[_0xde38('0x1d')]=_0x456343[_0xde38('0x1e')];_0x456343[_0xde38('0x17')]=_0x456343['adminEmail'];}logger['info']('['+[_0x5c18ac[_0xde38('0x11')]()]+_0xde38('0x1f'),_0x456343);_0x14b863(_0x456343);})[_0xde38('0x20')](function(_0x232c6b){logger[_0xde38('0x13')]('['+[_0x5c18ac[_0xde38('0x11')]()]+']',_0x232c6b['message']);_0x4d4e24(_0x232c6b[_0xde38('0x14')]);});}else{logger[_0xde38('0x10')]('['+[_0x5c18ac['toUpperCase']()]+_0xde38('0x21'));_0x456343[_0xde38('0x1d')]=_0x456343['adminId'];_0x456343['userEmail']=_0x456343[_0xde38('0x22')];_0x14b863(_0x456343);}});};}function createEndUser(_0xd052dd,_0x4aef11,_0x4c8917,_0x1f19c3,_0x1374ed){logger[_0xde38('0x10')]('['+[_0xd052dd[_0xde38('0x11')]()]+_0xde38('0x23'),_0x4c8917);return new Promise(function(_0x48c4e6,_0x5f443e){var _0x425ace={'method':_0xde38('0x24'),'uri':_0x1f19c3+_0xde38('0x25')+_0x1374ed,'body':{'user_name':_0x4c8917['endUserNumber'],'roles':_0xde38('0x26'),'first_name':_0x4c8917[_0xde38('0x27')],'active':_0xde38('0x28'),'date_format':_0xde38('0x29'),'phone':_0x4c8917[_0xde38('0x27')]},'auth':_0x4aef11,'json':!![]};return rp(_0x425ace)['then'](function(_0x3922b3){logger[_0xde38('0x10')]('['+[_0xd052dd[_0xde38('0x11')]()]+_0xde38('0x2a'),_0x3922b3[_0xde38('0xe')]);_0x4c8917['endUserId']=_0x3922b3[_0xde38('0xe')][_0xde38('0xf')];_0x48c4e6(_0x4c8917);})[_0xde38('0x20')](function(_0x400bd2){logger[_0xde38('0x13')]('['+[_0xd052dd[_0xde38('0x11')]()]+']',_0x400bd2['message']);_0x5f443e(_0x400bd2[_0xde38('0x14')]);});});}function getEndUser(_0x4c065c,_0xd511a1,_0x47386c,_0xe0f782,_0x3e365e){return function(_0x59ffb2){logger[_0xde38('0x10')]('['+[_0x4c065c[_0xde38('0x11')]()]+_0xde38('0x2b'),_0x59ffb2);return new Promise(function(_0xc5085,_0x42ac88){var _0x531f7b={'method':_0xde38('0xc'),'uri':_0x47386c+_0xde38('0x2c')+_0x59ffb2[_0xde38('0x27')]+'&'+_0xe0f782+'&'+_0x3e365e,'auth':_0xd511a1,'json':!![]};return rp(_0x531f7b)['then'](function(_0x2774f4){if(_0x2774f4[_0xde38('0xe')][_0xde38('0x1b')]>0x0){_0x59ffb2[_0xde38('0x2d')]=_0x2774f4['result'][0x0][_0xde38('0xf')];logger['info']('['+[_0x4c065c[_0xde38('0x11')]()]+_0xde38('0x2e'),_0x59ffb2);_0xc5085(_0x59ffb2);}else{return createEndUser(_0x4c065c,_0xd511a1,_0x59ffb2,_0x47386c,_0xe0f782)[_0xde38('0xd')](function(_0x70e11a){logger[_0xde38('0x10')]('['+[_0x4c065c['toUpperCase']()]+_0xde38('0x2f'),_0x70e11a);_0xc5085(_0x70e11a);});}})['catch'](function(_0x512692){logger['error']('['+[_0x4c065c[_0xde38('0x11')]()]+']',_0x512692[_0xde38('0x14')]);_0x42ac88(_0x512692[_0xde38('0x14')]);});});};}function getCustomFields(_0x5a02b3,_0xbc3484){var _0x44401c={};if(_0x5a02b3[_0xde38('0x1b')]>0x0){_[_0xde38('0x30')](_0x5a02b3,function(_0x41dd00){if(_[_0xde38('0x31')]([_0xde38('0x32'),_0xde38('0x33')],_0x41dd00['type'])&&_0x41dd00[_0xde38('0x34')]&&!_0x41dd00['customField']){_0x44401c[_0x41dd00[_0xde38('0x34')][_0xde38('0x35')]()]=_0x41dd00[_0xde38('0x36')][_0xde38('0x37')]();}else if(_[_0xde38('0x31')]([_0xde38('0x32'),_0xde38('0x33')],_0x41dd00[_0xde38('0x38')])&&_0x41dd00[_0xde38('0x39')]&&_0x41dd00['customField']){_0x44401c[_0x41dd00['idField']['toLowerCase']()]=_0x41dd00[_0xde38('0x36')][_0xde38('0x37')]();}else if(_0x41dd00[_0xde38('0x38')]===_0xde38('0x3a')&&_0x41dd00[_0xde38('0x3b')]&&_0x41dd00[_0xde38('0x39')]&&_0x41dd00[_0xde38('0x3c')]){_0x44401c[_0x41dd00[_0xde38('0x39')][_0xde38('0x35')]()]=_0xbc3484[_0x41dd00['variableName']][_0xde38('0x37')]();}else if(_0x41dd00[_0xde38('0x38')]===_0xde38('0x3d')&&_0x41dd00[_0xde38('0x3e')]&&_0x41dd00[_0xde38('0x3e')][_0xde38('0x3f')]&&_0x41dd00['idField']&&_0x41dd00[_0xde38('0x3c')]){_0x44401c[_0x41dd00[_0xde38('0x39')][_0xde38('0x35')]()]=_0xbc3484[_0x41dd00[_0xde38('0x3e')][_0xde38('0x3f')][_0xde38('0x35')]()][_0xde38('0x37')]();}});}return _0x44401c;}function getTicket(_0xefcd09,_0x283510,_0x12e191,_0x576e3c,_0x353cb1,_0x2fe8ca){return function(_0x3d0ff8){logger[_0xde38('0x10')]('['+[_0xefcd09[_0xde38('0x11')]()]+']\x20getTicket\x20input\x20crm',_0x3d0ff8);return new Promise(function(_0x1267cd,_0x46c544){var _0x48f689=_0xefcd09[_0xde38('0x35')]()==='outbound'?_0x3d0ff8[_0xde38('0x1d')]:_0x3d0ff8['endUserId'];var _0x3635da={'method':_0xde38('0x24'),'uri':_0x12e191+'incident'+'?'+_0x2fe8ca,'body':Object[_0xde38('0x40')]({},{'active':_0xde38('0x28'),'caller_id':_0x48f689,'assigned_to':_0x3d0ff8[_0xde38('0x1d')],'short_description':intUtil['getString'](_0x576e3c[_0xde38('0x41')],_0x353cb1,'\x20'),'description':intUtil[_0xde38('0x42')](_0x576e3c[_0xde38('0x43')],_0x353cb1,'\x0a')},getCustomFields(_0x576e3c[_0xde38('0x44')],_0x353cb1)),'auth':_0x283510,'json':!![]};return rp(_0x3635da)[_0xde38('0xd')](function(_0x508384){logger[_0xde38('0x10')]('['+[_0xefcd09[_0xde38('0x11')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x508384[_0xde38('0xe')]);_0x3d0ff8[_0xde38('0x45')]=_0x508384[_0xde38('0xe')][_0xde38('0xf')];_0x3d0ff8[_0xde38('0x46')]=_0x508384[_0xde38('0xe')][_0xde38('0x47')];logger['info']('['+[_0xefcd09[_0xde38('0x11')]()]+_0xde38('0x48'),_0x3d0ff8);_0x1267cd(_0x3d0ff8);})[_0xde38('0x20')](function(_0x3cbee5){logger[_0xde38('0x13')]('['+[_0xefcd09['toUpperCase']()]+']',_0x3cbee5[_0xde38('0x14')]);_0x46c544(_0x3cbee5[_0xde38('0x14')]);});});};}function createRemoteTag(_0x139b4b,_0x21cbb3,_0x240b05,_0x1a530e){return new Promise(function(_0x7d44fc,_0x90121b){var _0x2dad5f={'method':_0xde38('0x24'),'uri':_0x240b05+'label'+'?'+_0x1a530e,'body':{'short_description':_0x139b4b,'global':!![],'active':!![],'name':_0x139b4b},'auth':_0x21cbb3,'json':!![]};return rp(_0x2dad5f)['then'](function(_0x4a5a9a){var _0x5aa550=_0x4a5a9a[_0xde38('0xe')][_0xde38('0xf')];_0x7d44fc(_0x5aa550);});});}function getRemoteTag(_0x287fb5,_0x2f0d07,_0x3e0d0a,_0x552a4e,_0x3ee435){return new Promise(function(_0x2f6b9a,_0x5b0432){var _0x38a26f={'method':_0xde38('0xc'),'uri':_0x3e0d0a+_0xde38('0x49')+_0xde38('0x4a')+_0x287fb5+'&'+_0x552a4e,'auth':_0x2f0d07,'json':!![]};return rp(_0x38a26f)[_0xde38('0xd')](function(_0x3b0b7c){if(_0x3b0b7c[_0xde38('0xe')][_0xde38('0x1b')]>0x0){var _0x18aec9=_0x3b0b7c[_0xde38('0xe')][0x0][_0xde38('0xf')];_0x2f6b9a(_0x18aec9);}else{return createRemoteTag(_0x287fb5,_0x2f0d07,_0x3e0d0a,_0x552a4e)['then'](function(_0x254943){_0x2f6b9a(_0x254943);});}});});}function assignTagToIncident(_0x576507,_0x462278,_0x2684a1,_0x1a4edb,_0x3a27bb){return new Promise(function(_0x59aa5c,_0x4ef609){var _0x52db05={'method':_0xde38('0x24'),'uri':_0x2684a1+_0xde38('0x4b')+'?'+_0x3a27bb,'body':{'label':_0x576507,'table':_0xde38('0x4c'),'id_type':_0xde38('0x4d'),'table_key':_0x1a4edb[_0xde38('0x45')],'title':_0xde38('0x4e')+_0x1a4edb['ticketNumber'],'id_display':_0x1a4edb['ticketNumber']},'auth':_0x462278,'json':!![]};return rp(_0x52db05)[_0xde38('0xd')](function(_0x332f76){_0x59aa5c();})[_0xde38('0x20')](function(){_0x59aa5c();});});}function manageTags(_0x3b0893,_0x50ff2e,_0x45f3fb,_0x38f2f9,_0x40ddea,_0x1a70d6,_0xffcc80){return new Promise(function(_0x1afcde,_0x109d78){var _0x2c81cf=[];_0x50ff2e['forEach'](function(_0x202716){_0x2c81cf[_0xde38('0x4f')](getRemoteTag(_0x202716,_0x45f3fb,_0x38f2f9,_0x1a70d6,_0xffcc80));});return Promise[_0xde38('0x50')](_0x2c81cf)['then'](function(_0x4cd96b){if(_0x4cd96b['length']){logger[_0xde38('0x10')]('['+[_0x3b0893['toUpperCase']()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x4cd96b);var _0x5be668=[];_0x4cd96b[_0xde38('0x30')](function(_0x141625){_0x5be668[_0xde38('0x4f')](assignTagToIncident(_0x141625,_0x45f3fb,_0x38f2f9,_0x40ddea,_0x1a70d6));});return Promise[_0xde38('0x50')](_0x5be668)[_0xde38('0xd')](function(){_0x1afcde();})[_0xde38('0x20')](function(){_0x1afcde();});}else{_0x1afcde();}});});}function getTags(_0x34fb59,_0x2d1922,_0x332238,_0x150492,_0x169f60,_0x1351af){return function(_0x8f6b69){return new Promise(function(_0x435619,_0x1cdf0f){var _0x11e5cc=[];var _0x7969af=_0x150492[_0xde38('0x51')];if(_0x7969af&&_0x7969af[_0xde38('0x1b')]>0x0){_0x11e5cc=_['map'](_0x7969af,_0xde38('0x3f'));}if(_0x11e5cc[_0xde38('0x1b')]>0x0){return manageTags(_0x34fb59,_0x11e5cc,_0x2d1922,_0x332238,_0x8f6b69,_0x169f60,_0x1351af)[_0xde38('0xd')](function(){_0x435619(_0x8f6b69);});}else{_0x435619(_0x8f6b69);}});};}function emit(_0x201f8e,_0x509a62,_0x4578b9){var _0x3a1daa='%26sysparm_record_target%3Dincident'+_0xde38('0x52')+_0xde38('0x53')+_0xde38('0x54');var _0x44dbc5={'uri':_0x201f8e+_0xde38('0x55')+_0x4578b9+_0x3a1daa};io['to'](util['format'](_0xde38('0x56'),_0x509a62))['emit'](_0xde38('0x57'),_0x44dbc5);}exports['cs']=function(_0xe39102,_0x4cc19f,_0x2ea27d,_0x54dee6,_0x2bf2f1,_0x36b70a,_0x2437bd,_0x245479){var _0x35af83={};var _0x4a4aab={'user':_0x36b70a['username'],'pass':_0x36b70a['password']};var _0x44fbec=_0xde38('0x58');var _0x4de35e=_0xde38('0x59');_0x36b70a[_0xde38('0x5a')]=intUtil[_0xde38('0x5b')](_0x36b70a[_0xde38('0x5a')]);_0x36b70a[_0xde38('0x5c')]=intUtil[_0xde38('0x5b')](_0x36b70a[_0xde38('0x5c')]);var _0x4937c3=util[_0xde38('0x5d')](_0xde38('0x5e'),_0x36b70a['remoteUri']);_0x35af83['userEmail']=!_[_0xde38('0x5f')](_0x54dee6)?_0x54dee6['email']:null;_0x35af83[_0xde38('0x22')]=_0x36b70a[_0xde38('0x60')];_0x35af83['endUserNumber']=_0x245479[_0xde38('0x35')]()===_0xde38('0x61')?_0x4cc19f[_0xde38('0x62')]:_0x4cc19f[_0xde38('0x63')];_0x35af83[_0xde38('0x64')]=_0x245479==='queue'||_0x245479==='unmanaged'?_0xde38('0x65'):_0xde38('0x61');var _0x35f3e0=util[_0xde38('0x5d')](_0xde38('0x66'),_0x36b70a[_0xde38('0x5c')],_0x4cc19f[_0xde38('0x67')],md5(_0x4cc19f[_0xde38('0x67')]));if(_0x2bf2f1&&_0x2bf2f1['monitor_format']){logger['info']('[QUEUE]',_0xde38('0x68'));_0x4cc19f[_0xde38('0x69')]=_0x35f3e0;}else if(_0x2437bd&&_0x2437bd[_0xde38('0x6a')]&&_0x2437bd[_0xde38('0x6a')]!==_0xde38('0x6b')){logger['info']('[OUTBOUND]',_0xde38('0x68'));_0x4cc19f[_0xde38('0x69')]=_0x35f3e0;}else{_0x4cc19f[_0xde38('0x69')]='';}return getAdminUser(_0x245479,_0x4a4aab,_0x35af83,_0x4937c3,_0x4de35e,_0x44fbec)[_0xde38('0xd')](getUser(_0x245479,_0x4a4aab,_0x4937c3,_0x4de35e,_0x44fbec))[_0xde38('0xd')](getEndUser(_0x245479,_0x4a4aab,_0x4937c3,_0x4de35e,_0x44fbec))[_0xde38('0xd')](getTicket(_0x245479,_0x4a4aab,_0x4937c3,_0x2ea27d,_0x4cc19f,_0x4de35e))[_0xde38('0xd')](function(_0x38c431){logger['info'](util[_0xde38('0x5d')](_0xde38('0x6c'),_0x38c431[_0xde38('0x45')]));logger[_0xde38('0x10')](util[_0xde38('0x5d')]('call\x20direction:\x20%s',_0x245479));if(_0x245479!==_0xde38('0x6d')){logger[_0xde38('0x10')]('['+[_0x245479[_0xde38('0x11')]()]+']',_0xde38('0x6e'));emit(_0x36b70a['remoteUri'],_0x54dee6['name'],_0x38c431[_0xde38('0x45')]);}})[_0xde38('0x20')](function(_0x307ab){logger[_0xde38('0x13')]('['+[_0x245479[_0xde38('0x11')]()]+_0xde38('0x6f'),util['inspect'](_0x307ab,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x00e5=['error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','POST','sys_user?','user','true','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','endUserNumber','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','toString','string','idField','variable','variableName','Variable','name','outbound','assign','getString','Descriptions','Fields','ticketId','ticketNumber','label','label_entry','Incident','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','email','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','request-promise','util','md5','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','length','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch'];(function(_0x1b892b,_0x4efe48){var _0xa99e57=function(_0x3f957a){while(--_0x3f957a){_0x1b892b['push'](_0x1b892b['shift']());}};_0xa99e57(++_0x4efe48);}(_0x00e5,0x17b));var _0x500e=function(_0x164079,_0x1c1cd1){_0x164079=_0x164079-0x0;var _0x2384bb=_0x00e5[_0x164079];return _0x2384bb;};'use strict';var _=require(_0x500e('0x0'));var Promise=require(_0x500e('0x1'));var rp=require(_0x500e('0x2'));var util=require(_0x500e('0x3'));var md5=require(_0x500e('0x4'));var Redis=require('ioredis');var intUtil=require(_0x500e('0x5'));var config=require(_0x500e('0x6'));var logger=require(_0x500e('0x7'))(_0x500e('0x8'));config[_0x500e('0x9')]=_['defaults'](config[_0x500e('0x9')],{'host':_0x500e('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x3237c5,_0x44741d,_0x51b50e,_0x2b6880,_0x18bdea,_0x48d9fb){return new Promise(function(_0x47b2ce,_0x1160e9){var _0x33dfbf={'method':_0x500e('0xb'),'uri':_0x2b6880+_0x500e('0xc')+'&'+_0x18bdea+'&'+_0x48d9fb,'auth':_0x44741d,'json':!![]};return rp(_0x33dfbf)['then'](function(_0x52c4eb){if(_0x52c4eb['result'][_0x500e('0xd')]>0x0){_0x51b50e[_0x500e('0xe')]=_0x52c4eb[_0x500e('0xf')][0x0][_0x500e('0x10')];}logger[_0x500e('0x11')]('['+[_0x3237c5[_0x500e('0x12')]()]+_0x500e('0x13'),_0x51b50e);_0x47b2ce(_0x51b50e);})[_0x500e('0x14')](function(_0x24368e){logger[_0x500e('0x15')]('['+[_0x3237c5[_0x500e('0x12')]()]+']',_0x24368e[_0x500e('0x16')]);_0x1160e9(_0x24368e['message']);});});}function getUser(_0x1ea467,_0x594e73,_0x4ac593,_0x5d8736,_0x1536f9){return function(_0x1e1cfe){logger[_0x500e('0x11')]('['+[_0x1ea467[_0x500e('0x12')]()]+_0x500e('0x17'),_0x1e1cfe);return new Promise(function(_0x4cd50b,_0x2709d6){if(intUtil[_0x500e('0x18')](_0x1e1cfe[_0x500e('0x19')])){var _0x2e46e7={'method':_0x500e('0xb'),'uri':_0x4ac593+_0x500e('0x1a')+_0x1e1cfe[_0x500e('0x19')]+'&'+_0x5d8736+'&'+_0x1536f9,'auth':_0x594e73,'json':!![]};logger['info']('['+[_0x1ea467[_0x500e('0x12')]()]+_0x500e('0x1b'),_0x2e46e7);return rp(_0x2e46e7)[_0x500e('0x1c')](function(_0x27ec00){logger[_0x500e('0x11')]('['+[_0x1ea467[_0x500e('0x12')]()]+_0x500e('0x1d'),_0x27ec00);if(_0x27ec00['result']['length']>0x0&&String(_0x27ec00[_0x500e('0xf')][0x0]['active'])==='true'){_0x1e1cfe['userId']=_0x27ec00['result'][0x0][_0x500e('0x10')];}else{_0x1e1cfe[_0x500e('0x1e')]=_0x1e1cfe[_0x500e('0xe')];_0x1e1cfe[_0x500e('0x19')]=_0x1e1cfe[_0x500e('0x1f')];}logger[_0x500e('0x11')]('['+[_0x1ea467[_0x500e('0x12')]()]+_0x500e('0x20'),_0x1e1cfe);_0x4cd50b(_0x1e1cfe);})['catch'](function(_0x4e677f){logger[_0x500e('0x15')]('['+[_0x1ea467[_0x500e('0x12')]()]+']',_0x4e677f[_0x500e('0x16')]);_0x2709d6(_0x4e677f[_0x500e('0x16')]);});}else{logger['info']('['+[_0x1ea467[_0x500e('0x12')]()]+_0x500e('0x21'));_0x1e1cfe[_0x500e('0x1e')]=_0x1e1cfe[_0x500e('0xe')];_0x1e1cfe['userEmail']=_0x1e1cfe['adminEmail'];_0x4cd50b(_0x1e1cfe);}});};}function createEndUser(_0x937db6,_0x1f2984,_0x25f2ed,_0x25f468,_0x4b356b){logger[_0x500e('0x11')]('['+[_0x937db6[_0x500e('0x12')]()]+'],\x20createEndUser\x20input\x20crm',_0x25f2ed);return new Promise(function(_0x339e50,_0x36107c){var _0x149ef7={'method':_0x500e('0x22'),'uri':_0x25f468+_0x500e('0x23')+_0x4b356b,'body':{'user_name':_0x25f2ed['endUserNumber'],'roles':_0x500e('0x24'),'first_name':_0x25f2ed['endUserNumber'],'active':_0x500e('0x25'),'date_format':'System','phone':_0x25f2ed['endUserNumber']},'auth':_0x1f2984,'json':!![]};return rp(_0x149ef7)['then'](function(_0x1531e1){logger['info']('['+[_0x937db6[_0x500e('0x12')]()]+_0x500e('0x26'),_0x1531e1[_0x500e('0xf')]);_0x25f2ed[_0x500e('0x27')]=_0x1531e1[_0x500e('0xf')]['sys_id'];_0x339e50(_0x25f2ed);})[_0x500e('0x14')](function(_0x17880e){logger[_0x500e('0x15')]('['+[_0x937db6['toUpperCase']()]+']',_0x17880e['message']);_0x36107c(_0x17880e[_0x500e('0x16')]);});});}function getEndUser(_0x8575da,_0x567e40,_0x28cb15,_0xd25fba,_0x254155){return function(_0x29181c){logger[_0x500e('0x11')]('['+[_0x8575da[_0x500e('0x12')]()]+'],\x20getEndUser\x20input\x20crm',_0x29181c);return new Promise(function(_0x47cd24,_0x45ae35){var _0xe37e70={'method':_0x500e('0xb'),'uri':_0x28cb15+_0x500e('0x28')+_0x29181c[_0x500e('0x29')]+'&'+_0xd25fba+'&'+_0x254155,'auth':_0x567e40,'json':!![]};return rp(_0xe37e70)['then'](function(_0x47af2e){if(_0x47af2e[_0x500e('0xf')][_0x500e('0xd')]>0x0){_0x29181c[_0x500e('0x27')]=_0x47af2e[_0x500e('0xf')][0x0]['sys_id'];logger[_0x500e('0x11')]('['+[_0x8575da[_0x500e('0x12')]()]+_0x500e('0x2a'),_0x29181c);_0x47cd24(_0x29181c);}else{return createEndUser(_0x8575da,_0x567e40,_0x29181c,_0x28cb15,_0xd25fba)[_0x500e('0x1c')](function(_0x28f86a){logger[_0x500e('0x11')]('['+[_0x8575da[_0x500e('0x12')]()]+_0x500e('0x2b'),_0x28f86a);_0x47cd24(_0x28f86a);});}})[_0x500e('0x14')](function(_0x31d99b){logger[_0x500e('0x15')]('['+[_0x8575da[_0x500e('0x12')]()]+']',_0x31d99b[_0x500e('0x16')]);_0x45ae35(_0x31d99b[_0x500e('0x16')]);});});};}function getCustomFields(_0x2f8384,_0x1fe21e){var _0x4b6803={};if(_0x2f8384[_0x500e('0xd')]>0x0){_[_0x500e('0x2c')](_0x2f8384,function(_0x15b7c5){if(_[_0x500e('0x2d')](['string',_0x500e('0x2e')],_0x15b7c5[_0x500e('0x2f')])&&_0x15b7c5[_0x500e('0x30')]&&!_0x15b7c5[_0x500e('0x31')]){_0x4b6803[_0x15b7c5[_0x500e('0x30')][_0x500e('0x32')]()]=_0x15b7c5[_0x500e('0x33')][_0x500e('0x34')]();}else if(_[_0x500e('0x2d')]([_0x500e('0x35'),_0x500e('0x2e')],_0x15b7c5[_0x500e('0x2f')])&&_0x15b7c5[_0x500e('0x36')]&&_0x15b7c5[_0x500e('0x31')]){_0x4b6803[_0x15b7c5[_0x500e('0x36')][_0x500e('0x32')]()]=_0x15b7c5[_0x500e('0x33')][_0x500e('0x34')]();}else if(_0x15b7c5['type']===_0x500e('0x37')&&_0x15b7c5['variableName']&&_0x15b7c5['idField']&&_0x15b7c5[_0x500e('0x31')]){_0x4b6803[_0x15b7c5[_0x500e('0x36')][_0x500e('0x32')]()]=_0x1fe21e[_0x15b7c5[_0x500e('0x38')]][_0x500e('0x34')]();}else if(_0x15b7c5['type']==='customVariable'&&_0x15b7c5['Variable']&&_0x15b7c5[_0x500e('0x39')][_0x500e('0x3a')]&&_0x15b7c5[_0x500e('0x36')]&&_0x15b7c5[_0x500e('0x31')]){_0x4b6803[_0x15b7c5[_0x500e('0x36')][_0x500e('0x32')]()]=_0x1fe21e[_0x15b7c5['Variable'][_0x500e('0x3a')]['toLowerCase']()][_0x500e('0x34')]();}});}return _0x4b6803;}function getTicket(_0x4034e1,_0x497b51,_0xc6a578,_0x503292,_0x3a7b00,_0x4e99fd){return function(_0x2896d){logger['info']('['+[_0x4034e1[_0x500e('0x12')]()]+']\x20getTicket\x20input\x20crm',_0x2896d);return new Promise(function(_0x2f2db4,_0xaa7b92){var _0x19bfab=_0x4034e1[_0x500e('0x32')]()===_0x500e('0x3b')?_0x2896d[_0x500e('0x1e')]:_0x2896d[_0x500e('0x27')];var _0x3465e3={'method':_0x500e('0x22'),'uri':_0xc6a578+'incident'+'?'+_0x4e99fd,'body':Object[_0x500e('0x3c')]({},{'active':'true','caller_id':_0x19bfab,'assigned_to':_0x2896d[_0x500e('0x1e')],'short_description':intUtil[_0x500e('0x3d')](_0x503292['Subjects'],_0x3a7b00,'\x20'),'description':intUtil['getString'](_0x503292[_0x500e('0x3e')],_0x3a7b00,'\x0a')},getCustomFields(_0x503292[_0x500e('0x3f')],_0x3a7b00)),'auth':_0x497b51,'json':!![]};return rp(_0x3465e3)[_0x500e('0x1c')](function(_0x1fd85f){logger[_0x500e('0x11')]('['+[_0x4034e1[_0x500e('0x12')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x1fd85f[_0x500e('0xf')]);_0x2896d[_0x500e('0x40')]=_0x1fd85f[_0x500e('0xf')][_0x500e('0x10')];_0x2896d[_0x500e('0x41')]=_0x1fd85f[_0x500e('0xf')]['number'];logger['info']('['+[_0x4034e1[_0x500e('0x12')]()]+']\x20getTicket\x20crm',_0x2896d);_0x2f2db4(_0x2896d);})[_0x500e('0x14')](function(_0x5209db){logger[_0x500e('0x15')]('['+[_0x4034e1[_0x500e('0x12')]()]+']',_0x5209db[_0x500e('0x16')]);_0xaa7b92(_0x5209db[_0x500e('0x16')]);});});};}function createRemoteTag(_0x1a65bd,_0x226f51,_0x40d98,_0x367458){return new Promise(function(_0x5f8e98,_0x3bc755){var _0xaa698a={'method':'POST','uri':_0x40d98+_0x500e('0x42')+'?'+_0x367458,'body':{'short_description':_0x1a65bd,'global':!![],'active':!![],'name':_0x1a65bd},'auth':_0x226f51,'json':!![]};return rp(_0xaa698a)[_0x500e('0x1c')](function(_0x488ead){var _0x2b3218=_0x488ead[_0x500e('0xf')][_0x500e('0x10')];_0x5f8e98(_0x2b3218);});});}function getRemoteTag(_0x58d66b,_0x52faa0,_0x783c07,_0x4226b7,_0x5a9588){return new Promise(function(_0x53b735,_0x251f7e){var _0x539122={'method':_0x500e('0xb'),'uri':_0x783c07+_0x500e('0x42')+'?sysparm_query=name%3D'+_0x58d66b+'&'+_0x4226b7,'auth':_0x52faa0,'json':!![]};return rp(_0x539122)[_0x500e('0x1c')](function(_0x16baf2){if(_0x16baf2['result'][_0x500e('0xd')]>0x0){var _0x4273d4=_0x16baf2['result'][0x0][_0x500e('0x10')];_0x53b735(_0x4273d4);}else{return createRemoteTag(_0x58d66b,_0x52faa0,_0x783c07,_0x4226b7)[_0x500e('0x1c')](function(_0x4fe4e9){_0x53b735(_0x4fe4e9);});}});});}function assignTagToIncident(_0x358ea0,_0x371d78,_0x5ec730,_0x28a456,_0x186d87){return new Promise(function(_0x51ffe8,_0x188d03){var _0x2bb23a={'method':_0x500e('0x22'),'uri':_0x5ec730+_0x500e('0x43')+'?'+_0x186d87,'body':{'label':_0x358ea0,'table':'incident','id_type':_0x500e('0x44'),'table_key':_0x28a456[_0x500e('0x40')],'title':'Incident\x20-\x20'+_0x28a456[_0x500e('0x41')],'id_display':_0x28a456[_0x500e('0x41')]},'auth':_0x371d78,'json':!![]};return rp(_0x2bb23a)['then'](function(_0x4fcc16){_0x51ffe8();})[_0x500e('0x14')](function(){_0x51ffe8();});});}function manageTags(_0x50ba44,_0x3e6718,_0x67a2db,_0x237c4d,_0x450ec3,_0x2fc6bb,_0x2036e2){return new Promise(function(_0x2edc56,_0x3b868d){var _0x597afe=[];_0x3e6718['forEach'](function(_0x2c8a1c){_0x597afe[_0x500e('0x45')](getRemoteTag(_0x2c8a1c,_0x67a2db,_0x237c4d,_0x2fc6bb,_0x2036e2));});return Promise['all'](_0x597afe)[_0x500e('0x1c')](function(_0x1f9720){if(_0x1f9720[_0x500e('0xd')]){logger[_0x500e('0x11')]('['+[_0x50ba44[_0x500e('0x12')]()]+_0x500e('0x46'),_0x1f9720);var _0x16e2b3=[];_0x1f9720[_0x500e('0x2c')](function(_0x2852b0){_0x16e2b3[_0x500e('0x45')](assignTagToIncident(_0x2852b0,_0x67a2db,_0x237c4d,_0x450ec3,_0x2fc6bb));});return Promise['all'](_0x16e2b3)[_0x500e('0x1c')](function(){_0x2edc56();})['catch'](function(){_0x2edc56();});}else{_0x2edc56();}});});}function getTags(_0x23983b,_0x2eec04,_0x3ef40b,_0x303aa3,_0x2e1504,_0xca6e0e){return function(_0xa64d28){return new Promise(function(_0x1afb73,_0x2058a5){var _0x21c5b6=[];var _0x27e0c2=_0x303aa3[_0x500e('0x47')];if(_0x27e0c2&&_0x27e0c2[_0x500e('0xd')]>0x0){_0x21c5b6=_['map'](_0x27e0c2,_0x500e('0x3a'));}if(_0x21c5b6[_0x500e('0xd')]>0x0){return manageTags(_0x23983b,_0x21c5b6,_0x2eec04,_0x3ef40b,_0xa64d28,_0x2e1504,_0xca6e0e)[_0x500e('0x1c')](function(){_0x1afb73(_0xa64d28);});}else{_0x1afb73(_0xa64d28);}});};}function emit(_0x131224,_0x5ebc2f,_0x255727){var _0x11dd9f='%26sysparm_record_target%3Dincident'+_0x500e('0x48')+_0x500e('0x49')+'%255EORDERBYDESCnumber';var _0x2f4a38={'uri':_0x131224+_0x500e('0x4a')+_0x255727+_0x11dd9f};io['to'](util[_0x500e('0x4b')](_0x500e('0x4c'),_0x5ebc2f))[_0x500e('0x4d')](_0x500e('0x4e'),_0x2f4a38);}exports['cs']=function(_0x20dcf1,_0x4fb936,_0x3eedaa,_0x42277d,_0x38e199,_0x34f490,_0x2bbaf9,_0x1504b7){var _0x7e1f4d={};var _0x26bdd2={'user':_0x34f490[_0x500e('0x4f')],'pass':_0x34f490['password']};var _0x557f7d='sysparm_limit=1';var _0x1a9447=_0x500e('0x50');_0x34f490['remoteUri']=intUtil[_0x500e('0x51')](_0x34f490[_0x500e('0x52')]);_0x34f490['serverUrl']=intUtil[_0x500e('0x51')](_0x34f490[_0x500e('0x53')]);var _0x364d90=util[_0x500e('0x4b')](_0x500e('0x54'),_0x34f490[_0x500e('0x52')]);_0x7e1f4d['userEmail']=!_['isNil'](_0x42277d)?_0x42277d[_0x500e('0x55')]:null;_0x7e1f4d[_0x500e('0x1f')]=_0x34f490['email'];_0x7e1f4d[_0x500e('0x29')]=_0x1504b7[_0x500e('0x32')]()===_0x500e('0x3b')?_0x4fb936[_0x500e('0x56')]:_0x4fb936['calleridnum'];_0x7e1f4d[_0x500e('0x57')]=_0x1504b7===_0x500e('0x58')||_0x1504b7===_0x500e('0x59')?'queue':_0x500e('0x3b');var _0xbd2c7c=util[_0x500e('0x4b')](_0x500e('0x5a'),_0x34f490['serverUrl'],_0x4fb936[_0x500e('0x5b')],md5(_0x4fb936[_0x500e('0x5b')]));if(_0x38e199&&_0x38e199[_0x500e('0x5c')]){logger[_0x500e('0x11')](_0x500e('0x5d'),_0x500e('0x5e'));_0x4fb936[_0x500e('0x5f')]=_0xbd2c7c;}else if(_0x2bbaf9&&_0x2bbaf9[_0x500e('0x60')]&&_0x2bbaf9['recordingFormat']!=='none'){logger[_0x500e('0x11')]('[OUTBOUND]',_0x500e('0x5e'));_0x4fb936[_0x500e('0x5f')]=_0xbd2c7c;}else{_0x4fb936['recordingURL']='';}return getAdminUser(_0x1504b7,_0x26bdd2,_0x7e1f4d,_0x364d90,_0x1a9447,_0x557f7d)[_0x500e('0x1c')](getUser(_0x1504b7,_0x26bdd2,_0x364d90,_0x1a9447,_0x557f7d))['then'](getEndUser(_0x1504b7,_0x26bdd2,_0x364d90,_0x1a9447,_0x557f7d))[_0x500e('0x1c')](getTicket(_0x1504b7,_0x26bdd2,_0x364d90,_0x3eedaa,_0x4fb936,_0x1a9447))[_0x500e('0x1c')](function(_0xcc58f0){logger[_0x500e('0x11')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0xcc58f0[_0x500e('0x40')]));logger['info'](util[_0x500e('0x4b')](_0x500e('0x61'),_0x1504b7));if(_0x1504b7!==_0x500e('0x59')){logger[_0x500e('0x11')]('['+[_0x1504b7['toUpperCase']()]+']',_0x500e('0x62'));emit(_0x34f490['remoteUri'],_0x42277d[_0x500e('0x3a')],_0xcc58f0[_0x500e('0x40')]);}})[_0x500e('0x14')](function(_0x5e9cfe){logger[_0x500e('0x15')]('['+[_0x1504b7[_0x500e('0x12')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x500e('0x63')](_0x5e9cfe,{'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 dc21a02..db3593b 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 _0x4846=['Outbound','catch','[OUTBOUND]','unmanaged','lastevent','toUpperCase','users','request-promise','bluebird','md5','ioredis','sugarcrm','redis','socket.io-emitter','POST','info','Creating\x20new\x20ticket...','name','Subjects','created_by','description','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','parent_name','length','forEach','variableName','push','JSON','stringify','format','Basic\x20%s','apiKey','toString','base64','get_server_info','Getting\x20agent\x20with\x20name','Employees','then','entry_list','find','name_value_list','user_name','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','Contacts','','Caller\x20-\x20%s','first_name','[HTTP]','merge','nameField','content','string','idField','customField','custom_fields','type','variable','customVariable','Variable','toLowerCase','login','username','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','stripTrailingSlash','recordingFormat','none','destcalleridname','Fields'];(function(_0x2d7ead,_0x48cb08){var _0x4ecf0e=function(_0xca9c69){while(--_0xca9c69){_0x2d7ead['push'](_0x2d7ead['shift']());}};_0x4ecf0e(++_0x48cb08);}(_0x4846,0x7b));var _0x6484=function(_0x5bae5f,_0x3dee66){_0x5bae5f=_0x5bae5f-0x0;var _0x1742e1=_0x4846[_0x5bae5f];return _0x1742e1;};'use strict';var _=require('lodash');var rp=require(_0x6484('0x0'));var BPromise=require(_0x6484('0x1'));var md5=require(_0x6484('0x2'));var util=require('util');var Redis=require(_0x6484('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x6484('0x4'));config[_0x6484('0x5')]=_['defaults'](config[_0x6484('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x6484('0x6'))(new Redis(config[_0x6484('0x5')]));var def={'method':_0x6484('0x7'),'json':!![]};function emit(_0x1db75b,_0x29f3c3,_0x16b85a){io['to'](_0x1db75b)['emit'](_0x29f3c3,_0x16b85a);}function getTicket(_0x3a2c34,_0x3d361f,_0xb684ac,_0x108455,_0x4df8a6,_0x474e43,_0x884c41,_0x2ce7b8){logger[_0x6484('0x8')](_0x6484('0x9'));var _0xd8e05=new Date();var _0x550831=[{'name':_0x6484('0xa'),'value':intUtil['getString'](_0x108455[_0x6484('0xb')],_0x4df8a6,'\x20')},{'name':'assigned_user_id','value':_0x3d361f['id']},{'name':_0x6484('0xc'),'value':_0x3d361f['id']},{'name':_0x6484('0xd'),'value':intUtil['getString'](_0x108455['Descriptions'],_0x4df8a6,'\x0a')},{'name':_0x6484('0xe'),'value':_0xd8e05[_0x6484('0xf')]()[_0x6484('0x10')](0x0,0x13)[_0x6484('0x11')]('T','\x20')},{'name':_0x6484('0x12'),'value':'0'},{'name':_0x6484('0x13'),'value':'15'},{'name':_0x6484('0x14'),'value':_0xb684ac['id']},{'name':_0x6484('0x15'),'value':'Contacts'},{'name':_0x6484('0x16'),'value':_0xb684ac[_0x6484('0xa')]},{'name':'direction','value':_0x2ce7b8}];if(_0x474e43[_0x6484('0x17')]){_[_0x6484('0x18')](_0x474e43,function(_0x6cbfae){if(_0x4df8a6[_0x6cbfae[_0x6484('0x19')]]){_0x550831[_0x6484('0x1a')]({'name':_0x6cbfae['idField'],'value':_0x4df8a6[_0x6cbfae[_0x6484('0x19')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x6484('0x1b'),'response_type':_0x6484('0x1b'),'rest_data':JSON[_0x6484('0x1c')]({'session':_0x884c41['id'],'module_name':'Calls','name_value_list':_0x550831})}});}function getAuth(_0x577be3){return util[_0x6484('0x1d')](_0x6484('0x1e'),new Buffer(_0x577be3[_0x6484('0x1f')]+':X')[_0x6484('0x20')](_0x6484('0x21')));}function getServerInfo(_0x5dd23e){return request({'form':{'method':_0x6484('0x22'),'input_type':_0x6484('0x1b'),'response_type':'JSON','rest_data':JSON[_0x6484('0x1c')]({'session':_0x5dd23e['id']})}});}function getUser(_0x5670ca,_0x4d3dab,_0x2192e6){if(!_['isNil'](_0x4d3dab)){logger[_0x6484('0x8')](_0x6484('0x23'),_0x4d3dab);return request({'form':{'method':'get_entry_list','input_type':_0x6484('0x1b'),'response_type':_0x6484('0x1b'),'rest_data':JSON[_0x6484('0x1c')]({'session':_0x2192e6['id'],'module_name':_0x6484('0x24'),'query':util[_0x6484('0x1d')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x4d3dab),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x6484('0x25')](function(_0x3f4d2e){if(_0x3f4d2e[_0x6484('0x26')][_0x6484('0x17')]){var _0x3497fa=_[_0x6484('0x27')](_0x3f4d2e[_0x6484('0x26')],function(_0x3b84a7){return _0x3b84a7[_0x6484('0x28')][_0x6484('0x29')][_0x6484('0x2a')]===_0x4d3dab;});if(_0x3497fa){logger['info'](_0x6484('0x2b'));return BPromise['resolve']({'id':_0x3497fa[_0x6484('0x28')]['id'][_0x6484('0x2a')],'name':_0x3497fa[_0x6484('0x28')][_0x6484('0xa')][_0x6484('0x2a')]});}}logger[_0x6484('0x8')](_0x6484('0x2c'));return BPromise[_0x6484('0x2d')]({'id':_0x2192e6[_0x6484('0x28')]['user_id'][_0x6484('0x2a')],'name':_0x2192e6[_0x6484('0x28')][_0x6484('0x29')]['value']});});}else{logger[_0x6484('0x8')](_0x6484('0x2e'));return BPromise[_0x6484('0x2d')]({'id':_0x2192e6['name_value_list'][_0x6484('0x2f')]['value'],'name':_0x2192e6[_0x6484('0x28')][_0x6484('0x29')][_0x6484('0x2a')]});}}function getEndUser(_0x475b50,_0x2e4ca7,_0x1af124,_0x8c3c0c){logger[_0x6484('0x8')]('Searching\x20enduser\x20with\x20phone',_0x1af124);return request({'form':{'method':_0x6484('0x30'),'input_type':_0x6484('0x1b'),'response_type':_0x6484('0x1b'),'rest_data':JSON[_0x6484('0x1c')]({'session':_0x8c3c0c['id'],'module_name':'Contacts','query':util[_0x6484('0x1d')](_0x6484('0x31'),_0x1af124),'order_by':'','offset':'0','select_fields':['id',_0x6484('0xa'),_0x6484('0x32')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x563a51){if(_0x563a51[_0x6484('0x26')]['length']){var _0x27ebd7=_[_0x6484('0x27')](_0x563a51[_0x6484('0x26')],function(_0x2a875c){return _0x2a875c[_0x6484('0x28')][_0x6484('0x32')][_0x6484('0x2a')]===_0x1af124;});if(_0x27ebd7){logger[_0x6484('0x8')](_0x6484('0x33'));return BPromise[_0x6484('0x2d')]({'id':_0x27ebd7[_0x6484('0x28')]['id'][_0x6484('0x2a')],'name':_0x27ebd7[_0x6484('0x28')][_0x6484('0xa')][_0x6484('0x2a')],'phone':_0x27ebd7[_0x6484('0x28')][_0x6484('0x32')][_0x6484('0x2a')]});}}else{logger[_0x6484('0x8')](_0x6484('0x34'));return request({'form':{'method':_0x6484('0x35'),'input_type':'JSON','response_type':_0x6484('0x1b'),'rest_data':JSON[_0x6484('0x1c')]({'session':_0x8c3c0c['id'],'module_name':_0x6484('0x36'),'name_value_list':[{'name':'first_name','value':_0x2e4ca7!==_0x6484('0x37')?_0x2e4ca7:util[_0x6484('0x1d')](_0x6484('0x38'),_0x1af124)},{'name':'phone_home','value':_0x1af124}]})}})[_0x6484('0x25')](function(_0x4b1cbc){logger[_0x6484('0x8')]('Enduser\x20created.');return BPromise[_0x6484('0x2d')]({'id':_0x4b1cbc['id'],'name':_0x4b1cbc[_0x6484('0x26')][_0x6484('0x39')][_0x6484('0x2a')],'phone':_0x4b1cbc[_0x6484('0x26')][_0x6484('0x32')]['value']});});}});}function request(_0x48062a){logger['debug'](_0x6484('0x3a'),JSON['stringify'](_0x48062a));return rp(_[_0x6484('0x3b')](def,_0x48062a));}function getTags(_0x45cc69,_0x1784d0){var _0x280d18=[];if(_0x45cc69&&_0x45cc69['length']>0x0){_0x280d18=_['map'](_0x45cc69,_0x1784d0);}return _0x280d18;}function getCustomFields(_0x58c813,_0x114337){var _0x2cb097=[];var _0x303358={'custom_fields':[]};if(_0x58c813[_0x6484('0x17')]>0x0){_[_0x6484('0x18')](_0x58c813,function(_0x5cf272){if(_0x5cf272['type']==='string'&&_0x5cf272[_0x6484('0x3c')]&&!_0x5cf272['customField']){_0x303358[_0x5cf272[_0x6484('0x3c')]['toLowerCase']()]=_0x5cf272[_0x6484('0x3d')][_0x6484('0x20')]();}else if(_0x5cf272['type']===_0x6484('0x3e')&&_0x5cf272[_0x6484('0x3f')]&&_0x5cf272[_0x6484('0x40')]){_0x303358[_0x6484('0x41')]['push']({'id':_0x5cf272[_0x6484('0x3f')],'value':_0x5cf272[_0x6484('0x3d')][_0x6484('0x20')]()});}else if(_0x5cf272[_0x6484('0x42')]===_0x6484('0x43')&&_0x5cf272[_0x6484('0x19')]&&_0x5cf272['idField']&&_0x5cf272[_0x6484('0x40')]){_0x114337[_0x5cf272[_0x6484('0x19')]]&&_0x303358['custom_fields'][_0x6484('0x1a')]({'id':_0x5cf272[_0x6484('0x3f')],'value':_0x114337[_0x5cf272['variableName']][_0x6484('0x20')]()});}else if(_0x5cf272[_0x6484('0x42')]===_0x6484('0x44')&&_0x5cf272[_0x6484('0x45')]&&_0x5cf272['Variable'][_0x6484('0xa')]&&_0x5cf272['idField']&&_0x5cf272['customField']){_0x114337[_0x5cf272['Variable'][_0x6484('0xa')][_0x6484('0x46')]()]&&_0x303358[_0x6484('0x41')]['push']({'id':_0x5cf272[_0x6484('0x3f')],'value':_0x114337[_0x5cf272[_0x6484('0x45')][_0x6484('0xa')][_0x6484('0x46')]()]['toString']()});}});}return _0x303358;}function getConnection(_0x10d142){return request({'method':_0x6484('0x7'),'form':{'method':_0x6484('0x47'),'input_type':_0x6484('0x1b'),'response_type':_0x6484('0x1b'),'rest_data':JSON[_0x6484('0x1c')]({'user_auth':{'user_name':_0x10d142[_0x6484('0x48')],'password':_0x10d142['password'],'encryption':'PLAIN'},'application':_0x6484('0x49')})}})[_0x6484('0x25')](function(_0x447d05){var _0x1304da=_0x447d05;if(_0x1304da['id']){def['sessionID']=_0x1304da['id'];return BPromise[_0x6484('0x2d')](_0x1304da);}else{throw new Error(util[_0x6484('0x1d')](_0x6484('0x4a'),_0x10d142['id']));}});}function setRelationship(_0x545e29,_0x8d8fd9,_0x28de26,_0x502aca){return request({'form':{'method':_0x6484('0x4b'),'input_type':_0x6484('0x1b'),'response_type':_0x6484('0x1b'),'rest_data':JSON[_0x6484('0x1c')]({'session':_0x545e29['id'],'module_name':_0x6484('0x4c'),'module_id':_0x28de26['id'],'link_field_name':_0x502aca,'related_ids':[_0x8d8fd9['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x6484('0x4d')]=function(_0x7bf909,_0x49e157,_0x232f01,_0x101a78,_0x2ba4a1,_0x23e1e9){var _0x5132ea,_0x283164,_0x5b0f13,_0x4d6ace;_0x23e1e9[_0x6484('0x4e')]=intUtil['stripTrailingSlash'](_0x23e1e9[_0x6484('0x4e')]);_0x23e1e9[_0x6484('0x4f')]=intUtil['stripTrailingSlash'](_0x23e1e9[_0x6484('0x4f')]);def[_0x6484('0x50')]=util[_0x6484('0x1d')](_0x6484('0x51'),_0x23e1e9[_0x6484('0x4e')]);if(_0x2ba4a1&&_0x2ba4a1[_0x6484('0x52')]){logger['info'](_0x6484('0x53'),_0x6484('0x54'));_0x49e157[_0x6484('0x55')]=util['format'](_0x6484('0x56'),_0x23e1e9[_0x6484('0x4f')],_0x49e157[_0x6484('0x57')],md5(_0x49e157[_0x6484('0x57')]));}else{_0x49e157[_0x6484('0x55')]='';}return getConnection(_0x23e1e9)[_0x6484('0x25')](function(_0x322411){_0x4d6ace=_0x322411;return getUser(_0x23e1e9,_0x101a78[_0x6484('0xa')],_0x4d6ace);})['then'](function(_0x378531){_0x5132ea=_0x378531;logger[_0x6484('0x8')](_0x6484('0x58'),_0x5132ea['id']);return getEndUser(_0x23e1e9,_0x49e157[_0x6484('0x59')],_0x49e157[_0x6484('0x5a')],_0x4d6ace);})[_0x6484('0x25')](function(_0x287b35){_0x283164=_0x287b35;logger[_0x6484('0x8')](_0x6484('0x5b'),_0x283164['id']);return getTicket(_0x23e1e9,_0x5132ea,_0x283164,_0x232f01,_0x49e157,_0x232f01['Fields'],_0x4d6ace,_0x6484('0x5c'));})[_0x6484('0x25')](function(_0x578ee1){_0x5b0f13=_0x578ee1;logger[_0x6484('0x8')](_0x6484('0x5d'));logger['info'](_0x6484('0x5e'),_0x5b0f13['id']);return setRelationship(_0x4d6ace,_0x5132ea,_0x5b0f13,'users');})['then'](function(){return setRelationship(_0x4d6ace,_0x283164,_0x5b0f13,_0x6484('0x5f'));})[_0x6484('0x25')](function(){return getServerInfo(_0x4d6ace);})[_0x6484('0x25')](function(_0x175dd7){var _0x25d0d4=parseInt(_0x175dd7[_0x6484('0x60')][_0x6484('0x61')](0x0));var _0x33e0db=util['format'](_0x6484('0x62'),_0x23e1e9['remoteUri'],_0x5b0f13['id']);if(_0x25d0d4>0x6){_0x33e0db=util[_0x6484('0x1d')](_0x6484('0x63'),_0x23e1e9[_0x6484('0x4e')],_0x5b0f13['id']);}logger[_0x6484('0x8')](_0x6484('0x53'),_0x6484('0x64'));emit(util[_0x6484('0x1d')](_0x6484('0x65'),_0x101a78['name']),_0x6484('0x66'),{'uri':_0x33e0db});})['catch'](function(_0x30418a){logger[_0x6484('0x67')]('[QUEUE]',JSON[_0x6484('0x1c')](_0x30418a));});};exports['outbound']=function(_0xa2cd0c,_0xaaf9d7,_0x269211,_0x497c23,_0x539bd6,_0xec409b,_0x46a8aa){var _0x120a8b,_0x21ff47,_0x22ac6a,_0x2c4521;_0xec409b[_0x6484('0x4e')]=intUtil[_0x6484('0x68')](_0xec409b['remoteUri']);_0xec409b['serverUrl']=intUtil[_0x6484('0x68')](_0xec409b['serverUrl']);def[_0x6484('0x50')]=util['format'](_0x6484('0x51'),_0xec409b['remoteUri']);if(_0x46a8aa&&_0x46a8aa['recordingFormat']&&_0x46a8aa[_0x6484('0x69')]!==_0x6484('0x6a')){logger[_0x6484('0x8')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0xaaf9d7['recordingURL']=util['format'](_0x6484('0x56'),_0xec409b['serverUrl'],_0xaaf9d7[_0x6484('0x57')],md5(_0xaaf9d7[_0x6484('0x57')]));}return getConnection(_0xec409b)[_0x6484('0x25')](function(_0x59cf29){_0x2c4521=_0x59cf29;return getUser(_0xec409b,_0x497c23[_0x6484('0xa')],_0x2c4521);})['then'](function(_0x5c9a5a){_0x120a8b=_0x5c9a5a;logger[_0x6484('0x8')]('The\x20User\x20ID\x20is:',_0x120a8b['id']);return getEndUser(_0xec409b,_0xaaf9d7[_0x6484('0x6b')],_0xaaf9d7['destcalleridnum'],_0x2c4521);})[_0x6484('0x25')](function(_0x2e8ea4){_0x21ff47=_0x2e8ea4;logger[_0x6484('0x8')](_0x6484('0x5b'),_0x21ff47['id']);return getTicket(_0xec409b,_0x120a8b,_0x21ff47,_0x269211,_0xaaf9d7,_0x269211[_0x6484('0x6c')],_0x2c4521,_0x6484('0x6d'));})[_0x6484('0x25')](function(_0x4bf260){_0x22ac6a=_0x4bf260;logger['info'](_0x6484('0x5d'));logger[_0x6484('0x8')](_0x6484('0x5e'),_0x22ac6a['id']);return setRelationship(_0x2c4521,_0x120a8b,_0x22ac6a,'users');})[_0x6484('0x25')](function(){return setRelationship(_0x2c4521,_0x21ff47,_0x22ac6a,'contacts');})['then'](function(){return getServerInfo(_0x2c4521);})[_0x6484('0x25')](function(_0x31a2dc){var _0x4b17fd=parseInt(_0x31a2dc['version'][_0x6484('0x61')](0x0));var _0x5d3642=util[_0x6484('0x1d')](_0x6484('0x62'),_0xec409b['remoteUri'],_0x22ac6a['id']);if(_0x4b17fd>0x6){_0x5d3642=util[_0x6484('0x1d')](_0x6484('0x63'),_0xec409b['remoteUri'],_0x22ac6a['id']);}logger[_0x6484('0x8')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6484('0x1d')](_0x6484('0x65'),_0x497c23['name']),_0x6484('0x66'),{'uri':_0x5d3642});})[_0x6484('0x6e')](function(_0x7afdff){logger[_0x6484('0x67')](_0x6484('0x6f'),JSON[_0x6484('0x1c')](_0x7afdff));});};exports[_0x6484('0x70')]=function(_0x7d3a92,_0x212334,_0x185e74,_0x2b1457,_0x409318,_0xfc2c13){var _0x307e00,_0x41b531,_0x494eb8,_0x1116ec;_0xfc2c13['remoteUri']=intUtil[_0x6484('0x68')](_0xfc2c13[_0x6484('0x4e')]);_0xfc2c13['serverUrl']=intUtil['stripTrailingSlash'](_0xfc2c13['serverUrl']);def[_0x6484('0x50')]=util[_0x6484('0x1d')]('%s/service/v4_1/rest.php',_0xfc2c13[_0x6484('0x4e')]);if(_0x409318&&_0x409318[_0x6484('0x52')]){logger[_0x6484('0x8')]('['+_0x212334[_0x6484('0x71')][_0x6484('0x72')]()+']',_0x6484('0x54'));_0x212334[_0x6484('0x55')]=util[_0x6484('0x1d')](_0x6484('0x56'),_0xfc2c13[_0x6484('0x4f')],_0x212334[_0x6484('0x57')],md5(_0x212334[_0x6484('0x57')]));}else{_0x212334[_0x6484('0x55')]='';}return getConnection(_0xfc2c13)[_0x6484('0x25')](function(_0x4a4126){_0x1116ec=_0x4a4126;if(!_['isNil'](_0x2b1457)){return getUser(_0xfc2c13,_0x2b1457[_0x6484('0xa')],_0x1116ec);}else{return getUser(_0xfc2c13,null,_0x1116ec);}})[_0x6484('0x25')](function(_0x2908ce){_0x307e00=_0x2908ce;logger[_0x6484('0x8')](_0x6484('0x58'),_0x307e00['id']);return getEndUser(_0xfc2c13,_0x212334[_0x6484('0x59')],_0x212334[_0x6484('0x5a')],_0x1116ec);})['then'](function(_0x2f9f96){_0x41b531=_0x2f9f96;logger[_0x6484('0x8')](_0x6484('0x5b'),_0x41b531['id']);return getTicket(_0xfc2c13,_0x307e00,_0x41b531,_0x185e74,_0x212334,_0x185e74[_0x6484('0x6c')],_0x1116ec,_0x6484('0x5c'));})[_0x6484('0x25')](function(_0x453e8f){_0x494eb8=_0x453e8f;logger[_0x6484('0x8')](_0x6484('0x5d'));logger[_0x6484('0x8')](_0x6484('0x5e'),_0x494eb8['id']);return setRelationship(_0x1116ec,_0x307e00,_0x494eb8,_0x6484('0x73'));})['then'](function(){return setRelationship(_0x1116ec,_0x41b531,_0x494eb8,'contacts');})[_0x6484('0x25')](function(){return getServerInfo(_0x1116ec);})[_0x6484('0x6e')](function(_0x5d4287){logger[_0x6484('0x67')]('['+_0x212334[_0x6484('0x71')][_0x6484('0x72')]()+']',JSON[_0x6484('0x1c')](_0x5d4287));});}; \ No newline at end of file +var _0xfc4c=['Variable','push','POST','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','charAt','remoteUri','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','recordingFormat','none','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','contacts','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','user:%s','[OUTBOUND]','unmanaged','lastevent','toUpperCase','calleridname','calleridnum','Fields','request-promise','bluebird','md5','util','ioredis','../../../../config/logger','sugarcrm','defaults','redis','emit','getString','Subjects','assigned_user_id','Descriptions','date_start','toISOString','duration_hours','parent_id','Contacts','parent_name','name','direction','length','forEach','idField','variableName','set_entry','JSON','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','stringify','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','value','info','Agent\x20found!','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','phone_home','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','customField','nameField','toLowerCase','content','custom_fields','variable','customVariable'];(function(_0x3b2369,_0x4c68b9){var _0x5a1367=function(_0x58ddcf){while(--_0x58ddcf){_0x3b2369['push'](_0x3b2369['shift']());}};_0x5a1367(++_0x4c68b9);}(_0xfc4c,0x198));var _0xcfc4=function(_0x4b273e,_0x313e03){_0x4b273e=_0x4b273e-0x0;var _0x1e8ec5=_0xfc4c[_0x4b273e];return _0x1e8ec5;};'use strict';var _=require('lodash');var rp=require(_0xcfc4('0x0'));var BPromise=require(_0xcfc4('0x1'));var md5=require(_0xcfc4('0x2'));var util=require(_0xcfc4('0x3'));var Redis=require(_0xcfc4('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xcfc4('0x5'))(_0xcfc4('0x6'));config['redis']=_[_0xcfc4('0x7')](config[_0xcfc4('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcfc4('0x8')]));var def={'method':'POST','json':!![]};function emit(_0xe33029,_0x5ed22c,_0x3bbb45){io['to'](_0xe33029)[_0xcfc4('0x9')](_0x5ed22c,_0x3bbb45);}function getTicket(_0x3120ab,_0x527e06,_0x55fec1,_0x15145f,_0x1928a2,_0x3aa9ae,_0x985107,_0x54586c){logger['info']('Creating\x20new\x20ticket...');var _0x49f8e6=new Date();var _0x36d7d4=[{'name':'name','value':intUtil[_0xcfc4('0xa')](_0x15145f[_0xcfc4('0xb')],_0x1928a2,'\x20')},{'name':_0xcfc4('0xc'),'value':_0x527e06['id']},{'name':'created_by','value':_0x527e06['id']},{'name':'description','value':intUtil[_0xcfc4('0xa')](_0x15145f[_0xcfc4('0xd')],_0x1928a2,'\x0a')},{'name':_0xcfc4('0xe'),'value':_0x49f8e6[_0xcfc4('0xf')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0xcfc4('0x10'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xcfc4('0x11'),'value':_0x55fec1['id']},{'name':'parent_type','value':_0xcfc4('0x12')},{'name':_0xcfc4('0x13'),'value':_0x55fec1[_0xcfc4('0x14')]},{'name':_0xcfc4('0x15'),'value':_0x54586c}];if(_0x3aa9ae[_0xcfc4('0x16')]){_[_0xcfc4('0x17')](_0x3aa9ae,function(_0x5e262e){if(_0x1928a2[_0x5e262e['variableName']]){_0x36d7d4['push']({'name':_0x5e262e[_0xcfc4('0x18')],'value':_0x1928a2[_0x5e262e[_0xcfc4('0x19')]]});}});}return request({'form':{'method':_0xcfc4('0x1a'),'input_type':'JSON','response_type':_0xcfc4('0x1b'),'rest_data':JSON['stringify']({'session':_0x985107['id'],'module_name':_0xcfc4('0x1c'),'name_value_list':_0x36d7d4})}});}function getAuth(_0x520bb5){return util[_0xcfc4('0x1d')](_0xcfc4('0x1e'),new Buffer(_0x520bb5[_0xcfc4('0x1f')]+':X')[_0xcfc4('0x20')](_0xcfc4('0x21')));}function getServerInfo(_0x205442){return request({'form':{'method':_0xcfc4('0x22'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xcfc4('0x23')]({'session':_0x205442['id']})}});}function getUser(_0x3d97e3,_0xf05db5,_0x695b9){if(!_[_0xcfc4('0x24')](_0xf05db5)){logger['info'](_0xcfc4('0x25'),_0xf05db5);return request({'form':{'method':_0xcfc4('0x26'),'input_type':_0xcfc4('0x1b'),'response_type':'JSON','rest_data':JSON[_0xcfc4('0x23')]({'session':_0x695b9['id'],'module_name':_0xcfc4('0x27'),'query':util[_0xcfc4('0x1d')](_0xcfc4('0x28'),_0xf05db5),'order_by':'','offset':'0','select_fields':['id',_0xcfc4('0x14'),_0xcfc4('0x29')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xcfc4('0x2a')](function(_0x50f055){if(_0x50f055[_0xcfc4('0x2b')][_0xcfc4('0x16')]){var _0x452298=_[_0xcfc4('0x2c')](_0x50f055[_0xcfc4('0x2b')],function(_0x2bcf61){return _0x2bcf61['name_value_list']['user_name'][_0xcfc4('0x2d')]===_0xf05db5;});if(_0x452298){logger[_0xcfc4('0x2e')](_0xcfc4('0x2f'));return BPromise['resolve']({'id':_0x452298[_0xcfc4('0x30')]['id']['value'],'name':_0x452298['name_value_list']['name'][_0xcfc4('0x2d')]});}}logger[_0xcfc4('0x2e')](_0xcfc4('0x31'));return BPromise[_0xcfc4('0x32')]({'id':_0x695b9[_0xcfc4('0x30')][_0xcfc4('0x33')][_0xcfc4('0x2d')],'name':_0x695b9[_0xcfc4('0x30')][_0xcfc4('0x29')]['value']});});}else{logger[_0xcfc4('0x2e')](_0xcfc4('0x34'));return BPromise[_0xcfc4('0x32')]({'id':_0x695b9[_0xcfc4('0x30')]['user_id'][_0xcfc4('0x2d')],'name':_0x695b9['name_value_list'][_0xcfc4('0x29')][_0xcfc4('0x2d')]});}}function getEndUser(_0x14c622,_0x378d4d,_0x252814,_0x9a2f6e){logger[_0xcfc4('0x2e')](_0xcfc4('0x35'),_0x252814);return request({'form':{'method':_0xcfc4('0x26'),'input_type':_0xcfc4('0x1b'),'response_type':_0xcfc4('0x1b'),'rest_data':JSON[_0xcfc4('0x23')]({'session':_0x9a2f6e['id'],'module_name':'Contacts','query':util[_0xcfc4('0x1d')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x252814),'order_by':'','offset':'0','select_fields':['id',_0xcfc4('0x14'),_0xcfc4('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xcfc4('0x2a')](function(_0x244c9f){if(_0x244c9f[_0xcfc4('0x2b')][_0xcfc4('0x16')]){var _0x3f7f2e=_['find'](_0x244c9f[_0xcfc4('0x2b')],function(_0x5f1e0b){return _0x5f1e0b['name_value_list'][_0xcfc4('0x36')][_0xcfc4('0x2d')]===_0x252814;});if(_0x3f7f2e){logger[_0xcfc4('0x2e')]('Enduser\x20found!');return BPromise[_0xcfc4('0x32')]({'id':_0x3f7f2e[_0xcfc4('0x30')]['id'][_0xcfc4('0x2d')],'name':_0x3f7f2e[_0xcfc4('0x30')][_0xcfc4('0x14')][_0xcfc4('0x2d')],'phone':_0x3f7f2e[_0xcfc4('0x30')][_0xcfc4('0x36')][_0xcfc4('0x2d')]});}}else{logger[_0xcfc4('0x2e')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xcfc4('0x1a'),'input_type':_0xcfc4('0x1b'),'response_type':_0xcfc4('0x1b'),'rest_data':JSON['stringify']({'session':_0x9a2f6e['id'],'module_name':'Contacts','name_value_list':[{'name':_0xcfc4('0x37'),'value':_0x378d4d!==_0xcfc4('0x38')?_0x378d4d:util[_0xcfc4('0x1d')](_0xcfc4('0x39'),_0x252814)},{'name':_0xcfc4('0x36'),'value':_0x252814}]})}})[_0xcfc4('0x2a')](function(_0x3d39fd){logger['info'](_0xcfc4('0x3a'));return BPromise['resolve']({'id':_0x3d39fd['id'],'name':_0x3d39fd[_0xcfc4('0x2b')][_0xcfc4('0x37')][_0xcfc4('0x2d')],'phone':_0x3d39fd[_0xcfc4('0x2b')]['phone_home'][_0xcfc4('0x2d')]});});}});}function request(_0x24615a){logger[_0xcfc4('0x3b')](_0xcfc4('0x3c'),JSON[_0xcfc4('0x23')](_0x24615a));return rp(_[_0xcfc4('0x3d')](def,_0x24615a));}function getTags(_0x4eba1e,_0x27defa){var _0x131ba7=[];if(_0x4eba1e&&_0x4eba1e['length']>0x0){_0x131ba7=_[_0xcfc4('0x3e')](_0x4eba1e,_0x27defa);}return _0x131ba7;}function getCustomFields(_0x1e2b31,_0x31c632){var _0x7e5680=[];var _0x43fff9={'custom_fields':[]};if(_0x1e2b31[_0xcfc4('0x16')]>0x0){_[_0xcfc4('0x17')](_0x1e2b31,function(_0x137add){if(_0x137add[_0xcfc4('0x3f')]===_0xcfc4('0x40')&&_0x137add['nameField']&&!_0x137add[_0xcfc4('0x41')]){_0x43fff9[_0x137add[_0xcfc4('0x42')][_0xcfc4('0x43')]()]=_0x137add[_0xcfc4('0x44')]['toString']();}else if(_0x137add[_0xcfc4('0x3f')]==='string'&&_0x137add[_0xcfc4('0x18')]&&_0x137add[_0xcfc4('0x41')]){_0x43fff9[_0xcfc4('0x45')]['push']({'id':_0x137add[_0xcfc4('0x18')],'value':_0x137add[_0xcfc4('0x44')][_0xcfc4('0x20')]()});}else if(_0x137add[_0xcfc4('0x3f')]===_0xcfc4('0x46')&&_0x137add[_0xcfc4('0x19')]&&_0x137add[_0xcfc4('0x18')]&&_0x137add[_0xcfc4('0x41')]){_0x31c632[_0x137add[_0xcfc4('0x19')]]&&_0x43fff9[_0xcfc4('0x45')]['push']({'id':_0x137add[_0xcfc4('0x18')],'value':_0x31c632[_0x137add[_0xcfc4('0x19')]][_0xcfc4('0x20')]()});}else if(_0x137add[_0xcfc4('0x3f')]===_0xcfc4('0x47')&&_0x137add[_0xcfc4('0x48')]&&_0x137add[_0xcfc4('0x48')][_0xcfc4('0x14')]&&_0x137add[_0xcfc4('0x18')]&&_0x137add[_0xcfc4('0x41')]){_0x31c632[_0x137add[_0xcfc4('0x48')][_0xcfc4('0x14')][_0xcfc4('0x43')]()]&&_0x43fff9['custom_fields'][_0xcfc4('0x49')]({'id':_0x137add['idField'],'value':_0x31c632[_0x137add[_0xcfc4('0x48')][_0xcfc4('0x14')][_0xcfc4('0x43')]()][_0xcfc4('0x20')]()});}});}return _0x43fff9;}function getConnection(_0x3bf948){return request({'method':_0xcfc4('0x4a'),'form':{'method':'login','input_type':_0xcfc4('0x1b'),'response_type':'JSON','rest_data':JSON[_0xcfc4('0x23')]({'user_auth':{'user_name':_0x3bf948[_0xcfc4('0x4b')],'password':_0x3bf948['password'],'encryption':_0xcfc4('0x4c')},'application':_0xcfc4('0x4d')})}})[_0xcfc4('0x2a')](function(_0x3c308f){var _0x42612c=_0x3c308f;if(_0x42612c['id']){def[_0xcfc4('0x4e')]=_0x42612c['id'];return BPromise[_0xcfc4('0x32')](_0x42612c);}else{throw new Error(util[_0xcfc4('0x1d')](_0xcfc4('0x4f'),_0x3bf948['id']));}});}function setRelationship(_0x38d258,_0x2dab87,_0x53b13c,_0x43a34e){return request({'form':{'method':_0xcfc4('0x50'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xcfc4('0x23')]({'session':_0x38d258['id'],'module_name':'Calls','module_id':_0x53b13c['id'],'link_field_name':_0x43a34e,'related_ids':[_0x2dab87['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xcfc4('0x51')]=function(_0xcdf5d9,_0x5b3214,_0x3ad946,_0x5e01ef,_0x56d584,_0x216ab5){var _0x1406e2,_0x3d717e,_0x55d515,_0x4f1997;_0x216ab5['remoteUri']=intUtil[_0xcfc4('0x52')](_0x216ab5['remoteUri']);_0x216ab5[_0xcfc4('0x53')]=intUtil[_0xcfc4('0x52')](_0x216ab5[_0xcfc4('0x53')]);def[_0xcfc4('0x54')]=util[_0xcfc4('0x1d')](_0xcfc4('0x55'),_0x216ab5['remoteUri']);if(_0x56d584&&_0x56d584[_0xcfc4('0x56')]){logger['info'](_0xcfc4('0x57'),'Recording\x20is\x20enabled!');_0x5b3214[_0xcfc4('0x58')]=util[_0xcfc4('0x1d')](_0xcfc4('0x59'),_0x216ab5[_0xcfc4('0x53')],_0x5b3214['uniqueid'],md5(_0x5b3214[_0xcfc4('0x5a')]));}else{_0x5b3214[_0xcfc4('0x58')]='';}return getConnection(_0x216ab5)[_0xcfc4('0x2a')](function(_0x315040){_0x4f1997=_0x315040;return getUser(_0x216ab5,_0x5e01ef['name'],_0x4f1997);})[_0xcfc4('0x2a')](function(_0xe84676){_0x1406e2=_0xe84676;logger[_0xcfc4('0x2e')]('The\x20User\x20ID\x20is:',_0x1406e2['id']);return getEndUser(_0x216ab5,_0x5b3214['calleridname'],_0x5b3214['calleridnum'],_0x4f1997);})[_0xcfc4('0x2a')](function(_0x4bdc5c){_0x3d717e=_0x4bdc5c;logger[_0xcfc4('0x2e')](_0xcfc4('0x5b'),_0x3d717e['id']);return getTicket(_0x216ab5,_0x1406e2,_0x3d717e,_0x3ad946,_0x5b3214,_0x3ad946['Fields'],_0x4f1997,_0xcfc4('0x5c'));})[_0xcfc4('0x2a')](function(_0x33041b){_0x55d515=_0x33041b;logger[_0xcfc4('0x2e')](_0xcfc4('0x5d'));logger[_0xcfc4('0x2e')](_0xcfc4('0x5e'),_0x55d515['id']);return setRelationship(_0x4f1997,_0x1406e2,_0x55d515,_0xcfc4('0x5f'));})[_0xcfc4('0x2a')](function(){return setRelationship(_0x4f1997,_0x3d717e,_0x55d515,'contacts');})[_0xcfc4('0x2a')](function(){return getServerInfo(_0x4f1997);})['then'](function(_0x370907){var _0x1c9c91=parseInt(_0x370907[_0xcfc4('0x60')][_0xcfc4('0x61')](0x0));var _0x5bd187=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x216ab5[_0xcfc4('0x62')],_0x55d515['id']);if(_0x1c9c91>0x6){_0x5bd187=util[_0xcfc4('0x1d')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x216ab5[_0xcfc4('0x62')],_0x55d515['id']);}logger[_0xcfc4('0x2e')](_0xcfc4('0x57'),_0xcfc4('0x63'));emit(util['format']('user:%s',_0x5e01ef['name']),_0xcfc4('0x64'),{'uri':_0x5bd187});})[_0xcfc4('0x65')](function(_0x4eb9e5){logger[_0xcfc4('0x66')](_0xcfc4('0x57'),JSON[_0xcfc4('0x23')](_0x4eb9e5));});};exports[_0xcfc4('0x67')]=function(_0x3c89f9,_0x233f1b,_0x3c2cfa,_0x1dea17,_0x3d3dda,_0xe41106,_0x562e83){var _0x4996b1,_0x2e3e55,_0x1a3833,_0x32b1e0;_0xe41106[_0xcfc4('0x62')]=intUtil[_0xcfc4('0x52')](_0xe41106['remoteUri']);_0xe41106[_0xcfc4('0x53')]=intUtil['stripTrailingSlash'](_0xe41106[_0xcfc4('0x53')]);def[_0xcfc4('0x54')]=util[_0xcfc4('0x1d')](_0xcfc4('0x55'),_0xe41106[_0xcfc4('0x62')]);if(_0x562e83&&_0x562e83[_0xcfc4('0x68')]&&_0x562e83[_0xcfc4('0x68')]!==_0xcfc4('0x69')){logger['info']('[OUTBOUND]',_0xcfc4('0x6a'));_0x233f1b[_0xcfc4('0x58')]=util[_0xcfc4('0x1d')](_0xcfc4('0x59'),_0xe41106['serverUrl'],_0x233f1b[_0xcfc4('0x5a')],md5(_0x233f1b[_0xcfc4('0x5a')]));}return getConnection(_0xe41106)[_0xcfc4('0x2a')](function(_0x35d1b1){_0x32b1e0=_0x35d1b1;return getUser(_0xe41106,_0x1dea17[_0xcfc4('0x14')],_0x32b1e0);})['then'](function(_0x3ae2c3){_0x4996b1=_0x3ae2c3;logger[_0xcfc4('0x2e')](_0xcfc4('0x6b'),_0x4996b1['id']);return getEndUser(_0xe41106,_0x233f1b[_0xcfc4('0x6c')],_0x233f1b[_0xcfc4('0x6d')],_0x32b1e0);})[_0xcfc4('0x2a')](function(_0x10c92e){_0x2e3e55=_0x10c92e;logger[_0xcfc4('0x2e')](_0xcfc4('0x5b'),_0x2e3e55['id']);return getTicket(_0xe41106,_0x4996b1,_0x2e3e55,_0x3c2cfa,_0x233f1b,_0x3c2cfa['Fields'],_0x32b1e0,'Outbound');})[_0xcfc4('0x2a')](function(_0x53846f){_0x1a3833=_0x53846f;logger['info'](_0xcfc4('0x5d'));logger[_0xcfc4('0x2e')](_0xcfc4('0x5e'),_0x1a3833['id']);return setRelationship(_0x32b1e0,_0x4996b1,_0x1a3833,_0xcfc4('0x5f'));})[_0xcfc4('0x2a')](function(){return setRelationship(_0x32b1e0,_0x2e3e55,_0x1a3833,_0xcfc4('0x6e'));})[_0xcfc4('0x2a')](function(){return getServerInfo(_0x32b1e0);})[_0xcfc4('0x2a')](function(_0x5f34fd){var _0x1fc476=parseInt(_0x5f34fd[_0xcfc4('0x60')][_0xcfc4('0x61')](0x0));var _0x1ad4f4=util[_0xcfc4('0x1d')](_0xcfc4('0x6f'),_0xe41106['remoteUri'],_0x1a3833['id']);if(_0x1fc476>0x6){_0x1ad4f4=util[_0xcfc4('0x1d')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0xe41106[_0xcfc4('0x62')],_0x1a3833['id']);}logger[_0xcfc4('0x2e')]('[OUTBOUND]',_0xcfc4('0x63'));emit(util['format'](_0xcfc4('0x70'),_0x1dea17['name']),_0xcfc4('0x64'),{'uri':_0x1ad4f4});})[_0xcfc4('0x65')](function(_0x108d34){logger[_0xcfc4('0x66')](_0xcfc4('0x71'),JSON['stringify'](_0x108d34));});};exports[_0xcfc4('0x72')]=function(_0x466f28,_0x2406ac,_0x1af7e0,_0x1c809e,_0x1b8040,_0x484906){var _0x40a5d1,_0xffd1b6,_0x100574,_0x546a89;_0x484906[_0xcfc4('0x62')]=intUtil['stripTrailingSlash'](_0x484906[_0xcfc4('0x62')]);_0x484906[_0xcfc4('0x53')]=intUtil[_0xcfc4('0x52')](_0x484906['serverUrl']);def[_0xcfc4('0x54')]=util[_0xcfc4('0x1d')]('%s/service/v4_1/rest.php',_0x484906['remoteUri']);if(_0x1b8040&&_0x1b8040[_0xcfc4('0x56')]){logger['info']('['+_0x2406ac[_0xcfc4('0x73')][_0xcfc4('0x74')]()+']','Recording\x20is\x20enabled!');_0x2406ac[_0xcfc4('0x58')]=util['format'](_0xcfc4('0x59'),_0x484906[_0xcfc4('0x53')],_0x2406ac[_0xcfc4('0x5a')],md5(_0x2406ac['uniqueid']));}else{_0x2406ac['recordingURL']='';}return getConnection(_0x484906)[_0xcfc4('0x2a')](function(_0x26a851){_0x546a89=_0x26a851;if(!_[_0xcfc4('0x24')](_0x1c809e)){return getUser(_0x484906,_0x1c809e['name'],_0x546a89);}else{return getUser(_0x484906,null,_0x546a89);}})['then'](function(_0x37560f){_0x40a5d1=_0x37560f;logger[_0xcfc4('0x2e')]('The\x20User\x20ID\x20is:',_0x40a5d1['id']);return getEndUser(_0x484906,_0x2406ac[_0xcfc4('0x75')],_0x2406ac[_0xcfc4('0x76')],_0x546a89);})[_0xcfc4('0x2a')](function(_0x6849bb){_0xffd1b6=_0x6849bb;logger['info']('The\x20Enduser\x20ID\x20is:',_0xffd1b6['id']);return getTicket(_0x484906,_0x40a5d1,_0xffd1b6,_0x1af7e0,_0x2406ac,_0x1af7e0[_0xcfc4('0x77')],_0x546a89,_0xcfc4('0x5c'));})[_0xcfc4('0x2a')](function(_0xc0a10c){_0x100574=_0xc0a10c;logger[_0xcfc4('0x2e')]('Ticket\x20created!');logger['info'](_0xcfc4('0x5e'),_0x100574['id']);return setRelationship(_0x546a89,_0x40a5d1,_0x100574,'users');})[_0xcfc4('0x2a')](function(){return setRelationship(_0x546a89,_0xffd1b6,_0x100574,_0xcfc4('0x6e'));})[_0xcfc4('0x2a')](function(){return getServerInfo(_0x546a89);})[_0xcfc4('0x65')](function(_0x1bdb9d){logger[_0xcfc4('0x66')]('['+_0x2406ac['lastevent'][_0xcfc4('0x74')]()+']',JSON[_0xcfc4('0x23')](_0x1bdb9d));});}; \ 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 6ea9db4..c7171f0 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 _0xb09a=['%s:\x20%s','customVariable','format','join','stripTrailingSlash','substring','lastIndexOf','isNil','test','lodash','util','getString','sortBy','length','type','string','content','variable','variableName','Variable','name','toLowerCase','push','keyValue','key','keyContent','keyType'];(function(_0x1f8053,_0x111077){var _0x174fd8=function(_0x2f92fc){while(--_0x2f92fc){_0x1f8053['push'](_0x1f8053['shift']());}};_0x174fd8(++_0x111077);}(_0xb09a,0x90));var _0xab09=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xb09a[_0x17928f];return _0x500b63;};'use strict';var _=require(_0xab09('0x0'));var util=require(_0xab09('0x1'));exports[_0xab09('0x2')]=function(_0x5d8cc2,_0x1acc5f,_0x344423){var _0x299df3=[];if(_0x5d8cc2['length']>0x0){var _0x48ea75=_[_0xab09('0x3')](_0x5d8cc2,['id']);for(var _0x45554c=0x0;_0x45554c<_0x48ea75[_0xab09('0x4')];_0x45554c++){var _0x189ce4=_0x48ea75[_0x45554c];if(_0x189ce4[_0xab09('0x5')]===_0xab09('0x6')){_0x299df3['push'](_0x189ce4[_0xab09('0x7')]);}else if(_0x189ce4['type']===_0xab09('0x8')&&_0x189ce4[_0xab09('0x9')]){_0x1acc5f[_0x189ce4[_0xab09('0x9')]]&&_0x299df3['push'](_0x1acc5f[_0x189ce4[_0xab09('0x9')]]['toString']());}else if(_0x189ce4['type']==='customVariable'&&_0x189ce4[_0xab09('0xa')]&&_0x189ce4[_0xab09('0xa')][_0xab09('0xb')]){_0x1acc5f[_0x189ce4['Variable']['name'][_0xab09('0xc')]()]&&_0x299df3[_0xab09('0xd')](_0x1acc5f[_0x189ce4[_0xab09('0xa')]['name'][_0xab09('0xc')]()]['toString']());}else if(_0x189ce4[_0xab09('0x5')]===_0xab09('0xe')){if(_0x189ce4['keyType']===_0xab09('0x6')&&_0x189ce4['key']){_0x299df3[_0xab09('0xd')](util['format']('%s:\x20%s',_0x189ce4[_0xab09('0xf')],_0x189ce4[_0xab09('0x10')]));}else if(_0x189ce4[_0xab09('0x11')]===_0xab09('0x8')&&_0x189ce4[_0xab09('0x9')]&&_0x189ce4[_0xab09('0xf')]){_0x1acc5f[_0x189ce4[_0xab09('0x9')]]&&_0x299df3[_0xab09('0xd')](util['format'](_0xab09('0x12'),_0x189ce4['key'],_0x1acc5f[_0x189ce4[_0xab09('0x9')]]));}else if(_0x189ce4['keyType']===_0xab09('0x13')&&_0x189ce4[_0xab09('0xa')]&&_0x189ce4[_0xab09('0xa')][_0xab09('0xb')]&&_0x189ce4[_0xab09('0xf')]){_0x1acc5f[_0x189ce4['Variable']['name'][_0xab09('0xc')]()]&&_0x299df3[_0xab09('0xd')](util[_0xab09('0x14')](_0xab09('0x12'),_0x189ce4[_0xab09('0xf')],_0x1acc5f[_0x189ce4[_0xab09('0xa')]['name'][_0xab09('0xc')]()]));}}}}return _0x299df3[_0xab09('0x15')](_0x344423);};exports[_0xab09('0x16')]=function(_0x1a1167){var _0x14888b=_0x1a1167['slice'](-0x1);if(_0x14888b==='/'){_0x1a1167=_0x1a1167[_0xab09('0x17')](0x0,_0x1a1167[_0xab09('0x18')](_0x14888b));}return _0x1a1167;};exports['validateEmail']=function(_0x537314){if(!_[_0xab09('0x19')](_0x537314)&&_0x537314!==''){var _0x2ff887=/^(([^<>()\[\]\\.,;:\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 _0x2ff887[_0xab09('0x1a')](String(_0x537314)[_0xab09('0xc')]());}else{return![];}}; \ No newline at end of file +var _0xdd2f=['Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','substring','validateEmail','test','lodash','util','getString','length','sortBy','type','string','push','variable','variableName','toString','customVariable'];(function(_0x3429a3,_0x5f1ca7){var _0x849cc3=function(_0x6bbbc3){while(--_0x6bbbc3){_0x3429a3['push'](_0x3429a3['shift']());}};_0x849cc3(++_0x5f1ca7);}(_0xdd2f,0xc4));var _0xfdd2=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xdd2f[_0x24237f];return _0x48298e;};'use strict';var _=require(_0xfdd2('0x0'));var util=require(_0xfdd2('0x1'));exports[_0xfdd2('0x2')]=function(_0x2ca7e6,_0x5edb18,_0x33ee15){var _0x597488=[];if(_0x2ca7e6[_0xfdd2('0x3')]>0x0){var _0x1e5b6b=_[_0xfdd2('0x4')](_0x2ca7e6,['id']);for(var _0xca532a=0x0;_0xca532a<_0x1e5b6b[_0xfdd2('0x3')];_0xca532a++){var _0x1211ec=_0x1e5b6b[_0xca532a];if(_0x1211ec[_0xfdd2('0x5')]===_0xfdd2('0x6')){_0x597488[_0xfdd2('0x7')](_0x1211ec['content']);}else if(_0x1211ec[_0xfdd2('0x5')]===_0xfdd2('0x8')&&_0x1211ec['variableName']){_0x5edb18[_0x1211ec[_0xfdd2('0x9')]]&&_0x597488[_0xfdd2('0x7')](_0x5edb18[_0x1211ec[_0xfdd2('0x9')]][_0xfdd2('0xa')]());}else if(_0x1211ec[_0xfdd2('0x5')]===_0xfdd2('0xb')&&_0x1211ec[_0xfdd2('0xc')]&&_0x1211ec[_0xfdd2('0xc')][_0xfdd2('0xd')]){_0x5edb18[_0x1211ec[_0xfdd2('0xc')]['name'][_0xfdd2('0xe')]()]&&_0x597488[_0xfdd2('0x7')](_0x5edb18[_0x1211ec[_0xfdd2('0xc')][_0xfdd2('0xd')][_0xfdd2('0xe')]()][_0xfdd2('0xa')]());}else if(_0x1211ec[_0xfdd2('0x5')]===_0xfdd2('0xf')){if(_0x1211ec[_0xfdd2('0x10')]===_0xfdd2('0x6')&&_0x1211ec[_0xfdd2('0x11')]){_0x597488[_0xfdd2('0x7')](util[_0xfdd2('0x12')](_0xfdd2('0x13'),_0x1211ec['key'],_0x1211ec[_0xfdd2('0x14')]));}else if(_0x1211ec[_0xfdd2('0x10')]===_0xfdd2('0x8')&&_0x1211ec[_0xfdd2('0x9')]&&_0x1211ec[_0xfdd2('0x11')]){_0x5edb18[_0x1211ec['variableName']]&&_0x597488['push'](util[_0xfdd2('0x12')](_0xfdd2('0x13'),_0x1211ec[_0xfdd2('0x11')],_0x5edb18[_0x1211ec['variableName']]));}else if(_0x1211ec['keyType']==='customVariable'&&_0x1211ec[_0xfdd2('0xc')]&&_0x1211ec[_0xfdd2('0xc')][_0xfdd2('0xd')]&&_0x1211ec['key']){_0x5edb18[_0x1211ec['Variable']['name'][_0xfdd2('0xe')]()]&&_0x597488[_0xfdd2('0x7')](util['format'](_0xfdd2('0x13'),_0x1211ec[_0xfdd2('0x11')],_0x5edb18[_0x1211ec[_0xfdd2('0xc')]['name']['toLowerCase']()]));}}}}return _0x597488[_0xfdd2('0x15')](_0x33ee15);};exports[_0xfdd2('0x16')]=function(_0x11fccc){var _0x45adfd=_0x11fccc['slice'](-0x1);if(_0x45adfd==='/'){_0x11fccc=_0x11fccc[_0xfdd2('0x17')](0x0,_0x11fccc['lastIndexOf'](_0x45adfd));}return _0x11fccc;};exports[_0xfdd2('0x18')]=function(_0x40e77c){if(!_['isNil'](_0x40e77c)&&_0x40e77c!==''){var _0x3f746e=/^(([^<>()\[\]\\.,;:\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 _0x3f746e[_0xfdd2('0x19')](String(_0x40e77c)[_0xfdd2('0xe')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index d33e50c..4789ae8 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['info','Creating\x20new\x20ticket...','merge','Normal','Subjects','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','success','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','then','Agent\x20found!','resolve','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','catch','userId','getUser','Searching\x20end\x20user\x20with\x20phone','GET','query','Enduser\x20found!','firstname','Enduser\x20created.','lastname','phone','accessKey','getchallenge','login','token','getConnection','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','lastevent','toUpperCase','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','emit','length','forEach','includes','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase'];(function(_0x587dd0,_0x273922){var _0x56f153=function(_0x27fb33){while(--_0x27fb33){_0x587dd0['push'](_0x587dd0['shift']());}};_0x56f153(++_0x273922);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var rp=require(_0x0d8b('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0x0d8b('0x2'));var intUtil=require(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var io=require(_0x0d8b('0x9'))(new Redis(config['redis']));function emit(_0x413284,_0x284169,_0x58e4e2){io['to'](_0x413284)[_0x0d8b('0xa')](_0x284169,_0x58e4e2);}function getCustomFields(_0x348e65,_0x3b027f){var _0x1f4800={};if(_0x348e65[_0x0d8b('0xb')]>0x0){_[_0x0d8b('0xc')](_0x348e65,function(_0x2c5e9e){if(_[_0x0d8b('0xd')](['string',_0x0d8b('0xe')],_0x2c5e9e['type'])&&_0x2c5e9e[_0x0d8b('0xf')]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x2c5e9e[_0x0d8b('0x10')][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x13')&&_0x2c5e9e[_0x0d8b('0x14')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x15')&&_0x2c5e9e['Variable']&&_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]['toLowerCase']()]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')][_0x0d8b('0x18')]()][_0x0d8b('0x11')]();}});}return _0x1f4800;}function createTicket(_0x18dd2d,_0x264b39,_0xa3612a,_0x4a15bf,_0x27512e,_0x23d58f,_0x196c0a){logger[_0x0d8b('0x19')](_0x0d8b('0x1a'));var _0x5b709c=_[_0x0d8b('0x1b')]({'parent_id':'','assigned_user_id':_0x264b39['id'],'ticketpriorities':_0x0d8b('0x1c'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x4a15bf[_0x0d8b('0x1d')],_0x27512e,'\x20'),'description':intUtil['getString'](_0x4a15bf['Descriptions'],_0x27512e,'\x0a'),'contact_id':_0xa3612a['id']},getCustomFields(_0x23d58f,_0x27512e));var _0x5527d8={'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x18dd2d[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'username':_0x18dd2d[_0x0d8b('0x23')],'sessionName':_0x196c0a[_0x0d8b('0x24')],'elementType':_0x0d8b('0x25'),'element':JSON[_0x0d8b('0x26')](_0x5b709c)},'json':!![]};return request(_0x5527d8)['then'](function(_0xe8bbee){if(_0xe8bbee[_0x0d8b('0x27')]){return BPromise['resolve']({'id':_0xe8bbee[_0x0d8b('0x28')]['id']});}else{throw new Error(util['format'](_0x0d8b('0x29'),JSON[_0x0d8b('0x26')](_0xe8bbee[_0x0d8b('0x2a')])));}})['catch'](function(_0x59a905){var _0x28f639=_0x59a905[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),'createTicket',_0x28f639,JSON[_0x0d8b('0x26')](_0x59a905));});}function getUser(_0x4b59e5,_0x97050a,_0x48f24f){if(intUtil[_0x0d8b('0x2d')](_0x97050a)){logger['info'](_0x0d8b('0x2e'),_0x97050a);return request({'method':'GET','uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x4b59e5[_0x0d8b('0x21')]),'qs':{'operation':'query','username':_0x4b59e5['username'],'sessionName':_0x48f24f['sessionName'],'query':util[_0x0d8b('0x1f')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x97050a)},'json':!![]})[_0x0d8b('0x2f')](function(_0x54f6f3){if(_0x54f6f3['success']&&_0x54f6f3[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x30'));return BPromise[_0x0d8b('0x31')]({'id':_0x54f6f3[_0x0d8b('0x28')][0x0]['id'],'email':_0x54f6f3[_0x0d8b('0x28')][0x0][_0x0d8b('0x32')],'name':_0x54f6f3['result'][0x0][_0x0d8b('0x33')]+'\x20'+_0x54f6f3[_0x0d8b('0x28')]['last_name']});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f['userId'],'email':_0x4b59e5[_0x0d8b('0x23')],'name':_0x0d8b('0x35')});}})[_0x0d8b('0x36')](function(_0x31ceba){var _0x933e01=_0x31ceba['statusCode']||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),'getUser',_0x933e01,JSON[_0x0d8b('0x26')](_0x31ceba));});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f[_0x0d8b('0x37')],'email':_0x4b59e5['username'],'name':'admin'})[_0x0d8b('0x36')](function(_0x5c2c04){var _0x531c55=_0x5c2c04[_0x0d8b('0x2b')]||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),_0x0d8b('0x38'),_0x531c55,JSON[_0x0d8b('0x26')](_0x5c2c04));});}}function getEndUser(_0x24c789,_0x579324,_0x6e5bab,_0x6a02ad){logger[_0x0d8b('0x19')](_0x0d8b('0x39'),_0x6e5bab);return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x24c789['remoteUri']),'qs':{'operation':_0x0d8b('0x3b'),'username':_0x24c789[_0x0d8b('0x23')],'sessionName':_0x6a02ad[_0x0d8b('0x24')],'query':util[_0x0d8b('0x1f')]('SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;',_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab)},'json':!![]})[_0x0d8b('0x2f')](function(_0x4b4bde){if(_0x4b4bde[_0x0d8b('0x27')]&&_0x4b4bde[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x3c'));return BPromise[_0x0d8b('0x31')]({'id':_0x4b4bde[_0x0d8b('0x28')][0x0]['id'],'name':_0x4b4bde[_0x0d8b('0x28')][0x0][_0x0d8b('0x3d')]+'\x20'+_0x4b4bde[_0x0d8b('0x28')][0x0]['lastname'],'phone':_0x6e5bab});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':'POST','uri':util['format'](_0x0d8b('0x20'),_0x24c789[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'sessionName':_0x6a02ad['sessionName'],'elementType':'Contacts','element':JSON[_0x0d8b('0x26')]({'lastname':_0x579324,'phone':_0x6e5bab,'assigned_user_id':'\x20'})},'json':!![]})[_0x0d8b('0x2f')](function(_0x344278){logger['info'](_0x0d8b('0x3e'));return BPromise[_0x0d8b('0x31')]({'id':_0x344278['result']['id'],'name':_0x344278['result'][_0x0d8b('0x3f')],'phone':_0x344278['result'][_0x0d8b('0x40')]});})['catch'](function(_0x53f643){var _0x30ccee=_0x53f643[_0x0d8b('0x2b')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getEndUser',_0x30ccee,JSON['stringify'](_0x53f643));});}});}function getConnection(_0x374d40){var _0x1e0498=_0x374d40[_0x0d8b('0x23')];var _0x490eda=_0x374d40[_0x0d8b('0x41')];return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'qs':{'operation':_0x0d8b('0x42'),'username':_0x1e0498},'json':!![]})[_0x0d8b('0x2f')](function(_0x1d5067){if(_0x1d5067[_0x0d8b('0x27')]){return request({'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x43'),'username':_0x1e0498,'accessKey':md5(_0x1d5067[_0x0d8b('0x28')][_0x0d8b('0x44')]+_0x490eda)},'json':!![]});}})[_0x0d8b('0x2f')](function(_0x1e162c){if(_0x1e162c[_0x0d8b('0x27')]){return BPromise['resolve'](_0x1e162c[_0x0d8b('0x28')]);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x374d40['id']));}})[_0x0d8b('0x36')](function(_0x113fb7){var _0x3f943a=_0x113fb7[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),_0x0d8b('0x45'),_0x3f943a,JSON[_0x0d8b('0x26')](_0x113fb7));});}function request(_0x241587){logger[_0x0d8b('0x19')]('[HTTP]',JSON['stringify'](_0x241587));return rp(_0x241587);}exports['queue']=function(_0x573f4f,_0x368ede,_0xf22c3c,_0x5e3bb4,_0x4950a8,_0x44c5c1){var _0x3d3cb6,_0x5c5bd7,_0x5ef6c3,_0x900906;_0x44c5c1[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x44c5c1[_0x0d8b('0x21')]);if(_0x4950a8&&_0x4950a8[_0x0d8b('0x47')]){logger['info'](_0x0d8b('0x48'),_0x0d8b('0x49'));_0x368ede['recordingURL']=util['format'](_0x0d8b('0x4a'),_0x44c5c1[_0x0d8b('0x4b')],_0x368ede['uniqueid'],md5(_0x368ede['uniqueid']));}else{_0x368ede[_0x0d8b('0x4c')]='';}return getConnection(_0x44c5c1)[_0x0d8b('0x2f')](function(_0x377027){_0x900906=_0x377027;return getUser(_0x44c5c1,_0x5e3bb4[_0x0d8b('0x4d')],_0x900906);})['then'](function(_0x356b3d){_0x3d3cb6=_0x356b3d;logger['info']('The\x20User\x20ID\x20is:',_0x3d3cb6['id']);return getEndUser(_0x44c5c1,_0x368ede[_0x0d8b('0x4e')],_0x368ede[_0x0d8b('0x4f')],_0x900906);})['then'](function(_0x4a8f33){_0x5c5bd7=_0x4a8f33;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x5c5bd7['id']);return createTicket(_0x44c5c1,_0x3d3cb6,_0x5c5bd7,_0xf22c3c,_0x368ede,_0xf22c3c[_0x0d8b('0x51')],_0x900906);})[_0x0d8b('0x2f')](function(_0x3afc3a){_0x5ef6c3=_0x3afc3a;logger[_0x0d8b('0x19')](_0x0d8b('0x52'));logger[_0x0d8b('0x19')]('The\x20Ticket\x20ID\x20is:',_0x5ef6c3['id']);var _0x24a859=util[_0x0d8b('0x1f')](_0x0d8b('0x53'),_0x44c5c1[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5ef6c3['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x48'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')]('user:%s',_0x5e3bb4[_0x0d8b('0x17')]),_0x0d8b('0x56'),{'uri':_0x24a859});})[_0x0d8b('0x36')](function(_0x23de9e){logger[_0x0d8b('0x2a')]('[QUEUE]',JSON[_0x0d8b('0x26')](_0x23de9e));});};exports[_0x0d8b('0x57')]=function(_0x181d49,_0x17a87f,_0x1d6cd4,_0x59ada2,_0x4d0e7c,_0x3b1166,_0x291b83){var _0x3e4a41,_0xbbb520,_0x5a70bd,_0x199122;_0x3b1166[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x3b1166['remoteUri']);_0x3b1166[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x3b1166[_0x0d8b('0x4b')]);if(_0x291b83&&_0x291b83[_0x0d8b('0x58')]&&_0x291b83[_0x0d8b('0x58')]!==_0x0d8b('0x59')){logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),'Recording\x20is\x20enabled!');_0x17a87f[_0x0d8b('0x4c')]=util['format'](_0x0d8b('0x4a'),_0x3b1166[_0x0d8b('0x4b')],_0x17a87f[_0x0d8b('0x5b')],md5(_0x17a87f[_0x0d8b('0x5b')]));}return getConnection(_0x3b1166)['then'](function(_0x19e097){_0x199122=_0x19e097;return getUser(_0x3b1166,_0x59ada2[_0x0d8b('0x4d')],_0x199122);})[_0x0d8b('0x2f')](function(_0x2332fc){_0x3e4a41=_0x2332fc;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0x3e4a41['id']);return getEndUser(_0x3b1166,_0x17a87f[_0x0d8b('0x5d')],_0x17a87f[_0x0d8b('0x5e')],_0x199122);})[_0x0d8b('0x2f')](function(_0x34affb){_0xbbb520=_0x34affb;logger['info']('The\x20Enduser\x20ID\x20is:',_0xbbb520['id']);return createTicket(_0x3b1166,_0x3e4a41,_0xbbb520,_0x1d6cd4,_0x17a87f,_0x1d6cd4[_0x0d8b('0x51')],_0x199122);})[_0x0d8b('0x2f')](function(_0x53e399){_0x5a70bd=_0x53e399;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger['info'](_0x0d8b('0x5f'),_0x5a70bd['id']);var _0x1c4e96=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3b1166[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5a70bd['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')](_0x0d8b('0x60'),_0x59ada2['name']),_0x0d8b('0x56'),{'uri':_0x1c4e96});})['catch'](function(_0x1a203e){logger[_0x0d8b('0x2a')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x26')](_0x1a203e));});};exports['unmanaged']=function(_0x3fe47d,_0x4a1c4a,_0x3a356b,_0x2c6c5f,_0x1c5fe2,_0x2ebea3){var _0xc5c35f,_0x2b44e5,_0x3e927c,_0x91aa89;_0x2ebea3[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x2ebea3['remoteUri']);_0x2ebea3[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x2ebea3[_0x0d8b('0x4b')]);if(_0x1c5fe2&&_0x1c5fe2[_0x0d8b('0x47')]){logger['info']('['+_0x4a1c4a[_0x0d8b('0x61')]['toUpperCase']()+']',_0x0d8b('0x49'));_0x4a1c4a[_0x0d8b('0x4c')]=util[_0x0d8b('0x1f')](_0x0d8b('0x4a'),_0x2ebea3[_0x0d8b('0x4b')],_0x4a1c4a[_0x0d8b('0x5b')],md5(_0x4a1c4a[_0x0d8b('0x5b')]));}else{_0x4a1c4a[_0x0d8b('0x4c')]='';}return getConnection(_0x2ebea3)['then'](function(_0x10eca6){_0x91aa89=_0x10eca6;return getUser(_0x2ebea3,'',_0x91aa89);})[_0x0d8b('0x2f')](function(_0x5b2916){_0xc5c35f=_0x5b2916;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0xc5c35f['id']);return getEndUser(_0x2ebea3,_0x4a1c4a[_0x0d8b('0x4e')],_0x4a1c4a[_0x0d8b('0x4f')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0x9e44b4){_0x2b44e5=_0x9e44b4;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x2b44e5['id']);return createTicket(_0x2ebea3,_0xc5c35f,_0x2b44e5,_0x3a356b,_0x4a1c4a,_0x3a356b[_0x0d8b('0x51')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0xe35028){_0x3e927c=_0xe35028;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger[_0x0d8b('0x19')](_0x0d8b('0x5f'),_0x3e927c['id']);})[_0x0d8b('0x36')](function(_0x58525c){logger['error']('['+_0x4a1c4a[_0x0d8b('0x61')][_0x0d8b('0x62')]()+']',JSON[_0x0d8b('0x26')](_0x58525c));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x245c82,_0x57fd74){var _0x3c5516=function(_0x2f76e4){while(--_0x2f76e4){_0x245c82['push'](_0x245c82['shift']());}};_0x3c5516(++_0x57fd74);}(_0x9c44,0x178));var _0x49c4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9c44[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 4e2e977..9e4c2d0 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 _0x478b=['error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','calleridname','calleridnum','\x20Error\x20running\x20Zendesk\x20integration','util','ioredis','./util','../../../../config/environment','zendesk','redis','localhost','emit','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','then','ticket','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','filter','end-user','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','Basic\x20%s','base64','debug','stringify','map','forEach','includes','picklist','nameField','content','toString','string','type','customField','custom_fields','push','idField','variable','variableName','customVariable','Variable','toLowerCase','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','replace','/api/v2'];(function(_0x4b667f,_0x28750b){var _0xc2dd0a=function(_0x47195f){while(--_0x47195f){_0x4b667f['push'](_0x4b667f['shift']());}};_0xc2dd0a(++_0x28750b);}(_0x478b,0x1b1));var _0xb478=function(_0x4f3db7,_0x1cf338){_0x4f3db7=_0x4f3db7-0x0;var _0x11a76a=_0x478b[_0x4f3db7];return _0x11a76a;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require(_0xb478('0x0'));var Redis=require(_0xb478('0x1'));var intUtil=require(_0xb478('0x2'));var config=require(_0xb478('0x3'));var logger=require('../../../../config/logger')(_0xb478('0x4'));config['redis']=_['defaults'](config[_0xb478('0x5')],{'host':_0xb478('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb478('0x5')]));function emit(_0xb0ac9f,_0x4b6b6f,_0xdbb58e){io['to'](_0xb0ac9f)[_0xb478('0x7')](_0x4b6b6f,_0xdbb58e);}var headers={'Content-Type':'application/json','Accept':_0xb478('0x8')};function getTicket(_0x4f56dc,_0x23244a,_0x37ab2c,_0x29c68b,_0x3701b2){logger[_0xb478('0x9')](_0xb478('0xa'));return request({'uri':util[_0xb478('0xb')]('%s/tickets.json',_0x4f56dc[_0xb478('0xc')]),'method':_0xb478('0xd'),'body':{'ticket':_[_0xb478('0xe')]({'requester_id':_0x37ab2c['id'],'submitter_id':_0x23244a?_0x23244a['id']:undefined,'assignee_id':_0x23244a?_0x23244a['id']:undefined,'tags':getTags(_0x29c68b[_0xb478('0xf')],_0xb478('0x10')),'subject':intUtil[_0xb478('0x11')](_0x29c68b[_0xb478('0x12')],_0x3701b2,'\x20'),'description':intUtil[_0xb478('0x11')](_0x29c68b['Descriptions'],_0x3701b2,'\x0a'),'comment':{'public':![],'body':intUtil[_0xb478('0x11')](_0x29c68b[_0xb478('0x13')],_0x3701b2,'\x0a')}},getCustomFields(_0x29c68b['Fields'],_0x3701b2))}})[_0xb478('0x14')](function(_0x39006c){logger['info']('Ticket\x20created!');return _0x39006c[_0xb478('0x15')];});}function getUser(_0x524ee4,_0x143797){if(intUtil['validateEmail'](_0x143797)){logger[_0xb478('0x9')]('Getting\x20agent\x20with\x20email',_0x143797);return request({'uri':util['format'](_0xb478('0x16'),_0x524ee4[_0xb478('0xc')]),'qs':{'query':util['format'](_0xb478('0x17'),_0x143797)}})[_0xb478('0x14')](function(_0x148e67){if(_0x148e67['count']){logger[_0xb478('0x9')](_0xb478('0x18'));return _[_0xb478('0x19')](_0x148e67[_0xb478('0x1a')],{'email':_0x143797,'role':_0xb478('0x1b')});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xb478('0xb')](_0xb478('0x1c'),_0x524ee4['remoteUri'])})[_0xb478('0x14')](function(_0x1e3cfd){logger[_0xb478('0x9')](_0xb478('0x1d'));return _0x1e3cfd[_0xb478('0x1e')];});}});}else{logger[_0xb478('0x9')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xb478('0xb')](_0xb478('0x1c'),_0x524ee4[_0xb478('0xc')])})[_0xb478('0x14')](function(_0x278e1c){logger[_0xb478('0x9')](_0xb478('0x1d'));return _0x278e1c['user'];});}}function getEndUser(_0x474dda,_0x41ac9f,_0x273e9a){logger[_0xb478('0x9')]('Searching\x20enduser\x20with\x20phone',_0x273e9a);return request({'uri':util['format'](_0xb478('0x16'),_0x474dda[_0xb478('0xc')]),'qs':{'query':util[_0xb478('0xb')]('type:user\x20role:end-user\x20phone:%s',_0x273e9a)}})[_0xb478('0x14')](function(_0x723178){var _0x4b58f5;if(_0x723178[_0xb478('0x1a')]['length']){_0x723178['results']=_[_0xb478('0x1f')](_0x723178[_0xb478('0x1a')],{'suspended':![],'role':_0xb478('0x20')});if(_0x723178[_0xb478('0x1a')][_0xb478('0x21')]){_0x4b58f5=_['first'](_0x723178[_0xb478('0x1a')]);}}if(_0x4b58f5){logger[_0xb478('0x9')]('Enduser\x20found!');return _0x4b58f5;}else{logger[_0xb478('0x9')](_0xb478('0x22'));return request({'uri':util[_0xb478('0xb')](_0xb478('0x23'),_0x474dda[_0xb478('0xc')]),'method':_0xb478('0xd'),'body':{'user':{'role':_0xb478('0x20'),'name':util['format'](_0xb478('0x24'),_0x41ac9f||_0x273e9a),'phone':_0x273e9a}}})['then'](function(_0x2c3e2a){logger[_0xb478('0x9')](_0xb478('0x25'));return _0x2c3e2a[_0xb478('0x1e')];});}});}function getAuth(_0x4a4e96){var _0x507e43;if(_0x4a4e96[_0xb478('0x26')]===_0xb478('0x27')){_0x507e43=util['format'](_0xb478('0x28'),_0x4a4e96[_0xb478('0x29')],_0x4a4e96['password']);}else if(_0x4a4e96[_0xb478('0x26')]===_0xb478('0x2a')){_0x507e43=util[_0xb478('0xb')]('%s/token:%s',_0x4a4e96[_0xb478('0x29')],_0x4a4e96['token']);}return util['format'](_0xb478('0x2b'),new Buffer(_0x507e43)['toString'](_0xb478('0x2c')));}function request(_0x90a02d){logger[_0xb478('0x2d')]('[HTTP]',JSON[_0xb478('0x2e')](_0x90a02d));return rp(_['defaults'](_0x90a02d,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4d572f,_0x1e0477){var _0x55095a=[];if(_0x4d572f&&_0x4d572f['length']>0x0){_0x55095a=_[_0xb478('0x2f')](_0x4d572f,_0x1e0477);}return _0x55095a;}function getCustomFields(_0xec40e5,_0x2d9da9){var _0xb435d8=[];var _0x3f1342={'custom_fields':[]};if(_0xec40e5['length']>0x0){_[_0xb478('0x30')](_0xec40e5,function(_0x3840fa){if(_[_0xb478('0x31')](['string',_0xb478('0x32')],_0x3840fa['type'])&&_0x3840fa[_0xb478('0x33')]&&!_0x3840fa['customField']){_0x3f1342[_0x3840fa[_0xb478('0x33')]['toLowerCase']()]=_0x3840fa[_0xb478('0x34')][_0xb478('0x35')]();}else if(_[_0xb478('0x31')]([_0xb478('0x36'),'picklist'],_0x3840fa[_0xb478('0x37')])&&_0x3840fa['idField']&&_0x3840fa[_0xb478('0x38')]){_0x3f1342[_0xb478('0x39')][_0xb478('0x3a')]({'id':_0x3840fa[_0xb478('0x3b')],'value':_0x3840fa['content'][_0xb478('0x35')]()});}else if(_0x3840fa[_0xb478('0x37')]===_0xb478('0x3c')&&_0x3840fa[_0xb478('0x3d')]&&_0x3840fa[_0xb478('0x3b')]&&_0x3840fa[_0xb478('0x38')]){_0x2d9da9[_0x3840fa['variableName']]&&_0x3f1342[_0xb478('0x39')][_0xb478('0x3a')]({'id':_0x3840fa[_0xb478('0x3b')],'value':_0x2d9da9[_0x3840fa[_0xb478('0x3d')]]['toString']()});}else if(_0x3840fa[_0xb478('0x37')]===_0xb478('0x3e')&&_0x3840fa['Variable']&&_0x3840fa['Variable'][_0xb478('0x10')]&&_0x3840fa['idField']&&_0x3840fa[_0xb478('0x38')]){_0x2d9da9[_0x3840fa[_0xb478('0x3f')]['name']['toLowerCase']()]&&_0x3f1342['custom_fields']['push']({'id':_0x3840fa[_0xb478('0x3b')],'value':_0x2d9da9[_0x3840fa[_0xb478('0x3f')]['name'][_0xb478('0x40')]()][_0xb478('0x35')]()});}});}return _0x3f1342;}exports[_0xb478('0x41')]=function(_0x16c8ac,_0x3e7604,_0x38388a,_0x21b341,_0x1b74cd,_0x5aa111){var _0x5010e5,_0xf05cfb;_0x5aa111[_0xb478('0xc')]=intUtil['stripTrailingSlash'](_0x5aa111[_0xb478('0xc')]);_0x5aa111[_0xb478('0x42')]=intUtil[_0xb478('0x43')](_0x5aa111[_0xb478('0x42')]);if(_0x1b74cd&&_0x1b74cd['monitor_format']){logger[_0xb478('0x9')](_0xb478('0x44'),_0xb478('0x45'));_0x3e7604['recordingURL']=util[_0xb478('0xb')](_0xb478('0x46'),_0x5aa111[_0xb478('0x42')],_0x3e7604[_0xb478('0x47')],md5(_0x3e7604[_0xb478('0x47')]));}else{_0x3e7604[_0xb478('0x48')]='';}headers[_0xb478('0x49')]=getAuth(_0x5aa111);return getUser(_0x5aa111,_0x21b341[_0xb478('0x4a')])['then'](function(_0x24d111){_0x5010e5=_0x24d111;logger[_0xb478('0x9')]('The\x20User\x20ID\x20is:',_0x5010e5['id']);return getEndUser(_0x5aa111,_0x3e7604['calleridname'],_0x3e7604['calleridnum']);})[_0xb478('0x14')](function(_0x4caf8c){_0xf05cfb=_0x4caf8c;logger[_0xb478('0x9')]('The\x20Enduser\x20ID\x20is:',_0xf05cfb['id']);return getTicket(_0x5aa111,_0x5010e5,_0xf05cfb,_0x38388a,_0x3e7604);})['then'](function(_0x341dc8){if(_0x341dc8){logger[_0xb478('0x9')]('The\x20Ticket\x20ID\x20is:',_0x341dc8['id']);switch(_0x5aa111[_0xb478('0x37')]){case _0xb478('0x4b'):logger[_0xb478('0x9')](_0xb478('0x44'),_0xb478('0x4c'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x5aa111[_0xb478('0xc')],_0x5010e5['id'],_0x341dc8['id']),'method':_0xb478('0xd')});case _0xb478('0x4d'):logger['info'](_0xb478('0x44'),_0xb478('0x4e'));emit(util[_0xb478('0xb')]('user:%s',_0x21b341[_0xb478('0x10')]),_0xb478('0x4f'),{'uri':util[_0xb478('0xb')]('%s/agent/tickets/%s',_0x5aa111[_0xb478('0xc')][_0xb478('0x50')](_0xb478('0x51'),''),_0x341dc8['id'])});break;default:logger[_0xb478('0x52')](_0xb478('0x44'),_0xb478('0x53'));}}})[_0xb478('0x54')](function(_0x218dff){logger[_0xb478('0x52')](_0xb478('0x55'),util[_0xb478('0x56')](_0x218dff,{'showHidden':!![],'depth':null}));});};exports[_0xb478('0x57')]=function(_0x3da489,_0x5d8165,_0x706457,_0x510e6f,_0x338d94,_0x5083dc,_0x4d69bd){var _0xa6eb04,_0x55d179;_0x5083dc[_0xb478('0xc')]=intUtil[_0xb478('0x43')](_0x5083dc[_0xb478('0xc')]);_0x5083dc[_0xb478('0x42')]=intUtil['stripTrailingSlash'](_0x5083dc['serverUrl']);if(_0x4d69bd&&_0x4d69bd[_0xb478('0x58')]&&_0x4d69bd['recordingFormat']!==_0xb478('0x59')){logger[_0xb478('0x9')](_0xb478('0x5a'),_0xb478('0x45'));_0x5d8165[_0xb478('0x48')]=util[_0xb478('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5083dc[_0xb478('0x42')],_0x5d8165[_0xb478('0x47')],md5(_0x5d8165[_0xb478('0x47')]));}headers[_0xb478('0x49')]=getAuth(_0x5083dc);return getUser(_0x5083dc,_0x510e6f[_0xb478('0x4a')])['then'](function(_0x502323){_0xa6eb04=_0x502323;logger[_0xb478('0x9')](_0xb478('0x5b'),_0xa6eb04['id']);return getEndUser(_0x5083dc,_0x5d8165['destcalleridname'],_0x5d8165['destcalleridnum']);})['then'](function(_0x53511d){_0x55d179=_0x53511d;logger[_0xb478('0x9')](_0xb478('0x5c'),_0x55d179['id']);return getTicket(_0x5083dc,_0xa6eb04,_0x55d179,_0x706457,_0x5d8165);})[_0xb478('0x14')](function(_0x3e6f4b){if(_0x3e6f4b){logger[_0xb478('0x9')](_0xb478('0x5d'),_0x3e6f4b['id']);switch(_0x5083dc[_0xb478('0x37')]){case'integrationTab':logger[_0xb478('0x9')]('[OUTBOUND]',_0xb478('0x4c'));return request({'uri':util[_0xb478('0xb')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x5083dc[_0xb478('0xc')],_0xa6eb04['id'],_0x3e6f4b['id']),'method':_0xb478('0xd')});case _0xb478('0x4d'):logger['info'](_0xb478('0x5a'),_0xb478('0x4e'));emit(util[_0xb478('0xb')](_0xb478('0x5e'),_0x510e6f[_0xb478('0x10')]),_0xb478('0x4f'),{'uri':util['format'](_0xb478('0x5f'),_0x5083dc[_0xb478('0xc')][_0xb478('0x50')](_0xb478('0x51'),''),_0x3e6f4b['id'])});break;default:logger['error'](_0xb478('0x5a'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x104686){logger[_0xb478('0x52')](_0xb478('0x60'),util[_0xb478('0x56')](_0x104686,{'showHidden':!![],'depth':null}));});};exports[_0xb478('0x61')]=function(_0x1bd46d,_0xb228bb,_0x3f06e1,_0x44c74b,_0x40ed21,_0x730d05){var _0x237b28,_0x260abd;_0x730d05[_0xb478('0xc')]=intUtil[_0xb478('0x43')](_0x730d05['remoteUri']);_0x730d05['serverUrl']=intUtil['stripTrailingSlash'](_0x730d05[_0xb478('0x42')]);if(_0x40ed21&&_0x40ed21['monitor_format']){logger[_0xb478('0x9')]('['+_0xb228bb[_0xb478('0x62')][_0xb478('0x63')]()+']','Recording\x20is\x20enabled!');_0xb228bb['recordingURL']=util[_0xb478('0xb')](_0xb478('0x46'),_0x730d05['serverUrl'],_0xb228bb[_0xb478('0x47')],md5(_0xb228bb[_0xb478('0x47')]));}else{_0xb228bb[_0xb478('0x48')]='';}headers[_0xb478('0x49')]=getAuth(_0x730d05);return getUser(_0x730d05)[_0xb478('0x14')](function(_0x4e2393){_0x237b28=_0x4e2393;logger[_0xb478('0x9')](_0xb478('0x5b'),_0x237b28['id']);return getEndUser(_0x730d05,_0xb228bb[_0xb478('0x64')],_0xb228bb[_0xb478('0x65')]);})[_0xb478('0x14')](function(_0x3161a9){_0x260abd=_0x3161a9;logger[_0xb478('0x9')](_0xb478('0x5c'),_0x260abd['id']);return getTicket(_0x730d05,_0x237b28,_0x260abd,_0x3f06e1,_0xb228bb);})['then'](function(_0x41f81c){if(_0x41f81c){logger[_0xb478('0x9')]('The\x20Ticket\x20ID\x20is:',_0x41f81c['id']);}})[_0xb478('0x54')](function(_0x4a1d78){logger['error']('['+_0xb228bb[_0xb478('0x62')][_0xb478('0x63')]()+']'+_0xb478('0x66'),util[_0xb478('0x56')](_0x4a1d78,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x62f5=['POST','Tags','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','%s/search.json','remoteUri','count','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','nameField','toLowerCase','content','type','customField','push','idField','variableName','custom_fields','customVariable','Variable','name','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','[OUTBOUND]','Authorization','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','error','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','ioredis','./util','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x62f5,0x13f));var _0x562f=function(_0x41cb89,_0x7d86c){_0x41cb89=_0x41cb89-0x0;var _0x169ed2=_0x62f5[_0x41cb89];return _0x169ed2;};'use strict';var _=require(_0x562f('0x0'));var rp=require('request-promise');var md5=require(_0x562f('0x1'));var util=require('util');var Redis=require(_0x562f('0x2'));var intUtil=require(_0x562f('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x562f('0x4'));config[_0x562f('0x5')]=_[_0x562f('0x6')](config[_0x562f('0x5')],{'host':_0x562f('0x7'),'port':0x18eb});var io=require(_0x562f('0x8'))(new Redis(config[_0x562f('0x5')]));function emit(_0x300635,_0x5c9a8e,_0xc2aa70){io['to'](_0x300635)[_0x562f('0x9')](_0x5c9a8e,_0xc2aa70);}var headers={'Content-Type':'application/json','Accept':_0x562f('0xa')};function getTicket(_0x1984e7,_0x3742b3,_0x3e5b9d,_0x20984a,_0x45106f){logger[_0x562f('0xb')](_0x562f('0xc'));return request({'uri':util[_0x562f('0xd')]('%s/tickets.json',_0x1984e7['remoteUri']),'method':_0x562f('0xe'),'body':{'ticket':_['merge']({'requester_id':_0x3e5b9d['id'],'submitter_id':_0x3742b3?_0x3742b3['id']:undefined,'assignee_id':_0x3742b3?_0x3742b3['id']:undefined,'tags':getTags(_0x20984a[_0x562f('0xf')],'name'),'subject':intUtil[_0x562f('0x10')](_0x20984a[_0x562f('0x11')],_0x45106f,'\x20'),'description':intUtil[_0x562f('0x10')](_0x20984a[_0x562f('0x12')],_0x45106f,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x20984a[_0x562f('0x12')],_0x45106f,'\x0a')}},getCustomFields(_0x20984a[_0x562f('0x13')],_0x45106f))}})[_0x562f('0x14')](function(_0x5c0087){logger[_0x562f('0xb')](_0x562f('0x15'));return _0x5c0087[_0x562f('0x16')];});}function getUser(_0x2b5633,_0x450d96){if(intUtil['validateEmail'](_0x450d96)){logger[_0x562f('0xb')]('Getting\x20agent\x20with\x20email',_0x450d96);return request({'uri':util['format'](_0x562f('0x17'),_0x2b5633[_0x562f('0x18')]),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x450d96)}})[_0x562f('0x14')](function(_0x4c3b1c){if(_0x4c3b1c[_0x562f('0x19')]){logger[_0x562f('0xb')](_0x562f('0x1a'));return _[_0x562f('0x1b')](_0x4c3b1c[_0x562f('0x1c')],{'email':_0x450d96,'role':'agent'});}else{logger[_0x562f('0xb')](_0x562f('0x1d'));return request({'uri':util[_0x562f('0xd')](_0x562f('0x1e'),_0x2b5633[_0x562f('0x18')])})[_0x562f('0x14')](function(_0x2a4365){logger[_0x562f('0xb')](_0x562f('0x1f'));return _0x2a4365[_0x562f('0x20')];});}});}else{logger[_0x562f('0xb')](_0x562f('0x1d'));return request({'uri':util['format'](_0x562f('0x1e'),_0x2b5633[_0x562f('0x18')])})[_0x562f('0x14')](function(_0x3398d9){logger[_0x562f('0xb')](_0x562f('0x1f'));return _0x3398d9[_0x562f('0x20')];});}}function getEndUser(_0x230248,_0x5ecb46,_0x4241f9){logger[_0x562f('0xb')]('Searching\x20enduser\x20with\x20phone',_0x4241f9);return request({'uri':util[_0x562f('0xd')](_0x562f('0x17'),_0x230248[_0x562f('0x18')]),'qs':{'query':util[_0x562f('0xd')](_0x562f('0x21'),_0x4241f9)}})[_0x562f('0x14')](function(_0x15cab9){var _0x19da28;if(_0x15cab9[_0x562f('0x1c')][_0x562f('0x22')]){_0x15cab9['results']=_[_0x562f('0x23')](_0x15cab9[_0x562f('0x1c')],{'suspended':![],'role':_0x562f('0x24')});if(_0x15cab9['results'][_0x562f('0x22')]){_0x19da28=_[_0x562f('0x25')](_0x15cab9['results']);}}if(_0x19da28){logger['info'](_0x562f('0x26'));return _0x19da28;}else{logger[_0x562f('0xb')](_0x562f('0x27'));return request({'uri':util[_0x562f('0xd')](_0x562f('0x28'),_0x230248[_0x562f('0x18')]),'method':_0x562f('0xe'),'body':{'user':{'role':_0x562f('0x24'),'name':util['format'](_0x562f('0x29'),_0x5ecb46||_0x4241f9),'phone':_0x4241f9}}})[_0x562f('0x14')](function(_0x12792f){logger[_0x562f('0xb')]('Enduser\x20created.');return _0x12792f['user'];});}});}function getAuth(_0x496a2c){var _0x30e688;if(_0x496a2c[_0x562f('0x2a')]===_0x562f('0x2b')){_0x30e688=util[_0x562f('0xd')](_0x562f('0x2c'),_0x496a2c[_0x562f('0x2d')],_0x496a2c[_0x562f('0x2b')]);}else if(_0x496a2c[_0x562f('0x2a')]===_0x562f('0x2e')){_0x30e688=util[_0x562f('0xd')](_0x562f('0x2f'),_0x496a2c[_0x562f('0x2d')],_0x496a2c['token']);}return util[_0x562f('0xd')](_0x562f('0x30'),new Buffer(_0x30e688)[_0x562f('0x31')](_0x562f('0x32')));}function request(_0x4686d1){logger['debug'](_0x562f('0x33'),JSON[_0x562f('0x34')](_0x4686d1));return rp(_[_0x562f('0x6')](_0x4686d1,{'method':_0x562f('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x248337,_0x43a463){var _0x316dba=[];if(_0x248337&&_0x248337['length']>0x0){_0x316dba=_[_0x562f('0x36')](_0x248337,_0x43a463);}return _0x316dba;}function getCustomFields(_0x581b63,_0x48d156){var _0x31db03=[];var _0x4a6c2a={'custom_fields':[]};if(_0x581b63[_0x562f('0x22')]>0x0){_[_0x562f('0x37')](_0x581b63,function(_0xb989b4){if(_[_0x562f('0x38')]([_0x562f('0x39'),_0x562f('0x3a')],_0xb989b4['type'])&&_0xb989b4[_0x562f('0x3b')]&&!_0xb989b4['customField']){_0x4a6c2a[_0xb989b4[_0x562f('0x3b')][_0x562f('0x3c')]()]=_0xb989b4[_0x562f('0x3d')][_0x562f('0x31')]();}else if(_[_0x562f('0x38')]([_0x562f('0x39'),_0x562f('0x3a')],_0xb989b4[_0x562f('0x3e')])&&_0xb989b4['idField']&&_0xb989b4[_0x562f('0x3f')]){_0x4a6c2a['custom_fields'][_0x562f('0x40')]({'id':_0xb989b4[_0x562f('0x41')],'value':_0xb989b4[_0x562f('0x3d')][_0x562f('0x31')]()});}else if(_0xb989b4['type']==='variable'&&_0xb989b4[_0x562f('0x42')]&&_0xb989b4[_0x562f('0x41')]&&_0xb989b4[_0x562f('0x3f')]){_0x48d156[_0xb989b4[_0x562f('0x42')]]&&_0x4a6c2a[_0x562f('0x43')][_0x562f('0x40')]({'id':_0xb989b4[_0x562f('0x41')],'value':_0x48d156[_0xb989b4['variableName']][_0x562f('0x31')]()});}else if(_0xb989b4[_0x562f('0x3e')]===_0x562f('0x44')&&_0xb989b4[_0x562f('0x45')]&&_0xb989b4['Variable'][_0x562f('0x46')]&&_0xb989b4[_0x562f('0x41')]&&_0xb989b4[_0x562f('0x3f')]){_0x48d156[_0xb989b4[_0x562f('0x45')]['name'][_0x562f('0x3c')]()]&&_0x4a6c2a[_0x562f('0x43')][_0x562f('0x40')]({'id':_0xb989b4[_0x562f('0x41')],'value':_0x48d156[_0xb989b4[_0x562f('0x45')][_0x562f('0x46')][_0x562f('0x3c')]()][_0x562f('0x31')]()});}});}return _0x4a6c2a;}exports['queue']=function(_0x488d37,_0x2929b4,_0x54e738,_0x50a116,_0x32bc8d,_0x2ab97d){var _0x3a948c,_0x1fb985;_0x2ab97d[_0x562f('0x18')]=intUtil[_0x562f('0x47')](_0x2ab97d[_0x562f('0x18')]);_0x2ab97d[_0x562f('0x48')]=intUtil[_0x562f('0x47')](_0x2ab97d[_0x562f('0x48')]);if(_0x32bc8d&&_0x32bc8d[_0x562f('0x49')]){logger[_0x562f('0xb')](_0x562f('0x4a'),_0x562f('0x4b'));_0x2929b4[_0x562f('0x4c')]=util[_0x562f('0xd')](_0x562f('0x4d'),_0x2ab97d[_0x562f('0x48')],_0x2929b4[_0x562f('0x4e')],md5(_0x2929b4['uniqueid']));}else{_0x2929b4[_0x562f('0x4c')]='';}headers['Authorization']=getAuth(_0x2ab97d);return getUser(_0x2ab97d,_0x50a116[_0x562f('0x4f')])['then'](function(_0x329389){_0x3a948c=_0x329389;logger['info']('The\x20User\x20ID\x20is:',_0x3a948c['id']);return getEndUser(_0x2ab97d,_0x2929b4[_0x562f('0x50')],_0x2929b4[_0x562f('0x51')]);})[_0x562f('0x14')](function(_0x3316f5){_0x1fb985=_0x3316f5;logger[_0x562f('0xb')](_0x562f('0x52'),_0x1fb985['id']);return getTicket(_0x2ab97d,_0x3a948c,_0x1fb985,_0x54e738,_0x2929b4);})[_0x562f('0x14')](function(_0x255e7d){if(_0x255e7d){logger[_0x562f('0xb')](_0x562f('0x53'),_0x255e7d['id']);switch(_0x2ab97d[_0x562f('0x3e')]){case _0x562f('0x54'):logger['info'](_0x562f('0x4a'),_0x562f('0x55'));return request({'uri':util[_0x562f('0xd')](_0x562f('0x56'),_0x2ab97d[_0x562f('0x18')],_0x3a948c['id'],_0x255e7d['id']),'method':_0x562f('0xe')});case _0x562f('0x57'):logger[_0x562f('0xb')](_0x562f('0x4a'),_0x562f('0x58'));emit(util[_0x562f('0xd')](_0x562f('0x59'),_0x50a116[_0x562f('0x46')]),'trigger:browser:url',{'uri':util[_0x562f('0xd')](_0x562f('0x5a'),_0x2ab97d['remoteUri'][_0x562f('0x5b')](_0x562f('0x5c'),''),_0x255e7d['id'])});break;default:logger['error'](_0x562f('0x4a'),_0x562f('0x5d'));}}})[_0x562f('0x5e')](function(_0x55b714){logger['error'](_0x562f('0x5f'),util['inspect'](_0x55b714,{'showHidden':!![],'depth':null}));});};exports[_0x562f('0x60')]=function(_0x387712,_0x14d093,_0x1b8a6b,_0x50f278,_0x3054fb,_0xce818,_0x30c116){var _0x1fdd10,_0xcf7a9f;_0xce818[_0x562f('0x18')]=intUtil[_0x562f('0x47')](_0xce818[_0x562f('0x18')]);_0xce818['serverUrl']=intUtil[_0x562f('0x47')](_0xce818[_0x562f('0x48')]);if(_0x30c116&&_0x30c116['recordingFormat']&&_0x30c116[_0x562f('0x61')]!==_0x562f('0x62')){logger[_0x562f('0xb')](_0x562f('0x63'),_0x562f('0x4b'));_0x14d093['recordingURL']=util['format'](_0x562f('0x4d'),_0xce818[_0x562f('0x48')],_0x14d093['uniqueid'],md5(_0x14d093[_0x562f('0x4e')]));}headers[_0x562f('0x64')]=getAuth(_0xce818);return getUser(_0xce818,_0x50f278[_0x562f('0x4f')])[_0x562f('0x14')](function(_0x14fd09){_0x1fdd10=_0x14fd09;logger[_0x562f('0xb')](_0x562f('0x65'),_0x1fdd10['id']);return getEndUser(_0xce818,_0x14d093[_0x562f('0x66')],_0x14d093[_0x562f('0x67')]);})[_0x562f('0x14')](function(_0xdb3620){_0xcf7a9f=_0xdb3620;logger[_0x562f('0xb')](_0x562f('0x52'),_0xcf7a9f['id']);return getTicket(_0xce818,_0x1fdd10,_0xcf7a9f,_0x1b8a6b,_0x14d093);})[_0x562f('0x14')](function(_0x5afde6){if(_0x5afde6){logger[_0x562f('0xb')]('The\x20Ticket\x20ID\x20is:',_0x5afde6['id']);switch(_0xce818[_0x562f('0x3e')]){case'integrationTab':logger[_0x562f('0xb')](_0x562f('0x63'),_0x562f('0x55'));return request({'uri':util['format'](_0x562f('0x56'),_0xce818[_0x562f('0x18')],_0x1fdd10['id'],_0x5afde6['id']),'method':_0x562f('0xe')});case _0x562f('0x57'):logger[_0x562f('0xb')]('[OUTBOUND]',_0x562f('0x58'));emit(util[_0x562f('0xd')]('user:%s',_0x50f278[_0x562f('0x46')]),'trigger:browser:url',{'uri':util[_0x562f('0xd')]('%s/agent/tickets/%s',_0xce818[_0x562f('0x18')][_0x562f('0x5b')](_0x562f('0x5c'),''),_0x5afde6['id'])});break;default:logger[_0x562f('0x68')](_0x562f('0x63'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x562f('0x5e')](function(_0x452046){logger['error'](_0x562f('0x69'),util[_0x562f('0x6a')](_0x452046,{'showHidden':!![],'depth':null}));});};exports[_0x562f('0x6b')]=function(_0xaa0810,_0x272972,_0x11f2c8,_0x457ce7,_0x5eea1e,_0x5abe6d){var _0x9e90a9,_0x3a2c2e;_0x5abe6d['remoteUri']=intUtil['stripTrailingSlash'](_0x5abe6d['remoteUri']);_0x5abe6d['serverUrl']=intUtil[_0x562f('0x47')](_0x5abe6d[_0x562f('0x48')]);if(_0x5eea1e&&_0x5eea1e[_0x562f('0x49')]){logger[_0x562f('0xb')]('['+_0x272972[_0x562f('0x6c')][_0x562f('0x6d')]()+']',_0x562f('0x4b'));_0x272972[_0x562f('0x4c')]=util[_0x562f('0xd')](_0x562f('0x4d'),_0x5abe6d[_0x562f('0x48')],_0x272972['uniqueid'],md5(_0x272972['uniqueid']));}else{_0x272972[_0x562f('0x4c')]='';}headers[_0x562f('0x64')]=getAuth(_0x5abe6d);return getUser(_0x5abe6d)[_0x562f('0x14')](function(_0x2e64ab){_0x9e90a9=_0x2e64ab;logger[_0x562f('0xb')](_0x562f('0x65'),_0x9e90a9['id']);return getEndUser(_0x5abe6d,_0x272972[_0x562f('0x50')],_0x272972[_0x562f('0x51')]);})[_0x562f('0x14')](function(_0x5e22a9){_0x3a2c2e=_0x5e22a9;logger[_0x562f('0xb')](_0x562f('0x52'),_0x3a2c2e['id']);return getTicket(_0x5abe6d,_0x9e90a9,_0x3a2c2e,_0x11f2c8,_0x272972);})[_0x562f('0x14')](function(_0xe6d5d4){if(_0xe6d5d4){logger[_0x562f('0xb')](_0x562f('0x53'),_0xe6d5d4['id']);}})[_0x562f('0x5e')](function(_0x2959a6){logger['error']('['+_0x272972['lastevent'][_0x562f('0x6d')]()+']'+_0x562f('0x6e'),util[_0x562f('0x6a')](_0x2959a6,{'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 301ec89..c1f14e5 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 _0xe3f2=['clientId','clientSecret','refresh_token','then','add','catch','error','Failing\x20creating\x20the\x20access_token','info','GET','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','isArrayLikeObject','users','email','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Description','getString','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','format','answertime','endtime','utc','YYYY-MM-DDTHH:mm:ss','starttime','mm:ss','lastevent','called','Call_Result','Called','complete','connect','Rejected','abandoned','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','details','stack','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','none','[OUTBOUND]','zoho.eu','destcalleridname','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','unmanaged','calleridnum','toUpperCase','lodash','request-promise','md5','util','moment','ioredis','zoho','defaults','redis','localhost','socket.io-emitter','debug','[HTTP]','stringify','length','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','name','Variable','toLowerCase','indexOf','split','isNil','expires_in','access_token','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token'];(function(_0x138a81,_0x1e506e){var _0x857750=function(_0x272b2d){while(--_0x272b2d){_0x138a81['push'](_0x138a81['shift']());}};_0x857750(++_0x1e506e);}(_0xe3f2,0x101));var _0x2e3f=function(_0x5258f4,_0x5970d6){_0x5258f4=_0x5258f4-0x0;var _0x5ca2f7=_0xe3f2[_0x5258f4];return _0x5ca2f7;};'use strict';var _=require(_0x2e3f('0x0'));var rp=require(_0x2e3f('0x1'));var md5=require(_0x2e3f('0x2'));var util=require(_0x2e3f('0x3'));var intUtil=require('./util');var moment=require(_0x2e3f('0x4'));var Redis=require(_0x2e3f('0x5'));var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x2e3f('0x6'));config['redis']=_[_0x2e3f('0x7')](config[_0x2e3f('0x8')],{'host':_0x2e3f('0x9'),'port':0x18eb});var io=require(_0x2e3f('0xa'))(new Redis(config[_0x2e3f('0x8')]));function emit(_0x48ace0,_0x425d61,_0x17f75c){io['to'](_0x48ace0)['emit'](_0x425d61,_0x17f75c);}function request(_0x2ca1db){logger[_0x2e3f('0xb')](_0x2e3f('0xc'),JSON[_0x2e3f('0xd')](_0x2ca1db));return rp(_0x2ca1db);}function getCustomFields(_0x2e7854,_0xec779b){var _0x3ed5d2={};if(_0x2e7854[_0x2e3f('0xe')]>0x0){_[_0x2e3f('0xf')](_0x2e7854,function(_0x5b7d8e){if(_[_0x2e3f('0x10')]([_0x2e3f('0x11'),_0x2e3f('0x12')],_0x5b7d8e[_0x2e3f('0x13')])&&_0x5b7d8e[_0x2e3f('0x14')]){_0x3ed5d2[_0x5b7d8e[_0x2e3f('0x14')]]=_0x5b7d8e[_0x2e3f('0x15')][_0x2e3f('0x16')]();}else if(_0x5b7d8e['type']===_0x2e3f('0x17')&&_0x5b7d8e[_0x2e3f('0x18')]&&_0x5b7d8e[_0x2e3f('0x14')]&&_0xec779b[_0x5b7d8e[_0x2e3f('0x18')]]){_0x3ed5d2[_0x5b7d8e[_0x2e3f('0x14')]]=_0xec779b[_0x5b7d8e[_0x2e3f('0x18')]][_0x2e3f('0x16')]();}else if(_0x5b7d8e[_0x2e3f('0x13')]===_0x2e3f('0x19')&&_0x5b7d8e['Variable']&&_0x5b7d8e['Variable'][_0x2e3f('0x1a')]&&_0x5b7d8e[_0x2e3f('0x14')]&&_0xec779b[_0x5b7d8e[_0x2e3f('0x1b')][_0x2e3f('0x1a')]['toLowerCase']()]){_0x3ed5d2[_0x5b7d8e[_0x2e3f('0x14')]]=_0xec779b[_0x5b7d8e['Variable']['name'][_0x2e3f('0x1c')]()][_0x2e3f('0x16')]();}});}return _0x3ed5d2;}function getName(_0x10820c){if(_0x10820c[_0x2e3f('0x1d')]('\x20')>0x0){var _0x3f4961=_0x10820c[_0x2e3f('0x1e')](/ (.+)/);if(_0x3f4961[0x1]){return _0x3f4961;}}return[_0x10820c,_0x10820c];}var accountsTokens={};function getAccessToken(_0x2b79eb){return new Promise(function(_0x827424,_0x203d13){if(!_['isNil'](accountsTokens[_0x2b79eb['id']])&&!_[_0x2e3f('0x1f')](accountsTokens[_0x2b79eb['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x2b79eb['id']][_0x2e3f('0x20')])){_0x827424(accountsTokens[_0x2b79eb['id']][_0x2e3f('0x21')]);}}var _0x11015b;switch(_0x2b79eb['zone']){case'US':_0x11015b=_0x2e3f('0x22');break;case'AU':_0x11015b=_0x2e3f('0x23');break;case'EU':_0x11015b=_0x2e3f('0x24');break;case'IN':_0x11015b=_0x2e3f('0x25');break;case'CN':_0x11015b=_0x2e3f('0x26');break;default:_0x11015b=_0x2e3f('0x24');break;}var _0x59914a={'method':_0x2e3f('0x27'),'uri':_0x11015b+_0x2e3f('0x28'),'qs':{'refresh_token':_0x2b79eb['refreshToken'],'client_id':_0x2b79eb[_0x2e3f('0x29')],'client_secret':_0x2b79eb[_0x2e3f('0x2a')],'grant_type':_0x2e3f('0x2b')},'json':!![]};return rp(_0x59914a)[_0x2e3f('0x2c')](function(_0x81294e){accountsTokens[_0x2b79eb['id']]={'access_token':_0x81294e[_0x2e3f('0x21')],'expires_in':moment()[_0x2e3f('0x2d')](_0x81294e[_0x2e3f('0x20')],'seconds')};_0x827424(_0x81294e[_0x2e3f('0x21')]);})[_0x2e3f('0x2e')](function(_0x3bf27c){logger[_0x2e3f('0x2f')](_0x2e3f('0x30'),_0x3bf27c['stack']);_0x203d13(_0x3bf27c);});});}function getUser(_0x25f474,_0x3e8b48,_0x146e4c,_0x6f6de8){logger[_0x2e3f('0x31')]('Search\x20user');return request({'method':_0x2e3f('0x32'),'uri':util['format'](_0x2e3f('0x33'),_0x3e8b48),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x2e3f('0x34')+_0x25f474},'json':!![]})[_0x2e3f('0x2c')](function(_0xafeef2){if(_0xafeef2['users']){var _0x3e7575=-0x1;if(_[_0x2e3f('0x35')](_0xafeef2['users'])){if(!_['isNil'](_0x6f6de8)){_0x3e7575=_['findIndex'](_0xafeef2[_0x2e3f('0x36')],function(_0x4ca511){return _0x4ca511[_0x2e3f('0x37')]===_0x6f6de8;});}if(_0x3e7575>=0x0){logger[_0x2e3f('0x31')]('Agent\x20found!');}else{logger['info'](_0x2e3f('0x38'));_0x3e7575=_['findIndex'](_0xafeef2[_0x2e3f('0x36')],function(_0x1ea807){return _0x1ea807[_0x2e3f('0x39')]['name']===_0x2e3f('0x3a');});}return _0xafeef2[_0x2e3f('0x36')][_0x3e7575];}else{if(_0xafeef2[_0x2e3f('0x3b')][_0x2e3f('0x39')]['name']===_0x2e3f('0x3a')){logger[_0x2e3f('0x31')](_0x2e3f('0x38'));user=_0xafeef2['user'];return user;}else{logger[_0x2e3f('0x2f')]('The\x20failing\x20result\x20is',JSON[_0x2e3f('0xd')](_0xafeef2));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x2e3f('0xd')](_0xafeef2));}}}else{logger['error'](_0x2e3f('0x3c'),JSON['stringify'](_0xafeef2));throw new Error(_0x2e3f('0x3d')+JSON['stringify'](_0xafeef2));}})[_0x2e3f('0x2e')](function(_0x196308){console[_0x2e3f('0x2f')](_0x196308);});}function getZohoUser(_0x5ce303,_0x19c660){return new BPromise(function(_0x33b3fa,_0x3adfd5){request(_0x5ce303)[_0x2e3f('0x2c')](function(_0x3d4cb6){var _0x4d1ddc=null;if(_0x3d4cb6){_0x4d1ddc=_0x3d4cb6[_0x2e3f('0x3e')][0x0];_0x4d1ddc[_0x2e3f('0x3f')]=_0x19c660;}_0x33b3fa(_0x4d1ddc);})['catch'](function(_0x10476c){_0x3adfd5(_0x10476c);});});}function createEndUser(_0x3c14dc,_0x146145,_0x2db616,_0x5b7dff,_0x580131,_0x3dde80){var _0x2db616=getName(_0x2db616);return request({'method':_0x2e3f('0x27'),'uri':_0x2e3f('0x40')+_0x146145+_0x2e3f('0x41')+_[_0x2e3f('0x42')](_0x3dde80[_0x2e3f('0x43')])+'s','body':{'data':[{'Last_Name':_0x2db616[0x1],'First_Name':_0x2db616[0x0],'Phone':_0x5b7dff,'Owner':{'name':!_['isNil'](_0x580131[_0x2e3f('0x44')][_0x2e3f('0x1a')])?_0x580131[_0x2e3f('0x44')][_0x2e3f('0x1a')]:!_[_0x2e3f('0x1f')](_0x580131[_0x2e3f('0x45')])?_0x580131[_0x2e3f('0x45')]+'\x20'+_0x580131[_0x2e3f('0x46')]:_0x580131[_0x2e3f('0x46')],'id':_0x580131['id']}}]},'headers':{'Authorization':_0x2e3f('0x34')+_0x3c14dc},'json':!![]})['then'](function(_0x38e33d){if(_0x38e33d&&_0x38e33d[_0x2e3f('0x3e')][0x0][_0x2e3f('0x47')]==='SUCCESS'){var _0x13c31a=_0x38e33d[_0x2e3f('0x3e')][0x0]['details'];_0x13c31a[_0x2e3f('0x3f')]=_[_0x2e3f('0x42')](_0x3dde80[_0x2e3f('0x43')])+'s';return _0x13c31a;}logger['error'](_0x2e3f('0x3c'),JSON[_0x2e3f('0xd')](data));throw new Error('Error:\x20'+JSON[_0x2e3f('0xd')](data));})['catch'](function(_0x3611e0){console[_0x2e3f('0x48')](_0x2e3f('0x49'),_0x3611e0);});}function getEndUser(_0x306a0f,_0x52183f,_0x57a521,_0x3e1752,_0x69df1a,_0x3d41f0,_0x3e8a9c){var _0x53e88a={'method':_0x2e3f('0x32'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x306a0f},'json':!![]};switch(_0x3e8a9c[_0x2e3f('0x4a')]){case _0x2e3f('0x4b'):_0x53e88a[_0x2e3f('0x4c')]=_0x2e3f('0x40')+_0x52183f+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x69df1a+'))';return getZohoUser(_0x53e88a,_0x2e3f('0x4d'))['then'](function(_0x456f5c){if(_0x456f5c)return _0x456f5c;_0x53e88a['uri']=_0x2e3f('0x40')+_0x52183f+_0x2e3f('0x4e')+_0x69df1a+'))';return getZohoUser(_0x53e88a,_0x2e3f('0x4f'))[_0x2e3f('0x2c')](function(_0x37b561){if(_0x37b561)return _0x37b561;if(_0x3e8a9c['moduleCreate']!=_0x2e3f('0x50')){return createEndUser(_0x306a0f,_0x52183f,_0x3e1752,_0x69df1a,_0x3d41f0,_0x3e8a9c);}else{return{};}});});break;case _0x2e3f('0x51'):_0x53e88a[_0x2e3f('0x4c')]=_0x2e3f('0x40')+_0x52183f+_0x2e3f('0x52')+_0x69df1a+'))';return getZohoUser(_0x53e88a,_0x2e3f('0x4d'))[_0x2e3f('0x2c')](function(_0x3245d4){if(_0x3245d4)return _0x3245d4;if(_0x3e8a9c[_0x2e3f('0x43')]!=_0x2e3f('0x50')){return createEndUser(_0x306a0f,_0x52183f,_0x3e1752,_0x69df1a,_0x3d41f0,_0x3e8a9c);}else{return{};}});break;case'lead':_0x53e88a[_0x2e3f('0x4c')]=_0x2e3f('0x40')+_0x52183f+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x69df1a+'))';return getZohoUser(_0x53e88a,_0x2e3f('0x4f'))[_0x2e3f('0x2c')](function(_0x28c04b){if(_0x28c04b)return _0x28c04b;if(_0x3e8a9c['moduleCreate']!=_0x2e3f('0x50')){return createEndUser(_0x306a0f,_0x52183f,_0x3e1752,_0x69df1a,_0x3d41f0,_0x3e8a9c);}else{return{};}});break;}}function getCall(_0x2ecd8e,_0xb75e6b,_0x3c986b,_0x4446ab,_0x461fb9,_0x2db6a2,_0x32315e,_0x5d9b1c){logger[_0x2e3f('0x31')](_0x2e3f('0x53'));var _0x312340={};_0x312340[_0x2e3f('0x54')]={'name':!_[_0x2e3f('0x1f')](_0x4446ab['role'][_0x2e3f('0x1a')])&&!_[_0x2e3f('0x1f')](_0x4446ab[_0x2e3f('0x39')]['name'])&&_0x4446ab[_0x2e3f('0x39')][_0x2e3f('0x1a')]===_0x2e3f('0x55')?_0x4446ab[_0x2e3f('0x44')][_0x2e3f('0x1a')]:!_[_0x2e3f('0x1f')](_0x4446ab[_0x2e3f('0x45')])?_0x4446ab[_0x2e3f('0x45')]+'\x20'+_0x4446ab[_0x2e3f('0x46')]:_0x4446ab['last_name'],'id':_0x4446ab['id']};_0x312340['Subject']=intUtil['getString'](_0x2db6a2['Subjects'],_0x32315e,'\x20');_0x312340[_0x2e3f('0x56')]=intUtil[_0x2e3f('0x57')](_0x2db6a2['Descriptions'],_0x32315e,'\x0a');if(_0x461fb9[_0x2e3f('0x3f')]==='Contacts'){_0x312340[_0x2e3f('0x58')]={'name':!_[_0x2e3f('0x1f')](_0x461fb9[_0x2e3f('0x59')])?_0x461fb9['Full_Name']:!_[_0x2e3f('0x1f')](_0x461fb9[_0x2e3f('0x5a')])?_0x461fb9[_0x2e3f('0x5a')]+'\x20'+_0x461fb9[_0x2e3f('0x5b')]:_0x461fb9[_0x2e3f('0x5b')],'id':_0x461fb9['id']};}if(_0x461fb9['enduserType']==='Leads'){_0x312340[_0x2e3f('0x5c')]={'name':!_[_0x2e3f('0x1f')](_0x461fb9[_0x2e3f('0x59')])?_0x461fb9[_0x2e3f('0x59')]:!_['isNil'](_0x461fb9['First_Name'])?_0x461fb9['First_Name']+'\x20'+_0x461fb9[_0x2e3f('0x5b')]:_0x461fb9[_0x2e3f('0x5b')],'id':_0x461fb9['id']};_0x312340[_0x2e3f('0x5d')]=_[_0x2e3f('0x42')](_0x461fb9[_0x2e3f('0x3f')]);}if(_0x32315e['talktime']){_0x312340[_0x2e3f('0x5e')]=moment['utc'](parseInt(_0x32315e['talktime'])*0x3e8)[_0x2e3f('0x5f')]('mm:ss');}else if(_0x32315e[_0x2e3f('0x60')]&&_0x32315e[_0x2e3f('0x61')]){_0x312340[_0x2e3f('0x5e')]=moment[_0x2e3f('0x62')](moment(_0x32315e[_0x2e3f('0x61')],_0x2e3f('0x63'))['diff'](moment(_0x32315e[_0x2e3f('0x64')],'YYYY-MM-DDTHH:mm:ss')))[_0x2e3f('0x5f')](_0x2e3f('0x65'));}switch(_0x32315e[_0x2e3f('0x66')]){case _0x2e3f('0x67'):_0x312340[_0x2e3f('0x68')]=_0x2e3f('0x69');break;case _0x2e3f('0x6a'):case _0x2e3f('0x6b'):_0x312340[_0x2e3f('0x68')]='Answered';break;case'rejected':_0x312340[_0x2e3f('0x68')]=_0x2e3f('0x6c');break;case _0x2e3f('0x6d'):_0x312340[_0x2e3f('0x68')]='Abandoned';break;case'timeout':_0x312340[_0x2e3f('0x68')]=_0x2e3f('0x6e');default:}_0x312340[_0x2e3f('0x6f')]=(_0x5d9b1c===_0x2e3f('0x70')?moment(_0x32315e[_0x2e3f('0x64')])[_0x2e3f('0x5f')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x32315e['agentcalledAt'])['format'](_0x2e3f('0x63')))||moment()[_0x2e3f('0x5f')]('YYYY-MM-DDTHH:mm:ss');_0x312340[_0x2e3f('0x71')]=_0x5d9b1c||_0x2e3f('0x72');_0x312340=_[_0x2e3f('0x73')](_0x312340,getCustomFields(_0x2db6a2[_0x2e3f('0x74')],_0x32315e));return request({'method':_0x2e3f('0x27'),'uri':_0x2e3f('0x40')+_0xb75e6b+_0x2e3f('0x75'),'headers':{'Authorization':_0x2e3f('0x34')+_0x2ecd8e},'body':{'data':[_0x312340]},'json':!![]})[_0x2e3f('0x2c')](function(_0x3d7ddd){if(_0x3d7ddd&&_0x3d7ddd[_0x2e3f('0x3e')][0x0]['code']==='SUCCESS'){logger[_0x2e3f('0x31')](_0x2e3f('0x76'));return{'id':_0x3d7ddd['data'][0x0][_0x2e3f('0x77')]['id']};}})[_0x2e3f('0x2e')](function(_0x31aafc){logger[_0x2e3f('0x31')]('err',_0x31aafc[_0x2e3f('0x78')]);console[_0x2e3f('0x48')](_0x2e3f('0x79'),_0x31aafc);});}exports[_0x2e3f('0x7a')]=function(_0x7936c8,_0x57d6ac,_0x54a1bd,_0x202d47,_0x37ddb6,_0x38c05){var _0x281942,_0x378714,_0x5afee5;_0x38c05[_0x2e3f('0x7b')]=intUtil[_0x2e3f('0x7c')](_0x38c05[_0x2e3f('0x7b')]);_0x38c05[_0x2e3f('0x7d')]=intUtil[_0x2e3f('0x7c')](_0x38c05[_0x2e3f('0x7d')]);if(_0x37ddb6&&_0x37ddb6[_0x2e3f('0x7e')]){logger[_0x2e3f('0x31')]('[QUEUE]',_0x2e3f('0x7f'));_0x57d6ac[_0x2e3f('0x80')]=_0x38c05[_0x2e3f('0x7d')]+_0x2e3f('0x81')+_0x57d6ac[_0x2e3f('0x82')]+_0x2e3f('0x83')+md5(_0x57d6ac[_0x2e3f('0x82')]);}else{_0x57d6ac[_0x2e3f('0x80')]='';}var _0xddb7c1=_0x38c05['host']==='zoho.eu'?'eu':_0x2e3f('0x84');return getAccessToken(_0x38c05)['then'](function(_0x33622f){_0x5afee5=_0x33622f;return getUser(_0x5afee5,_0xddb7c1,_0x38c05,_0x202d47[_0x2e3f('0x37')]);})[_0x2e3f('0x2c')](function(_0x117b53){_0x281942=_0x117b53;logger[_0x2e3f('0x31')](_0x2e3f('0x85'),_0x281942['id']);return getEndUser(_0x5afee5,_0xddb7c1,_0x38c05,_0x57d6ac[_0x2e3f('0x86')],_0x57d6ac['calleridnum'],_0x281942,_0x54a1bd);})[_0x2e3f('0x2c')](function(_0x1d28fb){_0x378714=_0x1d28fb;return getCall(_0x5afee5,_0xddb7c1,_0x38c05,_0x281942,_0x378714,_0x54a1bd,_0x57d6ac,'Inbound');})[_0x2e3f('0x2c')](function(_0x1dafd3){if(_0x1dafd3){logger['info'](_0x2e3f('0x87'),_0x1dafd3['id']);logger[_0x2e3f('0x31')](_0x2e3f('0x88'),_0x2e3f('0x89'));emit(util['format']('user:%s',_0x202d47[_0x2e3f('0x1a')]),_0x2e3f('0x8a'),{'uri':'https://crm.'+_0x38c05['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x1dafd3['id']});}})[_0x2e3f('0x2e')](function(_0x23956d){logger[_0x2e3f('0x2f')](_0x2e3f('0x88'),JSON[_0x2e3f('0xd')](_0x23956d));});};exports[_0x2e3f('0x70')]=function(_0x4a6f72,_0x419975,_0x35a30b,_0x1cbdfa,_0x4b9090,_0x217b91,_0x13d894){var _0x3def61,_0xc36587,_0x1e993d;_0x217b91[_0x2e3f('0x7b')]=intUtil[_0x2e3f('0x7c')](_0x217b91[_0x2e3f('0x7b')]);_0x217b91['serverUrl']=intUtil[_0x2e3f('0x7c')](_0x217b91['serverUrl']);if(_0x13d894&&_0x13d894['recordingFormat']&&_0x13d894['recordingFormat']!==_0x2e3f('0x8b')){logger[_0x2e3f('0x31')](_0x2e3f('0x8c'),_0x2e3f('0x7f'));_0x419975[_0x2e3f('0x80')]=_0x217b91[_0x2e3f('0x7d')]+'/api/voice/recordings/'+_0x419975['uniqueid']+_0x2e3f('0x83')+md5(_0x419975['uniqueid']);}var _0x243315=_0x217b91[_0x2e3f('0x7b')]===_0x2e3f('0x8d')?'eu':'com';return getAccessToken(_0x217b91)[_0x2e3f('0x2c')](function(_0x25b8aa){_0x1e993d=_0x25b8aa;return getUser(_0x1e993d,_0x243315,_0x217b91,_0x1cbdfa[_0x2e3f('0x37')]);})[_0x2e3f('0x2c')](function(_0x5a1b5e){_0x3def61=_0x5a1b5e;logger[_0x2e3f('0x31')](_0x2e3f('0x85'),_0x3def61['id']);return getEndUser(_0x1e993d,_0x243315,_0x217b91,_0x419975[_0x2e3f('0x8e')],_0x419975['destcalleridnum'],_0x3def61,_0x35a30b);})['then'](function(_0x50a89d){_0xc36587=_0x50a89d;return getCall(_0x1e993d,_0x243315,_0x217b91,_0x3def61,_0xc36587,_0x35a30b,_0x419975,'Outbound');})['then'](function(_0x3f4fde){if(_0x3f4fde){logger[_0x2e3f('0x31')](_0x2e3f('0x87'),_0x3f4fde['id']);logger['info']('[OUTBOUND]',_0x2e3f('0x89'));emit(util[_0x2e3f('0x5f')](_0x2e3f('0x8f'),_0x1cbdfa[_0x2e3f('0x1a')]),_0x2e3f('0x8a'),{'uri':_0x2e3f('0x90')+_0x217b91[_0x2e3f('0x7b')]+_0x2e3f('0x91')+_0x3f4fde['id']});}})[_0x2e3f('0x2e')](function(_0x3b8b51){logger['error'](_0x2e3f('0x8c'),JSON[_0x2e3f('0xd')](_0x3b8b51));});};exports[_0x2e3f('0x92')]=function(_0x2d0437,_0x290a9d,_0x4bc383,_0x4828b1,_0xf0395d,_0x50d9fa){var _0x1a671e,_0x3d82c8,_0xe38754;_0x50d9fa['host']=intUtil[_0x2e3f('0x7c')](_0x50d9fa[_0x2e3f('0x7b')]);_0x50d9fa['serverUrl']=intUtil[_0x2e3f('0x7c')](_0x50d9fa[_0x2e3f('0x7d')]);if(_0xf0395d&&_0xf0395d['monitor_format']){logger[_0x2e3f('0x31')]('['+_0x290a9d[_0x2e3f('0x66')]['toUpperCase']()+']',_0x2e3f('0x7f'));_0x290a9d[_0x2e3f('0x80')]=_0x50d9fa[_0x2e3f('0x7d')]+_0x2e3f('0x81')+_0x290a9d[_0x2e3f('0x82')]+_0x2e3f('0x83')+md5(_0x290a9d['uniqueid']);}else{_0x290a9d[_0x2e3f('0x80')]='';}var _0x6b1917=_0x50d9fa['host']==='zoho.eu'?'eu':_0x2e3f('0x84');return getAccessToken(_0x50d9fa)['then'](function(_0x22e7e9){_0xe38754=_0x22e7e9;return getUser(_0xe38754,_0x6b1917,_0x50d9fa);})[_0x2e3f('0x2c')](function(_0x5b542f){_0x1a671e=_0x5b542f;logger[_0x2e3f('0x31')](_0x2e3f('0x85'),_0x1a671e['id']);return getEndUser(_0xe38754,_0x6b1917,_0x50d9fa,_0x290a9d[_0x2e3f('0x86')],_0x290a9d[_0x2e3f('0x93')],_0x1a671e,_0x4bc383);})[_0x2e3f('0x2c')](function(_0x2080f8){_0x3d82c8=_0x2080f8;return getCall(_0xe38754,_0x6b1917,_0x50d9fa,_0x1a671e,_0x3d82c8,_0x4bc383,_0x290a9d,'Inbound');})[_0x2e3f('0x2c')](function(_0x8aeaff){if(_0x8aeaff){logger[_0x2e3f('0x31')](_0x2e3f('0x87'),_0x8aeaff['id']);}})[_0x2e3f('0x2e')](function(_0x5cef24){logger[_0x2e3f('0x2f')]('['+_0x290a9d['lastevent'][_0x2e3f('0x94')]()+']',JSON['stringify'](_0x5cef24));});}; \ No newline at end of file +var _0x98ea=['complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','calleridname','calleridnum','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/downloads?type=uniqueid&token=','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://crm.','toUpperCase','lodash','request-promise','md5','util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','string','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','then','add','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','email','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','log','moduleSearch','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','Last_Name','What_Id','First_Name','$se_module','Call_Duration','utc','talktime','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','called','Call_Result'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x98ea,0x164));var _0xa98e=function(_0x1d3488,_0x5270ff){_0x1d3488=_0x1d3488-0x0;var _0x2a2316=_0x98ea[_0x1d3488];return _0x2a2316;};'use strict';var _=require(_0xa98e('0x0'));var rp=require(_0xa98e('0x1'));var md5=require(_0xa98e('0x2'));var util=require(_0xa98e('0x3'));var intUtil=require('./util');var moment=require(_0xa98e('0x4'));var Redis=require(_0xa98e('0x5'));var BPromise=require(_0xa98e('0x6'));var config=require(_0xa98e('0x7'));var logger=require(_0xa98e('0x8'))(_0xa98e('0x9'));config[_0xa98e('0xa')]=_[_0xa98e('0xb')](config[_0xa98e('0xa')],{'host':_0xa98e('0xc'),'port':0x18eb});var io=require(_0xa98e('0xd'))(new Redis(config[_0xa98e('0xa')]));function emit(_0xe99dec,_0x3d2e70,_0x5f5739){io['to'](_0xe99dec)[_0xa98e('0xe')](_0x3d2e70,_0x5f5739);}function request(_0x4cc87d){logger[_0xa98e('0xf')](_0xa98e('0x10'),JSON[_0xa98e('0x11')](_0x4cc87d));return rp(_0x4cc87d);}function getCustomFields(_0x15a499,_0x22b4f9){var _0x29f717={};if(_0x15a499[_0xa98e('0x12')]>0x0){_[_0xa98e('0x13')](_0x15a499,function(_0x592e45){if(_['includes']([_0xa98e('0x14'),'picklist'],_0x592e45[_0xa98e('0x15')])&&_0x592e45[_0xa98e('0x16')]){_0x29f717[_0x592e45['idField']]=_0x592e45[_0xa98e('0x17')][_0xa98e('0x18')]();}else if(_0x592e45['type']===_0xa98e('0x19')&&_0x592e45[_0xa98e('0x1a')]&&_0x592e45[_0xa98e('0x16')]&&_0x22b4f9[_0x592e45[_0xa98e('0x1a')]]){_0x29f717[_0x592e45[_0xa98e('0x16')]]=_0x22b4f9[_0x592e45[_0xa98e('0x1a')]]['toString']();}else if(_0x592e45[_0xa98e('0x15')]==='customVariable'&&_0x592e45[_0xa98e('0x1b')]&&_0x592e45[_0xa98e('0x1b')][_0xa98e('0x1c')]&&_0x592e45[_0xa98e('0x16')]&&_0x22b4f9[_0x592e45[_0xa98e('0x1b')][_0xa98e('0x1c')][_0xa98e('0x1d')]()]){_0x29f717[_0x592e45[_0xa98e('0x16')]]=_0x22b4f9[_0x592e45[_0xa98e('0x1b')][_0xa98e('0x1c')][_0xa98e('0x1d')]()][_0xa98e('0x18')]();}});}return _0x29f717;}function getName(_0xeb31a){if(_0xeb31a['indexOf']('\x20')>0x0){var _0x52e0da=_0xeb31a[_0xa98e('0x1e')](/ (.+)/);if(_0x52e0da[0x1]){return _0x52e0da;}}return[_0xeb31a,_0xeb31a];}var accountsTokens={};function getAccessToken(_0xd3c2f){return new Promise(function(_0x58a4e9,_0x4f47b9){if(!_[_0xa98e('0x1f')](accountsTokens[_0xd3c2f['id']])&&!_[_0xa98e('0x1f')](accountsTokens[_0xd3c2f['id']][_0xa98e('0x20')])){if(moment()['isBefore'](accountsTokens[_0xd3c2f['id']][_0xa98e('0x21')])){_0x58a4e9(accountsTokens[_0xd3c2f['id']][_0xa98e('0x20')]);}}var _0x314184;switch(_0xd3c2f[_0xa98e('0x22')]){case'US':_0x314184=_0xa98e('0x23');break;case'AU':_0x314184=_0xa98e('0x24');break;case'EU':_0x314184=_0xa98e('0x25');break;case'IN':_0x314184='https://accounts.zoho.in';break;case'CN':_0x314184='https://accounts.zoho.com.cn';break;default:_0x314184=_0xa98e('0x25');break;}var _0xd3c6f6={'method':_0xa98e('0x26'),'uri':_0x314184+_0xa98e('0x27'),'qs':{'refresh_token':_0xd3c2f[_0xa98e('0x28')],'client_id':_0xd3c2f['clientId'],'client_secret':_0xd3c2f[_0xa98e('0x29')],'grant_type':_0xa98e('0x2a')},'json':!![]};return rp(_0xd3c6f6)[_0xa98e('0x2b')](function(_0x15c1d0){accountsTokens[_0xd3c2f['id']]={'access_token':_0x15c1d0[_0xa98e('0x20')],'expires_in':moment()[_0xa98e('0x2c')](_0x15c1d0[_0xa98e('0x21')],'seconds')};_0x58a4e9(_0x15c1d0['access_token']);})[_0xa98e('0x2d')](function(_0x1b7d39){logger[_0xa98e('0x2e')](_0xa98e('0x2f'),_0x1b7d39[_0xa98e('0x30')]);_0x4f47b9(_0x1b7d39);});});}function getUser(_0x22e77b,_0x30736f,_0xb810ee,_0x33b872){logger[_0xa98e('0x31')]('Search\x20user');return request({'method':_0xa98e('0x32'),'uri':util[_0xa98e('0x33')](_0xa98e('0x34'),_0x30736f),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xa98e('0x35')+_0x22e77b},'json':!![]})[_0xa98e('0x2b')](function(_0x51f85f){if(_0x51f85f['users']){var _0x5d5e2c=-0x1;if(_[_0xa98e('0x36')](_0x51f85f[_0xa98e('0x37')])){if(!_[_0xa98e('0x1f')](_0x33b872)){_0x5d5e2c=_[_0xa98e('0x38')](_0x51f85f[_0xa98e('0x37')],function(_0x7b78ec){return _0x7b78ec[_0xa98e('0x39')]===_0x33b872;});}if(_0x5d5e2c>=0x0){logger['info']('Agent\x20found!');}else{logger[_0xa98e('0x31')](_0xa98e('0x3a'));_0x5d5e2c=_[_0xa98e('0x38')](_0x51f85f[_0xa98e('0x37')],function(_0x231724){return _0x231724[_0xa98e('0x3b')][_0xa98e('0x1c')]===_0xa98e('0x3c');});}return _0x51f85f['users'][_0x5d5e2c];}else{if(_0x51f85f[_0xa98e('0x3d')][_0xa98e('0x3b')][_0xa98e('0x1c')]==='Administrator'){logger[_0xa98e('0x31')]('Using\x20the\x20admin\x20account!');user=_0x51f85f[_0xa98e('0x3d')];return user;}else{logger[_0xa98e('0x2e')](_0xa98e('0x3e'),JSON[_0xa98e('0x11')](_0x51f85f));throw new Error(_0xa98e('0x3f')+JSON['stringify'](_0x51f85f));}}}else{logger[_0xa98e('0x2e')](_0xa98e('0x3e'),JSON[_0xa98e('0x11')](_0x51f85f));throw new Error(_0xa98e('0x3f')+JSON['stringify'](_0x51f85f));}})[_0xa98e('0x2d')](function(_0x5d7d59){console[_0xa98e('0x2e')](_0x5d7d59);});}function getZohoUser(_0xbae15c,_0x151b61){return new BPromise(function(_0x3c88e8,_0x401b82){request(_0xbae15c)[_0xa98e('0x2b')](function(_0x16a02e){var _0x336e96=null;if(_0x16a02e){_0x336e96=_0x16a02e[_0xa98e('0x40')][0x0];_0x336e96[_0xa98e('0x41')]=_0x151b61;}_0x3c88e8(_0x336e96);})[_0xa98e('0x2d')](function(_0x223fb5){_0x401b82(_0x223fb5);});});}function createEndUser(_0x2f07b5,_0x357890,_0xc32d3e,_0x2e374a,_0x5b84c3,_0x2e9897){var _0xc32d3e=getName(_0xc32d3e);return request({'method':_0xa98e('0x26'),'uri':_0xa98e('0x42')+_0x357890+_0xa98e('0x43')+_[_0xa98e('0x44')](_0x2e9897[_0xa98e('0x45')])+'s','body':{'data':[{'Last_Name':_0xc32d3e[0x1],'First_Name':_0xc32d3e[0x0],'Phone':_0x2e374a,'Owner':{'name':!_[_0xa98e('0x1f')](_0x5b84c3[_0xa98e('0x46')][_0xa98e('0x1c')])?_0x5b84c3[_0xa98e('0x46')][_0xa98e('0x1c')]:!_[_0xa98e('0x1f')](_0x5b84c3[_0xa98e('0x47')])?_0x5b84c3[_0xa98e('0x47')]+'\x20'+_0x5b84c3['last_name']:_0x5b84c3[_0xa98e('0x48')],'id':_0x5b84c3['id']}}]},'headers':{'Authorization':_0xa98e('0x35')+_0x2f07b5},'json':!![]})[_0xa98e('0x2b')](function(_0x4fc7fa){if(_0x4fc7fa&&_0x4fc7fa[_0xa98e('0x40')][0x0][_0xa98e('0x49')]===_0xa98e('0x4a')){var _0x3a78f1=_0x4fc7fa['data'][0x0][_0xa98e('0x4b')];_0x3a78f1[_0xa98e('0x41')]=_[_0xa98e('0x44')](_0x2e9897['moduleCreate'])+'s';return _0x3a78f1;}logger['error']('The\x20failing\x20result\x20is',JSON[_0xa98e('0x11')](data));throw new Error('Error:\x20'+JSON[_0xa98e('0x11')](data));})[_0xa98e('0x2d')](function(_0x3358bf){console[_0xa98e('0x4c')]('CREATE\x20ERROR',_0x3358bf);});}function getEndUser(_0x4f0b8e,_0x2a7013,_0x20ff5f,_0x275df6,_0x4dca3b,_0x939f9a,_0x3965d5){var _0xa6fb7b={'method':_0xa98e('0x32'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4f0b8e},'json':!![]};switch(_0x3965d5[_0xa98e('0x4d')]){case'contact_lead':_0xa6fb7b[_0xa98e('0x4e')]='https://www.zohoapis.'+_0x2a7013+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x4dca3b+'))';return getZohoUser(_0xa6fb7b,_0xa98e('0x4f'))[_0xa98e('0x2b')](function(_0x1c341d){if(_0x1c341d)return _0x1c341d;_0xa6fb7b[_0xa98e('0x4e')]=_0xa98e('0x42')+_0x2a7013+_0xa98e('0x50')+_0x4dca3b+'))';return getZohoUser(_0xa6fb7b,_0xa98e('0x51'))[_0xa98e('0x2b')](function(_0x1dede1){if(_0x1dede1)return _0x1dede1;if(_0x3965d5['moduleCreate']!=_0xa98e('0x52')){return createEndUser(_0x4f0b8e,_0x2a7013,_0x275df6,_0x4dca3b,_0x939f9a,_0x3965d5);}else{return{};}});});break;case _0xa98e('0x53'):_0xa6fb7b[_0xa98e('0x4e')]=_0xa98e('0x42')+_0x2a7013+_0xa98e('0x54')+_0x4dca3b+'))';return getZohoUser(_0xa6fb7b,_0xa98e('0x4f'))[_0xa98e('0x2b')](function(_0x78a84d){if(_0x78a84d)return _0x78a84d;if(_0x3965d5[_0xa98e('0x45')]!=_0xa98e('0x52')){return createEndUser(_0x4f0b8e,_0x2a7013,_0x275df6,_0x4dca3b,_0x939f9a,_0x3965d5);}else{return{};}});break;case'lead':_0xa6fb7b[_0xa98e('0x4e')]='https://www.zohoapis.'+_0x2a7013+_0xa98e('0x50')+_0x4dca3b+'))';return getZohoUser(_0xa6fb7b,_0xa98e('0x51'))[_0xa98e('0x2b')](function(_0x51545b){if(_0x51545b)return _0x51545b;if(_0x3965d5[_0xa98e('0x45')]!=_0xa98e('0x52')){return createEndUser(_0x4f0b8e,_0x2a7013,_0x275df6,_0x4dca3b,_0x939f9a,_0x3965d5);}else{return{};}});break;}}function getCall(_0x35f372,_0x227c53,_0x105993,_0x197c2f,_0x4e431c,_0x23e1d4,_0x37ee0e,_0x5eb268){logger['info'](_0xa98e('0x55'));var _0x2e0a5f={};_0x2e0a5f[_0xa98e('0x56')]={'name':!_[_0xa98e('0x1f')](_0x197c2f[_0xa98e('0x46')][_0xa98e('0x1c')])&&!_[_0xa98e('0x1f')](_0x197c2f[_0xa98e('0x3b')][_0xa98e('0x1c')])&&_0x197c2f['profile'][_0xa98e('0x1c')]===_0xa98e('0x57')?_0x197c2f['role'][_0xa98e('0x1c')]:!_[_0xa98e('0x1f')](_0x197c2f['first_name'])?_0x197c2f[_0xa98e('0x47')]+'\x20'+_0x197c2f[_0xa98e('0x48')]:_0x197c2f['last_name'],'id':_0x197c2f['id']};_0x2e0a5f['Subject']=intUtil[_0xa98e('0x58')](_0x23e1d4[_0xa98e('0x59')],_0x37ee0e,'\x20');_0x2e0a5f[_0xa98e('0x5a')]=intUtil[_0xa98e('0x58')](_0x23e1d4[_0xa98e('0x5b')],_0x37ee0e,'\x0a');if(_0x4e431c[_0xa98e('0x41')]===_0xa98e('0x4f')){_0x2e0a5f[_0xa98e('0x5c')]={'name':!_['isNil'](_0x4e431c[_0xa98e('0x5d')])?_0x4e431c['Full_Name']:!_[_0xa98e('0x1f')](_0x4e431c['First_Name'])?_0x4e431c['First_Name']+'\x20'+_0x4e431c[_0xa98e('0x5e')]:_0x4e431c[_0xa98e('0x5e')],'id':_0x4e431c['id']};}if(_0x4e431c[_0xa98e('0x41')]===_0xa98e('0x51')){_0x2e0a5f[_0xa98e('0x5f')]={'name':!_['isNil'](_0x4e431c['Full_Name'])?_0x4e431c[_0xa98e('0x5d')]:!_[_0xa98e('0x1f')](_0x4e431c[_0xa98e('0x60')])?_0x4e431c[_0xa98e('0x60')]+'\x20'+_0x4e431c[_0xa98e('0x5e')]:_0x4e431c[_0xa98e('0x5e')],'id':_0x4e431c['id']};_0x2e0a5f[_0xa98e('0x61')]=_['startCase'](_0x4e431c['enduserType']);}if(_0x37ee0e['talktime']){_0x2e0a5f[_0xa98e('0x62')]=moment[_0xa98e('0x63')](parseInt(_0x37ee0e[_0xa98e('0x64')])*0x3e8)[_0xa98e('0x33')](_0xa98e('0x65'));}else if(_0x37ee0e[_0xa98e('0x66')]&&_0x37ee0e['endtime']){_0x2e0a5f[_0xa98e('0x62')]=moment[_0xa98e('0x63')](moment(_0x37ee0e[_0xa98e('0x67')],_0xa98e('0x68'))['diff'](moment(_0x37ee0e[_0xa98e('0x69')],_0xa98e('0x68'))))[_0xa98e('0x33')](_0xa98e('0x65'));}switch(_0x37ee0e[_0xa98e('0x6a')]){case _0xa98e('0x6b'):_0x2e0a5f[_0xa98e('0x6c')]='Called';break;case _0xa98e('0x6d'):case _0xa98e('0x6e'):_0x2e0a5f[_0xa98e('0x6c')]=_0xa98e('0x6f');break;case _0xa98e('0x70'):_0x2e0a5f[_0xa98e('0x6c')]=_0xa98e('0x71');break;case _0xa98e('0x72'):_0x2e0a5f[_0xa98e('0x6c')]=_0xa98e('0x73');break;case _0xa98e('0x74'):_0x2e0a5f[_0xa98e('0x6c')]='Timeout';default:}_0x2e0a5f[_0xa98e('0x75')]=(_0x5eb268===_0xa98e('0x76')?moment(_0x37ee0e[_0xa98e('0x69')])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x37ee0e[_0xa98e('0x77')])[_0xa98e('0x33')](_0xa98e('0x68')))||moment()[_0xa98e('0x33')](_0xa98e('0x68'));_0x2e0a5f[_0xa98e('0x78')]=_0x5eb268||_0xa98e('0x79');_0x2e0a5f=_[_0xa98e('0x7a')](_0x2e0a5f,getCustomFields(_0x23e1d4[_0xa98e('0x7b')],_0x37ee0e));return request({'method':_0xa98e('0x26'),'uri':_0xa98e('0x42')+_0x227c53+'/crm/v2/Calls','headers':{'Authorization':_0xa98e('0x35')+_0x35f372},'body':{'data':[_0x2e0a5f]},'json':!![]})['then'](function(_0x29f3e8){if(_0x29f3e8&&_0x29f3e8[_0xa98e('0x40')][0x0][_0xa98e('0x49')]==='SUCCESS'){logger[_0xa98e('0x31')](_0xa98e('0x7c'));return{'id':_0x29f3e8[_0xa98e('0x40')][0x0][_0xa98e('0x4b')]['id']};}})[_0xa98e('0x2d')](function(_0x44bf87){logger[_0xa98e('0x31')](_0xa98e('0x7d'),_0x44bf87[_0xa98e('0x30')]);console['log'](_0xa98e('0x7d'),_0x44bf87);});}exports[_0xa98e('0x7e')]=function(_0x4d22e3,_0x57a1af,_0x4c76e2,_0x2897ca,_0x43903c,_0x694b14){var _0x3c043c,_0x205ca3,_0xe50d06;_0x694b14[_0xa98e('0x7f')]=intUtil['stripTrailingSlash'](_0x694b14[_0xa98e('0x7f')]);_0x694b14['serverUrl']=intUtil[_0xa98e('0x80')](_0x694b14[_0xa98e('0x81')]);if(_0x43903c&&_0x43903c[_0xa98e('0x82')]){logger[_0xa98e('0x31')](_0xa98e('0x83'),_0xa98e('0x84'));_0x57a1af[_0xa98e('0x85')]=_0x694b14[_0xa98e('0x81')]+_0xa98e('0x86')+_0x57a1af['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x57a1af[_0xa98e('0x87')]);}else{_0x57a1af[_0xa98e('0x85')]='';}var _0x3da49b=_0x694b14['host']===_0xa98e('0x88')?'eu':_0xa98e('0x89');return getAccessToken(_0x694b14)[_0xa98e('0x2b')](function(_0x3a62d8){_0xe50d06=_0x3a62d8;return getUser(_0xe50d06,_0x3da49b,_0x694b14,_0x2897ca[_0xa98e('0x39')]);})['then'](function(_0x28f2c4){_0x3c043c=_0x28f2c4;logger[_0xa98e('0x31')]('The\x20User\x20ID\x20is:',_0x3c043c['id']);return getEndUser(_0xe50d06,_0x3da49b,_0x694b14,_0x57a1af[_0xa98e('0x8a')],_0x57a1af[_0xa98e('0x8b')],_0x3c043c,_0x4c76e2);})[_0xa98e('0x2b')](function(_0xce5397){_0x205ca3=_0xce5397;return getCall(_0xe50d06,_0x3da49b,_0x694b14,_0x3c043c,_0x205ca3,_0x4c76e2,_0x57a1af,_0xa98e('0x79'));})[_0xa98e('0x2b')](function(_0x122e30){if(_0x122e30){logger[_0xa98e('0x31')](_0xa98e('0x8c'),_0x122e30['id']);logger[_0xa98e('0x31')](_0xa98e('0x83'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xa98e('0x33')](_0xa98e('0x8d'),_0x2897ca['name']),_0xa98e('0x8e'),{'uri':'https://crm.'+_0x694b14[_0xa98e('0x7f')]+_0xa98e('0x8f')+_0x122e30['id']});}})[_0xa98e('0x2d')](function(_0xa39d5a){logger['error']('[QUEUE]',JSON[_0xa98e('0x11')](_0xa39d5a));});};exports[_0xa98e('0x76')]=function(_0x5afb21,_0x379fad,_0x32de18,_0x10768a,_0x29c1ad,_0x421ce0,_0x211d31){var _0xa4dc2f,_0x3bc057,_0x2c110a;_0x421ce0[_0xa98e('0x7f')]=intUtil[_0xa98e('0x80')](_0x421ce0[_0xa98e('0x7f')]);_0x421ce0[_0xa98e('0x81')]=intUtil['stripTrailingSlash'](_0x421ce0[_0xa98e('0x81')]);if(_0x211d31&&_0x211d31[_0xa98e('0x90')]&&_0x211d31[_0xa98e('0x90')]!==_0xa98e('0x91')){logger[_0xa98e('0x31')](_0xa98e('0x92'),_0xa98e('0x84'));_0x379fad[_0xa98e('0x85')]=_0x421ce0[_0xa98e('0x81')]+_0xa98e('0x86')+_0x379fad['uniqueid']+_0xa98e('0x93')+md5(_0x379fad[_0xa98e('0x87')]);}var _0x1fd9ea=_0x421ce0[_0xa98e('0x7f')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x421ce0)['then'](function(_0xf56578){_0x2c110a=_0xf56578;return getUser(_0x2c110a,_0x1fd9ea,_0x421ce0,_0x10768a[_0xa98e('0x39')]);})[_0xa98e('0x2b')](function(_0x274956){_0xa4dc2f=_0x274956;logger['info'](_0xa98e('0x94'),_0xa4dc2f['id']);return getEndUser(_0x2c110a,_0x1fd9ea,_0x421ce0,_0x379fad[_0xa98e('0x95')],_0x379fad[_0xa98e('0x96')],_0xa4dc2f,_0x32de18);})[_0xa98e('0x2b')](function(_0x9a47b4){_0x3bc057=_0x9a47b4;return getCall(_0x2c110a,_0x1fd9ea,_0x421ce0,_0xa4dc2f,_0x3bc057,_0x32de18,_0x379fad,_0xa98e('0x97'));})[_0xa98e('0x2b')](function(_0x19a04e){if(_0x19a04e){logger[_0xa98e('0x31')](_0xa98e('0x8c'),_0x19a04e['id']);logger[_0xa98e('0x31')](_0xa98e('0x92'),_0xa98e('0x98'));emit(util[_0xa98e('0x33')](_0xa98e('0x8d'),_0x10768a[_0xa98e('0x1c')]),'trigger:browser:url',{'uri':_0xa98e('0x99')+_0x421ce0[_0xa98e('0x7f')]+_0xa98e('0x8f')+_0x19a04e['id']});}})['catch'](function(_0x188a79){logger['error'](_0xa98e('0x92'),JSON[_0xa98e('0x11')](_0x188a79));});};exports['unmanaged']=function(_0x5d7495,_0x46098b,_0x2f9025,_0x2bb128,_0x49bd9b,_0x2474b6){var _0x3cc1b7,_0x301a36,_0x4e1204;_0x2474b6[_0xa98e('0x7f')]=intUtil[_0xa98e('0x80')](_0x2474b6[_0xa98e('0x7f')]);_0x2474b6[_0xa98e('0x81')]=intUtil[_0xa98e('0x80')](_0x2474b6[_0xa98e('0x81')]);if(_0x49bd9b&&_0x49bd9b[_0xa98e('0x82')]){logger[_0xa98e('0x31')]('['+_0x46098b[_0xa98e('0x6a')][_0xa98e('0x9a')]()+']',_0xa98e('0x84'));_0x46098b[_0xa98e('0x85')]=_0x2474b6[_0xa98e('0x81')]+_0xa98e('0x86')+_0x46098b['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x46098b[_0xa98e('0x87')]);}else{_0x46098b[_0xa98e('0x85')]='';}var _0x5379ce=_0x2474b6['host']==='zoho.eu'?'eu':'com';return getAccessToken(_0x2474b6)[_0xa98e('0x2b')](function(_0x3addda){_0x4e1204=_0x3addda;return getUser(_0x4e1204,_0x5379ce,_0x2474b6);})[_0xa98e('0x2b')](function(_0x4eff57){_0x3cc1b7=_0x4eff57;logger['info'](_0xa98e('0x94'),_0x3cc1b7['id']);return getEndUser(_0x4e1204,_0x5379ce,_0x2474b6,_0x46098b[_0xa98e('0x8a')],_0x46098b[_0xa98e('0x8b')],_0x3cc1b7,_0x2f9025);})[_0xa98e('0x2b')](function(_0x3c6d70){_0x301a36=_0x3c6d70;return getCall(_0x4e1204,_0x5379ce,_0x2474b6,_0x3cc1b7,_0x301a36,_0x2f9025,_0x46098b,_0xa98e('0x79'));})[_0xa98e('0x2b')](function(_0x37b900){if(_0x37b900){logger[_0xa98e('0x31')](_0xa98e('0x8c'),_0x37b900['id']);}})[_0xa98e('0x2d')](function(_0x35538d){logger[_0xa98e('0x2e')]('['+_0x46098b[_0xa98e('0x6a')][_0xa98e('0x9a')]()+']',JSON[_0xa98e('0x11')](_0x35538d));});}; \ 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 e6b0e55..9094dde 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 _0xcb3c=['Script','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','trigger','exec','data2'];(function(_0x34ef44,_0x3c6c08){var _0x43044a=function(_0x31e296){while(--_0x31e296){_0x34ef44['push'](_0x34ef44['shift']());}};_0x43044a(++_0x3c6c08);}(_0xcb3c,0x1ba));var _0xccb3=function(_0x1602ef,_0x447aba){_0x1602ef=_0x1602ef-0x0;var _0x5870ee=_0xcb3c[_0x1602ef];return _0x5870ee;};'use strict';var util=require(_0xccb3('0x0'));var sh=require(_0xccb3('0x1'));var Mustache=require(_0xccb3('0x2'));var logger=require('../../../../config/logger')(_0xccb3('0x3'));exports[_0xccb3('0x4')]=function(_0x5cc4f8,_0x25df1c){var _0x1f682e=_0x5cc4f8[_0xccb3('0x5')]?_0x5cc4f8[_0xccb3('0x5')]:_0xccb3('0x6');var _0x50391a=_0x5cc4f8[_0xccb3('0x7')]?Mustache[_0xccb3('0x8')](_0x5cc4f8[_0xccb3('0x7')],_0x25df1c):_0x25df1c;sh['exec'](_0x50391a,function(_0x1eafc8,_0x52b488,_0xc6b54b){if(_0x1eafc8!==0x0){logger[_0xccb3('0x9')](util[_0xccb3('0xa')](_0xccb3('0xb'),_0x1f682e,_0x50391a,_0x1eafc8,_0xc6b54b));}else{logger[_0xccb3('0xc')](util[_0xccb3('0xa')](_0xccb3('0xd'),_0x1f682e,_0x50391a,_0x52b488));}});}; \ No newline at end of file +var _0x8881=['error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','exec','data2','Script','data3','render'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8881,0x8c));var _0x1888=function(_0x30c649,_0x2ebbac){_0x30c649=_0x30c649-0x0;var _0x3edfb9=_0x8881[_0x30c649];return _0x3edfb9;};'use strict';var util=require(_0x1888('0x0'));var sh=require(_0x1888('0x1'));var Mustache=require(_0x1888('0x2'));var logger=require(_0x1888('0x3'))(_0x1888('0x4'));exports[_0x1888('0x5')]=function(_0x5578cc,_0x5450b7){var _0x1d5e6b=_0x5578cc[_0x1888('0x6')]?_0x5578cc['data2']:_0x1888('0x7');var _0x89e75a=_0x5578cc[_0x1888('0x8')]?Mustache[_0x1888('0x9')](_0x5578cc['data3'],_0x5450b7):_0x5450b7;sh['exec'](_0x89e75a,function(_0x16de68,_0x4d8435,_0x2553a0){if(_0x16de68!==0x0){logger[_0x1888('0xa')](util[_0x1888('0xb')](_0x1888('0xc'),_0x1d5e6b,_0x89e75a,_0x16de68,_0x2553a0));}else{logger[_0x1888('0xd')](util[_0x1888('0xb')](_0x1888('0xe'),_0x1d5e6b,_0x89e75a,_0x4d8435));}});}; \ 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 5264add..73ae74b 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 _0x4432=['lodash','mustache','trigger','exec','toUpperCase','render','data2','data5','number','data6','parse','error','stack','data1','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','stringify','then',',\x20request\x20body:\x20','object','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','request-promise'];(function(_0x388e89,_0x21f300){var _0x4be2c7=function(_0xac8e84){while(--_0xac8e84){_0x388e89['push'](_0x388e89['shift']());}};_0x4be2c7(++_0x21f300);}(_0x4432,0x1d0));var _0x2443=function(_0x52b8a5,_0x1333cd){_0x52b8a5=_0x52b8a5-0x0;var _0x18c976=_0x4432[_0x52b8a5];return _0x18c976;};'use strict';var rp=require(_0x2443('0x0'));var util=require('util');var _=require(_0x2443('0x1'));var Mustache=require(_0x2443('0x2'));var logger=require('../../../../config/logger')(_0x2443('0x3'));exports[_0x2443('0x4')]=function(_0x4537eb,_0x9a3233){var _0x33c075,_0x38707c;var _0x55a019={'method':_0x4537eb['data1'][_0x2443('0x5')](),'uri':Mustache[_0x2443('0x6')](_0x4537eb[_0x2443('0x7')],_0x9a3233),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4537eb[_0x2443('0x8')])===_0x2443('0x9')&&parseInt(_0x4537eb['data5'])>=0x1&&parseInt(_0x4537eb['data5'])<=0xa?parseInt(_0x4537eb['data5'])*0x3e8:0x5*0x3e8};try{_0x55a019['headers']=_0x4537eb[_0x2443('0xa')]?JSON[_0x2443('0xb')](Mustache['render'](_0x4537eb['data6'],_0x9a3233)):{};}catch(_0x15058d){logger[_0x2443('0xc')](_0x15058d[_0x2443('0xd')]);}switch(_0x4537eb[_0x2443('0xe')][_0x2443('0x5')]()){case'GET':case _0x2443('0xf'):_0x33c075=null;_0x55a019['qs']=_0x9a3233;break;case _0x2443('0x10'):case _0x2443('0x11'):if(_0x4537eb['data7']){try{_0x33c075=JSON[_0x2443('0xb')](Mustache[_0x2443('0x6')](_0x4537eb[_0x2443('0x12')],_0x9a3233));_0x55a019[_0x2443('0x13')]=_0x33c075;}catch(_0x21ac08){logger['error'](_0x21ac08[_0x2443('0xd')]);logger['error'](_0x2443('0x14'));}}else{_0x33c075=_0x9a3233;_0x55a019[_0x2443('0x13')]=_0x33c075;}break;}logger[_0x2443('0x15')](util[_0x2443('0x16')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x4537eb[_0x2443('0xe')],_0x4537eb[_0x2443('0x7')],JSON[_0x2443('0x17')](_0x55a019)));rp(_0x55a019)[_0x2443('0x18')](function(_0x217a81){_0x33c075=!_['isNil'](_0x33c075)?_0x2443('0x19')+_0x33c075:'';_0x38707c=typeof _0x217a81[_0x2443('0x13')]===_0x2443('0x1a')?JSON[_0x2443('0x17')](_0x217a81[_0x2443('0x13')]):_0x217a81[_0x2443('0x13')];logger['info'](util['format']('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x4537eb[_0x2443('0xe')],_0x4537eb[_0x2443('0x7')],_0x217a81['statusCode'],_0x38707c));})[_0x2443('0x1b')](function(_0x5ba0c6){logger['error'](util[_0x2443('0x16')](_0x2443('0x1c'),_0x4537eb[_0x2443('0xe')],_0x4537eb[_0x2443('0x7')],_0x5ba0c6[_0x2443('0x1d')],_0x5ba0c6[_0x2443('0x1e')],_0x5ba0c6['message']));});}; \ No newline at end of file +var _0x06e8=['info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','isNil','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','message','request-promise','lodash','mustache','../../../../config/logger','exec','data1','toUpperCase','number','data5','headers','data6','parse','render','error','stack','GET','DELETE','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x06e8,0x161));var _0x806e=function(_0x1660e7,_0x39e06f){_0x1660e7=_0x1660e7-0x0;var _0x33a406=_0x06e8[_0x1660e7];return _0x33a406;};'use strict';var rp=require(_0x806e('0x0'));var util=require('util');var _=require(_0x806e('0x1'));var Mustache=require(_0x806e('0x2'));var logger=require(_0x806e('0x3'))('trigger');exports[_0x806e('0x4')]=function(_0x4f503f,_0x5363e5){var _0xc9cc06,_0xdafe42;var _0x286bf0={'method':_0x4f503f[_0x806e('0x5')][_0x806e('0x6')](),'uri':Mustache['render'](_0x4f503f['data2'],_0x5363e5),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4f503f['data5'])===_0x806e('0x7')&&parseInt(_0x4f503f[_0x806e('0x8')])>=0x1&&parseInt(_0x4f503f[_0x806e('0x8')])<=0xa?parseInt(_0x4f503f['data5'])*0x3e8:0x5*0x3e8};try{_0x286bf0[_0x806e('0x9')]=_0x4f503f[_0x806e('0xa')]?JSON[_0x806e('0xb')](Mustache[_0x806e('0xc')](_0x4f503f[_0x806e('0xa')],_0x5363e5)):{};}catch(_0x2ae075){logger[_0x806e('0xd')](_0x2ae075[_0x806e('0xe')]);}switch(_0x4f503f[_0x806e('0x5')][_0x806e('0x6')]()){case _0x806e('0xf'):case _0x806e('0x10'):_0xc9cc06=null;_0x286bf0['qs']=_0x5363e5;break;case'POST':case _0x806e('0x11'):if(_0x4f503f[_0x806e('0x12')]){try{_0xc9cc06=JSON[_0x806e('0xb')](Mustache[_0x806e('0xc')](_0x4f503f[_0x806e('0x12')],_0x5363e5));_0x286bf0[_0x806e('0x13')]=_0xc9cc06;}catch(_0x452eec){logger[_0x806e('0xd')](_0x452eec[_0x806e('0xe')]);logger[_0x806e('0xd')](_0x806e('0x14'));}}else{_0xc9cc06=_0x5363e5;_0x286bf0[_0x806e('0x13')]=_0xc9cc06;}break;}logger[_0x806e('0x15')](util[_0x806e('0x16')](_0x806e('0x17'),_0x4f503f[_0x806e('0x5')],_0x4f503f[_0x806e('0x18')],JSON[_0x806e('0x19')](_0x286bf0)));rp(_0x286bf0)['then'](function(_0x2681c5){_0xc9cc06=!_[_0x806e('0x1a')](_0xc9cc06)?',\x20request\x20body:\x20'+_0xc9cc06:'';_0xdafe42=typeof _0x2681c5[_0x806e('0x13')]===_0x806e('0x1b')?JSON[_0x806e('0x19')](_0x2681c5[_0x806e('0x13')]):_0x2681c5[_0x806e('0x13')];logger['info'](util[_0x806e('0x16')](_0x806e('0x1c'),_0x4f503f[_0x806e('0x5')],_0x4f503f[_0x806e('0x18')],_0x2681c5['statusCode'],_0xdafe42));})[_0x806e('0x1d')](function(_0x49d192){logger[_0x806e('0xd')](util[_0x806e('0x16')](_0x806e('0x1e'),_0x4f503f[_0x806e('0x5')],_0x4f503f[_0x806e('0x18')],_0x49d192[_0x806e('0x1f')],_0x49d192[_0x806e('0x20')],_0x49d192[_0x806e('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index c8bc13c..27f53ff 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 _0x53e7=['bluebird','routing','http','Request','request','then','debug','error','message','result','catch','exports','jayson/promise'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x53e7,0xc2));var _0x753e=function(_0x7b484,_0x195ad4){_0x7b484=_0x7b484-0x0;var _0x2ae1cf=_0x53e7[_0x7b484];return _0x2ae1cf;};'use strict';var jayson=require(_0x753e('0x0'));var BPromise=require(_0x753e('0x1'));var logger=require('../../config/logger')(_0x753e('0x2'));var client=jayson['client'][_0x753e('0x3')]({'port':0x2329});client[_0x753e('0x4')]=function(_0x5e6b4d,_0xf23a07){return new BPromise(function(_0x5c9847,_0x27f149){return client[_0x753e('0x5')](_0x5e6b4d,_0xf23a07)[_0x753e('0x6')](function(_0x406deb){logger[_0x753e('0x7')]('rpc',_0x753e('0x2'),_0x5e6b4d,_0xf23a07,_0x406deb);if(_0x406deb[_0x753e('0x8')]){logger[_0x753e('0x8')]('rpc',_0x753e('0x2'),_0x5e6b4d,_0x406deb[_0x753e('0x8')]['message'],_0xf23a07);return _0x27f149(_0x406deb[_0x753e('0x8')][_0x753e('0x9')]);}else{return _0x5c9847(_0x406deb[_0x753e('0xa')]);}})[_0x753e('0xb')](function(_0x5a98ff){logger['error']('rpc',_0x753e('0x2'),_0x5e6b4d,_0x5a98ff,_0xf23a07);return _0x27f149(_0x5a98ff);});});};module[_0x753e('0xc')]=client; \ No newline at end of file +var _0x77af=['message','result','exports','bluebird','routing','http','Request','request','then','debug','rpc','error'];(function(_0x100e36,_0x4da225){var _0x1df0c9=function(_0xe4b84f){while(--_0xe4b84f){_0x100e36['push'](_0x100e36['shift']());}};_0x1df0c9(++_0x4da225);}(_0x77af,0x15f));var _0xf77a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x77af[_0x4b369d];return _0x571a98;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xf77a('0x0'));var logger=require('../../config/logger')(_0xf77a('0x1'));var client=jayson['client'][_0xf77a('0x2')]({'port':0x2329});client[_0xf77a('0x3')]=function(_0x493f41,_0x308d77){return new BPromise(function(_0x19c2c9,_0x209509){return client[_0xf77a('0x4')](_0x493f41,_0x308d77)[_0xf77a('0x5')](function(_0x5d506d){logger[_0xf77a('0x6')](_0xf77a('0x7'),_0xf77a('0x1'),_0x493f41,_0x308d77,_0x5d506d);if(_0x5d506d['error']){logger['error'](_0xf77a('0x7'),_0xf77a('0x1'),_0x493f41,_0x5d506d[_0xf77a('0x8')][_0xf77a('0x9')],_0x308d77);return _0x209509(_0x5d506d[_0xf77a('0x8')][_0xf77a('0x9')]);}else{return _0x19c2c9(_0x5d506d[_0xf77a('0xa')]);}})['catch'](function(_0x1aca2c){logger['error'](_0xf77a('0x7'),_0xf77a('0x1'),_0x493f41,_0x1aca2c,_0x308d77);return _0x209509(_0x1aca2c);});});};module[_0xf77a('0xb')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index ad70c69..47ff8e9 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 _0x77ed=['listen','getSettings','loginMailFrequency','log','bluebird','./server','./lib/email','./rpc/mailAccount','./rpc/setting','then','getMailAccounts','initMailAccounts','refresh','mailAccounts'];(function(_0x54c60f,_0x2b6144){var _0xb1db44=function(_0x3b3741){while(--_0x3b3741){_0x54c60f['push'](_0x54c60f['shift']());}};_0xb1db44(++_0x2b6144);}(_0x77ed,0x11c));var _0xd77e=function(_0x1342fc,_0xbdaae3){_0x1342fc=_0x1342fc-0x0;var _0x568486=_0x77ed[_0x1342fc];return _0x568486;};'use strict';var BPromise=require(_0xd77e('0x0'));var server=require(_0xd77e('0x1'));var Realtime=require('./realtime');var EmailChannel=require(_0xd77e('0x2'));var mailAccount=require(_0xd77e('0x3'));var setting=require(_0xd77e('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise['resolve']()[_0xd77e('0x5')](mailAccount[_0xd77e('0x6')]())[_0xd77e('0x5')](realtime[_0xd77e('0x7')]())[_0xd77e('0x5')](function(){email[_0xd77e('0x8')](realtime[_0xd77e('0x9')]);return realtime;});}function main(){return server[_0xd77e('0xa')](realtime,email)['then'](function(){return initRealtime();})[_0xd77e('0x5')](function(){return setting[_0xd77e('0xb')]();})[_0xd77e('0x5')](function(_0x2577b5){return setInterval(initRealtime,_0x2577b5[_0xd77e('0xc')]*0x3e8);})['catch'](function(_0x4bfb90){console[_0xd77e('0xd')](_0x4bfb90);});}main(); \ No newline at end of file +var _0xd4d2=['listen','getSettings','catch','log','bluebird','./server','./realtime','./lib/email','./rpc/setting','resolve','then','getMailAccounts','initMailAccounts','mailAccounts'];(function(_0x29d623,_0x1a5c9c){var _0x242e59=function(_0x2c78ab){while(--_0x2c78ab){_0x29d623['push'](_0x29d623['shift']());}};_0x242e59(++_0x1a5c9c);}(_0xd4d2,0x154));var _0x2d4d=function(_0x296557,_0xd13ed){_0x296557=_0x296557-0x0;var _0xe61f31=_0xd4d2[_0x296557];return _0xe61f31;};'use strict';var BPromise=require(_0x2d4d('0x0'));var server=require(_0x2d4d('0x1'));var Realtime=require(_0x2d4d('0x2'));var EmailChannel=require(_0x2d4d('0x3'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x2d4d('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x2d4d('0x5')]()[_0x2d4d('0x6')](mailAccount[_0x2d4d('0x7')]())[_0x2d4d('0x6')](realtime[_0x2d4d('0x8')]())[_0x2d4d('0x6')](function(){email['refresh'](realtime[_0x2d4d('0x9')]);return realtime;});}function main(){return server[_0x2d4d('0xa')](realtime,email)[_0x2d4d('0x6')](function(){return initRealtime();})[_0x2d4d('0x6')](function(){return setting[_0x2d4d('0xb')]();})[_0x2d4d('0x6')](function(_0x463f18){return setInterval(initRealtime,_0x463f18['loginMailFrequency']*0x3e8);})[_0x2d4d('0xc')](function(_0xafaa33){console[_0x2d4d('0xd')](_0xafaa33);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index de7020c..e239a5f 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 _0x540e=['mailAccounts','smtp','prototype','name','key','active','Imap','status','messageStatus','total','stringify','emit','refresh','hasOwnProperty','imapAccounts','box','handleImapBox','handleImapEmail','bind','handleImapError','isNil','disabled','connected','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','from','then','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','sendMail','send','verifySmtp','Smtp','lastSync','verify','verified','lodash','md5','../../../config/environment','../../../config/logger','email','redis','defaults','./imap','./smtp'];(function(_0x21b359,_0x4dc80e){var _0x57b8e7=function(_0x135adb){while(--_0x135adb){_0x21b359['push'](_0x21b359['shift']());}};_0x57b8e7(++_0x4dc80e);}(_0x540e,0x11d));var _0xe540=function(_0x156c55,_0x10b85c){_0x156c55=_0x156c55-0x0;var _0x5e476f=_0x540e[_0x156c55];return _0x5e476f;};'use strict';var _=require(_0xe540('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0xe540('0x1'));var Redis=require('ioredis');var config=require(_0xe540('0x2'));var logger=require(_0xe540('0x3'))(_0xe540('0x4'));config[_0xe540('0x5')]=_[_0xe540('0x6')](config[_0xe540('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var EmailImap=require(_0xe540('0x7'));var EmailSmtp=require(_0xe540('0x8'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x4de34a){logger['info']('start\x20email\x20channel');this[_0xe540('0x9')]=_0x4de34a['mailAccounts'];this['imapAccounts']={};this[_0xe540('0xa')]=new EmailSmtp();}EmailChannel[_0xe540('0xb')]['emit']=function(_0x116c20){var _0x1f5b76=this['mailAccounts'][_0x116c20];var _0x572f73={'id':_0x1f5b76['id'],'name':_0x1f5b76[_0xe540('0xc')],'key':_0x1f5b76[_0xe540('0xd')],'active':_0x1f5b76[_0xe540('0xe')],'Imap':{'status':_0x1f5b76[_0xe540('0xf')][_0xe540('0x10')],'messageStatus':_0x1f5b76[_0xe540('0xf')][_0xe540('0x11')],'total':_0x1f5b76['Imap'][_0xe540('0x12')]}};if(_['isNil'](md5Accounts[_0x116c20])){md5Accounts[_0x116c20]={};}var _0x3a1f16=md5(JSON[_0xe540('0x13')](_0x572f73));if(md5Accounts[_0x116c20][_0xe540('0x1')]!==_0x3a1f16){md5Accounts[_0x116c20][_0xe540('0x1')]=_0x3a1f16;io[_0xe540('0x14')]('mailAccount:update',_0x572f73);}};EmailChannel[_0xe540('0xb')][_0xe540('0x15')]=function(_0x2db82c){for(var _0x174b4f in _0x2db82c){if(_0x2db82c[_0xe540('0x16')](_0x174b4f)){if(_0x2db82c[_0x174b4f][_0xe540('0xf')]&&_0x2db82c[_0x174b4f]['active']){var _0x1c4396=_0x2db82c[_0x174b4f][_0xe540('0xf')];if(!this[_0xe540('0x17')][_0xe540('0x16')](_0x1c4396['id'])){this[_0xe540('0x17')][_0x1c4396['id']]=new EmailImap(_0x1c4396,_0x2db82c[_0x174b4f][_0xe540('0x4')]);this[_0xe540('0x17')][_0x1c4396['id']]['on'](_0xe540('0x18'),this[_0xe540('0x19')]['bind'](this,_0x174b4f));this[_0xe540('0x17')][_0x1c4396['id']]['on'](_0xe540('0x4'),this[_0xe540('0x1a')][_0xe540('0x1b')](this,_0x174b4f));this[_0xe540('0x17')][_0x1c4396['id']]['on']('end',this['handleImapEnd'][_0xe540('0x1b')](this,_0x174b4f));this[_0xe540('0x17')][_0x1c4396['id']]['on']('error',this[_0xe540('0x1c')][_0xe540('0x1b')](this,_0x174b4f));}}else{if(_[_0xe540('0x1d')](this['mailAccounts'][_0x174b4f][_0xe540('0xf')])){this[_0xe540('0x9')][_0x174b4f][_0xe540('0xf')]={};}this[_0xe540('0x9')][_0x174b4f]['Imap'][_0xe540('0x10')]=_0xe540('0x1e');this[_0xe540('0x9')][_0x174b4f][_0xe540('0xf')][_0xe540('0x11')]='';this[_0xe540('0x14')](_0x174b4f);}}}};EmailChannel[_0xe540('0xb')][_0xe540('0x19')]=function(_0x2a45fe,_0x13f1ec){if(this[_0xe540('0x9')][_0x2a45fe]){this['mailAccounts'][_0x2a45fe][_0xe540('0xf')]['status']=_0xe540('0x1f');this[_0xe540('0x9')][_0x2a45fe][_0xe540('0xf')]['messageStatus']=_0x13f1ec[_0xe540('0xc')];if(_0x13f1ec['messages']){this['mailAccounts'][_0x2a45fe][_0xe540('0xf')][_0xe540('0x12')]=_0x13f1ec[_0xe540('0x20')]['total'];}return this[_0xe540('0x14')](_0x2a45fe);}};EmailChannel[_0xe540('0xb')][_0xe540('0x1a')]=function(_0x778c98,_0xe5338b){logger[_0xe540('0x21')](_0xe540('0x22'),_0xe5338b['firstName'],_0xe5338b['lastName'],_0xe5338b[_0xe540('0x23')],_0x778c98);if(this[_0xe540('0x9')][_0x778c98]){return mailAccount['notify'](_0x778c98,_0xe5338b)[_0xe540('0x24')](function(_0x177678){if(_0x177678){logger[_0xe540('0x21')](_0xe540('0x25'));}})[_0xe540('0x26')](function(_0x31c568){logger[_0xe540('0x27')](_0xe540('0x28'),JSON[_0xe540('0x13')](_0x31c568));});}};EmailChannel['prototype'][_0xe540('0x29')]=function(_0x2d2926){if(this[_0xe540('0x9')][_0x2d2926]&&this[_0xe540('0x9')][_0x2d2926][_0xe540('0xf')]){if(this['imapAccounts'][this[_0xe540('0x9')][_0x2d2926]['Imap']['id']]){delete this[_0xe540('0x17')][this[_0xe540('0x9')][_0x2d2926][_0xe540('0xf')]['id']];}this[_0xe540('0x9')][_0x2d2926][_0xe540('0xf')]['lastSync']=moment();this[_0xe540('0x14')](_0x2d2926);}};EmailChannel[_0xe540('0xb')][_0xe540('0x1c')]=function(_0x392e2b,_0x3ad6b8){if(this[_0xe540('0x9')][_0x392e2b]){this[_0xe540('0x9')][_0x392e2b][_0xe540('0xf')][_0xe540('0x10')]=_0xe540('0x27');this[_0xe540('0x9')][_0x392e2b][_0xe540('0xf')]['messageStatus']=_0x3ad6b8;return this['emit'](_0x392e2b);}};EmailChannel[_0xe540('0xb')][_0xe540('0x2a')]=function(_0x435c70,_0x500ddf){return this['smtp'][_0xe540('0x2b')](_0x435c70,_0x500ddf);};EmailChannel['prototype'][_0xe540('0x2c')]=function(_0x4767d6){var _0x483d1e=this;if(this[_0xe540('0x9')][_0x4767d6['id']]){if(_[_0xe540('0x1d')](this[_0xe540('0x9')][_0x4767d6['id']][_0xe540('0x2d')])){this[_0xe540('0x9')][_0x4767d6['id']]['Smtp']={};}this['mailAccounts'][_0x4767d6['id']][_0xe540('0x2d')][_0xe540('0x2e')]=moment();return new BPromise(function(_0x3d5689,_0x5984ba){return _0x483d1e[_0xe540('0xa')][_0xe540('0x2f')](_0x4767d6)[_0xe540('0x24')](function(_0x1d80d9){_0x483d1e[_0xe540('0x9')][_0x4767d6['id']]['Smtp'][_0xe540('0x10')]=_0xe540('0x30');_0x483d1e['mailAccounts'][_0x4767d6['id']]['Smtp']['messageStatus']='';_0x483d1e[_0xe540('0x14')](_0x4767d6['id']);_0x3d5689(_0x1d80d9);})['catch'](function(_0x19d282){_0x483d1e[_0xe540('0x9')][_0x4767d6['id']][_0xe540('0x2d')][_0xe540('0x10')]=_0xe540('0x27');_0x483d1e[_0xe540('0x9')][_0x4767d6['id']][_0xe540('0x2d')]['messageStatus']=_0x19d282;_0x483d1e[_0xe540('0x14')](_0x4767d6['id']);_0x5984ba(_0x19d282);});});}return this['smtp'][_0xe540('0x2f')](_0x4767d6);};module['exports']=EmailChannel; \ No newline at end of file +var _0x4e9f=['./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','name','key','active','Imap','total','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','handleImapEnd','isNil','status','disabled','messageStatus','connected','messages','notify','then','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','handleImapError','sendMail','send','verifySmtp','Smtp','smtp','verify','verified','exports','lodash','moment','bluebird','md5','../../../config/environment','email','redis','defaults','localhost','socket.io-emitter'];(function(_0x354bd6,_0x4a7c74){var _0x39bf52=function(_0x585791){while(--_0x585791){_0x354bd6['push'](_0x354bd6['shift']());}};_0x39bf52(++_0x4a7c74);}(_0x4e9f,0x169));var _0xf4e9=function(_0x3b43c0,_0x59058a){_0x3b43c0=_0x3b43c0-0x0;var _0x26cece=_0x4e9f[_0x3b43c0];return _0x26cece;};'use strict';var _=require(_0xf4e9('0x0'));var moment=require(_0xf4e9('0x1'));var BPromise=require(_0xf4e9('0x2'));var md5=require(_0xf4e9('0x3'));var Redis=require('ioredis');var config=require(_0xf4e9('0x4'));var logger=require('../../../config/logger')(_0xf4e9('0x5'));config[_0xf4e9('0x6')]=_[_0xf4e9('0x7')](config[_0xf4e9('0x6')],{'host':_0xf4e9('0x8'),'port':0x18eb});var io=require(_0xf4e9('0x9'))(new Redis(config[_0xf4e9('0x6')]));var EmailImap=require(_0xf4e9('0xa'));var EmailSmtp=require(_0xf4e9('0xb'));var mailAccount=require(_0xf4e9('0xc'));var md5Accounts={};function EmailChannel(_0x35948a){logger[_0xf4e9('0xd')](_0xf4e9('0xe'));this['mailAccounts']=_0x35948a[_0xf4e9('0xf')];this[_0xf4e9('0x10')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0xf4e9('0x11')][_0xf4e9('0x12')]=function(_0x4b747c){var _0x1c4d9f=this['mailAccounts'][_0x4b747c];var _0x17af6a={'id':_0x1c4d9f['id'],'name':_0x1c4d9f[_0xf4e9('0x13')],'key':_0x1c4d9f[_0xf4e9('0x14')],'active':_0x1c4d9f[_0xf4e9('0x15')],'Imap':{'status':_0x1c4d9f[_0xf4e9('0x16')]['status'],'messageStatus':_0x1c4d9f['Imap']['messageStatus'],'total':_0x1c4d9f[_0xf4e9('0x16')][_0xf4e9('0x17')]}};if(_['isNil'](md5Accounts[_0x4b747c])){md5Accounts[_0x4b747c]={};}var _0x409120=md5(JSON['stringify'](_0x17af6a));if(md5Accounts[_0x4b747c][_0xf4e9('0x3')]!==_0x409120){md5Accounts[_0x4b747c][_0xf4e9('0x3')]=_0x409120;io[_0xf4e9('0x12')]('mailAccount:update',_0x17af6a);}};EmailChannel[_0xf4e9('0x11')]['refresh']=function(_0x15a59e){for(var _0x23b1c1 in _0x15a59e){if(_0x15a59e[_0xf4e9('0x18')](_0x23b1c1)){if(_0x15a59e[_0x23b1c1][_0xf4e9('0x16')]&&_0x15a59e[_0x23b1c1][_0xf4e9('0x15')]){var _0x395f4b=_0x15a59e[_0x23b1c1][_0xf4e9('0x16')];if(!this[_0xf4e9('0x10')][_0xf4e9('0x18')](_0x395f4b['id'])){this['imapAccounts'][_0x395f4b['id']]=new EmailImap(_0x395f4b,_0x15a59e[_0x23b1c1][_0xf4e9('0x5')]);this[_0xf4e9('0x10')][_0x395f4b['id']]['on'](_0xf4e9('0x19'),this[_0xf4e9('0x1a')][_0xf4e9('0x1b')](this,_0x23b1c1));this[_0xf4e9('0x10')][_0x395f4b['id']]['on'](_0xf4e9('0x5'),this[_0xf4e9('0x1c')]['bind'](this,_0x23b1c1));this['imapAccounts'][_0x395f4b['id']]['on']('end',this[_0xf4e9('0x1d')][_0xf4e9('0x1b')](this,_0x23b1c1));this[_0xf4e9('0x10')][_0x395f4b['id']]['on']('error',this['handleImapError'][_0xf4e9('0x1b')](this,_0x23b1c1));}}else{if(_[_0xf4e9('0x1e')](this[_0xf4e9('0xf')][_0x23b1c1][_0xf4e9('0x16')])){this[_0xf4e9('0xf')][_0x23b1c1][_0xf4e9('0x16')]={};}this[_0xf4e9('0xf')][_0x23b1c1][_0xf4e9('0x16')][_0xf4e9('0x1f')]=_0xf4e9('0x20');this[_0xf4e9('0xf')][_0x23b1c1][_0xf4e9('0x16')][_0xf4e9('0x21')]='';this[_0xf4e9('0x12')](_0x23b1c1);}}}};EmailChannel['prototype'][_0xf4e9('0x1a')]=function(_0x5e914b,_0x46336f){if(this['mailAccounts'][_0x5e914b]){this['mailAccounts'][_0x5e914b][_0xf4e9('0x16')][_0xf4e9('0x1f')]=_0xf4e9('0x22');this['mailAccounts'][_0x5e914b][_0xf4e9('0x16')][_0xf4e9('0x21')]=_0x46336f[_0xf4e9('0x13')];if(_0x46336f[_0xf4e9('0x23')]){this[_0xf4e9('0xf')][_0x5e914b][_0xf4e9('0x16')][_0xf4e9('0x17')]=_0x46336f['messages'][_0xf4e9('0x17')];}return this[_0xf4e9('0x12')](_0x5e914b);}};EmailChannel[_0xf4e9('0x11')][_0xf4e9('0x1c')]=function(_0x56aa09,_0x2899f8){logger[_0xf4e9('0xd')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x2899f8['firstName'],_0x2899f8['lastName'],_0x2899f8['from'],_0x56aa09);if(this[_0xf4e9('0xf')][_0x56aa09]){return mailAccount[_0xf4e9('0x24')](_0x56aa09,_0x2899f8)[_0xf4e9('0x25')](function(_0x40a47a){if(_0x40a47a){logger[_0xf4e9('0xd')](_0xf4e9('0x26'));}})[_0xf4e9('0x27')](function(_0x44a020){logger[_0xf4e9('0x28')](_0xf4e9('0x29'),JSON[_0xf4e9('0x2a')](_0x44a020));});}};EmailChannel[_0xf4e9('0x11')][_0xf4e9('0x1d')]=function(_0x24e55a){if(this[_0xf4e9('0xf')][_0x24e55a]&&this[_0xf4e9('0xf')][_0x24e55a][_0xf4e9('0x16')]){if(this[_0xf4e9('0x10')][this[_0xf4e9('0xf')][_0x24e55a][_0xf4e9('0x16')]['id']]){delete this['imapAccounts'][this[_0xf4e9('0xf')][_0x24e55a][_0xf4e9('0x16')]['id']];}this[_0xf4e9('0xf')][_0x24e55a][_0xf4e9('0x16')][_0xf4e9('0x2b')]=moment();this[_0xf4e9('0x12')](_0x24e55a);}};EmailChannel[_0xf4e9('0x11')][_0xf4e9('0x2c')]=function(_0x23121c,_0x544cf1){if(this['mailAccounts'][_0x23121c]){this[_0xf4e9('0xf')][_0x23121c][_0xf4e9('0x16')]['status']=_0xf4e9('0x28');this[_0xf4e9('0xf')][_0x23121c][_0xf4e9('0x16')]['messageStatus']=_0x544cf1;return this[_0xf4e9('0x12')](_0x23121c);}};EmailChannel[_0xf4e9('0x11')][_0xf4e9('0x2d')]=function(_0x1f45cb,_0x566ce5){return this['smtp'][_0xf4e9('0x2e')](_0x1f45cb,_0x566ce5);};EmailChannel[_0xf4e9('0x11')][_0xf4e9('0x2f')]=function(_0x1805b3){var _0xc948ae=this;if(this[_0xf4e9('0xf')][_0x1805b3['id']]){if(_[_0xf4e9('0x1e')](this['mailAccounts'][_0x1805b3['id']][_0xf4e9('0x30')])){this['mailAccounts'][_0x1805b3['id']][_0xf4e9('0x30')]={};}this['mailAccounts'][_0x1805b3['id']][_0xf4e9('0x30')][_0xf4e9('0x2b')]=moment();return new BPromise(function(_0x6f48f,_0x1dd12f){return _0xc948ae[_0xf4e9('0x31')][_0xf4e9('0x32')](_0x1805b3)['then'](function(_0x498f82){_0xc948ae[_0xf4e9('0xf')][_0x1805b3['id']]['Smtp'][_0xf4e9('0x1f')]=_0xf4e9('0x33');_0xc948ae['mailAccounts'][_0x1805b3['id']][_0xf4e9('0x30')][_0xf4e9('0x21')]='';_0xc948ae[_0xf4e9('0x12')](_0x1805b3['id']);_0x6f48f(_0x498f82);})[_0xf4e9('0x27')](function(_0x4e4483){_0xc948ae[_0xf4e9('0xf')][_0x1805b3['id']][_0xf4e9('0x30')]['status']='error';_0xc948ae[_0xf4e9('0xf')][_0x1805b3['id']][_0xf4e9('0x30')][_0xf4e9('0x21')]=_0x4e4483;_0xc948ae[_0xf4e9('0x12')](_0x1805b3['id']);_0x1dd12f(_0x4e4483);});});}return this[_0xf4e9('0x31')][_0xf4e9('0x32')](_0x1805b3);};module[_0xf4e9('0x34')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index c03480a..df4a68c 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 _0x9744=['handleFetchError','handleFetchEnd','body','handleMessageBody','handleMessageEnd','handleSimpleParser','handleMessageAttributes','parser','emit','closeBox','stringify','textCode','hasOwnProperty','upperFirst','path','util','lodash','randomstring','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','getAccount','imap','account','ready','handleReady','bind','end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','password','host','port','tls','autotls','required','user','getHost','anonymous@xcally.com','openBox','handleOpenBox','box','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','once'];(function(_0x49b523,_0x30ad2f){var _0x5c891f=function(_0x554e2f){while(--_0x554e2f){_0x49b523['push'](_0x49b523['shift']());}};_0x5c891f(++_0x30ad2f);}(_0x9744,0x1ea));var _0x4974=function(_0x10a9ba,_0x3896a1){_0x10a9ba=_0x10a9ba-0x0;var _0x4e7305=_0x9744[_0x10a9ba];return _0x4e7305;};'use strict';var fs=require('fs');var path=require(_0x4974('0x0'));var util=require(_0x4974('0x1'));var Imap=require('imap');var _=require(_0x4974('0x2'));var rs=require(_0x4974('0x3'));var simpleParser=require(_0x4974('0x4'))[_0x4974('0x5')];var Iconv=require(_0x4974('0x6'))[_0x4974('0x7')];var EventEmitter=require(_0x4974('0x8'))[_0x4974('0x9')];var utils=require(_0x4974('0xa'));var logger=require(_0x4974('0xb'))(_0x4974('0xc'));function EmailImap(_0x29b8dd,_0x3b5e06){this[_0x4974('0xd')]=_0x4974('0xe');this['account']=this[_0x4974('0xf')](_0x29b8dd,_0x3b5e06);this[_0x4974('0x10')]=new Imap(this[_0x4974('0x11')]);this[_0x4974('0x10')]['once'](_0x4974('0x12'),this[_0x4974('0x13')][_0x4974('0x14')](this));this['imap']['once'](_0x4974('0x15'),this[_0x4974('0x16')][_0x4974('0x14')](this));this[_0x4974('0x10')]['on'](_0x4974('0x17'),this[_0x4974('0x18')]['bind'](this));this[_0x4974('0x10')][_0x4974('0x19')]();}util[_0x4974('0x1a')](EmailImap,EventEmitter);EmailImap[_0x4974('0x1b')][_0x4974('0xf')]=function(_0x30f063,_0x4d8f9a){var _0x374e7c={'connTimeout':_0x30f063[_0x4974('0x1c')]?_0x30f063[_0x4974('0x1c')]*0x3e8:0x2710,'authTimeout':_0x30f063[_0x4974('0x1d')]?_0x30f063[_0x4974('0x1d')]*0x3e8:0x1388};if(_[_0x4974('0x1e')](_0x30f063[_0x4974('0x1f')])){if(_0x30f063[_0x4974('0x20')]){_0x374e7c['user']=_0x30f063['user'];_0x374e7c['password']=_0x30f063[_0x4974('0x21')];}_0x374e7c[_0x4974('0x22')]=_0x30f063[_0x4974('0x22')];_0x374e7c[_0x4974('0x23')]=_0x30f063[_0x4974('0x23')]||0x3e1;if(_0x30f063[_0x4974('0x24')]){_0x374e7c[_0x4974('0x24')]=!![];}else{_0x374e7c[_0x4974('0x24')]=![];_0x374e7c[_0x4974('0x25')]=_0x4974('0x26');}}else{_0x374e7c[_0x4974('0x27')]=_0x30f063[_0x4974('0x27')];_0x374e7c[_0x4974('0x21')]=_0x30f063[_0x4974('0x21')];_0x374e7c[_0x4974('0x22')]=utils[_0x4974('0x28')](_0x30f063[_0x4974('0x1f')]);_0x374e7c[_0x4974('0x23')]=0x3e1;_0x374e7c[_0x4974('0x24')]=!![];}_0x374e7c[_0x4974('0xc')]=_0x4d8f9a||_0x30f063[_0x4974('0x27')]||_0x4974('0x29');return _0x374e7c;};EmailImap[_0x4974('0x1b')]['handleReady']=function(){this[_0x4974('0x10')][_0x4974('0x2a')](this[_0x4974('0xd')],![],this['handleOpenBox']['bind'](this));};EmailImap[_0x4974('0x1b')][_0x4974('0x2b')]=function(_0x3b933d,_0x166076){if(_0x3b933d){this[_0x4974('0x18')](_0x3b933d,!![]);}else{this['emit'](_0x4974('0x2c'),_0x166076);this['readUnseen']();}};EmailImap[_0x4974('0x1b')][_0x4974('0x2d')]=function(_0x1e3b7f){if(_0x1e3b7f){this[_0x4974('0x18')](_0x1e3b7f,!![]);}else{this[_0x4974('0x10')][_0x4974('0x15')]();}};EmailImap['prototype']['readUnseen']=function(){this[_0x4974('0x10')][_0x4974('0x2e')]([_0x4974('0x2f')],this['handleReadUnseen'][_0x4974('0x14')](this));};EmailImap[_0x4974('0x1b')][_0x4974('0x30')]=function(_0x95145b,_0x2783fe){if(_0x95145b){this[_0x4974('0x18')](_0x95145b,!![]);}else{if(_0x2783fe[_0x4974('0x31')]){try{var _0x250bbd=this['imap'][_0x4974('0x32')](_0x2783fe,{'bodies':'','markSeen':!![]});_0x250bbd['on'](_0x4974('0x33'),this[_0x4974('0x34')]['bind'](this));_0x250bbd[_0x4974('0x35')]('error',this[_0x4974('0x36')][_0x4974('0x14')](this));_0x250bbd[_0x4974('0x35')]('end',this[_0x4974('0x37')][_0x4974('0x14')](this));}catch(_0xcb3bb9){logger[_0x4974('0x17')](_0xcb3bb9);}}else{this[_0x4974('0x10')]['closeBox'](!![],this[_0x4974('0x2d')]['bind'](this));}}};EmailImap[_0x4974('0x1b')]['handleFetchMessage']=function(_0xb5cf55,_0x45b6d4){_0xb5cf55['on'](_0x4974('0x38'),this[_0x4974('0x39')][_0x4974('0x14')](this));_0xb5cf55[_0x4974('0x35')]('attributes',this['handleMessageAttributes']['bind'](this));_0xb5cf55[_0x4974('0x35')](_0x4974('0x15'),this[_0x4974('0x3a')][_0x4974('0x14')](this));};EmailImap[_0x4974('0x1b')]['handleMessageBody']=function(_0x22b812,_0x9aeb98){simpleParser(_0x22b812,{'Iconv':Iconv},this[_0x4974('0x3b')][_0x4974('0x14')](this));};EmailImap['prototype'][_0x4974('0x3c')]=function(_0xd6fe9f){};EmailImap[_0x4974('0x1b')][_0x4974('0x3a')]=function(){};EmailImap[_0x4974('0x1b')][_0x4974('0x3b')]=function(_0x16ec8c,_0x44b0d1){if(_0x16ec8c){logger['error'](_0x16ec8c);}else{var _0x3be12b=this;utils[_0x4974('0x3d')](this['account'],_0x44b0d1,function(_0x2ece99){_0x3be12b[_0x4974('0x3e')](_0x4974('0xc'),_0x2ece99);});}};EmailImap[_0x4974('0x1b')][_0x4974('0x37')]=function(){this[_0x4974('0x10')][_0x4974('0x3f')](!![],this[_0x4974('0x2d')][_0x4974('0x14')](this));};EmailImap[_0x4974('0x1b')][_0x4974('0x36')]=function(_0x25e038){this['handleError'](_0x25e038);this[_0x4974('0x10')][_0x4974('0x3f')](!![],this[_0x4974('0x2d')][_0x4974('0x14')](this));};EmailImap['prototype']['handleEnd']=function(){this[_0x4974('0x3e')](_0x4974('0x15'));};EmailImap[_0x4974('0x1b')][_0x4974('0x18')]=function(_0x2dc8a2,_0x52129a){logger[_0x4974('0x17')](_0x4974('0x18'),this[_0x4974('0x11')][_0x4974('0xc')],JSON[_0x4974('0x40')](_0x2dc8a2));var _0x54f12e='';if(_0x2dc8a2){if(_0x2dc8a2[_0x4974('0x41')]){_0x54f12e=_0x2dc8a2[_0x4974('0x41')];}else{for(var _0x592e14 in _0x2dc8a2){if(_0x2dc8a2[_0x4974('0x42')](_0x592e14)){_0x54f12e+=_[_0x4974('0x43')](_0x592e14)+':\x20'+_0x2dc8a2[_0x592e14]+'\x0a';}}}}if(_0x52129a){this[_0x4974('0x10')][_0x4974('0x15')]();}else{this[_0x4974('0x3e')](_0x4974('0x17'),_0x54f12e);this['emit'](_0x4974('0x15'));}};module['exports']=EmailImap; \ No newline at end of file +var _0x3c85=['bind','closeBox','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','parser','emit','textCode','hasOwnProperty','path','util','imap','lodash','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','INBOX','account','getAccount','ready','handleReady','once','end','handleEnd','handleError','connect','connTimeout','authTimeout','isNil','service','user','password','host','port','tls','autotls','required','prototype','openBox','mailbox','handleOpenBox','box','readUnseen','handleCloseBox','UNSEEN','handleReadUnseen','length','handleFetchMessage','error','handleFetchError','handleFetchEnd'];(function(_0x5c59e9,_0x253541){var _0x56b0b3=function(_0xeb6ad2){while(--_0xeb6ad2){_0x5c59e9['push'](_0x5c59e9['shift']());}};_0x56b0b3(++_0x253541);}(_0x3c85,0xb8));var _0x53c8=function(_0x309269,_0x9b95eb){_0x309269=_0x309269-0x0;var _0x503623=_0x3c85[_0x309269];return _0x503623;};'use strict';var fs=require('fs');var path=require(_0x53c8('0x0'));var util=require(_0x53c8('0x1'));var Imap=require(_0x53c8('0x2'));var _=require(_0x53c8('0x3'));var rs=require('randomstring');var simpleParser=require(_0x53c8('0x4'))[_0x53c8('0x5')];var Iconv=require(_0x53c8('0x6'))[_0x53c8('0x7')];var EventEmitter=require(_0x53c8('0x8'))[_0x53c8('0x9')];var utils=require(_0x53c8('0xa'));var logger=require(_0x53c8('0xb'))(_0x53c8('0xc'));function EmailImap(_0x51c04e,_0x46d0e0){this['mailbox']=_0x53c8('0xd');this[_0x53c8('0xe')]=this[_0x53c8('0xf')](_0x51c04e,_0x46d0e0);this['imap']=new Imap(this[_0x53c8('0xe')]);this[_0x53c8('0x2')]['once'](_0x53c8('0x10'),this[_0x53c8('0x11')]['bind'](this));this[_0x53c8('0x2')][_0x53c8('0x12')](_0x53c8('0x13'),this[_0x53c8('0x14')]['bind'](this));this['imap']['on']('error',this[_0x53c8('0x15')]['bind'](this));this['imap'][_0x53c8('0x16')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0x53c8('0xf')]=function(_0x4c16a6,_0x3b738f){var _0x4105bd={'connTimeout':_0x4c16a6[_0x53c8('0x17')]?_0x4c16a6[_0x53c8('0x17')]*0x3e8:0x2710,'authTimeout':_0x4c16a6[_0x53c8('0x18')]?_0x4c16a6['authTimeout']*0x3e8:0x1388};if(_[_0x53c8('0x19')](_0x4c16a6[_0x53c8('0x1a')])){if(_0x4c16a6['authentication']){_0x4105bd['user']=_0x4c16a6[_0x53c8('0x1b')];_0x4105bd['password']=_0x4c16a6[_0x53c8('0x1c')];}_0x4105bd[_0x53c8('0x1d')]=_0x4c16a6[_0x53c8('0x1d')];_0x4105bd[_0x53c8('0x1e')]=_0x4c16a6[_0x53c8('0x1e')]||0x3e1;if(_0x4c16a6[_0x53c8('0x1f')]){_0x4105bd[_0x53c8('0x1f')]=!![];}else{_0x4105bd[_0x53c8('0x1f')]=![];_0x4105bd[_0x53c8('0x20')]=_0x53c8('0x21');}}else{_0x4105bd[_0x53c8('0x1b')]=_0x4c16a6[_0x53c8('0x1b')];_0x4105bd[_0x53c8('0x1c')]=_0x4c16a6[_0x53c8('0x1c')];_0x4105bd[_0x53c8('0x1d')]=utils['getHost'](_0x4c16a6[_0x53c8('0x1a')]);_0x4105bd[_0x53c8('0x1e')]=0x3e1;_0x4105bd[_0x53c8('0x1f')]=!![];}_0x4105bd[_0x53c8('0xc')]=_0x3b738f||_0x4c16a6['user']||'anonymous@xcally.com';return _0x4105bd;};EmailImap[_0x53c8('0x22')][_0x53c8('0x11')]=function(){this[_0x53c8('0x2')][_0x53c8('0x23')](this[_0x53c8('0x24')],![],this[_0x53c8('0x25')]['bind'](this));};EmailImap['prototype'][_0x53c8('0x25')]=function(_0x50b5f6,_0x385dae){if(_0x50b5f6){this[_0x53c8('0x15')](_0x50b5f6,!![]);}else{this['emit'](_0x53c8('0x26'),_0x385dae);this[_0x53c8('0x27')]();}};EmailImap[_0x53c8('0x22')][_0x53c8('0x28')]=function(_0x5029ba){if(_0x5029ba){this[_0x53c8('0x15')](_0x5029ba,!![]);}else{this[_0x53c8('0x2')][_0x53c8('0x13')]();}};EmailImap[_0x53c8('0x22')][_0x53c8('0x27')]=function(){this[_0x53c8('0x2')]['search']([_0x53c8('0x29')],this[_0x53c8('0x2a')]['bind'](this));};EmailImap[_0x53c8('0x22')]['handleReadUnseen']=function(_0x501d26,_0x1fbac3){if(_0x501d26){this[_0x53c8('0x15')](_0x501d26,!![]);}else{if(_0x1fbac3[_0x53c8('0x2b')]){try{var _0x5c077f=this['imap']['fetch'](_0x1fbac3,{'bodies':'','markSeen':!![]});_0x5c077f['on']('message',this[_0x53c8('0x2c')]['bind'](this));_0x5c077f['once'](_0x53c8('0x2d'),this[_0x53c8('0x2e')]['bind'](this));_0x5c077f[_0x53c8('0x12')](_0x53c8('0x13'),this[_0x53c8('0x2f')][_0x53c8('0x30')](this));}catch(_0x2de4e2){logger['error'](_0x2de4e2);}}else{this[_0x53c8('0x2')][_0x53c8('0x31')](!![],this['handleCloseBox'][_0x53c8('0x30')](this));}}};EmailImap['prototype'][_0x53c8('0x2c')]=function(_0x116061,_0x2f1a59){_0x116061['on']('body',this[_0x53c8('0x32')]['bind'](this));_0x116061[_0x53c8('0x12')](_0x53c8('0x33'),this['handleMessageAttributes'][_0x53c8('0x30')](this));_0x116061[_0x53c8('0x12')](_0x53c8('0x13'),this['handleMessageEnd'][_0x53c8('0x30')](this));};EmailImap['prototype'][_0x53c8('0x32')]=function(_0x38f981,_0xbd781e){simpleParser(_0x38f981,{'Iconv':Iconv},this['handleSimpleParser'][_0x53c8('0x30')](this));};EmailImap[_0x53c8('0x22')]['handleMessageAttributes']=function(_0xf2f441){};EmailImap['prototype'][_0x53c8('0x34')]=function(){};EmailImap[_0x53c8('0x22')][_0x53c8('0x35')]=function(_0x16dddb,_0x7fac09){if(_0x16dddb){logger['error'](_0x16dddb);}else{var _0x5ae652=this;utils[_0x53c8('0x36')](this[_0x53c8('0xe')],_0x7fac09,function(_0x446d03){_0x5ae652[_0x53c8('0x37')](_0x53c8('0xc'),_0x446d03);});}};EmailImap['prototype']['handleFetchEnd']=function(){this['imap'][_0x53c8('0x31')](!![],this['handleCloseBox'][_0x53c8('0x30')](this));};EmailImap[_0x53c8('0x22')][_0x53c8('0x2e')]=function(_0x34d453){this[_0x53c8('0x15')](_0x34d453);this['imap'][_0x53c8('0x31')](!![],this[_0x53c8('0x28')][_0x53c8('0x30')](this));};EmailImap['prototype'][_0x53c8('0x14')]=function(){this['emit']('end');};EmailImap['prototype']['handleError']=function(_0x5b5d3b,_0x4ad324){logger[_0x53c8('0x2d')](_0x53c8('0x15'),this['account'][_0x53c8('0xc')],JSON['stringify'](_0x5b5d3b));var _0x5747c3='';if(_0x5b5d3b){if(_0x5b5d3b[_0x53c8('0x38')]){_0x5747c3=_0x5b5d3b[_0x53c8('0x38')];}else{for(var _0x5c0a8f in _0x5b5d3b){if(_0x5b5d3b[_0x53c8('0x39')](_0x5c0a8f)){_0x5747c3+=_['upperFirst'](_0x5c0a8f)+':\x20'+_0x5b5d3b[_0x5c0a8f]+'\x0a';}}}}if(_0x4ad324){this[_0x53c8('0x2')][_0x53c8('0x13')]();}else{this[_0x53c8('0x37')](_0x53c8('0x2d'),_0x5747c3);this[_0x53c8('0x37')]('end');}};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 28fa58c..7136eeb 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 _0x66aa=['toString','verify','Not\x20verifired','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile','sendMail'];(function(_0x1fee59,_0x393c7b){var _0x4ab835=function(_0x383ddf){while(--_0x383ddf){_0x1fee59['push'](_0x1fee59['shift']());}};_0x4ab835(++_0x393c7b);}(_0x66aa,0xb7));var _0xa66a=function(_0x137c33,_0x27a274){_0x137c33=_0x137c33-0x0;var _0x23aa2d=_0x66aa[_0x137c33];return _0x23aa2d;};'use strict';var nodemailer=require(_0xa66a('0x0'));var BPromise=require(_0xa66a('0x1'));var inlineBase64=require(_0xa66a('0x2'));function EmailSmtp(){}EmailSmtp[_0xa66a('0x3')][_0xa66a('0x4')]=function(_0x51a0a7,_0x5416f7){return new BPromise(function(_0x58c66e,_0x4ce641){var _0x88dbf3=nodemailer[_0xa66a('0x5')](_0x51a0a7);_0x88dbf3[_0xa66a('0x6')](_0xa66a('0x7'),inlineBase64());_0x88dbf3[_0xa66a('0x8')](_0x5416f7,function(_0x58d725,_0x270d26){if(_0x58d725){_0x4ce641(_0x58d725[_0xa66a('0x9')]());}else{_0x58c66e(_0x270d26);}});});};EmailSmtp[_0xa66a('0x3')][_0xa66a('0xa')]=function(_0x1db75e){return new BPromise(function(_0x3873a8,_0x445ff7){var _0x4b7563=nodemailer['createTransport'](_0x1db75e);_0x4b7563[_0xa66a('0xa')](function(_0x8db2b4,_0x14d1ed){if(_0x8db2b4){_0x445ff7(_0x8db2b4[_0xa66a('0x9')]());}else{if(_0x14d1ed){_0x3873a8(_0x14d1ed);}else{_0x445ff7(_0xa66a('0xb'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0xa5a9=['bluebird','nodemailer-plugin-inline-base64','prototype','send','use','compile','sendMail','toString','verify','createTransport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa5a9,0xdc));var _0x9a5a=function(_0x2dbcf0,_0x1c9ce9){_0x2dbcf0=_0x2dbcf0-0x0;var _0x185a15=_0xa5a9[_0x2dbcf0];return _0x185a15;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0x9a5a('0x0'));var inlineBase64=require(_0x9a5a('0x1'));function EmailSmtp(){}EmailSmtp[_0x9a5a('0x2')][_0x9a5a('0x3')]=function(_0x581442,_0x4ae057){return new BPromise(function(_0x36555a,_0x545ea0){var _0x2f14f7=nodemailer['createTransport'](_0x581442);_0x2f14f7[_0x9a5a('0x4')](_0x9a5a('0x5'),inlineBase64());_0x2f14f7[_0x9a5a('0x6')](_0x4ae057,function(_0x4f4e51,_0x4e1321){if(_0x4f4e51){_0x545ea0(_0x4f4e51[_0x9a5a('0x7')]());}else{_0x36555a(_0x4e1321);}});});};EmailSmtp[_0x9a5a('0x2')][_0x9a5a('0x8')]=function(_0x43166a){return new BPromise(function(_0x5d2adf,_0x2f5544){var _0x4e21ac=nodemailer[_0x9a5a('0x9')](_0x43166a);_0x4e21ac[_0x9a5a('0x8')](function(_0x20d531,_0x534b44){if(_0x20d531){_0x2f5544(_0x20d531[_0x9a5a('0x7')]());}else{if(_0x534b44){_0x5d2adf(_0x534b44);}else{_0x2f5544('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index b6e0903..f08da9c 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 _0x1410=['gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','127.0.0.1','lodash','moment','randomstring','path','node-tnef','email','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','join','length','pop','test','html','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','message','originTo','isEmpty','originCc','bcc','attach','type','attachment','attachment-','format','now','server/files/attachments/','writeFileSync','content','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','parser','from','subject','messageId','inReplyTo','date','application/ms-tnef','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost'];(function(_0x1af71a,_0x5ea38f){var _0x3f5fdb=function(_0x53dc32){while(--_0x53dc32){_0x1af71a['push'](_0x1af71a['shift']());}};_0x3f5fdb(++_0x5ea38f);}(_0x1410,0x130));var _0x0141=function(_0x5824c1,_0x3c61f1){_0x5824c1=_0x5824c1-0x0;var _0x397d9d=_0x1410[_0x5824c1];return _0x397d9d;};'use strict';var _=require(_0x0141('0x0'));var moment=require(_0x0141('0x1'));var random=require(_0x0141('0x2'));var fs=require('fs');var path=require(_0x0141('0x3'));var util=require('util');var tnef=require(_0x0141('0x4'));var logger=require('../../../config/logger')(_0x0141('0x5'));var config=require('../../../config/environment');function getAddress(_0x194c72){var _0x454af1=_[_0x0141('0x6')](_0x194c72[_0x0141('0x7')]);return _0x454af1&&_0x454af1[_0x0141('0x8')]?_0x454af1[_0x0141('0x8')]:_0x0141('0x9')+random[_0x0141('0xa')](0x6)+_0x0141('0xb');}function getFirstName(_0x57cfbb){var _0x19ff64=_[_0x0141('0x6')](_0x57cfbb[_0x0141('0x7')]);if(_0x19ff64&&_0x19ff64[_0x0141('0xc')]){if(_0x19ff64[_0x0141('0xc')]==_0x19ff64[_0x0141('0x8')]){return _0x19ff64[_0x0141('0xc')][_0x0141('0xd')](0x0,_0x19ff64['name'][_0x0141('0xe')]('@'));}var _0x3b7718=_0x19ff64[_0x0141('0xc')][_0x0141('0xf')](/\s+/);return _0x3b7718['length']>0x1?_0x3b7718['slice'](0x0,-0x1)[_0x0141('0x10')]('\x20'):_0x19ff64[_0x0141('0xc')];}return'Anonymous';}function getLastName(_0x278f18){var _0x5d8795=_[_0x0141('0x6')](_0x278f18[_0x0141('0x7')]);if(_0x5d8795&&_0x5d8795[_0x0141('0xc')]){var _0x51a855=_0x5d8795[_0x0141('0xc')]['split'](/\s+/);return _0x51a855[_0x0141('0x11')]>0x1?_0x51a855[_0x0141('0x12')]():'';}return'';}function getMails(_0x345fbd,_0x310e2b){var _0x3bf5b4='';for(var _0x3c91e8=0x0;_0x3c91e8<_0x310e2b['value']['length'];_0x3c91e8+=0x1){if(_0x310e2b[_0x0141('0x7')][_0x3c91e8][_0x0141('0x8')]!==_0x345fbd){if(!_['isEmpty'](_0x3bf5b4)){_0x3bf5b4+=',';}_0x3bf5b4+=_0x310e2b[_0x0141('0x7')][_0x3c91e8][_0x0141('0xc')]||_0x310e2b[_0x0141('0x7')][_0x3c91e8][_0x0141('0x8')]||'';_0x3bf5b4+='\x20<';_0x3bf5b4+=_0x310e2b['value'][_0x3c91e8][_0x0141('0x8')]?_0x310e2b[_0x0141('0x7')][_0x3c91e8]['address']:_0x0141('0x9')+random[_0x0141('0xa')](0x6)+_0x0141('0xb');_0x3bf5b4+='>';}}return _0x3bf5b4;}function parseEmail(_0x30a141,_0x316f70,_0x13ac96){if(_0x316f70['html']){var _0x21d8fc=/)<[^<]*)*<\/script>/gi;while(_0x21d8fc[_0x0141('0x13')](_0x316f70[_0x0141('0x14')])){_0x316f70[_0x0141('0x14')]=_0x316f70[_0x0141('0x14')][_0x0141('0x15')](_0x21d8fc,'');}if(_0x316f70[_0x0141('0x14')][_0x0141('0x16')](_0x0141('0x17'))){var _0x3869b7=[];_0x316f70[_0x0141('0x18')][_0x0141('0x19')](_0x59bdbd=>{_0x3869b7[_0x0141('0x1a')](_0x59bdbd[_0x0141('0x1b')]);});var _0xb80072=/]+>/g;var _0x3e242c=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0xcc5658=_0x316f70['html'][_0x0141('0x15')](_0x3e242c,_0x0141('0x1c'));var _0x2bb7c4=_0xcc5658['replace'](_0xb80072,_0x0141('0x1d'));for(let _0x4d1cb3=0x0;_0x4d1cb3<_0x3869b7[_0x0141('0x11')];_0x4d1cb3++){var _0x13d8d1=_0x2bb7c4[_0x0141('0x15')](_0x0141('0x1d'),_0x0141('0x1e')+_0x3869b7[_0x4d1cb3]+_0x0141('0x1f'));_0x2bb7c4=_0x13d8d1;}_0x316f70[_0x0141('0x14')]=_0x2bb7c4;}_0x13ac96[_0x0141('0x20')]=_0x316f70[_0x0141('0x14')];}else{_0x13ac96[_0x0141('0x20')]=_0x316f70[_0x0141('0x21')];}if(_0x13ac96[_0x0141('0x20')]){_0x13ac96[_0x0141('0x20')]=_0x13ac96['body'][_0x0141('0x15')](/0x0){var _0x1d545b=[_0x0141('0x31'),_0x0141('0x32'),_0x0141('0x33')];for(var _0x37c228=0x0;_0x37c228<_0x316f70['headerLines'][_0x0141('0x11')];_0x37c228++){var _0x56ac88=_[_0x0141('0xe')](_0x1d545b,_0x316f70['headerLines'][_0x37c228]['line']);if(_0x56ac88>=0x0){_0x13ac96['isAutoreply']=!![];}}}return _0x13ac96;}exports[_0x0141('0x34')]=function(_0x2579df,_0x210a8c,_0x5dfd8a){var _0x8e0b85={'from':getAddress(_0x210a8c[_0x0141('0x35')]),'firstName':getFirstName(_0x210a8c[_0x0141('0x35')]),'lastName':getLastName(_0x210a8c[_0x0141('0x35')]),'mapKey':'email','message':{'from':getMails(_0x2579df[_0x0141('0x5')],_0x210a8c[_0x0141('0x35')]),'to':_0x2579df[_0x0141('0x5')],'cc':'','subject':_0x210a8c[_0x0141('0x36')]||'','messageId':_0x210a8c[_0x0141('0x37')],'inReplyTo':_0x210a8c[_0x0141('0x38')],'sentAt':moment(_0x210a8c[_0x0141('0x39')])[_0x0141('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x210a8c[_0x0141('0x14')]&&!_0x210a8c[_0x0141('0x21')]){var _0xbacb30=_['filter'](_0x210a8c[_0x0141('0x18')],{'contentType':_0x0141('0x3a')});if(_0xbacb30[_0x0141('0x11')]){logger['info'](util[_0x0141('0x2b')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x210a8c[_0x0141('0x37')]));tnef['parseBuffer'](_[_0x0141('0x3b')](_0xbacb30)['content'],function(_0xaa2b6d,_0xf2ef01){if(_0xf2ef01){_0x210a8c[_0x0141('0x14')]=_0xf2ef01[_0x0141('0x3c')]||_0x0141('0x3d');if(_0xf2ef01['Attachments']){for(var _0x3890ef=0x0;_0x3890ef<_0xf2ef01[_0x0141('0x3e')][_0x0141('0x11')];_0x3890ef++){var _0x5edf0a=_0xf2ef01[_0x0141('0x3e')][_0x3890ef];_0x8e0b85[_0x0141('0x22')][_0x0141('0x18')]['push']({'filename':_0x5edf0a[_0x0141('0x3f')],'content':Buffer['from'](_0x5edf0a[_0x0141('0x40')])});}}}_0x5dfd8a(parseEmail(_0x2579df,_0x210a8c,_0x8e0b85));});}else{_0x210a8c[_0x0141('0x14')]=_0x0141('0x3d');_0x5dfd8a(parseEmail(_0x2579df,_0x210a8c,_0x8e0b85));}}else{_0x5dfd8a(parseEmail(_0x2579df,_0x210a8c,_0x8e0b85));}};exports[_0x0141('0x41')]=function(_0x5c8f64){switch(_0x5c8f64){case _0x0141('0x42'):return _0x0141('0x43');case _0x0141('0x44'):return _0x0141('0x45');case _0x0141('0x46'):return _0x0141('0x47');case _0x0141('0x48'):return'outlook.office365.com';}return _0x0141('0x49');}; \ No newline at end of file +var _0xa282=['html','replace','\x20[Attachment:\x20','\x20]','body','message','originTo','originCc','includes','bcc','attach','type','attachment-','format','%s-%s','now','root','server/files/attachments/','content','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','parser','from','subject','inReplyTo','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook.office365.com','127.0.0.1','lodash','path','node-tnef','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','length','join','Anonymous','split','isEmpty'];(function(_0x3e6e11,_0x1c13b9){var _0x363519=function(_0x505d63){while(--_0x505d63){_0x3e6e11['push'](_0x3e6e11['shift']());}};_0x363519(++_0x1c13b9);}(_0xa282,0x1f3));var _0x2a28=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa282[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x2a28('0x0'));var moment=require('moment');var random=require('randomstring');var fs=require('fs');var path=require(_0x2a28('0x1'));var util=require('util');var tnef=require(_0x2a28('0x2'));var logger=require('../../../config/logger')(_0x2a28('0x3'));var config=require(_0x2a28('0x4'));function getAddress(_0x2e12ef){var _0x194226=_[_0x2a28('0x5')](_0x2e12ef[_0x2a28('0x6')]);return _0x194226&&_0x194226[_0x2a28('0x7')]?_0x194226[_0x2a28('0x7')]:_0x2a28('0x8')+random[_0x2a28('0x9')](0x6)+_0x2a28('0xa');}function getFirstName(_0x91d789){var _0x20c0fa=_['head'](_0x91d789[_0x2a28('0x6')]);if(_0x20c0fa&&_0x20c0fa['name']){if(_0x20c0fa[_0x2a28('0xb')]==_0x20c0fa[_0x2a28('0x7')]){return _0x20c0fa[_0x2a28('0xb')][_0x2a28('0xc')](0x0,_0x20c0fa[_0x2a28('0xb')][_0x2a28('0xd')]('@'));}var _0x4f6255=_0x20c0fa['name']['split'](/\s+/);return _0x4f6255[_0x2a28('0xe')]>0x1?_0x4f6255['slice'](0x0,-0x1)[_0x2a28('0xf')]('\x20'):_0x20c0fa[_0x2a28('0xb')];}return _0x2a28('0x10');}function getLastName(_0x4524ee){var _0x3dd0de=_['head'](_0x4524ee['value']);if(_0x3dd0de&&_0x3dd0de[_0x2a28('0xb')]){var _0x1da434=_0x3dd0de['name'][_0x2a28('0x11')](/\s+/);return _0x1da434[_0x2a28('0xe')]>0x1?_0x1da434['pop']():'';}return'';}function getMails(_0x5e6257,_0x575294){var _0x13751d='';for(var _0x506493=0x0;_0x506493<_0x575294[_0x2a28('0x6')][_0x2a28('0xe')];_0x506493+=0x1){if(_0x575294['value'][_0x506493][_0x2a28('0x7')]!==_0x5e6257){if(!_[_0x2a28('0x12')](_0x13751d)){_0x13751d+=',';}_0x13751d+=_0x575294['value'][_0x506493][_0x2a28('0xb')]||_0x575294['value'][_0x506493][_0x2a28('0x7')]||'';_0x13751d+='\x20<';_0x13751d+=_0x575294['value'][_0x506493][_0x2a28('0x7')]?_0x575294[_0x2a28('0x6')][_0x506493][_0x2a28('0x7')]:_0x2a28('0x8')+random[_0x2a28('0x9')](0x6)+'@xcally.com';_0x13751d+='>';}}return _0x13751d;}function parseEmail(_0x5404e3,_0x18d88d,_0x50988f){if(_0x18d88d['html']){var _0x2150c7=/)<[^<]*)*<\/script>/gi;while(_0x2150c7['test'](_0x18d88d[_0x2a28('0x13')])){_0x18d88d[_0x2a28('0x13')]=_0x18d88d[_0x2a28('0x13')][_0x2a28('0x14')](_0x2150c7,'');}if(_0x18d88d['html']['includes'](_0x2a28('0x15'))){var _0x11ad1f=[];_0x18d88d[_0x2a28('0x16')]['forEach'](_0x3e4d4b=>{_0x11ad1f[_0x2a28('0x17')](_0x3e4d4b[_0x2a28('0x18')]);});var _0x27db13=/]+>/g;var _0x185d9c=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x13d489=_0x18d88d[_0x2a28('0x13')][_0x2a28('0x14')](_0x185d9c,_0x2a28('0x19'));var _0x3f26c7=_0x13d489[_0x2a28('0x14')](_0x27db13,'_IMG');for(let _0x408539=0x0;_0x408539<_0x11ad1f[_0x2a28('0xe')];_0x408539++){var _0x551740=_0x3f26c7[_0x2a28('0x14')](_0x2a28('0x1a'),_0x2a28('0x1b')+_0x11ad1f[_0x408539]+_0x2a28('0x1c'));_0x3f26c7=_0x551740;}_0x18d88d[_0x2a28('0x13')]=_0x3f26c7;}_0x50988f[_0x2a28('0x1d')]=_0x18d88d['html'];}else{_0x50988f[_0x2a28('0x1d')]=_0x18d88d['textAsHtml'];}if(_0x50988f[_0x2a28('0x1d')]){_0x50988f[_0x2a28('0x1d')]=_0x50988f[_0x2a28('0x1d')][_0x2a28('0x14')](/0x0){var _0x483d46=[_0x2a28('0x2d'),_0x2a28('0x2e'),_0x2a28('0x2f')];for(var _0x388ab6=0x0;_0x388ab6<_0x18d88d[_0x2a28('0x2c')][_0x2a28('0xe')];_0x388ab6++){var _0x13556c=_[_0x2a28('0xd')](_0x483d46,_0x18d88d[_0x2a28('0x2c')][_0x388ab6][_0x2a28('0x30')]);if(_0x13556c>=0x0){_0x50988f[_0x2a28('0x31')]=!![];}}}return _0x50988f;}exports[_0x2a28('0x32')]=function(_0x53e1cb,_0x9a9929,_0x2f3dd0){var _0x101306={'from':getAddress(_0x9a9929['from']),'firstName':getFirstName(_0x9a9929[_0x2a28('0x33')]),'lastName':getLastName(_0x9a9929[_0x2a28('0x33')]),'mapKey':_0x2a28('0x3'),'message':{'from':getMails(_0x53e1cb['email'],_0x9a9929[_0x2a28('0x33')]),'to':_0x53e1cb[_0x2a28('0x3')],'cc':'','subject':_0x9a9929[_0x2a28('0x34')]||'','messageId':_0x9a9929['messageId'],'inReplyTo':_0x9a9929[_0x2a28('0x35')],'sentAt':moment(_0x9a9929['date'])[_0x2a28('0x26')](_0x2a28('0x36')),'attach':![],'attachments':[]}};if(!_0x9a9929[_0x2a28('0x13')]&&!_0x9a9929['textAsHtml']){var _0x3e6387=_[_0x2a28('0x37')](_0x9a9929['attachments'],{'contentType':_0x2a28('0x38')});if(_0x3e6387[_0x2a28('0xe')]){logger[_0x2a28('0x39')](util[_0x2a28('0x26')](_0x2a28('0x3a'),_0x9a9929['messageId']));tnef[_0x2a28('0x3b')](_[_0x2a28('0x3c')](_0x3e6387)['content'],function(_0x2e3486,_0x4ebaff){if(_0x4ebaff){_0x9a9929[_0x2a28('0x13')]=_0x4ebaff[_0x2a28('0x3d')]||_0x2a28('0x3e');if(_0x4ebaff[_0x2a28('0x3f')]){for(var _0x2210bf=0x0;_0x2210bf<_0x4ebaff['Attachments'][_0x2a28('0xe')];_0x2210bf++){var _0x5bb056=_0x4ebaff[_0x2a28('0x3f')][_0x2210bf];_0x101306[_0x2a28('0x1e')][_0x2a28('0x16')][_0x2a28('0x17')]({'filename':_0x5bb056[_0x2a28('0x40')],'content':Buffer[_0x2a28('0x33')](_0x5bb056[_0x2a28('0x41')])});}}}_0x2f3dd0(parseEmail(_0x53e1cb,_0x9a9929,_0x101306));});}else{_0x9a9929['html']=_0x2a28('0x3e');_0x2f3dd0(parseEmail(_0x53e1cb,_0x9a9929,_0x101306));}}else{_0x2f3dd0(parseEmail(_0x53e1cb,_0x9a9929,_0x101306));}};exports[_0x2a28('0x42')]=function(_0x122a33){switch(_0x122a33){case _0x2a28('0x43'):return _0x2a28('0x44');case _0x2a28('0x45'):return _0x2a28('0x46');case _0x2a28('0x47'):return'imap-mail.outlook.com';case'outlook365':return _0x2a28('0x48');}return _0x2a28('0x49');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 03994e8..f2708b6 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 _0x38c1=['Imap','Smtp','exports','lodash','name','Service','key','SERV','active'];(function(_0x35b89c,_0x5ef9c6){var _0x3e1549=function(_0x488d6b){while(--_0x488d6b){_0x35b89c['push'](_0x35b89c['shift']());}};_0x3e1549(++_0x5ef9c6);}(_0x38c1,0x111));var _0x138c=function(_0x277415,_0x38968b){_0x277415=_0x277415-0x0;var _0x376342=_0x38c1[_0x277415];return _0x376342;};'use strict';var _=require(_0x138c('0x0'));function MailAccount(_0x52d844){this['id']=_0x52d844['id']||0x0;this[_0x138c('0x1')]=_0x52d844[_0x138c('0x1')]||_0x138c('0x2');this['key']=_0x52d844[_0x138c('0x3')]||_0x138c('0x4');this[_0x138c('0x5')]=_0x52d844['active']||![];this[_0x138c('0x6')]=_0x52d844[_0x138c('0x6')]||[];this[_0x138c('0x7')]=_0x52d844[_0x138c('0x7')]||[];}module[_0x138c('0x8')]=MailAccount; \ No newline at end of file +var _0x09ba=['key','SERV','active','Imap','Smtp','exports','lodash','name','Service'];(function(_0x1442c6,_0x2a51ad){var _0x3670e8=function(_0x1a2b90){while(--_0x1a2b90){_0x1442c6['push'](_0x1442c6['shift']());}};_0x3670e8(++_0x2a51ad);}(_0x09ba,0x189));var _0xa09b=function(_0x14a3d9,_0x12f232){_0x14a3d9=_0x14a3d9-0x0;var _0xeef905=_0x09ba[_0x14a3d9];return _0xeef905;};'use strict';var _=require(_0xa09b('0x0'));function MailAccount(_0x407ed0){this['id']=_0x407ed0['id']||0x0;this['name']=_0x407ed0[_0xa09b('0x1')]||_0xa09b('0x2');this[_0xa09b('0x3')]=_0x407ed0[_0xa09b('0x3')]||_0xa09b('0x4');this['active']=_0x407ed0[_0xa09b('0x5')]||![];this[_0xa09b('0x6')]=_0x407ed0[_0xa09b('0x6')]||[];this['Smtp']=_0x407ed0[_0xa09b('0x7')]||[];}module[_0xa09b('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 43aa74d..0dcb68c 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 _0x64db=['hasOwnProperty','prototype','initMailAccounts','length','isUndefined','merge','exports','../model/mailAccount','mailAccounts','mapKeys'];(function(_0x5723b6,_0x115a57){var _0xaa8065=function(_0x1e2613){while(--_0x1e2613){_0x5723b6['push'](_0x5723b6['shift']());}};_0xaa8065(++_0x115a57);}(_0x64db,0x1bf));var _0xb64d=function(_0xa86b2e,_0x428354){_0xa86b2e=_0xa86b2e-0x0;var _0x34ba67=_0x64db[_0xa86b2e];return _0x34ba67;};'use strict';var _=require('lodash');var MailAccount=require(_0xb64d('0x0'));var Realtime=function(){this[_0xb64d('0x1')]={};};function freeIsNotKey(_0x3a51fd,_0x36aed9,_0x4d064d){var _0x213eea=_[_0xb64d('0x2')](_0x3a51fd,function(_0x5c633c,_0x5cc907){return _0x5c633c[_0x4d064d];});for(var _0x316034 in _0x36aed9){if(_0x36aed9[_0xb64d('0x3')](_0x316034)){if(!_0x213eea[_0x316034]){delete _0x36aed9[_0x316034];}}}}Realtime[_0xb64d('0x4')]['mergeFromDatabase']=function(_0x4d3c95,_0x4f8fd2){for(var _0x5dde1d in _0x4f8fd2){if(_0x4d3c95[_0xb64d('0x3')](_0x5dde1d)){_0x4d3c95[_0x5dde1d]=_0x4f8fd2[_0x5dde1d];}}};Realtime[_0xb64d('0x4')][_0xb64d('0x5')]=function(){var _0x21c07c=this;return function(_0x2cb939){if(_0x2cb939){freeIsNotKey(_0x2cb939,_0x21c07c['mailAccounts'],'id');for(var _0x46cc6d=0x0,_0x1c6539={},_0x30c684={};_0x46cc6d<_0x2cb939[_0xb64d('0x6')];_0x46cc6d+=0x1){_0x1c6539=_0x2cb939[_0x46cc6d];if(_[_0xb64d('0x7')](_0x21c07c[_0xb64d('0x1')][_0x1c6539['id']])){_0x21c07c[_0xb64d('0x1')][_0x1c6539['id']]=new MailAccount(_0x1c6539);}else{_[_0xb64d('0x8')](_0x21c07c['mailAccounts'][_0x1c6539['id']],_0x1c6539);}}}return _0x21c07c[_0xb64d('0x1')];};};module[_0xb64d('0x9')]=Realtime; \ No newline at end of file +var _0xffad=['isUndefined','merge','exports','lodash','../model/mailAccount','prototype','mergeFromDatabase','hasOwnProperty','initMailAccounts','mailAccounts'];(function(_0x10dfb3,_0x3da2d4){var _0x27834e=function(_0x31acdd){while(--_0x31acdd){_0x10dfb3['push'](_0x10dfb3['shift']());}};_0x27834e(++_0x3da2d4);}(_0xffad,0x175));var _0xdffa=function(_0x38403b,_0x139335){_0x38403b=_0x38403b-0x0;var _0x22f2ba=_0xffad[_0x38403b];return _0x22f2ba;};'use strict';var _=require(_0xdffa('0x0'));var MailAccount=require(_0xdffa('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x3ba075,_0x10fe41,_0x5938e9){var _0x505bbe=_['mapKeys'](_0x3ba075,function(_0x49601c,_0x1989ae){return _0x49601c[_0x5938e9];});for(var _0x444ed2 in _0x10fe41){if(_0x10fe41['hasOwnProperty'](_0x444ed2)){if(!_0x505bbe[_0x444ed2]){delete _0x10fe41[_0x444ed2];}}}}Realtime[_0xdffa('0x2')][_0xdffa('0x3')]=function(_0x536778,_0x2bb7cc){for(var _0xbe9dd8 in _0x2bb7cc){if(_0x536778[_0xdffa('0x4')](_0xbe9dd8)){_0x536778[_0xbe9dd8]=_0x2bb7cc[_0xbe9dd8];}}};Realtime[_0xdffa('0x2')][_0xdffa('0x5')]=function(){var _0x4764f7=this;return function(_0x4679f8){if(_0x4679f8){freeIsNotKey(_0x4679f8,_0x4764f7[_0xdffa('0x6')],'id');for(var _0x2d0c2c=0x0,_0x892087={},_0x5badcb={};_0x2d0c2c<_0x4679f8['length'];_0x2d0c2c+=0x1){_0x892087=_0x4679f8[_0x2d0c2c];if(_[_0xdffa('0x7')](_0x4764f7[_0xdffa('0x6')][_0x892087['id']])){_0x4764f7[_0xdffa('0x6')][_0x892087['id']]=new MailAccount(_0x892087);}else{_[_0xdffa('0x8')](_0x4764f7[_0xdffa('0x6')][_0x892087['id']],_0x892087);}}}return _0x4764f7[_0xdffa('0x6')];};};module[_0xdffa('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index e659753..596baaf 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 _0x11d1=['GetMailAccount','name','email','active','key','TemplateId','MailServerIn','Imap','MailServerOut','Smtp','NotifyMailAccount','../client','Request'];(function(_0x4edb1f,_0x558fbc){var _0x15e97f=function(_0x286c06){while(--_0x286c06){_0x4edb1f['push'](_0x4edb1f['shift']());}};_0x15e97f(++_0x558fbc);}(_0x11d1,0x184));var _0x111d=function(_0x23b081,_0x4220ab){_0x23b081=_0x23b081-0x0;var _0x246c3f=_0x11d1[_0x23b081];return _0x246c3f;};'use strict';var client=require(_0x111d('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x111d('0x1')](_0x111d('0x2'),{'options':{'attributes':['id',_0x111d('0x3'),'service',_0x111d('0x4'),_0x111d('0x5'),_0x111d('0x6'),'ListId',_0x111d('0x7')],'raw':![],'include':[{'model':_0x111d('0x8'),'as':_0x111d('0x9')},{'model':_0x111d('0xa'),'as':_0x111d('0xb')}]},'log':'getMailAccount'});};};exports['notify']=function(_0x1ba64c,_0xdf4197){return client['Request'](_0x111d('0xc'),{'account':{'id':_0x1ba64c},'body':_0xdf4197,'log':_0x111d('0xc')});}; \ No newline at end of file +var _0x8cda=['Request','GetMailAccount','name','service','email','key','ListId','TemplateId','Imap','MailServerOut','Smtp','getMailAccount','notify','getMailAccounts'];(function(_0x3f4cd0,_0x303070){var _0x3f9f01=function(_0x6ced93){while(--_0x6ced93){_0x3f4cd0['push'](_0x3f4cd0['shift']());}};_0x3f9f01(++_0x303070);}(_0x8cda,0x1db));var _0xa8cd=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8cda[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports[_0xa8cd('0x0')]=function(){return function(){return client[_0xa8cd('0x1')](_0xa8cd('0x2'),{'options':{'attributes':['id',_0xa8cd('0x3'),_0xa8cd('0x4'),_0xa8cd('0x5'),'active',_0xa8cd('0x6'),_0xa8cd('0x7'),_0xa8cd('0x8')],'raw':![],'include':[{'model':'MailServerIn','as':_0xa8cd('0x9')},{'model':_0xa8cd('0xa'),'as':_0xa8cd('0xb')}]},'log':_0xa8cd('0xc')});};};exports[_0xa8cd('0xd')]=function(_0x2481ba,_0x13f394){return client[_0xa8cd('0x1')]('NotifyMailAccount',{'account':{'id':_0x2481ba},'body':_0x13f394,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index e4a134c..59f8a56 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 _0x33f4=['ShowSetting','loginMailFrequency','GetSettings','../client','getSettings','Request'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x33f4,0xcf));var _0x433f=function(_0x9ede64,_0x3c7a41){_0x9ede64=_0x9ede64-0x0;var _0x52c0b5=_0x33f4[_0x9ede64];return _0x52c0b5;};'use strict';var client=require(_0x433f('0x0'));exports[_0x433f('0x1')]=function(){return client[_0x433f('0x2')](_0x433f('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x433f('0x4')]},'log':_0x433f('0x5')});}; \ No newline at end of file +var _0x4000=['getSettings','ShowSetting','loginMailFrequency','GetSettings','../client'];(function(_0x3f3a50,_0xe24e48){var _0x41d125=function(_0x4b3fe1){while(--_0x4b3fe1){_0x3f3a50['push'](_0x3f3a50['shift']());}};_0x41d125(++_0xe24e48);}(_0x4000,0x158));var _0x0400=function(_0x18d745,_0x1543ab){_0x18d745=_0x18d745-0x0;var _0x1a41ea=_0x4000[_0x18d745];return _0x1a41ea;};'use strict';var client=require(_0x0400('0x0'));exports[_0x0400('0x1')]=function(){return client['Request'](_0x0400('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0400('0x3')]},'log':_0x0400('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 426a609..5113755 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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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 4171a6f..0725421 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 _0x6f69=['websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','sticky-session','ioredis','../../config/environment','createServer','timeout','port','socket.io'];(function(_0x3070f7,_0x142b7a){var _0x5a231f=function(_0x506689){while(--_0x506689){_0x3070f7['push'](_0x3070f7['shift']());}};_0x5a231f(++_0x142b7a);}(_0x6f69,0x118));var _0x96f6=function(_0x31c038,_0x6a6fdc){_0x31c038=_0x31c038-0x0;var _0xe53800=_0x6f69[_0x31c038];return _0xe53800;};'use strict';var _=require(_0x96f6('0x0'));var http=require('http');var express=require('express');var sticky=require(_0x96f6('0x1'));var Redis=require(_0x96f6('0x2'));var config=require(_0x96f6('0x3'));var app=express();var server=http[_0x96f6('0x4')](app);server[_0x96f6('0x5')]=0xdbba0;if(sticky['listen'](server,config[_0x96f6('0x6')])){var socketio=require(_0x96f6('0x7'))(server,{'transports':[_0x96f6('0x8'),_0x96f6('0x9')]});config[_0x96f6('0xa')]=_[_0x96f6('0xb')](config[_0x96f6('0xa')],{'host':_0x96f6('0xc'),'port':0x18eb});socketio[_0x96f6('0xd')](require(_0x96f6('0xe'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x96f6('0xa')])}));require(_0x96f6('0xf'))[_0x96f6('0x10')]();require(_0x96f6('0x11'))[_0x96f6('0x10')](socketio);require(_0x96f6('0x12'))['default'](app);require(_0x96f6('0x13'))['default'](app);}else{server[_0x96f6('0x14')](_0x96f6('0x15'),function(){console[_0x96f6('0x16')](_0x96f6('0x17'),config[_0x96f6('0x6')]);});}exports=module['exports']=app; \ No newline at end of file +var _0xc091=['../../config/socketio','../../config/express','../../routes','once','listening','port','exports','lodash','sticky-session','../../config/environment','createServer','timeout','listen','socket.io','polling','redis','localhost','adapter','socket.io-redis','../../config/triggers','default'];(function(_0x1e9b13,_0x78c34b){var _0x27254f=function(_0x3aa64d){while(--_0x3aa64d){_0x1e9b13['push'](_0x1e9b13['shift']());}};_0x27254f(++_0x78c34b);}(_0xc091,0x1ab));var _0x1c09=function(_0x45ce79,_0x5022c0){_0x45ce79=_0x45ce79-0x0;var _0x11f416=_0xc091[_0x45ce79];return _0x11f416;};'use strict';var _=require(_0x1c09('0x0'));var http=require('http');var express=require('express');var sticky=require(_0x1c09('0x1'));var Redis=require('ioredis');var config=require(_0x1c09('0x2'));var app=express();var server=http[_0x1c09('0x3')](app);server[_0x1c09('0x4')]=0xdbba0;if(sticky[_0x1c09('0x5')](server,config['port'])){var socketio=require(_0x1c09('0x6'))(server,{'transports':['websocket',_0x1c09('0x7')]});config['redis']=_['defaults'](config[_0x1c09('0x8')],{'host':_0x1c09('0x9'),'port':0x18eb});socketio[_0x1c09('0xa')](require(_0x1c09('0xb'))({'pubClient':new Redis(config[_0x1c09('0x8')]),'subClient':new Redis(config[_0x1c09('0x8')])}));require(_0x1c09('0xc'))[_0x1c09('0xd')]();require(_0x1c09('0xe'))['default'](socketio);require(_0x1c09('0xf'))[_0x1c09('0xd')](app);require(_0x1c09('0x10'))[_0x1c09('0xd')](app);}else{server[_0x1c09('0x11')](_0x1c09('0x12'),function(){console['log']('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x1c09('0x13')]);});}exports=module[_0x1c09('0x14')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 8d46b77..93a5daa 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 _0xd3ef=['message','catch','exports','jayson/promise','../../config/logger','routing','client','http','Request','request','then','debug','rpc','error'];(function(_0x292600,_0x120a55){var _0x2ef83b=function(_0xe2e801){while(--_0xe2e801){_0x292600['push'](_0x292600['shift']());}};_0x2ef83b(++_0x120a55);}(_0xd3ef,0x199));var _0xfd3e=function(_0xf1af27,_0x598bb1){_0xf1af27=_0xf1af27-0x0;var _0x46b274=_0xd3ef[_0xf1af27];return _0x46b274;};'use strict';var jayson=require(_0xfd3e('0x0'));var BPromise=require('bluebird');var logger=require(_0xfd3e('0x1'))(_0xfd3e('0x2'));var client=jayson[_0xfd3e('0x3')][_0xfd3e('0x4')]({'port':0x2329});client[_0xfd3e('0x5')]=function(_0x1793b6,_0x53fe1e){return new BPromise(function(_0x373739,_0x419e6a){return client[_0xfd3e('0x6')](_0x1793b6,_0x53fe1e)[_0xfd3e('0x7')](function(_0x4aa3c1){logger[_0xfd3e('0x8')](_0xfd3e('0x9'),_0xfd3e('0x2'),_0x1793b6,_0x53fe1e,_0x4aa3c1);if(_0x4aa3c1['error']){logger[_0xfd3e('0xa')](_0xfd3e('0x9'),_0xfd3e('0x2'),_0x1793b6,_0x4aa3c1[_0xfd3e('0xa')][_0xfd3e('0xb')],_0x53fe1e);return _0x419e6a(_0x4aa3c1['error'][_0xfd3e('0xb')]);}else{return _0x373739(_0x4aa3c1['result']);}})[_0xfd3e('0xc')](function(_0x39c170){logger[_0xfd3e('0xa')](_0xfd3e('0x9'),_0xfd3e('0x2'),_0x1793b6,_0x39c170,_0x53fe1e);return _0x419e6a(_0x39c170);});});};module[_0xfd3e('0xd')]=client; \ No newline at end of file +var _0x771a=['client','http','request','then','debug','rpc','error','message','result','catch','bluebird','routing'];(function(_0x53ec7f,_0x208f9a){var _0x5939e8=function(_0x44e002){while(--_0x44e002){_0x53ec7f['push'](_0x53ec7f['shift']());}};_0x5939e8(++_0x208f9a);}(_0x771a,0x15a));var _0xa771=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x771a[_0x6cf19c];return _0xce14f3;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xa771('0x0'));var logger=require('../../config/logger')(_0xa771('0x1'));var client=jayson[_0xa771('0x2')][_0xa771('0x3')]({'port':0x2329});client['Request']=function(_0x1d1aa5,_0x7f9497){return new BPromise(function(_0x4f5088,_0x2a423c){return client[_0xa771('0x4')](_0x1d1aa5,_0x7f9497)[_0xa771('0x5')](function(_0x2e08f8){logger[_0xa771('0x6')](_0xa771('0x7'),_0xa771('0x1'),_0x1d1aa5,_0x7f9497,_0x2e08f8);if(_0x2e08f8[_0xa771('0x8')]){logger['error']('rpc',_0xa771('0x1'),_0x1d1aa5,_0x2e08f8[_0xa771('0x8')][_0xa771('0x9')],_0x7f9497);return _0x2a423c(_0x2e08f8[_0xa771('0x8')][_0xa771('0x9')]);}else{return _0x4f5088(_0x2e08f8[_0xa771('0xa')]);}})[_0xa771('0xb')](function(_0x2f2aec){logger[_0xa771('0x8')](_0xa771('0x7'),_0xa771('0x1'),_0x1d1aa5,_0x2f2aec,_0x7f9497);return _0x2a423c(_0x2f2aec);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 5e4d2a5..576b67c 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 _0xb2d5=['initMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','getAgents','then','getIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues'];(function(_0x5b9fd4,_0x5a61dd){var _0xd7cf72=function(_0x38de4a){while(--_0x38de4a){_0x5b9fd4['push'](_0x5b9fd4['shift']());}};_0xd7cf72(++_0x5a61dd);}(_0xb2d5,0xc4));var _0x5b2d=function(_0x5d2360,_0x4efab1){_0x5d2360=_0x5d2360-0x0;var _0x5df16e=_0xb2d5[_0x5d2360];return _0x5df16e;};'use strict';var BPromise=require(_0x5b2d('0x0'));var server=require(_0x5b2d('0x1'));var Realtime=require(_0x5b2d('0x2'));var user=require(_0x5b2d('0x3'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x5b2d('0x4'));var chatQueue=require(_0x5b2d('0x5'));var smsQueue=require(_0x5b2d('0x6'));var mailQueue=require(_0x5b2d('0x7'));var faxQueue=require(_0x5b2d('0x8'));var whatsappQueue=require(_0x5b2d('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x5b2d('0xa')]()['then'](user[_0x5b2d('0xb')]())['then'](realtime['initAgents']())[_0x5b2d('0xc')](interval[_0x5b2d('0xd')]())['then'](realtime['initIntervals']())[_0x5b2d('0xc')](openchannelQueue[_0x5b2d('0xe')]())[_0x5b2d('0xc')](realtime['initOpenchannelQueues']())[_0x5b2d('0xc')](chatQueue[_0x5b2d('0xf')]())[_0x5b2d('0xc')](realtime[_0x5b2d('0x10')]())[_0x5b2d('0xc')](smsQueue[_0x5b2d('0x11')]())[_0x5b2d('0xc')](realtime[_0x5b2d('0x12')]())[_0x5b2d('0xc')](mailQueue[_0x5b2d('0x13')]())[_0x5b2d('0xc')](realtime[_0x5b2d('0x14')]())[_0x5b2d('0xc')](faxQueue['getFaxQueues']())['then'](realtime[_0x5b2d('0x15')]())[_0x5b2d('0xc')](whatsappQueue[_0x5b2d('0x16')]())['then'](realtime[_0x5b2d('0x17')]())[_0x5b2d('0xc')](function(){return realtime;});}function main(){return server[_0x5b2d('0x18')](realtime)[_0x5b2d('0xc')](function(_0x1e5197){return initRealtime();})['then'](function(_0x17d8ed){return setInterval(initRealtime,0x1388);})[_0x5b2d('0x19')](function(_0x543ed6){console[_0x5b2d('0x1a')](_0x543ed6);});}main(); \ No newline at end of file +var _0xc0c8=['./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','getAgents','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log'];(function(_0x1b2038,_0x563689){var _0x230800=function(_0x3ef0d2){while(--_0x3ef0d2){_0x1b2038['push'](_0x1b2038['shift']());}};_0x230800(++_0x563689);}(_0xc0c8,0x16c));var _0x8c0c=function(_0x1d1703,_0x55cd10){_0x1d1703=_0x1d1703-0x0;var _0x3df539=_0xc0c8[_0x1d1703];return _0x3df539;};'use strict';var BPromise=require('bluebird');var server=require(_0x8c0c('0x0'));var Realtime=require(_0x8c0c('0x1'));var user=require(_0x8c0c('0x2'));var interval=require(_0x8c0c('0x3'));var openchannelQueue=require(_0x8c0c('0x4'));var chatQueue=require(_0x8c0c('0x5'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x8c0c('0x6'));var faxQueue=require(_0x8c0c('0x7'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()['then'](user[_0x8c0c('0x8')]())[_0x8c0c('0x9')](realtime[_0x8c0c('0xa')]())[_0x8c0c('0x9')](interval[_0x8c0c('0xb')]())[_0x8c0c('0x9')](realtime[_0x8c0c('0xc')]())[_0x8c0c('0x9')](openchannelQueue[_0x8c0c('0xd')]())[_0x8c0c('0x9')](realtime[_0x8c0c('0xe')]())['then'](chatQueue[_0x8c0c('0xf')]())[_0x8c0c('0x9')](realtime[_0x8c0c('0x10')]())[_0x8c0c('0x9')](smsQueue[_0x8c0c('0x11')]())[_0x8c0c('0x9')](realtime[_0x8c0c('0x12')]())[_0x8c0c('0x9')](mailQueue[_0x8c0c('0x13')]())[_0x8c0c('0x9')](realtime[_0x8c0c('0x14')]())[_0x8c0c('0x9')](faxQueue[_0x8c0c('0x15')]())['then'](realtime[_0x8c0c('0x16')]())['then'](whatsappQueue[_0x8c0c('0x17')]())['then'](realtime[_0x8c0c('0x18')]())[_0x8c0c('0x9')](function(){return realtime;});}function main(){return server[_0x8c0c('0x19')](realtime)['then'](function(_0x222d17){return initRealtime();})[_0x8c0c('0x9')](function(_0xc763b6){return setInterval(initRealtime,0x1388);})[_0x8c0c('0x1a')](function(_0x50cd3b){console[_0x8c0c('0x1b')](_0x50cd3b);});}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 3a79936..3687c1f 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 _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x241179,_0x41e5b1){var _0x508ead=function(_0xaefffd){while(--_0xaefffd){_0x241179['push'](_0x241179['shift']());}};_0x508ead(++_0x41e5b1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xc4aa[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file +var _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x5b4dfd,_0x1f9bd0){var _0x1f7aec=function(_0x43d086){while(--_0x43d086){_0x5b4dfd['push'](_0x5b4dfd['shift']());}};_0x1f7aec(++_0x1f9bd0);}(_0x7a54,0x106));var _0x47a5=function(_0x390d89,_0x1098fc){_0x390d89=_0x390d89-0x0;var _0x199057=_0x7a54[_0x390d89];return _0x199057;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 46f0258..e0fe115 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 _0xaf04=['jayson/promise','http','request','then','error','message','result','catch','sendMailMessage','SendMail','bluebird'];(function(_0x49a906,_0xfd85db){var _0x1340ca=function(_0x582ed6){while(--_0x582ed6){_0x49a906['push'](_0x49a906['shift']());}};_0x1340ca(++_0xfd85db);}(_0xaf04,0x8e));var _0x4af0=function(_0x38456c,_0x4be32f){_0x38456c=_0x38456c-0x0;var _0x376186=_0xaf04[_0x38456c];return _0x376186;};'use strict';var BPromise=require(_0x4af0('0x0'));var jayson=require(_0x4af0('0x1'));var client=jayson['client'][_0x4af0('0x2')]({'port':0x232b});function request(_0x445b76,_0x2adb3e){return new BPromise(function(_0x23b50b,_0x5cd408){return client[_0x4af0('0x3')](_0x445b76,_0x2adb3e)[_0x4af0('0x4')](function(_0x2693d0){if(_0x2693d0[_0x4af0('0x5')]){return _0x5cd408(_0x2693d0['error'][_0x4af0('0x6')]);}else{return _0x23b50b(_0x2693d0[_0x4af0('0x7')]);}})[_0x4af0('0x8')](function(_0x1a4370){return _0x5cd408(_0x1a4370);});});}exports[_0x4af0('0x9')]=function(_0x33442c,_0x377e1b){return request(_0x4af0('0xa'),{'account':_0x33442c,'message':_0x377e1b});}; \ No newline at end of file +var _0x5687=['message','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5687,0x1f1));var _0x7568=function(_0x5cdd3e,_0x3976ea){_0x5cdd3e=_0x5cdd3e-0x0;var _0x2303be=_0x5687[_0x5cdd3e];return _0x2303be;};'use strict';var BPromise=require(_0x7568('0x0'));var jayson=require(_0x7568('0x1'));var client=jayson[_0x7568('0x2')][_0x7568('0x3')]({'port':0x232b});function request(_0x7607b,_0x1a3f6f){return new BPromise(function(_0x183c2b,_0x4e4951){return client[_0x7568('0x4')](_0x7607b,_0x1a3f6f)[_0x7568('0x5')](function(_0x1a724b){if(_0x1a724b[_0x7568('0x6')]){return _0x4e4951(_0x1a724b[_0x7568('0x6')][_0x7568('0x7')]);}else{return _0x183c2b(_0x1a724b[_0x7568('0x8')]);}})[_0x7568('0x9')](function(_0x2a90e3){return _0x4e4951(_0x2a90e3);});});}exports[_0x7568('0xa')]=function(_0x5e2b33,_0x3b4008){return request(_0x7568('0xb'),{'account':_0x5e2b33,'message':_0x3b4008});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 0a195fb..dc1295b 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 _0x0e16=['ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','updateRealtime','prototype','getChannelStatus','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','mailPause','faxStatus','faxStatusTime','whatsappStatusTime','whatsappCurrentCapacity','openchannelStatusTime','busyQueue','stringify','emit','user:save','exports','lodash','moment','md5'];(function(_0x7341a9,_0x9e663b){var _0x52bca9=function(_0x372a82){while(--_0x372a82){_0x7341a9['push'](_0x7341a9['shift']());}};_0x52bca9(++_0x9e663b);}(_0x0e16,0x183));var _0x60e1=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x0e16[_0x1da04e];return _0xdd8c41;};'use strict';var _=require(_0x60e1('0x0'));var moment=require(_0x60e1('0x1'));var md5=require(_0x60e1('0x2'));var Redis=require(_0x60e1('0x3'));var config=require(_0x60e1('0x4'));config[_0x60e1('0x5')]=_[_0x60e1('0x6')](config[_0x60e1('0x5')],{'host':_0x60e1('0x7'),'port':0x18eb});var io=require(_0x60e1('0x8'))(new Redis(config[_0x60e1('0x5')]));function Agent(_0x3664e2){this['id']=_0x3664e2['id']||0x0;this['name']=_0x3664e2[_0x60e1('0x9')]||'';this['online']=_0x3664e2[_0x60e1('0xa')]||!![];this[_0x60e1('0xb')]=_0x3664e2[_0x60e1('0xb')]||![];this[_0x60e1('0xc')]=_0x3664e2[_0x60e1('0xc')]||![];this['mailPause']=_0x3664e2['mailPause']||![];this[_0x60e1('0xd')]=_0x3664e2[_0x60e1('0xd')]||![];this[_0x60e1('0xe')]=_0x3664e2[_0x60e1('0xe')]||![];this[_0x60e1('0xf')]=_0x3664e2[_0x60e1('0xf')]||![];this[_0x60e1('0x10')]=_0x60e1('0x11');this[_0x60e1('0x12')]=0x0;this[_0x60e1('0x13')]=_0x3664e2[_0x60e1('0x13')]||0x0;this[_0x60e1('0x14')]=0x0;this['mailStatus']=_0x60e1('0x11');this[_0x60e1('0x15')]=0x0;this[_0x60e1('0x16')]=_0x3664e2[_0x60e1('0x16')]||0x0;this[_0x60e1('0x17')]=0x0;this['faxStatus']=_0x60e1('0x11');this['faxStatusTime']=0x0;this[_0x60e1('0x18')]=_0x3664e2['faxCapacity']||0x0;this[_0x60e1('0x19')]=0x0;this[_0x60e1('0x1a')]='unknown';this[_0x60e1('0x1b')]=0x0;this[_0x60e1('0x1c')]=_0x3664e2[_0x60e1('0x1c')]||0x0;this[_0x60e1('0x1d')]=0x0;this[_0x60e1('0x1e')]='unknown';this['whatsappStatusTime']=0x0;this[_0x60e1('0x1f')]=_0x3664e2['whatsappCapacity']||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x60e1('0x20')]='unknown';this['openchannelStatusTime']=0x0;this[_0x60e1('0x21')]=_0x3664e2['openchannelCapacity']||0x0;this[_0x60e1('0x22')]=0x0;this[_0x60e1('0x23')]=![];this['busyQueue']=undefined;this[_0x60e1('0x2')]='';this[_0x60e1('0x24')]();}Agent[_0x60e1('0x25')][_0x60e1('0x26')]=function(_0x88f777){if(this[_0x88f777+'CurrentCapacity']>0x0){if(this[_0x88f777+_0x60e1('0x27')]>0x0&&this[_0x88f777+'CurrentCapacity']>=this[_0x88f777+'Capacity']){return _0x60e1('0x28');}else{return _0x60e1('0x29');}}else{return _0x60e1('0x2a');}};Agent[_0x60e1('0x25')][_0x60e1('0x24')]=function(){var _0x1b1617=[_0x60e1('0x2b'),_0x60e1('0x2c'),_0x60e1('0x2d'),_0x60e1('0x2e'),_0x60e1('0x2f'),_0x60e1('0x30')];for(var _0x5ea803=0x0;_0x5ea803<_0x1b1617[_0x60e1('0x31')];_0x5ea803+=0x1){var _0x3fef77=this['getChannelStatus'](_0x1b1617[_0x5ea803]);if(this[_0x1b1617[_0x5ea803]+_0x60e1('0x32')]!==_0x3fef77){this[_0x1b1617[_0x5ea803]+_0x60e1('0x33')]=_[_0x60e1('0x34')](moment()[_0x60e1('0x35')]('x'));}this[_0x1b1617[_0x5ea803]+_0x60e1('0x32')]=_0x3fef77;}var _0x1be296={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0x60e1('0xb')],'chatPause':this[_0x60e1('0xc')],'mailPause':this[_0x60e1('0x36')],'smsPause':this[_0x60e1('0xe')],'faxPause':this['faxPause'],'openchannelPause':this[_0x60e1('0xf')],'chatStatus':this[_0x60e1('0x10')],'chatStatusTime':this[_0x60e1('0x12')],'chatCapacity':this[_0x60e1('0x13')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x60e1('0x15')],'mailCapacity':this[_0x60e1('0x16')],'mailCurrentCapacity':this[_0x60e1('0x17')],'faxStatus':this[_0x60e1('0x37')],'faxStatusTime':this[_0x60e1('0x38')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x60e1('0x19')],'smsStatus':this[_0x60e1('0x1a')],'smsStatusTime':this[_0x60e1('0x1b')],'smsCapacity':this[_0x60e1('0x1c')],'smsCurrentCapacity':this[_0x60e1('0x1d')],'whatsappStatus':this[_0x60e1('0x1e')],'whatsappStatusTime':this[_0x60e1('0x39')],'whatsappCapacity':this[_0x60e1('0x1f')],'whatsappCurrentCapacity':this[_0x60e1('0x3a')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x60e1('0x3b')],'openchannelCapacity':this[_0x60e1('0x21')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0x60e1('0x3c')]};var _0x176efc=md5(JSON[_0x60e1('0x3d')](_0x1be296));if(this['md5']!==_0x176efc){this[_0x60e1('0x2')]=_0x176efc;io[_0x60e1('0x3e')](_0x60e1('0x3f'),_0x1be296);}};module[_0x60e1('0x40')]=Agent; \ No newline at end of file +var _0x0b70=['voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','getChannelStatus','Capacity','CurrentCapacity','maxcapacity','idle','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','chatCurrentCapacity','faxStatus','whatsappCurrentCapacity','openchannelStatusTime','emit','exports','lodash','moment','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','online'];(function(_0x46ca72,_0x2e8625){var _0x4835c3=function(_0x4107bd){while(--_0x4107bd){_0x46ca72['push'](_0x46ca72['shift']());}};_0x4835c3(++_0x2e8625);}(_0x0b70,0x192));var _0x00b7=function(_0x34904e,_0x4549ac){_0x34904e=_0x34904e-0x0;var _0x4cf5e2=_0x0b70[_0x34904e];return _0x4cf5e2;};'use strict';var _=require(_0x00b7('0x0'));var moment=require(_0x00b7('0x1'));var md5=require(_0x00b7('0x2'));var Redis=require(_0x00b7('0x3'));var config=require(_0x00b7('0x4'));config['redis']=_[_0x00b7('0x5')](config[_0x00b7('0x6')],{'host':_0x00b7('0x7'),'port':0x18eb});var io=require(_0x00b7('0x8'))(new Redis(config[_0x00b7('0x6')]));function Agent(_0x288e58){this['id']=_0x288e58['id']||0x0;this[_0x00b7('0x9')]=_0x288e58[_0x00b7('0x9')]||'';this[_0x00b7('0xa')]=_0x288e58['online']||!![];this[_0x00b7('0xb')]=_0x288e58[_0x00b7('0xb')]||![];this[_0x00b7('0xc')]=_0x288e58['chatPause']||![];this[_0x00b7('0xd')]=_0x288e58[_0x00b7('0xd')]||![];this['faxPause']=_0x288e58[_0x00b7('0xe')]||![];this[_0x00b7('0xf')]=_0x288e58['smsPause']||![];this[_0x00b7('0x10')]=_0x288e58[_0x00b7('0x10')]||![];this['chatStatus']=_0x00b7('0x11');this[_0x00b7('0x12')]=0x0;this['chatCapacity']=_0x288e58[_0x00b7('0x13')]||0x0;this['chatCurrentCapacity']=0x0;this[_0x00b7('0x14')]='unknown';this[_0x00b7('0x15')]=0x0;this[_0x00b7('0x16')]=_0x288e58['mailCapacity']||0x0;this[_0x00b7('0x17')]=0x0;this['faxStatus']=_0x00b7('0x11');this['faxStatusTime']=0x0;this[_0x00b7('0x18')]=_0x288e58[_0x00b7('0x18')]||0x0;this[_0x00b7('0x19')]=0x0;this[_0x00b7('0x1a')]=_0x00b7('0x11');this[_0x00b7('0x1b')]=0x0;this[_0x00b7('0x1c')]=_0x288e58[_0x00b7('0x1c')]||0x0;this[_0x00b7('0x1d')]=0x0;this[_0x00b7('0x1e')]=_0x00b7('0x11');this[_0x00b7('0x1f')]=0x0;this[_0x00b7('0x20')]=_0x288e58['whatsappCapacity']||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']=_0x00b7('0x11');this['openchannelStatusTime']=0x0;this[_0x00b7('0x21')]=_0x288e58[_0x00b7('0x21')]||0x0;this[_0x00b7('0x22')]=0x0;this[_0x00b7('0x23')]=![];this[_0x00b7('0x24')]=undefined;this[_0x00b7('0x2')]='';this[_0x00b7('0x25')]();}Agent['prototype'][_0x00b7('0x26')]=function(_0x9e9f8c){if(this[_0x9e9f8c+'CurrentCapacity']>0x0){if(this[_0x9e9f8c+_0x00b7('0x27')]>0x0&&this[_0x9e9f8c+_0x00b7('0x28')]>=this[_0x9e9f8c+_0x00b7('0x27')]){return _0x00b7('0x29');}else{return'working';}}else{return _0x00b7('0x2a');}};Agent['prototype'][_0x00b7('0x25')]=function(){var _0x4b1960=['mail',_0x00b7('0x2b'),_0x00b7('0x2c'),_0x00b7('0x2d'),_0x00b7('0x2e'),_0x00b7('0x2f')];for(var _0x3f3aa4=0x0;_0x3f3aa4<_0x4b1960[_0x00b7('0x30')];_0x3f3aa4+=0x1){var _0x167b89=this['getChannelStatus'](_0x4b1960[_0x3f3aa4]);if(this[_0x4b1960[_0x3f3aa4]+_0x00b7('0x31')]!==_0x167b89){this[_0x4b1960[_0x3f3aa4]+_0x00b7('0x32')]=_[_0x00b7('0x33')](moment()[_0x00b7('0x34')]('x'));}this[_0x4b1960[_0x3f3aa4]+'Status']=_0x167b89;}var _0x129b78={'id':this['id'],'name':this[_0x00b7('0x9')],'online':this[_0x00b7('0xa')],'voicePause':this[_0x00b7('0xb')],'chatPause':this[_0x00b7('0xc')],'mailPause':this[_0x00b7('0xd')],'smsPause':this[_0x00b7('0xf')],'faxPause':this[_0x00b7('0xe')],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x00b7('0x12')],'chatCapacity':this[_0x00b7('0x13')],'chatCurrentCapacity':this[_0x00b7('0x35')],'mailStatus':this[_0x00b7('0x14')],'mailStatusTime':this[_0x00b7('0x15')],'mailCapacity':this[_0x00b7('0x16')],'mailCurrentCapacity':this[_0x00b7('0x17')],'faxStatus':this[_0x00b7('0x36')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x00b7('0x18')],'faxCurrentCapacity':this[_0x00b7('0x19')],'smsStatus':this[_0x00b7('0x1a')],'smsStatusTime':this[_0x00b7('0x1b')],'smsCapacity':this[_0x00b7('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x00b7('0x1e')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x00b7('0x37')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x00b7('0x38')],'openchannelCapacity':this[_0x00b7('0x21')],'openchannelCurrentCapacity':this[_0x00b7('0x22')],'busy':this[_0x00b7('0x23')],'busyQueue':this['busyQueue']};var _0x2d1438=md5(JSON['stringify'](_0x129b78));if(this[_0x00b7('0x2')]!==_0x2d1438){this['md5']=_0x2d1438;io[_0x00b7('0x39')]('user:save',_0x129b78);}};module[_0x00b7('0x3a')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 0218ad6..23db06b 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 _0x6bae=['available','paused','stringify','format','chat:queue:%s','exports','lodash','md5','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','map','_rr','loggedIn','length','online','chatPause'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x6bae,0x102));var _0xe6ba=function(_0x53051d,_0x4346c1){_0x53051d=_0x53051d-0x0;var _0x8e374e=_0x6bae[_0x53051d];return _0x8e374e;};'use strict';var _=require(_0xe6ba('0x0'));var md5=require(_0xe6ba('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0xe6ba('0x2'));config[_0xe6ba('0x3')]=_['defaults'](config['redis'],{'host':_0xe6ba('0x4'),'port':0x18eb});var io=require(_0xe6ba('0x5'))(new Redis(config[_0xe6ba('0x3')]));function ChatQueue(_0x37a510){this['id']=_0x37a510['id']||0x0;this[_0xe6ba('0x6')]=_0x37a510[_0xe6ba('0x6')]||'';this[_0xe6ba('0x7')]=_0x37a510[_0xe6ba('0x7')]||0xa;this['strategy']=_0x37a510[_0xe6ba('0x8')]||_0xe6ba('0x9');this[_0xe6ba('0xa')]=_0x37a510[_0xe6ba('0xa')];this[_0xe6ba('0xb')]={};this[_0xe6ba('0xc')]=0x0;this[_0xe6ba('0x1')]='';this['updateRouting']();this[_0xe6ba('0xd')]();}ChatQueue[_0xe6ba('0xe')][_0xe6ba('0xf')]=function(){var _0x57548e=this['mapAgentsId']['_rr'];this[_0xe6ba('0xb')]=_[_0xe6ba('0x10')](this[_0xe6ba('0xa')],'id');this[_0xe6ba('0xb')][_0xe6ba('0x11')]=_0x57548e;};ChatQueue[_0xe6ba('0xe')][_0xe6ba('0xd')]=function(){this[_0xe6ba('0x12')]=0x0;this['paused']=0x0;for(var _0x5bbe88=0x0;_0x5bbe88=0x0?this[_0xe6ba('0x16')]:0x0;var _0xe93fc3={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xe6ba('0x6')],'paused':this[_0xe6ba('0x17')],'waiting':this[_0xe6ba('0xc')]};var _0x3edce6=md5(JSON[_0xe6ba('0x18')](_0xe93fc3));if(this[_0xe6ba('0x1')]!==_0x3edce6){this[_0xe6ba('0x1')]=_0x3edce6;io['to'](util[_0xe6ba('0x19')](_0xe6ba('0x1a'),_0xe93fc3[_0xe6ba('0x6')]))['emit']('chat_queue:save',_0xe93fc3);}};module[_0xe6ba('0x1b')]=ChatQueue; \ No newline at end of file +var _0x88ab=['exports','ioredis','../../../config/environment','redis','defaults','name','timeout','strategy','beepall','Agents','md5','updateRouting','prototype','mapAgentsId','_rr','map','updateRealtime','loggedIn','paused','length','chatPause','available','format','chat:queue:%s','chat_queue:save'];(function(_0x441a2a,_0x5cf076){var _0x1bc386=function(_0x11b87e){while(--_0x11b87e){_0x441a2a['push'](_0x441a2a['shift']());}};_0x1bc386(++_0x5cf076);}(_0x88ab,0x1dc));var _0xb88a=function(_0x146f48,_0x475f61){_0x146f48=_0x146f48-0x0;var _0x2f5766=_0x88ab[_0x146f48];return _0x2f5766;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0xb88a('0x0'));var config=require(_0xb88a('0x1'));config[_0xb88a('0x2')]=_[_0xb88a('0x3')](config[_0xb88a('0x2')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x48e1e7){this['id']=_0x48e1e7['id']||0x0;this[_0xb88a('0x4')]=_0x48e1e7[_0xb88a('0x4')]||'';this['timeout']=_0x48e1e7[_0xb88a('0x5')]||0xa;this[_0xb88a('0x6')]=_0x48e1e7[_0xb88a('0x6')]||_0xb88a('0x7');this[_0xb88a('0x8')]=_0x48e1e7['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0xb88a('0x9')]='';this[_0xb88a('0xa')]();this['updateRealtime']();}ChatQueue[_0xb88a('0xb')][_0xb88a('0xa')]=function(){var _0xd26241=this[_0xb88a('0xc')][_0xb88a('0xd')];this[_0xb88a('0xc')]=_[_0xb88a('0xe')](this[_0xb88a('0x8')],'id');this[_0xb88a('0xc')][_0xb88a('0xd')]=_0xd26241;};ChatQueue[_0xb88a('0xb')][_0xb88a('0xf')]=function(){this[_0xb88a('0x10')]=0x0;this[_0xb88a('0x11')]=0x0;for(var _0x5e360e=0x0;_0x5e360e=0x0?this[_0xb88a('0x14')]:0x0;var _0x2dfa5c={'id':this['id'],'available':this[_0xb88a('0x14')],'loggedIn':this[_0xb88a('0x10')],'name':this[_0xb88a('0x4')],'paused':this[_0xb88a('0x11')],'waiting':this['waiting']};var _0x3723c4=md5(JSON['stringify'](_0x2dfa5c));if(this[_0xb88a('0x9')]!==_0x3723c4){this['md5']=_0x3723c4;io['to'](util[_0xb88a('0x15')](_0xb88a('0x16'),_0x2dfa5c[_0xb88a('0x4')]))['emit'](_0xb88a('0x17'),_0x2dfa5c);}};module[_0xb88a('0x18')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index ec10bdc..d2df4ac 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 _0x9945=['fax_queue:save','exports','lodash','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','available','fax:queue:%s'];(function(_0x346d45,_0x6db175){var _0x548330=function(_0x41e453){while(--_0x41e453){_0x346d45['push'](_0x346d45['shift']());}};_0x548330(++_0x6db175);}(_0x9945,0x1bc));var _0x5994=function(_0x1305a2,_0x35767d){_0x1305a2=_0x1305a2-0x0;var _0x536183=_0x9945[_0x1305a2];return _0x536183;};'use strict';var _=require(_0x5994('0x0'));var md5=require(_0x5994('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x5994('0x2'));config[_0x5994('0x3')]=_[_0x5994('0x4')](config['redis'],{'host':_0x5994('0x5'),'port':0x18eb});var io=require(_0x5994('0x6'))(new Redis(config[_0x5994('0x3')]));function FaxQueue(_0x3d0359){this['id']=_0x3d0359['id']||0x0;this[_0x5994('0x7')]=_0x3d0359[_0x5994('0x7')]||'';this[_0x5994('0x8')]=_0x3d0359[_0x5994('0x8')]||0xa;this[_0x5994('0x9')]=_0x3d0359['strategy']||_0x5994('0xa');this[_0x5994('0xb')]=_0x3d0359[_0x5994('0xb')];this[_0x5994('0xc')]={};this[_0x5994('0xd')]=0x0;this[_0x5994('0x1')]='';this[_0x5994('0xe')]();this[_0x5994('0xf')]();}FaxQueue[_0x5994('0x10')][_0x5994('0xe')]=function(){var _0x1db2f5=this[_0x5994('0xc')][_0x5994('0x11')];this['mapAgentsId']=_[_0x5994('0x12')](this[_0x5994('0xb')],'id');this['mapAgentsId'][_0x5994('0x11')]=_0x1db2f5;};FaxQueue[_0x5994('0x10')]['updateRealtime']=function(){this[_0x5994('0x13')]=0x0;this[_0x5994('0x14')]=0x0;for(var _0x5c5b43=0x0;_0x5c5b43=0x0?this[_0x5994('0x16')]:0x0;var _0x43babf={'id':this['id'],'available':this[_0x5994('0x16')],'loggedIn':this[_0x5994('0x13')],'name':this['name'],'paused':this[_0x5994('0x14')],'waiting':this[_0x5994('0xd')]};var _0x310c6d=md5(JSON['stringify'](_0x43babf));if(this[_0x5994('0x1')]!==_0x310c6d){this[_0x5994('0x1')]=_0x310c6d;io['to'](util['format'](_0x5994('0x17'),_0x43babf['name']))['emit'](_0x5994('0x18'),_0x43babf);}};module[_0x5994('0x19')]=FaxQueue; \ No newline at end of file +var _0xf95d=['faxPause','available','stringify','fax:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','online'];(function(_0x497fca,_0x377648){var _0x2401e3=function(_0x1dd613){while(--_0x1dd613){_0x497fca['push'](_0x497fca['shift']());}};_0x2401e3(++_0x377648);}(_0xf95d,0x156));var _0xdf95=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xf95d[_0x24f31b];return _0x488401;};'use strict';var _=require(_0xdf95('0x0'));var md5=require(_0xdf95('0x1'));var util=require(_0xdf95('0x2'));var Redis=require(_0xdf95('0x3'));var config=require(_0xdf95('0x4'));config[_0xdf95('0x5')]=_['defaults'](config['redis'],{'host':_0xdf95('0x6'),'port':0x18eb});var io=require(_0xdf95('0x7'))(new Redis(config[_0xdf95('0x5')]));function FaxQueue(_0x1a0d19){this['id']=_0x1a0d19['id']||0x0;this[_0xdf95('0x8')]=_0x1a0d19[_0xdf95('0x8')]||'';this[_0xdf95('0x9')]=_0x1a0d19[_0xdf95('0x9')]||0xa;this[_0xdf95('0xa')]=_0x1a0d19['strategy']||'beepall';this[_0xdf95('0xb')]=_0x1a0d19[_0xdf95('0xb')];this['mapAgentsId']={};this[_0xdf95('0xc')]=0x0;this['md5']='';this[_0xdf95('0xd')]();this[_0xdf95('0xe')]();}FaxQueue[_0xdf95('0xf')][_0xdf95('0xd')]=function(){var _0x30b6f5=this[_0xdf95('0x10')][_0xdf95('0x11')];this[_0xdf95('0x10')]=_[_0xdf95('0x12')](this[_0xdf95('0xb')],'id');this[_0xdf95('0x10')]['_rr']=_0x30b6f5;};FaxQueue[_0xdf95('0xf')]['updateRealtime']=function(){this[_0xdf95('0x13')]=0x0;this[_0xdf95('0x14')]=0x0;for(var _0x1a09aa=0x0;_0x1a09aa=0x0?this[_0xdf95('0x17')]:0x0;var _0xe354f9={'id':this['id'],'available':this['available'],'loggedIn':this[_0xdf95('0x13')],'name':this[_0xdf95('0x8')],'paused':this[_0xdf95('0x14')],'waiting':this[_0xdf95('0xc')]};var _0x2c6e51=md5(JSON[_0xdf95('0x18')](_0xe354f9));if(this[_0xdf95('0x1')]!==_0x2c6e51){this['md5']=_0x2c6e51;io['to'](util['format'](_0xdf95('0x19'),_0xe354f9[_0xdf95('0x8')]))[_0xdf95('0x1a')]('fax_queue:save',_0xe354f9);}};module[_0xdf95('0x1b')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 6163a68..8e8a95c 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 _0xa6e2=['Intervals','name'];(function(_0x35d90b,_0x157231){var _0x4bd6f4=function(_0x1d3fbf){while(--_0x1d3fbf){_0x35d90b['push'](_0x35d90b['shift']());}};_0x4bd6f4(++_0x157231);}(_0xa6e2,0x137));var _0x2a6e=function(_0x5a5273,_0x49908b){_0x5a5273=_0x5a5273-0x0;var _0x3a2abb=_0xa6e2[_0x5a5273];return _0x3a2abb;};'use strict';function Interval(_0x1b7121){this['id']=_0x1b7121['id']||0x0;this['name']=_0x1b7121[_0x2a6e('0x0')]||'';this[_0x2a6e('0x1')]=_0x1b7121[_0x2a6e('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0xf625=['Intervals','name'];(function(_0x22ec81,_0x4b6958){var _0x4dac5c=function(_0x5e96d6){while(--_0x5e96d6){_0x22ec81['push'](_0x22ec81['shift']());}};_0x4dac5c(++_0x4b6958);}(_0xf625,0x1df));var _0x5f62=function(_0x7835a,_0x7ef740){_0x7835a=_0x7835a-0x0;var _0xd46e11=_0xf625[_0x7835a];return _0xd46e11;};'use strict';function Interval(_0x4da873){this['id']=_0x4da873['id']||0x0;this[_0x5f62('0x0')]=_0x4da873['name']||'';this[_0x5f62('0x1')]=_0x4da873[_0x5f62('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 6159dbe..d8b0fbf 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 _0x1609=['_rr','map','loggedIn','length','online','mailPause','paused','available','stringify','mail:queue:%s','emit','mail_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype'];(function(_0x5178fb,_0x121e19){var _0x348183=function(_0x52c2ec){while(--_0x52c2ec){_0x5178fb['push'](_0x5178fb['shift']());}};_0x348183(++_0x121e19);}(_0x1609,0x79));var _0x9160=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x1609[_0x311c35];return _0x5cc50c;};'use strict';var _=require('lodash');var md5=require(_0x9160('0x0'));var util=require(_0x9160('0x1'));var Redis=require(_0x9160('0x2'));var config=require(_0x9160('0x3'));config[_0x9160('0x4')]=_['defaults'](config[_0x9160('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x9160('0x5'))(new Redis(config[_0x9160('0x4')]));function MailQueue(_0x883235){this['id']=_0x883235['id']||0x0;this[_0x9160('0x6')]=_0x883235[_0x9160('0x6')]||'';this[_0x9160('0x7')]=_0x883235[_0x9160('0x7')]||0xa;this[_0x9160('0x8')]=_0x883235['strategy']||'beepall';this['Agents']=_0x883235[_0x9160('0x9')];this[_0x9160('0xa')]={};this[_0x9160('0xb')]=0x0;this[_0x9160('0x0')]='';this['updateRouting']();this[_0x9160('0xc')]();}MailQueue[_0x9160('0xd')]['updateRouting']=function(){var _0xed18ff=this['mapAgentsId'][_0x9160('0xe')];this[_0x9160('0xa')]=_[_0x9160('0xf')](this[_0x9160('0x9')],'id');this['mapAgentsId'][_0x9160('0xe')]=_0xed18ff;};MailQueue[_0x9160('0xd')]['updateRealtime']=function(){this[_0x9160('0x10')]=0x0;this['paused']=0x0;for(var _0x2b5fcb=0x0;_0x2b5fcb=0x0?this[_0x9160('0x15')]:0x0;var _0x48f6c6={'id':this['id'],'available':this['available'],'loggedIn':this[_0x9160('0x10')],'name':this[_0x9160('0x6')],'paused':this[_0x9160('0x14')],'waiting':this['waiting']};var _0x37eca3=md5(JSON[_0x9160('0x16')](_0x48f6c6));if(this['md5']!==_0x37eca3){this[_0x9160('0x0')]=_0x37eca3;io['to'](util['format'](_0x9160('0x17'),_0x48f6c6[_0x9160('0x6')]))[_0x9160('0x18')](_0x9160('0x19'),_0x48f6c6);}};module[_0x9160('0x1a')]=MailQueue; \ No newline at end of file +var _0x4d2e=['updateRouting','prototype','_rr','map','updateRealtime','loggedIn','online','mailPause','paused','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5'];(function(_0x885eff,_0x555809){var _0x17819f=function(_0x3a69f0){while(--_0x3a69f0){_0x885eff['push'](_0x885eff['shift']());}};_0x17819f(++_0x555809);}(_0x4d2e,0xca));var _0xe4d2=function(_0x3b3980,_0x2f3141){_0x3b3980=_0x3b3980-0x0;var _0x511f27=_0x4d2e[_0x3b3980];return _0x511f27;};'use strict';var _=require(_0xe4d2('0x0'));var md5=require('md5');var util=require(_0xe4d2('0x1'));var Redis=require(_0xe4d2('0x2'));var config=require('../../../config/environment');config[_0xe4d2('0x3')]=_[_0xe4d2('0x4')](config['redis'],{'host':_0xe4d2('0x5'),'port':0x18eb});var io=require(_0xe4d2('0x6'))(new Redis(config[_0xe4d2('0x3')]));function MailQueue(_0x5981bc){this['id']=_0x5981bc['id']||0x0;this['name']=_0x5981bc[_0xe4d2('0x7')]||'';this[_0xe4d2('0x8')]=_0x5981bc[_0xe4d2('0x8')]||0xa;this[_0xe4d2('0x9')]=_0x5981bc[_0xe4d2('0x9')]||_0xe4d2('0xa');this[_0xe4d2('0xb')]=_0x5981bc['Agents'];this[_0xe4d2('0xc')]={};this[_0xe4d2('0xd')]=0x0;this[_0xe4d2('0xe')]='';this[_0xe4d2('0xf')]();this['updateRealtime']();}MailQueue[_0xe4d2('0x10')][_0xe4d2('0xf')]=function(){var _0x537a29=this[_0xe4d2('0xc')][_0xe4d2('0x11')];this[_0xe4d2('0xc')]=_[_0xe4d2('0x12')](this[_0xe4d2('0xb')],'id');this[_0xe4d2('0xc')][_0xe4d2('0x11')]=_0x537a29;};MailQueue['prototype'][_0xe4d2('0x13')]=function(){this[_0xe4d2('0x14')]=0x0;this['paused']=0x0;for(var _0x21f10a=0x0;_0x21f10a=0x0?this[_0xe4d2('0x18')]:0x0;var _0x5a77af={'id':this['id'],'available':this[_0xe4d2('0x18')],'loggedIn':this[_0xe4d2('0x14')],'name':this['name'],'paused':this[_0xe4d2('0x17')],'waiting':this[_0xe4d2('0xd')]};var _0x1c93c0=md5(JSON[_0xe4d2('0x19')](_0x5a77af));if(this[_0xe4d2('0xe')]!==_0x1c93c0){this[_0xe4d2('0xe')]=_0x1c93c0;io['to'](util[_0xe4d2('0x1a')](_0xe4d2('0x1b'),_0x5a77af['name']))[_0xe4d2('0x1c')](_0xe4d2('0x1d'),_0x5a77af);}};module[_0xe4d2('0x1e')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index fffeead..98f7145 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 _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x5c78d9,_0x2736c7){var _0x69ae1f=function(_0x4b31ac){while(--_0x4b31ac){_0x5c78d9['push'](_0x5c78d9['shift']());}};_0x69ae1f(++_0x2736c7);}(_0x2ef3,0xba));var _0x32ef=function(_0x1961f1,_0x8c0bcd){_0x1961f1=_0x1961f1-0x0;var _0x1b7c7c=_0x2ef3[_0x1961f1];return _0x1b7c7c;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x4f08dd,_0x3784ec){var _0x3017ee=function(_0x7d95be){while(--_0x7d95be){_0x4f08dd['push'](_0x4f08dd['shift']());}};_0x3017ee(++_0x3784ec);}(_0x2ef3,0xba));var _0x32ef=function(_0x34ef91,_0x3c9cce){_0x34ef91=_0x34ef91-0x0;var _0x5a0075=_0x2ef3[_0x34ef91];return _0x5a0075;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index ed82c6a..ff13eb1 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 _0x0e85=['waiting','updateRouting','updateRealtime','prototype','mapAgentsId','map','loggedIn','paused','length','smsPause','available','stringify','format','sms:queue:%s','emit','exports','lodash','md5','ioredis','../../../config/environment','localhost','redis','name','timeout','strategy','beepall','Agents'];(function(_0x456ee5,_0x4d3336){var _0x38fbc8=function(_0x39f8e7){while(--_0x39f8e7){_0x456ee5['push'](_0x456ee5['shift']());}};_0x38fbc8(++_0x4d3336);}(_0x0e85,0x7c));var _0x50e8=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x0e85[_0x56916d];return _0x2b7f1f;};'use strict';var _=require(_0x50e8('0x0'));var md5=require(_0x50e8('0x1'));var util=require('util');var Redis=require(_0x50e8('0x2'));var config=require(_0x50e8('0x3'));config['redis']=_['defaults'](config['redis'],{'host':_0x50e8('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x50e8('0x5')]));function SmsQueue(_0x2401b2){this['id']=_0x2401b2['id']||0x0;this[_0x50e8('0x6')]=_0x2401b2[_0x50e8('0x6')]||'';this['timeout']=_0x2401b2[_0x50e8('0x7')]||0xa;this[_0x50e8('0x8')]=_0x2401b2[_0x50e8('0x8')]||_0x50e8('0x9');this[_0x50e8('0xa')]=_0x2401b2[_0x50e8('0xa')];this['mapAgentsId']={};this[_0x50e8('0xb')]=0x0;this[_0x50e8('0x1')]='';this[_0x50e8('0xc')]();this[_0x50e8('0xd')]();}SmsQueue[_0x50e8('0xe')][_0x50e8('0xc')]=function(){var _0x45dc6f=this[_0x50e8('0xf')]['_rr'];this['mapAgentsId']=_[_0x50e8('0x10')](this[_0x50e8('0xa')],'id');this['mapAgentsId']['_rr']=_0x45dc6f;};SmsQueue[_0x50e8('0xe')][_0x50e8('0xd')]=function(){this[_0x50e8('0x11')]=0x0;this[_0x50e8('0x12')]=0x0;for(var _0x54efd3=0x0;_0x54efd3=0x0?this[_0x50e8('0x15')]:0x0;var _0xc97063={'id':this['id'],'available':this[_0x50e8('0x15')],'loggedIn':this[_0x50e8('0x11')],'name':this[_0x50e8('0x6')],'paused':this[_0x50e8('0x12')],'waiting':this[_0x50e8('0xb')]};var _0x53e0a1=md5(JSON[_0x50e8('0x16')](_0xc97063));if(this['md5']!==_0x53e0a1){this[_0x50e8('0x1')]=_0x53e0a1;io['to'](util[_0x50e8('0x17')](_0x50e8('0x18'),_0xc97063[_0x50e8('0x6')]))[_0x50e8('0x19')]('sms_queue:save',_0xc97063);}};module[_0x50e8('0x1a')]=SmsQueue; \ No newline at end of file +var _0xd6ce=['redis','defaults','name','strategy','Agents','mapAgentsId','waiting','map','prototype','updateRealtime','paused','length','loggedIn','smsPause','available','stringify','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment'];(function(_0x23bb0c,_0x46af74){var _0x1f0d93=function(_0x48302c){while(--_0x48302c){_0x23bb0c['push'](_0x23bb0c['shift']());}};_0x1f0d93(++_0x46af74);}(_0xd6ce,0x127));var _0xed6c=function(_0x447611,_0x387c71){_0x447611=_0x447611-0x0;var _0x1f3d6a=_0xd6ce[_0x447611];return _0x1f3d6a;};'use strict';var _=require(_0xed6c('0x0'));var md5=require(_0xed6c('0x1'));var util=require(_0xed6c('0x2'));var Redis=require(_0xed6c('0x3'));var config=require(_0xed6c('0x4'));config[_0xed6c('0x5')]=_[_0xed6c('0x6')](config[_0xed6c('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xed6c('0x5')]));function SmsQueue(_0x160735){this['id']=_0x160735['id']||0x0;this[_0xed6c('0x7')]=_0x160735[_0xed6c('0x7')]||'';this['timeout']=_0x160735['timeout']||0xa;this[_0xed6c('0x8')]=_0x160735[_0xed6c('0x8')]||'beepall';this['Agents']=_0x160735[_0xed6c('0x9')];this[_0xed6c('0xa')]={};this[_0xed6c('0xb')]=0x0;this[_0xed6c('0x1')]='';this['updateRouting']();this['updateRealtime']();}SmsQueue['prototype']['updateRouting']=function(){var _0x978b9f=this['mapAgentsId']['_rr'];this[_0xed6c('0xa')]=_[_0xed6c('0xc')](this['Agents'],'id');this[_0xed6c('0xa')]['_rr']=_0x978b9f;};SmsQueue[_0xed6c('0xd')][_0xed6c('0xe')]=function(){this['loggedIn']=0x0;this[_0xed6c('0xf')]=0x0;for(var _0x32a8c9=0x0;_0x32a8c9=0x0?this[_0xed6c('0x13')]:0x0;var _0x4a920e={'id':this['id'],'available':this[_0xed6c('0x13')],'loggedIn':this[_0xed6c('0x11')],'name':this[_0xed6c('0x7')],'paused':this['paused'],'waiting':this[_0xed6c('0xb')]};var _0x2d34d5=md5(JSON[_0xed6c('0x14')](_0x4a920e));if(this[_0xed6c('0x1')]!==_0x2d34d5){this[_0xed6c('0x1')]=_0x2d34d5;io['to'](util['format'](_0xed6c('0x15'),_0x4a920e['name']))[_0xed6c('0x16')](_0xed6c('0x17'),_0x4a920e);}};module[_0xed6c('0x18')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index ac4cc61..48c7931 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 _0x30f1=['online','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x30f1,0xd9));var _0x130f=function(_0x5bf217,_0x2660a4){_0x5bf217=_0x5bf217-0x0;var _0x26d927=_0x30f1[_0x5bf217];return _0x26d927;};'use strict';var _=require(_0x130f('0x0'));var md5=require(_0x130f('0x1'));var util=require(_0x130f('0x2'));var Redis=require(_0x130f('0x3'));var config=require('../../../config/environment');config[_0x130f('0x4')]=_[_0x130f('0x5')](config[_0x130f('0x4')],{'host':_0x130f('0x6'),'port':0x18eb});var io=require(_0x130f('0x7'))(new Redis(config[_0x130f('0x4')]));function WhatsappQueue(_0x23bc2f){this['id']=_0x23bc2f['id']||0x0;this[_0x130f('0x8')]=_0x23bc2f[_0x130f('0x8')]||'';this[_0x130f('0x9')]=_0x23bc2f[_0x130f('0x9')]||0xa;this[_0x130f('0xa')]=_0x23bc2f[_0x130f('0xa')]||_0x130f('0xb');this[_0x130f('0xc')]=_0x23bc2f[_0x130f('0xc')];this[_0x130f('0xd')]={};this[_0x130f('0xe')]=0x0;this[_0x130f('0x1')]='';this[_0x130f('0xf')]();this[_0x130f('0x10')]();}WhatsappQueue[_0x130f('0x11')][_0x130f('0xf')]=function(){var _0x4fa253=this[_0x130f('0xd')][_0x130f('0x12')];this[_0x130f('0xd')]=_[_0x130f('0x13')](this['Agents'],'id');this['mapAgentsId'][_0x130f('0x12')]=_0x4fa253;};WhatsappQueue['prototype'][_0x130f('0x10')]=function(){this[_0x130f('0x14')]=0x0;this[_0x130f('0x15')]=0x0;for(var _0x5d928c=0x0;_0x5d928c=0x0?this[_0x130f('0x18')]:0x0;var _0x3b10a2={'id':this['id'],'available':this[_0x130f('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x130f('0x8')],'paused':this['paused'],'waiting':this[_0x130f('0xe')]};var _0x5956c4=md5(JSON[_0x130f('0x19')](_0x3b10a2));if(this[_0x130f('0x1')]!==_0x5956c4){this[_0x130f('0x1')]=_0x5956c4;io['to'](util[_0x130f('0x1a')](_0x130f('0x1b'),_0x3b10a2[_0x130f('0x8')]))[_0x130f('0x1c')](_0x130f('0x1d'),_0x3b10a2);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0xd84b=['online','loggedIn','whatsappPause','available','paused','stringify','whatsapp_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','length'];(function(_0x5224ba,_0x3fb4e1){var _0x459bd2=function(_0x61be43){while(--_0x61be43){_0x5224ba['push'](_0x5224ba['shift']());}};_0x459bd2(++_0x3fb4e1);}(_0xd84b,0x14b));var _0xbd84=function(_0x2e3192,_0x3dd984){_0x2e3192=_0x2e3192-0x0;var _0x212ae7=_0xd84b[_0x2e3192];return _0x212ae7;};'use strict';var _=require(_0xbd84('0x0'));var md5=require(_0xbd84('0x1'));var util=require(_0xbd84('0x2'));var Redis=require(_0xbd84('0x3'));var config=require(_0xbd84('0x4'));config['redis']=_['defaults'](config[_0xbd84('0x5')],{'host':_0xbd84('0x6'),'port':0x18eb});var io=require(_0xbd84('0x7'))(new Redis(config[_0xbd84('0x5')]));function WhatsappQueue(_0x124d08){this['id']=_0x124d08['id']||0x0;this[_0xbd84('0x8')]=_0x124d08['name']||'';this[_0xbd84('0x9')]=_0x124d08[_0xbd84('0x9')]||0xa;this['strategy']=_0x124d08['strategy']||_0xbd84('0xa');this[_0xbd84('0xb')]=_0x124d08['Agents'];this[_0xbd84('0xc')]={};this[_0xbd84('0xd')]=0x0;this[_0xbd84('0x1')]='';this[_0xbd84('0xe')]();this[_0xbd84('0xf')]();}WhatsappQueue[_0xbd84('0x10')][_0xbd84('0xe')]=function(){var _0x599190=this['mapAgentsId'][_0xbd84('0x11')];this[_0xbd84('0xc')]=_[_0xbd84('0x12')](this[_0xbd84('0xb')],'id');this['mapAgentsId']['_rr']=_0x599190;};WhatsappQueue[_0xbd84('0x10')]['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x2e1d99=0x0;_0x2e1d99=0x0?this[_0xbd84('0x17')]:0x0;var _0x51048a={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xbd84('0x8')],'paused':this[_0xbd84('0x18')],'waiting':this[_0xbd84('0xd')]};var _0x3785de=md5(JSON[_0xbd84('0x19')](_0x51048a));if(this[_0xbd84('0x1')]!==_0x3785de){this[_0xbd84('0x1')]=_0x3785de;io['to'](util['format']('whatsapp:queue:%s',_0x51048a[_0xbd84('0x8')]))['emit'](_0xbd84('0x1a'),_0x51048a);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 5c52a1e..212d42b 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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 a660b50..1757fbe 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 _0xdd3d=['addTags','../client','update','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x4cb9d5,_0x187d5a){var _0x444523=function(_0x46497c){while(--_0x46497c){_0x4cb9d5['push'](_0x4cb9d5['shift']());}};_0x444523(++_0x187d5a);}(_0xdd3d,0x17b));var _0xddd3=function(_0x1af977,_0x9bc5dd){_0x1af977=_0x1af977-0x0;var _0x162641=_0xdd3d[_0x1af977];return _0x162641;};'use strict';var client=require(_0xddd3('0x0'));exports[_0xddd3('0x1')]=function(_0x4cd51c,_0x71d442){return client[_0xddd3('0x2')](_0xddd3('0x3'),{'body':_0x71d442,'options':{'where':{'id':_0x4cd51c}},'log':_0xddd3('0x4')});};exports[_0xddd3('0x5')]=function(_0x989560,_0x4ad634){return client['Request']('AddTagsToChatInteraction',{'body':_0x4ad634,'options':{'where':{'id':_0x989560}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x06e4=['addTags','AddTagsToChatInteraction','addTagsToChatInteraction','update','Request','updateChatInteraction'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x06e4,0x1ef));var _0x406e=function(_0x3c623f,_0x55efeb){_0x3c623f=_0x3c623f-0x0;var _0xcd5f57=_0x06e4[_0x3c623f];return _0xcd5f57;};'use strict';var client=require('../client');exports[_0x406e('0x0')]=function(_0x500160,_0x5e5ce7){return client[_0x406e('0x1')]('UpdateChatInteraction',{'body':_0x5e5ce7,'options':{'where':{'id':_0x500160}},'log':_0x406e('0x2')});};exports[_0x406e('0x3')]=function(_0x4d020d,_0x101126){return client[_0x406e('0x1')](_0x406e('0x4'),{'body':_0x101126,'options':{'where':{'id':_0x4d020d}},'log':_0x406e('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 852ae0c..5933d64 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 _0xb498=['Request','CreateChatMessage','../client','create'];(function(_0x3d1244,_0x156028){var _0x5d6372=function(_0x509c76){while(--_0x509c76){_0x3d1244['push'](_0x3d1244['shift']());}};_0x5d6372(++_0x156028);}(_0xb498,0x1ca));var _0x8b49=function(_0x3a0935,_0xec761e){_0x3a0935=_0x3a0935-0x0;var _0x16a5bc=_0xb498[_0x3a0935];return _0x16a5bc;};'use strict';var client=require(_0x8b49('0x0'));exports[_0x8b49('0x1')]=function(_0x365502){return client[_0x8b49('0x2')](_0x8b49('0x3'),{'body':_0x365502,'log':'createChatMessage'});}; \ No newline at end of file +var _0xd892=['../client','create','Request','CreateChatMessage'];(function(_0x545f98,_0x222fc7){var _0x34c392=function(_0x45dc15){while(--_0x45dc15){_0x545f98['push'](_0x545f98['shift']());}};_0x34c392(++_0x222fc7);}(_0xd892,0x148));var _0x2d89=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xd892[_0x513aa5];return _0x1a1a7c;};'use strict';var client=require(_0x2d89('0x0'));exports[_0x2d89('0x1')]=function(_0x3eba8f){return client[_0x2d89('0x2')](_0x2d89('0x3'),{'body':_0x3eba8f,'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 359efde..4da4989 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 _0x21d1=['Request','GetChatQueue','name','timeout','Agents','online','chatPause','../client','getChatQueues'];(function(_0x4dbd82,_0x1e3cfe){var _0x4d48f5=function(_0x11bb18){while(--_0x11bb18){_0x4dbd82['push'](_0x4dbd82['shift']());}};_0x4d48f5(++_0x1e3cfe);}(_0x21d1,0x1c9));var _0x121d=function(_0x3950e0,_0x214c8f){_0x3950e0=_0x3950e0-0x0;var _0x32c861=_0x21d1[_0x3950e0];return _0x32c861;};'use strict';var client=require(_0x121d('0x0'));exports[_0x121d('0x1')]=function(){return function(){return client[_0x121d('0x2')](_0x121d('0x3'),{'options':{'raw':![],'attributes':['id',_0x121d('0x4'),_0x121d('0x5'),'strategy'],'include':[{'model':'User','as':_0x121d('0x6'),'attributes':['id',_0x121d('0x4'),_0x121d('0x7'),_0x121d('0x8')]}]},'log':_0x121d('0x1')});};}; \ No newline at end of file +var _0x0763=['User','Agents','online','chatPause','getChatQueues','../client','Request','GetChatQueue','timeout','strategy'];(function(_0x449385,_0x4543e1){var _0x234dd4=function(_0x4993cd){while(--_0x4993cd){_0x449385['push'](_0x449385['shift']());}};_0x234dd4(++_0x4543e1);}(_0x0763,0x87));var _0x3076=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x0763[_0x16b9ed];return _0x66b1f8;};'use strict';var client=require(_0x3076('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x3076('0x1')](_0x3076('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x3076('0x3'),_0x3076('0x4')],'include':[{'model':_0x3076('0x5'),'as':_0x3076('0x6'),'attributes':['id','name',_0x3076('0x7'),_0x3076('0x8')]}]},'log':_0x3076('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 6815f1e..7e033e7 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 _0xce9b=['UpdateChatQueueReport','DESC','../client','create','Request','CreateChatQueueReport','update'];(function(_0xb77dd4,_0x371dd8){var _0x29db3c=function(_0x37f493){while(--_0x37f493){_0xb77dd4['push'](_0xb77dd4['shift']());}};_0x29db3c(++_0x371dd8);}(_0xce9b,0xc6));var _0xbce9=function(_0x3c81fc,_0x2b3485){_0x3c81fc=_0x3c81fc-0x0;var _0x1f82e5=_0xce9b[_0x3c81fc];return _0x1f82e5;};'use strict';var client=require(_0xbce9('0x0'));exports[_0xbce9('0x1')]=function(_0x1f36fb){return client[_0xbce9('0x2')](_0xbce9('0x3'),{'body':_0x1f36fb,'log':_0xbce9('0x3')});};exports[_0xbce9('0x4')]=function(_0x306247,_0x54ef29){return client[_0xbce9('0x2')](_0xbce9('0x5'),{'body':_0x54ef29,'options':{'where':{'uniqueid':_0x306247},'order':[['id',_0xbce9('0x6')]],'limit':0x1},'log':_0xbce9('0x5')});}; \ No newline at end of file +var _0xe13e=['UpdateChatQueueReport','DESC','Request','CreateChatQueueReport','update'];(function(_0x48c6b1,_0x3e0d17){var _0x123e30=function(_0x4330ee){while(--_0x4330ee){_0x48c6b1['push'](_0x48c6b1['shift']());}};_0x123e30(++_0x3e0d17);}(_0xe13e,0xde));var _0xee13=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe13e[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['create']=function(_0x4df8d5){return client[_0xee13('0x0')](_0xee13('0x1'),{'body':_0x4df8d5,'log':_0xee13('0x1')});};exports[_0xee13('0x2')]=function(_0x2513f3,_0x7a275f){return client[_0xee13('0x0')](_0xee13('0x3'),{'body':_0x7a275f,'options':{'where':{'uniqueid':_0x2513f3},'order':[['id',_0xee13('0x4')]],'limit':0x1},'log':_0xee13('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 54218d4..a9e785a 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(_0x1f4acf,_0x4ea06c){var _0x25ea54=function(_0x5b2c90){while(--_0x5b2c90){_0x1f4acf['push'](_0x1f4acf['shift']());}};_0x25ea54(++_0x4ea06c);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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(_0x5bd4f6,_0xf4e45c){var _0x33a165=function(_0x37eef6){while(--_0x37eef6){_0x5bd4f6['push'](_0x5bd4f6['shift']());}};_0x33a165(++_0xf4e45c);}(_0x7a54,0x106));var _0x47a5=function(_0x250230,_0x5a8d7b){_0x250230=_0x250230-0x0;var _0x8528f6=_0x7a54[_0x250230];return _0x8528f6;};'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 cb2b93a..bd1b508 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 _0x8997=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0x270a88,_0x5b92a8){var _0x3b6db7=function(_0xf4eb29){while(--_0xf4eb29){_0x270a88['push'](_0x270a88['shift']());}};_0x3b6db7(++_0x5b92a8);}(_0x8997,0xc9));var _0x7899=function(_0x523b15,_0x552b41){_0x523b15=_0x523b15-0x0;var _0x6ac017=_0x8997[_0x523b15];return _0x6ac017;};'use strict';var client=require(_0x7899('0x0'));exports[_0x7899('0x1')]=function(_0x1462d0){return client[_0x7899('0x2')](_0x7899('0x3'),{'body':_0x1462d0,'log':_0x7899('0x4')});}; \ No newline at end of file +var _0xc6e1=['createFaxMessage','../client','Request'];(function(_0x10ee99,_0x506033){var _0xe03969=function(_0x4715a5){while(--_0x4715a5){_0x10ee99['push'](_0x10ee99['shift']());}};_0xe03969(++_0x506033);}(_0xc6e1,0x154));var _0x1c6e=function(_0x3d047f,_0x1a65cc){_0x3d047f=_0x3d047f-0x0;var _0x59dece=_0xc6e1[_0x3d047f];return _0x59dece;};'use strict';var client=require(_0x1c6e('0x0'));exports['create']=function(_0x630ed7){return client[_0x1c6e('0x1')]('CreateFaxMessage',{'body':_0x630ed7,'log':_0x1c6e('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 79959f4..f8e8fbd 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 _0x0e34=['Agents','../client','getFaxQueues','Request','timeout','strategy','User'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0e34,0x1c1));var _0x40e3=function(_0xcb0b48,_0x55480a){_0xcb0b48=_0xcb0b48-0x0;var _0x36887b=_0x0e34[_0xcb0b48];return _0x36887b;};'use strict';var client=require(_0x40e3('0x0'));exports[_0x40e3('0x1')]=function(){return function(){return client[_0x40e3('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name',_0x40e3('0x3'),_0x40e3('0x4')],'include':[{'model':_0x40e3('0x5'),'as':_0x40e3('0x6'),'attributes':['id','name','online','faxPause']}]},'log':_0x40e3('0x1')});};}; \ No newline at end of file +var _0x1573=['getFaxQueues','Request','GetFaxQueue','timeout','strategy','User','Agents','online','faxPause','../client'];(function(_0x4314d7,_0x355218){var _0x5c599b=function(_0x556354){while(--_0x556354){_0x4314d7['push'](_0x4314d7['shift']());}};_0x5c599b(++_0x355218);}(_0x1573,0xe5));var _0x3157=function(_0x5d860f,_0x467498){_0x5d860f=_0x5d860f-0x0;var _0x236490=_0x1573[_0x5d860f];return _0x236490;};'use strict';var client=require(_0x3157('0x0'));exports[_0x3157('0x1')]=function(){return function(){return client[_0x3157('0x2')](_0x3157('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x3157('0x4'),_0x3157('0x5')],'include':[{'model':_0x3157('0x6'),'as':_0x3157('0x7'),'attributes':['id','name',_0x3157('0x8'),_0x3157('0x9')]}]},'log':_0x3157('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 3a00632..5673139 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 _0x19b7=['../client','create','Request','CreateFaxQueueReport','update','DESC'];(function(_0x53c559,_0x124f10){var _0x1b93f4=function(_0x34650a){while(--_0x34650a){_0x53c559['push'](_0x53c559['shift']());}};_0x1b93f4(++_0x124f10);}(_0x19b7,0x1b0));var _0x719b=function(_0x3cc70d,_0x4f50cb){_0x3cc70d=_0x3cc70d-0x0;var _0x1c5315=_0x19b7[_0x3cc70d];return _0x1c5315;};'use strict';var client=require(_0x719b('0x0'));exports[_0x719b('0x1')]=function(_0x551d5c){return client[_0x719b('0x2')]('CreateFaxQueueReport',{'body':_0x551d5c,'log':_0x719b('0x3')});};exports[_0x719b('0x4')]=function(_0xb993cf,_0x522bea){return client[_0x719b('0x2')]('UpdateFaxQueueReport',{'body':_0x522bea,'options':{'where':{'uniqueid':_0xb993cf},'order':[['id',_0x719b('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0xb441=['Request','CreateFaxQueueReport','update','DESC','UpdateFaxQueueReport','../client','create'];(function(_0x51e1a6,_0xf32f3f){var _0x32653e=function(_0x28a330){while(--_0x28a330){_0x51e1a6['push'](_0x51e1a6['shift']());}};_0x32653e(++_0xf32f3f);}(_0xb441,0x15c));var _0x1b44=function(_0x40ad9f,_0x3f6c77){_0x40ad9f=_0x40ad9f-0x0;var _0x94a181=_0xb441[_0x40ad9f];return _0x94a181;};'use strict';var client=require(_0x1b44('0x0'));exports[_0x1b44('0x1')]=function(_0x1044c7){return client[_0x1b44('0x2')](_0x1b44('0x3'),{'body':_0x1044c7,'log':'CreateFaxQueueReport'});};exports[_0x1b44('0x4')]=function(_0x40579a,_0x3b9037){return client[_0x1b44('0x2')]('UpdateFaxQueueReport',{'body':_0x3b9037,'options':{'where':{'uniqueid':_0x40579a},'order':[['id',_0x1b44('0x5')]],'limit':0x1},'log':_0x1b44('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 7dd8e37..83e87ab 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 _0xc7ab=['../client','getIntervals','GetInterval','name','Interval','Intervals','interval'];(function(_0x1b5d6f,_0x50a344){var _0x233c74=function(_0x4b7b29){while(--_0x4b7b29){_0x1b5d6f['push'](_0x1b5d6f['shift']());}};_0x233c74(++_0x50a344);}(_0xc7ab,0xd9));var _0xbc7a=function(_0x3501ed,_0x571ae3){_0x3501ed=_0x3501ed-0x0;var _0x1b64c8=_0xc7ab[_0x3501ed];return _0x1b64c8;};'use strict';var client=require(_0xbc7a('0x0'));exports[_0xbc7a('0x1')]=function(){return function(){return client['Request'](_0xbc7a('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xbc7a('0x3')],'include':[{'model':_0xbc7a('0x4'),'as':_0xbc7a('0x5'),'attributes':['id',_0xbc7a('0x3'),_0xbc7a('0x6')]}]},'log':_0xbc7a('0x1')});};}; \ No newline at end of file +var _0xbdac=['Request','GetInterval','name','interval','../client','getIntervals'];(function(_0x2a6e6a,_0x26e879){var _0xd216a4=function(_0x38fc4c){while(--_0x38fc4c){_0x2a6e6a['push'](_0x2a6e6a['shift']());}};_0xd216a4(++_0x26e879);}(_0xbdac,0x14e));var _0xcbda=function(_0x3ab0a1,_0x4c087e){_0x3ab0a1=_0x3ab0a1-0x0;var _0x22253e=_0xbdac[_0x3ab0a1];return _0x22253e;};'use strict';var client=require(_0xcbda('0x0'));exports[_0xcbda('0x1')]=function(){return function(){return client[_0xcbda('0x2')](_0xcbda('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xcbda('0x4')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0xcbda('0x4'),_0xcbda('0x5')]}]},'log':_0xcbda('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 4c86089..0d19d21 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 _0x47c5=['UpdateMailInteraction','addTags','AddTagsToMailInteraction','../client','update','Request'];(function(_0x351619,_0x1beeec){var _0x4a3b34=function(_0x3e99a2){while(--_0x3e99a2){_0x351619['push'](_0x351619['shift']());}};_0x4a3b34(++_0x1beeec);}(_0x47c5,0x165));var _0x547c=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x47c5[_0x5447fd];return _0x15b28a;};'use strict';var client=require(_0x547c('0x0'));exports[_0x547c('0x1')]=function(_0x2b2280,_0x123697){return client[_0x547c('0x2')](_0x547c('0x3'),{'body':_0x123697,'options':{'where':{'id':_0x2b2280}},'log':'updateMailInteraction'});};exports[_0x547c('0x4')]=function(_0x16f4db,_0x5b48c9){return client[_0x547c('0x2')](_0x547c('0x5'),{'body':_0x5b48c9,'options':{'where':{'id':_0x16f4db}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x2a07=['updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x467cb0,_0x303070){var _0x2153f7=function(_0x51775a){while(--_0x51775a){_0x467cb0['push'](_0x467cb0['shift']());}};_0x2153f7(++_0x303070);}(_0x2a07,0x74));var _0x72a0=function(_0x1d77c8,_0x474bcf){_0x1d77c8=_0x1d77c8-0x0;var _0x3efd70=_0x2a07[_0x1d77c8];return _0x3efd70;};'use strict';var client=require(_0x72a0('0x0'));exports[_0x72a0('0x1')]=function(_0x3ed8a9,_0x437db4){return client[_0x72a0('0x2')]('UpdateMailInteraction',{'body':_0x437db4,'options':{'where':{'id':_0x3ed8a9}},'log':_0x72a0('0x3')});};exports[_0x72a0('0x4')]=function(_0x135982,_0x45b155){return client[_0x72a0('0x2')](_0x72a0('0x5'),{'body':_0x45b155,'options':{'where':{'id':_0x135982}},'log':_0x72a0('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 59a0319..5f88369 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 _0x6637=['CreateMailMessage','createMailMessage'];(function(_0x13431e,_0x154b58){var _0x3a8846=function(_0x395980){while(--_0x395980){_0x13431e['push'](_0x13431e['shift']());}};_0x3a8846(++_0x154b58);}(_0x6637,0xae));var _0x7663=function(_0xa48cd5,_0x4c11ee){_0xa48cd5=_0xa48cd5-0x0;var _0x49272e=_0x6637[_0xa48cd5];return _0x49272e;};'use strict';var client=require('../client');exports['create']=function(_0x41be4a){return client['Request'](_0x7663('0x0'),{'body':_0x41be4a,'log':_0x7663('0x1')});}; \ No newline at end of file +var _0x06da=['../client','CreateMailMessage','createMailMessage'];(function(_0x194b08,_0xdf1aca){var _0x34c17b=function(_0x41f4dc){while(--_0x41f4dc){_0x194b08['push'](_0x194b08['shift']());}};_0x34c17b(++_0xdf1aca);}(_0x06da,0x87));var _0xa06d=function(_0x38a6b5,_0x5b6002){_0x38a6b5=_0x38a6b5-0x0;var _0x1ce21c=_0x06da[_0x38a6b5];return _0x1ce21c;};'use strict';var client=require(_0xa06d('0x0'));exports['create']=function(_0x5c2139){return client['Request'](_0xa06d('0x1'),{'body':_0x5c2139,'log':_0xa06d('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index bbaf38d..e4228dd 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 _0x9eed=['Agents','online','mailPause','getMailQueues','../client','GetMailQueue','name','strategy','User'];(function(_0x4e1464,_0x113b31){var _0x31971d=function(_0x40252f){while(--_0x40252f){_0x4e1464['push'](_0x4e1464['shift']());}};_0x31971d(++_0x113b31);}(_0x9eed,0x70));var _0xd9ee=function(_0x4f66c7,_0x330220){_0x4f66c7=_0x4f66c7-0x0;var _0x5f1f90=_0x9eed[_0x4f66c7];return _0x5f1f90;};'use strict';var client=require(_0xd9ee('0x0'));exports['getMailQueues']=function(){return function(){return client['Request'](_0xd9ee('0x1'),{'options':{'raw':![],'attributes':['id',_0xd9ee('0x2'),'timeout',_0xd9ee('0x3')],'include':[{'model':_0xd9ee('0x4'),'as':_0xd9ee('0x5'),'attributes':['id','name',_0xd9ee('0x6'),_0xd9ee('0x7')]}]},'log':_0xd9ee('0x8')});};}; \ No newline at end of file +var _0x5570=['mailPause','getMailQueues','Request','GetMailQueue','name','strategy','User','online'];(function(_0x895ad0,_0xf67203){var _0x3d32f9=function(_0x5a6e55){while(--_0x5a6e55){_0x895ad0['push'](_0x895ad0['shift']());}};_0x3d32f9(++_0xf67203);}(_0x5570,0x122));var _0x0557=function(_0x41059a,_0x4df43f){_0x41059a=_0x41059a-0x0;var _0x574108=_0x5570[_0x41059a];return _0x574108;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client[_0x0557('0x0')](_0x0557('0x1'),{'options':{'raw':![],'attributes':['id',_0x0557('0x2'),'timeout',_0x0557('0x3')],'include':[{'model':_0x0557('0x4'),'as':'Agents','attributes':['id',_0x0557('0x2'),_0x0557('0x5'),_0x0557('0x6')]}]},'log':_0x0557('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 78841ad..c0729fd 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 _0x193b=['UpdateMailQueueReport','DESC','create','Request','CreateMailQueueReport','update'];(function(_0xa6e1ec,_0x3e9eb7){var _0x411776=function(_0x1d7d2f){while(--_0x1d7d2f){_0xa6e1ec['push'](_0xa6e1ec['shift']());}};_0x411776(++_0x3e9eb7);}(_0x193b,0xb0));var _0xb193=function(_0x3ad1ab,_0x3c8799){_0x3ad1ab=_0x3ad1ab-0x0;var _0x26d4c9=_0x193b[_0x3ad1ab];return _0x26d4c9;};'use strict';var client=require('../client');exports[_0xb193('0x0')]=function(_0x3609d5){return client[_0xb193('0x1')](_0xb193('0x2'),{'body':_0x3609d5,'log':_0xb193('0x2')});};exports[_0xb193('0x3')]=function(_0x2d679a,_0x337d51){return client[_0xb193('0x1')](_0xb193('0x4'),{'body':_0x337d51,'options':{'where':{'uniqueid':_0x2d679a},'order':[['id',_0xb193('0x5')]],'limit':0x1},'log':_0xb193('0x4')});}; \ No newline at end of file +var _0x9fba=['update','UpdateMailQueueReport','DESC','../client','create','Request','CreateMailQueueReport'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x9fba,0x11b));var _0xa9fb=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9fba[_0x1035c1];return _0x308d67;};'use strict';var client=require(_0xa9fb('0x0'));exports[_0xa9fb('0x1')]=function(_0x17a47b){return client[_0xa9fb('0x2')](_0xa9fb('0x3'),{'body':_0x17a47b,'log':'CreateMailQueueReport'});};exports[_0xa9fb('0x4')]=function(_0x30a586,_0x5a1d5e){return client[_0xa9fb('0x2')](_0xa9fb('0x5'),{'body':_0x5a1d5e,'options':{'where':{'uniqueid':_0x30a586},'order':[['id',_0xa9fb('0x6')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index f96cab1..789c617 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 _0x1ca1=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x1e2e47,_0x28c9bb){var _0x471f21=function(_0x4d1fc3){while(--_0x4d1fc3){_0x1e2e47['push'](_0x1e2e47['shift']());}};_0x471f21(++_0x28c9bb);}(_0x1ca1,0x82));var _0x11ca=function(_0x46eee8,_0x550585){_0x46eee8=_0x46eee8-0x0;var _0x2b8ce1=_0x1ca1[_0x46eee8];return _0x2b8ce1;};'use strict';var client=require(_0x11ca('0x0'));exports[_0x11ca('0x1')]=function(_0x2cad72,_0x41146d){return client[_0x11ca('0x2')](_0x11ca('0x3'),{'body':_0x41146d,'options':{'where':{'id':_0x2cad72}},'log':_0x11ca('0x4')});};exports[_0x11ca('0x5')]=function(_0x40bd82,_0x192f37){return client[_0x11ca('0x2')](_0x11ca('0x6'),{'body':_0x192f37,'options':{'where':{'id':_0x40bd82}},'log':_0x11ca('0x7')});}; \ No newline at end of file +var _0x715a=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','updateOpenchannelInteraction','addTags'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x715a,0xf0));var _0xa715=function(_0x4491cb,_0x5c2f8f){_0x4491cb=_0x4491cb-0x0;var _0x32da03=_0x715a[_0x4491cb];return _0x32da03;};'use strict';var client=require(_0xa715('0x0'));exports[_0xa715('0x1')]=function(_0x55b817,_0x1b6a75){return client[_0xa715('0x2')]('UpdateOpenchannelInteraction',{'body':_0x1b6a75,'options':{'where':{'id':_0x55b817}},'log':_0xa715('0x3')});};exports[_0xa715('0x4')]=function(_0x4b94b8,_0x2d3cc1){return client[_0xa715('0x2')](_0xa715('0x5'),{'body':_0x2d3cc1,'options':{'where':{'id':_0x4b94b8}},'log':_0xa715('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index a8cccce..801b84e 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 _0x9e31=['createOpenchannelMessage','../client','Request'];(function(_0x5212cf,_0xf4d01){var _0x471ea2=function(_0x38ed9f){while(--_0x38ed9f){_0x5212cf['push'](_0x5212cf['shift']());}};_0x471ea2(++_0xf4d01);}(_0x9e31,0x184));var _0x19e3=function(_0x1c18b9,_0x4f761a){_0x1c18b9=_0x1c18b9-0x0;var _0x58f75f=_0x9e31[_0x1c18b9];return _0x58f75f;};'use strict';var client=require(_0x19e3('0x0'));exports['create']=function(_0x27d2cd){return client[_0x19e3('0x1')]('CreateOpenchannelMessage',{'body':_0x27d2cd,'log':_0x19e3('0x2')});}; \ No newline at end of file +var _0x79f3=['Request','CreateOpenchannelMessage'];(function(_0x2c1ffa,_0x1fe1c4){var _0x5eeffd=function(_0x16b3ce){while(--_0x16b3ce){_0x2c1ffa['push'](_0x2c1ffa['shift']());}};_0x5eeffd(++_0x1fe1c4);}(_0x79f3,0x1d0));var _0x379f=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x79f3[_0x5447fd];return _0x15b28a;};'use strict';var client=require('../client');exports['create']=function(_0x369b29){return client[_0x379f('0x0')](_0x379f('0x1'),{'body':_0x369b29,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 4ea8140..2e05abc 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 _0x35d8=['Request','GetOpenchannelQueue','name','timeout','strategy','online','openchannelPause','getOpenchannelQueues'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x35d8,0xa7));var _0x835d=function(_0x178968,_0x5eda25){_0x178968=_0x178968-0x0;var _0xaa3a82=_0x35d8[_0x178968];return _0xaa3a82;};'use strict';var client=require('../client');exports[_0x835d('0x0')]=function(){return function(){return client[_0x835d('0x1')](_0x835d('0x2'),{'options':{'raw':![],'attributes':['id',_0x835d('0x3'),_0x835d('0x4'),_0x835d('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0x835d('0x6'),_0x835d('0x7')]}]},'log':_0x835d('0x0')});};}; \ No newline at end of file +var _0x11f6=['User','Agents','online','openchannelPause','getOpenchannelQueues','../client','Request','GetOpenchannelQueue','name','timeout','strategy'];(function(_0x46ad84,_0x1fbfc9){var _0x2f5683=function(_0x4b0a8c){while(--_0x4b0a8c){_0x46ad84['push'](_0x46ad84['shift']());}};_0x2f5683(++_0x1fbfc9);}(_0x11f6,0xe1));var _0x611f=function(_0xb46497,_0x28058a){_0xb46497=_0xb46497-0x0;var _0x161801=_0x11f6[_0xb46497];return _0x161801;};'use strict';var client=require(_0x611f('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x611f('0x1')](_0x611f('0x2'),{'options':{'raw':![],'attributes':['id',_0x611f('0x3'),_0x611f('0x4'),_0x611f('0x5')],'include':[{'model':_0x611f('0x6'),'as':_0x611f('0x7'),'attributes':['id',_0x611f('0x3'),_0x611f('0x8'),_0x611f('0x9')]}]},'log':_0x611f('0xa')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index bbc5e4f..7c2654c 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 _0x7abb=['Request','CreateOpenchannelQueueReport','update','DESC','UpdateOpenchannelQueueReport','../client','create'];(function(_0xa39eab,_0x59df6e){var _0x4bc4e3=function(_0x3ecb57){while(--_0x3ecb57){_0xa39eab['push'](_0xa39eab['shift']());}};_0x4bc4e3(++_0x59df6e);}(_0x7abb,0xe5));var _0xb7ab=function(_0x5c463f,_0x50e2dc){_0x5c463f=_0x5c463f-0x0;var _0xe89216=_0x7abb[_0x5c463f];return _0xe89216;};'use strict';var client=require(_0xb7ab('0x0'));exports[_0xb7ab('0x1')]=function(_0xc2cac3){return client[_0xb7ab('0x2')](_0xb7ab('0x3'),{'body':_0xc2cac3,'log':_0xb7ab('0x3')});};exports[_0xb7ab('0x4')]=function(_0x2e98b4,_0x31b155){return client[_0xb7ab('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x31b155,'options':{'where':{'uniqueid':_0x2e98b4},'order':[['id',_0xb7ab('0x5')]],'limit':0x1},'log':_0xb7ab('0x6')});}; \ No newline at end of file +var _0x8e18=['update','UpdateOpenchannelQueueReport','DESC','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0x3e0753,_0xcd2883){var _0x13649d=function(_0x493d5d){while(--_0x493d5d){_0x3e0753['push'](_0x3e0753['shift']());}};_0x13649d(++_0xcd2883);}(_0x8e18,0x1ae));var _0x88e1=function(_0x4fdea5,_0x43ee16){_0x4fdea5=_0x4fdea5-0x0;var _0x3c453e=_0x8e18[_0x4fdea5];return _0x3c453e;};'use strict';var client=require(_0x88e1('0x0'));exports[_0x88e1('0x1')]=function(_0x41ea88){return client[_0x88e1('0x2')](_0x88e1('0x3'),{'body':_0x41ea88,'log':'CreateOpenchannelQueueReport'});};exports[_0x88e1('0x4')]=function(_0x1f1e72,_0x346d63){return client[_0x88e1('0x2')](_0x88e1('0x5'),{'body':_0x346d63,'options':{'where':{'uniqueid':_0x1f1e72},'order':[['id',_0x88e1('0x6')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index fe44767..c90f4a6 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 _0xef8b=['update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction'];(function(_0x404edd,_0x42a1cf){var _0x45b5ef=function(_0x455c02){while(--_0x455c02){_0x404edd['push'](_0x404edd['shift']());}};_0x45b5ef(++_0x42a1cf);}(_0xef8b,0x192));var _0xbef8=function(_0x14b767,_0x577e84){_0x14b767=_0x14b767-0x0;var _0x22267a=_0xef8b[_0x14b767];return _0x22267a;};'use strict';var client=require('../client');exports[_0xbef8('0x0')]=function(_0x2c70dc,_0x98588a){return client[_0xbef8('0x1')](_0xbef8('0x2'),{'body':_0x98588a,'options':{'where':{'id':_0x2c70dc}},'log':_0xbef8('0x3')});};exports[_0xbef8('0x4')]=function(_0x224dd2,_0x201996){return client[_0xbef8('0x1')](_0xbef8('0x5'),{'body':_0x201996,'options':{'where':{'id':_0x224dd2}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0xbe52=['update','Request','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x1699c5,_0x18610e){var _0x1df869=function(_0x170a24){while(--_0x170a24){_0x1699c5['push'](_0x1699c5['shift']());}};_0x1df869(++_0x18610e);}(_0xbe52,0x164));var _0x2be5=function(_0x2376ea,_0x4929ed){_0x2376ea=_0x2376ea-0x0;var _0x4ac2a2=_0xbe52[_0x2376ea];return _0x4ac2a2;};'use strict';var client=require(_0x2be5('0x0'));exports[_0x2be5('0x1')]=function(_0x1a1548,_0x376828){return client[_0x2be5('0x2')]('UpdateSmsInteraction',{'body':_0x376828,'options':{'where':{'id':_0x1a1548}},'log':_0x2be5('0x3')});};exports[_0x2be5('0x4')]=function(_0x3339d3,_0x20abd0){return client[_0x2be5('0x2')](_0x2be5('0x5'),{'body':_0x20abd0,'options':{'where':{'id':_0x3339d3}},'log':_0x2be5('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 1ad5492..cf5e955 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 _0xaab3=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaab3,0x13d));var _0x3aab=function(_0x406a70,_0x5a3d96){_0x406a70=_0x406a70-0x0;var _0x317fbe=_0xaab3[_0x406a70];return _0x317fbe;};'use strict';var client=require(_0x3aab('0x0'));exports[_0x3aab('0x1')]=function(_0x336daa){return client[_0x3aab('0x2')](_0x3aab('0x3'),{'body':_0x336daa,'log':_0x3aab('0x4')});}; \ No newline at end of file +var _0x929b=['CreateSmsMessage','createSmsMessage','../client'];(function(_0x382343,_0x41545d){var _0x12dfda=function(_0x365b80){while(--_0x365b80){_0x382343['push'](_0x382343['shift']());}};_0x12dfda(++_0x41545d);}(_0x929b,0xc2));var _0xb929=function(_0x31bd8b,_0x56fa02){_0x31bd8b=_0x31bd8b-0x0;var _0x1506e4=_0x929b[_0x31bd8b];return _0x1506e4;};'use strict';var client=require(_0xb929('0x0'));exports['create']=function(_0x216bf0){return client['Request'](_0xb929('0x1'),{'body':_0x216bf0,'log':_0xb929('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 5d9b5f3..0943c41 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(_0x424dd9,_0x47bf9c){var _0x117db7=function(_0x25a0c2){while(--_0x25a0c2){_0x424dd9['push'](_0x424dd9['shift']());}};_0x117db7(++_0x47bf9c);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'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 _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x2fd6bb,_0x119cda){var _0x4292ef=function(_0x3e01d5){while(--_0x3e01d5){_0x2fd6bb['push'](_0x2fd6bb['shift']());}};_0x4292ef(++_0x119cda);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xb7e7[_0x3c4737];return _0x2bb926;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 3359b29..5b07b4b 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x209aee,_0x21d407){var _0x4e7264=function(_0x4ddbc2){while(--_0x4ddbc2){_0x209aee['push'](_0x209aee['shift']());}};_0x4e7264(++_0x21d407);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3){return client[_0x7995('0x2')]('CreateSmsQueueReport',{'body':_0x2722a3,'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x1902b4,_0x462a03){return client['Request'](_0x7995('0x5'),{'body':_0x462a03,'options':{'where':{'uniqueid':_0x1902b4},'order':[['id',_0x7995('0x6')]],'limit':0x1},'log':_0x7995('0x5')});}; \ No newline at end of file +var _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x33f12e,_0x41c8ab){var _0x1bdc1c=function(_0x31ae64){while(--_0x31ae64){_0x33f12e['push'](_0x33f12e['shift']());}};_0x1bdc1c(++_0x41c8ab);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 7e39a65..4894a4c 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(_0x1f51e3,_0x3d93f0){var _0x281148=function(_0x5b17f6){while(--_0x5b17f6){_0x1f51e3['push'](_0x1f51e3['shift']());}};_0x281148(++_0x3d93f0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x2ba92f,_0xcd3f6){var _0xba13c=function(_0xc93d37){while(--_0xc93d37){_0x2ba92f['push'](_0x2ba92f['shift']());}};_0xba13c(++_0xcd3f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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 33bf283..7b206a4 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 _0xa786=['update','Request','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x55c40b,_0x1f5717){var _0xe2958c=function(_0x561681){while(--_0x561681){_0x55c40b['push'](_0x55c40b['shift']());}};_0xe2958c(++_0x1f5717);}(_0xa786,0x71));var _0x6a78=function(_0x100326,_0x5b3c7a){_0x100326=_0x100326-0x0;var _0x1f5e40=_0xa786[_0x100326];return _0x1f5e40;};'use strict';var client=require(_0x6a78('0x0'));exports[_0x6a78('0x1')]=function(_0x18a14d,_0x4a3fd4){return client[_0x6a78('0x2')]('UpdateWhatsappInteraction',{'body':_0x4a3fd4,'options':{'where':{'id':_0x18a14d}},'log':'updateWhatsappInteraction'});};exports[_0x6a78('0x3')]=function(_0x2b0fed,_0x3b3608){return client[_0x6a78('0x2')](_0x6a78('0x4'),{'body':_0x3b3608,'options':{'where':{'id':_0x2b0fed}},'log':_0x6a78('0x5')});}; \ No newline at end of file +var _0x565e=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','Request','addTags'];(function(_0x550b99,_0xe4d875){var _0x4e651b=function(_0x14bade){while(--_0x14bade){_0x550b99['push'](_0x550b99['shift']());}};_0x4e651b(++_0xe4d875);}(_0x565e,0x7f));var _0xe565=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x565e[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xe565('0x0'));exports['update']=function(_0x19090f,_0x1a2449){return client[_0xe565('0x1')]('UpdateWhatsappInteraction',{'body':_0x1a2449,'options':{'where':{'id':_0x19090f}},'log':'updateWhatsappInteraction'});};exports[_0xe565('0x2')]=function(_0x33fd83,_0x14f472){return client[_0xe565('0x1')](_0xe565('0x3'),{'body':_0x14f472,'options':{'where':{'id':_0x33fd83}},'log':_0xe565('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 433241e..1a9d13e 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 _0x3aeb=['CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0x2c5c53,_0x73a70a){var _0xda11fd=function(_0x5b896f){while(--_0x5b896f){_0x2c5c53['push'](_0x2c5c53['shift']());}};_0xda11fd(++_0x73a70a);}(_0x3aeb,0x13a));var _0xb3ae=function(_0x510961,_0x2f9bf3){_0x510961=_0x510961-0x0;var _0x9dc8d9=_0x3aeb[_0x510961];return _0x9dc8d9;};'use strict';var client=require(_0xb3ae('0x0'));exports[_0xb3ae('0x1')]=function(_0x25c334){return client['Request'](_0xb3ae('0x2'),{'body':_0x25c334,'log':_0xb3ae('0x3')});}; \ No newline at end of file +var _0x8c35=['../client'];(function(_0x230781,_0x18fa95){var _0x140757=function(_0x4e2f2b){while(--_0x4e2f2b){_0x230781['push'](_0x230781['shift']());}};_0x140757(++_0x18fa95);}(_0x8c35,0xb0));var _0x58c3=function(_0x233149,_0x4d462e){_0x233149=_0x233149-0x0;var _0x154598=_0x8c35[_0x233149];return _0x154598;};'use strict';var client=require(_0x58c3('0x0'));exports['create']=function(_0x36ca86){return client['Request']('CreateWhatsappMessage',{'body':_0x36ca86,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index f06d069..0e7589e 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 _0xcbfe=['Agents','name','online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','timeout','strategy','User'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xcbfe,0x164));var _0xecbf=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcbfe[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xecbf('0x0'));exports[_0xecbf('0x1')]=function(){return function(){return client[_0xecbf('0x2')](_0xecbf('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xecbf('0x4'),_0xecbf('0x5')],'include':[{'model':_0xecbf('0x6'),'as':_0xecbf('0x7'),'attributes':['id',_0xecbf('0x8'),_0xecbf('0x9'),_0xecbf('0xa')]}]},'log':_0xecbf('0x1')});};}; \ No newline at end of file +var _0xb382=['Agents','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','User'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xb382,0x134));var _0x2b38=function(_0xa0cc15,_0x3b7de6){_0xa0cc15=_0xa0cc15-0x0;var _0x4fa675=_0xb382[_0xa0cc15];return _0x4fa675;};'use strict';var client=require(_0x2b38('0x0'));exports[_0x2b38('0x1')]=function(){return function(){return client[_0x2b38('0x2')](_0x2b38('0x3'),{'options':{'raw':![],'attributes':['id',_0x2b38('0x4'),_0x2b38('0x5'),'strategy'],'include':[{'model':_0x2b38('0x6'),'as':_0x2b38('0x7'),'attributes':['id',_0x2b38('0x4'),'online',_0x2b38('0x8')]}]},'log':_0x2b38('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 78d675e..66c1fee 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 _0xfde0=['create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','../client'];(function(_0x62a1f1,_0x10ca9c){var _0x195f17=function(_0xea8d9a){while(--_0xea8d9a){_0x62a1f1['push'](_0x62a1f1['shift']());}};_0x195f17(++_0x10ca9c);}(_0xfde0,0x143));var _0x0fde=function(_0x32a47e,_0x3bc378){_0x32a47e=_0x32a47e-0x0;var _0x4a9368=_0xfde0[_0x32a47e];return _0x4a9368;};'use strict';var client=require(_0x0fde('0x0'));exports[_0x0fde('0x1')]=function(_0x2db49c){return client[_0x0fde('0x2')](_0x0fde('0x3'),{'body':_0x2db49c,'log':_0x0fde('0x3')});};exports[_0x0fde('0x4')]=function(_0x231a86,_0x183f1d){return client[_0x0fde('0x2')](_0x0fde('0x5'),{'body':_0x183f1d,'options':{'where':{'uniqueid':_0x231a86},'order':[['id','DESC']],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0xe413=['UpdateWhatsappQueueReport','DESC','../client','Request','CreateWhatsappQueueReport','update'];(function(_0x399e5c,_0x19340f){var _0x3cedad=function(_0x5f4c07){while(--_0x5f4c07){_0x399e5c['push'](_0x399e5c['shift']());}};_0x3cedad(++_0x19340f);}(_0xe413,0x17c));var _0x3e41=function(_0x3f0233,_0x200857){_0x3f0233=_0x3f0233-0x0;var _0x9fca73=_0xe413[_0x3f0233];return _0x9fca73;};'use strict';var client=require(_0x3e41('0x0'));exports['create']=function(_0x121348){return client[_0x3e41('0x1')](_0x3e41('0x2'),{'body':_0x121348,'log':_0x3e41('0x2')});};exports[_0x3e41('0x3')]=function(_0x3100e0,_0x3e52de){return client[_0x3e41('0x1')](_0x3e41('0x4'),{'body':_0x3e52de,'options':{'where':{'uniqueid':_0x3100e0},'order':[['id',_0x3e41('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 9b39a95..dd71618 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 _0x4c4a=['number','timeout\x20is\x20a\x20number','info','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','join','stop','agents','timeout','createQueue','atimeout','channel','format','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x3263f5,_0x3a846b){var _0x3f225f=function(_0x24484e){while(--_0x24484e){_0x3263f5['push'](_0x3263f5['shift']());}};_0x3f225f(++_0x3a846b);}(_0x4c4a,0x190));var _0xa4c4=function(_0x5cabf8,_0x1660c9){_0x5cabf8=_0x5cabf8-0x0;var _0x4bf0fc=_0x4c4a[_0x5cabf8];return _0x4bf0fc;};'use strict';var schema=require(_0xa4c4('0x0'));var _=require(_0xa4c4('0x1'));var util=require(_0xa4c4('0x2'));var seqqueue=require('seq-queue');var logger=require(_0xa4c4('0x3'))(_0xa4c4('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0xa4c4('0x5'),'required':!![],'message':_0xa4c4('0x6')},'timeout':{'type':_0xa4c4('0x7'),'message':_0xa4c4('0x8')}});function writeLog(_0x46e381,_0x56f8c4,_0x433d8f){return logger[_0xa4c4('0x9')](util['format']('[%s][AGENT][NAME:%s][STATUS:%s]',_0x46e381,_0x56f8c4[_0xa4c4('0xa')],_0x433d8f));}function handleFindAgent(_0x3c0699){return function(_0x2aa221){return _0x2aa221['name'][_0xa4c4('0xb')]()===_0x3c0699[_0xa4c4('0xb')]();};}exports[_0xa4c4('0xc')]=function(_0x24b0cd,_0x2cbd5c,_0x5cd398,_0x70d3e8){return function(_0x26b086){try{var _0xf93aad={'name':_0x2cbd5c[0x0],'timeout':_0x2cbd5c[0x1]};var _0x4dcd77=queue[_0xa4c4('0x0')](_0xf93aad,{'typecast':!![]});if(_0x4dcd77[_0xa4c4('0xd')]){logger[_0xa4c4('0xe')](_0xa4c4('0xf'),_0x24b0cd,_[_0xa4c4('0x10')](_0x4dcd77,'message')[_0xa4c4('0x11')](',\x20'));_0x26b086[_0xa4c4('0x12')]();}else{var _0x1d4b43=_['find'](_0x5cd398[_0xa4c4('0x13')],handleFindAgent(_0xf93aad[_0xa4c4('0xa')]));if(_0x1d4b43){var _0x1c291c=(_0xf93aad[_0xa4c4('0x14')]||0xa)*0x3e8;var _0x3e68bf,_0x14766c;var _0x4b8bc7=seqqueue[_0xa4c4('0x15')](_0x1c291c);_0x4b8bc7['id']=_0x24b0cd;_0x4b8bc7[_0xa4c4('0x16')]=_0x1c291c;_0x4b8bc7[_0xa4c4('0x17')]=_0x70d3e8['channel'];writeLog(_0x24b0cd,_0x1d4b43,util[_0xa4c4('0x18')](_0xa4c4('0x19'),_0x1c291c));_0x5cd398[_0xa4c4('0x1a')][_0x24b0cd]['on'](_0xa4c4('0x1b'),function(){logger[_0xa4c4('0x9')](_0xa4c4('0x1c'),_0x24b0cd);clearTimeout(_0x14766c);_0x14766c=undefined;_0x4b8bc7['close']();if(_0x5cd398[_0xa4c4('0x1a')][_0x24b0cd]){delete _0x5cd398['rules'][_0x24b0cd];}_0x26b086[_0xa4c4('0x12')]();});_0x5cd398[_0xa4c4('0x1a')][_0x24b0cd]['on'](_0xa4c4('0x1d'),function(){if(_0x5cd398['rules'][_0x24b0cd]){delete _0x5cd398[_0xa4c4('0x1a')][_0x24b0cd];}});_0x14766c=setTimeout(function(){logger[_0xa4c4('0x9')](_0xa4c4('0x1e'),_0x24b0cd);clearTimeout(_0x14766c);_0x4b8bc7[_0xa4c4('0x1f')]();_0x26b086[_0xa4c4('0x20')]();},_0x1c291c);strategy['agent'](_0x4b8bc7,_0x1d4b43,_0x5cd398,_0x70d3e8);}else{logger[_0xa4c4('0xe')](_0xa4c4('0x21'),_0x24b0cd,_0xf93aad['name']);_0x26b086['stop']();}}}catch(_0x3eb742){console[_0xa4c4('0x22')](_0x3eb742);logger['error'](_0xa4c4('0x23'),_0x24b0cd,_0x3eb742[_0xa4c4('0x24')]);_0x26b086[_0xa4c4('0x12')]();}};}; \ No newline at end of file +var _0xe342=['atimeout','channel','format','START:%s','rules','close','stop','info','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','seq-queue','../../../../config/logger','routing','number','timeout\x20is\x20a\x20number','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','error','map','message','join','find','agents','timeout'];(function(_0x16b837,_0x2af11a){var _0x277401=function(_0x6a7e9b){while(--_0x6a7e9b){_0x16b837['push'](_0x16b837['shift']());}};_0x277401(++_0x2af11a);}(_0xe342,0x1bf));var _0x2e34=function(_0x849e7c,_0x34014e){_0x849e7c=_0x849e7c-0x0;var _0x11722f=_0xe342[_0x849e7c];return _0x11722f;};'use strict';var schema=require(_0x2e34('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require(_0x2e34('0x1'));var logger=require(_0x2e34('0x2'))(_0x2e34('0x3'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x2e34('0x4'),'message':_0x2e34('0x5')}});function writeLog(_0x4ecb02,_0xc7ff2,_0x4a6640){return logger['info'](util['format'](_0x2e34('0x6'),_0x4ecb02,_0xc7ff2[_0x2e34('0x7')],_0x4a6640));}function handleFindAgent(_0x52fb58){return function(_0x5ea810){return _0x5ea810[_0x2e34('0x7')][_0x2e34('0x8')]()===_0x52fb58[_0x2e34('0x8')]();};}exports[_0x2e34('0x9')]=function(_0x5b8b56,_0x782295,_0x3b08ad,_0x53fba6){return function(_0x3c3c5e){try{var _0x3c7392={'name':_0x782295[0x0],'timeout':_0x782295[0x1]};var _0x56d05a=queue[_0x2e34('0x0')](_0x3c7392,{'typecast':!![]});if(_0x56d05a['length']){logger[_0x2e34('0xa')]('[%s][AGENT]\x20%s',_0x5b8b56,_[_0x2e34('0xb')](_0x56d05a,_0x2e34('0xc'))[_0x2e34('0xd')](',\x20'));_0x3c3c5e['stop']();}else{var _0x23f510=_[_0x2e34('0xe')](_0x3b08ad[_0x2e34('0xf')],handleFindAgent(_0x3c7392[_0x2e34('0x7')]));if(_0x23f510){var _0xb2f743=(_0x3c7392[_0x2e34('0x10')]||0xa)*0x3e8;var _0x5e61a4,_0x13783e;var _0x51e5f0=seqqueue['createQueue'](_0xb2f743);_0x51e5f0['id']=_0x5b8b56;_0x51e5f0[_0x2e34('0x11')]=_0xb2f743;_0x51e5f0[_0x2e34('0x12')]=_0x53fba6[_0x2e34('0x12')];writeLog(_0x5b8b56,_0x23f510,util[_0x2e34('0x13')](_0x2e34('0x14'),_0xb2f743));_0x3b08ad[_0x2e34('0x15')][_0x5b8b56]['on']('end',function(){logger['info']('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x5b8b56);clearTimeout(_0x13783e);_0x13783e=undefined;_0x51e5f0[_0x2e34('0x16')]();if(_0x3b08ad[_0x2e34('0x15')][_0x5b8b56]){delete _0x3b08ad[_0x2e34('0x15')][_0x5b8b56];}_0x3c3c5e[_0x2e34('0x17')]();});_0x3b08ad[_0x2e34('0x15')][_0x5b8b56]['on']('complete',function(){if(_0x3b08ad[_0x2e34('0x15')][_0x5b8b56]){delete _0x3b08ad[_0x2e34('0x15')][_0x5b8b56];}});_0x13783e=setTimeout(function(){logger[_0x2e34('0x18')]('[%s][AGENT]\x20ROUTING\x20END',_0x5b8b56);clearTimeout(_0x13783e);_0x51e5f0['close']();_0x3c3c5e['next']();},_0xb2f743);strategy[_0x2e34('0x19')](_0x51e5f0,_0x23f510,_0x3b08ad,_0x53fba6);}else{logger[_0x2e34('0xa')](_0x2e34('0x1a'),_0x5b8b56,_0x3c7392['name']);_0x3c3c5e[_0x2e34('0x17')]();}}}catch(_0x2ba08a){console['log'](_0x2ba08a);logger[_0x2e34('0xa')](_0x2e34('0x1b'),_0x5b8b56,_0x2ba08a[_0x2e34('0x1c')]);_0x3c3c5e[_0x2e34('0x17')]();}};}; \ 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 08e8add..625fe88 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 _0x63ea=['isEmpty','getMustacheRender','Message','create','[%s][AMAZONLEX]\x20%s','body','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','message','toString','error','amazonlex','providerName','providerResponse','then','dialogState','catch','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','next','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','whatsapp','phone','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','created'];(function(_0x121cc8,_0x1a644f){var _0x495371=function(_0x1b120e){while(--_0x1b120e){_0x121cc8['push'](_0x121cc8['shift']());}};_0x495371(++_0x1a644f);}(_0x63ea,0x109));var _0xa63e=function(_0x29474f,_0x1c2837){_0x29474f=_0x29474f-0x0;var _0x1a65b1=_0x63ea[_0x29474f];return _0x1a65b1;};'use strict';var _=require(_0xa63e('0x0'));var moment=require(_0xa63e('0x1'));var AWS=require('aws-sdk');var utils=require(_0xa63e('0x2'));var logger=require(_0xa63e('0x3'))('routing');var rpc={'chatMessage':require(_0xa63e('0x4')),'openchannelMessage':require(_0xa63e('0x5')),'mailMessage':require(_0xa63e('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xa63e('0x7')),'whatsappMessage':require(_0xa63e('0x8'))};exports[_0xa63e('0x9')]=function(_0x18a717,_0x46336b){return function(_0x5483d2){try{if(!_[_0xa63e('0xa')](this[_0xa63e('0xb')][_0xa63e('0xc')])){logger[_0xa63e('0xd')]('[%s][AMAZONLEX]\x20%s',_0x18a717,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x5483d2[_0xa63e('0xe')]();}var _0xf0ad11={'ContactId':this['contact']['id'],'sentAt':moment()[_0xa63e('0xf')](_0xa63e('0x10')),'direction':_0xa63e('0x11')};if(this['channel']===_0xa63e('0x12')||this['channel']===_0xa63e('0x13')){_0xf0ad11[_0xa63e('0x14')]=this[_0xa63e('0xb')][_0xa63e('0x14')];}var _0x135216=this[_0xa63e('0x15')];if(_0x135216===_0xa63e('0x16')){_0xf0ad11[_0xa63e('0x17')]=this[_0xa63e('0x18')]['id'];}else{_0xf0ad11[_['upperFirst'](_0x135216)+_0xa63e('0x19')]=this[_0xa63e('0x18')]['id'];}_0xf0ad11[_[_0xa63e('0x1a')](_0x135216)+_0xa63e('0x1b')]=this[_0xa63e('0xb')]['id'];if(this[_0xa63e('0xb')][_0xa63e('0x1c')]){var _0x29890e=_0x46336b[0x4];if(!_[_0xa63e('0x1d')](_0x29890e)){_0xf0ad11['body']=utils[_0xa63e('0x1e')](_0x29890e,this);return rpc[_0x135216+_0xa63e('0x1f')][_0xa63e('0x20')](_0xf0ad11)['then'](function(_0x2f05de){logger['info'](_0xa63e('0x21'),_0x18a717,_0xf0ad11[_0xa63e('0x22')]);})['catch'](function(_0x57decc){logger['error'](_0xa63e('0x21'),_0x18a717,JSON[_0xa63e('0x23')](_0x57decc));})['finally'](function(){logger[_0xa63e('0xd')](_0xa63e('0x24'),_0x18a717);_0x5483d2['stop']();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x18a717);_0x5483d2[_0xa63e('0x25')]();}}else{var _0x5de25e=this;var _0x339b03=new AWS[(_0xa63e('0x26'))]({'accessKeyId':_0x46336b[0x0],'secretAccessKey':_0x46336b[0x1],'region':_0x46336b[0x2]});var _0x5ccb92={'botAlias':_0xa63e('0x27'),'botName':_0x46336b[0x3],'inputText':this[_0xa63e('0x28')][_0xa63e('0x22')],'userId':this['channel']+':'+this['interaction']['id'][_0xa63e('0x29')]()};_0x339b03['postText'](_0x5ccb92,function(_0x417ea1,_0x3201f1){if(_0x417ea1){logger[_0xa63e('0x2a')](_0xa63e('0x21'),_0x18a717,_0x417ea1[_0xa63e('0x28')]);_0x5483d2[_0xa63e('0xe')]();}else if(_0x3201f1&&_0x3201f1[_0xa63e('0x28')]){_0x5de25e[_0xa63e('0x22')][_0xa63e('0x2b')]=_0x3201f1;_0xf0ad11[_0xa63e('0x22')]=_0x3201f1[_0xa63e('0x28')];_0xf0ad11[_0xa63e('0x2c')]=_0xa63e('0x2b');_0xf0ad11[_0xa63e('0x2d')]=JSON[_0xa63e('0x23')](_0x3201f1);return rpc[_0x135216+'Message'][_0xa63e('0x20')](_0xf0ad11)[_0xa63e('0x2e')](function(_0x17f1ee){logger[_0xa63e('0xd')](_0xa63e('0x21'),_0x18a717,_0xf0ad11['body']);if(_0x3201f1[_0xa63e('0x2f')]=='Failed'){_0x5483d2['next']();}else{_0x5483d2[_0xa63e('0x25')]();}})[_0xa63e('0x30')](function(_0x351681){logger[_0xa63e('0x2a')](_0xa63e('0x21'),_0x18a717,JSON[_0xa63e('0x23')](_0x351681));_0x5483d2[_0xa63e('0xe')]();});}else{_0x5483d2[_0xa63e('0xe')]();}});}}catch(_0x2f7a53){logger[_0xa63e('0x2a')]('[%s][AMAZONLEX]\x20%s',_0x18a717,JSON[_0xa63e('0x23')](_0x2f7a53));_0x5483d2['stop']();}};}; \ No newline at end of file +var _0x2d6d=['dialogState','Failed','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','chat','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','created','isEmpty','getMustacheRender','body','catch','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','stringify','create'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x2d6d,0x1a9));var _0xd2d6=function(_0x138836,_0x229129){_0x138836=_0x138836-0x0;var _0x322688=_0x2d6d[_0x138836];return _0x322688;};'use strict';var _=require('lodash');var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0xd2d6('0x0'));var logger=require(_0xd2d6('0x1'))(_0xd2d6('0x2'));var rpc={'chatMessage':require(_0xd2d6('0x3')),'openchannelMessage':require(_0xd2d6('0x4')),'mailMessage':require(_0xd2d6('0x5')),'smsMessage':require(_0xd2d6('0x6')),'faxMessage':require(_0xd2d6('0x7')),'whatsappMessage':require(_0xd2d6('0x8'))};exports[_0xd2d6('0x9')]=function(_0x25ac4d,_0x37bcd1){return function(_0x16586b){try{if(!_['isNil'](this[_0xd2d6('0xa')]['UserId'])){logger[_0xd2d6('0xb')](_0xd2d6('0xc'),_0x25ac4d,_0xd2d6('0xd'));return _0x16586b[_0xd2d6('0xe')]();}var _0x1bd509={'ContactId':this[_0xd2d6('0xf')]['id'],'sentAt':moment()[_0xd2d6('0x10')](_0xd2d6('0x11')),'direction':'out'};if(this[_0xd2d6('0x12')]==='sms'||this['channel']===_0xd2d6('0x13')){_0x1bd509[_0xd2d6('0x14')]=this[_0xd2d6('0xa')]['phone'];}var _0x1daebf=this['channel'];if(_0x1daebf===_0xd2d6('0x15')){_0x1bd509[_0xd2d6('0x16')]=this['account']['id'];}else{_0x1bd509[_['upperFirst'](_0x1daebf)+_0xd2d6('0x17')]=this[_0xd2d6('0x18')]['id'];}_0x1bd509[_[_0xd2d6('0x19')](_0x1daebf)+_0xd2d6('0x1a')]=this[_0xd2d6('0xa')]['id'];if(this[_0xd2d6('0xa')][_0xd2d6('0x1b')]){var _0x5eb366=_0x37bcd1[0x4];if(!_[_0xd2d6('0x1c')](_0x5eb366)){_0x1bd509['body']=utils[_0xd2d6('0x1d')](_0x5eb366,this);return rpc[_0x1daebf+'Message']['create'](_0x1bd509)['then'](function(_0x26a494){logger['info'](_0xd2d6('0xc'),_0x25ac4d,_0x1bd509[_0xd2d6('0x1e')]);})[_0xd2d6('0x1f')](function(_0x3a1156){logger['error']('[%s][AMAZONLEX]\x20%s',_0x25ac4d,JSON['stringify'](_0x3a1156));})['finally'](function(){logger[_0xd2d6('0xb')](_0xd2d6('0x20'),_0x25ac4d);_0x16586b['stop']();});}else{logger[_0xd2d6('0xb')](_0xd2d6('0x21'),_0x25ac4d);_0x16586b[_0xd2d6('0x22')]();}}else{var _0x1e4fc1=this;var _0x1b26c8=new AWS[(_0xd2d6('0x23'))]({'accessKeyId':_0x37bcd1[0x0],'secretAccessKey':_0x37bcd1[0x1],'region':_0x37bcd1[0x2]});var _0x478a48={'botAlias':_0xd2d6('0x24'),'botName':_0x37bcd1[0x3],'inputText':this[_0xd2d6('0x25')][_0xd2d6('0x1e')],'userId':this[_0xd2d6('0x12')]+':'+this[_0xd2d6('0xa')]['id'][_0xd2d6('0x26')]()};_0x1b26c8[_0xd2d6('0x27')](_0x478a48,function(_0x47ae94,_0x115e7b){if(_0x47ae94){logger['error'](_0xd2d6('0xc'),_0x25ac4d,_0x47ae94[_0xd2d6('0x25')]);_0x16586b[_0xd2d6('0xe')]();}else if(_0x115e7b&&_0x115e7b[_0xd2d6('0x25')]){_0x1e4fc1[_0xd2d6('0x1e')][_0xd2d6('0x28')]=_0x115e7b;_0x1bd509[_0xd2d6('0x1e')]=_0x115e7b[_0xd2d6('0x25')];_0x1bd509[_0xd2d6('0x29')]=_0xd2d6('0x28');_0x1bd509[_0xd2d6('0x2a')]=JSON[_0xd2d6('0x2b')](_0x115e7b);return rpc[_0x1daebf+'Message'][_0xd2d6('0x2c')](_0x1bd509)['then'](function(_0x14d923){logger[_0xd2d6('0xb')]('[%s][AMAZONLEX]\x20%s',_0x25ac4d,_0x1bd509[_0xd2d6('0x1e')]);if(_0x115e7b[_0xd2d6('0x2d')]==_0xd2d6('0x2e')){_0x16586b['next']();}else{_0x16586b[_0xd2d6('0x22')]();}})[_0xd2d6('0x1f')](function(_0x5e7184){logger['error'](_0xd2d6('0xc'),_0x25ac4d,JSON[_0xd2d6('0x2b')](_0x5e7184));_0x16586b[_0xd2d6('0xe')]();});}else{_0x16586b[_0xd2d6('0xe')]();}});}}catch(_0xc7a264){logger['error'](_0xd2d6('0xc'),_0x25ac4d,JSON[_0xd2d6('0x2b')](_0xc7a264));_0x16586b['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 51e345b..1c96f92 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 _0xea8c=['../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','Message','Smtp','service','host','port','secure','auth','user','messageId','html','replace','','auto-replied','All','auto_reply','sendMailMessage','then','create','stringify','error','finally','resolve','catch','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Interaction','update','stop','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction'];(function(_0xcb5a3c,_0x5588c3){var _0x1229a0=function(_0x2be096){while(--_0x2be096){_0xcb5a3c['push'](_0xcb5a3c['shift']());}};_0x1229a0(++_0x5588c3);}(_0xea8c,0xd4));var _0xcea8=function(_0x31aace,_0x415c7c){_0x31aace=_0x31aace-0x0;var _0x397f6d=_0xea8c[_0x31aace];return _0x397f6d;};'use strict';var _=require(_0xcea8('0x0'));var moment=require(_0xcea8('0x1'));var utils=require(_0xcea8('0x2'));var logger=require(_0xcea8('0x3'))('routing');var rpc={'chatMessage':require(_0xcea8('0x4')),'openchannelMessage':require(_0xcea8('0x5')),'mailMessage':require(_0xcea8('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xcea8('0x7')),'whatsappMessage':require(_0xcea8('0x8')),'chatInteraction':require(_0xcea8('0x9')),'openchannelInteraction':require(_0xcea8('0xa')),'mailInteraction':require(_0xcea8('0xb')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0xcea8('0xc')),'whatsappInteraction':require(_0xcea8('0xd'))};var mailRpc=require(_0xcea8('0xe'));exports['consequence']=function(_0x5e29e4,_0x2b03a4,_0x86430d,_0x404262){return function(_0x22fa39){try{var _0x29c404=this[_0xcea8('0xf')];if(_0x29c404===_0xcea8('0x10')&&_0x404262[_0xcea8('0x11')][_0xcea8('0x12')]){logger[_0xcea8('0x13')](_0xcea8('0x14'),_0x5e29e4,_0xcea8('0x15'));return _0x22fa39[_0xcea8('0x16')]();}if(_0x2b03a4[0x0]==='1'&&(_[_0xcea8('0x17')](this[_0xcea8('0x18')]['created'])||!this[_0xcea8('0x18')][_0xcea8('0x19')])){logger['info'](_0xcea8('0x14'),_0x5e29e4,_0xcea8('0x1a'));return _0x22fa39[_0xcea8('0x16')]();}if(_0x2b03a4[0x0]==='2'&&this['interaction'][_0xcea8('0x1b')]){logger['info'](_0xcea8('0x1c'),_0x5e29e4,_0xcea8('0x1d'));return _0x22fa39[_0xcea8('0x16')]();}var _0x4039f1={'ContactId':this[_0xcea8('0x1e')]['id'],'sentAt':moment()[_0xcea8('0x1f')](_0xcea8('0x20')),'direction':_0xcea8('0x21')};if(this[_0xcea8('0xf')]===_0xcea8('0x10')){_0x4039f1[_0xcea8('0x11')]=utils[_0xcea8('0x22')](_0x2b03a4[0x2],this);}else{_0x4039f1[_0xcea8('0x11')]=utils[_0xcea8('0x22')](_0x2b03a4[0x1],this);}if(this[_0xcea8('0x23')]){_0x4039f1['to']=this[_0xcea8('0x23')]['from']||'';if(this[_0xcea8('0xf')]===_0xcea8('0x10')&&_0x2b03a4[0x1]==='1'){_0x4039f1['cc']=this[_0xcea8('0x23')]['cc']||'';}_0x4039f1['from']=this[_0xcea8('0x23')]['to']||'';_0x4039f1[_0xcea8('0x24')]=this[_0xcea8('0x23')][_0xcea8('0x24')]||'';_0x4039f1[_0xcea8('0x25')]=!![];if(this[_0xcea8('0x23')][_0xcea8('0x26')]){_0x4039f1[_0xcea8('0x26')]='';_0x4039f1['subject']+=_[_0xcea8('0x27')](this[_0xcea8('0x23')]['subject'],'Re:')?'':_0xcea8('0x28');_0x4039f1[_0xcea8('0x26')]+=this[_0xcea8('0x23')][_0xcea8('0x26')];}}if(this[_0xcea8('0xf')]===_0xcea8('0x29')){_0x4039f1[_0xcea8('0x2a')]=this[_0xcea8('0x2b')]['id'];}else{_0x4039f1[_[_0xcea8('0x2c')](this['channel'])+_0xcea8('0x2d')]=this[_0xcea8('0x2b')]['id'];}_0x4039f1[_[_0xcea8('0x2c')](this[_0xcea8('0xf')])+'InteractionId']=this[_0xcea8('0x18')]['id'];var _0x17904d=this[_0xcea8('0x18')];if(rpc[this[_0xcea8('0xf')]+_0xcea8('0x2e')]){if(this['channel']===_0xcea8('0x10')){var _0x2aa338={'tls':{'rejectUnauthorized':![]}};if(this[_0xcea8('0x2b')][_0xcea8('0x2f')][_0xcea8('0x30')]){_0x2aa338[_0xcea8('0x30')]=this[_0xcea8('0x2b')][_0xcea8('0x2f')][_0xcea8('0x30')];}else{_0x2aa338[_0xcea8('0x31')]=this['account'][_0xcea8('0x2f')]['host'];_0x2aa338[_0xcea8('0x32')]=this[_0xcea8('0x2b')][_0xcea8('0x2f')][_0xcea8('0x32')];_0x2aa338[_0xcea8('0x33')]=this[_0xcea8('0x2b')][_0xcea8('0x2f')][_0xcea8('0x33')];}if(this[_0xcea8('0x2b')][_0xcea8('0x2f')]['authentication']){_0x2aa338[_0xcea8('0x34')]={'user':this[_0xcea8('0x2b')][_0xcea8('0x2f')][_0xcea8('0x35')],'pass':this[_0xcea8('0x2b')][_0xcea8('0x2f')]['pass']};}_0x4039f1['inReplyTo']=this['message'][_0xcea8('0x36')];_0x4039f1[_0xcea8('0x37')]=''+_[_0xcea8('0x38')](_0x4039f1[_0xcea8('0x11')],_0xcea8('0x39'),'','';_0x433e02[_0xb17b('0x36')]={'Auto-Submitted':_0xb17b('0x37'),'X-Auto-Response-Suppress':_0xb17b('0x38'),'Precedence':'auto_reply'};return mailRpc[_0xb17b('0x39')](_0x2dff1d,_0x433e02)[_0xb17b('0x3a')](function(_0x569618){logger['info'](_0xb17b('0x3b'),_0x12635d);_0x433e02[_0xb17b('0x31')]=_0x569618[_0xb17b('0x1e')][_0xb17b('0x31')];return rpc[_0x5b7dc5+_0xb17b('0x28')]['create'](_0x433e02);})[_0xb17b('0x3a')](function(_0x25d93a){logger['info'](_0xb17b('0xf'),_0x12635d,JSON[_0xb17b('0x3c')](_0x25d93a));})[_0xb17b('0x3d')](function(_0x161aa3){logger[_0xb17b('0x3e')]('[RPC][%s][AUTOREPLY]\x20%s',_0x12635d,JSON[_0xb17b('0x3c')](_0x161aa3));})[_0xb17b('0x3f')](function(){Promise[_0xb17b('0x40')]()[_0xb17b('0x3a')](function(){if(_0x36fd37[0x0]!=='2'||_0x1fd0e8[_0xb17b('0x15')])return;return rpc[_0x5b7dc5+_0xb17b('0x41')][_0xb17b('0x42')](_0x1fd0e8['id'],{'autoreplyExecuted':!![]})[_0xb17b('0x3a')](function(_0x5a7f68){logger['info'](_0xb17b('0x16'),_0x12635d,JSON[_0xb17b('0x3c')](_0x5a7f68));})['catch'](function(_0x58e768){logger[_0xb17b('0x3e')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x12635d,JSON['stringify'](_0x58e768));});})[_0xb17b('0x3a')](function(){_0x3561ad[_0xb17b('0x14')]();});});}else{return rpc[this[_0xb17b('0x1c')]+_0xb17b('0x28')]['create'](_0x433e02)[_0xb17b('0x3a')](function(_0x5122a9){logger['info']('[%s][AUTOREPLY]\x20%s',_0x12635d,_0x433e02[_0xb17b('0xd')]);})[_0xb17b('0x3d')](function(_0x131c97){logger[_0xb17b('0x3e')](_0xb17b('0xf'),_0x12635d,JSON['stringify'](_0x131c97));})[_0xb17b('0x3f')](function(){Promise['resolve']()[_0xb17b('0x3a')](function(){if(_0x36fd37[0x0]!=='2'||_0x1fd0e8[_0xb17b('0x15')])return;return rpc[_0x5b7dc5+_0xb17b('0x41')]['update'](_0x1fd0e8['id'],{'autoreplyExecuted':!![]})[_0xb17b('0x3a')](function(_0x50eea0){logger[_0xb17b('0xe')](_0xb17b('0x16'),_0x12635d,JSON[_0xb17b('0x3c')](_0x50eea0));})['catch'](function(_0x1b74e1){logger[_0xb17b('0x3e')](_0xb17b('0x43'),_0x12635d,JSON[_0xb17b('0x3c')](_0x1b74e1));});})[_0xb17b('0x3a')](function(){_0x3561ad[_0xb17b('0x14')]();});});}}}catch(_0x15c7f8){logger[_0xb17b('0x3e')]('[%s][AUTOREPLY]\x20%s',_0x12635d,JSON[_0xb17b('0x3c')](_0x15c7f8));_0x3561ad[_0xb17b('0x44')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 60f5968..24944de 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 _0x5a03=['update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','channel','Interaction'];(function(_0x3033a,_0x481c8e){var _0x10c4a7=function(_0x485c0b){while(--_0x485c0b){_0x3033a['push'](_0x3033a['shift']());}};_0x10c4a7(++_0x481c8e);}(_0x5a03,0xd8));var _0x35a0=function(_0x2e2f09,_0x13b1ee){_0x2e2f09=_0x2e2f09-0x0;var _0x15ebd5=_0x5a03[_0x2e2f09];return _0x15ebd5;};'use strict';var moment=require('moment');var logger=require(_0x35a0('0x0'))(_0x35a0('0x1'));var rpc={'chatInteraction':require(_0x35a0('0x2')),'openchannelInteraction':require(_0x35a0('0x3')),'smsInteraction':require(_0x35a0('0x4')),'mailInteraction':require(_0x35a0('0x5')),'faxInteraction':require(_0x35a0('0x6')),'whatsappInteraction':require(_0x35a0('0x7'))};exports[_0x35a0('0x8')]=function(_0x59632f,_0x19fe17,_0x4b511b,_0x5237be){return function(_0x2059c3){try{logger[_0x35a0('0x9')](_0x35a0('0xa'),_0x59632f,_0x19fe17[0x0]);var _0x462000={'closed':0x1,'closedAt':moment()[_0x35a0('0xb')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':'system','disposition':_0x19fe17[0x0]};if(rpc[_0x5237be[_0x35a0('0xc')]+_0x35a0('0xd')]){rpc[_0x5237be[_0x35a0('0xc')]+_0x35a0('0xd')][_0x35a0('0xe')](_0x5237be[_0x35a0('0xf')]['id'],_0x462000)['then'](function(_0x187e2f){logger['info'](_0x35a0('0x10'),_0x59632f,_0x5237be[_0x35a0('0xf')]['id']);})[_0x35a0('0x11')](function(_0x238cfd){logger[_0x35a0('0x12')](_0x35a0('0x13'),_0x59632f,JSON[_0x35a0('0x14')](_0x238cfd));})[_0x35a0('0x15')](function(){_0x2059c3[_0x35a0('0x16')]();});}}catch(_0x1065c8){logger['error'](_0x35a0('0x13'),_0x59632f,JSON[_0x35a0('0x14')](_0x1065c8));_0x2059c3[_0x35a0('0x16')]();}};}; \ No newline at end of file +var _0xcb5c=['[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','error'];(function(_0xf26c2e,_0x56c3ea){var _0x46ecb4=function(_0x1be516){while(--_0x1be516){_0xf26c2e['push'](_0xf26c2e['shift']());}};_0x46ecb4(++_0x56c3ea);}(_0xcb5c,0xc1));var _0xccb5=function(_0x4755c5,_0x5ff0f6){_0x4755c5=_0x4755c5-0x0;var _0x77aed9=_0xcb5c[_0x4755c5];return _0x77aed9;};'use strict';var moment=require(_0xccb5('0x0'));var logger=require(_0xccb5('0x1'))(_0xccb5('0x2'));var rpc={'chatInteraction':require(_0xccb5('0x3')),'openchannelInteraction':require(_0xccb5('0x4')),'smsInteraction':require(_0xccb5('0x5')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xccb5('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports['consequence']=function(_0x4c8d81,_0x231de4,_0x372f48,_0x3b9f39){return function(_0x417d5e){try{logger[_0xccb5('0x7')](_0xccb5('0x8'),_0x4c8d81,_0x231de4[0x0]);var _0x2c25cc={'closed':0x1,'closedAt':moment()[_0xccb5('0x9')](_0xccb5('0xa')),'closeReason':'system','disposition':_0x231de4[0x0]};if(rpc[_0x3b9f39[_0xccb5('0xb')]+_0xccb5('0xc')]){rpc[_0x3b9f39[_0xccb5('0xb')]+'Interaction']['update'](_0x3b9f39['interaction']['id'],_0x2c25cc)[_0xccb5('0xd')](function(_0x5b5c58){logger[_0xccb5('0x7')](_0xccb5('0xe'),_0x4c8d81,_0x3b9f39[_0xccb5('0xf')]['id']);})['catch'](function(_0x5f67e4){logger[_0xccb5('0x10')](_0xccb5('0x11'),_0x4c8d81,JSON[_0xccb5('0x12')](_0x5f67e4));})[_0xccb5('0x13')](function(){_0x417d5e[_0xccb5('0x14')]();});}}catch(_0x3b378e){logger['error']('[%s][CLOSE]\x20%s',_0x4c8d81,JSON[_0xccb5('0x12')](_0x3b378e));_0x417d5e['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index fd55dbe..24ee7ad 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 _0xb5dd=['phone','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','info','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','textRequest','result','providerName','dialogflow','providerResponse','metadata','lodash','moment','apiai-promise','md5','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp'];(function(_0xabb8a1,_0x5ed479){var _0x9a4673=function(_0x44ed09){while(--_0x44ed09){_0xabb8a1['push'](_0xabb8a1['shift']());}};_0x9a4673(++_0x5ed479);}(_0xb5dd,0xd9));var _0xdb5d=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xb5dd[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xdb5d('0x0'));var moment=require(_0xdb5d('0x1'));var apiai=require(_0xdb5d('0x2'));var md5=require(_0xdb5d('0x3'));var utils=require(_0xdb5d('0x4'));var logger=require('../../../../config/logger')(_0xdb5d('0x5'));var rpc={'chatMessage':require(_0xdb5d('0x6')),'openchannelMessage':require(_0xdb5d('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xdb5d('0x8')),'faxMessage':require(_0xdb5d('0x9')),'whatsappMessage':require(_0xdb5d('0xa'))};exports[_0xdb5d('0xb')]=function(_0x2d980b,_0x89fa9e){return function(_0x344631){try{if(!_[_0xdb5d('0xc')](this[_0xdb5d('0xd')][_0xdb5d('0xe')])){logger['info'](_0xdb5d('0xf'),_0x2d980b,_0xdb5d('0x10'));return _0x344631[_0xdb5d('0x11')]();}var _0x4fb3ab={'ContactId':this['contact']['id'],'sentAt':moment()[_0xdb5d('0x12')](_0xdb5d('0x13')),'direction':_0xdb5d('0x14')};if(this['channel']==='sms'||this[_0xdb5d('0x15')]===_0xdb5d('0x16')){_0x4fb3ab[_0xdb5d('0x17')]=this[_0xdb5d('0xd')][_0xdb5d('0x17')];}var _0x114c34=this[_0xdb5d('0x15')];if(_0x114c34==='chat'){_0x4fb3ab[_0xdb5d('0x18')]=this[_0xdb5d('0x19')]['id'];}else{_0x4fb3ab[_[_0xdb5d('0x1a')](_0x114c34)+'AccountId']=this[_0xdb5d('0x19')]['id'];}_0x4fb3ab[_[_0xdb5d('0x1a')](_0x114c34)+_0xdb5d('0x1b')]=this['interaction']['id'];if(this['interaction'][_0xdb5d('0x1c')]){var _0x5d334c=_0x89fa9e[0x2];if(!_[_0xdb5d('0x1d')](_0x5d334c)){_0x4fb3ab[_0xdb5d('0x1e')]=utils[_0xdb5d('0x1f')](_0x5d334c,this);return rpc[_0x114c34+_0xdb5d('0x20')][_0xdb5d('0x21')](_0x4fb3ab)[_0xdb5d('0x22')](function(_0x427bf7){logger['info'](_0xdb5d('0xf'),_0x2d980b,_0x4fb3ab['body']);})[_0xdb5d('0x23')](function(_0x405d3d){logger[_0xdb5d('0x24')](_0xdb5d('0xf'),_0x2d980b,JSON[_0xdb5d('0x25')](_0x405d3d));})['finally'](function(){logger[_0xdb5d('0x26')](_0xdb5d('0x27'),_0x2d980b);_0x344631['stop']();});}else{logger['info'](_0xdb5d('0x28'),_0x2d980b);_0x344631[_0xdb5d('0x29')]();}}else{var _0x598a03=this;var _0x2e6b0c=apiai(_0x89fa9e[0x0],{'language':_0x89fa9e[0x1]||'en'});return _0x2e6b0c[_0xdb5d('0x2a')](this['message'][_0xdb5d('0x1e')],{'sessionId':md5(this['interaction']['id'])})[_0xdb5d('0x22')](function(_0x4c6a0a){_0x598a03[_0xdb5d('0x1e')]['dialogflow']=_0x4c6a0a;_0x4fb3ab['body']=_0x4c6a0a[_0xdb5d('0x2b')]['fulfillment']['speech'];_0x4fb3ab[_0xdb5d('0x2c')]=_0xdb5d('0x2d');_0x4fb3ab[_0xdb5d('0x2e')]=JSON[_0xdb5d('0x25')](_0x4c6a0a);return rpc[_0x114c34+_0xdb5d('0x20')]['create'](_0x4fb3ab)[_0xdb5d('0x22')](function(_0xd966ed){logger[_0xdb5d('0x26')](_0xdb5d('0xf'),_0x2d980b,_0x4fb3ab[_0xdb5d('0x1e')]);if(_0x4c6a0a[_0xdb5d('0x2b')][_0xdb5d('0x2f')]['endConversation']){_0x344631[_0xdb5d('0x11')]();}else{_0x344631[_0xdb5d('0x29')]();}})[_0xdb5d('0x23')](function(_0x528304){logger['error'](_0xdb5d('0xf'),_0x2d980b,JSON['stringify'](_0x528304));_0x344631[_0xdb5d('0x11')]();});})[_0xdb5d('0x23')](function(_0x3affd3){logger[_0xdb5d('0x24')](_0xdb5d('0xf'),_0x2d980b,_0x3affd3['message']);_0x344631['next']();});}}catch(_0x16ddea){logger[_0xdb5d('0x24')](_0xdb5d('0xf'),_0x2d980b,JSON[_0xdb5d('0x25')](_0x16ddea));_0x344631[_0xdb5d('0x29')]();}};}; \ No newline at end of file +var _0xcfcb=['ChatWebsiteId','account','AccountId','upperFirst','InteractionId','isEmpty','getMustacheRender','Message','[%s][DIALOGFLOW]\x20%s','catch','error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','body','fulfillment','speech','dialogflow','providerResponse','create','then','metadata','endConversation','next','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone'];(function(_0x20647c,_0x262425){var _0x51db8a=function(_0x4bdb98){while(--_0x4bdb98){_0x20647c['push'](_0x20647c['shift']());}};_0x51db8a(++_0x262425);}(_0xcfcb,0x7a));var _0xbcfc=function(_0x400635,_0x49a764){_0x400635=_0x400635-0x0;var _0x5b0c61=_0xcfcb[_0x400635];return _0x5b0c61;};'use strict';var _=require(_0xbcfc('0x0'));var moment=require('moment');var apiai=require('apiai-promise');var md5=require('md5');var utils=require(_0xbcfc('0x1'));var logger=require(_0xbcfc('0x2'))(_0xbcfc('0x3'));var rpc={'chatMessage':require(_0xbcfc('0x4')),'openchannelMessage':require(_0xbcfc('0x5')),'mailMessage':require(_0xbcfc('0x6')),'smsMessage':require(_0xbcfc('0x7')),'faxMessage':require(_0xbcfc('0x8')),'whatsappMessage':require(_0xbcfc('0x9'))};exports[_0xbcfc('0xa')]=function(_0x4056a8,_0x42052a){return function(_0x2a57ad){try{if(!_[_0xbcfc('0xb')](this[_0xbcfc('0xc')][_0xbcfc('0xd')])){logger[_0xbcfc('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x4056a8,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2a57ad['next']();}var _0x541fe2={'ContactId':this[_0xbcfc('0xf')]['id'],'sentAt':moment()[_0xbcfc('0x10')](_0xbcfc('0x11')),'direction':_0xbcfc('0x12')};if(this[_0xbcfc('0x13')]===_0xbcfc('0x14')||this[_0xbcfc('0x13')]==='whatsapp'){_0x541fe2['phone']=this[_0xbcfc('0xc')][_0xbcfc('0x15')];}var _0x52aba1=this[_0xbcfc('0x13')];if(_0x52aba1==='chat'){_0x541fe2[_0xbcfc('0x16')]=this[_0xbcfc('0x17')]['id'];}else{_0x541fe2[_['upperFirst'](_0x52aba1)+_0xbcfc('0x18')]=this[_0xbcfc('0x17')]['id'];}_0x541fe2[_[_0xbcfc('0x19')](_0x52aba1)+_0xbcfc('0x1a')]=this[_0xbcfc('0xc')]['id'];if(this[_0xbcfc('0xc')]['created']){var _0x3ec18c=_0x42052a[0x2];if(!_[_0xbcfc('0x1b')](_0x3ec18c)){_0x541fe2['body']=utils[_0xbcfc('0x1c')](_0x3ec18c,this);return rpc[_0x52aba1+_0xbcfc('0x1d')]['create'](_0x541fe2)['then'](function(_0x15abcf){logger[_0xbcfc('0xe')](_0xbcfc('0x1e'),_0x4056a8,_0x541fe2['body']);})[_0xbcfc('0x1f')](function(_0x406fcd){logger[_0xbcfc('0x20')](_0xbcfc('0x1e'),_0x4056a8,JSON[_0xbcfc('0x21')](_0x406fcd));})['finally'](function(){logger[_0xbcfc('0xe')](_0xbcfc('0x22'),_0x4056a8);_0x2a57ad[_0xbcfc('0x23')]();});}else{logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x4056a8);_0x2a57ad[_0xbcfc('0x23')]();}}else{var _0x172ba1=this;var _0x43f168=apiai(_0x42052a[0x0],{'language':_0x42052a[0x1]||'en'});return _0x43f168[_0xbcfc('0x24')](this[_0xbcfc('0x25')][_0xbcfc('0x26')],{'sessionId':md5(this[_0xbcfc('0xc')]['id'])})['then'](function(_0x3a90a7){_0x172ba1[_0xbcfc('0x26')]['dialogflow']=_0x3a90a7;_0x541fe2[_0xbcfc('0x26')]=_0x3a90a7['result'][_0xbcfc('0x27')][_0xbcfc('0x28')];_0x541fe2['providerName']=_0xbcfc('0x29');_0x541fe2[_0xbcfc('0x2a')]=JSON[_0xbcfc('0x21')](_0x3a90a7);return rpc[_0x52aba1+_0xbcfc('0x1d')][_0xbcfc('0x2b')](_0x541fe2)[_0xbcfc('0x2c')](function(_0x582e45){logger[_0xbcfc('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x4056a8,_0x541fe2[_0xbcfc('0x26')]);if(_0x3a90a7['result'][_0xbcfc('0x2d')][_0xbcfc('0x2e')]){_0x2a57ad[_0xbcfc('0x2f')]();}else{_0x2a57ad[_0xbcfc('0x23')]();}})[_0xbcfc('0x1f')](function(_0x258362){logger[_0xbcfc('0x20')](_0xbcfc('0x1e'),_0x4056a8,JSON[_0xbcfc('0x21')](_0x258362));_0x2a57ad[_0xbcfc('0x2f')]();});})[_0xbcfc('0x1f')](function(_0x580ecc){logger[_0xbcfc('0x20')]('[%s][DIALOGFLOW]\x20%s',_0x4056a8,_0x580ecc[_0xbcfc('0x25')]);_0x2a57ad[_0xbcfc('0x2f')]();});}}catch(_0x421925){logger[_0xbcfc('0x20')](_0xbcfc('0x1e'),_0x4056a8,JSON['stringify'](_0x421925));_0x2a57ad[_0xbcfc('0x23')]();}};}; \ 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 40faed7..24dd137 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 _0x702c=['./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','clone','body','create','then','[%s][DIALOGFLOWV2]\x20%s','catch','consequence','isNil','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','isEmpty','Message','error','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','sessionPath','message','detectIntent','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','DIALOGFLOWV2_INTENTNAME','name','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','dialogflowV2','stringify','fulfillmentText','push','all','lodash','dialogflow','md5','moment','bluebird','routing'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x702c,0x1e4));var _0xc702=function(_0x2378ad,_0x49892e){_0x2378ad=_0x2378ad-0x0;var _0x307bda=_0x702c[_0x2378ad];return _0x307bda;};'use strict';var _=require(_0xc702('0x0'));var dialogflow=require(_0xc702('0x1'));var md5=require(_0xc702('0x2'));var moment=require(_0xc702('0x3'));var Promise=require(_0xc702('0x4'));var logger=require('../../../../config/logger')(_0xc702('0x5'));var utils=require(_0xc702('0x6'));var rpc={'chatMessage':require(_0xc702('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xc702('0x8')),'smsMessage':require(_0xc702('0x9')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x1e6471,_0x79f9bb,_0x1ab818,_0x159696){return new Promise(function(_0x4231e2,_0x1d4d29){var _0x5811d6=_[_0xc702('0xa')](_0x1ab818);_0x5811d6[_0xc702('0xb')]=_0x159696;return rpc[_0x79f9bb+'Message'][_0xc702('0xc')](_0x5811d6)[_0xc702('0xd')](function(){logger['info'](_0xc702('0xe'),_0x1e6471,_0x5811d6[_0xc702('0xb')]);_0x4231e2();})[_0xc702('0xf')](function(_0x42c969){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x1e6471,JSON['stringify'](_0x42c969));_0x1d4d29(_0x42c969);});});}exports[_0xc702('0x10')]=function(_0x1a151a,_0x3bd920){return function(_0x28b609){try{if(!_[_0xc702('0x11')](this['interaction'][_0xc702('0x12')])){logger[_0xc702('0x13')]('[%s][DIALOGFLOWV2]\x20%s',_0x1a151a,_0xc702('0x14'));return _0x28b609[_0xc702('0x15')]();}var _0x2459a5={'ContactId':this[_0xc702('0x16')]['id'],'sentAt':moment()[_0xc702('0x17')](_0xc702('0x18')),'direction':_0xc702('0x19')};if(this[_0xc702('0x1a')]==='sms'||this['channel']===_0xc702('0x1b')){_0x2459a5[_0xc702('0x1c')]=this['interaction'][_0xc702('0x1c')];}var _0x5ca14a=this[_0xc702('0x1a')];if(_0x5ca14a===_0xc702('0x1d')){_0x2459a5[_0xc702('0x1e')]=this[_0xc702('0x1f')]['id'];}else{_0x2459a5[_[_0xc702('0x20')](_0x5ca14a)+_0xc702('0x21')]=this['account']['id'];}_0x2459a5[_[_0xc702('0x20')](_0x5ca14a)+_0xc702('0x22')]=this['interaction']['id'];if(this[_0xc702('0x23')]['created']){var _0x395079=_0x3bd920[0x4];if(!_[_0xc702('0x24')](_0x395079)){_0x2459a5['body']=utils['getMustacheRender'](_0x395079,this);return rpc[_0x5ca14a+_0xc702('0x25')]['create'](_0x2459a5)['then'](function(_0x55faa2){logger['info'](_0xc702('0xe'),_0x1a151a,_0x2459a5[_0xc702('0xb')]);})['catch'](function(_0x4d236c){logger[_0xc702('0x26')]('[%s][DIALOGFLOWV2]\x20%s',_0x1a151a,JSON['stringify'](_0x4d236c));})[_0xc702('0x27')](function(){logger[_0xc702('0x13')](_0xc702('0x28'),_0x1a151a);_0x28b609[_0xc702('0x29')]();});}else{logger[_0xc702('0x13')](_0xc702('0x2a'),_0x1a151a);_0x28b609[_0xc702('0x29')]();}}else{var _0x565d9a=this;var _0x6b8692=_0x3bd920[0x2][_0xc702('0x2b')](/\\n/g,'\x0a');var _0x10a192={'credentials':{'private_key':_0x6b8692,'client_email':_0x3bd920[0x1]}};var _0x118989=new dialogflow['SessionsClient'](_0x10a192);var _0xfb9692=_0x118989[_0xc702('0x2c')](_0x3bd920[0x0],md5(_0x565d9a[_0xc702('0x23')]['id']));var _0x1a72e6={'session':_0xfb9692,'queryInput':{'text':{'text':_0x565d9a[_0xc702('0x2d')][_0xc702('0xb')],'languageCode':_0x3bd920[0x3]||'en'}}};return _0x118989[_0xc702('0x2e')](_0x1a72e6)['then'](function(_0x4e91c3){if(_0x4e91c3&&_0x4e91c3['length']){_0x565d9a[_0xc702('0xb')]['dialogflowV2']=_0x4e91c3;var _0x53abeb=_0x4e91c3[0x0];var _0x2dee6e=_0x53abeb[_0xc702('0x2f')][_0xc702('0x30')]&&_0x53abeb['queryResult']['diagnosticInfo'][_0xc702('0x31')]?_0x53abeb[_0xc702('0x2f')][_0xc702('0x30')][_0xc702('0x31')]['end_conversation'][_0xc702('0x32')]:![];_0x565d9a['body']['DIALOGFLOWV2_ACTION']=_0x53abeb[_0xc702('0x2f')]['action'];_0x565d9a[_0xc702('0xb')][_0xc702('0x33')]=_0x53abeb[_0xc702('0x2f')]['allRequiredParamsPresent'];_0x565d9a[_0xc702('0xb')][_0xc702('0x34')]=_0x53abeb[_0xc702('0x2f')]['diagnosticInfo']&&_0x53abeb[_0xc702('0x2f')][_0xc702('0x30')][_0xc702('0x31')]?_0x53abeb[_0xc702('0x2f')][_0xc702('0x30')]['fields'][_0xc702('0x35')][_0xc702('0x32')]:![];_0x565d9a[_0xc702('0xb')][_0xc702('0x36')]=_0x53abeb[_0xc702('0x2f')]['intent'][_0xc702('0x37')];_0x565d9a[_0xc702('0xb')][_0xc702('0x38')]=_0x53abeb[_0xc702('0x2f')][_0xc702('0x39')]['displayName'];_0x565d9a[_0xc702('0xb')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x53abeb['queryResult'][_0xc702('0x39')][_0xc702('0x3a')];_0x565d9a['body'][_0xc702('0x3b')]=_0x53abeb[_0xc702('0x2f')][_0xc702('0x3c')];_0x565d9a[_0xc702('0xb')][_0xc702('0x3d')]=_0x53abeb['queryResult'][_0xc702('0x3e')];_0x565d9a['body'][_0xc702('0x3f')]=_0x53abeb[_0xc702('0x2f')]['intentDetectionConfidence'];_0x2459a5[_0xc702('0x40')]=_0xc702('0x41');_0x2459a5['providerResponse']=JSON[_0xc702('0x42')](_0x4e91c3);var _0x209b7a=[];for(var _0x56a2ae=0x0;_0x56a2ae<_0x4e91c3['length'];_0x56a2ae++){var _0x12e80f=_0x4e91c3[_0x56a2ae];if(_0x12e80f&&_0x12e80f[_0xc702('0x2f')]&&_0x12e80f[_0xc702('0x2f')][_0xc702('0x43')]){_0x209b7a[_0xc702('0x44')](createMessage(_0x1a151a,_0x5ca14a,_0x2459a5,_0x12e80f[_0xc702('0x2f')]['fulfillmentText']));}}return Promise[_0xc702('0x45')](_0x209b7a)['then'](function(){if(_0x2dee6e){_0x28b609[_0xc702('0x15')]();}else{_0x28b609[_0xc702('0x29')]();}})[_0xc702('0xf')](function(_0xe9f39d){logger[_0xc702('0x26')](_0xc702('0xe'),_0x1a151a,JSON[_0xc702('0x42')](_0xe9f39d));_0x28b609['next']();});}})['catch'](function(_0x2d6af0){logger[_0xc702('0x26')](_0xc702('0xe'),_0x1a151a,_0x2d6af0[_0xc702('0x2d')]);_0x28b609['next']();});}}catch(_0x1b8d28){logger[_0xc702('0x26')](_0xc702('0xe'),_0x1a151a,JSON[_0xc702('0x42')](_0x1b8d28));_0x28b609[_0xc702('0x29')]();}};}; \ No newline at end of file +var _0xde8a=['md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','UserId','next','format','YYYY-MM-DD\x20HH:mm:ss','sms','channel','whatsapp','interaction','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','getMustacheRender','create','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','SessionsClient','sessionPath','detectIntent','dialogflowV2','queryResult','fields','diagnosticInfo','end_conversation','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','intent','name','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','all','dialogflow'];(function(_0x53c30e,_0x27b70d){var _0x14d5ff=function(_0x50b8da){while(--_0x50b8da){_0x53c30e['push'](_0x53c30e['shift']());}};_0x14d5ff(++_0x27b70d);}(_0xde8a,0x107));var _0xade8=function(_0x490d8f,_0x31d8a5){_0x490d8f=_0x490d8f-0x0;var _0x53aa33=_0xde8a[_0x490d8f];return _0x53aa33;};'use strict';var _=require('lodash');var dialogflow=require(_0xade8('0x0'));var md5=require(_0xade8('0x1'));var moment=require(_0xade8('0x2'));var Promise=require(_0xade8('0x3'));var logger=require(_0xade8('0x4'))(_0xade8('0x5'));var utils=require(_0xade8('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xade8('0x7')),'mailMessage':require(_0xade8('0x8')),'smsMessage':require(_0xade8('0x9')),'faxMessage':require(_0xade8('0xa')),'whatsappMessage':require(_0xade8('0xb'))};function createMessage(_0x8657e8,_0x187293,_0x4a0425,_0x2e3e61){return new Promise(function(_0x12db41,_0x4ec5df){var _0x32fac6=_[_0xade8('0xc')](_0x4a0425);_0x32fac6[_0xade8('0xd')]=_0x2e3e61;return rpc[_0x187293+'Message']['create'](_0x32fac6)[_0xade8('0xe')](function(){logger[_0xade8('0xf')](_0xade8('0x10'),_0x8657e8,_0x32fac6[_0xade8('0xd')]);_0x12db41();})[_0xade8('0x11')](function(_0x32e2d1){logger[_0xade8('0x12')](_0xade8('0x10'),_0x8657e8,JSON[_0xade8('0x13')](_0x32e2d1));_0x4ec5df(_0x32e2d1);});});}exports[_0xade8('0x14')]=function(_0x2501f1,_0x28a33b){return function(_0x22ea46){try{if(!_[_0xade8('0x15')](this['interaction'][_0xade8('0x16')])){logger['info'](_0xade8('0x10'),_0x2501f1,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x22ea46[_0xade8('0x17')]();}var _0x523bfe={'ContactId':this['contact']['id'],'sentAt':moment()[_0xade8('0x18')](_0xade8('0x19')),'direction':'out'};if(this['channel']===_0xade8('0x1a')||this[_0xade8('0x1b')]===_0xade8('0x1c')){_0x523bfe['phone']=this[_0xade8('0x1d')]['phone'];}var _0x4d9e8b=this[_0xade8('0x1b')];if(_0x4d9e8b===_0xade8('0x1e')){_0x523bfe[_0xade8('0x1f')]=this[_0xade8('0x20')]['id'];}else{_0x523bfe[_[_0xade8('0x21')](_0x4d9e8b)+'AccountId']=this['account']['id'];}_0x523bfe[_[_0xade8('0x21')](_0x4d9e8b)+_0xade8('0x22')]=this[_0xade8('0x1d')]['id'];if(this[_0xade8('0x1d')][_0xade8('0x23')]){var _0x282b60=_0x28a33b[0x4];if(!_['isEmpty'](_0x282b60)){_0x523bfe[_0xade8('0xd')]=utils[_0xade8('0x24')](_0x282b60,this);return rpc[_0x4d9e8b+'Message'][_0xade8('0x25')](_0x523bfe)[_0xade8('0xe')](function(_0x2b1318){logger[_0xade8('0xf')](_0xade8('0x10'),_0x2501f1,_0x523bfe[_0xade8('0xd')]);})[_0xade8('0x11')](function(_0x5c0ac9){logger[_0xade8('0x12')](_0xade8('0x10'),_0x2501f1,JSON[_0xade8('0x13')](_0x5c0ac9));})['finally'](function(){logger[_0xade8('0xf')](_0xade8('0x26'),_0x2501f1);_0x22ea46[_0xade8('0x27')]();});}else{logger[_0xade8('0xf')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x2501f1);_0x22ea46[_0xade8('0x27')]();}}else{var _0x43a324=this;var _0x53909e=_0x28a33b[0x2]['replace'](/\\n/g,'\x0a');var _0x19a5dd={'credentials':{'private_key':_0x53909e,'client_email':_0x28a33b[0x1]}};var _0x235282=new dialogflow[(_0xade8('0x28'))](_0x19a5dd);var _0x1055c2=_0x235282[_0xade8('0x29')](_0x28a33b[0x0],md5(_0x43a324['interaction']['id']));var _0x5e718e={'session':_0x1055c2,'queryInput':{'text':{'text':_0x43a324['message'][_0xade8('0xd')],'languageCode':_0x28a33b[0x3]||'en'}}};return _0x235282[_0xade8('0x2a')](_0x5e718e)[_0xade8('0xe')](function(_0x82e9fa){if(_0x82e9fa&&_0x82e9fa['length']){_0x43a324['body'][_0xade8('0x2b')]=_0x82e9fa;var _0x5b3f94=_0x82e9fa[0x0];var _0x395286=_0x5b3f94[_0xade8('0x2c')]['diagnosticInfo']&&_0x5b3f94[_0xade8('0x2c')]['diagnosticInfo'][_0xade8('0x2d')]?_0x5b3f94[_0xade8('0x2c')][_0xade8('0x2e')][_0xade8('0x2d')][_0xade8('0x2f')]['boolValue']:![];_0x43a324[_0xade8('0xd')][_0xade8('0x30')]=_0x5b3f94[_0xade8('0x2c')][_0xade8('0x31')];_0x43a324[_0xade8('0xd')][_0xade8('0x32')]=_0x5b3f94[_0xade8('0x2c')]['allRequiredParamsPresent'];_0x43a324[_0xade8('0xd')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x5b3f94[_0xade8('0x2c')][_0xade8('0x2e')]&&_0x5b3f94[_0xade8('0x2c')]['diagnosticInfo'][_0xade8('0x2d')]?_0x5b3f94[_0xade8('0x2c')][_0xade8('0x2e')][_0xade8('0x2d')][_0xade8('0x2f')]['boolValue']:![];_0x43a324[_0xade8('0xd')]['DIALOGFLOWV2_INTENTNAME']=_0x5b3f94['queryResult'][_0xade8('0x33')][_0xade8('0x34')];_0x43a324[_0xade8('0xd')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x5b3f94[_0xade8('0x2c')][_0xade8('0x33')][_0xade8('0x35')];_0x43a324['body'][_0xade8('0x36')]=_0x5b3f94[_0xade8('0x2c')][_0xade8('0x33')][_0xade8('0x37')];_0x43a324[_0xade8('0xd')][_0xade8('0x38')]=_0x5b3f94[_0xade8('0x2c')][_0xade8('0x39')];_0x43a324[_0xade8('0xd')][_0xade8('0x3a')]=_0x5b3f94['queryResult']['queryText'];_0x43a324['body'][_0xade8('0x3b')]=_0x5b3f94[_0xade8('0x2c')][_0xade8('0x3c')];_0x523bfe[_0xade8('0x3d')]=_0xade8('0x2b');_0x523bfe[_0xade8('0x3e')]=JSON['stringify'](_0x82e9fa);var _0x5621ab=[];for(var _0x4efdc3=0x0;_0x4efdc3<_0x82e9fa['length'];_0x4efdc3++){var _0x2e1041=_0x82e9fa[_0x4efdc3];if(_0x2e1041&&_0x2e1041[_0xade8('0x2c')]&&_0x2e1041[_0xade8('0x2c')][_0xade8('0x3f')]){_0x5621ab[_0xade8('0x40')](createMessage(_0x2501f1,_0x4d9e8b,_0x523bfe,_0x2e1041['queryResult'][_0xade8('0x3f')]));}}return Promise[_0xade8('0x41')](_0x5621ab)[_0xade8('0xe')](function(){if(_0x395286){_0x22ea46[_0xade8('0x17')]();}else{_0x22ea46[_0xade8('0x27')]();}})[_0xade8('0x11')](function(_0xdd5809){logger[_0xade8('0x12')](_0xade8('0x10'),_0x2501f1,JSON['stringify'](_0xdd5809));_0x22ea46[_0xade8('0x17')]();});}})[_0xade8('0x11')](function(_0xddad11){logger[_0xade8('0x12')](_0xade8('0x10'),_0x2501f1,_0xddad11['message']);_0x22ea46[_0xade8('0x17')]();});}}catch(_0x3965b6){logger['error'](_0xade8('0x10'),_0x2501f1,JSON[_0xade8('0x13')](_0x3965b6));_0x22ea46['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 caa49ba..d0d3c0d 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 _0x9f56=['info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','lodash','html-to-text','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','stop','condition','priorityTrue','priorityFalse'];(function(_0x5a3498,_0x6c4923){var _0x57ad21=function(_0x553d56){while(--_0x553d56){_0x5a3498['push'](_0x5a3498['shift']());}};_0x57ad21(++_0x6c4923);}(_0x9f56,0x9a));var _0x69f5=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0x9f56[_0x2eb5bc];return _0x51c7b1;};'use strict';var schema=require(_0x69f5('0x0'));var _=require(_0x69f5('0x1'));var htmlToText=require(_0x69f5('0x2'));var utils=require(_0x69f5('0x3'));var logger=require('../../../../config/logger')(_0x69f5('0x4'));var gotoif=schema({'condition':{'type':_0x69f5('0x5'),'required':!![],'message':_0x69f5('0x6')},'priorityTrue':{'type':_0x69f5('0x7'),'message':_0x69f5('0x8')},'priorityFalse':{'type':_0x69f5('0x7'),'message':'priority\x20false\x20is\x20a\x20number'}});exports['consequence']=function(_0x8aba82,_0x588ae7){return function(_0x4e71dc){try{var _0x1936ca={'condition':htmlToText[_0x69f5('0x9')](utils[_0x69f5('0xa')](_0x588ae7[0x0],this),{'wordwrap':![]})[_0x69f5('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x588ae7[0x1],'priorityFalse':_0x588ae7[0x2]};var _0x188d6a=gotoif[_0x69f5('0x0')](_0x1936ca,{'typecast':!![]});if(_0x188d6a[_0x69f5('0xc')]){logger[_0x69f5('0xd')](_0x69f5('0xe'),_0x8aba82,_[_0x69f5('0xf')](_0x188d6a,'message')['join'](',\x20'));_0x4e71dc[_0x69f5('0x10')]();}else{try{var _0x4f606b=eval('('+_0x1936ca[_0x69f5('0x11')]+')');var _0x37a02e=_0x4f606b?_0x1936ca[_0x69f5('0x12')]:_0x1936ca[_0x69f5('0x13')];logger[_0x69f5('0x14')](_0x69f5('0x15'),_0x8aba82,_0x1936ca[_0x69f5('0x11')],_0x4f606b,_0x37a02e||_0x69f5('0x16'));if(_0x37a02e){var _0x2626c3=_['findIndex'](_0x4e71dc[_0x69f5('0x17')](),{'p':_0x37a02e});if(_0x2626c3>=0x0){logger[_0x69f5('0x14')](_0x69f5('0x18'),_0x8aba82,_0x37a02e||_0x69f5('0x16'),_0x2626c3);_0x4e71dc[_0x69f5('0x16')](_0x2626c3);}else{logger[_0x69f5('0x14')](_0x69f5('0x19'),_0x8aba82,_0x37a02e||'next');_0x4e71dc[_0x69f5('0x10')]();}}else{_0x4e71dc[_0x69f5('0x16')]();}}catch(_0x2f9b96){logger[_0x69f5('0xd')](_0x69f5('0x1a'),_0x8aba82,_0x2f9b96[_0x69f5('0x1b')]);_0x4e71dc[_0x69f5('0x10')]();}}}catch(_0x4b7762){logger['error'](_0x69f5('0xe'),_0x8aba82,JSON[_0x69f5('0x1c')](_0x4b7762));_0x4e71dc['stop']();}};}; \ No newline at end of file +var _0xff79=['[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','lodash','html-to-text','../../../../config/logger','routing','string','priority\x20true\x20is\x20a\x20number','number','consequence','fromString','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','info'];(function(_0x5bc74d,_0xb28345){var _0x5e18ec=function(_0x28aaa7){while(--_0x28aaa7){_0x5bc74d['push'](_0x5bc74d['shift']());}};_0x5e18ec(++_0xb28345);}(_0xff79,0x165));var _0x9ff7=function(_0x2fc67c,_0x47b530){_0x2fc67c=_0x2fc67c-0x0;var _0x54a70b=_0xff79[_0x2fc67c];return _0x54a70b;};'use strict';var schema=require(_0x9ff7('0x0'));var _=require(_0x9ff7('0x1'));var htmlToText=require(_0x9ff7('0x2'));var utils=require('./utils');var logger=require(_0x9ff7('0x3'))(_0x9ff7('0x4'));var gotoif=schema({'condition':{'type':_0x9ff7('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':'number','message':_0x9ff7('0x6')},'priorityFalse':{'type':_0x9ff7('0x7'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x9ff7('0x8')]=function(_0x18d6ff,_0x208712){return function(_0x37dc82){try{var _0x4b0525={'condition':htmlToText[_0x9ff7('0x9')](utils[_0x9ff7('0xa')](_0x208712[0x0],this),{'wordwrap':![]})[_0x9ff7('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x208712[0x1],'priorityFalse':_0x208712[0x2]};var _0x49ef4c=gotoif[_0x9ff7('0x0')](_0x4b0525,{'typecast':!![]});if(_0x49ef4c[_0x9ff7('0xc')]){logger['error'](_0x9ff7('0xd'),_0x18d6ff,_[_0x9ff7('0xe')](_0x49ef4c,_0x9ff7('0xf'))[_0x9ff7('0x10')](',\x20'));_0x37dc82[_0x9ff7('0x11')]();}else{try{var _0x5493a8=eval('('+_0x4b0525[_0x9ff7('0x12')]+')');var _0x172924=_0x5493a8?_0x4b0525[_0x9ff7('0x13')]:_0x4b0525['priorityFalse'];logger[_0x9ff7('0x14')](_0x9ff7('0x15'),_0x18d6ff,_0x4b0525[_0x9ff7('0x12')],_0x5493a8,_0x172924||_0x9ff7('0x16'));if(_0x172924){var _0x170663=_['findIndex'](_0x37dc82[_0x9ff7('0x17')](),{'p':_0x172924});if(_0x170663>=0x0){logger[_0x9ff7('0x14')](_0x9ff7('0x18'),_0x18d6ff,_0x172924||'next',_0x170663);_0x37dc82[_0x9ff7('0x16')](_0x170663);}else{logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x18d6ff,_0x172924||_0x9ff7('0x16'));_0x37dc82['stop']();}}else{_0x37dc82[_0x9ff7('0x16')]();}}catch(_0x450b3a){logger[_0x9ff7('0x19')](_0x9ff7('0x1a'),_0x18d6ff,_0x450b3a[_0x9ff7('0xf')]);_0x37dc82[_0x9ff7('0x11')]();}}}catch(_0x409b99){logger[_0x9ff7('0x19')](_0x9ff7('0xd'),_0x18d6ff,JSON['stringify'](_0x409b99));_0x37dc82['stop']();}};}; \ 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 d348853..01274d5 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 _0x4041=['findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','next','error','stringify','validate','lodash','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','[%s][GOTOP]\x20%s','map','stop','info','priority'];(function(_0x19ad3f,_0x347c34){var _0x3e2946=function(_0x9aad42){while(--_0x9aad42){_0x19ad3f['push'](_0x19ad3f['shift']());}};_0x3e2946(++_0x347c34);}(_0x4041,0x126));var _0x1404=function(_0x5b2410,_0x28fa4f){_0x5b2410=_0x5b2410-0x0;var _0x4d43fc=_0x4041[_0x5b2410];return _0x4d43fc;};'use strict';var schema=require(_0x1404('0x0'));var _=require(_0x1404('0x1'));var logger=require('../../../../config/logger')('routing');var gotop=schema({'priority':{'type':_0x1404('0x2'),'required':!![],'message':_0x1404('0x3')}});exports[_0x1404('0x4')]=function(_0xee1047,_0x2eac71){return function(_0x243fb7){try{var _0x4d92f3={'priority':_0x2eac71[0x0]};var _0x276a89=gotop[_0x1404('0x0')](_0x4d92f3,{'typecast':!![]});if(_0x276a89['length']){logger['error'](_0x1404('0x5'),_0xee1047,_[_0x1404('0x6')](_0x276a89,'message')['join'](',\x20'));_0x243fb7[_0x1404('0x7')]();}else{logger[_0x1404('0x8')]('[%s][GOTOP]\x20priority\x20%s',_0xee1047,_0x4d92f3[_0x1404('0x9')]);if(_0x4d92f3['priority']){var _0x35f8b9=_[_0x1404('0xa')](_0x243fb7[_0x1404('0xb')](),{'p':_0x4d92f3[_0x1404('0x9')]});if(_0x35f8b9>=0x0){logger[_0x1404('0x8')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0xee1047,_0x4d92f3[_0x1404('0x9')]||'next',_0x35f8b9);_0x243fb7['next'](_0x35f8b9);}else{logger[_0x1404('0x8')](_0x1404('0xc'),_0xee1047,_0x4d92f3[_0x1404('0x9')]||_0x1404('0xd'));_0x243fb7[_0x1404('0x7')]();}}else{_0x243fb7[_0x1404('0xd')]();}}}catch(_0x48d27f){logger[_0x1404('0xe')](_0x1404('0x5'),_0xee1047,JSON[_0x1404('0xf')](_0x48d27f));_0x243fb7[_0x1404('0x7')]();}};}; \ No newline at end of file +var _0x143c=['priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','join','stop','info','[%s][GOTOP]\x20priority\x20%s'];(function(_0x406dae,_0x22c4e9){var _0x197231=function(_0x5111af){while(--_0x5111af){_0x406dae['push'](_0x406dae['shift']());}};_0x197231(++_0x22c4e9);}(_0x143c,0x113));var _0xc143=function(_0x4afc2c,_0x336a88){_0x4afc2c=_0x4afc2c-0x0;var _0x164084=_0x143c[_0x4afc2c];return _0x164084;};'use strict';var schema=require('validate');var _=require(_0xc143('0x0'));var logger=require(_0xc143('0x1'))(_0xc143('0x2'));var gotop=schema({'priority':{'type':_0xc143('0x3'),'required':!![],'message':_0xc143('0x4')}});exports[_0xc143('0x5')]=function(_0xc664c8,_0x540ac3){return function(_0x5331c1){try{var _0x40efb3={'priority':_0x540ac3[0x0]};var _0x5b449a=gotop['validate'](_0x40efb3,{'typecast':!![]});if(_0x5b449a[_0xc143('0x6')]){logger[_0xc143('0x7')](_0xc143('0x8'),_0xc664c8,_['map'](_0x5b449a,'message')[_0xc143('0x9')](',\x20'));_0x5331c1[_0xc143('0xa')]();}else{logger[_0xc143('0xb')](_0xc143('0xc'),_0xc664c8,_0x40efb3[_0xc143('0xd')]);if(_0x40efb3[_0xc143('0xd')]){var _0x2f1b62=_[_0xc143('0xe')](_0x5331c1[_0xc143('0xf')](),{'p':_0x40efb3[_0xc143('0xd')]});if(_0x2f1b62>=0x0){logger[_0xc143('0xb')](_0xc143('0x10'),_0xc664c8,_0x40efb3[_0xc143('0xd')]||_0xc143('0x11'),_0x2f1b62);_0x5331c1[_0xc143('0x11')](_0x2f1b62);}else{logger[_0xc143('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0xc664c8,_0x40efb3[_0xc143('0xd')]||_0xc143('0x11'));_0x5331c1[_0xc143('0xa')]();}}else{_0x5331c1[_0xc143('0x11')]();}}}catch(_0x2c1dcf){logger[_0xc143('0x7')](_0xc143('0x8'),_0xc664c8,JSON['stringify'](_0x2c1dcf));_0x5331c1[_0xc143('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 e9babbb..63a0371 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 _0x2128=['[%s][MESSAGE]\x20%s','body','next','catch','stop','error','stringify','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','then'];(function(_0x2a5b3b,_0x4ebe31){var _0xae665a=function(_0x59e86a){while(--_0x59e86a){_0x2a5b3b['push'](_0x2a5b3b['shift']());}};_0xae665a(++_0x4ebe31);}(_0x2128,0x1c9));var _0x8212=function(_0x8c2e66,_0xf79589){_0x8c2e66=_0x8c2e66-0x0;var _0x31492f=_0x2128[_0x8c2e66];return _0x31492f;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require('../../../../config/logger')(_0x8212('0x0'));var rpc={'chatMessage':require(_0x8212('0x1')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x8212('0x2')),'smsMessage':require(_0x8212('0x3')),'faxMessage':require(_0x8212('0x4')),'whatsappMessage':require(_0x8212('0x5'))};exports['consequence']=function(_0x1eb10b,_0x1a52d4){return function(_0x4fa944){try{var _0x19f876={'body':utils[_0x8212('0x6')](_0x1a52d4[0x0],this),'ContactId':this[_0x8212('0x7')]['id']};if(this[_0x8212('0x8')]===_0x8212('0x9')){_0x19f876[_0x8212('0xa')]=this[_0x8212('0xb')]['id'];}else{_0x19f876[_[_0x8212('0xc')](this[_0x8212('0x8')])+_0x8212('0xd')]=this[_0x8212('0xb')]['id'];}_0x19f876[_[_0x8212('0xc')](this['channel'])+_0x8212('0xe')]=this[_0x8212('0xf')]['id'];if(rpc[this[_0x8212('0x8')]+_0x8212('0x10')]){return rpc[this[_0x8212('0x8')]+_0x8212('0x10')]['create'](_0x19f876)[_0x8212('0x11')](function(_0x28a9b0){logger['info'](_0x8212('0x12'),_0x1eb10b,_0x19f876[_0x8212('0x13')]);_0x4fa944[_0x8212('0x14')]();})[_0x8212('0x15')](function(_0x5275ce){logger['error'](_0x8212('0x12'),_0x1eb10b,JSON['stringify'](_0x5275ce));_0x4fa944[_0x8212('0x16')]();});}}catch(_0x3dcf41){logger[_0x8212('0x17')](_0x8212('0x12'),_0x1eb10b,JSON[_0x8212('0x18')](_0x3dcf41));_0x4fa944['stop']();}};}; \ No newline at end of file +var _0x3e9e=['../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','channel','chat','ChatWebsiteId','account','upperFirst','interaction','Message','create','info','next','catch','error','[%s][MESSAGE]\x20%s','stop','./utils','routing','../../rpc/openchannelMessage'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x3e9e,0x13d));var _0xe3e9=function(_0x622858,_0x2b63d5){_0x622858=_0x622858-0x0;var _0x9fc10a=_0x3e9e[_0x622858];return _0x9fc10a;};'use strict';var _=require('lodash');var utils=require(_0xe3e9('0x0'));var logger=require('../../../../config/logger')(_0xe3e9('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xe3e9('0x2')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xe3e9('0x3')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xe3e9('0x4'))};exports[_0xe3e9('0x5')]=function(_0x554839,_0x50c4bd){return function(_0x4c49af){try{var _0x372fba={'body':utils['getMustacheRender'](_0x50c4bd[0x0],this),'ContactId':this['contact']['id']};if(this[_0xe3e9('0x6')]===_0xe3e9('0x7')){_0x372fba[_0xe3e9('0x8')]=this[_0xe3e9('0x9')]['id'];}else{_0x372fba[_[_0xe3e9('0xa')](this['channel'])+'AccountId']=this[_0xe3e9('0x9')]['id'];}_0x372fba[_['upperFirst'](this[_0xe3e9('0x6')])+'InteractionId']=this[_0xe3e9('0xb')]['id'];if(rpc[this['channel']+_0xe3e9('0xc')]){return rpc[this[_0xe3e9('0x6')]+_0xe3e9('0xc')][_0xe3e9('0xd')](_0x372fba)['then'](function(_0x5c1f26){logger[_0xe3e9('0xe')]('[%s][MESSAGE]\x20%s',_0x554839,_0x372fba['body']);_0x4c49af[_0xe3e9('0xf')]();})[_0xe3e9('0x10')](function(_0x4f36e7){logger[_0xe3e9('0x11')](_0xe3e9('0x12'),_0x554839,JSON['stringify'](_0x4f36e7));_0x4c49af[_0xe3e9('0x13')]();});}}catch(_0x174cd5){logger[_0xe3e9('0x11')](_0xe3e9('0x12'),_0x554839,JSON['stringify'](_0x174cd5));_0x4c49af[_0xe3e9('0x13')]();}};}; \ 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 1a4ec0c..bae3d9a 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 _0xfc66=['./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xfc66,0x1a2));var _0x6fc6=function(_0x286ec3,_0x13b30d){_0x286ec3=_0x286ec3-0x0;var _0x325a83=_0xfc66[_0x286ec3];return _0x325a83;};'use strict';var utils=require(_0x6fc6('0x0'));var logger=require(_0x6fc6('0x1'))(_0x6fc6('0x2'));exports[_0x6fc6('0x3')]=function(_0x375b15,_0x5ebe8f){return function(_0x34c786){try{logger[_0x6fc6('0x4')](_0x6fc6('0x5'),_0x375b15,utils[_0x6fc6('0x6')](_0x5ebe8f[0x0],this));_0x34c786[_0x6fc6('0x7')]();}catch(_0x5f18d3){logger[_0x6fc6('0x8')](_0x6fc6('0x5'),_0x375b15,JSON[_0x6fc6('0x9')](_0x5f18d3));_0x34c786[_0x6fc6('0xa')]();}};}; \ No newline at end of file +var _0x92e0=['stop','./utils','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','stringify'];(function(_0x59f408,_0x27091d){var _0x5a06fa=function(_0x43d82c){while(--_0x43d82c){_0x59f408['push'](_0x59f408['shift']());}};_0x5a06fa(++_0x27091d);}(_0x92e0,0x199));var _0x092e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x92e0[_0x3dd15e];return _0x231fd0;};'use strict';var utils=require(_0x092e('0x0'));var logger=require('../../../../config/logger')('routing');exports[_0x092e('0x1')]=function(_0xb23b9e,_0xe40b92){return function(_0x35a583){try{logger[_0x092e('0x2')](_0x092e('0x3'),_0xb23b9e,utils[_0x092e('0x4')](_0xe40b92[0x0],this));_0x35a583[_0x092e('0x5')]();}catch(_0x51959c){logger['error'](_0x092e('0x3'),_0xb23b9e,JSON[_0x092e('0x6')](_0x51959c));_0x35a583[_0x092e('0x7')]();}};}; \ 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 ecdfbb0..c9e0e9d 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 _0xaf90=['localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','length','map','join','stop','find','Queues','timeout','createQueue','atimeout','qtimeout','rules','end','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','seq-queue','moment','ioredis','../../../../config/environment','routing','./strategy','redis','defaults'];(function(_0x93942f,_0xb48547){var _0x23fcd8=function(_0x4728be){while(--_0x4728be){_0x93942f['push'](_0x93942f['shift']());}};_0x23fcd8(++_0xb48547);}(_0xaf90,0x1e3));var _0x0af9=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xaf90[_0x4243a3];return _0x1b2a33;};'use strict';var schema=require(_0x0af9('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require(_0x0af9('0x1'));var moment=require(_0x0af9('0x2'));var Redis=require(_0x0af9('0x3'));var config=require(_0x0af9('0x4'));var logger=require('../../../../config/logger')(_0x0af9('0x5'));var strategy=require(_0x0af9('0x6'));config[_0x0af9('0x7')]=_[_0x0af9('0x8')](config['redis'],{'host':_0x0af9('0x9'),'port':0x18eb});var io=require(_0x0af9('0xa'))(new Redis(config['redis']));var attributes=['id',_0x0af9('0xb'),_0x0af9('0xc'),_0x0af9('0xd'),_0x0af9('0xe'),_0x0af9('0xf')];function emit(_0x4f8db1,_0x2d186d,_0x4bbb2b){io['to'](_0x4f8db1)[_0x0af9('0x10')](_0x2d186d,_0x4bbb2b);}function emitChannelQueueInteraction(_0x267fc2,_0x3acba9,_0x19ee3e,_0x4eb2e1,_0x25599b,_0x49ed60,_0xf195e5,_0x1152d1){var _0x46ba18=_[_0x0af9('0x11')](_0x19ee3e);_0x46ba18['queue_id']=_0x1152d1;_0x46ba18[_0x0af9('0xd')]=_0x3acba9;_0x46ba18[_0x0af9('0xc')]=_0x4eb2e1;_0x46ba18['id']=_0x25599b;if(_0x49ed60){_0xf195e5[util[_0x0af9('0x12')](_0x0af9('0x13'),_0x267fc2)][_0x25599b]=_[_0x0af9('0x14')](_0x46ba18,attributes);}else{delete _0xf195e5[util[_0x0af9('0x12')](_0x0af9('0x13'),_0x267fc2)][_0x25599b];}emit(util[_0x0af9('0x12')](_0x0af9('0x15'),_0x267fc2,_0x3acba9),util['format'](_0x0af9('0x16'),_0x267fc2,_0x49ed60?'save':_0x0af9('0x17')),_['pick'](_0x46ba18,attributes));}var rpc={'openchannelQueueReport':require(_0x0af9('0x18')),'mailQueueReport':require(_0x0af9('0x19')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x0af9('0x1a')),'faxQueueReport':require(_0x0af9('0x1b')),'whatsappQueueReport':require(_0x0af9('0x1c'))};var queue=schema({'name':{'type':_0x0af9('0x1d'),'required':!![],'message':_0x0af9('0x1e')},'timeout':{'type':_0x0af9('0x1f'),'message':_0x0af9('0x20')}});function startRouting(_0x3577f4,_0x5c2cca,_0x256349,_0xf79ad){if(_0x3577f4&&_0x5c2cca&&_0x256349){_0x5c2cca[_0x0af9('0x21')]+=0x1;var _0x2dd0ce={'uniqueid':_0x3577f4,'from':_0x256349['body']?_0x256349[_0x0af9('0x22')]['from']:'','joinAt':moment()[_0x0af9('0x12')](_0x0af9('0x23')),'ContactId':_0x256349[_0x0af9('0x24')]?_0x256349[_0x0af9('0x24')]['id']:null,'ListId':_0x256349['list']?_0x256349[_0x0af9('0x25')]['id']:null};_0x2dd0ce[_[_0x0af9('0x26')](_0x256349[_0x0af9('0x27')])+_0x0af9('0x28')]=_0x5c2cca['id']||null;_0x2dd0ce[_[_0x0af9('0x26')](_0x256349[_0x0af9('0x27')])+_0x0af9('0x29')]=_0x256349[_0x0af9('0x2a')]?_0x256349[_0x0af9('0x2a')]['id']:null;_0x2dd0ce[_[_0x0af9('0x26')](_0x256349[_0x0af9('0x27')])+'MessageId']=_0x256349[_0x0af9('0x2b')]?_0x256349[_0x0af9('0x2b')]['id']:null;_0x2dd0ce[_[_0x0af9('0x26')](_0x256349[_0x0af9('0x27')])+(_0x256349[_0x0af9('0x27')]!==_0x0af9('0x2c')?_0x0af9('0x2d'):_0x0af9('0x2e'))]=_0x256349[_0x0af9('0xc')]?_0x256349[_0x0af9('0xc')]['id']:null;logger[_0x0af9('0x2f')](util[_0x0af9('0x12')](_0x0af9('0x30'),_0x3577f4,_0x5c2cca[_0x0af9('0x31')]));emitChannelQueueInteraction(_0x256349[_0x0af9('0x27')],_0x5c2cca['name'],_0x2dd0ce,_0x256349[_0x0af9('0xc')][_0x0af9('0x31')],_0x256349[_0x0af9('0x2b')]['id'],!![],_0xf79ad,_0x5c2cca['id']);if(rpc[_0x256349[_0x0af9('0x27')]+_0x0af9('0x32')]){return rpc[_0x256349[_0x0af9('0x27')]+_0x0af9('0x32')]['create'](_0x2dd0ce)[_0x0af9('0x33')](function(_0x340d06){logger[_0x0af9('0x34')](_0x0af9('0x35'));});}}}function stopRouting(_0x282c2f,_0x2c67be,_0x491e4f,_0x5c4f7d){if(_0x282c2f&&_0x2c67be){_0x2c67be['waiting']-=0x1;var _0x57318d={'leaveAt':moment()[_0x0af9('0x12')](_0x0af9('0x23')),'acceptAt':moment()[_0x0af9('0x12')](_0x0af9('0x23')),'reason':_0x0af9('0x36')};logger[_0x0af9('0x2f')](util[_0x0af9('0x12')](_0x0af9('0x37'),_0x282c2f,_0x2c67be[_0x0af9('0x31')]));emitChannelQueueInteraction(_0x491e4f[_0x0af9('0x27')],_0x2c67be[_0x0af9('0x31')],_0x491e4f['body'],_0x491e4f[_0x0af9('0xc')]['name'],_0x491e4f[_0x0af9('0x2b')]['id'],![],_0x5c4f7d,_0x2c67be['id']);if(rpc[_0x491e4f[_0x0af9('0x27')]+'QueueReport']){return rpc[_0x491e4f['channel']+_0x0af9('0x32')][_0x0af9('0x38')](_0x282c2f,_0x57318d)[_0x0af9('0x33')](function(_0x41201c){logger[_0x0af9('0x34')](_0x0af9('0x39'));});}}}function endRouting(_0x3609ee,_0x3b3e67,_0x299f8c,_0x5067b0){if(_0x3609ee&&_0x3b3e67){_0x3b3e67[_0x0af9('0x21')]-=0x1;var _0x366552={'leaveAt':moment()[_0x0af9('0x12')](_0x0af9('0x23')),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger['info'](util[_0x0af9('0x12')](_0x0af9('0x3a'),_0x3609ee,_0x3b3e67['name']));emitChannelQueueInteraction(_0x299f8c[_0x0af9('0x27')],_0x3b3e67[_0x0af9('0x31')],_0x299f8c['body'],_0x299f8c[_0x0af9('0xc')][_0x0af9('0x31')],_0x299f8c[_0x0af9('0x2b')]['id'],![],_0x5067b0);if(rpc[_0x299f8c[_0x0af9('0x27')]+_0x0af9('0x32')]){return rpc[_0x299f8c[_0x0af9('0x27')]+_0x0af9('0x32')][_0x0af9('0x38')](_0x3609ee,_0x366552)['catch'](function(_0x23dfc4){logger[_0x0af9('0x34')](_0x0af9('0x39'));});}}}function handleFindQueue(_0x3d4a0d){return function(_0x3cdb8d){return _0x3cdb8d[_0x0af9('0x31')]['toLowerCase']()===_0x3d4a0d[_0x0af9('0x3b')]();};}exports['consequence']=function(_0x3b78d3,_0x2c9f68,_0x1f6a15,_0x52dbdf){return function(_0x48e34e){try{var _0x105a48={'name':_0x2c9f68[0x0],'timeout':_0x2c9f68[0x1]};var _0x405211=queue['validate'](_0x105a48,{'typecast':!![]});if(_0x405211[_0x0af9('0x3c')]){logger[_0x0af9('0x34')]('[%s][QUEUE]\x20%s',_0x3b78d3,_[_0x0af9('0x3d')](_0x405211,_0x0af9('0x2b'))[_0x0af9('0x3e')](',\x20'));_0x48e34e[_0x0af9('0x3f')]();}else{var _0x154dca=_[_0x0af9('0x40')](_0x1f6a15[_0x52dbdf['channel']+_0x0af9('0x41')],handleFindQueue(_0x105a48[_0x0af9('0x31')]));if(_0x154dca){startRouting(_0x3b78d3,_0x154dca,_0x52dbdf,_0x1f6a15);var _0x486ef9=(_0x154dca[_0x0af9('0x42')]||0xa)*0x3e8;var _0x1d9712=(_0x105a48[_0x0af9('0x42')]||0x14)*0x3e8;var _0x3396d6,_0x204ce4;if(_0x486ef9>_0x1d9712){_0x1d9712=_0x486ef9;}var _0x1ef090=seqqueue[_0x0af9('0x43')](_0x486ef9);_0x1ef090['id']=_0x3b78d3;_0x1ef090[_0x0af9('0x44')]=_0x486ef9;_0x1ef090[_0x0af9('0x45')]=_0x1d9712;_0x1ef090['channel']=_0x52dbdf[_0x0af9('0x27')];_0x1f6a15[_0x0af9('0x46')][_0x3b78d3]['on'](_0x0af9('0x47'),function(){logger[_0x0af9('0x2f')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x3b78d3);stopRouting(_0x3b78d3,_0x154dca,_0x52dbdf,_0x1f6a15);clearTimeout(_0x3396d6);_0x3396d6=undefined;_0x1ef090[_0x0af9('0x48')](!![]);if(_0x1f6a15[_0x0af9('0x46')][_0x3b78d3]){delete _0x1f6a15['rules'][_0x3b78d3];}_0x48e34e['stop']();});_0x1f6a15[_0x0af9('0x46')][_0x3b78d3]['on'](_0x0af9('0x49'),function(){if(_0x1f6a15[_0x0af9('0x46')][_0x3b78d3]){delete _0x1f6a15['rules'][_0x3b78d3];}});_0x3396d6=setTimeout(function(){logger[_0x0af9('0x2f')](_0x0af9('0x4a'),_0x3b78d3);endRouting(_0x3b78d3,_0x154dca,_0x52dbdf,_0x1f6a15);clearTimeout(_0x3396d6);_0x1ef090[_0x0af9('0x48')](!![]);_0x48e34e[_0x0af9('0x4b')]();},_0x1d9712);switch(_0x154dca[_0x0af9('0x4c')]){case _0x0af9('0x4d'):strategy[_0x0af9('0x4d')](_0x1ef090,_0x154dca,_0x1f6a15,_0x52dbdf);break;default:strategy[_0x0af9('0x4e')](_0x1ef090,_0x154dca,_0x1f6a15,_0x52dbdf);}}else{logger[_0x0af9('0x34')](_0x0af9('0x4f'),_0x3b78d3,_0x105a48[_0x0af9('0x31')]);_0x48e34e[_0x0af9('0x3f')]();}}}catch(_0x3257d4){console[_0x0af9('0x50')](_0x3257d4);logger[_0x0af9('0x34')]('[%s][QUEUE]\x20%s',_0x3b78d3,_0x3257d4[_0x0af9('0x51')]);_0x48e34e[_0x0af9('0x3f')]();}};}; \ No newline at end of file +var _0x0c2a=['consequence','[%s][QUEUE]\x20%s','join','stop','find','createQueue','atimeout','qtimeout','rules','end','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','util','seq-queue','moment','ioredis','../../../../config/environment','./strategy','redis','defaults','socket.io-emitter','account','queue','from','emit','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','name','QueueReport','create','catch','error','[%s][STOP:QUEUE][NAME:%s]','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase'];(function(_0x408438,_0x1c1bbd){var _0x3db4fa=function(_0x49d039){while(--_0x49d039){_0x408438['push'](_0x408438['shift']());}};_0x3db4fa(++_0x1c1bbd);}(_0x0c2a,0x1d5));var _0xa0c2=function(_0x1ba4d7,_0x3508ba){_0x1ba4d7=_0x1ba4d7-0x0;var _0x2589d5=_0x0c2a[_0x1ba4d7];return _0x2589d5;};'use strict';var schema=require(_0xa0c2('0x0'));var _=require('lodash');var util=require(_0xa0c2('0x1'));var seqqueue=require(_0xa0c2('0x2'));var moment=require(_0xa0c2('0x3'));var Redis=require(_0xa0c2('0x4'));var config=require(_0xa0c2('0x5'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0xa0c2('0x6'));config[_0xa0c2('0x7')]=_[_0xa0c2('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xa0c2('0x9'))(new Redis(config[_0xa0c2('0x7')]));var attributes=['id','queue_id',_0xa0c2('0xa'),_0xa0c2('0xb'),_0xa0c2('0xc'),'joinAt'];function emit(_0x4782bf,_0x1332da,_0x1399fc){io['to'](_0x4782bf)[_0xa0c2('0xd')](_0x1332da,_0x1399fc);}function emitChannelQueueInteraction(_0x1411cf,_0x146014,_0x2551cb,_0x41efdb,_0x1bde1f,_0x48eb53,_0x5f3904,_0x168c17){var _0x35dd9b=_[_0xa0c2('0xe')](_0x2551cb);_0x35dd9b['queue_id']=_0x168c17;_0x35dd9b[_0xa0c2('0xb')]=_0x146014;_0x35dd9b[_0xa0c2('0xa')]=_0x41efdb;_0x35dd9b['id']=_0x1bde1f;if(_0x48eb53){_0x5f3904[util[_0xa0c2('0xf')](_0xa0c2('0x10'),_0x1411cf)][_0x1bde1f]=_[_0xa0c2('0x11')](_0x35dd9b,attributes);}else{delete _0x5f3904[util[_0xa0c2('0xf')]('%sQueuesWaitingInteractions',_0x1411cf)][_0x1bde1f];}emit(util[_0xa0c2('0xf')](_0xa0c2('0x12'),_0x1411cf,_0x146014),util[_0xa0c2('0xf')](_0xa0c2('0x13'),_0x1411cf,_0x48eb53?_0xa0c2('0x14'):_0xa0c2('0x15')),_[_0xa0c2('0x11')](_0x35dd9b,attributes));}var rpc={'openchannelQueueReport':require(_0xa0c2('0x16')),'mailQueueReport':require(_0xa0c2('0x17')),'chatQueueReport':require(_0xa0c2('0x18')),'smsQueueReport':require(_0xa0c2('0x19')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xa0c2('0x1a'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xa0c2('0x1b'),'message':_0xa0c2('0x1c')}});function startRouting(_0x1b17a3,_0x1017ab,_0x5305d6,_0x56dfe9){if(_0x1b17a3&&_0x1017ab&&_0x5305d6){_0x1017ab[_0xa0c2('0x1d')]+=0x1;var _0x462c55={'uniqueid':_0x1b17a3,'from':_0x5305d6[_0xa0c2('0x1e')]?_0x5305d6[_0xa0c2('0x1e')][_0xa0c2('0xc')]:'','joinAt':moment()[_0xa0c2('0xf')](_0xa0c2('0x1f')),'ContactId':_0x5305d6['contact']?_0x5305d6[_0xa0c2('0x20')]['id']:null,'ListId':_0x5305d6[_0xa0c2('0x21')]?_0x5305d6[_0xa0c2('0x21')]['id']:null};_0x462c55[_['upperFirst'](_0x5305d6[_0xa0c2('0x22')])+_0xa0c2('0x23')]=_0x1017ab['id']||null;_0x462c55[_[_0xa0c2('0x24')](_0x5305d6[_0xa0c2('0x22')])+_0xa0c2('0x25')]=_0x5305d6['interaction']?_0x5305d6[_0xa0c2('0x26')]['id']:null;_0x462c55[_[_0xa0c2('0x24')](_0x5305d6[_0xa0c2('0x22')])+_0xa0c2('0x27')]=_0x5305d6[_0xa0c2('0x28')]?_0x5305d6[_0xa0c2('0x28')]['id']:null;_0x462c55[_[_0xa0c2('0x24')](_0x5305d6[_0xa0c2('0x22')])+(_0x5305d6[_0xa0c2('0x22')]!==_0xa0c2('0x29')?_0xa0c2('0x2a'):_0xa0c2('0x2b'))]=_0x5305d6[_0xa0c2('0xa')]?_0x5305d6[_0xa0c2('0xa')]['id']:null;logger[_0xa0c2('0x2c')](util[_0xa0c2('0xf')]('[%s][START:QUEUE][NAME:%s]',_0x1b17a3,_0x1017ab['name']));emitChannelQueueInteraction(_0x5305d6['channel'],_0x1017ab[_0xa0c2('0x2d')],_0x462c55,_0x5305d6[_0xa0c2('0xa')]['name'],_0x5305d6[_0xa0c2('0x28')]['id'],!![],_0x56dfe9,_0x1017ab['id']);if(rpc[_0x5305d6[_0xa0c2('0x22')]+_0xa0c2('0x2e')]){return rpc[_0x5305d6[_0xa0c2('0x22')]+_0xa0c2('0x2e')][_0xa0c2('0x2f')](_0x462c55)[_0xa0c2('0x30')](function(_0x4dad6f){logger[_0xa0c2('0x31')]('create\x20queue\x20report');});}}}function stopRouting(_0x193f65,_0x33e9eb,_0x2e9a2c,_0x3e2a28){if(_0x193f65&&_0x33e9eb){_0x33e9eb[_0xa0c2('0x1d')]-=0x1;var _0x16ebe1={'leaveAt':moment()['format'](_0xa0c2('0x1f')),'acceptAt':moment()[_0xa0c2('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger[_0xa0c2('0x2c')](util[_0xa0c2('0xf')](_0xa0c2('0x32'),_0x193f65,_0x33e9eb[_0xa0c2('0x2d')]));emitChannelQueueInteraction(_0x2e9a2c[_0xa0c2('0x22')],_0x33e9eb['name'],_0x2e9a2c['body'],_0x2e9a2c[_0xa0c2('0xa')][_0xa0c2('0x2d')],_0x2e9a2c['message']['id'],![],_0x3e2a28,_0x33e9eb['id']);if(rpc[_0x2e9a2c[_0xa0c2('0x22')]+'QueueReport']){return rpc[_0x2e9a2c[_0xa0c2('0x22')]+_0xa0c2('0x2e')]['update'](_0x193f65,_0x16ebe1)[_0xa0c2('0x30')](function(_0x2eecf4){logger[_0xa0c2('0x31')](_0xa0c2('0x33'));});}}}function endRouting(_0x4ae371,_0x1e3a12,_0x1286a2,_0x492dca){if(_0x4ae371&&_0x1e3a12){_0x1e3a12[_0xa0c2('0x1d')]-=0x1;var _0x1b1eaa={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0xa0c2('0xf')](_0xa0c2('0x1f')),'reason':_0xa0c2('0x34')};logger['info'](util['format'](_0xa0c2('0x35'),_0x4ae371,_0x1e3a12[_0xa0c2('0x2d')]));emitChannelQueueInteraction(_0x1286a2[_0xa0c2('0x22')],_0x1e3a12[_0xa0c2('0x2d')],_0x1286a2[_0xa0c2('0x1e')],_0x1286a2[_0xa0c2('0xa')][_0xa0c2('0x2d')],_0x1286a2['message']['id'],![],_0x492dca);if(rpc[_0x1286a2[_0xa0c2('0x22')]+_0xa0c2('0x2e')]){return rpc[_0x1286a2[_0xa0c2('0x22')]+_0xa0c2('0x2e')][_0xa0c2('0x36')](_0x4ae371,_0x1b1eaa)[_0xa0c2('0x30')](function(_0x43c6d0){logger[_0xa0c2('0x31')](_0xa0c2('0x33'));});}}}function handleFindQueue(_0x247ea2){return function(_0x10ac90){return _0x10ac90['name'][_0xa0c2('0x37')]()===_0x247ea2[_0xa0c2('0x37')]();};}exports[_0xa0c2('0x38')]=function(_0x2188f1,_0x21b222,_0x4d3cd4,_0xb555c6){return function(_0x177cff){try{var _0x1608ec={'name':_0x21b222[0x0],'timeout':_0x21b222[0x1]};var _0x500c81=queue[_0xa0c2('0x0')](_0x1608ec,{'typecast':!![]});if(_0x500c81['length']){logger[_0xa0c2('0x31')](_0xa0c2('0x39'),_0x2188f1,_['map'](_0x500c81,_0xa0c2('0x28'))[_0xa0c2('0x3a')](',\x20'));_0x177cff[_0xa0c2('0x3b')]();}else{var _0x20c593=_[_0xa0c2('0x3c')](_0x4d3cd4[_0xb555c6[_0xa0c2('0x22')]+'Queues'],handleFindQueue(_0x1608ec['name']));if(_0x20c593){startRouting(_0x2188f1,_0x20c593,_0xb555c6,_0x4d3cd4);var _0x11191d=(_0x20c593[_0xa0c2('0x34')]||0xa)*0x3e8;var _0x5eb7a2=(_0x1608ec['timeout']||0x14)*0x3e8;var _0x17ce51,_0x2fa620;if(_0x11191d>_0x5eb7a2){_0x5eb7a2=_0x11191d;}var _0x56cb77=seqqueue[_0xa0c2('0x3d')](_0x11191d);_0x56cb77['id']=_0x2188f1;_0x56cb77[_0xa0c2('0x3e')]=_0x11191d;_0x56cb77[_0xa0c2('0x3f')]=_0x5eb7a2;_0x56cb77[_0xa0c2('0x22')]=_0xb555c6[_0xa0c2('0x22')];_0x4d3cd4[_0xa0c2('0x40')][_0x2188f1]['on'](_0xa0c2('0x41'),function(){logger[_0xa0c2('0x2c')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x2188f1);stopRouting(_0x2188f1,_0x20c593,_0xb555c6,_0x4d3cd4);clearTimeout(_0x17ce51);_0x17ce51=undefined;_0x56cb77[_0xa0c2('0x42')](!![]);if(_0x4d3cd4[_0xa0c2('0x40')][_0x2188f1]){delete _0x4d3cd4[_0xa0c2('0x40')][_0x2188f1];}_0x177cff[_0xa0c2('0x3b')]();});_0x4d3cd4[_0xa0c2('0x40')][_0x2188f1]['on'](_0xa0c2('0x43'),function(){if(_0x4d3cd4[_0xa0c2('0x40')][_0x2188f1]){delete _0x4d3cd4['rules'][_0x2188f1];}});_0x17ce51=setTimeout(function(){logger[_0xa0c2('0x2c')](_0xa0c2('0x44'),_0x2188f1);endRouting(_0x2188f1,_0x20c593,_0xb555c6,_0x4d3cd4);clearTimeout(_0x17ce51);_0x56cb77[_0xa0c2('0x42')](!![]);_0x177cff[_0xa0c2('0x45')]();},_0x5eb7a2);switch(_0x20c593[_0xa0c2('0x46')]){case'rrmemory':strategy['rrmemory'](_0x56cb77,_0x20c593,_0x4d3cd4,_0xb555c6);break;default:strategy[_0xa0c2('0x47')](_0x56cb77,_0x20c593,_0x4d3cd4,_0xb555c6);}}else{logger['error'](_0xa0c2('0x48'),_0x2188f1,_0x1608ec[_0xa0c2('0x2d')]);_0x177cff[_0xa0c2('0x3b')]();}}}catch(_0x2685d5){console[_0xa0c2('0x49')](_0x2685d5);logger['error'](_0xa0c2('0x39'),_0x2188f1,_0x2685d5[_0xa0c2('0x4a')]);_0x177cff[_0xa0c2('0x3b')]();}};}; \ 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 9ed5a56..9d21891 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 _0xacfb=['writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','notificationId','busy','STOP','TIMEOUT','uuid','./util','../../../../../config/logger','squeue','agent','realtime','routing','push','handleRun','bind','handleTimeout','timeout','handleDrained','prototype','info','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busyQueue','showNotification'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xacfb,0xca));var _0xbacf=function(_0x1104f1,_0x2a4be1){_0x1104f1=_0x1104f1-0x0;var _0x3ea157=_0xacfb[_0x1104f1];return _0x3ea157;};'use strict';var _=require('lodash');var uuid=require(_0xbacf('0x0'));var util=require(_0xbacf('0x1'));var logger=require(_0xbacf('0x2'))('routing');var Agent=function(_0x15656f,_0x3a084a,_0x3f1aa4,_0x47af67){this['notificationId']=uuid['v4']();this[_0xbacf('0x3')]=_0x15656f;this[_0xbacf('0x4')]=_0x3a084a;this[_0xbacf('0x5')]=_0x3f1aa4;this[_0xbacf('0x6')]=_0x47af67;this['squeue'][_0xbacf('0x7')](this[_0xbacf('0x8')][_0xbacf('0x9')](this),this[_0xbacf('0xa')][_0xbacf('0x9')](this));this['squeue']['on'](_0xbacf('0xb'),this[_0xbacf('0xa')][_0xbacf('0x9')](this));this['squeue']['on']('drained',this[_0xbacf('0xc')][_0xbacf('0x9')](this));};Agent[_0xbacf('0xd')][_0xbacf('0x7')]=function(){this[_0xbacf('0x3')]['push'](this[_0xbacf('0x8')][_0xbacf('0x9')](this),this[_0xbacf('0xa')]['bind'](this));};Agent[_0xbacf('0xd')][_0xbacf('0xc')]=function(){this[_0xbacf('0xa')](!![]);};Agent[_0xbacf('0xd')][_0xbacf('0x8')]=function(_0x1941c9){logger[_0xbacf('0xe')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0xbacf('0x3')]['id'],this[_0xbacf('0x4')]['id']);if(_['isNil'](this[_0xbacf('0x5')][_0xbacf('0xf')][this[_0xbacf('0x4')]['id']])){logger[_0xbacf('0xe')](_0xbacf('0x10'),this[_0xbacf('0x3')]['id'],this[_0xbacf('0x4')]['id']);setTimeout(this[_0xbacf('0x7')][_0xbacf('0x9')](this),0x3e8);}else{if(this['routing'][_0xbacf('0x11')]||util[_0xbacf('0x12')](this[_0xbacf('0x3')]['id'],this[_0xbacf('0x5')][_0xbacf('0xf')][this[_0xbacf('0x4')]['id']],this[_0xbacf('0x3')][_0xbacf('0x13')],![])){this['realtime'][_0xbacf('0xf')][this[_0xbacf('0x4')]['id']]['busy']=!![];this['realtime'][_0xbacf('0xf')][this[_0xbacf('0x4')]['id']][_0xbacf('0x14')]=undefined;util[_0xbacf('0x15')](this['notificationId'],this['squeue']['id'],this[_0xbacf('0x5')][_0xbacf('0xf')][this[_0xbacf('0x4')]['id']],null,this[_0xbacf('0x6')]);util[_0xbacf('0x16')](this[_0xbacf('0x3')]['id'],this[_0xbacf('0x5')][_0xbacf('0xf')][this['agent']['id']],_0xbacf('0x17')+(this[_0xbacf('0x6')][_0xbacf('0x11')]?_0xbacf('0x18'):''));}else{logger[_0xbacf('0xe')](_0xbacf('0x19'),this[_0xbacf('0x3')]['id'],this[_0xbacf('0x4')]['id']);setTimeout(this[_0xbacf('0x7')][_0xbacf('0x9')](this),0x3e8);}}};Agent[_0xbacf('0xd')]['handleTimeout']=function(_0xee626f){if(_['isNil'](this[_0xbacf('0x5')][_0xbacf('0xf')][this[_0xbacf('0x4')]['id']])){return logger[_0xbacf('0xe')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xbacf('0x3')]['id'],this['agent']['id']);}else{logger[_0xbacf('0xe')](_0xbacf('0x1a'),this['squeue']['id'],this[_0xbacf('0x4')]['id']);util[_0xbacf('0x1b')](this[_0xbacf('0x1c')],this['squeue']['id'],this[_0xbacf('0x5')]['agents'][this[_0xbacf('0x4')]['id']],null,this[_0xbacf('0x6')]);this['realtime'][_0xbacf('0xf')][this[_0xbacf('0x4')]['id']][_0xbacf('0x1d')]=![];this[_0xbacf('0x5')][_0xbacf('0xf')][this[_0xbacf('0x4')]['id']][_0xbacf('0x14')]=undefined;util[_0xbacf('0x16')](this[_0xbacf('0x3')]['id'],this[_0xbacf('0x5')][_0xbacf('0xf')][this['agent']['id']],_0xee626f?_0xbacf('0x1e'):_0xbacf('0x1f'));}if(!_0xee626f){setTimeout(this[_0xbacf('0x7')][_0xbacf('0x9')](this),0x3e8);}};function agent(_0x1017b0,_0x4c50aa,_0xcc0101,_0x240e76){return new Agent(_0x1017b0,_0x4c50aa,_0xcc0101,_0x240e76);}module['exports']=agent; \ No newline at end of file +var _0x5d44=['info','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','writeLog','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','busy','busyQueue','STOP','exports','lodash','uuid','./util','routing','notificationId','squeue','realtime','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','push'];(function(_0x271450,_0x4b2557){var _0x4b6013=function(_0x29588e){while(--_0x29588e){_0x271450['push'](_0x271450['shift']());}};_0x4b6013(++_0x4b2557);}(_0x5d44,0xd1));var _0x45d4=function(_0x13a836,_0x4c2ba2){_0x13a836=_0x13a836-0x0;var _0x1f5bee=_0x5d44[_0x13a836];return _0x1f5bee;};'use strict';var _=require(_0x45d4('0x0'));var uuid=require(_0x45d4('0x1'));var util=require(_0x45d4('0x2'));var logger=require('../../../../../config/logger')(_0x45d4('0x3'));var Agent=function(_0x183dc5,_0x40f3b5,_0x27b1f8,_0x3274b4){this[_0x45d4('0x4')]=uuid['v4']();this[_0x45d4('0x5')]=_0x183dc5;this['agent']=_0x40f3b5;this[_0x45d4('0x6')]=_0x27b1f8;this[_0x45d4('0x3')]=_0x3274b4;this[_0x45d4('0x5')]['push'](this[_0x45d4('0x7')][_0x45d4('0x8')](this),this[_0x45d4('0x9')]['bind'](this));this[_0x45d4('0x5')]['on'](_0x45d4('0xa'),this[_0x45d4('0x9')][_0x45d4('0x8')](this));this['squeue']['on'](_0x45d4('0xb'),this[_0x45d4('0xc')][_0x45d4('0x8')](this));};Agent[_0x45d4('0xd')][_0x45d4('0xe')]=function(){this['squeue'][_0x45d4('0xe')](this[_0x45d4('0x7')][_0x45d4('0x8')](this),this[_0x45d4('0x9')][_0x45d4('0x8')](this));};Agent[_0x45d4('0xd')][_0x45d4('0xc')]=function(){this[_0x45d4('0x9')](!![]);};Agent[_0x45d4('0xd')][_0x45d4('0x7')]=function(_0xb21c41){logger[_0x45d4('0xf')](_0x45d4('0x10'),this[_0x45d4('0x5')]['id'],this[_0x45d4('0x11')]['id']);if(_[_0x45d4('0x12')](this[_0x45d4('0x6')][_0x45d4('0x13')][this[_0x45d4('0x11')]['id']])){logger['info'](_0x45d4('0x14'),this[_0x45d4('0x5')]['id'],this[_0x45d4('0x11')]['id']);setTimeout(this['push'][_0x45d4('0x8')](this),0x3e8);}else{if(this[_0x45d4('0x3')]['forcedOwnership']||util['isAgentAvailable'](this[_0x45d4('0x5')]['id'],this[_0x45d4('0x6')][_0x45d4('0x13')][this[_0x45d4('0x11')]['id']],this[_0x45d4('0x5')][_0x45d4('0x15')],![])){this[_0x45d4('0x6')][_0x45d4('0x13')][this[_0x45d4('0x11')]['id']]['busy']=!![];this[_0x45d4('0x6')][_0x45d4('0x13')][this['agent']['id']]['busyQueue']=undefined;util['showNotification'](this[_0x45d4('0x4')],this[_0x45d4('0x5')]['id'],this[_0x45d4('0x6')]['agents'][this[_0x45d4('0x11')]['id']],null,this['routing']);util[_0x45d4('0x16')](this[_0x45d4('0x5')]['id'],this[_0x45d4('0x6')][_0x45d4('0x13')][this[_0x45d4('0x11')]['id']],_0x45d4('0x17')+(this[_0x45d4('0x3')][_0x45d4('0x18')]?_0x45d4('0x19'):''));}else{logger[_0x45d4('0xf')](_0x45d4('0x1a'),this['squeue']['id'],this[_0x45d4('0x11')]['id']);setTimeout(this[_0x45d4('0xe')]['bind'](this),0x3e8);}}};Agent[_0x45d4('0xd')][_0x45d4('0x9')]=function(_0x41c6ec){if(_['isNil'](this[_0x45d4('0x6')][_0x45d4('0x13')][this['agent']['id']])){return logger[_0x45d4('0xf')](_0x45d4('0x14'),this[_0x45d4('0x5')]['id'],this[_0x45d4('0x11')]['id']);}else{logger['info'](_0x45d4('0x1b'),this[_0x45d4('0x5')]['id'],this[_0x45d4('0x11')]['id']);util['hideNotification'](this[_0x45d4('0x4')],this[_0x45d4('0x5')]['id'],this[_0x45d4('0x6')][_0x45d4('0x13')][this[_0x45d4('0x11')]['id']],null,this[_0x45d4('0x3')]);this[_0x45d4('0x6')][_0x45d4('0x13')][this[_0x45d4('0x11')]['id']][_0x45d4('0x1c')]=![];this[_0x45d4('0x6')]['agents'][this['agent']['id']][_0x45d4('0x1d')]=undefined;util[_0x45d4('0x16')](this[_0x45d4('0x5')]['id'],this[_0x45d4('0x6')][_0x45d4('0x13')][this['agent']['id']],_0x41c6ec?_0x45d4('0x1e'):'TIMEOUT');}if(!_0x41c6ec){setTimeout(this[_0x45d4('0xe')]['bind'](this),0x3e8);}};function agent(_0x1c09b9,_0x1509df,_0x4f9281,_0x525787){return new Agent(_0x1c09b9,_0x1509df,_0x4f9281,_0x525787);}module[_0x45d4('0x1f')]=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 14d3858..ab892f0 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 _0x1939=['isNil','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','writeLog','RINGING','busy','busyQueue','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','exports','lodash','./util','../../../../../config/logger','routing','notificationId','queue','realtime','squeue','push','handleRun','bind','handleTimeout','timeout','prototype','handleDrained'];(function(_0x2b3408,_0x4bc054){var _0x3b0ac1=function(_0x2f0688){while(--_0x2f0688){_0x2b3408['push'](_0x2b3408['shift']());}};_0x3b0ac1(++_0x4bc054);}(_0x1939,0x1d1));var _0x9193=function(_0x49fa98,_0x11accf){_0x49fa98=_0x49fa98-0x0;var _0x1698f1=_0x1939[_0x49fa98];return _0x1698f1;};'use strict';var _=require(_0x9193('0x0'));var uuid=require('uuid');var util=require(_0x9193('0x1'));var logger=require(_0x9193('0x2'))(_0x9193('0x3'));var Beepall=function(_0x538b4c,_0x12643a,_0x4415e0,_0x31aa3c){this[_0x9193('0x4')]=uuid['v4']();this['squeue']=_0x538b4c;this[_0x9193('0x5')]=_0x12643a;this[_0x9193('0x6')]=_0x4415e0;this['routing']=_0x31aa3c;this[_0x9193('0x7')][_0x9193('0x8')](this[_0x9193('0x9')][_0x9193('0xa')](this),this[_0x9193('0xb')]['bind'](this));this[_0x9193('0x7')]['on'](_0x9193('0xc'),this[_0x9193('0xb')][_0x9193('0xa')](this));this[_0x9193('0x7')]['on']('drained',this['handleDrained']['bind'](this));};Beepall[_0x9193('0xd')]['push']=function(){this[_0x9193('0x7')][_0x9193('0x8')](this['handleRun'][_0x9193('0xa')](this),this[_0x9193('0xb')][_0x9193('0xa')](this));};Beepall[_0x9193('0xd')][_0x9193('0xe')]=function(_0x32f466){this[_0x9193('0xb')](!![]);};Beepall[_0x9193('0xd')][_0x9193('0x9')]=function(_0x4df3b9){var _0x1088e0=!![];if(!_[_0x9193('0xf')](this[_0x9193('0x5')])&&!_[_0x9193('0xf')](this[_0x9193('0x5')]['Agents'])&&this[_0x9193('0x5')][_0x9193('0x10')][_0x9193('0x11')]>0x0){for(var _0x363323=0x0,_0x1d6030;_0x3633230x0){for(var _0x412483=0x0,_0xcc782;_0x4124830x0&&_0x20e2da[_0x3dee99+_0x027a('0x22')]>=_0x20e2da[_0x3dee99+_0x027a('0x21')]){writeLog(_0x119a5c,_0x20e2da,_0x3dee99[_0x027a('0x23')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x027a('0x24')]=function(_0x55a8cd,_0x953887,_0x488920,_0x2be389,_0x4d5a25){return sendNotification(!![],_0x55a8cd,_0x953887,_0x488920,_0x2be389,_0x4d5a25);};exports['hideNotification']=function(_0x31385d,_0x5782ac,_0x47a365,_0x448ba0,_0x52ca99){return sendNotification(![],_0x31385d,_0x5782ac,_0x47a365,_0x448ba0,_0x52ca99);};exports[_0x027a('0x25')]=writeLog; \ No newline at end of file +var _0xc1c6=['routing','redis','localhost','emit','format','user:%s','name','user:save','\x20interaction','notificationSound','notificationShake','body','queue','getMustacheRender','account','msg','error','[%s][QUEUE]\x20%s','message','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','showNotification','writeLog','lodash','util','../utils','ioredis','../../../../../config/logger'];(function(_0x3de7c2,_0x3005d9){var _0x255541=function(_0x268acb){while(--_0x268acb){_0x3de7c2['push'](_0x3de7c2['shift']());}};_0x255541(++_0x3005d9);}(_0xc1c6,0xf7));var _0x6c1c=function(_0xec50d6,_0xde7a6c){_0xec50d6=_0xec50d6-0x0;var _0x431961=_0xc1c6[_0xec50d6];return _0x431961;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var utils=require(_0x6c1c('0x2'));var Mustache=require('mustache');var Redis=require(_0x6c1c('0x3'));var config=require('../../../../../config/environment');var logger=require(_0x6c1c('0x4'))(_0x6c1c('0x5'));config[_0x6c1c('0x6')]=_['defaults'](config['redis'],{'host':_0x6c1c('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6c1c('0x6')]));function emit(_0x582bec,_0xe510ca,_0x2eb1ba){io['to'](_0x582bec)[_0x6c1c('0x8')](_0xe510ca,_0x2eb1ba);}function sendNotification(_0x2cec58,_0x4b66ec,_0x35f9ab,_0x3ca985,_0x524d21,_0x147c7b){io['to'](util[_0x6c1c('0x9')](_0x6c1c('0xa'),_0x3ca985[_0x6c1c('0xb')]))['emit'](_0x6c1c('0xc'),_0x3ca985);var _0x2a4fd4=_0x147c7b||{};var _0x40cebf=_0x35f9ab['split']('.');var _0x412717={'uniqueid':_0x4b66ec,'channel':_0x40cebf[0x0],'id':_0x40cebf[0x1],'title':_0x40cebf[0x0]+_0x6c1c('0xd'),'interactionId':_0x40cebf[0x2],'queue':_0x524d21?_0x524d21[_0x6c1c('0xb')]:null,'sound':_0x2a4fd4['account'][_0x6c1c('0xe')],'shake':_0x2a4fd4['account'][_0x6c1c('0xf')]};try{if(!_0x2a4fd4[_0x6c1c('0x10')]){_0x2a4fd4[_0x6c1c('0x10')]={};}if(_0x524d21){_0x2a4fd4[_0x6c1c('0x10')][_0x6c1c('0x11')]=_0x524d21;}else if(_0x2a4fd4[_0x6c1c('0x10')][_0x6c1c('0x11')]){delete _0x2a4fd4[_0x6c1c('0x10')][_0x6c1c('0x11')];}_0x412717['msg']=utils[_0x6c1c('0x12')](_0x2a4fd4[_0x6c1c('0x13')]['notificationTemplate'],_0x2a4fd4);}catch(_0x3a2d32){_0x412717[_0x6c1c('0x14')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0x6c1c('0x15')](util['format'](_0x6c1c('0x16'),_0x4b66ec,_0x3a2d32[_0x6c1c('0x17')]));}io['to'](util['format'](_0x6c1c('0xa'),_0x3ca985['name']))[_0x6c1c('0x8')](util[_0x6c1c('0x9')](_0x6c1c('0x18'),_0x2cec58?_0x6c1c('0x19'):_0x6c1c('0x1a')),_0x412717);}function writeLog(_0x1efb19,_0x1993c5,_0x2ed830){return logger[_0x6c1c('0x1b')](util[_0x6c1c('0x9')](_0x6c1c('0x1c'),_0x1efb19,_0x1993c5[_0x6c1c('0xb')],_0x2ed830));}exports[_0x6c1c('0x1d')]=function(_0x9c6c55,_0x31fed2,_0x19c269,_0x2319d3){if(_0x31fed2[_0x6c1c('0x1e')]){writeLog(_0x9c6c55,_0x31fed2,_0x6c1c('0x1f'));return![];}if(!_0x31fed2[_0x6c1c('0x20')]){writeLog(_0x9c6c55,_0x31fed2,_0x6c1c('0x21'));return![];}if(_0x31fed2[_0x19c269+_0x6c1c('0x22')]){writeLog(_0x9c6c55,_0x31fed2,_0x6c1c('0x23'));return![];}if(_0x2319d3&&_0x31fed2[_0x6c1c('0x24')](_0x19c269+_0x6c1c('0x25'))&&_0x31fed2[_0x6c1c('0x24')](_0x19c269+_0x6c1c('0x26'))){if(_0x31fed2[_0x19c269+_0x6c1c('0x25')]>0x0&&_0x31fed2[_0x19c269+_0x6c1c('0x26')]>=_0x31fed2[_0x19c269+'Capacity']){writeLog(_0x9c6c55,_0x31fed2,_0x19c269[_0x6c1c('0x27')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x6c1c('0x28')]=function(_0x4c23f8,_0xcd3179,_0x5f286b,_0x436d17,_0xf557ba){return sendNotification(!![],_0x4c23f8,_0xcd3179,_0x5f286b,_0x436d17,_0xf557ba);};exports['hideNotification']=function(_0x3b1a4f,_0x24da4c,_0x4e13e3,_0x3b319a,_0x19a8f1){return sendNotification(![],_0x3b1a4f,_0x24da4c,_0x4e13e3,_0x3b319a,_0x19a8f1);};exports[_0x6c1c('0x29')]=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 ca5ad87..9e7a201 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 _0x3d46=['replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','isObject','validate','lodash','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s'];(function(_0x41ce3c,_0x5690a9){var _0x493b99=function(_0x48be02){while(--_0x48be02){_0x41ce3c['push'](_0x41ce3c['shift']());}};_0x493b99(++_0x5690a9);}(_0x3d46,0x1cf));var _0x63d4=function(_0x4515d1,_0x587c9f){_0x4515d1=_0x4515d1-0x0;var _0x1adc79=_0x3d46[_0x4515d1];return _0x1adc79;};'use strict';var schema=require(_0x63d4('0x0'));var sh=require('shelljs');var _=require(_0x63d4('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x63d4('0x2'));var system=schema({'command':{'type':'string','required':!![],'message':_0x63d4('0x3')}});exports[_0x63d4('0x4')]=function(_0x2bc618,_0x3fb852){return function(_0x512963){try{var _0x194b1b={'command':_0x3fb852[0x0]};var _0x2a83f9=system[_0x63d4('0x0')](_0x194b1b,{'typecast':!![]});if(_0x2a83f9[_0x63d4('0x5')]){logger[_0x63d4('0x6')](_0x63d4('0x7'),_0x2bc618,_[_0x63d4('0x8')](_0x2a83f9,_0x63d4('0x9'))[_0x63d4('0xa')](',\x20'));logger[_0x63d4('0xb')](_0x63d4('0xc'),_0x2bc618);_0x512963['next']();}else{var _0x26663c=this;var _0x40f1c1=utils['getMustacheRender'](_0x3fb852[0x0],this);logger['info'](_0x63d4('0xd'),_0x2bc618,_0x40f1c1);sh[_0x63d4('0xe')](_[_0x63d4('0xf')](_0x40f1c1),function(_0x11472c,_0x503155){logger[_0x63d4('0xb')](_0x63d4('0x10'),_0x2bc618,_0x11472c);if(_0x11472c==0x0){var _0x315d29=_0x503155[_0x63d4('0x11')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x3fb852[0x1])||_[_0x63d4('0x12')](_0x3fb852[0x1])){logger[_0x63d4('0xb')](_0x63d4('0x13'),_0x2bc618);_0x26663c[_0x63d4('0x14')][_0x3fb852[0x1]]=_0x315d29;}else{logger['info'](_0x63d4('0x15'),_0x2bc618,_0x3fb852[0x1],_0x315d29);_0x26663c[_0x63d4('0x14')][_0x3fb852[0x1]]=_0x315d29;}}_0x512963[_0x63d4('0x16')]();});}}catch(_0xb701f8){logger[_0x63d4('0x6')]('[%s][SYSTEM]\x20%s',_0x2bc618,_[_0x63d4('0x17')](_0xb701f8)?JSON['stringify'](_0xb701f8):_0xb701f8);logger[_0x63d4('0xb')](_0x63d4('0xc'),_0x2bc618);_0x512963[_0x63d4('0x16')]();}};}; \ No newline at end of file +var _0xeeaf=['isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','isNil','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','[%s][SYSTEM]\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeeaf,0x1bc));var _0xfeea=function(_0x20dd85,_0x305804){_0x20dd85=_0x20dd85-0x0;var _0x1960cd=_0xeeaf[_0x20dd85];return _0x1960cd;};'use strict';var schema=require(_0xfeea('0x0'));var sh=require(_0xfeea('0x1'));var _=require(_0xfeea('0x2'));var utils=require(_0xfeea('0x3'));var logger=require(_0xfeea('0x4'))(_0xfeea('0x5'));var system=schema({'command':{'type':_0xfeea('0x6'),'required':!![],'message':_0xfeea('0x7')}});exports['consequence']=function(_0x3ec35c,_0x4543c6){return function(_0x4963da){try{var _0x9bc1d7={'command':_0x4543c6[0x0]};var _0x4b1f35=system['validate'](_0x9bc1d7,{'typecast':!![]});if(_0x4b1f35[_0xfeea('0x8')]){logger['error']('[%s][SYSTEM]\x20%s',_0x3ec35c,_['map'](_0x4b1f35,_0xfeea('0x9'))[_0xfeea('0xa')](',\x20'));logger['info'](_0xfeea('0xb'),_0x3ec35c);_0x4963da[_0xfeea('0xc')]();}else{var _0xa276aa=this;var _0x3c3afb=utils[_0xfeea('0xd')](_0x4543c6[0x0],this);logger[_0xfeea('0xe')](_0xfeea('0xf'),_0x3ec35c,_0x3c3afb);sh[_0xfeea('0x10')](_[_0xfeea('0x11')](_0x3c3afb),function(_0x29d07e,_0x46b53d){logger['info']('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x3ec35c,_0x29d07e);if(_0x29d07e==0x0){var _0x150d0d=_0x46b53d['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0xfeea('0x12')](_0x4543c6[0x1])||_[_0xfeea('0x13')](_0x4543c6[0x1])){logger[_0xfeea('0xe')]('[%s][SYSTEM]\x20no\x20variable',_0x3ec35c);_0xa276aa[_0xfeea('0x14')][_0x4543c6[0x1]]=_0x150d0d;}else{logger[_0xfeea('0xe')](_0xfeea('0x15'),_0x3ec35c,_0x4543c6[0x1],_0x150d0d);_0xa276aa[_0xfeea('0x14')][_0x4543c6[0x1]]=_0x150d0d;}}_0x4963da[_0xfeea('0xc')]();});}}catch(_0x21790b){logger[_0xfeea('0x16')](_0xfeea('0x17'),_0x3ec35c,_[_0xfeea('0x18')](_0x21790b)?JSON[_0xfeea('0x19')](_0x21790b):_0x21790b);logger[_0xfeea('0xe')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x3ec35c);_0x4963da[_0xfeea('0xc')]();}};}; \ 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 3678e4f..4be84eb 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 _0xd153=['Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel'];(function(_0x4953da,_0x5adaca){var _0x2d3780=function(_0x458f36){while(--_0x458f36){_0x4953da['push'](_0x4953da['shift']());}};_0x2d3780(++_0x5adaca);}(_0xd153,0x1d3));var _0x3d15=function(_0x37123c,_0x3d26d8){_0x37123c=_0x37123c-0x0;var _0x22df3b=_0xd153[_0x37123c];return _0x22df3b;};'use strict';var schema=require('validate');var _=require(_0x3d15('0x0'));var rpc={'chatInteraction':require(_0x3d15('0x1')),'openchannelInteraction':require(_0x3d15('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x3d15('0x3')),'whatsappInteraction':require(_0x3d15('0x4'))};var logger=require(_0x3d15('0x5'))('routing');var tag=schema({'tag':{'type':_0x3d15('0x6'),'required':!![],'message':_0x3d15('0x7')}});exports[_0x3d15('0x8')]=function(_0x242e4f,_0x28ff91,_0x4f5d17,_0x56b9bb){return function(_0x3b9734){try{var _0x3fe309={'tag':_0x28ff91[0x0]};var _0x419071=tag[_0x3d15('0x9')](_0x3fe309,{'typecast':!![]});if(_0x419071['length']){logger[_0x3d15('0xa')](_0x3d15('0xb'),_0x242e4f,_[_0x3d15('0xc')](_0x419071,_0x3d15('0xd'))[_0x3d15('0xe')](',\x20'));logger[_0x3d15('0xf')](_0x3d15('0x10'),_0x242e4f);_0x3b9734[_0x3d15('0x11')]();}else{var _0x1d317a={'ids':[_0x28ff91[0x0]]};if(rpc[_0x56b9bb[_0x3d15('0x12')]+_0x3d15('0x13')]){rpc[_0x56b9bb['channel']+_0x3d15('0x13')][_0x3d15('0x14')](_0x56b9bb[_0x3d15('0x15')]['id'],_0x1d317a)[_0x3d15('0x16')](function(_0x5ea56f){logger['info'](_0x3d15('0x17'),_0x242e4f,_0x28ff91[0x1],_0x56b9bb[_0x3d15('0x12')],_0x56b9bb[_0x3d15('0x15')]['id']);})[_0x3d15('0x18')](function(_0x144b90){logger[_0x3d15('0xa')]('[%s][TAG]\x20%s',_0x242e4f,JSON[_0x3d15('0x19')](_0x144b90));logger[_0x3d15('0xf')](_0x3d15('0x10'),_0x242e4f);})[_0x3d15('0x1a')](function(){_0x3b9734['next']();});}}}catch(_0x25f48a){logger[_0x3d15('0xa')](_0x3d15('0xb'),_0x242e4f,_['isObject'](_0x25f48a)?JSON[_0x3d15('0x19')](_0x25f48a):_0x25f48a);logger[_0x3d15('0xf')](_0x3d15('0x10'),_0x242e4f);_0x3b9734[_0x3d15('0x11')]();}};}; \ No newline at end of file +var _0x0f5c=['length','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','[%s][TAG]\x20%s','finally','next','stringify','lodash','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','consequence','validate'];(function(_0x4578e9,_0x22f525){var _0x516627=function(_0x41b9a0){while(--_0x41b9a0){_0x4578e9['push'](_0x4578e9['shift']());}};_0x516627(++_0x22f525);}(_0x0f5c,0x1a6));var _0xc0f5=function(_0x419e17,_0x7fe78c){_0x419e17=_0x419e17-0x0;var _0x1f2044=_0x0f5c[_0x419e17];return _0x1f2044;};'use strict';var schema=require('validate');var _=require(_0xc0f5('0x0'));var rpc={'chatInteraction':require(_0xc0f5('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xc0f5('0x2')),'faxInteraction':require(_0xc0f5('0x3')),'whatsappInteraction':require(_0xc0f5('0x4'))};var logger=require(_0xc0f5('0x5'))(_0xc0f5('0x6'));var tag=schema({'tag':{'type':_0xc0f5('0x7'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xc0f5('0x8')]=function(_0x8edd89,_0x1545d1,_0x1eac85,_0xda1059){return function(_0x44609f){try{var _0x521a64={'tag':_0x1545d1[0x0]};var _0x5265b5=tag[_0xc0f5('0x9')](_0x521a64,{'typecast':!![]});if(_0x5265b5[_0xc0f5('0xa')]){logger['error']('[%s][TAG]\x20%s',_0x8edd89,_[_0xc0f5('0xb')](_0x5265b5,_0xc0f5('0xc'))[_0xc0f5('0xd')](',\x20'));logger[_0xc0f5('0xe')](_0xc0f5('0xf'),_0x8edd89);_0x44609f['next']();}else{var _0x421d20={'ids':[_0x1545d1[0x0]]};if(rpc[_0xda1059[_0xc0f5('0x10')]+_0xc0f5('0x11')]){rpc[_0xda1059[_0xc0f5('0x10')]+_0xc0f5('0x11')]['addTags'](_0xda1059[_0xc0f5('0x12')]['id'],_0x421d20)[_0xc0f5('0x13')](function(_0x1c50ec){logger['info'](_0xc0f5('0x14'),_0x8edd89,_0x1545d1[0x1],_0xda1059[_0xc0f5('0x10')],_0xda1059['interaction']['id']);})[_0xc0f5('0x15')](function(_0x544179){logger[_0xc0f5('0x16')](_0xc0f5('0x17'),_0x8edd89,JSON['stringify'](_0x544179));logger[_0xc0f5('0xe')](_0xc0f5('0xf'),_0x8edd89);})[_0xc0f5('0x18')](function(){_0x44609f[_0xc0f5('0x19')]();});}}}catch(_0x5e063e){logger[_0xc0f5('0x16')]('[%s][TAG]\x20%s',_0x8edd89,_['isObject'](_0x5e063e)?JSON[_0xc0f5('0x1a')](_0x5e063e):_0x5e063e);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x8edd89);_0x44609f[_0xc0f5('0x19')]();}};}; \ 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 bd95537..3ea7fb6 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x41dc08,_0x48dd15){var _0x4391c5=function(_0x65b33f){while(--_0x65b33f){_0x41dc08['push'](_0x41dc08['shift']());}};_0x4391c5(++_0x48dd15);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0x9c44=['merge','body','account','list','exports','render'];(function(_0x127f1a,_0x421610){var _0x531cee=function(_0x5bd923){while(--_0x5bd923){_0x127f1a['push'](_0x127f1a['shift']());}};_0x531cee(++_0x421610);}(_0x9c44,0x178));var _0x49c4=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9c44[_0x4f9b18];return _0x29f20c;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 1d2caaf..4ee7753 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 _0x4977=['format','%s.%s.%s','isNil','IntervalId','map','interval','listen','channel','message','interaction','isArray','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflow','dialogflowv2','TagId','%s:%s:%s','./interval','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','execute','Applications\x20executed','stringify','matchPath','rules','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','UserId','catch','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','loggedIn','mailQueues','name','paused','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','log','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine'];(function(_0x543faa,_0x3cd1f9){var _0x375043=function(_0x9d51a9){while(--_0x9d51a9){_0x543faa['push'](_0x543faa['shift']());}};_0x375043(++_0x3cd1f9);}(_0x4977,0x1cd));var _0x7497=function(_0x43982f,_0x47be5f){_0x43982f=_0x43982f-0x0;var _0x3f6c47=_0x4977[_0x43982f];return _0x3f6c47;};'use strict';var _=require(_0x7497('0x0'));var util=require(_0x7497('0x1'));var path=require(_0x7497('0x2'));var fs=require('fs');var jayson=require(_0x7497('0x3'));var BPromise=require(_0x7497('0x4'));var uuid=require('uuid');var config=require(_0x7497('0x5'));var logger=require(_0x7497('0x6'))(_0x7497('0x7'));var rpc={'openchannelQueueReport':require(_0x7497('0x8')),'mailQueueReport':require(_0x7497('0x9')),'chatQueueReport':require(_0x7497('0xa')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x7497('0xb')),'whatsappQueueReport':require(_0x7497('0xc'))};var RuleEngine=require(_0x7497('0xd'));function getId(_0x15c322,_0x180bf8,_0x54da2d){return util[_0x7497('0xe')](_0x7497('0xf'),_0x15c322,_0x180bf8||0x0,_0x54da2d||0x0);}function getIntervals(_0x5b4f54,_0x28c035){var _0x264d9f=[];if(!_[_0x7497('0x10')](_0x28c035[_0x7497('0x11')])&&!_[_0x7497('0x10')](_0x5b4f54[_0x28c035[_0x7497('0x11')]])&&!_[_0x7497('0x10')](_0x5b4f54[_0x28c035[_0x7497('0x11')]]['Intervals'])){_0x264d9f=_[_0x7497('0x12')](_0x5b4f54[_0x28c035[_0x7497('0x11')]]['Intervals'],'interval');}else if(!_[_0x7497('0x10')](_0x28c035[_0x7497('0x13')])){_0x264d9f=[_0x28c035[_0x7497('0x13')]];}return _0x264d9f;}exports[_0x7497('0x14')]=function(_0x20faeb){_0x20faeb['rules']={};return new BPromise(function(_0x454656,_0x55521f){var _0x230d7c={'Start':function(_0x366ee3){var _0x1b240e=this;return new Promise(function(_0x44c562,_0x2f3dce){if(_0x366ee3){try{var _0x51b7d5=[];var _0x26842c=getId(_0x366ee3[_0x7497('0x15')],_0x366ee3[_0x7497('0x16')]?_0x366ee3[_0x7497('0x16')]['id']:0x0,_0x366ee3[_0x7497('0x17')]?_0x366ee3['interaction']['id']:0x0);if(_0x366ee3['applications']&&_[_0x7497('0x18')](_0x366ee3[_0x7497('0x19')])&&_0x366ee3[_0x7497('0x19')][_0x7497('0x1a')]){for(var _0x324ab3=0x0;_0x324ab3<_0x366ee3[_0x7497('0x19')]['length'];_0x324ab3+=0x1){var _0xbe6c82=_0x366ee3[_0x7497('0x19')][_0x324ab3];if(fs[_0x7497('0x1b')](path[_0x7497('0x1c')](__dirname,'applications',_0xbe6c82[_0x7497('0x1d')]+_0x7497('0x1e')))){var _0x1794c7=[];switch(_0xbe6c82[_0x7497('0x1d')][_0x7497('0x1f')]()){case _0x7497('0x20'):var _0x3c7ecb=_0xbe6c82[_0x7497('0x21')][_0x7497('0x22')](',');if(_0x366ee3['channel']===_0x7497('0x23')){_0x1794c7[_0x7497('0x24')](_0x3c7ecb[0x0]);_0x1794c7[_0x7497('0x24')](_0x3c7ecb[0x1]);_0x1794c7[_0x7497('0x24')](_0x3c7ecb[_0x7497('0x25')](0x2,_0x3c7ecb[_0x7497('0x1a')])[_0x7497('0x1c')](','));}else{_0x1794c7['push'](_0x3c7ecb[0x0]);_0x1794c7[_0x7497('0x24')](_0x3c7ecb[_0x7497('0x25')](0x1,_0x3c7ecb[_0x7497('0x1a')])[_0x7497('0x1c')](','));}break;case _0x7497('0x26'):var _0x4a99ac=_0xbe6c82['appdata'][_0x7497('0x22')](',');_0x1794c7[_0x7497('0x24')](_0x4a99ac[0x0]);_0x1794c7[_0x7497('0x24')](_0x4a99ac[0x1]);_0x1794c7[_0x7497('0x24')](_0x4a99ac[_0x7497('0x25')](0x2,_0x4a99ac[_0x7497('0x1a')])[_0x7497('0x1c')](','));break;case _0x7497('0x27'):var _0x4e4c05=_0xbe6c82[_0x7497('0x21')]['split'](',');_0x1794c7[_0x7497('0x24')](_0x4e4c05[0x0]);_0x1794c7[_0x7497('0x24')](_0x4e4c05[0x1]);_0x1794c7['push'](_0x4e4c05[0x2]);_0x1794c7['push'](_0x4e4c05[0x3]);_0x1794c7[_0x7497('0x24')](_0x4e4c05[_0x7497('0x25')](0x4,_0x4e4c05['length'])[_0x7497('0x1c')](','));break;case'amazonlex':var _0x3ba3d6=_0xbe6c82[_0x7497('0x21')][_0x7497('0x22')](',');_0x1794c7[_0x7497('0x24')](_0x3ba3d6[0x0]);_0x1794c7[_0x7497('0x24')](_0x3ba3d6[0x1]);_0x1794c7[_0x7497('0x24')](_0x3ba3d6[0x2]);_0x1794c7[_0x7497('0x24')](_0x3ba3d6[0x3]);_0x1794c7['push'](_0x3ba3d6[_0x7497('0x25')](0x4,_0x3ba3d6[_0x7497('0x1a')])[_0x7497('0x1c')](','));break;case'message':_0x1794c7[_0x7497('0x24')](_0xbe6c82[_0x7497('0x21')]);break;case'tag':_0x1794c7['push'](_0xbe6c82[_0x7497('0x28')]);_0x1794c7[_0x7497('0x24')](_0xbe6c82['appdata']);break;default:_0x1794c7=_[_0x7497('0x10')](_0xbe6c82['appdata'])?[]:_0xbe6c82['appdata'][_0x7497('0x22')](',');}var _0x1c15c9={'id':util[_0x7497('0xe')](_0x7497('0x29'),_0x26842c,_0xbe6c82['id'],_0xbe6c82['app']),'condition':require(_0x7497('0x2a'))['condition'](_0x26842c,getIntervals(_0x20faeb[_0x7497('0x2b')],_0xbe6c82),_0x20faeb),'consequence':require(_0x7497('0x2c')+_0xbe6c82[_0x7497('0x1d')])[_0x7497('0x2d')](_0x26842c,_0x1794c7,_0x20faeb,_0x366ee3),'p':_0xbe6c82[_0x7497('0x2e')]||0x0};logger[_0x7497('0x2f')](_0x7497('0x30'),_0x1c15c9['id'],_0x7497('0x31'),getIntervals(_0x20faeb[_0x7497('0x2b')],_0xbe6c82)[_0x7497('0x1c')](_0x7497('0x32')));_0x51b7d5[_0x7497('0x24')](_0x1c15c9);}else{logger[_0x7497('0x33')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x7497('0x1c')](__dirname,_0x7497('0x19'),_0xbe6c82[_0x7497('0x1d')]+_0x7497('0x1e')));}}_0x20faeb['rules'][_0x26842c]=new RuleEngine(_0x51b7d5);_0x20faeb['rules'][_0x26842c][_0x7497('0x34')](_0x366ee3,function(_0x5befd2){logger[_0x7497('0x2f')](_0x7497('0x35'),JSON[_0x7497('0x36')](_0x5befd2[_0x7497('0x37')]));if(_0x20faeb[_0x7497('0x38')][_0x26842c]){_0x20faeb[_0x7497('0x38')][_0x26842c]['emit'](_0x7497('0x39'));}});return _0x44c562({'code':0xc8,'message':_0x366ee3});}else{logger[_0x7497('0x2f')](_0x7497('0x3a'));return _0x44c562({'code':0xc8,'message':_0x366ee3});}}catch(_0x201e4a){logger[_0x7497('0x33')](_0x201e4a[_0x7497('0x3b')]);return _0x2f3dce(_0x1b240e[_0x7497('0x33')](0x1f4,_0x201e4a));}}return _0x2f3dce(_0x7497('0x3c'));});},'AcceptMessage':function(_0x306999){var _0x5ef292=this;return new Promise(function(_0x35d350,_0x276a57){if(_0x306999[_0x7497('0x3d')]&&_0x306999[_0x7497('0x3d')]['id']){if(_0x20faeb[_0x7497('0x3e')][_0x306999[_0x7497('0x3d')]['id']]){_0x20faeb['agents'][_0x306999[_0x7497('0x3d')]['id']][_0x7497('0x3f')]=![];_0x20faeb['agents'][_0x306999[_0x7497('0x3d')]['id']][_0x7497('0x40')]=undefined;}}if(_0x306999[_0x7497('0x16')]&&_0x306999[_0x7497('0x16')]['id']){try{var _0x189c2e=getId(_0x306999[_0x7497('0x15')],_0x306999['message']?_0x306999[_0x7497('0x16')]['id']:0x0,_0x306999['interaction']?_0x306999[_0x7497('0x17')]['id']:0x0);if(_0x20faeb[_0x7497('0x38')][_0x189c2e]){_0x20faeb[_0x7497('0x38')][_0x189c2e]['emit'](_0x7497('0x41'));if(rpc[_0x306999['channel']+'QueueReport']){rpc[_0x306999[_0x7497('0x15')]+_0x7497('0x42')]['update'](_0x189c2e,{'UserId':_0x306999[_0x7497('0x16')][_0x7497('0x43')]})[_0x7497('0x44')](function(_0x24d297){logger[_0x7497('0x33')]('error\x20update\x20queue\x20report');});}}return _0x35d350({'code':0xc8,'message':_0x306999});}catch(_0x46b7a8){logger[_0x7497('0x33')](_0x46b7a8[_0x7497('0x3b')]);return _0x276a57(_0x5ef292['error'](0x1f4,_0x46b7a8));}}logger['error']('message\x20is\x20empty');return _0x276a57(_0x5ef292[_0x7497('0x33')](0x1f4,_0x7497('0x45')));});},'RejectMessage':function(_0x221ca4){var _0x2e02ae=this;return new Promise(function(_0x184fd1,_0x165322){if(_0x221ca4[_0x7497('0x3d')]&&_0x221ca4[_0x7497('0x3d')]['id']){try{if(_0x20faeb[_0x7497('0x3e')][_0x221ca4[_0x7497('0x3d')]['id']]){_0x20faeb[_0x7497('0x3e')][_0x221ca4[_0x7497('0x3d')]['id']][_0x7497('0x3f')]=![];_0x20faeb[_0x7497('0x3e')][_0x221ca4['agent']['id']]['busyQueue']=undefined;}return _0x184fd1({'code':0xc8,'message':_0x221ca4});}catch(_0x252f8a){logger[_0x7497('0x33')](_0x252f8a[_0x7497('0x3b')]);return _0x165322(_0x2e02ae[_0x7497('0x33')](0x1f4,_0x252f8a));}}logger['error'](_0x7497('0x45'));return _0x165322(_0x2e02ae[_0x7497('0x33')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x249723){var _0x143b0f=this;return new Promise(function(_0x5a0404,_0x833bee){if(_0x249723[_0x7497('0x15')]&&_0x249723[_0x7497('0x17')]&&_0x249723[_0x7497('0x17')]['id']){try{var _0x203c2d=getId(_0x249723['channel'],_0x249723[_0x7497('0x16')]?_0x249723['message']['id']:0x0,_0x249723[_0x7497('0x17')]?_0x249723[_0x7497('0x17')]['id']:0x0);if(_0x20faeb['rules'][_0x203c2d]){_0x20faeb[_0x7497('0x38')][_0x203c2d]['emit'](_0x7497('0x41'));}return _0x5a0404({'code':0xc8,'message':_0x249723});}catch(_0x572e76){logger[_0x7497('0x33')](_0x572e76[_0x7497('0x3b')]);return _0x833bee(_0x143b0f[_0x7497('0x33')](0x1f4,_0x572e76));}}logger[_0x7497('0x33')](_0x7497('0x45'));return _0x833bee(_0x143b0f[_0x7497('0x33')](0x1f4,_0x7497('0x45')));});},'AgentCapacity':function(_0x77a3ac){var _0x2bdaf3=this;return new Promise(function(_0x311842,_0x1c163c){if(_0x20faeb[_0x7497('0x3e')][_0x7497('0x46')](_0x77a3ac['id'])){for(var _0x235cf1 in _0x77a3ac[_0x7497('0x47')]){if(_0x77a3ac['capacity'][_0x7497('0x46')](_0x235cf1)){if(_0x20faeb[_0x7497('0x3e')][_0x77a3ac['id']][_0x7497('0x46')](_0x235cf1+_0x7497('0x48'))){_0x20faeb[_0x7497('0x3e')][_0x77a3ac['id']][_0x235cf1+_0x7497('0x48')]=parseInt(_0x77a3ac['capacity'][_0x235cf1],0xa);}}}_0x20faeb['agents'][_0x77a3ac['id']][_0x7497('0x49')]();return _0x311842({'code':0xc8,'message':_0x20faeb[_0x7497('0x3e')][_0x77a3ac['id']]});}else{return _0x1c163c(_0x2bdaf3[_0x7497('0x33')](0x1f4,_0x7497('0x4a')));}});},'Agents':function(_0x2d337d){return new Promise(function(_0x175923,_0x6a418){var _0x2b1c9a=_['values'](_0x20faeb[_0x7497('0x3e')]);_0x175923({'count':_0x2b1c9a['length'],'rows':_0x2b1c9a});});},'ChatQueues':function(_0x78c694){return new Promise(function(_0x31f6e2,_0x7343c6){var _0x535281=[];for(var _0x7ce766 in _0x20faeb[_0x7497('0x4b')]){if(_0x20faeb[_0x7497('0x4b')]['hasOwnProperty'](_0x7ce766)){var _0x338c54=_0x20faeb[_0x7497('0x4b')][_0x7ce766];var _0x51e80b={'id':_0x338c54['id'],'available':_0x338c54[_0x7497('0x4c')],'loggedIn':_0x338c54[_0x7497('0x4d')],'name':_0x338c54['name'],'paused':_0x338c54['paused'],'waiting':_0x338c54['waiting']};_0x535281[_0x7497('0x24')](_0x51e80b);}}_0x31f6e2({'count':_0x535281['length'],'rows':_0x535281});});},'MailQueues':function(_0x203156){return new Promise(function(_0x295bb6,_0x1131fe){var _0x35e0ea=[];for(var _0x427d36 in _0x20faeb['mailQueues']){if(_0x20faeb[_0x7497('0x4e')][_0x7497('0x46')](_0x427d36)){var _0x24b479=_0x20faeb[_0x7497('0x4e')][_0x427d36];var _0x4a7294={'id':_0x24b479['id'],'available':_0x24b479[_0x7497('0x4c')],'loggedIn':_0x24b479[_0x7497('0x4d')],'name':_0x24b479[_0x7497('0x4f')],'paused':_0x24b479[_0x7497('0x50')],'waiting':_0x24b479[_0x7497('0x51')]};_0x35e0ea[_0x7497('0x24')](_0x4a7294);}}_0x295bb6({'count':_0x35e0ea[_0x7497('0x1a')],'rows':_0x35e0ea});});},'OpenchannelQueues':function(_0x2a04a3){return new Promise(function(_0x38b504,_0x1d4609){var _0x3922c6=[];for(var _0x96713b in _0x20faeb['openchannelQueues']){if(_0x20faeb[_0x7497('0x52')]['hasOwnProperty'](_0x96713b)){var _0x1c4c5d=_0x20faeb[_0x7497('0x52')][_0x96713b];var _0x57c12d={'id':_0x1c4c5d['id'],'available':_0x1c4c5d[_0x7497('0x4c')],'loggedIn':_0x1c4c5d[_0x7497('0x4d')],'name':_0x1c4c5d[_0x7497('0x4f')],'paused':_0x1c4c5d[_0x7497('0x50')],'waiting':_0x1c4c5d[_0x7497('0x51')]};_0x3922c6[_0x7497('0x24')](_0x57c12d);}}_0x38b504({'count':_0x3922c6[_0x7497('0x1a')],'rows':_0x3922c6});});},'SmsQueues':function(_0x381bc4){return new Promise(function(_0x4193eb,_0x5131cb){var _0x263ea2=[];for(var _0x15c20a in _0x20faeb['smsQueues']){if(_0x20faeb['smsQueues']['hasOwnProperty'](_0x15c20a)){var _0x3d649a=_0x20faeb[_0x7497('0x53')][_0x15c20a];var _0x34361b={'id':_0x3d649a['id'],'available':_0x3d649a['available'],'loggedIn':_0x3d649a['loggedIn'],'name':_0x3d649a[_0x7497('0x4f')],'paused':_0x3d649a[_0x7497('0x50')],'waiting':_0x3d649a[_0x7497('0x51')]};_0x263ea2[_0x7497('0x24')](_0x34361b);}}_0x4193eb({'count':_0x263ea2['length'],'rows':_0x263ea2});});},'FaxQueues':function(_0x1c9071){return new Promise(function(_0x295879,_0x598d8d){var _0xe581f4=[];for(var _0x71a999 in _0x20faeb[_0x7497('0x54')]){if(_0x20faeb[_0x7497('0x54')][_0x7497('0x46')](_0x71a999)){var _0xa06461=_0x20faeb[_0x7497('0x54')][_0x71a999];var _0x2886a0={'id':_0xa06461['id'],'available':_0xa06461[_0x7497('0x4c')],'loggedIn':_0xa06461[_0x7497('0x4d')],'name':_0xa06461[_0x7497('0x4f')],'paused':_0xa06461['paused'],'waiting':_0xa06461[_0x7497('0x51')]};_0xe581f4[_0x7497('0x24')](_0x2886a0);}}_0x295879({'count':_0xe581f4[_0x7497('0x1a')],'rows':_0xe581f4});});},'WhatsappQueues':function(_0x40efb1){return new Promise(function(_0x7c7ef6,_0x4bfe68){var _0x4ad794=[];for(var _0x2d5d82 in _0x20faeb[_0x7497('0x55')]){if(_0x20faeb[_0x7497('0x55')]['hasOwnProperty'](_0x2d5d82)){var _0x38ea66=_0x20faeb[_0x7497('0x55')][_0x2d5d82];var _0x489d8d={'id':_0x38ea66['id'],'available':_0x38ea66[_0x7497('0x4c')],'loggedIn':_0x38ea66[_0x7497('0x4d')],'name':_0x38ea66[_0x7497('0x4f')],'paused':_0x38ea66[_0x7497('0x50')],'waiting':_0x38ea66['waiting']};_0x4ad794[_0x7497('0x24')](_0x489d8d);}}_0x7c7ef6({'count':_0x4ad794[_0x7497('0x1a')],'rows':_0x4ad794});});},'ChatQueuesWaitingInteractions':function(_0x3c5dfc){return new Promise(function(_0x307a41,_0x985ec3){var _0x3b9a8e=_[_0x7497('0x56')](_0x20faeb[_0x7497('0x57')]);_0x307a41({'count':_0x3b9a8e['length'],'rows':_0x3b9a8e});});},'MailQueuesWaitingInteractions':function(_0x4761be){return new Promise(function(_0x1fe72b,_0x33efb2){var _0x32ac3e=_['values'](_0x20faeb[_0x7497('0x58')]);_0x1fe72b({'count':_0x32ac3e['length'],'rows':_0x32ac3e});});},'OpenchannelQueuesWaitingInteractions':function(_0x2acffd){return new Promise(function(_0x164dff,_0x1fd5d0){var _0xc6147d=_['values'](_0x20faeb[_0x7497('0x59')]);_0x164dff({'count':_0xc6147d['length'],'rows':_0xc6147d});});},'SmsQueuesWaitingInteractions':function(_0x1eaecd){return new Promise(function(_0x26205f,_0x32d0ee){var _0x9ebc80=_[_0x7497('0x56')](_0x20faeb[_0x7497('0x5a')]);_0x26205f({'count':_0x9ebc80[_0x7497('0x1a')],'rows':_0x9ebc80});});},'FaxQueuesWaitingInteractions':function(_0x3626e2){return new Promise(function(_0x415448,_0x15c9da){var _0x103c9e=_[_0x7497('0x56')](_0x20faeb['faxQueuesWaitingInteractions']);_0x415448({'count':_0x103c9e['length'],'rows':_0x103c9e});});},'WhatsappQueuesWaitingInteractions':function(_0x1489c4){return new Promise(function(_0x3ef491,_0x517ed7){var _0x3c9c88=_[_0x7497('0x56')](_0x20faeb[_0x7497('0x5b')]);_0x3ef491({'count':_0x3c9c88[_0x7497('0x1a')],'rows':_0x3c9c88});});}};var _0x573afe=jayson[_0x7497('0x5c')](_0x230d7c)['http']();_0x573afe['on'](_0x7497('0x33'),function(_0x16134a){logger[_0x7497('0x33')](JSON[_0x7497('0x36')](_0x16134a));return _0x55521f(_0x16134a);});_0x573afe[_0x7497('0x14')](0x232c,'127.0.0.1',function(){console[_0x7497('0x5d')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x454656(_0x7497('0x5e')+0x232c);});});}; \ No newline at end of file +var _0xe8c6=['../rpc/smsQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','IntervalId','isNil','Intervals','interval','listen','rules','message','interaction','applications','length','existsSync','join','.js','autoreply','appdata','split','mail','push','slice','dialogflow','dialogflowv2','amazonlex','tag','%s:%s:%s','condition','./applications/','app','consequence','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','execute','info','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busyQueue','channel','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','paused','waiting','mailQueues','name','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport'];(function(_0x1dfb5c,_0x2b1e32){var _0x2cfccf=function(_0x5304d9){while(--_0x5304d9){_0x1dfb5c['push'](_0x1dfb5c['shift']());}};_0x2cfccf(++_0x2b1e32);}(_0xe8c6,0x167));var _0x6e8c=function(_0x129bb5,_0x124c38){_0x129bb5=_0x129bb5-0x0;var _0x146301=_0xe8c6[_0x129bb5];return _0x146301;};'use strict';var _=require(_0x6e8c('0x0'));var util=require(_0x6e8c('0x1'));var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x6e8c('0x2'));var uuid=require(_0x6e8c('0x3'));var config=require(_0x6e8c('0x4'));var logger=require(_0x6e8c('0x5'))(_0x6e8c('0x6'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x6e8c('0x7')),'chatQueueReport':require(_0x6e8c('0x8')),'smsQueueReport':require(_0x6e8c('0x9')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x6e8c('0xa'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x490c40,_0x4ce1ca,_0xdad8e4){return util[_0x6e8c('0xb')](_0x6e8c('0xc'),_0x490c40,_0x4ce1ca||0x0,_0xdad8e4||0x0);}function getIntervals(_0x13b796,_0x3e627f){var _0x756a71=[];if(!_['isNil'](_0x3e627f[_0x6e8c('0xd')])&&!_[_0x6e8c('0xe')](_0x13b796[_0x3e627f['IntervalId']])&&!_[_0x6e8c('0xe')](_0x13b796[_0x3e627f[_0x6e8c('0xd')]][_0x6e8c('0xf')])){_0x756a71=_['map'](_0x13b796[_0x3e627f[_0x6e8c('0xd')]][_0x6e8c('0xf')],'interval');}else if(!_['isNil'](_0x3e627f[_0x6e8c('0x10')])){_0x756a71=[_0x3e627f[_0x6e8c('0x10')]];}return _0x756a71;}exports[_0x6e8c('0x11')]=function(_0x279c45){_0x279c45[_0x6e8c('0x12')]={};return new BPromise(function(_0x52e52d,_0x31e36f){var _0x16b64b={'Start':function(_0x2793b9){var _0x3556e4=this;return new Promise(function(_0x4148f1,_0xd44f22){if(_0x2793b9){try{var _0x4a9368=[];var _0xc297db=getId(_0x2793b9['channel'],_0x2793b9[_0x6e8c('0x13')]?_0x2793b9[_0x6e8c('0x13')]['id']:0x0,_0x2793b9[_0x6e8c('0x14')]?_0x2793b9['interaction']['id']:0x0);if(_0x2793b9[_0x6e8c('0x15')]&&_['isArray'](_0x2793b9[_0x6e8c('0x15')])&&_0x2793b9[_0x6e8c('0x15')]['length']){for(var _0x24681c=0x0;_0x24681c<_0x2793b9[_0x6e8c('0x15')][_0x6e8c('0x16')];_0x24681c+=0x1){var _0x640052=_0x2793b9[_0x6e8c('0x15')][_0x24681c];if(fs[_0x6e8c('0x17')](path[_0x6e8c('0x18')](__dirname,_0x6e8c('0x15'),_0x640052['app']+_0x6e8c('0x19')))){var _0x57ce6c=[];switch(_0x640052['app']['toLowerCase']()){case _0x6e8c('0x1a'):var _0x485e8f=_0x640052[_0x6e8c('0x1b')][_0x6e8c('0x1c')](',');if(_0x2793b9['channel']===_0x6e8c('0x1d')){_0x57ce6c['push'](_0x485e8f[0x0]);_0x57ce6c['push'](_0x485e8f[0x1]);_0x57ce6c[_0x6e8c('0x1e')](_0x485e8f[_0x6e8c('0x1f')](0x2,_0x485e8f[_0x6e8c('0x16')])[_0x6e8c('0x18')](','));}else{_0x57ce6c[_0x6e8c('0x1e')](_0x485e8f[0x0]);_0x57ce6c[_0x6e8c('0x1e')](_0x485e8f['slice'](0x1,_0x485e8f[_0x6e8c('0x16')])[_0x6e8c('0x18')](','));}break;case _0x6e8c('0x20'):var _0x2ab677=_0x640052[_0x6e8c('0x1b')]['split'](',');_0x57ce6c['push'](_0x2ab677[0x0]);_0x57ce6c[_0x6e8c('0x1e')](_0x2ab677[0x1]);_0x57ce6c[_0x6e8c('0x1e')](_0x2ab677[_0x6e8c('0x1f')](0x2,_0x2ab677[_0x6e8c('0x16')])[_0x6e8c('0x18')](','));break;case _0x6e8c('0x21'):var _0xd10d93=_0x640052[_0x6e8c('0x1b')][_0x6e8c('0x1c')](',');_0x57ce6c[_0x6e8c('0x1e')](_0xd10d93[0x0]);_0x57ce6c['push'](_0xd10d93[0x1]);_0x57ce6c[_0x6e8c('0x1e')](_0xd10d93[0x2]);_0x57ce6c[_0x6e8c('0x1e')](_0xd10d93[0x3]);_0x57ce6c['push'](_0xd10d93['slice'](0x4,_0xd10d93['length'])[_0x6e8c('0x18')](','));break;case _0x6e8c('0x22'):var _0x3f5536=_0x640052[_0x6e8c('0x1b')][_0x6e8c('0x1c')](',');_0x57ce6c[_0x6e8c('0x1e')](_0x3f5536[0x0]);_0x57ce6c[_0x6e8c('0x1e')](_0x3f5536[0x1]);_0x57ce6c[_0x6e8c('0x1e')](_0x3f5536[0x2]);_0x57ce6c[_0x6e8c('0x1e')](_0x3f5536[0x3]);_0x57ce6c[_0x6e8c('0x1e')](_0x3f5536[_0x6e8c('0x1f')](0x4,_0x3f5536[_0x6e8c('0x16')])[_0x6e8c('0x18')](','));break;case'message':_0x57ce6c[_0x6e8c('0x1e')](_0x640052[_0x6e8c('0x1b')]);break;case _0x6e8c('0x23'):_0x57ce6c[_0x6e8c('0x1e')](_0x640052['TagId']);_0x57ce6c[_0x6e8c('0x1e')](_0x640052[_0x6e8c('0x1b')]);break;default:_0x57ce6c=_[_0x6e8c('0xe')](_0x640052[_0x6e8c('0x1b')])?[]:_0x640052[_0x6e8c('0x1b')][_0x6e8c('0x1c')](',');}var _0x24d1bf={'id':util[_0x6e8c('0xb')](_0x6e8c('0x24'),_0xc297db,_0x640052['id'],_0x640052['app']),'condition':require('./interval')[_0x6e8c('0x25')](_0xc297db,getIntervals(_0x279c45['intervals'],_0x640052),_0x279c45),'consequence':require(_0x6e8c('0x26')+_0x640052[_0x6e8c('0x27')])[_0x6e8c('0x28')](_0xc297db,_0x57ce6c,_0x279c45,_0x2793b9),'p':_0x640052['priority']||0x0};logger['info'](_0x6e8c('0x29'),_0x24d1bf['id'],_0x6e8c('0x2a'),getIntervals(_0x279c45[_0x6e8c('0x2b')],_0x640052)[_0x6e8c('0x18')](_0x6e8c('0x2c')));_0x4a9368[_0x6e8c('0x1e')](_0x24d1bf);}else{logger[_0x6e8c('0x2d')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x6e8c('0x18')](__dirname,_0x6e8c('0x15'),_0x640052[_0x6e8c('0x27')]+'.js'));}}_0x279c45[_0x6e8c('0x12')][_0xc297db]=new RuleEngine(_0x4a9368);_0x279c45[_0x6e8c('0x12')][_0xc297db][_0x6e8c('0x2e')](_0x2793b9,function(_0x30fed2){logger[_0x6e8c('0x2f')](_0x6e8c('0x30'),JSON[_0x6e8c('0x31')](_0x30fed2[_0x6e8c('0x32')]));if(_0x279c45[_0x6e8c('0x12')][_0xc297db]){_0x279c45[_0x6e8c('0x12')][_0xc297db][_0x6e8c('0x33')](_0x6e8c('0x34'));}});return _0x4148f1({'code':0xc8,'message':_0x2793b9});}else{logger[_0x6e8c('0x2f')](_0x6e8c('0x35'));return _0x4148f1({'code':0xc8,'message':_0x2793b9});}}catch(_0x29ab4a){logger['error'](_0x29ab4a[_0x6e8c('0x36')]);return _0xd44f22(_0x3556e4[_0x6e8c('0x2d')](0x1f4,_0x29ab4a));}}return _0xd44f22(_0x6e8c('0x37'));});},'AcceptMessage':function(_0x280813){var _0x56e101=this;return new Promise(function(_0x2d7f7f,_0x467d68){if(_0x280813[_0x6e8c('0x38')]&&_0x280813['agent']['id']){if(_0x279c45[_0x6e8c('0x39')][_0x280813['agent']['id']]){_0x279c45[_0x6e8c('0x39')][_0x280813[_0x6e8c('0x38')]['id']]['busy']=![];_0x279c45[_0x6e8c('0x39')][_0x280813[_0x6e8c('0x38')]['id']][_0x6e8c('0x3a')]=undefined;}}if(_0x280813[_0x6e8c('0x13')]&&_0x280813[_0x6e8c('0x13')]['id']){try{var _0x3722db=getId(_0x280813[_0x6e8c('0x3b')],_0x280813['message']?_0x280813[_0x6e8c('0x13')]['id']:0x0,_0x280813[_0x6e8c('0x14')]?_0x280813[_0x6e8c('0x14')]['id']:0x0);if(_0x279c45[_0x6e8c('0x12')][_0x3722db]){_0x279c45[_0x6e8c('0x12')][_0x3722db][_0x6e8c('0x33')](_0x6e8c('0x3c'));if(rpc[_0x280813[_0x6e8c('0x3b')]+_0x6e8c('0x3d')]){rpc[_0x280813['channel']+_0x6e8c('0x3d')][_0x6e8c('0x3e')](_0x3722db,{'UserId':_0x280813[_0x6e8c('0x13')][_0x6e8c('0x3f')]})[_0x6e8c('0x40')](function(_0x58eb7e){logger[_0x6e8c('0x2d')](_0x6e8c('0x41'));});}}return _0x2d7f7f({'code':0xc8,'message':_0x280813});}catch(_0x5f7e4a){logger[_0x6e8c('0x2d')](_0x5f7e4a[_0x6e8c('0x36')]);return _0x467d68(_0x56e101[_0x6e8c('0x2d')](0x1f4,_0x5f7e4a));}}logger[_0x6e8c('0x2d')](_0x6e8c('0x42'));return _0x467d68(_0x56e101[_0x6e8c('0x2d')](0x1f4,_0x6e8c('0x42')));});},'RejectMessage':function(_0xd47389){var _0xd6d03c=this;return new Promise(function(_0x2eef8a,_0x32ed8c){if(_0xd47389[_0x6e8c('0x38')]&&_0xd47389[_0x6e8c('0x38')]['id']){try{if(_0x279c45[_0x6e8c('0x39')][_0xd47389[_0x6e8c('0x38')]['id']]){_0x279c45[_0x6e8c('0x39')][_0xd47389[_0x6e8c('0x38')]['id']][_0x6e8c('0x43')]=![];_0x279c45[_0x6e8c('0x39')][_0xd47389[_0x6e8c('0x38')]['id']][_0x6e8c('0x3a')]=undefined;}return _0x2eef8a({'code':0xc8,'message':_0xd47389});}catch(_0x2a1c23){logger[_0x6e8c('0x2d')](_0x2a1c23[_0x6e8c('0x36')]);return _0x32ed8c(_0xd6d03c[_0x6e8c('0x2d')](0x1f4,_0x2a1c23));}}logger[_0x6e8c('0x2d')](_0x6e8c('0x42'));return _0x32ed8c(_0xd6d03c[_0x6e8c('0x2d')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x39cc63){var _0x2c8083=this;return new Promise(function(_0x16a011,_0x285482){if(_0x39cc63['channel']&&_0x39cc63[_0x6e8c('0x14')]&&_0x39cc63[_0x6e8c('0x14')]['id']){try{var _0x46b37d=getId(_0x39cc63[_0x6e8c('0x3b')],_0x39cc63['message']?_0x39cc63[_0x6e8c('0x13')]['id']:0x0,_0x39cc63['interaction']?_0x39cc63[_0x6e8c('0x14')]['id']:0x0);if(_0x279c45[_0x6e8c('0x12')][_0x46b37d]){_0x279c45[_0x6e8c('0x12')][_0x46b37d]['emit']('end');}return _0x16a011({'code':0xc8,'message':_0x39cc63});}catch(_0x5d2786){logger['error'](_0x5d2786[_0x6e8c('0x36')]);return _0x285482(_0x2c8083[_0x6e8c('0x2d')](0x1f4,_0x5d2786));}}logger[_0x6e8c('0x2d')](_0x6e8c('0x42'));return _0x285482(_0x2c8083['error'](0x1f4,_0x6e8c('0x42')));});},'AgentCapacity':function(_0x178dd4){var _0x240f3d=this;return new Promise(function(_0x11d791,_0x3891cf){if(_0x279c45['agents']['hasOwnProperty'](_0x178dd4['id'])){for(var _0x4c24c2 in _0x178dd4[_0x6e8c('0x44')]){if(_0x178dd4[_0x6e8c('0x44')][_0x6e8c('0x45')](_0x4c24c2)){if(_0x279c45[_0x6e8c('0x39')][_0x178dd4['id']][_0x6e8c('0x45')](_0x4c24c2+'CurrentCapacity')){_0x279c45[_0x6e8c('0x39')][_0x178dd4['id']][_0x4c24c2+_0x6e8c('0x46')]=parseInt(_0x178dd4[_0x6e8c('0x44')][_0x4c24c2],0xa);}}}_0x279c45[_0x6e8c('0x39')][_0x178dd4['id']][_0x6e8c('0x47')]();return _0x11d791({'code':0xc8,'message':_0x279c45[_0x6e8c('0x39')][_0x178dd4['id']]});}else{return _0x3891cf(_0x240f3d[_0x6e8c('0x2d')](0x1f4,_0x6e8c('0x48')));}});},'Agents':function(_0x472979){return new Promise(function(_0x38b60a,_0x480000){var _0x4d877c=_[_0x6e8c('0x49')](_0x279c45['agents']);_0x38b60a({'count':_0x4d877c[_0x6e8c('0x16')],'rows':_0x4d877c});});},'ChatQueues':function(_0x2667d0){return new Promise(function(_0x11431f,_0xb94e41){var _0x3d3056=[];for(var _0x39f178 in _0x279c45[_0x6e8c('0x4a')]){if(_0x279c45[_0x6e8c('0x4a')][_0x6e8c('0x45')](_0x39f178)){var _0x5e9a06=_0x279c45[_0x6e8c('0x4a')][_0x39f178];var _0x177f83={'id':_0x5e9a06['id'],'available':_0x5e9a06[_0x6e8c('0x4b')],'loggedIn':_0x5e9a06[_0x6e8c('0x4c')],'name':_0x5e9a06['name'],'paused':_0x5e9a06[_0x6e8c('0x4d')],'waiting':_0x5e9a06[_0x6e8c('0x4e')]};_0x3d3056[_0x6e8c('0x1e')](_0x177f83);}}_0x11431f({'count':_0x3d3056['length'],'rows':_0x3d3056});});},'MailQueues':function(_0xa76628){return new Promise(function(_0x35956a,_0x12eea4){var _0x47029b=[];for(var _0x34ddcf in _0x279c45[_0x6e8c('0x4f')]){if(_0x279c45[_0x6e8c('0x4f')]['hasOwnProperty'](_0x34ddcf)){var _0x2d4a27=_0x279c45[_0x6e8c('0x4f')][_0x34ddcf];var _0x5a0e5e={'id':_0x2d4a27['id'],'available':_0x2d4a27[_0x6e8c('0x4b')],'loggedIn':_0x2d4a27[_0x6e8c('0x4c')],'name':_0x2d4a27[_0x6e8c('0x50')],'paused':_0x2d4a27[_0x6e8c('0x4d')],'waiting':_0x2d4a27['waiting']};_0x47029b['push'](_0x5a0e5e);}}_0x35956a({'count':_0x47029b[_0x6e8c('0x16')],'rows':_0x47029b});});},'OpenchannelQueues':function(_0x194b07){return new Promise(function(_0x44da6,_0x2bb742){var _0x5affb6=[];for(var _0x5d5f95 in _0x279c45['openchannelQueues']){if(_0x279c45[_0x6e8c('0x51')][_0x6e8c('0x45')](_0x5d5f95)){var _0x8f17b6=_0x279c45[_0x6e8c('0x51')][_0x5d5f95];var _0xc572d0={'id':_0x8f17b6['id'],'available':_0x8f17b6[_0x6e8c('0x4b')],'loggedIn':_0x8f17b6[_0x6e8c('0x4c')],'name':_0x8f17b6[_0x6e8c('0x50')],'paused':_0x8f17b6[_0x6e8c('0x4d')],'waiting':_0x8f17b6[_0x6e8c('0x4e')]};_0x5affb6[_0x6e8c('0x1e')](_0xc572d0);}}_0x44da6({'count':_0x5affb6['length'],'rows':_0x5affb6});});},'SmsQueues':function(_0x16543f){return new Promise(function(_0x40ce91,_0x4421bf){var _0x41cafc=[];for(var _0x5d7fc8 in _0x279c45[_0x6e8c('0x52')]){if(_0x279c45['smsQueues'][_0x6e8c('0x45')](_0x5d7fc8)){var _0x142e3d=_0x279c45[_0x6e8c('0x52')][_0x5d7fc8];var _0x2ef79a={'id':_0x142e3d['id'],'available':_0x142e3d['available'],'loggedIn':_0x142e3d[_0x6e8c('0x4c')],'name':_0x142e3d[_0x6e8c('0x50')],'paused':_0x142e3d[_0x6e8c('0x4d')],'waiting':_0x142e3d[_0x6e8c('0x4e')]};_0x41cafc[_0x6e8c('0x1e')](_0x2ef79a);}}_0x40ce91({'count':_0x41cafc[_0x6e8c('0x16')],'rows':_0x41cafc});});},'FaxQueues':function(_0x34b4b0){return new Promise(function(_0x2ed67c,_0x1afe09){var _0x4672a3=[];for(var _0x3ae6a6 in _0x279c45[_0x6e8c('0x53')]){if(_0x279c45[_0x6e8c('0x53')][_0x6e8c('0x45')](_0x3ae6a6)){var _0x463aaf=_0x279c45[_0x6e8c('0x53')][_0x3ae6a6];var _0x20b7a1={'id':_0x463aaf['id'],'available':_0x463aaf['available'],'loggedIn':_0x463aaf[_0x6e8c('0x4c')],'name':_0x463aaf[_0x6e8c('0x50')],'paused':_0x463aaf['paused'],'waiting':_0x463aaf[_0x6e8c('0x4e')]};_0x4672a3[_0x6e8c('0x1e')](_0x20b7a1);}}_0x2ed67c({'count':_0x4672a3['length'],'rows':_0x4672a3});});},'WhatsappQueues':function(_0x48244e){return new Promise(function(_0x33c80b,_0x558554){var _0x4a615b=[];for(var _0x35e843 in _0x279c45[_0x6e8c('0x54')]){if(_0x279c45['whatsappQueues'][_0x6e8c('0x45')](_0x35e843)){var _0x1ca7ff=_0x279c45[_0x6e8c('0x54')][_0x35e843];var _0x21e431={'id':_0x1ca7ff['id'],'available':_0x1ca7ff['available'],'loggedIn':_0x1ca7ff['loggedIn'],'name':_0x1ca7ff['name'],'paused':_0x1ca7ff[_0x6e8c('0x4d')],'waiting':_0x1ca7ff['waiting']};_0x4a615b[_0x6e8c('0x1e')](_0x21e431);}}_0x33c80b({'count':_0x4a615b[_0x6e8c('0x16')],'rows':_0x4a615b});});},'ChatQueuesWaitingInteractions':function(_0x44f9da){return new Promise(function(_0x5f4a65,_0x4d6ee7){var _0x1ec778=_[_0x6e8c('0x49')](_0x279c45[_0x6e8c('0x55')]);_0x5f4a65({'count':_0x1ec778[_0x6e8c('0x16')],'rows':_0x1ec778});});},'MailQueuesWaitingInteractions':function(_0x24252d){return new Promise(function(_0x858ba0,_0x4f1195){var _0x3c22cb=_[_0x6e8c('0x49')](_0x279c45['mailQueuesWaitingInteractions']);_0x858ba0({'count':_0x3c22cb[_0x6e8c('0x16')],'rows':_0x3c22cb});});},'OpenchannelQueuesWaitingInteractions':function(_0x41ed56){return new Promise(function(_0x1202e5,_0x4076e7){var _0x4b2c93=_[_0x6e8c('0x49')](_0x279c45['openchannelQueuesWaitingInteractions']);_0x1202e5({'count':_0x4b2c93[_0x6e8c('0x16')],'rows':_0x4b2c93});});},'SmsQueuesWaitingInteractions':function(_0x2cd2c9){return new Promise(function(_0xc6c20,_0x30fdac){var _0x433127=_[_0x6e8c('0x49')](_0x279c45[_0x6e8c('0x56')]);_0xc6c20({'count':_0x433127[_0x6e8c('0x16')],'rows':_0x433127});});},'FaxQueuesWaitingInteractions':function(_0x5a2c8e){return new Promise(function(_0x155301,_0x1081f6){var _0x511abd=_[_0x6e8c('0x49')](_0x279c45['faxQueuesWaitingInteractions']);_0x155301({'count':_0x511abd[_0x6e8c('0x16')],'rows':_0x511abd});});},'WhatsappQueuesWaitingInteractions':function(_0xa00100){return new Promise(function(_0x30b040,_0x2ab6e8){var _0x4d6c31=_['values'](_0x279c45[_0x6e8c('0x57')]);_0x30b040({'count':_0x4d6c31[_0x6e8c('0x16')],'rows':_0x4d6c31});});}};var _0x4c2f8=jayson['server'](_0x16b64b)[_0x6e8c('0x58')]();_0x4c2f8['on']('error',function(_0x282903){logger[_0x6e8c('0x2d')](JSON[_0x6e8c('0x31')](_0x282903));return _0x31e36f(_0x282903);});_0x4c2f8['listen'](0x232c,_0x6e8c('0x59'),function(){console[_0x6e8c('0x5a')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x52e52d(_0x6e8c('0x5b')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index cf210db..19d61b5 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 _0xb16c=['true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','log','stack','util','jayson/promise','lodash','../../../config/logger','routing','http','request','then','error','message','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','format','iftime\x20%s','indexOf'];(function(_0x10c201,_0x2111a6){var _0x3c7576=function(_0x2aa6e1){while(--_0x2aa6e1){_0x10c201['push'](_0x10c201['shift']());}};_0x3c7576(++_0x2111a6);}(_0xb16c,0x8e));var _0xcb16=function(_0x1c9649,_0x1da993){_0x1c9649=_0x1c9649-0x0;var _0x248718=_0xb16c[_0x1c9649];return _0x248718;};'use strict';var util=require(_0xcb16('0x0'));var BPromise=require('bluebird');var jayson=require(_0xcb16('0x1'));var _=require(_0xcb16('0x2'));var logger=require(_0xcb16('0x3'))(_0xcb16('0x4'));var client=jayson['client'][_0xcb16('0x5')]({'port':0x232a});function request(_0x9fbbb0,_0x4dc1df){return new BPromise(function(_0x58fdc7,_0x5e9fa5){return client[_0xcb16('0x6')](_0x9fbbb0,_0x4dc1df)[_0xcb16('0x7')](function(_0x341e7c){if(_0x341e7c[_0xcb16('0x8')]){return _0x5e9fa5(_0x341e7c['error'][_0xcb16('0x9')]);}else{return _0x58fdc7(_0x341e7c['result']);}})[_0xcb16('0xa')](function(_0x508b87){return _0x5e9fa5(_0x508b87);});});}exports[_0xcb16('0xb')]=function(_0x7748bb,_0x5d7e99,_0x4cd8f4){return function(_0x47c93e){if(_0x4cd8f4[_0xcb16('0xc')]&&!_0x4cd8f4['rules'][_0x7748bb]){logger[_0xcb16('0xd')](_0xcb16('0xe'),_0x7748bb);return _0x47c93e[_0xcb16('0xf')]();}var _0x5d0932=[];for(var _0xcca3be=0x0;_0xcca3be<_0x5d7e99['length'];_0xcca3be+=0x1){_0x5d0932[_0xcb16('0x10')](request('Command',{'command':util[_0xcb16('0x11')](_0xcb16('0x12'),_0x5d7e99[_0xcca3be])})[_0xcb16('0x7')](function(_0x486482){return _0x486482&&_0x486482[_0xcb16('0x9')]&&_0x486482['message'][_0xcb16('0x13')](_0xcb16('0x14'))>=0x0?!![]:![];})[_0xcb16('0xa')](function(_0x448e22){logger[_0xcb16('0x8')](_0xcb16('0x15'),_0x7748bb,_0x5d7e99[_0xcca3be]);}));}BPromise[_0xcb16('0x16')](_0x5d0932)['then'](function(_0x475e2f){var _0x12e395=_['some'](_0x475e2f);logger['info'](_0xcb16('0x17'),_0x7748bb,_0x5d7e99[_0xcb16('0x18')]('\x20|\x20'),_0x12e395);_0x47c93e['when'](_0x12e395);})['catch'](function(_0x370044){console[_0xcb16('0x19')](_0x370044);logger[_0xcb16('0x8')](_0xcb16('0x17'),_0x7748bb,_0x5d7e99[_0xcb16('0x18')]('\x20|\x20'),_0x370044[_0xcb16('0x1a')]);_0x47c93e[_0xcb16('0xf')]();});};}; \ No newline at end of file +var _0xc370=['\x20|\x20','when','log','stack','util','bluebird','lodash','../../../config/logger','routing','client','http','request','then','error','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','format','iftime\x20%s','message','indexOf','true','all','[%s][INTERVAL]\x20%s\x20%s','join'];(function(_0x109e1d,_0x4474f0){var _0x549e93=function(_0x214d66){while(--_0x214d66){_0x109e1d['push'](_0x109e1d['shift']());}};_0x549e93(++_0x4474f0);}(_0xc370,0x1d5));var _0x0c37=function(_0x26dd05,_0x135f80){_0x26dd05=_0x26dd05-0x0;var _0x5da547=_0xc370[_0x26dd05];return _0x5da547;};'use strict';var util=require(_0x0c37('0x0'));var BPromise=require(_0x0c37('0x1'));var jayson=require('jayson/promise');var _=require(_0x0c37('0x2'));var logger=require(_0x0c37('0x3'))(_0x0c37('0x4'));var client=jayson[_0x0c37('0x5')][_0x0c37('0x6')]({'port':0x232a});function request(_0x134bc2,_0x4921ab){return new BPromise(function(_0x367279,_0x5e60fc){return client[_0x0c37('0x7')](_0x134bc2,_0x4921ab)[_0x0c37('0x8')](function(_0x544a1d){if(_0x544a1d[_0x0c37('0x9')]){return _0x5e60fc(_0x544a1d[_0x0c37('0x9')]['message']);}else{return _0x367279(_0x544a1d[_0x0c37('0xa')]);}})[_0x0c37('0xb')](function(_0x499fa3){return _0x5e60fc(_0x499fa3);});});}exports[_0x0c37('0xc')]=function(_0x33a036,_0x96a0b0,_0x459fe9){return function(_0x10ee2a){if(_0x459fe9[_0x0c37('0xd')]&&!_0x459fe9[_0x0c37('0xd')][_0x33a036]){logger[_0x0c37('0xe')](_0x0c37('0xf'),_0x33a036);return _0x10ee2a[_0x0c37('0x10')]();}var _0x2c6f41=[];for(var _0x3de85f=0x0;_0x3de85f<_0x96a0b0[_0x0c37('0x11')];_0x3de85f+=0x1){_0x2c6f41[_0x0c37('0x12')](request('Command',{'command':util[_0x0c37('0x13')](_0x0c37('0x14'),_0x96a0b0[_0x3de85f])})[_0x0c37('0x8')](function(_0xdc4406){return _0xdc4406&&_0xdc4406[_0x0c37('0x15')]&&_0xdc4406['message'][_0x0c37('0x16')](_0x0c37('0x17'))>=0x0?!![]:![];})[_0x0c37('0xb')](function(_0x452b7f){logger['error']('[%s][INTERVAL]\x20%s',_0x33a036,_0x96a0b0[_0x3de85f]);}));}BPromise[_0x0c37('0x18')](_0x2c6f41)[_0x0c37('0x8')](function(_0x49a8b5){var _0x19d83a=_['some'](_0x49a8b5);logger[_0x0c37('0xe')](_0x0c37('0x19'),_0x33a036,_0x96a0b0[_0x0c37('0x1a')](_0x0c37('0x1b')),_0x19d83a);_0x10ee2a[_0x0c37('0x1c')](_0x19d83a);})[_0x0c37('0xb')](function(_0xe78866){console[_0x0c37('0x1d')](_0xe78866);logger[_0x0c37('0x9')](_0x0c37('0x19'),_0x33a036,_0x96a0b0[_0x0c37('0x1a')](_0x0c37('0x1b')),_0xe78866[_0x0c37('0x1e')]);_0x10ee2a['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index ee9db69..0eada57 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 _0xe706=['then','type','agentacw','agentcomplete','acw','acwtime','CreateVoiceAgentReport','request','destuniqueid','agentcalled','debug','now','called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','complete','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','transferexten','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','transfertargetuniqueid','agentcalledAt','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName'];(function(_0x41bc73,_0x3844e7){var _0x40278e=function(_0x5f114a){while(--_0x5f114a){_0x41bc73['push'](_0x41bc73['shift']());}};_0x40278e(++_0x3844e7);}(_0xe706,0xa3));var _0x6e70=function(_0x5b9ac9,_0x374422){_0x5b9ac9=_0x5b9ac9-0x0;var _0x7e6db3=_0xe706[_0x5b9ac9];return _0x7e6db3;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var utils=require(_0x6e70('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5e8446,_0x2cae77){utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x5'),_0x5e8446[_0x6e70('0x6')],_0x5e8446[_0x6e70('0x7')],_0x5e8446[_0x6e70('0x8')],_0x5e8446[_0x6e70('0x9')],_0x5e8446[_0x6e70('0xa')],_0x5e8446[_0x6e70('0xb')],_0x5e8446[_0x6e70('0xc')],_0x5e8446[_0x6e70('0xd')]));if(_0x5e8446[_0x6e70('0x8')]){utils[_0x6e70('0xe')](_0x5e8446[_0x6e70('0x8')])[_0x6e70('0xf')](function(_0x954545){if(_0x954545){_0x5e8446[_0x6e70('0x10')]=_0x954545[_0x6e70('0x10')];_0x5e8446[_0x6e70('0x11')]=_0x5e8446[_0x6e70('0x12')]?_0x954545[_0x6e70('0x13')]:![];_0x5e8446[_0x6e70('0x14')]=_0x5e8446[_0x6e70('0x11')]?_0x954545['acwTimeout']:0x0;}utils['request'](_0x6e70('0x15'),_0x5e8446);});}else{utils[_0x6e70('0x16')](_0x6e70('0x15'),_0x5e8446);}if(_0x2cae77){delete transfers[_0x5e8446[_0x6e70('0x6')]];}else{delete agents[_0x5e8446[_0x6e70('0x17')]];}}exports[_0x6e70('0x18')]=function(_0xa1eb74){try{utils[_0x6e70('0x19')](util['format']('[%s][agents][agentcalled]',_0xa1eb74['uniqueid']),_0xa1eb74);agents[_0xa1eb74[_0x6e70('0x17')]]=_0xa1eb74;agents[_0xa1eb74['destuniqueid']]['agentcalledAt']=utils[_0x6e70('0x1a')]();agents[_0xa1eb74[_0x6e70('0x17')]]['lastevent']=_0x6e70('0x1b');agents[_0xa1eb74['destuniqueid']][_0x6e70('0xc')]=null;agents[_0xa1eb74[_0x6e70('0x17')]]['connectedlinename']=null;utils['info'](util[_0x6e70('0x4')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0xa1eb74[_0x6e70('0x6')],agents[_0xa1eb74[_0x6e70('0x17')]]['membername'],_0xa1eb74['destuniqueid']));}catch(_0xc238ba){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x1d'),_0xa1eb74[_0x6e70('0x6')]),_0xc238ba);}};exports[_0x6e70('0x1e')]=function(_0x1b2453){try{if(!_[_0x6e70('0x1f')](agents[_0x1b2453[_0x6e70('0x17')]])){utils[_0x6e70('0x19')](util['format'](_0x6e70('0x20'),_0x1b2453[_0x6e70('0x6')]),_0x1b2453);utils[_0x6e70('0x3')](util['format'](_0x6e70('0x21'),_0x1b2453[_0x6e70('0x6')],agents[_0x1b2453[_0x6e70('0x17')]]['membername'],_0x1b2453[_0x6e70('0x17')]));agents[_0x1b2453['destuniqueid']]['agentringnoanswer']=!![];agents[_0x1b2453['destuniqueid']][_0x6e70('0x22')]=utils[_0x6e70('0x1a')]();agents[_0x1b2453['destuniqueid']][_0x6e70('0xd')]=_0x6e70('0x23');agents[_0x1b2453['destuniqueid']][_0x6e70('0x24')]=_0x6e70('0x23');agents[_0x1b2453[_0x6e70('0x17')]]['holdtime']=_0x1b2453['ringtime']?parseInt(_0x1b2453[_0x6e70('0x25')])/0x3e8:0x0;agents[_0x1b2453[_0x6e70('0x17')]][_0x6e70('0x26')]=0x0;unanswered[_0x6e70('0x27')](_0x1b2453[_0x6e70('0x17')]);}}catch(_0x5d772a){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x20'),_0x1b2453[_0x6e70('0x6')]),_0x5d772a);}};exports[_0x6e70('0x28')]=function(_0x20a225){try{_[_0x6e70('0x29')](agents,function(_0x24114a,_0x3a0821){if(_0x24114a[_0x6e70('0x6')]==_0x20a225['uniqueid']&&!_[_0x6e70('0x2a')](unanswered,_0x24114a['destuniqueid'])){utils[_0x6e70('0x19')](util['format'](_0x6e70('0x2b'),_0x20a225[_0x6e70('0x6')]),_0x20a225);utils[_0x6e70('0x3')](util['format'](_0x6e70('0x2c'),_0x20a225[_0x6e70('0x6')],_0x24114a['membername'],_0x24114a[_0x6e70('0x17')]));_0x24114a[_0x6e70('0x1e')]=!![];_0x24114a['agentringnoanswerAt']=utils[_0x6e70('0x1a')]();_0x24114a[_0x6e70('0xd')]=_0x6e70('0x2d');_0x24114a[_0x6e70('0x24')]=_0x6e70('0x2d');_0x24114a[_0x6e70('0x2e')]=_0x20a225[_0x6e70('0x2e')];_0x24114a[_0x6e70('0x26')]=0x0;writeDB(_0x24114a);}});}catch(_0xf146fd){utils[_0x6e70('0x1c')](util['format'](_0x6e70('0x2b'),_0x20a225['uniqueid']),_0xf146fd);}};exports[_0x6e70('0x2f')]=function(_0x3222a2){try{if(agents[_0x3222a2[_0x6e70('0x17')]]){utils[_0x6e70('0x19')](util[_0x6e70('0x4')](_0x6e70('0x30'),_0x3222a2[_0x6e70('0x6')]),_0x3222a2);utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x31'),_0x3222a2[_0x6e70('0x6')],agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0x9')],_0x3222a2['destuniqueid']));agents[_0x3222a2['destuniqueid']]['agentconnectAt']=utils[_0x6e70('0x1a')]();agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0xc')]=_0x3222a2[_0x6e70('0xc')];agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0x32')]=_0x3222a2['connectedlinename'];agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0x2e')]=_0x3222a2[_0x6e70('0x25')];agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0xd')]=_0x6e70('0x33');_[_0x6e70('0x29')](agents,function(_0x16fc7d,_0x5be100){if(_0x16fc7d[_0x6e70('0x17')]!=_0x3222a2[_0x6e70('0x17')]&&_0x16fc7d[_0x6e70('0x6')]==_0x3222a2[_0x6e70('0x6')]){_0x16fc7d[_0x6e70('0x26')]=0x0;_0x16fc7d[_0x6e70('0x2e')]=_0x3222a2[_0x6e70('0x25')];_0x16fc7d['agentringnoanswer']=!![];_0x16fc7d['agentringnoanswerAt']=utils['now']();_0x16fc7d[_0x6e70('0xd')]=_0x6e70('0x34');_0x16fc7d[_0x6e70('0x24')]=_0x6e70('0x34');_0x16fc7d[_0x6e70('0x35')]=_0x3222a2['destuniqueid'];_0x16fc7d[_0x6e70('0x36')]=_0x3222a2[_0x6e70('0x9')];writeDB(_0x16fc7d);}});}}catch(_0x2a2aca){utils['error'](util['format']('[%s][agents][agentconnect]',_0x3222a2[_0x6e70('0x6')]),_0x2a2aca);}};exports['agentcomplete']=function(_0x42f49a){try{if(!_[_0x6e70('0x1f')](agents[_0x42f49a[_0x6e70('0x17')]])){utils[_0x6e70('0x19')](util['format'](_0x6e70('0x37'),_0x42f49a['uniqueid']),_0x42f49a);utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x38'),_0x42f49a[_0x6e70('0x6')],agents[_0x42f49a['destuniqueid']][_0x6e70('0x9')],_0x42f49a[_0x6e70('0x17')]));agents[_0x42f49a[_0x6e70('0x17')]][_0x6e70('0x12')]=!![];agents[_0x42f49a[_0x6e70('0x17')]][_0x6e70('0x39')]=utils[_0x6e70('0x1a')]();agents[_0x42f49a['destuniqueid']][_0x6e70('0x26')]=utils[_0x6e70('0x3a')](agents[_0x42f49a[_0x6e70('0x17')]][_0x6e70('0x39')],agents[_0x42f49a[_0x6e70('0x17')]][_0x6e70('0x3b')]);agents[_0x42f49a[_0x6e70('0x17')]]['reason']=_0x42f49a[_0x6e70('0x24')];agents[_0x42f49a['destuniqueid']][_0x6e70('0xd')]=_0x6e70('0x3c');writeDB(agents[_0x42f49a['destuniqueid']]);}}catch(_0x53efc3){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x37'),_0x42f49a['uniqueid']),_0x53efc3);}};exports['blindtransfer']=function(_0x238ebb){try{if(!_[_0x6e70('0x1f')](agents[_0x238ebb[_0x6e70('0x3d')]])){utils[_0x6e70('0x19')](util[_0x6e70('0x4')](_0x6e70('0x3e'),_0x238ebb['uniqueid']),_0x238ebb);utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x3f'),_0x238ebb[_0x6e70('0x6')],agents[_0x238ebb[_0x6e70('0x3d')]]['membername'],agents[_0x238ebb['transfereruniqueid']][_0x6e70('0x6')]));agents[_0x238ebb[_0x6e70('0x3d')]][_0x6e70('0x40')]=!![];agents[_0x238ebb[_0x6e70('0x3d')]][_0x6e70('0x41')]='blind';agents[_0x238ebb[_0x6e70('0x3d')]][_0x6e70('0x42')]=_0x238ebb[_0x6e70('0x43')];agents[_0x238ebb[_0x6e70('0x3d')]][_0x6e70('0x44')]=agents[_0x238ebb['transfereruniqueid']][_0x6e70('0x6')];}}catch(_0x1dd242){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x3e'),_0x238ebb[_0x6e70('0x6')]),_0x1dd242);}};exports['attendedtransfer']=function(_0x40e7c6){try{utils[_0x6e70('0x19')](util['format'](_0x6e70('0x45'),_0x40e7c6[_0x6e70('0x46')]),_0x40e7c6);if(_0x40e7c6['origtransfereruniqueid']==_0x40e7c6[_0x6e70('0x47')]){if(!_[_0x6e70('0x1f')](agents[_0x40e7c6[_0x6e70('0x48')]])){utils[_0x6e70('0x3')](util[_0x6e70('0x4')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x40e7c6[_0x6e70('0x46')],agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x9')]));agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x40')]=!![];agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x41')]=_0x6e70('0x49');agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x42')]=_0x40e7c6[_0x6e70('0x4a')];agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x44')]=_0x40e7c6[_0x6e70('0x46')];}if(_0x40e7c6[_0x6e70('0x4b')]&&agents[_0x40e7c6[_0x6e70('0x4b')]]){agents[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0x4c')]=0x1;transfers[_0x40e7c6[_0x6e70('0x4b')]]=_[_0x6e70('0x4d')](agents[_0x40e7c6['transfereeuniqueid']]);transfers[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0xb')]=agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0xb')];transfers[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0x4e')]=agents[_0x40e7c6['secondtransfereruniqueid']][_0x6e70('0x4e')];transfers[_0x40e7c6[_0x6e70('0x4b')]]['agentcalledAt']=utils[_0x6e70('0x1a')]();transfers[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0x3b')]=utils['now']();transfers[_0x40e7c6['transfereeuniqueid']][_0x6e70('0x2e')]=0x0;transfers[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0x4c')]=0x2;}}else if(_0x40e7c6[_0x6e70('0x48')]==_0x40e7c6[_0x6e70('0x4f')]){if(!_[_0x6e70('0x1f')](agents[_0x40e7c6[_0x6e70('0x46')]])){utils['info'](util['format'](_0x6e70('0x50'),_0x40e7c6[_0x6e70('0x46')],agents[_0x40e7c6[_0x6e70('0x46')]][_0x6e70('0x9')]));agents[_0x40e7c6['origtransfereruniqueid']]['transfer']=!![];agents[_0x40e7c6[_0x6e70('0x46')]][_0x6e70('0x41')]='ATTENDED';agents[_0x40e7c6['origtransfereruniqueid']][_0x6e70('0x42')]=_0x40e7c6['secondtransfererexten'];agents[_0x40e7c6[_0x6e70('0x46')]][_0x6e70('0x44')]=_0x40e7c6[_0x6e70('0x48')];}if(_0x40e7c6[_0x6e70('0x51')]&&agents[_0x40e7c6[_0x6e70('0x51')]]){agents[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0x4c')]=0x1;transfers[_0x40e7c6[_0x6e70('0x51')]]=_['clone'](agents[_0x40e7c6[_0x6e70('0x51')]]);transfers[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0xb')]=agents[_0x40e7c6[_0x6e70('0x46')]][_0x6e70('0xb')];transfers[_0x40e7c6['transfertargetuniqueid']]['calleridname']=agents[_0x40e7c6['origtransfereruniqueid']][_0x6e70('0x4e')];transfers[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0x52')]=utils['now']();transfers[_0x40e7c6['transfertargetuniqueid']][_0x6e70('0x3b')]=utils[_0x6e70('0x1a')]();transfers[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0x2e')]=0x0;transfers[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0x4c')]=0x2;}}}catch(_0x5eb6f0){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x45'),_0x40e7c6[_0x6e70('0x46')]),_0x5eb6f0);}};exports['hangup']=function(_0xce964b){try{utils['debug'](util['format'](_0x6e70('0x53'),_0xce964b[_0x6e70('0x6')]),_0xce964b);if(agents[_0xce964b[_0x6e70('0x6')]]&&agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')]===_0x6e70('0x23')){if(_0xce964b['cause']==='21'){agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')]=_0x6e70('0x54');agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0xd')]=_0x6e70('0x54');}utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x55'),_0xce964b[_0x6e70('0x6')],agents[_0xce964b['uniqueid']][_0x6e70('0x9')],agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')],agents[_0xce964b['uniqueid']]['lastevent']));writeDB(agents[_0xce964b[_0x6e70('0x6')]]);var _0x18ecf0=unanswered[_0x6e70('0x56')](_0xce964b[_0x6e70('0x6')]);if(_0x18ecf0>-0x1){unanswered[_0x6e70('0x57')](_0x18ecf0,0x1);}}if(transfers[_0xce964b['uniqueid']]){transfers[_0xce964b['uniqueid']][_0x6e70('0x12')]=!![];transfers[_0xce964b[_0x6e70('0x6')]]['agentcompleteAt']=utils[_0x6e70('0x1a')]();transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x26')]=utils[_0x6e70('0x3a')](transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x39')],transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x3b')]);transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')]=_0x6e70('0x58');transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0xd')]=_0x6e70('0x3c');utils['info'](util['format'](_0x6e70('0x55'),_0xce964b['uniqueid'],transfers[_0xce964b[_0x6e70('0x6')]]['membername'],transfers[_0xce964b['uniqueid']][_0x6e70('0x24')],transfers[_0xce964b['uniqueid']]['lastevent']));writeDB(transfers[_0xce964b[_0x6e70('0x6')]],!![]);}if(agents[_0xce964b[_0x6e70('0x6')]]&&agents[_0xce964b[_0x6e70('0x6')]]['agentconnectAt']){agents[_0xce964b['uniqueid']]['agentcomplete']=!![];agents[_0xce964b[_0x6e70('0x6')]]['agentcompleteAt']=utils[_0x6e70('0x1a')]();agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x26')]=utils[_0x6e70('0x3a')](agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x39')],agents[_0xce964b[_0x6e70('0x6')]]['agentconnectAt']);agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')]=agents[_0xce964b[_0x6e70('0x6')]]['transfer']?_0x6e70('0x40'):_0x6e70('0x58');agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0xd')]=_0x6e70('0x3c');utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x55'),_0xce964b[_0x6e70('0x6')],agents[_0xce964b['uniqueid']][_0x6e70('0x9')],agents[_0xce964b[_0x6e70('0x6')]]['reason'],agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0xd')]));writeDB(agents[_0xce964b['uniqueid']]);}}catch(_0x596d71){utils[_0x6e70('0x1c')](util['format'](_0x6e70('0x53'),_0xce964b['uniqueid']),_0x596d71);}}; \ No newline at end of file +var _0xbf6e=['[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','calleridnum','connectedlinenum','lastevent','then','type','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','destuniqueid','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','reason','holdtime','talktime','push','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','ringtime','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcomplete','agentcompleteAt','diffTime','complete','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','transferuniqueid','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','ATTENDED','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','agent','[%s][agents][hangup]','./utils','info','format'];(function(_0x3eab2d,_0x4b55b3){var _0x4b45d1=function(_0x104bdb){while(--_0x104bdb){_0x3eab2d['push'](_0x3eab2d['shift']());}};_0x4b45d1(++_0x4b55b3);}(_0xbf6e,0x149));var _0xebf6=function(_0x229066,_0x443063){_0x229066=_0x229066-0x0;var _0xd7c89=_0xbf6e[_0x229066];return _0xd7c89;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xebf6('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x2b658d,_0x14bf01){utils[_0xebf6('0x1')](util[_0xebf6('0x2')](_0xebf6('0x3'),_0x2b658d[_0xebf6('0x4')],_0x2b658d['channel'],_0x2b658d[_0xebf6('0x5')],_0x2b658d[_0xebf6('0x6')],_0x2b658d[_0xebf6('0x7')],_0x2b658d[_0xebf6('0x8')],_0x2b658d[_0xebf6('0x9')],_0x2b658d[_0xebf6('0xa')]));if(_0x2b658d[_0xebf6('0x5')]){utils['getVoiceQueueByName'](_0x2b658d[_0xebf6('0x5')])[_0xebf6('0xb')](function(_0x12ed12){if(_0x12ed12){_0x2b658d['type']=_0x12ed12[_0xebf6('0xc')];_0x2b658d[_0xebf6('0xd')]=_0x2b658d['agentcomplete']?_0x12ed12[_0xebf6('0xe')]:![];_0x2b658d[_0xebf6('0xf')]=_0x2b658d[_0xebf6('0xd')]?_0x12ed12[_0xebf6('0x10')]:0x0;}utils[_0xebf6('0x11')](_0xebf6('0x12'),_0x2b658d);});}else{utils['request'](_0xebf6('0x12'),_0x2b658d);}if(_0x14bf01){delete transfers[_0x2b658d[_0xebf6('0x4')]];}else{delete agents[_0x2b658d['destuniqueid']];}}exports[_0xebf6('0x13')]=function(_0x101a6c){try{utils[_0xebf6('0x14')](util[_0xebf6('0x2')](_0xebf6('0x15'),_0x101a6c['uniqueid']),_0x101a6c);agents[_0x101a6c['destuniqueid']]=_0x101a6c;agents[_0x101a6c['destuniqueid']][_0xebf6('0x16')]=utils[_0xebf6('0x17')]();agents[_0x101a6c['destuniqueid']][_0xebf6('0xa')]=_0xebf6('0x18');agents[_0x101a6c[_0xebf6('0x19')]][_0xebf6('0x9')]=null;agents[_0x101a6c[_0xebf6('0x19')]][_0xebf6('0x1a')]=null;utils[_0xebf6('0x1')](util[_0xebf6('0x2')](_0xebf6('0x1b'),_0x101a6c[_0xebf6('0x4')],agents[_0x101a6c['destuniqueid']]['membername'],_0x101a6c[_0xebf6('0x19')]));}catch(_0x38c9e3){utils[_0xebf6('0x1c')](util[_0xebf6('0x2')](_0xebf6('0x15'),_0x101a6c[_0xebf6('0x4')]),_0x38c9e3);}};exports[_0xebf6('0x1d')]=function(_0x80f523){try{if(!_['isNil'](agents[_0x80f523[_0xebf6('0x19')]])){utils[_0xebf6('0x14')](util[_0xebf6('0x2')](_0xebf6('0x1e'),_0x80f523[_0xebf6('0x4')]),_0x80f523);utils[_0xebf6('0x1')](util[_0xebf6('0x2')](_0xebf6('0x1f'),_0x80f523[_0xebf6('0x4')],agents[_0x80f523[_0xebf6('0x19')]][_0xebf6('0x6')],_0x80f523[_0xebf6('0x19')]));agents[_0x80f523[_0xebf6('0x19')]][_0xebf6('0x1d')]=!![];agents[_0x80f523[_0xebf6('0x19')]][_0xebf6('0x20')]=utils[_0xebf6('0x17')]();agents[_0x80f523[_0xebf6('0x19')]][_0xebf6('0xa')]='timeout';agents[_0x80f523['destuniqueid']][_0xebf6('0x21')]='timeout';agents[_0x80f523[_0xebf6('0x19')]][_0xebf6('0x22')]=_0x80f523['ringtime']?parseInt(_0x80f523['ringtime'])/0x3e8:0x0;agents[_0x80f523[_0xebf6('0x19')]][_0xebf6('0x23')]=0x0;unanswered[_0xebf6('0x24')](_0x80f523[_0xebf6('0x19')]);}}catch(_0xedaaeb){utils[_0xebf6('0x1c')](util[_0xebf6('0x2')](_0xebf6('0x1e'),_0x80f523['uniqueid']),_0xedaaeb);}};exports[_0xebf6('0x25')]=function(_0x78cdf0){try{_['forIn'](agents,function(_0x2fe3ee,_0x28bbea){if(_0x2fe3ee['uniqueid']==_0x78cdf0[_0xebf6('0x4')]&&!_[_0xebf6('0x26')](unanswered,_0x2fe3ee[_0xebf6('0x19')])){utils[_0xebf6('0x14')](util[_0xebf6('0x2')](_0xebf6('0x27'),_0x78cdf0['uniqueid']),_0x78cdf0);utils[_0xebf6('0x1')](util[_0xebf6('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x78cdf0['uniqueid'],_0x2fe3ee[_0xebf6('0x6')],_0x2fe3ee[_0xebf6('0x19')]));_0x2fe3ee['agentringnoanswer']=!![];_0x2fe3ee[_0xebf6('0x20')]=utils[_0xebf6('0x17')]();_0x2fe3ee['lastevent']=_0xebf6('0x28');_0x2fe3ee[_0xebf6('0x21')]=_0xebf6('0x28');_0x2fe3ee['holdtime']=_0x78cdf0[_0xebf6('0x22')];_0x2fe3ee[_0xebf6('0x23')]=0x0;writeDB(_0x2fe3ee);}});}catch(_0xed3a5b){utils[_0xebf6('0x1c')](util['format']('[%s][agents][queuecallerabandon]',_0x78cdf0[_0xebf6('0x4')]),_0xed3a5b);}};exports[_0xebf6('0x29')]=function(_0x562f76){try{if(agents[_0x562f76[_0xebf6('0x19')]]){utils[_0xebf6('0x14')](util['format'](_0xebf6('0x2a'),_0x562f76[_0xebf6('0x4')]),_0x562f76);utils[_0xebf6('0x1')](util[_0xebf6('0x2')](_0xebf6('0x2b'),_0x562f76['uniqueid'],agents[_0x562f76[_0xebf6('0x19')]]['membername'],_0x562f76[_0xebf6('0x19')]));agents[_0x562f76['destuniqueid']][_0xebf6('0x2c')]=utils[_0xebf6('0x17')]();agents[_0x562f76[_0xebf6('0x19')]][_0xebf6('0x9')]=_0x562f76[_0xebf6('0x9')];agents[_0x562f76[_0xebf6('0x19')]]['connectedlinename']=_0x562f76[_0xebf6('0x1a')];agents[_0x562f76[_0xebf6('0x19')]][_0xebf6('0x22')]=_0x562f76[_0xebf6('0x2d')];agents[_0x562f76[_0xebf6('0x19')]][_0xebf6('0xa')]='connect';_[_0xebf6('0x2e')](agents,function(_0x2782a5,_0x3f8502){if(_0x2782a5[_0xebf6('0x19')]!=_0x562f76[_0xebf6('0x19')]&&_0x2782a5[_0xebf6('0x4')]==_0x562f76['uniqueid']){_0x2782a5['talktime']=0x0;_0x2782a5['holdtime']=_0x562f76[_0xebf6('0x2d')];_0x2782a5[_0xebf6('0x1d')]=!![];_0x2782a5[_0xebf6('0x20')]=utils['now']();_0x2782a5[_0xebf6('0xa')]=_0xebf6('0x2f');_0x2782a5[_0xebf6('0x21')]='answered_elsewhere';_0x2782a5[_0xebf6('0x30')]=_0x562f76[_0xebf6('0x19')];_0x2782a5['answeredelsewheremembername']=_0x562f76[_0xebf6('0x6')];writeDB(_0x2782a5);}});}}catch(_0x1de50e){utils[_0xebf6('0x1c')](util['format'](_0xebf6('0x2a'),_0x562f76['uniqueid']),_0x1de50e);}};exports['agentcomplete']=function(_0x256552){try{if(!_[_0xebf6('0x31')](agents[_0x256552[_0xebf6('0x19')]])){utils[_0xebf6('0x14')](util['format'](_0xebf6('0x32'),_0x256552['uniqueid']),_0x256552);utils[_0xebf6('0x1')](util[_0xebf6('0x2')](_0xebf6('0x33'),_0x256552[_0xebf6('0x4')],agents[_0x256552[_0xebf6('0x19')]]['membername'],_0x256552['destuniqueid']));agents[_0x256552[_0xebf6('0x19')]][_0xebf6('0x34')]=!![];agents[_0x256552[_0xebf6('0x19')]][_0xebf6('0x35')]=utils['now']();agents[_0x256552[_0xebf6('0x19')]][_0xebf6('0x23')]=utils[_0xebf6('0x36')](agents[_0x256552[_0xebf6('0x19')]][_0xebf6('0x35')],agents[_0x256552[_0xebf6('0x19')]][_0xebf6('0x2c')]);agents[_0x256552['destuniqueid']][_0xebf6('0x21')]=_0x256552[_0xebf6('0x21')];agents[_0x256552[_0xebf6('0x19')]][_0xebf6('0xa')]=_0xebf6('0x37');writeDB(agents[_0x256552[_0xebf6('0x19')]]);}}catch(_0x250cf4){utils['error'](util[_0xebf6('0x2')]('[%s][agents][agentcomplete]',_0x256552[_0xebf6('0x4')]),_0x250cf4);}};exports[_0xebf6('0x38')]=function(_0x5d84ac){try{if(!_[_0xebf6('0x31')](agents[_0x5d84ac['transfereruniqueid']])){utils[_0xebf6('0x14')](util[_0xebf6('0x2')](_0xebf6('0x39'),_0x5d84ac[_0xebf6('0x4')]),_0x5d84ac);utils[_0xebf6('0x1')](util['format'](_0xebf6('0x3a'),_0x5d84ac[_0xebf6('0x4')],agents[_0x5d84ac['transfereruniqueid']][_0xebf6('0x6')],agents[_0x5d84ac[_0xebf6('0x3b')]][_0xebf6('0x4')]));agents[_0x5d84ac[_0xebf6('0x3b')]][_0xebf6('0x3c')]=!![];agents[_0x5d84ac['transfereruniqueid']][_0xebf6('0x3d')]=_0xebf6('0x3e');agents[_0x5d84ac[_0xebf6('0x3b')]][_0xebf6('0x3f')]=_0x5d84ac['extension'];agents[_0x5d84ac[_0xebf6('0x3b')]][_0xebf6('0x40')]=agents[_0x5d84ac[_0xebf6('0x3b')]][_0xebf6('0x4')];}}catch(_0x16abac){utils[_0xebf6('0x1c')](util[_0xebf6('0x2')](_0xebf6('0x39'),_0x5d84ac[_0xebf6('0x4')]),_0x16abac);}};exports['attendedtransfer']=function(_0x22c3ad){try{utils[_0xebf6('0x14')](util[_0xebf6('0x2')]('[%s][agents][attendedtransfer]',_0x22c3ad[_0xebf6('0x41')]),_0x22c3ad);if(_0x22c3ad['origtransfereruniqueid']==_0x22c3ad['origtransfererlinkedid']){if(!_[_0xebf6('0x31')](agents[_0x22c3ad[_0xebf6('0x42')]])){utils[_0xebf6('0x1')](util[_0xebf6('0x2')](_0xebf6('0x43'),_0x22c3ad['origtransfereruniqueid'],agents[_0x22c3ad[_0xebf6('0x42')]]['membername']));agents[_0x22c3ad['secondtransfereruniqueid']]['transfer']=!![];agents[_0x22c3ad[_0xebf6('0x42')]][_0xebf6('0x3d')]='ATTENDED';agents[_0x22c3ad[_0xebf6('0x42')]][_0xebf6('0x3f')]=_0x22c3ad[_0xebf6('0x44')];agents[_0x22c3ad[_0xebf6('0x42')]][_0xebf6('0x40')]=_0x22c3ad[_0xebf6('0x41')];}if(_0x22c3ad[_0xebf6('0x45')]&&agents[_0x22c3ad['transfereeuniqueid']]){agents[_0x22c3ad[_0xebf6('0x45')]][_0xebf6('0x46')]=0x1;transfers[_0x22c3ad[_0xebf6('0x45')]]=_[_0xebf6('0x47')](agents[_0x22c3ad[_0xebf6('0x45')]]);transfers[_0x22c3ad[_0xebf6('0x45')]]['calleridnum']=agents[_0x22c3ad[_0xebf6('0x42')]][_0xebf6('0x8')];transfers[_0x22c3ad[_0xebf6('0x45')]][_0xebf6('0x48')]=agents[_0x22c3ad[_0xebf6('0x42')]][_0xebf6('0x48')];transfers[_0x22c3ad['transfereeuniqueid']][_0xebf6('0x16')]=utils[_0xebf6('0x17')]();transfers[_0x22c3ad[_0xebf6('0x45')]][_0xebf6('0x2c')]=utils[_0xebf6('0x17')]();transfers[_0x22c3ad['transfereeuniqueid']][_0xebf6('0x22')]=0x0;transfers[_0x22c3ad[_0xebf6('0x45')]][_0xebf6('0x46')]=0x2;}}else if(_0x22c3ad[_0xebf6('0x42')]==_0x22c3ad[_0xebf6('0x49')]){if(!_[_0xebf6('0x31')](agents[_0x22c3ad[_0xebf6('0x41')]])){utils[_0xebf6('0x1')](util[_0xebf6('0x2')](_0xebf6('0x43'),_0x22c3ad[_0xebf6('0x41')],agents[_0x22c3ad['origtransfereruniqueid']][_0xebf6('0x6')]));agents[_0x22c3ad[_0xebf6('0x41')]][_0xebf6('0x3c')]=!![];agents[_0x22c3ad[_0xebf6('0x41')]][_0xebf6('0x3d')]=_0xebf6('0x4a');agents[_0x22c3ad['origtransfereruniqueid']][_0xebf6('0x3f')]=_0x22c3ad['secondtransfererexten'];agents[_0x22c3ad[_0xebf6('0x41')]][_0xebf6('0x40')]=_0x22c3ad[_0xebf6('0x42')];}if(_0x22c3ad[_0xebf6('0x4b')]&&agents[_0x22c3ad[_0xebf6('0x4b')]]){agents[_0x22c3ad[_0xebf6('0x4b')]][_0xebf6('0x46')]=0x1;transfers[_0x22c3ad['transfertargetuniqueid']]=_['clone'](agents[_0x22c3ad[_0xebf6('0x4b')]]);transfers[_0x22c3ad[_0xebf6('0x4b')]]['calleridnum']=agents[_0x22c3ad[_0xebf6('0x41')]][_0xebf6('0x8')];transfers[_0x22c3ad['transfertargetuniqueid']][_0xebf6('0x48')]=agents[_0x22c3ad[_0xebf6('0x41')]]['calleridname'];transfers[_0x22c3ad[_0xebf6('0x4b')]][_0xebf6('0x16')]=utils[_0xebf6('0x17')]();transfers[_0x22c3ad[_0xebf6('0x4b')]][_0xebf6('0x2c')]=utils[_0xebf6('0x17')]();transfers[_0x22c3ad[_0xebf6('0x4b')]]['holdtime']=0x0;transfers[_0x22c3ad[_0xebf6('0x4b')]][_0xebf6('0x46')]=0x2;}}}catch(_0x26d338){utils[_0xebf6('0x1c')](util[_0xebf6('0x2')](_0xebf6('0x4c'),_0x22c3ad[_0xebf6('0x41')]),_0x26d338);}};exports[_0xebf6('0x4d')]=function(_0x3bc43){try{utils[_0xebf6('0x14')](util['format']('[%s][agents][hangup]',_0x3bc43[_0xebf6('0x4')]),_0x3bc43);if(agents[_0x3bc43[_0xebf6('0x4')]]&&agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x21')]==='timeout'){if(_0x3bc43[_0xebf6('0x4e')]==='21'){agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x21')]=_0xebf6('0x4f');agents[_0x3bc43['uniqueid']]['lastevent']='rejected';}utils[_0xebf6('0x1')](util[_0xebf6('0x2')](_0xebf6('0x50'),_0x3bc43[_0xebf6('0x4')],agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x6')],agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x21')],agents[_0x3bc43['uniqueid']][_0xebf6('0xa')]));writeDB(agents[_0x3bc43[_0xebf6('0x4')]]);var _0x50169c=unanswered['indexOf'](_0x3bc43[_0xebf6('0x4')]);if(_0x50169c>-0x1){unanswered['splice'](_0x50169c,0x1);}}if(transfers[_0x3bc43[_0xebf6('0x4')]]){transfers[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x34')]=!![];transfers[_0x3bc43['uniqueid']][_0xebf6('0x35')]=utils[_0xebf6('0x17')]();transfers[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x23')]=utils[_0xebf6('0x36')](transfers[_0x3bc43[_0xebf6('0x4')]]['agentcompleteAt'],transfers[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x2c')]);transfers[_0x3bc43['uniqueid']][_0xebf6('0x21')]=_0xebf6('0x51');transfers[_0x3bc43[_0xebf6('0x4')]]['lastevent']=_0xebf6('0x37');utils[_0xebf6('0x1')](util['format'](_0xebf6('0x50'),_0x3bc43[_0xebf6('0x4')],transfers[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x6')],transfers[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x21')],transfers[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0xa')]));writeDB(transfers[_0x3bc43[_0xebf6('0x4')]],!![]);}if(agents[_0x3bc43[_0xebf6('0x4')]]&&agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x2c')]){agents[_0x3bc43[_0xebf6('0x4')]]['agentcomplete']=!![];agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x35')]=utils[_0xebf6('0x17')]();agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x23')]=utils[_0xebf6('0x36')](agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x35')],agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x2c')]);agents[_0x3bc43['uniqueid']]['reason']=agents[_0x3bc43[_0xebf6('0x4')]]['transfer']?_0xebf6('0x3c'):_0xebf6('0x51');agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0xa')]=_0xebf6('0x37');utils['info'](util[_0xebf6('0x2')](_0xebf6('0x50'),_0x3bc43['uniqueid'],agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x6')],agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x21')],agents[_0x3bc43[_0xebf6('0x4')]]['lastevent']));writeDB(agents[_0x3bc43['uniqueid']]);}}catch(_0x1b245d){utils[_0xebf6('0x1c')](util[_0xebf6('0x2')](_0xebf6('0x52'),_0x3bc43[_0xebf6('0x4')]),_0x1b245d);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index bf76b80..fb87119 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 _0x8b30=['musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','noop','execif','gotoif','[%s][calls][newexten]','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','uniqueid','blinds','transfereeuniqueid','info','format','channel','queue','interface','calleridnum','lastevent','accountcode','UserId','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','OutgoingSpoolFailed','context','exten','now','DOCUMENTATION','error','newstate','debug','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','diffTime','endtime','starttime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','origtransfererchannel','destinationchannel','musiconholdstart','[%s][calls][musiconholdstart]'];(function(_0x9d9343,_0x494c83){var _0x2abcd2=function(_0x101a63){while(--_0x101a63){_0x9d9343['push'](_0x9d9343['shift']());}};_0x2abcd2(++_0x494c83);}(_0x8b30,0x1e7));var _0x08b3=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0x8b30[_0x2f1762];return _0x8ab21;};'use strict';var _=require(_0x08b3('0x0'));var util=require(_0x08b3('0x1'));var utils=require(_0x08b3('0x2'));var transfers=require(_0x08b3('0x3'));var dispositions=[_0x08b3('0x4'),_0x08b3('0x5'),_0x08b3('0x5'),_0x08b3('0x4'),_0x08b3('0x4'),'NO\x20ANSWER',_0x08b3('0x6'),_0x08b3('0x7'),_0x08b3('0x5'),'FAILED',_0x08b3('0x5')];var channels={};function writeDB(_0x430635){var _0x47349d;if(transfers['blinds'][_0x430635[_0x08b3('0x8')]]){_0x47349d=_0x430635['uniqueid'];_0x430635[_0x08b3('0x8')]=transfers[_0x08b3('0x9')][_0x430635[_0x08b3('0x8')]][_0x08b3('0xa')];}utils[_0x08b3('0xb')](util[_0x08b3('0xc')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x430635['uniqueid'],_0x430635[_0x08b3('0xd')],_0x430635[_0x08b3('0xe')],_0x430635['membername'],_0x430635[_0x08b3('0xf')],_0x430635[_0x08b3('0x10')],_0x430635['connectedlinenum'],_0x430635[_0x08b3('0x11')]));if(_0x430635['accountcode']){utils['getUserByInternal'](_0x430635[_0x08b3('0x12')])['then'](function(_0x4742a3){if(_0x4742a3){_0x430635[_0x08b3('0x13')]=_0x4742a3['id'];}utils[_0x08b3('0x14')]('CreateVoiceCallReport',_0x430635);});}else{utils['request'](_0x08b3('0x15'),_0x430635);}if(channels[_0x430635[_0x08b3('0x8')]]){delete channels[_0x430635[_0x08b3('0x8')]];}else if(_0x47349d&&channels[_0x47349d]){delete transfers[_0x08b3('0x9')][_0x47349d];delete channels[_0x47349d];}}exports[_0x08b3('0x16')]=function(_0x286631){try{utils['debug'](util['format'](_0x08b3('0x17'),_0x286631[_0x08b3('0x8')]),_0x286631);if(_0x286631[_0x08b3('0x8')]==_0x286631['linkedid']&&_0x286631['channel']!=_0x08b3('0x18')){utils[_0x08b3('0xb')](util[_0x08b3('0xc')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x286631[_0x08b3('0x8')],_0x286631[_0x08b3('0x19')],_0x286631[_0x08b3('0x1a')]));channels[_0x286631[_0x08b3('0x8')]]={'uniqueid':_0x286631['uniqueid'],'accountcode':_0x286631[_0x08b3('0x12')],'source':_0x286631['calleridnum'],'destination':_0x286631['exten'],'destinationcontext':_0x286631[_0x08b3('0x19')],'channel':_0x286631[_0x08b3('0xd')],'starttime':utils[_0x08b3('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x08b3('0x4'),'amaflags':_0x08b3('0x1c')};}}catch(_0x12512a){utils[_0x08b3('0x1d')](util[_0x08b3('0xc')](_0x08b3('0x17'),_0x286631[_0x08b3('0x8')]),_0x12512a);}};exports[_0x08b3('0x1e')]=function(_0x5a4740){try{utils[_0x08b3('0x1f')](util['format']('[%s][calls][newstate]',_0x5a4740['uniqueid']),_0x5a4740);if(!_[_0x08b3('0x20')](channels[_0x5a4740[_0x08b3('0x8')]])&&_0x5a4740[_0x08b3('0x21')]==0x6){utils[_0x08b3('0xb')](util[_0x08b3('0xc')](_0x08b3('0x22'),_0x5a4740[_0x08b3('0x8')],_0x5a4740[_0x08b3('0x19')],_0x5a4740['channel']));if(_['isNil'](channels[_0x5a4740[_0x08b3('0x8')]][_0x08b3('0x23')])){channels[_0x5a4740[_0x08b3('0x8')]][_0x08b3('0x23')]=utils[_0x08b3('0x1b')]();}}else if(!_[_0x08b3('0x20')](channels[_0x5a4740[_0x08b3('0x24')]])&&_0x5a4740[_0x08b3('0x21')]==0x6&&_0x5a4740[_0x08b3('0x19')]!=_0x08b3('0x25')){utils['info'](util[_0x08b3('0xc')](_0x08b3('0x26'),_0x5a4740[_0x08b3('0x8')],_0x5a4740[_0x08b3('0x24')],_0x5a4740[_0x08b3('0x19')],_0x5a4740[_0x08b3('0xd')]));channels[_0x5a4740[_0x08b3('0x24')]][_0x08b3('0x12')]=_0x5a4740[_0x08b3('0x12')];channels[_0x5a4740['linkedid']]['destinationchannel']=_0x5a4740[_0x08b3('0xd')];if(_[_0x08b3('0x20')](channels[_0x5a4740[_0x08b3('0x24')]]['answertime'])){channels[_0x5a4740[_0x08b3('0x24')]][_0x08b3('0x27')]=utils['now']();}channels[_0x5a4740[_0x08b3('0x24')]][_0x08b3('0x28')]=dispositions[_[_0x08b3('0x29')](_0x5a4740['channelstate'])]||_0x08b3('0x6');}}catch(_0x364735){utils['error'](util[_0x08b3('0xc')]('[%s][calls][newstate]',_0x5a4740[_0x08b3('0x8')]),_0x364735);}};exports[_0x08b3('0x2a')]=function(_0x11cea9){try{if(!_[_0x08b3('0x20')](channels[_0x11cea9[_0x08b3('0x8')]])){utils[_0x08b3('0x1f')](util['format'](_0x08b3('0x2b'),_0x11cea9[_0x08b3('0x8')]),_0x11cea9);if(_['isNil'](channels[_0x11cea9[_0x08b3('0x8')]][_0x08b3('0x2c')])){channels[_0x11cea9['uniqueid']][_0x08b3('0x2c')]=_0x11cea9['calleridname']+'\x20<'+_0x11cea9[_0x08b3('0x10')]+'>';}utils[_0x08b3('0xb')](util[_0x08b3('0xc')](_0x08b3('0x2d'),_0x11cea9[_0x08b3('0x8')],channels[_0x11cea9['uniqueid']][_0x08b3('0x2c')],_0x11cea9[_0x08b3('0x2e')]));channels[_0x11cea9[_0x08b3('0x8')]]['endtime']=utils[_0x08b3('0x1b')]();channels[_0x11cea9['uniqueid']]['duration']=utils[_0x08b3('0x2f')](channels[_0x11cea9['uniqueid']][_0x08b3('0x30')],channels[_0x11cea9[_0x08b3('0x8')]][_0x08b3('0x31')]);channels[_0x11cea9[_0x08b3('0x8')]]['billableseconds']=channels[_0x11cea9[_0x08b3('0x8')]][_0x08b3('0x27')]?utils[_0x08b3('0x2f')](channels[_0x11cea9[_0x08b3('0x8')]]['endtime'],channels[_0x11cea9['uniqueid']][_0x08b3('0x27')]):0x0;writeDB(channels[_0x11cea9[_0x08b3('0x8')]]);}}catch(_0xb5d23a){utils[_0x08b3('0x1d')](util['format']('[%s][calls][hangup]',_0x11cea9[_0x08b3('0x8')]),_0xb5d23a);}};exports[_0x08b3('0x32')]=function(_0xef7020){try{if(!_[_0x08b3('0x20')](channels[_0xef7020[_0x08b3('0x33')]])){utils[_0x08b3('0x1f')](util[_0x08b3('0xc')](_0x08b3('0x34'),_0xef7020[_0x08b3('0x35')]),_0xef7020);if(channels[_0xef7020['localtwolinkedid']][_0x08b3('0xd')]==_0xef7020[_0x08b3('0x36')]){utils[_0x08b3('0xb')](util[_0x08b3('0xc')](_0x08b3('0x37'),_0xef7020[_0x08b3('0x35')],_0xef7020[_0x08b3('0x33')],_0xef7020[_0x08b3('0x38')]));channels[_0xef7020[_0x08b3('0x33')]]['destinationchannel']=_0xef7020[_0x08b3('0x38')];channels[_0xef7020[_0x08b3('0x33')]][_0x08b3('0x39')]=_0x08b3('0x3a');}else if(channels[_0xef7020[_0x08b3('0x33')]][_0x08b3('0xd')]=_0xef7020['transfertargetchannel']){utils[_0x08b3('0xb')](util['format'](_0x08b3('0x37'),_0xef7020[_0x08b3('0x35')],_0xef7020[_0x08b3('0x33')],_0xef7020[_0x08b3('0x3b')]));channels[_0xef7020[_0x08b3('0x33')]][_0x08b3('0x3c')]=_0xef7020['origtransfererchannel'];channels[_0xef7020[_0x08b3('0x33')]]['userfield']=_0x08b3('0x3a');}}}catch(_0x205f16){utils[_0x08b3('0x1d')](util[_0x08b3('0xc')](_0x08b3('0x34'),_0xef7020['origtransfereruniqueid']),_0x205f16);}};exports[_0x08b3('0x3d')]=function(_0x43b8fe){try{if(!_['isNil'](channels[_0x43b8fe[_0x08b3('0x8')]])){utils[_0x08b3('0x1f')](util['format'](_0x08b3('0x3e'),_0x43b8fe[_0x08b3('0x8')]),_0x43b8fe);channels[_0x43b8fe[_0x08b3('0x8')]][_0x08b3('0x3f')]=utils[_0x08b3('0x1b')]();utils[_0x08b3('0xb')](util[_0x08b3('0xc')](_0x08b3('0x40'),_0x43b8fe[_0x08b3('0x8')],channels[_0x43b8fe['uniqueid']][_0x08b3('0x3f')]));}}catch(_0x19cf9c){utils[_0x08b3('0x1d')](util['format']('[%s][calls][musiconholdstart]',_0x43b8fe[_0x08b3('0x8')]),_0x19cf9c);}};exports[_0x08b3('0x41')]=function(_0x19f1f9){try{if(!_['isNil'](channels[_0x19f1f9[_0x08b3('0x8')]])){utils['debug'](util['format'](_0x08b3('0x42'),_0x19f1f9['uniqueid']),_0x19f1f9);if(!_[_0x08b3('0x20')](channels[_0x19f1f9['uniqueid']][_0x08b3('0x3f')])){channels[_0x19f1f9[_0x08b3('0x8')]][_0x08b3('0x43')]+=utils[_0x08b3('0x2f')](utils['now'](),channels[_0x19f1f9[_0x08b3('0x8')]][_0x08b3('0x3f')]);utils[_0x08b3('0xb')](util[_0x08b3('0xc')](_0x08b3('0x44'),_0x19f1f9[_0x08b3('0x8')],channels[_0x19f1f9['uniqueid']]['mohtime']));delete channels[_0x19f1f9[_0x08b3('0x8')]]['musiconholdstartAt'];}}}catch(_0x2dbc3e){utils['error'](util[_0x08b3('0xc')](_0x08b3('0x42'),_0x19f1f9['uniqueid']),_0x2dbc3e);}};exports[_0x08b3('0x45')]=function(_0x3c11e3){try{if(!_[_0x08b3('0x20')](channels[_0x3c11e3[_0x08b3('0x8')]])){utils[_0x08b3('0x1f')](util[_0x08b3('0xc')]('[%s][calls][varset]',_0x3c11e3[_0x08b3('0x8')]),_0x3c11e3);if(!_[_0x08b3('0x20')](_0x3c11e3[_0x08b3('0x46')][_0x08b3('0x47')])){utils[_0x08b3('0xb')](util['format'](_0x08b3('0x48'),_0x3c11e3[_0x08b3('0x8')],_0x3c11e3[_0x08b3('0x49')]));channels[_0x3c11e3[_0x08b3('0x8')]]['source']=_0x3c11e3[_0x08b3('0x49')];}if(!_[_0x08b3('0x20')](_0x3c11e3[_0x08b3('0x46')][_0x08b3('0x4a')])){utils[_0x08b3('0xb')](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x3c11e3[_0x08b3('0x8')],_0x3c11e3[_0x08b3('0x49')]));channels[_0x3c11e3[_0x08b3('0x8')]][_0x08b3('0x4b')]=_0x3c11e3[_0x08b3('0x49')];channels[_0x3c11e3[_0x08b3('0x8')]][_0x08b3('0x2c')]='\x22'+_0x3c11e3[_0x08b3('0x49')]+_0x08b3('0x4c')+_0x3c11e3[_0x08b3('0x49')]+'>';}if(!_[_0x08b3('0x20')](_0x3c11e3[_0x08b3('0x46')][_0x08b3('0x4d')])||!_[_0x08b3('0x20')](_0x3c11e3[_0x08b3('0x46')][_0x08b3('0x4e')])){utils[_0x08b3('0xb')](util['format'](_0x08b3('0x4f'),_0x3c11e3['uniqueid'],!_[_0x08b3('0x20')](_0x3c11e3[_0x08b3('0x46')][_0x08b3('0x4d')])?'xmd-callerid-preview':_0x08b3('0x4e'),_0x3c11e3[_0x08b3('0x49')]));channels[_0x3c11e3[_0x08b3('0x8')]][_0x08b3('0x2c')]=_0x3c11e3[_0x08b3('0x49')];}if(!_[_0x08b3('0x20')](_0x3c11e3['variable'][_0x08b3('0x50')])||!_[_0x08b3('0x20')](_0x3c11e3[_0x08b3('0x46')][_0x08b3('0x51')])){utils[_0x08b3('0xb')](util[_0x08b3('0xc')](_0x08b3('0x4f'),_0x3c11e3[_0x08b3('0x8')],!_[_0x08b3('0x20')](_0x3c11e3[_0x08b3('0x46')][_0x08b3('0x50')])?_0x08b3('0x50'):_0x08b3('0x51'),_0x3c11e3['value']));channels[_0x3c11e3['uniqueid']][_0x08b3('0x52')]=_0x08b3('0x53');channels[_0x3c11e3[_0x08b3('0x8')]][_0x08b3('0x54')]=_0x3c11e3[_0x08b3('0x49')];channels[_0x3c11e3['uniqueid']]['queue']=!![];}if(!_[_0x08b3('0x20')](_0x3c11e3['variable'][_0x08b3('0x55')])){utils['info'](util[_0x08b3('0xc')](_0x08b3('0x56'),_0x3c11e3[_0x08b3('0x8')],_0x3c11e3[_0x08b3('0x49')]));channels[_0x3c11e3[_0x08b3('0x8')]][_0x08b3('0x57')]=_0x3c11e3[_0x08b3('0x49')];}if(!_[_0x08b3('0x20')](_0x3c11e3[_0x08b3('0x46')][_0x08b3('0x58')])){utils[_0x08b3('0xb')](util[_0x08b3('0xc')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x3c11e3['uniqueid'],_0x3c11e3[_0x08b3('0x49')]));channels[_0x3c11e3['uniqueid']][_0x08b3('0x59')]=_0x3c11e3[_0x08b3('0x49')];}if(!_[_0x08b3('0x20')](_0x3c11e3[_0x08b3('0x46')][_0x08b3('0x5a')])){utils['info'](util[_0x08b3('0xc')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x3c11e3['uniqueid'],_0x3c11e3[_0x08b3('0x49')]));channels[_0x3c11e3[_0x08b3('0x8')]][_0x08b3('0x5b')]=_0x3c11e3[_0x08b3('0x49')];}if(!_[_0x08b3('0x20')](_0x3c11e3[_0x08b3('0x46')][_0x08b3('0x5c')])){utils[_0x08b3('0xb')](util[_0x08b3('0xc')](_0x08b3('0x5d'),_0x3c11e3['uniqueid'],_0x3c11e3[_0x08b3('0x49')]));channels[_0x3c11e3[_0x08b3('0x8')]]['sipcallid']=_0x3c11e3['value'];}}}catch(_0x1f67c8){utils[_0x08b3('0x1d')](util[_0x08b3('0xc')](_0x08b3('0x5e'),_0x3c11e3[_0x08b3('0x8')]),_0x1f67c8);}};exports[_0x08b3('0x5f')]=function(_0xaf5103){try{if(!_['isNil'](channels[_0xaf5103[_0x08b3('0x8')]])){utils[_0x08b3('0x1f')](util['format']('[%s][calls][newexten]',_0xaf5103[_0x08b3('0x8')]),_0xaf5103);utils[_0x08b3('0xb')](util[_0x08b3('0xc')](_0x08b3('0x60'),_0xaf5103[_0x08b3('0x8')],_0xaf5103[_0x08b3('0x61')],_0xaf5103[_0x08b3('0x62')]));if(_0xaf5103['application']['toLowerCase']()==_0x08b3('0x63')&&_[_0x08b3('0x64')](_0xaf5103[_0x08b3('0x62')][_0x08b3('0x65')](),_0x08b3('0x66'))){var _0x493a28=_0xaf5103['appdata'][_0x08b3('0x67')]('=');var _0x4eb261=_0x493a28[0x0][_0x08b3('0x68')](_0x493a28[0x0]['lastIndexOf']('(')+0x1,_0x493a28[0x0][_0x08b3('0x69')](')'));var _0x12d95c=_0x493a28[0x1];channels[_0xaf5103[_0x08b3('0x8')]][_0x4eb261]=_0x12d95c;}if(!_['includes']([_0x08b3('0x2a'),_0x08b3('0x6a'),_0x08b3('0x6b'),_0x08b3('0x63'),_0x08b3('0x6c')],_0xaf5103[_0x08b3('0x61')][_0x08b3('0x65')]())){channels[_0xaf5103[_0x08b3('0x8')]][_0x08b3('0x52')]=_0xaf5103['application'];channels[_0xaf5103['uniqueid']][_0x08b3('0x54')]=_0xaf5103[_0x08b3('0x62')];}}}catch(_0x48d2d3){utils[_0x08b3('0x1d')](util[_0x08b3('0xc')](_0x08b3('0x6d'),_0xaf5103[_0x08b3('0x8')]),_0x48d2d3);}}; \ No newline at end of file +var _0x9b5c=['routeid','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr','substring','includes','noop','execif','gotoif','lodash','util','FAILED','NO\x20ANSWER','ANSWERED','blinds','uniqueid','transfereeuniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','interface','calleridnum','connectedlinenum','lastevent','getUserByInternal','accountcode','then','UserId','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','systemanswertime','info','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','callerid','cause-txt','endtime','duration','diffTime','starttime','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','origtransfererchannel','[%s][calls][attendedtransfer]','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','source','value','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','lastdata','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s'];(function(_0xb0fe92,_0x147e42){var _0x41787f=function(_0x42ae35){while(--_0x42ae35){_0xb0fe92['push'](_0xb0fe92['shift']());}};_0x41787f(++_0x147e42);}(_0x9b5c,0xea));var _0xc9b5=function(_0x5a6715,_0x23f06d){_0x5a6715=_0x5a6715-0x0;var _0x45e838=_0x9b5c[_0x5a6715];return _0x45e838;};'use strict';var _=require(_0xc9b5('0x0'));var util=require(_0xc9b5('0x1'));var utils=require('./utils');var transfers=require('./transfers.controller');var dispositions=['NO\x20ANSWER',_0xc9b5('0x2'),_0xc9b5('0x2'),_0xc9b5('0x3'),'NO\x20ANSWER',_0xc9b5('0x3'),_0xc9b5('0x4'),'BUSY',_0xc9b5('0x2'),_0xc9b5('0x2'),_0xc9b5('0x2')];var channels={};function writeDB(_0x100c90){var _0x251d12;if(transfers[_0xc9b5('0x5')][_0x100c90[_0xc9b5('0x6')]]){_0x251d12=_0x100c90[_0xc9b5('0x6')];_0x100c90[_0xc9b5('0x6')]=transfers[_0xc9b5('0x5')][_0x100c90[_0xc9b5('0x6')]][_0xc9b5('0x7')];}utils['info'](util[_0xc9b5('0x8')](_0xc9b5('0x9'),_0x100c90[_0xc9b5('0x6')],_0x100c90[_0xc9b5('0xa')],_0x100c90['queue'],_0x100c90[_0xc9b5('0xb')],_0x100c90[_0xc9b5('0xc')],_0x100c90[_0xc9b5('0xd')],_0x100c90[_0xc9b5('0xe')],_0x100c90[_0xc9b5('0xf')]));if(_0x100c90['accountcode']){utils[_0xc9b5('0x10')](_0x100c90[_0xc9b5('0x11')])[_0xc9b5('0x12')](function(_0xd67c2d){if(_0xd67c2d){_0x100c90[_0xc9b5('0x13')]=_0xd67c2d['id'];}utils[_0xc9b5('0x14')](_0xc9b5('0x15'),_0x100c90);});}else{utils[_0xc9b5('0x14')](_0xc9b5('0x15'),_0x100c90);}if(channels[_0x100c90['uniqueid']]){delete channels[_0x100c90[_0xc9b5('0x6')]];}else if(_0x251d12&&channels[_0x251d12]){delete transfers[_0xc9b5('0x5')][_0x251d12];delete channels[_0x251d12];}}exports['newchannel']=function(_0x4c6ebe){try{utils[_0xc9b5('0x16')](util[_0xc9b5('0x8')](_0xc9b5('0x17'),_0x4c6ebe[_0xc9b5('0x6')]),_0x4c6ebe);if(_0x4c6ebe['uniqueid']==_0x4c6ebe[_0xc9b5('0x18')]&&_0x4c6ebe[_0xc9b5('0xa')]!='OutgoingSpoolFailed'){utils['info'](util[_0xc9b5('0x8')](_0xc9b5('0x19'),_0x4c6ebe[_0xc9b5('0x6')],_0x4c6ebe['context'],_0x4c6ebe[_0xc9b5('0x1a')]));channels[_0x4c6ebe[_0xc9b5('0x6')]]={'uniqueid':_0x4c6ebe['uniqueid'],'accountcode':_0x4c6ebe['accountcode'],'source':_0x4c6ebe['calleridnum'],'destination':_0x4c6ebe[_0xc9b5('0x1a')],'destinationcontext':_0x4c6ebe[_0xc9b5('0x1b')],'channel':_0x4c6ebe[_0xc9b5('0xa')],'starttime':utils[_0xc9b5('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xc9b5('0x3'),'amaflags':_0xc9b5('0x1d')};}}catch(_0x2ced9a){utils[_0xc9b5('0x1e')](util['format'](_0xc9b5('0x17'),_0x4c6ebe[_0xc9b5('0x6')]),_0x2ced9a);}};exports[_0xc9b5('0x1f')]=function(_0x5cb00d){try{utils[_0xc9b5('0x16')](util['format'](_0xc9b5('0x20'),_0x5cb00d[_0xc9b5('0x6')]),_0x5cb00d);if(!_[_0xc9b5('0x21')](channels[_0x5cb00d[_0xc9b5('0x6')]])&&_0x5cb00d[_0xc9b5('0x22')]==0x6){utils['info'](util[_0xc9b5('0x8')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x5cb00d[_0xc9b5('0x6')],_0x5cb00d['context'],_0x5cb00d[_0xc9b5('0xa')]));if(_['isNil'](channels[_0x5cb00d[_0xc9b5('0x6')]]['systemanswertime'])){channels[_0x5cb00d[_0xc9b5('0x6')]][_0xc9b5('0x23')]=utils[_0xc9b5('0x1c')]();}}else if(!_[_0xc9b5('0x21')](channels[_0x5cb00d[_0xc9b5('0x18')]])&&_0x5cb00d['channelstate']==0x6&&_0x5cb00d[_0xc9b5('0x1b')]!='transfer'){utils[_0xc9b5('0x24')](util['format'](_0xc9b5('0x25'),_0x5cb00d[_0xc9b5('0x6')],_0x5cb00d['linkedid'],_0x5cb00d[_0xc9b5('0x1b')],_0x5cb00d['channel']));channels[_0x5cb00d[_0xc9b5('0x18')]][_0xc9b5('0x11')]=_0x5cb00d[_0xc9b5('0x11')];channels[_0x5cb00d[_0xc9b5('0x18')]][_0xc9b5('0x26')]=_0x5cb00d[_0xc9b5('0xa')];if(_[_0xc9b5('0x21')](channels[_0x5cb00d[_0xc9b5('0x18')]][_0xc9b5('0x27')])){channels[_0x5cb00d[_0xc9b5('0x18')]][_0xc9b5('0x27')]=utils['now']();}channels[_0x5cb00d[_0xc9b5('0x18')]][_0xc9b5('0x28')]=dispositions[_[_0xc9b5('0x29')](_0x5cb00d[_0xc9b5('0x22')])]||_0xc9b5('0x4');}}catch(_0x22a2a8){utils[_0xc9b5('0x1e')](util['format'](_0xc9b5('0x20'),_0x5cb00d[_0xc9b5('0x6')]),_0x22a2a8);}};exports[_0xc9b5('0x2a')]=function(_0x204f0a){try{if(!_[_0xc9b5('0x21')](channels[_0x204f0a[_0xc9b5('0x6')]])){utils['debug'](util[_0xc9b5('0x8')]('[%s][calls][hangup]',_0x204f0a[_0xc9b5('0x6')]),_0x204f0a);if(_[_0xc9b5('0x21')](channels[_0x204f0a[_0xc9b5('0x6')]]['callerid'])){channels[_0x204f0a[_0xc9b5('0x6')]]['callerid']=_0x204f0a['calleridname']+'\x20<'+_0x204f0a[_0xc9b5('0xd')]+'>';}utils[_0xc9b5('0x24')](util[_0xc9b5('0x8')](_0xc9b5('0x2b'),_0x204f0a['uniqueid'],channels[_0x204f0a['uniqueid']][_0xc9b5('0x2c')],_0x204f0a[_0xc9b5('0x2d')]));channels[_0x204f0a['uniqueid']][_0xc9b5('0x2e')]=utils['now']();channels[_0x204f0a['uniqueid']][_0xc9b5('0x2f')]=utils[_0xc9b5('0x30')](channels[_0x204f0a[_0xc9b5('0x6')]][_0xc9b5('0x2e')],channels[_0x204f0a[_0xc9b5('0x6')]][_0xc9b5('0x31')]);channels[_0x204f0a[_0xc9b5('0x6')]]['billableseconds']=channels[_0x204f0a[_0xc9b5('0x6')]][_0xc9b5('0x27')]?utils[_0xc9b5('0x30')](channels[_0x204f0a[_0xc9b5('0x6')]][_0xc9b5('0x2e')],channels[_0x204f0a[_0xc9b5('0x6')]][_0xc9b5('0x27')]):0x0;writeDB(channels[_0x204f0a['uniqueid']]);}}catch(_0x59afb8){utils[_0xc9b5('0x1e')](util[_0xc9b5('0x8')](_0xc9b5('0x32'),_0x204f0a['uniqueid']),_0x59afb8);}};exports[_0xc9b5('0x33')]=function(_0x133342){try{if(!_[_0xc9b5('0x21')](channels[_0x133342[_0xc9b5('0x34')]])){utils[_0xc9b5('0x16')](util[_0xc9b5('0x8')]('[%s][calls][attendedtransfer]',_0x133342['origtransfereruniqueid']),_0x133342);if(channels[_0x133342[_0xc9b5('0x34')]][_0xc9b5('0xa')]==_0x133342[_0xc9b5('0x35')]){utils[_0xc9b5('0x24')](util[_0xc9b5('0x8')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x133342['origtransfereruniqueid'],_0x133342[_0xc9b5('0x34')],_0x133342[_0xc9b5('0x36')]));channels[_0x133342[_0xc9b5('0x34')]][_0xc9b5('0x26')]=_0x133342[_0xc9b5('0x36')];channels[_0x133342[_0xc9b5('0x34')]][_0xc9b5('0x37')]=_0xc9b5('0x38');}else if(channels[_0x133342[_0xc9b5('0x34')]][_0xc9b5('0xa')]=_0x133342[_0xc9b5('0x39')]){utils[_0xc9b5('0x24')](util[_0xc9b5('0x8')](_0xc9b5('0x3a'),_0x133342[_0xc9b5('0x3b')],_0x133342['localtwolinkedid'],_0x133342[_0xc9b5('0x3c')]));channels[_0x133342[_0xc9b5('0x34')]][_0xc9b5('0x26')]=_0x133342['origtransfererchannel'];channels[_0x133342[_0xc9b5('0x34')]][_0xc9b5('0x37')]=_0xc9b5('0x38');}}}catch(_0x5a7df2){utils[_0xc9b5('0x1e')](util[_0xc9b5('0x8')](_0xc9b5('0x3d'),_0x133342[_0xc9b5('0x3b')]),_0x5a7df2);}};exports['musiconholdstart']=function(_0x4c0428){try{if(!_[_0xc9b5('0x21')](channels[_0x4c0428['uniqueid']])){utils[_0xc9b5('0x16')](util['format'](_0xc9b5('0x3e'),_0x4c0428[_0xc9b5('0x6')]),_0x4c0428);channels[_0x4c0428['uniqueid']][_0xc9b5('0x3f')]=utils[_0xc9b5('0x1c')]();utils[_0xc9b5('0x24')](util[_0xc9b5('0x8')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x4c0428[_0xc9b5('0x6')],channels[_0x4c0428['uniqueid']][_0xc9b5('0x3f')]));}}catch(_0x53e75c){utils[_0xc9b5('0x1e')](util[_0xc9b5('0x8')](_0xc9b5('0x3e'),_0x4c0428[_0xc9b5('0x6')]),_0x53e75c);}};exports[_0xc9b5('0x40')]=function(_0x49a9be){try{if(!_[_0xc9b5('0x21')](channels[_0x49a9be[_0xc9b5('0x6')]])){utils[_0xc9b5('0x16')](util['format'](_0xc9b5('0x41'),_0x49a9be[_0xc9b5('0x6')]),_0x49a9be);if(!_[_0xc9b5('0x21')](channels[_0x49a9be[_0xc9b5('0x6')]][_0xc9b5('0x3f')])){channels[_0x49a9be['uniqueid']][_0xc9b5('0x42')]+=utils['diffTime'](utils[_0xc9b5('0x1c')](),channels[_0x49a9be[_0xc9b5('0x6')]][_0xc9b5('0x3f')]);utils['info'](util['format'](_0xc9b5('0x43'),_0x49a9be[_0xc9b5('0x6')],channels[_0x49a9be[_0xc9b5('0x6')]][_0xc9b5('0x42')]));delete channels[_0x49a9be[_0xc9b5('0x6')]][_0xc9b5('0x3f')];}}}catch(_0x170bdf){utils[_0xc9b5('0x1e')](util['format']('[%s][calls][musiconholdstop]',_0x49a9be[_0xc9b5('0x6')]),_0x170bdf);}};exports[_0xc9b5('0x44')]=function(_0x460f44){try{if(!_[_0xc9b5('0x21')](channels[_0x460f44[_0xc9b5('0x6')]])){utils[_0xc9b5('0x16')](util[_0xc9b5('0x8')](_0xc9b5('0x45'),_0x460f44[_0xc9b5('0x6')]),_0x460f44);if(!_['isNil'](_0x460f44[_0xc9b5('0x46')][_0xc9b5('0x47')])){utils[_0xc9b5('0x24')](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x460f44[_0xc9b5('0x6')],_0x460f44['value']));channels[_0x460f44['uniqueid']][_0xc9b5('0x48')]=_0x460f44[_0xc9b5('0x49')];}if(!_[_0xc9b5('0x21')](_0x460f44[_0xc9b5('0x46')][_0xc9b5('0x4a')])){utils[_0xc9b5('0x24')](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x460f44[_0xc9b5('0x6')],_0x460f44[_0xc9b5('0x49')]));channels[_0x460f44[_0xc9b5('0x6')]][_0xc9b5('0x4b')]=_0x460f44[_0xc9b5('0x49')];channels[_0x460f44[_0xc9b5('0x6')]][_0xc9b5('0x2c')]='\x22'+_0x460f44[_0xc9b5('0x49')]+_0xc9b5('0x4c')+_0x460f44[_0xc9b5('0x49')]+'>';}if(!_[_0xc9b5('0x21')](_0x460f44[_0xc9b5('0x46')][_0xc9b5('0x4d')])||!_[_0xc9b5('0x21')](_0x460f44[_0xc9b5('0x46')][_0xc9b5('0x4e')])){utils[_0xc9b5('0x24')](util['format'](_0xc9b5('0x4f'),_0x460f44[_0xc9b5('0x6')],!_['isNil'](_0x460f44['variable']['xmd-callerid-preview'])?_0xc9b5('0x4d'):_0xc9b5('0x4e'),_0x460f44['value']));channels[_0x460f44[_0xc9b5('0x6')]][_0xc9b5('0x2c')]=_0x460f44[_0xc9b5('0x49')];}if(!_['isNil'](_0x460f44['variable'][_0xc9b5('0x50')])||!_[_0xc9b5('0x21')](_0x460f44['variable']['xmcs-queue'])){utils[_0xc9b5('0x24')](util['format'](_0xc9b5('0x4f'),_0x460f44['uniqueid'],!_[_0xc9b5('0x21')](_0x460f44[_0xc9b5('0x46')][_0xc9b5('0x50')])?'xmd-queue':_0xc9b5('0x51'),_0x460f44['value']));channels[_0x460f44[_0xc9b5('0x6')]][_0xc9b5('0x52')]='Queue';channels[_0x460f44[_0xc9b5('0x6')]][_0xc9b5('0x53')]=_0x460f44[_0xc9b5('0x49')];channels[_0x460f44[_0xc9b5('0x6')]][_0xc9b5('0x54')]=!![];}if(!_[_0xc9b5('0x21')](_0x460f44['variable'][_0xc9b5('0x55')])){utils[_0xc9b5('0x24')](util[_0xc9b5('0x8')](_0xc9b5('0x56'),_0x460f44[_0xc9b5('0x6')],_0x460f44['value']));channels[_0x460f44[_0xc9b5('0x6')]][_0xc9b5('0x57')]=_0x460f44[_0xc9b5('0x49')];}if(!_[_0xc9b5('0x21')](_0x460f44[_0xc9b5('0x46')][_0xc9b5('0x58')])){utils[_0xc9b5('0x24')](util[_0xc9b5('0x8')](_0xc9b5('0x59'),_0x460f44[_0xc9b5('0x6')],_0x460f44['value']));channels[_0x460f44[_0xc9b5('0x6')]][_0xc9b5('0x5a')]=_0x460f44[_0xc9b5('0x49')];}if(!_[_0xc9b5('0x21')](_0x460f44[_0xc9b5('0x46')][_0xc9b5('0x5b')])){utils[_0xc9b5('0x24')](util[_0xc9b5('0x8')](_0xc9b5('0x5c'),_0x460f44['uniqueid'],_0x460f44[_0xc9b5('0x49')]));channels[_0x460f44['uniqueid']][_0xc9b5('0x5d')]=_0x460f44[_0xc9b5('0x49')];}if(!_['isNil'](_0x460f44['variable']['sipcallid'])){utils[_0xc9b5('0x24')](util[_0xc9b5('0x8')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x460f44[_0xc9b5('0x6')],_0x460f44[_0xc9b5('0x49')]));channels[_0x460f44[_0xc9b5('0x6')]][_0xc9b5('0x5e')]=_0x460f44[_0xc9b5('0x49')];}}}catch(_0xd2ec7c){utils['error'](util[_0xc9b5('0x8')](_0xc9b5('0x45'),_0x460f44['uniqueid']),_0xd2ec7c);}};exports[_0xc9b5('0x5f')]=function(_0x4be887){try{if(!_[_0xc9b5('0x21')](channels[_0x4be887[_0xc9b5('0x6')]])){utils[_0xc9b5('0x16')](util[_0xc9b5('0x8')](_0xc9b5('0x60'),_0x4be887[_0xc9b5('0x6')]),_0x4be887);utils[_0xc9b5('0x24')](util[_0xc9b5('0x8')](_0xc9b5('0x61'),_0x4be887[_0xc9b5('0x6')],_0x4be887[_0xc9b5('0x62')],_0x4be887[_0xc9b5('0x63')]));if(_0x4be887['application']['toLowerCase']()==_0xc9b5('0x64')&&_[_0xc9b5('0x65')](_0x4be887[_0xc9b5('0x63')][_0xc9b5('0x66')](),_0xc9b5('0x67'))){var _0x15b50f=_0x4be887[_0xc9b5('0x63')]['split']('=');var _0x3a3de6=_0x15b50f[0x0][_0xc9b5('0x68')](_0x15b50f[0x0]['lastIndexOf']('(')+0x1,_0x15b50f[0x0]['lastIndexOf'](')'));var _0xeb5464=_0x15b50f[0x1];channels[_0x4be887['uniqueid']][_0x3a3de6]=_0xeb5464;}if(!_[_0xc9b5('0x69')]([_0xc9b5('0x2a'),_0xc9b5('0x6a'),_0xc9b5('0x6b'),_0xc9b5('0x64'),_0xc9b5('0x6c')],_0x4be887[_0xc9b5('0x62')][_0xc9b5('0x66')]())){channels[_0x4be887[_0xc9b5('0x6')]][_0xc9b5('0x52')]=_0x4be887[_0xc9b5('0x62')];channels[_0x4be887[_0xc9b5('0x6')]]['lastdata']=_0x4be887['appdata'];}}}catch(_0x17a481){utils[_0xc9b5('0x1e')](util[_0xc9b5('0x8')](_0xc9b5('0x60'),_0x4be887[_0xc9b5('0x6')]),_0x17a481);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 85eda60..2b7570f 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 _0x1b3f=['info','[core]\x20connected','shutdown','fullybooted','error','[core]\x20error','[core]\x20close','./utils','connect'];(function(_0x4fb560,_0x4dd846){var _0x57ef21=function(_0x14eea8){while(--_0x14eea8){_0x4fb560['push'](_0x4fb560['shift']());}};_0x57ef21(++_0x4dd846);}(_0x1b3f,0x166));var _0xf1b3=function(_0x4791b1,_0x4223ff){_0x4791b1=_0x4791b1-0x0;var _0x41c85a=_0x1b3f[_0x4791b1];return _0x41c85a;};'use strict';var utils=require(_0xf1b3('0x0'));exports[_0xf1b3('0x1')]=function(){utils[_0xf1b3('0x2')](_0xf1b3('0x3'));};exports[_0xf1b3('0x4')]=function(){utils[_0xf1b3('0x2')]('[core]\x20shutdown');};exports[_0xf1b3('0x5')]=function(){utils[_0xf1b3('0x2')]('[core]\x20fullybooted');};exports[_0xf1b3('0x6')]=function(_0x33aa94){utils['error'](_0xf1b3('0x7'),_0x33aa94);};exports['close']=function(){utils[_0xf1b3('0x2')](_0xf1b3('0x8'));};exports['managerevent']=function(_0x1d836e){}; \ No newline at end of file +var _0xc68f=['shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','close','[core]\x20close','managerevent','info','[core]\x20connected'];(function(_0x1ec86f,_0x43fae7){var _0x54b355=function(_0x211789){while(--_0x211789){_0x1ec86f['push'](_0x1ec86f['shift']());}};_0x54b355(++_0x43fae7);}(_0xc68f,0x1f2));var _0xfc68=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc68f[_0x3dd15e];return _0x231fd0;};'use strict';var utils=require('./utils');exports['connect']=function(){utils[_0xfc68('0x0')](_0xfc68('0x1'));};exports[_0xfc68('0x2')]=function(){utils[_0xfc68('0x0')](_0xfc68('0x3'));};exports[_0xfc68('0x4')]=function(){utils['info'](_0xfc68('0x5'));};exports[_0xfc68('0x6')]=function(_0x401f8a){utils[_0xfc68('0x6')]('[core]\x20error',_0x401f8a);};exports[_0xfc68('0x7')]=function(){utils[_0xfc68('0x0')](_0xfc68('0x8'));};exports[_0xfc68('0x9')]=function(_0x364bc2){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 80ce130..fe0fce9 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 _0xcc5d=['dialstatus','ANSWER','answertime','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','complete','endtime','holdtime','diffTime','billableseconds','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','uniqueid','application','toLowerCase','set','appdata','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','called','dialend'];(function(_0x3eb4ae,_0x493c5b){var _0x1aa0d4=function(_0x194a3b){while(--_0x194a3b){_0x3eb4ae['push'](_0x3eb4ae['shift']());}};_0x1aa0d4(++_0x493c5b);}(_0xcc5d,0x115));var _0xdcc5=function(_0xc2ae30,_0x18293c){_0xc2ae30=_0xc2ae30-0x0;var _0x531e4d=_0xcc5d[_0xc2ae30];return _0x531e4d;};'use strict';var _=require('lodash');var util=require(_0xdcc5('0x0'));var utils=require(_0xdcc5('0x1'));var dials={};function writeDB(_0x5a8c61){utils[_0xdcc5('0x2')](util[_0xdcc5('0x3')](_0xdcc5('0x4'),_0x5a8c61['uniqueid'],_0x5a8c61[_0xdcc5('0x5')],_0x5a8c61[_0xdcc5('0x6')],_0x5a8c61[_0xdcc5('0x7')],_0x5a8c61['connectedlinenum'],_0x5a8c61['dialstatus']));utils[_0xdcc5('0x8')](_0xdcc5('0x9'),_0x5a8c61);delete dials[_0x5a8c61['uniqueid']];}exports[_0xdcc5('0xa')]=function(_0x9b0c20){try{utils[_0xdcc5('0xb')](util[_0xdcc5('0x3')](_0xdcc5('0xc'),_0x9b0c20[_0xdcc5('0xd')]),_0x9b0c20);utils[_0xdcc5('0x2')](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x9b0c20[_0xdcc5('0xd')],_0x9b0c20['application'],_0x9b0c20['appdata']));if(_0x9b0c20[_0xdcc5('0xe')][_0xdcc5('0xf')]()==_0xdcc5('0x10')&&_['startsWith'](_0x9b0c20[_0xdcc5('0x11')]['toLowerCase'](),_0xdcc5('0x12'))){var _0x1e0c96=_0x9b0c20[_0xdcc5('0x11')][_0xdcc5('0x13')]('=');dials[_0x9b0c20[_0xdcc5('0xd')]]={'routeId':_0x1e0c96[0x1]};}}catch(_0x2d9305){utils[_0xdcc5('0x14')](util[_0xdcc5('0x3')](_0xdcc5('0xc'),_0x9b0c20[_0xdcc5('0xd')]),_0x2d9305);}};exports[_0xdcc5('0x15')]=function(_0x172730){try{utils[_0xdcc5('0xb')](util[_0xdcc5('0x3')](_0xdcc5('0x16'),_0x172730['uniqueid']),_0x172730);if(!_[_0xdcc5('0x17')](_0x172730[_0xdcc5('0x18')][_0xdcc5('0x19')])){utils[_0xdcc5('0x2')](util[_0xdcc5('0x3')](_0xdcc5('0x1a'),_0x172730[_0xdcc5('0xd')],_0x172730[_0xdcc5('0x1b')]));dials[_0x172730[_0xdcc5('0xd')]]={'routeId':_0x172730[_0xdcc5('0x1b')]};}}catch(_0x123d5f){utils[_0xdcc5('0x14')](util[_0xdcc5('0x3')](_0xdcc5('0x16'),_0x172730[_0xdcc5('0xd')]),_0x123d5f);}};exports[_0xdcc5('0x1c')]=function(_0x14779f){try{if(!_[_0xdcc5('0x17')](dials[_0x14779f[_0xdcc5('0xd')]])){utils[_0xdcc5('0xb')](util[_0xdcc5('0x3')](_0xdcc5('0x1d'),_0x14779f[_0xdcc5('0xd')]),_0x14779f);dials[_0x14779f[_0xdcc5('0xd')]]=_[_0xdcc5('0x1e')](dials[_0x14779f[_0xdcc5('0xd')]],_0x14779f);dials[_0x14779f[_0xdcc5('0xd')]][_0xdcc5('0x1f')]=utils[_0xdcc5('0x20')]();dials[_0x14779f['uniqueid']]['lastevent']=_0xdcc5('0x21');utils[_0xdcc5('0x2')](util['format']('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x14779f[_0xdcc5('0xd')],dials[_0x14779f[_0xdcc5('0xd')]]['starttime']));}}catch(_0x4d01c3){utils[_0xdcc5('0x14')](util[_0xdcc5('0x3')](_0xdcc5('0x1d'),_0x14779f['uniqueid']),_0x4d01c3);}};exports[_0xdcc5('0x22')]=function(_0x418954){try{if(!_[_0xdcc5('0x17')](dials[_0x418954[_0xdcc5('0xd')]])){utils[_0xdcc5('0xb')](util[_0xdcc5('0x3')]('[%s][dials][dialend]',_0x418954[_0xdcc5('0xd')]),_0x418954);dials[_0x418954[_0xdcc5('0xd')]]['dialstatus']=_0x418954['dialstatus'];if(_0x418954[_0xdcc5('0x23')]==_0xdcc5('0x24')){dials[_0x418954[_0xdcc5('0xd')]]=_[_0xdcc5('0x1e')](dials[_0x418954[_0xdcc5('0xd')]],_0x418954);dials[_0x418954[_0xdcc5('0xd')]][_0xdcc5('0x25')]=utils[_0xdcc5('0x20')]();dials[_0x418954['uniqueid']][_0xdcc5('0x26')]=_0xdcc5('0x27');utils[_0xdcc5('0x2')](util['format'](_0xdcc5('0x28'),_0x418954[_0xdcc5('0xd')],_0x418954[_0xdcc5('0x23')],dials[_0x418954[_0xdcc5('0xd')]][_0xdcc5('0x25')]));}else{utils[_0xdcc5('0x2')](util[_0xdcc5('0x3')](_0xdcc5('0x29'),_0x418954[_0xdcc5('0xd')],_0x418954['dialstatus']));}}}catch(_0x17728f){utils[_0xdcc5('0x14')](util[_0xdcc5('0x3')](_0xdcc5('0x2a'),_0x418954[_0xdcc5('0xd')]),_0x17728f);}};exports[_0xdcc5('0x2b')]=function(_0x2eb5db){try{if(!_[_0xdcc5('0x17')](dials[_0x2eb5db['uniqueid']])){utils['debug'](util[_0xdcc5('0x3')](_0xdcc5('0x2c'),_0x2eb5db['uniqueid']),_0x2eb5db);utils['info'](util[_0xdcc5('0x3')](_0xdcc5('0x2d'),_0x2eb5db[_0xdcc5('0xd')],_0x2eb5db[_0xdcc5('0x7')],_0x2eb5db[_0xdcc5('0x2e')],_0x2eb5db['cause-txt']));dials[_0x2eb5db['uniqueid']]=_['assign'](dials[_0x2eb5db[_0xdcc5('0xd')]],{'endtime':utils[_0xdcc5('0x20')](),'lastevent':_0xdcc5('0x2f')});dials[_0x2eb5db[_0xdcc5('0xd')]]['duration']=utils['diffTime'](dials[_0x2eb5db[_0xdcc5('0xd')]][_0xdcc5('0x30')],dials[_0x2eb5db['uniqueid']][_0xdcc5('0x1f')]);dials[_0x2eb5db[_0xdcc5('0xd')]][_0xdcc5('0x31')]=utils[_0xdcc5('0x32')](dials[_0x2eb5db['uniqueid']][_0xdcc5('0x25')]||dials[_0x2eb5db[_0xdcc5('0xd')]]['endtime'],dials[_0x2eb5db[_0xdcc5('0xd')]]['starttime']);dials[_0x2eb5db[_0xdcc5('0xd')]][_0xdcc5('0x33')]=dials[_0x2eb5db[_0xdcc5('0xd')]]['answertime']?utils['diffTime'](dials[_0x2eb5db[_0xdcc5('0xd')]][_0xdcc5('0x30')],dials[_0x2eb5db[_0xdcc5('0xd')]]['answertime']):0x0;writeDB(dials[_0x2eb5db[_0xdcc5('0xd')]]);}}catch(_0x598d62){utils[_0xdcc5('0x14')](util[_0xdcc5('0x3')](_0xdcc5('0x2c'),_0x2eb5db['uniqueid']),_0x598d62);}}; \ No newline at end of file +var _0x8160=['error','format','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','value','[%s][dials][dialbegin]','assign','now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','starttime','billableseconds','lodash','./utils','info','uniqueid','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','toLowerCase','startsWith','appdata','cdr(routeid)'];(function(_0x143d88,_0x16c46d){var _0x18f936=function(_0x11bdd6){while(--_0x11bdd6){_0x143d88['push'](_0x143d88['shift']());}};_0x18f936(++_0x16c46d);}(_0x8160,0x139));var _0x0816=function(_0x1311dd,_0x272df5){_0x1311dd=_0x1311dd-0x0;var _0xf168ab=_0x8160[_0x1311dd];return _0xf168ab;};'use strict';var _=require(_0x0816('0x0'));var util=require('util');var utils=require(_0x0816('0x1'));var dials={};function writeDB(_0x2a51bf){utils[_0x0816('0x2')](util['format']('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x2a51bf[_0x0816('0x3')],_0x2a51bf['channel'],_0x2a51bf['dialstring'],_0x2a51bf[_0x0816('0x4')],_0x2a51bf[_0x0816('0x5')],_0x2a51bf[_0x0816('0x6')]));utils[_0x0816('0x7')](_0x0816('0x8'),_0x2a51bf);delete dials[_0x2a51bf[_0x0816('0x3')]];}exports[_0x0816('0x9')]=function(_0x5aba73){try{utils[_0x0816('0xa')](util['format']('[%s][dials][newexten]',_0x5aba73['uniqueid']),_0x5aba73);utils['info'](util['format'](_0x0816('0xb'),_0x5aba73[_0x0816('0x3')],_0x5aba73['application'],_0x5aba73['appdata']));if(_0x5aba73['application'][_0x0816('0xc')]()=='set'&&_[_0x0816('0xd')](_0x5aba73[_0x0816('0xe')][_0x0816('0xc')](),_0x0816('0xf'))){var _0x473163=_0x5aba73[_0x0816('0xe')]['split']('=');dials[_0x5aba73[_0x0816('0x3')]]={'routeId':_0x473163[0x1]};}}catch(_0xc60614){utils[_0x0816('0x10')](util[_0x0816('0x11')]('[%s][dials][newexten]',_0x5aba73[_0x0816('0x3')]),_0xc60614);}};exports[_0x0816('0x12')]=function(_0x40b68e){try{utils['debug'](util[_0x0816('0x11')](_0x0816('0x13'),_0x40b68e[_0x0816('0x3')]),_0x40b68e);if(!_[_0x0816('0x14')](_0x40b68e[_0x0816('0x15')][_0x0816('0x16')])){utils[_0x0816('0x2')](util['format']('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x40b68e[_0x0816('0x3')],_0x40b68e[_0x0816('0x17')]));dials[_0x40b68e[_0x0816('0x3')]]={'routeId':_0x40b68e[_0x0816('0x17')]};}}catch(_0x3be236){utils[_0x0816('0x10')](util[_0x0816('0x11')]('[%s][dials][varset]',_0x40b68e['uniqueid']),_0x3be236);}};exports['dialbegin']=function(_0x274d4f){try{if(!_[_0x0816('0x14')](dials[_0x274d4f[_0x0816('0x3')]])){utils[_0x0816('0xa')](util[_0x0816('0x11')](_0x0816('0x18'),_0x274d4f[_0x0816('0x3')]),_0x274d4f);dials[_0x274d4f['uniqueid']]=_[_0x0816('0x19')](dials[_0x274d4f[_0x0816('0x3')]],_0x274d4f);dials[_0x274d4f[_0x0816('0x3')]]['starttime']=utils[_0x0816('0x1a')]();dials[_0x274d4f[_0x0816('0x3')]]['lastevent']=_0x0816('0x1b');utils['info'](util[_0x0816('0x11')](_0x0816('0x1c'),_0x274d4f[_0x0816('0x3')],dials[_0x274d4f[_0x0816('0x3')]]['starttime']));}}catch(_0x43411f){utils[_0x0816('0x10')](util[_0x0816('0x11')](_0x0816('0x18'),_0x274d4f[_0x0816('0x3')]),_0x43411f);}};exports[_0x0816('0x1d')]=function(_0x3f1f05){try{if(!_[_0x0816('0x14')](dials[_0x3f1f05['uniqueid']])){utils[_0x0816('0xa')](util[_0x0816('0x11')](_0x0816('0x1e'),_0x3f1f05[_0x0816('0x3')]),_0x3f1f05);dials[_0x3f1f05['uniqueid']][_0x0816('0x6')]=_0x3f1f05[_0x0816('0x6')];if(_0x3f1f05[_0x0816('0x6')]==_0x0816('0x1f')){dials[_0x3f1f05['uniqueid']]=_[_0x0816('0x19')](dials[_0x3f1f05['uniqueid']],_0x3f1f05);dials[_0x3f1f05[_0x0816('0x3')]][_0x0816('0x20')]=utils['now']();dials[_0x3f1f05[_0x0816('0x3')]][_0x0816('0x21')]=_0x0816('0x22');utils[_0x0816('0x2')](util[_0x0816('0x11')](_0x0816('0x23'),_0x3f1f05[_0x0816('0x3')],_0x3f1f05['dialstatus'],dials[_0x3f1f05[_0x0816('0x3')]][_0x0816('0x20')]));}else{utils[_0x0816('0x2')](util[_0x0816('0x11')]('[%s][dials][dialend]\x20dialstatus:%s',_0x3f1f05[_0x0816('0x3')],_0x3f1f05[_0x0816('0x6')]));}}}catch(_0x50613a){utils['error'](util[_0x0816('0x11')](_0x0816('0x1e'),_0x3f1f05['uniqueid']),_0x50613a);}};exports['hangup']=function(_0x4b0924){try{if(!_[_0x0816('0x14')](dials[_0x4b0924[_0x0816('0x3')]])){utils[_0x0816('0xa')](util[_0x0816('0x11')](_0x0816('0x24'),_0x4b0924[_0x0816('0x3')]),_0x4b0924);utils[_0x0816('0x2')](util[_0x0816('0x11')](_0x0816('0x25'),_0x4b0924[_0x0816('0x3')],_0x4b0924[_0x0816('0x4')],_0x4b0924[_0x0816('0x26')],_0x4b0924[_0x0816('0x27')]));dials[_0x4b0924[_0x0816('0x3')]]=_[_0x0816('0x19')](dials[_0x4b0924[_0x0816('0x3')]],{'endtime':utils[_0x0816('0x1a')](),'lastevent':_0x0816('0x28')});dials[_0x4b0924[_0x0816('0x3')]][_0x0816('0x29')]=utils[_0x0816('0x2a')](dials[_0x4b0924[_0x0816('0x3')]][_0x0816('0x2b')],dials[_0x4b0924['uniqueid']]['starttime']);dials[_0x4b0924[_0x0816('0x3')]][_0x0816('0x2c')]=utils[_0x0816('0x2a')](dials[_0x4b0924[_0x0816('0x3')]]['answertime']||dials[_0x4b0924[_0x0816('0x3')]][_0x0816('0x2b')],dials[_0x4b0924[_0x0816('0x3')]][_0x0816('0x2d')]);dials[_0x4b0924[_0x0816('0x3')]][_0x0816('0x2e')]=dials[_0x4b0924[_0x0816('0x3')]][_0x0816('0x20')]?utils[_0x0816('0x2a')](dials[_0x4b0924['uniqueid']]['endtime'],dials[_0x4b0924[_0x0816('0x3')]]['answertime']):0x0;writeDB(dials[_0x4b0924[_0x0816('0x3')]]);}}catch(_0x387502){utils[_0x0816('0x10')](util[_0x0816('0x11')](_0x0816('0x24'),_0x4b0924[_0x0816('0x3')]),_0x387502);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 1bd23ac..2ebf83e 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 _0x9498=['agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','asterisk','username','keepConnected','xdr','disabled','info','./agents.controller','./queues.controller','./transfers.controller','./core.controller','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','device','[%s][index][devicestatechange]'];(function(_0x16e8da,_0x3f4f97){var _0x462bc1=function(_0x18fc9c){while(--_0x18fc9c){_0x16e8da['push'](_0x16e8da['shift']());}};_0x462bc1(++_0x3f4f97);}(_0x9498,0x19c));var _0x8949=function(_0x93a7a9,_0x430651){_0x93a7a9=_0x93a7a9-0x0;var _0x151c25=_0x9498[_0x93a7a9];return _0x151c25;};var AsteriskManager=require(_0x8949('0x0'));var config=require(_0x8949('0x1'));var utils=require(_0x8949('0x2'));var util=require('util');var ami=new AsteriskManager(config['asterisk']['port'],config[_0x8949('0x3')]['ip'],config[_0x8949('0x3')][_0x8949('0x4')],config['asterisk']['password'],!![]);ami[_0x8949('0x5')]();if(config[_0x8949('0x6')]&&config[_0x8949('0x6')][_0x8949('0x7')]){utils[_0x8949('0x8')]('XDR\x20DISABLED');}else{var agents=require(_0x8949('0x9'));var calls=require('./calls.controller');var queues=require(_0x8949('0xa'));var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0x8949('0xb'));var core=require(_0x8949('0xc'));ami['on']('connect',core['connect']);ami['on'](_0x8949('0xd'),core['shutdown']);ami['on'](_0x8949('0xe'),core[_0x8949('0xe')]);ami['on'](_0x8949('0xf'),core['error']);ami['on'](_0x8949('0x10'),core[_0x8949('0x10')]);ami['on']('managerevent',core[_0x8949('0x11')]);ami['on'](_0x8949('0x12'),function(_0x16783c){try{utils['debug'](util[_0x8949('0x13')]('[%s][index][devicestatechange]',_0x16783c[_0x8949('0x14')]),_0x16783c);members[_0x8949('0x12')](_0x16783c);}catch(_0x370e0e){utils[_0x8949('0xf')](util[_0x8949('0x13')](_0x8949('0x15'),_0x16783c['device']),_0x370e0e);}});ami['on'](_0x8949('0x16'),function(_0x1370ed){try{utils[_0x8949('0x17')](util[_0x8949('0x13')](_0x8949('0x18'),_0x1370ed[_0x8949('0x19')]),_0x1370ed);agents[_0x8949('0x16')](_0x1370ed);}catch(_0x548c98){utils[_0x8949('0xf')](util[_0x8949('0x13')]('[%s][index][agentcalled]',_0x1370ed[_0x8949('0x19')]),_0x548c98);}});ami['on'](_0x8949('0x1a'),function(_0x5d4800){try{utils[_0x8949('0x17')](util[_0x8949('0x13')]('[%s][index][agentringnoanswer]',_0x5d4800[_0x8949('0x19')]),_0x5d4800);agents[_0x8949('0x1a')](_0x5d4800);}catch(_0xbb197f){utils[_0x8949('0xf')](util[_0x8949('0x13')](_0x8949('0x1b'),_0x5d4800['uniqueid']),_0xbb197f);}});ami['on'](_0x8949('0x1c'),function(_0x427d52){try{utils[_0x8949('0x17')](util[_0x8949('0x13')](_0x8949('0x1d'),_0x427d52[_0x8949('0x19')]),_0x427d52);agents[_0x8949('0x1c')](_0x427d52);queues[_0x8949('0x1c')](_0x427d52);}catch(_0x3fd24b){utils[_0x8949('0xf')](util[_0x8949('0x13')](_0x8949('0x1d'),_0x427d52[_0x8949('0x19')]),_0x3fd24b);}});ami['on'](_0x8949('0x1e'),function(_0x1ec56c){try{utils[_0x8949('0x17')](util[_0x8949('0x13')](_0x8949('0x1f'),_0x1ec56c[_0x8949('0x19')]),_0x1ec56c);agents[_0x8949('0x1e')](_0x1ec56c);queues[_0x8949('0x1e')](_0x1ec56c);members[_0x8949('0x1e')](_0x1ec56c);}catch(_0x13f1ef){utils['error'](util[_0x8949('0x13')]('[%s][index][agentcomplete]',_0x1ec56c[_0x8949('0x19')]),_0x13f1ef);}});ami['on']('queuecallerabandon',function(_0x5dbd71){try{utils[_0x8949('0x17')](util[_0x8949('0x13')](_0x8949('0x20'),_0x5dbd71[_0x8949('0x19')]),_0x5dbd71);agents[_0x8949('0x21')](_0x5dbd71);queues['queuecallerabandon'](_0x5dbd71);}catch(_0xe26b6f){utils['error'](util[_0x8949('0x13')]('[%s][index][queuecallerabandon]',_0x5dbd71['uniqueid']),_0xe26b6f);}});ami['on'](_0x8949('0x22'),function(_0x7f341d){try{utils[_0x8949('0x17')](util[_0x8949('0x13')](_0x8949('0x23'),_0x7f341d[_0x8949('0x19')]),_0x7f341d);queues[_0x8949('0x22')](_0x7f341d);recordings[_0x8949('0x22')](_0x7f341d);}catch(_0x33d7b2){utils[_0x8949('0xf')](util[_0x8949('0x13')]('[%s][index][queuecallerjoin]',_0x7f341d['uniqueid']),_0x33d7b2);}});ami['on']('queuecallerleave',function(_0x83d87f){try{utils[_0x8949('0x17')](util['format'](_0x8949('0x24'),_0x83d87f[_0x8949('0x19')]),_0x83d87f);queues[_0x8949('0x25')](_0x83d87f);}catch(_0x3baf41){utils[_0x8949('0xf')](util[_0x8949('0x13')](_0x8949('0x24'),_0x83d87f[_0x8949('0x19')]),_0x3baf41);}});ami['on'](_0x8949('0x26'),function(_0x2e9db1){try{utils[_0x8949('0x17')](util[_0x8949('0x13')](_0x8949('0x27'),_0x2e9db1[_0x8949('0x19')]),_0x2e9db1);queues[_0x8949('0x26')](_0x2e9db1);calls[_0x8949('0x26')](_0x2e9db1);}catch(_0x1e2ede){utils[_0x8949('0xf')](util['format'](_0x8949('0x27'),_0x2e9db1[_0x8949('0x19')]),_0x1e2ede);}});ami['on'](_0x8949('0x28'),function(_0x34898f){try{utils[_0x8949('0x17')](util[_0x8949('0x13')](_0x8949('0x29'),_0x34898f[_0x8949('0x19')]),_0x34898f);queues[_0x8949('0x28')](_0x34898f);calls[_0x8949('0x28')](_0x34898f);}catch(_0x542667){utils[_0x8949('0xf')](util['format'](_0x8949('0x29'),_0x34898f[_0x8949('0x19')]),_0x542667);}});ami['on'](_0x8949('0x2a'),function(_0x81e0c3){try{utils[_0x8949('0x17')](util[_0x8949('0x13')](_0x8949('0x2b'),_0x81e0c3['uniqueid']),_0x81e0c3);calls['newstate'](_0x81e0c3);recordings[_0x8949('0x2a')](_0x81e0c3);}catch(_0x27a459){utils[_0x8949('0xf')](util[_0x8949('0x13')](_0x8949('0x2b'),_0x81e0c3['uniqueid']),_0x27a459);}});ami['on'](_0x8949('0x2c'),function(_0x2c0589){try{utils[_0x8949('0x17')](util[_0x8949('0x13')]('[%s][index][hangup]',_0x2c0589['uniqueid']),_0x2c0589);calls['hangup'](_0x2c0589);recordings[_0x8949('0x2c')](_0x2c0589);dials[_0x8949('0x2c')](_0x2c0589);agents[_0x8949('0x2c')](_0x2c0589);queues[_0x8949('0x2c')](_0x2c0589);}catch(_0x41cda1){utils['error'](util[_0x8949('0x13')]('[%s][index][hangup]',_0x2c0589['uniqueid']),_0x41cda1);}});ami['on'](_0x8949('0x2d'),function(_0x36ec7c){try{utils['debug'](util[_0x8949('0x13')](_0x8949('0x2e'),_0x36ec7c[_0x8949('0x19')]),_0x36ec7c);members[_0x8949('0x2d')](_0x36ec7c);}catch(_0x102997){utils[_0x8949('0xf')](util[_0x8949('0x13')]('[%s][index][cdr]',_0x36ec7c[_0x8949('0x19')]),_0x102997);}});ami['on'](_0x8949('0x2f'),function(_0x10257e){try{utils[_0x8949('0x17')](util[_0x8949('0x13')](_0x8949('0x30'),_0x10257e['uniqueid']),_0x10257e);queues[_0x8949('0x2f')](_0x10257e);agents[_0x8949('0x2f')](_0x10257e);transfers[_0x8949('0x2f')](_0x10257e);}catch(_0x3bea82){utils['error'](util['format']('[%s][index][blindtransfer]',_0x10257e[_0x8949('0x19')]),_0x3bea82);}});ami['on']('attendedtransfer',function(_0x331e01){try{utils[_0x8949('0x17')](util[_0x8949('0x13')](_0x8949('0x31'),_0x331e01[_0x8949('0x32')]),_0x331e01);queues[_0x8949('0x33')](_0x331e01);transfers['attendedtransfer'](_0x331e01);agents[_0x8949('0x33')](_0x331e01);calls[_0x8949('0x33')](_0x331e01);}catch(_0xead868){utils[_0x8949('0xf')](util[_0x8949('0x13')](_0x8949('0x31'),_0x331e01[_0x8949('0x32')]),_0xead868);}});ami['on'](_0x8949('0x34'),function(_0x43e316){try{utils[_0x8949('0x17')](util[_0x8949('0x13')](_0x8949('0x35'),_0x43e316[_0x8949('0x19')]),_0x43e316);queues[_0x8949('0x34')](_0x43e316);recordings[_0x8949('0x34')](_0x43e316);calls[_0x8949('0x34')](_0x43e316);dials[_0x8949('0x34')](_0x43e316);}catch(_0x5cb403){utils[_0x8949('0xf')](util['format']('[%s][index][varset]',_0x43e316[_0x8949('0x19')]),_0x5cb403);}});ami['on']('newexten',function(_0x5abdc2){try{utils['debug'](util[_0x8949('0x13')](_0x8949('0x36'),_0x5abdc2[_0x8949('0x19')]),_0x5abdc2);calls[_0x8949('0x37')](_0x5abdc2);recordings[_0x8949('0x37')](_0x5abdc2);dials[_0x8949('0x37')](_0x5abdc2);}catch(_0x2900fd){utils[_0x8949('0xf')](util[_0x8949('0x13')](_0x8949('0x36'),_0x5abdc2[_0x8949('0x19')]),_0x2900fd);}});ami['on'](_0x8949('0x38'),function(_0x317ac2){try{utils[_0x8949('0x17')](util[_0x8949('0x13')](_0x8949('0x39'),_0x317ac2['uniqueid']),_0x317ac2);calls[_0x8949('0x38')](_0x317ac2);recordings[_0x8949('0x38')](_0x317ac2);}catch(_0x45230c){utils[_0x8949('0xf')](util['format']('[%s][index][newchannel]',_0x317ac2['uniqueid']),_0x45230c);}});ami['on'](_0x8949('0x3a'),function(_0x53481c){try{utils['debug'](util[_0x8949('0x13')]('[%s][index][dialbegin]',_0x53481c[_0x8949('0x19')]),_0x53481c);dials[_0x8949('0x3a')](_0x53481c);}catch(_0x51f074){utils[_0x8949('0xf')](util[_0x8949('0x13')](_0x8949('0x3b'),_0x53481c[_0x8949('0x19')]),_0x51f074);}});ami['on'](_0x8949('0x3c'),function(_0x563c7e){try{utils[_0x8949('0x17')](util['format'](_0x8949('0x3d'),_0x563c7e['uniqueid']),_0x563c7e);dials[_0x8949('0x3c')](_0x563c7e);}catch(_0x3c922a){utils[_0x8949('0xf')](util[_0x8949('0x13')](_0x8949('0x3d'),_0x563c7e[_0x8949('0x19')]),_0x3c922a);}});} \ No newline at end of file +var _0x71ee=['queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','../../config/environment','./utils','port','asterisk','username','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','[%s][index][devicestatechange]','devicestatechange','format','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x71ee,0xa1));var _0xe71e=function(_0x356596,_0x1a1a8c){_0x356596=_0x356596-0x0;var _0x231fa9=_0x71ee[_0x356596];return _0x231fa9;};var AsteriskManager=require('asterisk-manager');var config=require(_0xe71e('0x0'));var utils=require(_0xe71e('0x1'));var util=require('util');var ami=new AsteriskManager(config['asterisk'][_0xe71e('0x2')],config[_0xe71e('0x3')]['ip'],config['asterisk'][_0xe71e('0x4')],config['asterisk']['password'],!![]);ami[_0xe71e('0x5')]();if(config[_0xe71e('0x6')]&&config[_0xe71e('0x6')][_0xe71e('0x7')]){utils[_0xe71e('0x8')](_0xe71e('0x9'));}else{var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require(_0xe71e('0xa'));var recordings=require(_0xe71e('0xb'));var members=require(_0xe71e('0xc'));var dials=require(_0xe71e('0xd'));var transfers=require(_0xe71e('0xe'));var core=require(_0xe71e('0xf'));ami['on'](_0xe71e('0x10'),core[_0xe71e('0x10')]);ami['on'](_0xe71e('0x11'),core[_0xe71e('0x11')]);ami['on']('fullybooted',core[_0xe71e('0x12')]);ami['on'](_0xe71e('0x13'),core['error']);ami['on'](_0xe71e('0x14'),core[_0xe71e('0x14')]);ami['on'](_0xe71e('0x15'),core[_0xe71e('0x15')]);ami['on']('devicestatechange',function(_0x441c8e){try{utils[_0xe71e('0x16')](util['format'](_0xe71e('0x17'),_0x441c8e['device']),_0x441c8e);members[_0xe71e('0x18')](_0x441c8e);}catch(_0x21b759){utils[_0xe71e('0x13')](util[_0xe71e('0x19')](_0xe71e('0x17'),_0x441c8e[_0xe71e('0x1a')]),_0x21b759);}});ami['on'](_0xe71e('0x1b'),function(_0x448eba){try{utils[_0xe71e('0x16')](util[_0xe71e('0x19')]('[%s][index][agentcalled]',_0x448eba['uniqueid']),_0x448eba);agents[_0xe71e('0x1b')](_0x448eba);}catch(_0x4349c2){utils[_0xe71e('0x13')](util[_0xe71e('0x19')](_0xe71e('0x1c'),_0x448eba[_0xe71e('0x1d')]),_0x4349c2);}});ami['on'](_0xe71e('0x1e'),function(_0x453c1d){try{utils[_0xe71e('0x16')](util[_0xe71e('0x19')](_0xe71e('0x1f'),_0x453c1d['uniqueid']),_0x453c1d);agents[_0xe71e('0x1e')](_0x453c1d);}catch(_0x1896bd){utils[_0xe71e('0x13')](util[_0xe71e('0x19')](_0xe71e('0x1f'),_0x453c1d[_0xe71e('0x1d')]),_0x1896bd);}});ami['on'](_0xe71e('0x20'),function(_0x386671){try{utils[_0xe71e('0x16')](util[_0xe71e('0x19')](_0xe71e('0x21'),_0x386671['uniqueid']),_0x386671);agents['agentconnect'](_0x386671);queues['agentconnect'](_0x386671);}catch(_0xf044ac){utils['error'](util[_0xe71e('0x19')](_0xe71e('0x21'),_0x386671[_0xe71e('0x1d')]),_0xf044ac);}});ami['on'](_0xe71e('0x22'),function(_0x285614){try{utils['debug'](util[_0xe71e('0x19')](_0xe71e('0x23'),_0x285614['uniqueid']),_0x285614);agents[_0xe71e('0x22')](_0x285614);queues[_0xe71e('0x22')](_0x285614);members[_0xe71e('0x22')](_0x285614);}catch(_0x4f39af){utils[_0xe71e('0x13')](util[_0xe71e('0x19')](_0xe71e('0x23'),_0x285614['uniqueid']),_0x4f39af);}});ami['on'](_0xe71e('0x24'),function(_0x2495a2){try{utils['debug'](util[_0xe71e('0x19')](_0xe71e('0x25'),_0x2495a2[_0xe71e('0x1d')]),_0x2495a2);agents['queuecallerabandon'](_0x2495a2);queues[_0xe71e('0x24')](_0x2495a2);}catch(_0x3098b0){utils[_0xe71e('0x13')](util[_0xe71e('0x19')](_0xe71e('0x25'),_0x2495a2[_0xe71e('0x1d')]),_0x3098b0);}});ami['on'](_0xe71e('0x26'),function(_0x38975c){try{utils[_0xe71e('0x16')](util['format'](_0xe71e('0x27'),_0x38975c['uniqueid']),_0x38975c);queues[_0xe71e('0x26')](_0x38975c);recordings[_0xe71e('0x26')](_0x38975c);}catch(_0x46e74b){utils[_0xe71e('0x13')](util[_0xe71e('0x19')](_0xe71e('0x27'),_0x38975c['uniqueid']),_0x46e74b);}});ami['on'](_0xe71e('0x28'),function(_0x4a07d4){try{utils[_0xe71e('0x16')](util[_0xe71e('0x19')]('[%s][index][queuecallerleave]',_0x4a07d4[_0xe71e('0x1d')]),_0x4a07d4);queues[_0xe71e('0x28')](_0x4a07d4);}catch(_0xfe98df){utils[_0xe71e('0x13')](util[_0xe71e('0x19')](_0xe71e('0x29'),_0x4a07d4[_0xe71e('0x1d')]),_0xfe98df);}});ami['on'](_0xe71e('0x2a'),function(_0x2d8891){try{utils['debug'](util[_0xe71e('0x19')](_0xe71e('0x2b'),_0x2d8891[_0xe71e('0x1d')]),_0x2d8891);queues['musiconholdstart'](_0x2d8891);calls[_0xe71e('0x2a')](_0x2d8891);}catch(_0x492a17){utils[_0xe71e('0x13')](util['format'](_0xe71e('0x2b'),_0x2d8891[_0xe71e('0x1d')]),_0x492a17);}});ami['on'](_0xe71e('0x2c'),function(_0x3bceb5){try{utils[_0xe71e('0x16')](util[_0xe71e('0x19')](_0xe71e('0x2d'),_0x3bceb5[_0xe71e('0x1d')]),_0x3bceb5);queues[_0xe71e('0x2c')](_0x3bceb5);calls[_0xe71e('0x2c')](_0x3bceb5);}catch(_0x183294){utils['error'](util[_0xe71e('0x19')]('[%s][index][musiconholdstop]',_0x3bceb5[_0xe71e('0x1d')]),_0x183294);}});ami['on']('newstate',function(_0x33cab9){try{utils[_0xe71e('0x16')](util[_0xe71e('0x19')](_0xe71e('0x2e'),_0x33cab9[_0xe71e('0x1d')]),_0x33cab9);calls[_0xe71e('0x2f')](_0x33cab9);recordings[_0xe71e('0x2f')](_0x33cab9);}catch(_0x2d624d){utils[_0xe71e('0x13')](util[_0xe71e('0x19')](_0xe71e('0x2e'),_0x33cab9[_0xe71e('0x1d')]),_0x2d624d);}});ami['on'](_0xe71e('0x30'),function(_0x1f15d9){try{utils[_0xe71e('0x16')](util['format'](_0xe71e('0x31'),_0x1f15d9[_0xe71e('0x1d')]),_0x1f15d9);calls[_0xe71e('0x30')](_0x1f15d9);recordings['hangup'](_0x1f15d9);dials['hangup'](_0x1f15d9);agents[_0xe71e('0x30')](_0x1f15d9);queues[_0xe71e('0x30')](_0x1f15d9);}catch(_0x18c064){utils[_0xe71e('0x13')](util[_0xe71e('0x19')]('[%s][index][hangup]',_0x1f15d9[_0xe71e('0x1d')]),_0x18c064);}});ami['on']('cdr',function(_0x50ab2c){try{utils[_0xe71e('0x16')](util[_0xe71e('0x19')](_0xe71e('0x32'),_0x50ab2c['uniqueid']),_0x50ab2c);members[_0xe71e('0x33')](_0x50ab2c);}catch(_0xa1c9cc){utils['error'](util['format'](_0xe71e('0x32'),_0x50ab2c[_0xe71e('0x1d')]),_0xa1c9cc);}});ami['on'](_0xe71e('0x34'),function(_0x679e99){try{utils[_0xe71e('0x16')](util['format']('[%s][index][blindtransfer]',_0x679e99[_0xe71e('0x1d')]),_0x679e99);queues['blindtransfer'](_0x679e99);agents[_0xe71e('0x34')](_0x679e99);transfers['blindtransfer'](_0x679e99);}catch(_0x380fd3){utils['error'](util[_0xe71e('0x19')](_0xe71e('0x35'),_0x679e99['uniqueid']),_0x380fd3);}});ami['on'](_0xe71e('0x36'),function(_0x3bd331){try{utils['debug'](util[_0xe71e('0x19')](_0xe71e('0x37'),_0x3bd331[_0xe71e('0x38')]),_0x3bd331);queues[_0xe71e('0x36')](_0x3bd331);transfers[_0xe71e('0x36')](_0x3bd331);agents[_0xe71e('0x36')](_0x3bd331);calls['attendedtransfer'](_0x3bd331);}catch(_0x417f20){utils[_0xe71e('0x13')](util['format'](_0xe71e('0x37'),_0x3bd331[_0xe71e('0x38')]),_0x417f20);}});ami['on'](_0xe71e('0x39'),function(_0x19e9ff){try{utils[_0xe71e('0x16')](util[_0xe71e('0x19')](_0xe71e('0x3a'),_0x19e9ff[_0xe71e('0x1d')]),_0x19e9ff);queues['varset'](_0x19e9ff);recordings[_0xe71e('0x39')](_0x19e9ff);calls[_0xe71e('0x39')](_0x19e9ff);dials['varset'](_0x19e9ff);}catch(_0x796661){utils[_0xe71e('0x13')](util[_0xe71e('0x19')]('[%s][index][varset]',_0x19e9ff[_0xe71e('0x1d')]),_0x796661);}});ami['on'](_0xe71e('0x3b'),function(_0x3b68af){try{utils[_0xe71e('0x16')](util[_0xe71e('0x19')](_0xe71e('0x3c'),_0x3b68af[_0xe71e('0x1d')]),_0x3b68af);calls['newexten'](_0x3b68af);recordings[_0xe71e('0x3b')](_0x3b68af);dials[_0xe71e('0x3b')](_0x3b68af);}catch(_0x581646){utils[_0xe71e('0x13')](util[_0xe71e('0x19')](_0xe71e('0x3c'),_0x3b68af[_0xe71e('0x1d')]),_0x581646);}});ami['on'](_0xe71e('0x3d'),function(_0x59bf8f){try{utils['debug'](util[_0xe71e('0x19')]('[%s][index][newchannel]',_0x59bf8f[_0xe71e('0x1d')]),_0x59bf8f);calls[_0xe71e('0x3d')](_0x59bf8f);recordings[_0xe71e('0x3d')](_0x59bf8f);}catch(_0x4f9ac1){utils['error'](util['format'](_0xe71e('0x3e'),_0x59bf8f[_0xe71e('0x1d')]),_0x4f9ac1);}});ami['on'](_0xe71e('0x3f'),function(_0x5a7adf){try{utils[_0xe71e('0x16')](util[_0xe71e('0x19')](_0xe71e('0x40'),_0x5a7adf[_0xe71e('0x1d')]),_0x5a7adf);dials['dialbegin'](_0x5a7adf);}catch(_0x42fbb7){utils[_0xe71e('0x13')](util[_0xe71e('0x19')](_0xe71e('0x41'),_0x5a7adf['uniqueid']),_0x42fbb7);}});ami['on'](_0xe71e('0x42'),function(_0x54d40d){try{utils['debug'](util[_0xe71e('0x19')]('[%s][index][dialend]',_0x54d40d[_0xe71e('0x1d')]),_0x54d40d);dials[_0xe71e('0x42')](_0x54d40d);}catch(_0x59a9c0){utils[_0xe71e('0x13')](util[_0xe71e('0x19')]('[%s][index][dialend]',_0x54d40d[_0xe71e('0x1d')]),_0x59a9c0);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index de47001..5ffa12f 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 _0xbab3=['destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','split','lodash','./utils','Local/_attended@transfer','Queue:','info','interface','data2','membername','type','getUserByInterface','then','name','internal','request','getUserByName','CreateMemberReport','catch','error','format','[%s][members][writeDB]','uniqueid','some','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','TALKING','agent','NOT_INUSE','exitAt','now','duration','enterAt','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','[%s][members][cdr]','data1','source','data3'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xbab3,0x130));var _0x3bab=function(_0x22b0cb,_0x5a764a){_0x22b0cb=_0x22b0cb-0x0;var _0x444178=_0xbab3[_0x22b0cb];return _0x444178;};'use strict';var _=require(_0x3bab('0x0'));var util=require('util');var utils=require(_0x3bab('0x1'));var members={};var exclude=[_0x3bab('0x2'),_0x3bab('0x3')];function writeDB(_0x54da45){utils[_0x3bab('0x4')](util['format']('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x54da45['uniqueid'],_0x54da45[_0x3bab('0x5')],_0x54da45['channel'],_0x54da45[_0x3bab('0x6')],_0x54da45[_0x3bab('0x7')],_0x54da45[_0x3bab('0x8')]));if(_0x54da45[_0x3bab('0x5')]){utils[_0x3bab('0x9')](_0x54da45[_0x3bab('0x5')])[_0x3bab('0xa')](function(_0x31b4a9){if(_0x31b4a9){_0x54da45[_0x3bab('0x7')]=_0x31b4a9[_0x3bab('0xb')];_0x54da45[_0x3bab('0xc')]=_0x31b4a9['internal'];utils[_0x3bab('0xd')]('CreateMemberReport',_0x54da45);}else{utils[_0x3bab('0xe')](_0x54da45[_0x3bab('0x5')]['split']('/')[0x1])[_0x3bab('0xa')](function(_0x1ebce4){if(_0x1ebce4){_0x54da45[_0x3bab('0x7')]=_0x1ebce4[_0x3bab('0xb')];_0x54da45[_0x3bab('0xc')]=_0x1ebce4[_0x3bab('0xc')];utils[_0x3bab('0xd')](_0x3bab('0xf'),_0x54da45);}});}})[_0x3bab('0x10')](function(_0x10d3ca){utils[_0x3bab('0x11')](util[_0x3bab('0x12')](_0x3bab('0x13'),_0x54da45[_0x3bab('0x14')]),_0x10d3ca);});}delete members[_0x54da45[_0x3bab('0x5')]];}function startsWith(_0x173d14,_0x12a2a0){return _[_0x3bab('0x15')](_0x173d14,function(_0x51b3e3){return _['startsWith'](_0x12a2a0,_0x51b3e3);});}exports['devicestatechange']=function(_0x1af796){try{utils[_0x3bab('0x16')](util[_0x3bab('0x12')](_0x3bab('0x17'),members[_0x1af796[_0x3bab('0x18')]]?members[_0x1af796[_0x3bab('0x18')]][_0x3bab('0x14')]:_0x1af796[_0x3bab('0x18')]),_0x1af796);utils[_0x3bab('0x4')](util['format'](_0x3bab('0x19'),members[_0x1af796[_0x3bab('0x18')]]?members[_0x1af796[_0x3bab('0x18')]]['uniqueid']:_0x1af796[_0x3bab('0x18')],_0x1af796[_0x3bab('0x1a')],_0x1af796[_0x3bab('0x18')]));switch(_0x1af796['state']){case _0x3bab('0x1b'):case'BUSY':if(!startsWith(exclude,_0x1af796[_0x3bab('0x18')])){members[_0x1af796[_0x3bab('0x18')]]={'channel':_0x3bab('0x1c'),'interface':_0x1af796[_0x3bab('0x18')],'type':_0x3bab('0x1d'),'enterAt':utils['now'](),'role':_0x3bab('0x1e')};}break;case _0x3bab('0x1f'):if(!_['isNil'](members[_0x1af796['device']])){members[_0x1af796[_0x3bab('0x18')]][_0x3bab('0x20')]=utils[_0x3bab('0x21')]();members[_0x1af796[_0x3bab('0x18')]][_0x3bab('0x22')]=utils['diffTime'](members[_0x1af796[_0x3bab('0x18')]][_0x3bab('0x20')],members[_0x1af796[_0x3bab('0x18')]][_0x3bab('0x23')]);if(members[_0x1af796['device']][_0x3bab('0x14')]){writeDB(members[_0x1af796[_0x3bab('0x18')]]);}}break;default:break;}}catch(_0x1a7e66){utils['error'](util[_0x3bab('0x12')](_0x3bab('0x17'),members[_0x1af796['device']]?members[_0x1af796[_0x3bab('0x18')]]['uniqueid']:_0x1af796[_0x3bab('0x18')]),_0x1a7e66);}};exports['agentcomplete']=function(_0x15513e){try{if(!_[_0x3bab('0x24')](members[_0x15513e[_0x3bab('0x5')]])){utils['debug'](util['format'](_0x3bab('0x25'),_0x15513e[_0x3bab('0x14')]),_0x15513e);utils['info'](util[_0x3bab('0x12')](_0x3bab('0x26'),_0x15513e[_0x3bab('0x14')],_0x15513e['interface'],_0x15513e['queue']));members[_0x15513e[_0x3bab('0x5')]]=_[_0x3bab('0x27')](members[_0x15513e[_0x3bab('0x5')]],{'data4':_0x15513e[_0x3bab('0x28')],'uniqueid':_0x15513e['uniqueid']});}}catch(_0x4b2b94){utils[_0x3bab('0x11')](util[_0x3bab('0x12')](_0x3bab('0x25'),_0x15513e[_0x3bab('0x14')]),_0x4b2b94);}};exports[_0x3bab('0x29')]=function(_0x1ba60d){try{utils['debug'](util[_0x3bab('0x12')](_0x3bab('0x2a'),_0x1ba60d[_0x3bab('0x14')]),_0x1ba60d);if(_0x1ba60d['channel']){var _0x2c09bc=_0x1ba60d['channel']['split']('-')[0x0];if(!_[_0x3bab('0x24')](members[_0x2c09bc])){members[_0x2c09bc]=_[_0x3bab('0x27')](members[_0x2c09bc],{'data1':members[_0x2c09bc][_0x3bab('0x2b')]||_0x1ba60d['type'],'data2':members[_0x2c09bc]['data2']||_0x1ba60d[_0x3bab('0x2c')],'data3':members[_0x2c09bc][_0x3bab('0x2d')]||_0x1ba60d[_0x3bab('0x2e')],'uniqueid':members[_0x2c09bc][_0x3bab('0x14')]||_0x1ba60d[_0x3bab('0x14')]});utils[_0x3bab('0x4')](util[_0x3bab('0x12')](_0x3bab('0x2f'),_0x1ba60d[_0x3bab('0x14')],members[_0x2c09bc][_0x3bab('0x2b')],members[_0x2c09bc][_0x3bab('0x6')],members[_0x2c09bc][_0x3bab('0x2d')]));if(members[_0x2c09bc]['exitAt']){writeDB(members[_0x2c09bc]);}}}if(_0x1ba60d[_0x3bab('0x30')]){var _0xd462c3=_0x1ba60d['destinationchannel'][_0x3bab('0x31')]('-')[0x0];if(!_[_0x3bab('0x24')](members[_0xd462c3])){members[_0xd462c3]=_[_0x3bab('0x27')](members[_0xd462c3],{'data1':members[_0xd462c3][_0x3bab('0x2b')]||_0x1ba60d['type'],'data2':members[_0xd462c3][_0x3bab('0x6')]||_0x1ba60d[_0x3bab('0x2c')],'data3':members[_0xd462c3][_0x3bab('0x2d')]||_0x1ba60d[_0x3bab('0x2e')],'uniqueid':members[_0xd462c3][_0x3bab('0x14')]||_0x1ba60d[_0x3bab('0x14')]});utils[_0x3bab('0x4')](util[_0x3bab('0x12')](_0x3bab('0x2f'),_0x1ba60d[_0x3bab('0x14')],members[_0xd462c3][_0x3bab('0x2b')],members[_0xd462c3][_0x3bab('0x6')],members[_0xd462c3][_0x3bab('0x2d')]));if(members[_0xd462c3][_0x3bab('0x20')]){writeDB(members[_0xd462c3]);}}}}catch(_0x1ace0c){utils[_0x3bab('0x11')](util['format'](_0x3bab('0x2a'),_0x1ba60d[_0x3bab('0x14')]),_0x1ace0c);}}; \ No newline at end of file +var _0x06fe=['queue','assign','cdr','[%s][members][cdr]','source','destination','data1','destinationchannel','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','./utils','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','channel','data2','membername','type','interface','then','name','internal','request','split','CreateMemberReport','catch','some','devicestatechange','device','uniqueid','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','agent','NOT_INUSE','isNil','now','diffTime','exitAt','enterAt','error','[%s][members][devicestatechange]','agentcomplete','debug','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s'];(function(_0x32cc8a,_0x500424){var _0x5eb4e3=function(_0x45adbb){while(--_0x45adbb){_0x32cc8a['push'](_0x32cc8a['shift']());}};_0x5eb4e3(++_0x500424);}(_0x06fe,0xff));var _0xe06f=function(_0x4392af,_0xec5afe){_0x4392af=_0x4392af-0x0;var _0x9fa8eb=_0x06fe[_0x4392af];return _0x9fa8eb;};'use strict';var _=require(_0xe06f('0x0'));var util=require('util');var utils=require(_0xe06f('0x1'));var members={};var exclude=['Local/_attended@transfer',_0xe06f('0x2')];function writeDB(_0x139f7e){utils['info'](util[_0xe06f('0x3')](_0xe06f('0x4'),_0x139f7e['uniqueid'],_0x139f7e['interface'],_0x139f7e[_0xe06f('0x5')],_0x139f7e[_0xe06f('0x6')],_0x139f7e[_0xe06f('0x7')],_0x139f7e[_0xe06f('0x8')]));if(_0x139f7e[_0xe06f('0x9')]){utils['getUserByInterface'](_0x139f7e['interface'])[_0xe06f('0xa')](function(_0x15bf60){if(_0x15bf60){_0x139f7e['membername']=_0x15bf60[_0xe06f('0xb')];_0x139f7e[_0xe06f('0xc')]=_0x15bf60['internal'];utils[_0xe06f('0xd')]('CreateMemberReport',_0x139f7e);}else{utils['getUserByName'](_0x139f7e[_0xe06f('0x9')][_0xe06f('0xe')]('/')[0x1])[_0xe06f('0xa')](function(_0x32373f){if(_0x32373f){_0x139f7e[_0xe06f('0x7')]=_0x32373f['name'];_0x139f7e[_0xe06f('0xc')]=_0x32373f[_0xe06f('0xc')];utils[_0xe06f('0xd')](_0xe06f('0xf'),_0x139f7e);}});}})[_0xe06f('0x10')](function(_0x3018e2){utils['error'](util[_0xe06f('0x3')]('[%s][members][writeDB]',_0x139f7e['uniqueid']),_0x3018e2);});}delete members[_0x139f7e[_0xe06f('0x9')]];}function startsWith(_0x4caa18,_0x52fd57){return _[_0xe06f('0x11')](_0x4caa18,function(_0x47069){return _['startsWith'](_0x52fd57,_0x47069);});}exports[_0xe06f('0x12')]=function(_0x270aee){try{utils['debug'](util[_0xe06f('0x3')]('[%s][members][devicestatechange]',members[_0x270aee['device']]?members[_0x270aee[_0xe06f('0x13')]][_0xe06f('0x14')]:_0x270aee[_0xe06f('0x13')]),_0x270aee);utils[_0xe06f('0x15')](util[_0xe06f('0x3')](_0xe06f('0x16'),members[_0x270aee[_0xe06f('0x13')]]?members[_0x270aee['device']]['uniqueid']:_0x270aee[_0xe06f('0x13')],_0x270aee[_0xe06f('0x17')],_0x270aee[_0xe06f('0x13')]));switch(_0x270aee['state']){case _0xe06f('0x18'):case _0xe06f('0x19'):if(!startsWith(exclude,_0x270aee[_0xe06f('0x13')])){members[_0x270aee['device']]={'channel':'voice','interface':_0x270aee[_0xe06f('0x13')],'type':'TALKING','enterAt':utils['now'](),'role':_0xe06f('0x1a')};}break;case _0xe06f('0x1b'):if(!_[_0xe06f('0x1c')](members[_0x270aee[_0xe06f('0x13')]])){members[_0x270aee['device']]['exitAt']=utils[_0xe06f('0x1d')]();members[_0x270aee[_0xe06f('0x13')]]['duration']=utils[_0xe06f('0x1e')](members[_0x270aee[_0xe06f('0x13')]][_0xe06f('0x1f')],members[_0x270aee[_0xe06f('0x13')]][_0xe06f('0x20')]);if(members[_0x270aee['device']]['uniqueid']){writeDB(members[_0x270aee['device']]);}}break;default:break;}}catch(_0x33af93){utils[_0xe06f('0x21')](util['format'](_0xe06f('0x22'),members[_0x270aee['device']]?members[_0x270aee['device']][_0xe06f('0x14')]:_0x270aee[_0xe06f('0x13')]),_0x33af93);}};exports[_0xe06f('0x23')]=function(_0x3c5818){try{if(!_[_0xe06f('0x1c')](members[_0x3c5818[_0xe06f('0x9')]])){utils[_0xe06f('0x24')](util[_0xe06f('0x3')](_0xe06f('0x25'),_0x3c5818[_0xe06f('0x14')]),_0x3c5818);utils[_0xe06f('0x15')](util[_0xe06f('0x3')](_0xe06f('0x26'),_0x3c5818[_0xe06f('0x14')],_0x3c5818[_0xe06f('0x9')],_0x3c5818[_0xe06f('0x27')]));members[_0x3c5818[_0xe06f('0x9')]]=_[_0xe06f('0x28')](members[_0x3c5818['interface']],{'data4':_0x3c5818[_0xe06f('0x27')],'uniqueid':_0x3c5818[_0xe06f('0x14')]});}}catch(_0xaca5ea){utils['error'](util[_0xe06f('0x3')]('[%s][members][agentcomplete]',_0x3c5818['uniqueid']),_0xaca5ea);}};exports[_0xe06f('0x29')]=function(_0xcbc0bf){try{utils[_0xe06f('0x24')](util[_0xe06f('0x3')](_0xe06f('0x2a'),_0xcbc0bf['uniqueid']),_0xcbc0bf);if(_0xcbc0bf[_0xe06f('0x5')]){var _0x1a5531=_0xcbc0bf[_0xe06f('0x5')][_0xe06f('0xe')]('-')[0x0];if(!_['isNil'](members[_0x1a5531])){members[_0x1a5531]=_[_0xe06f('0x28')](members[_0x1a5531],{'data1':members[_0x1a5531]['data1']||_0xcbc0bf['type'],'data2':members[_0x1a5531][_0xe06f('0x6')]||_0xcbc0bf[_0xe06f('0x2b')],'data3':members[_0x1a5531]['data3']||_0xcbc0bf[_0xe06f('0x2c')],'uniqueid':members[_0x1a5531][_0xe06f('0x14')]||_0xcbc0bf[_0xe06f('0x14')]});utils[_0xe06f('0x15')](util[_0xe06f('0x3')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0xcbc0bf[_0xe06f('0x14')],members[_0x1a5531][_0xe06f('0x2d')],members[_0x1a5531][_0xe06f('0x6')],members[_0x1a5531]['data3']));if(members[_0x1a5531][_0xe06f('0x1f')]){writeDB(members[_0x1a5531]);}}}if(_0xcbc0bf[_0xe06f('0x2e')]){var _0x471ef5=_0xcbc0bf[_0xe06f('0x2e')][_0xe06f('0xe')]('-')[0x0];if(!_[_0xe06f('0x1c')](members[_0x471ef5])){members[_0x471ef5]=_[_0xe06f('0x28')](members[_0x471ef5],{'data1':members[_0x471ef5]['data1']||_0xcbc0bf[_0xe06f('0x8')],'data2':members[_0x471ef5][_0xe06f('0x6')]||_0xcbc0bf['source'],'data3':members[_0x471ef5][_0xe06f('0x2f')]||_0xcbc0bf[_0xe06f('0x2c')],'uniqueid':members[_0x471ef5][_0xe06f('0x14')]||_0xcbc0bf[_0xe06f('0x14')]});utils['info'](util['format'](_0xe06f('0x30'),_0xcbc0bf[_0xe06f('0x14')],members[_0x471ef5][_0xe06f('0x2d')],members[_0x471ef5][_0xe06f('0x6')],members[_0x471ef5][_0xe06f('0x2f')]));if(members[_0x471ef5]['exitAt']){writeDB(members[_0x471ef5]);}}}}catch(_0x4e23cc){utils['error'](util['format']('[%s][members][cdr]',_0xcbc0bf[_0xe06f('0x14')]),_0x4e23cc);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index c9db697..c84753e 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 _0x7d3b=['[%s][queues][agentcomplete]','queuecallercompleteAt','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','transfertype','BLIND','BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','transferexten','transferuniqueid','origtransfererlinkedid','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridnum','calleridname','queuecallerjoinAt','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]','diffTime','lodash','util','./utils','info','format','uniqueid','channel','queue','lastAssignedTo','accountcode','queuecallerexitreason','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','varset','[%s][queues][varset]','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','count','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]','destaccountcode','assigned','membername'];(function(_0x59f7b8,_0x1ad270){var _0x4fa326=function(_0x374665){while(--_0x374665){_0x59f7b8['push'](_0x59f7b8['shift']());}};_0x4fa326(++_0x1ad270);}(_0x7d3b,0x1b4));var _0xb7d3=function(_0x149569,_0x1d67a9){_0x149569=_0x149569-0x0;var _0x461c0d=_0x7d3b[_0x149569];return _0x461c0d;};'use strict';var _=require(_0xb7d3('0x0'));var util=require(_0xb7d3('0x1'));var utils=require(_0xb7d3('0x2'));var queues={};function writeDB(_0x3f2a74){utils[_0xb7d3('0x3')](util[_0xb7d3('0x4')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x3f2a74[_0xb7d3('0x5')],_0x3f2a74[_0xb7d3('0x6')],_0x3f2a74[_0xb7d3('0x7')],_0x3f2a74[_0xb7d3('0x8')],_0x3f2a74['calleridnum'],_0x3f2a74[_0xb7d3('0x9')],_0x3f2a74[_0xb7d3('0xa')]));if(_0x3f2a74[_0xb7d3('0x7')]){utils['getVoiceQueueByName'](_0x3f2a74[_0xb7d3('0x7')])['then'](function(_0x2707dc){if(_0x2707dc){_0x3f2a74['type']=_0x2707dc['type'];}utils[_0xb7d3('0xb')](_0xb7d3('0xc'),_0x3f2a74);});}else{utils['request'](_0xb7d3('0xc'),_0x3f2a74);}if(_0x3f2a74[_0xb7d3('0xd')]){delete queues[_0x3f2a74[_0xb7d3('0xd')]];}else{delete queues[_0x3f2a74[_0xb7d3('0x5')]];}}exports[_0xb7d3('0xe')]=function(_0x33af50){try{utils[_0xb7d3('0xf')](util[_0xb7d3('0x4')](_0xb7d3('0x10'),_0x33af50[_0xb7d3('0x5')]),_0x33af50);utils[_0xb7d3('0x3')](util[_0xb7d3('0x4')](_0xb7d3('0x11'),_0x33af50[_0xb7d3('0x5')],_0x33af50[_0xb7d3('0x7')],_0x33af50[_0xb7d3('0x12')]));queues[_0x33af50[_0xb7d3('0x5')]]=_[_0xb7d3('0x13')](_0x33af50,{'originalposition':_0x33af50[_0xb7d3('0x12')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x4caf59){utils[_0xb7d3('0x14')](util['format'](_0xb7d3('0x10'),_0x33af50[_0xb7d3('0x5')]),_0x4caf59);}};exports[_0xb7d3('0x15')]=function(_0x3986e0){try{if(!_[_0xb7d3('0x16')](queues[_0x3986e0[_0xb7d3('0x5')]])){utils[_0xb7d3('0xf')](util[_0xb7d3('0x4')](_0xb7d3('0x17'),_0x3986e0[_0xb7d3('0x5')]),_0x3986e0);if(queues[_0x3986e0[_0xb7d3('0x5')]][_0xb7d3('0x18')]){if(!queues[_0x3986e0[_0xb7d3('0x5')]][_0xb7d3('0x19')]&&!queues[_0x3986e0['uniqueid']][_0xb7d3('0x1a')]){queues[_0x3986e0[_0xb7d3('0x5')]][_0xb7d3('0x1b')]=!![];queues[_0x3986e0[_0xb7d3('0x5')]]['queuecallercompleteAt']=utils[_0xb7d3('0x1c')]();queues[_0x3986e0[_0xb7d3('0x5')]][_0xb7d3('0xa')]=_0xb7d3('0x1d');}utils[_0xb7d3('0x3')](util[_0xb7d3('0x4')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x3986e0[_0xb7d3('0x5')],queues[_0x3986e0['uniqueid']]['name'],queues[_0x3986e0[_0xb7d3('0x5')]][_0xb7d3('0xa')]));writeDB(queues[_0x3986e0[_0xb7d3('0x5')]]);}else if(queues[_0x3986e0[_0xb7d3('0x5')]][_0xb7d3('0xd')]){utils['info'](util[_0xb7d3('0x4')](_0xb7d3('0x1e'),_0x3986e0[_0xb7d3('0x5')],queues[_0x3986e0['uniqueid']][_0xb7d3('0x1f')],queues[_0x3986e0['uniqueid']][_0xb7d3('0xd')]));queues[queues[_0x3986e0[_0xb7d3('0x5')]][_0xb7d3('0xd')]]=queues[_0x3986e0[_0xb7d3('0x5')]];queues[queues[_0x3986e0['uniqueid']]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0x3986e0[_0xb7d3('0x5')]];}}}catch(_0x27a679){utils[_0xb7d3('0x14')](util[_0xb7d3('0x4')]('[%s][queues][hangup]',_0x3986e0['uniqueid']),_0x27a679);}};exports[_0xb7d3('0x20')]=function(_0x19e96e){try{utils[_0xb7d3('0xf')](util['format'](_0xb7d3('0x21'),_0x19e96e[_0xb7d3('0x5')]),_0x19e96e);if(!_[_0xb7d3('0x16')](_0x19e96e['variable'][_0xb7d3('0x22')])&&_0x19e96e[_0xb7d3('0x23')][_0xb7d3('0x24')]()!==_0xb7d3('0x25')){if(!_[_0xb7d3('0x16')](queues[_0x19e96e['uniqueid']])){queues[_0x19e96e[_0xb7d3('0x5')]][_0xb7d3('0x19')]=![];queues[_0x19e96e[_0xb7d3('0x5')]][_0xb7d3('0x26')]=null;queues[_0x19e96e[_0xb7d3('0x5')]][_0xb7d3('0x1a')]=!![];queues[_0x19e96e['uniqueid']]['queuecallerexitAt']=utils[_0xb7d3('0x1c')]();queues[_0x19e96e[_0xb7d3('0x5')]]['queuecallerexitreason']=_0x19e96e[_0xb7d3('0x23')][_0xb7d3('0x24')]();utils[_0xb7d3('0x3')](util[_0xb7d3('0x4')](_0xb7d3('0x27'),_0x19e96e[_0xb7d3('0x5')],queues[_0x19e96e[_0xb7d3('0x5')]][_0xb7d3('0x1f')],_0x19e96e[_0xb7d3('0x23')],queues[_0x19e96e['uniqueid']][_0xb7d3('0xa')]));writeDB(queues[_0x19e96e[_0xb7d3('0x5')]]);}}else if(!_[_0xb7d3('0x16')](_0x19e96e[_0xb7d3('0x28')][_0xb7d3('0x29')])){if(!_[_0xb7d3('0x16')](queues[_0x19e96e['uniqueid']])&&!queues[_0x19e96e['uniqueid']][_0xb7d3('0x19')]){queues[_0x19e96e['uniqueid']][_0xb7d3('0x19')]=![];queues[_0x19e96e[_0xb7d3('0x5')]]['queuecallerabandonAt']=null;queues[_0x19e96e['uniqueid']]['queuecallerexit']=!![];queues[_0x19e96e['uniqueid']][_0xb7d3('0x2a')]=utils[_0xb7d3('0x1c')]();queues[_0x19e96e[_0xb7d3('0x5')]][_0xb7d3('0xa')]=_0xb7d3('0x2b');utils[_0xb7d3('0x3')](util[_0xb7d3('0x4')](_0xb7d3('0x2c'),_0x19e96e[_0xb7d3('0x5')],queues[_0x19e96e[_0xb7d3('0x5')]]['name'],_0x19e96e[_0xb7d3('0x23')],queues[_0x19e96e[_0xb7d3('0x5')]][_0xb7d3('0xa')]));}}}catch(_0x1eb8d5){utils[_0xb7d3('0x14')](util[_0xb7d3('0x4')]('[%s][queues][varset]',_0x19e96e[_0xb7d3('0x5')]),_0x1eb8d5);}};exports[_0xb7d3('0x19')]=function(_0x41f376){try{if(!_[_0xb7d3('0x16')](queues[_0x41f376['uniqueid']])){utils['debug'](util[_0xb7d3('0x4')](_0xb7d3('0x2d'),_0x41f376[_0xb7d3('0x5')]),_0x41f376);queues[_0x41f376[_0xb7d3('0x5')]][_0xb7d3('0x1a')]=![];queues[_0x41f376['uniqueid']][_0xb7d3('0x2a')]=null;queues[_0x41f376['uniqueid']]['queuecallerabandon']=!![];queues[_0x41f376['uniqueid']][_0xb7d3('0x26')]=utils[_0xb7d3('0x1c')]();queues[_0x41f376[_0xb7d3('0x5')]][_0xb7d3('0xa')]=_0xb7d3('0x2e');utils[_0xb7d3('0x3')](util['format'](_0xb7d3('0x2f'),_0x41f376[_0xb7d3('0x5')],queues[_0x41f376[_0xb7d3('0x5')]][_0xb7d3('0x1f')],queues[_0x41f376[_0xb7d3('0x5')]]['queuecallerexitreason']));}}catch(_0x1f2ba7){utils[_0xb7d3('0x14')](util[_0xb7d3('0x4')](_0xb7d3('0x2d'),_0x41f376[_0xb7d3('0x5')]),_0x1f2ba7);}};exports['queuecallerleave']=function(_0x149ccf){try{if(!_[_0xb7d3('0x16')](queues[_0x149ccf[_0xb7d3('0x5')]])){utils[_0xb7d3('0xf')](util[_0xb7d3('0x4')]('[%s][queues][queuecallerleave]',_0x149ccf[_0xb7d3('0x5')]),_0x149ccf);utils[_0xb7d3('0x3')](util[_0xb7d3('0x4')](_0xb7d3('0x30'),_0x149ccf[_0xb7d3('0x5')],queues[_0x149ccf[_0xb7d3('0x5')]][_0xb7d3('0x1f')],_0x149ccf[_0xb7d3('0x31')],_0x149ccf[_0xb7d3('0x32')]));queues[_0x149ccf['uniqueid']]['queuecallerleave']=!![];queues[_0x149ccf[_0xb7d3('0x5')]][_0xb7d3('0x18')]=utils[_0xb7d3('0x1c')]();queues[_0x149ccf[_0xb7d3('0x5')]][_0xb7d3('0x33')]=utils['diffTime'](queues[_0x149ccf[_0xb7d3('0x5')]][_0xb7d3('0x18')],queues[_0x149ccf['uniqueid']]['queuecallerjoinAt']);queues[_0x149ccf[_0xb7d3('0x5')]][_0xb7d3('0x12')]=_0x149ccf[_0xb7d3('0x12')];queues[_0x149ccf[_0xb7d3('0x5')]][_0xb7d3('0x34')]=_0x149ccf['count'];queues[_0x149ccf[_0xb7d3('0x5')]][_0xb7d3('0x31')]=_0x149ccf[_0xb7d3('0x31')];queues[_0x149ccf[_0xb7d3('0x5')]]['connectedlinename']=_0x149ccf[_0xb7d3('0x32')];}}catch(_0x1c7fe1){utils['error'](util[_0xb7d3('0x4')](_0xb7d3('0x35'),_0x149ccf[_0xb7d3('0x5')]),_0x1c7fe1);}};exports[_0xb7d3('0x36')]=function(_0x37a6db){try{if(!_[_0xb7d3('0x16')](queues[_0x37a6db[_0xb7d3('0x5')]])){utils['debug'](util[_0xb7d3('0x4')](_0xb7d3('0x37'),_0x37a6db[_0xb7d3('0x5')]),_0x37a6db);utils[_0xb7d3('0x3')](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x37a6db[_0xb7d3('0x5')],queues[_0x37a6db[_0xb7d3('0x5')]]['name'],_0x37a6db['membername'],_0x37a6db[_0xb7d3('0x38')]));queues[_0x37a6db['uniqueid']][_0xb7d3('0x19')]=![];queues[_0x37a6db[_0xb7d3('0x5')]][_0xb7d3('0x19')]=![];queues[_0x37a6db[_0xb7d3('0x5')]]['queuecallerabandonAt']=null;queues[_0x37a6db[_0xb7d3('0x5')]]['queuecallerexit']=![];queues[_0x37a6db[_0xb7d3('0x5')]][_0xb7d3('0xa')]=null;queues[_0x37a6db[_0xb7d3('0x5')]][_0xb7d3('0x2a')]=null;queues[_0x37a6db['uniqueid']][_0xb7d3('0x39')]=!![];queues[_0x37a6db[_0xb7d3('0x5')]][_0xb7d3('0x9')]=_0x37a6db[_0xb7d3('0x38')];queues[_0x37a6db[_0xb7d3('0x5')]][_0xb7d3('0x8')]=_0x37a6db[_0xb7d3('0x3a')];}}catch(_0x453115){utils[_0xb7d3('0x14')](util[_0xb7d3('0x4')](_0xb7d3('0x37'),_0x37a6db['uniqueid']),_0x453115);}};exports['agentcomplete']=function(_0x5813c4){try{if(!_['isNil'](queues[_0x5813c4['uniqueid']])){if(queues[_0x5813c4['uniqueid']][_0xb7d3('0x18')]){utils[_0xb7d3('0xf')](util[_0xb7d3('0x4')](_0xb7d3('0x3b'),_0x5813c4['uniqueid']),_0x5813c4);queues[_0x5813c4[_0xb7d3('0x5')]][_0xb7d3('0x19')]=![];queues[_0x5813c4[_0xb7d3('0x5')]][_0xb7d3('0x19')]=![];queues[_0x5813c4['uniqueid']][_0xb7d3('0x26')]=null;queues[_0x5813c4[_0xb7d3('0x5')]][_0xb7d3('0x1a')]=![];queues[_0x5813c4['uniqueid']][_0xb7d3('0x2a')]=null;queues[_0x5813c4[_0xb7d3('0x5')]][_0xb7d3('0x39')]=!![];queues[_0x5813c4[_0xb7d3('0x5')]][_0xb7d3('0x8')]=_0x5813c4[_0xb7d3('0x3a')];queues[_0x5813c4[_0xb7d3('0x5')]][_0xb7d3('0x1b')]=!![];queues[_0x5813c4[_0xb7d3('0x5')]][_0xb7d3('0x3c')]=utils['now']();if(_0x5813c4[_0xb7d3('0x3d')]==_0xb7d3('0x3e')){if(!queues[_0x5813c4[_0xb7d3('0x5')]]['transfer']){queues[_0x5813c4['uniqueid']]['queuecallerexitreason']=_0xb7d3('0x3f');}}else{queues[_0x5813c4[_0xb7d3('0x5')]][_0xb7d3('0xa')]='COMPLETEDBY'+_0x5813c4['reason'][_0xb7d3('0x24')]();}utils[_0xb7d3('0x3')](util[_0xb7d3('0x4')](_0xb7d3('0x40'),_0x5813c4[_0xb7d3('0x5')],queues[_0x5813c4[_0xb7d3('0x5')]][_0xb7d3('0x1f')],_0x5813c4[_0xb7d3('0x3a')],queues[_0x5813c4[_0xb7d3('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x5813c4[_0xb7d3('0x5')]]);}}}catch(_0x48087c){utils[_0xb7d3('0x14')](util[_0xb7d3('0x4')](_0xb7d3('0x3b'),_0x5813c4['uniqueid']),_0x48087c);}};exports['blindtransfer']=function(_0x1208ad){try{if(!_['isNil'](queues[_0x1208ad[_0xb7d3('0x41')]])){utils[_0xb7d3('0xf')](util[_0xb7d3('0x4')]('[%s][queues][blindtransfer]',_0x1208ad[_0xb7d3('0x5')]),_0x1208ad);queues[_0x1208ad[_0xb7d3('0x41')]][_0xb7d3('0x3e')]=!![];queues[_0x1208ad[_0xb7d3('0x41')]][_0xb7d3('0x42')]=_0xb7d3('0x43');queues[_0x1208ad['transfereeuniqueid']]['transferexten']=_0x1208ad['extension'];queues[_0x1208ad[_0xb7d3('0x41')]]['transferuniqueid']=_0x1208ad[_0xb7d3('0x41')];queues[_0x1208ad[_0xb7d3('0x41')]]['queuecallerexitreason']=_0xb7d3('0x44');utils[_0xb7d3('0x3')](util[_0xb7d3('0x4')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x1208ad[_0xb7d3('0x5')],queues[_0x1208ad[_0xb7d3('0x41')]]['name'],_0x1208ad['transfereeuniqueid'],_0x1208ad['extension']));}}catch(_0x6c2ef0){utils['error'](util[_0xb7d3('0x4')]('[%s][queues][blindtransfer]',_0x1208ad[_0xb7d3('0x5')]),_0x6c2ef0);}};exports[_0xb7d3('0x45')]=function(_0x4b617a){try{utils['debug'](util[_0xb7d3('0x4')](_0xb7d3('0x46'),_0x4b617a['origtransfereruniqueid']),_0x4b617a);if(_0x4b617a[_0xb7d3('0x47')]==_0x4b617a['origtransfererlinkedid']){if(!_[_0xb7d3('0x16')](queues[_0x4b617a[_0xb7d3('0x48')]])){utils['info'](util[_0xb7d3('0x4')](_0xb7d3('0x49'),_0x4b617a[_0xb7d3('0x47')],queues[_0x4b617a[_0xb7d3('0x48')]][_0xb7d3('0x1f')],_0x4b617a['origtransfererexten']));queues[_0x4b617a[_0xb7d3('0x48')]][_0xb7d3('0x3e')]=!![];queues[_0x4b617a[_0xb7d3('0x48')]][_0xb7d3('0x42')]=_0xb7d3('0x4a');queues[_0x4b617a[_0xb7d3('0x48')]][_0xb7d3('0x4b')]=_0x4b617a['origtransfererexten'];queues[_0x4b617a[_0xb7d3('0x48')]][_0xb7d3('0x4c')]=_0x4b617a[_0xb7d3('0x47')];queues[_0x4b617a[_0xb7d3('0x48')]][_0xb7d3('0xa')]='ATTENDEDTRANSFER';}if(!_[_0xb7d3('0x16')](queues[_0x4b617a[_0xb7d3('0x4d')]])){if(_0x4b617a['transfereelinkedid']&&queues[_0x4b617a[_0xb7d3('0x4e')]]){queues[_0x4b617a[_0xb7d3('0x4e')]][_0xb7d3('0x4f')]=0x1;queues[_0x4b617a[_0xb7d3('0x41')]]=_[_0xb7d3('0x50')](queues[_0x4b617a[_0xb7d3('0x4e')]]);queues[_0x4b617a['transfereeuniqueid']][_0xb7d3('0xd')]=_0x4b617a[_0xb7d3('0x51')];queues[_0x4b617a[_0xb7d3('0x41')]][_0xb7d3('0x4f')]=0x2;queues[_0x4b617a['transfereeuniqueid']][_0xb7d3('0x52')]=queues[_0x4b617a['secondtransfererlinkedid']][_0xb7d3('0x52')];queues[_0x4b617a['transfereeuniqueid']]['calleridname']=queues[_0x4b617a['secondtransfererlinkedid']][_0xb7d3('0x53')];queues[_0x4b617a[_0xb7d3('0x41')]][_0xb7d3('0x54')]=utils['now']();queues[_0x4b617a['transfereeuniqueid']][_0xb7d3('0x18')]=utils['now']();queues[_0x4b617a[_0xb7d3('0x41')]]['holdtime']=0x0;queues[_0x4b617a[_0xb7d3('0x41')]]['mohtime']=0x0;utils[_0xb7d3('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x4b617a[_0xb7d3('0x47')],queues[_0x4b617a[_0xb7d3('0x41')]][_0xb7d3('0x1f')],queues[_0x4b617a['transfereeuniqueid']]['calleridnum'],queues[_0x4b617a['transfereeuniqueid']][_0xb7d3('0x53')]));}else{utils[_0xb7d3('0x3')](util[_0xb7d3('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x4b617a[_0xb7d3('0x47')],queues[_0x4b617a[_0xb7d3('0x4d')]][_0xb7d3('0x1f')],_0x4b617a[_0xb7d3('0x48')]));queues[_0x4b617a[_0xb7d3('0x4d')]][_0xb7d3('0xd')]=_0x4b617a[_0xb7d3('0x48')];}}}else if(_0x4b617a[_0xb7d3('0x55')]==_0x4b617a[_0xb7d3('0x48')]){if(!_[_0xb7d3('0x16')](queues[_0x4b617a['origtransfererlinkedid']])){utils[_0xb7d3('0x3')](util[_0xb7d3('0x4')](_0xb7d3('0x56'),_0x4b617a[_0xb7d3('0x47')],queues[_0x4b617a['origtransfererlinkedid']][_0xb7d3('0x1f')],_0x4b617a['secondtransfereruniqueid'],_0x4b617a[_0xb7d3('0x57')]));queues[_0x4b617a[_0xb7d3('0x4d')]]['transfer']=!![];queues[_0x4b617a[_0xb7d3('0x4d')]][_0xb7d3('0x42')]='ATTENDED';queues[_0x4b617a[_0xb7d3('0x4d')]][_0xb7d3('0x4b')]=_0x4b617a[_0xb7d3('0x57')];queues[_0x4b617a[_0xb7d3('0x4d')]][_0xb7d3('0x4c')]=_0x4b617a[_0xb7d3('0x55')];queues[_0x4b617a[_0xb7d3('0x4d')]][_0xb7d3('0xa')]=_0xb7d3('0x58');}if(!_[_0xb7d3('0x16')](queues[_0x4b617a['secondtransfererlinkedid']])){if(_0x4b617a[_0xb7d3('0x59')]&&queues[_0x4b617a['transfertargetlinkedid']]){queues[_0x4b617a[_0xb7d3('0x59')]][_0xb7d3('0x4f')]=0x1;queues[_0x4b617a[_0xb7d3('0x51')]]=_[_0xb7d3('0x50')](queues[_0x4b617a[_0xb7d3('0x59')]]);queues[_0x4b617a[_0xb7d3('0x51')]]['transfereduniqueid']=_0x4b617a['transfertargetuniqueid'];queues[_0x4b617a['transfertargetuniqueid']]['queuecallerenterreason']=0x2;queues[_0x4b617a[_0xb7d3('0x51')]][_0xb7d3('0x52')]=queues[_0x4b617a[_0xb7d3('0x4d')]][_0xb7d3('0x52')];queues[_0x4b617a['transfertargetuniqueid']][_0xb7d3('0x53')]=queues[_0x4b617a[_0xb7d3('0x4d')]][_0xb7d3('0x53')];queues[_0x4b617a[_0xb7d3('0x51')]]['queuecallerjoinAt']=utils['now']();queues[_0x4b617a[_0xb7d3('0x51')]][_0xb7d3('0x18')]=utils[_0xb7d3('0x1c')]();queues[_0x4b617a['transfertargetuniqueid']][_0xb7d3('0x33')]=0x0;queues[_0x4b617a[_0xb7d3('0x51')]][_0xb7d3('0x5a')]=0x0;utils[_0xb7d3('0x3')](util['format'](_0xb7d3('0x5b'),_0x4b617a['origtransfereruniqueid'],queues[_0x4b617a[_0xb7d3('0x51')]][_0xb7d3('0x1f')],queues[_0x4b617a[_0xb7d3('0x51')]][_0xb7d3('0xd')],queues[_0x4b617a[_0xb7d3('0x51')]][_0xb7d3('0x52')],queues[_0x4b617a['transfertargetuniqueid']]['calleridname']));}else{utils[_0xb7d3('0x3')](util[_0xb7d3('0x4')](_0xb7d3('0x5c'),_0x4b617a['origtransfereruniqueid'],queues[_0x4b617a[_0xb7d3('0x48')]][_0xb7d3('0x1f')],_0x4b617a[_0xb7d3('0x4d')]));queues[_0x4b617a[_0xb7d3('0x48')]][_0xb7d3('0xd')]=_0x4b617a['origtransfererlinkedid'];}}}}catch(_0x2c3351){utils[_0xb7d3('0x14')](util[_0xb7d3('0x4')](_0xb7d3('0x46'),_0x4b617a[_0xb7d3('0x47')]),_0x2c3351);}};exports[_0xb7d3('0x5d')]=function(_0x5317ef){try{if(!_[_0xb7d3('0x16')](queues[_0x5317ef['uniqueid']])){utils['debug'](util[_0xb7d3('0x4')]('[%s][queues][musiconholdstart]',_0x5317ef['uniqueid']),_0x5317ef);queues[_0x5317ef[_0xb7d3('0x5')]][_0xb7d3('0x5e')]=utils['now']();utils['info'](util[_0xb7d3('0x4')](_0xb7d3('0x5f'),_0x5317ef[_0xb7d3('0x5')],queues[_0x5317ef[_0xb7d3('0x5')]]['name'],queues[_0x5317ef[_0xb7d3('0x5')]][_0xb7d3('0x5e')]));}}catch(_0x154b9e){utils[_0xb7d3('0x14')](util[_0xb7d3('0x4')](_0xb7d3('0x60'),_0x5317ef[_0xb7d3('0x5')]),_0x154b9e);}};exports['musiconholdstop']=function(_0x4e5401){try{if(!_[_0xb7d3('0x16')](queues[_0x4e5401[_0xb7d3('0x5')]])){if(!_[_0xb7d3('0x16')](queues[_0x4e5401[_0xb7d3('0x5')]]['musiconholdstartAt'])){utils[_0xb7d3('0xf')](util[_0xb7d3('0x4')](_0xb7d3('0x61'),_0x4e5401['uniqueid']),_0x4e5401);queues[_0x4e5401['uniqueid']]['mohtime']+=utils[_0xb7d3('0x62')](utils[_0xb7d3('0x1c')](),queues[_0x4e5401[_0xb7d3('0x5')]][_0xb7d3('0x5e')]);utils['info'](util[_0xb7d3('0x4')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x4e5401[_0xb7d3('0x5')],queues[_0x4e5401[_0xb7d3('0x5')]]['name'],queues[_0x4e5401[_0xb7d3('0x5')]][_0xb7d3('0x5a')]));delete queues[_0x4e5401[_0xb7d3('0x5')]][_0xb7d3('0x5e')];}}}catch(_0x1b3ce7){utils['error'](util[_0xb7d3('0x4')](_0xb7d3('0x61'),_0x4e5401[_0xb7d3('0x5')]),_0x1b3ce7);}}; \ No newline at end of file +var _0xc28b=['origtransfererexten','ATTENDED','transferexten','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','clone','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstart]','musiconholdstop','diffTime','lodash','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','lastAssignedTo','accountcode','queuecallerexitreason','queue','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','hangup','format','[%s][queues][hangup]','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','error','varset','isNil','variable','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerexitAt','[%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','queuecallerleaveAt','holdtime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','transfertype','BLIND','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER'];(function(_0x2e4377,_0x1c5fd1){var _0x464dec=function(_0x305881){while(--_0x305881){_0x2e4377['push'](_0x2e4377['shift']());}};_0x464dec(++_0x1c5fd1);}(_0xc28b,0x147));var _0xbc28=function(_0x1d2a17,_0x106e8d){_0x1d2a17=_0x1d2a17-0x0;var _0x5909b7=_0xc28b[_0x1d2a17];return _0x5909b7;};'use strict';var _=require(_0xbc28('0x0'));var util=require(_0xbc28('0x1'));var utils=require(_0xbc28('0x2'));var queues={};function writeDB(_0x2647dd){utils[_0xbc28('0x3')](util['format'](_0xbc28('0x4'),_0x2647dd['uniqueid'],_0x2647dd[_0xbc28('0x5')],_0x2647dd['queue'],_0x2647dd[_0xbc28('0x6')],_0x2647dd['calleridnum'],_0x2647dd[_0xbc28('0x7')],_0x2647dd[_0xbc28('0x8')]));if(_0x2647dd['queue']){utils['getVoiceQueueByName'](_0x2647dd[_0xbc28('0x9')])['then'](function(_0xfa6914){if(_0xfa6914){_0x2647dd[_0xbc28('0xa')]=_0xfa6914['type'];}utils[_0xbc28('0xb')](_0xbc28('0xc'),_0x2647dd);});}else{utils[_0xbc28('0xb')](_0xbc28('0xc'),_0x2647dd);}if(_0x2647dd['transfereduniqueid']){delete queues[_0x2647dd[_0xbc28('0xd')]];}else{delete queues[_0x2647dd[_0xbc28('0xe')]];}}exports[_0xbc28('0xf')]=function(_0x323512){try{utils[_0xbc28('0x10')](util['format'](_0xbc28('0x11'),_0x323512[_0xbc28('0xe')]),_0x323512);utils[_0xbc28('0x3')](util['format'](_0xbc28('0x12'),_0x323512[_0xbc28('0xe')],_0x323512[_0xbc28('0x9')],_0x323512[_0xbc28('0x13')]));queues[_0x323512[_0xbc28('0xe')]]=_[_0xbc28('0x14')](_0x323512,{'originalposition':_0x323512['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x3bc1b6){utils['error'](util['format'](_0xbc28('0x11'),_0x323512[_0xbc28('0xe')]),_0x3bc1b6);}};exports[_0xbc28('0x15')]=function(_0x119293){try{if(!_['isNil'](queues[_0x119293['uniqueid']])){utils[_0xbc28('0x10')](util[_0xbc28('0x16')](_0xbc28('0x17'),_0x119293[_0xbc28('0xe')]),_0x119293);if(queues[_0x119293[_0xbc28('0xe')]]['queuecallerleaveAt']){if(!queues[_0x119293[_0xbc28('0xe')]]['queuecallerabandon']&&!queues[_0x119293['uniqueid']][_0xbc28('0x18')]){queues[_0x119293[_0xbc28('0xe')]][_0xbc28('0x19')]=!![];queues[_0x119293[_0xbc28('0xe')]][_0xbc28('0x1a')]=utils[_0xbc28('0x1b')]();queues[_0x119293[_0xbc28('0xe')]]['queuecallerexitreason']=_0xbc28('0x1c');}utils['info'](util['format'](_0xbc28('0x1d'),_0x119293[_0xbc28('0xe')],queues[_0x119293['uniqueid']][_0xbc28('0x1e')],queues[_0x119293[_0xbc28('0xe')]][_0xbc28('0x8')]));writeDB(queues[_0x119293['uniqueid']]);}else if(queues[_0x119293['uniqueid']]['transfereduniqueid']){utils[_0xbc28('0x3')](util[_0xbc28('0x16')](_0xbc28('0x1f'),_0x119293[_0xbc28('0xe')],queues[_0x119293[_0xbc28('0xe')]]['name'],queues[_0x119293[_0xbc28('0xe')]]['transfereduniqueid']));queues[queues[_0x119293[_0xbc28('0xe')]][_0xbc28('0xd')]]=queues[_0x119293['uniqueid']];queues[queues[_0x119293[_0xbc28('0xe')]]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0x119293[_0xbc28('0xe')]];}}}catch(_0x53f2e6){utils[_0xbc28('0x20')](util['format'](_0xbc28('0x17'),_0x119293[_0xbc28('0xe')]),_0x53f2e6);}};exports[_0xbc28('0x21')]=function(_0x18a78a){try{utils[_0xbc28('0x10')](util[_0xbc28('0x16')]('[%s][queues][varset]',_0x18a78a[_0xbc28('0xe')]),_0x18a78a);if(!_[_0xbc28('0x22')](_0x18a78a[_0xbc28('0x23')]['queuestatus'])&&_0x18a78a[_0xbc28('0x24')][_0xbc28('0x25')]()!==_0xbc28('0x26')){if(!_[_0xbc28('0x22')](queues[_0x18a78a['uniqueid']])){queues[_0x18a78a[_0xbc28('0xe')]][_0xbc28('0x27')]=![];queues[_0x18a78a[_0xbc28('0xe')]][_0xbc28('0x28')]=null;queues[_0x18a78a[_0xbc28('0xe')]][_0xbc28('0x18')]=!![];queues[_0x18a78a[_0xbc28('0xe')]]['queuecallerexitAt']=utils[_0xbc28('0x1b')]();queues[_0x18a78a[_0xbc28('0xe')]][_0xbc28('0x8')]=_0x18a78a[_0xbc28('0x24')][_0xbc28('0x25')]();utils[_0xbc28('0x3')](util['format'](_0xbc28('0x29'),_0x18a78a[_0xbc28('0xe')],queues[_0x18a78a[_0xbc28('0xe')]][_0xbc28('0x1e')],_0x18a78a[_0xbc28('0x24')],queues[_0x18a78a[_0xbc28('0xe')]]['queuecallerexitreason']));writeDB(queues[_0x18a78a['uniqueid']]);}}else if(!_[_0xbc28('0x22')](_0x18a78a[_0xbc28('0x23')][_0xbc28('0x2a')])){if(!_[_0xbc28('0x22')](queues[_0x18a78a['uniqueid']])&&!queues[_0x18a78a[_0xbc28('0xe')]][_0xbc28('0x27')]){queues[_0x18a78a['uniqueid']]['queuecallerabandon']=![];queues[_0x18a78a[_0xbc28('0xe')]][_0xbc28('0x28')]=null;queues[_0x18a78a[_0xbc28('0xe')]]['queuecallerexit']=!![];queues[_0x18a78a[_0xbc28('0xe')]][_0xbc28('0x2b')]=utils[_0xbc28('0x1b')]();queues[_0x18a78a[_0xbc28('0xe')]][_0xbc28('0x8')]='EXITWITHKEY';utils['info'](util['format'](_0xbc28('0x2c'),_0x18a78a[_0xbc28('0xe')],queues[_0x18a78a[_0xbc28('0xe')]][_0xbc28('0x1e')],_0x18a78a[_0xbc28('0x24')],queues[_0x18a78a[_0xbc28('0xe')]][_0xbc28('0x8')]));}}}catch(_0x5db9ff){utils['error'](util[_0xbc28('0x16')]('[%s][queues][varset]',_0x18a78a['uniqueid']),_0x5db9ff);}};exports['queuecallerabandon']=function(_0x2617e2){try{if(!_[_0xbc28('0x22')](queues[_0x2617e2[_0xbc28('0xe')]])){utils[_0xbc28('0x10')](util[_0xbc28('0x16')](_0xbc28('0x2d'),_0x2617e2[_0xbc28('0xe')]),_0x2617e2);queues[_0x2617e2[_0xbc28('0xe')]][_0xbc28('0x18')]=![];queues[_0x2617e2[_0xbc28('0xe')]][_0xbc28('0x2b')]=null;queues[_0x2617e2[_0xbc28('0xe')]][_0xbc28('0x27')]=!![];queues[_0x2617e2[_0xbc28('0xe')]][_0xbc28('0x28')]=utils[_0xbc28('0x1b')]();queues[_0x2617e2[_0xbc28('0xe')]][_0xbc28('0x8')]=_0xbc28('0x2e');utils[_0xbc28('0x3')](util[_0xbc28('0x16')](_0xbc28('0x2f'),_0x2617e2['uniqueid'],queues[_0x2617e2[_0xbc28('0xe')]][_0xbc28('0x1e')],queues[_0x2617e2[_0xbc28('0xe')]][_0xbc28('0x8')]));}}catch(_0x1d54f7){utils['error'](util[_0xbc28('0x16')](_0xbc28('0x2d'),_0x2617e2[_0xbc28('0xe')]),_0x1d54f7);}};exports[_0xbc28('0x30')]=function(_0x2cf5b1){try{if(!_[_0xbc28('0x22')](queues[_0x2cf5b1['uniqueid']])){utils[_0xbc28('0x10')](util[_0xbc28('0x16')](_0xbc28('0x31'),_0x2cf5b1[_0xbc28('0xe')]),_0x2cf5b1);utils[_0xbc28('0x3')](util[_0xbc28('0x16')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x2cf5b1[_0xbc28('0xe')],queues[_0x2cf5b1['uniqueid']][_0xbc28('0x1e')],_0x2cf5b1[_0xbc28('0x32')],_0x2cf5b1[_0xbc28('0x33')]));queues[_0x2cf5b1[_0xbc28('0xe')]][_0xbc28('0x30')]=!![];queues[_0x2cf5b1[_0xbc28('0xe')]][_0xbc28('0x34')]=utils['now']();queues[_0x2cf5b1[_0xbc28('0xe')]][_0xbc28('0x35')]=utils['diffTime'](queues[_0x2cf5b1[_0xbc28('0xe')]][_0xbc28('0x34')],queues[_0x2cf5b1['uniqueid']][_0xbc28('0x36')]);queues[_0x2cf5b1[_0xbc28('0xe')]]['position']=_0x2cf5b1[_0xbc28('0x13')];queues[_0x2cf5b1[_0xbc28('0xe')]][_0xbc28('0x37')]=_0x2cf5b1['count'];queues[_0x2cf5b1['uniqueid']][_0xbc28('0x32')]=_0x2cf5b1['connectedlinenum'];queues[_0x2cf5b1[_0xbc28('0xe')]][_0xbc28('0x33')]=_0x2cf5b1[_0xbc28('0x33')];}}catch(_0x14fa0d){utils[_0xbc28('0x20')](util[_0xbc28('0x16')]('[%s][queues][queuecallerleave]',_0x2cf5b1[_0xbc28('0xe')]),_0x14fa0d);}};exports[_0xbc28('0x38')]=function(_0x140ec0){try{if(!_[_0xbc28('0x22')](queues[_0x140ec0[_0xbc28('0xe')]])){utils[_0xbc28('0x10')](util['format'](_0xbc28('0x39'),_0x140ec0[_0xbc28('0xe')]),_0x140ec0);utils[_0xbc28('0x3')](util[_0xbc28('0x16')](_0xbc28('0x3a'),_0x140ec0[_0xbc28('0xe')],queues[_0x140ec0['uniqueid']]['name'],_0x140ec0[_0xbc28('0x3b')],_0x140ec0[_0xbc28('0x3c')]));queues[_0x140ec0[_0xbc28('0xe')]]['queuecallerabandon']=![];queues[_0x140ec0['uniqueid']][_0xbc28('0x27')]=![];queues[_0x140ec0[_0xbc28('0xe')]][_0xbc28('0x28')]=null;queues[_0x140ec0[_0xbc28('0xe')]][_0xbc28('0x18')]=![];queues[_0x140ec0[_0xbc28('0xe')]]['queuecallerexitreason']=null;queues[_0x140ec0[_0xbc28('0xe')]]['queuecallerexitAt']=null;queues[_0x140ec0['uniqueid']][_0xbc28('0x3d')]=!![];queues[_0x140ec0[_0xbc28('0xe')]][_0xbc28('0x7')]=_0x140ec0[_0xbc28('0x3c')];queues[_0x140ec0[_0xbc28('0xe')]]['lastAssignedTo']=_0x140ec0[_0xbc28('0x3b')];}}catch(_0x134901){utils[_0xbc28('0x20')](util['format'](_0xbc28('0x39'),_0x140ec0['uniqueid']),_0x134901);}};exports['agentcomplete']=function(_0x2c9048){try{if(!_[_0xbc28('0x22')](queues[_0x2c9048[_0xbc28('0xe')]])){if(queues[_0x2c9048['uniqueid']][_0xbc28('0x34')]){utils[_0xbc28('0x10')](util['format']('[%s][queues][agentcomplete]',_0x2c9048[_0xbc28('0xe')]),_0x2c9048);queues[_0x2c9048[_0xbc28('0xe')]]['queuecallerabandon']=![];queues[_0x2c9048['uniqueid']]['queuecallerabandon']=![];queues[_0x2c9048['uniqueid']]['queuecallerabandonAt']=null;queues[_0x2c9048[_0xbc28('0xe')]][_0xbc28('0x18')]=![];queues[_0x2c9048['uniqueid']][_0xbc28('0x2b')]=null;queues[_0x2c9048['uniqueid']][_0xbc28('0x3d')]=!![];queues[_0x2c9048[_0xbc28('0xe')]][_0xbc28('0x6')]=_0x2c9048['membername'];queues[_0x2c9048[_0xbc28('0xe')]][_0xbc28('0x19')]=!![];queues[_0x2c9048[_0xbc28('0xe')]][_0xbc28('0x1a')]=utils[_0xbc28('0x1b')]();if(_0x2c9048[_0xbc28('0x3e')]==_0xbc28('0x3f')){if(!queues[_0x2c9048['uniqueid']][_0xbc28('0x3f')]){queues[_0x2c9048[_0xbc28('0xe')]][_0xbc28('0x8')]=_0xbc28('0x40');}}else{queues[_0x2c9048[_0xbc28('0xe')]][_0xbc28('0x8')]='COMPLETEDBY'+_0x2c9048['reason'][_0xbc28('0x25')]();}utils['info'](util[_0xbc28('0x16')](_0xbc28('0x41'),_0x2c9048[_0xbc28('0xe')],queues[_0x2c9048['uniqueid']]['name'],_0x2c9048['membername'],queues[_0x2c9048[_0xbc28('0xe')]]['queuecallerexitreason']));writeDB(queues[_0x2c9048[_0xbc28('0xe')]]);}}}catch(_0x34f072){utils['error'](util[_0xbc28('0x16')](_0xbc28('0x42'),_0x2c9048[_0xbc28('0xe')]),_0x34f072);}};exports[_0xbc28('0x43')]=function(_0x516542){try{if(!_['isNil'](queues[_0x516542[_0xbc28('0x44')]])){utils[_0xbc28('0x10')](util['format']('[%s][queues][blindtransfer]',_0x516542[_0xbc28('0xe')]),_0x516542);queues[_0x516542[_0xbc28('0x44')]][_0xbc28('0x3f')]=!![];queues[_0x516542['transfereeuniqueid']][_0xbc28('0x45')]=_0xbc28('0x46');queues[_0x516542[_0xbc28('0x44')]]['transferexten']=_0x516542[_0xbc28('0x47')];queues[_0x516542['transfereeuniqueid']][_0xbc28('0x48')]=_0x516542['transfereeuniqueid'];queues[_0x516542[_0xbc28('0x44')]][_0xbc28('0x8')]=_0xbc28('0x49');utils[_0xbc28('0x3')](util[_0xbc28('0x16')](_0xbc28('0x4a'),_0x516542['uniqueid'],queues[_0x516542[_0xbc28('0x44')]][_0xbc28('0x1e')],_0x516542['transfereeuniqueid'],_0x516542[_0xbc28('0x47')]));}}catch(_0x351b37){utils[_0xbc28('0x20')](util['format'](_0xbc28('0x4b'),_0x516542[_0xbc28('0xe')]),_0x351b37);}};exports['attendedtransfer']=function(_0x8ee976){try{utils['debug'](util['format'](_0xbc28('0x4c'),_0x8ee976[_0xbc28('0x4d')]),_0x8ee976);if(_0x8ee976[_0xbc28('0x4d')]==_0x8ee976[_0xbc28('0x4e')]){if(!_[_0xbc28('0x22')](queues[_0x8ee976[_0xbc28('0x4f')]])){utils[_0xbc28('0x3')](util[_0xbc28('0x16')](_0xbc28('0x50'),_0x8ee976[_0xbc28('0x4d')],queues[_0x8ee976[_0xbc28('0x4f')]]['name'],_0x8ee976[_0xbc28('0x51')]));queues[_0x8ee976[_0xbc28('0x4f')]][_0xbc28('0x3f')]=!![];queues[_0x8ee976[_0xbc28('0x4f')]][_0xbc28('0x45')]=_0xbc28('0x52');queues[_0x8ee976[_0xbc28('0x4f')]][_0xbc28('0x53')]=_0x8ee976['origtransfererexten'];queues[_0x8ee976[_0xbc28('0x4f')]][_0xbc28('0x48')]=_0x8ee976['origtransfereruniqueid'];queues[_0x8ee976[_0xbc28('0x4f')]][_0xbc28('0x8')]=_0xbc28('0x54');}if(!_['isNil'](queues[_0x8ee976[_0xbc28('0x4e')]])){if(_0x8ee976[_0xbc28('0x55')]&&queues[_0x8ee976['transfereelinkedid']]){queues[_0x8ee976[_0xbc28('0x55')]][_0xbc28('0x56')]=0x1;queues[_0x8ee976[_0xbc28('0x44')]]=_['clone'](queues[_0x8ee976[_0xbc28('0x55')]]);queues[_0x8ee976[_0xbc28('0x44')]][_0xbc28('0xd')]=_0x8ee976['transfertargetuniqueid'];queues[_0x8ee976[_0xbc28('0x44')]][_0xbc28('0x56')]=0x2;queues[_0x8ee976[_0xbc28('0x44')]][_0xbc28('0x57')]=queues[_0x8ee976['secondtransfererlinkedid']][_0xbc28('0x57')];queues[_0x8ee976[_0xbc28('0x44')]][_0xbc28('0x58')]=queues[_0x8ee976[_0xbc28('0x4f')]][_0xbc28('0x58')];queues[_0x8ee976[_0xbc28('0x44')]][_0xbc28('0x36')]=utils[_0xbc28('0x1b')]();queues[_0x8ee976[_0xbc28('0x44')]]['queuecallerleaveAt']=utils[_0xbc28('0x1b')]();queues[_0x8ee976[_0xbc28('0x44')]][_0xbc28('0x35')]=0x0;queues[_0x8ee976['transfereeuniqueid']][_0xbc28('0x59')]=0x0;utils[_0xbc28('0x3')](util[_0xbc28('0x16')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x8ee976[_0xbc28('0x4d')],queues[_0x8ee976[_0xbc28('0x44')]][_0xbc28('0x1e')],queues[_0x8ee976[_0xbc28('0x44')]][_0xbc28('0x57')],queues[_0x8ee976[_0xbc28('0x44')]]['calleridname']));}else{utils[_0xbc28('0x3')](util[_0xbc28('0x16')](_0xbc28('0x5a'),_0x8ee976['origtransfereruniqueid'],queues[_0x8ee976[_0xbc28('0x4e')]][_0xbc28('0x1e')],_0x8ee976[_0xbc28('0x4f')]));queues[_0x8ee976[_0xbc28('0x4e')]]['transfereduniqueid']=_0x8ee976[_0xbc28('0x4f')];}}}else if(_0x8ee976[_0xbc28('0x5b')]==_0x8ee976[_0xbc28('0x4f')]){if(!_['isNil'](queues[_0x8ee976[_0xbc28('0x4e')]])){utils[_0xbc28('0x3')](util[_0xbc28('0x16')](_0xbc28('0x5c'),_0x8ee976[_0xbc28('0x4d')],queues[_0x8ee976['origtransfererlinkedid']][_0xbc28('0x1e')],_0x8ee976['secondtransfereruniqueid'],_0x8ee976[_0xbc28('0x5d')]));queues[_0x8ee976['origtransfererlinkedid']]['transfer']=!![];queues[_0x8ee976['origtransfererlinkedid']][_0xbc28('0x45')]=_0xbc28('0x52');queues[_0x8ee976[_0xbc28('0x4e')]][_0xbc28('0x53')]=_0x8ee976[_0xbc28('0x5d')];queues[_0x8ee976[_0xbc28('0x4e')]][_0xbc28('0x48')]=_0x8ee976[_0xbc28('0x5b')];queues[_0x8ee976[_0xbc28('0x4e')]][_0xbc28('0x8')]=_0xbc28('0x54');}if(!_[_0xbc28('0x22')](queues[_0x8ee976[_0xbc28('0x4f')]])){if(_0x8ee976['transfertargetlinkedid']&&queues[_0x8ee976[_0xbc28('0x5e')]]){queues[_0x8ee976[_0xbc28('0x5e')]]['queuecallerenterreason']=0x1;queues[_0x8ee976[_0xbc28('0x5f')]]=_[_0xbc28('0x60')](queues[_0x8ee976[_0xbc28('0x5e')]]);queues[_0x8ee976['transfertargetuniqueid']][_0xbc28('0xd')]=_0x8ee976[_0xbc28('0x5f')];queues[_0x8ee976[_0xbc28('0x5f')]][_0xbc28('0x56')]=0x2;queues[_0x8ee976['transfertargetuniqueid']][_0xbc28('0x57')]=queues[_0x8ee976['origtransfererlinkedid']][_0xbc28('0x57')];queues[_0x8ee976[_0xbc28('0x5f')]]['calleridname']=queues[_0x8ee976[_0xbc28('0x4e')]]['calleridname'];queues[_0x8ee976['transfertargetuniqueid']][_0xbc28('0x36')]=utils[_0xbc28('0x1b')]();queues[_0x8ee976['transfertargetuniqueid']][_0xbc28('0x34')]=utils[_0xbc28('0x1b')]();queues[_0x8ee976[_0xbc28('0x5f')]][_0xbc28('0x35')]=0x0;queues[_0x8ee976[_0xbc28('0x5f')]][_0xbc28('0x59')]=0x0;utils[_0xbc28('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x8ee976[_0xbc28('0x4d')],queues[_0x8ee976[_0xbc28('0x5f')]]['name'],queues[_0x8ee976['transfertargetuniqueid']]['transfereduniqueid'],queues[_0x8ee976[_0xbc28('0x5f')]][_0xbc28('0x57')],queues[_0x8ee976[_0xbc28('0x5f')]][_0xbc28('0x58')]));}else{utils[_0xbc28('0x3')](util[_0xbc28('0x16')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x8ee976[_0xbc28('0x4d')],queues[_0x8ee976['secondtransfererlinkedid']][_0xbc28('0x1e')],_0x8ee976[_0xbc28('0x4e')]));queues[_0x8ee976[_0xbc28('0x4f')]][_0xbc28('0xd')]=_0x8ee976[_0xbc28('0x4e')];}}}}catch(_0x2ecb94){utils[_0xbc28('0x20')](util[_0xbc28('0x16')](_0xbc28('0x4c'),_0x8ee976[_0xbc28('0x4d')]),_0x2ecb94);}};exports[_0xbc28('0x61')]=function(_0x12d66d){try{if(!_['isNil'](queues[_0x12d66d[_0xbc28('0xe')]])){utils['debug'](util['format']('[%s][queues][musiconholdstart]',_0x12d66d['uniqueid']),_0x12d66d);queues[_0x12d66d[_0xbc28('0xe')]][_0xbc28('0x62')]=utils[_0xbc28('0x1b')]();utils['info'](util[_0xbc28('0x16')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x12d66d[_0xbc28('0xe')],queues[_0x12d66d[_0xbc28('0xe')]]['name'],queues[_0x12d66d[_0xbc28('0xe')]][_0xbc28('0x62')]));}}catch(_0x527a4c){utils[_0xbc28('0x20')](util[_0xbc28('0x16')](_0xbc28('0x63'),_0x12d66d[_0xbc28('0xe')]),_0x527a4c);}};exports[_0xbc28('0x64')]=function(_0x25d3fb){try{if(!_[_0xbc28('0x22')](queues[_0x25d3fb[_0xbc28('0xe')]])){if(!_[_0xbc28('0x22')](queues[_0x25d3fb[_0xbc28('0xe')]]['musiconholdstartAt'])){utils[_0xbc28('0x10')](util[_0xbc28('0x16')]('[%s][queues][musiconholdstop]',_0x25d3fb[_0xbc28('0xe')]),_0x25d3fb);queues[_0x25d3fb[_0xbc28('0xe')]][_0xbc28('0x59')]+=utils[_0xbc28('0x65')](utils[_0xbc28('0x1b')](),queues[_0x25d3fb[_0xbc28('0xe')]][_0xbc28('0x62')]);utils[_0xbc28('0x3')](util[_0xbc28('0x16')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x25d3fb['uniqueid'],queues[_0x25d3fb[_0xbc28('0xe')]][_0xbc28('0x1e')],queues[_0x25d3fb['uniqueid']]['mohtime']));delete queues[_0x25d3fb['uniqueid']][_0xbc28('0x62')];}}}catch(_0x310e10){utils[_0xbc28('0x20')](util[_0xbc28('0x16')]('[%s][queues][musiconholdstop]',_0x25d3fb[_0xbc28('0xe')]),_0x310e10);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index c876ea4..70d5bb6 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 _0xb794=['connectedlinename','type','outbound','forEach','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','set','startsWith','appdata','toLowerCase','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','util','./utils','format','[%s][recordings][writeDB]','uniqueid','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','context','exten','error','newstate','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','info','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','isNil','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','.WAV','find','monitors','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum'];(function(_0x1ce7dd,_0x1cbada){var _0x32dea1=function(_0x2302d0){while(--_0x2302d0){_0x1ce7dd['push'](_0x1ce7dd['shift']());}};_0x32dea1(++_0x1cbada);}(_0xb794,0x181));var _0x4b79=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb794[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x4b79('0x0'));var utils=require(_0x4b79('0x1'));var recordings={};function writeDB(_0x69cfc9){utils['info'](util[_0x4b79('0x2')](_0x4b79('0x3'),_0x69cfc9[_0x4b79('0x4')]));if(_0x69cfc9[_0x4b79('0x5')]){utils['getUserByInternal'](_0x69cfc9[_0x4b79('0x5')])[_0x4b79('0x6')](function(_0x3661ec){if(_0x3661ec){_0x69cfc9[_0x4b79('0x7')]=_0x3661ec[_0x4b79('0x8')];_0x69cfc9[_0x4b79('0x9')]=_0x3661ec['id'];}utils[_0x4b79('0xa')]('CreateVoiceRecording',_0x69cfc9);});}else{utils[_0x4b79('0xa')](_0x4b79('0xb'),_0x69cfc9);}}exports[_0x4b79('0xc')]=function(_0x37e585){try{utils[_0x4b79('0xd')](util[_0x4b79('0x2')](_0x4b79('0xe'),_0x37e585[_0x4b79('0x4')]),_0x37e585);if(_0x37e585[_0x4b79('0x4')]==_0x37e585[_0x4b79('0xf')]){utils['info'](util['format']('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x37e585[_0x4b79('0x4')],_0x37e585[_0x4b79('0x10')],_0x37e585[_0x4b79('0x11')]));recordings[_0x37e585['uniqueid']]={'uniqueid':_0x37e585['uniqueid'],'accountcode':_0x37e585[_0x4b79('0x5')],'exten':_0x37e585[_0x4b79('0x11')],'context':_0x37e585[_0x4b79('0x10')],'channel':_0x37e585['channel'],'monitors':[]};}}catch(_0x414260){utils[_0x4b79('0x12')](util[_0x4b79('0x2')](_0x4b79('0xe'),_0x37e585[_0x4b79('0x4')]),_0x414260);}};exports[_0x4b79('0x13')]=function(_0x4fbcc9){try{utils[_0x4b79('0xd')](util[_0x4b79('0x2')](_0x4b79('0x14'),_0x4fbcc9[_0x4b79('0x4')]),_0x4fbcc9);if(!_['isNil'](recordings[_0x4fbcc9[_0x4b79('0x4')]])&&_0x4fbcc9[_0x4b79('0x15')]==0x6){utils['info'](util[_0x4b79('0x2')](_0x4b79('0x16'),_0x4fbcc9[_0x4b79('0x4')],_0x4fbcc9[_0x4b79('0x10')],_0x4fbcc9['channel']));}else if(!_['isNil'](recordings[_0x4fbcc9[_0x4b79('0xf')]])&&_0x4fbcc9[_0x4b79('0x15')]==0x6&&_0x4fbcc9[_0x4b79('0x10')]!='transfer'){utils[_0x4b79('0x17')](util[_0x4b79('0x2')](_0x4b79('0x18'),_0x4fbcc9['uniqueid'],_0x4fbcc9[_0x4b79('0xf')],_0x4fbcc9[_0x4b79('0x10')],_0x4fbcc9['channel']));recordings[_0x4fbcc9['linkedid']][_0x4b79('0x5')]=_0x4fbcc9[_0x4b79('0x5')];}}catch(_0x1f3abb){utils['error'](util[_0x4b79('0x2')](_0x4b79('0x14'),_0x4fbcc9[_0x4b79('0x4')]),_0x1f3abb);}};exports[_0x4b79('0x19')]=function(_0x31d95e){try{if(!_[_0x4b79('0x1a')](_0x31d95e['variable'])&&!_[_0x4b79('0x1a')](_0x31d95e[_0x4b79('0x1b')][_0x4b79('0x1c')])){utils['debug'](util['format']('[%s][recordings][varset]',_0x31d95e[_0x4b79('0x4')]),_0x31d95e);utils[_0x4b79('0x17')](util['format'](_0x4b79('0x1d'),_0x31d95e[_0x4b79('0x4')],_0x31d95e['variable'],_0x31d95e[_0x4b79('0x1e')]));if(_['endsWith'](_0x31d95e['value'],_0x4b79('0x1f'))){_0x31d95e[_0x4b79('0x1e')]=_0x31d95e[_0x4b79('0x1e')][_0x4b79('0x20')](_0x4b79('0x1f'),_0x4b79('0x21'));}if(recordings[_0x31d95e[_0x4b79('0xf')]]){var _0xfef11a=_[_0x4b79('0x22')](recordings[_0x31d95e['linkedid']][_0x4b79('0x23')],{'value':_0x31d95e[_0x4b79('0x1e')]});if(_['isNil'](_0xfef11a)){recordings[_0x31d95e[_0x4b79('0xf')]][_0x4b79('0x23')]['push']({'value':_0x31d95e[_0x4b79('0x1e')]});}}}}catch(_0x103246){utils[_0x4b79('0x12')](util[_0x4b79('0x2')]('[%s][recordings][varset]',_0x31d95e[_0x4b79('0x4')]),_0x103246);}};exports[_0x4b79('0x24')]=function(_0x20f56a){try{if(!_['isNil'](recordings[_0x20f56a[_0x4b79('0x4')]])){utils[_0x4b79('0xd')](util[_0x4b79('0x2')]('[%s][recordings][hangup]',_0x20f56a[_0x4b79('0x4')]),_0x20f56a);utils[_0x4b79('0x17')](util[_0x4b79('0x2')](_0x4b79('0x25'),_0x20f56a[_0x4b79('0x4')],_0x20f56a[_0x4b79('0x26')],_0x20f56a[_0x4b79('0x27')],_0x20f56a[_0x4b79('0x28')]));recordings[_0x20f56a['uniqueid']][_0x4b79('0x26')]=_0x20f56a['calleridnum'];recordings[_0x20f56a[_0x4b79('0x4')]][_0x4b79('0x27')]=_0x20f56a[_0x4b79('0x27')];recordings[_0x20f56a[_0x4b79('0x4')]][_0x4b79('0x29')]=_0x20f56a[_0x4b79('0x29')];recordings[_0x20f56a[_0x4b79('0x4')]][_0x4b79('0x2a')]=_0x20f56a[_0x4b79('0x2a')];if(recordings[_0x20f56a[_0x4b79('0x4')]][_0x4b79('0x2b')]==_0x4b79('0x2c')&&recordings[_0x20f56a[_0x4b79('0x4')]][_0x4b79('0x5')]){recordings[_0x20f56a[_0x4b79('0x4')]][_0x4b79('0x29')]=recordings[_0x20f56a['uniqueid']]['accountcode'];recordings[_0x20f56a['uniqueid']][_0x4b79('0x2a')]='';}recordings[_0x20f56a[_0x4b79('0x4')]][_0x4b79('0x23')][_0x4b79('0x2d')](function(_0x3582e7){var _0x3df16d=_['clone'](recordings[_0x20f56a['uniqueid']]);_0x3df16d[_0x4b79('0x1e')]=_0x3582e7['value'];writeDB(_0x3df16d);});delete recordings[_0x20f56a[_0x4b79('0x4')]];}}catch(_0x42d996){utils[_0x4b79('0x12')](util[_0x4b79('0x2')](_0x4b79('0x2e'),_0x20f56a[_0x4b79('0x4')]),_0x42d996);}};exports[_0x4b79('0x2f')]=function(_0x5b6ec5){try{if(!_[_0x4b79('0x1a')](recordings[_0x5b6ec5[_0x4b79('0x4')]])){utils[_0x4b79('0xd')](util[_0x4b79('0x2')](_0x4b79('0x30'),_0x5b6ec5['uniqueid']),_0x5b6ec5);utils[_0x4b79('0x17')](util[_0x4b79('0x2')](_0x4b79('0x31'),_0x5b6ec5[_0x4b79('0x4')],_0x5b6ec5[_0x4b79('0x32')],_0x5b6ec5['appdata']));if(_0x5b6ec5[_0x4b79('0x32')]['toLowerCase']()==_0x4b79('0x33')&&_[_0x4b79('0x34')](_0x5b6ec5[_0x4b79('0x35')][_0x4b79('0x36')](),'cdr')){var _0x43c26f=_0x5b6ec5[_0x4b79('0x35')][_0x4b79('0x37')]('=');var _0x43b57e=_0x43c26f[0x0]['substring'](_0x43c26f[0x0]['lastIndexOf']('(')+0x1,_0x43c26f[0x0][_0x4b79('0x38')](')'));var _0xb4d8b4=_0x43c26f[0x1];recordings[_0x5b6ec5['uniqueid']][_0x43b57e]=_0xb4d8b4;}}}catch(_0x5d2981){utils[_0x4b79('0x12')](util[_0x4b79('0x2')](_0x4b79('0x30'),_0x5b6ec5[_0x4b79('0x4')]),_0x5d2981);}};exports[_0x4b79('0x39')]=function(_0x237811){try{if(!_['isNil'](recordings[_0x237811[_0x4b79('0x4')]])){utils['debug'](util['format']('[%s][recordings][queuecallerjoin]',_0x237811['uniqueid']),_0x237811);utils[_0x4b79('0x17')](util['format'](_0x4b79('0x3a'),_0x237811[_0x4b79('0x4')],_0x237811['queue']));recordings[_0x237811[_0x4b79('0x4')]][_0x4b79('0x3b')]=_0x237811[_0x4b79('0x3b')];}}catch(_0x15b9a6){utils['error'](util[_0x4b79('0x2')](_0x4b79('0x3c'),_0x237811[_0x4b79('0x4')]),_0x15b9a6);}}; \ No newline at end of file +var _0xdcc1=['debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','error','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','.WAV','monitors','push','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','cause-txt','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','queue','lodash','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel'];(function(_0xc0c199,_0x3fdfd8){var _0x292349=function(_0x48a26b){while(--_0x48a26b){_0xc0c199['push'](_0xc0c199['shift']());}};_0x292349(++_0x3fdfd8);}(_0xdcc1,0x15f));var _0x1dcc=function(_0x2368db,_0x15c4b6){_0x2368db=_0x2368db-0x0;var _0x1dad2d=_0xdcc1[_0x2368db];return _0x1dad2d;};'use strict';var _=require(_0x1dcc('0x0'));var util=require('util');var utils=require(_0x1dcc('0x1'));var recordings={};function writeDB(_0x2c79d0){utils[_0x1dcc('0x2')](util[_0x1dcc('0x3')](_0x1dcc('0x4'),_0x2c79d0[_0x1dcc('0x5')]));if(_0x2c79d0[_0x1dcc('0x6')]){utils[_0x1dcc('0x7')](_0x2c79d0[_0x1dcc('0x6')])[_0x1dcc('0x8')](function(_0x3c63bb){if(_0x3c63bb){_0x2c79d0[_0x1dcc('0x9')]=_0x3c63bb[_0x1dcc('0xa')];_0x2c79d0[_0x1dcc('0xb')]=_0x3c63bb['id'];}utils[_0x1dcc('0xc')](_0x1dcc('0xd'),_0x2c79d0);});}else{utils[_0x1dcc('0xc')](_0x1dcc('0xd'),_0x2c79d0);}}exports[_0x1dcc('0xe')]=function(_0x39c716){try{utils[_0x1dcc('0xf')](util[_0x1dcc('0x3')](_0x1dcc('0x10'),_0x39c716[_0x1dcc('0x5')]),_0x39c716);if(_0x39c716[_0x1dcc('0x5')]==_0x39c716[_0x1dcc('0x11')]){utils[_0x1dcc('0x2')](util[_0x1dcc('0x3')](_0x1dcc('0x12'),_0x39c716[_0x1dcc('0x5')],_0x39c716[_0x1dcc('0x13')],_0x39c716[_0x1dcc('0x14')]));recordings[_0x39c716[_0x1dcc('0x5')]]={'uniqueid':_0x39c716['uniqueid'],'accountcode':_0x39c716[_0x1dcc('0x6')],'exten':_0x39c716[_0x1dcc('0x14')],'context':_0x39c716[_0x1dcc('0x13')],'channel':_0x39c716[_0x1dcc('0x15')],'monitors':[]};}}catch(_0x4c2c34){utils['error'](util[_0x1dcc('0x3')](_0x1dcc('0x10'),_0x39c716[_0x1dcc('0x5')]),_0x4c2c34);}};exports[_0x1dcc('0x16')]=function(_0x4c3fbc){try{utils[_0x1dcc('0xf')](util[_0x1dcc('0x3')](_0x1dcc('0x17'),_0x4c3fbc['uniqueid']),_0x4c3fbc);if(!_[_0x1dcc('0x18')](recordings[_0x4c3fbc[_0x1dcc('0x5')]])&&_0x4c3fbc[_0x1dcc('0x19')]==0x6){utils[_0x1dcc('0x2')](util[_0x1dcc('0x3')](_0x1dcc('0x1a'),_0x4c3fbc[_0x1dcc('0x5')],_0x4c3fbc[_0x1dcc('0x13')],_0x4c3fbc[_0x1dcc('0x15')]));}else if(!_['isNil'](recordings[_0x4c3fbc[_0x1dcc('0x11')]])&&_0x4c3fbc['channelstate']==0x6&&_0x4c3fbc[_0x1dcc('0x13')]!=_0x1dcc('0x1b')){utils[_0x1dcc('0x2')](util[_0x1dcc('0x3')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x4c3fbc[_0x1dcc('0x5')],_0x4c3fbc[_0x1dcc('0x11')],_0x4c3fbc['context'],_0x4c3fbc['channel']));recordings[_0x4c3fbc['linkedid']][_0x1dcc('0x6')]=_0x4c3fbc[_0x1dcc('0x6')];}}catch(_0x5a0e5e){utils[_0x1dcc('0x1c')](util[_0x1dcc('0x3')](_0x1dcc('0x17'),_0x4c3fbc['uniqueid']),_0x5a0e5e);}};exports['varset']=function(_0x5ce00c){try{if(!_[_0x1dcc('0x18')](_0x5ce00c['variable'])&&!_[_0x1dcc('0x18')](_0x5ce00c[_0x1dcc('0x1d')][_0x1dcc('0x1e')])){utils[_0x1dcc('0xf')](util['format'](_0x1dcc('0x1f'),_0x5ce00c[_0x1dcc('0x5')]),_0x5ce00c);utils[_0x1dcc('0x2')](util[_0x1dcc('0x3')](_0x1dcc('0x20'),_0x5ce00c[_0x1dcc('0x5')],_0x5ce00c['variable'],_0x5ce00c[_0x1dcc('0x21')]));if(_['endsWith'](_0x5ce00c['value'],_0x1dcc('0x22'))){_0x5ce00c[_0x1dcc('0x21')]=_0x5ce00c[_0x1dcc('0x21')][_0x1dcc('0x23')](_0x1dcc('0x22'),_0x1dcc('0x24'));}if(recordings[_0x5ce00c[_0x1dcc('0x11')]]){var _0x416426=_['find'](recordings[_0x5ce00c['linkedid']]['monitors'],{'value':_0x5ce00c[_0x1dcc('0x21')]});if(_['isNil'](_0x416426)){recordings[_0x5ce00c[_0x1dcc('0x11')]][_0x1dcc('0x25')][_0x1dcc('0x26')]({'value':_0x5ce00c[_0x1dcc('0x21')]});}}}}catch(_0x2ef66d){utils[_0x1dcc('0x1c')](util['format'](_0x1dcc('0x1f'),_0x5ce00c[_0x1dcc('0x5')]),_0x2ef66d);}};exports[_0x1dcc('0x27')]=function(_0x299c1c){try{if(!_[_0x1dcc('0x18')](recordings[_0x299c1c[_0x1dcc('0x5')]])){utils[_0x1dcc('0xf')](util[_0x1dcc('0x3')]('[%s][recordings][hangup]',_0x299c1c[_0x1dcc('0x5')]),_0x299c1c);utils[_0x1dcc('0x2')](util['format'](_0x1dcc('0x28'),_0x299c1c['uniqueid'],_0x299c1c['calleridnum'],_0x299c1c['calleridname'],_0x299c1c[_0x1dcc('0x29')]));recordings[_0x299c1c[_0x1dcc('0x5')]][_0x1dcc('0x2a')]=_0x299c1c[_0x1dcc('0x2a')];recordings[_0x299c1c[_0x1dcc('0x5')]][_0x1dcc('0x2b')]=_0x299c1c['calleridname'];recordings[_0x299c1c[_0x1dcc('0x5')]][_0x1dcc('0x2c')]=_0x299c1c[_0x1dcc('0x2c')];recordings[_0x299c1c['uniqueid']][_0x1dcc('0x2d')]=_0x299c1c['connectedlinename'];if(recordings[_0x299c1c[_0x1dcc('0x5')]][_0x1dcc('0x2e')]==_0x1dcc('0x2f')&&recordings[_0x299c1c['uniqueid']][_0x1dcc('0x6')]){recordings[_0x299c1c[_0x1dcc('0x5')]][_0x1dcc('0x2c')]=recordings[_0x299c1c[_0x1dcc('0x5')]][_0x1dcc('0x6')];recordings[_0x299c1c['uniqueid']][_0x1dcc('0x2d')]='';}recordings[_0x299c1c['uniqueid']][_0x1dcc('0x25')][_0x1dcc('0x30')](function(_0x3942dc){var _0x53add2=_['clone'](recordings[_0x299c1c[_0x1dcc('0x5')]]);_0x53add2[_0x1dcc('0x21')]=_0x3942dc[_0x1dcc('0x21')];writeDB(_0x53add2);});delete recordings[_0x299c1c['uniqueid']];}}catch(_0xabbbc1){utils[_0x1dcc('0x1c')](util['format']('[%s][recordings][hangup]',_0x299c1c[_0x1dcc('0x5')]),_0xabbbc1);}};exports['newexten']=function(_0x1ec3da){try{if(!_[_0x1dcc('0x18')](recordings[_0x1ec3da[_0x1dcc('0x5')]])){utils[_0x1dcc('0xf')](util[_0x1dcc('0x3')](_0x1dcc('0x31'),_0x1ec3da[_0x1dcc('0x5')]),_0x1ec3da);utils['info'](util['format'](_0x1dcc('0x32'),_0x1ec3da[_0x1dcc('0x5')],_0x1ec3da[_0x1dcc('0x33')],_0x1ec3da[_0x1dcc('0x34')]));if(_0x1ec3da[_0x1dcc('0x33')][_0x1dcc('0x35')]()==_0x1dcc('0x36')&&_['startsWith'](_0x1ec3da['appdata']['toLowerCase'](),_0x1dcc('0x37'))){var _0x425444=_0x1ec3da[_0x1dcc('0x34')][_0x1dcc('0x38')]('=');var _0x558cae=_0x425444[0x0][_0x1dcc('0x39')](_0x425444[0x0][_0x1dcc('0x3a')]('(')+0x1,_0x425444[0x0][_0x1dcc('0x3a')](')'));var _0x4e5bcb=_0x425444[0x1];recordings[_0x1ec3da[_0x1dcc('0x5')]][_0x558cae]=_0x4e5bcb;}}}catch(_0x2ebaa3){utils[_0x1dcc('0x1c')](util[_0x1dcc('0x3')]('[%s][recordings][newexten]',_0x1ec3da['uniqueid']),_0x2ebaa3);}};exports['queuecallerjoin']=function(_0x5b9dc4){try{if(!_['isNil'](recordings[_0x5b9dc4[_0x1dcc('0x5')]])){utils['debug'](util['format'](_0x1dcc('0x3b'),_0x5b9dc4[_0x1dcc('0x5')]),_0x5b9dc4);utils[_0x1dcc('0x2')](util[_0x1dcc('0x3')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x5b9dc4[_0x1dcc('0x5')],_0x5b9dc4[_0x1dcc('0x3c')]));recordings[_0x5b9dc4[_0x1dcc('0x5')]][_0x1dcc('0x3c')]=_0x5b9dc4[_0x1dcc('0x3c')];}}catch(_0x3a0b98){utils[_0x1dcc('0x1c')](util['format'](_0x1dcc('0x3b'),_0x5b9dc4['uniqueid']),_0x3a0b98);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 5de12b3..298383d 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 _0x1e04=['request','CreateVoiceTransferReport','blinds','blindtransfer','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','attendedtransfer','debug','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetaccountcode','transfertargetcontext','util','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid'];(function(_0x2f63c4,_0x404e35){var _0x59cf49=function(_0x424327){while(--_0x424327){_0x2f63c4['push'](_0x2f63c4['shift']());}};_0x59cf49(++_0x404e35);}(_0x1e04,0x71));var _0x41e0=function(_0xf69aa4,_0x345358){_0xf69aa4=_0xf69aa4-0x0;var _0x296474=_0x1e04[_0xf69aa4];return _0x296474;};'use strict';var _=require('lodash');var util=require(_0x41e0('0x0'));var utils=require('./utils');function writeDB(_0x40beae){utils[_0x41e0('0x1')](util[_0x41e0('0x2')](_0x41e0('0x3'),_0x40beae[_0x41e0('0x4')]===_0x41e0('0x5')?_0x40beae[_0x41e0('0x6')]:_0x40beae['uniqueid'],_0x40beae[_0x41e0('0x4')]));utils[_0x41e0('0x7')](_0x41e0('0x8'),_0x40beae);}exports[_0x41e0('0x9')]={};exports[_0x41e0('0xa')]=function(_0x363c10){try{utils['debug'](util[_0x41e0('0x2')](_0x41e0('0xb'),_0x363c10['uniqueid']),_0x363c10);utils[_0x41e0('0x1')](util[_0x41e0('0x2')](_0x41e0('0xc'),_0x363c10['uniqueid'],_0x363c10[_0x41e0('0xd')],_0x363c10[_0x41e0('0xe')],_0x363c10[_0x41e0('0xf')],_0x363c10[_0x41e0('0x10')]));_0x363c10[_0x41e0('0x4')]=_0x41e0('0x11');exports[_0x41e0('0x9')][_0x363c10[_0x41e0('0x12')]]=_0x363c10;writeDB(_0x363c10);}catch(_0x1cced4){utils[_0x41e0('0x13')](util[_0x41e0('0x2')](_0x41e0('0xb'),_0x363c10['uniqueid']),_0x1cced4);}};exports[_0x41e0('0x14')]=function(_0x21abab){try{utils[_0x41e0('0x15')](util[_0x41e0('0x2')](_0x41e0('0x16'),_0x21abab[_0x41e0('0x6')]),_0x21abab);utils[_0x41e0('0x1')](util['format'](_0x41e0('0x17'),_0x21abab['origtransfereruniqueid'],_0x21abab[_0x41e0('0x18')],_0x21abab[_0x41e0('0x19')],_0x21abab[_0x41e0('0x1a')],_0x21abab[_0x41e0('0x1b')]));_0x21abab=_[_0x41e0('0x1c')](_0x21abab,{'transfererchannel':_0x21abab[_0x41e0('0x1d')],'transferercalleridnum':_0x21abab[_0x41e0('0x18')],'transferercalleridname':_0x21abab[_0x41e0('0x19')],'transfererconnectedlinenum':_0x21abab['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x21abab[_0x41e0('0x1e')],'transfereraccountcode':_0x21abab[_0x41e0('0x1f')],'transferercontext':_0x21abab[_0x41e0('0x20')],'transfererexten':_0x21abab['secondtransfererexten'],'transfererlinkedid':_0x21abab['origtransfererlinkedid'],'context':_0x21abab[_0x41e0('0x21')],'extension':_0x21abab[_0x41e0('0x22')],'type':_0x41e0('0x5')});if(_[_0x41e0('0x23')](_0x21abab[_0x41e0('0x24')])){_0x21abab=_[_0x41e0('0x1c')](_0x21abab,{'transfereechannel':_0x21abab[_0x41e0('0x25')],'transfereecalleridnum':_0x21abab[_0x41e0('0x1a')],'transfereecalleridname':_0x21abab[_0x41e0('0x1b')],'transfereeconnectedlinenum':_0x21abab['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x21abab['transfertargetconnectedlinename'],'transfereeaccountcode':_0x21abab[_0x41e0('0x26')],'transfereecontext':_0x21abab[_0x41e0('0x27')],'transfereeexten':_0x21abab['transfertargetexten'],'transfereelinkedid':_0x21abab['transfertargetlinkedid']});}writeDB(_0x21abab);}catch(_0xdd656c){utils[_0x41e0('0x13')](util[_0x41e0('0x2')]('[%s][transfers][attendedtransfer]',_0x21abab[_0x41e0('0x6')]),_0xdd656c);}}; \ No newline at end of file +var _0x13ab=['lodash','util','info','format','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereruniqueid','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','origtransfererlinkedid','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','[%s][transfers][attendedtransfer]'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x13ab,0x171));var _0xb13a=function(_0x5dcb8,_0x5dc94e){_0x5dcb8=_0x5dcb8-0x0;var _0x5dece0=_0x13ab[_0x5dcb8];return _0x5dece0;};'use strict';var _=require(_0xb13a('0x0'));var util=require(_0xb13a('0x1'));var utils=require('./utils');function writeDB(_0x9faa9e){utils[_0xb13a('0x2')](util[_0xb13a('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x9faa9e[_0xb13a('0x4')]===_0xb13a('0x5')?_0x9faa9e[_0xb13a('0x6')]:_0x9faa9e[_0xb13a('0x7')],_0x9faa9e[_0xb13a('0x4')]));utils[_0xb13a('0x8')](_0xb13a('0x9'),_0x9faa9e);}exports[_0xb13a('0xa')]={};exports[_0xb13a('0xb')]=function(_0x375755){try{utils[_0xb13a('0xc')](util[_0xb13a('0x3')](_0xb13a('0xd'),_0x375755[_0xb13a('0x7')]),_0x375755);utils['info'](util[_0xb13a('0x3')](_0xb13a('0xe'),_0x375755[_0xb13a('0x7')],_0x375755[_0xb13a('0xf')],_0x375755[_0xb13a('0x10')],_0x375755['transfereecalleridnum'],_0x375755['transfereecalleridname']));_0x375755[_0xb13a('0x4')]='blind';exports['blinds'][_0x375755[_0xb13a('0x11')]]=_0x375755;writeDB(_0x375755);}catch(_0x33e16a){utils['error'](util['format'](_0xb13a('0xd'),_0x375755[_0xb13a('0x7')]),_0x33e16a);}};exports[_0xb13a('0x12')]=function(_0x371e3b){try{utils[_0xb13a('0xc')](util[_0xb13a('0x3')]('[%s][transfers][attendedtransfer]',_0x371e3b['origtransfereruniqueid']),_0x371e3b);utils[_0xb13a('0x2')](util[_0xb13a('0x3')](_0xb13a('0x13'),_0x371e3b['origtransfereruniqueid'],_0x371e3b[_0xb13a('0x14')],_0x371e3b[_0xb13a('0x15')],_0x371e3b[_0xb13a('0x16')],_0x371e3b[_0xb13a('0x17')]));_0x371e3b=_[_0xb13a('0x18')](_0x371e3b,{'transfererchannel':_0x371e3b[_0xb13a('0x19')],'transferercalleridnum':_0x371e3b[_0xb13a('0x14')],'transferercalleridname':_0x371e3b['origtransferercalleridname'],'transfererconnectedlinenum':_0x371e3b[_0xb13a('0x1a')],'transfererconnectedlinename':_0x371e3b[_0xb13a('0x1b')],'transfereraccountcode':_0x371e3b['origtransfereraccountcode'],'transferercontext':_0x371e3b[_0xb13a('0x1c')],'transfererexten':_0x371e3b['secondtransfererexten'],'transfererlinkedid':_0x371e3b[_0xb13a('0x1d')],'context':_0x371e3b['origtransferercontext'],'extension':_0x371e3b[_0xb13a('0x1e')],'type':'attended'});if(_[_0xb13a('0x1f')](_0x371e3b[_0xb13a('0x20')])){_0x371e3b=_['assign'](_0x371e3b,{'transfereechannel':_0x371e3b[_0xb13a('0x21')],'transfereecalleridnum':_0x371e3b[_0xb13a('0x16')],'transfereecalleridname':_0x371e3b[_0xb13a('0x17')],'transfereeconnectedlinenum':_0x371e3b['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x371e3b[_0xb13a('0x22')],'transfereeaccountcode':_0x371e3b[_0xb13a('0x23')],'transfereecontext':_0x371e3b[_0xb13a('0x24')],'transfereeexten':_0x371e3b[_0xb13a('0x25')],'transfereelinkedid':_0x371e3b[_0xb13a('0x26')]});}writeDB(_0x371e3b);}catch(_0x2da2b3){utils[_0xb13a('0x27')](util[_0xb13a('0x3')](_0xb13a('0x28'),_0x371e3b[_0xb13a('0x6')]),_0x2da2b3);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index eab052b..bc0c6ec 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 _0x3e8a=['getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','notfound','catch','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acwTimeout','result','[utils][getVoiceQueueByName]','addTime','add','seconds','subtract','format','diffTime','sumTime','now','YYYY-MM-DD\x20HH:mm:ss','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','found','[utils][getUserByInternal]'];(function(_0x405ae6,_0x40b3e6){var _0x266ea2=function(_0x238c05){while(--_0x238c05){_0x405ae6['push'](_0x405ae6['shift']());}};_0x266ea2(++_0x40b3e6);}(_0x3e8a,0x78));var _0xa3e8=function(_0x4e9bb4,_0x286ed8){_0x4e9bb4=_0x4e9bb4-0x0;var _0x399a77=_0x3e8a[_0x4e9bb4];return _0x399a77;};'use strict';var BPromise=require(_0xa3e8('0x0'));var jayson=require(_0xa3e8('0x1'));var moment=require(_0xa3e8('0x2'));var util=require(_0xa3e8('0x3'));var client=jayson[_0xa3e8('0x4')][_0xa3e8('0x5')]({'port':0x2329});var logger=require(_0xa3e8('0x6'))(_0xa3e8('0x7'));exports[_0xa3e8('0x8')]=function(_0x5d2466,_0x16fa1b){logger[_0xa3e8('0x8')](_0x5d2466,_0x16fa1b?util[_0xa3e8('0x9')](_0x16fa1b,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x40acab,_0x40c324){logger[_0xa3e8('0xa')](_0x40acab,_0x40c324?util[_0xa3e8('0x9')](_0x40c324,{'showHidden':![],'depth':null}):'');};exports[_0xa3e8('0xb')]=function(_0x57de64,_0x20d95b){logger[_0xa3e8('0xb')](_0x57de64,_0x20d95b?util['inspect'](_0x20d95b,{'showHidden':![],'depth':null}):'');};exports[_0xa3e8('0xc')]=function(_0x29ea1b,_0x1c5a89){return client[_0xa3e8('0xc')](_0x29ea1b,{'body':_0x1c5a89})[_0xa3e8('0xd')](function(_0x4a8068){logger[_0xa3e8('0xa')](_0xa3e8('0xe'),_0x29ea1b,_0x4a8068?util[_0xa3e8('0x9')](_0x4a8068,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x3ac218){logger[_0xa3e8('0xb')](_0xa3e8('0xe'),_0x29ea1b,_0x3ac218?util[_0xa3e8('0x9')](_0x3ac218,{'showHidden':![],'depth':null}):'');});};function getUser(_0x96037d){return client['request'](_0xa3e8('0xf'),{'options':{'raw':!![],'attributes':['id',_0xa3e8('0x10'),_0xa3e8('0x11'),_0xa3e8('0x12')],'where':_0x96037d,'limit':0x1}})[_0xa3e8('0xd')](function(_0x2f9d77){logger[_0xa3e8('0xa')](_0xa3e8('0x13'),JSON[_0xa3e8('0x14')](_0x96037d),_0x2f9d77?util[_0xa3e8('0x9')](_0x2f9d77,{'showHidden':![],'depth':null}):'');return _0x2f9d77['result'][_0xa3e8('0x15')]?_0x2f9d77['result'][0x0]:null;});}exports['getUserByInternal']=function(_0x15b1e2){return new BPromise(function(_0x53d50c,_0x2d0a5e){if(_0x15b1e2){return getUser({'internal':_0x15b1e2})[_0xa3e8('0xd')](function(_0x4bc60b){logger[_0xa3e8('0x8')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x15b1e2,_0x4bc60b?_0xa3e8('0x16'):'notfound');return _0x53d50c(_0x4bc60b);})['catch'](function(_0x1e7928){logger[_0xa3e8('0xb')](_0xa3e8('0x17'),_0x1e7928?util[_0xa3e8('0x9')](_0x1e7928,{'showHidden':![],'depth':null}):'');return _0x53d50c(null);});}return _0x53d50c(null);});};exports[_0xa3e8('0x18')]=function(_0x1b015a){return new BPromise(function(_0x1f994b,_0x5ddc22){if(_0x1b015a){return getUser({'interface':_0x1b015a})[_0xa3e8('0xd')](function(_0x2081a2){logger[_0xa3e8('0x8')](_0xa3e8('0x19'),_0x1b015a,_0x2081a2?'found':'notfound');return _0x1f994b(_0x2081a2);})['catch'](function(_0x4041c0){logger['error'](_0xa3e8('0x1a'),_0x4041c0?util['inspect'](_0x4041c0,{'showHidden':![],'depth':null}):'');return _0x1f994b(null);});}return _0x1f994b(null);});};exports[_0xa3e8('0x1b')]=function(_0x4ee977){return new BPromise(function(_0x25e9a8,_0xfdbebb){if(_0x4ee977){return getUser({'name':_0x4ee977})[_0xa3e8('0xd')](function(_0x270b35){logger['info'](_0xa3e8('0x1c'),_0x4ee977,_0x270b35?'found':_0xa3e8('0x1d'));return _0x25e9a8(_0x270b35);})[_0xa3e8('0x1e')](function(_0x514237){logger[_0xa3e8('0xb')](_0xa3e8('0x1f'),_0x514237?util[_0xa3e8('0x9')](_0x514237,{'showHidden':![],'depth':null}):'');return _0x25e9a8(null);});}return _0x25e9a8(null);});};exports[_0xa3e8('0x20')]=function(_0x623a79){return new BPromise(function(_0xf6918,_0x146594){if(_0x623a79){return client['request'](_0xa3e8('0x21'),{'options':{'raw':!![],'attributes':['id',_0xa3e8('0x11'),'type','acw',_0xa3e8('0x22')],'where':{'name':_0x623a79},'limit':0x1}})[_0xa3e8('0xd')](function(_0x3b0422){logger[_0xa3e8('0xa')]('[utils][getVoiceQueueByName]\x20name:%s',_0x623a79,_0x3b0422?util['inspect'](_0x3b0422,{'showHidden':![],'depth':null}):'');logger['info']('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x623a79,_0x3b0422?_0xa3e8('0x16'):_0xa3e8('0x1d'));return _0xf6918(_0x3b0422[_0xa3e8('0x23')][_0xa3e8('0x15')]?_0x3b0422[_0xa3e8('0x23')][0x0]:null);})[_0xa3e8('0x1e')](function(_0x31917b){logger[_0xa3e8('0xb')](_0xa3e8('0x24'),_0x31917b?util[_0xa3e8('0x9')](_0x31917b,{'showHidden':![],'depth':null}):'');return _0xf6918(null);});}return _0xf6918(null);});};exports[_0xa3e8('0x25')]=function(_0xe2c76d,_0x599539){return moment(_0xe2c76d)[_0xa3e8('0x26')](_0x599539,_0xa3e8('0x27'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports['subtractTime']=function(_0x32d883,_0x44f141){return moment(_0x32d883)[_0xa3e8('0x28')](_0x44f141,_0xa3e8('0x27'))[_0xa3e8('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xa3e8('0x2a')]=function(_0x3a3261,_0x3ea679){return moment(_0x3a3261)['diff'](moment(_0x3ea679),_0xa3e8('0x27'));};exports[_0xa3e8('0x2b')]=function(_0x5cd1c2,_0x343140){return parseInt(_0x5cd1c2,0xa)+parseInt(_0x343140,0xa);};exports[_0xa3e8('0x2c')]=function(){return moment()[_0xa3e8('0x29')](_0xa3e8('0x2d'));};exports[_0xa3e8('0x2e')]=function(_0xfadb2,_0x2ed772){if(_0x2ed772){return moment(_0xfadb2)['isAfter'](_0x2ed772);}return!![];};exports[_0xa3e8('0x2f')]=function(_0xde5e9,_0x1afdb3){if(_0x1afdb3){return moment(_0xde5e9)[_0xa3e8('0x2f')](_0x1afdb3);}else if(_0xde5e9){return!![];}return![];}; \ No newline at end of file +var _0x19af=['bluebird','jayson/promise','util','client','http','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','GetUser','internal','name','interface','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','catch','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','found','[utils][getVoiceQueueByName]','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','now','isBefore'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x19af,0xe6));var _0xf19a=function(_0x4b5161,_0xcce11f){_0x4b5161=_0x4b5161-0x0;var _0x2c9c3c=_0x19af[_0x4b5161];return _0x2c9c3c;};'use strict';var BPromise=require(_0xf19a('0x0'));var jayson=require(_0xf19a('0x1'));var moment=require('moment');var util=require(_0xf19a('0x2'));var client=jayson[_0xf19a('0x3')][_0xf19a('0x4')]({'port':0x2329});var logger=require('../../config/logger')('xdr');exports[_0xf19a('0x5')]=function(_0x548fab,_0x5bdd87){logger[_0xf19a('0x5')](_0x548fab,_0x5bdd87?util[_0xf19a('0x6')](_0x5bdd87,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x5511ae,_0x516925){logger[_0xf19a('0x7')](_0x5511ae,_0x516925?util[_0xf19a('0x6')](_0x516925,{'showHidden':![],'depth':null}):'');};exports[_0xf19a('0x8')]=function(_0x4aaec5,_0x2ca081){logger[_0xf19a('0x8')](_0x4aaec5,_0x2ca081?util[_0xf19a('0x6')](_0x2ca081,{'showHidden':![],'depth':null}):'');};exports[_0xf19a('0x9')]=function(_0x17e0ef,_0x38ce44){return client[_0xf19a('0x9')](_0x17e0ef,{'body':_0x38ce44})[_0xf19a('0xa')](function(_0x3ba298){logger[_0xf19a('0x7')](_0xf19a('0xb'),_0x17e0ef,_0x3ba298?util[_0xf19a('0x6')](_0x3ba298,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x4e3714){logger[_0xf19a('0x8')]('[utils][request]\x20name:%s',_0x17e0ef,_0x4e3714?util[_0xf19a('0x6')](_0x4e3714,{'showHidden':![],'depth':null}):'');});};function getUser(_0xe9c08b){return client[_0xf19a('0x9')](_0xf19a('0xc'),{'options':{'raw':!![],'attributes':['id',_0xf19a('0xd'),_0xf19a('0xe'),_0xf19a('0xf')],'where':_0xe9c08b,'limit':0x1}})[_0xf19a('0xa')](function(_0x481706){logger[_0xf19a('0x7')]('[utils][getUser]\x20where:%s',JSON['stringify'](_0xe9c08b),_0x481706?util['inspect'](_0x481706,{'showHidden':![],'depth':null}):'');return _0x481706[_0xf19a('0x10')][_0xf19a('0x11')]?_0x481706[_0xf19a('0x10')][0x0]:null;});}exports[_0xf19a('0x12')]=function(_0x595a2f){return new BPromise(function(_0x36be58,_0x2840dc){if(_0x595a2f){return getUser({'internal':_0x595a2f})['then'](function(_0xebca49){logger[_0xf19a('0x5')](_0xf19a('0x13'),_0x595a2f,_0xebca49?'found':'notfound');return _0x36be58(_0xebca49);})[_0xf19a('0x14')](function(_0x4eed13){logger[_0xf19a('0x8')](_0xf19a('0x15'),_0x4eed13?util[_0xf19a('0x6')](_0x4eed13,{'showHidden':![],'depth':null}):'');return _0x36be58(null);});}return _0x36be58(null);});};exports['getUserByInterface']=function(_0x4ad0d3){return new BPromise(function(_0x1099ea,_0x228b3e){if(_0x4ad0d3){return getUser({'interface':_0x4ad0d3})[_0xf19a('0xa')](function(_0x4cf907){logger['info'](_0xf19a('0x16'),_0x4ad0d3,_0x4cf907?'found':_0xf19a('0x17'));return _0x1099ea(_0x4cf907);})['catch'](function(_0x5db06a){logger[_0xf19a('0x8')](_0xf19a('0x18'),_0x5db06a?util['inspect'](_0x5db06a,{'showHidden':![],'depth':null}):'');return _0x1099ea(null);});}return _0x1099ea(null);});};exports[_0xf19a('0x19')]=function(_0x518d66){return new BPromise(function(_0x374f5d,_0x446e12){if(_0x518d66){return getUser({'name':_0x518d66})[_0xf19a('0xa')](function(_0x2363e1){logger['info'](_0xf19a('0x1a'),_0x518d66,_0x2363e1?'found':_0xf19a('0x17'));return _0x374f5d(_0x2363e1);})[_0xf19a('0x14')](function(_0x4a3070){logger[_0xf19a('0x8')](_0xf19a('0x1b'),_0x4a3070?util[_0xf19a('0x6')](_0x4a3070,{'showHidden':![],'depth':null}):'');return _0x374f5d(null);});}return _0x374f5d(null);});};exports[_0xf19a('0x1c')]=function(_0xfdfdf7){return new BPromise(function(_0xcd9729,_0x1a22b3){if(_0xfdfdf7){return client[_0xf19a('0x9')](_0xf19a('0x1d'),{'options':{'raw':!![],'attributes':['id',_0xf19a('0xe'),_0xf19a('0x1e'),_0xf19a('0x1f'),_0xf19a('0x20')],'where':{'name':_0xfdfdf7},'limit':0x1}})['then'](function(_0x52d524){logger[_0xf19a('0x7')](_0xf19a('0x21'),_0xfdfdf7,_0x52d524?util[_0xf19a('0x6')](_0x52d524,{'showHidden':![],'depth':null}):'');logger[_0xf19a('0x5')](_0xf19a('0x22'),_0xfdfdf7,_0x52d524?_0xf19a('0x23'):_0xf19a('0x17'));return _0xcd9729(_0x52d524[_0xf19a('0x10')]['length']?_0x52d524[_0xf19a('0x10')][0x0]:null);})[_0xf19a('0x14')](function(_0x186a9b){logger[_0xf19a('0x8')](_0xf19a('0x24'),_0x186a9b?util[_0xf19a('0x6')](_0x186a9b,{'showHidden':![],'depth':null}):'');return _0xcd9729(null);});}return _0xcd9729(null);});};exports['addTime']=function(_0x4d491a,_0x59199b){return moment(_0x4d491a)[_0xf19a('0x25')](_0x59199b,_0xf19a('0x26'))[_0xf19a('0x27')](_0xf19a('0x28'));};exports[_0xf19a('0x29')]=function(_0x480bad,_0xf3c550){return moment(_0x480bad)[_0xf19a('0x2a')](_0xf3c550,_0xf19a('0x26'))[_0xf19a('0x27')](_0xf19a('0x28'));};exports[_0xf19a('0x2b')]=function(_0x300903,_0x568f87){return moment(_0x300903)['diff'](moment(_0x568f87),_0xf19a('0x26'));};exports['sumTime']=function(_0x76d2f8,_0x2b6b4){return parseInt(_0x76d2f8,0xa)+parseInt(_0x2b6b4,0xa);};exports[_0xf19a('0x2c')]=function(){return moment()['format'](_0xf19a('0x28'));};exports['isAfter']=function(_0x170271,_0x492734){if(_0x492734){return moment(_0x170271)['isAfter'](_0x492734);}return!![];};exports[_0xf19a('0x2d')]=function(_0x4cb17c,_0xf6cecf){if(_0xf6cecf){return moment(_0x4cb17c)[_0xf19a('0x2d')](_0xf6cecf);}else if(_0x4cb17c){return!![];}return![];}; \ No newline at end of file